test

decompiled_code:
__int64 test()
{
const char *v0; // r13
unsigned int v1; // er12
size_t i; // rsi
int v3; // eax
int j; // eax
__int128 *v5; // r12
__int64 v6; // rsi
int v7; // er12
__int64 v8; // rax
__int128 *v9; // r12
__int64 v10; // rsi
int v11; // er12
__int64 v12; // rax
__int64 v13; // rsi
int v14; // eax
size_t v15; // r14
int v16; // ebx
size_t v17; // rax
__int64 v18; // r15
unsigned int v19; // ebx
__int64 *v21; // r12
__int64 v22; // rsi
__int64 v23; // r12
__int64 v24; // rsi
__int64 v25; // r12
__int64 v26; // rsi
__int64 v27; // [rsp+0h] [rbp-1118h]
__int64 v28; // [rsp+0h] [rbp-1118h]
int v29; // [rsp+14h] [rbp-1104h] BYREF
__int64 v30; // [rsp+18h] [rbp-1100h] BYREF
__int64 v31; // [rsp+20h] [rbp-10F8h] BYREF
__int64 v32; // [rsp+28h] [rbp-10F0h] BYREF
__int128 s1; // [rsp+30h] [rbp-10E8h] BYREF
__int128 v34; // [rsp+40h] [rbp-10D8h] BYREF
__int64 v35; // [rsp+50h] [rbp-10C8h]
__int128 v36; // [rsp+60h] [rbp-10B8h] BYREF
__int128 v37; // [rsp+70h] [rbp-10A8h] BYREF
__int64 v38; // [rsp+80h] [rbp-1098h] BYREF
char v39[4232]; // [rsp+90h] [rbp-1088h] BYREF

v0 = "abcdefghijklmnopqrstuvwxyz";
v1 = 0;
puts("testing blowfish in raw ecb mode");
v29 = 0;
for ( i = 26LL; ; i = strlen(v0) )
{
BF_set_key(v39, i, v0);
v30 = bf_plain[v29];
BF_encrypt(&v30, v39);
if ( v30 != bf_cipher[v29] )
{
v1 = 1;
puts("BF_encrypt error encrypting");
printf("got :");
printf("%08lX ", (unsigned int)v30);
printf("%08lX ", HIDWORD(v30));
putchar(10);
printf("expected:");
printf("%08lX ", LODWORD(bf_cipher[v29]));
printf("%08lX ", HIDWORD(bf_cipher[v29]));
putchar(10);
}
BF_decrypt(&v30, v39);
if ( v30 != bf_plain[v29] )
break;
v3 = v29 + 1;
v29 = v3;
if ( v3 > 1 )
goto LABEL_8;
LABEL_4:
v0 = (&bf_key)[v3];
}
v1 = 1;
puts("BF_encrypt error decrypting");
printf("got :");
printf("%08lX ", (unsigned int)v30);
printf("%08lX ", HIDWORD(v30));
putchar(10);
printf("expected:");
printf("%08lX ", LODWORD(bf_plain[v29]));
printf("%08lX ", HIDWORD(bf_plain[v29]));
putchar(10);
v3 = v29 + 1;
v29 = v3;
if ( v3 <= 1 )
goto LABEL_4;
LABEL_8:
puts("testing blowfish in ecb mode");
v29 = 0;
for ( j = 0; j <= 33; v29 = j )
{
while ( 1 )
{
BF_set_key(v39, 8LL, (char *)&ecb_data + 8 * j);
BF_ecb_encrypt(&plain_data[v29], &v32, v39, 1LL);
if ( cipher_data[v29] != v32 )
{
v5 = (__int128 *)&v32;
puts("BF_ecb_encrypt blowfish error encrypting");
printf("got :");
do
{
v6 = *(unsigned __int8 *)v5;
v5 = (__int128 *)((char *)v5 + 1);
printf("%02X ", v6);
}
while ( &s1 != v5 );
v7 = 0;
putchar(10);
printf("expected:");
do
{
v8 = v7++;
printf("%02X ", *((unsigned __int8 *)&cipher_data[v29] + v8));
}
while ( v7 != 8 );
v1 = 1;
putchar(10);
}
BF_ecb_encrypt(&v32, &v32, v39, 0LL);
if ( plain_data[v29] != v32 )
break;
j = v29 + 1;
v29 = j;
if ( j > 33 )
goto LABEL_22;
}
v9 = (__int128 *)&v32;
puts("BF_ecb_encrypt error decrypting");
printf("got :");
do
{
v10 = *(unsigned __int8 *)v9;
v9 = (__int128 *)((char *)v9 + 1);
printf("%02X ", v10);
}
while ( &s1 != v9 );
v11 = 0;
putchar(10);
printf("expected:");
do
{
v12 = v11++;
printf("%02X ", *((unsigned __int8 *)&plain_data[v29] + v12));
}
while ( v11 != 8 );
v1 = 1;
putchar(10);
j = v29 + 1;
}
LABEL_22:
puts("testing blowfish set_key");
v29 = 1;
v13 = 1LL;
do
{
while ( 1 )
{
BF_set_key(v39, v13, key_test);
BF_ecb_encrypt(&key_data, &v32, v39, 1LL);
if ( v32 != key_out[v29 - 1] )
break;
v13 = (unsigned int)(v29 + 1);
v29 = v13;
if ( (int)v13 > 24 )
goto LABEL_26;
}
v1 = 1;
puts("blowfish setkey error");
v13 = (unsigned int)(v29 + 1);
v29 = v13;
}
while ( (int)v13 <= 24 );
LABEL_26:
puts("testing blowfish in cbc mode");
v14 = strlen(cbc_data);
v15 = (unsigned int)(v14 + 1);
v16 = v14;
BF_set_key(v39, 16LL, &cbc_key);
v31 = 0x1032547698BADCFELL;
v35 = 0LL;
v38 = 0LL;
s1 = 0LL;
v34 = 0LL;
v36 = 0LL;
v37 = 0LL;
BF_cbc_encrypt(cbc_data, &v36, v15, v39, &v31, 1LL);
if ( cbc_ok != v36 || xmmword_E70 != v37 )
{
v21 = (__int64 *)&v36;
puts("BF_cbc_encrypt encrypt error");
do
{
v22 = *(unsigned __int8 *)v21;
v21 = (__int64 *)((char *)v21 + 1);
printf("0x%02X,", v22);
}
while ( &v38 != v21 );
v1 = 1;
}
v31 = 0x1032547698BADCFELL;
BF_cbc_encrypt(&v36, &s1, v15, v39, &v31, 0LL);
v17 = strlen(cbc_data);
if ( memcmp(&s1, cbc_data, v17 + 1) )
{
v1 = 1;
puts("BF_cbc_encrypt decrypt error");
}
v18 = (unsigned int)(v16 - 12);
puts("testing blowfish in cfb64 mode");
BF_set_key(v39, 16LL, &cbc_key);
s1 = 0LL;
v34 = 0LL;
v35 = 0LL;
v36 = 0LL;
v37 = 0LL;
v38 = 0LL;
v31 = 0x1032547698BADCFELL;
v29 = 0;
BF_cfb64_encrypt(cbc_data, &v36, 13LL, v39, &v31, &v29, 1LL);
LODWORD(v27) = 1;
BF_cfb64_encrypt(&cbc_data[13], (char *)&v36 + 13, v18, v39, &v31, &v29, v27);
if ( memcmp(&v36, cfb64_ok, v15) )
{
v25 = 0LL;
puts("BF_cfb64_encrypt encrypt error");
do
{
v26 = *((unsigned __int8 *)&v36 + v25++);
printf("0x%02X,", v26);
}
while ( (int)v15 > (int)v25 );
v1 = 1;
}
v19 = v16 - 16;
v29 = 0;
v31 = 0x1032547698BADCFELL;
BF_cfb64_encrypt(&v36, &s1, 17LL, v39, &v31, &v29, 0LL);
LODWORD(v28) = 0;
BF_cfb64_encrypt((char *)&v37 + 1, (char *)&v34 + 1, v19, v39, &v31, &v29, v28);
if ( memcmp(&s1, cbc_data, v15) )
{
v1 = 1;
puts("BF_cfb64_encrypt decrypt error");
}
puts("testing blowfish in ofb64");
BF_set_key(v39, 16LL, &cbc_key);
v31 = 0x1032547698BADCFELL;
s1 = 0LL;
v34 = 0LL;
v36 = 0LL;
v37 = 0LL;
v35 = 0LL;
v38 = 0LL;
v29 = 0;
BF_ofb64_encrypt(cbc_data, &v36, 13LL, v39, &v31, &v29);
BF_ofb64_encrypt(&cbc_data[13], (char *)&v36 + 13, v18, v39, &v31, &v29);
if ( memcmp(&v36, ofb64_ok, v15) )
{
v23 = 0LL;
puts("BF_ofb64_encrypt encrypt error");
do
{
v24 = *((unsigned __int8 *)&v36 + v23++);
printf("0x%02X,", v24);
}
while ( (int)v15 > (int)v23 );
v1 = 1;
}
v31 = 0x1032547698BADCFELL;
v29 = 0;
BF_ofb64_encrypt(&v36, &s1, 17LL, v39, &v31, &v29);
BF_ofb64_encrypt((char *)&v37 + 1, (char *)&v34 + 1, v19, v39, &v31, &v29);
if ( memcmp(&s1, cbc_data, v15) )
{
v1 = 1;
puts("BF_ofb64_encrypt decrypt error");
}
return v1;
}

canonical_decompiled_code:
__int64 func1()
{
const char *v0; // r13
unsigned int v1; // er12
size_t i; // rsi
int v3; // eax
int j; // eax
__int128 *v5; // r12
__int64 v6; // rsi
int v7; // er12
__int64 v8; // rax
__int128 *v9; // r12
__int64 v10; // rsi
int v11; // er12
__int64 v12; // rax
__int64 v13; // rsi
int v14; // eax
size_t v15; // r14
int v16; // ebx
size_t v17; // rax
__int64 v18; // r15
unsigned int v19; // ebx
__int64 *v21; // r12
__int64 v22; // rsi
__int64 v23; // r12
__int64 v24; // rsi
__int64 v25; // r12
__int64 v26; // rsi
__int64 v27; // [rsp+0h] [rbp-1118h]
__int64 v28; // [rsp+0h] [rbp-1118h]
int v29; // [rsp+14h] [rbp-1104h] BYREF
__int64 v30; // [rsp+18h] [rbp-1100h] BYREF
__int64 v31; // [rsp+20h] [rbp-10F8h] BYREF
__int64 v32; // [rsp+28h] [rbp-10F0h] BYREF
__int128 s1; // [rsp+30h] [rbp-10E8h] BYREF
__int128 v34; // [rsp+40h] [rbp-10D8h] BYREF
__int64 v35; // [rsp+50h] [rbp-10C8h]
__int128 v36; // [rsp+60h] [rbp-10B8h] BYREF
__int128 v37; // [rsp+70h] [rbp-10A8h] BYREF
__int64 v38; // [rsp+80h] [rbp-1098h] BYREF
char v39[4232]; // [rsp+90h] [rbp-1088h] BYREF

v0 = "abcdefghijklmnopqrstuvwxyz";
v1 = 0;
puts("testing blowfish in raw ecb mode");
v29 = 0;
for ( i = 26LL; ; i = strlen(v0) )
{
BF_set_key(v39, i, v0);
v30 = bf_plain[v29];
BF_encrypt(&v30, v39);
if ( v30 != bf_cipher[v29] )
{
v1 = 1;
puts("BF_encrypt error encrypting");
printf("got :");
printf("%08lX ", (unsigned int)v30);
printf("%08lX ", HIDWORD(v30));
putchar(10);
printf("expected:");
printf("%08lX ", LODWORD(bf_cipher[v29]));
printf("%08lX ", HIDWORD(bf_cipher[v29]));
putchar(10);
}
BF_decrypt(&v30, v39);
if ( v30 != bf_plain[v29] )
break;
v3 = v29 + 1;
v29 = v3;
if ( v3 > 1 )
goto LABEL_8;
LABEL_4:
v0 = (&bf_key)[v3];
}
v1 = 1;
puts("BF_encrypt error decrypting");
printf("got :");
printf("%08lX ", (unsigned int)v30);
printf("%08lX ", HIDWORD(v30));
putchar(10);
printf("expected:");
printf("%08lX ", LODWORD(bf_plain[v29]));
printf("%08lX ", HIDWORD(bf_plain[v29]));
putchar(10);
v3 = v29 + 1;
v29 = v3;
if ( v3 <= 1 )
goto LABEL_4;
LABEL_8:
puts("testing blowfish in ecb mode");
v29 = 0;
for ( j = 0; j <= 33; v29 = j )
{
while ( 1 )
{
BF_set_key(v39, 8LL, (char *)&ecb_data + 8 * j);
BF_ecb_encrypt(&plain_data[v29], &v32, v39, 1LL);
if ( cipher_data[v29] != v32 )
{
v5 = (__int128 *)&v32;
puts("BF_ecb_encrypt blowfish error encrypting");
printf("got :");
do
{
v6 = *(unsigned __int8 *)v5;
v5 = (__int128 *)((char *)v5 + 1);
printf("%02X ", v6);
}
while ( &s1 != v5 );
v7 = 0;
putchar(10);
printf("expected:");
do
{
v8 = v7++;
printf("%02X ", *((unsigned __int8 *)&cipher_data[v29] + v8));
}
while ( v7 != 8 );
v1 = 1;
putchar(10);
}
BF_ecb_encrypt(&v32, &v32, v39, 0LL);
if ( plain_data[v29] != v32 )
break;
j = v29 + 1;
v29 = j;
if ( j > 33 )
goto LABEL_22;
}
v9 = (__int128 *)&v32;
puts("BF_ecb_encrypt error decrypting");
printf("got :");
do
{
v10 = *(unsigned __int8 *)v9;
v9 = (__int128 *)((char *)v9 + 1);
printf("%02X ", v10);
}
while ( &s1 != v9 );
v11 = 0;
putchar(10);
printf("expected:");
do
{
v12 = v11++;
printf("%02X ", *((unsigned __int8 *)&plain_data[v29] + v12));
}
while ( v11 != 8 );
v1 = 1;
putchar(10);
j = v29 + 1;
}
LABEL_22:
puts("testing blowfish set_key");
v29 = 1;
v13 = 1LL;
do
{
while ( 1 )
{
BF_set_key(v39, v13, key_test);
BF_ecb_encrypt(&key_data, &v32, v39, 1LL);
if ( v32 != key_out[v29 - 1] )
break;
v13 = (unsigned int)(v29 + 1);
v29 = v13;
if ( (int)v13 > 24 )
goto LABEL_26;
}
v1 = 1;
puts("blowfish setkey error");
v13 = (unsigned int)(v29 + 1);
v29 = v13;
}
while ( (int)v13 <= 24 );
LABEL_26:
puts("testing blowfish in cbc mode");
v14 = strlen(cbc_data);
v15 = (unsigned int)(v14 + 1);
v16 = v14;
BF_set_key(v39, 16LL, &cbc_key);
v31 = 0x1032547698BADCFELL;
v35 = 0LL;
v38 = 0LL;
s1 = 0LL;
v34 = 0LL;
v36 = 0LL;
v37 = 0LL;
BF_cbc_encrypt(cbc_data, &v36, v15, v39, &v31, 1LL);
if ( cbc_ok != v36 || xmmword_E70 != v37 )
{
v21 = (__int64 *)&v36;
puts("BF_cbc_encrypt encrypt error");
do
{
v22 = *(unsigned __int8 *)v21;
v21 = (__int64 *)((char *)v21 + 1);
printf("0x%02X,", v22);
}
while ( &v38 != v21 );
v1 = 1;
}
v31 = 0x1032547698BADCFELL;
BF_cbc_encrypt(&v36, &s1, v15, v39, &v31, 0LL);
v17 = strlen(cbc_data);
if ( memcmp(&s1, cbc_data, v17 + 1) )
{
v1 = 1;
puts("BF_cbc_encrypt decrypt error");
}
v18 = (unsigned int)(v16 - 12);
puts("testing blowfish in cfb64 mode");
BF_set_key(v39, 16LL, &cbc_key);
s1 = 0LL;
v34 = 0LL;
v35 = 0LL;
v36 = 0LL;
v37 = 0LL;
v38 = 0LL;
v31 = 0x1032547698BADCFELL;
v29 = 0;
BF_cfb64_encrypt(cbc_data, &v36, 13LL, v39, &v31, &v29, 1LL);
LODWORD(v27) = 1;
BF_cfb64_encrypt(&cbc_data[13], (char *)&v36 + 13, v18, v39, &v31, &v29, v27);
if ( memcmp(&v36, cfb64_ok, v15) )
{
v25 = 0LL;
puts("BF_cfb64_encrypt encrypt error");
do
{
v26 = *((unsigned __int8 *)&v36 + v25++);
printf("0x%02X,", v26);
}
while ( (int)v15 > (int)v25 );
v1 = 1;
}
v19 = v16 - 16;
v29 = 0;
v31 = 0x1032547698BADCFELL;
BF_cfb64_encrypt(&v36, &s1, 17LL, v39, &v31, &v29, 0LL);
LODWORD(v28) = 0;
BF_cfb64_encrypt((char *)&v37 + 1, (char *)&v34 + 1, v19, v39, &v31, &v29, v28);
if ( memcmp(&s1, cbc_data, v15) )
{
v1 = 1;
puts("BF_cfb64_encrypt decrypt error");
}
puts("testing blowfish in ofb64");
BF_set_key(v39, 16LL, &cbc_key);
v31 = 0x1032547698BADCFELL;
s1 = 0LL;
v34 = 0LL;
v36 = 0LL;
v37 = 0LL;
v35 = 0LL;
v38 = 0LL;
v29 = 0;
BF_ofb64_encrypt(cbc_data, &v36, 13LL, v39, &v31, &v29);
BF_ofb64_encrypt(&cbc_data[13], (char *)&v36 + 13, v18, v39, &v31, &v29);
if ( memcmp(&v36, ofb64_ok, v15) )
{
v23 = 0LL;
puts("BF_ofb64_encrypt encrypt error");
do
{
v24 = *((unsigned __int8 *)&v36 + v23++);
printf("0x%02X,", v24);
}
while ( (int)v15 > (int)v23 );
v1 = 1;
}
v31 = 0x1032547698BADCFELL;
v29 = 0;
BF_ofb64_encrypt(&v36, &s1, 17LL, v39, &v31, &v29);
BF_ofb64_encrypt((char *)&v37 + 1, (char *)&v34 + 1, v19, v39, &v31, &v29);
if ( memcmp(&s1, cbc_data, v15) )
{
v1 = 1;
puts("BF_ofb64_encrypt decrypt error");
}
return v1;
}

original_code:
static int test(void)
{
    unsigned char cbc_in[40], cbc_out[40], iv[8];
    int i, n, err = 0;
    BF_KEY key;
    unsigned int data[2];
    unsigned char out[8];
    unsigned int len;
    printf("testing blowfish in raw ecb mode\n");
    for (n = 0; n < 2; n++) {
        BF_set_key(&key, strlen(bf_key[n]), (unsigned char *)bf_key[n]);
        data[0] = bf_plain[n][0];
        data[1] = bf_plain[n][1];
        BF_encrypt(data, &key);
        if (memcmp(&(bf_cipher[n][0]), &(data[0]), 8) != 0) {
            printf("BF_encrypt error encrypting\n");
            printf("got     :");
            for (i = 0; i < 2; i++)
                printf("%08lX ", (unsigned long)data[i]);
            printf("\n");
            printf("expected:");
            for (i = 0; i < 2; i++)
                printf("%08lX ", (unsigned long)bf_cipher[n][i]);
            err = 1;
            printf("\n");
        }
        BF_decrypt(&(data[0]), &key);
        if (memcmp(&(bf_plain[n][0]), &(data[0]), 8) != 0) {
            printf("BF_encrypt error decrypting\n");
            printf("got     :");
            for (i = 0; i < 2; i++)
                printf("%08lX ", (unsigned long)data[i]);
            printf("\n");
            printf("expected:");
            for (i = 0; i < 2; i++)
                printf("%08lX ", (unsigned long)bf_plain[n][i]);
            printf("\n");
            err = 1;
        }
    }
    printf("testing blowfish in ecb mode\n");
    for (n = 0; n < 34; n++) {
        BF_set_key(&key, 8, ecb_data[n]);
        BF_ecb_encrypt(&(plain_data[n][0]), out, &key, 1);
        if (memcmp(&(cipher_data[n][0]), out, 8) != 0) {
            printf("BF_ecb_encrypt blowfish error encrypting\n");
            printf("got     :");
            for (i = 0; i < 8; i++)
                printf("%02X ", out[i]);
            printf("\n");
            printf("expected:");
            for (i = 0; i < 8; i++)
                printf("%02X ", cipher_data[n][i]);
            err = 1;
            printf("\n");
        }
        BF_ecb_encrypt(out, out, &key, 0);
        if (memcmp(&(plain_data[n][0]), out, 8) != 0) {
            printf("BF_ecb_encrypt error decrypting\n");
            printf("got     :");
            for (i = 0; i < 8; i++)
                printf("%02X ", out[i]);
            printf("\n");
            printf("expected:");
            for (i = 0; i < 8; i++)
                printf("%02X ", plain_data[n][i]);
            printf("\n");
            err = 1;
        }
    }
    printf("testing blowfish set_key\n");
    for (n = 1; n < 25; n++) {
        BF_set_key(&key, n, key_test);
        BF_ecb_encrypt(key_data, out, &key, 1);
        if (memcmp(out, &(key_out[i = n - 1][0]), 8) != 0) {
            printf("blowfish setkey error\n");
            err = 1;
        }
    }
    printf("testing blowfish in cbc mode\n");
    len = strlen(cbc_data) + 1;
    BF_set_key(&key, 16, cbc_key);
    memset(cbc_in, 0, sizeof cbc_in);
    memset(cbc_out, 0, sizeof cbc_out);
    memcpy(iv, cbc_iv, sizeof iv);
    BF_cbc_encrypt((unsigned char *)cbc_data, cbc_out, len,
                   &key, iv, 1);
    if (memcmp(cbc_out, cbc_ok, 32) != 0) {
        err = 1;
        printf("BF_cbc_encrypt encrypt error\n");
        for (i = 0; i < 32; i++)
            printf("0x%02X,", cbc_out[i]);
    }
    memcpy(iv, cbc_iv, 8);
    BF_cbc_encrypt(cbc_out, cbc_in, len, &key, iv, 0);
    if (memcmp(cbc_in, cbc_data, strlen(cbc_data) + 1) != 0) {
        printf("BF_cbc_encrypt decrypt error\n");
        err = 1;
    }
    printf("testing blowfish in cfb64 mode\n");
    BF_set_key(&key, 16, cbc_key);
    memset(cbc_in, 0, 40);
    memset(cbc_out, 0, 40);
    memcpy(iv, cbc_iv, 8);
    n = 0;
    BF_cfb64_encrypt((unsigned char *)cbc_data, cbc_out, (long)13,
                     &key, iv, &n, 1);
    BF_cfb64_encrypt((unsigned char *)&(cbc_data[13]), &(cbc_out[13]),
                     len - 13, &key, iv, &n, 1);
    if (memcmp(cbc_out, cfb64_ok, (int)len) != 0) {
        err = 1;
        printf("BF_cfb64_encrypt encrypt error\n");
        for (i = 0; i < (int)len; i++)
            printf("0x%02X,", cbc_out[i]);
    }
    n = 0;
    memcpy(iv, cbc_iv, 8);
    BF_cfb64_encrypt(cbc_out, cbc_in, 17, &key, iv, &n, 0);
    BF_cfb64_encrypt(&(cbc_out[17]), &(cbc_in[17]), len - 17,
                     &key, iv, &n, 0);
    if (memcmp(cbc_in, cbc_data, (int)len) != 0) {
        printf("BF_cfb64_encrypt decrypt error\n");
        err = 1;
    }
    printf("testing blowfish in ofb64\n");
    BF_set_key(&key, 16, cbc_key);
    memset(cbc_in, 0, 40);
    memset(cbc_out, 0, 40);
    memcpy(iv, cbc_iv, 8);
    n = 0;
    BF_ofb64_encrypt((unsigned char *)cbc_data, cbc_out, (long)13, &key, iv,
                     &n);
    BF_ofb64_encrypt((unsigned char *)&(cbc_data[13]), &(cbc_out[13]),
                     len - 13, &key, iv, &n);
    if (memcmp(cbc_out, ofb64_ok, (int)len) != 0) {
        err = 1;
        printf("BF_ofb64_encrypt encrypt error\n");
        for (i = 0; i < (int)len; i++)
            printf("0x%02X,", cbc_out[i]);
    }
    n = 0;
    memcpy(iv, cbc_iv, 8);
    BF_ofb64_encrypt(cbc_out, cbc_in, 17, &key, iv, &n);
    BF_ofb64_encrypt(&(cbc_out[17]), &(cbc_in[17]), len - 17, &key, iv, &n);
    if (memcmp(cbc_in, cbc_data, (int)len) != 0) {
        printf("BF_ofb64_encrypt decrypt error\n");
        err = 1;
    }
    return (err);
}

canonical_original_code:
static int test()
{
    unsigned char cbc_in[40]; unsigned char cbc_out[40]; unsigned char iv[8];
    int i; int n; int err = 0;
    struct bf_key_st key;
    unsigned int data[2];
    unsigned char out[8];
    unsigned int len;
    printf("testing blowfish in raw ecb mode\n");
    for (n = 0; n < 2; n++) {
        BF_set_key(&key, strlen(bf_key[n]), (unsigned char *)bf_key[n]);
        data[0] = bf_plain[n][0];
        data[1] = bf_plain[n][1];
        BF_encrypt(data, &key);
        if (memcmp(&(bf_cipher[n][0]), &(data[0]), 8) != 0) {
            printf("BF_encrypt error encrypting\n");
            printf("got     :");
            for (i = 0; i < 2; i++)
                printf("%08lX ", (unsigned long)data[i]);
            printf("\n");
            printf("expected:");
            for (i = 0; i < 2; i++)
                printf("%08lX ", (unsigned long)bf_cipher[n][i]);
            err = 1;
            printf("\n");
        }
        BF_decrypt(&(data[0]), &key);
        if (memcmp(&(bf_plain[n][0]), &(data[0]), 8) != 0) {
            printf("BF_encrypt error decrypting\n");
            printf("got     :");
            for (i = 0; i < 2; i++)
                printf("%08lX ", (unsigned long)data[i]);
            printf("\n");
            printf("expected:");
            for (i = 0; i < 2; i++)
                printf("%08lX ", (unsigned long)bf_plain[n][i]);
            printf("\n");
            err = 1;
        }
    }
    printf("testing blowfish in ecb mode\n");
    for (n = 0; n < 34; n++) {
        BF_set_key(&key, 8, ecb_data[n]);
        BF_ecb_encrypt(&(plain_data[n][0]), out, &key, 1);
        if (memcmp(&(cipher_data[n][0]), out, 8) != 0) {
            printf("BF_ecb_encrypt blowfish error encrypting\n");
            printf("got     :");
            for (i = 0; i < 8; i++)
                printf("%02X ", out[i]);
            printf("\n");
            printf("expected:");
            for (i = 0; i < 8; i++)
                printf("%02X ", cipher_data[n][i]);
            err = 1;
            printf("\n");
        }
        BF_ecb_encrypt(out, out, &key, 0);
        if (memcmp(&(plain_data[n][0]), out, 8) != 0) {
            printf("BF_ecb_encrypt error decrypting\n");
            printf("got     :");
            for (i = 0; i < 8; i++)
                printf("%02X ", out[i]);
            printf("\n");
            printf("expected:");
            for (i = 0; i < 8; i++)
                printf("%02X ", plain_data[n][i]);
            printf("\n");
            err = 1;
        }
    }
    printf("testing blowfish set_key\n");
    for (n = 1; n < 25; n++) {
        BF_set_key(&key, n, key_test);
        BF_ecb_encrypt(key_data, out, &key, 1);
        if (memcmp(out, &(key_out[i = n - 1][0]), 8) != 0) {
            printf("blowfish setkey error\n");
            err = 1;
        }
    }
    printf("testing blowfish in cbc mode\n");
    len = strlen(cbc_data) + 1;
    BF_set_key(&key, 16, cbc_key);
    memset(cbc_in, 0, sizeof cbc_in);
    memset(cbc_out, 0, sizeof cbc_out);
    memcpy(iv, cbc_iv, sizeof iv);
    BF_cbc_encrypt((unsigned char *)cbc_data, cbc_out, len,
                   &key, iv, 1);
    if (memcmp(cbc_out, cbc_ok, 32) != 0) {
        err = 1;
        printf("BF_cbc_encrypt encrypt error\n");
        for (i = 0; i < 32; i++)
            printf("0x%02X,", cbc_out[i]);
    }
    memcpy(iv, cbc_iv, 8);
    BF_cbc_encrypt(cbc_out, cbc_in, len, &key, iv, 0);
    if (memcmp(cbc_in, cbc_data, strlen(cbc_data) + 1) != 0) {
        printf("BF_cbc_encrypt decrypt error\n");
        err = 1;
    }
    printf("testing blowfish in cfb64 mode\n");
    BF_set_key(&key, 16, cbc_key);
    memset(cbc_in, 0, 40);
    memset(cbc_out, 0, 40);
    memcpy(iv, cbc_iv, 8);
    n = 0;
    BF_cfb64_encrypt((unsigned char *)cbc_data, cbc_out, (long)13,
                     &key, iv, &n, 1);
    BF_cfb64_encrypt((unsigned char *)&(cbc_data[13]), &(cbc_out[13]),
                     len - 13, &key, iv, &n, 1);
    if (memcmp(cbc_out, cfb64_ok, (int)len) != 0) {
        err = 1;
        printf("BF_cfb64_encrypt encrypt error\n");
        for (i = 0; i < (int)len; i++)
            printf("0x%02X,", cbc_out[i]);
    }
    n = 0;
    memcpy(iv, cbc_iv, 8);
    BF_cfb64_encrypt(cbc_out, cbc_in, 17, &key, iv, &n, 0);
    BF_cfb64_encrypt(&(cbc_out[17]), &(cbc_in[17]), len - 17,
                     &key, iv, &n, 0);
    if (memcmp(cbc_in, cbc_data, (int)len) != 0) {
        printf("BF_cfb64_encrypt decrypt error\n");
        err = 1;
    }
    printf("testing blowfish in ofb64\n");
    BF_set_key(&key, 16, cbc_key);
    memset(cbc_in, 0, 40);
    memset(cbc_out, 0, 40);
    memcpy(iv, cbc_iv, 8);
    n = 0;
    BF_ofb64_encrypt((unsigned char *)cbc_data, cbc_out, (long)13, &key, iv,
                     &n);
    BF_ofb64_encrypt((unsigned char *)&(cbc_data[13]), &(cbc_out[13]),
                     len - 13, &key, iv, &n);
    if (memcmp(cbc_out, ofb64_ok, (int)len) != 0) {
        err = 1;
        printf("BF_ofb64_encrypt encrypt error\n");
        for (i = 0; i < (int)len; i++)
            printf("0x%02X,", cbc_out[i]);
    }
    n = 0;
    memcpy(iv, cbc_iv, 8);
    BF_ofb64_encrypt(cbc_out, cbc_in, 17, &key, iv, &n);
    BF_ofb64_encrypt(&(cbc_out[17]), &(cbc_in[17]), len - 17, &key, iv, &n);
    if (memcmp(cbc_in, cbc_data, (int)len) != 0) {
        printf("BF_ofb64_encrypt decrypt error\n");
        err = 1;
    }
    return (err);
}

variable_types:
iv
unsigned char [8]

variable_types: i int

variable_types: n int

variable_types: err int

variable_types: struct bf_key_st { unsigned int P[-1]; unsigned int S[-1]; }

variable_types:
data
unsigned int [2]

variable_types:
out
unsigned char [8]

variable_types:
len
unsigned int


main

canonical_name: main

decompiled_code:
int __cdecl __noreturn main(int argc, const char **argv, const char **envp)
{
int v3; // edi

if ( argc <= 1 )
v3 = test(argc, argv, envp);
else
v3 = print_test_data(argc, argv, envp);
exit(v3);
}

canonical_decompiled_code:
int __cdecl __noreturn main(int argc, const char **argv, const char **envp)
{
int v3; // edi

if ( argc <= 1 )
v3 = func1(argc, argv, envp);
else
v3 = func0(argc, argv, envp);
exit(v3);
}

original_code:
int main(int argc, char *argv[])
{
    int ret;
    if (argc > 1)
        ret = print_test_data();
    else
        ret = test();
    exit(ret);
    return (0);
}

variable_types: argc int

variable_types:
argv
char *[]

variable_types: ret int

return_type: int


decompiled_code:
__int64 __fastcall by_dir_hash_cmp(unsigned __int64 **a1, unsigned __int64 **a2)
{
__int64 result; // rax
unsigned __int64 v3; // rdx

result = 1LL;
v3 = **a2;
if ( **a1 <= v3 )
result = (unsigned int)-(**a1 < v3);
return result;
}

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

result = 1LL;
v3 = **a2;
if ( **a1 <= v3 )
result = (unsigned int)-(**a1 < v3);
return result;
}

original_code:
static int by_dir_hash_cmp(const BY_DIR_HASH *const *a,
                           const BY_DIR_HASH *const *b)
{
    if ((*a)->hash > (*b)->hash)
        return 1;
    if ((*a)->hash < (*b)->hash)
        return -1;
    return 0;
}

canonical_original_code:
static int by_dir_hash_cmp(struct lookup_dir_hashes_st **a, struct lookup_dir_hashes_st **b)
{
    if ((*a)->hash > (*b)->hash)
        return 1;
    if ((*a)->hash < (*b)->hash)
        return -1;
    return 0;
}

variable_types: struct lookup_dir_hashes_st { unsigned long hash; int suffix; } **

variable_types:
b
struct lookup_dir_hashes_st **


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

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

original_code:
static void by_dir_hash_free(BY_DIR_HASH *hash)
{
    OPENSSL_free(hash);
}

canonical_original_code:
static void by_dir_hash_free(struct lookup_dir_hashes_st *hash)
{
    OPENSSL_free(hash);
}

variable_types: struct lookup_dir_hashes_st { unsigned long hash; int suffix; } *

return_type: void


decompiled_code:
char *__fastcall DES_crypt(__int64 a1, char *a2)
{
return DES_fcrypt(a1, a2, buff_0);
}

canonical_decompiled_code:
char *__fastcall func1(__int64 a1, char *a2)
{
return func0(a1, a2, buff_0);
}

original_code:
char *DES_crypt(const char *buf, const char *salt)
{
    static char buff[14];

#ifndef CHARSET_EBCDIC
    return (DES_fcrypt(buf, salt, buff));
#else
    char e_salt[2 + 1];
    char e_buf[32 + 1];         /* replace 32 by 8 ? */
    char *ret;

    /* Copy at most 2 chars of salt */
    if ((e_salt[0] = salt[0]) != '\0')
        e_salt[1] = salt[1];

    /* Copy at most 32 chars of password */
    strncpy(e_buf, buf, sizeof(e_buf));

    /* Make sure we have a delimiter */
    e_salt[sizeof(e_salt) - 1] = e_buf[sizeof(e_buf) - 1] = '\0';

    /* Convert the e_salt to ASCII, as that's what DES_fcrypt works on */
    ebcdic2ascii(e_salt, e_salt, sizeof e_salt);

    /* Convert the cleartext password to ASCII */
    ebcdic2ascii(e_buf, e_buf, sizeof e_buf);

    /* Encrypt it (from/to ASCII) */
    ret = DES_fcrypt(e_buf, e_salt, buff);

    /* Convert the result back to EBCDIC */
    ascii2ebcdic(ret, ret, strlen(ret));

    return ret;
#endif
}

canonical_original_code:
char *DES_crypt(char *buf, char *salt)
{
    static char buff[14];

#ifndef CHARSET_EBCDIC
    return (DES_fcrypt(buf, salt, buff));
#else
    char e_salt[-1];
    char e_buf[-1];         /* replace 32 by 8 ? */
    char *ret;

    /* Copy at most 2 chars of salt */
    if ((e_salt[0] = salt[0]) != '\0')
        e_salt[1] = salt[1];

    /* Copy at most 32 chars of password */
    strncpy(e_buf, buf, sizeof(e_buf));

    /* Make sure we have a delimiter */
    e_salt[sizeof(e_salt) - 1] = e_buf[sizeof(e_buf) - 1] = '\0';

    /* Convert the e_salt to ASCII, as that's what DES_fcrypt works on */
    ebcdic2ascii(e_salt, e_salt, sizeof e_salt);

    /* Convert the cleartext password to ASCII */
    ebcdic2ascii(e_buf, e_buf, sizeof e_buf);

    /* Encrypt it (from/to ASCII) */
    ret = DES_fcrypt(e_buf, e_salt, buff);

    /* Convert the result back to EBCDIC */
    ascii2ebcdic(ret, ret, strlen(ret));

    return ret;
#endif
}

variable_types:
buf
char *

variable_types:
salt
char *

variable_types:
buff
char [14]

variable_types:
ret
char *

return_type: char *


parseArgs

decompiled_code:
__int64 __fastcall parseArgs(int a1, __int64 a2)
{
int v2; // ebx
const char **v3; // rbp
int v4; // er12
const char **v5; // r15
const char *v6; // rdx
bool v8; // al
bool v9; // cf
bool v10; // zf
const char *v11; // rdi
__int64 v12; // rcx
const char *v13; // rsi
char v14; // al
bool v15; // cf
bool v16; // zf
const char *v17; // rdi
__int64 v18; // rcx
const char *v19; // rsi

v2 = a1 - 1;
verify_depth = 0;
verify_error = 0;
if ( a1 - 1 <= 0 )
{
if ( !perform )
perform = 3;
return 0LL;
}
v3 = (const char **)(a2 + 8);
v4 = 0;
do
{
while ( 1 )
{
v6 = *v3;
if ( !strcmp(*v3, "-connect") )
{
if ( !--v2 )
goto LABEL_29;
v5 = v3 + 1;
host = (char *)v3[1];
goto LABEL_5;
}
if ( !strcmp(*v3, "-reuse") )
break;
if ( !strcmp(*v3, "-new") )
{
perform = 1;
v5 = v3;
}
else if ( !strcmp(*v3, "-verify") )
{
if ( !--v2 )
goto LABEL_29;
v5 = v3 + 1;
verify_depth = atoi(v3[1]);
BIO_printf(bio_err, "verify depth is %d\n", verify_depth);
}
else if ( !strcmp(*v3, "-cert") )
{
if ( !--v2 )
goto LABEL_29;
v5 = v3 + 1;
t_cert_file = (__int64)v3[1];
}
else if ( !strcmp(*v3, "-key") )
{
if ( !--v2 )
goto LABEL_29;
v5 = v3 + 1;
t_key_file = (__int64)v3[1];
}
else if ( !strcmp(*v3, "-CApath") )
{
if ( !--v2 )
goto LABEL_29;
v5 = v3 + 1;
CApath = (__int64)v3[1];
}
else if ( !strcmp(*v3, "-CAfile") )
{
if ( !--v2 )
goto LABEL_29;
v5 = v3 + 1;
CAfile = (__int64)v3[1];
}
else if ( !strcmp(*v3, "-cipher") )
{
if ( !--v2 )
goto LABEL_29;
v5 = v3 + 1;
tm_cipher = (__int64)v3[1];
}
else if ( !strcmp(*v3, "-nbio") )
{
v5 = v3;
}
else if ( !strcmp(*v3, "-www") )
{
if ( !--v2 )
goto LABEL_29;
v5 = v3 + 1;
s_www_path = (__int64)v3[1];
if ( strlen((const char *)s_www_path) > 0x1F9C )
{
v4 = 1;
BIO_printf(bio_err, "-www option too long\n");
}
}
else
{
v8 = strcmp(*v3, "-bugs") != 0;
v9 = 0;
v10 = !v8;
if ( v8 )
{
v11 = "-ssl2";
v12 = 6LL;
v13 = *v3;
do
{
if ( !v12 )
break;
v9 = *v13 < (unsigned int)*v11;
v10 = *v13++ == *v11++;
--v12;
}
while ( v10 );
v14 = (!v9 && !v10) - v9;
v15 = 0;
v16 = v14 == 0;
if ( v14 )
{
v17 = "-ssl3";
v18 = 6LL;
v19 = *v3;
do
{
if ( !v18 )
break;
v15 = *v19 < (unsigned int)*v17;
v16 = *v19++ == *v17++;
--v18;
}
while ( v16 );
if ( (!v15 && !v16) == v15 )
{
v5 = v3;
s_time_meth = SSLv3_client_method(v17, v19, v6, v18);
}
else
{
if ( strcmp(*v3, "-time") )
{
BIO_printf(bio_err, "unknown option %s\n", v6);
if ( !perform )
perform = 3;
goto LABEL_29;
}
if ( !--v2 )
goto LABEL_29;
v5 = v3 + 1;
maxTime = atoi(v3[1]);
if ( maxTime <= 0 )
{
v4 = 1;
BIO_printf(bio_err, "time must be > 0\n");
}
}
}
else
{
v5 = v3;
s_time_meth = SSLv2_client_method(v11, v13, v6, v12);
}
}
else
{
st_bugs = 1;
v5 = v3;
}
}
LABEL_5:
v3 = v5 + 1;
if ( !--v2 )
goto LABEL_9;
}
perform = 2;
++v3;
--v2;
}
while ( v2 );
LABEL_9:
if ( !perform )
perform = 3;
if ( v4 )
{
LABEL_29:
s_time_usage();
return 0xFFFFFFFFLL;
}
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func2(int a1, __int64 a2)
{
int v2; // ebx
const char **v3; // rbp
int v4; // er12
const char **v5; // r15
const char *v6; // rdx
bool v8; // al
bool v9; // cf
bool v10; // zf
const char *v11; // rdi
__int64 v12; // rcx
const char *v13; // rsi
char v14; // al
bool v15; // cf
bool v16; // zf
const char *v17; // rdi
__int64 v18; // rcx
const char *v19; // rsi

v2 = a1 - 1;
verify_depth = 0;
verify_error = 0;
if ( a1 - 1 <= 0 )
{
if ( !perform )
perform = 3;
return 0LL;
}
v3 = (const char **)(a2 + 8);
v4 = 0;
do
{
while ( 1 )
{
v6 = *v3;
if ( !strcmp(*v3, "-connect") )
{
if ( !--v2 )
goto LABEL_29;
v5 = v3 + 1;
host = (char *)v3[1];
goto LABEL_5;
}
if ( !strcmp(*v3, "-reuse") )
break;
if ( !strcmp(*v3, "-new") )
{
perform = 1;
v5 = v3;
}
else if ( !strcmp(*v3, "-verify") )
{
if ( !--v2 )
goto LABEL_29;
v5 = v3 + 1;
verify_depth = atoi(v3[1]);
BIO_printf(bio_err, "verify depth is %d\n", verify_depth);
}
else if ( !strcmp(*v3, "-cert") )
{
if ( !--v2 )
goto LABEL_29;
v5 = v3 + 1;
t_cert_file = (__int64)v3[1];
}
else if ( !strcmp(*v3, "-key") )
{
if ( !--v2 )
goto LABEL_29;
v5 = v3 + 1;
t_key_file = (__int64)v3[1];
}
else if ( !strcmp(*v3, "-CApath") )
{
if ( !--v2 )
goto LABEL_29;
v5 = v3 + 1;
CApath = (__int64)v3[1];
}
else if ( !strcmp(*v3, "-CAfile") )
{
if ( !--v2 )
goto LABEL_29;
v5 = v3 + 1;
CAfile = (__int64)v3[1];
}
else if ( !strcmp(*v3, "-cipher") )
{
if ( !--v2 )
goto LABEL_29;
v5 = v3 + 1;
tm_cipher = (__int64)v3[1];
}
else if ( !strcmp(*v3, "-nbio") )
{
v5 = v3;
}
else if ( !strcmp(*v3, "-www") )
{
if ( !--v2 )
goto LABEL_29;
v5 = v3 + 1;
s_www_path = (__int64)v3[1];
if ( strlen((const char *)s_www_path) > 0x1F9C )
{
v4 = 1;
BIO_printf(bio_err, "-www option too long\n");
}
}
else
{
v8 = strcmp(*v3, "-bugs") != 0;
v9 = 0;
v10 = !v8;
if ( v8 )
{
v11 = "-ssl2";
v12 = 6LL;
v13 = *v3;
do
{
if ( !v12 )
break;
v9 = *v13 < (unsigned int)*v11;
v10 = *v13++ == *v11++;
--v12;
}
while ( v10 );
v14 = (!v9 && !v10) - v9;
v15 = 0;
v16 = v14 == 0;
if ( v14 )
{
v17 = "-ssl3";
v18 = 6LL;
v19 = *v3;
do
{
if ( !v18 )
break;
v15 = *v19 < (unsigned int)*v17;
v16 = *v19++ == *v17++;
--v18;
}
while ( v16 );
if ( (!v15 && !v16) == v15 )
{
v5 = v3;
s_time_meth = SSLv3_client_method(v17, v19, v6, v18);
}
else
{
if ( strcmp(*v3, "-time") )
{
BIO_printf(bio_err, "unknown option %s\n", v6);
if ( !perform )
perform = 3;
goto LABEL_29;
}
if ( !--v2 )
goto LABEL_29;
v5 = v3 + 1;
maxTime = atoi(v3[1]);
if ( maxTime <= 0 )
{
v4 = 1;
BIO_printf(bio_err, "time must be > 0\n");
}
}
}
else
{
v5 = v3;
s_time_meth = SSLv2_client_method(v11, v13, v6, v12);
}
}
else
{
st_bugs = 1;
v5 = v3;
}
}
LABEL_5:
v3 = v5 + 1;
if ( !--v2 )
goto LABEL_9;
}
perform = 2;
++v3;
--v2;
}
while ( v2 );
LABEL_9:
if ( !perform )
perform = 3;
if ( v4 )
{
LABEL_29:
func1();
return 0xFFFFFFFFLL;
}
return 0LL;
}

original_code:
static int parseArgs(int argc, char **argv)
{
    int badop = 0;
    verify_depth = 0;
    verify_error = 0;
    argc--;
    argv++;
    while (argc >= 1) {
        if (strcmp(*argv, "-connect") == 0) {
            if (--argc < 1)
                goto bad;
            host = *(++argv);
        }
        else if (strcmp(*argv, "-reuse") == 0)
            perform = 2;
        else if (strcmp(*argv, "-new") == 0)
            perform = 1;
        else if (strcmp(*argv, "-verify") == 0) {
            tm_verify = 0x01 | 0x04;
            if (--argc < 1)
                goto bad;
            verify_depth = atoi(*(++argv));
            BIO_printf(bio_err, "verify depth is %d\n", verify_depth);
        } else if (strcmp(*argv, "-cert") == 0) {
            if (--argc < 1)
                goto bad;
            t_cert_file = *(++argv);
        } else if (strcmp(*argv, "-key") == 0) {
            if (--argc < 1)
                goto bad;
            t_key_file = *(++argv);
        } else if (strcmp(*argv, "-CApath") == 0) {
            if (--argc < 1)
                goto bad;
            CApath = *(++argv);
        } else if (strcmp(*argv, "-CAfile") == 0) {
            if (--argc < 1)
                goto bad;
            CAfile = *(++argv);
        } else if (strcmp(*argv, "-cipher") == 0) {
            if (--argc < 1)
                goto bad;
            tm_cipher = *(++argv);
        }
        else if (strcmp(*argv, "-nbio") == 0) {
            t_nbio = 1;
        }
        else if (strcmp(*argv, "-www") == 0) {
            if (--argc < 1)
                goto bad;
            s_www_path = *(++argv);
            if (strlen(s_www_path) > 1024*8 - 100) {
                BIO_printf(bio_err, "-www option too long\n");
                badop = 1;
            }
        } else if (strcmp(*argv, "-bugs") == 0)
            st_bugs = 1;
        else if (strcmp(*argv, "-ssl2") == 0)
            s_time_meth = SSLv2_client_method();
        else if (strcmp(*argv, "-ssl3") == 0)
            s_time_meth = SSLv3_client_method();
        else if (strcmp(*argv, "-time") == 0) {
            if (--argc < 1)
                goto bad;
            maxTime = atoi(*(++argv));
            if(maxTime <= 0) {
                BIO_printf(bio_err, "time must be > 0\n");
                badop = 1;
            }
        } else {
            BIO_printf(bio_err, "unknown option %s\n", *argv);
            badop = 1;
            break;
        }
        argc--;
        argv++;
    }
    if (perform == 0)
        perform = 3;
    if (badop) {
 bad:
        s_time_usage();
        return -1;
    }
    return 0;
}

variable_types:
argv
char **

variable_types: badop int


decompiled_code:
__int64 __fastcall tm_Time_F(__int64 a1)
{
return app_tminterval(a1, 1LL);
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1)
{
return app_tminterval(a1, 1LL);
}

original_code:
static double tm_Time_F(int s)
{
    return app_tminterval(s, 1);
}

variable_types: s int

return_type: double


decompiled_code:
void s_time_init()
{
host = "localhost:4433";
t_cert_file = 0LL;
t_key_file = 0LL;
CApath = 0LL;
CAfile = 0LL;
tm_cipher = 0LL;
maxTime = 30;
tm_ctx = 0LL;
s_time_meth = 0LL;
s_www_path = 0LL;
bytes_read = 0LL;
st_bugs = 0;
perform = 0;
}

canonical_decompiled_code:
void func0()
{
host = "localhost:4433";
t_cert_file = 0LL;
t_key_file = 0LL;
CApath = 0LL;
CAfile = 0LL;
tm_cipher = 0LL;
maxTime = 30;
tm_ctx = 0LL;
s_time_meth = 0LL;
s_www_path = 0LL;
bytes_read = 0LL;
st_bugs = 0;
perform = 0;
}

original_code:
static void s_time_init(void)
{
    host = "localhost:4433";
    t_cert_file = ((void *)0);
    t_key_file = ((void *)0);
    CApath = ((void *)0);
    CAfile = ((void *)0);
    tm_cipher = ((void *)0);
    tm_verify = 0x00;
    maxTime = 30;
    tm_ctx = ((void *)0);
    s_time_meth = ((void *)0);
    s_www_path = ((void *)0);
    bytes_read = 0;
    st_bugs = 0;
    perform = 0;
    t_nbio = 0;
}

canonical_original_code:
static void s_time_init()
{
    host = "localhost:4433";
    t_cert_file = ((void *)0);
    t_key_file = ((void *)0);
    CApath = ((void *)0);
    CAfile = ((void *)0);
    tm_cipher = ((void *)0);
    tm_verify = 0x00;
    maxTime = 30;
    tm_ctx = ((void *)0);
    s_time_meth = ((void *)0);
    s_www_path = ((void *)0);
    bytes_read = 0;
    st_bugs = 0;
    perform = 0;
    t_nbio = 0;
}


decompiled_code:
int s_time_usage()
{
puts("usage: s_time <args>\n");
printf("-connect host:port - host:port to connect to (default is %s)\n", "localhost:4433");
puts("-nbio - Run with non-blocking IO");
puts("-ssl2 - Just use SSLv2");
puts("-ssl3 - Just use SSLv3");
puts("-bugs - Turn on SSL bug compatibility");
puts("-new - Just time new connections");
puts("-reuse - Just time connection reuse");
puts("-www page - Retrieve 'page' from the site");
return printf(
"-time arg - max number of seconds to collect data, default %d\n"
"-verify arg - turn on peer certificate verification, arg == depth\n"
"-cert arg - certificate file to use, PEM format assumed\n"
"-key arg - RSA file to use, PEM format assumed, key is in cert file\n"
" file if not specified by this option\n"
"-CApath arg - PEM format directory of CA's\n"
"-CAfile arg - PEM format file of CA's\n"
"-cipher - preferred cipher to use, play with 'openssl ciphers'\n"
"\n",
30LL);
}

canonical_decompiled_code:
int func1()
{
puts("usage: s_time <args>\n");
printf("-connect host:port - host:port to connect to (default is %s)\n", "localhost:4433");
puts("-nbio - Run with non-blocking IO");
puts("-ssl2 - Just use SSLv2");
puts("-ssl3 - Just use SSLv3");
puts("-bugs - Turn on SSL bug compatibility");
puts("-new - Just time new connections");
puts("-reuse - Just time connection reuse");
puts("-www page - Retrieve 'page' from the site");
return printf(
"-time arg - max number of seconds to collect data, default %d\n"
"-verify arg - turn on peer certificate verification, arg == depth\n"
"-cert arg - certificate file to use, PEM format assumed\n"
"-key arg - RSA file to use, PEM format assumed, key is in cert file\n"
" file if not specified by this option\n"
"-CApath arg - PEM format directory of CA's\n"
"-CAfile arg - PEM format file of CA's\n"
"-cipher - preferred cipher to use, play with 'openssl ciphers'\n"
"\n",
30LL);
}

original_code:
static void s_time_usage(void)
{
    static char umsg[] = "-time arg     - max number of seconds to collect data, default %d\n-verify arg   - turn on peer certificate verification, arg == depth\n-cert arg     - certificate file to use, PEM format assumed\n-key arg      - RSA file to use, PEM format assumed, key is in cert file\n                file if not specified by this option\n-CApath arg   - PEM format directory of CA's\n-CAfile arg   - PEM format file of CA's\n-cipher       - preferred cipher to use, play with 'openssl ciphers'\n\n";
    printf("usage: s_time <args>\n\n");
    printf("-connect host:port - host:port to connect to (default is %s)\n",
           "localhost:4433");
    printf("-nbio         - Run with non-blocking IO\n");
    printf("-ssl2         - Just use SSLv2\n");
    printf("-ssl3         - Just use SSLv3\n");
    printf("-bugs         - Turn on SSL bug compatibility\n");
    printf("-new          - Just time new connections\n");
    printf("-reuse        - Just time connection reuse\n");
    printf("-www page     - Retrieve 'page' from the site\n");
    printf(umsg, 30);
}

canonical_original_code:
static void s_time_usage()
{
    static char umsg[] = "-time arg     - max number of seconds to collect data, default %d\n-verify arg   - turn on peer certificate verification, arg == depth\n-cert arg     - certificate file to use, PEM format assumed\n-key arg      - RSA file to use, PEM format assumed, key is in cert file\n                file if not specified by this option\n-CApath arg   - PEM format directory of CA's\n-CAfile arg   - PEM format file of CA's\n-cipher       - preferred cipher to use, play with 'openssl ciphers'\n\n";
    printf("usage: s_time <args>\n\n");
    printf("-connect host:port - host:port to connect to (default is %s)\n",
           "localhost:4433");
    printf("-nbio         - Run with non-blocking IO\n");
    printf("-ssl2         - Just use SSLv2\n");
    printf("-ssl3         - Just use SSLv3\n");
    printf("-bugs         - Turn on SSL bug compatibility\n");
    printf("-new          - Just time new connections\n");
    printf("-reuse        - Just time connection reuse\n");
    printf("-www page     - Retrieve 'page' from the site\n");
    printf(umsg, 30);
}

variable_types:
umsg
char []


decompiled_code:
void *BN_options()
{
if ( !init_1 )
{
init_1 = 1;
BIO_snprintf(&data_0, 16LL, "bn(%d,%d)", 64LL, 64LL);
}
return &data_0;
}

canonical_decompiled_code:
void *func5()
{
if ( !init_1 )
{
init_1 = 1;
BIO_snprintf(&data_0, 16LL, "bn(%d,%d)", 64LL, 64LL);
}
return &data_0;
}

original_code:
char *BN_options(void)
{
    static int init = 0;
    static char data[16];

    if (!init) {
        init++;
#ifdef BN_LLONG
        BIO_snprintf(data, sizeof data, "bn(%d,%d)",
                     (int)sizeof(BN_ULLONG) * 8, (int)sizeof(BN_ULONG) * 8);
#else
        BIO_snprintf(data, sizeof data, "bn(%d,%d)",
                     (int)sizeof(BN_ULONG) * 8, (int)sizeof(BN_ULONG) * 8);
#endif
    }
    return (data);
}

canonical_original_code:
char *BN_options()
{
    static int init = 0;
    static char data[16];

    if (!init) {
        init++;
#ifdef BN_LLONG
        BIO_snprintf(data, sizeof data, "bn(%d,%d)",
                     (int)sizeof(BN_ULLONG) * 8, (int)sizeof(BN_ULONG) * 8);
#else
        BIO_snprintf(data, sizeof data, "bn(%d,%d)",
                     (int)sizeof(BN_ULONG) * 8, (int)sizeof(BN_ULONG) * 8);
#endif
    }
    return (data);
}

variable_types: init int

variable_types:
data
char [16]


decompiled_code:
__int64 engine_unregister_all_ECDH()
{
return engine_table_cleanup(&ecdh_table);
}

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

original_code:
static void engine_unregister_all_ECDH(void)
{
    engine_table_cleanup(&ecdh_table);
}

canonical_original_code:
static void engine_unregister_all_ECDH()
{
    engine_table_cleanup(&ecdh_table);
}


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

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

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

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

original_code:
void ERR_load_CMS_strings(void)
{
#ifndef OPENSSL_NO_ERR

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

canonical_original_code:
void ERR_load_CMS_strings()
{
#ifndef OPENSSL_NO_ERR

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


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

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

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

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

original_code:
void ERR_load_ECDSA_strings(void)
{
#ifndef OPENSSL_NO_ERR

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

canonical_original_code:
void ERR_load_ECDSA_strings()
{
#ifndef OPENSSL_NO_ERR

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


decompiled_code:
_BOOL8 __fastcall int_cleanup_check(int a1)
{
_BOOL8 result; // rax

result = 1LL;
if ( !cleanup_stack )
{
result = 0LL;
if ( a1 )
{
cleanup_stack = sk_new_null();
result = cleanup_stack != 0;
}
}
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func1(int a1)
{
_BOOL8 result; // rax

result = 1LL;
if ( !cleanup_stack )
{
result = 0LL;
if ( a1 )
{
cleanup_stack = sk_new_null();
result = cleanup_stack != 0;
}
}
return result;
}

original_code:
static int int_cleanup_check(int create)
{
    if (cleanup_stack)
        return 1;
    if (!create)
        return 0;
    cleanup_stack = sk_ENGINE_CLEANUP_ITEM_new_null();
    return (cleanup_stack ? 1 : 0);
}

variable_types: create int


decompiled_code:
__int64 ENGINE_cleanup()
{
if ( int_cleanup_check(0) )
{
sk_pop_free(cleanup_stack, engine_cleanup_cb_free);
cleanup_stack = 0LL;
}
return RAND_set_rand_method(0LL);
}

canonical_decompiled_code:
__int64 func6()
{
if ( func1(0) )
{
sk_pop_free(cleanup_stack, engine_cleanup_cb_free);
cleanup_stack = 0LL;
}
return RAND_set_rand_method(0LL);
}

original_code:
void ENGINE_cleanup(void)
{
    if (int_cleanup_check(0)) {
        sk_ENGINE_CLEANUP_ITEM_pop_free(cleanup_stack,
                                        engine_cleanup_cb_free);
        cleanup_stack = NULL;
    }
    /*
     * FIXME: This should be handled (somehow) through RAND, eg. by it
     * registering a cleanup callback.
     */
    RAND_set_rand_method(NULL);
}

canonical_original_code:
void ENGINE_cleanup()
{
    if (int_cleanup_check(0)) {
        sk_ENGINE_CLEANUP_ITEM_pop_free(cleanup_stack,
                                        engine_cleanup_cb_free);
        cleanup_stack = NULL;
    }
    /*
     * FIXME: This should be handled (somehow) through RAND, eg. by it
     * registering a cleanup callback.
     */
    RAND_set_rand_method(NULL);
}


decompiled_code:
void *ENGINE_get_static_state()
{
return &internal_static_hack;
}

canonical_decompiled_code:
void *func26()
{
return &internal_static_hack;
}

original_code:
void *ENGINE_get_static_state(void)
{
    return &internal_static_hack;
}

return_type: void *


decompiled_code:
__int64 EVP_cleanup()
{
OBJ_NAME_cleanup(2LL);
OBJ_NAME_cleanup(1LL);
OBJ_NAME_cleanup(0xFFFFFFFFLL);
EVP_PBE_cleanup();
if ( obj_cleanup_defer == 2 )
{
obj_cleanup_defer = 0;
OBJ_cleanup();
}
return OBJ_sigid_free();
}

canonical_decompiled_code:
__int64 func6()
{
OBJ_NAME_cleanup(2LL);
OBJ_NAME_cleanup(1LL);
OBJ_NAME_cleanup(0xFFFFFFFFLL);
EVP_PBE_cleanup();
if ( obj_cleanup_defer == 2 )
{
obj_cleanup_defer = 0;
OBJ_cleanup();
}
return OBJ_sigid_free();
}

original_code:
void EVP_cleanup(void)
{
    OBJ_NAME_cleanup(OBJ_NAME_TYPE_CIPHER_METH);
    OBJ_NAME_cleanup(OBJ_NAME_TYPE_MD_METH);
    /*
     * The above calls will only clean out the contents of the name hash
     * table, but not the hash table itself.  The following line does that
     * part.  -- Richard Levitte
     */
    OBJ_NAME_cleanup(-1);

    EVP_PBE_cleanup();
    if (obj_cleanup_defer == 2) {
        obj_cleanup_defer = 0;
        OBJ_cleanup();
    }
    OBJ_sigid_free();
}

canonical_original_code:
void EVP_cleanup()
{
    OBJ_NAME_cleanup(OBJ_NAME_TYPE_CIPHER_METH);
    OBJ_NAME_cleanup(OBJ_NAME_TYPE_MD_METH);
    /*
     * The above calls will only clean out the contents of the name hash
     * table, but not the hash table itself.  The following line does that
     * part.  -- Richard Levitte
     */
    OBJ_NAME_cleanup(-1);

    EVP_PBE_cleanup();
    if (obj_cleanup_defer == 2) {
        obj_cleanup_defer = 0;
        OBJ_cleanup();
    }
    OBJ_sigid_free();
}


decompiled_code:
__int64 ssl2_default_timeout()
{
return 300LL;
}

canonical_decompiled_code:
__int64 func1()
{
return 300LL;
}

original_code:
long ssl2_default_timeout(void)
{
    return (300);
}

canonical_original_code:
long ssl2_default_timeout()
{
    return (300);
}

return_type: long


decompiled_code:
__int64 ssl2_num_ciphers()
{
return 7LL;
}

canonical_decompiled_code:
__int64 func2()
{
return 7LL;
}

original_code:
int ssl2_num_ciphers(void)
{
    return ((sizeof(ssl2_ciphers)/sizeof(SSL_CIPHER)));
}

canonical_original_code:
int ssl2_num_ciphers()
{
    return ((sizeof(ssl2_ciphers)/sizeof(SSL_CIPHER)));
}


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

result = 0LL;
if ( a1 <= 6 )
result = (char *)&ssl2_ciphers + 88 * (6LL - a1);
return result;
}

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

result = 0LL;
if ( a1 <= 6 )
result = (char *)&ssl2_ciphers + 88 * (6LL - a1);
return result;
}

original_code:
const SSL_CIPHER *ssl2_get_cipher(unsigned int u)
{
    if (u < (sizeof(ssl2_ciphers)/sizeof(SSL_CIPHER)))
        return (&(ssl2_ciphers[(sizeof(ssl2_ciphers)/sizeof(SSL_CIPHER)) - 1 - u]));
    else
        return (((void *)0));
}

canonical_original_code:
struct ssl_cipher_st *ssl2_get_cipher(unsigned int u)
{
    if (u < (sizeof(ssl2_ciphers)/sizeof(SSL_CIPHER)))
        return (&(ssl2_ciphers[(sizeof(ssl2_ciphers)/sizeof(SSL_CIPHER)) - 1 - u]));
    else
        return (((void *)0));
}

variable_types:
u
unsigned int

return_type: struct ssl_cipher_st { int valid; char *name; unsigned long id; unsigned long algorithm_mkey; unsigned long algorithm_auth; unsigned long algorithm_enc; unsigned long algorithm_mac; unsigned long algorithm_ssl; unsigned long algo_strength; unsigned long algorithm2; int strength_bits; int alg_bits; } *


original_code:
int ssl2_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p)
{
    long l;
    if (p != ((void *)0)) {
        l = c->id;
        if ((l & 0xff000000) != 0x02000000 && l != 0x03005600)
            return (0);
        p[0] = ((unsigned char)(l >> 16L)) & 0xFF;
        p[1] = ((unsigned char)(l >> 8L)) & 0xFF;
        p[2] = ((unsigned char)(l)) & 0xFF;
    }
    return (3);
}

canonical_original_code:
int ssl2_put_cipher_by_char(struct ssl_cipher_st *c, unsigned char *p)
{
    long l;
    if (p != ((void *)0)) {
        l = c->id;
        if ((l & 0xff000000) != 0x02000000 && l != 0x03005600)
            return (0);
        p[0] = ((unsigned char)(l >> 16L)) & 0xFF;
        p[1] = ((unsigned char)(l >> 8L)) & 0xFF;
        p[2] = ((unsigned char)(l)) & 0xFF;
    }
    return (3);
}

variable_types: struct ssl_cipher_st { int valid; char *name; unsigned long id; unsigned long algorithm_mkey; unsigned long algorithm_auth; unsigned long algorithm_enc; unsigned long algorithm_mac; unsigned long algorithm_ssl; unsigned long algo_strength; unsigned long algorithm2; int strength_bits; int alg_bits; } *

variable_types:
p
unsigned char *

variable_types: l long


decompiled_code:
__int64 __fastcall X509_REQ_extension_nid(int a1)
{
__int64 result; // rax
unsigned int *v2; // rdx

result = *(unsigned int *)ext_nids;
if ( (_DWORD)result )
{
v2 = (unsigned int *)((char *)ext_nids + 4);
while ( a1 != (_DWORD)result )
{
result = *v2++;
if ( !(_DWORD)result )
return result;
}
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func3(int a1)
{
__int64 result; // rax
unsigned int *v2; // rdx

result = *(unsigned int *)ext_nids;
if ( (_DWORD)result )
{
v2 = (unsigned int *)((char *)ext_nids + 4);
while ( a1 != (_DWORD)result )
{
result = *v2++;
if ( !(_DWORD)result )
return result;
}
result = 1LL;
}
return result;
}

original_code:
int X509_REQ_extension_nid(int req_nid)
{
    int i, nid;
    for (i = 0;; i++) {
        nid = ext_nids[i];
        if (nid == NID_undef)
            return 0;
        else if (req_nid == nid)
            return 1;
    }
}

canonical_original_code:
int X509_REQ_extension_nid(int req_nid)
{
    int i; int nid;
    for (i = 0;; i++) {
        nid = ext_nids[i];
        if (nid == NID_undef)
            return 0;
        else if (req_nid == nid)
            return 1;
    }
}

variable_types: i int

variable_types: nid int


decompiled_code:
void *X509_REQ_get_extension_nids()
{
return ext_nids;
}

canonical_decompiled_code:
void *func4()
{
return ext_nids;
}

original_code:
int *X509_REQ_get_extension_nids(void)
{
    return ext_nids;
}

canonical_original_code:
int *X509_REQ_get_extension_nids()
{
    return ext_nids;
}

return_type: int *


decompiled_code:
void __fastcall X509_REQ_set_extension_nids(void *a1)
{
ext_nids = a1;
}

canonical_decompiled_code:
void __fastcall func5(void *a1)
{
ext_nids = a1;
}

original_code:
void X509_REQ_set_extension_nids(int *nids)
{
    ext_nids = nids;
}

variable_types:
nids
int *


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

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

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

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

original_code:
void ERR_load_X509_strings(void)
{
#ifndef OPENSSL_NO_ERR

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

canonical_original_code:
void ERR_load_X509_strings()
{
#ifndef OPENSSL_NO_ERR

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


decompiled_code:
__int64 __fastcall prime_main(int a1, __int64 a2)
{
const char *v3; // rsi
int v4; // er14
const char **v5; // r8
unsigned int v6; // ebp
unsigned int v7; // er12
int v8; // ebx
unsigned int v9; // er13
const char *v10; // rdi
__int64 v11; // rcx
bool v12; // cf
bool v13; // zf
char v14; // al
bool v15; // cf
bool v16; // zf
const char *v17; // rdi
__int64 v18; // rcx
char v19; // al
bool v20; // cf
bool v21; // zf
const char **v22; // r15
int v23; // eax
bool v24; // cf
bool v25; // zf
const char *v26; // rdi
__int64 v27; // rcx
char v28; // al
char v29; // al
__int64 v30; // rdi
__int64 v31; // rax
__int64 v32; // rdx
__int64 v33; // rcx
const char **v34; // r8
__int64 v35; // r15
const char *v36; // rsi
int v37; // eax
const char *v38; // rdx
const char *v40; // rdi
__int64 v41; // rcx
char v42; // al
bool v43; // cf
bool v44; // zf
const char *v45; // rdi
__int64 v46; // rcx
const char **v47; // r15
int v48; // eax
const char *v49; // rbp
__int64 v50; // rax
unsigned int v51; // [rsp+4h] [rbp-54h]
const char **v52; // [rsp+8h] [rbp-50h]
__int64 v53[8]; // [rsp+18h] [rbp-40h] BYREF

v3 = (char *)prime_main + 1;
v53[0] = 0LL;
signal(13, (__sighandler_t)((char *)prime_main + 1));
if ( !bio_err )
{
v50 = BIO_s_file();
bio_err = BIO_new(v50);
if ( bio_err )
{
v3 = (_BYTE *)(&loc_68 + 2);
BIO_ctrl(bio_err, 106LL, 16LL, stderr);
}
}
v4 = a1 - 1;
v5 = (const char **)(a2 + 8);
if ( a1 - 1 <= 0 )
{
v51 = 0;
v6 = 0;
v7 = 0;
v8 = 0;
v29 = 1;
v9 = 20;
LABEL_22:
if ( !*v5 && v29 )
{
BIO_printf(bio_err, "No prime specified\n");
LABEL_53:
v7 = 1;
BIO_printf(bio_err, "options are\n");
BIO_printf(bio_err, "%-14s hex\n", "-hex");
BIO_printf(bio_err, "%-14s number of checks\n", "-checks <n>");
return v7;
}
}
else
{
v51 = 0;
v6 = 0;
v7 = 0;
v8 = 0;
v9 = 20;
while ( 1 )
{
v24 = **v5 < 0x2Du;
v25 = **v5 == 45;
if ( **v5 != 45 )
break;
v26 = "-hex";
v27 = 5LL;
v3 = *v5;
do
{
if ( !v27 )
break;
v24 = *v3 < (unsigned int)*v26;
v25 = *v3++ == *v26++;
--v27;
}
while ( v25 );
v28 = (!v24 && !v25) - v24;
v12 = 0;
v13 = v28 == 0;
if ( v28 )
{
v10 = "-generate";
v11 = 10LL;
v3 = *v5;
do
{
if ( !v11 )
break;
v12 = *v3 < (unsigned int)*v10;
v13 = *v3++ == *v10++;
--v11;
}
while ( v13 );
v14 = (!v12 && !v13) - v12;
v15 = 0;
v16 = v14 == 0;
if ( v14 )
{
v17 = "-bits";
v18 = 6LL;
v3 = *v5;
do
{
if ( !v18 )
break;
v15 = *v3 < (unsigned int)*v17;
v16 = *v3++ == *v17++;
--v18;
}
while ( v16 );
v19 = (!v15 && !v16) - v15;
v20 = 0;
v21 = v19 == 0;
if ( v19 )
{
v40 = "-safe";
v41 = 6LL;
v3 = *v5;
do
{
if ( !v41 )
break;
v20 = *v3 < (unsigned int)*v40;
v21 = *v3++ == *v40++;
--v41;
}
while ( v21 );
v42 = (!v20 && !v21) - v20;
v43 = 0;
v44 = v42 == 0;
if ( v42 )
{
v45 = "-checks";
v46 = 8LL;
v3 = *v5;
do
{
if ( !v46 )
break;
v43 = *v3 < (unsigned int)*v45;
v44 = *v3++ == *v45++;
--v46;
}
while ( v44 );
if ( (!v43 && !v44) != v43 )
{
BIO_printf(bio_err, "Unknown option '%s'\n", *v5);
goto LABEL_53;
}
if ( !--v4 )
goto LABEL_53;
v47 = v5 + 1;
v48 = atoi(v5[1]);
v5 = v47;
v9 = v48;
}
else
{
v51 = 1;
}
}
else
{
if ( !--v4 )
goto LABEL_53;
v22 = v5 + 1;
v23 = atoi(v5[1]);
v5 = v22;
v6 = v23;
}
}
else
{
v7 = 1;
}
++v5;
if ( !--v4 )
goto LABEL_21;
}
else
{
v8 = 1;
++v5;
if ( !--v4 )
{
LABEL_21:
v29 = v7 ^ 1;
goto LABEL_22;
}
}
}
}
v52 = v5;
v30 = BIO_s_file();
v31 = BIO_new(v30);
v34 = v52;
v35 = v31;
if ( v31 )
{
v3 = (_BYTE *)(&loc_68 + 2);
v30 = v31;
BIO_ctrl(v31, 106LL, 0LL, stdout);
v34 = v52;
}
if ( v7 )
{
if ( !v6 )
{
BIO_printf(bio_err, "Specifiy the number of bits.\n", v32, v33, v34);
return v7;
}
v53[0] = BN_new(v30, v3, v32, v33, v34);
BN_generate_prime_ex(v53[0], v6, v51, 0LL, 0LL, 0LL);
if ( v8 )
v49 = (const char *)BN_bn2hex(v53[0]);
else
v49 = (const char *)BN_bn2dec(v53[0]);
BIO_printf(v35, "%s\n", v49);
CRYPTO_free(v49);
}
else
{
v36 = *v34;
if ( v8 )
BN_hex2bn(v53, v36);
else
BN_dec2bn(v53, v36);
BN_print(v35, v53[0]);
v37 = BN_is_prime_ex(v53[0], v9, 0LL, 0LL);
v38 = (const char *)&unk_399;
if ( !v37 )
v38 = "not ";
BIO_printf(v35, " is %sprime\n", v38);
}
v7 = 0;
BN_free(v53[0]);
BIO_free_all(v35);
return v7;
}

canonical_decompiled_code:
__int64 __fastcall func0(int a1, __int64 a2)
{
const char *v3; // rsi
int v4; // er14
const char **v5; // r8
unsigned int v6; // ebp
unsigned int v7; // er12
int v8; // ebx
unsigned int v9; // er13
const char *v10; // rdi
__int64 v11; // rcx
bool v12; // cf
bool v13; // zf
char v14; // al
bool v15; // cf
bool v16; // zf
const char *v17; // rdi
__int64 v18; // rcx
char v19; // al
bool v20; // cf
bool v21; // zf
const char **v22; // r15
int v23; // eax
bool v24; // cf
bool v25; // zf
const char *v26; // rdi
__int64 v27; // rcx
char v28; // al
char v29; // al
__int64 v30; // rdi
__int64 v31; // rax
__int64 v32; // rdx
__int64 v33; // rcx
const char **v34; // r8
__int64 v35; // r15
const char *v36; // rsi
int v37; // eax
const char *v38; // rdx
const char *v40; // rdi
__int64 v41; // rcx
char v42; // al
bool v43; // cf
bool v44; // zf
const char *v45; // rdi
__int64 v46; // rcx
const char **v47; // r15
int v48; // eax
const char *v49; // rbp
__int64 v50; // rax
unsigned int v51; // [rsp+4h] [rbp-54h]
const char **v52; // [rsp+8h] [rbp-50h]
__int64 v53[8]; // [rsp+18h] [rbp-40h] BYREF

v3 = (char *)prime_main + 1;
v53[0] = 0LL;
signal(13, (__sighandler_t)((char *)prime_main + 1));
if ( !bio_err )
{
v50 = BIO_s_file();
bio_err = BIO_new(v50);
if ( bio_err )
{
v3 = (_BYTE *)(&loc_68 + 2);
BIO_ctrl(bio_err, 106LL, 16LL, stderr);
}
}
v4 = a1 - 1;
v5 = (const char **)(a2 + 8);
if ( a1 - 1 <= 0 )
{
v51 = 0;
v6 = 0;
v7 = 0;
v8 = 0;
v29 = 1;
v9 = 20;
LABEL_22:
if ( !*v5 && v29 )
{
BIO_printf(bio_err, "No prime specified\n");
LABEL_53:
v7 = 1;
BIO_printf(bio_err, "options are\n");
BIO_printf(bio_err, "%-14s hex\n", "-hex");
BIO_printf(bio_err, "%-14s number of checks\n", "-checks <n>");
return v7;
}
}
else
{
v51 = 0;
v6 = 0;
v7 = 0;
v8 = 0;
v9 = 20;
while ( 1 )
{
v24 = **v5 < 0x2Du;
v25 = **v5 == 45;
if ( **v5 != 45 )
break;
v26 = "-hex";
v27 = 5LL;
v3 = *v5;
do
{
if ( !v27 )
break;
v24 = *v3 < (unsigned int)*v26;
v25 = *v3++ == *v26++;
--v27;
}
while ( v25 );
v28 = (!v24 && !v25) - v24;
v12 = 0;
v13 = v28 == 0;
if ( v28 )
{
v10 = "-generate";
v11 = 10LL;
v3 = *v5;
do
{
if ( !v11 )
break;
v12 = *v3 < (unsigned int)*v10;
v13 = *v3++ == *v10++;
--v11;
}
while ( v13 );
v14 = (!v12 && !v13) - v12;
v15 = 0;
v16 = v14 == 0;
if ( v14 )
{
v17 = "-bits";
v18 = 6LL;
v3 = *v5;
do
{
if ( !v18 )
break;
v15 = *v3 < (unsigned int)*v17;
v16 = *v3++ == *v17++;
--v18;
}
while ( v16 );
v19 = (!v15 && !v16) - v15;
v20 = 0;
v21 = v19 == 0;
if ( v19 )
{
v40 = "-safe";
v41 = 6LL;
v3 = *v5;
do
{
if ( !v41 )
break;
v20 = *v3 < (unsigned int)*v40;
v21 = *v3++ == *v40++;
--v41;
}
while ( v21 );
v42 = (!v20 && !v21) - v20;
v43 = 0;
v44 = v42 == 0;
if ( v42 )
{
v45 = "-checks";
v46 = 8LL;
v3 = *v5;
do
{
if ( !v46 )
break;
v43 = *v3 < (unsigned int)*v45;
v44 = *v3++ == *v45++;
--v46;
}
while ( v44 );
if ( (!v43 && !v44) != v43 )
{
BIO_printf(bio_err, "Unknown option '%s'\n", *v5);
goto LABEL_53;
}
if ( !--v4 )
goto LABEL_53;
v47 = v5 + 1;
v48 = atoi(v5[1]);
v5 = v47;
v9 = v48;
}
else
{
v51 = 1;
}
}
else
{
if ( !--v4 )
goto LABEL_53;
v22 = v5 + 1;
v23 = atoi(v5[1]);
v5 = v22;
v6 = v23;
}
}
else
{
v7 = 1;
}
++v5;
if ( !--v4 )
goto LABEL_21;
}
else
{
v8 = 1;
++v5;
if ( !--v4 )
{
LABEL_21:
v29 = v7 ^ 1;
goto LABEL_22;
}
}
}
}
v52 = v5;
v30 = BIO_s_file();
v31 = BIO_new(v30);
v34 = v52;
v35 = v31;
if ( v31 )
{
v3 = (_BYTE *)(&loc_68 + 2);
v30 = v31;
BIO_ctrl(v31, 106LL, 0LL, stdout);
v34 = v52;
}
if ( v7 )
{
if ( !v6 )
{
BIO_printf(bio_err, "Specifiy the number of bits.\n", v32, v33, v34);
return v7;
}
v53[0] = BN_new(v30, v3, v32, v33, v34);
BN_generate_prime_ex(v53[0], v6, v51, 0LL, 0LL, 0LL);
if ( v8 )
v49 = (const char *)BN_bn2hex(v53[0]);
else
v49 = (const char *)BN_bn2dec(v53[0]);
BIO_printf(v35, "%s\n", v49);
CRYPTO_free(v49);
}
else
{
v36 = *v34;
if ( v8 )
BN_hex2bn(v53, v36);
else
BN_dec2bn(v53, v36);
BN_print(v35, v53[0]);
v37 = BN_is_prime_ex(v53[0], v9, 0LL, 0LL);
v38 = (const char *)&unk_399;
if ( !v37 )
v38 = "not ";
BIO_printf(v35, " is %sprime\n", v38);
}
v7 = 0;
BN_free(v53[0]);
BIO_free_all(v35);
return v7;
}

original_code:
int prime_main(int argc,char **argv)
{
    int hex = 0;
    int checks = 20;
    int generate = 0;
    int bits = 0;
    int safe = 0;
    BIGNUM *bn = ((void *)0);
    BIO *bio_out;
    signal(13,((__sighandler_t) 1));
    if (bio_err == ((void *)0))
        if ((bio_err = BIO_new(BIO_s_file())) != ((void *)0))
            BIO_ctrl(bio_err,106,0x00 | 0x10,(char *)stderr);
    --argc;
    ++argv;
    while (argc >= 1 && **argv == '-') {
        if (!strcmp(*argv, "-hex"))
            hex = 1;
        else if (!strcmp(*argv, "-generate"))
            generate = 1;
        else if (!strcmp(*argv, "-bits"))
            if (--argc < 1)
                goto bad;
            else
                bits = atoi(*++argv);
        else if (!strcmp(*argv, "-safe"))
            safe = 1;
        else if (!strcmp(*argv, "-checks"))
            if (--argc < 1)
                goto bad;
            else
                checks = atoi(*++argv);
        else {
            BIO_printf(bio_err, "Unknown option '%s'\n", *argv);
            goto bad;
        }
        --argc;
        ++argv;
    }
    if (argv[0] == ((void *)0) && !generate) {
        BIO_printf(bio_err, "No prime specified\n");
        goto bad;
    }
    if ((bio_out = BIO_new(BIO_s_file())) != ((void *)0)) {
        BIO_ctrl(bio_out,106,0x00,(char *)stdout);
    }
    if (generate) {
        char *s;
        if (!bits) {
            BIO_printf(bio_err, "Specifiy the number of bits.\n");
            return 1;
        }
        bn = BN_new();
        BN_generate_prime_ex(bn, bits, safe, ((void *)0), ((void *)0), ((void *)0));
        s = hex ? BN_bn2hex(bn) : BN_bn2dec(bn);
        BIO_printf(bio_out, "%s\n", s);
        CRYPTO_free(s);
    } else {
        if (hex)
            BN_hex2bn(&bn, argv[0]);
        else
            BN_dec2bn(&bn, argv[0]);
        BN_print(bio_out, bn);
        BIO_printf(bio_out, " is %sprime\n",
                   BN_is_prime_ex(bn, checks, ((void *)0), ((void *)0)) ? "" : "not ");
    }
    BN_free(bn);
    BIO_free_all(bio_out);
    return 0;
 bad:
    BIO_printf(bio_err, "options are\n");
    BIO_printf(bio_err, "%-14s hex\n", "-hex");
    BIO_printf(bio_err, "%-14s number of checks\n", "-checks <n>");
    return 1;
}

canonical_original_code:
int prime_main(int argc, char **argv)
{
    int hex = 0;
    int checks = 20;
    int generate = 0;
    int bits = 0;
    int safe = 0;
    struct bignum_st *bn = ((void *)0);
    struct bio_st *bio_out;
    signal(13,((void (*)(int)) 1));
    if (bio_err == ((void *)0))
        if ((bio_err = BIO_new(BIO_s_file())) != ((void *)0))
            BIO_ctrl(bio_err,106,0x00 | 0x10,(char *)stderr);
    --argc;
    ++argv;
    while (argc >= 1 && **argv == '-') {
        if (!strcmp(*argv, "-hex"))
            hex = 1;
        else if (!strcmp(*argv, "-generate"))
            generate = 1;
        else if (!strcmp(*argv, "-bits"))
            if (--argc < 1)
                goto bad;
            else
                bits = atoi(*++argv);
        else if (!strcmp(*argv, "-safe"))
            safe = 1;
        else if (!strcmp(*argv, "-checks"))
            if (--argc < 1)
                goto bad;
            else
                checks = atoi(*++argv);
        else {
            BIO_printf(bio_err, "Unknown option '%s'\n", *argv);
            goto bad;
        }
        --argc;
        ++argv;
    }
    if (argv[0] == ((void *)0) && !generate) {
        BIO_printf(bio_err, "No prime specified\n");
        goto bad;
    }
    if ((bio_out = BIO_new(BIO_s_file())) != ((void *)0)) {
        BIO_ctrl(bio_out,106,0x00,(char *)stdout);
    }
    if (generate) {
        char *s;
        if (!bits) {
            BIO_printf(bio_err, "Specifiy the number of bits.\n");
            return 1;
        }
        bn = BN_new();
        BN_generate_prime_ex(bn, bits, safe, ((void *)0), ((void *)0), ((void *)0));
        s = hex ? BN_bn2hex(bn) : BN_bn2dec(bn);
        BIO_printf(bio_out, "%s\n", s);
        CRYPTO_free(s);
    } else {
        if (hex)
            BN_hex2bn(&bn, argv[0]);
        else
            BN_dec2bn(&bn, argv[0]);
        BN_print(bio_out, bn);
        BIO_printf(bio_out, " is %sprime\n",
                   BN_is_prime_ex(bn, checks, ((void *)0), ((void *)0)) ? "" : "not ");
    }
    BN_free(bn);
    BIO_free_all(bio_out);
    return 0;
 bad:
    BIO_printf(bio_err, "options are\n");
    BIO_printf(bio_err, "%-14s hex\n", "-hex");
    BIO_printf(bio_err, "%-14s number of checks\n", "-checks <n>");
    return 1;
}

variable_types: argc int

variable_types: hex int

variable_types: checks int

variable_types: generate int

variable_types: bits int

variable_types: safe int

variable_types: struct bignum_st { unsigned long *d; int top; int dmax; int neg; int flags; } *

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

variable_types:
s
char *

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

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

user_defined_types: struct stack_st_void { struct stack_st stack; }


decompiled_code:
__int64 __fastcall RSA_padding_add_SSLv23(_WORD *a1, int a2, const void *a3, unsigned int a4)
{
_BYTE *v4; // rbx
int v5; // ebp
char *v8; // rbp
__int64 result; // rax

if ( a2 - 10 <= (int)a4 )
{
ERR_put_error(4LL, 110LL, 110LL, "rsa_ssl.c", 72LL);
result = 0LL;
}
else
{
v4 = a1 + 1;
*a1 = 512;
v5 = a2 - 11 - a4;
if ( (int)RAND_bytes(a1 + 1, (unsigned int)v5) <= 0 )
return 0LL;
if ( v5 > 0 )
{
v8 = (char *)a1 + (unsigned int)(v5 + 2);
LABEL_6:
while ( *v4 )
{
if ( v8 == ++v4 )
goto LABEL_8;
}
while ( (int)RAND_bytes(v4, 1LL) > 0 )
{
if ( *v4 )
{
if ( v8 == ++v4 )
goto LABEL_8;
goto LABEL_6;
}
}
return 0LL;
}
v8 = (char *)(a1 + 1);
LABEL_8:
v8[8] = 0;
*(_QWORD *)v8 = 0x303030303030303LL;
memcpy(v8 + 9, a3, a4);
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(_WORD *a1, int a2, const void *a3, unsigned int a4)
{
_BYTE *v4; // rbx
int v5; // ebp
char *v8; // rbp
__int64 result; // rax

if ( a2 - 10 <= (int)a4 )
{
ERR_put_error(4LL, 110LL, 110LL, "rsa_ssl.c", 72LL);
result = 0LL;
}
else
{
v4 = a1 + 1;
*a1 = 512;
v5 = a2 - 11 - a4;
if ( (int)RAND_bytes(a1 + 1, (unsigned int)v5) <= 0 )
return 0LL;
if ( v5 > 0 )
{
v8 = (char *)a1 + (unsigned int)(v5 + 2);
LABEL_6:
while ( *v4 )
{
if ( v8 == ++v4 )
goto LABEL_8;
}
while ( (int)RAND_bytes(v4, 1LL) > 0 )
{
if ( *v4 )
{
if ( v8 == ++v4 )
goto LABEL_8;
goto LABEL_6;
}
}
return 0LL;
}
v8 = (char *)(a1 + 1);
LABEL_8:
v8[8] = 0;
*(_QWORD *)v8 = 0x303030303030303LL;
memcpy(v8 + 9, a3, a4);
result = 1LL;
}
return result;
}

original_code:
int RSA_padding_add_SSLv23(unsigned char *to, int tlen,
                           const unsigned char *from, int flen)
{
    int i, j;
    unsigned char *p;

    if (flen > (tlen - 11)) {
        RSAerr(RSA_F_RSA_PADDING_ADD_SSLV23,
               RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE);
        return (0);
    }

    p = (unsigned char *)to;

    *(p++) = 0;
    *(p++) = 2;                 /* Public Key BT (Block Type) */

    /* pad out with non-zero random data */
    j = tlen - 3 - 8 - flen;

    if (RAND_bytes(p, j) <= 0)
        return (0);
    for (i = 0; i < j; i++) {
        if (*p == '\0')
            do {
                if (RAND_bytes(p, 1) <= 0)
                    return (0);
            } while (*p == '\0');
        p++;
    }

    memset(p, 3, 8);
    p += 8;
    *(p++) = '\0';

    memcpy(p, from, (unsigned int)flen);
    return (1);
}

canonical_original_code:
int RSA_padding_add_SSLv23(unsigned char *to, int tlen, unsigned char *from, int flen)
{
    int i; int j;
    unsigned char *p;

    if (flen > (tlen - 11)) {
        RSAerr(RSA_F_RSA_PADDING_ADD_SSLV23,
               RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE);
        return (0);
    }

    p = (unsigned char *)to;

    *(p++) = 0;
    *(p++) = 2;                 /* Public Key BT (Block Type) */

    /* pad out with non-zero random data */
    j = tlen - 3 - 8 - flen;

    if (RAND_bytes(p, j) <= 0)
        return (0);
    for (i = 0; i < j; i++) {
        if (*p == '\0')
            do {
                if (RAND_bytes(p, 1) <= 0)
                    return (0);
            } while (*p == '\0');
        p++;
    }

    memset(p, 3, 8);
    p += 8;
    *(p++) = '\0';

    memcpy(p, from, (unsigned int)flen);
    return (1);
}

variable_types:
to
unsigned char *

variable_types: tlen int

variable_types:
from
unsigned char *

variable_types: flen int

variable_types: j int


decompiled_code:
__int64 __fastcall RSA_padding_check_SSLv23(void *dest, signed int a2, _BYTE *a3, int a4, int a5)
{
char *v6; // rsi
int v7; // ecx
int v8; // edx
char *v9; // rax
unsigned int v10; // er12
char *v11; // rax
unsigned int v12; // ecx

if ( a4 <= 9 )
{
v10 = -1;
ERR_put_error(4LL, 114LL, 111LL, "rsa_ssl.c", 112LL);
}
else if ( a4 + 1 == a5 && (v6 = a3 + 1, *a3 == 2) )
{
v7 = a4 - 1;
v8 = 0;
while ( 1 )
{
v9 = v6++;
if ( !*(v6 - 1) )
break;
if ( v7 == ++v8 )
goto LABEL_7;
}
if ( v7 == v8 || v8 <= 7 )
{
LABEL_7:
v10 = -1;
ERR_put_error(4LL, 114LL, 113LL, "rsa_ssl.c", 127LL);
return v10;
}
v11 = v9 - 8;
while ( *v11 == 3 )
{
if ( v6 - 1 == ++v11 )
{
v10 = -1;
ERR_put_error(4LL, 114LL, 115LL, "rsa_ssl.c", 136LL);
return v10;
}
}
v12 = v7 - (v8 + 1);
v10 = v12;
if ( (int)v12 > a2 )
{
v10 = -1;
ERR_put_error(4LL, 114LL, 109LL, "rsa_ssl.c", 143LL);
}
else
{
memcpy(dest, v6, v12);
}
}
else
{
v10 = -1;
ERR_put_error(4LL, 114LL, 107LL, "rsa_ssl.c", 116LL);
}
return v10;
}

original_code:
int RSA_padding_check_SSLv23(unsigned char *to, int tlen,
                             const unsigned char *from, int flen, int num)
{
    int i, j, k;
    const unsigned char *p;

    p = from;
    if (flen < 10) {
        RSAerr(RSA_F_RSA_PADDING_CHECK_SSLV23, RSA_R_DATA_TOO_SMALL);
        return (-1);
    }
    if ((num != (flen + 1)) || (*(p++) != 02)) {
        RSAerr(RSA_F_RSA_PADDING_CHECK_SSLV23, RSA_R_BLOCK_TYPE_IS_NOT_02);
        return (-1);
    }

    /* scan over padding data */
    j = flen - 1;               /* one for type */
    for (i = 0; i < j; i++)
        if (*(p++) == 0)
            break;

    if ((i == j) || (i < 8)) {
        RSAerr(RSA_F_RSA_PADDING_CHECK_SSLV23,
               RSA_R_NULL_BEFORE_BLOCK_MISSING);
        return (-1);
    }
    for (k = -9; k < -1; k++) {
        if (p[k] != 0x03)
            break;
    }
    if (k == -1) {
        RSAerr(RSA_F_RSA_PADDING_CHECK_SSLV23, RSA_R_SSLV3_ROLLBACK_ATTACK);
        return (-1);
    }

    i++;                        /* Skip over the '\0' */
    j -= i;
    if (j > tlen) {
        RSAerr(RSA_F_RSA_PADDING_CHECK_SSLV23, RSA_R_DATA_TOO_LARGE);
        return (-1);
    }
    memcpy(to, p, (unsigned int)j);

    return (j);
}

canonical_original_code:
int RSA_padding_check_SSLv23(unsigned char *to, int tlen, unsigned char *from, int flen, int num)
{
    int i; int j; int k;
    unsigned char *p;

    p = from;
    if (flen < 10) {
        RSAerr(RSA_F_RSA_PADDING_CHECK_SSLV23, RSA_R_DATA_TOO_SMALL);
        return (-1);
    }
    if ((num != (flen + 1)) || (*(p++) != 02)) {
        RSAerr(RSA_F_RSA_PADDING_CHECK_SSLV23, RSA_R_BLOCK_TYPE_IS_NOT_02);
        return (-1);
    }

    /* scan over padding data */
    j = flen - 1;               /* one for type */
    for (i = 0; i < j; i++)
        if (*(p++) == 0)
            break;

    if ((i == j) || (i < 8)) {
        RSAerr(RSA_F_RSA_PADDING_CHECK_SSLV23,
               RSA_R_NULL_BEFORE_BLOCK_MISSING);
        return (-1);
    }
    for (k = -9; k < -1; k++) {
        if (p[k] != 0x03)
            break;
    }
    if (k == -1) {
        RSAerr(RSA_F_RSA_PADDING_CHECK_SSLV23, RSA_R_SSLV3_ROLLBACK_ATTACK);
        return (-1);
    }

    i++;                        /* Skip over the '\0' */
    j -= i;
    if (j > tlen) {
        RSAerr(RSA_F_RSA_PADDING_CHECK_SSLV23, RSA_R_DATA_TOO_LARGE);
        return (-1);
    }
    memcpy(to, p, (unsigned int)j);

    return (j);
}

variable_types: num int

variable_types: i int

variable_types: k int

variable_types:
p
unsigned char *


decompiled_code:
__int64 __fastcall ssl_puts(__int64 a1, const char *a2)
{
size_t v2; // rax

v2 = strlen(a2);
return BIO_write(a1, a2, v2);
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1, const char *a2)
{
size_t v2; // rax

v2 = strlen(a2);
return BIO_write(a1, a2, v2);
}

original_code:
static int ssl_puts(BIO *bp, const char *str)
{
    int n, ret;
    n = strlen(str);
    ret = BIO_write(bp, str, n);
    return (ret);
}

canonical_original_code:
static int ssl_puts(struct bio_st *bp, char *str)
{
    int n; int ret;
    n = strlen(str);
    ret = BIO_write(bp, str, n);
    return (ret);
}

variable_types:
str
char *

variable_types: n int

variable_types: ret int

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

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


decompiled_code:
void *BIO_f_ssl()
{
return &methods_sslp;
}

canonical_decompiled_code:
void *func7()
{
return &methods_sslp;
}

original_code:
BIO_METHOD *BIO_f_ssl(void)
{
    return (&methods_sslp);
}

canonical_original_code:
struct bio_method_st *BIO_f_ssl()
{
    return (&methods_sslp);
}

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


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

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

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

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

original_code:
void ERR_load_BIO_strings(void)
{
#ifndef OPENSSL_NO_ERR

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

canonical_original_code:
void ERR_load_BIO_strings()
{
#ifndef OPENSSL_NO_ERR

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


decompiled_code:
__int64 engine_unregister_all_RSA()
{
return engine_table_cleanup(&rsa_table);
}

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

original_code:
static void engine_unregister_all_RSA(void)
{
    engine_table_cleanup(&rsa_table);
}

canonical_original_code:
static void engine_unregister_all_RSA()
{
    engine_table_cleanup(&rsa_table);
}


decompiled_code:
__int64 __fastcall MD4_Init(_QWORD *a1)
{
unsigned __int64 v2; // rdi

a1[2] = 0LL;
v2 = (unsigned __int64)(a1 + 3);
*(_QWORD *)(v2 + 60) = 0LL;
memset((void *)(v2 & 0xFFFFFFFFFFFFFFF8LL), 0, 8 * (((unsigned int)a1 - (v2 & 0xFFFFFFF8) + 92) >> 3));
*a1 = 0xEFCDAB8967452301LL;
a1[1] = 0x1032547698BADCFELL;
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func0(_QWORD *a1)
{
unsigned __int64 v2; // rdi

a1[2] = 0LL;
v2 = (unsigned __int64)(a1 + 3);
*(_QWORD *)(v2 + 60) = 0LL;
memset((void *)(v2 & 0xFFFFFFFFFFFFFFF8LL), 0, 8 * (((unsigned int)a1 - (v2 & 0xFFFFFFF8) + 92) >> 3));
*a1 = 0xEFCDAB8967452301LL;
a1[1] = 0x1032547698BADCFELL;
return 1LL;
}

original_code:
int MD4_Init(MD4_CTX *c)
{
    memset(c, 0, sizeof(*c));
    c->A = (unsigned long)0x67452301L;
    c->B = (unsigned long)0xefcdab89L;
    c->C = (unsigned long)0x98badcfeL;
    c->D = (unsigned long)0x10325476L;
    return 1;
}

canonical_original_code:
int MD4_Init(struct MD4state_st *c)
{
    memset(c, 0, sizeof(*c));
    c->A = (unsigned long)0x67452301L;
    c->B = (unsigned long)0xefcdab89L;
    c->C = (unsigned long)0x98badcfeL;
    c->D = (unsigned long)0x10325476L;
    return 1;
}

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


canonical_original_code:
void md4_block_data_order(struct MD4state_st *c, void *data_, unsigned long num)
{
    unsigned char *data = data_;
    register unsigned int A; register unsigned int B; register unsigned int C; register unsigned int D; register unsigned int l;
    unsigned int XX0; unsigned int XX1; unsigned int XX2; unsigned int XX3; unsigned int XX4; unsigned int XX5; unsigned int XX6; unsigned int XX7; unsigned int XX8; unsigned int XX9; unsigned int XX10; unsigned int XX11; unsigned int XX12; unsigned int XX13; unsigned int XX14; unsigned int XX15;
    A = c->A;
    B = c->B;
    C = c->C;
    D = c->D;
    for (; num--;) {
        (void)((l)=*((unsigned int *)(data)), (data)+=4, l);
        XX0 = l;
        (void)((l)=*((unsigned int *)(data)), (data)+=4, l);
        XX1 = l;
        { A+=((XX0)+(0)+(((((C)) ^ ((D))) & ((B))) ^ ((D)))); A=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(3), "0"((unsigned int)(A)) : "cc"); ret; }); };;
        (void)((l)=*((unsigned int *)(data)), (data)+=4, l);
        XX2 = l;
        { D+=((XX1)+(0)+(((((B)) ^ ((C))) & ((A))) ^ ((C)))); D=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(7), "0"((unsigned int)(D)) : "cc"); ret; }); };;
        (void)((l)=*((unsigned int *)(data)), (data)+=4, l);
        XX3 = l;
        { C+=((XX2)+(0)+(((((A)) ^ ((B))) & ((D))) ^ ((B)))); C=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(11), "0"((unsigned int)(C)) : "cc"); ret; }); };;
        (void)((l)=*((unsigned int *)(data)), (data)+=4, l);
        XX4 = l;
        { B+=((XX3)+(0)+(((((D)) ^ ((A))) & ((C))) ^ ((A)))); B=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(19), "0"((unsigned int)(B)) : "cc"); ret; }); };;
        (void)((l)=*((unsigned int *)(data)), (data)+=4, l);
        XX5 = l;
        { A+=((XX4)+(0)+(((((C)) ^ ((D))) & ((B))) ^ ((D)))); A=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(3), "0"((unsigned int)(A)) : "cc"); ret; }); };;
        (void)((l)=*((unsigned int *)(data)), (data)+=4, l);
        XX6 = l;
        { D+=((XX5)+(0)+(((((B)) ^ ((C))) & ((A))) ^ ((C)))); D=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(7), "0"((unsigned int)(D)) : "cc"); ret; }); };;
        (void)((l)=*((unsigned int *)(data)), (data)+=4, l);
        XX7 = l;
        { C+=((XX6)+(0)+(((((A)) ^ ((B))) & ((D))) ^ ((B)))); C=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(11), "0"((unsigned int)(C)) : "cc"); ret; }); };;
        (void)((l)=*((unsigned int *)(data)), (data)+=4, l);
        XX8 = l;
        { B+=((XX7)+(0)+(((((D)) ^ ((A))) & ((C))) ^ ((A)))); B=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(19), "0"((unsigned int)(B)) : "cc"); ret; }); };;
        (void)((l)=*((unsigned int *)(data)), (data)+=4, l);
        XX9 = l;
        { A+=((XX8)+(0)+(((((C)) ^ ((D))) & ((B))) ^ ((D)))); A=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(3), "0"((unsigned int)(A)) : "cc"); ret; }); };;
        (void)((l)=*((unsigned int *)(data)), (data)+=4, l);
        XX10 = l;
        { D+=((XX9)+(0)+(((((B)) ^ ((C))) & ((A))) ^ ((C)))); D=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(7), "0"((unsigned int)(D)) : "cc"); ret; }); };;
        (void)((l)=*((unsigned int *)(data)), (data)+=4, l);
        XX11 = l;
        { C+=((XX10)+(0)+(((((A)) ^ ((B))) & ((D))) ^ ((B)))); C=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(11), "0"((unsigned int)(C)) : "cc"); ret; }); };;
        (void)((l)=*((unsigned int *)(data)), (data)+=4, l);
        XX12 = l;
        { B+=((XX11)+(0)+(((((D)) ^ ((A))) & ((C))) ^ ((A)))); B=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(19), "0"((unsigned int)(B)) : "cc"); ret; }); };;
        (void)((l)=*((unsigned int *)(data)), (data)+=4, l);
        XX13 = l;
        { A+=((XX12)+(0)+(((((C)) ^ ((D))) & ((B))) ^ ((D)))); A=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(3), "0"((unsigned int)(A)) : "cc"); ret; }); };;
        (void)((l)=*((unsigned int *)(data)), (data)+=4, l);
        XX14 = l;
        { D+=((XX13)+(0)+(((((B)) ^ ((C))) & ((A))) ^ ((C)))); D=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(7), "0"((unsigned int)(D)) : "cc"); ret; }); };;
        (void)((l)=*((unsigned int *)(data)), (data)+=4, l);
        XX15 = l;
        { C+=((XX14)+(0)+(((((A)) ^ ((B))) & ((D))) ^ ((B)))); C=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(11), "0"((unsigned int)(C)) : "cc"); ret; }); };;
        { B+=((XX15)+(0)+(((((D)) ^ ((A))) & ((C))) ^ ((A)))); B=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(19), "0"((unsigned int)(B)) : "cc"); ret; }); };;
        { A+=((XX0)+(0x5A827999L)+((((B)) & ((C))) | (((B)) & ((D))) | (((C)) & ((D))))); A=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(3), "0"((unsigned int)(A)) : "cc"); ret; }); };;
        { D+=((XX4)+(0x5A827999L)+((((A)) & ((B))) | (((A)) & ((C))) | (((B)) & ((C))))); D=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(5), "0"((unsigned int)(D)) : "cc"); ret; }); };;
        { C+=((XX8)+(0x5A827999L)+((((D)) & ((A))) | (((D)) & ((B))) | (((A)) & ((B))))); C=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(9), "0"((unsigned int)(C)) : "cc"); ret; }); };;
        { B+=((XX12)+(0x5A827999L)+((((C)) & ((D))) | (((C)) & ((A))) | (((D)) & ((A))))); B=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(13), "0"((unsigned int)(B)) : "cc"); ret; }); };;
        { A+=((XX1)+(0x5A827999L)+((((B)) & ((C))) | (((B)) & ((D))) | (((C)) & ((D))))); A=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(3), "0"((unsigned int)(A)) : "cc"); ret; }); };;
        { D+=((XX5)+(0x5A827999L)+((((A)) & ((B))) | (((A)) & ((C))) | (((B)) & ((C))))); D=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(5), "0"((unsigned int)(D)) : "cc"); ret; }); };;
        { C+=((XX9)+(0x5A827999L)+((((D)) & ((A))) | (((D)) & ((B))) | (((A)) & ((B))))); C=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(9), "0"((unsigned int)(C)) : "cc"); ret; }); };;
        { B+=((XX13)+(0x5A827999L)+((((C)) & ((D))) | (((C)) & ((A))) | (((D)) & ((A))))); B=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(13), "0"((unsigned int)(B)) : "cc"); ret; }); };;
        { A+=((XX2)+(0x5A827999L)+((((B)) & ((C))) | (((B)) & ((D))) | (((C)) & ((D))))); A=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(3), "0"((unsigned int)(A)) : "cc"); ret; }); };;
        { D+=((XX6)+(0x5A827999L)+((((A)) & ((B))) | (((A)) & ((C))) | (((B)) & ((C))))); D=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(5), "0"((unsigned int)(D)) : "cc"); ret; }); };;
        { C+=((XX10)+(0x5A827999L)+((((D)) & ((A))) | (((D)) & ((B))) | (((A)) & ((B))))); C=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(9), "0"((unsigned int)(C)) : "cc"); ret; }); };;
        { B+=((XX14)+(0x5A827999L)+((((C)) & ((D))) | (((C)) & ((A))) | (((D)) & ((A))))); B=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(13), "0"((unsigned int)(B)) : "cc"); ret; }); };;
        { A+=((XX3)+(0x5A827999L)+((((B)) & ((C))) | (((B)) & ((D))) | (((C)) & ((D))))); A=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(3), "0"((unsigned int)(A)) : "cc"); ret; }); };;
        { D+=((XX7)+(0x5A827999L)+((((A)) & ((B))) | (((A)) & ((C))) | (((B)) & ((C))))); D=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(5), "0"((unsigned int)(D)) : "cc"); ret; }); };;
        { C+=((XX11)+(0x5A827999L)+((((D)) & ((A))) | (((D)) & ((B))) | (((A)) & ((B))))); C=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(9), "0"((unsigned int)(C)) : "cc"); ret; }); };;
        { B+=((XX15)+(0x5A827999L)+((((C)) & ((D))) | (((C)) & ((A))) | (((D)) & ((A))))); B=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(13), "0"((unsigned int)(B)) : "cc"); ret; }); };;
        { A+=((XX0)+(0x6ED9EBA1L)+(((B)) ^ ((C)) ^ ((D)))); A=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(3), "0"((unsigned int)(A)) : "cc"); ret; }); };;
        { D+=((XX8)+(0x6ED9EBA1L)+(((A)) ^ ((B)) ^ ((C)))); D=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(9), "0"((unsigned int)(D)) : "cc"); ret; }); };;
        { C+=((XX4)+(0x6ED9EBA1L)+(((D)) ^ ((A)) ^ ((B)))); C=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(11), "0"((unsigned int)(C)) : "cc"); ret; }); };;
        { B+=((XX12)+(0x6ED9EBA1L)+(((C)) ^ ((D)) ^ ((A)))); B=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(15), "0"((unsigned int)(B)) : "cc"); ret; }); };;
        { A+=((XX2)+(0x6ED9EBA1L)+(((B)) ^ ((C)) ^ ((D)))); A=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(3), "0"((unsigned int)(A)) : "cc"); ret; }); };;
        { D+=((XX10)+(0x6ED9EBA1L)+(((A)) ^ ((B)) ^ ((C)))); D=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(9), "0"((unsigned int)(D)) : "cc"); ret; }); };;
        { C+=((XX6)+(0x6ED9EBA1L)+(((D)) ^ ((A)) ^ ((B)))); C=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(11), "0"((unsigned int)(C)) : "cc"); ret; }); };;
        { B+=((XX14)+(0x6ED9EBA1L)+(((C)) ^ ((D)) ^ ((A)))); B=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(15), "0"((unsigned int)(B)) : "cc"); ret; }); };;
        { A+=((XX1)+(0x6ED9EBA1L)+(((B)) ^ ((C)) ^ ((D)))); A=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(3), "0"((unsigned int)(A)) : "cc"); ret; }); };;
        { D+=((XX9)+(0x6ED9EBA1L)+(((A)) ^ ((B)) ^ ((C)))); D=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(9), "0"((unsigned int)(D)) : "cc"); ret; }); };;
        { C+=((XX5)+(0x6ED9EBA1L)+(((D)) ^ ((A)) ^ ((B)))); C=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(11), "0"((unsigned int)(C)) : "cc"); ret; }); };;
        { B+=((XX13)+(0x6ED9EBA1L)+(((C)) ^ ((D)) ^ ((A)))); B=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(15), "0"((unsigned int)(B)) : "cc"); ret; }); };;
        { A+=((XX3)+(0x6ED9EBA1L)+(((B)) ^ ((C)) ^ ((D)))); A=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(3), "0"((unsigned int)(A)) : "cc"); ret; }); };;
        { D+=((XX11)+(0x6ED9EBA1L)+(((A)) ^ ((B)) ^ ((C)))); D=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(9), "0"((unsigned int)(D)) : "cc"); ret; }); };;
        { C+=((XX7)+(0x6ED9EBA1L)+(((D)) ^ ((A)) ^ ((B)))); C=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(11), "0"((unsigned int)(C)) : "cc"); ret; }); };;
        { B+=((XX15)+(0x6ED9EBA1L)+(((C)) ^ ((D)) ^ ((A)))); B=({ register unsigned int ret; asm ( "roll %1,%0" : "=r"(ret) : "I"(15), "0"((unsigned int)(B)) : "cc"); ret; }); };;
        A = c->A += A;
        B = c->B += B;
        C = c->C += C;
        D = c->D += D;
    }
}

variable_types:
num
unsigned long

variable_types:
data
unsigned char *

variable_types:
A
unsigned int

variable_types:
B
unsigned int

variable_types:
C
unsigned int

variable_types:
D
unsigned int

variable_types:
l
unsigned int

variable_types:
ret
unsigned int

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


original_code:
int MD4_Update(MD4_CTX *c, const void *data_, size_t len)
{
    const unsigned char *data = data_;
    unsigned char *p;
    unsigned int l;
    size_t n;
    if (len == 0)
        return 1;
    l = (c->Nl + (((unsigned int) len) << 3)) & 0xffffffffUL;
    if (l < c->Nl)
        c->Nh++;
    c->Nh += (unsigned int) (len >> 29);
    c->Nl = l;
    n = c->num;
    if (n != 0) {
        p = (unsigned char *)c->data;
        if (len >= 64 || len + n >= 64) {
            memcpy(p + n, data, 64 - n);
            md4_block_data_order(c, p, 1);
            n = 64 - n;
            data += n;
            len -= n;
            c->num = 0;
            memset(p, 0, 64);
        } else {
            memcpy(p + n, data, len);
            c->num += (unsigned int)len;
            return 1;
        }
    }
    n = len / 64;
    if (n > 0) {
        md4_block_data_order(c, data, n);
        n *= 64;
        data += n;
        len -= n;
    }
    if (len != 0) {
        p = (unsigned char *)c->data;
        c->num = (unsigned int)len;
        memcpy(p, data, len);
    }
    return 1;
}

