def _translate_cmpxchg(self, tb, instruction):
        # Flags Affected
        # The ZF flag is set if the values in the destination operand
        # and register AL, AX, or EAX are equal; otherwise it is
        # cleared. The CF, PF, AF, SF, and OF flags are set according
        # to the results of the comparison operation.

        # Accumulator = AL, AX, EAX, or RAX depending on whether a byte,
        # word, doubleword, or quadword comparison is being performed
        # IF accumulator = DEST
        # THEN
        #   ZF <- 1;
        #   DEST <- SRC;
        # ELSE
        #   ZF <- 0;
        #   accumulator <- DEST;
        # FI;

        oprnd0 = tb.read(instruction.operands[0])
        oprnd1 = tb.read(instruction.operands[1])

        # Define immediate registers
        end_addr = ReilImmediateOperand((instruction.address + instruction.size) << 8, self._arch_info.address_size + 8)

        # Define accum register.
        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')

        # Compare.
        tb.add(self._builder.gen_sub(accum, oprnd0, tmp0))

        # Update flags : CF, OF, SF, ZF, AF, PF
        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)

        # Exchange
        tb.add(self._builder.gen_jcc(tmp0, change_accum_lbl))
        tb.add(change_dst_lbl)
        tb.write(instruction.operands[0], oprnd1)
        tb.add(self._builder.gen_jcc(one, end_addr))
        tb.add(change_accum_lbl)
        # tb.add(self._builder.gen_str(oprnd0, accum))
        tb.write(accum_x86, oprnd0)

# "Binary Arithmetic Instructions"
# ============================================================================ #
dataset/ETHPy150Open programa-stic/barf-project/barf/barf/arch/x86/x86translator.py/X86Translator._translate_cmpxchg/operator `==` -> `<=`