ucStreamBufferGetStreamBufferType (struct StreamBufferDef_t * xStreamBuffer)
{
  unsigned char _1;
  uint8_t _4;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = xStreamBuffer_3(D)->ucFlags;
  _4 = _1 & 1;
  return _4;

}


vStreamBufferSetStreamBufferNumber (struct StreamBufferDef_t * xStreamBuffer, UBaseType_t uxStreamBufferNumber)
{
  <bb 2> :
  # DEBUG BEGIN_STMT
  xStreamBuffer_2(D)->uxStreamBufferNumber = uxStreamBufferNumber_3(D);
  return;

}


uxStreamBufferGetStreamBufferNumber (struct StreamBufferDef_t * xStreamBuffer)
{
  UBaseType_t _3;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _3 = xStreamBuffer_2(D)->uxStreamBufferNumber;
  return _3;

}


prvInitialiseNewStreamBuffer (struct StreamBuffer_t * const pxStreamBuffer, uint8_t * const pucBuffer, size_t xBufferSizeBytes, size_t xTriggerLevelBytes, uint8_t ucFlags)
{
  const BaseType_t xWriteValue;
  void * _1;

  <bb 2> :
  # DEBUG BEGIN_STMT
  xWriteValue_2 = 85;
  # DEBUG xWriteValue => xWriteValue_2
  # DEBUG BEGIN_STMT
  _1 = memset (pucBuffer_4(D), 85, xBufferSizeBytes_5(D));
  if (pucBuffer_4(D) != _1)
    goto <bb 3>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  vPortRaiseBASEPRI ();

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

  <bb 5> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  memset (pxStreamBuffer_7(D), 0, 36);
  # DEBUG BEGIN_STMT
  pxStreamBuffer_7(D)->pucBuffer = pucBuffer_4(D);
  # DEBUG BEGIN_STMT
  pxStreamBuffer_7(D)->xLength = xBufferSizeBytes_5(D);
  # DEBUG BEGIN_STMT
  pxStreamBuffer_7(D)->xTriggerLevelBytes = xTriggerLevelBytes_11(D);
  # DEBUG BEGIN_STMT
  pxStreamBuffer_7(D)->ucFlags = ucFlags_13(D);
  return;

}


prvBytesInBuffer (const struct StreamBuffer_t * const pxStreamBuffer)
{
  size_t xCount;
  unsigned int _1;
  unsigned int _2;
  unsigned int _3;
  unsigned int _4;
  unsigned int _9;
  size_t _12;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _1 = pxStreamBuffer_7(D)->xLength;
  _2 ={v} pxStreamBuffer_7(D)->xHead;
  xCount_8 = _1 + _2;
  # DEBUG xCount => xCount_8
  # DEBUG BEGIN_STMT
  _9 ={v} pxStreamBuffer_7(D)->xTail;
  xCount_10 = xCount_8 - _9;
  # DEBUG xCount => xCount_10
  # DEBUG BEGIN_STMT
  _3 = pxStreamBuffer_7(D)->xLength;
  if (xCount_10 >= _3)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  _4 = pxStreamBuffer_7(D)->xLength;
  xCount_11 = xCount_10 - _4;
  # DEBUG xCount => xCount_11

  <bb 4> :
  # xCount_5 = PHI <xCount_10(2), xCount_11(3)>
  # DEBUG xCount => xCount_5
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _12 = xCount_5;
  return _12;

}


prvReadBytesFromBuffer (struct StreamBuffer_t * pxStreamBuffer, uint8_t * pucData, size_t xCount, size_t xTail)
{
  size_t xFirstLength;
  unsigned int _1;
  unsigned int _2;
  unsigned int _3;
  unsigned int _4;
  uint8_t * _5;
  uint8_t * _6;
  uint8_t * _7;
  uint8_t * _8;
  unsigned int _9;
  unsigned int _10;
  unsigned int _11;
  size_t _24;

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

  <bb 3> :
  # DEBUG BEGIN_STMT
  vPortRaiseBASEPRI ();

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

  <bb 5> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _1 = pxStreamBuffer_16(D)->xLength;
  _2 = _1 - xTail_17(D);
  xFirstLength_18 = MIN_EXPR <xCount_14(D), _2>;
  # DEBUG xFirstLength => xFirstLength_18
  # DEBUG BEGIN_STMT
  if (xFirstLength_18 > xCount_14(D))
    goto <bb 6>; [INV]
  else
    goto <bb 8>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  vPortRaiseBASEPRI ();

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

  <bb 8> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _3 = xTail_17(D) + xFirstLength_18;
  _4 = pxStreamBuffer_16(D)->xLength;
  if (_3 > _4)
    goto <bb 9>; [INV]
  else
    goto <bb 11>; [INV]

  <bb 9> :
  # DEBUG BEGIN_STMT
  vPortRaiseBASEPRI ();

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

  <bb 11> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _5 = pxStreamBuffer_16(D)->pucBuffer;
  _6 = _5 + xTail_17(D);
  memcpy (pucData_19(D), _6, xFirstLength_18);
  # DEBUG BEGIN_STMT
  if (xCount_14(D) > xFirstLength_18)
    goto <bb 12>; [INV]
  else
    goto <bb 13>; [INV]

  <bb 12> :
  # DEBUG BEGIN_STMT
  _7 = pucData_19(D) + xFirstLength_18;
  _8 = pxStreamBuffer_16(D)->pucBuffer;
  _9 = xCount_14(D) - xFirstLength_18;
  memcpy (_7, _8, _9);

  <bb 13> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  xTail_22 = xTail_17(D) + xCount_14(D);
  # DEBUG xTail => xTail_22
  # DEBUG BEGIN_STMT
  _10 = pxStreamBuffer_16(D)->xLength;
  if (xTail_22 >= _10)
    goto <bb 14>; [INV]
  else
    goto <bb 15>; [INV]

  <bb 14> :
  # DEBUG BEGIN_STMT
  _11 = pxStreamBuffer_16(D)->xLength;
  xTail_23 = xTail_22 - _11;
  # DEBUG xTail => xTail_23

  <bb 15> :
  # xTail_12 = PHI <xTail_22(13), xTail_23(14)>
  # DEBUG xTail => xTail_12
  # DEBUG BEGIN_STMT
  _24 = xTail_12;
  return _24;

}


