OsIf_Timer_System_MicrosToTicks (uint32 Micros)
{
  uint32 CoreId;
  uint32 ticks;
  uint64 interim;
  uint32 D.4355;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  ticks = 0;
  # DEBUG BEGIN_STMT
  CoreId = 0;
  # DEBUG BEGIN_STMT
  _1 = OsIf_abMdlInit[CoreId];
  _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 != 0)
    goto <bb 6>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 5> :
  _3 = OsIf_apxInternalCfg[CoreId];
  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;
  _5 = OsIf_au32InternalFrequencies[CoreId];
  _6 = (long long unsigned int) _5;
  interim = _4 * _6;
  # DEBUG BEGIN_STMT
  interim = interim / 1000000;
  # DEBUG BEGIN_STMT
  _7 = interim <= 4294967295;
  DevAssert (_7);
  # DEBUG BEGIN_STMT
  ticks = (uint32) interim;

  <bb 8> :
  # DEBUG BEGIN_STMT
  D.4355 = ticks;
  return D.4355;

}


OsIf_Timer_System_SetTimerFrequency (uint32 Freq)
{
  uint32 CoreId;

  <bb 2> :
  # DEBUG BEGIN_STMT
  CoreId = 0;
  # DEBUG BEGIN_STMT
  _1 = OsIf_abMdlInit[CoreId];
  _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 != 0)
    goto <bb 6>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 5> :
  _3 = OsIf_apxInternalCfg[CoreId];
  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] = Freq;

  <bb 8> :
  return;

}


OsIf_Timer_System_GetElapsed (uint32 * const CurrentRef)
{
  uint32 CoreId;
  uint32 Elapsed;
  uint32 D.4334;

  <bb 2> :
  # DEBUG BEGIN_STMT
  Elapsed = 0;
  # DEBUG BEGIN_STMT
  CoreId = 0;
  # DEBUG BEGIN_STMT
  _1 = OsIf_abMdlInit[CoreId];
  _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 != 0)
    goto <bb 6>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 5> :
  _3 = OsIf_apxInternalCfg[CoreId];
  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 = OsIf_Timer_System_Internal_GetElapsed (CurrentRef);

  <bb 8> :
  # DEBUG BEGIN_STMT
  D.4334 = Elapsed;
  return D.4334;

}


OsIf_Timer_System_GetCounter ()
{
  uint32 CoreId;
  uint32 Counter;
  uint32 D.4323;

  <bb 2> :
  # DEBUG BEGIN_STMT
  Counter = 0;
  # DEBUG BEGIN_STMT
  CoreId = 0;
  # DEBUG BEGIN_STMT
  _1 = OsIf_abMdlInit[CoreId];
  _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 != 0)
    goto <bb 6>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 5> :
  _3 = OsIf_apxInternalCfg[CoreId];
  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 = OsIf_Timer_System_Internal_GetCounter ();

  <bb 8> :
  # DEBUG BEGIN_STMT
  D.4323 = Counter;
  return D.4323;

}


OsIf_Timer_System_Init ()
{
  uint32 CoreId;

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

  <bb 3> :
  _1 = OsIf_apxPredefinedConfig[CoreId];
  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] = 1;
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _2 = OsIf_apxPredefinedConfig[CoreId];
  OsIf_apxInternalCfg[CoreId] = _2;
  # DEBUG BEGIN_STMT
  _3 = OsIf_apxInternalCfg[CoreId];
  _4 = _3->counterFrequency;
  OsIf_au32InternalFrequencies[CoreId] = _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;
  uint32 D.4339;

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

  <bb 3> :
  # DEBUG BEGIN_STMT
  _4 = 3758153744B;
  _5 = _4->RVR;
  _6 = *CurrentRef;
  _7 = _6 - CurrentVal;
  dif = _5 + _7;
  goto <bb 5>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  _8 = *CurrentRef;
  dif = _8 - CurrentVal;

  <bb 5> :
  # DEBUG BEGIN_STMT
  *CurrentRef = CurrentVal;
  # DEBUG BEGIN_STMT
  D.4339 = dif;
  return D.4339;

}


OsIf_Timer_System_Internal_GetCounter ()
{
  uint32 D.4325;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = 3758153744B;
  _2 = _1->CVR;
  D.4325 = _2 & 16777215;
  return D.4325;

}


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

}


DevAssert (volatile boolean x)
{
  <bb 2> :
  # DEBUG BEGIN_STMT
  x.0_1 = 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;

}


