pfe_emac_irq_unmask (struct pfe_emac_t * emac)
{
  <bb 2> :
  # DEBUG BEGIN_STMT
  return;

}


pfe_emac_irq_mask (struct pfe_emac_t * emac)
{
  <bb 2> :
  # DEBUG BEGIN_STMT
  return;

}


pfe_emac_isr (struct pfe_emac_t * emac)
{
  errno_t ret;
  errno_t D.11214;

  <bb 2> :
  # DEBUG BEGIN_STMT
  ret = 0;
  # DEBUG BEGIN_STMT
  _1 = &emac->mutex;
  oal_mutex_lock (_1);
  # DEBUG BEGIN_STMT
  _2 = emac->emac_base_va;
  _3 = emac->cbus_base_va;
  ret = pfe_emac_cfg_isr (_2, _3);
  # DEBUG BEGIN_STMT
  _4 = &emac->mutex;
  oal_mutex_unlock (_4);
  # DEBUG BEGIN_STMT
  D.11214 = ret;
  return D.11214;

}


pfe_emac_get_stat_value (const struct pfe_emac_t * emac, uint32_t stat_id)
{
  uint32_t stat_value;
  uint32_t D.11212;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _1 = emac->emac_base_va;
  stat_value = pfe_emac_cfg_get_stat_value (_1, stat_id);
  # DEBUG BEGIN_STMT
  D.11212 = stat_value;
  return D.11212;

}


pfe_emac_get_tx_cnt (const struct pfe_emac_t * emac)
{
  uint32_t tx_cnt;
  uint32_t D.11210;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _1 = emac->emac_base_va;
  tx_cnt = pfe_emac_cfg_get_tx_cnt (_1);
  # DEBUG BEGIN_STMT
  D.11210 = tx_cnt;
  return D.11210;

}


pfe_emac_get_rx_cnt (const struct pfe_emac_t * emac)
{
  uint32_t rx_cnt;
  uint32_t D.11208;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _1 = emac->emac_base_va;
  rx_cnt = pfe_emac_cfg_get_rx_cnt (_1);
  # DEBUG BEGIN_STMT
  D.11208 = rx_cnt;
  return D.11208;

}


pfe_emac_mdio_write45 (struct pfe_emac_t * emac, uint8_t pa, uint8_t dev, uint16_t ra, uint16_t val, uint32_t key)
{
  errno_t ret;
  errno_t D.11206;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _1 = &emac->mutex;
  oal_mutex_lock (_1);
  # DEBUG BEGIN_STMT
  _2 = emac->mdio_locked;
  if (_2 == 1)
    goto <bb 3>; [INV]
  else
    goto <bb 6>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  _3 = emac->mdio_key;
  if (key == _3)
    goto <bb 4>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  _4 = emac->emac_base_va;
  ret = pfe_emac_cfg_mdio_write45 (_4, pa, dev, ra, val);
  goto <bb 7>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  ret = 115;
  goto <bb 7>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  _5 = emac->emac_base_va;
  ret = pfe_emac_cfg_mdio_write45 (_5, pa, dev, ra, val);

  <bb 7> :
  # DEBUG BEGIN_STMT
  _6 = &emac->mutex;
  oal_mutex_unlock (_6);
  # DEBUG BEGIN_STMT
  D.11206 = ret;
  return D.11206;

}


pfe_emac_mdio_read45 (struct pfe_emac_t * emac, uint8_t pa, uint8_t dev, uint16_t ra, uint16_t * val, uint32_t key)
{
  errno_t ret;
  errno_t D.11198;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _1 = &emac->mutex;
  oal_mutex_lock (_1);
  # DEBUG BEGIN_STMT
  _2 = emac->mdio_locked;
  if (_2 == 1)
    goto <bb 3>; [INV]
  else
    goto <bb 6>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  _3 = emac->mdio_key;
  if (key == _3)
    goto <bb 4>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  _4 = emac->emac_base_va;
  ret = pfe_emac_cfg_mdio_read45 (_4, pa, dev, ra, val);
  goto <bb 7>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  ret = 115;
  goto <bb 7>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  _5 = emac->emac_base_va;
  ret = pfe_emac_cfg_mdio_read45 (_5, pa, dev, ra, val);

  <bb 7> :
  # DEBUG BEGIN_STMT
  _6 = &emac->mutex;
  oal_mutex_unlock (_6);
  # DEBUG BEGIN_STMT
  D.11198 = ret;
  return D.11198;

}


pfe_emac_mdio_write22 (struct pfe_emac_t * emac, uint8_t pa, uint8_t ra, uint16_t val, uint32_t key)
{
  errno_t ret;
  errno_t D.11190;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _1 = &emac->mutex;
  oal_mutex_lock (_1);
  # DEBUG BEGIN_STMT
  _2 = emac->mdio_locked;
  if (_2 == 1)
    goto <bb 3>; [INV]
  else
    goto <bb 6>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  _3 = emac->mdio_key;
  if (key == _3)
    goto <bb 4>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  _4 = emac->emac_base_va;
  ret = pfe_emac_cfg_mdio_write22 (_4, pa, ra, val);
  goto <bb 7>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  ret = 115;
  goto <bb 7>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  _5 = emac->emac_base_va;
  ret = pfe_emac_cfg_mdio_write22 (_5, pa, ra, val);

  <bb 7> :
  # DEBUG BEGIN_STMT
  _6 = &emac->mutex;
  oal_mutex_unlock (_6);
  # DEBUG BEGIN_STMT
  D.11190 = ret;
  return D.11190;

}


pfe_emac_mdio_read22 (struct pfe_emac_t * emac, uint8_t pa, uint8_t ra, uint16_t * val, uint32_t key)
{
  errno_t ret;
  errno_t D.11182;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _1 = &emac->mutex;
  oal_mutex_lock (_1);
  # DEBUG BEGIN_STMT
  _2 = emac->mdio_locked;
  if (_2 == 1)
    goto <bb 3>; [INV]
  else
    goto <bb 6>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  _3 = emac->mdio_key;
  if (key == _3)
    goto <bb 4>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  _4 = emac->emac_base_va;
  ret = pfe_emac_cfg_mdio_read22 (_4, pa, ra, val);
  goto <bb 7>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  ret = 115;
  goto <bb 7>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  _5 = emac->emac_base_va;
  ret = pfe_emac_cfg_mdio_read22 (_5, pa, ra, val);

  <bb 7> :
  # DEBUG BEGIN_STMT
  _6 = &emac->mutex;
  oal_mutex_unlock (_6);
  # DEBUG BEGIN_STMT
  D.11182 = ret;
  return D.11182;

}