prvWriteBytesToBuffer (struct StreamBuffer_t * const pxStreamBuffer, const uint8_t * pucData, size_t xCount, size_t xHead)
{
  size_t xFirstLength;
  unsigned int _1;
  unsigned int _2;
  unsigned int _3;
  unsigned int _4;
  uint8_t * _5;
  uint8_t * _6;
  unsigned int _7;
  unsigned int _8;
  uint8_t * _9;
  const uint8_t * _10;
  unsigned int _11;
  unsigned int _12;
  unsigned int _13;
  size_t _27;

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

  <bb 3> :
  # DEBUG BEGIN_STMT
  vPortRaiseBASEPRI ();

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

  <bb 5> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _1 = pxStreamBuffer_18(D)->xLength;
  _2 = _1 - xHead_19(D);
  xFirstLength_20 = MIN_EXPR <xCount_16(D), _2>;
  # DEBUG xFirstLength => xFirstLength_20
  # DEBUG BEGIN_STMT
  _3 = xHead_19(D) + xFirstLength_20;
  _4 = pxStreamBuffer_18(D)->xLength;
  if (_3 > _4)
    goto <bb 6>; [INV]
  else
    goto <bb 8>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  vPortRaiseBASEPRI ();

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

  <bb 8> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _5 = pxStreamBuffer_18(D)->pucBuffer;
  _6 = _5 + xHead_19(D);
  memcpy (_6, pucData_21(D), xFirstLength_20);
  # DEBUG BEGIN_STMT
  if (xCount_16(D) > xFirstLength_20)
    goto <bb 9>; [INV]
  else
    goto <bb 13>; [INV]

  <bb 9> :
  # DEBUG BEGIN_STMT
  _7 = xCount_16(D) - xFirstLength_20;
  _8 = pxStreamBuffer_18(D)->xLength;
  if (_7 > _8)
    goto <bb 10>; [INV]
  else
    goto <bb 12>; [INV]

  <bb 10> :
  # DEBUG BEGIN_STMT
  vPortRaiseBASEPRI ();

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

  <bb 12> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _9 = pxStreamBuffer_18(D)->pucBuffer;
  _10 = pucData_21(D) + xFirstLength_20;
  _11 = xCount_16(D) - xFirstLength_20;
  memcpy (_9, _10, _11);

  <bb 13> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  xHead_25 = xHead_19(D) + xCount_16(D);
  # DEBUG xHead => xHead_25
  # DEBUG BEGIN_STMT
  _12 = pxStreamBuffer_18(D)->xLength;
  if (xHead_25 >= _12)
    goto <bb 14>; [INV]
  else
    goto <bb 15>; [INV]

  <bb 14> :
  # DEBUG BEGIN_STMT
  _13 = pxStreamBuffer_18(D)->xLength;
  xHead_26 = xHead_25 - _13;
  # DEBUG xHead => xHead_26

  <bb 15> :
  # xHead_14 = PHI <xHead_25(13), xHead_26(14)>
  # DEBUG xHead => xHead_14
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _27 = xHead_14;
  return _27;

}


xStreamBufferReceiveCompletedFromISR (struct StreamBufferDef_t * xStreamBuffer, BaseType_t * pxHigherPriorityTaskWoken)
{
  UBaseType_t uxSavedInterruptStatus;
  BaseType_t xReturn;
  struct StreamBuffer_t * const pxStreamBuffer;
  struct tskTaskControlBlock * _1;
  struct tskTaskControlBlock * _2;
  BaseType_t _16;

  <bb 2> :
  # DEBUG BEGIN_STMT
  pxStreamBuffer_6 = xStreamBuffer_5(D);
  # DEBUG pxStreamBuffer => pxStreamBuffer_6
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  if (pxStreamBuffer_6 == 0B)
    goto <bb 3>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  vPortRaiseBASEPRI ();

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

  <bb 5> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  uxSavedInterruptStatus_9 = ulPortRaiseBASEPRI ();
  # DEBUG uxSavedInterruptStatus => uxSavedInterruptStatus_9
  # DEBUG BEGIN_STMT
  _1 ={v} pxStreamBuffer_6->xTaskWaitingToSend;
  if (_1 != 0B)
    goto <bb 6>; [INV]
  else
    goto <bb 7>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  _2 ={v} pxStreamBuffer_6->xTaskWaitingToSend;
  xTaskGenericNotifyFromISR (_2, 0, 0, 0, 0B, pxHigherPriorityTaskWoken_11(D));
  # DEBUG BEGIN_STMT
  pxStreamBuffer_6->xTaskWaitingToSend ={v} 0B;
  # DEBUG BEGIN_STMT
  xReturn_14 = 1;
  # DEBUG xReturn => xReturn_14
  goto <bb 8>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  xReturn_10 = 0;
  # DEBUG xReturn => xReturn_10

  <bb 8> :
  # xReturn_3 = PHI <xReturn_14(6), xReturn_10(7)>
  # DEBUG xReturn => xReturn_3
  # DEBUG BEGIN_STMT
  vPortSetBASEPRI (uxSavedInterruptStatus_9);
  # DEBUG BEGIN_STMT
  _16 = xReturn_3;
  return _16;

}


xStreamBufferSendCompletedFromISR (struct StreamBufferDef_t * xStreamBuffer, BaseType_t * pxHigherPriorityTaskWoken)
{
  UBaseType_t uxSavedInterruptStatus;
  BaseType_t xReturn;
  struct StreamBuffer_t * const pxStreamBuffer;
  struct tskTaskControlBlock * _1;
  struct tskTaskControlBlock * _2;
  BaseType_t _16;

  <bb 2> :
  # DEBUG BEGIN_STMT
  pxStreamBuffer_6 = xStreamBuffer_5(D);
  # DEBUG pxStreamBuffer => pxStreamBuffer_6
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  if (pxStreamBuffer_6 == 0B)
    goto <bb 3>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  vPortRaiseBASEPRI ();

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

  <bb 5> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  uxSavedInterruptStatus_9 = ulPortRaiseBASEPRI ();
  # DEBUG uxSavedInterruptStatus => uxSavedInterruptStatus_9
  # DEBUG BEGIN_STMT
  _1 ={v} pxStreamBuffer_6->xTaskWaitingToReceive;
  if (_1 != 0B)
    goto <bb 6>; [INV]
  else
    goto <bb 7>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  _2 ={v} pxStreamBuffer_6->xTaskWaitingToReceive;
  xTaskGenericNotifyFromISR (_2, 0, 0, 0, 0B, pxHigherPriorityTaskWoken_11(D));
  # DEBUG BEGIN_STMT
  pxStreamBuffer_6->xTaskWaitingToReceive ={v} 0B;
  # DEBUG BEGIN_STMT
  xReturn_14 = 1;
  # DEBUG xReturn => xReturn_14
  goto <bb 8>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  xReturn_10 = 0;
  # DEBUG xReturn => xReturn_10

  <bb 8> :
  # xReturn_3 = PHI <xReturn_14(6), xReturn_10(7)>
  # DEBUG xReturn => xReturn_3
  # DEBUG BEGIN_STMT
  vPortSetBASEPRI (uxSavedInterruptStatus_9);
  # DEBUG BEGIN_STMT
  _16 = xReturn_3;
  return _16;

}


xStreamBufferIsFull (struct StreamBufferDef_t * xStreamBuffer)
{
  const struct StreamBuffer_t * const pxStreamBuffer;
  size_t xBytesToStoreMessageLength;
  BaseType_t xReturn;
  unsigned char _1;
  int _2;
  int _3;
  unsigned int _4;
  BaseType_t _15;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  pxStreamBuffer_8 = xStreamBuffer_7(D);
  # DEBUG pxStreamBuffer => pxStreamBuffer_8
  # DEBUG BEGIN_STMT
  if (pxStreamBuffer_8 == 0B)
    goto <bb 3>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  vPortRaiseBASEPRI ();

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

  <bb 5> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _1 = pxStreamBuffer_8->ucFlags;
  _2 = (int) _1;
  _3 = _2 & 1;
  if (_3 != 0)
    goto <bb 6>; [INV]
  else
    goto <bb 7>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  xBytesToStoreMessageLength_11 = 4;
  # DEBUG xBytesToStoreMessageLength => xBytesToStoreMessageLength_11
  goto <bb 8>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  xBytesToStoreMessageLength_10 = 0;
  # DEBUG xBytesToStoreMessageLength => xBytesToStoreMessageLength_10

  <bb 8> :
  # xBytesToStoreMessageLength_6 = PHI <xBytesToStoreMessageLength_11(6), xBytesToStoreMessageLength_10(7)>
  # DEBUG xBytesToStoreMessageLength => xBytesToStoreMessageLength_6
  # DEBUG BEGIN_STMT
  _4 = xStreamBufferSpacesAvailable (xStreamBuffer_7(D));
  if (xBytesToStoreMessageLength_6 >= _4)
    goto <bb 9>; [INV]
  else
    goto <bb 10>; [INV]

  <bb 9> :
  # DEBUG BEGIN_STMT
  xReturn_14 = 1;
  # DEBUG xReturn => xReturn_14
  goto <bb 11>; [INV]

  <bb 10> :
  # DEBUG BEGIN_STMT
  xReturn_13 = 0;
  # DEBUG xReturn => xReturn_13

  <bb 11> :
  # xReturn_5 = PHI <xReturn_14(9), xReturn_13(10)>
  # DEBUG xReturn => xReturn_5
  # DEBUG BEGIN_STMT
  _15 = xReturn_5;
  return _15;

}


