IcmpFileName

decompiled_code:
const char *__fastcall IcmpFileName(__int64 a1)
{
_BYTE *v1; // rax
const char *result; // rax

v1 = *(_BYTE **)(a1 + 136);
if ( !v1 )
return "ICMP_TRUNC";
switch ( *v1 )
{
case 0:
result = "ECHO_REPLY";
break;
case 3:
switch ( v1[1] )
{
case 0:
result = "NET_UNRCH";
break;
case 1:
result = "HST_UNRCH";
break;
case 2:
result = "PROTO_UNRCH";
break;
case 3:
result = "PORT_UNRCH";
break;
case 4:
result = "UNRCH_FRAG_NEEDED";
break;
case 5:
result = "UNRCH_SOURCE_ROUTE_FAILED";
break;
case 6:
result = "UNRCH_NETWORK_UNKNOWN";
break;
case 7:
result = "UNRCH_HOST_UNKNOWN";
break;
case 8:
result = "UNRCH_HOST_ISOLATED";
break;
case 9:
result = "UNRCH_PKT_FILTERED_NET";
break;
case 0xA:
result = "UNRCH_PKT_FILTERED_HOST";
break;
case 0xB:
result = "UNRCH_NET_UNR_TOS";
break;
case 0xC:
result = "UNRCH_HOST_UNR_TOS";
break;
case 0xD:
result = "UNRCH_PACKET_FILT";
break;
case 0xE:
result = "UNRCH_PREC_VIOL";
break;
case 0xF:
result = "UNRCH_PREC_CUTOFF";
break;
default:
result = "UNKNOWN";
break;
}
break;
case 4:
result = "SRC_QUENCH";
break;
case 5:
result = "REDIRECT";
break;
case 8:
result = "ECHO";
break;
case 0xB:
result = "TTL_EXCEED";
break;
case 0xC:
result = "PARAM_PROB";
break;
case 0xD:
result = "TIMESTAMP";
break;
case 0xE:
result = "TIMESTAMP_RPL";
break;
case 0xF:
result = "INFO_REQ";
break;
case 0x10:
result = "INFO_RPL";
break;
case 0x11:
result = "ADDR";
break;
case 0x12:
result = "ADDR_RPL";
break;
default:
result = "UNKNOWN";
break;
}
return result;
}

canonical_decompiled_code:
const char *__fastcall func5(__int64 a1)
{
_BYTE *v1; // rax
const char *result; // rax

v1 = *(_BYTE **)(a1 + 136);
if ( !v1 )
return "ICMP_TRUNC";
switch ( *v1 )
{
case 0:
result = "ECHO_REPLY";
break;
case 3:
switch ( v1[1] )
{
case 0:
result = "NET_UNRCH";
break;
case 1:
result = "HST_UNRCH";
break;
case 2:
result = "PROTO_UNRCH";
break;
case 3:
result = "PORT_UNRCH";
break;
case 4:
result = "UNRCH_FRAG_NEEDED";
break;
case 5:
result = "UNRCH_SOURCE_ROUTE_FAILED";
break;
case 6:
result = "UNRCH_NETWORK_UNKNOWN";
break;
case 7:
result = "UNRCH_HOST_UNKNOWN";
break;
case 8:
result = "UNRCH_HOST_ISOLATED";
break;
case 9:
result = "UNRCH_PKT_FILTERED_NET";
break;
case 0xA:
result = "UNRCH_PKT_FILTERED_HOST";
break;
case 0xB:
result = "UNRCH_NET_UNR_TOS";
break;
case 0xC:
result = "UNRCH_HOST_UNR_TOS";
break;
case 0xD:
result = "UNRCH_PACKET_FILT";
break;
case 0xE:
result = "UNRCH_PREC_VIOL";
break;
case 0xF:
result = "UNRCH_PREC_CUTOFF";
break;
default:
result = "UNKNOWN";
break;
}
break;
case 4:
result = "SRC_QUENCH";
break;
case 5:
result = "REDIRECT";
break;
case 8:
result = "ECHO";
break;
case 0xB:
result = "TTL_EXCEED";
break;
case 0xC:
result = "PARAM_PROB";
break;
case 0xD:
result = "TIMESTAMP";
break;
case 0xE:
result = "TIMESTAMP_RPL";
break;
case 0xF:
result = "INFO_REQ";
break;
case 0x10:
result = "INFO_RPL";
break;
case 0x11:
result = "ADDR";
break;
case 0x12:
result = "ADDR_RPL";
break;
default:
result = "UNKNOWN";
break;
}
return result;
}

original_code:
char *IcmpFileName(Packet * p)
{
    if(p->icmph == ((void *)0))
    {
        return "ICMP_TRUNC";
    }
    switch(p->icmph->type)
    {
        case 0:
            return "ECHO_REPLY";
        case 3:
            switch(p->icmph->code)
            {
                case 0:
                    return "NET_UNRCH";
                case 1:
                    return "HST_UNRCH";
                case 2:
                    return "PROTO_UNRCH";
                case 3:
                    return "PORT_UNRCH";
                case 4:
                    return "UNRCH_FRAG_NEEDED";
                case 5:
                    return "UNRCH_SOURCE_ROUTE_FAILED";
                case 6:
                    return "UNRCH_NETWORK_UNKNOWN";
                case 7:
                    return "UNRCH_HOST_UNKNOWN";
                case 8:
                    return "UNRCH_HOST_ISOLATED";
                case 9:
                    return "UNRCH_PKT_FILTERED_NET";
                case 10:
                    return "UNRCH_PKT_FILTERED_HOST";
                case 11:
                    return "UNRCH_NET_UNR_TOS";
                case 12:
                    return "UNRCH_HOST_UNR_TOS";
                case 13:
                    return "UNRCH_PACKET_FILT";
                case 14:
                    return "UNRCH_PREC_VIOL";
                case 15:
                    return "UNRCH_PREC_CUTOFF";
                default:
                    return "UNKNOWN";
            }
        case 4:
            return "SRC_QUENCH";
        case 5:
            return "REDIRECT";
        case 8:
            return "ECHO";
        case 11:
            return "TTL_EXCEED";
        case 12:
            return "PARAM_PROB";
        case 13:
            return "TIMESTAMP";
        case 14:
            return "TIMESTAMP_RPL";
        case 15:
            return "INFO_REQ";
        case 16:
            return "INFO_RPL";
        case 17:
            return "ADDR";
        case 18:
            return "ADDR_RPL";
        default:
            return "UNKNOWN";
    }
}

canonical_original_code:
char *IcmpFileName(struct _Packet *p)
{
    if(p->icmph == ((void *)0))
    {
        return "ICMP_TRUNC";
    }
    switch(p->icmph->type)
    {
        case 0:
            return "ECHO_REPLY";
        case 3:
            switch(p->icmph->code)
            {
                case 0:
                    return "NET_UNRCH";
                case 1:
                    return "HST_UNRCH";
                case 2:
                    return "PROTO_UNRCH";
                case 3:
                    return "PORT_UNRCH";
                case 4:
                    return "UNRCH_FRAG_NEEDED";
                case 5:
                    return "UNRCH_SOURCE_ROUTE_FAILED";
                case 6:
                    return "UNRCH_NETWORK_UNKNOWN";
                case 7:
                    return "UNRCH_HOST_UNKNOWN";
                case 8:
                    return "UNRCH_HOST_ISOLATED";
                case 9:
                    return "UNRCH_PKT_FILTERED_NET";
                case 10:
                    return "UNRCH_PKT_FILTERED_HOST";
                case 11:
                    return "UNRCH_NET_UNR_TOS";
                case 12:
                    return "UNRCH_HOST_UNR_TOS";
                case 13:
                    return "UNRCH_PACKET_FILT";
                case 14:
                    return "UNRCH_PREC_VIOL";
                case 15:
                    return "UNRCH_PREC_CUTOFF";
                default:
                    return "UNKNOWN";
            }
        case 4:
            return "SRC_QUENCH";
        case 5:
            return "REDIRECT";
        case 8:
            return "ECHO";
        case 11:
            return "TTL_EXCEED";
        case 12:
            return "PARAM_PROB";
        case 13:
            return "TIMESTAMP";
        case 14:
            return "TIMESTAMP_RPL";
        case 15:
            return "INFO_REQ";
        case 16:
            return "INFO_RPL";
        case 17:
            return "ADDR";
        case 18:
            return "ADDR_RPL";
        default:
            return "UNKNOWN";
    }
}

return_type: char *

user_defined_types: struct _Packet { struct pcap_pkthdr *pkth; unsigned char *pkt; struct _EtherARP *ah; struct _EtherHdr *eh; struct _VlanTagHdr *vh; struct _EthLlc *ehllc; struct _EthLlcOther *ehllcother; struct _GREHdr *greh; unsigned int *mpls; struct _IPHdr *iph; struct _IPHdr *inner_iph; struct _IPHdr *outer_iph; struct _TCPHdr *tcph; struct _UDPHdr *udph; struct _ICMPHdr *icmph; unsigned char *data; unsigned char *ip_data; unsigned char *outer_ip_data; unsigned char *ip_frag_start; unsigned char *ip_options_data; unsigned char *tcp_options_data; void *ssnptr; void *fragtracker; void *flow; void *streamptr; struct _IPv4Hdr *ip4h; struct _IPv6Hdr *ip6h; struct _ICMP6 *icmp6h; struct _IPH_API *iph_api; struct _IPH_API *orig_iph_api; struct _IPH_API *outer_iph_api; struct _IPH_API *outer_orig_iph_api; struct _IPv4Hdr inner_ip4h; struct _IPv6Hdr inner_ip6h; struct _IPv4Hdr outer_ip4h; struct _IPv6Hdr outer_ip6h; struct _MplsHdr mplsHdr; int family; int orig_family; int outer_family; int bytes_to_inspect; unsigned int preprocessor_bits; unsigned int preproc_reassembly_pkt_bits; unsigned int caplen; unsigned int http_pipeline_count; unsigned int packet_flags; unsigned int proto_bits; unsigned short dsize; unsigned short ip_dsize; unsigned short alt_dsize; unsigned short actual_ip_len; unsigned short outer_ip_dsize; unsigned short frag_offset; unsigned short ip_frag_len; unsigned short ip_options_len; unsigned short tcp_options_len; unsigned short sp; unsigned short dp; unsigned short orig_sp; unsigned short orig_dp; short application_protocol_ordinal; unsigned char frag_flag; unsigned char mf; unsigned char df; unsigned char rf; unsigned char uri_count; unsigned char csum_flags; unsigned char encapsulated; unsigned char ip_option_count; unsigned char tcp_option_count; unsigned char ip6_extension_count; unsigned char ip6_frag_index; unsigned char ip_lastopt_bad; unsigned char tcp_lastopt_bad; struct _Fddi_hdr *fddihdr; struct _Fddi_llc_saps *fddisaps; struct _Fddi_llc_sna *fddisna; struct _Fddi_llc_iparp *fddiiparp; struct _Fddi_llc_other *fddiother; struct _Trh_hdr *trh; struct _Trh_llc *trhllc; struct _Trh_mr *trhmr; struct _Pflog1_hdr *pf1h; struct _Pflog2_hdr *pf2h; struct _Pflog3_hdr *pf3h; struct _SLLHdr *sllh; struct _WifiHdr *wifih; struct _PPPoEHdr *pppoeh; struct _EtherEapol *eplh; struct _EAPHdr *eaph; unsigned char *eaptype; struct _EapolKey *eapolk; struct _Options ip_options[40]; struct _Options tcp_options[40]; struct _IP6Option ip6_extensions[40]; unsigned short configPolicyId; int linktype; }

user_defined_types: struct _MplsHdr { unsigned int label; unsigned char exp; unsigned char bos; unsigned char ttl; }

user_defined_types: struct pcap_pkthdr { struct timeval ts; unsigned int caplen; unsigned int len; }

user_defined_types: struct _EtherARP { struct _ARPHdr ea_hdr; unsigned char arp_sha[6]; unsigned char arp_spa[4]; unsigned char arp_tha[6]; unsigned char arp_tpa[4]; }

user_defined_types: struct _EtherHdr { unsigned char ether_dst[6]; unsigned char ether_src[6]; unsigned short ether_type; }

user_defined_types: struct _VlanTagHdr { unsigned short vth_pri_cfi_vlan; unsigned short vth_proto; }

user_defined_types: struct _EthLlc { unsigned char dsap; unsigned char ssap; }

user_defined_types: struct _EthLlcOther { unsigned char ctrl; unsigned char org_code[3]; unsigned short proto_id; }

user_defined_types: struct _GREHdr { unsigned char flags; unsigned char version; unsigned short ether_type; }

user_defined_types: struct _IPHdr { unsigned char ip_verhl; unsigned char ip_tos; unsigned short ip_len; unsigned short ip_id; unsigned short ip_off; unsigned char ip_ttl; unsigned char ip_proto; unsigned short ip_csum; struct in_addr ip_src; struct in_addr ip_dst; }

user_defined_types: struct _TCPHdr { unsigned short th_sport; unsigned short th_dport; unsigned int th_seq; unsigned int th_ack; unsigned char th_offx2; unsigned char th_flags; unsigned short th_win; unsigned short th_sum; unsigned short th_urp; }

user_defined_types: struct _UDPHdr { unsigned short uh_sport; unsigned short uh_dport; unsigned short uh_len; unsigned short uh_chk; }

user_defined_types: struct _ICMPHdr { unsigned char type; unsigned char code; unsigned short csum; union { unsigned char pptr; struct in_addr gwaddr; struct idseq idseq; int sih_void; struct pmtu pmtu; struct rtradv rtradv; } icmp_hun; union { struct ts ts; struct ih_ip ip; struct ra_addr radv; unsigned int mask; char data[1]; } icmp_dun; }

user_defined_types: struct _IPv4Hdr { unsigned char ip_verhl; unsigned char ip_tos; unsigned short ip_len; unsigned short ip_id; unsigned short ip_off; unsigned char ip_ttl; unsigned char ip_proto; unsigned short ip_csum; struct _ip ip_src; struct _ip ip_dst; }

user_defined_types: struct _IPv6Hdr { unsigned int vcl; unsigned short len; unsigned char next; unsigned char hop_lmt; struct _ip ip_src; struct _ip ip_dst; }

user_defined_types: struct _ICMP6 { unsigned char type; unsigned char code; unsigned short csum; }

user_defined_types: struct _IPH_API { struct _ip *(*iph_ret_src)(struct _Packet *); struct _ip *(*iph_ret_dst)(struct _Packet *); unsigned short (*iph_ret_tos)(struct _Packet *); unsigned char (*iph_ret_ttl)(struct _Packet *); unsigned short (*iph_ret_len)(struct _Packet *); unsigned int (*iph_ret_id)(struct _Packet *); unsigned char (*iph_ret_proto)(struct _Packet *); unsigned short (*iph_ret_off)(struct _Packet *); unsigned char (*iph_ret_ver)(struct _Packet *); unsigned char (*iph_ret_hlen)(struct _Packet *); struct _ip *(*orig_iph_ret_src)(struct _Packet *); struct _ip *(*orig_iph_ret_dst)(struct _Packet *); unsigned short (*orig_iph_ret_tos)(struct _Packet *); unsigned char (*orig_iph_ret_ttl)(struct _Packet *); unsigned short (*orig_iph_ret_len)(struct _Packet *); unsigned int (*orig_iph_ret_id)(struct _Packet *); unsigned char (*orig_iph_ret_proto)(struct _Packet *); unsigned short (*orig_iph_ret_off)(struct _Packet *); unsigned char (*orig_iph_ret_ver)(struct _Packet *); unsigned char (*orig_iph_ret_hlen)(struct _Packet *); char ver; }

user_defined_types: struct _Fddi_hdr { unsigned char fc; unsigned char daddr[6]; unsigned char saddr[6]; }

user_defined_types: struct _Fddi_llc_saps { unsigned char dsap; unsigned char ssap; }

user_defined_types: struct _Fddi_llc_sna { unsigned char ctrl_fld[2]; }

user_defined_types: struct _Fddi_llc_iparp { unsigned char ctrl_fld; unsigned char protid[3]; unsigned short ethertype; }

user_defined_types: struct _Fddi_llc_other { unsigned char ctrl_fld[1]; }

user_defined_types: struct _Trh_hdr { unsigned char ac; unsigned char fc; unsigned char daddr[6]; unsigned char saddr[6]; }

user_defined_types: struct _Trh_llc { unsigned char dsap; unsigned char ssap; unsigned char protid[3]; unsigned short ethertype; }

user_defined_types: struct _Trh_mr { unsigned short bcast_len_dir_lf_res; unsigned short rseg[8]; }

user_defined_types: struct _Pflog1_hdr { unsigned int af; char intf[16]; short rule; unsigned short reason; unsigned short action; unsigned short dir; }

user_defined_types: struct _Pflog2_hdr { char length; unsigned char af; unsigned char action; unsigned char reason; char ifname[16]; char ruleset[16]; unsigned int rulenr; unsigned int subrulenr; unsigned char dir; unsigned char pad[3]; }

user_defined_types: struct _Pflog3_hdr { char length; unsigned char af; unsigned char action; unsigned char reason; char ifname[16]; char ruleset[16]; unsigned int rulenr; unsigned int subrulenr; unsigned int uid; unsigned int pid; unsigned int rule_uid; unsigned int rule_pid; unsigned char dir; unsigned char pad[3]; }


LogNull

decompiled_code:
void LogNull()
{
;
}

canonical_decompiled_code:
void func0()
{
;
}

original_code:
void LogNull(Packet *p, void *event, uint32_t event_type, void *arg)
{
    return;
}

canonical_original_code:
void LogNull(struct _Packet *p, void *event, unsigned int event_type, void *arg)
{
    return;
}

variable_types: struct _Packet { struct pcap_pkthdr { struct timeval { long tv_sec; long tv_usec; } ts; unsigned int caplen; unsigned int len; } *pkth; unsigned char *pkt; struct _EtherARP { struct _ARPHdr { unsigned short ar_hrd; unsigned short ar_pro; unsigned char ar_hln; unsigned char ar_pln; unsigned short ar_op; } ea_hdr; unsigned char arp_sha[6]; unsigned char arp_spa[4]; unsigned char arp_tha[6]; unsigned char arp_tpa[4]; } *ah; struct _EtherHdr { unsigned char ether_dst[6]; unsigned char ether_src[6]; unsigned short ether_type; } *eh; struct _VlanTagHdr { unsigned short vth_pri_cfi_vlan; unsigned short vth_proto; } *vh; struct _EthLlc { unsigned char dsap; unsigned char ssap; } *ehllc; struct _EthLlcOther { unsigned char ctrl; unsigned char org_code[3]; unsigned short proto_id; } *ehllcother; struct _GREHdr { unsigned char flags; unsigned char version; unsigned short ether_type; } *greh; unsigned int *mpls; struct _IPHdr { unsigned char ip_verhl; unsigned char ip_tos; unsigned short ip_len; unsigned short ip_id; unsigned short ip_off; unsigned char ip_ttl; unsigned char ip_proto; unsigned short ip_csum; struct in_addr { unsigned int s_addr; } ip_src; struct in_addr ip_dst; } *iph; struct _IPHdr *inner_iph; struct _IPHdr *outer_iph; struct _TCPHdr { unsigned short th_sport; unsigned short th_dport; unsigned int th_seq; unsigned int th_ack; unsigned char th_offx2; unsigned char th_flags; unsigned short th_win; unsigned short th_sum; unsigned short th_urp; } *tcph; struct _UDPHdr { unsigned short uh_sport; unsigned short uh_dport; unsigned short uh_len; unsigned short uh_chk; } *udph; struct _ICMPHdr { unsigned char type; unsigned char code; unsigned short csum; union { unsigned char pptr; struct in_addr gwaddr; struct idseq { unsigned short id; unsigned short seq; } idseq; int sih_void; struct pmtu { unsigned short ipm_void; unsigned short nextmtu; } pmtu; struct rtradv { unsigned char num_addrs; unsigned char wpa; unsigned short lifetime; } rtradv; } icmp_hun; union { struct ts { unsigned int otime; unsigned int rtime; unsigned int ttime; } ts; struct ih_ip { struct _IPHdr *ip; } ip; struct ra_addr { unsigned int addr; unsigned int preference; } radv; unsigned int mask; char data[1]; } icmp_dun; } *icmph; unsigned char *data; unsigned char *ip_data; unsigned char *outer_ip_data; unsigned char *ip_frag_start; unsigned char *ip_options_data; unsigned char *tcp_options_data; void *ssnptr; void *fragtracker; void *flow; void *streamptr; struct _IPv4Hdr { unsigned char ip_verhl; unsigned char ip_tos; unsigned short ip_len; unsigned short ip_id; unsigned short ip_off; unsigned char ip_ttl; unsigned char ip_proto; unsigned short ip_csum; struct _ip { int family; int bits; union { unsigned int u6_addr8[16]; unsigned int u6_addr16[8]; unsigned int u6_addr32[4]; } ip; } ip_src; struct _ip ip_dst; } *ip4h; struct _IPv6Hdr { unsigned int vcl; unsigned short len; unsigned char next; unsigned char hop_lmt; struct _ip ip_src; struct _ip ip_dst; } *ip6h; struct _ICMP6 { unsigned char type; unsigned char code; unsigned short csum; } *icmp6h; struct _IPH_API { struct _ip *(*iph_ret_src)(struct _Packet *); struct _ip *(*iph_ret_dst)(struct _Packet *); unsigned short (*iph_ret_tos)(struct _Packet *); unsigned char (*iph_ret_ttl)(struct _Packet *); unsigned short (*iph_ret_len)(struct _Packet *); unsigned int (*iph_ret_id)(struct _Packet *); unsigned char (*iph_ret_proto)(struct _Packet *); unsigned short (*iph_ret_off)(struct _Packet *); unsigned char (*iph_ret_ver)(struct _Packet *); unsigned char (*iph_ret_hlen)(struct _Packet *); struct _ip *(*orig_iph_ret_src)(struct _Packet *); struct _ip *(*orig_iph_ret_dst)(struct _Packet *); unsigned short (*orig_iph_ret_tos)(struct _Packet *); unsigned char (*orig_iph_ret_ttl)(struct _Packet *); unsigned short (*orig_iph_ret_len)(struct _Packet *); unsigned int (*orig_iph_ret_id)(struct _Packet *); unsigned char (*orig_iph_ret_proto)(struct _Packet *); unsigned short (*orig_iph_ret_off)(struct _Packet *); unsigned char (*orig_iph_ret_ver)(struct _Packet *); unsigned char (*orig_iph_ret_hlen)(struct _Packet *); char ver; } *iph_api; struct _IPH_API *orig_iph_api; struct _IPH_API *outer_iph_api; struct _IPH_API *outer_orig_iph_api; struct _IPv4Hdr inner_ip4h; struct _IPv6Hdr inner_ip6h; struct _IPv4Hdr outer_ip4h; struct _IPv6Hdr outer_ip6h; struct _MplsHdr { unsigned int label; unsigned char exp; unsigned char bos; unsigned char ttl; } mplsHdr; int family; int orig_family; int outer_family; int bytes_to_inspect; unsigned int preprocessor_bits; unsigned int preproc_reassembly_pkt_bits; unsigned int caplen; unsigned int http_pipeline_count; unsigned int packet_flags; unsigned int proto_bits; unsigned short dsize; unsigned short ip_dsize; unsigned short alt_dsize; unsigned short actual_ip_len; unsigned short outer_ip_dsize; unsigned short frag_offset; unsigned short ip_frag_len; unsigned short ip_options_len; unsigned short tcp_options_len; unsigned short sp; unsigned short dp; unsigned short orig_sp; unsigned short orig_dp; short application_protocol_ordinal; unsigned char frag_flag; unsigned char mf; unsigned char df; unsigned char rf; unsigned char uri_count; unsigned char csum_flags; unsigned char encapsulated; unsigned char ip_option_count; unsigned char tcp_option_count; unsigned char ip6_extension_count; unsigned char ip6_frag_index; unsigned char ip_lastopt_bad; unsigned char tcp_lastopt_bad; struct _Fddi_hdr { unsigned char fc; unsigned char daddr[6]; unsigned char saddr[6]; } *fddihdr; struct _Fddi_llc_saps { unsigned char dsap; unsigned char ssap; } *fddisaps; struct _Fddi_llc_sna { unsigned char ctrl_fld[2]; } *fddisna; struct _Fddi_llc_iparp { unsigned char ctrl_fld; unsigned char protid[3]; unsigned short ethertype; } *fddiiparp; struct _Fddi_llc_other { unsigned char ctrl_fld[1]; } *fddiother; struct _Trh_hdr { unsigned char ac; unsigned char fc; unsigned char daddr[6]; unsigned char saddr[6]; } *trh; struct _Trh_llc { unsigned char dsap; unsigned char ssap; unsigned char protid[3]; unsigned short ethertype; } *trhllc; struct _Trh_mr { unsigned short bcast_len_dir_lf_res; unsigned short rseg[8]; } *trhmr; struct _Pflog1_hdr { unsigned int af; char intf[16]; short rule; unsigned short reason; unsigned short action; unsigned short dir; } *pf1h; struct _Pflog2_hdr { char length; unsigned char af; unsigned char action; unsigned char reason; char ifname[16]; char ruleset[16]; unsigned int rulenr; unsigned int subrulenr; unsigned char dir; unsigned char pad[3]; } *pf2h; struct _Pflog3_hdr { char length; unsigned char af; unsigned char action; unsigned char reason; char ifname[16]; char ruleset[16]; unsigned int rulenr; unsigned int subrulenr; unsigned int uid; unsigned int pid; unsigned int rule_uid; unsigned int rule_pid; unsigned char dir; unsigned char pad[3]; } *pf3h; struct _SLLHdr { unsigned short sll_pkttype; unsigned short sll_hatype; unsigned short sll_halen; unsigned char sll_addr[8]; unsigned short sll_protocol; } *sllh; struct _WifiHdr { unsigned short frame_control; unsigned short duration_id; unsigned char addr1[6]; unsigned char addr2[6]; unsigned char addr3[6]; unsigned short seq_control; unsigned char addr4[6]; } *wifih; struct _PPPoEHdr { struct _EtherHdr ethhdr; unsigned char ver_type; unsigned char code; unsigned short session; unsigned short length; } *pppoeh; struct _EtherEapol { unsigned char version; unsigned char eaptype; unsigned short len; } *eplh; struct _EAPHdr { unsigned char code; unsigned char id; unsigned short len; } *eaph; unsigned char *eaptype; struct _EapolKey { unsigned char type; unsigned char length[2]; unsigned char counter[8]; unsigned char iv[16]; unsigned char index; unsigned char sig[16]; } *eapolk; struct _Options { unsigned char code; unsigned char len; unsigned char *data; } ip_options[40]; struct _Options tcp_options[40]; struct _IP6Option { unsigned char type; unsigned char *data; } ip6_extensions[40]; unsigned short configPolicyId; int linktype; } *

variable_types:
event
void *

variable_types:
arg
void *

return_type: void

user_defined_types: struct _Packet { struct pcap_pkthdr *pkth; unsigned char *pkt; struct _EtherARP *ah; struct _EtherHdr *eh; struct _VlanTagHdr *vh; struct _EthLlc *ehllc; struct _EthLlcOther *ehllcother; struct _GREHdr *greh; unsigned int *mpls; struct _IPHdr *iph; struct _IPHdr *inner_iph; struct _IPHdr *outer_iph; struct _TCPHdr *tcph; struct _UDPHdr *udph; struct _ICMPHdr *icmph; unsigned char *data; unsigned char *ip_data; unsigned char *outer_ip_data; unsigned char *ip_frag_start; unsigned char *ip_options_data; unsigned char *tcp_options_data; void *ssnptr; void *fragtracker; void *flow; void *streamptr; struct _IPv4Hdr *ip4h; struct _IPv6Hdr *ip6h; struct _ICMP6 *icmp6h; struct _IPH_API *iph_api; struct _IPH_API *orig_iph_api; struct _IPH_API *outer_iph_api; struct _IPH_API *outer_orig_iph_api; struct _IPv4Hdr inner_ip4h; struct _IPv6Hdr inner_ip6h; struct _IPv4Hdr outer_ip4h; struct _IPv6Hdr outer_ip6h; struct _MplsHdr mplsHdr; int family; int orig_family; int outer_family; int bytes_to_inspect; unsigned int preprocessor_bits; unsigned int preproc_reassembly_pkt_bits; unsigned int caplen; unsigned int http_pipeline_count; unsigned int packet_flags; unsigned int proto_bits; unsigned short dsize; unsigned short ip_dsize; unsigned short alt_dsize; unsigned short actual_ip_len; unsigned short outer_ip_dsize; unsigned short frag_offset; unsigned short ip_frag_len; unsigned short ip_options_len; unsigned short tcp_options_len; unsigned short sp; unsigned short dp; unsigned short orig_sp; unsigned short orig_dp; short application_protocol_ordinal; unsigned char frag_flag; unsigned char mf; unsigned char df; unsigned char rf; unsigned char uri_count; unsigned char csum_flags; unsigned char encapsulated; unsigned char ip_option_count; unsigned char tcp_option_count; unsigned char ip6_extension_count; unsigned char ip6_frag_index; unsigned char ip_lastopt_bad; unsigned char tcp_lastopt_bad; struct _Fddi_hdr *fddihdr; struct _Fddi_llc_saps *fddisaps; struct _Fddi_llc_sna *fddisna; struct _Fddi_llc_iparp *fddiiparp; struct _Fddi_llc_other *fddiother; struct _Trh_hdr *trh; struct _Trh_llc *trhllc; struct _Trh_mr *trhmr; struct _Pflog1_hdr *pf1h; struct _Pflog2_hdr *pf2h; struct _Pflog3_hdr *pf3h; struct _SLLHdr *sllh; struct _WifiHdr *wifih; struct _PPPoEHdr *pppoeh; struct _EtherEapol *eplh; struct _EAPHdr *eaph; unsigned char *eaptype; struct _EapolKey *eapolk; struct _Options ip_options[40]; struct _Options tcp_options[40]; struct _IP6Option ip6_extensions[40]; unsigned short configPolicyId; int linktype; }

user_defined_types: struct pcap_pkthdr { struct timeval ts; unsigned int caplen; unsigned int len; }

user_defined_types: struct _EtherARP { struct _ARPHdr ea_hdr; unsigned char arp_sha[6]; unsigned char arp_spa[4]; unsigned char arp_tha[6]; unsigned char arp_tpa[4]; }

user_defined_types: struct _IPHdr { unsigned char ip_verhl; unsigned char ip_tos; unsigned short ip_len; unsigned short ip_id; unsigned short ip_off; unsigned char ip_ttl; unsigned char ip_proto; unsigned short ip_csum; struct in_addr ip_src; struct in_addr ip_dst; }


LogNullCleanExitFunc

decompiled_code:
void LogNullCleanExitFunc()
{
;
}

canonical_decompiled_code:
void func1()
{
;
}

original_code:
void LogNullCleanExitFunc(int signal, void *arg)
{
    return;
}

