decompiled_code:
__int64 __fastcall log_limit(__int64 a1)
{
__int64 result; // rax

result = impair[4];
if ( !(_DWORD)result )
result = *(unsigned int *)(a1 + 40);
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1)
{
__int64 result; // rax

result = impair[4];
if ( !(_DWORD)result )
result = *(unsigned int *)(a1 + 40);
return result;
}

original_code:
static unsigned log_limit(const struct log_limiter *limiter)
{
 if (impair.log_rate_limit == 0) {
  return limiter->limit;
 } else {
  return impair.log_rate_limit;
 }
}

canonical_original_code:
static unsigned int log_limit(struct log_limiter *limiter)
{
 if (impair.log_rate_limit == 0) {
  return limiter->limit;
 } else {
  return impair.log_rate_limit;
 }
}

variable_types: struct log_limiter { union pthread_mutex_t { struct __pthread_mutex_s { int __lock; unsigned int __count; int __owner; unsigned int __nusers; int __kind; short __spins; short __elision; struct __pthread_internal_list { struct __pthread_internal_list *__prev; struct __pthread_internal_list *__next; } __list; } __data; char __size[40]; long __align; } mutex; unsigned int limit; unsigned int count; char *what; } *

return_type: unsigned int

user_defined_types: struct log_limiter { union pthread_mutex_t mutex; unsigned int limit; unsigned int count; char *what; }

user_defined_types: union pthread_mutex_t { struct __pthread_mutex_s __data; char __size[40]; long __align; }

user_defined_types: struct __pthread_mutex_s { int __lock; unsigned int __count; int __owner; unsigned int __nusers; int __kind; short __spins; short __elision; struct __pthread_internal_list __list; }


repo: libreswan/libreswan

decompiled_code:
unsigned __int64 init_log_limiter()
{
__int64 v1; // [rsp+0h] [rbp-28h] BYREF
unsigned __int64 v2; // [rsp+18h] [rbp-10h]

v2 = __readfsqword(0x28u);
deltatime(&v1, 3600LL);
enable_periodic_timer(7LL, reset_log_limiter);
return v2 - __readfsqword(0x28u);
}

canonical_decompiled_code:
unsigned __int64 func4()
{
__int64 v1; // [rsp+0h] [rbp-28h] BYREF
unsigned __int64 v2; // [rsp+18h] [rbp-10h]

v2 = __readfsqword(0x28u);
deltatime(&v1, 3600LL);
enable_periodic_timer(7LL, reset_log_limiter);
return v2 - __readfsqword(0x28u);
}

original_code:
void init_log_limiter(void)
{
 enable_periodic_timer(EVENT_RESET_LOG_LIMITER,
         reset_log_limiter,
         deltatime(secs_per_hour));
}

canonical_original_code:
void init_log_limiter()
{
 enable_periodic_timer(EVENT_RESET_LOG_LIMITER,
         reset_log_limiter,
         deltatime(secs_per_hour));
}

return_type: void


original_code:
static size_t jam_lset_pretty(struct jambuf *buf, enum_names *en, lset_t val,
         const char *separator, _Bool shorten)
{
 if (val == ((lset_t)0)) {
  return jam(buf, "none");
 }
 size_t s = 0;
 const char *sep = "";
 const struct enum_names *range = ((void *)0);
 const char *prefix = ((void *)0);
 for (unsigned e = 0; val != 0; e++) {
  lset_t bit = ((lset_t)1 << (e));
  if (val & bit) {
   if (range == ((void *)0) || e > range->en_last) {
    range = enum_range(en, e, &prefix);
   }
   s += jam_string(buf, sep);
   sep = separator;
   const char *name = enum_range_name(range, e, prefix, shorten);
   if (name == ((void *)0)) {
    s += jam(buf, "0x" "%""l" "x", bit);
   } else {
    s += jam_string(buf, name);
   }
  }
  val &= ~bit;
 }
 return s;
}

canonical_original_code:
static unsigned long jam_lset_pretty(struct jambuf *buf, struct enum_names *en, unsigned long val, char *separator, _Bool shorten)
{
 if (val == ((unsigned long)0)) {
  return jam(buf, "none");
 }
 unsigned long s = 0;
 char *sep = "";
 struct enum_names *range = ((void *)0);
 char *prefix = ((void *)0);
 for (unsigned int e = 0; val != 0; e++) {
  unsigned long bit = ((lset_t)1 << (e));
  if (val & bit) {
   if (range == ((void *)0) || e > range->en_last) {
    range = enum_range(en, e, &prefix);
   }
   s += jam_string(buf, sep);
   sep = separator;
   char *name = enum_range_name(range, e, prefix, shorten);
   if (name == ((void *)0)) {
    s += jam(buf, "0x" "%""l" "x", bit);
   } else {
    s += jam_string(buf, name);
   }
  }
  val &= ~bit;
 }
 return s;
}

variable_types: struct jambuf { char *array; unsigned long total; unsigned long roof; char *dots; } *

variable_types: struct enum_names { unsigned long en_first; unsigned long en_last; char **en_names; unsigned long en_checklen; char *en_prefix; struct enum_names *en_next_range; } *

variable_types:
val
unsigned long

variable_types:
separator
char *

variable_types:
s
unsigned long

variable_types:
sep
char *

variable_types:
prefix
char *

variable_types:
e
unsigned int

variable_types:
bit
unsigned long

variable_types:
name
char *

return_type: unsigned long


decompiled_code:
__int64 __fastcall test_lset(__int64 a1, __int64 a2)
{
__int64 v2; // rbp
unsigned int i; // er12
__int64 v4; // rbx

if ( !a2 )
return 1LL;
v2 = a2;
for ( i = 0; ; ++i )
{
v4 = 1LL << i;
if ( (v2 & (1LL << i)) != 0 && !enum_name(a1, i) )
break;
v2 &= ~v4;
if ( !v2 )
return 1LL;
}
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1, __int64 a2)
{
__int64 v2; // rbp
unsigned int i; // er12
__int64 v4; // rbx

if ( !a2 )
return 1LL;
v2 = a2;
for ( i = 0; ; ++i )
{
v4 = 1LL << i;
if ( (v2 & (1LL << i)) != 0 && !enum_name(a1, i) )
break;
v2 &= ~v4;
if ( !v2 )
return 1LL;
}
return 0LL;
}

original_code:
_Bool test_lset(const struct enum_names *en, lset_t val)
{
 for (unsigned e = 0; val != 0; e++) {
  lset_t bit = ((lset_t)1 << (e));
  if (val & bit) {
   const char *n = enum_name(en, e);
   if (n == ((void *)0)) {
    return 0;
   }
  }
  val &= ~bit;
 }
 return 1;
}

canonical_original_code:
_Bool test_lset(struct enum_names *en, unsigned long val)
{
 for (unsigned int e = 0; val != 0; e++) {
  unsigned long bit = ((lset_t)1 << (e));
  if (val & bit) {
   char *n = enum_name(en, e);
   if (n == ((void *)0)) {
    return 0;
   }
  }
  val &= ~bit;
 }
 return 1;
}

variable_types:
n
char *

user_defined_types: struct enum_names { unsigned long en_first; unsigned long en_last; char **en_names; unsigned long en_checklen; char *en_prefix; struct enum_names *en_next_range; }


decompiled_code:
__int64 __fastcall jam_lset(__int64 a1, __int64 a2, __int64 a3)
{
return jam_lset_pretty(a1, a2, a3, "+", 0);
}

original_code:
size_t jam_lset(struct jambuf *buf, enum_names *en, lset_t val)
{
 return jam_lset_pretty(buf, en, val, "+", 0);
}

canonical_original_code:
unsigned long jam_lset(struct jambuf *buf, struct enum_names *en, unsigned long val)
{
 return jam_lset_pretty(buf, en, val, "+", 0);
}

user_defined_types: struct jambuf { char *array; unsigned long total; unsigned long roof; char *dots; }


decompiled_code:
__int64 __fastcall str_lset(__int64 a1, __int64 a2, __int64 a3)
{
_QWORD v5[11]; // [rsp+0h] [rbp-58h] BYREF

v5[5] = __readfsqword(0x28u);
array_as_jambuf(v5, a3, 512LL);
jam_lset((__int64)v5, a1, a2);
return a3;
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1, __int64 a2, __int64 a3)
{
_QWORD v5[11]; // [rsp+0h] [rbp-58h] BYREF

v5[5] = __readfsqword(0x28u);
array_as_jambuf(v5, a3, 512LL);
func2((__int64)v5, a1, a2);
return a3;
}

original_code:
const char *str_lset(enum_names *en, lset_t val, lset_buf *out)
{
 struct jambuf buf = array_as_jambuf((out->buf), sizeof(out->buf));
 jam_lset(&buf, en, val);
 return out->buf;
}

canonical_original_code:
char *str_lset(struct enum_names *en, unsigned long val, struct lset_buf *out)
{
 struct jambuf buf = array_as_jambuf((out->buf), sizeof(out->buf));
 jam_lset(&buf, en, val);
 return out->buf;
}

variable_types:
out
struct lset_buf { char buf[512]; } *

variable_types: struct jambuf { char *array; unsigned long total; unsigned long roof; char *dots; }

return_type: char *


decompiled_code:
__int64 __fastcall jam_lset_short(__int64 a1, __int64 a2, void *a3, __int64 a4)
{
return jam_lset_pretty(a1, a2, a4, a3, 1u);
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1, __int64 a2, void *a3, __int64 a4)
{
return func0(a1, a2, a4, a3, 1u);
}

original_code:
size_t jam_lset_short(struct jambuf *buf, enum_names *en,
        const char *separator, lset_t val)
{
 return jam_lset_pretty(buf, en, val, separator, 1);
}

canonical_original_code:
unsigned long jam_lset_short(struct jambuf *buf, struct enum_names *en, char *separator, unsigned long val)
{
 return jam_lset_pretty(buf, en, val, separator, 1);
}


decompiled_code:
__int64 __fastcall str_lset_short(__int64 a1, void *a2, __int64 a3, __int64 a4)
{
_QWORD v7[11]; // [rsp+0h] [rbp-58h] BYREF

v7[5] = __readfsqword(0x28u);
array_as_jambuf(v7, a4, 512LL);
jam_lset_short((__int64)v7, a1, a2, a3);
return a4;
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1, void *a2, __int64 a3, __int64 a4)
{
_QWORD v7[11]; // [rsp+0h] [rbp-58h] BYREF

v7[5] = __readfsqword(0x28u);
array_as_jambuf(v7, a4, 512LL);
func4((__int64)v7, a1, a2, a3);
return a4;
}

original_code:
const char *str_lset_short(enum_names *en, const char *separator,
      lset_t val, lset_buf *out)
{
 struct jambuf buf = array_as_jambuf((out->buf), sizeof(out->buf));
 jam_lset_short(&buf, en, separator, val);
 return out->buf;
}

canonical_original_code:
char *str_lset_short(struct enum_names *en, char *separator, unsigned long val, struct lset_buf *out)
{
 struct jambuf buf = array_as_jambuf((out->buf), sizeof(out->buf));
 jam_lset_short(&buf, en, separator, val);
 return out->buf;
}


original_code:
size_t jam_sparse_lset(struct jambuf *buf, const struct sparse_name *sd, lset_t val)
{
 if (val == ((lset_t)0)) {
  return jam(buf, "none");
 }
 size_t s = 0;
 const char *sep = "";
 for (unsigned e = 0; val != 0; e++) {
  lset_t bit = ((lset_t)1 << (e));
  if (val & bit) {
   s += jam_string(buf, sep);
   sep = "+";
   const char *name = sparse_name(sd, bit);
   if (name == ((void *)0)) {
    s += jam(buf, "0x" "%""l" "x", bit);
   } else {
    s += jam_string(buf, name);
   }
  }
  val &= ~bit;
 }
 return s;
}

canonical_original_code:
unsigned long jam_sparse_lset(struct jambuf *buf, struct sparse_name *sd, unsigned long val)
{
 if (val == ((unsigned long)0)) {
  return jam(buf, "none");
 }
 unsigned long s = 0;
 char *sep = "";
 for (unsigned int e = 0; val != 0; e++) {
  unsigned long bit = ((lset_t)1 << (e));
  if (val & bit) {
   s += jam_string(buf, sep);
   sep = "+";
   char *name = sparse_name(sd, bit);
   if (name == ((void *)0)) {
    s += jam(buf, "0x" "%""l" "x", bit);
   } else {
    s += jam_string(buf, name);
   }
  }
  val &= ~bit;
 }
 return s;
}

variable_types: struct sparse_name { char *name; unsigned long value; } *


original_code:
static size_t jam_ipv4_endpoint(struct jambuf *buf, const struct ip_info *afi,
    const struct ip_bytes *bytes, unsigned hport)
{
 size_t s = 0;
 s += afi->address.jam(buf, afi, bytes);
 s += jam(buf, ":%u", hport);
 return s;
}

canonical_original_code:
static unsigned long jam_ipv4_endpoint(struct jambuf *buf, struct ip_info *afi, struct ip_bytes *bytes, unsigned int hport)
{
 unsigned long s = 0;
 s += afi->address.jam(buf, afi, bytes);
 s += jam(buf, ":%u", hport);
 return s;
}

variable_types: struct ip_info { enum ip_version { IPv4=4, IPv6=6 } ip_version; enum ip_index { IPv4_INDEX=0, IPv6_INDEX=1 } ip_index; char *ip_name; unsigned long ip_size; unsigned int mask_cnt; struct { struct ip_address { _Bool is_set; enum ip_version { IPv4=4, IPv6=6 } version; struct ip_bytes { unsigned char byte[16]; } bytes; } unspec; struct ip_address loopback; unsigned long (*jam)(struct jambuf *buf, struct ip_info *info, struct ip_bytes *bytes); unsigned long (*jam_wrapped)(struct jambuf *buf, struct ip_info *info, struct ip_bytes *bytes); } address; struct { unsigned long (*jam)(struct jambuf *buf, struct ip_info *info, struct ip_bytes *bytes, unsigned int hport); } endpoint; struct { struct ip_subnet { _Bool is_set; enum ip_version { IPv4=4, IPv6=6 } version; struct ip_bytes bytes; unsigned int maskbits; } zero; struct ip_subnet all; } subnet; struct { struct ip_range { _Bool is_set; _Bool is_subnet; enum ip_version { IPv4=4, IPv6=6 } version; struct ip_bytes start; struct ip_bytes end; } zero; struct ip_range all; } range; struct { struct ip_selector { _Bool is_set; enum ip_version { IPv4=4, IPv6=6 } version; struct ip_bytes bytes; unsigned int maskbits; unsigned int ipproto; int hport; } zero; struct ip_selector all; } selector; unsigned int ikev1_max_fragment_size; unsigned int ikev2_max_fragment_size; struct { int domain; char *domain_name; } socket; int af; char *af_name; unsigned long sockaddr_size; struct ip_address (*address_from_sockaddr)(struct ip_sockaddr { unsigned int len; union { struct sockaddr { unsigned short sa_family; char sa_data[14]; } sa; 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]; } sin; struct sockaddr_in6 { unsigned short sin6_family; unsigned short sin6_port; unsigned int sin6_flowinfo; struct in6_addr { union { unsigned char __u6_addr8[16]; unsigned short __u6_addr16[8]; unsigned int __u6_addr32[4]; } __in6_u; } sin6_addr; unsigned int sin6_scope_id; } sin6; } sa; } sa); struct ip_port { unsigned int hport; } (*port_from_sockaddr)(struct ip_sockaddr sa); enum ikev2_ts_type { IKEv2_TS_IPV4_ADDR_RANGE=7, IKEv2_TS_IPV6_ADDR_RANGE=8, IKEv2_TS_FC_ADDR_RANGE=9, IKEv2_TS_SECLABEL=10 } ikev2_ts_addr_range_type; enum ikev2_cp_attribute_type { IKEv2_CP_ATTR_RESERVED=0, IKEv2_INTERNAL_IP4_ADDRESS=1, IKEv2_INTERNAL_IP4_NETMASK=2, IKEv2_INTERNAL_IP4_DNS=3, IKEv2_INTERNAL_IP4_NBNS=4, IKEv2_RESERVED_5=5, IKEv2_INTERNAL_IP4_DHCP=6, IKEv2_APPLICATION_VERSION=7, IKEv2_INTERNAL_IP6_ADDRESS=8, IKEv2_RESERVED_9=9, IKEv2_INTERNAL_IP6_DNS=10, IKEv2_RESERVED_11=11, IKEv2_INTERNAL_IP6_DHCP=12, IKEv2_INTERNAL_IP4_SUBNET=13, IKEv2_SUPPORTED_ATTRIBUTES=14, IKEv2_INTERNAL_IP6_SUBNET=15, IKEv2_MIP6_HOME_PREFIX=16, IKEv2_INTERNAL_IP6_LINK=17, IKEv2_INTERNAL_IP6_PREFIX=18, IKEv2_HOME_AGENT_ADDRESS=19, IKEv2_P_CSCF_IP4_ADDRESS=20, IKEv2_P_CSCF_IP6_ADDRESS=21, IKEv2_FTT_KAT=22, IKEv2_EXTERNAL_SOURCE_IP4_NAT_INFO=23, IKEv2_TIMEOUT_PERIOD_FOR_LIVENESS_CHECK=24, IKEv2_INTERNAL_DNS_DOMAIN=25, IKEv2_INTERNAL_DNSSEC_TA=26 } ikev2_internal_address; enum ikev2_cp_attribute_type { IKEv2_CP_ATTR_RESERVED=0, IKEv2_INTERNAL_IP4_ADDRESS=1, IKEv2_INTERNAL_IP4_NETMASK=2, IKEv2_INTERNAL_IP4_DNS=3, IKEv2_INTERNAL_IP4_NBNS=4, IKEv2_RESERVED_5=5, IKEv2_INTERNAL_IP4_DHCP=6, IKEv2_APPLICATION_VERSION=7, IKEv2_INTERNAL_IP6_ADDRESS=8, IKEv2_RESERVED_9=9, IKEv2_INTERNAL_IP6_DNS=10, IKEv2_RESERVED_11=11, IKEv2_INTERNAL_IP6_DHCP=12, IKEv2_INTERNAL_IP4_SUBNET=13, IKEv2_SUPPORTED_ATTRIBUTES=14, IKEv2_INTERNAL_IP6_SUBNET=15, IKEv2_MIP6_HOME_PREFIX=16, IKEv2_INTERNAL_IP6_LINK=17, IKEv2_INTERNAL_IP6_PREFIX=18, IKEv2_HOME_AGENT_ADDRESS=19, IKEv2_P_CSCF_IP4_ADDRESS=20, IKEv2_P_CSCF_IP6_ADDRESS=21, IKEv2_FTT_KAT=22, IKEv2_EXTERNAL_SOURCE_IP4_NAT_INFO=23, IKEv2_TIMEOUT_PERIOD_FOR_LIVENESS_CHECK=24, IKEv2_INTERNAL_DNS_DOMAIN=25, IKEv2_INTERNAL_DNSSEC_TA=26 } ikev2_internal_dns; enum ike_id_type { ID_FROMCERT=-1, ID_NONE=0, ID_IPV4_ADDR=1, ID_FQDN=2, ID_USER_FQDN=3, ID_RFC822_ADDR=expr, ID_IPV4_ADDR_SUBNET=4, ID_IPV6_ADDR=5, ID_IPV6_ADDR_SUBNET=6, ID_IPV4_ADDR_RANGE=7, ID_IPV6_ADDR_RANGE=8, ID_DER_ASN1_DN=9, ID_DER_ASN1_GN=10, ID_KEY_ID=11, ID_FC_NAME=12, ID_NULL=13 } id_ip_addr; enum ike_id_type { ID_FROMCERT=-1, ID_NONE=0, ID_IPV4_ADDR=1, ID_FQDN=2, ID_USER_FQDN=3, ID_RFC822_ADDR=expr, ID_IPV4_ADDR_SUBNET=4, ID_IPV6_ADDR=5, ID_IPV6_ADDR_SUBNET=6, ID_IPV4_ADDR_RANGE=7, ID_IPV6_ADDR_RANGE=8, ID_DER_ASN1_DN=9, ID_DER_ASN1_GN=10, ID_KEY_ID=11, ID_FC_NAME=12, ID_NULL=13 } id_ip_addr_subnet; enum ike_id_type { ID_FROMCERT=-1, ID_NONE=0, ID_IPV4_ADDR=1, ID_FQDN=2, ID_USER_FQDN=3, ID_RFC822_ADDR=expr, ID_IPV4_ADDR_SUBNET=4, ID_IPV6_ADDR=5, ID_IPV6_ADDR_SUBNET=6, ID_IPV4_ADDR_RANGE=7, ID_IPV6_ADDR_RANGE=8, ID_DER_ASN1_DN=9, ID_DER_ASN1_GN=10, ID_KEY_ID=11, ID_FC_NAME=12, ID_NULL=13 } id_ip_addr_range; } *

variable_types:
bytes
struct ip_bytes *

variable_types:
hport
unsigned int

user_defined_types: struct ip_info { enum ip_version ip_version; enum ip_index ip_index; char *ip_name; unsigned long ip_size; unsigned int mask_cnt; struct { struct ip_address unspec; struct ip_address loopback; unsigned long (*jam)(struct jambuf *buf, struct ip_info *info, struct ip_bytes *bytes); unsigned long (*jam_wrapped)(struct jambuf *buf, struct ip_info *info, struct ip_bytes *bytes); } address; struct { unsigned long (*jam)(struct jambuf *buf, struct ip_info *info, struct ip_bytes *bytes, unsigned int hport); } endpoint; struct { struct ip_subnet zero; struct ip_subnet all; } subnet; struct { struct ip_range zero; struct ip_range all; } range; struct { struct ip_selector zero; struct ip_selector all; } selector; unsigned int ikev1_max_fragment_size; unsigned int ikev2_max_fragment_size; struct { int domain; char *domain_name; } socket; int af; char *af_name; unsigned long sockaddr_size; struct ip_address (*address_from_sockaddr)(struct ip_sockaddr sa); struct ip_port (*port_from_sockaddr)(struct ip_sockaddr sa); enum ikev2_ts_type ikev2_ts_addr_range_type; enum ikev2_cp_attribute_type ikev2_internal_address; enum ikev2_cp_attribute_type ikev2_internal_dns; enum ike_id_type id_ip_addr; enum ike_id_type id_ip_addr_subnet; enum ike_id_type id_ip_addr_range; }

user_defined_types: struct ip_address { _Bool is_set; enum ip_version version; struct ip_bytes bytes; }

user_defined_types: struct ip_subnet { _Bool is_set; enum ip_version version; struct ip_bytes bytes; unsigned int maskbits; }

user_defined_types: struct ip_range { _Bool is_set; _Bool is_subnet; enum ip_version version; struct ip_bytes start; struct ip_bytes end; }

user_defined_types: struct ip_selector { _Bool is_set; enum ip_version version; struct ip_bytes bytes; unsigned int maskbits; unsigned int ipproto; int hport; }

user_defined_types: struct ip_sockaddr { unsigned int len; union { struct sockaddr sa; struct sockaddr_in sin; struct sockaddr_in6 sin6; } sa; }

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_in6 { unsigned short sin6_family; unsigned short sin6_port; unsigned int sin6_flowinfo; struct in6_addr sin6_addr; unsigned int sin6_scope_id; }


original_code:
static size_t jam_ipv4_address(struct jambuf *buf, const struct ip_info *afi, const struct ip_bytes *bytes)
{
 const char *sep = "";
 size_t s = 0;
 for (size_t i = 0; i < afi->ip_size; i++) {
  s += jam(buf, "%s%""u", sep, bytes->byte[i]);
  sep = ".";
 }
 return s;
}

canonical_original_code:
static unsigned long jam_ipv4_address(struct jambuf *buf, struct ip_info *afi, struct ip_bytes *bytes)
{
 char *sep = "";
 unsigned long s = 0;
 for (unsigned long i = 0; i < afi->ip_size; i++) {
  s += jam(buf, "%s%""u", sep, bytes->byte[i]);
  sep = ".";
 }
 return s;
}

variable_types: struct jambuf { char *array; unsigned long total; unsigned long roof; char *dots; } *

variable_types:
i
unsigned long

user_defined_types: enum ip_index { IPv4_INDEX=0, IPv6_INDEX=1 }

user_defined_types: enum ikev2_ts_type { IKEv2_TS_IPV4_ADDR_RANGE=7, IKEv2_TS_IPV6_ADDR_RANGE=8, IKEv2_TS_FC_ADDR_RANGE=9, IKEv2_TS_SECLABEL=10 }

user_defined_types: enum ikev2_cp_attribute_type { IKEv2_CP_ATTR_RESERVED=0, IKEv2_INTERNAL_IP4_ADDRESS=1, IKEv2_INTERNAL_IP4_NETMASK=2, IKEv2_INTERNAL_IP4_DNS=3, IKEv2_INTERNAL_IP4_NBNS=4, IKEv2_RESERVED_5=5, IKEv2_INTERNAL_IP4_DHCP=6, IKEv2_APPLICATION_VERSION=7, IKEv2_INTERNAL_IP6_ADDRESS=8, IKEv2_RESERVED_9=9, IKEv2_INTERNAL_IP6_DNS=10, IKEv2_RESERVED_11=11, IKEv2_INTERNAL_IP6_DHCP=12, IKEv2_INTERNAL_IP4_SUBNET=13, IKEv2_SUPPORTED_ATTRIBUTES=14, IKEv2_INTERNAL_IP6_SUBNET=15, IKEv2_MIP6_HOME_PREFIX=16, IKEv2_INTERNAL_IP6_LINK=17, IKEv2_INTERNAL_IP6_PREFIX=18, IKEv2_HOME_AGENT_ADDRESS=19, IKEv2_P_CSCF_IP4_ADDRESS=20, IKEv2_P_CSCF_IP6_ADDRESS=21, IKEv2_FTT_KAT=22, IKEv2_EXTERNAL_SOURCE_IP4_NAT_INFO=23, IKEv2_TIMEOUT_PERIOD_FOR_LIVENESS_CHECK=24, IKEv2_INTERNAL_DNS_DOMAIN=25, IKEv2_INTERNAL_DNSSEC_TA=26 }

user_defined_types: enum ike_id_type { ID_FROMCERT=-1, ID_NONE=0, ID_IPV4_ADDR=1, ID_FQDN=2, ID_USER_FQDN=3, ID_RFC822_ADDR=expr, ID_IPV4_ADDR_SUBNET=4, ID_IPV6_ADDR=5, ID_IPV6_ADDR_SUBNET=6, ID_IPV4_ADDR_RANGE=7, ID_IPV6_ADDR_RANGE=8, ID_DER_ASN1_DN=9, ID_DER_ASN1_GN=10, ID_KEY_ID=11, ID_FC_NAME=12, ID_NULL=13 }

user_defined_types: struct ip_bytes { unsigned char byte[16]; }

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

user_defined_types: struct in6_addr { union { unsigned char __u6_addr8[16]; unsigned short __u6_addr16[8]; unsigned int __u6_addr32[4]; } __in6_u; }


original_code:
static size_t jam_ipv6_address(struct jambuf *buf, const struct ip_info *afi, const struct ip_bytes *bytes)
{
 size_t s = 0;
 shunk_t zeros = zeros_to_skip(afi, bytes);
 const char *sep = "";
 const uint8_t *ptr = bytes->byte;
 const uint8_t *last = ptr + afi->ip_size - 2;
 while (ptr <= last) {
  if (ptr == zeros.ptr) {
   s += jam(buf, "::");
   sep = "";
   ptr += zeros.len;
  } else {
   unsigned ia = (ptr[0] << 8) + ptr[1];
   s += jam(buf, "%s%x", sep, ia);
   sep = ":";
   ptr += 2;
  }
 }
 return s;
}

canonical_original_code:
static unsigned long jam_ipv6_address(struct jambuf *buf, struct ip_info *afi, struct ip_bytes *bytes)
{
 unsigned long s = 0;
 struct shunk zeros = zeros_to_skip(afi, bytes);
 char *sep = "";
 unsigned char *ptr = bytes->byte;
 unsigned char *last = ptr + afi->ip_size - 2;
 while (ptr <= last) {
  if (ptr == zeros.ptr) {
   s += jam(buf, "::");
   sep = "";
   ptr += zeros.len;
  } else {
   unsigned int ia = (ptr[0] << 8) + ptr[1];
   s += jam(buf, "%s%x", sep, ia);
   sep = ":";
   ptr += 2;
  }
 }
 return s;
}

variable_types: struct shunk { void *ptr; unsigned long len; }

variable_types:
ptr
unsigned char *

variable_types:
last
unsigned char *

variable_types:
ia
unsigned int


decompiled_code:
__int64 __fastcall jam_ipv6_address_wrapped(__int64 a1, __int64 a2, unsigned __int64 a3)
{
__int64 v4; // rbx
__int64 v5; // rcx
__int64 v6; // rbx

v4 = jam_string(a1, "[");
v6 = jam_ipv6_address(a1, a2, a3, v5) + v4;
return v6 + jam_string(a1, "]");
}

canonical_decompiled_code:
__int64 __fastcall func8(__int64 a1, __int64 a2, unsigned __int64 a3)
{
__int64 v4; // rbx
__int64 v5; // rcx
__int64 v6; // rbx

v4 = jam_string(a1, "[");
v6 = func7(a1, a2, a3, v5) + v4;
return v6 + jam_string(a1, "]");
}

original_code:
static size_t jam_ipv6_address_wrapped(struct jambuf *buf, const struct ip_info *afi, const struct ip_bytes *bytes)
{
 size_t s = 0;
 s += jam_string(buf, "[");
 s += jam_ipv6_address(buf, afi, bytes);
 s += jam_string(buf, "]");
 return s;
}

canonical_original_code:
static unsigned long jam_ipv6_address_wrapped(struct jambuf *buf, struct ip_info *afi, struct ip_bytes *bytes)
{
 unsigned long s = 0;
 s += jam_string(buf, "[");
 s += jam_ipv6_address(buf, afi, bytes);
 s += jam_string(buf, "]");
 return s;
}

variable_types:
s
unsigned long


decompiled_code:
__int64 __fastcall jam_ipv6_endpoint(__int64 a1, __int64 a2, unsigned __int64 a3, unsigned int a4)
{
__int64 v5; // rbx

v5 = jam_ipv6_address_wrapped(a1, a2, a3);
return v5 + jam(a1, ":%u", a4);
}

canonical_decompiled_code:
__int64 __fastcall func9(__int64 a1, __int64 a2, unsigned __int64 a3, unsigned int a4)
{
__int64 v5; // rbx

v5 = func8(a1, a2, a3);
return v5 + jam(a1, ":%u", a4);
}

original_code:
static size_t jam_ipv6_endpoint(struct jambuf *buf, const struct ip_info *afi,
    const struct ip_bytes *bytes, unsigned hport)
{
 size_t s = 0;
 s += jam_ipv6_address_wrapped(buf, afi, bytes);
 s += jam(buf, ":%u", hport);
 return s;
}

canonical_original_code:
static unsigned long jam_ipv6_endpoint(struct jambuf *buf, struct ip_info *afi, struct ip_bytes *bytes, unsigned int hport)
{
 unsigned long s = 0;
 s += jam_ipv6_address_wrapped(buf, afi, bytes);
 s += jam(buf, ":%u", hport);
 return s;
}


aftoinfo

decompiled_code:
char *__fastcall aftoinfo(int a1)
{
char *result; // rax

result = (char *)&ip_families;
if ( a1 != 2 )
{
result = (char *)&ip_families + 400;
if ( a1 != 10 )
result = 0LL;
}
return result;
}

canonical_decompiled_code:
char *__fastcall func10(int a1)
{
char *result; // rax

result = (char *)&ip_families;
if ( a1 != 2 )
{
result = (char *)&ip_families + 400;
if ( a1 != 10 )
result = 0LL;
}
return result;
}

original_code:
const struct ip_info *aftoinfo(int af)
{
 switch (af) {
 case 2:
  return &ip_families[IPv4_INDEX];
 case 10:
  return &ip_families[IPv6_INDEX];
 case 0:
  return ((void *)0);
 default:
  return ((void *)0);
 }
}

variable_types: af int

return_type: struct ip_info { enum ip_version { IPv4=4, IPv6=6 } ip_version; enum ip_index { IPv4_INDEX=0, IPv6_INDEX=1 } ip_index; char *ip_name; unsigned long ip_size; unsigned int mask_cnt; struct { struct ip_address { _Bool is_set; enum ip_version { IPv4=4, IPv6=6 } version; struct ip_bytes { unsigned char byte[16]; } bytes; } unspec; struct ip_address loopback; unsigned long (*jam)(struct jambuf { char *array; unsigned long total; unsigned long roof; char *dots; } *buf, struct ip_info *info, struct ip_bytes *bytes); unsigned long (*jam_wrapped)(struct jambuf *buf, struct ip_info *info, struct ip_bytes *bytes); } address; struct { unsigned long (*jam)(struct jambuf *buf, struct ip_info *info, struct ip_bytes *bytes, unsigned int hport); } endpoint; struct { struct ip_subnet { _Bool is_set; enum ip_version { IPv4=4, IPv6=6 } version; struct ip_bytes bytes; unsigned int maskbits; } zero; struct ip_subnet all; } subnet; struct { struct ip_range { _Bool is_set; _Bool is_subnet; enum ip_version { IPv4=4, IPv6=6 } version; struct ip_bytes start; struct ip_bytes end; } zero; struct ip_range all; } range; struct { struct ip_selector { _Bool is_set; enum ip_version { IPv4=4, IPv6=6 } version; struct ip_bytes bytes; unsigned int maskbits; unsigned int ipproto; int hport; } zero; struct ip_selector all; } selector; unsigned int ikev1_max_fragment_size; unsigned int ikev2_max_fragment_size; struct { int domain; char *domain_name; } socket; int af; char *af_name; unsigned long sockaddr_size; struct ip_address (*address_from_sockaddr)(struct ip_sockaddr { unsigned int len; union { struct sockaddr { unsigned short sa_family; char sa_data[14]; } sa; 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]; } sin; struct sockaddr_in6 { unsigned short sin6_family; unsigned short sin6_port; unsigned int sin6_flowinfo; struct in6_addr { union { unsigned char __u6_addr8[16]; unsigned short __u6_addr16[8]; unsigned int __u6_addr32[4]; } __in6_u; } sin6_addr; unsigned int sin6_scope_id; } sin6; } sa; } sa); struct ip_port { unsigned int hport; } (*port_from_sockaddr)(struct ip_sockaddr sa); enum ikev2_ts_type { IKEv2_TS_IPV4_ADDR_RANGE=7, IKEv2_TS_IPV6_ADDR_RANGE=8, IKEv2_TS_FC_ADDR_RANGE=9, IKEv2_TS_SECLABEL=10 } ikev2_ts_addr_range_type; enum ikev2_cp_attribute_type { IKEv2_CP_ATTR_RESERVED=0, IKEv2_INTERNAL_IP4_ADDRESS=1, IKEv2_INTERNAL_IP4_NETMASK=2, IKEv2_INTERNAL_IP4_DNS=3, IKEv2_INTERNAL_IP4_NBNS=4, IKEv2_RESERVED_5=5, IKEv2_INTERNAL_IP4_DHCP=6, IKEv2_APPLICATION_VERSION=7, IKEv2_INTERNAL_IP6_ADDRESS=8, IKEv2_RESERVED_9=9, IKEv2_INTERNAL_IP6_DNS=10, IKEv2_RESERVED_11=11, IKEv2_INTERNAL_IP6_DHCP=12, IKEv2_INTERNAL_IP4_SUBNET=13, IKEv2_SUPPORTED_ATTRIBUTES=14, IKEv2_INTERNAL_IP6_SUBNET=15, IKEv2_MIP6_HOME_PREFIX=16, IKEv2_INTERNAL_IP6_LINK=17, IKEv2_INTERNAL_IP6_PREFIX=18, IKEv2_HOME_AGENT_ADDRESS=19, IKEv2_P_CSCF_IP4_ADDRESS=20, IKEv2_P_CSCF_IP6_ADDRESS=21, IKEv2_FTT_KAT=22, IKEv2_EXTERNAL_SOURCE_IP4_NAT_INFO=23, IKEv2_TIMEOUT_PERIOD_FOR_LIVENESS_CHECK=24, IKEv2_INTERNAL_DNS_DOMAIN=25, IKEv2_INTERNAL_DNSSEC_TA=26 } ikev2_internal_address; enum ikev2_cp_attribute_type { IKEv2_CP_ATTR_RESERVED=0, IKEv2_INTERNAL_IP4_ADDRESS=1, IKEv2_INTERNAL_IP4_NETMASK=2, IKEv2_INTERNAL_IP4_DNS=3, IKEv2_INTERNAL_IP4_NBNS=4, IKEv2_RESERVED_5=5, IKEv2_INTERNAL_IP4_DHCP=6, IKEv2_APPLICATION_VERSION=7, IKEv2_INTERNAL_IP6_ADDRESS=8, IKEv2_RESERVED_9=9, IKEv2_INTERNAL_IP6_DNS=10, IKEv2_RESERVED_11=11, IKEv2_INTERNAL_IP6_DHCP=12, IKEv2_INTERNAL_IP4_SUBNET=13, IKEv2_SUPPORTED_ATTRIBUTES=14, IKEv2_INTERNAL_IP6_SUBNET=15, IKEv2_MIP6_HOME_PREFIX=16, IKEv2_INTERNAL_IP6_LINK=17, IKEv2_INTERNAL_IP6_PREFIX=18, IKEv2_HOME_AGENT_ADDRESS=19, IKEv2_P_CSCF_IP4_ADDRESS=20, IKEv2_P_CSCF_IP6_ADDRESS=21, IKEv2_FTT_KAT=22, IKEv2_EXTERNAL_SOURCE_IP4_NAT_INFO=23, IKEv2_TIMEOUT_PERIOD_FOR_LIVENESS_CHECK=24, IKEv2_INTERNAL_DNS_DOMAIN=25, IKEv2_INTERNAL_DNSSEC_TA=26 } ikev2_internal_dns; enum ike_id_type { ID_FROMCERT=-1, ID_NONE=0, ID_IPV4_ADDR=1, ID_FQDN=2, ID_USER_FQDN=3, ID_RFC822_ADDR=expr, ID_IPV4_ADDR_SUBNET=4, ID_IPV6_ADDR=5, ID_IPV6_ADDR_SUBNET=6, ID_IPV4_ADDR_RANGE=7, ID_IPV6_ADDR_RANGE=8, ID_DER_ASN1_DN=9, ID_DER_ASN1_GN=10, ID_KEY_ID=11, ID_FC_NAME=12, ID_NULL=13 } id_ip_addr; enum ike_id_type { ID_FROMCERT=-1, ID_NONE=0, ID_IPV4_ADDR=1, ID_FQDN=2, ID_USER_FQDN=3, ID_RFC822_ADDR=expr, ID_IPV4_ADDR_SUBNET=4, ID_IPV6_ADDR=5, ID_IPV6_ADDR_SUBNET=6, ID_IPV4_ADDR_RANGE=7, ID_IPV6_ADDR_RANGE=8, ID_DER_ASN1_DN=9, ID_DER_ASN1_GN=10, ID_KEY_ID=11, ID_FC_NAME=12, ID_NULL=13 } id_ip_addr_subnet; enum ike_id_type { ID_FROMCERT=-1, ID_NONE=0, ID_IPV4_ADDR=1, ID_FQDN=2, ID_USER_FQDN=3, ID_RFC822_ADDR=expr, ID_IPV4_ADDR_SUBNET=4, ID_IPV6_ADDR=5, ID_IPV6_ADDR_SUBNET=6, ID_IPV4_ADDR_RANGE=7, ID_IPV6_ADDR_RANGE=8, ID_DER_ASN1_DN=9, ID_DER_ASN1_GN=10, ID_KEY_ID=11, ID_FC_NAME=12, ID_NULL=13 } id_ip_addr_range; } *


decompiled_code:
__int64 lsw_conf_setdefault()
{
__int64 result; // rax

result = 0LL;
if ( !(_QWORD)global_oco )
{
*(_QWORD *)&global_oco = clone_bytes(&LC1, 1LL, "rootdir");
*((_QWORD *)&global_oco + 1) = clone_bytes("/etc", 5LL, "default conf ipsec_conf_dir");
*(_QWORD *)&xmmword_8B0 = clone_bytes("/etc/ipsec.conf", 16LL, "default conf conffile");
*((_QWORD *)&xmmword_8B0 + 1) = clone_bytes("/etc/ipsec.secrets", 19LL, "default ipsec.secrets");
qword_8C8 = clone_bytes("/var", 5LL, "default vardir");
*(_QWORD *)&xmmword_8D0 = clone_bytes("/etc/ipsec.d", 13LL, "default conf ipsecd_dir");
qword_900 = clone_bytes("/var/lib/ipsec/nss", 19LL, "default nssdir");
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 func0()
{
__int64 result; // rax

result = 0LL;
if ( !(_QWORD)global_oco )
{
*(_QWORD *)&global_oco = clone_bytes(&LC1, 1LL, "rootdir");
*((_QWORD *)&global_oco + 1) = clone_bytes("/etc", 5LL, "default conf ipsec_conf_dir");
*(_QWORD *)&xmmword_8B0 = clone_bytes("/etc/ipsec.conf", 16LL, "default conf conffile");
*((_QWORD *)&xmmword_8B0 + 1) = clone_bytes("/etc/ipsec.secrets", 19LL, "default ipsec.secrets");
qword_8C8 = clone_bytes("/var", 5LL, "default vardir");
*(_QWORD *)&xmmword_8D0 = clone_bytes("/etc/ipsec.d", 13LL, "default conf ipsecd_dir");
qword_900 = clone_bytes("/var/lib/ipsec/nss", 19LL, "default nssdir");
result = 1LL;
}
return result;
}

original_code:
static _Bool lsw_conf_setdefault(void)
{
 if (global_oco.rootdir != ((void *)0)) {
  return 0;
 }
 global_oco.rootdir = (("") == ((void *)0) ? ((void *)0) : clone_bytes((""), strlen(("")) + 1, ("rootdir")));
 global_oco.confdir = (("/etc") == ((void *)0) ? ((void *)0) : clone_bytes(("/etc"), strlen(("/etc")) + 1, ("default conf ipsec_conf_dir")));
 global_oco.conffile = (("/etc/ipsec.conf") == ((void *)0) ? ((void *)0) : clone_bytes(("/etc/ipsec.conf"), strlen(("/etc/ipsec.conf")) + 1, ("default conf conffile")));
 global_oco.secretsfile = (("/etc/ipsec.secrets") == ((void *)0) ? ((void *)0) : clone_bytes(("/etc/ipsec.secrets"), strlen(("/etc/ipsec.secrets")) + 1, ("default ipsec.secrets")));
 global_oco.vardir = (("/var") == ((void *)0) ? ((void *)0) : clone_bytes(("/var"), strlen(("/var")) + 1, ("default vardir")));
 global_oco.confddir = (("/etc/ipsec.d") == ((void *)0) ? ((void *)0) : clone_bytes(("/etc/ipsec.d"), strlen(("/etc/ipsec.d")) + 1, ("default conf ipsecd_dir")));
 global_oco.nssdir = (("/var/lib/ipsec/nss") == ((void *)0) ? ((void *)0) : clone_bytes(("/var/lib/ipsec/nss"), strlen(("/var/lib/ipsec/nss")) + 1, ("default nssdir")));
 return 1;
}

canonical_original_code:
static _Bool lsw_conf_setdefault()
{
 if (global_oco.rootdir != ((void *)0)) {
  return 0;
 }
 global_oco.rootdir = (("") == ((void *)0) ? ((void *)0) : clone_bytes((""), strlen(("")) + 1, ("rootdir")));
 global_oco.confdir = (("/etc") == ((void *)0) ? ((void *)0) : clone_bytes(("/etc"), strlen(("/etc")) + 1, ("default conf ipsec_conf_dir")));
 global_oco.conffile = (("/etc/ipsec.conf") == ((void *)0) ? ((void *)0) : clone_bytes(("/etc/ipsec.conf"), strlen(("/etc/ipsec.conf")) + 1, ("default conf conffile")));
 global_oco.secretsfile = (("/etc/ipsec.secrets") == ((void *)0) ? ((void *)0) : clone_bytes(("/etc/ipsec.secrets"), strlen(("/etc/ipsec.secrets")) + 1, ("default ipsec.secrets")));
 global_oco.vardir = (("/var") == ((void *)0) ? ((void *)0) : clone_bytes(("/var"), strlen(("/var")) + 1, ("default vardir")));
 global_oco.confddir = (("/etc/ipsec.d") == ((void *)0) ? ((void *)0) : clone_bytes(("/etc/ipsec.d"), strlen(("/etc/ipsec.d")) + 1, ("default conf ipsecd_dir")));
 global_oco.nssdir = (("/var/lib/ipsec/nss") == ((void *)0) ? ((void *)0) : clone_bytes(("/var/lib/ipsec/nss"), strlen(("/var/lib/ipsec/nss")) + 1, ("default nssdir")));
 return 1;
}


subst

decompiled_code:
unsigned __int64 __fastcall subst(__int64 *a1, const char *a2, __int64 a3)
{
__int64 v4; // rbp
size_t v5; // rax
unsigned __int64 v7; // [rsp+8h] [rbp-20h]

v4 = (__int64)a2;
v7 = __readfsqword(0x28u);
if ( *a1 )
{
pfree();
*a1 = 0LL;
}
if ( a2 )
{
v5 = strlen(a2);
v4 = clone_bytes(a2, v5 + 1, a3);
}
*a1 = v4;
return v7 - __readfsqword(0x28u);
}

canonical_decompiled_code:
unsigned __int64 __fastcall func1(__int64 *a1, const char *a2, __int64 a3)
{
__int64 v4; // rbp
size_t v5; // rax
unsigned __int64 v7; // [rsp+8h] [rbp-20h]

v4 = (__int64)a2;
v7 = __readfsqword(0x28u);
if ( *a1 )
{
pfree();
*a1 = 0LL;
}
if ( a2 )
{
v5 = strlen(a2);
v4 = clone_bytes(a2, v5 + 1, a3);
}
*a1 = v4;
return v7 - __readfsqword(0x28u);
}

original_code:
static void subst(char **field, const char *value, const char *name)
{
 { typeof(*field) *pp_ = &(*field); if (*pp_ != ((void *)0)) { pfree(*pp_); *pp_ = ((void *)0); } };
 *field = ((value) == ((void *)0) ? ((void *)0) : clone_bytes((value), strlen((value)) + 1, (name)));
}

canonical_original_code:
static void subst(char **field, char *value, char *name)
{
 { typeof(*field) *pp_ = &(*field); if (*pp_ != ((void *)0)) { pfree(*pp_); *pp_ = ((void *)0); } };
 *field = ((value) == ((void *)0) ? ((void *)0) : clone_bytes((value), strlen((value)) + 1, (name)));
}

variable_types:
field
char **

variable_types:
value
char *


decompiled_code:
unsigned __int64 lsw_conf_calculate()
{
char _0[4104]; // [rsp+0h] [rbp+0h] BYREF
unsigned __int64 vars1008; // [rsp+1008h] [rbp+1008h]

vars1008 = __readfsqword(0x28u);
_snprintf_chk(_0, 4096LL, 1LL, 4096LL, "%s/cacerts", (const char *)xmmword_8D0);
subst((__int64 *)&xmmword_8E0, _0, (__int64)"cacert path");
_snprintf_chk(_0, 4096LL, 1LL, 4096LL, "%s/crls", (const char *)xmmword_8D0);
subst((__int64 *)&xmmword_8E0 + 1, _0, (__int64)"crls path");
_snprintf_chk(_0, 4096LL, 1LL, 4096LL, "%s/policies", (const char *)xmmword_8D0);
subst((__int64 *)&xmmword_8D0 + 1, _0, (__int64)"policies path");
_snprintf_chk(_0, 4096LL, 1LL, 4096LL, "%s/nsspassword", (const char *)xmmword_8D0);
subst((__int64 *)&xmmword_8F0, _0, (__int64)"nsspassword file");
return vars1008 - __readfsqword(0x28u);
}

canonical_decompiled_code:
unsigned __int64 func2()
{
char _0[4104]; // [rsp+0h] [rbp+0h] BYREF
unsigned __int64 vars1008; // [rsp+1008h] [rbp+1008h]

vars1008 = __readfsqword(0x28u);
_snprintf_chk(_0, 4096LL, 1LL, 4096LL, "%s/cacerts", (const char *)xmmword_8D0);
func1((__int64 *)&xmmword_8E0, _0, (__int64)"cacert path");
_snprintf_chk(_0, 4096LL, 1LL, 4096LL, "%s/crls", (const char *)xmmword_8D0);
func1((__int64 *)&xmmword_8E0 + 1, _0, (__int64)"crls path");
_snprintf_chk(_0, 4096LL, 1LL, 4096LL, "%s/policies", (const char *)xmmword_8D0);
func1((__int64 *)&xmmword_8D0 + 1, _0, (__int64)"policies path");
_snprintf_chk(_0, 4096LL, 1LL, 4096LL, "%s/nsspassword", (const char *)xmmword_8D0);
func1((__int64 *)&xmmword_8F0, _0, (__int64)"nsspassword file");
return vars1008 - __readfsqword(0x28u);
}

original_code:
static void lsw_conf_calculate(void)
{
 char buf[4096];
 snprintf(buf, sizeof(buf), "%s" "/cacerts", global_oco.confddir);
 subst(&global_oco.cacerts_dir, buf, "cacert path");
 snprintf(buf, sizeof(buf), "%s" "/crls", global_oco.confddir);
 subst(&global_oco.crls_dir, buf, "crls path");
 snprintf(buf, sizeof(buf), "%s/policies", global_oco.confddir);
 subst(&global_oco.policies_dir, buf, "policies path");
 snprintf(buf, sizeof(buf), "%s/nsspassword", global_oco.confddir);
 subst(&global_oco.nsspassword_file, buf, "nsspassword file");
}

canonical_original_code:
static void lsw_conf_calculate()
{
 char buf[4096];
 snprintf(buf, sizeof(buf), "%s" "/cacerts", global_oco.confddir);
 subst(&global_oco.cacerts_dir, buf, "cacert path");
 snprintf(buf, sizeof(buf), "%s" "/crls", global_oco.confddir);
 subst(&global_oco.crls_dir, buf, "crls path");
 snprintf(buf, sizeof(buf), "%s/policies", global_oco.confddir);
 subst(&global_oco.policies_dir, buf, "policies path");
 snprintf(buf, sizeof(buf), "%s/nsspassword", global_oco.confddir);
 subst(&global_oco.nsspassword_file, buf, "nsspassword file");
}

variable_types:
buf
char [4096]


decompiled_code:
unsigned __int64 lsw_conf_free_oco()
{
unsigned __int64 v1; // [rsp+8h] [rbp-10h]

v1 = __readfsqword(0x28u);
if ( (_QWORD)global_oco )
{
pfree();
*(_QWORD *)&global_oco = 0LL;
}
if ( *((_QWORD *)&global_oco + 1) )
{
pfree();
*((_QWORD *)&global_oco + 1) = 0LL;
}
if ( (_QWORD)xmmword_8B0 )
{
pfree();
*(_QWORD *)&xmmword_8B0 = 0LL;
}
if ( *((_QWORD *)&xmmword_8B0 + 1) )
{
pfree();
*((_QWORD *)&xmmword_8B0 + 1) = 0LL;
}
if ( qword_8C8 )
{
pfree();
qword_8C8 = 0LL;
}
if ( (_QWORD)xmmword_8D0 )
{
pfree();
*(_QWORD *)&xmmword_8D0 = 0LL;
}
if ( *((_QWORD *)&xmmword_8D0 + 1) )
{
pfree();
*((_QWORD *)&xmmword_8D0 + 1) = 0LL;
}
if ( (_QWORD)xmmword_8E0 )
{
pfree();
*(_QWORD *)&xmmword_8E0 = 0LL;
}
if ( *((_QWORD *)&xmmword_8E0 + 1) )
{
pfree();
*((_QWORD *)&xmmword_8E0 + 1) = 0LL;
}
if ( (_QWORD)xmmword_8F0 )
{
pfree();
*(_QWORD *)&xmmword_8F0 = 0LL;
}
if ( *((_QWORD *)&xmmword_8F0 + 1) )
{
pfree();
*((_QWORD *)&xmmword_8F0 + 1) = 0LL;
}
if ( qword_900 )
pfree();
qword_900 = 0xFBFBFBFBFBFBFBFBLL;
global_oco = (__int128)_mm_load_si128((const __m128i *)&LC22);
xmmword_8B0 = global_oco;
unk_8C0 = global_oco;
xmmword_8D0 = global_oco;
xmmword_8E0 = global_oco;
xmmword_8F0 = global_oco;
return v1 - __readfsqword(0x28u);
}

canonical_decompiled_code:
unsigned __int64 func3()
{
unsigned __int64 v1; // [rsp+8h] [rbp-10h]

v1 = __readfsqword(0x28u);
if ( (_QWORD)global_oco )
{
pfree();
*(_QWORD *)&global_oco = 0LL;
}
if ( *((_QWORD *)&global_oco + 1) )
{
pfree();
*((_QWORD *)&global_oco + 1) = 0LL;
}
if ( (_QWORD)xmmword_8B0 )
{
pfree();
*(_QWORD *)&xmmword_8B0 = 0LL;
}
if ( *((_QWORD *)&xmmword_8B0 + 1) )
{
pfree();
*((_QWORD *)&xmmword_8B0 + 1) = 0LL;
}
if ( qword_8C8 )
{
pfree();
qword_8C8 = 0LL;
}
if ( (_QWORD)xmmword_8D0 )
{
pfree();
*(_QWORD *)&xmmword_8D0 = 0LL;
}
if ( *((_QWORD *)&xmmword_8D0 + 1) )
{
pfree();
*((_QWORD *)&xmmword_8D0 + 1) = 0LL;
}
if ( (_QWORD)xmmword_8E0 )
{
pfree();
*(_QWORD *)&xmmword_8E0 = 0LL;
}
if ( *((_QWORD *)&xmmword_8E0 + 1) )
{
pfree();
*((_QWORD *)&xmmword_8E0 + 1) = 0LL;
}
if ( (_QWORD)xmmword_8F0 )
{
pfree();
*(_QWORD *)&xmmword_8F0 = 0LL;
}
if ( *((_QWORD *)&xmmword_8F0 + 1) )
{
pfree();
*((_QWORD *)&xmmword_8F0 + 1) = 0LL;
}
if ( qword_900 )
pfree();
qword_900 = 0xFBFBFBFBFBFBFBFBLL;
global_oco = (__int128)_mm_load_si128((const __m128i *)&LC22);
xmmword_8B0 = global_oco;
unk_8C0 = global_oco;
xmmword_8D0 = global_oco;
xmmword_8E0 = global_oco;
xmmword_8F0 = global_oco;
return v1 - __readfsqword(0x28u);
}

original_code:
void lsw_conf_free_oco(void)
{
 { typeof(global_oco.rootdir) *pp_ = &(global_oco.rootdir); if (*pp_ != ((void *)0)) { pfree(*pp_); *pp_ = ((void *)0); } };
 { typeof(global_oco.confdir) *pp_ = &(global_oco.confdir); if (*pp_ != ((void *)0)) { pfree(*pp_); *pp_ = ((void *)0); } };
 { typeof(global_oco.conffile) *pp_ = &(global_oco.conffile); if (*pp_ != ((void *)0)) { pfree(*pp_); *pp_ = ((void *)0); } };
 { typeof(global_oco.secretsfile) *pp_ = &(global_oco.secretsfile); if (*pp_ != ((void *)0)) { pfree(*pp_); *pp_ = ((void *)0); } };
 { typeof(global_oco.vardir) *pp_ = &(global_oco.vardir); if (*pp_ != ((void *)0)) { pfree(*pp_); *pp_ = ((void *)0); } };
 { typeof(global_oco.confddir) *pp_ = &(global_oco.confddir); if (*pp_ != ((void *)0)) { pfree(*pp_); *pp_ = ((void *)0); } };
 { typeof(global_oco.policies_dir) *pp_ = &(global_oco.policies_dir); if (*pp_ != ((void *)0)) { pfree(*pp_); *pp_ = ((void *)0); } };
 { typeof(global_oco.cacerts_dir) *pp_ = &(global_oco.cacerts_dir); if (*pp_ != ((void *)0)) { pfree(*pp_); *pp_ = ((void *)0); } };
 { typeof(global_oco.crls_dir) *pp_ = &(global_oco.crls_dir); if (*pp_ != ((void *)0)) { pfree(*pp_); *pp_ = ((void *)0); } };
 { typeof(global_oco.nsspassword_file) *pp_ = &(global_oco.nsspassword_file); if (*pp_ != ((void *)0)) { pfree(*pp_); *pp_ = ((void *)0); } };
 { typeof(global_oco.nsspassword) *pp_ = &(global_oco.nsspassword); if (*pp_ != ((void *)0)) { pfree(*pp_); *pp_ = ((void *)0); } };
 { typeof(global_oco.nssdir) *pp_ = &(global_oco.nssdir); if (*pp_ != ((void *)0)) { pfree(*pp_); *pp_ = ((void *)0); } };
 memset(((&global_oco)), 0xFB, (sizeof(*(&global_oco))));
}

canonical_original_code:
void lsw_conf_free_oco()
{
 { typeof(global_oco.rootdir) *pp_ = &(global_oco.rootdir); if (*pp_ != ((void *)0)) { pfree(*pp_); *pp_ = ((void *)0); } };
 { typeof(global_oco.confdir) *pp_ = &(global_oco.confdir); if (*pp_ != ((void *)0)) { pfree(*pp_); *pp_ = ((void *)0); } };
 { typeof(global_oco.conffile) *pp_ = &(global_oco.conffile); if (*pp_ != ((void *)0)) { pfree(*pp_); *pp_ = ((void *)0); } };
 { typeof(global_oco.secretsfile) *pp_ = &(global_oco.secretsfile); if (*pp_ != ((void *)0)) { pfree(*pp_); *pp_ = ((void *)0); } };
 { typeof(global_oco.vardir) *pp_ = &(global_oco.vardir); if (*pp_ != ((void *)0)) { pfree(*pp_); *pp_ = ((void *)0); } };
 { typeof(global_oco.confddir) *pp_ = &(global_oco.confddir); if (*pp_ != ((void *)0)) { pfree(*pp_); *pp_ = ((void *)0); } };
 { typeof(global_oco.policies_dir) *pp_ = &(global_oco.policies_dir); if (*pp_ != ((void *)0)) { pfree(*pp_); *pp_ = ((void *)0); } };
 { typeof(global_oco.cacerts_dir) *pp_ = &(global_oco.cacerts_dir); if (*pp_ != ((void *)0)) { pfree(*pp_); *pp_ = ((void *)0); } };
 { typeof(global_oco.crls_dir) *pp_ = &(global_oco.crls_dir); if (*pp_ != ((void *)0)) { pfree(*pp_); *pp_ = ((void *)0); } };
 { typeof(global_oco.nsspassword_file) *pp_ = &(global_oco.nsspassword_file); if (*pp_ != ((void *)0)) { pfree(*pp_); *pp_ = ((void *)0); } };
 { typeof(global_oco.nsspassword) *pp_ = &(global_oco.nsspassword); if (*pp_ != ((void *)0)) { pfree(*pp_); *pp_ = ((void *)0); } };
 { typeof(global_oco.nssdir) *pp_ = &(global_oco.nssdir); if (*pp_ != ((void *)0)) { pfree(*pp_); *pp_ = ((void *)0); } };
 memset(((&global_oco)), 0xFB, (sizeof(*(&global_oco))));
}


decompiled_code:
__int128 *lsw_init_options()
{
if ( (unsigned __int8)lsw_conf_setdefault() )
lsw_conf_calculate();
return &global_oco;
}

canonical_decompiled_code:
__int128 *func4()
{
if ( (unsigned __int8)func0() )
func2();
return &global_oco;
}

original_code:
const struct lsw_conf_options *lsw_init_options(void)
{
 if (lsw_conf_setdefault()) {
  lsw_conf_calculate();
 }
 return &global_oco;
}

canonical_original_code:
struct lsw_conf_options *lsw_init_options()
{
 if (lsw_conf_setdefault()) {
  lsw_conf_calculate();
 }
 return &global_oco;
}

return_type: struct lsw_conf_options { char *rootdir; char *confdir; char *conffile; char *secretsfile; char *ppkdir; char *vardir; char *confddir; char *policies_dir; char *cacerts_dir; char *crls_dir; char *nsspassword_file; char *nsspassword; char *nssdir; } *


decompiled_code:
unsigned __int64 __fastcall lsw_conf_rootdir(const char *a1)
{
lsw_conf_setdefault();
subst((__int64 *)&global_oco, a1, (__int64)"override /");
return lsw_conf_calculate();
}

canonical_decompiled_code:
unsigned __int64 __fastcall func5(const char *a1)
{
func0();
func1((__int64 *)&global_oco, a1, (__int64)"override /");
return func2();
}

original_code:
void lsw_conf_rootdir(const char *root_dir)
{
 lsw_conf_setdefault();
 subst(&global_oco.rootdir, root_dir, "override /");
 lsw_conf_calculate();
}

canonical_original_code:
void lsw_conf_rootdir(char *root_dir)
{
 lsw_conf_setdefault();
 subst(&global_oco.rootdir, root_dir, "override /");
 lsw_conf_calculate();
}


decompiled_code:
unsigned __int64 __fastcall lsw_conf_secretsfile(const char *a1)
{
lsw_conf_setdefault();
subst((__int64 *)&xmmword_8B0 + 1, a1, (__int64)"secretsfile");
return lsw_conf_calculate();
}

canonical_decompiled_code:
unsigned __int64 __fastcall func8(const char *a1)
{
func0();
func1((__int64 *)&xmmword_8B0 + 1, a1, (__int64)"secretsfile");
return func2();
}

original_code:
void lsw_conf_secretsfile(const char *secretsfile)
{
 lsw_conf_setdefault();
 subst(&global_oco.secretsfile, secretsfile, "secretsfile");
 lsw_conf_calculate();
}

canonical_original_code:
void lsw_conf_secretsfile(char *secretsfile)
{
 lsw_conf_setdefault();
 subst(&global_oco.secretsfile, secretsfile, "secretsfile");
 lsw_conf_calculate();
}

variable_types:
secretsfile
char *


decompiled_code:
unsigned __int64 __fastcall lsw_conf_nsspassword(const char *a1)
{
lsw_conf_setdefault();
subst((__int64 *)&xmmword_8F0 + 1, a1, (__int64)"nsspassword");
return lsw_conf_calculate();
}

canonical_decompiled_code:
unsigned __int64 __fastcall func9(const char *a1)
{
func0();
func1((__int64 *)&xmmword_8F0 + 1, a1, (__int64)"nsspassword");
return func2();
}

original_code:
void lsw_conf_nsspassword(const char *nsspassword)
{
 lsw_conf_setdefault();
 subst(&global_oco.nsspassword, nsspassword, "nsspassword");
 lsw_conf_calculate();
}

canonical_original_code:
void lsw_conf_nsspassword(char *nsspassword)
{
 lsw_conf_setdefault();
 subst(&global_oco.nsspassword, nsspassword, "nsspassword");
 lsw_conf_calculate();
}

variable_types:
nsspassword
char *


decompiled_code:
__int64 __fastcall cidr_info(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, __int128 a7)
{
__int64 result; // rax
__m128i v8; // [rsp+0h] [rbp-38h]

v8 = _mm_loadu_si128((const __m128i *)&a7);
if ( (_BYTE)a7 )
result = ip_version_info(v8.m128i_u32[1], a2, 0LL);
else
result = 0LL;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, __int128 a7)
{
__int64 result; // rax
__m128i v8; // [rsp+0h] [rbp-38h]

v8 = _mm_loadu_si128((const __m128i *)&a7);
if ( (_BYTE)a7 )
result = ip_version_info(v8.m128i_u32[1], a2, 0LL);
else
result = 0LL;
return result;
}

original_code:
const struct ip_info *cidr_info(const ip_cidr cidr)
{
 if (!cidr.is_set) {
  return ((void *)0);
 }
 return ip_version_info(cidr.version);
}

canonical_original_code:
struct ip_info *cidr_info(struct ip_cidr cidr)
{
 if (!cidr.is_set) {
  return ((void *)0);
 }
 return ip_version_info(cidr.version);
}

variable_types: struct ip_cidr { _Bool is_set; enum ip_version { IPv4=4, IPv6=6 } version; struct ip_bytes bytes; unsigned int prefix_len; }

user_defined_types: struct ip_cidr { _Bool is_set; enum ip_version version; struct ip_bytes bytes; unsigned int prefix_len; }


decompiled_code:
__int64 __fastcall cidr_type(const __m128i *a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6)
{
__int64 result; // rax

if ( a1 )
result = cidr_info((__int64)a1, a2, a3, a4, a5, a6, *(_OWORD *)&_mm_loadu_si128(a1));
else
result = 0LL;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(const __m128i *a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6)
{
__int64 result; // rax

if ( a1 )
result = func0((__int64)a1, a2, a3, a4, a5, a6, *(_OWORD *)&_mm_loadu_si128(a1));
else
result = 0LL;
return result;
}

original_code:
const struct ip_info *cidr_type(const ip_cidr *cidr)
{
 if (cidr == ((void *)0)) {
  return ((void *)0);
 }
 return cidr_info(*cidr);
}

canonical_original_code:
struct ip_info *cidr_type(struct ip_cidr *cidr)
{
 if (cidr == ((void *)0)) {
  return ((void *)0);
 }
 return cidr_info(*cidr);
}

variable_types: struct ip_cidr { _Bool is_set; enum ip_version { IPv4=4, IPv6=6 } version; struct ip_bytes bytes; unsigned int prefix_len; } *

user_defined_types: struct jambuf { char *array; unsigned long total; unsigned long roof; char *dots; }


decompiled_code:
__int64 __fastcall cidr_prefix_len(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, int a7, int a8, int a9, unsigned int a10)
{
return a10;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, int a7, int a8, int a9, unsigned int a10)
{
return a10;
}

original_code:
unsigned cidr_prefix_len(const ip_cidr cidr)
{
 return cidr.prefix_len;
}

canonical_original_code:
unsigned int cidr_prefix_len(struct ip_cidr cidr)
{
 return cidr.prefix_len;
}

variable_types: struct ip_cidr { _Bool is_set; enum ip_version { IPv4=4, IPv6=6 } version; struct ip_bytes { unsigned char byte[16]; } bytes; unsigned int prefix_len; }


decompiled_code:
bool __fastcall cidr_is_specified(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, __int128 a7, __int64 a8, unsigned int a9)
{
return cidr_check(a1, a2, a3, a4, a5, a6, *(_OWORD *)&_mm_loadu_si128((const __m128i *)&a7), a8, a9) == 0LL;
}

original_code:
_Bool cidr_is_specified(const ip_cidr cidr)
{
 return cidr_check(cidr) == ((void *)0);
}

canonical_original_code:
_Bool cidr_is_specified(struct ip_cidr cidr)
{
 return cidr_check(cidr) == ((void *)0);
}


original_code:
size_t jam_cidr(struct jambuf *buf, const ip_cidr *cidr)
{
 if (cidr == ((void *)0)) {
  return jam_string(buf, "<null-cidr>");
 }
 if (!cidr->is_set) {
  return jam_string(buf, "<unset-cidr>");
 }
 size_t s = 0;
 ip_address sa = cidr_address(*cidr);
 s += jam_address(buf, &sa);
 s += jam(buf, "/%u", cidr->prefix_len);
 return s;
}

canonical_original_code:
unsigned long jam_cidr(struct jambuf *buf, struct ip_cidr *cidr)
{
 if (cidr == ((void *)0)) {
  return jam_string(buf, "<null-cidr>");
 }
 if (!cidr->is_set) {
  return jam_string(buf, "<unset-cidr>");
 }
 unsigned long s = 0;
 struct ip_address sa = cidr_address(*cidr);
 s += jam_address(buf, &sa);
 s += jam(buf, "/%u", cidr->prefix_len);
 return s;
}

variable_types: struct ip_cidr { _Bool is_set; enum ip_version { IPv4=4, IPv6=6 } version; struct ip_bytes { unsigned char byte[16]; } bytes; unsigned int prefix_len; } *

variable_types: struct ip_address { _Bool is_set; enum ip_version { IPv4=4, IPv6=6 } version; struct ip_bytes { unsigned char byte[16]; } bytes; }


decompiled_code:
__int64 __fastcall str_cidr(const __m128i *a1, __int64 a2)
{
__int64 v2; // rdx
__int64 v3; // rcx
__int64 v4; // r8
__int64 v5; // r9
_QWORD v7[9]; // [rsp+0h] [rbp-48h] BYREF

v7[5] = __readfsqword(0x28u);
array_as_jambuf(v7, a2, 47LL);
jam_cidr((__int64)v7, a1, v2, v3, v4, v5);
return a2;
}

original_code:
const char *str_cidr(const ip_cidr *cidr, cidr_buf *out)
{
 struct jambuf buf = array_as_jambuf((out->buf), sizeof(out->buf));
 jam_cidr(&buf, cidr);
 return out->buf;
}

canonical_original_code:
char *str_cidr(struct ip_cidr *cidr, struct cidr_buf *out)
{
 struct jambuf buf = array_as_jambuf((out->buf), sizeof(out->buf));
 jam_cidr(&buf, cidr);
 return out->buf;
}

variable_types:
out
struct cidr_buf { char buf[-1]; } *

variable_types: struct jambuf { char *array; unsigned long total; unsigned long roof; char *dots; }


original_code:
void pexpect_cidr(const ip_cidr cidr, where_t where)
{
 if (cidr.is_set == 0 ||
     cidr.version == 0) {
  llog_pexpect(&global_logger, where, "invalid ""<cidr-%s:IPv%d[""%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x""]/%u>", ((cidr).is_set ? "set" : "unset"), (cidr).version, ((cidr).bytes).byte[0], ((cidr).bytes).byte[1], ((cidr).bytes).byte[2], ((cidr).bytes).byte[3], ((cidr).bytes).byte[4], ((cidr).bytes).byte[5], ((cidr).bytes).byte[6], ((cidr).bytes).byte[7], ((cidr).bytes).byte[8], ((cidr).bytes).byte[9], ((cidr).bytes).byte[10], ((cidr).bytes).byte[11], ((cidr).bytes).byte[12], ((cidr).bytes).byte[13], ((cidr).bytes).byte[14], ((cidr).bytes).byte[15], (cidr).prefix_len);
 }
}

canonical_original_code:
void pexpect_cidr(struct ip_cidr cidr, struct where *where)
{
 if (cidr.is_set == 0 ||
     cidr.version == 0) {
  llog_pexpect(&global_logger, where, "invalid ""<cidr-%s:IPv%d[""%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x""]/%u>", ((cidr).is_set ? "set" : "unset"), (cidr).version, ((cidr).bytes).byte[0], ((cidr).bytes).byte[1], ((cidr).bytes).byte[2], ((cidr).bytes).byte[3], ((cidr).bytes).byte[4], ((cidr).bytes).byte[5], ((cidr).bytes).byte[6], ((cidr).bytes).byte[7], ((cidr).bytes).byte[8], ((cidr).bytes).byte[9], ((cidr).bytes).byte[10], ((cidr).bytes).byte[11], ((cidr).bytes).byte[12], ((cidr).bytes).byte[13], ((cidr).bytes).byte[14], ((cidr).bytes).byte[15], (cidr).prefix_len);
 }
}

variable_types: struct where { char *func; char *file; long line; } *


decompiled_code:
unsigned __int64 __fastcall get_rnd_bytes(__int64 a1, __int64 a2)
{
unsigned __int64 v3; // [rsp+8h] [rbp-10h]

v3 = __readfsqword(0x28u);
if ( (unsigned int)PK11_GenerateRandom() )
passert_nss_error(&global_logger, here_1, "generating %zu random bytes", a2);
return v3 - __readfsqword(0x28u);
}

canonical_decompiled_code:
unsigned __int64 __fastcall func0(__int64 a1, __int64 a2)
{
unsigned __int64 v3; // [rsp+8h] [rbp-10h]

v3 = __readfsqword(0x28u);
if ( (unsigned int)PK11_GenerateRandom() )
passert_nss_error(&global_logger, here_1, "generating %zu random bytes", a2);
return v3 - __readfsqword(0x28u);
}

original_code:
void get_rnd_bytes(void *buffer, size_t length)
{
 if (PK11_GenerateRandom(buffer, length) != SECSuccess) {
  passert_nss_error(&global_logger, ({ static const struct where here = { .func = __func__, .file = "lib/libswan/rnd.c", .line = 68, }; &here; }), "generating %zu random bytes", length);
 }
}

canonical_original_code:
void get_rnd_bytes(void *buffer, unsigned long length)
{
 if (PK11_GenerateRandom(buffer, length) != SECSuccess) {
  passert_nss_error(&global_logger, ({ static struct where here = { .func = __func__, .file = "lib/libswan/rnd.c", .line = 68, }; &here; }), "generating %zu random bytes", length);
 }
}

variable_types:
buffer
void *

variable_types:
length
unsigned long

variable_types: struct where { char *func; char *file; long line; }


decompiled_code:
__int64 __fastcall get_rnd_uintmax(unsigned __int64 a1)
{
__int64 v2[3]; // [rsp+0h] [rbp-18h] BYREF

v2[1] = __readfsqword(0x28u);
get_rnd_bytes((__int64)v2, 8LL);
return v2[0] % a1;
}

canonical_decompiled_code:
__int64 __fastcall func1(unsigned __int64 a1)
{
__int64 v2[3]; // [rsp+0h] [rbp-18h] BYREF

v2[1] = __readfsqword(0x28u);
func0((__int64)v2, 8LL);
return v2[0] % a1;
}

original_code:
uintmax_t get_rnd_uintmax(uintmax_t roof)
{
 uintmax_t rnd;
 get_rnd_bytes(&rnd, sizeof(rnd));
 return rnd % roof;
}

canonical_original_code:
unsigned long get_rnd_uintmax(unsigned long roof)
{
 unsigned long rnd;
 get_rnd_bytes(&rnd, sizeof(rnd));
 return rnd % roof;
}

variable_types:
roof
unsigned long

variable_types:
rnd
unsigned long


decompiled_code:
unsigned __int64 __fastcall fill_rnd_chunk(__int64 a1, __int64 a2)
{
return get_rnd_bytes(a1, a2);
}

canonical_decompiled_code:
unsigned __int64 __fastcall func2(__int64 a1, __int64 a2)
{
return func0(a1, a2);
}

original_code:
void fill_rnd_chunk(chunk_t chunk)
{
 get_rnd_bytes(chunk.ptr, chunk.len);
}

canonical_original_code:
void fill_rnd_chunk(struct chunk_t chunk)
{
 get_rnd_bytes(chunk.ptr, chunk.len);
}

variable_types: struct chunk_t { unsigned char *ptr; unsigned long len; }


decompiled_code:
__int64 alloc_rnd_chunk()
{
__int64 v0; // r13
__int64 v1; // rdx

v0 = alloc_chunk();
fill_rnd_chunk(v0, v1);
return v0;
}

canonical_decompiled_code:
__int64 func3()
{
__int64 v0; // r13
__int64 v1; // rdx

v0 = alloc_chunk();
func2(v0, v1);
return v0;
}

original_code:
chunk_t alloc_rnd_chunk(size_t size, const char *name)
{
 chunk_t chunk = alloc_chunk(size, name);
 fill_rnd_chunk(chunk);
 return chunk;
}

canonical_original_code:
struct chunk_t alloc_rnd_chunk(unsigned long size, char *name)
{
 struct chunk_t chunk = alloc_chunk(size, name);
 fill_rnd_chunk(chunk);
 return chunk;
}

variable_types:
size
unsigned long

variable_types:
name
char *

return_type: struct chunk_t { unsigned char *ptr; unsigned long len; }


decompiled_code:
__int64 __fastcall str_nss_oid(unsigned int a1, __int64 a2)
{
__int64 v2; // r12
__int64 v3; // rax

v2 = a2;
v3 = SECOID_FindOIDByTag();
if ( v3 )
return *(_QWORD *)(v3 + 32);
_snprintf_chk(a2, 23LL, 1LL, -1LL, "SEC_OID_%d", a1);
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func0(unsigned int a1, __int64 a2)
{
__int64 v2; // r12
__int64 v3; // rax

v2 = a2;
v3 = SECOID_FindOIDByTag();
if ( v3 )
return *(_QWORD *)(v3 + 32);
_snprintf_chk(a2, 23LL, 1LL, -1LL, "SEC_OID_%d", a1);
return v2;
}

original_code:
const char *str_nss_oid(SECOidTag oidtag, enum_buf *buf)
{
 SECOidData *data = SECOID_FindOIDByTag(oidtag);
 if (data != ((void *)0)) {
  return data->desc;
 } else {
  snprintf(buf->buf, sizeof(buf->buf),
    "SEC_OID_%d", oidtag);
  return buf->buf;
 }
}

canonical_original_code:
char *str_nss_oid(enum SECOidTag oidtag, struct enum_buf *buf)
{
 struct SECOidDataStr *data = SECOID_FindOIDByTag(oidtag);
 if (data != ((void *)0)) {
  return data->desc;
 } else {
  snprintf(buf->buf, sizeof(buf->buf),
    "SEC_OID_%d", oidtag);
  return buf->buf;
 }
}

variable_types:
buf
struct enum_buf { char buf[-1]; } *

variable_types: struct SECOidDataStr { struct SECItemStr { enum SECItemType { siBuffer=0, siClearDataBuffer=1, siCipherDataBuffer=2, siDERCertBuffer=3, siEncodedCertBuffer=4, siDERNameBuffer=5, siEncodedNameBuffer=6, siAsciiNameString=7, siAsciiString=8, siDEROID=9, siUnsignedInteger=10, siUTCTime=11, siGeneralizedTime=12, siVisibleString=13, siUTF8String=14, siBMPString=15 } type; unsigned char *data; unsigned int len; } oid; enum SECOidTag { SEC_OID_UNKNOWN=0, SEC_OID_MD2=1, SEC_OID_MD4=2, SEC_OID_MD5=3, SEC_OID_SHA1=4, SEC_OID_RC2_CBC=5, SEC_OID_RC4=6, SEC_OID_DES_EDE3_CBC=7, SEC_OID_RC5_CBC_PAD=8, SEC_OID_DES_ECB=9, SEC_OID_DES_CBC=10, SEC_OID_DES_OFB=11, SEC_OID_DES_CFB=12, SEC_OID_DES_MAC=13, SEC_OID_DES_EDE=14, SEC_OID_ISO_SHA_WITH_RSA_SIGNATURE=15, SEC_OID_PKCS1_RSA_ENCRYPTION=16, SEC_OID_PKCS1_MD2_WITH_RSA_ENCRYPTION=17, SEC_OID_PKCS1_MD4_WITH_RSA_ENCRYPTION=18, SEC_OID_PKCS1_MD5_WITH_RSA_ENCRYPTION=19, SEC_OID_PKCS1_SHA1_WITH_RSA_ENCRYPTION=20, SEC_OID_PKCS5_PBE_WITH_MD2_AND_DES_CBC=21, SEC_OID_PKCS5_PBE_WITH_MD5_AND_DES_CBC=22, SEC_OID_PKCS5_PBE_WITH_SHA1_AND_DES_CBC=23, SEC_OID_PKCS7=24, SEC_OID_PKCS7_DATA=25, SEC_OID_PKCS7_SIGNED_DATA=26, SEC_OID_PKCS7_ENVELOPED_DATA=27, SEC_OID_PKCS7_SIGNED_ENVELOPED_DATA=28, SEC_OID_PKCS7_DIGESTED_DATA=29, SEC_OID_PKCS7_ENCRYPTED_DATA=30, SEC_OID_PKCS9_EMAIL_ADDRESS=31, SEC_OID_PKCS9_UNSTRUCTURED_NAME=32, SEC_OID_PKCS9_CONTENT_TYPE=33, SEC_OID_PKCS9_MESSAGE_DIGEST=34, SEC_OID_PKCS9_SIGNING_TIME=35, SEC_OID_PKCS9_COUNTER_SIGNATURE=36, SEC_OID_PKCS9_CHALLENGE_PASSWORD=37, SEC_OID_PKCS9_UNSTRUCTURED_ADDRESS=38, SEC_OID_PKCS9_EXTENDED_CERTIFICATE_ATTRIBUTES=39, SEC_OID_PKCS9_SMIME_CAPABILITIES=40, SEC_OID_AVA_COMMON_NAME=41, SEC_OID_AVA_COUNTRY_NAME=42, SEC_OID_AVA_LOCALITY=43, SEC_OID_AVA_STATE_OR_PROVINCE=44, SEC_OID_AVA_ORGANIZATION_NAME=45, SEC_OID_AVA_ORGANIZATIONAL_UNIT_NAME=46, SEC_OID_AVA_DN_QUALIFIER=47, SEC_OID_AVA_DC=48, SEC_OID_NS_TYPE_GIF=49, SEC_OID_NS_TYPE_JPEG=50, SEC_OID_NS_TYPE_URL=51, SEC_OID_NS_TYPE_HTML=52, SEC_OID_NS_TYPE_CERT_SEQUENCE=53, SEC_OID_MISSI_KEA_DSS_OLD=54, SEC_OID_MISSI_DSS_OLD=55, SEC_OID_MISSI_KEA_DSS=56, SEC_OID_MISSI_DSS=57, SEC_OID_MISSI_KEA=58, SEC_OID_MISSI_ALT_KEA=59, SEC_OID_NS_CERT_EXT_NETSCAPE_OK=60, SEC_OID_NS_CERT_EXT_ISSUER_LOGO=61, SEC_OID_NS_CERT_EXT_SUBJECT_LOGO=62, SEC_OID_NS_CERT_EXT_CERT_TYPE=63, SEC_OID_NS_CERT_EXT_BASE_URL=64, SEC_OID_NS_CERT_EXT_REVOCATION_URL=65, SEC_OID_NS_CERT_EXT_CA_REVOCATION_URL=66, SEC_OID_NS_CERT_EXT_CA_CRL_URL=67, SEC_OID_NS_CERT_EXT_CA_CERT_URL=68, SEC_OID_NS_CERT_EXT_CERT_RENEWAL_URL=69, SEC_OID_NS_CERT_EXT_CA_POLICY_URL=70, SEC_OID_NS_CERT_EXT_HOMEPAGE_URL=71, SEC_OID_NS_CERT_EXT_ENTITY_LOGO=72, SEC_OID_NS_CERT_EXT_USER_PICTURE=73, SEC_OID_NS_CERT_EXT_SSL_SERVER_NAME=74, SEC_OID_NS_CERT_EXT_COMMENT=75, SEC_OID_NS_CERT_EXT_LOST_PASSWORD_URL=76, SEC_OID_NS_CERT_EXT_CERT_RENEWAL_TIME=77, SEC_OID_NS_KEY_USAGE_GOVT_APPROVED=78, SEC_OID_X509_SUBJECT_DIRECTORY_ATTR=79, SEC_OID_X509_SUBJECT_KEY_ID=80, SEC_OID_X509_KEY_USAGE=81, SEC_OID_X509_PRIVATE_KEY_USAGE_PERIOD=82, SEC_OID_X509_SUBJECT_ALT_NAME=83, SEC_OID_X509_ISSUER_ALT_NAME=84, SEC_OID_X509_BASIC_CONSTRAINTS=85, SEC_OID_X509_NAME_CONSTRAINTS=86, SEC_OID_X509_CRL_DIST_POINTS=87, SEC_OID_X509_CERTIFICATE_POLICIES=88, SEC_OID_X509_POLICY_MAPPINGS=89, SEC_OID_X509_POLICY_CONSTRAINTS=90, SEC_OID_X509_AUTH_KEY_ID=91, SEC_OID_X509_EXT_KEY_USAGE=92, SEC_OID_X509_AUTH_INFO_ACCESS=93, SEC_OID_X509_CRL_NUMBER=94, SEC_OID_X509_REASON_CODE=95, SEC_OID_X509_INVALID_DATE=96, SEC_OID_X500_RSA_ENCRYPTION=97, SEC_OID_RFC1274_UID=98, SEC_OID_RFC1274_MAIL=99, SEC_OID_PKCS12=100, SEC_OID_PKCS12_MODE_IDS=101, SEC_OID_PKCS12_ESPVK_IDS=102, SEC_OID_PKCS12_BAG_IDS=103, SEC_OID_PKCS12_CERT_BAG_IDS=104, SEC_OID_PKCS12_OIDS=105, SEC_OID_PKCS12_PBE_IDS=106, SEC_OID_PKCS12_SIGNATURE_IDS=107, SEC_OID_PKCS12_ENVELOPING_IDS=108, SEC_OID_PKCS12_PKCS8_KEY_SHROUDING=109, SEC_OID_PKCS12_KEY_BAG_ID=110, SEC_OID_PKCS12_CERT_AND_CRL_BAG_ID=111, SEC_OID_PKCS12_SECRET_BAG_ID=112, SEC_OID_PKCS12_X509_CERT_CRL_BAG=113, SEC_OID_PKCS12_SDSI_CERT_BAG=114, SEC_OID_PKCS12_PBE_WITH_SHA1_AND_128_BIT_RC4=115, SEC_OID_PKCS12_PBE_WITH_SHA1_AND_40_BIT_RC4=116, SEC_OID_PKCS12_PBE_WITH_SHA1_AND_TRIPLE_DES_CBC=117, SEC_OID_PKCS12_PBE_WITH_SHA1_AND_128_BIT_RC2_CBC=118, SEC_OID_PKCS12_PBE_WITH_SHA1_AND_40_BIT_RC2_CBC=119, SEC_OID_PKCS12_RSA_ENCRYPTION_WITH_128_BIT_RC4=120, SEC_OID_PKCS12_RSA_ENCRYPTION_WITH_40_BIT_RC4=121, SEC_OID_PKCS12_RSA_ENCRYPTION_WITH_TRIPLE_DES=122, SEC_OID_PKCS12_RSA_SIGNATURE_WITH_SHA1_DIGEST=123, SEC_OID_ANSIX9_DSA_SIGNATURE=124, SEC_OID_ANSIX9_DSA_SIGNATURE_WITH_SHA1_DIGEST=125, SEC_OID_BOGUS_DSA_SIGNATURE_WITH_SHA1_DIGEST=126, SEC_OID_VERISIGN_USER_NOTICES=127, SEC_OID_PKIX_CPS_POINTER_QUALIFIER=128, SEC_OID_PKIX_USER_NOTICE_QUALIFIER=129, SEC_OID_PKIX_OCSP=130, SEC_OID_PKIX_OCSP_BASIC_RESPONSE=131, SEC_OID_PKIX_OCSP_NONCE=132, SEC_OID_PKIX_OCSP_CRL=133, SEC_OID_PKIX_OCSP_RESPONSE=134, SEC_OID_PKIX_OCSP_NO_CHECK=135, SEC_OID_PKIX_OCSP_ARCHIVE_CUTOFF=136, SEC_OID_PKIX_OCSP_SERVICE_LOCATOR=137, SEC_OID_PKIX_REGCTRL_REGTOKEN=138, SEC_OID_PKIX_REGCTRL_AUTHENTICATOR=139, SEC_OID_PKIX_REGCTRL_PKIPUBINFO=140, SEC_OID_PKIX_REGCTRL_PKI_ARCH_OPTIONS=141, SEC_OID_PKIX_REGCTRL_OLD_CERT_ID=142, SEC_OID_PKIX_REGCTRL_PROTOCOL_ENC_KEY=143, SEC_OID_PKIX_REGINFO_UTF8_PAIRS=144, SEC_OID_PKIX_REGINFO_CERT_REQUEST=145, SEC_OID_EXT_KEY_USAGE_SERVER_AUTH=146, SEC_OID_EXT_KEY_USAGE_CLIENT_AUTH=147, SEC_OID_EXT_KEY_USAGE_CODE_SIGN=148, SEC_OID_EXT_KEY_USAGE_EMAIL_PROTECT=149, SEC_OID_EXT_KEY_USAGE_TIME_STAMP=150, SEC_OID_OCSP_RESPONDER=151, SEC_OID_NETSCAPE_SMIME_KEA=152, SEC_OID_FORTEZZA_SKIPJACK=153, SEC_OID_PKCS12_V2_PBE_WITH_SHA1_AND_128_BIT_RC4=154, SEC_OID_PKCS12_V2_PBE_WITH_SHA1_AND_40_BIT_RC4=155, SEC_OID_PKCS12_V2_PBE_WITH_SHA1_AND_3KEY_TRIPLE_DES_CBC=156, SEC_OID_PKCS12_V2_PBE_WITH_SHA1_AND_2KEY_TRIPLE_DES_CBC=157, SEC_OID_PKCS12_V2_PBE_WITH_SHA1_AND_128_BIT_RC2_CBC=158, SEC_OID_PKCS12_V2_PBE_WITH_SHA1_AND_40_BIT_RC2_CBC=159, SEC_OID_PKCS12_SAFE_CONTENTS_ID=160, SEC_OID_PKCS12_PKCS8_SHROUDED_KEY_BAG_ID=161, SEC_OID_PKCS12_V1_KEY_BAG_ID=162, SEC_OID_PKCS12_V1_PKCS8_SHROUDED_KEY_BAG_ID=163, SEC_OID_PKCS12_V1_CERT_BAG_ID=164, SEC_OID_PKCS12_V1_CRL_BAG_ID=165, SEC_OID_PKCS12_V1_SECRET_BAG_ID=166, SEC_OID_PKCS12_V1_SAFE_CONTENTS_BAG_ID=167, SEC_OID_PKCS9_X509_CERT=168, SEC_OID_PKCS9_SDSI_CERT=169, SEC_OID_PKCS9_X509_CRL=170, SEC_OID_PKCS9_FRIENDLY_NAME=171, SEC_OID_PKCS9_LOCAL_KEY_ID=172, SEC_OID_BOGUS_KEY_USAGE=173, SEC_OID_X942_DIFFIE_HELMAN_KEY=174, SEC_OID_NETSCAPE_NICKNAME=175, SEC_OID_NETSCAPE_RECOVERY_REQUEST=176, SEC_OID_CERT_RENEWAL_LOCATOR=177, SEC_OID_NS_CERT_EXT_SCOPE_OF_USE=178, SEC_OID_CMS_EPHEMERAL_STATIC_DIFFIE_HELLMAN=179, SEC_OID_CMS_3DES_KEY_WRAP=180, SEC_OID_CMS_RC2_KEY_WRAP=181, SEC_OID_SMIME_ENCRYPTION_KEY_PREFERENCE=182, SEC_OID_AES_128_ECB=183, SEC_OID_AES_128_CBC=184, SEC_OID_AES_192_ECB=185, SEC_OID_AES_192_CBC=186, SEC_OID_AES_256_ECB=187, SEC_OID_AES_256_CBC=188, SEC_OID_SDN702_DSA_SIGNATURE=189, SEC_OID_MS_SMIME_ENCRYPTION_KEY_PREFERENCE=190, SEC_OID_SHA256=191, SEC_OID_SHA384=192, SEC_OID_SHA512=193, SEC_OID_PKCS1_SHA256_WITH_RSA_ENCRYPTION=194, SEC_OID_PKCS1_SHA384_WITH_RSA_ENCRYPTION=195, SEC_OID_PKCS1_SHA512_WITH_RSA_ENCRYPTION=196, SEC_OID_AES_128_KEY_WRAP=197, SEC_OID_AES_192_KEY_WRAP=198, SEC_OID_AES_256_KEY_WRAP=199, SEC_OID_ANSIX962_EC_PUBLIC_KEY=200, SEC_OID_ANSIX962_ECDSA_SHA1_SIGNATURE=201, SEC_OID_ANSIX962_EC_PRIME192V1=202, SEC_OID_ANSIX962_EC_PRIME192V2=203, SEC_OID_ANSIX962_EC_PRIME192V3=204, SEC_OID_ANSIX962_EC_PRIME239V1=205, SEC_OID_ANSIX962_EC_PRIME239V2=206, SEC_OID_ANSIX962_EC_PRIME239V3=207, SEC_OID_ANSIX962_EC_PRIME256V1=208, SEC_OID_SECG_EC_SECP112R1=209, SEC_OID_SECG_EC_SECP112R2=210, SEC_OID_SECG_EC_SECP128R1=211, SEC_OID_SECG_EC_SECP128R2=212, SEC_OID_SECG_EC_SECP160K1=213, SEC_OID_SECG_EC_SECP160R1=214, SEC_OID_SECG_EC_SECP160R2=215, SEC_OID_SECG_EC_SECP192K1=216, SEC_OID_SECG_EC_SECP224K1=217, SEC_OID_SECG_EC_SECP224R1=218, SEC_OID_SECG_EC_SECP256K1=219, SEC_OID_SECG_EC_SECP384R1=220, SEC_OID_SECG_EC_SECP521R1=221, SEC_OID_ANSIX962_EC_C2PNB163V1=222, SEC_OID_ANSIX962_EC_C2PNB163V2=223, SEC_OID_ANSIX962_EC_C2PNB163V3=224, SEC_OID_ANSIX962_EC_C2PNB176V1=225, SEC_OID_ANSIX962_EC_C2TNB191V1=226, SEC_OID_ANSIX962_EC_C2TNB191V2=227, SEC_OID_ANSIX962_EC_C2TNB191V3=228, SEC_OID_ANSIX962_EC_C2ONB191V4=229, SEC_OID_ANSIX962_EC_C2ONB191V5=230, SEC_OID_ANSIX962_EC_C2PNB208W1=231, SEC_OID_ANSIX962_EC_C2TNB239V1=232, SEC_OID_ANSIX962_EC_C2TNB239V2=233, SEC_OID_ANSIX962_EC_C2TNB239V3=234, SEC_OID_ANSIX962_EC_C2ONB239V4=235, SEC_OID_ANSIX962_EC_C2ONB239V5=236, SEC_OID_ANSIX962_EC_C2PNB272W1=237, SEC_OID_ANSIX962_EC_C2PNB304W1=238, SEC_OID_ANSIX962_EC_C2TNB359V1=239, SEC_OID_ANSIX962_EC_C2PNB368W1=240, SEC_OID_ANSIX962_EC_C2TNB431R1=241, SEC_OID_SECG_EC_SECT113R1=242, SEC_OID_SECG_EC_SECT113R2=243, SEC_OID_SECG_EC_SECT131R1=244, SEC_OID_SECG_EC_SECT131R2=245, SEC_OID_SECG_EC_SECT163K1=246, SEC_OID_SECG_EC_SECT163R1=247, SEC_OID_SECG_EC_SECT163R2=248, SEC_OID_SECG_EC_SECT193R1=249, SEC_OID_SECG_EC_SECT193R2=250, SEC_OID_SECG_EC_SECT233K1=251, SEC_OID_SECG_EC_SECT233R1=252, SEC_OID_SECG_EC_SECT239K1=253, SEC_OID_SECG_EC_SECT283K1=254, SEC_OID_SECG_EC_SECT283R1=255, SEC_OID_SECG_EC_SECT409K1=256, SEC_OID_SECG_EC_SECT409R1=257, SEC_OID_SECG_EC_SECT571K1=258, SEC_OID_SECG_EC_SECT571R1=259, SEC_OID_NETSCAPE_AOLSCREENNAME=260, SEC_OID_AVA_SURNAME=261, SEC_OID_AVA_SERIAL_NUMBER=262, SEC_OID_AVA_STREET_ADDRESS=263, SEC_OID_AVA_TITLE=264, SEC_OID_AVA_POSTAL_ADDRESS=265, SEC_OID_AVA_POSTAL_CODE=266, SEC_OID_AVA_POST_OFFICE_BOX=267, SEC_OID_AVA_GIVEN_NAME=268, SEC_OID_AVA_INITIALS=269, SEC_OID_AVA_GENERATION_QUALIFIER=270, SEC_OID_AVA_HOUSE_IDENTIFIER=271, SEC_OID_AVA_PSEUDONYM=272, SEC_OID_PKIX_CA_ISSUERS=273, SEC_OID_PKCS9_EXTENSION_REQUEST=274, SEC_OID_ANSIX962_ECDSA_SIGNATURE_RECOMMENDED_DIGEST=275, SEC_OID_ANSIX962_ECDSA_SIGNATURE_SPECIFIED_DIGEST=276, SEC_OID_ANSIX962_ECDSA_SHA224_SIGNATURE=277, SEC_OID_ANSIX962_ECDSA_SHA256_SIGNATURE=278, SEC_OID_ANSIX962_ECDSA_SHA384_SIGNATURE=279, SEC_OID_ANSIX962_ECDSA_SHA512_SIGNATURE=280, SEC_OID_X509_HOLD_INSTRUCTION_CODE=281, SEC_OID_X509_DELTA_CRL_INDICATOR=282, SEC_OID_X509_ISSUING_DISTRIBUTION_POINT=283, SEC_OID_X509_CERT_ISSUER=284, SEC_OID_X509_FRESHEST_CRL=285, SEC_OID_X509_INHIBIT_ANY_POLICY=286, SEC_OID_X509_SUBJECT_INFO_ACCESS=287, SEC_OID_CAMELLIA_128_CBC=288, SEC_OID_CAMELLIA_192_CBC=289, SEC_OID_CAMELLIA_256_CBC=290, SEC_OID_PKCS5_PBKDF2=291, SEC_OID_PKCS5_PBES2=292, SEC_OID_PKCS5_PBMAC1=293, SEC_OID_HMAC_SHA1=294, SEC_OID_HMAC_SHA224=295, SEC_OID_HMAC_SHA256=296, SEC_OID_HMAC_SHA384=297, SEC_OID_HMAC_SHA512=298, SEC_OID_PKIX_TIMESTAMPING=299, SEC_OID_PKIX_CA_REPOSITORY=300, SEC_OID_ISO_SHA1_WITH_RSA_SIGNATURE=301, SEC_OID_SEED_CBC=302, SEC_OID_X509_ANY_POLICY=303, SEC_OID_PKCS1_RSA_OAEP_ENCRYPTION=304, SEC_OID_PKCS1_MGF1=305, SEC_OID_PKCS1_PSPECIFIED=306, SEC_OID_PKCS1_RSA_PSS_SIGNATURE=307, SEC_OID_PKCS1_SHA224_WITH_RSA_ENCRYPTION=308, SEC_OID_SHA224=309, SEC_OID_EV_INCORPORATION_LOCALITY=310, SEC_OID_EV_INCORPORATION_STATE=311, SEC_OID_EV_INCORPORATION_COUNTRY=312, SEC_OID_BUSINESS_CATEGORY=313, SEC_OID_NIST_DSA_SIGNATURE_WITH_SHA224_DIGEST=314, SEC_OID_NIST_DSA_SIGNATURE_WITH_SHA256_DIGEST=315, SEC_OID_MS_EXT_KEY_USAGE_CTL_SIGNING=316, SEC_OID_AVA_NAME=317, SEC_OID_AES_128_GCM=318, SEC_OID_AES_192_GCM=319, SEC_OID_AES_256_GCM=320, SEC_OID_IDEA_CBC=321, SEC_OID_RC2_40_CBC=322, SEC_OID_DES_40_CBC=323, SEC_OID_RC4_40=324, SEC_OID_RC4_56=325, SEC_OID_NULL_CIPHER=326, SEC_OID_HMAC_MD5=327, SEC_OID_TLS_RSA=328, SEC_OID_TLS_DHE_RSA=329, SEC_OID_TLS_DHE_DSS=330, SEC_OID_TLS_DH_RSA=331, SEC_OID_TLS_DH_DSS=332, SEC_OID_TLS_DH_ANON=333, SEC_OID_TLS_ECDHE_ECDSA=334, SEC_OID_TLS_ECDHE_RSA=335, SEC_OID_TLS_ECDH_ECDSA=336, SEC_OID_TLS_ECDH_RSA=337, SEC_OID_TLS_ECDH_ANON=338, SEC_OID_TLS_RSA_EXPORT=339, SEC_OID_TLS_DHE_RSA_EXPORT=340, SEC_OID_TLS_DHE_DSS_EXPORT=341, SEC_OID_TLS_DH_RSA_EXPORT=342, SEC_OID_TLS_DH_DSS_EXPORT=343, SEC_OID_TLS_DH_ANON_EXPORT=344, SEC_OID_APPLY_SSL_POLICY=345, SEC_OID_CHACHA20_POLY1305=346, SEC_OID_TLS_ECDHE_PSK=347, SEC_OID_TLS_DHE_PSK=348, SEC_OID_TLS_FFDHE_2048=349, SEC_OID_TLS_FFDHE_3072=350, SEC_OID_TLS_FFDHE_4096=351, SEC_OID_TLS_FFDHE_6144=352, SEC_OID_TLS_FFDHE_8192=353, SEC_OID_TLS_DHE_CUSTOM=354, SEC_OID_CURVE25519=355, SEC_OID_TLS13_KEA_ANY=356, SEC_OID_X509_ANY_EXT_KEY_USAGE=357, SEC_OID_EXT_KEY_USAGE_IPSEC_IKE=358, SEC_OID_IPSEC_IKE_END=359, SEC_OID_IPSEC_IKE_INTERMEDIATE=360, SEC_OID_TOTAL=361 } offset; char *desc; unsigned long mechanism; enum SECSupportExtenTag { INVALID_CERT_EXTENSION=0, UNSUPPORTED_CERT_EXTENSION=1, SUPPORTED_CERT_EXTENSION=2 } supportedExtension; } *

user_defined_types: struct SECOidDataStr { struct SECItemStr oid; enum SECOidTag offset; char *desc; unsigned long mechanism; enum SECSupportExtenTag supportedExtension; }

user_defined_types: struct SECItemStr { enum SECItemType type; unsigned char *data; unsigned int len; }


decompiled_code:
__int64 __fastcall jam_nss_oid(__int64 a1, unsigned int a2)
{
__int64 v2; // rax
__int64 result; // rax

v2 = SECOID_FindOIDByTag(a2);
if ( v2 )
result = jam_string(a1, *(_QWORD *)(v2 + 32));
else
result = jam(a1, "SEC_OID_%d", a2);
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1, unsigned int a2)
{
__int64 v2; // rax
__int64 result; // rax

v2 = SECOID_FindOIDByTag(a2);
if ( v2 )
result = jam_string(a1, *(_QWORD *)(v2 + 32));
else
result = jam(a1, "SEC_OID_%d", a2);
return result;
}

original_code:
size_t jam_nss_oid(struct jambuf *buf, SECOidTag oidtag)
{
 SECOidData *data = SECOID_FindOIDByTag(oidtag);
 if (data != ((void *)0)) {
  return jam_string(buf, data->desc);
 }
 return jam(buf, "SEC_OID_%d", oidtag);
}

canonical_original_code:
unsigned long jam_nss_oid(struct jambuf *buf, enum SECOidTag oidtag)
{
 struct SECOidDataStr *data = SECOID_FindOIDByTag(oidtag);
 if (data != ((void *)0)) {
  return jam_string(buf, data->desc);
 }
 return jam(buf, "SEC_OID_%d", oidtag);
}

variable_types: struct jambuf { char *array; unsigned long total; unsigned long roof; char *dots; } *

variable_types: enum SECOidTag { SEC_OID_UNKNOWN=0, SEC_OID_MD2=1, SEC_OID_MD4=2, SEC_OID_MD5=3, SEC_OID_SHA1=4, SEC_OID_RC2_CBC=5, SEC_OID_RC4=6, SEC_OID_DES_EDE3_CBC=7, SEC_OID_RC5_CBC_PAD=8, SEC_OID_DES_ECB=9, SEC_OID_DES_CBC=10, SEC_OID_DES_OFB=11, SEC_OID_DES_CFB=12, SEC_OID_DES_MAC=13, SEC_OID_DES_EDE=14, SEC_OID_ISO_SHA_WITH_RSA_SIGNATURE=15, SEC_OID_PKCS1_RSA_ENCRYPTION=16, SEC_OID_PKCS1_MD2_WITH_RSA_ENCRYPTION=17, SEC_OID_PKCS1_MD4_WITH_RSA_ENCRYPTION=18, SEC_OID_PKCS1_MD5_WITH_RSA_ENCRYPTION=19, SEC_OID_PKCS1_SHA1_WITH_RSA_ENCRYPTION=20, SEC_OID_PKCS5_PBE_WITH_MD2_AND_DES_CBC=21, SEC_OID_PKCS5_PBE_WITH_MD5_AND_DES_CBC=22, SEC_OID_PKCS5_PBE_WITH_SHA1_AND_DES_CBC=23, SEC_OID_PKCS7=24, SEC_OID_PKCS7_DATA=25, SEC_OID_PKCS7_SIGNED_DATA=26, SEC_OID_PKCS7_ENVELOPED_DATA=27, SEC_OID_PKCS7_SIGNED_ENVELOPED_DATA=28, SEC_OID_PKCS7_DIGESTED_DATA=29, SEC_OID_PKCS7_ENCRYPTED_DATA=30, SEC_OID_PKCS9_EMAIL_ADDRESS=31, SEC_OID_PKCS9_UNSTRUCTURED_NAME=32, SEC_OID_PKCS9_CONTENT_TYPE=33, SEC_OID_PKCS9_MESSAGE_DIGEST=34, SEC_OID_PKCS9_SIGNING_TIME=35, SEC_OID_PKCS9_COUNTER_SIGNATURE=36, SEC_OID_PKCS9_CHALLENGE_PASSWORD=37, SEC_OID_PKCS9_UNSTRUCTURED_ADDRESS=38, SEC_OID_PKCS9_EXTENDED_CERTIFICATE_ATTRIBUTES=39, SEC_OID_PKCS9_SMIME_CAPABILITIES=40, SEC_OID_AVA_COMMON_NAME=41, SEC_OID_AVA_COUNTRY_NAME=42, SEC_OID_AVA_LOCALITY=43, SEC_OID_AVA_STATE_OR_PROVINCE=44, SEC_OID_AVA_ORGANIZATION_NAME=45, SEC_OID_AVA_ORGANIZATIONAL_UNIT_NAME=46, SEC_OID_AVA_DN_QUALIFIER=47, SEC_OID_AVA_DC=48, SEC_OID_NS_TYPE_GIF=49, SEC_OID_NS_TYPE_JPEG=50, SEC_OID_NS_TYPE_URL=51, SEC_OID_NS_TYPE_HTML=52, SEC_OID_NS_TYPE_CERT_SEQUENCE=53, SEC_OID_MISSI_KEA_DSS_OLD=54, SEC_OID_MISSI_DSS_OLD=55, SEC_OID_MISSI_KEA_DSS=56, SEC_OID_MISSI_DSS=57, SEC_OID_MISSI_KEA=58, SEC_OID_MISSI_ALT_KEA=59, SEC_OID_NS_CERT_EXT_NETSCAPE_OK=60, SEC_OID_NS_CERT_EXT_ISSUER_LOGO=61, SEC_OID_NS_CERT_EXT_SUBJECT_LOGO=62, SEC_OID_NS_CERT_EXT_CERT_TYPE=63, SEC_OID_NS_CERT_EXT_BASE_URL=64, SEC_OID_NS_CERT_EXT_REVOCATION_URL=65, SEC_OID_NS_CERT_EXT_CA_REVOCATION_URL=66, SEC_OID_NS_CERT_EXT_CA_CRL_URL=67, SEC_OID_NS_CERT_EXT_CA_CERT_URL=68, SEC_OID_NS_CERT_EXT_CERT_RENEWAL_URL=69, SEC_OID_NS_CERT_EXT_CA_POLICY_URL=70, SEC_OID_NS_CERT_EXT_HOMEPAGE_URL=71, SEC_OID_NS_CERT_EXT_ENTITY_LOGO=72, SEC_OID_NS_CERT_EXT_USER_PICTURE=73, SEC_OID_NS_CERT_EXT_SSL_SERVER_NAME=74, SEC_OID_NS_CERT_EXT_COMMENT=75, SEC_OID_NS_CERT_EXT_LOST_PASSWORD_URL=76, SEC_OID_NS_CERT_EXT_CERT_RENEWAL_TIME=77, SEC_OID_NS_KEY_USAGE_GOVT_APPROVED=78, SEC_OID_X509_SUBJECT_DIRECTORY_ATTR=79, SEC_OID_X509_SUBJECT_KEY_ID=80, SEC_OID_X509_KEY_USAGE=81, SEC_OID_X509_PRIVATE_KEY_USAGE_PERIOD=82, SEC_OID_X509_SUBJECT_ALT_NAME=83, SEC_OID_X509_ISSUER_ALT_NAME=84, SEC_OID_X509_BASIC_CONSTRAINTS=85, SEC_OID_X509_NAME_CONSTRAINTS=86, SEC_OID_X509_CRL_DIST_POINTS=87, SEC_OID_X509_CERTIFICATE_POLICIES=88, SEC_OID_X509_POLICY_MAPPINGS=89, SEC_OID_X509_POLICY_CONSTRAINTS=90, SEC_OID_X509_AUTH_KEY_ID=91, SEC_OID_X509_EXT_KEY_USAGE=92, SEC_OID_X509_AUTH_INFO_ACCESS=93, SEC_OID_X509_CRL_NUMBER=94, SEC_OID_X509_REASON_CODE=95, SEC_OID_X509_INVALID_DATE=96, SEC_OID_X500_RSA_ENCRYPTION=97, SEC_OID_RFC1274_UID=98, SEC_OID_RFC1274_MAIL=99, SEC_OID_PKCS12=100, SEC_OID_PKCS12_MODE_IDS=101, SEC_OID_PKCS12_ESPVK_IDS=102, SEC_OID_PKCS12_BAG_IDS=103, SEC_OID_PKCS12_CERT_BAG_IDS=104, SEC_OID_PKCS12_OIDS=105, SEC_OID_PKCS12_PBE_IDS=106, SEC_OID_PKCS12_SIGNATURE_IDS=107, SEC_OID_PKCS12_ENVELOPING_IDS=108, SEC_OID_PKCS12_PKCS8_KEY_SHROUDING=109, SEC_OID_PKCS12_KEY_BAG_ID=110, SEC_OID_PKCS12_CERT_AND_CRL_BAG_ID=111, SEC_OID_PKCS12_SECRET_BAG_ID=112, SEC_OID_PKCS12_X509_CERT_CRL_BAG=113, SEC_OID_PKCS12_SDSI_CERT_BAG=114, SEC_OID_PKCS12_PBE_WITH_SHA1_AND_128_BIT_RC4=115, SEC_OID_PKCS12_PBE_WITH_SHA1_AND_40_BIT_RC4=116, SEC_OID_PKCS12_PBE_WITH_SHA1_AND_TRIPLE_DES_CBC=117, SEC_OID_PKCS12_PBE_WITH_SHA1_AND_128_BIT_RC2_CBC=118, SEC_OID_PKCS12_PBE_WITH_SHA1_AND_40_BIT_RC2_CBC=119, SEC_OID_PKCS12_RSA_ENCRYPTION_WITH_128_BIT_RC4=120, SEC_OID_PKCS12_RSA_ENCRYPTION_WITH_40_BIT_RC4=121, SEC_OID_PKCS12_RSA_ENCRYPTION_WITH_TRIPLE_DES=122, SEC_OID_PKCS12_RSA_SIGNATURE_WITH_SHA1_DIGEST=123, SEC_OID_ANSIX9_DSA_SIGNATURE=124, SEC_OID_ANSIX9_DSA_SIGNATURE_WITH_SHA1_DIGEST=125, SEC_OID_BOGUS_DSA_SIGNATURE_WITH_SHA1_DIGEST=126, SEC_OID_VERISIGN_USER_NOTICES=127, SEC_OID_PKIX_CPS_POINTER_QUALIFIER=128, SEC_OID_PKIX_USER_NOTICE_QUALIFIER=129, SEC_OID_PKIX_OCSP=130, SEC_OID_PKIX_OCSP_BASIC_RESPONSE=131, SEC_OID_PKIX_OCSP_NONCE=132, SEC_OID_PKIX_OCSP_CRL=133, SEC_OID_PKIX_OCSP_RESPONSE=134, SEC_OID_PKIX_OCSP_NO_CHECK=135, SEC_OID_PKIX_OCSP_ARCHIVE_CUTOFF=136, SEC_OID_PKIX_OCSP_SERVICE_LOCATOR=137, SEC_OID_PKIX_REGCTRL_REGTOKEN=138, SEC_OID_PKIX_REGCTRL_AUTHENTICATOR=139, SEC_OID_PKIX_REGCTRL_PKIPUBINFO=140, SEC_OID_PKIX_REGCTRL_PKI_ARCH_OPTIONS=141, SEC_OID_PKIX_REGCTRL_OLD_CERT_ID=142, SEC_OID_PKIX_REGCTRL_PROTOCOL_ENC_KEY=143, SEC_OID_PKIX_REGINFO_UTF8_PAIRS=144, SEC_OID_PKIX_REGINFO_CERT_REQUEST=145, SEC_OID_EXT_KEY_USAGE_SERVER_AUTH=146, SEC_OID_EXT_KEY_USAGE_CLIENT_AUTH=147, SEC_OID_EXT_KEY_USAGE_CODE_SIGN=148, SEC_OID_EXT_KEY_USAGE_EMAIL_PROTECT=149, SEC_OID_EXT_KEY_USAGE_TIME_STAMP=150, SEC_OID_OCSP_RESPONDER=151, SEC_OID_NETSCAPE_SMIME_KEA=152, SEC_OID_FORTEZZA_SKIPJACK=153, SEC_OID_PKCS12_V2_PBE_WITH_SHA1_AND_128_BIT_RC4=154, SEC_OID_PKCS12_V2_PBE_WITH_SHA1_AND_40_BIT_RC4=155, SEC_OID_PKCS12_V2_PBE_WITH_SHA1_AND_3KEY_TRIPLE_DES_CBC=156, SEC_OID_PKCS12_V2_PBE_WITH_SHA1_AND_2KEY_TRIPLE_DES_CBC=157, SEC_OID_PKCS12_V2_PBE_WITH_SHA1_AND_128_BIT_RC2_CBC=158, SEC_OID_PKCS12_V2_PBE_WITH_SHA1_AND_40_BIT_RC2_CBC=159, SEC_OID_PKCS12_SAFE_CONTENTS_ID=160, SEC_OID_PKCS12_PKCS8_SHROUDED_KEY_BAG_ID=161, SEC_OID_PKCS12_V1_KEY_BAG_ID=162, SEC_OID_PKCS12_V1_PKCS8_SHROUDED_KEY_BAG_ID=163, SEC_OID_PKCS12_V1_CERT_BAG_ID=164, SEC_OID_PKCS12_V1_CRL_BAG_ID=165, SEC_OID_PKCS12_V1_SECRET_BAG_ID=166, SEC_OID_PKCS12_V1_SAFE_CONTENTS_BAG_ID=167, SEC_OID_PKCS9_X509_CERT=168, SEC_OID_PKCS9_SDSI_CERT=169, SEC_OID_PKCS9_X509_CRL=170, SEC_OID_PKCS9_FRIENDLY_NAME=171, SEC_OID_PKCS9_LOCAL_KEY_ID=172, SEC_OID_BOGUS_KEY_USAGE=173, SEC_OID_X942_DIFFIE_HELMAN_KEY=174, SEC_OID_NETSCAPE_NICKNAME=175, SEC_OID_NETSCAPE_RECOVERY_REQUEST=176, SEC_OID_CERT_RENEWAL_LOCATOR=177, SEC_OID_NS_CERT_EXT_SCOPE_OF_USE=178, SEC_OID_CMS_EPHEMERAL_STATIC_DIFFIE_HELLMAN=179, SEC_OID_CMS_3DES_KEY_WRAP=180, SEC_OID_CMS_RC2_KEY_WRAP=181, SEC_OID_SMIME_ENCRYPTION_KEY_PREFERENCE=182, SEC_OID_AES_128_ECB=183, SEC_OID_AES_128_CBC=184, SEC_OID_AES_192_ECB=185, SEC_OID_AES_192_CBC=186, SEC_OID_AES_256_ECB=187, SEC_OID_AES_256_CBC=188, SEC_OID_SDN702_DSA_SIGNATURE=189, SEC_OID_MS_SMIME_ENCRYPTION_KEY_PREFERENCE=190, SEC_OID_SHA256=191, SEC_OID_SHA384=192, SEC_OID_SHA512=193, SEC_OID_PKCS1_SHA256_WITH_RSA_ENCRYPTION=194, SEC_OID_PKCS1_SHA384_WITH_RSA_ENCRYPTION=195, SEC_OID_PKCS1_SHA512_WITH_RSA_ENCRYPTION=196, SEC_OID_AES_128_KEY_WRAP=197, SEC_OID_AES_192_KEY_WRAP=198, SEC_OID_AES_256_KEY_WRAP=199, SEC_OID_ANSIX962_EC_PUBLIC_KEY=200, SEC_OID_ANSIX962_ECDSA_SHA1_SIGNATURE=201, SEC_OID_ANSIX962_EC_PRIME192V1=202, SEC_OID_ANSIX962_EC_PRIME192V2=203, SEC_OID_ANSIX962_EC_PRIME192V3=204, SEC_OID_ANSIX962_EC_PRIME239V1=205, SEC_OID_ANSIX962_EC_PRIME239V2=206, SEC_OID_ANSIX962_EC_PRIME239V3=207, SEC_OID_ANSIX962_EC_PRIME256V1=208, SEC_OID_SECG_EC_SECP112R1=209, SEC_OID_SECG_EC_SECP112R2=210, SEC_OID_SECG_EC_SECP128R1=211, SEC_OID_SECG_EC_SECP128R2=212, SEC_OID_SECG_EC_SECP160K1=213, SEC_OID_SECG_EC_SECP160R1=214, SEC_OID_SECG_EC_SECP160R2=215, SEC_OID_SECG_EC_SECP192K1=216, SEC_OID_SECG_EC_SECP224K1=217, SEC_OID_SECG_EC_SECP224R1=218, SEC_OID_SECG_EC_SECP256K1=219, SEC_OID_SECG_EC_SECP384R1=220, SEC_OID_SECG_EC_SECP521R1=221, SEC_OID_ANSIX962_EC_C2PNB163V1=222, SEC_OID_ANSIX962_EC_C2PNB163V2=223, SEC_OID_ANSIX962_EC_C2PNB163V3=224, SEC_OID_ANSIX962_EC_C2PNB176V1=225, SEC_OID_ANSIX962_EC_C2TNB191V1=226, SEC_OID_ANSIX962_EC_C2TNB191V2=227, SEC_OID_ANSIX962_EC_C2TNB191V3=228, SEC_OID_ANSIX962_EC_C2ONB191V4=229, SEC_OID_ANSIX962_EC_C2ONB191V5=230, SEC_OID_ANSIX962_EC_C2PNB208W1=231, SEC_OID_ANSIX962_EC_C2TNB239V1=232, SEC_OID_ANSIX962_EC_C2TNB239V2=233, SEC_OID_ANSIX962_EC_C2TNB239V3=234, SEC_OID_ANSIX962_EC_C2ONB239V4=235, SEC_OID_ANSIX962_EC_C2ONB239V5=236, SEC_OID_ANSIX962_EC_C2PNB272W1=237, SEC_OID_ANSIX962_EC_C2PNB304W1=238, SEC_OID_ANSIX962_EC_C2TNB359V1=239, SEC_OID_ANSIX962_EC_C2PNB368W1=240, SEC_OID_ANSIX962_EC_C2TNB431R1=241, SEC_OID_SECG_EC_SECT113R1=242, SEC_OID_SECG_EC_SECT113R2=243, SEC_OID_SECG_EC_SECT131R1=244, SEC_OID_SECG_EC_SECT131R2=245, SEC_OID_SECG_EC_SECT163K1=246, SEC_OID_SECG_EC_SECT163R1=247, SEC_OID_SECG_EC_SECT163R2=248, SEC_OID_SECG_EC_SECT193R1=249, SEC_OID_SECG_EC_SECT193R2=250, SEC_OID_SECG_EC_SECT233K1=251, SEC_OID_SECG_EC_SECT233R1=252, SEC_OID_SECG_EC_SECT239K1=253, SEC_OID_SECG_EC_SECT283K1=254, SEC_OID_SECG_EC_SECT283R1=255, SEC_OID_SECG_EC_SECT409K1=256, SEC_OID_SECG_EC_SECT409R1=257, SEC_OID_SECG_EC_SECT571K1=258, SEC_OID_SECG_EC_SECT571R1=259, SEC_OID_NETSCAPE_AOLSCREENNAME=260, SEC_OID_AVA_SURNAME=261, SEC_OID_AVA_SERIAL_NUMBER=262, SEC_OID_AVA_STREET_ADDRESS=263, SEC_OID_AVA_TITLE=264, SEC_OID_AVA_POSTAL_ADDRESS=265, SEC_OID_AVA_POSTAL_CODE=266, SEC_OID_AVA_POST_OFFICE_BOX=267, SEC_OID_AVA_GIVEN_NAME=268, SEC_OID_AVA_INITIALS=269, SEC_OID_AVA_GENERATION_QUALIFIER=270, SEC_OID_AVA_HOUSE_IDENTIFIER=271, SEC_OID_AVA_PSEUDONYM=272, SEC_OID_PKIX_CA_ISSUERS=273, SEC_OID_PKCS9_EXTENSION_REQUEST=274, SEC_OID_ANSIX962_ECDSA_SIGNATURE_RECOMMENDED_DIGEST=275, SEC_OID_ANSIX962_ECDSA_SIGNATURE_SPECIFIED_DIGEST=276, SEC_OID_ANSIX962_ECDSA_SHA224_SIGNATURE=277, SEC_OID_ANSIX962_ECDSA_SHA256_SIGNATURE=278, SEC_OID_ANSIX962_ECDSA_SHA384_SIGNATURE=279, SEC_OID_ANSIX962_ECDSA_SHA512_SIGNATURE=280, SEC_OID_X509_HOLD_INSTRUCTION_CODE=281, SEC_OID_X509_DELTA_CRL_INDICATOR=282, SEC_OID_X509_ISSUING_DISTRIBUTION_POINT=283, SEC_OID_X509_CERT_ISSUER=284, SEC_OID_X509_FRESHEST_CRL=285, SEC_OID_X509_INHIBIT_ANY_POLICY=286, SEC_OID_X509_SUBJECT_INFO_ACCESS=287, SEC_OID_CAMELLIA_128_CBC=288, SEC_OID_CAMELLIA_192_CBC=289, SEC_OID_CAMELLIA_256_CBC=290, SEC_OID_PKCS5_PBKDF2=291, SEC_OID_PKCS5_PBES2=292, SEC_OID_PKCS5_PBMAC1=293, SEC_OID_HMAC_SHA1=294, SEC_OID_HMAC_SHA224=295, SEC_OID_HMAC_SHA256=296, SEC_OID_HMAC_SHA384=297, SEC_OID_HMAC_SHA512=298, SEC_OID_PKIX_TIMESTAMPING=299, SEC_OID_PKIX_CA_REPOSITORY=300, SEC_OID_ISO_SHA1_WITH_RSA_SIGNATURE=301, SEC_OID_SEED_CBC=302, SEC_OID_X509_ANY_POLICY=303, SEC_OID_PKCS1_RSA_OAEP_ENCRYPTION=304, SEC_OID_PKCS1_MGF1=305, SEC_OID_PKCS1_PSPECIFIED=306, SEC_OID_PKCS1_RSA_PSS_SIGNATURE=307, SEC_OID_PKCS1_SHA224_WITH_RSA_ENCRYPTION=308, SEC_OID_SHA224=309, SEC_OID_EV_INCORPORATION_LOCALITY=310, SEC_OID_EV_INCORPORATION_STATE=311, SEC_OID_EV_INCORPORATION_COUNTRY=312, SEC_OID_BUSINESS_CATEGORY=313, SEC_OID_NIST_DSA_SIGNATURE_WITH_SHA224_DIGEST=314, SEC_OID_NIST_DSA_SIGNATURE_WITH_SHA256_DIGEST=315, SEC_OID_MS_EXT_KEY_USAGE_CTL_SIGNING=316, SEC_OID_AVA_NAME=317, SEC_OID_AES_128_GCM=318, SEC_OID_AES_192_GCM=319, SEC_OID_AES_256_GCM=320, SEC_OID_IDEA_CBC=321, SEC_OID_RC2_40_CBC=322, SEC_OID_DES_40_CBC=323, SEC_OID_RC4_40=324, SEC_OID_RC4_56=325, SEC_OID_NULL_CIPHER=326, SEC_OID_HMAC_MD5=327, SEC_OID_TLS_RSA=328, SEC_OID_TLS_DHE_RSA=329, SEC_OID_TLS_DHE_DSS=330, SEC_OID_TLS_DH_RSA=331, SEC_OID_TLS_DH_DSS=332, SEC_OID_TLS_DH_ANON=333, SEC_OID_TLS_ECDHE_ECDSA=334, SEC_OID_TLS_ECDHE_RSA=335, SEC_OID_TLS_ECDH_ECDSA=336, SEC_OID_TLS_ECDH_RSA=337, SEC_OID_TLS_ECDH_ANON=338, SEC_OID_TLS_RSA_EXPORT=339, SEC_OID_TLS_DHE_RSA_EXPORT=340, SEC_OID_TLS_DHE_DSS_EXPORT=341, SEC_OID_TLS_DH_RSA_EXPORT=342, SEC_OID_TLS_DH_DSS_EXPORT=343, SEC_OID_TLS_DH_ANON_EXPORT=344, SEC_OID_APPLY_SSL_POLICY=345, SEC_OID_CHACHA20_POLY1305=346, SEC_OID_TLS_ECDHE_PSK=347, SEC_OID_TLS_DHE_PSK=348, SEC_OID_TLS_FFDHE_2048=349, SEC_OID_TLS_FFDHE_3072=350, SEC_OID_TLS_FFDHE_4096=351, SEC_OID_TLS_FFDHE_6144=352, SEC_OID_TLS_FFDHE_8192=353, SEC_OID_TLS_DHE_CUSTOM=354, SEC_OID_CURVE25519=355, SEC_OID_TLS13_KEA_ANY=356, SEC_OID_X509_ANY_EXT_KEY_USAGE=357, SEC_OID_EXT_KEY_USAGE_IPSEC_IKE=358, SEC_OID_IPSEC_IKE_END=359, SEC_OID_IPSEC_IKE_INTERMEDIATE=360, SEC_OID_TOTAL=361 }

user_defined_types: enum SECSupportExtenTag { INVALID_CERT_EXTENSION=0, UNSUPPORTED_CERT_EXTENSION=1, SUPPORTED_CERT_EXTENSION=2 }

user_defined_types: enum SECItemType { siBuffer=0, siClearDataBuffer=1, siCipherDataBuffer=2, siDERCertBuffer=3, siEncodedCertBuffer=4, siDERNameBuffer=5, siEncodedNameBuffer=6, siAsciiNameString=7, siAsciiString=8, siDEROID=9, siUnsignedInteger=10, siUTCTime=11, siGeneralizedTime=12, siVisibleString=13, siUTF8String=14, siBMPString=15 }


decompiled_code:
__int64 __fastcall jam_nss_cka(__int64 a1, __int64 a2)
{
__int64 result; // rax

if ( !a2 )
return jam_string(a1, "FLAGS_ONLY");
switch ( a2 )
{
case 260LL:
result = jam_string(a1, "ENCRYPT");
break;
case 261LL:
result = jam_string(a1, "DECRYPT");
break;
case 262LL:
result = jam_string(a1, "WRAP");
break;
case 263LL:
result = jam_string(a1, "UNWRAP");
break;
case 264LL:
result = jam_string(a1, "SIGN");
break;
case 265LL:
result = jam_string(a1, "SIGN_RECOVER");
break;
case 266LL:
result = jam_string(a1, "VERIFY");
break;
case 267LL:
result = jam_string(a1, "VERIFY_RECOVER");
break;
case 268LL:
result = jam_string(a1, "DERIVE");
break;
default:
result = jam(a1, "CKA_%08lx", a2);
break;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, __int64 a2)
{
__int64 result; // rax

if ( !a2 )
return jam_string(a1, "FLAGS_ONLY");
switch ( a2 )
{
case 260LL:
result = jam_string(a1, "ENCRYPT");
break;
case 261LL:
result = jam_string(a1, "DECRYPT");
break;
case 262LL:
result = jam_string(a1, "WRAP");
break;
case 263LL:
result = jam_string(a1, "UNWRAP");
break;
case 264LL:
result = jam_string(a1, "SIGN");
break;
case 265LL:
result = jam_string(a1, "SIGN_RECOVER");
break;
case 266LL:
result = jam_string(a1, "VERIFY");
break;
case 267LL:
result = jam_string(a1, "VERIFY_RECOVER");
break;
case 268LL:
result = jam_string(a1, "DERIVE");
break;
default:
result = jam(a1, "CKA_%08lx", a2);
break;
}
return result;
}

original_code:
size_t jam_nss_cka(struct jambuf *buf, CK_ATTRIBUTE_TYPE attribute)
{
 switch (attribute) {
  case 0x0000010C: return jam_string(buf, &"CKA_DERIVE"[strlen("CKA_")]);
  case 0: return jam_string(buf, &"CKA_FLAGS_ONLY"[strlen("CKA_")]);
  case 0x00000106: return jam_string(buf, &"CKA_WRAP"[strlen("CKA_")]);
  case 0x00000107: return jam_string(buf, &"CKA_UNWRAP"[strlen("CKA_")]);
  case 0x00000104: return jam_string(buf, &"CKA_ENCRYPT"[strlen("CKA_")]);
  case 0x00000105: return jam_string(buf, &"CKA_DECRYPT"[strlen("CKA_")]);
  case 0x00000108: return jam_string(buf, &"CKA_SIGN"[strlen("CKA_")]);
  case 0x00000109: return jam_string(buf, &"CKA_SIGN_RECOVER"[strlen("CKA_")]);
  case 0x0000010A: return jam_string(buf, &"CKA_VERIFY"[strlen("CKA_")]);
  case 0x0000010B: return jam_string(buf, &"CKA_VERIFY_RECOVER"[strlen("CKA_")]);
 default:
  return jam(buf, "CKA_%08lx", (long)attribute);
 }
}

canonical_original_code:
unsigned long jam_nss_cka(struct jambuf *buf, unsigned long attribute)
{
 switch (attribute) {
  case 0x0000010C: return jam_string(buf, &"CKA_DERIVE"[strlen("CKA_")]);
  case 0: return jam_string(buf, &"CKA_FLAGS_ONLY"[strlen("CKA_")]);
  case 0x00000106: return jam_string(buf, &"CKA_WRAP"[strlen("CKA_")]);
  case 0x00000107: return jam_string(buf, &"CKA_UNWRAP"[strlen("CKA_")]);
  case 0x00000104: return jam_string(buf, &"CKA_ENCRYPT"[strlen("CKA_")]);
  case 0x00000105: return jam_string(buf, &"CKA_DECRYPT"[strlen("CKA_")]);
  case 0x00000108: return jam_string(buf, &"CKA_SIGN"[strlen("CKA_")]);
  case 0x00000109: return jam_string(buf, &"CKA_SIGN_RECOVER"[strlen("CKA_")]);
  case 0x0000010A: return jam_string(buf, &"CKA_VERIFY"[strlen("CKA_")]);
  case 0x0000010B: return jam_string(buf, &"CKA_VERIFY_RECOVER"[strlen("CKA_")]);
 default:
  return jam(buf, "CKA_%08lx", (long)attribute);
 }
}

variable_types:
attribute
unsigned long


untext

decompiled_code:
__int64 __fastcall untext(_BYTE *a1, _BYTE *a2, __int64 a3)
{
if ( !a3 )
return 4294967294LL;
*a2 = *a1;
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func0(_BYTE *a1, _BYTE *a2, __int64 a3)
{
if ( !a3 )
return 4294967294LL;
*a2 = *a1;
return 1LL;
}

original_code:
static int untext(const char *src,
    char *dst,
    size_t dstlen)
{
 if (dstlen < 1)
  return (-2);
 *dst = *src;
 return 1;
}

canonical_original_code:
static int untext(char *src, char *dst, unsigned long dstlen)
{
 if (dstlen < 1)
  return (-2);
 *dst = *src;
 return 1;
}

variable_types:
src
char *

variable_types:
dst
char *

variable_types:
dstlen
unsigned long

return_type: int


badch

decompiled_code:
const char *badch()
{
return "unknown character in input";
}

canonical_decompiled_code:
const char *func1()
{
return "unknown character in input";
}

original_code:
static err_t badch(void)
{
 return "unknown character in input";
}

canonical_original_code:
static char *badch()
{
 return "unknown character in input";
}


ttodatav

decompiled_code:
const char *__fastcall ttodatav(char *a1, unsigned __int64 a2, int a3, char *a4, __int64 a5, _QWORD *a6)
{
int v6; // er12
char *v7; // rbp
unsigned __int64 v8; // rbx
const char *result; // rax
__int64 (__fastcall *v10)(); // r11
__int64 v11; // r10
char *v12; // r13
char *v13; // rax
int v14; // er8
unsigned __int64 v15; // rcx
__int64 v16; // r9
char *v17; // r13
char *v18; // rax
unsigned __int64 v19; // rdi
char v20; // dl
unsigned __int64 v21; // r14
char *v22; // r15
int v23; // eax
char *v24; // rdx
int v25; // edx
__int64 (__fastcall *v26)(); // [rsp+0h] [rbp-78h]
int v27; // [rsp+10h] [rbp-68h]
int v28; // [rsp+14h] [rbp-64h]
unsigned __int64 v29; // [rsp+18h] [rbp-60h]
__int64 v30; // [rsp+20h] [rbp-58h]
char v32[4]; // [rsp+30h] [rbp-48h] BYREF
char v33[4]; // [rsp+34h] [rbp-44h] BYREF
unsigned __int64 v34; // [rsp+38h] [rbp-40h]

v6 = a3;
v7 = a1;
v8 = a2;
v34 = __readfsqword(0x28u);
if ( !a5 )
a4 = v32;
if ( a3 )
{
if ( a3 == 64 )
{
v6 = 0;
v10 = unb64;
v11 = 4LL;
}
else if ( a3 == 256 )
{
v6 = 0;
v10 = (__int64 (__fastcall *)())untext;
v11 = 1LL;
}
else
{
result = "unknown base";
if ( a3 != 16 )
return result;
v6 = 1;
v10 = unhex;
v11 = 2LL;
}
LABEL_13:
if ( v8 )
{
v27 = 0;
v12 = &a4[a5];
v13 = a4;
v14 = v6;
v15 = (unsigned __int64)v12;
v16 = v11;
v17 = v13;
do
{
while ( 1 )
{
v18 = v33;
v19 = v8 - v16;
while ( 1 )
{
v20 = *v7;
v21 = v8--;
v22 = v7;
++v18;
++v7;
*(v18 - 1) = v20;
if ( v19 == v8 )
break;
if ( !v8 )
return "input ends in mid-byte, perhaps truncated";
}
v30 = v16;
v29 = v15;
v28 = v14;
v26 = v10;
v23 = ((__int64 (__fastcall *)(_BYTE *, _BYTE *, __int64))v10)(v33, v32, 4LL);
if ( v23 == -3 )
return "bad (non-zero) padding at end of base64 input";
v10 = v26;
v14 = v28;
v15 = v29;
v16 = v30;
if ( v23 < -2 )
{
if ( (unsigned int)(v23 + 7) <= 3 )
return badch();
return "unknown internal error";
}
if ( v23 == -2 )
return "internal buffer too short (\"can't happen\")";
if ( v23 <= 0 )
return "unknown internal error";
v24 = v32;
do
{
if ( v29 > (unsigned __int64)v17 )
*v17++ = *v24;
++v24;
}
while ( &v32[v23 - 1 + 1] != v24 );
v25 = v23 + v27;
v27 += v23;
if ( v8 <= 1 || (v28 & 1) == 0 )
break;
if ( *v7 == 95 )
{
v7 = v22 + 2;
v8 = v21 - 2;
}
}
}
while ( v8 );
result = 0LL;
if ( a6 )
*a6 = v25;
}
else
{
result = "no data bytes specified by input";
}
}
else if ( a2 <= 1 )
{
result = "input too short to be valid";
}
else if ( *a1 == 48 )
{
switch ( a1[1] )
{
case 'S':
case 's':
v8 = a2 - 2;
v7 = a1 + 2;
v10 = unb64;
v11 = 4LL;
goto LABEL_13;
case 'T':
case 't':
v8 = a2 - 2;
v7 = a1 + 2;
v10 = (__int64 (__fastcall *)())untext;
v11 = 1LL;
goto LABEL_13;
case 'X':
case 'x':
v8 = a2 - 2;
v7 = a1 + 2;
v6 = 1;
v11 = 2LL;
v10 = unhex;
goto LABEL_13;
default:
result = "unknown format prefix";
break;
}
}
else
{
result = "input does not begin with format prefix";
}
return result;
}

canonical_decompiled_code:
const char *__fastcall func2(char *a1, unsigned __int64 a2, int a3, char *a4, __int64 a5, _QWORD *a6)
{
int v6; // er12
char *v7; // rbp
unsigned __int64 v8; // rbx
const char *result; // rax
__int64 (__fastcall *v10)(); // r11
__int64 v11; // r10
char *v12; // r13
char *v13; // rax
int v14; // er8
unsigned __int64 v15; // rcx
__int64 v16; // r9
char *v17; // r13
char *v18; // rax
unsigned __int64 v19; // rdi
char v20; // dl
unsigned __int64 v21; // r14
char *v22; // r15
int v23; // eax
char *v24; // rdx
int v25; // edx
__int64 (__fastcall *v26)(); // [rsp+0h] [rbp-78h]
int v27; // [rsp+10h] [rbp-68h]
int v28; // [rsp+14h] [rbp-64h]
unsigned __int64 v29; // [rsp+18h] [rbp-60h]
__int64 v30; // [rsp+20h] [rbp-58h]
char v32[4]; // [rsp+30h] [rbp-48h] BYREF
char v33[4]; // [rsp+34h] [rbp-44h] BYREF
unsigned __int64 v34; // [rsp+38h] [rbp-40h]

v6 = a3;
v7 = a1;
v8 = a2;
v34 = __readfsqword(0x28u);
if ( !a5 )
a4 = v32;
if ( a3 )
{
if ( a3 == 64 )
{
v6 = 0;
v10 = unb64;
v11 = 4LL;
}
else if ( a3 == 256 )
{
v6 = 0;
v10 = (__int64 (__fastcall *)())untext;
v11 = 1LL;
}
else
{
result = "unknown base";
if ( a3 != 16 )
return result;
v6 = 1;
v10 = unhex;
v11 = 2LL;
}
LABEL_13:
if ( v8 )
{
v27 = 0;
v12 = &a4[a5];
v13 = a4;
v14 = v6;
v15 = (unsigned __int64)v12;
v16 = v11;
v17 = v13;
do
{
while ( 1 )
{
v18 = v33;
v19 = v8 - v16;
while ( 1 )
{
v20 = *v7;
v21 = v8--;
v22 = v7;
++v18;
++v7;
*(v18 - 1) = v20;
if ( v19 == v8 )
break;
if ( !v8 )
return "input ends in mid-byte, perhaps truncated";
}
v30 = v16;
v29 = v15;
v28 = v14;
v26 = v10;
v23 = ((__int64 (__fastcall *)(_BYTE *, _BYTE *, __int64))v10)(v33, v32, 4LL);
if ( v23 == -3 )
return "bad (non-zero) padding at end of base64 input";
v10 = v26;
v14 = v28;
v15 = v29;
v16 = v30;
if ( v23 < -2 )
{
if ( (unsigned int)(v23 + 7) <= 3 )
return func1();
return "unknown internal error";
}
if ( v23 == -2 )
return "internal buffer too short (\"can't happen\")";
if ( v23 <= 0 )
return "unknown internal error";
v24 = v32;
do
{
if ( v29 > (unsigned __int64)v17 )
*v17++ = *v24;
++v24;
}
while ( &v32[v23 - 1 + 1] != v24 );
v25 = v23 + v27;
v27 += v23;
if ( v8 <= 1 || (v28 & 1) == 0 )
break;
if ( *v7 == 95 )
{
v7 = v22 + 2;
v8 = v21 - 2;
}
}
}
while ( v8 );
result = 0LL;
if ( a6 )
*a6 = v25;
}
else
{
result = "no data bytes specified by input";
}
}
else if ( a2 <= 1 )
{
result = "input too short to be valid";
}
else if ( *a1 == 48 )
{
switch ( a1[1] )
{
case 'S':
case 's':
v8 = a2 - 2;
v7 = a1 + 2;
v10 = unb64;
v11 = 4LL;
goto LABEL_13;
case 'T':
case 't':
v8 = a2 - 2;
v7 = a1 + 2;
v10 = (__int64 (__fastcall *)())untext;
v11 = 1LL;
goto LABEL_13;
case 'X':
case 'x':
v8 = a2 - 2;
v7 = a1 + 2;
v6 = 1;
v11 = 2LL;
v10 = unhex;
goto LABEL_13;
default:
result = "unknown format prefix";
break;
}
}
else
{
result = "input does not begin with format prefix";
}
return result;
}

original_code:
static const char *ttodatav(const char *src, size_t srclen,
       int base,
       char *dst,
       size_t dstlen,
       size_t *lenp)
{
 size_t ingroup;
 char buf[4];
 int nbytes;
 int (*decode)(const char *, char *, size_t);
 char *stop;
 int ndone;
 int i;
 int underscoreok;
 if (dstlen == 0)
  dst = buf;
 stop = dst + dstlen;
 if (base == 0) {
  if (srclen < 2)
   return "input too short to be valid";
  if (*src++ != '0')
   return "input does not begin with format prefix";
  switch (*src++) {
  case 'x':
  case 'X':
   base = 16;
   break;
  case 's':
  case 'S':
   base = 64;
   break;
  case 't':
  case 'T':
   base = 256;
   break;
  default:
   return "unknown format prefix";
  }
  srclen -= 2;
 }
 switch (base) {
 case 16:
  decode = unhex;
  underscoreok = 1;
  ingroup = 2;
  break;
 case 64:
  decode = unb64;
  underscoreok = 0;
  ingroup = 4;
  break;
 case 256:
  decode = untext;
  ingroup = 1;
  underscoreok = 0;
  break;
 default:
  return "unknown base";
 }
 ndone = 0;
 while (srclen > 0) {
  char stage[4];
  size_t sl = 0;
  for (sl = 0; sl < ingroup; src++, srclen--) {
   if (srclen == 0)
    return "input ends in mid-byte, perhaps truncated";
   else
    stage[sl++] = *src;
  }
  nbytes = (*decode)(stage, buf, sizeof(buf));
  switch (nbytes) {
  case (-4):
  case (-5):
  case (-6):
  case (-7):
   return badch();
  case (-2):
   return "internal buffer too short (\"can't happen\")";
  case (-3):
   return "bad (non-zero) padding at end of base64 input";
  }
  if (nbytes <= 0)
   return "unknown internal error";
  for (i = 0; i < nbytes; i++) {
   if (dst < stop)
    *dst++ = buf[i];
   ndone++;
  }
  if (underscoreok && srclen > 1 && *src == '_') {
   src++;
   srclen--;
  }
 }
 if (ndone == 0)
  return "no data bytes specified by input";
 if (lenp != ((void *)0))
  *lenp = ndone;
 return ((void *)0);
}

canonical_original_code:
static char *ttodatav(char *src, unsigned long srclen, int base, char *dst, unsigned long dstlen, unsigned long *lenp)
{
 unsigned long ingroup;
 char buf[4];
 int nbytes;
 int (*decode)(char *, char *, unsigned long);
 char *stop;
 int ndone;
 int i;
 int underscoreok;
 if (dstlen == 0)
  dst = buf;
 stop = dst + dstlen;
 if (base == 0) {
  if (srclen < 2)
   return "input too short to be valid";
  if (*src++ != '0')
   return "input does not begin with format prefix";
  switch (*src++) {
  case 'x':
  case 'X':
   base = 16;
   break;
  case 's':
  case 'S':
   base = 64;
   break;
  case 't':
  case 'T':
   base = 256;
   break;
  default:
   return "unknown format prefix";
  }
  srclen -= 2;
 }
 switch (base) {
 case 16:
  decode = unhex;
  underscoreok = 1;
  ingroup = 2;
  break;
 case 64:
  decode = unb64;
  underscoreok = 0;
  ingroup = 4;
  break;
 case 256:
  decode = untext;
  ingroup = 1;
  underscoreok = 0;
  break;
 default:
  return "unknown base";
 }
 ndone = 0;
 while (srclen > 0) {
  char stage[4];
  unsigned long sl = 0;
  for (sl = 0; sl < ingroup; src++, srclen--) {
   if (srclen == 0)
    return "input ends in mid-byte, perhaps truncated";
   else
    stage[sl++] = *src;
  }
  nbytes = (*decode)(stage, buf, sizeof(buf));
  switch (nbytes) {
  case (-4):
  case (-5):
  case (-6):
  case (-7):
   return badch();
  case (-2):
   return "internal buffer too short (\"can't happen\")";
  case (-3):
   return "bad (non-zero) padding at end of base64 input";
  }
  if (nbytes <= 0)
   return "unknown internal error";
  for (i = 0; i < nbytes; i++) {
   if (dst < stop)
    *dst++ = buf[i];
   ndone++;
  }
  if (underscoreok && srclen > 1 && *src == '_') {
   src++;
   srclen--;
  }
 }
 if (ndone == 0)
  return "no data bytes specified by input";
 if (lenp != ((void *)0))
  *lenp = ndone;
 return ((void *)0);
}

variable_types:
srclen
unsigned long

variable_types: base int

variable_types:
lenp
unsigned long *

variable_types:
ingroup
unsigned long

variable_types:
buf
char [4]

variable_types: nbytes int

variable_types:
decode
int (*)(char *, char *, unsigned long)

variable_types:
stop
char *

variable_types: ndone int

variable_types: i int

variable_types: underscoreok int

variable_types:
stage
char [4]

variable_types:
sl
unsigned long