xStreamBufferIsEmpty (struct StreamBufferDef_t * xStreamBuffer)
{
  size_t xTail;
  BaseType_t xReturn;
  const struct StreamBuffer_t * const pxStreamBuffer;
  unsigned int _1;
  BaseType_t _9;

  <bb 2> :
  # DEBUG BEGIN_STMT
  pxStreamBuffer_4 = xStreamBuffer_3(D);
  # DEBUG pxStreamBuffer => pxStreamBuffer_4
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  if (pxStreamBuffer_4 == 0B)
    goto <bb 3>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  vPortRaiseBASEPRI ();

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

  <bb 5> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  xTail_6 ={v} pxStreamBuffer_4->xTail;
  # DEBUG xTail => xTail_6
  # DEBUG BEGIN_STMT
  _1 ={v} pxStreamBuffer_4->xHead;
  if (xTail_6 == _1)
    goto <bb 6>; [INV]
  else
    goto <bb 7>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  xReturn_8 = 1;
  # DEBUG xReturn => xReturn_8
  goto <bb 8>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  xReturn_7 = 0;
  # DEBUG xReturn => xReturn_7

  <bb 8> :
  # xReturn_2 = PHI <xReturn_8(6), xReturn_7(7)>
  # DEBUG xReturn => xReturn_2
  # DEBUG BEGIN_STMT
  _9 = xReturn_2;
  return _9;

}


