def _disassemble_bb(self, start_address, end_address, symbols):
        bb = BasicBlock()
        addr = start_address
        taken, not_taken, direct = None, None, None

        while addr < end_address:
            try:
                start, end = addr, min(addr + self._lookahead_max, end_address)
                data_chunk = self._mem[start:end]
            except Exception:
                # TODO: Log error.
                break

            try:
                asm = self._disasm.disassemble(data_chunk, addr)
            except (InvalidDisassemblerData, CapstoneOperandNotSupported):
                break

            if not asm:
                break

            ir = self._ir_trans.translate(asm)

            bb.instrs.append(DualInstruction(addr, asm, ir))

            # TODO: Process instructions without resorting to
            # asm.mnemonic or asm.prefix.

            # If it is a RET instruction, break.
            if ir[-1].mnemonic == ReilMnemonic.RET:
                break

            # If it is a x86 hlt instruction, break.
            if asm.mnemonic == "hlt":
                break

            # If callee does not return, break.
            if  ir[-1].mnemonic == ReilMnemonic.JCC and \
                asm.mnemonic == "call" and \
                isinstance(ir[-1].operands[2], ReilImmediateOperand) and \
                (ir[-1].operands[2].immediate >> 0x8) in symbols and \
                not symbols[ir[-1].operands[2].immediate >> 0x8][2]:
                break

            # If it is a JCC instruction, process it and break.
            if  ir[-1].mnemonic == ReilMnemonic.JCC and \
                not asm.mnemonic == "call" and \
                not asm.mnemonic == "blx" and \
                not asm.mnemonic == "bl" and \
                not asm.prefix in ["rep", "repe", "repne", "repz"]:
                taken, not_taken, direct = self._extract_branches(asm, ir)
                break

            # Process ARM instrs: pop reg, {reg*, pc}
            if  self._arch_info == ARCH_ARM and \
                asm.mnemonic == "pop" and \
                str(asm.operands[1]) in "pc":
                break

            # Process ARM instrs: ldr pc, *
            if  self._arch_info == ARCH_ARM and \
                asm.mnemonic == "ldr" and \
                "pc" in str(asm.operands[0]):
                break

            # Update instruction pointer and iterate.
            addr += asm.size

        bb.taken_branch = taken
        bb.not_taken_branch = not_taken
        bb.direct_branch = direct

        return bb
dataset/ETHPy150Open programa-stic/barf-project/barf/barf/analysis/basicblock/basicblock.py/BasicBlockBuilder._disassemble_bb/swapped operands of `in`