variable_types: signal int


LogNullRestartFunc

decompiled_code:
void LogNullRestartFunc()
{
;
}

canonical_decompiled_code:
void func2()
{
;
}

original_code:
void LogNullRestartFunc(int signal, void *arg)
{
    return;
}


LogNullInit

decompiled_code:
__int64 LogNullInit()
{
DebugMessageFile = "spo_log_null.c";
DebugMessageLine = 71;
DebugMessageFunc(4LL, "Output: LogNull Initialized\n");
AddFuncToOutputList(LogNull, 2LL, 0LL);
AddFuncToCleanExitList(LogNullCleanExitFunc, 0LL);
return AddFuncToRestartList(LogNullRestartFunc, 0LL);
}

canonical_decompiled_code:
__int64 func3()
{
DebugMessageFile = "spo_log_null.c";
DebugMessageLine = 71;
DebugMessageFunc(4LL, "Output: LogNull Initialized\n");
AddFuncToOutputList(LogNull, 2LL, 0LL);
AddFuncToCleanExitList(LogNullCleanExitFunc, 0LL);
return AddFuncToRestartList(LogNullRestartFunc, 0LL);
}

original_code:
void LogNullInit(char *args)
{
    DebugMessageFile = "spo_log_null.c"; DebugMessageLine = 71; DebugMessageFunc(0x00000004, "Output: LogNull Initialized\n");;
    AddFuncToOutputList(LogNull, OUTPUT_TYPE__LOG, ((void *)0));
    AddFuncToCleanExitList(LogNullCleanExitFunc, ((void *)0));
    AddFuncToRestartList(LogNullRestartFunc, ((void *)0));
}

variable_types:
args
char *


LogNullSetup

decompiled_code:
__int64 LogNullSetup()
{
RegisterOutputPlugin("log_null", 2LL, LogNullInit);
DebugMessageFile = "spo_log_null.c";
DebugMessageLine = 65;
return DebugMessageFunc(4LL, "Output plugin: LogNull is setup...\n");
}

canonical_decompiled_code:
__int64 func4()
{
RegisterOutputPlugin("log_null", 2LL, LogNullInit);
DebugMessageFile = "spo_log_null.c";
DebugMessageLine = 65;
return DebugMessageFunc(4LL, "Output plugin: LogNull is setup...\n");
}

original_code:
void LogNullSetup(void)
{
    RegisterOutputPlugin("log_null", OUTPUT_TYPE_FLAG__LOG, LogNullInit);
    DebugMessageFile = "spo_log_null.c"; DebugMessageLine = 65; DebugMessageFunc(0x00000004, "Output plugin: LogNull is setup...\n");;
}

canonical_original_code:
void LogNullSetup()
{
    RegisterOutputPlugin("log_null", OUTPUT_TYPE_FLAG__LOG, LogNullInit);
    DebugMessageFile = "spo_log_null.c"; DebugMessageLine = 65; DebugMessageFunc(0x00000004, "Output plugin: LogNull is setup...\n");;
}


BcDaemonMode

decompiled_code:
__int64 BcDaemonMode()
{
return *(_DWORD *)(barnyard2_conf + 8LL) & 2;
}

canonical_decompiled_code:
__int64 func0()
{
return *(_DWORD *)(barnyard2_conf + 8LL) & 2;
}

original_code:
static inline int BcDaemonMode(void)
{
    return barnyard2_conf->run_flags & RUN_FLAG__DAEMON;
}

canonical_original_code:
static inline int BcDaemonMode()
{
    return barnyard2_conf->run_flags & RUN_FLAG__DAEMON;
}

return_type: int


GetDebugLevel

decompiled_code:
__int64 GetDebugLevel()
{
char *v1; // rax

if ( debug_init_1 )
return (unsigned int)debug_level_0;
v1 = getenv("BARNYARD2_DEBUG");
if ( v1 )
debug_level_0 = strtoul(v1, 0LL, 0);
else
debug_level_0 = 0;
debug_init_1 = 1;
return (unsigned int)debug_level_0;
}

canonical_decompiled_code:
__int64 func1()
{
char *v1; // rax

if ( debug_init_1 )
return (unsigned int)debug_level_0;
v1 = getenv("BARNYARD2_DEBUG");
if ( v1 )
debug_level_0 = strtoul(v1, 0LL, 0);
else
debug_level_0 = 0;
debug_init_1 = 1;
return (unsigned int)debug_level_0;
}

original_code:
int GetDebugLevel(void)
{
    static int debug_init = 0;
    static unsigned int debug_level = 0;
    const char* key;
    if (debug_init)
        return debug_level;
    key = getenv("BARNYARD2_DEBUG");
    if ( key )
        debug_level = strtoul(key, ((void *)0), 0);
    else
        debug_level = 0;
    debug_init = 1;
    return debug_level;
}

canonical_original_code:
int GetDebugLevel()
{
    static int debug_init = 0;
    static unsigned int debug_level = 0;
    char *key;
    if (debug_init)
        return debug_level;
    key = getenv("BARNYARD2_DEBUG");
    if ( key )
        debug_level = strtoul(key, ((void *)0), 0);
    else
        debug_level = 0;
    debug_init = 1;
    return debug_level;
}

variable_types:
key
char *


DebugThis

decompiled_code:
_BOOL8 __fastcall DebugThis(int a1)
{
return (a1 & (unsigned int)GetDebugLevel()) != 0;
}

canonical_decompiled_code:
_BOOL8 __fastcall func2(int a1)
{
return (a1 & (unsigned int)func1()) != 0;
}

original_code:
int DebugThis(int level)
{
    if (!(level & GetDebugLevel()))
        return 0;
    return 1;
}

variable_types: level int


DebugMessageFunc

decompiled_code:
void DebugMessageFunc(int a1, const char *a2, ...)
{
size_t v3; // rax
char *v4; // rdi
int v5; // esi
char s[1032]; // [rsp+0h] [rbp-4E8h] BYREF
gcc_va_list arg; // [rsp+408h] [rbp-E0h] BYREF

if ( (a1 & (unsigned int)GetDebugLevel()) != 0 )
{
va_start(arg, a2);
if ( barnyard2_conf && (unsigned int)BcDaemonMode() )
{
s[1023] = 0;
if ( DebugMessageFile )
{
snprintf(s, 0x3FFuLL, "%s:%d: ", (const char *)DebugMessageFile, (unsigned int)DebugMessageLine);
v3 = strlen(s);
v4 = &s[v3];
v5 = 1024 - v3;
}
else
{
v4 = s;
v5 = 1024;
}
vsnprintf(v4, v5 - 1, a2, arg);
syslog(31, "%s", s);
}
else
{
if ( DebugMessageFile )
printf("%s:%d: ", (const char *)DebugMessageFile, (unsigned int)DebugMessageLine);
vprintf(a2, arg);
}
}
}

canonical_decompiled_code:
void func3(int a1, const char *a2, ...)
{
size_t v3; // rax
char *v4; // rdi
int v5; // esi
char s[1032]; // [rsp+0h] [rbp-4E8h] BYREF
gcc_va_list arg; // [rsp+408h] [rbp-E0h] BYREF

if ( (a1 & (unsigned int)func1()) != 0 )
{
va_start(arg, a2);
if ( barnyard2_conf && (unsigned int)func0() )
{
s[1023] = 0;
if ( DebugMessageFile )
{
snprintf(s, 0x3FFuLL, "%s:%d: ", (const char *)DebugMessageFile, (unsigned int)DebugMessageLine);
v3 = strlen(s);
v4 = &s[v3];
v5 = 1024 - v3;
}
else
{
v4 = s;
v5 = 1024;
}
vsnprintf(v4, v5 - 1, a2, arg);
syslog(31, "%s", s);
}
else
{
if ( DebugMessageFile )
printf("%s:%d: ", (const char *)DebugMessageFile, (unsigned int)DebugMessageLine);
vprintf(a2, arg);
}
}
}

original_code:
void DebugMessageFunc(int level, char *fmt, ...)
{
    va_list ap;
    if (!(level & GetDebugLevel()))
        return;
    __builtin_va_start(ap,fmt);
    if ((barnyard2_conf != ((void *)0)) && BcDaemonMode())
    {
        char buf[1024];
        int buf_len = sizeof(buf);
        char *buf_ptr = buf;
        buf[buf_len - 1] = '\0';
        if (DebugMessageFile != ((void *)0))
        {
            snprintf(buf, buf_len - 1, "%s:%d: ",
                    DebugMessageFile, DebugMessageLine);
            buf_ptr += strlen(buf);
            buf_len -= strlen(buf);
        }
        vsnprintf(buf_ptr, buf_len - 1, fmt, ap);
        syslog((3<<3) | 7, "%s", buf);
    }
    else
    {
        if (DebugMessageFile != ((void *)0))
            printf("%s:%d: ", DebugMessageFile, DebugMessageLine);
        vprintf(fmt, ap);
    }
    __builtin_va_end(ap);
}

canonical_original_code:
void DebugMessageFunc(int level, char *fmt, ...)
{
    __builtin_va_list ap;
    if (!(level & GetDebugLevel()))
        return;
    __builtin_va_start(ap,fmt);
    if ((barnyard2_conf != ((void *)0)) && BcDaemonMode())
    {
        char buf[1024];
        int buf_len = sizeof(buf);
        char *buf_ptr = buf;
        buf[buf_len - 1] = '\0';
        if (DebugMessageFile != ((void *)0))
        {
            snprintf(buf, buf_len - 1, "%s:%d: ",
                    DebugMessageFile, DebugMessageLine);
            buf_ptr += strlen(buf);
            buf_len -= strlen(buf);
        }
        vsnprintf(buf_ptr, buf_len - 1, fmt, ap);
        syslog((3<<3) | 7, "%s", buf);
    }
    else
    {
        if (DebugMessageFile != ((void *)0))
            printf("%s:%d: ", DebugMessageFile, DebugMessageLine);
        vprintf(fmt, ap);
    }
    __builtin_va_end(ap);
}

variable_types:
fmt
char *

variable_types:
buf
char [1024]


DebugWideMessageFunc

decompiled_code:
int DebugWideMessageFunc(int a1, const wchar_t *a2, ...)
{
int result; // eax
wchar_t v3[1026]; // [rsp+0h] [rbp-10E8h] BYREF
gcc_va_list arg; // [rsp+1008h] [rbp-E0h] BYREF

result = GetDebugLevel();
if ( (a1 & result) != 0 )
{
v3[1024] = 0;
if ( DebugMessageFile )
printf("%s:%d: ", (const char *)DebugMessageFile, (unsigned int)DebugMessageLine);
va_start(arg, a2);
if ( (unsigned int)BcDaemonMode() )
result = vswprintf(v3, 0x400uLL, a2, arg);
else
result = vwprintf(a2, arg);
}
return result;
}

canonical_decompiled_code:
int func4(int a1, const wchar_t *a2, ...)
{
int result; // eax
wchar_t v3[1026]; // [rsp+0h] [rbp-10E8h] BYREF
gcc_va_list arg; // [rsp+1008h] [rbp-E0h] BYREF

result = func1();
if ( (a1 & result) != 0 )
{
v3[1024] = 0;
if ( DebugMessageFile )
printf("%s:%d: ", (const char *)DebugMessageFile, (unsigned int)DebugMessageLine);
va_start(arg, a2);
if ( (unsigned int)func0() )
result = vswprintf(v3, 0x400uLL, a2, arg);
else
result = vwprintf(a2, arg);
}
return result;
}

original_code:
void DebugWideMessageFunc(int level, wchar_t *fmt, ...)
{
    va_list ap;
    wchar_t buf[1024 +1];
    if (!(level & GetDebugLevel()))
    {
        return;
    }
    buf[1024]= (wchar_t)0;
    if (DebugMessageFile != ((void *)0))
        printf("%s:%d: ", DebugMessageFile, DebugMessageLine);
    __builtin_va_start(ap,fmt);
    if(BcDaemonMode())
    {
        vswprintf(buf, 1024, fmt, ap);
    }
    else
    {
        vwprintf(fmt, ap);
    }
    __builtin_va_end(ap);
}

canonical_original_code:
void DebugWideMessageFunc(int level, int *fmt, ...)
{
    __builtin_va_list ap;
    int buf[-1];
    if (!(level & GetDebugLevel()))
    {
        return;
    }
    buf[1024]= (int)0;
    if (DebugMessageFile != ((void *)0))
        printf("%s:%d: ", DebugMessageFile, DebugMessageLine);
    __builtin_va_start(ap,fmt);
    if(BcDaemonMode())
    {
        vswprintf(buf, 1024, fmt, ap);
    }
    else
    {
        vwprintf(fmt, ap);
    }
    __builtin_va_end(ap);
}

variable_types:
fmt
int *

variable_types:
buf
int [-1]


decompiled_code:
void __fastcall sfmemcap_delete(void *a1)
{
if ( a1 )
free(a1);
}

canonical_decompiled_code:
void __fastcall func1(void *a1)
{
if ( a1 )
free(a1);
}

original_code:
void sfmemcap_delete( MEMCAP * p )
{
     if(p)free( p );
}

canonical_original_code:
void sfmemcap_delete(struct MEMCAP *p)
{
     if(p)free( p );
}

variable_types: struct MEMCAP { unsigned int memused; unsigned int memcap; int nblocks; } *


decompiled_code:
void __fastcall sfmemcap_free(_DWORD *a1, __int64 a2)
{
*a1 -= *(_QWORD *)(a2 - 8);
--a1[2];
free((void *)(a2 - 8));
}

original_code:
void sfmemcap_free( MEMCAP * mc, void * p )
{
   long * q;
   q = (long*)p;
   q--;
   mc->memused -= (unsigned)(*q);
   mc->nblocks--;
   free(q);
}

canonical_original_code:
void sfmemcap_free(struct MEMCAP *mc, void *p)
{
   long *q;
   q = (long *)p;
   q--;
   mc->memused -= (unsigned int)(*q);
   mc->nblocks--;
   free(q);
}

variable_types:
p
void *

variable_types:
q
long *

user_defined_types: struct MEMCAP { unsigned int memused; unsigned int memcap; int nblocks; }


decompiled_code:
int __fastcall sfmemcap_showmem(unsigned int *a1)
{
fprintf(stderr, "memcap: memcap = %u bytes,", a1[1]);
fprintf(stderr, " memused= %u bytes,", *a1);
return fprintf(stderr, " nblocks= %d blocks\n", a1[2]);
}

canonical_decompiled_code:
int __fastcall func3(unsigned int *a1)
{
fprintf(stderr, "memcap: memcap = %u bytes,", a1[1]);
fprintf(stderr, " memused= %u bytes,", *a1);
return fprintf(stderr, " nblocks= %d blocks\n", a1[2]);
}

original_code:
void sfmemcap_showmem( MEMCAP * mc )
{
     fprintf(stderr, "memcap: memcap = %u bytes,",mc->memcap);
     fprintf(stderr, " memused= %u bytes,",mc->memused);
     fprintf(stderr, " nblocks= %d blocks\n",mc->nblocks);
}

canonical_original_code:
void sfmemcap_showmem(struct MEMCAP *mc)
{
     fprintf(stderr, "memcap: memcap = %u bytes,",mc->memcap);
     fprintf(stderr, " memused= %u bytes,",mc->memused);
     fprintf(stderr, " nblocks= %d blocks\n",mc->nblocks);
}


BcAlertInterface

decompiled_code:
__int64 BcAlertInterface()
{
return *(_DWORD *)(barnyard2_conf + 12LL) & 0x200;
}

canonical_decompiled_code:
__int64 func0()
{
return *(_DWORD *)(barnyard2_conf + 12LL) & 0x200;
}

