def _translate_ret(self, tb, instruction):
        # Flags Affected
        # None.

        imm1 = tb.immediate(1, 1)
        imm8 = tb.immediate(8, self._sp.size)

        tmp0 = tb.temporal(self._sp.size)
        tmp1 = tb.temporal(self._sp.size)
        tmp2 = tb.temporal(self._sp.size + 8)

        tb.add(self._builder.gen_ldm(self._sp, tmp1))
        tb.add(self._builder.gen_add(self._sp, self._ws, tmp0))
        tb.add(self._builder.gen_str(tmp0, self._sp))

        # Free stack.
        if len(instruction.operands) > 0:
            oprnd0 = tb.read(instruction.operands[0])

            imm0 = tb.immediate(oprnd0.immediate & (2**self._sp.size -1), self._sp.size)

            tmp3 = tb.temporal(self._sp.size)

            tb.add(self._builder.gen_add(self._sp, imm0, tmp3))
            tb.add(self._builder.gen_str(tmp3, self._sp))

        tb.add(self._builder.gen_bsh(tmp1, imm8, tmp2))
        tb.add(self._builder.gen_jcc(imm1, tmp2))
dataset/ETHPy150Open programa-stic/barf-project/barf/barf/arch/x86/x86translator.py/X86Translator._translate_ret/original