// File: /workspace/github_c_makefile_star2_O0/Ihsoh[P]ilang/compiler/frontend/semantics.c
// Function: calc_type_size
static size_t _calc_type_size(
	ParserContext *ctx,
	ParserASTNode *node,
	ParserASTNode *node_type
) {
	assert(ctx);
	assert(node);
	assert(node_type);

	switch (node_type->type) {
		case FE_NODE_TYPE_CHAR: {
			return 1;
		}
		case FE_NODE_TYPE_INT8: {
			return 1;
		}
		case FE_NODE_TYPE_INT16: {
			return 2;
		}
		case FE_NODE_TYPE_INT32: {
			return 4;
		}
		case FE_NODE_TYPE_INT64: {
			return 8;
		}
		case FE_NODE_TYPE_UINT8: {
			return 1;
		}
		case FE_NODE_TYPE_UINT16: {
			return 2;
		}
		case FE_NODE_TYPE_UINT32: {
			return 4;
		}
		case FE_NODE_TYPE_UINT64: {
			return 8;
		}
		case FE_NODE_TYPE_FLOAT: {
			return 4;
		}
		case FE_NODE_TYPE_DOUBLE: {
			return 8;
		}
		case FE_NODE_TYPE_VA_LIST: {
			return 0;
		}
		case FE_NODE_TYPE_STRUCT: {
			return _calc_struct_type_size(ctx, node, node_type);
		}
		case FE_NODE_TYPE_ARRAY: {
			assert(node_type->nchilds == 2);

			ParserASTNode *node_array_dims = node_type->childs[0];
			assert(node_array_dims);
			assert(node_array_dims->type == FE_NODE_TYPE_ARRAY_DIMS);

			ParserASTNode *node_array_type = node_type->childs[1];
			assert(node_array_type);

			size_t size = _calc_type_size(ctx, node, node_array_type);
			for (int i = 0; i < node_array_dims->nchilds; i++) {
				ParserASTNode *node_array_dim = node_array_dims->childs[i];
				assert(node_array_dim);

				size *= fe_parser_get_uint_val(ctx, node_array_dim);
			}

			return size;
		}
		case FE_NODE_TYPE_FUNC: {
			return 0;
		}
		case FE_NODE_TYPE_POINTER: {
			if (ctx->arch == FE_ARCH_32) {
				return 4;
			} else if (ctx->arch == FE_ARCH_64) {
				return 8;
			} else {
				assert(0);
				return 0;
			}
		}
		case FE_NODE_TYPE_VOID: {
			return 1;
		}
		default: {
			assert(0);
			return 0;
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x57ded
jmp 0x57e0c
leaq 0x24762(%rip), %rdi     # 0x7c556
leaq 0x2644f(%rip), %rsi     # 0x7e24a
movl $0x7d2, %edx            # imm = 0x7D2
leaq 0x2762c(%rip), %rcx     # 0x7f433
callq 0x30a0
cmpq $0x0, -0x18(%rbp)
je 0x57e15
jmp 0x57e34
leaq 0x1e1b7(%rip), %rdi     # 0x75fd3
leaq 0x26427(%rip), %rsi     # 0x7e24a
movl $0x7d3, %edx            # imm = 0x7D3
leaq 0x27604(%rip), %rcx     # 0x7f433
callq 0x30a0
cmpq $0x0, -0x20(%rbp)
je 0x57e3d
jmp 0x57e5c
leaq 0x1c8ef(%rip), %rdi     # 0x74733
leaq 0x263ff(%rip), %rsi     # 0x7e24a
movl $0x7d4, %edx            # imm = 0x7D4
leaq 0x275dc(%rip), %rcx     # 0x7f433
callq 0x30a0
movq -0x20(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4c(%rbp)
subl $0x400, %eax            # imm = 0x400
je 0x57f75
jmp 0x57e72
movl -0x4c(%rbp), %eax
subl $0x401, %eax            # imm = 0x401
je 0x57f82
jmp 0x57e82
movl -0x4c(%rbp), %eax
subl $0x402, %eax            # imm = 0x402
je 0x57f8f
jmp 0x57e92
movl -0x4c(%rbp), %eax
subl $0x403, %eax            # imm = 0x403
je 0x57f9c
jmp 0x57ea2
movl -0x4c(%rbp), %eax
subl $0x404, %eax            # imm = 0x404
je 0x57fa9
jmp 0x57eb2
movl -0x4c(%rbp), %eax
subl $0x405, %eax            # imm = 0x405
je 0x57fb6
jmp 0x57ec2
movl -0x4c(%rbp), %eax
subl $0x406, %eax            # imm = 0x406
je 0x57fc3
jmp 0x57ed2
movl -0x4c(%rbp), %eax
subl $0x407, %eax            # imm = 0x407
je 0x57fd0
jmp 0x57ee2
movl -0x4c(%rbp), %eax
subl $0x408, %eax            # imm = 0x408
je 0x57fdd
jmp 0x57ef2
movl -0x4c(%rbp), %eax
subl $0x409, %eax            # imm = 0x409
je 0x57fea
jmp 0x57f02
movl -0x4c(%rbp), %eax
subl $0x40a, %eax            # imm = 0x40A
je 0x57ff7
jmp 0x57f12
movl -0x4c(%rbp), %eax
subl $0x40b, %eax            # imm = 0x40B
je 0x58004
jmp 0x57f22
movl -0x4c(%rbp), %eax
subl $0x410, %eax            # imm = 0x410
je 0x58011
jmp 0x57f32
movl -0x4c(%rbp), %eax
subl $0x420, %eax            # imm = 0x420
je 0x5802b
jmp 0x57f42
movl -0x4c(%rbp), %eax
subl $0x430, %eax            # imm = 0x430
je 0x58181
jmp 0x57f52
movl -0x4c(%rbp), %eax
subl $0x440, %eax            # imm = 0x440
je 0x5818b
jmp 0x57f62
movl -0x4c(%rbp), %eax
subl $0x4ff, %eax            # imm = 0x4FF
je 0x581d2
jmp 0x581dc
movq $0x1, -0x8(%rbp)
jmp 0x581fb
movq $0x1, -0x8(%rbp)
jmp 0x581fb
movq $0x2, -0x8(%rbp)
jmp 0x581fb
movq $0x4, -0x8(%rbp)
jmp 0x581fb
movq $0x8, -0x8(%rbp)
jmp 0x581fb
movq $0x1, -0x8(%rbp)
jmp 0x581fb
movq $0x2, -0x8(%rbp)
jmp 0x581fb
movq $0x4, -0x8(%rbp)
jmp 0x581fb
movq $0x8, -0x8(%rbp)
jmp 0x581fb
movq $0x4, -0x8(%rbp)
jmp 0x581fb
movq $0x8, -0x8(%rbp)
jmp 0x581fb
movq $0x0, -0x8(%rbp)
jmp 0x581fb
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x5af00
movq %rax, -0x8(%rbp)
jmp 0x581fb
movq -0x20(%rbp), %rax
cmpl $0x2, 0x44(%rax)
jne 0x58037
jmp 0x58056
leaq 0x1c80a(%rip), %rdi     # 0x74848
leaq 0x26205(%rip), %rsi     # 0x7e24a
movl $0x7ff, %edx            # imm = 0x7FF
leaq 0x273e2(%rip), %rcx     # 0x7f433
callq 0x30a0
movq -0x20(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x5806e
jmp 0x5808d
leaq 0x27408(%rip), %rdi     # 0x7f47d
leaq 0x261ce(%rip), %rsi     # 0x7e24a
movl $0x802, %edx            # imm = 0x802
leaq 0x273ab(%rip), %rcx     # 0x7f433
callq 0x30a0
movq -0x28(%rbp), %rax
cmpl $0x421, (%rax)          # imm = 0x421
jne 0x5809b
jmp 0x580ba
leaq 0x1c70e(%rip), %rdi     # 0x747b0
leaq 0x261a1(%rip), %rsi     # 0x7e24a
movl $0x803, %edx            # imm = 0x803
leaq 0x2737e(%rip), %rcx     # 0x7f433
callq 0x30a0
movq -0x20(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x580d3
jmp 0x580f2
leaq 0x265f8(%rip), %rdi     # 0x7e6d2
leaq 0x26169(%rip), %rsi     # 0x7e24a
movl $0x806, %edx            # imm = 0x806
leaq 0x27346(%rip), %rcx     # 0x7f433
callq 0x30a0
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq 0x57dd0
movq %rax, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movq -0x28(%rbp), %rcx
cmpl 0x44(%rcx), %eax
jge 0x58177
movq -0x28(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x3c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
je 0x58137
jmp 0x58156
leaq 0x2734f(%rip), %rdi     # 0x7f48d
leaq 0x26105(%rip), %rsi     # 0x7e24a
movl $0x80b, %edx            # imm = 0x80B
leaq 0x272e2(%rip), %rcx     # 0x7f433
callq 0x30a0
movq -0x10(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x429f0
imulq -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x5810e
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x581fb
movq $0x0, -0x8(%rbp)
jmp 0x581fb
movq -0x10(%rbp), %rax
cmpl $0x1, 0x30(%rax)
jne 0x5819f
movq $0x4, -0x8(%rbp)
jmp 0x581fb
movq -0x10(%rbp), %rax
cmpl $0x2, 0x30(%rax)
jne 0x581b3
movq $0x8, -0x8(%rbp)
jmp 0x581fb
leaq 0x1a2a1(%rip), %rdi     # 0x7245b
leaq 0x26089(%rip), %rsi     # 0x7e24a
movl $0x81b, %edx            # imm = 0x81B
leaq 0x27266(%rip), %rcx     # 0x7f433
callq 0x30a0
movq $0x1, -0x8(%rbp)
jmp 0x581fb
leaq 0x1a278(%rip), %rdi     # 0x7245b
leaq 0x26060(%rip), %rsi     # 0x7e24a
movl $0x823, %edx            # imm = 0x823
leaq 0x2723d(%rip), %rcx     # 0x7f433
callq 0x30a0
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)