prvReadMessageFromBuffer (struct StreamBuffer_t * pxStreamBuffer, void * pvRxData, size_t xBufferLengthBytes, size_t xBytesAvailable)
{
  size_t xNextTail;
  size_t xTempNextMessageLength;
  size_t xNextMessageLength;
  size_t xCount;
  unsigned char _1;
  int _2;
  int _3;
  unsigned int _4;
  size_t _25;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  xNextTail_12 ={v} pxStreamBuffer_11(D)->xTail;
  # DEBUG xNextTail => xNextTail_12
  # DEBUG BEGIN_STMT
  _1 = pxStreamBuffer_11(D)->ucFlags;
  _2 = (int) _1;
  _3 = _2 & 1;
  if (_3 != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  xNextTail_17 = prvReadBytesFromBuffer (pxStreamBuffer_11(D), &xTempNextMessageLength, 4, xNextTail_12);
  # DEBUG xNextTail => xNextTail_17
  # DEBUG BEGIN_STMT
  xNextMessageLength_18 = xTempNextMessageLength;
  # DEBUG xNextMessageLength => xNextMessageLength_18
  # DEBUG BEGIN_STMT
  xBytesAvailable_19 = xBytesAvailable_15(D) + 4294967292;
  # DEBUG xBytesAvailable => xBytesAvailable_19
  # DEBUG BEGIN_STMT
  if (xNextMessageLength_18 > xBufferLengthBytes_13(D))
    goto <bb 4>; [INV]
  else
    goto <bb 6>; [INV]

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

  <bb 5> :
  # DEBUG BEGIN_STMT
  xNextMessageLength_14 = xBufferLengthBytes_13(D);
  # DEBUG xNextMessageLength => xNextMessageLength_14

  <bb 6> :
  # xBytesAvailable_5 = PHI <xBytesAvailable_19(4), xBytesAvailable_15(D)(5), xBytesAvailable_19(3)>
  # xNextMessageLength_6 = PHI <xNextMessageLength_20(4), xNextMessageLength_14(5), xNextMessageLength_18(3)>
  # xNextTail_7 = PHI <xNextTail_17(4), xNextTail_12(5), xNextTail_17(3)>
  # DEBUG xNextTail => xNextTail_7
  # DEBUG xNextMessageLength => xNextMessageLength_6
  # DEBUG xBytesAvailable => xBytesAvailable_5
  # DEBUG BEGIN_STMT
  xCount_21 = MIN_EXPR <xBytesAvailable_5, xNextMessageLength_6>;
  # DEBUG xCount => xCount_21
  # DEBUG BEGIN_STMT
  if (xCount_21 != 0)
    goto <bb 7>; [INV]
  else
    goto <bb 8>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  _4 = prvReadBytesFromBuffer (pxStreamBuffer_11(D), pvRxData_22(D), xCount_21, xNextTail_7);
  pxStreamBuffer_11(D)->xTail ={v} _4;

  <bb 8> :
  # DEBUG BEGIN_STMT
  _25 = xCount_21;
  xTempNextMessageLength ={v} {CLOBBER};
  return _25;

}


xStreamBufferReceiveFromISR (struct StreamBufferDef_t * xStreamBuffer, void * pvRxData, size_t xBufferLengthBytes, BaseType_t * const pxHigherPriorityTaskWoken)
{
  UBaseType_t uxSavedInterruptStatus;
  size_t xBytesToStoreMessageLength;
  size_t xBytesAvailable;
  size_t xReceivedLength;
  struct StreamBuffer_t * const pxStreamBuffer;
  unsigned char _1;
  int _2;
  int _3;
  struct tskTaskControlBlock * _4;
  struct tskTaskControlBlock * _5;
  size_t _28;

  <bb 2> :
  # DEBUG BEGIN_STMT
  pxStreamBuffer_11 = xStreamBuffer_10(D);
  # DEBUG pxStreamBuffer => pxStreamBuffer_11
  # DEBUG BEGIN_STMT
  xReceivedLength_12 = 0;
  # DEBUG xReceivedLength => xReceivedLength_12
  # DEBUG BEGIN_STMT
  if (pvRxData_13(D) == 0B)
    goto <bb 3>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  vPortRaiseBASEPRI ();

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

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

  <bb 6> :
  # DEBUG BEGIN_STMT
  vPortRaiseBASEPRI ();

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

  <bb 8> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _1 = pxStreamBuffer_11->ucFlags;
  _2 = (int) _1;
  _3 = _2 & 1;
  if (_3 != 0)
    goto <bb 9>; [INV]
  else
    goto <bb 10>; [INV]

  <bb 9> :
  # DEBUG BEGIN_STMT
  xBytesToStoreMessageLength_16 = 4;
  # DEBUG xBytesToStoreMessageLength => xBytesToStoreMessageLength_16
  goto <bb 11>; [INV]

  <bb 10> :
  # DEBUG BEGIN_STMT
  xBytesToStoreMessageLength_15 = 0;
  # DEBUG xBytesToStoreMessageLength => xBytesToStoreMessageLength_15

  <bb 11> :
  # xBytesToStoreMessageLength_7 = PHI <xBytesToStoreMessageLength_16(9), xBytesToStoreMessageLength_15(10)>
  # DEBUG xBytesToStoreMessageLength => xBytesToStoreMessageLength_7
  # DEBUG BEGIN_STMT
  xBytesAvailable_18 = prvBytesInBuffer (pxStreamBuffer_11);
  # DEBUG xBytesAvailable => xBytesAvailable_18
  # DEBUG BEGIN_STMT
  if (xBytesAvailable_18 > xBytesToStoreMessageLength_7)
    goto <bb 12>; [INV]
  else
    goto <bb 16>; [INV]

  <bb 12> :
  # DEBUG BEGIN_STMT
  xReceivedLength_21 = prvReadMessageFromBuffer (pxStreamBuffer_11, pvRxData_13(D), xBufferLengthBytes_19(D), xBytesAvailable_18);
  # DEBUG xReceivedLength => xReceivedLength_21
  # DEBUG BEGIN_STMT
  if (xReceivedLength_21 != 0)
    goto <bb 13>; [INV]
  else
    goto <bb 16>; [INV]

  <bb 13> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  uxSavedInterruptStatus_23 = ulPortRaiseBASEPRI ();
  # DEBUG uxSavedInterruptStatus => uxSavedInterruptStatus_23
  # DEBUG BEGIN_STMT
  _4 ={v} pxStreamBuffer_11->xTaskWaitingToSend;
  if (_4 != 0B)
    goto <bb 14>; [INV]
  else
    goto <bb 15>; [INV]

  <bb 14> :
  # DEBUG BEGIN_STMT
  _5 ={v} pxStreamBuffer_11->xTaskWaitingToSend;
  xTaskGenericNotifyFromISR (_5, 0, 0, 0, 0B, pxHigherPriorityTaskWoken_24(D));
  # DEBUG BEGIN_STMT
  pxStreamBuffer_11->xTaskWaitingToSend ={v} 0B;

  <bb 15> :
  # DEBUG BEGIN_STMT
  vPortSetBASEPRI (uxSavedInterruptStatus_23);
  # DEBUG BEGIN_STMT

  <bb 16> :
  # xReceivedLength_6 = PHI <xReceivedLength_12(11), xReceivedLength_21(15), xReceivedLength_21(12)>
  # DEBUG xReceivedLength => xReceivedLength_6
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _28 = xReceivedLength_6;
  return _28;

}


xStreamBufferNextMessageLengthBytes (struct StreamBufferDef_t * xStreamBuffer)
{
  size_t xTempReturn;
  size_t xBytesAvailable;
  size_t xReturn;
  struct StreamBuffer_t * const pxStreamBuffer;
  unsigned char _1;
  int _2;
  int _3;
  unsigned int _4;
  size_t _17;

  <bb 2> :
  # DEBUG BEGIN_STMT
  pxStreamBuffer_8 = xStreamBuffer_7(D);
  # DEBUG pxStreamBuffer => pxStreamBuffer_8
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  if (pxStreamBuffer_8 == 0B)
    goto <bb 3>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  vPortRaiseBASEPRI ();

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

  <bb 5> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _1 = pxStreamBuffer_8->ucFlags;
  _2 = (int) _1;
  _3 = _2 & 1;
  if (_3 != 0)
    goto <bb 6>; [INV]
  else
    goto <bb 12>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  xBytesAvailable_12 = prvBytesInBuffer (pxStreamBuffer_8);
  # DEBUG xBytesAvailable => xBytesAvailable_12
  # DEBUG BEGIN_STMT
  if (xBytesAvailable_12 > 4)
    goto <bb 7>; [INV]
  else
    goto <bb 8>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  _4 ={v} pxStreamBuffer_8->xTail;
  prvReadBytesFromBuffer (pxStreamBuffer_8, &xTempReturn, 4, _4);
  # DEBUG BEGIN_STMT
  xReturn_16 = xTempReturn;
  # DEBUG xReturn => xReturn_16
  goto <bb 13>; [INV]

  <bb 8> :
  # DEBUG BEGIN_STMT
  if (xBytesAvailable_12 != 0)
    goto <bb 9>; [INV]
  else
    goto <bb 11>; [INV]

  <bb 9> :
  # DEBUG BEGIN_STMT
  vPortRaiseBASEPRI ();

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

  <bb 11> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  xReturn_13 = 0;
  # DEBUG xReturn => xReturn_13
  goto <bb 13>; [INV]

  <bb 12> :
  # DEBUG BEGIN_STMT
  xReturn_10 = 0;
  # DEBUG xReturn => xReturn_10

  <bb 13> :
  # xReturn_5 = PHI <xReturn_13(11), xReturn_10(12), xReturn_16(7)>
  # DEBUG xReturn => xReturn_5
  # DEBUG BEGIN_STMT
  _17 = xReturn_5;
  xTempReturn ={v} {CLOBBER};
  return _17;

}


xStreamBufferReceive (struct StreamBufferDef_t * xStreamBuffer, void * pvRxData, size_t xBufferLengthBytes, TickType_t xTicksToWait)
{
  size_t xBytesToStoreMessageLength;
  size_t xBytesAvailable;
  size_t xReceivedLength;
  struct StreamBuffer_t * const pxStreamBuffer;
  unsigned char _1;
  int _2;
  int _3;
  struct tskTaskControlBlock * _4;
  struct tskTaskControlBlock * _5;
  struct tskTaskControlBlock * _6;
  struct tskTaskControlBlock * _7;
  size_t _44;

  <bb 2> :
  # DEBUG BEGIN_STMT
  pxStreamBuffer_16 = xStreamBuffer_15(D);
  # DEBUG pxStreamBuffer => pxStreamBuffer_16
  # DEBUG BEGIN_STMT
  xReceivedLength_17 = 0;
  # DEBUG xReceivedLength => xReceivedLength_17
  # DEBUG BEGIN_STMT
  if (pvRxData_18(D) == 0B)
    goto <bb 3>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  vPortRaiseBASEPRI ();

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

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

  <bb 6> :
  # DEBUG BEGIN_STMT
  vPortRaiseBASEPRI ();

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

  <bb 8> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _1 = pxStreamBuffer_16->ucFlags;
  _2 = (int) _1;
  _3 = _2 & 1;
  if (_3 != 0)
    goto <bb 9>; [INV]
  else
    goto <bb 10>; [INV]

  <bb 9> :
  # DEBUG BEGIN_STMT
  xBytesToStoreMessageLength_21 = 4;
  # DEBUG xBytesToStoreMessageLength => xBytesToStoreMessageLength_21
  goto <bb 11>; [INV]

  <bb 10> :
  # DEBUG BEGIN_STMT
  xBytesToStoreMessageLength_20 = 0;
  # DEBUG xBytesToStoreMessageLength => xBytesToStoreMessageLength_20

  <bb 11> :
  # xBytesToStoreMessageLength_10 = PHI <xBytesToStoreMessageLength_21(9), xBytesToStoreMessageLength_20(10)>
  # DEBUG xBytesToStoreMessageLength => xBytesToStoreMessageLength_10
  # DEBUG BEGIN_STMT
  if (xTicksToWait_22(D) != 0)
    goto <bb 12>; [INV]
  else
    goto <bb 19>; [INV]

  <bb 12> :
  # DEBUG BEGIN_STMT
  vPortEnterCritical ();
  # DEBUG BEGIN_STMT
  xBytesAvailable_27 = prvBytesInBuffer (pxStreamBuffer_16);
  # DEBUG xBytesAvailable => xBytesAvailable_27
  # DEBUG BEGIN_STMT
  if (xBytesAvailable_27 <= xBytesToStoreMessageLength_10)
    goto <bb 13>; [INV]
  else
    goto <bb 17>; [INV]

  <bb 13> :
  # DEBUG BEGIN_STMT
  xTaskGenericNotifyStateClear (0B, 0);
  # DEBUG BEGIN_STMT
  _4 ={v} pxStreamBuffer_16->xTaskWaitingToReceive;
  if (_4 != 0B)
    goto <bb 14>; [INV]
  else
    goto <bb 16>; [INV]

  <bb 14> :
  # DEBUG BEGIN_STMT
  vPortRaiseBASEPRI ();

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

  <bb 16> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _5 = xTaskGetCurrentTaskHandle ();
  pxStreamBuffer_16->xTaskWaitingToReceive ={v} _5;

  <bb 17> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  vPortExitCritical ();
  # DEBUG BEGIN_STMT
  if (xBytesAvailable_27 <= xBytesToStoreMessageLength_10)
    goto <bb 18>; [INV]
  else
    goto <bb 20>; [INV]

  <bb 18> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  xTaskGenericNotifyWait (0, 0, 0, 0B, xTicksToWait_22(D));
  # DEBUG BEGIN_STMT
  pxStreamBuffer_16->xTaskWaitingToReceive ={v} 0B;
  # DEBUG BEGIN_STMT
  xBytesAvailable_36 = prvBytesInBuffer (pxStreamBuffer_16);
  # DEBUG xBytesAvailable => xBytesAvailable_36
  goto <bb 20>; [INV]

  <bb 19> :
  # DEBUG BEGIN_STMT
  xBytesAvailable_24 = prvBytesInBuffer (pxStreamBuffer_16);
  # DEBUG xBytesAvailable => xBytesAvailable_24

  <bb 20> :
  # xBytesAvailable_9 = PHI <xBytesAvailable_36(18), xBytesAvailable_24(19), xBytesAvailable_27(17)>
  # DEBUG xBytesAvailable => xBytesAvailable_9
  # DEBUG BEGIN_STMT
  if (xBytesAvailable_9 > xBytesToStoreMessageLength_10)
    goto <bb 21>; [INV]
  else
    goto <bb 25>; [INV]

  <bb 21> :
  # DEBUG BEGIN_STMT
  xReceivedLength_39 = prvReadMessageFromBuffer (pxStreamBuffer_16, pvRxData_18(D), xBufferLengthBytes_37(D), xBytesAvailable_9);
  # DEBUG xReceivedLength => xReceivedLength_39
  # DEBUG BEGIN_STMT
  if (xReceivedLength_39 != 0)
    goto <bb 22>; [INV]
  else
    goto <bb 25>; [INV]

  <bb 22> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  vTaskSuspendAll ();
  # DEBUG BEGIN_STMT
  _6 ={v} pxStreamBuffer_16->xTaskWaitingToSend;
  if (_6 != 0B)
    goto <bb 23>; [INV]
  else
    goto <bb 24>; [INV]

  <bb 23> :
  # DEBUG BEGIN_STMT
  _7 ={v} pxStreamBuffer_16->xTaskWaitingToSend;
  xTaskGenericNotify (_7, 0, 0, 0, 0B);
  # DEBUG BEGIN_STMT
  pxStreamBuffer_16->xTaskWaitingToSend ={v} 0B;

  <bb 24> :
  # DEBUG BEGIN_STMT
  xTaskResumeAll ();
  # DEBUG BEGIN_STMT

  <bb 25> :
  # xReceivedLength_8 = PHI <xReceivedLength_17(20), xReceivedLength_39(24), xReceivedLength_39(21)>
  # DEBUG xReceivedLength => xReceivedLength_8
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _44 = xReceivedLength_8;
  return _44;

}


prvWriteMessageToBuffer (struct StreamBuffer_t * const pxStreamBuffer, const void * pvTxData, size_t xDataLengthBytes, size_t xSpace, size_t xRequiredSpace)
{
  size_t xNextHead;
  unsigned char _1;
  int _2;
  int _3;
  unsigned int xDataLengthBytes.2_4;
  unsigned int _5;
  unsigned int xDataLengthBytes.3_6;
  unsigned int xDataLengthBytes.4_7;
  unsigned int _8;
  size_t _24;

  <bb 2> :
  # DEBUG BEGIN_STMT
  xNextHead_14 ={v} pxStreamBuffer_13(D)->xHead;
  # DEBUG xNextHead => xNextHead_14
  # DEBUG BEGIN_STMT
  _1 = pxStreamBuffer_13(D)->ucFlags;
  _2 = (int) _1;
  _3 = _2 & 1;
  if (_3 != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 6>; [INV]

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

  <bb 4> :
  # DEBUG BEGIN_STMT
  xNextHead_20 = prvWriteBytesToBuffer (pxStreamBuffer_13(D), &xDataLengthBytes, 4, xNextHead_14);
  # DEBUG xNextHead => xNextHead_20
  goto <bb 7>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  xDataLengthBytes = 0;
  goto <bb 7>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  xDataLengthBytes.2_4 = xDataLengthBytes;
  _5 = MIN_EXPR <xSpace_15(D), xDataLengthBytes.2_4>;
  xDataLengthBytes = _5;

  <bb 7> :
  # xNextHead_9 = PHI <xNextHead_14(5), xNextHead_14(6), xNextHead_20(4)>
  # DEBUG xNextHead => xNextHead_9
  # DEBUG BEGIN_STMT
  xDataLengthBytes.3_6 = xDataLengthBytes;
  if (xDataLengthBytes.3_6 != 0)
    goto <bb 8>; [INV]
  else
    goto <bb 9>; [INV]

  <bb 8> :
  # DEBUG BEGIN_STMT
  xDataLengthBytes.4_7 = xDataLengthBytes;
  _8 = prvWriteBytesToBuffer (pxStreamBuffer_13(D), pvTxData_21(D), xDataLengthBytes.4_7, xNextHead_9);
  pxStreamBuffer_13(D)->xHead ={v} _8;

  <bb 9> :
  # DEBUG BEGIN_STMT
  _24 = xDataLengthBytes;
  return _24;

}


xStreamBufferSendFromISR (struct StreamBufferDef_t * xStreamBuffer, const void * pvTxData, size_t xDataLengthBytes, BaseType_t * const pxHigherPriorityTaskWoken)
{
  UBaseType_t uxSavedInterruptStatus;
  size_t xRequiredSpace;
  size_t xSpace;
  size_t xReturn;
  struct StreamBuffer_t * const pxStreamBuffer;
  unsigned char _1;
  int _2;
  int _3;
  unsigned int _4;
  unsigned int _5;
  struct tskTaskControlBlock * _6;
  struct tskTaskControlBlock * _7;
  size_t _29;

  <bb 2> :
  # DEBUG BEGIN_STMT
  pxStreamBuffer_12 = xStreamBuffer_11(D);
  # DEBUG pxStreamBuffer => pxStreamBuffer_12
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  xRequiredSpace_14 = xDataLengthBytes_13(D);
  # DEBUG xRequiredSpace => xRequiredSpace_14
  # DEBUG BEGIN_STMT
  if (pvTxData_15(D) == 0B)
    goto <bb 3>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  vPortRaiseBASEPRI ();

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

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

  <bb 6> :
  # DEBUG BEGIN_STMT
  vPortRaiseBASEPRI ();

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

  <bb 8> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _1 = pxStreamBuffer_12->ucFlags;
  _2 = (int) _1;
  _3 = _2 & 1;
  if (_3 != 0)
    goto <bb 9>; [INV]
  else
    goto <bb 10>; [INV]

  <bb 9> :
  # DEBUG BEGIN_STMT
  xRequiredSpace_17 = xRequiredSpace_14 + 4;
  # DEBUG xRequiredSpace => xRequiredSpace_17

  <bb 10> :
  # xRequiredSpace_8 = PHI <xRequiredSpace_14(8), xRequiredSpace_17(9)>
  # DEBUG xRequiredSpace => xRequiredSpace_8
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  xSpace_19 = xStreamBufferSpacesAvailable (pxStreamBuffer_12);
  # DEBUG xSpace => xSpace_19
  # DEBUG BEGIN_STMT
  xReturn_21 = prvWriteMessageToBuffer (pxStreamBuffer_12, pvTxData_15(D), xDataLengthBytes_13(D), xSpace_19, xRequiredSpace_8);
  # DEBUG xReturn => xReturn_21
  # DEBUG BEGIN_STMT
  if (xReturn_21 != 0)
    goto <bb 11>; [INV]
  else
    goto <bb 15>; [INV]

  <bb 11> :
  # DEBUG BEGIN_STMT
  _4 = prvBytesInBuffer (pxStreamBuffer_12);
  _5 = pxStreamBuffer_12->xTriggerLevelBytes;
  if (_4 >= _5)
    goto <bb 12>; [INV]
  else
    goto <bb 15>; [INV]

  <bb 12> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  uxSavedInterruptStatus_24 = ulPortRaiseBASEPRI ();
  # DEBUG uxSavedInterruptStatus => uxSavedInterruptStatus_24
  # DEBUG BEGIN_STMT
  _6 ={v} pxStreamBuffer_12->xTaskWaitingToReceive;
  if (_6 != 0B)
    goto <bb 13>; [INV]
  else
    goto <bb 14>; [INV]

  <bb 13> :
  # DEBUG BEGIN_STMT
  _7 ={v} pxStreamBuffer_12->xTaskWaitingToReceive;
  xTaskGenericNotifyFromISR (_7, 0, 0, 0, 0B, pxHigherPriorityTaskWoken_25(D));
  # DEBUG BEGIN_STMT
  pxStreamBuffer_12->xTaskWaitingToReceive ={v} 0B;

  <bb 14> :
  # DEBUG BEGIN_STMT
  vPortSetBASEPRI (uxSavedInterruptStatus_24);
  # DEBUG BEGIN_STMT

  <bb 15> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _29 = xReturn_21;
  return _29;

}


xStreamBufferSend (struct StreamBufferDef_t * xStreamBuffer, const void * pvTxData, size_t xDataLengthBytes, TickType_t xTicksToWait)
{
  size_t xMaxReportedSpace;
  struct TimeOut_t xTimeOut;
  size_t xRequiredSpace;
  size_t xSpace;
  size_t xReturn;
  struct StreamBuffer_t * const pxStreamBuffer;
  unsigned int _1;
  unsigned char _2;
  int _3;
  int _4;
  long unsigned int xTicksToWait.0_5;
  struct tskTaskControlBlock * _6;
  struct tskTaskControlBlock * _7;
  long unsigned int xTicksToWait.1_8;
  long int _9;
  unsigned int _10;
  unsigned int _11;
  struct tskTaskControlBlock * _12;
  struct tskTaskControlBlock * _13;
  size_t _58;

  <bb 2> :
  # DEBUG BEGIN_STMT
  pxStreamBuffer_24 = xStreamBuffer_23(D);
  # DEBUG pxStreamBuffer => pxStreamBuffer_24
  # DEBUG BEGIN_STMT
  xSpace_25 = 0;
  # DEBUG xSpace => xSpace_25
  # DEBUG BEGIN_STMT
  xRequiredSpace_27 = xDataLengthBytes_26(D);
  # DEBUG xRequiredSpace => xRequiredSpace_27
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  xMaxReportedSpace_28 = 0;
  # DEBUG xMaxReportedSpace => xMaxReportedSpace_28
  # DEBUG BEGIN_STMT
  if (pvTxData_29(D) == 0B)
    goto <bb 3>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  vPortRaiseBASEPRI ();

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

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

  <bb 6> :
  # DEBUG BEGIN_STMT
  vPortRaiseBASEPRI ();

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

  <bb 8> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _1 = pxStreamBuffer_24->xLength;
  xMaxReportedSpace_31 = _1 + 4294967295;
  # DEBUG xMaxReportedSpace => xMaxReportedSpace_31
  # DEBUG BEGIN_STMT
  _2 = pxStreamBuffer_24->ucFlags;
  _3 = (int) _2;
  _4 = _3 & 1;
  if (_4 != 0)
    goto <bb 9>; [INV]
  else
    goto <bb 14>; [INV]

  <bb 9> :
  # DEBUG BEGIN_STMT
  xRequiredSpace_33 = xRequiredSpace_27 + 4;
  # DEBUG xRequiredSpace => xRequiredSpace_33
  # DEBUG BEGIN_STMT
  if (xRequiredSpace_33 <= xDataLengthBytes_26(D))
    goto <bb 10>; [INV]
  else
    goto <bb 12>; [INV]

  <bb 10> :
  # DEBUG BEGIN_STMT
  vPortRaiseBASEPRI ();

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

  <bb 12> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  if (xRequiredSpace_33 > xMaxReportedSpace_31)
    goto <bb 13>; [INV]
  else
    goto <bb 16>; [INV]

  <bb 13> :
  # DEBUG BEGIN_STMT
  xTicksToWait = 0;
  goto <bb 16>; [INV]

  <bb 14> :
  # DEBUG BEGIN_STMT
  if (xRequiredSpace_27 > xMaxReportedSpace_31)
    goto <bb 15>; [INV]
  else
    goto <bb 16>; [INV]

  <bb 15> :
  # DEBUG BEGIN_STMT
  xRequiredSpace_32 = xMaxReportedSpace_31;
  # DEBUG xRequiredSpace => xRequiredSpace_32

  <bb 16> :
  # xRequiredSpace_16 = PHI <xRequiredSpace_33(13), xRequiredSpace_27(14), xRequiredSpace_32(15), xRequiredSpace_33(12)>
  # DEBUG xRequiredSpace => xRequiredSpace_16
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  xTicksToWait.0_5 = xTicksToWait;
  if (xTicksToWait.0_5 != 0)
    goto <bb 17>; [INV]
  else
    goto <bb 24>; [INV]

  <bb 17> :
  # DEBUG BEGIN_STMT
  vTaskSetTimeOutState (&xTimeOut);

  <bb 18> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  vPortEnterCritical ();
  # DEBUG BEGIN_STMT
  xSpace_39 = xStreamBufferSpacesAvailable (pxStreamBuffer_24);
  # DEBUG xSpace => xSpace_39
  # DEBUG BEGIN_STMT
  if (xSpace_39 < xRequiredSpace_16)
    goto <bb 19>; [INV]
  else
    goto <bb 23>; [INV]

  <bb 19> :
  # DEBUG BEGIN_STMT
  xTaskGenericNotifyStateClear (0B, 0);
  # DEBUG BEGIN_STMT
  _6 ={v} pxStreamBuffer_24->xTaskWaitingToSend;
  if (_6 != 0B)
    goto <bb 20>; [INV]
  else
    goto <bb 22>; [INV]

  <bb 20> :
  # DEBUG BEGIN_STMT
  vPortRaiseBASEPRI ();

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

  <bb 22> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _7 = xTaskGetCurrentTaskHandle ();
  pxStreamBuffer_24->xTaskWaitingToSend ={v} _7;
  # DEBUG BEGIN_STMT
  vPortExitCritical ();
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  xTicksToWait.1_8 = xTicksToWait;
  xTaskGenericNotifyWait (0, 0, 0, 0B, xTicksToWait.1_8);
  # DEBUG BEGIN_STMT
  pxStreamBuffer_24->xTaskWaitingToSend ={v} 0B;
  # DEBUG BEGIN_STMT
  _9 = xTaskCheckForTimeOut (&xTimeOut, &xTicksToWait);
  if (_9 == 0)
    goto <bb 18>; [INV]
  else
    goto <bb 24>; [INV]

  <bb 23> :
  # DEBUG BEGIN_STMT
  vPortExitCritical ();
  # DEBUG BEGIN_STMT

  <bb 24> :
  # xSpace_14 = PHI <xSpace_25(16), xSpace_39(22), xSpace_39(23)>
  # DEBUG xSpace => xSpace_14
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  if (xSpace_14 == 0)
    goto <bb 25>; [INV]
  else
    goto <bb 26>; [INV]

  <bb 25> :
  # DEBUG BEGIN_STMT
  xSpace_50 = xStreamBufferSpacesAvailable (pxStreamBuffer_24);
  # DEBUG xSpace => xSpace_50

  <bb 26> :
  # xSpace_15 = PHI <xSpace_14(24), xSpace_50(25)>
  # DEBUG xSpace => xSpace_15
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  xReturn_52 = prvWriteMessageToBuffer (pxStreamBuffer_24, pvTxData_29(D), xDataLengthBytes_26(D), xSpace_15, xRequiredSpace_16);
  # DEBUG xReturn => xReturn_52
  # DEBUG BEGIN_STMT
  if (xReturn_52 != 0)
    goto <bb 27>; [INV]
  else
    goto <bb 31>; [INV]

  <bb 27> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _10 = prvBytesInBuffer (pxStreamBuffer_24);
  _11 = pxStreamBuffer_24->xTriggerLevelBytes;
  if (_10 >= _11)
    goto <bb 28>; [INV]
  else
    goto <bb 31>; [INV]

  <bb 28> :
  # DEBUG BEGIN_STMT
  vTaskSuspendAll ();
  # DEBUG BEGIN_STMT
  _12 ={v} pxStreamBuffer_24->xTaskWaitingToReceive;
  if (_12 != 0B)
    goto <bb 29>; [INV]
  else
    goto <bb 30>; [INV]

  <bb 29> :
  # DEBUG BEGIN_STMT
  _13 ={v} pxStreamBuffer_24->xTaskWaitingToReceive;
  xTaskGenericNotify (_13, 0, 0, 0, 0B);
  # DEBUG BEGIN_STMT
  pxStreamBuffer_24->xTaskWaitingToReceive ={v} 0B;

  <bb 30> :
  # DEBUG BEGIN_STMT
  xTaskResumeAll ();
  # DEBUG BEGIN_STMT

  <bb 31> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _58 = xReturn_52;
  xTimeOut ={v} {CLOBBER};
  return _58;

}


xStreamBufferBytesAvailable (struct StreamBufferDef_t * xStreamBuffer)
{
  size_t xReturn;
  const struct StreamBuffer_t * const pxStreamBuffer;
  size_t _6;

  <bb 2> :
  # DEBUG BEGIN_STMT
  pxStreamBuffer_2 = xStreamBuffer_1(D);
  # DEBUG pxStreamBuffer => pxStreamBuffer_2
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  if (pxStreamBuffer_2 == 0B)
    goto <bb 3>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  vPortRaiseBASEPRI ();

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

  <bb 5> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  xReturn_5 = prvBytesInBuffer (pxStreamBuffer_2);
  # DEBUG xReturn => xReturn_5
  # DEBUG BEGIN_STMT
  _6 = xReturn_5;
  return _6;

}


xStreamBufferSpacesAvailable (struct StreamBufferDef_t * xStreamBuffer)
{
  size_t xOriginalTail;
  size_t xSpace;
  const struct StreamBuffer_t * const pxStreamBuffer;
  unsigned int _1;
  unsigned int _2;
  unsigned int _3;
  unsigned int _4;
  unsigned int _5;
  unsigned int _12;
  size_t _16;

  <bb 2> :
  # DEBUG BEGIN_STMT
  pxStreamBuffer_8 = xStreamBuffer_7(D);
  # DEBUG pxStreamBuffer => pxStreamBuffer_8
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  if (pxStreamBuffer_8 == 0B)
    goto <bb 3>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  vPortRaiseBASEPRI ();

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

  <bb 5> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  xOriginalTail_10 ={v} pxStreamBuffer_8->xTail;
  # DEBUG xOriginalTail => xOriginalTail_10
  # DEBUG BEGIN_STMT
  _1 = pxStreamBuffer_8->xLength;
  _2 ={v} pxStreamBuffer_8->xTail;
  xSpace_11 = _1 + _2;
  # DEBUG xSpace => xSpace_11
  # DEBUG BEGIN_STMT
  _12 ={v} pxStreamBuffer_8->xHead;
  xSpace_13 = xSpace_11 - _12;
  # DEBUG xSpace => xSpace_13
  # DEBUG BEGIN_STMT
  _3 ={v} pxStreamBuffer_8->xTail;
  if (xOriginalTail_10 != _3)
    goto <bb 5>; [INV]
  else
    goto <bb 6>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  xSpace_14 = xSpace_13 + 4294967295;
  # DEBUG xSpace => xSpace_14
  # DEBUG BEGIN_STMT
  _4 = pxStreamBuffer_8->xLength;
  if (xSpace_14 >= _4)
    goto <bb 7>; [INV]
  else
    goto <bb 8>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  _5 = pxStreamBuffer_8->xLength;
  xSpace_15 = xSpace_14 - _5;
  # DEBUG xSpace => xSpace_15

  <bb 8> :
  # xSpace_6 = PHI <xSpace_14(6), xSpace_15(7)>
  # DEBUG xSpace => xSpace_6
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _16 = xSpace_6;
  return _16;

}


xStreamBufferSetTriggerLevel (struct StreamBufferDef_t * xStreamBuffer, size_t xTriggerLevel)
{
  BaseType_t xReturn;
  struct StreamBuffer_t * const pxStreamBuffer;
  unsigned int _1;
  BaseType_t _13;

  <bb 2> :
  # DEBUG BEGIN_STMT
  pxStreamBuffer_6 = xStreamBuffer_5(D);
  # DEBUG pxStreamBuffer => pxStreamBuffer_6
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  if (pxStreamBuffer_6 == 0B)
    goto <bb 3>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  vPortRaiseBASEPRI ();

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

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

  <bb 6> :
  # DEBUG BEGIN_STMT
  xTriggerLevel_8 = 1;
  # DEBUG xTriggerLevel => xTriggerLevel_8

  <bb 7> :
  # xTriggerLevel_2 = PHI <xTriggerLevel_7(D)(5), xTriggerLevel_8(6)>
  # DEBUG xTriggerLevel => xTriggerLevel_2
  # DEBUG BEGIN_STMT
  _1 = pxStreamBuffer_6->xLength;
  if (xTriggerLevel_2 < _1)
    goto <bb 8>; [INV]
  else
    goto <bb 9>; [INV]

  <bb 8> :
  # DEBUG BEGIN_STMT
  pxStreamBuffer_6->xTriggerLevelBytes = xTriggerLevel_2;
  # DEBUG BEGIN_STMT
  xReturn_12 = 1;
  # DEBUG xReturn => xReturn_12
  goto <bb 10>; [INV]

  <bb 9> :
  # DEBUG BEGIN_STMT
  xReturn_10 = 0;
  # DEBUG xReturn => xReturn_10

  <bb 10> :
  # xReturn_3 = PHI <xReturn_12(8), xReturn_10(9)>
  # DEBUG xReturn => xReturn_3
  # DEBUG BEGIN_STMT
  _13 = xReturn_3;
  return _13;

}


xStreamBufferReset (struct StreamBufferDef_t * xStreamBuffer)
{
  UBaseType_t uxStreamBufferNumber;
  BaseType_t xReturn;
  struct StreamBuffer_t * const pxStreamBuffer;
  struct tskTaskControlBlock * _1;
  struct tskTaskControlBlock * _2;
  uint8_t * _3;
  unsigned int _4;
  unsigned int _5;
  unsigned char _6;
  BaseType_t _19;

  <bb 2> :
  # DEBUG BEGIN_STMT
  pxStreamBuffer_10 = xStreamBuffer_9(D);
  # DEBUG pxStreamBuffer => pxStreamBuffer_10
  # DEBUG BEGIN_STMT
  xReturn_11 = 0;
  # DEBUG xReturn => xReturn_11
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  if (pxStreamBuffer_10 == 0B)
    goto <bb 3>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  vPortRaiseBASEPRI ();

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

  <bb 5> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  uxStreamBufferNumber_13 = pxStreamBuffer_10->uxStreamBufferNumber;
  # DEBUG uxStreamBufferNumber => uxStreamBufferNumber_13
  # DEBUG BEGIN_STMT
  vPortEnterCritical ();
  # DEBUG BEGIN_STMT
  _1 ={v} pxStreamBuffer_10->xTaskWaitingToReceive;
  if (_1 == 0B)
    goto <bb 6>; [INV]
  else
    goto <bb 8>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  _2 ={v} pxStreamBuffer_10->xTaskWaitingToSend;
  if (_2 == 0B)
    goto <bb 7>; [INV]
  else
    goto <bb 8>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  _3 = pxStreamBuffer_10->pucBuffer;
  _4 = pxStreamBuffer_10->xLength;
  _5 = pxStreamBuffer_10->xTriggerLevelBytes;
  _6 = pxStreamBuffer_10->ucFlags;
  prvInitialiseNewStreamBuffer (pxStreamBuffer_10, _3, _4, _5, _6);
  # DEBUG BEGIN_STMT
  xReturn_16 = 1;
  # DEBUG xReturn => xReturn_16
  # DEBUG BEGIN_STMT
  pxStreamBuffer_10->uxStreamBufferNumber = uxStreamBufferNumber_13;

  <bb 8> :
  # xReturn_7 = PHI <xReturn_11(5), xReturn_11(6), xReturn_16(7)>
  # DEBUG xReturn => xReturn_7
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  vPortExitCritical ();
  # DEBUG BEGIN_STMT
  _19 = xReturn_7;
  return _19;

}


vStreamBufferDelete (struct StreamBufferDef_t * xStreamBuffer)
{
  struct StreamBuffer_t * pxStreamBuffer;
  unsigned char _1;
  int _2;
  int _3;

  <bb 2> :
  # DEBUG BEGIN_STMT
  pxStreamBuffer_6 = xStreamBuffer_5(D);
  # DEBUG pxStreamBuffer => pxStreamBuffer_6
  # DEBUG BEGIN_STMT
  if (pxStreamBuffer_6 == 0B)
    goto <bb 3>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  vPortRaiseBASEPRI ();

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

  <bb 5> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _1 = pxStreamBuffer_6->ucFlags;
  _2 = (int) _1;
  _3 = _2 & 2;
  if (_3 == 0)
    goto <bb 6>; [INV]
  else
    goto <bb 7>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  vPortFree (pxStreamBuffer_6);
  goto <bb 8>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  memset (pxStreamBuffer_6, 0, 36);

  <bb 8> :
  return;

}


xStreamBufferGenericCreate (size_t xBufferSizeBytes, size_t xTriggerLevelBytes, BaseType_t xIsMessageBuffer)
{
  uint8_t ucFlags;
  uint8_t * pucAllocatedMemory;
  unsigned int _1;
  uint8_t * _2;
  struct StreamBufferDef_t * _23;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  if (xIsMessageBuffer_9(D) == 1)
    goto <bb 3>; [INV]
  else
    goto <bb 6>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  ucFlags_14 = 1;
  # DEBUG ucFlags => ucFlags_14
  # DEBUG BEGIN_STMT
  if (xBufferSizeBytes_11(D) <= 4)
    goto <bb 4>; [INV]
  else
    goto <bb 9>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  vPortRaiseBASEPRI ();

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

  <bb 6> :
  # DEBUG BEGIN_STMT
  ucFlags_10 = 0;
  # DEBUG ucFlags => ucFlags_10
  # DEBUG BEGIN_STMT
  if (xBufferSizeBytes_11(D) == 0)
    goto <bb 7>; [INV]
  else
    goto <bb 9>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  vPortRaiseBASEPRI ();

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

  <bb 9> :
  # ucFlags_6 = PHI <ucFlags_14(3), ucFlags_10(6)>
  # DEBUG ucFlags => ucFlags_6
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  if (xTriggerLevelBytes_16(D) > xBufferSizeBytes_11(D))
    goto <bb 10>; [INV]
  else
    goto <bb 12>; [INV]

  <bb 10> :
  # DEBUG BEGIN_STMT
  vPortRaiseBASEPRI ();

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

  <bb 12> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  if (xTriggerLevelBytes_16(D) == 0)
    goto <bb 13>; [INV]
  else
    goto <bb 14>; [INV]

  <bb 13> :
  # DEBUG BEGIN_STMT
  xTriggerLevelBytes_17 = 1;
  # DEBUG xTriggerLevelBytes => xTriggerLevelBytes_17

  <bb 14> :
  # xTriggerLevelBytes_4 = PHI <xTriggerLevelBytes_16(D)(12), xTriggerLevelBytes_17(13)>
  # DEBUG xTriggerLevelBytes => xTriggerLevelBytes_4
  # DEBUG BEGIN_STMT
  if (xBufferSizeBytes_11(D) <= 4294967258)
    goto <bb 15>; [INV]
  else
    goto <bb 16>; [INV]

  <bb 15> :
  # DEBUG BEGIN_STMT
  xBufferSizeBytes_19 = xBufferSizeBytes_11(D) + 1;
  # DEBUG xBufferSizeBytes => xBufferSizeBytes_19
  # DEBUG BEGIN_STMT
  _1 = xBufferSizeBytes_19 + 36;
  pucAllocatedMemory_21 = pvPortMalloc (_1);
  # DEBUG pucAllocatedMemory => pucAllocatedMemory_21
  goto <bb 17>; [INV]

  <bb 16> :
  # DEBUG BEGIN_STMT
  pucAllocatedMemory_18 = 0B;
  # DEBUG pucAllocatedMemory => pucAllocatedMemory_18

  <bb 17> :
  # xBufferSizeBytes_3 = PHI <xBufferSizeBytes_19(15), xBufferSizeBytes_11(D)(16)>
  # pucAllocatedMemory_5 = PHI <pucAllocatedMemory_21(15), pucAllocatedMemory_18(16)>
  # DEBUG pucAllocatedMemory => pucAllocatedMemory_5
  # DEBUG xBufferSizeBytes => xBufferSizeBytes_3
  # DEBUG BEGIN_STMT
  if (pucAllocatedMemory_5 != 0B)
    goto <bb 18>; [INV]
  else
    goto <bb 19>; [INV]

  <bb 18> :
  # DEBUG BEGIN_STMT
  _2 = pucAllocatedMemory_5 + 36;
  prvInitialiseNewStreamBuffer (pucAllocatedMemory_5, _2, xBufferSizeBytes_3, xTriggerLevelBytes_4, ucFlags_6);
  # DEBUG BEGIN_STMT

  <bb 19> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _23 = pucAllocatedMemory_5;
  return _23;

}


__attribute__((always_inline))
vPortSetBASEPRI (uint32_t ulNewMaskValue)
{
  <bb 2> :
  # DEBUG BEGIN_STMT
  __asm__ __volatile__("	msr basepri, %0	" :  : "r" ulNewMaskValue_2(D) : "memory");
  return;

}


__attribute__((always_inline))
ulPortRaiseBASEPRI ()
{
  uint32_t ulNewBASEPRI;
  uint32_t ulOriginalBASEPRI;
  uint32_t _5;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  __asm__ __volatile__("	mrs %0, basepri											
	mov %1, %2												
	msr basepri, %1											
	isb														
	dsb														
" : "=r" ulOriginalBASEPRI_3, "=r" ulNewBASEPRI_4 : "i" 16 : "memory");
  # DEBUG ulNewBASEPRI => ulNewBASEPRI_4
  # DEBUG ulOriginalBASEPRI => ulOriginalBASEPRI_3
  # DEBUG BEGIN_STMT
  _5 = ulOriginalBASEPRI_3;
  return _5;

}


__attribute__((always_inline))
vPortRaiseBASEPRI ()
{
  uint32_t ulNewBASEPRI;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  __asm__ __volatile__("	mov %0, %1												
	msr basepri, %0											
	isb														
	dsb														
" : "=r" ulNewBASEPRI_3 : "i" 16 : "memory");
  # DEBUG ulNewBASEPRI => ulNewBASEPRI_3
  return;

}


