LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mhmt/mhmt-main.c
// Function: show_help
void show_help(void)
{
    printf("======== mhmt help ========\n");
    printf("parameters:\n");
    printf("-mlz, -hrm, -hst - use MegaLZ, hrum3.5 or hrust1.x format (default is MegaLZ)\n");
    printf("-g - greedy coding (default is optimal coding)\n");
    printf("-d - depacking instead of packing (default is packing)\n");
    printf("\n");
    printf("-zxh - use zx-specific header for hrum or hrust. DEFAULT is NO HEADER!\n");
    printf("       Not applicable for MegaLZ. If -zxh is specified, -16, NO -bend and\n");
    printf("       NO -mlz is forced.\n");
    printf("\n");
    printf("-8, -16 - bitstream is in bytes or words in packed file.\n");
    printf("          Default for MegaLZ is -8, for hrum and hrust is -16.\n");
    printf("\n");
    printf("-bend - if -16 specified, this makes words big-endian. Default is little-endian.\n");
    printf("\n");
    printf("-maxwinN - maximum lookback window. N is decimal number, which can only be\n");
    printf("           256,512,1024,2048,4096,8192,16384,32768. Default is format-specific\n");
    printf("           maximum window: MegaLZ is 4352, hrum is 4096, hrust is 65536.\n");
    printf("           For given format, window can't be greater than default value\n");
    printf("\n");
    printf("usage:\n");
    printf("mhmt [parameter list] <input filename> [<output filename>]\n");
    printf("\n");
    printf("if no output filename given, filename is appended with \".mlz\", \".hrm\" or \".hst\"\n");
    printf("in accordance with format chosen; for depacking \".dpk\" is appended\n");
    printf("====== mhmt help end ======\n");
    printf("\n");
}

// Assembly:
pushq %rax
leaq 0x3934(%rip), %rdi      # 0x67e3
callq 0x1120
leaq 0x3944(%rip), %rdi      # 0x67ff
callq 0x1120
leaq 0x3944(%rip), %rdi      # 0x680b
callq 0x1120
leaq 0x3986(%rip), %rdi      # 0x6859
callq 0x1120
leaq 0x39a9(%rip), %rdi      # 0x6888
callq 0x1120
movl $0xa, %edi
callq 0x10f0
leaq 0x39ca(%rip), %rdi      # 0x68bf
callq 0x1120
leaq 0x3a05(%rip), %rdi      # 0x6906
callq 0x1120
leaq 0x3a43(%rip), %rdi      # 0x6950
callq 0x1120
movl $0xa, %edi
callq 0x10f0
leaq 0x3a47(%rip), %rdi      # 0x696a
callq 0x1120
leaq 0x3a74(%rip), %rdi      # 0x69a3
callq 0x1120
movl $0xa, %edi
callq 0x10f0
leaq 0x3a9d(%rip), %rdi      # 0x69e2
callq 0x1120
movl $0xa, %edi
callq 0x10f0
leaq 0x3ad8(%rip), %rdi      # 0x6a33
callq 0x1120
leaq 0x3b17(%rip), %rdi      # 0x6a7e
callq 0x1120
leaq 0x3b5a(%rip), %rdi      # 0x6acd
callq 0x1120
leaq 0x3b97(%rip), %rdi      # 0x6b16
callq 0x1120
movl $0xa, %edi
callq 0x10f0
leaq 0x3bc9(%rip), %rdi      # 0x6b5e
callq 0x1120
leaq 0x3bc4(%rip), %rdi      # 0x6b65
callq 0x1120
movl $0xa, %edi
callq 0x10f0
leaq 0x3be9(%rip), %rdi      # 0x6ba0
callq 0x1120
leaq 0x3c2d(%rip), %rdi      # 0x6bf0
callq 0x1120
leaq 0x3c64(%rip), %rdi      # 0x6c33
callq 0x1120
movl $0xa, %edi
popq %rax
jmp 0x10f0
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mhmt/mhmt-optimal.c
// Function: make_optch
struct optchain * make_optch(ULONG actual_len)
{
    struct optchain * optch;
    ULONG i;
    // we allocate length+1 because all codes at the end of input stream will point
    // to the length+1 place. Also we'll start reversing from length+1 position in optch array
    optch = (struct optchain *)malloc( (actual_len+1)*sizeof(struct optchain) );

    if( optch ) {
        optch[0].code.length = 1; // 1st byte is always copied 'as-is', however, this is just filler,
        optch[0].code.disp   = 0; // not accounted elsewhere
        // init prices to absolute maximum for optimal chain build-up
        optch[0].price = 0;
        optch[1].price = 8;

        for(i=2; i<(actual_len+1); i++)
            optch[i].price = 0xFFFFFFFF;
    }

    return optch;
}

// Assembly:
pushq %rbx
movl %edi, %ebx
incl %ebx
movq %rbx, %rdi
shlq $0x4, %rdi
callq 0x10e0
testq %rax, %rax
je 0x34f9
movq $0x1, (%rax)
movl $0x0, 0x8(%rax)
movl $0x8, 0x18(%rax)
cmpl $0x3, %ebx
jb 0x34f9
leaq 0x1(%rbx), %rcx
andq $-0x4, %rcx
addq $-0x3, %rbx
movq %rbx, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
movq %rax, %rdx
addq $0x58, %rdx
xorl %esi, %esi
movdqa 0x398d(%rip), %xmm1     # 0x6db0
movdqa 0x3995(%rip), %xmm2     # 0x6dc0
movdqa 0x399d(%rip), %xmm3     # 0x6dd0
pxor %xmm3, %xmm0
pcmpeqd %xmm4, %xmm4
movq %rsi, %xmm5
pshufd $0x44, %xmm5, %xmm5     # xmm5 = xmm5[0,1,0,1]
movdqa %xmm5, %xmm6
por %xmm2, %xmm6
pxor %xmm3, %xmm6
movdqa %xmm6, %xmm7
pcmpgtd %xmm0, %xmm7
pcmpeqd %xmm0, %xmm6
pshufd $0xf5, %xmm6, %xmm8     # xmm8 = xmm6[1,1,3,3]
pand %xmm7, %xmm8
pshufd $0xf5, %xmm7, %xmm6     # xmm6 = xmm7[1,1,3,3]
por %xmm8, %xmm6
movd %xmm6, %edi
notl %edi
testb $0x1, %dil
je 0x3485
movl $0xffffffff, -0x30(%rdx) # imm = 0xFFFFFFFF
pxor %xmm4, %xmm6
pextrw $0x4, %xmm6, %edi
testb $0x1, %dil
je 0x349b
movl $0xffffffff, -0x20(%rdx) # imm = 0xFFFFFFFF
por %xmm1, %xmm5
pxor %xmm3, %xmm5
movdqa %xmm5, %xmm6
pcmpgtd %xmm0, %xmm6
pcmpeqd %xmm0, %xmm5
pshufd $0xf5, %xmm5, %xmm7     # xmm7 = xmm5[1,1,3,3]
pand %xmm6, %xmm7
pshufd $0xf5, %xmm6, %xmm5     # xmm5 = xmm6[1,1,3,3]
por %xmm7, %xmm5
pxor %xmm4, %xmm5
pextrw $0x0, %xmm5, %edi
testb $0x1, %dil
je 0x34d7
movl $0xffffffff, -0x10(%rdx) # imm = 0xFFFFFFFF
pextrw $0x4, %xmm5, %edi
testb $0x1, %dil
je 0x34e8
movl $0xffffffff, (%rdx)     # imm = 0xFFFFFFFF
addq $0x4, %rsi
addq $0x40, %rdx
cmpq %rsi, %rcx
jne 0x343b
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mhmt/mhmt-optimal.c
// Function: update_optch
void update_optch(ULONG position, struct lzcode * codes, ULONG (*get_lz_price)(ULONG position, struct lzcode * lzcode), struct optchain * optch)
{
    ULONG codepos;
    ULONG bitlen;
    ULONG newpos;
    LONG len;

    for( codepos = 0; len=codes[codepos].length; codepos++ ) { // loop through all existing lz codes
        bitlen = (*get_lz_price)(position, &codes[codepos]); // get bit length of given lz code

        if( !bitlen ) {
            printf("mhmt-optimal.c: update_optch() found zero bitlength of lz code. Fatal error.\n");
            exit(1);

        } else {
            if( len<0 ) len=(-len); // deal with negative lengths (special markers)

            newpos = position + len; // look where current lz code points to and take from there old price reaching that location

            if( optch[newpos].price > bitlen + optch[position].price ) { // if oldprice is worse than with current lz code
                optch[newpos].price = bitlen + optch[position].price;
                optch[newpos].code  = codes[codepos];
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, 0x10(%rsp)
movq %rsi, 0x8(%rsp)
movl (%rsi), %r15d
testl %r15d, %r15d
je 0x358e
movq %rcx, %rbx
movl %edi, %ebp
movl %edi, %eax
shlq $0x4, %rax
leaq (%rcx,%rax), %r13
addq $0x8, %r13
movl $0x1, %r14d
movq 0x8(%rsp), %r12
movl %ebp, %edi
movq %r12, %rsi
callq *0x10(%rsp)
testl %eax, %eax
je 0x359d
movl %r15d, %ecx
negl %ecx
cmovsl %r15d, %ecx
addl %ebp, %ecx
shlq $0x4, %rcx
addl (%r13), %eax
cmpl %eax, 0x8(%rbx,%rcx)
jbe 0x3576
addq %rbx, %rcx
movl %eax, 0x8(%rcx)
movq (%r12), %rax
movq %rax, (%rcx)
movl %r14d, %eax
movq 0x8(%rsp), %rcx
leaq (%rcx,%rax,8), %r12
movl (%r12), %r15d
incl %r14d
testl %r15d, %r15d
jne 0x3543
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x383c(%rip), %rdi      # 0x6de0
callq 0x1120
movl $0x1, %edi
callq 0x10d0
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mhmt/mhmt-optimal.c
// Function: reverse_optch
void reverse_optch(struct optchain * optch, ULONG actual_len)
{
    struct lzcode curr, temp;
    ULONG position;
    LONG len;
    position = actual_len;
    temp = optch[position].code;

    while(position>1) {
        len = temp.length;

        if( len<0 ) len=(-len);

        position -= len;
        curr = temp;
        temp = optch[position].code;
        optch[position].code = curr;
    }
}

// Assembly:
cmpl $0x2, %esi
jb 0x35ea
movl %esi, %eax
shlq $0x4, %rax
movq (%rdi,%rax), %xmm0
movd %xmm0, %eax
movl %eax, %ecx
negl %ecx
cmovnsl %eax, %ecx
addl %ecx, %esi
movq %rsi, %rax
shlq $0x4, %rax
movq (%rdi,%rax), %xmm1
movq %xmm0, (%rdi,%rax)
movdqa %xmm1, %xmm0
cmpl $0x1, %esi
ja 0x35c3
retq
nop
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mhmt/mhmt-parsearg.c
// Function: cmp_str_nocase
LONG cmp_str_nocase(char * left, char * right)
{
    LONG order=0;
    UBYTE leftchar,rightchar;
    UBYTE leftadd,rightadd;

    do {
        leftchar  = (UBYTE)*left;
        rightchar = (UBYTE)*right;
        leftadd  = 0;
        rightadd = 0;
        left++;
        right++;

        if( leftchar  >= (UBYTE)'a' ) leftadd  = (UBYTE)('A'-'a');

        if( rightchar >= (UBYTE)'a' ) rightadd = (UBYTE)('A'-'a');

        if( leftchar  > (UBYTE)'z' ) leftadd  = 0;

        if( rightchar > (UBYTE)'z' ) rightadd = 0;

        leftchar  += leftadd;
        rightchar += rightadd;

        if( leftchar<rightchar ) order = (-1);

        if( leftchar>rightchar ) order = (+1);
    } while( (!order) && leftchar && rightchar );

    return order;
}

// Assembly:
pushq %rbx
xorl %ecx, %ecx
movl $0x1, %edx
xorl %r8d, %r8d
movb (%rdi,%r8), %al
movb (%rsi,%r8), %r9b
cmpb $0x61, %al
setb %r10b
shlb $0x5, %r10b
addb $-0x20, %r10b
cmpb $0x61, %r9b
setb %r11b
shlb $0x5, %r11b
addb $-0x20, %r11b
cmpb $0x7b, %al
movzbl %r10b, %r10d
cmovael %ecx, %r10d
cmpb $0x7b, %r9b
movzbl %r11b, %r11d
cmovael %ecx, %r11d
addb %al, %r10b
leal (%r11,%r9), %ebx
cmpb %bl, %r10b
movl $0x0, %eax
sbbl %eax, %eax
cmpb %bl, %r10b
cmoval %edx, %eax
addb %r9b, %r11b
je 0x3d56
testb %r10b, %r10b
je 0x3d56
incq %r8
testl %eax, %eax
je 0x3cf2
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mhmt/mhmt-parsearg.c
// Function: match_arg
struct argtbl * match_arg(char * argument)
{
    struct argtbl * test_arg = default_arg_table;

    while( test_arg->name && cmp_str_nocase(test_arg->name,argument) )
        test_arg++;

    return (test_arg->name)?test_arg:NULL;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movq 0x634a(%rip), %rdi      # 0xa0b0
testq %rdi, %rdi
je 0x3d8b
leaq 0x633e(%rip), %rbx      # 0xa0b0
movq %r14, %rsi
callq 0x3ce7
testl %eax, %eax
je 0x3d8d
movq 0x10(%rbx), %rdi
addq $0x10, %rbx
testq %rdi, %rdi
jne 0x3d72
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mhmt/mhmt-parsearg.c
// Function: sort_args
void sort_args( struct argtbl * args, ULONG argsize )
{
    struct argtbl temp;
    LONG i,j;

    // simple bubble sort since there are not too many arguments
    for( i=(argsize-2); i>=0; i-- ) {
        for( j=0; j<=i; j++ ) {
            if( args[j].type > args[j+1].type ) {
                temp      = args[j];
                args[j]   = args[j+1];
                args[j+1] = temp;
            }
        }
    }
}

// Assembly:
movl %esi, %eax
addl $-0x2, %eax
js 0x3de3
decl %esi
movq %rdi, %rdx
xorl %ecx, %ecx
movl 0x8(%rdx), %r9d
leaq 0x10(%rdx), %r8
cmpl 0x18(%rdx), %r9d
jbe 0x3dcc
movups (%rdx), %xmm0
movaps %xmm0, -0x18(%rsp)
movups (%r8), %xmm0
movups %xmm0, (%rdx)
movaps -0x18(%rsp), %xmm0
movups %xmm0, (%r8)
incq %rcx
movq %r8, %rdx
cmpq %rcx, %rsi
jne 0x3da6
leal -0x1(%rax), %ecx
decq %rsi
testl %eax, %eax
movl %ecx, %eax
jg 0x3da1
retq
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mhmt/mhmt-tb.c
// Function: free_tb
void free_tb(void)
{
    // free all allocated bunches
    struct tb_bunch * tbtmp;

    while( tb_bunches ) {
        tbtmp=tb_bunches;
        tb_bunches=tb_bunches->next;
        free( tbtmp );
    }
}

// Assembly:
movq 0xedc6(%rip), %rdi      # 0x12c18
testq %rdi, %rdi
je 0x3e77
pushq %rax
movq (%rdi), %rax
movq %rax, 0xedb6(%rip)      # 0x12c18
callq 0x10c0
movq 0xedaa(%rip), %rdi      # 0x12c18
testq %rdi, %rdi
jne 0x3e58
addq $0x8, %rsp
retq
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mhmt/mhmt-tb.c
// Function: add_tb
ULONG add_tb(UWORD index, ULONG position)
{
    struct tb_chain * newtb;
    newtb=get_free_tb();

    if( !newtb ) {
        // no free elements
        if( position > wrk.maxwin ) { // if there could be enough tbs to try to flush
            // try to flush current chain
            cutoff_tb_chain(index,position);
        }

        newtb=get_free_tb();

        if( !newtb ) {
            // nothing free - allocate new bunch
            if( !add_bunch_of_tb() ) {
                return 0;
            }

            newtb=get_free_tb(); // here is no chance to fail!... hopefully...
        }
    }

    newtb->pos=position-1; // points to the first byte of given two bytes
    newtb->next=tb_entry[index];
    tb_entry[index]=newtb;
    return 1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq 0xed8b(%rip), %rax      # 0x12c10
movzwl %di, %r14d
testq %rax, %rax
jne 0x3ec0
leaq 0x748b(%rip), %rax      # 0xb320
cmpl %ebx, 0x1c(%rax)
jae 0x3eb0
movl %r14d, %edi
movl %ebx, %esi
callq 0x3f0b
movq 0xed65(%rip), %rax      # 0x12c10
testq %rax, %rax
jne 0x3ec0
callq 0x3f90
testl %eax, %eax
je 0x3eef
movq 0xed50(%rip), %rax      # 0x12c10
movq 0x8(%rax), %rcx
movq %rcx, 0xed45(%rip)      # 0x12c10
decl %ebx
movl %ebx, (%rax)
leaq 0xed4a(%rip), %rcx      # 0x12c20
movq (%rcx,%r14,8), %rdx
movq %rdx, 0x8(%rax)
movq %rax, (%rcx,%r14,8)
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
xorl %eax, %eax
jmp 0x3ee7
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mhmt/mhmt-tb.c
// Function: add_bunch_of_tb
ULONG add_bunch_of_tb(void)
{
    ULONG i;
    struct tb_bunch * newbunch;
    // alloc new bunch
    newbunch=(struct tb_bunch *)malloc( sizeof(struct tb_bunch) );

    if( !newbunch ) return 0;

    // link every twobyter into one list
    for(i=0; i<(BUNCHSIZE-1); i++) {
        newbunch->bunch[i].next=&(newbunch->bunch[i+1]);
    }

    // add this list to the free list
    newbunch->bunch[BUNCHSIZE-1].next=tb_free;
    tb_free=&(newbunch->bunch[0]);
    // add bunch to bunches list
    newbunch->next=tb_bunches;
    tb_bunches=newbunch;
    return 1;
}

// Assembly:
pushq %rax
movl $0x10008, %edi          # imm = 0x10008
callq 0x10e0
testq %rax, %rax
je 0x407a
movq %rax, %rcx
addq $0x8, %rcx
movdqa 0x2e0d(%rip), %xmm0     # 0x6dc0
movl $0x20, %edx
movdqa 0x2e10(%rip), %xmm1     # 0x6dd0
movdqa 0x33a8(%rip), %xmm2     # 0x7370
pshufd $0xf5, %xmm2, %xmm3     # xmm3 = xmm2[1,1,3,3]
pcmpeqd %xmm4, %xmm4
movdqa 0x33a7(%rip), %xmm5     # 0x7380
movdqa %xmm0, %xmm6
pxor %xmm1, %xmm6
movdqa %xmm2, %xmm8
pcmpgtd %xmm6, %xmm8
pshufd $0xf5, %xmm6, %xmm7     # xmm7 = xmm6[1,1,3,3]
pcmpeqd %xmm3, %xmm7
pand %xmm8, %xmm7
movdqa %xmm0, %xmm6
psubq %xmm4, %xmm6
movd %xmm7, %esi
testb $0x1, %sil
je 0x401c
movq %xmm6, %rsi
shlq $0x4, %rsi
addq %rcx, %rsi
movq %rsi, -0x10(%rax,%rdx)
pextrw $0x4, %xmm7, %esi
testb $0x1, %sil
je 0x403c
pshufd $0xee, %xmm6, %xmm6     # xmm6 = xmm6[2,3,2,3]
movq %xmm6, %rsi
shlq $0x4, %rsi
addq %rcx, %rsi
movq %rsi, (%rax,%rdx)
paddq %xmm5, %xmm0
addq $0x20, %rdx
cmpq $0x10020, %rdx          # imm = 0x10020
jne 0x3fd9
movq 0xebbc(%rip), %rdx      # 0x12c10
movq %rdx, 0x10000(%rax)
movq %rcx, 0xebae(%rip)      # 0x12c10
movq 0xebaf(%rip), %rcx      # 0x12c18
movq %rcx, (%rax)
movq %rax, 0xeba5(%rip)      # 0x12c18
movl $0x1, %eax
jmp 0x407c
xorl %eax, %eax
popq %rcx
retq
nop
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mhmt/mhmt-depack.c
// Function: depack
ULONG depack(void)
{
    ULONG (*checker) (void) = NULL;
    ULONG (*depacker)(void) = NULL;
    ULONG success=1;

    // some preparations
    //
    if( wrk.packtype==PK_MLZ ) {
        checker  = &checker_megalz;
        depacker = &depacker_megalz;

    } else if( wrk.packtype==PK_HRM ) {
        checker  = &checker_hrum;
        depacker = &depacker_hrum;

    } else if( wrk.packtype==PK_HST ) {
//		checker  = &checker_hrust;
        depacker = &depacker_hrust;

    } else {
        printf("mhmt-depack.c:depack() - format unsupported!\n");
        return 0;
    }

    // allocate buffer used for depacking
    //
    buf_size = ( wrk.maxwin==4352 ) ? 8192 : wrk.maxwin; // provided there are no other non-2^n sizes
    buffer=(UBYTE*)malloc(buf_size);

    if( !buffer ) {
        printf("mhmt-depack.c:depack() cannot allocate memory for depack buffer!\n");
        return 0;
    }

    buf_ptr=0;
    success = success && emit_file(NULL,EMIT_FILE_INIT);
//	success = success && (*checker) ();
//#ifdef DBG
//	printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
//#endif
    success = success && (*depacker)();
    /*success = success && */depack_outbyte( 0, DEPACK_OUTBYTE_FLUSH );
    /*success = success && */emit_file(NULL,EMIT_FILE_FINISH);

    if( buffer )
        free(buffer);

    return success;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
leaq 0x7295(%rip), %rax      # 0xb320
movl (%rax), %ecx
decl %ecx
cmpl $0x3, %ecx
jae 0x4124
movl %ecx, %ecx
leaq 0x5d07(%rip), %rdx      # 0x9da8
movq (%rdx,%rcx,8), %r14
movl 0x1c(%rax), %eax
cmpl $0x1100, %eax           # imm = 0x1100
movl $0x2000, %edi           # imm = 0x2000
cmovnel %eax, %edi
movl %edi, 0x8eb65(%rip)     # 0x92c20
callq 0x10e0
movq %rax, 0x8eb61(%rip)     # 0x92c28
testq %rax, %rax
je 0x412d
movl $0x0, 0x8eb4e(%rip)     # 0x92c24
xorl %ebx, %ebx
xorl %edi, %edi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15f2
testl %eax, %eax
je 0x40f2
callq *%r14
xorl %ebx, %ebx
testl %eax, %eax
setne %bl
movl 0x8eb2c(%rip), %esi     # 0x92c24
testl %esi, %esi
je 0x4108
movq 0x8eb25(%rip), %rdi     # 0x92c28
callq 0x15f2
xorl %edi, %edi
xorl %esi, %esi
callq 0x15f2
movq 0x8eb10(%rip), %rdi     # 0x92c28
testq %rdi, %rdi
je 0x413b
callq 0x10c0
jmp 0x413b
leaq 0x33d8(%rip), %rdi      # 0x7503
jmp 0x4134
leaq 0x33fc(%rip), %rdi      # 0x7530
callq 0x1120
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mhmt/mhmt-depack.c
// Function: depack_outbyte
ULONG depack_outbyte(UBYTE byte, ULONG operation)
{
    if( operation==DEPACK_OUTBYTE_ADD ) {
        buffer[buf_ptr++] = byte;

        if( buf_ptr>0x51d ) {
//			printf("����\n");
        }

        if( buf_ptr >= buf_size ) {
            buf_ptr=0;
            return emit_file( buffer, buf_size );
        }

        return 1;

    } else if( operation==DEPACK_OUTBYTE_FLUSH ) {
        if( buf_ptr ) return emit_file( buffer, buf_ptr );

        return 1;

    } else {
        printf("mhmt-depack.c:depack_outbyte() - bad operation requested\n");
        return 0;
    }
}

// Assembly:
cmpl $0x1, %esi
je 0x531a
cmpl $0x2, %esi
jne 0x5330
movq 0x8d940(%rip), %rax     # 0x92c28
movl 0x8d936(%rip), %ecx     # 0x92c24
leal 0x1(%rcx), %edx
movl %edx, 0x8d92d(%rip)     # 0x92c24
movb %dil, (%rax,%rcx)
movl 0x8d91f(%rip), %esi     # 0x92c20
movl $0x1, %eax
cmpl %esi, 0x8d918(%rip)     # 0x92c24
jb 0x5343
movl $0x0, 0x8d90c(%rip)     # 0x92c24
jmp 0x5324
movl 0x8d904(%rip), %esi     # 0x92c24
testl %esi, %esi
je 0x5344
movq 0x8d8fd(%rip), %rdi     # 0x92c28
jmp 0x15f2
pushq %rax
leaq 0x246b(%rip), %rdi      # 0x77a3
callq 0x1120
xorl %eax, %eax
addq $0x8, %rsp
retq
movl $0x1, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mhmt/mhmt-depack.c
// Function: depack_repeat
ULONG depack_repeat(LONG disp, ULONG length)
{
    ULONG back_ptr;
    ULONG success=1;

//#ifdef DBG
//	printf("\n");
//#endif
    // in a self-consistent system, these three errors should never appear, since there is input stream check before actual depacking
    if( !length ) {
        printf("mhmt-depack.c:depack_repeat() - zero length!\n");
        return 0;

    } else if( disp>=0 ) {
        printf("mhmt-depack.c:depack_repeat() - non-negative displacement!\n");
        return 0;

    } else if( (ULONG)(-disp)>buf_size ) {
        printf("mhmt-depack.c:depack_repeat() - displacement greater than buffer size!\n");
        return 0;

    } else {
        back_ptr = (disp+buf_ptr) & (buf_size-1); // buf_size MUST BE 2^N!

        do {
            success = success && depack_outbyte( buffer[back_ptr], DEPACK_OUTBYTE_ADD ); // also increases buf_ptr
            back_ptr = (back_ptr+1) & (buf_size-1); // buf_size MUST BE 2^N!
        } while( --length );
    }

    return success;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
testl %esi, %esi
je 0x54d6
testl %edi, %edi
js 0x54df
leaq 0x242b(%rip), %rdi      # 0x78ff
jmp 0x54f4
leaq 0x23ae(%rip), %rdi      # 0x788b
jmp 0x54f4
movl %edi, %eax
negl %eax
movl 0x8d737(%rip), %ecx     # 0x92c20
cmpl %eax, %ecx
jae 0x5502
leaq 0x23c4(%rip), %rdi      # 0x78b8
callq 0x1120
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movl %esi, %ebx
addl 0x8d71a(%rip), %edi     # 0x92c24
leal -0x1(%rcx), %ebp
andl %edi, %ebp
movl $0x1, %eax
testl %eax, %eax
je 0x5540
movq 0x8d709(%rip), %rax     # 0x92c28
movl %ebp, %ecx
movzbl (%rax,%rcx), %edi
movl $0x2, %esi
callq 0x52d7
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
setne %al
movl 0x8d6e2(%rip), %ecx     # 0x92c20
jmp 0x5542
xorl %eax, %eax
incl %ebp
leal -0x1(%rcx), %edx
andl %edx, %ebp
decl %ebx
jne 0x5514
jmp 0x54fb
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mhmt/mhmt-depack.c
// Function: depack_getbits_word
ULONG depack_getbits_word(void)
{
    ULONG bits,bits2;

    if( wrk.wordbit ) { // 16bits
        if( wrk.bigend ) {
            bits  = depack_getbyte(DEPACK_GETBYTE_NEXT);

            if( bits  == 0xFFFFFFFF ) return 0xFFFFFFFF;

            bits2 = depack_getbyte(DEPACK_GETBYTE_NEXT);

            if( bits2 == 0xFFFFFFFF ) return 0xFFFFFFFF;

        } else {
            bits2 = depack_getbyte(DEPACK_GETBYTE_NEXT);

            if( bits2 == 0xFFFFFFFF ) return 0xFFFFFFFF;

            bits  = depack_getbyte(DEPACK_GETBYTE_NEXT);

            if( bits  == 0xFFFFFFFF ) return 0xFFFFFFFF;
        }

        bits = (bits<<24) | ( 0x00FF0000&(bits2<<16) );

    } else { // 8bits
        bits=depack_getbyte(DEPACK_GETBYTE_NEXT);

        if( bits!=0xFFFFFFFF)
            bits <<= 24;
    }

    return bits;
}

// Assembly:
leaq 0x5dca(%rip), %rdx      # 0xb320
cmpl $0x0, 0x10(%rdx)
je 0x559a
cmpl $0x0, 0x14(%rdx)
movl 0x8d6ca(%rip), %ecx     # 0x92c30
movl 0x48(%rdx), %esi
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
je 0x55bf
cmpl %esi, %ecx
jae 0x55be
movq 0x40(%rdx), %rdx
movq %rcx, %rdi
incq %rdi
movl %edi, 0x8d6ac(%rip)     # 0x92c30
cmpl %esi, %edi
jae 0x55be
movb (%rdx,%rcx), %sil
leal 0x2(%rcx), %eax
movl %eax, 0x8d69b(%rip)     # 0x92c30
movb (%rdx,%rdi), %al
jmp 0x55e5
movl 0x8d690(%rip), %ecx     # 0x92c30
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl 0x48(%rdx), %ecx
jae 0x55be
movq 0x40(%rdx), %rax
leal 0x1(%rcx), %edx
movl %edx, 0x8d679(%rip)     # 0x92c30
movzbl (%rax,%rcx), %eax
shll $0x18, %eax
retq
cmpl %esi, %ecx
jae 0x55be
movq 0x40(%rdx), %rdx
leal 0x1(%rcx), %edi
movl %edi, 0x8d660(%rip)     # 0x92c30
cmpl %esi, %edi
jae 0x55be
movb (%rdx,%rcx), %al
leal 0x2(%rcx), %esi
movl %esi, 0x8d650(%rip)     # 0x92c30
movb 0x1(%rdx,%rcx), %sil
movzbl %al, %eax
movzbl %sil, %ecx
shll $0x18, %ecx
shll $0x10, %eax
orl %ecx, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/evanwire[P]GitClone/client.c
// Function: configure
void configure(char* host, char* port){
  int configure_fd = open(".configure", O_WRONLY | O_TRUNC | O_CREAT, 0777);

  if(configure_fd < 0){
    printf("\nError: Was unable to open/create the .configure file. Please try again.\n");
    exit(1);
  }
  int initial_size = strlen(host) + strlen(port) + 1;
  char to_be_written[initial_size];
  memset(to_be_written, 0, sizeof to_be_written);
  strcat(to_be_written, host);
  strcat(to_be_written, " ");
  strcat(to_be_written, port);
  int write_size = write(configure_fd, to_be_written, initial_size);
  if(write_size < 0){
    printf("\nError: Was unable to write to the .configure file. Please try again.\n");
    exit(1);
  }

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r15
leaq 0x3ac3(%rip), %rdi      # 0x5381
movl $0x241, %esi            # imm = 0x241
movl $0x1ff, %edx            # imm = 0x1FF
xorl %eax, %eax
callq 0x10f0
testl %eax, %eax
js 0x1958
movl %eax, %r14d
movq %r15, %rdi
callq 0x10a0
movq %rax, %r12
movq %rbx, %rdi
callq 0x10a0
addl %eax, %r12d
incl %r12d
leaq 0xf(%r12), %rax
andq $-0x10, %rax
movq %rsp, %r13
subq %rax, %r13
movq %r13, %rsp
movq %r13, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x10c0
movq %r13, %rdi
movq %r15, %rsi
callq 0x1230
movq %r13, %rdi
callq 0x10a0
movw $0x20, (%rax,%r13)
movq %r13, %rdi
movq %rbx, %rsi
callq 0x1230
movslq %r12d, %rdx
movl %r14d, %edi
movq %r13, %rsi
callq 0x1080
testl %eax, %eax
js 0x1961
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3e77(%rip), %rdi      # 0x57d6
jmp 0x1968
leaq 0x3e28(%rip), %rdi      # 0x5790
callq 0x11e0
movl $0x1, %edi
callq 0x1180
// File: /workspace/github_c_makefile_star2_O3/evanwire[P]GitClone/client.c
// Function: destroy
void destroy(char* projectName){
  //Prepare message to server
  int i;
  char to_be_written[strlen(projectName) + 3];
  memset(to_be_written, 0, sizeof(to_be_written));
  to_be_written[0] = 'd';
  to_be_written[1] = ' ';
  int message_idx = 2;
  for(i = 0; i < strlen(projectName); i++){
    if(projectName[i]){
      to_be_written[message_idx] = projectName[i];
      message_idx++;
    }
  }
  printf("\nWritten to server: -%s- Size: %d passed in: -%s-\n", to_be_written, sizeof(to_be_written), projectName);

  //Connect to server, store the response
  char* response = connect_to_WTFserver(to_be_written);

  //Report if server responded with an error
  /*
    TODO: Make a method for receiving and alerting user of errors
      -Basically, if the server response begins with a certain character or some indicator of an error, it will send the server response to that method which will print
        the error message out to the user, without including the indicator we decide to use.
  */
  if(strcmp(response, "x") == 0){
    printf("\nError: The project %s does not exist on the server.\n", projectName);
    exit(1);
  }else if(strcmp(response, "e") == 0){
    printf("\nError: The server ran into an error processing your request. Please try again.\n");
    exit(1);
  }else{
    printf("\n%s\n", response);
  }
  return;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x10a0
movq %rax, %r12
leaq 0x3(%rax), %rdx
movq %rsp, %r13
leaq 0x12(%rax), %r14
andq $-0x10, %r14
movq %r13, %r15
subq %r14, %r15
movq %r15, %rsp
negq %r14
movq %r15, %rdi
xorl %esi, %esi
movq %rdx, -0x30(%rbp)
callq 0x10c0
movw $0x2064, (%r13,%r14)    # imm = 0x2064
testq %r12, %r12
je 0x3cd8
movl $0x2, %eax
xorl %ecx, %ecx
movb (%rbx,%rcx), %dl
testb %dl, %dl
je 0x3cd0
cltq
movb %dl, (%r15,%rax)
incl %eax
incq %rcx
cmpq %rcx, %r12
jne 0x3cc1
leaq 0x16ad(%rip), %rdi      # 0x538c
movq %r15, %rsi
movq -0x30(%rbp), %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1040
movq %r15, %rdi
callq 0x41ca
movzbl (%rax), %ecx
cmpl $0x65, %ecx
je 0x3d1e
cmpl $0x78, %ecx
jne 0x3d24
cmpb $0x0, 0x1(%rax)
jne 0x3d24
leaq 0x16c4(%rip), %rdi      # 0x53d6
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1040
jmp 0x3d50
cmpb $0x0, 0x1(%rax)
je 0x3d44
leaq 0x16a6(%rip), %rdi      # 0x53d1
movq %rax, %rsi
xorl %eax, %eax
callq 0x1040
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2307(%rip), %rdi      # 0x6052
callq 0x11e0
movl $0x1, %edi
callq 0x1180
// File: /workspace/github_c_makefile_star2_O3/evanwire[P]GitClone/client.c
// Function: currentVersion
void currentVersion(char* projectName){
  //Prepare message to server
  int i;
  char to_be_written[strlen(projectName) + 3];
  memset(to_be_written, 0, sizeof(to_be_written));
  to_be_written[0] = 'v';
  to_be_written[1] = ' ';
  int message_idx = 2;
  for(i = 0; i < strlen(projectName); i++){
    if(projectName[i]){
      to_be_written[message_idx] = projectName[i];
      message_idx++;
    }
  }
  printf("\nWritten to server: -%s- Size: %d passed in: -%s-\n", to_be_written, sizeof(to_be_written), projectName);

  //Connect to server, store the response
  char* response = connect_to_WTFserver(to_be_written);

  //Report if server responded with an error
  /*
    TODO: Make a method for receiving and alerting user of errors
      -Basically, if the server response begins with a certain character or some indicator of an error, it will send the server response to that method which will print
        the error message out to the user, without including the indicator we decide to use.
  */
  if(strcmp(response, "x") == 0){
    printf("\nError: The specified project does not exist on the server. Please check the project name and try again.\n");
    exit(1);
  }else if(strcmp(response, "e") == 0){
    printf("\nError: The server ran into an error processing your request. Please try again.\n");
    exit(1);
  }

  printf("Here is the current version of the project and its contained files:\n");
  printf("%s\n",response);
  free(response);

  return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x10a0
movq %rax, %r12
leaq 0x3(%rax), %rdx
movq %rsp, %r13
leaq 0x12(%rax), %r14
andq $-0x10, %r14
movq %r13, %r15
subq %r14, %r15
movq %r15, %rsp
negq %r14
movq %r15, %rdi
xorl %esi, %esi
movq %rdx, -0x30(%rbp)
callq 0x10c0
movw $0x2076, (%r13,%r14)    # imm = 0x2076
testq %r12, %r12
je 0x4144
movl $0x2, %eax
xorl %ecx, %ecx
movb (%rbx,%rcx), %dl
testb %dl, %dl
je 0x413c
cltq
movb %dl, (%r15,%rax)
incl %eax
incq %rcx
cmpq %rcx, %r12
jne 0x412d
leaq 0x1241(%rip), %rdi      # 0x538c
movq %r15, %rsi
movq -0x30(%rbp), %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1040
movq %r15, %rdi
callq 0x41ca
movq %rax, %rbx
movzbl (%rax), %eax
cmpl $0x65, %eax
je 0x4183
cmpl $0x78, %eax
jne 0x4189
cmpb $0x0, 0x1(%rbx)
jne 0x4189
leaq 0x1f21(%rip), %rdi      # 0x60a2
jmp 0x41bb
cmpb $0x0, 0x1(%rbx)
je 0x41b4
leaq 0x1e7e(%rip), %rdi      # 0x600e
callq 0x11e0
movq %rbx, %rdi
callq 0x11e0
movq %rbx, %rdi
callq 0x1170
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1e97(%rip), %rdi      # 0x6052
callq 0x11e0
movl $0x1, %edi
callq 0x1180
// File: /workspace/github_c_makefile_star2_O3/evanwire[P]GitClone/client.c
// Function: readFile
char* readFile(char* fileName){
  //Finding file's size
  struct stat st;
  stat(fileName, &st);
  int size = st.st_size;

  char* file_contents = malloc(size * sizeof(char));
  if(!file_contents){
    printf("\nError: was unable to use malloc(). Please try again.\n");
    exit(1);
  }
  memset(file_contents, 0, size);

  int file_fd = open(fileName, O_RDONLY);
  if(file_fd < 0){
    printf("\nError: Ran into trouble reading file %s.", fileName);
    return "Error";
  }

  int bytes_read = read(file_fd, file_contents, size);
  file_contents[bytes_read] = '\0';
  close(file_fd);
  return file_contents;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x90, %rsp
movq %rdi, %r14
leaq -0xb0(%rbp), %rbx
movq %rbx, %rsi
callq 0x1140
movslq 0x30(%rbx), %r15
movl $0x1, %edi
movq %r15, %rsi
callq 0x10e0
testq %rax, %rax
je 0x441f
movq %rax, %rbx
movq %r14, %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x10f0
testl %eax, %eax
js 0x43f4
movl %eax, %r12d
movl %eax, %edi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x11c0
cltq
movb $0x0, (%rbx,%rax)
movl %r12d, %edi
callq 0x1250
jmp 0x440c
leaq 0x11c9(%rip), %rdi      # 0x55c4
movq %r14, %rsi
xorl %eax, %eax
callq 0x1040
leaq 0x11e2(%rip), %rbx      # 0x55ee
movq %rbx, %rax
addq $0x90, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1e1e(%rip), %rdi      # 0x6244
callq 0x11e0
movl $0x1, %edi
callq 0x1180
// File: /workspace/github_c_makefile_star2_O3/evanwire[P]GitClone/client.c
// Function: hashIt
char* hashIt(char* input){
  unsigned char digest[MD5_DIGEST_LENGTH];
  MD5(input, strlen(input), digest);
  int i;
  char * result=(char*)malloc(34*sizeof(char));
  memset(result,'\0',34);
  for(i = 0; i < MD5_DIGEST_LENGTH; i++){
     sprintf(result+2*i, "%02x", digest[i]);
  }

  return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
callq 0x10a0
leaq -0x30(%rbp), %rdx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x11f0
movl $0x1, %edi
movl $0x22, %esi
callq 0x10e0
movq %rax, %rbx
leaq 0x114b(%rip), %r14      # 0x55bf
movq %rax, %r15
xorl %r12d, %r12d
movzbl -0x30(%rbp,%r12), %edx
movq %r15, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x1050
incq %r12
addq $0x2, %r15
cmpq $0x10, %r12
jne 0x447a
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/evanwire[P]GitClone/client.c
// Function: copyFile
void copyFile(char* from_file_name, int to_fd){
  char* from_file_contents = readFile(from_file_name);

  int bytes_written = write(to_fd, from_file_contents, strlen(from_file_contents));
  if(bytes_written < 0){
    printf("\nError: unable to execute the write() function. Please try again.\n");
    exit(1);
  }

  free(from_file_contents);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %esi, %r14d
callq 0x4387
movq %rax, %rbx
movq %rax, %rdi
callq 0x10a0
movl %r14d, %edi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x1080
testl %eax, %eax
js 0x44e2
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x1170
leaq 0x1d19(%rip), %rdi      # 0x6202
callq 0x11e0
movl $0x1, %edi
callq 0x1180
// File: /workspace/github_c_makefile_star2_O3/evanwire[P]GitClone/client.c
// Function: read_line
char* read_line(int fd){
  //Creating a buffer to hold the entire file
  int file_storage_size = 10;
  int file_idx = 0;
  char* file_contents = malloc(file_storage_size * sizeof(char));
  if(!file_contents){
    printf("\nError: was unable to use malloc(). Please try again.\n");
    exit(1);
  }

  //buffer to read character of the file to
  char buffer[1];


  //Copy from file to buffer until \n is reached
  while((read(fd, buffer, 1)) == 1){
    if(buffer[0] == '\n' || buffer[0] == 0 || buffer[0] == EOF){
      break;
    }else{
      file_contents[file_idx] = buffer[0];
      file_idx++;
       if(file_idx == file_storage_size){
        char* larger_file = realloc(file_contents, 2 * file_storage_size * sizeof(char));

        if(!larger_file){
          printf("\nError: was unable to use realloc(). Please try again.\n");
          exit(1);
        }

        file_contents = larger_file;
      }

    }


  }
  //Eliminate any unwanted characters from the realloc
  char* fixed_file_contents = malloc(file_idx * sizeof(char));
  strcpy(fixed_file_contents, file_contents);
  fixed_file_contents[file_idx] = '\0';

  //free the original file_contents
  free(file_contents);

  return fixed_file_contents;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %edi, %r14d
movl $0xa, %edi
callq 0x1190
testq %rax, %rax
je 0x45ce
movq %rax, %rbx
leaq -0x21(%rbp), %rsi
movl $0x1, %edx
movl %r14d, %edi
callq 0x11c0
cmpq $0x1, %rax
jne 0x458f
xorl %r12d, %r12d
leaq -0x21(%rbp), %r15
movzbl -0x21(%rbp), %eax
testl %eax, %eax
je 0x458a
cmpl $0xa, %eax
je 0x458a
cmpl $0xff, %eax
je 0x458a
movb %al, (%rbx,%r12)
cmpq $0x9, %r12
jne 0x4571
movl $0x14, %esi
movq %rbx, %rdi
callq 0x1220
movq %rax, %rbx
testq %rax, %rax
je 0x45c5
movl $0x1, %edx
movl %r14d, %edi
movq %r15, %rsi
callq 0x11c0
incq %r12
cmpq $0x1, %rax
je 0x453e
movl %r12d, %r14d
jmp 0x4592
xorl %r14d, %r14d
movq %r14, %rdi
callq 0x1190
movq %rax, %r15
movq %rax, %rdi
movq %rbx, %rsi
callq 0x1150
movb $0x0, (%r15,%r14)
movq %rbx, %rdi
callq 0x1170
movq %r15, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1cae(%rip), %rdi      # 0x627a
jmp 0x45d5
leaq 0x1c6f(%rip), %rdi      # 0x6244
callq 0x11e0
movl $0x1, %edi
callq 0x1180
// File: /workspace/github_c_makefile_star2_O3/moefh[P]hed/src/main.c
// Function: print_version
static void print_version(void)
{
  printf("hed, a tiny hex editor\n");
  printf("Version " HED_VERSION " compiled on " __DATE__ "\n");
  printf("Copyright (C) 2017 Ricardo R. Massaro\n");
  printf("Source code: https://github.com/ricardo-massaro/hed\n");
}

// Assembly:
pushq %rax
leaq 0x4973(%rip), %rdi      # 0x7084
callq 0x2060
leaq 0x497e(%rip), %rdi      # 0x709b
callq 0x2060
leaq 0x4996(%rip), %rdi      # 0x70bf
callq 0x2060
leaq 0x49b0(%rip), %rdi      # 0x70e5
popq %rax
jmp 0x2060
// File: /workspace/github_c_makefile_star2_O3/moefh[P]hed/src/term.c
// Function: term_setup_raw
int term_setup_raw(int use_term_fd)
{
  struct termios term;

  term_fd = use_term_fd;
  if (! isatty(term_fd))
    return -1;
  if (tcgetattr(term_fd, &old_term) < 0)
    return -1;
  restored_old_term = 0;
  
  term = old_term;
  term.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IXON);
  term.c_oflag &= ~OPOST;
  term.c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
  term.c_cflag &= ~(CSIZE | PARENB);
  term.c_cflag |= CS8;
  term.c_cc[VMIN] = 0;
  term.c_cc[VTIME] = 1;
  if (tcsetattr(term_fd, TCSAFLUSH, &term) < 0 || atexit(term_restore) != 0)
    return -1;
  return 0;
}

// Assembly:
pushq %rbx
subq $0x40, %rsp
movl %edi, 0x79e4(%rip)      # 0xa178
callq 0x2080
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testl %eax, %eax
je 0x2840
movl 0x79cc(%rip), %edi      # 0xa178
leaq 0x79c9(%rip), %rsi      # 0xa17c
callq 0x2220
testl %eax, %eax
js 0x2840
movups 0x79b5(%rip), %xmm0     # 0xa17c
movq %rsp, %rdx
movaps %xmm0, (%rdx)
movups 0x79b8(%rip), %xmm0     # 0xa18c
movaps %xmm0, 0x10(%rdx)
movups 0x79bd(%rip), %xmm0     # 0xa19c
movaps %xmm0, 0x20(%rdx)
movups 0x79be(%rip), %xmm0     # 0xa1a8
andl $0xfffffa14, (%rdx)     # imm = 0xFFFFFA14
movups %xmm0, 0x2c(%rdx)
andb $-0x2, 0x4(%rdx)
andl $0xffff7fb4, 0xc(%rdx)  # imm = 0xFFFF7FB4
movb $0x0, 0x796e(%rip)      # 0xa174
movl $0xfffffecf, %eax       # imm = 0xFFFFFECF
andl 0x8(%rdx), %eax
orl $0x30, %eax
movl %eax, 0x8(%rdx)
movw $0x1, 0x16(%rdx)
movl 0x7958(%rip), %edi      # 0xa178
movl $0x2, %esi
callq 0x2230
testl %eax, %eax
js 0x2840
leaq -0xd9(%rip), %rdi       # 0x275c
callq 0x63f0
xorl %ebx, %ebx
negl %eax
sbbl %ebx, %ebx
movl %ebx, %eax
addq $0x40, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/moefh[P]hed/src/input.c
// Function: read_key
int read_key(int fd, char *seq, size_t max_seq_len)
{
  int nread;
  unsigned char c;
  while ((nread = read(fd, &c, 1)) != 1) {
    if (nread == -1 && errno != EAGAIN && errno != EINTR)
      return KEY_READ_ERROR;
    if (nread == -1 && errno == EINTR)
      return KEY_REDRAW;
  }

#define NEXT()        do { if (read(fd, &seq[len], 1) != 1) return read_key_seq(seq, len); len++; } while (0)
#define CUR           seq[len-1]
  
  size_t len = 0;
  if (c == '\x1b') {
    if (read(fd, &seq[len++], 1) != 1)
      return c;
    
    while (len < max_seq_len-3) {
      NEXT();
      if (CUR == '~' || CUR == '^' || IS_LETTER(CUR))
        return read_key_seq(seq, len);
      if (CUR == ';') {
        NEXT();
        continue;
      }
      //if (! IS_DIGIT(CUR)) return read_key_seq(seq, len);
    }
    return read_key_seq(seq, len);
  }
  //if (c >= 32) return -1;
  return c;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x7(%rsp), %r15
movl $0x1, %edx
movl %ebp, %edi
movq %r15, %rsi
callq 0x2140
cmpl $-0x1, %eax
je 0x28cb
cmpl $0x1, %eax
jne 0x28b0
jmp 0x28ea
callq 0x2040
movl (%rax), %eax
cmpl $0xb, %eax
je 0x28b0
cmpl $0x4, %eax
jne 0x29a5
movl $0x110002, %eax         # imm = 0x110002
jmp 0x29aa
movzbl 0x7(%rsp), %eax
cmpl $0x1b, %eax
jne 0x29aa
movl $0x1, %r15d
movl $0x1, %edx
movl %ebp, %edi
movq %rbx, %rsi
callq 0x2140
movq %rax, %rcx
movl $0x1b, %eax
cmpq $0x1, %rcx
jne 0x29aa
addq $-0x3, %r14
cmpq $0x2, %r14
jb 0x298f
movl $0x1, %r12d
leaq (%rbx,%r12), %r13
movl $0x1, %edx
movl %ebp, %edi
movq %r13, %rsi
callq 0x2140
cmpq $0x1, %rax
jne 0x29b9
leaq 0x1(%r12), %r15
movzbl (%r13), %eax
movl %eax, %ecx
orl $0x20, %ecx
cmpl $0x7e, %ecx
je 0x298f
leal -0x41(%rax), %ecx
cmpb $0x19, %cl
jbe 0x298f
cmpb $0x3b, %al
jne 0x2987
leaq (%rbx,%r15), %rsi
movl $0x1, %edx
movl %ebp, %edi
callq 0x2140
cmpq $0x1, %rax
jne 0x298f
addq $0x2, %r12
movq %r12, %r15
jmp 0x298a
movq %r15, %r12
cmpq %r14, %r15
jb 0x292f
movq %rbx, %rdi
movq %r15, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x29c1
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
movq %r12, %rsi
jmp 0x2995
// File: /workspace/github_c_makefile_star2_O3/moefh[P]hed/src/screen.c
// Function: hed_init_screen
int hed_init_screen(struct hed_screen *scr)
{
  signal(SIGWINCH, SIG_DFL);
  screen = scr;

  screen->term_fd = (isatty(STDIN_FILENO)) ? STDIN_FILENO : STDOUT_FILENO;
  if (term_setup_raw(screen->term_fd) < 0)
    return -1;
  
  term_get_window_size(&screen->w, &screen->h);
  screen->window_changed = true;
  screen->redraw_needed = true;
  screen->utf8_box_draw = true;
  screen->vt100_box_draw = true;
  screen->msg_was_set = false;
  screen->cur_msg[0] = '\0';
  screen->out_buf_len = 0;
  
  signal(SIGWINCH, handle_sigwinch);
  return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
xorl %ebx, %ebx
movl $0x1c, %edi
xorl %esi, %esi
callq 0x2160
movq %r14, 0x7588(%rip)      # 0xa1c0
xorl %edi, %edi
callq 0x2080
xorl %edi, %edi
testl %eax, %eax
sete %dil
movq 0x7572(%rip), %rax      # 0xa1c0
movl %edi, (%rax)
callq 0x2789
testl %eax, %eax
js 0x2c9f
movq 0x7560(%rip), %rsi      # 0xa1c0
leaq 0x4(%rsi), %rdi
addq $0x8, %rsi
callq 0x2848
movq 0x754c(%rip), %rax      # 0xa1c0
movl $0x1010101, 0xc(%rax)   # imm = 0x1010101
movw $0x0, 0x10(%rax)
movq $0x0, 0x518(%rax)
leaq 0x1b(%rip), %rsi        # 0x2cae
movl $0x1c, %edi
callq 0x2160
jmp 0x2ca4
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/moefh[P]hed/src/screen.c
// Function: handle_sigwinch
static void handle_sigwinch(int signum)
{
  if (screen) {
    term_get_window_size(&screen->w, &screen->h);
    screen->window_changed = true;
    screen->redraw_needed = true;
  }
  signal(signum, handle_sigwinch);
}

// Assembly:
pushq %rbx
movl %edi, %ebx
movq 0x7508(%rip), %rsi      # 0xa1c0
testq %rsi, %rsi
je 0x2cd7
leaq 0x4(%rsi), %rdi
addq $0x8, %rsi
callq 0x2848
movq 0x74ef(%rip), %rax      # 0xa1c0
movw $0x101, 0xc(%rax)       # imm = 0x101
leaq -0x30(%rip), %rsi       # 0x2cae
movl %ebx, %edi
popq %rbx
jmp 0x2160
// File: /workspace/github_c_makefile_star2_O3/moefh[P]hed/src/screen.c
// Function: hed_scr_show_msg
int hed_scr_show_msg(const char *fmt, ...)
{
  va_list ap;
  va_start(ap, fmt);
  if (screen)
    vsnprintf(screen->cur_msg, sizeof(screen->cur_msg), fmt, ap);
  else {
    vfprintf(stderr, fmt, ap);
    fprintf(stderr, "\n");
  }
  va_end(ap);
  
  if (screen) {
    screen->redraw_needed = true;
    screen->msg_was_set = true;
  }
  return -1;
}

// Assembly:
subq $0xd8, %rsp
movq %rdi, %r10
leaq 0x20(%rsp), %rdi
movq %rsi, 0x8(%rdi)
movq %rdx, 0x10(%rdi)
movq %rcx, 0x18(%rdi)
movq %r8, 0x20(%rdi)
movq %r9, 0x28(%rdi)
testb %al, %al
je 0x2d44
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
movq %rdi, 0x10(%rsp)
leaq 0xe0(%rsp), %rax
movq %rax, 0x8(%rsp)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, (%rsp)
movq 0x7455(%rip), %rdi      # 0xa1c0
testq %rdi, %rdi
je 0x2da5
addq $0x11, %rdi
movq %rsp, %rcx
movl $0x100, %esi            # imm = 0x100
movq %r10, %rdx
callq 0x20a0
movq 0x7435(%rip), %rax      # 0xa1c0
testq %rax, %rax
je 0x2d98
movb $0x1, %cl
movb %cl, 0xd(%rax)
movb %cl, 0x10(%rax)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0xd8, %rsp
retq
movq %rsp, %rsi
movq %r10, %rdi
callq 0x2361
jmp 0x2d84
// File: /workspace/github_c_makefile_star2_O3/moefh[P]hed/src/screen.c
// Function: hed_scr_flush
void hed_scr_flush(void)
{
  if (screen->out_buf_len > 0) {
    size_t pos = 0;
    while (pos < screen->out_buf_len) {
      ssize_t n = write(screen->term_fd, screen->out_buf + pos, screen->out_buf_len - pos);
      if (n < 0) {
        if (errno != EINTR)
          break;
      } else if (n == 0)
        break;
      pos += n;
    }
    screen->out_buf_len = 0;
  }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq 0x73d2(%rip), %rax      # 0xa1c0
movq 0x518(%rax), %rdx
testq %rdx, %rdx
je 0x2e50
xorl %r14d, %r14d
movl (%rax), %edi
leaq (%rax,%r14), %rsi
addq $0x111, %rsi            # imm = 0x111
subq %r14, %rdx
callq 0x20b0
movq %rax, %rbx
testq %rax, %rax
js 0x2e1e
jne 0x2e28
jmp 0x2e3e
callq 0x2040
cmpl $0x4, (%rax)
jne 0x2e3e
addq %rbx, %r14
movq 0x738e(%rip), %rax      # 0xa1c0
movq 0x518(%rax), %rdx
cmpq %rdx, %r14
jb 0x2dfd
movq 0x737b(%rip), %rax      # 0xa1c0
movq $0x0, 0x518(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/moefh[P]hed/src/screen.c
// Function: hed_scr_out
void hed_scr_out(const char *fmt, ...)
{
  static char buf[1024];

  va_list ap;
  va_start(ap, fmt);
  vsnprintf(buf, sizeof(buf), fmt, ap);
  va_end(ap);

  size_t len = strlen(buf);
  if (screen->out_buf_len + len > sizeof(screen->out_buf))
    hed_scr_flush();
  memcpy(screen->out_buf + screen->out_buf_len, buf, len);
  screen->out_buf_len += len;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0xd8, %rsp
movq %rdi, %r10
leaq 0x20(%rsp), %rdi
movq %rsi, 0x8(%rdi)
movq %rdx, 0x10(%rdi)
movq %rcx, 0x18(%rdi)
movq %r8, 0x20(%rdi)
movq %r9, 0x28(%rdi)
testb %al, %al
je 0x2eb9
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
movq %rsp, %rcx
movq %rdi, 0x10(%rcx)
leaq 0xf0(%rsp), %rax
movq %rax, 0x8(%rcx)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, (%rcx)
leaq 0x72f0(%rip), %rbx      # 0xa1d0
movl $0x400, %esi            # imm = 0x400
movq %rbx, %rdi
movq %r10, %rdx
callq 0x20a0
movq %rbx, %rdi
callq 0x20e0
movq %rax, %rbx
movq 0x72be(%rip), %r14      # 0xa1c0
movq 0x518(%r14), %rax
movq %rbx, %rcx
addq %rax, %rcx
cmpq $0x401, %rcx            # imm = 0x401
jb 0x2f2b
callq 0x2de3
movq 0x729c(%rip), %r14      # 0xa1c0
movq 0x518(%r14), %rax
leaq (%r14,%rax), %rdi
addq $0x111, %rdi            # imm = 0x111
leaq 0x7293(%rip), %rsi      # 0xa1d0
movq %rbx, %rdx
callq 0x21b0
addq %rbx, 0x518(%r14)
addq $0xd8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/moefh[P]hed/src/screen.c
// Function: hed_scr_set_color
void hed_scr_set_color(int c1, int c2)
{
  if (c1 >= 0)
    hed_scr_out("\x1b[%dm", c1);
  if (c2 >= 0)
    hed_scr_out("\x1b[%dm", c2);
}

// Assembly:
pushq %rbx
movl %esi, %ebx
testl %edi, %edi
js 0x313b
movl %edi, %esi
leaq 0x4257(%rip), %rdi      # 0x738b
xorl %eax, %eax
callq 0x2e58
testl %ebx, %ebx
js 0x3150
leaq 0x4245(%rip), %rdi      # 0x738b
movl %ebx, %esi
xorl %eax, %eax
popq %rbx
jmp 0x2e58
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/moefh[P]hed/src/screen.c
// Function: hed_scr_move_cursor
void hed_scr_move_cursor(int x, int y)
{
  if (x < 1) x = 1;
  if (y < 1) y = 1;
  if (x > screen->w) x = screen->w;
  if (y > screen->h) y = screen->h;
  hed_scr_out("\x1b[%d;%dH", y, x);
}

// Assembly:
cmpl $0x2, %edi
movl $0x1, %eax
cmovll %eax, %edi
cmpl $0x2, %esi
cmovll %eax, %esi
movq 0x6ffe(%rip), %rax      # 0xa1c0
movl 0x4(%rax), %edx
movl 0x8(%rax), %eax
cmpl %edx, %edi
cmovll %edi, %edx
cmpl %eax, %esi
cmovgel %eax, %esi
leaq 0x41d7(%rip), %rdi      # 0x73b0
xorl %eax, %eax
jmp 0x2e58