// File: /workspace/github_c_makefile_star2_O1/Ihsoh[P]ilang/compiler/backend/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 BE_NODE_TYPE_CHAR: {
			return 1;
		}
		case BE_NODE_TYPE_INT8: {
			return 1;
		}
		case BE_NODE_TYPE_INT16: {
			return 2;
		}
		case BE_NODE_TYPE_INT32: {
			return 4;
		}
		case BE_NODE_TYPE_INT64: {
			return 8;
		}
		case BE_NODE_TYPE_UINT8: {
			return 1;
		}
		case BE_NODE_TYPE_UINT16: {
			return 2;
		}
		case BE_NODE_TYPE_UINT32: {
			return 4;
		}
		case BE_NODE_TYPE_UINT64: {
			return 8;
		}
		case BE_NODE_TYPE_FLOAT: {
			return 4;
		}
		case BE_NODE_TYPE_DOUBLE: {
			return 8;
		}
		case BE_NODE_TYPE_VA_LIST: {
			return 1;
		}
		case BE_NODE_TYPE_STRUCT: {
			return _calc_struct_type_align(ctx, node, node_type);
		}
		case BE_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 BE_NODE_TYPE_FUNC: {
			return 0;
		}
		case BE_NODE_TYPE_POINTER: {
			if (ctx->arch == BE_ARCH_32) {
				return 4;
			} else if (ctx->arch == BE_ARCH_64) {
				return 8;
			} else {
				assert(0);
				return 0;
			}
		}
		case BE_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 0x1fa3a(%rip), %rax     # 0x4d750
