// File: /workspace/github_c_makefile_star2_O0/Ihsoh[P]ilang/compiler/backend/asmgen_gas64.c
// Function: asm_stat_sext
static void _asm_stat_sext(
	ASMGeneratorGas64Context *ctx,
	ParserASTNode *node
) {
	assert(ctx);
	assert(node);
	assert(node->type == BE_NODE_STAT_SEXT);
	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);
	const char *reg_target = _asm_inst_reg(ctx, type_target, _ASM_REG_AX);

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

	_asm_inst_movsx_x_x(
		ctx,
		ctx->body,
		type_target,
		reg_target,
		type_source,
		reg_source
	);

	_asm_inst_mov_sym_x(
		ctx,
		ctx->body,
		symbol_target,
		reg_target
	);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x2be99
jmp 0x2beb8
leaq 0x542c1(%rip), %rdi     # 0x80161
leaq 0x4ec5d(%rip), %rsi     # 0x7ab04
movl $0xfef, %edx            # imm = 0xFEF
leaq 0x4fff2(%rip), %rcx     # 0x7bea5
callq 0x30a0
cmpq $0x0, -0x10(%rbp)
je 0x2bec1
jmp 0x2bee0
leaq 0x4a694(%rip), %rdi     # 0x7655c
leaq 0x4ec35(%rip), %rsi     # 0x7ab04
movl $0xff0, %edx            # imm = 0xFF0
leaq 0x4ffca(%rip), %rcx     # 0x7bea5
callq 0x30a0
movq -0x10(%rbp), %rax
cmpl $0xbc1, (%rax)          # imm = 0xBC1
jne 0x2beee
jmp 0x2bf0d
leaq 0x4b85b(%rip), %rdi     # 0x77750
leaq 0x4ec08(%rip), %rsi     # 0x7ab04
movl $0xff1, %edx            # imm = 0xFF1
leaq 0x4ff9d(%rip), %rcx     # 0x7bea5
callq 0x30a0
movq -0x10(%rbp), %rax
cmpl $0x2, 0x44(%rax)
jne 0x2bf19
jmp 0x2bf38
leaq 0x56e24(%rip), %rdi     # 0x82d44
leaq 0x4ebdd(%rip), %rsi     # 0x7ab04
movl $0xff2, %edx            # imm = 0xFF2
leaq 0x4ff72(%rip), %rcx     # 0x7bea5
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 0x2bf55
jmp 0x2bf74
leaq 0x4a461(%rip), %rdi     # 0x763bd
leaq 0x4eba1(%rip), %rsi     # 0x7ab04
movl $0xff5, %edx            # imm = 0xFF5
leaq 0x4ff36(%rip), %rcx     # 0x7bea5
callq 0x30a0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x32820
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movb 0x30(%rax), %al
movb %al, -0x21(%rbp)
movq -0x8(%rbp), %rdi
xorl %edx, %edx
movzbl -0x21(%rbp), %esi
callq 0x334d0
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rdx
movl $0x1, %esi
callq 0x334a0
movb %al, -0x39(%rbp)
movq -0x8(%rbp), %rdi
movl $0x1, %edx
movzbl -0x39(%rbp), %esi
callq 0x334d0
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movb -0x21(%rbp), %dl
movq -0x30(%rbp), %rcx
movb -0x39(%rbp), %al
movq -0x48(%rbp), %r9
movzbl %dl, %edx
movzbl %al, %r8d
callq 0x34340
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movq -0x20(%rbp), %rdx
movq -0x30(%rbp), %rcx
callq 0x32d40
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)