// File: /workspace/github_c_makefile_star2_O3/naleksiev[P]fin/src/fin_ast.c
// Function: fin_ast_parse_unary_expr
static fin_ast_expr_t* fin_ast_parse_unary_expr(fin_ctx_t* ctx, fin_lex_t* lex) {
    fin_ast_unary_type_t op;
    if (fin_lex_match(lex, fin_lex_type_plus))
        op = fin_ast_unary_type_pos;
    else if (fin_lex_match(lex, fin_lex_type_minus))
        op = fin_ast_unary_type_neg;
    else if (fin_lex_match(lex, fin_lex_type_bang))
        op = fin_ast_unary_type_not;
    else if (fin_lex_match(lex, fin_lex_type_tilde))
        op = fin_ast_unary_type_bnot;
    else if (fin_lex_match(lex, fin_lex_type_plus_plus))
        op = fin_ast_unary_type_inc;
    else if (fin_lex_match(lex, fin_lex_type_minus_minus))
        op = fin_ast_unary_type_dec;
    else if (fin_lex_get_type(lex) == fin_lex_type_l_paren)
        return fin_ast_parse_const_expr(ctx, lex);
    else if (fin_lex_get_type(lex) == fin_lex_type_int)
        return fin_ast_parse_const_expr(ctx, lex);
    else if (fin_lex_get_type(lex) == fin_lex_type_float)
        return fin_ast_parse_const_expr(ctx, lex);
    else if (fin_lex_get_type(lex) == fin_lex_type_bool)
        return fin_ast_parse_const_expr(ctx, lex);
    else if (fin_lex_get_type(lex) == fin_lex_type_string)
        return fin_ast_parse_const_expr(ctx, lex);
    else if (fin_lex_get_type(lex) == fin_lex_type_quot)
        return fin_ast_parse_str_interp_expr(ctx, lex);
    else {
        fin_ast_expr_t* tmp_expr = fin_ast_parse_assign_expr(ctx, lex, NULL);
        if (tmp_expr->type == fin_ast_expr_type_id)
            return fin_lex_get_type(lex) == fin_lex_type_l_paren ? fin_ast_parse_invoke_expr(ctx, lex, tmp_expr) : tmp_expr;
        return tmp_expr;
    }

    fin_ast_expr_t* expr = fin_ast_parse_unary_expr(ctx, lex);
    fin_ast_unary_expr_t* un_expr = (fin_ast_unary_expr_t*)ctx->alloc(NULL, sizeof(fin_ast_unary_expr_t));
    un_expr->base.type = fin_ast_expr_type_unary;
    un_expr->op = op;
    un_expr->expr = expr;
    return &un_expr->base;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
movl $0x12, %esi
callq 0x57da
xorl %r12d, %r12d
testb %al, %al
jne 0x43ea
movq %r14, %rdi
movl $0x13, %esi
callq 0x57da
movl $0x1, %r12d
testb %al, %al
jne 0x43ea
movq %r14, %rdi
movl $0x11, %esi
callq 0x57da
movl $0x2, %r12d
testb %al, %al
jne 0x43ea
movq %r14, %rdi
movl $0xe, %esi
callq 0x57da
movl $0x3, %r12d
testb %al, %al
jne 0x43ea
movq %r14, %rdi
movl $0x18, %esi
callq 0x57da
movl $0x4, %r12d
testb %al, %al
jne 0x43ea
movq %r14, %rdi
movl $0x19, %esi
callq 0x57da
movl $0x5, %r12d
testb %al, %al
je 0x441e
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4352
movq %rax, %r14
xorl %edi, %edi
movl $0x10, %esi
callq *(%rbx)
movq %rax, %r15
movl $0x6, (%rax)
movl %r12d, 0x4(%rax)
movq %r14, 0x8(%rax)
movq %r15, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
callq 0x57fc
cmpl $0x2e, %eax
je 0x445e
movq %r14, %rdi
callq 0x57fc
cmpl $0x1, %eax
je 0x445e
movq %r14, %rdi
callq 0x57fc
cmpl $0x2, %eax
je 0x445e
movq %r14, %rdi
callq 0x57fc
testl %eax, %eax
je 0x445e
movq %r14, %rdi
callq 0x57fc
cmpl $0x3, %eax
jne 0x446e
movq %rbx, %rdi
movq %r14, %rsi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x44ce
movq %r14, %rdi
callq 0x57fc
cmpl $0x5, %eax
jne 0x448e
movq %rbx, %rdi
movq %r14, %rsi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x45cc
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x3d6b
movq %rax, %r15
cmpl $0x0, (%rax)
jne 0x4412
movq %r14, %rdi
callq 0x57fc
cmpl $0x2e, %eax
jne 0x4412
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x3c9a