// File: /workspace/github_c_makefile_star2_O2/Ihsoh[P]ilang/compiler/backend/asmgen_gas32.c
// Function: asm_stat_func_call
static void _asm_stat_func_call(
	ASMGeneratorGas32Context *ctx,
	ParserASTNode *node
) {
	assert(ctx);
	assert(node);
	assert(node->type == BE_NODE_STAT_FUNC_CALL);
	assert(node->nchilds == 2);

	ParserASTNode *node_func_call_params = node->childs[1];
	for (int i = node_func_call_params->nchilds - 1; i >= 0; i--) {
		ParserASTNode *node_func_call_param = node_func_call_params->childs[i];

		_move_id_or_constexpr_to_reg(
			ctx,
			_ASM_REG_AX,
			_ASM_REG_BX,
			node_func_call_param
		);

		_asm_inst_push_x(
			ctx,
			ctx->body,
			BE_TYPE_UINT32,
			_ASM_REG_NAME_EBX
		);

		_asm_inst_push_x(
			ctx,
			ctx->body,
			BE_TYPE_UINT32,
			_ASM_REG_NAME_EAX
		);
	}

	ParserASTNode *node_func = node->childs[0];
	if (node_func->type == BE_NODE_IDENTIFIER) {
		ParserSymbol *symbol_func = _get_symbol_by_id_node(ctx, node_func);
		if (symbol_func->type == BE_SYM_FUNC) {
			ResizableString rstr_func_name;
			rstr_init_with_raw(&rstr_func_name, node_func->token->content, node_func->token->len);

			_asm_inst_call_x(ctx, ctx->body, RSTR_CSTR(&rstr_func_name));

			rstr_free(&rstr_func_name);
		} else if (symbol_func->type == BE_SYM_VAR) {
			_move_id_or_constexpr_to_reg(
				ctx,
				_ASM_REG_AX,
				_ASM_REG_BX,
				node_func
			);
			_asm_inst_callabs_x(ctx, ctx->body, _ASM_REG_NAME_EAX);
		} else {
			assert(0);
		}
	} else if (node_func->type == BE_NODE_EXPR) {
		_move_id_or_constexpr_to_reg(
			ctx,
			_ASM_REG_AX,
			_ASM_REG_BX,
			node_func
		);
		_asm_inst_call_x(ctx, ctx->body, _ASM_REG_NAME_EAX);
	} else {
		assert(0);
	}

	ResizableString rstr_tmp;
	rstr_init(&rstr_tmp);
	_asm_inst_uint_const(ctx, &rstr_tmp, node_func_call_params->nchilds * 8);
	_asm_inst_add_x_x(
		ctx,
		ctx->body,
		BE_TYPE_UINT32,
		_ASM_REG_NAME_ESP,
		RSTR_CSTR(&rstr_tmp)
	);
	rstr_free(&rstr_tmp);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
testq %rsi, %rsi
je 0x15471
cmpl $0xbd2, (%rsi)          # imm = 0xBD2
jne 0x15490
cmpl $0x2, 0x44(%rsi)
jne 0x154af
movq %rdi, %rbx
movq %rsi, -0x38(%rbp)
movq 0x48(%rsi), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
movl 0x44(%rax), %r14d
pushq $0x1
popq %r15
leaq 0x28ad4(%rip), %r12     # 0x3dd98
leaq 0x28ac8(%rip), %r13     # 0x3dd93
testl %r14d, %r14d
jle 0x15307
movq -0x30(%rbp), %rax
movq 0x48(%rax), %rax
movq -0x8(%rax,%r14,8), %rcx
decq %r14
movq %rbx, %rdi
xorl %esi, %esi
movl %r15d, %edx
callq 0x141f5
movq 0x20(%rbx), %rdi
movq %r12, %rsi
callq 0x13e40
movq 0x20(%rbx), %rdi
movq %r13, %rsi
callq 0x13e40
jmp 0x152cb
movq -0x38(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %r15
movl (%r15), %eax
cmpl $0x200, %eax            # imm = 0x200
je 0x1534c
cmpl $0xe00, %eax            # imm = 0xE00
jne 0x154ce
pushq $0x1
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
movq %r15, %rcx
callq 0x141f5
movq 0x20(%rbx), %rdi
leaq 0x28a51(%rip), %rsi     # 0x3dd93
callq 0x1552b
jmp 0x1540c
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1293e
movl (%rax), %eax
cmpl $0x1, %eax
je 0x1539e
cmpl $0x3, %eax
jne 0x154ed
movq 0x10(%r15), %rax
movq 0x8(%rax), %rsi
movl 0x4(%rax), %edx
leaq -0x48(%rbp), %r15
movq %r15, %rdi
callq 0x6fa2
movq 0x20(%rbx), %rdi
movq 0x8(%r15), %rax
testq %rax, %rax
leaq 0x2869b(%rip), %rsi     # 0x3da2b
cmovneq %rax, %rsi
callq 0x1552b
movq %r15, %rdi
jmp 0x15407
pushq $0x1
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
movq %r15, %rcx
callq 0x141f5
movq 0x20(%rbx), %r15
testq %r15, %r15
je 0x1550c
leaq 0x289d1(%rip), %rsi     # 0x3dd93
leaq -0x48(%rbp), %r12
movq %r12, %rdi
callq 0x6e49
pushq $0x2a
popq %rsi
movq %r12, %rdi
callq 0x7814
movq 0x8(%r12), %rax
testq %rax, %rax
leaq 0x28643(%rip), %rcx     # 0x3da2b
cmovneq %rax, %rcx
leaq 0x292b7(%rip), %rsi     # 0x3e6aa
leaq 0x2a971(%rip), %rdx     # 0x3fd6b
movq %r15, %rdi
xorl %eax, %eax
callq 0x739a
movq %r12, %rdi
callq 0x72b9
leaq -0x48(%rbp), %r15
movq %r15, %rdi
callq 0x6e1c
movq -0x30(%rbp), %rax
movslq 0x44(%rax), %rdx
shlq $0x3, %rdx
leaq 0x28f79(%rip), %rsi     # 0x3e3a4
movq %r15, %rdi
xorl %eax, %eax
callq 0x739a
movq 0x20(%rbx), %rdi
movq 0x8(%r15), %rax
testq %rax, %rax
leaq 0x285e4(%rip), %rcx     # 0x3da2b
cmovneq %rax, %rcx
leaq 0x29b4b(%rip), %rdx     # 0x3ef9d
pushq $0x8
popq %rsi
callq 0x13bfe
movq %r15, %rdi
callq 0x72b9
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x28a92(%rip), %rdi     # 0x3df0a
leaq 0x27fc9(%rip), %rsi     # 0x3d448
leaq 0x2a822(%rip), %rcx     # 0x3fca8
movl $0x17ae, %edx           # imm = 0x17AE
callq 0x30a0
leaq 0x2a857(%rip), %rdi     # 0x3fcee
leaq 0x27faa(%rip), %rsi     # 0x3d448
leaq 0x2a803(%rip), %rcx     # 0x3fca8
movl $0x17af, %edx           # imm = 0x17AF
callq 0x30a0
leaq 0x3414f(%rip), %rdi     # 0x49605
leaq 0x27f8b(%rip), %rsi     # 0x3d448
leaq 0x2a7e4(%rip), %rcx     # 0x3fca8
movl $0x17b0, %edx           # imm = 0x17B0
callq 0x30a0
leaq 0x25e94(%rip), %rdi     # 0x3b369
leaq 0x27f6c(%rip), %rsi     # 0x3d448
leaq 0x2a7c5(%rip), %rcx     # 0x3fca8
movl $0x17ea, %edx           # imm = 0x17EA
callq 0x30a0
leaq 0x25e75(%rip), %rdi     # 0x3b369
leaq 0x27f4d(%rip), %rsi     # 0x3d448
leaq 0x2a7a6(%rip), %rcx     # 0x3fca8
movl $0x17df, %edx           # imm = 0x17DF
callq 0x30a0
leaq 0x2651d(%rip), %rdi     # 0x3ba30
leaq 0x27f2e(%rip), %rsi     # 0x3d448
leaq 0x2a850(%rip), %rcx     # 0x3fd71
movl $0x6f0, %edx            # imm = 0x6F0
callq 0x30a0