decompiled_code:
__int64 __fastcall RSA_padding_check_PKCS1_type_2(void *dest, int a2, const void *a3, int a4, int a5)
{
unsigned int v7; // er14
unsigned __int8 *v11; // rax
unsigned __int8 *v12; // rbp
__int64 v13; // rcx
int v14; // esi
int v15; // eax
int v16; // er8
unsigned int v17; // edx
int v18; // eax
int v19; // edx
int v20; // ebx
int v21; // eax
int v22; // edx
int v23; // er10

if ( a2 < 0 || a4 < 0 )
return (unsigned int)-1;
if ( a5 > 10 && a4 <= a5 )
{
v11 = (unsigned __int8 *)CRYPTO_malloc((unsigned int)a5, "rsa_pk1.c", 206LL);
v12 = v11;
if ( !v11 )
{
v7 = -1;
ERR_put_error(4LL, 113LL, 65LL, "rsa_pk1.c", 208LL);
return v7;
}
memset(v11, 0, a5);
memcpy(&v12[a5 - (__int64)a4], a3, a4);
constant_time_is_zero(*v12);
constant_time_eq_constprop_0(v12[1]);
do
{
v14 = v13;
v15 = constant_time_is_zero(v12[v13]);
v18 = constant_time_select_int(v15 & (unsigned int)~v16, v14, v17);
}
while ( a5 > (int)v13 );
constant_time_ge(v18, 10);
v20 = a5 - v19;
v7 = v20;
v21 = constant_time_ge(a2, v20);
if ( (v21 & v23) != 0 )
{
memcpy(dest, &v12[v22], v20);
CRYPTO_free(v12);
if ( v20 != -1 )
return v7;
}
else
{
CRYPTO_free(v12);
}
}
v7 = -1;
ERR_put_error(4LL, 113LL, 159LL, "rsa_pk1.c", 272LL);
return v7;
}

canonical_decompiled_code:
__int64 __fastcall func10(void *dest, int a2, const void *a3, int a4, int a5)
{
unsigned int v7; // er14
unsigned __int8 *v11; // rax
unsigned __int8 *v12; // rbp
__int64 v13; // rcx
int v14; // esi
int v15; // eax
int v16; // er8
unsigned int v17; // edx
int v18; // eax
int v19; // edx
int v20; // ebx
int v21; // eax
int v22; // edx
int v23; // er10

if ( a2 < 0 || a4 < 0 )
return (unsigned int)-1;
if ( a5 > 10 && a4 <= a5 )
{
v11 = (unsigned __int8 *)CRYPTO_malloc((unsigned int)a5, "rsa_pk1.c", 206LL);
v12 = v11;
if ( !v11 )
{
v7 = -1;
ERR_put_error(4LL, 113LL, 65LL, "rsa_pk1.c", 208LL);
return v7;
}
memset(v11, 0, a5);
memcpy(&v12[a5 - (__int64)a4], a3, a4);
func3(*v12);
func6(v12[1]);
do
{
v14 = v13;
v15 = func3(v12[v13]);
v18 = func5(v15 & (unsigned int)~v16, v14, v17);
}
while ( a5 > (int)v13 );
func2(v18, 10);
v20 = a5 - v19;
v7 = v20;
v21 = func2(a2, v20);
if ( (v21 & v23) != 0 )
{
memcpy(dest, &v12[v22], v20);
CRYPTO_free(v12);
if ( v20 != -1 )
return v7;
}
else
{
CRYPTO_free(v12);
}
}
v7 = -1;
ERR_put_error(4LL, 113LL, 159LL, "rsa_pk1.c", 272LL);
return v7;
}

original_code:
int RSA_padding_check_PKCS1_type_2(unsigned char *to, int tlen,
                                   const unsigned char *from, int flen,
                                   int num)
{
    int i;
    /* |em| is the encoded message, zero-padded to exactly |num| bytes */
    unsigned char *em = NULL;
    unsigned int good, found_zero_byte;
    int zero_index = 0, msg_index, mlen = -1;

    if (tlen < 0 || flen < 0)
        return -1;

    /*
     * PKCS#1 v1.5 decryption. See "PKCS #1 v2.2: RSA Cryptography Standard",
     * section 7.2.2.
     */

    if (flen > num)
        goto err;

    if (num < 11)
        goto err;

    em = OPENSSL_malloc(num);
    if (em == NULL) {
        RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2, ERR_R_MALLOC_FAILURE);
        return -1;
    }
    memset(em, 0, num);
    /*
     * Always do this zero-padding copy (even when num == flen) to avoid
     * leaking that information. The copy still leaks some side-channel
     * information, but it's impossible to have a fixed  memory access
     * pattern since we can't read out of the bounds of |from|.
     *
     * TODO(emilia): Consider porting BN_bn2bin_padded from BoringSSL.
     */
    memcpy(em + num - flen, from, flen);

    good = constant_time_is_zero(em[0]);
    good &= constant_time_eq(em[1], 2);

    found_zero_byte = 0;
    for (i = 2; i < num; i++) {
        unsigned int equals0 = constant_time_is_zero(em[i]);
        zero_index =
            constant_time_select_int(~found_zero_byte & equals0, i,
                                     zero_index);
        found_zero_byte |= equals0;
    }

    /*
     * PS must be at least 8 bytes long, and it starts two bytes into |em|.
     * If we never found a 0-byte, then |zero_index| is 0 and the check
     * also fails.
     */
    good &= constant_time_ge((unsigned int)(zero_index), 2 + 8);

    /*
     * Skip the zero byte. This is incorrect if we never found a zero-byte
     * but in this case we also do not copy the message out.
     */
    msg_index = zero_index + 1;
    mlen = num - msg_index;

    /*
     * For good measure, do this check in constant time as well; it could
     * leak something if |tlen| was assuming valid padding.
     */
    good &= constant_time_ge((unsigned int)(tlen), (unsigned int)(mlen));

    /*
     * We can't continue in constant-time because we need to copy the result
     * and we cannot fake its length. This unavoidably leaks timing
     * information at the API boundary.
     * TODO(emilia): this could be addressed at the call site,
     * see BoringSSL commit 0aa0767340baf925bda4804882aab0cb974b2d26.
     */
    if (!good) {
        mlen = -1;
        goto err;
    }

    memcpy(to, em + msg_index, mlen);

 err:
    if (em != NULL)
        OPENSSL_free(em);
    if (mlen == -1)
        RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2,
               RSA_R_PKCS_DECODING_ERROR);
    return mlen;
}

canonical_original_code:
int RSA_padding_check_PKCS1_type_2(unsigned char *to, int tlen, unsigned char *from, int flen, int num)
{
    int i;
    /* |em| is the encoded message, zero-padded to exactly |num| bytes */
    unsigned char *em = NULL;
    unsigned int good; unsigned int found_zero_byte;
    int zero_index = 0; int msg_index; int mlen = -1;

    if (tlen < 0 || flen < 0)
        return -1;

    /*
     * PKCS#1 v1.5 decryption. See "PKCS #1 v2.2: RSA Cryptography Standard",
     * section 7.2.2.
     */

    if (flen > num)
        goto err;

    if (num < 11)
        goto err;

    em = OPENSSL_malloc(num);
    if (em == NULL) {
        RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2, ERR_R_MALLOC_FAILURE);
        return -1;
    }
    memset(em, 0, num);
    /*
     * Always do this zero-padding copy (even when num == flen) to avoid
     * leaking that information. The copy still leaks some side-channel
     * information, but it's impossible to have a fixed  memory access
     * pattern since we can't read out of the bounds of |from|.
     *
     * TODO(emilia): Consider porting BN_bn2bin_padded from BoringSSL.
     */
    memcpy(em + num - flen, from, flen);

    good = constant_time_is_zero(em[0]);
    good &= constant_time_eq(em[1], 2);

    found_zero_byte = 0;
    for (i = 2; i < num; i++) {
        unsigned int equals0 = constant_time_is_zero(em[i]);
        zero_index =
            constant_time_select_int(~found_zero_byte & equals0, i,
                                     zero_index);
        found_zero_byte |= equals0;
    }

    /*
     * PS must be at least 8 bytes long, and it starts two bytes into |em|.
     * If we never found a 0-byte, then |zero_index| is 0 and the check
     * also fails.
     */
    good &= constant_time_ge((unsigned int)(zero_index), 2 + 8);

    /*
     * Skip the zero byte. This is incorrect if we never found a zero-byte
     * but in this case we also do not copy the message out.
     */
    msg_index = zero_index + 1;
    mlen = num - msg_index;

    /*
     * For good measure, do this check in constant time as well; it could
     * leak something if |tlen| was assuming valid padding.
     */
    good &= constant_time_ge((unsigned int)(tlen), (unsigned int)(mlen));

    /*
     * We can't continue in constant-time because we need to copy the result
     * and we cannot fake its length. This unavoidably leaks timing
     * information at the API boundary.
     * TODO(emilia): this could be addressed at the call site,
     * see BoringSSL commit 0aa0767340baf925bda4804882aab0cb974b2d26.
     */
    if (!good) {
        mlen = -1;
        goto err;
    }

    memcpy(to, em + msg_index, mlen);

 err:
    if (em != NULL)
        OPENSSL_free(em);
    if (mlen == -1)
        RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2,
               RSA_R_PKCS_DECODING_ERROR);
    return mlen;
}

variable_types:
em
unsigned char *

variable_types:
good
unsigned int

variable_types: mlen int


decompiled_code:
__int64 __fastcall i2d_ASN1_BOOLEAN(char a1, __int64 *a2)
{
unsigned int v2; // er12
_BYTE *v3; // rax
__int64 v5[4]; // [rsp+8h] [rbp-20h] BYREF

v2 = ASN1_object_size(0LL, 1LL, 1LL);
if ( a2 )
{
v5[0] = *a2;
ASN1_put_object(v5, 0LL, 1LL, 1LL, 0LL);
v3 = (_BYTE *)v5[0]++;
*v3 = a1;
*a2 = v5[0];
}
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func0(char a1, __int64 *a2)
{
unsigned int v2; // er12
_BYTE *v3; // rax
__int64 v5[4]; // [rsp+8h] [rbp-20h] BYREF

v2 = ASN1_object_size(0LL, 1LL, 1LL);
if ( a2 )
{
v5[0] = *a2;
ASN1_put_object(v5, 0LL, 1LL, 1LL, 0LL);
v3 = (_BYTE *)v5[0]++;
*v3 = a1;
*a2 = v5[0];
}
return v2;
}

original_code:
int i2d_ASN1_BOOLEAN(int a, unsigned char **pp)
{
    int r;
    unsigned char *p;

    r = ASN1_object_size(0, 1, V_ASN1_BOOLEAN);
    if (pp == NULL)
        return (r);
    p = *pp;

    ASN1_put_object(&p, 0, 1, V_ASN1_BOOLEAN, V_ASN1_UNIVERSAL);
    *(p++) = (unsigned char)a;
    *pp = p;
    return (r);
}

variable_types: a int

variable_types:
pp
unsigned char **

variable_types: r int

variable_types:
p
unsigned char *

return_type: int


decompiled_code:
__int64 __fastcall d2i_ASN1_BOOLEAN(unsigned int *a1, __int64 *a2, __int64 a3)
{
unsigned __int8 *v3; // rdx
__int64 v4; // rax
unsigned int v5; // er8
__int64 v7; // rdx
int v8; // [rsp+8h] [rbp-30h] BYREF
char v9[4]; // [rsp+Ch] [rbp-2Ch] BYREF
unsigned __int8 *v10; // [rsp+10h] [rbp-28h] BYREF
__int64 v11[4]; // [rsp+18h] [rbp-20h] BYREF

v10 = (unsigned __int8 *)*a2;
if ( (ASN1_get_object(&v10, v11, &v8, v9, a3) & 0x80u) != 0LL )
{
v7 = 102LL;
goto LABEL_9;
}
if ( v8 != 1 )
{
v7 = 117LL;
LABEL_9:
ERR_put_error(13LL, 142LL, v7, "a_bool.c", 109LL);
return (unsigned int)-1;
}
if ( v11[0] != 1 )
{
v7 = 106LL;
goto LABEL_9;
}
v3 = v10;
v4 = (__int64)++v10;
v5 = *v3;
if ( a1 )
*a1 = v5;
*a2 = v4;
return v5;
}

canonical_decompiled_code:
__int64 __fastcall func1(unsigned int *a1, __int64 *a2, __int64 a3)
{
unsigned __int8 *v3; // rdx
__int64 v4; // rax
unsigned int v5; // er8
__int64 v7; // rdx
int v8; // [rsp+8h] [rbp-30h] BYREF
char v9[4]; // [rsp+Ch] [rbp-2Ch] BYREF
unsigned __int8 *v10; // [rsp+10h] [rbp-28h] BYREF
__int64 v11[4]; // [rsp+18h] [rbp-20h] BYREF

v10 = (unsigned __int8 *)*a2;
if ( (ASN1_get_object(&v10, v11, &v8, v9, a3) & 0x80u) != 0LL )
{
v7 = 102LL;
goto LABEL_9;
}
if ( v8 != 1 )
{
v7 = 117LL;
LABEL_9:
ERR_put_error(13LL, 142LL, v7, "a_bool.c", 109LL);
return (unsigned int)-1;
}
if ( v11[0] != 1 )
{
v7 = 106LL;
goto LABEL_9;
}
v3 = v10;
v4 = (__int64)++v10;
v5 = *v3;
if ( a1 )
*a1 = v5;
*a2 = v4;
return v5;
}

original_code:
int d2i_ASN1_BOOLEAN(int *a, const unsigned char **pp, long length)
{
    int ret = -1;
    const unsigned char *p;
    long len;
    int inf, tag, xclass;
    int i = 0;

    p = *pp;
    inf = ASN1_get_object(&p, &len, &tag, &xclass, length);
    if (inf & 0x80) {
        i = ASN1_R_BAD_OBJECT_HEADER;
        goto err;
    }

    if (tag != V_ASN1_BOOLEAN) {
        i = ASN1_R_EXPECTING_A_BOOLEAN;
        goto err;
    }

    if (len != 1) {
        i = ASN1_R_BOOLEAN_IS_WRONG_LENGTH;
        goto err;
    }
    ret = (int)*(p++);
    if (a != NULL)
        (*a) = ret;
    *pp = p;
    return (ret);
 err:
    ASN1err(ASN1_F_D2I_ASN1_BOOLEAN, i);
    return (ret);
}

canonical_original_code:
int d2i_ASN1_BOOLEAN(int *a, unsigned char **pp, long length)
{
    int ret = -1;
    unsigned char *p;
    long len;
    int inf; int tag; int xclass;
    int i = 0;

    p = *pp;
    inf = ASN1_get_object(&p, &len, &tag, &xclass, length);
    if (inf & 0x80) {
        i = ASN1_R_BAD_OBJECT_HEADER;
        goto err;
    }

    if (tag != V_ASN1_BOOLEAN) {
        i = ASN1_R_EXPECTING_A_BOOLEAN;
        goto err;
    }

    if (len != 1) {
        i = ASN1_R_BOOLEAN_IS_WRONG_LENGTH;
        goto err;
    }
    ret = (int)*(p++);
    if (a != NULL)
        (*a) = ret;
    *pp = p;
    return (ret);
 err:
    ASN1err(ASN1_F_D2I_ASN1_BOOLEAN, i);
    return (ret);
}

variable_types:
a
int *

variable_types: length long

variable_types: ret int

variable_types: len long

variable_types: inf int

variable_types: tag int

variable_types: xclass int

variable_types: i int


decompiled_code:
__int64 engine_unregister_all_pkey_asn1_meths()
{
return engine_table_cleanup(&pkey_asn1_meth_table);
}

canonical_decompiled_code:
__int64 func0()
{
return engine_table_cleanup(&pkey_asn1_meth_table);
}

original_code:
static void engine_unregister_all_pkey_asn1_meths(void)
{
    engine_table_cleanup(&pkey_asn1_meth_table);
}

canonical_original_code:
static void engine_unregister_all_pkey_asn1_meths()
{
    engine_table_cleanup(&pkey_asn1_meth_table);
}

return_type: void


decompiled_code:
const char *__fastcall skip_dot(const char *a1)
{
char *v2; // rax
char *v3; // rdi
bool v4; // zf
const char *result; // rax

v2 = strchr(a1, 46);
v3 = v2 + 1;
v4 = v2 == 0LL;
result = a1;
if ( !v4 )
result = v3;
return result;
}

canonical_decompiled_code:
const char *__fastcall func1(const char *a1)
{
char *v2; // rax
char *v3; // rdi
bool v4; // zf
const char *result; // rax

v2 = strchr(a1, 46);
v3 = v2 + 1;
v4 = v2 == 0LL;
result = a1;
if ( !v4 )
result = v3;
return result;
}

original_code:
static char *skip_dot(char *name)
{
    char *p;
    p = strchr(name, '.');
    if (p)
        return p + 1;
    return name;
}

variable_types:
name
char *

variable_types:
p
char *

return_type: char *


decompiled_code:
__int64 ENGINE_add_conf_module()
{
return CONF_module_add("engines", int_engine_module_init, int_engine_module_finish);
}

canonical_decompiled_code:
__int64 func5()
{
return CONF_module_add("engines", int_engine_module_init, int_engine_module_finish);
}

original_code:
void ENGINE_add_conf_module(void)
{
    CONF_module_add("engines",
                    int_engine_module_init, int_engine_module_finish);
}

canonical_original_code:
void ENGINE_add_conf_module()
{
    CONF_module_add("engines",
                    int_engine_module_init, int_engine_module_finish);
}


decompiled_code:
unsigned __int64 OPENSSL_rdtsc()
{
return __rdtsc();
}

canonical_decompiled_code:
unsigned __int64 func1()
{
return __rdtsc();
}

original_code:
unsigned int OPENSSL_rdtsc(void)
{
    if (OPENSSL_armcap_P & ARMV7_TICK)
        return _armv7_tick();
    else
        return 0;
}

canonical_original_code:
unsigned int OPENSSL_rdtsc()
{
    if (OPENSSL_armcap_P & ARMV7_TICK)
        return _armv7_tick();
    else
        return 0;
}

return_type: unsigned int


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

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

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

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

original_code:
void ERR_load_PKCS7_strings(void)
{
#ifndef OPENSSL_NO_ERR

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

canonical_original_code:
void ERR_load_PKCS7_strings()
{
#ifndef OPENSSL_NO_ERR

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


decompiled_code:
void *__fastcall MD4(__int64 a1, __int64 a2, void *a3)
{
void *v3; // rbx
int v4; // er8
void *result; // rax
_BYTE v6[120]; // [rsp+0h] [rbp-78h] BYREF

v3 = a3;
if ( !a3 )
v3 = &m_0;
v4 = MD4_Init(v6);
result = 0LL;
if ( v4 )
{
MD4_Update(v6, a1, a2);
MD4_Final(v3, v6);
OPENSSL_cleanse(v6, 92LL);
result = v3;
}
return result;
}

canonical_decompiled_code:
void *__fastcall func0(__int64 a1, __int64 a2, void *a3)
{
void *v3; // rbx
int v4; // er8
void *result; // rax
_BYTE v6[120]; // [rsp+0h] [rbp-78h] BYREF

v3 = a3;
if ( !a3 )
v3 = &m_0;
v4 = MD4_Init(v6);
result = 0LL;
if ( v4 )
{
MD4_Update(v6, a1, a2);
MD4_Final(v3, v6);
OPENSSL_cleanse(v6, 92LL);
result = v3;
}
return result;
}

original_code:
unsigned char *MD4(const unsigned char *d, size_t n, unsigned char *md)
{
    MD4_CTX c;
    static unsigned char m[16];
    if (md == ((void *)0))
        md = m;
    if (!MD4_Init(&c))
        return ((void *)0);
    MD4_Update(&c, d, n);
    MD4_Final(md, &c);
    OPENSSL_cleanse(&c, sizeof(c));
    return (md);
}

canonical_original_code:
unsigned char *MD4(unsigned char *d, unsigned long n, unsigned char *md)
{
    struct MD4state_st c;
    static unsigned char m[16];
    if (md == ((void *)0))
        md = m;
    if (!MD4_Init(&c))
        return ((void *)0);
    MD4_Update(&c, d, n);
    MD4_Final(md, &c);
    OPENSSL_cleanse(&c, sizeof(c));
    return (md);
}

variable_types:
d
unsigned char *

variable_types:
n
unsigned long

variable_types:
md
unsigned char *

variable_types: struct MD4state_st { unsigned int A; unsigned int Nl; unsigned int data[-1]; unsigned int num; }

variable_types:
m
unsigned char [16]

return_type: unsigned char *


decompiled_code:
__int64 OPENSSL_add_all_algorithms_noconf()
{
OPENSSL_cpuid_setup();
OpenSSL_add_all_ciphers();
return OpenSSL_add_all_digests();
}

canonical_decompiled_code:
__int64 func0()
{
OPENSSL_cpuid_setup();
OpenSSL_add_all_ciphers();
return OpenSSL_add_all_digests();
}

original_code:
void OPENSSL_add_all_algorithms_noconf(void)
{
    /*
     * For the moment OPENSSL_cpuid_setup does something
     * only on IA-32, but we reserve the option for all
     * platforms...
     */
    OPENSSL_cpuid_setup();
    OpenSSL_add_all_ciphers();
    OpenSSL_add_all_digests();
#ifndef OPENSSL_NO_ENGINE
# if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(HAVE_CRYPTODEV)
    ENGINE_setup_bsd_cryptodev();
# endif
#endif
}

canonical_original_code:
void OPENSSL_add_all_algorithms_noconf()
{
    /*
     * For the moment OPENSSL_cpuid_setup does something
     * only on IA-32, but we reserve the option for all
     * platforms...
     */
    OPENSSL_cpuid_setup();
    OpenSSL_add_all_ciphers();
    OpenSSL_add_all_digests();
#ifndef OPENSSL_NO_ENGINE
# if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(HAVE_CRYPTODEV)
    ENGINE_setup_bsd_cryptodev();
# endif
#endif
}


decompiled_code:
__int64 __fastcall UI_UTIL_read_pw_string(__int64 a1, int a2, __int64 a3, int a4)
{
int v5; // edx
unsigned int v6; // er12
_BYTE v8[8200]; // [rsp+0h] [rbp-2008h] BYREF

v5 = 0x2000;
if ( a2 <= 0x2000 )
v5 = a2;
v6 = UI_UTIL_read_pw(a1, (__int64)v8, v5, a3, a4);
OPENSSL_cleanse(v8, 0x2000LL);
return v6;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1, int a2, __int64 a3, int a4)
{
int v5; // edx
unsigned int v6; // er12
_BYTE v8[8200]; // [rsp+0h] [rbp-2008h] BYREF

v5 = 0x2000;
if ( a2 <= 0x2000 )
v5 = a2;
v6 = func0(a1, (__int64)v8, v5, a3, a4);
OPENSSL_cleanse(v8, 0x2000LL);
return v6;
}

original_code:
int UI_UTIL_read_pw_string(char *buf, int length, const char *prompt,
                           int verify)
{
    char buff[BUFSIZ];
    int ret;

    ret =
        UI_UTIL_read_pw(buf, buff, (length > BUFSIZ) ? BUFSIZ : length,
                        prompt, verify);
    OPENSSL_cleanse(buff, BUFSIZ);
    return (ret);
}

canonical_original_code:
int UI_UTIL_read_pw_string(char *buf, int length, char *prompt, int verify)
{
    char buff[-1];
    int ret;

    ret =
        UI_UTIL_read_pw(buf, buff, (length > BUFSIZ) ? BUFSIZ : length,
                        prompt, verify);
    OPENSSL_cleanse(buff, BUFSIZ);
    return (ret);
}

variable_types:
buf
char *

variable_types: length int

variable_types:
prompt
char *

variable_types: verify int

variable_types:
buff
char [-1]


decompiled_code:
void ENGINE_load_padlock()
{
;
}

canonical_decompiled_code:
void func0()
{
;
}

original_code:
void ENGINE_load_padlock(void)
{
}

canonical_original_code:
void ENGINE_load_padlock()
{
}


decompiled_code:
__int64 __fastcall ssl_mt_error(int a1)
{
__int64 v1; // rdi
__int64 result; // rax

v1 = (unsigned int)(a1 - 1);
result = 253LL;
if ( (unsigned int)v1 <= 5 )
result = (unsigned int)CSWTCH_29[v1];
return result;
}

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

v1 = (unsigned int)(a1 - 1);
result = 253LL;
if ( (unsigned int)v1 <= 5 )
result = (unsigned int)CSWTCH_29[v1];
return result;
}

original_code:
static int ssl_mt_error(int n)
{
    int ret;
    switch (n) {
    case 0x0001:
        ret = 203;
        break;
    case 0x0002:
        ret = 202;
        break;
    case 0x0004:
        ret = 201;
        break;
    case 0x0006:
        ret = 204;
        break;
    default:
        ret = 253;
        break;
    }
    return (ret);
}

variable_types: n int

variable_types: ret int


decompiled_code:
__int64 __fastcall int_def_cb(char *s1, int a2, _DWORD *a3)
{
unsigned __int64 v4; // rdx
unsigned __int64 v5; // rcx
unsigned __int64 v7; // rbx
unsigned __int64 v8; // rcx
__int64 result; // rax
unsigned __int64 v10; // rdx
unsigned __int64 v11; // rcx
unsigned __int64 v12; // rcx
unsigned __int64 v13; // rcx
unsigned __int64 v14; // rax
unsigned __int64 v15; // rcx
unsigned __int64 v16; // rcx
size_t v17; // rdx
size_t v18; // rdx

if ( !s1 )
return 0LL;
v4 = 4LL;
v5 = 4LL;
v7 = a2;
if ( (unsigned __int64)a2 <= 4 )
v5 = a2;
if ( !memcmp(s1, &unk_53A, v5) )
{
*a3 |= 0xFFFFu;
result = 1LL;
}
else
{
v8 = 4LL;
if ( v7 <= 4 )
v8 = v7;
if ( !memcmp(s1, &unk_53E, v8) )
{
*a3 |= 1u;
result = 1LL;
}
else
{
if ( v7 <= 4 )
v4 = v7;
if ( !memcmp(s1, &unk_542, v4) )
{
*a3 |= 2u;
result = 1LL;
}
else
{
v10 = 5LL;
v11 = 5LL;
if ( v7 <= 5 )
v11 = v7;
if ( !memcmp(s1, "ECDH", v11) )
{
*a3 |= 0x10u;
result = 1LL;
}
else
{
v12 = 6LL;
if ( v7 <= 6 )
v12 = v7;
if ( !memcmp(s1, "ECDSA", v12) )
{
*a3 |= 0x20u;
result = 1LL;
}
else
{
v13 = 3LL;
if ( v7 <= 3 )
v13 = v7;
if ( !memcmp(s1, "DH", v13) )
{
*a3 |= 4u;
result = 1LL;
}
else
{
if ( v7 <= 5 )
v10 = v7;
if ( !memcmp(s1, "RAND", v10) )
{
*a3 |= 8u;
result = 1LL;
}
else
{
v14 = 8LL;
v15 = 8LL;
if ( v7 <= 8 )
v15 = v7;
if ( !memcmp(s1, "CIPHERS", v15) )
{
*a3 |= 0x40u;
result = 1LL;
}
else
{
if ( v7 <= 8 )
v14 = v7;
if ( !memcmp(s1, "DIGESTS", v14) )
{
*a3 |= 0x80u;
result = 1LL;
}
else
{
v16 = 5LL;
if ( v7 <= 5 )
v16 = v7;
if ( !memcmp(s1, "PKEY", v16) )
{
*a3 |= 0x600u;
result = 1LL;
}
else
{
v17 = 12LL;
if ( v7 <= 0xC )
v17 = v7;
if ( !strncmp(s1, "PKEY_CRYPTO", v17) )
{
*a3 |= 0x200u;
result = 1LL;
}
else
{
v18 = 10LL;
if ( v7 <= 0xA )
v18 = v7;
if ( !strncmp(s1, "PKEY_ASN1", v18) )
{
*a3 |= 0x400u;
result = 1LL;
}
else
{
result = 0LL;
}
}
}
}
}
}
}
}
}
}
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(char *s1, int a2, _DWORD *a3)
{
unsigned __int64 v4; // rdx
unsigned __int64 v5; // rcx
unsigned __int64 v7; // rbx
unsigned __int64 v8; // rcx
__int64 result; // rax
unsigned __int64 v10; // rdx
unsigned __int64 v11; // rcx
unsigned __int64 v12; // rcx
unsigned __int64 v13; // rcx
unsigned __int64 v14; // rax
unsigned __int64 v15; // rcx
unsigned __int64 v16; // rcx
size_t v17; // rdx
size_t v18; // rdx

if ( !s1 )
return 0LL;
v4 = 4LL;
v5 = 4LL;
v7 = a2;
if ( (unsigned __int64)a2 <= 4 )
v5 = a2;
if ( !memcmp(s1, &unk_53A, v5) )
{
*a3 |= 0xFFFFu;
result = 1LL;
}
else
{
v8 = 4LL;
if ( v7 <= 4 )
v8 = v7;
if ( !memcmp(s1, &unk_53E, v8) )
{
*a3 |= 1u;
result = 1LL;
}
else
{
if ( v7 <= 4 )
v4 = v7;
if ( !memcmp(s1, &unk_542, v4) )
{
*a3 |= 2u;
result = 1LL;
}
else
{
v10 = 5LL;
v11 = 5LL;
if ( v7 <= 5 )
v11 = v7;
if ( !memcmp(s1, "ECDH", v11) )
{
*a3 |= 0x10u;
result = 1LL;
}
else
{
v12 = 6LL;
if ( v7 <= 6 )
v12 = v7;
if ( !memcmp(s1, "ECDSA", v12) )
{
*a3 |= 0x20u;
result = 1LL;
}
else
{
v13 = 3LL;
if ( v7 <= 3 )
v13 = v7;
if ( !memcmp(s1, "DH", v13) )
{
*a3 |= 4u;
result = 1LL;
}
else
{
if ( v7 <= 5 )
v10 = v7;
if ( !memcmp(s1, "RAND", v10) )
{
*a3 |= 8u;
result = 1LL;
}
else
{
v14 = 8LL;
v15 = 8LL;
if ( v7 <= 8 )
v15 = v7;
if ( !memcmp(s1, "CIPHERS", v15) )
{
*a3 |= 0x40u;
result = 1LL;
}
else
{
if ( v7 <= 8 )
v14 = v7;
if ( !memcmp(s1, "DIGESTS", v14) )
{
*a3 |= 0x80u;
result = 1LL;
}
else
{
v16 = 5LL;
if ( v7 <= 5 )
v16 = v7;
if ( !memcmp(s1, "PKEY", v16) )
{
*a3 |= 0x600u;
result = 1LL;
}
else
{
v17 = 12LL;
if ( v7 <= 0xC )
v17 = v7;
if ( !strncmp(s1, "PKEY_CRYPTO", v17) )
{
*a3 |= 0x200u;
result = 1LL;
}
else
{
v18 = 10LL;
if ( v7 <= 0xA )
v18 = v7;
if ( !strncmp(s1, "PKEY_ASN1", v18) )
{
*a3 |= 0x400u;
result = 1LL;
}
else
{
result = 0LL;
}
}
}
}
}
}
}
}
}
}
}
}
return result;
}

original_code:
static int int_def_cb(const char *alg, int len, void *arg)
{
    unsigned int *pflags = arg;
    if (alg == NULL)
        return 0;
    if (!strncmp(alg, "ALL", len))
        *pflags |= ENGINE_METHOD_ALL;
    else if (!strncmp(alg, "RSA", len))
        *pflags |= ENGINE_METHOD_RSA;
    else if (!strncmp(alg, "DSA", len))
        *pflags |= ENGINE_METHOD_DSA;
    else if (!strncmp(alg, "ECDH", len))
        *pflags |= ENGINE_METHOD_ECDH;
    else if (!strncmp(alg, "ECDSA", len))
        *pflags |= ENGINE_METHOD_ECDSA;
    else if (!strncmp(alg, "DH", len))
        *pflags |= ENGINE_METHOD_DH;
    else if (!strncmp(alg, "RAND", len))
        *pflags |= ENGINE_METHOD_RAND;
    else if (!strncmp(alg, "CIPHERS", len))
        *pflags |= ENGINE_METHOD_CIPHERS;
    else if (!strncmp(alg, "DIGESTS", len))
        *pflags |= ENGINE_METHOD_DIGESTS;
    else if (!strncmp(alg, "PKEY", len))
        *pflags |= ENGINE_METHOD_PKEY_METHS | ENGINE_METHOD_PKEY_ASN1_METHS;
    else if (!strncmp(alg, "PKEY_CRYPTO", len))
        *pflags |= ENGINE_METHOD_PKEY_METHS;
    else if (!strncmp(alg, "PKEY_ASN1", len))
        *pflags |= ENGINE_METHOD_PKEY_ASN1_METHS;
    else
        return 0;
    return 1;
}

canonical_original_code:
static int int_def_cb(char *alg, int len, void *arg)
{
    unsigned int *pflags = arg;
    if (alg == NULL)
        return 0;
    if (!strncmp(alg, "ALL", len))
        *pflags |= ENGINE_METHOD_ALL;
    else if (!strncmp(alg, "RSA", len))
        *pflags |= ENGINE_METHOD_RSA;
    else if (!strncmp(alg, "DSA", len))
        *pflags |= ENGINE_METHOD_DSA;
    else if (!strncmp(alg, "ECDH", len))
        *pflags |= ENGINE_METHOD_ECDH;
    else if (!strncmp(alg, "ECDSA", len))
        *pflags |= ENGINE_METHOD_ECDSA;
    else if (!strncmp(alg, "DH", len))
        *pflags |= ENGINE_METHOD_DH;
    else if (!strncmp(alg, "RAND", len))
        *pflags |= ENGINE_METHOD_RAND;
    else if (!strncmp(alg, "CIPHERS", len))
        *pflags |= ENGINE_METHOD_CIPHERS;
    else if (!strncmp(alg, "DIGESTS", len))
        *pflags |= ENGINE_METHOD_DIGESTS;
    else if (!strncmp(alg, "PKEY", len))
        *pflags |= ENGINE_METHOD_PKEY_METHS | ENGINE_METHOD_PKEY_ASN1_METHS;
    else if (!strncmp(alg, "PKEY_CRYPTO", len))
        *pflags |= ENGINE_METHOD_PKEY_METHS;
    else if (!strncmp(alg, "PKEY_ASN1", len))
        *pflags |= ENGINE_METHOD_PKEY_ASN1_METHS;
    else
        return 0;
    return 1;
}

variable_types:
alg
char *

variable_types: len int

variable_types:
arg
void *

variable_types:
pflags
unsigned int *


decompiled_code:
__int64 __fastcall ASN1_PRINTABLE_type(unsigned __int8 *a1, int a2)
{
unsigned __int64 v2; // rax
__int64 v3; // rsi
__int64 v4; // r10
int v5; // ecx
int v6; // er8
unsigned __int64 v7; // r11
bool v8; // sf
__int64 result; // rax

if ( a2 <= 0 )
{
if ( a1 )
{
v2 = *a1;
v3 = 4294967294LL;
if ( (_BYTE)v2 )
goto LABEL_5;
}
return 19LL;
}
if ( !a1 )
return 19LL;
v2 = *a1;
if ( !(_BYTE)v2 )
return 19LL;
v3 = (unsigned int)(a2 - 1);
LABEL_5:
v4 = (__int64)&a1[v3 + 1];
v5 = 0;
v6 = 0;
v7 = 0xA7FFFB8100000000LL;
do
{
++a1;
if ( (unsigned __int8)v2 <= 0x3Fu )
{
if ( !_bittest64((const __int64 *)&v7, v2) && (unsigned __int8)((v2 & 0xDF) - 65) > 0x19u )
{
v2 = *a1;
v6 = 1;
if ( !(_BYTE)v2 )
break;
continue;
}
}
else if ( (unsigned __int8)((v2 & 0xDF) - 65) >= 0x1Au )
{
v6 = 1;
}
v8 = (v2 & 0x80u) != 0LL;
v2 = *a1;
if ( v8 )
v5 = 1;
if ( !(_BYTE)v2 )
break;
}
while ( a1 != (unsigned __int8 *)v4 );
result = 20LL;
if ( !v5 )
result = v6 == 0 ? 19 : 22;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(unsigned __int8 *a1, int a2)
{
unsigned __int64 v2; // rax
__int64 v3; // rsi
__int64 v4; // r10
int v5; // ecx
int v6; // er8
unsigned __int64 v7; // r11
bool v8; // sf
__int64 result; // rax

if ( a2 <= 0 )
{
if ( a1 )
{
v2 = *a1;
v3 = 4294967294LL;
if ( (_BYTE)v2 )
goto LABEL_5;
}
return 19LL;
}
if ( !a1 )
return 19LL;
v2 = *a1;
if ( !(_BYTE)v2 )
return 19LL;
v3 = (unsigned int)(a2 - 1);
LABEL_5:
v4 = (__int64)&a1[v3 + 1];
v5 = 0;
v6 = 0;
v7 = 0xA7FFFB8100000000LL;
do
{
++a1;
if ( (unsigned __int8)v2 <= 0x3Fu )
{
if ( !_bittest64((const __int64 *)&v7, v2) && (unsigned __int8)((v2 & 0xDF) - 65) > 0x19u )
{
v2 = *a1;
v6 = 1;
if ( !(_BYTE)v2 )
break;
continue;
}
}
else if ( (unsigned __int8)((v2 & 0xDF) - 65) >= 0x1Au )
{
v6 = 1;
}
v8 = (v2 & 0x80u) != 0LL;
v2 = *a1;
if ( v8 )
v5 = 1;
if ( !(_BYTE)v2 )
break;
}
while ( a1 != (unsigned __int8 *)v4 );
result = 20LL;
if ( !v5 )
result = v6 == 0 ? 19 : 22;
return result;
}

variable_types:
s
unsigned char *

variable_types: c int


decompiled_code:
// attributes: thunk
_QWORD *ecdh_data_new()
{
return ECDH_DATA_new_method_constprop_0();
}

canonical_decompiled_code:
_QWORD *func4()
{
return func3();
}

original_code:
static void *ecdh_data_new(void)
{
    return (void *)ECDH_DATA_new_method(NULL);
}

canonical_original_code:
static void *ecdh_data_new()
{
    return (void *)ECDH_DATA_new_method(NULL);
}

return_type: void *


decompiled_code:
__int64 engine_unregister_all_STORE()
{
return engine_table_cleanup(&store_table);
}

canonical_decompiled_code:
__int64 func0()
{
return engine_table_cleanup(&store_table);
}

original_code:
static void engine_unregister_all_STORE(void)
{
    engine_table_cleanup(&store_table);
}

canonical_original_code:
static void engine_unregister_all_STORE()
{
    engine_table_cleanup(&store_table);
}


decompiled_code:
__int64 OPENSSL_load_builtin_modules()
{
ASN1_add_oid_module();
ENGINE_add_conf_module();
return EVP_add_alg_module();
}

canonical_decompiled_code:
__int64 func0()
{
ASN1_add_oid_module();
ENGINE_add_conf_module();
return EVP_add_alg_module();
}

original_code:
void OPENSSL_load_builtin_modules(void)
{
    /* Add builtin modules here */
    ASN1_add_oid_module();
#ifndef OPENSSL_NO_ENGINE
    ENGINE_add_conf_module();
#endif
    EVP_add_alg_module();
}

canonical_original_code:
void OPENSSL_load_builtin_modules()
{
    /* Add builtin modules here */
    ASN1_add_oid_module();
#ifndef OPENSSL_NO_ENGINE
    ENGINE_add_conf_module();
#endif
    EVP_add_alg_module();
}


decompiled_code:
// attributes: thunk
_QWORD *ecdsa_data_new()
{
return ECDSA_DATA_new_method_constprop_0();
}

original_code:
static void *ecdsa_data_new(void)
{
    return (void *)ECDSA_DATA_new_method(NULL);
}

canonical_original_code:
static void *ecdsa_data_new()
{
    return (void *)ECDSA_DATA_new_method(NULL);
}


decompiled_code:
__int64 ENGINE_get_table_flags()
{
return (unsigned int)table_flags;
}

canonical_decompiled_code:
__int64 func11()
{
return (unsigned int)table_flags;
}

original_code:
unsigned int ENGINE_get_table_flags(void)
{
    return table_flags;
}

canonical_original_code:
unsigned int ENGINE_get_table_flags()
{
    return table_flags;
}


decompiled_code:
void __fastcall ENGINE_set_table_flags(int a1)
{
table_flags = a1;
}

canonical_decompiled_code:
void __fastcall func12(int a1)
{
table_flags = a1;
}

original_code:
void ENGINE_set_table_flags(unsigned int flags)
{
    table_flags = flags;
}

variable_types:
flags
unsigned int


decompiled_code:
__int64 engine_unregister_all_DH()
{
return engine_table_cleanup(&dh_table);
}

canonical_decompiled_code:
__int64 func0()
{
return engine_table_cleanup(&dh_table);
}

original_code:
static void engine_unregister_all_DH(void)
{
    engine_table_cleanup(&dh_table);
}

canonical_original_code:
static void engine_unregister_all_DH()
{
    engine_table_cleanup(&dh_table);
}


decompiled_code:
__int64 ERR_load_crypto_strings()
{
ERR_load_ERR_strings();
ERR_load_BN_strings();
ERR_load_RSA_strings();
ERR_load_DH_strings();
ERR_load_EVP_strings();
ERR_load_BUF_strings();
ERR_load_OBJ_strings();
ERR_load_PEM_strings();
ERR_load_DSA_strings();
ERR_load_X509_strings();
ERR_load_ASN1_strings();
ERR_load_CONF_strings();
ERR_load_CRYPTO_strings();
ERR_load_COMP_strings();
ERR_load_EC_strings();
ERR_load_ECDSA_strings();
ERR_load_ECDH_strings();
ERR_load_BIO_strings();
ERR_load_PKCS7_strings();
ERR_load_X509V3_strings();
ERR_load_PKCS12_strings();
ERR_load_RAND_strings();
ERR_load_DSO_strings();
ERR_load_TS_strings();
ERR_load_ENGINE_strings();
ERR_load_OCSP_strings();
ERR_load_UI_strings();
return ERR_load_CMS_strings();
}

canonical_decompiled_code:
__int64 func0()
{
ERR_load_ERR_strings();
ERR_load_BN_strings();
ERR_load_RSA_strings();
ERR_load_DH_strings();
ERR_load_EVP_strings();
ERR_load_BUF_strings();
ERR_load_OBJ_strings();
ERR_load_PEM_strings();
ERR_load_DSA_strings();
ERR_load_X509_strings();
ERR_load_ASN1_strings();
ERR_load_CONF_strings();
ERR_load_CRYPTO_strings();
ERR_load_COMP_strings();
ERR_load_EC_strings();
ERR_load_ECDSA_strings();
ERR_load_ECDH_strings();
ERR_load_BIO_strings();
ERR_load_PKCS7_strings();
ERR_load_X509V3_strings();
ERR_load_PKCS12_strings();
ERR_load_RAND_strings();
ERR_load_DSO_strings();
ERR_load_TS_strings();
ERR_load_ENGINE_strings();
ERR_load_OCSP_strings();
ERR_load_UI_strings();
return ERR_load_CMS_strings();
}

original_code:
void ERR_load_crypto_strings(void)
{
#ifndef OPENSSL_NO_ERR
    ERR_load_ERR_strings();     /* include error strings for SYSerr */
    ERR_load_BN_strings();
# ifndef OPENSSL_NO_RSA
    ERR_load_RSA_strings();
# endif
# ifndef OPENSSL_NO_DH
    ERR_load_DH_strings();
# endif
    ERR_load_EVP_strings();
    ERR_load_BUF_strings();
    ERR_load_OBJ_strings();
    ERR_load_PEM_strings();
# ifndef OPENSSL_NO_DSA
    ERR_load_DSA_strings();
# endif
    ERR_load_X509_strings();
    ERR_load_ASN1_strings();
    ERR_load_CONF_strings();
    ERR_load_CRYPTO_strings();
# ifndef OPENSSL_NO_COMP
    ERR_load_COMP_strings();
# endif
# ifndef OPENSSL_NO_EC
    ERR_load_EC_strings();
# endif
# ifndef OPENSSL_NO_ECDSA
    ERR_load_ECDSA_strings();
# endif
# ifndef OPENSSL_NO_ECDH
    ERR_load_ECDH_strings();
# endif
    /* skip ERR_load_SSL_strings() because it is not in this library */
    ERR_load_BIO_strings();
    ERR_load_PKCS7_strings();
    ERR_load_X509V3_strings();
    ERR_load_PKCS12_strings();
    ERR_load_RAND_strings();
    ERR_load_DSO_strings();
    ERR_load_TS_strings();
# ifndef OPENSSL_NO_ENGINE
    ERR_load_ENGINE_strings();
# endif
    ERR_load_OCSP_strings();
    ERR_load_UI_strings();
# ifdef OPENSSL_FIPS
    ERR_load_FIPS_strings();
# endif
# ifndef OPENSSL_NO_CMS
    ERR_load_CMS_strings();
# endif
# ifndef OPENSSL_NO_JPAKE
    ERR_load_JPAKE_strings();
# endif
#endif
}

canonical_original_code:
void ERR_load_crypto_strings()
{
#ifndef OPENSSL_NO_ERR
    ERR_load_ERR_strings();     /* include error strings for SYSerr */
    ERR_load_BN_strings();
# ifndef OPENSSL_NO_RSA
    ERR_load_RSA_strings();
# endif
# ifndef OPENSSL_NO_DH
    ERR_load_DH_strings();
# endif
    ERR_load_EVP_strings();
    ERR_load_BUF_strings();
    ERR_load_OBJ_strings();
    ERR_load_PEM_strings();
# ifndef OPENSSL_NO_DSA
    ERR_load_DSA_strings();
# endif
    ERR_load_X509_strings();
    ERR_load_ASN1_strings();
    ERR_load_CONF_strings();
    ERR_load_CRYPTO_strings();
# ifndef OPENSSL_NO_COMP
    ERR_load_COMP_strings();
# endif
# ifndef OPENSSL_NO_EC
    ERR_load_EC_strings();
# endif
# ifndef OPENSSL_NO_ECDSA
    ERR_load_ECDSA_strings();
# endif
# ifndef OPENSSL_NO_ECDH
    ERR_load_ECDH_strings();
# endif
    /* skip ERR_load_SSL_strings() because it is not in this library */
    ERR_load_BIO_strings();
    ERR_load_PKCS7_strings();
    ERR_load_X509V3_strings();
    ERR_load_PKCS12_strings();
    ERR_load_RAND_strings();
    ERR_load_DSO_strings();
    ERR_load_TS_strings();
# ifndef OPENSSL_NO_ENGINE
    ERR_load_ENGINE_strings();
# endif
    ERR_load_OCSP_strings();
    ERR_load_UI_strings();
# ifdef OPENSSL_FIPS
    ERR_load_FIPS_strings();
# endif
# ifndef OPENSSL_NO_CMS
    ERR_load_CMS_strings();
# endif
# ifndef OPENSSL_NO_JPAKE
    ERR_load_JPAKE_strings();
# endif
#endif
}


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

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

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

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

original_code:
void ERR_load_CONF_strings(void)
{
#ifndef OPENSSL_NO_ERR

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

canonical_original_code:
void ERR_load_CONF_strings()
{
#ifndef OPENSSL_NO_ERR

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


decompiled_code:
__int64 engine_unregister_all_digests()
{
return engine_table_cleanup(&digest_table);
}

canonical_decompiled_code:
__int64 func0()
{
return engine_table_cleanup(&digest_table);
}

original_code:
static void engine_unregister_all_digests(void)
{
    engine_table_cleanup(&digest_table);
}

canonical_original_code:
static void engine_unregister_all_digests()
{
    engine_table_cleanup(&digest_table);
}


decompiled_code:
__int64 __fastcall ENGINE_init(__int64 a1)
{
unsigned int v1; // er12
__int64 result; // rax

if ( a1 )
{
CRYPTO_lock(9LL, 30LL, "eng_init.c", 134LL);
v1 = engine_unlocked_init(a1);
CRYPTO_lock(10LL, 30LL, "eng_init.c", 136LL);
result = v1;
}
else
{
ERR_put_error(38LL, 119LL, 67LL, "eng_init.c", 131LL);
result = 0LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1)
{
unsigned int v1; // er12
__int64 result; // rax

if ( a1 )
{
CRYPTO_lock(9LL, 30LL, "eng_init.c", 134LL);
v1 = func0(a1);
CRYPTO_lock(10LL, 30LL, "eng_init.c", 136LL);
result = v1;
}
else
{
ERR_put_error(38LL, 119LL, 67LL, "eng_init.c", 131LL);
result = 0LL;
}
return result;
}

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

canonical_original_code: char ENGINE_init() {return 0;}

return_type: char


decompiled_code:
_BOOL8 OPENSSL_issetugid()
{
__uid_t v0; // ebx
__uid_t v1; // er8
_BOOL8 result; // rax
__gid_t v3; // ebx

v0 = getuid();
v1 = geteuid();
result = 1LL;
if ( v0 == v1 )
{
v3 = getgid();
result = v3 != getegid();
}
return result;
}

canonical_decompiled_code:
_BOOL8 func0()
{
__uid_t v0; // ebx
__uid_t v1; // er8
_BOOL8 result; // rax
__gid_t v3; // ebx

v0 = getuid();
v1 = geteuid();
result = 1LL;
if ( v0 == v1 )
{
v3 = getgid();
result = v3 != getegid();
}
return result;
}

original_code:
int OPENSSL_issetugid(void)
{
    if (getuid() != geteuid())
        return 1;
    if (getgid() != getegid())
        return 1;
    return 0;
}

canonical_original_code:
int OPENSSL_issetugid()
{
    if (getuid() != geteuid())
        return 1;
    if (getgid() != getegid())
        return 1;
    return 0;
}


decompiled_code:
__int64 __fastcall parse_http_line1(char *nptr)
{
__int64 v1; // rbx
char *v2; // r12
const unsigned __int16 **v3; // rax
const unsigned __int16 *v4; // rdx
const unsigned __int16 **v5; // rbp
__int64 v6; // rax
__int64 v7; // r8
__int64 result; // rax
__int64 v9; // rax
const char *v10; // rbx
const char *v11; // r13
int v12; // er14
__int64 v13; // rax
const unsigned __int16 *v14; // r13
char *v15; // rax
__int64 v16; // rcx
__int64 v17; // r8
char *endptr; // [rsp+8h] [rbp-30h] BYREF

v1 = (unsigned __int8)*nptr;
if ( !(_BYTE)v1 )
{
LABEL_10:
v7 = 202LL;
LABEL_11:
ERR_put_error(39LL, 118LL, 115LL, "ocsp_ht.c", v7);
return 0LL;
}
v2 = nptr;
v3 = _ctype_b_loc();
v4 = *v3;
v5 = v3;
while ( (v4[v1] & 0x2000) == 0 )
{
v1 = (unsigned __int8)*++v2;
if ( !(_BYTE)v1 )
goto LABEL_10;
}
while ( 1 )
{
v6 = (unsigned __int8)*v2;
if ( !(_BYTE)v6 )
{
v7 = 211LL;
goto LABEL_11;
}
if ( (v4[v6] & 0x2000) == 0 )
break;
++v2;
}
v9 = (unsigned __int8)*v2;
v10 = v2;
if ( !(_BYTE)v9 )
{
LABEL_28:
v7 = 220LL;
goto LABEL_11;
}
while ( 1 )
{
v11 = v10++;
if ( (v4[v9] & 0x2000) != 0 )
break;
v9 = *(unsigned __int8 *)v10;
if ( !(_BYTE)v9 )
goto LABEL_28;
}
*v11 = 0;
v12 = strtoul(v2, &endptr, 10);
result = 0LL;
if ( !*endptr )
{
v13 = *((unsigned __int8 *)v11 + 1);
if ( (_BYTE)v13 )
{
v14 = *v5;
while ( (v14[v13] & 0x2000) != 0 )
{
v13 = *(unsigned __int8 *)++v10;
if ( !(_BYTE)v13 )
goto LABEL_23;
}
v15 = (char *)&v10[strlen(v10) - 1];
endptr = v15;
while ( (v14[(unsigned __int8)*v15] & 0x2000) != 0 )
{
*v15 = 0;
v14 = *v5;
v15 = --endptr;
}
}
LABEL_23:
result = 1LL;
if ( v12 != 200 )
{
ERR_put_error(39LL, 118LL, 114LL, "ocsp_ht.c", 247LL);
if ( *v10 )
ERR_add_error_data(4LL, "Code=", v2, ",Reason=", v10);
else
ERR_add_error_data(2LL, "Code=", v2, v16, v17);
result = 0LL;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(char *nptr)
{
__int64 v1; // rbx
char *v2; // r12
const unsigned __int16 **v3; // rax
const unsigned __int16 *v4; // rdx
const unsigned __int16 **v5; // rbp
__int64 v6; // rax
__int64 v7; // r8
__int64 result; // rax
__int64 v9; // rax
const char *v10; // rbx
const char *v11; // r13
int v12; // er14
__int64 v13; // rax
const unsigned __int16 *v14; // r13
char *v15; // rax
__int64 v16; // rcx
__int64 v17; // r8
char *endptr; // [rsp+8h] [rbp-30h] BYREF

v1 = (unsigned __int8)*nptr;
if ( !(_BYTE)v1 )
{
LABEL_10:
v7 = 202LL;
LABEL_11:
ERR_put_error(39LL, 118LL, 115LL, "ocsp_ht.c", v7);
return 0LL;
}
v2 = nptr;
v3 = _ctype_b_loc();
v4 = *v3;
v5 = v3;
while ( (v4[v1] & 0x2000) == 0 )
{
v1 = (unsigned __int8)*++v2;
if ( !(_BYTE)v1 )
goto LABEL_10;
}
while ( 1 )
{
v6 = (unsigned __int8)*v2;
if ( !(_BYTE)v6 )
{
v7 = 211LL;
goto LABEL_11;
}
if ( (v4[v6] & 0x2000) == 0 )
break;
++v2;
}
v9 = (unsigned __int8)*v2;
v10 = v2;
if ( !(_BYTE)v9 )
{
LABEL_28:
v7 = 220LL;
goto LABEL_11;
}
while ( 1 )
{
v11 = v10++;
if ( (v4[v9] & 0x2000) != 0 )
break;
v9 = *(unsigned __int8 *)v10;
if ( !(_BYTE)v9 )
goto LABEL_28;
}
*v11 = 0;
v12 = strtoul(v2, &endptr, 10);
result = 0LL;
if ( !*endptr )
{
v13 = *((unsigned __int8 *)v11 + 1);
if ( (_BYTE)v13 )
{
v14 = *v5;
while ( (v14[v13] & 0x2000) != 0 )
{
v13 = *(unsigned __int8 *)++v10;
if ( !(_BYTE)v13 )
goto LABEL_23;
}
v15 = (char *)&v10[strlen(v10) - 1];
endptr = v15;
while ( (v14[(unsigned __int8)*v15] & 0x2000) != 0 )
{
*v15 = 0;
v14 = *v5;
v15 = --endptr;
}
}
LABEL_23:
result = 1LL;
if ( v12 != 200 )
{
ERR_put_error(39LL, 118LL, 114LL, "ocsp_ht.c", 247LL);
if ( *v10 )
ERR_add_error_data(4LL, "Code=", v2, ",Reason=", v10);
else
ERR_add_error_data(2LL, "Code=", v2, v16, v17);
result = 0LL;
}
}
return result;
}

original_code:
static int parse_http_line1(char *line)
{
    int retcode;
    char *p, *q, *r;
    /* Skip to first white space (passed protocol info) */

    for (p = line; *p && !isspace((unsigned char)*p); p++)
        continue;
    if (!*p) {
        OCSPerr(OCSP_F_PARSE_HTTP_LINE1, OCSP_R_SERVER_RESPONSE_PARSE_ERROR);
        return 0;
    }

    /* Skip past white space to start of response code */
    while (*p && isspace((unsigned char)*p))
        p++;

    if (!*p) {
        OCSPerr(OCSP_F_PARSE_HTTP_LINE1, OCSP_R_SERVER_RESPONSE_PARSE_ERROR);
        return 0;
    }

    /* Find end of response code: first whitespace after start of code */
    for (q = p; *q && !isspace((unsigned char)*q); q++)
        continue;

    if (!*q) {
        OCSPerr(OCSP_F_PARSE_HTTP_LINE1, OCSP_R_SERVER_RESPONSE_PARSE_ERROR);
        return 0;
    }

    /* Set end of response code and start of message */
    *q++ = 0;

    /* Attempt to parse numeric code */
    retcode = strtoul(p, &r, 10);

    if (*r)
        return 0;

    /* Skip over any leading white space in message */
    while (*q && isspace((unsigned char)*q))
        q++;

    if (*q) {
        /*
         * Finally zap any trailing white space in message (include CRLF)
         */

        /* We know q has a non white space character so this is OK */
        for (r = q + strlen(q) - 1; isspace((unsigned char)*r); r--)
            *r = 0;
    }
    if (retcode != 200) {
        OCSPerr(OCSP_F_PARSE_HTTP_LINE1, OCSP_R_SERVER_RESPONSE_ERROR);
        if (!*q)
            ERR_add_error_data(2, "Code=", p);
        else
            ERR_add_error_data(4, "Code=", p, ",Reason=", q);
        return 0;
    }

    return 1;

}

canonical_original_code:
static int parse_http_line1(char *line)
{
    int retcode;
    char *p; char *q; char *r;
    /* Skip to first white space (passed protocol info) */

    for (p = line; *p && !isspace((unsigned char)*p); p++)
        continue;
    if (!*p) {
        OCSPerr(OCSP_F_PARSE_HTTP_LINE1, OCSP_R_SERVER_RESPONSE_PARSE_ERROR);
        return 0;
    }

    /* Skip past white space to start of response code */
    while (*p && isspace((unsigned char)*p))
        p++;

    if (!*p) {
        OCSPerr(OCSP_F_PARSE_HTTP_LINE1, OCSP_R_SERVER_RESPONSE_PARSE_ERROR);
        return 0;
    }

    /* Find end of response code: first whitespace after start of code */
    for (q = p; *q && !isspace((unsigned char)*q); q++)
        continue;

    if (!*q) {
        OCSPerr(OCSP_F_PARSE_HTTP_LINE1, OCSP_R_SERVER_RESPONSE_PARSE_ERROR);
        return 0;
    }

    /* Set end of response code and start of message */
    *q++ = 0;

    /* Attempt to parse numeric code */
    retcode = strtoul(p, &r, 10);

    if (*r)
        return 0;

    /* Skip over any leading white space in message */
    while (*q && isspace((unsigned char)*q))
        q++;

    if (*q) {
        /*
         * Finally zap any trailing white space in message (include CRLF)
         */

        /* We know q has a non white space character so this is OK */
        for (r = q + strlen(q) - 1; isspace((unsigned char)*r); r--)
            *r = 0;
    }
    if (retcode != 200) {
        OCSPerr(OCSP_F_PARSE_HTTP_LINE1, OCSP_R_SERVER_RESPONSE_ERROR);
        if (!*q)
            ERR_add_error_data(2, "Code=", p);
        else
            ERR_add_error_data(4, "Code=", p, ",Reason=", q);
        return 0;
    }

    return 1;

}

variable_types:
line
char *

variable_types: retcode int

variable_types:
p
char *

variable_types:
q
char *

variable_types:
r
char *


original_code:
int EVP_EncodeBlock(unsigned char *t, const unsigned char *f, int dlen)
{
    int i, ret = 0;
    unsigned long l;

    for (i = dlen; i > 0; i -= 3) {
        if (i >= 3) {
            l = (((unsigned long)f[0]) << 16L) |
                (((unsigned long)f[1]) << 8L) | f[2];
            *(t++) = conv_bin2ascii(l >> 18L);
            *(t++) = conv_bin2ascii(l >> 12L);
            *(t++) = conv_bin2ascii(l >> 6L);
            *(t++) = conv_bin2ascii(l);
        } else {
            l = ((unsigned long)f[0]) << 16L;
            if (i == 2)
                l |= ((unsigned long)f[1] << 8L);

            *(t++) = conv_bin2ascii(l >> 18L);
            *(t++) = conv_bin2ascii(l >> 12L);
            *(t++) = (i == 1) ? '=' : conv_bin2ascii(l >> 6L);
            *(t++) = '=';
        }
        ret += 4;
        f += 3;
    }

    *t = '\0';
    return (ret);
}

canonical_original_code:
int EVP_EncodeBlock(unsigned char *t, unsigned char *f, int dlen)
{
    int i; int ret = 0;
    unsigned long l;

    for (i = dlen; i > 0; i -= 3) {
        if (i >= 3) {
            l = (((unsigned long)f[0]) << 16L) |
                (((unsigned long)f[1]) << 8L) | f[2];
            *(t++) = conv_bin2ascii(l >> 18L);
            *(t++) = conv_bin2ascii(l >> 12L);
            *(t++) = conv_bin2ascii(l >> 6L);
            *(t++) = conv_bin2ascii(l);
        } else {
            l = ((unsigned long)f[0]) << 16L;
            if (i == 2)
                l |= ((unsigned long)f[1] << 8L);

            *(t++) = conv_bin2ascii(l >> 18L);
            *(t++) = conv_bin2ascii(l >> 12L);
            *(t++) = (i == 1) ? '=' : conv_bin2ascii(l >> 6L);
            *(t++) = '=';
        }
        ret += 4;
        f += 3;
    }

    *t = '\0';
    return (ret);
}

variable_types:
t
unsigned char *

variable_types:
f
unsigned char *

variable_types: dlen int

variable_types: i int

variable_types:
l
unsigned long


original_code:
int EVP_DecodeBlock(unsigned char *t, const unsigned char *f, int n)
{
    int i, ret = 0, a, b, c, d;
    unsigned long l;

    /* trim white space from the start of the line. */
    while ((conv_ascii2bin(*f) == B64_WS) && (n > 0)) {
        f++;
        n--;
    }

    /*
     * strip off stuff at the end of the line ascii2bin values B64_WS,
     * B64_EOLN, B64_EOLN and B64_EOF
     */
    while ((n > 3) && (B64_NOT_BASE64(conv_ascii2bin(f[n - 1]))))
        n--;

    if (n % 4 != 0)
        return (-1);

    for (i = 0; i < n; i += 4) {
        a = conv_ascii2bin(*(f++));
        b = conv_ascii2bin(*(f++));
        c = conv_ascii2bin(*(f++));
        d = conv_ascii2bin(*(f++));
        if ((a & 0x80) || (b & 0x80) || (c & 0x80) || (d & 0x80))
            return (-1);
        l = ((((unsigned long)a) << 18L) |
             (((unsigned long)b) << 12L) |
             (((unsigned long)c) << 6L) | (((unsigned long)d)));
        *(t++) = (unsigned char)(l >> 16L) & 0xff;
        *(t++) = (unsigned char)(l >> 8L) & 0xff;
        *(t++) = (unsigned char)(l) & 0xff;
        ret += 3;
    }
    return (ret);
}

canonical_original_code:
int EVP_DecodeBlock(unsigned char *t, unsigned char *f, int n)
{
    int i; int ret = 0; int a; int b; int c; int d;
    unsigned long l;

    /* trim white space from the start of the line. */
    while ((conv_ascii2bin(*f) == B64_WS) && (n > 0)) {
        f++;
        n--;
    }

    /*
     * strip off stuff at the end of the line ascii2bin values B64_WS,
     * B64_EOLN, B64_EOLN and B64_EOF
     */
    while ((n > 3) && (B64_NOT_BASE64(conv_ascii2bin(f[n - 1]))))
        n--;

    if (n % 4 != 0)
        return (-1);

    for (i = 0; i < n; i += 4) {
        a = conv_ascii2bin(*(f++));
        b = conv_ascii2bin(*(f++));
        c = conv_ascii2bin(*(f++));
        d = conv_ascii2bin(*(f++));
        if ((a & 0x80) || (b & 0x80) || (c & 0x80) || (d & 0x80))
            return (-1);
        l = ((((unsigned long)a) << 18L) |
             (((unsigned long)b) << 12L) |
             (((unsigned long)c) << 6L) | (((unsigned long)d)));
        *(t++) = (unsigned char)(l >> 16L) & 0xff;
        *(t++) = (unsigned char)(l >> 8L) & 0xff;
        *(t++) = (unsigned char)(l) & 0xff;
        ret += 3;
    }
    return (ret);
}

variable_types: n int

variable_types: ret int

variable_types: a int

variable_types: b int

variable_types: d int


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

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

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

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

original_code:
void ERR_load_BN_strings(void)
{
#ifndef OPENSSL_NO_ERR

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

canonical_original_code:
void ERR_load_BN_strings()
{
#ifndef OPENSSL_NO_ERR

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


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

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

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

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

original_code:
void ERR_load_TS_strings(void)
{
#ifndef OPENSSL_NO_ERR

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

canonical_original_code:
void ERR_load_TS_strings()
{
#ifndef OPENSSL_NO_ERR

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


decompiled_code:
__int64 engine_unregister_all_ciphers()
{
return engine_table_cleanup(&cipher_table);
}

canonical_decompiled_code:
__int64 func0()
{
return engine_table_cleanup(&cipher_table);
}

original_code:
static void engine_unregister_all_ciphers(void)
{
    engine_table_cleanup(&cipher_table);
}

canonical_original_code:
static void engine_unregister_all_ciphers()
{
    engine_table_cleanup(&cipher_table);
}


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

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

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

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

original_code:
void ERR_load_UI_strings(void)
{
#ifndef OPENSSL_NO_ERR

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

canonical_original_code:
void ERR_load_UI_strings()
{
#ifndef OPENSSL_NO_ERR

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


decompiled_code:
const char *__fastcall ASN1_tag2str(unsigned int a1)
{
const char *result; // rax

if ( (a1 & 0xFFFFFFF7) == 258 )
{
a1 &= 0xFFFFFEFF;
return tag2str_0[a1];
}
result = "(unknown)";
if ( a1 <= 0x1E )
return tag2str_0[a1];
return result;
}

canonical_decompiled_code:
const char *__fastcall func0(unsigned int a1)
{
const char *result; // rax

if ( (a1 & 0xFFFFFFF7) == 258 )
{
a1 &= 0xFFFFFEFF;
return tag2str_0[a1];
}
result = "(unknown)";
if ( a1 <= 0x1E )
return tag2str_0[a1];
return result;
}

original_code:
const char *ASN1_tag2str(int tag)
{
    static const char *const tag2str[] = {
        /* 0-4 */
        "EOC", "BOOLEAN", "INTEGER", "BIT STRING", "OCTET STRING",
        /* 5-9 */
        "NULL", "OBJECT", "OBJECT DESCRIPTOR", "EXTERNAL", "REAL",
        /* 10-13 */
        "ENUMERATED", "<ASN1 11>", "UTF8STRING", "<ASN1 13>",
        /* 15-17 */
        "<ASN1 14>", "<ASN1 15>", "SEQUENCE", "SET",
        /* 18-20 */
        "NUMERICSTRING", "PRINTABLESTRING", "T61STRING",
        /* 21-24 */
        "VIDEOTEXSTRING", "IA5STRING", "UTCTIME", "GENERALIZEDTIME",
        /* 25-27 */
        "GRAPHICSTRING", "VISIBLESTRING", "GENERALSTRING",
        /* 28-30 */
        "UNIVERSALSTRING", "<ASN1 29>", "BMPSTRING"
    };

    if ((tag == V_ASN1_NEG_INTEGER) || (tag == V_ASN1_NEG_ENUMERATED))
        tag &= ~0x100;

    if (tag < 0 || tag > 30)
        return "(unknown)";
    return tag2str[tag];
}

canonical_original_code:
char *ASN1_tag2str(int tag)
{
    static char *tag2str[] = {
        /* 0-4 */
        "EOC", "BOOLEAN", "INTEGER", "BIT STRING", "OCTET STRING",
        /* 5-9 */
        "NULL", "OBJECT", "OBJECT DESCRIPTOR", "EXTERNAL", "REAL",
        /* 10-13 */
        "ENUMERATED", "<ASN1 11>", "UTF8STRING", "<ASN1 13>",
        /* 15-17 */
        "<ASN1 14>", "<ASN1 15>", "SEQUENCE", "SET",
        /* 18-20 */
        "NUMERICSTRING", "PRINTABLESTRING", "T61STRING",
        /* 21-24 */
        "VIDEOTEXSTRING", "IA5STRING", "UTCTIME", "GENERALIZEDTIME",
        /* 25-27 */
        "GRAPHICSTRING", "VISIBLESTRING", "GENERALSTRING",
        /* 28-30 */
        "UNIVERSALSTRING", "<ASN1 29>", "BMPSTRING"
    };

    if ((tag == V_ASN1_NEG_INTEGER) || (tag == V_ASN1_NEG_ENUMERATED))
        tag &= ~0x100;

    if (tag < 0 || tag > 30)
        return "(unknown)";
    return tag2str[tag];
}

variable_types: tag int


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

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

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

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

original_code:
void ERR_load_PEM_strings(void)
{
#ifndef OPENSSL_NO_ERR

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

canonical_original_code:
void ERR_load_PEM_strings()
{
#ifndef OPENSSL_NO_ERR

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


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

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

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

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

original_code:
void ERR_load_PKCS12_strings(void)
{
#ifndef OPENSSL_NO_ERR

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

canonical_original_code:
void ERR_load_PKCS12_strings()
{
#ifndef OPENSSL_NO_ERR

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


decompiled_code:
__int64 __fastcall constant_time_msb(int a1)
{
return (unsigned int)(a1 >> 31);
}

canonical_decompiled_code:
__int64 __fastcall func0(int a1)
{
return (unsigned int)(a1 >> 31);
}

original_code:
static inline unsigned int constant_time_msb(unsigned int a)
{
    return 0 - (a >> (sizeof(a) * 8 - 1));
}

variable_types:
a
unsigned int


decompiled_code:
__int64 __fastcall constant_time_is_zero(int a1)
{
return constant_time_msb(~a1 & (unsigned int)(a1 - 1));
}

canonical_decompiled_code:
__int64 __fastcall func1(int a1)
{
return func0(~a1 & (unsigned int)(a1 - 1));
}

original_code:
static inline unsigned int constant_time_is_zero(unsigned int a)
{
    return constant_time_msb(~a & (a - 1));
}


decompiled_code:
__int64 __fastcall constant_time_select(int a1, int a2, unsigned int a3)
{
return a1 & (a3 ^ a2) ^ a3;
}

canonical_decompiled_code:
__int64 __fastcall func2(int a1, int a2, unsigned int a3)
{
return a1 & (a3 ^ a2) ^ a3;
}

original_code:
static inline unsigned int constant_time_select(unsigned int mask,
                                                unsigned int a,
                                                unsigned int b)
{
    return (mask & a) | (~mask & b);
}

variable_types:
mask
unsigned int

variable_types:
b
unsigned int


decompiled_code:
// attributes: thunk
__int64 __fastcall constant_time_select_int(int a1, int a2, unsigned int a3)
{
return constant_time_select(a1, a2, a3);
}

canonical_decompiled_code:
__int64 __fastcall func3(int a1, int a2, unsigned int a3)
{
return func2(a1, a2, a3);
}

original_code:
static inline int constant_time_select_int(unsigned int mask, int a, int b)
{
    return (int)(constant_time_select(mask, (unsigned)(a), (unsigned)(b)));
}

canonical_original_code:
static inline int constant_time_select_int(unsigned int mask, int a, int b)
{
    return (int)(constant_time_select(mask, (unsigned int)(a), (unsigned int)(b)));
}


original_code:
static int dh_cb(int p, int n, BN_GENCB *cb)
{
    char c = '*';
    if (p == 0)
        c = '.';
    if (p == 1)
        c = '+';
    if (p == 2)
        c = '*';
    if (p == 3)
        c = '\n';
    BIO_write(cb->arg, &c, 1);
    (void)(int)BIO_ctrl(cb->arg,11,0,((void *)0));
    return 1;
}

canonical_original_code:
static int dh_cb(int p, int n, struct bn_gencb_st *cb)
{
    char c = '*';
    if (p == 0)
        c = '.';
    if (p == 1)
        c = '+';
    if (p == 2)
        c = '*';
    if (p == 3)
        c = '\n';
    BIO_write(cb->arg, &c, 1);
    (void)(int)BIO_ctrl(cb->arg,11,0,((void *)0));
    return 1;
}

variable_types: p int

variable_types: struct bn_gencb_st { unsigned int ver; void *arg; union { void (*cb_1)(int, int, void *); int (*cb_2)(int, int, struct bn_gencb_st *); } cb; } *

variable_types: c char


decompiled_code:
int __fastcall get_current_time(struct timeval *a1)
{
return gettimeofday(a1, 0LL);
}

canonical_decompiled_code:
int __fastcall func3(struct timeval *a1)
{
return gettimeofday(a1, 0LL);
}

original_code:
static void get_current_time(struct timeval *t)
{
    gettimeofday(t, ((void *)0));
}

variable_types: struct timeval { long tv_sec; long tv_usec; } *


user_defined_types: struct bn_gencb_st { unsigned int ver; void *arg; union { void (*cb_1)(int, int, void *); int (*cb_2)(int, int, struct bn_gencb_st *); } cb; }


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

if ( a1 )
{
result = 1LL;
if ( a1 == 2 )
{
DH_free(*a2);
*a2 = 0LL;
result = 2LL;
}
}
else
{
v3 = DH_new();
*a2 = v3;
result = 2 * (unsigned int)(v3 != 0);
}
return result;
}

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

if ( a1 )
{
result = 1LL;
if ( a1 == 2 )
{
DH_free(*a2);
*a2 = 0LL;
result = 2LL;
}
}
else
{
v3 = DH_new();
*a2 = v3;
result = 2 * (unsigned int)(v3 != 0);
}
return result;
}


main

canonical_name: main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
const char *v3; // rdi
int v4; // ebp
const char *v5; // rdi
int v6; // er13
int v7; // er12

if ( argc <= 2 )
{
usage(argc, argv, envp);
v7 = 0;
}
else
{
v3 = argv[1];
if ( *v3 == 45 && (v4 = *((unsigned __int8 *)v3 + 1), !v3[1]) || (v4 = open(v3, 0, envp), v4 >= 0) )
{
v5 = argv[2];
if ( (*v5 != 45 || (v6 = 1, v5[1])) && (v6 = open(v5, 193, 511LL), v6 < 0) )
{
v7 = -1;
perror("Error opening output file");
}
else
{
do
v7 = modulate((unsigned int)v4, (unsigned int)v6);
while ( v7 );
close(v6);
close(v4);
}
}
else
{
v7 = -1;
perror("Error opening input file");
}
}
return v7;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
const char *v3; // rdi
int v4; // ebp
const char *v5; // rdi
int v6; // er13
int v7; // er12

if ( argc <= 2 )
{
func9(argc, argv, envp);
v7 = 0;
}
else
{
v3 = argv[1];
if ( *v3 == 45 && (v4 = *((unsigned __int8 *)v3 + 1), !v3[1]) || (v4 = open(v3, 0, envp), v4 >= 0) )
{
v5 = argv[2];
if ( (*v5 != 45 || (v6 = 1, v5[1])) && (v6 = open(v5, 193, 511LL), v6 < 0) )
{
v7 = -1;
perror("Error opening output file");
}
else
{
do
v7 = func8((unsigned int)v4, (unsigned int)v6);
while ( v7 );
close(v6);
close(v4);
}
}
else
{
v7 = -1;
perror("Error opening input file");
}
}
return v7;
}

original_code:
int main(int argc, char **argv)
{
 int infd=-1, outfd=-1;
 int retval;
 if (argc<3)
 {
  usage();
  return 0;
 }
 if (strcmp(argv[1],"-")==0)
 {
  infd=0;
 }
 else
 {
  infd=open(argv[1],00);
 }
 if (infd<0)
 {
  perror("Error opening input file");
  return -1;
 }
 if (strcmp(argv[2],"-")==0)
 {
  outfd=1;
 }
 else
 {
  outfd=open(argv[2],01|0100|0200,0777);
 }
 if (outfd<0)
 {
  perror("Error opening output file");
  return -1;
 }
 while ((retval=modulate(infd,outfd)))
  ;
 close(outfd);
 close(infd);
 return retval;
}

canonical_original_code:
int main(int argc, char **argv)
{
 int infd = -1; int outfd = -1;
 int retval;
 if (argc<3)
 {
  usage();
  return 0;
 }
 if (strcmp(argv[1],"-")==0)
 {
  infd=0;
 }
 else
 {
  infd=open(argv[1],00);
 }
 if (infd<0)
 {
  perror("Error opening input file");
  return -1;
 }
 if (strcmp(argv[2],"-")==0)
 {
  outfd=1;
 }
 else
 {
  outfd=open(argv[2],01|0100|0200,0777);
 }
 if (outfd<0)
 {
  perror("Error opening output file");
  return -1;
 }
 while ((retval=modulate(infd,outfd)))
  ;
 close(outfd);
 close(infd);
 return retval;
}

variable_types: argc int

variable_types:
argv
char **

variable_types: infd int

variable_types: outfd int

variable_types: retval int


tone

decompiled_code:
__int64 __fastcall tone(int fd, int a2, const void *a3)
{
do
{
if ( !a2 )
return 0LL;
--a2;
}
while ( write(fd, a3, 0xAuLL) == 10 );
return 0xFFFFFFFFLL;
}

canonical_decompiled_code:
__int64 __fastcall func7(int fd, int a2, const void *a3)
{
do
{
if ( !a2 )
return 0LL;
--a2;
}
while ( write(fd, a3, 0xAuLL) == 10 );
return 0xFFFFFFFFLL;
}

original_code:
int tone(int fd, int cycles, const signed char *pattern)
{
 while (cycles--)
 {
  if (write(fd,pattern,10)!=10)
   return -1;
 }
 return 0;
}

canonical_original_code:
int tone(int fd, int cycles, char *pattern)
{
 while (cycles--)
 {
  if (write(fd,pattern,10)!=10)
   return -1;
 }
 return 0;
}

variable_types: fd int

variable_types: cycles int

variable_types:
pattern
char *


modulate

decompiled_code:
__int64 __fastcall modulate(int a1, int a2)
{
unsigned __int64 v2; // rax
unsigned int v3; // er8
char *v5; // rbp
char v6; // al
int v7; // ebx
unsigned int v8; // edx
_QWORD *v9; // rax
_BYTE v10[256]; // [rsp+0h] [rbp-118h] BYREF
char v11; // [rsp+100h] [rbp-18h] BYREF

v2 = read(a1, v10, 0x100uLL);
v3 = 0;
if ( v2 )
{
if ( v2 <= 0xFF )
{
v8 = 256 - v2;
v9 = &v10[v2];
if ( v8 >= 8 )
{
*v9 = 0LL;
*(_QWORD *)((char *)v9 + v8 - 8) = 0LL;
memset(
(void *)((unsigned __int64)(v9 + 1) & 0xFFFFFFFFFFFFFFF8LL),
0,
8LL * ((v8 + (_DWORD)v9 - (((_DWORD)v9 + 8) & 0xFFFFFFF8)) >> 3));
}
else if ( (v8 & 4) != 0 )
{
*(_DWORD *)v9 = 0;
*(_DWORD *)((char *)v9 + v8 - 4) = 0;
}
else if ( v8 )
{
*(_BYTE *)v9 = 0;
if ( (v8 & 2) != 0 )
*(_WORD *)((char *)v9 + v8 - 2) = 0;
}
}
if ( (unsigned int)tone(a2, 2000, &cycle_tone) || (v5 = v10, (unsigned int)tone(a2, 8, &cycle_silence)) )
{
LABEL_4:
perror("Unable to write output");
v3 = -1;
}
else
{
do
{
v6 = *v5;
v7 = 9;
do
{
while ( (v6 & 1) == 0 )
{
if ( (unsigned int)tone(a2, 8, &cycle_tone) || (unsigned int)tone(a2, 16, &cycle_silence) )
goto LABEL_4;
v6 = (unsigned __int8)*v5 >> 1;
*v5 = v6;
if ( !--v7 )
goto LABEL_15;
}
if ( (unsigned int)tone(a2, 16, &cycle_tone) || (unsigned int)tone(a2, 8, &cycle_silence) )
goto LABEL_4;
v6 = (unsigned __int8)*v5 >> 1;
*v5 = v6;
--v7;
}
while ( v7 );
LABEL_15:
++v5;
}
while ( v5 != &v11 );
v3 = 1;
}
}
return v3;
}

canonical_decompiled_code:
__int64 __fastcall func8(int a1, int a2)
{
unsigned __int64 v2; // rax
unsigned int v3; // er8
char *v5; // rbp
char v6; // al
int v7; // ebx
unsigned int v8; // edx
_QWORD *v9; // rax
_BYTE v10[256]; // [rsp+0h] [rbp-118h] BYREF
char v11; // [rsp+100h] [rbp-18h] BYREF

v2 = read(a1, v10, 0x100uLL);
v3 = 0;
if ( v2 )
{
if ( v2 <= 0xFF )
{
v8 = 256 - v2;
v9 = &v10[v2];
if ( v8 >= 8 )
{
*v9 = 0LL;
*(_QWORD *)((char *)v9 + v8 - 8) = 0LL;
memset(
(void *)((unsigned __int64)(v9 + 1) & 0xFFFFFFFFFFFFFFF8LL),
0,
8LL * ((v8 + (_DWORD)v9 - (((_DWORD)v9 + 8) & 0xFFFFFFF8)) >> 3));
}
else if ( (v8 & 4) != 0 )
{
*(_DWORD *)v9 = 0;
*(_DWORD *)((char *)v9 + v8 - 4) = 0;
}
else if ( v8 )
{
*(_BYTE *)v9 = 0;
if ( (v8 & 2) != 0 )
*(_WORD *)((char *)v9 + v8 - 2) = 0;
}
}
if ( (unsigned int)func7(a2, 2000, &cycle_tone) || (v5 = v10, (unsigned int)func7(a2, 8, &cycle_silence)) )
{
LABEL_4:
perror("Unable to write output");
v3 = -1;
}
else
{
do
{
v6 = *v5;
v7 = 9;
do
{
while ( (v6 & 1) == 0 )
{
if ( (unsigned int)func7(a2, 8, &cycle_tone) || (unsigned int)func7(a2, 16, &cycle_silence) )
goto LABEL_4;
v6 = (unsigned __int8)*v5 >> 1;
*v5 = v6;
if ( !--v7 )
goto LABEL_15;
}
if ( (unsigned int)func7(a2, 16, &cycle_tone) || (unsigned int)func7(a2, 8, &cycle_silence) )
goto LABEL_4;
v6 = (unsigned __int8)*v5 >> 1;
*v5 = v6;
--v7;
}
while ( v7 );
LABEL_15:
++v5;
}
while ( v5 != &v11 );
v3 = 1;
}
}
return v3;
}

original_code:
int modulate(int fdin, int fdout)
{
 unsigned char buf[256];
 unsigned char *ptr=buf;
 int bitcount;
 ssize_t count;
 count=read(fdin,buf,sizeof(buf));
 if (count==0)
  return 0;
 if (count<sizeof(buf))
  memset(buf+count,0x00,sizeof(buf)-count);
 if (tone(fdout,((8)*250),cycle_tone))
  goto error;
 if (tone(fdout,8,cycle_silence))
  goto error;
 for (count=0;count<256;count++)
 {
  for (bitcount=0;bitcount<9;bitcount++)
  {
   if (*ptr&0x01)
   {
    if (tone(fdout,8*2,cycle_tone))
     goto error;
    if (tone(fdout,8,cycle_silence))
     goto error;
   }
   else
   {
    if (tone(fdout,8,cycle_tone))
     goto error;
    if (tone(fdout,8*2,cycle_silence))
     goto error;
   }
   *ptr>>=1;
  }
  ptr++;
 }
 return 1;
error:
 perror("Unable to write output");
 return -1;
}

canonical_original_code:
int modulate(int fdin, int fdout)
{
 unsigned char buf[256];
 unsigned char *ptr = buf;
 int bitcount;
 long count;
 count=read(fdin,buf,sizeof(buf));
 if (count==0)
  return 0;
 if (count<sizeof(buf))
  memset(buf+count,0x00,sizeof(buf)-count);
 if (tone(fdout,((8)*250),cycle_tone))
  goto error;
 if (tone(fdout,8,cycle_silence))
  goto error;
 for (count=0;count<256;count++)
 {
  for (bitcount=0;bitcount<9;bitcount++)
  {
   if (*ptr&0x01)
   {
    if (tone(fdout,8*2,cycle_tone))
     goto error;
    if (tone(fdout,8,cycle_silence))
     goto error;
   }
   else
   {
    if (tone(fdout,8,cycle_tone))
     goto error;
    if (tone(fdout,8*2,cycle_silence))
     goto error;
   }
   *ptr>>=1;
  }
  ptr++;
 }
 return 1;
error:
 perror("Unable to write output");
 return -1;
}

variable_types: fdin int

variable_types: fdout int

variable_types:
buf
unsigned char [256]

variable_types:
ptr
unsigned char *

variable_types: bitcount int

variable_types: count long


usage

decompiled_code:
int usage()
{
return puts(
"tam8085tape <input> <output>\n"
"\n"
"Converts input file to TAM8085-tape format\n"
"Input is a raw byte stream.\n"
"Output is signed 8 bit samples with 32000 sps.\n"
"Output consists of 256 byte pages. Input is padded to full page with zeros.\n");
}

canonical_decompiled_code:
int func9()
{
return puts(
"tam8085tape <input> <output>\n"
"\n"
"Converts input file to TAM8085-tape format\n"
"Input is a raw byte stream.\n"
"Output is signed 8 bit samples with 32000 sps.\n"
"Output consists of 256 byte pages. Input is padded to full page with zeros.\n");
}

original_code:
void usage(void)
{
 puts(
"tam8085tape <input> <output>\n\n"
"Converts input file to TAM8085-tape format\n"
"Input is a raw byte stream.\n"
"Output is signed 8 bit samples with 32000 sps.\n"
"Output consists of 256 byte pages. Input is padded to full page with zeros.\n"
 );
}

canonical_original_code:
void usage()
{
 puts(
"tam8085tape <input> <output>\n\n"
"Converts input file to TAM8085-tape format\n"
"Input is a raw byte stream.\n"
"Output is signed 8 bit samples with 32000 sps.\n"
"Output consists of 256 byte pages. Input is padded to full page with zeros.\n"
 );
}


uiSetup

decompiled_code:
void uiSetup()
{
isKeyPad = 0;
shipLocation = 0x80;
isAutoFire = 0;
}

canonical_decompiled_code:
void func0()
{
isKeyPad = 0;
shipLocation = 0x80;
isAutoFire = 0;
}

original_code:
void uiSetup(void) {
  isKeyPad = 0;
  shipLocation = 128;
  isAutoFire = 0;
}

canonical_original_code:
void uiSetup() {
  isKeyPad = 0;
  shipLocation = 128;
  isAutoFire = 0;
}


uiStep

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

result = u8g_sdl_get_key();
isFire = 0;
if ( (_DWORD)result == 115 )
goto LABEL_14;
if ( (int)result <= 115 )
{
if ( (_DWORD)result == 32 )
{
isFire = 1;
}
else if ( (_DWORD)result == 113 )
{
exit(0);
}
return result;
}
if ( (_DWORD)result == 273 )
{
LABEL_14:
result = (unsigned __int8)shipLocation;
if ( (unsigned __int8)~uiIncrement >= (unsigned __int8)shipLocation )
{
result = (unsigned __int8)uiIncrement + (unsigned int)(unsigned __int8)shipLocation;
shipLocation += uiIncrement;
}
}
else if ( (_DWORD)result == 274 || (_DWORD)result == 120 )
{
result = (unsigned __int8)shipLocation;
if ( (unsigned __int8)shipLocation >= (unsigned __int8)uiIncrement )
{
result = (unsigned __int8)shipLocation - (unsigned int)(unsigned __int8)uiIncrement;
shipLocation -= uiIncrement;
}
}
return result;
}

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

result = u8g_sdl_get_key();
isFire = 0;
if ( (_DWORD)result == 115 )
goto LABEL_14;
if ( (int)result <= 115 )
{
if ( (_DWORD)result == 32 )
{
isFire = 1;
}
else if ( (_DWORD)result == 113 )
{
exit(0);
}
return result;
}
if ( (_DWORD)result == 273 )
{
LABEL_14:
result = (unsigned __int8)shipLocation;
if ( (unsigned __int8)~uiIncrement >= (unsigned __int8)shipLocation )
{
result = (unsigned __int8)uiIncrement + (unsigned int)(unsigned __int8)shipLocation;
shipLocation += uiIncrement;
}
}
else if ( (_DWORD)result == 274 || (_DWORD)result == 120 )
{
result = (unsigned __int8)shipLocation;
if ( (unsigned __int8)shipLocation >= (unsigned __int8)uiIncrement )
{
result = (unsigned __int8)shipLocation - (unsigned int)(unsigned __int8)uiIncrement;
shipLocation -= uiIncrement;
}
}
return result;
}

original_code:
void uiStep(void) {
  int key = u8g_sdl_get_key();
  isFire = 0;
  switch( key )
  {
    case ' ':
      isFire = 1;
      break;
    case 274:
    case 'x':
      if ( shipLocation >= 0+ uiIncrement )
 shipLocation -= uiIncrement;
      break;
    case 273:
    case 's':
      if ( shipLocation <= 255 - uiIncrement )
 shipLocation += uiIncrement;
      break;
    case 'q':
      exit(0);
  }
}

canonical_original_code:
void uiStep() {
  int key = u8g_sdl_get_key();
  isFire = 0;
  switch( key )
  {
    case ' ':
      isFire = 1;
      break;
    case 274:
    case 'x':
      if ( shipLocation >= 0+ uiIncrement )
 shipLocation -= uiIncrement;
      break;
    case 273:
    case 's':
      if ( shipLocation <= 255 - uiIncrement )
 shipLocation += uiIncrement;
      break;
    case 'q':
      exit(0);
  }
}

variable_types: key int


main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
int v4; // ebx

if ( (unsigned __int8)u8g_Init(&u8g, &u8g_dev_sdl_1bit, envp) )
{
v4 = 4000;
st_Setup(&u8g);
uiSetup();
do
{
u8g_FirstPage(&u8g);
do
st_Draw(0LL);
while ( (unsigned __int8)u8g_NextPage(&u8g) );
SDL_Delay(10LL);
uiStep();
st_Step((unsigned __int8)shipLocation, (unsigned __int8)isAutoFire, (unsigned __int8)isFire);
--v4;
}
while ( v4 );
}
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
int v4; // ebx

if ( (unsigned __int8)u8g_Init(&u8g, &u8g_dev_sdl_1bit, envp) )
{
v4 = 4000;
st_Setup(&u8g);
func0();
do
{
u8g_FirstPage(&u8g);
do
st_Draw(0LL);
while ( (unsigned __int8)u8g_NextPage(&u8g) );
SDL_Delay(10LL);
func1();
st_Step((unsigned __int8)shipLocation, (unsigned __int8)isAutoFire, (unsigned __int8)isFire);
--v4;
}
while ( v4 );
}
return 0;
}

original_code:
int main(void)
{
  uint32_t x;
  if ( u8g_Init(&u8g, &u8g_dev_sdl_1bit) == 0 )
    return 0;
  st_Setup(&u8g);
  uiSetup();
  for(x = 0; x < 4000; x++)
  {
    u8g_FirstPage(&u8g);
    do
    {
      st_Draw(0);
    } while( u8g_NextPage(&u8g) );
    SDL_Delay(10);
    uiStep();
    st_Step(shipLocation, isAutoFire, isFire);
  }
  return 0;
}

canonical_original_code:
int main()
{
  unsigned int x;
  if ( u8g_Init(&u8g, &u8g_dev_sdl_1bit) == 0 )
    return 0;
  st_Setup(&u8g);
  uiSetup();
  for(x = 0; x < 4000; x++)
  {
    u8g_FirstPage(&u8g);
    do
    {
      st_Draw(0);
    } while( u8g_NextPage(&u8g) );
    SDL_Delay(10);
    uiStep();
    st_Step(shipLocation, isAutoFire, isFire);
  }
  return 0;
}

variable_types:
x
unsigned int


decompiled_code:
__int64 __fastcall u8g_DrawWuPixel(__int64 a1, unsigned __int16 a2, unsigned __int16 a3, char a4)
{
u8g_SetColorIndex(a1, (unsigned __int8)(3 - a4));
return u8g_DrawPixel(a1, a2, a3);
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, unsigned __int16 a2, unsigned __int16 a3, char a4)
{
u8g_SetColorIndex(a1, (unsigned __int8)(3 - a4));
return u8g_DrawPixel(a1, a2, a3);
}

original_code:
void u8g_DrawWuPixel(u8g_t *u8g, u8g_uint_t x0, u8g_uint_t y0, uint8_t intensity)
{
  u8g_SetColorIndex(u8g, 4 -1-intensity);
  u8g_DrawPixel(u8g, x0, y0);
}

canonical_original_code:
void u8g_DrawWuPixel(struct _u8g_t *u8g, unsigned short x0, unsigned short y0, unsigned char intensity)
{
  u8g_SetColorIndex(u8g, 4 -1-intensity);
  u8g_DrawPixel(u8g, x0, y0);
}

variable_types: struct _u8g_t { unsigned short width; unsigned short height; struct _u8g_dev_t { unsigned char (*dev_fn)(struct _u8g_t *u8g, struct _u8g_dev_t *dev, unsigned char msg, void *arg); void *dev_mem; unsigned char (*com_fn)(struct _u8g_t *u8g, unsigned char msg, unsigned char arg_val, void *arg_ptr); } *dev; unsigned char *font; unsigned char *cursor_font; unsigned char cursor_fg_color; unsigned char cursor_encoding; unsigned char mode; unsigned short cursor_x; unsigned short cursor_y; void (*cursor_fn)(struct _u8g_t *u8g); char glyph_dx; char glyph_x; char glyph_y; unsigned char glyph_width; unsigned char glyph_height; unsigned short (*font_calc_vref)(struct _u8g_t *u8g); unsigned char font_height_mode; char font_ref_ascent; char font_ref_descent; unsigned char font_line_spacing_factor; unsigned char line_spacing; struct _u8g_dev_arg_pixel_t { unsigned short x; unsigned char pixel; unsigned char dir; unsigned char color; unsigned char hi_color; unsigned char blue; } arg_pixel; void (*state_cb)(unsigned char msg); struct _u8g_box_t { unsigned short x0; } current_page; } *

variable_types:
intensity
unsigned char

user_defined_types: struct _u8g_t { unsigned short width; unsigned short height; struct _u8g_dev_t *dev; unsigned char *font; unsigned char *cursor_font; unsigned char cursor_fg_color; unsigned char cursor_encoding; unsigned char mode; unsigned short cursor_x; unsigned short cursor_y; void (*cursor_fn)(struct _u8g_t *u8g); char glyph_dx; char glyph_x; char glyph_y; unsigned char glyph_width; unsigned char glyph_height; unsigned short (*font_calc_vref)(struct _u8g_t *u8g); unsigned char font_height_mode; char font_ref_ascent; char font_ref_descent; unsigned char font_line_spacing_factor; unsigned char line_spacing; struct _u8g_dev_arg_pixel_t arg_pixel; void (*state_cb)(unsigned char msg); struct _u8g_box_t current_page; }


decompiled_code:
__int64 __fastcall u8g_DrawWuLine2Bit(__int64 a1, unsigned __int16 a2, int a3, unsigned __int16 a4, int a5)
{
unsigned __int16 v5; // ax
unsigned __int16 v7; // di
int v8; // ebp
unsigned __int16 v9; // bx
unsigned __int16 v10; // r15
unsigned __int16 v11; // r8
unsigned __int16 v13; // r12
unsigned __int16 v14; // r14
unsigned __int16 v15; // r15
unsigned __int16 v16; // dx
int v17; // ecx
char v18; // bl
unsigned __int16 v19; // r14
int v20; // er12
unsigned __int16 v21; // bp
unsigned __int16 v22; // dx
__int16 v23; // [rsp+8h] [rbp-50h]
unsigned __int16 v24; // [rsp+8h] [rbp-50h]
unsigned __int16 v25; // [rsp+Ch] [rbp-4Ch]
unsigned __int64 v26; // [rsp+10h] [rbp-48h]
__int16 v27; // [rsp+1Ch] [rbp-3Ch]
unsigned __int16 v28; // [rsp+1Eh] [rbp-3Ah]

v5 = a4;
v7 = a5;
v8 = a3;
v9 = a2;
if ( (unsigned __int16)a3 > (unsigned __int16)a5 )
v8 = a5;
if ( (unsigned __int16)a3 > (unsigned __int16)a5 )
{
v7 = a3;
if ( (unsigned __int16)a3 > (unsigned __int16)a5 )
{
v9 = a4;
if ( (unsigned __int16)a3 > (unsigned __int16)a5 )
v5 = a2;
}
}
v28 = v5;
v10 = v7 - v8;
if ( v9 > v5 )
{
v11 = v9 - v5;
v23 = -1;
if ( !v10 )
goto LABEL_10;
}
else
{
v11 = v5 - v9;
if ( v5 == v9 )
{
u8g_SetColorIndex(a1, 3LL);
return u8g_DrawVLine(a1, v9, (unsigned __int16)v8, (unsigned __int16)(v10 + 1));
}
v23 = 1;
if ( !v10 )
{
LABEL_10:
v24 = v11;
u8g_SetColorIndex(a1, 3LL);
return u8g_DrawHLine(a1, v9, (unsigned __int16)v8, (unsigned __int16)(v24 + 1));
}
}
v25 = v11;
u8g_DrawWuPixel(a1, v9, v8, 0);
if ( v10 > v25 )
{
v19 = 0;
v20 = v8;
v21 = v9;
do
{
v22 = v19;
v19 += ((unsigned __int64)v25 << 16) / v10;
if ( v19 <= v22 )
{
v9 += v23;
v21 = v9;
}
u8g_DrawWuPixel(a1, v21, ++v20, (int)v19 >> 14);
u8g_DrawWuPixel(a1, v9 + v23, v20, ((int)v19 >> 14) ^ 3);
}
while ( v7 + ~(_WORD)v20 );
}
else
{
v26 = ((unsigned __int64)v10 << 16) / v25;
if ( v25 != 1 )
{
v27 = v25 - 1;
v13 = v8;
v14 = 0;
v15 = v9;
do
{
v16 = v14;
v14 += v26;
if ( v14 <= v16 )
{
LOWORD(v8) = v8 + 1;
v13 = v8;
}
v15 += v23;
v17 = (int)v14 >> 14;
v18 = v17 ^ 3;
u8g_DrawWuPixel(a1, v15, v13, v17);
u8g_DrawWuPixel(a1, v15, v8 + 1, v18);
--v27;
}
while ( v27 );
}
}
return u8g_DrawWuPixel(a1, v28, v7, 0);
}

original_code:
void u8g_DrawWuLine2Bit(u8g_t *u8g, u8g_uint_t x0, u8g_uint_t y0, u8g_uint_t x1, u8g_uint_t y1)
{
  uint16_t ErrorAdj, ErrorAcc, ErrorAccTemp;
  uint16_t IntensityShift;
  u8g_uint_t DeltaX, DeltaY;
  u8g_uint_t XDir;
  uint8_t Weighting, WeightingComplementMask;
  if ( y0 > y1 )
  {
    u8g_uint_t temp;
    temp = y0; y0 = y1; y1= temp;
    temp = x0; x0 = x1; x1= temp;
  }
  DeltaY = y1 - y0;
  if ( x1 >= x0 )
  {
    DeltaX = x1 - x0;
    XDir = 1;
  }
  else
  {
    DeltaX = x0 - x1;
    XDir = 0;
    XDir--;
  }
  if ( DeltaX == 0 )
  {
    u8g_SetColorIndex(u8g, 4 -1-0);
    u8g_DrawVLine(u8g, x0, y0, DeltaY+1 );
    return;
  }
  if ( DeltaY == 0 )
  {
    u8g_SetColorIndex(u8g, 4 -1-0);
    u8g_DrawHLine(u8g, x0, y0, DeltaX+1 );
    return;
  }
  u8g_DrawWuPixel(u8g, x0, y0, 0);
  ErrorAcc = 0;
  IntensityShift = 16 - 2;
  WeightingComplementMask = 4 - 1;
  if ( DeltaY > DeltaX )
  {
    ErrorAdj = ((unsigned long)DeltaX << 16) / (unsigned long)DeltaY;
    while( --DeltaY )
    {
      ErrorAccTemp = ErrorAcc;
      ErrorAcc += ErrorAdj;
      if ( ErrorAcc <= ErrorAccTemp )
      {
        x0 += XDir;
      }
      y0++;
      Weighting = ErrorAcc >> IntensityShift;
      u8g_DrawWuPixel(u8g, x0, y0, 0 +Weighting);
      Weighting ^= WeightingComplementMask;
      u8g_DrawWuPixel(u8g, x0+XDir, y0, 0 +Weighting);
    }
  }
  else
  {
    ErrorAdj = ((unsigned long)DeltaY << 16) / (unsigned long)DeltaX;
    while( --DeltaX )
    {
      ErrorAccTemp = ErrorAcc;
      ErrorAcc += ErrorAdj;
      if ( ErrorAcc <= ErrorAccTemp )
      {
        y0++;
      }
      x0 += XDir;
      Weighting = ErrorAcc >> IntensityShift;
      u8g_DrawWuPixel(u8g, x0, y0, 0 +Weighting);
      Weighting ^= WeightingComplementMask;
      u8g_DrawWuPixel(u8g, x0, y0+1, 0 +Weighting);
    }
  }
  u8g_DrawWuPixel(u8g, x1, y1, 0);
}

canonical_original_code:
void u8g_DrawWuLine2Bit(struct _u8g_t *u8g, unsigned short x0, unsigned short y0, unsigned short x1, unsigned short y1)
{
  unsigned short ErrorAdj; unsigned short ErrorAcc; unsigned short ErrorAccTemp;
  unsigned short IntensityShift;
  unsigned short DeltaX; unsigned short DeltaY;
  unsigned short XDir;
  unsigned char Weighting; unsigned char WeightingComplementMask;
  if ( y0 > y1 )
  {
    unsigned short temp;
    temp = y0; y0 = y1; y1= temp;
    temp = x0; x0 = x1; x1= temp;
  }
  DeltaY = y1 - y0;
  if ( x1 >= x0 )
  {
    DeltaX = x1 - x0;
    XDir = 1;
  }
  else
  {
    DeltaX = x0 - x1;
    XDir = 0;
    XDir--;
  }
  if ( DeltaX == 0 )
  {
    u8g_SetColorIndex(u8g, 4 -1-0);
    u8g_DrawVLine(u8g, x0, y0, DeltaY+1 );
    return;
  }
  if ( DeltaY == 0 )
  {
    u8g_SetColorIndex(u8g, 4 -1-0);
    u8g_DrawHLine(u8g, x0, y0, DeltaX+1 );
    return;
  }
  u8g_DrawWuPixel(u8g, x0, y0, 0);
  ErrorAcc = 0;
  IntensityShift = 16 - 2;
  WeightingComplementMask = 4 - 1;
  if ( DeltaY > DeltaX )
  {
    ErrorAdj = ((unsigned long)DeltaX << 16) / (unsigned long)DeltaY;
    while( --DeltaY )
    {
      ErrorAccTemp = ErrorAcc;
      ErrorAcc += ErrorAdj;
      if ( ErrorAcc <= ErrorAccTemp )
      {
        x0 += XDir;
      }
      y0++;
      Weighting = ErrorAcc >> IntensityShift;
      u8g_DrawWuPixel(u8g, x0, y0, 0 +Weighting);
      Weighting ^= WeightingComplementMask;
      u8g_DrawWuPixel(u8g, x0+XDir, y0, 0 +Weighting);
    }
  }
  else
  {
    ErrorAdj = ((unsigned long)DeltaY << 16) / (unsigned long)DeltaX;
    while( --DeltaX )
    {
      ErrorAccTemp = ErrorAcc;
      ErrorAcc += ErrorAdj;
      if ( ErrorAcc <= ErrorAccTemp )
      {
        y0++;
      }
      x0 += XDir;
      Weighting = ErrorAcc >> IntensityShift;
      u8g_DrawWuPixel(u8g, x0, y0, 0 +Weighting);
      Weighting ^= WeightingComplementMask;
      u8g_DrawWuPixel(u8g, x0, y0+1, 0 +Weighting);
    }
  }
  u8g_DrawWuPixel(u8g, x1, y1, 0);
}

variable_types:
ErrorAdj
unsigned short

variable_types:
ErrorAcc
unsigned short

variable_types:
ErrorAccTemp
unsigned short

variable_types:
IntensityShift
unsigned short

variable_types:
DeltaX
unsigned short

variable_types:
DeltaY
unsigned short

variable_types:
XDir
unsigned short

variable_types:
Weighting
unsigned char

variable_types:
WeightingComplementMask
unsigned char

variable_types:
temp
unsigned short

user_defined_types: struct _u8g_dev_arg_pixel_t { unsigned short x; unsigned char pixel; unsigned char dir; unsigned char color; unsigned char hi_color; unsigned char blue; }

user_defined_types: struct _u8g_box_t { unsigned short x0; }

user_defined_types: struct _u8g_dev_t { unsigned char (*dev_fn)(struct _u8g_t *u8g, struct _u8g_dev_t *dev, unsigned char msg, void *arg); void *dev_mem; unsigned char (*com_fn)(struct _u8g_t *u8g, unsigned char msg, unsigned char arg_val, void *arg_ptr); }


decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
_BYTE v4[104]; // [rsp+0h] [rbp-68h] BYREF

u8g_Init(v4, &u8g_dev_sdl_2bit, envp);
u8g_FirstPage(v4);
do
{
u8g_SetFont(v4, &u8g_font_10x20);
u8g_SetFont(v4, &u8g_font_fur25);
u8g_GetFontBBXWidth(v4);
u8g_GetFontBBXHeight(v4);
u8g_SetColorIndex(v4, 1LL);
u8g_DrawStr(v4, 30LL, 35LL, "gabc");
u8g_SetColorIndex(v4, 2LL);
u8g_DrawStr(v4, 31LL, 36LL, "gabc");
u8g_SetColorIndex(v4, 3LL);
u8g_DrawStr(v4, 32LL, 37LL, "gabc");
u8g_DrawWuLine2Bit((__int64)v4, 0, 63, 0x64u, 63);
u8g_DrawWuLine2Bit((__int64)v4, 0, 60, 0x64u, 58);
u8g_DrawWuLine2Bit((__int64)v4, 0, 57, 0x64u, 53);
}
while ( (unsigned __int8)u8g_NextPage(v4) );
while ( (int)u8g_sdl_get_key() < 0 )
;
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
_BYTE v4[104]; // [rsp+0h] [rbp-68h] BYREF

u8g_Init(v4, &u8g_dev_sdl_2bit, envp);
u8g_FirstPage(v4);
do
{
u8g_SetFont(v4, &u8g_font_10x20);
u8g_SetFont(v4, &u8g_font_fur25);
u8g_GetFontBBXWidth(v4);
u8g_GetFontBBXHeight(v4);
u8g_SetColorIndex(v4, 1LL);
u8g_DrawStr(v4, 30LL, 35LL, "gabc");
u8g_SetColorIndex(v4, 2LL);
u8g_DrawStr(v4, 31LL, 36LL, "gabc");
u8g_SetColorIndex(v4, 3LL);
u8g_DrawStr(v4, 32LL, 37LL, "gabc");
func1((__int64)v4, 0, 63, 0x64u, 63);
func1((__int64)v4, 0, 60, 0x64u, 58);
func1((__int64)v4, 0, 57, 0x64u, 53);
}
while ( (unsigned __int8)u8g_NextPage(v4) );
while ( (int)u8g_sdl_get_key() < 0 )
;
return 0;
}

original_code:
int main(void)
{
  u8g_uint_t w,h;
  u8g_t u8g;
  u8g_Init(&u8g, &u8g_dev_sdl_2bit);
  u8g_FirstPage(&u8g);
  do
  {
    u8g_SetFont(&u8g, u8g_font_10x20);
    u8g_SetFont(&u8g, u8g_font_fur25);
    w = u8g_GetFontBBXWidth(&u8g);
    h = u8g_GetFontBBXHeight(&u8g);
    u8g_SetColorIndex(&u8g, 1);
    u8g_DrawStr(&u8g, 30, 35, "gabc");
    u8g_SetColorIndex(&u8g, 2);
    u8g_DrawStr(&u8g, 30+1, 35+1, "gabc");
    u8g_SetColorIndex(&u8g, 3);
    u8g_DrawStr(&u8g, 30+2, 35+2, "gabc");
    u8g_DrawWuLine2Bit(&u8g, 0, 63, 100, 63);
    u8g_DrawWuLine2Bit(&u8g, 0, 63-3, 100, 63-5);
    u8g_DrawWuLine2Bit(&u8g, 0, 63-2*3, 100, 63-2*5);
  }while( u8g_NextPage(&u8g) );
  while( u8g_sdl_get_key() < 0 )
    ;
  return 0;
}

canonical_original_code:
int main()
{
  unsigned short w; unsigned short h;
  struct _u8g_t u8g;
  u8g_Init(&u8g, &u8g_dev_sdl_2bit);
  u8g_FirstPage(&u8g);
  do
  {
    u8g_SetFont(&u8g, u8g_font_10x20);
    u8g_SetFont(&u8g, u8g_font_fur25);
    w = u8g_GetFontBBXWidth(&u8g);
    h = u8g_GetFontBBXHeight(&u8g);
    u8g_SetColorIndex(&u8g, 1);
    u8g_DrawStr(&u8g, 30, 35, "gabc");
    u8g_SetColorIndex(&u8g, 2);
    u8g_DrawStr(&u8g, 30+1, 35+1, "gabc");
    u8g_SetColorIndex(&u8g, 3);
    u8g_DrawStr(&u8g, 30+2, 35+2, "gabc");
    u8g_DrawWuLine2Bit(&u8g, 0, 63, 100, 63);
    u8g_DrawWuLine2Bit(&u8g, 0, 63-3, 100, 63-5);
    u8g_DrawWuLine2Bit(&u8g, 0, 63-2*3, 100, 63-2*5);
  }while( u8g_NextPage(&u8g) );
  while( u8g_sdl_get_key() < 0 )
    ;
  return 0;
}

variable_types:
w
unsigned short

variable_types:
h
unsigned short

variable_types: struct _u8g_t { unsigned short width; unsigned short height; struct _u8g_dev_t { unsigned char (*dev_fn)(struct _u8g_t *u8g, struct _u8g_dev_t *dev, unsigned char msg, void *arg); void *dev_mem; unsigned char (*com_fn)(struct _u8g_t *u8g, unsigned char msg, unsigned char arg_val, void *arg_ptr); } *dev; unsigned char *font; unsigned char *cursor_font; unsigned char cursor_fg_color; unsigned char cursor_encoding; unsigned char mode; unsigned short cursor_x; unsigned short cursor_y; void (*cursor_fn)(struct _u8g_t *u8g); char glyph_dx; char glyph_x; char glyph_y; unsigned char glyph_width; unsigned char glyph_height; unsigned short (*font_calc_vref)(struct _u8g_t *u8g); unsigned char font_height_mode; char font_ref_ascent; char font_ref_descent; unsigned char font_line_spacing_factor; unsigned char line_spacing; struct _u8g_dev_arg_pixel_t { unsigned short x; unsigned char pixel; unsigned char dir; unsigned char color; unsigned char hi_color; unsigned char blue; } arg_pixel; void (*state_cb)(unsigned char msg); struct _u8g_box_t { unsigned short x0; } current_page; }


decompiled_code:
int __fastcall pic_gen_short_desc(__int64 a1, const char *a2)
{
_BYTE v3[96]; // [rsp+0h] [rbp-278h] BYREF
char s[256]; // [rsp+60h] [rbp-218h] BYREF
char command[280]; // [rsp+160h] [rbp-118h] BYREF

u8g_Init(v3, &u8g_dev_pbm);
u8g_SetFont(v3, a1);
if ( (unsigned __int8)u8g_IsGlyph(v3, 97LL) )
sprintf(s, "%s: 123 ABC abcdefg", a2);
else
strcpy(s, "0123456789");
u8g_FirstPage(v3);
do
{
u8g_SetFont(v3, a1);
u8g_DrawStr(v3, 0LL, 100LL, s);
}
while ( (unsigned __int8)u8g_NextPage(v3) );
u8g_SetFont(v3, a1);
sprintf(command, "convert u8g.pbm -trim %s_short.png", a2);
return system(command);
}

canonical_decompiled_code:
int __fastcall func0(__int64 a1, const char *a2)
{
_BYTE v3[96]; // [rsp+0h] [rbp-278h] BYREF
char s[256]; // [rsp+60h] [rbp-218h] BYREF
char command[280]; // [rsp+160h] [rbp-118h] BYREF

u8g_Init(v3, &u8g_dev_pbm);
u8g_SetFont(v3, a1);
if ( (unsigned __int8)u8g_IsGlyph(v3, 97LL) )
sprintf(s, "%s: 123 ABC abcdefg", a2);
else
strcpy(s, "0123456789");
u8g_FirstPage(v3);
do
{
u8g_SetFont(v3, a1);
u8g_DrawStr(v3, 0LL, 100LL, s);
}
while ( (unsigned __int8)u8g_NextPage(v3) );
u8g_SetFont(v3, a1);
sprintf(command, "convert u8g.pbm -trim %s_short.png", a2);
return system(command);
}

original_code:
void pic_gen_short_desc(const u8g_pgm_uint8_t *font, const char *name, u8g_uint_t width, const char *real_name)
{
  char s[256];
  u8g_t u8g;
  u8g_Init(&u8g, &u8g_dev_pbm);
    u8g_SetFont(&u8g, font);
  if ( u8g_IsGlyph(&u8g, 'a') != 0 )
    sprintf(s, "%s: 123 ABC abcdefg", name);
  else
    sprintf(s, "0123456789");
  u8g_FirstPage(&u8g);
  do
  {
    u8g_SetFont(&u8g, font);
    u8g_DrawStr(&u8g, 0, 100, s);
  }while( u8g_NextPage(&u8g) );
  {
    char cmd[256];
    u8g_SetFont(&u8g, font);
    sprintf(cmd, "convert u8g.pbm -trim %s_short.png", name );
    system(cmd);
  }
}

canonical_original_code:
void pic_gen_short_desc(unsigned char *font, char *name, unsigned short width, char *real_name)
{
  char s[256];
  struct _u8g_t u8g;
  u8g_Init(&u8g, &u8g_dev_pbm);
    u8g_SetFont(&u8g, font);
  if ( u8g_IsGlyph(&u8g, 'a') != 0 )
    sprintf(s, "%s: 123 ABC abcdefg", name);
  else
    sprintf(s, "0123456789");
  u8g_FirstPage(&u8g);
  do
  {
    u8g_SetFont(&u8g, font);
    u8g_DrawStr(&u8g, 0, 100, s);
  }while( u8g_NextPage(&u8g) );
  {
    char cmd[256];
    u8g_SetFont(&u8g, font);
    sprintf(cmd, "convert u8g.pbm -trim %s_short.png", name );
    system(cmd);
  }
}

variable_types:
font
unsigned char *

variable_types:
name
char *

variable_types:
width
unsigned short

variable_types:
s
char [256]

variable_types:
cmd
char [256]