// File: /workspace/github_cpp_makefile_star2_O1/7shi[P]8086run/v2/bios.cpp
// Function: bios(int)
void bios(int n) {
    void intr(int);
    static uint8_t buf[512];
    static FILE *fhcopy;
    static bool hread;
    switch (n) {
        case 0x00: // #DE
            error("#DE: division exception");
            break;
        case 0x08: // timer
        {
            uint16_t low = read16(&mem[0x46c]);
            if (!++low) {
                uint16_t high = read16(&mem[0x46e]);
                if (++high >= 24) {
                    high %= 24;
                    mem[0x470] = 1;
                }
                write16(&mem[0x46e], high);
            }
            write16(&mem[0x46c], low);
            intr(0x1c);
            return;
        }
        case 0x09: // keyboard
            while (kbhit()) {
                int head = read16(&mem[0x41a]) - 0x1e;
                int tail = read16(&mem[0x41c]) - 0x1e;
                int next = (tail + 2) & 0x1f;
                if (next == head) break;
                uint16_t scanasc = decodeKey(getch());
                if (scanasc) {
                    write16(&mem[0x41e + tail], scanasc);
                    write16(&mem[0x41c], 0x1e + next);
                }
            }
            return;
        case 0x10: // video
            switch (AH) {
                case 0x00:
#ifdef _WIN32
                    system("cls");
#else
                    printf("\x1b[H\x1b[J");
                    fflush(stdout);
#endif
                    cleared = true;
                    return;
                case 0x02:
                {
#ifdef _WIN32
                    HANDLE hStd = GetStdHandle(STD_OUTPUT_HANDLE);
                    COORD pos = {DL, DH};
                    SetConsoleCursorPosition(hStd, pos);
#else
                    printf("\x1b[%d;%dH", DH + 1, DL + 1);
                    fflush(stdout);
#endif
                    return;
                }
                case 0x0e:
                    if (write(STDOUT_FILENO, &AL, 1));
                    return;
            }
            return; // ignore
        case 0x11: // get equipment list
            AX = disks[1].f ? 0x41 : 1;
            return;
        case 0x12: // get memory size
            AX = 640;
            return;
        case 0x13: // disk
        {
            switch (AH) { // ORIGINAL EXTENSIONS
                case 0xfe: // hopen
                    if (fhcopy) fclose(fhcopy);
                    hread = AL != 1;
                    CF = !(fhcopy = fopen((char *) &DS[DX], hread ? "rb" : "wb"));
                    return;
                case 0xff: // hcopy
                    if (fhcopy) {
                        if (hread) {
                            CX = fread(&DS[DX], 1, 512, fhcopy);
                        } else {
                            CX = fwrite(&DS[DX], 1, CX, fhcopy);
                        }
                        if (!CX) {
                            fclose(fhcopy);
                            fhcopy = NULL;
                        }
                    } else {
                        CX = 0;
                    }
                    return;
            }
            if (DL > 1 || !disks[DL].f) {
                CF = 1; // error
                AH = 1; // invalid
                return;
            }
            Disk *d = &disks[DL];
            int c = CH | ((CL & 0xc0) << 2), s = (CL & 0x3f) - 1;
            int lba = d->s * (d->h * c + DH) + s;
            switch (AH) {
                case 0x00: // reset disk system
                    AH = CF = 0;
                    return;
                case 0x02: // read sectors
                case 0x03: // write sectors
                    if (c >= d->c || DH >= d->h
                            || s < 0 || s >= d->s) {
                        CF = 1; // error
                        AH = 4; // sector
                        return;
                    }
                    fseek(d->f, lba << 9, SEEK_SET);
                    if (AH == 2) {
                        if (fread(&ES[BX], 512, AL, d->f) < 1) {
                            memset(&ES[BX], 0, AL << 9);
                        }
                    } else {
                        fwrite(&ES[BX], 512, AL, d->f);
                    }
                    AH = CF = 0;
                    return;
                case 0x05: // format
                    fseek(d->f, (lba - s) << 9, SEEK_SET);
                    for (int i = 0; i < d->s; ++i) {
                        fwrite(&buf, 512, 1, d->f);
                    }
                    AH = CF = 0;
                    return;
                case 0x08: // get drive params
                    AX = 0;
                    BL = d->type;
                    CH = d->c - 1;
                    CL = d->s | ((d->c >> 2) & 0xc0);
                    DH = d->h - 1;
                    DL = 1;
                    ES = DI = 0;
                    CF = 0;
                    return;
                case 0x15: // get disk type
                    AH = 1;
                    CF = 0;
                    return;
                case 0x17: // set disk type
                    CF = 0; // ignore
                    return;
                case 0x18: // set media type
                    d->c = c + 1;
                    d->s = s + 1;
                    ES = DI = 0;
                    AH = CF = 0;
                    return;
            }
            CF = 1;
            return;
        }
        case 0x14: // serial port
            CF = 1; // error
            return;
        case 0x15: // system
            switch (AH) {
                case 0x88: // get extended memory size
                    CF = 0;
                    AX = 0;
                    return;
            }
            break;
        case 0x16: // keyboard
        {
            int head = read16(&mem[0x41a]);
            int tail = read16(&mem[0x41c]);
            switch (AH) {
                case 0x00: // get keystroke
                    while (head == tail) {
                        bios(9);
                        tail = read16(&mem[0x41c]);
                    }
                    AX = read16(&mem[0x400 + head]);
                    write16(&mem[0x41a], 0x1e + ((head - 0x1c) & 0x1f));
                    return;
                case 0x01: // check for keystroke
                    if ((ZF = head == tail)) {
                        AX = 0; // empty
                    } else {
                        AX = read16(&mem[0x400 + head]);
                    }
                    return;
            }
            break;
        }
        case 0x17: // parallel port
            CF = 1; // error
            return;
        case 0x18: // boot fault
            error("Boot failed (INT 18H)");
            return;
        case 0x19: // bootstrap
            error("Bootstrap (INT 19H) not implemented");
            return;
        case 0x1a: // time
            switch (AH) {
                case 0x00: // get system time
                    AL = mem[0x470];
                    CX = read16(&mem[0x46e]);
                    DX = read16(&mem[0x46c]);
                    mem[0x470] = 0;
                    return;
                case 0x01: // set system time
                    write16(&mem[0x46e], CX);
                    write16(&mem[0x46c], DX);
                    mem[0x470] = 0;
                    return;
                case 0x02: // get RTC time
                case 0x04: // get RTC date
                {
                    time_t t = time(NULL);
                    tm *lt = localtime(&t);
                    if (AH == 2) {
                        CH = bcd(lt->tm_hour);
                        CL = bcd(lt->tm_min);
                        DH = bcd(lt->tm_sec);
                        DL = lt->tm_isdst == 1 ? 1 : 0;
                    } else {
                        CH = bcd(lt->tm_year / 100 + 19);
                        CL = bcd(lt->tm_year % 100);
                        DH = bcd(lt->tm_mon + 1);
                        DL = bcd(lt->tm_mday);
                    }
                    CF = 0;
                    return;
                }
                case 0x03: // set RTC time
                case 0x05: // set RTC date
                    return; // ignore
            }
            break;
        case 0x1b: // Control-Break handler
            return;
        case 0x1c: // timer handler
            return;
    }
    error("not implemented: int %02x,%02x", n, AH);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %edi, %ebx
cmpl $0x1c, %edi
ja 0x16dc
movl %ebx, %eax
leaq 0x6b20(%rip), %rcx      # 0x8004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x129ef4(%rip), %rax    # 0x12b3e8
movb $0x1, (%rax)
jmp 0x1dc1
leaq 0x6be3(%rip), %rdi      # 0x80e6
jmp 0x17c5
leaq 0x129e91(%rip), %r14    # 0x12b3a0
movq 0x20(%r14), %rax
movzbl (%rax), %edx
cmpl $0xff, %edx
je 0x18e2
cmpl $0xfe, %edx
jne 0x1941
movq 0x9e3b(%rip), %rdi      # 0xb370
testq %rdi, %rdi
je 0x153f
callq 0x10e0
movq (%r14), %rax
leaq 0x129e47(%rip), %rcx    # 0x12b390
movzwl 0x4(%rcx), %edi
leaq 0x129fac(%rip), %rcx    # 0x12b500
addq 0x30(%rcx), %rdi
cmpb $0x1, (%rax)
setne 0x9e16(%rip)            # 0xb378
leaq 0x6b77(%rip), %rax      # 0x80e0
leaq 0x6b73(%rip), %rsi      # 0x80e3
cmovneq %rax, %rsi
callq 0x1130
movq %rax, 0x9df0(%rip)      # 0xb370
testq %rax, %rax
leaq 0x129e5e(%rip), %rax    # 0x12b3e8
sete (%rax)
jmp 0x1dc1
leaq 0x9de7(%rip), %r14      # 0xb380
movzbl 0x41a(%r14), %r15d
movzbl 0x41b(%r14), %r12d
shll $0x8, %r12d
orq %r15, %r12
movzwl 0x41c(%r14), %eax
leaq 0x129de1(%rip), %rcx    # 0x12b3a0
movq 0x20(%rcx), %rcx
movzbl (%rcx), %ecx
cmpl $0x1, %ecx
je 0x1929
testl %ecx, %ecx
jne 0x16dc
cmpw %ax, %r12w
jne 0x15f1
movl $0x9, %edi
callq 0x14c4
cmpw 0x41c(%r14), %r12w
je 0x15dd
movzwl 0x400(%r12,%r14), %eax
leaq 0x129d8f(%rip), %rcx    # 0x12b390
movw %ax, (%rcx)
addb $0x4, %r15b
andb $0x1f, %r15b
addb $0x1e, %r15b
movb %r15b, 0x41a(%r14)
movb $0x0, 0x41b(%r14)
jmp 0x1dc1
leaq 0x129d75(%rip), %rax    # 0x12b3a0
movq 0x20(%rax), %rax
cmpb $-0x78, (%rax)
jne 0x16dc
leaq 0x129da9(%rip), %rax    # 0x12b3e8
movb $0x0, (%rax)
leaq 0x129d47(%rip), %rax    # 0x12b390
movw $0x0, (%rax)
jmp 0x1dc1
leaq 0x9d26(%rip), %rbx      # 0xb380
callq 0x7129
testl %eax, %eax
je 0x1dc1
movzwl 0x41a(%rbx), %ebp
addl $-0x1e, %ebp
movzbl 0x41c(%rbx), %r15d
leal 0x4(%r15), %r14d
andl $0x1f, %r14d
cmpl %ebp, %r14d
je 0x1dc1
movzbl 0x41d(%rbx), %r12d
callq 0x70d8
movl %eax, %edi
callq 0x6ad4
testw %ax, %ax
je 0x16c4
shll $0x8, %r12d
orl %r15d, %r12d
movw %ax, 0x400(%r12,%rbx)
leal 0x1e(%r14), %eax
movb %al, 0x41c(%rbx)
movb $0x0, 0x41d(%rbx)
cmpl %ebp, %r14d
jne 0x165a
jmp 0x1dc1
leaq 0x69e3(%rip), %rdi      # 0x80b8
xorl %eax, %eax
callq 0x20da
leaq 0x129cbd(%rip), %rax    # 0x12b3a0
movq 0x20(%rax), %rax
movzbl (%rax), %edx
leaq 0x6a2f(%rip), %rdi      # 0x8120
movl %ebx, %esi
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x20da
leaq 0x129c93(%rip), %rax    # 0x12b3a0
movq 0x20(%rax), %rcx
movzbl (%rcx), %ecx
cmpl $0xe, %ecx
je 0x1a3c
cmpl $0x2, %ecx
je 0x1a01
testl %ecx, %ecx
jne 0x1dc1
leaq 0x699b(%rip), %rdi      # 0x80d0
xorl %eax, %eax
callq 0x1030
movq 0x987d(%rip), %rax      # 0xafc0
movq (%rax), %rdi
callq 0x1120
leaq 0x129da0(%rip), %rax    # 0x12b4f2
jmp 0x14f4
leaq 0x9c22(%rip), %rax      # 0xb380
movzwl 0x46c(%rax), %ecx
incw %cx
jne 0x17a1
movzwl 0x46e(%rax), %edx
incl %edx
cmpw $0x18, %dx
jb 0x1794
movzwl %dx, %esi
imull $0xaaab, %esi, %esi     # imm = 0xAAAB
shrl $0x11, %esi
andl $-0x8, %esi
leal (%rsi,%rsi,2), %esi
subl %esi, %edx
movb $0x1, 0x470(%rax)
movb %dl, 0x46e(%rax)
movb $0x0, 0x46f(%rax)
movw %cx, 0x46c(%rax)
movl $0x1c, %edi
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x21c8
leaq 0x6937(%rip), %rdi      # 0x80fc
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x20da
leaq 0x129bc1(%rip), %r14    # 0x12b3a0
movq 0x20(%r14), %rax
movzbl (%rax), %eax
cmpq $0x5, %rax
ja 0x16dc
leaq 0x6881(%rip), %rcx      # 0x8078
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
xorl %edi, %edi
callq 0x10d0
leaq 0x8(%rsp), %rdi
movq %rax, (%rdi)
callq 0x10a0
movq 0x20(%r14), %rcx
cmpb $0x2, (%rcx)
jne 0x1a7a
movslq 0x8(%rax), %rcx
imulq $0x66666667, %rcx, %rdx # imm = 0x66666667
movq %rdx, %rsi
shrq $0x3f, %rsi
sarq $0x22, %rdx
addl %esi, %edx
movl %edx, %esi
shll $0x4, %esi
addl %edx, %edx
leal (%rdx,%rdx,4), %edx
subl %edx, %ecx
orl %esi, %ecx
movq 0x28(%r14), %rdx
movb %cl, (%rdx)
movslq 0x4(%rax), %rcx
imulq $0x66666667, %rcx, %rdx # imm = 0x66666667
movq %rdx, %rsi
shrq $0x3f, %rsi
sarq $0x22, %rdx
addl %esi, %edx
movl %edx, %esi
shll $0x4, %esi
addl %edx, %edx
leal (%rdx,%rdx,4), %edx
subl %edx, %ecx
orl %esi, %ecx
movq 0x8(%r14), %rdx
movb %cl, (%rdx)
movslq (%rax), %rcx
imulq $0x66666667, %rcx, %rdx # imm = 0x66666667
movq %rdx, %rsi
shrq $0x3f, %rsi
sarq $0x22, %rdx
addl %esi, %edx
movl %edx, %esi
shll $0x4, %esi
addl %edx, %edx
leal (%rdx,%rdx,4), %edx
subl %edx, %ecx
orl %esi, %ecx
movq 0x30(%r14), %rdx
movb %cl, (%rdx)
cmpl $0x1, 0x20(%rax)
sete %al
jmp 0x1b63
xorl %eax, %eax
cmpq $0x0, 0x989e(%rip)      # 0xb158
setne %al
shll $0x6, %eax
incl %eax
leaq 0x129ac7(%rip), %rcx    # 0x12b390
movw %ax, (%rcx)
jmp 0x1dc1
leaq 0x129ab8(%rip), %rax    # 0x12b390
movw $0x280, (%rax)          # imm = 0x280
jmp 0x1dc1
movq 0x9a87(%rip), %rcx      # 0xb370
testq %rcx, %rcx
je 0x1bde
leaq 0x129a97(%rip), %rbx    # 0x12b390
movzwl 0x4(%rbx), %edi
leaq 0x129bfc(%rip), %rax    # 0x12b500
addq 0x30(%rax), %rdi
cmpb $0x1, 0x9a69(%rip)      # 0xb378
jne 0x1bf0
movl $0x1, %esi
movl $0x200, %edx            # imm = 0x200
callq 0x11c0
jmp 0x1bfe
leaq 0x129ab5(%rip), %rcx    # 0x12b3e5
cmpw %ax, %r12w
sete (%rcx)
jne 0x1a6c
xorl %eax, %eax
jmp 0x18c2
movq 0x10(%r14), %rcx
movzbl (%rcx), %ecx
cmpq $0x1, %rcx
ja 0x1a5a
leaq (%rcx,%rcx,2), %rcx
leaq 0x97e3(%rip), %rsi      # 0xb140
movq (%rsi,%rcx,8), %rdi
testq %rdi, %rdi
je 0x1a5a
leaq (%rsi,%rcx,8), %r15
movq 0x8(%r14), %rcx
movq 0x28(%r14), %r8
movzbl (%rcx), %ecx
leal (,%rcx,4), %esi
movb (%r8), %sil
andl $0x3f, %ecx
cmpl $0x14, %edx
jg 0x1c27
cmpl $0x8, %edx
ja 0x14ed
movl 0x10(%r15), %r10d
movl 0x14(%r15), %r9d
movl %esi, %r8d
imull %r10d, %r8d
movq 0x30(%r14), %r11
movzbl (%r11), %r11d
addl %r11d, %r8d
imull %r9d, %r8d
movl %edx, %edx
leaq 0x66d1(%rip), %rbx      # 0x8090
movslq (%rbx,%rdx,4), %rdx
addq %rbx, %rdx
jmpq *%rdx
cmpl 0xc(%r15), %esi
jge 0x19ef
cmpl %r11d, %r10d
setle %dl
testl %ecx, %ecx
sete %sil
orb %dl, %sil
cmpl %r9d, %ecx
setg %dl
orb %sil, %dl
cmpb $0x1, %dl
jne 0x1d3f
leaq 0x1299f2(%rip), %rcx    # 0x12b3e8
movb $0x1, (%rcx)
movb $0x4, (%rax)
jmp 0x1dc1
movq 0x10(%rax), %rcx
movq 0x30(%rax), %rax
movzbl (%rax), %esi
incl %esi
movzbl (%rcx), %edx
incl %edx
leaq 0x66bd(%rip), %rdi      # 0x80d7
xorl %eax, %eax
callq 0x1030
movq 0x9598(%rip), %rax      # 0xafc0
movq (%rax), %rdi
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x1120
movq (%rax), %rsi
movl $0x1, %edx
movl $0x1, %edi
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x1060
leaq 0x129987(%rip), %rcx    # 0x12b3e8
movb $0x1, %dl
movb %dl, (%rcx)
movb %dl, (%rax)
jmp 0x1dc1
movzwl 0x400(%r12,%r14), %eax
jmp 0x18c2
movslq 0x14(%rax), %rcx
imulq $0x51eb851f, %rcx, %rcx # imm = 0x51EB851F
movq %rcx, %rdx
sarq $0x25, %rdx
shrq $0x3f, %rcx
addl %edx, %ecx
addl $0x13, %ecx
movslq %ecx, %rcx
imulq $0x66666667, %rcx, %rdx # imm = 0x66666667
movq %rdx, %rsi
shrq $0x3f, %rsi
sarq $0x22, %rdx
addl %esi, %edx
movl %edx, %esi
shll $0x4, %esi
addl %edx, %edx
leal (%rdx,%rdx,4), %edx
subl %edx, %ecx
orl %esi, %ecx
movq 0x28(%r14), %rdx
movb %cl, (%rdx)
movslq 0x14(%rax), %rcx
imulq $0x51eb851f, %rcx, %rdx # imm = 0x51EB851F
movq %rdx, %rsi
shrq $0x3f, %rsi
sarq $0x25, %rdx
addl %esi, %edx
imull $0x64, %edx, %edx
subl %edx, %ecx
movslq %ecx, %rcx
imulq $0x66666667, %rcx, %rdx # imm = 0x66666667
movq %rdx, %rsi
shrq $0x3f, %rsi
sarq $0x22, %rdx
addl %esi, %edx
movl %edx, %esi
shll $0x4, %esi
addl %edx, %edx
leal (%rdx,%rdx,4), %edx
subl %edx, %ecx
orl %esi, %ecx
movq 0x8(%r14), %rdx
movb %cl, (%rdx)
movl 0x10(%rax), %ecx
leal 0x1(%rcx), %edx
movslq %edx, %rdx
imulq $0x66666667, %rdx, %rdx # imm = 0x66666667
movq %rdx, %rsi
shrq $0x3f, %rsi
sarq $0x22, %rdx
addl %esi, %edx
movl %edx, %esi
shll $0x4, %esi
addl %edx, %edx
leal (%rdx,%rdx,4), %edx
negl %edx
addl %edx, %ecx
incl %ecx
orl %esi, %ecx
movq 0x30(%r14), %rdx
movb %cl, (%rdx)
movslq 0xc(%rax), %rax
imulq $0x66666667, %rax, %rcx # imm = 0x66666667
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x22, %rcx
addl %edx, %ecx
movl %ecx, %edx
shll $0x4, %edx
addl %ecx, %ecx
leal (%rcx,%rcx,4), %ecx
subl %ecx, %eax
orl %edx, %eax
movq 0x10(%r14), %rcx
movb %al, (%rcx)
leaq 0x129878(%rip), %rax    # 0x12b3e8
movb $0x0, (%rax)
jmp 0x1dc1
leaq 0x129811(%rip), %rax    # 0x12b390
movzwl 0x2(%rax), %ecx
leaq 0x97f6(%rip), %rdx      # 0xb380
movw %cx, 0x46e(%rdx)
movzwl 0x4(%rax), %eax
movb %al, 0x46c(%rdx)
movb %ah, 0x46d(%rdx)
movb $0x0, 0x470(%rdx)
jmp 0x1dc1
leaq 0x97cc(%rip), %rax      # 0xb380
movb 0x470(%rax), %cl
movq (%r14), %rdx
movb %cl, (%rdx)
leaq 0x1297ca(%rip), %rcx    # 0x12b390
movl 0x46c(%rax), %edx
roll $0x10, %edx
movl %edx, 0x2(%rcx)
movb $0x0, 0x470(%rax)
jmp 0x1dc1
leaq 0x1297ab(%rip), %rax    # 0x12b390
movw $0x0, 0x2(%rax)
jmp 0x1dc1
movzwl 0x2(%rbx), %edx
movl $0x1, %esi
callq 0x1220
movw %ax, 0x2(%rbx)
testw %ax, %ax
jne 0x1dc1
movq 0x975e(%rip), %rdi      # 0xb370
callq 0x10e0
movq $0x0, 0x974e(%rip) # 0xb370
jmp 0x1dc1
cmpl $0x15, %edx
je 0x1d37
cmpl $0x17, %edx
je 0x1b69
cmpl $0x18, %edx
jne 0x14ed
incl %esi
movl %esi, 0xc(%r15)
movl %ecx, 0x14(%r15)
leaq 0x12973d(%rip), %rcx    # 0x12b390
xorl %edx, %edx
movw %dx, 0xe(%rcx)
leaq 0x9720(%rip), %rcx      # 0xb380
leaq 0x129899(%rip), %rsi    # 0x12b500
movq %rcx, (%rsi)
movw %dx, 0x8(%rsi)
leaq 0x129773(%rip), %rcx    # 0x12b3e8
jmp 0x1c80
leaq 0x12976a(%rip), %rcx    # 0x12b3e8
xorl %edx, %edx
movb %dl, (%rcx)
movb %dl, (%rax)
jmp 0x1dc1
shll $0x9, %r8d
movslq %r8d, %rsi
xorl %ebp, %ebp
xorl %edx, %edx
callq 0x1100
cmpl $0x0, 0x14(%r15)
jle 0x1db0
leaq 0x94c5(%rip), %rbx      # 0xb170
movq (%r15), %rcx
movl $0x200, %esi            # imm = 0x200
movl $0x1, %edx
movq %rbx, %rdi
callq 0x1220
incl %ebp
cmpl 0x14(%r15), %ebp
jl 0x1cab
jmp 0x1db0
leaq 0x1296bc(%rip), %rcx    # 0x12b390
xorl %eax, %eax
movw %ax, (%rcx)
movb 0x8(%r15), %dl
movq 0x18(%r14), %rsi
movb %dl, (%rsi)
movb 0xc(%r15), %dl
decb %dl
movq 0x28(%r14), %rsi
movb %dl, (%rsi)
movl 0xc(%r15), %edx
shrl $0x2, %edx
andl $0xc0, %edx
orl 0x14(%r15), %edx
movq 0x8(%r14), %rsi
movb %dl, (%rsi)
movb 0x10(%r15), %dl
decb %dl
movq 0x30(%r14), %rsi
movb %dl, (%rsi)
movq 0x10(%r14), %rdx
movb $0x1, (%rdx)
movw %ax, 0xe(%rcx)
leaq 0x965c(%rip), %rcx      # 0xb380
leaq 0x1297d5(%rip), %rdx    # 0x12b500
movq %rcx, (%rdx)
movw %ax, 0x8(%rdx)
jmp 0x1b69
movb $0x1, (%rax)
jmp 0x1b69
leal (%rcx,%r8), %eax
addl $0x7fffff, %eax         # imm = 0x7FFFFF
shll $0x9, %eax
movslq %eax, %rsi
xorl %edx, %edx
callq 0x1100
movq (%r14), %rax
movq 0x20(%r14), %rsi
leaq 0x12962d(%rip), %rbx    # 0x12b390
movzwl 0x6(%rbx), %edi
leaq 0x129792(%rip), %r12    # 0x12b500
movzbl (%rax), %edx
movq (%r15), %rcx
addq (%r12), %rdi
cmpb $0x2, (%rsi)
jne 0x1da6
movl $0x200, %esi            # imm = 0x200
callq 0x11c0
testq %rax, %rax
jne 0x1db0
movzwl 0x6(%rbx), %edi
addq (%r12), %rdi
movq (%r14), %rax
movzbl (%rax), %edx
shll $0x9, %edx
xorl %esi, %esi
callq 0x1070
jmp 0x1db0
movl $0x200, %esi            # imm = 0x200
callq 0x1220
leaq 0x129631(%rip), %rax    # 0x12b3e8
xorl %ecx, %ecx
movb %cl, (%rax)
movq 0x20(%r14), %rax
movb %cl, (%rax)
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq