OsIf_Timer_System_MicrosToTicks (uint32 Micros)
{
  uint32 CoreId;
  uint32 ticks;
  uint64 interim;
  _Bool _1;
  _Bool _2;
  const struct OsIf_ConfigType * _3;
  long long unsigned int _4;
  long unsigned int _5;
  long long unsigned int _6;
  _Bool _7;
  uint32 _20;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  ticks_10 = 0;
  # DEBUG ticks => ticks_10
  # DEBUG BEGIN_STMT
  CoreId_11 = 0;
  # DEBUG CoreId => CoreId_11
  # DEBUG BEGIN_STMT
  _1 = OsIf_abMdlInit[CoreId_11];
  _2 = ~_1;
  if (_2 != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  DevAssert (0);
  goto <bb 8>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  if (CoreId_11 != 0)
    goto <bb 6>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 5> :
  _3 = OsIf_apxInternalCfg[CoreId_11];
  if (_3 == 0B)
    goto <bb 6>; [INV]
  else
    goto <bb 7>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  DevAssert (0);
  goto <bb 8>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  _4 = (long long unsigned int) Micros_13(D);
  _5 = OsIf_au32InternalFrequencies[CoreId_11];
  _6 = (long long unsigned int) _5;
  interim_14 = _4 * _6;
  # DEBUG interim => interim_14
  # DEBUG BEGIN_STMT
  interim_15 = interim_14 / 1000000;
  # DEBUG interim => interim_15
  # DEBUG BEGIN_STMT
  _7 = interim_15 <= 4294967295;
  DevAssert (_7);
  # DEBUG BEGIN_STMT
  ticks_17 = (uint32) interim_15;
  # DEBUG ticks => ticks_17

  <bb 8> :
  # ticks_8 = PHI <ticks_10(3), ticks_10(6), ticks_17(7)>
  # DEBUG ticks => ticks_8
  # DEBUG BEGIN_STMT
  _20 = ticks_8;
  return _20;

}


OsIf_Timer_System_SetTimerFrequency (uint32 Freq)
{
  uint32 CoreId;
  _Bool _1;
  _Bool _2;
  const struct OsIf_ConfigType * _3;

  <bb 2> :
  # DEBUG BEGIN_STMT
  CoreId_5 = 0;
  # DEBUG CoreId => CoreId_5
  # DEBUG BEGIN_STMT
  _1 = OsIf_abMdlInit[CoreId_5];
  _2 = ~_1;
  if (_2 != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  DevAssert (0);
  goto <bb 8>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  if (CoreId_5 != 0)
    goto <bb 6>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 5> :
  _3 = OsIf_apxInternalCfg[CoreId_5];
  if (_3 == 0B)
    goto <bb 6>; [INV]
  else
    goto <bb 7>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  DevAssert (0);
  goto <bb 8>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  OsIf_au32InternalFrequencies[CoreId_5] = Freq_7(D);

  <bb 8> :
  return;

}


OsIf_Timer_System_GetElapsed (uint32 * const CurrentRef)
{
  uint32 CoreId;
  uint32 Elapsed;
  _Bool _1;
  _Bool _2;
  const struct OsIf_ConfigType * _3;
  uint32 _14;

  <bb 2> :
  # DEBUG BEGIN_STMT
  Elapsed_6 = 0;
  # DEBUG Elapsed => Elapsed_6
  # DEBUG BEGIN_STMT
  CoreId_7 = 0;
  # DEBUG CoreId => CoreId_7
  # DEBUG BEGIN_STMT
  _1 = OsIf_abMdlInit[CoreId_7];
  _2 = ~_1;
  if (_2 != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  DevAssert (0);
  goto <bb 8>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  if (CoreId_7 != 0)
    goto <bb 6>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 5> :
  _3 = OsIf_apxInternalCfg[CoreId_7];
  if (_3 == 0B)
    goto <bb 6>; [INV]
  else
    goto <bb 7>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  DevAssert (0);
  goto <bb 8>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  Elapsed_11 = OsIf_Timer_System_Internal_GetElapsed (CurrentRef_9(D));
  # DEBUG Elapsed => Elapsed_11

  <bb 8> :
  # Elapsed_4 = PHI <Elapsed_6(3), Elapsed_6(6), Elapsed_11(7)>
  # DEBUG Elapsed => Elapsed_4
  # DEBUG BEGIN_STMT
  _14 = Elapsed_4;
  return _14;

}


OsIf_Timer_System_GetCounter ()
{
  uint32 CoreId;
  uint32 Counter;
  _Bool _1;
  _Bool _2;
  const struct OsIf_ConfigType * _3;
  uint32 _13;

  <bb 2> :
  # DEBUG BEGIN_STMT
  Counter_6 = 0;
  # DEBUG Counter => Counter_6
  # DEBUG BEGIN_STMT
  CoreId_7 = 0;
  # DEBUG CoreId => CoreId_7
  # DEBUG BEGIN_STMT
  _1 = OsIf_abMdlInit[CoreId_7];
  _2 = ~_1;
  if (_2 != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  DevAssert (0);
  goto <bb 8>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  if (CoreId_7 != 0)
    goto <bb 6>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 5> :
  _3 = OsIf_apxInternalCfg[CoreId_7];
  if (_3 == 0B)
    goto <bb 6>; [INV]
  else
    goto <bb 7>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  DevAssert (0);
  goto <bb 8>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  Counter_10 = OsIf_Timer_System_Internal_GetCounter ();
  # DEBUG Counter => Counter_10

  <bb 8> :
  # Counter_4 = PHI <Counter_6(3), Counter_6(6), Counter_10(7)>
  # DEBUG Counter => Counter_4
  # DEBUG BEGIN_STMT
  _13 = Counter_4;
  return _13;

}


OsIf_Timer_System_Init ()
{
  uint32 CoreId;
  const struct OsIf_ConfigType * _1;
  const struct OsIf_ConfigType * _2;
  const struct OsIf_ConfigType * _3;
  long unsigned int _4;

  <bb 2> :
  # DEBUG BEGIN_STMT
  CoreId_6 = 0;
  # DEBUG CoreId => CoreId_6
  # DEBUG BEGIN_STMT
  if (CoreId_6 != 0)
    goto <bb 4>; [INV]
  else
    goto <bb 3>; [INV]

  <bb 3> :
  _1 = OsIf_apxPredefinedConfig[CoreId_6];
  if (_1 == 0B)
    goto <bb 4>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  DevAssert (0);

  <bb 5> :
  # DEBUG BEGIN_STMT
  OsIf_abMdlInit[CoreId_6] = 1;
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _2 = OsIf_apxPredefinedConfig[CoreId_6];
  OsIf_apxInternalCfg[CoreId_6] = _2;
  # DEBUG BEGIN_STMT
  _3 = OsIf_apxInternalCfg[CoreId_6];
  _4 = _3->counterFrequency;
  OsIf_au32InternalFrequencies[CoreId_6] = _4;
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  OsIf_Timer_System_Internal_Init ();
  return;

}


OsIf_Timer_System_Internal_GetElapsed (uint32 * const CurrentRef)
{
  uint32 dif;
  uint32 CurrentVal;
  struct S32_SysTick_Type * _1;
  long unsigned int _2;
  long unsigned int _3;
  struct S32_SysTick_Type * _4;
  long unsigned int _5;
  long unsigned int _6;
  long unsigned int _7;
  long unsigned int _8;
  uint32 _17;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = 3758153744B;
  _2 ={v} _1->CVR;
  CurrentVal_11 = _2 & 16777215;
  # DEBUG CurrentVal => CurrentVal_11
  # DEBUG BEGIN_STMT
  dif_12 = 0;
  # DEBUG dif => dif_12
  # DEBUG BEGIN_STMT
  _3 = *CurrentRef_13(D);
  if (CurrentVal_11 > _3)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  _4 = 3758153744B;
  _5 ={v} _4->RVR;
  _6 = *CurrentRef_13(D);
  _7 = _6 - CurrentVal_11;
  dif_15 = _5 + _7;
  # DEBUG dif => dif_15
  goto <bb 5>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  _8 = *CurrentRef_13(D);
  dif_14 = _8 - CurrentVal_11;
  # DEBUG dif => dif_14

  <bb 5> :
  # dif_9 = PHI <dif_15(3), dif_14(4)>
  # DEBUG dif => dif_9
  # DEBUG BEGIN_STMT
  *CurrentRef_13(D) = CurrentVal_11;
  # DEBUG BEGIN_STMT
  _17 = dif_9;
  return _17;

}


OsIf_Timer_System_Internal_GetCounter ()
{
  struct S32_SysTick_Type * _1;
  long unsigned int _2;
  uint32 _4;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = 3758153744B;
  _2 ={v} _1->CVR;
  _4 = _2 & 16777215;
  return _4;

}


OsIf_Timer_System_Internal_Init ()
{
  struct S32_SysTick_Type * _1;
  struct S32_SysTick_Type * _2;
  struct S32_SysTick_Type * _3;
  struct S32_SysTick_Type * _4;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = 3758153744B;
  _1->CSRr ={v} 0;
  # DEBUG BEGIN_STMT
  _2 = 3758153744B;
  _2->RVR ={v} 16777215;
  # DEBUG BEGIN_STMT
  _3 = 3758153744B;
  _3->CVR ={v} 0;
  # DEBUG BEGIN_STMT
  _4 = 3758153744B;
  _4->CSRr ={v} 5;
  return;

}


DevAssert (volatile boolean x)
{
  _Bool x.0_1;

  <bb 2> :
  # DEBUG BEGIN_STMT
  x.0_1 ={v} x;
  if (x.0_1 != 0)
    goto <bb 4>; [INV]
  else
    goto <bb 3>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  goto <bb 3>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  return;

}


