// File: /workspace/github_c_makefile_star2_O0/ryvnf[P]czc/eval.c
// Function: eval_init_type
struct type *eval_init_type(struct type *t, struct ast *ast)
{
    size_t n_childs;
    struct ast **childs = ast_asts(ast, &n_childs);

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

        if (a_t->len < n_childs)
            fatal(ast->loc, "excess elements in array initializer");

        for (size_t i = 0; i < n_childs; i++) {
            struct type *got_type = eval_type(a_t->of, childs[i]);
            struct type *type = target_type(a_t->of, got_type);

            if (type == NULL || !type_equals(a_t->of, type))
                fatal(ast->loc, "invalid type in array initializer");
        }
    } else if (is_struct_type(t)) {
        struct struct_type *s_t = struct_type(t);

        if (s_t->n_fields < n_childs)
            fatal(ast->loc, "excess elements in struct initializer");

        for (size_t i = 0; i < n_childs; i++) {
            struct type *field_type = s_t->fields[i].type;
            struct type *got_type = eval_type(field_type, childs[i]);
            struct type *type = target_type(field_type, got_type);

            if (type == NULL || !type_equals(field_type, type))
                fatal(ast->loc, "invalid type in struct initializer");
        }
    } else {
        fatal(ast->loc, "invalid type");
    }

    return type_dup(t, 0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0x2ad0
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
callq 0x6e90
testb $0x1, %al
jne 0x8303
jmp 0x83bf
movq -0x8(%rbp), %rdi
callq 0x10490
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
cmpq -0x18(%rbp), %rax
jae 0x8334
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0xae9f(%rip), %rsi      # 0x131cc
movb $0x0, %al
callq 0x6610
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x18(%rbp), %rax
jae 0x83ba
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x20(%rbp), %rax
movq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x7130
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x38(%rbp), %rsi
callq 0x6d30
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x8394
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x40(%rbp), %rsi
callq 0x10c90
testb $0x1, %al
jne 0x83aa
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0xae4e(%rip), %rsi      # 0x131f1
movb $0x0, %al
callq 0x6610
jmp 0x83ac
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x833c
jmp 0x84b8
movq -0x8(%rbp), %rdi
callq 0x84d0
testb $0x1, %al
jne 0x83d1
jmp 0x84a0
movq -0x8(%rbp), %rdi
callq 0x10570
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rax
cmpq -0x18(%rbp), %rax
jae 0x8402
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0xae18(%rip), %rsi      # 0x13213
movb $0x0, %al
callq 0x6610
movq $0x0, -0x50(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x18(%rbp), %rax
jae 0x849e
movq -0x48(%rbp), %rax
addq $0x20, %rax
movq -0x50(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rdi
movq -0x20(%rbp), %rax
movq -0x50(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x7130
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0x6d30
movq %rax, -0x68(%rbp)
cmpq $0x0, -0x68(%rbp)
je 0x8475
movq -0x58(%rbp), %rdi
movq -0x68(%rbp), %rsi
callq 0x10c90
testb $0x1, %al
jne 0x848b
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0xadb5(%rip), %rsi      # 0x13239
movb $0x0, %al
callq 0x6610
jmp 0x848d
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x840a
jmp 0x84b6
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0xadad(%rip), %rsi      # 0x1325c
movb $0x0, %al
callq 0x6610
jmp 0x84b8
movq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0x10f60
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax)