Process a list of instructions by merging subsequent instuctions with
    identical opcodes into "large instructions".
967529
def merge_specific_instructions(chunks, join_preamble=True, join_raster=True):
    
    new_instructions = []
    last_opcode = None
    instruction_buffer = b''
    for instruction in chunks:
        opcode = match_opcode(instruction)
        if   join_preamble and OPCODES[opcode][0] == 'preamble' and last_opcode == 'preamble':
            instruction_buffer += instruction
        elif join_raster   and 'raster' in OPCODES[opcode][0] and 'raster' in last_opcode:
            instruction_buffer += instruction
        else:
            if instruction_buffer:
                new_instructions.append(instruction_buffer)
            instruction_buffer = instruction
        last_opcode = OPCODES[opcode][0]
    if instruction_buffer:
        new_instructions.append(instruction_buffer)
    return new_instructions
131071
private int combine_blocks(long addr)
    throws IOException
    {
        long cum_length;
        int length;
        long next_addr = addr;

        length = readInt();
        if (length > 0) {
            while ((length > 0) && (next_addr + length < tail_ptr)) {
                next_addr += length;
                seek(next_addr);
                length = readInt();
            }
            if (length < 0) {
                cum_length = next_addr - addr;
                seek(addr);
                writeInt((int) cum_length);
            } else {
                cum_length = tail_ptr - addr;
            }
            return(int) cum_length;
        } else {
            return length;
        }
    }
464607
def disassemble(self, lineno_width=3,
                    mark_as_current=False,
                    asm_format=False,
                    show_bytes=False):
        
        fields = []
        if asm_format:
            indexed_operand = set(['name', 'local', 'compare', 'free'])
        # Column: Source code line number
        if lineno_width:
            if self.starts_line is not None:
                if asm_format:
                    lineno_fmt = "%%%dd:\n" % lineno_width
                    fields.append(lineno_fmt % self.starts_line)
                    fields.append(' ' * (lineno_width))
                    if self.is_jump_target:
                        fields.append(' ' * (lineno_width-1))
                else:
                    lineno_fmt = "%%%dd:" % lineno_width
                    fields.append(lineno_fmt % self.starts_line)
            else:
                fields.append(' ' * (lineno_width+1))
        # Column: Current instruction indicator
        if mark_as_current and not asm_format:
            fields.append('-->')
        else:
            fields.append('   ')
        # Column: Jump target marker
        if self.is_jump_target:
            if not asm_format:
                fields.append('>>')
            else:
                fields = ["L%d:\n" % self.offset] + fields
                if not self.starts_line:
                    fields.append(' ')
        else:
            fields.append('  ')
        # Column: Instruction offset from start of code sequence
        if not asm_format:
            fields.append(repr(self.offset).rjust(4))

        if show_bytes:
            hex_bytecode = "|%02x" % self.opcode
            if self.inst_size == 1:
                # Not 3.6 or later
                hex_bytecode += ' ' * (2*3)
            if self.inst_size == 2:
                # Must by Python 3.6 or later
                if self.has_arg:
                    hex_bytecode += " %02x" % (self.arg % 256)
                else :
                    hex_bytecode += ' 00'
            elif self.inst_size == 3:
                # Not 3.6 or later
                hex_bytecode += " %02x %02x" % (
                    (self.arg >> 8, self.arg % 256))

            fields.append(hex_bytecode + '|')

        # Column: Opcode name
        fields.append(self.opname.ljust(20))

        # Column: Opcode argument
        if self.arg is not None:
            argrepr = self.argrepr
            if asm_format:
                if self.optype == 'jabs':
                    fields.append('L' + str(self.arg))
                elif self.optype == 'jrel':
                    argval = self.offset + self.arg + self.inst_size
                    fields.append('L' + str(argval))
                elif self.optype in indexed_operand:
                    fields.append('(%s)' % argrepr)
                    argrepr = None
                elif (self.optype == 'const'
                      and not re.search('\s', argrepr)):
                    fields.append('(%s)' % argrepr)
                    argrepr = None
                else:
                    fields.append(repr(self.arg))
            elif not (show_bytes and argrepr):
                fields.append(repr(self.arg).rjust(6))
            # Column: Opcode argument details
            if argrepr:
                fields.append('(%s)' % argrepr)
                pass
            pass
        return ' '.join(fields).rstrip()
1106861
def makebunches(data, commdct):
    """"""
    bunchdt = {}
    ddtt, dtls = data.dt, data.dtls
    for obj_i, key in enumerate(dtls):
        key = key.upper()
        bunchdt[key] = []
        objs = ddtt[key]
        for obj in objs:
            bobj = makeabunch(commdct, obj, obj_i)
            bunchdt[key].append(bobj)
    return bunchdt
257146
def write_instruction(fout, start_pos, ins):
    
    opcode, operands = ins.opcode, ins.operands
    fmt_operands = opcode_table[opcode]['operands']

    if ins.wide:
        # The "WIDE" prefix
        fout.write(pack('>B', 0xC4))
        # The real opcode.
        fout.write(pack('>B', opcode))
        fout.write(pack('>H', operands[0].value))
        if opcode == 0x84:
            fout.write(pack('>h', operands[1].value))
    elif fmt_operands:
        # A normal simple opcode with simple operands.
        fout.write(pack('>B', opcode))
        for i, (fmt, _) in enumerate(fmt_operands):
            fout.write(fmt.value.pack(operands[i].value))
    elif opcode == 0xAB:
        # Special case for lookupswitch.
        fout.write(pack('>B', opcode))
        # assemble([
        #     ('lookupswitch', {
        #         2: -3,
        #         4: 5
        #     }, <default>)
        # ])
        padding = 4 - (start_pos + 1) % 4
        padding = padding if padding != 4 else 0
        fout.write(pack(f'{padding}x'))
        fout.write(pack('>ii', operands[1].value, len(operands[0])))
        for key in sorted(operands[0].keys()):
            fout.write(pack('>ii', key, operands[0][key]))
    elif opcode == 0xAA:
        # Special case for table switch.
        fout.write(pack('>B', opcode))
        padding = 4 - (start_pos + 1) % 4
        padding = padding if padding != 4 else 0
        fout.write(pack(f'{padding}x'))
        fout.write(pack(
            f'>iii{len(operands) - 3}i',
            # Default branch offset
            operands[0].value,
            operands[1].value,
            operands[2].value,
            *(o.value for o in operands[3:])
        ))
    else:
        # opcode with no operands.
        fout.write(pack('>B', opcode))
66104
def transform_33_32(inst, new_inst, i, n, offset,
                    instructions, new_asm):
    
    add_size = xdis.op_size(new_inst.opcode, opcode_33)
    if inst.opname in ('MAKE_FUNCTION','MAKE_CLOSURE'):
        # Previous instruction should be a load const which
        # contains the name of the function to call
        prev_inst = instructions[i-1]
        assert prev_inst.opname == 'LOAD_CONST'
        assert isinstance(prev_inst.arg, int)
        assert len(instructions) > 2
        assert len(instructions) > 2
        prev_inst2 = instructions[i-2]
        assert prev_inst2.opname == 'LOAD_CONST'
        assert isinstance(prev_inst2.arg, int)

        # Remove the function name as an additional LOAD_CONST
        prev2_const = new_asm.code.co_consts[prev_inst.arg]
        assert hasattr(prev2_const, 'co_name')
        new_asm.code.instructions = new_asm.code.instructions[:-1]
        load_const_size = xdis.op_size(prev_inst.opcode, opcode_33)
        add_size -= load_const_size
        new_inst.offset = offset - add_size
        return -load_const_size
    return 0
1339139
def disassemble(bytecode: bytes) -> list:
    
    instruction_list = []
    address = 0
    length = len(bytecode)
    if "bzzr" in str(bytecode[-43:]):
        # ignore swarm hash
        length -= 43

    while address < length:
        try:
            op_code = opcodes[bytecode[address]]
        except KeyError:
            instruction_list.append(EvmInstruction(address, "INVALID"))
            address += 1
            continue

        op_code_name = op_code[0]
        current_instruction = EvmInstruction(address, op_code_name)

        match = re.search(regex_PUSH, op_code_name)
        if match:
            argument_bytes = bytecode[address + 1 : address + 1 + int(match.group(1))]
            current_instruction.argument = "0x" + argument_bytes.hex()
            address += int(match.group(1))

        instruction_list.append(current_instruction)
        address += 1

    # We use a to_dict() here for compatibility reasons
    return [element.to_dict() for element in instruction_list]
1190934
def disassemble(self, offset, size):
        
        for i in DCode(
                self.CM, offset, size,
                self.get_buff()[offset:offset + size]).get_instructions():
            yield i
621851
def merge_code(left_code, right_code):
    

    data = dict()

    code_lines = (left_code and left_code.iter_code_by_lines()) or tuple()
    for abs_line, rel_line, dis in code_lines:
        data[rel_line] = [(abs_line, dis), None]

    code_lines = (right_code and right_code.iter_code_by_lines()) or tuple()
    for abs_line, rel_line, dis in code_lines:
        found = data.get(rel_line, None)
        if found is None:
            found = [None, (abs_line, dis)]
            data[rel_line] = found
        else:
            found[1] = (abs_line, dis)

    return data
1251377
def opcode_list(self, script):
        """"""
        opcodes = []
        new_pc = 0
        try:
            for opcode, data, pc, new_pc in self.get_opcodes(script):
                opcodes.append(self.disassemble_for_opcode_data(opcode, data))
        except ScriptError:
            opcodes.append(binascii.hexlify(script[new_pc:]).decode("utf8"))

        return opcodes
1276388
def finalize(self):
        
        self._check_finalized()
        self._final = True

        for dest_w, values in self.dest_instrs_info.items():
            mux_vals = dict(zip(self.instructions, values))
            dest_w <<= sparse_mux(self.signal_wire, mux_vals)
167240
def instruction_BLO(self, opcode, ea):
        
        if self.C == 1:
#            log.info("$%x BLO/BCS/LBLO/LBCS branch to $%x, because C==1 \t| %s" % (
#                self.program_counter, ea, self.cfg.mem_info.get_shortest(ea)
#            ))
            self.program_counter.set(ea)
978815
public void mergeInternal(INode parityINodes[], INode sourceINodes[],
      String parity, String source, RaidCodec codec, int[] checksums)
          throws IOException {
    waitForReady();
    long now = FSNamesystem.now();
    unprotectedMerge(parityINodes, sourceINodes, parity, source, codec,
        checksums, now);
    fsImage.getEditLog().logMerge(parity, source, codec.id, checksums, now);
  }
808917
private static Set<Integer> find(final Predicate<Instruction> predicate, final List<Instruction> instructions) {
        final Set<Integer> positions = new HashSet<>();

        for (int i = 0; i < instructions.size(); i++) {
            final Instruction instruction = instructions.get(i);
            if (predicate.test(instruction)) {
                positions.add(i);
            }
        }

        return positions;
    }
1084197
def parse_instruction(string, location, tokens):
    
    mnemonic_str = ReilMnemonic.from_string(tokens["mnemonic"])

    oprnd1 = tokens["fst_operand"][0]
    oprnd2 = tokens["snd_operand"][0]
    oprnd3 = tokens["trd_operand"][0]

    ins_builder = ReilBuilder()

    return ins_builder.build(mnemonic_str, oprnd1, oprnd2, oprnd3)
583229
def add_instruction (self, instr):
        
        assert(isinstance(instr, Instruction))
        self.instruction_list.append(instr)
        if instr.lhs not in self.defined_variables:
            if isinstance(instr.lhs, Variable):
                self.defined_variables.append(instr.lhs)
        if isinstance(instr, EqInstruction):
            if isinstance(instr.rhs, Variable):
                if instr.rhs not in self.used_variables:
                    self.used_variables.append(instr.rhs)
        else:
            if isinstance(instr.rhs_1, Variable):
                if instr.rhs_1 not in self.used_variables:
                    self.used_variables.append(instr.rhs_1)
            if isinstance(instr.rhs_2, Variable):
                if instr.rhs_2 not in self.used_variables:
                    self.used_variables.append(instr.rhs_2)
1022775
public void setInstructions(String instructions) {
        // Split the instructions into multiple instructions for each existent newline
        ArrayList<String> instructionsList = new ArrayList<>();
        StringTokenizer st = new StringTokenizer(instructions, "\n");
        while (st.hasMoreTokens()) {
            instructionsList.add(st.nextToken());
        }
        // Set the new list of instructions
        dataForm.setInstructions(instructionsList);

    }