// File: /workspace/github_c_makefile_star2_O2/buptlxb[P]xRay/disasm/Routines_ModRM.c
// Function: Reg_Opcode
void __bea_callspec__ Reg_Opcode(ARGTYPE* pMyArgument, PDISASM pMyDisasm)
{
    size_t i = 0;
    if (!Security(1, pMyDisasm)) return;
    GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7;
    if (GV.REX.R_ == 1) {
        GV.REGOPCODE += 0x8;
    }
    if (GV.MMX_  == 1) {
        #ifndef BEA_LIGHT_DISASSEMBLY
           (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersMMX[GV.REGOPCODE]);
        #endif
        (*pMyArgument).ArgType = REGISTER_TYPE+MMX_REG+REGS[GV.REGOPCODE];
        (*pMyArgument).ArgSize = 64;
    }
    else if (GV.SEG_ == 1) {
        #ifndef BEA_LIGHT_DISASSEMBLY
           (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSEG[GV.REGOPCODE]);
        #endif
        (*pMyArgument).ArgType = REGISTER_TYPE+SEGMENT_REG+REGS[GV.REGOPCODE];
        (*pMyArgument).ArgSize = 16;
    }
    else if (GV.CR_ == 1) {
        #ifndef BEA_LIGHT_DISASSEMBLY
           (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersCR[GV.REGOPCODE]);
        #endif
        (*pMyArgument).ArgType = REGISTER_TYPE+CR_REG+REGS[GV.REGOPCODE];
        (*pMyArgument).ArgSize = 32;
    }
    else if (GV.DR_ == 1) {
        if (GV.SYNTAX_ == ATSyntax) {
            #ifndef BEA_LIGHT_DISASSEMBLY
               (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersDR_AT[GV.REGOPCODE]);
            #endif
        }
        else {
            #ifndef BEA_LIGHT_DISASSEMBLY
               (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersDR[GV.REGOPCODE]);
            #endif
        }
        (*pMyArgument).ArgType = REGISTER_TYPE+DR_REG+REGS[GV.REGOPCODE];
        (*pMyArgument).ArgSize = 32;
    }
    else if (GV.SSE_ == 1) {
        #ifndef BEA_LIGHT_DISASSEMBLY
           (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[GV.REGOPCODE]);
        #endif
        (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[GV.REGOPCODE];
        (*pMyArgument).ArgSize = 128;
    }
    else if (GV.OperandSize == 8) {
        if (GV.REX.state == 0) {
            #ifndef BEA_LIGHT_DISASSEMBLY
               (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8BitsLegacy[GV.REGOPCODE]);
            #endif
            (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS8BITS[GV.REGOPCODE];
			if (GV.REGOPCODE >= 4) {
				(*pMyArgument).ArgPosition = HighPosition;
			}
            (*pMyArgument).ArgSize = 8;
        }
        else {
            #ifndef BEA_LIGHT_DISASSEMBLY
               (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[GV.REGOPCODE]);
            #endif
            (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[GV.REGOPCODE];
            (*pMyArgument).ArgSize = 8;
        }
    }
    else if (GV.OperandSize == 16) {
        #ifndef BEA_LIGHT_DISASSEMBLY
           (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[GV.REGOPCODE]);
        #endif
        (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[GV.REGOPCODE];
        (*pMyArgument).ArgSize = 16;
    }
    else if (GV.OperandSize == 32) {
        #ifndef BEA_LIGHT_DISASSEMBLY
           (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.REGOPCODE]);
        #endif
        (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[GV.REGOPCODE];
        (*pMyArgument).ArgSize = 32;
    }
    else if (GV.OperandSize == 64) {
        #ifndef BEA_LIGHT_DISASSEMBLY
           (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.REGOPCODE]);
        #endif
        (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[GV.REGOPCODE];
        (*pMyArgument).ArgSize = 64;
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq 0x1f0(%rsi), %rax
movq 0x250(%rsi), %rcx
incq %rax
decq %rcx
cmpq %rax, %rcx
jae 0x2893a
movl $0x1, 0x289(%r14)
jmp 0x28a72
movq %rdi, %rbx
movzbl (%rax), %eax
shrl $0x3, %eax
andl $0x7, %eax
movl %eax, 0x240(%r14)
cmpb $0x1, 0x285(%r14)
jne 0x28961
orl $0x8, %eax
movl %eax, 0x240(%r14)
cmpl $0x1, 0x22c(%r14)
jne 0x289a5
movl %eax, %eax
leaq 0xe44c(%rip), %rcx      # 0x36dc0
leaq (%rcx,%rax,4), %rsi
movq %rbx, %rdi
callq 0x8170
movslq 0x240(%r14), %rax
leaq 0xe4d2(%rip), %rcx      # 0x36e60
movl $0x20010000, %edx       # imm = 0x20010000
addl (%rcx,%rax,4), %edx
movl %edx, 0x40(%rbx)
movl $0x40, 0x44(%rbx)
jmp 0x28a72
cmpl $0x1, 0x23c(%r14)
jne 0x289e9
movl %eax, %eax
leaq 0xdf88(%rip), %rcx      # 0x36940
leaq (%rcx,%rax,8), %rsi
movq %rbx, %rdi
callq 0x8170
movslq 0x240(%r14), %rax
leaq 0xe48e(%rip), %rcx      # 0x36e60
movl $0x21000000, %edx       # imm = 0x21000000
addl (%rcx,%rax,4), %edx
movl %edx, 0x40(%rbx)
movl $0x10, 0x44(%rbx)
jmp 0x28a72
cmpl $0x1, 0x234(%r14)
jne 0x28a1d
movl %eax, %eax
leaq 0xe144(%rip), %rcx      # 0x36b40
leaq (%rcx,%rax,8), %rsi
movq %rbx, %rdi
callq 0x8170
movslq 0x240(%r14), %rax
leaq 0xe44a(%rip), %rcx      # 0x36e60
movl $0x20100000, %edx       # imm = 0x20100000
jmp 0x28a65
cmpl $0x1, 0x238(%r14)
jne 0x28a7a
cmpl $0x400, 0x24c(%r14) # imm = 0x400
leaq 0xe087(%rip), %rcx      # 0x36ac0
leaq 0xe000(%rip), %rdx      # 0x36a40
cmoveq %rcx, %rdx
movl %eax, %eax
leaq (%rdx,%rax,8), %rsi
movq %rbx, %rdi
callq 0x8170
movslq 0x240(%r14), %rax
leaq 0xe400(%rip), %rcx      # 0x36e60
movl $0x20200000, %edx       # imm = 0x20200000
addl (%rcx,%rax,4), %edx
movl %edx, 0x40(%rbx)
movl $0x20, 0x44(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
cmpl $0x1, 0x230(%r14)
jne 0x28abb
movl %eax, %eax
leaq 0xe353(%rip), %rcx      # 0x36de0
leaq (%rcx,%rax,8), %rsi
movq %rbx, %rdi
callq 0x8170
movslq 0x240(%r14), %rax
leaq 0xe3b9(%rip), %rcx      # 0x36e60
movl $0x20080000, %edx       # imm = 0x20080000
addl (%rcx,%rax,4), %edx
movl %edx, 0x40(%rbx)
movl $0x80, 0x44(%rbx)
jmp 0x28a72
movl 0x20c(%r14), %ecx
addl $-0x8, %ecx
roll $0x1d, %ecx
cmpl $0x7, %ecx
ja 0x28a72
leaq 0x1ec4(%rip), %rdx      # 0x2a998
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
cmpb $0x0, 0x288(%r14)
movl %eax, %eax
je 0x28ba5
leaq 0xe24c(%rip), %rcx      # 0x36d40
leaq (%rcx,%rax,8), %rsi
movq %rbx, %rdi
callq 0x8170
movslq 0x240(%r14), %rax
leaq 0xe352(%rip), %rcx      # 0x36e60
movl $0x20020000, %edx       # imm = 0x20020000
addl (%rcx,%rax,4), %edx
movl %edx, 0x40(%rbx)
jmp 0x28bde
movl %eax, %eax
leaq 0xe0d9(%rip), %rcx      # 0x36c00
leaq (%rcx,%rax,8), %rsi
movq %rbx, %rdi
callq 0x8170
movslq 0x240(%r14), %rax
leaq 0xe31f(%rip), %rcx      # 0x36e60
movl $0x20020000, %edx       # imm = 0x20020000
jmp 0x28a65
movl %eax, %eax
leaq 0xe12c(%rip), %rcx      # 0x36c80
leaq (%rcx,%rax,8), %rsi
movq %rbx, %rdi
callq 0x8170
movslq 0x240(%r14), %rax
leaq 0xe2f2(%rip), %rcx      # 0x36e60
movl $0x20020000, %edx       # imm = 0x20020000
jmp 0x289d7
movl %eax, %eax
leaq 0xe03f(%rip), %rcx      # 0x36bc0
leaq (%rcx,%rax,4), %rsi
movq %rbx, %rdi
callq 0x8170
movslq 0x240(%r14), %rax
leaq 0xe2c5(%rip), %rcx      # 0x36e60
movl $0x20020000, %edx       # imm = 0x20020000
jmp 0x28993
leaq 0xe154(%rip), %rcx      # 0x36d00
leaq (%rcx,%rax,4), %rsi
movq %rbx, %rdi
callq 0x8170
movslq 0x240(%r14), %rax
leaq 0xe15a(%rip), %rcx      # 0x36d20
movl $0x20020000, %edx       # imm = 0x20020000
addl (%rcx,%rax,4), %edx
movl %edx, 0x40(%rbx)
cmpq $0x4, %rax
jl 0x28bde
movl $0x1, 0x48(%rbx)
movl $0x8, 0x44(%rbx)
jmp 0x28a72