// File: /workspace/github_c_makefile_star2_O0/hsjoihs[P]c-compiler/parse_analyze_toplevel.c
// Function: size_of
int size_of(const struct AnalyzerState *ptr_ps, const struct Type *ref_type)
{
	const struct Type type = *ref_type;
	switch (type.type_category) {
	case INT_:
		return 4;
	case PTR_:
		return 8;
	case CHAR_:
		return 1;
	case ARRAY:
		return type.array_length * size_of(ptr_ps, type.derived_from);
	case FN:
		fprintf(stderr, "function type does not have a size\n");
		exit(EXIT_FAILURE);
	case STRUCT_NOT_UNION:
	case UNION:
		if ((0)) { /* is local struct/union */
			unsupported("struct/union type declared locally");
		}
		const char *tag = type.s.struct_or_union_tag;
		const struct StructOrUnionInternalCompleteInfo *ptr_info =
		    lookup(ptr_ps->global_struct_or_union_tag_map, tag);
		if (!ptr_info) {
			fprintf(stderr, "tried to take the size of an incomplete type `");
			debug_print_type(&type);
			fprintf(stderr, "`\n");
			exit(EXIT_FAILURE);
		}
		return ptr_info->s_and_a.size;
	case VOID_:
		fprintf(stderr, "the size of type `void` is never known\n");
		exit(EXIT_FAILURE);
	case ENUM_:
		return 4;
	}

	fprintf(stderr,
	        "****************************\n"
	        "* INTERNAL COMPILER ERROR @ %s\n"
	        "* Unexpected value of TypeCategory: `type.type_category` is `%d`\n"
	        "****************************\n",
	        __func__, type.type_category);
	exit(EXIT_FAILURE);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x18(%rbp), %rax
movups 0x40(%rax), %xmm0
movaps %xmm0, -0x30(%rbp)
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups 0x20(%rax), %xmm2
movups 0x30(%rax), %xmm3
movaps %xmm3, -0x40(%rbp)
movaps %xmm2, -0x50(%rbp)
movaps %xmm1, -0x60(%rbp)
movaps %xmm0, -0x70(%rbp)
movl -0x70(%rbp), %eax
movq %rax, -0x88(%rbp)
subq $0x8, %rax
ja 0x26e6
movq -0x88(%rbp), %rax
leaq 0x10dbc(%rip), %rcx     # 0x1338c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x4, -0x4(%rbp)
jmp 0x2712
movl $0x8, -0x4(%rbp)
jmp 0x2712
movl $0x1, -0x4(%rbp)
jmp 0x2712
movl -0x60(%rbp), %eax
movl %eax, -0x8c(%rbp)
movq -0x10(%rbp), %rdi
movq -0x68(%rbp), %rsi
callq 0x2570
movl %eax, %ecx
movl -0x8c(%rbp), %eax
imull %ecx, %eax
movl %eax, -0x4(%rbp)
jmp 0x2712
movq 0x199cb(%rip), %rax     # 0x1bff8
movq (%rax), %rdi
leaq 0x10de5(%rip), %rsi     # 0x1341c
movb $0x0, %al
callq 0x10d0
movl $0x1, %edi
callq 0x1150
movq -0x40(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rdi
movq -0x78(%rbp), %rsi
callq 0xcc00
movq %rax, -0x80(%rbp)
cmpq $0x0, -0x80(%rbp)
jne 0x26af
movq 0x19985(%rip), %rax     # 0x1bff8
movq (%rax), %rdi
leaq 0x10dc3(%rip), %rsi     # 0x13440
movb $0x0, %al
callq 0x10d0
leaq -0x70(%rbp), %rdi
callq 0xb390
movq 0x19964(%rip), %rax     # 0x1bff8
movq (%rax), %rdi
leaq 0x11903(%rip), %rsi     # 0x13fa1
movb $0x0, %al
callq 0x10d0
movl $0x1, %edi
callq 0x1150
movq -0x80(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x2712
movq 0x19936(%rip), %rax     # 0x1bff8
movq (%rax), %rdi
leaq 0x10da3(%rip), %rsi     # 0x1346f
movb $0x0, %al
callq 0x10d0
movl $0x1, %edi
callq 0x1150
movl $0x4, -0x4(%rbp)
jmp 0x2712
movq 0x1990b(%rip), %rax     # 0x1bff8
movq (%rax), %rdi
movl -0x70(%rbp), %ecx
leaq 0x10d9d(%rip), %rsi     # 0x13497
leaq 0x10e31(%rip), %rdx     # 0x13532
movb $0x0, %al
callq 0x10d0
movl $0x1, %edi
callq 0x1150
movl -0x4(%rbp), %eax
addq $0x90, %rsp
popq %rbp
retq
nop