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

	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_source_left = node->childs[1];
	ParserASTNode *node_source_right = node->childs[2];

	if (be_sem_is_integer_type(type_target)) {
		_move_id_or_constexpr_to_reg(
			ctx,
			_ASM_REG_AX,
			_ASM_REG_BX,
			node_source_left
		);

		_move_id_or_constexpr_to_reg(
			ctx,
			_ASM_REG_CX,
			_ASM_REG_DX,
			node_source_right
		);

		if (type_target == BE_TYPE_INT64) {
			_asm_inst_mov_x_x(
				ctx,
				ctx->body,
				BE_TYPE_UINT32,
				_ASM_REG_NAME_ESI,
				_ASM_REG_NAME_EAX
			);

			_asm_inst_mov_x_x(
				ctx,
				ctx->body,
				BE_TYPE_UINT32,
				_ASM_REG_NAME_EDI,
				_ASM_REG_NAME_EBX
			);

			_asm_inst_sar_x_x(
				ctx,
				ctx->body,
				BE_TYPE_UINT32,
				_ASM_REG_NAME_EDI,
				_ASM_REG_NAME_CL
			);

			_asm_inst_shrd_x_x_x(
				ctx,
				ctx->body,
				BE_TYPE_UINT32,
				_ASM_REG_NAME_ESI,
				_ASM_REG_NAME_EBX,
				_ASM_REG_NAME_CL
			);

			_asm_inst_mov_x_x(
				ctx,
				ctx->body,
				BE_TYPE_UINT32,
				_ASM_REG_NAME_EDX,
				_ASM_REG_NAME_EBX
			);

			_asm_inst_sar_x_x(
				ctx,
				ctx->body,
				BE_TYPE_UINT32,
				_ASM_REG_NAME_EDX,
				_ASM_CONST_31
			);

			_asm_inst_mov_x_x(
				ctx,
				ctx->body,
				BE_TYPE_UINT32,
				_ASM_REG_NAME_EAX,
				_ASM_REG_NAME_ESI
			);

			_asm_inst_mov_x_x(
				ctx,
				ctx->body,
				BE_TYPE_UINT32,
				_ASM_REG_NAME_EBX,
				_ASM_REG_NAME_EDI
			);

			_asm_inst_test_x_x(
				ctx,
				ctx->body,
				BE_TYPE_UINT8,
				_ASM_REG_NAME_CL,
				_ASM_CONST_32
			);

			_asm_inst_cmovne_x_x(
				ctx,
				ctx->body,
				BE_TYPE_UINT32,
				_ASM_REG_NAME_EAX,
				_ASM_REG_NAME_EDI
			);

			_asm_inst_cmovne_x_x(
				ctx,
				ctx->body,
				BE_TYPE_UINT32,
				_ASM_REG_NAME_EBX,
				_ASM_REG_NAME_EDX
			);

			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_EBX
			);

			_free_varsym(ctx, symbol_target_l);
			_free_varsym(ctx, symbol_target_h);
		} else if (type_target == BE_TYPE_UINT64) {
			_asm_inst_mov_x_x(
				ctx,
				ctx->body,
				BE_TYPE_UINT32,
				_ASM_REG_NAME_ESI,
				_ASM_REG_NAME_EAX
			);

			_asm_inst_mov_x_x(
				ctx,
				ctx->body,
				BE_TYPE_UINT32,
				_ASM_REG_NAME_EDI,
				_ASM_REG_NAME_EBX
			);

			_asm_inst_shr_x_x(
				ctx,
				ctx->body,
				BE_TYPE_UINT32,
				_ASM_REG_NAME_EDI,
				_ASM_REG_NAME_CL
			);

			_asm_inst_shrd_x_x_x(
				ctx,
				ctx->body,
				BE_TYPE_UINT32,
				_ASM_REG_NAME_ESI,
				_ASM_REG_NAME_EBX,
				_ASM_REG_NAME_CL
			);

			_asm_inst_mov_x_x(
				ctx,
				ctx->body,
				BE_TYPE_UINT32,
				_ASM_REG_NAME_EAX,
				_ASM_REG_NAME_ESI
			);

			_asm_inst_mov_x_x(
				ctx,
				ctx->body,
				BE_TYPE_UINT32,
				_ASM_REG_NAME_EBX,
				_ASM_REG_NAME_EDI
			);

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

			_asm_inst_test_x_x(
				ctx,
				ctx->body,
				BE_TYPE_UINT8,
				_ASM_REG_NAME_CL,
				_ASM_CONST_32
			);

			_asm_inst_cmovne_x_x(
				ctx,
				ctx->body,
				BE_TYPE_UINT32,
				_ASM_REG_NAME_EAX,
				_ASM_REG_NAME_EDI
			);

			_asm_inst_cmovne_x_x(
				ctx,
				ctx->body,
				BE_TYPE_UINT32,
				_ASM_REG_NAME_EBX,
				_ASM_REG_NAME_EDX
			);

			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_EBX
			);

			_free_varsym(ctx, symbol_target_l);
			_free_varsym(ctx, symbol_target_h);
		} else {
			_asm_inst_shr_x_x(
				ctx,
				ctx->body,
				BE_TYPE_UINT32,
				_ASM_REG_NAME_EAX,
				_ASM_REG_NAME_CL
			);

			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);
		}
	} else {
		assert(0);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x1979c
jmp 0x197bb
leaq 0x669be(%rip), %rdi     # 0x80161
leaq 0x5c14e(%rip), %rsi     # 0x758f8
movl $0x1ea2, %edx           # imm = 0x1EA2
leaq 0x60039(%rip), %rcx     # 0x797ef
callq 0x30a0
cmpq $0x0, -0x10(%rbp)
je 0x197c4
jmp 0x197e3
leaq 0x5cd91(%rip), %rdi     # 0x7655c
leaq 0x5c126(%rip), %rsi     # 0x758f8
movl $0x1ea3, %edx           # imm = 0x1EA3
leaq 0x60011(%rip), %rcx     # 0x797ef
callq 0x30a0
movq -0x10(%rbp), %rax
cmpl $0xbec, (%rax)          # imm = 0xBEC
jne 0x197f1
jmp 0x19810
leaq 0x60037(%rip), %rdi     # 0x7982f
leaq 0x5c0f9(%rip), %rsi     # 0x758f8
movl $0x1ea4, %edx           # imm = 0x1EA4
leaq 0x5ffe4(%rip), %rcx     # 0x797ef
callq 0x30a0
movq -0x10(%rbp), %rax
cmpl $0x3, 0x44(%rax)
jne 0x1981c
jmp 0x1983b
leaq 0x5d91b(%rip), %rdi     # 0x7713e
leaq 0x5c0ce(%rip), %rsi     # 0x758f8
movl $0x1ea5, %edx           # imm = 0x1EA5
leaq 0x5ffb9(%rip), %rcx     # 0x797ef
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 0x19858
jmp 0x19877
leaq 0x5cb5e(%rip), %rdi     # 0x763bd
leaq 0x5c092(%rip), %rsi     # 0x758f8
movl $0x1ea8, %edx           # imm = 0x1EA8
leaq 0x5ff7d(%rip), %rcx     # 0x797ef
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 -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x38(%rbp)
movzbl -0x21(%rbp), %edi
callq 0x4da80
testb $0x1, %al
jne 0x198c4
jmp 0x19d9b
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rcx
xorl %esi, %esi
movl $0x1, %edx
callq 0x22a20
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rcx
movl $0x2, %esi
movl $0x3, %edx
callq 0x22a20
movzbl -0x21(%rbp), %eax
cmpl $0x5, %eax
jne 0x19b0f
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x8, %edx
leaq 0x5c900(%rip), %rcx     # 0x76214
leaq 0x5caca(%rip), %r8      # 0x763e5
callq 0x20f30
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x8, %edx
leaq 0x5fdb2(%rip), %rcx     # 0x796ea
leaq 0x5caab(%rip), %r8      # 0x763ea
callq 0x20f30
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x8, %edx
leaq 0x5fd8e(%rip), %rcx     # 0x796ea
leaq 0x5d1e4(%rip), %r8      # 0x76b47
callq 0x22f80
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x8, %edx
leaq 0x5c894(%rip), %rcx     # 0x76214
leaq 0x5ca63(%rip), %r8      # 0x763ea
leaq 0x5d1b9(%rip), %r9      # 0x76b47
callq 0x26db0
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x8, %edx
leaq 0x5d1b1(%rip), %rcx     # 0x76b5c
leaq 0x5ca38(%rip), %r8      # 0x763ea
callq 0x20f30
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x8, %edx
leaq 0x5d18d(%rip), %rcx     # 0x76b5c
leaq 0x5ddd8(%rip), %r8      # 0x777ae
callq 0x22f80
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x8, %edx
leaq 0x5c9f2(%rip), %rcx     # 0x763e5
leaq 0x5c81a(%rip), %r8      # 0x76214
callq 0x20f30
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x8, %edx
leaq 0x5c9d3(%rip), %rcx     # 0x763ea
leaq 0x5fccc(%rip), %r8      # 0x796ea
callq 0x20f30
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x6, %edx
leaq 0x5d10c(%rip), %rcx     # 0x76b47
leaq 0x5fcad(%rip), %r8      # 0x796ef
callq 0x23af0
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x8, %edx
leaq 0x5c986(%rip), %rcx     # 0x763e5
leaq 0x5fc84(%rip), %r8      # 0x796ea
callq 0x26c70
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x8, %edx
leaq 0x5c967(%rip), %rcx     # 0x763ea
leaq 0x5d0d2(%rip), %r8      # 0x76b5c
callq 0x26c70
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
xorl %edx, %edx
callq 0x1f8e0
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
movl $0x4, %edx
callq 0x1f8e0
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movq -0x40(%rbp), %rdx
leaq 0x5c916(%rip), %rcx     # 0x763e5
callq 0x20080
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movq -0x48(%rbp), %rdx
leaq 0x5c8ff(%rip), %rcx     # 0x763ea
callq 0x20080
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x1fd10
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x1fd10
jmp 0x19d99
movzbl -0x21(%rbp), %eax
cmpl $0x9, %eax
jne 0x19d07
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x8, %edx
leaq 0x5c6e0(%rip), %rcx     # 0x76214
leaq 0x5c8aa(%rip), %r8      # 0x763e5
callq 0x20f30
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x8, %edx
leaq 0x5fb92(%rip), %rcx     # 0x796ea
leaq 0x5c88b(%rip), %r8      # 0x763ea
callq 0x20f30
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x8, %edx
leaq 0x5fb6e(%rip), %rcx     # 0x796ea
leaq 0x5cfc4(%rip), %r8      # 0x76b47
callq 0x26f20
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x8, %edx
leaq 0x5c674(%rip), %rcx     # 0x76214
leaq 0x5c843(%rip), %r8      # 0x763ea
leaq 0x5cf99(%rip), %r9      # 0x76b47
callq 0x26db0
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x8, %edx
leaq 0x5c81a(%rip), %rcx     # 0x763e5
leaq 0x5c642(%rip), %r8      # 0x76214
callq 0x20f30
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x8, %edx
leaq 0x5c7fb(%rip), %rcx     # 0x763ea
leaq 0x5faf4(%rip), %r8      # 0x796ea
callq 0x20f30
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x8, %edx
leaq 0x5cf49(%rip), %r8      # 0x76b5c
movq %r8, %rcx
callq 0x230c0
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x6, %edx
leaq 0x5cf14(%rip), %rcx     # 0x76b47
leaq 0x5fab5(%rip), %r8      # 0x796ef
callq 0x23af0
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x8, %edx
leaq 0x5c78e(%rip), %rcx     # 0x763e5
leaq 0x5fa8c(%rip), %r8      # 0x796ea
callq 0x26c70
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x8, %edx
leaq 0x5c76f(%rip), %rcx     # 0x763ea
leaq 0x5ceda(%rip), %r8      # 0x76b5c
callq 0x26c70
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
xorl %edx, %edx
callq 0x1f8e0
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
movl $0x4, %edx
callq 0x1f8e0
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movq -0x50(%rbp), %rdx
leaq 0x5c71e(%rip), %rcx     # 0x763e5
callq 0x20080
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movq -0x58(%rbp), %rdx
leaq 0x5c707(%rip), %rcx     # 0x763ea
callq 0x20080
movq -0x8(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x1fd10
movq -0x8(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0x1fd10
jmp 0x19d97
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x8, %edx
leaq 0x5c6c6(%rip), %rcx     # 0x763e5
leaq 0x5ce21(%rip), %r8      # 0x76b47
callq 0x26f20
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
xorl %edx, %edx
callq 0x1f8e0
movq %rax, -0x60(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x8(%rbp), %rdi
xorl %edx, %edx
leaq 0x5bb91(%rip), %rcx     # 0x758f8
movl $0x1f9f, %r8d           # imm = 0x1F9F
movzbl -0x21(%rbp), %esi
callq 0x20d10
movq -0x78(%rbp), %rdi
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
movq %rax, %rcx
callq 0x20080
movq -0x8(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0x1fd10
jmp 0x19d99
jmp 0x19dba
leaq 0x596b8(%rip), %rdi     # 0x7345a
leaq 0x5bb4f(%rip), %rsi     # 0x758f8
movl $0x1fa5, %edx           # imm = 0x1FA5
leaq 0x5fa3a(%rip), %rcx     # 0x797ef
callq 0x30a0
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)