// File: /workspace/github_c_makefile_star2_O0/Ihsoh[P]ilang/compiler/backend/asmgen_gas32.c
// Function: asm_stat_sitofp
static void _asm_stat_sitofp(
	ASMGeneratorGas32Context *ctx,
	ParserASTNode *node
) {
	assert(ctx);
	assert(node);
	assert(node->type == BE_NODE_STAT_SITOFP);
	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);

	_asm_inst_xor_x_x(
		ctx,
		ctx->body,
		BE_TYPE_UINT32,
		_ASM_REG_NAME_EAX,
		_ASM_REG_NAME_EAX
	);

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

	ParserASTNode *node_source = node->childs[1];
	uint8_t type_source = _move_id_or_constexpr_to_reg(
		ctx,
		_ASM_REG_AX,
		_ASM_REG_BX,
		node_source
	);

	if (type_target == BE_TYPE_FLOAT) {
		if (type_source == BE_TYPE_INT64) {
			_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
			);

			ResizableString rstr_memref;
			rstr_init(&rstr_memref);
			_asm_inst_memref_base(ctx, &rstr_memref, _ASM_REG_NAME_ESP);

			_asm_inst_cvtsi2ss_x_x(
				ctx,
				ctx->body,
				BE_TYPE_INT32,
				_ASM_REG_NAME_XMM0,
				RSTR_CSTR(&rstr_memref)
			);

			rstr_free(&rstr_memref);

			_asm_inst_add_x_x(
				ctx,
				ctx->body,
				BE_TYPE_UINT32,
				_ASM_REG_NAME_ESP,
				_ASM_CONST_8
			);
		} else {
			_asm_inst_cvtsi2ss_x_x(
				ctx,
				ctx->body,
				BE_TYPE_INT32,
				_ASM_REG_NAME_XMM0,
				_ASM_REG_NAME_EAX
			);
		}

		ParserSymbol *symbol_target_l = _instantiate_varsym(ctx, symbol_target, 0);

		_asm_inst_movss_sym_x(
			ctx,
			ctx->body,
			symbol_target_l,
			_ASM_REG_NAME_XMM0
		);

		_free_varsym(ctx, symbol_target_l);
	} else if (type_target == BE_TYPE_DOUBLE) {
		if (type_source == BE_TYPE_INT64) {
			_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
			);

			ResizableString rstr_memref;
			rstr_init(&rstr_memref);
			_asm_inst_memref_base(ctx, &rstr_memref, _ASM_REG_NAME_ESP);

			_asm_inst_cvtsi2sd_x_x(
				ctx,
				ctx->body,
				BE_TYPE_INT32,
				_ASM_REG_NAME_XMM0,
				RSTR_CSTR(&rstr_memref)
			);

			rstr_free(&rstr_memref);

			_asm_inst_add_x_x(
				ctx,
				ctx->body,
				BE_TYPE_UINT32,
				_ASM_REG_NAME_ESP,
				_ASM_CONST_8
			);
		} else {
			_asm_inst_cvtsi2sd_x_x(
				ctx,
				ctx->body,
				BE_TYPE_INT32,
				_ASM_REG_NAME_XMM0,
				_ASM_REG_NAME_EAX
			);
		}

		ParserSymbol *symbol_target_l = _instantiate_varsym(ctx, symbol_target, 0);

		_asm_inst_movsd_sym_x(
			ctx,
			ctx->body,
			symbol_target_l,
			_ASM_REG_NAME_XMM0
		);

		_free_varsym(ctx, symbol_target_l);
	} else {
		assert(0);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x1426c
jmp 0x1428b
leaq 0x6beee(%rip), %rdi     # 0x80161
leaq 0x6167e(%rip), %rsi     # 0x758f8
movl $0x13c0, %edx           # imm = 0x13C0
leaq 0x63616(%rip), %rcx     # 0x7789c
callq 0x30a0
cmpq $0x0, -0x10(%rbp)
je 0x14294
jmp 0x142b3
leaq 0x622c1(%rip), %rdi     # 0x7655c
leaq 0x61656(%rip), %rsi     # 0x758f8
movl $0x13c1, %edx           # imm = 0x13C1
leaq 0x635ee(%rip), %rcx     # 0x7789c
callq 0x30a0
movq -0x10(%rbp), %rax
cmpl $0xbc2, (%rax)          # imm = 0xBC2
jne 0x142c1
jmp 0x142e0
leaq 0x63617(%rip), %rdi     # 0x778df
leaq 0x61629(%rip), %rsi     # 0x758f8
movl $0x13c2, %edx           # imm = 0x13C2
leaq 0x635c1(%rip), %rcx     # 0x7789c
callq 0x30a0
movq -0x10(%rbp), %rax
cmpl $0x2, 0x44(%rax)
jne 0x142ec
jmp 0x1430b
leaq 0x6ea51(%rip), %rdi     # 0x82d44
leaq 0x615fe(%rip), %rsi     # 0x758f8
movl $0x13c3, %edx           # imm = 0x13C3
leaq 0x63596(%rip), %rcx     # 0x7789c
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 0x14328
jmp 0x14347
leaq 0x6208e(%rip), %rdi     # 0x763bd
leaq 0x615c2(%rip), %rsi     # 0x758f8
movl $0x13c6, %edx           # imm = 0x13C6
leaq 0x6355a(%rip), %rcx     # 0x7789c
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 -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x8, %edx
leaq 0x6206b(%rip), %r8      # 0x763e5
movq %r8, %rcx
callq 0x230c0
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x8, %edx
leaq 0x62050(%rip), %r8      # 0x763ea
movq %r8, %rcx
callq 0x230c0
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rcx
xorl %esi, %esi
movl $0x1, %edx
callq 0x22a20
movb %al, -0x31(%rbp)
movzbl -0x21(%rbp), %eax
cmpl $0xa, %eax
jne 0x1451b
movzbl -0x31(%rbp), %eax
cmpl $0x5, %eax
jne 0x144b6
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x8, %edx
leaq 0x61fef(%rip), %rcx     # 0x763ea
callq 0x221b0
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x8, %edx
leaq 0x61fcd(%rip), %rcx     # 0x763e5
callq 0x221b0
leaq -0x48(%rbp), %rdi
callq 0x8c90
movq -0x8(%rbp), %rdi
leaq -0x48(%rbp), %rsi
leaq 0x634cc(%rip), %rdx     # 0x77901
callq 0x23200
movq -0x8(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x70(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x14462
leaq 0x61ae3(%rip), %rax     # 0x75f3f
movq %rax, -0x80(%rbp)
jmp 0x1446a
movq -0x40(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x70(%rbp), %rsi
movq -0x78(%rbp), %rdi
movq -0x80(%rbp), %r8
movl $0x4, %edx
leaq 0x63484(%rip), %rcx     # 0x77906
callq 0x232b0
leaq -0x48(%rbp), %rdi
callq 0x9310
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x8, %edx
leaq 0x63459(%rip), %rcx     # 0x77901
leaq 0x6345d(%rip), %r8      # 0x7790c
callq 0x21eb0
jmp 0x144da
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x4, %edx
leaq 0x63438(%rip), %rcx     # 0x77906
leaq 0x61f10(%rip), %r8      # 0x763e5
callq 0x232b0
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
xorl %edx, %edx
callq 0x1f8e0
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movq -0x50(%rbp), %rdx
leaq 0x63402(%rip), %rcx     # 0x77906
callq 0x23420
movq -0x8(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x1fd10
jmp 0x146a0
movzbl -0x21(%rbp), %eax
cmpl $0xb, %eax
jne 0x1467f
movzbl -0x31(%rbp), %eax
cmpl $0x5, %eax
jne 0x1461d
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x8, %edx
leaq 0x61e9d(%rip), %rcx     # 0x763ea
callq 0x221b0
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x8, %edx
leaq 0x61e7b(%rip), %rcx     # 0x763e5
callq 0x221b0
leaq -0x60(%rbp), %rdi
callq 0x8c90
movq -0x8(%rbp), %rdi
leaq -0x60(%rbp), %rsi
leaq 0x6337a(%rip), %rdx     # 0x77901
callq 0x23200
movq -0x8(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x88(%rbp)
cmpq $0x0, -0x58(%rbp)
jne 0x145bd
leaq 0x6198b(%rip), %rax     # 0x75f3f
movq %rax, -0x98(%rbp)
jmp 0x145c8
movq -0x58(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x88(%rbp), %rsi
movq -0x90(%rbp), %rdi
movq -0x98(%rbp), %r8
movl $0x4, %edx
leaq 0x6331d(%rip), %rcx     # 0x77906
callq 0x23530
leaq -0x60(%rbp), %rdi
callq 0x9310
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x8, %edx
leaq 0x632f2(%rip), %rcx     # 0x77901
leaq 0x632f6(%rip), %r8      # 0x7790c
callq 0x21eb0
jmp 0x14641
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x4, %edx
leaq 0x632d1(%rip), %rcx     # 0x77906
leaq 0x61da9(%rip), %r8      # 0x763e5
callq 0x23530
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
xorl %edx, %edx
callq 0x1f8e0
movq %rax, -0x68(%rbp)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movq -0x68(%rbp), %rdx
leaq 0x6329b(%rip), %rcx     # 0x77906
callq 0x236a0
movq -0x8(%rbp), %rdi
movq -0x68(%rbp), %rsi
callq 0x1fd10
jmp 0x1469e
leaq 0x5edd4(%rip), %rdi     # 0x7345a
leaq 0x6126b(%rip), %rsi     # 0x758f8
movl $0x1455, %edx           # imm = 0x1455
leaq 0x63203(%rip), %rcx     # 0x7789c
callq 0x30a0
jmp 0x146a0
addq $0xa0, %rsp
popq %rbp
retq
nopl (%rax)