Exact number of atomic operations in _radixPass.
545405
def _nbOperations(n):
    
    if n < 2:
        return 0
    else:
        n0 = (n + 2) // 3
        n02 = n0 + n // 3
        return 3 * (n02) + n0 + _nbOperations(n02)
1067905
def number_of_modified_bytes(buf, fuzzed_buf):
    
    count = 0
    for idx, b in enumerate(buf):
        if b != fuzzed_buf[idx]:
            count += 1
    return count
830231
def _max(self, memory, addr, **kwargs):
        
        return memory.state.solver.max(addr, exact=kwargs.pop('exact', self._exact), **kwargs)
420416
private int divaddLong(int dh, int dl, int[] result, int offset) {
        long carry = 0;

        long sum = (dl & LONG_MASK) + (result[1+offset] & LONG_MASK);
        result[1+offset] = (int)sum;

        sum = (dh & LONG_MASK) + (result[offset] & LONG_MASK) + carry;
        result[offset] = (int)sum;
        carry = sum >>> 32;
        return (int)carry;
    }
1166105
def bitwise_and(self, t):
        
        """
        The following code implements the and operations as presented in the paper
        'Signedness-Agnostic Program Analysis: Precise Integer Bounds for Low-Level Code'
        """
        s = self

        def number_of_ones(n):
            ctr = 0
            while n > 0:
                ctr += 1
                n &= n - 1
            return ctr

        # Optimization: if one of the two intervals is an integer and contains only one one we can be precise
        for a, b in [[s, t], [t, s]]:
            if a.is_integer and number_of_ones(a.lower_bound) == 1:
                if a.lower_bound == (1 << (t.bits - 1)):
                    # It's testing the sign bit
                    stride = 1 << (a.bits - 1)
                    if b.is_integer:
                        if b.lower_bound == stride:
                            return StridedInterval(bits=b.bits, stride=0, lower_bound=stride, upper_bound=stride)
                        else:
                            return StridedInterval(bits=b.bits, stride=0, lower_bound=0, upper_bound=0)
                    else:
                        is_sol = (a.lower_bound - b.lower_bound) % b.stride == 0 and b.lower_bound <= a.lower_bound <= b.upper_bound
                        if is_sol:
                            return StridedInterval(bits=b.bits, stride=stride, lower_bound=0, upper_bound=stride)
                        else:
                            return StridedInterval(bits=b.bits, stride=0, lower_bound=0, upper_bound=0)
                else:
                    #FIXME: implement case only one 1 not in first position
                    pass

        # paper's and
        new_interval = s.bitwise_not().bitwise_or(t.bitwise_not()).bitwise_not()
        return new_interval.normalize()
1175823
def UXTH(self, params):
        
        Ra, Rb = self.get_two_parameters(r'\s*([^\s,]*),\s*([^\s,]*)(,\s*[^\s,]*)*\s*', params)

        self.check_arguments(low_registers=(Ra, Rb))

        def UXTH_func():
            self.register[Ra] = (self.register[Rb] & 0xFFFF)

        return UXTH_func
1096063
function Me(ct,pt,ut){// Remove trailing zeros.
for(var bt=1,ht=pt.length;!pt[--ht];pt.pop());// Calculate the base 10 exponent. First get the number of digits of c[0].
for(ht=pt[0];10<=ht;ht/=10,bt++);// Overflow?
return(ut=bt+ut*Pe-1)>Qe?ct.c=ct.e=null:ut<Ze?ct.c=[ct.e=0]:(ct.e=ut,ct.c=pt),ct}
807066
def STRH(self, params):
        
        Ra, Rb, Rc = self.get_three_parameters(self.THREE_PARAMETER_WITH_BRACKETS, params)

        if self.is_immediate(Rc):
            self.check_arguments(low_registers=(Ra, Rb), imm5=(Rc,))

            def STRH_func():
                for i in range(2):
                    self.memory[self.register[Rb] + self.convert_to_integer(Rc[1:]) + i] = ((self.register[Ra] >> (8 * i)) & 0xFF)
        else:
            self.check_arguments(low_registers=(Ra, Rb, Rc))

            def STRH_func():
                for i in range(2):
                    self.memory[self.register[Rb] + self.register[Rc] + i] = ((self.register[Ra] >> (8 * i)) & 0xFF)

        return STRH_func
1371437
def count_operations(elements: Iterable[Operation]) \
        -> Dict[Type[Operation], int]:
    
    op_count: Dict[Type[Operation], int] = defaultdict(int)
    for elem in elements:
        op_count[type(elem)] += 1
    return dict(op_count)
