// File: /workspace/github_c_makefile_star2_O0/Ihsoh[P]ilang/compiler/frontend/irgen_c.c
// Function: ir_func
static void _ir_func(IRGeneratorCContext *ctx, ParserASTNode *node) {
	assert(ctx);
	assert(node);
	assert(node->type == FE_NODE_FUNC);

	ParserASTNode *node_identifier = NULL;
	ParserASTNode *node_func_params = NULL;
	ParserASTNode *node_return_type = NULL;
	ParserASTNode *node_body = NULL;

	int nchilds = node->nchilds;
	if (nchilds == 3) {
		node_identifier = node->childs[0];
		node_func_params = node->childs[1];
		node_body = node->childs[2];
	} else if (nchilds == 4) {
		node_identifier = node->childs[0];
		node_func_params = node->childs[1];
		node_return_type = node->childs[2];
		node_body = node->childs[3];
	} else {
		assert(0);
	}
	assert(node_identifier->type == FE_NODE_IDENTIFIER);
	assert(node_func_params->type == FE_NODE_FUNC_PARAMS);

	_OUT_CSTR(ctx, "\n");

	if (node_return_type == NULL) {
		_OUT_CSTR(ctx, "void ");

		_OUT_STR(ctx, node_identifier->token->content, node_identifier->token->len);
		_OUT_CSTR(ctx, " (");
		ResizableString rstr_func_params;
		rstr_init(&rstr_func_params);
		_ir_func_params(ctx, &rstr_func_params, node_func_params);
		_OUT_STR(ctx, rstr_func_params.buffer, rstr_func_params.len);
		rstr_free(&rstr_func_params);
		_OUT_CSTR(ctx, ")");
	} else {
		ResizableString rstr_func_sign;
		rstr_init(&rstr_func_sign);

		rstr_append_with_raw(&rstr_func_sign, node_identifier->token->content, node_identifier->token->len);
		rstr_append_with_cstr(&rstr_func_sign, " (");
		ResizableString rstr_func_params;
		rstr_init(&rstr_func_params);
		_ir_func_params(ctx, &rstr_func_params, node_func_params);
		rstr_append_with_rstr(&rstr_func_sign, &rstr_func_params);
		rstr_free(&rstr_func_params);
		rstr_append_with_cstr(&rstr_func_sign, ")");

		_ir_type(ctx, &rstr_func_sign, node_return_type);
		_OUT_STR(ctx, rstr_func_sign.buffer, rstr_func_sign.len);
		_OUT_CSTR(ctx, " ");
		rstr_free(&rstr_func_sign);
	}

	if (node_body->type == FE_NODE_DUMMY) {
		_OUT_CSTR(ctx, ";");
	} else {
		_OUT_CSTR(ctx, "\n");
		_ir_stats_block(ctx, 0, node_body);
	}
	_OUT_CSTR(ctx, "\n");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x2117c
jmp 0x2119b
leaq 0x5b3d3(%rip), %rdi     # 0x7c556
leaq 0x55c5e(%rip), %rsi     # 0x76de8
movl $0x6ff, %edx            # imm = 0x6FF
leaq 0x56740(%rip), %rcx     # 0x778d6
callq 0x30a0
cmpq $0x0, -0x10(%rbp)
je 0x211a4
jmp 0x211c3
leaq 0x54e28(%rip), %rdi     # 0x75fd3
leaq 0x55c36(%rip), %rsi     # 0x76de8
movl $0x700, %edx            # imm = 0x700
leaq 0x56718(%rip), %rcx     # 0x778d6
callq 0x30a0
movq -0x10(%rbp), %rax
cmpl $0xa00, (%rax)          # imm = 0xA00
jne 0x211d1
jmp 0x211f0
leaq 0x54f7b(%rip), %rdi     # 0x76153
leaq 0x55c09(%rip), %rsi     # 0x76de8
movl $0x701, %edx            # imm = 0x701
leaq 0x566eb(%rip), %rcx     # 0x778d6
callq 0x30a0
movq $0x0, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x10(%rbp), %rax
movl 0x44(%rax), %eax
movl %eax, -0x34(%rbp)
cmpl $0x3, -0x34(%rbp)
jne 0x21251
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x212b9
cmpl $0x4, -0x34(%rbp)
jne 0x21298
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x18(%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x212b7
leaq 0x511bc(%rip), %rdi     # 0x7245b
leaq 0x55b42(%rip), %rsi     # 0x76de8
movl $0x713, %edx            # imm = 0x713
leaq 0x56624(%rip), %rcx     # 0x778d6
callq 0x30a0
jmp 0x212b9
movq -0x18(%rbp), %rax
cmpl $0x200, (%rax)          # imm = 0x200
jne 0x212c7
jmp 0x212e6
leaq 0x5335c(%rip), %rdi     # 0x7462a
leaq 0x55b13(%rip), %rsi     # 0x76de8
movl $0x715, %edx            # imm = 0x715
leaq 0x565f5(%rip), %rcx     # 0x778d6
callq 0x30a0
movq -0x20(%rbp), %rax
cmpl $0xa01, (%rax)          # imm = 0xA01
jne 0x212f4
jmp 0x21313
leaq 0x54e84(%rip), %rdi     # 0x7617f
leaq 0x55ae6(%rip), %rsi     # 0x76de8
movl $0x716, %edx            # imm = 0x716
leaq 0x565c8(%rip), %rcx     # 0x778d6
callq 0x30a0
movl $0x0, -0x38(%rbp)
movslq -0x38(%rbp), %rax
cmpq $0x1, %rax
jae 0x2134b
movslq -0x38(%rbp), %rcx
leaq 0x54dc7(%rip), %rax     # 0x760f6
movsbl (%rax,%rcx), %edi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x30d0
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x2131a
cmpq $0x0, -0x28(%rbp)
jne 0x2149c
movl $0x0, -0x3c(%rbp)
movslq -0x3c(%rbp), %rax
cmpq $0x5, %rax
jae 0x2138e
movslq -0x3c(%rbp), %rcx
leaq 0x55ccb(%rip), %rax     # 0x7703d
movsbl (%rax,%rcx), %edi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x30d0
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x2135d
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %eax
movq -0x18(%rbp), %rcx
movq 0x10(%rcx), %rcx
cmpl 0x4(%rcx), %eax
jge 0x213d1
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movslq -0x40(%rbp), %rcx
movsbl (%rax,%rcx), %edi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x30d0
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x21395
movl $0x0, -0x44(%rbp)
movslq -0x44(%rbp), %rax
cmpq $0x2, %rax
jae 0x21409
movslq -0x44(%rbp), %rcx
leaq 0x5666f(%rip), %rax     # 0x77a5c
movsbl (%rax,%rcx), %edi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x30d0
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x213d8
leaq -0x58(%rbp), %rdi
callq 0x8c90
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq -0x58(%rbp), %rsi
callq 0x21e30
movl $0x0, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
cmpl -0x54(%rbp), %eax
jge 0x21456
movq -0x50(%rbp), %rax
movslq -0x5c(%rbp), %rcx
movsbl (%rax,%rcx), %edi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x30d0
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x2142a
leaq -0x58(%rbp), %rdi
callq 0x9310
movl $0x0, -0x60(%rbp)
movslq -0x60(%rbp), %rax
cmpq $0x1, %rax
jae 0x21497
movslq -0x60(%rbp), %rcx
leaq 0x55b23(%rip), %rax     # 0x76f9e
movsbl (%rax,%rcx), %edi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x30d0
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0x21466
jmp 0x215b8
leaq -0x70(%rbp), %rdi
callq 0x8c90
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rsi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movl 0x4(%rax), %edx
leaq -0x70(%rbp), %rdi
callq 0x8f90
leaq -0x70(%rbp), %rdi
leaq 0x5658c(%rip), %rsi     # 0x77a5c
callq 0x8d70
leaq -0x80(%rbp), %rdi
callq 0x8c90
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq -0x80(%rbp), %rsi
callq 0x21e30
leaq -0x70(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x9100
leaq -0x80(%rbp), %rdi
callq 0x9310
leaq -0x70(%rbp), %rdi
leaq 0x55a8e(%rip), %rsi     # 0x76f9e
callq 0x8d70
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq -0x70(%rbp), %rsi
callq 0x216c0
movl $0x0, -0x84(%rbp)
movl -0x84(%rbp), %eax
cmpl -0x6c(%rbp), %eax
jge 0x21568
movq -0x68(%rbp), %rax
movslq -0x84(%rbp), %rcx
movsbl (%rax,%rcx), %edi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x30d0
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
jmp 0x21530
movl $0x0, -0x88(%rbp)
movslq -0x88(%rbp), %rax
cmpq $0x1, %rax
jae 0x215af
movslq -0x88(%rbp), %rcx
leaq 0x51ec7(%rip), %rax     # 0x73454
movsbl (%rax,%rcx), %edi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x30d0
movl -0x88(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x88(%rbp)
jmp 0x21572
leaq -0x70(%rbp), %rdi
callq 0x9310
movq -0x30(%rbp), %rax
cmpl $0x900, (%rax)          # imm = 0x900
jne 0x2160d
movl $0x0, -0x8c(%rbp)
movslq -0x8c(%rbp), %rax
cmpq $0x1, %rax
jae 0x2160b
movslq -0x8c(%rbp), %rcx
leaq 0x5652e(%rip), %rax     # 0x77b17
movsbl (%rax,%rcx), %edi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x30d0
movl -0x8c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8c(%rbp)
jmp 0x215ce
jmp 0x21663
movl $0x0, -0x90(%rbp)
movslq -0x90(%rbp), %rax
cmpq $0x1, %rax
jae 0x21654
movslq -0x90(%rbp), %rcx
leaq 0x54ac4(%rip), %rax     # 0x760f6
movsbl (%rax,%rcx), %edi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x30d0
movl -0x90(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x90(%rbp)
jmp 0x21617
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rdx
xorl %esi, %esi
callq 0x25b90
movl $0x0, -0x94(%rbp)
movslq -0x94(%rbp), %rax
cmpq $0x1, %rax
jae 0x216aa
movslq -0x94(%rbp), %rcx
leaq 0x54a6e(%rip), %rax     # 0x760f6
movsbl (%rax,%rcx), %edi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x30d0
movl -0x94(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x94(%rbp)
jmp 0x2166d
addq $0xa0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)