canonical_original_code:
int MD4_Update(struct MD4state_st *c, void *data_, unsigned long len)
{
    unsigned char *data = data_;
    unsigned char *p;
    unsigned int l;
    unsigned long n;
    if (len == 0)
        return 1;
    l = (c->Nl + (((unsigned int) len) << 3)) & 0xffffffffUL;
    if (l < c->Nl)
        c->Nh++;
    c->Nh += (unsigned int) (len >> 29);
    c->Nl = l;
    n = c->num;
    if (n != 0) {
        p = (unsigned char *)c->data;
        if (len >= 64 || len + n >= 64) {
            memcpy(p + n, data, 64 - n);
            md4_block_data_order(c, p, 1);
            n = 64 - n;
            data += n;
            len -= n;
            c->num = 0;
            memset(p, 0, 64);
        } else {
            memcpy(p + n, data, len);
            c->num += (unsigned int)len;
            return 1;
        }
    }
    n = len / 64;
    if (n > 0) {
        md4_block_data_order(c, data, n);
        n *= 64;
        data += n;
        len -= n;
    }
    if (len != 0) {
        p = (unsigned char *)c->data;
        c->num = (unsigned int)len;
        memcpy(p, data, len);
    }
    return 1;
}

variable_types:
len
unsigned long

variable_types:
n
unsigned long


decompiled_code:
__int64 __fastcall MD4_Transform(int *a1, int *a2)
{
return md4_block_data_order(a1, a2, 1LL);
}

canonical_decompiled_code:
__int64 __fastcall func3(int *a1, int *a2)
{
return func1(a1, a2, 1LL);
}

original_code:
void MD4_Transform(MD4_CTX *c, const unsigned char *data)
{
    md4_block_data_order(c, data, 1);
}

canonical_original_code:
void MD4_Transform(struct MD4state_st *c, unsigned char *data)
{
    md4_block_data_order(c, data, 1);
}


original_code:
int MD4_Final(unsigned char *md, MD4_CTX *c)
{
    unsigned char *p = (unsigned char *)c->data;
    size_t n = c->num;
    p[n] = 0x80;
    n++;
    if (n > (64 - 8)) {
        memset(p + n, 0, 64 - n);
        n = 0;
        md4_block_data_order(c, p, 1);
    }
    memset(p + n, 0, 64 - 8 - n);
    p += 64 - 8;
    (void)(*((unsigned int *)(p))=(c->Nl), (p)+=4, c->Nl);
    (void)(*((unsigned int *)(p))=(c->Nh), (p)+=4, c->Nh);
    p -= 64;
    md4_block_data_order(c, p, 1);
    c->num = 0;
    memset(p, 0, 64);
    do { unsigned long ll; ll=(c)->A; (void)(*((unsigned int *)((md)))=(ll), ((md))+=4, ll); ll=(c)->B; (void)(*((unsigned int *)((md)))=(ll), ((md))+=4, ll); ll=(c)->C; (void)(*((unsigned int *)((md)))=(ll), ((md))+=4, ll); ll=(c)->D; (void)(*((unsigned int *)((md)))=(ll), ((md))+=4, ll); } while (0);
    return 1;
}

