// File: /workspace/github_c_makefile_star2_O0/dwelch67[P]lc3/lc3asm.c
// Function: parse_immed
unsigned int parse_immed ( unsigned int ra )
{
    unsigned int rb;

    if((newline[ra]==0x30)&&((newline[ra+1]=='x')||(newline[ra+1]=='X')))
    {
        ra+=2;
        rb=0;
        for(;newline[ra];ra++)
        {
            if(newline[ra]==0x20) break;
            if(!hexchar[newline[ra]])
            {
                printf("<%u> Error: invalid number\n",line);
                return(0);
            }
            cstring[rb++]=newline[ra];
        }
        cstring[rb]=0;
        if(rb==0)
        {
            printf("<%u> Error: invalid number\n",line);
            return(0);
        }
        rx=strtoul(cstring,NULL,16);
    }
    else
    {
        rb=0;
        for(;newline[ra];ra++)
        {
            if(newline[ra]==0x20) break;
            if(!numchar[newline[ra]])
            {
                printf("<%u> Error: invalid number\n",line);
                return(0);
            }
            cstring[rb++]=newline[ra];
        }
        cstring[rb]=0;
        if(rb==0)
        {
            printf("<%u> Error: invalid number\n",line);
            return(0);
        }
        rx=strtoul(cstring,NULL,10);
    }
    for(;newline[ra];ra++) if(newline[ra]!=0x20) break;
    return(ra);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl %edi, -0x8(%rbp)
movl -0x8(%rbp), %eax
movl %eax, %ecx
leaq 0x5e09(%rip), %rax      # 0x72c0
movsbl (%rax,%rcx), %eax
cmpl $0x30, %eax
jne 0x1603
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x5deb(%rip), %rax      # 0x72c0
movsbl (%rax,%rcx), %eax
cmpl $0x78, %eax
je 0x14fc
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x5dd1(%rip), %rax      # 0x72c0
movsbl (%rax,%rcx), %eax
cmpl $0x58, %eax
jne 0x1603
movl -0x8(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
movl -0x8(%rbp), %eax
movl %eax, %ecx
leaq 0x5da8(%rip), %rax      # 0x72c0
cmpb $0x0, (%rax,%rcx)
je 0x15ad
movl -0x8(%rbp), %eax
movl %eax, %ecx
leaq 0x5d92(%rip), %rax      # 0x72c0
movsbl (%rax,%rcx), %eax
cmpl $0x20, %eax
jne 0x1539
jmp 0x15ad
movl -0x8(%rbp), %eax
movl %eax, %ecx
leaq 0x5d7b(%rip), %rax      # 0x72c0
movsbq (%rax,%rcx), %rcx
leaq 0x5b5f(%rip), %rax      # 0x70b0
cmpb $0x0, (%rax,%rcx)
jne 0x1577
movl 0x6163(%rip), %esi      # 0x76c0
leaq 0x3b0a(%rip), %rdi      # 0x506e
movb $0x0, %al
callq 0x1050
movl $0x0, -0x4(%rbp)
jmp 0x1737
movl -0x8(%rbp), %eax
movl %eax, %ecx
leaq 0x5d3d(%rip), %rax      # 0x72c0
movb (%rax,%rcx), %dl
movl -0xc(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0xc(%rbp)
movl %eax, %eax
movl %eax, %ecx
leaq 0x6134(%rip), %rax      # 0x76d0
movb %dl, (%rax,%rcx)
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x150c
movl -0xc(%rbp), %eax
movl %eax, %ecx
leaq 0x6117(%rip), %rax      # 0x76d0
movb $0x0, (%rax,%rcx)
cmpl $0x0, -0xc(%rbp)
jne 0x15e3
movl 0x60f7(%rip), %esi      # 0x76c0
leaq 0x3a9e(%rip), %rdi      # 0x506e
movb $0x0, %al
callq 0x1050
movl $0x0, -0x4(%rbp)
jmp 0x1737
leaq 0x60e6(%rip), %rdi      # 0x76d0
xorl %eax, %eax
movl %eax, %esi
movl $0x10, %edx
callq 0x10b0
movl %eax, 0x64d2(%rip)      # 0x7ad0
jmp 0x16f9
movl $0x0, -0xc(%rbp)
movl -0x8(%rbp), %eax
movl %eax, %ecx
leaq 0x5caa(%rip), %rax      # 0x72c0
cmpb $0x0, (%rax,%rcx)
je 0x16ab
movl -0x8(%rbp), %eax
movl %eax, %ecx
leaq 0x5c94(%rip), %rax      # 0x72c0
movsbl (%rax,%rcx), %eax
cmpl $0x20, %eax
jne 0x1637
jmp 0x16ab
movl -0x8(%rbp), %eax
movl %eax, %ecx
leaq 0x5c7d(%rip), %rax      # 0x72c0
movsbq (%rax,%rcx), %rcx
leaq 0x5b61(%rip), %rax      # 0x71b0
cmpb $0x0, (%rax,%rcx)
jne 0x1675
movl 0x6065(%rip), %esi      # 0x76c0
leaq 0x3a0c(%rip), %rdi      # 0x506e
movb $0x0, %al
callq 0x1050
movl $0x0, -0x4(%rbp)
jmp 0x1737
movl -0x8(%rbp), %eax
movl %eax, %ecx
leaq 0x5c3f(%rip), %rax      # 0x72c0
movb (%rax,%rcx), %dl
movl -0xc(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0xc(%rbp)
movl %eax, %eax
movl %eax, %ecx
leaq 0x6036(%rip), %rax      # 0x76d0
movb %dl, (%rax,%rcx)
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x160a
movl -0xc(%rbp), %eax
movl %eax, %ecx
leaq 0x6019(%rip), %rax      # 0x76d0
movb $0x0, (%rax,%rcx)
cmpl $0x0, -0xc(%rbp)
jne 0x16de
movl 0x5ff9(%rip), %esi      # 0x76c0
leaq 0x39a0(%rip), %rdi      # 0x506e
movb $0x0, %al
callq 0x1050
movl $0x0, -0x4(%rbp)
jmp 0x1737
leaq 0x5feb(%rip), %rdi      # 0x76d0
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x10b0
movl %eax, 0x63d7(%rip)      # 0x7ad0
jmp 0x16fb
movl -0x8(%rbp), %eax
movl %eax, %ecx
leaq 0x5bb9(%rip), %rax      # 0x72c0
cmpb $0x0, (%rax,%rcx)
je 0x1731
movl -0x8(%rbp), %eax
movl %eax, %ecx
leaq 0x5ba7(%rip), %rax      # 0x72c0
movsbl (%rax,%rcx), %eax
cmpl $0x20, %eax
je 0x1724
jmp 0x1731
jmp 0x1726
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x16fb
movl -0x8(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq