// File: tomfunkhouser[P]gaps/pkgs/png/inftrees.c
// Function: inflate_table
int ZLIB_INTERNAL inflate_table(type, lens, codes, table, bits, work)
codetype type;
unsigned short FAR *lens;
unsigned codes;
code FAR * FAR *table;
unsigned FAR *bits;
unsigned short FAR *work;
{
    unsigned len;               /* a code's length in bits */
    unsigned sym;               /* index of code symbols */
    unsigned min, max;          /* minimum and maximum code lengths */
    unsigned root;              /* number of index bits for root table */
    unsigned curr;              /* number of index bits for current table */
    unsigned drop;              /* code bits to drop for sub-table */
    int left;                   /* number of prefix codes available */
    unsigned used;              /* code entries in table used */
    unsigned huff;              /* Huffman code */
    unsigned incr;              /* for incrementing code, index */
    unsigned fill;              /* index for replicating entries */
    unsigned low;               /* low bits for current root entry */
    unsigned mask;              /* mask for low root bits */
    code here;                  /* table entry for duplication */
    code FAR *next;             /* next available space in table */
    const unsigned short FAR *base;     /* base value table to use */
    const unsigned short FAR *extra;    /* extra bits table to use */
    int end;                    /* use base and extra for symbol > end */
    unsigned short count[MAXBITS+1];    /* number of codes of each length */
    unsigned short offs[MAXBITS+1];     /* offsets in table for each length */
    static const unsigned short lbase[31] = { /* Length codes 257..285 base */
        3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
        35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
    static const unsigned short lext[31] = { /* Length codes 257..285 extra */
        16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
        19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 73, 195};
    static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
        1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
        257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
        8193, 12289, 16385, 24577, 0, 0};
    static const unsigned short dext[32] = { /* Distance codes 0..29 extra */
        16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
        23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
        28, 28, 29, 29, 64, 64};

    /*
       Process a set of code lengths to create a canonical Huffman code.  The
       code lengths are lens[0..codes-1].  Each length corresponds to the
       symbols 0..codes-1.  The Huffman code is generated by first sorting the
       symbols by length from short to long, and retaining the symbol order
       for codes with equal lengths.  Then the code starts with all zero bits
       for the first code of the shortest length, and the codes are integer
       increments for the same length, and zeros are appended as the length
       increases.  For the deflate format, these bits are stored backwards
       from their more natural integer increment ordering, and so when the
       decoding tables are built in the large loop below, the integer codes
       are incremented backwards.

       This routine assumes, but does not check, that all of the entries in
       lens[] are in the range 0..MAXBITS.  The caller must assure this.
       1..MAXBITS is interpreted as that code length.  zero means that that
       symbol does not occur in this code.

       The codes are sorted by computing a count of codes for each length,
       creating from that a table of starting indices for each length in the
       sorted table, and then entering the symbols in order in the sorted
       table.  The sorted table is work[], with that space being provided by
       the caller.

       The length counts are used for other purposes as well, i.e. finding
       the minimum and maximum length codes, determining if there are any
       codes at all, checking for a valid set of lengths, and looking ahead
       at length counts to determine sub-table sizes when building the
       decoding tables.
     */

    /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */
    for (len = 0; len <= MAXBITS; len++)
        count[len] = 0;
    for (sym = 0; sym < codes; sym++)
        count[lens[sym]]++;

    /* bound code lengths, force root to be within code lengths */
    root = *bits;
    for (max = MAXBITS; max >= 1; max--)
        if (count[max] != 0) break;
    if (root > max) root = max;
    if (max == 0) {                     /* no symbols to code at all */
        here.op = (unsigned char)64;    /* invalid code marker */
        here.bits = (unsigned char)1;
        here.val = (unsigned short)0;
        *(*table)++ = here;             /* make a table to force an error */
        *(*table)++ = here;
        *bits = 1;
        return 0;     /* no symbols, but wait for decoding to report error */
    }
    for (min = 1; min < max; min++)
        if (count[min] != 0) break;
    if (root < min) root = min;

    /* check for an over-subscribed or incomplete set of lengths */
    left = 1;
    for (len = 1; len <= MAXBITS; len++) {
        left <<= 1;
        left -= count[len];
        if (left < 0) return -1;        /* over-subscribed */
    }
    if (left > 0 && (type == CODES || max != 1))
        return -1;                      /* incomplete set */

    /* generate offsets into symbol table for each length for sorting */
    offs[1] = 0;
    for (len = 1; len < MAXBITS; len++)
        offs[len + 1] = offs[len] + count[len];

    /* sort symbols by length, by symbol order within each length */
    for (sym = 0; sym < codes; sym++)
        if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym;

    /*
       Create and fill in decoding tables.  In this loop, the table being
       filled is at next and has curr index bits.  The code being used is huff
       with length len.  That code is converted to an index by dropping drop
       bits off of the bottom.  For codes where len is less than drop + curr,
       those top drop + curr - len bits are incremented through all values to
       fill the table with replicated entries.

       root is the number of index bits for the root table.  When len exceeds
       root, sub-tables are created pointed to by the root entry with an index
       of the low root bits of huff.  This is saved in low to check for when a
       new sub-table should be started.  drop is zero when the root table is
       being filled, and drop is root when sub-tables are being filled.

       When a new sub-table is needed, it is necessary to look ahead in the
       code lengths to determine what size sub-table is needed.  The length
       counts are used for this, and so count[] is decremented as codes are
       entered in the tables.

       used keeps track of how many table entries have been allocated from the
       provided *table space.  It is checked for LENS and DIST tables against
       the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in
       the initial root table size constants.  See the comments in inftrees.h
       for more information.

       sym increments through all symbols, and the loop terminates when
       all codes of length max, i.e. all codes, have been processed.  This
       routine permits incomplete codes, so another loop after this one fills
       in the rest of the decoding tables with invalid code markers.
     */

    /* set up for code type */
    switch (type) {
    case CODES:
        base = extra = work;    /* dummy value--not used */
        end = 19;
        break;
    case LENS:
        base = lbase;
        base -= 257;
        extra = lext;
        extra -= 257;
        end = 256;
        break;
    default:            /* DISTS */
        base = dbase;
        extra = dext;
        end = -1;
    }

    /* initialize state for loop */
    huff = 0;                   /* starting code */
    sym = 0;                    /* starting code symbol */
    len = min;                  /* starting code length */
    next = *table;              /* current table to fill in */
    curr = root;                /* current table index bits */
    drop = 0;                   /* current bits to drop from code for index */
    low = (unsigned)(-1);       /* trigger new sub-table when len > root */
    used = 1U << root;          /* use root table entries */
    mask = used - 1;            /* mask for comparing low */

    /* check available table space */
    if ((type == LENS && used >= ENOUGH_LENS) ||
        (type == DISTS && used >= ENOUGH_DISTS))
        return 1;

    /* process all codes and make table entries */
    for (;;) {
        /* create table entry */
        here.bits = (unsigned char)(len - drop);
        if ((int)(work[sym]) < end) {
            here.op = (unsigned char)0;
            here.val = work[sym];
        }
        else if ((int)(work[sym]) > end) {
            here.op = (unsigned char)(extra[work[sym]]);
            here.val = base[work[sym]];
        }
        else {
            here.op = (unsigned char)(32 + 64);         /* end of block */
            here.val = 0;
        }

        /* replicate for those indices with low len bits equal to huff */
        incr = 1U << (len - drop);
        fill = 1U << curr;
        min = fill;                 /* save offset to next table */
        do {
            fill -= incr;
            next[(huff >> drop) + fill] = here;
        } while (fill != 0);

        /* backwards increment the len-bit code huff */
        incr = 1U << (len - 1);
        while (huff & incr)
            incr >>= 1;
        if (incr != 0) {
            huff &= incr - 1;
            huff += incr;
        }
        else
            huff = 0;

        /* go to next symbol, update count, len */
        sym++;
        if (--(count[len]) == 0) {
            if (len == max) break;
            len = lens[work[sym]];
        }

        /* create new sub-table if needed */
        if (len > root && (huff & mask) != low) {
            /* if first time, transition to sub-tables */
            if (drop == 0)
                drop = root;

            /* increment past last table */
            next += min;            /* here min is 1 << curr */

            /* determine length of next table */
            curr = len - drop;
            left = (int)(1 << curr);
            while (curr + drop < max) {
                left -= count[curr + drop];
                if (left <= 0) break;
                curr++;
                left <<= 1;
            }

            /* check for enough space */
            used += 1U << curr;
            if ((type == LENS && used >= ENOUGH_LENS) ||
                (type == DISTS && used >= ENOUGH_DISTS))
                return 1;

            /* point entry in root table to sub-table */
            low = huff & mask;
            (*table)[low].op = (unsigned char)curr;
            (*table)[low].bits = (unsigned char)root;
            (*table)[low].val = (unsigned short)(next - *table);
        }
    }

    /*
       Fill in rest of table for incomplete codes.  This loop is similar to the
       loop above in incrementing huff for table indices.  It is assumed that
       len is equal to curr + drop, so there is no loop needed to increment
       through high index bits.  When the current sub-table is filled, the loop
       drops back to the root table to fill in any remaining entries there.
     */
    here.op = (unsigned char)64;                /* invalid code marker */
    here.bits = (unsigned char)(len - drop);
    here.val = (unsigned short)0;
    while (huff != 0) {
        /* when done with sub-table, drop back to root table */
        if (drop != 0 && (huff & mask) != low) {
            drop = 0;
            len = root;
            next = *table;
            here.bits = (unsigned char)len;
        }

        /* put invalid code marker in table */
        next[huff >> drop] = here;

        /* backwards increment the len-bit code huff */
        incr = 1U << (len - 1);
        while (huff & incr)
            incr >>= 1;
        if (incr != 0) {
            huff &= incr - 1;
            huff += incr;
        }
        else
            huff = 0;
    }

    /* set return parameters */
    *table += used;
    *bits = root;
    return 0;
}

// Assembly:
subq $0x68, %rsp
movl %edi, 0x60(%rsp)
movq %rsi, 0x58(%rsp)
movl %edx, 0x54(%rsp)
movq %rcx, 0x48(%rsp)
movq %r8, 0x40(%rsp)
movq %r9, 0x38(%rsp)
movl $0x0, 0x34(%rsp)
cmpl $0xf, 0x34(%rsp)
ja 0x11e4d7
movl 0x34(%rsp), %eax
movw $0x0, -0x50(%rsp,%rax,2)
movl 0x34(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x34(%rsp)
jmp 0x11e4b8
movl $0x0, 0x30(%rsp)
movl 0x30(%rsp), %eax
cmpl 0x54(%rsp), %eax
jae 0x11e511
movq 0x58(%rsp), %rax
movl 0x30(%rsp), %ecx
movzwl (%rax,%rcx,2), %eax
movw -0x50(%rsp,%rax,2), %cx
addw $0x1, %cx
movw %cx, -0x50(%rsp,%rax,2)
movl 0x30(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x30(%rsp)
jmp 0x11e4df
movq 0x40(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x24(%rsp)
movl $0xf, 0x28(%rsp)
cmpl $0x1, 0x28(%rsp)
jb 0x11e54a
movl 0x28(%rsp), %eax
movzwl -0x50(%rsp,%rax,2), %eax
cmpl $0x0, %eax
je 0x11e53b
jmp 0x11e54a
jmp 0x11e53d
movl 0x28(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x28(%rsp)
jmp 0x11e524
movl 0x24(%rsp), %eax
cmpl 0x28(%rsp), %eax
jbe 0x11e55c
movl 0x28(%rsp), %eax
movl %eax, 0x24(%rsp)
cmpl $0x0, 0x28(%rsp)
jne 0x11e5bc
movb $0x40, -0x4(%rsp)
movb $0x1, -0x3(%rsp)
movw $0x0, -0x2(%rsp)
movq 0x48(%rsp), %rcx
movq (%rcx), %rax
movq %rax, %rdx
addq $0x4, %rdx
movq %rdx, (%rcx)
movl -0x4(%rsp), %ecx
movl %ecx, (%rax)
movq 0x48(%rsp), %rcx
movq (%rcx), %rax
movq %rax, %rdx
addq $0x4, %rdx
movq %rdx, (%rcx)
movl -0x4(%rsp), %ecx
movl %ecx, (%rax)
movq 0x40(%rsp), %rax
movl $0x1, (%rax)
movl $0x0, 0x64(%rsp)
jmp 0x11ec1e
movl $0x1, 0x2c(%rsp)
movl 0x2c(%rsp), %eax
cmpl 0x28(%rsp), %eax
jae 0x11e5ed
movl 0x2c(%rsp), %eax
movzwl -0x50(%rsp,%rax,2), %eax
cmpl $0x0, %eax
je 0x11e5de
jmp 0x11e5ed
jmp 0x11e5e0
movl 0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
jmp 0x11e5c4
movl 0x24(%rsp), %eax
cmpl 0x2c(%rsp), %eax
jae 0x11e5ff
movl 0x2c(%rsp), %eax
movl %eax, 0x24(%rsp)
movl $0x1, 0x18(%rsp)
movl $0x1, 0x34(%rsp)
cmpl $0xf, 0x34(%rsp)
ja 0x11e656
movl 0x18(%rsp), %eax
shll %eax
movl %eax, 0x18(%rsp)
movl 0x34(%rsp), %eax
movzwl -0x50(%rsp,%rax,2), %ecx
movl 0x18(%rsp), %eax
subl %ecx, %eax
movl %eax, 0x18(%rsp)
cmpl $0x0, 0x18(%rsp)
jge 0x11e647
movl $0xffffffff, 0x64(%rsp) # imm = 0xFFFFFFFF
jmp 0x11ec1e
jmp 0x11e649
movl 0x34(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x34(%rsp)
jmp 0x11e60f
cmpl $0x0, 0x18(%rsp)
jle 0x11e678
cmpl $0x0, 0x60(%rsp)
je 0x11e66b
cmpl $0x1, 0x28(%rsp)
je 0x11e678
movl $0xffffffff, 0x64(%rsp) # imm = 0xFFFFFFFF
jmp 0x11ec1e
movw $0x0, -0x6e(%rsp)
movl $0x1, 0x34(%rsp)
cmpl $0xf, 0x34(%rsp)
jae 0x11e6c0
movl 0x34(%rsp), %eax
movzwl -0x70(%rsp,%rax,2), %eax
movl 0x34(%rsp), %ecx
movzwl -0x50(%rsp,%rcx,2), %ecx
addl %ecx, %eax
movw %ax, %cx
movl 0x34(%rsp), %eax
addl $0x1, %eax
movl %eax, %eax
movw %cx, -0x70(%rsp,%rax,2)
movl 0x34(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x34(%rsp)
jmp 0x11e687
movl $0x0, 0x30(%rsp)
movl 0x30(%rsp), %eax
cmpl 0x54(%rsp), %eax
jae 0x11e726
movq 0x58(%rsp), %rax
movl 0x30(%rsp), %ecx
movzwl (%rax,%rcx,2), %eax
cmpl $0x0, %eax
je 0x11e717
movl 0x30(%rsp), %eax
movw %ax, %dx
movq 0x38(%rsp), %rax
movq 0x58(%rsp), %rcx
movl 0x30(%rsp), %esi
movzwl (%rcx,%rsi,2), %ecx
movl %ecx, %esi
movw -0x70(%rsp,%rsi,2), %cx
movw %cx, %di
addw $0x1, %di
movw %di, -0x70(%rsp,%rsi,2)
movzwl %cx, %ecx
movw %dx, (%rax,%rcx,2)
jmp 0x11e719
movl 0x30(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x30(%rsp)
jmp 0x11e6c8
movl 0x60(%rsp), %eax
movl %eax, -0x74(%rsp)
testl %eax, %eax
je 0x11e73f
jmp 0x11e734
movl -0x74(%rsp), %eax
subl $0x1, %eax
je 0x11e758
jmp 0x11e79a
movq 0x38(%rsp), %rax
movq %rax, -0x20(%rsp)
movq %rax, -0x18(%rsp)
movl $0x13, -0x24(%rsp)
jmp 0x11e7ba
leaq 0x1fce1(%rip), %rax     # 0x13e440
movq %rax, -0x18(%rsp)
movq -0x18(%rsp), %rax
addq $-0x202, %rax           # imm = 0xFDFE
movq %rax, -0x18(%rsp)
leaq 0x1fd05(%rip), %rax     # 0x13e480
movq %rax, -0x20(%rsp)
movq -0x20(%rsp), %rax
addq $-0x202, %rax           # imm = 0xFDFE
movq %rax, -0x20(%rsp)
movl $0x100, -0x24(%rsp)     # imm = 0x100
jmp 0x11e7ba
leaq 0x1fd1f(%rip), %rax     # 0x13e4c0
movq %rax, -0x18(%rsp)
leaq 0x1fd53(%rip), %rax     # 0x13e500
movq %rax, -0x20(%rsp)
movl $0xffffffff, -0x24(%rsp) # imm = 0xFFFFFFFF
movl $0x0, 0x10(%rsp)
movl $0x0, 0x30(%rsp)
movl 0x2c(%rsp), %eax
movl %eax, 0x34(%rsp)
movq 0x48(%rsp), %rax
movq (%rax), %rax
movq %rax, -0x10(%rsp)
movl 0x24(%rsp), %eax
movl %eax, 0x20(%rsp)
movl $0x0, 0x1c(%rsp)
movl $0xffffffff, 0x4(%rsp)  # imm = 0xFFFFFFFF
movl 0x24(%rsp), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, 0x14(%rsp)
movl 0x14(%rsp), %eax
subl $0x1, %eax
movl %eax, (%rsp)
cmpl $0x1, 0x60(%rsp)
jne 0x11e821
cmpl $0x354, 0x14(%rsp)      # imm = 0x354
jae 0x11e832
cmpl $0x2, 0x60(%rsp)
jne 0x11e83f
cmpl $0x250, 0x14(%rsp)      # imm = 0x250
jb 0x11e83f
movl $0x1, 0x64(%rsp)
jmp 0x11ec1e
jmp 0x11e841
movl 0x34(%rsp), %eax
subl 0x1c(%rsp), %eax
movb %al, -0x3(%rsp)
movq 0x38(%rsp), %rax
movl 0x30(%rsp), %ecx
movzwl (%rax,%rcx,2), %eax
cmpl -0x24(%rsp), %eax
jge 0x11e879
movb $0x0, -0x4(%rsp)
movq 0x38(%rsp), %rax
movl 0x30(%rsp), %ecx
movw (%rax,%rcx,2), %ax
movw %ax, -0x2(%rsp)
jmp 0x11e8d1
movq 0x38(%rsp), %rax
movl 0x30(%rsp), %ecx
movzwl (%rax,%rcx,2), %eax
cmpl -0x24(%rsp), %eax
jle 0x11e8c3
movq -0x20(%rsp), %rax
movq 0x38(%rsp), %rcx
movl 0x30(%rsp), %edx
movzwl (%rcx,%rdx,2), %ecx
movw (%rax,%rcx,2), %ax
movb %al, -0x4(%rsp)
movq -0x18(%rsp), %rax
movq 0x38(%rsp), %rcx
movl 0x30(%rsp), %edx
movzwl (%rcx,%rdx,2), %ecx
movw (%rax,%rcx,2), %ax
movw %ax, -0x2(%rsp)
jmp 0x11e8cf
movb $0x60, -0x4(%rsp)
movw $0x0, -0x2(%rsp)
jmp 0x11e8d1
movl 0x34(%rsp), %ecx
subl 0x1c(%rsp), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, 0xc(%rsp)
movl 0x20(%rsp), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, 0x8(%rsp)
movl 0x8(%rsp), %eax
movl %eax, 0x2c(%rsp)
movl 0xc(%rsp), %ecx
movl 0x8(%rsp), %eax
subl %ecx, %eax
movl %eax, 0x8(%rsp)
movq -0x10(%rsp), %rax
movl 0x10(%rsp), %edx
movl 0x1c(%rsp), %ecx
shrl %cl, %edx
movl %edx, %ecx
addl 0x8(%rsp), %ecx
movl %ecx, %ecx
movl -0x4(%rsp), %edx
movl %edx, (%rax,%rcx,4)
cmpl $0x0, 0x8(%rsp)
jne 0x11e8fb
movl 0x34(%rsp), %ecx
subl $0x1, %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, 0xc(%rsp)
movl 0x10(%rsp), %eax
andl 0xc(%rsp), %eax
cmpl $0x0, %eax
je 0x11e959
movl 0xc(%rsp), %eax
shrl %eax
movl %eax, 0xc(%rsp)
jmp 0x11e940
cmpl $0x0, 0xc(%rsp)
je 0x11e97d
movl 0xc(%rsp), %eax
subl $0x1, %eax
andl 0x10(%rsp), %eax
movl %eax, 0x10(%rsp)
movl 0xc(%rsp), %eax
addl 0x10(%rsp), %eax
movl %eax, 0x10(%rsp)
jmp 0x11e985
movl $0x0, 0x10(%rsp)
movl 0x30(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x30(%rsp)
movl 0x34(%rsp), %eax
movl %eax, %ecx
movw -0x50(%rsp,%rcx,2), %ax
addw $-0x1, %ax
movw %ax, -0x50(%rsp,%rcx,2)
movzwl %ax, %eax
cmpl $0x0, %eax
jne 0x11e9d5
movl 0x34(%rsp), %eax
cmpl 0x28(%rsp), %eax
jne 0x11e9bb
jmp 0x11eb21
movq 0x58(%rsp), %rax
movq 0x38(%rsp), %rcx
movl 0x30(%rsp), %edx
movzwl (%rcx,%rdx,2), %ecx
movzwl (%rax,%rcx,2), %eax
movl %eax, 0x34(%rsp)
movl 0x34(%rsp), %eax
cmpl 0x24(%rsp), %eax
jbe 0x11eb1c
movl 0x10(%rsp), %eax
andl (%rsp), %eax
cmpl 0x4(%rsp), %eax
je 0x11eb1c
cmpl $0x0, 0x1c(%rsp)
jne 0x11ea03
movl 0x24(%rsp), %eax
movl %eax, 0x1c(%rsp)
movl 0x2c(%rsp), %ecx
movq -0x10(%rsp), %rax
movl %ecx, %ecx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rsp)
movl 0x34(%rsp), %eax
subl 0x1c(%rsp), %eax
movl %eax, 0x20(%rsp)
movl 0x20(%rsp), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, 0x18(%rsp)
movl 0x20(%rsp), %eax
addl 0x1c(%rsp), %eax
cmpl 0x28(%rsp), %eax
jae 0x11ea7c
movl 0x20(%rsp), %eax
addl 0x1c(%rsp), %eax
movl %eax, %eax
movzwl -0x50(%rsp,%rax,2), %ecx
movl 0x18(%rsp), %eax
subl %ecx, %eax
movl %eax, 0x18(%rsp)
cmpl $0x0, 0x18(%rsp)
jg 0x11ea65
jmp 0x11ea7c
movl 0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x20(%rsp)
movl 0x18(%rsp), %eax
shll %eax
movl %eax, 0x18(%rsp)
jmp 0x11ea35
movl 0x20(%rsp), %ecx
movl $0x1, %eax
shll %cl, %eax
addl 0x14(%rsp), %eax
movl %eax, 0x14(%rsp)
cmpl $0x1, 0x60(%rsp)
jne 0x11eaa0
cmpl $0x354, 0x14(%rsp)      # imm = 0x354
jae 0x11eab1
cmpl $0x2, 0x60(%rsp)
jne 0x11eabe
cmpl $0x250, 0x14(%rsp)      # imm = 0x250
jb 0x11eabe
movl $0x1, 0x64(%rsp)
jmp 0x11ec1e
movl 0x10(%rsp), %eax
andl (%rsp), %eax
movl %eax, 0x4(%rsp)
movl 0x20(%rsp), %eax
movb %al, %dl
movq 0x48(%rsp), %rax
movq (%rax), %rax
movl 0x4(%rsp), %ecx
movb %dl, (%rax,%rcx,4)
movl 0x24(%rsp), %eax
movb %al, %dl
movq 0x48(%rsp), %rax
movq (%rax), %rax
movl 0x4(%rsp), %ecx
movb %dl, 0x1(%rax,%rcx,4)
movq -0x10(%rsp), %rax
movq 0x48(%rsp), %rcx
movq (%rcx), %rcx
subq %rcx, %rax
sarq $0x2, %rax
movw %ax, %dx
movq 0x48(%rsp), %rax
movq (%rax), %rax
movl 0x4(%rsp), %ecx
movw %dx, 0x2(%rax,%rcx,4)
jmp 0x11e841
movb $0x40, -0x4(%rsp)
movl 0x34(%rsp), %eax
subl 0x1c(%rsp), %eax
movb %al, -0x3(%rsp)
movw $0x0, -0x2(%rsp)
cmpl $0x0, 0x10(%rsp)
je 0x11ebf3
cmpl $0x0, 0x1c(%rsp)
je 0x11eb7d
movl 0x10(%rsp), %eax
andl (%rsp), %eax
cmpl 0x4(%rsp), %eax
je 0x11eb7d
movl $0x0, 0x1c(%rsp)
movl 0x24(%rsp), %eax
movl %eax, 0x34(%rsp)
movq 0x48(%rsp), %rax
movq (%rax), %rax
movq %rax, -0x10(%rsp)
movl 0x34(%rsp), %eax
movb %al, -0x3(%rsp)
movq -0x10(%rsp), %rax
movl 0x10(%rsp), %edx
movl 0x1c(%rsp), %ecx
shrl %cl, %edx
movl %edx, %ecx
movl %ecx, %ecx
movl -0x4(%rsp), %edx
movl %edx, (%rax,%rcx,4)
movl 0x34(%rsp), %ecx
subl $0x1, %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, 0xc(%rsp)
movl 0x10(%rsp), %eax
andl 0xc(%rsp), %eax
cmpl $0x0, %eax
je 0x11ebc2
movl 0xc(%rsp), %eax
shrl %eax
movl %eax, 0xc(%rsp)
jmp 0x11eba9
cmpl $0x0, 0xc(%rsp)
je 0x11ebe6
movl 0xc(%rsp), %eax
subl $0x1, %eax
andl 0x10(%rsp), %eax
movl %eax, 0x10(%rsp)
movl 0xc(%rsp), %eax
addl 0x10(%rsp), %eax
movl %eax, 0x10(%rsp)
jmp 0x11ebee
movl $0x0, 0x10(%rsp)
jmp 0x11eb39
movl 0x14(%rsp), %edx
movq 0x48(%rsp), %rax
movq (%rax), %rcx
movl %edx, %edx
shlq $0x2, %rdx
addq %rdx, %rcx
movq %rcx, (%rax)
movl 0x24(%rsp), %ecx
movq 0x40(%rsp), %rax
movl %ecx, (%rax)
movl $0x0, 0x64(%rsp)
movl 0x64(%rsp), %eax
addq $0x68, %rsp
retq
nopw (%rax,%rax)