pfe_spd_get_rule (const struct pfe_phy_if_t * phy_if, uint16_t position, struct pfe_ct_spd_entry_t * entry)
{
  pfe_ct_phy_if_id_t phy_if_id;
  struct pfe_ct_spd_entry_t * entries;
  uint32_t entry_count;
  errno_t ret;
  int _1;
  struct pfe_ct_ipsec_spd_t * _2;
  int _3;
  struct pfe_ct_ipsec_spd_t * _4;
  long unsigned int _5;
  long unsigned int _6;
  int _7;
  struct pfe_ct_ipsec_spd_t * _8;
  long unsigned int _9;
  long unsigned int _10;
  long unsigned int _11;
  long unsigned int _12;
  int _13;
  struct pfe_ct_ipsec_spd_t * _14;
  long unsigned int _15;
  long unsigned int _16;
  long unsigned int _17;
  long unsigned int _18;
  int _19;
  struct pfe_ct_ipsec_spd_t * _20;
  long unsigned int _21;
  long unsigned int _22;
  long unsigned int _23;
  int _24;
  struct pfe_ct_ipsec_spd_t * _25;
  unsigned int _26;
  unsigned int _27;
  struct pfe_ct_spd_entry_t * _28;
  errno_t _42;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  phy_if_id_33 = pfe_phy_if_get_id (phy_if_32(D));
  # DEBUG phy_if_id => phy_if_id_33
  # DEBUG BEGIN_STMT
  _1 = (int) phy_if_id_33;
  _2 = pfe_spds[_1];
  if (_2 == 0B)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

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

  <bb 4> :
  # DEBUG BEGIN_STMT
  _3 = (int) phy_if_id_33;
  _4 = pfe_spds[_3];
  _5 = _4->entry_count;
  _6 = _5 >> 24;
  _7 = (int) phy_if_id_33;
  _8 = pfe_spds[_7];
  _9 = _8->entry_count;
  _10 = _9 >> 8;
  _11 = _10 & 65280;
  _12 = _6 | _11;
  _13 = (int) phy_if_id_33;
  _14 = pfe_spds[_13];
  _15 = _14->entry_count;
  _16 = _15 << 8;
  _17 = _16 & 16711680;
  _18 = _12 | _17;
  _19 = (int) phy_if_id_33;
  _20 = pfe_spds[_19];
  _21 = _20->entry_count;
  _22 = _21 << 24;
  entry_count_34 = _18 | _22;
  # DEBUG entry_count => entry_count_34
  # DEBUG BEGIN_STMT
  _23 = (long unsigned int) position_35(D);
  if (entry_count_34 <= _23)
    goto <bb 5>; [INV]
  else
    goto <bb 6>; [INV]

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

  <bb 6> :
  # DEBUG BEGIN_STMT
  _24 = (int) phy_if_id_33;
  _25 = pfe_spds[_24];
  entries_36 = _25 + 12;
  # DEBUG entries => entries_36
  # DEBUG BEGIN_STMT
  _26 = (unsigned int) position_35(D);
  _27 = _26 * 56;
  _28 = entries_36 + _27;
  memcpy (entry_37(D), _28, 56);
  # DEBUG BEGIN_STMT
  ret_39 = 0;
  # DEBUG ret => ret_39

  <bb 7> :
  # ret_29 = PHI <ret_41(3), ret_40(5), ret_39(6)>
  # DEBUG ret => ret_29
  # DEBUG BEGIN_STMT
  _42 = ret_29;
  return _42;

}


pfe_spd_remove_rule (struct pfe_phy_if_t * phy_if, uint16_t position)
{
  struct pfe_ct_ipsec_spd_t * spd;
  uint32_t old_addr;
  uint32_t entry_count;
  errno_t ret;
  struct pfe_ct_spd_entry_t * old_entries;
  struct pfe_ct_spd_entry_t * entries;
  pfe_ct_phy_if_id_t phy_if_id;
  int _1;
  struct pfe_ct_ipsec_spd_t * _2;
  int _3;
  struct pfe_ct_ipsec_spd_t * _4;
  long unsigned int _5;
  long unsigned int _6;
  int _7;
  struct pfe_ct_ipsec_spd_t * _8;
  long unsigned int _9;
  long unsigned int _10;
  long unsigned int _11;
  long unsigned int _12;
  int _13;
  struct pfe_ct_ipsec_spd_t * _14;
  long unsigned int _15;
  long unsigned int _16;
  long unsigned int _17;
  long unsigned int _18;
  int _19;
  struct pfe_ct_ipsec_spd_t * _20;
  long unsigned int _21;
  long unsigned int _22;
  int _23;
  struct pfe_ct_ipsec_spd_t * _24;
  int _25;
  struct pfe_class_t * class_ptr.10_26;
  long unsigned int _27;
  long unsigned int _28;
  int _29;
  struct pfe_ct_ipsec_spd_t * _30;
  long unsigned int _31;
  long unsigned int _32;
  long unsigned int _33;
  long unsigned int _34;
  long unsigned int _35;
  long unsigned int _36;
  long unsigned int _37;
  long unsigned int _38;
  long unsigned int _39;
  int _40;
  struct pfe_ct_ipsec_spd_t * _41;
  <unnamed type> _42;
  int _43;
  struct pfe_ct_ipsec_spd_t * _44;
  long unsigned int _45;
  long unsigned int _46;
  long unsigned int _47;
  long unsigned int _48;
  long unsigned int _49;
  unsigned int _50;
  unsigned int _51;
  struct pfe_ct_spd_entry_t * _52;
  sizetype _53;
  sizetype _54;
  sizetype _55;
  struct pfe_ct_spd_entry_t * _56;
  long unsigned int _57;
  long unsigned int _58;
  long unsigned int _59;
  long unsigned int _60;
  long unsigned int _61;
  int _62;
  struct pfe_ct_ipsec_spd_t * _63;
  int _64;
  errno_t _98;

  <bb 2> :
  # DEBUG BEGIN_STMT
  phy_if_id_70 = pfe_phy_if_get_id (phy_if_69(D));
  # DEBUG phy_if_id => phy_if_id_70
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _1 = (int) phy_if_id_70;
  _2 = pfe_spds[_1];
  if (_2 == 0B)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  ret_97 = 22;
  # DEBUG ret => ret_97
  goto <bb 14>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  _3 = (int) phy_if_id_70;
  _4 = pfe_spds[_3];
  _5 = _4->entry_count;
  _6 = _5 >> 24;
  _7 = (int) phy_if_id_70;
  _8 = pfe_spds[_7];
  _9 = _8->entry_count;
  _10 = _9 >> 8;
  _11 = _10 & 65280;
  _12 = _6 | _11;
  _13 = (int) phy_if_id_70;
  _14 = pfe_spds[_13];
  _15 = _14->entry_count;
  _16 = _15 << 8;
  _17 = _16 & 16711680;
  _18 = _12 | _17;
  _19 = (int) phy_if_id_70;
  _20 = pfe_spds[_19];
  _21 = _20->entry_count;
  _22 = _21 << 24;
  entry_count_71 = _18 | _22;
  # DEBUG entry_count => entry_count_71
  # DEBUG BEGIN_STMT
  if (entry_count_71 <= 1)
    goto <bb 5>; [INV]
  else
    goto <bb 6>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  _23 = (int) phy_if_id_70;
  _24 = pfe_spds[_23];
  oal_mm_free (_24);
  # DEBUG BEGIN_STMT
  _25 = (int) phy_if_id_70;
  pfe_spds[_25] = 0B;
  # DEBUG BEGIN_STMT
  old_addr_93 = pfe_phy_if_get_spd (phy_if_69(D));
  # DEBUG old_addr => old_addr_93
  # DEBUG BEGIN_STMT
  pfe_phy_if_set_spd (phy_if_69(D), 0);
  # DEBUG BEGIN_STMT
  class_ptr.10_26 = class_ptr;
  pfe_class_dmem_heap_free (class_ptr.10_26, old_addr_93);
  # DEBUG BEGIN_STMT
  ret_96 = 0;
  # DEBUG ret => ret_96
  goto <bb 14>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  entry_count_72 = entry_count_71 + 4294967295;
  # DEBUG entry_count => entry_count_72
  # DEBUG BEGIN_STMT
  _27 = entry_count_72 * 56;
  _28 = _27 + 12;
  spd_74 = oal_mm_malloc (_28);
  # DEBUG spd => spd_74
  # DEBUG BEGIN_STMT
  _29 = (int) phy_if_id_70;
  _30 = pfe_spds[_29];
  old_entries_75 = _30 + 12;
  # DEBUG old_entries => old_entries_75
  # DEBUG BEGIN_STMT
  if (spd_74 != 0B)
    goto <bb 7>; [INV]
  else
    goto <bb 13>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  entries_77 = spd_74 + 12;
  # DEBUG entries => entries_77
  # DEBUG BEGIN_STMT
  _31 = entry_count_72 >> 24;
  _32 = entry_count_72 >> 8;
  _33 = _32 & 65280;
  _34 = _31 | _33;
  _35 = entry_count_72 << 8;
  _36 = _35 & 16711680;
  _37 = _34 | _36;
  _38 = entry_count_72 << 24;
  _39 = _37 | _38;
  spd_74->entry_count = _39;
  # DEBUG BEGIN_STMT
  _40 = (int) phy_if_id_70;
  _41 = pfe_spds[_40];
  _42 = _41->no_ip_action;
  spd_74->no_ip_action = _42;
  # DEBUG BEGIN_STMT
  _43 = (int) phy_if_id_70;
  _44 = pfe_spds[_43];
  _45 = _44->entries;
  spd_74->entries = _45;
  # DEBUG BEGIN_STMT
  _46 = (long unsigned int) position_81(D);
  if (entry_count_72 <= _46)
    goto <bb 8>; [INV]
  else
    goto <bb 9>; [INV]

  <bb 8> :
  # DEBUG BEGIN_STMT
  _47 = entry_count_72 * 56;
  memcpy (entries_77, old_entries_75, _47);
  goto <bb 10>; [INV]

  <bb 9> :
  # DEBUG BEGIN_STMT
  _48 = (long unsigned int) position_81(D);
  _49 = _48 * 56;
  memcpy (entries_77, old_entries_75, _49);
  # DEBUG BEGIN_STMT
  _50 = (unsigned int) position_81(D);
  _51 = _50 * 56;
  _52 = entries_77 + _51;
  _53 = (sizetype) position_81(D);
  _54 = _53 + 1;
  _55 = _54 * 56;
  _56 = old_entries_75 + _55;
  _57 = (long unsigned int) position_81(D);
  _58 = entry_count_72 - _57;
  _59 = _58 * 56;
  memcpy (_52, _56, _59);

  <bb 10> :
  # DEBUG BEGIN_STMT
  _60 = entry_count_72 * 56;
  _61 = _60 + 12;
  ret_86 = pfe_spd_update_phyif (phy_if_69(D), spd_74, _61);
  # DEBUG ret => ret_86
  # DEBUG BEGIN_STMT
  if (ret_86 == 0)
    goto <bb 11>; [INV]
  else
    goto <bb 12>; [INV]

  <bb 11> :
  # DEBUG BEGIN_STMT
  _62 = (int) phy_if_id_70;
  _63 = pfe_spds[_62];
  oal_mm_free (_63);
  # DEBUG BEGIN_STMT
  _64 = (int) phy_if_id_70;
  pfe_spds[_64] = spd_74;
  goto <bb 14>; [INV]

  <bb 12> :
  # DEBUG BEGIN_STMT
  oal_mm_free (spd_74);
  goto <bb 14>; [INV]

  <bb 13> :
  # DEBUG BEGIN_STMT
  ret_76 = 11;
  # DEBUG ret => ret_76

  <bb 14> :
  # ret_65 = PHI <ret_97(3), ret_96(5), ret_86(12), ret_76(13), ret_86(11)>
  # DEBUG ret => ret_65
  # DEBUG BEGIN_STMT
  _98 = ret_65;
  return _98;

}


pfe_spd_add_rule (struct pfe_phy_if_t * phy_if, uint16_t position, struct pfe_ct_spd_entry_t * entry)
{
  addr_t dmem_addr;
  uint32_t old_count;
  uint32_t new_count;
  errno_t ret;
  struct pfe_ct_spd_entry_t * old_entries;
  struct pfe_ct_spd_entry_t * entries;
  struct pfe_ct_ipsec_spd_t * spd;
  pfe_ct_phy_if_id_t phy_if_id;
  int _1;
  struct pfe_ct_ipsec_spd_t * _2;
  long unsigned int _3;
  long unsigned int _4;
  long unsigned int _5;
  long unsigned int _6;
  long unsigned int _7;
  long unsigned int _8;
  long unsigned int _9;
  long unsigned int _10;
  long unsigned int _11;
  int _12;
  struct pfe_class_t * class_ptr.5_13;
  unsigned int _14;
  long unsigned int _15;
  unsigned int _16;
  long unsigned int _17;
  long unsigned int _18;
  long unsigned int _19;
  unsigned int _20;
  long unsigned int _21;
  long unsigned int _22;
  long unsigned int _23;
  unsigned int _24;
  long unsigned int _25;
  long unsigned int _26;
  struct pfe_class_t * class_ptr.6_27;
  int _28;
  struct pfe_ct_ipsec_spd_t * _29;
  long unsigned int _30;
  long unsigned int _31;
  int _32;
  struct pfe_ct_ipsec_spd_t * _33;
  long unsigned int _34;
  long unsigned int _35;
  long unsigned int _36;
  long unsigned int _37;
  int _38;
  struct pfe_ct_ipsec_spd_t * _39;
  long unsigned int _40;
  long unsigned int _41;
  long unsigned int _42;
  long unsigned int _43;
  int _44;
  struct pfe_ct_ipsec_spd_t * _45;
  long unsigned int _46;
  long unsigned int _47;
  long unsigned int _48;
  long unsigned int _49;
  int _50;
  struct pfe_ct_ipsec_spd_t * _51;
  long unsigned int _52;
  long unsigned int _53;
  long unsigned int _54;
  long unsigned int _55;
  long unsigned int _56;
  long unsigned int _57;
  long unsigned int _58;
  long unsigned int _59;
  long unsigned int _60;
  int _61;
  struct pfe_ct_ipsec_spd_t * _62;
  <unnamed type> _63;
  int _64;
  struct pfe_ct_ipsec_spd_t * _65;
  long unsigned int _66;
  long unsigned int _67;
  long unsigned int _68;
  long unsigned int _69;
  struct pfe_ct_spd_entry_t * _70;
  struct pfe_ct_spd_entry_t * _71;
  long unsigned int _72;
  long unsigned int _73;
  long unsigned int _74;
  sizetype _75;
  sizetype _76;
  sizetype _77;
  struct pfe_ct_spd_entry_t * _78;
  unsigned int _79;
  unsigned int _80;
  struct pfe_ct_spd_entry_t * _81;
  long unsigned int _82;
  long unsigned int _83;
  long unsigned int _84;
  unsigned int _85;
  unsigned int _86;
  struct pfe_ct_spd_entry_t * _87;
  long unsigned int _88;
  long unsigned int _89;
  int _90;
  struct pfe_ct_ipsec_spd_t * _91;
  int _92;
  errno_t _140;

  <bb 2> :
  # DEBUG BEGIN_STMT
  phy_if_id_98 = pfe_phy_if_get_id (phy_if_97(D));
  # DEBUG phy_if_id => phy_if_id_98
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _1 = (int) phy_if_id_98;
  _2 = pfe_spds[_1];
  if (_2 == 0B)
    goto <bb 3>; [INV]
  else
    goto <bb 8>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  new_count_123 = 1;
  # DEBUG new_count => new_count_123
  # DEBUG BEGIN_STMT
  spd_125 = oal_mm_malloc (68);
  # DEBUG spd => spd_125
  # DEBUG BEGIN_STMT
  if (spd_125 != 0B)
    goto <bb 4>; [INV]
  else
    goto <bb 7>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  entries_127 = spd_125 + 12;
  # DEBUG entries => entries_127
  # DEBUG BEGIN_STMT
  _3 = new_count_123 >> 24;
  _4 = new_count_123 >> 8;
  _5 = _4 & 65280;
  _6 = _3 | _5;
  _7 = new_count_123 << 8;
  _8 = _7 & 16711680;
  _9 = _6 | _8;
  _10 = new_count_123 << 24;
  _11 = _9 | _10;
  spd_125->entry_count = _11;
  # DEBUG BEGIN_STMT
  spd_125->no_ip_action = 2;
  # DEBUG BEGIN_STMT
  memcpy (entries_127, entry_112(D), 56);
  # DEBUG BEGIN_STMT
  _12 = (int) phy_if_id_98;
  pfe_spds[_12] = spd_125;
  # DEBUG BEGIN_STMT
  class_ptr.5_13 = class_ptr;
  dmem_addr_133 = pfe_class_dmem_heap_alloc (class_ptr.5_13, 68);
  # DEBUG dmem_addr => dmem_addr_133
  # DEBUG BEGIN_STMT
  if (dmem_addr_133 != 0)
    goto <bb 5>; [INV]
  else
    goto <bb 6>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  _14 = dmem_addr_133 + 12;
  _15 = _14 >> 24;
  _16 = dmem_addr_133 + 12;
  _17 = _16 >> 8;
  _18 = _17 & 65280;
  _19 = _15 | _18;
  _20 = dmem_addr_133 + 12;
  _21 = _20 << 8;
  _22 = _21 & 16711680;
  _23 = _19 | _22;
  _24 = dmem_addr_133 + 12;
  _25 = _24 << 24;
  _26 = _23 | _25;
  spd_125->entries = _26;
  # DEBUG BEGIN_STMT
  class_ptr.6_27 = class_ptr;
  pfe_class_write_dmem (class_ptr.6_27, -1, dmem_addr_133, spd_125, 68);
  # DEBUG BEGIN_STMT
  pfe_phy_if_set_spd (phy_if_97(D), dmem_addr_133);
  # DEBUG BEGIN_STMT
  ret_139 = 0;
  # DEBUG ret => ret_139
  goto <bb 18>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  oal_mm_free (spd_125);
  # DEBUG BEGIN_STMT
  ret_135 = 11;
  # DEBUG ret => ret_135
  goto <bb 18>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  ret_126 = 11;
  # DEBUG ret => ret_126
  goto <bb 18>; [INV]

  <bb 8> :
  # DEBUG BEGIN_STMT
  _28 = (int) phy_if_id_98;
  _29 = pfe_spds[_28];
  _30 = _29->entry_count;
  _31 = _30 >> 24;
  _32 = (int) phy_if_id_98;
  _33 = pfe_spds[_32];
  _34 = _33->entry_count;
  _35 = _34 >> 8;
  _36 = _35 & 65280;
  _37 = _31 | _36;
  _38 = (int) phy_if_id_98;
  _39 = pfe_spds[_38];
  _40 = _39->entry_count;
  _41 = _40 << 8;
  _42 = _41 & 16711680;
  _43 = _37 | _42;
  _44 = (int) phy_if_id_98;
  _45 = pfe_spds[_44];
  _46 = _45->entry_count;
  _47 = _46 << 24;
  old_count_99 = _43 | _47;
  # DEBUG old_count => old_count_99
  # DEBUG BEGIN_STMT
  new_count_100 = old_count_99 + 1;
  # DEBUG new_count => new_count_100
  # DEBUG BEGIN_STMT
  _48 = new_count_100 * 56;
  _49 = _48 + 12;
  spd_102 = oal_mm_malloc (_49);
  # DEBUG spd => spd_102
  # DEBUG BEGIN_STMT
  _50 = (int) phy_if_id_98;
  _51 = pfe_spds[_50];
  old_entries_103 = _51 + 12;
  # DEBUG old_entries => old_entries_103
  # DEBUG BEGIN_STMT
  if (spd_102 != 0B)
    goto <bb 9>; [INV]
  else
    goto <bb 17>; [INV]

  <bb 9> :
  # DEBUG BEGIN_STMT
  entries_105 = spd_102 + 12;
  # DEBUG entries => entries_105
  # DEBUG BEGIN_STMT
  _52 = new_count_100 >> 24;
  _53 = new_count_100 >> 8;
  _54 = _53 & 65280;
  _55 = _52 | _54;
  _56 = new_count_100 << 8;
  _57 = _56 & 16711680;
  _58 = _55 | _57;
  _59 = new_count_100 << 24;
  _60 = _58 | _59;
  spd_102->entry_count = _60;
  # DEBUG BEGIN_STMT
  _61 = (int) phy_if_id_98;
  _62 = pfe_spds[_61];
  _63 = _62->no_ip_action;
  spd_102->no_ip_action = _63;
  # DEBUG BEGIN_STMT
  _64 = (int) phy_if_id_98;
  _65 = pfe_spds[_64];
  _66 = _65->entries;
  spd_102->entries = _66;
  # DEBUG BEGIN_STMT
  _67 = (long unsigned int) position_109(D);
  if (old_count_99 <= _67)
    goto <bb 10>; [INV]
  else
    goto <bb 11>; [INV]

  <bb 10> :
  # DEBUG BEGIN_STMT
  _68 = old_count_99 * 56;
  memcpy (entries_105, old_entries_103, _68);
  # DEBUG BEGIN_STMT
  _69 = old_count_99 * 56;
  _70 = entries_105 + _69;
  memcpy (_70, entry_112(D), 56);
  goto <bb 14>; [INV]

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

  <bb 12> :
  # DEBUG BEGIN_STMT
  _71 = entries_105 + 56;
  _72 = old_count_99 * 56;
  memcpy (_71, old_entries_103, _72);
  # DEBUG BEGIN_STMT
  memcpy (entries_105, entry_112(D), 56);
  goto <bb 14>; [INV]

  <bb 13> :
  # DEBUG BEGIN_STMT
  _73 = (long unsigned int) position_109(D);
  _74 = _73 * 56;
  memcpy (entries_105, old_entries_103, _74);
  # DEBUG BEGIN_STMT
  _75 = (sizetype) position_109(D);
  _76 = _75 + 1;
  _77 = _76 * 56;
  _78 = entries_105 + _77;
  _79 = (unsigned int) position_109(D);
  _80 = _79 * 56;
  _81 = old_entries_103 + _80;
  _82 = (long unsigned int) position_109(D);
  _83 = old_count_99 - _82;
  _84 = _83 * 56;
  memcpy (_78, _81, _84);
  # DEBUG BEGIN_STMT
  _85 = (unsigned int) position_109(D);
  _86 = _85 * 56;
  _87 = entries_105 + _86;
  memcpy (_87, entry_112(D), 56);

  <bb 14> :
  # DEBUG BEGIN_STMT
  _88 = new_count_100 * 56;
  _89 = _88 + 12;
  ret_119 = pfe_spd_update_phyif (phy_if_97(D), spd_102, _89);
  # DEBUG ret => ret_119
  # DEBUG BEGIN_STMT
  if (ret_119 == 0)
    goto <bb 15>; [INV]
  else
    goto <bb 16>; [INV]

  <bb 15> :
  # DEBUG BEGIN_STMT
  _90 = (int) phy_if_id_98;
  _91 = pfe_spds[_90];
  oal_mm_free (_91);
  # DEBUG BEGIN_STMT
  _92 = (int) phy_if_id_98;
  pfe_spds[_92] = spd_102;
  goto <bb 18>; [INV]

  <bb 16> :
  # DEBUG BEGIN_STMT
  oal_mm_free (spd_102);
  goto <bb 18>; [INV]

  <bb 17> :
  # DEBUG BEGIN_STMT
  ret_104 = 11;
  # DEBUG ret => ret_104

  <bb 18> :
  # ret_93 = PHI <ret_126(7), ret_119(16), ret_104(17), ret_135(6), ret_139(5), ret_119(15)>
  # DEBUG ret => ret_93
  # DEBUG BEGIN_STMT
  _140 = ret_93;
  return _140;

}


pfe_spd_destroy (struct pfe_if_db_t * phy_if_db)
{
  struct pfe_if_db_entry_t * if_db_entry;
  struct pfe_phy_if_t * phy_if;
  errno_t ret;
  uint32_t session_id;
  uint32_t idx;
  struct pfe_ct_ipsec_spd_t * _1;
  int _2;
  long unsigned int session_id.0_3;
  void * idx.1_4;
  struct pfe_if_db_entry_t * if_db_entry.2_5;
  struct pfe_ct_ipsec_spd_t * _6;
  long unsigned int session_id.3_7;
  int _8;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  session_id = 0;
  # DEBUG BEGIN_STMT
  ret_15 = 0;
  # DEBUG ret => ret_15
  # DEBUG BEGIN_STMT
  phy_if_16 = 0B;
  # DEBUG phy_if => phy_if_16
  # DEBUG BEGIN_STMT
  if_db_entry = 0B;
  # DEBUG BEGIN_STMT
  idx_18 = 0;
  # DEBUG idx => idx_18
  goto <bb 10>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  _1 = pfe_spds[idx_9];
  if (_1 == 0B)
    goto <bb 4>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 4> :
  # DEBUG BEGIN_STMT
  // predicted unlikely by continue predictor.
  goto <bb 9>; [INV]

  <bb 5> :
  # DEBUG BEGIN_STMT
  phy_if_22 = 0B;
  # DEBUG phy_if => phy_if_22
  # DEBUG BEGIN_STMT
  if_db_entry = 0B;
  # DEBUG BEGIN_STMT
  _2 = pfe_if_db_lock (&session_id);
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  session_id.0_3 = session_id;
  idx.1_4 = (void *) idx_9;
  ret_27 = pfe_if_db_get_first (phy_if_db_25(D), session_id.0_3, 1, idx.1_4, &if_db_entry);
  # DEBUG ret => ret_27
  # DEBUG BEGIN_STMT
  if (ret_27 == 0)
    goto <bb 6>; [INV]
  else
    goto <bb 8>; [INV]

  <bb 6> :
  # DEBUG BEGIN_STMT
  if_db_entry.2_5 = if_db_entry;
  phy_if_28 = pfe_if_db_entry_get_phy_if (if_db_entry.2_5);
  # DEBUG phy_if => phy_if_28
  # DEBUG BEGIN_STMT
  if (phy_if_28 != 0B)
    goto <bb 7>; [INV]
  else
    goto <bb 8>; [INV]

  <bb 7> :
  # DEBUG BEGIN_STMT
  pfe_spd_destroy_phyif (phy_if_28);

  <bb 8> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  _6 = pfe_spds[idx_9];
  oal_mm_free (_6);
  # DEBUG BEGIN_STMT
  pfe_spds[idx_9] = 0B;
  # DEBUG BEGIN_STMT
  session_id.3_7 = session_id;
  _8 = pfe_if_db_unlock (session_id.3_7);

  <bb 9> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  idx_33 = idx_9 + 1;
  # DEBUG idx => idx_33

  <bb 10> :
  # idx_9 = PHI <idx_18(2), idx_33(9)>
  # DEBUG idx => idx_9
  # DEBUG BEGIN_STMT
  if (idx_9 <= 8)
    goto <bb 3>; [INV]
  else
    goto <bb 11>; [INV]

  <bb 11> :
  # DEBUG BEGIN_STMT
  class_ptr = 0B;
  session_id ={v} {CLOBBER};
  if_db_entry ={v} {CLOBBER};
  return;

}


pfe_spd_init (struct pfe_class_t * class)
{
  uint32_t idx;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  class_ptr = class_4(D);
  # DEBUG BEGIN_STMT
  idx_6 = 0;
  # DEBUG idx => idx_6
  goto <bb 4>; [INV]

  <bb 3> :
  # DEBUG BEGIN_STMT
  pfe_spds[idx_1] = 0B;
  # DEBUG BEGIN_STMT
  idx_8 = idx_1 + 1;
  # DEBUG idx => idx_8

  <bb 4> :
  # idx_1 = PHI <idx_6(2), idx_8(3)>
  # DEBUG idx => idx_1
  # DEBUG BEGIN_STMT
  if (idx_1 <= 8)
    goto <bb 3>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 5> :
  return;

}


pfe_spd_destroy_phyif (struct pfe_phy_if_t * phy_if)
{
  uint32_t baddr;
  struct pfe_class_t * class_ptr.4_1;
  int _2;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  baddr_6 = pfe_phy_if_get_spd (phy_if_4(D));
  # DEBUG baddr => baddr_6
  # DEBUG BEGIN_STMT
  class_ptr.4_1 = class_ptr;
  pfe_class_dmem_heap_free (class_ptr.4_1, baddr_6);
  # DEBUG BEGIN_STMT
  _2 = pfe_phy_if_set_spd (phy_if_4(D), 0);
  # DEBUG BEGIN_STMT
  return;

}


