// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movq 0x20(%rsp), %rax
movl $0x18, 0x10(%rax)
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rax
cmpb $0x0, (%rax)
jne 0x7ea4
movq 0x20(%rsp), %rax
movl $0x1a, 0x10(%rax)
jmp 0x8208
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rax
movsbl (%rax), %eax
cmpl $0x30, %eax
jl 0x7ec6
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rax
movsbl (%rax), %eax
cmpl $0x39, %eax
jle 0x7ed7
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rax
movsbl (%rax), %eax
cmpl $0x2e, %eax
jne 0x7f09
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rdi
movq 0x20(%rsp), %rsi
addq $0x8, %rsi
callq 0x3050
movq 0x20(%rsp), %rax
movsd %xmm0, 0x18(%rax)
movq 0x20(%rsp), %rax
movl $0x1e, 0x10(%rax)
jmp 0x81f7
callq 0x31c0
movq (%rax), %rax
movq 0x20(%rsp), %rcx
movq 0x8(%rcx), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x80c2
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x18(%rsp)
callq 0x31c0
movq (%rax), %rax
movq 0x20(%rsp), %rcx
movq 0x8(%rcx), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %ecx
andl $0x400, %ecx            # imm = 0x400
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, 0xf(%rsp)
jne 0x7fae
callq 0x31c0
movq (%rax), %rax
movq 0x20(%rsp), %rcx
movq 0x8(%rcx), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %ecx
andl $0x800, %ecx            # imm = 0x800
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, 0xf(%rsp)
jne 0x7fae
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rax
movsbl (%rax), %eax
cmpl $0x5f, %eax
sete %al
movb %al, 0xf(%rsp)
movb 0xf(%rsp), %al
testb $0x1, %al
jne 0x7fb8
jmp 0x7fce
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x8(%rax)
jmp 0x7f40
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x18(%rsp), %rcx
subq %rcx, %rax
movl %eax, %edx
callq 0x8210
movq %rax, 0x10(%rsp)
cmpq $0x0, 0x10(%rsp)
jne 0x801f
movq 0x18(%rsp), %rdi
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x18(%rsp), %rcx
subq %rcx, %rax
movl %eax, %esi
callq 0x82d0
movq %rax, 0x10(%rsp)
cmpq $0x0, 0x10(%rsp)
jne 0x8038
movq 0x20(%rsp), %rax
movl $0x19, 0x10(%rax)
jmp 0x80bd
movq 0x10(%rsp), %rax
movl 0x10(%rax), %eax
andl $0x1f, %eax
movl %eax, 0x8(%rsp)
je 0x8067
jmp 0x804b
movl 0x8(%rsp), %eax
addl $-0x8, %eax
subl $0x8, %eax
jb 0x8099
jmp 0x8059
movl 0x8(%rsp), %eax
addl $-0x10, %eax
subl $0x8, %eax
jb 0x8087
jmp 0x80bb
movq 0x20(%rsp), %rax
movl $0x1f, 0x10(%rax)
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rcx
movq 0x20(%rsp), %rax
movq %rcx, 0x18(%rax)
jmp 0x80bb
movq 0x10(%rsp), %rax
movq 0x18(%rax), %rcx
movq 0x20(%rsp), %rax
movq %rcx, 0x20(%rax)
movq 0x10(%rsp), %rax
movl 0x10(%rax), %ecx
movq 0x20(%rsp), %rax
movl %ecx, 0x10(%rax)
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rcx
movq 0x20(%rsp), %rax
movq %rcx, 0x18(%rax)
jmp 0x80bd
jmp 0x81f5
movq 0x20(%rsp), %rcx
movq 0x8(%rcx), %rax
movq %rax, %rdx
incq %rdx
movq %rdx, 0x8(%rcx)
movsbl (%rax), %eax
addl $-0x9, %eax
movl %eax, %ecx
movq %rcx, (%rsp)
subl $0x55, %eax
ja 0x81e7
movq (%rsp), %rax
leaq 0x386b(%rip), %rcx      # 0xb960
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x20(%rsp), %rax
movl $0x20, 0x10(%rax)
movq 0x20(%rsp), %rax
leaq 0x2ba(%rip), %rcx       # 0x83d0
movq %rcx, 0x18(%rax)
jmp 0x81f3
movq 0x20(%rsp), %rax
movl $0x20, 0x10(%rax)
movq 0x20(%rsp), %rax
leaq 0x2b9(%rip), %rcx       # 0x83f0
movq %rcx, 0x18(%rax)
jmp 0x81f3
movq 0x20(%rsp), %rax
movl $0x20, 0x10(%rax)
movq 0x20(%rsp), %rax
leaq 0x2b8(%rip), %rcx       # 0x8410
movq %rcx, 0x18(%rax)
jmp 0x81f3
movq 0x20(%rsp), %rax
movl $0x20, 0x10(%rax)
movq 0x20(%rsp), %rax
leaq 0x2b7(%rip), %rcx       # 0x8430
movq %rcx, 0x18(%rax)
jmp 0x81f3
movq 0x20(%rsp), %rax
movl $0x20, 0x10(%rax)
movq 0x20(%rsp), %rax
movq 0x6e41(%rip), %rcx      # 0xefd8
movq %rcx, 0x18(%rax)
jmp 0x81f3
movq 0x20(%rsp), %rax
movl $0x20, 0x10(%rax)
movq 0x20(%rsp), %rax
movq 0x6e2b(%rip), %rcx      # 0xefe0
movq %rcx, 0x18(%rax)
jmp 0x81f3
movq 0x20(%rsp), %rax
movl $0x1c, 0x10(%rax)
jmp 0x81f3
movq 0x20(%rsp), %rax
movl $0x1d, 0x10(%rax)
jmp 0x81f3
movq 0x20(%rsp), %rax
movl $0x1b, 0x10(%rax)
jmp 0x81f3
jmp 0x81f3
movq 0x20(%rsp), %rax
movl $0x19, 0x10(%rax)
jmp 0x81f5
jmp 0x81f7
jmp 0x81f9
movq 0x20(%rsp), %rax
cmpl $0x18, 0x10(%rax)
je 0x7e85
addq $0x28, %rsp
retq
nopl (%rax)