Lpspi_Ip_GetStatus (uint8 u8Instance)
{
  Lpspi_Ip_HwStatusType status;
  const struct Lpspi_Ip_StateStructureType * state;
  int _1;
  Lpspi_Ip_HwStatusType _10;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  status_4 = 0;
  # DEBUG status => status_4
  # DEBUG BEGIN_STMT
  if (u8Instance_5(D) > 5)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

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

  <bb 4> :
  # DEBUG BEGIN_STMT
  _1 = (int) u8Instance_5(D);
  state_7 = Lpspi_Ip_StateStructureArray[_1];
  # DEBUG state => state_7
  # DEBUG BEGIN_STMT
  if (state_7 != 0B)
    goto <bb 5>; [INV]
  else
    goto <bb 6>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  status_8 = state_7->status;
  # DEBUG status => status_8

  <bb 6> :
  # status_2 = PHI <status_4(3), status_4(4), status_8(5)>
  # DEBUG status => status_2
  # DEBUG BEGIN_STMT
  _10 = status_2;
  return _10;

}


Lpspi_Ip_IrqHandler (uint8 u8Instance)
{
  uint32 u32IrqFlags;
  const struct Lpspi_Ip_StateStructureType * state;
  struct LPSPI_Type * base;
  int _1;
  int _2;
  long unsigned int _3;
  long unsigned int _4;
  long unsigned int _5;
  long unsigned int _6;
  long unsigned int _15;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = (int) u8Instance_8(D);
  base_10 = Lpspi_Ip_Bases[_1];
  # DEBUG base => base_10
  # DEBUG BEGIN_STMT
  _2 = (int) u8Instance_8(D);
  state_11 = Lpspi_Ip_StateStructureArray[_2];
  # DEBUG state => state_11
  # DEBUG BEGIN_STMT
  u32IrqFlags_12 = 0;
  # DEBUG u32IrqFlags => u32IrqFlags_12
  # DEBUG BEGIN_STMT
  if (state_11 != 0B)
    goto <bb 3>; [INV]
  else
    goto <bb 6>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  _3 ={v} base_10->SR;
  u32IrqFlags_14 = _3 & 6147;
  # DEBUG u32IrqFlags => u32IrqFlags_14
  # DEBUG BEGIN_STMT
  _4 ={v} base_10->IER;
  _15 = _4 & 6147;
  u32IrqFlags_16 = _15 & u32IrqFlags_14;
  # DEBUG u32IrqFlags => u32IrqFlags_16
  # DEBUG BEGIN_STMT
  if (u32IrqFlags_16 != 0)
    goto <bb 4>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  Lpspi_Ip_TransferProcess (u8Instance_8(D));
  goto <bb 7>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  _5 ={v} base_10->SR;
  base_10->SR ={v} _5;
  goto <bb 7>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  _6 ={v} base_10->SR;
  base_10->SR ={v} _6;

  <bb 7> :
  return;

}


Lpspi_Ip_Cancel (uint8 u8Instance)
{
  uint32 u32Cfgr1;
  struct Lpspi_Ip_StateStructureType * state;
  struct LPSPI_Type * base;
  int _1;
  int _2;
  <unnamed type> _3;
  long unsigned int _4;
  long unsigned int _5;
  long unsigned int _6;
  long unsigned int _7;
  long unsigned int _8;
  long unsigned int _9;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  u32Cfgr1_12 = 0;
  # DEBUG u32Cfgr1 => u32Cfgr1_12
  # DEBUG BEGIN_STMT
  if (u8Instance_13(D) > 5)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

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

  <bb 4> :
  # DEBUG BEGIN_STMT
  _1 = (int) u8Instance_13(D);
  base_15 = Lpspi_Ip_Bases[_1];
  # DEBUG base => base_15
  # DEBUG BEGIN_STMT
  _2 = (int) u8Instance_13(D);
  state_16 = Lpspi_Ip_StateStructureArray[_2];
  # DEBUG state => state_16
  # DEBUG BEGIN_STMT
  if (state_16 == 0B)
    goto <bb 5>; [INV]
  else
    goto <bb 6>; [INV]

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

  <bb 6> :
  # DEBUG BEGIN_STMT
  SchM_Enter_Spi_SPI_EXCLUSIVE_AREA_10 ();
  # DEBUG BEGIN_STMT
  _3 = state_16->status;
  if (_3 == 2)
    goto <bb 7>; [INV]
  else
    goto <bb 8>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  _4 ={v} base_15->CR;
  _5 = _4 & 4294967294;
  base_15->CR ={v} _5;
  # DEBUG BEGIN_STMT
  u32Cfgr1_19 ={v} base_15->CFGR1;
  # DEBUG u32Cfgr1 => u32Cfgr1_19
  # DEBUG BEGIN_STMT
  _6 ={v} base_15->CR;
  _7 = _6 | 2;
  base_15->CR ={v} _7;
  # DEBUG BEGIN_STMT
  _8 ={v} base_15->CR;
  _9 = _8 & 4294967293;
  base_15->CR ={v} _9;
  # DEBUG BEGIN_STMT
  base_15->CFGR1 ={v} u32Cfgr1_19;
  # DEBUG BEGIN_STMT
  state_16->status = 1;

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

  <bb 9> :
  return;

}


Lpspi_Ip_UpdateTransferMode (uint8 u8Instance, Lpspi_Ip_ModeType Mode)
{
  Lpspi_Ip_StatusType status;
  struct Lpspi_Ip_StateStructureType * state;
  int _1;
  <unnamed type> _2;
  Lpspi_Ip_StatusType _16;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  status_5 = 0;
  # DEBUG status => status_5
  # DEBUG BEGIN_STMT
  if (u8Instance_6(D) > 5)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  DevAssert (0);
  # DEBUG BEGIN_STMT
  status_15 = 1;
  # DEBUG status => status_15
  goto <bb 9>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  _1 = (int) u8Instance_6(D);
  state_8 = Lpspi_Ip_StateStructureArray[_1];
  # DEBUG state => state_8
  # DEBUG BEGIN_STMT
  if (state_8 == 0B)
    goto <bb 5>; [INV]
  else
    goto <bb 6>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  DevAssert (0);
  # DEBUG BEGIN_STMT
  status_13 = 1;
  # DEBUG status => status_13
  goto <bb 9>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  _2 = state_8->status;
  if (_2 != 2)
    goto <bb 7>; [INV]
  else
    goto <bb 8>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  state_8->transferMode = Mode_10(D);
  goto <bb 9>; [INV]

  <bb 8> :
  # DEBUG BEGIN_STMT
  status_9 = 1;
  # DEBUG status => status_9

  <bb 9> :
  # status_3 = PHI <status_15(3), status_13(5), status_5(7), status_9(8)>
  # DEBUG status => status_3
  # DEBUG BEGIN_STMT
  _16 = status_3;
  return _16;

}


Lpspi_Ip_UpdateDefaultTransmitData (const struct Lpspi_Ip_ExternalDeviceType * pExternalDevice, uint32 u32DefaultData)
{
  Lpspi_Ip_StatusType status;
  const struct Lpspi_Ip_StateStructureType * state;
  unsigned char _1;
  int _2;
  <unnamed type> _3;
  struct Lpspi_Ip_DeviceParamsType * _4;
  Lpspi_Ip_StatusType _18;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  status_7 = 0;
  # DEBUG status => status_7
  # DEBUG BEGIN_STMT
  if (pExternalDevice_8(D) == 0B)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  DevAssert (0);
  # DEBUG BEGIN_STMT
  status_17 = 1;
  # DEBUG status => status_17
  goto <bb 9>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  _1 = pExternalDevice_8(D)->u8Instance;
  _2 = (int) _1;
  state_10 = Lpspi_Ip_StateStructureArray[_2];
  # DEBUG state => state_10
  # DEBUG BEGIN_STMT
  if (state_10 == 0B)
    goto <bb 5>; [INV]
  else
    goto <bb 6>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  DevAssert (0);
  # DEBUG BEGIN_STMT
  status_15 = 1;
  # DEBUG status => status_15
  goto <bb 9>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  _3 = state_10->status;
  if (_3 != 2)
    goto <bb 7>; [INV]
  else
    goto <bb 8>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  _4 = pExternalDevice_8(D)->pDeviceParams;
  _4->u32DefaultData = u32DefaultData_12(D);
  goto <bb 9>; [INV]

  <bb 8> :
  # DEBUG BEGIN_STMT
  status_11 = 1;
  # DEBUG status => status_11

  <bb 9> :
  # status_5 = PHI <status_17(3), status_15(5), status_7(7), status_11(8)>
  # DEBUG status => status_5
  # DEBUG BEGIN_STMT
  _18 = status_5;
  return _18;

}


Lpspi_Ip_UpdateLsb (const struct Lpspi_Ip_ExternalDeviceType * pExternalDevice, boolean bLsb)
{
  Lpspi_Ip_StatusType status;
  const struct Lpspi_Ip_StateStructureType * state;
  unsigned char _1;
  int _2;
  <unnamed type> _3;
  struct Lpspi_Ip_DeviceParamsType * _4;
  Lpspi_Ip_StatusType _18;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  status_7 = 0;
  # DEBUG status => status_7
  # DEBUG BEGIN_STMT
  if (pExternalDevice_8(D) == 0B)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  DevAssert (0);
  # DEBUG BEGIN_STMT
  status_17 = 1;
  # DEBUG status => status_17
  goto <bb 9>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  _1 = pExternalDevice_8(D)->u8Instance;
  _2 = (int) _1;
  state_10 = Lpspi_Ip_StateStructureArray[_2];
  # DEBUG state => state_10
  # DEBUG BEGIN_STMT
  if (state_10 == 0B)
    goto <bb 5>; [INV]
  else
    goto <bb 6>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  DevAssert (0);
  # DEBUG BEGIN_STMT
  status_15 = 1;
  # DEBUG status => status_15
  goto <bb 9>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  _3 = state_10->status;
  if (_3 != 2)
    goto <bb 7>; [INV]
  else
    goto <bb 8>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  _4 = pExternalDevice_8(D)->pDeviceParams;
  _4->lsb = bLsb_12(D);
  goto <bb 9>; [INV]

  <bb 8> :
  # DEBUG BEGIN_STMT
  status_11 = 1;
  # DEBUG status => status_11

  <bb 9> :
  # status_5 = PHI <status_17(3), status_15(5), status_7(7), status_11(8)>
  # DEBUG status => status_5
  # DEBUG BEGIN_STMT
  _18 = status_5;
  return _18;

}


Lpspi_Ip_UpdateFrameSize (const struct Lpspi_Ip_ExternalDeviceType * pExternalDevice, uint8 u8FrameSize)
{
  Lpspi_Ip_StatusType status;
  const struct Lpspi_Ip_StateStructureType * state;
  unsigned char _1;
  unsigned char _2;
  int _3;
  <unnamed type> _4;
  struct Lpspi_Ip_DeviceParamsType * _5;
  Lpspi_Ip_StatusType _21;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  status_8 = 0;
  # DEBUG status => status_8
  # DEBUG BEGIN_STMT
  if (pExternalDevice_9(D) == 0B)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  DevAssert (0);
  # DEBUG BEGIN_STMT
  status_20 = 1;
  # DEBUG status => status_20
  goto <bb 11>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  _1 = u8FrameSize_10(D) + 252;
  if (_1 > 28)
    goto <bb 5>; [INV]
  else
    goto <bb 6>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  DevAssert (0);
  # DEBUG BEGIN_STMT
  status_18 = 1;
  # DEBUG status => status_18
  goto <bb 11>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  _2 = pExternalDevice_9(D)->u8Instance;
  _3 = (int) _2;
  state_12 = Lpspi_Ip_StateStructureArray[_3];
  # DEBUG state => state_12
  # DEBUG BEGIN_STMT
  if (state_12 == 0B)
    goto <bb 7>; [INV]
  else
    goto <bb 8>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  DevAssert (0);
  # DEBUG BEGIN_STMT
  status_16 = 1;
  # DEBUG status => status_16
  goto <bb 11>; [INV]

  <bb 8> :
  # DEBUG BEGIN_STMT
  _4 = state_12->status;
  if (_4 != 2)
    goto <bb 9>; [INV]
  else
    goto <bb 10>; [INV]

  <bb 9> :
  # DEBUG BEGIN_STMT
  _5 = pExternalDevice_9(D)->pDeviceParams;
  _5->u8FrameSize = u8FrameSize_10(D);
  goto <bb 11>; [INV]

  <bb 10> :
  # DEBUG BEGIN_STMT
  status_13 = 1;
  # DEBUG status => status_13

  <bb 11> :
  # status_6 = PHI <status_20(3), status_18(5), status_16(7), status_8(9), status_13(10)>
  # DEBUG status => status_6
  # DEBUG BEGIN_STMT
  _21 = status_6;
  return _21;

}


Lpspi_Ip_ManageBuffers (uint8 u8Instance)
{
  const struct Lpspi_Ip_StateStructureType * state;
  const struct LPSPI_Type * base;
  int _1;
  int _2;
  <unnamed type> _3;
  long unsigned int _4;
  long unsigned int _5;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  if (u8Instance_7(D) > 5)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

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

  <bb 4> :
  # DEBUG BEGIN_STMT
  _1 = (int) u8Instance_7(D);
  base_9 = Lpspi_Ip_Bases[_1];
  # DEBUG base => base_9
  # DEBUG BEGIN_STMT
  _2 = (int) u8Instance_7(D);
  state_10 = Lpspi_Ip_StateStructureArray[_2];
  # DEBUG state => state_10
  # DEBUG BEGIN_STMT
  if (state_10 == 0B)
    goto <bb 5>; [INV]
  else
    goto <bb 6>; [INV]

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

  <bb 6> :
  # DEBUG BEGIN_STMT
  _3 = state_10->transferMode;
  if (_3 == 0)
    goto <bb 7>; [INV]
  else
    goto <bb 9>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  _4 ={v} base_9->SR;
  _5 = _4 & 3;
  if (_5 != 0)
    goto <bb 8>; [INV]
  else
    goto <bb 9>; [INV]

  <bb 8> :
  # DEBUG BEGIN_STMT
  Lpspi_Ip_TransferProcess (u8Instance_7(D));

  <bb 9> :
  return;

}


Lpspi_Ip_AsyncTransmit (const struct Lpspi_Ip_ExternalDeviceType * pExternalDevice, uint8 * pu8TxBuffer, uint8 * pu8RxBuffer, uint16 u16Length, void (*Lpspi_Ip_CallbackType) (uint8, Lpspi_Ip_EventType) EndCallback)
{
  uint8 u8Instance;
  Lpspi_Ip_StatusType status;
  struct Lpspi_Ip_StateStructureType * state;
  struct LPSPI_Type * base;
  int _1;
  int _2;
  struct Lpspi_Ip_DeviceParamsType * _3;
  unsigned char _4;
  short unsigned int _5;
  struct Lpspi_Ip_DeviceParamsType * _6;
  unsigned char _7;
  short unsigned int _8;
  <unnamed type> _9;
  struct Lpspi_Ip_DeviceParamsType * _10;
  unsigned char _11;
  struct Lpspi_Ip_DeviceParamsType * _12;
  _Bool _13;
  struct Lpspi_Ip_DeviceParamsType * _14;
  long unsigned int _15;
  <unnamed type> _16;
  int _17;
  Lpspi_Ip_StatusType _58;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  status_22 = 0;
  # DEBUG status => status_22
  # DEBUG BEGIN_STMT
  u8Instance_23 = 0;
  # DEBUG u8Instance => u8Instance_23
  # DEBUG BEGIN_STMT
  if (pExternalDevice_24(D) == 0B)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  DevAssert (0);
  # DEBUG BEGIN_STMT
  status_57 = 1;
  # DEBUG status => status_57
  goto <bb 20>; [INV]

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

  <bb 5> :
  # DEBUG BEGIN_STMT
  DevAssert (0);
  # DEBUG BEGIN_STMT
  status_55 = 1;
  # DEBUG status => status_55
  goto <bb 20>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  u8Instance_27 = pExternalDevice_24(D)->u8Instance;
  # DEBUG u8Instance => u8Instance_27
  # DEBUG BEGIN_STMT
  _1 = (int) u8Instance_27;
  base_28 = Lpspi_Ip_Bases[_1];
  # DEBUG base => base_28
  # DEBUG BEGIN_STMT
  _2 = (int) u8Instance_27;
  state_29 = Lpspi_Ip_StateStructureArray[_2];
  # DEBUG state => state_29
  # DEBUG BEGIN_STMT
  if (state_29 == 0B)
    goto <bb 7>; [INV]
  else
    goto <bb 8>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  DevAssert (0);
  # DEBUG BEGIN_STMT
  status_35 = 1;
  # DEBUG status => status_35
  goto <bb 14>; [INV]

  <bb 8> :
  # DEBUG BEGIN_STMT
  _3 = pExternalDevice_24(D)->pDeviceParams;
  _4 = _3->u8FrameSize;
  if (_4 > 16)
    goto <bb 9>; [INV]
  else
    goto <bb 11>; [INV]

  <bb 9> :
  # DEBUG BEGIN_STMT
  _5 = u16Length_25(D) & 3;
  if (_5 != 0)
    goto <bb 10>; [INV]
  else
    goto <bb 14>; [INV]

  <bb 10> :
  # DEBUG BEGIN_STMT
  DevAssert (0);
  # DEBUG BEGIN_STMT
  status_33 = 1;
  # DEBUG status => status_33
  goto <bb 14>; [INV]

  <bb 11> :
  # DEBUG BEGIN_STMT
  _6 = pExternalDevice_24(D)->pDeviceParams;
  _7 = _6->u8FrameSize;
  if (_7 > 8)
    goto <bb 12>; [INV]
  else
    goto <bb 14>; [INV]

  <bb 12> :
  # DEBUG BEGIN_STMT
  _8 = u16Length_25(D) & 1;
  if (_8 != 0)
    goto <bb 13>; [INV]
  else
    goto <bb 14>; [INV]

  <bb 13> :
  # DEBUG BEGIN_STMT
  DevAssert (0);
  # DEBUG BEGIN_STMT
  status_31 = 1;
  # DEBUG status => status_31

  <bb 14> :
  # status_18 = PHI <status_35(7), status_33(10), status_22(11), status_31(13), status_22(9), status_22(12)>
  # DEBUG status => status_18
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  if (status_18 != 1)
    goto <bb 15>; [INV]
  else
    goto <bb 20>; [INV]

  <bb 15> :
  # DEBUG BEGIN_STMT
  SchM_Enter_Spi_SPI_EXCLUSIVE_AREA_09 ();
  # DEBUG BEGIN_STMT
  _9 = state_29->status;
  if (_9 == 2)
    goto <bb 16>; [INV]
  else
    goto <bb 17>; [INV]

  <bb 16> :
  # DEBUG BEGIN_STMT
  SchM_Exit_Spi_SPI_EXCLUSIVE_AREA_09 ();
  # DEBUG BEGIN_STMT
  status_53 = 1;
  # DEBUG status => status_53
  goto <bb 20>; [INV]

  <bb 17> :
  # DEBUG BEGIN_STMT
  state_29->status = 2;
  # DEBUG BEGIN_STMT
  SchM_Exit_Spi_SPI_EXCLUSIVE_AREA_09 ();
  # DEBUG BEGIN_STMT
  _10 = pExternalDevice_24(D)->pDeviceParams;
  _11 = _10->u8FrameSize;
  state_29->u8FrameSize = _11;
  # DEBUG BEGIN_STMT
  _12 = pExternalDevice_24(D)->pDeviceParams;
  _13 = _12->lsb;
  state_29->lsb = _13;
  # DEBUG BEGIN_STMT
  _14 = pExternalDevice_24(D)->pDeviceParams;
  _15 = _14->u32DefaultData;
  state_29->u32DefaultData = _15;
  # DEBUG BEGIN_STMT
  state_29->pExternalDevice = pExternalDevice_24(D);
  # DEBUG BEGIN_STMT
  state_29->callback = EndCallback_43(D);
  # DEBUG BEGIN_STMT
  Lpspi_TransmitTxInit (u8Instance_27, pu8TxBuffer_45(D), u16Length_25(D));
  # DEBUG BEGIN_STMT
  Lpspi_TransmitRxInit (u8Instance_27, pu8RxBuffer_47(D), u16Length_25(D));
  # DEBUG BEGIN_STMT
  base_28->DER ={v} 0;
  # DEBUG BEGIN_STMT
  _16 = state_29->transferMode;
  _17 = (int) _16;
  switch (_17) <default: <L29> [INV], case 0: <L20> [INV], case 1: <L21> [INV]>

  <bb 18> :
<L20>:
  # DEBUG BEGIN_STMT
  base_28->IER ={v} 0;
  # DEBUG BEGIN_STMT
  goto <bb 20>; [INV]

  <bb 19> :
<L21>:
  # DEBUG BEGIN_STMT
  base_28->IER ={v} 6147;
  # DEBUG BEGIN_STMT

  <bb 20> :
  # status_19 = PHI <status_57(3), status_55(5), status_18(14), status_53(16), status_18(18), status_18(19), status_18(17)>
<L29>:
  # DEBUG status => status_19
  # DEBUG BEGIN_STMT
  _58 = status_19;
  return _58;

}


Lpspi_TransmitRxInit (uint8 u8Instance, uint8 * pu8RxBuffer, uint16 numberOfFrames)
{
  struct Lpspi_Ip_StateStructureType * state;
  int _1;
  unsigned char _2;
  unsigned char _3;
  short unsigned int _4;
  short unsigned int _5;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = (int) u8Instance_7(D);
  state_9 = Lpspi_Ip_StateStructureArray[_1];
  # DEBUG state => state_9
  # DEBUG BEGIN_STMT
  state_9->rxIndex = 0;
  # DEBUG BEGIN_STMT
  state_9->pu8RxBuffer = pu8RxBuffer_11(D);
  # DEBUG BEGIN_STMT
  _2 = state_9->u8FrameSize;
  if (_2 <= 8)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  state_9->expectedFifoReads = numberOfFrames_13(D);
  goto <bb 7>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  _3 = state_9->u8FrameSize;
  if (_3 <= 16)
    goto <bb 5>; [INV]
  else
    goto <bb 6>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  _4 = numberOfFrames_13(D) / 2;
  state_9->expectedFifoReads = _4;
  goto <bb 7>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  _5 = numberOfFrames_13(D) / 4;
  state_9->expectedFifoReads = _5;

  <bb 7> :
  return;

}


Lpspi_TransmitTxInit (uint8 u8Instance, uint8 * pu8TxBuffer, uint16 numberOfFrames)
{
  uint32 u32Cfgr1;
  uint32 u32TransferCommand;
  struct Lpspi_Ip_StateStructureType * state;
  struct LPSPI_Type * base;
  int _1;
  int _2;
  _Bool _3;
  long unsigned int _4;
  long unsigned int _5;
  long unsigned int _6;
  long unsigned int _7;
  long unsigned int _8;
  long unsigned int _9;
  long unsigned int _10;
  _Bool _11;
  _Bool _12;
  const struct Lpspi_Ip_ExternalDeviceType * _13;
  long unsigned int _14;
  const struct Lpspi_Ip_ExternalDeviceType * _15;
  long unsigned int _16;
  unsigned char _17;
  long unsigned int _18;
  long unsigned int _19;
  long unsigned int _20;
  long unsigned int _21;
  _Bool _22;
  long unsigned int _23;
  long unsigned int _24;
  long unsigned int _25;
  _Bool _26;
  _Bool _27;
  long unsigned int _28;
  long unsigned int _29;
  long unsigned int _30;
  long unsigned int _31;
  unsigned char _32;
  unsigned char _33;
  short unsigned int _34;
  short unsigned int _35;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = (int) u8Instance_40(D);
  base_42 = Lpspi_Ip_Bases[_1];
  # DEBUG base => base_42
  # DEBUG BEGIN_STMT
  _2 = (int) u8Instance_40(D);
  state_43 = Lpspi_Ip_StateStructureArray[_2];
  # DEBUG state => state_43
  # DEBUG BEGIN_STMT
  u32TransferCommand_44 = 0;
  # DEBUG u32TransferCommand => u32TransferCommand_44
  # DEBUG BEGIN_STMT
  u32Cfgr1_45 = 0;
  # DEBUG u32Cfgr1 => u32Cfgr1_45
  # DEBUG BEGIN_STMT
  _3 = state_43->bFirstCmd;
  if (_3 != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  SchM_Enter_Spi_SPI_EXCLUSIVE_AREA_11 ();
  # DEBUG BEGIN_STMT
  _4 ={v} base_42->CR;
  _5 = _4 & 4294967294;
  base_42->CR ={v} _5;
  # DEBUG BEGIN_STMT
  u32Cfgr1_48 ={v} base_42->CFGR1;
  # DEBUG u32Cfgr1 => u32Cfgr1_48
  # DEBUG BEGIN_STMT
  _6 ={v} base_42->CR;
  _7 = _6 | 2;
  base_42->CR ={v} _7;
  # DEBUG BEGIN_STMT
  _8 ={v} base_42->CR;
  _9 = _8 & 4294967293;
  base_42->CR ={v} _9;
  # DEBUG BEGIN_STMT
  base_42->CFGR1 ={v} u32Cfgr1_48;
  # DEBUG BEGIN_STMT
  _10 ={v} base_42->SR;
  base_42->SR ={v} _10;
  # DEBUG BEGIN_STMT
  _11 = state_43->bSlaveMode;
  _12 = ~_11;
  if (_12 != 0)
    goto <bb 4>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  _13 = state_43->pExternalDevice;
  _14 = _13->ccr;
  base_42->CCR ={v} _14;

  <bb 5> :
  # DEBUG BEGIN_STMT
  _15 = state_43->pExternalDevice;
  _16 = _15->tcr;
  _17 = state_43->u8FrameSize;
  _18 = (long unsigned int) _17;
  _19 = _18 + 4294967295;
  _20 = _19 & 4095;
  _21 = _16 | _20;
  _22 = state_43->lsb;
  _23 = (long unsigned int) _22;
  _24 = _23 << 23;
  _25 = _24 & 8388608;
  u32TransferCommand_54 = _21 | _25;
  # DEBUG u32TransferCommand => u32TransferCommand_54
  # DEBUG BEGIN_STMT
  _26 = state_43->bSlaveMode;
  if (_26 != 0)
    goto <bb 6>; [INV]
  else
    goto <bb 7>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  u32TransferCommand_55 = u32TransferCommand_54 & 4292870143;
  # DEBUG u32TransferCommand => u32TransferCommand_55

  <bb 7> :
  # u32TransferCommand_36 = PHI <u32TransferCommand_54(5), u32TransferCommand_55(6)>
  # DEBUG u32TransferCommand => u32TransferCommand_36
  # DEBUG BEGIN_STMT
  _27 = state_43->bFirstCmd;
  if (_27 != 0)
    goto <bb 8>; [INV]
  else
    goto <bb 9>; [INV]

  <bb 8> :
  # DEBUG BEGIN_STMT
  base_42->TCR ={v} u32TransferCommand_36;
  # DEBUG BEGIN_STMT
  _28 ={v} base_42->CR;
  _29 = _28 | 1;
  base_42->CR ={v} _29;
  # DEBUG BEGIN_STMT
  SchM_Exit_Spi_SPI_EXCLUSIVE_AREA_11 ();
  goto <bb 12>; [INV]

  <bb 9> :
  # DEBUG BEGIN_STMT
  _30 = u32TransferCommand_36 & 2097152;
  if (_30 != 0)
    goto <bb 10>; [INV]
  else
    goto <bb 11>; [INV]

  <bb 10> :
  # DEBUG BEGIN_STMT
  _31 = u32TransferCommand_36 | 1048576;
  base_42->TCR ={v} _31;
  goto <bb 12>; [INV]

  <bb 11> :
  # DEBUG BEGIN_STMT
  base_42->TCR ={v} u32TransferCommand_36;

  <bb 12> :
  # DEBUG BEGIN_STMT
  state_43->txIndex = 0;
  # DEBUG BEGIN_STMT
  state_43->pu8TxBuffer = pu8TxBuffer_62(D);
  # DEBUG BEGIN_STMT
  _32 = state_43->u8FrameSize;
  if (_32 <= 8)
    goto <bb 13>; [INV]
  else
    goto <bb 14>; [INV]

  <bb 13> :
  # DEBUG BEGIN_STMT
  state_43->expectedFifoWrites = numberOfFrames_64(D);
  goto <bb 17>; [INV]

  <bb 14> :
  # DEBUG BEGIN_STMT
  _33 = state_43->u8FrameSize;
  if (_33 <= 16)
    goto <bb 15>; [INV]
  else
    goto <bb 16>; [INV]

  <bb 15> :
  # DEBUG BEGIN_STMT
  _34 = numberOfFrames_64(D) / 2;
  state_43->expectedFifoWrites = _34;
  goto <bb 17>; [INV]

  <bb 16> :
  # DEBUG BEGIN_STMT
  _35 = numberOfFrames_64(D) / 4;
  state_43->expectedFifoWrites = _35;

  <bb 17> :
  return;

}


Lpspi_Ip_SyncTransmit (const struct Lpspi_Ip_ExternalDeviceType * pExternalDevice, uint8 * pu8TxBuffer, uint8 * pu8RxBuffer, uint16 u16Length, uint32 u32TimeOut)
{
  uint8 u8Instance;
  uint32 ElapsedTicks;
  uint32 CurrentTicks;
  uint32 TimeoutTicks;
  Lpspi_Ip_StatusType DataProcessStatus;
  Lpspi_Ip_StatusType status;
  uint8 numberOfReads;
  struct Lpspi_Ip_StateStructureType * state;
  struct LPSPI_Type * base;
  int _1;
  int _2;
  struct Lpspi_Ip_DeviceParamsType * _3;
  unsigned char _4;
  short unsigned int _5;
  struct Lpspi_Ip_DeviceParamsType * _6;
  unsigned char _7;
  short unsigned int _8;
  <unnamed type> _9;
  struct Lpspi_Ip_DeviceParamsType * _10;
  unsigned char _11;
  struct Lpspi_Ip_DeviceParamsType * _12;
  _Bool _13;
  struct Lpspi_Ip_DeviceParamsType * _14;
  long unsigned int _15;
  long unsigned int _16;
  long unsigned int _17;
  long unsigned int _18;
  unsigned char _19;
  int _20;
  short unsigned int _21;
  int _22;
  short unsigned int _23;
  int _24;
  int _25;
  short unsigned int _26;
  unsigned char _27;
  short unsigned int _28;
  unsigned char _29;
  long unsigned int _30;
  long unsigned int _31;
  long unsigned int _32;
  long unsigned int _33;
  short unsigned int _34;
  short unsigned int _35;
  _Bool _36;
  _Bool _37;
  long unsigned int _38;
  long unsigned int _39;
  long unsigned int _102;
  Lpspi_Ip_StatusType _116;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  status_56 = 0;
  # DEBUG status => status_56
  # DEBUG BEGIN_STMT
  DataProcessStatus_57 = 1;
  # DEBUG DataProcessStatus => DataProcessStatus_57
  # DEBUG BEGIN_STMT
  TimeoutTicks_61 = OsIf_MicrosToTicks (u32TimeOut_59(D), 0);
  # DEBUG TimeoutTicks => TimeoutTicks_61
  # DEBUG BEGIN_STMT
  CurrentTicks = 0;
  # DEBUG BEGIN_STMT
  ElapsedTicks_63 = 0;
  # DEBUG ElapsedTicks => ElapsedTicks_63
  # DEBUG BEGIN_STMT
  u8Instance_64 = 0;
  # DEBUG u8Instance => u8Instance_64
  # DEBUG BEGIN_STMT
  if (pExternalDevice_65(D) == 0B)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  DevAssert (0);
  # DEBUG BEGIN_STMT
  status_115 = 1;
  # DEBUG status => status_115
  goto <bb 42>; [INV]

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

  <bb 5> :
  # DEBUG BEGIN_STMT
  DevAssert (0);
  # DEBUG BEGIN_STMT
  status_113 = 1;
  # DEBUG status => status_113
  goto <bb 42>; [INV]

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

  <bb 7> :
  # DEBUG BEGIN_STMT
  DevAssert (0);
  # DEBUG BEGIN_STMT
  status_111 = 1;
  # DEBUG status => status_111
  goto <bb 42>; [INV]

  <bb 8> :
  # DEBUG BEGIN_STMT
  u8Instance_67 = pExternalDevice_65(D)->u8Instance;
  # DEBUG u8Instance => u8Instance_67
  # DEBUG BEGIN_STMT
  _1 = (int) u8Instance_67;
  base_68 = Lpspi_Ip_Bases[_1];
  # DEBUG base => base_68
  # DEBUG BEGIN_STMT
  _2 = (int) u8Instance_67;
  state_69 = Lpspi_Ip_StateStructureArray[_2];
  # DEBUG state => state_69
  # DEBUG BEGIN_STMT
  if (state_69 == 0B)
    goto <bb 9>; [INV]
  else
    goto <bb 10>; [INV]

  <bb 9> :
  # DEBUG BEGIN_STMT
  DevAssert (0);
  # DEBUG BEGIN_STMT
  status_75 = 1;
  # DEBUG status => status_75
  goto <bb 16>; [INV]

  <bb 10> :
  # DEBUG BEGIN_STMT
  _3 = pExternalDevice_65(D)->pDeviceParams;
  _4 = _3->u8FrameSize;
  if (_4 > 16)
    goto <bb 11>; [INV]
  else
    goto <bb 13>; [INV]

  <bb 11> :
  # DEBUG BEGIN_STMT
  _5 = u16Length_66(D) & 3;
  if (_5 != 0)
    goto <bb 12>; [INV]
  else
    goto <bb 16>; [INV]

  <bb 12> :
  # DEBUG BEGIN_STMT
  DevAssert (0);
  # DEBUG BEGIN_STMT
  status_73 = 1;
  # DEBUG status => status_73
  goto <bb 16>; [INV]

  <bb 13> :
  # DEBUG BEGIN_STMT
  _6 = pExternalDevice_65(D)->pDeviceParams;
  _7 = _6->u8FrameSize;
  if (_7 > 8)
    goto <bb 14>; [INV]
  else
    goto <bb 16>; [INV]

  <bb 14> :
  # DEBUG BEGIN_STMT
  _8 = u16Length_66(D) & 1;
  if (_8 != 0)
    goto <bb 15>; [INV]
  else
    goto <bb 16>; [INV]

  <bb 15> :
  # DEBUG BEGIN_STMT
  DevAssert (0);
  # DEBUG BEGIN_STMT
  status_71 = 1;
  # DEBUG status => status_71

  <bb 16> :
  # status_42 = PHI <status_75(9), status_73(12), status_56(13), status_71(15), status_56(11), status_56(14)>
  # DEBUG status => status_42
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  if (status_42 != 1)
    goto <bb 17>; [INV]
  else
    goto <bb 42>; [INV]

  <bb 17> :
  # DEBUG BEGIN_STMT
  SchM_Enter_Spi_SPI_EXCLUSIVE_AREA_08 ();
  # DEBUG BEGIN_STMT
  _9 = state_69->status;
  if (_9 == 2)
    goto <bb 18>; [INV]
  else
    goto <bb 19>; [INV]

  <bb 18> :
  # DEBUG BEGIN_STMT
  SchM_Exit_Spi_SPI_EXCLUSIVE_AREA_08 ();
  # DEBUG BEGIN_STMT
  status_109 = 1;
  # DEBUG status => status_109
  goto <bb 42>; [INV]

  <bb 19> :
  # DEBUG BEGIN_STMT
  state_69->status = 2;
  # DEBUG BEGIN_STMT
  SchM_Exit_Spi_SPI_EXCLUSIVE_AREA_08 ();
  # DEBUG BEGIN_STMT
  base_68->DER ={v} 0;
  # DEBUG BEGIN_STMT
  base_68->IER ={v} 0;
  # DEBUG BEGIN_STMT
  _10 = pExternalDevice_65(D)->pDeviceParams;
  _11 = _10->u8FrameSize;
  state_69->u8FrameSize = _11;
  # DEBUG BEGIN_STMT
  _12 = pExternalDevice_65(D)->pDeviceParams;
  _13 = _12->lsb;
  state_69->lsb = _13;
  # DEBUG BEGIN_STMT
  _14 = pExternalDevice_65(D)->pDeviceParams;
  _15 = _14->u32DefaultData;
  state_69->u32DefaultData = _15;
  # DEBUG BEGIN_STMT
  state_69->pExternalDevice = pExternalDevice_65(D);
  # DEBUG BEGIN_STMT
  Lpspi_TransmitTxInit (u8Instance_67, pu8TxBuffer_85(D), u16Length_66(D));
  # DEBUG BEGIN_STMT
  Lpspi_TransmitRxInit (u8Instance_67, pu8RxBuffer_87(D), u16Length_66(D));
  # DEBUG BEGIN_STMT
  _16 = OsIf_GetCounter (0);
  CurrentTicks = _16;
  # DEBUG BEGIN_STMT
  goto <bb 34>; [INV]

  <bb 20> :
  # DEBUG BEGIN_STMT
  _17 ={v} base_68->FSR;
  _18 = _17 >> 16;
  _19 = (unsigned char) _18;
  numberOfReads_91 = _19 & 7;
  # DEBUG numberOfReads => numberOfReads_91
  # DEBUG BEGIN_STMT
  if (numberOfReads_91 > 4)
    goto <bb 21>; [INV]
  else
    goto <bb 22>; [INV]

  <bb 21> :
  # DEBUG BEGIN_STMT
  numberOfReads_92 = 4;
  # DEBUG numberOfReads => numberOfReads_92

  <bb 22> :
  # numberOfReads_40 = PHI <numberOfReads_91(20), numberOfReads_92(21)>
  # DEBUG numberOfReads => numberOfReads_40
  # DEBUG BEGIN_STMT
  if (numberOfReads_40 != 0)
    goto <bb 23>; [INV]
  else
    goto <bb 28>; [INV]

  <bb 23> :
  # DEBUG BEGIN_STMT
  _20 = (int) numberOfReads_40;
  _21 = state_69->expectedFifoReads;
  _22 = (int) _21;
  _23 = state_69->rxIndex;
  _24 = (int) _23;
  _25 = _22 - _24;
  if (_20 > _25)
    goto <bb 24>; [INV]
  else
    goto <bb 25>; [INV]

  <bb 24> :
  # DEBUG BEGIN_STMT
  _26 = state_69->expectedFifoReads;
  _27 = (unsigned char) _26;
  _28 = state_69->rxIndex;
  _29 = (unsigned char) _28;
  numberOfReads_93 = _27 - _29;
  # DEBUG numberOfReads => numberOfReads_93

  <bb 25> :
  # numberOfReads_41 = PHI <numberOfReads_40(23), numberOfReads_93(24)>
  # DEBUG numberOfReads => numberOfReads_41
  # DEBUG BEGIN_STMT
  if (numberOfReads_41 != 0)
    goto <bb 26>; [INV]
  else
    goto <bb 27>; [INV]

  <bb 26> :
  # DEBUG BEGIN_STMT
  ElapsedTicks_94 = 0;
  # DEBUG ElapsedTicks => ElapsedTicks_94

  <bb 27> :
  # ElapsedTicks_46 = PHI <ElapsedTicks_49(25), ElapsedTicks_94(26)>
  # DEBUG ElapsedTicks => ElapsedTicks_46
  # DEBUG BEGIN_STMT
  Lpspi_Ip_ReadData (u8Instance_67, numberOfReads_41);

  <bb 28> :
  # ElapsedTicks_47 = PHI <ElapsedTicks_49(22), ElapsedTicks_46(27)>
  # DEBUG ElapsedTicks => ElapsedTicks_47
  # DEBUG BEGIN_STMT
  DataProcessStatus_97 = Lpspi_Ip_PushDataProcess (u8Instance_67);
  # DEBUG DataProcessStatus => DataProcessStatus_97
  # DEBUG BEGIN_STMT
  if (DataProcessStatus_97 == 0)
    goto <bb 29>; [INV]
  else
    goto <bb 30>; [INV]

  <bb 29> :
  # DEBUG BEGIN_STMT
  ElapsedTicks_98 = 0;
  # DEBUG ElapsedTicks => ElapsedTicks_98

  <bb 30> :
  # ElapsedTicks_48 = PHI <ElapsedTicks_47(28), ElapsedTicks_98(29)>
  # DEBUG ElapsedTicks => ElapsedTicks_48
  # DEBUG BEGIN_STMT
  _30 ={v} base_68->SR;
  _31 = _30 & 6144;
  if (_31 != 0)
    goto <bb 31>; [INV]
  else
    goto <bb 32>; [INV]

  <bb 31> :
  # DEBUG BEGIN_STMT
  _32 ={v} base_68->SR;
  _33 = _32 & 6144;
  base_68->SR ={v} _33;
  # DEBUG BEGIN_STMT
  status_100 = 2;
  # DEBUG status => status_100

  <bb 32> :
  # status_43 = PHI <status_44(30), status_100(31)>
  # DEBUG status => status_43
  # DEBUG BEGIN_STMT
  _102 = OsIf_GetElapsed (&CurrentTicks, 0);
  ElapsedTicks_103 = _102 + ElapsedTicks_48;
  # DEBUG ElapsedTicks => ElapsedTicks_103
  # DEBUG BEGIN_STMT
  if (ElapsedTicks_103 >= TimeoutTicks_61)
    goto <bb 33>; [INV]
  else
    goto <bb 34>; [INV]

  <bb 33> :
  # DEBUG BEGIN_STMT
  status_104 = 3;
  # DEBUG status => status_104

  <bb 34> :
  # status_44 = PHI <status_42(19), status_43(32), status_104(33)>
  # ElapsedTicks_49 = PHI <ElapsedTicks_63(19), ElapsedTicks_103(32), ElapsedTicks_103(33)>
  # DEBUG ElapsedTicks => ElapsedTicks_49
  # DEBUG status => status_44
  # DEBUG BEGIN_STMT
  _34 = state_69->rxIndex;
  _35 = state_69->expectedFifoReads;
  if (_34 != _35)
    goto <bb 35>; [INV]
  else
    goto <bb 36>; [INV]

  <bb 35> :
  if (status_44 == 0)
    goto <bb 20>; [INV]
  else
    goto <bb 36>; [INV]

  <bb 36> :
  # DEBUG BEGIN_STMT
  _36 = state_69->bKeepCs;
  _37 = ~_36;
  if (_37 != 0)
    goto <bb 38>; [INV]
  else
    goto <bb 37>; [INV]

  <bb 37> :
  if (status_44 != 0)
    goto <bb 38>; [INV]
  else
    goto <bb 39>; [INV]

  <bb 38> :
  # DEBUG BEGIN_STMT
  _38 ={v} base_68->CR;
  _39 = _38 & 4294967294;
  base_68->CR ={v} _39;

  <bb 39> :
  # DEBUG BEGIN_STMT
  if (status_44 != 0)
    goto <bb 40>; [INV]
  else
    goto <bb 41>; [INV]

  <bb 40> :
  # DEBUG BEGIN_STMT
  state_69->status = 3;
  goto <bb 42>; [INV]

  <bb 41> :
  # DEBUG BEGIN_STMT
  state_69->status = 1;

  <bb 42> :
  # status_45 = PHI <status_115(3), status_113(5), status_111(7), status_42(16), status_109(18), status_44(40), status_44(41)>
  # DEBUG status => status_45
  # DEBUG BEGIN_STMT
  _116 = status_45;
  CurrentTicks ={v} {CLOBBER};
  return _116;

}


Lpspi_Ip_DeInit (uint8 u8Instance)
{
  Lpspi_Ip_StatusType status;
  const struct Lpspi_Ip_StateStructureType * state;
  struct LPSPI_Type * base;
  int _1;
  int _2;
  <unnamed type> _3;
  long unsigned int _4;
  long unsigned int _5;
  int _6;
  Lpspi_Ip_StatusType _22;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  status_9 = 0;
  # DEBUG status => status_9
  # DEBUG BEGIN_STMT
  if (u8Instance_10(D) > 5)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  DevAssert (0);
  # DEBUG BEGIN_STMT
  status_21 = 1;
  # DEBUG status => status_21
  goto <bb 9>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  _1 = (int) u8Instance_10(D);
  base_12 = Lpspi_Ip_Bases[_1];
  # DEBUG base => base_12
  # DEBUG BEGIN_STMT
  _2 = (int) u8Instance_10(D);
  state_13 = Lpspi_Ip_StateStructureArray[_2];
  # DEBUG state => state_13
  # DEBUG BEGIN_STMT
  if (state_13 == 0B)
    goto <bb 5>; [INV]
  else
    goto <bb 6>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  DevAssert (0);
  # DEBUG BEGIN_STMT
  status_19 = 1;
  # DEBUG status => status_19
  goto <bb 9>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  _3 = state_13->status;
  if (_3 == 2)
    goto <bb 7>; [INV]
  else
    goto <bb 8>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  status_17 = 1;
  # DEBUG status => status_17
  goto <bb 9>; [INV]

  <bb 8> :
  # DEBUG BEGIN_STMT
  _4 ={v} base_12->CR;
  _5 = _4 | 2;
  base_12->CR ={v} _5;
  # DEBUG BEGIN_STMT
  base_12->CR ={v} 0;
  # DEBUG BEGIN_STMT
  _6 = (int) u8Instance_10(D);
  Lpspi_Ip_StateStructureArray[_6] = 0B;

  <bb 9> :
  # status_7 = PHI <status_21(3), status_19(5), status_17(7), status_9(8)>
  # DEBUG status => status_7
  # DEBUG BEGIN_STMT
  _22 = status_7;
  return _22;

}


Lpspi_Ip_Init (const struct Lpspi_Ip_ConfigType * pPhyUnitConfigPtr)
{
  uint8 u8Instance;
  Lpspi_Ip_StatusType status;
  struct Lpspi_Ip_StateStructureType * state;
  struct LPSPI_Type * base;
  int _1;
  int _2;
  int _3;
  struct Lpspi_Ip_StateStructureType * _4;
  int _5;
  long unsigned int _6;
  long unsigned int _7;
  long unsigned int _8;
  _Bool _9;
  <unnamed type> _10;
  Lpspi_Ip_StatusType _34;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  status_13 = 0;
  # DEBUG status => status_13
  # DEBUG BEGIN_STMT
  u8Instance_14 = 0;
  # DEBUG u8Instance => u8Instance_14
  # DEBUG BEGIN_STMT
  if (pPhyUnitConfigPtr_15(D) == 0B)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  DevAssert (0);
  # DEBUG BEGIN_STMT
  status_33 = 1;
  # DEBUG status => status_33
  goto <bb 7>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  u8Instance_17 = pPhyUnitConfigPtr_15(D)->u8Instance;
  # DEBUG u8Instance => u8Instance_17
  # DEBUG BEGIN_STMT
  _1 = (int) u8Instance_17;
  state_18 = Lpspi_Ip_StateStructureArray[_1];
  # DEBUG state => state_18
  # DEBUG BEGIN_STMT
  _2 = (int) u8Instance_17;
  base_19 = Lpspi_Ip_Bases[_2];
  # DEBUG base => base_19
  # DEBUG BEGIN_STMT
  if (state_18 != 0B)
    goto <bb 5>; [INV]
  else
    goto <bb 6>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  DevAssert (0);
  # DEBUG BEGIN_STMT
  status_31 = 1;
  # DEBUG status => status_31
  goto <bb 7>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  _3 = (int) u8Instance_17;
  _4 = pPhyUnitConfigPtr_15(D)->stateStructure;
  Lpspi_Ip_StateStructureArray[_3] = _4;
  # DEBUG BEGIN_STMT
  _5 = (int) u8Instance_17;
  state_21 = Lpspi_Ip_StateStructureArray[_5];
  # DEBUG state => state_21
  # DEBUG BEGIN_STMT
  _6 = pPhyUnitConfigPtr_15(D)->cr;
  _7 = _6 | 8;
  base_19->CR ={v} _7;
  # DEBUG BEGIN_STMT
  _8 = pPhyUnitConfigPtr_15(D)->cfgr1;
  base_19->CFGR1 ={v} _8;
  # DEBUG BEGIN_STMT
  base_19->FCR ={v} 2;
  # DEBUG BEGIN_STMT
  _9 = pPhyUnitConfigPtr_15(D)->bSlaveMode;
  state_21->bSlaveMode = _9;
  # DEBUG BEGIN_STMT
  state_21->bKeepCs = 0;
  # DEBUG BEGIN_STMT
  state_21->bFirstCmd = 1;
  # DEBUG BEGIN_STMT
  state_21->status = 1;
  # DEBUG BEGIN_STMT
  _10 = pPhyUnitConfigPtr_15(D)->transferMode;
  Lpspi_Ip_UpdateTransferMode (u8Instance_17, _10);

  <bb 7> :
  # status_11 = PHI <status_33(3), status_31(5), status_13(6)>
  # DEBUG status => status_11
  # DEBUG BEGIN_STMT
  _34 = status_11;
  return _34;

}


Lpspi_Ip_TransferProcess (uint8 u8Instance)
{
  boolean bErrorFlag;
  uint8 numberOfReads;
  uint32 srStatusRegister;
  struct Lpspi_Ip_StateStructureType * state;
  struct LPSPI_Type * base;
  int _1;
  int _2;
  <unnamed type> _3;
  long unsigned int _4;
  long unsigned int _5;
  long unsigned int _6;
  long unsigned int _7;
  unsigned char _8;
  int _9;
  short unsigned int _10;
  int _11;
  short unsigned int _12;
  int _13;
  int _14;
  short unsigned int _15;
  unsigned char _16;
  short unsigned int _17;
  unsigned char _18;
  short unsigned int _19;
  short unsigned int _20;
  _Bool _21;
  _Bool _22;
  long unsigned int _23;
  long unsigned int _24;
  void (*<T2ef>) (uint8, Lpspi_Ip_EventType) _25;
  void (*<T2ef>) (uint8, Lpspi_Ip_EventType) _26;
  void (*<T2ef>) (uint8, Lpspi_Ip_EventType) _27;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = (int) u8Instance_36(D);
  base_38 = Lpspi_Ip_Bases[_1];
  # DEBUG base => base_38
  # DEBUG BEGIN_STMT
  _2 = (int) u8Instance_36(D);
  state_39 = Lpspi_Ip_StateStructureArray[_2];
  # DEBUG state => state_39
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  bErrorFlag_40 = 0;
  # DEBUG bErrorFlag => bErrorFlag_40
  # DEBUG BEGIN_STMT
  _3 = state_39->status;
  if (_3 == 2)
    goto <bb 3>; [INV]
  else
    goto <bb 24>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  srStatusRegister_41 ={v} base_38->SR;
  # DEBUG srStatusRegister => srStatusRegister_41
  # DEBUG BEGIN_STMT
  _4 ={v} base_38->SR;
  base_38->SR ={v} _4;
  # DEBUG BEGIN_STMT
  _5 = srStatusRegister_41 & 6144;
  if (_5 != 0)
    goto <bb 4>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  bErrorFlag_48 = 1;
  # DEBUG bErrorFlag => bErrorFlag_48
  goto <bb 12>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  _6 ={v} base_38->FSR;
  _7 = _6 >> 16;
  _8 = (unsigned char) _7;
  numberOfReads_43 = _8 & 7;
  # DEBUG numberOfReads => numberOfReads_43
  # DEBUG BEGIN_STMT
  if (numberOfReads_43 > 4)
    goto <bb 6>; [INV]
  else
    goto <bb 7>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  numberOfReads_44 = 4;
  # DEBUG numberOfReads => numberOfReads_44

  <bb 7> :
  # numberOfReads_28 = PHI <numberOfReads_43(5), numberOfReads_44(6)>
  # DEBUG numberOfReads => numberOfReads_28
  # DEBUG BEGIN_STMT
  if (numberOfReads_28 != 0)
    goto <bb 8>; [INV]
  else
    goto <bb 11>; [INV]

  <bb 8> :
  # DEBUG BEGIN_STMT
  _9 = (int) numberOfReads_28;
  _10 = state_39->expectedFifoReads;
  _11 = (int) _10;
  _12 = state_39->rxIndex;
  _13 = (int) _12;
  _14 = _11 - _13;
  if (_9 > _14)
    goto <bb 9>; [INV]
  else
    goto <bb 10>; [INV]

  <bb 9> :
  # DEBUG BEGIN_STMT
  _15 = state_39->expectedFifoReads;
  _16 = (unsigned char) _15;
  _17 = state_39->rxIndex;
  _18 = (unsigned char) _17;
  numberOfReads_45 = _16 - _18;
  # DEBUG numberOfReads => numberOfReads_45

  <bb 10> :
  # numberOfReads_29 = PHI <numberOfReads_28(8), numberOfReads_45(9)>
  # DEBUG numberOfReads => numberOfReads_29
  # DEBUG BEGIN_STMT
  Lpspi_Ip_ReadData (u8Instance_36(D), numberOfReads_29);

  <bb 11> :
  # DEBUG BEGIN_STMT
  Lpspi_Ip_PushDataProcess (u8Instance_36(D));

  <bb 12> :
  # bErrorFlag_30 = PHI <bErrorFlag_48(4), bErrorFlag_40(11)>
  # DEBUG bErrorFlag => bErrorFlag_30
  # DEBUG BEGIN_STMT
  _19 = state_39->rxIndex;
  _20 = state_39->expectedFifoReads;
  if (_19 == _20)
    goto <bb 14>; [INV]
  else
    goto <bb 13>; [INV]

  <bb 13> :
  if (bErrorFlag_30 != 0)
    goto <bb 14>; [INV]
  else
    goto <bb 24>; [INV]

  <bb 14> :
  # DEBUG BEGIN_STMT
  _21 = state_39->bKeepCs;
  _22 = ~_21;
  if (_22 != 0)
    goto <bb 16>; [INV]
  else
    goto <bb 15>; [INV]

  <bb 15> :
  if (bErrorFlag_30 != 0)
    goto <bb 16>; [INV]
  else
    goto <bb 17>; [INV]

  <bb 16> :
  # DEBUG BEGIN_STMT
  SchM_Enter_Spi_SPI_EXCLUSIVE_AREA_12 ();
  # DEBUG BEGIN_STMT
  _23 ={v} base_38->CR;
  _24 = _23 & 4294967294;
  base_38->CR ={v} _24;
  # DEBUG BEGIN_STMT
  SchM_Exit_Spi_SPI_EXCLUSIVE_AREA_12 ();

  <bb 17> :
  # DEBUG BEGIN_STMT
  base_38->IER ={v} 0;
  # DEBUG BEGIN_STMT
  if (bErrorFlag_30 != 0)
    goto <bb 18>; [INV]
  else
    goto <bb 19>; [INV]

  <bb 18> :
  # DEBUG BEGIN_STMT
  state_39->status = 3;
  goto <bb 20>; [INV]

  <bb 19> :
  # DEBUG BEGIN_STMT
  state_39->status = 1;

  <bb 20> :
  # DEBUG BEGIN_STMT
  _25 = state_39->callback;
  if (_25 != 0B)
    goto <bb 21>; [INV]
  else
    goto <bb 24>; [INV]

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

  <bb 22> :
  # DEBUG BEGIN_STMT
  _26 = state_39->callback;
  _26 (u8Instance_36(D), 1);
  goto <bb 24>; [INV]

  <bb 23> :
  # DEBUG BEGIN_STMT
  _27 = state_39->callback;
  _27 (u8Instance_36(D), 0);

  <bb 24> :
  return;

}


Lpspi_Ip_PushDataProcess (uint8 u8Instance)
{
  Lpspi_Ip_StatusType status;
  uint8 numberOfReads;
  uint8 numberOfWrites;
  const struct Lpspi_Ip_StateStructureType * state;
  struct LPSPI_Type * base;
  int _1;
  int _2;
  long unsigned int _3;
  unsigned char _4;
  long unsigned int _5;
  long unsigned int _6;
  unsigned char _7;
  int _8;
  int _9;
  int _10;
  unsigned char _11;
  int _12;
  short unsigned int _13;
  int _14;
  short unsigned int _15;
  int _16;
  int _17;
  short unsigned int _18;
  unsigned char _19;
  short unsigned int _20;
  unsigned char _21;
  short unsigned int _22;
  short unsigned int _23;
  long unsigned int _24;
  long unsigned int _25;
  _Bool _26;
  _Bool _27;
  long unsigned int _28;
  long unsigned int _29;
  long unsigned int _30;
  long unsigned int _31;
  Lpspi_Ip_StatusType _53;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = (int) u8Instance_38(D);
  base_40 = Lpspi_Ip_Bases[_1];
  # DEBUG base => base_40
  # DEBUG BEGIN_STMT
  _2 = (int) u8Instance_38(D);
  state_41 = Lpspi_Ip_StateStructureArray[_2];
  # DEBUG state => state_41
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  status_42 = 1;
  # DEBUG status => status_42
  # DEBUG BEGIN_STMT
  _3 ={v} base_40->FSR;
  _4 = (unsigned char) _3;
  numberOfWrites_43 = _4 & 7;
  # DEBUG numberOfWrites => numberOfWrites_43
  # DEBUG BEGIN_STMT
  _5 ={v} base_40->FSR;
  _6 = _5 >> 16;
  _7 = (unsigned char) _6;
  numberOfReads_44 = _7 & 7;
  # DEBUG numberOfReads => numberOfReads_44
  # DEBUG BEGIN_STMT
  _8 = (int) numberOfWrites_43;
  _9 = (int) numberOfReads_44;
  _10 = _8 + _9;
  if (_10 <= 3)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  _11 = numberOfWrites_43 + numberOfReads_44;
  numberOfWrites_46 = 3 - _11;
  # DEBUG numberOfWrites => numberOfWrites_46
  goto <bb 5>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  numberOfWrites_45 = 0;
  # DEBUG numberOfWrites => numberOfWrites_45

  <bb 5> :
  # numberOfWrites_32 = PHI <numberOfWrites_46(3), numberOfWrites_45(4)>
  # DEBUG numberOfWrites => numberOfWrites_32
  # DEBUG BEGIN_STMT
  if (numberOfWrites_32 != 0)
    goto <bb 6>; [INV]
  else
    goto <bb 14>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  _12 = (int) numberOfWrites_32;
  _13 = state_41->expectedFifoWrites;
  _14 = (int) _13;
  _15 = state_41->txIndex;
  _16 = (int) _15;
  _17 = _14 - _16;
  if (_12 > _17)
    goto <bb 7>; [INV]
  else
    goto <bb 8>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  _18 = state_41->expectedFifoWrites;
  _19 = (unsigned char) _18;
  _20 = state_41->txIndex;
  _21 = (unsigned char) _20;
  numberOfWrites_47 = _19 - _21;
  # DEBUG numberOfWrites => numberOfWrites_47

  <bb 8> :
  # numberOfWrites_33 = PHI <numberOfWrites_32(6), numberOfWrites_47(7)>
  # DEBUG numberOfWrites => numberOfWrites_33
  # DEBUG BEGIN_STMT
  _22 = state_41->expectedFifoWrites;
  _23 = state_41->txIndex;
  if (_22 == _23)
    goto <bb 9>; [INV]
  else
    goto <bb 12>; [INV]

  <bb 9> :
  # DEBUG BEGIN_STMT
  _24 ={v} base_40->IER;
  _25 = _24 & 4294967294;
  base_40->IER ={v} _25;
  # DEBUG BEGIN_STMT
  _26 = state_41->bKeepCs;
  _27 = ~_26;
  if (_27 != 0)
    goto <bb 10>; [INV]
  else
    goto <bb 13>; [INV]

  <bb 10> :
  _28 ={v} base_40->TCR;
  _29 = _28 & 2097152;
  if (_29 != 0)
    goto <bb 11>; [INV]
  else
    goto <bb 13>; [INV]

  <bb 11> :
  # DEBUG BEGIN_STMT
  _30 ={v} base_40->TCR;
  _31 = _30 & 4291821567;
  base_40->TCR ={v} _31;
  # DEBUG BEGIN_STMT
  status_51 = 0;
  # DEBUG status => status_51
  goto <bb 13>; [INV]

  <bb 12> :
  # DEBUG BEGIN_STMT
  status_48 = 0;
  # DEBUG status => status_48

  <bb 13> :
  # status_34 = PHI <status_42(10), status_48(12), status_42(9), status_51(11)>
  # DEBUG status => status_34
  # DEBUG BEGIN_STMT
  Lpspi_Ip_PushData (u8Instance_38(D), numberOfWrites_33);

  <bb 14> :
  # status_35 = PHI <status_42(5), status_34(13)>
  # DEBUG status => status_35
  # DEBUG BEGIN_STMT
  _53 = status_35;
  return _53;

}


Lpspi_Ip_PushData (uint8 u8Instance, uint8 numberOfWrites)
{
  uint8 i;
  uint32 data;
  struct Lpspi_Ip_StateStructureType * state;
  struct LPSPI_Type * base;
  int _1;
  int _2;
  uint8 * _3;
  unsigned char _4;
  uint8 * _5;
  short unsigned int _6;
  sizetype _7;
  uint8 * _8;
  unsigned char _9;
  unsigned char _10;
  uint8 * _11;
  short unsigned int _12;
  unsigned int _13;
  unsigned int _14;
  uint16 * _15;
  short unsigned int _16;
  uint8 * _17;
  short unsigned int _18;
  unsigned int _19;
  unsigned int _20;
  uint32 * _21;
  short unsigned int _22;
  short unsigned int _23;
  short unsigned int _24;
  unsigned char i.2_25;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = (int) u8Instance_29(D);
  base_31 = Lpspi_Ip_Bases[_1];
  # DEBUG base => base_31
  # DEBUG BEGIN_STMT
  _2 = (int) u8Instance_29(D);
  state_32 = Lpspi_Ip_StateStructureArray[_2];
  # DEBUG state => state_32
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  i_33 = 0;
  # DEBUG i => i_33
  goto <bb 11>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  _3 = state_32->pu8TxBuffer;
  if (_3 != 0B)
    goto <bb 4>; [INV]
  else
    goto <bb 9>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  _4 = state_32->u8FrameSize;
  if (_4 <= 8)
    goto <bb 5>; [INV]
  else
    goto <bb 6>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  _5 = state_32->pu8TxBuffer;
  _6 = state_32->txIndex;
  _7 = (sizetype) _6;
  _8 = _5 + _7;
  _9 = *_8;
  data_38 = (uint32) _9;
  # DEBUG data => data_38
  goto <bb 10>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  _10 = state_32->u8FrameSize;
  if (_10 <= 16)
    goto <bb 7>; [INV]
  else
    goto <bb 8>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  _11 = state_32->pu8TxBuffer;
  _12 = state_32->txIndex;
  _13 = (unsigned int) _12;
  _14 = _13 * 2;
  _15 = _11 + _14;
  _16 = *_15;
  data_37 = (uint32) _16;
  # DEBUG data => data_37
  goto <bb 10>; [INV]

  <bb 8> :
  # DEBUG BEGIN_STMT
  _17 = state_32->pu8TxBuffer;
  _18 = state_32->txIndex;
  _19 = (unsigned int) _18;
  _20 = _19 * 4;
  _21 = _17 + _20;
  data_36 = *_21;
  # DEBUG data => data_36
  goto <bb 10>; [INV]

  <bb 9> :
  # DEBUG BEGIN_STMT
  data_35 = state_32->u32DefaultData;
  # DEBUG data => data_35

  <bb 10> :
  # data_26 = PHI <data_37(7), data_35(9), data_38(5), data_36(8)>
  # DEBUG data => data_26
  # DEBUG BEGIN_STMT
  base_31->TDR ={v} data_26;
  # DEBUG BEGIN_STMT
  _22 = state_32->txIndex;
  _23 = _22;
  _24 = _23 + 1;
  state_32->txIndex = _24;
  # DEBUG BEGIN_STMT
  i.2_25 = i_27;
  i_41 = i.2_25 + 1;
  # DEBUG i => i_41

  <bb 11> :
  # i_27 = PHI <i_33(2), i_41(10)>
  # DEBUG i => i_27
  # DEBUG BEGIN_STMT
  if (i_27 < numberOfWrites_34(D))
    goto <bb 3>; [INV]
  else
    goto <bb 12>; [INV]

  <bb 12> :
  return;

}


Lpspi_Ip_ReadData (uint8 u8Instance, uint8 numberOfReads)
{
  uint8 i;
  uint32 data;
  struct Lpspi_Ip_StateStructureType * state;
  const struct LPSPI_Type * base;
  int _1;
  int _2;
  uint8 * _3;
  unsigned char _4;
  uint8 * _5;
  short unsigned int _6;
  sizetype _7;
  uint8 * _8;
  unsigned char _9;
  unsigned char _10;
  uint8 * _11;
  short unsigned int _12;
  unsigned int _13;
  unsigned int _14;
  uint16 * _15;
  short unsigned int _16;
  uint8 * _17;
  short unsigned int _18;
  unsigned int _19;
  unsigned int _20;
  uint32 * _21;
  short unsigned int _22;
  short unsigned int _23;
  short unsigned int _24;
  unsigned char i.1_25;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = (int) u8Instance_29(D);
  base_31 = Lpspi_Ip_Bases[_1];
  # DEBUG base => base_31
  # DEBUG BEGIN_STMT
  _2 = (int) u8Instance_29(D);
  state_32 = Lpspi_Ip_StateStructureArray[_2];
  # DEBUG state => state_32
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  i_33 = 0;
  # DEBUG i => i_33
  goto <bb 10>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  data_35 ={v} base_31->RDR;
  # DEBUG data => data_35
  # DEBUG BEGIN_STMT
  _3 = state_32->pu8RxBuffer;
  if (_3 != 0B)
    goto <bb 4>; [INV]
  else
    goto <bb 9>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  _4 = state_32->u8FrameSize;
  if (_4 <= 8)
    goto <bb 5>; [INV]
  else
    goto <bb 6>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  _5 = state_32->pu8RxBuffer;
  _6 = state_32->rxIndex;
  _7 = (sizetype) _6;
  _8 = _5 + _7;
  _9 = (unsigned char) data_35;
  *_8 = _9;
  goto <bb 9>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  _10 = state_32->u8FrameSize;
  if (_10 <= 16)
    goto <bb 7>; [INV]
  else
    goto <bb 8>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  _11 = state_32->pu8RxBuffer;
  _12 = state_32->rxIndex;
  _13 = (unsigned int) _12;
  _14 = _13 * 2;
  _15 = _11 + _14;
  _16 = (short unsigned int) data_35;
  *_15 = _16;
  goto <bb 9>; [INV]

  <bb 8> :
  # DEBUG BEGIN_STMT
  _17 = state_32->pu8RxBuffer;
  _18 = state_32->rxIndex;
  _19 = (unsigned int) _18;
  _20 = _19 * 4;
  _21 = _17 + _20;
  *_21 = data_35;

  <bb 9> :
  # DEBUG BEGIN_STMT
  _22 = state_32->rxIndex;
  _23 = _22;
  _24 = _23 + 1;
  state_32->rxIndex = _24;
  # DEBUG BEGIN_STMT
  i.1_25 = i_26;
  i_40 = i.1_25 + 1;
  # DEBUG i => i_40

  <bb 10> :
  # i_26 = PHI <i_33(2), i_40(9)>
  # DEBUG i => i_26
  # DEBUG BEGIN_STMT
  if (i_26 < numberOfReads_34(D))
    goto <bb 3>; [INV]
  else
    goto <bb 11>; [INV]

  <bb 11> :
  return;

}


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

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

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

  <bb 4> :
  # DEBUG BEGIN_STMT
  return;

}


