// File: /workspace/github_c_makefile_star2_O1/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 0x77dd
leaq 0x1417(%rip), %rcx      # 0x8a40
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 0x715c
testq %rax, %rax
je 0x7862
movq %rax, %r15
movq 0x18(%rbx), %rax
movq %rax, 0x8(%r15)
testb $0x10, 0x10(%rbx)
je 0x7671
movq 0x20(%rbx), %rax
movq %rax, 0x10(%r15,%r12,8)
movq %rbx, %rdi
callq 0x61df
cmpl $0x1c, 0x10(%rbx)
jne 0x771a
xorl %r14d, %r14d
testq %r12, %r12
je 0x76ba
movq %rbx, %rdi
callq 0x61df
movq %rbx, %rdi
callq 0x7051
movq %rax, 0x10(%r15,%r14,8)
testq %rax, %rax
je 0x776e
cmpl $0x1b, 0x10(%rbx)
jne 0x76ba
incq %r14
cmpq %r14, %r12
jne 0x768b
movl %r12d, %r14d
cmpl $0x1d, 0x10(%rbx)
jne 0x771a
decl %r12d
cmpl %r12d, %r14d
jne 0x771a
movq %rbx, %rdi
callq 0x61df
jmp 0x7721
xorl %r14d, %r14d
xorl %esi, %esi
callq 0x715c
testq %rax, %rax
je 0x7862
movq %rax, %r15
movq 0x18(%rbx), %rax
movq %rax, 0x8(%r15)
testb $0x10, 0x10(%rbx)
je 0x76fe
movq 0x20(%rbx), %rax
movq %rax, 0x10(%r15)
movq %rbx, %rdi
callq 0x61df
cmpl $0x1c, 0x10(%rbx)
jne 0x7721
movq %rbx, %rdi
callq 0x61df
cmpl $0x1d, 0x10(%rbx)
je 0x76c8
movl $0x19, 0x10(%rbx)
movq %r15, %r14
jmp 0x7862
xorl %r14d, %r14d
xorl %esi, %esi
callq 0x715c
testq %rax, %rax
je 0x7862
movq %rax, %r15
movq 0x18(%rbx), %rax
movq %rax, 0x8(%r15)
testb $0x10, 0x10(%rbx)
je 0x7755
movq 0x20(%rbx), %rax
movq %rax, 0x18(%r15)
movq %rbx, %rdi
callq 0x61df
movq %rbx, %rdi
callq 0x752e
movq %rax, 0x10(%r15)
testq %rax, %rax
jne 0x7721
movq %r15, %rdi
callq 0x60d8
movq %r15, %rdi
callq 0x3030
jmp 0x785f
movl $0x10, %edi
callq 0x3120
testq %rax, %rax
je 0x7811
movq %rax, %r14
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movl $0x1, (%rax)
movq $0x0, 0x8(%rax)
jmp 0x7814
movq %rbx, %rdi
callq 0x61df
movq %rbx, %rdi
callq 0x6b7f
testq %rax, %rax
je 0x785f
movq %rax, %r14
cmpl $0x1d, 0x10(%rbx)
je 0x7855
movl $0x19, 0x10(%rbx)
jmp 0x7862
movl $0x10, %edi
callq 0x3120
testq %rax, %rax
je 0x7826
movq %rax, %r14
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
jmp 0x7829
movl $0x10, %edi
callq 0x3120
testq %rax, %rax
je 0x7845
movq %rax, %r14
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
jmp 0x7848
xorl %r14d, %r14d
testq %r14, %r14
je 0x785f
movsd 0x18(%rbx), %xmm0
movsd %xmm0, 0x8(%r14)
jmp 0x7855
xorl %r14d, %r14d
testq %r14, %r14
je 0x785f
movl $0x19, 0x10(%rbx)
movabsq $0x7ff8000000000000, %rax # imm = 0x7FF8000000000000
movq %rax, 0x8(%r14)
jmp 0x7862
xorl %r14d, %r14d
testq %r14, %r14
je 0x785f
movq 0x18(%rbx), %rax
movq %rax, 0x8(%r14)
movq %rbx, %rdi
callq 0x61df
jmp 0x7862
xorl %r14d, %r14d
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq