// File: /workspace/github_c_makefile_star2_O1/afi-lambda[P]a_little_smalltalk/src/parser.c
// Function: parseArray
static int parseArray()
{
    int i, size, base;
    object newLit, obj;

    base = literalTop;
    nextToken();
    while (parseok && (token != closing))
    {
        switch (token)
        {
        case arraybegin:
            parseArray();
            break;

        case intconst:
            genLiteral(newInteger(tokenInteger));
            nextToken();
            break;

        case floatconst:
            genLiteral(newFloat(tokenFloat));
            nextToken();
            break;

        case nameconst:
        case namecolon:
        case symconst:
            genLiteral(newSymbol(tokenString));
            nextToken();
            break;

        case binary:
            if (streq(tokenString, "("))
            {
                parseArray();
                break;
            }
            if (streq(tokenString, "-") && isdigit(peek()))
            {
                nextToken();
                if (token == intconst)
                    genLiteral(newInteger(- tokenInteger));
                else if (token == floatconst)
                {
                    genLiteral(newFloat(-tokenFloat));
                }
                else
                    compilError(selector, "negation not followed", "by number");
                nextToken();
                break;
            }
            genLiteral(newSymbol(tokenString));
            nextToken();
            break;

        case charconst:
            genLiteral(newChar(tokenInteger));
            nextToken();
            break;

        case strconst:
            genLiteral(newStString(tokenString));
            nextToken();
            break;

        default:
            compilError(selector, "illegal text in literal array", tokenString);
            nextToken();
            break;
        }
    }

    if (parseok)
    {
        if (!streq(tokenString, ")"))
            compilError(selector, "array not terminated by right parenthesis",
                             tokenString);
        else
            nextToken();
    }
    size = literalTop - base;
    newLit = newArray(size);
    for (i = size; i >= 1; i--)
    {
        obj = literalArray[literalTop];
        basicAtPut(newLit, i, obj);
        decr(obj);
        literalArray[literalTop] = nilobj;
        literalTop = literalTop - 1;
    }
    return (genLiteral(newLit));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl 0x2094c(%rip), %ebp     # 0x28d64
callq 0x6172
cmpl $0x0, 0x2092c(%rip)     # 0x28d50
setne %cl
leaq 0x200f2(%rip), %r13     # 0x28520
movl (%r13), %eax
cmpl $0xa, %eax
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x85a2
leaq 0x20a26(%rip), %rbx     # 0x28e70
leaq 0x16fa(%rip), %r12      # 0x9b4b
leaq 0x20078(%rip), %r15     # 0x284d0
leaq 0x1489(%rip), %r14      # 0x98e8
decl %eax
cmpl $0x8, %eax
ja 0x856b
movslq (%r14,%rax,4), %rax
addq %r14, %rax
jmpq *%rax
movq %r15, %rdi
callq 0x37bd
jmp 0x8543
movq %r15, %rdi
callq 0x3b88
jmp 0x8543
leaq 0x20090(%rip), %rax     # 0x28524
movl (%rax), %edi
callq 0x36ba
jmp 0x8543
movq %r15, %rdi
leaq 0x166a(%rip), %rsi      # 0x9b14
callq 0x2160
testl %eax, %eax
je 0x851c
movq %r15, %rdi
leaq 0x1557(%rip), %rsi      # 0x9a14
callq 0x2160
testl %eax, %eax
jne 0x8473
callq 0x2240
movl %ebp, 0x4(%rsp)
movq %r12, %rbp
movq %rbx, %r12
movq (%rax), %rbx
xorl %eax, %eax
callq 0x6a06
movsbq %al, %rax
testb $0x8, 0x1(%rbx,%rax,2)
movq %r12, %rbx
movq %rbp, %r12
movl 0x4(%rsp), %ebp
je 0x8473
callq 0x6172
movl (%r13), %eax
cmpl $0x4, %eax
je 0x857b
cmpl $0x3, %eax
jne 0x858f
xorl %edi, %edi
leaq 0x2000c(%rip), %rax     # 0x28524
subl (%rax), %edi
jmp 0x853e
callq 0x8407
jmp 0x8550
leaq 0x1fffe(%rip), %rax     # 0x28528
movsd (%rax), %xmm0
callq 0x3a12
jmp 0x8543
leaq 0x1ffe8(%rip), %rax     # 0x28524
movl (%rax), %edi
callq 0x314c
movswl %ax, %edi
callq 0x7a4b
callq 0x6172
cmpl $0x0, 0x207f9(%rip)     # 0x28d50
setne %cl
je 0x85a2
movl (%r13), %eax
cmpl $0xa, %eax
jne 0x845f
jmp 0x85a2
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x26d7
jmp 0x854b
leaq 0x1ffa6(%rip), %rax     # 0x28528
movsd (%rax), %xmm0
xorps 0x1313(%rip), %xmm0     # 0x98a0
jmp 0x852e
movq %rbx, %rdi
leaq 0x155b(%rip), %rsi      # 0x9af4
leaq 0x156a(%rip), %rdx      # 0x9b0a
jmp 0x8574
testb %cl, %cl
je 0x85de
leaq 0x1ff23(%rip), %rdi     # 0x284d0
leaq 0x1562(%rip), %rsi      # 0x9b16
callq 0x2160
testl %eax, %eax
je 0x85d9
leaq 0x208ac(%rip), %rdi     # 0x28e70
leaq 0x159e(%rip), %rsi      # 0x9b69
leaq 0x1fefe(%rip), %rdx     # 0x284d0
callq 0x26d7
jmp 0x85de
callq 0x6172
movl 0x2077f(%rip), %r14d    # 0x28d64
movl %r14d, %edi
subl %ebp, %edi
callq 0x35da
movswl %ax, %ebx
subl %ebp, %r14d
jle 0x8668
movl %ebx, %eax
shrl %eax
movswq %ax, %rax
shlq $0x4, %rax
leaq 0x5c36(%rip), %rcx      # 0xe240
leaq (%rcx,%rax), %r15
addq $0x8, %r15
movl %r14d, %r12d
incl %r14d
decq %r12
leaq 0x2089e(%rip), %r13     # 0x28ec0
movslq 0x2073b(%rip), %rax     # 0x28d64
movswl (%r13,%rax,2), %ebp
movq (%r15), %rax
movw %bp, (%rax,%r12,2)
movl %ebp, %edi
callq 0x2f20
movl %ebp, %edi
callq 0x2f46
movslq 0x20718(%rip), %rax     # 0x28d64
movw $0x0, (%r13,%rax,2)
decl %eax
movl %eax, 0x20708(%rip)     # 0x28d64
decl %r14d
decq %r12
cmpl $0x1, %r14d
jg 0x8622
movl %ebx, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x7a4b