// File: /workspace/github_c_makefile_star2_O0/ryvnf[P]czc/eval.c
// Function: eval_call_expr
struct expr eval_call_expr(struct ast *ast)
{
    struct type *type = eval_type(NULL, ast);
    struct ast *called_ast = ast_ast(ast, 0);
    struct expr called_expr = eval_expr(NULL, called_ast);
    if (get_c_prec(called_ast->tag) < get_c_prec(ast->tag))
        called_expr.rope = add_paren(called_expr.rope);

    struct rope *rope = called_expr.rope;
    size_t n_arg_asts;
    struct ast **arg_asts = ast_asts(ast_ast(ast, 1), &n_arg_asts);

    rope = rope_new_tree(rope, rope_new_s("("));

    struct func_type *called_type = func_type(called_expr.type);

    for (size_t i = 0; i < n_arg_asts; i++) {
        struct expr arg_expr;
        if (i < called_type->n_params)
            arg_expr = eval_expr(called_type->params[i], arg_asts[i]);
        else
            arg_expr = eval_expr(NULL, arg_asts[i]);
        if (get_c_prec(arg_asts[i]->tag) <= get_c_prec(COMMA_EXPR))
            arg_expr.rope = add_paren(arg_expr.rope);

        rope = rope_new_tree(rope, arg_expr.rope);

        if (i != n_arg_asts - 1)
            rope = rope_new_tree(rope, rope_new_s(", "));
    }

    rope = rope_new_tree(rope, rope_new_s(")"));

    return (struct expr){ .rope = rope, .type = type };
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x18(%rbp)
movq -0x18(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edi
callq 0x7130
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x2a40
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edi
callq 0x81b0
movq %rax, -0x38(%rbp)
movq %rdx, -0x30(%rbp)
movq -0x28(%rbp), %rax
movl (%rax), %edi
callq 0x6a50
movl %eax, -0x94(%rbp)
movq -0x18(%rbp), %rax
movl (%rax), %edi
callq 0x6a50
movl %eax, %ecx
movl -0x94(%rbp), %eax
cmpl %ecx, %eax
jge 0x982b
movq -0x30(%rbp), %rdi
callq 0x81f0
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rdi
movl $0x1, %esi
callq 0x2a40
movq %rax, %rdi
leaq -0x48(%rbp), %rsi
callq 0x2ad0
movq %rax, -0x50(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0xa0(%rbp)
leaq 0xad11(%rip), %rdi      # 0x14574
callq 0xf2f0
movq -0xa0(%rbp), %rdi
movq %rax, %rsi
callq 0xf2a0
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rdi
callq 0x10500
movq %rax, -0x58(%rbp)
movq $0x0, -0x60(%rbp)
movq -0x60(%rbp), %rax
cmpq -0x48(%rbp), %rax
jae 0x99b8
movq -0x60(%rbp), %rax
movq -0x58(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jae 0x98e4
movq -0x58(%rbp), %rax
movq -0x60(%rbp), %rcx
movq 0x20(%rax,%rcx,8), %rdi
movq -0x50(%rbp), %rax
movq -0x60(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x81b0
movq %rax, -0x80(%rbp)
movq %rdx, -0x78(%rbp)
movq -0x80(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0x68(%rbp)
jmp 0x991d
movq -0x50(%rbp), %rax
movq -0x60(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
xorl %eax, %eax
movl %eax, %edi
callq 0x81b0
movq %rax, -0x90(%rbp)
movq %rdx, -0x88(%rbp)
movq -0x90(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x88(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x50(%rbp), %rax
movq -0x60(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl (%rax), %edi
callq 0x6a50
movl %eax, -0xa4(%rbp)
movl $0x4200, %edi           # imm = 0x4200
callq 0x6a50
movl %eax, %ecx
movl -0xa4(%rbp), %eax
cmpl %ecx, %eax
jg 0x9959
movq -0x68(%rbp), %rdi
callq 0x81f0
movq %rax, -0x68(%rbp)
movq -0x40(%rbp), %rdi
movq -0x68(%rbp), %rsi
callq 0xf2a0
movq %rax, -0x40(%rbp)
movq -0x60(%rbp), %rax
movq -0x48(%rbp), %rcx
subq $0x1, %rcx
cmpq %rcx, %rax
je 0x99a5
movq -0x40(%rbp), %rax
movq %rax, -0xb0(%rbp)
leaq 0x8c8f(%rip), %rdi      # 0x1261c
callq 0xf2f0
movq -0xb0(%rbp), %rdi
movq %rax, %rsi
callq 0xf2a0
movq %rax, -0x40(%rbp)
jmp 0x99a7
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0x9890
movq -0x40(%rbp), %rax
movq %rax, -0xb8(%rbp)
leaq 0x86ca(%rip), %rdi      # 0x12094
callq 0xf2f0
movq -0xb8(%rbp), %rdi
movq %rax, %rsi
callq 0xf2a0
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rdx
addq $0xc0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)