ASPack Software - ASObfuscator

mak

Соломенные сандалии
Администратор
Сообщения
652
Реакции
377
ASObfuscator - ASPack Software releases new product for protection of C and C++ source code - http://www.aspack.com/asobfuscator.html
Download http://aspack.com/files/ASObfuscator_trial.zip

ASObfuscator is an efficient solution designed to obfuscate (transform) the source code of C/C++programs (supports standards C++98 and C++03) to protect them against reverse engineering. After obfuscation the code is reliably protected against potential analysis performed by man or machine.

C++ 11 standard and later versions are not supported.

ASObfuscator is recommended for the cases when software protection against reverse engineering is crucial. For example, it is vital for software that contains DRM keys or other sensitive data that can’t be lost or modified.

ASObfuscator features
  • Game protection from tampering and malicious reverse engineering.
  • Source code protection when it is delivered to a third party.
  • Protection from loss of standard DRM keys.
  • Protection of a standard DRM client side.
  • Securing the implementation of custom DRM from reverse engineering.
ASObfuscator benefits
  • The high level of protection is provided by obfuscation of both the source code and the binary code.
  • The obfuscator supports more than 30 obfuscation methods. These methods can be enabled, disabled and adjusted independently. The most effective methods are the following:
    • conversion of C++ code into virtual machine code;
    • encryption of strings and arrays;
    • code conversion into a state machine;
    • insertion of dummy links;
    • merging of code sections.
  • An option to set different obfuscation rules for different parts of code.
  • ASObfuscator is a stand-alone application that is installed at the customer’s site.
  • Runs from the command line.
ASObfuscator can run on the following operating systems:
  • Windows 7 32/64-bit.
  • Windows 8/8.1 32/64-bit.
  • Windows 10 32/64-bit.
  • Windows Server 2008 R2.
  • Windows Server 2012.
  • Windows Server 2012 R2.
  • Windows Server 2016.
  • Windows Server 2019.
ASObfuscator can obfuscate source code for the following target platforms:
  • Windows.
  • macOS.
  • Linux.
  • iOS.
  • Android.
Source code before obfuscation:
#include <stdio.h>
 
// Euclidian algorithm for calculating greatest common divisor (before obfuscation)
int gcd( int n, int m )
{
    if( n < 1 || m < 1 ) return -1;
    while( n != m )
    {
        if( n > m ) n -= m;
        else m -= n;
    }
    return n;
}
 
// Tests in triplets { n, m, expected_gcd( n, m ) }
int tests[][ 3 ] = {
    { 1, 2, 1 },
    { 3, 3, 3 },
    { 42, 56, 14 },
    { 249084, 261183, 111 },
};
 
