// File: /workspace/github_c_makefile_star2_O0/ryvnf[P]czc/eval.c
// Function: sizeof_type
size_t sizeof_type(struct loc *loc, struct type *type)
{
    switch (type_type(type->tag)) {
        case VOID_TYPE_FLAG:
            fatal(loc, "cannot compute the size of void");
            return 0;
        case FUNC_TYPE_FLAG:
            fatal(loc, "cannot compute the size of a function");
            return 0;
        case BOOL_TYPE_FLAG:
        case INT_TYPE_FLAG:
        case FLOAT_TYPE_FLAG:
            return sizeof_basic_type(type);
        case PTR_TYPE_FLAG:
            // This would not be portable on computers where size of function
            // pointers is different from regular pointers.
            return sizeof (void *);
        case ARRAY_TYPE_FLAG: {
            struct type *elem_type = array_type(type)->of;
            size_t elem_size = sizeof_type(loc, elem_type);
            size_t elem_align = alignof_type(loc, elem_type);
            size_t n_elems = array_type(type)->len;
            return align_size(elem_size, elem_align) * n_elems;
        }
        case STRUCT_TYPE_FLAG: {
            size_t n_fields = struct_type(type)->n_fields;
            struct field *fields = struct_type(type)->fields;
            size_t size = 0;

            for (size_t i = 0; i < n_fields; i++) {
                size_t field_size = sizeof_type(loc, fields[i].type);
                size_t field_align = alignof_type(loc, fields[i].type);
                size += align_size(field_size, field_align);
            }

            return size;
        }
    }

    unreachable();
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x18(%rbp), %rax
movl (%rax), %edi
callq 0x6f00
movl %eax, %ecx
movl %ecx, -0x6c(%rbp)
subl $0x1, %eax
je 0x8756
jmp 0x8707
movl -0x6c(%rbp), %eax
subl $0x2, %eax
je 0x877a
jmp 0x8711
movl -0x6c(%rbp), %eax
subl $0x4, %eax
je 0x877a
jmp 0x871b
movl -0x6c(%rbp), %eax
subl $0x8, %eax
je 0x878c
jmp 0x8725
movl -0x6c(%rbp), %eax
subl $0x10, %eax
je 0x8799
jmp 0x872f
movl -0x6c(%rbp), %eax
subl $0x20, %eax
je 0x8768
jmp 0x8739
movl -0x6c(%rbp), %eax
subl $0x40, %eax
je 0x87f8
jmp 0x8747
movl -0x6c(%rbp), %eax
subl $0x80, %eax
je 0x877a
jmp 0x88a1
movq -0x10(%rbp), %rdi
leaq 0xab38(%rip), %rsi      # 0x13299
movb $0x0, %al
callq 0x6610
movq -0x10(%rbp), %rdi
leaq 0xab46(%rip), %rsi      # 0x132b9
movb $0x0, %al
callq 0x6610
movq -0x18(%rbp), %rdi
callq 0xfcf0
movq %rax, -0x8(%rbp)
jmp 0x88c2
movq $0x8, -0x8(%rbp)
jmp 0x88c2
movq -0x18(%rbp), %rdi
callq 0x10490
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x86e0
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x84f0
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rdi
callq 0x10490
movq 0x10(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x8680
imulq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x88c2
movq -0x18(%rbp), %rdi
callq 0x10570
movq 0x10(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rdi
callq 0x10570
addq $0x20, %rax
movq %rax, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
movq $0x0, -0x58(%rbp)
movq -0x58(%rbp), %rax
cmpq -0x40(%rbp), %rax
jae 0x8897
movq -0x10(%rbp), %rdi
movq -0x48(%rbp), %rax
movq -0x58(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rsi
callq 0x86e0
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rdi
movq -0x48(%rbp), %rax
movq -0x58(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rsi
callq 0x84f0
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rdi
movq -0x68(%rbp), %rsi
callq 0x8680
addq -0x50(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x882a
movq -0x50(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x88c2
leaq 0xa8e8(%rip), %rdi      # 0x13190
leaq 0xa907(%rip), %rsi      # 0x131b6
movl $0x34b, %edx            # imm = 0x34B
leaq 0xaa31(%rip), %rcx      # 0x132ec
movb $0x0, %al
callq 0x6510
movq -0x8(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax)