// File: /workspace/github_c_makefile_star2_O2/Ihsoh[P]ilang/compiler/backend/semantics.c
// Function: print_type_node
static void _print_type_node(ParserASTNode *node, FILE *file) {
	assert(node);
	assert(file);

	switch (node->type) {
		case BE_NODE_TYPE_CHAR: {
			assert(node->nchilds == 0);
			fputs("char", file);
			break;
		}
		case BE_NODE_TYPE_INT8: {
			assert(node->nchilds == 0);
			fputs("int8", file);
			break;
		}
		case BE_NODE_TYPE_UINT8: {
			assert(node->nchilds == 0);
			fputs("uint8", file);
			break;
		}
		case BE_NODE_TYPE_INT16: {
			assert(node->nchilds == 0);
			fputs("int16", file);
			break;
		}
		case BE_NODE_TYPE_UINT16: {
			assert(node->nchilds == 0);
			fputs("uint16", file);
			break;
		}
		case BE_NODE_TYPE_INT32: {
			assert(node->nchilds == 0);
			fputs("int32", file);
			break;
		}
		case BE_NODE_TYPE_UINT32: {
			assert(node->nchilds == 0);
			fputs("uint32", file);
			break;
		}
		case BE_NODE_TYPE_INT64: {
			assert(node->nchilds == 0);
			fputs("int64", file);
			break;
		}
		case BE_NODE_TYPE_UINT64: {
			assert(node->nchilds == 0);
			fputs("uint64", file);
			break;
		}
		case BE_NODE_TYPE_FLOAT: {
			assert(node->nchilds == 0);
			fputs("float", file);
			break;
		}
		case BE_NODE_TYPE_DOUBLE: {
			assert(node->nchilds == 0);
			fputs("double", file);
			break;
		}
		case BE_NODE_TYPE_STRUCT: {
			assert(node->nchilds == 1);

			fputs("struct ", file);

			ParserASTNode *node_id = node->childs[0];
			assert(node_id->type == BE_NODE_IDENTIFIER);

			cmn_print_token(node_id->token, file);
			break;
		}
		case BE_NODE_TYPE_ARRAY: {
			assert(node->nchilds == 2);
			ParserASTNode *node_array_dims = node->childs[0];
			assert(node_array_dims->type == BE_NODE_TYPE_ARRAY_DIMS);
			ParserASTNode *node_t = node->childs[1];

			for (int i = 0; i < node_array_dims->nchilds; i++) {
				ParserASTNode *node_array_dim = node_array_dims->childs[i];
				assert(node_array_dim->type == BE_NODE_LITERAL_UINT);
				fputc('[', file);
				cmn_print_token(node_array_dim->token, file);
				fputc(']', file);
			}

			_print_type_node(node_t, file);

			break;
		}
		case BE_NODE_TYPE_FUNC: {
			assert(node->nchilds == 1 || node->nchilds == 2);
			ParserASTNode *node_params = NULL;
			ParserASTNode *node_t = NULL;

			node_params = node->childs[0];
			if (node->nchilds == 2) {
				node_t = node->childs[1];
			}

			_print_func_params(node_params, file);

			if (node_t != NULL) {
				fputc(':', file);
				_print_type_node(node_t, file);
			}
			break;
		}
		case BE_NODE_TYPE_POINTER: {
			assert(node->nchilds == 1);
			ParserASTNode *node_t = node->childs[0];

			fputc('*', file);

			_print_type_node(node_t, file);
			break;
		}
		case BE_NODE_TYPE_VOID: {
			assert(node->nchilds == 0);
			fputs("void", file);
			break;
		}
		default: {
			assert(0);
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
testq %r14, %r14
je 0x31821
movl (%r14), %eax
cmpl $0x420, %eax            # imm = 0x420
je 0x3145a
cmpl $0x430, %eax            # imm = 0x430
je 0x314c6
cmpl $0x440, %eax            # imm = 0x440
jne 0x31623
cmpl $0x1, 0x44(%r14)
jne 0x3187e
movq 0x48(%r14), %rax
movq (%rax), %r14
pushq $0x2a
popq %rdi
jmp 0x31616
cmpl $0x2, 0x44(%r14)
jne 0x318db
movq 0x48(%r14), %rax
movq (%rax), %r15
cmpl $0x421, (%r15)          # imm = 0x421
jne 0x318bc
movq 0x8(%rax), %r14
xorl %r12d, %r12d
movslq 0x44(%r15), %rax
cmpq %rax, %r12
jge 0x31417
movq 0x48(%r15), %rax
movq (%rax,%r12,8), %r13
cmpl $0x300, (%r13)          # imm = 0x300
jne 0x317b2
pushq $0x5b
popq %rdi
movq %rbx, %rsi
callq 0x30c0
movq 0x10(%r13), %rdi
movq %rbx, %rsi
callq 0x3a60
pushq $0x5d
popq %rdi
movq %rbx, %rsi
callq 0x30c0
incq %r12
jmp 0x31480
movl 0x44(%r14), %ecx
leal -0x1(%rcx), %eax
cmpl $0x2, %eax
jae 0x3185f
movq 0x48(%r14), %rax
cmpl $0x2, %ecx
jne 0x314e5
movq 0x8(%rax), %r14
jmp 0x314e8
xorl %r14d, %r14d
movq (%rax), %r15
testq %r15, %r15
je 0x3189d
cmpl $0x0, 0x44(%r15)
jle 0x3160a
movq 0x48(%r15), %rax
movq (%rax), %rax
cmpl $0xa02, (%rax)          # imm = 0xA02
jne 0x31903
cmpl $0x2, 0x44(%rax)
jne 0x318fa
movq 0x48(%rax), %rax
movq (%rax), %rcx
cmpl $0x200, (%rcx)          # imm = 0x200
jne 0x31922
movq 0x8(%rax), %r12
movq 0x10(%rcx), %rdi
movq %rbx, %rsi
callq 0x3a60
leaq 0x1a931(%rip), %rdi     # 0x4be77
movq %rbx, %rsi
callq 0x30b0
movq %r12, %rdi
movq %rbx, %rsi
callq 0x31403
pushq $0x1
popq %r12
movslq 0x44(%r15), %rax
cmpq %rax, %r12
jge 0x3160a
movq 0x48(%r15), %rax
movq (%rax,%r12,8), %r13
movl (%r13), %eax
andl $-0x2, %eax
cmpl $0xa02, %eax            # imm = 0xA02
jne 0x317d1
leaq 0x1a954(%rip), %rdi     # 0x4bedf
movq %rbx, %rsi
callq 0x30b0
movl (%r13), %eax
cmpl $0xa02, %eax            # imm = 0xA02
je 0x315ba
cmpl $0xa03, %eax            # imm = 0xA03
jne 0x31802
leaq 0x13cf6(%rip), %rdi     # 0x452a6
movq %rbx, %rsi
callq 0x30b0
jmp 0x31602
cmpl $0x2, 0x44(%r13)
jne 0x317f0
movq 0x48(%r13), %rax
movq (%rax), %rcx
cmpl $0x200, (%rcx)          # imm = 0x200
jne 0x317f9
movq 0x8(%rax), %r13
movq 0x10(%rcx), %rdi
movq %rbx, %rsi
callq 0x3a60
leaq 0x1a888(%rip), %rdi     # 0x4be77
movq %rbx, %rsi
callq 0x30b0
movq %r13, %rdi
movq %rbx, %rsi
callq 0x31403
incq %r12
jmp 0x3155d
pushq $0x3a
popq %rdi
testq %r14, %r14
je 0x317a3
movq %rbx, %rsi
callq 0x30c0
jmp 0x31417
leal -0x400(%rax), %ecx
cmpl $0x10, %ecx
ja 0x31655
leaq 0x17a2b(%rip), %rax     # 0x49060
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
cmpl $0x0, 0x44(%r14)
jne 0x31941
leaq 0x1390b(%rip), %rdi     # 0x44f5b
jmp 0x3178d
cmpl $0x4ff, %eax            # imm = 0x4FF
jne 0x31840
cmpl $0x0, 0x44(%r14)
jne 0x31ad4
leaq 0x1a7a2(%rip), %rdi     # 0x4be14
jmp 0x3178d
cmpl $0x0, 0x44(%r14)
jne 0x31960
leaq 0x138f8(%rip), %rdi     # 0x44f81
jmp 0x3178d
cmpl $0x1, 0x44(%r14)
jne 0x3197f
leaq 0x1a76c(%rip), %rdi     # 0x4be0c
movq %rbx, %rsi
callq 0x30b0
movq 0x48(%r14), %rax
movq (%rax), %rax
cmpl $0x200, (%rax)          # imm = 0x200
jne 0x31ab5
movq 0x10(%rax), %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3a60
cmpl $0x0, 0x44(%r14)
jne 0x3199e
leaq 0x13879(%rip), %rdi     # 0x44f60
jmp 0x3178d
cmpl $0x0, 0x44(%r14)
jne 0x319bd
leaq 0x1387d(%rip), %rdi     # 0x44f7b
jmp 0x3178d
cmpl $0x0, 0x44(%r14)
jne 0x319dc
leaq 0x1385f(%rip), %rdi     # 0x44f74
jmp 0x3178d
cmpl $0x0, 0x44(%r14)
jne 0x319fb
leaq 0x13845(%rip), %rdi     # 0x44f6e
jmp 0x3178d
cmpl $0x0, 0x44(%r14)
jne 0x31a1a
leaq 0x13830(%rip), %rdi     # 0x44f6d
jmp 0x3178d
cmpl $0x0, 0x44(%r14)
jne 0x31a39
leaq 0x13815(%rip), %rdi     # 0x44f66
jmp 0x3178d
cmpl $0x0, 0x44(%r14)
jne 0x31a58
leaq 0x13802(%rip), %rdi     # 0x44f67
jmp 0x3178d
cmpl $0x0, 0x44(%r14)
jne 0x31a77
leaq 0x137e8(%rip), %rdi     # 0x44f61
jmp 0x3178d
cmpl $0x0, 0x44(%r14)
jne 0x31a96
leaq 0x137e8(%rip), %rdi     # 0x44f75
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x30b0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x17de7(%rip), %rdi     # 0x495a0
leaq 0x179b0(%rip), %rsi     # 0x49170
leaq 0x1a616(%rip), %rcx     # 0x4bddd
movl $0x18eb, %edx           # imm = 0x18EB
callq 0x30a0
leaq 0x1a6a1(%rip), %rdi     # 0x4be79
leaq 0x17991(%rip), %rsi     # 0x49170
leaq 0x1a633(%rip), %rcx     # 0x4be19
movl $0x1891, %edx           # imm = 0x1891
callq 0x30a0
leaq 0x17e21(%rip), %rdi     # 0x49618
jmp 0x31809
leaq 0xcfc6(%rip), %rdi      # 0x3e7c6
jmp 0x31809
leaq 0x9b60(%rip), %rdi      # 0x3b369
leaq 0x17960(%rip), %rsi     # 0x49170
leaq 0x1a602(%rip), %rcx     # 0x4be19
movl $0x1895, %edx           # imm = 0x1895
callq 0x30a0
leaq 0xc6e2(%rip), %rdi      # 0x3df0a
leaq 0x17941(%rip), %rsi     # 0x49170
leaq 0x1a5a7(%rip), %rcx     # 0x4bddd
movl $0x189d, %edx           # imm = 0x189D
callq 0x30a0
leaq 0x9b22(%rip), %rdi      # 0x3b369
leaq 0x17922(%rip), %rsi     # 0x49170
leaq 0x1a588(%rip), %rcx     # 0x4bddd
movl $0x1916, %edx           # imm = 0x1916
callq 0x30a0
leaq 0x17d89(%rip), %rdi     # 0x495ef
leaq 0x17903(%rip), %rsi     # 0x49170
leaq 0x1a569(%rip), %rcx     # 0x4bddd
movl $0x18f6, %edx           # imm = 0x18F6
callq 0x30a0
leaq 0xd34e(%rip), %rdi      # 0x3ebd3
leaq 0x178e4(%rip), %rsi     # 0x49170
leaq 0x1a54a(%rip), %rcx     # 0x4bddd
movl $0x1908, %edx           # imm = 0x1908
callq 0x30a0
leaq 0xc666(%rip), %rdi      # 0x3df0a
leaq 0x178c5(%rip), %rsi     # 0x49170
leaq 0x1a567(%rip), %rcx     # 0x4be19
movl $0x186c, %edx           # imm = 0x186C
callq 0x30a0
leaq 0x17cac(%rip), %rdi     # 0x4956f
leaq 0x178a6(%rip), %rsi     # 0x49170
leaq 0x1a50c(%rip), %rcx     # 0x4bddd
movl $0x18e6, %edx           # imm = 0x18E6
callq 0x30a0
leaq 0x17d23(%rip), %rdi     # 0x49605
leaq 0x17887(%rip), %rsi     # 0x49170
leaq 0x1a4ed(%rip), %rcx     # 0x4bddd
movl $0x18e4, %edx           # imm = 0x18E4
callq 0x30a0
leaq 0x17d17(%rip), %rdi     # 0x49618
jmp 0x31929
leaq 0x1a540(%rip), %rdi     # 0x4be4a
leaq 0x1785f(%rip), %rsi     # 0x49170
leaq 0x1a501(%rip), %rcx     # 0x4be19
movl $0x1871, %edx           # imm = 0x1871
callq 0x30a0
leaq 0xce9d(%rip), %rdi      # 0x3e7c6
leaq 0x17840(%rip), %rsi     # 0x49170
leaq 0x1a4e2(%rip), %rcx     # 0x4be19
movl $0x188c, %edx           # imm = 0x188C
callq 0x30a0
leaq 0x17bea(%rip), %rdi     # 0x49532
leaq 0x17821(%rip), %rsi     # 0x49170
leaq 0x1a487(%rip), %rcx     # 0x4bddd
movl $0x18a2, %edx           # imm = 0x18A2
callq 0x30a0
leaq 0x17bcb(%rip), %rdi     # 0x49532
leaq 0x17802(%rip), %rsi     # 0x49170
leaq 0x1a468(%rip), %rcx     # 0x4bddd
movl $0x18d4, %edx           # imm = 0x18D4
callq 0x30a0
leaq 0xd24d(%rip), %rdi      # 0x3ebd3
leaq 0x177e3(%rip), %rsi     # 0x49170
leaq 0x1a449(%rip), %rcx     # 0x4bddd
movl $0x18d9, %edx           # imm = 0x18D9
callq 0x30a0
leaq 0x17b8d(%rip), %rdi     # 0x49532
leaq 0x177c4(%rip), %rsi     # 0x49170
leaq 0x1a42a(%rip), %rcx     # 0x4bddd
movl $0x18ac, %edx           # imm = 0x18AC
callq 0x30a0
leaq 0x17b6e(%rip), %rdi     # 0x49532
leaq 0x177a5(%rip), %rsi     # 0x49170
leaq 0x1a40b(%rip), %rcx     # 0x4bddd
movl $0x18cf, %edx           # imm = 0x18CF
callq 0x30a0
leaq 0x17b4f(%rip), %rdi     # 0x49532
leaq 0x17786(%rip), %rsi     # 0x49170
leaq 0x1a3ec(%rip), %rcx     # 0x4bddd
movl $0x18ca, %edx           # imm = 0x18CA
callq 0x30a0
leaq 0x17b30(%rip), %rdi     # 0x49532
leaq 0x17767(%rip), %rsi     # 0x49170
leaq 0x1a3cd(%rip), %rcx     # 0x4bddd
movl $0x18bb, %edx           # imm = 0x18BB
callq 0x30a0
leaq 0x17b11(%rip), %rdi     # 0x49532
leaq 0x17748(%rip), %rsi     # 0x49170
leaq 0x1a3ae(%rip), %rcx     # 0x4bddd
movl $0x18c0, %edx           # imm = 0x18C0
callq 0x30a0
leaq 0x17af2(%rip), %rdi     # 0x49532
leaq 0x17729(%rip), %rsi     # 0x49170
leaq 0x1a38f(%rip), %rcx     # 0x4bddd
movl $0x18b6, %edx           # imm = 0x18B6
callq 0x30a0
leaq 0x17ad3(%rip), %rdi     # 0x49532
leaq 0x1770a(%rip), %rsi     # 0x49170
leaq 0x1a370(%rip), %rcx     # 0x4bddd
movl $0x18b1, %edx           # imm = 0x18B1
callq 0x30a0
leaq 0x17ab4(%rip), %rdi     # 0x49532
leaq 0x176eb(%rip), %rsi     # 0x49170
leaq 0x1a351(%rip), %rcx     # 0x4bddd
movl $0x18a7, %edx           # imm = 0x18A7
callq 0x30a0
leaq 0x17a95(%rip), %rdi     # 0x49532
leaq 0x176cc(%rip), %rsi     # 0x49170
leaq 0x1a332(%rip), %rcx     # 0x4bddd
movl $0x18c5, %edx           # imm = 0x18C5
callq 0x30a0
leaq 0xcd0a(%rip), %rdi      # 0x3e7c6
leaq 0x176ad(%rip), %rsi     # 0x49170
leaq 0x1a313(%rip), %rcx     # 0x4bddd
movl $0x18de, %edx           # imm = 0x18DE
callq 0x30a0
leaq 0x17a57(%rip), %rdi     # 0x49532
leaq 0x1768e(%rip), %rsi     # 0x49170
leaq 0x1a2f4(%rip), %rcx     # 0x4bddd
movl $0x1911, %edx           # imm = 0x1911
callq 0x30a0
nop