// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl $0x0, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x2a2f(%rip), %rsi      # 0xc9c4
callq 0x2150
cmpl $0x0, %eax
je 0x9fb4
movq -0x8(%rbp), %rdi
leaq 0x2a1f(%rip), %rsi      # 0xc9c9
callq 0x2150
cmpl $0x0, %eax
jne 0x9fe5
movl $0x2, %edi
xorl %esi, %esi
callq 0x9650
movl $0x1, -0x10(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x29f7(%rip), %rsi      # 0xc9c9
callq 0x2150
cmpl $0x0, %eax
jne 0x9fe3
movl $0x1, -0x14(%rbp)
jmp 0x9fe5
cmpl $0x0, -0x10(%rbp)
jne 0xa055
movl 0x20d9f(%rip), %eax     # 0x2ad90
movl %eax, -0xc(%rbp)
xorl %eax, %eax
cmpl $0x0, -0x10(%rbp)
movb %al, -0x15(%rbp)
jne 0xa009
cmpl $0x1, -0xc(%rbp)
setge %al
movb %al, -0x15(%rbp)
movb -0x15(%rbp), %al
testb $0x1, %al
jne 0xa012
jmp 0xa053
movq -0x8(%rbp), %rdi
movslq -0xc(%rbp), %rcx
leaq 0x218cf(%rip), %rax     # 0x2b8f0
movq (%rax,%rcx,8), %rsi
callq 0x2150
cmpl $0x0, %eax
jne 0xa046
movl -0xc(%rbp), %esi
subl $0x1, %esi
movl $0x3, %edi
callq 0x9650
movl $0x1, -0x10(%rbp)
jmp 0xa048
movl -0xc(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x9ff4
jmp 0xa055
cmpl $0x0, -0x10(%rbp)
jne 0xa0c5
movl $0x1, -0xc(%rbp)
xorl %eax, %eax
cmpl $0x0, -0x10(%rbp)
movb %al, -0x16(%rbp)
jne 0xa07c
movl -0xc(%rbp), %eax
cmpl 0x20d16(%rip), %eax     # 0x2ad8c
setle %al
movb %al, -0x16(%rbp)
movb -0x16(%rbp), %al
testb $0x1, %al
jne 0xa085
jmp 0xa0c3
movq -0x8(%rbp), %rdi
movslq -0xc(%rbp), %rcx
leaq 0x2105c(%rip), %rax     # 0x2b0f0
movq (%rax,%rcx,8), %rsi
callq 0x2150
cmpl $0x0, %eax
jne 0xa0b6
movl -0xc(%rbp), %esi
movl $0x2, %edi
callq 0x9650
movl $0x1, -0x10(%rbp)
jmp 0xa0b8
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0xa062
jmp 0xa0c5
cmpl $0x0, -0x10(%rbp)
jne 0xa138
movl $0x1, -0xc(%rbp)
xorl %eax, %eax
cmpl $0x0, -0x10(%rbp)
movb %al, -0x17(%rbp)
jne 0xa0ec
movl -0xc(%rbp), %eax
cmpl 0x2048a(%rip), %eax     # 0x2a570
setle %al
movb %al, -0x17(%rbp)
movb -0x17(%rbp), %al
testb $0x1, %al
jne 0xa0f5
jmp 0xa136
movq -0x8(%rbp), %rdi
movslq -0xc(%rbp), %rcx
leaq 0x2047c(%rip), %rax     # 0x2a580
movq (%rax,%rcx,8), %rsi
callq 0x2150
cmpl $0x0, %eax
jne 0xa129
movl -0xc(%rbp), %esi
subl $0x1, %esi
movl $0x1, %edi
callq 0x9650
movl $0x1, -0x10(%rbp)
jmp 0xa12b
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0xa0d2
jmp 0xa138
cmpl $0x0, -0x10(%rbp)
jne 0xa1b2
movl $0x0, -0xc(%rbp)
xorl %eax, %eax
cmpl $0x0, -0x10(%rbp)
movb %al, -0x18(%rbp)
jne 0xa166
movslq -0xc(%rbp), %rcx
leaq 0x5115(%rip), %rax      # 0xf270
cmpq $0x0, (%rax,%rcx,8)
setne %al
movb %al, -0x18(%rbp)
movb -0x18(%rbp), %al
testb $0x1, %al
jne 0xa16f
jmp 0xa1b0
movq -0x8(%rbp), %rdi
movslq -0xc(%rbp), %rcx
leaq 0x50f2(%rip), %rax      # 0xf270
movq (%rax,%rcx,8), %rsi
callq 0x2150
cmpl $0x0, %eax
jne 0xa1a3
movl -0xc(%rbp), %esi
addl $0x4, %esi
movl $0x5, %edi
callq 0x9650
movl $0x1, -0x10(%rbp)
jmp 0xa1a5
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0xa145
jmp 0xa1b2
cmpl $0x0, -0x10(%rbp)
jne 0xa1ed
movq -0x8(%rbp), %rdi
callq 0x4000
movswl %ax, %edi
callq 0xa290
movl %eax, %esi
movl $0x4, %edi
callq 0x9650
leaq 0x2049(%rip), %rdi      # 0xc225
callq 0x4000
xorl %esi, %esi
movl %esi, %edi
movswl %ax, %edx
callq 0x9c10
movl -0x14(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)