

def _translate_cmpxchg(self, tb, instruction):
    oprnd0 = tb.read(instruction.operands[0])
    oprnd1 = tb.read(instruction.operands[1])
    end_addr = ReilImmediateOperand(((instruction.address + instruction.size) << 8), (self._arch_info.address_size + 8))
    if (oprnd0.size == 8):
        accum = ReilRegisterOperand('al', 8)
        accum_x86 = X86RegisterOperand('al', 8)
    elif (oprnd0.size == 16):
        accum = ReilRegisterOperand('ax', 16)
        accum_x86 = X86RegisterOperand('ax', 16)
    elif (oprnd0.size == 32):
        accum = ReilRegisterOperand('eax', 32)
        accum_x86 = X86RegisterOperand('eax', 32)
    elif (oprnd0.size == 64):
        accum = ReilRegisterOperand('rax', 64)
        accum_x86 = X86RegisterOperand('rax', 64)
    else:
        raise Exception(('Invalid operand size: %s' % oprnd0))
    tmp0 = tb.temporal((oprnd0.size * 2))
    one = tb.immediate(1, 1)
    change_dst_lbl = Label('change_dst')
    change_accum_lbl = Label('change_accum')
    tb.add(self._builder.gen_sub(accum, oprnd0, tmp0))
    self._update_cf(tb, accum, oprnd0, tmp0)
    self._update_of_sub(tb, accum, oprnd0, tmp0)
    self._update_sf(tb, accum, oprnd0, tmp0)
    self._update_zf(tb, accum, oprnd0, tmp0)
    self._update_af(tb, accum, oprnd0, tmp0)
    self._update_pf(tb, accum, oprnd0, tmp0)
    tb.add(self._builder.gen_jcc(tmp0, change_accum_lbl))
    tb.add(change_dst_lbl)
    tb.write(end_addr.operands[0], oprnd1)
    tb.add(self._builder.gen_jcc(one, end_addr))
    tb.add(change_accum_lbl)
    tb.write(accum_x86, oprnd0)

dataset/ETHPy150Open programa-stic/barf-project/barf/barf/arch/x86/x86translator.py X86Translator._translate_cmpxchg/VarMisuse@369/549 `instruction`->`end_addr`