

def _rep_prefix_begin(self, tb, instruction):
    if (self._arch_info.address_size == 16):
        counter = ReilRegisterOperand('cx', 16)
    elif (self._arch_info.address_size == 32):
        counter = ReilRegisterOperand('ecx', 32)
    elif (self._arch_info.address_size == 64):
        counter = ReilRegisterOperand('rcx', 64)
    else:
        raise Exception('Invalid address size: %d', self._arch_info.address_size)
    loop_start_lbl = Label('loop_start')
    end_addr = ReilImmediateOperand(((instruction.address + instruction.size) << 8), (self._arch_info.address_size + 8))
    counter_zero = tb.temporal(1)
    tb.add(loop_start_lbl)
    tb.add(self._builder.gen_bisz(counter, counter_zero))
    tb.add(self._builder.gen_jcc(counter_zero, end_addr))
    return (counter, loop_start_lbl)

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