pfe_emac_mdio_unlock (struct pfe_emac_t * emac, uint32_t key)
{
  errno_t ret;
  errno_t D.11174;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _1 = &emac->mutex;
  oal_mutex_lock (_1);
  # DEBUG BEGIN_STMT
  _2 = emac->mdio_locked;
  if (_2 == 1)
    goto <bb 3>; [INV]
  else
    goto <bb 6>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  _3 = emac->mdio_key;
  if (key == _3)
    goto <bb 4>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  emac->mdio_locked = 0;
  # DEBUG BEGIN_STMT
  ret = 0;
  goto <bb 7>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  ret = 115;
  goto <bb 7>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  ret = 120;

  <bb 7> :
  # DEBUG BEGIN_STMT
  _4 = &emac->mutex;
  oal_mutex_unlock (_4);
  # DEBUG BEGIN_STMT
  D.11174 = ret;
  return D.11174;

}


pfe_emac_mdio_lock (struct pfe_emac_t * emac, uint32_t * key)
{
  errno_t ret;
  errno_t D.11166;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _1 = &emac->mutex;
  oal_mutex_lock (_1);
  # DEBUG BEGIN_STMT
  _2 = emac->mdio_locked;
  if (_2 == 1)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  ret = 115;
  goto <bb 5>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  emac->mdio_locked = 1;
  # DEBUG BEGIN_STMT
  key_seed.3_3 = key_seed;
  emac->mdio_key = key_seed.3_3;
  # DEBUG BEGIN_STMT
  key_seed.4_4 = key_seed;
  _5 = key_seed.4_4 + 1;
  key_seed = _5;
  # DEBUG BEGIN_STMT
  _6 = emac->mdio_key;
  *key = _6;
  # DEBUG BEGIN_STMT
  ret = 0;

  <bb 5> :
  # DEBUG BEGIN_STMT
  _7 = &emac->mutex;
  oal_mutex_unlock (_7);
  # DEBUG BEGIN_STMT
  D.11166 = ret;
  return D.11166;

}


pfe_emac_destroy (struct pfe_emac_t * emac)
{
  const struct pfe_mac_addr_db_entry_t * entry;
  struct LLIST_t * tmp_item;
  struct LLIST_t * curItem;
  uint8_t zero_addr[6];

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  memset (&zero_addr, 0, 6);
  # DEBUG BEGIN_STMT
  if (emac != 0B)
    goto <bb 3>; [INV]
  else
    goto <bb 7>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  _1 = &emac->mutex;
  oal_mutex_lock (_1);
  # DEBUG BEGIN_STMT
  curItem = emac->mac_addr_list.prNext;
  tmp_item = curItem->prNext;
  goto <bb 5>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  _2 = curItem - 14B;
  entry = (const struct pfe_mac_addr_db_entry_t *) _2;
  # DEBUG BEGIN_STMT
  _3 = &entry->addr;
  _4 = entry->owner;
  _5 = pfe_emac_del_addr_nolock (emac, _3, _4);
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  curItem = tmp_item;
  tmp_item = tmp_item->prNext;

  <bb 5> :
  # DEBUG BEGIN_STMT
  _6 = &emac->mac_addr_list;
  if (curItem != _6)
    goto <bb 4>; [INV]
  else
    goto <bb 6>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  pfe_emac_disable (emac);
  # DEBUG BEGIN_STMT
  _7 = emac->emac_base_va;
  pfe_emac_cfg_disable_ts (_7);
  # DEBUG BEGIN_STMT
  pfe_emac_addr_db_drop_all (emac);
  # DEBUG BEGIN_STMT
  _8 = &emac->mutex;
  oal_mutex_unlock (_8);
  # DEBUG BEGIN_STMT
  _9 = &emac->mutex;
  oal_mutex_destroy (_9);
  # DEBUG BEGIN_STMT
  _10 = &emac->ts_mutex;
  oal_mutex_destroy (_10);

  <bb 7> :
  zero_addr = {CLOBBER};
  return;

}


pfe_emac_get_addr (struct pfe_emac_t * emac, uint8_t * addr)
{
  errno_t ret;
  const struct pfe_mac_addr_db_entry_t * entry;
  errno_t D.11144;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  ret = 0;
  # DEBUG BEGIN_STMT
  _1 = &emac->mutex;
  oal_mutex_lock (_1);
  # DEBUG BEGIN_STMT
  entry = pfe_emac_addr_db_find_by_slot (emac, 0);
  # DEBUG BEGIN_STMT
  if (entry == 0B)
    goto <bb 3>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  entry = pfe_emac_addr_db_get_first (emac);
  # DEBUG BEGIN_STMT
  if (entry == 0B)
    goto <bb 4>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  ret = 2;

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

  <bb 6> :
  # DEBUG BEGIN_STMT
  _2 = &entry->addr;
  memcpy (addr, _2, 6);

  <bb 7> :
  # DEBUG BEGIN_STMT
  _3 = &emac->mutex;
  oal_mutex_unlock (_3);
  # DEBUG BEGIN_STMT
  D.11144 = ret;
  return D.11144;

}


pfe_emac_add_addr (struct pfe_emac_t * emac, const uint8_t * addr, pfe_drv_id_t owner)
{
  int32_t hash;
  const struct pfe_mac_addr_db_entry_t * entry;
  errno_t ret;
  uint32_t slot;
  errno_t D.11128;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _1 = &emac->mutex;
  oal_mutex_lock (_1);
  # DEBUG BEGIN_STMT
  entry = pfe_emac_addr_db_find_by_addr (emac, addr, owner);
  # DEBUG BEGIN_STMT
  if (entry != 0B)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  ret = 116;
  goto <bb 15>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  slot = 0;
  goto <bb 7>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  _2 = emac->mac_addr_slots;
  _3 = (unsigned int) _2;
  _4 = _3 >> slot;
  _5 = _4 & 1;
  if (_5 == 0)
    goto <bb 8>; [INV]
  else
    goto <bb 6>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  slot = slot + 1;

  <bb 7> :
  # DEBUG BEGIN_STMT
  if (slot <= 7)
    goto <bb 5>; [INV]
  else
    goto <bb 8>; [INV]

  <bb 8> :
  # DEBUG BEGIN_STMT
  if (slot == 8)
    goto <bb 9>; [INV]
  else
    goto <bb 13>; [INV]

  <bb 9> :
  # DEBUG BEGIN_STMT
  _6 = pfe_emac_is_broad (addr);
  if (_6 != 0)
    goto <bb 10>; [INV]
  else
    goto <bb 11>; [INV]

  <bb 10> :
  # DEBUG BEGIN_STMT
  ret = 22;
  goto <bb 15>; [INV]

  <bb 11> :
  # DEBUG BEGIN_STMT
  _7 = emac->emac_base_va;
  _8 = pfe_emac_cfg_get_hash (_7, addr);
  hash = (int32_t) _8;
  # DEBUG BEGIN_STMT
  hash.1_9 = (long unsigned int) hash;
  ret = pfe_emac_addr_db_add (emac, addr, 1, hash.1_9, owner);
  # DEBUG BEGIN_STMT
  if (ret == 0)
    goto <bb 12>; [INV]
  else
    goto <bb 15>; [INV]

  <bb 12> :
  # DEBUG BEGIN_STMT
  _10 = emac->emac_base_va;
  hash.2_11 = (long unsigned int) hash;
  pfe_emac_cfg_set_hash_group (_10, hash.2_11, 1);
  goto <bb 15>; [INV]

  <bb 13> :
  # DEBUG BEGIN_STMT
  ret = pfe_emac_addr_db_add (emac, addr, 0, slot, owner);
  # DEBUG BEGIN_STMT
  if (ret == 0)
    goto <bb 14>; [INV]
  else
    goto <bb 15>; [INV]

  <bb 14> :
  # DEBUG BEGIN_STMT
  _12 = emac->mac_addr_slots;
  _13 = 1 << slot;
  _14 = (unsigned char) _13;
  _15 = _12 | _14;
  emac->mac_addr_slots = _15;
  # DEBUG BEGIN_STMT
  _16 = emac->emac_base_va;
  _17 = (unsigned char) slot;
  pfe_emac_cfg_write_addr_slot (_16, addr, _17);

  <bb 15> :
  # DEBUG BEGIN_STMT
  _18 = &emac->mutex;
  oal_mutex_unlock (_18);
  # DEBUG BEGIN_STMT
  D.11128 = ret;
  return D.11128;

}


pfe_emac_del_addr_nolock (struct pfe_emac_t * emac, const uint8_t * addr, pfe_drv_id_t owner)
{
  uint8_t zero_addr[6];
  errno_t ret;
  struct pfe_mac_addr_db_entry_t local_entry;
  struct pfe_mac_addr_db_entry_t * entry;
  errno_t D.11093;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  entry = pfe_emac_addr_db_find_by_addr (emac, addr, owner);
  # DEBUG BEGIN_STMT
  if (entry == 0B)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  ret = 2;
  goto <bb 9>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  local_entry = *entry;
  # DEBUG BEGIN_STMT
  ret = pfe_emac_addr_db_del_entry (emac, entry);
  # DEBUG BEGIN_STMT
  if (ret == 0)
    goto <bb 5>; [INV]
  else
    goto <bb 9>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  oal_mm_free (entry);
  # DEBUG BEGIN_STMT
  entry = 0B;
  # DEBUG BEGIN_STMT
  _1 = local_entry.in_hash_grp;
  if (_1 == 1)
    goto <bb 6>; [INV]
  else
    goto <bb 8>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  _2 = local_entry.hash;
  _3 = pfe_emac_addr_db_find_by_hash (emac, _2);
  if (_3 != 0B)
    goto <bb 9>; [INV]
  else
    goto <bb 7>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  _4 = emac->emac_base_va;
  _5 = local_entry.hash;
  pfe_emac_cfg_set_hash_group (_4, _5, 0);
  goto <bb 9>; [INV]

  <bb 8> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  memset (&zero_addr, 0, 6);
  # DEBUG BEGIN_STMT
  _6 = emac->emac_base_va;
  _7 = local_entry.addr_slot_idx;
  pfe_emac_cfg_write_addr_slot (_6, &zero_addr, _7);
  # DEBUG BEGIN_STMT
  _8 = emac->mac_addr_slots;
  _9 = local_entry.addr_slot_idx;
  _10 = (int) _9;
  _11 = 1 << _10;
  _12 = (unsigned char) _11;
  _13 = ~_12;
  _14 = _8 & _13;
  emac->mac_addr_slots = _14;
  zero_addr = {CLOBBER};

  <bb 9> :
  # DEBUG BEGIN_STMT
  D.11093 = ret;
  local_entry = {CLOBBER};
  return D.11093;

}


pfe_emac_del_addr (struct pfe_emac_t * emac, const uint8_t * addr, pfe_drv_id_t owner)
{
  errno_t ret;
  errno_t D.11112;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _1 = &emac->mutex;
  oal_mutex_lock (_1);
  # DEBUG BEGIN_STMT
  ret = pfe_emac_del_addr_nolock (emac, addr, owner);
  # DEBUG BEGIN_STMT
  _2 = &emac->mutex;
  oal_mutex_unlock (_2);
  # DEBUG BEGIN_STMT
  D.11112 = ret;
  return D.11112;

}


pfe_emac_flush_mac_addrs (struct pfe_emac_t * emac, pfe_emac_crit_t crit, pfe_mac_type_t type, pfe_drv_id_t owner)
{
  uint8_t addr[6];
  errno_t ret;
  struct LLIST_t * tmp_item;
  struct LLIST_t * item;
  const struct pfe_mac_addr_db_entry_t * entry;
  errno_t D.11042;

  <bb 2> :
  # DEBUG BEGIN_STMT
  entry = 0B;
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  ret = 0;
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _1 = &emac->mutex;
  oal_mutex_lock (_1);
  # DEBUG BEGIN_STMT
  item = emac->mac_addr_list.prNext;
  tmp_item = item->prNext;
  goto <bb 8>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  _2 = item - 14B;
  entry = (const struct pfe_mac_addr_db_entry_t *) _2;
  # DEBUG BEGIN_STMT
  if (entry != 0B)
    goto <bb 4>; [INV]
  else
    goto <bb 7>; [INV]

  <bb 4> :
  _3 = entry->owner;
  if (owner == _3)
    goto <bb 5>; [INV]
  else
    goto <bb 7>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  _4 = &entry->addr;
  MEM[(char * {ref-all})&addr] = MEM[(char * {ref-all})_4];
  # DEBUG BEGIN_STMT
  _5 = pfe_emac_flush_criterion_eval (entry, crit, type, owner);
  if (_5 == 1)
    goto <bb 6>; [INV]
  else
    goto <bb 7>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  _6 = &entry->addr;
  _7 = entry->owner;
  ret = pfe_emac_del_addr_nolock (emac, _6, _7);
  # DEBUG BEGIN_STMT
  if (ret != 0)
    goto <bb 9>; [INV]
  else
    goto <bb 7>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  item = tmp_item;
  tmp_item = tmp_item->prNext;

  <bb 8> :
  # DEBUG BEGIN_STMT
  _8 = &emac->mac_addr_list;
  if (item != _8)
    goto <bb 3>; [INV]
  else
    goto <bb 9>; [INV]

  <bb 9> :
  # DEBUG BEGIN_STMT
  _9 = &emac->mutex;
  oal_mutex_unlock (_9);
  # DEBUG BEGIN_STMT
  D.11042 = ret;
  addr = {CLOBBER};
  return D.11042;

}


pfe_emac_set_link_duplex (const struct pfe_emac_t * emac, pfe_emac_duplex_t duplex)
{
  errno_t ret;
  errno_t D.11032;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _1 = emac->emac_base_va;
  ret = pfe_emac_cfg_set_duplex (_1, duplex);
  # DEBUG BEGIN_STMT
  D.11032 = ret;
  return D.11032;

}


pfe_emac_set_link_speed (const struct pfe_emac_t * emac, pfe_emac_speed_t link_speed)
{
  errno_t ret;
  errno_t D.11030;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _1 = emac->emac_base_va;
  ret = pfe_emac_cfg_set_speed (_1, link_speed);
  # DEBUG BEGIN_STMT
  D.11030 = ret;
  return D.11030;

}


pfe_emac_get_link_status (const struct pfe_emac_t * emac, pfe_emac_link_speed_t * link_speed, pfe_emac_duplex_t * duplex, bool_t * link)
{
  errno_t ret;
  errno_t D.11028;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _1 = emac->emac_base_va;
  ret = pfe_emac_cfg_get_link_status (_1, link_speed, duplex, link);
  # DEBUG BEGIN_STMT
  D.11028 = ret;
  return D.11028;

}


pfe_emac_get_link_config (const struct pfe_emac_t * emac, pfe_emac_speed_t * speed, pfe_emac_duplex_t * duplex)
{
  errno_t ret;
  errno_t D.11026;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _1 = emac->emac_base_va;
  ret = pfe_emac_cfg_get_link_config (_1, speed, duplex);
  # DEBUG BEGIN_STMT
  D.11026 = ret;
  return D.11026;

}


pfe_emac_get_mii_mode (const struct pfe_emac_t * emac)
{
  pfe_emac_mii_mode_t mii_mode;
  pfe_emac_mii_mode_t D.11024;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  mii_mode = emac->mode;
  # DEBUG BEGIN_STMT
  D.11024 = mii_mode;
  return D.11024;

}


pfe_emac_set_max_frame_length (const struct pfe_emac_t * emac, uint32_t len)
{
  errno_t ret;
  errno_t D.11022;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _1 = emac->emac_base_va;
  ret = pfe_emac_cfg_set_max_frame_length (_1, len);
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  D.11022 = ret;
  return D.11022;

}


pfe_emac_disable_rx_flow_control (const struct pfe_emac_t * emac)
{
  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = emac->emac_base_va;
  pfe_emac_cfg_set_rx_flow_control (_1, 0);
  return;

}


pfe_emac_enable_rx_flow_control (const struct pfe_emac_t * emac)
{
  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = emac->emac_base_va;
  pfe_emac_cfg_set_rx_flow_control (_1, 1);
  return;

}


pfe_emac_disable_tx_flow_control (const struct pfe_emac_t * emac)
{
  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = emac->emac_base_va;
  pfe_emac_cfg_set_tx_flow_control (_1, 0);
  return;

}


pfe_emac_enable_tx_flow_control (const struct pfe_emac_t * emac)
{
  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = emac->emac_base_va;
  pfe_emac_cfg_set_tx_flow_control (_1, 1);
  return;

}


pfe_emac_get_flow_control (const struct pfe_emac_t * emac, bool_t * tx_enable, bool_t * rx_enable)
{
  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = emac->emac_base_va;
  pfe_emac_cfg_get_tx_flow_control (_1, tx_enable);
  # DEBUG BEGIN_STMT
  _2 = emac->emac_base_va;
  pfe_emac_cfg_get_rx_flow_control (_2, rx_enable);
  return;

}


pfe_emac_disable_broadcast (const struct pfe_emac_t * emac)
{
  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = emac->emac_base_va;
  pfe_emac_cfg_set_broadcast (_1, 0);
  return;

}


pfe_emac_enable_broadcast (const struct pfe_emac_t * emac)
{
  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = emac->emac_base_va;
  pfe_emac_cfg_set_broadcast (_1, 1);
  return;

}


pfe_emac_disable_allmulti_mode (const struct pfe_emac_t * emac)
{
  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = emac->emac_base_va;
  pfe_emac_cfg_set_allmulti_mode (_1, 0);
  return;

}


pfe_emac_enable_allmulti_mode (const struct pfe_emac_t * emac)
{
  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = emac->emac_base_va;
  pfe_emac_cfg_set_allmulti_mode (_1, 1);
  return;

}


pfe_emac_disable_promisc_mode (const struct pfe_emac_t * emac)
{
  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = emac->emac_base_va;
  pfe_emac_cfg_set_promisc_mode (_1, 0);
  return;

}


pfe_emac_enable_promisc_mode (const struct pfe_emac_t * emac)
{
  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = emac->emac_base_va;
  pfe_emac_cfg_set_promisc_mode (_1, 1);
  return;

}


pfe_emac_disable_loopback (const struct pfe_emac_t * emac)
{
  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = emac->emac_base_va;
  pfe_emac_cfg_set_loopback (_1, 0);
  return;

}


pfe_emac_enable_loopback (const struct pfe_emac_t * emac)
{
  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = emac->emac_base_va;
  pfe_emac_cfg_set_loopback (_1, 1);
  return;

}


pfe_emac_set_ts_time (struct pfe_emac_t * emac, uint32_t sec, uint32_t nsec, uint16_t sec_hi)
{
  errno_t ret;
  errno_t D.11018;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _1 = &emac->ts_mutex;
  oal_mutex_lock (_1);
  # DEBUG BEGIN_STMT
  _2 = emac->emac_base_va;
  ret = pfe_emac_cfg_set_ts_time (_2, sec, nsec, sec_hi);
  # DEBUG BEGIN_STMT
  _3 = &emac->ts_mutex;
  oal_mutex_unlock (_3);
  # DEBUG BEGIN_STMT
  D.11018 = ret;
  return D.11018;

}


