// File: /workspace/github_c_makefile_star2_O0/dwelch67[P]lc3/lc3asm.c
// Function: main
int main ( int argc, char *argv[] )
{
    int ret;
    unsigned int ra;
    unsigned int rb;
    unsigned int inst;
    unsigned int inst2;

    if(argc!=2)
    {
        printf("lc3asm filename\n");
        return(1);
    }

    fpin=fopen(argv[1],"rt");
    if(fpin==NULL)
    {
        printf("Error opening file [%s]\n",argv[1]);
        return(1);
    }
    ret=assemble();
    fclose(fpin);

    if(ret) return(1);
    for(ra=0;ra<nlabs;ra++)
    {
        printf("label%04u: [0x%08X] [%s] %u\n",ra,lab_struct[ra].addr,lab_struct[ra].name,lab_struct[ra].type);

        if(lab_struct[ra].type)
        {
            for(rb=0;rb<nlabs;rb++)
            {
                if(lab_struct[rb].type) continue;
                if(strcmp(lab_struct[ra].name,lab_struct[rb].name)==0)
                {
                    rx=lab_struct[rb].addr;
                    inst=mem[lab_struct[ra].addr];

                    if((inst&0xF000)==0x0000)
                    {
                        //br[n][z][p]
                        rs=0x3000+(lab_struct[ra].addr);
                        rd=rx-(rs+1);
                        if(check_offset9(rd))
                        {
                            printf("<%u> Error: branch too far\n",lab_struct[ra].line);
                            return(1);
                        }
                        inst|=rd&0x01FF;
                        lab_struct[ra].type++;
                    }
                    if((inst&0xF000)==0x2000)
                    {
                        //ld
                        rs=0x3000+(lab_struct[ra].addr);
                        rd=rx-(rs+1);
                        if(check_offset9(rd))
                        {
                            printf("<%u> Error: ld too far\n",lab_struct[ra].line);
                            return(1);
                        }
                        inst|=rd&0x01FF;
                        lab_struct[ra].type++;
                    }
                    if((inst&0xF000)==0xA000)
                    {
                        //ldi
                        rs=0x3000+(lab_struct[ra].addr);
                        rd=rx-(rs+1);
                        if(check_offset9(rd))
                        {
                            printf("<%u> Error: ldi too far\n",lab_struct[ra].line);
                            return(1);
                        }
                        inst|=rd&0x01FF;
                        lab_struct[ra].type++;
                    }
                    if((inst&0xF800)==0x4800)
                    {
                        //jsr
                        rs=0x3000+(lab_struct[ra].addr);
                        rd=rx-(rs+1);
                        if(check_offset11(rd))
                        {
                            printf("<%u> Error: jsr too far\n",lab_struct[ra].line);
                            return(1);
                        }
                        inst|=rd&0x07FF;
                        lab_struct[ra].type++;
                    }
                    if((inst&0xF000)==0xE000)
                    {
                        //lea
                        rs=0x3000+(lab_struct[ra].addr);
                        rd=rx-(rs+1);
                        if(check_offset9(rd))
                        {
                            printf("<%u> Error: lea too far\n",lab_struct[ra].line);
                            return(1);
                        }
                        inst|=rd&0x01FF;
                        lab_struct[ra].type++;
                    }
                    if((inst&0xF000)==0x3000)
                    {
                        //st
                        rs=0x3000+(lab_struct[ra].addr);
                        rd=rx-(rs+1);
                        if(check_offset9(rd))
                        {
                            printf("<%u> Error: st too far\n",lab_struct[ra].line);
                            return(1);
                        }
                        inst|=rd&0x01FF;
                        lab_struct[ra].type++;
                    }
                    if((inst&0xF000)==0xB000)
                    {
                        //sti
                        rs=0x3000+(lab_struct[ra].addr);
                        rd=rx-(rs+1);
                        if(check_offset9(rd))
                        {
                            printf("<%u> Error: sti too far\n",lab_struct[ra].line);
                            return(1);
                        }
                        inst|=rd&0x01FF;
                        lab_struct[ra].type++;
                    }

                    if(lab_struct[ra].type==1)
                    {
                        printf("<%u> Error: internal error, unknown instruction 0x%08X\n",lab_struct[ra].line,inst);
                        return(1);
                    }
                    mem[lab_struct[ra].addr]=inst;
                    break;
                }
            }
            if(rb<nlabs) ; else
            {
                printf("<%u> Error: unresolved label\n",lab_struct[ra].line);
                return(1);
            }
        }
    }
    sprintf(newline,"%s.hex",argv[1]);
    fpout=fopen(newline,"wt");
    if(fpout==NULL)
    {
        printf("Error creating file [%s]\n",newline);
        return(1);
    }

    for(ra=0;ra<=ADDMASK;ra++)
    {
        curradd=0x3000+ra;
        if(mark[ra]&0x80000000)
        {
            printf("0x%04X: 0x%04X\n",curradd,mem[ra]);

            rb=0x02;
            rb+=(curradd>>8)&0xFF;
            rb+=(curradd>>0)&0xFF;
            rb+=0x00;
            rb+=(mem[ra]>> 8)&0xFF;
            rb+=(mem[ra]>> 0)&0xFF;
            rb=(-rb)&0xFF;
            fprintf(fpout,":%02X%04X%02X%04X%02X\n",0x02,curradd&0xFFFF,0x00,mem[ra],rb);
        }
    }
    fclose(fpout);
    return(0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x2, -0x8(%rbp)
je 0x42b6
leaq 0xfd5(%rip), %rdi       # 0x5278
movb $0x0, %al
callq 0x1050
movl $0x1, -0x4(%rbp)
jmp 0x4bc7
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0xfc4(%rip), %rsi       # 0x5289
callq 0x10a0
movq %rax, 0x54382f(%rip)    # 0x547b00
cmpq $0x0, 0x543827(%rip)    # 0x547b00
jne 0x42fd
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
leaq 0xfa2(%rip), %rdi       # 0x528c
movb $0x0, %al
callq 0x1050
movl $0x1, -0x4(%rbp)
jmp 0x4bc7
callq 0x1fe0
movl %eax, -0x14(%rbp)
movq 0x5437f4(%rip), %rdi    # 0x547b00
callq 0x1040
cmpl $0x0, -0x14(%rbp)
je 0x4323
movl $0x1, -0x4(%rbp)
jmp 0x4bc7
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl 0x4c37bd(%rip), %eax    # 0x4c7af0
jae 0x4a22
movl -0x18(%rbp), %esi
movl -0x18(%rbp), %eax
movl %eax, %ecx
leaq 0x37a8(%rip), %rax      # 0x7af0
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movl 0x40(%rax), %edx
movl -0x18(%rbp), %eax
leaq 0x3794(%rip), %rcx      # 0x7af0
imulq $0x4c, %rax, %rax
addq %rax, %rcx
movl -0x18(%rbp), %eax
movl %eax, %edi
leaq 0x3781(%rip), %rax      # 0x7af0
imulq $0x4c, %rdi, %rdi
addq %rdi, %rax
movl 0x48(%rax), %r8d
leaq 0xf24(%rip), %rdi       # 0x52a5
movb $0x0, %al
callq 0x1050
movl -0x18(%rbp), %eax
movl %eax, %ecx
leaq 0x375c(%rip), %rax      # 0x7af0
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0x48(%rax)
je 0x4a12
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl 0x4c373b(%rip), %eax    # 0x4c7af0
jae 0x49d3
movl -0x1c(%rbp), %eax
movl %eax, %ecx
leaq 0x3729(%rip), %rax      # 0x7af0
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0x48(%rax)
je 0x43d9
jmp 0x49c5
movl -0x18(%rbp), %eax
leaq 0x370d(%rip), %rdi      # 0x7af0
imulq $0x4c, %rax, %rax
addq %rax, %rdi
movl -0x1c(%rbp), %eax
leaq 0x36fc(%rip), %rsi      # 0x7af0
imulq $0x4c, %rax, %rax
addq %rax, %rsi
callq 0x1080
cmpl $0x0, %eax
jne 0x49c3
movl -0x1c(%rbp), %eax
movl %eax, %ecx
leaq 0x36db(%rip), %rax      # 0x7af0
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movl 0x40(%rax), %eax
movl %eax, 0x36ab(%rip)      # 0x7ad0
movl -0x18(%rbp), %eax
movl %eax, %ecx
leaq 0x36bf(%rip), %rax      # 0x7af0
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movl 0x40(%rax), %eax
movl %eax, %ecx
leaq 0x4c36bc(%rip), %rax    # 0x4c7b00
movl (%rax,%rcx,4), %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
andl $0xf000, %eax           # imm = 0xF000
cmpl $0x0, %eax
jne 0x4500
movl -0x18(%rbp), %eax
movl %eax, %ecx
leaq 0x3689(%rip), %rax      # 0x7af0
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movl 0x40(%rax), %eax
addl $0x3000, %eax           # imm = 0x3000
movl %eax, 0x365c(%rip)      # 0x7ad8
movl 0x364e(%rip), %eax      # 0x7ad0
movl 0x3650(%rip), %ecx      # 0x7ad8
addl $0x1, %ecx
subl %ecx, %eax
movl %eax, 0x3641(%rip)      # 0x7ad4
movl 0x363b(%rip), %edi      # 0x7ad4
callq 0x1400
cmpl $0x0, %eax
je 0x44d3
movl -0x18(%rbp), %eax
movl %eax, %ecx
leaq 0x3641(%rip), %rax      # 0x7af0
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movl 0x44(%rax), %esi
leaq 0xc98(%rip), %rdi       # 0x5158
movb $0x0, %al
callq 0x1050
movl $0x1, -0x4(%rbp)
jmp 0x4bc7
movl 0x35fb(%rip), %eax      # 0x7ad4
andl $0x1ff, %eax            # imm = 0x1FF
orl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x18(%rbp), %eax
movl %eax, %ecx
leaq 0x3600(%rip), %rax      # 0x7af0
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movl 0x48(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x48(%rax)
movl -0x20(%rbp), %eax
andl $0xf000, %eax           # imm = 0xF000
cmpl $0x2000, %eax           # imm = 0x2000
jne 0x45b8
movl -0x18(%rbp), %eax
movl %eax, %ecx
leaq 0x35d1(%rip), %rax      # 0x7af0
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movl 0x40(%rax), %eax
addl $0x3000, %eax           # imm = 0x3000
movl %eax, 0x35a4(%rip)      # 0x7ad8
movl 0x3596(%rip), %eax      # 0x7ad0
movl 0x3598(%rip), %ecx      # 0x7ad8
addl $0x1, %ecx
subl %ecx, %eax
movl %eax, 0x3589(%rip)      # 0x7ad4
movl 0x3583(%rip), %edi      # 0x7ad4
callq 0x1400
cmpl $0x0, %eax
je 0x458b
movl -0x18(%rbp), %eax
movl %eax, %ecx
leaq 0x3589(%rip), %rax      # 0x7af0
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movl 0x44(%rax), %esi
leaq 0xc41(%rip), %rdi       # 0x51b9
movb $0x0, %al
callq 0x1050
movl $0x1, -0x4(%rbp)
jmp 0x4bc7
movl 0x3543(%rip), %eax      # 0x7ad4
andl $0x1ff, %eax            # imm = 0x1FF
orl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x18(%rbp), %eax
movl %eax, %ecx
leaq 0x3548(%rip), %rax      # 0x7af0
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movl 0x48(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x48(%rax)
movl -0x20(%rbp), %eax
andl $0xf000, %eax           # imm = 0xF000
cmpl $0xa000, %eax           # imm = 0xA000
jne 0x4670
movl -0x18(%rbp), %eax
movl %eax, %ecx
leaq 0x3519(%rip), %rax      # 0x7af0
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movl 0x40(%rax), %eax
addl $0x3000, %eax           # imm = 0x3000
movl %eax, 0x34ec(%rip)      # 0x7ad8
movl 0x34de(%rip), %eax      # 0x7ad0
movl 0x34e0(%rip), %ecx      # 0x7ad8
addl $0x1, %ecx
subl %ecx, %eax
movl %eax, 0x34d1(%rip)      # 0x7ad4
movl 0x34cb(%rip), %edi      # 0x7ad4
callq 0x1400
cmpl $0x0, %eax
je 0x4643
movl -0x18(%rbp), %eax
movl %eax, %ecx
leaq 0x34d1(%rip), %rax      # 0x7af0
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movl 0x44(%rax), %esi
leaq 0xba6(%rip), %rdi       # 0x51d6
movb $0x0, %al
callq 0x1050
movl $0x1, -0x4(%rbp)
jmp 0x4bc7
movl 0x348b(%rip), %eax      # 0x7ad4
andl $0x1ff, %eax            # imm = 0x1FF
orl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x18(%rbp), %eax
movl %eax, %ecx
leaq 0x3490(%rip), %rax      # 0x7af0
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movl 0x48(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x48(%rax)
movl -0x20(%rbp), %eax
andl $0xf800, %eax           # imm = 0xF800
cmpl $0x4800, %eax           # imm = 0x4800
jne 0x4728
movl -0x18(%rbp), %eax
movl %eax, %ecx
leaq 0x3461(%rip), %rax      # 0x7af0
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movl 0x40(%rax), %eax
addl $0x3000, %eax           # imm = 0x3000
movl %eax, 0x3434(%rip)      # 0x7ad8
movl 0x3426(%rip), %eax      # 0x7ad0
movl 0x3428(%rip), %ecx      # 0x7ad8
addl $0x1, %ecx
subl %ecx, %eax
movl %eax, 0x3419(%rip)      # 0x7ad4
movl 0x3413(%rip), %edi      # 0x7ad4
callq 0x1450
cmpl $0x0, %eax
je 0x46fb
movl -0x18(%rbp), %eax
movl %eax, %ecx
leaq 0x3419(%rip), %rax      # 0x7af0
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movl 0x44(%rax), %esi
leaq 0xab4(%rip), %rdi       # 0x519c
movb $0x0, %al
callq 0x1050
movl $0x1, -0x4(%rbp)
jmp 0x4bc7
movl 0x33d3(%rip), %eax      # 0x7ad4
andl $0x7ff, %eax            # imm = 0x7FF
orl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x18(%rbp), %eax
movl %eax, %ecx
leaq 0x33d8(%rip), %rax      # 0x7af0
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movl 0x48(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x48(%rax)
movl -0x20(%rbp), %eax
andl $0xf000, %eax           # imm = 0xF000
cmpl $0xe000, %eax           # imm = 0xE000
jne 0x47e0
movl -0x18(%rbp), %eax
movl %eax, %ecx
leaq 0x33a9(%rip), %rax      # 0x7af0
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movl 0x40(%rax), %eax
addl $0x3000, %eax           # imm = 0x3000
movl %eax, 0x337c(%rip)      # 0x7ad8
movl 0x336e(%rip), %eax      # 0x7ad0
movl 0x3370(%rip), %ecx      # 0x7ad8
addl $0x1, %ecx
subl %ecx, %eax
movl %eax, 0x3361(%rip)      # 0x7ad4
movl 0x335b(%rip), %edi      # 0x7ad4
callq 0x1400
cmpl $0x0, %eax
je 0x47b3
movl -0x18(%rbp), %eax
movl %eax, %ecx
leaq 0x3361(%rip), %rax      # 0x7af0
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movl 0x44(%rax), %esi
leaq 0xa59(%rip), %rdi       # 0x51f9
movb $0x0, %al
callq 0x1050
movl $0x1, -0x4(%rbp)
jmp 0x4bc7
movl 0x331b(%rip), %eax      # 0x7ad4
andl $0x1ff, %eax            # imm = 0x1FF
orl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x18(%rbp), %eax
movl %eax, %ecx
leaq 0x3320(%rip), %rax      # 0x7af0
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movl 0x48(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x48(%rax)
movl -0x20(%rbp), %eax
andl $0xf000, %eax           # imm = 0xF000
cmpl $0x3000, %eax           # imm = 0x3000
jne 0x4898
movl -0x18(%rbp), %eax
movl %eax, %ecx
leaq 0x32f1(%rip), %rax      # 0x7af0
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movl 0x40(%rax), %eax
addl $0x3000, %eax           # imm = 0x3000
movl %eax, 0x32c4(%rip)      # 0x7ad8
movl 0x32b6(%rip), %eax      # 0x7ad0
movl 0x32b8(%rip), %ecx      # 0x7ad8
addl $0x1, %ecx
subl %ecx, %eax
movl %eax, 0x32a9(%rip)      # 0x7ad4
movl 0x32a3(%rip), %edi      # 0x7ad4
callq 0x1400
cmpl $0x0, %eax
je 0x486b
movl -0x18(%rbp), %eax
movl %eax, %ecx
leaq 0x32a9(%rip), %rax      # 0x7af0
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movl 0x44(%rax), %esi
leaq 0x9be(%rip), %rdi       # 0x5216
movb $0x0, %al
callq 0x1050
movl $0x1, -0x4(%rbp)
jmp 0x4bc7
movl 0x3263(%rip), %eax      # 0x7ad4
andl $0x1ff, %eax            # imm = 0x1FF
orl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x18(%rbp), %eax
movl %eax, %ecx
leaq 0x3268(%rip), %rax      # 0x7af0
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movl 0x48(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x48(%rax)
movl -0x20(%rbp), %eax
andl $0xf000, %eax           # imm = 0xF000
cmpl $0xb000, %eax           # imm = 0xB000
jne 0x4950
movl -0x18(%rbp), %eax
movl %eax, %ecx
leaq 0x3239(%rip), %rax      # 0x7af0
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movl 0x40(%rax), %eax
addl $0x3000, %eax           # imm = 0x3000
movl %eax, 0x320c(%rip)      # 0x7ad8
movl 0x31fe(%rip), %eax      # 0x7ad0
movl 0x3200(%rip), %ecx      # 0x7ad8
addl $0x1, %ecx
subl %ecx, %eax
movl %eax, 0x31f1(%rip)      # 0x7ad4
movl 0x31eb(%rip), %edi      # 0x7ad4
callq 0x1400
cmpl $0x0, %eax
je 0x4923
movl -0x18(%rbp), %eax
movl %eax, %ecx
leaq 0x31f1(%rip), %rax      # 0x7af0
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movl 0x44(%rax), %esi
leaq 0x923(%rip), %rdi       # 0x5233
movb $0x0, %al
callq 0x1050
movl $0x1, -0x4(%rbp)
jmp 0x4bc7
movl 0x31ab(%rip), %eax      # 0x7ad4
andl $0x1ff, %eax            # imm = 0x1FF
orl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x18(%rbp), %eax
movl %eax, %ecx
leaq 0x31b0(%rip), %rax      # 0x7af0
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movl 0x48(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x48(%rax)
movl -0x18(%rbp), %eax
movl %eax, %ecx
leaq 0x3194(%rip), %rax      # 0x7af0
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
cmpl $0x1, 0x48(%rax)
jne 0x499c
movl -0x18(%rbp), %eax
movl %eax, %ecx
leaq 0x317b(%rip), %rax      # 0x7af0
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movl 0x44(%rax), %esi
movl -0x20(%rbp), %edx
leaq 0x939(%rip), %rdi       # 0x52c2
movb $0x0, %al
callq 0x1050
movl $0x1, -0x4(%rbp)
jmp 0x4bc7
movl -0x20(%rbp), %edx
movl -0x18(%rbp), %eax
movl %eax, %ecx
leaq 0x3145(%rip), %rax      # 0x7af0
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movl 0x40(%rax), %eax
movl %eax, %ecx
leaq 0x4c3142(%rip), %rax    # 0x4c7b00
movl %edx, (%rax,%rcx,4)
jmp 0x49d3
jmp 0x49c5
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x43ac
movl -0x1c(%rbp), %eax
cmpl 0x4c3114(%rip), %eax    # 0x4c7af0
jae 0x49e0
jmp 0x4a10
movl -0x18(%rbp), %eax
movl %eax, %ecx
leaq 0x3104(%rip), %rax      # 0x7af0
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movl 0x44(%rax), %esi
leaq 0x8fd(%rip), %rdi       # 0x52fa
movb $0x0, %al
callq 0x1050
movl $0x1, -0x4(%rbp)
jmp 0x4bc7
jmp 0x4a12
jmp 0x4a14
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x432a
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0x288f(%rip), %rdi      # 0x72c0
leaq 0x8e0(%rip), %rsi       # 0x5318
movb $0x0, %al
callq 0x10c0
leaq 0x287a(%rip), %rdi      # 0x72c0
leaq 0x8d2(%rip), %rsi       # 0x531f
callq 0x10a0
movq %rax, 0x5430b7(%rip)    # 0x547b10
cmpq $0x0, 0x5430af(%rip)    # 0x547b10
jne 0x4a84
leaq 0x8b8(%rip), %rdi       # 0x5322
leaq 0x284f(%rip), %rsi      # 0x72c0
movb $0x0, %al
callq 0x1050
movl $0x1, -0x4(%rbp)
jmp 0x4bc7
movl $0x0, -0x18(%rbp)
cmpl $0xffff, -0x18(%rbp)    # imm = 0xFFFF
ja 0x4bb4
movl -0x18(%rbp), %eax
addl $0x3000, %eax           # imm = 0x3000
movl %eax, 0x4c304e(%rip)    # 0x4c7af4
movl -0x18(%rbp), %eax
movl %eax, %ecx
leaq 0x50304e(%rip), %rax    # 0x507b00
movl (%rax,%rcx,4), %eax
andl $0x80000000, %eax       # imm = 0x80000000
cmpl $0x0, %eax
je 0x4ba4
movl 0x4c302b(%rip), %esi    # 0x4c7af4
movl -0x18(%rbp), %eax
movl %eax, %ecx
leaq 0x4c302b(%rip), %rax    # 0x4c7b00
movl (%rax,%rcx,4), %edx
leaq 0x85d(%rip), %rdi       # 0x533c
movb $0x0, %al
callq 0x1050
movl $0x2, -0x1c(%rbp)
movl 0x4c3001(%rip), %eax    # 0x4c7af4
shrl $0x8, %eax
andl $0xff, %eax
addl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl 0x4c2fed(%rip), %eax    # 0x4c7af4
shrl $0x0, %eax
andl $0xff, %eax
addl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
addl $0x0, %eax
movl %eax, -0x1c(%rbp)
movl -0x18(%rbp), %eax
movl %eax, %ecx
leaq 0x4c2fd6(%rip), %rax    # 0x4c7b00
movl (%rax,%rcx,4), %eax
shrl $0x8, %eax
andl $0xff, %eax
addl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x18(%rbp), %eax
movl %eax, %ecx
leaq 0x4c2fb9(%rip), %rax    # 0x4c7b00
movl (%rax,%rcx,4), %eax
shrl $0x0, %eax
andl $0xff, %eax
addl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
xorl %eax, %eax
subl -0x1c(%rbp), %eax
andl $0xff, %eax
movl %eax, -0x1c(%rbp)
movq 0x542fa4(%rip), %rdi    # 0x547b10
movl 0x4c2f82(%rip), %ecx    # 0x4c7af4
andl $0xffff, %ecx           # imm = 0xFFFF
movl -0x18(%rbp), %eax
movl %eax, %edx
leaq 0x4c2f7c(%rip), %rax    # 0x4c7b00
movl (%rax,%rdx,4), %r9d
movl -0x1c(%rbp), %eax
leaq 0x7ba(%rip), %rsi       # 0x534c
movl $0x2, %edx
xorl %r8d, %r8d
movl %eax, (%rsp)
movb $0x0, %al
callq 0x1090
jmp 0x4ba6
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x4a8b
movq 0x542f55(%rip), %rdi    # 0x547b10
callq 0x1040
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq