// File: /workspace/github_c_makefile_star2_O0/ryvnf[P]czc/eval.c
// Function: eval_init_expr
struct expr eval_init_expr(struct type *t, struct ast *ast, bool global_init)
{
    struct type *type = eval_type(t, ast);

    size_t n_childs;
    struct ast **childs = ast_asts(ast, &n_childs);

    struct rope *rope;

    // If this is not part of a global variable initializer, make this
    // initializer a compound expression.
    if (!global_init) {
        rope = lparen_rope;
        rope = rope_new_tree(rope, type_to_c(NULL, t));
        rope = rope_new_tree(rope, rparen_sp_rope);
        rope = rope_new_tree(rope, lcurly_sp_rope);
    } else {
        rope = lcurly_sp_rope;
    }

    if (is_array_type(t)) {
        struct array_type *a_t = array_type(t);

        for (size_t i = 0; i < n_childs; i++) {
            struct expr expr = eval_expr_(a_t->of, childs[i], global_init);
            rope = rope_new_tree(rope, expr.rope);

            if (i != n_childs - 1)
                rope = rope_new_tree(rope, comma_sp_rope);
            else
                rope = rope_new_tree(rope, sp_rope);
        }
    } else if (is_struct_type(t)) {
        struct struct_type *s_t = struct_type(t);

        for (size_t i = 0; i < n_childs; i++) {
            struct expr expr = eval_expr_(s_t->fields[i].type, childs[i], global_init);
            rope = rope_new_tree(rope, expr.rope);

            if (i != n_childs - 1)
                rope = rope_new_tree(rope, comma_sp_rope);
            else
                rope = rope_new_tree(rope, sp_rope);
        }
    }

    rope = rope_new_tree(rope, rcurly_rope);

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movb %dl, %al
movq %rdi, -0x18(%rbp)
movq %rsi, -0x20(%rbp)
andb $0x1, %al
movb %al, -0x21(%rbp)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x7130
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x2ad0
movq %rax, -0x40(%rbp)
testb $0x1, -0x21(%rbp)
jne 0xa0c2
leaq 0xf227(%rip), %rax      # 0x19290
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x18(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edi
callq 0x3ee0
movq -0x90(%rbp), %rdi
movq %rax, %rsi
callq 0xf2a0
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
leaq 0xf24d(%rip), %rsi      # 0x192f0
callq 0xf2a0
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
leaq 0xf2d9(%rip), %rsi      # 0x19390
callq 0xf2a0
movq %rax, -0x48(%rbp)
jmp 0xa0cd
leaq 0xf2c7(%rip), %rax      # 0x19390
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rdi
callq 0x6e90
testb $0x1, %al
jne 0xa0df
jmp 0xa18f
movq -0x18(%rbp), %rdi
callq 0x10490
movq %rax, -0x50(%rbp)
movq $0x0, -0x58(%rbp)
movq -0x58(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0xa18a
movq -0x50(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x40(%rbp), %rax
movq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
movb -0x21(%rbp), %al
andb $0x1, %al
movzbl %al, %edx
callq 0xa2a0
movq %rax, -0x68(%rbp)
movq %rdx, -0x60(%rbp)
movq -0x48(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0xf2a0
movq %rax, -0x48(%rbp)
movq -0x58(%rbp), %rax
movq -0x38(%rbp), %rcx
subq $0x1, %rcx
cmpq %rcx, %rax
je 0xa163
movq -0x48(%rbp), %rdi
leaq 0xf398(%rip), %rsi      # 0x194f0
callq 0xf2a0
movq %rax, -0x48(%rbp)
jmp 0xa177
movq -0x48(%rbp), %rdi
leaq 0xf502(%rip), %rsi      # 0x19670
callq 0xf2a0
movq %rax, -0x48(%rbp)
jmp 0xa179
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0xa0f4
jmp 0xa262
movq -0x18(%rbp), %rdi
callq 0x84d0
testb $0x1, %al
jne 0xa1a1
jmp 0xa260
movq -0x18(%rbp), %rdi
callq 0x10570
movq %rax, -0x70(%rbp)
movq $0x0, -0x78(%rbp)
movq -0x78(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0xa25e
movq -0x70(%rbp), %rax
addq $0x20, %rax
movq -0x78(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rdi
movq -0x40(%rbp), %rax
movq -0x78(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
movb -0x21(%rbp), %al
andb $0x1, %al
movzbl %al, %edx
callq 0xa2a0
movq %rax, -0x88(%rbp)
movq %rdx, -0x80(%rbp)
movq -0x48(%rbp), %rdi
movq -0x80(%rbp), %rsi
callq 0xf2a0
movq %rax, -0x48(%rbp)
movq -0x78(%rbp), %rax
movq -0x38(%rbp), %rcx
subq $0x1, %rcx
cmpq %rcx, %rax
je 0xa237
movq -0x48(%rbp), %rdi
leaq 0xf2c4(%rip), %rsi      # 0x194f0
callq 0xf2a0
movq %rax, -0x48(%rbp)
jmp 0xa24b
movq -0x48(%rbp), %rdi
leaq 0xf42e(%rip), %rsi      # 0x19670
callq 0xf2a0
movq %rax, -0x48(%rbp)
jmp 0xa24d
movq -0x78(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x78(%rbp)
jmp 0xa1b6
jmp 0xa260
jmp 0xa262
movq -0x48(%rbp), %rdi
leaq 0xf143(%rip), %rsi      # 0x193b0
callq 0xf2a0
movq %rax, -0x48(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rdx
addq $0x90, %rsp
popq %rbp
retq
nopw (%rax,%rax)