__attribute__((hot))
fifo_peek (const struct fifo_t * const fifo, uint32_t num)
{
  volatile void * ret;
  void * D.7621;

  <bb 2> :
  # DEBUG BEGIN_STMT
  ret = 0B;
  # DEBUG BEGIN_STMT
  _1 = fifo->depth;
  _2 = num < _1;
  _3 = (long int) _2;
  _4 = __builtin_expect (_3, 1);
  if (_4 != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  _5 = fifo->data;
  _6 = num * 4;
  _7 = _5 + _6;
  ret = *_7;

  <bb 4> :
  # DEBUG BEGIN_STMT
  D.7621 = ret;
  return D.7621;

}


__attribute__((cold))
fifo_clear (struct fifo_t * const fifo)
{
  <bb 2> :
  # DEBUG BEGIN_STMT
  if (fifo != 0B)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  fifo->read = 0;
  # DEBUG BEGIN_STMT
  _1 = fifo->depth;
  fifo->write = _1;

  <bb 4> :
  return;

}


__attribute__((cold))
fifo_destroy (struct fifo_t * fifo)
{
  <bb 2> :
  # DEBUG BEGIN_STMT
  memset (fifo, 0, 64);
  return;

}


__attribute__((cold))
fifo_create (const uint32_t depth, struct fifo_t * fifo, void * * data)
{
  struct fifo_t * tmp_fifo;
  struct fifo_t * D.7615;

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

  <bb 3> :
  _1 = depth + 4294967295;
  _2 = depth & _1;
  if (_2 != 0)
    goto <bb 5>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 4> :
  depth.1_3 = (signed int) depth;
  if (depth.1_3 < 0)
    goto <bb 5>; [INV]
  else
    goto <bb 6>; [INV]

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

  <bb 6> :
  # DEBUG BEGIN_STMT
  tmp_fifo->read = 0;
  # DEBUG BEGIN_STMT
  tmp_fifo->write = 0;
  # DEBUG BEGIN_STMT
  tmp_fifo->depth = depth;
  # DEBUG BEGIN_STMT
  _4 = depth + 4294967295;
  tmp_fifo->depth_mask = _4;
  # DEBUG BEGIN_STMT
  tmp_fifo->data = data;
  # DEBUG BEGIN_STMT
  _5 = tmp_fifo->data;
  _6 = _5 == 0B;
  _7 = (long int) _6;
  _8 = __builtin_expect (_7, 0);
  if (_8 != 0)
    goto <bb 7>; [INV]
  else
    goto <bb 8>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  tmp_fifo = 0B;

  <bb 8> :
  # DEBUG BEGIN_STMT
  D.7615 = tmp_fifo;
  return D.7615;

}


__attribute__((hot))
fifo_get_free_space (const struct fifo_t * const fifo, uint32_t * free_space)
{
  errno_t err;
  uint32_t ret;
  errno_t D.7605;

  <bb 2> :
  # DEBUG BEGIN_STMT
  ret = 0;
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  err = fifo_get_fill_level (fifo, &ret);
  # DEBUG BEGIN_STMT
  _1 = fifo->depth;
  ret.0_2 = ret;
  _3 = _1 - ret.0_2;
  *free_space = _3;
  # DEBUG BEGIN_STMT
  D.7605 = err;
  ret = {CLOBBER};
  return D.7605;

}


__attribute__((hot))
fifo_get_fill_level (const struct fifo_t * const fifo, uint32_t * fill_level)
{
  errno_t ret;
  errno_t D.7603;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _1 = fifo->write;
  _2 = fifo->read;
  _3 = _1 - _2;
  *fill_level = _3;
  # DEBUG BEGIN_STMT
  ret = 0;
  # DEBUG BEGIN_STMT
  D.7603 = ret;
  return D.7603;

}


