// File: /workspace/github_c_makefile_star2_O2/afi-lambda[P]a_little_smalltalk/src/lex.c
// Function: nextToken
tokentype nextToken()
{
    char *tp;
    boolean sign;

    /* skip over blanks and comments */
    while (nextChar() && (isspace(cc) || (cc == '"')))
        if (cc == '"')
        {
            /* read comment */
            while (nextChar() && (cc != '"'))
                ;
            if (!cc)
                break; /* break if we run into eof */
        }

    tp = tokenString;
    *tp++ = cc;

    if (!cc) /* end of input */
        token = inputend;

    else if (isalpha(cc))   /* identifier */
    {
        while (nextChar() && isalnum(cc))
            *tp++ = cc;
        if (cc == ':')
        {
            *tp++ = cc;
            token = namecolon;
        }
        else
        {
            pushBack(cc);
            token = nameconst;
        }
    }

    else if (isdigit(cc))   /* number */
    {
        longresult = cc - '0';
        while (nextChar() && isdigit(cc))
        {
            *tp++ = cc;
            longresult = (longresult * 10) + (cc - '0');
        }
        if (longCanBeInt(longresult))
        {
            tokenInteger = longresult;
            token = intconst;
        }
        else
        {
            token = floatconst;
            tokenFloat = (double) longresult;
        }
        if (cc == '.')   /* possible float */
        {
            if (nextChar() && isdigit(cc))
            {
                *tp++ = '.';
                do
                    *tp++ = cc;
                while (nextChar() && isdigit(cc));
                if (cc)
                    pushBack(cc);
                token = floatconst;
                *tp = '\0';
                tokenFloat = atof(tokenString);
            }
            else
            {
                /* nope, just an ordinary period */
                if (cc)
                    pushBack(cc);
                pushBack('.');
            }
        }
        else
            pushBack(cc);

        if (nextChar() && cc == 'e')   /* possible float */
        {
            if (nextChar() && cc == '-')
            {
                sign = true;
                nextChar();
            }
            else
                sign = false;
            if (cc && isdigit(cc))   /* yep, its a float */
            {
                *tp++ = 'e';
                if (sign)
                    *tp++ = '-';
                while (cc && isdigit(cc))
                {
                    *tp++ = cc;
                    nextChar();
                }
                if (cc)
                    pushBack(cc);
                *tp = '\0';
                token = floatconst;
                tokenFloat = atof(tokenString);
            }
            else     /* nope, wrong again */
            {
                if (cc)
                    pushBack(cc);
                if (sign)
                    pushBack('-');
                pushBack('e');
            }
        }
        else if (cc)
            pushBack(cc);
    }

    else if (cc == '$')   /* character constant */
    {
        tokenInteger = (int) nextChar();
        token = charconst;
    }

    else if (cc == '#')   /* symbol */
    {
        tp--; /* erase pound sign */
        if (nextChar() == '(')
            token = arraybegin;
        else
        {
            pushBack(cc);
            while (nextChar() && isSymbolChar(cc))
                *tp++ = cc;
            pushBack(cc);
            token = symconst;
        }
    }

    else if (cc == '\'')   /* string constant */
    {
        tp--; /* erase pound sign */
strloop:
        while (nextChar() && (cc != '\''))
            *tp++ = cc;
        /* check for nested quote marks */
        if (cc && nextChar() && (cc == '\''))
        {
            *tp++ = cc;
            goto strloop;
        }
        pushBack(cc);
        token = strconst;
    }

    else if (isClosing(cc)) /* closing expressions */
        token = closing;

    else if (singleBinary(cc))   /* single binary expressions */
    {
        token = binary;
    }

    else   /* anything else is binary */
    {
        if (nextChar() && binarySecond(cc))
            *tp++ = cc;
        else
            pushBack(cc);
        token = binary;
    }

    *tp = '\0';
    return (token);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
callq 0x6392
movb 0x22709(%rip), %bpl     # 0x284b0
movsbq %bpl, %r15
testb %al, %al
je 0x5df0
callq 0x2220
cmpb $0x22, %bpl
je 0x5dc9
movq (%rax), %rax
movzwl (%rax,%r15,2), %eax
andl $0x2000, %eax           # imm = 0x2000
je 0x5df0
cmpb $0x22, %bpl
jne 0x5d9b
callq 0x6392
movb 0x226d6(%rip), %cl      # 0x284b0
testb %al, %al
je 0x5de3
cmpb $0x22, %cl
jne 0x5dcf
testb %cl, %cl
jne 0x5d9b
movb $0x0, 0x226d2(%rip)     # 0x284c0
jmp 0x5e5c
movb %bpl, 0x226c9(%rip)     # 0x284c0
testb %bpl, %bpl
je 0x5e5c
callq 0x2220
movq %rax, %rbx
movq (%rax), %rax
movzwl (%rax,%r15,2), %eax
btl $0xa, %eax
jb 0x5e80
btl $0xb, %eax
jb 0x5ec3
movzbl %bpl, %eax
leal -0x22(%rax), %ecx
cmpl $0xc, %ecx
ja 0x5fd7
leaq 0x3a39(%rip), %rax      # 0x986c
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
callq 0x6392
cmpb $0x28, %al
jne 0x62d6
movl $0x7, 0x226bd(%rip)     # 0x28510
leaq 0x22666(%rip), %r14     # 0x284c0
jmp 0x5e6d
movl $0xb, 0x226aa(%rip)     # 0x28510
leaq 0x22654(%rip), %r14     # 0x284c1
movb $0x0, (%r14)
movl 0x22699(%rip), %eax     # 0x28510
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2263a(%rip), %r14     # 0x284c1
callq 0x6392
movb 0x2261e(%rip), %cl      # 0x284b0
testb %al, %al
je 0x5eab
movsbq %cl, %rax
movq (%rbx), %rdx
testb $0x8, (%rdx,%rax,2)
je 0x5eab
movb %cl, (%r14)
incq %r14
jmp 0x5e87
cmpb $0x3a, %cl
jne 0x5eff
movb $0x3a, (%r14)
incq %r14
movl $0x2, 0x2264f(%rip)     # 0x28510
jmp 0x5e6d
addq $-0x30, %r15
leaq 0x225f3(%rip), %r14     # 0x284c1
callq 0x6392
testb %al, %al
je 0x5f28
movq (%rbx), %rcx
movb 0x225d0(%rip), %al      # 0x284b0
movsbq %al, %rax
testb $0x8, 0x1(%rcx,%rax,2)
je 0x5f28
movb %al, (%r14)
incq %r14
imulq $0xa, %r15, %rcx
leaq (%rcx,%rax), %r15
addq $-0x30, %r15
jmp 0x5ece
movslq 0x2259a(%rip), %rax     # 0x284a0
leal 0x1(%rax), %edx
movl %edx, 0x22591(%rip)     # 0x284a0
leaq 0x2260a(%rip), %rdx     # 0x28520
movb %cl, (%rax,%rdx)
movl $0x1, 0x225ed(%rip)     # 0x28510
jmp 0x5e6d
leaq 0x3fff(%r15), %rax
cmpq $0x7ffe, %rax           # imm = 0x7FFE
ja 0x5f42
movl %r15d, 0x225d6(%rip)    # 0x28514
pushq $0x3
jmp 0x5f51
cvtsi2sd %r15, %xmm0
movsd %xmm0, 0x225c9(%rip)    # 0x28518
pushq $0x4
popq %rax
movl %eax, 0x225b8(%rip)     # 0x28510
movb 0x22552(%rip), %al      # 0x284b0
cmpb $0x2e, %al
jne 0x5fb8
callq 0x6392
movb 0x22543(%rip), %cl      # 0x284b0
testb %al, %al
je 0x5f83
movsbq %cl, %rax
movq (%rbx), %rdx
testb $0x8, 0x1(%rdx,%rax,2)
jne 0x6008
movl 0x22517(%rip), %eax     # 0x284a0
testb %cl, %cl
je 0x5f9d
movslq %eax, %rdx
leal 0x1(%rdx), %eax
leaq 0x22586(%rip), %rsi     # 0x28520
movb %cl, (%rdx,%rsi)
leal 0x1(%rax), %ecx
movl %ecx, 0x224fa(%rip)     # 0x284a0
cltq
leaq 0x22571(%rip), %rcx     # 0x28520
movb $0x2e, (%rax,%rcx)
jmp 0x607a
movslq 0x224e1(%rip), %rcx     # 0x284a0
leal 0x1(%rcx), %edx
movl %edx, 0x224d8(%rip)     # 0x284a0
leaq 0x22551(%rip), %rdx     # 0x28520
movb %al, (%rcx,%rdx)
jmp 0x607a
cmpl $0x3b, %eax
je 0x5fea
cmpl $0x5b, %eax
je 0x5ff9
cmpl $0x5d, %eax
jne 0x6157
movl $0xa, 0x2251c(%rip)     # 0x28510
jmp 0x5e66
movl $0x9, 0x2250d(%rip)     # 0x28510
jmp 0x5e66
movb $0x2e, (%r14)
addq $0x2, %r14
movq %r14, %rax
movq %rax, %r14
movb %cl, -0x1(%rax)
callq 0x6392
movb 0x2248c(%rip), %cl      # 0x284b0
testb %al, %al
je 0x603a
movsbq %cl, %rdx
movq (%rbx), %rsi
leaq 0x1(%r14), %rax
testb $0x8, 0x1(%rsi,%rdx,2)
jne 0x6013
testb %cl, %cl
je 0x6058
movslq 0x2245b(%rip), %rax     # 0x284a0
leal 0x1(%rax), %edx
movl %edx, 0x22452(%rip)     # 0x284a0
leaq 0x224cb(%rip), %rdx     # 0x28520
movb %cl, (%rax,%rdx)
movl $0x4, 0x224ae(%rip)     # 0x28510
movb $0x0, (%r14)
leaq 0x22453(%rip), %rdi     # 0x284c0
callq 0x2080
movsd %xmm0, 0x2249e(%rip)    # 0x28518
callq 0x6392
testb %al, %al
setne %cl
movb 0x22426(%rip), %al      # 0x284b0
cmpb $0x65, %al
sete %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x60e4
callq 0x6392
testb %al, %al
sete %cl
movb 0x2240a(%rip), %al      # 0x284b0
cmpb $0x2d, %al
setne %bpl
orb %cl, %bpl
jne 0x60bc
callq 0x6392
movb 0x223f4(%rip), %al      # 0x284b0
testb %al, %al
je 0x610b
movq (%rbx), %rcx
movsbq %al, %rdx
testb $0x8, 0x1(%rcx,%rdx,2)
jne 0x6142
movslq 0x223cb(%rip), %rdx     # 0x284a0
leal 0x1(%rdx), %ecx
leaq 0x22441(%rip), %rsi     # 0x28520
movb %al, (%rdx,%rsi)
jmp 0x6111
testb %al, %al
je 0x5e6d
movslq 0x223ad(%rip), %rcx     # 0x284a0
leal 0x1(%rcx), %edx
movl %edx, 0x223a4(%rip)     # 0x284a0
leaq 0x2241d(%rip), %rdx     # 0x28520
movb %al, (%rcx,%rdx)
jmp 0x5e6d
movl 0x2238f(%rip), %ecx     # 0x284a0
testb %bpl, %bpl
jne 0x6126
movslq %ecx, %rax
incl %ecx
leaq 0x223fe(%rip), %rdx     # 0x28520
movb $0x2d, (%rax,%rdx)
leal 0x1(%rcx), %eax
movl %eax, 0x22371(%rip)     # 0x284a0
movslq %ecx, %rax
leaq 0x223e7(%rip), %rcx     # 0x28520
movb $0x65, (%rax,%rcx)
jmp 0x5e6d
movb $0x65, (%r14)
testb %bpl, %bpl
je 0x623a
incq %r14
jmp 0x6264
callq 0x6392
movb 0x2234e(%rip), %cl      # 0x284b0
testb %al, %al
je 0x619d
movsbq %cl, %rax
movq (%rbx), %rdx
testb $0x2c, 0x1(%rdx,%rax,2)
jne 0x619d
movzbl %cl, %edx
leaq 0x22344(%rip), %r14     # 0x284c2
leaq 0x2233c(%rip), %rax     # 0x284c1
addl $-0x22, %edx
cmpl $0x3b, %edx
ja 0x61be
movabsq $0xa000000020010e1, %rsi # imm = 0xA000000020010E1
btq %rdx, %rsi
jae 0x61be
movslq 0x222fc(%rip), %rdx     # 0x284a0
leal 0x1(%rdx), %eax
movl %eax, 0x222f3(%rip)     # 0x284a0
leaq 0x2236c(%rip), %rax     # 0x28520
addq %rdx, %rax
leaq 0x22303(%rip), %r14     # 0x284c1
movb %cl, (%rax)
movl $0x9, 0x22346(%rip)     # 0x28510
jmp 0x5e6d
leaq 0x222ea(%rip), %r14     # 0x284c0
callq 0x6392
testb %al, %al
setne %cl
movb 0x222ca(%rip), %al      # 0x284b0
cmpb $0x27, %al
setne %dl
testb %dl, %cl
jne 0x6215
testb %al, %al
je 0x62ab
callq 0x6392
movb 0x222ae(%rip), %cl      # 0x284b0
testb %al, %al
je 0x62ad
movb $0x27, %al
cmpb $0x27, %cl
jne 0x62ad
movb %al, (%r14)
incq %r14
jmp 0x61d6
callq 0x6392
movsbl %al, %eax
movl %eax, 0x222e9(%rip)     # 0x28514
movl $0x5, 0x222db(%rip)     # 0x28510
jmp 0x5e66
movb $0x2d, 0x1(%r14)
addq $0x2, %r14
jmp 0x6264
movq (%rbx), %rcx
movsbq %al, %rdx
testb $0x8, 0x1(%rcx,%rdx,2)
je 0x626a
movb %al, (%r14)
incq %r14
callq 0x6392
movb 0x2224c(%rip), %al      # 0x284b0
testb %al, %al
jne 0x6245
jmp 0x6284
movslq 0x2222f(%rip), %rcx     # 0x284a0
leal 0x1(%rcx), %edx
movl %edx, 0x22226(%rip)     # 0x284a0
leaq 0x2229f(%rip), %rdx     # 0x28520
movb %al, (%rcx,%rdx)
movb $0x0, (%r14)
movl $0x4, 0x2227e(%rip)     # 0x28510
leaq 0x22227(%rip), %rdi     # 0x284c0
callq 0x2080
movsd %xmm0, 0x22272(%rip)    # 0x28518
jmp 0x5e6d
xorl %ecx, %ecx
movslq 0x221ec(%rip), %rax     # 0x284a0
leal 0x1(%rax), %edx
movl %edx, 0x221e3(%rip)     # 0x284a0
leaq 0x2225c(%rip), %rdx     # 0x28520
movb %cl, (%rax,%rdx)
movl $0x8, 0x2223f(%rip)     # 0x28510
jmp 0x5e6d
movb 0x221d4(%rip), %al      # 0x284b0
movslq 0x221bd(%rip), %rcx     # 0x284a0
leal 0x1(%rcx), %edx
movl %edx, 0x221b4(%rip)     # 0x284a0
leaq 0x2222d(%rip), %r15     # 0x28520
movb %al, (%rcx,%r15)
leaq 0x221c2(%rip), %r14     # 0x284c0
movabsq $0x8000000020010a1, %r12 # imm = 0x8000000020010A1
callq 0x6392
movb 0x2219d(%rip), %cl      # 0x284b0
testb %al, %al
je 0x6347
movsbq %cl, %rax
movq (%rbx), %rdx
movzwl (%rdx,%rax,2), %eax
testw $0xc00, %ax             # imm = 0xC00
je 0x6330
movb %cl, (%r14)
incq %r14
jmp 0x6308
btl $0xd, %eax
jb 0x6347
movzbl %cl, %eax
addl $-0x22, %eax
cmpl $0x3b, %eax
ja 0x6328
btq %rax, %r12
jae 0x6328
movslq 0x22152(%rip), %rax     # 0x284a0
leal 0x1(%rax), %edx
movl %edx, 0x22149(%rip)     # 0x284a0
movb %cl, (%rax,%r15)
movl $0x6, 0x221ab(%rip)     # 0x28510
jmp 0x5e6d