// File: /workspace/github_c_makefile_star2_O2/Ihsoh[P]ilang/compiler/frontend/semantics.c
// Function: calc_type_align
static size_t _calc_type_align(
	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 1;
		}
		case FE_NODE_TYPE_STRUCT: {
			return _calc_struct_type_align(ctx, node, node_type);
		}
		case FE_NODE_TYPE_ARRAY: {
			assert(node_type->nchilds == 2);

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

			return _calc_type_align(ctx, node, node_array_type);
		}
		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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x1dddb(%rip), %rax     # 0x46ef4
testq %rdx, %rdx
je 0x29364
movl (%rdx), %ecx
leal -0x400(%rcx), %esi
cmpl $0x20, %esi
ja 0x2916e
movslq (%rax,%rsi,4), %rcx
addq %rax, %rcx
jmpq *%rcx
cmpl $0x2, 0x44(%rdx)
jne 0x29383
movq 0x48(%rdx), %rcx
movq 0x8(%rcx), %rdx
testq %rdx, %rdx
jne 0x29119
leaq 0x1ec3d(%rip), %rdi     # 0x47d93
leaq 0x1e7dd(%rip), %rsi     # 0x4793a
leaq 0x1ebe4(%rip), %rcx     # 0x47d48
movl $0x768, %edx            # imm = 0x768
callq 0x30a0
cmpl $0x430, %ecx            # imm = 0x430
je 0x29230
cmpl $0x440, %ecx            # imm = 0x440
je 0x29235
cmpl $0x4ff, %ecx            # imm = 0x4FF
je 0x2922c
leaq 0x131c7(%rip), %rdi     # 0x3c360
leaq 0x1e79a(%rip), %rsi     # 0x4793a
leaq 0x1eba1(%rip), %rcx     # 0x47d48
movl $0x77d, %edx            # imm = 0x77D
callq 0x30a0
pushq $0x2
jmp 0x2924c
cmpl $0x1, 0x44(%rdx)
jne 0x293e0
movq 0x48(%rdx), %rax
movq (%rax), %r12
testq %r12, %r12
je 0x293ff
cmpl $0x200, (%r12)          # imm = 0x200
jne 0x2941e
movq 0x10(%r12), %rcx
pushq $0x2
popq %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x6779
movq %rax, %r15
testq %rax, %rax
jne 0x2920d
movq 0x10(%r12), %rsi
leaq 0x1eacc(%rip), %rdx     # 0x47cd3
movq %rbx, %rdi
callq *0x50(%rbx)
movq 0x30(%r15), %rax
testq %rax, %rax
je 0x2943d
cmpl $0xd00, (%rax)          # imm = 0xD00
jne 0x2945c
cmpb $0x0, 0x68(%rax)
je 0x29260
pushq $0x1
jmp 0x2924c
xorl %r15d, %r15d
jmp 0x2924e
movl 0x30(%rbx), %eax
cmpl $0x1, %eax
je 0x2924a
cmpl $0x2, %eax
jne 0x2947b
pushq $0x8
jmp 0x2924c
pushq $0x4
popq %r15
movq %r15, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x38(%r15), %rcx
testq %rcx, %rcx
je 0x2949a
cmpl $0xd01, (%rcx)          # imm = 0xD01
jne 0x294b9
pushq $0x1
popq %r15
xorl %edx, %edx
movq %rcx, -0x30(%rbp)
movslq 0x44(%rcx), %rax
cmpq %rax, %rdx
jge 0x2924e
movq 0x48(%rcx), %rax
movq (%rax,%rdx,8), %r12
testq %r12, %r12
je 0x293a2
movq %rdx, -0x38(%rbp)
cmpl $0xc00, (%r12)          # imm = 0xC00
jne 0x293c1
xorl %r13d, %r13d
movslq 0x44(%r12), %rax
cmpq %rax, %r13
jge 0x292f7
movq 0x48(%r12), %rax
movq (%rax,%r13,8), %rax
testq %rax, %rax
je 0x29345
cmpl $0xc01, (%rax)          # imm = 0xC01
jne 0x29307
cmpl $0x1, 0x44(%rax)
jle 0x29326
movq 0x48(%rax), %rax
movq 0x8(%rax), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x290fb
cmpq %r15, %rax
cmovaq %rax, %r15
incq %r13
jmp 0x292b2
movq -0x38(%rbp), %rdx
incq %rdx
movq -0x30(%rbp), %rcx
jmp 0x29283
leaq 0x1ebb1(%rip), %rdi     # 0x47ebf
leaq 0x1e625(%rip), %rsi     # 0x4793a
leaq 0x1ea87(%rip), %rcx     # 0x47da3
movl $0x725, %edx            # imm = 0x725
callq 0x30a0
leaq 0x1ebba(%rip), %rdi     # 0x47ee7
leaq 0x1e606(%rip), %rsi     # 0x4793a
leaq 0x1ea68(%rip), %rcx     # 0x47da3
movl $0x726, %edx            # imm = 0x726
callq 0x30a0
leaq 0x1eb65(%rip), %rdi     # 0x47eb1
leaq 0x1e5e7(%rip), %rsi     # 0x4793a
leaq 0x1ea49(%rip), %rcx     # 0x47da3
movl $0x724, %edx            # imm = 0x724
callq 0x30a0
leaq 0x153a8(%rip), %rdi     # 0x3e713
leaq 0x1e5c8(%rip), %rsi     # 0x4793a
leaq 0x1e9cf(%rip), %rcx     # 0x47d48
movl $0x73a, %edx            # imm = 0x73A
callq 0x30a0
leaq 0x1549e(%rip), %rdi     # 0x3e828
leaq 0x1e5a9(%rip), %rsi     # 0x4793a
leaq 0x1e9b0(%rip), %rcx     # 0x47d48
movl $0x765, %edx            # imm = 0x765
callq 0x30a0
leaq 0x1eac3(%rip), %rdi     # 0x47e6c
leaq 0x1e58a(%rip), %rsi     # 0x4793a
leaq 0x1e9ec(%rip), %rcx     # 0x47da3
movl $0x720, %edx            # imm = 0x720
callq 0x30a0
leaq 0x1eabc(%rip), %rdi     # 0x47e84
leaq 0x1e56b(%rip), %rsi     # 0x4793a
leaq 0x1e9cd(%rip), %rcx     # 0x47da3
movl $0x721, %edx            # imm = 0x721
callq 0x30a0
leaq 0x1536d(%rip), %rdi     # 0x3e754
leaq 0x1e54c(%rip), %rsi     # 0x4793a
leaq 0x1e9ae(%rip), %rcx     # 0x47da3
movl $0x706, %edx            # imm = 0x706
callq 0x30a0
leaq 0x1e9ef(%rip), %rdi     # 0x47df5
leaq 0x1e52d(%rip), %rsi     # 0x4793a
leaq 0x1e98f(%rip), %rcx     # 0x47da3
movl $0x709, %edx            # imm = 0x709
callq 0x30a0
leaq 0x15347(%rip), %rdi     # 0x3e76c
leaq 0x1e50e(%rip), %rsi     # 0x4793a
leaq 0x1e970(%rip), %rcx     # 0x47da3
movl $0x70a, %edx            # imm = 0x70A
callq 0x30a0
leaq 0x1e9b9(%rip), %rdi     # 0x47dfd
leaq 0x1e4ef(%rip), %rsi     # 0x4793a
leaq 0x1e951(%rip), %rcx     # 0x47da3
movl $0x712, %edx            # imm = 0x712
callq 0x30a0
leaq 0x1e9a6(%rip), %rdi     # 0x47e09
leaq 0x1e4d0(%rip), %rsi     # 0x4793a
leaq 0x1e932(%rip), %rcx     # 0x47da3
movl $0x713, %edx            # imm = 0x713
callq 0x30a0
leaq 0x12ede(%rip), %rdi     # 0x3c360
leaq 0x1e4b1(%rip), %rsi     # 0x4793a
leaq 0x1e8b8(%rip), %rcx     # 0x47d48
movl $0x775, %edx            # imm = 0x775
callq 0x30a0
leaq 0x1e98c(%rip), %rdi     # 0x47e2d
leaq 0x1e492(%rip), %rsi     # 0x4793a
leaq 0x1e8f4(%rip), %rcx     # 0x47da3
movl $0x719, %edx            # imm = 0x719
callq 0x30a0
leaq 0x1e97e(%rip), %rdi     # 0x47e3e
leaq 0x1e473(%rip), %rsi     # 0x4793a
leaq 0x1e8d5(%rip), %rcx     # 0x47da3
movl $0x71a, %edx            # imm = 0x71A
callq 0x30a0