// File: /workspace/github_c_makefile_star2_O2/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 %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
pushq $0x12
popq %rsi
movq %r14, %rdi
callq 0x5537
xorl %r12d, %r12d
testb %al, %al
jne 0x4260
pushq $0x13
popq %rsi
movq %r14, %rdi
callq 0x5537
testb %al, %al
je 0x4214
pushq $0x1
jmp 0x425e
pushq $0x11
popq %rsi
movq %r14, %rdi
callq 0x5537
testb %al, %al
je 0x4227
pushq $0x2
jmp 0x425e
pushq $0xe
popq %rsi
movq %r14, %rdi
callq 0x5537
testb %al, %al
je 0x423a
pushq $0x3
jmp 0x425e
pushq $0x18
popq %rsi
movq %r14, %rdi
callq 0x5537
testb %al, %al
je 0x424d
pushq $0x4
jmp 0x425e
pushq $0x19
popq %rsi
movq %r14, %rdi
callq 0x5537
testb %al, %al
je 0x4298
pushq $0x5
popq %r12
movq %rbx, %rdi
movq %r14, %rsi
callq 0x41db
movq %rax, %r14
pushq $0x10
popq %rsi
xorl %edi, %edi
callq *(%rbx)
movq %rax, %r15
movl $0x6, (%rax)
movl %r12d, 0x4(%rax)
movq %r14, 0x8(%rax)
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
callq 0x5559
cmpl $0x2e, %eax
je 0x42d8
movq %r14, %rdi
callq 0x5559
cmpl $0x1, %eax
je 0x42d8
movq %r14, %rdi
callq 0x5559
cmpl $0x2, %eax
je 0x42d8
movq %r14, %rdi
callq 0x5559
testl %eax, %eax
je 0x42d8
movq %r14, %rdi
callq 0x5559
cmpl $0x3, %eax
jne 0x42f1
movq %rbx, %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x43ef
movq %r14, %rdi
callq 0x5559
cmpl $0x5, %eax
jne 0x43a0
leaq -0x30(%rbp), %r15
andq $0x0, (%r15)
pushq $0x5
popq %rsi
movq %r14, %rdi
callq 0x38da
pushq $0x18
popq %r12
movq %r14, %rdi
pushq $0x5
popq %rsi
callq 0x5537
testb %al, %al
jne 0x43e6
movq %r14, %rdi
callq 0x5559
cmpl $0x3, %eax
jne 0x4349
movq %rbx, %rdi
movq %r14, %rsi
callq 0x43ef
movq %rax, %r13
jmp 0x4378
movq %r14, %rdi
pushq $0x6
popq %rsi
callq 0x5537
testb %al, %al
je 0x4375
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x3a1d
movq %rax, %r13
movq %r14, %rdi
pushq $0x7
popq %rsi
callq 0x38da
jmp 0x4378
xorl %r13d, %r13d
xorl %edi, %edi
movl %r12d, %esi
callq *(%rbx)
movq %rax, (%r15)
movl $0x5, (%rax)
movq %r13, 0x8(%rax)
movq (%r15), %rax
andq $0x0, 0x10(%rax)
movq (%r15), %r15
addq $0x10, %r15
jmp 0x4319
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x3c73
movq %rax, %r15
cmpl $0x0, (%rax)
jne 0x4286
movq %r14, %rdi
callq 0x5559
cmpl $0x2e, %eax
jne 0x4286
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3bdd
movq -0x30(%rbp), %r15
jmp 0x4286