Disassembled instruction information represented as a JavaScript object.
@name CsInsn
@class
@private
@param {InsnType} insn Native instruction struct.
@param {ARCH} arch Architecture.
165119
function (insn, arch) {
    this.arch = arch;

    // Convert arch number to string
    var archStr = archs.toString(arch);

    Object.defineProperty(this, "_nativeInsn", {
        "configurable"  : true,
        "value"         : null,
    });

    /**
     * Instruction id
     * @name id
     * @type {Number}
     * @memberOf CsInsn
     */
    this.id = insn.id;

    /**
     * Instruction address
     * @name address
     * @type {Number}
     * @memberOf CsInsn
     */
    this.address = insn.address;

    /**
     * Instruction bytes
     * @name bytes
     * @type {Array}
     * @memberOf CsInsn
     */
    this.bytes = insn.bytes.buffer.toJSON().data.slice(0, insn.size);

    /**
     * Instruction mnemonic string
     * @name mnemonic
     * @type {String}
     * @memberOf CsInsn
     */
    this.mnemonic = insn.mnemonic.buffer.readCString(0);

    /**
     * Instruction operand string
     * @name op_str
     * @type {String}
     * @memberOf CsInsn
     */
    this.op_str = insn.op_str.buffer.readCString(0);

    if (insn.detail.address()) {
        var detail = insn.detail.deref();
        /**
         * Instruction detailed information
         *
         * *NOTE: only valid when detail option is ON (OFF by default)*
         *
         * @name detail
         * @type {Object}
         * @memberOf CsInsn
         */
        this.detail = {
            /**
             * Registers implicitly read by this instruction
             * @name detail.regs_read
             * @type {Array}
             * @memberOf CsInsn
             */
            "regs_read" : detail.regs_read.buffer.toJSON().data.slice(
                0,
                detail.regs_read_count
            ),

            /**
             * Registers implicitly modified by this instruction
             * @name detail.regs_write
             * @type {Array}
             * @memberOf CsInsn
             */
            "regs_write" : detail.regs_write.buffer.toJSON().data.slice(
                0,
                detail.regs_write_count
            ),

            /**
             * Groups this instruction belongs to
             * @name detail.groups
             * @type {Array}
             * @memberOf CsInsn
             */
            "groups" : detail.groups.buffer.toJSON().data.slice(
                0,
                detail.groups_count
            ),
        };

        var ArchDetail = exports[archStr]._Detail;
        this.detail[archStr] = new ArchDetail(detail.arch[archStr]);
    }

    return this;
}
971526
function Instruction(pi) {
  _classCallCheck(this, Instruction);

  this.tag = pi.split('<?')[1].split(' ')[0];
  this.att = Object.create(null);
  var hit,
      atexp = Instruction._ATEXP;

  while (hit = atexp.exec(pi)) {
    var n = hit[1],
        v = hit[2];
    this.att[n] = cast(v);
  }
}
333918
public boolean isAssertionInstruction(Instruction ins, ConstantPoolGen cpg) {

        if (ins instanceof InvokeInstruction) {
            return isAssertionCall((InvokeInstruction) ins);
        }
        if (ins instanceof GETSTATIC) {
            GETSTATIC getStatic = (GETSTATIC) ins;
            String className = getStatic.getClassName(cpg);
            String fieldName = getStatic.getFieldName(cpg);
            if ("java.util.logging.Level".equals(className) && "SEVERE".equals(fieldName)) {
                return true;
            }
            return "org.apache.log4j.Level".equals(className)
                && ("ERROR".equals(fieldName) || "FATAL".equals(fieldName));
        }
        return false;
    }
1126232
function InstructionBuilder(block) {
	var result
	if (Object.keys(Grammar).some(function(name){
		var r = Grammar[name]
		var m = r.header.exec(block.headerLine.content)
		if (m == null) return false
		//console.log(name, block.headerLine.content, m)
		result = r.parse(m, block.bodyLines)
		if (result.name == null) result.name = name
		return true
	})) {
		//console.log(result)
		return result
	} else throw 'Unknown structure:' + block.headerLine.content
}
1121059
@SuppressWarnings("ReferenceEquality")
  private void createPropertyScopeFor(Symbol s) {
    // In order to build a property scope for s, we will need to build
    // a property scope for all its implicit prototypes first. This means
    // that sometimes we will already have built its property scope
    // for a previous symbol.
    if (s.propertyScope != null) {
      return;
    }

    ObjectType type = getType(s) == null ? null : getType(s).toObjectType();
    if (type == null) {
      return;
    }

    // Create an empty property scope for the given symbol, maybe with a parent scope if it has
    // an implicit prototype.
    SymbolScope parentPropertyScope = maybeGetParentPropertyScope(type);
    s.setPropertyScope(new SymbolScope(null, parentPropertyScope, type, s));

    // If this symbol represents some 'a.b.c.prototype', add any instance properties of a.b.c
    // into the symbol scope.
    ObjectType instanceType = type;
    Iterable<String> propNames = type.getOwnPropertyNames();
    if (instanceType.isFunctionPrototypeType()) {
      // Guard against modifying foo.prototype when foo is a regular (non-constructor) function.
      if (instanceType.getOwnerFunction().hasInstanceType()) {
        // Merge the properties of "Foo.prototype" and "new Foo()" together.
        instanceType = instanceType.getOwnerFunction().getInstanceType();
        propNames = Iterables.concat(propNames, instanceType.getOwnPropertyNames());
      }
    }

    // Add all declared properties in propNames into the property scope
    for (String propName : propNames) {
      StaticSlot newProp = instanceType.getSlot(propName);
      if (newProp.getDeclaration() == null) {
        // Skip properties without declarations. We won't know how to index
        // them, because we index things by node.
        continue;
      }

      // We have symbol tables that do not do type analysis. They just try
      // to build a complete index of all objects in the program. So we might
      // already have symbols for things like "Foo.bar". If this happens,
      // throw out the old symbol and use the type-based symbol.
      Symbol oldProp =
          symbols.get(newProp.getDeclaration().getNode(), s.getName() + "." + propName);

      // If we've already have an entry in the table for this symbol,
      // then skip it. This should only happen if we screwed up,
      // and declared multiple distinct properties with the same name
      // at the same node. We bail out here to be safe.
      if (symbols.get(newProp.getDeclaration().getNode(), newProp.getName()) != null) {
        if (logger.isLoggable(Level.FINE)) {
          logger.fine("Found duplicate symbol " + newProp);
        }
        continue;
      }

      Symbol newSym = copySymbolTo(newProp, s.propertyScope);
      if (oldProp != null) {
        if (newSym.getJSDocInfo() == null) {
          newSym.setJSDocInfo(oldProp.getJSDocInfo());
        }
        newSym.setPropertyScope(oldProp.propertyScope);
        for (Reference ref : oldProp.references.values()) {
          newSym.defineReferenceAt(ref.getNode());
        }
        // All references/scopes from oldProp were updated to use the newProp. Time to remove
        // oldProp.
        removeSymbol(oldProp);
      }
    }
  }
1133736
@Override
    public void modelNormalInstruction(Instruction ins, int numWordsConsumed, int numWordsProduced) {

        int flags = 0;
        if (ins instanceof InvokeInstruction) {
            flags = ValueNumber.RETURN_VALUE;
        } else if (ins instanceof ArrayInstruction) {
            flags = ValueNumber.ARRAY_VALUE;
        } else if (ins instanceof ConstantPushInstruction) {
            flags = ValueNumber.CONSTANT_VALUE;
        }

        // Get the input operands to this instruction.
        ValueNumber[] inputValueList = popInputValues(numWordsConsumed);

        // See if we have the output operands in the cache.
        // If not, push default (fresh) values for the output,
        // and add them to the cache.
        ValueNumber[] outputValueList = getOutputValues(inputValueList, numWordsProduced, flags);

        if (VERIFY_INTEGRITY) {
            checkConsumedAndProducedValues(ins, inputValueList, outputValueList);
        }

        // Push output operands on stack.
        pushOutputValues(outputValueList);
    }
721556
public static boolean isLhsByDestructuring(Node n) {
    switch (n.getToken()) {
      case NAME:
      case GETPROP:
      case GETELEM:
        return isLhsByDestructuringHelper(n);
      default:
        return false;
    }
  }
1294967
def transform_32_33(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)

        # Add the function name as an additional LOAD_CONST
        load_fn_const = Instruction()
        load_fn_const.opname = 'LOAD_CONST'
        load_fn_const.opcode = opcode_33.opmap['LOAD_CONST']
        load_fn_const.line_no = None
        prev_const = new_asm.code.co_consts[prev_inst.arg]
        if hasattr(prev_const, 'co_name'):
            fn_name = new_asm.code.co_consts[prev_inst.arg].co_name
        else:
            fn_name = 'what-is-up'
        const_index = len(new_asm.code.co_consts)
        new_asm.code.co_consts = list(new_asm.code.co_consts)
        new_asm.code.co_consts.append(fn_name)
        load_fn_const.arg = const_index
        load_fn_const.offset = offset
        load_fn_const.starts_line = False
        load_fn_const.is_jump_target = False
        new_asm.code.instructions.append(load_fn_const)
        load_const_size = xdis.op_size(load_fn_const.opcode, opcode_33)
        add_size += load_const_size
        new_inst.offset = offset + add_size
        pass
    return add_size
961694
def prepare_native_return_state(native_state):
        

        javavm_simos = native_state.project.simos
        ret_state = native_state.copy()

        # set successor flags
        ret_state.regs._ip = ret_state.callstack.ret_addr
        ret_state.scratch.guard = ret_state.solver.true
        ret_state.history.jumpkind = 'Ijk_Ret'

        # if available, lookup the return value in native memory
        ret_var = ret_state.callstack.invoke_return_variable
        if ret_var is not None:
            # get return symbol from native state
            native_cc = javavm_simos.get_native_cc()
            ret_symbol = native_cc.get_return_val(native_state).to_claripy()
            # convert value to java type
            if ret_var.type in ArchSoot.primitive_types:
                # return value has a primitive type
                # => we need to manually cast the return value to the correct size, as this
                #    would be usually done by the java callee
                ret_value = javavm_simos.cast_primitive(ret_state, ret_symbol,
                                                        to_type=ret_var.type)
            else:
                # return value has a reference type
                # => ret_symbol is a opaque ref
                # => lookup corresponding java reference
                ret_value = ret_state.jni_references.lookup(ret_symbol)

        else:
            ret_value = None

        # teardown return state
        SimEngineSoot.prepare_return_state(ret_state, ret_value)

        # finally, delete all local references
        ret_state.jni_references.clear_local_references()

        return [ret_state]
1277400
public static int cudnnAddTensor(
        cudnnHandle handle, 
        Pointer alpha, 
        cudnnTensorDescriptor aDesc, 
        Pointer A, 
        Pointer beta, 
        cudnnTensorDescriptor cDesc, 
        Pointer C)
    {
        return checkResult(cudnnAddTensorNative(handle, alpha, aDesc, A, beta, cDesc, C));
    }
334199
function init(_pluginInterface) {
    pi = _pluginInterface;
    localStorage = pi.localStorage;
    log = pi.log;
    ipv4.setNetCallbackFunctions(
        function(net, newmac, newip) {
            for (const callbacks of Object.values(NetCallbacks)) {
                if (callbacks.onMacFoundCallback != undefined) {
                    callbacks.onMacFoundCallback(net, newmac, newip);
                }
            }
            // NetCallbacks[plugin_name].onNewIDFoundCallback(newid,newip);
        }
        , function(net, lostmac, lostip) {
            for (const callbacks of Object.values(NetCallbacks)) {
                if (callbacks.onMacLostCallback != undefined) {
                    callbacks.onMacLostCallback(net, lostmac, lostip);
                }
            }
            // NetCallbacks[plugin_name].onIPAddressLostCallback(id,lostip);
        }
        , function(net, mac, oldip, newip) {
            for (const callbacks of Object.values(NetCallbacks)) {
                if (callbacks.onIPChangedCallback != undefined) {
                    callbacks.onIPChangedCallback(net, mac, oldip, newip);
                }
            }
            // NetCallbacks[plugin_name].onIPAddressChangedCallback(id,oldip,newip);
        }
    );

    // Periodical publish test
    /*setInterval(()=>{
        pi.server.publish(
            'HelloTopic'
            ,{desc:'Hello desc'});
    },15000);*/
}
415048
function disallowBuiltIns(node) {
            if (node.callee.type !== "MemberExpression" || node.callee.computed) {
                return;
            }
            const propName = node.callee.property.name;

            if (DISALLOWED_PROPS.indexOf(propName) > -1) {
                context.report({
                    message: "Do not access Object.prototype method '{{prop}}' from target object.",
                    loc: node.callee.property.loc.start,
                    data: { prop: propName },
                    node
                });
            }
        }
624253
public void insert(final AbstractInsnNode insn) {
        ++size;
        if (first == null) {
            first = insn;
            last = insn;
        } else {
            first.prev = insn;
            insn.next = first;
        }
        first = insn;
        cache = null;
        insn.index = 0; // insn now belongs to an InsnList
    }
317962
def expect(instr, expected, context):
    
    if not isinstance(instr, expected):
        raise DecompilationError(
            "Expected a {expected} instruction {context}. Got {instr}.".format(
                instr=instr, expected=expected, context=context,
            )
        )
    return instr
186775
private S3Object decipherWithInstFileSuffix(GetObjectRequest req,
            long[] desiredRange, long[] cryptoRange, S3Object retrieved,
            String instFileSuffix) {
        final S3ObjectId id = req.getS3ObjectId();
        // Check if encrypted info is in an instruction file
        final S3ObjectWrapper ifile = fetchInstructionFile(id, instFileSuffix);
        if (ifile == null) {
            throw new SdkClientException("Instruction file with suffix "
                    + instFileSuffix + " is not found for " + retrieved);
        }
        try {
            return decipherWithInstructionFile(req, desiredRange,
                    cryptoRange, new S3ObjectWrapper(retrieved, id), ifile);
        } finally {
            closeQuietly(ifile, log);
        }
    }
874189
private List<Instruction> reduceInstructionsInternal(final List<Instruction> instructions) {
        final List<Instruction> visitedInstructions = new LinkedList<>();
        final Set<Integer> visitedInstructionPositions = new HashSet<>();
        final Set<Integer> handledLoadIndexes = new HashSet<>();
        final Set<Integer> backtrackPositions = new LinkedHashSet<>(findSortedBacktrackPositions());

        while (!visitedInstructionPositions.containsAll(backtrackPositions)) {

            // unvisited backtrack position
            final int backtrackPosition = backtrackPositions.stream().filter(pos -> !visitedInstructionPositions.contains(pos))
                    .findFirst().orElseThrow(IllegalStateException::new);

            final List<Integer> lastVisitedPositions = stackSizeSimulator.simulateStatementBackwards(backtrackPosition);
            final List<Instruction> lastVisitedInstructions = lastVisitedPositions.stream().map(instructions::get).collect(Collectors.toList());

            visitedInstructionPositions.addAll(lastVisitedPositions);
            visitedInstructions.addAll(lastVisitedInstructions);

            // unhandled load indexes
            final Set<Integer> unhandledLoadIndexes = findUnhandledLoadIndexes(handledLoadIndexes, lastVisitedInstructions);

            // for each load occurrence index -> find load/store backtrack positions (reverse order matters here)
            final SortedSet<Integer> loadStoreBacktrackPositions = findLoadStoreBacktrackPositions(unhandledLoadIndexes);

            handledLoadIndexes.addAll(unhandledLoadIndexes);

            loadStoreBacktrackPositions.stream().forEach(backtrackPositions::add);
        }

        // sort in method natural order
        Collections.reverse(visitedInstructions);

        return visitedInstructions;
    }
1210160
def _func_addrs_from_prologues(self):
        

        # Pre-compile all regexes
        regexes = list()
        for ins_regex in self.project.arch.function_prologs:
            r = re.compile(ins_regex)
            regexes.append(r)
        # EDG says: I challenge anyone bothering to read this to come up with a better
        # way to handle CPU modes that affect instruction decoding.
        # Since the only one we care about is ARM/Thumb right now
        # we have this gross hack. Sorry about that.
        thumb_regexes = list()
        if hasattr(self.project.arch, 'thumb_prologs'):
            for ins_regex in self.project.arch.thumb_prologs:
                # Thumb prologues are found at even addrs, but their actual addr is odd!
                # Isn't that great?
                r = re.compile(ins_regex)
                thumb_regexes.append(r)

        # Construct the binary blob first
        unassured_functions = [ ]

        for start_, bytes_ in self._binary.memory.backers():
            for regex in regexes:
                # Match them!
                for mo in regex.finditer(bytes_):
                    position = mo.start() + start_
                    if position % self.project.arch.instruction_alignment == 0:
                        mapped_position = AT.from_rva(position, self._binary).to_mva()
                        if self._addr_in_exec_memory_regions(mapped_position):
                            unassured_functions.append(mapped_position)
            # HACK part 2: Yes, i really have to do this
            for regex in thumb_regexes:
                # Match them!
                for mo in regex.finditer(bytes_):
                    position = mo.start() + start_
                    if position % self.project.arch.instruction_alignment == 0:
                        mapped_position = AT.from_rva(position, self._binary).to_mva()
                        if self._addr_in_exec_memory_regions(mapped_position):
                            unassured_functions.append(mapped_position+1)

        l.info("Found %d functions with prologue scanning.", len(unassured_functions))
        return unassured_functions