// File: /workspace/github_c_makefile_star2_O2/codeplea[P]tinyexpr/tinyexpr.c
// Function: base
static te_expr *base(state *s) {
    /* <base>      =    <constant> | <variable> | <function-0> {"(" ")"} | <function-1> <power> | <function-X> "(" <expr> {"," <expr>} ")" | "(" <list> ")" */
    te_expr *ret;
    int arity;

    switch (TYPE_MASK(s->type)) {
        case TOK_NUMBER:
            ret = new_expr(TE_CONSTANT, 0);
            CHECK_NULL(ret);

            ret->value = s->value;
            next_token(s);
            break;

        case TOK_VARIABLE:
            ret = new_expr(TE_VARIABLE, 0);
            CHECK_NULL(ret);

            ret->bound = s->bound;
            next_token(s);
            break;

        case TE_FUNCTION0:
        case TE_CLOSURE0:
            ret = new_expr(s->type, 0);
            CHECK_NULL(ret);

            ret->function = s->function;
            if (IS_CLOSURE(s->type)) ret->parameters[0] = s->context;
            next_token(s);
            if (s->type == TOK_OPEN) {
                next_token(s);
                if (s->type != TOK_CLOSE) {
                    s->type = TOK_ERROR;
                } else {
                    next_token(s);
                }
            }
            break;

        case TE_FUNCTION1:
        case TE_CLOSURE1:
            ret = new_expr(s->type, 0);
            CHECK_NULL(ret);

            ret->function = s->function;
            if (IS_CLOSURE(s->type)) ret->parameters[1] = s->context;
            next_token(s);
            ret->parameters[0] = power(s);
            CHECK_NULL(ret->parameters[0], te_free(ret));
            break;

        case TE_FUNCTION2: case TE_FUNCTION3: case TE_FUNCTION4:
        case TE_FUNCTION5: case TE_FUNCTION6: case TE_FUNCTION7:
        case TE_CLOSURE2: case TE_CLOSURE3: case TE_CLOSURE4:
        case TE_CLOSURE5: case TE_CLOSURE6: case TE_CLOSURE7:
            arity = ARITY(s->type);

            ret = new_expr(s->type, 0);
            CHECK_NULL(ret);

            ret->function = s->function;
            if (IS_CLOSURE(s->type)) ret->parameters[arity] = s->context;
            next_token(s);

            if (s->type != TOK_OPEN) {
                s->type = TOK_ERROR;
            } else {
                int i;
                for(i = 0; i < arity; i++) {
                    next_token(s);
                    ret->parameters[i] = expr(s);
                    CHECK_NULL(ret->parameters[i], te_free(ret));

                    if(s->type != TOK_SEP) {
                        break;
                    }
                }
                if(s->type != TOK_CLOSE || i != arity - 1) {
                    s->type = TOK_ERROR;
                } else {
                    next_token(s);
                }
            }

            break;

        case TOK_OPEN:
            next_token(s);
            ret = list(s);
            CHECK_NULL(ret);

            if (s->type != TOK_CLOSE) {
                s->type = TOK_ERROR;
            } else {
                next_token(s);
            }
            break;

        default:
            ret = new_expr(0, 0);
            CHECK_NULL(ret);

            s->type = TOK_ERROR;
            ret->value = NAN;
            break;
    }

    return ret;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x10(%rdi), %edi
movl %edi, %eax
andl $0x1f, %eax
addl $-0x8, %eax
cmpl $0x17, %eax
ja 0x74f6
leaq 0x1707(%rip), %rcx      # 0x8a48
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl %edi, %eax
andl $0x18, %eax
movl %edi, %r12d
andl $0x7, %r12d
testl %eax, %eax
cmovel %eax, %r12d
xorl %r14d, %r14d
xorl %esi, %esi
callq 0x7001
testq %rax, %rax
je 0x7548
movq %rax, %r15
movq 0x18(%rbx), %rax
movq %rax, 0x8(%r15)
testb $0x10, 0x10(%rbx)
je 0x7389
movq 0x20(%rbx), %rax
movq %rax, 0x10(%r15,%r12,8)
movq %rbx, %rdi
callq 0x623c
cmpl $0x1c, 0x10(%rbx)
jne 0x749d
xorl %r14d, %r14d
cmpq %r14, %r12
je 0x7480
movq %rbx, %rdi
callq 0x623c
movq %rbx, %rdi
callq 0x6f59
movq %rax, 0x10(%r15,%r14,8)
testq %rax, %rax
je 0x7470
movl 0x10(%rbx), %eax
cmpl $0x1b, %eax
jne 0x7487
incq %r14
jmp 0x739e
xorl %r14d, %r14d
xorl %esi, %esi
callq 0x7001
testq %rax, %rax
je 0x7548
movq %rax, %r15
movq 0x18(%rbx), %rax
movq %rax, 0x8(%r15)
testb $0x10, 0x10(%rbx)
je 0x7402
movq 0x20(%rbx), %rax
movq %rax, 0x10(%r15)
movq %rbx, %rdi
callq 0x623c
cmpl $0x1c, 0x10(%rbx)
jne 0x7545
movq %rbx, %rdi
callq 0x623c
cmpl $0x1d, 0x10(%rbx)
jne 0x749d
jmp 0x753d
xorl %r14d, %r14d
xorl %esi, %esi
callq 0x7001
testq %rax, %rax
je 0x7548
movq %rax, %r15
movq 0x18(%rbx), %rax
movq %rax, 0x8(%r15)
testb $0x10, 0x10(%rbx)
je 0x7453
movq 0x20(%rbx), %rax
movq %rax, 0x18(%r15)
movq %rbx, %rdi
callq 0x623c
movq %rbx, %rdi
callq 0x727a
movq %rax, 0x10(%r15)
testq %rax, %rax
jne 0x7545
movq %r15, %rdi
callq 0x6224
xorl %r14d, %r14d
jmp 0x7548
xorl %eax, %eax
movl %r12d, %r14d
jmp 0x748d
cmpl $0x1d, %eax
sete %al
testb %al, %al
je 0x749d
decl %r12d
cmpl %r12d, %r14d
je 0x753d
movl $0x19, 0x10(%rbx)
jmp 0x7545
xorl %r14d, %r14d
pushq $0x1
popq %rdi
xorl %esi, %esi
callq 0x7001
testq %rax, %rax
je 0x7548
movq %rax, %r15
movsd 0x18(%rbx), %xmm0
movsd %xmm0, 0x8(%rax)
jmp 0x753d
movq %rbx, %rdi
callq 0x623c
movq %rbx, %rdi
callq 0x6bae
testq %rax, %rax
je 0x7478
movq %rax, %r14
cmpl $0x1d, 0x10(%rbx)
jne 0x7557
movq %rbx, %rdi
callq 0x623c
jmp 0x7548
xorl %r14d, %r14d
xorl %edi, %edi
xorl %esi, %esi
callq 0x7001
testq %rax, %rax
je 0x7548
movl $0x19, 0x10(%rbx)
movabsq $0x7ff8000000000000, %rcx # imm = 0x7FF8000000000000
movq %rcx, 0x8(%rax)
movq %rax, %r14
jmp 0x7548
xorl %r14d, %r14d
xorl %edi, %edi
xorl %esi, %esi
callq 0x7001
testq %rax, %rax
je 0x7548
movq %rax, %r15
movq 0x18(%rbx), %rax
movq %rax, 0x8(%r15)
movq %rbx, %rdi
callq 0x623c
movq %r15, %r14
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movl $0x19, 0x10(%rbx)
jmp 0x7548