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

    is_const=0;
    is_label=0;
    for(;newline[ra];ra++) if(newline[ra]!=0x20) break;
    if(numchar[newline[ra]])
    {
        ra=parse_immed(ra); if(ra==0) return(0);
        is_const=1;
    }
    else
    {
        //assume label, find space or eol.
        for(rb=ra;newline[rb];rb++)
        {
            if(newline[rb]==0x20) break; //no spaces in labels
        }
        //got a label
        rc=rb-ra;
        if(rc==0)
        {
            printf("<%u> Error: Invalid label\n",line);
            return(0);
        }
        rc--;
        if(rc>=LABLEN)
        {
            printf("<%u> Error: Label too long\n",line);
            return(0);
        }
        for(rb=0;rb<=rc;rb++)
        {
            lab_struct[nlabs].name[rb]=newline[ra++];
        }
        lab_struct[nlabs].name[rb]=0;
        lab_struct[nlabs].addr=curradd;
        lab_struct[nlabs].line=line;
        lab_struct[nlabs].type=1;
        nlabs++;
        rx=0;
        is_label=1;
    }
    return(ra);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl %edi, -0x8(%rbp)
movl $0x0, 0x5e7b(%rip)      # 0x7ae0
movl $0x0, 0x5e75(%rip)      # 0x7ae4
movl -0x8(%rbp), %eax
movl %eax, %ecx
leaq 0x5645(%rip), %rax      # 0x72c0
cmpb $0x0, (%rax,%rcx)
je 0x1ca5
movl -0x8(%rbp), %eax
movl %eax, %ecx
leaq 0x5633(%rip), %rax      # 0x72c0
movsbl (%rax,%rcx), %eax
cmpl $0x20, %eax
je 0x1c98
jmp 0x1ca5
jmp 0x1c9a
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x1c6f
movl -0x8(%rbp), %eax
movl %eax, %ecx
leaq 0x560f(%rip), %rax      # 0x72c0
movsbq (%rax,%rcx), %rcx
leaq 0x54f3(%rip), %rax      # 0x71b0
cmpb $0x0, (%rax,%rcx)
je 0x1cef
movl -0x8(%rbp), %edi
callq 0x14a0
movl %eax, -0x8(%rbp)
cmpl $0x0, -0x8(%rbp)
jne 0x1ce0
movl $0x0, -0x4(%rbp)
jmp 0x1e79
movl $0x1, 0x5df6(%rip)      # 0x7ae0
jmp 0x1e73
movl -0x8(%rbp), %eax
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %eax
movl %eax, %ecx
leaq 0x55bf(%rip), %rax      # 0x72c0
cmpb $0x0, (%rax,%rcx)
je 0x1d2b
movl -0xc(%rbp), %eax
movl %eax, %ecx
leaq 0x55ad(%rip), %rax      # 0x72c0
movsbl (%rax,%rcx), %eax
cmpl $0x20, %eax
jne 0x1d1e
jmp 0x1d2b
jmp 0x1d20
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x1cf5
movl -0xc(%rbp), %eax
subl -0x8(%rbp), %eax
movl %eax, -0x10(%rbp)
cmpl $0x0, -0x10(%rbp)
jne 0x1d5a
movl 0x5980(%rip), %esi      # 0x76c0
leaq 0x3379(%rip), %rdi      # 0x50c0
movb $0x0, %al
callq 0x1050
movl $0x0, -0x4(%rbp)
jmp 0x1e79
movl -0x10(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x10(%rbp)
cmpl $0x40, -0x10(%rbp)
jb 0x1d89
movl 0x5951(%rip), %esi      # 0x76c0
leaq 0x3365(%rip), %rdi      # 0x50db
movb $0x0, %al
callq 0x1050
movl $0x0, -0x4(%rbp)
jmp 0x1e79
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
cmpl -0x10(%rbp), %eax
ja 0x1dd8
movl -0x8(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x8(%rbp)
movl %eax, %eax
movl %eax, %ecx
leaq 0x5512(%rip), %rax      # 0x72c0
movb (%rax,%rcx), %dl
movl 0x4c5d39(%rip), %eax    # 0x4c7af0
movl %eax, %ecx
leaq 0x5d30(%rip), %rax      # 0x7af0
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movl -0xc(%rbp), %ecx
movb %dl, (%rax,%rcx)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x1d90
movl 0x4c5d12(%rip), %eax    # 0x4c7af0
movl %eax, %ecx
leaq 0x5d09(%rip), %rax      # 0x7af0
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movl -0xc(%rbp), %ecx
movb $0x0, (%rax,%rcx)
movl 0x4c5cf9(%rip), %ecx    # 0x4c7af4
movl 0x4c5cef(%rip), %eax    # 0x4c7af0
movl %eax, %edx
leaq 0x5ce6(%rip), %rax      # 0x7af0
imulq $0x4c, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x40(%rax)
movl 0x58a6(%rip), %ecx      # 0x76c0
movl 0x4c5cd0(%rip), %eax    # 0x4c7af0
movl %eax, %edx
leaq 0x5cc7(%rip), %rax      # 0x7af0
imulq $0x4c, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x44(%rax)
movl 0x4c5cb7(%rip), %eax    # 0x4c7af0
movl %eax, %ecx
leaq 0x5cae(%rip), %rax      # 0x7af0
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movl $0x1, 0x48(%rax)
movl 0x4c5c9a(%rip), %eax    # 0x4c7af0
addl $0x1, %eax
movl %eax, 0x4c5c91(%rip)    # 0x4c7af0
movl $0x0, 0x5c67(%rip)      # 0x7ad0
movl $0x1, 0x5c71(%rip)      # 0x7ae4
movl -0x8(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)