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

	ParserASTNode *ins_node = data->ins_node;

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

	EncoderInstruction enc_ins;

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

	int arch = ASM_PARSER_CONTEXT_DATA_GET_ARCH(data->ctx);

	InsRegister *target_reg = ASM_REG_AST_NODE_GET_REG(target);

	switch (arch) {
		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: {
			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;
		}
	}

	_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 0x1f2cc
jmp 0x1f2eb
leaq 0x2a833(%rip), %rdi     # 0x49b06
leaq 0x2bd46(%rip), %rsi     # 0x4b020
movl $0x130, %edx            # imm = 0x130
leaq 0x2bfd7(%rip), %rcx     # 0x4b2bd
callq 0xa0b0
cmpq $0x0, -0x10(%rbp)
je 0x1f2f4
jmp 0x1f313
leaq 0x30cf4(%rip), %rdi     # 0x4ffef
leaq 0x2bd1e(%rip), %rsi     # 0x4b020
movl $0x130, %edx            # imm = 0x130
leaq 0x2bfaf(%rip), %rcx     # 0x4b2bd
callq 0xa0b0
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
je 0x1f31f
jmp 0x1f33e
leaq 0x2bd57(%rip), %rdi     # 0x4b07d
leaq 0x2bcf3(%rip), %rsi     # 0x4b020
movl $0x130, %edx            # imm = 0x130
leaq 0x2bf84(%rip), %rcx     # 0x4b2bd
callq 0xa0b0
movq -0x10(%rbp), %rax
movq (%rax), %rax
cmpl $0x1, 0x44(%rax)
jne 0x1f34d
jmp 0x1f36c
leaq 0x2bfaa(%rip), %rdi     # 0x4b2fe
leaq 0x2bcc5(%rip), %rsi     # 0x4b020
movl $0x130, %edx            # imm = 0x130
leaq 0x2bf56(%rip), %rcx     # 0x4b2bd
callq 0xa0b0
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x48(%rax), %rax
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x8(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq -0x80(%rbp), %rcx
callq 0x1a9e0
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movl 0xb0(%rax), %eax
movl %eax, -0x84(%rbp)
movq -0x20(%rbp), %rax
movq 0x60(%rax), %rax
movq %rax, -0x90(%rbp)
movl -0x84(%rbp), %eax
movl %eax, -0x94(%rbp)
subl $0x1, %eax
je 0x1f3e8
jmp 0x1f3d8
movl -0x94(%rbp), %eax
subl $0x2, %eax
je 0x1f435
jmp 0x1f482
movq -0x90(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, -0x98(%rbp)
subl $0x3, %eax
je 0x1f40c
jmp 0x1f3ff
movl -0x98(%rbp), %eax
subl $0x4, %eax
je 0x1f40e
jmp 0x1f414
jmp 0x1f433
movb $0x1, -0x75(%rbp)
jmp 0x1f433
leaq 0x2804a(%rip), %rdi     # 0x47465
leaq 0x2bbfe(%rip), %rsi     # 0x4b020
movl $0x14a, %edx            # imm = 0x14A
leaq 0x2be8f(%rip), %rcx     # 0x4b2bd
callq 0xa0b0
jmp 0x1f4a1
movq -0x90(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, -0x9c(%rbp)
subl $0x3, %eax
je 0x1f459
jmp 0x1f44c
movl -0x9c(%rbp), %eax
subl $0x4, %eax
je 0x1f45f
jmp 0x1f461
movb $0x1, -0x75(%rbp)
jmp 0x1f480
jmp 0x1f480
leaq 0x27ffd(%rip), %rdi     # 0x47465
leaq 0x2bbb1(%rip), %rsi     # 0x4b020
movl $0x15b, %edx            # imm = 0x15B
leaq 0x2be42(%rip), %rcx     # 0x4b2bd
callq 0xa0b0
jmp 0x1f4a1
leaq 0x27fdc(%rip), %rdi     # 0x47465
leaq 0x2bb90(%rip), %rsi     # 0x4b020
movl $0x162, %edx            # imm = 0x162
leaq 0x2be21(%rip), %rcx     # 0x4b2bd
callq 0xa0b0
movq -0x10(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x1e570
addq $0xa0, %rsp
popq %rbp
retq
nopw (%rax,%rax)