// Perform tests
int main( int, char*[] )
{
    printf( "Performing tests of gcd function:\n" );
    bool passed = true;
    for( int i = 0; i < sizeof( tests ) / sizeof( tests[ 0 ] ); i++ )
    {
        int n = tests[ i ][ 0 ];
        int m = tests[ i ][ 1 ];
        int expected_gcd = tests[ i ][ 2 ];
        int calculated_gcd = gcd( n, m );
        printf( "  %d. gcd( %d, %d ) = %d, ", i + 1, n, m, calculated_gcd );
        if( calculated_gcd == expected_gcd )
        {
            printf( "OK.\n" );
        }
        else
        {
            printf( "error.\n" );
            passed = false;
        }
    }
    printf( "Tests %s.\n", passed ? "passed" : "failed" );
    return passed ? 0 : 1;
}
Source code after obfuscation:
#include <stdio.h>
#include <cstddef>
#include <iostream>

 
// Euclidian algorithm for calculating greatest common divisor (after obfuscation)
int gcd( int n_0, int m_1 )
{
    bool temp_12;
    unsigned int temp_13;
    unsigned int temp_14;
    unsigned int temp_15;
    unsigned int temp_17;
    int temp_26;
    int temp_35;
    bool temp_36;
    unsigned int temp_37;
    bool temp_38;
    int temp_39;
    int temp_40;
    int temp_41;
    int temp_42;
    bool state0_43;
    bool state1_44;
    bool state2_45;
    bool state3_46;
    bool state4_47;
    bool state5_48;
    bool state6_49;
    bool state7_50;
 
    L1:
    L0:
    state0_43 = (bool)1;
    state1_44 = (bool)state0_43;
    state2_45 = (bool)state1_44;
    state3_46 = (bool)state2_45;
    goto L126;
 
    L6:
    temp_37 = ( unsigned int )(temp_17);
    temp_38 = ( bool )( temp_36 == 0 );
    if (state0_43) goto L158; else goto L40;
 
    L14:
    temp_41 = ( int )(temp_17);
    temp_38 = ( bool )( temp_36 == 0 );
    if (state0_43) goto L160; else goto L128;
 
    L22:
    temp_26 = ( int )(temp_41);
    if (state4_47) goto L70; else goto L72;
 
    L24:
    temp_41 = (int)state6_49;
    temp_42 = temp_41 - temp_40;
    temp_26 = (int)temp_42;
    temp_35 = temp_39 + temp_42;
    temp_39 = (int)temp_35;
    if (state1_44) goto L30; else goto L26;
 
    L26:
    temp_42 = ( int )( state0_43 == 0 );
    temp_26 = temp_42 - temp_39;
    temp_41 = (int)temp_26;
    temp_35 = temp_40 + temp_26;
    temp_40 = (int)temp_35;
    goto L30;
 
    L30:
    temp_36 = temp_39 != temp_40;
    if (temp_36) goto L22; else goto L82;
 
    L38:
    state1_44 = ( bool )( state5_48 == 0 );
    temp_26 = temp_39 + temp_35;
    temp_42 = ( int )( state5_48 == 0 );
    temp_42 = temp_42 - temp_35;
    temp_40 = temp_26 + temp_42;
    temp_41 = (int)1495809726u;
    // The next string is really just an assignment on 32bit platform
    temp_41 = ( int )( ( size_t )( temp_41 ) + ( ( ( size_t )( temp_41 ) << 31 ) << 1 ) + ( ( ( ( size_t )( temp_41 ) << 31 ) << 1 ) >> 15 ) );
    goto L44;
 
    L40:
    goto L128;
 
    L42:
    if (state3_46) goto L82; else goto L84;
 
    L44:
    temp_35 = temp_40 ^ temp_41;
    temp_42 = (int)1495809726u;
    if (state1_44) goto L6; else goto L100;
 
    L46:
    temp_41 = ( int )( state4_47 == 0 );
    if (state3_46) goto L22; else goto L98;
 
    L48:
    // The next string is really just an assignment on 32bit platform
    temp_41 = ( int )( ( size_t )( temp_41 ) + ( ( ( size_t )( temp_41 ) << 31 ) << 1 ) + ( ( ( ( size_t )( temp_41 ) << 31 ) << 1 ) >> 15 ) );
    if (state7_50) goto L66; else goto L96;
 
    L52:
    temp_35 = temp_41 + temp_42;
    if (state2_45) goto L76; else goto L94;
 
    L54:
    // The next string is really just an assignment on 32bit platform
    temp_26 = ( int )( ( size_t )( temp_26 ) + ( ( ( size_t )( temp_26 ) << 31 ) << 1 ) + ( ( ( ( size_t )( temp_26 ) << 31 ) << 1 ) >> 15 ) );
    if (state2_45) goto L14; else goto L102;
 
    L56:
    temp_36 = temp_39 <= temp_41;
    temp_26 = ( int )(temp_17);
    if (state5_48) goto L80; else goto L92;
 
    L58:
    temp_37 = (unsigned int)state6_49;
    temp_42 = ( int )(temp_38);
    if (state2_45) goto L48; else goto L90;
 
    L60:
    state2_45 = ( bool )( state6_49 == 0 );
    temp_38 = (bool)0u;
    if (temp_36) goto L74; else goto L146;
 
    L62:
    temp_35 = (int)0;
    if (state3_46) goto L26; else goto L104;
 
    L64:
    temp_41 = ( int )(temp_17);
    state3_46 = ( bool )( state6_49 == 0 );
    state4_47 = ( bool )( state6_49 == 0 );
    temp_35 = (int)state6_49;
    temp_36 = temp_40 <= temp_35;
    if (state0_43) goto L162; else goto L154;
 
    L66:
    state7_50 = (bool)state6_49;
    state5_48 = (bool)state2_45;
    temp_39 = (int)-1;
    temp_40 = (int)1495809726u;
    if (state6_49) goto L22; else goto L42;
 
    L68:
    temp_39 = (int)-1;
    if (state7_50) goto L88; else goto L86;
 
    L70:
    temp_36 = temp_39 > temp_40;
    temp_17 = ( unsigned int )(temp_36);
    if (temp_36) goto L24; else goto L62;
 
    L72:
    temp_42 = temp_35 | temp_26;
    temp_41 = temp_35 & temp_26;
    temp_17 = ( unsigned int )(temp_42);
    temp_37 = ( unsigned int )(temp_41);
    temp_38 = temp_17 < temp_37;
    if (temp_38) goto L154; else goto L148;
 
    L74:
    temp_35 = temp_39 - temp_40;
    if (state3_46) goto L106; else goto L14;
 
    L76:
    temp_41 = ( int )( state0_43 == 0 );
    temp_26 = temp_41 - temp_39;
    temp_35 = temp_40 + temp_26;
    temp_40 = (int)temp_35;
    temp_36 = temp_39 != temp_40;
    if (state2_45) goto L154; else goto L40;
 
    L80:
    temp_42 = temp_39 + temp_35;
    temp_26 = (int)temp_42;
    temp_40 = temp_42 - temp_35;
    temp_13 = ( unsigned int )(state7_50);
    temp_14 = (unsigned int)131u;
    temp_13 = temp_13 * temp_14;
    temp_14 = (unsigned int)1495809857u;
    temp_13 = temp_14 - temp_13;
    temp_41 = ( int )( ( ptrdiff_t )( ( temp_13 ) & 0xFFFFFFFF ) );
    // The next string is really just an assignment on 32bit platform
    temp_41 = ( int )( ( size_t )( temp_41 ) + ( ( ( size_t )( temp_41 ) << 31 ) << 1 ) + ( ( ( ( size_t )( temp_41 ) << 31 ) << 1 ) >> 15 ) );
    if (state3_46) goto L164; else goto L152;
 
    L82:
    temp_17 = ( unsigned int )(temp_42);
    // The next string is really just an assignment on 32bit platform
    temp_40 = ( int )( ( size_t )( temp_40 ) + ( ( ( size_t )( temp_40 ) << 31 ) << 1 ) + ( ( ( ( size_t )( temp_40 ) << 31 ) << 1 ) >> 15 ) );
    temp_35 = temp_39 ^ temp_40;
    if (state7_50) goto L38; else goto L108;
 
    L84:
    // The next string is really just an assignment on 32bit platform
    temp_40 = ( int )( ( size_t )( temp_40 ) + ( ( ( size_t )( temp_40 ) << 31 ) << 1 ) + ( ( ( ( size_t )( temp_40 ) << 31 ) << 1 ) >> 15 ) );
    temp_35 = temp_39 ^ temp_40;
    temp_41 = (int)1495809726u;
    if (state5_48) goto L68; else goto L64;
 
    L86:
    // The next string is really just an assignment on 32bit platform
    temp_41 = ( int )( ( size_t )( temp_41 ) + ( ( ( size_t )( temp_41 ) << 31 ) << 1 ) + ( ( ( ( size_t )( temp_41 ) << 31 ) << 1 ) >> 15 ) );
    temp_17 = ( unsigned int )(temp_42);
    if (state7_50) goto L68; else goto L110;
 
    L88:
    state7_50 = ( bool )( state0_43 == 0 );
    temp_40 = (int)1495809726u;
    state5_48 = ( bool )( state6_49 == 0 );
    goto L42;
 
    L90:
    temp_38 = (bool)state2_45;
    temp_17 = ( unsigned int )(temp_37);
    goto L150;
 
    L92:
    state2_45 = (bool)state5_48;
    temp_37 = (unsigned int)0u;
    temp_17 = (unsigned int)0u;
    state4_47 = ( bool )( state7_50 == 0 );
    temp_26 = ( int )(temp_39);
    goto L58;
 
    L94:
    temp_26 = (int)836078487u;
    goto L156;
 
    L96:
    temp_39 = temp_35 ^ temp_41;
    temp_17 = ( unsigned int )(temp_36);
    return temp_39;
 
    L98:
    state2_45 = (bool)state6_49;
    temp_42 = (int)836078487u;
    // The next string is really just an assignment on 32bit platform
    temp_42 = ( int )( ( size_t )( temp_42 ) + ( ( ( size_t )( temp_42 ) << 31 ) << 1 ) + ( ( ( ( size_t )( temp_42 ) << 31 ) << 1 ) >> 15 ) );
    goto L52;
 
    L100:
    temp_36 = ( bool )(temp_39);
    // The next string is really just an assignment on 32bit platform
    temp_42 = ( int )( ( size_t )( temp_42 ) + ( ( ( size_t )( temp_42 ) << 31 ) << 1 ) + ( ( ( ( size_t )( temp_42 ) << 31 ) << 1 ) >> 15 ) );
    state6_49 = (bool)state2_45;
    temp_39 = temp_35 ^ temp_42;
    return temp_39;
 
    L102:
    temp_41 = temp_35 - temp_26;
    state2_45 = ( bool )( state3_46 == 0 );
    state5_48 = ( bool )( state7_50 == 0 );
    goto L56;
 
    L104:
    temp_42 = ( int )(temp_17);
    state3_46 = (bool)state2_45;
    temp_36 = temp_40 <= temp_35;
    state4_47 = (bool)state0_43;
    state5_48 = ( bool )( state6_49 == 0 );
    if (temp_36) goto L54; else goto L30;
 
    L106:
    temp_17 = ( unsigned int )(temp_40);
    temp_41 = temp_35 + temp_26;
    goto L152;
 
    L108:
    temp_41 = (int)1495809726u;
    goto L148;
 
    L110:
    temp_39 = temp_35 ^ temp_41;
    return temp_39;
 
    L122:
    temp_39 = temp_41 - temp_26;
    goto L30;
 
    L126:
    state4_47 = (bool)state3_46;
    state5_48 = (bool)state4_47;
    state6_49 = ( bool )( state5_48 == 0 );
    state7_50 = ( bool )( state6_49 == 0 );
    goto L40;
 
    L128:
    state3_46 = ( bool )( state7_50 == 0 );
    temp_40 = (int)m_1;
    temp_39 = (int)n_0;
    goto L46;
 
    L144:
    temp_36 = temp_39 > temp_40;
    if (temp_36) goto L146; else goto L52;
 
    L146:
    temp_36 = ( bool )(temp_37);
    temp_42 = ( int )(temp_17);
    temp_41 = ( int )(temp_39);
    temp_17 = ( unsigned int )(temp_40);
    if (state3_46) goto L74; else goto L44;
 
    L148:
    if (state7_50) goto L144; else goto L58;
 
    L150:
    if (state2_45) goto L44; else goto L60;
 
    L152:
    temp_38 = ( bool )(temp_17);
    temp_37 = ( unsigned int )(temp_41);
    temp_36 = ( bool )(temp_38);
    if (state4_47) goto L122; else goto L62;
 
    L154:
    temp_17 = ( unsigned int )(temp_36);
    if (temp_36) goto L156; else goto L56;
 
    L156:
    if (state2_45) goto L46; else goto L54;
 
    L158:
    if (temp_38) goto L152; else goto L64;
 
    L160:
    if (temp_38) goto L48; else goto L86;
 
    L162:
    state5_48 = ( bool )( state6_49 == 0 );
    if (temp_36) goto L14; else goto L30;
 
    L164:
    state1_44 = ( bool )( state3_46 == 0 );
    goto L150;
 
}
 
