Dem_BufferOverflow ()
{
  uint32 u32CoreId;
  boolean D.5750;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = Sys_GetCoreID ();
  u32CoreId = (uint32) _1;
  # DEBUG BEGIN_STMT
  D.5750 = Dem_OverflowEvent[u32CoreId];
  return D.5750;

}


Dem_GetEventCount ()
{
  uint32 u32CoreId;
  uint32 D.5748;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = Sys_GetCoreID ();
  u32CoreId = (uint32) _1;
  # DEBUG BEGIN_STMT
  D.5748 = Dem_numEventErrors[u32CoreId];
  return D.5748;

}


Dem_GetEvent (uint32 IndexNumber, Dem_EventIdType * EventId, Dem_EventStatusType * EventStatus)
{
  uint32 u32CoreId;
  boolean result;
  boolean D.5746;

  <bb 2> :
  # DEBUG BEGIN_STMT
  result = 0;
  # DEBUG BEGIN_STMT
  _1 = Sys_GetCoreID ();
  u32CoreId = (uint32) _1;
  # DEBUG BEGIN_STMT
  _2 = Dem_numEventErrors[u32CoreId];
  if (IndexNumber < _2)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  _3 = Dem_EventId[u32CoreId][IndexNumber];
  *EventId = _3;
  # DEBUG BEGIN_STMT
  _4 = Dem_EventStatus[u32CoreId][IndexNumber];
  *EventStatus = _4;
  goto <bb 5>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  result = 1;

  <bb 5> :
  # DEBUG BEGIN_STMT
  D.5746 = result;
  return D.5746;

}


Dem_ClearEvents ()
{
  uint32 u32CoreId;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = Sys_GetCoreID ();
  u32CoreId = (uint32) _1;
  # DEBUG BEGIN_STMT
  Dem_numEventErrors[u32CoreId] = 0;
  return;

}


Dem_TestLastReportErrorStatusPreExtData (Dem_EventIdType Dem_EventIdRaw, Dem_EventStatusType Dem_EventStatusRaw, uint8 * Dem_pui8_PreExtData, uint8 Dem_PreExtDataSize)
{
  uint32 u32CoreId;
  uint8 u8Counter;
  uint32 counterUp;
  sint32 counterDown;
  boolean bRetValue;
  boolean D.5741;

  <bb 2> :
  # DEBUG BEGIN_STMT
  bRetValue = 1;
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _1 = Sys_GetCoreID ();
  u32CoreId = (uint32) _1;
  # DEBUG BEGIN_STMT
  _2 = Dem_numEventErrors[u32CoreId];
  _3 = _2 + 4294967295;
  counterDown = (sint32) _3;
  goto <bb 17>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  _4 = Dem_EventId[u32CoreId][counterDown];
  if (Dem_EventIdRaw == _4)
    goto <bb 4>; [INV]
  else
    goto <bb 16>; [INV]

  <bb 4> :
  _5 = Dem_EventStatus[u32CoreId][counterDown];
  if (Dem_EventStatusRaw == _5)
    goto <bb 5>; [INV]
  else
    goto <bb 16>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  u8Counter = 0;
  goto <bb 11>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  _6 = (sizetype) u8Counter;
  _7 = Dem_pui8_PreExtData + _6;
  _8 = *_7;
  if (_8 == 165)
    goto <bb 7>; [INV]
  else
    goto <bb 8>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  // predicted unlikely by continue predictor.
  goto <bb 10>; [INV]

  <bb 8> :
  # DEBUG BEGIN_STMT
  _9 = (sizetype) u8Counter;
  _10 = Dem_pui8_PreExtData + _9;
  _11 = *_10;
  _12 = (int) u8Counter;
  _13 = Dem_au8ExtendedData[u32CoreId][_12];
  if (_11 != _13)
    goto <bb 9>; [INV]
  else
    goto <bb 10>; [INV]

  <bb 9> :
  # DEBUG BEGIN_STMT
  bRetValue = 0;

  <bb 10> :
  # DEBUG BEGIN_STMT
  u8Counter.0_14 = u8Counter;
  u8Counter = u8Counter.0_14 + 1;

  <bb 11> :
  # DEBUG BEGIN_STMT
  if (u8Counter < Dem_PreExtDataSize)
    goto <bb 6>; [INV]
  else
    goto <bb 12>; [INV]

  <bb 12> :
  # DEBUG BEGIN_STMT
  counterUp = (uint32) counterDown;
  goto <bb 14>; [INV]

  <bb 13> :
  # DEBUG BEGIN_STMT
  _15 = counterUp + 1;
  _16 = Dem_EventId[u32CoreId][_15];
  Dem_EventId[u32CoreId][counterUp] = _16;
  # DEBUG BEGIN_STMT
  _17 = counterUp + 1;
  _18 = Dem_EventStatus[u32CoreId][_17];
  Dem_EventStatus[u32CoreId][counterUp] = _18;
  # DEBUG BEGIN_STMT
  counterUp = counterUp + 1;

  <bb 14> :
  # DEBUG BEGIN_STMT
  _19 = Dem_numEventErrors[u32CoreId];
  _20 = _19 + 4294967295;
  if (counterUp < _20)
    goto <bb 13>; [INV]
  else
    goto <bb 15>; [INV]

  <bb 15> :
  # DEBUG BEGIN_STMT
  _21 = Dem_numEventErrors[u32CoreId];
  _22 = _21 + 4294967295;
  Dem_numEventErrors[u32CoreId] = _22;
  # DEBUG BEGIN_STMT
  goto <bb 18>; [INV]

  <bb 16> :
  # DEBUG BEGIN_STMT
  counterDown = counterDown + -1;

  <bb 17> :
  # DEBUG BEGIN_STMT
  if (counterDown >= 0)
    goto <bb 3>; [INV]
  else
    goto <bb 18>; [INV]

  <bb 18> :
  # DEBUG BEGIN_STMT
  u8Counter = 0;
  goto <bb 20>; [INV]

  <bb 19> :
  # DEBUG BEGIN_STMT
  _23 = (int) u8Counter;
  Dem_au8ExtendedData[u32CoreId][_23] = 0;
  # DEBUG BEGIN_STMT
  u8Counter.1_24 = u8Counter;
  u8Counter = u8Counter.1_24 + 1;

  <bb 20> :
  # DEBUG BEGIN_STMT
  if (u8Counter <= 99)
    goto <bb 19>; [INV]
  else
    goto <bb 21>; [INV]

  <bb 21> :
  # DEBUG BEGIN_STMT
  D.5741 = bRetValue;
  return D.5741;

}


Dem_TestNoError ()
{
  uint32 u32CoreId;
  uint32 counter;
  boolean result;
  boolean D.5731;

  <bb 2> :
  # DEBUG BEGIN_STMT
  result = 1;
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _1 = Sys_GetCoreID ();
  u32CoreId = (uint32) _1;
  # DEBUG BEGIN_STMT
  counter = 0;
  goto <bb 7>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  _2 = Dem_EventStatus[u32CoreId][counter];
  if (_2 == 1)
    goto <bb 5>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 4> :
  _3 = Dem_EventStatus[u32CoreId][counter];
  if (_3 == 3)
    goto <bb 5>; [INV]
  else
    goto <bb 6>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  result = 0;
  # DEBUG BEGIN_STMT
  goto <bb 8>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  counter = counter + 1;

  <bb 7> :
  # DEBUG BEGIN_STMT
  _4 = Dem_numEventErrors[u32CoreId];
  if (counter < _4)
    goto <bb 3>; [INV]
  else
    goto <bb 8>; [INV]

  <bb 8> :
  # DEBUG BEGIN_STMT
  Dem_numEventErrors[u32CoreId] = 0;
  # DEBUG BEGIN_STMT
  D.5731 = result;
  return D.5731;

}


Dem_TestLastReportErrorStatus (Dem_EventIdType EventId, Dem_EventStatusType EventStatus)
{
  uint32 u32CoreId;
  uint32 counterUp;
  sint32 counterDown;
  boolean result;
  boolean D.5726;

  <bb 2> :
  # DEBUG BEGIN_STMT
  result = 0;
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _1 = Sys_GetCoreID ();
  u32CoreId = (uint32) _1;
  # DEBUG BEGIN_STMT
  _2 = Dem_numEventErrors[u32CoreId];
  _3 = _2 + 4294967295;
  counterDown = (sint32) _3;
  goto <bb 10>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  _4 = Dem_EventId[u32CoreId][counterDown];
  if (EventId == _4)
    goto <bb 4>; [INV]
  else
    goto <bb 9>; [INV]

  <bb 4> :
  _5 = Dem_EventStatus[u32CoreId][counterDown];
  if (EventStatus == _5)
    goto <bb 5>; [INV]
  else
    goto <bb 9>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  result = 1;
  # DEBUG BEGIN_STMT
  counterUp = (uint32) counterDown;
  goto <bb 7>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  _6 = counterUp + 1;
  _7 = Dem_EventId[u32CoreId][_6];
  Dem_EventId[u32CoreId][counterUp] = _7;
  # DEBUG BEGIN_STMT
  _8 = counterUp + 1;
  _9 = Dem_EventStatus[u32CoreId][_8];
  Dem_EventStatus[u32CoreId][counterUp] = _9;
  # DEBUG BEGIN_STMT
  counterUp = counterUp + 1;

  <bb 7> :
  # DEBUG BEGIN_STMT
  _10 = Dem_numEventErrors[u32CoreId];
  _11 = _10 + 4294967295;
  if (counterUp < _11)
    goto <bb 6>; [INV]
  else
    goto <bb 8>; [INV]

  <bb 8> :
  # DEBUG BEGIN_STMT
  _12 = Dem_numEventErrors[u32CoreId];
  _13 = _12 + 4294967295;
  Dem_numEventErrors[u32CoreId] = _13;
  # DEBUG BEGIN_STMT
  goto <bb 11>; [INV]

  <bb 9> :
  # DEBUG BEGIN_STMT
  counterDown = counterDown + -1;

  <bb 10> :
  # DEBUG BEGIN_STMT
  if (counterDown >= 0)
    goto <bb 3>; [INV]
  else
    goto <bb 11>; [INV]

  <bb 11> :
  # DEBUG BEGIN_STMT
  D.5726 = result;
  return D.5726;

}


