// File: /workspace/github_c_makefile_star2_O3/afi-lambda[P]a_little_smalltalk/src/parser.c
// Function: nameTerm
static boolean nameTerm(char *name)
{
    int i;
    boolean done = false;
    boolean isSuper = false;

    /* it might be self or super */
    if (streq(name, "self") || streq(name, "super"))
    {
        genInstruction(PushArgument, 0);
        done = true;
        if (streq(name,"super"))
            isSuper = true;
    }

    /* or it might be a temporary (reverse this to get most recent first)*/
    if (!done)
        for (i = temporaryTop; (!done) && (i >= 1); i--)
            if (streq(name, temporaryName[i]))
            {
                genInstruction(PushTemporary, i - 1);
                done = true;
            }

    /* or it might be an argument */
    if (!done)
        for (i = 1; (!done) && (i <= argumentTop); i++)
            if (streq(name, argumentName[i]))
            {
                genInstruction(PushArgument, i);
                done = true;
            }

    /* or it might be an instance variable */
    if (!done)
        for (i = 1; (!done) && (i <= instanceTop); i++)
        {
            if (streq(name, instanceName[i]))
            {
                genInstruction(PushInstance, i - 1);
                done = true;
            }
        }

    /* or it might be a global constant */
    if (!done)
        for (i = 0; (!done) && glbsyms[i]; i++)
            if (streq(name, glbsyms[i]))
            {
                genInstruction(PushConstant, i + 4);
                done = true;
            }

    /* not anything else, it must be a global */
    /* must look it up at run time */
    if (!done)
    {
        genInstruction(PushLiteral, genLiteral(newSymbol(name)));
        genMessage(false, 0, newSymbol("value"));
    }

    return (isSuper);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
leaq 0x24fc(%rip), %rsi      # 0x9a47
callq 0x2160
testl %eax, %eax
je 0x7682
leaq 0x24ed(%rip), %rsi      # 0x9a4c
movq %rbx, %rdi
callq 0x2160
testl %eax, %eax
je 0x7682
movslq 0x217da(%rip), %r14     # 0x28d50
testq %r14, %r14
jle 0x75ac
leaq 0x2232e(%rip), %rax     # 0x298b0
leaq (%rax,%r14,8), %r15
movq (%r15), %rsi
movq %rbx, %rdi
callq 0x2160
testl %eax, %eax
je 0x76d9
je 0x75ac
leaq -0x1(%r14), %rax
addq $-0x8, %r15
cmpq $0x1, %r14
movq %rax, %r14
jg 0x7586
movslq 0x21799(%rip), %r15     # 0x28d4c
testq %r15, %r15
jle 0x75e5
movl $0x1, %r14d
leaq 0x21aeb(%rip), %r12     # 0x290b0
movq (%r12,%r14,8), %rsi
movq %rbx, %rdi
callq 0x2160
testl %eax, %eax
je 0x76e3
leaq 0x1(%r14), %rax
cmpq %r15, %r14
movq %rax, %r14
jb 0x75c5
movslq 0x20f44(%rip), %r15     # 0x28530
testq %r15, %r15
jle 0x7618
xorl %r14d, %r14d
leaq 0x20f45(%rip), %r12     # 0x28540
movq 0x8(%r12,%r14,8), %rsi
movq %rbx, %rdi
callq 0x2160
testl %eax, %eax
je 0x76f3
incq %r14
cmpq %r15, %r14
jb 0x75fb
movl $0x4, %ebp
xorl %r14d, %r14d
leaq 0x5769(%rip), %r15      # 0xcd90
movq (%r14,%r15), %rsi
movq %rbx, %rdi
callq 0x2160
testl %eax, %eax
je 0x76ea
incl %ebp
addq $0x8, %r14
cmpq $0x20, %r14
jne 0x7627
movq %rbx, %rdi
callq 0x379b
movswl %ax, %edi
callq 0x77ff
movl $0x4, %edi
movl %eax, %esi
callq 0x6f21
leaq 0x1bd0(%rip), %rdi      # 0x923a
callq 0x379b
movswl %ax, %edx
xorl %ebx, %ebx
xorl %edi, %edi
xorl %esi, %esi
callq 0x71c6
jmp 0x7702
movslq 0x216bf(%rip), %rax     # 0x28d48
cmpq $0x100, %rax            # imm = 0x100
jl 0x76ad
leaq 0x217c8(%rip), %rdi     # 0x28e60
leaq 0x242f(%rip), %rsi      # 0x9ace
leaq 0x2027(%rip), %rdx      # 0x96cd
callq 0x26d5
jmp 0x76c1
leal 0x1(%rax), %ecx
movl %ecx, 0x21692(%rip)     # 0x28d48
leaq 0x216a3(%rip), %rcx     # 0x28d60
movb $0x20, (%rax,%rcx)
leaq 0x2384(%rip), %rsi      # 0x9a4c
movq %rbx, %rdi
callq 0x2160
xorl %ebx, %ebx
testl %eax, %eax
sete %bl
jmp 0x7702
decl %r14d
movl $0x3, %edi
jmp 0x76f8
movl $0x2, %edi
jmp 0x76f8
movl $0x5, %edi
movl %ebp, %esi
jmp 0x76fb
movl $0x1, %edi
movl %r14d, %esi
callq 0x6f21
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq