// File: /workspace/github_c_makefile_star2_O2/codeplea[P]tinyexpr/tinyexpr.c
// Function: next_token
void next_token(state *s) {
    s->type = TOK_NULL;

    do {

        if (!*s->next){
            s->type = TOK_END;
            return;
        }

        /* Try reading a number. */
        if ((s->next[0] >= '0' && s->next[0] <= '9') || s->next[0] == '.') {
            s->value = strtod(s->next, (char**)&s->next);
            s->type = TOK_NUMBER;
        } else {
            /* Look for a variable or builtin function call. */
            if (isalpha(s->next[0])) {
                const char *start;
                start = s->next;
                while (isalpha(s->next[0]) || isdigit(s->next[0]) || (s->next[0] == '_')) s->next++;
                
                const te_variable *var = find_lookup(s, start, s->next - start);
                if (!var) var = find_builtin(start, s->next - start);

                if (!var) {
                    s->type = TOK_ERROR;
                } else {
                    switch(TYPE_MASK(var->type))
                    {
                        case TE_VARIABLE:
                            s->type = TOK_VARIABLE;
                            s->bound = var->address;
                            break;

                        case TE_CLOSURE0: case TE_CLOSURE1: case TE_CLOSURE2: case TE_CLOSURE3:         /* Falls through. */
                        case TE_CLOSURE4: case TE_CLOSURE5: case TE_CLOSURE6: case TE_CLOSURE7:         /* Falls through. */
                            s->context = var->context;                                                  /* Falls through. */

                        case TE_FUNCTION0: case TE_FUNCTION1: case TE_FUNCTION2: case TE_FUNCTION3:     /* Falls through. */
                        case TE_FUNCTION4: case TE_FUNCTION5: case TE_FUNCTION6: case TE_FUNCTION7:     /* Falls through. */
                            s->type = var->type;
                            s->function = var->address;
                            break;
                    }
                }

            } else {
                /* Look for an operator or special character. */
                switch (s->next++[0]) {
                    case '+': s->type = TOK_INFIX; s->function = add; break;
                    case '-': s->type = TOK_INFIX; s->function = sub; break;
                    case '*': s->type = TOK_INFIX; s->function = mul; break;
                    case '/': s->type = TOK_INFIX; s->function = divide; break;
                    case '^': s->type = TOK_INFIX; s->function = pow; break;
                    case '%': s->type = TOK_INFIX; s->function = fmod; break;
                    case '(': s->type = TOK_OPEN; break;
                    case ')': s->type = TOK_CLOSE; break;
                    case ',': s->type = TOK_SEP; break;
                    case ' ': case '\t': case '\n': case '\r': break;
                    default: s->type = TOK_ERROR; break;
                }
            }
        }
    } while (s->type == TOK_NULL);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r15
movl $0x18, 0x10(%rdi)
leaq 0x8(%rdi), %rax
movq %rax, 0x20(%rsp)
movq 0x8(%rdi), %rsi
movq %rdi, 0x18(%rsp)
movq %rsi, 0x8(%rsp)
movsbq (%rsi), %rbx
testq %rbx, %rbx
je 0x6453
cmpb $0x2e, %bl
je 0x645d
leal -0x30(%rbx), %eax
cmpb $0x9, %al
jbe 0x645d
callq 0x31c0
movq (%rax), %rcx
movzwl (%rcx,%rbx,2), %ecx
btl $0xa, %ecx
movq 0x20(%rsp), %rdx
jb 0x62d6
movq 0x8(%rsp), %rax
leaq 0x1(%rax), %rsi
movq %rsi, (%rdx)
movzbl (%rax), %eax
leal -0x9(%rax), %ecx
cmpl $0x2, %ecx
jb 0x6266
leal -0x20(%rax), %ecx
cmpl $0xf, %ecx
ja 0x63bb
leaq 0x269b(%rip), %rdx      # 0x8968
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
movq 0x8(%rsp), %rsi
leaq 0x1(%rsi), %rdi
xorl %r12d, %r12d
movabsq $0x100000000, %rsi      # imm = 0x100000000
cmpb $0x5f, %bl
je 0x62f9
andl $0xc00, %ecx            # imm = 0xC00
je 0x630f
movq %rdi, (%rdx)
movq (%rax), %rcx
movsbq (%rdi), %rbx
movzwl (%rcx,%rbx,2), %ecx
incq %rdi
addq %rsi, %r12
jmp 0x62ec
movq %rdi, 0x10(%rsp)
movq 0x28(%r15), %r14
testq %r14, %r14
je 0x6353
movl 0x30(%r15), %ebx
sarq $0x20, %r12
subl $0x1, %ebx
jb 0x6357
movq (%r14), %r13
movq 0x8(%rsp), %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x3050
testl %eax, %eax
jne 0x634d
cmpb $0x0, (%r13,%r12)
je 0x63d8
addq $0x20, %r14
jmp 0x6325
sarq $0x20, %r12
xorl %ebx, %ebx
pushq $0x17
popq %r15
movl %r15d, %eax
subl %ebx, %eax
jl 0x6438
cltd
pushq $0x2
popq %rcx
idivl %ecx
movl %eax, %r13d
addl %ebx, %r13d
movslq %r13d, %r14
shlq $0x5, %r14
leaq 0x572e(%rip), %rax      # 0xbab0
movq (%r14,%rax), %rbp
movq 0x8(%rsp), %rdi
movq %rbp, %rsi
movq %r12, %rdx
callq 0x3050
testl %eax, %eax
jne 0x63a6
movsbl (%rbp,%r12), %eax
testl %eax, %eax
je 0x63c9
negl %eax
leal 0x1(%r13), %ecx
decl %r13d
testl %eax, %eax
cmovgl %ecx, %ebx
cmovgl %r15d, %r13d
movl %r13d, %r15d
jmp 0x635d
cmpl $0xd, %eax
je 0x6266
jmp 0x647c
leaq 0x56e0(%rip), %rax      # 0xbab0
addq %rax, %r14
movq 0x18(%rsp), %r15
decq 0x10(%rsp)
movl 0x10(%r14), %eax
movl %eax, %ecx
andl $0x1f, %ecx
leal -0x8(%rcx), %edx
cmpl $0x8, %edx
jb 0x63fe
leal -0x10(%rcx), %edx
cmpl $0x8, %edx
jae 0x641a
movq 0x18(%r14), %rcx
movq %rcx, 0x20(%r15)
movl %eax, 0x10(%r15)
movq 0x8(%r14), %rcx
movq %rcx, 0x18(%r15)
cmpl $0x18, %eax
movq 0x10(%rsp), %rsi
je 0x6266
jmp 0x6444
testl %ecx, %ecx
movq 0x10(%rsp), %rsi
jne 0x6266
movl $0x1f, 0x10(%r15)
movq 0x8(%r14), %rax
jmp 0x6503
movq 0x18(%rsp), %rax
movl $0x19, 0x10(%rax)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x1a, 0x10(%r15)
jmp 0x6444
movq 0x8(%rsp), %rdi
movq 0x20(%rsp), %rsi
callq 0x3060
movsd %xmm0, 0x18(%r15)
movl $0x1e, 0x10(%r15)
jmp 0x6444
cmpl $0x5e, %eax
jne 0x6492
movl $0x20, 0x10(%r15)
movq 0x5b48(%rip), %rax      # 0xbfd8
jmp 0x6503
movl $0x19, 0x10(%r15)
jmp 0x6444
movl $0x20, 0x10(%r15)
leaq 0x78(%rip), %rax        # 0x6523
jmp 0x6503
movl $0x1b, 0x10(%r15)
jmp 0x6444
movl $0x1c, 0x10(%r15)
jmp 0x6444
movl $0x20, 0x10(%r15)
leaq 0x58(%rip), %rax        # 0x6528
jmp 0x6503
movl $0x20, 0x10(%r15)
movq 0x5aff(%rip), %rax      # 0xbfe0
jmp 0x6503
movl $0x20, 0x10(%r15)
leaq 0x2c(%rip), %rax        # 0x651e
jmp 0x6503
movl $0x20, 0x10(%r15)
leaq 0x16(%rip), %rax        # 0x6519
movq %rax, 0x18(%r15)
jmp 0x6444
movl $0x1d, 0x10(%r15)
jmp 0x6444