// Tests in triplets { n, m, expected_gcd( n, m ) }
int tests[][ 3 ] = {
    { 1, 2, 1 },
    { 3, 3, 3 },
    { 42, 56, 14 },
    { 249084, 261183, 111 },
};
 
// Perform tests
int main( int, char*[] )
{
    printf( "Performing tests of gcd function:\n" );
    bool passed = true;
    for( int i = 0; i < sizeof( tests ) / sizeof( tests[ 0 ] ); i++ )
    {
        int n = tests[ i ][ 0 ];
        int m = tests[ i ][ 1 ];
        int expected_gcd = tests[ i ][ 2 ];
        int calculated_gcd = gcd( n, m );
        printf( "  %d. gcd( %d, %d ) = %d, ", i + 1, n, m, calculated_gcd );
        if( calculated_gcd == expected_gcd )
        {
            printf( "OK.\n" );
        }
        else
        {
            printf( "error.\n" );
            passed = false;
        }
    }
    printf( "Tests %s.\n", passed ? "passed" : "failed" );
    return passed ? 0 : 1;
}
 

mak

Соломенные сандалии
Администратор
Сообщения
652
Реакции
377
Результаты в GodBolt с оптимизайцией, мод clang -O3
clang -O3:
gcd(int, int):                               # @gcd(int, int)
        push    rbp
        push    r15
        push    r14
        push    r13
        push    r12
        push    rbx
        mov     al, 1
        mov     dword ptr [rsp - 4], eax        # 4-byte Spill
        xor     r9d, r9d
        mov     r12b, 1
        mov     byte ptr [rsp - 5], 1           # 1-byte Folded Spill
        mov     r13b, 1
        mov     r11b, 1