original_code:
static inline int BcAlertInterface(void)
{
    return barnyard2_conf->output_flags & OUTPUT_FLAG__ALERT_IFACE;
}

canonical_original_code:
static inline int BcAlertInterface()
{
    return barnyard2_conf->output_flags & OUTPUT_FLAG__ALERT_IFACE;
}


BcObfuscate

decompiled_code:
__int64 BcObfuscate()
{
return *(_DWORD *)(barnyard2_conf + 12LL) & 0x100;
}

canonical_decompiled_code:
__int64 func1()
{
return *(_DWORD *)(barnyard2_conf + 12LL) & 0x100;
}

original_code:
static inline int BcObfuscate(void)
{
    return barnyard2_conf->output_flags & OUTPUT_FLAG__OBFUSCATE;
}

canonical_original_code:
static inline int BcObfuscate()
{
    return barnyard2_conf->output_flags & OUTPUT_FLAG__OBFUSCATE;
}


BcOutputAppData

decompiled_code:
__int64 BcOutputAppData()
{
return *(_DWORD *)(barnyard2_conf + 12LL) & 8;
}

canonical_decompiled_code:
__int64 func2()
{
return *(_DWORD *)(barnyard2_conf + 12LL) & 8;
}

original_code:
static inline int BcOutputAppData(void)
{
    return barnyard2_conf->output_flags & OUTPUT_FLAG__APP_DATA;
}

canonical_original_code:
static inline int BcOutputAppData()
{
    return barnyard2_conf->output_flags & OUTPUT_FLAG__APP_DATA;
}


AlertFastRestartFunc

decompiled_code:
void __fastcall AlertFastRestartFunc(__int64 a1, _QWORD *a2)
{
AlertFastCleanup(a1, a2, "AlertFastRestartFunc");
}

canonical_decompiled_code:
void __fastcall func4(__int64 a1, _QWORD *a2)
{
func3(a1, a2, "AlertFastRestartFunc");
}

original_code:
static void AlertFastRestartFunc(int signal, void *arg)
{
    AlertFastCleanup(signal, arg, "AlertFastRestartFunc");
}


AlertFastCleanExitFunc

decompiled_code:
void __fastcall AlertFastCleanExitFunc(__int64 a1, _QWORD *a2)
{
AlertFastCleanup(a1, a2, "AlertFastCleanExitFunc");
}

canonical_decompiled_code:
void __fastcall func5(__int64 a1, _QWORD *a2)
{
func3(a1, a2, "AlertFastCleanExitFunc");
}

original_code:
static void AlertFastCleanExitFunc(int signal, void *arg)
{
    AlertFastCleanup(signal, arg, "AlertFastCleanExitFunc");
}


AlertFastSetup

decompiled_code:
__int64 AlertFastSetup()
{
RegisterOutputPlugin("alert_fast", 1LL, AlertFastInit);
DebugMessageFile = "spo_alert_fast.c";
DebugMessageLine = 115;
return DebugMessageFunc(1LL, "Output plugin: AlertFast is setup...\n");
}

canonical_decompiled_code:
__int64 func12()
{
RegisterOutputPlugin("alert_fast", 1LL, AlertFastInit);
DebugMessageFile = "spo_alert_fast.c";
DebugMessageLine = 115;
return DebugMessageFunc(1LL, "Output plugin: AlertFast is setup...\n");
}

original_code:
void AlertFastSetup(void)
{
    RegisterOutputPlugin("alert_fast", OUTPUT_TYPE_FLAG__ALERT, AlertFastInit);
    DebugMessageFile = "spo_alert_fast.c"; DebugMessageLine = 115; DebugMessageFunc(0x00000001,"Output plugin: AlertFast is setup...\n");;
}

canonical_original_code:
void AlertFastSetup()
{
    RegisterOutputPlugin("alert_fast", OUTPUT_TYPE_FLAG__ALERT, AlertFastInit);
    DebugMessageFile = "spo_alert_fast.c"; DebugMessageLine = 115; DebugMessageFunc(0x00000001,"Output plugin: AlertFast is setup...\n");;
}


AlertTestSetup

decompiled_code:
__int64 AlertTestSetup()
{
RegisterOutputPlugin("alert_test", 1LL, AlertTestInit);
DebugMessageFile = "spo_alert_test.c";
DebugMessageLine = 127;
return DebugMessageFunc(1LL, "Output plugin: AlertTest is setup...\n");
}

canonical_decompiled_code:
__int64 func4()
{
RegisterOutputPlugin("alert_test", 1LL, AlertTestInit);
DebugMessageFile = "spo_alert_test.c";
DebugMessageLine = 127;
return DebugMessageFunc(1LL, "Output plugin: AlertTest is setup...\n");
}

original_code:
void AlertTestSetup(void)
{
    RegisterOutputPlugin("alert_test", OUTPUT_TYPE_FLAG__ALERT, AlertTestInit);
    DebugMessageFile = "spo_alert_test.c"; DebugMessageLine = 127; DebugMessageFunc(0x00000001,"Output plugin: AlertTest is setup...\n");;
}

canonical_original_code:
void AlertTestSetup()
{
    RegisterOutputPlugin("alert_test", OUTPUT_TYPE_FLAG__ALERT, AlertTestInit);
    DebugMessageFile = "spo_alert_test.c"; DebugMessageLine = 127; DebugMessageFunc(0x00000001,"Output plugin: AlertTest is setup...\n");;
}


BcOutputUseUtc

decompiled_code:
__int64 BcOutputUseUtc()
{
return *(_DWORD *)(barnyard2_conf + 12LL) & 0x40;
}

canonical_decompiled_code:
__int64 func0()
{
return *(_DWORD *)(barnyard2_conf + 12LL) & 0x40;
}

original_code:
static inline int BcOutputUseUtc(void)
{
    return barnyard2_conf->output_flags & OUTPUT_FLAG__USE_UTC;
}

canonical_original_code:
static inline int BcOutputUseUtc()
{
    return barnyard2_conf->output_flags & OUTPUT_FLAG__USE_UTC;
}


original_code:
void syslog_timestamp(uint32_t sec, uint32_t usec, char *timebuf)
{
    register int s;
    int localzone;
    time_t Time;
    struct tm *lt;
 char *arr_month[] = {"Jan", "Feb", "Mar", "Apr", "May",
          "Jun", "Jul", "Aug", "Sep", "Oct",
          "Nov", "Dec"};
    localzone = barnyard2_conf->thiszone;
    if(BcOutputUseUtc())
        localzone = 0;
    s = (sec + localzone) % 86400;
    Time = (sec + localzone) - s;
    lt = gmtime(&Time);
    SnortSnprintf(timebuf, 26, "%s %2d %02d:%02d:%02d",
  arr_month[lt->tm_mon], lt->tm_mday, s / 3600, (s % 3600) / 60, s % 60);
}

canonical_original_code:
void syslog_timestamp(unsigned int sec, unsigned int usec, char *timebuf)
{
    register int s;
    int localzone;
    long Time;
    struct tm *lt;
 char *arr_month[] = {"Jan", "Feb", "Mar", "Apr", "May",
          "Jun", "Jul", "Aug", "Sep", "Oct",
          "Nov", "Dec"};
    localzone = barnyard2_conf->thiszone;
    if(BcOutputUseUtc())
        localzone = 0;
    s = (sec + localzone) % 86400;
    Time = (sec + localzone) - s;
    lt = gmtime(&Time);
    SnortSnprintf(timebuf, 26, "%s %2d %02d:%02d:%02d",
  arr_month[lt->tm_mon], lt->tm_mday, s / 3600, (s % 3600) / 60, s % 60);
}

variable_types:
sec
unsigned int

variable_types:
usec
unsigned int

variable_types:
timebuf
char *

variable_types: s int

variable_types: localzone int

variable_types: Time long

variable_types: struct tm { int tm_sec; int tm_min; int tm_hour; int tm_mday; int tm_mon; int tm_year; int tm_wday; int tm_yday; int tm_isdst; long tm_gmtoff; char *tm_zone; } *


repo: oberhofer/luacwrap

decompiled_code:
int __fastcall luaaux_printPreDump(unsigned int a1)
{
wprintf(&LC13);
return wprintf(&LC14, a1);
}

canonical_decompiled_code:
int __fastcall func1(unsigned int a1)
{
wprintf(&LC13);
return wprintf(&LC14, a1);
}

original_code:
void luaaux_printPreDump(int expected) {
  wprintf(L"STACK DUMP\n");
  wprintf(L"Expected size: %i\n",expected);
}

variable_types: expected int


decompiled_code:
char *__fastcall luaaux_makeLuaErrorMessage(int a1, const char *a2)
{
char *result; // rax
size_t v3; // rax
size_t v4; // rax
size_t v5; // rax

message_0[0] = 0;
result = "No error";
if ( a1 )
{
switch ( a1 )
{
case 4:
strcpy(message_0, "Lua memory allocation error.");
result = message_0;
break;
case 5:
strcpy(message_0, "Lua error: error during error handler execution.");
result = message_0;
break;
case 2:
v3 = strlen(message_0);
strncat(message_0, "Lua runtime error", 999 - v3);
result = message_0;
if ( a2 )
{
v4 = strlen(message_0);
strncat(message_0, ": ", 999 - v4);
v5 = strlen(message_0);
strncat(message_0, a2, 999 - v5);
result = message_0;
}
break;
default:
strcpy(message_0, "Unknown Lua error.");
result = message_0;
break;
}
}
return result;
}

canonical_decompiled_code:
char *__fastcall func3(int a1, const char *a2)
{
char *result; // rax
size_t v3; // rax
size_t v4; // rax
size_t v5; // rax

message_0[0] = 0;
result = "No error";
if ( a1 )
{
switch ( a1 )
{
case 4:
strcpy(message_0, "Lua memory allocation error.");
result = message_0;
break;
case 5:
strcpy(message_0, "Lua error: error during error handler execution.");
result = message_0;
break;
case 2:
v3 = strlen(message_0);
strncat(message_0, "Lua runtime error", 999 - v3);
result = message_0;
if ( a2 )
{
v4 = strlen(message_0);
strncat(message_0, ": ", 999 - v4);
v5 = strlen(message_0);
strncat(message_0, a2, 999 - v5);
result = message_0;
}
break;
default:
strcpy(message_0, "Unknown Lua error.");
result = message_0;
break;
}
}
return result;
}

original_code:
const char* luaaux_makeLuaErrorMessage(int return_value, const char* msg)
{
  static char message[1000];
  message[0] = '\0';
  if(return_value == 0)
    return "No error";
  switch(return_value)
  {
    case 2:
      {
        strncat(message,
          "Lua runtime error",
          sizeof(message) - strlen(message) - 1);
        if(msg)
        {
          strncat(message, ": ", sizeof(message) - strlen(message) - 1);
          strncat(message, msg, sizeof(message) - strlen(message) - 1);
        }
      }
      break;
    case 4:
      strcpy(message, "Lua memory allocation error.");
      break;
    case 5:
      strcpy(message, "Lua error: error during error handler execution.");
      break;
    default:
      strcpy(message, "Unknown Lua error.");
      break;
  }
  return message;
}

canonical_original_code:
char *luaaux_makeLuaErrorMessage(int return_value, char *msg)
{
  static char message[1000];
  message[0] = '\0';
  if(return_value == 0)
    return "No error";
  switch(return_value)
  {
    case 2:
      {
        strncat(message,
          "Lua runtime error",
          sizeof(message) - strlen(message) - 1);
        if(msg)
        {
          strncat(message, ": ", sizeof(message) - strlen(message) - 1);
          strncat(message, msg, sizeof(message) - strlen(message) - 1);
        }
      }
      break;
    case 4:
      strcpy(message, "Lua memory allocation error.");
      break;
    case 5:
      strcpy(message, "Lua error: error during error handler execution.");
      break;
    default:
      strcpy(message, "Unknown Lua error.");
      break;
  }
  return message;
}

variable_types:
msg
char *

variable_types:
message
char [1000]


repo: obijywk/footswitch