canonical_original_code:
int MD4_Final(unsigned char *md, struct MD4state_st *c)
{
    unsigned char *p = (unsigned char *)c->data;
    unsigned long n = c->num;
    p[n] = 0x80;
    n++;
    if (n > (64 - 8)) {
        memset(p + n, 0, 64 - n);
        n = 0;
        md4_block_data_order(c, p, 1);
    }
    memset(p + n, 0, 64 - 8 - n);
    p += 64 - 8;
    (void)(*((unsigned int *)(p))=(c->Nl), (p)+=4, c->Nl);
    (void)(*((unsigned int *)(p))=(c->Nh), (p)+=4, c->Nh);
    p -= 64;
    md4_block_data_order(c, p, 1);
    c->num = 0;
    memset(p, 0, 64);
    do { unsigned long ll; ll=(c)->A; (void)(*((unsigned int *)((md)))=(ll), ((md))+=4, ll); ll=(c)->B; (void)(*((unsigned int *)((md)))=(ll), ((md))+=4, ll); ll=(c)->C; (void)(*((unsigned int *)((md)))=(ll), ((md))+=4, ll); ll=(c)->D; (void)(*((unsigned int *)((md)))=(ll), ((md))+=4, ll); } while (0);
    return 1;
}

variable_types:
md
unsigned char *

variable_types:
ll
unsigned long


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

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

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

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

original_code:
void ERR_load_DSA_strings(void)
{
#ifndef OPENSSL_NO_ERR

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

canonical_original_code:
void ERR_load_DSA_strings()
{
#ifndef OPENSSL_NO_ERR

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


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

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

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

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

original_code:
void ERR_load_RSA_strings(void)
{
#ifndef OPENSSL_NO_ERR

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

canonical_original_code:
void ERR_load_RSA_strings()
{
#ifndef OPENSSL_NO_ERR

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