// File: /workspace/github_cpp_makefile_star2_O3/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 0x1685
movl %ebx, %eax
leaq 0x6b94(%rip), %rcx      # 0x8040
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x129f2c(%rip), %rax    # 0x12b3e8
movb $0x1, (%rax)
jmp 0x1d8d
leaq 0x6c57(%rip), %rdi      # 0x8122
jmp 0x1761
leaq 0x129ec9(%rip), %r14    # 0x12b3a0
movq 0x20(%r14), %rax
movzbl (%rax), %edx
cmpl $0xff, %edx
je 0x18a3
cmpl $0xfe, %edx
jne 0x1905
movq 0x9e73(%rip), %rdi      # 0xb370
testq %rdi, %rdi
je 0x1507
callq 0x10e0
movq (%r14), %rax
leaq 0x129e7f(%rip), %rcx    # 0x12b390
movzwl 0x4(%rcx), %edi
leaq 0x129fe4(%rip), %rcx    # 0x12b500
addq 0x30(%rcx), %rdi
cmpb $0x1, (%rax)
setne 0x9e4e(%rip)            # 0xb378
leaq 0x6beb(%rip), %rax      # 0x811c
leaq 0x6be7(%rip), %rsi      # 0x811f
cmovneq %rax, %rsi
callq 0x1130
movq %rax, 0x9e28(%rip)      # 0xb370
testq %rax, %rax
leaq 0x129e96(%rip), %rax    # 0x12b3e8
sete (%rax)
jmp 0x1d8d
leaq 0x9e1f(%rip), %r14      # 0xb380
movzwl 0x41a(%r14), %r15d
movzwl 0x41c(%r14), %eax
leaq 0x129e28(%rip), %rcx    # 0x12b3a0
movq 0x20(%rcx), %rcx
movzbl (%rcx), %ecx
cmpl $0x1, %ecx
je 0x18ea
testl %ecx, %ecx
jne 0x1685
cmpw %ax, %r15w
jne 0x15aa
movl $0x9, %edi
callq 0x148c
cmpw 0x41c(%r14), %r15w
je 0x1596
movzwl 0x400(%r15,%r14), %eax
leaq 0x129dd6(%rip), %rcx    # 0x12b390
movw %ax, (%rcx)
leal 0x4(%r15), %eax
andb $0x1f, %al
addb $0x1e, %al
movb %al, 0x41a(%r14)
movb $0x0, 0x41b(%r14)
jmp 0x1d8d
leaq 0x129dc0(%rip), %rax    # 0x12b3a0
movq 0x20(%rax), %rax
cmpb $-0x78, (%rax)
jne 0x1685
leaq 0x129df4(%rip), %rax    # 0x12b3e8
movb $0x0, (%rax)
leaq 0x129d92(%rip), %rax    # 0x12b390
movw $0x0, (%rax)
jmp 0x1d8d
callq 0x714b
testl %eax, %eax
je 0x1d8d
leaq 0x9d64(%rip), %rbx      # 0xb380
movzwl 0x41a(%rbx), %eax
addl $-0x1e, %eax
movzwl 0x41c(%rbx), %r14d
leal 0x4(%r14), %ebp
andl $0x1f, %ebp
cmpl %eax, %ebp
je 0x1d8d
callq 0x7100
movl %eax, %edi
callq 0x6b18
testw %ax, %ax
je 0x1669
movw %ax, 0x400(%r14,%rbx)
addb $0x1e, %bpl
movb %bpl, 0x41c(%rbx)
movb $0x0, 0x41d(%rbx)
callq 0x714b
testl %eax, %eax
jne 0x161c
jmp 0x1d8d
leaq 0x6a76(%rip), %rdi      # 0x80f4
xorl %eax, %eax
callq 0x20a6
leaq 0x129d14(%rip), %rax    # 0x12b3a0
movq 0x20(%rax), %rax
movzbl (%rax), %edx
leaq 0x6ac2(%rip), %rdi      # 0x815c
movl %ebx, %esi
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x20a6
leaq 0x129cea(%rip), %rax    # 0x12b3a0
movq 0x20(%rax), %rcx
movzbl (%rcx), %ecx
cmpl $0xe, %ecx
je 0x1a00
cmpl $0x2, %ecx
je 0x19c5
testl %ecx, %ecx
jne 0x1d8d
leaq 0x6a2e(%rip), %rdi      # 0x810c
xorl %eax, %eax
callq 0x1030
movq 0x98cc(%rip), %rax      # 0xafb8
movq (%rax), %rdi
callq 0x1120
leaq 0x129df7(%rip), %rax    # 0x12b4f2
jmp 0x14bc
leaq 0x9c79(%rip), %rax      # 0xb380
movzwl 0x46c(%rax), %ecx
incw %cx
jne 0x187e
movzwl 0x46e(%rax), %ecx
incl %ecx
cmpw $0x18, %cx
jb 0x1741
movzwl %cx, %edx
imull $0xaaab, %edx, %edx     # imm = 0xAAAB
shrl $0x11, %edx
andl $-0x8, %edx
leal (%rdx,%rdx,2), %edx
subl %edx, %ecx
movb $0x1, 0x470(%rax)
movb %cl, 0x46e(%rax)
xorl %ecx, %ecx
movb %cl, 0x46f(%rax)
movb %cl, 0x46c(%rax)
jmp 0x1887
leaq 0x69d7(%rip), %rdi      # 0x8138
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x20a6
leaq 0x129c25(%rip), %r14    # 0x12b3a0
movq 0x20(%r14), %rax
movzbl (%rax), %eax
cmpq $0x5, %rax
ja 0x1685
leaq 0x6921(%rip), %rcx      # 0x80b4
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 0x1a3e
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 0x1b29
xorl %eax, %eax
cmpq $0x0, 0x9902(%rip)      # 0xb158
setne %al
shll $0x6, %eax
incl %eax
leaq 0x129b2b(%rip), %rcx    # 0x12b390
movw %ax, (%rcx)
jmp 0x1d8d
leaq 0x129b1c(%rip), %rax    # 0x12b390
movw $0x280, (%rax)          # imm = 0x280
jmp 0x1d8d
movb %cl, 0x46c(%rax)
shrl $0x8, %ecx
movb %cl, 0x46d(%rax)
movl $0x1c, %edi
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x2194
movq 0x9ac6(%rip), %rcx      # 0xb370
testq %rcx, %rcx
je 0x1baa
leaq 0x129ad6(%rip), %rbx    # 0x12b390
movzwl 0x4(%rbx), %edi
leaq 0x129c3b(%rip), %rax    # 0x12b500
addq 0x30(%rax), %rdi
cmpb $0x1, 0x9aa8(%rip)      # 0xb378
jne 0x1bbc
movl $0x1, %esi
movl $0x200, %edx            # imm = 0x200
callq 0x11c0
jmp 0x1bca
leaq 0x129af4(%rip), %rcx    # 0x12b3e5
cmpw %ax, %r15w
sete (%rcx)
jne 0x1a30
xorl %eax, %eax
jmp 0x185e
movq 0x10(%r14), %rcx
movzbl (%rcx), %ecx
cmpq $0x1, %rcx
ja 0x1a1e
leaq (%rcx,%rcx,2), %rcx
leaq 0x981f(%rip), %rsi      # 0xb140
movq (%rsi,%rcx,8), %rdi
testq %rdi, %rdi
je 0x1a1e
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 0x1bf3
cmpl $0x8, %edx
ja 0x14b5
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 0x6749(%rip), %rbx      # 0x80cc
movslq (%rbx,%rdx,4), %rdx
addq %rbx, %rdx
jmpq *%rdx
cmpl 0xc(%r15), %esi
jge 0x19b3
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 0x1d0b
leaq 0x129a2e(%rip), %rcx    # 0x12b3e8
movb $0x1, (%rcx)
movb $0x4, (%rax)
jmp 0x1d8d
movq 0x10(%rax), %rcx
movq 0x30(%rax), %rax
movzbl (%rax), %esi
incl %esi
movzbl (%rcx), %edx
incl %edx
leaq 0x6735(%rip), %rdi      # 0x8113
xorl %eax, %eax
callq 0x1030
movq 0x95cc(%rip), %rax      # 0xafb8
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 0x1299c3(%rip), %rcx    # 0x12b3e8
movb $0x1, %dl
movb %dl, (%rcx)
movb %dl, (%rax)
jmp 0x1d8d
movzwl 0x400(%r15,%r14), %eax
jmp 0x185e
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
movsbl %cl, %edx
imull $0x67, %edx, %edx
movzwl %dx, %edx
movswl %dx, %esi
shrl $0xf, %edx
shrl $0xa, %esi
addb %dl, %sil
movzbl %sil, %edx
shlb $0x4, %sil
addl %edx, %edx
leal (%rdx,%rdx,4), %edx
subb %dl, %cl
orb %sil, %cl
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 0x1298b2(%rip), %rax    # 0x12b3e8
movb $0x0, (%rax)
jmp 0x1d8d
leaq 0x12984b(%rip), %rax    # 0x12b390
movzwl 0x2(%rax), %ecx
leaq 0x9830(%rip), %rdx      # 0xb380
movw %cx, 0x46e(%rdx)
movzwl 0x4(%rax), %eax
movb %al, 0x46c(%rdx)
movb %ah, 0x46d(%rdx)
movb $0x0, 0x470(%rdx)
jmp 0x1d8d
leaq 0x9806(%rip), %rax      # 0xb380
movb 0x470(%rax), %cl
movq (%r14), %rdx
movb %cl, (%rdx)
movd 0x46c(%rax), %xmm0
pshuflw $0xe1, %xmm0, %xmm0     # xmm0 = xmm0[1,0,2,3,4,5,6,7]
leaq 0x1297f7(%rip), %rcx    # 0x12b390
movd %xmm0, 0x2(%rcx)
movb $0x0, 0x470(%rax)
jmp 0x1d8d
leaq 0x1297df(%rip), %rax    # 0x12b390
movw $0x0, 0x2(%rax)
jmp 0x1d8d
movzwl 0x2(%rbx), %edx
movl $0x1, %esi
callq 0x1220
movw %ax, 0x2(%rbx)
testw %ax, %ax
jne 0x1d8d
movq 0x9792(%rip), %rdi      # 0xb370
callq 0x10e0
movq $0x0, 0x9782(%rip) # 0xb370
jmp 0x1d8d
cmpl $0x15, %edx
je 0x1d03
cmpl $0x17, %edx
je 0x1b2f
cmpl $0x18, %edx
jne 0x14b5
incl %esi
movl %esi, 0xc(%r15)
movl %ecx, 0x14(%r15)
leaq 0x129771(%rip), %rcx    # 0x12b390
xorl %edx, %edx
movw %dx, 0xe(%rcx)
leaq 0x9754(%rip), %rcx      # 0xb380
leaq 0x1298cd(%rip), %rsi    # 0x12b500
movq %rcx, (%rsi)
movw %dx, 0x8(%rsi)
leaq 0x1297a7(%rip), %rcx    # 0x12b3e8
jmp 0x1c4c
leaq 0x12979e(%rip), %rcx    # 0x12b3e8
xorl %edx, %edx
movb %dl, (%rcx)
movb %dl, (%rax)
jmp 0x1d8d
shll $0x9, %r8d
movslq %r8d, %rsi
xorl %ebp, %ebp
xorl %edx, %edx
callq 0x1100
cmpl $0x0, 0x14(%r15)
jle 0x1d7c
leaq 0x94f9(%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 0x1c77
jmp 0x1d7c
leaq 0x1296f0(%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 0x9690(%rip), %rcx      # 0xb380
leaq 0x129809(%rip), %rdx    # 0x12b500
movq %rcx, (%rdx)
movw %ax, 0x8(%rdx)
jmp 0x1b2f
movb $0x1, (%rax)
jmp 0x1b2f
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 0x129661(%rip), %rbx    # 0x12b390
movzwl 0x6(%rbx), %edi
leaq 0x1297c6(%rip), %r12    # 0x12b500
movzbl (%rax), %edx
movq (%r15), %rcx
addq (%r12), %rdi
cmpb $0x2, (%rsi)
jne 0x1d72
movl $0x200, %esi            # imm = 0x200
callq 0x11c0
testq %rax, %rax
jne 0x1d7c
movzwl 0x6(%rbx), %edi
addq (%r12), %rdi
movq (%r14), %rax
movzbl (%rax), %edx
shll $0x9, %edx
xorl %esi, %esi
callq 0x1070
jmp 0x1d7c
movl $0x200, %esi            # imm = 0x200
callq 0x1220
leaq 0x129665(%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