// File: /workspace/github_c_makefile_star2_O0/dwelch67[P]lc3/lc3dis.c
// Function: main
int main ( int argc, char *argv[] )
{
    unsigned int ra;
    unsigned int addr;
    unsigned int inst;
    unsigned int rd,rs1,rs2,simm,dest;
    FILE *fp;

    if(argc<2)
    {
        fprintf(stderr,".hex file not specified\n");
        return(1);
    }

    memset(mem,0xFF,sizeof(mem));
    memset(mem_hit,0x00,sizeof(mem_hit));

    fp=fopen(argv[1],"rt");
    if(fp==NULL)
    {
        fprintf(stderr,"Error opening file [%s]\n",argv[1]);
        return(1);
    }
    if(readhex(fp)) return(1);
    fclose(fp);

    for(addr=0;addr<=RAMMASK;addr++)
    {
        if(mem_hit[addr])
        {
            inst=mem[addr];
            printf("0x%04X: 0x%04X ",addr,inst);
            switch(inst&0xF000)
            {
                case 0x0000:
                {
                    printf("br");
                    if(inst&0x0800) printf("n");
                    if(inst&0x0400) printf("z");
                    if(inst&0x0200) printf("p");
                    simm=sext9(inst);
                    dest=(addr+1+simm)&0xFFFF;
                    printf(" 0x%04X",dest);
                    if(simm&0x8000) printf(" ; -%u",(simm^0xFFFF)+1);
                    else            printf(" ; +%u",simm);
                    break;
                }
                case 0x1000:
                {
                    rd=(inst>>9)&7;
                    rs1=(inst>>6)&7;
                    if(inst&0x20)
                    {
                        simm=sext5(inst);
                        printf("add r%u,r%u,#0x%04X",rd,rs1,simm);
                    }
                    else
                    {
                        rs2=(inst>>0)&7;
                        printf("add r%u,r%u,r%u",rd,rs1,rs2);
                    }
                    break;
                }
                case 0x2000:
                {
                    rd=(inst>>9)&7;
                    simm=sext9(inst);
                    dest=(addr+1+simm)&0xFFFF;
                    printf("ld r%u,0x%04X",rd,dest);
                    if(simm&0x8000) printf(" ; -%u",(simm^0xFFFF)+1);
                    else            printf(" ; +%u",simm);
                    break;
                }
                case 0x3000:
                {
                    rd=(inst>>9)&7;
                    simm=sext9(inst);
                    dest=(addr+1+simm)&0xFFFF;
                    printf("st r%u,0x%04X",rd,dest);
                    if(simm&0x8000) printf(" ; -%u",(simm^0xFFFF)+1);
                    else            printf(" ; +%u",simm);
                    break;
                }
                case 0x4000:
                {
                    if(inst&0x0800)
                    {
                        simm=sext11(inst);
                        dest=(addr+1+simm)&0xFFFF;
                        printf("jsr 0x%04X",dest);
                        if(simm&0x8000) printf(" ; -%u",(simm^0xFFFF)+1);
                        else            printf(" ; +%u",simm);
                    }
                    else
                    {
                        rd=(inst>>6)&7;
                        printf("jsrr r%u",rd);
                    }
                    break;
                }
                case 0x5000:
                {
                    rd=(inst>>9)&7;
                    rs1=(inst>>6)&7;
                    if(inst&0x20)
                    {
                        simm=sext5(inst);
                        printf("and r%u,r%u,#0x%04X",rd,rs1,simm);
                    }
                    else
                    {
                        rs2=(inst>>0)&7;
                        printf("and r%u,r%u,r%u",rd,rs1,rs2);
                    }
                    break;
                }
                case 0x6000:
                {
                    rd=(inst>>9)&7;
                    rs1=(inst>>6)&7;
                    simm=sext6(inst);
                    printf("ldr r%u,r%u,#0x%04X",rd,rs1,simm);
                    if(simm&0x8000) printf(" ; -%u",(simm^0xFFFF)+1);
                    else            printf(" ; +%u",simm);
                    break;
                }
                case 0x7000:
                {
                    rd=(inst>>9)&7;
                    rs1=(inst>>6)&7;
                    simm=sext6(inst);
                    printf("str r%u,r%u,#0x%04X",rd,rs1,simm);
                    if(simm&0x8000) printf(" ; -%u",(simm^0xFFFF)+1);
                    else            printf(" ; +%u",simm);
                    break;
                }
                case 0x8000:
                {
                    printf("rti");
                    break;
                }
                case 0x9000:
                {
                    rd=(inst>>9)&7;
                    rs1=(inst>>6)&7;
                    printf("not r%u,r%u",rd,rs1);
                    break;
                }
                case 0xA000:
                {
                    rd=(inst>>9)&7;
                    simm=sext9(inst);
                    dest=(addr+1+simm)&0xFFFF;
                    printf("ldi r%u,0x%04X",rd,dest);
                    if(simm&0x8000) printf(" ; -%u",(simm^0xFFFF)+1);
                    else            printf(" ; +%u",simm);
                    break;
                }
                case 0xB000:
                {
                    rd=(inst>>9)&7;
                    simm=sext9(inst);
                    dest=(addr+1+simm)&0xFFFF;
                    printf("sti r%u,0x%04X",rd,dest);
                    if(simm&0x8000) printf(" ; -%u",(simm^0xFFFF)+1);
                    else            printf(" ; +%u",simm);
                    break;
                }
                case 0xC000:
                {
                    printf("ret");
                    break;
                }
                case 0xD000:
                {
                    printf("undefined");
                    break;
                }
                case 0xE000:
                {
                    rd=(inst>>9)&7;
                    simm=sext9(inst);
                    dest=(addr+1+simm)&0xFFFF;
                    printf("lea r%u,0x%04X",rd,dest);
                    if(simm&0x8000) printf(" ; -%u",(simm^0xFFFF)+1);
                    else            printf(" ; +%u",simm);
                    break;
                }
                case 0xF000:
                {
                    rd=inst&0xFF;
                    printf("trap 0x%02X",rd);
                    break;
                }
            }


            printf("\n");
        }
    }



    return(0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x2, -0x8(%rbp)
jge 0x1360
movq 0x2cb5(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
leaq 0xcb7(%rip), %rsi       # 0x2004
movb $0x0, %al
callq 0x1070
movl $0x1, -0x4(%rbp)
jmp 0x1bd2
leaq 0x2d09(%rip), %rdi      # 0x4070
movl $0xff, %esi
movl $0x20000, %edx          # imm = 0x20000
callq 0x1050
leaq 0x22cf3(%rip), %rdi     # 0x24070
xorl %esi, %esi
movl $0x10000, %edx          # imm = 0x10000
callq 0x1050
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0xc85(%rip), %rsi       # 0x201d
callq 0x1080
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x13d4
movq 0x2c49(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0xc5f(%rip), %rsi       # 0x2020
movb $0x0, %al
callq 0x1070
movl $0x1, -0x4(%rbp)
jmp 0x1bd2
movq -0x38(%rbp), %rdi
callq 0x1be0
cmpl $0x0, %eax
je 0x13ee
movl $0x1, -0x4(%rbp)
jmp 0x1bd2
movq -0x38(%rbp), %rdi
callq 0x1030
movl $0x0, -0x18(%rbp)
cmpl $0xffff, -0x18(%rbp)    # imm = 0xFFFF
ja 0x1bcb
movl -0x18(%rbp), %eax
movl %eax, %ecx
leaq 0x22c59(%rip), %rax     # 0x24070
cmpb $0x0, (%rax,%rcx)
je 0x1bbb
movl -0x18(%rbp), %eax
movl %eax, %ecx
leaq 0x2c43(%rip), %rax      # 0x4070
movzwl (%rax,%rcx,2), %eax
movl %eax, -0x1c(%rbp)
movl -0x18(%rbp), %esi
movl -0x1c(%rbp), %edx
leaq 0xbf8(%rip), %rdi       # 0x2039
xorl %eax, %eax
callq 0x1040
movl -0x1c(%rbp), %eax
andl $0xf000, %eax           # imm = 0xF000
movl %eax, -0x3c(%rbp)
je 0x154e
jmp 0x145b
movl -0x3c(%rbp), %eax
subl $0x1000, %eax           # imm = 0x1000
je 0x161f
jmp 0x146b
movl -0x3c(%rbp), %eax
subl $0x2000, %eax           # imm = 0x2000
je 0x1694
jmp 0x147b
movl -0x3c(%rbp), %eax
subl $0x3000, %eax           # imm = 0x3000
je 0x1715
jmp 0x148b
movl -0x3c(%rbp), %eax
subl $0x4000, %eax           # imm = 0x4000
je 0x1796
jmp 0x149b
movl -0x3c(%rbp), %eax
subl $0x5000, %eax           # imm = 0x5000
je 0x1834
jmp 0x14ab
movl -0x3c(%rbp), %eax
subl $0x6000, %eax           # imm = 0x6000
je 0x18a9
jmp 0x14bb
movl -0x3c(%rbp), %eax
subl $0x7000, %eax           # imm = 0x7000
je 0x1928
jmp 0x14cb
movl -0x3c(%rbp), %eax
subl $0x8000, %eax           # imm = 0x8000
je 0x19a7
jmp 0x14db
movl -0x3c(%rbp), %eax
subl $0x9000, %eax           # imm = 0x9000
je 0x19ba
jmp 0x14eb
movl -0x3c(%rbp), %eax
subl $0xa000, %eax           # imm = 0xA000
je 0x19eb
jmp 0x14fb
movl -0x3c(%rbp), %eax
subl $0xb000, %eax           # imm = 0xB000
je 0x1a6c
jmp 0x150b
movl -0x3c(%rbp), %eax
subl $0xc000, %eax           # imm = 0xC000
je 0x1aed
jmp 0x151b
movl -0x3c(%rbp), %eax
subl $0xd000, %eax           # imm = 0xD000
je 0x1b00
jmp 0x152b
movl -0x3c(%rbp), %eax
subl $0xe000, %eax           # imm = 0xE000
je 0x1b13
jmp 0x153b
movl -0x3c(%rbp), %eax
subl $0xf000, %eax           # imm = 0xF000
je 0x1b91
jmp 0x1bad
leaq 0xaf4(%rip), %rdi       # 0x2049
movb $0x0, %al
callq 0x1040
movl -0x1c(%rbp), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0x1577
leaq 0xadc(%rip), %rdi       # 0x204c
movb $0x0, %al
callq 0x1040
movl -0x1c(%rbp), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x1592
leaq 0xac3(%rip), %rdi       # 0x204e
movb $0x0, %al
callq 0x1040
movl -0x1c(%rbp), %eax
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
je 0x15ad
leaq 0xaaa(%rip), %rdi       # 0x2050
movb $0x0, %al
callq 0x1040
movl -0x1c(%rbp), %eax
movzwl %ax, %edi
callq 0x12a0
movzwl %ax, %eax
movl %eax, -0x2c(%rbp)
movl -0x18(%rbp), %eax
addl $0x1, %eax
addl -0x2c(%rbp), %eax
andl $0xffff, %eax           # imm = 0xFFFF
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %esi
leaq 0xaca(%rip), %rdi       # 0x20a3
movb $0x0, %al
callq 0x1040
movl -0x2c(%rbp), %eax
andl $0x8000, %eax           # imm = 0x8000
cmpl $0x0, %eax
je 0x1609
movl -0x2c(%rbp), %esi
xorl $0xffff, %esi           # imm = 0xFFFF
addl $0x1, %esi
leaq 0xa52(%rip), %rdi       # 0x2052
movb $0x0, %al
callq 0x1040
jmp 0x161a
movl -0x2c(%rbp), %esi
leaq 0xa46(%rip), %rdi       # 0x2059
movb $0x0, %al
callq 0x1040
jmp 0x1bad
movl -0x1c(%rbp), %eax
shrl $0x9, %eax
andl $0x7, %eax
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %eax
shrl $0x6, %eax
andl $0x7, %eax
movl %eax, -0x24(%rbp)
movl -0x1c(%rbp), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x166c
movl -0x1c(%rbp), %eax
movzwl %ax, %edi
callq 0x1220
movzwl %ax, %eax
movl %eax, -0x2c(%rbp)
movl -0x20(%rbp), %esi
movl -0x24(%rbp), %edx
movl -0x2c(%rbp), %ecx
leaq 0x9fd(%rip), %rdi       # 0x2060
movb $0x0, %al
callq 0x1040
jmp 0x168f
movl -0x1c(%rbp), %eax
shrl $0x0, %eax
andl $0x7, %eax
movl %eax, -0x28(%rbp)
movl -0x20(%rbp), %esi
movl -0x24(%rbp), %edx
movl -0x28(%rbp), %ecx
leaq 0x9ec(%rip), %rdi       # 0x2074
movb $0x0, %al
callq 0x1040
jmp 0x1bad
movl -0x1c(%rbp), %eax
shrl $0x9, %eax
andl $0x7, %eax
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %eax
movzwl %ax, %edi
callq 0x12a0
movzwl %ax, %eax
movl %eax, -0x2c(%rbp)
movl -0x18(%rbp), %eax
addl $0x1, %eax
addl -0x2c(%rbp), %eax
andl $0xffff, %eax           # imm = 0xFFFF
movl %eax, -0x30(%rbp)
movl -0x20(%rbp), %esi
movl -0x30(%rbp), %edx
leaq 0x9b5(%rip), %rdi       # 0x2084
movb $0x0, %al
callq 0x1040
movl -0x2c(%rbp), %eax
andl $0x8000, %eax           # imm = 0x8000
cmpl $0x0, %eax
je 0x16ff
movl -0x2c(%rbp), %esi
xorl $0xffff, %esi           # imm = 0xFFFF
addl $0x1, %esi
leaq 0x95c(%rip), %rdi       # 0x2052
movb $0x0, %al
callq 0x1040
jmp 0x1710
movl -0x2c(%rbp), %esi
leaq 0x950(%rip), %rdi       # 0x2059
movb $0x0, %al
callq 0x1040
jmp 0x1bad
movl -0x1c(%rbp), %eax
shrl $0x9, %eax
andl $0x7, %eax
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %eax
movzwl %ax, %edi
callq 0x12a0
movzwl %ax, %eax
movl %eax, -0x2c(%rbp)
movl -0x18(%rbp), %eax
addl $0x1, %eax
addl -0x2c(%rbp), %eax
andl $0xffff, %eax           # imm = 0xFFFF
movl %eax, -0x30(%rbp)
movl -0x20(%rbp), %esi
movl -0x30(%rbp), %edx
leaq 0x942(%rip), %rdi       # 0x2092
movb $0x0, %al
callq 0x1040
movl -0x2c(%rbp), %eax
andl $0x8000, %eax           # imm = 0x8000
cmpl $0x0, %eax
je 0x1780
movl -0x2c(%rbp), %esi
xorl $0xffff, %esi           # imm = 0xFFFF
addl $0x1, %esi
leaq 0x8db(%rip), %rdi       # 0x2052
movb $0x0, %al
callq 0x1040
jmp 0x1791
movl -0x2c(%rbp), %esi
leaq 0x8cf(%rip), %rdi       # 0x2059
movb $0x0, %al
callq 0x1040
jmp 0x1bad
movl -0x1c(%rbp), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0x1812
movl -0x1c(%rbp), %eax
movzwl %ax, %edi
callq 0x12e0
movzwl %ax, %eax
movl %eax, -0x2c(%rbp)
movl -0x18(%rbp), %eax
addl $0x1, %eax
addl -0x2c(%rbp), %eax
andl $0xffff, %eax           # imm = 0xFFFF
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %esi
leaq 0x8d1(%rip), %rdi       # 0x20a0
movb $0x0, %al
callq 0x1040
movl -0x2c(%rbp), %eax
andl $0x8000, %eax           # imm = 0x8000
cmpl $0x0, %eax
je 0x17ff
movl -0x2c(%rbp), %esi
xorl $0xffff, %esi           # imm = 0xFFFF
addl $0x1, %esi
leaq 0x85c(%rip), %rdi       # 0x2052
movb $0x0, %al
callq 0x1040
jmp 0x1810
movl -0x2c(%rbp), %esi
leaq 0x850(%rip), %rdi       # 0x2059
movb $0x0, %al
callq 0x1040
jmp 0x182f
movl -0x1c(%rbp), %eax
shrl $0x6, %eax
andl $0x7, %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %esi
leaq 0x883(%rip), %rdi       # 0x20ab
movb $0x0, %al
callq 0x1040
jmp 0x1bad
movl -0x1c(%rbp), %eax
shrl $0x9, %eax
andl $0x7, %eax
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %eax
shrl $0x6, %eax
andl $0x7, %eax
movl %eax, -0x24(%rbp)
movl -0x1c(%rbp), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x1881
movl -0x1c(%rbp), %eax
movzwl %ax, %edi
callq 0x1220
movzwl %ax, %eax
movl %eax, -0x2c(%rbp)
movl -0x20(%rbp), %esi
movl -0x24(%rbp), %edx
movl -0x2c(%rbp), %ecx
leaq 0x83c(%rip), %rdi       # 0x20b4
movb $0x0, %al
callq 0x1040
jmp 0x18a4
movl -0x1c(%rbp), %eax
shrl $0x0, %eax
andl $0x7, %eax
movl %eax, -0x28(%rbp)
movl -0x20(%rbp), %esi
movl -0x24(%rbp), %edx
movl -0x28(%rbp), %ecx
leaq 0x82b(%rip), %rdi       # 0x20c8
movb $0x0, %al
callq 0x1040
jmp 0x1bad
movl -0x1c(%rbp), %eax
shrl $0x9, %eax
andl $0x7, %eax
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %eax
shrl $0x6, %eax
andl $0x7, %eax
movl %eax, -0x24(%rbp)
movl -0x1c(%rbp), %eax
movzwl %ax, %edi
callq 0x1260
movzwl %ax, %eax
movl %eax, -0x2c(%rbp)
movl -0x20(%rbp), %esi
movl -0x24(%rbp), %edx
movl -0x2c(%rbp), %ecx
leaq 0x7f6(%rip), %rdi       # 0x20d8
movb $0x0, %al
callq 0x1040
movl -0x2c(%rbp), %eax
andl $0x8000, %eax           # imm = 0x8000
cmpl $0x0, %eax
je 0x1912
movl -0x2c(%rbp), %esi
xorl $0xffff, %esi           # imm = 0xFFFF
addl $0x1, %esi
leaq 0x749(%rip), %rdi       # 0x2052
movb $0x0, %al
callq 0x1040
jmp 0x1923
movl -0x2c(%rbp), %esi
leaq 0x73d(%rip), %rdi       # 0x2059
movb $0x0, %al
callq 0x1040
jmp 0x1bad
movl -0x1c(%rbp), %eax
shrl $0x9, %eax
andl $0x7, %eax
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %eax
shrl $0x6, %eax
andl $0x7, %eax
movl %eax, -0x24(%rbp)
movl -0x1c(%rbp), %eax
movzwl %ax, %edi
callq 0x1260
movzwl %ax, %eax
movl %eax, -0x2c(%rbp)
movl -0x20(%rbp), %esi
movl -0x24(%rbp), %edx
movl -0x2c(%rbp), %ecx
leaq 0x78b(%rip), %rdi       # 0x20ec
movb $0x0, %al
callq 0x1040
movl -0x2c(%rbp), %eax
andl $0x8000, %eax           # imm = 0x8000
cmpl $0x0, %eax
je 0x1991
movl -0x2c(%rbp), %esi
xorl $0xffff, %esi           # imm = 0xFFFF
addl $0x1, %esi
leaq 0x6ca(%rip), %rdi       # 0x2052
movb $0x0, %al
callq 0x1040
jmp 0x19a2
movl -0x2c(%rbp), %esi
leaq 0x6be(%rip), %rdi       # 0x2059
movb $0x0, %al
callq 0x1040
jmp 0x1bad
leaq 0x752(%rip), %rdi       # 0x2100
movb $0x0, %al
callq 0x1040
jmp 0x1bad
movl -0x1c(%rbp), %eax
shrl $0x9, %eax
andl $0x7, %eax
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %eax
shrl $0x6, %eax
andl $0x7, %eax
movl %eax, -0x24(%rbp)
movl -0x20(%rbp), %esi
movl -0x24(%rbp), %edx
leaq 0x725(%rip), %rdi       # 0x2104
movb $0x0, %al
callq 0x1040
jmp 0x1bad
movl -0x1c(%rbp), %eax
shrl $0x9, %eax
andl $0x7, %eax
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %eax
movzwl %ax, %edi
callq 0x12a0
movzwl %ax, %eax
movl %eax, -0x2c(%rbp)
movl -0x18(%rbp), %eax
addl $0x1, %eax
addl -0x2c(%rbp), %eax
andl $0xffff, %eax           # imm = 0xFFFF
movl %eax, -0x30(%rbp)
movl -0x20(%rbp), %esi
movl -0x30(%rbp), %edx
leaq 0x6ea(%rip), %rdi       # 0x2110
movb $0x0, %al
callq 0x1040
movl -0x2c(%rbp), %eax
andl $0x8000, %eax           # imm = 0x8000
cmpl $0x0, %eax
je 0x1a56
movl -0x2c(%rbp), %esi
xorl $0xffff, %esi           # imm = 0xFFFF
addl $0x1, %esi
leaq 0x605(%rip), %rdi       # 0x2052
movb $0x0, %al
callq 0x1040
jmp 0x1a67
movl -0x2c(%rbp), %esi
leaq 0x5f9(%rip), %rdi       # 0x2059
movb $0x0, %al
callq 0x1040
jmp 0x1bad
movl -0x1c(%rbp), %eax
shrl $0x9, %eax
andl $0x7, %eax
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %eax
movzwl %ax, %edi
callq 0x12a0
movzwl %ax, %eax
movl %eax, -0x2c(%rbp)
movl -0x18(%rbp), %eax
addl $0x1, %eax
addl -0x2c(%rbp), %eax
andl $0xffff, %eax           # imm = 0xFFFF
movl %eax, -0x30(%rbp)
movl -0x20(%rbp), %esi
movl -0x30(%rbp), %edx
leaq 0x678(%rip), %rdi       # 0x211f
movb $0x0, %al
callq 0x1040
movl -0x2c(%rbp), %eax
andl $0x8000, %eax           # imm = 0x8000
cmpl $0x0, %eax
je 0x1ad7
movl -0x2c(%rbp), %esi
xorl $0xffff, %esi           # imm = 0xFFFF
addl $0x1, %esi
leaq 0x584(%rip), %rdi       # 0x2052
movb $0x0, %al
callq 0x1040
jmp 0x1ae8
movl -0x2c(%rbp), %esi
leaq 0x578(%rip), %rdi       # 0x2059
movb $0x0, %al
callq 0x1040
jmp 0x1bad
leaq 0x63a(%rip), %rdi       # 0x212e
movb $0x0, %al
callq 0x1040
jmp 0x1bad
leaq 0x62b(%rip), %rdi       # 0x2132
movb $0x0, %al
callq 0x1040
jmp 0x1bad
movl -0x1c(%rbp), %eax
shrl $0x9, %eax
andl $0x7, %eax
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %eax
movzwl %ax, %edi
callq 0x12a0
movzwl %ax, %eax
movl %eax, -0x2c(%rbp)
movl -0x18(%rbp), %eax
addl $0x1, %eax
addl -0x2c(%rbp), %eax
andl $0xffff, %eax           # imm = 0xFFFF
movl %eax, -0x30(%rbp)
movl -0x20(%rbp), %esi
movl -0x30(%rbp), %edx
leaq 0x5ee(%rip), %rdi       # 0x213c
movb $0x0, %al
callq 0x1040
movl -0x2c(%rbp), %eax
andl $0x8000, %eax           # imm = 0x8000
cmpl $0x0, %eax
je 0x1b7e
movl -0x2c(%rbp), %esi
xorl $0xffff, %esi           # imm = 0xFFFF
addl $0x1, %esi
leaq 0x4dd(%rip), %rdi       # 0x2052
movb $0x0, %al
callq 0x1040
jmp 0x1b8f
movl -0x2c(%rbp), %esi
leaq 0x4d1(%rip), %rdi       # 0x2059
movb $0x0, %al
callq 0x1040
jmp 0x1bad
movl -0x1c(%rbp), %eax
andl $0xff, %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %esi
leaq 0x5a5(%rip), %rdi       # 0x214b
movb $0x0, %al
callq 0x1040
leaq 0x60e(%rip), %rdi       # 0x21c2
movb $0x0, %al
callq 0x1040
jmp 0x1bbd
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x13fe
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)