pfe_spd_update_phyif (struct pfe_phy_if_t * phy_if, struct pfe_ct_ipsec_spd_t * spd, const uint32_t size)
{
  uint32_t old_addr;
  addr_t dmem_addr;
  errno_t ret;
  struct pfe_class_t * class_ptr.7_1;
  unsigned int _2;
  long unsigned int _3;
  unsigned int _4;
  long unsigned int _5;
  long unsigned int _6;
  long unsigned int _7;
  unsigned int _8;
  long unsigned int _9;
  long unsigned int _10;
  long unsigned int _11;
  unsigned int _12;
  long unsigned int _13;
  long unsigned int _14;
  struct pfe_class_t * class_ptr.8_15;
  struct pfe_class_t * class_ptr.9_16;
  errno_t _33;

  <bb 2> :
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  class_ptr.7_1 = class_ptr;
  dmem_addr_22 = pfe_class_dmem_heap_alloc (class_ptr.7_1, size_20(D));
  # DEBUG dmem_addr => dmem_addr_22
  # DEBUG BEGIN_STMT
  if (dmem_addr_22 == 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

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

  <bb 4> :
  # DEBUG BEGIN_STMT
  _2 = dmem_addr_22 + 12;
  _3 = _2 >> 24;
  _4 = dmem_addr_22 + 12;
  _5 = _4 >> 8;
  _6 = _5 & 65280;
  _7 = _3 | _6;
  _8 = dmem_addr_22 + 12;
  _9 = _8 << 8;
  _10 = _9 & 16711680;
  _11 = _7 | _10;
  _12 = dmem_addr_22 + 12;
  _13 = _12 << 24;
  _14 = _11 | _13;
  spd_23(D)->entries = _14;
  # DEBUG BEGIN_STMT
  class_ptr.8_15 = class_ptr;
  pfe_class_write_dmem (class_ptr.8_15, -1, dmem_addr_22, spd_23(D), size_20(D));
  # DEBUG BEGIN_STMT
  old_addr_28 = pfe_phy_if_get_spd (phy_if_26(D));
  # DEBUG old_addr => old_addr_28
  # DEBUG BEGIN_STMT
  pfe_phy_if_set_spd (phy_if_26(D), dmem_addr_22);
  # DEBUG BEGIN_STMT
  class_ptr.9_16 = class_ptr;
  pfe_class_dmem_heap_free (class_ptr.9_16, old_addr_28);
  # DEBUG BEGIN_STMT
  ret_31 = 0;
  # DEBUG ret => ret_31

  <bb 5> :
  # ret_17 = PHI <ret_32(3), ret_31(4)>
  # DEBUG ret => ret_17
  # DEBUG BEGIN_STMT
  _33 = ret_17;
  return _33;

}


