// File: /workspace/github_c_makefile_star2_O1/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 0x1f1ca(%rip), %rax     # 0x4ade4
testq %rdx, %rdx
je 0x2be8c
movl (%rdx), %ecx
cmpl $0x42f, %ecx            # imm = 0x42F
jg 0x2bc7b
addl $0xfffffc00, %ecx       # imm = 0xFFFFFC00
cmpl $0x20, %ecx
ja 0x2beca
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
cmpl $0x2, 0x44(%rdx)
jne 0x2beab
movq 0x48(%rdx), %rcx
movq 0x8(%rcx), %rdx
testq %rdx, %rdx
jne 0x2bc1a
leaq 0x20050(%rip), %rdi     # 0x4bcb3
leaq 0x1fbf0(%rip), %rsi     # 0x4b85a
leaq 0x1fff7(%rip), %rcx     # 0x4bc68
movl $0x768, %edx            # imm = 0x768
callq 0x30a0
cmpl $0x430, %ecx            # imm = 0x430
je 0x2bdfb
cmpl $0x440, %ecx            # imm = 0x440
je 0x2be00
cmpl $0x4ff, %ecx            # imm = 0x4FF
jne 0x2beca
movl $0x1, %r15d
jmp 0x2be1d
movl $0x4, %r15d
jmp 0x2be1d
movl $0x2, %r15d
jmp 0x2be1d
cmpl $0x1, 0x44(%rdx)
jne 0x2bf27
movq 0x48(%rdx), %rax
movq (%rax), %r15
testq %r15, %r15
je 0x2bf46
cmpl $0x200, (%r15)          # imm = 0x200
jne 0x2bf65
movq 0x10(%r15), %rcx
movq %rbx, %rdi
movq %r14, %rsi
movl $0x2, %edx
callq 0x6db9
movq %rax, %r12
testq %rax, %rax
jne 0x2bd14
movq 0x10(%r15), %rsi
leaq 0x1fee5(%rip), %rdx     # 0x4bbf3
movq %rbx, %rdi
callq *0x50(%rbx)
movq 0x30(%r12), %rax
testq %rax, %rax
je 0x2bf84
cmpl $0xd00, (%rax)          # imm = 0xD00
jne 0x2bfa3
movl $0x1, %r15d
cmpb $0x0, 0x68(%rax)
jne 0x2be1d
movq 0x38(%r12), %rcx
testq %rcx, %rcx
je 0x2bfe1
cmpl $0xd01, (%rcx)          # imm = 0xD01
jne 0x2c000
cmpl $0x0, 0x44(%rcx)
jle 0x2be1d
xorl %edx, %edx
movq %rcx, -0x30(%rbp)
movq 0x48(%rcx), %rax
movq (%rax,%rdx,8), %r12
testq %r12, %r12
je 0x2bee9
cmpl $0xc00, (%r12)          # imm = 0xC00
jne 0x2bf08
movq %rdx, -0x38(%rbp)
cmpl $0x0, 0x44(%r12)
jle 0x2bde1
xorl %r13d, %r13d
movq 0x48(%r12), %rax
movq (%rax,%r13,8), %rax
testq %rax, %rax
je 0x2be4e
cmpl $0xc01, (%rax)          # imm = 0xC01
jne 0x2be6d
cmpl $0x1, 0x44(%rax)
jle 0x2be2f
movq 0x48(%rax), %rax
movq 0x8(%rax), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2bbfc
cmpq %r15, %rax
cmovaq %rax, %r15
incq %r13
movslq 0x44(%r12), %rax
cmpq %rax, %r13
jl 0x2bd96
movq -0x38(%rbp), %rdx
incq %rdx
movq -0x30(%rbp), %rcx
movslq 0x44(%rcx), %rax
cmpq %rax, %rdx
jl 0x2bd68
jmp 0x2be1d
xorl %r15d, %r15d
jmp 0x2be1d
movl 0x30(%rbx), %eax
movl $0x4, %r15d
cmpl $0x1, %eax
je 0x2be1d
cmpl $0x2, %eax
jne 0x2bfc2
movl $0x8, %r15d
movq %r15, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1ffd1(%rip), %rdi     # 0x4be07
leaq 0x1fa1d(%rip), %rsi     # 0x4b85a
leaq 0x1fe7f(%rip), %rcx     # 0x4bcc3
movl $0x726, %edx            # imm = 0x726
callq 0x30a0
leaq 0x1ff7c(%rip), %rdi     # 0x4bdd1
leaq 0x1f9fe(%rip), %rsi     # 0x4b85a
leaq 0x1fe60(%rip), %rcx     # 0x4bcc3
movl $0x724, %edx            # imm = 0x724
callq 0x30a0
leaq 0x1ff6b(%rip), %rdi     # 0x4bddf
leaq 0x1f9df(%rip), %rsi     # 0x4b85a
leaq 0x1fe41(%rip), %rcx     # 0x4bcc3
movl $0x725, %edx            # imm = 0x725
callq 0x30a0
leaq 0x16824(%rip), %rdi     # 0x426b7
leaq 0x1f9c0(%rip), %rsi     # 0x4b85a
leaq 0x1fdc7(%rip), %rcx     # 0x4bc68
movl $0x73a, %edx            # imm = 0x73A
callq 0x30a0
leaq 0x1691a(%rip), %rdi     # 0x427cc
leaq 0x1f9a1(%rip), %rsi     # 0x4b85a
leaq 0x1fda8(%rip), %rcx     # 0x4bc68
movl $0x765, %edx            # imm = 0x765
callq 0x30a0
leaq 0x144b3(%rip), %rdi     # 0x40384
leaq 0x1f982(%rip), %rsi     # 0x4b85a
leaq 0x1fd89(%rip), %rcx     # 0x4bc68
movl $0x77d, %edx            # imm = 0x77D
callq 0x30a0
leaq 0x1fe9c(%rip), %rdi     # 0x4bd8c
leaq 0x1f963(%rip), %rsi     # 0x4b85a
leaq 0x1fdc5(%rip), %rcx     # 0x4bcc3
movl $0x720, %edx            # imm = 0x720
callq 0x30a0
leaq 0x1fe95(%rip), %rdi     # 0x4bda4
leaq 0x1f944(%rip), %rsi     # 0x4b85a
leaq 0x1fda6(%rip), %rcx     # 0x4bcc3
movl $0x721, %edx            # imm = 0x721
callq 0x30a0
leaq 0x167ca(%rip), %rdi     # 0x426f8
leaq 0x1f925(%rip), %rsi     # 0x4b85a
leaq 0x1fd87(%rip), %rcx     # 0x4bcc3
movl $0x706, %edx            # imm = 0x706
callq 0x30a0
leaq 0x1fdc8(%rip), %rdi     # 0x4bd15
leaq 0x1f906(%rip), %rsi     # 0x4b85a
leaq 0x1fd68(%rip), %rcx     # 0x4bcc3
movl $0x709, %edx            # imm = 0x709
callq 0x30a0
leaq 0x167a4(%rip), %rdi     # 0x42710
leaq 0x1f8e7(%rip), %rsi     # 0x4b85a
leaq 0x1fd49(%rip), %rcx     # 0x4bcc3
movl $0x70a, %edx            # imm = 0x70A
callq 0x30a0
leaq 0x1fd92(%rip), %rdi     # 0x4bd1d
leaq 0x1f8c8(%rip), %rsi     # 0x4b85a
leaq 0x1fd2a(%rip), %rcx     # 0x4bcc3
movl $0x712, %edx            # imm = 0x712
callq 0x30a0
leaq 0x1fd7f(%rip), %rdi     # 0x4bd29
leaq 0x1f8a9(%rip), %rsi     # 0x4b85a
leaq 0x1fd0b(%rip), %rcx     # 0x4bcc3
movl $0x713, %edx            # imm = 0x713
callq 0x30a0
leaq 0x143bb(%rip), %rdi     # 0x40384
leaq 0x1f88a(%rip), %rsi     # 0x4b85a
leaq 0x1fc91(%rip), %rcx     # 0x4bc68
movl $0x775, %edx            # imm = 0x775
callq 0x30a0
leaq 0x1fd65(%rip), %rdi     # 0x4bd4d
leaq 0x1f86b(%rip), %rsi     # 0x4b85a
leaq 0x1fccd(%rip), %rcx     # 0x4bcc3
movl $0x719, %edx            # imm = 0x719
callq 0x30a0
leaq 0x1fd57(%rip), %rdi     # 0x4bd5e
leaq 0x1f84c(%rip), %rsi     # 0x4b85a
leaq 0x1fcae(%rip), %rcx     # 0x4bcc3
movl $0x71a, %edx            # imm = 0x71A
callq 0x30a0