decompiled_code:
__int64 __fastcall asn1_add_error(__int64 a1, unsigned int a2)
{
char v3[13]; // [rsp+3h] [rbp-35h] BYREF
char v4[40]; // [rsp+10h] [rbp-28h] BYREF

BIO_snprintf(v4, 24LL, "%lu", a1);
BIO_snprintf(v3, 13LL, "%d", a2);
return ERR_add_error_data(4LL, "address=", v4, " offset=", v3);
}

canonical_decompiled_code:
__int64 __fastcall func20(__int64 a1, unsigned int a2)
{
char v3[13]; // [rsp+3h] [rbp-35h] BYREF
char v4[40]; // [rsp+10h] [rbp-28h] BYREF

BIO_snprintf(v4, 24LL, "%lu", a1);
BIO_snprintf(v3, 13LL, "%d", a2);
return ERR_add_error_data(4LL, "address=", v4, " offset=", v3);
}

original_code:
void asn1_add_error(const unsigned char *address, int offset)
{
    char buf1[DECIMAL_SIZE(address) + 1], buf2[DECIMAL_SIZE(offset) + 1];

    BIO_snprintf(buf1, sizeof buf1, "%lu", (unsigned long)address);
    BIO_snprintf(buf2, sizeof buf2, "%d", offset);
    ERR_add_error_data(4, "address=", buf1, " offset=", buf2);
}

canonical_original_code:
void asn1_add_error(unsigned char *address, int offset)
{
    char buf1[-1]; char buf2[-1];

    BIO_snprintf(buf1, sizeof buf1, "%lu", (unsigned long)address);
    BIO_snprintf(buf2, sizeof buf2, "%d", offset);
    ERR_add_error_data(4, "address=", buf1, " offset=", buf2);
}

variable_types:
address
unsigned char *

variable_types: offset int


original_code:
void OpenSSL_add_all_ciphers(void)
{

#ifndef OPENSSL_NO_DES
    EVP_add_cipher(EVP_des_cfb());
    EVP_add_cipher(EVP_des_cfb1());
    EVP_add_cipher(EVP_des_cfb8());
    EVP_add_cipher(EVP_des_ede_cfb());
    EVP_add_cipher(EVP_des_ede3_cfb());
    EVP_add_cipher(EVP_des_ede3_cfb1());
    EVP_add_cipher(EVP_des_ede3_cfb8());

    EVP_add_cipher(EVP_des_ofb());
    EVP_add_cipher(EVP_des_ede_ofb());
    EVP_add_cipher(EVP_des_ede3_ofb());

    EVP_add_cipher(EVP_desx_cbc());
    EVP_add_cipher_alias(SN_desx_cbc, "DESX");
    EVP_add_cipher_alias(SN_desx_cbc, "desx");

    EVP_add_cipher(EVP_des_cbc());
    EVP_add_cipher_alias(SN_des_cbc, "DES");
    EVP_add_cipher_alias(SN_des_cbc, "des");
    EVP_add_cipher(EVP_des_ede_cbc());
    EVP_add_cipher(EVP_des_ede3_cbc());
    EVP_add_cipher_alias(SN_des_ede3_cbc, "DES3");
    EVP_add_cipher_alias(SN_des_ede3_cbc, "des3");

    EVP_add_cipher(EVP_des_ecb());
    EVP_add_cipher(EVP_des_ede());
    EVP_add_cipher(EVP_des_ede3());
#endif

#ifndef OPENSSL_NO_RC4
    EVP_add_cipher(EVP_rc4());
    EVP_add_cipher(EVP_rc4_40());
# ifndef OPENSSL_NO_MD5
    EVP_add_cipher(EVP_rc4_hmac_md5());
# endif
#endif

#ifndef OPENSSL_NO_IDEA
    EVP_add_cipher(EVP_idea_ecb());
    EVP_add_cipher(EVP_idea_cfb());
    EVP_add_cipher(EVP_idea_ofb());
    EVP_add_cipher(EVP_idea_cbc());
    EVP_add_cipher_alias(SN_idea_cbc, "IDEA");
    EVP_add_cipher_alias(SN_idea_cbc, "idea");
#endif

#ifndef OPENSSL_NO_SEED
    EVP_add_cipher(EVP_seed_ecb());
    EVP_add_cipher(EVP_seed_cfb());
    EVP_add_cipher(EVP_seed_ofb());
    EVP_add_cipher(EVP_seed_cbc());
    EVP_add_cipher_alias(SN_seed_cbc, "SEED");
    EVP_add_cipher_alias(SN_seed_cbc, "seed");
#endif

#ifndef OPENSSL_NO_RC2
    EVP_add_cipher(EVP_rc2_ecb());
    EVP_add_cipher(EVP_rc2_cfb());
    EVP_add_cipher(EVP_rc2_ofb());
    EVP_add_cipher(EVP_rc2_cbc());
    EVP_add_cipher(EVP_rc2_40_cbc());
    EVP_add_cipher(EVP_rc2_64_cbc());
    EVP_add_cipher_alias(SN_rc2_cbc, "RC2");
    EVP_add_cipher_alias(SN_rc2_cbc, "rc2");
#endif

#ifndef OPENSSL_NO_BF
    EVP_add_cipher(EVP_bf_ecb());
    EVP_add_cipher(EVP_bf_cfb());
    EVP_add_cipher(EVP_bf_ofb());
    EVP_add_cipher(EVP_bf_cbc());
    EVP_add_cipher_alias(SN_bf_cbc, "BF");
    EVP_add_cipher_alias(SN_bf_cbc, "bf");
    EVP_add_cipher_alias(SN_bf_cbc, "blowfish");
#endif

#ifndef OPENSSL_NO_CAST
    EVP_add_cipher(EVP_cast5_ecb());
    EVP_add_cipher(EVP_cast5_cfb());
    EVP_add_cipher(EVP_cast5_ofb());
    EVP_add_cipher(EVP_cast5_cbc());
    EVP_add_cipher_alias(SN_cast5_cbc, "CAST");
    EVP_add_cipher_alias(SN_cast5_cbc, "cast");
    EVP_add_cipher_alias(SN_cast5_cbc, "CAST-cbc");
    EVP_add_cipher_alias(SN_cast5_cbc, "cast-cbc");
#endif

#ifndef OPENSSL_NO_RC5
    EVP_add_cipher(EVP_rc5_32_12_16_ecb());
    EVP_add_cipher(EVP_rc5_32_12_16_cfb());
    EVP_add_cipher(EVP_rc5_32_12_16_ofb());
    EVP_add_cipher(EVP_rc5_32_12_16_cbc());
    EVP_add_cipher_alias(SN_rc5_cbc, "rc5");
    EVP_add_cipher_alias(SN_rc5_cbc, "RC5");
#endif

#ifndef OPENSSL_NO_AES
    EVP_add_cipher(EVP_aes_128_ecb());
    EVP_add_cipher(EVP_aes_128_cbc());
    EVP_add_cipher(EVP_aes_128_cfb());
    EVP_add_cipher(EVP_aes_128_cfb1());
    EVP_add_cipher(EVP_aes_128_cfb8());
    EVP_add_cipher(EVP_aes_128_ofb());
    EVP_add_cipher(EVP_aes_128_ctr());
    EVP_add_cipher(EVP_aes_128_gcm());
    EVP_add_cipher(EVP_aes_128_xts());
    EVP_add_cipher_alias(SN_aes_128_cbc, "AES128");
    EVP_add_cipher_alias(SN_aes_128_cbc, "aes128");
    EVP_add_cipher(EVP_aes_192_ecb());
    EVP_add_cipher(EVP_aes_192_cbc());
    EVP_add_cipher(EVP_aes_192_cfb());
    EVP_add_cipher(EVP_aes_192_cfb1());
    EVP_add_cipher(EVP_aes_192_cfb8());
    EVP_add_cipher(EVP_aes_192_ofb());
    EVP_add_cipher(EVP_aes_192_ctr());
    EVP_add_cipher(EVP_aes_192_gcm());
    EVP_add_cipher_alias(SN_aes_192_cbc, "AES192");
    EVP_add_cipher_alias(SN_aes_192_cbc, "aes192");
    EVP_add_cipher(EVP_aes_256_ecb());
    EVP_add_cipher(EVP_aes_256_cbc());
    EVP_add_cipher(EVP_aes_256_cfb());
    EVP_add_cipher(EVP_aes_256_cfb1());
    EVP_add_cipher(EVP_aes_256_cfb8());
    EVP_add_cipher(EVP_aes_256_ofb());
    EVP_add_cipher(EVP_aes_256_ctr());
    EVP_add_cipher(EVP_aes_256_gcm());
    EVP_add_cipher(EVP_aes_256_xts());
    EVP_add_cipher_alias(SN_aes_256_cbc, "AES256");
    EVP_add_cipher_alias(SN_aes_256_cbc, "aes256");
# if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA1)
    EVP_add_cipher(EVP_aes_128_cbc_hmac_sha1());
    EVP_add_cipher(EVP_aes_256_cbc_hmac_sha1());
# endif
#endif

#ifndef OPENSSL_NO_CAMELLIA
    EVP_add_cipher(EVP_camellia_128_ecb());
    EVP_add_cipher(EVP_camellia_128_cbc());
    EVP_add_cipher(EVP_camellia_128_cfb());
    EVP_add_cipher(EVP_camellia_128_cfb1());
    EVP_add_cipher(EVP_camellia_128_cfb8());
    EVP_add_cipher(EVP_camellia_128_ofb());
    EVP_add_cipher_alias(SN_camellia_128_cbc, "CAMELLIA128");
    EVP_add_cipher_alias(SN_camellia_128_cbc, "camellia128");
    EVP_add_cipher(EVP_camellia_192_ecb());
    EVP_add_cipher(EVP_camellia_192_cbc());
    EVP_add_cipher(EVP_camellia_192_cfb());
    EVP_add_cipher(EVP_camellia_192_cfb1());
    EVP_add_cipher(EVP_camellia_192_cfb8());
    EVP_add_cipher(EVP_camellia_192_ofb());
    EVP_add_cipher_alias(SN_camellia_192_cbc, "CAMELLIA192");
    EVP_add_cipher_alias(SN_camellia_192_cbc, "camellia192");
    EVP_add_cipher(EVP_camellia_256_ecb());
    EVP_add_cipher(EVP_camellia_256_cbc());
    EVP_add_cipher(EVP_camellia_256_cfb());
    EVP_add_cipher(EVP_camellia_256_cfb1());
    EVP_add_cipher(EVP_camellia_256_cfb8());
    EVP_add_cipher(EVP_camellia_256_ofb());
    EVP_add_cipher_alias(SN_camellia_256_cbc, "CAMELLIA256");
    EVP_add_cipher_alias(SN_camellia_256_cbc, "camellia256");
#endif
}

canonical_original_code:
void OpenSSL_add_all_ciphers()
{

#ifndef OPENSSL_NO_DES
    EVP_add_cipher(EVP_des_cfb());
    EVP_add_cipher(EVP_des_cfb1());
    EVP_add_cipher(EVP_des_cfb8());
    EVP_add_cipher(EVP_des_ede_cfb());
    EVP_add_cipher(EVP_des_ede3_cfb());
    EVP_add_cipher(EVP_des_ede3_cfb1());
    EVP_add_cipher(EVP_des_ede3_cfb8());

    EVP_add_cipher(EVP_des_ofb());
    EVP_add_cipher(EVP_des_ede_ofb());
    EVP_add_cipher(EVP_des_ede3_ofb());

    EVP_add_cipher(EVP_desx_cbc());
    EVP_add_cipher_alias(SN_desx_cbc, "DESX");
    EVP_add_cipher_alias(SN_desx_cbc, "desx");

    EVP_add_cipher(EVP_des_cbc());
    EVP_add_cipher_alias(SN_des_cbc, "DES");
    EVP_add_cipher_alias(SN_des_cbc, "des");
    EVP_add_cipher(EVP_des_ede_cbc());
    EVP_add_cipher(EVP_des_ede3_cbc());
    EVP_add_cipher_alias(SN_des_ede3_cbc, "DES3");
    EVP_add_cipher_alias(SN_des_ede3_cbc, "des3");

    EVP_add_cipher(EVP_des_ecb());
    EVP_add_cipher(EVP_des_ede());
    EVP_add_cipher(EVP_des_ede3());
#endif

#ifndef OPENSSL_NO_RC4
    EVP_add_cipher(EVP_rc4());
    EVP_add_cipher(EVP_rc4_40());
# ifndef OPENSSL_NO_MD5
    EVP_add_cipher(EVP_rc4_hmac_md5());
# endif
#endif

#ifndef OPENSSL_NO_IDEA
    EVP_add_cipher(EVP_idea_ecb());
    EVP_add_cipher(EVP_idea_cfb());
    EVP_add_cipher(EVP_idea_ofb());
    EVP_add_cipher(EVP_idea_cbc());
    EVP_add_cipher_alias(SN_idea_cbc, "IDEA");
    EVP_add_cipher_alias(SN_idea_cbc, "idea");
#endif

#ifndef OPENSSL_NO_SEED
    EVP_add_cipher(EVP_seed_ecb());
    EVP_add_cipher(EVP_seed_cfb());
    EVP_add_cipher(EVP_seed_ofb());
    EVP_add_cipher(EVP_seed_cbc());
    EVP_add_cipher_alias(SN_seed_cbc, "SEED");
    EVP_add_cipher_alias(SN_seed_cbc, "seed");
#endif

#ifndef OPENSSL_NO_RC2
    EVP_add_cipher(EVP_rc2_ecb());
    EVP_add_cipher(EVP_rc2_cfb());
    EVP_add_cipher(EVP_rc2_ofb());
    EVP_add_cipher(EVP_rc2_cbc());
    EVP_add_cipher(EVP_rc2_40_cbc());
    EVP_add_cipher(EVP_rc2_64_cbc());
    EVP_add_cipher_alias(SN_rc2_cbc, "RC2");
    EVP_add_cipher_alias(SN_rc2_cbc, "rc2");
#endif

#ifndef OPENSSL_NO_BF
    EVP_add_cipher(EVP_bf_ecb());
    EVP_add_cipher(EVP_bf_cfb());
    EVP_add_cipher(EVP_bf_ofb());
    EVP_add_cipher(EVP_bf_cbc());
    EVP_add_cipher_alias(SN_bf_cbc, "BF");
    EVP_add_cipher_alias(SN_bf_cbc, "bf");
    EVP_add_cipher_alias(SN_bf_cbc, "blowfish");
#endif

#ifndef OPENSSL_NO_CAST
    EVP_add_cipher(EVP_cast5_ecb());
    EVP_add_cipher(EVP_cast5_cfb());
    EVP_add_cipher(EVP_cast5_ofb());
    EVP_add_cipher(EVP_cast5_cbc());
    EVP_add_cipher_alias(SN_cast5_cbc, "CAST");
    EVP_add_cipher_alias(SN_cast5_cbc, "cast");
    EVP_add_cipher_alias(SN_cast5_cbc, "CAST-cbc");
    EVP_add_cipher_alias(SN_cast5_cbc, "cast-cbc");
#endif

#ifndef OPENSSL_NO_RC5
    EVP_add_cipher(EVP_rc5_32_12_16_ecb());
    EVP_add_cipher(EVP_rc5_32_12_16_cfb());
    EVP_add_cipher(EVP_rc5_32_12_16_ofb());
    EVP_add_cipher(EVP_rc5_32_12_16_cbc());
    EVP_add_cipher_alias(SN_rc5_cbc, "rc5");
    EVP_add_cipher_alias(SN_rc5_cbc, "RC5");
#endif

#ifndef OPENSSL_NO_AES
    EVP_add_cipher(EVP_aes_128_ecb());
    EVP_add_cipher(EVP_aes_128_cbc());
    EVP_add_cipher(EVP_aes_128_cfb());
    EVP_add_cipher(EVP_aes_128_cfb1());
    EVP_add_cipher(EVP_aes_128_cfb8());
    EVP_add_cipher(EVP_aes_128_ofb());
    EVP_add_cipher(EVP_aes_128_ctr());
    EVP_add_cipher(EVP_aes_128_gcm());
    EVP_add_cipher(EVP_aes_128_xts());
    EVP_add_cipher_alias(SN_aes_128_cbc, "AES128");
    EVP_add_cipher_alias(SN_aes_128_cbc, "aes128");
    EVP_add_cipher(EVP_aes_192_ecb());
    EVP_add_cipher(EVP_aes_192_cbc());
    EVP_add_cipher(EVP_aes_192_cfb());
    EVP_add_cipher(EVP_aes_192_cfb1());
    EVP_add_cipher(EVP_aes_192_cfb8());
    EVP_add_cipher(EVP_aes_192_ofb());
    EVP_add_cipher(EVP_aes_192_ctr());
    EVP_add_cipher(EVP_aes_192_gcm());
    EVP_add_cipher_alias(SN_aes_192_cbc, "AES192");
    EVP_add_cipher_alias(SN_aes_192_cbc, "aes192");
    EVP_add_cipher(EVP_aes_256_ecb());
    EVP_add_cipher(EVP_aes_256_cbc());
    EVP_add_cipher(EVP_aes_256_cfb());
    EVP_add_cipher(EVP_aes_256_cfb1());
    EVP_add_cipher(EVP_aes_256_cfb8());
    EVP_add_cipher(EVP_aes_256_ofb());
    EVP_add_cipher(EVP_aes_256_ctr());
    EVP_add_cipher(EVP_aes_256_gcm());
    EVP_add_cipher(EVP_aes_256_xts());
    EVP_add_cipher_alias(SN_aes_256_cbc, "AES256");
    EVP_add_cipher_alias(SN_aes_256_cbc, "aes256");
# if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA1)
    EVP_add_cipher(EVP_aes_128_cbc_hmac_sha1());
    EVP_add_cipher(EVP_aes_256_cbc_hmac_sha1());
# endif
#endif

#ifndef OPENSSL_NO_CAMELLIA
    EVP_add_cipher(EVP_camellia_128_ecb());
    EVP_add_cipher(EVP_camellia_128_cbc());
    EVP_add_cipher(EVP_camellia_128_cfb());
    EVP_add_cipher(EVP_camellia_128_cfb1());
    EVP_add_cipher(EVP_camellia_128_cfb8());
    EVP_add_cipher(EVP_camellia_128_ofb());
    EVP_add_cipher_alias(SN_camellia_128_cbc, "CAMELLIA128");
    EVP_add_cipher_alias(SN_camellia_128_cbc, "camellia128");
    EVP_add_cipher(EVP_camellia_192_ecb());
    EVP_add_cipher(EVP_camellia_192_cbc());
    EVP_add_cipher(EVP_camellia_192_cfb());
    EVP_add_cipher(EVP_camellia_192_cfb1());
    EVP_add_cipher(EVP_camellia_192_cfb8());
    EVP_add_cipher(EVP_camellia_192_ofb());
    EVP_add_cipher_alias(SN_camellia_192_cbc, "CAMELLIA192");
    EVP_add_cipher_alias(SN_camellia_192_cbc, "camellia192");
    EVP_add_cipher(EVP_camellia_256_ecb());
    EVP_add_cipher(EVP_camellia_256_cbc());
    EVP_add_cipher(EVP_camellia_256_cfb());
    EVP_add_cipher(EVP_camellia_256_cfb1());
    EVP_add_cipher(EVP_camellia_256_cfb8());
    EVP_add_cipher(EVP_camellia_256_ofb());
    EVP_add_cipher_alias(SN_camellia_256_cbc, "CAMELLIA256");
    EVP_add_cipher_alias(SN_camellia_256_cbc, "camellia256");
#endif
}

return_type: void


writeError

decompiled_code:
void __noreturn writeError()
{
fprintf(stderr, "%s: I/O error reading `%s', possible reason follows.\n", progName, &inFileName);
perror(progName);
fprintf(stderr, "%s: warning: output file(s) may be incomplete.\n", progName);
exit(1);
}

canonical_decompiled_code:
void __noreturn func0()
{
fprintf(stderr, "%s: I/O error reading `%s', possible reason follows.\n", progName, &inFileName);
perror(progName);
fprintf(stderr, "%s: warning: output file(s) may be incomplete.\n", progName);
exit(1);
}

original_code:
static void writeError ( void )
{
   fprintf ( stderr,
             "%s: I/O error reading `%s', possible reason follows.\n",
            progName, inFileName );
   perror ( progName );
   fprintf ( stderr, "%s: warning: output file(s) may be incomplete.\n",
             progName );
   exit ( 1 );
}

canonical_original_code:
static void writeError()
{
   fprintf ( stderr,
             "%s: I/O error reading `%s', possible reason follows.\n",
            progName, inFileName );
   perror ( progName );
   fprintf ( stderr, "%s: warning: output file(s) may be incomplete.\n",
             progName );
   exit ( 1 );
}


decompiled_code:
int __fastcall bsPutUInt32(__int64 a1, unsigned int a2)
{
int v2; // ebx
int result; // eax

v2 = 31;
do
result = bsPutBit(a1, (a2 >> v2) & 1);
while ( v2-- != 0 );
return result;
}

canonical_decompiled_code:
int __fastcall func3(__int64 a1, unsigned int a2)
{
int v2; // ebx
int result; // eax

v2 = 31;
do
result = func2(a1, (a2 >> v2) & 1);
while ( v2-- != 0 );
return result;
}

original_code:
static
void bsPutUInt32 ( EState* s, UInt32 u )
{
   bsW ( s, 8, (u >> 24) & 0xffL );
   bsW ( s, 8, (u >> 16) & 0xffL );
   bsW ( s, 8, (u >> 8) & 0xffL );
   bsW ( s, 8, u & 0xffL );
}

canonical_original_code:
static void bsPutUInt32(struct EState *s, unsigned int u)
{
   bsW ( s, 8, (u >> 24) & 0xffL );
   bsW ( s, 8, (u >> 16) & 0xffL );
   bsW ( s, 8, (u >> 8) & 0xffL );
   bsW ( s, 8, u & 0xffL );
}

variable_types: struct EState { struct bz_stream { char *next_in; unsigned int avail_in; unsigned int total_in_lo32; unsigned int total_in_hi32; char *next_out; unsigned int avail_out; unsigned int total_out_lo32; unsigned int total_out_hi32; void *state; void *(*bzalloc)(void *, int, int); void (*bzfree)(void *, void *); void *opaque; } *strm; int mode; int state; unsigned int avail_in_expect; unsigned int *arr1; unsigned int *arr2; unsigned int *ftab; int origPtr; unsigned int *ptr; unsigned char *block; unsigned short *mtfv; unsigned char *zbits; int workFactor; unsigned int state_in_ch; int state_in_len; int rNToGo; int rTPos; int nblock; int nblockMAX; int numZ; int state_out_pos; int nInUse; unsigned char inUse[256]; unsigned char unseqToSeq[256]; unsigned int bsBuff; int bsLive; unsigned int blockCRC; unsigned int combinedCRC; int verbosity; int blockNo; int blockSize100k; int nMTF; int mtfFreq[258]; unsigned char selector[-1]; unsigned char selectorMtf[-1]; unsigned char len[6][258]; int code[6][258]; int rfreq[6][258]; unsigned int len_pack[258][4]; } *

variable_types:
u
unsigned int

user_defined_types: struct EState { struct bz_stream *strm; int mode; int state; unsigned int avail_in_expect; unsigned int *arr1; unsigned int *arr2; unsigned int *ftab; int origPtr; unsigned int *ptr; unsigned char *block; unsigned short *mtfv; unsigned char *zbits; int workFactor; unsigned int state_in_ch; int state_in_len; int rNToGo; int rTPos; int nblock; int nblockMAX; int numZ; int state_out_pos; int nInUse; unsigned char inUse[256]; unsigned char unseqToSeq[256]; unsigned int bsBuff; int bsLive; unsigned int blockCRC; unsigned int combinedCRC; int verbosity; int blockNo; int blockSize100k; int nMTF; int mtfFreq[258]; unsigned char selector[-1]; unsigned char selectorMtf[-1]; unsigned char len[6][258]; int code[6][258]; int rfreq[6][258]; unsigned int len_pack[258][4]; }


bsPutUChar

decompiled_code:
int __fastcall bsPutUChar(__int64 a1, unsigned __int8 a2)
{
int v2; // ebx
int result; // eax

v2 = 7;
do
result = bsPutBit(a1, (a2 >> v2) & 1);
while ( v2-- != 0 );
return result;
}

canonical_decompiled_code:
int __fastcall func4(__int64 a1, unsigned __int8 a2)
{
int v2; // ebx
int result; // eax

v2 = 7;
do
result = func2(a1, (a2 >> v2) & 1);
while ( v2-- != 0 );
return result;
}

original_code:
static
void bsPutUChar ( EState* s, UChar c )
{
   bsW( s, 8, (UInt32)c );
}

canonical_original_code:
static void bsPutUChar(struct EState *s, unsigned char c)
{
   bsW( s, 8, (unsigned int)c );
}

variable_types:
c
unsigned char

user_defined_types: struct bz_stream { char *next_in; unsigned int avail_in; unsigned int total_in_lo32; unsigned int total_in_hi32; char *next_out; unsigned int avail_out; unsigned int total_out_lo32; unsigned int total_out_hi32; void *state; void *(*bzalloc)(void *, int, int); void (*bzfree)(void *, void *); void *opaque; }


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

result = sk_pop_free(ext_list, ext_list_free);
ext_list = 0LL;
return result;
}

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

result = sk_pop_free(ext_list, ext_list_free);
ext_list = 0LL;
return result;
}

original_code:
void X509V3_EXT_cleanup(void)
{
    sk_X509V3_EXT_METHOD_pop_free(ext_list, ext_list_free);
    ext_list = NULL;
}

canonical_original_code:
void X509V3_EXT_cleanup()
{
    sk_X509V3_EXT_METHOD_pop_free(ext_list, ext_list_free);
    ext_list = NULL;
}


decompiled_code:
__int64 X509V3_add_standard_extensions()
{
return 1LL;
}

canonical_decompiled_code:
__int64 func10()
{
return 1LL;
}

original_code:
int X509V3_add_standard_extensions(void)
{
    return 1;
}

canonical_original_code:
int X509V3_add_standard_extensions()
{
    return 1;
}

return_type: int


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

result = ERR_func_error_string(X509V3_str_functs);
if ( !result )
{
ERR_load_strings(0LL, &X509V3_str_functs);
result = ERR_load_strings(0LL, &X509V3_str_reasons);
}
return result;
}

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

result = ERR_func_error_string(X509V3_str_functs);
if ( !result )
{
ERR_load_strings(0LL, &X509V3_str_functs);
result = ERR_load_strings(0LL, &X509V3_str_reasons);
}
return result;
}

original_code:
void ERR_load_X509V3_strings(void)
{
#ifndef OPENSSL_NO_ERR

    if (ERR_func_error_string(X509V3_str_functs[0].error) == NULL) {
        ERR_load_strings(0, X509V3_str_functs);
        ERR_load_strings(0, X509V3_str_reasons);
    }
#endif
}

canonical_original_code:
void ERR_load_X509V3_strings()
{
#ifndef OPENSSL_NO_ERR

    if (ERR_func_error_string(X509V3_str_functs[0].error) == NULL) {
        ERR_load_strings(0, X509V3_str_functs);
        ERR_load_strings(0, X509V3_str_reasons);
    }
#endif
}


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

result = ERR_func_error_string(EVP_str_functs);
if ( !result )
{
ERR_load_strings(0LL, &EVP_str_functs);
result = ERR_load_strings(0LL, &EVP_str_reasons);
}
return result;
}

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

result = ERR_func_error_string(EVP_str_functs);
if ( !result )
{
ERR_load_strings(0LL, &EVP_str_functs);
result = ERR_load_strings(0LL, &EVP_str_reasons);
}
return result;
}

original_code:
void ERR_load_EVP_strings(void)
{
#ifndef OPENSSL_NO_ERR

    if (ERR_func_error_string(EVP_str_functs[0].error) == NULL) {
        ERR_load_strings(0, EVP_str_functs);
        ERR_load_strings(0, EVP_str_reasons);
    }
#endif
}

canonical_original_code:
void ERR_load_EVP_strings()
{
#ifndef OPENSSL_NO_ERR

    if (ERR_func_error_string(EVP_str_functs[0].error) == NULL) {
        ERR_load_strings(0, EVP_str_functs);
        ERR_load_strings(0, EVP_str_reasons);
    }
#endif
}


decompiled_code:
__int64 __fastcall swap_bytes(__int64 a1, __int64 a2)
{
int i; // ecx
__int64 result; // rax

for ( i = 0; i != 4; ++i )
{
for ( result = 0LL; result != 8; ++result )
*(_BYTE *)(a2 + 4 * result) = *(_BYTE *)(a1 + result);
a1 += 8LL;
++a2;
}
return result;
}

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

for ( i = 0; i != 4; ++i )
{
for ( result = 0LL; result != 8; ++result )
*(_BYTE *)(a2 + 4 * result) = *(_BYTE *)(a1 + result);
a1 += 8LL;
++a2;
}
return result;
}

original_code:
static void swap_bytes(byte * w, byte * k)
{
    int i, j;
    for (i = 0; i < 4; i++)
        for (j = 0; j < 8; j++)
            k[i + 4 * j] = w[8 * i + j];
}

canonical_original_code:
static void swap_bytes(unsigned char *w, unsigned char *k)
{
    int i; int j;
    for (i = 0; i < 4; i++)
        for (j = 0; j < 8; j++)
            k[i + 4 * j] = w[8 * i + j];
}

variable_types:
w
unsigned char *

variable_types:
k
unsigned char *

variable_types: i int

variable_types: j int


decompiled_code:
__int64 __fastcall circle_xor8(__int64 *a1, void *a2)
{
_BYTE *v2; // rcx
__int64 result; // rax
__int64 v4[2]; // [rsp+8h] [rbp-10h]

v4[0] = *a1;
v2 = memmove(a2, a1 + 1, 0x18uLL);
for ( result = 0LL; result != 8; ++result )
v2[result + 24] = v2[result] ^ *((_BYTE *)v4 + result);
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 *a1, void *a2)
{
_BYTE *v2; // rcx
__int64 result; // rax
__int64 v4[2]; // [rsp+8h] [rbp-10h]

v4[0] = *a1;
v2 = memmove(a2, a1 + 1, 0x18uLL);
for ( result = 0LL; result != 8; ++result )
v2[result + 24] = v2[result] ^ *((_BYTE *)v4 + result);
return result;
}

original_code:
static void circle_xor8(const byte * w, byte * k)
{
    byte buf[8];
    int i;
    memcpy(buf, w, 8);
    memmove(k, w + 8, 24);
    for (i = 0; i < 8; i++)
        k[i + 24] = buf[i] ^ k[i];
}

canonical_original_code:
static void circle_xor8(unsigned char *w, unsigned char *k)
{
    unsigned char buf[8];
    int i;
    memcpy(buf, w, 8);
    memmove(k, w + 8, 24);
    for (i = 0; i < 8; i++)
        k[i + 24] = buf[i] ^ k[i];
}

variable_types:
buf
unsigned char [8]


decompiled_code:
__int64 __fastcall init_gost_hash_ctx(__int64 a1, __int64 a2)
{
__int64 v3; // rdi
void *v4; // rax

v3 = a1 + 8;
*(_QWORD *)(v3 - 8) = 0LL;
*(_QWORD *)(v3 + 104) = 0LL;
memset(
(void *)(v3 & 0xFFFFFFFFFFFFFFF8LL),
0,
8 * ((unsigned __int64)((unsigned int)a1 - (v3 & 0xFFFFFFF8) + 120) >> 3));
v4 = malloc(0x1020uLL);
*(_QWORD *)(a1 + 8) = v4;
if ( !v4 )
return 0LL;
gost_init(v4, a2);
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1, __int64 a2)
{
__int64 v3; // rdi
void *v4; // rax

v3 = a1 + 8;
*(_QWORD *)(v3 - 8) = 0LL;
*(_QWORD *)(v3 + 104) = 0LL;
memset(
(void *)(v3 & 0xFFFFFFFFFFFFFFF8LL),
0,
8 * ((unsigned __int64)((unsigned int)a1 - (v3 & 0xFFFFFFF8) + 120) >> 3));
v4 = malloc(0x1020uLL);
*(_QWORD *)(a1 + 8) = v4;
if ( !v4 )
return 0LL;
gost_init(v4, a2);
return 1LL;
}

original_code:
int init_gost_hash_ctx(gost_hash_ctx * ctx,
                       const gost_subst_block * subst_block)
{
    memset(ctx, 0, sizeof(gost_hash_ctx));
    ctx->cipher_ctx = (gost_ctx *) malloc(sizeof(gost_ctx));
    if (!ctx->cipher_ctx) {
        return 0;
    }
    gost_init(ctx->cipher_ctx, subst_block);
    return 1;
}

canonical_original_code:
int init_gost_hash_ctx(struct gost_hash_ctx *ctx, struct gost_subst_block *subst_block)
{
    memset(ctx, 0, sizeof(gost_hash_ctx));
    ctx->cipher_ctx = (struct gost_ctx *) malloc(sizeof(gost_ctx));
    if (!ctx->cipher_ctx) {
        return 0;
    }
    gost_init(ctx->cipher_ctx, subst_block);
    return 1;
}

variable_types: struct gost_hash_ctx { long long len; struct gost_ctx { unsigned int k[8]; unsigned int k87[256]; } *cipher_ctx; int left; unsigned char H[32]; unsigned char S[32]; unsigned char remainder[32]; } *

variable_types: struct gost_subst_block { unsigned char k8[16]; unsigned char k7[16]; unsigned char k6[16]; unsigned char k5[16]; unsigned char k4[16]; unsigned char k3[16]; unsigned char k2[16]; unsigned char k1[16]; } *

user_defined_types: struct gost_hash_ctx { long long len; struct gost_ctx *cipher_ctx; int left; unsigned char H[32]; unsigned char S[32]; unsigned char remainder[32]; }


decompiled_code:
void __fastcall done_gost_hash_ctx(__int64 a1)
{
free(*(void **)(a1 + 8));
}

canonical_decompiled_code:
void __fastcall func5(__int64 a1)
{
free(*(void **)(a1 + 8));
}

original_code:
void done_gost_hash_ctx(gost_hash_ctx * ctx)
{
    free(ctx->cipher_ctx);
}

canonical_original_code:
void done_gost_hash_ctx(struct gost_hash_ctx *ctx)
{
    free(ctx->cipher_ctx);
}

user_defined_types: struct gost_ctx { unsigned int k[8]; unsigned int k87[256]; }


original_code:
int start_hash(gost_hash_ctx * ctx)
{
    if (!ctx->cipher_ctx)
        return 0;
    memset(&(ctx->H), 0, 32);
    memset(&(ctx->S), 0, 32);
    ctx->len = 0L;
    ctx->left = 0;
    return 1;
}

canonical_original_code:
int start_hash(struct gost_hash_ctx *ctx)
{
    if (!ctx->cipher_ctx)
        return 0;
    memset(&(ctx->H), 0, 32);
    memset(&(ctx->S), 0, 32);
    ctx->len = 0L;
    ctx->left = 0;
    return 1;
}


original_code:
int hash_block(gost_hash_ctx * ctx, const byte * block, size_t length)
{
    if (ctx->left) {
        unsigned int add_bytes = 32 - ctx->left;
        if (add_bytes > length) {
            add_bytes = length;
        }
        memcpy(&(ctx->remainder[ctx->left]), block, add_bytes);
        ctx->left += add_bytes;
        if (ctx->left < 32) {
            return 1;
        }
        block += add_bytes;
        length -= add_bytes;
        hash_step(ctx->cipher_ctx, ctx->H, ctx->remainder);
        add_blocks(32, ctx->S, ctx->remainder);
        ctx->len += 32;
        ctx->left = 0;
    }
    while (length >= 32) {
        hash_step(ctx->cipher_ctx, ctx->H, block);
        add_blocks(32, ctx->S, block);
        ctx->len += 32;
        block += 32;
        length -= 32;
    }
    if (length) {
        memcpy(ctx->remainder, block, ctx->left = length);
    }
    return 1;
}

canonical_original_code:
int hash_block(struct gost_hash_ctx *ctx, unsigned char *block, unsigned long length)
{
    if (ctx->left) {
        unsigned int add_bytes = 32 - ctx->left;
        if (add_bytes > length) {
            add_bytes = length;
        }
        memcpy(&(ctx->remainder[ctx->left]), block, add_bytes);
        ctx->left += add_bytes;
        if (ctx->left < 32) {
            return 1;
        }
        block += add_bytes;
        length -= add_bytes;
        hash_step(ctx->cipher_ctx, ctx->H, ctx->remainder);
        add_blocks(32, ctx->S, ctx->remainder);
        ctx->len += 32;
        ctx->left = 0;
    }
    while (length >= 32) {
        hash_step(ctx->cipher_ctx, ctx->H, block);
        add_blocks(32, ctx->S, block);
        ctx->len += 32;
        block += 32;
        length -= 32;
    }
    if (length) {
        memcpy(ctx->remainder, block, ctx->left = length);
    }
    return 1;
}

variable_types:
block
unsigned char *

variable_types:
length
unsigned long


original_code:
int finish_hash(gost_hash_ctx * ctx, byte * hashval)
{
    byte buf[32];
    byte H[32];
    byte S[32];
    ghosthash_len fin_len = ctx->len;
    byte *bptr;
    memcpy(H, ctx->H, 32);
    memcpy(S, ctx->S, 32);
    if (ctx->left) {
        memset(buf, 0, 32);
        memcpy(buf, ctx->remainder, ctx->left);
        hash_step(ctx->cipher_ctx, H, buf);
        add_blocks(32, S, buf);
        fin_len += ctx->left;
    }
    memset(buf, 0, 32);
    bptr = buf;
    fin_len <<= 3;
    while (fin_len > 0) {
        *(bptr++) = (byte) (fin_len & 0xFF);
        fin_len >>= 8;
    };
    hash_step(ctx->cipher_ctx, H, buf);
    hash_step(ctx->cipher_ctx, H, S);
    memcpy(hashval, H, 32);
    return 1;
}

canonical_original_code:
int finish_hash(struct gost_hash_ctx *ctx, unsigned char *hashval)
{
    unsigned char buf[32];
    unsigned char H[32];
    unsigned char S[32];
    long long fin_len = ctx->len;
    unsigned char *bptr;
    memcpy(H, ctx->H, 32);
    memcpy(S, ctx->S, 32);
    if (ctx->left) {
        memset(buf, 0, 32);
        memcpy(buf, ctx->remainder, ctx->left);
        hash_step(ctx->cipher_ctx, H, buf);
        add_blocks(32, S, buf);
        fin_len += ctx->left;
    }
    memset(buf, 0, 32);
    bptr = buf;
    fin_len <<= 3;
    while (fin_len > 0) {
        *(bptr++) = (byte) (fin_len & 0xFF);
        fin_len >>= 8;
    };
    hash_step(ctx->cipher_ctx, H, buf);
    hash_step(ctx->cipher_ctx, H, S);
    memcpy(hashval, H, 32);
    return 1;
}

variable_types:
hashval
unsigned char *

variable_types:
buf
unsigned char [32]

variable_types:
H
unsigned char [32]

variable_types:
S
unsigned char [32]

variable_types:
bptr
unsigned char *


decompiled_code:
__int64 __fastcall RAND_egd(char *a1)
{
return RAND_egd_bytes(a1, 255);
}

canonical_decompiled_code:
__int64 __fastcall func2(char *a1)
{
return func1(a1, 255);
}

original_code: char RAND_egd(void) {return 0;}

canonical_original_code: char RAND_egd() {return 0;}

return_type: char


decompiled_code:
// attributes: thunk
void *default_malloc_ex(size_t size)
{
return malloc_func(size);
}

canonical_decompiled_code:
void *func0(size_t size)
{
return malloc_func(size);
}

original_code:
static void *default_malloc_ex(size_t num, const char *file, int line)
{
    return malloc_func(num);
}

canonical_original_code:
static void *default_malloc_ex(unsigned long num, char *file, int line)
{
    return malloc_func(num);
}

variable_types:
num
unsigned long

variable_types:
file
char *

variable_types: line int

return_type: void *


decompiled_code:
// attributes: thunk
void *default_realloc_ex(void *ptr, size_t size)
{
return realloc_func(ptr, size);
}

canonical_decompiled_code:
void *func1(void *ptr, size_t size)
{
return realloc_func(ptr, size);
}

original_code:
static void *default_realloc_ex(void *str, size_t num,
                                const char *file, int line)
{
    return realloc_func(str, num);
}

canonical_original_code:
static void *default_realloc_ex(void *str, unsigned long num, char *file, int line)
{
    return realloc_func(str, num);
}

variable_types:
str
void *


decompiled_code:
// attributes: thunk
void *default_malloc_locked_ex(size_t size)
{
return malloc_locked_func(size);
}

canonical_decompiled_code:
void *func2(size_t size)
{
return malloc_locked_func(size);
}

original_code:
static void *default_malloc_locked_ex(size_t num, const char *file, int line)
{
    return malloc_locked_func(num);
}

canonical_original_code:
static void *default_malloc_locked_ex(unsigned long num, char *file, int line)
{
    return malloc_locked_func(num);
}


decompiled_code:
__int64 __fastcall CRYPTO_set_mem_functions(void *(*a1)(size_t size), void *(*a2)(void *ptr, size_t size), void *a3)
{
__int64 result; // rax

OPENSSL_init();
result = (unsigned int)allow_customize;
if ( allow_customize )
{
if ( a2 == 0LL || a1 == 0LL || !a3 )
{
result = 0LL;
}
else
{
malloc_func = a1;
result = 1LL;
malloc_ex_func = (__int64 (__fastcall *)())default_malloc_ex;
realloc_func = a2;
realloc_ex_func = (__int64 (__fastcall *)())default_realloc_ex;
free_func = a3;
malloc_locked_func = a1;
malloc_locked_ex_func = (__int64 (__fastcall *)())default_malloc_locked_ex;
free_locked_func = a3;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func3(void *(*a1)(size_t size), void *(*a2)(void *ptr, size_t size), void *a3)
{
__int64 result; // rax

OPENSSL_init();
result = (unsigned int)allow_customize;
if ( allow_customize )
{
if ( a2 == 0LL || a1 == 0LL || !a3 )
{
result = 0LL;
}
else
{
malloc_func = a1;
result = 1LL;
malloc_ex_func = (__int64 (__fastcall *)())default_malloc_ex;
realloc_func = a2;
realloc_ex_func = (__int64 (__fastcall *)())default_realloc_ex;
free_func = a3;
malloc_locked_func = a1;
malloc_locked_ex_func = (__int64 (__fastcall *)())default_malloc_locked_ex;
free_locked_func = a3;
}
}
return result;
}

original_code:
int CRYPTO_set_mem_functions(void *(*m) (size_t), void *(*r) (void *, size_t),
                             void (*f) (void *))
{
    OPENSSL_init();
    if (!allow_customize)
        return 0;
    if ((m == 0) || (r == 0) || (f == 0))
        return 0;
    malloc_func = m;
    malloc_ex_func = default_malloc_ex;
    realloc_func = r;
    realloc_ex_func = default_realloc_ex;
    free_func = f;
    malloc_locked_func = m;
    malloc_locked_ex_func = default_malloc_locked_ex;
    free_locked_func = f;
    return 1;
}

canonical_original_code:
int CRYPTO_set_mem_functions(void *(*m)(unsigned long), void *(*r)(void *, unsigned long), void (*f)(void *))
{
    OPENSSL_init();
    if (!allow_customize)
        return 0;
    if ((m == 0) || (r == 0) || (f == 0))
        return 0;
    malloc_func = m;
    malloc_ex_func = default_malloc_ex;
    realloc_func = r;
    realloc_ex_func = default_realloc_ex;
    free_func = f;
    malloc_locked_func = m;
    malloc_locked_ex_func = default_malloc_locked_ex;
    free_locked_func = f;
    return 1;
}

variable_types:
m
void *(*)(unsigned long)

variable_types:
r
void *(*)(void *, unsigned long)

variable_types:
f
void (*)(void *)


decompiled_code:
__int64 __fastcall CRYPTO_set_mem_ex_functions(__int64 (__fastcall *a1)(), __int64 (__fastcall *a2)(), void *a3)
{
__int64 result; // rax

result = (unsigned int)allow_customize;
if ( allow_customize )
{
if ( a2 == 0LL || a1 == 0LL || !a3 )
{
result = 0LL;
}
else
{
malloc_func = 0LL;
result = 1LL;
malloc_ex_func = a1;
realloc_func = 0LL;
realloc_ex_func = a2;
free_func = a3;
malloc_locked_func = 0LL;
malloc_locked_ex_func = a1;
free_locked_func = a3;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 (__fastcall *a1)(), __int64 (__fastcall *a2)(), void *a3)
{
__int64 result; // rax

result = (unsigned int)allow_customize;
if ( allow_customize )
{
if ( a2 == 0LL || a1 == 0LL || !a3 )
{
result = 0LL;
}
else
{
malloc_func = 0LL;
result = 1LL;
malloc_ex_func = a1;
realloc_func = 0LL;
realloc_ex_func = a2;
free_func = a3;
malloc_locked_func = 0LL;
malloc_locked_ex_func = a1;
free_locked_func = a3;
}
}
return result;
}

original_code:
int CRYPTO_set_mem_ex_functions(void *(*m) (size_t, const char *, int),
                                void *(*r) (void *, size_t, const char *,
                                            int), void (*f) (void *))
{
    if (!allow_customize)
        return 0;
    if ((m == 0) || (r == 0) || (f == 0))
        return 0;
    malloc_func = 0;
    malloc_ex_func = m;
    realloc_func = 0;
    realloc_ex_func = r;
    free_func = f;
    malloc_locked_func = 0;
    malloc_locked_ex_func = m;
    free_locked_func = f;
    return 1;
}

canonical_original_code:
int CRYPTO_set_mem_ex_functions(void *(*m)(unsigned long, char *, int), void *(*r)(void *, unsigned long, char *, int), void (*f)(void *))
{
    if (!allow_customize)
        return 0;
    if ((m == 0) || (r == 0) || (f == 0))
        return 0;
    malloc_func = 0;
    malloc_ex_func = m;
    realloc_func = 0;
    realloc_ex_func = r;
    free_func = f;
    malloc_locked_func = 0;
    malloc_locked_ex_func = m;
    free_locked_func = f;
    return 1;
}

variable_types:
m
void *(*)(unsigned long, char *, int)

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


decompiled_code:
__int64 __fastcall CRYPTO_set_locked_mem_functions(void *(*a1)(size_t size), void *a2)
{
__int64 result; // rax

result = (unsigned int)allow_customize;
if ( allow_customize )
{
if ( a1 && a2 )
{
malloc_locked_func = a1;
result = 1LL;
malloc_locked_ex_func = (__int64 (__fastcall *)())default_malloc_locked_ex;
free_locked_func = a2;
}
else
{
result = 0LL;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func5(void *(*a1)(size_t size), void *a2)
{
__int64 result; // rax

result = (unsigned int)allow_customize;
if ( allow_customize )
{
if ( a1 && a2 )
{
malloc_locked_func = a1;
result = 1LL;
malloc_locked_ex_func = (__int64 (__fastcall *)())default_malloc_locked_ex;
free_locked_func = a2;
}
else
{
result = 0LL;
}
}
return result;
}

original_code:
int CRYPTO_set_locked_mem_functions(void *(*m) (size_t), void (*f) (void *))
{
    if (!allow_customize)
        return 0;
    if ((m == ((void *)0)) || (f == ((void *)0)))
        return 0;
    malloc_locked_func = m;
    malloc_locked_ex_func = default_malloc_locked_ex;
    free_locked_func = f;
    return 1;
}

canonical_original_code:
int CRYPTO_set_locked_mem_functions(void *(*m)(unsigned long), void (*f)(void *))
{
    if (!allow_customize)
        return 0;
    if ((m == ((void *)0)) || (f == ((void *)0)))
        return 0;
    malloc_locked_func = m;
    malloc_locked_ex_func = default_malloc_locked_ex;
    free_locked_func = f;
    return 1;
}


decompiled_code:
__int64 __fastcall CRYPTO_set_locked_mem_ex_functions(__int64 (__fastcall *a1)(), void *a2)
{
__int64 result; // rax

result = (unsigned int)allow_customize;
if ( allow_customize )
{
if ( a1 && a2 )
{
malloc_locked_func = 0LL;
result = 1LL;
malloc_locked_ex_func = a1;
free_func = a2;
}
else
{
result = 0LL;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 (__fastcall *a1)(), void *a2)
{
__int64 result; // rax

result = (unsigned int)allow_customize;
if ( allow_customize )
{
if ( a1 && a2 )
{
malloc_locked_func = 0LL;
result = 1LL;
malloc_locked_ex_func = a1;
free_func = a2;
}
else
{
result = 0LL;
}
}
return result;
}

original_code:
int CRYPTO_set_locked_mem_ex_functions(void *(*m) (size_t, const char *, int),
                                       void (*f) (void *))
{
    if (!allow_customize)
        return 0;
    if ((m == ((void *)0)) || (f == ((void *)0)))
        return 0;
    malloc_locked_func = 0;
    malloc_locked_ex_func = m;
    free_func = f;
    return 1;
}

canonical_original_code:
int CRYPTO_set_locked_mem_ex_functions(void *(*m)(unsigned long, char *, int), void (*f)(void *))
{
    if (!allow_customize)
        return 0;
    if ((m == ((void *)0)) || (f == ((void *)0)))
        return 0;
    malloc_locked_func = 0;
    malloc_locked_ex_func = m;
    free_func = f;
    return 1;
}


decompiled_code:
__int64 __fastcall CRYPTO_set_mem_debug_functions(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5)
{
__int64 result; // rax

result = (unsigned int)allow_customize_debug;
if ( allow_customize_debug )
{
OPENSSL_init();
malloc_debug_func = a1;
result = 1LL;
realloc_debug_func = a2;
free_debug_func = a3;
set_debug_options_func = a4;
get_debug_options_func = a5;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func7(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5)
{
__int64 result; // rax

result = (unsigned int)allow_customize_debug;
if ( allow_customize_debug )
{
OPENSSL_init();
malloc_debug_func = a1;
result = 1LL;
realloc_debug_func = a2;
free_debug_func = a3;
set_debug_options_func = a4;
get_debug_options_func = a5;
}
return result;
}

original_code:
int CRYPTO_set_mem_debug_functions(void (*m)
                                    (void *, int, const char *, int, int),
                                   void (*r) (void *, void *, int,
                                              const char *, int, int),
                                   void (*f) (void *, int), void (*so) (long),
                                   long (*go) (void))
{
    if (!allow_customize_debug)
        return 0;
    OPENSSL_init();
    malloc_debug_func = m;
    realloc_debug_func = r;
    free_debug_func = f;
    set_debug_options_func = so;
    get_debug_options_func = go;
    return 1;
}

canonical_original_code:
int CRYPTO_set_mem_debug_functions(void (*m)(void *, int, char *, int, int), void (*r)(void *, void *, int, char *, int, int), void (*f)(void *, int), void (*so)(long), long (*go)())
{
    if (!allow_customize_debug)
        return 0;
    OPENSSL_init();
    malloc_debug_func = m;
    realloc_debug_func = r;
    free_debug_func = f;
    set_debug_options_func = so;
    get_debug_options_func = go;
    return 1;
}

variable_types:
m
void (*)(void *, int, char *, int, int)

variable_types: void (*)(void *, void *, int, char *, int, int)

variable_types:
f
void (*)(void *, int)

variable_types:
so
void (*)(long)

variable_types:
go
long (*)()


decompiled_code:
void __fastcall CRYPTO_get_mem_functions(void *(**a1)(size_t size), void *(**a2)(void *ptr, size_t size), _QWORD *a3)
{
void *(*v3)(size_t); // rax
void *(*v4)(void *, size_t); // rax

if ( a1 )
{
v3 = 0LL;
if ( !malloc_ex_func )
v3 = malloc_func;
*a1 = v3;
}
if ( a2 )
{
v4 = 0LL;
if ( (char *)realloc_ex_func == (char *)default_realloc_ex )
v4 = realloc_func;
*a2 = v4;
}
if ( a3 )
*a3 = free_func;
}

canonical_decompiled_code:
void __fastcall func8(void *(**a1)(size_t size), void *(**a2)(void *ptr, size_t size), _QWORD *a3)
{
void *(*v3)(size_t); // rax
void *(*v4)(void *, size_t); // rax

if ( a1 )
{
v3 = 0LL;
if ( !malloc_ex_func )
v3 = malloc_func;
*a1 = v3;
}
if ( a2 )
{
v4 = 0LL;
if ( (char *)realloc_ex_func == (char *)default_realloc_ex )
v4 = realloc_func;
*a2 = v4;
}
if ( a3 )
*a3 = free_func;
}

original_code:
void CRYPTO_get_mem_functions(void *(**m) (size_t),
                              void *(**r) (void *, size_t),
                              void (**f) (void *))
{
    if (m != ((void *)0))
        *m = (malloc_ex_func == default_malloc_ex) ? malloc_func : 0;
    if (r != ((void *)0))
        *r = (realloc_ex_func == default_realloc_ex) ? realloc_func : 0;
    if (f != ((void *)0))
        *f = free_func;
}

canonical_original_code:
void CRYPTO_get_mem_functions(void *(**m)(unsigned long), void *(**r)(void *, unsigned long), void (**f)(void *))
{
    if (m != ((void *)0))
        *m = (malloc_ex_func == default_malloc_ex) ? malloc_func : 0;
    if (r != ((void *)0))
        *r = (realloc_ex_func == default_realloc_ex) ? realloc_func : 0;
    if (f != ((void *)0))
        *f = free_func;
}

variable_types:
m
void *(**)(unsigned long)

variable_types:
r
void *(**)(void *, unsigned long)

variable_types:
f
void (**)(void *)


decompiled_code:
void __fastcall CRYPTO_get_mem_ex_functions(__int64 (__fastcall **a1)(), __int64 (__fastcall **a2)(), _QWORD *a3)
{
__int64 (__fastcall *v3)(); // rax
__int64 (__fastcall *v4)(); // rax

if ( a1 )
{
v3 = malloc_ex_func;
if ( !malloc_ex_func )
v3 = 0LL;
*a1 = v3;
}
if ( a2 )
{
v4 = realloc_ex_func;
if ( (char *)realloc_ex_func == (char *)default_realloc_ex )
v4 = 0LL;
*a2 = v4;
}
if ( a3 )
*a3 = free_func;
}

canonical_decompiled_code:
void __fastcall func9(__int64 (__fastcall **a1)(), __int64 (__fastcall **a2)(), _QWORD *a3)
{
__int64 (__fastcall *v3)(); // rax
__int64 (__fastcall *v4)(); // rax

if ( a1 )
{
v3 = malloc_ex_func;
if ( !malloc_ex_func )
v3 = 0LL;
*a1 = v3;
}
if ( a2 )
{
v4 = realloc_ex_func;
if ( (char *)realloc_ex_func == (char *)default_realloc_ex )
v4 = 0LL;
*a2 = v4;
}
if ( a3 )
*a3 = free_func;
}

original_code:
void CRYPTO_get_mem_ex_functions(void *(**m) (size_t, const char *, int),
                                 void *(**r) (void *, size_t, const char *,
                                              int), void (**f) (void *))
{
    if (m != ((void *)0))
        *m = (malloc_ex_func != default_malloc_ex) ? malloc_ex_func : 0;
    if (r != ((void *)0))
        *r = (realloc_ex_func != default_realloc_ex) ? realloc_ex_func : 0;
    if (f != ((void *)0))
        *f = free_func;
}

canonical_original_code:
void CRYPTO_get_mem_ex_functions(void *(**m)(unsigned long, char *, int), void *(**r)(void *, unsigned long, char *, int), void (**f)(void *))
{
    if (m != ((void *)0))
        *m = (malloc_ex_func != default_malloc_ex) ? malloc_ex_func : 0;
    if (r != ((void *)0))
        *r = (realloc_ex_func != default_realloc_ex) ? realloc_ex_func : 0;
    if (f != ((void *)0))
        *f = free_func;
}

variable_types:
m
void *(**)(unsigned long, char *, int)

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


decompiled_code:
void __fastcall CRYPTO_get_locked_mem_functions(void *(**a1)(size_t size), _QWORD *a2)
{
void *(*v2)(size_t); // rax

if ( a1 )
{
v2 = 0LL;
if ( (char *)malloc_locked_ex_func == (char *)default_malloc_locked_ex )
v2 = malloc_locked_func;
*a1 = v2;
}
if ( a2 )
*a2 = free_locked_func;
}

canonical_decompiled_code:
void __fastcall func10(void *(**a1)(size_t size), _QWORD *a2)
{
void *(*v2)(size_t); // rax

if ( a1 )
{
v2 = 0LL;
if ( (char *)malloc_locked_ex_func == (char *)default_malloc_locked_ex )
v2 = malloc_locked_func;
*a1 = v2;
}
if ( a2 )
*a2 = free_locked_func;
}

original_code:
void CRYPTO_get_locked_mem_functions(void *(**m) (size_t),
                                     void (**f) (void *))
{
    if (m != ((void *)0))
        *m = (malloc_locked_ex_func == default_malloc_locked_ex) ?
            malloc_locked_func : 0;
    if (f != ((void *)0))
        *f = free_locked_func;
}

canonical_original_code:
void CRYPTO_get_locked_mem_functions(void *(**m)(unsigned long), void (**f)(void *))
{
    if (m != ((void *)0))
        *m = (malloc_locked_ex_func == default_malloc_locked_ex) ?
            malloc_locked_func : 0;
    if (f != ((void *)0))
        *f = free_locked_func;
}


decompiled_code:
void __fastcall CRYPTO_get_locked_mem_ex_functions(__int64 (__fastcall **a1)(), _QWORD *a2)
{
__int64 (__fastcall *v2)(); // rax

if ( a1 )
{
v2 = malloc_locked_ex_func;
if ( (char *)malloc_locked_ex_func == (char *)default_malloc_locked_ex )
v2 = 0LL;
*a1 = v2;
}
if ( a2 )
*a2 = free_locked_func;
}

canonical_decompiled_code:
void __fastcall func11(__int64 (__fastcall **a1)(), _QWORD *a2)
{
__int64 (__fastcall *v2)(); // rax

if ( a1 )
{
v2 = malloc_locked_ex_func;
if ( (char *)malloc_locked_ex_func == (char *)default_malloc_locked_ex )
v2 = 0LL;
*a1 = v2;
}
if ( a2 )
*a2 = free_locked_func;
}

original_code:
void CRYPTO_get_locked_mem_ex_functions(void
                                        *(**m) (size_t, const char *, int),
                                        void (**f) (void *))
{
    if (m != ((void *)0))
        *m = (malloc_locked_ex_func != default_malloc_locked_ex) ?
            malloc_locked_ex_func : 0;
    if (f != ((void *)0))
        *f = free_locked_func;
}

canonical_original_code:
void CRYPTO_get_locked_mem_ex_functions(void *(**m)(unsigned long, char *, int), void (**f)(void *))
{
    if (m != ((void *)0))
        *m = (malloc_locked_ex_func != default_malloc_locked_ex) ?
            malloc_locked_ex_func : 0;
    if (f != ((void *)0))
        *f = free_locked_func;
}


decompiled_code:
void PKCS5_PBE_add()
{
;
}

canonical_decompiled_code:
void func0()
{
;
}

original_code:
void PKCS5_PBE_add(void)
{
}

canonical_original_code:
void PKCS5_PBE_add()
{
}


decompiled_code:
__int64 __fastcall KDF1_SHA1(__int64 a1, __int64 a2, __int64 a3, _QWORD *a4)
{
if ( *a4 <= 0x13uLL )
return 0LL;
*a4 = 20LL;
return SHA1();
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1, __int64 a2, __int64 a3, _QWORD *a4)
{
if ( *a4 <= 0x13uLL )
return 0LL;
*a4 = 20LL;
return SHA1();
}

original_code:
static void *KDF1_SHA1(const void *in, size_t inlen, void *out,
                       size_t *outlen)
{
    if (*outlen < 20)
        return ((void *)0);
    else
        *outlen = 20;
    return SHA1(in, inlen, out);
}

canonical_original_code:
static void *KDF1_SHA1(void *in, unsigned long inlen, void *out, unsigned long *outlen)
{
    if (*outlen < 20)
        return ((void *)0);
    else
        *outlen = 20;
    return SHA1(in, inlen, out);
}

variable_types:
in
void *

variable_types:
inlen
unsigned long

variable_types:
out
void *

variable_types:
outlen
unsigned long *


decompiled_code:
__int64 __fastcall do_all_fn_doall_arg(_DWORD *a1, unsigned int *a2)
{
__int64 result; // rax

result = *a2;
if ( *a1 == (_DWORD)result )
result = (*((__int64 (__fastcall **)(_DWORD *, _QWORD))a2 + 1))(a1, *((_QWORD *)a2 + 2));
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(_DWORD *a1, unsigned int *a2)
{
__int64 result; // rax

result = *a2;
if ( *a1 == (_DWORD)result )
result = (*((__int64 (__fastcall **)(_DWORD *, _QWORD))a2 + 1))(a1, *((_QWORD *)a2 + 2));
return result;
}

original_code:
static void do_all_fn_doall_arg(const OBJ_NAME *name, struct doall *d)
{
    if (name->type == d->type)
        d->fn(name, d->arg);
}

canonical_original_code:
static void do_all_fn_doall_arg(struct obj_name_st *name, struct doall *d)
{
    if (name->type == d->type)
        d->fn(name, d->arg);
}

variable_types: struct obj_name_st { int type; int alias; char *name; char *data; } *

variable_types: struct doall { int type; void (*fn)(struct obj_name_st *, void *arg); void *arg; } *


decompiled_code:
// attributes: thunk
__int64 __fastcall do_all_fn_LHASH_DOALL_ARG(_DWORD *a1, unsigned int *a2)
{
return do_all_fn_doall_arg(a1, a2);
}

canonical_decompiled_code:
__int64 __fastcall func1(_DWORD *a1, unsigned int *a2)
{
return func0(a1, a2);
}

original_code: static void do_all_fn_LHASH_DOALL_ARG(void *arg1, void *arg2) { const OBJ_NAME *a = arg1; struct doall *b = arg2; do_all_fn_doall_arg(a, b); }

canonical_original_code: static void do_all_fn_LHASH_DOALL_ARG(void *arg1, void *arg2) { struct obj_name_st *a = arg1; struct doall *b = arg2; do_all_fn_doall_arg(a, b); }

variable_types: struct doall { int type; void (*fn)(struct obj_name_st { int type; int alias; char *name; char *data; } *, void *arg); void *arg; } *

user_defined_types: struct doall { int type; void (*fn)(struct obj_name_st *, void *arg); void *arg; }


decompiled_code:
int __fastcall obj_name_cmp(__int64 a1, __int64 a2)
{
int result; // eax
__int64 v3; // rax

result = *(_DWORD *)a1 - *(_DWORD *)a2;
if ( *(_DWORD *)a1 == *(_DWORD *)a2 )
{
if ( name_funcs_stack && (int)sk_num() > *(_DWORD *)a1 )
{
v3 = sk_value(name_funcs_stack);
result = (*(__int64 (__fastcall **)(_QWORD, _QWORD))(v3 + 8))(*(_QWORD *)(a1 + 8), *(_QWORD *)(a2 + 8));
}
else
{
result = strcmp(*(const char **)(a1 + 8), *(const char **)(a2 + 8));
}
}
return result;
}

canonical_decompiled_code:
int __fastcall func3(__int64 a1, __int64 a2)
{
int result; // eax
__int64 v3; // rax

result = *(_DWORD *)a1 - *(_DWORD *)a2;
if ( *(_DWORD *)a1 == *(_DWORD *)a2 )
{
if ( name_funcs_stack && (int)sk_num() > *(_DWORD *)a1 )
{
v3 = sk_value(name_funcs_stack);
result = (*(__int64 (__fastcall **)(_QWORD, _QWORD))(v3 + 8))(*(_QWORD *)(a1 + 8), *(_QWORD *)(a2 + 8));
}
else
{
result = strcmp(*(const char **)(a1 + 8), *(const char **)(a2 + 8));
}
}
return result;
}

original_code:
static int obj_name_cmp(const void *a_void, const void *b_void)
{
    int ret;
    const OBJ_NAME *a = (const OBJ_NAME *)a_void;
    const OBJ_NAME *b = (const OBJ_NAME *)b_void;
    ret = a->type - b->type;
    if (ret == 0) {
        if ((name_funcs_stack != ((void *)0))
            && (sk_num(((_STACK*) (1 ? (name_funcs_stack) : (struct stack_st_NAME_FUNCS*)0))) > a->type)) {
            ret = ((NAME_FUNCS *)sk_value(((_STACK*) (1 ? (name_funcs_stack) : (struct stack_st_NAME_FUNCS*)0)), (a->type)))->cmp_func(a->name, b->name);
        } else
            ret = strcmp(a->name, b->name);
    }
    return (ret);
}

canonical_original_code:
static int obj_name_cmp(void *a_void, void *b_void)
{
    int ret;
    struct obj_name_st *a = (const OBJ_NAME *)a_void;
    struct obj_name_st *b = (const OBJ_NAME *)b_void;
    ret = a->type - b->type;
    if (ret == 0) {
        if ((name_funcs_stack != ((void *)0))
            && (sk_num(((struct stack_st *) (1 ? (name_funcs_stack) : (struct stack_st_NAME_FUNCS *)0))) > a->type)) {
            ret = ((struct name_funcs_st *)sk_value(((struct stack_st *) (1 ? (name_funcs_stack) : (struct stack_st_NAME_FUNCS *)0)), (a->type)))->cmp_func(a->name, b->name);
        } else
            ret = strcmp(a->name, b->name);
    }
    return (ret);
}

variable_types: ret int

user_defined_types: struct obj_name_st { int type; int alias; char *name; char *data; }

user_defined_types: struct stack_st { int num; char **data; int sorted; int num_alloc; int (*comp)(void *, void *); }

user_defined_types: struct stack_st_NAME_FUNCS { struct stack_st stack; }

user_defined_types: struct name_funcs_st { unsigned long (*hash_func)(char *name); int (*cmp_func)(char *a, char *b); void (*free_func)(char *, int, char *); }


decompiled_code:
// attributes: thunk
int __fastcall obj_name_LHASH_COMP(__int64 a1, __int64 a2)
{
return obj_name_cmp(a1, a2);
}

canonical_decompiled_code:
int __fastcall func4(__int64 a1, __int64 a2)
{
return func3(a1, a2);
}

original_code: static int obj_name_LHASH_COMP(const void *arg1, const void *arg2) { const OBJ_NAME *a = arg1; const OBJ_NAME *b = arg2; return obj_name_cmp(a,b); }

canonical_original_code: static int obj_name_LHASH_COMP(void *arg1, void *arg2) { struct obj_name_st *a = arg1; struct obj_name_st *b = arg2; return obj_name_cmp(a,b); }


decompiled_code:
int __fastcall do_all_sorted_cmp(const void *a1, const void *a2)
{
return strcmp(*(const char **)(*(_QWORD *)a1 + 8LL), *(const char **)(*(_QWORD *)a2 + 8LL));
}

canonical_decompiled_code:
int __fastcall func5(const void *a1, const void *a2)
{
return strcmp(*(const char **)(*(_QWORD *)a1 + 8LL), *(const char **)(*(_QWORD *)a2 + 8LL));
}

original_code:
static int do_all_sorted_cmp(const void *n1_, const void *n2_)
{
    const OBJ_NAME *const *n1 = n1_;
    const OBJ_NAME *const *n2 = n2_;
    return strcmp((*n1)->name, (*n2)->name);
}

canonical_original_code:
static int do_all_sorted_cmp(void *n1_, void *n2_)
{
    struct obj_name_st **n1 = n1_;
    struct obj_name_st **n2 = n2_;
    return strcmp((*n1)->name, (*n2)->name);
}

variable_types: struct obj_name_st { int type; int alias; char *name; char *data; } **


decompiled_code:
__int64 __fastcall obj_name_hash(int *a1)
{
__int64 (__fastcall **v2)(_QWORD); // rax

if ( !name_funcs_stack || (int)sk_num() <= *a1 )
return lh_strhash(*((_QWORD *)a1 + 1)) ^ *a1;
v2 = (__int64 (__fastcall **)(_QWORD))sk_value(name_funcs_stack);
return (*v2)(*((_QWORD *)a1 + 1)) ^ *a1;
}

canonical_decompiled_code:
__int64 __fastcall func6(int *a1)
{
__int64 (__fastcall **v2)(_QWORD); // rax

if ( !name_funcs_stack || (int)sk_num() <= *a1 )
return lh_strhash(*((_QWORD *)a1 + 1)) ^ *a1;
v2 = (__int64 (__fastcall **)(_QWORD))sk_value(name_funcs_stack);
return (*v2)(*((_QWORD *)a1 + 1)) ^ *a1;
}

original_code:
static unsigned long obj_name_hash(const void *a_void)
{
    unsigned long ret;
    const OBJ_NAME *a = (const OBJ_NAME *)a_void;
    if ((name_funcs_stack != ((void *)0))
        && (sk_num(((_STACK*) (1 ? (name_funcs_stack) : (struct stack_st_NAME_FUNCS*)0))) > a->type)) {
        ret =
            ((NAME_FUNCS *)sk_value(((_STACK*) (1 ? (name_funcs_stack) : (struct stack_st_NAME_FUNCS*)0)), (a->type)))->hash_func(a->name);
    } else {
        ret = lh_strhash(a->name);
    }
    ret ^= a->type;
    return (ret);
}

canonical_original_code:
static unsigned long obj_name_hash(void *a_void)
{
    unsigned long ret;
    struct obj_name_st *a = (const OBJ_NAME *)a_void;
    if ((name_funcs_stack != ((void *)0))
        && (sk_num(((struct stack_st *) (1 ? (name_funcs_stack) : (struct stack_st_NAME_FUNCS *)0))) > a->type)) {
        ret =
            ((struct name_funcs_st *)sk_value(((struct stack_st *) (1 ? (name_funcs_stack) : (struct stack_st_NAME_FUNCS *)0)), (a->type)))->hash_func(a->name);
    } else {
        ret = lh_strhash(a->name);
    }
    ret ^= a->type;
    return (ret);
}

variable_types:
ret
unsigned long

return_type: unsigned long


decompiled_code:
// attributes: thunk
__int64 __fastcall obj_name_LHASH_HASH(int *a1)
{
return obj_name_hash(a1);
}

canonical_decompiled_code:
__int64 __fastcall func7(int *a1)
{
return func6(a1);
}

original_code: static unsigned long obj_name_LHASH_HASH(const void *arg) { const OBJ_NAME *a = arg; return obj_name_hash(a); }

canonical_original_code: static unsigned long obj_name_LHASH_HASH(void *arg) { struct obj_name_st *a = arg; return obj_name_hash(a); }

variable_types:
arg
void *


decompiled_code:
// attributes: thunk
__int64 name_funcs_free()
{
return CRYPTO_free();
}

canonical_decompiled_code:
__int64 func8()
{
return CRYPTO_free();
}

original_code:
static void name_funcs_free(NAME_FUNCS *ptr)
{
    CRYPTO_free(ptr);
}

canonical_original_code:
static void name_funcs_free(struct name_funcs_st *ptr)
{
    CRYPTO_free(ptr);
}

variable_types: struct name_funcs_st { unsigned long (*hash_func)(char *name); int (*cmp_func)(char *a, char *b); void (*free_func)(char *, int, char *); } *


decompiled_code:
_BOOL8 OBJ_NAME_init()
{
if ( names_lh )
return 1LL;
CRYPTO_mem_ctrl(3LL);
names_lh = lh_new(obj_name_LHASH_HASH, obj_name_LHASH_COMP);
CRYPTO_mem_ctrl(2LL);
return names_lh != 0;
}

canonical_decompiled_code:
_BOOL8 func9()
{
if ( names_lh )
return 1LL;
CRYPTO_mem_ctrl(3LL);
names_lh = lh_new(obj_name_LHASH_HASH, obj_name_LHASH_COMP);
CRYPTO_mem_ctrl(2LL);
return names_lh != 0;
}

original_code:
int OBJ_NAME_init(void)
{
    if (names_lh != ((void *)0))
        return (1);
    CRYPTO_mem_ctrl(0x3);
    names_lh = ((struct lhash_st_OBJ_NAME *)lh_new(obj_name_LHASH_HASH, obj_name_LHASH_COMP));
    CRYPTO_mem_ctrl(0x2);
    return (names_lh != ((void *)0));
}

canonical_original_code:
int OBJ_NAME_init()
{
    if (names_lh != ((void *)0))
        return (1);
    CRYPTO_mem_ctrl(0x3);
    names_lh = ((struct lhash_st_OBJ_NAME *)lh_new(obj_name_LHASH_HASH, obj_name_LHASH_COMP));
    CRYPTO_mem_ctrl(0x2);
    return (names_lh != ((void *)0));
}


decompiled_code:
__int64 __fastcall OBJ_NAME_new_index(__int64 a1, __int64 a2, __int64 a3)
{
unsigned int v4; // er15
int v5; // ebx
_QWORD *v6; // rbp
_QWORD *v8; // rax

if ( !name_funcs_stack )
{
CRYPTO_mem_ctrl(3LL);
name_funcs_stack = sk_new_null();
CRYPTO_mem_ctrl(2LL);
if ( !name_funcs_stack )
return 0;
}
v4 = names_type_num++;
v5 = sk_num();
if ( v5 < names_type_num )
{
while ( 1 )
{
CRYPTO_mem_ctrl(3LL);
v6 = (_QWORD *)CRYPTO_malloc(24LL, "o_names.c", 87LL);
CRYPTO_mem_ctrl(2LL);
if ( !v6 )
break;
*v6 = &lh_strhash;
++v5;
v6[1] = &strcmp;
v6[2] = 0LL;
CRYPTO_mem_ctrl(3LL);
sk_push(name_funcs_stack, v6);
CRYPTO_mem_ctrl(2LL);
if ( names_type_num <= v5 )
goto LABEL_8;
}
v4 = 0;
ERR_put_error(8LL, 106LL, 65LL, "o_names.c", 90LL);
}
else
{
LABEL_8:
v8 = (_QWORD *)sk_value(name_funcs_stack);
if ( a1 )
*v8 = a1;
if ( a2 )
v8[1] = a2;
if ( a3 )
v8[2] = a3;
}
return v4;
}

canonical_decompiled_code:
__int64 __fastcall func10(__int64 a1, __int64 a2, __int64 a3)
{
unsigned int v4; // er15
int v5; // ebx
_QWORD *v6; // rbp
_QWORD *v8; // rax

if ( !name_funcs_stack )
{
CRYPTO_mem_ctrl(3LL);
name_funcs_stack = sk_new_null();
CRYPTO_mem_ctrl(2LL);
if ( !name_funcs_stack )
return 0;
}
v4 = names_type_num++;
v5 = sk_num();
if ( v5 < names_type_num )
{
while ( 1 )
{
CRYPTO_mem_ctrl(3LL);
v6 = (_QWORD *)CRYPTO_malloc(24LL, "o_names.c", 87LL);
CRYPTO_mem_ctrl(2LL);
if ( !v6 )
break;
*v6 = &lh_strhash;
++v5;
v6[1] = &strcmp;
v6[2] = 0LL;
CRYPTO_mem_ctrl(3LL);
sk_push(name_funcs_stack, v6);
CRYPTO_mem_ctrl(2LL);
if ( names_type_num <= v5 )
goto LABEL_8;
}
v4 = 0;
ERR_put_error(8LL, 106LL, 65LL, "o_names.c", 90LL);
}
else
{
LABEL_8:
v8 = (_QWORD *)sk_value(name_funcs_stack);
if ( a1 )
*v8 = a1;
if ( a2 )
v8[1] = a2;
if ( a3 )
v8[2] = a3;
}
return v4;
}

original_code:
int OBJ_NAME_new_index(unsigned long (*hash_func) (const char *),
                       int (*cmp_func) (const char *, const char *),
                       void (*free_func) (const char *, int, const char *))
{
    int ret;
    int i;
    NAME_FUNCS *name_funcs;
    if (name_funcs_stack == ((void *)0)) {
        CRYPTO_mem_ctrl(0x3);
        name_funcs_stack = ((struct stack_st_NAME_FUNCS *)sk_new_null());
        CRYPTO_mem_ctrl(0x2);
    }
    if (name_funcs_stack == ((void *)0)) {
        return (0);
    }
    ret = names_type_num;
    names_type_num++;
    for (i = sk_num(((_STACK*) (1 ? (name_funcs_stack) : (struct stack_st_NAME_FUNCS*)0))); i < names_type_num; i++) {
        CRYPTO_mem_ctrl(0x3);
        name_funcs = CRYPTO_malloc((int)sizeof(NAME_FUNCS),"o_names.c",87);
        CRYPTO_mem_ctrl(0x2);
        if (!name_funcs) {
            ERR_put_error(8,(106),((1|64)),"o_names.c",90);
            return (0);
        }
        name_funcs->hash_func = lh_strhash;
        name_funcs->cmp_func = strcmp;
        name_funcs->free_func = 0;
        CRYPTO_mem_ctrl(0x3);
        sk_push(((_STACK*) (1 ? (name_funcs_stack) : (struct stack_st_NAME_FUNCS*)0)), ((void*) (1 ? (name_funcs) : (NAME_FUNCS*)0)));
        CRYPTO_mem_ctrl(0x2);
    }
    name_funcs = ((NAME_FUNCS *)sk_value(((_STACK*) (1 ? (name_funcs_stack) : (struct stack_st_NAME_FUNCS*)0)), (ret)));
    if (hash_func != ((void *)0))
        name_funcs->hash_func = hash_func;
    if (cmp_func != ((void *)0))
        name_funcs->cmp_func = cmp_func;
    if (free_func != ((void *)0))
        name_funcs->free_func = free_func;
    return (ret);
}

canonical_original_code:
int OBJ_NAME_new_index(unsigned long (*hash_func)(char *), int (*cmp_func)(char *, char *), void (*free_func)(char *, int, char *))
{
    int ret;
    int i;
    struct name_funcs_st *name_funcs;
    if (name_funcs_stack == ((void *)0)) {
        CRYPTO_mem_ctrl(0x3);
        name_funcs_stack = ((struct stack_st_NAME_FUNCS *)sk_new_null());
        CRYPTO_mem_ctrl(0x2);
    }
    if (name_funcs_stack == ((void *)0)) {
        return (0);
    }
    ret = names_type_num;
    names_type_num++;
    for (i = sk_num(((struct stack_st *) (1 ? (name_funcs_stack) : (struct stack_st_NAME_FUNCS *)0))); i < names_type_num; i++) {
        CRYPTO_mem_ctrl(0x3);
        name_funcs = CRYPTO_malloc((int)sizeof(NAME_FUNCS),"o_names.c",87);
        CRYPTO_mem_ctrl(0x2);
        if (!name_funcs) {
            ERR_put_error(8,(106),((1|64)),"o_names.c",90);
            return (0);
        }
        name_funcs->hash_func = lh_strhash;
        name_funcs->cmp_func = strcmp;
        name_funcs->free_func = 0;
        CRYPTO_mem_ctrl(0x3);
        sk_push(((struct stack_st *) (1 ? (name_funcs_stack) : (struct stack_st_NAME_FUNCS *)0)), ((void *) (1 ? (name_funcs) : (struct name_funcs_st *)0)));
        CRYPTO_mem_ctrl(0x2);
    }
    name_funcs = ((struct name_funcs_st *)sk_value(((struct stack_st *) (1 ? (name_funcs_stack) : (struct stack_st_NAME_FUNCS *)0)), (ret)));
    if (hash_func != ((void *)0))
        name_funcs->hash_func = hash_func;
    if (cmp_func != ((void *)0))
        name_funcs->cmp_func = cmp_func;
    if (free_func != ((void *)0))
        name_funcs->free_func = free_func;
    return (ret);
}

variable_types: i int


decompiled_code:
__int64 __fastcall OBJ_NAME_get(__int64 a1, int a2)
{
int v3; // ebx
__int64 v4; // rdi
int v5; // ebx
__int64 v6; // rax
int v8; // [rsp+0h] [rbp-38h] BYREF
__int64 v9; // [rsp+8h] [rbp-30h]

if ( a1 )
{
v3 = a2;
v4 = names_lh;
if ( !names_lh )
{
if ( !OBJ_NAME_init() )
return 0LL;
v4 = names_lh;
}
BYTE1(v3) = BYTE1(a2) & 0x7F;
v9 = a1;
v8 = v3;
v5 = 11;
while ( 1 )
{
v6 = lh_retrieve(v4, &v8);
if ( !v6 )
break;
if ( !*(_DWORD *)(v6 + 4) || (a2 & 0x8000) != 0 )
return *(_QWORD *)(v6 + 16);
if ( !--v5 )
return 0LL;
v4 = names_lh;
v9 = *(_QWORD *)(v6 + 16);
}
return 0LL;
}
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func11(__int64 a1, int a2)
{
int v3; // ebx
__int64 v4; // rdi
int v5; // ebx
__int64 v6; // rax
int v8; // [rsp+0h] [rbp-38h] BYREF
__int64 v9; // [rsp+8h] [rbp-30h]

if ( a1 )
{
v3 = a2;
v4 = names_lh;
if ( !names_lh )
{
if ( !func9() )
return 0LL;
v4 = names_lh;
}
BYTE1(v3) = BYTE1(a2) & 0x7F;
v9 = a1;
v8 = v3;
v5 = 11;
while ( 1 )
{
v6 = lh_retrieve(v4, &v8);
if ( !v6 )
break;
if ( !*(_DWORD *)(v6 + 4) || (a2 & 0x8000) != 0 )
return *(_QWORD *)(v6 + 16);
if ( !--v5 )
return 0LL;
v4 = names_lh;
v9 = *(_QWORD *)(v6 + 16);
}
return 0LL;
}
return 0LL;
}

original_code:
const char *OBJ_NAME_get(const char *name, int type)
{
    OBJ_NAME on, *ret;
    int num = 0, alias;
    if (name == ((void *)0))
        return (((void *)0));
    if ((names_lh == ((void *)0)) && !OBJ_NAME_init())
        return (((void *)0));
    alias = type & 0x8000;
    type &= ~0x8000;
    on.name = name;
    on.type = type;
    for (;;) {
        ret = ((OBJ_NAME *)lh_retrieve(((_LHASH *)((void*) (1 ? names_lh : (struct lhash_st_OBJ_NAME*)0))), ((void*) (1 ? &on : (OBJ_NAME*)0))));
        if (ret == ((void *)0))
            return (((void *)0));
        if ((ret->alias) && !alias) {
            if (++num > 10)
                return (((void *)0));
            on.name = ret->data;
        } else {
            return (ret->data);
        }
    }
}

canonical_original_code:
char *OBJ_NAME_get(char *name, int type)
{
    struct obj_name_st on; struct obj_name_st *ret;
    int num = 0; int alias;
    if (name == ((void *)0))
        return (((void *)0));
    if ((names_lh == ((void *)0)) && !OBJ_NAME_init())
        return (((void *)0));
    alias = type & 0x8000;
    type &= ~0x8000;
    on.name = name;
    on.type = type;
    for (;;) {
        ret = ((struct obj_name_st *)lh_retrieve(((struct lhash_st *)((void *) (1 ? names_lh : (struct lhash_st_OBJ_NAME *)0))), ((void *) (1 ? &on : (struct obj_name_st *)0))));
        if (ret == ((void *)0))
            return (((void *)0));
        if ((ret->alias) && !alias) {
            if (++num > 10)
                return (((void *)0));
            on.name = ret->data;
        } else {
            return (ret->data);
        }
    }
}

variable_types:
name
char *

variable_types: type int

variable_types: struct obj_name_st { int type; int alias; char *name; char *data; }

variable_types: num int

variable_types: alias int

return_type: char *

user_defined_types: struct lhash_st { struct lhash_node_st **b; int (*comp)(void *, void *); unsigned long (*hash)(void *); unsigned int num_nodes; unsigned int num_alloc_nodes; unsigned int p; unsigned int pmax; unsigned long up_load; unsigned long down_load; unsigned long num_items; unsigned long num_expands; unsigned long num_expand_reallocs; unsigned long num_contracts; unsigned long num_contract_reallocs; unsigned long num_hash_calls; unsigned long num_comp_calls; unsigned long num_insert; unsigned long num_replace; unsigned long num_delete; unsigned long num_no_delete; unsigned long num_retrieve; unsigned long num_retrieve_miss; unsigned long num_hash_comps; int error; }

user_defined_types: struct lhash_node_st { void *data; struct lhash_node_st *next; unsigned long hash; }


decompiled_code:
_BOOL8 __fastcall OBJ_NAME_add(__int64 a1, int a2, __int64 a3)
{
__int64 v5; // rax
__int64 v6; // rsi
__int16 v7; // ax
__int64 v8; // rdi
unsigned int *v9; // rbp
__int64 v11; // rax

if ( !names_lh && !OBJ_NAME_init() )
return 0LL;
v5 = CRYPTO_malloc(24LL, "o_names.c", 191LL);
v6 = v5;
if ( !v5 )
return 0LL;
*(_QWORD *)(v5 + 8) = a1;
v7 = a2;
BYTE1(a2) &= 0x7Fu;
v8 = names_lh;
*(_QWORD *)(v6 + 16) = a3;
*(_DWORD *)(v6 + 4) = v7 & 0x8000;
*(_DWORD *)v6 = a2;
v9 = (unsigned int *)lh_insert(v8);
if ( !v9 )
return *(_DWORD *)(names_lh + 168) == 0;
if ( name_funcs_stack )
{
if ( (int)sk_num() > (int)*v9 )
{
v11 = sk_value(name_funcs_stack);
(*(void (__fastcall **)(_QWORD, _QWORD, _QWORD))(v11 + 16))(*((_QWORD *)v9 + 1), *v9, *((_QWORD *)v9 + 2));
}
}
CRYPTO_free(v9);
return 1LL;
}

canonical_decompiled_code:
_BOOL8 __fastcall func12(__int64 a1, int a2, __int64 a3)
{
__int64 v5; // rax
__int64 v6; // rsi
__int16 v7; // ax
__int64 v8; // rdi
unsigned int *v9; // rbp
__int64 v11; // rax

if ( !names_lh && !func9() )
return 0LL;
v5 = CRYPTO_malloc(24LL, "o_names.c", 191LL);
v6 = v5;
if ( !v5 )
return 0LL;
*(_QWORD *)(v5 + 8) = a1;
v7 = a2;
BYTE1(a2) &= 0x7Fu;
v8 = names_lh;
*(_QWORD *)(v6 + 16) = a3;
*(_DWORD *)(v6 + 4) = v7 & 0x8000;
*(_DWORD *)v6 = a2;
v9 = (unsigned int *)lh_insert(v8);
if ( !v9 )
return *(_DWORD *)(names_lh + 168) == 0;
if ( name_funcs_stack )
{
if ( (int)sk_num() > (int)*v9 )
{
v11 = sk_value(name_funcs_stack);
(*(void (__fastcall **)(_QWORD, _QWORD, _QWORD))(v11 + 16))(*((_QWORD *)v9 + 1), *v9, *((_QWORD *)v9 + 2));
}
}
CRYPTO_free(v9);
return 1LL;
}

original_code:
int OBJ_NAME_add(const char *name, int type, const char *data)
{
    OBJ_NAME *onp, *ret;
    int alias;
    if ((names_lh == ((void *)0)) && !OBJ_NAME_init())
        return (0);
    alias = type & 0x8000;
    type &= ~0x8000;
    onp = (OBJ_NAME *)CRYPTO_malloc((int)sizeof(OBJ_NAME),"o_names.c",191);
    if (onp == ((void *)0)) {
        return (0);
    }
    onp->name = name;
    onp->alias = alias;
    onp->type = type;
    onp->data = data;
    ret = ((OBJ_NAME *)lh_insert(((_LHASH *)((void*) (1 ? names_lh : (struct lhash_st_OBJ_NAME*)0))), ((void*) (1 ? onp : (OBJ_NAME*)0))));
    if (ret != ((void *)0)) {
        if ((name_funcs_stack != ((void *)0))
            && (sk_num(((_STACK*) (1 ? (name_funcs_stack) : (struct stack_st_NAME_FUNCS*)0))) > ret->type)) {
            ((NAME_FUNCS *)sk_value(((_STACK*) (1 ? (name_funcs_stack) : (struct stack_st_NAME_FUNCS*)0)), (ret->type)))->free_func(ret->name, ret->type,
                                                      ret->data);
        }
        CRYPTO_free(ret);
    } else {
        if (((((_LHASH *)((void*) (1 ? names_lh : (struct lhash_st_OBJ_NAME*)0))))->error)) {
            return (0);
        }
    }
    return (1);
}

canonical_original_code:
int OBJ_NAME_add(char *name, int type, char *data)
{
    struct obj_name_st *onp; struct obj_name_st *ret;
    int alias;
    if ((names_lh == ((void *)0)) && !OBJ_NAME_init())
        return (0);
    alias = type & 0x8000;
    type &= ~0x8000;
    onp = (struct obj_name_st *)CRYPTO_malloc((int)sizeof(OBJ_NAME),"o_names.c",191);
    if (onp == ((void *)0)) {
        return (0);
    }
    onp->name = name;
    onp->alias = alias;
    onp->type = type;
    onp->data = data;
    ret = ((struct obj_name_st *)lh_insert(((struct lhash_st *)((void *) (1 ? names_lh : (struct lhash_st_OBJ_NAME *)0))), ((void *) (1 ? onp : (struct obj_name_st *)0))));
    if (ret != ((void *)0)) {
        if ((name_funcs_stack != ((void *)0))
            && (sk_num(((struct stack_st *) (1 ? (name_funcs_stack) : (struct stack_st_NAME_FUNCS *)0))) > ret->type)) {
            ((struct name_funcs_st *)sk_value(((struct stack_st *) (1 ? (name_funcs_stack) : (struct stack_st_NAME_FUNCS *)0)), (ret->type)))->free_func(ret->name, ret->type,
                                                      ret->data);
        }
        CRYPTO_free(ret);
    } else {
        if (((((struct lhash_st *)((void *) (1 ? names_lh : (struct lhash_st_OBJ_NAME *)0))))->error)) {
            return (0);
        }
    }
    return (1);
}

variable_types:
data
char *


decompiled_code:
__int64 __fastcall OBJ_NAME_remove(__int64 a1, int a2)
{
unsigned int *v2; // rbp
__int64 result; // rax
__int64 v4; // rax
unsigned int v5; // [rsp+0h] [rbp-28h] BYREF
__int64 v6; // [rsp+8h] [rbp-20h]

if ( !names_lh )
return 0LL;
v6 = a1;
v5 = a2 & 0xFFFF7FFF;
v2 = (unsigned int *)lh_delete(names_lh, &v5);
result = 0LL;
if ( v2 )
{
if ( name_funcs_stack )
{
if ( (int)sk_num() > (int)*v2 )
{
v4 = sk_value(name_funcs_stack);
(*(void (__fastcall **)(_QWORD, _QWORD, _QWORD))(v4 + 16))(*((_QWORD *)v2 + 1), *v2, *((_QWORD *)v2 + 2));
}
}
CRYPTO_free(v2);
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func13(__int64 a1, int a2)
{
unsigned int *v2; // rbp
__int64 result; // rax
__int64 v4; // rax
unsigned int v5; // [rsp+0h] [rbp-28h] BYREF
__int64 v6; // [rsp+8h] [rbp-20h]

if ( !names_lh )
return 0LL;
v6 = a1;
v5 = a2 & 0xFFFF7FFF;
v2 = (unsigned int *)lh_delete(names_lh, &v5);
result = 0LL;
if ( v2 )
{
if ( name_funcs_stack )
{
if ( (int)sk_num() > (int)*v2 )
{
v4 = sk_value(name_funcs_stack);
(*(void (__fastcall **)(_QWORD, _QWORD, _QWORD))(v4 + 16))(*((_QWORD *)v2 + 1), *v2, *((_QWORD *)v2 + 2));
}
}
CRYPTO_free(v2);
result = 1LL;
}
return result;
}

original_code:
int OBJ_NAME_remove(const char *name, int type)
{
    OBJ_NAME on, *ret;
    if (names_lh == ((void *)0))
        return (0);
    type &= ~0x8000;
    on.name = name;
    on.type = type;
    ret = ((OBJ_NAME *)lh_delete(((_LHASH *)((void*) (1 ? names_lh : (struct lhash_st_OBJ_NAME*)0))), ((void*) (1 ? &on : (OBJ_NAME*)0))));
    if (ret != ((void *)0)) {
        if ((name_funcs_stack != ((void *)0))
            && (sk_num(((_STACK*) (1 ? (name_funcs_stack) : (struct stack_st_NAME_FUNCS*)0))) > ret->type)) {
            ((NAME_FUNCS *)sk_value(((_STACK*) (1 ? (name_funcs_stack) : (struct stack_st_NAME_FUNCS*)0)), (ret->type)))->free_func(ret->name, ret->type,
                                                      ret->data);
        }
        CRYPTO_free(ret);
        return (1);
    } else
        return (0);
}

canonical_original_code:
int OBJ_NAME_remove(char *name, int type)
{
    struct obj_name_st on; struct obj_name_st *ret;
    if (names_lh == ((void *)0))
        return (0);
    type &= ~0x8000;
    on.name = name;
    on.type = type;
    ret = ((struct obj_name_st *)lh_delete(((struct lhash_st *)((void *) (1 ? names_lh : (struct lhash_st_OBJ_NAME *)0))), ((void *) (1 ? &on : (struct obj_name_st *)0))));
    if (ret != ((void *)0)) {
        if ((name_funcs_stack != ((void *)0))
            && (sk_num(((struct stack_st *) (1 ? (name_funcs_stack) : (struct stack_st_NAME_FUNCS *)0))) > ret->type)) {
            ((struct name_funcs_st *)sk_value(((struct stack_st *) (1 ? (name_funcs_stack) : (struct stack_st_NAME_FUNCS *)0)), (ret->type)))->free_func(ret->name, ret->type,
                                                      ret->data);
        }
        CRYPTO_free(ret);
        return (1);
    } else
        return (0);
}


decompiled_code:
void __fastcall names_lh_free_doall(__int64 a1)
{
int v1; // esi

if ( a1 )
{
v1 = *(_DWORD *)a1;
if ( free_type < 0 || free_type == v1 )
OBJ_NAME_remove(*(_QWORD *)(a1 + 8), v1);
}
}

canonical_decompiled_code:
void __fastcall func14(__int64 a1)
{
int v1; // esi

if ( a1 )
{
v1 = *(_DWORD *)a1;
if ( free_type < 0 || free_type == v1 )
func13(*(_QWORD *)(a1 + 8), v1);
}
}

original_code:
static void names_lh_free_doall(OBJ_NAME *onp)
{
    if (onp == ((void *)0))
        return;
    if (free_type < 0 || free_type == onp->type)
        OBJ_NAME_remove(onp->name, onp->type);
}

canonical_original_code:
static void names_lh_free_doall(struct obj_name_st *onp)
{
    if (onp == ((void *)0))
        return;
    if (free_type < 0 || free_type == onp->type)
        OBJ_NAME_remove(onp->name, onp->type);
}


decompiled_code:
// attributes: thunk
void __fastcall names_lh_free_LHASH_DOALL(__int64 a1)
{
names_lh_free_doall(a1);
}

canonical_decompiled_code:
void __fastcall func15(__int64 a1)
{
func14(a1);
}

original_code: static void names_lh_free_LHASH_DOALL(void *arg) { OBJ_NAME *a = arg; names_lh_free_doall(a); }

canonical_original_code: static void names_lh_free_LHASH_DOALL(void *arg) { struct obj_name_st *a = arg; names_lh_free_doall(a); }


decompiled_code:
__int64 __fastcall OBJ_NAME_do_all(int a1, __int64 a2, __int64 a3)
{
int v4; // [rsp+0h] [rbp-28h] BYREF
__int64 v5; // [rsp+8h] [rbp-20h]
__int64 v6; // [rsp+10h] [rbp-18h]

v4 = a1;
v5 = a2;
v6 = a3;
return lh_doall_arg(names_lh, do_all_fn_LHASH_DOALL_ARG, &v4);
}

canonical_decompiled_code:
__int64 __fastcall func16(int a1, __int64 a2, __int64 a3)
{
int v4; // [rsp+0h] [rbp-28h] BYREF
__int64 v5; // [rsp+8h] [rbp-20h]
__int64 v6; // [rsp+10h] [rbp-18h]

v4 = a1;
v5 = a2;
v6 = a3;
return lh_doall_arg(names_lh, do_all_fn_LHASH_DOALL_ARG, &v4);
}

original_code:
void OBJ_NAME_do_all(int type, void (*fn) (const OBJ_NAME *, void *arg),
                     void *arg)
{
    struct doall d;
    d.type = type;
    d.fn = fn;
    d.arg = arg;
    lh_doall_arg(((_LHASH *)((void*) (1 ? names_lh : (struct lhash_st_OBJ_NAME*)0))), do_all_fn_LHASH_DOALL_ARG, ((void*) (1 ? &d : (struct doall*)0)));
}

canonical_original_code:
void OBJ_NAME_do_all(int type, void (*fn)(struct obj_name_st *, void *arg), void *arg)
{
    struct doall d;
    d.type = type;
    d.fn = fn;
    d.arg = arg;
    lh_doall_arg(((struct lhash_st *)((void *) (1 ? names_lh : (struct lhash_st_OBJ_NAME *)0))), do_all_fn_LHASH_DOALL_ARG, ((void *) (1 ? &d : (struct doall *)0)));
}

variable_types: void (*)(struct obj_name_st { int type; int alias; char *name; char *data; } *, void *arg)

variable_types: struct doall { int type; void (*fn)(struct obj_name_st { int type; int alias; char *name; char *data; } *, void *arg); void *arg; }


decompiled_code:
void *__fastcall OBJ_NAME_do_all_sorted(int a1, void (__fastcall *a2)(__int64, __int64), __int64 a3)
{
int v4; // eax
void *result; // rax
__int64 v6; // rbx
__int64 v7; // rdi
int v8; // [rsp+0h] [rbp-38h] BYREF
int v9; // [rsp+4h] [rbp-34h]
void *base; // [rsp+8h] [rbp-30h]

v8 = a1;
v4 = lh_num_items(names_lh);
result = (void *)CRYPTO_malloc((unsigned int)(8 * v4), "o_names.c", 314LL);
base = result;
if ( result )
{
v9 = 0;
OBJ_NAME_do_all(a1, (__int64)do_all_sorted_fn, (__int64)&v8);
qsort(base, v9, 8uLL, do_all_sorted_cmp);
if ( v9 > 0 )
{
v6 = 0LL;
do
{
v7 = *((_QWORD *)base + v6++);
a2(v7, a3);
}
while ( v9 > (int)v6 );
}
result = (void *)CRYPTO_free(base);
}
return result;
}

canonical_decompiled_code:
void *__fastcall func17(int a1, void (__fastcall *a2)(__int64, __int64), __int64 a3)
{
int v4; // eax
void *result; // rax
__int64 v6; // rbx
__int64 v7; // rdi
int v8; // [rsp+0h] [rbp-38h] BYREF
int v9; // [rsp+4h] [rbp-34h]
void *base; // [rsp+8h] [rbp-30h]

v8 = a1;
v4 = lh_num_items(names_lh);
result = (void *)CRYPTO_malloc((unsigned int)(8 * v4), "o_names.c", 314LL);
base = result;
if ( result )
{
v9 = 0;
func16(a1, (__int64)do_all_sorted_fn, (__int64)&v8);
qsort(base, v9, 8uLL, do_all_sorted_cmp);
if ( v9 > 0 )
{
v6 = 0LL;
do
{
v7 = *((_QWORD *)base + v6++);
a2(v7, a3);
}
while ( v9 > (int)v6 );
}
result = (void *)CRYPTO_free(base);
}
return result;
}

original_code:
void OBJ_NAME_do_all_sorted(int type,
                            void (*fn) (const OBJ_NAME *, void *arg),
                            void *arg)
{
    struct doall_sorted d;
    int n;
    d.type = type;
    d.names =
        CRYPTO_malloc((int)lh_num_items(((_LHASH *)((void*) (1 ? names_lh : (struct lhash_st_OBJ_NAME*)0)))) * sizeof *d.names,"o_names.c",314);
    if(d.names) {
        d.n = 0;
        OBJ_NAME_do_all(type, do_all_sorted_fn, &d);
        qsort((void *)d.names, d.n, sizeof *d.names, do_all_sorted_cmp);
        for (n = 0; n < d.n; ++n)
            fn(d.names[n], arg);
        CRYPTO_free((void *)d.names);
    }
}

canonical_original_code:
void OBJ_NAME_do_all_sorted(int type, void (*fn)(struct obj_name_st *, void *arg), void *arg)
{
    struct doall_sorted d;
    int n;
    d.type = type;
    d.names =
        CRYPTO_malloc((int)lh_num_items(((struct lhash_st *)((void *) (1 ? names_lh : (struct lhash_st_OBJ_NAME *)0)))) * sizeof *d.names,"o_names.c",314);
    if(d.names) {
        d.n = 0;
        OBJ_NAME_do_all(type, do_all_sorted_fn, &d);
        qsort((void *)d.names, d.n, sizeof *d.names, do_all_sorted_cmp);
        for (n = 0; n < d.n; ++n)
            fn(d.names[n], arg);
        CRYPTO_free((void *)d.names);
    }
}

variable_types: struct doall_sorted { int type; int n; struct obj_name_st { int type; int alias; char *name; char *data; } **names; }

variable_types: n int

user_defined_types: struct doall_sorted { int type; int n; struct obj_name_st **names; }


decompiled_code:
__int64 __fastcall OBJ_NAME_cleanup(int a1)
{
__int64 v2; // rdi
__int64 v3; // rbp
__int64 result; // rax

v2 = names_lh;
if ( names_lh )
{
v3 = *(_QWORD *)(names_lh + 48);
free_type = a1;
*(_QWORD *)(names_lh + 48) = 0LL;
lh_doall(v2, names_lh_free_LHASH_DOALL);
if ( a1 < 0 )
{
lh_free(names_lh);
result = sk_pop_free(name_funcs_stack, name_funcs_free);
names_lh = 0LL;
name_funcs_stack = 0LL;
}
else
{
result = names_lh;
*(_QWORD *)(names_lh + 48) = v3;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func18(int a1)
{
__int64 v2; // rdi
__int64 v3; // rbp
__int64 result; // rax

v2 = names_lh;
if ( names_lh )
{
v3 = *(_QWORD *)(names_lh + 48);
free_type = a1;
*(_QWORD *)(names_lh + 48) = 0LL;
lh_doall(v2, names_lh_free_LHASH_DOALL);
if ( a1 < 0 )
{
lh_free(names_lh);
result = sk_pop_free(name_funcs_stack, name_funcs_free);
names_lh = 0LL;
name_funcs_stack = 0LL;
}
else
{
result = names_lh;
*(_QWORD *)(names_lh + 48) = v3;
}
}
return result;
}

original_code:
void OBJ_NAME_cleanup(int type)
{
    unsigned long down_load;

    if (names_lh == NULL)
        return;

    free_type = type;
    down_load = lh_OBJ_NAME_down_load(names_lh);
    lh_OBJ_NAME_down_load(names_lh) = 0;

    lh_OBJ_NAME_doall(names_lh, LHASH_DOALL_FN(names_lh_free));
    if (type < 0) {
        lh_OBJ_NAME_free(names_lh);
        sk_NAME_FUNCS_pop_free(name_funcs_stack, name_funcs_free);
        names_lh = NULL;
        name_funcs_stack = NULL;
    } else
        lh_OBJ_NAME_down_load(names_lh) = down_load;
}


decompiled_code:
__int64 __fastcall app_RAND_load_file(__int64 a1, __int64 a2, int a3)
{
__int64 v4; // rbx
unsigned int v5; // er12
__int64 v7; // [rsp+0h] [rbp-F8h] BYREF

v4 = a1;
if ( a1 )
{
if ( (int)RAND_egd() > 0 )
{
egdsocket = 1;
return 1;
}
LABEL_3:
if ( (unsigned int)RAND_load_file(a1, -1LL) )
goto LABEL_5;
v5 = RAND_status();
if ( v5 )
goto LABEL_5;
goto LABEL_10;
}
a1 = RAND_file_name(&v7, 200LL);
if ( a1 )
goto LABEL_3;
v5 = RAND_status();
if ( v5 )
{
LABEL_5:
seeded = 1;
return 1;
}
LABEL_10:
if ( !a3 )
{
BIO_printf(a2, "unable to load 'random state'\n");
BIO_printf(a2, "This means that the random number generator has not been seeded\n");
BIO_printf(a2, "with much random data.\n");
if ( !v4 )
{
BIO_printf(a2, "Consider setting the RANDFILE environment variable to point at a file that\n");
BIO_printf(a2, "'random' data can be kept in (the file will be overwritten).\n");
}
}
return v5;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, __int64 a2, int a3)
{
__int64 v4; // rbx
unsigned int v5; // er12
__int64 v7; // [rsp+0h] [rbp-F8h] BYREF

v4 = a1;
if ( a1 )
{
if ( (int)RAND_egd() > 0 )
{
egdsocket = 1;
return 1;
}
LABEL_3:
if ( (unsigned int)RAND_load_file(a1, -1LL) )
goto LABEL_5;
v5 = RAND_status();
if ( v5 )
goto LABEL_5;
goto LABEL_10;
}
a1 = RAND_file_name(&v7, 200LL);
if ( a1 )
goto LABEL_3;
v5 = RAND_status();
if ( v5 )
{
LABEL_5:
seeded = 1;
return 1;
}
LABEL_10:
if ( !a3 )
{
BIO_printf(a2, "unable to load 'random state'\n");
BIO_printf(a2, "This means that the random number generator has not been seeded\n");
BIO_printf(a2, "with much random data.\n");
if ( !v4 )
{
BIO_printf(a2, "Consider setting the RANDFILE environment variable to point at a file that\n");
BIO_printf(a2, "'random' data can be kept in (the file will be overwritten).\n");
}
}
return v5;
}

original_code:
int app_RAND_load_file(const char *file, BIO *bio_e, int dont_warn)
{
    int consider_randfile = (file == ((void *)0));
    char buffer[200];
    if (file == ((void *)0))
        file = RAND_file_name(buffer, sizeof buffer);
    else if (RAND_egd(file) > 0) {
        egdsocket = 1;
        return 1;
    }
    if (file == ((void *)0) || !RAND_load_file(file, -1)) {
        if (RAND_status() == 0) {
            if (!dont_warn) {
                BIO_printf(bio_e, "unable to load 'random state'\n");
                BIO_printf(bio_e,
                           "This means that the random number generator has not been seeded\n");
                BIO_printf(bio_e, "with much random data.\n");
                if (consider_randfile) {
                    BIO_printf(bio_e,
                               "Consider setting the RANDFILE environment variable to point at a file that\n");
                    BIO_printf(bio_e,
                               "'random' data can be kept in (the file will be overwritten).\n");
                }
            }
            return 0;
        }
    }
    seeded = 1;
    return 1;
}

canonical_original_code:
int app_RAND_load_file(char *file, struct bio_st *bio_e, int dont_warn)
{
    int consider_randfile = (file == ((void *)0));
    char buffer[200];
    if (file == ((void *)0))
        file = RAND_file_name(buffer, sizeof buffer);
    else if (RAND_egd(file) > 0) {
        egdsocket = 1;
        return 1;
    }
    if (file == ((void *)0) || !RAND_load_file(file, -1)) {
        if (RAND_status() == 0) {
            if (!dont_warn) {
                BIO_printf(bio_e, "unable to load 'random state'\n");
                BIO_printf(bio_e,
                           "This means that the random number generator has not been seeded\n");
                BIO_printf(bio_e, "with much random data.\n");
                if (consider_randfile) {
                    BIO_printf(bio_e,
                               "Consider setting the RANDFILE environment variable to point at a file that\n");
                    BIO_printf(bio_e,
                               "'random' data can be kept in (the file will be overwritten).\n");
                }
            }
            return 0;
        }
    }
    seeded = 1;
    return 1;
}

variable_types:
file
char *

variable_types: struct bio_st { struct bio_method_st { int type; char *name; int (*bwrite)(struct bio_st *, char *, int); int (*bread)(struct bio_st *, char *, int); int (*bputs)(struct bio_st *, char *); int (*bgets)(struct bio_st *, char *, int); long (*ctrl)(struct bio_st *, int, long, void *); int (*create)(struct bio_st *); int (*destroy)(struct bio_st *); long (*callback_ctrl)(struct bio_st *, int, void (*)(struct bio_st *, int, char *, int, long, long)); } *method; long (*callback)(struct bio_st *, int, char *, int, long, long); char *cb_arg; int init; int shutdown; int flags; int retry_reason; int num; void *ptr; struct bio_st *next_bio; struct bio_st *prev_bio; int references; unsigned long num_read; unsigned long num_write; struct crypto_ex_data_st { struct stack_st_void { struct stack_st { int num; char **data; int sorted; int num_alloc; int (*comp)(void *, void *); } stack; } *sk; int dummy; } ex_data; } *

variable_types:
buffer
char [200]

user_defined_types: struct bio_st { struct bio_method_st *method; long (*callback)(struct bio_st *, int, char *, int, long, long); char *cb_arg; int init; int shutdown; int flags; int retry_reason; int num; void *ptr; struct bio_st *next_bio; struct bio_st *prev_bio; int references; unsigned long num_read; unsigned long num_write; struct crypto_ex_data_st ex_data; }

user_defined_types: struct crypto_ex_data_st { struct stack_st_void *sk; int dummy; }

user_defined_types: struct stack_st_void { struct stack_st stack; }


decompiled_code:
__int64 __fastcall app_RAND_write_file(__int64 a1, __int64 a2)
{
__int64 result; // rax
__int64 v3; // [rsp-D8h] [rbp-D8h] BYREF

result = 0LL;
if ( !egdsocket )
{
result = (unsigned int)seeded;
if ( seeded )
{
if ( (a1 || RAND_file_name(&v3, 200LL)) && (unsigned int)RAND_write_file() )
{
result = 1LL;
}
else
{
BIO_printf(a2, "unable to write 'random state'\n");
result = 0LL;
}
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1, __int64 a2)
{
__int64 result; // rax
__int64 v3; // [rsp-D8h] [rbp-D8h] BYREF

result = 0LL;
if ( !egdsocket )
{
result = (unsigned int)seeded;
if ( seeded )
{
if ( (a1 || RAND_file_name(&v3, 200LL)) && (unsigned int)RAND_write_file() )
{
result = 1LL;
}
else
{
BIO_printf(a2, "unable to write 'random state'\n");
result = 0LL;
}
}
}
return result;
}

original_code:
int app_RAND_write_file(const char *file, BIO *bio_e)
{
    char buffer[200];
    if (egdsocket || !seeded)
        return 0;
    if (file == ((void *)0))
        file = RAND_file_name(buffer, sizeof buffer);
    if (file == ((void *)0) || !RAND_write_file(file)) {
        BIO_printf(bio_e, "unable to write 'random state'\n");
        return 0;
    }
    return 1;
}

canonical_original_code:
int app_RAND_write_file(char *file, struct bio_st *bio_e)
{
    char buffer[200];
    if (egdsocket || !seeded)
        return 0;
    if (file == ((void *)0))
        file = RAND_file_name(buffer, sizeof buffer);
    if (file == ((void *)0) || !RAND_write_file(file)) {
        BIO_printf(bio_e, "unable to write 'random state'\n");
        return 0;
    }
    return 1;
}

user_defined_types: struct bio_method_st { int type; char *name; int (*bwrite)(struct bio_st *, char *, int); int (*bread)(struct bio_st *, char *, int); int (*bputs)(struct bio_st *, char *); int (*bgets)(struct bio_st *, char *, int); long (*ctrl)(struct bio_st *, int, long, void *); int (*create)(struct bio_st *); int (*destroy)(struct bio_st *); long (*callback_ctrl)(struct bio_st *, int, void (*)(struct bio_st *, int, char *, int, long, long)); }


decompiled_code:
void app_RAND_allow_write_file()
{
seeded = 1;
}

canonical_decompiled_code:
void func2()
{
seeded = 1;
}

original_code:
void app_RAND_allow_write_file(void)
{
    seeded = 1;
}


decompiled_code:
void ENGINE_load_capi()
{
;
}

canonical_decompiled_code:
void func0()
{
;
}

original_code:
void ENGINE_load_capi(void)
{
}

canonical_original_code:
void ENGINE_load_capi()
{
}


decompiled_code:
const char *BF_options()
{
return "blowfish(idx)";
}

canonical_decompiled_code:
const char *func0()
{
return "blowfish(idx)";
}

original_code:
const char *BF_options(void)
{
#ifdef BF_PTR
    return ("blowfish(ptr)");
#elif defined(BF_PTR2)
    return ("blowfish(ptr2)");
#else
    return ("blowfish(idx)");
#endif
}

canonical_original_code:
char *BF_options()
{
#ifdef BF_PTR
    return ("blowfish(ptr)");
#elif defined(BF_PTR2)
    return ("blowfish(ptr2)");
#else
    return ("blowfish(idx)");
#endif
}


decompiled_code:
void *DES_options()
{
void *result; // rax

if ( !init_1 )
return &buf_0;
BIO_snprintf(&buf_0, 32LL, "des(%s,%s,%s,%s)", "idx", "cisc", "16", "int");
result = &buf_0;
init_1 = 0;
return result;
}

canonical_decompiled_code:
void *func0()
{
void *result; // rax

if ( !init_1 )
return &buf_0;
BIO_snprintf(&buf_0, 32LL, "des(%s,%s,%s,%s)", "idx", "cisc", "16", "int");
result = &buf_0;
init_1 = 0;
return result;
}

original_code:
const char *DES_options(void)
{
    static int init = 1;
    static char buf[32];

    if (init) {
        const char *ptr, *unroll, *risc, *size;

#ifdef DES_PTR
        ptr = "ptr";
#else
        ptr = "idx";
#endif
#if defined(DES_RISC1) || defined(DES_RISC2)
# ifdef DES_RISC1
        risc = "risc1";
# endif
# ifdef DES_RISC2
        risc = "risc2";
# endif
#else
        risc = "cisc";
#endif
#ifdef DES_UNROLL
        unroll = "16";
#else
        unroll = "2";
#endif
        if (sizeof(DES_LONG) != sizeof(long))
            size = "int";
        else
            size = "long";
        BIO_snprintf(buf, sizeof buf, "des(%s,%s,%s,%s)", ptr, risc, unroll,
                     size);
        init = 0;
    }
    return (buf);
}

canonical_original_code:
char *DES_options()
{
    static int init = 1;
    static char buf[32];

    if (init) {
        char *ptr; char *unroll; char *risc; char *size;

#ifdef DES_PTR
        ptr = "ptr";
#else
        ptr = "idx";
#endif
#if defined(DES_RISC1) || defined(DES_RISC2)
# ifdef DES_RISC1
        risc = "risc1";
# endif
# ifdef DES_RISC2
        risc = "risc2";
# endif
#else
        risc = "cisc";
#endif
#ifdef DES_UNROLL
        unroll = "16";
#else
        unroll = "2";
#endif
        if (sizeof(DES_LONG) != sizeof(long))
            size = "int";
        else
            size = "long";
        BIO_snprintf(buf, sizeof buf, "des(%s,%s,%s,%s)", ptr, risc, unroll,
                     size);
        init = 0;
    }
    return (buf);
}

variable_types: init int

variable_types:
buf
char [32]

variable_types:
ptr
char *

variable_types:
unroll
char *

variable_types:
risc
char *

variable_types:
size
char *


decompiled_code:
__int64 GOST_KEY_INFO_new()
{
return ASN1_item_new(&GOST_KEY_INFO_it);
}

canonical_decompiled_code:
__int64 func6()
{
return ASN1_item_new(&GOST_KEY_INFO_it);
}

original_code: GOST_KEY_INFO *GOST_KEY_INFO_new(void) { return (GOST_KEY_INFO *)ASN1_item_new((&(GOST_KEY_INFO_it))); }

canonical_original_code: struct GOST_KEY_INFO *GOST_KEY_INFO_new() { return (struct GOST_KEY_INFO *)ASN1_item_new((&(GOST_KEY_INFO_it))); }

return_type: struct GOST_KEY_INFO { struct asn1_string_st { int length; int type; unsigned char *data; long flags; } *encrypted_key; struct asn1_string_st *imit; } *

user_defined_types: struct GOST_KEY_INFO { struct asn1_string_st *encrypted_key; struct asn1_string_st *imit; }


decompiled_code:
__int64 GOST_KEY_PARAMS_new()
{
return ASN1_item_new(&GOST_KEY_PARAMS_it);
}

canonical_decompiled_code:
__int64 func14()
{
return ASN1_item_new(&GOST_KEY_PARAMS_it);
}

original_code: GOST_KEY_PARAMS *GOST_KEY_PARAMS_new(void) { return (GOST_KEY_PARAMS *)ASN1_item_new((&(GOST_KEY_PARAMS_it))); }

canonical_original_code: struct GOST_KEY_PARAMS *GOST_KEY_PARAMS_new() { return (struct GOST_KEY_PARAMS *)ASN1_item_new((&(GOST_KEY_PARAMS_it))); }

return_type: struct GOST_KEY_PARAMS { struct asn1_object_st { char *sn; int nid; int length; unsigned char *data; int flags; } *key_params; struct asn1_object_st *hash_params; struct asn1_object_st *cipher_params; } *

user_defined_types: struct GOST_KEY_PARAMS { struct asn1_object_st *key_params; struct asn1_object_st *hash_params; struct asn1_object_st *cipher_params; }


decompiled_code:
__int64 GOST_CIPHER_PARAMS_new()
{
return ASN1_item_new(&GOST_CIPHER_PARAMS_it);
}

canonical_decompiled_code:
__int64 func18()
{
return ASN1_item_new(&GOST_CIPHER_PARAMS_it);
}

original_code: GOST_CIPHER_PARAMS *GOST_CIPHER_PARAMS_new(void) { return (GOST_CIPHER_PARAMS *)ASN1_item_new((&(GOST_CIPHER_PARAMS_it))); }

canonical_original_code: struct GOST_CIPHER_PARAMS *GOST_CIPHER_PARAMS_new() { return (struct GOST_CIPHER_PARAMS *)ASN1_item_new((&(GOST_CIPHER_PARAMS_it))); }

return_type: struct GOST_CIPHER_PARAMS { struct asn1_string_st { int length; int type; unsigned char *data; long flags; } *iv; struct asn1_object_st { char *sn; int nid; int length; unsigned char *data; int flags; } *enc_param_set; } *

user_defined_types: struct GOST_CIPHER_PARAMS { struct asn1_string_st *iv; struct asn1_object_st *enc_param_set; }


decompiled_code:
__int64 OPENSSL_add_all_algorithms_conf()
{
OPENSSL_add_all_algorithms_noconf();
return OPENSSL_config(0LL);
}

canonical_decompiled_code:
__int64 func0()
{
OPENSSL_add_all_algorithms_noconf();
return OPENSSL_config(0LL);
}

original_code:
void OPENSSL_add_all_algorithms_conf(void)
{
    OPENSSL_add_all_algorithms_noconf();
    OPENSSL_config(NULL);
}

canonical_original_code:
void OPENSSL_add_all_algorithms_conf()
{
    OPENSSL_add_all_algorithms_noconf();
    OPENSSL_config(NULL);
}