pfe_emac_adjust_ts_time (struct pfe_emac_t * emac, uint32_t sec, uint32_t nsec, bool_t sgn)
{
  errno_t ret;
  errno_t D.11016;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _1 = &emac->ts_mutex;
  oal_mutex_lock (_1);
  # DEBUG BEGIN_STMT
  _2 = emac->emac_base_va;
  ret = pfe_emac_cfg_adjust_ts_time (_2, sec, nsec, sgn);
  # DEBUG BEGIN_STMT
  _3 = &emac->ts_mutex;
  oal_mutex_unlock (_3);
  # DEBUG BEGIN_STMT
  D.11016 = ret;
  return D.11016;

}


pfe_emac_get_ts_time (struct pfe_emac_t * emac, uint32_t * sec, uint32_t * nsec, uint16_t * sec_hi)
{
  errno_t ret;
  errno_t D.11014;

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

  <bb 3> :
  if (nsec == 0B)
    goto <bb 5>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 4> :
  if (sec_hi == 0B)
    goto <bb 5>; [INV]
  else
    goto <bb 6>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  ret = 22;
  goto <bb 7>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  _1 = &emac->ts_mutex;
  oal_mutex_lock (_1);
  # DEBUG BEGIN_STMT
  _2 = emac->emac_base_va;
  pfe_emac_cfg_get_ts_time (_2, sec, nsec, sec_hi);
  # DEBUG BEGIN_STMT
  _3 = &emac->ts_mutex;
  oal_mutex_unlock (_3);
  # DEBUG BEGIN_STMT
  ret = 0;

  <bb 7> :
  # DEBUG BEGIN_STMT
  D.11014 = ret;
  return D.11014;

}


pfe_emac_get_ts_freq_adjustment (struct pfe_emac_t * emac, uint32_t * ppb, bool_t * sgn)
{
  errno_t ret;
  errno_t D.11007;

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

  <bb 3> :
  if (sgn == 0B)
    goto <bb 4>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  ret = 22;
  goto <bb 6>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  _1 = &emac->ts_mutex;
  oal_mutex_lock (_1);
  # DEBUG BEGIN_STMT
  _2 = emac->adj_ppb;
  *ppb = _2;
  # DEBUG BEGIN_STMT
  _3 = emac->adj_sign;
  *sgn = _3;
  # DEBUG BEGIN_STMT
  _4 = &emac->ts_mutex;
  oal_mutex_unlock (_4);
  # DEBUG BEGIN_STMT
  ret = 0;

  <bb 6> :
  # DEBUG BEGIN_STMT
  D.11007 = ret;
  return D.11007;

}


pfe_emac_set_ts_freq_adjustment (struct pfe_emac_t * emac, uint32_t ppb, bool_t sgn)
{
  errno_t ret;
  errno_t D.11001;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _1 = &emac->ts_mutex;
  oal_mutex_lock (_1);
  # DEBUG BEGIN_STMT
  emac->adj_ppb = ppb;
  # DEBUG BEGIN_STMT
  emac->adj_sign = sgn;
  # DEBUG BEGIN_STMT
  _2 = emac->emac_base_va;
  _3 = emac->i_clk_hz;
  _4 = emac->o_clk_hz;
  ret = pfe_emac_cfg_adjust_ts_freq (_2, _3, _4, ppb, sgn);
  # DEBUG BEGIN_STMT
  _5 = &emac->ts_mutex;
  oal_mutex_unlock (_5);
  # DEBUG BEGIN_STMT
  D.11001 = ret;
  return D.11001;

}


pfe_emac_enable_ts (struct pfe_emac_t * emac, uint32_t i_clk_hz, uint32_t o_clk_hz)
{
  bool_t eclk;
  errno_t ret;
  errno_t D.10999;
  int iftmp.0;

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

  <bb 3> :
  if (o_clk_hz == 0)
    goto <bb 4>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 4> :
  iftmp.0 = 1;
  goto <bb 6>; [INV]

  <bb 5> :
  iftmp.0 = 0;

  <bb 6> :
  eclk = (bool_t) iftmp.0;
  # DEBUG BEGIN_STMT
  if (eclk == 0)
    goto <bb 7>; [INV]
  else
    goto <bb 9>; [INV]

  <bb 7> :
  if (i_clk_hz <= o_clk_hz)
    goto <bb 8>; [INV]
  else
    goto <bb 9>; [INV]

  <bb 8> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  ret = 22;
  goto <bb 10>; [INV]

  <bb 9> :
  # DEBUG BEGIN_STMT
  emac->i_clk_hz = i_clk_hz;
  # DEBUG BEGIN_STMT
  emac->o_clk_hz = o_clk_hz;
  # DEBUG BEGIN_STMT
  _1 = &emac->ts_mutex;
  oal_mutex_lock (_1);
  # DEBUG BEGIN_STMT
  _2 = emac->emac_base_va;
  ret = pfe_emac_cfg_enable_ts (_2, eclk, i_clk_hz, o_clk_hz);
  # DEBUG BEGIN_STMT
  _3 = &emac->ts_mutex;
  oal_mutex_unlock (_3);

  <bb 10> :
  # DEBUG BEGIN_STMT
  D.10999 = ret;
  return D.10999;

}


pfe_emac_disable (const struct pfe_emac_t * emac)
{
  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = emac->emac_base_va;
  pfe_emac_cfg_set_enable (_1, 0);
  return;

}


pfe_emac_enable (const struct pfe_emac_t * emac)
{
  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = emac->emac_base_va;
  pfe_emac_cfg_set_enable (_1, 1);
  return;

}


pfe_emac_get_gpi (const struct pfe_emac_t * emac)
{
  struct pfe_gpi_t * D.10988;

  <bb 2> :
  # DEBUG BEGIN_STMT
  D.10988 = emac->gpi;
  return D.10988;

}


pfe_emac_bind_gpi (struct pfe_emac_t * emac, struct pfe_gpi_t * gpi)
{
  errno_t ret;
  errno_t D.10986;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  emac->gpi = gpi;
  # DEBUG BEGIN_STMT
  ret = 0;
  # DEBUG BEGIN_STMT
  D.10986 = ret;
  return D.10986;

}


