def _translate_neg(self, tb, instruction):
        # Flags Affected
        # The CF flag set to 0 if the source operand is 0; otherwise it
        # is set to 1. The OF, SF, ZF, AF, and PF flags are set
        # according to the result.

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

        imm0 = tb.immediate((2**oprnd0.size)-1, oprnd0.size)
        imm1 = tb.immediate(1, oprnd0.size)
        imm2 = tb.immediate(1, 1)

        tmp0 = tb.temporal(oprnd0.size)
        tmp1 = tb.temporal(oprnd0.size)
        tmp2 = tb.temporal(1)

        tb.add(self._builder.gen_xor(oprnd0, imm0, tmp0))
        tb.add(self._builder.gen_add(tmp0, imm1, tmp1))

        # Flags : CF
        tb.add(self._builder.gen_bisz(oprnd0, tmp2))
        tb.add(self._builder.gen_xor(tmp2, imm2, self._flags["cf"]))

        if self._translation_mode == FULL_TRANSLATION:
            # Flags : OF, SF, ZF, AF, PF
            self._update_of_sub(tb, oprnd0, oprnd0, tmp1)
            self._update_sf(tb, oprnd0, oprnd0, tmp1)
            self._update_zf(tb, oprnd0, oprnd0, tmp1)
            self._update_af(tb, oprnd0, oprnd0, tmp1)
            self._update_pf(tb, oprnd0, oprnd0, tmp1)

        tb.write(instruction.operands[0], tmp1)
dataset/ETHPy150Open programa-stic/barf-project/barf/barf/arch/x86/x86translator.py/X86Translator._translate_neg/original