

def _translate_imul(self, tb, instruction):
    if (len(instruction.operands) == 1):
        oprnd0 = tb.read(instruction.operands[0])
        if (oprnd0.size == 8):
            oprnd1 = ReilRegisterOperand('al', 8)
            tmp0 = tb.temporal(16)
            result_low = ReilRegisterOperand('al', 8)
            result_high = ReilRegisterOperand('ah', 8)
        elif (oprnd0.size == 16):
            oprnd1 = ReilRegisterOperand('ax', 16)
            tmp0 = tb.temporal(32)
            result_low = ReilRegisterOperand('dx', 16)
            result_high = ReilRegisterOperand('ax', 16)
        elif (oprnd0.size == 32):
            oprnd1 = ReilRegisterOperand('eax', 32)
            tmp0 = tb.temporal(64)
            result_low = ReilRegisterOperand('edx', 32)
            result_high = ReilRegisterOperand('eax', 32)
        elif (oprnd0.size == 64):
            oprnd1 = ReilRegisterOperand('rax', 64)
            tmp0 = tb.temporal(64)
            result_low = ReilRegisterOperand('rdx', 64)
            result_high = ReilRegisterOperand('rax', 64)
    elif (len(instruction.operands) == 2):
        oprnd0 = tb.read(instruction.operands[0])
        oprnd1 = tb.read(instruction.operands[1])
    elif (len(instruction.operands) == 3):
        oprnd0 = tb.read(instruction.operands[1])
        oprnd1 = tb.read(instruction.operands[2])
    imm0 = tb.immediate((- oprnd0.size), (2 * oprnd0.size))
    tmp0 = tb.temporal((2 * oprnd0.size))
    tb.add(self._builder.gen_mul(oprnd0, oprnd1, tmp0))
    if (len(instruction.operands) == 1):
        tb.add(self._builder.gen_bsh(tmp0, imm0, result_high))
        tb.add(self._builder.gen_str(tmp0, result_low))
    elif (len(instruction.operands) == 2):
        tb.write(instruction.operands[0], tmp0)
    elif (len(instruction.operands) == 3):
        tb.write(instruction.operands[0], tmp0)
    if (self._translation_mode == FULL_TRANSLATION):
        self._undefine_flag(tb, self._flags['sf'])
        self._undefine_flag(tb, self._flags['zf'])
        self._undefine_flag(tb, self._flags['af'])
        self._undefine_flag(tb, self._flags['pf'])

dataset/ETHPy150Open programa-stic/barf-project/barf/barf/arch/x86/x86translator.py X86Translator._translate_imul/original