decompiled_code:
__int64 __fastcall resolve_device_path(char *resolved)
{
const char *v1; // rbx
size_t v2; // rbx
ssize_t v3; // rax
__int64 result; // rax
int *v5; // rax
int *v6; // rax
char buf[4120]; // [rsp+0h] [rbp-1018h] BYREF

v1 = symbolic_device_dir;
strcpy(buf, symbolic_device_dir);
strcat(buf, symbolic_device_name);
v2 = strlen(v1);
v3 = readlink(buf, &buf[v2], 4096 - v2);
if ( v3 == -1 )
{
v5 = __errno_location();
fprintf(stderr, "readlink failed, err %d\n", (unsigned int)*v5);
result = 0xFFFFFFFFLL;
}
else
{
buf[v2 + v3] = 0;
if ( realpath(buf, resolved) )
{
result = 0LL;
}
else
{
v6 = __errno_location();
fprintf(stderr, "realpath failed, err %d\n", (unsigned int)*v6);
result = 0xFFFFFFFFLL;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func8(char *resolved)
{
const char *v1; // rbx
size_t v2; // rbx
ssize_t v3; // rax
__int64 result; // rax
int *v5; // rax
int *v6; // rax
char buf[4120]; // [rsp+0h] [rbp-1018h] BYREF

v1 = symbolic_device_dir;
strcpy(buf, symbolic_device_dir);
strcat(buf, symbolic_device_name);
v2 = strlen(v1);
v3 = readlink(buf, &buf[v2], 4096 - v2);
if ( v3 == -1 )
{
v5 = __errno_location();
fprintf(stderr, "readlink failed, err %d\n", (unsigned int)*v5);
result = 0xFFFFFFFFLL;
}
else
{
buf[v2 + v3] = 0;
if ( realpath(buf, resolved) )
{
result = 0LL;
}
else
{
v6 = __errno_location();
fprintf(stderr, "realpath failed, err %d\n", (unsigned int)*v6);
result = 0xFFFFFFFFLL;
}
}
return result;
}

original_code:
int resolve_device_path(char* device) {
  char path_temp[4096];
  strcpy(path_temp, symbolic_device_dir);
  strcat(path_temp, symbolic_device_name);
  ssize_t symbolic_device_dir_len = strlen(symbolic_device_dir);
  ssize_t resolved_len = readlink(
      path_temp,
      path_temp + symbolic_device_dir_len,
      sizeof(path_temp) - symbolic_device_dir_len);
  if (resolved_len == -1) {
    fprintf(stderr, "readlink failed, err %d\n", (*__errno_location ()));
    return -1;
  }
  path_temp[symbolic_device_dir_len + resolved_len] = 0;
  if (realpath(path_temp, device) == ((void *)0)) {
    fprintf(stderr, "realpath failed, err %d\n", (*__errno_location ()));
    return -1;
  }
  return 0;
}

canonical_original_code:
int resolve_device_path(char *device) {
  char path_temp[4096];
  strcpy(path_temp, symbolic_device_dir);
  strcat(path_temp, symbolic_device_name);
  long symbolic_device_dir_len = strlen(symbolic_device_dir);
  long resolved_len = readlink(
      path_temp,
      path_temp + symbolic_device_dir_len,
      sizeof(path_temp) - symbolic_device_dir_len);
  if (resolved_len == -1) {
    fprintf(stderr, "readlink failed, err %d\n", (*__errno_location ()));
    return -1;
  }
  path_temp[symbolic_device_dir_len + resolved_len] = 0;
  if (realpath(path_temp, device) == ((void *)0)) {
    fprintf(stderr, "realpath failed, err %d\n", (*__errno_location ()));
    return -1;
  }
  return 0;
}

variable_types:
device
char *


decompiled_code:
__int64 __fastcall open_device(const char *a1)
{
int v1; // eax
unsigned int v2; // ebx
int *v4; // rax
int *v5; // rax

v1 = open(a1, 0);
v2 = v1;
if ( v1 == -1 )
{
v4 = __errno_location();
fprintf(stderr, "failed to open device, err %d\n", (unsigned int)*v4);
}
else if ( ioctl(v1, 0x40044590uLL, 1LL) == -1 )
{
v5 = __errno_location();
fprintf(stderr, "failed to get exclusive access, err %d\n", (unsigned int)*v5);
v2 = -1;
}
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func9(const char *a1)
{
int v1; // eax
unsigned int v2; // ebx
int *v4; // rax
int *v5; // rax

v1 = open(a1, 0);
v2 = v1;
if ( v1 == -1 )
{
v4 = __errno_location();
fprintf(stderr, "failed to open device, err %d\n", (unsigned int)*v4);
}
else if ( ioctl(v1, 0x40044590uLL, 1LL) == -1 )
{
v5 = __errno_location();
fprintf(stderr, "failed to get exclusive access, err %d\n", (unsigned int)*v5);
v2 = -1;
}
return v2;
}

original_code:
int open_device(char* device) {
  int fevdev = open(device, 00);
  if (fevdev == -1) {
    fprintf(stderr, "failed to open device, err %d\n", (*__errno_location ()));
    return -1;
  }
  int result = ioctl(fevdev, (((1U) << (((0 +8)+8)+14)) | ((('E')) << (0 +8)) | (((0x90)) << 0) | ((((sizeof(int)))) << ((0 +8)+8))), 1);
  if (result == -1) {
    fprintf(stderr, "failed to get exclusive access, err %d\n", (*__errno_location ()));
    return -1;
  }
  return fevdev;
}

canonical_original_code:
int open_device(char *device) {
  int fevdev = open(device, 00);
  if (fevdev == -1) {
    fprintf(stderr, "failed to open device, err %d\n", (*__errno_location ()));
    return -1;
  }
  int result = ioctl(fevdev, (((1U) << (((0 +8)+8)+14)) | ((('E')) << (0 +8)) | (((0x90)) << 0) | ((((sizeof(int)))) << ((0 +8)+8))), 1);
  if (result == -1) {
    fprintf(stderr, "failed to get exclusive access, err %d\n", (*__errno_location ()));
    return -1;
  }
  return fevdev;
}

variable_types: fevdev int

variable_types: result int


decompiled_code:
__int64 open_broadcast_socket()
{
int v0; // eax
unsigned int v1; // ebx
__int16 v2; // bp
int *v4; // rax
int *v5; // rax
int *v6; // rax
struct sockaddr v7; // [rsp+0h] [rbp-38h] BYREF
int optval[7]; // [rsp+1Ch] [rbp-1Ch] BYREF

v0 = socket(2, 2, 0);
v1 = v0;
socket_fd = v0;
if ( v0 == -1 )
{
v4 = __errno_location();
fprintf(stderr, "failed to create socket, err %d\n", (unsigned int)*v4);
}
else
{
optval[0] = 1;
v1 = setsockopt(v0, 1, 6, optval, 4u);
if ( v1 == -1 )
{
v5 = __errno_location();
fprintf(stderr, "failed to broadcast enable socket, err %d\n", (unsigned int)*v5);
}
else
{
*(_QWORD *)&v7.sa_family = 2LL;
*(_QWORD *)&v7.sa_data[6] = 0LL;
v2 = _bswap_16(58710);
*(_WORD *)v7.sa_data = v2;
v1 = bind(socket_fd, &v7, 0x10u);
if ( v1 == -1 )
{
v6 = __errno_location();
fprintf(stderr, "failed to bind to socket, err %d\n", (unsigned int)*v6);
}
else
{
*(_QWORD *)&socket_addr.sa_family = 2LL;
*(_QWORD *)&socket_addr.sa_data[6] = 0LL;
*(_DWORD *)&socket_addr.sa_data[2] = inet_addr("255.255.255.255");
*(_WORD *)socket_addr.sa_data = v2;
v1 = 0;
}
}
}
return v1;
}

canonical_decompiled_code:
__int64 func10()
{
int v0; // eax
unsigned int v1; // ebx
__int16 v2; // bp
int *v4; // rax
int *v5; // rax
int *v6; // rax
struct sockaddr v7; // [rsp+0h] [rbp-38h] BYREF
int optval[7]; // [rsp+1Ch] [rbp-1Ch] BYREF

v0 = socket(2, 2, 0);
v1 = v0;
socket_fd = v0;
if ( v0 == -1 )
{
v4 = __errno_location();
fprintf(stderr, "failed to create socket, err %d\n", (unsigned int)*v4);
}
else
{
optval[0] = 1;
v1 = setsockopt(v0, 1, 6, optval, 4u);
if ( v1 == -1 )
{
v5 = __errno_location();
fprintf(stderr, "failed to broadcast enable socket, err %d\n", (unsigned int)*v5);
}
else
{
*(_QWORD *)&v7.sa_family = 2LL;
*(_QWORD *)&v7.sa_data[6] = 0LL;
v2 = func7(58710);
*(_WORD *)v7.sa_data = v2;
v1 = bind(socket_fd, &v7, 0x10u);
if ( v1 == -1 )
{
v6 = __errno_location();
fprintf(stderr, "failed to bind to socket, err %d\n", (unsigned int)*v6);
}
else
{
*(_QWORD *)&socket_addr.sa_family = 2LL;
*(_QWORD *)&socket_addr.sa_data[6] = 0LL;
*(_DWORD *)&socket_addr.sa_data[2] = inet_addr("255.255.255.255");
*(_WORD *)socket_addr.sa_data = v2;
v1 = 0;
}
}
}
return v1;
}

original_code:
int open_broadcast_socket() {
  socket_fd = socket(2, SOCK_DGRAM, 0);
  if (socket_fd == -1) {
    fprintf(stderr, "failed to create socket, err %d\n", (*__errno_location ()));
    return -1;
  }
  int broadcast_enable = 1;
  int result = setsockopt(socket_fd, 1, 6,
                          &broadcast_enable, sizeof(broadcast_enable));
  if (result == -1) {
    fprintf(stderr, "failed to broadcast enable socket, err %d\n", (*__errno_location ()));
    return -1;
  }
  struct sockaddr_in source_addr;
  memset(&source_addr, 0, sizeof(source_addr));
  source_addr.sin_family = 2;
  source_addr.sin_addr.s_addr = ((in_addr_t) 0x00000000);
  source_addr.sin_port = htons(58710);
  result = bind(socket_fd, (struct sockaddr *)&source_addr,
                sizeof(source_addr));
  if (result == -1) {
    fprintf(stderr, "failed to bind to socket, err %d\n", (*__errno_location ()));
    return -1;
  }
  memset(&socket_addr, 0, sizeof(socket_addr));
  socket_addr.sin_family = 2;
  socket_addr.sin_addr.s_addr = inet_addr("255.255.255.255");
  socket_addr.sin_port = htons(58710);
  return 0;
}

canonical_original_code:
int open_broadcast_socket() {
  socket_fd = socket(2, SOCK_DGRAM, 0);
  if (socket_fd == -1) {
    fprintf(stderr, "failed to create socket, err %d\n", (*__errno_location ()));
    return -1;
  }
  int broadcast_enable = 1;
  int result = setsockopt(socket_fd, 1, 6,
                          &broadcast_enable, sizeof(broadcast_enable));
  if (result == -1) {
    fprintf(stderr, "failed to broadcast enable socket, err %d\n", (*__errno_location ()));
    return -1;
  }
  struct sockaddr_in source_addr;
  memset(&source_addr, 0, sizeof(source_addr));
  source_addr.sin_family = 2;
  source_addr.sin_addr.s_addr = ((unsigned int) 0x00000000);
  source_addr.sin_port = htons(58710);
  result = bind(socket_fd, (struct sockaddr *)&source_addr,
                sizeof(source_addr));
  if (result == -1) {
    fprintf(stderr, "failed to bind to socket, err %d\n", (*__errno_location ()));
    return -1;
  }
  memset(&socket_addr, 0, sizeof(socket_addr));
  socket_addr.sin_family = 2;
  socket_addr.sin_addr.s_addr = inet_addr("255.255.255.255");
  socket_addr.sin_port = htons(58710);
  return 0;
}

variable_types: struct sockaddr_in { unsigned short sin_family; unsigned short sin_port; struct in_addr { unsigned int s_addr; } sin_addr; unsigned char sin_zero[-1]; }

user_defined_types: struct sockaddr_in { unsigned short sin_family; unsigned short sin_port; struct in_addr sin_addr; unsigned char sin_zero[-1]; }

user_defined_types: struct sockaddr { unsigned short sa_family; char sa_data[14]; }


broadcast

decompiled_code:
__int64 __fastcall broadcast(void *buf, int a2)
{
unsigned int v2; // ebx
int *v4; // rax

v2 = sendto(socket_fd, buf, a2, 0, &socket_addr, 0x10u);
if ( v2 == -1 )
{
v4 = __errno_location();
fprintf(stderr, "failed to broadcast message, err %d\n", (unsigned int)*v4);
}
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func11(void *buf, int a2)
{
unsigned int v2; // ebx
int *v4; // rax

v2 = sendto(socket_fd, buf, a2, 0, &socket_addr, 0x10u);
if ( v2 == -1 )
{
v4 = __errno_location();
fprintf(stderr, "failed to broadcast message, err %d\n", (unsigned int)*v4);
}
return v2;
}

original_code:
int broadcast(char* message, int message_len) {
  int result = sendto(socket_fd, message, message_len, 0,
                      (struct sockaddr*)&socket_addr, sizeof(socket_addr));
  if (result == -1) {
    fprintf(stderr, "failed to broadcast message, err %d\n", (*__errno_location ()));
    return -1;
  }
  return result;
}

canonical_original_code:
int broadcast(char *message, int message_len) {
  int result = sendto(socket_fd, message, message_len, 0,
                      (struct sockaddr*)&socket_addr, sizeof(socket_addr));
  if (result == -1) {
    fprintf(stderr, "failed to broadcast message, err %d\n", (*__errno_location ()));
    return -1;
  }
  return result;
}

variable_types:
message
char *


decompiled_code:
char *init_reastream_packet()
{
char *result; // rax

reastream_packet = 0x485253526DLL;
*(_QWORD *)dest = 0LL;
qword_404110 = 0LL;
qword_404118 = 0LL;
qword_404120 = 0LL;
qword_404128 = 0LL;
qword_404130 = 0LL;
qword_404138 = 0LL;
qword_404140 = 0LL;
result = strcpy(dest, reastream_id);
LOBYTE(qword_404128) = 1;
BYTE4(qword_404128) = 24;
return result;
}

canonical_decompiled_code:
char *func12()
{
char *result; // rax

reastream_packet = 0x485253526DLL;
*(_QWORD *)dest = 0LL;
qword_404110 = 0LL;
qword_404118 = 0LL;
qword_404120 = 0LL;
qword_404128 = 0LL;
qword_404130 = 0LL;
qword_404138 = 0LL;
qword_404140 = 0LL;
result = strcpy(dest, reastream_id);
LOBYTE(qword_404128) = 1;
BYTE4(qword_404128) = 24;
return result;
}

original_code:
void init_reastream_packet() {
  memset(&reastream_packet, 0, sizeof(reastream_packet));
  strcpy(reastream_packet, "mRSR");
  reastream_packet[0x04] = 0x48;
  strcpy(reastream_packet + 0x08, reastream_id);
  reastream_packet[0x28] = 0x01;
  reastream_packet[0x2c] = 0x18;
}


decompiled_code:
__int64 __fastcall broadcast_midi_message(char a1, int a2)
{
LOBYTE(qword_404130) = -86;
LOBYTE(qword_404140) = -112;
BYTE1(qword_404140) = a1;
BYTE2(qword_404140) = a2 != 0 ? 0x7F : 0;
return broadcast(&reastream_packet, 72);
}

canonical_decompiled_code:
__int64 __fastcall func13(char a1, int a2)
{
LOBYTE(qword_404130) = -86;
LOBYTE(qword_404140) = -112;
BYTE1(qword_404140) = a1;
BYTE2(qword_404140) = a2 != 0 ? 0x7F : 0;
return func11(&reastream_packet, 72);
}

original_code:
void broadcast_midi_message(char key, int on) {
  reastream_packet[0x30] = 0xaa;
  reastream_packet[0x40] = 0x90;
  reastream_packet[0x41] = key;
  reastream_packet[0x42] = on ? 0x7f : 0x00;
  broadcast(reastream_packet, 0x48);
}

variable_types: key char

variable_types: on int


repo: obonaventure/SystemesInformatiques

decompiled_code:
void __fastcall test_even(char a1)
{
if ( (a1 & 1) == 0 )
++even;
}

canonical_decompiled_code:
void __fastcall func8(char a1)
{
if ( (a1 & 1) == 0 )
++even;
}

original_code:
void test_even(int i) {
  if((i%2)==0)
    even++;
}

variable_types: i int


decompiled_code:
void __fastcall __noreturn is_even(void *a1)
{
int v1; // ebx

v1 = 1000000;
do
{
test_even(global);
--v1;
}
while ( v1 );
pthread_exit(0LL);
}

canonical_decompiled_code:
void __fastcall __noreturn func9(void *a1)
{
int v1; // ebx

v1 = 1000000;
do
{
func8(global);
--v1;
}
while ( v1 );
pthread_exit(0LL);
}

original_code:
void *is_even(void * param) {
  for(int j=0;j<1000000;j++) {
    test_even(global);
  }
  pthread_exit(((void *)0));
}

canonical_original_code:
void *is_even(void *param) {
  for(int j = 0;j<1000000;j++) {
    test_even(global);
  }
  pthread_exit(((void *)0));
}

variable_types:
param
void *

variable_types: j int

return_type: void *


increment

decompiled_code:
__int64 __fastcall increment(int a1)
{
return (unsigned int)(a1 + 1);
}

canonical_decompiled_code:
__int64 __fastcall func10(int a1)
{
return (unsigned int)(a1 + 1);
}

original_code:
int increment(int i) {
  return i+1;
}

canonical_original_code:
int increment(int i) {
  return i+1;
}


decompiled_code:
unsigned __int64 __fastcall str2bits(__int64 a1, __int64 a2, _QWORD *a3)
{
unsigned __int64 result; // rax
unsigned __int64 v4; // r8

*a3 = 0LL;
a3[1] = 0LL;
a3[2] = 0LL;
a3[3] = 0LL;
a3[4] = 0LL;
a3[5] = 0LL;
a3[6] = 0LL;
a3[7] = 0LL;
result = 8 * a2;
v4 = 64LL;
if ( (unsigned __int64)(8 * a2) <= 0x40 )
v4 = 8 * a2;
if ( result )
{
result = 0LL;
do
{
*((_BYTE *)a3 + result) = (*(char *)(a1 + (int)result / 8) >> ((int)result % 8)) & 1;
++result;
}
while ( result < v4 );
}
return result;
}

canonical_decompiled_code:
unsigned __int64 __fastcall func0(__int64 a1, __int64 a2, _QWORD *a3)
{
unsigned __int64 result; // rax
unsigned __int64 v4; // r8

*a3 = 0LL;
a3[1] = 0LL;
a3[2] = 0LL;
a3[3] = 0LL;
a3[4] = 0LL;
a3[5] = 0LL;
a3[6] = 0LL;
a3[7] = 0LL;
result = 8 * a2;
v4 = 64LL;
if ( (unsigned __int64)(8 * a2) <= 0x40 )
v4 = 8 * a2;
if ( result )
{
result = 0LL;
do
{
*((_BYTE *)a3 + result) = (*(char *)(a1 + (int)result / 8) >> ((int)result % 8)) & 1;
++result;
}
while ( result < v4 );
}
return result;
}

original_code:
static void str2bits(const char *input, size_t len, char *output)
{
    int i;
    memset(output, 0, 64);
    for(i = 0; i < (len * 8 < 64 ? len * 8 : 64); ++i)
        output[i] = (input[i / 8] >> (i % 8)) & 1;
}

canonical_original_code:
static void str2bits(char *input, unsigned long len, char *output)
{
    int i;
    memset(output, 0, 64);
    for(i = 0; i < (len * 8 < 64 ? len * 8 : 64); ++i)
        output[i] = (input[i / 8] >> (i % 8)) & 1;
}

variable_types:
input
char *

variable_types:
len
unsigned long

variable_types:
output
char *


decompiled_code:
__int64 __fastcall bits2str(__int64 a1, _QWORD *a2)
{
__int64 result; // rax

*a2 = 0LL;
for ( result = 0LL; result != 64; ++result )
*((_BYTE *)a2 + (int)result / 8) |= *(char *)(a1 + result) << ((int)result % 8);
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1, _QWORD *a2)
{
__int64 result; // rax

*a2 = 0LL;
for ( result = 0LL; result != 64; ++result )
*((_BYTE *)a2 + (int)result / 8) |= *(char *)(a1 + result) << ((int)result % 8);
return result;
}

original_code:
static void bits2str(const char *input, char *output)
{
    int i;
    memset(output, 0, 8);
    for (i = 0; i < (8 * 8); ++i)
        output[i / 8] |= input[i] << (i % 8);
}

canonical_original_code:
static void bits2str(char *input, char *output)
{
    int i;
    memset(output, 0, 8);
    for (i = 0; i < (8 * 8); ++i)
        output[i / 8] |= input[i] << (i % 8);
}


decompiled_code:
void *__fastcall hex2str(__int64 a1, unsigned __int64 a2, char *a3)
{
void *result; // rax
const char *v5; // rbx

result = memset(a3, 0, a2 >> 1);
if ( a2 )
{
v5 = 0LL;
do
{
sscanf(&v5[a1], "%02hhX", &a3[(int)v5 / 2]);
result = (void *)v5;
v5 += 2;
}
while ( result != (void *)((a2 - 1) & 0xFFFFFFFFFFFFFFFELL) );
}
return result;
}

canonical_decompiled_code:
void *__fastcall func4(__int64 a1, unsigned __int64 a2, char *a3)
{
void *result; // rax
const char *v5; // rbx

result = memset(a3, 0, a2 >> 1);
if ( a2 )
{
v5 = 0LL;
do
{
sscanf(&v5[a1], "%02hhX", &a3[(int)v5 / 2]);
result = (void *)v5;
v5 += 2;
}
while ( result != (void *)((a2 - 1) & 0xFFFFFFFFFFFFFFFELL) );
}
return result;
}

original_code:
static void hex2str(const char *input, size_t len, char *output)
{
    int i;
    memset(output, 0, len / 2);
    for (i = 0; i < len; i += 2)
        sscanf(input + i, "%02hhX", &output[i / 2]);
}

canonical_original_code:
static void hex2str(char *input, unsigned long len, char *output)
{
    int i;
    memset(output, 0, len / 2);
    for (i = 0; i < len; i += 2)
        sscanf(input + i, "%02hhX", &output[i / 2]);
}


decompiled_code:
void __fastcall pwd_init(const char *a1)
{
size_t v1; // rax
__int64 v2; // rsi
_QWORD v3[9]; // [rsp+0h] [rbp-48h] BYREF

v1 = strlen(a1);
v2 = 8LL;
if ( v1 < 8 )
v2 = v1;
str2bits((__int64)a1, v2, v3);
setkey((const char *)v3);
}

canonical_decompiled_code:
void __fastcall func5(const char *a1)
{
size_t v1; // rax
__int64 v2; // rsi
_QWORD v3[9]; // [rsp+0h] [rbp-48h] BYREF

v1 = strlen(a1);
v2 = 8LL;
if ( v1 < 8 )
v2 = v1;
func0((__int64)a1, v2, v3);
setkey((const char *)v3);
}

original_code:
void pwd_init(const char *key)
{
    char work[(8 * 8)];
    str2bits(key, (strlen(key) < 8 ? strlen(key) : 8), work);
    setkey(work);
}

canonical_original_code:
void pwd_init(char *key)
{
    char work[-1];
    str2bits(key, (strlen(key) < 8 ? strlen(key) : 8), work);
    setkey(work);
}

variable_types:
key
char *

variable_types:
work
char [-1]


decompiled_code:
int __fastcall pwd_encrypt(const char *a1, char *a2, int a3)
{
__int64 v4; // rax
__int64 v6; // [rsp+8h] [rbp-60h] BYREF
char block[88]; // [rsp+10h] [rbp-58h] BYREF

v4 = strlen(a1);
str2bits((__int64)a1, v4, block);
_encrypt(block, a3, 0);
bits2str((__int64)block, &v6);
return str2hex((__int64)&v6, 8LL, a2);
}

canonical_decompiled_code:
int __fastcall func6(const char *a1, char *a2, int a3)
{
__int64 v4; // rax
__int64 v6; // [rsp+8h] [rbp-60h] BYREF
char block[88]; // [rsp+10h] [rbp-58h] BYREF

v4 = strlen(a1);
func0((__int64)a1, v4, block);
func2(block, a3, 0);
func1((__int64)block, &v6);
return func3((__int64)&v6, 8LL, a2);
}

original_code:
void pwd_encrypt(const char *pwd, char *cipher, int n)
{
    char work[(8 * 8)], output[8];
    str2bits(pwd, strlen(pwd), work);
    __encrypt(work, n, 0);
    bits2str(work, output);
    str2hex(output, 8, cipher);
}

canonical_original_code:
void pwd_encrypt(char *pwd, char *cipher, int n)
{
    char work[-1]; char output[8];
    str2bits(pwd, strlen(pwd), work);
    __encrypt(work, n, 0);
    bits2str(work, output);
    str2hex(output, 8, cipher);
}

variable_types:
pwd
char *

variable_types:
cipher
char *

variable_types: n int

variable_types:
output
char [8]


decompiled_code:
__int64 __fastcall pwd_decrypt(const char *a1, _QWORD *a2, int a3)
{
unsigned __int64 v4; // rax
char v6[8]; // [rsp+8h] [rbp-60h] BYREF
char block[88]; // [rsp+10h] [rbp-58h] BYREF

v4 = strlen(a1);
hex2str((__int64)a1, v4, v6);
str2bits((__int64)v6, 8LL, block);
_encrypt(block, a3, 1);
return bits2str((__int64)block, a2);
}

canonical_decompiled_code:
__int64 __fastcall func7(const char *a1, _QWORD *a2, int a3)
{
unsigned __int64 v4; // rax
char v6[8]; // [rsp+8h] [rbp-60h] BYREF
char block[88]; // [rsp+10h] [rbp-58h] BYREF

v4 = strlen(a1);
func4((__int64)a1, v4, v6);
func0((__int64)v6, 8LL, block);
func2(block, a3, 1);
return func1((__int64)block, a2);
}

original_code:
void pwd_decrypt(const char *hex, char *pwd, int n)
{
    char work[(8 * 8)], input[8];
    hex2str(hex, strlen(hex), input);
    str2bits(input, 8, work);
    __encrypt(work, n, 1);
    bits2str(work, pwd);
}

canonical_original_code:
void pwd_decrypt(char *hex, char *pwd, int n)
{
    char work[-1]; char input[8];
    hex2str(hex, strlen(hex), input);
    str2bits(input, 8, work);
    __encrypt(work, n, 1);
    bits2str(work, pwd);
}

variable_types:
hex
char *

variable_types:
input
char [8]


mange

decompiled_code:
int __fastcall mange(unsigned int a1)
{
int i; // ebx
int result; // eax

printf("Philosophe [%d] mange\n", a1);
for ( i = 0; ; ++i )
{
result = rand();
if ( result <= i )
break;
}
return result;
}

canonical_decompiled_code:
int __fastcall func8(unsigned int a1)
{
int i; // ebx
int result; // eax

printf("Philosophe [%d] mange\n", a1);
for ( i = 0; ; ++i )
{
result = rand();
if ( result <= i )
break;
}
return result;
}

original_code:
void mange(int id) {
  printf("Philosophe [%d] mange\n",id);
  for(int i=0;i< rand(); i++) {
  }
}

canonical_original_code:
void mange(int id) {
  printf("Philosophe [%d] mange\n",id);
  for(int i = 0;i< rand(); i++) {
  }
}

variable_types: id int


error

decompiled_code:
void __fastcall __noreturn error(unsigned int a1, __int64 a2)
{
int *v2; // rax
char *v3; // rax

v2 = __errno_location();
v3 = strerror(*v2);
fprintf(stderr, format, a2, a1, v3);
exit(1);
}

canonical_decompiled_code:
void __fastcall __noreturn func7(unsigned int a1, __int64 a2)
{
int *v2; // rax
char *v3; // rax

v2 = __errno_location();
v3 = strerror(*v2);
fprintf(stderr, format, a2, a1, v3);
exit(1);
}

original_code:
void error(int err, char *msg) {
  fprintf(stderr,"%s a retourné %d message d'erreur : %s\n",msg,err,strerror((*__errno_location ())));
  exit(1);
}

variable_types: err int

variable_types:
msg
char *


decompiled_code:
void *__fastcall thread_first(void *a1)
{
++global;
return 0LL;
}

canonical_decompiled_code:
void *__fastcall func7(void *a1)
{
++global;
return 0LL;
}

original_code:
void *thread_first(void * param) {
  global++;
  return(((void *)0));
}

canonical_original_code:
void *thread_first(void *param) {
  global++;
  return(((void *)0));
}


decompiled_code:
void __noreturn thread_second()
{
++global;
pthread_exit(0LL);
}

canonical_decompiled_code:
void __noreturn func9()
{
++global;
pthread_exit(0LL);
}

original_code:
void *thread_second(void * param) {
  global++;
  pthread_exit(((void *)0));
}

canonical_original_code:
void *thread_second(void *param) {
  global++;
  pthread_exit(((void *)0));
}


decompiled_code:
void __fastcall __noreturn error(unsigned int a1, __int64 a2)
{
int *v2; // rax
char *v3; // rax

v2 = __errno_location();
v3 = strerror(*v2);
fprintf(_bss_start, format, a2, a1, v3);
exit(1);
}

canonical_decompiled_code:
void __fastcall __noreturn func8(unsigned int a1, __int64 a2)
{
int *v2; // rax
char *v3; // rax

v2 = __errno_location();
v3 = strerror(*v2);
fprintf(_bss_start, format, a2, a1, v3);
exit(1);
}

original_code:
void error(int err, char *msg) {
  fprintf(stderr,"%s a retourné %d, message d'erreur : %s\n",msg,err,strerror((*__errno_location ())));
  exit(1);
}


main

canonical_name: main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
int v3; // eax
int v4; // eax
int v5; // eax
int v6; // eax
int v7; // eax
int v8; // eax
size_t stacksize; // [rsp+8h] [rbp-50h] BYREF
pthread_attr_t attr; // [rsp+10h] [rbp-48h] BYREF
pthread_t newthread[2]; // [rsp+48h] [rbp-10h] BYREF

v3 = pthread_attr_init(&attr);
if ( v3 )
error(v3, (__int64)"pthread_attr_init");
v4 = pthread_attr_getstacksize(&attr, &stacksize);
if ( v4 )
error(v4, (__int64)"pthread_attr_getstacksize");
printf(aTailleParD, stacksize);
stacksize = 0x10000LL;
v5 = pthread_attr_setstacksize(&attr, 0x10000uLL);
if ( v5 )
error(v5, (__int64)"pthread_attr_setstacksize");
v6 = pthread_create(newthread, &attr, thread_first, 0LL);
if ( v6 )
error(v6, (__int64)"pthread_create");
v7 = 1000000000;
do
--v7;
while ( v7 );
v8 = pthread_join(newthread[0], 0LL);
if ( v8 )
error(v8, (__int64)"pthread_join");
printf("global: %d\n", (unsigned int)global);
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
int v3; // eax
int v4; // eax
int v5; // eax
int v6; // eax
int v7; // eax
int v8; // eax
size_t stacksize; // [rsp+8h] [rbp-50h] BYREF
pthread_attr_t attr; // [rsp+10h] [rbp-48h] BYREF
pthread_t newthread[2]; // [rsp+48h] [rbp-10h] BYREF

v3 = pthread_attr_init(&attr);
if ( v3 )
func8(v3, (__int64)"pthread_attr_init");
v4 = pthread_attr_getstacksize(&attr, &stacksize);
if ( v4 )
func8(v4, (__int64)"pthread_attr_getstacksize");
printf(aTailleParD, stacksize);
stacksize = 0x10000LL;
v5 = pthread_attr_setstacksize(&attr, 0x10000uLL);
if ( v5 )
func8(v5, (__int64)"pthread_attr_setstacksize");
v6 = pthread_create(newthread, &attr, thread_first, 0LL);
if ( v6 )
func8(v6, (__int64)"pthread_create");
v7 = 1000000000;
do
--v7;
while ( v7 );
v8 = pthread_join(newthread[0], 0LL);
if ( v8 )
func8(v8, (__int64)"pthread_join");
printf("global: %d\n", (unsigned int)global);
return 0;
}

original_code:
int main (int argc, char *argv[]) {
  pthread_t first;
  pthread_attr_t attr_first;
  size_t stacksize;
  int err;
  err= pthread_attr_init(&attr_first);
  if(err!=0)
    error(err,"pthread_attr_init");
  err= pthread_attr_getstacksize(&attr_first,&stacksize);
  if(err!=0)
    error(err,"pthread_attr_getstacksize");
  printf("Taille par défaut du stack : %ld\n",stacksize);
  stacksize=65536;
  err= pthread_attr_setstacksize(&attr_first,stacksize);
  if(err!=0)
    error(err,"pthread_attr_setstacksize");
  err=pthread_create(&first,&attr_first,&thread_first,((void *)0));
  if(err!=0)
    error(err,"pthread_create");
  for(int i=0; i<1000000000;i++) { }
  err=pthread_join(first,((void *)0));
    if(err!=0)
      error(err,"pthread_join");
  printf("global: %d\n",global);
  return(0);
}

canonical_original_code:
int main(int argc, char *argv[]) {
  unsigned long first;
  union pthread_attr_t attr_first;
  unsigned long stacksize;
  int err;
  err= pthread_attr_init(&attr_first);
  if(err!=0)
    error(err,"pthread_attr_init");
  err= pthread_attr_getstacksize(&attr_first,&stacksize);
  if(err!=0)
    error(err,"pthread_attr_getstacksize");
  printf("Taille par défaut du stack : %ld\n",stacksize);
  stacksize=65536;
  err= pthread_attr_setstacksize(&attr_first,stacksize);
  if(err!=0)
    error(err,"pthread_attr_setstacksize");
  err=pthread_create(&first,&attr_first,&thread_first,((void *)0));
  if(err!=0)
    error(err,"pthread_create");
  for(int i = 0; i<1000000000;i++) { }
  err=pthread_join(first,((void *)0));
    if(err!=0)
      error(err,"pthread_join");
  printf("global: %d\n",global);
  return(0);
}

variable_types: argc int

variable_types:
argv
char *[]

variable_types:
first
unsigned long

variable_types: union pthread_attr_t { char __size[56]; long __align; }

variable_types:
stacksize
unsigned long

variable_types: i int


decompiled_code:
__int64 init_suite1()
{
b = 0LL;
return 0LL;
}

canonical_decompiled_code:
__int64 func0()
{
b = 0LL;
return 0LL;
}

original_code:
int init_suite1(void) {
    b = ((void *)0);
    return 0;
}

canonical_original_code:
int init_suite1() {
    b = ((void *)0);
    return 0;
}


decompiled_code:
__int64 clean_suite1()
{
if ( b )
bitstring_free();
return 0LL;
}

canonical_decompiled_code:
__int64 func1()
{
if ( b )
bitstring_free();
return 0LL;
}

original_code:
int clean_suite1(void) {
    if(b)
        bitstring_free(b);
    return 0;
}

canonical_original_code:
int clean_suite1() {
    if(b)
        bitstring_free(b);
    return 0;
}


testAlloc

decompiled_code:
int testAlloc()
{
_BOOL4 v0; // ebx
__int64 v1; // rax
_BOOL4 v2; // ebx
unsigned int i; // ebx
int v4; // eax
_BOOL4 v5; // ebp
_BOOL4 v6; // ebx

b = bitstring_alloc(24LL);
putchar(10);
v0 = b != 0;
if ( !b )
puts(s);
CU_assertImplementation(v0, 44LL, "__b__", "test.c", &unk_BD5, 1LL);
v1 = bitstring_len(b);
v2 = v1 == 24;
if ( v1 != 24 )
puts(aErreurLeBitstr);
CU_assertImplementation(v2, 49LL, "__b__", "test.c", &unk_BD5, 1LL);
for ( i = 0; i != 24; ++i )
{
v4 = bitstring_get(b, i);
v5 = v4 == 0;
if ( v4 )
puts(aErreurAuMoinsU);
CU_assertImplementation(v5, 56LL, "__b__", "test.c", &unk_BD5, 1LL);
}
bitstring_free(b);
b = bitstring_alloc(18LL);
v6 = b == 0;
if ( b )
puts(aErreurLePtrBit);
CU_assertImplementation(v6, 65LL, "__b__", "test.c", &unk_BD5, 1LL);
bitstring_free(b);
b = 0LL;
puts("\n\tVotre fonction 'bitstring_alloc()' a l'air correcte.");
return putchar(9);
}

canonical_decompiled_code:
int func2()
{
_BOOL4 v0; // ebx
__int64 v1; // rax
_BOOL4 v2; // ebx
unsigned int i; // ebx
int v4; // eax
_BOOL4 v5; // ebp
_BOOL4 v6; // ebx

b = bitstring_alloc(24LL);
putchar(10);
v0 = b != 0;
if ( !b )
puts(s);
CU_assertImplementation(v0, 44LL, "__b__", "test.c", &unk_BD5, 1LL);
v1 = bitstring_len(b);
v2 = v1 == 24;
if ( v1 != 24 )
puts(aErreurLeBitstr);
CU_assertImplementation(v2, 49LL, "__b__", "test.c", &unk_BD5, 1LL);
for ( i = 0; i != 24; ++i )
{
v4 = bitstring_get(b, i);
v5 = v4 == 0;
if ( v4 )
puts(aErreurAuMoinsU);
CU_assertImplementation(v5, 56LL, "__b__", "test.c", &unk_BD5, 1LL);
}
bitstring_free(b);
b = bitstring_alloc(18LL);
v6 = b == 0;
if ( b )
puts(aErreurLePtrBit);
CU_assertImplementation(v6, 65LL, "__b__", "test.c", &unk_BD5, 1LL);
bitstring_free(b);
b = 0LL;
puts("\n\tVotre fonction 'bitstring_alloc()' a l'air correcte.");
return putchar(9);
}

original_code:
void testAlloc() {
    int i;
    b = bitstring_alloc(24);
    printf("\n");
    do { int __b__ = (b != ((void *)0)); if(! __b__) printf("Erreur : Le ptr bitstring 'b' ne pointe vers aucune addresse" " mémoire. Lui avez-vous alloué de la mémoire (malloc()) ?" " Renvoyez-vous le bon pointeur ?\n"); { CU_assertImplementation((__b__), 44, "__b__", "test.c", "", 1); }; } while(0);
    do { int __b__ = (bitstring_len(b) == 24); if(! __b__) printf("Erreur : Le bitstring n'a pas la bonne longueur (en bits)." " Avez-vous pensé à l'affecter à une variable de la structure après avoir" " alloué la mémoire ? Il se peut que ce soit votre fonction 'bitstring_len()'" " qui n'est pas correcte.\n"); { CU_assertImplementation((__b__), 49, "__b__", "test.c", "", 1); }; } while(0);
    for (i = 0; i < 24; i++) {
        do { int __b__ = (bitstring_get(b, i) == 0); if(! __b__) printf("Erreur : Au moins un des bits du bitstring ne vaut pas 0. Assurez-vous" " que l'espace mémoire pour les données du bitstring soit bien mis" " à 0 après l'allocation. De plus, est-ce que bitstring_get est correcte?\n"); { CU_assertImplementation((__b__), 56, "__b__", "test.c", "", 1); }; } while(0);
    }
    bitstring_free(b);
    b = bitstring_alloc(18);
    do { int __b__ = (b == ((void *)0)); if(! __b__) printf("Erreur : Le ptr bitstring 'b' devrait être NULL car on a essayé de l'allouer" " pour une longueur de 18 bits, ce qui n'est pas multiple de 8." " Avez-vous pensé à vérifier que la longueur passée en paramètre" " était bien un multiple de 8 avant d'allouer de la mémoire ?" " Renvoyez-vous bien le ptr NULL si ce n'est pas un multiple de 8 ?\n"); { CU_assertImplementation((__b__), 65, "__b__", "test.c", "", 1); }; } while(0);
    bitstring_free(b);
    b = ((void *)0);
    printf("\n\tVotre fonction 'bitstring_alloc()' a l'air correcte.\n");
    printf("\t");
}


testSet

decompiled_code:
int testSet()
{
int v0; // ebp
unsigned int i; // ebx
int v2; // eax
_BOOL4 v3; // er12
int v4; // eax
_BOOL4 v5; // ebx
unsigned int j; // ebx
int v7; // eax
_BOOL4 v8; // ebp
int v9; // eax
_BOOL4 v10; // ebp

b = bitstring_alloc(24LL);
putchar(10);
printf(format, 19LL);
bitstring_set(b, 19LL, 1LL);
v0 = 1;
for ( i = 0; ; ++i )
{
if ( i != 19 )
{
v2 = bitstring_get(b, i);
v3 = v2 == 0;
if ( v2 )
puts(
"Erreur : Impossible de tester la fonction 'bitstring_set()' car votre fonction 'bitstring_get()' ou 'bitstring"
"_alloc()' n'est pas correcte.");
CU_assertImplementation(v3, 94LL, "__b__", "test.c", &unk_BD5, 1LL);
if ( v0 > 23 )
break;
}
++v0;
}
v4 = bitstring_get(b, 19LL);
v5 = v4 == 1;
if ( v4 != 1 )
printf(aErreurTousLesB, 19LL);
CU_assertImplementation(v5, 100LL, "__b__", "test.c", &unk_BD5, 1LL);
printf(format, 21LL);
bitstring_set(b, 21LL, 1LL);
for ( j = 0; j != 24; ++j )
{
if ( ((j - 19) & 0xFFFFFFFD) != 0 )
{
v9 = bitstring_get(b, j);
v10 = v9 == 0;
if ( v9 )
puts(aErreurAffecter_0);
CU_assertImplementation(v10, 123LL, "__b__", "test.c", &unk_BD5, 1LL);
}
else
{
v7 = bitstring_get(b, j);
v8 = v7 == 1;
if ( v7 != 1 )
puts(aErreurAffecter);
CU_assertImplementation(v8, 116LL, "__b__", "test.c", &unk_BD5, 1LL);
}
}
puts("\n\tVotre fonction 'bitstring_set()' a l'air correcte.");
return putchar(9);
}

canonical_decompiled_code:
int func3()
{
int v0; // ebp
unsigned int i; // ebx
int v2; // eax
_BOOL4 v3; // er12
int v4; // eax
_BOOL4 v5; // ebx
unsigned int j; // ebx
int v7; // eax
_BOOL4 v8; // ebp
int v9; // eax
_BOOL4 v10; // ebp

b = bitstring_alloc(24LL);
putchar(10);
printf(format, 19LL);
bitstring_set(b, 19LL, 1LL);
v0 = 1;
for ( i = 0; ; ++i )
{
if ( i != 19 )
{
v2 = bitstring_get(b, i);
v3 = v2 == 0;
if ( v2 )
puts(
"Erreur : Impossible de tester la fonction 'bitstring_set()' car votre fonction 'bitstring_get()' ou 'bitstring"
"_alloc()' n'est pas correcte.");
CU_assertImplementation(v3, 94LL, "__b__", "test.c", &unk_BD5, 1LL);
if ( v0 > 23 )
break;
}
++v0;
}
v4 = bitstring_get(b, 19LL);
v5 = v4 == 1;
if ( v4 != 1 )
printf(aErreurTousLesB, 19LL);
CU_assertImplementation(v5, 100LL, "__b__", "test.c", &unk_BD5, 1LL);
printf(format, 21LL);
bitstring_set(b, 21LL, 1LL);
for ( j = 0; j != 24; ++j )
{
if ( ((j - 19) & 0xFFFFFFFD) != 0 )
{
v9 = bitstring_get(b, j);
v10 = v9 == 0;
if ( v9 )
puts(aErreurAffecter_0);
CU_assertImplementation(v10, 123LL, "__b__", "test.c", &unk_BD5, 1LL);
}
else
{
v7 = bitstring_get(b, j);
v8 = v7 == 1;
if ( v7 != 1 )
puts(aErreurAffecter);
CU_assertImplementation(v8, 116LL, "__b__", "test.c", &unk_BD5, 1LL);
}
}
puts("\n\tVotre fonction 'bitstring_set()' a l'air correcte.");
return putchar(9);
}

original_code:
void testSet() {
    int i;
    int testbit = 19;
    b = bitstring_alloc(24);
    printf("\n");
    printf("\tMise du bit %d à 1\n", testbit);
    bitstring_set(b, testbit, 1);
    for(i = 0; i < 24; ++i) {
        if(i == testbit)
                continue;
        do { int __b__ = (bitstring_get(b, i) == 0); if(! __b__) printf("Erreur : Impossible de tester la fonction 'bitstring_set()' car" " votre fonction 'bitstring_get()' ou 'bitstring_alloc()' n'est pas correcte.\n"); { CU_assertImplementation((__b__), 94, "__b__", "test.c", "", 1); }; } while(0);
    }
    do { int __b__ = (bitstring_get(b, testbit) == 1); if(! __b__) printf("Erreur : Tous les bits semblent être à 0 dans votre bitstring alors" " que le n°%d (0 étant le premier) devrait être à 1. Le problème" " peut venir de 'bitstring_set()', mais aussi de 'bitstring_get()'.\n", testbit); { CU_assertImplementation((__b__), 100, "__b__", "test.c", "", 1); }; } while(0);
    printf("\tMise du bit %d à 1\n", testbit+2);
    bitstring_set(b, testbit + 2, 1);
    for(i = 0; i < 24; ++i) {
        if(i == testbit || i == testbit + 2) {
            do { int __b__ = (bitstring_get(b, i) == 1); if(! __b__) printf("Erreur : Affecter un seul bit fonctionne correctement, mais en" " affecter un second dans le même octet semble effacer le premier (ou ne" " pas affecter correctement le second). Vérifiez que vous ne mettez pas" " tout l'octet à 0 avant d'y set un bit. (Il se peut aussi que ce soit du" " à 'bitstring_get()')\n"); { CU_assertImplementation((__b__), 116, "__b__", "test.c", "", 1); }; } while(0);
        } else {
            do { int __b__ = (bitstring_get(b, i) == 0); if(! __b__) printf("Erreur : Affecter un seul bit fonctionne correctement, mais en" " affecter un second dans le même octet altère des bits qui ne devraient pas" " l'être. (Il se peut aussi que ce soit dû à 'bitstring_get()')\n"); { CU_assertImplementation((__b__), 123, "__b__", "test.c", "", 1); }; } while(0);
        }
    }
    printf("\n\tVotre fonction 'bitstring_set()' a l'air correcte.\n");
    printf("\t");
}

variable_types: testbit int


main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__int64 v3; // rax
__int64 v4; // rbx
int result; // eax

if ( (unsigned int)CU_initialize_registry(argc, argv, envp) )
return CU_get_error();
v3 = CU_add_suite("Suite de tests pour bitstring", init_suite1, clean_suite1);
v4 = v3;
if ( v3
&& CU_add_test(v3, "test de 'bitstring_alloc()'", testAlloc)
&& CU_add_test(v4, "test de 'bitstring_set()'", testSet) )
{
CU_basic_set_mode(1LL);
CU_basic_run_tests();
CU_cleanup_registry();
result = CU_get_error();
}
else
{
CU_cleanup_registry();
result = CU_get_error();
}
return result;
}

original_code:
int main()
{
    CU_pSuite pSuite = ((void *)0);
    if(CUE_SUCCESS != CU_initialize_registry())
       return CU_get_error();
    pSuite = CU_add_suite("Suite de tests pour bitstring", init_suite1, clean_suite1);
    if(((void *)0) == pSuite) {
       CU_cleanup_registry();
       return CU_get_error();
    }
    if(((void *)0) == CU_add_test(pSuite, "test de 'bitstring_alloc()'", testAlloc) ||
       ((void *)0) == CU_add_test(pSuite, "test de 'bitstring_set()'", testSet)) {
       CU_cleanup_registry();
       return CU_get_error();
    }
    CU_basic_set_mode(CU_BRM_SILENT);
    CU_basic_run_tests();
    CU_cleanup_registry();
    return CU_get_error();
}

canonical_original_code:
int main()
{
    struct CU_Suite *pSuite = ((void *)0);
    if(CUE_SUCCESS != CU_initialize_registry())
       return CU_get_error();
    pSuite = CU_add_suite("Suite de tests pour bitstring", init_suite1, clean_suite1);
    if(((void *)0) == pSuite) {
       CU_cleanup_registry();
       return CU_get_error();
    }
    if(((void *)0) == CU_add_test(pSuite, "test de 'bitstring_alloc()'", testAlloc) ||
       ((void *)0) == CU_add_test(pSuite, "test de 'bitstring_set()'", testSet)) {
       CU_cleanup_registry();
       return CU_get_error();
    }
    CU_basic_set_mode(CU_BRM_SILENT);
    CU_basic_run_tests();
    CU_cleanup_registry();
    return CU_get_error();
}

variable_types: struct CU_Suite { char *pName; int fActive; struct CU_Test { char *pName; int fActive; void (*pTestFunc)(); struct __jmp_buf_tag { long __jmpbuf[8]; int __mask_was_saved; struct __sigset_t { unsigned long __val[-1]; } __saved_mask; } (*pJumpBuf)[1]; struct CU_Test *pNext; struct CU_Test *pPrev; } *pTest; int (*pInitializeFunc)(); int (*pCleanupFunc)(); void (*pSetUpFunc)(); void (*pTearDownFunc)(); unsigned int uiNumberOfTests; struct CU_Suite *pNext; struct CU_Suite *pPrev; unsigned int uiNumberOfTestsFailed; unsigned int uiNumberOfTestsSuccess; } *

user_defined_types: struct CU_Suite { char *pName; int fActive; struct CU_Test *pTest; int (*pInitializeFunc)(); int (*pCleanupFunc)(); void (*pSetUpFunc)(); void (*pTearDownFunc)(); unsigned int uiNumberOfTests; struct CU_Suite *pNext; struct CU_Suite *pPrev; unsigned int uiNumberOfTestsFailed; unsigned int uiNumberOfTestsSuccess; }

user_defined_types: struct CU_Test { char *pName; int fActive; void (*pTestFunc)(); struct __jmp_buf_tag (*pJumpBuf)[1]; struct CU_Test *pNext; struct CU_Test *pPrev; }

user_defined_types: struct __jmp_buf_tag { long __jmpbuf[8]; int __mask_was_saved; struct __sigset_t __saved_mask; }


decompiled_code:
void __fastcall __noreturn thread_work(void *a1)
{
pthread_mutex_lock(&global_mutex);
pthread_exit(0LL);
}

canonical_decompiled_code:
void __fastcall __noreturn func7(void *a1)
{
pthread_mutex_lock(&global_mutex);
pthread_exit(0LL);
}

original_code:
static void *thread_work(void *arg)
{
 pthread_mutex_lock(&global_mutex);
 pthread_exit(((void *)0));
 pthread_mutex_unlock(&global_mutex);
}

variable_types:
arg
void *


decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
pthread_t *v3; // rbx
pthread_t th[3]; // [rsp+0h] [rbp-38h] BYREF
char v6; // [rsp+18h] [rbp-20h] BYREF

pthread_mutex_init(&global_mutex, 0LL);
v3 = th;
do
pthread_create(v3++, 0LL, (void *(*)(void *))thread_work, 0LL);
while ( v3 != (pthread_t *)&v6 );
pthread_join(th[0], 0LL);
pthread_join(th[1], 0LL);
pthread_join(th[2], 0LL);
return 0;
}

original_code:
int main (int argc, char const *argv[])
{
 int i;
 pthread_t threads[3];
 pthread_mutex_init(&global_mutex, ((void *)0));
 for (i = 0; i < 3; ++i)
  pthread_create(&threads[i], ((void *)0), thread_work, ((void *)0));
 for (i = 0; i < 3; ++i)
  pthread_join(threads[i], ((void *)0));
 return 0;
}

canonical_original_code:
int main(int argc, char *argv[])
{
 int i;
 unsigned long threads[3];
 pthread_mutex_init(&global_mutex, ((void *)0));
 for (i = 0; i < 3; ++i)
  pthread_create(&threads[i], ((void *)0), thread_work, ((void *)0));
 for (i = 0; i < 3; ++i)
  pthread_join(threads[i], ((void *)0));
 return 0;
}

variable_types:
threads
unsigned long [3]


increment

decompiled_code:
__int64 __fastcall increment(int a1)
{
return (unsigned int)(a1 + 1);
}

canonical_decompiled_code:
__int64 __fastcall func8(int a1)
{
return (unsigned int)(a1 + 1);
}

original_code:
int increment(int i) {
  return i+1;
}


error

canonical_original_code:
void error(int err, char *msg) {
  fprintf(stderr,"%s a retourné %d, message d'erreur : %s\n",msg,err,strerror((*__errno_location ())));
  exit(1);
}


repo: ocdet/veip

decompiled_code:
__int64 init_pbuf_list()
{
pbuf_start_list = (int)init_pbuf();
pbuf_stop_list = (int)init_pbuf();
return 0LL;
}

canonical_decompiled_code:
__int64 func2()
{
pbuf_start_list = (int)init_pbuf();
pbuf_stop_list = (int)init_pbuf();
return 0LL;
}

original_code:
int init_pbuf_list(){
  pbuf_start_list = init_pbuf();
  pbuf_stop_list = init_pbuf();
  return 0;
}


split

original_code:
void split(char str[], char * delim){
  char * tok[128];
  char * ptr = str;
  int i, len;
  for (len = 0; len < 128; len++){
    if((tok[len] = strtok(ptr, delim)) == ((void *)0))
      break;
    ptr = ((void *)0);
  }
  memcpy(str, tok, 128);
  return;
}

canonical_original_code:
void split(char str[], char *delim){
  char *tok[128];
  char *ptr = str;
  int i; int len;
  for (len = 0; len < 128; len++){
    if((tok[len] = strtok(ptr, delim)) == ((void *)0))
      break;
    ptr = ((void *)0);
  }
  memcpy(str, tok, 128);
  return;
}

variable_types:
str
char []

variable_types:
delim
char *

variable_types:
tok
char *[128]

variable_types:
ptr
char *

variable_types: len int


decompiled_code:
__int64 __fastcall get_inaddr(char *name)
{
in_addr_t v1; // ebx
struct hostent *v3; // rax

v1 = inet_addr(name);
if ( v1 == -1 )
{
v3 = gethostbyname(name);
if ( v3 )
v1 = **(_DWORD **)v3->h_addr_list;
}
return v1;
}

canonical_decompiled_code:
__int64 __fastcall func5(char *name)
{
in_addr_t v1; // ebx
struct hostent *v3; // rax

v1 = inet_addr(name);
if ( v1 == -1 )
{
v3 = gethostbyname(name);
if ( v3 )
v1 = **(_DWORD **)v3->h_addr_list;
}
return v1;
}

original_code:
in_addr_t get_inaddr(char * peer){
  in_addr_t addr;
  struct hostent * hp;
  addr = inet_addr(peer);
  if( addr == 0xffffffff){
    hp = (struct hostent *)gethostbyname(peer);
    if(!hp) return(-1);
    addr = *(unsigned int *)hp->h_addr_list[0];
  }
  return(addr);
}

canonical_original_code:
unsigned int get_inaddr(char *peer){
  unsigned int addr;
  struct hostent *hp;
  addr = inet_addr(peer);
  if( addr == 0xffffffff){
    hp = (struct hostent *)gethostbyname(peer);
    if(!hp) return(-1);
    addr = *(unsigned int *)hp->h_addr_list[0];
  }
  return(addr);
}

variable_types:
peer
char *

variable_types:
addr
unsigned int

variable_types: struct hostent { char *h_name; char **h_aliases; int h_addrtype; int h_length; char **h_addr_list; } *

return_type: unsigned int


etype

original_code:
u_short etype(char * pkt){
  struct ether_header * ehdr;
  u_short type;
  ehdr = (struct ether_header *)malloc(sizeof(struct ether_header));
  if(ehdr == ((void *)0)) return(0);
  memset(ehdr, 0, sizeof(struct ether_header));
  memcpy(ehdr, pkt, sizeof(struct ether_header));
  type = ehdr->ether_type;
  free(ehdr);
  return(ntohs(type));
}

canonical_original_code:
unsigned short etype(char *pkt){
  struct ether_header *ehdr;
  unsigned short type;
  ehdr = (struct ether_header *)malloc(sizeof(struct ether_header));
  if(ehdr == ((void *)0)) return(0);
  memset(ehdr, 0, sizeof(struct ether_header));
  memcpy(ehdr, pkt, sizeof(struct ether_header));
  type = ehdr->ether_type;
  free(ehdr);
  return(ntohs(type));
}

variable_types:
pkt
char *

variable_types: struct ether_header { unsigned char ether_dhost[6]; unsigned char ether_shost[6]; unsigned short ether_type; } *

variable_types:
type
unsigned short

return_type: unsigned short


decompiled_code:
__int64 __fastcall get_nif(char *src)
{
unsigned __int16 v1; // bp
int v2; // eax
unsigned int v3; // ebx
struct sockaddr v5; // [rsp+0h] [rbp-68h] BYREF
char dest[8]; // [rsp+20h] [rbp-48h] BYREF
__int64 v7; // [rsp+28h] [rbp-40h]
__int64 v8; // [rsp+30h] [rbp-38h]
__int64 v9; // [rsp+38h] [rbp-30h]
__int64 v10; // [rsp+40h] [rbp-28h]

v1 = _bswap_16(3);
v2 = socket(17, 3, v1);
if ( v2 < 0 )
{
perror("socket");
v3 = -1;
}
else
{
v3 = v2;
v7 = 0LL;
v8 = 0LL;
v9 = 0LL;
v10 = 0LL;
strncpy(dest, src, 0xFuLL);
if ( ioctl(v3, 0x8933uLL, dest) < 0 )
{
perror("ioctl");
close(v3);
v3 = -1;
}
else
{
v5.sa_family = 17;
*(_WORD *)v5.sa_data = v1;
*(_DWORD *)&v5.sa_data[2] = v8;
if ( bind(v3, &v5, 0x14u) < 0 )
{
perror("bind");
close(v3);
v3 = -1;
}
else if ( ioctl(v3, 0x8913uLL, dest) < 0 || (LOWORD(v8) = v8 | 0x100, ioctl(v3, 0x8914uLL, dest) < 0) )
{
perror("ioctl");
close(v3);
v3 = -1;
}
}
}
return v3;
}

canonical_decompiled_code:
__int64 __fastcall func7(char *src)
{
unsigned __int16 v1; // bp
int v2; // eax
unsigned int v3; // ebx
struct sockaddr v5; // [rsp+0h] [rbp-68h] BYREF
char dest[8]; // [rsp+20h] [rbp-48h] BYREF
__int64 v7; // [rsp+28h] [rbp-40h]
__int64 v8; // [rsp+30h] [rbp-38h]
__int64 v9; // [rsp+38h] [rbp-30h]
__int64 v10; // [rsp+40h] [rbp-28h]

v1 = func0(3);
v2 = socket(17, 3, v1);
if ( v2 < 0 )
{
perror("socket");
v3 = -1;
}
else
{
v3 = v2;
v7 = 0LL;
v8 = 0LL;
v9 = 0LL;
v10 = 0LL;
strncpy(dest, src, 0xFuLL);
if ( ioctl(v3, 0x8933uLL, dest) < 0 )
{
perror("ioctl");
close(v3);
v3 = -1;
}
else
{
v5.sa_family = 17;
*(_WORD *)v5.sa_data = v1;
*(_DWORD *)&v5.sa_data[2] = v8;
if ( bind(v3, &v5, 0x14u) < 0 )
{
perror("bind");
close(v3);
v3 = -1;
}
else if ( ioctl(v3, 0x8913uLL, dest) < 0 || (LOWORD(v8) = v8 | 0x100, ioctl(v3, 0x8914uLL, dest) < 0) )
{
perror("ioctl");
close(v3);
v3 = -1;
}
}
}
return v3;
}

original_code:
int get_nif(char * device){
  struct ifreq ifreq;
  struct sockaddr_ll sa;
  int sock;
  if((sock = socket(17, SOCK_RAW, htons(0x0003)))<0){
    perror("socket");
    return(-1);
  }
  memset(&ifreq, 0, sizeof(struct ifreq));
  strncpy(ifreq.ifr_ifrn.ifrn_name, device, sizeof(ifreq.ifr_ifrn.ifrn_name)-1);
  if(ioctl(sock, 0x8933, &ifreq)<0){
    perror("ioctl");
    close(sock);
    return(-1);
  }
  sa.sll_family = 17;
  sa.sll_protocol = htons(0x0003);
  sa.sll_ifindex = ifreq.ifr_ifru.ifru_ivalue;
  if(bind(sock, (struct sockaddr *)&sa, sizeof(sa))<0){
    perror("bind");
    close(sock);
    return(-1);
  }
  if(ioctl(sock, 0x8913, &ifreq)<0){
    perror("ioctl");
    close(sock);
    return(-1);
  }
  ifreq.ifr_ifru.ifru_flags=ifreq.ifr_ifru.ifru_flags|IFF_PROMISC;
  if(ioctl(sock, 0x8914, &ifreq)<0){
    perror("ioctl");
    close(sock);
    return(-1);
  }
  return(sock);
}

canonical_original_code:
int get_nif(char *device){
  struct ifreq ifreq;
  struct sockaddr_ll sa;
  int sock;
  if((sock = socket(17, SOCK_RAW, htons(0x0003)))<0){
    perror("socket");
    return(-1);
  }
  memset(&ifreq, 0, sizeof(struct ifreq));
  strncpy(ifreq.ifr_ifrn.ifrn_name, device, sizeof(ifreq.ifr_ifrn.ifrn_name)-1);
  if(ioctl(sock, 0x8933, &ifreq)<0){
    perror("ioctl");
    close(sock);
    return(-1);
  }
  sa.sll_family = 17;
  sa.sll_protocol = htons(0x0003);
  sa.sll_ifindex = ifreq.ifr_ifru.ifru_ivalue;
  if(bind(sock, (struct sockaddr *)&sa, sizeof(sa))<0){
    perror("bind");
    close(sock);
    return(-1);
  }
  if(ioctl(sock, 0x8913, &ifreq)<0){
    perror("ioctl");
    close(sock);
    return(-1);
  }
  ifreq.ifr_ifru.ifru_flags=ifreq.ifr_ifru.ifru_flags|IFF_PROMISC;
  if(ioctl(sock, 0x8914, &ifreq)<0){
    perror("ioctl");
    close(sock);
    return(-1);
  }
  return(sock);
}

variable_types:
device
char *

variable_types: struct ifreq { union { char ifrn_name[16]; } ifr_ifrn; union { struct sockaddr { unsigned short sa_family; char sa_data[14]; } ifru_addr; struct sockaddr ifru_dstaddr; struct sockaddr ifru_broadaddr; struct sockaddr ifru_netmask; struct sockaddr ifru_hwaddr; short ifru_flags; int ifru_ivalue; int ifru_mtu; struct ifmap { unsigned long mem_start; unsigned long mem_end; unsigned short base_addr; unsigned char irq; unsigned char dma; unsigned char port; } ifru_map; char ifru_slave[16]; char ifru_newname[16]; void *ifru_data; struct if_settings { unsigned int type; unsigned int size; union { struct raw_hdlc_proto { unsigned short encoding; unsigned short parity; } *raw_hdlc; struct cisco_proto { unsigned int interval; unsigned int timeout; } *cisco; struct fr_proto { unsigned int t391; unsigned int t392; unsigned int n391; unsigned int n392; unsigned int n393; unsigned short lmi; unsigned short dce; } *fr; struct fr_proto_pvc { unsigned int dlci; } *fr_pvc; struct fr_proto_pvc_info { unsigned int dlci; char master[16]; } *fr_pvc_info; struct sync_serial_settings { unsigned int clock_rate; unsigned int clock_type; unsigned short loopback; } *sync; struct te1_settings { unsigned int clock_rate; unsigned int clock_type; unsigned short loopback; unsigned int slot_map; } *te1; } ifs_ifsu; } ifru_settings; } ifr_ifru; }

variable_types: struct sockaddr_ll { unsigned short sll_family; unsigned short sll_protocol; int sll_ifindex; unsigned short sll_hatype; unsigned char sll_pkttype; unsigned char sll_halen; unsigned char sll_addr[8]; }

variable_types: sock int

user_defined_types: struct ifreq { union { char ifrn_name[16]; } ifr_ifrn; union { struct sockaddr ifru_addr; struct sockaddr ifru_dstaddr; struct sockaddr ifru_broadaddr; struct sockaddr ifru_netmask; struct sockaddr ifru_hwaddr; short ifru_flags; int ifru_ivalue; int ifru_mtu; struct ifmap ifru_map; char ifru_slave[16]; char ifru_newname[16]; void *ifru_data; struct if_settings ifru_settings; } ifr_ifru; }

user_defined_types: struct if_settings { unsigned int type; unsigned int size; union { struct raw_hdlc_proto *raw_hdlc; struct cisco_proto *cisco; struct fr_proto *fr; struct fr_proto_pvc *fr_pvc; struct fr_proto_pvc_info *fr_pvc_info; struct sync_serial_settings *sync; struct te1_settings *te1; } ifs_ifsu; }