// File: /workspace/github_c_makefile_star2_O0/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
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x4f0bd
jmp 0x4f0dc
leaq 0x3109d(%rip), %rdi     # 0x80161
leaq 0x337b5(%rip), %rsi     # 0x82880
movl $0x44d, %edx            # imm = 0x44D
leaq 0x33c99(%rip), %rcx     # 0x82d70
callq 0x30a0
cmpq $0x0, -0x18(%rbp)
je 0x4f0e5
jmp 0x4f104
leaq 0x27470(%rip), %rdi     # 0x7655c
leaq 0x3378d(%rip), %rsi     # 0x82880
movl $0x44e, %edx            # imm = 0x44E
leaq 0x33c71(%rip), %rcx     # 0x82d70
callq 0x30a0
cmpq $0x0, -0x20(%rbp)
je 0x4f10d
jmp 0x4f12c
leaq 0x3612a(%rip), %rdi     # 0x8523e
leaq 0x33765(%rip), %rsi     # 0x82880
movl $0x44f, %edx            # imm = 0x44F
leaq 0x33c49(%rip), %rcx     # 0x82d70
callq 0x30a0
movq -0x20(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x2c(%rbp)
subl $0x400, %eax            # imm = 0x400
je 0x4f245
jmp 0x4f142
movl -0x2c(%rbp), %eax
subl $0x401, %eax            # imm = 0x401
je 0x4f252
jmp 0x4f152
movl -0x2c(%rbp), %eax
subl $0x402, %eax            # imm = 0x402
je 0x4f25f
jmp 0x4f162
movl -0x2c(%rbp), %eax
subl $0x403, %eax            # imm = 0x403
je 0x4f26c
jmp 0x4f172
movl -0x2c(%rbp), %eax
subl $0x404, %eax            # imm = 0x404
je 0x4f279
jmp 0x4f182
movl -0x2c(%rbp), %eax
subl $0x405, %eax            # imm = 0x405
je 0x4f286
jmp 0x4f192
movl -0x2c(%rbp), %eax
subl $0x406, %eax            # imm = 0x406
je 0x4f293
jmp 0x4f1a2
movl -0x2c(%rbp), %eax
subl $0x407, %eax            # imm = 0x407
je 0x4f2a0
jmp 0x4f1b2
movl -0x2c(%rbp), %eax
subl $0x408, %eax            # imm = 0x408
je 0x4f2ad
jmp 0x4f1c2
movl -0x2c(%rbp), %eax
subl $0x409, %eax            # imm = 0x409
je 0x4f2ba
jmp 0x4f1d2
movl -0x2c(%rbp), %eax
subl $0x40a, %eax            # imm = 0x40A
je 0x4f2c7
jmp 0x4f1e2
movl -0x2c(%rbp), %eax
subl $0x40b, %eax            # imm = 0x40B
je 0x4f2d4
jmp 0x4f1f2
movl -0x2c(%rbp), %eax
subl $0x410, %eax            # imm = 0x410
je 0x4f2e1
jmp 0x4f202
movl -0x2c(%rbp), %eax
subl $0x420, %eax            # imm = 0x420
je 0x4f2fb
jmp 0x4f212
movl -0x2c(%rbp), %eax
subl $0x430, %eax            # imm = 0x430
je 0x4f375
jmp 0x4f222
movl -0x2c(%rbp), %eax
subl $0x440, %eax            # imm = 0x440
je 0x4f37f
jmp 0x4f232
movl -0x2c(%rbp), %eax
subl $0x4ff, %eax            # imm = 0x4FF
je 0x4f3c6
jmp 0x4f3d0
movq $0x1, -0x8(%rbp)
jmp 0x4f3ef
movq $0x1, -0x8(%rbp)
jmp 0x4f3ef
movq $0x2, -0x8(%rbp)
jmp 0x4f3ef
movq $0x4, -0x8(%rbp)
jmp 0x4f3ef
movq $0x8, -0x8(%rbp)
jmp 0x4f3ef
movq $0x1, -0x8(%rbp)
jmp 0x4f3ef
movq $0x2, -0x8(%rbp)
jmp 0x4f3ef
movq $0x4, -0x8(%rbp)
jmp 0x4f3ef
movq $0x8, -0x8(%rbp)
jmp 0x4f3ef
movq $0x4, -0x8(%rbp)
jmp 0x4f3ef
movq $0x8, -0x8(%rbp)
jmp 0x4f3ef
movq $0x1, -0x8(%rbp)
jmp 0x4f3ef
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x50140
movq %rax, -0x8(%rbp)
jmp 0x4f3ef
movq -0x20(%rbp), %rax
cmpl $0x2, 0x44(%rax)
jne 0x4f307
jmp 0x4f326
leaq 0x33aad(%rip), %rdi     # 0x82dbb
leaq 0x3356b(%rip), %rsi     # 0x82880
movl $0x47a, %edx            # imm = 0x47A
leaq 0x33a4f(%rip), %rcx     # 0x82d70
callq 0x30a0
movq -0x20(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x4f33f
jmp 0x4f35e
leaq 0x33a8d(%rip), %rdi     # 0x82dd3
leaq 0x33533(%rip), %rsi     # 0x82880
movl $0x47d, %edx            # imm = 0x47D
leaq 0x33a17(%rip), %rcx     # 0x82d70
callq 0x30a0
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x4f0a0
movq %rax, -0x8(%rbp)
jmp 0x4f3ef
movq $0x0, -0x8(%rbp)
jmp 0x4f3ef
movq -0x10(%rbp), %rax
cmpl $0x1, 0x30(%rax)
jne 0x4f393
movq $0x4, -0x8(%rbp)
jmp 0x4f3ef
movq -0x10(%rbp), %rax
cmpl $0x2, 0x30(%rax)
jne 0x4f3a7
movq $0x8, -0x8(%rbp)
jmp 0x4f3ef
leaq 0x240ac(%rip), %rdi     # 0x7345a
leaq 0x334cb(%rip), %rsi     # 0x82880
movl $0x48a, %edx            # imm = 0x48A
leaq 0x339af(%rip), %rcx     # 0x82d70
callq 0x30a0
movq $0x1, -0x8(%rbp)
jmp 0x4f3ef
leaq 0x24083(%rip), %rdi     # 0x7345a
leaq 0x334a2(%rip), %rsi     # 0x82880
movl $0x492, %edx            # imm = 0x492
leaq 0x33986(%rip), %rcx     # 0x82d70
callq 0x30a0
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)