

def _translate_shr(self, tb, instruction):
    oprnd0 = tb.read(instruction.operands[0])
    oprnd1 = tb.read(instruction.operands[1])
    imm0 = tb.immediate(1, oprnd0.size)
    imm1 = tb.immediate(((2 ** oprnd0.size) - 1), oprnd0.size)
    imm2 = tb.immediate((- 1), oprnd0.size)
    tmp0 = tb.temporal(oprnd0.size)
    tmp1 = tb.temporal(oprnd0.size)
    tmp2 = tb.temporal(oprnd0.size)
    tmp3 = tb.temporal(oprnd0.size)
    tmp4 = tb.temporal(oprnd0.size)
    tmp5 = tb.temporal(oprnd0.size)
    tmp6 = tb.temporal(oprnd0.size)
    tb.add(self._builder.gen_str(oprnd1, tmp0))
    tb.add(self._builder.gen_sub(tmp0, imm0, tmp1))
    tb.add(self._builder.gen_xor(tmp1, imm1, tmp2))
    tb.add(self._builder.gen_add(tmp2, imm0, tmp3))
    tb.add(self._builder.gen_bsh(oprnd0, tmp3, tmp4))
    tb.add(self._builder.gen_and(tmp4, imm0, tmp5))
    tb.add(self._builder.gen_str(tmp5, self._flags['cf']))
    tb.add(self._builder.gen_bsh(tmp4, imm2, tmp6))
    if (self._translation_mode == FULL_TRANSLATION):
        self._update_sf(tb, oprnd0, oprnd0, tmp6)
        self._update_zf(tb, oprnd0, oprnd0, tmp6)
        self._update_pf(tb, oprnd0, oprnd0, tmp6)
        self._undefine_flag(tb, self._flags['af'])
    tb.write(instruction.operands[0], tmp6)

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