main ()
{
  uint8 u8TimeOut;
  uint8 rxBuffer[100];
  volatile Std_ReturnType CAN_Write_Status;
  static struct Can_Msg_Type Can_MsgInfo;
  volatile Std_ReturnType R_Uart_Status2;
  volatile Std_ReturnType R_Uart_Status1;
  volatile Std_ReturnType T_Uart_Status3;
  volatile Std_ReturnType T_Uart_Status2;
  volatile Std_ReturnType T_Uart_Status1;
  int D.10240;

  <bb 2> :
  u8TimeOut = 100;
  CanIf_bTxFlag = 0;
  CanIf_bRxFlag = 0;
  Mcu_Init (0B);
  Mcu_InitClock (0);
  Mcl_Init (0B);
  Mcu_SetMode (0);
  OsIf_Init (0B);
  Platform_Init (0B);
  Platform_InstallIrqHandler (31, LPUART_UART_IP_0_IRQHandler, 0B);
  Platform_InstallIrqHandler (33, LPUART_UART_IP_1_IRQHandler, 0B);
  Platform_InstallIrqHandler (35, LPUART_UART_IP_2_IRQHandler, 0B);
  Platform_InstallIrqHandler (69, MCL_FLEXIO_ISR, 0B);
  Platform_InstallIrqHandler (0, Dma0_Ch0_IRQHandler, 0B);
  Platform_InstallIrqHandler (1, Dma0_Ch1_IRQHandler, 0B);
  Platform_InstallIrqHandler (2, Dma0_Ch2_IRQHandler, 0B);
  Platform_InstallIrqHandler (3, Dma0_Ch3_IRQHandler, 0B);
  Platform_InstallIrqHandler (4, Dma0_Ch4_IRQHandler, 0B);
  Platform_InstallIrqHandler (5, Dma0_Ch5_IRQHandler, 0B);
  Port_Init (0B);
  Uart_Init (0B);
  Can_Init (0B);
  Can_SetControllerMode (0, 1);
  Can_MsgInfo.id = 403846230;
  Can_MsgInfo.idFrame = 2;
  Can_MsgInfo.length = 8;
  Can_MsgInfo.sdu = &Can_au8Sdu8bytes;
  Dio_WriteChannel (137, 1);
  Dio_WriteChannel (135, 1);
  _1 = xQueueGenericCreate (1, 0, 3);
  sem_handle = _1;
  sem_handle.18_2 = sem_handle;
  if (sem_handle.18_2 != 0B)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  sem_handle.19_3 = sem_handle;
  xQueueGenericSend (sem_handle.19_3, 0B, 0, 0);

  <bb 4> :
  xTaskCreate (BleTask, "BleTask", 1114, 0B, 2, 0B);
  xTaskCreate (ReceiveTask, "RecTask", 90, 0B, 3, 0B);
  vTaskStartScheduler ();

  <bb 5> :
  pinValue.20_4 = pinValue;
  _5 = ~pinValue.20_4;
  pinValue = _5;
  CanIf_SendMessage (0, Can_MsgInfo);
  TestDelay (100000);
  Can_MainFunction_Read ();
  CanIf_bRxFlag = 0;
  TestDelay (100000);
  goto <bb 5>; [INV]

}


TestDelay (uint32 delay)
{
  static volatile uint32 DelayTimer = 0;

  <bb 2> :
  goto <bb 4>; [INV]

  <bb 3> :
  DelayTimer.16_1 = DelayTimer;
  _2 = DelayTimer.16_1 + 1;
  DelayTimer = _2;

  <bb 4> :
  DelayTimer.17_3 = DelayTimer;
  if (delay > DelayTimer.17_3)
    goto <bb 3>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 5> :
  DelayTimer = 0;
  return;

}


CanIf_SendMessage (uint8 ControllerId, struct Can_Msg_Type CanMsg)
{
  Can_HwHandleType Hth;
  uint8 u8TimeOut;
  Std_ReturnType retVal;
  volatile Std_ReturnType CAN_Write_Status;
  volatile struct Can_PduType Can_PduInfo;
  Std_ReturnType D.10236;

  <bb 2> :
  retVal = 1;
  u8TimeOut = 100;
  _1 = (short unsigned int) ControllerId;
  Hth = _1 + 1;
  _2 = CanMsg.id;
  _3 = CanMsg.idFrame;
  _4 = CanMsg.length;
  _5 = CanMsg.sdu;
  Can_PduInfo = Can_CreatePduInfo (_2, _3, 0, _4, _5);
  _6 = Can_Write (Hth, &Can_PduInfo);
  CAN_Write_Status = _6;
  CanIf_bTxFlag = 0;
  CAN_Write_Status.12_7 = CAN_Write_Status;
  if (CAN_Write_Status.12_7 == 0)
    goto <bb 3>; [INV]
  else
    goto <bb 7>; [INV]

  <bb 3> :
  goto <bb 5>; [INV]

  <bb 4> :
  Can_MainFunction_Write ();
  Can_DummyDelay (100);
  u8TimeOut.13_8 = u8TimeOut;
  u8TimeOut = u8TimeOut.13_8 + 255;

  <bb 5> :
  CanIf_bTxFlag.14_9 = CanIf_bTxFlag;
  _10 = ~CanIf_bTxFlag.14_9;
  if (_10 != 0)
    goto <bb 6>; [INV]
  else
    goto <bb 7>; [INV]

  <bb 6> :
  if (u8TimeOut != 0)
    goto <bb 4>; [INV]
  else
    goto <bb 7>; [INV]

  <bb 7> :
  CanIf_bTxFlag.15_11 = CanIf_bTxFlag;
  if (CanIf_bTxFlag.15_11 != 0)
    goto <bb 8>; [INV]
  else
    goto <bb 9>; [INV]

  <bb 8> :
  retVal = 0;
  goto <bb 10>; [INV]

  <bb 9> :
  retVal = 1;

  <bb 10> :
  D.10236 = retVal;

  <bb 11> :
<L9>:
  return D.10236;

}


Can_DummyDelay (uint32 loops)
{
  volatile uint32 contor2;
  volatile uint32 contor1;
  volatile uint32 data;
  long unsigned int D.10229;

  <bb 2> :
  data = 2857740885;
  contor1 = 0;
  contor2 = loops;

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

  <bb 4> :
  contor1.5_1 = contor1;
  _2 = 1 << contor1.5_1;
  _3 = (long unsigned int) _2;
  contor2.6_4 = contor2;
  _5 = _3 | contor2.6_4;
  D.10229 = _5 | 11184810;
  data.7_6 = data;
  _7 = D.10229 ^ data.7_6;
  data = _7;
  contor1.8_8 = contor1;
  _9 = contor1.8_8 + 1;
  contor1 = _9;

  <bb 5> :
  contor1.9_10 = contor1;
  if (contor1.9_10 <= 766)
    goto <bb 4>; [INV]
  else
    goto <bb 6>; [INV]

  <bb 6> :
  contor2.10_11 = contor2;
  _12 = contor2.10_11 + 4294967295;
  contor2 = _12;
  contor2.11_13 = contor2;
  if (contor2.11_13 != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 7>; [INV]

  <bb 7> :
  return;

}


CanIf_CurrentIcomConfiguration (uint8 ControllerId, IcomConfigIdType ConfigurationId, IcomSwitch_ErrorType Error)
{
  <bb 2> :
  return;

}


CanIf_RxIndication (const struct Can_HwType * Mailbox, const struct PduInfoType * PduInfoPtr)
{
  <bb 2> :
  CanIf_bRxFlag = 1;
  _1 = Mailbox->CanId;
  _2 = PduInfoPtr->SduLength;
  _3 = (unsigned char) _2;
  _4 = PduInfoPtr->SduDataPtr;
  CanIf_u8RxIndicationCnt.2_5 = CanIf_u8RxIndicationCnt;
  _6 = (int) CanIf_u8RxIndicationCnt.2_5;
  canRxMsg_Buff[_6] = Can_GetMsgInfo (_1, _3, _4);
  CanIf_u8RxIndicationCnt.3_7 = CanIf_u8RxIndicationCnt;
  CanIf_u8RxIndicationCnt.4_8 = CanIf_u8RxIndicationCnt.3_7;
  _9 = CanIf_u8RxIndicationCnt.4_8 + 1;
  CanIf_u8RxIndicationCnt = _9;
  return;

}


CanIf_TxConfirmation (PduIdType CanTxPduId)
{
  <bb 2> :
  CanIf_u8TxConfirmCnt.0_1 = CanIf_u8TxConfirmCnt;
  CanIf_u8TxConfirmCnt.1_2 = CanIf_u8TxConfirmCnt.0_1;
  _3 = CanIf_u8TxConfirmCnt.1_2 + 1;
  CanIf_u8TxConfirmCnt = _3;
  CanIf_bTxFlag = 1;
  return;

}


CanIf_ControllerModeIndication (uint8 ControllerId, Can_ControllerStateType ControllerMode)
{
  <bb 2> :
  return;

}


CanIf_ControllerBusOff (uint8 ControllerId)
{
  <bb 2> :
  return;

}


Can_GetMsgInfo (Can_IdType id, uint8 length, uint8 * sdu)
{
  struct Can_Msg_Type CanMsgInfo;

  <bb 2> :
  _1 = id >> 30;
  CanMsgInfo.idFrame = _1;
  _2 = CanMsgInfo.idFrame;
  _3 = _2 & 1;
  if (_3 != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  _4 = id & 2047;
  CanMsgInfo.id = _4;
  goto <bb 5>; [INV]

  <bb 4> :
  _5 = id & 536870911;
  CanMsgInfo.id = _5;

  <bb 5> :
  CanMsgInfo.length = length;
  CanMsgInfo.sdu = sdu;
  <retval> = CanMsgInfo;
  CanMsgInfo = {CLOBBER};

  <bb 6> :
<L4>:
  return <retval>;

}


Can_CreatePduInfo (Can_IdType id, CAN_IdFrameType idFrame, PduIdType swPduHandle, uint8 length, uint8 * sdu)
{
  struct Can_PduType PduInfo;

  <bb 2> :
  switch (idFrame) <default: <L4> [INV], case 0: <L0> [INV], case 1: <L1> [INV], case 2: <L2> [INV], case 3: <L3> [INV]>

  <bb 3> :
<L0>:
  id = id & 2047;
  goto <bb 8>; [INV]

  <bb 4> :
<L1>:
  _1 = id & 2047;
  id = _1 | 1073741824;
  goto <bb 8>; [INV]

  <bb 5> :
<L2>:
  id = id | 2147483648;
  goto <bb 8>; [INV]

  <bb 6> :
<L3>:
  id = id | 3221225472;
  goto <bb 8>; [INV]

  <bb 7> :
<L4>:
  id = id & 2047;

  <bb 8> :
  PduInfo.id = id;
  PduInfo.swPduHandle = swPduHandle;
  PduInfo.length = length;
  PduInfo.sdu = sdu;
  <retval> = PduInfo;
  PduInfo = {CLOBBER};

  <bb 9> :
<L7>:
  return <retval>;

}