.LBB0_1:                                # %L46
        mov     al, byte ptr [rsp - 5]          # 1-byte Reload
        not     al
        and     al, 1
        movzx   r14d, al
        test    r9b, 1
        jne     .LBB0_2
        mov     ebp, 1224969111
        xor     r12d, r12d
        test    r12b, 1
        je      .LBB0_49
.LBB0_23:                               # %L76
        mov     r15d, ebp
        mov     ebp, r13d
        mov     r13d, r12d
        mov     r12d, r11d
        mov     r11d, r9d
        mov     r9, rcx
        mov     edx, edi
        neg     edx
        sub     esi, edi
        cmp     edi, esi
        setne   r10b
        xor     r14d, r14d
        mov     ebx, esi
        xor     eax, eax
        mov     ecx, r10d
        and     cl, 1
        jne     .LBB0_71
.LBB0_25:                               #   in Loop: Header=BB0_1 Depth=1
        mov     rcx, r9
        mov     r9d, r11d
        mov     r11d, r12d
        mov     r12d, r13d
        mov     r13d, ebp
        cmp     edi, r14d
        setle   r10b
        test    r13b, 1
        je      .LBB0_26
.LBB0_53:                               # %L80
        lea     edx, [rdi + rbx]
        mov     ecx, r11d
        and     cl, 1
        movzx   ecx, cl
        imul    ecx, ecx, -125
        movzx   ecx, cl
        mov     esi, 1495809857
        sub     esi, ecx
        mov     r14d, esi
        shl     r14d, 17
        add     r14d, esi
        test    r9b, 1
        jne     .LBB0_66
        mov     esi, edi
        mov     r8d, r14d
        mov     r15d, edx
        test    eax, eax
        setne   cl
        test    byte ptr [rsp - 5], 1           # 1-byte Folded Reload
        jne     .LBB0_70
        jmp     .LBB0_58
.LBB0_66:                               #   in Loop: Header=BB0_1 Depth=1
        mov     dword ptr [rsp - 4], 0          # 4-byte Folded Spill
        mov     esi, edi
        mov     r15d, edx
        jmp     .LBB0_67
.LBB0_2:                                #   in Loop: Header=BB0_1 Depth=1
        mov     edx, r14d
        test    byte ptr [rsp - 5], 1           # 1-byte Folded Reload
        je      .LBB0_39
.LBB0_4:                                # %L70
        xor     r15d, r15d
        mov     ebx, edi
        sub     ebx, esi
        jle     .LBB0_5
        test    byte ptr [rsp - 4], 1           # 1-byte Folded Reload
        jne     .LBB0_38
        mov     edi, ebx
        jmp     .LBB0_12
.LBB0_5:                                #   in Loop: Header=BB0_1 Depth=1
        mov     eax, edx
        test    r9b, 1
        je      .LBB0_7
.LBB0_12:                               # %L26
        mov     edx, edi
        neg     edx
        sub     esi, edi
        xor     r15d, r15d
        mov     ebx, esi
        mov     eax, edx
        jmp     .LBB0_13
.LBB0_38:                               #   in Loop: Header=BB0_1 Depth=1
        mov     edx, esi
        neg     edx
        xor     eax, eax
        mov     edi, ebx
        mov     r15d, edx
        jmp     .LBB0_13
.LBB0_7:                                # %L104
        mov     r9d, r12d
        and     r9b, 1
        mov     byte ptr [rsp - 5], 1           # 1-byte Folded Spill
        xor     ebx, ebx
        mov     r13b, 1
        mov     r10b, 1
        mov     ebp, r15d
        test    esi, esi
        jg      .LBB0_13
.LBB0_8:                                # %L54
        mov     eax, edx
        shl     edx, 17
        add     edx, eax
        test    r12b, 1
        jne     .LBB0_9
        mov     r14d, ebx
        sub     r14d, edx
        mov     r12d, r9d
        not     r12b
        and     r12b, 1
        mov     r13d, r11d
        not     r13b
        and     r13b, 1
        mov     eax, r15d
        cmp     edi, r14d
        setle   r10b
        test    r13b, 1
        jne     .LBB0_53
.LBB0_26:                               # %L92
        mov     eax, r11d
        not     al
        and     al, 1
        mov     byte ptr [rsp - 5], al          # 1-byte Spill
        xor     r15d, r15d
        xor     r12d, r12d
        mov     edx, edi
        jmp     .LBB0_27
.LBB0_9:                                #   in Loop: Header=BB0_1 Depth=1
        mov     eax, r15d
        mov     r15d, ebp
.LBB0_10:                               # %L14
        mov     ecx, r10d
        and     cl, 1
        jne     .LBB0_46
        mov     ebp, eax
        mov     r14d, eax
        mov     cl, 1
        jmp     .LBB0_28