pfe_emac_get_index (const struct pfe_emac_t * emac)
{
  uint8_t emac_idx;
  uint8_t D.10984;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _1 = emac->emac_base_va;
  _2 = emac->cbus_base_va;
  emac_idx = pfe_emac_cfg_get_index (_1, _2);
  # DEBUG BEGIN_STMT
  D.10984 = emac_idx;
  return D.10984;

}


pfe_emac_create (addr_t cbus_base_va, addr_t emac_base, pfe_emac_mii_mode_t mode, pfe_emac_speed_t speed, pfe_emac_duplex_t duplex, uint32_t emac_index)
{
  struct pfe_emac_t * emac;
  struct pfe_emac_t * D.10968;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _1 = emac_index > 2;
  _2 = (long int) _1;
  _3 = __builtin_expect (_2, 0);
  if (_3 != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  emac = 0B;
  goto <bb 12>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  emac = &emac_instance[emac_index];
  # DEBUG BEGIN_STMT
  memset (emac, 0, 56);
  # DEBUG BEGIN_STMT
  emac->cbus_base_va = cbus_base_va;
  # DEBUG BEGIN_STMT
  emac->emac_base_offset = emac_base;
  # DEBUG BEGIN_STMT
  _4 = emac->cbus_base_va;
  _5 = emac->emac_base_offset;
  _6 = _4 + _5;
  emac->emac_base_va = _6;
  # DEBUG BEGIN_STMT
  emac->mode = 0;
  # DEBUG BEGIN_STMT
  emac->speed = 0;
  # DEBUG BEGIN_STMT
  emac->duplex = 0;
  # DEBUG BEGIN_STMT
  if (emac_base == 655360)
    goto <bb 5>; [INV]
  else
    goto <bb 6>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  emac->mutex = 161;
  # DEBUG BEGIN_STMT
  emac->ts_mutex = 164;
  goto <bb 9>; [INV]

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

  <bb 7> :
  # DEBUG BEGIN_STMT
  emac->mutex = 162;
  # DEBUG BEGIN_STMT
  emac->ts_mutex = 165;
  goto <bb 9>; [INV]

  <bb 8> :
  # DEBUG BEGIN_STMT
  emac->mutex = 163;
  # DEBUG BEGIN_STMT
  emac->ts_mutex = 166;

  <bb 9> :
  # DEBUG BEGIN_STMT
  _7 = &emac->mutex;
  oal_mutex_init (_7);
  # DEBUG BEGIN_STMT
  _8 = &emac->ts_mutex;
  oal_mutex_init (_8);
  # DEBUG BEGIN_STMT
  _9 = &emac->mutex;
  oal_mutex_lock (_9);
  # DEBUG BEGIN_STMT
  emac->mac_addr_slots = 0;
  # DEBUG BEGIN_STMT
  pfe_emac_addr_db_init (emac);
  # DEBUG BEGIN_STMT
  pfe_emac_disable (emac);
  # DEBUG BEGIN_STMT
  _10 = emac->emac_base_va;
  _11 = pfe_emac_cfg_init (_10, mode, speed, duplex);
  if (_11 != 0)
    goto <bb 10>; [INV]
  else
    goto <bb 11>; [INV]

  <bb 10> :
  # DEBUG BEGIN_STMT
  _12 = &emac->mutex;
  oal_mutex_unlock (_12);
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  emac = 0B;
  goto <bb 12>; [INV]

  <bb 11> :
  # DEBUG BEGIN_STMT
  emac->mode = mode;
  # DEBUG BEGIN_STMT
  emac->speed = speed;
  # DEBUG BEGIN_STMT
  emac->duplex = duplex;
  # DEBUG BEGIN_STMT
  pfe_emac_disable_loopback (emac);
  # DEBUG BEGIN_STMT
  pfe_emac_disable_promisc_mode (emac);
  # DEBUG BEGIN_STMT
  pfe_emac_disable_broadcast (emac);
  # DEBUG BEGIN_STMT
  _13 = &emac->mutex;
  oal_mutex_unlock (_13);

  <bb 12> :
  # DEBUG BEGIN_STMT
  D.10968 = emac;
  return D.10968;

}


pfe_emac_addr_db_find_by_slot (const struct pfe_emac_t * emac, uint8_t slot)
{
  struct LLIST_t * curItem;
  bool_t match;
  struct pfe_mac_addr_db_entry_t * entry;
  struct pfe_mac_addr_db_entry_t * D.11150;

  <bb 2> :
  # DEBUG BEGIN_STMT
  entry = 0B;
  # DEBUG BEGIN_STMT
  match = 0;
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  curItem = emac->mac_addr_list.prNext;
  goto <bb 6>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  _1 = curItem - 14B;
  entry = (struct pfe_mac_addr_db_entry_t *) _1;
  # DEBUG BEGIN_STMT
  _2 = entry->addr_slot_idx;
  if (slot == _2)
    goto <bb 4>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  match = 1;
  # DEBUG BEGIN_STMT
  goto <bb 7>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  curItem = curItem->prNext;

  <bb 6> :
  # DEBUG BEGIN_STMT
  _3 = &emac->mac_addr_list;
  if (curItem != _3)
    goto <bb 3>; [INV]
  else
    goto <bb 7>; [INV]

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

  <bb 8> :
  # DEBUG BEGIN_STMT
  entry = 0B;

  <bb 9> :
  # DEBUG BEGIN_STMT
  D.11150 = entry;
  return D.11150;

}


pfe_emac_addr_db_find_by_hash (const struct pfe_emac_t * emac, uint32_t hash)
{
  bool_t match;
  struct LLIST_t * curItem;
  struct pfe_mac_addr_db_entry_t * entry;
  struct pfe_mac_addr_db_entry_t * D.11110;

  <bb 2> :
  # DEBUG BEGIN_STMT
  entry = 0B;
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  match = 0;
  # DEBUG BEGIN_STMT
  curItem = emac->mac_addr_list.prNext;
  goto <bb 6>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  _1 = curItem - 14B;
  entry = (struct pfe_mac_addr_db_entry_t *) _1;
  # DEBUG BEGIN_STMT
  _2 = entry->hash;
  if (hash == _2)
    goto <bb 4>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  match = 1;
  # DEBUG BEGIN_STMT
  goto <bb 7>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  curItem = curItem->prNext;

  <bb 6> :
  # DEBUG BEGIN_STMT
  _3 = &emac->mac_addr_list;
  if (curItem != _3)
    goto <bb 3>; [INV]
  else
    goto <bb 7>; [INV]

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

  <bb 8> :
  # DEBUG BEGIN_STMT
  entry = 0B;

  <bb 9> :
  # DEBUG BEGIN_STMT
  D.11110 = entry;
  return D.11110;

}


pfe_emac_addr_db_get_first (const struct pfe_emac_t * emac)
{
  struct pfe_mac_addr_db_entry_t * db_entry;
  struct pfe_mac_addr_db_entry_t * D.11155;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _1 = emac->mac_addr_list.prNext;
  _2 = &emac->mac_addr_list;
  if (_1 == _2)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

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

  <bb 4> :
  # DEBUG BEGIN_STMT
  _3 = emac->mac_addr_list.prNext;
  _4 = _3 - 14B;
  db_entry = (struct pfe_mac_addr_db_entry_t *) _4;

  <bb 5> :
  # DEBUG BEGIN_STMT
  D.11155 = db_entry;
  return D.11155;

}


pfe_emac_addr_db_find_by_addr (const struct pfe_emac_t * emac, const uint8_t * addr, pfe_drv_id_t owner)
{
  bool_t match;
  struct LLIST_t * curItem;
  struct pfe_mac_addr_db_entry_t * entry;
  struct pfe_mac_addr_db_entry_t * D.11102;

  <bb 2> :
  # DEBUG BEGIN_STMT
  entry = 0B;
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  match = 0;
  # DEBUG BEGIN_STMT
  curItem = emac->mac_addr_list.prNext;
  goto <bb 7>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  _1 = curItem - 14B;
  entry = (struct pfe_mac_addr_db_entry_t *) _1;
  # DEBUG BEGIN_STMT
  _2 = entry->owner;
  if (owner == _2)
    goto <bb 4>; [INV]
  else
    goto <bb 6>; [INV]

  <bb 4> :
  _3 = &entry->addr;
  _4 = memcmp (addr, _3, 6);
  if (_4 == 0)
    goto <bb 5>; [INV]
  else
    goto <bb 6>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  match = 1;
  # DEBUG BEGIN_STMT
  goto <bb 8>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  curItem = curItem->prNext;

  <bb 7> :
  # DEBUG BEGIN_STMT
  _5 = &emac->mac_addr_list;
  if (curItem != _5)
    goto <bb 3>; [INV]
  else
    goto <bb 8>; [INV]

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

  <bb 9> :
  # DEBUG BEGIN_STMT
  entry = 0B;

  <bb 10> :
  # DEBUG BEGIN_STMT
  D.11102 = entry;
  return D.11102;

}


pfe_emac_addr_db_drop_all (const struct pfe_emac_t * emac)
{
  struct LLIST_t * tmp_item;
  struct LLIST_t * curItem;
  struct pfe_mac_addr_db_entry_t * entry;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  curItem = emac->mac_addr_list.prNext;
  tmp_item = curItem->prNext;
  goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  _1 = curItem - 14B;
  entry = (struct pfe_mac_addr_db_entry_t *) _1;
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _2 = entry->iterator.prPrev;
  _3 = entry->iterator.prNext;
  _2->prNext = _3;
  # DEBUG BEGIN_STMT
  _4 = entry->iterator.prNext;
  _5 = entry->iterator.prPrev;
  _4->prPrev = _5;
  # DEBUG BEGIN_STMT
  entry->iterator.prPrev = 0B;
  # DEBUG BEGIN_STMT
  entry->iterator.prNext = 0B;
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  oal_mm_free (entry);
  # DEBUG BEGIN_STMT
  curItem = tmp_item;
  tmp_item = tmp_item->prNext;

  <bb 4> :
  # DEBUG BEGIN_STMT
  _6 = &emac->mac_addr_list;
  if (curItem != _6)
    goto <bb 3>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 5> :
  return;

}


pfe_emac_addr_db_del_entry (const struct pfe_emac_t * emac, struct pfe_mac_addr_db_entry_t * entry)
{
  errno_t ret;
  errno_t D.11104;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _1 = entry->iterator.prPrev;
  _2 = entry->iterator.prNext;
  _1->prNext = _2;
  # DEBUG BEGIN_STMT
  _3 = entry->iterator.prNext;
  _4 = entry->iterator.prPrev;
  _3->prPrev = _4;
  # DEBUG BEGIN_STMT
  entry->iterator.prPrev = 0B;
  # DEBUG BEGIN_STMT
  entry->iterator.prNext = 0B;
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  ret = 0;
  # DEBUG BEGIN_STMT
  D.11104 = ret;
  return D.11104;

}


pfe_emac_addr_db_add (struct pfe_emac_t * emac, const uint8_t * addr, bool_t in_hash_grp, uint32_t data, pfe_drv_id_t owner)
{
  errno_t ret;
  struct pfe_mac_addr_db_entry_t * entry;
  errno_t D.11136;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  entry = oal_mm_malloc (24);
  # DEBUG BEGIN_STMT
  if (entry == 0B)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  ret = 11;
  goto <bb 8>; [INV]

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

  <bb 5> :
  # DEBUG BEGIN_STMT
  entry->hash = data;
  # DEBUG BEGIN_STMT
  entry->in_hash_grp = 1;
  goto <bb 7>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  _1 = (unsigned char) data;
  entry->addr_slot_idx = _1;
  # DEBUG BEGIN_STMT
  entry->in_hash_grp = 0;

  <bb 7> :
  # DEBUG BEGIN_STMT
  entry->owner = owner;
  # DEBUG BEGIN_STMT
  _2 = &entry->addr;
  memcpy (_2, addr, 6);
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _3 = emac->mac_addr_list.prPrev;
  entry->iterator.prPrev = _3;
  # DEBUG BEGIN_STMT
  _4 = &emac->mac_addr_list;
  entry->iterator.prNext = _4;
  # DEBUG BEGIN_STMT
  _5 = emac->mac_addr_list.prPrev;
  _6 = &entry->iterator;
  _5->prNext = _6;
  # DEBUG BEGIN_STMT
  _7 = &entry->iterator;
  emac->mac_addr_list.prPrev = _7;
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  ret = 0;

  <bb 8> :
  # DEBUG BEGIN_STMT
  D.11136 = ret;
  return D.11136;

}


pfe_emac_addr_db_init (struct pfe_emac_t * emac)
{
  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _1 = &emac->mac_addr_list;
  emac->mac_addr_list.prNext = _1;
  # DEBUG BEGIN_STMT
  _2 = &emac->mac_addr_list;
  emac->mac_addr_list.prPrev = _2;
  # DEBUG BEGIN_STMT
  return;

}


pfe_emac_flush_criterion_eval (const struct pfe_mac_addr_db_entry_t * entry, pfe_emac_crit_t crit, pfe_mac_type_t type, pfe_drv_id_t owner)
{
  bool_t ret;
  bool_t D.11061;

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

  <bb 3> :
  # DEBUG BEGIN_STMT
  _1 = entry->owner;
  if (owner == _1)
    goto <bb 4>; [INV]
  else
    goto <bb 12>; [INV]

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

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

  <bb 6> :
  # DEBUG BEGIN_STMT
  _2 = &entry->addr;
  ret = pfe_emac_check_crit_by_type (_2, type);
  goto <bb 12>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  if (crit == 2)
    goto <bb 8>; [INV]
  else
    goto <bb 10>; [INV]

  <bb 8> :
  # DEBUG BEGIN_STMT
  _3 = entry->owner;
  if (owner == _3)
    goto <bb 9>; [INV]
  else
    goto <bb 12>; [INV]

  <bb 9> :
  # DEBUG BEGIN_STMT
  _4 = &entry->addr;
  ret = pfe_emac_check_crit_by_type (_4, type);
  goto <bb 12>; [INV]

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

  <bb 11> :
  # DEBUG BEGIN_STMT
  ret = 1;

  <bb 12> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  D.11061 = ret;
  return D.11061;

}


pfe_emac_check_crit_by_type (const uint8_t * addr, pfe_mac_type_t type)
{
  bool_t ret;
  bool_t D.11071;

  <bb 2> :
  # DEBUG BEGIN_STMT
  ret = 0;
  # DEBUG BEGIN_STMT
  if (type == 3)
    goto <bb 9>; [INV]
  else
    goto <bb 3>; [INV]

  <bb 3> :
  if (type == 1)
    goto <bb 4>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 4> :
  _1 = pfe_emac_is_multi (addr);
  if (_1 == 1)
    goto <bb 9>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 5> :
  if (type == 2)
    goto <bb 6>; [INV]
  else
    goto <bb 7>; [INV]

  <bb 6> :
  _2 = pfe_emac_is_broad (addr);
  if (_2 == 1)
    goto <bb 9>; [INV]
  else
    goto <bb 7>; [INV]

  <bb 7> :
  if (type == 0)
    goto <bb 8>; [INV]
  else
    goto <bb 10>; [INV]

  <bb 8> :
  _3 = pfe_emac_is_multi (addr);
  if (_3 == 0)
    goto <bb 9>; [INV]
  else
    goto <bb 10>; [INV]

  <bb 9> :
  # DEBUG BEGIN_STMT
  ret = 1;

  <bb 10> :
  # DEBUG BEGIN_STMT
  D.11071 = ret;
  return D.11071;

}


pfe_emac_is_multi (const uint8_t * addr)
{
  bool_t D.11080;

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

  <bb 3> :
  _2 = *addr;
  _3 = (unsigned int) _2;
  _4 = _3 & 1;
  if (_4 != 0)
    goto <bb 4>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  D.11080 = 1;
  // predicted unlikely by early return (on trees) predictor.
  goto <bb 6>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  D.11080 = 0;
  // predicted unlikely by early return (on trees) predictor.

  <bb 6> :
  return D.11080;

}


pfe_emac_is_broad (const uint8_t * addr)
{
  bool_t D.11075;

  <bb 2> :
  # DEBUG BEGIN_STMT
  _1 = *addr;
  _2 = addr + 1;
  _3 = *_2;
  _4 = _1 & _3;
  _5 = addr + 2;
  _6 = *_5;
  _7 = _4 & _6;
  _8 = addr + 3;
  _9 = *_8;
  _10 = _7 & _9;
  _11 = addr + 4;
  _12 = *_11;
  _13 = _10 & _12;
  _14 = addr + 5;
  _15 = *_14;
  _16 = _13 & _15;
  if (_16 == 255)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  D.11075 = 1;
  // predicted unlikely by early return (on trees) predictor.
  goto <bb 5>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  D.11075 = 0;
  // predicted unlikely by early return (on trees) predictor.

  <bb 5> :
  return D.11075;

}


oal_mutex_unlock (const oal_mutex_t * mutex)
{
  errno_t retval;
  errno_t D.10982;

  <bb 2> :
  # DEBUG BEGIN_STMT
  retval = 22;
  # DEBUG BEGIN_STMT
  _1 = *mutex;
  if (_1 <= 255)
    goto <bb 3>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  _2 = *mutex;
  _3 = (int) _2;
  _4 = mutex_alloc[_3];
  if (_4 != 0)
    goto <bb 4>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  _5 = *mutex;
  _6 = (int) _5;
  _7 = SchM_Exit_Eth_43_PFE_ETH_EXCLUSIVE_AREA_ID[_6];
  _7 ();
  # DEBUG BEGIN_STMT
  retval = 0;

  <bb 5> :
  # DEBUG BEGIN_STMT
  D.10982 = retval;
  return D.10982;

}


oal_mutex_lock (const oal_mutex_t * mutex)
{
  errno_t retval;
  errno_t D.10976;

  <bb 2> :
  # DEBUG BEGIN_STMT
  retval = 22;
  # DEBUG BEGIN_STMT
  _1 = *mutex;
  if (_1 <= 255)
    goto <bb 3>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  _2 = *mutex;
  _3 = (int) _2;
  _4 = mutex_alloc[_3];
  if (_4 != 0)
    goto <bb 4>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  _5 = *mutex;
  _6 = (int) _5;
  _7 = SchM_Enter_Eth_43_PFE_ETH_EXCLUSIVE_AREA_ID[_6];
  _7 ();
  # DEBUG BEGIN_STMT
  retval = 0;

  <bb 5> :
  # DEBUG BEGIN_STMT
  D.10976 = retval;
  return D.10976;

}


oal_mutex_destroy (oal_mutex_t * mutex)
{
  errno_t D.11161;

  <bb 2> :
  # DEBUG BEGIN_STMT
  D.11161 = oal_mutex_destroy_internal (mutex);
  return D.11161;

}


oal_mutex_init (oal_mutex_t * mutex)
{
  errno_t D.10970;

  <bb 2> :
  # DEBUG BEGIN_STMT
  D.10970 = oal_mutex_init_internal (mutex);
  return D.10970;

}


