// File: /workspace/github_c_makefile_star2_O0/codeplea[P]tinyexpr/tinyexpr.c
// Function: factor
static te_expr *factor(state *s) {
    /* <factor>    =    <power> {"^" <power>} */
    te_expr *ret = power(s);
    CHECK_NULL(ret);

    int neg = 0;

    if (ret->type == (TE_FUNCTION1 | TE_FLAG_PURE) && ret->function == negate) {
        te_expr *se = ret->parameters[0];
        free(ret);
        ret = se;
        neg = 1;
    }

    te_expr *insertion = 0;

    while (s->type == TOK_INFIX && (s->function == pow)) {
        te_fun2 t = s->function;
        next_token(s);

        if (insertion) {
            /* Make exponentiation go right-to-left. */
            te_expr *p = power(s);
            CHECK_NULL(p, te_free(ret));

            te_expr *insert = NEW_EXPR(TE_FUNCTION2 | TE_FLAG_PURE, insertion->parameters[1], p);
            CHECK_NULL(insert, te_free(p), te_free(ret));

            insert->function = t;
            insertion->parameters[1] = insert;
            insertion = insert;
        } else {
            te_expr *p = power(s);
            CHECK_NULL(p, te_free(ret));

            te_expr *prev = ret;
            ret = NEW_EXPR(TE_FUNCTION2 | TE_FLAG_PURE, ret, p);
            CHECK_NULL(ret, te_free(p), te_free(prev));

            ret->function = t;
            insertion = ret;
        }
    }

    if (neg) {
        te_expr *prev = ret;
        ret = NEW_EXPR(TE_FUNCTION1 | TE_FLAG_PURE, ret);
        CHECK_NULL(ret, te_free(prev));

        ret->function = negate;
    }

    return ret;
}

// Assembly:
subq $0x98, %rsp
movq %rdi, 0x88(%rsp)
movq 0x88(%rsp), %rdi
callq 0x9f00
movq %rax, 0x80(%rsp)
cmpq $0x0, 0x80(%rsp)
jne 0x9c20
movq $0x0, 0x90(%rsp)
jmp 0x9eee
movl $0x0, 0x7c(%rsp)
movq 0x80(%rsp), %rax
cmpl $0x29, (%rax)
jne 0x9c7d
movq 0x80(%rsp), %rax
leaq 0x3ec(%rip), %rcx       # 0xa030
cmpq %rcx, 0x8(%rax)
jne 0x9c7d
movq 0x80(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x70(%rsp)
movq 0x80(%rsp), %rdi
callq 0x3030
movq 0x70(%rsp), %rax
movq %rax, 0x80(%rsp)
movl $0x1, 0x7c(%rsp)
movq $0x0, 0x68(%rsp)
movq 0x88(%rsp), %rcx
xorl %eax, %eax
cmpl $0x20, 0x10(%rcx)
movb %al, 0xf(%rsp)
jne 0x9cb4
movq 0x88(%rsp), %rax
movq 0x532f(%rip), %rcx      # 0xefd8
cmpq %rcx, 0x18(%rax)
sete %al
movb %al, 0xf(%rsp)
movb 0xf(%rsp), %al
testb $0x1, %al
jne 0x9cc1
jmp 0x9e70
movq 0x88(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x60(%rsp)
movq 0x88(%rsp), %rdi
callq 0x7e70
cmpq $0x0, 0x68(%rsp)
je 0x9daa
movq 0x88(%rsp), %rdi
callq 0x9f00
movq %rax, 0x58(%rsp)
cmpq $0x0, 0x58(%rsp)
jne 0x9d23
movq 0x80(%rsp), %rdi
callq 0x7e40
movq $0x0, 0x90(%rsp)
jmp 0x9eee
movq 0x68(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x40(%rsp)
movq 0x58(%rsp), %rax
movq %rax, 0x48(%rsp)
leaq 0x40(%rsp), %rsi
movl $0x2a, %edi
callq 0x9960
movq %rax, 0x50(%rsp)
cmpq $0x0, 0x50(%rsp)
jne 0x9d7f
movq 0x58(%rsp), %rdi
callq 0x7e40
movq 0x80(%rsp), %rdi
callq 0x7e40
movq $0x0, 0x90(%rsp)
jmp 0x9eee
movq 0x60(%rsp), %rcx
movq 0x50(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x50(%rsp), %rcx
movq 0x68(%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0x50(%rsp), %rax
movq %rax, 0x68(%rsp)
jmp 0x9e6b
movq 0x88(%rsp), %rdi
callq 0x9f00
movq %rax, 0x38(%rsp)
cmpq $0x0, 0x38(%rsp)
jne 0x9de2
movq 0x80(%rsp), %rdi
callq 0x7e40
movq $0x0, 0x90(%rsp)
jmp 0x9eee
movq 0x80(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x80(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x28(%rsp)
leaq 0x20(%rsp), %rsi
movl $0x2a, %edi
callq 0x9960
movq %rax, 0x80(%rsp)
cmpq $0x0, 0x80(%rsp)
jne 0x9e4d
movq 0x38(%rsp), %rdi
callq 0x7e40
movq 0x30(%rsp), %rdi
callq 0x7e40
movq $0x0, 0x90(%rsp)
jmp 0x9eee
movq 0x60(%rsp), %rcx
movq 0x80(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x80(%rsp), %rax
movq %rax, 0x68(%rsp)
jmp 0x9c86
cmpl $0x0, 0x7c(%rsp)
je 0x9ede
movq 0x80(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x80(%rsp), %rax
movq %rax, 0x10(%rsp)
leaq 0x10(%rsp), %rsi
movl $0x29, %edi
callq 0x9960
movq %rax, 0x80(%rsp)
cmpq $0x0, 0x80(%rsp)
jne 0x9ecb
movq 0x18(%rsp), %rdi
callq 0x7e40
movq $0x0, 0x90(%rsp)
jmp 0x9eee
movq 0x80(%rsp), %rax
leaq 0x156(%rip), %rcx       # 0xa030
movq %rcx, 0x8(%rax)
movq 0x80(%rsp), %rax
movq %rax, 0x90(%rsp)
movq 0x90(%rsp), %rax
addq $0x98, %rsp
retq
nop