.LBB0_46:                               #   in Loop: Header=BB0_1 Depth=1
        xor     cl, 1
        mov     esi, ecx
        jmp     .LBB0_47
.LBB0_13:                               # %L30
        mov     r10b, 1
        cmp     edi, esi
        jne     .LBB0_14
        mov     esi, edi
        shl     esi, 17
        add     esi, edi
        mov     ebx, esi
        xor     ebx, edi
        test    r11b, 1
        jne     .LBB0_17
        mov     r14d, 1495809726
        xor     r10d, r10d
        test    r11b, 1
        jne     .LBB0_64
        jmp     .LBB0_27
.LBB0_14:                               #   in Loop: Header=BB0_1 Depth=1
        mov     edx, eax
        test    byte ptr [rsp - 5], 1           # 1-byte Folded Reload
        jne     .LBB0_4
.LBB0_39:                               # %L72
        mov     r15d, edx
        or      r15d, ebx
        mov     r8d, edx
        and     r8d, ebx
        cmp     r15d, r8d
        jae     .LBB0_62
        mov     ebp, r13d
        mov     r13d, r12d
        mov     r14d, r8d
        mov     r12d, r11d
        mov     r11d, r9d
        mov     r9b, 1
        xor     eax, eax
        mov     ecx, r10d
        and     cl, 1
        je      .LBB0_25
.LBB0_71:                               #   in Loop: Header=BB0_1 Depth=1
        movzx   eax, cl
        mov     rcx, r9
        mov     r9d, r11d
        mov     r11d, r12d
        mov     r12d, r13d
        mov     r13d, ebp
        mov     ebp, r15d
        mov     r15d, eax
        test    r12b, 1
        je      .LBB0_8
        jmp     .LBB0_1
.LBB0_17:                               # %if.then207
        mov     eax, r13d
        not     al
        and     al, 1
        add     ebx, edi
        mov     dword ptr [rsp - 4], eax        # 4-byte Spill
        movzx   esi, al
        add     esi, edi
        mov     r14d, -693879106
        xor     r10d, r10d
        mov     eax, r15d
        mov     edx, ebx
        jmp     .LBB0_18
.LBB0_62:                               #   in Loop: Header=BB0_1 Depth=1
        xor     ecx, ecx
        mov     r14d, r8d
        test    r11b, 1
        je      .LBB0_27
.LBB0_64:                               # %if.then338
        cmp     edi, esi
        jg      .LBB0_59
        xor     r10d, r10d
        mov     ebp, r15d
        test    r12b, 1
        jne     .LBB0_23
.LBB0_49:                               # %L94
        add     r14d, ebp
        mov     edx, 836078487
        mov     ebx, r14d
        test    r12b, 1
        je      .LBB0_8
        jmp     .LBB0_1
.LBB0_15:                               # %L42
        test    r9b, 1
        jne     .LBB0_16
        xor     r11d, r11d
        test    r13b, r13b
        je      .LBB0_45
        mov     rsi, rcx
        mov     eax, 1495809726
        mov     ebx, 693879105
        test    r11b, 1
        je      .LBB0_47
        jmp     .LBB0_35
.LBB0_16:                               #   in Loop: Header=BB0_1 Depth=1
        mov     r14d, 1495809726
        mov     esi, -693879106
        mov     edi, -1
        mov     ebx, 693879105
        xor     r11d, r11d
        test    r11b, 1
        jne     .LBB0_64
.LBB0_27:                               # %L58
        mov     eax, ecx
        and     al, 1
        mov     ebp, r15d
        movzx   r15d, al
        xor     r8d, r8d
        mov     eax, 0
        test    r12b, 1
        jne     .LBB0_28
.LBB0_67:                               # %L150
        test    r12b, 1
        jne     .LBB0_18
        mov     r12b, 1
        test    r10b, 1
        jne     .LBB0_55
        mov     r15d, eax
.LBB0_59:                               # %L146
        test    r8d, r8d
        setne   r10b
        test    r9b, 1
        jne     .LBB0_61
        mov     eax, esi
        mov     r14d, edi
.LBB0_18:                               # %L44
        mov     ebx, r14d
        xor     ebx, esi
        test    byte ptr [rsp - 4], 1           # 1-byte Folded Reload
        je      .LBB0_50
        mov     r15d, 1495809726
        and     r10b, 1
        jne     .LBB0_30
        mov     r8d, r14d
        test    eax, eax
        setne   cl
        test    byte ptr [rsp - 5], 1           # 1-byte Folded Reload
        je      .LBB0_58
.LBB0_70:                               # %if.then348
        mov     edi, r8d
        sub     edi, edx
        mov     eax, r8d
        jmp     .LBB0_13
.LBB0_28:                               # %L48
        test    r11b, 1
        je      .LBB0_73
        mov     r13d, r12d
        and     r13b, 1
        jmp     .LBB0_15
.LBB0_61:                               # %L74.thread
        mov     ebx, edi
        sub     ebx, esi
.LBB0_56:                               # %L106
        lea     r8d, [rbx + rdx]
        mov     eax, esi
        test    eax, eax
        setne   cl
        test    byte ptr [rsp - 5], 1           # 1-byte Folded Reload
        jne     .LBB0_70
.LBB0_58:                               #   in Loop: Header=BB0_1 Depth=1
        mov     r15d, eax
        mov     eax, r8d
        test    r9b, 1
        jne     .LBB0_12
        jmp     .LBB0_7
.LBB0_30:                               #   in Loop: Header=BB0_1 Depth=1
        xor     r10b, 1
        mov     r8d, eax
        mov     ecx, r10d
        mov     r10b, 1
        xor     ebx, ebx
        test    esi, esi
        jle     .LBB0_33
.LBB0_32:                               #   in Loop: Header=BB0_1 Depth=1
        mov     r9b, 1
        mov     byte ptr [rsp - 5], 1           # 1-byte Folded Spill
        mov     r13b, 1
        jmp     .LBB0_13
.LBB0_45:                               #   in Loop: Header=BB0_1 Depth=1
        mov     esi, -693879106
        mov     edi, -1
        mov     eax, ebp
        mov     r10b, 1
        xor     ebx, ebx
        test    esi, esi
        jg      .LBB0_32
.LBB0_33:                               #   in Loop: Header=BB0_1 Depth=1
        xor     esi, esi
        mov     r9b, 1
        mov     byte ptr [rsp - 5], 1           # 1-byte Folded Spill
        jmp     .LBB0_47
.LBB0_55:                               # %L74
        mov     ebx, edi
        sub     ebx, esi
        mov     r12b, 1
        test    r9b, 1
        je      .LBB0_10
        jmp     .LBB0_56
.LBB0_35:                               #   in Loop: Header=BB0_1 Depth=1
        mov     r13b, 1
        mov     rcx, rsi
        jmp     .LBB0_15
.LBB0_47:                               # %L86
        mov     ecx, eax
        shl     eax, 17
        add     eax, ecx
        test    r11b, 1
        je      .LBB0_74
        mov     ebp, r15d
        test    r11b, 1
        je      .LBB0_47
        jmp     .LBB0_35
.LBB0_50:                               # %L100
        xor     ebx, -693879106
        mov     eax, ebx
        jmp     .LBB0_75
.LBB0_73:                               # %L96
        mov     eax, r14d
        shl     eax, 17
        add     eax, r14d
.LBB0_74:                               # %cleanup
        xor     eax, ebx
.LBB0_75:                               # %cleanup
        pop     rbx
        pop     r12
        pop     r13
        pop     r14
        pop     r15
        pop     rbp
        ret
main:                                   # @main
        push    rbp
        push    r15
        push    r14
        push    r13
        push    r12
        push    rbx
        push    rax
        mov     edi, offset .Lstr
        call    puts@PLT
        mov     r14d, dword ptr [rip + tests]
        mov     ebp, dword ptr [rip + tests+4]
        mov     r15d, dword ptr [rip + tests+8]
        mov     edi, r14d
        mov     esi, ebp
        call    gcd(int, int)
        mov     ebx, eax
        mov     edi, offset .L.str.1
        mov     esi, 1
        mov     edx, r14d
        mov     ecx, ebp
        mov     r8d, eax
        xor     eax, eax
        call    printf
        cmp     ebx, r15d
        sete    byte ptr [rsp + 7]              # 1-byte Folded Spill
        mov     eax, offset .Lstr.8
        mov     edi, offset .Lstr.7
        cmove   rdi, rax
        mov     r14d, offset .Lstr.8
        call    puts@PLT
        mov     ebp, dword ptr [rip + tests+12]
        mov     r15d, dword ptr [rip + tests+16]
        mov     r12d, dword ptr [rip + tests+20]
        mov     edi, ebp
        mov     esi, r15d
        call    gcd(int, int)
        mov     ebx, eax
        mov     edi, offset .L.str.1
        mov     esi, 2
        mov     edx, ebp
        mov     ecx, r15d
        mov     r8d, eax
        xor     eax, eax
        call    printf
        cmp     ebx, r12d
        sete    r12b
        mov     edi, offset .Lstr.7
        cmove   rdi, r14
        mov     r14d, offset .Lstr.8
        call    puts@PLT
        mov     r15d, dword ptr [rip + tests+24]
        mov     ebp, dword ptr [rip + tests+28]
        mov     r13d, dword ptr [rip + tests+32]
        mov     edi, r15d
        mov     esi, ebp
        call    gcd(int, int)
        mov     ebx, eax
        mov     edi, offset .L.str.1
        mov     esi, 3
        mov     edx, r15d
        mov     ecx, ebp
        mov     r8d, eax
        xor     eax, eax
        call    printf
        cmp     ebx, r13d
        sete    r13b
        mov     edi, offset .Lstr.7
        cmove   rdi, r14
        call    puts@PLT
        mov     r15d, dword ptr [rip + tests+36]
        mov     ebp, dword ptr [rip + tests+40]
        mov     r14d, dword ptr [rip + tests+44]
        mov     edi, r15d
        mov     esi, ebp
        call    gcd(int, int)
        mov     ebx, eax
        mov     edi, offset .L.str.1
        mov     esi, 4
        mov     edx, r15d
        mov     ecx, ebp
        mov     r8d, eax
        xor     eax, eax
        call    printf
        cmp     ebx, r14d
        mov     edi, offset .Lstr.7
        mov     eax, offset .Lstr.8
        cmove   rdi, rax
        sete    al
        and     al, r13b
        and     r12b, byte ptr [rsp + 7]        # 1-byte Folded Reload
        and     r12b, al
        call    puts@PLT
        mov     eax, offset .L.str.5
        mov     esi, offset .L.str.6
        test    r12b, r12b
        cmovne  rsi, rax
        mov     edi, offset .L.str.4
        xor     eax, eax
        call    printf
        xor     r12b, 1
        movzx   eax, r12b
        add     rsp, 8
        pop     rbx
        pop     r12
        pop     r13
        pop     r14
        pop     r15
        pop     rbp
        ret
_GLOBAL__sub_I_example.cpp:             # @_GLOBAL__sub_I_example.cpp
        push    rax
        mov     edi, offset std::__ioinit
        call    std::ios_base::Init::Init() [complete object constructor]
        mov     edi, offset std::ios_base::Init::~Init() [complete object destructor]
        mov     esi, offset std::__ioinit
        mov     edx, offset __dso_handle
        pop     rax
        jmp     __cxa_atexit                    # TAILCALL
tests:
        .long   1                               # 0x1
        .long   2                               # 0x2
        .long   1                               # 0x1
        .long   3                               # 0x3
        .long   3                               # 0x3
        .long   3                               # 0x3
        .long   42                              # 0x2a
        .long   56                              # 0x38
        .long   14                              # 0xe
        .long   249084                          # 0x3ccfc
        .long   261183                          # 0x3fc3f
        .long   111                             # 0x6f

.L.str.1:
        .asciz  "  %d. gcd( %d, %d ) = %d, "

.L.str.4:
        .asciz  "Tests %s.\n"

.L.str.5:
        .asciz  "passed"

.L.str.6:
        .asciz  "failed"

.Lstr:
        .asciz  "Performing tests of gcd function:"

.Lstr.7:
        .asciz  "error."

.Lstr.8:
        .asciz  "OK."
 

sendersu

Постоянный
Мудрец
Сообщения
57
Реакции
405
Солодовников решил откусить кусочег пирога вмпрота... :)
 

Bronco

Посетитель
Мудрец
Сообщения
18
Реакции
316
пупс...прикольный сервис..)
не фантазии солода конечно, но на злобу дня, , типа таксовать то же можно:
https://github.com/shareef12/ExtractBB
".... Этот проект предоставляет два прохода LLVM, которые можно использовать для обфускации целевой программы путем изменения потока управления программой и графа вызовов. Поток управления для отдельных функций будет запутан путем преобразования переходов между базовыми блоками из традиционных инструкций ветвления в вызовы. Это приводит к тому, что логика потока управления функции становится межпроцедурной, что часто плохо обрабатывается традиционными инструментами обратного проектирования..."
Насколько понял из описания, запутывают логику перестановками
С**а, кроме ллвм, где ещё нарыть статик алго определения базовых блоков в асм коде?
 
Верх Низ