testq %rdx, %rdx
je 0x2df88
movl (%rdx), %ecx
cmpl $0x42f, %ecx            # imm = 0x42F
jg 0x2dd77
addl $0xfffffc00, %ecx       # imm = 0xFFFFFC00
cmpl $0x20, %ecx
ja 0x2dfc6
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
cmpl $0x2, 0x44(%rdx)
jne 0x2dfa7
movq 0x48(%rdx), %rcx
movq 0x8(%rcx), %rdx
testq %rdx, %rdx
jne 0x2dd16
leaq 0x20935(%rip), %rdi     # 0x4e694
leaq 0x2040a(%rip), %rsi     # 0x4e170
leaq 0x208c4(%rip), %rcx     # 0x4e631
movl $0x47d, %edx            # imm = 0x47D
callq 0x30a0
cmpl $0x430, %ecx            # imm = 0x430
je 0x2def7
cmpl $0x440, %ecx            # imm = 0x440
je 0x2defc
cmpl $0x4ff, %ecx            # imm = 0x4FF
jne 0x2dfc6
movl $0x1, %r15d
jmp 0x2df19
movl $0x4, %r15d
jmp 0x2df19
movl $0x2, %r15d
jmp 0x2df19
cmpl $0x1, 0x44(%rdx)
jne 0x2e023
movq 0x48(%rdx), %rax
movq (%rax), %r15
testq %r15, %r15
je 0x2e042
cmpl $0x200, (%r15)          # imm = 0x200
jne 0x2e061
movq 0x10(%r15), %rcx
movq %rbx, %rdi
movq %r14, %rsi
movl $0x2, %edx
callq 0x6d79
movq %rax, %r12
testq %rax, %rax
jne 0x2de10
movq 0x10(%r15), %rsi
leaq 0x2073b(%rip), %rdx     # 0x4e545
movq %rbx, %rdi
callq *0x50(%rbx)
movq 0x30(%r12), %rax
testq %rax, %rax
je 0x2e080
cmpl $0xd00, (%rax)          # imm = 0xD00
jne 0x2e09f
movl $0x1, %r15d
cmpb $0x0, 0x68(%rax)
jne 0x2df19
movq 0x38(%r12), %rcx
testq %rcx, %rcx
je 0x2e0dd
cmpl $0xd01, (%rcx)          # imm = 0xD01
jne 0x2e0fc
cmpl $0x0, 0x44(%rcx)
jle 0x2df19
xorl %edx, %edx
movq %rcx, -0x30(%rbp)
movq 0x48(%rcx), %rax
movq (%rax,%rdx,8), %r12
testq %r12, %r12
je 0x2dfe5
cmpl $0xc00, (%r12)          # imm = 0xC00
jne 0x2e004
movq %rdx, -0x38(%rbp)
cmpl $0x0, 0x44(%r12)
jle 0x2dedd
xorl %r13d, %r13d
movq 0x48(%r12), %rax
movq (%rax,%r13,8), %rax
testq %rax, %rax
je 0x2df4a
cmpl $0xc01, (%rax)          # imm = 0xC01
jne 0x2df69
cmpl $0x1, 0x44(%rax)
jle 0x2df2b
movq 0x48(%rax), %rax
movq 0x8(%rax), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2dcf8
cmpq %r15, %rax
cmovaq %rax, %r15
incq %r13
movslq 0x44(%r12), %rax
cmpq %rax, %r13
jl 0x2de92
movq -0x38(%rbp), %rdx
incq %rdx
movq -0x30(%rbp), %rcx
movslq 0x44(%rcx), %rax
cmpq %rax, %rdx
jl 0x2de64
jmp 0x2df19
xorl %r15d, %r15d
jmp 0x2df19
movl 0x30(%rbx), %eax
movl $0x4, %r15d
cmpl $0x1, %eax
je 0x2df19
cmpl $0x2, %eax
jne 0x2e0be
movl $0x8, %r15d
movq %r15, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x208c6(%rip), %rdi     # 0x4e7f8
leaq 0x20237(%rip), %rsi     # 0x4e170
leaq 0x20764(%rip), %rcx     # 0x4e6a4
movl $0x43b, %edx            # imm = 0x43B
callq 0x30a0
leaq 0x20871(%rip), %rdi     # 0x4e7c2
leaq 0x20218(%rip), %rsi     # 0x4e170
leaq 0x20745(%rip), %rcx     # 0x4e6a4
movl $0x439, %edx            # imm = 0x439
callq 0x30a0
leaq 0x20860(%rip), %rdi     # 0x4e7d0
leaq 0x201f9(%rip), %rsi     # 0x4e170
leaq 0x20726(%rip), %rcx     # 0x4e6a4
movl $0x43a, %edx            # imm = 0x43A
callq 0x30a0
leaq 0x228b1(%rip), %rdi     # 0x50840
leaq 0x201da(%rip), %rsi     # 0x4e170
leaq 0x20694(%rip), %rcx     # 0x4e631
movl $0x44f, %edx            # imm = 0x44F
callq 0x30a0
leaq 0x206ce(%rip), %rdi     # 0x4e67c
leaq 0x201bb(%rip), %rsi     # 0x4e170
leaq 0x20675(%rip), %rcx     # 0x4e631
movl $0x47a, %edx            # imm = 0x47A
callq 0x30a0
leaq 0x123c0(%rip), %rdi     # 0x4038d
leaq 0x2019c(%rip), %rsi     # 0x4e170
leaq 0x20656(%rip), %rcx     # 0x4e631
movl $0x492, %edx            # imm = 0x492
callq 0x30a0
leaq 0x20791(%rip), %rdi     # 0x4e77d
leaq 0x2017d(%rip), %rsi     # 0x4e170
leaq 0x206aa(%rip), %rcx     # 0x4e6a4
movl $0x435, %edx            # imm = 0x435
callq 0x30a0
leaq 0x2078a(%rip), %rdi     # 0x4e795
leaq 0x2015e(%rip), %rsi     # 0x4e170
leaq 0x2068b(%rip), %rcx     # 0x4e6a4
movl $0x436, %edx            # imm = 0x436
callq 0x30a0
leaq 0x206cc(%rip), %rdi     # 0x4e6f6
leaq 0x2013f(%rip), %rsi     # 0x4e170
leaq 0x2066c(%rip), %rcx     # 0x4e6a4
movl $0x41b, %edx            # imm = 0x41B
callq 0x30a0
leaq 0x1580d(%rip), %rdi     # 0x43856
leaq 0x20120(%rip), %rsi     # 0x4e170
leaq 0x2064d(%rip), %rcx     # 0x4e6a4
movl $0x41e, %edx            # imm = 0x41E
callq 0x30a0
leaq 0x1576c(%rip), %rdi     # 0x437d4
leaq 0x20101(%rip), %rsi     # 0x4e170
leaq 0x2062e(%rip), %rcx     # 0x4e6a4
movl $0x41f, %edx            # imm = 0x41F
callq 0x30a0
leaq 0x20687(%rip), %rdi     # 0x4e70e
leaq 0x200e2(%rip), %rsi     # 0x4e170
leaq 0x2060f(%rip), %rcx     # 0x4e6a4
movl $0x427, %edx            # imm = 0x427
callq 0x30a0
leaq 0x20674(%rip), %rdi     # 0x4e71a
leaq 0x200c3(%rip), %rsi     # 0x4e170
leaq 0x205f0(%rip), %rcx     # 0x4e6a4
movl $0x428, %edx            # imm = 0x428
callq 0x30a0
leaq 0x122c8(%rip), %rdi     # 0x4038d
leaq 0x200a4(%rip), %rsi     # 0x4e170
leaq 0x2055e(%rip), %rcx     # 0x4e631
movl $0x48a, %edx            # imm = 0x48A
callq 0x30a0
leaq 0x2065a(%rip), %rdi     # 0x4e73e
leaq 0x20085(%rip), %rsi     # 0x4e170
leaq 0x205b2(%rip), %rcx     # 0x4e6a4
movl $0x42e, %edx            # imm = 0x42E
callq 0x30a0
leaq 0x2064c(%rip), %rdi     # 0x4e74f
leaq 0x20066(%rip), %rsi     # 0x4e170
leaq 0x20593(%rip), %rcx     # 0x4e6a4
movl $0x42f, %edx            # imm = 0x42F
callq 0x30a0