// File: /workspace/github_c_makefile_star2_O0/Ihsoh[P]ilang/compiler/frontend/irgen.c
// Function: ir_type
static void _ir_type(
	IRGeneratorContext *ctx,
	ResizableString *rstr,
	ParserASTNode *node_type
) {
	assert(ctx);
	assert(rstr);
	assert(node_type);

	switch (node_type->type) {
		case FE_NODE_TYPE_CHAR: {
			rstr_append_with_cstr(rstr, "char");
			break;
		}
		case FE_NODE_TYPE_INT8: {
			rstr_append_with_cstr(rstr, "int8");
			break;
		}
		case FE_NODE_TYPE_UINT8: {
			rstr_append_with_cstr(rstr, "uint8");
			break;
		}
		case FE_NODE_TYPE_INT16: {
			rstr_append_with_cstr(rstr, "int16");
			break;
		}
		case FE_NODE_TYPE_UINT16: {
			rstr_append_with_cstr(rstr, "uint16");
			break;
		}
		case FE_NODE_TYPE_INT32: {
			rstr_append_with_cstr(rstr, "int32");
			break;
		}
		case FE_NODE_TYPE_UINT32: {
			rstr_append_with_cstr(rstr, "uint32");
			break;
		}
		case FE_NODE_TYPE_INT64: {
			rstr_append_with_cstr(rstr, "int64");
			break;
		}
		case FE_NODE_TYPE_UINT64: {
			rstr_append_with_cstr(rstr, "uint64");
			break;
		}
		case FE_NODE_TYPE_FLOAT: {
			rstr_append_with_cstr(rstr, "float");
			break;
		}
		case FE_NODE_TYPE_DOUBLE: {
			rstr_append_with_cstr(rstr, "double");
			break;
		}
		case FE_NODE_TYPE_VA_LIST: {
			rstr_append_with_cstr(rstr, "__va_list");
			break;
		}
		case FE_NODE_TYPE_STRUCT: {
			assert(node_type->nchilds == 1);

			ParserASTNode *node_id = node_type->childs[0];
			assert(node_id->type == FE_NODE_IDENTIFIER);

			rstr_append_with_cstr(rstr, "struct ");

			ResizableString rstr_id;
			rstr_init(&rstr_id);
			_ir_identifier_name(ctx, &rstr_id, node_id);
			rstr_append_with_rstr(rstr, &rstr_id);
			rstr_free(&rstr_id);
			break;
		}
		case FE_NODE_TYPE_ARRAY: {
			assert(node_type->nchilds == 2);

			ParserASTNode *node_array_dims = node_type->childs[0];
			assert(node_array_dims->type == FE_NODE_TYPE_ARRAY_DIMS);
			assert(node_array_dims->nchilds > 0);

			ParserASTNode *node_t = node_type->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 == FE_NODE_LITERAL_UINT);

				rstr_append_with_cstr(rstr, "[");
				rstr_append_with_raw(rstr, node_array_dim->token->content, node_array_dim->token->len);
				rstr_append_with_cstr(rstr, "]");
			}

			_ir_type(ctx, rstr, node_t);

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

			node_params = node_type->childs[0];
			assert(node_params->type == FE_NODE_FUNC_PARAMS);

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

			rstr_append_with_cstr(rstr, "function");

			rstr_append_with_cstr(rstr, "(");
			_ir_func_type_params(ctx, rstr, node_params);
			rstr_append_with_cstr(rstr, ")");

			if (node_t != NULL) {
				rstr_append_with_char(rstr, ':');
				_ir_type(ctx, rstr, node_t);
			}
			
			break;
		}
		case FE_NODE_TYPE_POINTER: {
			assert(node_type->nchilds == 1);
			ParserASTNode *node_t = node_type->childs[0];

			rstr_append_with_char(rstr, '*');

			_ir_type(ctx, rstr, node_t);
			break;
		}
		case FE_NODE_TYPE_VOID: {
			// 什么都不做。
			break;
		}
		default: {
			assert(0);
			break;
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x10cbd
jmp 0x10cdc
leaq 0x6b892(%rip), %rdi     # 0x7c556
leaq 0x636c9(%rip), %rsi     # 0x74394
movl $0xdb, %edx
leaq 0x63a14(%rip), %rcx     # 0x746eb
callq 0x30a0
cmpq $0x0, -0x10(%rbp)
je 0x10ce5
jmp 0x10d04
leaq 0x61e22(%rip), %rdi     # 0x72b0e
leaq 0x636a1(%rip), %rsi     # 0x74394
movl $0xdc, %edx
leaq 0x639ec(%rip), %rcx     # 0x746eb
callq 0x30a0
cmpq $0x0, -0x18(%rbp)
je 0x10d0d
jmp 0x10d2c
leaq 0x63a1f(%rip), %rdi     # 0x74733
leaq 0x63679(%rip), %rsi     # 0x74394
movl $0xdd, %edx
leaq 0x639c4(%rip), %rcx     # 0x746eb
callq 0x30a0
movq -0x18(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x6c(%rbp)
subl $0x400, %eax            # imm = 0x400
je 0x10e45
jmp 0x10d42
movl -0x6c(%rbp), %eax
subl $0x401, %eax            # imm = 0x401
je 0x10e5a
jmp 0x10d52
movl -0x6c(%rbp), %eax
subl $0x402, %eax            # imm = 0x402
je 0x10e84
jmp 0x10d62
movl -0x6c(%rbp), %eax
subl $0x403, %eax            # imm = 0x403
je 0x10eae
jmp 0x10d72
movl -0x6c(%rbp), %eax
subl $0x404, %eax            # imm = 0x404
je 0x10ed8
jmp 0x10d82
movl -0x6c(%rbp), %eax
subl $0x405, %eax            # imm = 0x405
je 0x10e6f
jmp 0x10d92
movl -0x6c(%rbp), %eax
subl $0x406, %eax            # imm = 0x406
je 0x10e99
jmp 0x10da2
movl -0x6c(%rbp), %eax
subl $0x407, %eax            # imm = 0x407
je 0x10ec3
jmp 0x10db2
movl -0x6c(%rbp), %eax
subl $0x408, %eax            # imm = 0x408
je 0x10eed
jmp 0x10dc2
movl -0x6c(%rbp), %eax
subl $0x409, %eax            # imm = 0x409
je 0x10f02
jmp 0x10dd2
movl -0x6c(%rbp), %eax
subl $0x40a, %eax            # imm = 0x40A
je 0x10f17
jmp 0x10de2
movl -0x6c(%rbp), %eax
subl $0x40b, %eax            # imm = 0x40B
je 0x10f2c
jmp 0x10df2
movl -0x6c(%rbp), %eax
subl $0x410, %eax            # imm = 0x410
je 0x10f41
jmp 0x10e02
movl -0x6c(%rbp), %eax
subl $0x420, %eax            # imm = 0x420
je 0x10fed
jmp 0x10e12
movl -0x6c(%rbp), %eax
subl $0x430, %eax            # imm = 0x430
je 0x1114b
jmp 0x10e22
movl -0x6c(%rbp), %eax
subl $0x440, %eax            # imm = 0x440
je 0x1124f
jmp 0x10e32
movl -0x6c(%rbp), %eax
subl $0x4ff, %eax            # imm = 0x4FF
je 0x112aa
jmp 0x112ac
movq -0x10(%rbp), %rdi
leaq 0x638ed(%rip), %rsi     # 0x7473d
callq 0x8d70
jmp 0x112cb
movq -0x10(%rbp), %rdi
leaq 0x638de(%rip), %rsi     # 0x74743
callq 0x8d70
jmp 0x112cb
movq -0x10(%rbp), %rdi
leaq 0x638c8(%rip), %rsi     # 0x74742
callq 0x8d70
jmp 0x112cb
movq -0x10(%rbp), %rdi
leaq 0x638ba(%rip), %rsi     # 0x74749
callq 0x8d70
jmp 0x112cb
movq -0x10(%rbp), %rdi
leaq 0x638a4(%rip), %rsi     # 0x74748
callq 0x8d70
jmp 0x112cb
movq -0x10(%rbp), %rdi
leaq 0x63897(%rip), %rsi     # 0x74750
callq 0x8d70
jmp 0x112cb
movq -0x10(%rbp), %rdi
leaq 0x63881(%rip), %rsi     # 0x7474f
callq 0x8d70
jmp 0x112cb
movq -0x10(%rbp), %rdi
leaq 0x63874(%rip), %rsi     # 0x74757
callq 0x8d70
jmp 0x112cb
movq -0x10(%rbp), %rdi
leaq 0x6385e(%rip), %rsi     # 0x74756
callq 0x8d70
jmp 0x112cb
movq -0x10(%rbp), %rdi
leaq 0x63850(%rip), %rsi     # 0x7475d
callq 0x8d70
jmp 0x112cb
movq -0x10(%rbp), %rdi
leaq 0x63841(%rip), %rsi     # 0x74763
callq 0x8d70
jmp 0x112cb
movq -0x10(%rbp), %rdi
leaq 0x63833(%rip), %rsi     # 0x7476a
callq 0x8d70
jmp 0x112cb
movq -0x18(%rbp), %rax
cmpl $0x1, 0x44(%rax)
jne 0x10f4d
jmp 0x10f6c
leaq 0x63820(%rip), %rdi     # 0x74774
leaq 0x63439(%rip), %rsi     # 0x74394
movl $0x111, %edx            # imm = 0x111
leaq 0x63784(%rip), %rcx     # 0x746eb
callq 0x30a0
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x200, (%rax)          # imm = 0x200
jne 0x10f89
jmp 0x10fa8
leaq 0x637fc(%rip), %rdi     # 0x7478c
leaq 0x633fd(%rip), %rsi     # 0x74394
movl $0x114, %edx            # imm = 0x114
leaq 0x63748(%rip), %rcx     # 0x746eb
callq 0x30a0
movq -0x10(%rbp), %rdi
leaq 0x65134(%rip), %rsi     # 0x760e7
callq 0x8d70
leaq -0x30(%rbp), %rdi
callq 0x8c90
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq -0x30(%rbp), %rsi
callq 0x10be0
movq -0x10(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x9100
leaq -0x30(%rbp), %rdi
callq 0x9310
jmp 0x112cb
movq -0x18(%rbp), %rax
cmpl $0x2, 0x44(%rax)
jne 0x10ff9
jmp 0x11018
leaq 0x63848(%rip), %rdi     # 0x74848
leaq 0x6338d(%rip), %rsi     # 0x74394
movl $0x120, %edx            # imm = 0x120
leaq 0x636d8(%rip), %rcx     # 0x746eb
callq 0x30a0
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpl $0x421, (%rax)          # imm = 0x421
jne 0x11035
jmp 0x11054
leaq 0x63774(%rip), %rdi     # 0x747b0
leaq 0x63351(%rip), %rsi     # 0x74394
movl $0x123, %edx            # imm = 0x123
leaq 0x6369c(%rip), %rcx     # 0x746eb
callq 0x30a0
movq -0x38(%rbp), %rax
cmpl $0x0, 0x44(%rax)
jle 0x11060
jmp 0x1107f
leaq 0x6377a(%rip), %rdi     # 0x747e1
leaq 0x63326(%rip), %rsi     # 0x74394
movl $0x124, %edx            # imm = 0x124
leaq 0x63671(%rip), %rcx     # 0x746eb
callq 0x30a0
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x40(%rbp)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
movq -0x38(%rbp), %rcx
cmpl 0x44(%rcx), %eax
jge 0x11135
movq -0x38(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x44(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
cmpl $0x300, (%rax)          # imm = 0x300
jne 0x110c8
jmp 0x110e7
leaq 0x6372f(%rip), %rdi     # 0x747fe
leaq 0x632be(%rip), %rsi     # 0x74394
movl $0x12a, %edx            # imm = 0x12A
leaq 0x63609(%rip), %rcx     # 0x746eb
callq 0x30a0
movq -0x10(%rbp), %rdi
leaq 0x63739(%rip), %rsi     # 0x7482b
callq 0x8d70
movq -0x10(%rbp), %rdi
movq -0x50(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rsi
movq -0x50(%rbp), %rax
movq 0x10(%rax), %rax
movl 0x4(%rax), %edx
callq 0x8f90
movq -0x10(%rbp), %rdi
leaq 0x6dffb(%rip), %rsi     # 0x7f11d
callq 0x8d70
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x11096
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x40(%rbp), %rdx
callq 0x10ca0
jmp 0x112cb
movq -0x18(%rbp), %rax
cmpl $0x1, 0x44(%rax)
je 0x1115f
movq -0x18(%rbp), %rax
cmpl $0x2, 0x44(%rax)
jne 0x11161
jmp 0x11180
leaq 0x636c5(%rip), %rdi     # 0x7482d
leaq 0x63225(%rip), %rsi     # 0x74394
movl $0x136, %edx            # imm = 0x136
leaq 0x63570(%rip), %rcx     # 0x746eb
callq 0x30a0
movq $0x0, -0x58(%rbp)
movq $0x0, -0x60(%rbp)
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
cmpl $0xa01, (%rax)          # imm = 0xA01
jne 0x111ad
jmp 0x111cc
leaq 0x636ac(%rip), %rdi     # 0x74860
leaq 0x631d9(%rip), %rsi     # 0x74394
movl $0x13b, %edx            # imm = 0x13B
leaq 0x63524(%rip), %rcx     # 0x746eb
callq 0x30a0
movq -0x18(%rbp), %rax
cmpl $0x2, 0x44(%rax)
jne 0x111e6
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x63698(%rip), %rsi     # 0x74889
callq 0x8d70
movq -0x10(%rbp), %rdi
leaq 0x6685c(%rip), %rsi     # 0x77a5d
callq 0x8d70
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x58(%rbp), %rdx
callq 0x13110
movq -0x10(%rbp), %rdi
leaq 0x65d7c(%rip), %rsi     # 0x76f9e
callq 0x8d70
cmpq $0x0, -0x60(%rbp)
je 0x1124d
movq -0x10(%rbp), %rdi
movl $0x3a, %esi
callq 0x8ea0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x60(%rbp), %rdx
callq 0x10ca0
jmp 0x112cb
movq -0x18(%rbp), %rax
cmpl $0x1, 0x44(%rax)
jne 0x1125b
jmp 0x1127a
leaq 0x63512(%rip), %rdi     # 0x74774
leaq 0x6312b(%rip), %rsi     # 0x74394
movl $0x14f, %edx            # imm = 0x14F
leaq 0x63476(%rip), %rcx     # 0x746eb
callq 0x30a0
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rdi
movl $0x2a, %esi
callq 0x8ea0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x68(%rbp), %rdx
callq 0x10ca0
jmp 0x112cb
jmp 0x112cb
leaq 0x611a8(%rip), %rdi     # 0x7245b
leaq 0x630da(%rip), %rsi     # 0x74394
movl $0x15c, %edx            # imm = 0x15C
leaq 0x63425(%rip), %rcx     # 0x746eb
callq 0x30a0
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)