// File: /workspace/github_c_makefile_star2_O1/salextpuru[P]speccy-toochain/src/mhmt/mhmt-emit.c
// Function: emit_hrust
ULONG emit_hrust(struct optchain * optch, ULONG actual_len)
{
    ULONG position;
    LONG length;
    LONG disp;
    LONG max_disp; // maximum encountered displacement
    ULONG varbits,varlen;
    ULONG success = 1;
    UBYTE wrlen[2];
    ULONG expbitlen = 2; // expandable match: bitlength of displacement
    max_disp = 0;

    // some checks
    if( !optch ) {
        printf("mhmt-emit.c:emit_hrust() - NULL passed!\n");
        return 0;
    }

    // initialize
    success = success && emit_file(NULL, EMIT_FILE_INIT);
    success = success && emit_byte(0, EMIT_BYTE_INIT);
    success = success && emit_bits(0, EMIT_BITS_INIT);

    // manage zx header info
    if( wrk.zxheader ) {
        success = success && emit_file( (UBYTE*)"HR", 2);
        wrlen[0] = wrk.inlen&0x00FF;
        wrlen[1] = (wrk.inlen>>8)&0x00FF;
        success = success && emit_file( wrlen, 2); // unpacked length mod 65536
        success = success && emit_file( wrlen, 2); // packed length - !to be filled later!
        success = success && emit_file( &wrk.indata[wrk.inlen-6], 6); // last bytes
    }

    // schedule first byte to be placed just after first bitstream word
    success = success && emit_byte( wrk.indata[0], EMIT_BYTE_ADD);
    // go emitting codes
    position = 1;

    while( (position<actual_len) && success ) {
#ifdef DBG
        printf("%04x:",position);
#endif
        length = optch[position].code.length;
        disp   = optch[position].code.disp;

        if( length==0 ) {
            printf("mhmt-emit.c:emit_hrust() - encountered stop-code in optimal chain before emitting all data!\n");
            return 0;

        } else if( disp==0 ) { // copy-bytes
            if( length==1 ) { // 1 byte: %1<byte>
                success = success && emit_bits( 0x80000000, 1 );
                success = success && emit_byte( wrk.indata[position], EMIT_BYTE_ADD );

            } else if( (12<=length) && (length<=42) && ( !(length&1) ) ) { // %0110001abcd<byte,byte,...>
                varbits = (length-12)<<27;
                success = success && emit_bits( 0x62000000, 7 );
                success = success && emit_bits( varbits, 4 );
                varlen = 0;

                while( success && (varlen<(ULONG)length) ) {
                    success = success && emit_byte( wrk.indata[position+varlen], EMIT_BYTE_ADD );
                    varlen++;
                }

            } else
                goto INVALID_CODE_HRUST;

        } else if( length==(-3) ) { // insertion code
            if( (-16)<=disp && disp<=(-1) ) { // %011001abcd<byte>
                success = success && emit_bits( 0x64000000, 6 );
                success = success && emit_bits( disp<<(32-4), 4 );

            } else if( (-79)<=disp && disp<(-16) ) {
                if( disp&1 ) { // ffb1..ffef: %01001<byte><byte>
                    success = success && emit_bits( 0x48000000, 5 );
                    varbits = disp&0x00FF;
                    varbits += 15;
                    varbits ^= 3;
                    varbits = ( (varbits>>1)&0x007F ) | ( (varbits<<7)&0x0080 );
                    success = success && emit_byte( (UBYTE)(varbits&0x00FF), EMIT_BYTE_ADD );

                } else { // ffb2..ffee: %00110<byte><byte>
                    success = success && emit_bits( 0x30000000, 5 );
                    varbits = disp&0x00FF;
                    varbits += 15;
                    varbits ^= 2;
                    varbits = ( (varbits>>1)&0x007F ) | ( (varbits<<7)&0x0080 );
                    success = success && emit_byte( (UBYTE)(varbits&0x00FF), EMIT_BYTE_ADD );
                }

            } else
                goto INVALID_CODE_HRUST;

            success = success && emit_byte( wrk.indata[position+1], EMIT_BYTE_ADD );

        } else if( length==1 ) { // %000abc
            if( (-8)<=disp && disp<=(-1) ) {
                success = success && emit_bits( 0x00000000, 3 );
                success = success && emit_bits( disp<<(32-3), 3 );

            } else
                goto INVALID_CODE_HRUST;

        } else if( length==2 ) {
            if( (-32)<=disp && disp<=(-1) ) { // %00111abcde
                success = success && emit_bits( 0x38000000, 5 );
                success = success && emit_bits( disp<<(32-5), 5 );

            } else if( (-256)<=disp && disp<(-32) ) { // %00110<byte>
                success = success && emit_bits( 0x30000000, 5 );
                success = success && emit_byte( (UBYTE)(0x00FF & disp), EMIT_BYTE_ADD );

            } else if( (-512)<=disp && disp<(-256) ) { // %00101<byte>
                success = success && emit_bits( 0x28000000, 5 );
                success = success && emit_byte( (UBYTE)(0x00FF & disp), EMIT_BYTE_ADD );

            } else if( (-768)<=disp && disp<(-512) ) { // %00100<byte>
                success = success && emit_bits( 0x20000000, 5 );
                success = success && emit_byte( (UBYTE)(0x00FF & disp), EMIT_BYTE_ADD );

            } else
                goto INVALID_CODE_HRUST;

        } else if (3<=length && length<=3839 && (-65536)<=disp && disp<=(-1) ) {
            // first see if we need emitting expansion codes
            //  -513.. -1024  (FDFF..FC00) - 2 bits
            //  -1025..-2048  (FBFF..F800) - 3
            //  -2049..-4096  (F7FF..F000) - 4
            //  -4097..-8192  (EFFF..E000) - 5
            //  -8193..-16384 (DFFF..C000) - 6
            // -16385..-32768 (BFFF..8000) - 7
            // -32769..-65536 (7FFF..0000) - 8
            if( disp<(-512) ) {
                varbits = 1024;
                varlen  = 2;

                while( (ULONG)(-disp) > varbits ) {
                    varbits <<= 1;
                    varlen++;
                }

                // emit expansion codes, if necessary: %00110<FE>
                while( varlen>expbitlen ) {
                    success = success && emit_bits( 0x30000000, 5 );
                    success = success && emit_byte( 0x00FE, EMIT_BYTE_ADD );
#ifdef DBG
                    printf("expansion\n");
#endif
                    expbitlen++;
                }
            }

            // emit length
            if( length<=15 ) { // 3..15
                success = success && emit_bits( 0, 1 );

                if( length==3 ) {
                    success = success && emit_bits( 0x80000000, 2 ); // %010

                } else {
                    varlen  = length/3;
                    varbits = length%3;
                    success = success && emit_bits( 0xFFFFFFFF, varlen<<1 );

                    if( length!=15 )
                        success = success && emit_bits( varbits<<(32-2), 2 );
                }

            } else if( length<=127 ) { // 16..127: %0110000abcdefg
                success = success && emit_bits( 0x60000000, 7 );
                success = success && emit_bits( length<<(32-7), 7 );

            } else { // 128..3839
                success = success && emit_bits( 0x60000000, 7 );
                success = success && emit_bits( length<<(32-15), 7 );
                success = success && emit_byte( (UBYTE)(length&0x00FF), EMIT_BYTE_ADD );
            }

            // emit displacement
            if( (-32)<=disp ) { // ffe0..ffff: %10abcde
                success = success && emit_bits( 0x80000000, 2 );
                success = success && emit_bits( disp<<(32-5), 5 );

            } else if( (-256)<=disp ) { // ff00..ffdf: %01<byte>
                success = success && emit_bits( 0x40000000, 2 );
                success = success && emit_byte( (UBYTE)(disp&0x00FF), EMIT_BYTE_ADD );

            } else if( (-512)<=disp ) { // fe00..feff: %00<byte>
                success = success && emit_bits( 0x00000000, 2 );
                success = success && emit_byte( (UBYTE)(disp&0x00FF), EMIT_BYTE_ADD );

            } else { // variable code length: [-65536..-512)
                // displacement itself: %11ab[cdefgh]<byte>
                success = success && emit_bits( 0xC0000000, 2 );
                success = success && emit_bits( disp<<(24-expbitlen), expbitlen );
                success = success && emit_byte( (UBYTE)(disp&0x00FF), EMIT_BYTE_ADD );
            }

        } else {
INVALID_CODE_HRUST:
            printf("mhmt-emit.c:emit_hrust() - invalid code: length=%d, displacement=%d\n",length,disp);
            return 0;
        }

#ifdef DBG

        if( length==(-3) ) {
            printf("insert-match.len=%d,disp=%d\n",(-length),disp);

        } else if( disp==0 ) {
            printf("copy.len=%d\n",length);

        } else {
            printf("match.len=%d,disp=%d\n",length,disp);
        }

#endif

        if( max_disp > disp ) max_disp = disp;

        if( length>0 ) // account for negative length
            position += length;

        else
            position -= length;
    }

    // stop-code: %0110_0000_0011_11
    success = success && emit_bits( 0x603C0000, 14 );
    success = success && emit_bits( 0, EMIT_BITS_FINISH ); // this also flushes emit_byte()
    success = success && emit_file( NULL, EMIT_FILE_FINISH );

    if( success ) {
        printf("Maximum displacement actually used is %d.\n",-max_disp);
        // TODO: patch packed length in file, if zx header
    }

    return success;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
testq %rdi, %rdi
je 0x2636
movl %esi, %r14d
movq %rdi, %r15
xorl %eax, %eax
movl %eax, 0x93cb(%rip)      # 0xb200
movl %eax, 0x94d5(%rip)      # 0xb310
movl %eax, 0x94d3(%rip)      # 0xb314
movl %eax, 0x94d1(%rip)      # 0xb318
movl %eax, 0x94cf(%rip)      # 0xb31c
leaq 0x94cc(%rip), %rcx      # 0xb320
cmpl %eax, 0xc(%rcx)
je 0x1eca
leaq 0x425c(%rip), %rdi      # 0x60bc
movl $0x2, %esi
callq 0x15fc
leaq 0x94af(%rip), %rcx      # 0xb320
movzwl 0x48(%rcx), %ecx
movw %cx, 0x1a(%rsp)
testl %eax, %eax
je 0x1f02
leaq 0x1a(%rsp), %rdi
movl $0x2, %esi
callq 0x15fc
testl %eax, %eax
je 0x1f02
leaq 0x1a(%rsp), %rdi
movl $0x2, %esi
callq 0x15fc
testl %eax, %eax
je 0x1f02
leaq 0x9471(%rip), %rbx      # 0xb320
movl 0x48(%rbx), %edi
addl $-0x6, %edi
addq 0x40(%rbx), %rdi
movl $0x6, %esi
callq 0x15fc
movq %rbx, %rcx
testl %eax, %eax
je 0x1f02
movq 0x40(%rcx), %rax
movb (%rax), %al
movl 0x943a(%rip), %ecx      # 0xb310
leaq 0x9333(%rip), %rdx      # 0xb210
movb %al, (%rcx,%rdx)
leal 0x1(%rcx), %eax
movzbl %al, %ecx
movl %ecx, 0x9424(%rip)      # 0xb310
movb $0x1, %al
cmpl 0x9420(%rip), %ecx      # 0xb314
jne 0x1f04
leaq 0x42f1(%rip), %rdi      # 0x61ee
callq 0x1120
xorl %eax, %eax
cmpl $0x2, %r14d
setb %cl
movl %eax, %edx
xorb $0x1, %dl
xorl %ebp, %ebp
orb %cl, %dl
jne 0x2600
movl $0x1, %ecx
xorl %ebp, %ebp
movl $0x2, 0x1c(%rsp)
leaq 0x42be(%rip), %r13      # 0x61ee
movq %r15, 0x20(%rsp)
movl %r14d, 0x2c(%rsp)
movq %rcx, 0x30(%rsp)
movl %ecx, %r12d
movq %r12, %rax
shlq $0x4, %rax
movl (%r15,%rax), %r8d
testq %r8, %r8
je 0x2659
movl 0x4(%r15,%rax), %eax
movq %rax, 0x8(%rsp)
testl %eax, %eax
movq %r8, (%rsp)
je 0x1fcb
cmpq $0x2, %r8
je 0x20b7
cmpl $0x1, %r8d
movq 0x8(%rsp), %r12
je 0x2087
cmpl $-0x3, %r8d
jne 0x20e2
cmpl $-0x10, %r12d
jb 0x21d7
movl $0x64000000, %edi       # imm = 0x64000000
movl $0x6, %esi
callq 0x1822
xorl %ebx, %ebx
testl %eax, %eax
je 0x25a5
movl %r12d, %edi
shll $0x1c, %edi
movl $0x4, %esi
callq 0x1822
testl %eax, %eax
jne 0x23f7
jmp 0x25a5
cmpl $0x1, %r8d
jne 0x202e
movl $0x80000000, %edi       # imm = 0x80000000
movl $0x1, %esi
callq 0x1822
xorl %ebx, %ebx
testl %eax, %eax
je 0x22a8
leaq 0x932f(%rip), %rax      # 0xb320
movq 0x40(%rax), %rax
movb (%rax,%r12), %al
movl 0x9311(%rip), %ecx      # 0xb310
leaq 0x920a(%rip), %rdx      # 0xb210
movb %al, (%rcx,%rdx)
leal 0x1(%rcx), %eax
movzbl %al, %eax
movl %eax, 0x92fb(%rip)      # 0xb310
cmpl 0x92f9(%rip), %eax      # 0xb314
jne 0x22a3
movq %r13, %rdi
callq 0x1120
jmp 0x22a8
leal -0xc(%r8), %eax
cmpl $0x1e, %eax
movq 0x8(%rsp), %r12
ja 0x2679
movl %r8d, %eax
andl $0x1, %eax
jne 0x2679
movl $0x62000000, %edi       # imm = 0x62000000
movl $0x7, %esi
callq 0x1822
testl %eax, %eax
movl %ebp, 0x14(%rsp)
je 0x2205
movq (%rsp), %rax
movl %eax, %edi
shll $0x1b, %edi
addl $0xa0000000, %edi       # imm = 0xA0000000
movl $0x4, %esi
callq 0x1822
movl %eax, %ebx
jmp 0x2207
cmpl $-0x8, %r12d
jb 0x2679
xorl %ebx, %ebx
xorl %edi, %edi
movl $0x3, %esi
callq 0x1822
testl %eax, %eax
je 0x25a5
movl %r12d, %edi
shll $0x1d, %edi
movl $0x3, %esi
jmp 0x2530
movq 0x8(%rsp), %r12
cmpl $-0x20, %r12d
jb 0x21ba
movl $0x38000000, %edi       # imm = 0x38000000
movl $0x5, %esi
callq 0x1822
testl %eax, %eax
jne 0x2525
jmp 0x259c
leal -0x3(%r8), %eax
cmpl $0xefc, %eax            # imm = 0xEFC
ja 0x2679
cmpl $0xffff0000, %r12d      # imm = 0xFFFF0000
jb 0x2679
cmpl $0xfffffdff, %r12d      # imm = 0xFFFFFDFF
jg 0x21f9
movl %r12d, %eax
negl %eax
movl $0x2, %ebx
cmpl $0x401, %eax            # imm = 0x401
jb 0x2129
movl $0x400, %ecx            # imm = 0x400
addl %ecx, %ecx
incl %ebx
cmpl %eax, %ecx
jb 0x2121
movl 0x1c(%rsp), %ecx
cmpl %ecx, %ebx
jbe 0x22de
movl %ebp, 0x14(%rsp)
movl $0x1, %ebp
movl %ebp, %eax
xorl %ebp, %ebp
movb $0x1, %r12b
testl %eax, %eax
je 0x21a9
movl %r14d, %r15d
movl %ecx, %r14d
movl $0x30000000, %edi       # imm = 0x30000000
movl $0x5, %esi
callq 0x1822
testl %eax, %eax
je 0x219a
movl 0x91a8(%rip), %eax      # 0xb310
leaq 0x90a1(%rip), %rcx      # 0xb210
movb $-0x2, (%rax,%rcx)
incl %eax
movzbl %al, %eax
movl %eax, 0x9192(%rip)      # 0xb310
xorl %ebp, %ebp
cmpl 0x918e(%rip), %eax      # 0xb314
jne 0x2192
movq %r13, %rdi
callq 0x1120
jmp 0x219a
movl $0x1, %ebp
xorl %r12d, %r12d
movl %r14d, %ecx
movl %r15d, %r14d
movq 0x20(%rsp), %r15
movq (%rsp), %r8
incl %ecx
cmpl %ecx, %ebx
jne 0x213e
movl %ebx, %ecx
movl 0x14(%rsp), %ebp
jmp 0x22e1
leal 0x100(%r12), %eax
cmpl $0xdf, %eax
ja 0x22b6
movl $0x30000000, %edi       # imm = 0x30000000
jmp 0x244b
leal 0x4f(%r12), %eax
cmpl $0x3e, %eax
ja 0x2679
testb $0x1, %r12b
jne 0x23ad
movl $0x30000000, %edi       # imm = 0x30000000
jmp 0x23b2
xorl %r12d, %r12d
movl 0x1c(%rsp), %ecx
jmp 0x22e1
xorl %ebx, %ebx
leaq 0x9112(%rip), %rdx      # 0xb320
testl %ebx, %ebx
je 0x2298
movl $0x1, %r12d
movq 0x30(%rsp), %rax
movl %eax, %ebp
movq (%rsp), %r8
movq 0x40(%rdx), %rax
movl %ebp, %ecx
movb (%rax,%rcx), %al
movl 0x90da(%rip), %ecx      # 0xb310
leaq 0x8fd3(%rip), %rsi      # 0xb210
movb %al, (%rcx,%rsi)
leal 0x1(%rcx), %eax
movzbl %al, %r14d
movl %r14d, 0x90c2(%rip)     # 0xb310
movl 0x90bf(%rip), %r15d     # 0xb314
movl $0x1, %ebx
cmpl %r15d, %r14d
jne 0x2274
movq %r13, %rdi
callq 0x1120
movq (%rsp), %r8
leaq 0x90ae(%rip), %rdx      # 0xb320
xorl %ebx, %ebx
cmpl %r15d, %r14d
je 0x2288
incl %ebp
leaq 0x1(%r12), %rax
cmpq %r8, %r12
movq %rax, %r12
jb 0x2227
movl 0x2c(%rsp), %r14d
movq 0x20(%rsp), %r15
movl 0x14(%rsp), %ebp
jmp 0x22ac
movq 0x20(%rsp), %r15
movl 0x14(%rsp), %ebp
jmp 0x22a8
movl $0x1, %ebx
movq (%rsp), %r8
movq 0x8(%rsp), %r12
jmp 0x25a9
movl %r12d, %eax
andl $0xffffff00, %eax       # imm = 0xFFFFFF00
cmpl $0xfffffd00, %eax       # imm = 0xFFFFFD00
je 0x2446
cmpl $0xfffffe00, %eax       # imm = 0xFFFFFE00
jne 0x2679
movl $0x28000000, %edi       # imm = 0x28000000
jmp 0x244b
xorl %r12d, %r12d
movl %ecx, 0x1c(%rsp)
cmpl $0xf, %r8d
jg 0x22f4
testb %r12b, %r12b
je 0x2333
xorl %eax, %eax
jmp 0x2348
xorl %ecx, %ecx
cmpl $0x7f, %r8d
jg 0x2367
testb %r12b, %r12b
jne 0x2370
movl $0x60000000, %edi       # imm = 0x60000000
movl $0x7, %esi
callq 0x1822
xorl %ecx, %ecx
movq (%rsp), %r8
testl %eax, %eax
movq 0x8(%rsp), %r12
je 0x24fe
movl %r8d, %edi
shll $0x19, %edi
movl $0x7, %esi
jmp 0x24ec
xorl %edi, %edi
movl $0x1, %esi
callq 0x1822
movq (%rsp), %r8
testl %eax, %eax
setne %al
movq 0x8(%rsp), %r12
cmpl $0x3, %r8d
jne 0x237a
xorl %ecx, %ecx
testb %al, %al
je 0x24fe
movl $0x80000000, %edi       # imm = 0x80000000
jmp 0x24e7
testb %r12b, %r12b
je 0x245c
movq 0x8(%rsp), %r12
jmp 0x24fe
movq %r8, %rbx
movl $0xaaaaaaab, %ecx       # imm = 0xAAAAAAAB
imulq %rcx, %rbx
shrq $0x21, %rbx
testb %al, %al
je 0x24c4
leal (%rbx,%rbx), %esi
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x1822
movq (%rsp), %r8
testl %eax, %eax
setne %al
jmp 0x24c6
movl $0x48000000, %edi       # imm = 0x48000000
movl $0x5, %esi
callq 0x1822
xorl %ebx, %ebx
testl %eax, %eax
je 0x25a5
leal 0xf(%r12), %eax
shrb %al
xorb $-0x7f, %al
movl 0x8f3b(%rip), %ecx      # 0xb310
leaq 0x8e34(%rip), %rdx      # 0xb210
movb %al, (%rcx,%rdx)
leal 0x1(%rcx), %eax
movzbl %al, %eax
movl %eax, 0x8f25(%rip)      # 0xb310
cmpl 0x8f23(%rip), %eax      # 0xb314
je 0x2592
leaq 0x8f22(%rip), %rax      # 0xb320
movq 0x40(%rax), %rax
movq 0x30(%rsp), %rcx
incl %ecx
movb (%rax,%rcx), %al
movl 0x8efe(%rip), %ecx      # 0xb310
leaq 0x8df7(%rip), %rdx      # 0xb210
movb %al, (%rcx,%rdx)
leal 0x1(%rcx), %eax
movzbl %al, %eax
movl %eax, 0x8ee8(%rip)      # 0xb310
movl $0x1, %ebx
cmpl 0x8ee1(%rip), %eax      # 0xb314
jne 0x25a5
movq %r13, %rdi
callq 0x1120
jmp 0x259c
movl $0x20000000, %edi       # imm = 0x20000000
movl $0x5, %esi
callq 0x1822
xorl %ebx, %ebx
jmp 0x256a
movl $0x60000000, %edi       # imm = 0x60000000
movl $0x7, %esi
callq 0x1822
testl %eax, %eax
movq 0x8(%rsp), %r12
je 0x24be
movq (%rsp), %rbx
movl %ebx, %edi
shll $0x11, %edi
movl $0x7, %esi
callq 0x1822
testl %eax, %eax
je 0x24f9
movl 0x8e7f(%rip), %eax      # 0xb310
leaq 0x8d78(%rip), %rcx      # 0xb210
movb %bl, (%rax,%rcx)
incl %eax
movzbl %al, %eax
movl %eax, 0x8e6a(%rip)      # 0xb310
movl $0x1, %ecx
cmpl 0x8e63(%rip), %eax      # 0xb314
movq %rbx, %r8
jne 0x24fe
movq %r13, %rdi
callq 0x1120
movq (%rsp), %r8
jmp 0x24fc
xorl %eax, %eax
cmpq $0xf, %r8
sete %cl
andb %al, %cl
movzbl %cl, %ecx
cmpl $0xf, %r8d
je 0x24fe
testb %al, %al
je 0x24fe
leal (%rbx,%rbx,2), %eax
movl %r8d, %edi
subl %eax, %edi
shll $0x1e, %edi
movl $0x2, %esi
callq 0x1822
movq (%rsp), %r8
movl %eax, %ecx
jmp 0x24fe
movq %rbx, %r8
xorl %ecx, %ecx
cmpl $-0x20, %r12d
jl 0x2539
xorl %ebx, %ebx
testl %ecx, %ecx
je 0x25a9
movl $0x80000000, %edi       # imm = 0x80000000
movl $0x2, %esi
callq 0x1822
testl %eax, %eax
je 0x25a5
movl %r12d, %edi
shll $0x1b, %edi
movl $0x5, %esi
callq 0x1822
movl %eax, %ebx
jmp 0x25a5
cmpl $0xffffff00, %r12d      # imm = 0xFFFFFF00
jl 0x254f
xorl %ebx, %ebx
testl %ecx, %ecx
je 0x25a9
movl $0x40000000, %edi       # imm = 0x40000000
jmp 0x2560
cmpl $0xfffffe00, %r12d      # imm = 0xFFFFFE00
jl 0x25d4
testl %ecx, %ecx
je 0x259c
xorl %ebx, %ebx
xorl %edi, %edi
movl $0x2, %esi
callq 0x1822
testl %eax, %eax
je 0x25a5
movl 0x8d9c(%rip), %eax      # 0xb310
leaq 0x8c95(%rip), %rcx      # 0xb210
movb %r12b, (%rax,%rcx)
incl %eax
movzbl %al, %eax
movl %eax, 0x8d86(%rip)      # 0xb310
cmpl 0x8d84(%rip), %eax      # 0xb314
jne 0x25a0
movq %r13, %rdi
callq 0x1120
jmp 0x25a5
xorl %ebx, %ebx
jmp 0x25a5
movl $0x1, %ebx
movq (%rsp), %r8
cmpl %r12d, %ebp
cmovgel %r12d, %ebp
movl %r8d, %eax
negl %eax
cmovsl %r8d, %eax
movq 0x30(%rsp), %rcx
addl %eax, %ecx
testl %ebx, %ebx
setne %al
cmpl %r14d, %ecx
jae 0x2600
testl %ebx, %ebx
jne 0x1f3a
jmp 0x2600
xorl %ebx, %ebx
testl %ecx, %ecx
je 0x25a5
movl $0xc0000000, %edi       # imm = 0xC0000000
movl $0x2, %esi
callq 0x1822
testl %eax, %eax
je 0x25a5
movb $0x18, %cl
movl 0x1c(%rsp), %esi
subb %sil, %cl
movl %r12d, %edi
shll %cl, %edi
jmp 0x2565
testb %al, %al
je 0x263f
movl $0x603c0000, %edi       # imm = 0x603C0000
movl $0xe, %esi
callq 0x1822
testl %eax, %eax
je 0x263f
xorl %ebx, %ebx
xorl %edi, %edi
xorl %esi, %esi
callq 0x1822
testl %eax, %eax
je 0x2641
xorl %edi, %edi
xorl %esi, %esi
callq 0x15fc
testl %eax, %eax
setne %bl
jmp 0x2641
leaq 0x3cca(%rip), %rdi      # 0x6307
jmp 0x2660
xorl %ebx, %ebx
testb %bl, %bl
je 0x2667
negl %ebp
leaq 0x39fc(%rip), %rdi      # 0x604a
movl %ebp, %esi
xorl %eax, %eax
callq 0x1040
jmp 0x2667
leaq 0x3ccf(%rip), %rdi      # 0x632f
callq 0x1120
xorl %ebx, %ebx
movzbl %bl, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3a3f(%rip), %rdi      # 0x60bf
xorl %ebx, %ebx
movl %r8d, %esi
movl %r12d, %edx
xorl %eax, %eax
callq 0x1040
jmp 0x2667