// File: /workspace/github_c_makefile_star2_O2/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 %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x2ca5(%rip), %rsi      # 0x9a27
callq 0x2150
testl %eax, %eax
je 0x6dea
leaq 0x2c9a(%rip), %rsi      # 0x9a2c
movq %rbx, %rdi
callq 0x2150
testl %eax, %eax
je 0x6dea
movl 0x21fab(%rip), %r14d    # 0x28d50
leaq 0x22b04(%rip), %rax     # 0x298b0
leaq (%rax,%r14,8), %r15
xorl %ecx, %ecx
pushq $0x3
popq %rbp
pushq $0x1
popq %r12
testl %ecx, %ecx
jne 0x6e0f
testl %r14d, %r14d
jle 0x6e0f
movq (%r15), %rsi
movq %rbx, %rdi
callq 0x2150
xorl %ecx, %ecx
testl %eax, %eax
jne 0x6de1
leal -0x1(%r14), %esi
movl %ebp, %edi
callq 0x699a
movl %r12d, %ecx
addq $-0x8, %r15
decl %r14d
jmp 0x6db9
pushq $0x20
popq %rdi
callq 0x7361
leaq 0x2c33(%rip), %rsi      # 0x9a2c
movq %rbx, %rdi
callq 0x2150
xorl %r14d, %r14d
testl %eax, %eax
sete %r14b
jmp 0x6ec2
testl %ecx, %ecx
jne 0x6ebf
xorl %ecx, %ecx
pushq $0x1
popq %r14
movl 0x21f28(%rip), %r13d    # 0x28d4c
leaq 0x22285(%rip), %r15     # 0x290b0
pushq $0x2
popq %rbp
pushq $0x1
popq %r12
testl %ecx, %ecx
jne 0x6e69
movslq %r13d, %rax
cmpq %rax, %r14
jg 0x6e69
movq (%r15,%r14,8), %rsi
movq %rbx, %rdi
callq 0x2150
xorl %ecx, %ecx
testl %eax, %eax
jne 0x6e64
movl %ebp, %edi
movl %r14d, %esi
callq 0x699a
movl 0x21eeb(%rip), %r13d    # 0x28d4c
movl %r12d, %ecx
incq %r14
jmp 0x6e32
testl %ecx, %ecx
jne 0x6ebf
xorl %ecx, %ecx
pushq $0x1
popq %r14
movl 0x216b6(%rip), %r12d    # 0x28530
leaq 0x216bf(%rip), %r15     # 0x28540
pushq $0x1
popq %rbp
testl %ecx, %ecx
jne 0x6ebb
movslq %r12d, %rax
cmpq %rax, %r14
jg 0x6ebb
movq (%r15,%r14,8), %rsi
movq %rbx, %rdi
callq 0x2150
xorl %ecx, %ecx
testl %eax, %eax
jne 0x6eb6
leal -0x1(%r14), %esi
movl %ebp, %edi
callq 0x699a
movl 0x2167c(%rip), %r12d    # 0x28530
movl %ebp, %ecx
incq %r14
jmp 0x6e84
testl %ecx, %ecx
je 0x6ed4
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r14d, %r14d
pushq $0x4
popq %rbp
leaq 0x5eaf(%rip), %r12      # 0xcd90
pushq $0x1
popq %r13
xorl %r15d, %r15d
xorl %ecx, %ecx
testl %ecx, %ecx
jne 0x6ec2
cmpq $0x20, %r15
je 0x6f1b
movq (%r15,%r12), %rsi
movq %rbx, %rdi
callq 0x2150
xorl %ecx, %ecx
testl %eax, %eax
jne 0x6f13
pushq $0x5
popq %rdi
movl %ebp, %esi
callq 0x699a
movl %r13d, %ecx
incl %ebp
addq $0x8, %r15
jmp 0x6eea
movq %rbx, %rdi
callq 0x3368
movswl %ax, %edi
callq 0x6fb3
pushq $0x4
popq %rdi
movl %eax, %esi
callq 0x699a
leaq 0x22e8(%rip), %rdi      # 0x9224
callq 0x3368
movswl %ax, %edx
xorl %r14d, %r14d
xorl %edi, %edi
xorl %esi, %esi
callq 0x6abe
jmp 0x6ec2