// File: /workspace/github_c_makefile_star2_O3/kyz[P]amostools/./amoslib.c
// Function: AMOS_print_source
int AMOS_print_source(uint8_t *src, size_t len, FILE *out,
                      struct AMOS_token *table[AMOS_TOKEN_TABLE_SIZE])
{
    uint32_t token, linelen=0, inpos, i, compiled_len = 0;
    uint8_t *line, *endline, add_space, start_of_line, label_at_eol = 0;
    int err = 0;

    /* while we have remaining input bytes */
    for (inpos = 0; inpos < len;) {
        /* skip compiled procedures */
        if (compiled_len) {
            fprintf(out, "   ' COMPILED PROCEDURE -- can't convert this to AMOS code\n");
            inpos += compiled_len + 8 - linelen;
            if (inpos > len) break;
            compiled_len = 0;
        }

        line = &src[inpos];
        linelen = line[0] * 2;
        inpos += linelen;

        /* stop if line claims to be zero length (bad data) */
        if (linelen == 0) {
            err |= 1;
            break;
        }

        /* if the line is said to be longer than we actually have bytes for,
         * mark this as an error, but continue with the bytes we have. */
        if (inpos > len) {
            err |= 1;
            linelen = len - (inpos - linelen);
        }

        //printf("LINE: ");for(i=0;i<linelen;i+=2)printf("%02X%02X ",line[i],line[i+1]);puts("");

        /* start the line with the given indent level */
        if ((i = line[1]) > 1) {
            while (i-- > 1) putc(' ', out);
        }
        add_space = 0;

        /* decode this line */
        endline = &line[linelen];
        line += 2;
        start_of_line = 1;

        while ((line < endline) && (token = amos_deek(line))) {
            line += 2;
            label_at_eol = 0;

            if (token <= 0x0018) {
                /* Tokens 0x0000 to 0x0018 are "variable" tokens. These represent
                 * variable, label and procedure names:
                 * - 0x0006 = TkVar, variable reference e.g. "X" in "Print X".
                 * - 0x000C = TkLab, label, e.g. "X:" or "190" (at the start of a line)
                 * - 0x0012 = TkPro, procedure reference, e.g. "X" in "X[42]"
                 * - 0x0018 = TkLGo, label reference, e.g. "X" in "Goto X"
                 *
                 * All these tokens have the following format:
                 * - 2 bytes: unknown purpose
                 * - 1 byte:  length of ASCII string for variable/label name
                 * - 1 byte:  flags. For TkVar, TkPro and TkLGo:
                 *            - flags & 0x01 = this is a floating point ref (eg "X#")
                 *            - flags & 0x02 = this is a string ref (eg "X$")
                 * - n bytes: ASCII string, with the above-given string length,
                 *            rounded to a multiple of two, null terminated.
                 */
                if (add_space) putc(' ', out);
                for (i = 0; i < line[2]; i++) {
                    uint8_t c = line[4+i];
                    if (!c) break;
                    if (c >= 'a' && c <= 'z') c -= ('a'-'A'); /* to uppercase */
                    putc(c, out);
                }
                if (token == 0x000C) {
                    /* if not a "line number" label, the label needs a colon */
                    if (!(line[4] >= '0' && line[4] <= '9')) putc(':', out);
                    add_space = 1;
                    label_at_eol = 1;
                }
                else {
                    if (line[3] & 0x01) putc('#', out);
                    else if (line[3] & 0x02) putc('$', out);
                    add_space = 0;
                }
                /* advance to the next token */
                line += ((line[2] & 1) ? 5 : 4) + line[2];
            }
            else if (token < 0x004E || token == 0x2B6A) {
                /* Tokens 0x0019 to 0x004D (and 0x2B6A) are "constant" tokens.
                 * They represent literal numbers and strings:
                 *
                 * - 0x001E = TkBin, a binary integer, e.g. %100101
                 * - 0x0026 = TkCh1, a string with double quotes, e.g. "hello"
                 * - 0x002E = TkCh2, a string with single quotes, e.g. 'hello'
                 * - 0x0036 = TkHex, a hexidecimal integer, e.g. $80FAA010
                 * - 0x003E = TkEnt, a decimal integer, e.g. 1234567890
                 * - 0x0046 = TkFl,  a floating-point number, e.g 3.142
                 * - 0x2B6A = TkDFl, a double-precision float, e.g. 3.1415926543
                 *
                 * TkBin, TkHex, TkEnt, TkFl have this format:
                 * - 4 bytes: the value
                 *
                 * TkDFl has this format:
                 * - 8 bytes: the value
                 *
                 * TkCh1 and TkCh2 have this format:
                 * - 2 bytes: the length of the string
                 * - n bytes: the string, for the above number of bytes rounded up
                 *            to a multiple of two bytes and padded with nulls.
                 */
                if (add_space) { putc(' ', out); add_space = 0; }
                switch (token) {
                case 0x001E: /* TkBin */
                    print_binary(out, amos_leek(line)); line += 4;
                    break;
                case 0x0026: /* TkCh1 */
                    line += print_string(out, line, '\"');
                    break;
                case 0x002E: /* TkCh2 */
                    line += print_string(out, line, '\'');
                    break;
                case 0x0036: /* TkHex */
                    fprintf(out, "$%X", amos_leek(line)); line += 4;
                    break;
                case 0x003E: /* TkEnt */
                    fprintf(out, "%d", (int) amos_leek(line)); line += 4;
                    break;
                case 0x0046: /* TkFl */
                    print_float(out, amos_leek(line)); line += 4;
                    break;
                case 0x2B6A:
                    print_double(out, amos_leek(line), amos_leek(line+4)); line += 8;
                    break;
                default:
                    fprintf(out, "Illegal_Constant_%04X", token);
                    err |= 2;
                }
            }
            else {
                char *tok = NULL;
                int key;
                /* all other tokens: 0x004E to 0xFFFF
                 *
                 * other than the extension tokens, these are actual instructions,
                 * functions or system variables which reside in AMOS's token table.
                 * The offset given leads to the handlers for these instructions,
                 * as well as their name and what would be correct parameters.
                 *
                 * AMOS allows "extensions" to the language. They have a token table
                 * just like AMOS, each extension has its own table.
                 *
                 * The extension token is token 0x004E and has this format:
                 * - 1 byte:  extension number [1-25]
                 * - 1 byte:  unused
                 * - 2 bytes: offset into extension's token table
                 *
                 * Other than this, some tokens in the core language have a special
                 * format. They are:
                 *
                 * TkRem1 (0x064A) and TkRem2 (0x0652):
                 * - 1 byte:  unused
                 * - 1 byte:  length of the remark
                 * - n bytes: the remark -- ASCII text, null terminated,
                 *            padded to a multiple of two bytes.
                 *
                 * TkFor (0x023C), TkRpt (0x0250), TkWhl (0x0268), TkDo (0x027E),
                 * TkIf (0x02BE), TkElse (0x02D0), TkData (0x0404) and AMOS Pro's
                 * TkElsI (0x25A4)
                 * - 2 bytes: unknown purpose
                 *
                 * TkExIf (0x0290), TkExit (0x029E) and TkOn (0x0316):
                 * - 4 bytes: unknown purpose
                 *
                 * TkProc (0x0376)
                 * - 4 bytes: number of bytes to corresponding ENDPROC line
                 *            (start of line + 8 + above = start of ENDPROC line)
                 *            (start of line + 8 + 6 + above = line _after_ ENDPROC)
                 * - 2 bytes: part of seed for encryption
                 * - 1 byte: flags:
                 *   - flags & 0x80 -- procedure is folded
                 *   - flags & 0x40 -- procedure is locked and should not be unfolded
                 *   - flags & 0x20 -- procedure is currently encrypted
                 *   - flags & 0x10 -- procedure contains compiled code, not tokens
                 * - 1 byte: part of seed for encryption
                 *
                 * TkEqu (0x2A40), TkLVO (0x2A4A), TkStru (0x2A54), TkStruS (0x2A64)
                 * - 4 bytes: value of the equate
                 * - 1 byte: type of the equate (0-7)
                 * - 1 byte: unknown purpose
                 */
                if (token == 0x004E) {
                    key = line[0] << 16 | amos_deek(&line[2]);
                    line += 4;
                }
                else {
                    key = token; /* slot 0 */
                }

                /* lookup token */
                int tidx = (key >> 1) % AMOS_TOKEN_TABLE_SIZE;
                for (struct AMOS_token *e = table[tidx]; e; e = e->next) {
                    if (e->key == key) {
                        tok = e->text;
                        break;
                    }
                }

                if (tok) {
                    char type = *tok++;
                    char is_paren = (token == 0x0074);
                    char is_func = (type == 'O' || type == '0' || type == '1' ||
                                    type == '2' || type == 'V');
                    if (!is_func && !start_of_line) add_space = 1;
                    if (!is_paren && add_space && *tok != ' ') putc(' ', out);
                    fprintf(out, "%s", tok);
                    add_space = (type == 'I');
                }
                else {
                    /* unknown token */
                    fprintf(out, " Extension_%d_%04X", key >> 16, key & 0xFFFF);
                    add_space = 1;
                    err |= 4;
                }


                /* special tokens in the core language with extra data after them */
                switch (token) {
                case 0x064A: /* TkRem1 */
                case 0x0652: /* TkRem2 */
                    fprintf(out, "%s", &line[2]);
                    i = line[1]; line += 2 + i; if (i & 1) line++;
                    break;

                case 0x023C: /* TkFor */
                case 0x0250: /* TkRpt */
                case 0x0268: /* TkWhl */
                case 0x027E: /* TkDo */
                case 0x02BE: /* TkIf */
                case 0x02D0: /* TkElse */
                case 0x0404: /* TkData */
                case 0x25A4: /* TkElsI */
                    line += 2;
                    break;

                case 0x0290: /* TkExIf */
                case 0x029E: /* TkExit */
                case 0x0316: /* TkOn */
                    line += 4;
                    break;

                case 0x0376: /* TkProc */
                    if (line[6] & 0x20) AMOS_decrypt_procedure(line-4, len - (inpos-linelen));
                    if (line[6] & 0x10) compiled_len = amos_leek(&line[0]);
                    line += 8;
                    break;

                case 0x2A40: /* Equ */
                case 0x2A4A: /* Lvo */
                case 0x2A54: /* Struc */
                case 0x2A64: /* Struct */
                    line += 6;
                    break;
                }
            }
            start_of_line = 0;
        }
        if (add_space && !label_at_eol) putc(' ', out);
        putc('\n', out);
    }
    return err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rcx, 0x58(%rsp)
testq %rsi, %rsi
je 0x1c4f
movq %rdx, %r14
movq %rsi, %r13
movq %rdi, %rbx
xorl %ebp, %ebp
movl $0x0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movl $0x0, 0xc(%rsp)
movl $0x0, 0x28(%rsp)
movq %rsi, 0x38(%rsp)
movq %rdi, 0x30(%rsp)
movq 0x20(%rsp), %r15
testl %r15d, %r15d
je 0x14d4
movl $0x3b, %esi
movl $0x1, %edx
leaq 0x1b67(%rip), %rdi      # 0x301a
movq %r14, %rcx
callq 0x11e0
addl 0x10(%rsp), %r15d
subl %ebp, %r15d
addl $0x8, %r15d
movq %r15, %r12
cmpq %r13, %r15
jbe 0x14de
jmp 0x1c5e
movl 0x10(%rsp), %eax
movl %eax, %r12d
movl %eax, %r15d
movzbl (%rbx,%r12), %eax
testl %eax, %eax
je 0x1c59
addq %rbx, %r12
movl %eax, %ecx
addl %eax, %ecx
leal (%r15,%rax,2), %eax
movl %eax, 0x10(%rsp)
movl %eax, %edx
movl %r13d, %eax
subl %r15d, %eax
xorl %ebx, %ebx
movq %rdx, 0x40(%rsp)
cmpq %r13, %rdx
cmovbel %ecx, %eax
movl %eax, 0x14(%rsp)
seta %bpl
movzbl 0x1(%r12), %r13d
cmpl $0x2, %r13d
jb 0x1539
decl %r13d
movl $0x20, %edi
movq %r14, %rsi
callq 0x1150
cmpl $0x1, %r13d
ja 0x1523
movb %bpl, %bl
orl %ebx, 0xc(%rsp)
movq $0x0, 0x20(%rsp)
movl 0x14(%rsp), %ebp
cmpl $0x3, %ebp
jb 0x1be4
movzwl 0x2(%r12), %eax
rolw $0x8, %ax
testw %ax, %ax
movq 0x38(%rsp), %r13
je 0x1bf5
movl %ebp, %ecx
addq %r12, %rcx
movq %rcx, 0x28(%rsp)
addq $0x2, %r12
movl 0x10(%rsp), %ecx
subl %ebp, %ecx
subq %rcx, %r13
movq %r13, 0x50(%rsp)
movzwl %ax, %ebx
xorl %r13d, %r13d
xorl %eax, %eax
movq $0x0, 0x20(%rsp)
leaq 0x2(%r12), %rbp
cmpl $0x18, %ebx
ja 0x1617
testb %r13b, %r13b
je 0x15b7
movl $0x20, %edi
movq %r14, %rsi
callq 0x1150
cmpb $0x0, 0x4(%r12)
je 0x15f6
xorl %r15d, %r15d
movb 0x6(%r12,%r15), %al
testb %al, %al
je 0x15f6
leal -0x61(%rax), %ecx
leal -0x20(%rax), %edx
cmpb $0x1a, %cl
movzbl %al, %eax
movzbl %dl, %ecx
cmovael %eax, %ecx
movzbl %cl, %edi
movq %r14, %rsi
callq 0x1150
incq %r15
movzbl 0x4(%r12), %eax
cmpq %rax, %r15
jb 0x15c2
cmpl $0xc, %ebx
jne 0x1679
movb 0x6(%r12), %al
addb $-0x30, %al
movl $0x3a, %edi
movb $0x1, %r13b
cmpb $0xa, %al
jae 0x17c7
jmp 0x17cf
cmpl $0x4e, %ebx
setae %cl
cmpl $0x2b6a, %ebx           # imm = 0x2B6A
setne %dl
testb %dl, %cl
jne 0x169c
testb %r13b, %r13b
je 0x163c
movl $0x20, %edi
movq %r14, %rsi
callq 0x1150
cmpl $0x35, %ebx
jle 0x181c
cmpl $0x45, %ebx
jg 0x1847
cmpl $0x36, %ebx
je 0x19cf
cmpl $0x3e, %ebx
jne 0x19af
movl 0x2(%r12), %edx
bswapl %edx
xorl %r13d, %r13d
movq %r14, %rdi
leaq 0x19e6(%rip), %rsi      # 0x305a
jmp 0x19e3
movzbl 0x5(%r12), %eax
testb $0x1, %al
jne 0x17bf
movl $0x24, %edi
xorl %r13d, %r13d
testb $0x2, %al
jne 0x17c7
jmp 0x17cf
movl %ebx, %ecx
cmpl $0x4e, %ebx
jne 0x16c6
movzbl 0x2(%r12), %edx
shll $0x10, %edx
movzbl 0x4(%r12), %esi
shll $0x8, %esi
movzbl 0x5(%r12), %ecx
orl %edx, %ecx
orl %esi, %ecx
addq $0x6, %r12
movq %r12, %rbp
movl %ecx, %edx
shrl %edx
imulq $0x7e6150b, %rdx, %rsi  # imm = 0x7E6150B
shrq $0x28, %rsi
imull $0x2069, %esi, %esi     # imm = 0x2069
subl %esi, %edx
movq 0x58(%rsp), %rsi
leaq (%rsi,%rdx,8), %r12
movq (%r12), %r12
testq %r12, %r12
je 0x1756
cmpl %ecx, 0x8(%r12)
jne 0x16e6
movb 0xc(%r12), %r15b
addq $0xd, %r12
leal -0x30(%r15), %ecx
cmpb $0x27, %cl
setae %dl
movabsq $0x3f7ffffff8, %rsi     # imm = 0x3F7FFFFFF8
shrq %cl, %rsi
testb %r13b, %r13b
setne %cl
cmpl $0x74, %ebx
je 0x1741
orb %sil, %dl
andb %dl, %al
orb %al, %cl
testb $0x1, %cl
je 0x1741
cmpb $0x20, (%r12)
je 0x1741
movl $0x20, %edi
movq %r14, %rsi
callq 0x1150
movq %r12, %rdi
movq %r14, %rsi
callq 0x1120
cmpb $0x49, %r15b
sete %r13b
jmp 0x1777
movl %ecx, %edx
shrl $0x10, %edx
movzwl %cx, %ecx
movq %r14, %rdi
leaq 0x190b(%rip), %rsi      # 0x3073
xorl %eax, %eax
callq 0x1160
orl $0x4, 0xc(%rsp)
movb $0x1, %r13b
movzwl %bx, %eax
xorl %esi, %esi
cmpl $0x375, %eax            # imm = 0x375
jg 0x17eb
cmpl $0x28f, %eax            # imm = 0x28F
jle 0x190b
cmpl $0x2bd, %eax            # imm = 0x2BD
jle 0x1a67
cmpl $0x2be, %eax            # imm = 0x2BE
je 0x1aeb
cmpl $0x2d0, %eax            # imm = 0x2D0
je 0x1aeb
cmpl $0x316, %eax            # imm = 0x316
je 0x1a79
jmp 0x1bb2
movl $0x23, %edi
xorl %r13d, %r13d
movq %r14, %rsi
callq 0x1150
movzbl 0x4(%r12), %eax
movl %eax, %ecx
andl $0x1, %ecx
addl %eax, %ecx
addq %rcx, %rbp
addq $0x4, %rbp
movl %r13d, %esi
jmp 0x1bb2
cmpl $0x651, %eax            # imm = 0x651
jg 0x193a
cmpl $0x376, %eax            # imm = 0x376
je 0x1a82
cmpl $0x404, %eax            # imm = 0x404
je 0x1aeb
cmpl $0x64a, %eax            # imm = 0x64A
je 0x1ac3
jmp 0x1bb2
cmpl $0x1e, %ebx
je 0x1966
cmpl $0x26, %ebx
je 0x1a4a
cmpl $0x2e, %ebx
jne 0x19af
movq %r14, %rdi
movq %rbp, %rsi
movl $0x27, %edx
jmp 0x1a55
cmpl $0x46, %ebx
je 0x19f3
cmpl $0x2b6a, %ebx           # imm = 0x2B6A
jne 0x19af
movzbl 0x2(%r12), %ebx
shll $0x18, %ebx
movzbl 0x3(%r12), %r15d
shll $0x10, %r15d
orl %r15d, %ebx
shrl $0x14, %ebx
andl $0x7ff, %ebx            # imm = 0x7FF
je 0x1b33
movzbl 0x4(%r12), %r13d
shll $0x8, %r13d
movzbl 0x5(%r12), %ebp
movl 0x6(%r12), %eax
bswapl %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movsd %xmm0, 0x18(%rsp)
leal -0x433(%rbx), %edi
movsd 0x1754(%rip), %xmm0     # 0x3008
callq 0x1060
mulsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
andl $0xf0000, %r15d         # imm = 0xF0000
orl %ebp, %r15d
leal (%r15,%r13), %eax
addl $0x100000, %eax         # imm = 0x100000
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x48(%rsp)
addl $0xfffffbed, %ebx       # imm = 0xFFFFFBED
movsd 0x1715(%rip), %xmm0     # 0x3008
movl %ebx, %edi
callq 0x1060
mulsd 0x48(%rsp), %xmm0
addsd 0x18(%rsp), %xmm0
jmp 0x1b37
leal -0x23c(%rax), %ecx
cmpl $0x2c, %ecx
ja 0x192a
movabsq $0x100000100001, %rdx   # imm = 0x100000100001
btq %rcx, %rdx
jb 0x1aeb
cmpl $0x27e, %eax            # imm = 0x27E
je 0x1aeb
jmp 0x1bb2
leal -0x2a40(%rax), %ecx
cmpl $0x24, %ecx
ja 0x1ab1
movabsq $0x1000100401, %rdx     # imm = 0x1000100401
btq %rcx, %rdx
jae 0x1ab1
addq $0x6, %rbp
jmp 0x1bb0
movl 0x2(%r12), %eax
bswapl %eax
movb $0x0, 0x80(%rsp)
leaq 0x80(%rsp), %rdx
movl %eax, %ecx
movl %eax, %esi
andb $0x1, %sil
orb $0x30, %sil
movb %sil, -0x1(%rdx)
decq %rdx
shrl %ecx
cmpl $0x1, %eax
movl %ecx, %eax
ja 0x197f
xorl %r13d, %r13d
movq %r14, %rdi
leaq 0x18cc(%rip), %rsi      # 0x3272
xorl %eax, %eax
callq 0x1160
jmp 0x19ea
xorl %r13d, %r13d
movq %r14, %rdi
leaq 0x16a1(%rip), %rsi      # 0x305d
movl %ebx, %edx
xorl %eax, %eax
callq 0x1160
orl $0x2, 0xc(%rsp)
jmp 0x1bb0
movl 0x2(%r12), %edx
bswapl %edx
xorl %r13d, %r13d
movq %r14, %rdi
leaq 0x1673(%rip), %rsi      # 0x3056
xorl %eax, %eax
callq 0x1160
addq $0x6, %r12
jmp 0x1bad
movzbl 0x5(%r12), %edi
andl $0x7f, %edi
je 0x1af4
movzbl 0x2(%r12), %eax
shll $0x10, %eax
movzbl 0x3(%r12), %ecx
shll $0x8, %ecx
orl %eax, %ecx
movzbl 0x4(%r12), %eax
orl %ecx, %eax
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
movss %xmm0, 0x18(%rsp)
addl $-0x58, %edi
movss 0x15da(%rip), %xmm0     # 0x3010
callq 0x11d0
mulss 0x18(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
jmp 0x1af7
movq %r14, %rdi
movq %rbp, %rsi
movl $0x22, %edx
callq 0x1c74
movl %eax, %eax
addq %rax, %rbp
xorl %r13d, %r13d
jmp 0x1bb0
cmpl $0x290, %eax            # imm = 0x290
je 0x1a79
cmpl $0x29e, %eax            # imm = 0x29E
jne 0x1bb2
addq $0x4, %rbp
jmp 0x1bb0
movb 0x6(%rbp), %al
testb $0x20, %al
je 0x1a9a
leaq -0x4(%rbp), %rdi
movq 0x50(%rsp), %rsi
callq 0x1ce8
movb 0x6(%rbp), %al
testb $0x10, %al
je 0x1aa8
movl (%rbp), %eax
bswapl %eax
movq %rax, 0x20(%rsp)
addq $0x8, %rbp
jmp 0x1bb0
cmpl $0x25a4, %eax           # imm = 0x25A4
je 0x1aeb
cmpl $0x652, %eax            # imm = 0x652
jne 0x1bb2
leaq 0x2(%rbp), %rdi
movq %r14, %rsi
callq 0x1120
movzbl 0x1(%rbp), %eax
leaq (%rax,%rbp), %rcx
addq $0x2, %rcx
andl $0x1, %eax
addq %rcx, %rax
xorl %esi, %esi
movq %rax, %rbp
jmp 0x1bb2
addq $0x2, %rbp
jmp 0x1bb0
xorps %xmm0, %xmm0
movl $0x14, %esi
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
leaq 0x1779(%rip), %rdx      # 0x3284
movb $0x1, %al
callq 0x1100
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1120
movzbl (%rbx), %ecx
testl %ecx, %ecx
je 0x1b8d
cmpl $0x2e, %ecx
je 0x1ba6
cmpl $0x45, %ecx
je 0x1ba6
incq %rbx
jmp 0x1b1d
xorpd %xmm0, %xmm0
movl $0x1e, %esi
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
leaq 0x173f(%rip), %rdx      # 0x328a
movb $0x1, %al
callq 0x1100
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1120
movzbl (%rbx), %ecx
testl %ecx, %ecx
je 0x1b6e
cmpl $0x2e, %ecx
je 0x1b87
incq %rbx
jmp 0x1b5d
movl $0x2, %esi
movl $0x1, %edx
leaq 0x1708(%rip), %rdi      # 0x3287
movq %r14, %rcx
callq 0x11e0
addq $0xa, %r12
jmp 0x1baa
movl $0x2, %esi
movl $0x1, %edx
leaq 0x16e9(%rip), %rdi      # 0x3287
movq %r14, %rcx
callq 0x11e0
addq $0x6, %r12
xorl %r13d, %r13d
movq %r12, %rbp
xorl %esi, %esi
cmpq 0x28(%rsp), %rbp
jae 0x1bd2
movzwl (%rbp), %eax
rolw $0x8, %ax
movzwl %ax, %ebx
movb $0x1, %al
movq %rbp, %r12
testw %bx, %bx
jne 0x159b
testb %r13b, %r13b
sete %al
movq 0x38(%rsp), %r13
movq 0x30(%rsp), %rbx
jmp 0x1c09
movq 0x38(%rsp), %r13
movq 0x30(%rsp), %rbx
movq 0x40(%rsp), %r12
jmp 0x1c37
movq $0x0, 0x20(%rsp)
movb $0x1, %al
movq 0x30(%rsp), %rbx
movl 0x28(%rsp), %esi
testb %sil, %sil
setne %cl
orb %al, %cl
movq 0x40(%rsp), %r12
je 0x1c1e
movl %esi, 0x28(%rsp)
jmp 0x1c33
movl $0x20, %edi
movq %r14, %rsi
callq 0x1150
movl $0x0, 0x28(%rsp)
movl 0x14(%rsp), %ebp
movl $0xa, %edi
movq %r14, %rsi
callq 0x1150
cmpq %r13, %r12
jb 0x1498
jmp 0x1c5e
movl $0x0, 0xc(%rsp)
jmp 0x1c5e
orl $0x1, 0xc(%rsp)
movl 0xc(%rsp), %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq