// File: /workspace/github_c_makefile_star2_O0/Ihsoh[P]ilang/compiler/assembler/ins_enc.c
// Function: ins_enc_IN_eAX_Ib
void ins_enc_IN_eAX_Ib(
	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 *target_reg = ASM_REG_AST_NODE_GET_REG(target);

	switch (ASM_PARSER_CONTEXT_DATA_GET_ARCH(data->ctx)) {
		case ASM_ARCH_BIT16: {
			switch (target_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 (target_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, source, &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 0x2265c
jmp 0x2267b
leaq 0x274a3(%rip), %rdi     # 0x49b06
leaq 0x289b6(%rip), %rsi     # 0x4b020
movl $0x5d5, %edx            # imm = 0x5D5
leaq 0x293f8(%rip), %rcx     # 0x4ba6e
callq 0xa0b0
cmpq $0x0, -0x10(%rbp)
je 0x22684
jmp 0x226a3
leaq 0x2d964(%rip), %rdi     # 0x4ffef
leaq 0x2898e(%rip), %rsi     # 0x4b020
movl $0x5d5, %edx            # imm = 0x5D5
leaq 0x293d0(%rip), %rcx     # 0x4ba6e
callq 0xa0b0
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
je 0x226af
jmp 0x226ce
leaq 0x289c7(%rip), %rdi     # 0x4b07d
leaq 0x28963(%rip), %rsi     # 0x4b020
movl $0x5d5, %edx            # imm = 0x5D5
leaq 0x293a5(%rip), %rcx     # 0x4ba6e
callq 0xa0b0
movq -0x10(%rbp), %rax
movq (%rax), %rax
cmpl $0x2, 0x44(%rax)
jne 0x226dd
jmp 0x226fc
leaq 0x289a8(%rip), %rdi     # 0x4b08c
leaq 0x28935(%rip), %rsi     # 0x4b020
movl $0x5d5, %edx            # imm = 0x5D5
leaq 0x29377(%rip), %rcx     # 0x4ba6e
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 -0x20(%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 0x22789
jmp 0x2276c
movl -0x94(%rbp), %eax
subl $0x2, %eax
je 0x227d6
jmp 0x22779
movl -0x94(%rbp), %eax
subl $0x4, %eax
je 0x227d6
jmp 0x22823
movq -0x90(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, -0x98(%rbp)
subl $0x3, %eax
je 0x227ad
jmp 0x227a0
movl -0x98(%rbp), %eax
subl $0x4, %eax
je 0x227af
jmp 0x227b5
jmp 0x227d4
movb $0x1, -0x7d(%rbp)
jmp 0x227d4
leaq 0x24ca9(%rip), %rdi     # 0x47465
leaq 0x2885d(%rip), %rsi     # 0x4b020
movl $0x5ef, %edx            # imm = 0x5EF
leaq 0x2929f(%rip), %rcx     # 0x4ba6e
callq 0xa0b0
jmp 0x22842
movq -0x90(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, -0x9c(%rbp)
subl $0x3, %eax
je 0x227fa
jmp 0x227ed
movl -0x9c(%rbp), %eax
subl $0x4, %eax
je 0x22800
jmp 0x22802
movb $0x1, -0x7d(%rbp)
jmp 0x22821
jmp 0x22821
leaq 0x24c5c(%rip), %rdi     # 0x47465
leaq 0x28810(%rip), %rsi     # 0x4b020
movl $0x601, %edx            # imm = 0x601
leaq 0x29252(%rip), %rcx     # 0x4ba6e
callq 0xa0b0
jmp 0x22842
leaq 0x24c3b(%rip), %rdi     # 0x47465
leaq 0x287ef(%rip), %rsi     # 0x4b020
movl $0x608, %edx            # imm = 0x608
leaq 0x29231(%rip), %rcx     # 0x4ba6e
callq 0xa0b0
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x8(%rbp), %rsi
movq -0x28(%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)