830325
def persist_atomic_operations(operations)
      if persisted? && operations && !operations.empty?
        selector = atomic_selector
        _root.collection.find(selector).update_one(positionally(selector, operations), session: _session)
      end
    end
85400
def runtime_values(self):
        
        constants = set()
        for b in self.block_addrs:
            for sirsb in self._function_manager._cfg.get_all_irsbs(b):
                for s in sirsb.successors + sirsb.unsat_successors:
                    for a in s.history.recent_actions:
                        for ao in a.all_objects:
                            if not isinstance(ao.ast, claripy.ast.Base):
                                constants.add(ao.ast)
                            elif not ao.ast.symbolic:
                                constants.add(s.solver.eval(ao.ast))
        return constants
1129977
def slt(computation: BaseComputation) -> None:
    
    left, right = map(
        unsigned_to_signed,
        computation.stack_pop(num_items=2, type_hint=constants.UINT256),
    )

    if left < right:
        result = 1
    else:
        result = 0

    computation.stack_push(signed_to_unsigned(result))
766950
def _astore8(ins):
    ''' 
    '''
    output = _addr(ins.quad[1])
    op = ins.quad[2]

    indirect = op[0] == '*'
    if indirect:
        op = op[1:]

    immediate = op[0] == '#'
    if immediate:
        op = op[1:]

    if is_int(op):
        if indirect:
            if immediate:
                op = str(int(op) & 0xFFFF)  # Truncate to 16bit pointer
                output.append('ld a, (%s)' % op)
            else:
                output.append('ld de, (%s)' % op)
                output.append('ld a, (de)')
        else:
            op = str(int(op) & 0xFF)  # Truncate to byte
            output.append('ld (hl), %s' % op)
            return output

    elif op[0] == '_':
        if indirect:
            if immediate:
                output.append('ld a, (%s)' % op)  # Redundant: *#_id == _id
            else:
                output.append('ld de, (%s)' % op)  # *_id
                output.append('ld a, (de)')
        else:
            if immediate:
                output.append('ld a, %s' % op)  # #_id
            else:
                output.append('ld a, (%s)' % op)  # _id
    else:
        output.append('pop af')  # tn

    output.append('ld (hl), a')

    return output
276310
def _mul32(ins):
    
    op1, op2 = tuple(ins.quad[2:])
    if _int_ops(op1, op2):
        op1, op2 = _int_ops(op1, op2)
        output = _32bit_oper(op1)

        if op2 == 1:
            output.append('push de')
            output.append('push hl')
            return output  # A * 1 = Nothing

        if op2 == 0:
            output.append('ld hl, 0')
            output.append('push hl')
            output.append('push hl')
            return output

    output = _32bit_oper(op1, op2)
    output.append('call __MUL32')  # Inmmediate
    output.append('push de')
    output.append('push hl')
    REQUIRES.add('mul32.asm')
    return output
1067695
final int idlePerActive() {
        // Approximate at powers of two for small values, saturate past 4
        int p = parallelism;
        int a = p + (int)(ctl >> AC_SHIFT);
        return (a > (p >>>= 1) ? 0 :
                a > (p >>>= 1) ? 1 :
                a > (p >>>= 1) ? 2 :
                a > (p >>>= 1) ? 4 :
                8);
    }
782757
def _suffixArrayWithTrace(s, SA, n, K, operations, totalOperations):
    
    if _trace:
        _traceSuffixArray(operations, totalOperations)

    n0 = (n + 2) // 3
    n1 = (n + 1) // 3
    n2 = n // 3
    n02 = n0 + n2

    SA12 = _array("i", [0] * (n02 + 3))
    SA0 = _array("i", [0] * n0)
    s0 = _array("i", [0] * n0)

    # s12 : positions of mod 1 and mod 2 suffixes
    s12 = _array("i", [i for i in range(n + (n0 - n1)) if i % 3])  # <- writing i%3 is more efficient than i%3!=0
    s12.extend([0] * 3)

    # lsb radix sort the mod 1 and mod 2 triples
    _radixPass(s12, SA12, s[2:], n02, K)
    if _trace:
        operations += n02
        _traceSuffixArray(operations, totalOperations)

    _radixPass(SA12, s12, s[1:], n02, K)
    if _trace:
        operations += n02
        _traceSuffixArray(operations, totalOperations)

    _radixPass(s12, SA12, s, n02, K)
    if _trace:
        operations += n02
        _traceSuffixArray(operations, totalOperations)

    # find lexicographic names of triples
    name = 0
    c = _array("i", [-1] * 3)
    for i in range(n02):
        cSA12 = s[SA12[i]:SA12[i] + 3]
        if cSA12 != c:
            name += 1
            c = cSA12

        if SA12[i] % 3 == 1:
            s12[SA12[i] // 3] = name  # left half
        else:
            s12[(SA12[i] // 3) + n0] = name  # right half

    if name < n02:  # recurse if names are not yet unique
        operations = _suffixArrayWithTrace(s12, SA12, n02, name + 1, operations, totalOperations)
        if _trace:
            _traceSuffixArray(operations, totalOperations)

        # store unique names in s12 using the suffix array
        for i, SA12_i in enumerate(SA12[:n02]):
            s12[SA12_i] = i + 1
    else:  # generate the suffix array of s12 directly
        if _trace:
            operations += _nbOperations(n02)
            _traceSuffixArray(operations, totalOperations)

        for i, s12_i in enumerate(s12[:n02]):
            SA12[s12_i - 1] = i

    # stably sort the mod 0 suffixes from SA12 by their first character
    j = 0
    for SA12_i in SA12[:n02]:
        if (SA12_i < n0):
            s0[j] = 3 * SA12_i
            j += 1

    _radixPass(s0, SA0, s, n0, K)
    if _trace:
        operations += n0
        _traceSuffixArray(operations, totalOperations)

    # merge sorted SA0 suffixes and sorted SA12 suffixes
    p = j = k = 0
    t = n0 - n1
    while k < n:
        if SA12[t] < n0:  # pos of current offset 12 suffix
            i = SA12[t] * 3 + 1
        else:
            i = (SA12[t] - n0) * 3 + 2

        j = SA0[p]  # pos of current offset 0 suffix

        if SA12[t] < n0:
            bool = (s[i], s12[SA12[t] + n0]) <= (s[j], s12[int(j / 3)])
        else:
            bool = (s[i], s[i + 1], s12[SA12[t] - n0 + 1]) <= (s[j], s[j + 1], s12[int(j / 3) + n0])

        if (bool):
            SA[k] = i
            t += 1
            if t == n02:  # done --- only SA0 suffixes left
                k += 1
                while p < n0:
                    SA[k] = SA0[p]
                    p += 1
                    k += 1

        else:
            SA[k] = j
            p += 1
            if p == n0:  # done --- only SA12 suffixes left
                k += 1
                while t < n02:
                    if SA12[t] < n0:  # pos of current offset 12 suffix
                        SA[k] = (SA12[t] * 3) + 1
                    else:
                        SA[k] = ((SA12[t] - n0) * 3) + 2
                    t += 1
                    k += 1
        k += 1
    return operations
931314
def bitwise_or(self, t):
        
        """
        This implementation combines the approaches used by 'WYSINWYX: what you see is not what you execute'
        paper and 'Signedness-Agnostic Program Analysis: Precise Integer Bounds for Low-Level Code'. The
        first paper provides an sound way to approximate the stride, whereas the second provides a way
        to calculate the or operation using wrapping intervals.
        Note that, even though according Warren's work 'Hacker's delight', one should follow different
        approaches to calculate the minimun/maximum values of an or operations according on the type
        of the operands (signed/unsigned). On the other other hand, by splitting the wrapping-intervals
        at the south pole, we can safely and soundly only use the Warren's functions for unsigned
        integers.
        """
        s = self
        result_interval = list()

        for u in s._ssplit():
            for v in t._ssplit():
                w = u.bits
                # u |w v
                if u.is_integer:
                    s_t = StridedInterval._ntz(v.stride)
                elif v.is_integer:
                    s_t = StridedInterval._ntz(u.stride)
                else:
                    s_t = min(StridedInterval._ntz(u.stride), StridedInterval._ntz(v.stride))

                if u.is_integer and u.lower_bound == 0:
                    new_stride = v.stride
                elif v.is_integer and v.lower_bound == 0:
                    new_stride = u.stride
                else:
                    new_stride = 2 ** s_t
                mask = (1 << s_t) - 1
                r = (u.lower_bound & mask) | (v.lower_bound & mask)
                m = (2 ** w) - 1
                low_bound = WarrenMethods.min_or(u.lower_bound & (~mask & m), u.upper_bound & (~mask & m), v.lower_bound & (~mask & m), v.upper_bound & (~mask & m), w)
                upper_bound = WarrenMethods.max_or(u.lower_bound & (~mask & m), u.upper_bound & (~mask & m), v.lower_bound & (~mask & m), v.upper_bound & (~mask & m), w)
                if low_bound == upper_bound:
                    new_stride = 0

                new_interval = StridedInterval(lower_bound=((low_bound & (~mask & m)) | r), upper_bound=((upper_bound & (~mask & m)) | r), bits=w, stride=new_stride)
                result_interval.append(new_interval)

        return StridedInterval.least_upper_bound(*result_interval).normalize()