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

	ParserASTNode *node_target = node->childs[0];
	assert(node_target->type == BE_NODE_IDENTIFIER);
	ParserSymbol *symbol_target = _get_var_symbol_by_id_node(ctx, node_target);
	uint8_t type_target = BE_VAR_SYMBOL_GET_TYPE(symbol_target);

	ParserASTNode *node_func_call = node->childs[1];
	assert(node_func_call->type == BE_NODE_STAT_FUNC_CALL);
	_asm_stat_func_call(ctx, node_func_call);

	if (type_target == BE_TYPE_INT64
			|| type_target == BE_TYPE_UINT64
			|| type_target == BE_TYPE_DOUBLE) {
		ParserSymbol *symbol_target_l = _instantiate_varsym(ctx, symbol_target, 0);
		ParserSymbol *symbol_target_h = _instantiate_varsym(ctx, symbol_target, 4);

		_asm_inst_mov_sym_x(
			ctx,
			ctx->body,
			symbol_target_l,
			_ASM_REG_NAME_EAX
		);

		_asm_inst_mov_sym_x(
			ctx,
			ctx->body,
			symbol_target_h,
			_ASM_REG_NAME_EDX
		);

		_free_varsym(ctx, symbol_target_l);
		_free_varsym(ctx, symbol_target_h);
	} else {
		ParserSymbol *symbol_target_l = _instantiate_varsym(ctx, symbol_target, 0);

		_asm_inst_mov_sym_x(
			ctx,
			ctx->body,
			symbol_target_l,
			_asm_inst_reg(ctx, type_target, _ASM_REG_AX)
		);

		_free_varsym(ctx, symbol_target_l);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x16479
jmp 0x16498
leaq 0x69ce1(%rip), %rdi     # 0x80161
leaq 0x5f471(%rip), %rsi     # 0x758f8
movl $0x180c, %edx           # imm = 0x180C
leaq 0x624d4(%rip), %rcx     # 0x78967
callq 0x30a0
cmpq $0x0, -0x10(%rbp)
je 0x164a1
jmp 0x164c0
leaq 0x600b4(%rip), %rdi     # 0x7655c
leaq 0x5f449(%rip), %rsi     # 0x758f8
movl $0x180d, %edx           # imm = 0x180D
leaq 0x624ac(%rip), %rcx     # 0x78967
callq 0x30a0
movq -0x10(%rbp), %rax
cmpl $0xbd0, (%rax)          # imm = 0xBD0
jne 0x164ce
jmp 0x164ed
leaq 0x624d3(%rip), %rdi     # 0x789a8
leaq 0x5f41c(%rip), %rsi     # 0x758f8
movl $0x180e, %edx           # imm = 0x180E
leaq 0x6247f(%rip), %rcx     # 0x78967
callq 0x30a0
movq -0x10(%rbp), %rax
cmpl $0x2, 0x44(%rax)
jne 0x164f9
jmp 0x16518
leaq 0x6c844(%rip), %rdi     # 0x82d44
leaq 0x5f3f1(%rip), %rsi     # 0x758f8
movl $0x180f, %edx           # imm = 0x180F
leaq 0x62454(%rip), %rcx     # 0x78967
callq 0x30a0
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x200, (%rax)          # imm = 0x200
jne 0x16535
jmp 0x16554
leaq 0x5fe81(%rip), %rdi     # 0x763bd
leaq 0x5f3b5(%rip), %rsi     # 0x758f8
movl $0x1812, %edx           # imm = 0x1812
leaq 0x62418(%rip), %rcx     # 0x78967
callq 0x30a0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x1f720
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movb 0x30(%rax), %al
movb %al, -0x21(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpl $0xbd2, (%rax)          # imm = 0xBD2
jne 0x1658d
jmp 0x165ac
leaq 0x62285(%rip), %rdi     # 0x78819
leaq 0x5f35d(%rip), %rsi     # 0x758f8
movl $0x1817, %edx           # imm = 0x1817
leaq 0x623c0(%rip), %rcx     # 0x78967
callq 0x30a0
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x25010
movzbl -0x21(%rbp), %eax
cmpl $0x5, %eax
je 0x165d4
movzbl -0x21(%rbp), %eax
cmpl $0x9, %eax
je 0x165d4
movzbl -0x21(%rbp), %eax
cmpl $0xb, %eax
jne 0x16651
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
xorl %edx, %edx
callq 0x1f8e0
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
movl $0x4, %edx
callq 0x1f8e0
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movq -0x38(%rbp), %rdx
leaq 0x5fdd1(%rip), %rcx     # 0x763e5
callq 0x20080
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movq -0x40(%rbp), %rdx
leaq 0x6052c(%rip), %rcx     # 0x76b5c
callq 0x20080
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x1fd10
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x1fd10
jmp 0x166bd
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
xorl %edx, %edx
callq 0x1f8e0
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rdi
xorl %edx, %edx
leaq 0x5f26b(%rip), %rcx     # 0x758f8
movl $0x1837, %r8d           # imm = 0x1837
movzbl -0x21(%rbp), %esi
callq 0x20d10
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq -0x50(%rbp), %rdx
movq %rax, %rcx
callq 0x20080
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x1fd10
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)