FlexCAN_Ip_ManualBusOffRecovery (uint8 Instance)
{
  Flexcan_Ip_StatusType RetVal;
  uint32 uS2Ticks;
  uint32 timeElapsed;
  uint32 timeStart;
  struct FLEXCAN_Type * Base;
  Flexcan_Ip_StatusType D.8252;
  long unsigned int D.8249;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = (int) Instance;
  Base = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  timeStart = 0;
  # DEBUG BEGIN_STMT
  timeElapsed = 0;
  # DEBUG BEGIN_STMT
  uS2Ticks = OsIf_MicrosToTicks (1000000, 0);
  # DEBUG BEGIN_STMT
  RetVal = 1;
  # DEBUG BEGIN_STMT
  _2 = Base->CTRL1;
  _3 = _2 & 64;
  if (_3 != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 8>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  RetVal = 0;
  # DEBUG BEGIN_STMT
  _4 = Base->ESR1;
  _5 = _4 & 32;
  if (_5 != 0)
    goto <bb 4>; [INV]
  else
    goto <bb 8>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  SchM_Enter_Can_CAN_EXCLUSIVE_AREA_20 ();
  # DEBUG BEGIN_STMT
  _6 = Base->CTRL1;
  _7 = _6 & 4294967231;
  Base->CTRL1 = _7;
  # DEBUG BEGIN_STMT
  _8 = Base->CTRL1;
  _9 = _8 | 64;
  Base->CTRL1 = _9;
  # DEBUG BEGIN_STMT
  SchM_Exit_Can_CAN_EXCLUSIVE_AREA_20 ();
  # DEBUG BEGIN_STMT
  _10 = OsIf_GetCounter (0);
  timeStart = _10;
  # DEBUG BEGIN_STMT
  goto <bb 7>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  D.8249 = OsIf_GetElapsed (&timeStart, 0);
  timeElapsed = D.8249 + timeElapsed;
  # DEBUG BEGIN_STMT
  if (timeElapsed >= uS2Ticks)
    goto <bb 6>; [INV]
  else
    goto <bb 7>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  RetVal = 3;
  # DEBUG BEGIN_STMT
  goto <bb 8>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  _11 = Base->ESR1;
  _12 = _11 & 32;
  if (_12 != 0)
    goto <bb 5>; [INV]
  else
    goto <bb 8>; [INV]

  <bb 8> :
  # DEBUG BEGIN_STMT
  D.8252 = RetVal;
  timeStart = {CLOBBER};
  return D.8252;

}


FlexCAN_WakeUp_IRQHandler (uint8 u8Instance)
{
  const struct Flexcan_Ip_StateType * pState;
  struct FLEXCAN_Type * pBase;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = (int) u8Instance;
  pBase = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  _2 = (int) u8Instance;
  pState = Flexcan_Ip_apxState[_2];
  # DEBUG BEGIN_STMT
  if (pState != 0B)
    goto <bb 3>; [INV]
  else
    goto <bb 11>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  _3 = FlexCAN_GetWTOF (pBase);
  if (_3 != 0)
    goto <bb 4>; [INV]
  else
    goto <bb 7>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  FlexCAN_ClearWTOF (pBase);
  # DEBUG BEGIN_STMT
  _4 = FlexCAN_GetWTOIE (pBase);
  if (_4 != 0)
    goto <bb 5>; [INV]
  else
    goto <bb 7>; [INV]

  <bb 5> :
  _5 = pState->callback;
  if (_5 != 0B)
    goto <bb 6>; [INV]
  else
    goto <bb 7>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  _6 = pState->callback;
  _6 (u8Instance, 5, 0, pState);

  <bb 7> :
  # DEBUG BEGIN_STMT
  _7 = FlexCAN_GetWUMF (pBase);
  if (_7 != 0)
    goto <bb 8>; [INV]
  else
    goto <bb 12>; [INV]

  <bb 8> :
  # DEBUG BEGIN_STMT
  FlexCAN_ClearWUMF (pBase);
  # DEBUG BEGIN_STMT
  _8 = FlexCAN_GetWUMIE (pBase);
  if (_8 != 0)
    goto <bb 9>; [INV]
  else
    goto <bb 12>; [INV]

  <bb 9> :
  _9 = pState->callback;
  if (_9 != 0B)
    goto <bb 10>; [INV]
  else
    goto <bb 12>; [INV]

  <bb 10> :
  # DEBUG BEGIN_STMT
  _10 = pState->callback;
  _10 (u8Instance, 6, 0, pState);
  goto <bb 12>; [INV]

  <bb 11> :
  # DEBUG BEGIN_STMT
  FlexCAN_ClearWTOF (pBase);
  # DEBUG BEGIN_STMT
  FlexCAN_ClearWUMF (pBase);

  <bb 12> :
  return;

}


FlexCAN_Ip_GetWMB (uint8 u8Instance, uint8 u8WmbIndex, struct Flexcan_Ip_MsgBuffType * pWmb)
{
  uint32 pWmbData;
  uint32 * pTmp;
  const struct FLEXCAN_Type * pBase;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = (int) u8Instance;
  pBase = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  pTmp = &pWmb->data[0];
  # DEBUG BEGIN_STMT
  _2 = (int) u8WmbIndex;
  pWmbData = pBase->WMB[_2].WMBn_D03;
  # DEBUG BEGIN_STMT
  _3 = pWmbData >> 24;
  _4 = pWmbData >> 8;
  _5 = _4 & 65280;
  _6 = _3 | _5;
  _7 = pWmbData << 8;
  _8 = _7 & 16711680;
  _9 = _6 | _8;
  _10 = pWmbData << 24;
  _11 = _9 | _10;
  *pTmp = _11;
  # DEBUG BEGIN_STMT
  pTmp = &pWmb->data[4];
  # DEBUG BEGIN_STMT
  _12 = (int) u8WmbIndex;
  pWmbData = pBase->WMB[_12].WMBn_D47;
  # DEBUG BEGIN_STMT
  _13 = pWmbData >> 24;
  _14 = pWmbData >> 8;
  _15 = _14 & 65280;
  _16 = _13 | _15;
  _17 = pWmbData << 8;
  _18 = _17 & 16711680;
  _19 = _16 | _18;
  _20 = pWmbData << 24;
  _21 = _19 | _20;
  *pTmp = _21;
  # DEBUG BEGIN_STMT
  _22 = (int) u8WmbIndex;
  _23 = pBase->WMB[_22].WMBn_CS;
  pWmb->cs = _23;
  # DEBUG BEGIN_STMT
  _24 = pWmb->cs;
  _25 = _24 & 2097152;
  if (_25 != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  _26 = (int) u8WmbIndex;
  _27 = pBase->WMB[_26].WMBn_ID;
  pWmb->msgId = _27;
  goto <bb 5>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  _28 = (int) u8WmbIndex;
  _29 = pBase->WMB[_28].WMBn_ID;
  _30 = _29 >> 18;
  pWmb->msgId = _30;

  <bb 5> :
  # DEBUG BEGIN_STMT
  _31 = pWmb->cs;
  _32 = _31 >> 16;
  _33 = (unsigned char) _32;
  _34 = _33 & 15;
  pWmb->dataLen = _34;
  return;

}


FlexCAN_Ip_ConfigPN_Privileged (uint8 u8Instance, boolean bEnable, const struct Flexcan_Ip_PnConfigType * pPnConfig)
{
  boolean disabled;
  struct FLEXCAN_Type * pBase;
  Flexcan_Ip_StatusType status;
  Flexcan_Ip_StatusType result;
  Flexcan_Ip_StatusType D.8213;

  <bb 2> :
  # DEBUG BEGIN_STMT
  result = 0;
  # DEBUG BEGIN_STMT
  status = 0;
  # DEBUG BEGIN_STMT
  _1 = (int) u8Instance;
  pBase = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  _2 = FlexCAN_IsEnabled (pBase);
  _3 = (int) _2;
  _4 = _3 != 0;
  _5 = ~_4;
  _6 = (int) _5;
  disabled = (boolean) _6;
  # DEBUG BEGIN_STMT
  if (u8Instance == 0)
    goto <bb 3>; [INV]
  else
    goto <bb 12>; [INV]

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

  <bb 4> :
  # DEBUG BEGIN_STMT
  result = FlexCAN_Enable (pBase);

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

  <bb 6> :
  # DEBUG BEGIN_STMT
  if (bEnable != 0)
    goto <bb 7>; [INV]
  else
    goto <bb 8>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  FlexCAN_ConfigPN (pBase, pPnConfig);

  <bb 8> :
  # DEBUG BEGIN_STMT
  SchM_Enter_Can_CAN_EXCLUSIVE_AREA_12 ();
  # DEBUG BEGIN_STMT
  FlexCAN_SetPN (pBase, bEnable);
  # DEBUG BEGIN_STMT
  SchM_Exit_Can_CAN_EXCLUSIVE_AREA_12 ();

  <bb 9> :
  # DEBUG BEGIN_STMT
  if (disabled != 0)
    goto <bb 10>; [INV]
  else
    goto <bb 13>; [INV]

  <bb 10> :
  # DEBUG BEGIN_STMT
  status = FlexCAN_Disable (pBase);
  # DEBUG BEGIN_STMT
  if (status != 0)
    goto <bb 11>; [INV]
  else
    goto <bb 13>; [INV]

  <bb 11> :
  # DEBUG BEGIN_STMT
  result = status;
  goto <bb 13>; [INV]

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

  <bb 13> :
  # DEBUG BEGIN_STMT
  D.8213 = result;
  return D.8213;

}


FlexCAN_Ip_GetListenOnlyMode (uint8 instance)
{
  const struct FLEXCAN_Type * base;
  boolean D.8198;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = (int) instance;
  base = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  D.8198 = FlexCAN_IsListenOnlyModeEnabled (base);
  return D.8198;

}


FlexCAN_Ip_SetListenOnlyMode_Privileged (uint8 instance, const boolean enable)
{
  boolean disabled;
  struct FLEXCAN_Type * pBase;
  Flexcan_Ip_StatusType status;
  Flexcan_Ip_StatusType result;
  Flexcan_Ip_StatusType D.8192;

  <bb 2> :
  # DEBUG BEGIN_STMT
  result = 0;
  # DEBUG BEGIN_STMT
  status = 0;
  # DEBUG BEGIN_STMT
  _1 = (int) instance;
  pBase = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  _2 = FlexCAN_IsEnabled (pBase);
  _3 = (int) _2;
  _4 = _3 != 0;
  _5 = ~_4;
  _6 = (int) _5;
  disabled = (boolean) _6;
  # DEBUG BEGIN_STMT
  if (disabled != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  result = FlexCAN_Enable (pBase);

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

  <bb 5> :
  # DEBUG BEGIN_STMT
  SchM_Enter_Can_CAN_EXCLUSIVE_AREA_10 ();
  # DEBUG BEGIN_STMT
  FlexCAN_SetListenOnlyMode (pBase, enable);
  # DEBUG BEGIN_STMT
  SchM_Exit_Can_CAN_EXCLUSIVE_AREA_10 ();

  <bb 6> :
  # DEBUG BEGIN_STMT
  if (disabled != 0)
    goto <bb 7>; [INV]
  else
    goto <bb 9>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  status = FlexCAN_Disable (pBase);
  # DEBUG BEGIN_STMT
  if (status != 0)
    goto <bb 8>; [INV]
  else
    goto <bb 9>; [INV]

  <bb 8> :
  # DEBUG BEGIN_STMT
  result = status;

  <bb 9> :
  # DEBUG BEGIN_STMT
  D.8192 = result;
  return D.8192;

}


FlexCAN_Ip_SetRxMb15Mask_Privileged (uint8 instance, uint32 mask)
{
  boolean disabled;
  struct FLEXCAN_Type * pBase;
  Flexcan_Ip_StatusType status;
  Flexcan_Ip_StatusType result;
  Flexcan_Ip_StatusType D.8182;

  <bb 2> :
  # DEBUG BEGIN_STMT
  result = 0;
  # DEBUG BEGIN_STMT
  status = 0;
  # DEBUG BEGIN_STMT
  _1 = (int) instance;
  pBase = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  _2 = FlexCAN_IsEnabled (pBase);
  _3 = (int) _2;
  _4 = _3 != 0;
  _5 = ~_4;
  _6 = (int) _5;
  disabled = (boolean) _6;
  # DEBUG BEGIN_STMT
  if (disabled != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  result = FlexCAN_Enable (pBase);

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

  <bb 5> :
  # DEBUG BEGIN_STMT
  pBase->RX15MASK = mask;

  <bb 6> :
  # DEBUG BEGIN_STMT
  if (disabled != 0)
    goto <bb 7>; [INV]
  else
    goto <bb 9>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  status = FlexCAN_Disable (pBase);
  # DEBUG BEGIN_STMT
  if (status != 0)
    goto <bb 8>; [INV]
  else
    goto <bb 9>; [INV]

  <bb 8> :
  # DEBUG BEGIN_STMT
  result = status;

  <bb 9> :
  # DEBUG BEGIN_STMT
  D.8182 = result;
  return D.8182;

}


FlexCAN_Ip_SetRxMb14Mask_Privileged (uint8 instance, uint32 mask)
{
  boolean disabled;
  struct FLEXCAN_Type * pBase;
  Flexcan_Ip_StatusType status;
  Flexcan_Ip_StatusType result;
  Flexcan_Ip_StatusType D.8172;

  <bb 2> :
  # DEBUG BEGIN_STMT
  result = 0;
  # DEBUG BEGIN_STMT
  status = 0;
  # DEBUG BEGIN_STMT
  _1 = (int) instance;
  pBase = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  _2 = FlexCAN_IsEnabled (pBase);
  _3 = (int) _2;
  _4 = _3 != 0;
  _5 = ~_4;
  _6 = (int) _5;
  disabled = (boolean) _6;
  # DEBUG BEGIN_STMT
  if (disabled != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  result = FlexCAN_Enable (pBase);

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

  <bb 5> :
  # DEBUG BEGIN_STMT
  pBase->RX14MASK = mask;

  <bb 6> :
  # DEBUG BEGIN_STMT
  if (disabled != 0)
    goto <bb 7>; [INV]
  else
    goto <bb 9>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  status = FlexCAN_Disable (pBase);
  # DEBUG BEGIN_STMT
  if (status != 0)
    goto <bb 8>; [INV]
  else
    goto <bb 9>; [INV]

  <bb 8> :
  # DEBUG BEGIN_STMT
  result = status;

  <bb 9> :
  # DEBUG BEGIN_STMT
  D.8172 = result;
  return D.8172;

}


FlexCAN_Ip_AbortTransfer (uint8 u8Instance, uint8 mb_idx)
{
  Flexcan_Ip_StatusType result;
  const struct Flexcan_Ip_StateType * state;
  struct FLEXCAN_Type * pBase;
  Flexcan_Ip_StatusType D.8141;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = (int) u8Instance;
  pBase = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  _2 = (int) u8Instance;
  state = Flexcan_Ip_apxState[_2];
  # DEBUG BEGIN_STMT
  result = 0;
  # DEBUG BEGIN_STMT
  if (mb_idx <= 31)
    goto <bb 3>; [INV]
  else
    goto <bb 9>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  _3 = (int) mb_idx;
  _4 = state->mbs[_3].state;
  if (_4 == 0)
    goto <bb 4>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  result = 5;
  goto <bb 9>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  _5 = (long unsigned int) mb_idx;
  _6 = state->isIntActive;
  FLEXCAN_ClearMsgBuffIntCmd (pBase, u8Instance, _5, _6);
  # DEBUG BEGIN_STMT
  _7 = (int) mb_idx;
  _8 = state->mbs[_7].state;
  if (_8 == 2)
    goto <bb 6>; [INV]
  else
    goto <bb 7>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  result = FlexCAN_AbortTxTransfer (u8Instance, mb_idx);

  <bb 7> :
  # DEBUG BEGIN_STMT
  _9 = (int) mb_idx;
  _10 = state->mbs[_9].state;
  if (_10 == 1)
    goto <bb 8>; [INV]
  else
    goto <bb 9>; [INV]

  <bb 8> :
  # DEBUG BEGIN_STMT
  FlexCAN_AbortRxTransfer (u8Instance, mb_idx);

  <bb 9> :
  # DEBUG BEGIN_STMT
  D.8141 = result;
  return D.8141;

}


FlexCAN_Ip_SetErrorInt_Privileged (uint8 u8Instance, Flexcan_Ip_ErrorIntType type, boolean enable)
{
  boolean disabled;
  struct FLEXCAN_Type * pBase;
  Flexcan_Ip_StatusType status;
  Flexcan_Ip_StatusType result;
  Flexcan_Ip_StatusType D.8129;

  <bb 2> :
  # DEBUG BEGIN_STMT
  result = 0;
  # DEBUG BEGIN_STMT
  status = 0;
  # DEBUG BEGIN_STMT
  _1 = (int) u8Instance;
  pBase = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  _2 = FlexCAN_IsEnabled (pBase);
  _3 = (int) _2;
  _4 = _3 != 0;
  _5 = ~_4;
  _6 = (int) _5;
  disabled = (boolean) _6;
  # DEBUG BEGIN_STMT
  if (disabled != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  result = FlexCAN_Enable (pBase);

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

  <bb 5> :
  # DEBUG BEGIN_STMT
  switch (type) <default: <L16> [INV], case 0: <L6> [INV], case 1: <L7> [INV], case 2: <L4> [INV], case 3: <L5> [INV], case 4: <L3> [INV]>

  <bb 6> :
<L3>:
  # DEBUG BEGIN_STMT
  FlexCAN_SetErrIntCmd (pBase, 32768, enable);
  # DEBUG BEGIN_STMT
  goto <bb 11>; [INV]

  <bb 7> :
<L4>:
  # DEBUG BEGIN_STMT
  FlexCAN_SetErrIntCmd (pBase, 16384, enable);
  # DEBUG BEGIN_STMT
  goto <bb 11>; [INV]

  <bb 8> :
<L5>:
  # DEBUG BEGIN_STMT
  FlexCAN_SetErrIntCmd (pBase, 16385, enable);
  # DEBUG BEGIN_STMT
  goto <bb 11>; [INV]

  <bb 9> :
<L6>:
  # DEBUG BEGIN_STMT
  FlexCAN_SetErrIntCmd (pBase, 1024, enable);
  # DEBUG BEGIN_STMT
  goto <bb 11>; [INV]

  <bb 10> :
<L7>:
  # DEBUG BEGIN_STMT
  FlexCAN_SetErrIntCmd (pBase, 2048, enable);
  # DEBUG BEGIN_STMT

  <bb 11> :
<L16>:
  # DEBUG BEGIN_STMT
  if (disabled != 0)
    goto <bb 12>; [INV]
  else
    goto <bb 14>; [INV]

  <bb 12> :
  # DEBUG BEGIN_STMT
  status = FlexCAN_Disable (pBase);
  # DEBUG BEGIN_STMT
  if (status != 0)
    goto <bb 13>; [INV]
  else
    goto <bb 14>; [INV]

  <bb 13> :
  # DEBUG BEGIN_STMT
  result = status;

  <bb 14> :
  # DEBUG BEGIN_STMT
  D.8129 = result;
  return D.8129;

}


FlexCAN_Ip_DisableInterrupts_Privileged (uint8 u8Instance)
{
  struct Flexcan_Ip_StateType * state;
  Flexcan_Ip_StatusType result;
  struct FLEXCAN_Type * pBase;
  Flexcan_Ip_StatusType D.8119;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = (int) u8Instance;
  pBase = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  result = 1;
  # DEBUG BEGIN_STMT
  _2 = (int) u8Instance;
  state = Flexcan_Ip_apxState[_2];
  # DEBUG BEGIN_STMT
  _3 = FlexCAN_IsEnabled (pBase);
  if (_3 != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  FlexCAN_DisableInterrupts (pBase);
  # DEBUG BEGIN_STMT
  state->isIntActive = 0;
  # DEBUG BEGIN_STMT
  result = 0;

  <bb 4> :
  # DEBUG BEGIN_STMT
  D.8119 = result;
  return D.8119;

}


FlexCAN_Ip_EnableInterrupts_Privileged (uint8 u8Instance)
{
  struct Flexcan_Ip_StateType * state;
  Flexcan_Ip_StatusType result;
  struct FLEXCAN_Type * pBase;
  Flexcan_Ip_StatusType D.8115;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = (int) u8Instance;
  pBase = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  result = 1;
  # DEBUG BEGIN_STMT
  _2 = (int) u8Instance;
  state = Flexcan_Ip_apxState[_2];
  # DEBUG BEGIN_STMT
  _3 = FlexCAN_IsEnabled (pBase);
  if (_3 != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  FlexCAN_EnableInterrupts (pBase, u8Instance);
  # DEBUG BEGIN_STMT
  state->isIntActive = 1;
  # DEBUG BEGIN_STMT
  result = 0;

  <bb 4> :
  # DEBUG BEGIN_STMT
  D.8115 = result;
  return D.8115;

}


FlexCAN_Ip_ClearBuffStatusFlag (uint8 instance, uint8 msgBuffIdx)
{
  struct FLEXCAN_Type * pBase;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = (int) instance;
  pBase = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  _2 = (long unsigned int) msgBuffIdx;
  FlexCAN_ClearMsgBuffIntStatusFlag (pBase, _2);
  return;

}


FlexCAN_Ip_GetBuffStatusFlag (uint8 instance, uint8 msgBuffIdx)
{
  const struct FLEXCAN_Type * pBase;
  boolean returnResult;
  boolean D.8111;

  <bb 2> :
  # DEBUG BEGIN_STMT
  returnResult = 1;
  # DEBUG BEGIN_STMT
  _1 = (int) instance;
  pBase = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  _2 = (long unsigned int) msgBuffIdx;
  _3 = FlexCAN_GetBuffStatusFlag (pBase, _2);
  returnResult = _3 == 1;
  # DEBUG BEGIN_STMT
  D.8111 = returnResult;
  return D.8111;

}


FlexCAN_Ip_SetTxArbitrationStartDelay_Privileged (uint8 instance, uint8 value)
{
  boolean disabled;
  struct FLEXCAN_Type * pBase;
  Flexcan_Ip_StatusType status;
  Flexcan_Ip_StatusType result;
  Flexcan_Ip_StatusType D.8109;

  <bb 2> :
  # DEBUG BEGIN_STMT
  result = 0;
  # DEBUG BEGIN_STMT
  status = 0;
  # DEBUG BEGIN_STMT
  _1 = (int) instance;
  pBase = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  _2 = FlexCAN_IsEnabled (pBase);
  _3 = (int) _2;
  _4 = _3 != 0;
  _5 = ~_4;
  _6 = (int) _5;
  disabled = (boolean) _6;
  # DEBUG BEGIN_STMT
  if (disabled != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  result = FlexCAN_Enable (pBase);

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

  <bb 5> :
  # DEBUG BEGIN_STMT
  SchM_Enter_Can_CAN_EXCLUSIVE_AREA_17 ();
  # DEBUG BEGIN_STMT
  FlexCAN_SetTxArbitrationStartDelay (pBase, value);
  # DEBUG BEGIN_STMT
  SchM_Exit_Can_CAN_EXCLUSIVE_AREA_17 ();

  <bb 6> :
  # DEBUG BEGIN_STMT
  if (disabled != 0)
    goto <bb 7>; [INV]
  else
    goto <bb 9>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  status = FlexCAN_Disable (pBase);
  # DEBUG BEGIN_STMT
  if (status != 0)
    goto <bb 8>; [INV]
  else
    goto <bb 9>; [INV]

  <bb 8> :
  # DEBUG BEGIN_STMT
  result = status;

  <bb 9> :
  # DEBUG BEGIN_STMT
  D.8109 = result;
  return D.8109;

}


FlexCAN_Ip_SetTDCOffset_Privileged (uint8 instance, boolean enable, uint8 offset)
{
  boolean disabled;
  struct FLEXCAN_Type * pBase;
  Flexcan_Ip_StatusType status;
  Flexcan_Ip_StatusType result;
  Flexcan_Ip_StatusType D.8097;

  <bb 2> :
  # DEBUG BEGIN_STMT
  result = 0;
  # DEBUG BEGIN_STMT
  status = 0;
  # DEBUG BEGIN_STMT
  _1 = (int) instance;
  pBase = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  _2 = FlexCAN_IsEnabled (pBase);
  _3 = (int) _2;
  _4 = _3 != 0;
  _5 = ~_4;
  _6 = (int) _5;
  disabled = (boolean) _6;
  # DEBUG BEGIN_STMT
  if (disabled != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  result = FlexCAN_Enable (pBase);

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

  <bb 5> :
  # DEBUG BEGIN_STMT
  SchM_Enter_Can_CAN_EXCLUSIVE_AREA_16 ();
  # DEBUG BEGIN_STMT
  FlexCAN_SetTDCOffset (pBase, enable, offset);
  # DEBUG BEGIN_STMT
  SchM_Exit_Can_CAN_EXCLUSIVE_AREA_16 ();

  <bb 6> :
  # DEBUG BEGIN_STMT
  if (disabled != 0)
    goto <bb 7>; [INV]
  else
    goto <bb 9>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  status = FlexCAN_Disable (pBase);
  # DEBUG BEGIN_STMT
  if (status != 0)
    goto <bb 8>; [INV]
  else
    goto <bb 9>; [INV]

  <bb 8> :
  # DEBUG BEGIN_STMT
  result = status;

  <bb 9> :
  # DEBUG BEGIN_STMT
  D.8097 = result;
  return D.8097;

}


FlexCAN_Ip_GetBitrateFD (uint8 instance, struct Flexcan_Ip_TimeSegmentType * bitrate)
{
  boolean enhCbt;
  const struct FLEXCAN_Type * pBase;
  boolean D.8087;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = (int) instance;
  pBase = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  enhCbt = 0;
  # DEBUG BEGIN_STMT
  FlexCAN_GetFDTimeSegments (pBase, bitrate);
  # DEBUG BEGIN_STMT
  D.8087 = enhCbt;
  return D.8087;

}


FlexCAN_Ip_SetBitrateCbt_Privileged (uint8 instance, const struct Flexcan_Ip_TimeSegmentType * bitrate, boolean bitRateSwitch)
{
  boolean fd_enable;
  boolean disabled;
  struct FLEXCAN_Type * pBase;
  Flexcan_Ip_StatusType status;
  Flexcan_Ip_StatusType result;
  Flexcan_Ip_StatusType D.8083;

  <bb 2> :
  # DEBUG BEGIN_STMT
  result = 0;
  # DEBUG BEGIN_STMT
  status = 0;
  # DEBUG BEGIN_STMT
  _1 = (int) instance;
  pBase = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  _2 = FlexCAN_IsEnabled (pBase);
  _3 = (int) _2;
  _4 = _3 != 0;
  _5 = ~_4;
  _6 = (int) _5;
  disabled = (boolean) _6;
  # DEBUG BEGIN_STMT
  fd_enable = FlexCAN_IsFDEnabled (pBase);
  # DEBUG BEGIN_STMT
  if (disabled != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  result = FlexCAN_Enable (pBase);

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

  <bb 5> :
  # DEBUG BEGIN_STMT
  SchM_Enter_Can_CAN_EXCLUSIVE_AREA_15 ();
  # DEBUG BEGIN_STMT
  FlexCAN_SetFDEnabled (pBase, fd_enable, bitRateSwitch);
  # DEBUG BEGIN_STMT
  FlexCAN_SetFDTimeSegments (pBase, bitrate);
  # DEBUG BEGIN_STMT
  SchM_Exit_Can_CAN_EXCLUSIVE_AREA_15 ();

  <bb 6> :
  # DEBUG BEGIN_STMT
  if (disabled != 0)
    goto <bb 7>; [INV]
  else
    goto <bb 9>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  status = FlexCAN_Disable (pBase);
  # DEBUG BEGIN_STMT
  if (status != 0)
    goto <bb 8>; [INV]
  else
    goto <bb 9>; [INV]

  <bb 8> :
  # DEBUG BEGIN_STMT
  result = status;

  <bb 9> :
  # DEBUG BEGIN_STMT
  D.8083 = result;
  return D.8083;

}


FlexCAN_Ip_GetTDCValue (uint8 u8Instance)
{
  const struct FLEXCAN_Type * pBase;
  uint8 value;
  uint8 D.8073;

  <bb 2> :
  # DEBUG BEGIN_STMT
  value = 0;
  # DEBUG BEGIN_STMT
  _1 = (int) u8Instance;
  pBase = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  _2 = pBase->FDCTRL;
  _3 = (unsigned char) _2;
  value = _3 & 63;
  # DEBUG BEGIN_STMT
  D.8073 = value;
  return D.8073;

}


FlexCAN_Ip_GetTDCFail (uint8 u8Instance)
{
  const struct FLEXCAN_Type * pBase;
  boolean value;
  boolean D.8071;

  <bb 2> :
  # DEBUG BEGIN_STMT
  value = 0;
  # DEBUG BEGIN_STMT
  _1 = (int) u8Instance;
  pBase = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  _2 = pBase->FDCTRL;
  _3 = _2 & 16384;
  value = _3 == 16384;
  # DEBUG BEGIN_STMT
  D.8071 = value;
  return D.8071;

}


FlexCAN_Ip_ClearTDCFail (uint8 u8Instance)
{
  struct FLEXCAN_Type * pBase;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = (int) u8Instance;
  pBase = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  SchM_Enter_Can_CAN_EXCLUSIVE_AREA_09 ();
  # DEBUG BEGIN_STMT
  _2 = pBase->FDCTRL;
  _3 = _2 | 16384;
  pBase->FDCTRL = _3;
  # DEBUG BEGIN_STMT
  SchM_Exit_Can_CAN_EXCLUSIVE_AREA_09 ();
  return;

}


FlexCAN_Ip_GetBitrate (uint8 instance, struct Flexcan_Ip_TimeSegmentType * bitrate)
{
  boolean enhCbt;
  const struct FLEXCAN_Type * pBase;
  boolean D.8069;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = (int) instance;
  pBase = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  enhCbt = 0;
  # DEBUG BEGIN_STMT
  _2 = FlexCAN_IsExCbtEnabled (pBase);
  if (_2 != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  FlexCAN_GetExtendedTimeSegments (pBase, bitrate);
  goto <bb 5>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  FlexCAN_GetTimeSegments (pBase, bitrate);

  <bb 5> :
  # DEBUG BEGIN_STMT
  D.8069 = enhCbt;
  return D.8069;

}


FlexCAN_Ip_SetBitrate_Privileged (uint8 instance, const struct Flexcan_Ip_TimeSegmentType * bitrate, boolean enhExt)
{
  boolean disabled;
  struct FLEXCAN_Type * pBase;
  Flexcan_Ip_StatusType status;
  Flexcan_Ip_StatusType result;
  Flexcan_Ip_StatusType D.8062;

  <bb 2> :
  # DEBUG BEGIN_STMT
  result = 0;
  # DEBUG BEGIN_STMT
  status = 0;
  # DEBUG BEGIN_STMT
  _1 = (int) instance;
  pBase = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  _2 = FlexCAN_IsEnabled (pBase);
  _3 = (int) _2;
  _4 = _3 != 0;
  _5 = ~_4;
  _6 = (int) _5;
  disabled = (boolean) _6;
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  if (disabled != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  result = FlexCAN_Enable (pBase);

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

  <bb 5> :
  # DEBUG BEGIN_STMT
  SchM_Enter_Can_CAN_EXCLUSIVE_AREA_14 ();
  # DEBUG BEGIN_STMT
  _7 = FlexCAN_IsExCbtEnabled (pBase);
  if (_7 != 0)
    goto <bb 6>; [INV]
  else
    goto <bb 7>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  FlexCAN_SetExtendedTimeSegments (pBase, bitrate);
  goto <bb 8>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  FlexCAN_SetTimeSegments (pBase, bitrate);

  <bb 8> :
  # DEBUG BEGIN_STMT
  SchM_Exit_Can_CAN_EXCLUSIVE_AREA_14 ();

  <bb 9> :
  # DEBUG BEGIN_STMT
  if (disabled != 0)
    goto <bb 10>; [INV]
  else
    goto <bb 12>; [INV]

  <bb 10> :
  # DEBUG BEGIN_STMT
  status = FlexCAN_Disable (pBase);
  # DEBUG BEGIN_STMT
  if (status != 0)
    goto <bb 11>; [INV]
  else
    goto <bb 12>; [INV]

  <bb 11> :
  # DEBUG BEGIN_STMT
  result = status;

  <bb 12> :
  # DEBUG BEGIN_STMT
  D.8062 = result;
  return D.8062;

}


FlexCAN_Ip_SetRxMaskType_Privileged (uint8 instance, Flexcan_Ip_RxMaskType type)
{
  boolean disabled;
  struct FLEXCAN_Type * pBase;
  Flexcan_Ip_StatusType status;
  Flexcan_Ip_StatusType result;
  Flexcan_Ip_StatusType D.8046;

  <bb 2> :
  # DEBUG BEGIN_STMT
  result = 0;
  # DEBUG BEGIN_STMT
  status = 0;
  # DEBUG BEGIN_STMT
  _1 = (int) instance;
  pBase = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  _2 = FlexCAN_IsEnabled (pBase);
  _3 = (int) _2;
  _4 = _3 != 0;
  _5 = ~_4;
  _6 = (int) _5;
  disabled = (boolean) _6;
  # DEBUG BEGIN_STMT
  if (disabled != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  result = FlexCAN_Enable (pBase);

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

  <bb 5> :
  # DEBUG BEGIN_STMT
  SchM_Enter_Can_CAN_EXCLUSIVE_AREA_08 ();
  # DEBUG BEGIN_STMT
  FlexCAN_SetRxMaskType (pBase, type);
  # DEBUG BEGIN_STMT
  SchM_Exit_Can_CAN_EXCLUSIVE_AREA_08 ();

  <bb 6> :
  # DEBUG BEGIN_STMT
  if (disabled != 0)
    goto <bb 7>; [INV]
  else
    goto <bb 9>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  status = FlexCAN_Disable (pBase);
  # DEBUG BEGIN_STMT
  if (status != 0)
    goto <bb 8>; [INV]
  else
    goto <bb 9>; [INV]

  <bb 8> :
  # DEBUG BEGIN_STMT
  result = status;

  <bb 9> :
  # DEBUG BEGIN_STMT
  D.8046 = result;
  return D.8046;

}


FlexCAN_Ip_SetStopMode_Privileged (uint8 instance)
{
  Flexcan_Ip_StatusType status;
  struct FLEXCAN_Type * pBase;
  Flexcan_Ip_StatusType D.8036;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = (int) instance;
  pBase = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  status = FlexCAN_EnterFreezeMode (pBase);
  # DEBUG BEGIN_STMT
  if (status == 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  status = FlexCAN_Disable (pBase);

  <bb 4> :
  # DEBUG BEGIN_STMT
  D.8036 = status;
  return D.8036;

}


FlexCAN_Ip_SetStartMode_Privileged (uint8 instance)
{
  struct FLEXCAN_Type * pBase;
  Flexcan_Ip_StatusType D.8032;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = (int) instance;
  pBase = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  SchM_Enter_Can_CAN_EXCLUSIVE_AREA_07 ();
  # DEBUG BEGIN_STMT
  _2 = pBase->MCR;
  _3 = _2 & 2147483647;
  pBase->MCR = _3;
  # DEBUG BEGIN_STMT
  SchM_Exit_Can_CAN_EXCLUSIVE_AREA_07 ();
  # DEBUG BEGIN_STMT
  D.8032 = FlexCAN_ExitFreezeMode (pBase);
  return D.8032;

}


FlexCAN_Ip_GetStartMode_Privileged (uint8 instance)
{
  const struct FLEXCAN_Type * base;
  boolean D.8030;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = (int) instance;
  base = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  _2 = base->MCR;
  _3 = _2 & 17825792;
  D.8030 = _3 == 0;
  return D.8030;

}


FlexCAN_Ip_GetStopMode_Privileged (uint8 instance)
{
  const struct FLEXCAN_Type * base;
  boolean D.8028;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = (int) instance;
  base = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  _2 = base->MCR;
  _3 = _2 & 1048576;
  D.8028 = _3 == 1048576;
  return D.8028;

}


FlexCAN_Ip_MainFunctionWrite (uint8 instance, uint8 mb_idx)
{
  struct Flexcan_Ip_StateType * state;
  struct FLEXCAN_Type * base;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = (int) instance;
  base = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  _2 = (int) instance;
  state = Flexcan_Ip_apxState[_2];
  # DEBUG BEGIN_STMT
  _3 = (long unsigned int) mb_idx;
  _4 = FlexCAN_GetBuffStatusFlag (base, _3);
  if (_4 != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  _5 = (long unsigned int) mb_idx;
  _6 = (int) mb_idx;
  _7 = FlexCAN_GetMsgBuffTimestamp (base, _5);
  state->mbs[_6].time_stamp = _7;
  # DEBUG BEGIN_STMT
  FlexCAN_UnlockRxMsgBuff (base);
  # DEBUG BEGIN_STMT
  _8 = (long unsigned int) mb_idx;
  FlexCAN_ClearMsgBuffIntStatusFlag (base, _8);
  # DEBUG BEGIN_STMT
  _9 = (int) mb_idx;
  state->mbs[_9].state = 0;

  <bb 4> :
  return;

}


FlexCAN_Ip_MainFunctionBusOff_Privileged (uint8 instance)
{
  uint32 u32ErrStatus;
  const struct Flexcan_Ip_StateType * state;
  struct FLEXCAN_Type * base;
  Flexcan_Ip_StatusType eRetVal;
  Flexcan_Ip_StatusType D.8024;

  <bb 2> :
  # DEBUG BEGIN_STMT
  eRetVal = 1;
  # DEBUG BEGIN_STMT
  _1 = (int) instance;
  base = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  _2 = (int) instance;
  state = Flexcan_Ip_apxState[_2];
  # DEBUG BEGIN_STMT
  u32ErrStatus = 0;
  # DEBUG BEGIN_STMT
  u32ErrStatus = base->ESR1;
  # DEBUG BEGIN_STMT
  _3 = u32ErrStatus & 4;
  if (_3 != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 6>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  _4 = state->error_callback;
  if (_4 != 0B)
    goto <bb 4>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  _5 = state->error_callback;
  _5 (instance, 9, u32ErrStatus, state);

  <bb 5> :
  # DEBUG BEGIN_STMT
  base->ESR1 = 4;
  # DEBUG BEGIN_STMT
  eRetVal = 0;

  <bb 6> :
  # DEBUG BEGIN_STMT
  D.8024 = eRetVal;
  return D.8024;

}


FlexCAN_Ip_MainFunctionRead (uint8 instance, uint8 mb_idx)
{
  const struct Flexcan_Ip_StateType * state;
  const struct FLEXCAN_Type * base;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = (int) instance;
  base = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  _2 = (int) instance;
  state = Flexcan_Ip_apxState[_2];
  # DEBUG BEGIN_STMT
  _3 = state->bIsLegacyFifoEn;
  if (_3 != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 7>; [INV]

  <bb 3> :
  if (mb_idx <= 7)
    goto <bb 4>; [INV]
  else
    goto <bb 7>; [INV]

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

  <bb 5> :
  # DEBUG BEGIN_STMT
  _4 = FlexCAN_GetBuffStatusFlag (base, 5);
  if (_4 != 0)
    goto <bb 6>; [INV]
  else
    goto <bb 10>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  FlexCAN_IRQHandlerRxFIFO (instance, 5);
  goto <bb 10>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  _5 = (long unsigned int) mb_idx;
  _6 = FlexCAN_GetBuffStatusFlag (base, _5);
  if (_6 != 0)
    goto <bb 8>; [INV]
  else
    goto <bb 10>; [INV]

  <bb 8> :
  # DEBUG BEGIN_STMT
  _7 = (int) mb_idx;
  _8 = state->mbs[_7].state;
  if (_8 == 1)
    goto <bb 9>; [INV]
  else
    goto <bb 10>; [INV]

  <bb 9> :
  # DEBUG BEGIN_STMT
  _9 = (long unsigned int) mb_idx;
  FlexCAN_IRQHandlerRxMB (instance, _9);

  <bb 10> :
  return;

}


FlexCAN_Ip_Deinit_Privileged (uint8 instance)
{
  Flexcan_Ip_StatusType result;
  struct FLEXCAN_Type * base;
  Flexcan_Ip_StatusType D.8004;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = (int) instance;
  base = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  result = 1;
  # DEBUG BEGIN_STMT
  result = FlexCAN_EnterFreezeMode (base);
  # DEBUG BEGIN_STMT
  if (result == 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  FlexCAN_SetRegDefaultVal (base);
  # DEBUG BEGIN_STMT
  FlexCAN_Disable (base);
  # DEBUG BEGIN_STMT
  _2 = (int) instance;
  Flexcan_Ip_apxState[_2] = 0B;

  <bb 4> :
  # DEBUG BEGIN_STMT
  D.8004 = result;
  return D.8004;

}


FlexCAN_Ip_SetRxFifoGlobalMask_Privileged (uint8 instance, uint32 mask)
{
  boolean disabled;
  struct FLEXCAN_Type * pBase;
  Flexcan_Ip_StatusType status;
  Flexcan_Ip_StatusType result;
  Flexcan_Ip_StatusType D.8000;

  <bb 2> :
  # DEBUG BEGIN_STMT
  result = 0;
  # DEBUG BEGIN_STMT
  status = 0;
  # DEBUG BEGIN_STMT
  _1 = (int) instance;
  pBase = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  _2 = FlexCAN_IsEnabled (pBase);
  _3 = (int) _2;
  _4 = _3 != 0;
  _5 = ~_4;
  _6 = (int) _5;
  disabled = (boolean) _6;
  # DEBUG BEGIN_STMT
  if (disabled != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  result = FlexCAN_Enable (pBase);

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

  <bb 5> :
  # DEBUG BEGIN_STMT
  FlexCAN_SetRxFifoGlobalMask (pBase, mask);

  <bb 6> :
  # DEBUG BEGIN_STMT
  if (disabled != 0)
    goto <bb 7>; [INV]
  else
    goto <bb 9>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  status = FlexCAN_Disable (pBase);
  # DEBUG BEGIN_STMT
  if (status != 0)
    goto <bb 8>; [INV]
  else
    goto <bb 9>; [INV]

  <bb 8> :
  # DEBUG BEGIN_STMT
  result = status;

  <bb 9> :
  # DEBUG BEGIN_STMT
  D.8000 = result;
  return D.8000;

}


FlexCAN_Ip_SetRxIndividualMask_Privileged (uint8 instance, uint8 mb_idx, uint32 mask)
{
  boolean disabled;
  struct FLEXCAN_Type * pBase;
  Flexcan_Ip_StatusType status;
  Flexcan_Ip_StatusType result;
  Flexcan_Ip_StatusType D.7990;

  <bb 2> :
  # DEBUG BEGIN_STMT
  result = 0;
  # DEBUG BEGIN_STMT
  status = 0;
  # DEBUG BEGIN_STMT
  _1 = (int) instance;
  pBase = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  _2 = FlexCAN_IsEnabled (pBase);
  _3 = (int) _2;
  _4 = _3 != 0;
  _5 = ~_4;
  _6 = (int) _5;
  disabled = (boolean) _6;
  # DEBUG BEGIN_STMT
  if (disabled != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  result = FlexCAN_Enable (pBase);

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

  <bb 5> :
  # DEBUG BEGIN_STMT
  _7 = (long unsigned int) mb_idx;
  FlexCAN_SetRxIndividualMask (pBase, _7, mask);

  <bb 6> :
  # DEBUG BEGIN_STMT
  if (disabled != 0)
    goto <bb 7>; [INV]
  else
    goto <bb 9>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  status = FlexCAN_Disable (pBase);
  # DEBUG BEGIN_STMT
  if (status != 0)
    goto <bb 8>; [INV]
  else
    goto <bb 9>; [INV]

  <bb 8> :
  # DEBUG BEGIN_STMT
  result = status;

  <bb 9> :
  # DEBUG BEGIN_STMT
  D.7990 = result;
  return D.7990;

}


FlexCAN_Ip_ExitFreezeMode_Privileged (uint8 instance)
{
  struct FLEXCAN_Type * base;
  Flexcan_Ip_StatusType D.7980;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = (int) instance;
  base = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  D.7980 = FlexCAN_ExitFreezeMode (base);
  return D.7980;

}


FlexCAN_Ip_EnterFreezeMode_Privileged (uint8 instance)
{
  struct FLEXCAN_Type * base;
  Flexcan_Ip_StatusType D.7978;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = (int) instance;
  base = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  D.7978 = FlexCAN_EnterFreezeMode (base);
  return D.7978;

}


FlexCAN_Ip_SetRxMbGlobalMask_Privileged (uint8 instance, uint32 mask)
{
  boolean disabled;
  struct FLEXCAN_Type * pBase;
  Flexcan_Ip_StatusType status;
  Flexcan_Ip_StatusType result;
  Flexcan_Ip_StatusType D.7976;

  <bb 2> :
  # DEBUG BEGIN_STMT
  result = 0;
  # DEBUG BEGIN_STMT
  status = 0;
  # DEBUG BEGIN_STMT
  _1 = (int) instance;
  pBase = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  _2 = FlexCAN_IsEnabled (pBase);
  _3 = (int) _2;
  _4 = _3 != 0;
  _5 = ~_4;
  _6 = (int) _5;
  disabled = (boolean) _6;
  # DEBUG BEGIN_STMT
  if (disabled != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  result = FlexCAN_Enable (pBase);

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

  <bb 5> :
  # DEBUG BEGIN_STMT
  FlexCAN_SetRxMsgBuffGlobalMask (pBase, mask);

  <bb 6> :
  # DEBUG BEGIN_STMT
  if (disabled != 0)
    goto <bb 7>; [INV]
  else
    goto <bb 9>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  status = FlexCAN_Disable (pBase);
  # DEBUG BEGIN_STMT
  if (status != 0)
    goto <bb 8>; [INV]
  else
    goto <bb 9>; [INV]

  <bb 8> :
  # DEBUG BEGIN_STMT
  result = status;

  <bb 9> :
  # DEBUG BEGIN_STMT
  D.7976 = result;
  return D.7976;

}


FlexCAN_Ip_SendBlocking (uint8 instance, uint8 mb_idx, const struct Flexcan_Ip_DataInfoType * tx_info, uint32 msg_id, const uint8 * mb_data, uint32 timeout_ms)
{
  volatile uint32 * flexcan_mb;
  uint32 flexcan_mb_config;
  uint32 uS2Ticks;
  uint32 mS2Ticks;
  uint32 timeElapsed;
  uint32 timeStart;
  struct Flexcan_Ip_StateType * state;
  struct FLEXCAN_Type * base;
  Flexcan_Ip_StatusType result;
  Flexcan_Ip_StatusType D.7965;
  long unsigned int D.7958;
  long unsigned int D.7951;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _1 = (int) instance;
  base = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  _2 = (int) instance;
  state = Flexcan_Ip_apxState[_2];
  # DEBUG BEGIN_STMT
  timeStart = 0;
  # DEBUG BEGIN_STMT
  timeElapsed = 0;
  # DEBUG BEGIN_STMT
  _3 = timeout_ms * 1000;
  mS2Ticks = OsIf_MicrosToTicks (_3, 0);
  # DEBUG BEGIN_STMT
  uS2Ticks = 0;
  # DEBUG BEGIN_STMT
  flexcan_mb_config = 0;
  # DEBUG BEGIN_STMT
  flexcan_mb = 0B;
  # DEBUG BEGIN_STMT
  result = FlexCAN_StartSendData (instance, mb_idx, tx_info, msg_id, mb_data);
  # DEBUG BEGIN_STMT
  if (result == 0)
    goto <bb 3>; [INV]
  else
    goto <bb 18>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  _4 = OsIf_GetCounter (0);
  timeStart = _4;
  # DEBUG BEGIN_STMT
  goto <bb 6>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  D.7951 = OsIf_GetElapsed (&timeStart, 0);
  timeElapsed = D.7951 + timeElapsed;
  # DEBUG BEGIN_STMT
  if (timeElapsed >= mS2Ticks)
    goto <bb 5>; [INV]
  else
    goto <bb 6>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  result = 3;
  # DEBUG BEGIN_STMT
  goto <bb 7>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  _5 = (long unsigned int) mb_idx;
  _6 = FlexCAN_GetBuffStatusFlag (base, _5);
  if (_6 != 1)
    goto <bb 4>; [INV]
  else
    goto <bb 7>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  if (result == 3)
    goto <bb 8>; [INV]
  else
    goto <bb 17>; [INV]

  <bb 8> :
  _7 = (int) mb_idx;
  _8 = state->mbs[_7].state;
  if (_8 != 0)
    goto <bb 9>; [INV]
  else
    goto <bb 17>; [INV]

  <bb 9> :
  # DEBUG BEGIN_STMT
  _9 = (long unsigned int) mb_idx;
  FlexCAN_ClearMsgBuffIntStatusFlag (base, _9);
  # DEBUG BEGIN_STMT
  _10 = (long unsigned int) mb_idx;
  flexcan_mb = FlexCAN_GetMsgBuffRegion (base, _10);
  # DEBUG BEGIN_STMT
  flexcan_mb_config = *flexcan_mb;
  # DEBUG BEGIN_STMT
  flexcan_mb_config = flexcan_mb_config & 4043309055;
  # DEBUG BEGIN_STMT
  flexcan_mb_config = flexcan_mb_config | 150994944;
  # DEBUG BEGIN_STMT
  *flexcan_mb = flexcan_mb_config;
  # DEBUG BEGIN_STMT
  uS2Ticks = OsIf_MicrosToTicks (1000000, 0);
  # DEBUG BEGIN_STMT
  _11 = OsIf_GetCounter (0);
  timeStart = _11;
  # DEBUG BEGIN_STMT
  timeElapsed = 0;
  # DEBUG BEGIN_STMT
  goto <bb 12>; [INV]

  <bb 10> :
  # DEBUG BEGIN_STMT
  D.7958 = OsIf_GetElapsed (&timeStart, 0);
  timeElapsed = D.7958 + timeElapsed;
  # DEBUG BEGIN_STMT
  if (timeElapsed >= uS2Ticks)
    goto <bb 11>; [INV]
  else
    goto <bb 12>; [INV]

  <bb 11> :
  # DEBUG BEGIN_STMT
  result = 3;
  # DEBUG BEGIN_STMT
  goto <bb 13>; [INV]

  <bb 12> :
  # DEBUG BEGIN_STMT
  _12 = (long unsigned int) mb_idx;
  _13 = FlexCAN_GetBuffStatusFlag (base, _12);
  if (_13 == 0)
    goto <bb 10>; [INV]
  else
    goto <bb 13>; [INV]

  <bb 13> :
  # DEBUG BEGIN_STMT
  flexcan_mb_config = *flexcan_mb;
  # DEBUG BEGIN_STMT
  _14 = flexcan_mb_config >> 24;
  _15 = _14 & 15;
  if (_15 == 8)
    goto <bb 14>; [INV]
  else
    goto <bb 15>; [INV]

  <bb 14> :
  # DEBUG BEGIN_STMT
  result = 0;

  <bb 15> :
  # DEBUG BEGIN_STMT
  _16 = flexcan_mb_config >> 24;
  _17 = _16 & 15;
  if (_17 == 9)
    goto <bb 16>; [INV]
  else
    goto <bb 17>; [INV]

  <bb 16> :
  # DEBUG BEGIN_STMT
  result = 3;

  <bb 17> :
  # DEBUG BEGIN_STMT
  _18 = (long unsigned int) mb_idx;
  FlexCAN_ClearMsgBuffIntStatusFlag (base, _18);
  # DEBUG BEGIN_STMT
  _19 = (int) mb_idx;
  state->mbs[_19].state = 0;

  <bb 18> :
  # DEBUG BEGIN_STMT
  D.7965 = result;
  timeStart = {CLOBBER};
  return D.7965;

}


FlexCAN_BusOff_IRQHandler (uint8 instance)
{
  boolean isSpuriousInt;
  uint32 u32ErrStatus;
  const struct Flexcan_Ip_StateType * state;
  struct FLEXCAN_Type * base;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = (int) instance;
  base = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  _2 = (int) instance;
  state = Flexcan_Ip_apxState[_2];
  # DEBUG BEGIN_STMT
  u32ErrStatus = 0;
  # DEBUG BEGIN_STMT
  isSpuriousInt = 1;
  # DEBUG BEGIN_STMT
  if (state != 0B)
    goto <bb 3>; [INV]
  else
    goto <bb 18>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  u32ErrStatus = base->ESR1;
  # DEBUG BEGIN_STMT
  _3 = u32ErrStatus & 131072;
  if (_3 != 0)
    goto <bb 4>; [INV]
  else
    goto <bb 8>; [INV]

  <bb 4> :
  _4 = base->CTRL1;
  _5 = _4 & 2048;
  if (_5 != 0)
    goto <bb 5>; [INV]
  else
    goto <bb 8>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  base->ESR1 = 131072;
  # DEBUG BEGIN_STMT
  _6 = state->error_callback;
  if (_6 != 0B)
    goto <bb 6>; [INV]
  else
    goto <bb 7>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  _7 = state->error_callback;
  _7 (instance, 11, u32ErrStatus, state);
  # DEBUG BEGIN_STMT
  u32ErrStatus = base->ESR1;

  <bb 7> :
  # DEBUG BEGIN_STMT
  isSpuriousInt = 0;

  <bb 8> :
  # DEBUG BEGIN_STMT
  _8 = u32ErrStatus & 65536;
  if (_8 != 0)
    goto <bb 9>; [INV]
  else
    goto <bb 13>; [INV]

  <bb 9> :
  _9 = base->CTRL1;
  _10 = _9 & 1024;
  if (_10 != 0)
    goto <bb 10>; [INV]
  else
    goto <bb 13>; [INV]

  <bb 10> :
  # DEBUG BEGIN_STMT
  base->ESR1 = 65536;
  # DEBUG BEGIN_STMT
  _11 = state->error_callback;
  if (_11 != 0B)
    goto <bb 11>; [INV]
  else
    goto <bb 12>; [INV]

  <bb 11> :
  # DEBUG BEGIN_STMT
  _12 = state->error_callback;
  _12 (instance, 10, u32ErrStatus, state);
  # DEBUG BEGIN_STMT
  u32ErrStatus = base->ESR1;

  <bb 12> :
  # DEBUG BEGIN_STMT
  isSpuriousInt = 0;

  <bb 13> :
  # DEBUG BEGIN_STMT
  _13 = u32ErrStatus & 4;
  if (_13 != 0)
    goto <bb 14>; [INV]
  else
    goto <bb 18>; [INV]

  <bb 14> :
  _14 = base->CTRL1;
  _15 = _14 & 32768;
  if (_15 != 0)
    goto <bb 15>; [INV]
  else
    goto <bb 18>; [INV]

  <bb 15> :
  # DEBUG BEGIN_STMT
  base->ESR1 = 4;
  # DEBUG BEGIN_STMT
  _16 = state->error_callback;
  if (_16 != 0B)
    goto <bb 16>; [INV]
  else
    goto <bb 17>; [INV]

  <bb 16> :
  # DEBUG BEGIN_STMT
  _17 = state->error_callback;
  _17 (instance, 9, u32ErrStatus, state);

  <bb 17> :
  # DEBUG BEGIN_STMT
  isSpuriousInt = 0;

  <bb 18> :
  # DEBUG BEGIN_STMT
  if (isSpuriousInt != 0)
    goto <bb 19>; [INV]
  else
    goto <bb 20>; [INV]

  <bb 19> :
  # DEBUG BEGIN_STMT
  base->ESR1 = 720900;

  <bb 20> :
  return;

}


FlexCAN_Error_IRQHandler (uint8 instance)
{
  boolean isSpuriousInt;
  uint32 u32ErrStatus;
  const struct Flexcan_Ip_StateType * state;
  struct FLEXCAN_Type * pBase;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = (int) instance;
  pBase = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  _2 = (int) instance;
  state = Flexcan_Ip_apxState[_2];
  # DEBUG BEGIN_STMT
  u32ErrStatus = 0;
  # DEBUG BEGIN_STMT
  isSpuriousInt = 1;
  # DEBUG BEGIN_STMT
  if (state != 0B)
    goto <bb 3>; [INV]
  else
    goto <bb 13>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  u32ErrStatus = pBase->ESR1;
  # DEBUG BEGIN_STMT
  _3 = u32ErrStatus & 2;
  if (_3 != 0)
    goto <bb 4>; [INV]
  else
    goto <bb 8>; [INV]

  <bb 4> :
  _4 = pBase->CTRL1;
  _5 = _4 & 16384;
  if (_5 != 0)
    goto <bb 5>; [INV]
  else
    goto <bb 8>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  pBase->ESR1 = 2;
  # DEBUG BEGIN_STMT
  _6 = state->error_callback;
  if (_6 != 0B)
    goto <bb 6>; [INV]
  else
    goto <bb 7>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  _7 = state->error_callback;
  _7 (instance, 7, u32ErrStatus, state);
  # DEBUG BEGIN_STMT
  u32ErrStatus = pBase->ESR1;

  <bb 7> :
  # DEBUG BEGIN_STMT
  isSpuriousInt = 0;

  <bb 8> :
  # DEBUG BEGIN_STMT
  _8 = u32ErrStatus & 1048576;
  if (_8 != 0)
    goto <bb 9>; [INV]
  else
    goto <bb 13>; [INV]

  <bb 9> :
  _9 = pBase->CTRL2;
  _10 = (signed int) _9;
  if (_10 < 0)
    goto <bb 10>; [INV]
  else
    goto <bb 13>; [INV]

  <bb 10> :
  # DEBUG BEGIN_STMT
  pBase->ESR1 = 1048576;
  # DEBUG BEGIN_STMT
  _11 = state->error_callback;
  if (_11 != 0B)
    goto <bb 11>; [INV]
  else
    goto <bb 12>; [INV]

  <bb 11> :
  # DEBUG BEGIN_STMT
  _12 = state->error_callback;
  _12 (instance, 8, u32ErrStatus, state);

  <bb 12> :
  # DEBUG BEGIN_STMT
  isSpuriousInt = 0;

  <bb 13> :
  # DEBUG BEGIN_STMT
  if (isSpuriousInt != 0)
    goto <bb 14>; [INV]
  else
    goto <bb 15>; [INV]

  <bb 14> :
  # DEBUG BEGIN_STMT
  pBase->ESR1 = 3145730;

  <bb 15> :
  return;

}


FlexCAN_Ip_GetControllerRxErrorCounter (uint8 instance)
{
  const struct FLEXCAN_Type * base;
  uint8 D.7909;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = (int) instance;
  base = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  _2 = base->ECR;
  _3 = _2 >> 8;
  D.7909 = (uint8) _3;
  return D.7909;

}


FlexCAN_Ip_GetControllerTxErrorCounter (uint8 instance)
{
  const struct FLEXCAN_Type * base;
  uint8 D.7907;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = (int) instance;
  base = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  _2 = base->ECR;
  D.7907 = (uint8) _2;
  return D.7907;

}


FlexCAN_Ip_GetErrorStatus (uint8 instance)
{
  const struct FLEXCAN_Type * base;
  uint32 D.7905;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = (int) instance;
  base = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  D.7905 = base->ESR1;
  return D.7905;

}


FlexCAN_Ip_ClearErrorStatus (uint8 instance, uint32 error)
{
  struct FLEXCAN_Type * base;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = (int) instance;
  base = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  base->ESR1 = error;
  return;

}


FlexCAN_IRQHandler (uint8 instance, uint32 startMbIdx, uint32 endMbIdx)
{
  uint32 mb_idx;
  boolean bIsSpuriousInt;
  const struct Flexcan_Ip_StateType * state;
  struct FLEXCAN_Type * base;
  uint32 flag_reg;
  uint32 u32MbHandle;

  <bb 2> :
  # DEBUG BEGIN_STMT
  u32MbHandle = 0;
  # DEBUG BEGIN_STMT
  flag_reg = 0;
  # DEBUG BEGIN_STMT
  _1 = (int) instance;
  base = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  _2 = (int) instance;
  state = Flexcan_Ip_apxState[_2];
  # DEBUG BEGIN_STMT
  bIsSpuriousInt = 1;
  # DEBUG BEGIN_STMT
  mb_idx = endMbIdx;
  # DEBUG BEGIN_STMT
  if (state != 0B)
    goto <bb 3>; [INV]
  else
    goto <bb 20>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  _3 = FlexCAN_GetMsgBuffIntStatusFlag (base, mb_idx);
  flag_reg = (uint32) _3;
  # DEBUG BEGIN_STMT
  goto <bb 5>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  mb_idx = mb_idx + 4294967295;
  # DEBUG BEGIN_STMT
  _4 = FlexCAN_GetMsgBuffIntStatusFlag (base, mb_idx);
  flag_reg = (uint32) _4;

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

  <bb 6> :
  if (mb_idx > startMbIdx)
    goto <bb 4>; [INV]
  else
    goto <bb 7>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  if (flag_reg != 0)
    goto <bb 8>; [INV]
  else
    goto <bb 18>; [INV]

  <bb 8> :
  # DEBUG BEGIN_STMT
  bIsSpuriousInt = 0;
  # DEBUG BEGIN_STMT
  u32MbHandle = mb_idx;
  # DEBUG BEGIN_STMT
  _5 = state->bIsLegacyFifoEn;
  if (_5 != 0)
    goto <bb 9>; [INV]
  else
    goto <bb 11>; [INV]

  <bb 9> :
  if (mb_idx <= 7)
    goto <bb 10>; [INV]
  else
    goto <bb 11>; [INV]

  <bb 10> :
  # DEBUG BEGIN_STMT
  FlexCAN_IRQHandlerRxFIFO (instance, mb_idx);
  # DEBUG BEGIN_STMT
  u32MbHandle = 0;
  goto <bb 13>; [INV]

  <bb 11> :
  # DEBUG BEGIN_STMT
  _6 = state->mbs[u32MbHandle].state;
  if (_6 == 1)
    goto <bb 12>; [INV]
  else
    goto <bb 13>; [INV]

  <bb 12> :
  # DEBUG BEGIN_STMT
  FlexCAN_IRQHandlerRxMB (instance, mb_idx);

  <bb 13> :
  # DEBUG BEGIN_STMT
  _7 = state->mbs[u32MbHandle].state;
  if (_7 == 2)
    goto <bb 14>; [INV]
  else
    goto <bb 15>; [INV]

  <bb 14> :
  # DEBUG BEGIN_STMT
  FlexCAN_IRQHandlerTxMB (instance, mb_idx);

  <bb 15> :
  # DEBUG BEGIN_STMT
  _8 = FlexCAN_GetMsgBuffIntStatusFlag (base, mb_idx);
  if (_8 != 0)
    goto <bb 16>; [INV]
  else
    goto <bb 18>; [INV]

  <bb 16> :
  # DEBUG BEGIN_STMT
  _9 = state->mbs[u32MbHandle].state;
  if (_9 == 0)
    goto <bb 17>; [INV]
  else
    goto <bb 18>; [INV]

  <bb 17> :
  # DEBUG BEGIN_STMT
  FlexCAN_ClearMsgBuffIntStatusFlag (base, mb_idx);

  <bb 18> :
  # DEBUG BEGIN_STMT
  if (bIsSpuriousInt != 0)
    goto <bb 19>; [INV]
  else
    goto <bb 23>; [INV]

  <bb 19> :
  # DEBUG BEGIN_STMT
  FlexCAN_ProcessSpuriousInterruptMB (instance, startMbIdx, endMbIdx);
  goto <bb 23>; [INV]

  <bb 20> :
  # DEBUG BEGIN_STMT
  mb_idx = startMbIdx;
  goto <bb 22>; [INV]

  <bb 21> :
  # DEBUG BEGIN_STMT
  FlexCAN_ClearMsgBuffIntStatusFlag (base, mb_idx);
  # DEBUG BEGIN_STMT
  mb_idx = mb_idx + 1;

  <bb 22> :
  # DEBUG BEGIN_STMT
  if (mb_idx <= endMbIdx)
    goto <bb 21>; [INV]
  else
    goto <bb 23>; [INV]

  <bb 23> :
  return;

}


FlexCAN_CompleteRxMessageFifoData (uint8 instance)
{
  struct Flexcan_Ip_StateType * state;
  struct FLEXCAN_Type * base;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = (int) instance;
  base = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  _2 = (int) instance;
  state = Flexcan_Ip_apxState[_2];
  # DEBUG BEGIN_STMT
  _3 = state->transferType;
  if (_3 == 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  _4 = state->isIntActive;
  FlexCAN_SetMsgBuffIntCmd (base, instance, 5, 0, _4);
  # DEBUG BEGIN_STMT
  _5 = state->isIntActive;
  FlexCAN_SetMsgBuffIntCmd (base, instance, 6, 0, _5);
  # DEBUG BEGIN_STMT
  _6 = state->isIntActive;
  FlexCAN_SetMsgBuffIntCmd (base, instance, 7, 0, _6);

  <bb 4> :
  # DEBUG BEGIN_STMT
  state->mbs[0].pMBmessage = 0B;
  # DEBUG BEGIN_STMT
  state->mbs[0].state = 0;
  return;

}


FlexCAN_Ip_GetTransferStatus (uint8 instance, uint8 mb_idx)
{
  Flexcan_Ip_StatusType status;
  const struct Flexcan_Ip_StateType * state;
  Flexcan_Ip_StatusType D.7847;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = (int) instance;
  state = Flexcan_Ip_apxState[_1];
  # DEBUG BEGIN_STMT
  status = 1;
  # DEBUG BEGIN_STMT
  if (mb_idx <= 31)
    goto <bb 3>; [INV]
  else
    goto <bb 6>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  _2 = (int) mb_idx;
  _3 = state->mbs[_2].state;
  if (_3 == 0)
    goto <bb 4>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  status = 0;
  goto <bb 6>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  status = 2;

  <bb 6> :
  # DEBUG BEGIN_STMT
  D.7847 = status;
  return D.7847;

}


FlexCAN_Ip_ConfigRemoteResponseMb (uint8 instance, uint8 mb_idx, const struct Flexcan_Ip_DataInfoType * tx_info, uint32 msg_id, const uint8 * mb_data)
{
  volatile uint32 * pMbAddr;
  const struct Flexcan_Ip_StateType * const state;
  struct FLEXCAN_Type * pBase;
  struct Flexcan_Ip_MsbuffCodeStatusType cs;
  Flexcan_Ip_StatusType result;
  Flexcan_Ip_StatusType D.7839;

  <bb 2> :
  # DEBUG BEGIN_STMT
  result = 0;
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _1 = (int) instance;
  pBase = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  _2 = (int) instance;
  state = Flexcan_Ip_apxState[_2];
  # DEBUG BEGIN_STMT
  pMbAddr = 0B;
  # DEBUG BEGIN_STMT
  if (result == 0)
    goto <bb 3>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  _3 = tx_info->data_length;
  cs.dataLen = _3;
  # DEBUG BEGIN_STMT
  _4 = tx_info->msg_id_type;
  cs.msgIdType = _4;
  # DEBUG BEGIN_STMT
  cs.code = 10;
  # DEBUG BEGIN_STMT
  cs.fd_enable = 0;
  # DEBUG BEGIN_STMT
  cs.enable_brs = 0;
  # DEBUG BEGIN_STMT
  cs.fd_padding = 0;
  # DEBUG BEGIN_STMT
  _5 = (long unsigned int) mb_idx;
  FlexCAN_ClearMsgBuffIntStatusFlag (pBase, _5);
  # DEBUG BEGIN_STMT
  _6 = (long unsigned int) mb_idx;
  pMbAddr = FlexCAN_GetMsgBuffRegion (pBase, _6);
  # DEBUG BEGIN_STMT
  _7 = tx_info->is_remote;
  FlexCAN_SetTxMsgBuff (pMbAddr, &cs, msg_id, mb_data, _7);
  # DEBUG BEGIN_STMT
  _8 = tx_info->is_polling;
  _9 = ~_8;
  if (_9 != 0)
    goto <bb 4>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  _10 = (long unsigned int) mb_idx;
  _11 = state->isIntActive;
  result = FlexCAN_SetMsgBuffIntCmd (pBase, instance, _10, 1, _11);

  <bb 5> :
  # DEBUG BEGIN_STMT
  D.7839 = result;
  cs = {CLOBBER};
  return D.7839;

}


FlexCAN_Ip_ConfigRxFifo_Privileged (uint8 instance, Flexcan_Ip_RxFifoIdElementFormatType id_format, const struct Flexcan_Ip_IdTableType * id_filter_table)
{
  boolean disabled;
  struct FLEXCAN_Type * pBase;
  Flexcan_Ip_StatusType status;
  Flexcan_Ip_StatusType result;
  Flexcan_Ip_StatusType D.7833;

  <bb 2> :
  # DEBUG BEGIN_STMT
  result = 0;
  # DEBUG BEGIN_STMT
  status = 0;
  # DEBUG BEGIN_STMT
  _1 = (int) instance;
  pBase = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  _2 = FlexCAN_IsEnabled (pBase);
  _3 = (int) _2;
  _4 = _3 != 0;
  _5 = ~_4;
  _6 = (int) _5;
  disabled = (boolean) _6;
  # DEBUG BEGIN_STMT
  if (disabled != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  result = FlexCAN_Enable (pBase);

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

  <bb 5> :
  # DEBUG BEGIN_STMT
  FlexCAN_SetRxFifoFilter (pBase, id_format, id_filter_table);

  <bb 6> :
  # DEBUG BEGIN_STMT
  if (disabled != 0)
    goto <bb 7>; [INV]
  else
    goto <bb 9>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  status = FlexCAN_Disable (pBase);
  # DEBUG BEGIN_STMT
  if (status != 0)
    goto <bb 8>; [INV]
  else
    goto <bb 9>; [INV]

  <bb 8> :
  # DEBUG BEGIN_STMT
  result = status;

  <bb 9> :
  # DEBUG BEGIN_STMT
  D.7833 = result;
  return D.7833;

}


FlexCAN_Ip_RxFifoBlocking (uint8 instance, struct Flexcan_Ip_MsgBuffType * data, uint32 timeout)
{
  Flexcan_Ip_StatusType result;
  Flexcan_Ip_StatusType D.7794;

  <bb 2> :
  # DEBUG BEGIN_STMT
  result = 0;
  # DEBUG BEGIN_STMT
  result = FlexCAN_StartRxMessageFifoData (instance, data);
  # DEBUG BEGIN_STMT
  if (result == 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  result = FlexCAN_ProccessLegacyRxFIFO (instance, timeout);

  <bb 4> :
  # DEBUG BEGIN_STMT
  D.7794 = result;
  return D.7794;

}


FlexCAN_Ip_RxFifo (uint8 instance, struct Flexcan_Ip_MsgBuffType * data)
{
  Flexcan_Ip_StatusType result;
  Flexcan_Ip_StatusType D.7781;

  <bb 2> :
  # DEBUG BEGIN_STMT
  result = 0;
  # DEBUG BEGIN_STMT
  result = FlexCAN_StartRxMessageFifoData (instance, data);
  # DEBUG BEGIN_STMT
  D.7781 = result;
  return D.7781;

}


FlexCAN_Ip_ReceiveBlocking (uint8 instance, uint8 mb_idx, struct Flexcan_Ip_MsgBuffType * data, boolean isPolling, uint32 u32TimeoutMs)
{
  const struct FLEXCAN_Type * base;
  struct Flexcan_Ip_StateType * state;
  uint32 mS2Ticks;
  uint32 timeElapsed;
  uint32 timeStart;
  Flexcan_Ip_StatusType result;
  Flexcan_Ip_StatusType D.7750;
  long unsigned int D.7736;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  timeStart = 0;
  # DEBUG BEGIN_STMT
  timeElapsed = 0;
  # DEBUG BEGIN_STMT
  _1 = u32TimeoutMs * 1000;
  mS2Ticks = OsIf_MicrosToTicks (_1, 0);
  # DEBUG BEGIN_STMT
  _2 = (int) instance;
  state = Flexcan_Ip_apxState[_2];
  # DEBUG BEGIN_STMT
  _3 = (int) instance;
  base = Flexcan_Ip_apxBase[_3];
  # DEBUG BEGIN_STMT
  result = FlexCAN_StartRxMessageBufferData (instance, mb_idx, data, isPolling);
  # DEBUG BEGIN_STMT
  if (result == 0)
    goto <bb 3>; [INV]
  else
    goto <bb 10>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  _4 = OsIf_GetCounter (0);
  timeStart = _4;
  # DEBUG BEGIN_STMT
  goto <bb 9>; [INV]

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

  <bb 5> :
  # DEBUG BEGIN_STMT
  _5 = (long unsigned int) mb_idx;
  _6 = FlexCAN_GetBuffStatusFlag (base, _5);
  if (_6 != 0)
    goto <bb 6>; [INV]
  else
    goto <bb 7>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  _7 = (long unsigned int) mb_idx;
  FlexCAN_IRQHandlerRxMB (instance, _7);

  <bb 7> :
  # DEBUG BEGIN_STMT
  D.7736 = OsIf_GetElapsed (&timeStart, 0);
  timeElapsed = D.7736 + timeElapsed;
  # DEBUG BEGIN_STMT
  if (timeElapsed >= mS2Ticks)
    goto <bb 8>; [INV]
  else
    goto <bb 9>; [INV]

  <bb 8> :
  # DEBUG BEGIN_STMT
  result = 3;
  # DEBUG BEGIN_STMT
  goto <bb 10>; [INV]

  <bb 9> :
  # DEBUG BEGIN_STMT
  _8 = (int) mb_idx;
  _9 = state->mbs[_8].state;
  if (_9 == 1)
    goto <bb 4>; [INV]
  else
    goto <bb 10>; [INV]

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

  <bb 11> :
  _10 = ~isPolling;

  <bb 12> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  if (result != 4)
    goto <bb 13>; [INV]
  else
    goto <bb 17>; [INV]

  <bb 13> :
  if (result != 2)
    goto <bb 14>; [INV]
  else
    goto <bb 17>; [INV]

  <bb 14> :
  # DEBUG BEGIN_STMT
  _11 = (int) mb_idx;
  _12 = state->mbs[_11].state;
  if (_12 == 0)
    goto <bb 15>; [INV]
  else
    goto <bb 16>; [INV]

  <bb 15> :
  # DEBUG BEGIN_STMT
  result = 0;
  goto <bb 17>; [INV]

  <bb 16> :
  # DEBUG BEGIN_STMT
  _13 = (int) mb_idx;
  state->mbs[_13].state = 0;
  # DEBUG BEGIN_STMT
  result = 3;

  <bb 17> :
  # DEBUG BEGIN_STMT
  D.7750 = result;
  timeStart = {CLOBBER};
  return D.7750;

}


FlexCAN_Ip_Receive (uint8 instance, uint8 mb_idx, struct Flexcan_Ip_MsgBuffType * data, boolean isPolling)
{
  Flexcan_Ip_StatusType result;
  Flexcan_Ip_StatusType D.7723;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  result = FlexCAN_StartRxMessageBufferData (instance, mb_idx, data, isPolling);
  # DEBUG BEGIN_STMT
  D.7723 = result;
  return D.7723;

}


FlexCAN_Ip_ConfigRxMb (uint8 instance, uint8 mb_idx, const struct Flexcan_Ip_DataInfoType * rx_info, uint32 msg_id)
{
  struct FLEXCAN_Type * base;
  struct Flexcan_Ip_MsbuffCodeStatusType cs;
  Flexcan_Ip_StatusType eResult;
  Flexcan_Ip_StatusType D.7720;

  <bb 2> :
  # DEBUG BEGIN_STMT
  eResult = 0;
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _1 = (int) instance;
  base = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  _2 = (long unsigned int) mb_idx;
  FlexCAN_ClearMsgBuffIntStatusFlag (base, _2);
  # DEBUG BEGIN_STMT
  _3 = rx_info->data_length;
  cs.dataLen = _3;
  # DEBUG BEGIN_STMT
  _4 = rx_info->msg_id_type;
  cs.msgIdType = _4;
  # DEBUG BEGIN_STMT
  _5 = rx_info->fd_enable;
  cs.fd_enable = _5;
  # DEBUG BEGIN_STMT
  cs.code = 15;
  # DEBUG BEGIN_STMT
  _6 = (long unsigned int) mb_idx;
  FlexCAN_SetRxMsgBuff (base, _6, &cs, msg_id);
  # DEBUG BEGIN_STMT
  cs.code = 0;
  # DEBUG BEGIN_STMT
  _7 = (long unsigned int) mb_idx;
  FlexCAN_SetRxMsgBuff (base, _7, &cs, msg_id);
  # DEBUG BEGIN_STMT
  cs.code = 4;
  # DEBUG BEGIN_STMT
  _8 = (long unsigned int) mb_idx;
  FlexCAN_SetRxMsgBuff (base, _8, &cs, msg_id);
  # DEBUG BEGIN_STMT
  D.7720 = eResult;
  cs = {CLOBBER};
  return D.7720;

}


FlexCAN_Ip_Send (uint8 instance, uint8 mb_idx, const struct Flexcan_Ip_DataInfoType * tx_info, uint32 msg_id, const uint8 * mb_data)
{
  const struct FLEXCAN_Type * base;
  Flexcan_Ip_StatusType result;
  Flexcan_Ip_StatusType D.7705;

  <bb 2> :
  # DEBUG BEGIN_STMT
  result = 1;
  # DEBUG BEGIN_STMT
  _1 = (int) instance;
  base = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  _2 = FlexCAN_IsListenOnlyModeEnabled (base);
  _3 = ~_2;
  if (_3 != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  result = FlexCAN_StartSendData (instance, mb_idx, tx_info, msg_id, mb_data);

  <bb 4> :
  # DEBUG BEGIN_STMT
  D.7705 = result;
  return D.7705;

}


FlexCAN_Ip_Init_Privileged (uint8 Flexcan_Ip_u8Instance, struct Flexcan_Ip_StateType * Flexcan_Ip_pState, const struct Flexcan_Ip_ConfigType * Flexcan_Ip_pData)
{
  uint32 i;
  struct FLEXCAN_Type * pBase;
  Flexcan_Ip_StatusType eResult;
  Flexcan_Ip_StatusType D.7655;

  <bb 2> :
  # DEBUG BEGIN_STMT
  eResult = 0;
  # DEBUG BEGIN_STMT
  _1 = (int) Flexcan_Ip_u8Instance;
  pBase = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  eResult = FlexCAN_InitController (pBase, Flexcan_Ip_pData);
  # DEBUG BEGIN_STMT
  if (eResult == 0)
    goto <bb 3>; [INV]
  else
    goto <bb 10>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  _2 = Flexcan_Ip_pData->fd_enable;
  FlexCAN_EnableExtCbt (pBase, _2);
  # DEBUG BEGIN_STMT
  _3 = Flexcan_Ip_pData->fd_enable;
  if (_3 != 0)
    goto <bb 4>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  _4 = &Flexcan_Ip_pData->bitrate;
  FlexCAN_SetExtendedTimeSegments (pBase, _4);
  # DEBUG BEGIN_STMT
  _5 = &Flexcan_Ip_pData->bitrate_cbt;
  FlexCAN_SetFDTimeSegments (pBase, _5);
  goto <bb 6>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  _6 = &Flexcan_Ip_pData->bitrate;
  FlexCAN_SetTimeSegments (pBase, _6);

  <bb 6> :
  # DEBUG BEGIN_STMT
  _7 = Flexcan_Ip_pData->flexcanMode;
  FlexCAN_SetOperationMode (pBase, _7);
  # DEBUG BEGIN_STMT
  i = 0;
  goto <bb 8>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  Flexcan_Ip_pState->mbs[i].isPolling = 1;
  # DEBUG BEGIN_STMT
  Flexcan_Ip_pState->mbs[i].pMBmessage = 0B;
  # DEBUG BEGIN_STMT
  Flexcan_Ip_pState->mbs[i].state = 0;
  # DEBUG BEGIN_STMT
  Flexcan_Ip_pState->mbs[i].time_stamp = 0;
  # DEBUG BEGIN_STMT
  i = i + 1;

  <bb 8> :
  # DEBUG BEGIN_STMT
  if (i <= 31)
    goto <bb 7>; [INV]
  else
    goto <bb 9>; [INV]

  <bb 9> :
  # DEBUG BEGIN_STMT
  _8 = Flexcan_Ip_pData->transfer_type;
  Flexcan_Ip_pState->transferType = _8;
  # DEBUG BEGIN_STMT
  _9 = Flexcan_Ip_pData->Callback;
  Flexcan_Ip_pState->callback = _9;
  # DEBUG BEGIN_STMT
  Flexcan_Ip_pState->callbackParam = 0B;
  # DEBUG BEGIN_STMT
  _10 = Flexcan_Ip_pData->ErrorCallback;
  Flexcan_Ip_pState->error_callback = _10;
  # DEBUG BEGIN_STMT
  Flexcan_Ip_pState->errorCallbackParam = 0B;
  # DEBUG BEGIN_STMT
  _11 = Flexcan_Ip_pData->is_rx_fifo_needed;
  Flexcan_Ip_pState->bIsLegacyFifoEn = _11;
  # DEBUG BEGIN_STMT
  _12 = Flexcan_Ip_pData->max_num_mb;
  Flexcan_Ip_pState->u32MaxMbNum = _12;
  # DEBUG BEGIN_STMT
  Flexcan_Ip_pState->isIntActive = 1;
  # DEBUG BEGIN_STMT
  _13 = (int) Flexcan_Ip_u8Instance;
  Flexcan_Ip_apxState[_13] = Flexcan_Ip_pState;

  <bb 10> :
  # DEBUG BEGIN_STMT
  D.7655 = eResult;
  return D.7655;

}


FlexCAN_AbortRxTransfer (uint8 u8Instance, uint8 mb_idx)
{
  volatile uint32 * flexcan_mb;
  uint32 flexcan_mb_config;
  uint32 val2;
  uint32 val1;
  struct Flexcan_Ip_StateType * state;
  struct FLEXCAN_Type * pBase;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = (int) u8Instance;
  pBase = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  _2 = (int) u8Instance;
  state = Flexcan_Ip_apxState[_2];
  # DEBUG BEGIN_STMT
  val1 = 0;
  # DEBUG BEGIN_STMT
  val2 = 0;
  # DEBUG BEGIN_STMT
  flexcan_mb_config = 0;
  # DEBUG BEGIN_STMT
  flexcan_mb = 0B;
  # DEBUG BEGIN_STMT
  _3 = (int) mb_idx;
  state->mbs[_3].state = 0;
  # DEBUG BEGIN_STMT
  _4 = state->bIsLegacyFifoEn;
  if (_4 != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 7>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  _5 = pBase->CTRL2;
  _6 = _5 >> 24;
  val1 = _6 & 15;
  # DEBUG BEGIN_STMT
  val2 = RxFifoOcuppiedLastMsgBuff (val1);
  # DEBUG BEGIN_STMT
  _7 = (long unsigned int) mb_idx;
  if (val2 < _7)
    goto <bb 4>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  _8 = (long unsigned int) mb_idx;
  flexcan_mb = FlexCAN_GetMsgBuffRegion (pBase, _8);
  # DEBUG BEGIN_STMT
  flexcan_mb_config = *flexcan_mb;
  # DEBUG BEGIN_STMT
  flexcan_mb_config = flexcan_mb_config & 4043309055;
  # DEBUG BEGIN_STMT
  flexcan_mb_config = flexcan_mb_config;
  # DEBUG BEGIN_STMT
  *flexcan_mb = flexcan_mb_config;
  # DEBUG BEGIN_STMT
  flexcan_mb_config = flexcan_mb_config & 4043309055;
  # DEBUG BEGIN_STMT
  flexcan_mb_config = flexcan_mb_config | 67108864;
  # DEBUG BEGIN_STMT
  *flexcan_mb = flexcan_mb_config;

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

  <bb 6> :
  # DEBUG BEGIN_STMT
  _9 = state->isIntActive;
  FLEXCAN_ClearMsgBuffIntCmd (pBase, u8Instance, 5, _9);
  goto <bb 8>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  _10 = (long unsigned int) mb_idx;
  flexcan_mb = FlexCAN_GetMsgBuffRegion (pBase, _10);
  # DEBUG BEGIN_STMT
  flexcan_mb_config = *flexcan_mb;
  # DEBUG BEGIN_STMT
  flexcan_mb_config = flexcan_mb_config & 4043309055;
  # DEBUG BEGIN_STMT
  flexcan_mb_config = flexcan_mb_config;
  # DEBUG BEGIN_STMT
  *flexcan_mb = flexcan_mb_config;
  # DEBUG BEGIN_STMT
  flexcan_mb_config = flexcan_mb_config & 4043309055;
  # DEBUG BEGIN_STMT
  flexcan_mb_config = flexcan_mb_config | 67108864;
  # DEBUG BEGIN_STMT
  *flexcan_mb = flexcan_mb_config;

  <bb 8> :
  # DEBUG BEGIN_STMT
  _11 = (long unsigned int) mb_idx;
  FlexCAN_ClearMsgBuffIntStatusFlag (pBase, _11);
  return;

}


FlexCAN_AbortTxTransfer (uint8 u8Instance, uint8 mb_idx)
{
  volatile uint32 * flexcan_mb;
  uint32 uS2Ticks;
  uint32 flexcan_mb_config;
  uint32 timeElapsed;
  uint32 timeStart;
  Flexcan_Ip_StatusType result;
  struct Flexcan_Ip_StateType * state;
  struct FLEXCAN_Type * pBase;
  Flexcan_Ip_StatusType D.8152;
  long unsigned int D.8143;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = (int) u8Instance;
  pBase = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  _2 = (int) u8Instance;
  state = Flexcan_Ip_apxState[_2];
  # DEBUG BEGIN_STMT
  result = 0;
  # DEBUG BEGIN_STMT
  timeStart = 0;
  # DEBUG BEGIN_STMT
  timeElapsed = 0;
  # DEBUG BEGIN_STMT
  flexcan_mb_config = 0;
  # DEBUG BEGIN_STMT
  uS2Ticks = 0;
  # DEBUG BEGIN_STMT
  flexcan_mb = 0B;
  # DEBUG BEGIN_STMT
  _3 = (long unsigned int) mb_idx;
  flexcan_mb = FlexCAN_GetMsgBuffRegion (pBase, _3);
  # DEBUG BEGIN_STMT
  flexcan_mb_config = *flexcan_mb;
  # DEBUG BEGIN_STMT
  flexcan_mb_config = flexcan_mb_config & 4043309055;
  # DEBUG BEGIN_STMT
  flexcan_mb_config = flexcan_mb_config | 150994944;
  # DEBUG BEGIN_STMT
  *flexcan_mb = flexcan_mb_config;
  # DEBUG BEGIN_STMT
  uS2Ticks = OsIf_MicrosToTicks (1000000, 0);
  # DEBUG BEGIN_STMT
  _4 = OsIf_GetCounter (0);
  timeStart = _4;
  # DEBUG BEGIN_STMT
  goto <bb 5>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  D.8143 = OsIf_GetElapsed (&timeStart, 0);
  timeElapsed = D.8143 + timeElapsed;
  # DEBUG BEGIN_STMT
  if (timeElapsed >= uS2Ticks)
    goto <bb 4>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  result = 3;
  # DEBUG BEGIN_STMT
  goto <bb 6>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  _5 = (long unsigned int) mb_idx;
  _6 = FlexCAN_GetBuffStatusFlag (pBase, _5);
  if (_6 == 0)
    goto <bb 3>; [INV]
  else
    goto <bb 6>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  if (result != 3)
    goto <bb 7>; [INV]
  else
    goto <bb 11>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  flexcan_mb_config = *flexcan_mb;
  # DEBUG BEGIN_STMT
  _7 = flexcan_mb_config >> 24;
  _8 = _7 & 15;
  if (_8 == 8)
    goto <bb 8>; [INV]
  else
    goto <bb 9>; [INV]

  <bb 8> :
  # DEBUG BEGIN_STMT
  result = 5;

  <bb 9> :
  # DEBUG BEGIN_STMT
  _9 = flexcan_mb_config >> 24;
  _10 = _9 & 15;
  if (_10 == 9)
    goto <bb 10>; [INV]
  else
    goto <bb 11>; [INV]

  <bb 10> :
  # DEBUG BEGIN_STMT
  result = 0;

  <bb 11> :
  # DEBUG BEGIN_STMT
  _11 = (long unsigned int) mb_idx;
  FlexCAN_ClearMsgBuffIntStatusFlag (pBase, _11);
  # DEBUG BEGIN_STMT
  _12 = (int) mb_idx;
  state->mbs[_12].state = 0;
  # DEBUG BEGIN_STMT
  D.8152 = result;
  timeStart = {CLOBBER};
  return D.8152;

}


FlexCAN_ProcessSpuriousInterruptMB (uint8 instance, uint32 startMbIdx, uint32 endMbIdx)
{
  uint32 u32MbHandle;
  uint32 mb_idx;
  struct Flexcan_Ip_StateType * state;
  struct FLEXCAN_Type * base;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = (int) instance;
  base = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  _2 = (int) instance;
  state = Flexcan_Ip_apxState[_2];
  # DEBUG BEGIN_STMT
  mb_idx = 0;
  # DEBUG BEGIN_STMT
  u32MbHandle = 0;
  # DEBUG BEGIN_STMT
  mb_idx = startMbIdx;
  goto <bb 12>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  _3 = FlexCAN_GetBuffStatusFlag (base, mb_idx);
  if (_3 != 0)
    goto <bb 4>; [INV]
  else
    goto <bb 11>; [INV]

  <bb 4> :
  _4 = FlexCAN_GetBuffStatusImask (base, mb_idx);
  if (_4 == 0)
    goto <bb 5>; [INV]
  else
    goto <bb 11>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  u32MbHandle = mb_idx;
  # DEBUG BEGIN_STMT
  _5 = state->bIsLegacyFifoEn;
  if (_5 != 0)
    goto <bb 6>; [INV]
  else
    goto <bb 8>; [INV]

  <bb 6> :
  if (mb_idx <= 7)
    goto <bb 7>; [INV]
  else
    goto <bb 8>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  u32MbHandle = 0;

  <bb 8> :
  # DEBUG BEGIN_STMT
  _6 = state->mbs[u32MbHandle].isPolling;
  _7 = ~_6;
  if (_7 != 0)
    goto <bb 9>; [INV]
  else
    goto <bb 11>; [INV]

  <bb 9> :
  # DEBUG BEGIN_STMT
  FlexCAN_ClearMsgBuffIntStatusFlag (base, mb_idx);
  # DEBUG BEGIN_STMT
  _8 = state->mbs[u32MbHandle].state;
  if (_8 == 2)
    goto <bb 10>; [INV]
  else
    goto <bb 11>; [INV]

  <bb 10> :
  # DEBUG BEGIN_STMT
  state->mbs[u32MbHandle].state = 0;
  # DEBUG BEGIN_STMT
  state->mbs[u32MbHandle].isPolling = 1;

  <bb 11> :
  # DEBUG BEGIN_STMT
  mb_idx = mb_idx + 1;

  <bb 12> :
  # DEBUG BEGIN_STMT
  if (mb_idx <= endMbIdx)
    goto <bb 3>; [INV]
  else
    goto <bb 13>; [INV]

  <bb 13> :
  return;

}


FlexCAN_IRQHandlerRxFIFO (uint8 instance, uint32 mb_idx)
{
  struct Flexcan_Ip_MsgBuffType data;
  struct Flexcan_Ip_StateType * state;
  struct FLEXCAN_Type * base;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = (int) instance;
  base = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  _2 = (int) instance;
  state = Flexcan_Ip_apxState[_2];
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _3 = state->mbs[0].pMBmessage;
  if (_3 == 0B)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  state->mbs[0].pMBmessage = &data;

  <bb 4> :
  # DEBUG BEGIN_STMT
  switch (mb_idx) <default: <L17> [INV], case 5: <L2> [INV], case 6: <L9> [INV], case 7: <L12> [INV]>

  <bb 5> :
<L2>:
  # DEBUG BEGIN_STMT
  _4 = state->mbs[0].state;
  if (_4 == 1)
    goto <bb 6>; [INV]
  else
    goto <bb 14>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  _5 = state->mbs[0].pMBmessage;
  FlexCAN_ReadRxFifo (base, _5);
  # DEBUG BEGIN_STMT
  FlexCAN_ClearMsgBuffIntStatusFlag (base, mb_idx);
  # DEBUG BEGIN_STMT
  state->mbs[0].state = 0;
  # DEBUG BEGIN_STMT
  _6 = state->callback;
  if (_6 != 0B)
    goto <bb 7>; [INV]
  else
    goto <bb 8>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  _7 = state->callback;
  _7 (instance, 1, 0, state);

  <bb 8> :
  # DEBUG BEGIN_STMT
  _8 = state->mbs[0].state;
  if (_8 == 0)
    goto <bb 9>; [INV]
  else
    goto <bb 14>; [INV]

  <bb 9> :
  # DEBUG BEGIN_STMT
  state->mbs[0].isPolling = 1;
  # DEBUG BEGIN_STMT
  FlexCAN_CompleteRxMessageFifoData (instance);
  goto <bb 14>; [INV]

  <bb 10> :
<L9>:
  # DEBUG BEGIN_STMT
  FlexCAN_ClearMsgBuffIntStatusFlag (base, mb_idx);
  # DEBUG BEGIN_STMT
  _9 = state->callback;
  if (_9 != 0B)
    goto <bb 11>; [INV]
  else
    goto <bb 14>; [INV]

  <bb 11> :
  # DEBUG BEGIN_STMT
  _10 = state->callback;
  _10 (instance, 2, 0, state);
  goto <bb 14>; [INV]

  <bb 12> :
<L12>:
  # DEBUG BEGIN_STMT
  FlexCAN_ClearMsgBuffIntStatusFlag (base, mb_idx);
  # DEBUG BEGIN_STMT
  _11 = state->callback;
  if (_11 != 0B)
    goto <bb 13>; [INV]
  else
    goto <bb 14>; [INV]

  <bb 13> :
  # DEBUG BEGIN_STMT
  _12 = state->callback;
  _12 (instance, 3, 0, state);

  <bb 14> :
<L17>:
  data = {CLOBBER};
  return;

}


FlexCAN_IRQHandlerTxMB (uint8 u8Instance, uint32 u32MbIdx)
{
  boolean bCurrentIntStat;
  struct Flexcan_Ip_MsgBuffType mb;
  struct Flexcan_Ip_StateType * pState;
  struct FLEXCAN_Type * pBase;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = (int) u8Instance;
  pBase = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  _2 = (int) u8Instance;
  pState = Flexcan_Ip_apxState[_2];
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  bCurrentIntStat = 0;
  # DEBUG BEGIN_STMT
  _3 = pState->mbs[u32MbIdx].isRemote;
  if (_3 != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  FlexCAN_LockRxMsgBuff (pBase, u32MbIdx);
  # DEBUG BEGIN_STMT
  FlexCAN_GetMsgBuff (pBase, u32MbIdx, &mb);
  # DEBUG BEGIN_STMT
  FlexCAN_UnlockRxMsgBuff (pBase);
  # DEBUG BEGIN_STMT
  _4 = mb.time_stamp;
  pState->mbs[u32MbIdx].time_stamp = _4;
  # DEBUG BEGIN_STMT
  _5 = mb.cs;
  _6 = _5 >> 24;
  _7 = _6 & 15;
  if (_7 == 4)
    goto <bb 4>; [INV]
  else
    goto <bb 6>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  FlexCAN_ClearMsgBuffIntStatusFlag (pBase, u32MbIdx);
  goto <bb 6>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  _8 = FlexCAN_GetMsgBuffTimestamp (pBase, u32MbIdx);
  pState->mbs[u32MbIdx].time_stamp = _8;
  # DEBUG BEGIN_STMT
  FlexCAN_UnlockRxMsgBuff (pBase);
  # DEBUG BEGIN_STMT
  FlexCAN_ClearMsgBuffIntStatusFlag (pBase, u32MbIdx);

  <bb 6> :
  # DEBUG BEGIN_STMT
  pState->mbs[u32MbIdx].state = 0;
  # DEBUG BEGIN_STMT
  bCurrentIntStat = pState->mbs[u32MbIdx].isPolling;
  # DEBUG BEGIN_STMT
  _9 = pState->callback;
  if (_9 != 0B)
    goto <bb 7>; [INV]
  else
    goto <bb 8>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  _10 = pState->callback;
  _10 (u8Instance, 4, u32MbIdx, pState);

  <bb 8> :
  # DEBUG BEGIN_STMT
  _11 = pState->mbs[u32MbIdx].state;
  if (_11 == 0)
    goto <bb 9>; [INV]
  else
    goto <bb 11>; [INV]

  <bb 9> :
  _12 = pState->mbs[u32MbIdx].isPolling;
  _13 = ~_12;
  if (_13 != 0)
    goto <bb 10>; [INV]
  else
    goto <bb 11>; [INV]

  <bb 10> :
  # DEBUG BEGIN_STMT
  pState->mbs[u32MbIdx].isPolling = 1;
  # DEBUG BEGIN_STMT
  _14 = pState->isIntActive;
  FlexCAN_SetMsgBuffIntCmd (pBase, u8Instance, u32MbIdx, 0, _14);
  goto <bb 14>; [INV]

  <bb 11> :
  # DEBUG BEGIN_STMT
  _15 = ~bCurrentIntStat;
  if (_15 != 0)
    goto <bb 12>; [INV]
  else
    goto <bb 14>; [INV]

  <bb 12> :
  _16 = pState->mbs[u32MbIdx].isPolling;
  if (_16 != 0)
    goto <bb 13>; [INV]
  else
    goto <bb 14>; [INV]

  <bb 13> :
  # DEBUG BEGIN_STMT
  _17 = pState->isIntActive;
  FlexCAN_SetMsgBuffIntCmd (pBase, u8Instance, u32MbIdx, 0, _17);

  <bb 14> :
  # DEBUG BEGIN_STMT
  mb = {CLOBBER};
  return;

}


FlexCAN_IRQHandlerRxMB (uint8 instance, uint32 mb_idx)
{
  volatile uint32 * flexcan_mb;
  boolean bIsCriticalSectionNeeded;
  boolean bCurrentIntStat;
  struct Flexcan_Ip_MsgBuffType data;
  struct Flexcan_Ip_StateType * state;
  struct FLEXCAN_Type * base;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = (int) instance;
  base = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  _2 = (int) instance;
  state = Flexcan_Ip_apxState[_2];
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  bCurrentIntStat = 0;
  # DEBUG BEGIN_STMT
  _3 = state->mbs[mb_idx].pMBmessage;
  if (_3 == 0B)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  state->mbs[mb_idx].pMBmessage = &data;

  <bb 4> :
  # DEBUG BEGIN_STMT
  bIsCriticalSectionNeeded = 0;
  # DEBUG BEGIN_STMT
  _4 = state->mbs[mb_idx].isPolling;
  if (_4 != 0)
    goto <bb 5>; [INV]
  else
    goto <bb 7>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  _5 = state->bIsLegacyFifoEn;
  if (_5 != 0)
    goto <bb 6>; [INV]
  else
    goto <bb 7>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  bIsCriticalSectionNeeded = 1;
  # DEBUG BEGIN_STMT
  __asm__ __volatile__(" cpsid i");

  <bb 7> :
  # DEBUG BEGIN_STMT
  FlexCAN_LockRxMsgBuff (base, mb_idx);
  # DEBUG BEGIN_STMT
  _6 = state->mbs[mb_idx].pMBmessage;
  FlexCAN_GetMsgBuff (base, mb_idx, _6);
  # DEBUG BEGIN_STMT
  FlexCAN_ClearMsgBuffIntStatusFlag (base, mb_idx);
  # DEBUG BEGIN_STMT
  _7 = state->bIsLegacyFifoEn;
  if (_7 != 0)
    goto <bb 8>; [INV]
  else
    goto <bb 10>; [INV]

  <bb 8> :
  _8 = state->mbs[mb_idx].pMBmessage;
  _9 = _8->cs;
  _10 = _9 >> 24;
  _11 = _10 & 15;
  if (_11 == 0)
    goto <bb 9>; [INV]
  else
    goto <bb 10>; [INV]

  <bb 9> :
  # DEBUG BEGIN_STMT
  flexcan_mb = FlexCAN_GetMsgBuffRegion (base, mb_idx);
  # DEBUG BEGIN_STMT
  _12 = *flexcan_mb;
  _13 = _12 & 4043309055;
  *flexcan_mb = _13;
  # DEBUG BEGIN_STMT
  _14 = *flexcan_mb;
  _15 = _14 | 67108864;
  *flexcan_mb = _15;
  goto <bb 11>; [INV]

  <bb 10> :
  # DEBUG BEGIN_STMT
  FlexCAN_UnlockRxMsgBuff (base);

  <bb 11> :
  # DEBUG BEGIN_STMT
  if (bIsCriticalSectionNeeded != 0)
    goto <bb 12>; [INV]
  else
    goto <bb 13>; [INV]

  <bb 12> :
  # DEBUG BEGIN_STMT
  __asm__ __volatile__(" cpsie i");

  <bb 13> :
  # DEBUG BEGIN_STMT
  state->mbs[mb_idx].state = 0;
  # DEBUG BEGIN_STMT
  bCurrentIntStat = state->mbs[mb_idx].isPolling;
  # DEBUG BEGIN_STMT
  _16 = state->callback;
  if (_16 != 0B)
    goto <bb 14>; [INV]
  else
    goto <bb 15>; [INV]

  <bb 14> :
  # DEBUG BEGIN_STMT
  _17 = state->callback;
  _17 (instance, 0, mb_idx, state);

  <bb 15> :
  # DEBUG BEGIN_STMT
  _18 = state->mbs[mb_idx].state;
  if (_18 == 0)
    goto <bb 16>; [INV]
  else
    goto <bb 18>; [INV]

  <bb 16> :
  _19 = state->mbs[mb_idx].isPolling;
  _20 = ~_19;
  if (_20 != 0)
    goto <bb 17>; [INV]
  else
    goto <bb 18>; [INV]

  <bb 17> :
  # DEBUG BEGIN_STMT
  state->mbs[mb_idx].isPolling = 1;
  # DEBUG BEGIN_STMT
  _21 = state->isIntActive;
  FlexCAN_SetMsgBuffIntCmd (base, instance, mb_idx, 0, _21);
  goto <bb 21>; [INV]

  <bb 18> :
  # DEBUG BEGIN_STMT
  _22 = ~bCurrentIntStat;
  if (_22 != 0)
    goto <bb 19>; [INV]
  else
    goto <bb 21>; [INV]

  <bb 19> :
  _23 = state->mbs[mb_idx].isPolling;
  if (_23 != 0)
    goto <bb 20>; [INV]
  else
    goto <bb 21>; [INV]

  <bb 20> :
  # DEBUG BEGIN_STMT
  _24 = state->isIntActive;
  FlexCAN_SetMsgBuffIntCmd (base, instance, mb_idx, 0, _24);

  <bb 21> :
  # DEBUG BEGIN_STMT
  data = {CLOBBER};
  return;

}


FlexCAN_StartRxMessageFifoData (uint8 instance, struct Flexcan_Ip_MsgBuffType * data)
{
  Flexcan_Ip_StatusType eResult;
  struct Flexcan_Ip_StateType * state;
  struct FLEXCAN_Type * base;
  Flexcan_Ip_StatusType D.7790;

  <bb 2> :
  # DEBUG BEGIN_STMT
  base = 0B;
  # DEBUG BEGIN_STMT
  state = 0B;
  # DEBUG BEGIN_STMT
  eResult = 0;
  # DEBUG BEGIN_STMT
  _1 = (int) instance;
  base = Flexcan_Ip_apxBase[_1];
  # DEBUG BEGIN_STMT
  _2 = (int) instance;
  state = Flexcan_Ip_apxState[_2];
  # DEBUG BEGIN_STMT
  _3 = state->mbs[0].state;
  if (_3 != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  eResult = 2;
  goto <bb 8>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  state->mbs[0].state = 1;
  # DEBUG BEGIN_STMT
  _4 = state->transferType;
  if (_4 == 1)
    goto <bb 5>; [INV]
  else
    goto <bb 6>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  state->mbs[0].isPolling = 1;

  <bb 6> :
  # DEBUG BEGIN_STMT
  state->mbs[0].pMBmessage = data;
  # DEBUG BEGIN_STMT
  _5 = state->transferType;
  if (_5 == 0)
    goto <bb 7>; [INV]
  else
    goto <bb 8>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  state->mbs[0].isPolling = 0;
  # DEBUG BEGIN_STMT
  _6 = state->isIntActive;
  FlexCAN_SetMsgBuffIntCmd (base, instance, 6, 1, _6);
  # DEBUG BEGIN_STMT
  _7 = state->isIntActive;
  FlexCAN_SetMsgBuffIntCmd (base, instance, 7, 1, _7);
  # DEBUG BEGIN_STMT
  _8 = state->isIntActive;
  FlexCAN_SetMsgBuffIntCmd (base, instance, 5, 1, _8);

  <bb 8> :
  # DEBUG BEGIN_STMT
  D.7790 = eResult;
  return D.7790;

}


FlexCAN_StartSendData (uint8 Flexcan_Ip_u8Instance, uint8 mb_idx, const struct Flexcan_Ip_DataInfoType * tx_info, uint32 msg_id, const uint8 * mb_data)
{
  volatile uint32 * pMbAddr;
  struct FLEXCAN_Type * base;
  struct Flexcan_Ip_StateType * state;
  struct Flexcan_Ip_MsbuffCodeStatusType cs;
  Flexcan_Ip_StatusType eResult;
  Flexcan_Ip_StatusType D.7715;

  <bb 2> :
  # DEBUG BEGIN_STMT
  eResult = 0;
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _1 = (int) Flexcan_Ip_u8Instance;
  state = Flexcan_Ip_apxState[_1];
  # DEBUG BEGIN_STMT
  _2 = (int) Flexcan_Ip_u8Instance;
  base = Flexcan_Ip_apxBase[_2];
  # DEBUG BEGIN_STMT
  pMbAddr = 0B;
  # DEBUG BEGIN_STMT
  _3 = (int) mb_idx;
  _4 = state->mbs[_3].state;
  if (_4 != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  eResult = 2;
  goto <bb 8>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  _5 = (long unsigned int) mb_idx;
  FlexCAN_ClearMsgBuffIntStatusFlag (base, _5);
  # DEBUG BEGIN_STMT
  _6 = (int) mb_idx;
  state->mbs[_6].state = 2;
  # DEBUG BEGIN_STMT
  _7 = (int) mb_idx;
  state->mbs[_7].time_stamp = 0;
  # DEBUG BEGIN_STMT
  _8 = (int) mb_idx;
  _9 = tx_info->is_polling;
  state->mbs[_8].isPolling = _9;
  # DEBUG BEGIN_STMT
  _10 = (int) mb_idx;
  _11 = tx_info->is_remote;
  state->mbs[_10].isRemote = _11;
  # DEBUG BEGIN_STMT
  _12 = tx_info->data_length;
  cs.dataLen = _12;
  # DEBUG BEGIN_STMT
  _13 = tx_info->msg_id_type;
  cs.msgIdType = _13;
  # DEBUG BEGIN_STMT
  _14 = tx_info->fd_enable;
  cs.fd_enable = _14;
  # DEBUG BEGIN_STMT
  _15 = tx_info->fd_padding;
  cs.fd_padding = _15;
  # DEBUG BEGIN_STMT
  _16 = tx_info->enable_brs;
  cs.enable_brs = _16;
  # DEBUG BEGIN_STMT
  _17 = tx_info->is_remote;
  if (_17 != 0)
    goto <bb 5>; [INV]
  else
    goto <bb 6>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  cs.code = 28;
  goto <bb 7>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  cs.code = 12;

  <bb 7> :
  # DEBUG BEGIN_STMT
  _18 = (long unsigned int) mb_idx;
  pMbAddr = FlexCAN_GetMsgBuffRegion (base, _18);
  # DEBUG BEGIN_STMT
  FlexCAN_SetTxMsgBuff (pMbAddr, &cs, msg_id, mb_data, 0);

  <bb 8> :
  # DEBUG BEGIN_STMT
  D.7715 = eResult;
  cs = {CLOBBER};
  return D.7715;

}


FlexCAN_StartRxMessageBufferData (uint8 instance, uint8 mb_idx, struct Flexcan_Ip_MsgBuffType * data, boolean isPolling)
{
  struct Flexcan_Ip_StateType * state;
  Flexcan_Ip_StatusType result;
  Flexcan_Ip_StatusType D.7728;

  <bb 2> :
  # DEBUG BEGIN_STMT
  result = 0;
  # DEBUG BEGIN_STMT
  _1 = (int) instance;
  state = Flexcan_Ip_apxState[_1];
  # DEBUG BEGIN_STMT
  _2 = (int) mb_idx;
  _3 = state->mbs[_2].state;
  if (_3 != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  result = 2;
  goto <bb 5>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  _4 = (int) mb_idx;
  state->mbs[_4].state = 1;
  # DEBUG BEGIN_STMT
  _5 = (int) mb_idx;
  state->mbs[_5].pMBmessage = data;
  # DEBUG BEGIN_STMT
  _6 = (int) mb_idx;
  state->mbs[_6].isPolling = isPolling;

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

}


FlexCAN_ProccessLegacyRxFIFO (uint8 u8Instance, uint32 u32TimeoutMs)
{
  uint32 u32intType;
  uint32 mS2Ticks;
  uint32 timeElapsed;
  uint32 timeStart;
  struct FLEXCAN_Type * pBase;
  struct Flexcan_Ip_StateType * pState;
  Flexcan_Ip_StatusType eResult;
  Flexcan_Ip_StatusType D.7807;
  long unsigned int D.7800;

  <bb 2> :
  # DEBUG BEGIN_STMT
  eResult = 0;
  # DEBUG BEGIN_STMT
  _1 = (int) u8Instance;
  pState = Flexcan_Ip_apxState[_1];
  # DEBUG BEGIN_STMT
  _2 = (int) u8Instance;
  pBase = Flexcan_Ip_apxBase[_2];
  # DEBUG BEGIN_STMT
  timeStart = 0;
  # DEBUG BEGIN_STMT
  timeElapsed = 0;
  # DEBUG BEGIN_STMT
  _3 = u32TimeoutMs * 1000;
  mS2Ticks = OsIf_MicrosToTicks (_3, 0);
  # DEBUG BEGIN_STMT
  u32intType = 0;
  # DEBUG BEGIN_STMT
  _4 = OsIf_GetCounter (0);
  timeStart = _4;
  # DEBUG BEGIN_STMT
  goto <bb 11>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  _5 = pState->transferType;
  if (_5 == 1)
    goto <bb 4>; [INV]
  else
    goto <bb 9>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  u32intType = 7;
  goto <bb 8>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  _6 = FlexCAN_GetBuffStatusFlag (pBase, u32intType);
  if (_6 != 0)
    goto <bb 6>; [INV]
  else
    goto <bb 7>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  FlexCAN_IRQHandlerRxFIFO (u8Instance, u32intType);

  <bb 7> :
  # DEBUG BEGIN_STMT
  u32intType = u32intType + 4294967295;

  <bb 8> :
  # DEBUG BEGIN_STMT
  if (u32intType > 4)
    goto <bb 5>; [INV]
  else
    goto <bb 9>; [INV]

  <bb 9> :
  # DEBUG BEGIN_STMT
  D.7800 = OsIf_GetElapsed (&timeStart, 0);
  timeElapsed = D.7800 + timeElapsed;
  # DEBUG BEGIN_STMT
  if (timeElapsed >= mS2Ticks)
    goto <bb 10>; [INV]
  else
    goto <bb 11>; [INV]

  <bb 10> :
  # DEBUG BEGIN_STMT
  eResult = 3;
  # DEBUG BEGIN_STMT
  goto <bb 12>; [INV]

  <bb 11> :
  # DEBUG BEGIN_STMT
  _7 = pState->mbs[0].state;
  if (_7 == 1)
    goto <bb 3>; [INV]
  else
    goto <bb 12>; [INV]

  <bb 12> :
  # DEBUG BEGIN_STMT
  if (eResult == 3)
    goto <bb 13>; [INV]
  else
    goto <bb 15>; [INV]

  <bb 13> :
  _8 = pState->transferType;
  if (_8 != 1)
    goto <bb 14>; [INV]
  else
    goto <bb 15>; [INV]

  <bb 14> :
  # DEBUG BEGIN_STMT
  _9 = pState->isIntActive;
  FlexCAN_SetMsgBuffIntCmd (pBase, u8Instance, 5, 0, _9);
  # DEBUG BEGIN_STMT
  _10 = pState->isIntActive;
  FlexCAN_SetMsgBuffIntCmd (pBase, u8Instance, 6, 0, _10);
  # DEBUG BEGIN_STMT
  _11 = pState->isIntActive;
  FlexCAN_SetMsgBuffIntCmd (pBase, u8Instance, 7, 0, _11);

  <bb 15> :
  # DEBUG BEGIN_STMT
  _12 = pState->mbs[0].state;
  switch (_12) <default: <L18> [INV], case 0: <L17> [INV], case 1: <L16> [INV]>

  <bb 16> :
<L16>:
  # DEBUG BEGIN_STMT
  pState->mbs[0].state = 0;
  # DEBUG BEGIN_STMT
  goto <bb 19>; [INV]

  <bb 17> :
<L17>:
  # DEBUG BEGIN_STMT
  eResult = 0;
  # DEBUG BEGIN_STMT
  goto <bb 19>; [INV]

  <bb 18> :
<L18>:
  # DEBUG BEGIN_STMT
  eResult = 1;
  # DEBUG BEGIN_STMT

  <bb 19> :
  # DEBUG BEGIN_STMT
  D.7807 = eResult;
  timeStart = {CLOBBER};
  return D.7807;

}


FlexCAN_InitController (struct FLEXCAN_Type * pBase, const struct Flexcan_Ip_ConfigType * Flexcan_Ip_pData)
{
  Flexcan_Ip_StatusType eResult;
  Flexcan_Ip_StatusType D.7668;

  <bb 2> :
  # DEBUG BEGIN_STMT
  eResult = 0;
  # DEBUG BEGIN_STMT
  _1 = FlexCAN_IsEnabled (pBase);
  if (_1 != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  eResult = FlexCAN_EnterFreezeMode (pBase);
  # DEBUG BEGIN_STMT
  if (eResult == 0)
    goto <bb 4>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  eResult = FlexCAN_Disable (pBase);

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

  <bb 6> :
  # DEBUG BEGIN_STMT
  _2 = Flexcan_Ip_pData->is_pe_clock;
  FlexCAN_SetClkSrc (pBase, _2);
  # DEBUG BEGIN_STMT
  _3 = pBase->MCR;
  _4 = _3 & 2147483647;
  pBase->MCR = _4;
  # DEBUG BEGIN_STMT
  eResult = FlexCAN_Init (pBase);
  # DEBUG BEGIN_STMT
  if (eResult != 0)
    goto <bb 7>; [INV]
  else
    goto <bb 8>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  FlexCAN_EnterFreezeMode (pBase);
  # DEBUG BEGIN_STMT
  FlexCAN_Disable (pBase);
  goto <bb 11>; [INV]

  <bb 8> :
  # DEBUG BEGIN_STMT
  _5 = FlexCAN_IsFDAvailable (pBase);
  if (_5 != 0)
    goto <bb 9>; [INV]
  else
    goto <bb 10>; [INV]

  <bb 9> :
  # DEBUG BEGIN_STMT
  _6 = Flexcan_Ip_pData->fd_enable;
  _7 = Flexcan_Ip_pData->bitRateSwitch;
  FlexCAN_SetFDEnabled (pBase, _6, _7);

  <bb 10> :
  # DEBUG BEGIN_STMT
  _8 = Flexcan_Ip_pData->ctrlOptions;
  FlexCAN_ConfigCtrlOptions (pBase, _8);
  # DEBUG BEGIN_STMT
  eResult = FlexCAN_InitCtroll (pBase, Flexcan_Ip_pData);

  <bb 11> :
  # DEBUG BEGIN_STMT
  D.7668 = eResult;
  return D.7668;

}


FlexCAN_InitCtroll (struct FLEXCAN_Type * pBase, const struct Flexcan_Ip_ConfigType * Flexcan_Ip_pData)
{
  Flexcan_Ip_StatusType eResult;
  Flexcan_Ip_StatusType D.7689;

  <bb 2> :
  # DEBUG BEGIN_STMT
  eResult = 0;
  # DEBUG BEGIN_STMT
  _1 = Flexcan_Ip_pData->flexcanMode;
  if (_1 != 2)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  FlexCAN_SetSelfReception (pBase, 0);

  <bb 4> :
  # DEBUG BEGIN_STMT
  eResult = FlexCAN_InitRxFifo (pBase, Flexcan_Ip_pData);
  # DEBUG BEGIN_STMT
  if (eResult != 0)
    goto <bb 5>; [INV]
  else
    goto <bb 6>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  FlexCAN_EnterFreezeMode (pBase);
  # DEBUG BEGIN_STMT
  FlexCAN_Disable (pBase);
  goto <bb 7>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  _2 = &Flexcan_Ip_pData->payload;
  FlexCAN_SetPayloadSize (pBase, _2);
  # DEBUG BEGIN_STMT
  _3 = Flexcan_Ip_pData->max_num_mb;
  FlexCAN_SetMaxMsgBuffNum (pBase, _3);

  <bb 7> :
  # DEBUG BEGIN_STMT
  D.7689 = eResult;
  return D.7689;

}


FlexCAN_InitRxFifo (struct FLEXCAN_Type * pBase, const struct Flexcan_Ip_ConfigType * Flexcan_Ip_pData)
{
  Flexcan_Ip_StatusType eResult;
  Flexcan_Ip_StatusType D.7697;

  <bb 2> :
  # DEBUG BEGIN_STMT
  eResult = 0;
  # DEBUG BEGIN_STMT
  _1 = Flexcan_Ip_pData->is_rx_fifo_needed;
  if (_1 != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  _2 = Flexcan_Ip_pData->num_id_filters;
  eResult = FlexCAN_EnableRxFifo (pBase, _2);

  <bb 4> :
  # DEBUG BEGIN_STMT
  D.7697 = eResult;
  return D.7697;

}


FlexCAN_ClearWUMF (struct FLEXCAN_Type * pBase)
{
  <bb 2> :
  # DEBUG BEGIN_STMT
  pBase->WU_MTC = 65536;
  return;

}


FlexCAN_GetWUMIE (const struct FLEXCAN_Type * pBase)
{
  uint8 D.8243;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = pBase->CTRL1_PN;
  _2 = _1 >> 16;
  _3 = (unsigned char) _2;
  D.8243 = _3 & 1;
  return D.8243;

}


FlexCAN_GetWUMF (const struct FLEXCAN_Type * pBase)
{
  uint8 D.8241;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = pBase->WU_MTC;
  _2 = _1 >> 16;
  _3 = (unsigned char) _2;
  D.8241 = _3 & 1;
  return D.8241;

}


FlexCAN_ClearWTOF (struct FLEXCAN_Type * pBase)
{
  <bb 2> :
  # DEBUG BEGIN_STMT
  pBase->WU_MTC = 131072;
  return;

}


FlexCAN_GetWTOIE (const struct FLEXCAN_Type * pBase)
{
  uint8 D.8239;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = pBase->CTRL1_PN;
  _2 = _1 >> 17;
  _3 = (unsigned char) _2;
  D.8239 = _3 & 1;
  return D.8239;

}


FlexCAN_GetWTOF (const struct FLEXCAN_Type * pBase)
{
  uint8 D.8237;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = pBase->WU_MTC;
  _2 = _1 >> 17;
  _3 = (unsigned char) _2;
  D.8237 = _3 & 1;
  return D.8237;

}


FlexCAN_SetPN (struct FLEXCAN_Type * pBase, boolean enable)
{
  long unsigned int iftmp.7;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = pBase->MCR;
  _2 = _1 & 4294950911;
  if (enable != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  iftmp.7 = 16384;
  goto <bb 5>; [INV]

  <bb 4> :
  iftmp.7 = 0;

  <bb 5> :
  _3 = iftmp.7 | _2;
  pBase->MCR = _3;
  return;

}


FlexCAN_SetRegDefaultVal (struct FLEXCAN_Type * base)
{
  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = FlexCAN_IsFDAvailable (base);
  if (_1 != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  base->FDCBT = 0;
  # DEBUG BEGIN_STMT
  base->FDCTRL = 2147500288;

  <bb 4> :
  # DEBUG BEGIN_STMT
  base->IFLAG1 = 4294967295;
  # DEBUG BEGIN_STMT
  base->IMASK1 = 0;
  # DEBUG BEGIN_STMT
  base->CBT = 0;
  # DEBUG BEGIN_STMT
  base->CTRL2 = 1048576;
  # DEBUG BEGIN_STMT
  base->ESR1 = 241670;
  # DEBUG BEGIN_STMT
  base->ECR = 0;
  # DEBUG BEGIN_STMT
  base->TIMER = 0;
  # DEBUG BEGIN_STMT
  base->CTRL1 = 0;
  # DEBUG BEGIN_STMT
  base->MCR = 3633315855;
  return;

}


FlexCAN_SetRxMaskType (struct FLEXCAN_Type * base, Flexcan_Ip_RxMaskType type)
{
  <bb 2> :
  # DEBUG BEGIN_STMT
  if (type == 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  _1 = base->MCR;
  _2 = _1 & 4294901759;
  base->MCR = _2;
  goto <bb 5>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  _3 = base->MCR;
  _4 = _3 | 65536;
  base->MCR = _4;

  <bb 5> :
  return;

}


FlexCAN_SetTxArbitrationStartDelay (struct FLEXCAN_Type * base, uint8 tasd)
{
  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = base->CTRL2;
  _2 = _1 & 4278714367;
  _3 = (long unsigned int) tasd;
  _4 = _3 << 19;
  _5 = _4 & 16252928;
  _6 = _2 | _5;
  base->CTRL2 = _6;
  return;

}


FlexCAN_SetRxIndividualMask (struct FLEXCAN_Type * base, uint32 msgBuffIdx, uint32 mask)
{
  <bb 2> :
  # DEBUG BEGIN_STMT
  base->RXIMR[msgBuffIdx] = mask;
  return;

}


FlexCAN_SetRxMsgBuffGlobalMask (struct FLEXCAN_Type * base, uint32 Mask)
{
  <bb 2> :
  # DEBUG BEGIN_STMT
  base->RXMGMASK = Mask;
  return;

}


FlexCAN_GetMsgBuffIntStatusFlag (const struct FLEXCAN_Type * base, uint32 msgBuffIdx)
{
  uint32 mask;
  uint8 flag;
  uint8 D.7887;

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

  <bb 3> :
  # DEBUG BEGIN_STMT
  mask = base->IMASK1;
  # DEBUG BEGIN_STMT
  _1 = base->IFLAG1;
  _2 = mask & _1;
  _3 = msgBuffIdx & 31;
  _4 = _2 >> _3;
  _5 = (unsigned char) _4;
  flag = _5 & 1;

  <bb 4> :
  # DEBUG BEGIN_STMT
  D.7887 = flag;
  return D.7887;

}


FlexCAN_SetClkSrc (struct FLEXCAN_Type * base, boolean enable)
{
  long unsigned int iftmp.0;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = base->CTRL1;
  _2 = _1 & 4294959103;
  if (enable != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  iftmp.0 = 8192;
  goto <bb 5>; [INV]

  <bb 4> :
  iftmp.0 = 0;

  <bb 5> :
  _3 = iftmp.0 | _2;
  base->CTRL1 = _3;
  return;

}


RxFifoOcuppiedLastMsgBuff (uint32 x)
{
  uint32 D.8162;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = x + 1;
  _2 = _1 * 8;
  _3 = _2 / 4;
  D.8162 = _3 + 5;
  return D.8162;

}


FlexCAN_IsListenOnlyModeEnabled (const struct FLEXCAN_Type * base)
{
  boolean D.7707;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = base->CTRL1;
  _2 = _1 & 8;
  D.7707 = _2 != 0;
  return D.7707;

}


FlexCAN_IsFDEnabled (const struct FLEXCAN_Type * base)
{
  boolean D.8085;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = base->MCR;
  _2 = _1 & 2048;
  D.8085 = _2 != 0;
  return D.8085;

}


FlexCAN_SetSelfReception (struct FLEXCAN_Type * base, boolean enable)
{
  long unsigned int iftmp.3;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = base->MCR;
  _2 = _1 & 4294836223;
  if (enable != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  iftmp.3 = 0;
  goto <bb 5>; [INV]

  <bb 4> :
  iftmp.3 = 131072;

  <bb 5> :
  _3 = iftmp.3 | _2;
  base->MCR = _3;
  return;

}


FlexCAN_EnableExtCbt (struct FLEXCAN_Type * base, boolean enableCBT)
{
  long unsigned int iftmp.4;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = base->CBT;
  _2 = _1 & 2147483647;
  if (enableCBT != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  iftmp.4 = 2147483648;
  goto <bb 5>; [INV]

  <bb 4> :
  iftmp.4 = 0;

  <bb 5> :
  _3 = iftmp.4 | _2;
  base->CBT = _3;
  return;

}


FlexCAN_IsExCbtEnabled (const struct FLEXCAN_Type * pBase)
{
  boolean D.8064;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = pBase->CBT;
  _2 = (signed int) _1;
  D.8064 = _2 < 0;
  return D.8064;

}


FlexCAN_GetFDTimeSegments (const struct FLEXCAN_Type * base, struct Flexcan_Ip_TimeSegmentType * timeSeg)
{
  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = base->FDCBT;
  _2 = _1 >> 20;
  _3 = _2 & 1023;
  timeSeg->preDivider = _3;
  # DEBUG BEGIN_STMT
  _4 = base->FDCBT;
  _5 = _4 >> 10;
  _6 = _5 & 31;
  timeSeg->propSeg = _6;
  # DEBUG BEGIN_STMT
  _7 = base->FDCBT;
  _8 = _7 >> 5;
  _9 = _8 & 7;
  timeSeg->phaseSeg1 = _9;
  # DEBUG BEGIN_STMT
  _10 = base->FDCBT;
  _11 = _10 & 7;
  timeSeg->phaseSeg2 = _11;
  # DEBUG BEGIN_STMT
  _12 = base->FDCBT;
  _13 = _12 >> 16;
  _14 = _13 & 7;
  timeSeg->rJumpwidth = _14;
  return;

}


FlexCAN_GetTimeSegments (const struct FLEXCAN_Type * base, struct Flexcan_Ip_TimeSegmentType * timeSeg)
{
  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = base->CTRL1;
  _2 = _1 >> 24;
  _3 = _2 & 255;
  timeSeg->preDivider = _3;
  # DEBUG BEGIN_STMT
  _4 = base->CTRL1;
  _5 = _4 & 7;
  timeSeg->propSeg = _5;
  # DEBUG BEGIN_STMT
  _6 = base->CTRL1;
  _7 = _6 >> 19;
  _8 = _7 & 7;
  timeSeg->phaseSeg1 = _8;
  # DEBUG BEGIN_STMT
  _9 = base->CTRL1;
  _10 = _9 >> 16;
  _11 = _10 & 7;
  timeSeg->phaseSeg2 = _11;
  # DEBUG BEGIN_STMT
  _12 = base->CTRL1;
  _13 = _12 >> 22;
  _14 = _13 & 3;
  timeSeg->rJumpwidth = _14;
  return;

}


FlexCAN_GetExtendedTimeSegments (const struct FLEXCAN_Type * base, struct Flexcan_Ip_TimeSegmentType * timeSeg)
{
  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = base->CBT;
  _2 = _1 >> 21;
  _3 = _2 & 1023;
  timeSeg->preDivider = _3;
  # DEBUG BEGIN_STMT
  _4 = base->CBT;
  _5 = _4 >> 10;
  _6 = _5 & 63;
  timeSeg->propSeg = _6;
  # DEBUG BEGIN_STMT
  _7 = base->CBT;
  _8 = _7 >> 5;
  _9 = _8 & 31;
  timeSeg->phaseSeg1 = _9;
  # DEBUG BEGIN_STMT
  _10 = base->CBT;
  _11 = _10 & 31;
  timeSeg->phaseSeg2 = _11;
  # DEBUG BEGIN_STMT
  _12 = base->CBT;
  _13 = _12 >> 16;
  _14 = _13 & 31;
  timeSeg->rJumpwidth = _14;
  return;

}


FlexCAN_SetExtendedTimeSegments (struct FLEXCAN_Type * base, const struct Flexcan_Ip_TimeSegmentType * timeSeg)
{
  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = base->CBT;
  _2 = _1 & 2147483648;
  base->CBT = _2;
  # DEBUG BEGIN_STMT
  _3 = base->CBT;
  _4 = timeSeg->propSeg;
  _5 = _4 << 10;
  _6 = _5 & 65535;
  _7 = timeSeg->phaseSeg2;
  _8 = _7 & 31;
  _9 = _6 | _8;
  _10 = timeSeg->phaseSeg1;
  _11 = _10 << 5;
  _12 = _11 & 992;
  _13 = _9 | _12;
  _14 = timeSeg->preDivider;
  _15 = _14 << 21;
  _16 = _15 & 2145386496;
  _17 = _13 | _16;
  _18 = timeSeg->rJumpwidth;
  _19 = _18 << 16;
  _20 = _19 & 2031616;
  _21 = _17 | _20;
  _22 = _3 | _21;
  base->CBT = _22;
  return;

}


FlexCAN_SetTimeSegments (struct FLEXCAN_Type * base, const struct Flexcan_Ip_TimeSegmentType * timeSeg)
{
  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = base->CTRL1;
  _2 = _1 & 65528;
  base->CTRL1 = _2;
  # DEBUG BEGIN_STMT
  _3 = base->CTRL1;
  _4 = timeSeg->propSeg;
  _5 = _4 & 7;
  _6 = timeSeg->phaseSeg2;
  _7 = _6 << 16;
  _8 = _7 & 458752;
  _9 = _5 | _8;
  _10 = timeSeg->phaseSeg1;
  _11 = _10 << 19;
  _12 = _11 & 3670016;
  _13 = _9 | _12;
  _14 = timeSeg->preDivider;
  _15 = _14 << 24;
  _16 = _13 | _15;
  _17 = timeSeg->rJumpwidth;
  _18 = _17 << 22;
  _19 = _18 & 12582912;
  _20 = _16 | _19;
  _21 = _3 | _20;
  base->CTRL1 = _21;
  return;

}


FlexCAN_SetFDTimeSegments (struct FLEXCAN_Type * base, const struct Flexcan_Ip_TimeSegmentType * timeSeg)
{
  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = base->FDCBT;
  _2 = _1 & 3221783320;
  base->FDCBT = _2;
  # DEBUG BEGIN_STMT
  _3 = base->FDCBT;
  _4 = timeSeg->propSeg;
  _5 = _4 << 10;
  _6 = _5 & 31744;
  _7 = timeSeg->phaseSeg2;
  _8 = _7 & 7;
  _9 = _6 | _8;
  _10 = timeSeg->phaseSeg1;
  _11 = _10 << 5;
  _12 = _11 & 255;
  _13 = _9 | _12;
  _14 = timeSeg->preDivider;
  _15 = _14 << 20;
  _16 = _15 & 1072693248;
  _17 = _13 | _16;
  _18 = timeSeg->rJumpwidth;
  _19 = _18 << 16;
  _20 = _19 & 458752;
  _21 = _17 | _20;
  _22 = _3 | _21;
  base->FDCBT = _22;
  return;

}


FlexCAN_GetBuffStatusImask (const struct FLEXCAN_Type * base, uint32 msgBuffIdx)
{
  uint32 u32Imask;
  uint8 D.7903;

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

  <bb 3> :
  # DEBUG BEGIN_STMT
  _1 = base->IMASK1;
  _2 = msgBuffIdx & 31;
  _3 = 1 << _2;
  _4 = _1 & _3;
  _5 = msgBuffIdx & 31;
  u32Imask = _4 >> _5;

  <bb 4> :
  # DEBUG BEGIN_STMT
  D.7903 = (uint8) u32Imask;
  return D.7903;

}


FlexCAN_GetBuffStatusFlag (const struct FLEXCAN_Type * base, uint32 msgBuffIdx)
{
  uint32 flag;
  uint8 D.7755;

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

  <bb 3> :
  # DEBUG BEGIN_STMT
  _1 = base->IFLAG1;
  _2 = msgBuffIdx & 31;
  _3 = 1 << _2;
  _4 = _1 & _3;
  _5 = msgBuffIdx & 31;
  flag = _4 >> _5;

  <bb 4> :
  # DEBUG BEGIN_STMT
  D.7755 = (uint8) flag;
  return D.7755;

}


FlexCAN_ClearMsgBuffIntStatusFlag (struct FLEXCAN_Type * base, uint32 msgBuffIdx)
{
  uint32 flag;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = msgBuffIdx & 31;
  flag = 1 << _1;
  # DEBUG BEGIN_STMT
  if (msgBuffIdx <= 31)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  base->IFLAG1 = flag;

  <bb 4> :
  return;

}


FlexCAN_UnlockRxMsgBuff (const struct FLEXCAN_Type * base)
{
  long unsigned int vol.5;

  <bb 2> :
  # DEBUG BEGIN_STMT
  vol.5 = base->TIMER;
  return;

}


FlexCAN_SetListenOnlyMode (struct FLEXCAN_Type * base, boolean enableListenOnly)
{
  long unsigned int iftmp.6;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = base->CTRL1;
  _2 = _1 & 4294967287;
  if (enableListenOnly != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  iftmp.6 = 8;
  goto <bb 5>; [INV]

  <bb 4> :
  iftmp.6 = 0;

  <bb 5> :
  _3 = iftmp.6 | _2;
  base->CTRL1 = _3;
  return;

}


FlexCAN_SetFDEnabled (struct FLEXCAN_Type * base, boolean enableFD, boolean enableBRS)
{
  long unsigned int iftmp.2;
  long unsigned int iftmp.1;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = base->MCR;
  _2 = _1 & 4294965247;
  if (enableFD != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  iftmp.1 = 2048;
  goto <bb 5>; [INV]

  <bb 4> :
  iftmp.1 = 0;

  <bb 5> :
  _3 = iftmp.1 | _2;
  base->MCR = _3;
  # DEBUG BEGIN_STMT
  _4 = base->FDCTRL;
  _5 = _4 & 2147483647;
  if (enableBRS != 0)
    goto <bb 6>; [INV]
  else
    goto <bb 7>; [INV]

  <bb 6> :
  iftmp.2 = 2147483648;
  goto <bb 8>; [INV]

  <bb 7> :
  iftmp.2 = 0;

  <bb 8> :
  _6 = iftmp.2 | _5;
  base->FDCTRL = _6;
  # DEBUG BEGIN_STMT
  _7 = base->FDCTRL;
  _8 = _7 & 4294926591;
  base->FDCTRL = _8;
  return;

}


FlexCAN_IsEnabled (const struct FLEXCAN_Type * pBase)
{
  boolean D.7670;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = pBase->MCR;
  _2 = (signed int) _1;
  D.7670 = _2 >= 0;
  return D.7670;

}


FlexCAN_SetTDCOffset (struct FLEXCAN_Type * base, boolean enable, uint8 offset)
{
  uint32 tmp;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  tmp = base->FDCTRL;
  # DEBUG BEGIN_STMT
  tmp = tmp & 4294926591;
  # DEBUG BEGIN_STMT
  if (enable != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  tmp = tmp | 32768;
  # DEBUG BEGIN_STMT
  _1 = (long unsigned int) offset;
  _2 = _1 << 8;
  _3 = _2 & 7936;
  tmp = tmp | _3;

  <bb 4> :
  # DEBUG BEGIN_STMT
  base->FDCTRL = tmp;
  return;

}


FlexCAN_SetRxFifoGlobalMask (struct FLEXCAN_Type * base, uint32 Mask)
{
  <bb 2> :
  # DEBUG BEGIN_STMT
  base->RXFGMASK = Mask;
  return;

}


