// File: /workspace/github_c_makefile_star2_O0/Ihsoh[P]ilang/compiler/assembler/ins_enc.c
// Function: ins_enc_OUT_Ib_eAX
void ins_enc_OUT_Ib_eAX(
	Instruction *ins,
	InstructionEncoderData *data
) {
	_CHECK_PARAMS(2);

	ParserASTNode *ins_node = data->ins_node;

	ParserASTNode *target = ins_node->childs[0];

	ParserASTNode *source = ins_node->childs[1];

	EncoderInstruction enc_ins;

	ins_init(data->ctx, ins, ins_node, &enc_ins);

	InsRegister *source_reg = ASM_REG_AST_NODE_GET_REG(source);

	switch (ASM_PARSER_CONTEXT_DATA_GET_ARCH(data->ctx)) {
		case ASM_ARCH_BIT16: {
			switch (source_reg->type) {
				case INS_REGISTER_GENERAL_2BYTE: {
					// 无需操作数大小前缀。
					break;
				}
				case INS_REGISTER_GENERAL_4BYTE: {
					enc_ins.legacy_prefix.operand_size_override = true;
					break;
				}
				default: {
					assert(0);
					break;
				}
			}
			break;
		}
		case ASM_ARCH_BIT32:
		case ASM_ARCH_BIT64: {
			switch (source_reg->type) {
				case INS_REGISTER_GENERAL_2BYTE: {
					enc_ins.legacy_prefix.operand_size_override = true;
					break;
				}
				case INS_REGISTER_GENERAL_4BYTE: {
					// 无需操作数大小前缀。
					break;
				}
				default: {
					assert(0);
					break;
				}
			}
			break;
		}
		default: {
			assert(0);
			break;
		}
	}

	ins_fill_imm8(data->ctx, ins, target, &enc_ins);

	_output(data, &enc_ins);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x229bc
jmp 0x229db
leaq 0x27143(%rip), %rdi     # 0x49b06
leaq 0x28656(%rip), %rsi     # 0x4b020
movl $0x629, %edx            # imm = 0x629
leaq 0x29118(%rip), %rcx     # 0x4baee
callq 0xa0b0
cmpq $0x0, -0x10(%rbp)
je 0x229e4
jmp 0x22a03
leaq 0x2d604(%rip), %rdi     # 0x4ffef
leaq 0x2862e(%rip), %rsi     # 0x4b020
movl $0x629, %edx            # imm = 0x629
leaq 0x290f0(%rip), %rcx     # 0x4baee
callq 0xa0b0
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
je 0x22a0f
jmp 0x22a2e
leaq 0x28667(%rip), %rdi     # 0x4b07d
leaq 0x28603(%rip), %rsi     # 0x4b020
movl $0x629, %edx            # imm = 0x629
leaq 0x290c5(%rip), %rcx     # 0x4baee
callq 0xa0b0
movq -0x10(%rbp), %rax
movq (%rax), %rax
cmpl $0x2, 0x44(%rax)
jne 0x22a3d
jmp 0x22a5c
leaq 0x28648(%rip), %rdi     # 0x4b08c
leaq 0x285d5(%rip), %rsi     # 0x4b020
movl $0x629, %edx            # imm = 0x629
leaq 0x29097(%rip), %rcx     # 0x4baee
callq 0xa0b0
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x8(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq -0x88(%rbp), %rcx
callq 0x1a9e0
movq -0x28(%rbp), %rax
movq 0x60(%rax), %rax
movq %rax, -0x90(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movl 0xb0(%rax), %eax
movl %eax, -0x94(%rbp)
subl $0x1, %eax
je 0x22ae9
jmp 0x22acc
movl -0x94(%rbp), %eax
subl $0x2, %eax
je 0x22b36
jmp 0x22ad9
movl -0x94(%rbp), %eax
subl $0x4, %eax
je 0x22b36
jmp 0x22b83
movq -0x90(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, -0x98(%rbp)
subl $0x3, %eax
je 0x22b0d
jmp 0x22b00
movl -0x98(%rbp), %eax
subl $0x4, %eax
je 0x22b0f
jmp 0x22b15
jmp 0x22b34
movb $0x1, -0x7d(%rbp)
jmp 0x22b34
leaq 0x24949(%rip), %rdi     # 0x47465
leaq 0x284fd(%rip), %rsi     # 0x4b020
movl $0x643, %edx            # imm = 0x643
leaq 0x28fbf(%rip), %rcx     # 0x4baee
callq 0xa0b0
jmp 0x22ba2
movq -0x90(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, -0x9c(%rbp)
subl $0x3, %eax
je 0x22b5a
jmp 0x22b4d
movl -0x9c(%rbp), %eax
subl $0x4, %eax
je 0x22b60
jmp 0x22b62
movb $0x1, -0x7d(%rbp)
jmp 0x22b81
jmp 0x22b81
leaq 0x248fc(%rip), %rdi     # 0x47465
leaq 0x284b0(%rip), %rsi     # 0x4b020
movl $0x655, %edx            # imm = 0x655
leaq 0x28f72(%rip), %rcx     # 0x4baee
callq 0xa0b0
jmp 0x22ba2
leaq 0x248db(%rip), %rdi     # 0x47465
leaq 0x2848f(%rip), %rsi     # 0x4b020
movl $0x65c, %edx            # imm = 0x65C
leaq 0x28f51(%rip), %rcx     # 0x4baee
callq 0xa0b0
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x8(%rbp), %rsi
movq -0x20(%rbp), %rdx
leaq -0x88(%rbp), %rcx
callq 0x1b800
movq -0x10(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x1e570
addq $0xa0, %rsp
popq %rbp
retq
nopw (%rax,%rax)