file
stringlengths 18
26
| data
stringlengths 3
1.04M
|
---|---|
the_stack_data/90765775.c | /*
This is a version (aka dlmalloc) of malloc/free/realloc written by
Doug Lea and released to the public domain, as explained at
http://creativecommons.org/publicdomain/zero/1.0/ Send questions,
comments, complaints, performance data, etc to [email protected]
* Version 2.8.6 Wed Aug 29 06:57:58 2012 Doug Lea
Note: There may be an updated version of this malloc obtainable at
ftp://gee.cs.oswego.edu/pub/misc/malloc.c
Check before installing!
* Quickstart
This library is all in one file to simplify the most common usage:
ftp it, compile it (-O3), and link it into another program. All of
the compile-time options default to reasonable values for use on
most platforms. You might later want to step through various
compile-time and dynamic tuning options.
For convenience, an include file for code using this malloc is at:
ftp://gee.cs.oswego.edu/pub/misc/malloc-2.8.6.h
You don't really need this .h file unless you call functions not
defined in your system include files. The .h file contains only the
excerpts from this file needed for using this malloc on ANSI C/C++
systems, so long as you haven't changed compile-time options about
naming and tuning parameters. If you do, then you can create your
own malloc.h that does include all settings by cutting at the point
indicated below. Note that you may already by default be using a C
library containing a malloc that is based on some version of this
malloc (for example in linux). You might still want to use the one
in this file to customize settings or to avoid overheads associated
with library versions.
* Vital statistics:
Supported pointer/size_t representation: 4 or 8 bytes
size_t MUST be an unsigned type of the same width as
pointers. (If you are using an ancient system that declares
size_t as a signed type, or need it to be a different width
than pointers, you can use a previous release of this malloc
(e.g. 2.7.2) supporting these.)
Alignment: 8 bytes (minimum)
This suffices for nearly all current machines and C compilers.
However, you can define MALLOC_ALIGNMENT to be wider than this
if necessary (up to 128bytes), at the expense of using more space.
Minimum overhead per allocated chunk: 4 or 8 bytes (if 4byte sizes)
8 or 16 bytes (if 8byte sizes)
Each malloced chunk has a hidden word of overhead holding size
and status information, and additional cross-check word
if FOOTERS is defined.
Minimum allocated size: 4-byte ptrs: 16 bytes (including overhead)
8-byte ptrs: 32 bytes (including overhead)
Even a request for zero bytes (i.e., malloc(0)) returns a
pointer to something of the minimum allocatable size.
The maximum overhead wastage (i.e., number of extra bytes
allocated than were requested in malloc) is less than or equal
to the minimum size, except for requests >= mmap_threshold that
are serviced via mmap(), where the worst case wastage is about
32 bytes plus the remainder from a system page (the minimal
mmap unit); typically 4096 or 8192 bytes.
Security: static-safe; optionally more or less
The "security" of malloc refers to the ability of malicious
code to accentuate the effects of errors (for example, freeing
space that is not currently malloc'ed or overwriting past the
ends of chunks) in code that calls malloc. This malloc
guarantees not to modify any memory locations below the base of
heap, i.e., static variables, even in the presence of usage
errors. The routines additionally detect most improper frees
and reallocs. All this holds as long as the static bookkeeping
for malloc itself is not corrupted by some other means. This
is only one aspect of security -- these checks do not, and
cannot, detect all possible programming errors.
If FOOTERS is defined nonzero, then each allocated chunk
carries an additional check word to verify that it was malloced
from its space. These check words are the same within each
execution of a program using malloc, but differ across
executions, so externally crafted fake chunks cannot be
freed. This improves security by rejecting frees/reallocs that
could corrupt heap memory, in addition to the checks preventing
writes to statics that are always on. This may further improve
security at the expense of time and space overhead. (Note that
FOOTERS may also be worth using with MSPACES.)
By default detected errors cause the program to abort (calling
"abort()"). You can override this to instead proceed past
errors by defining PROCEED_ON_ERROR. In this case, a bad free
has no effect, and a malloc that encounters a bad address
caused by user overwrites will ignore the bad address by
dropping pointers and indices to all known memory. This may
be appropriate for programs that should continue if at all
possible in the face of programming errors, although they may
run out of memory because dropped memory is never reclaimed.
If you don't like either of these options, you can define
CORRUPTION_ERROR_ACTION and USAGE_ERROR_ACTION to do anything
else. And if if you are sure that your program using malloc has
no errors or vulnerabilities, you can define INSECURE to 1,
which might (or might not) provide a small performance improvement.
It is also possible to limit the maximum total allocatable
space, using malloc_set_footprint_limit. This is not
designed as a security feature in itself (calls to set limits
are not screened or privileged), but may be useful as one
aspect of a secure implementation.
Thread-safety: NOT thread-safe unless USE_LOCKS defined non-zero
When USE_LOCKS is defined, each public call to malloc, free,
etc is surrounded with a lock. By default, this uses a plain
pthread mutex, win32 critical section, or a spin-lock if if
available for the platform and not disabled by setting
USE_SPIN_LOCKS=0. However, if USE_RECURSIVE_LOCKS is defined,
recursive versions are used instead (which are not required for
base functionality but may be needed in layered extensions).
Using a global lock is not especially fast, and can be a major
bottleneck. It is designed only to provide minimal protection
in concurrent environments, and to provide a basis for
extensions. If you are using malloc in a concurrent program,
consider instead using nedmalloc
(http://www.nedprod.com/programs/portable/nedmalloc/) or
ptmalloc (See http://www.malloc.de), which are derived from
versions of this malloc.
System requirements: Any combination of MORECORE and/or MMAP/MUNMAP
This malloc can use unix sbrk or any emulation (invoked using
the CALL_MORECORE macro) and/or mmap/munmap or any emulation
(invoked using CALL_MMAP/CALL_MUNMAP) to get and release system
memory. On most unix systems, it tends to work best if both
MORECORE and MMAP are enabled. On Win32, it uses emulations
based on VirtualAlloc. It also uses common C library functions
like memset.
Compliance: I believe it is compliant with the Single Unix Specification
(See http://www.unix.org). Also SVID/XPG, ANSI C, and probably
others as well.
* Overview of algorithms
This is not the fastest, most space-conserving, most portable, or
most tunable malloc ever written. However it is among the fastest
while also being among the most space-conserving, portable and
tunable. Consistent balance across these factors results in a good
general-purpose allocator for malloc-intensive programs.
In most ways, this malloc is a best-fit allocator. Generally, it
chooses the best-fitting existing chunk for a request, with ties
broken in approximately least-recently-used order. (This strategy
normally maintains low fragmentation.) However, for requests less
than 256bytes, it deviates from best-fit when there is not an
exactly fitting available chunk by preferring to use space adjacent
to that used for the previous small request, as well as by breaking
ties in approximately most-recently-used order. (These enhance
locality of series of small allocations.) And for very large requests
(>= 256Kb by default), it relies on system memory mapping
facilities, if supported. (This helps avoid carrying around and
possibly fragmenting memory used only for large chunks.)
All operations (except malloc_stats and mallinfo) have execution
times that are bounded by a constant factor of the number of bits in
a size_t, not counting any clearing in calloc or copying in realloc,
or actions surrounding MORECORE and MMAP that have times
proportional to the number of non-contiguous regions returned by
system allocation routines, which is often just 1. In real-time
applications, you can optionally suppress segment traversals using
NO_SEGMENT_TRAVERSAL, which assures bounded execution even when
system allocators return non-contiguous spaces, at the typical
expense of carrying around more memory and increased fragmentation.
The implementation is not very modular and seriously overuses
macros. Perhaps someday all C compilers will do as good a job
inlining modular code as can now be done by brute-force expansion,
but now, enough of them seem not to.
Some compilers issue a lot of warnings about code that is
dead/unreachable only on some platforms, and also about intentional
uses of negation on unsigned types. All known cases of each can be
ignored.
For a longer but out of date high-level description, see
http://gee.cs.oswego.edu/dl/html/malloc.html
* MSPACES
If MSPACES is defined, then in addition to malloc, free, etc.,
this file also defines mspace_malloc, mspace_free, etc. These
are versions of malloc routines that take an "mspace" argument
obtained using create_mspace, to control all internal bookkeeping.
If ONLY_MSPACES is defined, only these versions are compiled.
So if you would like to use this allocator for only some allocations,
and your system malloc for others, you can compile with
ONLY_MSPACES and then do something like...
static mspace mymspace = create_mspace(0,0); // for example
#define mymalloc(bytes) mspace_malloc(mymspace, bytes)
(Note: If you only need one instance of an mspace, you can instead
use "USE_DL_PREFIX" to relabel the global malloc.)
You can similarly create thread-local allocators by storing
mspaces as thread-locals. For example:
static __thread mspace tlms = 0;
void* tlmalloc(size_t bytes) {
if (tlms == 0) tlms = create_mspace(0, 0);
return mspace_malloc(tlms, bytes);
}
void tlfree(void* mem) { mspace_free(tlms, mem); }
Unless FOOTERS is defined, each mspace is completely independent.
You cannot allocate from one and free to another (although
conformance is only weakly checked, so usage errors are not always
caught). If FOOTERS is defined, then each chunk carries around a tag
indicating its originating mspace, and frees are directed to their
originating spaces. Normally, this requires use of locks.
------------------------- Compile-time options ---------------------------
Be careful in setting #define values for numerical constants of type
size_t. On some systems, literal values are not automatically extended
to size_t precision unless they are explicitly casted. You can also
use the symbolic values MAX_SIZE_T, SIZE_T_ONE, etc below.
WIN32 default: defined if _WIN32 defined
Defining WIN32 sets up defaults for MS environment and compilers.
Otherwise defaults are for unix. Beware that there seem to be some
cases where this malloc might not be a pure drop-in replacement for
Win32 malloc: Random-looking failures from Win32 GDI API's (eg;
SetDIBits()) may be due to bugs in some video driver implementations
when pixel buffers are malloc()ed, and the region spans more than
one VirtualAlloc()ed region. Because dlmalloc uses a small (64Kb)
default granularity, pixel buffers may straddle virtual allocation
regions more often than when using the Microsoft allocator. You can
avoid this by using VirtualAlloc() and VirtualFree() for all pixel
buffers rather than using malloc(). If this is not possible,
recompile this malloc with a larger DEFAULT_GRANULARITY. Note:
in cases where MSC and gcc (cygwin) are known to differ on WIN32,
conditions use _MSC_VER to distinguish them.
DLMALLOC_EXPORT default: extern
Defines how public APIs are declared. If you want to export via a
Windows DLL, you might define this as
#define DLMALLOC_EXPORT extern __declspec(dllexport)
If you want a POSIX ELF shared object, you might use
#define DLMALLOC_EXPORT extern __attribute__((visibility("default")))
MALLOC_ALIGNMENT default: (size_t)(2 * sizeof(void *))
Controls the minimum alignment for malloc'ed chunks. It must be a
power of two and at least 8, even on machines for which smaller
alignments would suffice. It may be defined as larger than this
though. Note however that code and data structures are optimized for
the case of 8-byte alignment.
MSPACES default: 0 (false)
If true, compile in support for independent allocation spaces.
This is only supported if HAVE_MMAP is true.
ONLY_MSPACES default: 0 (false)
If true, only compile in mspace versions, not regular versions.
USE_LOCKS default: 0 (false)
Causes each call to each public routine to be surrounded with
pthread or WIN32 mutex lock/unlock. (If set true, this can be
overridden on a per-mspace basis for mspace versions.) If set to a
non-zero value other than 1, locks are used, but their
implementation is left out, so lock functions must be supplied manually,
as described below.
USE_SPIN_LOCKS default: 1 iff USE_LOCKS and spin locks available
If true, uses custom spin locks for locking. This is currently
supported only gcc >= 4.1, older gccs on x86 platforms, and recent
MS compilers. Otherwise, posix locks or win32 critical sections are
used.
USE_RECURSIVE_LOCKS default: not defined
If defined nonzero, uses recursive (aka reentrant) locks, otherwise
uses plain mutexes. This is not required for malloc proper, but may
be needed for layered allocators such as nedmalloc.
LOCK_AT_FORK default: not defined
If defined nonzero, performs pthread_atfork upon initialization
to initialize child lock while holding parent lock. The implementation
assumes that pthread locks (not custom locks) are being used. In other
cases, you may need to customize the implementation.
FOOTERS default: 0
If true, provide extra checking and dispatching by placing
information in the footers of allocated chunks. This adds
space and time overhead.
INSECURE default: 0
If true, omit checks for usage errors and heap space overwrites.
USE_DL_PREFIX default: NOT defined
Causes compiler to prefix all public routines with the string 'dl'.
This can be useful when you only want to use this malloc in one part
of a program, using your regular system malloc elsewhere.
MALLOC_INSPECT_ALL default: NOT defined
If defined, compiles malloc_inspect_all and mspace_inspect_all, that
perform traversal of all heap space. Unless access to these
functions is otherwise restricted, you probably do not want to
include them in secure implementations.
ABORT default: defined as abort()
Defines how to abort on failed checks. On most systems, a failed
check cannot die with an "assert" or even print an informative
message, because the underlying print routines in turn call malloc,
which will fail again. Generally, the best policy is to simply call
abort(). It's not very useful to do more than this because many
errors due to overwriting will show up as address faults (null, odd
addresses etc) rather than malloc-triggered checks, so will also
abort. Also, most compilers know that abort() does not return, so
can better optimize code conditionally calling it.
PROCEED_ON_ERROR default: defined as 0 (false)
Controls whether detected bad addresses cause them to bypassed
rather than aborting. If set, detected bad arguments to free and
realloc are ignored. And all bookkeeping information is zeroed out
upon a detected overwrite of freed heap space, thus losing the
ability to ever return it from malloc again, but enabling the
application to proceed. If PROCEED_ON_ERROR is defined, the
static variable malloc_corruption_error_count is compiled in
and can be examined to see if errors have occurred. This option
generates slower code than the default abort policy.
DEBUG default: NOT defined
The DEBUG setting is mainly intended for people trying to modify
this code or diagnose problems when porting to new platforms.
However, it may also be able to better isolate user errors than just
using runtime checks. The assertions in the check routines spell
out in more detail the assumptions and invariants underlying the
algorithms. The checking is fairly extensive, and will slow down
execution noticeably. Calling malloc_stats or mallinfo with DEBUG
set will attempt to check every non-mmapped allocated and free chunk
in the course of computing the summaries.
ABORT_ON_ASSERT_FAILURE default: defined as 1 (true)
Debugging assertion failures can be nearly impossible if your
version of the assert macro causes malloc to be called, which will
lead to a cascade of further failures, blowing the runtime stack.
ABORT_ON_ASSERT_FAILURE cause assertions failures to call abort(),
which will usually make debugging easier.
MALLOC_FAILURE_ACTION default: sets errno to ENOMEM, or no-op on win32
The action to take before "return 0" when malloc fails to be able to
return memory because there is none available.
HAVE_MORECORE default: 1 (true) unless win32 or ONLY_MSPACES
True if this system supports sbrk or an emulation of it.
MORECORE default: sbrk
The name of the sbrk-style system routine to call to obtain more
memory. See below for guidance on writing custom MORECORE
functions. The type of the argument to sbrk/MORECORE varies across
systems. It cannot be size_t, because it supports negative
arguments, so it is normally the signed type of the same width as
size_t (sometimes declared as "intptr_t"). It doesn't much matter
though. Internally, we only call it with arguments less than half
the max value of a size_t, which should work across all reasonable
possibilities, although sometimes generating compiler warnings.
MORECORE_CONTIGUOUS default: 1 (true) if HAVE_MORECORE
If true, take advantage of fact that consecutive calls to MORECORE
with positive arguments always return contiguous increasing
addresses. This is true of unix sbrk. It does not hurt too much to
set it true anyway, since malloc copes with non-contiguities.
Setting it false when definitely non-contiguous saves time
and possibly wasted space it would take to discover this though.
MORECORE_CANNOT_TRIM default: NOT defined
True if MORECORE cannot release space back to the system when given
negative arguments. This is generally necessary only if you are
using a hand-crafted MORECORE function that cannot handle negative
arguments.
NO_SEGMENT_TRAVERSAL default: 0
If non-zero, suppresses traversals of memory segments
returned by either MORECORE or CALL_MMAP. This disables
merging of segments that are contiguous, and selectively
releasing them to the OS if unused, but bounds execution times.
HAVE_MMAP default: 1 (true)
True if this system supports mmap or an emulation of it. If so, and
HAVE_MORECORE is not true, MMAP is used for all system
allocation. If set and HAVE_MORECORE is true as well, MMAP is
primarily used to directly allocate very large blocks. It is also
used as a backup strategy in cases where MORECORE fails to provide
space from system. Note: A single call to MUNMAP is assumed to be
able to unmap memory that may have be allocated using multiple calls
to MMAP, so long as they are adjacent.
HAVE_MREMAP default: 1 on linux, else 0
If true realloc() uses mremap() to re-allocate large blocks and
extend or shrink allocation spaces.
MMAP_CLEARS default: 1 except on WINCE.
True if mmap clears memory so calloc doesn't need to. This is true
for standard unix mmap using /dev/zero and on WIN32 except for WINCE.
USE_BUILTIN_FFS default: 0 (i.e., not used)
Causes malloc to use the builtin ffs() function to compute indices.
Some compilers may recognize and intrinsify ffs to be faster than the
supplied C version. Also, the case of x86 using gcc is special-cased
to an asm instruction, so is already as fast as it can be, and so
this setting has no effect. Similarly for Win32 under recent MS compilers.
(On most x86s, the asm version is only slightly faster than the C version.)
malloc_getpagesize default: derive from system includes, or 4096.
The system page size. To the extent possible, this malloc manages
memory from the system in page-size units. This may be (and
usually is) a function rather than a constant. This is ignored
if WIN32, where page size is determined using getSystemInfo during
initialization.
USE_DEV_RANDOM default: 0 (i.e., not used)
Causes malloc to use /dev/random to initialize secure magic seed for
stamping footers. Otherwise, the current time is used.
NO_MALLINFO default: 0
If defined, don't compile "mallinfo". This can be a simple way
of dealing with mismatches between system declarations and
those in this file.
MALLINFO_FIELD_TYPE default: size_t
The type of the fields in the mallinfo struct. This was originally
defined as "int" in SVID etc, but is more usefully defined as
size_t. The value is used only if HAVE_USR_INCLUDE_MALLOC_H is not set
NO_MALLOC_STATS default: 0
If defined, don't compile "malloc_stats". This avoids calls to
fprintf and bringing in stdio dependencies you might not want.
REALLOC_ZERO_BYTES_FREES default: not defined
This should be set if a call to realloc with zero bytes should
be the same as a call to free. Some people think it should. Otherwise,
since this malloc returns a unique pointer for malloc(0), so does
realloc(p, 0).
LACKS_UNISTD_H, LACKS_FCNTL_H, LACKS_SYS_PARAM_H, LACKS_SYS_MMAN_H
LACKS_STRINGS_H, LACKS_STRING_H, LACKS_SYS_TYPES_H, LACKS_ERRNO_H
LACKS_STDLIB_H LACKS_SCHED_H LACKS_TIME_H default: NOT defined unless on WIN32
Define these if your system does not have these header files.
You might need to manually insert some of the declarations they provide.
DEFAULT_GRANULARITY default: page size if MORECORE_CONTIGUOUS,
system_info.dwAllocationGranularity in WIN32,
otherwise 64K.
Also settable using mallopt(M_GRANULARITY, x)
The unit for allocating and deallocating memory from the system. On
most systems with contiguous MORECORE, there is no reason to
make this more than a page. However, systems with MMAP tend to
either require or encourage larger granularities. You can increase
this value to prevent system allocation functions to be called so
often, especially if they are slow. The value must be at least one
page and must be a power of two. Setting to 0 causes initialization
to either page size or win32 region size. (Note: In previous
versions of malloc, the equivalent of this option was called
"TOP_PAD")
DEFAULT_TRIM_THRESHOLD default: 2MB
Also settable using mallopt(M_TRIM_THRESHOLD, x)
The maximum amount of unused top-most memory to keep before
releasing via malloc_trim in free(). Automatic trimming is mainly
useful in long-lived programs using contiguous MORECORE. Because
trimming via sbrk can be slow on some systems, and can sometimes be
wasteful (in cases where programs immediately afterward allocate
more large chunks) the value should be high enough so that your
overall system performance would improve by releasing this much
memory. As a rough guide, you might set to a value close to the
average size of a process (program) running on your system.
Releasing this much memory would allow such a process to run in
memory. Generally, it is worth tuning trim thresholds when a
program undergoes phases where several large chunks are allocated
and released in ways that can reuse each other's storage, perhaps
mixed with phases where there are no such chunks at all. The trim
value must be greater than page size to have any useful effect. To
disable trimming completely, you can set to MAX_SIZE_T. Note that the trick
some people use of mallocing a huge space and then freeing it at
program startup, in an attempt to reserve system memory, doesn't
have the intended effect under automatic trimming, since that memory
will immediately be returned to the system.
DEFAULT_MMAP_THRESHOLD default: 256K
Also settable using mallopt(M_MMAP_THRESHOLD, x)
The request size threshold for using MMAP to directly service a
request. Requests of at least this size that cannot be allocated
using already-existing space will be serviced via mmap. (If enough
normal freed space already exists it is used instead.) Using mmap
segregates relatively large chunks of memory so that they can be
individually obtained and released from the host system. A request
serviced through mmap is never reused by any other request (at least
not directly; the system may just so happen to remap successive
requests to the same locations). Segregating space in this way has
the benefits that: Mmapped space can always be individually released
back to the system, which helps keep the system level memory demands
of a long-lived program low. Also, mapped memory doesn't become
`locked' between other chunks, as can happen with normally allocated
chunks, which means that even trimming via malloc_trim would not
release them. However, it has the disadvantage that the space
cannot be reclaimed, consolidated, and then used to service later
requests, as happens with normal chunks. The advantages of mmap
nearly always outweigh disadvantages for "large" chunks, but the
value of "large" may vary across systems. The default is an
empirically derived value that works well in most systems. You can
disable mmap by setting to MAX_SIZE_T.
MAX_RELEASE_CHECK_RATE default: 4095 unless not HAVE_MMAP
The number of consolidated frees between checks to release
unused segments when freeing. When using non-contiguous segments,
especially with multiple mspaces, checking only for topmost space
doesn't always suffice to trigger trimming. To compensate for this,
free() will, with a period of MAX_RELEASE_CHECK_RATE (or the
current number of segments, if greater) try to release unused
segments to the OS when freeing chunks that result in
consolidation. The best value for this parameter is a compromise
between slowing down frees with relatively costly checks that
rarely trigger versus holding on to unused memory. To effectively
disable, set to MAX_SIZE_T. This may lead to a very slight speed
improvement at the expense of carrying around more memory.
*/
/* Version identifier to allow people to support multiple versions */
#ifndef DLMALLOC_VERSION
#define DLMALLOC_VERSION 20806
#endif /* DLMALLOC_VERSION */
#ifndef DLMALLOC_EXPORT
#define DLMALLOC_EXPORT extern
#endif
#ifndef WIN32
#ifdef _WIN32
#define WIN32 1
#endif /* _WIN32 */
#ifdef _WIN32_WCE
#define LACKS_FCNTL_H
#define WIN32 1
#endif /* _WIN32_WCE */
#endif /* WIN32 */
#ifdef WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <tchar.h>
#define HAVE_MMAP 1
#define HAVE_MORECORE 0
#define LACKS_UNISTD_H
#define LACKS_SYS_PARAM_H
#define LACKS_SYS_MMAN_H
#define LACKS_STRING_H
#define LACKS_STRINGS_H
#define LACKS_SYS_TYPES_H
#define LACKS_ERRNO_H
#define LACKS_SCHED_H
#ifndef MALLOC_FAILURE_ACTION
#define MALLOC_FAILURE_ACTION
#endif /* MALLOC_FAILURE_ACTION */
#ifndef MMAP_CLEARS
#ifdef _WIN32_WCE /* WINCE reportedly does not clear */
#define MMAP_CLEARS 0
#else
#define MMAP_CLEARS 1
#endif /* _WIN32_WCE */
#endif /*MMAP_CLEARS */
#endif /* WIN32 */
#if defined(DARWIN) || defined(_DARWIN)
/* Mac OSX docs advise not to use sbrk; it seems better to use mmap */
#ifndef HAVE_MORECORE
#define HAVE_MORECORE 0
#define HAVE_MMAP 1
/* OSX allocators provide 16 byte alignment */
#ifndef MALLOC_ALIGNMENT
#define MALLOC_ALIGNMENT ((size_t)16U)
#endif
#endif /* HAVE_MORECORE */
#endif /* DARWIN */
#ifndef LACKS_SYS_TYPES_H
#include <sys/types.h> /* For size_t */
#endif /* LACKS_SYS_TYPES_H */
/* The maximum possible size_t value has all bits set */
#define MAX_SIZE_T (~(size_t)0)
// #define USE_LOCKS
#ifndef USE_LOCKS /* ensure true if spin or recursive locks set */
#define USE_LOCKS ((defined(USE_SPIN_LOCKS) && USE_SPIN_LOCKS != 0) || \
(defined(USE_RECURSIVE_LOCKS) && USE_RECURSIVE_LOCKS != 0))
#endif /* USE_LOCKS */
#if USE_LOCKS /* Spin locks for gcc >= 4.1, older gcc on x86, MSC >= 1310 */
#if ((defined(__GNUC__) && \
((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) || \
defined(__i386__) || defined(__x86_64__))) || \
(defined(_MSC_VER) && _MSC_VER>=1310))
#ifndef USE_SPIN_LOCKS
#define USE_SPIN_LOCKS 1
#endif /* USE_SPIN_LOCKS */
#elif USE_SPIN_LOCKS
#error "USE_SPIN_LOCKS defined without implementation"
#endif /* ... locks available... */
#elif !defined(USE_SPIN_LOCKS)
#define USE_SPIN_LOCKS 0
#endif /* USE_LOCKS */
#ifndef ONLY_MSPACES
#define ONLY_MSPACES 0
#endif /* ONLY_MSPACES */
#ifndef MSPACES
#if ONLY_MSPACES
#define MSPACES 1
#else /* ONLY_MSPACES */
#define MSPACES 0
#endif /* ONLY_MSPACES */
#endif /* MSPACES */
#ifndef MALLOC_ALIGNMENT
#define MALLOC_ALIGNMENT ((size_t)(2 * sizeof(void *)))
#endif /* MALLOC_ALIGNMENT */
#ifndef FOOTERS
#define FOOTERS 0
#endif /* FOOTERS */
#ifndef ABORT
extern void dlfatal(char *file, int line, char *function);
#define ABORT dlfatal(__FILE__, __LINE__, __FUNCTION__)
#endif /* ABORT */
#ifndef ABORT_ON_ASSERT_FAILURE
#define ABORT_ON_ASSERT_FAILURE 1
#endif /* ABORT_ON_ASSERT_FAILURE */
#ifndef PROCEED_ON_ERROR
#define PROCEED_ON_ERROR 0
#endif /* PROCEED_ON_ERROR */
#ifndef INSECURE
#define INSECURE 0
#endif /* INSECURE */
#ifndef MALLOC_INSPECT_ALL
#define MALLOC_INSPECT_ALL 0
#endif /* MALLOC_INSPECT_ALL */
#ifndef HAVE_MMAP
#define HAVE_MMAP 1
#endif /* HAVE_MMAP */
#ifndef MMAP_CLEARS
#define MMAP_CLEARS 1
#endif /* MMAP_CLEARS */
#ifndef HAVE_MREMAP
#ifdef linux
#define HAVE_MREMAP 1
#define _GNU_SOURCE /* Turns on mremap() definition */
#else /* linux */
#define HAVE_MREMAP 0
#endif /* linux */
#endif /* HAVE_MREMAP */
#ifndef MALLOC_FAILURE_ACTION
#define MALLOC_FAILURE_ACTION errno = ENOMEM;
#endif /* MALLOC_FAILURE_ACTION */
#ifndef HAVE_MORECORE
#if ONLY_MSPACES
#define HAVE_MORECORE 0
#else /* ONLY_MSPACES */
#define HAVE_MORECORE 1
#endif /* ONLY_MSPACES */
#endif /* HAVE_MORECORE */
#if !HAVE_MORECORE
#define MORECORE_CONTIGUOUS 0
#else /* !HAVE_MORECORE */
#define MORECORE_DEFAULT sbrk
#ifndef MORECORE_CONTIGUOUS
#define MORECORE_CONTIGUOUS 1
#endif /* MORECORE_CONTIGUOUS */
#endif /* HAVE_MORECORE */
#ifndef DEFAULT_GRANULARITY
#if (MORECORE_CONTIGUOUS || defined(WIN32))
#define DEFAULT_GRANULARITY (0) /* 0 means to compute in init_mparams */
#else /* MORECORE_CONTIGUOUS */
#define DEFAULT_GRANULARITY ((size_t)64U * (size_t)1024U)
#endif /* MORECORE_CONTIGUOUS */
#endif /* DEFAULT_GRANULARITY */
#ifndef DEFAULT_TRIM_THRESHOLD
#ifndef MORECORE_CANNOT_TRIM
#define DEFAULT_TRIM_THRESHOLD ((size_t)2U * (size_t)1024U * (size_t)1024U)
#else /* MORECORE_CANNOT_TRIM */
#define DEFAULT_TRIM_THRESHOLD MAX_SIZE_T
#endif /* MORECORE_CANNOT_TRIM */
#endif /* DEFAULT_TRIM_THRESHOLD */
#ifndef DEFAULT_MMAP_THRESHOLD
#if HAVE_MMAP
#define DEFAULT_MMAP_THRESHOLD ((size_t)256U * (size_t)1024U)
#else /* HAVE_MMAP */
#define DEFAULT_MMAP_THRESHOLD MAX_SIZE_T
#endif /* HAVE_MMAP */
#endif /* DEFAULT_MMAP_THRESHOLD */
#ifndef MAX_RELEASE_CHECK_RATE
#if HAVE_MMAP
#define MAX_RELEASE_CHECK_RATE 4095
#else
#define MAX_RELEASE_CHECK_RATE MAX_SIZE_T
#endif /* HAVE_MMAP */
#endif /* MAX_RELEASE_CHECK_RATE */
#ifndef USE_BUILTIN_FFS
#define USE_BUILTIN_FFS 0
#endif /* USE_BUILTIN_FFS */
#ifndef USE_DEV_RANDOM
#define USE_DEV_RANDOM 0
#endif /* USE_DEV_RANDOM */
#ifndef NO_MALLINFO
#define NO_MALLINFO 0
#endif /* NO_MALLINFO */
#ifndef MALLINFO_FIELD_TYPE
#define MALLINFO_FIELD_TYPE size_t
#endif /* MALLINFO_FIELD_TYPE */
#ifndef NO_MALLOC_STATS
#define NO_MALLOC_STATS 0
#endif /* NO_MALLOC_STATS */
#ifndef NO_SEGMENT_TRAVERSAL
#define NO_SEGMENT_TRAVERSAL 0
#endif /* NO_SEGMENT_TRAVERSAL */
/*
mallopt tuning options. SVID/XPG defines four standard parameter
numbers for mallopt, normally defined in malloc.h. None of these
are used in this malloc, so setting them has no effect. But this
malloc does support the following options.
*/
#define M_TRIM_THRESHOLD (-1)
#define M_GRANULARITY (-2)
#define M_MMAP_THRESHOLD (-3)
/* ------------------------ Mallinfo declarations ------------------------ */
#if !NO_MALLINFO
/*
This version of malloc supports the standard SVID/XPG mallinfo
routine that returns a struct containing usage properties and
statistics. It should work on any system that has a
/usr/include/malloc.h defining struct mallinfo. The main
declaration needed is the mallinfo struct that is returned (by-copy)
by mallinfo(). The malloinfo struct contains a bunch of fields that
are not even meaningful in this version of malloc. These fields are
are instead filled by mallinfo() with other numbers that might be of
interest.
HAVE_USR_INCLUDE_MALLOC_H should be set if you have a
/usr/include/malloc.h file that includes a declaration of struct
mallinfo. If so, it is included; else a compliant version is
declared below. These must be precisely the same for mallinfo() to
work. The original SVID version of this struct, defined on most
systems with mallinfo, declares all fields as ints. But some others
define as unsigned long. If your system defines the fields using a
type of different width than listed here, you MUST #include your
system version and #define HAVE_USR_INCLUDE_MALLOC_H.
*/
/* #define HAVE_USR_INCLUDE_MALLOC_H */
#ifdef HAVE_USR_INCLUDE_MALLOC_H
#include "/usr/include/malloc.h"
#else /* HAVE_USR_INCLUDE_MALLOC_H */
#ifndef STRUCT_MALLINFO_DECLARED
/* HP-UX (and others?) redefines mallinfo unless _STRUCT_MALLINFO is defined */
#define _STRUCT_MALLINFO
#define STRUCT_MALLINFO_DECLARED 1
struct mallinfo {
MALLINFO_FIELD_TYPE arena; /* non-mmapped space allocated from system */
MALLINFO_FIELD_TYPE ordblks; /* number of free chunks */
MALLINFO_FIELD_TYPE smblks; /* always 0 */
MALLINFO_FIELD_TYPE hblks; /* always 0 */
MALLINFO_FIELD_TYPE hblkhd; /* space in mmapped regions */
MALLINFO_FIELD_TYPE usmblks; /* maximum total allocated space */
MALLINFO_FIELD_TYPE fsmblks; /* always 0 */
MALLINFO_FIELD_TYPE uordblks; /* total allocated space */
MALLINFO_FIELD_TYPE fordblks; /* total free space */
MALLINFO_FIELD_TYPE keepcost; /* releasable (via malloc_trim) space */
};
#endif /* STRUCT_MALLINFO_DECLARED */
#endif /* HAVE_USR_INCLUDE_MALLOC_H */
#endif /* NO_MALLINFO */
/*
Try to persuade compilers to inline. The most critical functions for
inlining are defined as macros, so these aren't used for them.
*/
#ifndef FORCEINLINE
#if defined(__GNUC__)
#define FORCEINLINE __inline __attribute__ ((always_inline))
#elif defined(_MSC_VER)
#define FORCEINLINE __forceinline
#endif
#endif
#ifndef NOINLINE
#if defined(__GNUC__)
#define NOINLINE __attribute__ ((noinline))
#elif defined(_MSC_VER)
#define NOINLINE __declspec(noinline)
#else
#define NOINLINE
#endif
#endif
#ifdef __cplusplus
extern "C" {
#ifndef FORCEINLINE
#define FORCEINLINE inline
#endif
#endif /* __cplusplus */
#ifndef FORCEINLINE
#define FORCEINLINE
#endif
#if !ONLY_MSPACES
#define USE_DL_PREFIX
/* ------------------- Declarations of public routines ------------------- */
#ifndef USE_DL_PREFIX
#define dlcalloc calloc
#define dlfree free
#define dlmalloc malloc
#define dlmemalign memalign
#define dlposix_memalign posix_memalign
#define dlrealloc realloc
#define dlrealloc_in_place realloc_in_place
#define dlvalloc valloc
#define dlpvalloc pvalloc
#define dlmallinfo mallinfo
#define dlmallopt mallopt
#define dlmalloc_trim malloc_trim
#define dlmalloc_stats malloc_stats
#define dlmalloc_usable_size malloc_usable_size
#define dlmalloc_footprint malloc_footprint
#define dlmalloc_max_footprint malloc_max_footprint
#define dlmalloc_footprint_limit malloc_footprint_limit
#define dlmalloc_set_footprint_limit malloc_set_footprint_limit
#define dlmalloc_inspect_all malloc_inspect_all
#define dlindependent_calloc independent_calloc
#define dlindependent_comalloc independent_comalloc
#define dlbulk_free bulk_free
#endif /* USE_DL_PREFIX */
/*
malloc(size_t n)
Returns a pointer to a newly allocated chunk of at least n bytes, or
null if no space is available, in which case errno is set to ENOMEM
on ANSI C systems.
If n is zero, malloc returns a minimum-sized chunk. (The minimum
size is 16 bytes on most 32bit systems, and 32 bytes on 64bit
systems.) Note that size_t is an unsigned type, so calls with
arguments that would be negative if signed are interpreted as
requests for huge amounts of space, which will often fail. The
maximum supported value of n differs across systems, but is in all
cases less than the maximum representable value of a size_t.
*/
DLMALLOC_EXPORT void* dlmalloc(size_t);
/*
free(void* p)
Releases the chunk of memory pointed to by p, that had been previously
allocated using malloc or a related routine such as realloc.
It has no effect if p is null. If p was not malloced or already
freed, free(p) will by default cause the current program to abort.
*/
DLMALLOC_EXPORT void dlfree(void*);
/*
calloc(size_t n_elements, size_t element_size);
Returns a pointer to n_elements * element_size bytes, with all locations
set to zero.
*/
DLMALLOC_EXPORT void* dlcalloc(size_t, size_t);
/*
realloc(void* p, size_t n)
Returns a pointer to a chunk of size n that contains the same data
as does chunk p up to the minimum of (n, p's size) bytes, or null
if no space is available.
The returned pointer may or may not be the same as p. The algorithm
prefers extending p in most cases when possible, otherwise it
employs the equivalent of a malloc-copy-free sequence.
If p is null, realloc is equivalent to malloc.
If space is not available, realloc returns null, errno is set (if on
ANSI) and p is NOT freed.
if n is for fewer bytes than already held by p, the newly unused
space is lopped off and freed if possible. realloc with a size
argument of zero (re)allocates a minimum-sized chunk.
The old unix realloc convention of allowing the last-free'd chunk
to be used as an argument to realloc is not supported.
*/
DLMALLOC_EXPORT void* dlrealloc(void*, size_t);
/*
realloc_in_place(void* p, size_t n)
Resizes the space allocated for p to size n, only if this can be
done without moving p (i.e., only if there is adjacent space
available if n is greater than p's current allocated size, or n is
less than or equal to p's size). This may be used instead of plain
realloc if an alternative allocation strategy is needed upon failure
to expand space; for example, reallocation of a buffer that must be
memory-aligned or cleared. You can use realloc_in_place to trigger
these alternatives only when needed.
Returns p if successful; otherwise null.
*/
DLMALLOC_EXPORT void* dlrealloc_in_place(void*, size_t);
/*
memalign(size_t alignment, size_t n);
Returns a pointer to a newly allocated chunk of n bytes, aligned
in accord with the alignment argument.
The alignment argument should be a power of two. If the argument is
not a power of two, the nearest greater power is used.
8-byte alignment is guaranteed by normal malloc calls, so don't
bother calling memalign with an argument of 8 or less.
Overreliance on memalign is a sure way to fragment space.
*/
DLMALLOC_EXPORT void* dlmemalign(size_t, size_t);
/*
int posix_memalign(void** pp, size_t alignment, size_t n);
Allocates a chunk of n bytes, aligned in accord with the alignment
argument. Differs from memalign only in that it (1) assigns the
allocated memory to *pp rather than returning it, (2) fails and
returns EINVAL if the alignment is not a power of two (3) fails and
returns ENOMEM if memory cannot be allocated.
*/
DLMALLOC_EXPORT int dlposix_memalign(void**, size_t, size_t);
/*
valloc(size_t n);
Equivalent to memalign(pagesize, n), where pagesize is the page
size of the system. If the pagesize is unknown, 4096 is used.
*/
DLMALLOC_EXPORT void* dlvalloc(size_t);
/*
mallopt(int parameter_number, int parameter_value)
Sets tunable parameters The format is to provide a
(parameter-number, parameter-value) pair. mallopt then sets the
corresponding parameter to the argument value if it can (i.e., so
long as the value is meaningful), and returns 1 if successful else
0. To workaround the fact that mallopt is specified to use int,
not size_t parameters, the value -1 is specially treated as the
maximum unsigned size_t value.
SVID/XPG/ANSI defines four standard param numbers for mallopt,
normally defined in malloc.h. None of these are use in this malloc,
so setting them has no effect. But this malloc also supports other
options in mallopt. See below for details. Briefly, supported
parameters are as follows (listed defaults are for "typical"
configurations).
Symbol param # default allowed param values
M_TRIM_THRESHOLD -1 2*1024*1024 any (-1 disables)
M_GRANULARITY -2 page size any power of 2 >= page size
M_MMAP_THRESHOLD -3 256*1024 any (or 0 if no MMAP support)
*/
DLMALLOC_EXPORT int dlmallopt(int, int);
/*
malloc_footprint();
Returns the number of bytes obtained from the system. The total
number of bytes allocated by malloc, realloc etc., is less than this
value. Unlike mallinfo, this function returns only a precomputed
result, so can be called frequently to monitor memory consumption.
Even if locks are otherwise defined, this function does not use them,
so results might not be up to date.
*/
DLMALLOC_EXPORT size_t dlmalloc_footprint(void);
/*
malloc_max_footprint();
Returns the maximum number of bytes obtained from the system. This
value will be greater than current footprint if deallocated space
has been reclaimed by the system. The peak number of bytes allocated
by malloc, realloc etc., is less than this value. Unlike mallinfo,
this function returns only a precomputed result, so can be called
frequently to monitor memory consumption. Even if locks are
otherwise defined, this function does not use them, so results might
not be up to date.
*/
DLMALLOC_EXPORT size_t dlmalloc_max_footprint(void);
/*
malloc_footprint_limit();
Returns the number of bytes that the heap is allowed to obtain from
the system, returning the last value returned by
malloc_set_footprint_limit, or the maximum size_t value if
never set. The returned value reflects a permission. There is no
guarantee that this number of bytes can actually be obtained from
the system.
*/
DLMALLOC_EXPORT size_t dlmalloc_footprint_limit();
/*
malloc_set_footprint_limit();
Sets the maximum number of bytes to obtain from the system, causing
failure returns from malloc and related functions upon attempts to
exceed this value. The argument value may be subject to page
rounding to an enforceable limit; this actual value is returned.
Using an argument of the maximum possible size_t effectively
disables checks. If the argument is less than or equal to the
current malloc_footprint, then all future allocations that require
additional system memory will fail. However, invocation cannot
retroactively deallocate existing used memory.
*/
DLMALLOC_EXPORT size_t dlmalloc_set_footprint_limit(size_t bytes);
#if MALLOC_INSPECT_ALL
/*
malloc_inspect_all(void(*handler)(void *start,
void *end,
size_t used_bytes,
void* callback_arg),
void* arg);
Traverses the heap and calls the given handler for each managed
region, skipping all bytes that are (or may be) used for bookkeeping
purposes. Traversal does not include include chunks that have been
directly memory mapped. Each reported region begins at the start
address, and continues up to but not including the end address. The
first used_bytes of the region contain allocated data. If
used_bytes is zero, the region is unallocated. The handler is
invoked with the given callback argument. If locks are defined, they
are held during the entire traversal. It is a bad idea to invoke
other malloc functions from within the handler.
For example, to count the number of in-use chunks with size greater
than 1000, you could write:
static int count = 0;
void count_chunks(void* start, void* end, size_t used, void* arg) {
if (used >= 1000) ++count;
}
then:
malloc_inspect_all(count_chunks, NULL);
malloc_inspect_all is compiled only if MALLOC_INSPECT_ALL is defined.
*/
DLMALLOC_EXPORT void dlmalloc_inspect_all(void(*handler)(void*, void *, size_t, void*),
void* arg);
#endif /* MALLOC_INSPECT_ALL */
#if !NO_MALLINFO
/*
mallinfo()
Returns (by copy) a struct containing various summary statistics:
arena: current total non-mmapped bytes allocated from system
ordblks: the number of free chunks
smblks: always zero.
hblks: current number of mmapped regions
hblkhd: total bytes held in mmapped regions
usmblks: the maximum total allocated space. This will be greater
than current total if trimming has occurred.
fsmblks: always zero
uordblks: current total allocated space (normal or mmapped)
fordblks: total free space
keepcost: the maximum number of bytes that could ideally be released
back to system via malloc_trim. ("ideally" means that
it ignores page restrictions etc.)
Because these fields are ints, but internal bookkeeping may
be kept as longs, the reported values may wrap around zero and
thus be inaccurate.
*/
DLMALLOC_EXPORT struct mallinfo dlmallinfo(void);
#endif /* NO_MALLINFO */
/*
independent_calloc(size_t n_elements, size_t element_size, void* chunks[]);
independent_calloc is similar to calloc, but instead of returning a
single cleared space, it returns an array of pointers to n_elements
independent elements that can hold contents of size elem_size, each
of which starts out cleared, and can be independently freed,
realloc'ed etc. The elements are guaranteed to be adjacently
allocated (this is not guaranteed to occur with multiple callocs or
mallocs), which may also improve cache locality in some
applications.
The "chunks" argument is optional (i.e., may be null, which is
probably the most typical usage). If it is null, the returned array
is itself dynamically allocated and should also be freed when it is
no longer needed. Otherwise, the chunks array must be of at least
n_elements in length. It is filled in with the pointers to the
chunks.
In either case, independent_calloc returns this pointer array, or
null if the allocation failed. If n_elements is zero and "chunks"
is null, it returns a chunk representing an array with zero elements
(which should be freed if not wanted).
Each element must be freed when it is no longer needed. This can be
done all at once using bulk_free.
independent_calloc simplifies and speeds up implementations of many
kinds of pools. It may also be useful when constructing large data
structures that initially have a fixed number of fixed-sized nodes,
but the number is not known at compile time, and some of the nodes
may later need to be freed. For example:
struct Node { int item; struct Node* next; };
struct Node* build_list() {
struct Node** pool;
int n = read_number_of_nodes_needed();
if (n <= 0) return 0;
pool = (struct Node**)(independent_calloc(n, sizeof(struct Node), 0);
if (pool == 0) die();
// organize into a linked list...
struct Node* first = pool[0];
for (i = 0; i < n-1; ++i)
pool[i]->next = pool[i+1];
free(pool); // Can now free the array (or not, if it is needed later)
return first;
}
*/
DLMALLOC_EXPORT void** dlindependent_calloc(size_t, size_t, void**);
/*
independent_comalloc(size_t n_elements, size_t sizes[], void* chunks[]);
independent_comalloc allocates, all at once, a set of n_elements
chunks with sizes indicated in the "sizes" array. It returns
an array of pointers to these elements, each of which can be
independently freed, realloc'ed etc. The elements are guaranteed to
be adjacently allocated (this is not guaranteed to occur with
multiple callocs or mallocs), which may also improve cache locality
in some applications.
The "chunks" argument is optional (i.e., may be null). If it is null
the returned array is itself dynamically allocated and should also
be freed when it is no longer needed. Otherwise, the chunks array
must be of at least n_elements in length. It is filled in with the
pointers to the chunks.
In either case, independent_comalloc returns this pointer array, or
null if the allocation failed. If n_elements is zero and chunks is
null, it returns a chunk representing an array with zero elements
(which should be freed if not wanted).
Each element must be freed when it is no longer needed. This can be
done all at once using bulk_free.
independent_comallac differs from independent_calloc in that each
element may have a different size, and also that it does not
automatically clear elements.
independent_comalloc can be used to speed up allocation in cases
where several structs or objects must always be allocated at the
same time. For example:
struct Head { ... }
struct Foot { ... }
void send_message(char* msg) {
int msglen = strlen(msg);
size_t sizes[3] = { sizeof(struct Head), msglen, sizeof(struct Foot) };
void* chunks[3];
if (independent_comalloc(3, sizes, chunks) == 0)
die();
struct Head* head = (struct Head*)(chunks[0]);
char* body = (char*)(chunks[1]);
struct Foot* foot = (struct Foot*)(chunks[2]);
// ...
}
In general though, independent_comalloc is worth using only for
larger values of n_elements. For small values, you probably won't
detect enough difference from series of malloc calls to bother.
Overuse of independent_comalloc can increase overall memory usage,
since it cannot reuse existing noncontiguous small chunks that
might be available for some of the elements.
*/
DLMALLOC_EXPORT void** dlindependent_comalloc(size_t, size_t*, void**);
/*
bulk_free(void* array[], size_t n_elements)
Frees and clears (sets to null) each non-null pointer in the given
array. This is likely to be faster than freeing them one-by-one.
If footers are used, pointers that have been allocated in different
mspaces are not freed or cleared, and the count of all such pointers
is returned. For large arrays of pointers with poor locality, it
may be worthwhile to sort this array before calling bulk_free.
*/
DLMALLOC_EXPORT size_t dlbulk_free(void**, size_t n_elements);
/*
pvalloc(size_t n);
Equivalent to valloc(minimum-page-that-holds(n)), that is,
round up n to nearest pagesize.
*/
DLMALLOC_EXPORT void* dlpvalloc(size_t);
/*
malloc_trim(size_t pad);
If possible, gives memory back to the system (via negative arguments
to sbrk) if there is unused memory at the `high' end of the malloc
pool or in unused MMAP segments. You can call this after freeing
large blocks of memory to potentially reduce the system-level memory
requirements of a program. However, it cannot guarantee to reduce
memory. Under some allocation patterns, some large free blocks of
memory will be locked between two used chunks, so they cannot be
given back to the system.
The `pad' argument to malloc_trim represents the amount of free
trailing space to leave untrimmed. If this argument is zero, only
the minimum amount of memory to maintain internal data structures
will be left. Non-zero arguments can be supplied to maintain enough
trailing space to service future expected allocations without having
to re-obtain memory from the system.
Malloc_trim returns 1 if it actually released any memory, else 0.
*/
DLMALLOC_EXPORT int dlmalloc_trim(size_t);
/*
malloc_stats();
Prints on stderr the amount of space obtained from the system (both
via sbrk and mmap), the maximum amount (which may be more than
current if malloc_trim and/or munmap got called), and the current
number of bytes allocated via malloc (or realloc, etc) but not yet
freed. Note that this is the number of bytes allocated, not the
number requested. It will be larger than the number requested
because of alignment and bookkeeping overhead. Because it includes
alignment wastage as being in use, this figure may be greater than
zero even when no user-level chunks are allocated.
The reported current and maximum system memory can be inaccurate if
a program makes other calls to system memory allocation functions
(normally sbrk) outside of malloc.
malloc_stats prints only the most commonly interesting statistics.
More information can be obtained by calling mallinfo.
*/
DLMALLOC_EXPORT void dlmalloc_stats(void);
/*
malloc_usable_size(void* p);
Returns the number of bytes you can actually use in
an allocated chunk, which may be more than you requested (although
often not) due to alignment and minimum size constraints.
You can use this many bytes without worrying about
overwriting other allocated objects. This is not a particularly great
programming practice. malloc_usable_size can be more useful in
debugging and assertions, for example:
p = malloc(n);
assert(malloc_usable_size(p) >= 256);
*/
size_t dlmalloc_usable_size(void*);
#endif /* ONLY_MSPACES */
#if MSPACES
/*
mspace is an opaque type representing an independent
region of space that supports mspace_malloc, etc.
*/
typedef void* mspace;
/*
create_mspace creates and returns a new independent space with the
given initial capacity, or, if 0, the default granularity size. It
returns null if there is no system memory available to create the
space. If argument locked is non-zero, the space uses a separate
lock to control access. The capacity of the space will grow
dynamically as needed to service mspace_malloc requests. You can
control the sizes of incremental increases of this space by
compiling with a different DEFAULT_GRANULARITY or dynamically
setting with mallopt(M_GRANULARITY, value).
*/
DLMALLOC_EXPORT mspace create_mspace(size_t capacity, int locked);
/*
destroy_mspace destroys the given space, and attempts to return all
of its memory back to the system, returning the total number of
bytes freed. After destruction, the results of access to all memory
used by the space become undefined.
*/
DLMALLOC_EXPORT size_t destroy_mspace(mspace msp);
/*
create_mspace_with_base uses the memory supplied as the initial base
of a new mspace. Part (less than 128*sizeof(size_t) bytes) of this
space is used for bookkeeping, so the capacity must be at least this
large. (Otherwise 0 is returned.) When this initial space is
exhausted, additional memory will be obtained from the system.
Destroying this space will deallocate all additionally allocated
space (if possible) but not the initial base.
*/
DLMALLOC_EXPORT mspace create_mspace_with_base(void* base, size_t capacity, int locked);
/*
mspace_track_large_chunks controls whether requests for large chunks
are allocated in their own untracked mmapped regions, separate from
others in this mspace. By default large chunks are not tracked,
which reduces fragmentation. However, such chunks are not
necessarily released to the system upon destroy_mspace. Enabling
tracking by setting to true may increase fragmentation, but avoids
leakage when relying on destroy_mspace to release all memory
allocated using this space. The function returns the previous
setting.
*/
DLMALLOC_EXPORT int mspace_track_large_chunks(mspace msp, int enable);
/*
mspace_malloc behaves as malloc, but operates within
the given space.
*/
DLMALLOC_EXPORT void* mspace_malloc(mspace msp, size_t bytes);
/*
mspace_free behaves as free, but operates within
the given space.
If compiled with FOOTERS==1, mspace_free is not actually needed.
free may be called instead of mspace_free because freed chunks from
any space are handled by their originating spaces.
*/
DLMALLOC_EXPORT void mspace_free(mspace msp, void* mem);
/*
mspace_realloc behaves as realloc, but operates within
the given space.
If compiled with FOOTERS==1, mspace_realloc is not actually
needed. realloc may be called instead of mspace_realloc because
realloced chunks from any space are handled by their originating
spaces.
*/
DLMALLOC_EXPORT void* mspace_realloc(mspace msp, void* mem, size_t newsize);
/*
mspace_calloc behaves as calloc, but operates within
the given space.
*/
DLMALLOC_EXPORT void* mspace_calloc(mspace msp, size_t n_elements, size_t elem_size);
/*
mspace_memalign behaves as memalign, but operates within
the given space.
*/
DLMALLOC_EXPORT void* mspace_memalign(mspace msp, size_t alignment, size_t bytes);
/*
mspace_independent_calloc behaves as independent_calloc, but
operates within the given space.
*/
DLMALLOC_EXPORT void** mspace_independent_calloc(mspace msp, size_t n_elements,
size_t elem_size, void* chunks[]);
/*
mspace_independent_comalloc behaves as independent_comalloc, but
operates within the given space.
*/
DLMALLOC_EXPORT void** mspace_independent_comalloc(mspace msp, size_t n_elements,
size_t sizes[], void* chunks[]);
/*
mspace_footprint() returns the number of bytes obtained from the
system for this space.
*/
DLMALLOC_EXPORT size_t mspace_footprint(mspace msp);
/*
mspace_max_footprint() returns the peak number of bytes obtained from the
system for this space.
*/
DLMALLOC_EXPORT size_t mspace_max_footprint(mspace msp);
#if !NO_MALLINFO
/*
mspace_mallinfo behaves as mallinfo, but reports properties of
the given space.
*/
DLMALLOC_EXPORT struct mallinfo mspace_mallinfo(mspace msp);
#endif /* NO_MALLINFO */
/*
malloc_usable_size(void* p) behaves the same as malloc_usable_size;
*/
DLMALLOC_EXPORT size_t mspace_usable_size(const void* mem);
/*
mspace_malloc_stats behaves as malloc_stats, but reports
properties of the given space.
*/
DLMALLOC_EXPORT void mspace_malloc_stats(mspace msp);
/*
mspace_trim behaves as malloc_trim, but
operates within the given space.
*/
DLMALLOC_EXPORT int mspace_trim(mspace msp, size_t pad);
/*
An alias for mallopt.
*/
DLMALLOC_EXPORT int mspace_mallopt(int, int);
#endif /* MSPACES */
#ifdef __cplusplus
} /* end of extern "C" */
#endif /* __cplusplus */
/*
========================================================================
To make a fully customizable malloc.h header file, cut everything
above this line, put into file malloc.h, edit to suit, and #include it
on the next line, as well as in programs that use this malloc.
========================================================================
*/
/* #include "malloc.h" */
#include <errno.h>
/*------------------------------ internal #includes ---------------------- */
#ifdef _MSC_VER
#pragma warning( disable : 4146 ) /* no "unsigned" warnings */
#endif /* _MSC_VER */
#if !NO_MALLOC_STATS
#include <stdio.h> /* for printing in malloc_stats */
#endif /* NO_MALLOC_STATS */
#ifndef LACKS_ERRNO_H
#include <errno.h> /* for MALLOC_FAILURE_ACTION */
#endif /* LACKS_ERRNO_H */
#ifdef DEBUG
#if ABORT_ON_ASSERT_FAILURE
#undef assert
#define assert(x) if(!(x)) ABORT
#else /* ABORT_ON_ASSERT_FAILURE */
#include <assert.h>
#endif /* ABORT_ON_ASSERT_FAILURE */
#else /* DEBUG */
#ifndef assert
#define assert(x)
#endif
#define DEBUG 0
#endif /* DEBUG */
#if !defined(WIN32) && !defined(LACKS_TIME_H)
#include <time.h> /* for magic initialization */
#endif /* WIN32 */
#ifndef LACKS_STDLIB_H
#include <stdlib.h> /* for abort() */
#endif /* LACKS_STDLIB_H */
#ifndef LACKS_STRING_H
#include <string.h> /* for memset etc */
#endif /* LACKS_STRING_H */
#if USE_BUILTIN_FFS
#ifndef LACKS_STRINGS_H
#include <strings.h> /* for ffs */
#endif /* LACKS_STRINGS_H */
#endif /* USE_BUILTIN_FFS */
#if HAVE_MMAP
#ifndef LACKS_SYS_MMAN_H
/* On some versions of linux, mremap decl in mman.h needs __USE_GNU set */
#if (defined(linux) && !defined(__USE_GNU))
#define __USE_GNU 1
#include <sys/mman.h> /* for mmap */
#undef __USE_GNU
#else
#include <sys/mman.h> /* for mmap */
#endif /* linux */
#endif /* LACKS_SYS_MMAN_H */
#ifndef LACKS_FCNTL_H
#include <fcntl.h>
#endif /* LACKS_FCNTL_H */
#endif /* HAVE_MMAP */
#ifndef LACKS_UNISTD_H
#include <unistd.h> /* for sbrk, sysconf */
#else /* LACKS_UNISTD_H */
#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__)
extern void* sbrk(ptrdiff_t);
#endif /* FreeBSD etc */
#endif /* LACKS_UNISTD_H */
/* Declarations for locking */
#if USE_LOCKS
#ifndef WIN32
#if defined (__SVR4) && defined (__sun) /* solaris */
#include <thread.h>
#elif !defined(LACKS_SCHED_H)
#include <sched.h>
#endif /* solaris or LACKS_SCHED_H */
#if (defined(USE_RECURSIVE_LOCKS) && USE_RECURSIVE_LOCKS != 0) || !USE_SPIN_LOCKS
#include <pthread.h>
#endif /* USE_RECURSIVE_LOCKS ... */
#elif defined(_MSC_VER)
#ifndef _M_AMD64
/* These are already defined on AMD64 builds */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
LONG __cdecl _InterlockedCompareExchange(LONG volatile *Dest, LONG Exchange, LONG Comp);
LONG __cdecl _InterlockedExchange(LONG volatile *Target, LONG Value);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* _M_AMD64 */
#pragma intrinsic (_InterlockedCompareExchange)
#pragma intrinsic (_InterlockedExchange)
#define interlockedcompareexchange _InterlockedCompareExchange
#define interlockedexchange _InterlockedExchange
#elif defined(WIN32) && defined(__GNUC__)
#define interlockedcompareexchange(a, b, c) __sync_val_compare_and_swap(a, c, b)
#define interlockedexchange __sync_lock_test_and_set
#endif /* Win32 */
#else /* USE_LOCKS */
#endif /* USE_LOCKS */
#ifndef LOCK_AT_FORK
#define LOCK_AT_FORK 0
#endif
/* Declarations for bit scanning on win32 */
#if defined(_MSC_VER) && _MSC_VER>=1300
#ifndef BitScanForward /* Try to avoid pulling in WinNT.h */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
unsigned char _BitScanForward(unsigned long *index, unsigned long mask);
unsigned char _BitScanReverse(unsigned long *index, unsigned long mask);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#define BitScanForward _BitScanForward
#define BitScanReverse _BitScanReverse
#pragma intrinsic(_BitScanForward)
#pragma intrinsic(_BitScanReverse)
#endif /* BitScanForward */
#endif /* defined(_MSC_VER) && _MSC_VER>=1300 */
#ifndef WIN32
#ifndef malloc_getpagesize
# ifdef _SC_PAGESIZE /* some SVR4 systems omit an underscore */
# ifndef _SC_PAGE_SIZE
# define _SC_PAGE_SIZE _SC_PAGESIZE
# endif
# endif
# ifdef _SC_PAGE_SIZE
# define malloc_getpagesize sysconf(_SC_PAGE_SIZE)
# else
# if defined(BSD) || defined(DGUX) || defined(HAVE_GETPAGESIZE)
extern size_t getpagesize();
# define malloc_getpagesize getpagesize()
# else
# ifdef WIN32 /* use supplied emulation of getpagesize */
# define malloc_getpagesize getpagesize()
# else
# ifndef LACKS_SYS_PARAM_H
# include <sys/param.h>
# endif
# ifdef EXEC_PAGESIZE
# define malloc_getpagesize EXEC_PAGESIZE
# else
# ifdef NBPG
# ifndef CLSIZE
# define malloc_getpagesize NBPG
# else
# define malloc_getpagesize (NBPG * CLSIZE)
# endif
# else
# ifdef NBPC
# define malloc_getpagesize NBPC
# else
# ifdef PAGESIZE
# define malloc_getpagesize PAGESIZE
# else /* just guess */
# define malloc_getpagesize ((size_t)4096U)
# endif
# endif
# endif
# endif
# endif
# endif
# endif
#endif
#endif
/* ------------------- size_t and alignment properties -------------------- */
/* The byte and bit size of a size_t */
#define SIZE_T_SIZE (sizeof(size_t))
#define SIZE_T_BITSIZE (sizeof(size_t) << 3)
/* Some constants coerced to size_t */
/* Annoying but necessary to avoid errors on some platforms */
#define SIZE_T_ZERO ((size_t)0)
#define SIZE_T_ONE ((size_t)1)
#define SIZE_T_TWO ((size_t)2)
#define SIZE_T_FOUR ((size_t)4)
#define TWO_SIZE_T_SIZES (SIZE_T_SIZE<<1)
#define FOUR_SIZE_T_SIZES (SIZE_T_SIZE<<2)
#define SIX_SIZE_T_SIZES (FOUR_SIZE_T_SIZES+TWO_SIZE_T_SIZES)
#define HALF_MAX_SIZE_T (MAX_SIZE_T / 2U)
/* The bit mask value corresponding to MALLOC_ALIGNMENT */
#define CHUNK_ALIGN_MASK (MALLOC_ALIGNMENT - SIZE_T_ONE)
/* True if address a has acceptable alignment */
#define is_aligned(A) (((size_t)((A)) & (CHUNK_ALIGN_MASK)) == 0)
/* the number of bytes to offset an address to align it */
#define align_offset(A)\
((((size_t)(A) & CHUNK_ALIGN_MASK) == 0)? 0 :\
((MALLOC_ALIGNMENT - ((size_t)(A) & CHUNK_ALIGN_MASK)) & CHUNK_ALIGN_MASK))
/* -------------------------- MMAP preliminaries ------------------------- */
/*
If HAVE_MORECORE or HAVE_MMAP are false, we just define calls and
checks to fail so compiler optimizer can delete code rather than
using so many "#if"s.
*/
/* MORECORE and MMAP must return MFAIL on failure */
#define MFAIL ((void*)(MAX_SIZE_T))
#define CMFAIL ((char*)(MFAIL)) /* defined for convenience */
#if HAVE_MMAP
#ifndef WIN32
#define MUNMAP_DEFAULT(a, s) munmap((a), (s))
#define MMAP_PROT (PROT_READ|PROT_WRITE)
#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
#define MAP_ANONYMOUS MAP_ANON
#endif /* MAP_ANON */
#ifdef MAP_ANONYMOUS
#define MMAP_FLAGS (MAP_PRIVATE|MAP_ANONYMOUS)
#define MMAP_DEFAULT(s) mmap(0, (s), MMAP_PROT, MMAP_FLAGS, -1, 0)
#else /* MAP_ANONYMOUS */
/*
Nearly all versions of mmap support MAP_ANONYMOUS, so the following
is unlikely to be needed, but is supplied just in case.
*/
#define MMAP_FLAGS (MAP_PRIVATE)
static int dev_zero_fd = -1; /* Cached file descriptor for /dev/zero. */
#define MMAP_DEFAULT(s) ((dev_zero_fd < 0) ? \
(dev_zero_fd = open("/dev/zero", O_RDWR), \
mmap(0, (s), MMAP_PROT, MMAP_FLAGS, dev_zero_fd, 0)) : \
mmap(0, (s), MMAP_PROT, MMAP_FLAGS, dev_zero_fd, 0))
#endif /* MAP_ANONYMOUS */
#define DIRECT_MMAP_DEFAULT(s) MMAP_DEFAULT(s)
#else /* WIN32 */
/* Win32 MMAP via VirtualAlloc */
static FORCEINLINE void* win32mmap(size_t size) {
void* ptr = VirtualAlloc(0, size, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
return (ptr != 0) ? ptr : MFAIL;
}
/* For direct MMAP, use MEM_TOP_DOWN to minimize interference */
static FORCEINLINE void* win32direct_mmap(size_t size) {
void* ptr = VirtualAlloc(0, size, MEM_RESERVE | MEM_COMMIT | MEM_TOP_DOWN,
PAGE_READWRITE);
return (ptr != 0) ? ptr : MFAIL;
}
/* This function supports releasing coalesed segments */
static FORCEINLINE int win32munmap(void* ptr, size_t size) {
MEMORY_BASIC_INFORMATION minfo;
char* cptr = (char*)ptr;
while (size) {
if (VirtualQuery(cptr, &minfo, sizeof(minfo)) == 0)
return -1;
if (minfo.BaseAddress != cptr || minfo.AllocationBase != cptr ||
minfo.State != MEM_COMMIT || minfo.RegionSize > size)
return -1;
if (VirtualFree(cptr, 0, MEM_RELEASE) == 0)
return -1;
cptr += minfo.RegionSize;
size -= minfo.RegionSize;
}
return 0;
}
#define MMAP_DEFAULT(s) win32mmap(s)
#define MUNMAP_DEFAULT(a, s) win32munmap((a), (s))
#define DIRECT_MMAP_DEFAULT(s) win32direct_mmap(s)
#endif /* WIN32 */
#endif /* HAVE_MMAP */
#if HAVE_MREMAP
#ifndef WIN32
#define MREMAP_DEFAULT(addr, osz, nsz, mv) mremap((addr), (osz), (nsz), (mv))
#endif /* WIN32 */
#endif /* HAVE_MREMAP */
/**
* Define CALL_MORECORE
*/
#if HAVE_MORECORE
#ifdef MORECORE
#define CALL_MORECORE(S) MORECORE(S)
#else /* MORECORE */
#define CALL_MORECORE(S) MORECORE_DEFAULT(S)
#endif /* MORECORE */
#else /* HAVE_MORECORE */
#define CALL_MORECORE(S) MFAIL
#endif /* HAVE_MORECORE */
/**
* Define CALL_MMAP/CALL_MUNMAP/CALL_DIRECT_MMAP
*/
#if HAVE_MMAP
#define USE_MMAP_BIT (SIZE_T_ONE)
#ifdef MMAP
#define CALL_MMAP(s) MMAP(s)
#else /* MMAP */
#define CALL_MMAP(s) MMAP_DEFAULT(s)
#endif /* MMAP */
#ifdef MUNMAP
#define CALL_MUNMAP(a, s) MUNMAP((a), (s))
#else /* MUNMAP */
#define CALL_MUNMAP(a, s) MUNMAP_DEFAULT((a), (s))
#endif /* MUNMAP */
#ifdef DIRECT_MMAP
#define CALL_DIRECT_MMAP(s) DIRECT_MMAP(s)
#else /* DIRECT_MMAP */
#define CALL_DIRECT_MMAP(s) DIRECT_MMAP_DEFAULT(s)
#endif /* DIRECT_MMAP */
#else /* HAVE_MMAP */
#define USE_MMAP_BIT (SIZE_T_ZERO)
#define MMAP(s) MFAIL
#define MUNMAP(a, s) (-1)
#define DIRECT_MMAP(s) MFAIL
#define CALL_DIRECT_MMAP(s) DIRECT_MMAP(s)
#define CALL_MMAP(s) MMAP(s)
#define CALL_MUNMAP(a, s) MUNMAP((a), (s))
#endif /* HAVE_MMAP */
/**
* Define CALL_MREMAP
*/
#if HAVE_MMAP && HAVE_MREMAP
#ifdef MREMAP
#define CALL_MREMAP(addr, osz, nsz, mv) MREMAP((addr), (osz), (nsz), (mv))
#else /* MREMAP */
#define CALL_MREMAP(addr, osz, nsz, mv) MREMAP_DEFAULT((addr), (osz), (nsz), (mv))
#endif /* MREMAP */
#else /* HAVE_MMAP && HAVE_MREMAP */
#define CALL_MREMAP(addr, osz, nsz, mv) MFAIL
#endif /* HAVE_MMAP && HAVE_MREMAP */
/* mstate bit set if continguous morecore disabled or failed */
#define USE_NONCONTIGUOUS_BIT (4U)
/* segment bit set in create_mspace_with_base */
#define EXTERN_BIT (8U)
/* --------------------------- Lock preliminaries ------------------------ */
/*
When locks are defined, there is one global lock, plus
one per-mspace lock.
The global lock_ensures that mparams.magic and other unique
mparams values are initialized only once. It also protects
sequences of calls to MORECORE. In many cases sys_alloc requires
two calls, that should not be interleaved with calls by other
threads. This does not protect against direct calls to MORECORE
by other threads not using this lock, so there is still code to
cope the best we can on interference.
Per-mspace locks surround calls to malloc, free, etc.
By default, locks are simple non-reentrant mutexes.
Because lock-protected regions generally have bounded times, it is
OK to use the supplied simple spinlocks. Spinlocks are likely to
improve performance for lightly contended applications, but worsen
performance under heavy contention.
If USE_LOCKS is > 1, the definitions of lock routines here are
bypassed, in which case you will need to define the type MLOCK_T,
and at least INITIAL_LOCK, DESTROY_LOCK, ACQUIRE_LOCK, RELEASE_LOCK
and TRY_LOCK. You must also declare a
static MLOCK_T malloc_global_mutex = { initialization values };.
*/
#if !USE_LOCKS
#define USE_LOCK_BIT (0U)
#define INITIAL_LOCK(l) (0)
#define DESTROY_LOCK(l) (0)
#define ACQUIRE_MALLOC_GLOBAL_LOCK()
#define RELEASE_MALLOC_GLOBAL_LOCK()
#else
#if USE_LOCKS > 1
/* ----------------------- User-defined locks ------------------------ */
/* Define your own lock implementation here */
/* #define INITIAL_LOCK(lk) ... */
/* #define DESTROY_LOCK(lk) ... */
/* #define ACQUIRE_LOCK(lk) ... */
/* #define RELEASE_LOCK(lk) ... */
/* #define TRY_LOCK(lk) ... */
/* static MLOCK_T malloc_global_mutex = ... */
#elif USE_SPIN_LOCKS
/* First, define CAS_LOCK and CLEAR_LOCK on ints */
/* Note CAS_LOCK defined to return 0 on success */
#if defined(__GNUC__)&& (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1))
#define CAS_LOCK(sl) __sync_lock_test_and_set(sl, 1)
#define CLEAR_LOCK(sl) __sync_lock_release(sl)
#elif (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)))
/* Custom spin locks for older gcc on x86 */
static FORCEINLINE int x86_cas_lock(int *sl) {
int ret;
int val = 1;
int cmp = 0;
__asm__ __volatile__("lock; cmpxchgl %1, %2"
: "=a" (ret)
: "r" (val), "m" (*(sl)), "0"(cmp)
: "memory", "cc");
return ret;
}
static FORCEINLINE void x86_clear_lock(int* sl) {
assert(*sl != 0);
int prev = 0;
int ret;
__asm__ __volatile__("lock; xchgl %0, %1"
: "=r" (ret)
: "m" (*(sl)), "0"(prev)
: "memory");
}
#define CAS_LOCK(sl) x86_cas_lock(sl)
#define CLEAR_LOCK(sl) x86_clear_lock(sl)
#else /* Win32 MSC */
#define CAS_LOCK(sl) interlockedexchange(sl, (LONG)1)
#define CLEAR_LOCK(sl) interlockedexchange (sl, (LONG)0)
#endif /* ... gcc spins locks ... */
/* How to yield for a spin lock */
#define SPINS_PER_YIELD 63
#if defined(_MSC_VER)
#define SLEEP_EX_DURATION 50 /* delay for yield/sleep */
#define SPIN_LOCK_YIELD SleepEx(SLEEP_EX_DURATION, FALSE)
#elif defined (__SVR4) && defined (__sun) /* solaris */
#define SPIN_LOCK_YIELD thr_yield();
#elif !defined(LACKS_SCHED_H)
#define SPIN_LOCK_YIELD sched_yield();
#else
#define SPIN_LOCK_YIELD
#endif /* ... yield ... */
#if !defined(USE_RECURSIVE_LOCKS) || USE_RECURSIVE_LOCKS == 0
/* Plain spin locks use single word (embedded in malloc_states) */
static int spin_acquire_lock(int *sl) {
int spins = 0;
while (*(volatile int *)sl != 0 || CAS_LOCK(sl)) {
if ((++spins & SPINS_PER_YIELD) == 0) {
SPIN_LOCK_YIELD;
}
}
return 0;
}
#define MLOCK_T int
#define TRY_LOCK(sl) !CAS_LOCK(sl)
#define RELEASE_LOCK(sl) CLEAR_LOCK(sl)
#define ACQUIRE_LOCK(sl) (CAS_LOCK(sl)? spin_acquire_lock(sl) : 0)
#define INITIAL_LOCK(sl) (*sl = 0)
#define DESTROY_LOCK(sl) (0)
static MLOCK_T malloc_global_mutex = 0;
#else /* USE_RECURSIVE_LOCKS */
/* types for lock owners */
#ifdef WIN32
#define THREAD_ID_T DWORD
#define CURRENT_THREAD GetCurrentThreadId()
#define EQ_OWNER(X,Y) ((X) == (Y))
#else
/*
Note: the following assume that pthread_t is a type that can be
initialized to (casted) zero. If this is not the case, you will need to
somehow redefine these or not use spin locks.
*/
#define THREAD_ID_T pthread_t
#define CURRENT_THREAD pthread_self()
#define EQ_OWNER(X,Y) pthread_equal(X, Y)
#endif
struct malloc_recursive_lock {
int sl;
unsigned int c;
THREAD_ID_T threadid;
};
#define MLOCK_T struct malloc_recursive_lock
static MLOCK_T malloc_global_mutex = { 0, 0, (THREAD_ID_T)0 };
static FORCEINLINE void recursive_release_lock(MLOCK_T *lk) {
assert(lk->sl != 0);
if (--lk->c == 0) {
CLEAR_LOCK(&lk->sl);
}
}
static FORCEINLINE int recursive_acquire_lock(MLOCK_T *lk) {
THREAD_ID_T mythreadid = CURRENT_THREAD;
int spins = 0;
for (;;) {
if (*((volatile int *)(&lk->sl)) == 0) {
if (!CAS_LOCK(&lk->sl)) {
lk->threadid = mythreadid;
lk->c = 1;
return 0;
}
}
else if (EQ_OWNER(lk->threadid, mythreadid)) {
++lk->c;
return 0;
}
if ((++spins & SPINS_PER_YIELD) == 0) {
SPIN_LOCK_YIELD;
}
}
}
static FORCEINLINE int recursive_try_lock(MLOCK_T *lk) {
THREAD_ID_T mythreadid = CURRENT_THREAD;
if (*((volatile int *)(&lk->sl)) == 0) {
if (!CAS_LOCK(&lk->sl)) {
lk->threadid = mythreadid;
lk->c = 1;
return 1;
}
}
else if (EQ_OWNER(lk->threadid, mythreadid)) {
++lk->c;
return 1;
}
return 0;
}
#define RELEASE_LOCK(lk) recursive_release_lock(lk)
#define TRY_LOCK(lk) recursive_try_lock(lk)
#define ACQUIRE_LOCK(lk) recursive_acquire_lock(lk)
#define INITIAL_LOCK(lk) ((lk)->threadid = (THREAD_ID_T)0, (lk)->sl = 0, (lk)->c = 0)
#define DESTROY_LOCK(lk) (0)
#endif /* USE_RECURSIVE_LOCKS */
#elif defined(WIN32) /* Win32 critical sections */
#define MLOCK_T CRITICAL_SECTION
#define ACQUIRE_LOCK(lk) (EnterCriticalSection(lk), 0)
#define RELEASE_LOCK(lk) LeaveCriticalSection(lk)
#define TRY_LOCK(lk) TryEnterCriticalSection(lk)
#define INITIAL_LOCK(lk) (!InitializeCriticalSectionAndSpinCount((lk), 0x80000000|4000))
#define DESTROY_LOCK(lk) (DeleteCriticalSection(lk), 0)
#define NEED_GLOBAL_LOCK_INIT
static MLOCK_T malloc_global_mutex;
static volatile LONG malloc_global_mutex_status;
/* Use spin loop to initialize global lock */
static void init_malloc_global_mutex() {
for (;;) {
long stat = malloc_global_mutex_status;
if (stat > 0)
return;
/* transition to < 0 while initializing, then to > 0) */
if (stat == 0 &&
interlockedcompareexchange(&malloc_global_mutex_status, (LONG)-1, (LONG)0) == 0) {
InitializeCriticalSection(&malloc_global_mutex);
interlockedexchange(&malloc_global_mutex_status, (LONG)1);
return;
}
SleepEx(0, FALSE);
}
}
#else /* pthreads-based locks */
#define MLOCK_T pthread_mutex_t
#define ACQUIRE_LOCK(lk) pthread_mutex_lock(lk)
#define RELEASE_LOCK(lk) pthread_mutex_unlock(lk)
#define TRY_LOCK(lk) (!pthread_mutex_trylock(lk))
#define INITIAL_LOCK(lk) pthread_init_lock(lk)
#define DESTROY_LOCK(lk) pthread_mutex_destroy(lk)
#if defined(USE_RECURSIVE_LOCKS) && USE_RECURSIVE_LOCKS != 0 && defined(linux) && !defined(PTHREAD_MUTEX_RECURSIVE)
/* Cope with old-style linux recursive lock initialization by adding */
/* skipped internal declaration from pthread.h */
extern int pthread_mutexattr_setkind_np __P((pthread_mutexattr_t *__attr,
int __kind));
#define PTHREAD_MUTEX_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP
#define pthread_mutexattr_settype(x,y) pthread_mutexattr_setkind_np(x,y)
#endif /* USE_RECURSIVE_LOCKS ... */
static MLOCK_T malloc_global_mutex = PTHREAD_MUTEX_INITIALIZER;
static int pthread_init_lock(MLOCK_T *lk) {
pthread_mutexattr_t attr;
if (pthread_mutexattr_init(&attr)) return 1;
#if defined(USE_RECURSIVE_LOCKS) && USE_RECURSIVE_LOCKS != 0
if (pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE)) return 1;
#endif
if (pthread_mutex_init(lk, &attr)) return 1;
if (pthread_mutexattr_destroy(&attr)) return 1;
return 0;
}
#endif /* ... lock types ... */
/* Common code for all lock types */
#define USE_LOCK_BIT (2U)
#ifndef ACQUIRE_MALLOC_GLOBAL_LOCK
#define ACQUIRE_MALLOC_GLOBAL_LOCK() ACQUIRE_LOCK(&malloc_global_mutex);
#endif
#ifndef RELEASE_MALLOC_GLOBAL_LOCK
#define RELEASE_MALLOC_GLOBAL_LOCK() RELEASE_LOCK(&malloc_global_mutex);
#endif
#endif /* USE_LOCKS */
/* ----------------------- Chunk representations ------------------------ */
/*
(The following includes lightly edited explanations by Colin Plumb.)
The malloc_chunk declaration below is misleading (but accurate and
necessary). It declares a "view" into memory allowing access to
necessary fields at known offsets from a given base.
Chunks of memory are maintained using a `boundary tag' method as
originally described by Knuth. (See the paper by Paul Wilson
ftp://ftp.cs.utexas.edu/pub/garbage/allocsrv.ps for a survey of such
techniques.) Sizes of free chunks are stored both in the front of
each chunk and at the end. This makes consolidating fragmented
chunks into bigger chunks fast. The head fields also hold bits
representing whether chunks are free or in use.
Here are some pictures to make it clearer. They are "exploded" to
show that the state of a chunk can be thought of as extending from
the high 31 bits of the head field of its header through the
prev_foot and PINUSE_BIT bit of the following chunk header.
A chunk that's in use looks like:
chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Size of previous chunk (if P = 0) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |P|
| Size of this chunk 1| +-+
mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
+- -+
| |
+- -+
| :
+- size - sizeof(size_t) available payload bytes -+
: |
chunk-> +- -+
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |1|
| Size of next chunk (may or may not be in use) | +-+
mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
And if it's free, it looks like this:
chunk-> +- -+
| User payload (must be in use, or we would have merged!) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |P|
| Size of this chunk 0| +-+
mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Next pointer |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Prev pointer |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| :
+- size - sizeof(struct chunk) unused bytes -+
: |
chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Size of this chunk |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |0|
| Size of next chunk (must be in use, or we would have merged)| +-+
mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| :
+- User payload -+
: |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|0|
+-+
Note that since we always merge adjacent free chunks, the chunks
adjacent to a free chunk must be in use.
Given a pointer to a chunk (which can be derived trivially from the
payload pointer) we can, in O(1) time, find out whether the adjacent
chunks are free, and if so, unlink them from the lists that they
are on and merge them with the current chunk.
Chunks always begin on even word boundaries, so the mem portion
(which is returned to the user) is also on an even word boundary, and
thus at least double-word aligned.
The P (PINUSE_BIT) bit, stored in the unused low-order bit of the
chunk size (which is always a multiple of two words), is an in-use
bit for the *previous* chunk. If that bit is *clear*, then the
word before the current chunk size contains the previous chunk
size, and can be used to find the front of the previous chunk.
The very first chunk allocated always has this bit set, preventing
access to non-existent (or non-owned) memory. If pinuse is set for
any given chunk, then you CANNOT determine the size of the
previous chunk, and might even get a memory addressing fault when
trying to do so.
The C (CINUSE_BIT) bit, stored in the unused second-lowest bit of
the chunk size redundantly records whether the current chunk is
inuse (unless the chunk is mmapped). This redundancy enables usage
checks within free and realloc, and reduces indirection when freeing
and consolidating chunks.
Each freshly allocated chunk must have both cinuse and pinuse set.
That is, each allocated chunk borders either a previously allocated
and still in-use chunk, or the base of its memory arena. This is
ensured by making all allocations from the `lowest' part of any
found chunk. Further, no free chunk physically borders another one,
so each free chunk is known to be preceded and followed by either
inuse chunks or the ends of memory.
Note that the `foot' of the current chunk is actually represented
as the prev_foot of the NEXT chunk. This makes it easier to
deal with alignments etc but can be very confusing when trying
to extend or adapt this code.
The exceptions to all this are
1. The special chunk `top' is the top-most available chunk (i.e.,
the one bordering the end of available memory). It is treated
specially. Top is never included in any bin, is used only if
no other chunk is available, and is released back to the
system if it is very large (see M_TRIM_THRESHOLD). In effect,
the top chunk is treated as larger (and thus less well
fitting) than any other available chunk. The top chunk
doesn't update its trailing size field since there is no next
contiguous chunk that would have to index off it. However,
space is still allocated for it (TOP_FOOT_SIZE) to enable
separation or merging when space is extended.
3. Chunks allocated via mmap, have both cinuse and pinuse bits
cleared in their head fields. Because they are allocated
one-by-one, each must carry its own prev_foot field, which is
also used to hold the offset this chunk has within its mmapped
region, which is needed to preserve alignment. Each mmapped
chunk is trailed by the first two fields of a fake next-chunk
for sake of usage checks.
*/
struct malloc_chunk {
size_t prev_foot; /* Size of previous chunk (if free). */
size_t head; /* Size and inuse bits. */
struct malloc_chunk* fd; /* double links -- used only if free. */
struct malloc_chunk* bk;
};
typedef struct malloc_chunk mchunk;
typedef struct malloc_chunk* mchunkptr;
typedef struct malloc_chunk* sbinptr; /* The type of bins of chunks */
typedef unsigned int bindex_t; /* Described below */
typedef unsigned int binmap_t; /* Described below */
typedef unsigned int flag_t; /* The type of various bit flag sets */
/* ------------------- Chunks sizes and alignments ----------------------- */
#define MCHUNK_SIZE (sizeof(mchunk))
#if FOOTERS
#define CHUNK_OVERHEAD (TWO_SIZE_T_SIZES)
#else /* FOOTERS */
#define CHUNK_OVERHEAD (SIZE_T_SIZE)
#endif /* FOOTERS */
/* MMapped chunks need a second word of overhead ... */
#define MMAP_CHUNK_OVERHEAD (TWO_SIZE_T_SIZES)
/* ... and additional padding for fake next-chunk at foot */
#define MMAP_FOOT_PAD (FOUR_SIZE_T_SIZES)
/* The smallest size we can malloc is an aligned minimal chunk */
#define MIN_CHUNK_SIZE\
((MCHUNK_SIZE + CHUNK_ALIGN_MASK) & ~CHUNK_ALIGN_MASK)
/* conversion from malloc headers to user pointers, and back */
#define chunk2mem(p) ((void*)((char*)(p) + TWO_SIZE_T_SIZES))
#define mem2chunk(mem) ((mchunkptr)((char*)(mem) - TWO_SIZE_T_SIZES))
/* chunk associated with aligned address A */
#define align_as_chunk(A) (mchunkptr)((A) + align_offset(chunk2mem(A)))
/* Bounds on request (not chunk) sizes. */
#define MAX_REQUEST ((-MIN_CHUNK_SIZE) << 2)
#define MIN_REQUEST (MIN_CHUNK_SIZE - CHUNK_OVERHEAD - SIZE_T_ONE)
/* pad request bytes into a usable size */
#define pad_request(req) \
(((req) + CHUNK_OVERHEAD + CHUNK_ALIGN_MASK) & ~CHUNK_ALIGN_MASK)
/* pad request, checking for minimum (but not maximum) */
#define request2size(req) \
(((req) < MIN_REQUEST)? MIN_CHUNK_SIZE : pad_request(req))
/* ------------------ Operations on head and foot fields ----------------- */
/*
The head field of a chunk is or'ed with PINUSE_BIT when previous
adjacent chunk in use, and or'ed with CINUSE_BIT if this chunk is in
use, unless mmapped, in which case both bits are cleared.
FLAG4_BIT is not used by this malloc, but might be useful in extensions.
*/
#define PINUSE_BIT (SIZE_T_ONE)
#define CINUSE_BIT (SIZE_T_TWO)
#define FLAG4_BIT (SIZE_T_FOUR)
#define INUSE_BITS (PINUSE_BIT|CINUSE_BIT)
#define FLAG_BITS (PINUSE_BIT|CINUSE_BIT|FLAG4_BIT)
/* Head value for fenceposts */
#define FENCEPOST_HEAD (INUSE_BITS|SIZE_T_SIZE)
/* extraction of fields from head words */
#define cinuse(p) ((p)->head & CINUSE_BIT)
#define pinuse(p) ((p)->head & PINUSE_BIT)
#define flag4inuse(p) ((p)->head & FLAG4_BIT)
#define is_inuse(p) (((p)->head & INUSE_BITS) != PINUSE_BIT)
#define is_mmapped(p) (((p)->head & INUSE_BITS) == 0)
#define chunksize(p) ((p)->head & ~(FLAG_BITS))
#define clear_pinuse(p) ((p)->head &= ~PINUSE_BIT)
#define set_flag4(p) ((p)->head |= FLAG4_BIT)
#define clear_flag4(p) ((p)->head &= ~FLAG4_BIT)
/* Treat space at ptr +/- offset as a chunk */
#define chunk_plus_offset(p, s) ((mchunkptr)(((char*)(p)) + (s)))
#define chunk_minus_offset(p, s) ((mchunkptr)(((char*)(p)) - (s)))
/* Ptr to next or previous physical malloc_chunk. */
#define next_chunk(p) ((mchunkptr)( ((char*)(p)) + ((p)->head & ~FLAG_BITS)))
#define prev_chunk(p) ((mchunkptr)( ((char*)(p)) - ((p)->prev_foot) ))
/* extract next chunk's pinuse bit */
#define next_pinuse(p) ((next_chunk(p)->head) & PINUSE_BIT)
/* Get/set size at footer */
#define get_foot(p, s) (((mchunkptr)((char*)(p) + (s)))->prev_foot)
#define set_foot(p, s) (((mchunkptr)((char*)(p) + (s)))->prev_foot = (s))
/* Set size, pinuse bit, and foot */
#define set_size_and_pinuse_of_free_chunk(p, s)\
((p)->head = (s|PINUSE_BIT), set_foot(p, s))
/* Set size, pinuse bit, foot, and clear next pinuse */
#define set_free_with_pinuse(p, s, n)\
(clear_pinuse(n), set_size_and_pinuse_of_free_chunk(p, s))
/* Get the internal overhead associated with chunk p */
#define overhead_for(p)\
(is_mmapped(p)? MMAP_CHUNK_OVERHEAD : CHUNK_OVERHEAD)
/* Return true if malloced space is not necessarily cleared */
#if MMAP_CLEARS
#define calloc_must_clear(p) (!is_mmapped(p))
#else /* MMAP_CLEARS */
#define calloc_must_clear(p) (1)
#endif /* MMAP_CLEARS */
/* ---------------------- Overlaid data structures ----------------------- */
/*
When chunks are not in use, they are treated as nodes of either
lists or trees.
"Small" chunks are stored in circular doubly-linked lists, and look
like this:
chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Size of previous chunk |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
`head:' | Size of chunk, in bytes |P|
mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Forward pointer to next chunk in list |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Back pointer to previous chunk in list |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Unused space (may be 0 bytes long) .
. .
. |
nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
`foot:' | Size of chunk, in bytes |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Larger chunks are kept in a form of bitwise digital trees (aka
tries) keyed on chunksizes. Because malloc_tree_chunks are only for
free chunks greater than 256 bytes, their size doesn't impose any
constraints on user chunk sizes. Each node looks like:
chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Size of previous chunk |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
`head:' | Size of chunk, in bytes |P|
mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Forward pointer to next chunk of same size |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Back pointer to previous chunk of same size |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Pointer to left child (child[0]) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Pointer to right child (child[1]) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Pointer to parent |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| bin index of this chunk |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Unused space .
. |
nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
`foot:' | Size of chunk, in bytes |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Each tree holding treenodes is a tree of unique chunk sizes. Chunks
of the same size are arranged in a circularly-linked list, with only
the oldest chunk (the next to be used, in our FIFO ordering)
actually in the tree. (Tree members are distinguished by a non-null
parent pointer.) If a chunk with the same size an an existing node
is inserted, it is linked off the existing node using pointers that
work in the same way as fd/bk pointers of small chunks.
Each tree contains a power of 2 sized range of chunk sizes (the
smallest is 0x100 <= x < 0x180), which is is divided in half at each
tree level, with the chunks in the smaller half of the range (0x100
<= x < 0x140 for the top nose) in the left subtree and the larger
half (0x140 <= x < 0x180) in the right subtree. This is, of course,
done by inspecting individual bits.
Using these rules, each node's left subtree contains all smaller
sizes than its right subtree. However, the node at the root of each
subtree has no particular ordering relationship to either. (The
dividing line between the subtree sizes is based on trie relation.)
If we remove the last chunk of a given size from the interior of the
tree, we need to replace it with a leaf node. The tree ordering
rules permit a node to be replaced by any leaf below it.
The smallest chunk in a tree (a common operation in a best-fit
allocator) can be found by walking a path to the leftmost leaf in
the tree. Unlike a usual binary tree, where we follow left child
pointers until we reach a null, here we follow the right child
pointer any time the left one is null, until we reach a leaf with
both child pointers null. The smallest chunk in the tree will be
somewhere along that path.
The worst case number of steps to add, find, or remove a node is
bounded by the number of bits differentiating chunks within
bins. Under current bin calculations, this ranges from 6 up to 21
(for 32 bit sizes) or up to 53 (for 64 bit sizes). The typical case
is of course much better.
*/
struct malloc_tree_chunk {
/* The first four fields must be compatible with malloc_chunk */
size_t prev_foot;
size_t head;
struct malloc_tree_chunk* fd;
struct malloc_tree_chunk* bk;
struct malloc_tree_chunk* child[2];
struct malloc_tree_chunk* parent;
bindex_t index;
};
typedef struct malloc_tree_chunk tchunk;
typedef struct malloc_tree_chunk* tchunkptr;
typedef struct malloc_tree_chunk* tbinptr; /* The type of bins of trees */
/* A little helper macro for trees */
#define leftmost_child(t) ((t)->child[0] != 0? (t)->child[0] : (t)->child[1])
/* ----------------------------- Segments -------------------------------- */
/*
Each malloc space may include non-contiguous segments, held in a
list headed by an embedded malloc_segment record representing the
top-most space. Segments also include flags holding properties of
the space. Large chunks that are directly allocated by mmap are not
included in this list. They are instead independently created and
destroyed without otherwise keeping track of them.
Segment management mainly comes into play for spaces allocated by
MMAP. Any call to MMAP might or might not return memory that is
adjacent to an existing segment. MORECORE normally contiguously
extends the current space, so this space is almost always adjacent,
which is simpler and faster to deal with. (This is why MORECORE is
used preferentially to MMAP when both are available -- see
sys_alloc.) When allocating using MMAP, we don't use any of the
hinting mechanisms (inconsistently) supported in various
implementations of unix mmap, or distinguish reserving from
committing memory. Instead, we just ask for space, and exploit
contiguity when we get it. It is probably possible to do
better than this on some systems, but no general scheme seems
to be significantly better.
Management entails a simpler variant of the consolidation scheme
used for chunks to reduce fragmentation -- new adjacent memory is
normally prepended or appended to an existing segment. However,
there are limitations compared to chunk consolidation that mostly
reflect the fact that segment processing is relatively infrequent
(occurring only when getting memory from system) and that we
don't expect to have huge numbers of segments:
* Segments are not indexed, so traversal requires linear scans. (It
would be possible to index these, but is not worth the extra
overhead and complexity for most programs on most platforms.)
* New segments are only appended to old ones when holding top-most
memory; if they cannot be prepended to others, they are held in
different segments.
Except for the top-most segment of an mstate, each segment record
is kept at the tail of its segment. Segments are added by pushing
segment records onto the list headed by &mstate.seg for the
containing mstate.
Segment flags control allocation/merge/deallocation policies:
* If EXTERN_BIT set, then we did not allocate this segment,
and so should not try to deallocate or merge with others.
(This currently holds only for the initial segment passed
into create_mspace_with_base.)
* If USE_MMAP_BIT set, the segment may be merged with
other surrounding mmapped segments and trimmed/de-allocated
using munmap.
* If neither bit is set, then the segment was obtained using
MORECORE so can be merged with surrounding MORECORE'd segments
and deallocated/trimmed using MORECORE with negative arguments.
*/
struct malloc_segment {
char* base; /* base address */
size_t size; /* allocated size */
struct malloc_segment* next; /* ptr to next segment */
flag_t sflags; /* mmap and extern flag */
};
#define is_mmapped_segment(S) ((S)->sflags & USE_MMAP_BIT)
#define is_extern_segment(S) ((S)->sflags & EXTERN_BIT)
typedef struct malloc_segment msegment;
typedef struct malloc_segment* msegmentptr;
/* ---------------------------- malloc_state ----------------------------- */
/*
A malloc_state holds all of the bookkeeping for a space.
The main fields are:
Top
The topmost chunk of the currently active segment. Its size is
cached in topsize. The actual size of topmost space is
topsize+TOP_FOOT_SIZE, which includes space reserved for adding
fenceposts and segment records if necessary when getting more
space from the system. The size at which to autotrim top is
cached from mparams in trim_check, except that it is disabled if
an autotrim fails.
Designated victim (dv)
This is the preferred chunk for servicing small requests that
don't have exact fits. It is normally the chunk split off most
recently to service another small request. Its size is cached in
dvsize. The link fields of this chunk are not maintained since it
is not kept in a bin.
SmallBins
An array of bin headers for free chunks. These bins hold chunks
with sizes less than MIN_LARGE_SIZE bytes. Each bin contains
chunks of all the same size, spaced 8 bytes apart. To simplify
use in double-linked lists, each bin header acts as a malloc_chunk
pointing to the real first node, if it exists (else pointing to
itself). This avoids special-casing for headers. But to avoid
waste, we allocate only the fd/bk pointers of bins, and then use
repositioning tricks to treat these as the fields of a chunk.
TreeBins
Treebins are pointers to the roots of trees holding a range of
sizes. There are 2 equally spaced treebins for each power of two
from TREE_SHIFT to TREE_SHIFT+16. The last bin holds anything
larger.
Bin maps
There is one bit map for small bins ("smallmap") and one for
treebins ("treemap). Each bin sets its bit when non-empty, and
clears the bit when empty. Bit operations are then used to avoid
bin-by-bin searching -- nearly all "search" is done without ever
looking at bins that won't be selected. The bit maps
conservatively use 32 bits per map word, even if on 64bit system.
For a good description of some of the bit-based techniques used
here, see Henry S. Warren Jr's book "Hacker's Delight" (and
supplement at http://hackersdelight.org/). Many of these are
intended to reduce the branchiness of paths through malloc etc, as
well as to reduce the number of memory locations read or written.
Segments
A list of segments headed by an embedded malloc_segment record
representing the initial space.
Address check support
The least_addr field is the least address ever obtained from
MORECORE or MMAP. Attempted frees and reallocs of any address less
than this are trapped (unless INSECURE is defined).
Magic tag
A cross-check field that should always hold same value as mparams.magic.
Max allowed footprint
The maximum allowed bytes to allocate from system (zero means no limit)
Flags
Bits recording whether to use MMAP, locks, or contiguous MORECORE
Statistics
Each space keeps track of current and maximum system memory
obtained via MORECORE or MMAP.
Trim support
Fields holding the amount of unused topmost memory that should trigger
trimming, and a counter to force periodic scanning to release unused
non-topmost segments.
Locking
If USE_LOCKS is defined, the "mutex" lock is acquired and released
around every public call using this mspace.
Extension support
A void* pointer and a size_t field that can be used to help implement
extensions to this malloc.
*/
/* Bin types, widths and sizes */
#define NSMALLBINS (32U)
#define NTREEBINS (32U)
#define SMALLBIN_SHIFT (3U)
#define SMALLBIN_WIDTH (SIZE_T_ONE << SMALLBIN_SHIFT)
#define TREEBIN_SHIFT (8U)
#define MIN_LARGE_SIZE (SIZE_T_ONE << TREEBIN_SHIFT)
#define MAX_SMALL_SIZE (MIN_LARGE_SIZE - SIZE_T_ONE)
#define MAX_SMALL_REQUEST (MAX_SMALL_SIZE - CHUNK_ALIGN_MASK - CHUNK_OVERHEAD)
struct malloc_state {
binmap_t smallmap;
binmap_t treemap;
size_t dvsize;
size_t topsize;
char* least_addr;
mchunkptr dv;
mchunkptr top;
size_t trim_check;
size_t release_checks;
size_t magic;
mchunkptr smallbins[(NSMALLBINS + 1) * 2];
tbinptr treebins[NTREEBINS];
size_t footprint;
size_t max_footprint;
size_t footprint_limit; /* zero means no limit */
flag_t mflags;
#if USE_LOCKS
MLOCK_T mutex; /* locate lock among fields that rarely change */
#endif /* USE_LOCKS */
msegment seg;
void* extp; /* Unused but available for extensions */
size_t exts;
};
typedef struct malloc_state* mstate;
/* ------------- Global malloc_state and malloc_params ------------------- */
/*
malloc_params holds global properties, including those that can be
dynamically set using mallopt. There is a single instance, mparams,
initialized in init_mparams. Note that the non-zeroness of "magic"
also serves as an initialization flag.
*/
struct malloc_params {
size_t magic;
size_t page_size;
size_t granularity;
size_t mmap_threshold;
size_t trim_threshold;
flag_t default_mflags;
};
static struct malloc_params mparams;
/* Ensure mparams initialized */
#define ensure_initialization() (void)(mparams.magic != 0 || init_mparams())
#if !ONLY_MSPACES
/* The global malloc_state used for all non-"mspace" calls */
static struct malloc_state _gm_;
#define gm (&_gm_)
#define is_global(M) ((M) == &_gm_)
#endif /* !ONLY_MSPACES */
#define is_initialized(M) ((M)->top != 0)
/* -------------------------- system alloc setup ------------------------- */
/* Operations on mflags */
#define use_lock(M) ((M)->mflags & USE_LOCK_BIT)
#define enable_lock(M) ((M)->mflags |= USE_LOCK_BIT)
#if USE_LOCKS
#define disable_lock(M) ((M)->mflags &= ~USE_LOCK_BIT)
#else
#define disable_lock(M)
#endif
#define use_mmap(M) ((M)->mflags & USE_MMAP_BIT)
#define enable_mmap(M) ((M)->mflags |= USE_MMAP_BIT)
#if HAVE_MMAP
#define disable_mmap(M) ((M)->mflags &= ~USE_MMAP_BIT)
#else
#define disable_mmap(M)
#endif
#define use_noncontiguous(M) ((M)->mflags & USE_NONCONTIGUOUS_BIT)
#define disable_contiguous(M) ((M)->mflags |= USE_NONCONTIGUOUS_BIT)
#define set_lock(M,L)\
((M)->mflags = (L)?\
((M)->mflags | USE_LOCK_BIT) :\
((M)->mflags & ~USE_LOCK_BIT))
/* page-align a size */
#define page_align(S)\
(((S) + (mparams.page_size - SIZE_T_ONE)) & ~(mparams.page_size - SIZE_T_ONE))
/* granularity-align a size */
#define granularity_align(S)\
(((S) + (mparams.granularity - SIZE_T_ONE))\
& ~(mparams.granularity - SIZE_T_ONE))
/* For mmap, use granularity alignment on windows, else page-align */
#ifdef WIN32
#define mmap_align(S) granularity_align(S)
#else
#define mmap_align(S) page_align(S)
#endif
/* For sys_alloc, enough padding to ensure can malloc request on success */
#define SYS_ALLOC_PADDING (TOP_FOOT_SIZE + MALLOC_ALIGNMENT)
#define is_page_aligned(S)\
(((size_t)(S) & (mparams.page_size - SIZE_T_ONE)) == 0)
#define is_granularity_aligned(S)\
(((size_t)(S) & (mparams.granularity - SIZE_T_ONE)) == 0)
/* True if segment S holds address A */
#define segment_holds(S, A)\
((char*)(A) >= S->base && (char*)(A) < S->base + S->size)
/* Return segment holding given address */
static msegmentptr segment_holding(mstate m, char* addr) {
msegmentptr sp = &m->seg;
for (;;) {
if (addr >= sp->base && addr < sp->base + sp->size)
return sp;
if ((sp = sp->next) == 0)
return 0;
}
}
/* Return true if segment contains a segment link */
static int has_segment_link(mstate m, msegmentptr ss) {
msegmentptr sp = &m->seg;
for (;;) {
if ((char*)sp >= ss->base && (char*)sp < ss->base + ss->size)
return 1;
if ((sp = sp->next) == 0)
return 0;
}
}
#ifndef MORECORE_CANNOT_TRIM
#define should_trim(M,s) ((s) > (M)->trim_check)
#else /* MORECORE_CANNOT_TRIM */
#define should_trim(M,s) (0)
#endif /* MORECORE_CANNOT_TRIM */
/*
TOP_FOOT_SIZE is padding at the end of a segment, including space
that may be needed to place segment records and fenceposts when new
noncontiguous segments are added.
*/
#define TOP_FOOT_SIZE\
(align_offset(chunk2mem(0))+pad_request(sizeof(struct malloc_segment))+MIN_CHUNK_SIZE)
/* ------------------------------- Hooks -------------------------------- */
/*
PREACTION should be defined to return 0 on success, and nonzero on
failure. If you are not using locking, you can redefine these to do
anything you like.
*/
#if USE_LOCKS
#define PREACTION(M) ((use_lock(M))? ACQUIRE_LOCK(&(M)->mutex) : 0)
#define POSTACTION(M) { if (use_lock(M)) RELEASE_LOCK(&(M)->mutex); }
#else /* USE_LOCKS */
#ifndef PREACTION
#define PREACTION(M) (0)
#endif /* PREACTION */
#ifndef POSTACTION
#define POSTACTION(M)
#endif /* POSTACTION */
#endif /* USE_LOCKS */
/*
CORRUPTION_ERROR_ACTION is triggered upon detected bad addresses.
USAGE_ERROR_ACTION is triggered on detected bad frees and
reallocs. The argument p is an address that might have triggered the
fault. It is ignored by the two predefined actions, but might be
useful in custom actions that try to help diagnose errors.
*/
#if PROCEED_ON_ERROR
/* A count of the number of corruption errors causing resets */
int malloc_corruption_error_count;
/* default corruption action */
static void reset_on_error(mstate m);
#define CORRUPTION_ERROR_ACTION(m) reset_on_error(m)
#define USAGE_ERROR_ACTION(m, p)
#else /* PROCEED_ON_ERROR */
#ifndef CORRUPTION_ERROR_ACTION
#define CORRUPTION_ERROR_ACTION(m) ABORT
#endif /* CORRUPTION_ERROR_ACTION */
#ifndef USAGE_ERROR_ACTION
#define USAGE_ERROR_ACTION(m,p) ABORT
#endif /* USAGE_ERROR_ACTION */
#endif /* PROCEED_ON_ERROR */
/* -------------------------- Debugging setup ---------------------------- */
#if ! DEBUG
#define check_free_chunk(M,P)
#define check_inuse_chunk(M,P)
#define check_malloced_chunk(M,P,N)
#define check_mmapped_chunk(M,P)
#define check_malloc_state(M)
#define check_top_chunk(M,P)
#else /* DEBUG */
#define check_free_chunk(M,P) do_check_free_chunk(M,P)
#define check_inuse_chunk(M,P) do_check_inuse_chunk(M,P)
#define check_top_chunk(M,P) do_check_top_chunk(M,P)
#define check_malloced_chunk(M,P,N) do_check_malloced_chunk(M,P,N)
#define check_mmapped_chunk(M,P) do_check_mmapped_chunk(M,P)
#define check_malloc_state(M) do_check_malloc_state(M)
static void do_check_any_chunk(mstate m, mchunkptr p);
static void do_check_top_chunk(mstate m, mchunkptr p);
static void do_check_mmapped_chunk(mstate m, mchunkptr p);
static void do_check_inuse_chunk(mstate m, mchunkptr p);
static void do_check_free_chunk(mstate m, mchunkptr p);
static void do_check_malloced_chunk(mstate m, void* mem, size_t s);
static void do_check_tree(mstate m, tchunkptr t);
static void do_check_treebin(mstate m, bindex_t i);
static void do_check_smallbin(mstate m, bindex_t i);
static void do_check_malloc_state(mstate m);
static int bin_find(mstate m, mchunkptr x);
static size_t traverse_and_check(mstate m);
#endif /* DEBUG */
/* ---------------------------- Indexing Bins ---------------------------- */
#define is_small(s) (((s) >> SMALLBIN_SHIFT) < NSMALLBINS)
#define small_index(s) (bindex_t)((s) >> SMALLBIN_SHIFT)
#define small_index2size(i) ((i) << SMALLBIN_SHIFT)
#define MIN_SMALL_INDEX (small_index(MIN_CHUNK_SIZE))
/* addressing by index. See above about smallbin repositioning */
#define smallbin_at(M, i) ((sbinptr)((char*)&((M)->smallbins[(i)<<1])))
#define treebin_at(M,i) (&((M)->treebins[i]))
/* assign tree index for size S to variable I. Use x86 asm if possible */
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
#define compute_tree_index(S, I)\
{\
unsigned int X = S >> TREEBIN_SHIFT;\
if (X == 0)\
I = 0;\
else if (X > 0xFFFF)\
I = NTREEBINS-1;\
else {\
unsigned int K = (unsigned) sizeof(X)*__CHAR_BIT__ - 1 - (unsigned) __builtin_clz(X); \
I = (bindex_t)((K << 1) + ((S >> (K + (TREEBIN_SHIFT-1)) & 1)));\
}\
}
#elif defined (__INTEL_COMPILER)
#define compute_tree_index(S, I)\
{\
size_t X = S >> TREEBIN_SHIFT;\
if (X == 0)\
I = 0;\
else if (X > 0xFFFF)\
I = NTREEBINS-1;\
else {\
unsigned int K = _bit_scan_reverse (X); \
I = (bindex_t)((K << 1) + ((S >> (K + (TREEBIN_SHIFT-1)) & 1)));\
}\
}
#elif defined(_MSC_VER) && _MSC_VER>=1300
#define compute_tree_index(S, I)\
{\
size_t X = S >> TREEBIN_SHIFT;\
if (X == 0)\
I = 0;\
else if (X > 0xFFFF)\
I = NTREEBINS-1;\
else {\
unsigned int K;\
_BitScanReverse((DWORD *) &K, (DWORD) X);\
I = (bindex_t)((K << 1) + ((S >> (K + (TREEBIN_SHIFT-1)) & 1)));\
}\
}
#else /* GNUC */
#define compute_tree_index(S, I)\
{\
size_t X = S >> TREEBIN_SHIFT;\
if (X == 0)\
I = 0;\
else if (X > 0xFFFF)\
I = NTREEBINS-1;\
else {\
unsigned int Y = (unsigned int)X;\
unsigned int N = ((Y - 0x100) >> 16) & 8;\
unsigned int K = (((Y <<= N) - 0x1000) >> 16) & 4;\
N += K;\
N += K = (((Y <<= K) - 0x4000) >> 16) & 2;\
K = 14 - N + ((Y <<= K) >> 15);\
I = (K << 1) + ((S >> (K + (TREEBIN_SHIFT-1)) & 1));\
}\
}
#endif /* GNUC */
/* Bit representing maximum resolved size in a treebin at i */
#define bit_for_tree_index(i) \
(i == NTREEBINS-1)? (SIZE_T_BITSIZE-1) : (((i) >> 1) + TREEBIN_SHIFT - 2)
/* Shift placing maximum resolved bit in a treebin at i as sign bit */
#define leftshift_for_tree_index(i) \
((i == NTREEBINS-1)? 0 : \
((SIZE_T_BITSIZE-SIZE_T_ONE) - (((i) >> 1) + TREEBIN_SHIFT - 2)))
/* The size of the smallest chunk held in bin with index i */
#define minsize_for_tree_index(i) \
((SIZE_T_ONE << (((i) >> 1) + TREEBIN_SHIFT)) | \
(((size_t)((i) & SIZE_T_ONE)) << (((i) >> 1) + TREEBIN_SHIFT - 1)))
/* ------------------------ Operations on bin maps ----------------------- */
/* bit corresponding to given index */
#define idx2bit(i) ((binmap_t)(1) << (i))
/* Mark/Clear bits with given index */
#define mark_smallmap(M,i) ((M)->smallmap |= idx2bit(i))
#define clear_smallmap(M,i) ((M)->smallmap &= ~idx2bit(i))
#define smallmap_is_marked(M,i) ((M)->smallmap & idx2bit(i))
#define mark_treemap(M,i) ((M)->treemap |= idx2bit(i))
#define clear_treemap(M,i) ((M)->treemap &= ~idx2bit(i))
#define treemap_is_marked(M,i) ((M)->treemap & idx2bit(i))
/* isolate the least set bit of a bitmap */
#define least_bit(x) ((x) & -(x))
/* mask with all bits to left of least bit of x on */
#define left_bits(x) ((x<<1) | -(x<<1))
/* mask with all bits to left of or equal to least bit of x on */
#define same_or_left_bits(x) ((x) | -(x))
/* index corresponding to given bit. Use x86 asm if possible */
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
#define compute_bit2idx(X, I)\
{\
unsigned int J;\
J = __builtin_ctz(X); \
I = (bindex_t)J;\
}
#elif defined (__INTEL_COMPILER)
#define compute_bit2idx(X, I)\
{\
unsigned int J;\
J = _bit_scan_forward (X); \
I = (bindex_t)J;\
}
#elif defined(_MSC_VER) && _MSC_VER>=1300
#define compute_bit2idx(X, I)\
{\
unsigned int J;\
_BitScanForward((DWORD *) &J, X);\
I = (bindex_t)J;\
}
#elif USE_BUILTIN_FFS
#define compute_bit2idx(X, I) I = ffs(X)-1
#else
#define compute_bit2idx(X, I)\
{\
unsigned int Y = X - 1;\
unsigned int K = Y >> (16-4) & 16;\
unsigned int N = K; Y >>= K;\
N += K = Y >> (8-3) & 8; Y >>= K;\
N += K = Y >> (4-2) & 4; Y >>= K;\
N += K = Y >> (2-1) & 2; Y >>= K;\
N += K = Y >> (1-0) & 1; Y >>= K;\
I = (bindex_t)(N + Y);\
}
#endif /* GNUC */
/* ----------------------- Runtime Check Support ------------------------- */
/*
For security, the main invariant is that malloc/free/etc never
writes to a static address other than malloc_state, unless static
malloc_state itself has been corrupted, which cannot occur via
malloc (because of these checks). In essence this means that we
believe all pointers, sizes, maps etc held in malloc_state, but
check all of those linked or offsetted from other embedded data
structures. These checks are interspersed with main code in a way
that tends to minimize their run-time cost.
When FOOTERS is defined, in addition to range checking, we also
verify footer fields of inuse chunks, which can be used guarantee
that the mstate controlling malloc/free is intact. This is a
streamlined version of the approach described by William Robertson
et al in "Run-time Detection of Heap-based Overflows" LISA'03
http://www.usenix.org/events/lisa03/tech/robertson.html The footer
of an inuse chunk holds the xor of its mstate and a random seed,
that is checked upon calls to free() and realloc(). This is
(probabalistically) unguessable from outside the program, but can be
computed by any code successfully malloc'ing any chunk, so does not
itself provide protection against code that has already broken
security through some other means. Unlike Robertson et al, we
always dynamically check addresses of all offset chunks (previous,
next, etc). This turns out to be cheaper than relying on hashes.
*/
#if !INSECURE
/* Check if address a is at least as high as any from MORECORE or MMAP */
#define ok_address(M, a) ((char*)(a) >= (M)->least_addr)
/* Check if address of next chunk n is higher than base chunk p */
#define ok_next(p, n) ((char*)(p) < (char*)(n))
/* Check if p has inuse status */
#define ok_inuse(p) is_inuse(p)
/* Check if p has its pinuse bit on */
#define ok_pinuse(p) pinuse(p)
#else /* !INSECURE */
#define ok_address(M, a) (1)
#define ok_next(b, n) (1)
#define ok_inuse(p) (1)
#define ok_pinuse(p) (1)
#endif /* !INSECURE */
#if (FOOTERS && !INSECURE)
/* Check if (alleged) mstate m has expected magic field */
#define ok_magic(M) ((M)->magic == mparams.magic)
#else /* (FOOTERS && !INSECURE) */
#define ok_magic(M) (1)
#endif /* (FOOTERS && !INSECURE) */
/* In gcc, use __builtin_expect to minimize impact of checks */
#if !INSECURE
#if defined(__GNUC__) && __GNUC__ >= 3
#define RTCHECK(e) __builtin_expect(e, 1)
#else /* GNUC */
#define RTCHECK(e) (e)
#endif /* GNUC */
#else /* !INSECURE */
#define RTCHECK(e) (1)
#endif /* !INSECURE */
/* macros to set up inuse chunks with or without footers */
#if !FOOTERS
#define mark_inuse_foot(M,p,s)
/* Macros for setting head/foot of non-mmapped chunks */
/* Set cinuse bit and pinuse bit of next chunk */
#define set_inuse(M,p,s)\
((p)->head = (((p)->head & PINUSE_BIT)|s|CINUSE_BIT),\
((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT)
/* Set cinuse and pinuse of this chunk and pinuse of next chunk */
#define set_inuse_and_pinuse(M,p,s)\
((p)->head = (s|PINUSE_BIT|CINUSE_BIT),\
((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT)
/* Set size, cinuse and pinuse bit of this chunk */
#define set_size_and_pinuse_of_inuse_chunk(M, p, s)\
((p)->head = (s|PINUSE_BIT|CINUSE_BIT))
#else /* FOOTERS */
/* Set foot of inuse chunk to be xor of mstate and seed */
#define mark_inuse_foot(M,p,s)\
(((mchunkptr)((char*)(p) + (s)))->prev_foot = ((size_t)(M) ^ mparams.magic))
#define get_mstate_for(p)\
((mstate)(((mchunkptr)((char*)(p) +\
(chunksize(p))))->prev_foot ^ mparams.magic))
#define set_inuse(M,p,s)\
((p)->head = (((p)->head & PINUSE_BIT)|s|CINUSE_BIT),\
(((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT), \
mark_inuse_foot(M,p,s))
#define set_inuse_and_pinuse(M,p,s)\
((p)->head = (s|PINUSE_BIT|CINUSE_BIT),\
(((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT),\
mark_inuse_foot(M,p,s))
#define set_size_and_pinuse_of_inuse_chunk(M, p, s)\
((p)->head = (s|PINUSE_BIT|CINUSE_BIT),\
mark_inuse_foot(M, p, s))
#endif /* !FOOTERS */
/* ---------------------------- setting mparams -------------------------- */
#if LOCK_AT_FORK
static void pre_fork(void) { ACQUIRE_LOCK(&(gm)->mutex); }
static void post_fork_parent(void) { RELEASE_LOCK(&(gm)->mutex); }
static void post_fork_child(void) { INITIAL_LOCK(&(gm)->mutex); }
#endif /* LOCK_AT_FORK */
/* Initialize mparams */
static int init_mparams(void) {
#ifdef NEED_GLOBAL_LOCK_INIT
if (malloc_global_mutex_status <= 0)
init_malloc_global_mutex();
#endif
ACQUIRE_MALLOC_GLOBAL_LOCK();
if (mparams.magic == 0) {
size_t magic;
size_t psize;
size_t gsize;
#ifndef WIN32
psize = malloc_getpagesize;
gsize = ((DEFAULT_GRANULARITY != 0) ? DEFAULT_GRANULARITY : psize);
#else /* WIN32 */
{
SYSTEM_INFO system_info;
GetSystemInfo(&system_info);
psize = system_info.dwPageSize;
gsize = ((DEFAULT_GRANULARITY != 0) ?
DEFAULT_GRANULARITY : system_info.dwAllocationGranularity);
}
#endif /* WIN32 */
/* Sanity-check configuration:
size_t must be unsigned and as wide as pointer type.
ints must be at least 4 bytes.
alignment must be at least 8.
Alignment, min chunk size, and page size must all be powers of 2.
*/
if ((sizeof(size_t) != sizeof(char*)) ||
(MAX_SIZE_T < MIN_CHUNK_SIZE) ||
(sizeof(int) < 4) ||
(MALLOC_ALIGNMENT < (size_t)8U) ||
((MALLOC_ALIGNMENT & (MALLOC_ALIGNMENT - SIZE_T_ONE)) != 0) ||
((MCHUNK_SIZE & (MCHUNK_SIZE - SIZE_T_ONE)) != 0) ||
((gsize & (gsize - SIZE_T_ONE)) != 0) ||
((psize & (psize - SIZE_T_ONE)) != 0))
ABORT;
mparams.granularity = gsize;
mparams.page_size = psize;
mparams.mmap_threshold = DEFAULT_MMAP_THRESHOLD;
mparams.trim_threshold = DEFAULT_TRIM_THRESHOLD;
#if MORECORE_CONTIGUOUS
mparams.default_mflags = USE_LOCK_BIT | USE_MMAP_BIT;
#else /* MORECORE_CONTIGUOUS */
mparams.default_mflags = USE_LOCK_BIT | USE_MMAP_BIT | USE_NONCONTIGUOUS_BIT;
#endif /* MORECORE_CONTIGUOUS */
#if !ONLY_MSPACES
/* Set up lock for main malloc area */
gm->mflags = mparams.default_mflags;
(void)INITIAL_LOCK(&gm->mutex);
#endif
#if LOCK_AT_FORK
pthread_atfork(&pre_fork, &post_fork_parent, &post_fork_child);
#endif
{
#if USE_DEV_RANDOM
int fd;
unsigned char buf[sizeof(size_t)];
/* Try to use /dev/urandom, else fall back on using time */
if ((fd = open("/dev/urandom", O_RDONLY)) >= 0 &&
read(fd, buf, sizeof(buf)) == sizeof(buf)) {
magic = *((size_t *)buf);
close(fd);
}
else
#endif /* USE_DEV_RANDOM */
#ifdef WIN32
magic = (size_t)(GetTickCount() ^ (size_t)0x55555555U);
#elif defined(LACKS_TIME_H)
magic = (size_t)&magic ^ (size_t)0x55555555U;
#else
magic = (size_t)(time(0) ^ (size_t)0x55555555U);
#endif
magic |= (size_t)8U; /* ensure nonzero */
magic &= ~(size_t)7U; /* improve chances of fault for bad values */
/* Until memory modes commonly available, use volatile-write */
(*(volatile size_t *)(&(mparams.magic))) = magic;
}
}
RELEASE_MALLOC_GLOBAL_LOCK();
return 1;
}
/* support for mallopt */
static int change_mparam(int param_number, int value) {
size_t val;
ensure_initialization();
val = (value == -1) ? MAX_SIZE_T : (size_t)value;
switch (param_number) {
case M_TRIM_THRESHOLD:
mparams.trim_threshold = val;
return 1;
case M_GRANULARITY:
if (val >= mparams.page_size && ((val & (val - 1)) == 0)) {
mparams.granularity = val;
return 1;
}
else
return 0;
case M_MMAP_THRESHOLD:
mparams.mmap_threshold = val;
return 1;
default:
return 0;
}
}
#if DEBUG
/* ------------------------- Debugging Support --------------------------- */
/* Check properties of any chunk, whether free, inuse, mmapped etc */
static void do_check_any_chunk(mstate m, mchunkptr p) {
assert((is_aligned(chunk2mem(p))) || (p->head == FENCEPOST_HEAD));
assert(ok_address(m, p));
}
/* Check properties of top chunk */
static void do_check_top_chunk(mstate m, mchunkptr p) {
msegmentptr sp = segment_holding(m, (char*)p);
size_t sz = p->head & ~INUSE_BITS; /* third-lowest bit can be set! */
assert(sp != 0);
assert((is_aligned(chunk2mem(p))) || (p->head == FENCEPOST_HEAD));
assert(ok_address(m, p));
assert(sz == m->topsize);
assert(sz > 0);
assert(sz == ((sp->base + sp->size) - (char*)p) - TOP_FOOT_SIZE);
assert(pinuse(p));
assert(!pinuse(chunk_plus_offset(p, sz)));
}
/* Check properties of (inuse) mmapped chunks */
static void do_check_mmapped_chunk(mstate m, mchunkptr p) {
size_t sz = chunksize(p);
size_t len = (sz + (p->prev_foot) + MMAP_FOOT_PAD);
assert(is_mmapped(p));
assert(use_mmap(m));
assert((is_aligned(chunk2mem(p))) || (p->head == FENCEPOST_HEAD));
assert(ok_address(m, p));
assert(!is_small(sz));
assert((len & (mparams.page_size - SIZE_T_ONE)) == 0);
assert(chunk_plus_offset(p, sz)->head == FENCEPOST_HEAD);
assert(chunk_plus_offset(p, sz + SIZE_T_SIZE)->head == 0);
}
/* Check properties of inuse chunks */
static void do_check_inuse_chunk(mstate m, mchunkptr p) {
do_check_any_chunk(m, p);
assert(is_inuse(p));
assert(next_pinuse(p));
/* If not pinuse and not mmapped, previous chunk has OK offset */
assert(is_mmapped(p) || pinuse(p) || next_chunk(prev_chunk(p)) == p);
if (is_mmapped(p))
do_check_mmapped_chunk(m, p);
}
/* Check properties of free chunks */
static void do_check_free_chunk(mstate m, mchunkptr p) {
size_t sz = chunksize(p);
mchunkptr next = chunk_plus_offset(p, sz);
do_check_any_chunk(m, p);
assert(!is_inuse(p));
assert(!next_pinuse(p));
assert(!is_mmapped(p));
if (p != m->dv && p != m->top) {
if (sz >= MIN_CHUNK_SIZE) {
assert((sz & CHUNK_ALIGN_MASK) == 0);
assert(is_aligned(chunk2mem(p)));
assert(next->prev_foot == sz);
assert(pinuse(p));
assert(next == m->top || is_inuse(next));
assert(p->fd->bk == p);
assert(p->bk->fd == p);
}
else /* markers are always of size SIZE_T_SIZE */
assert(sz == SIZE_T_SIZE);
}
}
/* Check properties of malloced chunks at the point they are malloced */
static void do_check_malloced_chunk(mstate m, void* mem, size_t s) {
if (mem != 0) {
mchunkptr p = mem2chunk(mem);
size_t sz = p->head & ~INUSE_BITS;
do_check_inuse_chunk(m, p);
assert((sz & CHUNK_ALIGN_MASK) == 0);
assert(sz >= MIN_CHUNK_SIZE);
assert(sz >= s);
/* unless mmapped, size is less than MIN_CHUNK_SIZE more than request */
assert(is_mmapped(p) || sz < (s + MIN_CHUNK_SIZE));
}
}
/* Check a tree and its subtrees. */
static void do_check_tree(mstate m, tchunkptr t) {
tchunkptr head = 0;
tchunkptr u = t;
bindex_t tindex = t->index;
size_t tsize = chunksize(t);
bindex_t idx;
compute_tree_index(tsize, idx);
assert(tindex == idx);
assert(tsize >= MIN_LARGE_SIZE);
assert(tsize >= minsize_for_tree_index(idx));
assert((idx == NTREEBINS - 1) || (tsize < minsize_for_tree_index((idx + 1))));
do { /* traverse through chain of same-sized nodes */
do_check_any_chunk(m, ((mchunkptr)u));
assert(u->index == tindex);
assert(chunksize(u) == tsize);
assert(!is_inuse(u));
assert(!next_pinuse(u));
assert(u->fd->bk == u);
assert(u->bk->fd == u);
if (u->parent == 0) {
assert(u->child[0] == 0);
assert(u->child[1] == 0);
}
else {
assert(head == 0); /* only one node on chain has parent */
head = u;
assert(u->parent != u);
assert(u->parent->child[0] == u ||
u->parent->child[1] == u ||
*((tbinptr*)(u->parent)) == u);
if (u->child[0] != 0) {
assert(u->child[0]->parent == u);
assert(u->child[0] != u);
do_check_tree(m, u->child[0]);
}
if (u->child[1] != 0) {
assert(u->child[1]->parent == u);
assert(u->child[1] != u);
do_check_tree(m, u->child[1]);
}
if (u->child[0] != 0 && u->child[1] != 0) {
assert(chunksize(u->child[0]) < chunksize(u->child[1]));
}
}
u = u->fd;
} while (u != t);
assert(head != 0);
}
/* Check all the chunks in a treebin. */
static void do_check_treebin(mstate m, bindex_t i) {
tbinptr* tb = treebin_at(m, i);
tchunkptr t = *tb;
int empty = (m->treemap & (1U << i)) == 0;
if (t == 0)
assert(empty);
if (!empty)
do_check_tree(m, t);
}
/* Check all the chunks in a smallbin. */
static void do_check_smallbin(mstate m, bindex_t i) {
sbinptr b = smallbin_at(m, i);
mchunkptr p = b->bk;
unsigned int empty = (m->smallmap & (1U << i)) == 0;
if (p == b)
assert(empty);
if (!empty) {
for (; p != b; p = p->bk) {
size_t size = chunksize(p);
mchunkptr q;
/* each chunk claims to be free */
do_check_free_chunk(m, p);
/* chunk belongs in bin */
assert(small_index(size) == i);
assert(p->bk == b || chunksize(p->bk) == chunksize(p));
/* chunk is followed by an inuse chunk */
q = next_chunk(p);
if (q->head != FENCEPOST_HEAD)
do_check_inuse_chunk(m, q);
}
}
}
/* Find x in a bin. Used in other check functions. */
static int bin_find(mstate m, mchunkptr x) {
size_t size = chunksize(x);
if (is_small(size)) {
bindex_t sidx = small_index(size);
sbinptr b = smallbin_at(m, sidx);
if (smallmap_is_marked(m, sidx)) {
mchunkptr p = b;
do {
if (p == x)
return 1;
} while ((p = p->fd) != b);
}
}
else {
bindex_t tidx;
compute_tree_index(size, tidx);
if (treemap_is_marked(m, tidx)) {
tchunkptr t = *treebin_at(m, tidx);
size_t sizebits = size << leftshift_for_tree_index(tidx);
while (t != 0 && chunksize(t) != size) {
t = t->child[(sizebits >> (SIZE_T_BITSIZE - SIZE_T_ONE)) & 1];
sizebits <<= 1;
}
if (t != 0) {
tchunkptr u = t;
do {
if (u == (tchunkptr)x)
return 1;
} while ((u = u->fd) != t);
}
}
}
return 0;
}
/* Traverse each chunk and check it; return total */
static size_t traverse_and_check(mstate m) {
size_t sum = 0;
if (is_initialized(m)) {
msegmentptr s = &m->seg;
sum += m->topsize + TOP_FOOT_SIZE;
while (s != 0) {
mchunkptr q = align_as_chunk(s->base);
mchunkptr lastq = 0;
assert(pinuse(q));
while (segment_holds(s, q) &&
q != m->top && q->head != FENCEPOST_HEAD) {
sum += chunksize(q);
if (is_inuse(q)) {
assert(!bin_find(m, q));
do_check_inuse_chunk(m, q);
}
else {
assert(q == m->dv || bin_find(m, q));
assert(lastq == 0 || is_inuse(lastq)); /* Not 2 consecutive free */
do_check_free_chunk(m, q);
}
lastq = q;
q = next_chunk(q);
}
s = s->next;
}
}
return sum;
}
/* Check all properties of malloc_state. */
static void do_check_malloc_state(mstate m) {
bindex_t i;
size_t total;
/* check bins */
for (i = 0; i < NSMALLBINS; ++i)
do_check_smallbin(m, i);
for (i = 0; i < NTREEBINS; ++i)
do_check_treebin(m, i);
if (m->dvsize != 0) { /* check dv chunk */
do_check_any_chunk(m, m->dv);
assert(m->dvsize == chunksize(m->dv));
assert(m->dvsize >= MIN_CHUNK_SIZE);
assert(bin_find(m, m->dv) == 0);
}
if (m->top != 0) { /* check top chunk */
do_check_top_chunk(m, m->top);
/*assert(m->topsize == chunksize(m->top)); redundant */
assert(m->topsize > 0);
assert(bin_find(m, m->top) == 0);
}
total = traverse_and_check(m);
assert(total <= m->footprint);
assert(m->footprint <= m->max_footprint);
}
#endif /* DEBUG */
/* ----------------------------- statistics ------------------------------ */
#if !NO_MALLINFO
static struct mallinfo internal_mallinfo(mstate m) {
struct mallinfo nm = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
ensure_initialization();
if (!PREACTION(m)) {
check_malloc_state(m);
if (is_initialized(m)) {
size_t nfree = SIZE_T_ONE; /* top always free */
size_t mfree = m->topsize + TOP_FOOT_SIZE;
size_t sum = mfree;
msegmentptr s = &m->seg;
while (s != 0) {
mchunkptr q = align_as_chunk(s->base);
while (segment_holds(s, q) &&
q != m->top && q->head != FENCEPOST_HEAD) {
size_t sz = chunksize(q);
sum += sz;
if (!is_inuse(q)) {
mfree += sz;
++nfree;
}
q = next_chunk(q);
}
s = s->next;
}
nm.arena = sum;
nm.ordblks = nfree;
nm.hblkhd = m->footprint - sum;
nm.usmblks = m->max_footprint;
nm.uordblks = m->footprint - mfree;
nm.fordblks = mfree;
nm.keepcost = m->topsize;
}
POSTACTION(m);
}
return nm;
}
#endif /* !NO_MALLINFO */
#if !NO_MALLOC_STATS
static void internal_malloc_stats(mstate m) {
ensure_initialization();
if (!PREACTION(m)) {
size_t maxfp = 0;
size_t fp = 0;
size_t used = 0;
check_malloc_state(m);
if (is_initialized(m)) {
msegmentptr s = &m->seg;
maxfp = m->max_footprint;
fp = m->footprint;
used = fp - (m->topsize + TOP_FOOT_SIZE);
while (s != 0) {
mchunkptr q = align_as_chunk(s->base);
while (segment_holds(s, q) &&
q != m->top && q->head != FENCEPOST_HEAD) {
if (!is_inuse(q))
used -= chunksize(q);
q = next_chunk(q);
}
s = s->next;
}
}
POSTACTION(m); /* drop lock */
fprintf(stderr, "max system bytes = %10lu\n", (unsigned long)(maxfp));
fprintf(stderr, "system bytes = %10lu\n", (unsigned long)(fp));
fprintf(stderr, "in use bytes = %10lu\n", (unsigned long)(used));
}
}
#endif /* NO_MALLOC_STATS */
/* ----------------------- Operations on smallbins ----------------------- */
/*
Various forms of linking and unlinking are defined as macros. Even
the ones for trees, which are very long but have very short typical
paths. This is ugly but reduces reliance on inlining support of
compilers.
*/
/* Link a free chunk into a smallbin */
#define insert_small_chunk(M, P, S) {\
bindex_t I = small_index(S);\
mchunkptr B = smallbin_at(M, I);\
mchunkptr F = B;\
assert(S >= MIN_CHUNK_SIZE);\
if (!smallmap_is_marked(M, I))\
mark_smallmap(M, I);\
else if (RTCHECK(ok_address(M, B->fd)))\
F = B->fd;\
else {\
CORRUPTION_ERROR_ACTION(M);\
}\
B->fd = P;\
F->bk = P;\
P->fd = F;\
P->bk = B;\
}
/* Unlink a chunk from a smallbin */
#define unlink_small_chunk(M, P, S) {\
mchunkptr F = P->fd;\
mchunkptr B = P->bk;\
bindex_t I = small_index(S);\
assert(P != B);\
assert(P != F);\
assert(chunksize(P) == small_index2size(I));\
if (RTCHECK(F == smallbin_at(M,I) || (ok_address(M, F) && F->bk == P))) { \
if (B == F) {\
clear_smallmap(M, I);\
}\
else if (RTCHECK(B == smallbin_at(M,I) ||\
(ok_address(M, B) && B->fd == P))) {\
F->bk = B;\
B->fd = F;\
}\
else {\
CORRUPTION_ERROR_ACTION(M);\
}\
}\
else {\
CORRUPTION_ERROR_ACTION(M);\
}\
}
/* Unlink the first chunk from a smallbin */
#define unlink_first_small_chunk(M, B, P, I) {\
mchunkptr F = P->fd;\
assert(P != B);\
assert(P != F);\
assert(chunksize(P) == small_index2size(I));\
if (B == F) {\
clear_smallmap(M, I);\
}\
else if (RTCHECK(ok_address(M, F) && F->bk == P)) {\
F->bk = B;\
B->fd = F;\
}\
else {\
CORRUPTION_ERROR_ACTION(M);\
}\
}
/* Replace dv node, binning the old one */
/* Used only when dvsize known to be small */
#define replace_dv(M, P, S) {\
size_t DVS = M->dvsize;\
assert(is_small(DVS));\
if (DVS != 0) {\
mchunkptr DV = M->dv;\
insert_small_chunk(M, DV, DVS);\
}\
M->dvsize = S;\
M->dv = P;\
}
/* ------------------------- Operations on trees ------------------------- */
/* Insert chunk into tree */
#define insert_large_chunk(M, X, S) {\
tbinptr* H;\
bindex_t I;\
compute_tree_index(S, I);\
H = treebin_at(M, I);\
X->index = I;\
X->child[0] = X->child[1] = 0;\
if (!treemap_is_marked(M, I)) {\
mark_treemap(M, I);\
*H = X;\
X->parent = (tchunkptr)H;\
X->fd = X->bk = X;\
}\
else {\
tchunkptr T = *H;\
size_t K = S << leftshift_for_tree_index(I);\
for (;;) {\
if (chunksize(T) != S) {\
tchunkptr* C = &(T->child[(K >> (SIZE_T_BITSIZE-SIZE_T_ONE)) & 1]);\
K <<= 1;\
if (*C != 0)\
T = *C;\
else if (RTCHECK(ok_address(M, C))) {\
*C = X;\
X->parent = T;\
X->fd = X->bk = X;\
break;\
}\
else {\
CORRUPTION_ERROR_ACTION(M);\
break;\
}\
}\
else {\
tchunkptr F = T->fd;\
if (RTCHECK(ok_address(M, T) && ok_address(M, F))) {\
T->fd = F->bk = X;\
X->fd = F;\
X->bk = T;\
X->parent = 0;\
break;\
}\
else {\
CORRUPTION_ERROR_ACTION(M);\
break;\
}\
}\
}\
}\
}
/*
Unlink steps:
1. If x is a chained node, unlink it from its same-sized fd/bk links
and choose its bk node as its replacement.
2. If x was the last node of its size, but not a leaf node, it must
be replaced with a leaf node (not merely one with an open left or
right), to make sure that lefts and rights of descendents
correspond properly to bit masks. We use the rightmost descendent
of x. We could use any other leaf, but this is easy to locate and
tends to counteract removal of leftmosts elsewhere, and so keeps
paths shorter than minimally guaranteed. This doesn't loop much
because on average a node in a tree is near the bottom.
3. If x is the base of a chain (i.e., has parent links) relink
x's parent and children to x's replacement (or null if none).
*/
#define unlink_large_chunk(M, X) {\
tchunkptr XP = X->parent;\
tchunkptr R;\
if (X->bk != X) {\
tchunkptr F = X->fd;\
R = X->bk;\
if (RTCHECK(ok_address(M, F) && F->bk == X && R->fd == X)) {\
F->bk = R;\
R->fd = F;\
}\
else {\
CORRUPTION_ERROR_ACTION(M);\
}\
}\
else {\
tchunkptr* RP;\
if (((R = *(RP = &(X->child[1]))) != 0) ||\
((R = *(RP = &(X->child[0]))) != 0)) {\
tchunkptr* CP;\
while ((*(CP = &(R->child[1])) != 0) ||\
(*(CP = &(R->child[0])) != 0)) {\
R = *(RP = CP);\
}\
if (RTCHECK(ok_address(M, RP)))\
*RP = 0;\
else {\
CORRUPTION_ERROR_ACTION(M);\
}\
}\
}\
if (XP != 0) {\
tbinptr* H = treebin_at(M, X->index);\
if (X == *H) {\
if ((*H = R) == 0) \
clear_treemap(M, X->index);\
}\
else if (RTCHECK(ok_address(M, XP))) {\
if (XP->child[0] == X) \
XP->child[0] = R;\
else \
XP->child[1] = R;\
}\
else\
CORRUPTION_ERROR_ACTION(M);\
if (R != 0) {\
if (RTCHECK(ok_address(M, R))) {\
tchunkptr C0, C1;\
R->parent = XP;\
if ((C0 = X->child[0]) != 0) {\
if (RTCHECK(ok_address(M, C0))) {\
R->child[0] = C0;\
C0->parent = R;\
}\
else\
CORRUPTION_ERROR_ACTION(M);\
}\
if ((C1 = X->child[1]) != 0) {\
if (RTCHECK(ok_address(M, C1))) {\
R->child[1] = C1;\
C1->parent = R;\
}\
else\
CORRUPTION_ERROR_ACTION(M);\
}\
}\
else\
CORRUPTION_ERROR_ACTION(M);\
}\
}\
}
/* Relays to large vs small bin operations */
#define insert_chunk(M, P, S)\
if (is_small(S)) insert_small_chunk(M, P, S)\
else { tchunkptr TP = (tchunkptr)(P); insert_large_chunk(M, TP, S); }
#define unlink_chunk(M, P, S)\
if (is_small(S)) unlink_small_chunk(M, P, S)\
else { tchunkptr TP = (tchunkptr)(P); unlink_large_chunk(M, TP); }
/* Relays to internal calls to malloc/free from realloc, memalign etc */
#if ONLY_MSPACES
#define internal_malloc(m, b) mspace_malloc(m, b)
#define internal_free(m, mem) mspace_free(m,mem);
#else /* ONLY_MSPACES */
#if MSPACES
#define internal_malloc(m, b)\
((m == gm)? dlmalloc(b) : mspace_malloc(m, b))
#define internal_free(m, mem)\
if (m == gm) dlfree(mem); else mspace_free(m,mem);
#else /* MSPACES */
#define internal_malloc(m, b) dlmalloc(b)
#define internal_free(m, mem) dlfree(mem)
#endif /* MSPACES */
#endif /* ONLY_MSPACES */
/* ----------------------- Direct-mmapping chunks ----------------------- */
/*
Directly mmapped chunks are set up with an offset to the start of
the mmapped region stored in the prev_foot field of the chunk. This
allows reconstruction of the required argument to MUNMAP when freed,
and also allows adjustment of the returned chunk to meet alignment
requirements (especially in memalign).
*/
/* Malloc using mmap */
static void* mmap_alloc(mstate m, size_t nb) {
size_t mmsize = mmap_align(nb + SIX_SIZE_T_SIZES + CHUNK_ALIGN_MASK);
if (m->footprint_limit != 0) {
size_t fp = m->footprint + mmsize;
if (fp <= m->footprint || fp > m->footprint_limit)
return 0;
}
if (mmsize > nb) { /* Check for wrap around 0 */
char* mm = (char*)(CALL_DIRECT_MMAP(mmsize));
if (mm != CMFAIL) {
size_t offset = align_offset(chunk2mem(mm));
size_t psize = mmsize - offset - MMAP_FOOT_PAD;
mchunkptr p = (mchunkptr)(mm + offset);
p->prev_foot = offset;
p->head = psize;
mark_inuse_foot(m, p, psize);
chunk_plus_offset(p, psize)->head = FENCEPOST_HEAD;
chunk_plus_offset(p, psize + SIZE_T_SIZE)->head = 0;
if (m->least_addr == 0 || mm < m->least_addr)
m->least_addr = mm;
if ((m->footprint += mmsize) > m->max_footprint)
m->max_footprint = m->footprint;
assert(is_aligned(chunk2mem(p)));
check_mmapped_chunk(m, p);
return chunk2mem(p);
}
}
return 0;
}
/* Realloc using mmap */
static mchunkptr mmap_resize(mstate m, mchunkptr oldp, size_t nb, int flags) {
size_t oldsize = chunksize(oldp);
(void)flags; /* placate people compiling -Wunused */
if (is_small(nb)) /* Can't shrink mmap regions below small size */
return 0;
/* Keep old chunk if big enough but not too big */
if (oldsize >= nb + SIZE_T_SIZE &&
(oldsize - nb) <= (mparams.granularity << 1))
return oldp;
else {
size_t offset = oldp->prev_foot;
size_t oldmmsize = oldsize + offset + MMAP_FOOT_PAD;
size_t newmmsize = mmap_align(nb + SIX_SIZE_T_SIZES + CHUNK_ALIGN_MASK);
char* cp = (char*)CALL_MREMAP((char*)oldp - offset,
oldmmsize, newmmsize, flags);
if (cp != CMFAIL) {
mchunkptr newp = (mchunkptr)(cp + offset);
size_t psize = newmmsize - offset - MMAP_FOOT_PAD;
newp->head = psize;
mark_inuse_foot(m, newp, psize);
chunk_plus_offset(newp, psize)->head = FENCEPOST_HEAD;
chunk_plus_offset(newp, psize + SIZE_T_SIZE)->head = 0;
if (cp < m->least_addr)
m->least_addr = cp;
if ((m->footprint += newmmsize - oldmmsize) > m->max_footprint)
m->max_footprint = m->footprint;
check_mmapped_chunk(m, newp);
return newp;
}
}
return 0;
}
/* -------------------------- mspace management -------------------------- */
/* Initialize top chunk and its size */
static void init_top(mstate m, mchunkptr p, size_t psize) {
/* Ensure alignment */
size_t offset = align_offset(chunk2mem(p));
p = (mchunkptr)((char*)p + offset);
psize -= offset;
m->top = p;
m->topsize = psize;
p->head = psize | PINUSE_BIT;
/* set size of fake trailing chunk holding overhead space only once */
chunk_plus_offset(p, psize)->head = TOP_FOOT_SIZE;
m->trim_check = mparams.trim_threshold; /* reset on each update */
}
/* Initialize bins for a new mstate that is otherwise zeroed out */
static void init_bins(mstate m) {
/* Establish circular links for smallbins */
bindex_t i;
for (i = 0; i < NSMALLBINS; ++i) {
sbinptr bin = smallbin_at(m, i);
bin->fd = bin->bk = bin;
}
}
#if PROCEED_ON_ERROR
/* default corruption action */
static void reset_on_error(mstate m) {
int i;
++malloc_corruption_error_count;
/* Reinitialize fields to forget about all memory */
m->smallmap = m->treemap = 0;
m->dvsize = m->topsize = 0;
m->seg.base = 0;
m->seg.size = 0;
m->seg.next = 0;
m->top = m->dv = 0;
for (i = 0; i < NTREEBINS; ++i)
*treebin_at(m, i) = 0;
init_bins(m);
}
#endif /* PROCEED_ON_ERROR */
/* Allocate chunk and prepend remainder with chunk in successor base. */
static void* prepend_alloc(mstate m, char* newbase, char* oldbase,
size_t nb) {
mchunkptr p = align_as_chunk(newbase);
mchunkptr oldfirst = align_as_chunk(oldbase);
size_t psize = (char*)oldfirst - (char*)p;
mchunkptr q = chunk_plus_offset(p, nb);
size_t qsize = psize - nb;
set_size_and_pinuse_of_inuse_chunk(m, p, nb);
assert((char*)oldfirst > (char*)q);
assert(pinuse(oldfirst));
assert(qsize >= MIN_CHUNK_SIZE);
/* consolidate remainder with first chunk of old base */
if (oldfirst == m->top) {
size_t tsize = m->topsize += qsize;
m->top = q;
q->head = tsize | PINUSE_BIT;
check_top_chunk(m, q);
}
else if (oldfirst == m->dv) {
size_t dsize = m->dvsize += qsize;
m->dv = q;
set_size_and_pinuse_of_free_chunk(q, dsize);
}
else {
if (!is_inuse(oldfirst)) {
size_t nsize = chunksize(oldfirst);
unlink_chunk(m, oldfirst, nsize);
oldfirst = chunk_plus_offset(oldfirst, nsize);
qsize += nsize;
}
set_free_with_pinuse(q, qsize, oldfirst);
insert_chunk(m, q, qsize);
check_free_chunk(m, q);
}
check_malloced_chunk(m, chunk2mem(p), nb);
return chunk2mem(p);
}
/* Add a segment to hold a new noncontiguous region */
static void add_segment(mstate m, char* tbase, size_t tsize, flag_t mmapped) {
/* Determine locations and sizes of segment, fenceposts, old top */
char* old_top = (char*)m->top;
msegmentptr oldsp = segment_holding(m, old_top);
char* old_end = oldsp->base + oldsp->size;
size_t ssize = pad_request(sizeof(struct malloc_segment));
char* rawsp = old_end - (ssize + FOUR_SIZE_T_SIZES + CHUNK_ALIGN_MASK);
size_t offset = align_offset(chunk2mem(rawsp));
char* asp = rawsp + offset;
char* csp = (asp < (old_top + MIN_CHUNK_SIZE)) ? old_top : asp;
mchunkptr sp = (mchunkptr)csp;
msegmentptr ss = (msegmentptr)(chunk2mem(sp));
mchunkptr tnext = chunk_plus_offset(sp, ssize);
mchunkptr p = tnext;
int nfences = 0;
/* reset top to new space */
init_top(m, (mchunkptr)tbase, tsize - TOP_FOOT_SIZE);
/* Set up segment record */
assert(is_aligned(ss));
set_size_and_pinuse_of_inuse_chunk(m, sp, ssize);
*ss = m->seg; /* Push current record */
m->seg.base = tbase;
m->seg.size = tsize;
m->seg.sflags = mmapped;
m->seg.next = ss;
/* Insert trailing fenceposts */
for (;;) {
mchunkptr nextp = chunk_plus_offset(p, SIZE_T_SIZE);
p->head = FENCEPOST_HEAD;
++nfences;
if ((char*)(&(nextp->head)) < old_end)
p = nextp;
else
break;
}
assert(nfences >= 2);
/* Insert the rest of old top into a bin as an ordinary free chunk */
if (csp != old_top) {
mchunkptr q = (mchunkptr)old_top;
size_t psize = csp - old_top;
mchunkptr tn = chunk_plus_offset(q, psize);
set_free_with_pinuse(q, psize, tn);
insert_chunk(m, q, psize);
}
check_top_chunk(m, m->top);
}
/* -------------------------- System allocation -------------------------- */
/* Get memory from system using MORECORE or MMAP */
static void* sys_alloc(mstate m, size_t nb) {
char* tbase = CMFAIL;
size_t tsize = 0;
flag_t mmap_flag = 0;
size_t asize; /* allocation size */
ensure_initialization();
/* Directly map large chunks, but only if already initialized */
if (use_mmap(m) && nb >= mparams.mmap_threshold && m->topsize != 0) {
void* mem = mmap_alloc(m, nb);
if (mem != 0)
return mem;
}
asize = granularity_align(nb + SYS_ALLOC_PADDING);
if (asize <= nb)
return 0; /* wraparound */
if (m->footprint_limit != 0) {
size_t fp = m->footprint + asize;
if (fp <= m->footprint || fp > m->footprint_limit)
return 0;
}
/*
Try getting memory in any of three ways (in most-preferred to
least-preferred order):
1. A call to MORECORE that can normally contiguously extend memory.
(disabled if not MORECORE_CONTIGUOUS or not HAVE_MORECORE or
or main space is mmapped or a previous contiguous call failed)
2. A call to MMAP new space (disabled if not HAVE_MMAP).
Note that under the default settings, if MORECORE is unable to
fulfill a request, and HAVE_MMAP is true, then mmap is
used as a noncontiguous system allocator. This is a useful backup
strategy for systems with holes in address spaces -- in this case
sbrk cannot contiguously expand the heap, but mmap may be able to
find space.
3. A call to MORECORE that cannot usually contiguously extend memory.
(disabled if not HAVE_MORECORE)
In all cases, we need to request enough bytes from system to ensure
we can malloc nb bytes upon success, so pad with enough space for
top_foot, plus alignment-pad to make sure we don't lose bytes if
not on boundary, and round this up to a granularity unit.
*/
if (MORECORE_CONTIGUOUS && !use_noncontiguous(m)) {
char* br = CMFAIL;
size_t ssize = asize; /* sbrk call size */
msegmentptr ss = (m->top == 0) ? 0 : segment_holding(m, (char*)m->top);
ACQUIRE_MALLOC_GLOBAL_LOCK();
if (ss == 0) { /* First time through or recovery */
char* base = (char*)CALL_MORECORE(0);
if (base != CMFAIL) {
size_t fp;
/* Adjust to end on a page boundary */
if (!is_page_aligned(base))
ssize += (page_align((size_t)base) - (size_t)base);
fp = m->footprint + ssize; /* recheck limits */
if (ssize > nb && ssize < HALF_MAX_SIZE_T &&
(m->footprint_limit == 0 ||
(fp > m->footprint && fp <= m->footprint_limit)) &&
(br = (char*)(CALL_MORECORE(ssize))) == base) {
tbase = base;
tsize = ssize;
}
}
}
else {
/* Subtract out existing available top space from MORECORE request. */
ssize = granularity_align(nb - m->topsize + SYS_ALLOC_PADDING);
/* Use mem here only if it did continuously extend old space */
if (ssize < HALF_MAX_SIZE_T &&
(br = (char*)(CALL_MORECORE(ssize))) == ss->base + ss->size) {
tbase = br;
tsize = ssize;
}
}
if (tbase == CMFAIL) { /* Cope with partial failure */
if (br != CMFAIL) { /* Try to use/extend the space we did get */
if (ssize < HALF_MAX_SIZE_T &&
ssize < nb + SYS_ALLOC_PADDING) {
size_t esize = granularity_align(nb + SYS_ALLOC_PADDING - ssize);
if (esize < HALF_MAX_SIZE_T) {
char* end = (char*)CALL_MORECORE(esize);
if (end != CMFAIL)
ssize += esize;
else { /* Can't use; try to release */
(void)CALL_MORECORE(-ssize);
br = CMFAIL;
}
}
}
}
if (br != CMFAIL) { /* Use the space we did get */
tbase = br;
tsize = ssize;
}
else
disable_contiguous(m); /* Don't try contiguous path in the future */
}
RELEASE_MALLOC_GLOBAL_LOCK();
}
if (HAVE_MMAP && tbase == CMFAIL) { /* Try MMAP */
char* mp = (char*)(CALL_MMAP(asize));
if (mp != CMFAIL) {
tbase = mp;
tsize = asize;
mmap_flag = USE_MMAP_BIT;
}
}
if (HAVE_MORECORE && tbase == CMFAIL) { /* Try noncontiguous MORECORE */
if (asize < HALF_MAX_SIZE_T) {
char* br = CMFAIL;
char* end = CMFAIL;
ACQUIRE_MALLOC_GLOBAL_LOCK();
br = (char*)(CALL_MORECORE(asize));
end = (char*)(CALL_MORECORE(0));
RELEASE_MALLOC_GLOBAL_LOCK();
if (br != CMFAIL && end != CMFAIL && br < end) {
size_t ssize = end - br;
if (ssize > nb + TOP_FOOT_SIZE) {
tbase = br;
tsize = ssize;
}
}
}
}
if (tbase != CMFAIL) {
if ((m->footprint += tsize) > m->max_footprint)
m->max_footprint = m->footprint;
if (!is_initialized(m)) { /* first-time initialization */
if (m->least_addr == 0 || tbase < m->least_addr)
m->least_addr = tbase;
m->seg.base = tbase;
m->seg.size = tsize;
m->seg.sflags = mmap_flag;
m->magic = mparams.magic;
m->release_checks = MAX_RELEASE_CHECK_RATE;
init_bins(m);
#if !ONLY_MSPACES
if (is_global(m))
init_top(m, (mchunkptr)tbase, tsize - TOP_FOOT_SIZE);
else
#endif
{
/* Offset top by embedded malloc_state */
mchunkptr mn = next_chunk(mem2chunk(m));
init_top(m, mn, (size_t)((tbase + tsize) - (char*)mn) - TOP_FOOT_SIZE);
}
}
else {
/* Try to merge with an existing segment */
msegmentptr sp = &m->seg;
/* Only consider most recent segment if traversal suppressed */
while (sp != 0 && tbase != sp->base + sp->size)
sp = (NO_SEGMENT_TRAVERSAL) ? 0 : sp->next;
if (sp != 0 &&
!is_extern_segment(sp) &&
(sp->sflags & USE_MMAP_BIT) == mmap_flag &&
segment_holds(sp, m->top)) { /* append */
sp->size += tsize;
init_top(m, m->top, m->topsize + tsize);
}
else {
if (tbase < m->least_addr)
m->least_addr = tbase;
sp = &m->seg;
while (sp != 0 && sp->base != tbase + tsize)
sp = (NO_SEGMENT_TRAVERSAL) ? 0 : sp->next;
if (sp != 0 &&
!is_extern_segment(sp) &&
(sp->sflags & USE_MMAP_BIT) == mmap_flag) {
char* oldbase = sp->base;
sp->base = tbase;
sp->size += tsize;
return prepend_alloc(m, tbase, oldbase, nb);
}
else
add_segment(m, tbase, tsize, mmap_flag);
}
}
if (nb < m->topsize) { /* Allocate from new or extended top space */
size_t rsize = m->topsize -= nb;
mchunkptr p = m->top;
mchunkptr r = m->top = chunk_plus_offset(p, nb);
r->head = rsize | PINUSE_BIT;
set_size_and_pinuse_of_inuse_chunk(m, p, nb);
check_top_chunk(m, m->top);
check_malloced_chunk(m, chunk2mem(p), nb);
return chunk2mem(p);
}
}
MALLOC_FAILURE_ACTION;
return 0;
}
/* ----------------------- system deallocation -------------------------- */
/* Unmap and unlink any mmapped segments that don't contain used chunks */
static size_t release_unused_segments(mstate m) {
size_t released = 0;
int nsegs = 0;
msegmentptr pred = &m->seg;
msegmentptr sp = pred->next;
while (sp != 0) {
char* base = sp->base;
size_t size = sp->size;
msegmentptr next = sp->next;
++nsegs;
if (is_mmapped_segment(sp) && !is_extern_segment(sp)) {
mchunkptr p = align_as_chunk(base);
size_t psize = chunksize(p);
/* Can unmap if first chunk holds entire segment and not pinned */
if (!is_inuse(p) && (char*)p + psize >= base + size - TOP_FOOT_SIZE) {
tchunkptr tp = (tchunkptr)p;
assert(segment_holds(sp, (char*)sp));
if (p == m->dv) {
m->dv = 0;
m->dvsize = 0;
}
else {
unlink_large_chunk(m, tp);
}
if (CALL_MUNMAP(base, size) == 0) {
released += size;
m->footprint -= size;
/* unlink obsoleted record */
sp = pred;
sp->next = next;
}
else { /* back out if cannot unmap */
insert_large_chunk(m, tp, psize);
}
}
}
if (NO_SEGMENT_TRAVERSAL) /* scan only first segment */
break;
pred = sp;
sp = next;
}
/* Reset check counter */
m->release_checks = (((size_t)nsegs > (size_t)MAX_RELEASE_CHECK_RATE) ?
(size_t)nsegs : (size_t)MAX_RELEASE_CHECK_RATE);
return released;
}
static int sys_trim(mstate m, size_t pad) {
size_t released = 0;
ensure_initialization();
if (pad < MAX_REQUEST && is_initialized(m)) {
pad += TOP_FOOT_SIZE; /* ensure enough room for segment overhead */
if (m->topsize > pad) {
/* Shrink top space in granularity-size units, keeping at least one */
size_t unit = mparams.granularity;
size_t extra = ((m->topsize - pad + (unit - SIZE_T_ONE)) / unit -
SIZE_T_ONE) * unit;
msegmentptr sp = segment_holding(m, (char*)m->top);
if (!is_extern_segment(sp)) {
if (is_mmapped_segment(sp)) {
if (HAVE_MMAP &&
sp->size >= extra &&
!has_segment_link(m, sp)) { /* can't shrink if pinned */
size_t newsize = sp->size - extra;
(void)newsize; /* placate people compiling -Wunused-variable */
/* Prefer mremap, fall back to munmap */
if ((CALL_MREMAP(sp->base, sp->size, newsize, 0) != MFAIL) ||
(CALL_MUNMAP(sp->base + newsize, extra) == 0)) {
released = extra;
}
}
}
else if (HAVE_MORECORE) {
if (extra >= HALF_MAX_SIZE_T) /* Avoid wrapping negative */
extra = (HALF_MAX_SIZE_T)+SIZE_T_ONE - unit;
ACQUIRE_MALLOC_GLOBAL_LOCK();
{
/* Make sure end of memory is where we last set it. */
char* old_br = (char*)(CALL_MORECORE(0));
if (old_br == sp->base + sp->size) {
char* rel_br = (char*)(CALL_MORECORE(-extra));
char* new_br = (char*)(CALL_MORECORE(0));
if (rel_br != CMFAIL && new_br < old_br)
released = old_br - new_br;
}
}
RELEASE_MALLOC_GLOBAL_LOCK();
}
}
if (released != 0) {
sp->size -= released;
m->footprint -= released;
init_top(m, m->top, m->topsize - released);
check_top_chunk(m, m->top);
}
}
/* Unmap any unused mmapped segments */
if (HAVE_MMAP)
released += release_unused_segments(m);
/* On failure, disable autotrim to avoid repeated failed future calls */
if (released == 0 && m->topsize > m->trim_check)
m->trim_check = MAX_SIZE_T;
}
return (released != 0) ? 1 : 0;
}
/* Consolidate and bin a chunk. Differs from exported versions
of free mainly in that the chunk need not be marked as inuse.
*/
static void dispose_chunk(mstate m, mchunkptr p, size_t psize) {
mchunkptr next = chunk_plus_offset(p, psize);
if (!pinuse(p)) {
mchunkptr prev;
size_t prevsize = p->prev_foot;
if (is_mmapped(p)) {
psize += prevsize + MMAP_FOOT_PAD;
if (CALL_MUNMAP((char*)p - prevsize, psize) == 0)
m->footprint -= psize;
return;
}
prev = chunk_minus_offset(p, prevsize);
psize += prevsize;
p = prev;
if (RTCHECK(ok_address(m, prev))) { /* consolidate backward */
if (p != m->dv) {
unlink_chunk(m, p, prevsize);
}
else if ((next->head & INUSE_BITS) == INUSE_BITS) {
m->dvsize = psize;
set_free_with_pinuse(p, psize, next);
return;
}
}
else {
CORRUPTION_ERROR_ACTION(m);
return;
}
}
if (RTCHECK(ok_address(m, next))) {
if (!cinuse(next)) { /* consolidate forward */
if (next == m->top) {
size_t tsize = m->topsize += psize;
m->top = p;
p->head = tsize | PINUSE_BIT;
if (p == m->dv) {
m->dv = 0;
m->dvsize = 0;
}
return;
}
else if (next == m->dv) {
size_t dsize = m->dvsize += psize;
m->dv = p;
set_size_and_pinuse_of_free_chunk(p, dsize);
return;
}
else {
size_t nsize = chunksize(next);
psize += nsize;
unlink_chunk(m, next, nsize);
set_size_and_pinuse_of_free_chunk(p, psize);
if (p == m->dv) {
m->dvsize = psize;
return;
}
}
}
else {
set_free_with_pinuse(p, psize, next);
}
insert_chunk(m, p, psize);
}
else {
CORRUPTION_ERROR_ACTION(m);
}
}
/* ---------------------------- malloc --------------------------- */
/* allocate a large request from the best fitting chunk in a treebin */
static void* tmalloc_large(mstate m, size_t nb) {
tchunkptr v = 0;
size_t rsize = -nb; /* Unsigned negation */
tchunkptr t;
bindex_t idx;
compute_tree_index(nb, idx);
if ((t = *treebin_at(m, idx)) != 0) {
/* Traverse tree for this bin looking for node with size == nb */
size_t sizebits = nb << leftshift_for_tree_index(idx);
tchunkptr rst = 0; /* The deepest untaken right subtree */
for (;;) {
tchunkptr rt;
size_t trem = chunksize(t) - nb;
if (trem < rsize) {
v = t;
if ((rsize = trem) == 0)
break;
}
rt = t->child[1];
t = t->child[(sizebits >> (SIZE_T_BITSIZE - SIZE_T_ONE)) & 1];
if (rt != 0 && rt != t)
rst = rt;
if (t == 0) {
t = rst; /* set t to least subtree holding sizes > nb */
break;
}
sizebits <<= 1;
}
}
if (t == 0 && v == 0) { /* set t to root of next non-empty treebin */
binmap_t leftbits = left_bits(idx2bit(idx)) & m->treemap;
if (leftbits != 0) {
bindex_t i;
binmap_t leastbit = least_bit(leftbits);
compute_bit2idx(leastbit, i);
t = *treebin_at(m, i);
}
}
while (t != 0) { /* find smallest of tree or subtree */
size_t trem = chunksize(t) - nb;
if (trem < rsize) {
rsize = trem;
v = t;
}
t = leftmost_child(t);
}
/* If dv is a better fit, return 0 so malloc will use it */
if (v != 0 && rsize < (size_t)(m->dvsize - nb)) {
if (RTCHECK(ok_address(m, v))) { /* split */
mchunkptr r = chunk_plus_offset(v, nb);
assert(chunksize(v) == rsize + nb);
if (RTCHECK(ok_next(v, r))) {
unlink_large_chunk(m, v);
if (rsize < MIN_CHUNK_SIZE)
set_inuse_and_pinuse(m, v, (rsize + nb));
else {
set_size_and_pinuse_of_inuse_chunk(m, v, nb);
set_size_and_pinuse_of_free_chunk(r, rsize);
insert_chunk(m, r, rsize);
}
return chunk2mem(v);
}
}
CORRUPTION_ERROR_ACTION(m);
}
return 0;
}
/* allocate a small request from the best fitting chunk in a treebin */
static void* tmalloc_small(mstate m, size_t nb) {
tchunkptr t, v;
size_t rsize;
bindex_t i;
binmap_t leastbit = least_bit(m->treemap);
compute_bit2idx(leastbit, i);
v = t = *treebin_at(m, i);
rsize = chunksize(t) - nb;
while ((t = leftmost_child(t)) != 0) {
size_t trem = chunksize(t) - nb;
if (trem < rsize) {
rsize = trem;
v = t;
}
}
if (RTCHECK(ok_address(m, v))) {
mchunkptr r = chunk_plus_offset(v, nb);
assert(chunksize(v) == rsize + nb);
if (RTCHECK(ok_next(v, r))) {
unlink_large_chunk(m, v);
if (rsize < MIN_CHUNK_SIZE)
set_inuse_and_pinuse(m, v, (rsize + nb));
else {
set_size_and_pinuse_of_inuse_chunk(m, v, nb);
set_size_and_pinuse_of_free_chunk(r, rsize);
replace_dv(m, r, rsize);
}
return chunk2mem(v);
}
}
CORRUPTION_ERROR_ACTION(m);
return 0;
}
#if !ONLY_MSPACES
void* dlmalloc(size_t bytes) {
/*
Basic algorithm:
If a small request (< 256 bytes minus per-chunk overhead):
1. If one exists, use a remainderless chunk in associated smallbin.
(Remainderless means that there are too few excess bytes to
represent as a chunk.)
2. If it is big enough, use the dv chunk, which is normally the
chunk adjacent to the one used for the most recent small request.
3. If one exists, split the smallest available chunk in a bin,
saving remainder in dv.
4. If it is big enough, use the top chunk.
5. If available, get memory from system and use it
Otherwise, for a large request:
1. Find the smallest available binned chunk that fits, and use it
if it is better fitting than dv chunk, splitting if necessary.
2. If better fitting than any binned chunk, use the dv chunk.
3. If it is big enough, use the top chunk.
4. If request size >= mmap threshold, try to directly mmap this chunk.
5. If available, get memory from system and use it
The ugly goto's here ensure that postaction occurs along all paths.
*/
#if USE_LOCKS
ensure_initialization(); /* initialize in sys_alloc if not using locks */
#endif
if (!PREACTION(gm)) {
void* mem;
size_t nb;
if (bytes <= MAX_SMALL_REQUEST) {
bindex_t idx;
binmap_t smallbits;
nb = (bytes < MIN_REQUEST) ? MIN_CHUNK_SIZE : pad_request(bytes);
idx = small_index(nb);
smallbits = gm->smallmap >> idx;
if ((smallbits & 0x3U) != 0) { /* Remainderless fit to a smallbin. */
mchunkptr b, p;
idx += ~smallbits & 1; /* Uses next bin if idx empty */
b = smallbin_at(gm, idx);
p = b->fd;
assert(chunksize(p) == small_index2size(idx));
unlink_first_small_chunk(gm, b, p, idx);
set_inuse_and_pinuse(gm, p, small_index2size(idx));
mem = chunk2mem(p);
check_malloced_chunk(gm, mem, nb);
goto postaction;
}
else if (nb > gm->dvsize) {
if (smallbits != 0) { /* Use chunk in next nonempty smallbin */
mchunkptr b, p, r;
size_t rsize;
bindex_t i;
binmap_t leftbits = (smallbits << idx) & left_bits(idx2bit(idx));
binmap_t leastbit = least_bit(leftbits);
compute_bit2idx(leastbit, i);
b = smallbin_at(gm, i);
p = b->fd;
assert(chunksize(p) == small_index2size(i));
unlink_first_small_chunk(gm, b, p, i);
rsize = small_index2size(i) - nb;
/* Fit here cannot be remainderless if 4byte sizes */
if (SIZE_T_SIZE != 4 && rsize < MIN_CHUNK_SIZE)
set_inuse_and_pinuse(gm, p, small_index2size(i));
else {
set_size_and_pinuse_of_inuse_chunk(gm, p, nb);
r = chunk_plus_offset(p, nb);
set_size_and_pinuse_of_free_chunk(r, rsize);
replace_dv(gm, r, rsize);
}
mem = chunk2mem(p);
check_malloced_chunk(gm, mem, nb);
goto postaction;
}
else if (gm->treemap != 0 && (mem = tmalloc_small(gm, nb)) != 0) {
check_malloced_chunk(gm, mem, nb);
goto postaction;
}
}
}
else if (bytes >= MAX_REQUEST)
nb = MAX_SIZE_T; /* Too big to allocate. Force failure (in sys alloc) */
else {
nb = pad_request(bytes);
if (gm->treemap != 0 && (mem = tmalloc_large(gm, nb)) != 0) {
check_malloced_chunk(gm, mem, nb);
goto postaction;
}
}
if (nb <= gm->dvsize) {
size_t rsize = gm->dvsize - nb;
mchunkptr p = gm->dv;
if (rsize >= MIN_CHUNK_SIZE) { /* split dv */
mchunkptr r = gm->dv = chunk_plus_offset(p, nb);
gm->dvsize = rsize;
set_size_and_pinuse_of_free_chunk(r, rsize);
set_size_and_pinuse_of_inuse_chunk(gm, p, nb);
}
else { /* exhaust dv */
size_t dvs = gm->dvsize;
gm->dvsize = 0;
gm->dv = 0;
set_inuse_and_pinuse(gm, p, dvs);
}
mem = chunk2mem(p);
check_malloced_chunk(gm, mem, nb);
goto postaction;
}
else if (nb < gm->topsize) { /* Split top */
size_t rsize = gm->topsize -= nb;
mchunkptr p = gm->top;
mchunkptr r = gm->top = chunk_plus_offset(p, nb);
r->head = rsize | PINUSE_BIT;
set_size_and_pinuse_of_inuse_chunk(gm, p, nb);
mem = chunk2mem(p);
check_top_chunk(gm, gm->top);
check_malloced_chunk(gm, mem, nb);
goto postaction;
}
mem = sys_alloc(gm, nb);
postaction:
POSTACTION(gm);
return mem;
}
return 0;
}
/* ---------------------------- free --------------------------- */
void dlfree(void* mem) {
/*
Consolidate freed chunks with preceeding or succeeding bordering
free chunks, if they exist, and then place in a bin. Intermixed
with special cases for top, dv, mmapped chunks, and usage errors.
*/
if (mem != 0) {
mchunkptr p = mem2chunk(mem);
#if FOOTERS
mstate fm = get_mstate_for(p);
if (!ok_magic(fm)) {
USAGE_ERROR_ACTION(fm, p);
return;
}
#else /* FOOTERS */
#define fm gm
#endif /* FOOTERS */
if (!PREACTION(fm)) {
check_inuse_chunk(fm, p);
if (RTCHECK(ok_address(fm, p) && ok_inuse(p))) {
size_t psize = chunksize(p);
mchunkptr next = chunk_plus_offset(p, psize);
if (!pinuse(p)) {
size_t prevsize = p->prev_foot;
if (is_mmapped(p)) {
psize += prevsize + MMAP_FOOT_PAD;
if (CALL_MUNMAP((char*)p - prevsize, psize) == 0)
fm->footprint -= psize;
goto postaction;
}
else {
mchunkptr prev = chunk_minus_offset(p, prevsize);
psize += prevsize;
p = prev;
if (RTCHECK(ok_address(fm, prev))) { /* consolidate backward */
if (p != fm->dv) {
unlink_chunk(fm, p, prevsize);
}
else if ((next->head & INUSE_BITS) == INUSE_BITS) {
fm->dvsize = psize;
set_free_with_pinuse(p, psize, next);
goto postaction;
}
}
else
goto erroraction;
}
}
if (RTCHECK(ok_next(p, next) && ok_pinuse(next))) {
if (!cinuse(next)) { /* consolidate forward */
if (next == fm->top) {
size_t tsize = fm->topsize += psize;
fm->top = p;
p->head = tsize | PINUSE_BIT;
if (p == fm->dv) {
fm->dv = 0;
fm->dvsize = 0;
}
if (should_trim(fm, tsize))
sys_trim(fm, 0);
goto postaction;
}
else if (next == fm->dv) {
size_t dsize = fm->dvsize += psize;
fm->dv = p;
set_size_and_pinuse_of_free_chunk(p, dsize);
goto postaction;
}
else {
size_t nsize = chunksize(next);
psize += nsize;
unlink_chunk(fm, next, nsize);
set_size_and_pinuse_of_free_chunk(p, psize);
if (p == fm->dv) {
fm->dvsize = psize;
goto postaction;
}
}
}
else
set_free_with_pinuse(p, psize, next);
if (is_small(psize)) {
insert_small_chunk(fm, p, psize);
check_free_chunk(fm, p);
}
else {
tchunkptr tp = (tchunkptr)p;
insert_large_chunk(fm, tp, psize);
check_free_chunk(fm, p);
if (--fm->release_checks == 0)
release_unused_segments(fm);
}
goto postaction;
}
}
erroraction:
USAGE_ERROR_ACTION(fm, p);
postaction:
POSTACTION(fm);
}
}
#if !FOOTERS
#undef fm
#endif /* FOOTERS */
}
void* dlcalloc(size_t n_elements, size_t elem_size) {
void* mem;
size_t req = 0;
if (n_elements != 0) {
req = n_elements * elem_size;
if (((n_elements | elem_size) & ~(size_t)0xffff) &&
(req / n_elements != elem_size))
req = MAX_SIZE_T; /* force downstream failure on overflow */
}
mem = dlmalloc(req);
if (mem != 0 && calloc_must_clear(mem2chunk(mem)))
memset(mem, 0, req);
return mem;
}
#endif /* !ONLY_MSPACES */
/* ------------ Internal support for realloc, memalign, etc -------------- */
/* Try to realloc; only in-place unless can_move true */
static mchunkptr try_realloc_chunk(mstate m, mchunkptr p, size_t nb,
int can_move) {
mchunkptr newp = 0;
size_t oldsize = chunksize(p);
mchunkptr next = chunk_plus_offset(p, oldsize);
if (RTCHECK(ok_address(m, p) && ok_inuse(p) &&
ok_next(p, next) && ok_pinuse(next))) {
if (is_mmapped(p)) {
newp = mmap_resize(m, p, nb, can_move);
}
else if (oldsize >= nb) { /* already big enough */
size_t rsize = oldsize - nb;
if (rsize >= MIN_CHUNK_SIZE) { /* split off remainder */
mchunkptr r = chunk_plus_offset(p, nb);
set_inuse(m, p, nb);
set_inuse(m, r, rsize);
dispose_chunk(m, r, rsize);
}
newp = p;
}
else if (next == m->top) { /* extend into top */
if (oldsize + m->topsize > nb) {
size_t newsize = oldsize + m->topsize;
size_t newtopsize = newsize - nb;
mchunkptr newtop = chunk_plus_offset(p, nb);
set_inuse(m, p, nb);
newtop->head = newtopsize | PINUSE_BIT;
m->top = newtop;
m->topsize = newtopsize;
newp = p;
}
}
else if (next == m->dv) { /* extend into dv */
size_t dvs = m->dvsize;
if (oldsize + dvs >= nb) {
size_t dsize = oldsize + dvs - nb;
if (dsize >= MIN_CHUNK_SIZE) {
mchunkptr r = chunk_plus_offset(p, nb);
mchunkptr n = chunk_plus_offset(r, dsize);
set_inuse(m, p, nb);
set_size_and_pinuse_of_free_chunk(r, dsize);
clear_pinuse(n);
m->dvsize = dsize;
m->dv = r;
}
else { /* exhaust dv */
size_t newsize = oldsize + dvs;
set_inuse(m, p, newsize);
m->dvsize = 0;
m->dv = 0;
}
newp = p;
}
}
else if (!cinuse(next)) { /* extend into next free chunk */
size_t nextsize = chunksize(next);
if (oldsize + nextsize >= nb) {
size_t rsize = oldsize + nextsize - nb;
unlink_chunk(m, next, nextsize);
if (rsize < MIN_CHUNK_SIZE) {
size_t newsize = oldsize + nextsize;
set_inuse(m, p, newsize);
}
else {
mchunkptr r = chunk_plus_offset(p, nb);
set_inuse(m, p, nb);
set_inuse(m, r, rsize);
dispose_chunk(m, r, rsize);
}
newp = p;
}
}
}
else {
USAGE_ERROR_ACTION(m, chunk2mem(p));
}
return newp;
}
static void* internal_memalign(mstate m, size_t alignment, size_t bytes) {
void* mem = 0;
if (alignment < MIN_CHUNK_SIZE) /* must be at least a minimum chunk size */
alignment = MIN_CHUNK_SIZE;
if ((alignment & (alignment - SIZE_T_ONE)) != 0) {/* Ensure a power of 2 */
size_t a = MALLOC_ALIGNMENT << 1;
while (a < alignment) a <<= 1;
alignment = a;
}
if (bytes >= MAX_REQUEST - alignment) {
if (m != 0) { /* Test isn't needed but avoids compiler warning */
MALLOC_FAILURE_ACTION;
}
}
else {
size_t nb = request2size(bytes);
size_t req = nb + alignment + MIN_CHUNK_SIZE - CHUNK_OVERHEAD;
mem = internal_malloc(m, req);
if (mem != 0) {
mchunkptr p = mem2chunk(mem);
if (PREACTION(m))
return 0;
if ((((size_t)(mem)) & (alignment - 1)) != 0) { /* misaligned */
/*
Find an aligned spot inside chunk. Since we need to give
back leading space in a chunk of at least MIN_CHUNK_SIZE, if
the first calculation places us at a spot with less than
MIN_CHUNK_SIZE leader, we can move to the next aligned spot.
We've allocated enough total room so that this is always
possible.
*/
char* br = (char*)mem2chunk((size_t)(((size_t)((char*)mem + alignment -
SIZE_T_ONE)) &
-alignment));
char* pos = ((size_t)(br - (char*)(p)) >= MIN_CHUNK_SIZE) ?
br : br + alignment;
mchunkptr newp = (mchunkptr)pos;
size_t leadsize = pos - (char*)(p);
size_t newsize = chunksize(p) - leadsize;
if (is_mmapped(p)) { /* For mmapped chunks, just adjust offset */
newp->prev_foot = p->prev_foot + leadsize;
newp->head = newsize;
}
else { /* Otherwise, give back leader, use the rest */
set_inuse(m, newp, newsize);
set_inuse(m, p, leadsize);
dispose_chunk(m, p, leadsize);
}
p = newp;
}
/* Give back spare room at the end */
if (!is_mmapped(p)) {
size_t size = chunksize(p);
if (size > nb + MIN_CHUNK_SIZE) {
size_t remainder_size = size - nb;
mchunkptr remainder = chunk_plus_offset(p, nb);
set_inuse(m, p, nb);
set_inuse(m, remainder, remainder_size);
dispose_chunk(m, remainder, remainder_size);
}
}
mem = chunk2mem(p);
assert(chunksize(p) >= nb);
assert(((size_t)mem & (alignment - 1)) == 0);
check_inuse_chunk(m, p);
POSTACTION(m);
}
}
return mem;
}
/*
Common support for independent_X routines, handling
all of the combinations that can result.
The opts arg has:
bit 0 set if all elements are same size (using sizes[0])
bit 1 set if elements should be zeroed
*/
static void** ialloc(mstate m,
size_t n_elements,
size_t* sizes,
int opts,
void* chunks[]) {
size_t element_size; /* chunksize of each element, if all same */
size_t contents_size; /* total size of elements */
size_t array_size; /* request size of pointer array */
void* mem; /* malloced aggregate space */
mchunkptr p; /* corresponding chunk */
size_t remainder_size; /* remaining bytes while splitting */
void** marray; /* either "chunks" or malloced ptr array */
mchunkptr array_chunk; /* chunk for malloced ptr array */
flag_t was_enabled; /* to disable mmap */
size_t size;
size_t i;
ensure_initialization();
/* compute array length, if needed */
if (chunks != 0) {
if (n_elements == 0)
return chunks; /* nothing to do */
marray = chunks;
array_size = 0;
}
else {
/* if empty req, must still return chunk representing empty array */
if (n_elements == 0)
return (void**)internal_malloc(m, 0);
marray = 0;
array_size = request2size(n_elements * (sizeof(void*)));
}
/* compute total element size */
if (opts & 0x1) { /* all-same-size */
element_size = request2size(*sizes);
contents_size = n_elements * element_size;
}
else { /* add up all the sizes */
element_size = 0;
contents_size = 0;
for (i = 0; i != n_elements; ++i)
contents_size += request2size(sizes[i]);
}
size = contents_size + array_size;
/*
Allocate the aggregate chunk. First disable direct-mmapping so
malloc won't use it, since we would not be able to later
free/realloc space internal to a segregated mmap region.
*/
was_enabled = use_mmap(m);
disable_mmap(m);
mem = internal_malloc(m, size - CHUNK_OVERHEAD);
if (was_enabled)
enable_mmap(m);
if (mem == 0)
return 0;
if (PREACTION(m)) return 0;
p = mem2chunk(mem);
remainder_size = chunksize(p);
assert(!is_mmapped(p));
if (opts & 0x2) { /* optionally clear the elements */
memset((size_t*)mem, 0, remainder_size - SIZE_T_SIZE - array_size);
}
/* If not provided, allocate the pointer array as final part of chunk */
if (marray == 0) {
size_t array_chunk_size;
array_chunk = chunk_plus_offset(p, contents_size);
array_chunk_size = remainder_size - contents_size;
marray = (void**)(chunk2mem(array_chunk));
set_size_and_pinuse_of_inuse_chunk(m, array_chunk, array_chunk_size);
remainder_size = contents_size;
}
/* split out elements */
for (i = 0; ; ++i) {
marray[i] = chunk2mem(p);
if (i != n_elements - 1) {
if (element_size != 0)
size = element_size;
else
size = request2size(sizes[i]);
remainder_size -= size;
set_size_and_pinuse_of_inuse_chunk(m, p, size);
p = chunk_plus_offset(p, size);
}
else { /* the final element absorbs any overallocation slop */
set_size_and_pinuse_of_inuse_chunk(m, p, remainder_size);
break;
}
}
#if DEBUG
if (marray != chunks) {
/* final element must have exactly exhausted chunk */
if (element_size != 0) {
assert(remainder_size == element_size);
}
else {
assert(remainder_size == request2size(sizes[i]));
}
check_inuse_chunk(m, mem2chunk(marray));
}
for (i = 0; i != n_elements; ++i)
check_inuse_chunk(m, mem2chunk(marray[i]));
#endif /* DEBUG */
POSTACTION(m);
return marray;
}
/* Try to free all pointers in the given array.
Note: this could be made faster, by delaying consolidation,
at the price of disabling some user integrity checks, We
still optimize some consolidations by combining adjacent
chunks before freeing, which will occur often if allocated
with ialloc or the array is sorted.
*/
static size_t internal_bulk_free(mstate m, void* array[], size_t nelem) {
size_t unfreed = 0;
if (!PREACTION(m)) {
void** a;
void** fence = &(array[nelem]);
for (a = array; a != fence; ++a) {
void* mem = *a;
if (mem != 0) {
mchunkptr p = mem2chunk(mem);
size_t psize = chunksize(p);
#if FOOTERS
if (get_mstate_for(p) != m) {
++unfreed;
continue;
}
#endif
check_inuse_chunk(m, p);
*a = 0;
if (RTCHECK(ok_address(m, p) && ok_inuse(p))) {
void ** b = a + 1; /* try to merge with next chunk */
mchunkptr next = next_chunk(p);
if (b != fence && *b == chunk2mem(next)) {
size_t newsize = chunksize(next) + psize;
set_inuse(m, p, newsize);
*b = chunk2mem(p);
}
else
dispose_chunk(m, p, psize);
}
else {
CORRUPTION_ERROR_ACTION(m);
break;
}
}
}
if (should_trim(m, m->topsize))
sys_trim(m, 0);
POSTACTION(m);
}
return unfreed;
}
/* Traversal */
#if MALLOC_INSPECT_ALL
static void internal_inspect_all(mstate m,
void(*handler)(void *start,
void *end,
size_t used_bytes,
void* callback_arg),
void* arg) {
if (is_initialized(m)) {
mchunkptr top = m->top;
msegmentptr s;
for (s = &m->seg; s != 0; s = s->next) {
mchunkptr q = align_as_chunk(s->base);
while (segment_holds(s, q) && q->head != FENCEPOST_HEAD) {
mchunkptr next = next_chunk(q);
size_t sz = chunksize(q);
size_t used;
void* start;
if (is_inuse(q)) {
used = sz - CHUNK_OVERHEAD; /* must not be mmapped */
start = chunk2mem(q);
}
else {
used = 0;
if (is_small(sz)) { /* offset by possible bookkeeping */
start = (void*)((char*)q + sizeof(struct malloc_chunk));
}
else {
start = (void*)((char*)q + sizeof(struct malloc_tree_chunk));
}
}
if (start < (void*)next) /* skip if all space is bookkeeping */
handler(start, next, used, arg);
if (q == top)
break;
q = next;
}
}
}
}
#endif /* MALLOC_INSPECT_ALL */
/* ------------------ Exported realloc, memalign, etc -------------------- */
#if !ONLY_MSPACES
void* dlrealloc(void* oldmem, size_t bytes) {
void* mem = 0;
if (oldmem == 0) {
mem = dlmalloc(bytes);
}
else if (bytes >= MAX_REQUEST) {
MALLOC_FAILURE_ACTION;
}
#ifdef REALLOC_ZERO_BYTES_FREES
else if (bytes == 0) {
dlfree(oldmem);
}
#endif /* REALLOC_ZERO_BYTES_FREES */
else {
size_t nb = request2size(bytes);
mchunkptr oldp = mem2chunk(oldmem);
#if ! FOOTERS
mstate m = gm;
#else /* FOOTERS */
mstate m = get_mstate_for(oldp);
if (!ok_magic(m)) {
USAGE_ERROR_ACTION(m, oldmem);
return 0;
}
#endif /* FOOTERS */
if (!PREACTION(m)) {
mchunkptr newp = try_realloc_chunk(m, oldp, nb, 1);
POSTACTION(m);
if (newp != 0) {
check_inuse_chunk(m, newp);
mem = chunk2mem(newp);
}
else {
mem = internal_malloc(m, bytes);
if (mem != 0) {
size_t oc = chunksize(oldp) - overhead_for(oldp);
memcpy(mem, oldmem, (oc < bytes) ? oc : bytes);
internal_free(m, oldmem);
}
}
}
}
return mem;
}
void* dlrealloc_in_place(void* oldmem, size_t bytes) {
void* mem = 0;
if (oldmem != 0) {
if (bytes >= MAX_REQUEST) {
MALLOC_FAILURE_ACTION;
}
else {
size_t nb = request2size(bytes);
mchunkptr oldp = mem2chunk(oldmem);
#if ! FOOTERS
mstate m = gm;
#else /* FOOTERS */
mstate m = get_mstate_for(oldp);
if (!ok_magic(m)) {
USAGE_ERROR_ACTION(m, oldmem);
return 0;
}
#endif /* FOOTERS */
if (!PREACTION(m)) {
mchunkptr newp = try_realloc_chunk(m, oldp, nb, 0);
POSTACTION(m);
if (newp == oldp) {
check_inuse_chunk(m, newp);
mem = oldmem;
}
}
}
}
return mem;
}
void* dlmemalign(size_t alignment, size_t bytes) {
if (alignment <= MALLOC_ALIGNMENT) {
return dlmalloc(bytes);
}
return internal_memalign(gm, alignment, bytes);
}
int dlposix_memalign(void** pp, size_t alignment, size_t bytes) {
void* mem = 0;
if (alignment == MALLOC_ALIGNMENT)
mem = dlmalloc(bytes);
else {
size_t d = alignment / sizeof(void*);
size_t r = alignment % sizeof(void*);
if (r != 0 || d == 0 || (d & (d - SIZE_T_ONE)) != 0)
return EINVAL;
else if (bytes <= MAX_REQUEST - alignment) {
if (alignment < MIN_CHUNK_SIZE)
alignment = MIN_CHUNK_SIZE;
mem = internal_memalign(gm, alignment, bytes);
}
}
if (mem == 0)
return ENOMEM;
else {
*pp = mem;
return 0;
}
}
void* dlvalloc(size_t bytes) {
size_t pagesz;
ensure_initialization();
pagesz = mparams.page_size;
return dlmemalign(pagesz, bytes);
}
void* dlpvalloc(size_t bytes) {
size_t pagesz;
ensure_initialization();
pagesz = mparams.page_size;
return dlmemalign(pagesz, (bytes + pagesz - SIZE_T_ONE) & ~(pagesz - SIZE_T_ONE));
}
void** dlindependent_calloc(size_t n_elements, size_t elem_size,
void* chunks[]) {
size_t sz = elem_size; /* serves as 1-element array */
return ialloc(gm, n_elements, &sz, 3, chunks);
}
void** dlindependent_comalloc(size_t n_elements, size_t sizes[],
void* chunks[]) {
return ialloc(gm, n_elements, sizes, 0, chunks);
}
size_t dlbulk_free(void* array[], size_t nelem) {
return internal_bulk_free(gm, array, nelem);
}
#if MALLOC_INSPECT_ALL
void dlmalloc_inspect_all(void(*handler)(void *start,
void *end,
size_t used_bytes,
void* callback_arg),
void* arg) {
ensure_initialization();
if (!PREACTION(gm)) {
internal_inspect_all(gm, handler, arg);
POSTACTION(gm);
}
}
#endif /* MALLOC_INSPECT_ALL */
int dlmalloc_trim(size_t pad) {
int result = 0;
ensure_initialization();
if (!PREACTION(gm)) {
result = sys_trim(gm, pad);
POSTACTION(gm);
}
return result;
}
size_t dlmalloc_footprint(void) {
return gm->footprint;
}
size_t dlmalloc_max_footprint(void) {
return gm->max_footprint;
}
size_t dlmalloc_footprint_limit(void) {
size_t maf = gm->footprint_limit;
return maf == 0 ? MAX_SIZE_T : maf;
}
size_t dlmalloc_set_footprint_limit(size_t bytes) {
size_t result; /* invert sense of 0 */
if (bytes == 0)
result = granularity_align(1); /* Use minimal size */
if (bytes == MAX_SIZE_T)
result = 0; /* disable */
else
result = granularity_align(bytes);
return gm->footprint_limit = result;
}
#if !NO_MALLINFO
struct mallinfo dlmallinfo(void) {
return internal_mallinfo(gm);
}
#endif /* NO_MALLINFO */
#if !NO_MALLOC_STATS
void dlmalloc_stats() {
internal_malloc_stats(gm);
}
#endif /* NO_MALLOC_STATS */
int dlmallopt(int param_number, int value) {
return change_mparam(param_number, value);
}
size_t dlmalloc_usable_size(void* mem) {
if (mem != 0) {
mchunkptr p = mem2chunk(mem);
if (is_inuse(p))
return chunksize(p) - overhead_for(p);
}
return 0;
}
#endif /* !ONLY_MSPACES */
/* ----------------------------- user mspaces ---------------------------- */
#if MSPACES
static mstate init_user_mstate(char* tbase, size_t tsize) {
size_t msize = pad_request(sizeof(struct malloc_state));
mchunkptr mn;
mchunkptr msp = align_as_chunk(tbase);
mstate m = (mstate)(chunk2mem(msp));
memset(m, 0, msize);
(void)INITIAL_LOCK(&m->mutex);
msp->head = (msize | INUSE_BITS);
m->seg.base = m->least_addr = tbase;
m->seg.size = m->footprint = m->max_footprint = tsize;
m->magic = mparams.magic;
m->release_checks = MAX_RELEASE_CHECK_RATE;
m->mflags = mparams.default_mflags;
m->extp = 0;
m->exts = 0;
disable_contiguous(m);
init_bins(m);
mn = next_chunk(mem2chunk(m));
init_top(m, mn, (size_t)((tbase + tsize) - (char*)mn) - TOP_FOOT_SIZE);
check_top_chunk(m, m->top);
return m;
}
mspace create_mspace(size_t capacity, int locked) {
mstate m = 0;
size_t msize;
ensure_initialization();
msize = pad_request(sizeof(struct malloc_state));
if (capacity < (size_t)-(msize + TOP_FOOT_SIZE + mparams.page_size)) {
size_t rs = ((capacity == 0) ? mparams.granularity :
(capacity + TOP_FOOT_SIZE + msize));
size_t tsize = granularity_align(rs);
char* tbase = (char*)(CALL_MMAP(tsize));
if (tbase != CMFAIL) {
m = init_user_mstate(tbase, tsize);
m->seg.sflags = USE_MMAP_BIT;
set_lock(m, locked);
}
}
return (mspace)m;
}
mspace create_mspace_with_base(void* base, size_t capacity, int locked) {
mstate m = 0;
size_t msize;
ensure_initialization();
msize = pad_request(sizeof(struct malloc_state));
if (capacity > msize + TOP_FOOT_SIZE &&
capacity < (size_t)-(msize + TOP_FOOT_SIZE + mparams.page_size)) {
m = init_user_mstate((char*)base, capacity);
m->seg.sflags = EXTERN_BIT;
set_lock(m, locked);
}
return (mspace)m;
}
int mspace_track_large_chunks(mspace msp, int enable) {
int ret = 0;
mstate ms = (mstate)msp;
if (!PREACTION(ms)) {
if (!use_mmap(ms)) {
ret = 1;
}
if (!enable) {
enable_mmap(ms);
}
else {
disable_mmap(ms);
}
POSTACTION(ms);
}
return ret;
}
size_t destroy_mspace(mspace msp) {
size_t freed = 0;
mstate ms = (mstate)msp;
if (ok_magic(ms)) {
msegmentptr sp = &ms->seg;
(void)DESTROY_LOCK(&ms->mutex); /* destroy before unmapped */
while (sp != 0) {
char* base = sp->base;
size_t size = sp->size;
flag_t flag = sp->sflags;
(void)base; /* placate people compiling -Wunused-variable */
sp = sp->next;
if ((flag & USE_MMAP_BIT) && !(flag & EXTERN_BIT) &&
CALL_MUNMAP(base, size) == 0)
freed += size;
}
}
else {
USAGE_ERROR_ACTION(ms, ms);
}
return freed;
}
/*
mspace versions of routines are near-clones of the global
versions. This is not so nice but better than the alternatives.
*/
void* mspace_malloc(mspace msp, size_t bytes) {
mstate ms = (mstate)msp;
if (!ok_magic(ms)) {
USAGE_ERROR_ACTION(ms, ms);
return 0;
}
if (!PREACTION(ms)) {
void* mem;
size_t nb;
if (bytes <= MAX_SMALL_REQUEST) {
bindex_t idx;
binmap_t smallbits;
nb = (bytes < MIN_REQUEST) ? MIN_CHUNK_SIZE : pad_request(bytes);
idx = small_index(nb);
smallbits = ms->smallmap >> idx;
if ((smallbits & 0x3U) != 0) { /* Remainderless fit to a smallbin. */
mchunkptr b, p;
idx += ~smallbits & 1; /* Uses next bin if idx empty */
b = smallbin_at(ms, idx);
p = b->fd;
assert(chunksize(p) == small_index2size(idx));
unlink_first_small_chunk(ms, b, p, idx);
set_inuse_and_pinuse(ms, p, small_index2size(idx));
mem = chunk2mem(p);
check_malloced_chunk(ms, mem, nb);
goto postaction;
}
else if (nb > ms->dvsize) {
if (smallbits != 0) { /* Use chunk in next nonempty smallbin */
mchunkptr b, p, r;
size_t rsize;
bindex_t i;
binmap_t leftbits = (smallbits << idx) & left_bits(idx2bit(idx));
binmap_t leastbit = least_bit(leftbits);
compute_bit2idx(leastbit, i);
b = smallbin_at(ms, i);
p = b->fd;
assert(chunksize(p) == small_index2size(i));
unlink_first_small_chunk(ms, b, p, i);
rsize = small_index2size(i) - nb;
/* Fit here cannot be remainderless if 4byte sizes */
if (SIZE_T_SIZE != 4 && rsize < MIN_CHUNK_SIZE)
set_inuse_and_pinuse(ms, p, small_index2size(i));
else {
set_size_and_pinuse_of_inuse_chunk(ms, p, nb);
r = chunk_plus_offset(p, nb);
set_size_and_pinuse_of_free_chunk(r, rsize);
replace_dv(ms, r, rsize);
}
mem = chunk2mem(p);
check_malloced_chunk(ms, mem, nb);
goto postaction;
}
else if (ms->treemap != 0 && (mem = tmalloc_small(ms, nb)) != 0) {
check_malloced_chunk(ms, mem, nb);
goto postaction;
}
}
}
else if (bytes >= MAX_REQUEST)
nb = MAX_SIZE_T; /* Too big to allocate. Force failure (in sys alloc) */
else {
nb = pad_request(bytes);
if (ms->treemap != 0 && (mem = tmalloc_large(ms, nb)) != 0) {
check_malloced_chunk(ms, mem, nb);
goto postaction;
}
}
if (nb <= ms->dvsize) {
size_t rsize = ms->dvsize - nb;
mchunkptr p = ms->dv;
if (rsize >= MIN_CHUNK_SIZE) { /* split dv */
mchunkptr r = ms->dv = chunk_plus_offset(p, nb);
ms->dvsize = rsize;
set_size_and_pinuse_of_free_chunk(r, rsize);
set_size_and_pinuse_of_inuse_chunk(ms, p, nb);
}
else { /* exhaust dv */
size_t dvs = ms->dvsize;
ms->dvsize = 0;
ms->dv = 0;
set_inuse_and_pinuse(ms, p, dvs);
}
mem = chunk2mem(p);
check_malloced_chunk(ms, mem, nb);
goto postaction;
}
else if (nb < ms->topsize) { /* Split top */
size_t rsize = ms->topsize -= nb;
mchunkptr p = ms->top;
mchunkptr r = ms->top = chunk_plus_offset(p, nb);
r->head = rsize | PINUSE_BIT;
set_size_and_pinuse_of_inuse_chunk(ms, p, nb);
mem = chunk2mem(p);
check_top_chunk(ms, ms->top);
check_malloced_chunk(ms, mem, nb);
goto postaction;
}
mem = sys_alloc(ms, nb);
postaction:
POSTACTION(ms);
return mem;
}
return 0;
}
void mspace_free(mspace msp, void* mem) {
if (mem != 0) {
mchunkptr p = mem2chunk(mem);
#if FOOTERS
mstate fm = get_mstate_for(p);
(void)msp; /* placate people compiling -Wunused */
#else /* FOOTERS */
mstate fm = (mstate)msp;
#endif /* FOOTERS */
if (!ok_magic(fm)) {
USAGE_ERROR_ACTION(fm, p);
return;
}
if (!PREACTION(fm)) {
check_inuse_chunk(fm, p);
if (RTCHECK(ok_address(fm, p) && ok_inuse(p))) {
size_t psize = chunksize(p);
mchunkptr next = chunk_plus_offset(p, psize);
if (!pinuse(p)) {
size_t prevsize = p->prev_foot;
if (is_mmapped(p)) {
psize += prevsize + MMAP_FOOT_PAD;
if (CALL_MUNMAP((char*)p - prevsize, psize) == 0)
fm->footprint -= psize;
goto postaction;
}
else {
mchunkptr prev = chunk_minus_offset(p, prevsize);
psize += prevsize;
p = prev;
if (RTCHECK(ok_address(fm, prev))) { /* consolidate backward */
if (p != fm->dv) {
unlink_chunk(fm, p, prevsize);
}
else if ((next->head & INUSE_BITS) == INUSE_BITS) {
fm->dvsize = psize;
set_free_with_pinuse(p, psize, next);
goto postaction;
}
}
else
goto erroraction;
}
}
if (RTCHECK(ok_next(p, next) && ok_pinuse(next))) {
if (!cinuse(next)) { /* consolidate forward */
if (next == fm->top) {
size_t tsize = fm->topsize += psize;
fm->top = p;
p->head = tsize | PINUSE_BIT;
if (p == fm->dv) {
fm->dv = 0;
fm->dvsize = 0;
}
if (should_trim(fm, tsize))
sys_trim(fm, 0);
goto postaction;
}
else if (next == fm->dv) {
size_t dsize = fm->dvsize += psize;
fm->dv = p;
set_size_and_pinuse_of_free_chunk(p, dsize);
goto postaction;
}
else {
size_t nsize = chunksize(next);
psize += nsize;
unlink_chunk(fm, next, nsize);
set_size_and_pinuse_of_free_chunk(p, psize);
if (p == fm->dv) {
fm->dvsize = psize;
goto postaction;
}
}
}
else
set_free_with_pinuse(p, psize, next);
if (is_small(psize)) {
insert_small_chunk(fm, p, psize);
check_free_chunk(fm, p);
}
else {
tchunkptr tp = (tchunkptr)p;
insert_large_chunk(fm, tp, psize);
check_free_chunk(fm, p);
if (--fm->release_checks == 0)
release_unused_segments(fm);
}
goto postaction;
}
}
erroraction:
USAGE_ERROR_ACTION(fm, p);
postaction:
POSTACTION(fm);
}
}
}
void* mspace_calloc(mspace msp, size_t n_elements, size_t elem_size) {
void* mem;
size_t req = 0;
mstate ms = (mstate)msp;
if (!ok_magic(ms)) {
USAGE_ERROR_ACTION(ms, ms);
return 0;
}
if (n_elements != 0) {
req = n_elements * elem_size;
if (((n_elements | elem_size) & ~(size_t)0xffff) &&
(req / n_elements != elem_size))
req = MAX_SIZE_T; /* force downstream failure on overflow */
}
mem = internal_malloc(ms, req);
if (mem != 0 && calloc_must_clear(mem2chunk(mem)))
memset(mem, 0, req);
return mem;
}
void* mspace_realloc(mspace msp, void* oldmem, size_t bytes) {
void* mem = 0;
if (oldmem == 0) {
mem = mspace_malloc(msp, bytes);
}
else if (bytes >= MAX_REQUEST) {
MALLOC_FAILURE_ACTION;
}
#ifdef REALLOC_ZERO_BYTES_FREES
else if (bytes == 0) {
mspace_free(msp, oldmem);
}
#endif /* REALLOC_ZERO_BYTES_FREES */
else {
size_t nb = request2size(bytes);
mchunkptr oldp = mem2chunk(oldmem);
#if ! FOOTERS
mstate m = (mstate)msp;
#else /* FOOTERS */
mstate m = get_mstate_for(oldp);
if (!ok_magic(m)) {
USAGE_ERROR_ACTION(m, oldmem);
return 0;
}
#endif /* FOOTERS */
if (!PREACTION(m)) {
mchunkptr newp = try_realloc_chunk(m, oldp, nb, 1);
POSTACTION(m);
if (newp != 0) {
check_inuse_chunk(m, newp);
mem = chunk2mem(newp);
}
else {
mem = mspace_malloc(m, bytes);
if (mem != 0) {
size_t oc = chunksize(oldp) - overhead_for(oldp);
memcpy(mem, oldmem, (oc < bytes) ? oc : bytes);
mspace_free(m, oldmem);
}
}
}
}
return mem;
}
void* mspace_realloc_in_place(mspace msp, void* oldmem, size_t bytes) {
void* mem = 0;
if (oldmem != 0) {
if (bytes >= MAX_REQUEST) {
MALLOC_FAILURE_ACTION;
}
else {
size_t nb = request2size(bytes);
mchunkptr oldp = mem2chunk(oldmem);
#if ! FOOTERS
mstate m = (mstate)msp;
#else /* FOOTERS */
mstate m = get_mstate_for(oldp);
(void)msp; /* placate people compiling -Wunused */
if (!ok_magic(m)) {
USAGE_ERROR_ACTION(m, oldmem);
return 0;
}
#endif /* FOOTERS */
if (!PREACTION(m)) {
mchunkptr newp = try_realloc_chunk(m, oldp, nb, 0);
POSTACTION(m);
if (newp == oldp) {
check_inuse_chunk(m, newp);
mem = oldmem;
}
}
}
}
return mem;
}
void* mspace_memalign(mspace msp, size_t alignment, size_t bytes) {
mstate ms = (mstate)msp;
if (!ok_magic(ms)) {
USAGE_ERROR_ACTION(ms, ms);
return 0;
}
if (alignment <= MALLOC_ALIGNMENT)
return mspace_malloc(msp, bytes);
return internal_memalign(ms, alignment, bytes);
}
void** mspace_independent_calloc(mspace msp, size_t n_elements,
size_t elem_size, void* chunks[]) {
size_t sz = elem_size; /* serves as 1-element array */
mstate ms = (mstate)msp;
if (!ok_magic(ms)) {
USAGE_ERROR_ACTION(ms, ms);
return 0;
}
return ialloc(ms, n_elements, &sz, 3, chunks);
}
void** mspace_independent_comalloc(mspace msp, size_t n_elements,
size_t sizes[], void* chunks[]) {
mstate ms = (mstate)msp;
if (!ok_magic(ms)) {
USAGE_ERROR_ACTION(ms, ms);
return 0;
}
return ialloc(ms, n_elements, sizes, 0, chunks);
}
size_t mspace_bulk_free(mspace msp, void* array[], size_t nelem) {
return internal_bulk_free((mstate)msp, array, nelem);
}
#if MALLOC_INSPECT_ALL
void mspace_inspect_all(mspace msp,
void(*handler)(void *start,
void *end,
size_t used_bytes,
void* callback_arg),
void* arg) {
mstate ms = (mstate)msp;
if (ok_magic(ms)) {
if (!PREACTION(ms)) {
internal_inspect_all(ms, handler, arg);
POSTACTION(ms);
}
}
else {
USAGE_ERROR_ACTION(ms, ms);
}
}
#endif /* MALLOC_INSPECT_ALL */
int mspace_trim(mspace msp, size_t pad) {
int result = 0;
mstate ms = (mstate)msp;
if (ok_magic(ms)) {
if (!PREACTION(ms)) {
result = sys_trim(ms, pad);
POSTACTION(ms);
}
}
else {
USAGE_ERROR_ACTION(ms, ms);
}
return result;
}
#if !NO_MALLOC_STATS
void mspace_malloc_stats(mspace msp) {
mstate ms = (mstate)msp;
if (ok_magic(ms)) {
internal_malloc_stats(ms);
}
else {
USAGE_ERROR_ACTION(ms, ms);
}
}
#endif /* NO_MALLOC_STATS */
size_t mspace_footprint(mspace msp) {
size_t result = 0;
mstate ms = (mstate)msp;
if (ok_magic(ms)) {
result = ms->footprint;
}
else {
USAGE_ERROR_ACTION(ms, ms);
}
return result;
}
size_t mspace_max_footprint(mspace msp) {
size_t result = 0;
mstate ms = (mstate)msp;
if (ok_magic(ms)) {
result = ms->max_footprint;
}
else {
USAGE_ERROR_ACTION(ms, ms);
}
return result;
}
size_t mspace_footprint_limit(mspace msp) {
size_t result = 0;
mstate ms = (mstate)msp;
if (ok_magic(ms)) {
size_t maf = ms->footprint_limit;
result = (maf == 0) ? MAX_SIZE_T : maf;
}
else {
USAGE_ERROR_ACTION(ms, ms);
}
return result;
}
size_t mspace_set_footprint_limit(mspace msp, size_t bytes) {
size_t result = 0;
mstate ms = (mstate)msp;
if (ok_magic(ms)) {
if (bytes == 0)
result = granularity_align(1); /* Use minimal size */
if (bytes == MAX_SIZE_T)
result = 0; /* disable */
else
result = granularity_align(bytes);
ms->footprint_limit = result;
}
else {
USAGE_ERROR_ACTION(ms, ms);
}
return result;
}
#if !NO_MALLINFO
struct mallinfo mspace_mallinfo(mspace msp) {
mstate ms = (mstate)msp;
if (!ok_magic(ms)) {
USAGE_ERROR_ACTION(ms, ms);
}
return internal_mallinfo(ms);
}
#endif /* NO_MALLINFO */
size_t mspace_usable_size(const void* mem) {
if (mem != 0) {
mchunkptr p = mem2chunk(mem);
if (is_inuse(p))
return chunksize(p) - overhead_for(p);
}
return 0;
}
int mspace_mallopt(int param_number, int value) {
return change_mparam(param_number, value);
}
#endif /* MSPACES */
/* -------------------- Alternative MORECORE functions ------------------- */
/*
Guidelines for creating a custom version of MORECORE:
* For best performance, MORECORE should allocate in multiples of pagesize.
* MORECORE may allocate more memory than requested. (Or even less,
but this will usually result in a malloc failure.)
* MORECORE must not allocate memory when given argument zero, but
instead return one past the end address of memory from previous
nonzero call.
* For best performance, consecutive calls to MORECORE with positive
arguments should return increasing addresses, indicating that
space has been contiguously extended.
* Even though consecutive calls to MORECORE need not return contiguous
addresses, it must be OK for malloc'ed chunks to span multiple
regions in those cases where they do happen to be contiguous.
* MORECORE need not handle negative arguments -- it may instead
just return MFAIL when given negative arguments.
Negative arguments are always multiples of pagesize. MORECORE
must not misinterpret negative args as large positive unsigned
args. You can suppress all such calls from even occurring by defining
MORECORE_CANNOT_TRIM,
As an example alternative MORECORE, here is a custom allocator
kindly contributed for pre-OSX macOS. It uses virtually but not
necessarily physically contiguous non-paged memory (locked in,
present and won't get swapped out). You can use it by uncommenting
this section, adding some #includes, and setting up the appropriate
defines above:
#define MORECORE osMoreCore
There is also a shutdown routine that should somehow be called for
cleanup upon program exit.
#define MAX_POOL_ENTRIES 100
#define MINIMUM_MORECORE_SIZE (64 * 1024U)
static int next_os_pool;
void *our_os_pools[MAX_POOL_ENTRIES];
void *osMoreCore(int size)
{
void *ptr = 0;
static void *sbrk_top = 0;
if (size > 0)
{
if (size < MINIMUM_MORECORE_SIZE)
size = MINIMUM_MORECORE_SIZE;
if (CurrentExecutionLevel() == kTaskLevel)
ptr = PoolAllocateResident(size + RM_PAGE_SIZE, 0);
if (ptr == 0)
{
return (void *) MFAIL;
}
// save ptrs so they can be freed during cleanup
our_os_pools[next_os_pool] = ptr;
next_os_pool++;
ptr = (void *) ((((size_t) ptr) + RM_PAGE_MASK) & ~RM_PAGE_MASK);
sbrk_top = (char *) ptr + size;
return ptr;
}
else if (size < 0)
{
// we don't currently support shrink behavior
return (void *) MFAIL;
}
else
{
return sbrk_top;
}
}
// cleanup any allocated memory pools
// called as last thing before shutting down driver
void osCleanupMem(void)
{
void **ptr;
for (ptr = our_os_pools; ptr < &our_os_pools[MAX_POOL_ENTRIES]; ptr++)
if (*ptr)
{
PoolDeallocate(*ptr);
*ptr = 0;
}
}
*/
/* -----------------------------------------------------------------------
History:
v2.8.6 Wed Aug 29 06:57:58 2012 Doug Lea
* fix bad comparison in dlposix_memalign
* don't reuse adjusted asize in sys_alloc
* add LOCK_AT_FORK -- thanks to Kirill Artamonov for the suggestion
* reduce compiler warnings -- thanks to all who reported/suggested these
v2.8.5 Sun May 22 10:26:02 2011 Doug Lea (dl at gee)
* Always perform unlink checks unless INSECURE
* Add posix_memalign.
* Improve realloc to expand in more cases; expose realloc_in_place.
Thanks to Peter Buhr for the suggestion.
* Add footprint_limit, inspect_all, bulk_free. Thanks
to Barry Hayes and others for the suggestions.
* Internal refactorings to avoid calls while holding locks
* Use non-reentrant locks by default. Thanks to Roland McGrath
for the suggestion.
* Small fixes to mspace_destroy, reset_on_error.
* Various configuration extensions/changes. Thanks
to all who contributed these.
V2.8.4a Thu Apr 28 14:39:43 2011 (dl at gee.cs.oswego.edu)
* Update Creative Commons URL
V2.8.4 Wed May 27 09:56:23 2009 Doug Lea (dl at gee)
* Use zeros instead of prev foot for is_mmapped
* Add mspace_track_large_chunks; thanks to Jean Brouwers
* Fix set_inuse in internal_realloc; thanks to Jean Brouwers
* Fix insufficient sys_alloc padding when using 16byte alignment
* Fix bad error check in mspace_footprint
* Adaptations for ptmalloc; thanks to Wolfram Gloger.
* Reentrant spin locks; thanks to Earl Chew and others
* Win32 improvements; thanks to Niall Douglas and Earl Chew
* Add NO_SEGMENT_TRAVERSAL and MAX_RELEASE_CHECK_RATE options
* Extension hook in malloc_state
* Various small adjustments to reduce warnings on some compilers
* Various configuration extensions/changes for more platforms. Thanks
to all who contributed these.
V2.8.3 Thu Sep 22 11:16:32 2005 Doug Lea (dl at gee)
* Add max_footprint functions
* Ensure all appropriate literals are size_t
* Fix conditional compilation problem for some #define settings
* Avoid concatenating segments with the one provided
in create_mspace_with_base
* Rename some variables to avoid compiler shadowing warnings
* Use explicit lock initialization.
* Better handling of sbrk interference.
* Simplify and fix segment insertion, trimming and mspace_destroy
* Reinstate REALLOC_ZERO_BYTES_FREES option from 2.7.x
* Thanks especially to Dennis Flanagan for help on these.
V2.8.2 Sun Jun 12 16:01:10 2005 Doug Lea (dl at gee)
* Fix memalign brace error.
V2.8.1 Wed Jun 8 16:11:46 2005 Doug Lea (dl at gee)
* Fix improper #endif nesting in C++
* Add explicit casts needed for C++
V2.8.0 Mon May 30 14:09:02 2005 Doug Lea (dl at gee)
* Use trees for large bins
* Support mspaces
* Use segments to unify sbrk-based and mmap-based system allocation,
removing need for emulation on most platforms without sbrk.
* Default safety checks
* Optional footer checks. Thanks to William Robertson for the idea.
* Internal code refactoring
* Incorporate suggestions and platform-specific changes.
Thanks to Dennis Flanagan, Colin Plumb, Niall Douglas,
Aaron Bachmann, Emery Berger, and others.
* Speed up non-fastbin processing enough to remove fastbins.
* Remove useless cfree() to avoid conflicts with other apps.
* Remove internal memcpy, memset. Compilers handle builtins better.
* Remove some options that no one ever used and rename others.
V2.7.2 Sat Aug 17 09:07:30 2002 Doug Lea (dl at gee)
* Fix malloc_state bitmap array misdeclaration
V2.7.1 Thu Jul 25 10:58:03 2002 Doug Lea (dl at gee)
* Allow tuning of FIRST_SORTED_BIN_SIZE
* Use PTR_UINT as type for all ptr->int casts. Thanks to John Belmonte.
* Better detection and support for non-contiguousness of MORECORE.
Thanks to Andreas Mueller, Conal Walsh, and Wolfram Gloger
* Bypass most of malloc if no frees. Thanks To Emery Berger.
* Fix freeing of old top non-contiguous chunk im sysmalloc.
* Raised default trim and map thresholds to 256K.
* Fix mmap-related #defines. Thanks to Lubos Lunak.
* Fix copy macros; added LACKS_FCNTL_H. Thanks to Neal Walfield.
* Branch-free bin calculation
* Default trim and mmap thresholds now 256K.
V2.7.0 Sun Mar 11 14:14:06 2001 Doug Lea (dl at gee)
* Introduce independent_comalloc and independent_calloc.
Thanks to Michael Pachos for motivation and help.
* Make optional .h file available
* Allow > 2GB requests on 32bit systems.
* new WIN32 sbrk, mmap, munmap, lock code from <[email protected]>.
Thanks also to Andreas Mueller <a.mueller at paradatec.de>,
and Anonymous.
* Allow override of MALLOC_ALIGNMENT (Thanks to Ruud Waij for
helping test this.)
* memalign: check alignment arg
* realloc: don't try to shift chunks backwards, since this
leads to more fragmentation in some programs and doesn't
seem to help in any others.
* Collect all cases in malloc requiring system memory into sysmalloc
* Use mmap as backup to sbrk
* Place all internal state in malloc_state
* Introduce fastbins (although similar to 2.5.1)
* Many minor tunings and cosmetic improvements
* Introduce USE_PUBLIC_MALLOC_WRAPPERS, USE_MALLOC_LOCK
* Introduce MALLOC_FAILURE_ACTION, MORECORE_CONTIGUOUS
Thanks to Tony E. Bennett <[email protected]> and others.
* Include errno.h to support default failure action.
V2.6.6 Sun Dec 5 07:42:19 1999 Doug Lea (dl at gee)
* return null for negative arguments
* Added Several WIN32 cleanups from Martin C. Fong <mcfong at yahoo.com>
* Add 'LACKS_SYS_PARAM_H' for those systems without 'sys/param.h'
(e.g. WIN32 platforms)
* Cleanup header file inclusion for WIN32 platforms
* Cleanup code to avoid Microsoft Visual C++ compiler complaints
* Add 'USE_DL_PREFIX' to quickly allow co-existence with existing
memory allocation routines
* Set 'malloc_getpagesize' for WIN32 platforms (needs more work)
* Use 'assert' rather than 'ASSERT' in WIN32 code to conform to
usage of 'assert' in non-WIN32 code
* Improve WIN32 'sbrk()' emulation's 'findRegion()' routine to
avoid infinite loop
* Always call 'fREe()' rather than 'free()'
V2.6.5 Wed Jun 17 15:57:31 1998 Doug Lea (dl at gee)
* Fixed ordering problem with boundary-stamping
V2.6.3 Sun May 19 08:17:58 1996 Doug Lea (dl at gee)
* Added pvalloc, as recommended by H.J. Liu
* Added 64bit pointer support mainly from Wolfram Gloger
* Added anonymously donated WIN32 sbrk emulation
* Malloc, calloc, getpagesize: add optimizations from Raymond Nijssen
* malloc_extend_top: fix mask error that caused wastage after
foreign sbrks
* Add linux mremap support code from HJ Liu
V2.6.2 Tue Dec 5 06:52:55 1995 Doug Lea (dl at gee)
* Integrated most documentation with the code.
* Add support for mmap, with help from
Wolfram Gloger ([email protected]).
* Use last_remainder in more cases.
* Pack bins using idea from [email protected]
* Use ordered bins instead of best-fit threshhold
* Eliminate block-local decls to simplify tracing and debugging.
* Support another case of realloc via move into top
* Fix error occuring when initial sbrk_base not word-aligned.
* Rely on page size for units instead of SBRK_UNIT to
avoid surprises about sbrk alignment conventions.
* Add mallinfo, mallopt. Thanks to Raymond Nijssen
([email protected]) for the suggestion.
* Add `pad' argument to malloc_trim and top_pad mallopt parameter.
* More precautions for cases where other routines call sbrk,
courtesy of Wolfram Gloger ([email protected]).
* Added macros etc., allowing use in linux libc from
H.J. Lu ([email protected])
* Inverted this history list
V2.6.1 Sat Dec 2 14:10:57 1995 Doug Lea (dl at gee)
* Re-tuned and fixed to behave more nicely with V2.6.0 changes.
* Removed all preallocation code since under current scheme
the work required to undo bad preallocations exceeds
the work saved in good cases for most test programs.
* No longer use return list or unconsolidated bins since
no scheme using them consistently outperforms those that don't
given above changes.
* Use best fit for very large chunks to prevent some worst-cases.
* Added some support for debugging
V2.6.0 Sat Nov 4 07:05:23 1995 Doug Lea (dl at gee)
* Removed footers when chunks are in use. Thanks to
Paul Wilson ([email protected]) for the suggestion.
V2.5.4 Wed Nov 1 07:54:51 1995 Doug Lea (dl at gee)
* Added malloc_trim, with help from Wolfram Gloger
([email protected]).
V2.5.3 Tue Apr 26 10:16:01 1994 Doug Lea (dl at g)
V2.5.2 Tue Apr 5 16:20:40 1994 Doug Lea (dl at g)
* realloc: try to expand in both directions
* malloc: swap order of clean-bin strategy;
* realloc: only conditionally expand backwards
* Try not to scavenge used bins
* Use bin counts as a guide to preallocation
* Occasionally bin return list chunks in first scan
* Add a few optimizations from [email protected]
V2.5.1 Sat Aug 14 15:40:43 1993 Doug Lea (dl at g)
* faster bin computation & slightly different binning
* merged all consolidations to one part of malloc proper
(eliminating old malloc_find_space & malloc_clean_bin)
* Scan 2 returns chunks (not just 1)
* Propagate failure in realloc if malloc returns 0
* Add stuff to allow compilation on non-ANSI compilers
from [email protected]
V2.5 Sat Aug 7 07:41:59 1993 Doug Lea (dl at g.oswego.edu)
* removed potential for odd address access in prev_chunk
* removed dependency on getpagesize.h
* misc cosmetics and a bit more internal documentation
* anticosmetics: mangled names in macros to evade debugger strangeness
* tested on sparc, hp-700, dec-mips, rs6000
with gcc & native cc (hp, dec only) allowing
Detlefs & Zorn comparison study (in SIGPLAN Notices.)
Trial version Fri Aug 28 13:14:29 1992 Doug Lea (dl at g.oswego.edu)
* Based loosely on libg++-1.2X malloc. (It retains some of the overall
structure of old version, but most details differ.)
*/
|
the_stack_data/64956.c | /*
* $Id: guage.c,v 1.76 2018/06/21 08:23:43 tom Exp $
*
* guage.c -- implements the gauge dialog
*
* Copyright 2000-2015,2018 Thomas E. Dickey
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License, version 2.1
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to
* Free Software Foundation, Inc.
* 51 Franklin St., Fifth Floor
* Boston, MA 02110, USA.
*
* An earlier version of this program lists as authors
* Marc Ewing, Red Hat Software
*/
#include <dialog.h>
#include <errno.h>
#define MY_LEN (MAX_LEN)/2
#define MIN_HIGH (4)
#define MIN_WIDE (10 + 2 * (2 + MARGIN))
#define isMarker(buf) !strncmp(buf, "XXX", (size_t) 3)
typedef struct _my_obj {
DIALOG_CALLBACK obj; /* has to be first in struct */
struct _my_obj *next;
WINDOW *text;
char *title;
char *prompt;
char prompt_buf[MY_LEN];
int percent;
int height;
int width;
char line[MAX_LEN + 1];
} MY_OBJ;
static MY_OBJ *all_objects;
static int
valid(MY_OBJ * obj)
{
MY_OBJ *list = all_objects;
int result = 0;
while (list != 0) {
if (list == obj) {
result = 1;
break;
}
list = list->next;
}
return result;
}
static void
delink(MY_OBJ * obj)
{
MY_OBJ *p = all_objects;
MY_OBJ *q = 0;
while (p != 0) {
if (p == obj) {
if (q != 0) {
q->next = p->next;
} else {
all_objects = p->next;
}
break;
}
q = p;
p = p->next;
}
}
static int
read_data(char *buffer, FILE *fp)
{
int result;
if (feof(fp)) {
result = 0;
} else if (fgets(buffer, MY_LEN, fp) != 0) {
DLG_TRACE(("read_data:%s", buffer));
buffer[MY_LEN] = '\0';
dlg_trim_string(buffer);
result = 1;
} else {
result = -1;
}
return result;
}
static int
decode_percent(char *buffer)
{
char *tmp = 0;
long value = strtol(buffer, &tmp, 10);
if (tmp != 0 && (*tmp == 0 || isspace(UCH(*tmp))) && value >= 0) {
return TRUE;
}
return FALSE;
}
static void
repaint_text(MY_OBJ * obj)
{
WINDOW *dialog = obj->obj.win;
int i, x;
if (dialog != 0) {
(void) werase(dialog);
dlg_draw_box2(dialog, 0, 0, obj->height, obj->width, dialog_attr,
border_attr, border2_attr);
dlg_draw_title(dialog, obj->title);
dlg_attrset(dialog, dialog_attr);
dlg_draw_helpline(dialog, FALSE);
dlg_print_autowrap(dialog, obj->prompt, obj->height, obj->width);
dlg_draw_box2(dialog,
obj->height - 4, 2 + MARGIN,
2 + MARGIN, obj->width - 2 * (2 + MARGIN),
dialog_attr,
border_attr,
border2_attr);
/*
* Clear the area for the progress bar by filling it with spaces
* in the gauge-attribute, and write the percentage with that
* attribute.
*/
(void) wmove(dialog, obj->height - 3, 4);
dlg_attrset(dialog, gauge_attr);
for (i = 0; i < (obj->width - 2 * (3 + MARGIN)); i++)
(void) waddch(dialog, ' ');
(void) wmove(dialog, obj->height - 3, (obj->width / 2) - 2);
(void) wprintw(dialog, "%3d%%", obj->percent);
/*
* Now draw a bar in reverse, relative to the background.
* The window attribute was useful for painting the background,
* but requires some tweaks to reverse it.
*/
x = (obj->percent * (obj->width - 2 * (3 + MARGIN))) / 100;
if ((gauge_attr & A_REVERSE) != 0) {
dlg_attroff(dialog, A_REVERSE);
} else {
dlg_attrset(dialog, A_REVERSE);
}
(void) wmove(dialog, obj->height - 3, 4);
for (i = 0; i < x; i++) {
chtype ch2 = winch(dialog);
if (gauge_attr & A_REVERSE) {
ch2 &= ~A_REVERSE;
}
(void) waddch(dialog, ch2);
}
(void) wrefresh(dialog);
}
}
static bool
handle_input(DIALOG_CALLBACK * cb)
{
MY_OBJ *obj = (MY_OBJ *) cb;
bool result;
bool cleanup = FALSE;
int status;
char buf[MY_LEN + 1];
if (dialog_state.pipe_input == 0) {
status = -1;
cleanup = TRUE;
} else if ((status = read_data(buf, dialog_state.pipe_input)) > 0) {
if (isMarker(buf)) {
/*
* Historically, next line should be percentage, but one of the
* worse-written clones of 'dialog' assumes the number is missing.
* (Gresham's Law applied to software).
*/
if ((status = read_data(buf, dialog_state.pipe_input)) > 0) {
obj->prompt_buf[0] = '\0';
if (decode_percent(buf))
obj->percent = atoi(buf);
else
strcpy(obj->prompt_buf, buf);
/* Rest is message text */
while ((status = read_data(buf, dialog_state.pipe_input)) > 0
&& !isMarker(buf)) {
if (strlen(obj->prompt_buf) + strlen(buf) <
sizeof(obj->prompt_buf) - 1) {
strcat(obj->prompt_buf, buf);
}
}
if (obj->prompt != obj->prompt_buf)
free(obj->prompt);
obj->prompt = obj->prompt_buf;
}
} else if (decode_percent(buf)) {
obj->percent = atoi(buf);
}
} else {
if (feof(dialog_state.pipe_input) ||
(ferror(dialog_state.pipe_input) && errno != EINTR)) {
cleanup = TRUE;
}
}
repaint_text(obj);
if (status > 0) {
result = TRUE;
} else {
result = FALSE;
if (cleanup) {
dlg_remove_callback(cb);
delink(obj);
}
}
return result;
}
static bool
handle_my_getc(DIALOG_CALLBACK * cb, int ch, int fkey, int *result)
{
bool status = TRUE;
*result = DLG_EXIT_OK;
if (cb != 0) {
if (!fkey && (ch == ERR)) {
(void) handle_input(cb);
/* cb might be freed in handle_input */
status = (valid((MY_OBJ *) cb) && (cb->input != 0));
}
} else {
status = FALSE;
}
return status;
}
static void
my_cleanup(DIALOG_CALLBACK * cb)
{
MY_OBJ *obj = (MY_OBJ *) cb;
if (valid(obj)) {
if (obj->prompt != obj->prompt_buf) {
free(obj->prompt);
obj->prompt = obj->prompt_buf;
}
free(obj->title);
dlg_del_window(obj->obj.win);
delink(obj);
}
}
void
dlg_update_gauge(void *objptr, int percent)
{
MY_OBJ *obj = (MY_OBJ *) objptr;
bool save_finish_string = dialog_state.finish_string;
dialog_state.finish_string = TRUE;
curs_set(0);
obj->percent = percent;
repaint_text(obj);
dialog_state.finish_string = save_finish_string;
}
/*
* (Re)Allocates an object and fills it as per the arguments
*/
void *
dlg_reallocate_gauge(void *objptr,
const char *title,
const char *cprompt,
int height,
int width,
int percent)
{
char *prompt = dlg_strclone(cprompt);
MY_OBJ *obj = objptr;
bool save_finish_string = dialog_state.finish_string;
dialog_state.finish_string = TRUE;
dlg_tab_correct_str(prompt);
if (objptr == 0) {
/* create a new object */
obj = dlg_calloc(MY_OBJ, 1);
assert_ptr(obj, "dialog_gauge");
dlg_auto_size(title, prompt, &height, &width, MIN_HIGH, MIN_WIDE);
dlg_print_size(height, width);
dlg_ctl_size(height, width);
} else {
/* reuse an existing object */
obj = objptr;
height = obj->height;
width = obj->width;
}
if (obj->obj.win == 0) {
/* center dialog box on screen */
int x = dlg_box_x_ordinate(width);
int y = dlg_box_y_ordinate(height);
WINDOW *dialog = dlg_new_window(height, width, y, x);
obj->obj.win = dialog;
}
obj->obj.input = dialog_state.pipe_input;
obj->obj.keep_win = TRUE;
obj->obj.bg_task = TRUE;
obj->obj.handle_getc = handle_my_getc;
obj->obj.handle_input = handle_input;
if (obj->title == 0 || strcmp(obj->title, title)) {
dlg_finish_string(obj->title);
free(obj->title);
obj->title = dlg_strclone(title);
}
dlg_finish_string(obj->prompt);
free(obj->prompt);
obj->prompt = prompt;
obj->percent = percent;
obj->height = height;
obj->width = width;
/* if this was a new object, link it into the list */
if (objptr == 0) {
obj->next = all_objects;
all_objects = obj;
}
dialog_state.finish_string = save_finish_string;
return (void *) obj;
}
void *
dlg_allocate_gauge(const char *title,
const char *cprompt,
int height,
int width,
int percent)
{
return dlg_reallocate_gauge(NULL, title, cprompt, height, width, percent);
}
void
dlg_free_gauge(void *objptr)
{
MY_OBJ *obj = (MY_OBJ *) objptr;
if (valid(obj)) {
obj->obj.keep_win = FALSE;
dlg_remove_callback(&(obj->obj));
delink(obj);
}
curs_set(1);
}
/*
* Display a gauge, or progress meter. Starts at percent% and reads stdin. If
* stdin is not XXX, then it is interpreted as a percentage, and the display is
* updated accordingly. Otherwise the next line is the percentage, and
* subsequent lines up to another XXX are used for the new prompt. Note that
* the size of the window never changes, so the prompt can not get any larger
* than the height and width specified.
*/
int
dialog_gauge(const char *title,
const char *cprompt,
int height,
int width,
int percent)
{
int fkey;
int ch, result;
void *objptr = dlg_allocate_gauge(title, cprompt, height, width, percent);
MY_OBJ *obj = (MY_OBJ *) objptr;
DLG_TRACE(("# gauge args:\n"));
DLG_TRACE2S("title", title);
DLG_TRACE2S("message", cprompt);
DLG_TRACE2N("height", height);
DLG_TRACE2N("width", width);
DLG_TRACE2N("percent", percent);
dlg_add_callback_ref((DIALOG_CALLBACK **) & obj, my_cleanup);
dlg_update_gauge(obj, percent);
dlg_trace_win(obj->obj.win);
do {
ch = dlg_getc(obj->obj.win, &fkey);
#ifdef KEY_RESIZE
if (fkey && ch == KEY_RESIZE) {
MY_OBJ *oldobj = obj;
dlg_will_resize(obj->obj.win);
dlg_mouse_free_regions();
obj = dlg_allocate_gauge(title,
cprompt,
height,
width,
oldobj->percent);
/* avoid breaking new window in dlg_remove_callback */
oldobj->obj.caller = 0;
oldobj->obj.input = 0;
oldobj->obj.keep_win = FALSE;
/* remove the old version of the gauge */
dlg_clear();
dlg_remove_callback(&(oldobj->obj));
refresh();
dlg_add_callback_ref((DIALOG_CALLBACK **) & obj, my_cleanup);
dlg_update_gauge(obj, obj->percent);
}
#endif
}
while (valid(obj) && handle_my_getc(&(obj->obj), ch, fkey, &result));
dlg_free_gauge(obj);
return (DLG_EXIT_OK);
}
|
the_stack_data/1054247.c | int singleNumber(int *nums, int numsSize)
{
int i, result = 0;
for (i = 0; i < numsSize; i++) result = result ^ nums[i];
return result;
}
|
the_stack_data/168891856.c | int __VERIFIER_nondet();
void __VERIFIER_assume();
int main (){
int a, x;
x = __VERIFIER_nondet();
/* a = 34; */
__VERIFIER_assume(a>0);
while (x>0){
a--;
x=x&a;
}
return 0;
}
|
the_stack_data/1214015.c | /**
******************************************************************************
* @file stm32f4xx_ll_adc.c
* @author MCD Application Team
* @version V1.7.1
* @date 14-April-2017
* @brief ADC LL module driver
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
#if defined(USE_FULL_LL_DRIVER)
/* Includes ------------------------------------------------------------------*/
#include "stm32f4xx_ll_adc.h"
#include "stm32f4xx_ll_bus.h"
#ifdef USE_FULL_ASSERT
#include "stm32_assert.h"
#else
#define assert_param(expr) ((void)0U)
#endif
/** @addtogroup STM32F4xx_LL_Driver
* @{
*/
#if defined (ADC1) || defined (ADC2) || defined (ADC3)
/** @addtogroup ADC_LL ADC
* @{
*/
/* Private types -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private constants ---------------------------------------------------------*/
/* Private macros ------------------------------------------------------------*/
/** @addtogroup ADC_LL_Private_Macros
* @{
*/
/* Check of parameters for configuration of ADC hierarchical scope: */
/* common to several ADC instances. */
#define IS_LL_ADC_COMMON_CLOCK(__CLOCK__) \
( ((__CLOCK__) == LL_ADC_CLOCK_SYNC_PCLK_DIV2) \
|| ((__CLOCK__) == LL_ADC_CLOCK_SYNC_PCLK_DIV4) \
|| ((__CLOCK__) == LL_ADC_CLOCK_SYNC_PCLK_DIV6) \
|| ((__CLOCK__) == LL_ADC_CLOCK_SYNC_PCLK_DIV8) \
)
/* Check of parameters for configuration of ADC hierarchical scope: */
/* ADC instance. */
#define IS_LL_ADC_RESOLUTION(__RESOLUTION__) \
( ((__RESOLUTION__) == LL_ADC_RESOLUTION_12B) \
|| ((__RESOLUTION__) == LL_ADC_RESOLUTION_10B) \
|| ((__RESOLUTION__) == LL_ADC_RESOLUTION_8B) \
|| ((__RESOLUTION__) == LL_ADC_RESOLUTION_6B) \
)
#define IS_LL_ADC_DATA_ALIGN(__DATA_ALIGN__) \
( ((__DATA_ALIGN__) == LL_ADC_DATA_ALIGN_RIGHT) \
|| ((__DATA_ALIGN__) == LL_ADC_DATA_ALIGN_LEFT) \
)
#define IS_LL_ADC_SCAN_SELECTION(__SCAN_SELECTION__) \
( ((__SCAN_SELECTION__) == LL_ADC_SEQ_SCAN_DISABLE) \
|| ((__SCAN_SELECTION__) == LL_ADC_SEQ_SCAN_ENABLE) \
)
#define IS_LL_ADC_SEQ_SCAN_MODE(__SEQ_SCAN_MODE__) \
( ((__SCAN_MODE__) == LL_ADC_SEQ_SCAN_DISABLE) \
|| ((__SCAN_MODE__) == LL_ADC_SEQ_SCAN_ENABLE) \
)
/* Check of parameters for configuration of ADC hierarchical scope: */
/* ADC group regular */
#define IS_LL_ADC_REG_TRIG_SOURCE(__REG_TRIG_SOURCE__) \
( ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_SOFTWARE) \
|| ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM1_CH1) \
|| ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM1_CH2) \
|| ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM1_CH3) \
|| ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM2_CH2) \
|| ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM2_CH3) \
|| ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM2_CH4) \
|| ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM2_TRGO) \
|| ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM3_CH1) \
|| ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM3_TRGO) \
|| ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM4_CH4) \
|| ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM5_CH1) \
|| ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM5_CH2) \
|| ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM5_CH3) \
|| ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM8_CH1) \
|| ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM8_TRGO) \
|| ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_EXTI_LINE11) \
)
#define IS_LL_ADC_REG_CONTINUOUS_MODE(__REG_CONTINUOUS_MODE__) \
( ((__REG_CONTINUOUS_MODE__) == LL_ADC_REG_CONV_SINGLE) \
|| ((__REG_CONTINUOUS_MODE__) == LL_ADC_REG_CONV_CONTINUOUS) \
)
#define IS_LL_ADC_REG_DMA_TRANSFER(__REG_DMA_TRANSFER__) \
( ((__REG_DMA_TRANSFER__) == LL_ADC_REG_DMA_TRANSFER_NONE) \
|| ((__REG_DMA_TRANSFER__) == LL_ADC_REG_DMA_TRANSFER_LIMITED) \
|| ((__REG_DMA_TRANSFER__) == LL_ADC_REG_DMA_TRANSFER_UNLIMITED) \
)
#define IS_LL_ADC_REG_FLAG_EOC_SELECTION(__REG_FLAG_EOC_SELECTION__) \
( ((__REG_FLAG_EOC_SELECTION__) == LL_ADC_REG_FLAG_EOC_SEQUENCE_CONV) \
|| ((__REG_FLAG_EOC_SELECTION__) == LL_ADC_REG_FLAG_EOC_UNITARY_CONV) \
)
#define IS_LL_ADC_REG_SEQ_SCAN_LENGTH(__REG_SEQ_SCAN_LENGTH__) \
( ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_DISABLE) \
|| ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_2RANKS) \
|| ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_3RANKS) \
|| ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_4RANKS) \
|| ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_5RANKS) \
|| ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_6RANKS) \
|| ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_7RANKS) \
|| ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_8RANKS) \
|| ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_9RANKS) \
|| ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_10RANKS) \
|| ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_11RANKS) \
|| ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_12RANKS) \
|| ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_13RANKS) \
|| ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_14RANKS) \
|| ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_15RANKS) \
|| ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_16RANKS) \
)
#define IS_LL_ADC_REG_SEQ_SCAN_DISCONT_MODE(__REG_SEQ_DISCONT_MODE__) \
( ((__REG_SEQ_DISCONT_MODE__) == LL_ADC_REG_SEQ_DISCONT_DISABLE) \
|| ((__REG_SEQ_DISCONT_MODE__) == LL_ADC_REG_SEQ_DISCONT_1RANK) \
|| ((__REG_SEQ_DISCONT_MODE__) == LL_ADC_REG_SEQ_DISCONT_2RANKS) \
|| ((__REG_SEQ_DISCONT_MODE__) == LL_ADC_REG_SEQ_DISCONT_3RANKS) \
|| ((__REG_SEQ_DISCONT_MODE__) == LL_ADC_REG_SEQ_DISCONT_4RANKS) \
|| ((__REG_SEQ_DISCONT_MODE__) == LL_ADC_REG_SEQ_DISCONT_5RANKS) \
|| ((__REG_SEQ_DISCONT_MODE__) == LL_ADC_REG_SEQ_DISCONT_6RANKS) \
|| ((__REG_SEQ_DISCONT_MODE__) == LL_ADC_REG_SEQ_DISCONT_7RANKS) \
|| ((__REG_SEQ_DISCONT_MODE__) == LL_ADC_REG_SEQ_DISCONT_8RANKS) \
)
/* Check of parameters for configuration of ADC hierarchical scope: */
/* ADC group injected */
#define IS_LL_ADC_INJ_TRIG_SOURCE(__INJ_TRIG_SOURCE__) \
( ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_SOFTWARE) \
|| ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM1_CH4) \
|| ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM1_TRGO) \
|| ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM2_CH1) \
|| ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM2_TRGO) \
|| ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM3_CH2) \
|| ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM3_CH4) \
|| ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM4_CH1) \
|| ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM4_CH2) \
|| ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM4_CH3) \
|| ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM4_TRGO) \
|| ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM5_CH4) \
|| ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM5_TRGO) \
|| ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM8_CH2) \
|| ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM8_CH3) \
|| ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_TIM8_CH4) \
|| ((__INJ_TRIG_SOURCE__) == LL_ADC_INJ_TRIG_EXT_EXTI_LINE15) \
)
#define IS_LL_ADC_INJ_TRIG_EXT_EDGE(__INJ_TRIG_EXT_EDGE__) \
( ((__INJ_TRIG_EXT_EDGE__) == LL_ADC_INJ_TRIG_EXT_RISING) \
|| ((__INJ_TRIG_EXT_EDGE__) == LL_ADC_INJ_TRIG_EXT_FALLING) \
|| ((__INJ_TRIG_EXT_EDGE__) == LL_ADC_INJ_TRIG_EXT_RISINGFALLING) \
)
#define IS_LL_ADC_INJ_TRIG_AUTO(__INJ_TRIG_AUTO__) \
( ((__INJ_TRIG_AUTO__) == LL_ADC_INJ_TRIG_INDEPENDENT) \
|| ((__INJ_TRIG_AUTO__) == LL_ADC_INJ_TRIG_FROM_GRP_REGULAR) \
)
#define IS_LL_ADC_INJ_SEQ_SCAN_LENGTH(__INJ_SEQ_SCAN_LENGTH__) \
( ((__INJ_SEQ_SCAN_LENGTH__) == LL_ADC_INJ_SEQ_SCAN_DISABLE) \
|| ((__INJ_SEQ_SCAN_LENGTH__) == LL_ADC_INJ_SEQ_SCAN_ENABLE_2RANKS) \
|| ((__INJ_SEQ_SCAN_LENGTH__) == LL_ADC_INJ_SEQ_SCAN_ENABLE_3RANKS) \
|| ((__INJ_SEQ_SCAN_LENGTH__) == LL_ADC_INJ_SEQ_SCAN_ENABLE_4RANKS) \
)
#define IS_LL_ADC_INJ_SEQ_SCAN_DISCONT_MODE(__INJ_SEQ_DISCONT_MODE__) \
( ((__INJ_SEQ_DISCONT_MODE__) == LL_ADC_INJ_SEQ_DISCONT_DISABLE) \
|| ((__INJ_SEQ_DISCONT_MODE__) == LL_ADC_INJ_SEQ_DISCONT_1RANK) \
)
#if defined(ADC_MULTIMODE_SUPPORT)
/* Check of parameters for configuration of ADC hierarchical scope: */
/* multimode. */
#if defined(ADC3)
#define IS_LL_ADC_MULTI_MODE(__MULTI_MODE__) \
( ((__MULTI_MODE__) == LL_ADC_MULTI_INDEPENDENT) \
|| ((__MULTI_MODE__) == LL_ADC_MULTI_DUAL_REG_SIMULT) \
|| ((__MULTI_MODE__) == LL_ADC_MULTI_DUAL_REG_INTERL) \
|| ((__MULTI_MODE__) == LL_ADC_MULTI_DUAL_INJ_SIMULT) \
|| ((__MULTI_MODE__) == LL_ADC_MULTI_DUAL_INJ_ALTERN) \
|| ((__MULTI_MODE__) == LL_ADC_MULTI_DUAL_REG_SIM_INJ_SIM) \
|| ((__MULTI_MODE__) == LL_ADC_MULTI_DUAL_REG_SIM_INJ_ALT) \
|| ((__MULTI_MODE__) == LL_ADC_MULTI_DUAL_REG_INT_INJ_SIM) \
|| ((__MULTI_MODE__) == LL_ADC_MULTI_TRIPLE_REG_SIM_INJ_SIM) \
|| ((__MULTI_MODE__) == LL_ADC_MULTI_TRIPLE_REG_SIM_INJ_ALT) \
|| ((__MULTI_MODE__) == LL_ADC_MULTI_TRIPLE_INJ_SIMULT) \
|| ((__MULTI_MODE__) == LL_ADC_MULTI_TRIPLE_REG_SIMULT) \
|| ((__MULTI_MODE__) == LL_ADC_MULTI_TRIPLE_REG_INTERL) \
|| ((__MULTI_MODE__) == LL_ADC_MULTI_TRIPLE_INJ_ALTERN) \
)
#else
#define IS_LL_ADC_MULTI_MODE(__MULTI_MODE__) \
( ((__MULTI_MODE__) == LL_ADC_MULTI_INDEPENDENT) \
|| ((__MULTI_MODE__) == LL_ADC_MULTI_DUAL_REG_SIMULT) \
|| ((__MULTI_MODE__) == LL_ADC_MULTI_DUAL_REG_INTERL) \
|| ((__MULTI_MODE__) == LL_ADC_MULTI_DUAL_INJ_SIMULT) \
|| ((__MULTI_MODE__) == LL_ADC_MULTI_DUAL_INJ_ALTERN) \
|| ((__MULTI_MODE__) == LL_ADC_MULTI_DUAL_REG_SIM_INJ_SIM) \
|| ((__MULTI_MODE__) == LL_ADC_MULTI_DUAL_REG_SIM_INJ_ALT) \
|| ((__MULTI_MODE__) == LL_ADC_MULTI_DUAL_REG_INT_INJ_SIM) \
)
#endif
#define IS_LL_ADC_MULTI_DMA_TRANSFER(__MULTI_DMA_TRANSFER__) \
( ((__MULTI_DMA_TRANSFER__) == LL_ADC_MULTI_REG_DMA_EACH_ADC) \
|| ((__MULTI_DMA_TRANSFER__) == LL_ADC_MULTI_REG_DMA_LIMIT_1) \
|| ((__MULTI_DMA_TRANSFER__) == LL_ADC_MULTI_REG_DMA_LIMIT_2) \
|| ((__MULTI_DMA_TRANSFER__) == LL_ADC_MULTI_REG_DMA_LIMIT_3) \
|| ((__MULTI_DMA_TRANSFER__) == LL_ADC_MULTI_REG_DMA_UNLMT_1) \
|| ((__MULTI_DMA_TRANSFER__) == LL_ADC_MULTI_REG_DMA_UNLMT_2) \
|| ((__MULTI_DMA_TRANSFER__) == LL_ADC_MULTI_REG_DMA_UNLMT_3) \
)
#define IS_LL_ADC_MULTI_TWOSMP_DELAY(__MULTI_TWOSMP_DELAY__) \
( ((__MULTI_TWOSMP_DELAY__) == LL_ADC_MULTI_TWOSMP_DELAY_5CYCLES) \
|| ((__MULTI_TWOSMP_DELAY__) == LL_ADC_MULTI_TWOSMP_DELAY_6CYCLES) \
|| ((__MULTI_TWOSMP_DELAY__) == LL_ADC_MULTI_TWOSMP_DELAY_7CYCLES) \
|| ((__MULTI_TWOSMP_DELAY__) == LL_ADC_MULTI_TWOSMP_DELAY_8CYCLES) \
|| ((__MULTI_TWOSMP_DELAY__) == LL_ADC_MULTI_TWOSMP_DELAY_9CYCLES) \
|| ((__MULTI_TWOSMP_DELAY__) == LL_ADC_MULTI_TWOSMP_DELAY_10CYCLES) \
|| ((__MULTI_TWOSMP_DELAY__) == LL_ADC_MULTI_TWOSMP_DELAY_11CYCLES) \
|| ((__MULTI_TWOSMP_DELAY__) == LL_ADC_MULTI_TWOSMP_DELAY_12CYCLES) \
|| ((__MULTI_TWOSMP_DELAY__) == LL_ADC_MULTI_TWOSMP_DELAY_13CYCLES) \
|| ((__MULTI_TWOSMP_DELAY__) == LL_ADC_MULTI_TWOSMP_DELAY_14CYCLES) \
|| ((__MULTI_TWOSMP_DELAY__) == LL_ADC_MULTI_TWOSMP_DELAY_15CYCLES) \
|| ((__MULTI_TWOSMP_DELAY__) == LL_ADC_MULTI_TWOSMP_DELAY_16CYCLES) \
|| ((__MULTI_TWOSMP_DELAY__) == LL_ADC_MULTI_TWOSMP_DELAY_17CYCLES) \
|| ((__MULTI_TWOSMP_DELAY__) == LL_ADC_MULTI_TWOSMP_DELAY_18CYCLES) \
|| ((__MULTI_TWOSMP_DELAY__) == LL_ADC_MULTI_TWOSMP_DELAY_19CYCLES) \
|| ((__MULTI_TWOSMP_DELAY__) == LL_ADC_MULTI_TWOSMP_DELAY_20CYCLES) \
)
#define IS_LL_ADC_MULTI_MASTER_SLAVE(__MULTI_MASTER_SLAVE__) \
( ((__MULTI_MASTER_SLAVE__) == LL_ADC_MULTI_MASTER) \
|| ((__MULTI_MASTER_SLAVE__) == LL_ADC_MULTI_SLAVE) \
|| ((__MULTI_MASTER_SLAVE__) == LL_ADC_MULTI_MASTER_SLAVE) \
)
#endif /* ADC_MULTIMODE_SUPPORT */
/**
* @}
*/
/* Private function prototypes -----------------------------------------------*/
/* Exported functions --------------------------------------------------------*/
/** @addtogroup ADC_LL_Exported_Functions
* @{
*/
/** @addtogroup ADC_LL_EF_Init
* @{
*/
/**
* @brief De-initialize registers of all ADC instances belonging to
* the same ADC common instance to their default reset values.
* @param ADCxy_COMMON ADC common instance
* (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
* @retval An ErrorStatus enumeration value:
* - SUCCESS: ADC common registers are de-initialized
* - ERROR: not applicable
*/
ErrorStatus LL_ADC_CommonDeInit(ADC_Common_TypeDef *ADCxy_COMMON)
{
/* Check the parameters */
assert_param(IS_ADC_COMMON_INSTANCE(ADCxy_COMMON));
/* Force reset of ADC clock (core clock) */
LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_ADC);
/* Release reset of ADC clock (core clock) */
LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_ADC);
return SUCCESS;
}
/**
* @brief Initialize some features of ADC common parameters
* (all ADC instances belonging to the same ADC common instance)
* and multimode (for devices with several ADC instances available).
* @note The setting of ADC common parameters is conditioned to
* ADC instances state:
* All ADC instances belonging to the same ADC common instance
* must be disabled.
* @param ADCxy_COMMON ADC common instance
* (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
* @param ADC_CommonInitStruct Pointer to a @ref LL_ADC_CommonInitTypeDef structure
* @retval An ErrorStatus enumeration value:
* - SUCCESS: ADC common registers are initialized
* - ERROR: ADC common registers are not initialized
*/
ErrorStatus LL_ADC_CommonInit(ADC_Common_TypeDef *ADCxy_COMMON, LL_ADC_CommonInitTypeDef *ADC_CommonInitStruct)
{
ErrorStatus status = SUCCESS;
/* Check the parameters */
assert_param(IS_ADC_COMMON_INSTANCE(ADCxy_COMMON));
assert_param(IS_LL_ADC_COMMON_CLOCK(ADC_CommonInitStruct->CommonClock));
#if defined(ADC_MULTIMODE_SUPPORT)
assert_param(IS_LL_ADC_MULTI_MODE(ADC_CommonInitStruct->Multimode));
if(ADC_CommonInitStruct->Multimode != LL_ADC_MULTI_INDEPENDENT)
{
assert_param(IS_LL_ADC_MULTI_DMA_TRANSFER(ADC_CommonInitStruct->MultiDMATransfer));
assert_param(IS_LL_ADC_MULTI_TWOSMP_DELAY(ADC_CommonInitStruct->MultiTwoSamplingDelay));
}
#endif /* ADC_MULTIMODE_SUPPORT */
/* Note: Hardware constraint (refer to description of functions */
/* "LL_ADC_SetCommonXXX()" and "LL_ADC_SetMultiXXX()"): */
/* On this STM32 serie, setting of these features is conditioned to */
/* ADC state: */
/* All ADC instances of the ADC common group must be disabled. */
if(__LL_ADC_IS_ENABLED_ALL_COMMON_INSTANCE(ADCxy_COMMON) == 0U)
{
/* Configuration of ADC hierarchical scope: */
/* - common to several ADC */
/* (all ADC instances belonging to the same ADC common instance) */
/* - Set ADC clock (conversion clock) */
/* - multimode (if several ADC instances available on the */
/* selected device) */
/* - Set ADC multimode configuration */
/* - Set ADC multimode DMA transfer */
/* - Set ADC multimode: delay between 2 sampling phases */
#if defined(ADC_MULTIMODE_SUPPORT)
if(ADC_CommonInitStruct->Multimode != LL_ADC_MULTI_INDEPENDENT)
{
MODIFY_REG(ADCxy_COMMON->CCR,
ADC_CCR_ADCPRE
| ADC_CCR_MULTI
| ADC_CCR_DMA
| ADC_CCR_DDS
| ADC_CCR_DELAY
,
ADC_CommonInitStruct->CommonClock
| ADC_CommonInitStruct->Multimode
| ADC_CommonInitStruct->MultiDMATransfer
| ADC_CommonInitStruct->MultiTwoSamplingDelay
);
}
else
{
MODIFY_REG(ADCxy_COMMON->CCR,
ADC_CCR_ADCPRE
| ADC_CCR_MULTI
| ADC_CCR_DMA
| ADC_CCR_DDS
| ADC_CCR_DELAY
,
ADC_CommonInitStruct->CommonClock
| LL_ADC_MULTI_INDEPENDENT
);
}
#else
LL_ADC_SetCommonClock(ADCxy_COMMON, ADC_CommonInitStruct->CommonClock);
#endif
}
else
{
/* Initialization error: One or several ADC instances belonging to */
/* the same ADC common instance are not disabled. */
status = ERROR;
}
return status;
}
/**
* @brief Set each @ref LL_ADC_CommonInitTypeDef field to default value.
* @param ADC_CommonInitStruct Pointer to a @ref LL_ADC_CommonInitTypeDef structure
* whose fields will be set to default values.
* @retval None
*/
void LL_ADC_CommonStructInit(LL_ADC_CommonInitTypeDef *ADC_CommonInitStruct)
{
/* Set ADC_CommonInitStruct fields to default values */
/* Set fields of ADC common */
/* (all ADC instances belonging to the same ADC common instance) */
ADC_CommonInitStruct->CommonClock = LL_ADC_CLOCK_SYNC_PCLK_DIV2;
#if defined(ADC_MULTIMODE_SUPPORT)
/* Set fields of ADC multimode */
ADC_CommonInitStruct->Multimode = LL_ADC_MULTI_INDEPENDENT;
ADC_CommonInitStruct->MultiDMATransfer = LL_ADC_MULTI_REG_DMA_EACH_ADC;
ADC_CommonInitStruct->MultiTwoSamplingDelay = LL_ADC_MULTI_TWOSMP_DELAY_5CYCLES;
#endif /* ADC_MULTIMODE_SUPPORT */
}
/**
* @brief De-initialize registers of the selected ADC instance
* to their default reset values.
* @note To reset all ADC instances quickly (perform a hard reset),
* use function @ref LL_ADC_CommonDeInit().
* @param ADCx ADC instance
* @retval An ErrorStatus enumeration value:
* - SUCCESS: ADC registers are de-initialized
* - ERROR: ADC registers are not de-initialized
*/
ErrorStatus LL_ADC_DeInit(ADC_TypeDef *ADCx)
{
ErrorStatus status = SUCCESS;
/* Check the parameters */
assert_param(IS_ADC_ALL_INSTANCE(ADCx));
/* Disable ADC instance if not already disabled. */
if(LL_ADC_IsEnabled(ADCx) == 1U)
{
/* Set ADC group regular trigger source to SW start to ensure to not */
/* have an external trigger event occurring during the conversion stop */
/* ADC disable process. */
LL_ADC_REG_SetTriggerSource(ADCx, LL_ADC_REG_TRIG_SOFTWARE);
/* Set ADC group injected trigger source to SW start to ensure to not */
/* have an external trigger event occurring during the conversion stop */
/* ADC disable process. */
LL_ADC_INJ_SetTriggerSource(ADCx, LL_ADC_INJ_TRIG_SOFTWARE);
/* Disable the ADC instance */
LL_ADC_Disable(ADCx);
}
/* Check whether ADC state is compliant with expected state */
/* (hardware requirements of bits state to reset registers below) */
if(READ_BIT(ADCx->CR2, ADC_CR2_ADON) == 0U)
{
/* ========== Reset ADC registers ========== */
/* Reset register SR */
CLEAR_BIT(ADCx->SR,
( LL_ADC_FLAG_STRT
| LL_ADC_FLAG_JSTRT
| LL_ADC_FLAG_EOCS
| LL_ADC_FLAG_OVR
| LL_ADC_FLAG_JEOS
| LL_ADC_FLAG_AWD1 )
);
/* Reset register CR1 */
CLEAR_BIT(ADCx->CR1,
( ADC_CR1_OVRIE | ADC_CR1_RES | ADC_CR1_AWDEN
| ADC_CR1_JAWDEN
| ADC_CR1_DISCNUM | ADC_CR1_JDISCEN | ADC_CR1_DISCEN
| ADC_CR1_JAUTO | ADC_CR1_AWDSGL | ADC_CR1_SCAN
| ADC_CR1_JEOCIE | ADC_CR1_AWDIE | ADC_CR1_EOCIE
| ADC_CR1_AWDCH )
);
/* Reset register CR2 */
CLEAR_BIT(ADCx->CR2,
( ADC_CR2_SWSTART | ADC_CR2_EXTEN | ADC_CR2_EXTSEL
| ADC_CR2_JSWSTART | ADC_CR2_JEXTEN | ADC_CR2_JEXTSEL
| ADC_CR2_ALIGN | ADC_CR2_EOCS
| ADC_CR2_DDS | ADC_CR2_DMA
| ADC_CR2_CONT | ADC_CR2_ADON )
);
/* Reset register SMPR1 */
CLEAR_BIT(ADCx->SMPR1,
( ADC_SMPR1_SMP18 | ADC_SMPR1_SMP17 | ADC_SMPR1_SMP16
| ADC_SMPR1_SMP15 | ADC_SMPR1_SMP14 | ADC_SMPR1_SMP13
| ADC_SMPR1_SMP12 | ADC_SMPR1_SMP11 | ADC_SMPR1_SMP10)
);
/* Reset register SMPR2 */
CLEAR_BIT(ADCx->SMPR2,
( ADC_SMPR2_SMP9
| ADC_SMPR2_SMP8 | ADC_SMPR2_SMP7 | ADC_SMPR2_SMP6
| ADC_SMPR2_SMP5 | ADC_SMPR2_SMP4 | ADC_SMPR2_SMP3
| ADC_SMPR2_SMP2 | ADC_SMPR2_SMP1 | ADC_SMPR2_SMP0)
);
/* Reset register JOFR1 */
CLEAR_BIT(ADCx->JOFR1, ADC_JOFR1_JOFFSET1);
/* Reset register JOFR2 */
CLEAR_BIT(ADCx->JOFR2, ADC_JOFR2_JOFFSET2);
/* Reset register JOFR3 */
CLEAR_BIT(ADCx->JOFR3, ADC_JOFR3_JOFFSET3);
/* Reset register JOFR4 */
CLEAR_BIT(ADCx->JOFR4, ADC_JOFR4_JOFFSET4);
/* Reset register HTR */
SET_BIT(ADCx->HTR, ADC_HTR_HT);
/* Reset register LTR */
CLEAR_BIT(ADCx->LTR, ADC_LTR_LT);
/* Reset register SQR1 */
CLEAR_BIT(ADCx->SQR1,
( ADC_SQR1_L
| ADC_SQR1_SQ16
| ADC_SQR1_SQ15 | ADC_SQR1_SQ14 | ADC_SQR1_SQ13)
);
/* Reset register SQR2 */
CLEAR_BIT(ADCx->SQR2,
( ADC_SQR2_SQ12 | ADC_SQR2_SQ11 | ADC_SQR2_SQ10
| ADC_SQR2_SQ9 | ADC_SQR2_SQ8 | ADC_SQR2_SQ7)
);
/* Reset register JSQR */
CLEAR_BIT(ADCx->JSQR,
( ADC_JSQR_JL
| ADC_JSQR_JSQ4 | ADC_JSQR_JSQ3
| ADC_JSQR_JSQ2 | ADC_JSQR_JSQ1 )
);
/* Reset register DR */
/* bits in access mode read only, no direct reset applicable */
/* Reset registers JDR1, JDR2, JDR3, JDR4 */
/* bits in access mode read only, no direct reset applicable */
/* Reset register CCR */
CLEAR_BIT(ADC->CCR, ADC_CCR_TSVREFE | ADC_CCR_ADCPRE);
}
return status;
}
/**
* @brief Initialize some features of ADC instance.
* @note These parameters have an impact on ADC scope: ADC instance.
* Affects both group regular and group injected (availability
* of ADC group injected depends on STM32 families).
* Refer to corresponding unitary functions into
* @ref ADC_LL_EF_Configuration_ADC_Instance .
* @note The setting of these parameters by function @ref LL_ADC_Init()
* is conditioned to ADC state:
* ADC instance must be disabled.
* This condition is applied to all ADC features, for efficiency
* and compatibility over all STM32 families. However, the different
* features can be set under different ADC state conditions
* (setting possible with ADC enabled without conversion on going,
* ADC enabled with conversion on going, ...)
* Each feature can be updated afterwards with a unitary function
* and potentially with ADC in a different state than disabled,
* refer to description of each function for setting
* conditioned to ADC state.
* @note After using this function, some other features must be configured
* using LL unitary functions.
* The minimum configuration remaining to be done is:
* - Set ADC group regular or group injected sequencer:
* map channel on the selected sequencer rank.
* Refer to function @ref LL_ADC_REG_SetSequencerRanks().
* - Set ADC channel sampling time
* Refer to function LL_ADC_SetChannelSamplingTime();
* @param ADCx ADC instance
* @param ADC_InitStruct Pointer to a @ref LL_ADC_REG_InitTypeDef structure
* @retval An ErrorStatus enumeration value:
* - SUCCESS: ADC registers are initialized
* - ERROR: ADC registers are not initialized
*/
ErrorStatus LL_ADC_Init(ADC_TypeDef *ADCx, LL_ADC_InitTypeDef *ADC_InitStruct)
{
ErrorStatus status = SUCCESS;
/* Check the parameters */
assert_param(IS_ADC_ALL_INSTANCE(ADCx));
assert_param(IS_LL_ADC_RESOLUTION(ADC_InitStruct->Resolution));
assert_param(IS_LL_ADC_DATA_ALIGN(ADC_InitStruct->DataAlignment));
assert_param(IS_LL_ADC_SCAN_SELECTION(ADC_InitStruct->SequencersScanMode));
/* Note: Hardware constraint (refer to description of this function): */
/* ADC instance must be disabled. */
if(LL_ADC_IsEnabled(ADCx) == 0U)
{
/* Configuration of ADC hierarchical scope: */
/* - ADC instance */
/* - Set ADC data resolution */
/* - Set ADC conversion data alignment */
MODIFY_REG(ADCx->CR1,
ADC_CR1_RES
| ADC_CR1_SCAN
,
ADC_InitStruct->Resolution
| ADC_InitStruct->SequencersScanMode
);
MODIFY_REG(ADCx->CR2,
ADC_CR2_ALIGN
,
ADC_InitStruct->DataAlignment
);
}
else
{
/* Initialization error: ADC instance is not disabled. */
status = ERROR;
}
return status;
}
/**
* @brief Set each @ref LL_ADC_InitTypeDef field to default value.
* @param ADC_InitStruct Pointer to a @ref LL_ADC_InitTypeDef structure
* whose fields will be set to default values.
* @retval None
*/
void LL_ADC_StructInit(LL_ADC_InitTypeDef *ADC_InitStruct)
{
/* Set ADC_InitStruct fields to default values */
/* Set fields of ADC instance */
ADC_InitStruct->Resolution = LL_ADC_RESOLUTION_12B;
ADC_InitStruct->DataAlignment = LL_ADC_DATA_ALIGN_RIGHT;
/* Enable scan mode to have a generic behavior with ADC of other */
/* STM32 families, without this setting available: */
/* ADC group regular sequencer and ADC group injected sequencer depend */
/* only of their own configuration. */
ADC_InitStruct->SequencersScanMode = LL_ADC_SEQ_SCAN_ENABLE;
}
/**
* @brief Initialize some features of ADC group regular.
* @note These parameters have an impact on ADC scope: ADC group regular.
* Refer to corresponding unitary functions into
* @ref ADC_LL_EF_Configuration_ADC_Group_Regular
* (functions with prefix "REG").
* @note The setting of these parameters by function @ref LL_ADC_Init()
* is conditioned to ADC state:
* ADC instance must be disabled.
* This condition is applied to all ADC features, for efficiency
* and compatibility over all STM32 families. However, the different
* features can be set under different ADC state conditions
* (setting possible with ADC enabled without conversion on going,
* ADC enabled with conversion on going, ...)
* Each feature can be updated afterwards with a unitary function
* and potentially with ADC in a different state than disabled,
* refer to description of each function for setting
* conditioned to ADC state.
* @note After using this function, other features must be configured
* using LL unitary functions.
* The minimum configuration remaining to be done is:
* - Set ADC group regular or group injected sequencer:
* map channel on the selected sequencer rank.
* Refer to function @ref LL_ADC_REG_SetSequencerRanks().
* - Set ADC channel sampling time
* Refer to function LL_ADC_SetChannelSamplingTime();
* @param ADCx ADC instance
* @param ADC_REG_InitStruct Pointer to a @ref LL_ADC_REG_InitTypeDef structure
* @retval An ErrorStatus enumeration value:
* - SUCCESS: ADC registers are initialized
* - ERROR: ADC registers are not initialized
*/
ErrorStatus LL_ADC_REG_Init(ADC_TypeDef *ADCx, LL_ADC_REG_InitTypeDef *ADC_REG_InitStruct)
{
ErrorStatus status = SUCCESS;
/* Check the parameters */
assert_param(IS_ADC_ALL_INSTANCE(ADCx));
assert_param(IS_LL_ADC_REG_TRIG_SOURCE(ADC_REG_InitStruct->TriggerSource));
assert_param(IS_LL_ADC_REG_SEQ_SCAN_LENGTH(ADC_REG_InitStruct->SequencerLength));
if(ADC_REG_InitStruct->SequencerLength != LL_ADC_REG_SEQ_SCAN_DISABLE)
{
assert_param(IS_LL_ADC_REG_SEQ_SCAN_DISCONT_MODE(ADC_REG_InitStruct->SequencerDiscont));
}
assert_param(IS_LL_ADC_REG_CONTINUOUS_MODE(ADC_REG_InitStruct->ContinuousMode));
assert_param(IS_LL_ADC_REG_DMA_TRANSFER(ADC_REG_InitStruct->DMATransfer));
/* Note: Hardware constraint (refer to description of this function): */
/* ADC instance must be disabled. */
if(LL_ADC_IsEnabled(ADCx) == 0U)
{
/* Configuration of ADC hierarchical scope: */
/* - ADC group regular */
/* - Set ADC group regular trigger source */
/* - Set ADC group regular sequencer length */
/* - Set ADC group regular sequencer discontinuous mode */
/* - Set ADC group regular continuous mode */
/* - Set ADC group regular conversion data transfer: no transfer or */
/* transfer by DMA, and DMA requests mode */
/* Note: On this STM32 serie, ADC trigger edge is set when starting */
/* ADC conversion. */
/* Refer to function @ref LL_ADC_REG_StartConversionExtTrig(). */
if(ADC_REG_InitStruct->SequencerLength != LL_ADC_REG_SEQ_SCAN_DISABLE)
{
MODIFY_REG(ADCx->CR1,
ADC_CR1_DISCEN
| ADC_CR1_DISCNUM
,
ADC_REG_InitStruct->SequencerLength
| ADC_REG_InitStruct->SequencerDiscont
);
}
else
{
MODIFY_REG(ADCx->CR1,
ADC_CR1_DISCEN
| ADC_CR1_DISCNUM
,
ADC_REG_InitStruct->SequencerLength
| LL_ADC_REG_SEQ_DISCONT_DISABLE
);
}
MODIFY_REG(ADCx->CR2,
ADC_CR2_EXTSEL
| ADC_CR2_EXTEN
| ADC_CR2_CONT
| ADC_CR2_DMA
| ADC_CR2_DDS
,
(ADC_REG_InitStruct->TriggerSource & ADC_CR2_EXTSEL)
| ADC_REG_InitStruct->ContinuousMode
| ADC_REG_InitStruct->DMATransfer
);
/* Set ADC group regular sequencer length and scan direction */
/* Note: Hardware constraint (refer to description of this function): */
/* Note: If ADC instance feature scan mode is disabled */
/* (refer to ADC instance initialization structure */
/* parameter @ref SequencersScanMode */
/* or function @ref LL_ADC_SetSequencersScanMode() ), */
/* this parameter is discarded. */
LL_ADC_REG_SetSequencerLength(ADCx, ADC_REG_InitStruct->SequencerLength);
}
else
{
/* Initialization error: ADC instance is not disabled. */
status = ERROR;
}
return status;
}
/**
* @brief Set each @ref LL_ADC_REG_InitTypeDef field to default value.
* @param ADC_REG_InitStruct Pointer to a @ref LL_ADC_REG_InitTypeDef structure
* whose fields will be set to default values.
* @retval None
*/
void LL_ADC_REG_StructInit(LL_ADC_REG_InitTypeDef *ADC_REG_InitStruct)
{
/* Set ADC_REG_InitStruct fields to default values */
/* Set fields of ADC group regular */
/* Note: On this STM32 serie, ADC trigger edge is set when starting */
/* ADC conversion. */
/* Refer to function @ref LL_ADC_REG_StartConversionExtTrig(). */
ADC_REG_InitStruct->TriggerSource = LL_ADC_REG_TRIG_SOFTWARE;
ADC_REG_InitStruct->SequencerLength = LL_ADC_REG_SEQ_SCAN_DISABLE;
ADC_REG_InitStruct->SequencerDiscont = LL_ADC_REG_SEQ_DISCONT_DISABLE;
ADC_REG_InitStruct->ContinuousMode = LL_ADC_REG_CONV_SINGLE;
ADC_REG_InitStruct->DMATransfer = LL_ADC_REG_DMA_TRANSFER_NONE;
}
/**
* @brief Initialize some features of ADC group injected.
* @note These parameters have an impact on ADC scope: ADC group injected.
* Refer to corresponding unitary functions into
* @ref ADC_LL_EF_Configuration_ADC_Group_Regular
* (functions with prefix "INJ").
* @note The setting of these parameters by function @ref LL_ADC_Init()
* is conditioned to ADC state:
* ADC instance must be disabled.
* This condition is applied to all ADC features, for efficiency
* and compatibility over all STM32 families. However, the different
* features can be set under different ADC state conditions
* (setting possible with ADC enabled without conversion on going,
* ADC enabled with conversion on going, ...)
* Each feature can be updated afterwards with a unitary function
* and potentially with ADC in a different state than disabled,
* refer to description of each function for setting
* conditioned to ADC state.
* @note After using this function, other features must be configured
* using LL unitary functions.
* The minimum configuration remaining to be done is:
* - Set ADC group injected sequencer:
* map channel on the selected sequencer rank.
* Refer to function @ref LL_ADC_INJ_SetSequencerRanks().
* - Set ADC channel sampling time
* Refer to function LL_ADC_SetChannelSamplingTime();
* @param ADCx ADC instance
* @param ADC_INJ_InitStruct Pointer to a @ref LL_ADC_INJ_InitTypeDef structure
* @retval An ErrorStatus enumeration value:
* - SUCCESS: ADC registers are initialized
* - ERROR: ADC registers are not initialized
*/
ErrorStatus LL_ADC_INJ_Init(ADC_TypeDef *ADCx, LL_ADC_INJ_InitTypeDef *ADC_INJ_InitStruct)
{
ErrorStatus status = SUCCESS;
/* Check the parameters */
assert_param(IS_ADC_ALL_INSTANCE(ADCx));
assert_param(IS_LL_ADC_INJ_TRIG_SOURCE(ADC_INJ_InitStruct->TriggerSource));
assert_param(IS_LL_ADC_INJ_SEQ_SCAN_LENGTH(ADC_INJ_InitStruct->SequencerLength));
if(ADC_INJ_InitStruct->SequencerLength != LL_ADC_INJ_SEQ_SCAN_DISABLE)
{
assert_param(IS_LL_ADC_INJ_SEQ_SCAN_DISCONT_MODE(ADC_INJ_InitStruct->SequencerDiscont));
}
assert_param(IS_LL_ADC_INJ_TRIG_AUTO(ADC_INJ_InitStruct->TrigAuto));
/* Note: Hardware constraint (refer to description of this function): */
/* ADC instance must be disabled. */
if(LL_ADC_IsEnabled(ADCx) == 0U)
{
/* Configuration of ADC hierarchical scope: */
/* - ADC group injected */
/* - Set ADC group injected trigger source */
/* - Set ADC group injected sequencer length */
/* - Set ADC group injected sequencer discontinuous mode */
/* - Set ADC group injected conversion trigger: independent or */
/* from ADC group regular */
/* Note: On this STM32 serie, ADC trigger edge is set when starting */
/* ADC conversion. */
/* Refer to function @ref LL_ADC_INJ_StartConversionExtTrig(). */
if(ADC_INJ_InitStruct->SequencerLength != LL_ADC_REG_SEQ_SCAN_DISABLE)
{
MODIFY_REG(ADCx->CR1,
ADC_CR1_JDISCEN
| ADC_CR1_JAUTO
,
ADC_INJ_InitStruct->SequencerDiscont
| ADC_INJ_InitStruct->TrigAuto
);
}
else
{
MODIFY_REG(ADCx->CR1,
ADC_CR1_JDISCEN
| ADC_CR1_JAUTO
,
LL_ADC_REG_SEQ_DISCONT_DISABLE
| ADC_INJ_InitStruct->TrigAuto
);
}
MODIFY_REG(ADCx->CR2,
ADC_CR2_JEXTSEL
| ADC_CR2_JEXTEN
,
(ADC_INJ_InitStruct->TriggerSource & ADC_CR2_JEXTSEL)
);
/* Note: Hardware constraint (refer to description of this function): */
/* Note: If ADC instance feature scan mode is disabled */
/* (refer to ADC instance initialization structure */
/* parameter @ref SequencersScanMode */
/* or function @ref LL_ADC_SetSequencersScanMode() ), */
/* this parameter is discarded. */
LL_ADC_INJ_SetSequencerLength(ADCx, ADC_INJ_InitStruct->SequencerLength);
}
else
{
/* Initialization error: ADC instance is not disabled. */
status = ERROR;
}
return status;
}
/**
* @brief Set each @ref LL_ADC_INJ_InitTypeDef field to default value.
* @param ADC_INJ_InitStruct Pointer to a @ref LL_ADC_INJ_InitTypeDef structure
* whose fields will be set to default values.
* @retval None
*/
void LL_ADC_INJ_StructInit(LL_ADC_INJ_InitTypeDef *ADC_INJ_InitStruct)
{
/* Set ADC_INJ_InitStruct fields to default values */
/* Set fields of ADC group injected */
ADC_INJ_InitStruct->TriggerSource = LL_ADC_INJ_TRIG_SOFTWARE;
ADC_INJ_InitStruct->SequencerLength = LL_ADC_INJ_SEQ_SCAN_DISABLE;
ADC_INJ_InitStruct->SequencerDiscont = LL_ADC_INJ_SEQ_DISCONT_DISABLE;
ADC_INJ_InitStruct->TrigAuto = LL_ADC_INJ_TRIG_INDEPENDENT;
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#endif /* ADC1 || ADC2 || ADC3 */
/**
* @}
*/
#endif /* USE_FULL_LL_DRIVER */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
the_stack_data/26700829.c | /*
Given a string, s, consisting of alphabets and digits, find the frequency of each digit in the given string.
Input Format
The first line contains a string, num which is the given number.
*/
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
char s;
int a[] = {0,0,0,0,0,0,0,0,0,0}; // An empty array
while(scanf("%c", &s) == 1) // It keeps on scaning the next value inline (continue while it is true)
{
if(s >= '0' && s <= '9') // If value is between 0 and 9
{
a[s-'0'] += 1; // Subtracting 0 from s to get the ASCII value
}
}
for(int i=0; i<10; i++)
printf("%d ", a[i]); // Printing the array
return 0;
}
/*
Sample Input 1
lw4n88j12n1
Sample Output 1
0 2 1 0 1 0 0 0 2 0
Sample Input 2
1v88886l256338ar0ekk
Sample Output 2
1 1 1 2 0 1 2 0 5 0
*/
|
the_stack_data/178265661.c | // PARAM: --set exp.structs.domain "sets"
#include<assert.h>
#include<stdio.h>
struct FunctionInfo {
void* ptr;
int id;
};
struct FunctionInfo functionToRun;
/// Finds the factorial of given number
int factorial(int n) {
int acc = 1;
for (int i = 1; i <= n; i++) {
acc *= i;
}
return acc;
}
/// Finds the "n" given a "n!".
/// In case an integer "n" cannot be calculated, return the upper (ceil) number.
int inverseFactorial(int fac) {
int product = 1;
int n = 1;
while (product < fac) {
n++;
product *= n;
}
printf("Inverse found!\n"); // create a side effect and prevent optimizations
return n;
}
int main() {
int n;
int choice;
if (choice == 1) {
functionToRun.id = 1;
functionToRun.ptr = factorial;
} else {
functionToRun.id = 2;
functionToRun.ptr = inverseFactorial;
}
int dead = 1;
typedef int (*fun)(int);
if (functionToRun.id == 1) {
fun f = functionToRun.ptr;
assert(f == factorial);
int result = f(n);
printf("Factorial of %d is %d\n", n, result);
dead = 0;
} else if (functionToRun.id == 2) {
fun f = functionToRun.ptr;
assert(f == inverseFactorial);
int result = f(n);
printf("Factorial of %d is %d\n", result, n);
dead = 0;
} else {
fun f = functionToRun.ptr;
printf("Exiting with code %d...\n", n);
int result = f(n);
}
assert(dead != 1);
return 0;
}
|
the_stack_data/45451212.c | #include <stdio.h>
int main(void)
{
printf("Hello World\n");
return 0;
} |
the_stack_data/182954278.c | //@ ltl invariant negative: ( ( ([] (<> ( (! AP((s0_l0 != 0))) && (! AP((s0_l1 != 0)))))) || (! ([] (<> ( AP((s0_l1 != 0)) && (! AP((s0_l0 != 0)))))))) || (! ([] (<> AP((1.0 <= _diverge_delta))))));
extern float __VERIFIER_nondet_float(void);
extern int __VERIFIER_nondet_int(void);
char __VERIFIER_nondet_bool(void) {
return __VERIFIER_nondet_int() != 0;
}
float _diverge_delta, _x__diverge_delta;
char s25_l0, _x_s25_l0;
char s25_evt1, _x_s25_evt1;
char s25_evt0, _x_s25_evt0;
float s25_x, _x_s25_x;
char s24_l1, _x_s24_l1;
char s24_l0, _x_s24_l0;
char s24_evt2, _x_s24_evt2;
char s24_evt1, _x_s24_evt1;
char s24_evt0, _x_s24_evt0;
float s24_x, _x_s24_x;
char s23_l1, _x_s23_l1;
char s23_l0, _x_s23_l0;
char s23_evt2, _x_s23_evt2;
char s23_evt1, _x_s23_evt1;
char s23_evt0, _x_s23_evt0;
float s23_x, _x_s23_x;
float s25_backoff, _x_s25_backoff;
char s22_l1, _x_s22_l1;
float s25_lambda, _x_s25_lambda;
char s22_l0, _x_s22_l0;
char s22_evt2, _x_s22_evt2;
char s22_evt1, _x_s22_evt1;
char s22_evt0, _x_s22_evt0;
float s22_x, _x_s22_x;
float s24_backoff, _x_s24_backoff;
char s21_l1, _x_s21_l1;
float s24_lambda, _x_s24_lambda;
char s21_l0, _x_s21_l0;
char s21_evt2, _x_s21_evt2;
char s21_evt1, _x_s21_evt1;
char s21_evt0, _x_s21_evt0;
float s21_x, _x_s21_x;
float s23_backoff, _x_s23_backoff;
char s20_l1, _x_s20_l1;
float s23_lambda, _x_s23_lambda;
char s20_l0, _x_s20_l0;
char s20_evt2, _x_s20_evt2;
char s20_evt1, _x_s20_evt1;
char s20_evt0, _x_s20_evt0;
float s20_x, _x_s20_x;
float s19_x, _x_s19_x;
float s21_backoff, _x_s21_backoff;
char s18_l1, _x_s18_l1;
float s21_lambda, _x_s21_lambda;
char s18_l0, _x_s18_l0;
char s18_evt2, _x_s18_evt2;
char s18_evt1, _x_s18_evt1;
char s18_evt0, _x_s18_evt0;
float s18_x, _x_s18_x;
float s20_backoff, _x_s20_backoff;
char s17_l1, _x_s17_l1;
float s20_lambda, _x_s20_lambda;
char s17_l0, _x_s17_l0;
char s17_evt2, _x_s17_evt2;
char s17_evt1, _x_s17_evt1;
char s17_evt0, _x_s17_evt0;
float s17_x, _x_s17_x;
char s16_evt2, _x_s16_evt2;
char s16_evt1, _x_s16_evt1;
char s16_evt0, _x_s16_evt0;
float s16_x, _x_s16_x;
float s18_backoff, _x_s18_backoff;
char s15_l1, _x_s15_l1;
float s18_lambda, _x_s18_lambda;
char s15_l0, _x_s15_l0;
char s15_evt2, _x_s15_evt2;
char s15_evt1, _x_s15_evt1;
char s15_evt0, _x_s15_evt0;
float s15_x, _x_s15_x;
float s17_backoff, _x_s17_backoff;
char s14_l1, _x_s14_l1;
float s17_lambda, _x_s17_lambda;
char s14_l0, _x_s14_l0;
char s4_evt0, _x_s4_evt0;
float s16_backoff, _x_s16_backoff;
char s13_l1, _x_s13_l1;
float s4_x, _x_s4_x;
char s19_evt2, _x_s19_evt2;
char bus_evt2, _x_bus_evt2;
char s3_evt0, _x_s3_evt0;
float s15_backoff, _x_s15_backoff;
char s12_l1, _x_s12_l1;
float s3_x, _x_s3_x;
char s5_evt2, _x_s5_evt2;
char s5_evt1, _x_s5_evt1;
char s2_evt2, _x_s2_evt2;
char s3_l1, _x_s3_l1;
float s6_backoff, _x_s6_backoff;
char s2_evt1, _x_s2_evt1;
float s14_x, _x_s14_x;
float s0_lambda, _x_s0_lambda;
float s22_lambda, _x_s22_lambda;
char s19_l0, _x_s19_l0;
char bus_l0, _x_bus_l0;
float s5_x, _x_s5_x;
float s0_backoff, _x_s0_backoff;
char s25_evt2, _x_s25_evt2;
float s0_x, _x_s0_x;
char s14_evt2, _x_s14_evt2;
char s2_evt0, _x_s2_evt0;
char s4_evt1, _x_s4_evt1;
char s19_evt0, _x_s19_evt0;
char bus_evt0, _x_bus_evt0;
char s19_evt1, _x_s19_evt1;
char bus_evt1, _x_bus_evt1;
char s1_l0, _x_s1_l0;
float s4_lambda, _x_s4_lambda;
char s0_evt0, _x_s0_evt0;
float s19_lambda, _x_s19_lambda;
char s16_l0, _x_s16_l0;
int bus_cd_id, _x_bus_cd_id;
char s6_evt2, _x_s6_evt2;
char s1_l1, _x_s1_l1;
float s4_backoff, _x_s4_backoff;
char s0_evt1, _x_s0_evt1;
float s12_x, _x_s12_x;
float s15_lambda, _x_s15_lambda;
char s12_l0, _x_s12_l0;
float s19_backoff, _x_s19_backoff;
char s16_l1, _x_s16_l1;
int bus_j, _x_bus_j;
char s5_evt0, _x_s5_evt0;
char s0_evt2, _x_s0_evt2;
char s25_l1, _x_s25_l1;
float delta, _x_delta;
char s4_l1, _x_s4_l1;
float s7_backoff, _x_s7_backoff;
char s3_evt1, _x_s3_evt1;
float s3_lambda, _x_s3_lambda;
char s0_l0, _x_s0_l0;
float s2_lambda, _x_s2_lambda;
char s3_evt2, _x_s3_evt2;
float s3_backoff, _x_s3_backoff;
char s0_l1, _x_s0_l1;
float s2_backoff, _x_s2_backoff;
float s1_x, _x_s1_x;
float s6_x, _x_s6_x;
float s1_backoff, _x_s1_backoff;
float s1_lambda, _x_s1_lambda;
char s2_l0, _x_s2_l0;
float s5_lambda, _x_s5_lambda;
char s1_evt0, _x_s1_evt0;
char s2_l1, _x_s2_l1;
float s5_backoff, _x_s5_backoff;
char s1_evt1, _x_s1_evt1;
float s13_x, _x_s13_x;
char s1_evt2, _x_s1_evt2;
char s4_evt2, _x_s4_evt2;
float s22_backoff, _x_s22_backoff;
char s19_l1, _x_s19_l1;
char bus_l1, _x_bus_l1;
char s9_evt0, _x_s9_evt0;
float s2_x, _x_s2_x;
char s3_l0, _x_s3_l0;
float s6_lambda, _x_s6_lambda;
char s6_evt0, _x_s6_evt0;
char s6_evt1, _x_s6_evt1;
float s7_x, _x_s7_x;
char s4_l0, _x_s4_l0;
float s7_lambda, _x_s7_lambda;
char s7_evt0, _x_s7_evt0;
char s7_evt1, _x_s7_evt1;
char s7_evt2, _x_s7_evt2;
float s8_x, _x_s8_x;
char s5_l1, _x_s5_l1;
float s8_backoff, _x_s8_backoff;
char s5_l0, _x_s5_l0;
float s8_lambda, _x_s8_lambda;
char s8_evt0, _x_s8_evt0;
char s8_evt1, _x_s8_evt1;
char s8_evt2, _x_s8_evt2;
float s9_x, _x_s9_x;
char s6_l1, _x_s6_l1;
float s9_backoff, _x_s9_backoff;
char s6_l0, _x_s6_l0;
float s9_lambda, _x_s9_lambda;
char s9_evt1, _x_s9_evt1;
char s9_evt2, _x_s9_evt2;
float s12_lambda, _x_s12_lambda;
char s9_l0, _x_s9_l0;
float s10_x, _x_s10_x;
char s7_l1, _x_s7_l1;
float s10_backoff, _x_s10_backoff;
char s7_l0, _x_s7_l0;
float s10_lambda, _x_s10_lambda;
float bus_x, _x_bus_x;
char s10_evt0, _x_s10_evt0;
char s10_evt1, _x_s10_evt1;
char s10_evt2, _x_s10_evt2;
float s13_lambda, _x_s13_lambda;
char s10_l0, _x_s10_l0;
float s11_x, _x_s11_x;
char s8_l1, _x_s8_l1;
float s11_backoff, _x_s11_backoff;
char s8_l0, _x_s8_l0;
float s11_lambda, _x_s11_lambda;
char s11_evt0, _x_s11_evt0;
char s11_evt1, _x_s11_evt1;
char s11_evt2, _x_s11_evt2;
float s14_lambda, _x_s14_lambda;
char s11_l0, _x_s11_l0;
char s9_l1, _x_s9_l1;
float s12_backoff, _x_s12_backoff;
char s12_evt0, _x_s12_evt0;
char s12_evt1, _x_s12_evt1;
char s12_evt2, _x_s12_evt2;
char s10_l1, _x_s10_l1;
float s13_backoff, _x_s13_backoff;
char s13_evt0, _x_s13_evt0;
char s13_evt1, _x_s13_evt1;
char s13_evt2, _x_s13_evt2;
float s16_lambda, _x_s16_lambda;
char s13_l0, _x_s13_l0;
char s11_l1, _x_s11_l1;
float s14_backoff, _x_s14_backoff;
char s14_evt0, _x_s14_evt0;
char s14_evt1, _x_s14_evt1;
int main()
{
_diverge_delta = __VERIFIER_nondet_float();
s25_l0 = __VERIFIER_nondet_bool();
s25_evt1 = __VERIFIER_nondet_bool();
s25_evt0 = __VERIFIER_nondet_bool();
s25_x = __VERIFIER_nondet_float();
s24_l1 = __VERIFIER_nondet_bool();
s24_l0 = __VERIFIER_nondet_bool();
s24_evt2 = __VERIFIER_nondet_bool();
s24_evt1 = __VERIFIER_nondet_bool();
s24_evt0 = __VERIFIER_nondet_bool();
s24_x = __VERIFIER_nondet_float();
s23_l1 = __VERIFIER_nondet_bool();
s23_l0 = __VERIFIER_nondet_bool();
s23_evt2 = __VERIFIER_nondet_bool();
s23_evt1 = __VERIFIER_nondet_bool();
s23_evt0 = __VERIFIER_nondet_bool();
s23_x = __VERIFIER_nondet_float();
s25_backoff = __VERIFIER_nondet_float();
s22_l1 = __VERIFIER_nondet_bool();
s25_lambda = __VERIFIER_nondet_float();
s22_l0 = __VERIFIER_nondet_bool();
s22_evt2 = __VERIFIER_nondet_bool();
s22_evt1 = __VERIFIER_nondet_bool();
s22_evt0 = __VERIFIER_nondet_bool();
s22_x = __VERIFIER_nondet_float();
s24_backoff = __VERIFIER_nondet_float();
s21_l1 = __VERIFIER_nondet_bool();
s24_lambda = __VERIFIER_nondet_float();
s21_l0 = __VERIFIER_nondet_bool();
s21_evt2 = __VERIFIER_nondet_bool();
s21_evt1 = __VERIFIER_nondet_bool();
s21_evt0 = __VERIFIER_nondet_bool();
s21_x = __VERIFIER_nondet_float();
s23_backoff = __VERIFIER_nondet_float();
s20_l1 = __VERIFIER_nondet_bool();
s23_lambda = __VERIFIER_nondet_float();
s20_l0 = __VERIFIER_nondet_bool();
s20_evt2 = __VERIFIER_nondet_bool();
s20_evt1 = __VERIFIER_nondet_bool();
s20_evt0 = __VERIFIER_nondet_bool();
s20_x = __VERIFIER_nondet_float();
s19_x = __VERIFIER_nondet_float();
s21_backoff = __VERIFIER_nondet_float();
s18_l1 = __VERIFIER_nondet_bool();
s21_lambda = __VERIFIER_nondet_float();
s18_l0 = __VERIFIER_nondet_bool();
s18_evt2 = __VERIFIER_nondet_bool();
s18_evt1 = __VERIFIER_nondet_bool();
s18_evt0 = __VERIFIER_nondet_bool();
s18_x = __VERIFIER_nondet_float();
s20_backoff = __VERIFIER_nondet_float();
s17_l1 = __VERIFIER_nondet_bool();
s20_lambda = __VERIFIER_nondet_float();
s17_l0 = __VERIFIER_nondet_bool();
s17_evt2 = __VERIFIER_nondet_bool();
s17_evt1 = __VERIFIER_nondet_bool();
s17_evt0 = __VERIFIER_nondet_bool();
s17_x = __VERIFIER_nondet_float();
s16_evt2 = __VERIFIER_nondet_bool();
s16_evt1 = __VERIFIER_nondet_bool();
s16_evt0 = __VERIFIER_nondet_bool();
s16_x = __VERIFIER_nondet_float();
s18_backoff = __VERIFIER_nondet_float();
s15_l1 = __VERIFIER_nondet_bool();
s18_lambda = __VERIFIER_nondet_float();
s15_l0 = __VERIFIER_nondet_bool();
s15_evt2 = __VERIFIER_nondet_bool();
s15_evt1 = __VERIFIER_nondet_bool();
s15_evt0 = __VERIFIER_nondet_bool();
s15_x = __VERIFIER_nondet_float();
s17_backoff = __VERIFIER_nondet_float();
s14_l1 = __VERIFIER_nondet_bool();
s17_lambda = __VERIFIER_nondet_float();
s14_l0 = __VERIFIER_nondet_bool();
s4_evt0 = __VERIFIER_nondet_bool();
s16_backoff = __VERIFIER_nondet_float();
s13_l1 = __VERIFIER_nondet_bool();
s4_x = __VERIFIER_nondet_float();
s19_evt2 = __VERIFIER_nondet_bool();
bus_evt2 = __VERIFIER_nondet_bool();
s3_evt0 = __VERIFIER_nondet_bool();
s15_backoff = __VERIFIER_nondet_float();
s12_l1 = __VERIFIER_nondet_bool();
s3_x = __VERIFIER_nondet_float();
s5_evt2 = __VERIFIER_nondet_bool();
s5_evt1 = __VERIFIER_nondet_bool();
s2_evt2 = __VERIFIER_nondet_bool();
s3_l1 = __VERIFIER_nondet_bool();
s6_backoff = __VERIFIER_nondet_float();
s2_evt1 = __VERIFIER_nondet_bool();
s14_x = __VERIFIER_nondet_float();
s0_lambda = __VERIFIER_nondet_float();
s22_lambda = __VERIFIER_nondet_float();
s19_l0 = __VERIFIER_nondet_bool();
bus_l0 = __VERIFIER_nondet_bool();
s5_x = __VERIFIER_nondet_float();
s0_backoff = __VERIFIER_nondet_float();
s25_evt2 = __VERIFIER_nondet_bool();
s0_x = __VERIFIER_nondet_float();
s14_evt2 = __VERIFIER_nondet_bool();
s2_evt0 = __VERIFIER_nondet_bool();
s4_evt1 = __VERIFIER_nondet_bool();
s19_evt0 = __VERIFIER_nondet_bool();
bus_evt0 = __VERIFIER_nondet_bool();
s19_evt1 = __VERIFIER_nondet_bool();
bus_evt1 = __VERIFIER_nondet_bool();
s1_l0 = __VERIFIER_nondet_bool();
s4_lambda = __VERIFIER_nondet_float();
s0_evt0 = __VERIFIER_nondet_bool();
s19_lambda = __VERIFIER_nondet_float();
s16_l0 = __VERIFIER_nondet_bool();
bus_cd_id = __VERIFIER_nondet_int();
s6_evt2 = __VERIFIER_nondet_bool();
s1_l1 = __VERIFIER_nondet_bool();
s4_backoff = __VERIFIER_nondet_float();
s0_evt1 = __VERIFIER_nondet_bool();
s12_x = __VERIFIER_nondet_float();
s15_lambda = __VERIFIER_nondet_float();
s12_l0 = __VERIFIER_nondet_bool();
s19_backoff = __VERIFIER_nondet_float();
s16_l1 = __VERIFIER_nondet_bool();
bus_j = __VERIFIER_nondet_int();
s5_evt0 = __VERIFIER_nondet_bool();
s0_evt2 = __VERIFIER_nondet_bool();
s25_l1 = __VERIFIER_nondet_bool();
delta = __VERIFIER_nondet_float();
s4_l1 = __VERIFIER_nondet_bool();
s7_backoff = __VERIFIER_nondet_float();
s3_evt1 = __VERIFIER_nondet_bool();
s3_lambda = __VERIFIER_nondet_float();
s0_l0 = __VERIFIER_nondet_bool();
s2_lambda = __VERIFIER_nondet_float();
s3_evt2 = __VERIFIER_nondet_bool();
s3_backoff = __VERIFIER_nondet_float();
s0_l1 = __VERIFIER_nondet_bool();
s2_backoff = __VERIFIER_nondet_float();
s1_x = __VERIFIER_nondet_float();
s6_x = __VERIFIER_nondet_float();
s1_backoff = __VERIFIER_nondet_float();
s1_lambda = __VERIFIER_nondet_float();
s2_l0 = __VERIFIER_nondet_bool();
s5_lambda = __VERIFIER_nondet_float();
s1_evt0 = __VERIFIER_nondet_bool();
s2_l1 = __VERIFIER_nondet_bool();
s5_backoff = __VERIFIER_nondet_float();
s1_evt1 = __VERIFIER_nondet_bool();
s13_x = __VERIFIER_nondet_float();
s1_evt2 = __VERIFIER_nondet_bool();
s4_evt2 = __VERIFIER_nondet_bool();
s22_backoff = __VERIFIER_nondet_float();
s19_l1 = __VERIFIER_nondet_bool();
bus_l1 = __VERIFIER_nondet_bool();
s9_evt0 = __VERIFIER_nondet_bool();
s2_x = __VERIFIER_nondet_float();
s3_l0 = __VERIFIER_nondet_bool();
s6_lambda = __VERIFIER_nondet_float();
s6_evt0 = __VERIFIER_nondet_bool();
s6_evt1 = __VERIFIER_nondet_bool();
s7_x = __VERIFIER_nondet_float();
s4_l0 = __VERIFIER_nondet_bool();
s7_lambda = __VERIFIER_nondet_float();
s7_evt0 = __VERIFIER_nondet_bool();
s7_evt1 = __VERIFIER_nondet_bool();
s7_evt2 = __VERIFIER_nondet_bool();
s8_x = __VERIFIER_nondet_float();
s5_l1 = __VERIFIER_nondet_bool();
s8_backoff = __VERIFIER_nondet_float();
s5_l0 = __VERIFIER_nondet_bool();
s8_lambda = __VERIFIER_nondet_float();
s8_evt0 = __VERIFIER_nondet_bool();
s8_evt1 = __VERIFIER_nondet_bool();
s8_evt2 = __VERIFIER_nondet_bool();
s9_x = __VERIFIER_nondet_float();
s6_l1 = __VERIFIER_nondet_bool();
s9_backoff = __VERIFIER_nondet_float();
s6_l0 = __VERIFIER_nondet_bool();
s9_lambda = __VERIFIER_nondet_float();
s9_evt1 = __VERIFIER_nondet_bool();
s9_evt2 = __VERIFIER_nondet_bool();
s12_lambda = __VERIFIER_nondet_float();
s9_l0 = __VERIFIER_nondet_bool();
s10_x = __VERIFIER_nondet_float();
s7_l1 = __VERIFIER_nondet_bool();
s10_backoff = __VERIFIER_nondet_float();
s7_l0 = __VERIFIER_nondet_bool();
s10_lambda = __VERIFIER_nondet_float();
bus_x = __VERIFIER_nondet_float();
s10_evt0 = __VERIFIER_nondet_bool();
s10_evt1 = __VERIFIER_nondet_bool();
s10_evt2 = __VERIFIER_nondet_bool();
s13_lambda = __VERIFIER_nondet_float();
s10_l0 = __VERIFIER_nondet_bool();
s11_x = __VERIFIER_nondet_float();
s8_l1 = __VERIFIER_nondet_bool();
s11_backoff = __VERIFIER_nondet_float();
s8_l0 = __VERIFIER_nondet_bool();
s11_lambda = __VERIFIER_nondet_float();
s11_evt0 = __VERIFIER_nondet_bool();
s11_evt1 = __VERIFIER_nondet_bool();
s11_evt2 = __VERIFIER_nondet_bool();
s14_lambda = __VERIFIER_nondet_float();
s11_l0 = __VERIFIER_nondet_bool();
s9_l1 = __VERIFIER_nondet_bool();
s12_backoff = __VERIFIER_nondet_float();
s12_evt0 = __VERIFIER_nondet_bool();
s12_evt1 = __VERIFIER_nondet_bool();
s12_evt2 = __VERIFIER_nondet_bool();
s10_l1 = __VERIFIER_nondet_bool();
s13_backoff = __VERIFIER_nondet_float();
s13_evt0 = __VERIFIER_nondet_bool();
s13_evt1 = __VERIFIER_nondet_bool();
s13_evt2 = __VERIFIER_nondet_bool();
s16_lambda = __VERIFIER_nondet_float();
s13_l0 = __VERIFIER_nondet_bool();
s11_l1 = __VERIFIER_nondet_bool();
s14_backoff = __VERIFIER_nondet_float();
s14_evt0 = __VERIFIER_nondet_bool();
s14_evt1 = __VERIFIER_nondet_bool();
int __ok = ((((((((( !(s25_l0 != 0)) && ( !(s25_l1 != 0))) && (s25_x == 0.0)) && ((( !(s25_evt2 != 0)) && ((s25_evt0 != 0) && ( !(s25_evt1 != 0)))) || (((( !(s25_evt2 != 0)) && (( !(s25_evt0 != 0)) && ( !(s25_evt1 != 0)))) || ((s25_evt2 != 0) && (( !(s25_evt0 != 0)) && ( !(s25_evt1 != 0))))) || ((( !(s25_evt2 != 0)) && ((s25_evt1 != 0) && ( !(s25_evt0 != 0)))) || ((s25_evt2 != 0) && ((s25_evt1 != 0) && ( !(s25_evt0 != 0)))))))) && ((( !(s25_l0 != 0)) && ( !(s25_l1 != 0))) || (((s25_l1 != 0) && ( !(s25_l0 != 0))) || ((s25_l0 != 0) && ( !(s25_l1 != 0)))))) && (13.0 <= s25_backoff)) && (( !(s25_lambda <= 0.0)) && ((s25_x <= s25_lambda) || ( !((s25_l1 != 0) && ( !(s25_l0 != 0))))))) && (((((((( !(s24_l0 != 0)) && ( !(s24_l1 != 0))) && (s24_x == 0.0)) && ((( !(s24_evt2 != 0)) && ((s24_evt0 != 0) && ( !(s24_evt1 != 0)))) || (((( !(s24_evt2 != 0)) && (( !(s24_evt0 != 0)) && ( !(s24_evt1 != 0)))) || ((s24_evt2 != 0) && (( !(s24_evt0 != 0)) && ( !(s24_evt1 != 0))))) || ((( !(s24_evt2 != 0)) && ((s24_evt1 != 0) && ( !(s24_evt0 != 0)))) || ((s24_evt2 != 0) && ((s24_evt1 != 0) && ( !(s24_evt0 != 0)))))))) && ((( !(s24_l0 != 0)) && ( !(s24_l1 != 0))) || (((s24_l1 != 0) && ( !(s24_l0 != 0))) || ((s24_l0 != 0) && ( !(s24_l1 != 0)))))) && (13.0 <= s24_backoff)) && (( !(s24_lambda <= 0.0)) && ((s24_x <= s24_lambda) || ( !((s24_l1 != 0) && ( !(s24_l0 != 0))))))) && (((((((( !(s23_l0 != 0)) && ( !(s23_l1 != 0))) && (s23_x == 0.0)) && ((( !(s23_evt2 != 0)) && ((s23_evt0 != 0) && ( !(s23_evt1 != 0)))) || (((( !(s23_evt2 != 0)) && (( !(s23_evt0 != 0)) && ( !(s23_evt1 != 0)))) || ((s23_evt2 != 0) && (( !(s23_evt0 != 0)) && ( !(s23_evt1 != 0))))) || ((( !(s23_evt2 != 0)) && ((s23_evt1 != 0) && ( !(s23_evt0 != 0)))) || ((s23_evt2 != 0) && ((s23_evt1 != 0) && ( !(s23_evt0 != 0)))))))) && ((( !(s23_l0 != 0)) && ( !(s23_l1 != 0))) || (((s23_l1 != 0) && ( !(s23_l0 != 0))) || ((s23_l0 != 0) && ( !(s23_l1 != 0)))))) && (13.0 <= s23_backoff)) && (( !(s23_lambda <= 0.0)) && ((s23_x <= s23_lambda) || ( !((s23_l1 != 0) && ( !(s23_l0 != 0))))))) && (((((((( !(s22_l0 != 0)) && ( !(s22_l1 != 0))) && (s22_x == 0.0)) && ((( !(s22_evt2 != 0)) && ((s22_evt0 != 0) && ( !(s22_evt1 != 0)))) || (((( !(s22_evt2 != 0)) && (( !(s22_evt0 != 0)) && ( !(s22_evt1 != 0)))) || ((s22_evt2 != 0) && (( !(s22_evt0 != 0)) && ( !(s22_evt1 != 0))))) || ((( !(s22_evt2 != 0)) && ((s22_evt1 != 0) && ( !(s22_evt0 != 0)))) || ((s22_evt2 != 0) && ((s22_evt1 != 0) && ( !(s22_evt0 != 0)))))))) && ((( !(s22_l0 != 0)) && ( !(s22_l1 != 0))) || (((s22_l1 != 0) && ( !(s22_l0 != 0))) || ((s22_l0 != 0) && ( !(s22_l1 != 0)))))) && (13.0 <= s22_backoff)) && (( !(s22_lambda <= 0.0)) && ((s22_x <= s22_lambda) || ( !((s22_l1 != 0) && ( !(s22_l0 != 0))))))) && (((((((( !(s21_l0 != 0)) && ( !(s21_l1 != 0))) && (s21_x == 0.0)) && ((( !(s21_evt2 != 0)) && ((s21_evt0 != 0) && ( !(s21_evt1 != 0)))) || (((( !(s21_evt2 != 0)) && (( !(s21_evt0 != 0)) && ( !(s21_evt1 != 0)))) || ((s21_evt2 != 0) && (( !(s21_evt0 != 0)) && ( !(s21_evt1 != 0))))) || ((( !(s21_evt2 != 0)) && ((s21_evt1 != 0) && ( !(s21_evt0 != 0)))) || ((s21_evt2 != 0) && ((s21_evt1 != 0) && ( !(s21_evt0 != 0)))))))) && ((( !(s21_l0 != 0)) && ( !(s21_l1 != 0))) || (((s21_l1 != 0) && ( !(s21_l0 != 0))) || ((s21_l0 != 0) && ( !(s21_l1 != 0)))))) && (13.0 <= s21_backoff)) && (( !(s21_lambda <= 0.0)) && ((s21_x <= s21_lambda) || ( !((s21_l1 != 0) && ( !(s21_l0 != 0))))))) && (((((((( !(s20_l0 != 0)) && ( !(s20_l1 != 0))) && (s20_x == 0.0)) && ((( !(s20_evt2 != 0)) && ((s20_evt0 != 0) && ( !(s20_evt1 != 0)))) || (((( !(s20_evt2 != 0)) && (( !(s20_evt0 != 0)) && ( !(s20_evt1 != 0)))) || ((s20_evt2 != 0) && (( !(s20_evt0 != 0)) && ( !(s20_evt1 != 0))))) || ((( !(s20_evt2 != 0)) && ((s20_evt1 != 0) && ( !(s20_evt0 != 0)))) || ((s20_evt2 != 0) && ((s20_evt1 != 0) && ( !(s20_evt0 != 0)))))))) && ((( !(s20_l0 != 0)) && ( !(s20_l1 != 0))) || (((s20_l1 != 0) && ( !(s20_l0 != 0))) || ((s20_l0 != 0) && ( !(s20_l1 != 0)))))) && (13.0 <= s20_backoff)) && (( !(s20_lambda <= 0.0)) && ((s20_x <= s20_lambda) || ( !((s20_l1 != 0) && ( !(s20_l0 != 0))))))) && (((((((( !(s19_l0 != 0)) && ( !(s19_l1 != 0))) && (s19_x == 0.0)) && ((( !(s19_evt2 != 0)) && ((s19_evt0 != 0) && ( !(s19_evt1 != 0)))) || (((( !(s19_evt2 != 0)) && (( !(s19_evt0 != 0)) && ( !(s19_evt1 != 0)))) || ((s19_evt2 != 0) && (( !(s19_evt0 != 0)) && ( !(s19_evt1 != 0))))) || ((( !(s19_evt2 != 0)) && ((s19_evt1 != 0) && ( !(s19_evt0 != 0)))) || ((s19_evt2 != 0) && ((s19_evt1 != 0) && ( !(s19_evt0 != 0)))))))) && ((( !(s19_l0 != 0)) && ( !(s19_l1 != 0))) || (((s19_l1 != 0) && ( !(s19_l0 != 0))) || ((s19_l0 != 0) && ( !(s19_l1 != 0)))))) && (13.0 <= s19_backoff)) && (( !(s19_lambda <= 0.0)) && ((s19_x <= s19_lambda) || ( !((s19_l1 != 0) && ( !(s19_l0 != 0))))))) && (((((((( !(s18_l0 != 0)) && ( !(s18_l1 != 0))) && (s18_x == 0.0)) && ((( !(s18_evt2 != 0)) && ((s18_evt0 != 0) && ( !(s18_evt1 != 0)))) || (((( !(s18_evt2 != 0)) && (( !(s18_evt0 != 0)) && ( !(s18_evt1 != 0)))) || ((s18_evt2 != 0) && (( !(s18_evt0 != 0)) && ( !(s18_evt1 != 0))))) || ((( !(s18_evt2 != 0)) && ((s18_evt1 != 0) && ( !(s18_evt0 != 0)))) || ((s18_evt2 != 0) && ((s18_evt1 != 0) && ( !(s18_evt0 != 0)))))))) && ((( !(s18_l0 != 0)) && ( !(s18_l1 != 0))) || (((s18_l1 != 0) && ( !(s18_l0 != 0))) || ((s18_l0 != 0) && ( !(s18_l1 != 0)))))) && (13.0 <= s18_backoff)) && (( !(s18_lambda <= 0.0)) && ((s18_x <= s18_lambda) || ( !((s18_l1 != 0) && ( !(s18_l0 != 0))))))) && (((((((( !(s17_l0 != 0)) && ( !(s17_l1 != 0))) && (s17_x == 0.0)) && ((( !(s17_evt2 != 0)) && ((s17_evt0 != 0) && ( !(s17_evt1 != 0)))) || (((( !(s17_evt2 != 0)) && (( !(s17_evt0 != 0)) && ( !(s17_evt1 != 0)))) || ((s17_evt2 != 0) && (( !(s17_evt0 != 0)) && ( !(s17_evt1 != 0))))) || ((( !(s17_evt2 != 0)) && ((s17_evt1 != 0) && ( !(s17_evt0 != 0)))) || ((s17_evt2 != 0) && ((s17_evt1 != 0) && ( !(s17_evt0 != 0)))))))) && ((( !(s17_l0 != 0)) && ( !(s17_l1 != 0))) || (((s17_l1 != 0) && ( !(s17_l0 != 0))) || ((s17_l0 != 0) && ( !(s17_l1 != 0)))))) && (13.0 <= s17_backoff)) && (( !(s17_lambda <= 0.0)) && ((s17_x <= s17_lambda) || ( !((s17_l1 != 0) && ( !(s17_l0 != 0))))))) && (((((((( !(s16_l0 != 0)) && ( !(s16_l1 != 0))) && (s16_x == 0.0)) && ((( !(s16_evt2 != 0)) && ((s16_evt0 != 0) && ( !(s16_evt1 != 0)))) || (((( !(s16_evt2 != 0)) && (( !(s16_evt0 != 0)) && ( !(s16_evt1 != 0)))) || ((s16_evt2 != 0) && (( !(s16_evt0 != 0)) && ( !(s16_evt1 != 0))))) || ((( !(s16_evt2 != 0)) && ((s16_evt1 != 0) && ( !(s16_evt0 != 0)))) || ((s16_evt2 != 0) && ((s16_evt1 != 0) && ( !(s16_evt0 != 0)))))))) && ((( !(s16_l0 != 0)) && ( !(s16_l1 != 0))) || (((s16_l1 != 0) && ( !(s16_l0 != 0))) || ((s16_l0 != 0) && ( !(s16_l1 != 0)))))) && (13.0 <= s16_backoff)) && (( !(s16_lambda <= 0.0)) && ((s16_x <= s16_lambda) || ( !((s16_l1 != 0) && ( !(s16_l0 != 0))))))) && (((((((( !(s15_l0 != 0)) && ( !(s15_l1 != 0))) && (s15_x == 0.0)) && ((( !(s15_evt2 != 0)) && ((s15_evt0 != 0) && ( !(s15_evt1 != 0)))) || (((( !(s15_evt2 != 0)) && (( !(s15_evt0 != 0)) && ( !(s15_evt1 != 0)))) || ((s15_evt2 != 0) && (( !(s15_evt0 != 0)) && ( !(s15_evt1 != 0))))) || ((( !(s15_evt2 != 0)) && ((s15_evt1 != 0) && ( !(s15_evt0 != 0)))) || ((s15_evt2 != 0) && ((s15_evt1 != 0) && ( !(s15_evt0 != 0)))))))) && ((( !(s15_l0 != 0)) && ( !(s15_l1 != 0))) || (((s15_l1 != 0) && ( !(s15_l0 != 0))) || ((s15_l0 != 0) && ( !(s15_l1 != 0)))))) && (13.0 <= s15_backoff)) && (( !(s15_lambda <= 0.0)) && ((s15_x <= s15_lambda) || ( !((s15_l1 != 0) && ( !(s15_l0 != 0))))))) && (((((((( !(s14_l0 != 0)) && ( !(s14_l1 != 0))) && (s14_x == 0.0)) && ((( !(s14_evt2 != 0)) && ((s14_evt0 != 0) && ( !(s14_evt1 != 0)))) || (((( !(s14_evt2 != 0)) && (( !(s14_evt0 != 0)) && ( !(s14_evt1 != 0)))) || ((s14_evt2 != 0) && (( !(s14_evt0 != 0)) && ( !(s14_evt1 != 0))))) || ((( !(s14_evt2 != 0)) && ((s14_evt1 != 0) && ( !(s14_evt0 != 0)))) || ((s14_evt2 != 0) && ((s14_evt1 != 0) && ( !(s14_evt0 != 0)))))))) && ((( !(s14_l0 != 0)) && ( !(s14_l1 != 0))) || (((s14_l1 != 0) && ( !(s14_l0 != 0))) || ((s14_l0 != 0) && ( !(s14_l1 != 0)))))) && (13.0 <= s14_backoff)) && (( !(s14_lambda <= 0.0)) && ((s14_x <= s14_lambda) || ( !((s14_l1 != 0) && ( !(s14_l0 != 0))))))) && (((((((( !(s13_l0 != 0)) && ( !(s13_l1 != 0))) && (s13_x == 0.0)) && ((( !(s13_evt2 != 0)) && ((s13_evt0 != 0) && ( !(s13_evt1 != 0)))) || (((( !(s13_evt2 != 0)) && (( !(s13_evt0 != 0)) && ( !(s13_evt1 != 0)))) || ((s13_evt2 != 0) && (( !(s13_evt0 != 0)) && ( !(s13_evt1 != 0))))) || ((( !(s13_evt2 != 0)) && ((s13_evt1 != 0) && ( !(s13_evt0 != 0)))) || ((s13_evt2 != 0) && ((s13_evt1 != 0) && ( !(s13_evt0 != 0)))))))) && ((( !(s13_l0 != 0)) && ( !(s13_l1 != 0))) || (((s13_l1 != 0) && ( !(s13_l0 != 0))) || ((s13_l0 != 0) && ( !(s13_l1 != 0)))))) && (13.0 <= s13_backoff)) && (( !(s13_lambda <= 0.0)) && ((s13_x <= s13_lambda) || ( !((s13_l1 != 0) && ( !(s13_l0 != 0))))))) && (((((((( !(s12_l0 != 0)) && ( !(s12_l1 != 0))) && (s12_x == 0.0)) && ((( !(s12_evt2 != 0)) && ((s12_evt0 != 0) && ( !(s12_evt1 != 0)))) || (((( !(s12_evt2 != 0)) && (( !(s12_evt0 != 0)) && ( !(s12_evt1 != 0)))) || ((s12_evt2 != 0) && (( !(s12_evt0 != 0)) && ( !(s12_evt1 != 0))))) || ((( !(s12_evt2 != 0)) && ((s12_evt1 != 0) && ( !(s12_evt0 != 0)))) || ((s12_evt2 != 0) && ((s12_evt1 != 0) && ( !(s12_evt0 != 0)))))))) && ((( !(s12_l0 != 0)) && ( !(s12_l1 != 0))) || (((s12_l1 != 0) && ( !(s12_l0 != 0))) || ((s12_l0 != 0) && ( !(s12_l1 != 0)))))) && (13.0 <= s12_backoff)) && (( !(s12_lambda <= 0.0)) && ((s12_x <= s12_lambda) || ( !((s12_l1 != 0) && ( !(s12_l0 != 0))))))) && (((((((( !(s11_l0 != 0)) && ( !(s11_l1 != 0))) && (s11_x == 0.0)) && ((( !(s11_evt2 != 0)) && ((s11_evt0 != 0) && ( !(s11_evt1 != 0)))) || (((( !(s11_evt2 != 0)) && (( !(s11_evt0 != 0)) && ( !(s11_evt1 != 0)))) || ((s11_evt2 != 0) && (( !(s11_evt0 != 0)) && ( !(s11_evt1 != 0))))) || ((( !(s11_evt2 != 0)) && ((s11_evt1 != 0) && ( !(s11_evt0 != 0)))) || ((s11_evt2 != 0) && ((s11_evt1 != 0) && ( !(s11_evt0 != 0)))))))) && ((( !(s11_l0 != 0)) && ( !(s11_l1 != 0))) || (((s11_l1 != 0) && ( !(s11_l0 != 0))) || ((s11_l0 != 0) && ( !(s11_l1 != 0)))))) && (13.0 <= s11_backoff)) && (( !(s11_lambda <= 0.0)) && ((s11_x <= s11_lambda) || ( !((s11_l1 != 0) && ( !(s11_l0 != 0))))))) && (((((((( !(s10_l0 != 0)) && ( !(s10_l1 != 0))) && (s10_x == 0.0)) && ((( !(s10_evt2 != 0)) && ((s10_evt0 != 0) && ( !(s10_evt1 != 0)))) || (((( !(s10_evt2 != 0)) && (( !(s10_evt0 != 0)) && ( !(s10_evt1 != 0)))) || ((s10_evt2 != 0) && (( !(s10_evt0 != 0)) && ( !(s10_evt1 != 0))))) || ((( !(s10_evt2 != 0)) && ((s10_evt1 != 0) && ( !(s10_evt0 != 0)))) || ((s10_evt2 != 0) && ((s10_evt1 != 0) && ( !(s10_evt0 != 0)))))))) && ((( !(s10_l0 != 0)) && ( !(s10_l1 != 0))) || (((s10_l1 != 0) && ( !(s10_l0 != 0))) || ((s10_l0 != 0) && ( !(s10_l1 != 0)))))) && (13.0 <= s10_backoff)) && (( !(s10_lambda <= 0.0)) && ((s10_x <= s10_lambda) || ( !((s10_l1 != 0) && ( !(s10_l0 != 0))))))) && (((((((( !(s9_l0 != 0)) && ( !(s9_l1 != 0))) && (s9_x == 0.0)) && ((( !(s9_evt2 != 0)) && ((s9_evt0 != 0) && ( !(s9_evt1 != 0)))) || (((( !(s9_evt2 != 0)) && (( !(s9_evt0 != 0)) && ( !(s9_evt1 != 0)))) || ((s9_evt2 != 0) && (( !(s9_evt0 != 0)) && ( !(s9_evt1 != 0))))) || ((( !(s9_evt2 != 0)) && ((s9_evt1 != 0) && ( !(s9_evt0 != 0)))) || ((s9_evt2 != 0) && ((s9_evt1 != 0) && ( !(s9_evt0 != 0)))))))) && ((( !(s9_l0 != 0)) && ( !(s9_l1 != 0))) || (((s9_l1 != 0) && ( !(s9_l0 != 0))) || ((s9_l0 != 0) && ( !(s9_l1 != 0)))))) && (13.0 <= s9_backoff)) && (( !(s9_lambda <= 0.0)) && ((s9_x <= s9_lambda) || ( !((s9_l1 != 0) && ( !(s9_l0 != 0))))))) && (((((((( !(s8_l0 != 0)) && ( !(s8_l1 != 0))) && (s8_x == 0.0)) && ((( !(s8_evt2 != 0)) && ((s8_evt0 != 0) && ( !(s8_evt1 != 0)))) || (((( !(s8_evt2 != 0)) && (( !(s8_evt0 != 0)) && ( !(s8_evt1 != 0)))) || ((s8_evt2 != 0) && (( !(s8_evt0 != 0)) && ( !(s8_evt1 != 0))))) || ((( !(s8_evt2 != 0)) && ((s8_evt1 != 0) && ( !(s8_evt0 != 0)))) || ((s8_evt2 != 0) && ((s8_evt1 != 0) && ( !(s8_evt0 != 0)))))))) && ((( !(s8_l0 != 0)) && ( !(s8_l1 != 0))) || (((s8_l1 != 0) && ( !(s8_l0 != 0))) || ((s8_l0 != 0) && ( !(s8_l1 != 0)))))) && (13.0 <= s8_backoff)) && (( !(s8_lambda <= 0.0)) && ((s8_x <= s8_lambda) || ( !((s8_l1 != 0) && ( !(s8_l0 != 0))))))) && (((((((( !(s7_l0 != 0)) && ( !(s7_l1 != 0))) && (s7_x == 0.0)) && ((( !(s7_evt2 != 0)) && ((s7_evt0 != 0) && ( !(s7_evt1 != 0)))) || (((( !(s7_evt2 != 0)) && (( !(s7_evt0 != 0)) && ( !(s7_evt1 != 0)))) || ((s7_evt2 != 0) && (( !(s7_evt0 != 0)) && ( !(s7_evt1 != 0))))) || ((( !(s7_evt2 != 0)) && ((s7_evt1 != 0) && ( !(s7_evt0 != 0)))) || ((s7_evt2 != 0) && ((s7_evt1 != 0) && ( !(s7_evt0 != 0)))))))) && ((( !(s7_l0 != 0)) && ( !(s7_l1 != 0))) || (((s7_l1 != 0) && ( !(s7_l0 != 0))) || ((s7_l0 != 0) && ( !(s7_l1 != 0)))))) && (13.0 <= s7_backoff)) && (( !(s7_lambda <= 0.0)) && ((s7_x <= s7_lambda) || ( !((s7_l1 != 0) && ( !(s7_l0 != 0))))))) && (((((((( !(s6_l0 != 0)) && ( !(s6_l1 != 0))) && (s6_x == 0.0)) && ((( !(s6_evt2 != 0)) && ((s6_evt0 != 0) && ( !(s6_evt1 != 0)))) || (((( !(s6_evt2 != 0)) && (( !(s6_evt0 != 0)) && ( !(s6_evt1 != 0)))) || ((s6_evt2 != 0) && (( !(s6_evt0 != 0)) && ( !(s6_evt1 != 0))))) || ((( !(s6_evt2 != 0)) && ((s6_evt1 != 0) && ( !(s6_evt0 != 0)))) || ((s6_evt2 != 0) && ((s6_evt1 != 0) && ( !(s6_evt0 != 0)))))))) && ((( !(s6_l0 != 0)) && ( !(s6_l1 != 0))) || (((s6_l1 != 0) && ( !(s6_l0 != 0))) || ((s6_l0 != 0) && ( !(s6_l1 != 0)))))) && (13.0 <= s6_backoff)) && (( !(s6_lambda <= 0.0)) && ((s6_x <= s6_lambda) || ( !((s6_l1 != 0) && ( !(s6_l0 != 0))))))) && (((((((( !(s5_l0 != 0)) && ( !(s5_l1 != 0))) && (s5_x == 0.0)) && ((( !(s5_evt2 != 0)) && ((s5_evt0 != 0) && ( !(s5_evt1 != 0)))) || (((( !(s5_evt2 != 0)) && (( !(s5_evt0 != 0)) && ( !(s5_evt1 != 0)))) || ((s5_evt2 != 0) && (( !(s5_evt0 != 0)) && ( !(s5_evt1 != 0))))) || ((( !(s5_evt2 != 0)) && ((s5_evt1 != 0) && ( !(s5_evt0 != 0)))) || ((s5_evt2 != 0) && ((s5_evt1 != 0) && ( !(s5_evt0 != 0)))))))) && ((( !(s5_l0 != 0)) && ( !(s5_l1 != 0))) || (((s5_l1 != 0) && ( !(s5_l0 != 0))) || ((s5_l0 != 0) && ( !(s5_l1 != 0)))))) && (13.0 <= s5_backoff)) && (( !(s5_lambda <= 0.0)) && ((s5_x <= s5_lambda) || ( !((s5_l1 != 0) && ( !(s5_l0 != 0))))))) && (((((((( !(s4_l0 != 0)) && ( !(s4_l1 != 0))) && (s4_x == 0.0)) && ((( !(s4_evt2 != 0)) && ((s4_evt0 != 0) && ( !(s4_evt1 != 0)))) || (((( !(s4_evt2 != 0)) && (( !(s4_evt0 != 0)) && ( !(s4_evt1 != 0)))) || ((s4_evt2 != 0) && (( !(s4_evt0 != 0)) && ( !(s4_evt1 != 0))))) || ((( !(s4_evt2 != 0)) && ((s4_evt1 != 0) && ( !(s4_evt0 != 0)))) || ((s4_evt2 != 0) && ((s4_evt1 != 0) && ( !(s4_evt0 != 0)))))))) && ((( !(s4_l0 != 0)) && ( !(s4_l1 != 0))) || (((s4_l1 != 0) && ( !(s4_l0 != 0))) || ((s4_l0 != 0) && ( !(s4_l1 != 0)))))) && (13.0 <= s4_backoff)) && (( !(s4_lambda <= 0.0)) && ((s4_x <= s4_lambda) || ( !((s4_l1 != 0) && ( !(s4_l0 != 0))))))) && (((((((( !(s3_l0 != 0)) && ( !(s3_l1 != 0))) && (s3_x == 0.0)) && ((( !(s3_evt2 != 0)) && ((s3_evt0 != 0) && ( !(s3_evt1 != 0)))) || (((( !(s3_evt2 != 0)) && (( !(s3_evt0 != 0)) && ( !(s3_evt1 != 0)))) || ((s3_evt2 != 0) && (( !(s3_evt0 != 0)) && ( !(s3_evt1 != 0))))) || ((( !(s3_evt2 != 0)) && ((s3_evt1 != 0) && ( !(s3_evt0 != 0)))) || ((s3_evt2 != 0) && ((s3_evt1 != 0) && ( !(s3_evt0 != 0)))))))) && ((( !(s3_l0 != 0)) && ( !(s3_l1 != 0))) || (((s3_l1 != 0) && ( !(s3_l0 != 0))) || ((s3_l0 != 0) && ( !(s3_l1 != 0)))))) && (13.0 <= s3_backoff)) && (( !(s3_lambda <= 0.0)) && ((s3_x <= s3_lambda) || ( !((s3_l1 != 0) && ( !(s3_l0 != 0))))))) && (((((((( !(s2_l0 != 0)) && ( !(s2_l1 != 0))) && (s2_x == 0.0)) && ((( !(s2_evt2 != 0)) && ((s2_evt0 != 0) && ( !(s2_evt1 != 0)))) || (((( !(s2_evt2 != 0)) && (( !(s2_evt0 != 0)) && ( !(s2_evt1 != 0)))) || ((s2_evt2 != 0) && (( !(s2_evt0 != 0)) && ( !(s2_evt1 != 0))))) || ((( !(s2_evt2 != 0)) && ((s2_evt1 != 0) && ( !(s2_evt0 != 0)))) || ((s2_evt2 != 0) && ((s2_evt1 != 0) && ( !(s2_evt0 != 0)))))))) && ((( !(s2_l0 != 0)) && ( !(s2_l1 != 0))) || (((s2_l1 != 0) && ( !(s2_l0 != 0))) || ((s2_l0 != 0) && ( !(s2_l1 != 0)))))) && (13.0 <= s2_backoff)) && (( !(s2_lambda <= 0.0)) && ((s2_x <= s2_lambda) || ( !((s2_l1 != 0) && ( !(s2_l0 != 0))))))) && (((((((( !(s1_l0 != 0)) && ( !(s1_l1 != 0))) && (s1_x == 0.0)) && ((( !(s1_evt2 != 0)) && ((s1_evt0 != 0) && ( !(s1_evt1 != 0)))) || (((( !(s1_evt2 != 0)) && (( !(s1_evt0 != 0)) && ( !(s1_evt1 != 0)))) || ((s1_evt2 != 0) && (( !(s1_evt0 != 0)) && ( !(s1_evt1 != 0))))) || ((( !(s1_evt2 != 0)) && ((s1_evt1 != 0) && ( !(s1_evt0 != 0)))) || ((s1_evt2 != 0) && ((s1_evt1 != 0) && ( !(s1_evt0 != 0)))))))) && ((( !(s1_l0 != 0)) && ( !(s1_l1 != 0))) || (((s1_l1 != 0) && ( !(s1_l0 != 0))) || ((s1_l0 != 0) && ( !(s1_l1 != 0)))))) && (13.0 <= s1_backoff)) && (( !(s1_lambda <= 0.0)) && ((s1_x <= s1_lambda) || ( !((s1_l1 != 0) && ( !(s1_l0 != 0))))))) && (((((((( !(s0_l0 != 0)) && ( !(s0_l1 != 0))) && (s0_x == 0.0)) && ((( !(s0_evt2 != 0)) && ((s0_evt0 != 0) && ( !(s0_evt1 != 0)))) || (((( !(s0_evt2 != 0)) && (( !(s0_evt0 != 0)) && ( !(s0_evt1 != 0)))) || ((s0_evt2 != 0) && (( !(s0_evt0 != 0)) && ( !(s0_evt1 != 0))))) || ((( !(s0_evt2 != 0)) && ((s0_evt1 != 0) && ( !(s0_evt0 != 0)))) || ((s0_evt2 != 0) && ((s0_evt1 != 0) && ( !(s0_evt0 != 0)))))))) && ((( !(s0_l0 != 0)) && ( !(s0_l1 != 0))) || (((s0_l1 != 0) && ( !(s0_l0 != 0))) || ((s0_l0 != 0) && ( !(s0_l1 != 0)))))) && (13.0 <= s0_backoff)) && (( !(s0_lambda <= 0.0)) && ((s0_x <= s0_lambda) || ( !((s0_l1 != 0) && ( !(s0_l0 != 0))))))) && (((((( !(bus_l0 != 0)) && ( !(bus_l1 != 0))) && (((( !(bus_evt2 != 0)) && (( !(bus_evt0 != 0)) && ( !(bus_evt1 != 0)))) || ((((bus_evt2 != 0) && (( !(bus_evt0 != 0)) && ( !(bus_evt1 != 0)))) || (( !(bus_evt2 != 0)) && ((bus_evt1 != 0) && ( !(bus_evt0 != 0))))) || (((bus_evt2 != 0) && ((bus_evt1 != 0) && ( !(bus_evt0 != 0)))) || (( !(bus_evt2 != 0)) && ((bus_evt0 != 0) && ( !(bus_evt1 != 0))))))) && (((( !(bus_l0 != 0)) && ( !(bus_l1 != 0))) || ((bus_l1 != 0) && ( !(bus_l0 != 0)))) || (((bus_l0 != 0) && ( !(bus_l1 != 0))) || ((bus_l0 != 0) && (bus_l1 != 0)))))) && ((bus_j == 0) && (bus_x == 0.0))) && ((( !(13.0 <= bus_x)) || ( !((bus_l0 != 0) && ( !(bus_l1 != 0))))) && ((delta == 0.0) || ( !((bus_l0 != 0) && (bus_l1 != 0)))))) && (0.0 <= delta)))))))))))))))))))))))))))) && (delta == _diverge_delta));
while (__ok) {
_x__diverge_delta = __VERIFIER_nondet_float();
_x_s25_l0 = __VERIFIER_nondet_bool();
_x_s25_evt1 = __VERIFIER_nondet_bool();
_x_s25_evt0 = __VERIFIER_nondet_bool();
_x_s25_x = __VERIFIER_nondet_float();
_x_s24_l1 = __VERIFIER_nondet_bool();
_x_s24_l0 = __VERIFIER_nondet_bool();
_x_s24_evt2 = __VERIFIER_nondet_bool();
_x_s24_evt1 = __VERIFIER_nondet_bool();
_x_s24_evt0 = __VERIFIER_nondet_bool();
_x_s24_x = __VERIFIER_nondet_float();
_x_s23_l1 = __VERIFIER_nondet_bool();
_x_s23_l0 = __VERIFIER_nondet_bool();
_x_s23_evt2 = __VERIFIER_nondet_bool();
_x_s23_evt1 = __VERIFIER_nondet_bool();
_x_s23_evt0 = __VERIFIER_nondet_bool();
_x_s23_x = __VERIFIER_nondet_float();
_x_s25_backoff = __VERIFIER_nondet_float();
_x_s22_l1 = __VERIFIER_nondet_bool();
_x_s25_lambda = __VERIFIER_nondet_float();
_x_s22_l0 = __VERIFIER_nondet_bool();
_x_s22_evt2 = __VERIFIER_nondet_bool();
_x_s22_evt1 = __VERIFIER_nondet_bool();
_x_s22_evt0 = __VERIFIER_nondet_bool();
_x_s22_x = __VERIFIER_nondet_float();
_x_s24_backoff = __VERIFIER_nondet_float();
_x_s21_l1 = __VERIFIER_nondet_bool();
_x_s24_lambda = __VERIFIER_nondet_float();
_x_s21_l0 = __VERIFIER_nondet_bool();
_x_s21_evt2 = __VERIFIER_nondet_bool();
_x_s21_evt1 = __VERIFIER_nondet_bool();
_x_s21_evt0 = __VERIFIER_nondet_bool();
_x_s21_x = __VERIFIER_nondet_float();
_x_s23_backoff = __VERIFIER_nondet_float();
_x_s20_l1 = __VERIFIER_nondet_bool();
_x_s23_lambda = __VERIFIER_nondet_float();
_x_s20_l0 = __VERIFIER_nondet_bool();
_x_s20_evt2 = __VERIFIER_nondet_bool();
_x_s20_evt1 = __VERIFIER_nondet_bool();
_x_s20_evt0 = __VERIFIER_nondet_bool();
_x_s20_x = __VERIFIER_nondet_float();
_x_s19_x = __VERIFIER_nondet_float();
_x_s21_backoff = __VERIFIER_nondet_float();
_x_s18_l1 = __VERIFIER_nondet_bool();
_x_s21_lambda = __VERIFIER_nondet_float();
_x_s18_l0 = __VERIFIER_nondet_bool();
_x_s18_evt2 = __VERIFIER_nondet_bool();
_x_s18_evt1 = __VERIFIER_nondet_bool();
_x_s18_evt0 = __VERIFIER_nondet_bool();
_x_s18_x = __VERIFIER_nondet_float();
_x_s20_backoff = __VERIFIER_nondet_float();
_x_s17_l1 = __VERIFIER_nondet_bool();
_x_s20_lambda = __VERIFIER_nondet_float();
_x_s17_l0 = __VERIFIER_nondet_bool();
_x_s17_evt2 = __VERIFIER_nondet_bool();
_x_s17_evt1 = __VERIFIER_nondet_bool();
_x_s17_evt0 = __VERIFIER_nondet_bool();
_x_s17_x = __VERIFIER_nondet_float();
_x_s16_evt2 = __VERIFIER_nondet_bool();
_x_s16_evt1 = __VERIFIER_nondet_bool();
_x_s16_evt0 = __VERIFIER_nondet_bool();
_x_s16_x = __VERIFIER_nondet_float();
_x_s18_backoff = __VERIFIER_nondet_float();
_x_s15_l1 = __VERIFIER_nondet_bool();
_x_s18_lambda = __VERIFIER_nondet_float();
_x_s15_l0 = __VERIFIER_nondet_bool();
_x_s15_evt2 = __VERIFIER_nondet_bool();
_x_s15_evt1 = __VERIFIER_nondet_bool();
_x_s15_evt0 = __VERIFIER_nondet_bool();
_x_s15_x = __VERIFIER_nondet_float();
_x_s17_backoff = __VERIFIER_nondet_float();
_x_s14_l1 = __VERIFIER_nondet_bool();
_x_s17_lambda = __VERIFIER_nondet_float();
_x_s14_l0 = __VERIFIER_nondet_bool();
_x_s4_evt0 = __VERIFIER_nondet_bool();
_x_s16_backoff = __VERIFIER_nondet_float();
_x_s13_l1 = __VERIFIER_nondet_bool();
_x_s4_x = __VERIFIER_nondet_float();
_x_s19_evt2 = __VERIFIER_nondet_bool();
_x_bus_evt2 = __VERIFIER_nondet_bool();
_x_s3_evt0 = __VERIFIER_nondet_bool();
_x_s15_backoff = __VERIFIER_nondet_float();
_x_s12_l1 = __VERIFIER_nondet_bool();
_x_s3_x = __VERIFIER_nondet_float();
_x_s5_evt2 = __VERIFIER_nondet_bool();
_x_s5_evt1 = __VERIFIER_nondet_bool();
_x_s2_evt2 = __VERIFIER_nondet_bool();
_x_s3_l1 = __VERIFIER_nondet_bool();
_x_s6_backoff = __VERIFIER_nondet_float();
_x_s2_evt1 = __VERIFIER_nondet_bool();
_x_s14_x = __VERIFIER_nondet_float();
_x_s0_lambda = __VERIFIER_nondet_float();
_x_s22_lambda = __VERIFIER_nondet_float();
_x_s19_l0 = __VERIFIER_nondet_bool();
_x_bus_l0 = __VERIFIER_nondet_bool();
_x_s5_x = __VERIFIER_nondet_float();
_x_s0_backoff = __VERIFIER_nondet_float();
_x_s25_evt2 = __VERIFIER_nondet_bool();
_x_s0_x = __VERIFIER_nondet_float();
_x_s14_evt2 = __VERIFIER_nondet_bool();
_x_s2_evt0 = __VERIFIER_nondet_bool();
_x_s4_evt1 = __VERIFIER_nondet_bool();
_x_s19_evt0 = __VERIFIER_nondet_bool();
_x_bus_evt0 = __VERIFIER_nondet_bool();
_x_s19_evt1 = __VERIFIER_nondet_bool();
_x_bus_evt1 = __VERIFIER_nondet_bool();
_x_s1_l0 = __VERIFIER_nondet_bool();
_x_s4_lambda = __VERIFIER_nondet_float();
_x_s0_evt0 = __VERIFIER_nondet_bool();
_x_s19_lambda = __VERIFIER_nondet_float();
_x_s16_l0 = __VERIFIER_nondet_bool();
_x_bus_cd_id = __VERIFIER_nondet_int();
_x_s6_evt2 = __VERIFIER_nondet_bool();
_x_s1_l1 = __VERIFIER_nondet_bool();
_x_s4_backoff = __VERIFIER_nondet_float();
_x_s0_evt1 = __VERIFIER_nondet_bool();
_x_s12_x = __VERIFIER_nondet_float();
_x_s15_lambda = __VERIFIER_nondet_float();
_x_s12_l0 = __VERIFIER_nondet_bool();
_x_s19_backoff = __VERIFIER_nondet_float();
_x_s16_l1 = __VERIFIER_nondet_bool();
_x_bus_j = __VERIFIER_nondet_int();
_x_s5_evt0 = __VERIFIER_nondet_bool();
_x_s0_evt2 = __VERIFIER_nondet_bool();
_x_s25_l1 = __VERIFIER_nondet_bool();
_x_delta = __VERIFIER_nondet_float();
_x_s4_l1 = __VERIFIER_nondet_bool();
_x_s7_backoff = __VERIFIER_nondet_float();
_x_s3_evt1 = __VERIFIER_nondet_bool();
_x_s3_lambda = __VERIFIER_nondet_float();
_x_s0_l0 = __VERIFIER_nondet_bool();
_x_s2_lambda = __VERIFIER_nondet_float();
_x_s3_evt2 = __VERIFIER_nondet_bool();
_x_s3_backoff = __VERIFIER_nondet_float();
_x_s0_l1 = __VERIFIER_nondet_bool();
_x_s2_backoff = __VERIFIER_nondet_float();
_x_s1_x = __VERIFIER_nondet_float();
_x_s6_x = __VERIFIER_nondet_float();
_x_s1_backoff = __VERIFIER_nondet_float();
_x_s1_lambda = __VERIFIER_nondet_float();
_x_s2_l0 = __VERIFIER_nondet_bool();
_x_s5_lambda = __VERIFIER_nondet_float();
_x_s1_evt0 = __VERIFIER_nondet_bool();
_x_s2_l1 = __VERIFIER_nondet_bool();
_x_s5_backoff = __VERIFIER_nondet_float();
_x_s1_evt1 = __VERIFIER_nondet_bool();
_x_s13_x = __VERIFIER_nondet_float();
_x_s1_evt2 = __VERIFIER_nondet_bool();
_x_s4_evt2 = __VERIFIER_nondet_bool();
_x_s22_backoff = __VERIFIER_nondet_float();
_x_s19_l1 = __VERIFIER_nondet_bool();
_x_bus_l1 = __VERIFIER_nondet_bool();
_x_s9_evt0 = __VERIFIER_nondet_bool();
_x_s2_x = __VERIFIER_nondet_float();
_x_s3_l0 = __VERIFIER_nondet_bool();
_x_s6_lambda = __VERIFIER_nondet_float();
_x_s6_evt0 = __VERIFIER_nondet_bool();
_x_s6_evt1 = __VERIFIER_nondet_bool();
_x_s7_x = __VERIFIER_nondet_float();
_x_s4_l0 = __VERIFIER_nondet_bool();
_x_s7_lambda = __VERIFIER_nondet_float();
_x_s7_evt0 = __VERIFIER_nondet_bool();
_x_s7_evt1 = __VERIFIER_nondet_bool();
_x_s7_evt2 = __VERIFIER_nondet_bool();
_x_s8_x = __VERIFIER_nondet_float();
_x_s5_l1 = __VERIFIER_nondet_bool();
_x_s8_backoff = __VERIFIER_nondet_float();
_x_s5_l0 = __VERIFIER_nondet_bool();
_x_s8_lambda = __VERIFIER_nondet_float();
_x_s8_evt0 = __VERIFIER_nondet_bool();
_x_s8_evt1 = __VERIFIER_nondet_bool();
_x_s8_evt2 = __VERIFIER_nondet_bool();
_x_s9_x = __VERIFIER_nondet_float();
_x_s6_l1 = __VERIFIER_nondet_bool();
_x_s9_backoff = __VERIFIER_nondet_float();
_x_s6_l0 = __VERIFIER_nondet_bool();
_x_s9_lambda = __VERIFIER_nondet_float();
_x_s9_evt1 = __VERIFIER_nondet_bool();
_x_s9_evt2 = __VERIFIER_nondet_bool();
_x_s12_lambda = __VERIFIER_nondet_float();
_x_s9_l0 = __VERIFIER_nondet_bool();
_x_s10_x = __VERIFIER_nondet_float();
_x_s7_l1 = __VERIFIER_nondet_bool();
_x_s10_backoff = __VERIFIER_nondet_float();
_x_s7_l0 = __VERIFIER_nondet_bool();
_x_s10_lambda = __VERIFIER_nondet_float();
_x_bus_x = __VERIFIER_nondet_float();
_x_s10_evt0 = __VERIFIER_nondet_bool();
_x_s10_evt1 = __VERIFIER_nondet_bool();
_x_s10_evt2 = __VERIFIER_nondet_bool();
_x_s13_lambda = __VERIFIER_nondet_float();
_x_s10_l0 = __VERIFIER_nondet_bool();
_x_s11_x = __VERIFIER_nondet_float();
_x_s8_l1 = __VERIFIER_nondet_bool();
_x_s11_backoff = __VERIFIER_nondet_float();
_x_s8_l0 = __VERIFIER_nondet_bool();
_x_s11_lambda = __VERIFIER_nondet_float();
_x_s11_evt0 = __VERIFIER_nondet_bool();
_x_s11_evt1 = __VERIFIER_nondet_bool();
_x_s11_evt2 = __VERIFIER_nondet_bool();
_x_s14_lambda = __VERIFIER_nondet_float();
_x_s11_l0 = __VERIFIER_nondet_bool();
_x_s9_l1 = __VERIFIER_nondet_bool();
_x_s12_backoff = __VERIFIER_nondet_float();
_x_s12_evt0 = __VERIFIER_nondet_bool();
_x_s12_evt1 = __VERIFIER_nondet_bool();
_x_s12_evt2 = __VERIFIER_nondet_bool();
_x_s10_l1 = __VERIFIER_nondet_bool();
_x_s13_backoff = __VERIFIER_nondet_float();
_x_s13_evt0 = __VERIFIER_nondet_bool();
_x_s13_evt1 = __VERIFIER_nondet_bool();
_x_s13_evt2 = __VERIFIER_nondet_bool();
_x_s16_lambda = __VERIFIER_nondet_float();
_x_s13_l0 = __VERIFIER_nondet_bool();
_x_s11_l1 = __VERIFIER_nondet_bool();
_x_s14_backoff = __VERIFIER_nondet_float();
_x_s14_evt0 = __VERIFIER_nondet_bool();
_x_s14_evt1 = __VERIFIER_nondet_bool();
__ok = ((((((((((((((((((((((( !(_x_s25_evt2 != 0)) && ((_x_s25_evt0 != 0) && ( !(_x_s25_evt1 != 0)))) || (((( !(_x_s25_evt2 != 0)) && (( !(_x_s25_evt0 != 0)) && ( !(_x_s25_evt1 != 0)))) || ((_x_s25_evt2 != 0) && (( !(_x_s25_evt0 != 0)) && ( !(_x_s25_evt1 != 0))))) || ((( !(_x_s25_evt2 != 0)) && ((_x_s25_evt1 != 0) && ( !(_x_s25_evt0 != 0)))) || ((_x_s25_evt2 != 0) && ((_x_s25_evt1 != 0) && ( !(_x_s25_evt0 != 0))))))) && ((( !(_x_s25_l0 != 0)) && ( !(_x_s25_l1 != 0))) || (((_x_s25_l1 != 0) && ( !(_x_s25_l0 != 0))) || ((_x_s25_l0 != 0) && ( !(_x_s25_l1 != 0)))))) && (13.0 <= _x_s25_backoff)) && (( !(_x_s25_lambda <= 0.0)) && ((_x_s25_x <= _x_s25_lambda) || ( !((_x_s25_l1 != 0) && ( !(_x_s25_l0 != 0))))))) && ((((((s25_l0 != 0) == (_x_s25_l0 != 0)) && ((s25_l1 != 0) == (_x_s25_l1 != 0))) && (s25_lambda == _x_s25_lambda)) && (((delta + (s25_x + (-1.0 * _x_s25_x))) == 0.0) && (s25_backoff == _x_s25_backoff))) || ( !(( !(delta <= 0.0)) || (( !(s25_evt2 != 0)) && (( !(s25_evt0 != 0)) && ( !(s25_evt1 != 0)))))))) && (((((_x_s25_l0 != 0) && ( !(_x_s25_l1 != 0))) || ((( !(_x_s25_l0 != 0)) && ( !(_x_s25_l1 != 0))) || ((_x_s25_l1 != 0) && ( !(_x_s25_l0 != 0))))) && ((s25_backoff == _x_s25_backoff) && (_x_s25_x == 0.0))) || ( !((( !(s25_l0 != 0)) && ( !(s25_l1 != 0))) && ((delta == 0.0) && ( !(( !(s25_evt2 != 0)) && (( !(s25_evt0 != 0)) && ( !(s25_evt1 != 0)))))))))) && (((( !(s25_evt2 != 0)) && ((s25_evt0 != 0) && ( !(s25_evt1 != 0)))) && (s25_lambda == _x_s25_lambda)) || ( !((( !(_x_s25_l0 != 0)) && ( !(_x_s25_l1 != 0))) && ((( !(s25_l0 != 0)) && ( !(s25_l1 != 0))) && ((delta == 0.0) && ( !(( !(s25_evt2 != 0)) && (( !(s25_evt0 != 0)) && ( !(s25_evt1 != 0))))))))))) && (((s25_evt2 != 0) && (( !(s25_evt0 != 0)) && ( !(s25_evt1 != 0)))) || ( !(((_x_s25_l1 != 0) && ( !(_x_s25_l0 != 0))) && ((( !(s25_l0 != 0)) && ( !(s25_l1 != 0))) && ((delta == 0.0) && ( !(( !(s25_evt2 != 0)) && (( !(s25_evt0 != 0)) && ( !(s25_evt1 != 0))))))))))) && (((s25_lambda == _x_s25_lambda) && (((s25_evt2 != 0) && ((s25_evt1 != 0) && ( !(s25_evt0 != 0)))) || (( !(s25_evt2 != 0)) && ((s25_evt0 != 0) && ( !(s25_evt1 != 0)))))) || ( !(((_x_s25_l0 != 0) && ( !(_x_s25_l1 != 0))) && ((( !(s25_l0 != 0)) && ( !(s25_l1 != 0))) && ((delta == 0.0) && ( !(( !(s25_evt2 != 0)) && (( !(s25_evt0 != 0)) && ( !(s25_evt1 != 0))))))))))) && ((((s25_lambda == _x_s25_lambda) && (_x_s25_x == 0.0)) && ((( !(_x_s25_l0 != 0)) && ( !(_x_s25_l1 != 0))) || ((_x_s25_l0 != 0) && ( !(_x_s25_l1 != 0))))) || ( !(((s25_l1 != 0) && ( !(s25_l0 != 0))) && ((delta == 0.0) && ( !(( !(s25_evt2 != 0)) && (( !(s25_evt0 != 0)) && ( !(s25_evt1 != 0)))))))))) && (((s25_lambda <= s25_x) && ((( !(s25_evt2 != 0)) && ((s25_evt1 != 0) && ( !(s25_evt0 != 0)))) && (_x_s25_backoff <= s25_backoff))) || ( !((( !(_x_s25_l0 != 0)) && ( !(_x_s25_l1 != 0))) && (((s25_l1 != 0) && ( !(s25_l0 != 0))) && ((delta == 0.0) && ( !(( !(s25_evt2 != 0)) && (( !(s25_evt0 != 0)) && ( !(s25_evt1 != 0))))))))))) && (((( !(s25_evt2 != 0)) && ((s25_evt0 != 0) && ( !(s25_evt1 != 0)))) && ((s25_backoff + (-1.0 * _x_s25_backoff)) <= -1.0)) || ( !(((_x_s25_l0 != 0) && ( !(_x_s25_l1 != 0))) && (((s25_l1 != 0) && ( !(s25_l0 != 0))) && ((delta == 0.0) && ( !(( !(s25_evt2 != 0)) && (( !(s25_evt0 != 0)) && ( !(s25_evt1 != 0))))))))))) && (((s25_lambda == _x_s25_lambda) && ((((_x_s25_l1 != 0) && ( !(_x_s25_l0 != 0))) || ((_x_s25_l0 != 0) && ( !(_x_s25_l1 != 0)))) && ((s25_backoff == _x_s25_backoff) && (_x_s25_x == 0.0)))) || ( !(((s25_l0 != 0) && ( !(s25_l1 != 0))) && ((delta == 0.0) && ( !(( !(s25_evt2 != 0)) && (( !(s25_evt0 != 0)) && ( !(s25_evt1 != 0)))))))))) && ((( !(s25_evt2 != 0)) && ((s25_evt0 != 0) && ( !(s25_evt1 != 0)))) || ( !(((_x_s25_l0 != 0) && ( !(_x_s25_l1 != 0))) && (((s25_l0 != 0) && ( !(s25_l1 != 0))) && ((delta == 0.0) && ( !(( !(s25_evt2 != 0)) && (( !(s25_evt0 != 0)) && ( !(s25_evt1 != 0))))))))))) && ((((s25_evt2 != 0) && (( !(s25_evt0 != 0)) && ( !(s25_evt1 != 0)))) && (s25_backoff <= s25_x)) || ( !(((_x_s25_l1 != 0) && ( !(_x_s25_l0 != 0))) && (((s25_l0 != 0) && ( !(s25_l1 != 0))) && ((delta == 0.0) && ( !(( !(s25_evt2 != 0)) && (( !(s25_evt0 != 0)) && ( !(s25_evt1 != 0))))))))))) && (((((((((((((((((( !(_x_s24_evt2 != 0)) && ((_x_s24_evt0 != 0) && ( !(_x_s24_evt1 != 0)))) || (((( !(_x_s24_evt2 != 0)) && (( !(_x_s24_evt0 != 0)) && ( !(_x_s24_evt1 != 0)))) || ((_x_s24_evt2 != 0) && (( !(_x_s24_evt0 != 0)) && ( !(_x_s24_evt1 != 0))))) || ((( !(_x_s24_evt2 != 0)) && ((_x_s24_evt1 != 0) && ( !(_x_s24_evt0 != 0)))) || ((_x_s24_evt2 != 0) && ((_x_s24_evt1 != 0) && ( !(_x_s24_evt0 != 0))))))) && ((( !(_x_s24_l0 != 0)) && ( !(_x_s24_l1 != 0))) || (((_x_s24_l1 != 0) && ( !(_x_s24_l0 != 0))) || ((_x_s24_l0 != 0) && ( !(_x_s24_l1 != 0)))))) && (13.0 <= _x_s24_backoff)) && (( !(_x_s24_lambda <= 0.0)) && ((_x_s24_x <= _x_s24_lambda) || ( !((_x_s24_l1 != 0) && ( !(_x_s24_l0 != 0))))))) && ((((((s24_l0 != 0) == (_x_s24_l0 != 0)) && ((s24_l1 != 0) == (_x_s24_l1 != 0))) && (s24_lambda == _x_s24_lambda)) && (((delta + (s24_x + (-1.0 * _x_s24_x))) == 0.0) && (s24_backoff == _x_s24_backoff))) || ( !(( !(delta <= 0.0)) || (( !(s24_evt2 != 0)) && (( !(s24_evt0 != 0)) && ( !(s24_evt1 != 0)))))))) && (((((_x_s24_l0 != 0) && ( !(_x_s24_l1 != 0))) || ((( !(_x_s24_l0 != 0)) && ( !(_x_s24_l1 != 0))) || ((_x_s24_l1 != 0) && ( !(_x_s24_l0 != 0))))) && ((s24_backoff == _x_s24_backoff) && (_x_s24_x == 0.0))) || ( !((( !(s24_l0 != 0)) && ( !(s24_l1 != 0))) && ((delta == 0.0) && ( !(( !(s24_evt2 != 0)) && (( !(s24_evt0 != 0)) && ( !(s24_evt1 != 0)))))))))) && (((( !(s24_evt2 != 0)) && ((s24_evt0 != 0) && ( !(s24_evt1 != 0)))) && (s24_lambda == _x_s24_lambda)) || ( !((( !(_x_s24_l0 != 0)) && ( !(_x_s24_l1 != 0))) && ((( !(s24_l0 != 0)) && ( !(s24_l1 != 0))) && ((delta == 0.0) && ( !(( !(s24_evt2 != 0)) && (( !(s24_evt0 != 0)) && ( !(s24_evt1 != 0))))))))))) && (((s24_evt2 != 0) && (( !(s24_evt0 != 0)) && ( !(s24_evt1 != 0)))) || ( !(((_x_s24_l1 != 0) && ( !(_x_s24_l0 != 0))) && ((( !(s24_l0 != 0)) && ( !(s24_l1 != 0))) && ((delta == 0.0) && ( !(( !(s24_evt2 != 0)) && (( !(s24_evt0 != 0)) && ( !(s24_evt1 != 0))))))))))) && (((s24_lambda == _x_s24_lambda) && (((s24_evt2 != 0) && ((s24_evt1 != 0) && ( !(s24_evt0 != 0)))) || (( !(s24_evt2 != 0)) && ((s24_evt0 != 0) && ( !(s24_evt1 != 0)))))) || ( !(((_x_s24_l0 != 0) && ( !(_x_s24_l1 != 0))) && ((( !(s24_l0 != 0)) && ( !(s24_l1 != 0))) && ((delta == 0.0) && ( !(( !(s24_evt2 != 0)) && (( !(s24_evt0 != 0)) && ( !(s24_evt1 != 0))))))))))) && ((((s24_lambda == _x_s24_lambda) && (_x_s24_x == 0.0)) && ((( !(_x_s24_l0 != 0)) && ( !(_x_s24_l1 != 0))) || ((_x_s24_l0 != 0) && ( !(_x_s24_l1 != 0))))) || ( !(((s24_l1 != 0) && ( !(s24_l0 != 0))) && ((delta == 0.0) && ( !(( !(s24_evt2 != 0)) && (( !(s24_evt0 != 0)) && ( !(s24_evt1 != 0)))))))))) && (((s24_lambda <= s24_x) && ((( !(s24_evt2 != 0)) && ((s24_evt1 != 0) && ( !(s24_evt0 != 0)))) && (_x_s24_backoff <= s24_backoff))) || ( !((( !(_x_s24_l0 != 0)) && ( !(_x_s24_l1 != 0))) && (((s24_l1 != 0) && ( !(s24_l0 != 0))) && ((delta == 0.0) && ( !(( !(s24_evt2 != 0)) && (( !(s24_evt0 != 0)) && ( !(s24_evt1 != 0))))))))))) && (((( !(s24_evt2 != 0)) && ((s24_evt0 != 0) && ( !(s24_evt1 != 0)))) && ((s24_backoff + (-1.0 * _x_s24_backoff)) <= -1.0)) || ( !(((_x_s24_l0 != 0) && ( !(_x_s24_l1 != 0))) && (((s24_l1 != 0) && ( !(s24_l0 != 0))) && ((delta == 0.0) && ( !(( !(s24_evt2 != 0)) && (( !(s24_evt0 != 0)) && ( !(s24_evt1 != 0))))))))))) && (((s24_lambda == _x_s24_lambda) && ((((_x_s24_l1 != 0) && ( !(_x_s24_l0 != 0))) || ((_x_s24_l0 != 0) && ( !(_x_s24_l1 != 0)))) && ((s24_backoff == _x_s24_backoff) && (_x_s24_x == 0.0)))) || ( !(((s24_l0 != 0) && ( !(s24_l1 != 0))) && ((delta == 0.0) && ( !(( !(s24_evt2 != 0)) && (( !(s24_evt0 != 0)) && ( !(s24_evt1 != 0)))))))))) && ((( !(s24_evt2 != 0)) && ((s24_evt0 != 0) && ( !(s24_evt1 != 0)))) || ( !(((_x_s24_l0 != 0) && ( !(_x_s24_l1 != 0))) && (((s24_l0 != 0) && ( !(s24_l1 != 0))) && ((delta == 0.0) && ( !(( !(s24_evt2 != 0)) && (( !(s24_evt0 != 0)) && ( !(s24_evt1 != 0))))))))))) && ((((s24_evt2 != 0) && (( !(s24_evt0 != 0)) && ( !(s24_evt1 != 0)))) && (s24_backoff <= s24_x)) || ( !(((_x_s24_l1 != 0) && ( !(_x_s24_l0 != 0))) && (((s24_l0 != 0) && ( !(s24_l1 != 0))) && ((delta == 0.0) && ( !(( !(s24_evt2 != 0)) && (( !(s24_evt0 != 0)) && ( !(s24_evt1 != 0))))))))))) && (((((((((((((((((( !(_x_s23_evt2 != 0)) && ((_x_s23_evt0 != 0) && ( !(_x_s23_evt1 != 0)))) || (((( !(_x_s23_evt2 != 0)) && (( !(_x_s23_evt0 != 0)) && ( !(_x_s23_evt1 != 0)))) || ((_x_s23_evt2 != 0) && (( !(_x_s23_evt0 != 0)) && ( !(_x_s23_evt1 != 0))))) || ((( !(_x_s23_evt2 != 0)) && ((_x_s23_evt1 != 0) && ( !(_x_s23_evt0 != 0)))) || ((_x_s23_evt2 != 0) && ((_x_s23_evt1 != 0) && ( !(_x_s23_evt0 != 0))))))) && ((( !(_x_s23_l0 != 0)) && ( !(_x_s23_l1 != 0))) || (((_x_s23_l1 != 0) && ( !(_x_s23_l0 != 0))) || ((_x_s23_l0 != 0) && ( !(_x_s23_l1 != 0)))))) && (13.0 <= _x_s23_backoff)) && (( !(_x_s23_lambda <= 0.0)) && ((_x_s23_x <= _x_s23_lambda) || ( !((_x_s23_l1 != 0) && ( !(_x_s23_l0 != 0))))))) && ((((((s23_l0 != 0) == (_x_s23_l0 != 0)) && ((s23_l1 != 0) == (_x_s23_l1 != 0))) && (s23_lambda == _x_s23_lambda)) && (((delta + (s23_x + (-1.0 * _x_s23_x))) == 0.0) && (s23_backoff == _x_s23_backoff))) || ( !(( !(delta <= 0.0)) || (( !(s23_evt2 != 0)) && (( !(s23_evt0 != 0)) && ( !(s23_evt1 != 0)))))))) && (((((_x_s23_l0 != 0) && ( !(_x_s23_l1 != 0))) || ((( !(_x_s23_l0 != 0)) && ( !(_x_s23_l1 != 0))) || ((_x_s23_l1 != 0) && ( !(_x_s23_l0 != 0))))) && ((s23_backoff == _x_s23_backoff) && (_x_s23_x == 0.0))) || ( !((( !(s23_l0 != 0)) && ( !(s23_l1 != 0))) && ((delta == 0.0) && ( !(( !(s23_evt2 != 0)) && (( !(s23_evt0 != 0)) && ( !(s23_evt1 != 0)))))))))) && (((( !(s23_evt2 != 0)) && ((s23_evt0 != 0) && ( !(s23_evt1 != 0)))) && (s23_lambda == _x_s23_lambda)) || ( !((( !(_x_s23_l0 != 0)) && ( !(_x_s23_l1 != 0))) && ((( !(s23_l0 != 0)) && ( !(s23_l1 != 0))) && ((delta == 0.0) && ( !(( !(s23_evt2 != 0)) && (( !(s23_evt0 != 0)) && ( !(s23_evt1 != 0))))))))))) && (((s23_evt2 != 0) && (( !(s23_evt0 != 0)) && ( !(s23_evt1 != 0)))) || ( !(((_x_s23_l1 != 0) && ( !(_x_s23_l0 != 0))) && ((( !(s23_l0 != 0)) && ( !(s23_l1 != 0))) && ((delta == 0.0) && ( !(( !(s23_evt2 != 0)) && (( !(s23_evt0 != 0)) && ( !(s23_evt1 != 0))))))))))) && (((s23_lambda == _x_s23_lambda) && (((s23_evt2 != 0) && ((s23_evt1 != 0) && ( !(s23_evt0 != 0)))) || (( !(s23_evt2 != 0)) && ((s23_evt0 != 0) && ( !(s23_evt1 != 0)))))) || ( !(((_x_s23_l0 != 0) && ( !(_x_s23_l1 != 0))) && ((( !(s23_l0 != 0)) && ( !(s23_l1 != 0))) && ((delta == 0.0) && ( !(( !(s23_evt2 != 0)) && (( !(s23_evt0 != 0)) && ( !(s23_evt1 != 0))))))))))) && ((((s23_lambda == _x_s23_lambda) && (_x_s23_x == 0.0)) && ((( !(_x_s23_l0 != 0)) && ( !(_x_s23_l1 != 0))) || ((_x_s23_l0 != 0) && ( !(_x_s23_l1 != 0))))) || ( !(((s23_l1 != 0) && ( !(s23_l0 != 0))) && ((delta == 0.0) && ( !(( !(s23_evt2 != 0)) && (( !(s23_evt0 != 0)) && ( !(s23_evt1 != 0)))))))))) && (((s23_lambda <= s23_x) && ((( !(s23_evt2 != 0)) && ((s23_evt1 != 0) && ( !(s23_evt0 != 0)))) && (_x_s23_backoff <= s23_backoff))) || ( !((( !(_x_s23_l0 != 0)) && ( !(_x_s23_l1 != 0))) && (((s23_l1 != 0) && ( !(s23_l0 != 0))) && ((delta == 0.0) && ( !(( !(s23_evt2 != 0)) && (( !(s23_evt0 != 0)) && ( !(s23_evt1 != 0))))))))))) && (((( !(s23_evt2 != 0)) && ((s23_evt0 != 0) && ( !(s23_evt1 != 0)))) && ((s23_backoff + (-1.0 * _x_s23_backoff)) <= -1.0)) || ( !(((_x_s23_l0 != 0) && ( !(_x_s23_l1 != 0))) && (((s23_l1 != 0) && ( !(s23_l0 != 0))) && ((delta == 0.0) && ( !(( !(s23_evt2 != 0)) && (( !(s23_evt0 != 0)) && ( !(s23_evt1 != 0))))))))))) && (((s23_lambda == _x_s23_lambda) && ((((_x_s23_l1 != 0) && ( !(_x_s23_l0 != 0))) || ((_x_s23_l0 != 0) && ( !(_x_s23_l1 != 0)))) && ((s23_backoff == _x_s23_backoff) && (_x_s23_x == 0.0)))) || ( !(((s23_l0 != 0) && ( !(s23_l1 != 0))) && ((delta == 0.0) && ( !(( !(s23_evt2 != 0)) && (( !(s23_evt0 != 0)) && ( !(s23_evt1 != 0)))))))))) && ((( !(s23_evt2 != 0)) && ((s23_evt0 != 0) && ( !(s23_evt1 != 0)))) || ( !(((_x_s23_l0 != 0) && ( !(_x_s23_l1 != 0))) && (((s23_l0 != 0) && ( !(s23_l1 != 0))) && ((delta == 0.0) && ( !(( !(s23_evt2 != 0)) && (( !(s23_evt0 != 0)) && ( !(s23_evt1 != 0))))))))))) && ((((s23_evt2 != 0) && (( !(s23_evt0 != 0)) && ( !(s23_evt1 != 0)))) && (s23_backoff <= s23_x)) || ( !(((_x_s23_l1 != 0) && ( !(_x_s23_l0 != 0))) && (((s23_l0 != 0) && ( !(s23_l1 != 0))) && ((delta == 0.0) && ( !(( !(s23_evt2 != 0)) && (( !(s23_evt0 != 0)) && ( !(s23_evt1 != 0))))))))))) && (((((((((((((((((( !(_x_s22_evt2 != 0)) && ((_x_s22_evt0 != 0) && ( !(_x_s22_evt1 != 0)))) || (((( !(_x_s22_evt2 != 0)) && (( !(_x_s22_evt0 != 0)) && ( !(_x_s22_evt1 != 0)))) || ((_x_s22_evt2 != 0) && (( !(_x_s22_evt0 != 0)) && ( !(_x_s22_evt1 != 0))))) || ((( !(_x_s22_evt2 != 0)) && ((_x_s22_evt1 != 0) && ( !(_x_s22_evt0 != 0)))) || ((_x_s22_evt2 != 0) && ((_x_s22_evt1 != 0) && ( !(_x_s22_evt0 != 0))))))) && ((( !(_x_s22_l0 != 0)) && ( !(_x_s22_l1 != 0))) || (((_x_s22_l1 != 0) && ( !(_x_s22_l0 != 0))) || ((_x_s22_l0 != 0) && ( !(_x_s22_l1 != 0)))))) && (13.0 <= _x_s22_backoff)) && (( !(_x_s22_lambda <= 0.0)) && ((_x_s22_x <= _x_s22_lambda) || ( !((_x_s22_l1 != 0) && ( !(_x_s22_l0 != 0))))))) && ((((((s22_l0 != 0) == (_x_s22_l0 != 0)) && ((s22_l1 != 0) == (_x_s22_l1 != 0))) && (s22_lambda == _x_s22_lambda)) && (((delta + (s22_x + (-1.0 * _x_s22_x))) == 0.0) && (s22_backoff == _x_s22_backoff))) || ( !(( !(delta <= 0.0)) || (( !(s22_evt2 != 0)) && (( !(s22_evt0 != 0)) && ( !(s22_evt1 != 0)))))))) && (((((_x_s22_l0 != 0) && ( !(_x_s22_l1 != 0))) || ((( !(_x_s22_l0 != 0)) && ( !(_x_s22_l1 != 0))) || ((_x_s22_l1 != 0) && ( !(_x_s22_l0 != 0))))) && ((s22_backoff == _x_s22_backoff) && (_x_s22_x == 0.0))) || ( !((( !(s22_l0 != 0)) && ( !(s22_l1 != 0))) && ((delta == 0.0) && ( !(( !(s22_evt2 != 0)) && (( !(s22_evt0 != 0)) && ( !(s22_evt1 != 0)))))))))) && (((( !(s22_evt2 != 0)) && ((s22_evt0 != 0) && ( !(s22_evt1 != 0)))) && (s22_lambda == _x_s22_lambda)) || ( !((( !(_x_s22_l0 != 0)) && ( !(_x_s22_l1 != 0))) && ((( !(s22_l0 != 0)) && ( !(s22_l1 != 0))) && ((delta == 0.0) && ( !(( !(s22_evt2 != 0)) && (( !(s22_evt0 != 0)) && ( !(s22_evt1 != 0))))))))))) && (((s22_evt2 != 0) && (( !(s22_evt0 != 0)) && ( !(s22_evt1 != 0)))) || ( !(((_x_s22_l1 != 0) && ( !(_x_s22_l0 != 0))) && ((( !(s22_l0 != 0)) && ( !(s22_l1 != 0))) && ((delta == 0.0) && ( !(( !(s22_evt2 != 0)) && (( !(s22_evt0 != 0)) && ( !(s22_evt1 != 0))))))))))) && (((s22_lambda == _x_s22_lambda) && (((s22_evt2 != 0) && ((s22_evt1 != 0) && ( !(s22_evt0 != 0)))) || (( !(s22_evt2 != 0)) && ((s22_evt0 != 0) && ( !(s22_evt1 != 0)))))) || ( !(((_x_s22_l0 != 0) && ( !(_x_s22_l1 != 0))) && ((( !(s22_l0 != 0)) && ( !(s22_l1 != 0))) && ((delta == 0.0) && ( !(( !(s22_evt2 != 0)) && (( !(s22_evt0 != 0)) && ( !(s22_evt1 != 0))))))))))) && ((((s22_lambda == _x_s22_lambda) && (_x_s22_x == 0.0)) && ((( !(_x_s22_l0 != 0)) && ( !(_x_s22_l1 != 0))) || ((_x_s22_l0 != 0) && ( !(_x_s22_l1 != 0))))) || ( !(((s22_l1 != 0) && ( !(s22_l0 != 0))) && ((delta == 0.0) && ( !(( !(s22_evt2 != 0)) && (( !(s22_evt0 != 0)) && ( !(s22_evt1 != 0)))))))))) && (((s22_lambda <= s22_x) && ((( !(s22_evt2 != 0)) && ((s22_evt1 != 0) && ( !(s22_evt0 != 0)))) && (_x_s22_backoff <= s22_backoff))) || ( !((( !(_x_s22_l0 != 0)) && ( !(_x_s22_l1 != 0))) && (((s22_l1 != 0) && ( !(s22_l0 != 0))) && ((delta == 0.0) && ( !(( !(s22_evt2 != 0)) && (( !(s22_evt0 != 0)) && ( !(s22_evt1 != 0))))))))))) && (((( !(s22_evt2 != 0)) && ((s22_evt0 != 0) && ( !(s22_evt1 != 0)))) && ((s22_backoff + (-1.0 * _x_s22_backoff)) <= -1.0)) || ( !(((_x_s22_l0 != 0) && ( !(_x_s22_l1 != 0))) && (((s22_l1 != 0) && ( !(s22_l0 != 0))) && ((delta == 0.0) && ( !(( !(s22_evt2 != 0)) && (( !(s22_evt0 != 0)) && ( !(s22_evt1 != 0))))))))))) && (((s22_lambda == _x_s22_lambda) && ((((_x_s22_l1 != 0) && ( !(_x_s22_l0 != 0))) || ((_x_s22_l0 != 0) && ( !(_x_s22_l1 != 0)))) && ((s22_backoff == _x_s22_backoff) && (_x_s22_x == 0.0)))) || ( !(((s22_l0 != 0) && ( !(s22_l1 != 0))) && ((delta == 0.0) && ( !(( !(s22_evt2 != 0)) && (( !(s22_evt0 != 0)) && ( !(s22_evt1 != 0)))))))))) && ((( !(s22_evt2 != 0)) && ((s22_evt0 != 0) && ( !(s22_evt1 != 0)))) || ( !(((_x_s22_l0 != 0) && ( !(_x_s22_l1 != 0))) && (((s22_l0 != 0) && ( !(s22_l1 != 0))) && ((delta == 0.0) && ( !(( !(s22_evt2 != 0)) && (( !(s22_evt0 != 0)) && ( !(s22_evt1 != 0))))))))))) && ((((s22_evt2 != 0) && (( !(s22_evt0 != 0)) && ( !(s22_evt1 != 0)))) && (s22_backoff <= s22_x)) || ( !(((_x_s22_l1 != 0) && ( !(_x_s22_l0 != 0))) && (((s22_l0 != 0) && ( !(s22_l1 != 0))) && ((delta == 0.0) && ( !(( !(s22_evt2 != 0)) && (( !(s22_evt0 != 0)) && ( !(s22_evt1 != 0))))))))))) && (((((((((((((((((( !(_x_s21_evt2 != 0)) && ((_x_s21_evt0 != 0) && ( !(_x_s21_evt1 != 0)))) || (((( !(_x_s21_evt2 != 0)) && (( !(_x_s21_evt0 != 0)) && ( !(_x_s21_evt1 != 0)))) || ((_x_s21_evt2 != 0) && (( !(_x_s21_evt0 != 0)) && ( !(_x_s21_evt1 != 0))))) || ((( !(_x_s21_evt2 != 0)) && ((_x_s21_evt1 != 0) && ( !(_x_s21_evt0 != 0)))) || ((_x_s21_evt2 != 0) && ((_x_s21_evt1 != 0) && ( !(_x_s21_evt0 != 0))))))) && ((( !(_x_s21_l0 != 0)) && ( !(_x_s21_l1 != 0))) || (((_x_s21_l1 != 0) && ( !(_x_s21_l0 != 0))) || ((_x_s21_l0 != 0) && ( !(_x_s21_l1 != 0)))))) && (13.0 <= _x_s21_backoff)) && (( !(_x_s21_lambda <= 0.0)) && ((_x_s21_x <= _x_s21_lambda) || ( !((_x_s21_l1 != 0) && ( !(_x_s21_l0 != 0))))))) && ((((((s21_l0 != 0) == (_x_s21_l0 != 0)) && ((s21_l1 != 0) == (_x_s21_l1 != 0))) && (s21_lambda == _x_s21_lambda)) && (((delta + (s21_x + (-1.0 * _x_s21_x))) == 0.0) && (s21_backoff == _x_s21_backoff))) || ( !(( !(delta <= 0.0)) || (( !(s21_evt2 != 0)) && (( !(s21_evt0 != 0)) && ( !(s21_evt1 != 0)))))))) && (((((_x_s21_l0 != 0) && ( !(_x_s21_l1 != 0))) || ((( !(_x_s21_l0 != 0)) && ( !(_x_s21_l1 != 0))) || ((_x_s21_l1 != 0) && ( !(_x_s21_l0 != 0))))) && ((s21_backoff == _x_s21_backoff) && (_x_s21_x == 0.0))) || ( !((( !(s21_l0 != 0)) && ( !(s21_l1 != 0))) && ((delta == 0.0) && ( !(( !(s21_evt2 != 0)) && (( !(s21_evt0 != 0)) && ( !(s21_evt1 != 0)))))))))) && (((( !(s21_evt2 != 0)) && ((s21_evt0 != 0) && ( !(s21_evt1 != 0)))) && (s21_lambda == _x_s21_lambda)) || ( !((( !(_x_s21_l0 != 0)) && ( !(_x_s21_l1 != 0))) && ((( !(s21_l0 != 0)) && ( !(s21_l1 != 0))) && ((delta == 0.0) && ( !(( !(s21_evt2 != 0)) && (( !(s21_evt0 != 0)) && ( !(s21_evt1 != 0))))))))))) && (((s21_evt2 != 0) && (( !(s21_evt0 != 0)) && ( !(s21_evt1 != 0)))) || ( !(((_x_s21_l1 != 0) && ( !(_x_s21_l0 != 0))) && ((( !(s21_l0 != 0)) && ( !(s21_l1 != 0))) && ((delta == 0.0) && ( !(( !(s21_evt2 != 0)) && (( !(s21_evt0 != 0)) && ( !(s21_evt1 != 0))))))))))) && (((s21_lambda == _x_s21_lambda) && (((s21_evt2 != 0) && ((s21_evt1 != 0) && ( !(s21_evt0 != 0)))) || (( !(s21_evt2 != 0)) && ((s21_evt0 != 0) && ( !(s21_evt1 != 0)))))) || ( !(((_x_s21_l0 != 0) && ( !(_x_s21_l1 != 0))) && ((( !(s21_l0 != 0)) && ( !(s21_l1 != 0))) && ((delta == 0.0) && ( !(( !(s21_evt2 != 0)) && (( !(s21_evt0 != 0)) && ( !(s21_evt1 != 0))))))))))) && ((((s21_lambda == _x_s21_lambda) && (_x_s21_x == 0.0)) && ((( !(_x_s21_l0 != 0)) && ( !(_x_s21_l1 != 0))) || ((_x_s21_l0 != 0) && ( !(_x_s21_l1 != 0))))) || ( !(((s21_l1 != 0) && ( !(s21_l0 != 0))) && ((delta == 0.0) && ( !(( !(s21_evt2 != 0)) && (( !(s21_evt0 != 0)) && ( !(s21_evt1 != 0)))))))))) && (((s21_lambda <= s21_x) && ((( !(s21_evt2 != 0)) && ((s21_evt1 != 0) && ( !(s21_evt0 != 0)))) && (_x_s21_backoff <= s21_backoff))) || ( !((( !(_x_s21_l0 != 0)) && ( !(_x_s21_l1 != 0))) && (((s21_l1 != 0) && ( !(s21_l0 != 0))) && ((delta == 0.0) && ( !(( !(s21_evt2 != 0)) && (( !(s21_evt0 != 0)) && ( !(s21_evt1 != 0))))))))))) && (((( !(s21_evt2 != 0)) && ((s21_evt0 != 0) && ( !(s21_evt1 != 0)))) && ((s21_backoff + (-1.0 * _x_s21_backoff)) <= -1.0)) || ( !(((_x_s21_l0 != 0) && ( !(_x_s21_l1 != 0))) && (((s21_l1 != 0) && ( !(s21_l0 != 0))) && ((delta == 0.0) && ( !(( !(s21_evt2 != 0)) && (( !(s21_evt0 != 0)) && ( !(s21_evt1 != 0))))))))))) && (((s21_lambda == _x_s21_lambda) && ((((_x_s21_l1 != 0) && ( !(_x_s21_l0 != 0))) || ((_x_s21_l0 != 0) && ( !(_x_s21_l1 != 0)))) && ((s21_backoff == _x_s21_backoff) && (_x_s21_x == 0.0)))) || ( !(((s21_l0 != 0) && ( !(s21_l1 != 0))) && ((delta == 0.0) && ( !(( !(s21_evt2 != 0)) && (( !(s21_evt0 != 0)) && ( !(s21_evt1 != 0)))))))))) && ((( !(s21_evt2 != 0)) && ((s21_evt0 != 0) && ( !(s21_evt1 != 0)))) || ( !(((_x_s21_l0 != 0) && ( !(_x_s21_l1 != 0))) && (((s21_l0 != 0) && ( !(s21_l1 != 0))) && ((delta == 0.0) && ( !(( !(s21_evt2 != 0)) && (( !(s21_evt0 != 0)) && ( !(s21_evt1 != 0))))))))))) && ((((s21_evt2 != 0) && (( !(s21_evt0 != 0)) && ( !(s21_evt1 != 0)))) && (s21_backoff <= s21_x)) || ( !(((_x_s21_l1 != 0) && ( !(_x_s21_l0 != 0))) && (((s21_l0 != 0) && ( !(s21_l1 != 0))) && ((delta == 0.0) && ( !(( !(s21_evt2 != 0)) && (( !(s21_evt0 != 0)) && ( !(s21_evt1 != 0))))))))))) && (((((((((((((((((( !(_x_s20_evt2 != 0)) && ((_x_s20_evt0 != 0) && ( !(_x_s20_evt1 != 0)))) || (((( !(_x_s20_evt2 != 0)) && (( !(_x_s20_evt0 != 0)) && ( !(_x_s20_evt1 != 0)))) || ((_x_s20_evt2 != 0) && (( !(_x_s20_evt0 != 0)) && ( !(_x_s20_evt1 != 0))))) || ((( !(_x_s20_evt2 != 0)) && ((_x_s20_evt1 != 0) && ( !(_x_s20_evt0 != 0)))) || ((_x_s20_evt2 != 0) && ((_x_s20_evt1 != 0) && ( !(_x_s20_evt0 != 0))))))) && ((( !(_x_s20_l0 != 0)) && ( !(_x_s20_l1 != 0))) || (((_x_s20_l1 != 0) && ( !(_x_s20_l0 != 0))) || ((_x_s20_l0 != 0) && ( !(_x_s20_l1 != 0)))))) && (13.0 <= _x_s20_backoff)) && (( !(_x_s20_lambda <= 0.0)) && ((_x_s20_x <= _x_s20_lambda) || ( !((_x_s20_l1 != 0) && ( !(_x_s20_l0 != 0))))))) && ((((((s20_l0 != 0) == (_x_s20_l0 != 0)) && ((s20_l1 != 0) == (_x_s20_l1 != 0))) && (s20_lambda == _x_s20_lambda)) && (((delta + (s20_x + (-1.0 * _x_s20_x))) == 0.0) && (s20_backoff == _x_s20_backoff))) || ( !(( !(delta <= 0.0)) || (( !(s20_evt2 != 0)) && (( !(s20_evt0 != 0)) && ( !(s20_evt1 != 0)))))))) && (((((_x_s20_l0 != 0) && ( !(_x_s20_l1 != 0))) || ((( !(_x_s20_l0 != 0)) && ( !(_x_s20_l1 != 0))) || ((_x_s20_l1 != 0) && ( !(_x_s20_l0 != 0))))) && ((s20_backoff == _x_s20_backoff) && (_x_s20_x == 0.0))) || ( !((( !(s20_l0 != 0)) && ( !(s20_l1 != 0))) && ((delta == 0.0) && ( !(( !(s20_evt2 != 0)) && (( !(s20_evt0 != 0)) && ( !(s20_evt1 != 0)))))))))) && (((( !(s20_evt2 != 0)) && ((s20_evt0 != 0) && ( !(s20_evt1 != 0)))) && (s20_lambda == _x_s20_lambda)) || ( !((( !(_x_s20_l0 != 0)) && ( !(_x_s20_l1 != 0))) && ((( !(s20_l0 != 0)) && ( !(s20_l1 != 0))) && ((delta == 0.0) && ( !(( !(s20_evt2 != 0)) && (( !(s20_evt0 != 0)) && ( !(s20_evt1 != 0))))))))))) && (((s20_evt2 != 0) && (( !(s20_evt0 != 0)) && ( !(s20_evt1 != 0)))) || ( !(((_x_s20_l1 != 0) && ( !(_x_s20_l0 != 0))) && ((( !(s20_l0 != 0)) && ( !(s20_l1 != 0))) && ((delta == 0.0) && ( !(( !(s20_evt2 != 0)) && (( !(s20_evt0 != 0)) && ( !(s20_evt1 != 0))))))))))) && (((s20_lambda == _x_s20_lambda) && (((s20_evt2 != 0) && ((s20_evt1 != 0) && ( !(s20_evt0 != 0)))) || (( !(s20_evt2 != 0)) && ((s20_evt0 != 0) && ( !(s20_evt1 != 0)))))) || ( !(((_x_s20_l0 != 0) && ( !(_x_s20_l1 != 0))) && ((( !(s20_l0 != 0)) && ( !(s20_l1 != 0))) && ((delta == 0.0) && ( !(( !(s20_evt2 != 0)) && (( !(s20_evt0 != 0)) && ( !(s20_evt1 != 0))))))))))) && ((((s20_lambda == _x_s20_lambda) && (_x_s20_x == 0.0)) && ((( !(_x_s20_l0 != 0)) && ( !(_x_s20_l1 != 0))) || ((_x_s20_l0 != 0) && ( !(_x_s20_l1 != 0))))) || ( !(((s20_l1 != 0) && ( !(s20_l0 != 0))) && ((delta == 0.0) && ( !(( !(s20_evt2 != 0)) && (( !(s20_evt0 != 0)) && ( !(s20_evt1 != 0)))))))))) && (((s20_lambda <= s20_x) && ((( !(s20_evt2 != 0)) && ((s20_evt1 != 0) && ( !(s20_evt0 != 0)))) && (_x_s20_backoff <= s20_backoff))) || ( !((( !(_x_s20_l0 != 0)) && ( !(_x_s20_l1 != 0))) && (((s20_l1 != 0) && ( !(s20_l0 != 0))) && ((delta == 0.0) && ( !(( !(s20_evt2 != 0)) && (( !(s20_evt0 != 0)) && ( !(s20_evt1 != 0))))))))))) && (((( !(s20_evt2 != 0)) && ((s20_evt0 != 0) && ( !(s20_evt1 != 0)))) && ((s20_backoff + (-1.0 * _x_s20_backoff)) <= -1.0)) || ( !(((_x_s20_l0 != 0) && ( !(_x_s20_l1 != 0))) && (((s20_l1 != 0) && ( !(s20_l0 != 0))) && ((delta == 0.0) && ( !(( !(s20_evt2 != 0)) && (( !(s20_evt0 != 0)) && ( !(s20_evt1 != 0))))))))))) && (((s20_lambda == _x_s20_lambda) && ((((_x_s20_l1 != 0) && ( !(_x_s20_l0 != 0))) || ((_x_s20_l0 != 0) && ( !(_x_s20_l1 != 0)))) && ((s20_backoff == _x_s20_backoff) && (_x_s20_x == 0.0)))) || ( !(((s20_l0 != 0) && ( !(s20_l1 != 0))) && ((delta == 0.0) && ( !(( !(s20_evt2 != 0)) && (( !(s20_evt0 != 0)) && ( !(s20_evt1 != 0)))))))))) && ((( !(s20_evt2 != 0)) && ((s20_evt0 != 0) && ( !(s20_evt1 != 0)))) || ( !(((_x_s20_l0 != 0) && ( !(_x_s20_l1 != 0))) && (((s20_l0 != 0) && ( !(s20_l1 != 0))) && ((delta == 0.0) && ( !(( !(s20_evt2 != 0)) && (( !(s20_evt0 != 0)) && ( !(s20_evt1 != 0))))))))))) && ((((s20_evt2 != 0) && (( !(s20_evt0 != 0)) && ( !(s20_evt1 != 0)))) && (s20_backoff <= s20_x)) || ( !(((_x_s20_l1 != 0) && ( !(_x_s20_l0 != 0))) && (((s20_l0 != 0) && ( !(s20_l1 != 0))) && ((delta == 0.0) && ( !(( !(s20_evt2 != 0)) && (( !(s20_evt0 != 0)) && ( !(s20_evt1 != 0))))))))))) && (((((((((((((((((( !(_x_s19_evt2 != 0)) && ((_x_s19_evt0 != 0) && ( !(_x_s19_evt1 != 0)))) || (((( !(_x_s19_evt2 != 0)) && (( !(_x_s19_evt0 != 0)) && ( !(_x_s19_evt1 != 0)))) || ((_x_s19_evt2 != 0) && (( !(_x_s19_evt0 != 0)) && ( !(_x_s19_evt1 != 0))))) || ((( !(_x_s19_evt2 != 0)) && ((_x_s19_evt1 != 0) && ( !(_x_s19_evt0 != 0)))) || ((_x_s19_evt2 != 0) && ((_x_s19_evt1 != 0) && ( !(_x_s19_evt0 != 0))))))) && ((( !(_x_s19_l0 != 0)) && ( !(_x_s19_l1 != 0))) || (((_x_s19_l1 != 0) && ( !(_x_s19_l0 != 0))) || ((_x_s19_l0 != 0) && ( !(_x_s19_l1 != 0)))))) && (13.0 <= _x_s19_backoff)) && (( !(_x_s19_lambda <= 0.0)) && ((_x_s19_x <= _x_s19_lambda) || ( !((_x_s19_l1 != 0) && ( !(_x_s19_l0 != 0))))))) && ((((((s19_l0 != 0) == (_x_s19_l0 != 0)) && ((s19_l1 != 0) == (_x_s19_l1 != 0))) && (s19_lambda == _x_s19_lambda)) && (((delta + (s19_x + (-1.0 * _x_s19_x))) == 0.0) && (s19_backoff == _x_s19_backoff))) || ( !(( !(delta <= 0.0)) || (( !(s19_evt2 != 0)) && (( !(s19_evt0 != 0)) && ( !(s19_evt1 != 0)))))))) && (((((_x_s19_l0 != 0) && ( !(_x_s19_l1 != 0))) || ((( !(_x_s19_l0 != 0)) && ( !(_x_s19_l1 != 0))) || ((_x_s19_l1 != 0) && ( !(_x_s19_l0 != 0))))) && ((s19_backoff == _x_s19_backoff) && (_x_s19_x == 0.0))) || ( !((( !(s19_l0 != 0)) && ( !(s19_l1 != 0))) && ((delta == 0.0) && ( !(( !(s19_evt2 != 0)) && (( !(s19_evt0 != 0)) && ( !(s19_evt1 != 0)))))))))) && (((( !(s19_evt2 != 0)) && ((s19_evt0 != 0) && ( !(s19_evt1 != 0)))) && (s19_lambda == _x_s19_lambda)) || ( !((( !(_x_s19_l0 != 0)) && ( !(_x_s19_l1 != 0))) && ((( !(s19_l0 != 0)) && ( !(s19_l1 != 0))) && ((delta == 0.0) && ( !(( !(s19_evt2 != 0)) && (( !(s19_evt0 != 0)) && ( !(s19_evt1 != 0))))))))))) && (((s19_evt2 != 0) && (( !(s19_evt0 != 0)) && ( !(s19_evt1 != 0)))) || ( !(((_x_s19_l1 != 0) && ( !(_x_s19_l0 != 0))) && ((( !(s19_l0 != 0)) && ( !(s19_l1 != 0))) && ((delta == 0.0) && ( !(( !(s19_evt2 != 0)) && (( !(s19_evt0 != 0)) && ( !(s19_evt1 != 0))))))))))) && (((s19_lambda == _x_s19_lambda) && (((s19_evt2 != 0) && ((s19_evt1 != 0) && ( !(s19_evt0 != 0)))) || (( !(s19_evt2 != 0)) && ((s19_evt0 != 0) && ( !(s19_evt1 != 0)))))) || ( !(((_x_s19_l0 != 0) && ( !(_x_s19_l1 != 0))) && ((( !(s19_l0 != 0)) && ( !(s19_l1 != 0))) && ((delta == 0.0) && ( !(( !(s19_evt2 != 0)) && (( !(s19_evt0 != 0)) && ( !(s19_evt1 != 0))))))))))) && ((((s19_lambda == _x_s19_lambda) && (_x_s19_x == 0.0)) && ((( !(_x_s19_l0 != 0)) && ( !(_x_s19_l1 != 0))) || ((_x_s19_l0 != 0) && ( !(_x_s19_l1 != 0))))) || ( !(((s19_l1 != 0) && ( !(s19_l0 != 0))) && ((delta == 0.0) && ( !(( !(s19_evt2 != 0)) && (( !(s19_evt0 != 0)) && ( !(s19_evt1 != 0)))))))))) && (((s19_lambda <= s19_x) && ((( !(s19_evt2 != 0)) && ((s19_evt1 != 0) && ( !(s19_evt0 != 0)))) && (_x_s19_backoff <= s19_backoff))) || ( !((( !(_x_s19_l0 != 0)) && ( !(_x_s19_l1 != 0))) && (((s19_l1 != 0) && ( !(s19_l0 != 0))) && ((delta == 0.0) && ( !(( !(s19_evt2 != 0)) && (( !(s19_evt0 != 0)) && ( !(s19_evt1 != 0))))))))))) && (((( !(s19_evt2 != 0)) && ((s19_evt0 != 0) && ( !(s19_evt1 != 0)))) && ((s19_backoff + (-1.0 * _x_s19_backoff)) <= -1.0)) || ( !(((_x_s19_l0 != 0) && ( !(_x_s19_l1 != 0))) && (((s19_l1 != 0) && ( !(s19_l0 != 0))) && ((delta == 0.0) && ( !(( !(s19_evt2 != 0)) && (( !(s19_evt0 != 0)) && ( !(s19_evt1 != 0))))))))))) && (((s19_lambda == _x_s19_lambda) && ((((_x_s19_l1 != 0) && ( !(_x_s19_l0 != 0))) || ((_x_s19_l0 != 0) && ( !(_x_s19_l1 != 0)))) && ((s19_backoff == _x_s19_backoff) && (_x_s19_x == 0.0)))) || ( !(((s19_l0 != 0) && ( !(s19_l1 != 0))) && ((delta == 0.0) && ( !(( !(s19_evt2 != 0)) && (( !(s19_evt0 != 0)) && ( !(s19_evt1 != 0)))))))))) && ((( !(s19_evt2 != 0)) && ((s19_evt0 != 0) && ( !(s19_evt1 != 0)))) || ( !(((_x_s19_l0 != 0) && ( !(_x_s19_l1 != 0))) && (((s19_l0 != 0) && ( !(s19_l1 != 0))) && ((delta == 0.0) && ( !(( !(s19_evt2 != 0)) && (( !(s19_evt0 != 0)) && ( !(s19_evt1 != 0))))))))))) && ((((s19_evt2 != 0) && (( !(s19_evt0 != 0)) && ( !(s19_evt1 != 0)))) && (s19_backoff <= s19_x)) || ( !(((_x_s19_l1 != 0) && ( !(_x_s19_l0 != 0))) && (((s19_l0 != 0) && ( !(s19_l1 != 0))) && ((delta == 0.0) && ( !(( !(s19_evt2 != 0)) && (( !(s19_evt0 != 0)) && ( !(s19_evt1 != 0))))))))))) && (((((((((((((((((( !(_x_s18_evt2 != 0)) && ((_x_s18_evt0 != 0) && ( !(_x_s18_evt1 != 0)))) || (((( !(_x_s18_evt2 != 0)) && (( !(_x_s18_evt0 != 0)) && ( !(_x_s18_evt1 != 0)))) || ((_x_s18_evt2 != 0) && (( !(_x_s18_evt0 != 0)) && ( !(_x_s18_evt1 != 0))))) || ((( !(_x_s18_evt2 != 0)) && ((_x_s18_evt1 != 0) && ( !(_x_s18_evt0 != 0)))) || ((_x_s18_evt2 != 0) && ((_x_s18_evt1 != 0) && ( !(_x_s18_evt0 != 0))))))) && ((( !(_x_s18_l0 != 0)) && ( !(_x_s18_l1 != 0))) || (((_x_s18_l1 != 0) && ( !(_x_s18_l0 != 0))) || ((_x_s18_l0 != 0) && ( !(_x_s18_l1 != 0)))))) && (13.0 <= _x_s18_backoff)) && (( !(_x_s18_lambda <= 0.0)) && ((_x_s18_x <= _x_s18_lambda) || ( !((_x_s18_l1 != 0) && ( !(_x_s18_l0 != 0))))))) && ((((((s18_l0 != 0) == (_x_s18_l0 != 0)) && ((s18_l1 != 0) == (_x_s18_l1 != 0))) && (s18_lambda == _x_s18_lambda)) && (((delta + (s18_x + (-1.0 * _x_s18_x))) == 0.0) && (s18_backoff == _x_s18_backoff))) || ( !(( !(delta <= 0.0)) || (( !(s18_evt2 != 0)) && (( !(s18_evt0 != 0)) && ( !(s18_evt1 != 0)))))))) && (((((_x_s18_l0 != 0) && ( !(_x_s18_l1 != 0))) || ((( !(_x_s18_l0 != 0)) && ( !(_x_s18_l1 != 0))) || ((_x_s18_l1 != 0) && ( !(_x_s18_l0 != 0))))) && ((s18_backoff == _x_s18_backoff) && (_x_s18_x == 0.0))) || ( !((( !(s18_l0 != 0)) && ( !(s18_l1 != 0))) && ((delta == 0.0) && ( !(( !(s18_evt2 != 0)) && (( !(s18_evt0 != 0)) && ( !(s18_evt1 != 0)))))))))) && (((( !(s18_evt2 != 0)) && ((s18_evt0 != 0) && ( !(s18_evt1 != 0)))) && (s18_lambda == _x_s18_lambda)) || ( !((( !(_x_s18_l0 != 0)) && ( !(_x_s18_l1 != 0))) && ((( !(s18_l0 != 0)) && ( !(s18_l1 != 0))) && ((delta == 0.0) && ( !(( !(s18_evt2 != 0)) && (( !(s18_evt0 != 0)) && ( !(s18_evt1 != 0))))))))))) && (((s18_evt2 != 0) && (( !(s18_evt0 != 0)) && ( !(s18_evt1 != 0)))) || ( !(((_x_s18_l1 != 0) && ( !(_x_s18_l0 != 0))) && ((( !(s18_l0 != 0)) && ( !(s18_l1 != 0))) && ((delta == 0.0) && ( !(( !(s18_evt2 != 0)) && (( !(s18_evt0 != 0)) && ( !(s18_evt1 != 0))))))))))) && (((s18_lambda == _x_s18_lambda) && (((s18_evt2 != 0) && ((s18_evt1 != 0) && ( !(s18_evt0 != 0)))) || (( !(s18_evt2 != 0)) && ((s18_evt0 != 0) && ( !(s18_evt1 != 0)))))) || ( !(((_x_s18_l0 != 0) && ( !(_x_s18_l1 != 0))) && ((( !(s18_l0 != 0)) && ( !(s18_l1 != 0))) && ((delta == 0.0) && ( !(( !(s18_evt2 != 0)) && (( !(s18_evt0 != 0)) && ( !(s18_evt1 != 0))))))))))) && ((((s18_lambda == _x_s18_lambda) && (_x_s18_x == 0.0)) && ((( !(_x_s18_l0 != 0)) && ( !(_x_s18_l1 != 0))) || ((_x_s18_l0 != 0) && ( !(_x_s18_l1 != 0))))) || ( !(((s18_l1 != 0) && ( !(s18_l0 != 0))) && ((delta == 0.0) && ( !(( !(s18_evt2 != 0)) && (( !(s18_evt0 != 0)) && ( !(s18_evt1 != 0)))))))))) && (((s18_lambda <= s18_x) && ((( !(s18_evt2 != 0)) && ((s18_evt1 != 0) && ( !(s18_evt0 != 0)))) && (_x_s18_backoff <= s18_backoff))) || ( !((( !(_x_s18_l0 != 0)) && ( !(_x_s18_l1 != 0))) && (((s18_l1 != 0) && ( !(s18_l0 != 0))) && ((delta == 0.0) && ( !(( !(s18_evt2 != 0)) && (( !(s18_evt0 != 0)) && ( !(s18_evt1 != 0))))))))))) && (((( !(s18_evt2 != 0)) && ((s18_evt0 != 0) && ( !(s18_evt1 != 0)))) && ((s18_backoff + (-1.0 * _x_s18_backoff)) <= -1.0)) || ( !(((_x_s18_l0 != 0) && ( !(_x_s18_l1 != 0))) && (((s18_l1 != 0) && ( !(s18_l0 != 0))) && ((delta == 0.0) && ( !(( !(s18_evt2 != 0)) && (( !(s18_evt0 != 0)) && ( !(s18_evt1 != 0))))))))))) && (((s18_lambda == _x_s18_lambda) && ((((_x_s18_l1 != 0) && ( !(_x_s18_l0 != 0))) || ((_x_s18_l0 != 0) && ( !(_x_s18_l1 != 0)))) && ((s18_backoff == _x_s18_backoff) && (_x_s18_x == 0.0)))) || ( !(((s18_l0 != 0) && ( !(s18_l1 != 0))) && ((delta == 0.0) && ( !(( !(s18_evt2 != 0)) && (( !(s18_evt0 != 0)) && ( !(s18_evt1 != 0)))))))))) && ((( !(s18_evt2 != 0)) && ((s18_evt0 != 0) && ( !(s18_evt1 != 0)))) || ( !(((_x_s18_l0 != 0) && ( !(_x_s18_l1 != 0))) && (((s18_l0 != 0) && ( !(s18_l1 != 0))) && ((delta == 0.0) && ( !(( !(s18_evt2 != 0)) && (( !(s18_evt0 != 0)) && ( !(s18_evt1 != 0))))))))))) && ((((s18_evt2 != 0) && (( !(s18_evt0 != 0)) && ( !(s18_evt1 != 0)))) && (s18_backoff <= s18_x)) || ( !(((_x_s18_l1 != 0) && ( !(_x_s18_l0 != 0))) && (((s18_l0 != 0) && ( !(s18_l1 != 0))) && ((delta == 0.0) && ( !(( !(s18_evt2 != 0)) && (( !(s18_evt0 != 0)) && ( !(s18_evt1 != 0))))))))))) && (((((((((((((((((( !(_x_s17_evt2 != 0)) && ((_x_s17_evt0 != 0) && ( !(_x_s17_evt1 != 0)))) || (((( !(_x_s17_evt2 != 0)) && (( !(_x_s17_evt0 != 0)) && ( !(_x_s17_evt1 != 0)))) || ((_x_s17_evt2 != 0) && (( !(_x_s17_evt0 != 0)) && ( !(_x_s17_evt1 != 0))))) || ((( !(_x_s17_evt2 != 0)) && ((_x_s17_evt1 != 0) && ( !(_x_s17_evt0 != 0)))) || ((_x_s17_evt2 != 0) && ((_x_s17_evt1 != 0) && ( !(_x_s17_evt0 != 0))))))) && ((( !(_x_s17_l0 != 0)) && ( !(_x_s17_l1 != 0))) || (((_x_s17_l1 != 0) && ( !(_x_s17_l0 != 0))) || ((_x_s17_l0 != 0) && ( !(_x_s17_l1 != 0)))))) && (13.0 <= _x_s17_backoff)) && (( !(_x_s17_lambda <= 0.0)) && ((_x_s17_x <= _x_s17_lambda) || ( !((_x_s17_l1 != 0) && ( !(_x_s17_l0 != 0))))))) && ((((((s17_l0 != 0) == (_x_s17_l0 != 0)) && ((s17_l1 != 0) == (_x_s17_l1 != 0))) && (s17_lambda == _x_s17_lambda)) && (((delta + (s17_x + (-1.0 * _x_s17_x))) == 0.0) && (s17_backoff == _x_s17_backoff))) || ( !(( !(delta <= 0.0)) || (( !(s17_evt2 != 0)) && (( !(s17_evt0 != 0)) && ( !(s17_evt1 != 0)))))))) && (((((_x_s17_l0 != 0) && ( !(_x_s17_l1 != 0))) || ((( !(_x_s17_l0 != 0)) && ( !(_x_s17_l1 != 0))) || ((_x_s17_l1 != 0) && ( !(_x_s17_l0 != 0))))) && ((s17_backoff == _x_s17_backoff) && (_x_s17_x == 0.0))) || ( !((( !(s17_l0 != 0)) && ( !(s17_l1 != 0))) && ((delta == 0.0) && ( !(( !(s17_evt2 != 0)) && (( !(s17_evt0 != 0)) && ( !(s17_evt1 != 0)))))))))) && (((( !(s17_evt2 != 0)) && ((s17_evt0 != 0) && ( !(s17_evt1 != 0)))) && (s17_lambda == _x_s17_lambda)) || ( !((( !(_x_s17_l0 != 0)) && ( !(_x_s17_l1 != 0))) && ((( !(s17_l0 != 0)) && ( !(s17_l1 != 0))) && ((delta == 0.0) && ( !(( !(s17_evt2 != 0)) && (( !(s17_evt0 != 0)) && ( !(s17_evt1 != 0))))))))))) && (((s17_evt2 != 0) && (( !(s17_evt0 != 0)) && ( !(s17_evt1 != 0)))) || ( !(((_x_s17_l1 != 0) && ( !(_x_s17_l0 != 0))) && ((( !(s17_l0 != 0)) && ( !(s17_l1 != 0))) && ((delta == 0.0) && ( !(( !(s17_evt2 != 0)) && (( !(s17_evt0 != 0)) && ( !(s17_evt1 != 0))))))))))) && (((s17_lambda == _x_s17_lambda) && (((s17_evt2 != 0) && ((s17_evt1 != 0) && ( !(s17_evt0 != 0)))) || (( !(s17_evt2 != 0)) && ((s17_evt0 != 0) && ( !(s17_evt1 != 0)))))) || ( !(((_x_s17_l0 != 0) && ( !(_x_s17_l1 != 0))) && ((( !(s17_l0 != 0)) && ( !(s17_l1 != 0))) && ((delta == 0.0) && ( !(( !(s17_evt2 != 0)) && (( !(s17_evt0 != 0)) && ( !(s17_evt1 != 0))))))))))) && ((((s17_lambda == _x_s17_lambda) && (_x_s17_x == 0.0)) && ((( !(_x_s17_l0 != 0)) && ( !(_x_s17_l1 != 0))) || ((_x_s17_l0 != 0) && ( !(_x_s17_l1 != 0))))) || ( !(((s17_l1 != 0) && ( !(s17_l0 != 0))) && ((delta == 0.0) && ( !(( !(s17_evt2 != 0)) && (( !(s17_evt0 != 0)) && ( !(s17_evt1 != 0)))))))))) && (((s17_lambda <= s17_x) && ((( !(s17_evt2 != 0)) && ((s17_evt1 != 0) && ( !(s17_evt0 != 0)))) && (_x_s17_backoff <= s17_backoff))) || ( !((( !(_x_s17_l0 != 0)) && ( !(_x_s17_l1 != 0))) && (((s17_l1 != 0) && ( !(s17_l0 != 0))) && ((delta == 0.0) && ( !(( !(s17_evt2 != 0)) && (( !(s17_evt0 != 0)) && ( !(s17_evt1 != 0))))))))))) && (((( !(s17_evt2 != 0)) && ((s17_evt0 != 0) && ( !(s17_evt1 != 0)))) && ((s17_backoff + (-1.0 * _x_s17_backoff)) <= -1.0)) || ( !(((_x_s17_l0 != 0) && ( !(_x_s17_l1 != 0))) && (((s17_l1 != 0) && ( !(s17_l0 != 0))) && ((delta == 0.0) && ( !(( !(s17_evt2 != 0)) && (( !(s17_evt0 != 0)) && ( !(s17_evt1 != 0))))))))))) && (((s17_lambda == _x_s17_lambda) && ((((_x_s17_l1 != 0) && ( !(_x_s17_l0 != 0))) || ((_x_s17_l0 != 0) && ( !(_x_s17_l1 != 0)))) && ((s17_backoff == _x_s17_backoff) && (_x_s17_x == 0.0)))) || ( !(((s17_l0 != 0) && ( !(s17_l1 != 0))) && ((delta == 0.0) && ( !(( !(s17_evt2 != 0)) && (( !(s17_evt0 != 0)) && ( !(s17_evt1 != 0)))))))))) && ((( !(s17_evt2 != 0)) && ((s17_evt0 != 0) && ( !(s17_evt1 != 0)))) || ( !(((_x_s17_l0 != 0) && ( !(_x_s17_l1 != 0))) && (((s17_l0 != 0) && ( !(s17_l1 != 0))) && ((delta == 0.0) && ( !(( !(s17_evt2 != 0)) && (( !(s17_evt0 != 0)) && ( !(s17_evt1 != 0))))))))))) && ((((s17_evt2 != 0) && (( !(s17_evt0 != 0)) && ( !(s17_evt1 != 0)))) && (s17_backoff <= s17_x)) || ( !(((_x_s17_l1 != 0) && ( !(_x_s17_l0 != 0))) && (((s17_l0 != 0) && ( !(s17_l1 != 0))) && ((delta == 0.0) && ( !(( !(s17_evt2 != 0)) && (( !(s17_evt0 != 0)) && ( !(s17_evt1 != 0))))))))))) && (((((((((((((((((( !(_x_s16_evt2 != 0)) && ((_x_s16_evt0 != 0) && ( !(_x_s16_evt1 != 0)))) || (((( !(_x_s16_evt2 != 0)) && (( !(_x_s16_evt0 != 0)) && ( !(_x_s16_evt1 != 0)))) || ((_x_s16_evt2 != 0) && (( !(_x_s16_evt0 != 0)) && ( !(_x_s16_evt1 != 0))))) || ((( !(_x_s16_evt2 != 0)) && ((_x_s16_evt1 != 0) && ( !(_x_s16_evt0 != 0)))) || ((_x_s16_evt2 != 0) && ((_x_s16_evt1 != 0) && ( !(_x_s16_evt0 != 0))))))) && ((( !(_x_s16_l0 != 0)) && ( !(_x_s16_l1 != 0))) || (((_x_s16_l1 != 0) && ( !(_x_s16_l0 != 0))) || ((_x_s16_l0 != 0) && ( !(_x_s16_l1 != 0)))))) && (13.0 <= _x_s16_backoff)) && (( !(_x_s16_lambda <= 0.0)) && ((_x_s16_x <= _x_s16_lambda) || ( !((_x_s16_l1 != 0) && ( !(_x_s16_l0 != 0))))))) && ((((((s16_l0 != 0) == (_x_s16_l0 != 0)) && ((s16_l1 != 0) == (_x_s16_l1 != 0))) && (s16_lambda == _x_s16_lambda)) && (((delta + (s16_x + (-1.0 * _x_s16_x))) == 0.0) && (s16_backoff == _x_s16_backoff))) || ( !(( !(delta <= 0.0)) || (( !(s16_evt2 != 0)) && (( !(s16_evt0 != 0)) && ( !(s16_evt1 != 0)))))))) && (((((_x_s16_l0 != 0) && ( !(_x_s16_l1 != 0))) || ((( !(_x_s16_l0 != 0)) && ( !(_x_s16_l1 != 0))) || ((_x_s16_l1 != 0) && ( !(_x_s16_l0 != 0))))) && ((s16_backoff == _x_s16_backoff) && (_x_s16_x == 0.0))) || ( !((( !(s16_l0 != 0)) && ( !(s16_l1 != 0))) && ((delta == 0.0) && ( !(( !(s16_evt2 != 0)) && (( !(s16_evt0 != 0)) && ( !(s16_evt1 != 0)))))))))) && (((( !(s16_evt2 != 0)) && ((s16_evt0 != 0) && ( !(s16_evt1 != 0)))) && (s16_lambda == _x_s16_lambda)) || ( !((( !(_x_s16_l0 != 0)) && ( !(_x_s16_l1 != 0))) && ((( !(s16_l0 != 0)) && ( !(s16_l1 != 0))) && ((delta == 0.0) && ( !(( !(s16_evt2 != 0)) && (( !(s16_evt0 != 0)) && ( !(s16_evt1 != 0))))))))))) && (((s16_evt2 != 0) && (( !(s16_evt0 != 0)) && ( !(s16_evt1 != 0)))) || ( !(((_x_s16_l1 != 0) && ( !(_x_s16_l0 != 0))) && ((( !(s16_l0 != 0)) && ( !(s16_l1 != 0))) && ((delta == 0.0) && ( !(( !(s16_evt2 != 0)) && (( !(s16_evt0 != 0)) && ( !(s16_evt1 != 0))))))))))) && (((s16_lambda == _x_s16_lambda) && (((s16_evt2 != 0) && ((s16_evt1 != 0) && ( !(s16_evt0 != 0)))) || (( !(s16_evt2 != 0)) && ((s16_evt0 != 0) && ( !(s16_evt1 != 0)))))) || ( !(((_x_s16_l0 != 0) && ( !(_x_s16_l1 != 0))) && ((( !(s16_l0 != 0)) && ( !(s16_l1 != 0))) && ((delta == 0.0) && ( !(( !(s16_evt2 != 0)) && (( !(s16_evt0 != 0)) && ( !(s16_evt1 != 0))))))))))) && ((((s16_lambda == _x_s16_lambda) && (_x_s16_x == 0.0)) && ((( !(_x_s16_l0 != 0)) && ( !(_x_s16_l1 != 0))) || ((_x_s16_l0 != 0) && ( !(_x_s16_l1 != 0))))) || ( !(((s16_l1 != 0) && ( !(s16_l0 != 0))) && ((delta == 0.0) && ( !(( !(s16_evt2 != 0)) && (( !(s16_evt0 != 0)) && ( !(s16_evt1 != 0)))))))))) && (((s16_lambda <= s16_x) && ((( !(s16_evt2 != 0)) && ((s16_evt1 != 0) && ( !(s16_evt0 != 0)))) && (_x_s16_backoff <= s16_backoff))) || ( !((( !(_x_s16_l0 != 0)) && ( !(_x_s16_l1 != 0))) && (((s16_l1 != 0) && ( !(s16_l0 != 0))) && ((delta == 0.0) && ( !(( !(s16_evt2 != 0)) && (( !(s16_evt0 != 0)) && ( !(s16_evt1 != 0))))))))))) && (((( !(s16_evt2 != 0)) && ((s16_evt0 != 0) && ( !(s16_evt1 != 0)))) && ((s16_backoff + (-1.0 * _x_s16_backoff)) <= -1.0)) || ( !(((_x_s16_l0 != 0) && ( !(_x_s16_l1 != 0))) && (((s16_l1 != 0) && ( !(s16_l0 != 0))) && ((delta == 0.0) && ( !(( !(s16_evt2 != 0)) && (( !(s16_evt0 != 0)) && ( !(s16_evt1 != 0))))))))))) && (((s16_lambda == _x_s16_lambda) && ((((_x_s16_l1 != 0) && ( !(_x_s16_l0 != 0))) || ((_x_s16_l0 != 0) && ( !(_x_s16_l1 != 0)))) && ((s16_backoff == _x_s16_backoff) && (_x_s16_x == 0.0)))) || ( !(((s16_l0 != 0) && ( !(s16_l1 != 0))) && ((delta == 0.0) && ( !(( !(s16_evt2 != 0)) && (( !(s16_evt0 != 0)) && ( !(s16_evt1 != 0)))))))))) && ((( !(s16_evt2 != 0)) && ((s16_evt0 != 0) && ( !(s16_evt1 != 0)))) || ( !(((_x_s16_l0 != 0) && ( !(_x_s16_l1 != 0))) && (((s16_l0 != 0) && ( !(s16_l1 != 0))) && ((delta == 0.0) && ( !(( !(s16_evt2 != 0)) && (( !(s16_evt0 != 0)) && ( !(s16_evt1 != 0))))))))))) && ((((s16_evt2 != 0) && (( !(s16_evt0 != 0)) && ( !(s16_evt1 != 0)))) && (s16_backoff <= s16_x)) || ( !(((_x_s16_l1 != 0) && ( !(_x_s16_l0 != 0))) && (((s16_l0 != 0) && ( !(s16_l1 != 0))) && ((delta == 0.0) && ( !(( !(s16_evt2 != 0)) && (( !(s16_evt0 != 0)) && ( !(s16_evt1 != 0))))))))))) && (((((((((((((((((( !(_x_s15_evt2 != 0)) && ((_x_s15_evt0 != 0) && ( !(_x_s15_evt1 != 0)))) || (((( !(_x_s15_evt2 != 0)) && (( !(_x_s15_evt0 != 0)) && ( !(_x_s15_evt1 != 0)))) || ((_x_s15_evt2 != 0) && (( !(_x_s15_evt0 != 0)) && ( !(_x_s15_evt1 != 0))))) || ((( !(_x_s15_evt2 != 0)) && ((_x_s15_evt1 != 0) && ( !(_x_s15_evt0 != 0)))) || ((_x_s15_evt2 != 0) && ((_x_s15_evt1 != 0) && ( !(_x_s15_evt0 != 0))))))) && ((( !(_x_s15_l0 != 0)) && ( !(_x_s15_l1 != 0))) || (((_x_s15_l1 != 0) && ( !(_x_s15_l0 != 0))) || ((_x_s15_l0 != 0) && ( !(_x_s15_l1 != 0)))))) && (13.0 <= _x_s15_backoff)) && (( !(_x_s15_lambda <= 0.0)) && ((_x_s15_x <= _x_s15_lambda) || ( !((_x_s15_l1 != 0) && ( !(_x_s15_l0 != 0))))))) && ((((((s15_l0 != 0) == (_x_s15_l0 != 0)) && ((s15_l1 != 0) == (_x_s15_l1 != 0))) && (s15_lambda == _x_s15_lambda)) && (((delta + (s15_x + (-1.0 * _x_s15_x))) == 0.0) && (s15_backoff == _x_s15_backoff))) || ( !(( !(delta <= 0.0)) || (( !(s15_evt2 != 0)) && (( !(s15_evt0 != 0)) && ( !(s15_evt1 != 0)))))))) && (((((_x_s15_l0 != 0) && ( !(_x_s15_l1 != 0))) || ((( !(_x_s15_l0 != 0)) && ( !(_x_s15_l1 != 0))) || ((_x_s15_l1 != 0) && ( !(_x_s15_l0 != 0))))) && ((s15_backoff == _x_s15_backoff) && (_x_s15_x == 0.0))) || ( !((( !(s15_l0 != 0)) && ( !(s15_l1 != 0))) && ((delta == 0.0) && ( !(( !(s15_evt2 != 0)) && (( !(s15_evt0 != 0)) && ( !(s15_evt1 != 0)))))))))) && (((( !(s15_evt2 != 0)) && ((s15_evt0 != 0) && ( !(s15_evt1 != 0)))) && (s15_lambda == _x_s15_lambda)) || ( !((( !(_x_s15_l0 != 0)) && ( !(_x_s15_l1 != 0))) && ((( !(s15_l0 != 0)) && ( !(s15_l1 != 0))) && ((delta == 0.0) && ( !(( !(s15_evt2 != 0)) && (( !(s15_evt0 != 0)) && ( !(s15_evt1 != 0))))))))))) && (((s15_evt2 != 0) && (( !(s15_evt0 != 0)) && ( !(s15_evt1 != 0)))) || ( !(((_x_s15_l1 != 0) && ( !(_x_s15_l0 != 0))) && ((( !(s15_l0 != 0)) && ( !(s15_l1 != 0))) && ((delta == 0.0) && ( !(( !(s15_evt2 != 0)) && (( !(s15_evt0 != 0)) && ( !(s15_evt1 != 0))))))))))) && (((s15_lambda == _x_s15_lambda) && (((s15_evt2 != 0) && ((s15_evt1 != 0) && ( !(s15_evt0 != 0)))) || (( !(s15_evt2 != 0)) && ((s15_evt0 != 0) && ( !(s15_evt1 != 0)))))) || ( !(((_x_s15_l0 != 0) && ( !(_x_s15_l1 != 0))) && ((( !(s15_l0 != 0)) && ( !(s15_l1 != 0))) && ((delta == 0.0) && ( !(( !(s15_evt2 != 0)) && (( !(s15_evt0 != 0)) && ( !(s15_evt1 != 0))))))))))) && ((((s15_lambda == _x_s15_lambda) && (_x_s15_x == 0.0)) && ((( !(_x_s15_l0 != 0)) && ( !(_x_s15_l1 != 0))) || ((_x_s15_l0 != 0) && ( !(_x_s15_l1 != 0))))) || ( !(((s15_l1 != 0) && ( !(s15_l0 != 0))) && ((delta == 0.0) && ( !(( !(s15_evt2 != 0)) && (( !(s15_evt0 != 0)) && ( !(s15_evt1 != 0)))))))))) && (((s15_lambda <= s15_x) && ((( !(s15_evt2 != 0)) && ((s15_evt1 != 0) && ( !(s15_evt0 != 0)))) && (_x_s15_backoff <= s15_backoff))) || ( !((( !(_x_s15_l0 != 0)) && ( !(_x_s15_l1 != 0))) && (((s15_l1 != 0) && ( !(s15_l0 != 0))) && ((delta == 0.0) && ( !(( !(s15_evt2 != 0)) && (( !(s15_evt0 != 0)) && ( !(s15_evt1 != 0))))))))))) && (((( !(s15_evt2 != 0)) && ((s15_evt0 != 0) && ( !(s15_evt1 != 0)))) && ((s15_backoff + (-1.0 * _x_s15_backoff)) <= -1.0)) || ( !(((_x_s15_l0 != 0) && ( !(_x_s15_l1 != 0))) && (((s15_l1 != 0) && ( !(s15_l0 != 0))) && ((delta == 0.0) && ( !(( !(s15_evt2 != 0)) && (( !(s15_evt0 != 0)) && ( !(s15_evt1 != 0))))))))))) && (((s15_lambda == _x_s15_lambda) && ((((_x_s15_l1 != 0) && ( !(_x_s15_l0 != 0))) || ((_x_s15_l0 != 0) && ( !(_x_s15_l1 != 0)))) && ((s15_backoff == _x_s15_backoff) && (_x_s15_x == 0.0)))) || ( !(((s15_l0 != 0) && ( !(s15_l1 != 0))) && ((delta == 0.0) && ( !(( !(s15_evt2 != 0)) && (( !(s15_evt0 != 0)) && ( !(s15_evt1 != 0)))))))))) && ((( !(s15_evt2 != 0)) && ((s15_evt0 != 0) && ( !(s15_evt1 != 0)))) || ( !(((_x_s15_l0 != 0) && ( !(_x_s15_l1 != 0))) && (((s15_l0 != 0) && ( !(s15_l1 != 0))) && ((delta == 0.0) && ( !(( !(s15_evt2 != 0)) && (( !(s15_evt0 != 0)) && ( !(s15_evt1 != 0))))))))))) && ((((s15_evt2 != 0) && (( !(s15_evt0 != 0)) && ( !(s15_evt1 != 0)))) && (s15_backoff <= s15_x)) || ( !(((_x_s15_l1 != 0) && ( !(_x_s15_l0 != 0))) && (((s15_l0 != 0) && ( !(s15_l1 != 0))) && ((delta == 0.0) && ( !(( !(s15_evt2 != 0)) && (( !(s15_evt0 != 0)) && ( !(s15_evt1 != 0))))))))))) && (((((((((((((((((( !(_x_s14_evt2 != 0)) && ((_x_s14_evt0 != 0) && ( !(_x_s14_evt1 != 0)))) || (((( !(_x_s14_evt2 != 0)) && (( !(_x_s14_evt0 != 0)) && ( !(_x_s14_evt1 != 0)))) || ((_x_s14_evt2 != 0) && (( !(_x_s14_evt0 != 0)) && ( !(_x_s14_evt1 != 0))))) || ((( !(_x_s14_evt2 != 0)) && ((_x_s14_evt1 != 0) && ( !(_x_s14_evt0 != 0)))) || ((_x_s14_evt2 != 0) && ((_x_s14_evt1 != 0) && ( !(_x_s14_evt0 != 0))))))) && ((( !(_x_s14_l0 != 0)) && ( !(_x_s14_l1 != 0))) || (((_x_s14_l1 != 0) && ( !(_x_s14_l0 != 0))) || ((_x_s14_l0 != 0) && ( !(_x_s14_l1 != 0)))))) && (13.0 <= _x_s14_backoff)) && (( !(_x_s14_lambda <= 0.0)) && ((_x_s14_x <= _x_s14_lambda) || ( !((_x_s14_l1 != 0) && ( !(_x_s14_l0 != 0))))))) && ((((((s14_l0 != 0) == (_x_s14_l0 != 0)) && ((s14_l1 != 0) == (_x_s14_l1 != 0))) && (s14_lambda == _x_s14_lambda)) && (((delta + (s14_x + (-1.0 * _x_s14_x))) == 0.0) && (s14_backoff == _x_s14_backoff))) || ( !(( !(delta <= 0.0)) || (( !(s14_evt2 != 0)) && (( !(s14_evt0 != 0)) && ( !(s14_evt1 != 0)))))))) && (((((_x_s14_l0 != 0) && ( !(_x_s14_l1 != 0))) || ((( !(_x_s14_l0 != 0)) && ( !(_x_s14_l1 != 0))) || ((_x_s14_l1 != 0) && ( !(_x_s14_l0 != 0))))) && ((s14_backoff == _x_s14_backoff) && (_x_s14_x == 0.0))) || ( !((( !(s14_l0 != 0)) && ( !(s14_l1 != 0))) && ((delta == 0.0) && ( !(( !(s14_evt2 != 0)) && (( !(s14_evt0 != 0)) && ( !(s14_evt1 != 0)))))))))) && (((( !(s14_evt2 != 0)) && ((s14_evt0 != 0) && ( !(s14_evt1 != 0)))) && (s14_lambda == _x_s14_lambda)) || ( !((( !(_x_s14_l0 != 0)) && ( !(_x_s14_l1 != 0))) && ((( !(s14_l0 != 0)) && ( !(s14_l1 != 0))) && ((delta == 0.0) && ( !(( !(s14_evt2 != 0)) && (( !(s14_evt0 != 0)) && ( !(s14_evt1 != 0))))))))))) && (((s14_evt2 != 0) && (( !(s14_evt0 != 0)) && ( !(s14_evt1 != 0)))) || ( !(((_x_s14_l1 != 0) && ( !(_x_s14_l0 != 0))) && ((( !(s14_l0 != 0)) && ( !(s14_l1 != 0))) && ((delta == 0.0) && ( !(( !(s14_evt2 != 0)) && (( !(s14_evt0 != 0)) && ( !(s14_evt1 != 0))))))))))) && (((s14_lambda == _x_s14_lambda) && (((s14_evt2 != 0) && ((s14_evt1 != 0) && ( !(s14_evt0 != 0)))) || (( !(s14_evt2 != 0)) && ((s14_evt0 != 0) && ( !(s14_evt1 != 0)))))) || ( !(((_x_s14_l0 != 0) && ( !(_x_s14_l1 != 0))) && ((( !(s14_l0 != 0)) && ( !(s14_l1 != 0))) && ((delta == 0.0) && ( !(( !(s14_evt2 != 0)) && (( !(s14_evt0 != 0)) && ( !(s14_evt1 != 0))))))))))) && ((((s14_lambda == _x_s14_lambda) && (_x_s14_x == 0.0)) && ((( !(_x_s14_l0 != 0)) && ( !(_x_s14_l1 != 0))) || ((_x_s14_l0 != 0) && ( !(_x_s14_l1 != 0))))) || ( !(((s14_l1 != 0) && ( !(s14_l0 != 0))) && ((delta == 0.0) && ( !(( !(s14_evt2 != 0)) && (( !(s14_evt0 != 0)) && ( !(s14_evt1 != 0)))))))))) && (((s14_lambda <= s14_x) && ((( !(s14_evt2 != 0)) && ((s14_evt1 != 0) && ( !(s14_evt0 != 0)))) && (_x_s14_backoff <= s14_backoff))) || ( !((( !(_x_s14_l0 != 0)) && ( !(_x_s14_l1 != 0))) && (((s14_l1 != 0) && ( !(s14_l0 != 0))) && ((delta == 0.0) && ( !(( !(s14_evt2 != 0)) && (( !(s14_evt0 != 0)) && ( !(s14_evt1 != 0))))))))))) && (((( !(s14_evt2 != 0)) && ((s14_evt0 != 0) && ( !(s14_evt1 != 0)))) && ((s14_backoff + (-1.0 * _x_s14_backoff)) <= -1.0)) || ( !(((_x_s14_l0 != 0) && ( !(_x_s14_l1 != 0))) && (((s14_l1 != 0) && ( !(s14_l0 != 0))) && ((delta == 0.0) && ( !(( !(s14_evt2 != 0)) && (( !(s14_evt0 != 0)) && ( !(s14_evt1 != 0))))))))))) && (((s14_lambda == _x_s14_lambda) && ((((_x_s14_l1 != 0) && ( !(_x_s14_l0 != 0))) || ((_x_s14_l0 != 0) && ( !(_x_s14_l1 != 0)))) && ((s14_backoff == _x_s14_backoff) && (_x_s14_x == 0.0)))) || ( !(((s14_l0 != 0) && ( !(s14_l1 != 0))) && ((delta == 0.0) && ( !(( !(s14_evt2 != 0)) && (( !(s14_evt0 != 0)) && ( !(s14_evt1 != 0)))))))))) && ((( !(s14_evt2 != 0)) && ((s14_evt0 != 0) && ( !(s14_evt1 != 0)))) || ( !(((_x_s14_l0 != 0) && ( !(_x_s14_l1 != 0))) && (((s14_l0 != 0) && ( !(s14_l1 != 0))) && ((delta == 0.0) && ( !(( !(s14_evt2 != 0)) && (( !(s14_evt0 != 0)) && ( !(s14_evt1 != 0))))))))))) && ((((s14_evt2 != 0) && (( !(s14_evt0 != 0)) && ( !(s14_evt1 != 0)))) && (s14_backoff <= s14_x)) || ( !(((_x_s14_l1 != 0) && ( !(_x_s14_l0 != 0))) && (((s14_l0 != 0) && ( !(s14_l1 != 0))) && ((delta == 0.0) && ( !(( !(s14_evt2 != 0)) && (( !(s14_evt0 != 0)) && ( !(s14_evt1 != 0))))))))))) && (((((((((((((((((( !(_x_s13_evt2 != 0)) && ((_x_s13_evt0 != 0) && ( !(_x_s13_evt1 != 0)))) || (((( !(_x_s13_evt2 != 0)) && (( !(_x_s13_evt0 != 0)) && ( !(_x_s13_evt1 != 0)))) || ((_x_s13_evt2 != 0) && (( !(_x_s13_evt0 != 0)) && ( !(_x_s13_evt1 != 0))))) || ((( !(_x_s13_evt2 != 0)) && ((_x_s13_evt1 != 0) && ( !(_x_s13_evt0 != 0)))) || ((_x_s13_evt2 != 0) && ((_x_s13_evt1 != 0) && ( !(_x_s13_evt0 != 0))))))) && ((( !(_x_s13_l0 != 0)) && ( !(_x_s13_l1 != 0))) || (((_x_s13_l1 != 0) && ( !(_x_s13_l0 != 0))) || ((_x_s13_l0 != 0) && ( !(_x_s13_l1 != 0)))))) && (13.0 <= _x_s13_backoff)) && (( !(_x_s13_lambda <= 0.0)) && ((_x_s13_x <= _x_s13_lambda) || ( !((_x_s13_l1 != 0) && ( !(_x_s13_l0 != 0))))))) && ((((((s13_l0 != 0) == (_x_s13_l0 != 0)) && ((s13_l1 != 0) == (_x_s13_l1 != 0))) && (s13_lambda == _x_s13_lambda)) && (((delta + (s13_x + (-1.0 * _x_s13_x))) == 0.0) && (s13_backoff == _x_s13_backoff))) || ( !(( !(delta <= 0.0)) || (( !(s13_evt2 != 0)) && (( !(s13_evt0 != 0)) && ( !(s13_evt1 != 0)))))))) && (((((_x_s13_l0 != 0) && ( !(_x_s13_l1 != 0))) || ((( !(_x_s13_l0 != 0)) && ( !(_x_s13_l1 != 0))) || ((_x_s13_l1 != 0) && ( !(_x_s13_l0 != 0))))) && ((s13_backoff == _x_s13_backoff) && (_x_s13_x == 0.0))) || ( !((( !(s13_l0 != 0)) && ( !(s13_l1 != 0))) && ((delta == 0.0) && ( !(( !(s13_evt2 != 0)) && (( !(s13_evt0 != 0)) && ( !(s13_evt1 != 0)))))))))) && (((( !(s13_evt2 != 0)) && ((s13_evt0 != 0) && ( !(s13_evt1 != 0)))) && (s13_lambda == _x_s13_lambda)) || ( !((( !(_x_s13_l0 != 0)) && ( !(_x_s13_l1 != 0))) && ((( !(s13_l0 != 0)) && ( !(s13_l1 != 0))) && ((delta == 0.0) && ( !(( !(s13_evt2 != 0)) && (( !(s13_evt0 != 0)) && ( !(s13_evt1 != 0))))))))))) && (((s13_evt2 != 0) && (( !(s13_evt0 != 0)) && ( !(s13_evt1 != 0)))) || ( !(((_x_s13_l1 != 0) && ( !(_x_s13_l0 != 0))) && ((( !(s13_l0 != 0)) && ( !(s13_l1 != 0))) && ((delta == 0.0) && ( !(( !(s13_evt2 != 0)) && (( !(s13_evt0 != 0)) && ( !(s13_evt1 != 0))))))))))) && (((s13_lambda == _x_s13_lambda) && (((s13_evt2 != 0) && ((s13_evt1 != 0) && ( !(s13_evt0 != 0)))) || (( !(s13_evt2 != 0)) && ((s13_evt0 != 0) && ( !(s13_evt1 != 0)))))) || ( !(((_x_s13_l0 != 0) && ( !(_x_s13_l1 != 0))) && ((( !(s13_l0 != 0)) && ( !(s13_l1 != 0))) && ((delta == 0.0) && ( !(( !(s13_evt2 != 0)) && (( !(s13_evt0 != 0)) && ( !(s13_evt1 != 0))))))))))) && ((((s13_lambda == _x_s13_lambda) && (_x_s13_x == 0.0)) && ((( !(_x_s13_l0 != 0)) && ( !(_x_s13_l1 != 0))) || ((_x_s13_l0 != 0) && ( !(_x_s13_l1 != 0))))) || ( !(((s13_l1 != 0) && ( !(s13_l0 != 0))) && ((delta == 0.0) && ( !(( !(s13_evt2 != 0)) && (( !(s13_evt0 != 0)) && ( !(s13_evt1 != 0)))))))))) && (((s13_lambda <= s13_x) && ((( !(s13_evt2 != 0)) && ((s13_evt1 != 0) && ( !(s13_evt0 != 0)))) && (_x_s13_backoff <= s13_backoff))) || ( !((( !(_x_s13_l0 != 0)) && ( !(_x_s13_l1 != 0))) && (((s13_l1 != 0) && ( !(s13_l0 != 0))) && ((delta == 0.0) && ( !(( !(s13_evt2 != 0)) && (( !(s13_evt0 != 0)) && ( !(s13_evt1 != 0))))))))))) && (((( !(s13_evt2 != 0)) && ((s13_evt0 != 0) && ( !(s13_evt1 != 0)))) && ((s13_backoff + (-1.0 * _x_s13_backoff)) <= -1.0)) || ( !(((_x_s13_l0 != 0) && ( !(_x_s13_l1 != 0))) && (((s13_l1 != 0) && ( !(s13_l0 != 0))) && ((delta == 0.0) && ( !(( !(s13_evt2 != 0)) && (( !(s13_evt0 != 0)) && ( !(s13_evt1 != 0))))))))))) && (((s13_lambda == _x_s13_lambda) && ((((_x_s13_l1 != 0) && ( !(_x_s13_l0 != 0))) || ((_x_s13_l0 != 0) && ( !(_x_s13_l1 != 0)))) && ((s13_backoff == _x_s13_backoff) && (_x_s13_x == 0.0)))) || ( !(((s13_l0 != 0) && ( !(s13_l1 != 0))) && ((delta == 0.0) && ( !(( !(s13_evt2 != 0)) && (( !(s13_evt0 != 0)) && ( !(s13_evt1 != 0)))))))))) && ((( !(s13_evt2 != 0)) && ((s13_evt0 != 0) && ( !(s13_evt1 != 0)))) || ( !(((_x_s13_l0 != 0) && ( !(_x_s13_l1 != 0))) && (((s13_l0 != 0) && ( !(s13_l1 != 0))) && ((delta == 0.0) && ( !(( !(s13_evt2 != 0)) && (( !(s13_evt0 != 0)) && ( !(s13_evt1 != 0))))))))))) && ((((s13_evt2 != 0) && (( !(s13_evt0 != 0)) && ( !(s13_evt1 != 0)))) && (s13_backoff <= s13_x)) || ( !(((_x_s13_l1 != 0) && ( !(_x_s13_l0 != 0))) && (((s13_l0 != 0) && ( !(s13_l1 != 0))) && ((delta == 0.0) && ( !(( !(s13_evt2 != 0)) && (( !(s13_evt0 != 0)) && ( !(s13_evt1 != 0))))))))))) && (((((((((((((((((( !(_x_s12_evt2 != 0)) && ((_x_s12_evt0 != 0) && ( !(_x_s12_evt1 != 0)))) || (((( !(_x_s12_evt2 != 0)) && (( !(_x_s12_evt0 != 0)) && ( !(_x_s12_evt1 != 0)))) || ((_x_s12_evt2 != 0) && (( !(_x_s12_evt0 != 0)) && ( !(_x_s12_evt1 != 0))))) || ((( !(_x_s12_evt2 != 0)) && ((_x_s12_evt1 != 0) && ( !(_x_s12_evt0 != 0)))) || ((_x_s12_evt2 != 0) && ((_x_s12_evt1 != 0) && ( !(_x_s12_evt0 != 0))))))) && ((( !(_x_s12_l0 != 0)) && ( !(_x_s12_l1 != 0))) || (((_x_s12_l1 != 0) && ( !(_x_s12_l0 != 0))) || ((_x_s12_l0 != 0) && ( !(_x_s12_l1 != 0)))))) && (13.0 <= _x_s12_backoff)) && (( !(_x_s12_lambda <= 0.0)) && ((_x_s12_x <= _x_s12_lambda) || ( !((_x_s12_l1 != 0) && ( !(_x_s12_l0 != 0))))))) && ((((((s12_l0 != 0) == (_x_s12_l0 != 0)) && ((s12_l1 != 0) == (_x_s12_l1 != 0))) && (s12_lambda == _x_s12_lambda)) && (((delta + (s12_x + (-1.0 * _x_s12_x))) == 0.0) && (s12_backoff == _x_s12_backoff))) || ( !(( !(delta <= 0.0)) || (( !(s12_evt2 != 0)) && (( !(s12_evt0 != 0)) && ( !(s12_evt1 != 0)))))))) && (((((_x_s12_l0 != 0) && ( !(_x_s12_l1 != 0))) || ((( !(_x_s12_l0 != 0)) && ( !(_x_s12_l1 != 0))) || ((_x_s12_l1 != 0) && ( !(_x_s12_l0 != 0))))) && ((s12_backoff == _x_s12_backoff) && (_x_s12_x == 0.0))) || ( !((( !(s12_l0 != 0)) && ( !(s12_l1 != 0))) && ((delta == 0.0) && ( !(( !(s12_evt2 != 0)) && (( !(s12_evt0 != 0)) && ( !(s12_evt1 != 0)))))))))) && (((( !(s12_evt2 != 0)) && ((s12_evt0 != 0) && ( !(s12_evt1 != 0)))) && (s12_lambda == _x_s12_lambda)) || ( !((( !(_x_s12_l0 != 0)) && ( !(_x_s12_l1 != 0))) && ((( !(s12_l0 != 0)) && ( !(s12_l1 != 0))) && ((delta == 0.0) && ( !(( !(s12_evt2 != 0)) && (( !(s12_evt0 != 0)) && ( !(s12_evt1 != 0))))))))))) && (((s12_evt2 != 0) && (( !(s12_evt0 != 0)) && ( !(s12_evt1 != 0)))) || ( !(((_x_s12_l1 != 0) && ( !(_x_s12_l0 != 0))) && ((( !(s12_l0 != 0)) && ( !(s12_l1 != 0))) && ((delta == 0.0) && ( !(( !(s12_evt2 != 0)) && (( !(s12_evt0 != 0)) && ( !(s12_evt1 != 0))))))))))) && (((s12_lambda == _x_s12_lambda) && (((s12_evt2 != 0) && ((s12_evt1 != 0) && ( !(s12_evt0 != 0)))) || (( !(s12_evt2 != 0)) && ((s12_evt0 != 0) && ( !(s12_evt1 != 0)))))) || ( !(((_x_s12_l0 != 0) && ( !(_x_s12_l1 != 0))) && ((( !(s12_l0 != 0)) && ( !(s12_l1 != 0))) && ((delta == 0.0) && ( !(( !(s12_evt2 != 0)) && (( !(s12_evt0 != 0)) && ( !(s12_evt1 != 0))))))))))) && ((((s12_lambda == _x_s12_lambda) && (_x_s12_x == 0.0)) && ((( !(_x_s12_l0 != 0)) && ( !(_x_s12_l1 != 0))) || ((_x_s12_l0 != 0) && ( !(_x_s12_l1 != 0))))) || ( !(((s12_l1 != 0) && ( !(s12_l0 != 0))) && ((delta == 0.0) && ( !(( !(s12_evt2 != 0)) && (( !(s12_evt0 != 0)) && ( !(s12_evt1 != 0)))))))))) && (((s12_lambda <= s12_x) && ((( !(s12_evt2 != 0)) && ((s12_evt1 != 0) && ( !(s12_evt0 != 0)))) && (_x_s12_backoff <= s12_backoff))) || ( !((( !(_x_s12_l0 != 0)) && ( !(_x_s12_l1 != 0))) && (((s12_l1 != 0) && ( !(s12_l0 != 0))) && ((delta == 0.0) && ( !(( !(s12_evt2 != 0)) && (( !(s12_evt0 != 0)) && ( !(s12_evt1 != 0))))))))))) && (((( !(s12_evt2 != 0)) && ((s12_evt0 != 0) && ( !(s12_evt1 != 0)))) && ((s12_backoff + (-1.0 * _x_s12_backoff)) <= -1.0)) || ( !(((_x_s12_l0 != 0) && ( !(_x_s12_l1 != 0))) && (((s12_l1 != 0) && ( !(s12_l0 != 0))) && ((delta == 0.0) && ( !(( !(s12_evt2 != 0)) && (( !(s12_evt0 != 0)) && ( !(s12_evt1 != 0))))))))))) && (((s12_lambda == _x_s12_lambda) && ((((_x_s12_l1 != 0) && ( !(_x_s12_l0 != 0))) || ((_x_s12_l0 != 0) && ( !(_x_s12_l1 != 0)))) && ((s12_backoff == _x_s12_backoff) && (_x_s12_x == 0.0)))) || ( !(((s12_l0 != 0) && ( !(s12_l1 != 0))) && ((delta == 0.0) && ( !(( !(s12_evt2 != 0)) && (( !(s12_evt0 != 0)) && ( !(s12_evt1 != 0)))))))))) && ((( !(s12_evt2 != 0)) && ((s12_evt0 != 0) && ( !(s12_evt1 != 0)))) || ( !(((_x_s12_l0 != 0) && ( !(_x_s12_l1 != 0))) && (((s12_l0 != 0) && ( !(s12_l1 != 0))) && ((delta == 0.0) && ( !(( !(s12_evt2 != 0)) && (( !(s12_evt0 != 0)) && ( !(s12_evt1 != 0))))))))))) && ((((s12_evt2 != 0) && (( !(s12_evt0 != 0)) && ( !(s12_evt1 != 0)))) && (s12_backoff <= s12_x)) || ( !(((_x_s12_l1 != 0) && ( !(_x_s12_l0 != 0))) && (((s12_l0 != 0) && ( !(s12_l1 != 0))) && ((delta == 0.0) && ( !(( !(s12_evt2 != 0)) && (( !(s12_evt0 != 0)) && ( !(s12_evt1 != 0))))))))))) && (((((((((((((((((( !(_x_s11_evt2 != 0)) && ((_x_s11_evt0 != 0) && ( !(_x_s11_evt1 != 0)))) || (((( !(_x_s11_evt2 != 0)) && (( !(_x_s11_evt0 != 0)) && ( !(_x_s11_evt1 != 0)))) || ((_x_s11_evt2 != 0) && (( !(_x_s11_evt0 != 0)) && ( !(_x_s11_evt1 != 0))))) || ((( !(_x_s11_evt2 != 0)) && ((_x_s11_evt1 != 0) && ( !(_x_s11_evt0 != 0)))) || ((_x_s11_evt2 != 0) && ((_x_s11_evt1 != 0) && ( !(_x_s11_evt0 != 0))))))) && ((( !(_x_s11_l0 != 0)) && ( !(_x_s11_l1 != 0))) || (((_x_s11_l1 != 0) && ( !(_x_s11_l0 != 0))) || ((_x_s11_l0 != 0) && ( !(_x_s11_l1 != 0)))))) && (13.0 <= _x_s11_backoff)) && (( !(_x_s11_lambda <= 0.0)) && ((_x_s11_x <= _x_s11_lambda) || ( !((_x_s11_l1 != 0) && ( !(_x_s11_l0 != 0))))))) && ((((((s11_l0 != 0) == (_x_s11_l0 != 0)) && ((s11_l1 != 0) == (_x_s11_l1 != 0))) && (s11_lambda == _x_s11_lambda)) && (((delta + (s11_x + (-1.0 * _x_s11_x))) == 0.0) && (s11_backoff == _x_s11_backoff))) || ( !(( !(delta <= 0.0)) || (( !(s11_evt2 != 0)) && (( !(s11_evt0 != 0)) && ( !(s11_evt1 != 0)))))))) && (((((_x_s11_l0 != 0) && ( !(_x_s11_l1 != 0))) || ((( !(_x_s11_l0 != 0)) && ( !(_x_s11_l1 != 0))) || ((_x_s11_l1 != 0) && ( !(_x_s11_l0 != 0))))) && ((s11_backoff == _x_s11_backoff) && (_x_s11_x == 0.0))) || ( !((( !(s11_l0 != 0)) && ( !(s11_l1 != 0))) && ((delta == 0.0) && ( !(( !(s11_evt2 != 0)) && (( !(s11_evt0 != 0)) && ( !(s11_evt1 != 0)))))))))) && (((( !(s11_evt2 != 0)) && ((s11_evt0 != 0) && ( !(s11_evt1 != 0)))) && (s11_lambda == _x_s11_lambda)) || ( !((( !(_x_s11_l0 != 0)) && ( !(_x_s11_l1 != 0))) && ((( !(s11_l0 != 0)) && ( !(s11_l1 != 0))) && ((delta == 0.0) && ( !(( !(s11_evt2 != 0)) && (( !(s11_evt0 != 0)) && ( !(s11_evt1 != 0))))))))))) && (((s11_evt2 != 0) && (( !(s11_evt0 != 0)) && ( !(s11_evt1 != 0)))) || ( !(((_x_s11_l1 != 0) && ( !(_x_s11_l0 != 0))) && ((( !(s11_l0 != 0)) && ( !(s11_l1 != 0))) && ((delta == 0.0) && ( !(( !(s11_evt2 != 0)) && (( !(s11_evt0 != 0)) && ( !(s11_evt1 != 0))))))))))) && (((s11_lambda == _x_s11_lambda) && (((s11_evt2 != 0) && ((s11_evt1 != 0) && ( !(s11_evt0 != 0)))) || (( !(s11_evt2 != 0)) && ((s11_evt0 != 0) && ( !(s11_evt1 != 0)))))) || ( !(((_x_s11_l0 != 0) && ( !(_x_s11_l1 != 0))) && ((( !(s11_l0 != 0)) && ( !(s11_l1 != 0))) && ((delta == 0.0) && ( !(( !(s11_evt2 != 0)) && (( !(s11_evt0 != 0)) && ( !(s11_evt1 != 0))))))))))) && ((((s11_lambda == _x_s11_lambda) && (_x_s11_x == 0.0)) && ((( !(_x_s11_l0 != 0)) && ( !(_x_s11_l1 != 0))) || ((_x_s11_l0 != 0) && ( !(_x_s11_l1 != 0))))) || ( !(((s11_l1 != 0) && ( !(s11_l0 != 0))) && ((delta == 0.0) && ( !(( !(s11_evt2 != 0)) && (( !(s11_evt0 != 0)) && ( !(s11_evt1 != 0)))))))))) && (((s11_lambda <= s11_x) && ((( !(s11_evt2 != 0)) && ((s11_evt1 != 0) && ( !(s11_evt0 != 0)))) && (_x_s11_backoff <= s11_backoff))) || ( !((( !(_x_s11_l0 != 0)) && ( !(_x_s11_l1 != 0))) && (((s11_l1 != 0) && ( !(s11_l0 != 0))) && ((delta == 0.0) && ( !(( !(s11_evt2 != 0)) && (( !(s11_evt0 != 0)) && ( !(s11_evt1 != 0))))))))))) && (((( !(s11_evt2 != 0)) && ((s11_evt0 != 0) && ( !(s11_evt1 != 0)))) && ((s11_backoff + (-1.0 * _x_s11_backoff)) <= -1.0)) || ( !(((_x_s11_l0 != 0) && ( !(_x_s11_l1 != 0))) && (((s11_l1 != 0) && ( !(s11_l0 != 0))) && ((delta == 0.0) && ( !(( !(s11_evt2 != 0)) && (( !(s11_evt0 != 0)) && ( !(s11_evt1 != 0))))))))))) && (((s11_lambda == _x_s11_lambda) && ((((_x_s11_l1 != 0) && ( !(_x_s11_l0 != 0))) || ((_x_s11_l0 != 0) && ( !(_x_s11_l1 != 0)))) && ((s11_backoff == _x_s11_backoff) && (_x_s11_x == 0.0)))) || ( !(((s11_l0 != 0) && ( !(s11_l1 != 0))) && ((delta == 0.0) && ( !(( !(s11_evt2 != 0)) && (( !(s11_evt0 != 0)) && ( !(s11_evt1 != 0)))))))))) && ((( !(s11_evt2 != 0)) && ((s11_evt0 != 0) && ( !(s11_evt1 != 0)))) || ( !(((_x_s11_l0 != 0) && ( !(_x_s11_l1 != 0))) && (((s11_l0 != 0) && ( !(s11_l1 != 0))) && ((delta == 0.0) && ( !(( !(s11_evt2 != 0)) && (( !(s11_evt0 != 0)) && ( !(s11_evt1 != 0))))))))))) && ((((s11_evt2 != 0) && (( !(s11_evt0 != 0)) && ( !(s11_evt1 != 0)))) && (s11_backoff <= s11_x)) || ( !(((_x_s11_l1 != 0) && ( !(_x_s11_l0 != 0))) && (((s11_l0 != 0) && ( !(s11_l1 != 0))) && ((delta == 0.0) && ( !(( !(s11_evt2 != 0)) && (( !(s11_evt0 != 0)) && ( !(s11_evt1 != 0))))))))))) && (((((((((((((((((( !(_x_s10_evt2 != 0)) && ((_x_s10_evt0 != 0) && ( !(_x_s10_evt1 != 0)))) || (((( !(_x_s10_evt2 != 0)) && (( !(_x_s10_evt0 != 0)) && ( !(_x_s10_evt1 != 0)))) || ((_x_s10_evt2 != 0) && (( !(_x_s10_evt0 != 0)) && ( !(_x_s10_evt1 != 0))))) || ((( !(_x_s10_evt2 != 0)) && ((_x_s10_evt1 != 0) && ( !(_x_s10_evt0 != 0)))) || ((_x_s10_evt2 != 0) && ((_x_s10_evt1 != 0) && ( !(_x_s10_evt0 != 0))))))) && ((( !(_x_s10_l0 != 0)) && ( !(_x_s10_l1 != 0))) || (((_x_s10_l1 != 0) && ( !(_x_s10_l0 != 0))) || ((_x_s10_l0 != 0) && ( !(_x_s10_l1 != 0)))))) && (13.0 <= _x_s10_backoff)) && (( !(_x_s10_lambda <= 0.0)) && ((_x_s10_x <= _x_s10_lambda) || ( !((_x_s10_l1 != 0) && ( !(_x_s10_l0 != 0))))))) && ((((((s10_l0 != 0) == (_x_s10_l0 != 0)) && ((s10_l1 != 0) == (_x_s10_l1 != 0))) && (s10_lambda == _x_s10_lambda)) && (((delta + (s10_x + (-1.0 * _x_s10_x))) == 0.0) && (s10_backoff == _x_s10_backoff))) || ( !(( !(delta <= 0.0)) || (( !(s10_evt2 != 0)) && (( !(s10_evt0 != 0)) && ( !(s10_evt1 != 0)))))))) && (((((_x_s10_l0 != 0) && ( !(_x_s10_l1 != 0))) || ((( !(_x_s10_l0 != 0)) && ( !(_x_s10_l1 != 0))) || ((_x_s10_l1 != 0) && ( !(_x_s10_l0 != 0))))) && ((s10_backoff == _x_s10_backoff) && (_x_s10_x == 0.0))) || ( !((( !(s10_l0 != 0)) && ( !(s10_l1 != 0))) && ((delta == 0.0) && ( !(( !(s10_evt2 != 0)) && (( !(s10_evt0 != 0)) && ( !(s10_evt1 != 0)))))))))) && (((( !(s10_evt2 != 0)) && ((s10_evt0 != 0) && ( !(s10_evt1 != 0)))) && (s10_lambda == _x_s10_lambda)) || ( !((( !(_x_s10_l0 != 0)) && ( !(_x_s10_l1 != 0))) && ((( !(s10_l0 != 0)) && ( !(s10_l1 != 0))) && ((delta == 0.0) && ( !(( !(s10_evt2 != 0)) && (( !(s10_evt0 != 0)) && ( !(s10_evt1 != 0))))))))))) && (((s10_evt2 != 0) && (( !(s10_evt0 != 0)) && ( !(s10_evt1 != 0)))) || ( !(((_x_s10_l1 != 0) && ( !(_x_s10_l0 != 0))) && ((( !(s10_l0 != 0)) && ( !(s10_l1 != 0))) && ((delta == 0.0) && ( !(( !(s10_evt2 != 0)) && (( !(s10_evt0 != 0)) && ( !(s10_evt1 != 0))))))))))) && (((s10_lambda == _x_s10_lambda) && (((s10_evt2 != 0) && ((s10_evt1 != 0) && ( !(s10_evt0 != 0)))) || (( !(s10_evt2 != 0)) && ((s10_evt0 != 0) && ( !(s10_evt1 != 0)))))) || ( !(((_x_s10_l0 != 0) && ( !(_x_s10_l1 != 0))) && ((( !(s10_l0 != 0)) && ( !(s10_l1 != 0))) && ((delta == 0.0) && ( !(( !(s10_evt2 != 0)) && (( !(s10_evt0 != 0)) && ( !(s10_evt1 != 0))))))))))) && ((((s10_lambda == _x_s10_lambda) && (_x_s10_x == 0.0)) && ((( !(_x_s10_l0 != 0)) && ( !(_x_s10_l1 != 0))) || ((_x_s10_l0 != 0) && ( !(_x_s10_l1 != 0))))) || ( !(((s10_l1 != 0) && ( !(s10_l0 != 0))) && ((delta == 0.0) && ( !(( !(s10_evt2 != 0)) && (( !(s10_evt0 != 0)) && ( !(s10_evt1 != 0)))))))))) && (((s10_lambda <= s10_x) && ((( !(s10_evt2 != 0)) && ((s10_evt1 != 0) && ( !(s10_evt0 != 0)))) && (_x_s10_backoff <= s10_backoff))) || ( !((( !(_x_s10_l0 != 0)) && ( !(_x_s10_l1 != 0))) && (((s10_l1 != 0) && ( !(s10_l0 != 0))) && ((delta == 0.0) && ( !(( !(s10_evt2 != 0)) && (( !(s10_evt0 != 0)) && ( !(s10_evt1 != 0))))))))))) && (((( !(s10_evt2 != 0)) && ((s10_evt0 != 0) && ( !(s10_evt1 != 0)))) && ((s10_backoff + (-1.0 * _x_s10_backoff)) <= -1.0)) || ( !(((_x_s10_l0 != 0) && ( !(_x_s10_l1 != 0))) && (((s10_l1 != 0) && ( !(s10_l0 != 0))) && ((delta == 0.0) && ( !(( !(s10_evt2 != 0)) && (( !(s10_evt0 != 0)) && ( !(s10_evt1 != 0))))))))))) && (((s10_lambda == _x_s10_lambda) && ((((_x_s10_l1 != 0) && ( !(_x_s10_l0 != 0))) || ((_x_s10_l0 != 0) && ( !(_x_s10_l1 != 0)))) && ((s10_backoff == _x_s10_backoff) && (_x_s10_x == 0.0)))) || ( !(((s10_l0 != 0) && ( !(s10_l1 != 0))) && ((delta == 0.0) && ( !(( !(s10_evt2 != 0)) && (( !(s10_evt0 != 0)) && ( !(s10_evt1 != 0)))))))))) && ((( !(s10_evt2 != 0)) && ((s10_evt0 != 0) && ( !(s10_evt1 != 0)))) || ( !(((_x_s10_l0 != 0) && ( !(_x_s10_l1 != 0))) && (((s10_l0 != 0) && ( !(s10_l1 != 0))) && ((delta == 0.0) && ( !(( !(s10_evt2 != 0)) && (( !(s10_evt0 != 0)) && ( !(s10_evt1 != 0))))))))))) && ((((s10_evt2 != 0) && (( !(s10_evt0 != 0)) && ( !(s10_evt1 != 0)))) && (s10_backoff <= s10_x)) || ( !(((_x_s10_l1 != 0) && ( !(_x_s10_l0 != 0))) && (((s10_l0 != 0) && ( !(s10_l1 != 0))) && ((delta == 0.0) && ( !(( !(s10_evt2 != 0)) && (( !(s10_evt0 != 0)) && ( !(s10_evt1 != 0))))))))))) && (((((((((((((((((( !(_x_s9_evt2 != 0)) && ((_x_s9_evt0 != 0) && ( !(_x_s9_evt1 != 0)))) || (((( !(_x_s9_evt2 != 0)) && (( !(_x_s9_evt0 != 0)) && ( !(_x_s9_evt1 != 0)))) || ((_x_s9_evt2 != 0) && (( !(_x_s9_evt0 != 0)) && ( !(_x_s9_evt1 != 0))))) || ((( !(_x_s9_evt2 != 0)) && ((_x_s9_evt1 != 0) && ( !(_x_s9_evt0 != 0)))) || ((_x_s9_evt2 != 0) && ((_x_s9_evt1 != 0) && ( !(_x_s9_evt0 != 0))))))) && ((( !(_x_s9_l0 != 0)) && ( !(_x_s9_l1 != 0))) || (((_x_s9_l1 != 0) && ( !(_x_s9_l0 != 0))) || ((_x_s9_l0 != 0) && ( !(_x_s9_l1 != 0)))))) && (13.0 <= _x_s9_backoff)) && (( !(_x_s9_lambda <= 0.0)) && ((_x_s9_x <= _x_s9_lambda) || ( !((_x_s9_l1 != 0) && ( !(_x_s9_l0 != 0))))))) && ((((((s9_l0 != 0) == (_x_s9_l0 != 0)) && ((s9_l1 != 0) == (_x_s9_l1 != 0))) && (s9_lambda == _x_s9_lambda)) && (((delta + (s9_x + (-1.0 * _x_s9_x))) == 0.0) && (s9_backoff == _x_s9_backoff))) || ( !(( !(delta <= 0.0)) || (( !(s9_evt2 != 0)) && (( !(s9_evt0 != 0)) && ( !(s9_evt1 != 0)))))))) && (((((_x_s9_l0 != 0) && ( !(_x_s9_l1 != 0))) || ((( !(_x_s9_l0 != 0)) && ( !(_x_s9_l1 != 0))) || ((_x_s9_l1 != 0) && ( !(_x_s9_l0 != 0))))) && ((s9_backoff == _x_s9_backoff) && (_x_s9_x == 0.0))) || ( !((( !(s9_l0 != 0)) && ( !(s9_l1 != 0))) && ((delta == 0.0) && ( !(( !(s9_evt2 != 0)) && (( !(s9_evt0 != 0)) && ( !(s9_evt1 != 0)))))))))) && (((( !(s9_evt2 != 0)) && ((s9_evt0 != 0) && ( !(s9_evt1 != 0)))) && (s9_lambda == _x_s9_lambda)) || ( !((( !(_x_s9_l0 != 0)) && ( !(_x_s9_l1 != 0))) && ((( !(s9_l0 != 0)) && ( !(s9_l1 != 0))) && ((delta == 0.0) && ( !(( !(s9_evt2 != 0)) && (( !(s9_evt0 != 0)) && ( !(s9_evt1 != 0))))))))))) && (((s9_evt2 != 0) && (( !(s9_evt0 != 0)) && ( !(s9_evt1 != 0)))) || ( !(((_x_s9_l1 != 0) && ( !(_x_s9_l0 != 0))) && ((( !(s9_l0 != 0)) && ( !(s9_l1 != 0))) && ((delta == 0.0) && ( !(( !(s9_evt2 != 0)) && (( !(s9_evt0 != 0)) && ( !(s9_evt1 != 0))))))))))) && (((s9_lambda == _x_s9_lambda) && (((s9_evt2 != 0) && ((s9_evt1 != 0) && ( !(s9_evt0 != 0)))) || (( !(s9_evt2 != 0)) && ((s9_evt0 != 0) && ( !(s9_evt1 != 0)))))) || ( !(((_x_s9_l0 != 0) && ( !(_x_s9_l1 != 0))) && ((( !(s9_l0 != 0)) && ( !(s9_l1 != 0))) && ((delta == 0.0) && ( !(( !(s9_evt2 != 0)) && (( !(s9_evt0 != 0)) && ( !(s9_evt1 != 0))))))))))) && ((((s9_lambda == _x_s9_lambda) && (_x_s9_x == 0.0)) && ((( !(_x_s9_l0 != 0)) && ( !(_x_s9_l1 != 0))) || ((_x_s9_l0 != 0) && ( !(_x_s9_l1 != 0))))) || ( !(((s9_l1 != 0) && ( !(s9_l0 != 0))) && ((delta == 0.0) && ( !(( !(s9_evt2 != 0)) && (( !(s9_evt0 != 0)) && ( !(s9_evt1 != 0)))))))))) && (((s9_lambda <= s9_x) && ((( !(s9_evt2 != 0)) && ((s9_evt1 != 0) && ( !(s9_evt0 != 0)))) && (_x_s9_backoff <= s9_backoff))) || ( !((( !(_x_s9_l0 != 0)) && ( !(_x_s9_l1 != 0))) && (((s9_l1 != 0) && ( !(s9_l0 != 0))) && ((delta == 0.0) && ( !(( !(s9_evt2 != 0)) && (( !(s9_evt0 != 0)) && ( !(s9_evt1 != 0))))))))))) && (((( !(s9_evt2 != 0)) && ((s9_evt0 != 0) && ( !(s9_evt1 != 0)))) && ((s9_backoff + (-1.0 * _x_s9_backoff)) <= -1.0)) || ( !(((_x_s9_l0 != 0) && ( !(_x_s9_l1 != 0))) && (((s9_l1 != 0) && ( !(s9_l0 != 0))) && ((delta == 0.0) && ( !(( !(s9_evt2 != 0)) && (( !(s9_evt0 != 0)) && ( !(s9_evt1 != 0))))))))))) && (((s9_lambda == _x_s9_lambda) && ((((_x_s9_l1 != 0) && ( !(_x_s9_l0 != 0))) || ((_x_s9_l0 != 0) && ( !(_x_s9_l1 != 0)))) && ((s9_backoff == _x_s9_backoff) && (_x_s9_x == 0.0)))) || ( !(((s9_l0 != 0) && ( !(s9_l1 != 0))) && ((delta == 0.0) && ( !(( !(s9_evt2 != 0)) && (( !(s9_evt0 != 0)) && ( !(s9_evt1 != 0)))))))))) && ((( !(s9_evt2 != 0)) && ((s9_evt0 != 0) && ( !(s9_evt1 != 0)))) || ( !(((_x_s9_l0 != 0) && ( !(_x_s9_l1 != 0))) && (((s9_l0 != 0) && ( !(s9_l1 != 0))) && ((delta == 0.0) && ( !(( !(s9_evt2 != 0)) && (( !(s9_evt0 != 0)) && ( !(s9_evt1 != 0))))))))))) && ((((s9_evt2 != 0) && (( !(s9_evt0 != 0)) && ( !(s9_evt1 != 0)))) && (s9_backoff <= s9_x)) || ( !(((_x_s9_l1 != 0) && ( !(_x_s9_l0 != 0))) && (((s9_l0 != 0) && ( !(s9_l1 != 0))) && ((delta == 0.0) && ( !(( !(s9_evt2 != 0)) && (( !(s9_evt0 != 0)) && ( !(s9_evt1 != 0))))))))))) && (((((((((((((((((( !(_x_s8_evt2 != 0)) && ((_x_s8_evt0 != 0) && ( !(_x_s8_evt1 != 0)))) || (((( !(_x_s8_evt2 != 0)) && (( !(_x_s8_evt0 != 0)) && ( !(_x_s8_evt1 != 0)))) || ((_x_s8_evt2 != 0) && (( !(_x_s8_evt0 != 0)) && ( !(_x_s8_evt1 != 0))))) || ((( !(_x_s8_evt2 != 0)) && ((_x_s8_evt1 != 0) && ( !(_x_s8_evt0 != 0)))) || ((_x_s8_evt2 != 0) && ((_x_s8_evt1 != 0) && ( !(_x_s8_evt0 != 0))))))) && ((( !(_x_s8_l0 != 0)) && ( !(_x_s8_l1 != 0))) || (((_x_s8_l1 != 0) && ( !(_x_s8_l0 != 0))) || ((_x_s8_l0 != 0) && ( !(_x_s8_l1 != 0)))))) && (13.0 <= _x_s8_backoff)) && (( !(_x_s8_lambda <= 0.0)) && ((_x_s8_x <= _x_s8_lambda) || ( !((_x_s8_l1 != 0) && ( !(_x_s8_l0 != 0))))))) && ((((((s8_l0 != 0) == (_x_s8_l0 != 0)) && ((s8_l1 != 0) == (_x_s8_l1 != 0))) && (s8_lambda == _x_s8_lambda)) && (((delta + (s8_x + (-1.0 * _x_s8_x))) == 0.0) && (s8_backoff == _x_s8_backoff))) || ( !(( !(delta <= 0.0)) || (( !(s8_evt2 != 0)) && (( !(s8_evt0 != 0)) && ( !(s8_evt1 != 0)))))))) && (((((_x_s8_l0 != 0) && ( !(_x_s8_l1 != 0))) || ((( !(_x_s8_l0 != 0)) && ( !(_x_s8_l1 != 0))) || ((_x_s8_l1 != 0) && ( !(_x_s8_l0 != 0))))) && ((s8_backoff == _x_s8_backoff) && (_x_s8_x == 0.0))) || ( !((( !(s8_l0 != 0)) && ( !(s8_l1 != 0))) && ((delta == 0.0) && ( !(( !(s8_evt2 != 0)) && (( !(s8_evt0 != 0)) && ( !(s8_evt1 != 0)))))))))) && (((( !(s8_evt2 != 0)) && ((s8_evt0 != 0) && ( !(s8_evt1 != 0)))) && (s8_lambda == _x_s8_lambda)) || ( !((( !(_x_s8_l0 != 0)) && ( !(_x_s8_l1 != 0))) && ((( !(s8_l0 != 0)) && ( !(s8_l1 != 0))) && ((delta == 0.0) && ( !(( !(s8_evt2 != 0)) && (( !(s8_evt0 != 0)) && ( !(s8_evt1 != 0))))))))))) && (((s8_evt2 != 0) && (( !(s8_evt0 != 0)) && ( !(s8_evt1 != 0)))) || ( !(((_x_s8_l1 != 0) && ( !(_x_s8_l0 != 0))) && ((( !(s8_l0 != 0)) && ( !(s8_l1 != 0))) && ((delta == 0.0) && ( !(( !(s8_evt2 != 0)) && (( !(s8_evt0 != 0)) && ( !(s8_evt1 != 0))))))))))) && (((s8_lambda == _x_s8_lambda) && (((s8_evt2 != 0) && ((s8_evt1 != 0) && ( !(s8_evt0 != 0)))) || (( !(s8_evt2 != 0)) && ((s8_evt0 != 0) && ( !(s8_evt1 != 0)))))) || ( !(((_x_s8_l0 != 0) && ( !(_x_s8_l1 != 0))) && ((( !(s8_l0 != 0)) && ( !(s8_l1 != 0))) && ((delta == 0.0) && ( !(( !(s8_evt2 != 0)) && (( !(s8_evt0 != 0)) && ( !(s8_evt1 != 0))))))))))) && ((((s8_lambda == _x_s8_lambda) && (_x_s8_x == 0.0)) && ((( !(_x_s8_l0 != 0)) && ( !(_x_s8_l1 != 0))) || ((_x_s8_l0 != 0) && ( !(_x_s8_l1 != 0))))) || ( !(((s8_l1 != 0) && ( !(s8_l0 != 0))) && ((delta == 0.0) && ( !(( !(s8_evt2 != 0)) && (( !(s8_evt0 != 0)) && ( !(s8_evt1 != 0)))))))))) && (((s8_lambda <= s8_x) && ((( !(s8_evt2 != 0)) && ((s8_evt1 != 0) && ( !(s8_evt0 != 0)))) && (_x_s8_backoff <= s8_backoff))) || ( !((( !(_x_s8_l0 != 0)) && ( !(_x_s8_l1 != 0))) && (((s8_l1 != 0) && ( !(s8_l0 != 0))) && ((delta == 0.0) && ( !(( !(s8_evt2 != 0)) && (( !(s8_evt0 != 0)) && ( !(s8_evt1 != 0))))))))))) && (((( !(s8_evt2 != 0)) && ((s8_evt0 != 0) && ( !(s8_evt1 != 0)))) && ((s8_backoff + (-1.0 * _x_s8_backoff)) <= -1.0)) || ( !(((_x_s8_l0 != 0) && ( !(_x_s8_l1 != 0))) && (((s8_l1 != 0) && ( !(s8_l0 != 0))) && ((delta == 0.0) && ( !(( !(s8_evt2 != 0)) && (( !(s8_evt0 != 0)) && ( !(s8_evt1 != 0))))))))))) && (((s8_lambda == _x_s8_lambda) && ((((_x_s8_l1 != 0) && ( !(_x_s8_l0 != 0))) || ((_x_s8_l0 != 0) && ( !(_x_s8_l1 != 0)))) && ((s8_backoff == _x_s8_backoff) && (_x_s8_x == 0.0)))) || ( !(((s8_l0 != 0) && ( !(s8_l1 != 0))) && ((delta == 0.0) && ( !(( !(s8_evt2 != 0)) && (( !(s8_evt0 != 0)) && ( !(s8_evt1 != 0)))))))))) && ((( !(s8_evt2 != 0)) && ((s8_evt0 != 0) && ( !(s8_evt1 != 0)))) || ( !(((_x_s8_l0 != 0) && ( !(_x_s8_l1 != 0))) && (((s8_l0 != 0) && ( !(s8_l1 != 0))) && ((delta == 0.0) && ( !(( !(s8_evt2 != 0)) && (( !(s8_evt0 != 0)) && ( !(s8_evt1 != 0))))))))))) && ((((s8_evt2 != 0) && (( !(s8_evt0 != 0)) && ( !(s8_evt1 != 0)))) && (s8_backoff <= s8_x)) || ( !(((_x_s8_l1 != 0) && ( !(_x_s8_l0 != 0))) && (((s8_l0 != 0) && ( !(s8_l1 != 0))) && ((delta == 0.0) && ( !(( !(s8_evt2 != 0)) && (( !(s8_evt0 != 0)) && ( !(s8_evt1 != 0))))))))))) && (((((((((((((((((( !(_x_s7_evt2 != 0)) && ((_x_s7_evt0 != 0) && ( !(_x_s7_evt1 != 0)))) || (((( !(_x_s7_evt2 != 0)) && (( !(_x_s7_evt0 != 0)) && ( !(_x_s7_evt1 != 0)))) || ((_x_s7_evt2 != 0) && (( !(_x_s7_evt0 != 0)) && ( !(_x_s7_evt1 != 0))))) || ((( !(_x_s7_evt2 != 0)) && ((_x_s7_evt1 != 0) && ( !(_x_s7_evt0 != 0)))) || ((_x_s7_evt2 != 0) && ((_x_s7_evt1 != 0) && ( !(_x_s7_evt0 != 0))))))) && ((( !(_x_s7_l0 != 0)) && ( !(_x_s7_l1 != 0))) || (((_x_s7_l1 != 0) && ( !(_x_s7_l0 != 0))) || ((_x_s7_l0 != 0) && ( !(_x_s7_l1 != 0)))))) && (13.0 <= _x_s7_backoff)) && (( !(_x_s7_lambda <= 0.0)) && ((_x_s7_x <= _x_s7_lambda) || ( !((_x_s7_l1 != 0) && ( !(_x_s7_l0 != 0))))))) && ((((((s7_l0 != 0) == (_x_s7_l0 != 0)) && ((s7_l1 != 0) == (_x_s7_l1 != 0))) && (s7_lambda == _x_s7_lambda)) && (((delta + (s7_x + (-1.0 * _x_s7_x))) == 0.0) && (s7_backoff == _x_s7_backoff))) || ( !(( !(delta <= 0.0)) || (( !(s7_evt2 != 0)) && (( !(s7_evt0 != 0)) && ( !(s7_evt1 != 0)))))))) && (((((_x_s7_l0 != 0) && ( !(_x_s7_l1 != 0))) || ((( !(_x_s7_l0 != 0)) && ( !(_x_s7_l1 != 0))) || ((_x_s7_l1 != 0) && ( !(_x_s7_l0 != 0))))) && ((s7_backoff == _x_s7_backoff) && (_x_s7_x == 0.0))) || ( !((( !(s7_l0 != 0)) && ( !(s7_l1 != 0))) && ((delta == 0.0) && ( !(( !(s7_evt2 != 0)) && (( !(s7_evt0 != 0)) && ( !(s7_evt1 != 0)))))))))) && (((( !(s7_evt2 != 0)) && ((s7_evt0 != 0) && ( !(s7_evt1 != 0)))) && (s7_lambda == _x_s7_lambda)) || ( !((( !(_x_s7_l0 != 0)) && ( !(_x_s7_l1 != 0))) && ((( !(s7_l0 != 0)) && ( !(s7_l1 != 0))) && ((delta == 0.0) && ( !(( !(s7_evt2 != 0)) && (( !(s7_evt0 != 0)) && ( !(s7_evt1 != 0))))))))))) && (((s7_evt2 != 0) && (( !(s7_evt0 != 0)) && ( !(s7_evt1 != 0)))) || ( !(((_x_s7_l1 != 0) && ( !(_x_s7_l0 != 0))) && ((( !(s7_l0 != 0)) && ( !(s7_l1 != 0))) && ((delta == 0.0) && ( !(( !(s7_evt2 != 0)) && (( !(s7_evt0 != 0)) && ( !(s7_evt1 != 0))))))))))) && (((s7_lambda == _x_s7_lambda) && (((s7_evt2 != 0) && ((s7_evt1 != 0) && ( !(s7_evt0 != 0)))) || (( !(s7_evt2 != 0)) && ((s7_evt0 != 0) && ( !(s7_evt1 != 0)))))) || ( !(((_x_s7_l0 != 0) && ( !(_x_s7_l1 != 0))) && ((( !(s7_l0 != 0)) && ( !(s7_l1 != 0))) && ((delta == 0.0) && ( !(( !(s7_evt2 != 0)) && (( !(s7_evt0 != 0)) && ( !(s7_evt1 != 0))))))))))) && ((((s7_lambda == _x_s7_lambda) && (_x_s7_x == 0.0)) && ((( !(_x_s7_l0 != 0)) && ( !(_x_s7_l1 != 0))) || ((_x_s7_l0 != 0) && ( !(_x_s7_l1 != 0))))) || ( !(((s7_l1 != 0) && ( !(s7_l0 != 0))) && ((delta == 0.0) && ( !(( !(s7_evt2 != 0)) && (( !(s7_evt0 != 0)) && ( !(s7_evt1 != 0)))))))))) && (((s7_lambda <= s7_x) && ((( !(s7_evt2 != 0)) && ((s7_evt1 != 0) && ( !(s7_evt0 != 0)))) && (_x_s7_backoff <= s7_backoff))) || ( !((( !(_x_s7_l0 != 0)) && ( !(_x_s7_l1 != 0))) && (((s7_l1 != 0) && ( !(s7_l0 != 0))) && ((delta == 0.0) && ( !(( !(s7_evt2 != 0)) && (( !(s7_evt0 != 0)) && ( !(s7_evt1 != 0))))))))))) && (((( !(s7_evt2 != 0)) && ((s7_evt0 != 0) && ( !(s7_evt1 != 0)))) && ((s7_backoff + (-1.0 * _x_s7_backoff)) <= -1.0)) || ( !(((_x_s7_l0 != 0) && ( !(_x_s7_l1 != 0))) && (((s7_l1 != 0) && ( !(s7_l0 != 0))) && ((delta == 0.0) && ( !(( !(s7_evt2 != 0)) && (( !(s7_evt0 != 0)) && ( !(s7_evt1 != 0))))))))))) && (((s7_lambda == _x_s7_lambda) && ((((_x_s7_l1 != 0) && ( !(_x_s7_l0 != 0))) || ((_x_s7_l0 != 0) && ( !(_x_s7_l1 != 0)))) && ((s7_backoff == _x_s7_backoff) && (_x_s7_x == 0.0)))) || ( !(((s7_l0 != 0) && ( !(s7_l1 != 0))) && ((delta == 0.0) && ( !(( !(s7_evt2 != 0)) && (( !(s7_evt0 != 0)) && ( !(s7_evt1 != 0)))))))))) && ((( !(s7_evt2 != 0)) && ((s7_evt0 != 0) && ( !(s7_evt1 != 0)))) || ( !(((_x_s7_l0 != 0) && ( !(_x_s7_l1 != 0))) && (((s7_l0 != 0) && ( !(s7_l1 != 0))) && ((delta == 0.0) && ( !(( !(s7_evt2 != 0)) && (( !(s7_evt0 != 0)) && ( !(s7_evt1 != 0))))))))))) && ((((s7_evt2 != 0) && (( !(s7_evt0 != 0)) && ( !(s7_evt1 != 0)))) && (s7_backoff <= s7_x)) || ( !(((_x_s7_l1 != 0) && ( !(_x_s7_l0 != 0))) && (((s7_l0 != 0) && ( !(s7_l1 != 0))) && ((delta == 0.0) && ( !(( !(s7_evt2 != 0)) && (( !(s7_evt0 != 0)) && ( !(s7_evt1 != 0))))))))))) && (((((((((((((((((( !(_x_s6_evt2 != 0)) && ((_x_s6_evt0 != 0) && ( !(_x_s6_evt1 != 0)))) || (((( !(_x_s6_evt2 != 0)) && (( !(_x_s6_evt0 != 0)) && ( !(_x_s6_evt1 != 0)))) || ((_x_s6_evt2 != 0) && (( !(_x_s6_evt0 != 0)) && ( !(_x_s6_evt1 != 0))))) || ((( !(_x_s6_evt2 != 0)) && ((_x_s6_evt1 != 0) && ( !(_x_s6_evt0 != 0)))) || ((_x_s6_evt2 != 0) && ((_x_s6_evt1 != 0) && ( !(_x_s6_evt0 != 0))))))) && ((( !(_x_s6_l0 != 0)) && ( !(_x_s6_l1 != 0))) || (((_x_s6_l1 != 0) && ( !(_x_s6_l0 != 0))) || ((_x_s6_l0 != 0) && ( !(_x_s6_l1 != 0)))))) && (13.0 <= _x_s6_backoff)) && (( !(_x_s6_lambda <= 0.0)) && ((_x_s6_x <= _x_s6_lambda) || ( !((_x_s6_l1 != 0) && ( !(_x_s6_l0 != 0))))))) && ((((((s6_l0 != 0) == (_x_s6_l0 != 0)) && ((s6_l1 != 0) == (_x_s6_l1 != 0))) && (s6_lambda == _x_s6_lambda)) && (((delta + (s6_x + (-1.0 * _x_s6_x))) == 0.0) && (s6_backoff == _x_s6_backoff))) || ( !(( !(delta <= 0.0)) || (( !(s6_evt2 != 0)) && (( !(s6_evt0 != 0)) && ( !(s6_evt1 != 0)))))))) && (((((_x_s6_l0 != 0) && ( !(_x_s6_l1 != 0))) || ((( !(_x_s6_l0 != 0)) && ( !(_x_s6_l1 != 0))) || ((_x_s6_l1 != 0) && ( !(_x_s6_l0 != 0))))) && ((s6_backoff == _x_s6_backoff) && (_x_s6_x == 0.0))) || ( !((( !(s6_l0 != 0)) && ( !(s6_l1 != 0))) && ((delta == 0.0) && ( !(( !(s6_evt2 != 0)) && (( !(s6_evt0 != 0)) && ( !(s6_evt1 != 0)))))))))) && (((( !(s6_evt2 != 0)) && ((s6_evt0 != 0) && ( !(s6_evt1 != 0)))) && (s6_lambda == _x_s6_lambda)) || ( !((( !(_x_s6_l0 != 0)) && ( !(_x_s6_l1 != 0))) && ((( !(s6_l0 != 0)) && ( !(s6_l1 != 0))) && ((delta == 0.0) && ( !(( !(s6_evt2 != 0)) && (( !(s6_evt0 != 0)) && ( !(s6_evt1 != 0))))))))))) && (((s6_evt2 != 0) && (( !(s6_evt0 != 0)) && ( !(s6_evt1 != 0)))) || ( !(((_x_s6_l1 != 0) && ( !(_x_s6_l0 != 0))) && ((( !(s6_l0 != 0)) && ( !(s6_l1 != 0))) && ((delta == 0.0) && ( !(( !(s6_evt2 != 0)) && (( !(s6_evt0 != 0)) && ( !(s6_evt1 != 0))))))))))) && (((s6_lambda == _x_s6_lambda) && (((s6_evt2 != 0) && ((s6_evt1 != 0) && ( !(s6_evt0 != 0)))) || (( !(s6_evt2 != 0)) && ((s6_evt0 != 0) && ( !(s6_evt1 != 0)))))) || ( !(((_x_s6_l0 != 0) && ( !(_x_s6_l1 != 0))) && ((( !(s6_l0 != 0)) && ( !(s6_l1 != 0))) && ((delta == 0.0) && ( !(( !(s6_evt2 != 0)) && (( !(s6_evt0 != 0)) && ( !(s6_evt1 != 0))))))))))) && ((((s6_lambda == _x_s6_lambda) && (_x_s6_x == 0.0)) && ((( !(_x_s6_l0 != 0)) && ( !(_x_s6_l1 != 0))) || ((_x_s6_l0 != 0) && ( !(_x_s6_l1 != 0))))) || ( !(((s6_l1 != 0) && ( !(s6_l0 != 0))) && ((delta == 0.0) && ( !(( !(s6_evt2 != 0)) && (( !(s6_evt0 != 0)) && ( !(s6_evt1 != 0)))))))))) && (((s6_lambda <= s6_x) && ((( !(s6_evt2 != 0)) && ((s6_evt1 != 0) && ( !(s6_evt0 != 0)))) && (_x_s6_backoff <= s6_backoff))) || ( !((( !(_x_s6_l0 != 0)) && ( !(_x_s6_l1 != 0))) && (((s6_l1 != 0) && ( !(s6_l0 != 0))) && ((delta == 0.0) && ( !(( !(s6_evt2 != 0)) && (( !(s6_evt0 != 0)) && ( !(s6_evt1 != 0))))))))))) && (((( !(s6_evt2 != 0)) && ((s6_evt0 != 0) && ( !(s6_evt1 != 0)))) && ((s6_backoff + (-1.0 * _x_s6_backoff)) <= -1.0)) || ( !(((_x_s6_l0 != 0) && ( !(_x_s6_l1 != 0))) && (((s6_l1 != 0) && ( !(s6_l0 != 0))) && ((delta == 0.0) && ( !(( !(s6_evt2 != 0)) && (( !(s6_evt0 != 0)) && ( !(s6_evt1 != 0))))))))))) && (((s6_lambda == _x_s6_lambda) && ((((_x_s6_l1 != 0) && ( !(_x_s6_l0 != 0))) || ((_x_s6_l0 != 0) && ( !(_x_s6_l1 != 0)))) && ((s6_backoff == _x_s6_backoff) && (_x_s6_x == 0.0)))) || ( !(((s6_l0 != 0) && ( !(s6_l1 != 0))) && ((delta == 0.0) && ( !(( !(s6_evt2 != 0)) && (( !(s6_evt0 != 0)) && ( !(s6_evt1 != 0)))))))))) && ((( !(s6_evt2 != 0)) && ((s6_evt0 != 0) && ( !(s6_evt1 != 0)))) || ( !(((_x_s6_l0 != 0) && ( !(_x_s6_l1 != 0))) && (((s6_l0 != 0) && ( !(s6_l1 != 0))) && ((delta == 0.0) && ( !(( !(s6_evt2 != 0)) && (( !(s6_evt0 != 0)) && ( !(s6_evt1 != 0))))))))))) && ((((s6_evt2 != 0) && (( !(s6_evt0 != 0)) && ( !(s6_evt1 != 0)))) && (s6_backoff <= s6_x)) || ( !(((_x_s6_l1 != 0) && ( !(_x_s6_l0 != 0))) && (((s6_l0 != 0) && ( !(s6_l1 != 0))) && ((delta == 0.0) && ( !(( !(s6_evt2 != 0)) && (( !(s6_evt0 != 0)) && ( !(s6_evt1 != 0))))))))))) && (((((((((((((((((( !(_x_s5_evt2 != 0)) && ((_x_s5_evt0 != 0) && ( !(_x_s5_evt1 != 0)))) || (((( !(_x_s5_evt2 != 0)) && (( !(_x_s5_evt0 != 0)) && ( !(_x_s5_evt1 != 0)))) || ((_x_s5_evt2 != 0) && (( !(_x_s5_evt0 != 0)) && ( !(_x_s5_evt1 != 0))))) || ((( !(_x_s5_evt2 != 0)) && ((_x_s5_evt1 != 0) && ( !(_x_s5_evt0 != 0)))) || ((_x_s5_evt2 != 0) && ((_x_s5_evt1 != 0) && ( !(_x_s5_evt0 != 0))))))) && ((( !(_x_s5_l0 != 0)) && ( !(_x_s5_l1 != 0))) || (((_x_s5_l1 != 0) && ( !(_x_s5_l0 != 0))) || ((_x_s5_l0 != 0) && ( !(_x_s5_l1 != 0)))))) && (13.0 <= _x_s5_backoff)) && (( !(_x_s5_lambda <= 0.0)) && ((_x_s5_x <= _x_s5_lambda) || ( !((_x_s5_l1 != 0) && ( !(_x_s5_l0 != 0))))))) && ((((((s5_l0 != 0) == (_x_s5_l0 != 0)) && ((s5_l1 != 0) == (_x_s5_l1 != 0))) && (s5_lambda == _x_s5_lambda)) && (((delta + (s5_x + (-1.0 * _x_s5_x))) == 0.0) && (s5_backoff == _x_s5_backoff))) || ( !(( !(delta <= 0.0)) || (( !(s5_evt2 != 0)) && (( !(s5_evt0 != 0)) && ( !(s5_evt1 != 0)))))))) && (((((_x_s5_l0 != 0) && ( !(_x_s5_l1 != 0))) || ((( !(_x_s5_l0 != 0)) && ( !(_x_s5_l1 != 0))) || ((_x_s5_l1 != 0) && ( !(_x_s5_l0 != 0))))) && ((s5_backoff == _x_s5_backoff) && (_x_s5_x == 0.0))) || ( !((( !(s5_l0 != 0)) && ( !(s5_l1 != 0))) && ((delta == 0.0) && ( !(( !(s5_evt2 != 0)) && (( !(s5_evt0 != 0)) && ( !(s5_evt1 != 0)))))))))) && (((( !(s5_evt2 != 0)) && ((s5_evt0 != 0) && ( !(s5_evt1 != 0)))) && (s5_lambda == _x_s5_lambda)) || ( !((( !(_x_s5_l0 != 0)) && ( !(_x_s5_l1 != 0))) && ((( !(s5_l0 != 0)) && ( !(s5_l1 != 0))) && ((delta == 0.0) && ( !(( !(s5_evt2 != 0)) && (( !(s5_evt0 != 0)) && ( !(s5_evt1 != 0))))))))))) && (((s5_evt2 != 0) && (( !(s5_evt0 != 0)) && ( !(s5_evt1 != 0)))) || ( !(((_x_s5_l1 != 0) && ( !(_x_s5_l0 != 0))) && ((( !(s5_l0 != 0)) && ( !(s5_l1 != 0))) && ((delta == 0.0) && ( !(( !(s5_evt2 != 0)) && (( !(s5_evt0 != 0)) && ( !(s5_evt1 != 0))))))))))) && (((s5_lambda == _x_s5_lambda) && (((s5_evt2 != 0) && ((s5_evt1 != 0) && ( !(s5_evt0 != 0)))) || (( !(s5_evt2 != 0)) && ((s5_evt0 != 0) && ( !(s5_evt1 != 0)))))) || ( !(((_x_s5_l0 != 0) && ( !(_x_s5_l1 != 0))) && ((( !(s5_l0 != 0)) && ( !(s5_l1 != 0))) && ((delta == 0.0) && ( !(( !(s5_evt2 != 0)) && (( !(s5_evt0 != 0)) && ( !(s5_evt1 != 0))))))))))) && ((((s5_lambda == _x_s5_lambda) && (_x_s5_x == 0.0)) && ((( !(_x_s5_l0 != 0)) && ( !(_x_s5_l1 != 0))) || ((_x_s5_l0 != 0) && ( !(_x_s5_l1 != 0))))) || ( !(((s5_l1 != 0) && ( !(s5_l0 != 0))) && ((delta == 0.0) && ( !(( !(s5_evt2 != 0)) && (( !(s5_evt0 != 0)) && ( !(s5_evt1 != 0)))))))))) && (((s5_lambda <= s5_x) && ((( !(s5_evt2 != 0)) && ((s5_evt1 != 0) && ( !(s5_evt0 != 0)))) && (_x_s5_backoff <= s5_backoff))) || ( !((( !(_x_s5_l0 != 0)) && ( !(_x_s5_l1 != 0))) && (((s5_l1 != 0) && ( !(s5_l0 != 0))) && ((delta == 0.0) && ( !(( !(s5_evt2 != 0)) && (( !(s5_evt0 != 0)) && ( !(s5_evt1 != 0))))))))))) && (((( !(s5_evt2 != 0)) && ((s5_evt0 != 0) && ( !(s5_evt1 != 0)))) && ((s5_backoff + (-1.0 * _x_s5_backoff)) <= -1.0)) || ( !(((_x_s5_l0 != 0) && ( !(_x_s5_l1 != 0))) && (((s5_l1 != 0) && ( !(s5_l0 != 0))) && ((delta == 0.0) && ( !(( !(s5_evt2 != 0)) && (( !(s5_evt0 != 0)) && ( !(s5_evt1 != 0))))))))))) && (((s5_lambda == _x_s5_lambda) && ((((_x_s5_l1 != 0) && ( !(_x_s5_l0 != 0))) || ((_x_s5_l0 != 0) && ( !(_x_s5_l1 != 0)))) && ((s5_backoff == _x_s5_backoff) && (_x_s5_x == 0.0)))) || ( !(((s5_l0 != 0) && ( !(s5_l1 != 0))) && ((delta == 0.0) && ( !(( !(s5_evt2 != 0)) && (( !(s5_evt0 != 0)) && ( !(s5_evt1 != 0)))))))))) && ((( !(s5_evt2 != 0)) && ((s5_evt0 != 0) && ( !(s5_evt1 != 0)))) || ( !(((_x_s5_l0 != 0) && ( !(_x_s5_l1 != 0))) && (((s5_l0 != 0) && ( !(s5_l1 != 0))) && ((delta == 0.0) && ( !(( !(s5_evt2 != 0)) && (( !(s5_evt0 != 0)) && ( !(s5_evt1 != 0))))))))))) && ((((s5_evt2 != 0) && (( !(s5_evt0 != 0)) && ( !(s5_evt1 != 0)))) && (s5_backoff <= s5_x)) || ( !(((_x_s5_l1 != 0) && ( !(_x_s5_l0 != 0))) && (((s5_l0 != 0) && ( !(s5_l1 != 0))) && ((delta == 0.0) && ( !(( !(s5_evt2 != 0)) && (( !(s5_evt0 != 0)) && ( !(s5_evt1 != 0))))))))))) && (((((((((((((((((( !(_x_s4_evt2 != 0)) && ((_x_s4_evt0 != 0) && ( !(_x_s4_evt1 != 0)))) || (((( !(_x_s4_evt2 != 0)) && (( !(_x_s4_evt0 != 0)) && ( !(_x_s4_evt1 != 0)))) || ((_x_s4_evt2 != 0) && (( !(_x_s4_evt0 != 0)) && ( !(_x_s4_evt1 != 0))))) || ((( !(_x_s4_evt2 != 0)) && ((_x_s4_evt1 != 0) && ( !(_x_s4_evt0 != 0)))) || ((_x_s4_evt2 != 0) && ((_x_s4_evt1 != 0) && ( !(_x_s4_evt0 != 0))))))) && ((( !(_x_s4_l0 != 0)) && ( !(_x_s4_l1 != 0))) || (((_x_s4_l1 != 0) && ( !(_x_s4_l0 != 0))) || ((_x_s4_l0 != 0) && ( !(_x_s4_l1 != 0)))))) && (13.0 <= _x_s4_backoff)) && (( !(_x_s4_lambda <= 0.0)) && ((_x_s4_x <= _x_s4_lambda) || ( !((_x_s4_l1 != 0) && ( !(_x_s4_l0 != 0))))))) && ((((((s4_l0 != 0) == (_x_s4_l0 != 0)) && ((s4_l1 != 0) == (_x_s4_l1 != 0))) && (s4_lambda == _x_s4_lambda)) && (((delta + (s4_x + (-1.0 * _x_s4_x))) == 0.0) && (s4_backoff == _x_s4_backoff))) || ( !(( !(delta <= 0.0)) || (( !(s4_evt2 != 0)) && (( !(s4_evt0 != 0)) && ( !(s4_evt1 != 0)))))))) && (((((_x_s4_l0 != 0) && ( !(_x_s4_l1 != 0))) || ((( !(_x_s4_l0 != 0)) && ( !(_x_s4_l1 != 0))) || ((_x_s4_l1 != 0) && ( !(_x_s4_l0 != 0))))) && ((s4_backoff == _x_s4_backoff) && (_x_s4_x == 0.0))) || ( !((( !(s4_l0 != 0)) && ( !(s4_l1 != 0))) && ((delta == 0.0) && ( !(( !(s4_evt2 != 0)) && (( !(s4_evt0 != 0)) && ( !(s4_evt1 != 0)))))))))) && (((( !(s4_evt2 != 0)) && ((s4_evt0 != 0) && ( !(s4_evt1 != 0)))) && (s4_lambda == _x_s4_lambda)) || ( !((( !(_x_s4_l0 != 0)) && ( !(_x_s4_l1 != 0))) && ((( !(s4_l0 != 0)) && ( !(s4_l1 != 0))) && ((delta == 0.0) && ( !(( !(s4_evt2 != 0)) && (( !(s4_evt0 != 0)) && ( !(s4_evt1 != 0))))))))))) && (((s4_evt2 != 0) && (( !(s4_evt0 != 0)) && ( !(s4_evt1 != 0)))) || ( !(((_x_s4_l1 != 0) && ( !(_x_s4_l0 != 0))) && ((( !(s4_l0 != 0)) && ( !(s4_l1 != 0))) && ((delta == 0.0) && ( !(( !(s4_evt2 != 0)) && (( !(s4_evt0 != 0)) && ( !(s4_evt1 != 0))))))))))) && (((s4_lambda == _x_s4_lambda) && (((s4_evt2 != 0) && ((s4_evt1 != 0) && ( !(s4_evt0 != 0)))) || (( !(s4_evt2 != 0)) && ((s4_evt0 != 0) && ( !(s4_evt1 != 0)))))) || ( !(((_x_s4_l0 != 0) && ( !(_x_s4_l1 != 0))) && ((( !(s4_l0 != 0)) && ( !(s4_l1 != 0))) && ((delta == 0.0) && ( !(( !(s4_evt2 != 0)) && (( !(s4_evt0 != 0)) && ( !(s4_evt1 != 0))))))))))) && ((((s4_lambda == _x_s4_lambda) && (_x_s4_x == 0.0)) && ((( !(_x_s4_l0 != 0)) && ( !(_x_s4_l1 != 0))) || ((_x_s4_l0 != 0) && ( !(_x_s4_l1 != 0))))) || ( !(((s4_l1 != 0) && ( !(s4_l0 != 0))) && ((delta == 0.0) && ( !(( !(s4_evt2 != 0)) && (( !(s4_evt0 != 0)) && ( !(s4_evt1 != 0)))))))))) && (((s4_lambda <= s4_x) && ((( !(s4_evt2 != 0)) && ((s4_evt1 != 0) && ( !(s4_evt0 != 0)))) && (_x_s4_backoff <= s4_backoff))) || ( !((( !(_x_s4_l0 != 0)) && ( !(_x_s4_l1 != 0))) && (((s4_l1 != 0) && ( !(s4_l0 != 0))) && ((delta == 0.0) && ( !(( !(s4_evt2 != 0)) && (( !(s4_evt0 != 0)) && ( !(s4_evt1 != 0))))))))))) && (((( !(s4_evt2 != 0)) && ((s4_evt0 != 0) && ( !(s4_evt1 != 0)))) && ((s4_backoff + (-1.0 * _x_s4_backoff)) <= -1.0)) || ( !(((_x_s4_l0 != 0) && ( !(_x_s4_l1 != 0))) && (((s4_l1 != 0) && ( !(s4_l0 != 0))) && ((delta == 0.0) && ( !(( !(s4_evt2 != 0)) && (( !(s4_evt0 != 0)) && ( !(s4_evt1 != 0))))))))))) && (((s4_lambda == _x_s4_lambda) && ((((_x_s4_l1 != 0) && ( !(_x_s4_l0 != 0))) || ((_x_s4_l0 != 0) && ( !(_x_s4_l1 != 0)))) && ((s4_backoff == _x_s4_backoff) && (_x_s4_x == 0.0)))) || ( !(((s4_l0 != 0) && ( !(s4_l1 != 0))) && ((delta == 0.0) && ( !(( !(s4_evt2 != 0)) && (( !(s4_evt0 != 0)) && ( !(s4_evt1 != 0)))))))))) && ((( !(s4_evt2 != 0)) && ((s4_evt0 != 0) && ( !(s4_evt1 != 0)))) || ( !(((_x_s4_l0 != 0) && ( !(_x_s4_l1 != 0))) && (((s4_l0 != 0) && ( !(s4_l1 != 0))) && ((delta == 0.0) && ( !(( !(s4_evt2 != 0)) && (( !(s4_evt0 != 0)) && ( !(s4_evt1 != 0))))))))))) && ((((s4_evt2 != 0) && (( !(s4_evt0 != 0)) && ( !(s4_evt1 != 0)))) && (s4_backoff <= s4_x)) || ( !(((_x_s4_l1 != 0) && ( !(_x_s4_l0 != 0))) && (((s4_l0 != 0) && ( !(s4_l1 != 0))) && ((delta == 0.0) && ( !(( !(s4_evt2 != 0)) && (( !(s4_evt0 != 0)) && ( !(s4_evt1 != 0))))))))))) && (((((((((((((((((( !(_x_s3_evt2 != 0)) && ((_x_s3_evt0 != 0) && ( !(_x_s3_evt1 != 0)))) || (((( !(_x_s3_evt2 != 0)) && (( !(_x_s3_evt0 != 0)) && ( !(_x_s3_evt1 != 0)))) || ((_x_s3_evt2 != 0) && (( !(_x_s3_evt0 != 0)) && ( !(_x_s3_evt1 != 0))))) || ((( !(_x_s3_evt2 != 0)) && ((_x_s3_evt1 != 0) && ( !(_x_s3_evt0 != 0)))) || ((_x_s3_evt2 != 0) && ((_x_s3_evt1 != 0) && ( !(_x_s3_evt0 != 0))))))) && ((( !(_x_s3_l0 != 0)) && ( !(_x_s3_l1 != 0))) || (((_x_s3_l1 != 0) && ( !(_x_s3_l0 != 0))) || ((_x_s3_l0 != 0) && ( !(_x_s3_l1 != 0)))))) && (13.0 <= _x_s3_backoff)) && (( !(_x_s3_lambda <= 0.0)) && ((_x_s3_x <= _x_s3_lambda) || ( !((_x_s3_l1 != 0) && ( !(_x_s3_l0 != 0))))))) && ((((((s3_l0 != 0) == (_x_s3_l0 != 0)) && ((s3_l1 != 0) == (_x_s3_l1 != 0))) && (s3_lambda == _x_s3_lambda)) && (((delta + (s3_x + (-1.0 * _x_s3_x))) == 0.0) && (s3_backoff == _x_s3_backoff))) || ( !(( !(delta <= 0.0)) || (( !(s3_evt2 != 0)) && (( !(s3_evt0 != 0)) && ( !(s3_evt1 != 0)))))))) && (((((_x_s3_l0 != 0) && ( !(_x_s3_l1 != 0))) || ((( !(_x_s3_l0 != 0)) && ( !(_x_s3_l1 != 0))) || ((_x_s3_l1 != 0) && ( !(_x_s3_l0 != 0))))) && ((s3_backoff == _x_s3_backoff) && (_x_s3_x == 0.0))) || ( !((( !(s3_l0 != 0)) && ( !(s3_l1 != 0))) && ((delta == 0.0) && ( !(( !(s3_evt2 != 0)) && (( !(s3_evt0 != 0)) && ( !(s3_evt1 != 0)))))))))) && (((( !(s3_evt2 != 0)) && ((s3_evt0 != 0) && ( !(s3_evt1 != 0)))) && (s3_lambda == _x_s3_lambda)) || ( !((( !(_x_s3_l0 != 0)) && ( !(_x_s3_l1 != 0))) && ((( !(s3_l0 != 0)) && ( !(s3_l1 != 0))) && ((delta == 0.0) && ( !(( !(s3_evt2 != 0)) && (( !(s3_evt0 != 0)) && ( !(s3_evt1 != 0))))))))))) && (((s3_evt2 != 0) && (( !(s3_evt0 != 0)) && ( !(s3_evt1 != 0)))) || ( !(((_x_s3_l1 != 0) && ( !(_x_s3_l0 != 0))) && ((( !(s3_l0 != 0)) && ( !(s3_l1 != 0))) && ((delta == 0.0) && ( !(( !(s3_evt2 != 0)) && (( !(s3_evt0 != 0)) && ( !(s3_evt1 != 0))))))))))) && (((s3_lambda == _x_s3_lambda) && (((s3_evt2 != 0) && ((s3_evt1 != 0) && ( !(s3_evt0 != 0)))) || (( !(s3_evt2 != 0)) && ((s3_evt0 != 0) && ( !(s3_evt1 != 0)))))) || ( !(((_x_s3_l0 != 0) && ( !(_x_s3_l1 != 0))) && ((( !(s3_l0 != 0)) && ( !(s3_l1 != 0))) && ((delta == 0.0) && ( !(( !(s3_evt2 != 0)) && (( !(s3_evt0 != 0)) && ( !(s3_evt1 != 0))))))))))) && ((((s3_lambda == _x_s3_lambda) && (_x_s3_x == 0.0)) && ((( !(_x_s3_l0 != 0)) && ( !(_x_s3_l1 != 0))) || ((_x_s3_l0 != 0) && ( !(_x_s3_l1 != 0))))) || ( !(((s3_l1 != 0) && ( !(s3_l0 != 0))) && ((delta == 0.0) && ( !(( !(s3_evt2 != 0)) && (( !(s3_evt0 != 0)) && ( !(s3_evt1 != 0)))))))))) && (((s3_lambda <= s3_x) && ((( !(s3_evt2 != 0)) && ((s3_evt1 != 0) && ( !(s3_evt0 != 0)))) && (_x_s3_backoff <= s3_backoff))) || ( !((( !(_x_s3_l0 != 0)) && ( !(_x_s3_l1 != 0))) && (((s3_l1 != 0) && ( !(s3_l0 != 0))) && ((delta == 0.0) && ( !(( !(s3_evt2 != 0)) && (( !(s3_evt0 != 0)) && ( !(s3_evt1 != 0))))))))))) && (((( !(s3_evt2 != 0)) && ((s3_evt0 != 0) && ( !(s3_evt1 != 0)))) && ((s3_backoff + (-1.0 * _x_s3_backoff)) <= -1.0)) || ( !(((_x_s3_l0 != 0) && ( !(_x_s3_l1 != 0))) && (((s3_l1 != 0) && ( !(s3_l0 != 0))) && ((delta == 0.0) && ( !(( !(s3_evt2 != 0)) && (( !(s3_evt0 != 0)) && ( !(s3_evt1 != 0))))))))))) && (((s3_lambda == _x_s3_lambda) && ((((_x_s3_l1 != 0) && ( !(_x_s3_l0 != 0))) || ((_x_s3_l0 != 0) && ( !(_x_s3_l1 != 0)))) && ((s3_backoff == _x_s3_backoff) && (_x_s3_x == 0.0)))) || ( !(((s3_l0 != 0) && ( !(s3_l1 != 0))) && ((delta == 0.0) && ( !(( !(s3_evt2 != 0)) && (( !(s3_evt0 != 0)) && ( !(s3_evt1 != 0)))))))))) && ((( !(s3_evt2 != 0)) && ((s3_evt0 != 0) && ( !(s3_evt1 != 0)))) || ( !(((_x_s3_l0 != 0) && ( !(_x_s3_l1 != 0))) && (((s3_l0 != 0) && ( !(s3_l1 != 0))) && ((delta == 0.0) && ( !(( !(s3_evt2 != 0)) && (( !(s3_evt0 != 0)) && ( !(s3_evt1 != 0))))))))))) && ((((s3_evt2 != 0) && (( !(s3_evt0 != 0)) && ( !(s3_evt1 != 0)))) && (s3_backoff <= s3_x)) || ( !(((_x_s3_l1 != 0) && ( !(_x_s3_l0 != 0))) && (((s3_l0 != 0) && ( !(s3_l1 != 0))) && ((delta == 0.0) && ( !(( !(s3_evt2 != 0)) && (( !(s3_evt0 != 0)) && ( !(s3_evt1 != 0))))))))))) && (((((((((((((((((( !(_x_s2_evt2 != 0)) && ((_x_s2_evt0 != 0) && ( !(_x_s2_evt1 != 0)))) || (((( !(_x_s2_evt2 != 0)) && (( !(_x_s2_evt0 != 0)) && ( !(_x_s2_evt1 != 0)))) || ((_x_s2_evt2 != 0) && (( !(_x_s2_evt0 != 0)) && ( !(_x_s2_evt1 != 0))))) || ((( !(_x_s2_evt2 != 0)) && ((_x_s2_evt1 != 0) && ( !(_x_s2_evt0 != 0)))) || ((_x_s2_evt2 != 0) && ((_x_s2_evt1 != 0) && ( !(_x_s2_evt0 != 0))))))) && ((( !(_x_s2_l0 != 0)) && ( !(_x_s2_l1 != 0))) || (((_x_s2_l1 != 0) && ( !(_x_s2_l0 != 0))) || ((_x_s2_l0 != 0) && ( !(_x_s2_l1 != 0)))))) && (13.0 <= _x_s2_backoff)) && (( !(_x_s2_lambda <= 0.0)) && ((_x_s2_x <= _x_s2_lambda) || ( !((_x_s2_l1 != 0) && ( !(_x_s2_l0 != 0))))))) && ((((((s2_l0 != 0) == (_x_s2_l0 != 0)) && ((s2_l1 != 0) == (_x_s2_l1 != 0))) && (s2_lambda == _x_s2_lambda)) && (((delta + (s2_x + (-1.0 * _x_s2_x))) == 0.0) && (s2_backoff == _x_s2_backoff))) || ( !(( !(delta <= 0.0)) || (( !(s2_evt2 != 0)) && (( !(s2_evt0 != 0)) && ( !(s2_evt1 != 0)))))))) && (((((_x_s2_l0 != 0) && ( !(_x_s2_l1 != 0))) || ((( !(_x_s2_l0 != 0)) && ( !(_x_s2_l1 != 0))) || ((_x_s2_l1 != 0) && ( !(_x_s2_l0 != 0))))) && ((s2_backoff == _x_s2_backoff) && (_x_s2_x == 0.0))) || ( !((( !(s2_l0 != 0)) && ( !(s2_l1 != 0))) && ((delta == 0.0) && ( !(( !(s2_evt2 != 0)) && (( !(s2_evt0 != 0)) && ( !(s2_evt1 != 0)))))))))) && (((( !(s2_evt2 != 0)) && ((s2_evt0 != 0) && ( !(s2_evt1 != 0)))) && (s2_lambda == _x_s2_lambda)) || ( !((( !(_x_s2_l0 != 0)) && ( !(_x_s2_l1 != 0))) && ((( !(s2_l0 != 0)) && ( !(s2_l1 != 0))) && ((delta == 0.0) && ( !(( !(s2_evt2 != 0)) && (( !(s2_evt0 != 0)) && ( !(s2_evt1 != 0))))))))))) && (((s2_evt2 != 0) && (( !(s2_evt0 != 0)) && ( !(s2_evt1 != 0)))) || ( !(((_x_s2_l1 != 0) && ( !(_x_s2_l0 != 0))) && ((( !(s2_l0 != 0)) && ( !(s2_l1 != 0))) && ((delta == 0.0) && ( !(( !(s2_evt2 != 0)) && (( !(s2_evt0 != 0)) && ( !(s2_evt1 != 0))))))))))) && (((s2_lambda == _x_s2_lambda) && (((s2_evt2 != 0) && ((s2_evt1 != 0) && ( !(s2_evt0 != 0)))) || (( !(s2_evt2 != 0)) && ((s2_evt0 != 0) && ( !(s2_evt1 != 0)))))) || ( !(((_x_s2_l0 != 0) && ( !(_x_s2_l1 != 0))) && ((( !(s2_l0 != 0)) && ( !(s2_l1 != 0))) && ((delta == 0.0) && ( !(( !(s2_evt2 != 0)) && (( !(s2_evt0 != 0)) && ( !(s2_evt1 != 0))))))))))) && ((((s2_lambda == _x_s2_lambda) && (_x_s2_x == 0.0)) && ((( !(_x_s2_l0 != 0)) && ( !(_x_s2_l1 != 0))) || ((_x_s2_l0 != 0) && ( !(_x_s2_l1 != 0))))) || ( !(((s2_l1 != 0) && ( !(s2_l0 != 0))) && ((delta == 0.0) && ( !(( !(s2_evt2 != 0)) && (( !(s2_evt0 != 0)) && ( !(s2_evt1 != 0)))))))))) && (((s2_lambda <= s2_x) && ((( !(s2_evt2 != 0)) && ((s2_evt1 != 0) && ( !(s2_evt0 != 0)))) && (_x_s2_backoff <= s2_backoff))) || ( !((( !(_x_s2_l0 != 0)) && ( !(_x_s2_l1 != 0))) && (((s2_l1 != 0) && ( !(s2_l0 != 0))) && ((delta == 0.0) && ( !(( !(s2_evt2 != 0)) && (( !(s2_evt0 != 0)) && ( !(s2_evt1 != 0))))))))))) && (((( !(s2_evt2 != 0)) && ((s2_evt0 != 0) && ( !(s2_evt1 != 0)))) && ((s2_backoff + (-1.0 * _x_s2_backoff)) <= -1.0)) || ( !(((_x_s2_l0 != 0) && ( !(_x_s2_l1 != 0))) && (((s2_l1 != 0) && ( !(s2_l0 != 0))) && ((delta == 0.0) && ( !(( !(s2_evt2 != 0)) && (( !(s2_evt0 != 0)) && ( !(s2_evt1 != 0))))))))))) && (((s2_lambda == _x_s2_lambda) && ((((_x_s2_l1 != 0) && ( !(_x_s2_l0 != 0))) || ((_x_s2_l0 != 0) && ( !(_x_s2_l1 != 0)))) && ((s2_backoff == _x_s2_backoff) && (_x_s2_x == 0.0)))) || ( !(((s2_l0 != 0) && ( !(s2_l1 != 0))) && ((delta == 0.0) && ( !(( !(s2_evt2 != 0)) && (( !(s2_evt0 != 0)) && ( !(s2_evt1 != 0)))))))))) && ((( !(s2_evt2 != 0)) && ((s2_evt0 != 0) && ( !(s2_evt1 != 0)))) || ( !(((_x_s2_l0 != 0) && ( !(_x_s2_l1 != 0))) && (((s2_l0 != 0) && ( !(s2_l1 != 0))) && ((delta == 0.0) && ( !(( !(s2_evt2 != 0)) && (( !(s2_evt0 != 0)) && ( !(s2_evt1 != 0))))))))))) && ((((s2_evt2 != 0) && (( !(s2_evt0 != 0)) && ( !(s2_evt1 != 0)))) && (s2_backoff <= s2_x)) || ( !(((_x_s2_l1 != 0) && ( !(_x_s2_l0 != 0))) && (((s2_l0 != 0) && ( !(s2_l1 != 0))) && ((delta == 0.0) && ( !(( !(s2_evt2 != 0)) && (( !(s2_evt0 != 0)) && ( !(s2_evt1 != 0))))))))))) && (((((((((((((((((( !(_x_s1_evt2 != 0)) && ((_x_s1_evt0 != 0) && ( !(_x_s1_evt1 != 0)))) || (((( !(_x_s1_evt2 != 0)) && (( !(_x_s1_evt0 != 0)) && ( !(_x_s1_evt1 != 0)))) || ((_x_s1_evt2 != 0) && (( !(_x_s1_evt0 != 0)) && ( !(_x_s1_evt1 != 0))))) || ((( !(_x_s1_evt2 != 0)) && ((_x_s1_evt1 != 0) && ( !(_x_s1_evt0 != 0)))) || ((_x_s1_evt2 != 0) && ((_x_s1_evt1 != 0) && ( !(_x_s1_evt0 != 0))))))) && ((( !(_x_s1_l0 != 0)) && ( !(_x_s1_l1 != 0))) || (((_x_s1_l1 != 0) && ( !(_x_s1_l0 != 0))) || ((_x_s1_l0 != 0) && ( !(_x_s1_l1 != 0)))))) && (13.0 <= _x_s1_backoff)) && (( !(_x_s1_lambda <= 0.0)) && ((_x_s1_x <= _x_s1_lambda) || ( !((_x_s1_l1 != 0) && ( !(_x_s1_l0 != 0))))))) && ((((((s1_l0 != 0) == (_x_s1_l0 != 0)) && ((s1_l1 != 0) == (_x_s1_l1 != 0))) && (s1_lambda == _x_s1_lambda)) && (((delta + (s1_x + (-1.0 * _x_s1_x))) == 0.0) && (s1_backoff == _x_s1_backoff))) || ( !(( !(delta <= 0.0)) || (( !(s1_evt2 != 0)) && (( !(s1_evt0 != 0)) && ( !(s1_evt1 != 0)))))))) && (((((_x_s1_l0 != 0) && ( !(_x_s1_l1 != 0))) || ((( !(_x_s1_l0 != 0)) && ( !(_x_s1_l1 != 0))) || ((_x_s1_l1 != 0) && ( !(_x_s1_l0 != 0))))) && ((s1_backoff == _x_s1_backoff) && (_x_s1_x == 0.0))) || ( !((( !(s1_l0 != 0)) && ( !(s1_l1 != 0))) && ((delta == 0.0) && ( !(( !(s1_evt2 != 0)) && (( !(s1_evt0 != 0)) && ( !(s1_evt1 != 0)))))))))) && (((( !(s1_evt2 != 0)) && ((s1_evt0 != 0) && ( !(s1_evt1 != 0)))) && (s1_lambda == _x_s1_lambda)) || ( !((( !(_x_s1_l0 != 0)) && ( !(_x_s1_l1 != 0))) && ((( !(s1_l0 != 0)) && ( !(s1_l1 != 0))) && ((delta == 0.0) && ( !(( !(s1_evt2 != 0)) && (( !(s1_evt0 != 0)) && ( !(s1_evt1 != 0))))))))))) && (((s1_evt2 != 0) && (( !(s1_evt0 != 0)) && ( !(s1_evt1 != 0)))) || ( !(((_x_s1_l1 != 0) && ( !(_x_s1_l0 != 0))) && ((( !(s1_l0 != 0)) && ( !(s1_l1 != 0))) && ((delta == 0.0) && ( !(( !(s1_evt2 != 0)) && (( !(s1_evt0 != 0)) && ( !(s1_evt1 != 0))))))))))) && (((s1_lambda == _x_s1_lambda) && (((s1_evt2 != 0) && ((s1_evt1 != 0) && ( !(s1_evt0 != 0)))) || (( !(s1_evt2 != 0)) && ((s1_evt0 != 0) && ( !(s1_evt1 != 0)))))) || ( !(((_x_s1_l0 != 0) && ( !(_x_s1_l1 != 0))) && ((( !(s1_l0 != 0)) && ( !(s1_l1 != 0))) && ((delta == 0.0) && ( !(( !(s1_evt2 != 0)) && (( !(s1_evt0 != 0)) && ( !(s1_evt1 != 0))))))))))) && ((((s1_lambda == _x_s1_lambda) && (_x_s1_x == 0.0)) && ((( !(_x_s1_l0 != 0)) && ( !(_x_s1_l1 != 0))) || ((_x_s1_l0 != 0) && ( !(_x_s1_l1 != 0))))) || ( !(((s1_l1 != 0) && ( !(s1_l0 != 0))) && ((delta == 0.0) && ( !(( !(s1_evt2 != 0)) && (( !(s1_evt0 != 0)) && ( !(s1_evt1 != 0)))))))))) && (((s1_lambda <= s1_x) && ((( !(s1_evt2 != 0)) && ((s1_evt1 != 0) && ( !(s1_evt0 != 0)))) && (_x_s1_backoff <= s1_backoff))) || ( !((( !(_x_s1_l0 != 0)) && ( !(_x_s1_l1 != 0))) && (((s1_l1 != 0) && ( !(s1_l0 != 0))) && ((delta == 0.0) && ( !(( !(s1_evt2 != 0)) && (( !(s1_evt0 != 0)) && ( !(s1_evt1 != 0))))))))))) && (((( !(s1_evt2 != 0)) && ((s1_evt0 != 0) && ( !(s1_evt1 != 0)))) && ((s1_backoff + (-1.0 * _x_s1_backoff)) <= -1.0)) || ( !(((_x_s1_l0 != 0) && ( !(_x_s1_l1 != 0))) && (((s1_l1 != 0) && ( !(s1_l0 != 0))) && ((delta == 0.0) && ( !(( !(s1_evt2 != 0)) && (( !(s1_evt0 != 0)) && ( !(s1_evt1 != 0))))))))))) && (((s1_lambda == _x_s1_lambda) && ((((_x_s1_l1 != 0) && ( !(_x_s1_l0 != 0))) || ((_x_s1_l0 != 0) && ( !(_x_s1_l1 != 0)))) && ((s1_backoff == _x_s1_backoff) && (_x_s1_x == 0.0)))) || ( !(((s1_l0 != 0) && ( !(s1_l1 != 0))) && ((delta == 0.0) && ( !(( !(s1_evt2 != 0)) && (( !(s1_evt0 != 0)) && ( !(s1_evt1 != 0)))))))))) && ((( !(s1_evt2 != 0)) && ((s1_evt0 != 0) && ( !(s1_evt1 != 0)))) || ( !(((_x_s1_l0 != 0) && ( !(_x_s1_l1 != 0))) && (((s1_l0 != 0) && ( !(s1_l1 != 0))) && ((delta == 0.0) && ( !(( !(s1_evt2 != 0)) && (( !(s1_evt0 != 0)) && ( !(s1_evt1 != 0))))))))))) && ((((s1_evt2 != 0) && (( !(s1_evt0 != 0)) && ( !(s1_evt1 != 0)))) && (s1_backoff <= s1_x)) || ( !(((_x_s1_l1 != 0) && ( !(_x_s1_l0 != 0))) && (((s1_l0 != 0) && ( !(s1_l1 != 0))) && ((delta == 0.0) && ( !(( !(s1_evt2 != 0)) && (( !(s1_evt0 != 0)) && ( !(s1_evt1 != 0))))))))))) && (((((((((((((((((( !(_x_s0_evt2 != 0)) && ((_x_s0_evt0 != 0) && ( !(_x_s0_evt1 != 0)))) || (((( !(_x_s0_evt2 != 0)) && (( !(_x_s0_evt0 != 0)) && ( !(_x_s0_evt1 != 0)))) || ((_x_s0_evt2 != 0) && (( !(_x_s0_evt0 != 0)) && ( !(_x_s0_evt1 != 0))))) || ((( !(_x_s0_evt2 != 0)) && ((_x_s0_evt1 != 0) && ( !(_x_s0_evt0 != 0)))) || ((_x_s0_evt2 != 0) && ((_x_s0_evt1 != 0) && ( !(_x_s0_evt0 != 0))))))) && ((( !(_x_s0_l0 != 0)) && ( !(_x_s0_l1 != 0))) || (((_x_s0_l1 != 0) && ( !(_x_s0_l0 != 0))) || ((_x_s0_l0 != 0) && ( !(_x_s0_l1 != 0)))))) && (13.0 <= _x_s0_backoff)) && (( !(_x_s0_lambda <= 0.0)) && ((_x_s0_x <= _x_s0_lambda) || ( !((_x_s0_l1 != 0) && ( !(_x_s0_l0 != 0))))))) && ((((((s0_l0 != 0) == (_x_s0_l0 != 0)) && ((s0_l1 != 0) == (_x_s0_l1 != 0))) && (s0_lambda == _x_s0_lambda)) && (((delta + (s0_x + (-1.0 * _x_s0_x))) == 0.0) && (s0_backoff == _x_s0_backoff))) || ( !(( !(delta <= 0.0)) || (( !(s0_evt2 != 0)) && (( !(s0_evt0 != 0)) && ( !(s0_evt1 != 0)))))))) && (((((_x_s0_l0 != 0) && ( !(_x_s0_l1 != 0))) || ((( !(_x_s0_l0 != 0)) && ( !(_x_s0_l1 != 0))) || ((_x_s0_l1 != 0) && ( !(_x_s0_l0 != 0))))) && ((s0_backoff == _x_s0_backoff) && (_x_s0_x == 0.0))) || ( !((( !(s0_l0 != 0)) && ( !(s0_l1 != 0))) && ((delta == 0.0) && ( !(( !(s0_evt2 != 0)) && (( !(s0_evt0 != 0)) && ( !(s0_evt1 != 0)))))))))) && (((( !(s0_evt2 != 0)) && ((s0_evt0 != 0) && ( !(s0_evt1 != 0)))) && (s0_lambda == _x_s0_lambda)) || ( !((( !(_x_s0_l0 != 0)) && ( !(_x_s0_l1 != 0))) && ((( !(s0_l0 != 0)) && ( !(s0_l1 != 0))) && ((delta == 0.0) && ( !(( !(s0_evt2 != 0)) && (( !(s0_evt0 != 0)) && ( !(s0_evt1 != 0))))))))))) && (((s0_evt2 != 0) && (( !(s0_evt0 != 0)) && ( !(s0_evt1 != 0)))) || ( !(((_x_s0_l1 != 0) && ( !(_x_s0_l0 != 0))) && ((( !(s0_l0 != 0)) && ( !(s0_l1 != 0))) && ((delta == 0.0) && ( !(( !(s0_evt2 != 0)) && (( !(s0_evt0 != 0)) && ( !(s0_evt1 != 0))))))))))) && (((s0_lambda == _x_s0_lambda) && (((s0_evt2 != 0) && ((s0_evt1 != 0) && ( !(s0_evt0 != 0)))) || (( !(s0_evt2 != 0)) && ((s0_evt0 != 0) && ( !(s0_evt1 != 0)))))) || ( !(((_x_s0_l0 != 0) && ( !(_x_s0_l1 != 0))) && ((( !(s0_l0 != 0)) && ( !(s0_l1 != 0))) && ((delta == 0.0) && ( !(( !(s0_evt2 != 0)) && (( !(s0_evt0 != 0)) && ( !(s0_evt1 != 0))))))))))) && ((((s0_lambda == _x_s0_lambda) && (_x_s0_x == 0.0)) && ((( !(_x_s0_l0 != 0)) && ( !(_x_s0_l1 != 0))) || ((_x_s0_l0 != 0) && ( !(_x_s0_l1 != 0))))) || ( !(((s0_l1 != 0) && ( !(s0_l0 != 0))) && ((delta == 0.0) && ( !(( !(s0_evt2 != 0)) && (( !(s0_evt0 != 0)) && ( !(s0_evt1 != 0)))))))))) && (((s0_lambda <= s0_x) && ((( !(s0_evt2 != 0)) && ((s0_evt1 != 0) && ( !(s0_evt0 != 0)))) && (_x_s0_backoff <= s0_backoff))) || ( !((( !(_x_s0_l0 != 0)) && ( !(_x_s0_l1 != 0))) && (((s0_l1 != 0) && ( !(s0_l0 != 0))) && ((delta == 0.0) && ( !(( !(s0_evt2 != 0)) && (( !(s0_evt0 != 0)) && ( !(s0_evt1 != 0))))))))))) && (((( !(s0_evt2 != 0)) && ((s0_evt0 != 0) && ( !(s0_evt1 != 0)))) && ((s0_backoff + (-1.0 * _x_s0_backoff)) <= -1.0)) || ( !(((_x_s0_l0 != 0) && ( !(_x_s0_l1 != 0))) && (((s0_l1 != 0) && ( !(s0_l0 != 0))) && ((delta == 0.0) && ( !(( !(s0_evt2 != 0)) && (( !(s0_evt0 != 0)) && ( !(s0_evt1 != 0))))))))))) && (((s0_lambda == _x_s0_lambda) && ((((_x_s0_l1 != 0) && ( !(_x_s0_l0 != 0))) || ((_x_s0_l0 != 0) && ( !(_x_s0_l1 != 0)))) && ((s0_backoff == _x_s0_backoff) && (_x_s0_x == 0.0)))) || ( !(((s0_l0 != 0) && ( !(s0_l1 != 0))) && ((delta == 0.0) && ( !(( !(s0_evt2 != 0)) && (( !(s0_evt0 != 0)) && ( !(s0_evt1 != 0)))))))))) && ((( !(s0_evt2 != 0)) && ((s0_evt0 != 0) && ( !(s0_evt1 != 0)))) || ( !(((_x_s0_l0 != 0) && ( !(_x_s0_l1 != 0))) && (((s0_l0 != 0) && ( !(s0_l1 != 0))) && ((delta == 0.0) && ( !(( !(s0_evt2 != 0)) && (( !(s0_evt0 != 0)) && ( !(s0_evt1 != 0))))))))))) && ((((s0_evt2 != 0) && (( !(s0_evt0 != 0)) && ( !(s0_evt1 != 0)))) && (s0_backoff <= s0_x)) || ( !(((_x_s0_l1 != 0) && ( !(_x_s0_l0 != 0))) && (((s0_l0 != 0) && ( !(s0_l1 != 0))) && ((delta == 0.0) && ( !(( !(s0_evt2 != 0)) && (( !(s0_evt0 != 0)) && ( !(s0_evt1 != 0))))))))))) && (((((((((((((((( !(_x_bus_evt2 != 0)) && (( !(_x_bus_evt0 != 0)) && ( !(_x_bus_evt1 != 0)))) || ((((_x_bus_evt2 != 0) && (( !(_x_bus_evt0 != 0)) && ( !(_x_bus_evt1 != 0)))) || (( !(_x_bus_evt2 != 0)) && ((_x_bus_evt1 != 0) && ( !(_x_bus_evt0 != 0))))) || (((_x_bus_evt2 != 0) && ((_x_bus_evt1 != 0) && ( !(_x_bus_evt0 != 0)))) || (( !(_x_bus_evt2 != 0)) && ((_x_bus_evt0 != 0) && ( !(_x_bus_evt1 != 0))))))) && (((( !(_x_bus_l0 != 0)) && ( !(_x_bus_l1 != 0))) || ((_x_bus_l1 != 0) && ( !(_x_bus_l0 != 0)))) || (((_x_bus_l0 != 0) && ( !(_x_bus_l1 != 0))) || ((_x_bus_l0 != 0) && (_x_bus_l1 != 0))))) && ((( !(13.0 <= _x_bus_x)) || ( !((_x_bus_l0 != 0) && ( !(_x_bus_l1 != 0))))) && ((_x_delta == 0.0) || ( !((_x_bus_l0 != 0) && (_x_bus_l1 != 0)))))) && ((delta <= 0.0) || (((delta + (bus_x + (-1.0 * _x_bus_x))) == 0.0) && ((((bus_l0 != 0) == (_x_bus_l0 != 0)) && ((bus_l1 != 0) == (_x_bus_l1 != 0))) && (bus_j == _x_bus_j))))) && ((((delta + (bus_x + (-1.0 * _x_bus_x))) == 0.0) && ((((bus_l0 != 0) == (_x_bus_l0 != 0)) && ((bus_l1 != 0) == (_x_bus_l1 != 0))) && (bus_j == _x_bus_j))) || ( !(( !(bus_evt2 != 0)) && (( !(bus_evt0 != 0)) && ( !(bus_evt1 != 0))))))) && (((((bus_evt2 != 0) && (( !(bus_evt0 != 0)) && ( !(bus_evt1 != 0)))) && ((_x_bus_l1 != 0) && ( !(_x_bus_l0 != 0)))) && ((bus_j == _x_bus_j) && (_x_bus_x == 0.0))) || ( !((( !(bus_l0 != 0)) && ( !(bus_l1 != 0))) && ((delta == 0.0) && ( !(( !(bus_evt2 != 0)) && (( !(bus_evt0 != 0)) && ( !(bus_evt1 != 0)))))))))) && (((bus_j == _x_bus_j) && (((_x_bus_l0 != 0) && ( !(_x_bus_l1 != 0))) || ((( !(_x_bus_l0 != 0)) && ( !(_x_bus_l1 != 0))) || ((_x_bus_l1 != 0) && ( !(_x_bus_l0 != 0)))))) || ( !(((bus_l1 != 0) && ( !(bus_l0 != 0))) && ((delta == 0.0) && ( !(( !(bus_evt2 != 0)) && (( !(bus_evt0 != 0)) && ( !(bus_evt1 != 0)))))))))) && (((( !(bus_evt2 != 0)) && ((bus_evt1 != 0) && ( !(bus_evt0 != 0)))) && (_x_bus_x == 0.0)) || ( !(((delta == 0.0) && ( !(( !(bus_evt2 != 0)) && (( !(bus_evt0 != 0)) && ( !(bus_evt1 != 0)))))) && ((( !(_x_bus_l0 != 0)) && ( !(_x_bus_l1 != 0))) && ((bus_l1 != 0) && ( !(bus_l0 != 0)))))))) && ((((bus_evt2 != 0) && ((bus_evt1 != 0) && ( !(bus_evt0 != 0)))) && ((13.0 <= bus_x) && (bus_x == _x_bus_x))) || ( !(((delta == 0.0) && ( !(( !(bus_evt2 != 0)) && (( !(bus_evt0 != 0)) && ( !(bus_evt1 != 0)))))) && (((bus_l1 != 0) && ( !(bus_l0 != 0))) && ((_x_bus_l1 != 0) && ( !(_x_bus_l0 != 0)))))))) && ((((bus_evt2 != 0) && (( !(bus_evt0 != 0)) && ( !(bus_evt1 != 0)))) && (( !(13.0 <= bus_x)) && (_x_bus_x == 0.0))) || ( !(((delta == 0.0) && ( !(( !(bus_evt2 != 0)) && (( !(bus_evt0 != 0)) && ( !(bus_evt1 != 0)))))) && (((bus_l1 != 0) && ( !(bus_l0 != 0))) && ((_x_bus_l0 != 0) && ( !(_x_bus_l1 != 0)))))))) && ((((((_x_bus_l0 != 0) && (_x_bus_l1 != 0)) && ( !(13.0 <= bus_x))) && ((( !(bus_evt2 != 0)) && ((bus_evt0 != 0) && ( !(bus_evt1 != 0)))) && (bus_cd_id == bus_j))) && ((_x_bus_x == 0.0) && ((bus_j + (-1 * _x_bus_j)) == -1))) || ( !(((bus_l0 != 0) && ( !(bus_l1 != 0))) && ((delta == 0.0) && ( !(( !(bus_evt2 != 0)) && (( !(bus_evt0 != 0)) && ( !(bus_evt1 != 0)))))))))) && ((((bus_j + (-1 * _x_bus_j)) == -1) && (((( !(bus_evt2 != 0)) && ((bus_evt0 != 0) && ( !(bus_evt1 != 0)))) && (bus_cd_id == bus_j)) && ((_x_bus_x == 0.0) && ( !(25 <= bus_j))))) || ( !(((delta == 0.0) && ( !(( !(bus_evt2 != 0)) && (( !(bus_evt0 != 0)) && ( !(bus_evt1 != 0)))))) && (((bus_l0 != 0) && (bus_l1 != 0)) && ((_x_bus_l0 != 0) && (_x_bus_l1 != 0))))))) && (((((( !(bus_evt2 != 0)) && ((bus_evt0 != 0) && ( !(bus_evt1 != 0)))) && (bus_j == 25)) && ((_x_bus_x == 0.0) && (bus_cd_id == bus_j))) && (_x_bus_j == 0)) || ( !(((delta == 0.0) && ( !(( !(bus_evt2 != 0)) && (( !(bus_evt0 != 0)) && ( !(bus_evt1 != 0)))))) && ((( !(_x_bus_l0 != 0)) && ( !(_x_bus_l1 != 0))) && ((bus_l0 != 0) && (bus_l1 != 0))))))) && (0.0 <= _x_delta)))))))))))))))))))))))))))) && (((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( !(s0_evt2 != 0)) && (( !(s0_evt0 != 0)) && ( !(s0_evt1 != 0)))) || (( !(s1_evt2 != 0)) && (( !(s1_evt0 != 0)) && ( !(s1_evt1 != 0))))) && ((( !(s0_evt2 != 0)) && (( !(s0_evt0 != 0)) && ( !(s0_evt1 != 0)))) || (( !(s2_evt2 != 0)) && (( !(s2_evt0 != 0)) && ( !(s2_evt1 != 0)))))) && ((( !(s0_evt2 != 0)) && (( !(s0_evt0 != 0)) && ( !(s0_evt1 != 0)))) || (( !(s3_evt2 != 0)) && (( !(s3_evt0 != 0)) && ( !(s3_evt1 != 0)))))) && ((( !(s0_evt2 != 0)) && (( !(s0_evt0 != 0)) && ( !(s0_evt1 != 0)))) || (( !(s4_evt2 != 0)) && (( !(s4_evt0 != 0)) && ( !(s4_evt1 != 0)))))) && ((( !(s0_evt2 != 0)) && (( !(s0_evt0 != 0)) && ( !(s0_evt1 != 0)))) || (( !(s5_evt2 != 0)) && (( !(s5_evt0 != 0)) && ( !(s5_evt1 != 0)))))) && ((( !(s0_evt2 != 0)) && (( !(s0_evt0 != 0)) && ( !(s0_evt1 != 0)))) || (( !(s6_evt2 != 0)) && (( !(s6_evt0 != 0)) && ( !(s6_evt1 != 0)))))) && ((( !(s0_evt2 != 0)) && (( !(s0_evt0 != 0)) && ( !(s0_evt1 != 0)))) || (( !(s7_evt2 != 0)) && (( !(s7_evt0 != 0)) && ( !(s7_evt1 != 0)))))) && ((( !(s0_evt2 != 0)) && (( !(s0_evt0 != 0)) && ( !(s0_evt1 != 0)))) || (( !(s8_evt2 != 0)) && (( !(s8_evt0 != 0)) && ( !(s8_evt1 != 0)))))) && ((( !(s0_evt2 != 0)) && (( !(s0_evt0 != 0)) && ( !(s0_evt1 != 0)))) || (( !(s9_evt2 != 0)) && (( !(s9_evt0 != 0)) && ( !(s9_evt1 != 0)))))) && ((( !(s0_evt2 != 0)) && (( !(s0_evt0 != 0)) && ( !(s0_evt1 != 0)))) || (( !(s10_evt2 != 0)) && (( !(s10_evt0 != 0)) && ( !(s10_evt1 != 0)))))) && ((( !(s0_evt2 != 0)) && (( !(s0_evt0 != 0)) && ( !(s0_evt1 != 0)))) || (( !(s11_evt2 != 0)) && (( !(s11_evt0 != 0)) && ( !(s11_evt1 != 0)))))) && ((( !(s0_evt2 != 0)) && (( !(s0_evt0 != 0)) && ( !(s0_evt1 != 0)))) || (( !(s12_evt2 != 0)) && (( !(s12_evt0 != 0)) && ( !(s12_evt1 != 0)))))) && ((( !(s0_evt2 != 0)) && (( !(s0_evt0 != 0)) && ( !(s0_evt1 != 0)))) || (( !(s13_evt2 != 0)) && (( !(s13_evt0 != 0)) && ( !(s13_evt1 != 0)))))) && ((( !(s0_evt2 != 0)) && (( !(s0_evt0 != 0)) && ( !(s0_evt1 != 0)))) || (( !(s14_evt2 != 0)) && (( !(s14_evt0 != 0)) && ( !(s14_evt1 != 0)))))) && ((( !(s0_evt2 != 0)) && (( !(s0_evt0 != 0)) && ( !(s0_evt1 != 0)))) || (( !(s15_evt2 != 0)) && (( !(s15_evt0 != 0)) && ( !(s15_evt1 != 0)))))) && ((( !(s0_evt2 != 0)) && (( !(s0_evt0 != 0)) && ( !(s0_evt1 != 0)))) || (( !(s16_evt2 != 0)) && (( !(s16_evt0 != 0)) && ( !(s16_evt1 != 0)))))) && ((( !(s0_evt2 != 0)) && (( !(s0_evt0 != 0)) && ( !(s0_evt1 != 0)))) || (( !(s17_evt2 != 0)) && (( !(s17_evt0 != 0)) && ( !(s17_evt1 != 0)))))) && ((( !(s0_evt2 != 0)) && (( !(s0_evt0 != 0)) && ( !(s0_evt1 != 0)))) || (( !(s18_evt2 != 0)) && (( !(s18_evt0 != 0)) && ( !(s18_evt1 != 0)))))) && ((( !(s0_evt2 != 0)) && (( !(s0_evt0 != 0)) && ( !(s0_evt1 != 0)))) || (( !(s19_evt2 != 0)) && (( !(s19_evt0 != 0)) && ( !(s19_evt1 != 0)))))) && ((( !(s0_evt2 != 0)) && (( !(s0_evt0 != 0)) && ( !(s0_evt1 != 0)))) || (( !(s20_evt2 != 0)) && (( !(s20_evt0 != 0)) && ( !(s20_evt1 != 0)))))) && ((( !(s0_evt2 != 0)) && (( !(s0_evt0 != 0)) && ( !(s0_evt1 != 0)))) || (( !(s21_evt2 != 0)) && (( !(s21_evt0 != 0)) && ( !(s21_evt1 != 0)))))) && ((( !(s0_evt2 != 0)) && (( !(s0_evt0 != 0)) && ( !(s0_evt1 != 0)))) || (( !(s22_evt2 != 0)) && (( !(s22_evt0 != 0)) && ( !(s22_evt1 != 0)))))) && ((( !(s0_evt2 != 0)) && (( !(s0_evt0 != 0)) && ( !(s0_evt1 != 0)))) || (( !(s23_evt2 != 0)) && (( !(s23_evt0 != 0)) && ( !(s23_evt1 != 0)))))) && ((( !(s0_evt2 != 0)) && (( !(s0_evt0 != 0)) && ( !(s0_evt1 != 0)))) || (( !(s24_evt2 != 0)) && (( !(s24_evt0 != 0)) && ( !(s24_evt1 != 0)))))) && ((( !(s0_evt2 != 0)) && (( !(s0_evt0 != 0)) && ( !(s0_evt1 != 0)))) || (( !(s25_evt2 != 0)) && (( !(s25_evt0 != 0)) && ( !(s25_evt1 != 0)))))) && ((( !(s1_evt2 != 0)) && (( !(s1_evt0 != 0)) && ( !(s1_evt1 != 0)))) || (( !(s2_evt2 != 0)) && (( !(s2_evt0 != 0)) && ( !(s2_evt1 != 0)))))) && ((( !(s1_evt2 != 0)) && (( !(s1_evt0 != 0)) && ( !(s1_evt1 != 0)))) || (( !(s3_evt2 != 0)) && (( !(s3_evt0 != 0)) && ( !(s3_evt1 != 0)))))) && ((( !(s1_evt2 != 0)) && (( !(s1_evt0 != 0)) && ( !(s1_evt1 != 0)))) || (( !(s4_evt2 != 0)) && (( !(s4_evt0 != 0)) && ( !(s4_evt1 != 0)))))) && ((( !(s1_evt2 != 0)) && (( !(s1_evt0 != 0)) && ( !(s1_evt1 != 0)))) || (( !(s5_evt2 != 0)) && (( !(s5_evt0 != 0)) && ( !(s5_evt1 != 0)))))) && ((( !(s1_evt2 != 0)) && (( !(s1_evt0 != 0)) && ( !(s1_evt1 != 0)))) || (( !(s6_evt2 != 0)) && (( !(s6_evt0 != 0)) && ( !(s6_evt1 != 0)))))) && ((( !(s1_evt2 != 0)) && (( !(s1_evt0 != 0)) && ( !(s1_evt1 != 0)))) || (( !(s7_evt2 != 0)) && (( !(s7_evt0 != 0)) && ( !(s7_evt1 != 0)))))) && ((( !(s1_evt2 != 0)) && (( !(s1_evt0 != 0)) && ( !(s1_evt1 != 0)))) || (( !(s8_evt2 != 0)) && (( !(s8_evt0 != 0)) && ( !(s8_evt1 != 0)))))) && ((( !(s1_evt2 != 0)) && (( !(s1_evt0 != 0)) && ( !(s1_evt1 != 0)))) || (( !(s9_evt2 != 0)) && (( !(s9_evt0 != 0)) && ( !(s9_evt1 != 0)))))) && ((( !(s1_evt2 != 0)) && (( !(s1_evt0 != 0)) && ( !(s1_evt1 != 0)))) || (( !(s10_evt2 != 0)) && (( !(s10_evt0 != 0)) && ( !(s10_evt1 != 0)))))) && ((( !(s1_evt2 != 0)) && (( !(s1_evt0 != 0)) && ( !(s1_evt1 != 0)))) || (( !(s11_evt2 != 0)) && (( !(s11_evt0 != 0)) && ( !(s11_evt1 != 0)))))) && ((( !(s1_evt2 != 0)) && (( !(s1_evt0 != 0)) && ( !(s1_evt1 != 0)))) || (( !(s12_evt2 != 0)) && (( !(s12_evt0 != 0)) && ( !(s12_evt1 != 0)))))) && ((( !(s1_evt2 != 0)) && (( !(s1_evt0 != 0)) && ( !(s1_evt1 != 0)))) || (( !(s13_evt2 != 0)) && (( !(s13_evt0 != 0)) && ( !(s13_evt1 != 0)))))) && ((( !(s1_evt2 != 0)) && (( !(s1_evt0 != 0)) && ( !(s1_evt1 != 0)))) || (( !(s14_evt2 != 0)) && (( !(s14_evt0 != 0)) && ( !(s14_evt1 != 0)))))) && ((( !(s1_evt2 != 0)) && (( !(s1_evt0 != 0)) && ( !(s1_evt1 != 0)))) || (( !(s15_evt2 != 0)) && (( !(s15_evt0 != 0)) && ( !(s15_evt1 != 0)))))) && ((( !(s1_evt2 != 0)) && (( !(s1_evt0 != 0)) && ( !(s1_evt1 != 0)))) || (( !(s16_evt2 != 0)) && (( !(s16_evt0 != 0)) && ( !(s16_evt1 != 0)))))) && ((( !(s1_evt2 != 0)) && (( !(s1_evt0 != 0)) && ( !(s1_evt1 != 0)))) || (( !(s17_evt2 != 0)) && (( !(s17_evt0 != 0)) && ( !(s17_evt1 != 0)))))) && ((( !(s1_evt2 != 0)) && (( !(s1_evt0 != 0)) && ( !(s1_evt1 != 0)))) || (( !(s18_evt2 != 0)) && (( !(s18_evt0 != 0)) && ( !(s18_evt1 != 0)))))) && ((( !(s1_evt2 != 0)) && (( !(s1_evt0 != 0)) && ( !(s1_evt1 != 0)))) || (( !(s19_evt2 != 0)) && (( !(s19_evt0 != 0)) && ( !(s19_evt1 != 0)))))) && ((( !(s1_evt2 != 0)) && (( !(s1_evt0 != 0)) && ( !(s1_evt1 != 0)))) || (( !(s20_evt2 != 0)) && (( !(s20_evt0 != 0)) && ( !(s20_evt1 != 0)))))) && ((( !(s1_evt2 != 0)) && (( !(s1_evt0 != 0)) && ( !(s1_evt1 != 0)))) || (( !(s21_evt2 != 0)) && (( !(s21_evt0 != 0)) && ( !(s21_evt1 != 0)))))) && ((( !(s1_evt2 != 0)) && (( !(s1_evt0 != 0)) && ( !(s1_evt1 != 0)))) || (( !(s22_evt2 != 0)) && (( !(s22_evt0 != 0)) && ( !(s22_evt1 != 0)))))) && ((( !(s1_evt2 != 0)) && (( !(s1_evt0 != 0)) && ( !(s1_evt1 != 0)))) || (( !(s23_evt2 != 0)) && (( !(s23_evt0 != 0)) && ( !(s23_evt1 != 0)))))) && ((( !(s1_evt2 != 0)) && (( !(s1_evt0 != 0)) && ( !(s1_evt1 != 0)))) || (( !(s24_evt2 != 0)) && (( !(s24_evt0 != 0)) && ( !(s24_evt1 != 0)))))) && ((( !(s1_evt2 != 0)) && (( !(s1_evt0 != 0)) && ( !(s1_evt1 != 0)))) || (( !(s25_evt2 != 0)) && (( !(s25_evt0 != 0)) && ( !(s25_evt1 != 0)))))) && ((( !(s2_evt2 != 0)) && (( !(s2_evt0 != 0)) && ( !(s2_evt1 != 0)))) || (( !(s3_evt2 != 0)) && (( !(s3_evt0 != 0)) && ( !(s3_evt1 != 0)))))) && ((( !(s2_evt2 != 0)) && (( !(s2_evt0 != 0)) && ( !(s2_evt1 != 0)))) || (( !(s4_evt2 != 0)) && (( !(s4_evt0 != 0)) && ( !(s4_evt1 != 0)))))) && ((( !(s2_evt2 != 0)) && (( !(s2_evt0 != 0)) && ( !(s2_evt1 != 0)))) || (( !(s5_evt2 != 0)) && (( !(s5_evt0 != 0)) && ( !(s5_evt1 != 0)))))) && ((( !(s2_evt2 != 0)) && (( !(s2_evt0 != 0)) && ( !(s2_evt1 != 0)))) || (( !(s6_evt2 != 0)) && (( !(s6_evt0 != 0)) && ( !(s6_evt1 != 0)))))) && ((( !(s2_evt2 != 0)) && (( !(s2_evt0 != 0)) && ( !(s2_evt1 != 0)))) || (( !(s7_evt2 != 0)) && (( !(s7_evt0 != 0)) && ( !(s7_evt1 != 0)))))) && ((( !(s2_evt2 != 0)) && (( !(s2_evt0 != 0)) && ( !(s2_evt1 != 0)))) || (( !(s8_evt2 != 0)) && (( !(s8_evt0 != 0)) && ( !(s8_evt1 != 0)))))) && ((( !(s2_evt2 != 0)) && (( !(s2_evt0 != 0)) && ( !(s2_evt1 != 0)))) || (( !(s9_evt2 != 0)) && (( !(s9_evt0 != 0)) && ( !(s9_evt1 != 0)))))) && ((( !(s2_evt2 != 0)) && (( !(s2_evt0 != 0)) && ( !(s2_evt1 != 0)))) || (( !(s10_evt2 != 0)) && (( !(s10_evt0 != 0)) && ( !(s10_evt1 != 0)))))) && ((( !(s2_evt2 != 0)) && (( !(s2_evt0 != 0)) && ( !(s2_evt1 != 0)))) || (( !(s11_evt2 != 0)) && (( !(s11_evt0 != 0)) && ( !(s11_evt1 != 0)))))) && ((( !(s2_evt2 != 0)) && (( !(s2_evt0 != 0)) && ( !(s2_evt1 != 0)))) || (( !(s12_evt2 != 0)) && (( !(s12_evt0 != 0)) && ( !(s12_evt1 != 0)))))) && ((( !(s2_evt2 != 0)) && (( !(s2_evt0 != 0)) && ( !(s2_evt1 != 0)))) || (( !(s13_evt2 != 0)) && (( !(s13_evt0 != 0)) && ( !(s13_evt1 != 0)))))) && ((( !(s2_evt2 != 0)) && (( !(s2_evt0 != 0)) && ( !(s2_evt1 != 0)))) || (( !(s14_evt2 != 0)) && (( !(s14_evt0 != 0)) && ( !(s14_evt1 != 0)))))) && ((( !(s2_evt2 != 0)) && (( !(s2_evt0 != 0)) && ( !(s2_evt1 != 0)))) || (( !(s15_evt2 != 0)) && (( !(s15_evt0 != 0)) && ( !(s15_evt1 != 0)))))) && ((( !(s2_evt2 != 0)) && (( !(s2_evt0 != 0)) && ( !(s2_evt1 != 0)))) || (( !(s16_evt2 != 0)) && (( !(s16_evt0 != 0)) && ( !(s16_evt1 != 0)))))) && ((( !(s2_evt2 != 0)) && (( !(s2_evt0 != 0)) && ( !(s2_evt1 != 0)))) || (( !(s17_evt2 != 0)) && (( !(s17_evt0 != 0)) && ( !(s17_evt1 != 0)))))) && ((( !(s2_evt2 != 0)) && (( !(s2_evt0 != 0)) && ( !(s2_evt1 != 0)))) || (( !(s18_evt2 != 0)) && (( !(s18_evt0 != 0)) && ( !(s18_evt1 != 0)))))) && ((( !(s2_evt2 != 0)) && (( !(s2_evt0 != 0)) && ( !(s2_evt1 != 0)))) || (( !(s19_evt2 != 0)) && (( !(s19_evt0 != 0)) && ( !(s19_evt1 != 0)))))) && ((( !(s2_evt2 != 0)) && (( !(s2_evt0 != 0)) && ( !(s2_evt1 != 0)))) || (( !(s20_evt2 != 0)) && (( !(s20_evt0 != 0)) && ( !(s20_evt1 != 0)))))) && ((( !(s2_evt2 != 0)) && (( !(s2_evt0 != 0)) && ( !(s2_evt1 != 0)))) || (( !(s21_evt2 != 0)) && (( !(s21_evt0 != 0)) && ( !(s21_evt1 != 0)))))) && ((( !(s2_evt2 != 0)) && (( !(s2_evt0 != 0)) && ( !(s2_evt1 != 0)))) || (( !(s22_evt2 != 0)) && (( !(s22_evt0 != 0)) && ( !(s22_evt1 != 0)))))) && ((( !(s2_evt2 != 0)) && (( !(s2_evt0 != 0)) && ( !(s2_evt1 != 0)))) || (( !(s23_evt2 != 0)) && (( !(s23_evt0 != 0)) && ( !(s23_evt1 != 0)))))) && ((( !(s2_evt2 != 0)) && (( !(s2_evt0 != 0)) && ( !(s2_evt1 != 0)))) || (( !(s24_evt2 != 0)) && (( !(s24_evt0 != 0)) && ( !(s24_evt1 != 0)))))) && ((( !(s2_evt2 != 0)) && (( !(s2_evt0 != 0)) && ( !(s2_evt1 != 0)))) || (( !(s25_evt2 != 0)) && (( !(s25_evt0 != 0)) && ( !(s25_evt1 != 0)))))) && ((( !(s3_evt2 != 0)) && (( !(s3_evt0 != 0)) && ( !(s3_evt1 != 0)))) || (( !(s4_evt2 != 0)) && (( !(s4_evt0 != 0)) && ( !(s4_evt1 != 0)))))) && ((( !(s3_evt2 != 0)) && (( !(s3_evt0 != 0)) && ( !(s3_evt1 != 0)))) || (( !(s5_evt2 != 0)) && (( !(s5_evt0 != 0)) && ( !(s5_evt1 != 0)))))) && ((( !(s3_evt2 != 0)) && (( !(s3_evt0 != 0)) && ( !(s3_evt1 != 0)))) || (( !(s6_evt2 != 0)) && (( !(s6_evt0 != 0)) && ( !(s6_evt1 != 0)))))) && ((( !(s3_evt2 != 0)) && (( !(s3_evt0 != 0)) && ( !(s3_evt1 != 0)))) || (( !(s7_evt2 != 0)) && (( !(s7_evt0 != 0)) && ( !(s7_evt1 != 0)))))) && ((( !(s3_evt2 != 0)) && (( !(s3_evt0 != 0)) && ( !(s3_evt1 != 0)))) || (( !(s8_evt2 != 0)) && (( !(s8_evt0 != 0)) && ( !(s8_evt1 != 0)))))) && ((( !(s3_evt2 != 0)) && (( !(s3_evt0 != 0)) && ( !(s3_evt1 != 0)))) || (( !(s9_evt2 != 0)) && (( !(s9_evt0 != 0)) && ( !(s9_evt1 != 0)))))) && ((( !(s3_evt2 != 0)) && (( !(s3_evt0 != 0)) && ( !(s3_evt1 != 0)))) || (( !(s10_evt2 != 0)) && (( !(s10_evt0 != 0)) && ( !(s10_evt1 != 0)))))) && ((( !(s3_evt2 != 0)) && (( !(s3_evt0 != 0)) && ( !(s3_evt1 != 0)))) || (( !(s11_evt2 != 0)) && (( !(s11_evt0 != 0)) && ( !(s11_evt1 != 0)))))) && ((( !(s3_evt2 != 0)) && (( !(s3_evt0 != 0)) && ( !(s3_evt1 != 0)))) || (( !(s12_evt2 != 0)) && (( !(s12_evt0 != 0)) && ( !(s12_evt1 != 0)))))) && ((( !(s3_evt2 != 0)) && (( !(s3_evt0 != 0)) && ( !(s3_evt1 != 0)))) || (( !(s13_evt2 != 0)) && (( !(s13_evt0 != 0)) && ( !(s13_evt1 != 0)))))) && ((( !(s3_evt2 != 0)) && (( !(s3_evt0 != 0)) && ( !(s3_evt1 != 0)))) || (( !(s14_evt2 != 0)) && (( !(s14_evt0 != 0)) && ( !(s14_evt1 != 0)))))) && ((( !(s3_evt2 != 0)) && (( !(s3_evt0 != 0)) && ( !(s3_evt1 != 0)))) || (( !(s15_evt2 != 0)) && (( !(s15_evt0 != 0)) && ( !(s15_evt1 != 0)))))) && ((( !(s3_evt2 != 0)) && (( !(s3_evt0 != 0)) && ( !(s3_evt1 != 0)))) || (( !(s16_evt2 != 0)) && (( !(s16_evt0 != 0)) && ( !(s16_evt1 != 0)))))) && ((( !(s3_evt2 != 0)) && (( !(s3_evt0 != 0)) && ( !(s3_evt1 != 0)))) || (( !(s17_evt2 != 0)) && (( !(s17_evt0 != 0)) && ( !(s17_evt1 != 0)))))) && ((( !(s3_evt2 != 0)) && (( !(s3_evt0 != 0)) && ( !(s3_evt1 != 0)))) || (( !(s18_evt2 != 0)) && (( !(s18_evt0 != 0)) && ( !(s18_evt1 != 0)))))) && ((( !(s3_evt2 != 0)) && (( !(s3_evt0 != 0)) && ( !(s3_evt1 != 0)))) || (( !(s19_evt2 != 0)) && (( !(s19_evt0 != 0)) && ( !(s19_evt1 != 0)))))) && ((( !(s3_evt2 != 0)) && (( !(s3_evt0 != 0)) && ( !(s3_evt1 != 0)))) || (( !(s20_evt2 != 0)) && (( !(s20_evt0 != 0)) && ( !(s20_evt1 != 0)))))) && ((( !(s3_evt2 != 0)) && (( !(s3_evt0 != 0)) && ( !(s3_evt1 != 0)))) || (( !(s21_evt2 != 0)) && (( !(s21_evt0 != 0)) && ( !(s21_evt1 != 0)))))) && ((( !(s3_evt2 != 0)) && (( !(s3_evt0 != 0)) && ( !(s3_evt1 != 0)))) || (( !(s22_evt2 != 0)) && (( !(s22_evt0 != 0)) && ( !(s22_evt1 != 0)))))) && ((( !(s3_evt2 != 0)) && (( !(s3_evt0 != 0)) && ( !(s3_evt1 != 0)))) || (( !(s23_evt2 != 0)) && (( !(s23_evt0 != 0)) && ( !(s23_evt1 != 0)))))) && ((( !(s3_evt2 != 0)) && (( !(s3_evt0 != 0)) && ( !(s3_evt1 != 0)))) || (( !(s24_evt2 != 0)) && (( !(s24_evt0 != 0)) && ( !(s24_evt1 != 0)))))) && ((( !(s3_evt2 != 0)) && (( !(s3_evt0 != 0)) && ( !(s3_evt1 != 0)))) || (( !(s25_evt2 != 0)) && (( !(s25_evt0 != 0)) && ( !(s25_evt1 != 0)))))) && ((( !(s4_evt2 != 0)) && (( !(s4_evt0 != 0)) && ( !(s4_evt1 != 0)))) || (( !(s5_evt2 != 0)) && (( !(s5_evt0 != 0)) && ( !(s5_evt1 != 0)))))) && ((( !(s4_evt2 != 0)) && (( !(s4_evt0 != 0)) && ( !(s4_evt1 != 0)))) || (( !(s6_evt2 != 0)) && (( !(s6_evt0 != 0)) && ( !(s6_evt1 != 0)))))) && ((( !(s4_evt2 != 0)) && (( !(s4_evt0 != 0)) && ( !(s4_evt1 != 0)))) || (( !(s7_evt2 != 0)) && (( !(s7_evt0 != 0)) && ( !(s7_evt1 != 0)))))) && ((( !(s4_evt2 != 0)) && (( !(s4_evt0 != 0)) && ( !(s4_evt1 != 0)))) || (( !(s8_evt2 != 0)) && (( !(s8_evt0 != 0)) && ( !(s8_evt1 != 0)))))) && ((( !(s4_evt2 != 0)) && (( !(s4_evt0 != 0)) && ( !(s4_evt1 != 0)))) || (( !(s9_evt2 != 0)) && (( !(s9_evt0 != 0)) && ( !(s9_evt1 != 0)))))) && ((( !(s4_evt2 != 0)) && (( !(s4_evt0 != 0)) && ( !(s4_evt1 != 0)))) || (( !(s10_evt2 != 0)) && (( !(s10_evt0 != 0)) && ( !(s10_evt1 != 0)))))) && ((( !(s4_evt2 != 0)) && (( !(s4_evt0 != 0)) && ( !(s4_evt1 != 0)))) || (( !(s11_evt2 != 0)) && (( !(s11_evt0 != 0)) && ( !(s11_evt1 != 0)))))) && ((( !(s4_evt2 != 0)) && (( !(s4_evt0 != 0)) && ( !(s4_evt1 != 0)))) || (( !(s12_evt2 != 0)) && (( !(s12_evt0 != 0)) && ( !(s12_evt1 != 0)))))) && ((( !(s4_evt2 != 0)) && (( !(s4_evt0 != 0)) && ( !(s4_evt1 != 0)))) || (( !(s13_evt2 != 0)) && (( !(s13_evt0 != 0)) && ( !(s13_evt1 != 0)))))) && ((( !(s4_evt2 != 0)) && (( !(s4_evt0 != 0)) && ( !(s4_evt1 != 0)))) || (( !(s14_evt2 != 0)) && (( !(s14_evt0 != 0)) && ( !(s14_evt1 != 0)))))) && ((( !(s4_evt2 != 0)) && (( !(s4_evt0 != 0)) && ( !(s4_evt1 != 0)))) || (( !(s15_evt2 != 0)) && (( !(s15_evt0 != 0)) && ( !(s15_evt1 != 0)))))) && ((( !(s4_evt2 != 0)) && (( !(s4_evt0 != 0)) && ( !(s4_evt1 != 0)))) || (( !(s16_evt2 != 0)) && (( !(s16_evt0 != 0)) && ( !(s16_evt1 != 0)))))) && ((( !(s4_evt2 != 0)) && (( !(s4_evt0 != 0)) && ( !(s4_evt1 != 0)))) || (( !(s17_evt2 != 0)) && (( !(s17_evt0 != 0)) && ( !(s17_evt1 != 0)))))) && ((( !(s4_evt2 != 0)) && (( !(s4_evt0 != 0)) && ( !(s4_evt1 != 0)))) || (( !(s18_evt2 != 0)) && (( !(s18_evt0 != 0)) && ( !(s18_evt1 != 0)))))) && ((( !(s4_evt2 != 0)) && (( !(s4_evt0 != 0)) && ( !(s4_evt1 != 0)))) || (( !(s19_evt2 != 0)) && (( !(s19_evt0 != 0)) && ( !(s19_evt1 != 0)))))) && ((( !(s4_evt2 != 0)) && (( !(s4_evt0 != 0)) && ( !(s4_evt1 != 0)))) || (( !(s20_evt2 != 0)) && (( !(s20_evt0 != 0)) && ( !(s20_evt1 != 0)))))) && ((( !(s4_evt2 != 0)) && (( !(s4_evt0 != 0)) && ( !(s4_evt1 != 0)))) || (( !(s21_evt2 != 0)) && (( !(s21_evt0 != 0)) && ( !(s21_evt1 != 0)))))) && ((( !(s4_evt2 != 0)) && (( !(s4_evt0 != 0)) && ( !(s4_evt1 != 0)))) || (( !(s22_evt2 != 0)) && (( !(s22_evt0 != 0)) && ( !(s22_evt1 != 0)))))) && ((( !(s4_evt2 != 0)) && (( !(s4_evt0 != 0)) && ( !(s4_evt1 != 0)))) || (( !(s23_evt2 != 0)) && (( !(s23_evt0 != 0)) && ( !(s23_evt1 != 0)))))) && ((( !(s4_evt2 != 0)) && (( !(s4_evt0 != 0)) && ( !(s4_evt1 != 0)))) || (( !(s24_evt2 != 0)) && (( !(s24_evt0 != 0)) && ( !(s24_evt1 != 0)))))) && ((( !(s4_evt2 != 0)) && (( !(s4_evt0 != 0)) && ( !(s4_evt1 != 0)))) || (( !(s25_evt2 != 0)) && (( !(s25_evt0 != 0)) && ( !(s25_evt1 != 0)))))) && ((( !(s5_evt2 != 0)) && (( !(s5_evt0 != 0)) && ( !(s5_evt1 != 0)))) || (( !(s6_evt2 != 0)) && (( !(s6_evt0 != 0)) && ( !(s6_evt1 != 0)))))) && ((( !(s5_evt2 != 0)) && (( !(s5_evt0 != 0)) && ( !(s5_evt1 != 0)))) || (( !(s7_evt2 != 0)) && (( !(s7_evt0 != 0)) && ( !(s7_evt1 != 0)))))) && ((( !(s5_evt2 != 0)) && (( !(s5_evt0 != 0)) && ( !(s5_evt1 != 0)))) || (( !(s8_evt2 != 0)) && (( !(s8_evt0 != 0)) && ( !(s8_evt1 != 0)))))) && ((( !(s5_evt2 != 0)) && (( !(s5_evt0 != 0)) && ( !(s5_evt1 != 0)))) || (( !(s9_evt2 != 0)) && (( !(s9_evt0 != 0)) && ( !(s9_evt1 != 0)))))) && ((( !(s5_evt2 != 0)) && (( !(s5_evt0 != 0)) && ( !(s5_evt1 != 0)))) || (( !(s10_evt2 != 0)) && (( !(s10_evt0 != 0)) && ( !(s10_evt1 != 0)))))) && ((( !(s5_evt2 != 0)) && (( !(s5_evt0 != 0)) && ( !(s5_evt1 != 0)))) || (( !(s11_evt2 != 0)) && (( !(s11_evt0 != 0)) && ( !(s11_evt1 != 0)))))) && ((( !(s5_evt2 != 0)) && (( !(s5_evt0 != 0)) && ( !(s5_evt1 != 0)))) || (( !(s12_evt2 != 0)) && (( !(s12_evt0 != 0)) && ( !(s12_evt1 != 0)))))) && ((( !(s5_evt2 != 0)) && (( !(s5_evt0 != 0)) && ( !(s5_evt1 != 0)))) || (( !(s13_evt2 != 0)) && (( !(s13_evt0 != 0)) && ( !(s13_evt1 != 0)))))) && ((( !(s5_evt2 != 0)) && (( !(s5_evt0 != 0)) && ( !(s5_evt1 != 0)))) || (( !(s14_evt2 != 0)) && (( !(s14_evt0 != 0)) && ( !(s14_evt1 != 0)))))) && ((( !(s5_evt2 != 0)) && (( !(s5_evt0 != 0)) && ( !(s5_evt1 != 0)))) || (( !(s15_evt2 != 0)) && (( !(s15_evt0 != 0)) && ( !(s15_evt1 != 0)))))) && ((( !(s5_evt2 != 0)) && (( !(s5_evt0 != 0)) && ( !(s5_evt1 != 0)))) || (( !(s16_evt2 != 0)) && (( !(s16_evt0 != 0)) && ( !(s16_evt1 != 0)))))) && ((( !(s5_evt2 != 0)) && (( !(s5_evt0 != 0)) && ( !(s5_evt1 != 0)))) || (( !(s17_evt2 != 0)) && (( !(s17_evt0 != 0)) && ( !(s17_evt1 != 0)))))) && ((( !(s5_evt2 != 0)) && (( !(s5_evt0 != 0)) && ( !(s5_evt1 != 0)))) || (( !(s18_evt2 != 0)) && (( !(s18_evt0 != 0)) && ( !(s18_evt1 != 0)))))) && ((( !(s5_evt2 != 0)) && (( !(s5_evt0 != 0)) && ( !(s5_evt1 != 0)))) || (( !(s19_evt2 != 0)) && (( !(s19_evt0 != 0)) && ( !(s19_evt1 != 0)))))) && ((( !(s5_evt2 != 0)) && (( !(s5_evt0 != 0)) && ( !(s5_evt1 != 0)))) || (( !(s20_evt2 != 0)) && (( !(s20_evt0 != 0)) && ( !(s20_evt1 != 0)))))) && ((( !(s5_evt2 != 0)) && (( !(s5_evt0 != 0)) && ( !(s5_evt1 != 0)))) || (( !(s21_evt2 != 0)) && (( !(s21_evt0 != 0)) && ( !(s21_evt1 != 0)))))) && ((( !(s5_evt2 != 0)) && (( !(s5_evt0 != 0)) && ( !(s5_evt1 != 0)))) || (( !(s22_evt2 != 0)) && (( !(s22_evt0 != 0)) && ( !(s22_evt1 != 0)))))) && ((( !(s5_evt2 != 0)) && (( !(s5_evt0 != 0)) && ( !(s5_evt1 != 0)))) || (( !(s23_evt2 != 0)) && (( !(s23_evt0 != 0)) && ( !(s23_evt1 != 0)))))) && ((( !(s5_evt2 != 0)) && (( !(s5_evt0 != 0)) && ( !(s5_evt1 != 0)))) || (( !(s24_evt2 != 0)) && (( !(s24_evt0 != 0)) && ( !(s24_evt1 != 0)))))) && ((( !(s5_evt2 != 0)) && (( !(s5_evt0 != 0)) && ( !(s5_evt1 != 0)))) || (( !(s25_evt2 != 0)) && (( !(s25_evt0 != 0)) && ( !(s25_evt1 != 0)))))) && ((( !(s6_evt2 != 0)) && (( !(s6_evt0 != 0)) && ( !(s6_evt1 != 0)))) || (( !(s7_evt2 != 0)) && (( !(s7_evt0 != 0)) && ( !(s7_evt1 != 0)))))) && ((( !(s6_evt2 != 0)) && (( !(s6_evt0 != 0)) && ( !(s6_evt1 != 0)))) || (( !(s8_evt2 != 0)) && (( !(s8_evt0 != 0)) && ( !(s8_evt1 != 0)))))) && ((( !(s6_evt2 != 0)) && (( !(s6_evt0 != 0)) && ( !(s6_evt1 != 0)))) || (( !(s9_evt2 != 0)) && (( !(s9_evt0 != 0)) && ( !(s9_evt1 != 0)))))) && ((( !(s6_evt2 != 0)) && (( !(s6_evt0 != 0)) && ( !(s6_evt1 != 0)))) || (( !(s10_evt2 != 0)) && (( !(s10_evt0 != 0)) && ( !(s10_evt1 != 0)))))) && ((( !(s6_evt2 != 0)) && (( !(s6_evt0 != 0)) && ( !(s6_evt1 != 0)))) || (( !(s11_evt2 != 0)) && (( !(s11_evt0 != 0)) && ( !(s11_evt1 != 0)))))) && ((( !(s6_evt2 != 0)) && (( !(s6_evt0 != 0)) && ( !(s6_evt1 != 0)))) || (( !(s12_evt2 != 0)) && (( !(s12_evt0 != 0)) && ( !(s12_evt1 != 0)))))) && ((( !(s6_evt2 != 0)) && (( !(s6_evt0 != 0)) && ( !(s6_evt1 != 0)))) || (( !(s13_evt2 != 0)) && (( !(s13_evt0 != 0)) && ( !(s13_evt1 != 0)))))) && ((( !(s6_evt2 != 0)) && (( !(s6_evt0 != 0)) && ( !(s6_evt1 != 0)))) || (( !(s14_evt2 != 0)) && (( !(s14_evt0 != 0)) && ( !(s14_evt1 != 0)))))) && ((( !(s6_evt2 != 0)) && (( !(s6_evt0 != 0)) && ( !(s6_evt1 != 0)))) || (( !(s15_evt2 != 0)) && (( !(s15_evt0 != 0)) && ( !(s15_evt1 != 0)))))) && ((( !(s6_evt2 != 0)) && (( !(s6_evt0 != 0)) && ( !(s6_evt1 != 0)))) || (( !(s16_evt2 != 0)) && (( !(s16_evt0 != 0)) && ( !(s16_evt1 != 0)))))) && ((( !(s6_evt2 != 0)) && (( !(s6_evt0 != 0)) && ( !(s6_evt1 != 0)))) || (( !(s17_evt2 != 0)) && (( !(s17_evt0 != 0)) && ( !(s17_evt1 != 0)))))) && ((( !(s6_evt2 != 0)) && (( !(s6_evt0 != 0)) && ( !(s6_evt1 != 0)))) || (( !(s18_evt2 != 0)) && (( !(s18_evt0 != 0)) && ( !(s18_evt1 != 0)))))) && ((( !(s6_evt2 != 0)) && (( !(s6_evt0 != 0)) && ( !(s6_evt1 != 0)))) || (( !(s19_evt2 != 0)) && (( !(s19_evt0 != 0)) && ( !(s19_evt1 != 0)))))) && ((( !(s6_evt2 != 0)) && (( !(s6_evt0 != 0)) && ( !(s6_evt1 != 0)))) || (( !(s20_evt2 != 0)) && (( !(s20_evt0 != 0)) && ( !(s20_evt1 != 0)))))) && ((( !(s6_evt2 != 0)) && (( !(s6_evt0 != 0)) && ( !(s6_evt1 != 0)))) || (( !(s21_evt2 != 0)) && (( !(s21_evt0 != 0)) && ( !(s21_evt1 != 0)))))) && ((( !(s6_evt2 != 0)) && (( !(s6_evt0 != 0)) && ( !(s6_evt1 != 0)))) || (( !(s22_evt2 != 0)) && (( !(s22_evt0 != 0)) && ( !(s22_evt1 != 0)))))) && ((( !(s6_evt2 != 0)) && (( !(s6_evt0 != 0)) && ( !(s6_evt1 != 0)))) || (( !(s23_evt2 != 0)) && (( !(s23_evt0 != 0)) && ( !(s23_evt1 != 0)))))) && ((( !(s6_evt2 != 0)) && (( !(s6_evt0 != 0)) && ( !(s6_evt1 != 0)))) || (( !(s24_evt2 != 0)) && (( !(s24_evt0 != 0)) && ( !(s24_evt1 != 0)))))) && ((( !(s6_evt2 != 0)) && (( !(s6_evt0 != 0)) && ( !(s6_evt1 != 0)))) || (( !(s25_evt2 != 0)) && (( !(s25_evt0 != 0)) && ( !(s25_evt1 != 0)))))) && ((( !(s7_evt2 != 0)) && (( !(s7_evt0 != 0)) && ( !(s7_evt1 != 0)))) || (( !(s8_evt2 != 0)) && (( !(s8_evt0 != 0)) && ( !(s8_evt1 != 0)))))) && ((( !(s7_evt2 != 0)) && (( !(s7_evt0 != 0)) && ( !(s7_evt1 != 0)))) || (( !(s9_evt2 != 0)) && (( !(s9_evt0 != 0)) && ( !(s9_evt1 != 0)))))) && ((( !(s7_evt2 != 0)) && (( !(s7_evt0 != 0)) && ( !(s7_evt1 != 0)))) || (( !(s10_evt2 != 0)) && (( !(s10_evt0 != 0)) && ( !(s10_evt1 != 0)))))) && ((( !(s7_evt2 != 0)) && (( !(s7_evt0 != 0)) && ( !(s7_evt1 != 0)))) || (( !(s11_evt2 != 0)) && (( !(s11_evt0 != 0)) && ( !(s11_evt1 != 0)))))) && ((( !(s7_evt2 != 0)) && (( !(s7_evt0 != 0)) && ( !(s7_evt1 != 0)))) || (( !(s12_evt2 != 0)) && (( !(s12_evt0 != 0)) && ( !(s12_evt1 != 0)))))) && ((( !(s7_evt2 != 0)) && (( !(s7_evt0 != 0)) && ( !(s7_evt1 != 0)))) || (( !(s13_evt2 != 0)) && (( !(s13_evt0 != 0)) && ( !(s13_evt1 != 0)))))) && ((( !(s7_evt2 != 0)) && (( !(s7_evt0 != 0)) && ( !(s7_evt1 != 0)))) || (( !(s14_evt2 != 0)) && (( !(s14_evt0 != 0)) && ( !(s14_evt1 != 0)))))) && ((( !(s7_evt2 != 0)) && (( !(s7_evt0 != 0)) && ( !(s7_evt1 != 0)))) || (( !(s15_evt2 != 0)) && (( !(s15_evt0 != 0)) && ( !(s15_evt1 != 0)))))) && ((( !(s7_evt2 != 0)) && (( !(s7_evt0 != 0)) && ( !(s7_evt1 != 0)))) || (( !(s16_evt2 != 0)) && (( !(s16_evt0 != 0)) && ( !(s16_evt1 != 0)))))) && ((( !(s7_evt2 != 0)) && (( !(s7_evt0 != 0)) && ( !(s7_evt1 != 0)))) || (( !(s17_evt2 != 0)) && (( !(s17_evt0 != 0)) && ( !(s17_evt1 != 0)))))) && ((( !(s7_evt2 != 0)) && (( !(s7_evt0 != 0)) && ( !(s7_evt1 != 0)))) || (( !(s18_evt2 != 0)) && (( !(s18_evt0 != 0)) && ( !(s18_evt1 != 0)))))) && ((( !(s7_evt2 != 0)) && (( !(s7_evt0 != 0)) && ( !(s7_evt1 != 0)))) || (( !(s19_evt2 != 0)) && (( !(s19_evt0 != 0)) && ( !(s19_evt1 != 0)))))) && ((( !(s7_evt2 != 0)) && (( !(s7_evt0 != 0)) && ( !(s7_evt1 != 0)))) || (( !(s20_evt2 != 0)) && (( !(s20_evt0 != 0)) && ( !(s20_evt1 != 0)))))) && ((( !(s7_evt2 != 0)) && (( !(s7_evt0 != 0)) && ( !(s7_evt1 != 0)))) || (( !(s21_evt2 != 0)) && (( !(s21_evt0 != 0)) && ( !(s21_evt1 != 0)))))) && ((( !(s7_evt2 != 0)) && (( !(s7_evt0 != 0)) && ( !(s7_evt1 != 0)))) || (( !(s22_evt2 != 0)) && (( !(s22_evt0 != 0)) && ( !(s22_evt1 != 0)))))) && ((( !(s7_evt2 != 0)) && (( !(s7_evt0 != 0)) && ( !(s7_evt1 != 0)))) || (( !(s23_evt2 != 0)) && (( !(s23_evt0 != 0)) && ( !(s23_evt1 != 0)))))) && ((( !(s7_evt2 != 0)) && (( !(s7_evt0 != 0)) && ( !(s7_evt1 != 0)))) || (( !(s24_evt2 != 0)) && (( !(s24_evt0 != 0)) && ( !(s24_evt1 != 0)))))) && ((( !(s7_evt2 != 0)) && (( !(s7_evt0 != 0)) && ( !(s7_evt1 != 0)))) || (( !(s25_evt2 != 0)) && (( !(s25_evt0 != 0)) && ( !(s25_evt1 != 0)))))) && ((( !(s8_evt2 != 0)) && (( !(s8_evt0 != 0)) && ( !(s8_evt1 != 0)))) || (( !(s9_evt2 != 0)) && (( !(s9_evt0 != 0)) && ( !(s9_evt1 != 0)))))) && ((( !(s8_evt2 != 0)) && (( !(s8_evt0 != 0)) && ( !(s8_evt1 != 0)))) || (( !(s10_evt2 != 0)) && (( !(s10_evt0 != 0)) && ( !(s10_evt1 != 0)))))) && ((( !(s8_evt2 != 0)) && (( !(s8_evt0 != 0)) && ( !(s8_evt1 != 0)))) || (( !(s11_evt2 != 0)) && (( !(s11_evt0 != 0)) && ( !(s11_evt1 != 0)))))) && ((( !(s8_evt2 != 0)) && (( !(s8_evt0 != 0)) && ( !(s8_evt1 != 0)))) || (( !(s12_evt2 != 0)) && (( !(s12_evt0 != 0)) && ( !(s12_evt1 != 0)))))) && ((( !(s8_evt2 != 0)) && (( !(s8_evt0 != 0)) && ( !(s8_evt1 != 0)))) || (( !(s13_evt2 != 0)) && (( !(s13_evt0 != 0)) && ( !(s13_evt1 != 0)))))) && ((( !(s8_evt2 != 0)) && (( !(s8_evt0 != 0)) && ( !(s8_evt1 != 0)))) || (( !(s14_evt2 != 0)) && (( !(s14_evt0 != 0)) && ( !(s14_evt1 != 0)))))) && ((( !(s8_evt2 != 0)) && (( !(s8_evt0 != 0)) && ( !(s8_evt1 != 0)))) || (( !(s15_evt2 != 0)) && (( !(s15_evt0 != 0)) && ( !(s15_evt1 != 0)))))) && ((( !(s8_evt2 != 0)) && (( !(s8_evt0 != 0)) && ( !(s8_evt1 != 0)))) || (( !(s16_evt2 != 0)) && (( !(s16_evt0 != 0)) && ( !(s16_evt1 != 0)))))) && ((( !(s8_evt2 != 0)) && (( !(s8_evt0 != 0)) && ( !(s8_evt1 != 0)))) || (( !(s17_evt2 != 0)) && (( !(s17_evt0 != 0)) && ( !(s17_evt1 != 0)))))) && ((( !(s8_evt2 != 0)) && (( !(s8_evt0 != 0)) && ( !(s8_evt1 != 0)))) || (( !(s18_evt2 != 0)) && (( !(s18_evt0 != 0)) && ( !(s18_evt1 != 0)))))) && ((( !(s8_evt2 != 0)) && (( !(s8_evt0 != 0)) && ( !(s8_evt1 != 0)))) || (( !(s19_evt2 != 0)) && (( !(s19_evt0 != 0)) && ( !(s19_evt1 != 0)))))) && ((( !(s8_evt2 != 0)) && (( !(s8_evt0 != 0)) && ( !(s8_evt1 != 0)))) || (( !(s20_evt2 != 0)) && (( !(s20_evt0 != 0)) && ( !(s20_evt1 != 0)))))) && ((( !(s8_evt2 != 0)) && (( !(s8_evt0 != 0)) && ( !(s8_evt1 != 0)))) || (( !(s21_evt2 != 0)) && (( !(s21_evt0 != 0)) && ( !(s21_evt1 != 0)))))) && ((( !(s8_evt2 != 0)) && (( !(s8_evt0 != 0)) && ( !(s8_evt1 != 0)))) || (( !(s22_evt2 != 0)) && (( !(s22_evt0 != 0)) && ( !(s22_evt1 != 0)))))) && ((( !(s8_evt2 != 0)) && (( !(s8_evt0 != 0)) && ( !(s8_evt1 != 0)))) || (( !(s23_evt2 != 0)) && (( !(s23_evt0 != 0)) && ( !(s23_evt1 != 0)))))) && ((( !(s8_evt2 != 0)) && (( !(s8_evt0 != 0)) && ( !(s8_evt1 != 0)))) || (( !(s24_evt2 != 0)) && (( !(s24_evt0 != 0)) && ( !(s24_evt1 != 0)))))) && ((( !(s8_evt2 != 0)) && (( !(s8_evt0 != 0)) && ( !(s8_evt1 != 0)))) || (( !(s25_evt2 != 0)) && (( !(s25_evt0 != 0)) && ( !(s25_evt1 != 0)))))) && ((( !(s9_evt2 != 0)) && (( !(s9_evt0 != 0)) && ( !(s9_evt1 != 0)))) || (( !(s10_evt2 != 0)) && (( !(s10_evt0 != 0)) && ( !(s10_evt1 != 0)))))) && ((( !(s9_evt2 != 0)) && (( !(s9_evt0 != 0)) && ( !(s9_evt1 != 0)))) || (( !(s11_evt2 != 0)) && (( !(s11_evt0 != 0)) && ( !(s11_evt1 != 0)))))) && ((( !(s9_evt2 != 0)) && (( !(s9_evt0 != 0)) && ( !(s9_evt1 != 0)))) || (( !(s12_evt2 != 0)) && (( !(s12_evt0 != 0)) && ( !(s12_evt1 != 0)))))) && ((( !(s9_evt2 != 0)) && (( !(s9_evt0 != 0)) && ( !(s9_evt1 != 0)))) || (( !(s13_evt2 != 0)) && (( !(s13_evt0 != 0)) && ( !(s13_evt1 != 0)))))) && ((( !(s9_evt2 != 0)) && (( !(s9_evt0 != 0)) && ( !(s9_evt1 != 0)))) || (( !(s14_evt2 != 0)) && (( !(s14_evt0 != 0)) && ( !(s14_evt1 != 0)))))) && ((( !(s9_evt2 != 0)) && (( !(s9_evt0 != 0)) && ( !(s9_evt1 != 0)))) || (( !(s15_evt2 != 0)) && (( !(s15_evt0 != 0)) && ( !(s15_evt1 != 0)))))) && ((( !(s9_evt2 != 0)) && (( !(s9_evt0 != 0)) && ( !(s9_evt1 != 0)))) || (( !(s16_evt2 != 0)) && (( !(s16_evt0 != 0)) && ( !(s16_evt1 != 0)))))) && ((( !(s9_evt2 != 0)) && (( !(s9_evt0 != 0)) && ( !(s9_evt1 != 0)))) || (( !(s17_evt2 != 0)) && (( !(s17_evt0 != 0)) && ( !(s17_evt1 != 0)))))) && ((( !(s9_evt2 != 0)) && (( !(s9_evt0 != 0)) && ( !(s9_evt1 != 0)))) || (( !(s18_evt2 != 0)) && (( !(s18_evt0 != 0)) && ( !(s18_evt1 != 0)))))) && ((( !(s9_evt2 != 0)) && (( !(s9_evt0 != 0)) && ( !(s9_evt1 != 0)))) || (( !(s19_evt2 != 0)) && (( !(s19_evt0 != 0)) && ( !(s19_evt1 != 0)))))) && ((( !(s9_evt2 != 0)) && (( !(s9_evt0 != 0)) && ( !(s9_evt1 != 0)))) || (( !(s20_evt2 != 0)) && (( !(s20_evt0 != 0)) && ( !(s20_evt1 != 0)))))) && ((( !(s9_evt2 != 0)) && (( !(s9_evt0 != 0)) && ( !(s9_evt1 != 0)))) || (( !(s21_evt2 != 0)) && (( !(s21_evt0 != 0)) && ( !(s21_evt1 != 0)))))) && ((( !(s9_evt2 != 0)) && (( !(s9_evt0 != 0)) && ( !(s9_evt1 != 0)))) || (( !(s22_evt2 != 0)) && (( !(s22_evt0 != 0)) && ( !(s22_evt1 != 0)))))) && ((( !(s9_evt2 != 0)) && (( !(s9_evt0 != 0)) && ( !(s9_evt1 != 0)))) || (( !(s23_evt2 != 0)) && (( !(s23_evt0 != 0)) && ( !(s23_evt1 != 0)))))) && ((( !(s9_evt2 != 0)) && (( !(s9_evt0 != 0)) && ( !(s9_evt1 != 0)))) || (( !(s24_evt2 != 0)) && (( !(s24_evt0 != 0)) && ( !(s24_evt1 != 0)))))) && ((( !(s9_evt2 != 0)) && (( !(s9_evt0 != 0)) && ( !(s9_evt1 != 0)))) || (( !(s25_evt2 != 0)) && (( !(s25_evt0 != 0)) && ( !(s25_evt1 != 0)))))) && ((( !(s10_evt2 != 0)) && (( !(s10_evt0 != 0)) && ( !(s10_evt1 != 0)))) || (( !(s11_evt2 != 0)) && (( !(s11_evt0 != 0)) && ( !(s11_evt1 != 0)))))) && ((( !(s10_evt2 != 0)) && (( !(s10_evt0 != 0)) && ( !(s10_evt1 != 0)))) || (( !(s12_evt2 != 0)) && (( !(s12_evt0 != 0)) && ( !(s12_evt1 != 0)))))) && ((( !(s10_evt2 != 0)) && (( !(s10_evt0 != 0)) && ( !(s10_evt1 != 0)))) || (( !(s13_evt2 != 0)) && (( !(s13_evt0 != 0)) && ( !(s13_evt1 != 0)))))) && ((( !(s10_evt2 != 0)) && (( !(s10_evt0 != 0)) && ( !(s10_evt1 != 0)))) || (( !(s14_evt2 != 0)) && (( !(s14_evt0 != 0)) && ( !(s14_evt1 != 0)))))) && ((( !(s10_evt2 != 0)) && (( !(s10_evt0 != 0)) && ( !(s10_evt1 != 0)))) || (( !(s15_evt2 != 0)) && (( !(s15_evt0 != 0)) && ( !(s15_evt1 != 0)))))) && ((( !(s10_evt2 != 0)) && (( !(s10_evt0 != 0)) && ( !(s10_evt1 != 0)))) || (( !(s16_evt2 != 0)) && (( !(s16_evt0 != 0)) && ( !(s16_evt1 != 0)))))) && ((( !(s10_evt2 != 0)) && (( !(s10_evt0 != 0)) && ( !(s10_evt1 != 0)))) || (( !(s17_evt2 != 0)) && (( !(s17_evt0 != 0)) && ( !(s17_evt1 != 0)))))) && ((( !(s10_evt2 != 0)) && (( !(s10_evt0 != 0)) && ( !(s10_evt1 != 0)))) || (( !(s18_evt2 != 0)) && (( !(s18_evt0 != 0)) && ( !(s18_evt1 != 0)))))) && ((( !(s10_evt2 != 0)) && (( !(s10_evt0 != 0)) && ( !(s10_evt1 != 0)))) || (( !(s19_evt2 != 0)) && (( !(s19_evt0 != 0)) && ( !(s19_evt1 != 0)))))) && ((( !(s10_evt2 != 0)) && (( !(s10_evt0 != 0)) && ( !(s10_evt1 != 0)))) || (( !(s20_evt2 != 0)) && (( !(s20_evt0 != 0)) && ( !(s20_evt1 != 0)))))) && ((( !(s10_evt2 != 0)) && (( !(s10_evt0 != 0)) && ( !(s10_evt1 != 0)))) || (( !(s21_evt2 != 0)) && (( !(s21_evt0 != 0)) && ( !(s21_evt1 != 0)))))) && ((( !(s10_evt2 != 0)) && (( !(s10_evt0 != 0)) && ( !(s10_evt1 != 0)))) || (( !(s22_evt2 != 0)) && (( !(s22_evt0 != 0)) && ( !(s22_evt1 != 0)))))) && ((( !(s10_evt2 != 0)) && (( !(s10_evt0 != 0)) && ( !(s10_evt1 != 0)))) || (( !(s23_evt2 != 0)) && (( !(s23_evt0 != 0)) && ( !(s23_evt1 != 0)))))) && ((( !(s10_evt2 != 0)) && (( !(s10_evt0 != 0)) && ( !(s10_evt1 != 0)))) || (( !(s24_evt2 != 0)) && (( !(s24_evt0 != 0)) && ( !(s24_evt1 != 0)))))) && ((( !(s10_evt2 != 0)) && (( !(s10_evt0 != 0)) && ( !(s10_evt1 != 0)))) || (( !(s25_evt2 != 0)) && (( !(s25_evt0 != 0)) && ( !(s25_evt1 != 0)))))) && ((( !(s11_evt2 != 0)) && (( !(s11_evt0 != 0)) && ( !(s11_evt1 != 0)))) || (( !(s12_evt2 != 0)) && (( !(s12_evt0 != 0)) && ( !(s12_evt1 != 0)))))) && ((( !(s11_evt2 != 0)) && (( !(s11_evt0 != 0)) && ( !(s11_evt1 != 0)))) || (( !(s13_evt2 != 0)) && (( !(s13_evt0 != 0)) && ( !(s13_evt1 != 0)))))) && ((( !(s11_evt2 != 0)) && (( !(s11_evt0 != 0)) && ( !(s11_evt1 != 0)))) || (( !(s14_evt2 != 0)) && (( !(s14_evt0 != 0)) && ( !(s14_evt1 != 0)))))) && ((( !(s11_evt2 != 0)) && (( !(s11_evt0 != 0)) && ( !(s11_evt1 != 0)))) || (( !(s15_evt2 != 0)) && (( !(s15_evt0 != 0)) && ( !(s15_evt1 != 0)))))) && ((( !(s11_evt2 != 0)) && (( !(s11_evt0 != 0)) && ( !(s11_evt1 != 0)))) || (( !(s16_evt2 != 0)) && (( !(s16_evt0 != 0)) && ( !(s16_evt1 != 0)))))) && ((( !(s11_evt2 != 0)) && (( !(s11_evt0 != 0)) && ( !(s11_evt1 != 0)))) || (( !(s17_evt2 != 0)) && (( !(s17_evt0 != 0)) && ( !(s17_evt1 != 0)))))) && ((( !(s11_evt2 != 0)) && (( !(s11_evt0 != 0)) && ( !(s11_evt1 != 0)))) || (( !(s18_evt2 != 0)) && (( !(s18_evt0 != 0)) && ( !(s18_evt1 != 0)))))) && ((( !(s11_evt2 != 0)) && (( !(s11_evt0 != 0)) && ( !(s11_evt1 != 0)))) || (( !(s19_evt2 != 0)) && (( !(s19_evt0 != 0)) && ( !(s19_evt1 != 0)))))) && ((( !(s11_evt2 != 0)) && (( !(s11_evt0 != 0)) && ( !(s11_evt1 != 0)))) || (( !(s20_evt2 != 0)) && (( !(s20_evt0 != 0)) && ( !(s20_evt1 != 0)))))) && ((( !(s11_evt2 != 0)) && (( !(s11_evt0 != 0)) && ( !(s11_evt1 != 0)))) || (( !(s21_evt2 != 0)) && (( !(s21_evt0 != 0)) && ( !(s21_evt1 != 0)))))) && ((( !(s11_evt2 != 0)) && (( !(s11_evt0 != 0)) && ( !(s11_evt1 != 0)))) || (( !(s22_evt2 != 0)) && (( !(s22_evt0 != 0)) && ( !(s22_evt1 != 0)))))) && ((( !(s11_evt2 != 0)) && (( !(s11_evt0 != 0)) && ( !(s11_evt1 != 0)))) || (( !(s23_evt2 != 0)) && (( !(s23_evt0 != 0)) && ( !(s23_evt1 != 0)))))) && ((( !(s11_evt2 != 0)) && (( !(s11_evt0 != 0)) && ( !(s11_evt1 != 0)))) || (( !(s24_evt2 != 0)) && (( !(s24_evt0 != 0)) && ( !(s24_evt1 != 0)))))) && ((( !(s11_evt2 != 0)) && (( !(s11_evt0 != 0)) && ( !(s11_evt1 != 0)))) || (( !(s25_evt2 != 0)) && (( !(s25_evt0 != 0)) && ( !(s25_evt1 != 0)))))) && ((( !(s12_evt2 != 0)) && (( !(s12_evt0 != 0)) && ( !(s12_evt1 != 0)))) || (( !(s13_evt2 != 0)) && (( !(s13_evt0 != 0)) && ( !(s13_evt1 != 0)))))) && ((( !(s12_evt2 != 0)) && (( !(s12_evt0 != 0)) && ( !(s12_evt1 != 0)))) || (( !(s14_evt2 != 0)) && (( !(s14_evt0 != 0)) && ( !(s14_evt1 != 0)))))) && ((( !(s12_evt2 != 0)) && (( !(s12_evt0 != 0)) && ( !(s12_evt1 != 0)))) || (( !(s15_evt2 != 0)) && (( !(s15_evt0 != 0)) && ( !(s15_evt1 != 0)))))) && ((( !(s12_evt2 != 0)) && (( !(s12_evt0 != 0)) && ( !(s12_evt1 != 0)))) || (( !(s16_evt2 != 0)) && (( !(s16_evt0 != 0)) && ( !(s16_evt1 != 0)))))) && ((( !(s12_evt2 != 0)) && (( !(s12_evt0 != 0)) && ( !(s12_evt1 != 0)))) || (( !(s17_evt2 != 0)) && (( !(s17_evt0 != 0)) && ( !(s17_evt1 != 0)))))) && ((( !(s12_evt2 != 0)) && (( !(s12_evt0 != 0)) && ( !(s12_evt1 != 0)))) || (( !(s18_evt2 != 0)) && (( !(s18_evt0 != 0)) && ( !(s18_evt1 != 0)))))) && ((( !(s12_evt2 != 0)) && (( !(s12_evt0 != 0)) && ( !(s12_evt1 != 0)))) || (( !(s19_evt2 != 0)) && (( !(s19_evt0 != 0)) && ( !(s19_evt1 != 0)))))) && ((( !(s12_evt2 != 0)) && (( !(s12_evt0 != 0)) && ( !(s12_evt1 != 0)))) || (( !(s20_evt2 != 0)) && (( !(s20_evt0 != 0)) && ( !(s20_evt1 != 0)))))) && ((( !(s12_evt2 != 0)) && (( !(s12_evt0 != 0)) && ( !(s12_evt1 != 0)))) || (( !(s21_evt2 != 0)) && (( !(s21_evt0 != 0)) && ( !(s21_evt1 != 0)))))) && ((( !(s12_evt2 != 0)) && (( !(s12_evt0 != 0)) && ( !(s12_evt1 != 0)))) || (( !(s22_evt2 != 0)) && (( !(s22_evt0 != 0)) && ( !(s22_evt1 != 0)))))) && ((( !(s12_evt2 != 0)) && (( !(s12_evt0 != 0)) && ( !(s12_evt1 != 0)))) || (( !(s23_evt2 != 0)) && (( !(s23_evt0 != 0)) && ( !(s23_evt1 != 0)))))) && ((( !(s12_evt2 != 0)) && (( !(s12_evt0 != 0)) && ( !(s12_evt1 != 0)))) || (( !(s24_evt2 != 0)) && (( !(s24_evt0 != 0)) && ( !(s24_evt1 != 0)))))) && ((( !(s12_evt2 != 0)) && (( !(s12_evt0 != 0)) && ( !(s12_evt1 != 0)))) || (( !(s25_evt2 != 0)) && (( !(s25_evt0 != 0)) && ( !(s25_evt1 != 0)))))) && ((( !(s13_evt2 != 0)) && (( !(s13_evt0 != 0)) && ( !(s13_evt1 != 0)))) || (( !(s14_evt2 != 0)) && (( !(s14_evt0 != 0)) && ( !(s14_evt1 != 0)))))) && ((( !(s13_evt2 != 0)) && (( !(s13_evt0 != 0)) && ( !(s13_evt1 != 0)))) || (( !(s15_evt2 != 0)) && (( !(s15_evt0 != 0)) && ( !(s15_evt1 != 0)))))) && ((( !(s13_evt2 != 0)) && (( !(s13_evt0 != 0)) && ( !(s13_evt1 != 0)))) || (( !(s16_evt2 != 0)) && (( !(s16_evt0 != 0)) && ( !(s16_evt1 != 0)))))) && ((( !(s13_evt2 != 0)) && (( !(s13_evt0 != 0)) && ( !(s13_evt1 != 0)))) || (( !(s17_evt2 != 0)) && (( !(s17_evt0 != 0)) && ( !(s17_evt1 != 0)))))) && ((( !(s13_evt2 != 0)) && (( !(s13_evt0 != 0)) && ( !(s13_evt1 != 0)))) || (( !(s18_evt2 != 0)) && (( !(s18_evt0 != 0)) && ( !(s18_evt1 != 0)))))) && ((( !(s13_evt2 != 0)) && (( !(s13_evt0 != 0)) && ( !(s13_evt1 != 0)))) || (( !(s19_evt2 != 0)) && (( !(s19_evt0 != 0)) && ( !(s19_evt1 != 0)))))) && ((( !(s13_evt2 != 0)) && (( !(s13_evt0 != 0)) && ( !(s13_evt1 != 0)))) || (( !(s20_evt2 != 0)) && (( !(s20_evt0 != 0)) && ( !(s20_evt1 != 0)))))) && ((( !(s13_evt2 != 0)) && (( !(s13_evt0 != 0)) && ( !(s13_evt1 != 0)))) || (( !(s21_evt2 != 0)) && (( !(s21_evt0 != 0)) && ( !(s21_evt1 != 0)))))) && ((( !(s13_evt2 != 0)) && (( !(s13_evt0 != 0)) && ( !(s13_evt1 != 0)))) || (( !(s22_evt2 != 0)) && (( !(s22_evt0 != 0)) && ( !(s22_evt1 != 0)))))) && ((( !(s13_evt2 != 0)) && (( !(s13_evt0 != 0)) && ( !(s13_evt1 != 0)))) || (( !(s23_evt2 != 0)) && (( !(s23_evt0 != 0)) && ( !(s23_evt1 != 0)))))) && ((( !(s13_evt2 != 0)) && (( !(s13_evt0 != 0)) && ( !(s13_evt1 != 0)))) || (( !(s24_evt2 != 0)) && (( !(s24_evt0 != 0)) && ( !(s24_evt1 != 0)))))) && ((( !(s13_evt2 != 0)) && (( !(s13_evt0 != 0)) && ( !(s13_evt1 != 0)))) || (( !(s25_evt2 != 0)) && (( !(s25_evt0 != 0)) && ( !(s25_evt1 != 0)))))) && ((( !(s14_evt2 != 0)) && (( !(s14_evt0 != 0)) && ( !(s14_evt1 != 0)))) || (( !(s15_evt2 != 0)) && (( !(s15_evt0 != 0)) && ( !(s15_evt1 != 0)))))) && ((( !(s14_evt2 != 0)) && (( !(s14_evt0 != 0)) && ( !(s14_evt1 != 0)))) || (( !(s16_evt2 != 0)) && (( !(s16_evt0 != 0)) && ( !(s16_evt1 != 0)))))) && ((( !(s14_evt2 != 0)) && (( !(s14_evt0 != 0)) && ( !(s14_evt1 != 0)))) || (( !(s17_evt2 != 0)) && (( !(s17_evt0 != 0)) && ( !(s17_evt1 != 0)))))) && ((( !(s14_evt2 != 0)) && (( !(s14_evt0 != 0)) && ( !(s14_evt1 != 0)))) || (( !(s18_evt2 != 0)) && (( !(s18_evt0 != 0)) && ( !(s18_evt1 != 0)))))) && ((( !(s14_evt2 != 0)) && (( !(s14_evt0 != 0)) && ( !(s14_evt1 != 0)))) || (( !(s19_evt2 != 0)) && (( !(s19_evt0 != 0)) && ( !(s19_evt1 != 0)))))) && ((( !(s14_evt2 != 0)) && (( !(s14_evt0 != 0)) && ( !(s14_evt1 != 0)))) || (( !(s20_evt2 != 0)) && (( !(s20_evt0 != 0)) && ( !(s20_evt1 != 0)))))) && ((( !(s14_evt2 != 0)) && (( !(s14_evt0 != 0)) && ( !(s14_evt1 != 0)))) || (( !(s21_evt2 != 0)) && (( !(s21_evt0 != 0)) && ( !(s21_evt1 != 0)))))) && ((( !(s14_evt2 != 0)) && (( !(s14_evt0 != 0)) && ( !(s14_evt1 != 0)))) || (( !(s22_evt2 != 0)) && (( !(s22_evt0 != 0)) && ( !(s22_evt1 != 0)))))) && ((( !(s14_evt2 != 0)) && (( !(s14_evt0 != 0)) && ( !(s14_evt1 != 0)))) || (( !(s23_evt2 != 0)) && (( !(s23_evt0 != 0)) && ( !(s23_evt1 != 0)))))) && ((( !(s14_evt2 != 0)) && (( !(s14_evt0 != 0)) && ( !(s14_evt1 != 0)))) || (( !(s24_evt2 != 0)) && (( !(s24_evt0 != 0)) && ( !(s24_evt1 != 0)))))) && ((( !(s14_evt2 != 0)) && (( !(s14_evt0 != 0)) && ( !(s14_evt1 != 0)))) || (( !(s25_evt2 != 0)) && (( !(s25_evt0 != 0)) && ( !(s25_evt1 != 0)))))) && ((( !(s15_evt2 != 0)) && (( !(s15_evt0 != 0)) && ( !(s15_evt1 != 0)))) || (( !(s16_evt2 != 0)) && (( !(s16_evt0 != 0)) && ( !(s16_evt1 != 0)))))) && ((( !(s15_evt2 != 0)) && (( !(s15_evt0 != 0)) && ( !(s15_evt1 != 0)))) || (( !(s17_evt2 != 0)) && (( !(s17_evt0 != 0)) && ( !(s17_evt1 != 0)))))) && ((( !(s15_evt2 != 0)) && (( !(s15_evt0 != 0)) && ( !(s15_evt1 != 0)))) || (( !(s18_evt2 != 0)) && (( !(s18_evt0 != 0)) && ( !(s18_evt1 != 0)))))) && ((( !(s15_evt2 != 0)) && (( !(s15_evt0 != 0)) && ( !(s15_evt1 != 0)))) || (( !(s19_evt2 != 0)) && (( !(s19_evt0 != 0)) && ( !(s19_evt1 != 0)))))) && ((( !(s15_evt2 != 0)) && (( !(s15_evt0 != 0)) && ( !(s15_evt1 != 0)))) || (( !(s20_evt2 != 0)) && (( !(s20_evt0 != 0)) && ( !(s20_evt1 != 0)))))) && ((( !(s15_evt2 != 0)) && (( !(s15_evt0 != 0)) && ( !(s15_evt1 != 0)))) || (( !(s21_evt2 != 0)) && (( !(s21_evt0 != 0)) && ( !(s21_evt1 != 0)))))) && ((( !(s15_evt2 != 0)) && (( !(s15_evt0 != 0)) && ( !(s15_evt1 != 0)))) || (( !(s22_evt2 != 0)) && (( !(s22_evt0 != 0)) && ( !(s22_evt1 != 0)))))) && ((( !(s15_evt2 != 0)) && (( !(s15_evt0 != 0)) && ( !(s15_evt1 != 0)))) || (( !(s23_evt2 != 0)) && (( !(s23_evt0 != 0)) && ( !(s23_evt1 != 0)))))) && ((( !(s15_evt2 != 0)) && (( !(s15_evt0 != 0)) && ( !(s15_evt1 != 0)))) || (( !(s24_evt2 != 0)) && (( !(s24_evt0 != 0)) && ( !(s24_evt1 != 0)))))) && ((( !(s15_evt2 != 0)) && (( !(s15_evt0 != 0)) && ( !(s15_evt1 != 0)))) || (( !(s25_evt2 != 0)) && (( !(s25_evt0 != 0)) && ( !(s25_evt1 != 0)))))) && ((( !(s16_evt2 != 0)) && (( !(s16_evt0 != 0)) && ( !(s16_evt1 != 0)))) || (( !(s17_evt2 != 0)) && (( !(s17_evt0 != 0)) && ( !(s17_evt1 != 0)))))) && ((( !(s16_evt2 != 0)) && (( !(s16_evt0 != 0)) && ( !(s16_evt1 != 0)))) || (( !(s18_evt2 != 0)) && (( !(s18_evt0 != 0)) && ( !(s18_evt1 != 0)))))) && ((( !(s16_evt2 != 0)) && (( !(s16_evt0 != 0)) && ( !(s16_evt1 != 0)))) || (( !(s19_evt2 != 0)) && (( !(s19_evt0 != 0)) && ( !(s19_evt1 != 0)))))) && ((( !(s16_evt2 != 0)) && (( !(s16_evt0 != 0)) && ( !(s16_evt1 != 0)))) || (( !(s20_evt2 != 0)) && (( !(s20_evt0 != 0)) && ( !(s20_evt1 != 0)))))) && ((( !(s16_evt2 != 0)) && (( !(s16_evt0 != 0)) && ( !(s16_evt1 != 0)))) || (( !(s21_evt2 != 0)) && (( !(s21_evt0 != 0)) && ( !(s21_evt1 != 0)))))) && ((( !(s16_evt2 != 0)) && (( !(s16_evt0 != 0)) && ( !(s16_evt1 != 0)))) || (( !(s22_evt2 != 0)) && (( !(s22_evt0 != 0)) && ( !(s22_evt1 != 0)))))) && ((( !(s16_evt2 != 0)) && (( !(s16_evt0 != 0)) && ( !(s16_evt1 != 0)))) || (( !(s23_evt2 != 0)) && (( !(s23_evt0 != 0)) && ( !(s23_evt1 != 0)))))) && ((( !(s16_evt2 != 0)) && (( !(s16_evt0 != 0)) && ( !(s16_evt1 != 0)))) || (( !(s24_evt2 != 0)) && (( !(s24_evt0 != 0)) && ( !(s24_evt1 != 0)))))) && ((( !(s16_evt2 != 0)) && (( !(s16_evt0 != 0)) && ( !(s16_evt1 != 0)))) || (( !(s25_evt2 != 0)) && (( !(s25_evt0 != 0)) && ( !(s25_evt1 != 0)))))) && ((( !(s17_evt2 != 0)) && (( !(s17_evt0 != 0)) && ( !(s17_evt1 != 0)))) || (( !(s18_evt2 != 0)) && (( !(s18_evt0 != 0)) && ( !(s18_evt1 != 0)))))) && ((( !(s17_evt2 != 0)) && (( !(s17_evt0 != 0)) && ( !(s17_evt1 != 0)))) || (( !(s19_evt2 != 0)) && (( !(s19_evt0 != 0)) && ( !(s19_evt1 != 0)))))) && ((( !(s17_evt2 != 0)) && (( !(s17_evt0 != 0)) && ( !(s17_evt1 != 0)))) || (( !(s20_evt2 != 0)) && (( !(s20_evt0 != 0)) && ( !(s20_evt1 != 0)))))) && ((( !(s17_evt2 != 0)) && (( !(s17_evt0 != 0)) && ( !(s17_evt1 != 0)))) || (( !(s21_evt2 != 0)) && (( !(s21_evt0 != 0)) && ( !(s21_evt1 != 0)))))) && ((( !(s17_evt2 != 0)) && (( !(s17_evt0 != 0)) && ( !(s17_evt1 != 0)))) || (( !(s22_evt2 != 0)) && (( !(s22_evt0 != 0)) && ( !(s22_evt1 != 0)))))) && ((( !(s17_evt2 != 0)) && (( !(s17_evt0 != 0)) && ( !(s17_evt1 != 0)))) || (( !(s23_evt2 != 0)) && (( !(s23_evt0 != 0)) && ( !(s23_evt1 != 0)))))) && ((( !(s17_evt2 != 0)) && (( !(s17_evt0 != 0)) && ( !(s17_evt1 != 0)))) || (( !(s24_evt2 != 0)) && (( !(s24_evt0 != 0)) && ( !(s24_evt1 != 0)))))) && ((( !(s17_evt2 != 0)) && (( !(s17_evt0 != 0)) && ( !(s17_evt1 != 0)))) || (( !(s25_evt2 != 0)) && (( !(s25_evt0 != 0)) && ( !(s25_evt1 != 0)))))) && ((( !(s18_evt2 != 0)) && (( !(s18_evt0 != 0)) && ( !(s18_evt1 != 0)))) || (( !(s19_evt2 != 0)) && (( !(s19_evt0 != 0)) && ( !(s19_evt1 != 0)))))) && ((( !(s18_evt2 != 0)) && (( !(s18_evt0 != 0)) && ( !(s18_evt1 != 0)))) || (( !(s20_evt2 != 0)) && (( !(s20_evt0 != 0)) && ( !(s20_evt1 != 0)))))) && ((( !(s18_evt2 != 0)) && (( !(s18_evt0 != 0)) && ( !(s18_evt1 != 0)))) || (( !(s21_evt2 != 0)) && (( !(s21_evt0 != 0)) && ( !(s21_evt1 != 0)))))) && ((( !(s18_evt2 != 0)) && (( !(s18_evt0 != 0)) && ( !(s18_evt1 != 0)))) || (( !(s22_evt2 != 0)) && (( !(s22_evt0 != 0)) && ( !(s22_evt1 != 0)))))) && ((( !(s18_evt2 != 0)) && (( !(s18_evt0 != 0)) && ( !(s18_evt1 != 0)))) || (( !(s23_evt2 != 0)) && (( !(s23_evt0 != 0)) && ( !(s23_evt1 != 0)))))) && ((( !(s18_evt2 != 0)) && (( !(s18_evt0 != 0)) && ( !(s18_evt1 != 0)))) || (( !(s24_evt2 != 0)) && (( !(s24_evt0 != 0)) && ( !(s24_evt1 != 0)))))) && ((( !(s18_evt2 != 0)) && (( !(s18_evt0 != 0)) && ( !(s18_evt1 != 0)))) || (( !(s25_evt2 != 0)) && (( !(s25_evt0 != 0)) && ( !(s25_evt1 != 0)))))) && ((( !(s19_evt2 != 0)) && (( !(s19_evt0 != 0)) && ( !(s19_evt1 != 0)))) || (( !(s20_evt2 != 0)) && (( !(s20_evt0 != 0)) && ( !(s20_evt1 != 0)))))) && ((( !(s19_evt2 != 0)) && (( !(s19_evt0 != 0)) && ( !(s19_evt1 != 0)))) || (( !(s21_evt2 != 0)) && (( !(s21_evt0 != 0)) && ( !(s21_evt1 != 0)))))) && ((( !(s19_evt2 != 0)) && (( !(s19_evt0 != 0)) && ( !(s19_evt1 != 0)))) || (( !(s22_evt2 != 0)) && (( !(s22_evt0 != 0)) && ( !(s22_evt1 != 0)))))) && ((( !(s19_evt2 != 0)) && (( !(s19_evt0 != 0)) && ( !(s19_evt1 != 0)))) || (( !(s23_evt2 != 0)) && (( !(s23_evt0 != 0)) && ( !(s23_evt1 != 0)))))) && ((( !(s19_evt2 != 0)) && (( !(s19_evt0 != 0)) && ( !(s19_evt1 != 0)))) || (( !(s24_evt2 != 0)) && (( !(s24_evt0 != 0)) && ( !(s24_evt1 != 0)))))) && ((( !(s19_evt2 != 0)) && (( !(s19_evt0 != 0)) && ( !(s19_evt1 != 0)))) || (( !(s25_evt2 != 0)) && (( !(s25_evt0 != 0)) && ( !(s25_evt1 != 0)))))) && ((( !(s20_evt2 != 0)) && (( !(s20_evt0 != 0)) && ( !(s20_evt1 != 0)))) || (( !(s21_evt2 != 0)) && (( !(s21_evt0 != 0)) && ( !(s21_evt1 != 0)))))) && ((( !(s20_evt2 != 0)) && (( !(s20_evt0 != 0)) && ( !(s20_evt1 != 0)))) || (( !(s22_evt2 != 0)) && (( !(s22_evt0 != 0)) && ( !(s22_evt1 != 0)))))) && ((( !(s20_evt2 != 0)) && (( !(s20_evt0 != 0)) && ( !(s20_evt1 != 0)))) || (( !(s23_evt2 != 0)) && (( !(s23_evt0 != 0)) && ( !(s23_evt1 != 0)))))) && ((( !(s20_evt2 != 0)) && (( !(s20_evt0 != 0)) && ( !(s20_evt1 != 0)))) || (( !(s24_evt2 != 0)) && (( !(s24_evt0 != 0)) && ( !(s24_evt1 != 0)))))) && ((( !(s20_evt2 != 0)) && (( !(s20_evt0 != 0)) && ( !(s20_evt1 != 0)))) || (( !(s25_evt2 != 0)) && (( !(s25_evt0 != 0)) && ( !(s25_evt1 != 0)))))) && ((( !(s21_evt2 != 0)) && (( !(s21_evt0 != 0)) && ( !(s21_evt1 != 0)))) || (( !(s22_evt2 != 0)) && (( !(s22_evt0 != 0)) && ( !(s22_evt1 != 0)))))) && ((( !(s21_evt2 != 0)) && (( !(s21_evt0 != 0)) && ( !(s21_evt1 != 0)))) || (( !(s23_evt2 != 0)) && (( !(s23_evt0 != 0)) && ( !(s23_evt1 != 0)))))) && ((( !(s21_evt2 != 0)) && (( !(s21_evt0 != 0)) && ( !(s21_evt1 != 0)))) || (( !(s24_evt2 != 0)) && (( !(s24_evt0 != 0)) && ( !(s24_evt1 != 0)))))) && ((( !(s21_evt2 != 0)) && (( !(s21_evt0 != 0)) && ( !(s21_evt1 != 0)))) || (( !(s25_evt2 != 0)) && (( !(s25_evt0 != 0)) && ( !(s25_evt1 != 0)))))) && ((( !(s22_evt2 != 0)) && (( !(s22_evt0 != 0)) && ( !(s22_evt1 != 0)))) || (( !(s23_evt2 != 0)) && (( !(s23_evt0 != 0)) && ( !(s23_evt1 != 0)))))) && ((( !(s22_evt2 != 0)) && (( !(s22_evt0 != 0)) && ( !(s22_evt1 != 0)))) || (( !(s24_evt2 != 0)) && (( !(s24_evt0 != 0)) && ( !(s24_evt1 != 0)))))) && ((( !(s22_evt2 != 0)) && (( !(s22_evt0 != 0)) && ( !(s22_evt1 != 0)))) || (( !(s25_evt2 != 0)) && (( !(s25_evt0 != 0)) && ( !(s25_evt1 != 0)))))) && ((( !(s23_evt2 != 0)) && (( !(s23_evt0 != 0)) && ( !(s23_evt1 != 0)))) || (( !(s24_evt2 != 0)) && (( !(s24_evt0 != 0)) && ( !(s24_evt1 != 0)))))) && ((( !(s23_evt2 != 0)) && (( !(s23_evt0 != 0)) && ( !(s23_evt1 != 0)))) || (( !(s25_evt2 != 0)) && (( !(s25_evt0 != 0)) && ( !(s25_evt1 != 0)))))) && ((( !(s24_evt2 != 0)) && (( !(s24_evt0 != 0)) && ( !(s24_evt1 != 0)))) || (( !(s25_evt2 != 0)) && (( !(s25_evt0 != 0)) && ( !(s25_evt1 != 0)))))) || ( !(delta == 0.0)))) && (( !(delta == 0.0)) || (( !(( !(s25_evt2 != 0)) && (( !(s25_evt0 != 0)) && ( !(s25_evt1 != 0))))) || (( !(( !(s24_evt2 != 0)) && (( !(s24_evt0 != 0)) && ( !(s24_evt1 != 0))))) || (( !(( !(s23_evt2 != 0)) && (( !(s23_evt0 != 0)) && ( !(s23_evt1 != 0))))) || (( !(( !(s22_evt2 != 0)) && (( !(s22_evt0 != 0)) && ( !(s22_evt1 != 0))))) || (( !(( !(s21_evt2 != 0)) && (( !(s21_evt0 != 0)) && ( !(s21_evt1 != 0))))) || (( !(( !(s20_evt2 != 0)) && (( !(s20_evt0 != 0)) && ( !(s20_evt1 != 0))))) || (( !(( !(s19_evt2 != 0)) && (( !(s19_evt0 != 0)) && ( !(s19_evt1 != 0))))) || (( !(( !(s18_evt2 != 0)) && (( !(s18_evt0 != 0)) && ( !(s18_evt1 != 0))))) || (( !(( !(s17_evt2 != 0)) && (( !(s17_evt0 != 0)) && ( !(s17_evt1 != 0))))) || (( !(( !(s16_evt2 != 0)) && (( !(s16_evt0 != 0)) && ( !(s16_evt1 != 0))))) || (( !(( !(s15_evt2 != 0)) && (( !(s15_evt0 != 0)) && ( !(s15_evt1 != 0))))) || (( !(( !(s14_evt2 != 0)) && (( !(s14_evt0 != 0)) && ( !(s14_evt1 != 0))))) || (( !(( !(s13_evt2 != 0)) && (( !(s13_evt0 != 0)) && ( !(s13_evt1 != 0))))) || (( !(( !(s12_evt2 != 0)) && (( !(s12_evt0 != 0)) && ( !(s12_evt1 != 0))))) || (( !(( !(s11_evt2 != 0)) && (( !(s11_evt0 != 0)) && ( !(s11_evt1 != 0))))) || (( !(( !(s10_evt2 != 0)) && (( !(s10_evt0 != 0)) && ( !(s10_evt1 != 0))))) || (( !(( !(s9_evt2 != 0)) && (( !(s9_evt0 != 0)) && ( !(s9_evt1 != 0))))) || (( !(( !(s8_evt2 != 0)) && (( !(s8_evt0 != 0)) && ( !(s8_evt1 != 0))))) || (( !(( !(s7_evt2 != 0)) && (( !(s7_evt0 != 0)) && ( !(s7_evt1 != 0))))) || (( !(( !(s6_evt2 != 0)) && (( !(s6_evt0 != 0)) && ( !(s6_evt1 != 0))))) || (( !(( !(s5_evt2 != 0)) && (( !(s5_evt0 != 0)) && ( !(s5_evt1 != 0))))) || (( !(( !(s4_evt2 != 0)) && (( !(s4_evt0 != 0)) && ( !(s4_evt1 != 0))))) || (( !(( !(s3_evt2 != 0)) && (( !(s3_evt0 != 0)) && ( !(s3_evt1 != 0))))) || (( !(( !(s2_evt2 != 0)) && (( !(s2_evt0 != 0)) && ( !(s2_evt1 != 0))))) || (( !(( !(s1_evt2 != 0)) && (( !(s1_evt0 != 0)) && ( !(s1_evt1 != 0))))) || (( !(( !(bus_evt2 != 0)) && (( !(bus_evt0 != 0)) && ( !(bus_evt1 != 0))))) || ( !(( !(s0_evt2 != 0)) && (( !(s0_evt0 != 0)) && ( !(s0_evt1 != 0))))))))))))))))))))))))))))))))) && (( !(delta == 0.0)) || (((((bus_evt2 != 0) && (( !(bus_evt0 != 0)) && ( !(bus_evt1 != 0)))) == (((s25_evt2 != 0) && (( !(s25_evt0 != 0)) && ( !(s25_evt1 != 0)))) || (((s24_evt2 != 0) && (( !(s24_evt0 != 0)) && ( !(s24_evt1 != 0)))) || (((s23_evt2 != 0) && (( !(s23_evt0 != 0)) && ( !(s23_evt1 != 0)))) || (((s22_evt2 != 0) && (( !(s22_evt0 != 0)) && ( !(s22_evt1 != 0)))) || (((s21_evt2 != 0) && (( !(s21_evt0 != 0)) && ( !(s21_evt1 != 0)))) || (((s20_evt2 != 0) && (( !(s20_evt0 != 0)) && ( !(s20_evt1 != 0)))) || (((s19_evt2 != 0) && (( !(s19_evt0 != 0)) && ( !(s19_evt1 != 0)))) || (((s18_evt2 != 0) && (( !(s18_evt0 != 0)) && ( !(s18_evt1 != 0)))) || (((s17_evt2 != 0) && (( !(s17_evt0 != 0)) && ( !(s17_evt1 != 0)))) || (((s16_evt2 != 0) && (( !(s16_evt0 != 0)) && ( !(s16_evt1 != 0)))) || (((s15_evt2 != 0) && (( !(s15_evt0 != 0)) && ( !(s15_evt1 != 0)))) || (((s14_evt2 != 0) && (( !(s14_evt0 != 0)) && ( !(s14_evt1 != 0)))) || (((s13_evt2 != 0) && (( !(s13_evt0 != 0)) && ( !(s13_evt1 != 0)))) || (((s12_evt2 != 0) && (( !(s12_evt0 != 0)) && ( !(s12_evt1 != 0)))) || (((s11_evt2 != 0) && (( !(s11_evt0 != 0)) && ( !(s11_evt1 != 0)))) || (((s10_evt2 != 0) && (( !(s10_evt0 != 0)) && ( !(s10_evt1 != 0)))) || (((s9_evt2 != 0) && (( !(s9_evt0 != 0)) && ( !(s9_evt1 != 0)))) || (((s8_evt2 != 0) && (( !(s8_evt0 != 0)) && ( !(s8_evt1 != 0)))) || (((s7_evt2 != 0) && (( !(s7_evt0 != 0)) && ( !(s7_evt1 != 0)))) || (((s6_evt2 != 0) && (( !(s6_evt0 != 0)) && ( !(s6_evt1 != 0)))) || (((s5_evt2 != 0) && (( !(s5_evt0 != 0)) && ( !(s5_evt1 != 0)))) || (((s4_evt2 != 0) && (( !(s4_evt0 != 0)) && ( !(s4_evt1 != 0)))) || (((s3_evt2 != 0) && (( !(s3_evt0 != 0)) && ( !(s3_evt1 != 0)))) || (((s2_evt2 != 0) && (( !(s2_evt0 != 0)) && ( !(s2_evt1 != 0)))) || (((s0_evt2 != 0) && (( !(s0_evt0 != 0)) && ( !(s0_evt1 != 0)))) || ((s1_evt2 != 0) && (( !(s1_evt0 != 0)) && ( !(s1_evt1 != 0)))))))))))))))))))))))))))))) && ((( !(bus_evt2 != 0)) && ((bus_evt1 != 0) && ( !(bus_evt0 != 0)))) == ((( !(s25_evt2 != 0)) && ((s25_evt1 != 0) && ( !(s25_evt0 != 0)))) || ((( !(s24_evt2 != 0)) && ((s24_evt1 != 0) && ( !(s24_evt0 != 0)))) || ((( !(s23_evt2 != 0)) && ((s23_evt1 != 0) && ( !(s23_evt0 != 0)))) || ((( !(s22_evt2 != 0)) && ((s22_evt1 != 0) && ( !(s22_evt0 != 0)))) || ((( !(s21_evt2 != 0)) && ((s21_evt1 != 0) && ( !(s21_evt0 != 0)))) || ((( !(s20_evt2 != 0)) && ((s20_evt1 != 0) && ( !(s20_evt0 != 0)))) || ((( !(s19_evt2 != 0)) && ((s19_evt1 != 0) && ( !(s19_evt0 != 0)))) || ((( !(s18_evt2 != 0)) && ((s18_evt1 != 0) && ( !(s18_evt0 != 0)))) || ((( !(s17_evt2 != 0)) && ((s17_evt1 != 0) && ( !(s17_evt0 != 0)))) || ((( !(s16_evt2 != 0)) && ((s16_evt1 != 0) && ( !(s16_evt0 != 0)))) || ((( !(s15_evt2 != 0)) && ((s15_evt1 != 0) && ( !(s15_evt0 != 0)))) || ((( !(s14_evt2 != 0)) && ((s14_evt1 != 0) && ( !(s14_evt0 != 0)))) || ((( !(s13_evt2 != 0)) && ((s13_evt1 != 0) && ( !(s13_evt0 != 0)))) || ((( !(s12_evt2 != 0)) && ((s12_evt1 != 0) && ( !(s12_evt0 != 0)))) || ((( !(s11_evt2 != 0)) && ((s11_evt1 != 0) && ( !(s11_evt0 != 0)))) || ((( !(s10_evt2 != 0)) && ((s10_evt1 != 0) && ( !(s10_evt0 != 0)))) || ((( !(s9_evt2 != 0)) && ((s9_evt1 != 0) && ( !(s9_evt0 != 0)))) || ((( !(s8_evt2 != 0)) && ((s8_evt1 != 0) && ( !(s8_evt0 != 0)))) || ((( !(s7_evt2 != 0)) && ((s7_evt1 != 0) && ( !(s7_evt0 != 0)))) || ((( !(s6_evt2 != 0)) && ((s6_evt1 != 0) && ( !(s6_evt0 != 0)))) || ((( !(s5_evt2 != 0)) && ((s5_evt1 != 0) && ( !(s5_evt0 != 0)))) || ((( !(s4_evt2 != 0)) && ((s4_evt1 != 0) && ( !(s4_evt0 != 0)))) || ((( !(s3_evt2 != 0)) && ((s3_evt1 != 0) && ( !(s3_evt0 != 0)))) || ((( !(s2_evt2 != 0)) && ((s2_evt1 != 0) && ( !(s2_evt0 != 0)))) || ((( !(s0_evt2 != 0)) && ((s0_evt1 != 0) && ( !(s0_evt0 != 0)))) || (( !(s1_evt2 != 0)) && ((s1_evt1 != 0) && ( !(s1_evt0 != 0))))))))))))))))))))))))))))))) && ((((bus_evt2 != 0) && ((bus_evt1 != 0) && ( !(bus_evt0 != 0)))) == (((s25_evt2 != 0) && ((s25_evt1 != 0) && ( !(s25_evt0 != 0)))) || (((s24_evt2 != 0) && ((s24_evt1 != 0) && ( !(s24_evt0 != 0)))) || (((s23_evt2 != 0) && ((s23_evt1 != 0) && ( !(s23_evt0 != 0)))) || (((s22_evt2 != 0) && ((s22_evt1 != 0) && ( !(s22_evt0 != 0)))) || (((s21_evt2 != 0) && ((s21_evt1 != 0) && ( !(s21_evt0 != 0)))) || (((s20_evt2 != 0) && ((s20_evt1 != 0) && ( !(s20_evt0 != 0)))) || (((s19_evt2 != 0) && ((s19_evt1 != 0) && ( !(s19_evt0 != 0)))) || (((s18_evt2 != 0) && ((s18_evt1 != 0) && ( !(s18_evt0 != 0)))) || (((s17_evt2 != 0) && ((s17_evt1 != 0) && ( !(s17_evt0 != 0)))) || (((s16_evt2 != 0) && ((s16_evt1 != 0) && ( !(s16_evt0 != 0)))) || (((s15_evt2 != 0) && ((s15_evt1 != 0) && ( !(s15_evt0 != 0)))) || (((s14_evt2 != 0) && ((s14_evt1 != 0) && ( !(s14_evt0 != 0)))) || (((s13_evt2 != 0) && ((s13_evt1 != 0) && ( !(s13_evt0 != 0)))) || (((s12_evt2 != 0) && ((s12_evt1 != 0) && ( !(s12_evt0 != 0)))) || (((s11_evt2 != 0) && ((s11_evt1 != 0) && ( !(s11_evt0 != 0)))) || (((s10_evt2 != 0) && ((s10_evt1 != 0) && ( !(s10_evt0 != 0)))) || (((s9_evt2 != 0) && ((s9_evt1 != 0) && ( !(s9_evt0 != 0)))) || (((s8_evt2 != 0) && ((s8_evt1 != 0) && ( !(s8_evt0 != 0)))) || (((s7_evt2 != 0) && ((s7_evt1 != 0) && ( !(s7_evt0 != 0)))) || (((s6_evt2 != 0) && ((s6_evt1 != 0) && ( !(s6_evt0 != 0)))) || (((s5_evt2 != 0) && ((s5_evt1 != 0) && ( !(s5_evt0 != 0)))) || (((s4_evt2 != 0) && ((s4_evt1 != 0) && ( !(s4_evt0 != 0)))) || (((s3_evt2 != 0) && ((s3_evt1 != 0) && ( !(s3_evt0 != 0)))) || (((s2_evt2 != 0) && ((s2_evt1 != 0) && ( !(s2_evt0 != 0)))) || (((s0_evt2 != 0) && ((s0_evt1 != 0) && ( !(s0_evt0 != 0)))) || ((s1_evt2 != 0) && ((s1_evt1 != 0) && ( !(s1_evt0 != 0)))))))))))))))))))))))))))))) && ((( !(bus_evt2 != 0)) && ((bus_evt0 != 0) && ( !(bus_evt1 != 0)))) == ((( !(s25_evt2 != 0)) && ((s25_evt0 != 0) && ( !(s25_evt1 != 0)))) || ((( !(s24_evt2 != 0)) && ((s24_evt0 != 0) && ( !(s24_evt1 != 0)))) || ((( !(s23_evt2 != 0)) && ((s23_evt0 != 0) && ( !(s23_evt1 != 0)))) || ((( !(s22_evt2 != 0)) && ((s22_evt0 != 0) && ( !(s22_evt1 != 0)))) || ((( !(s21_evt2 != 0)) && ((s21_evt0 != 0) && ( !(s21_evt1 != 0)))) || ((( !(s20_evt2 != 0)) && ((s20_evt0 != 0) && ( !(s20_evt1 != 0)))) || ((( !(s19_evt2 != 0)) && ((s19_evt0 != 0) && ( !(s19_evt1 != 0)))) || ((( !(s18_evt2 != 0)) && ((s18_evt0 != 0) && ( !(s18_evt1 != 0)))) || ((( !(s17_evt2 != 0)) && ((s17_evt0 != 0) && ( !(s17_evt1 != 0)))) || ((( !(s16_evt2 != 0)) && ((s16_evt0 != 0) && ( !(s16_evt1 != 0)))) || ((( !(s15_evt2 != 0)) && ((s15_evt0 != 0) && ( !(s15_evt1 != 0)))) || ((( !(s14_evt2 != 0)) && ((s14_evt0 != 0) && ( !(s14_evt1 != 0)))) || ((( !(s13_evt2 != 0)) && ((s13_evt0 != 0) && ( !(s13_evt1 != 0)))) || ((( !(s12_evt2 != 0)) && ((s12_evt0 != 0) && ( !(s12_evt1 != 0)))) || ((( !(s11_evt2 != 0)) && ((s11_evt0 != 0) && ( !(s11_evt1 != 0)))) || ((( !(s10_evt2 != 0)) && ((s10_evt0 != 0) && ( !(s10_evt1 != 0)))) || ((( !(s9_evt2 != 0)) && ((s9_evt0 != 0) && ( !(s9_evt1 != 0)))) || ((( !(s8_evt2 != 0)) && ((s8_evt0 != 0) && ( !(s8_evt1 != 0)))) || ((( !(s7_evt2 != 0)) && ((s7_evt0 != 0) && ( !(s7_evt1 != 0)))) || ((( !(s6_evt2 != 0)) && ((s6_evt0 != 0) && ( !(s6_evt1 != 0)))) || ((( !(s5_evt2 != 0)) && ((s5_evt0 != 0) && ( !(s5_evt1 != 0)))) || ((( !(s4_evt2 != 0)) && ((s4_evt0 != 0) && ( !(s4_evt1 != 0)))) || ((( !(s3_evt2 != 0)) && ((s3_evt0 != 0) && ( !(s3_evt1 != 0)))) || ((( !(s2_evt2 != 0)) && ((s2_evt0 != 0) && ( !(s2_evt1 != 0)))) || ((( !(s0_evt2 != 0)) && ((s0_evt0 != 0) && ( !(s0_evt1 != 0)))) || (( !(s1_evt2 != 0)) && ((s1_evt0 != 0) && ( !(s1_evt1 != 0)))))))))))))))))))))))))))))))))) && (( !(delta == 0.0)) || (((((((((((((((((((((((((((( !(s0_evt2 != 0)) && ((s0_evt0 != 0) && ( !(s0_evt1 != 0)))) == ((( !(bus_evt2 != 0)) && ((bus_evt0 != 0) && ( !(bus_evt1 != 0)))) && (bus_cd_id == 0))) && ((( !(s1_evt2 != 0)) && ((s1_evt0 != 0) && ( !(s1_evt1 != 0)))) == ((( !(bus_evt2 != 0)) && ((bus_evt0 != 0) && ( !(bus_evt1 != 0)))) && (bus_cd_id == 1)))) && ((( !(s2_evt2 != 0)) && ((s2_evt0 != 0) && ( !(s2_evt1 != 0)))) == ((( !(bus_evt2 != 0)) && ((bus_evt0 != 0) && ( !(bus_evt1 != 0)))) && (bus_cd_id == 2)))) && ((( !(s3_evt2 != 0)) && ((s3_evt0 != 0) && ( !(s3_evt1 != 0)))) == ((( !(bus_evt2 != 0)) && ((bus_evt0 != 0) && ( !(bus_evt1 != 0)))) && (bus_cd_id == 3)))) && ((( !(s4_evt2 != 0)) && ((s4_evt0 != 0) && ( !(s4_evt1 != 0)))) == ((( !(bus_evt2 != 0)) && ((bus_evt0 != 0) && ( !(bus_evt1 != 0)))) && (bus_cd_id == 4)))) && ((( !(s5_evt2 != 0)) && ((s5_evt0 != 0) && ( !(s5_evt1 != 0)))) == ((( !(bus_evt2 != 0)) && ((bus_evt0 != 0) && ( !(bus_evt1 != 0)))) && (bus_cd_id == 5)))) && ((( !(s6_evt2 != 0)) && ((s6_evt0 != 0) && ( !(s6_evt1 != 0)))) == ((( !(bus_evt2 != 0)) && ((bus_evt0 != 0) && ( !(bus_evt1 != 0)))) && (bus_cd_id == 6)))) && ((( !(s7_evt2 != 0)) && ((s7_evt0 != 0) && ( !(s7_evt1 != 0)))) == ((( !(bus_evt2 != 0)) && ((bus_evt0 != 0) && ( !(bus_evt1 != 0)))) && (bus_cd_id == 7)))) && ((( !(s8_evt2 != 0)) && ((s8_evt0 != 0) && ( !(s8_evt1 != 0)))) == ((( !(bus_evt2 != 0)) && ((bus_evt0 != 0) && ( !(bus_evt1 != 0)))) && (bus_cd_id == 8)))) && ((( !(s9_evt2 != 0)) && ((s9_evt0 != 0) && ( !(s9_evt1 != 0)))) == ((( !(bus_evt2 != 0)) && ((bus_evt0 != 0) && ( !(bus_evt1 != 0)))) && (bus_cd_id == 9)))) && ((( !(s10_evt2 != 0)) && ((s10_evt0 != 0) && ( !(s10_evt1 != 0)))) == ((( !(bus_evt2 != 0)) && ((bus_evt0 != 0) && ( !(bus_evt1 != 0)))) && (bus_cd_id == 10)))) && ((( !(s11_evt2 != 0)) && ((s11_evt0 != 0) && ( !(s11_evt1 != 0)))) == ((( !(bus_evt2 != 0)) && ((bus_evt0 != 0) && ( !(bus_evt1 != 0)))) && (bus_cd_id == 11)))) && ((( !(s12_evt2 != 0)) && ((s12_evt0 != 0) && ( !(s12_evt1 != 0)))) == ((( !(bus_evt2 != 0)) && ((bus_evt0 != 0) && ( !(bus_evt1 != 0)))) && (bus_cd_id == 12)))) && ((( !(s13_evt2 != 0)) && ((s13_evt0 != 0) && ( !(s13_evt1 != 0)))) == ((( !(bus_evt2 != 0)) && ((bus_evt0 != 0) && ( !(bus_evt1 != 0)))) && (bus_cd_id == 13)))) && ((( !(s14_evt2 != 0)) && ((s14_evt0 != 0) && ( !(s14_evt1 != 0)))) == ((( !(bus_evt2 != 0)) && ((bus_evt0 != 0) && ( !(bus_evt1 != 0)))) && (bus_cd_id == 14)))) && ((( !(s15_evt2 != 0)) && ((s15_evt0 != 0) && ( !(s15_evt1 != 0)))) == ((( !(bus_evt2 != 0)) && ((bus_evt0 != 0) && ( !(bus_evt1 != 0)))) && (bus_cd_id == 15)))) && ((( !(s16_evt2 != 0)) && ((s16_evt0 != 0) && ( !(s16_evt1 != 0)))) == ((( !(bus_evt2 != 0)) && ((bus_evt0 != 0) && ( !(bus_evt1 != 0)))) && (bus_cd_id == 16)))) && ((( !(s17_evt2 != 0)) && ((s17_evt0 != 0) && ( !(s17_evt1 != 0)))) == ((( !(bus_evt2 != 0)) && ((bus_evt0 != 0) && ( !(bus_evt1 != 0)))) && (bus_cd_id == 17)))) && ((( !(s18_evt2 != 0)) && ((s18_evt0 != 0) && ( !(s18_evt1 != 0)))) == ((( !(bus_evt2 != 0)) && ((bus_evt0 != 0) && ( !(bus_evt1 != 0)))) && (bus_cd_id == 18)))) && ((( !(s19_evt2 != 0)) && ((s19_evt0 != 0) && ( !(s19_evt1 != 0)))) == ((( !(bus_evt2 != 0)) && ((bus_evt0 != 0) && ( !(bus_evt1 != 0)))) && (bus_cd_id == 19)))) && ((( !(s20_evt2 != 0)) && ((s20_evt0 != 0) && ( !(s20_evt1 != 0)))) == ((( !(bus_evt2 != 0)) && ((bus_evt0 != 0) && ( !(bus_evt1 != 0)))) && (bus_cd_id == 20)))) && ((( !(s21_evt2 != 0)) && ((s21_evt0 != 0) && ( !(s21_evt1 != 0)))) == ((( !(bus_evt2 != 0)) && ((bus_evt0 != 0) && ( !(bus_evt1 != 0)))) && (bus_cd_id == 21)))) && ((( !(s22_evt2 != 0)) && ((s22_evt0 != 0) && ( !(s22_evt1 != 0)))) == ((( !(bus_evt2 != 0)) && ((bus_evt0 != 0) && ( !(bus_evt1 != 0)))) && (bus_cd_id == 22)))) && ((( !(s23_evt2 != 0)) && ((s23_evt0 != 0) && ( !(s23_evt1 != 0)))) == ((( !(bus_evt2 != 0)) && ((bus_evt0 != 0) && ( !(bus_evt1 != 0)))) && (bus_cd_id == 23)))) && ((( !(s24_evt2 != 0)) && ((s24_evt0 != 0) && ( !(s24_evt1 != 0)))) == ((( !(bus_evt2 != 0)) && ((bus_evt0 != 0) && ( !(bus_evt1 != 0)))) && (bus_cd_id == 24)))) && ((( !(s25_evt2 != 0)) && ((s25_evt0 != 0) && ( !(s25_evt1 != 0)))) == ((( !(bus_evt2 != 0)) && ((bus_evt0 != 0) && ( !(bus_evt1 != 0)))) && (bus_cd_id == 25)))))) && (((delta == _x__diverge_delta) || ( !(1.0 <= _diverge_delta))) && ((1.0 <= _diverge_delta) || ((delta + (_diverge_delta + (-1.0 * _x__diverge_delta))) == 0.0))));
_diverge_delta = _x__diverge_delta;
s25_l0 = _x_s25_l0;
s25_evt1 = _x_s25_evt1;
s25_evt0 = _x_s25_evt0;
s25_x = _x_s25_x;
s24_l1 = _x_s24_l1;
s24_l0 = _x_s24_l0;
s24_evt2 = _x_s24_evt2;
s24_evt1 = _x_s24_evt1;
s24_evt0 = _x_s24_evt0;
s24_x = _x_s24_x;
s23_l1 = _x_s23_l1;
s23_l0 = _x_s23_l0;
s23_evt2 = _x_s23_evt2;
s23_evt1 = _x_s23_evt1;
s23_evt0 = _x_s23_evt0;
s23_x = _x_s23_x;
s25_backoff = _x_s25_backoff;
s22_l1 = _x_s22_l1;
s25_lambda = _x_s25_lambda;
s22_l0 = _x_s22_l0;
s22_evt2 = _x_s22_evt2;
s22_evt1 = _x_s22_evt1;
s22_evt0 = _x_s22_evt0;
s22_x = _x_s22_x;
s24_backoff = _x_s24_backoff;
s21_l1 = _x_s21_l1;
s24_lambda = _x_s24_lambda;
s21_l0 = _x_s21_l0;
s21_evt2 = _x_s21_evt2;
s21_evt1 = _x_s21_evt1;
s21_evt0 = _x_s21_evt0;
s21_x = _x_s21_x;
s23_backoff = _x_s23_backoff;
s20_l1 = _x_s20_l1;
s23_lambda = _x_s23_lambda;
s20_l0 = _x_s20_l0;
s20_evt2 = _x_s20_evt2;
s20_evt1 = _x_s20_evt1;
s20_evt0 = _x_s20_evt0;
s20_x = _x_s20_x;
s19_x = _x_s19_x;
s21_backoff = _x_s21_backoff;
s18_l1 = _x_s18_l1;
s21_lambda = _x_s21_lambda;
s18_l0 = _x_s18_l0;
s18_evt2 = _x_s18_evt2;
s18_evt1 = _x_s18_evt1;
s18_evt0 = _x_s18_evt0;
s18_x = _x_s18_x;
s20_backoff = _x_s20_backoff;
s17_l1 = _x_s17_l1;
s20_lambda = _x_s20_lambda;
s17_l0 = _x_s17_l0;
s17_evt2 = _x_s17_evt2;
s17_evt1 = _x_s17_evt1;
s17_evt0 = _x_s17_evt0;
s17_x = _x_s17_x;
s16_evt2 = _x_s16_evt2;
s16_evt1 = _x_s16_evt1;
s16_evt0 = _x_s16_evt0;
s16_x = _x_s16_x;
s18_backoff = _x_s18_backoff;
s15_l1 = _x_s15_l1;
s18_lambda = _x_s18_lambda;
s15_l0 = _x_s15_l0;
s15_evt2 = _x_s15_evt2;
s15_evt1 = _x_s15_evt1;
s15_evt0 = _x_s15_evt0;
s15_x = _x_s15_x;
s17_backoff = _x_s17_backoff;
s14_l1 = _x_s14_l1;
s17_lambda = _x_s17_lambda;
s14_l0 = _x_s14_l0;
s4_evt0 = _x_s4_evt0;
s16_backoff = _x_s16_backoff;
s13_l1 = _x_s13_l1;
s4_x = _x_s4_x;
s19_evt2 = _x_s19_evt2;
bus_evt2 = _x_bus_evt2;
s3_evt0 = _x_s3_evt0;
s15_backoff = _x_s15_backoff;
s12_l1 = _x_s12_l1;
s3_x = _x_s3_x;
s5_evt2 = _x_s5_evt2;
s5_evt1 = _x_s5_evt1;
s2_evt2 = _x_s2_evt2;
s3_l1 = _x_s3_l1;
s6_backoff = _x_s6_backoff;
s2_evt1 = _x_s2_evt1;
s14_x = _x_s14_x;
s0_lambda = _x_s0_lambda;
s22_lambda = _x_s22_lambda;
s19_l0 = _x_s19_l0;
bus_l0 = _x_bus_l0;
s5_x = _x_s5_x;
s0_backoff = _x_s0_backoff;
s25_evt2 = _x_s25_evt2;
s0_x = _x_s0_x;
s14_evt2 = _x_s14_evt2;
s2_evt0 = _x_s2_evt0;
s4_evt1 = _x_s4_evt1;
s19_evt0 = _x_s19_evt0;
bus_evt0 = _x_bus_evt0;
s19_evt1 = _x_s19_evt1;
bus_evt1 = _x_bus_evt1;
s1_l0 = _x_s1_l0;
s4_lambda = _x_s4_lambda;
s0_evt0 = _x_s0_evt0;
s19_lambda = _x_s19_lambda;
s16_l0 = _x_s16_l0;
bus_cd_id = _x_bus_cd_id;
s6_evt2 = _x_s6_evt2;
s1_l1 = _x_s1_l1;
s4_backoff = _x_s4_backoff;
s0_evt1 = _x_s0_evt1;
s12_x = _x_s12_x;
s15_lambda = _x_s15_lambda;
s12_l0 = _x_s12_l0;
s19_backoff = _x_s19_backoff;
s16_l1 = _x_s16_l1;
bus_j = _x_bus_j;
s5_evt0 = _x_s5_evt0;
s0_evt2 = _x_s0_evt2;
s25_l1 = _x_s25_l1;
delta = _x_delta;
s4_l1 = _x_s4_l1;
s7_backoff = _x_s7_backoff;
s3_evt1 = _x_s3_evt1;
s3_lambda = _x_s3_lambda;
s0_l0 = _x_s0_l0;
s2_lambda = _x_s2_lambda;
s3_evt2 = _x_s3_evt2;
s3_backoff = _x_s3_backoff;
s0_l1 = _x_s0_l1;
s2_backoff = _x_s2_backoff;
s1_x = _x_s1_x;
s6_x = _x_s6_x;
s1_backoff = _x_s1_backoff;
s1_lambda = _x_s1_lambda;
s2_l0 = _x_s2_l0;
s5_lambda = _x_s5_lambda;
s1_evt0 = _x_s1_evt0;
s2_l1 = _x_s2_l1;
s5_backoff = _x_s5_backoff;
s1_evt1 = _x_s1_evt1;
s13_x = _x_s13_x;
s1_evt2 = _x_s1_evt2;
s4_evt2 = _x_s4_evt2;
s22_backoff = _x_s22_backoff;
s19_l1 = _x_s19_l1;
bus_l1 = _x_bus_l1;
s9_evt0 = _x_s9_evt0;
s2_x = _x_s2_x;
s3_l0 = _x_s3_l0;
s6_lambda = _x_s6_lambda;
s6_evt0 = _x_s6_evt0;
s6_evt1 = _x_s6_evt1;
s7_x = _x_s7_x;
s4_l0 = _x_s4_l0;
s7_lambda = _x_s7_lambda;
s7_evt0 = _x_s7_evt0;
s7_evt1 = _x_s7_evt1;
s7_evt2 = _x_s7_evt2;
s8_x = _x_s8_x;
s5_l1 = _x_s5_l1;
s8_backoff = _x_s8_backoff;
s5_l0 = _x_s5_l0;
s8_lambda = _x_s8_lambda;
s8_evt0 = _x_s8_evt0;
s8_evt1 = _x_s8_evt1;
s8_evt2 = _x_s8_evt2;
s9_x = _x_s9_x;
s6_l1 = _x_s6_l1;
s9_backoff = _x_s9_backoff;
s6_l0 = _x_s6_l0;
s9_lambda = _x_s9_lambda;
s9_evt1 = _x_s9_evt1;
s9_evt2 = _x_s9_evt2;
s12_lambda = _x_s12_lambda;
s9_l0 = _x_s9_l0;
s10_x = _x_s10_x;
s7_l1 = _x_s7_l1;
s10_backoff = _x_s10_backoff;
s7_l0 = _x_s7_l0;
s10_lambda = _x_s10_lambda;
bus_x = _x_bus_x;
s10_evt0 = _x_s10_evt0;
s10_evt1 = _x_s10_evt1;
s10_evt2 = _x_s10_evt2;
s13_lambda = _x_s13_lambda;
s10_l0 = _x_s10_l0;
s11_x = _x_s11_x;
s8_l1 = _x_s8_l1;
s11_backoff = _x_s11_backoff;
s8_l0 = _x_s8_l0;
s11_lambda = _x_s11_lambda;
s11_evt0 = _x_s11_evt0;
s11_evt1 = _x_s11_evt1;
s11_evt2 = _x_s11_evt2;
s14_lambda = _x_s14_lambda;
s11_l0 = _x_s11_l0;
s9_l1 = _x_s9_l1;
s12_backoff = _x_s12_backoff;
s12_evt0 = _x_s12_evt0;
s12_evt1 = _x_s12_evt1;
s12_evt2 = _x_s12_evt2;
s10_l1 = _x_s10_l1;
s13_backoff = _x_s13_backoff;
s13_evt0 = _x_s13_evt0;
s13_evt1 = _x_s13_evt1;
s13_evt2 = _x_s13_evt2;
s16_lambda = _x_s16_lambda;
s13_l0 = _x_s13_l0;
s11_l1 = _x_s11_l1;
s14_backoff = _x_s14_backoff;
s14_evt0 = _x_s14_evt0;
s14_evt1 = _x_s14_evt1;
}
}
|
the_stack_data/24444.c | #include <stdlib.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
int *n = (int *) malloc((sizeof (int)));
int l = 1;
int an;
int maior = 0;
printf("Digite números... (para parar digite um >= 1000)\n");
while (1) {
scanf("%i", &an);
// fazendo checagem
if (an>=1000)
break;
// adicionando item ao vetor
n = realloc(n, (sizeof (int))*l);
n[l-1] = an;
l ++;
// maior numero
if (maior < an)
maior = an;
};
// menor e media
int soma = 0;
int menor = maior;
for (int i = 0; i < l-1; ++i) {
if (n[i] < menor)
menor = n[i];
soma += n[i];
}
float media = (float) soma / (float) (l-1);
printf("=:%i <:%i >:%i /:%1.1f l:%i\n", soma,maior, menor, media, l-1 );
free(n);
return 0;
}
|
the_stack_data/43886863.c | /*程序5.7 分别用移动下标的方法和移动指针的方法实现输出数组的所有元素。
方法1:移动下标
*/
#include <stdio.h>
int main( )
{
int a[5]={1,2,3,4,5};
int i=0,*pa=a; //pa=&a[0]
while (i<5)
printf("%5d",pa[i++]); //移动下标
printf("\n");
return 0;
}
|
the_stack_data/179830949.c | #include <stdio.h>
int main() {
float i[4];
i[0] = 10;
i[1] = 15;
i[2] = 25;
i[3] = 30;
printf("$%.2f", i[1]);
return 0;
} |
the_stack_data/115477.c | #include <stdio.h>
#include <stdlib.h>
int calcular() {
/*printf("%f\n", 5.9 * 8.7);
printf("%f\n", pow(2,3));
printf("%f\n", sqrt(4));
printf("%f\n", ceil(5.89));
*/
printf("%f", floor(5.89));
return 0;
}
|
the_stack_data/132331.c | /*
* Derived from:
* http://www.kernel.org/pub/linux/libs/klibc/
*/
/*
* lrand48.c
*/
#include <stdlib.h>
#include <stdint.h>
unsigned short __rand48_seed[3]; /* Common with mrand48.c, srand48.c */
long lrand48(void)
{
return (uint32_t) jrand48(__rand48_seed) >> 1;
}
int rand(void)
{
return (int)lrand48();
}
long random(void)
{
return lrand48();
}
|
the_stack_data/198579781.c | #ifdef STM32F0xx
#include "stm32f0xx_hal_dma.c"
#endif
#ifdef STM32F1xx
#include "stm32f1xx_hal_dma.c"
#endif
#ifdef STM32F2xx
#include "stm32f2xx_hal_dma.c"
#endif
#ifdef STM32F3xx
#include "stm32f3xx_hal_dma.c"
#endif
#ifdef STM32F4xx
#include "stm32f4xx_hal_dma.c"
#endif
#ifdef STM32F7xx
#include "stm32f7xx_hal_dma.c"
#endif
#ifdef STM32G0xx
#include "stm32g0xx_hal_dma.c"
#endif
#ifdef STM32G4xx
#include "stm32g4xx_hal_dma.c"
#endif
#ifdef STM32H7xx
#include "stm32h7xx_hal_dma.c"
#endif
#ifdef STM32L0xx
#include "stm32l0xx_hal_dma.c"
#endif
#ifdef STM32L1xx
#include "stm32l1xx_hal_dma.c"
#endif
#ifdef STM32L4xx
#include "stm32l4xx_hal_dma.c"
#endif
#ifdef STM32MP1xx
#include "stm32mp1xx_hal_dma.c"
#endif
#ifdef STM32WBxx
#include "stm32wbxx_hal_dma.c"
#endif
|
the_stack_data/1082295.c | #ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#ifndef UINT8_MAX
#define UINT8_MAX 0xff
#endif
#ifndef INT8_MAX
#define INT8_MAX 0x7f
#endif
#ifndef UINT16_MAX
#define UINT16_MAX 0xffff
#endif
#ifndef INT16_MAX
#define INT16_MAX 0x7fff
#endif
#ifndef UINT32_MAX
#define UINT32_MAX 0xffffffff
#endif
#ifndef INT32_MAX
#define INT32_MAX 0x7fffffff
#endif
#ifndef UINT64_MAX
#define UINT64_MAX 0xffffffffffffffff
#endif
#ifndef INT64_MAX
#define INT64_MAX 0x7fffffffffffffff
#endif
/* builtin type defines */
typedef uint32_t Char;
typedef uint8_t Byte;
typedef uint8_t Bool;
enum Bool {
false = 0,
true = 1
};
typedef enum Return_Code {
OK = EXIT_SUCCESS,
ERR = EXIT_FAILURE,
FAIL = EXIT_FAILURE > EXIT_SUCCESS? EXIT_FAILURE + 1 : EXIT_SUCCESS + 1
} Return_Code;
typedef struct Ref_Manager {
size_t count;
void* value;
void* ref;
} Ref_Manager;
typedef struct String {
Byte* bytes;
uint32_t length;
} String;
typedef struct File {
FILE* fobj;
} File;
typedef File FileReadText;
typedef File FileReadBinary;
typedef File FileWriteText;
typedef File FileWriteBinary;
typedef File FileReadWriteText;
typedef File FileReadWriteBinary;
#define VAR_POINTER(type, name) \
type name##_Var; \
type* name = &name##_Var;
#define VAR_REFMAN(type, name) \
VAR_POINTER(type, name) \
VAR_POINTER(Ref_Manager, name##_Refman)
String* sys_M_argv = NULL;
uint32_t sys_M_argv_Length = 0;
VAR_POINTER(Ref_Manager, sys_M_argv_Refman)
VAR_REFMAN(File, sys_M_stdin)
VAR_REFMAN(File, sys_M_stdout)
VAR_REFMAN(File, sys_M_stderr)
typedef void* Ref;
typedef char cdef_M_Char;
typedef signed char cdef_M_Schar;
typedef unsigned char cdef_M_Uchar;
typedef short cdef_M_Short;
typedef unsigned short cdef_M_Ushort;
typedef int cdef_M_Int;
typedef unsigned int cdef_M_Uint;
typedef long cdef_M_Long;
typedef unsigned long cdef_M_Ulong;
typedef size_t cdef_M_Size;
typedef float cdef_M_Float;
typedef double cdef_M_Double;
typedef long double cdef_M_LongDouble;
typedef void (*Dynamic_Del)(void*, void*);
typedef void Generic_Type;
typedef struct Generic_Type_Dynamic { Dynamic_Del _del; } Generic_Type_Dynamic;
typedef long Line_Count;
typedef struct File_Coverage {
char const* filename;
Line_Count lines_number;
Line_Count* line_count;
} File_Coverage;
typedef struct Error_Message {
Byte* str;
unsigned length;
} Error_Message;
typedef struct Error_Messages {
Error_Message empty_object;
Error_Message outdated_weak_reference;
Error_Message object_memory;
Error_Message managed_object_memory;
Error_Message integer_overflow;
Error_Message slice_index;
Error_Message array_too_short;
Error_Message file_not_opened;
Error_Message file_read_failed;
Error_Message file_write_failed;
Error_Message zero_division;
Error_Message loop_limit;
} Error_Messages;
/* macros */
#define START_TRACE(line, cleanup, value, format, message, message_length) { \
LUMI_trace_print( \
format, \
LUMI_FILE_NAME, \
line, \
LUMI_FUNC_NAME, \
message, \
message_length); \
LUMI_err = value; \
LUMI_loop_depth = 0; \
goto cleanup; }
#define RAISE(line, cleanup, message) { \
START_TRACE( \
line, \
cleanup, \
ERR, \
LUMI_raise_format, \
LUMI_error_messages.message.str, \
LUMI_error_messages.message.length) }
#define USER_RAISE(line, cleanup, message, message_length) \
START_TRACE( \
line, \
cleanup, \
ERR, \
LUMI_raise_format, \
message, \
message_length)
#define TEST_FAIL(line, cleanup, message_length, message) \
START_TRACE( \
line, cleanup, FAIL, LUMI_assert_format, (Byte*)message, message_length)
#define TEST_ASSERT(line, cleanup, condition) if (!(condition)) \
TEST_FAIL(line, cleanup, 21, "condition is not true")
#define TEST_FAIL_NULL(line, cleanup) \
START_TRACE(line, cleanup, FAIL, LUMI_assert_format, NULL, 0)
#define CHECK(line, cleanup) if (LUMI_err != OK) { \
LUMI_trace_print( \
LUMI_traceline_format, LUMI_FILE_NAME, line, LUMI_FUNC_NAME, \
NULL, 0); \
LUMI_loop_depth = 0; \
goto cleanup; }
#define IGNORE_ERRORS(call) \
++LUMI_trace_ignore_count; (void)call; --LUMI_trace_ignore_count;
#define CHECK_REF(line, cleanup, ref) \
if (ref == NULL) RAISE(line, cleanup, empty_object)
#define CHECK_REFMAN(line, cleanup, refman) \
if (refman != NULL && (refman)->value == NULL) \
RAISE(line, cleanup, outdated_weak_reference)
#define CHECK_REF_REFMAN(line, cleanup, ref, refman) \
CHECK_REF(line, cleanup, ref) \
if ((refman)->value == NULL) RAISE(line, cleanup, outdated_weak_reference)
#define MAIN_PROXY(func) int main(int argc, char* argv[]) { \
return func(argc, argv); \
}
#define MAIN_FUNC MAIN_PROXY(LUMI_main)
#define TEST_MAIN_FUNC MAIN_PROXY(LUMI_test_main)
#define USER_MAIN_HEADER Return_Code LUMI_user_main(void)
#define ARRAY_DEL(Type, array, length) if (array != NULL) { \
uint32_t LUMI_n = 0; \
for (; LUMI_n < length; ++LUMI_n) \
Type##_Del(array + LUMI_n, NULL); \
}
#define ARRAY_DEL_DYN(Type, array, length) if (array != NULL) { \
uint32_t LUMI_n = 0; \
for (; LUMI_n < length; ++LUMI_n) \
Type##_Del(array + LUMI_n, &Type##_dynamic); \
}
#define SELF_REF_DEL(Type, field, _) \
while (self->field != NULL) { \
Type* value = self->field; \
self->field = value->field; \
value->field = NULL; \
Type##_Del(value, NULL); \
free(value); \
}
#define SELF_REF_DEL_STR(Type, field, _) \
while (self->field != NULL) { \
Type* value = self->field; \
Ref_Manager* value_Refman = self->field##_Refman; \
self->field = value->field; \
self->field##_Refman = value->field##_Refman; \
value->field = NULL; \
value->field##_Refman = NULL; \
Type##_Del(value, NULL); \
LUMI_owner_dec_ref(value_Refman); \
}
#define SELF_REF_DEL_DYN(Type, bases, field, field_Dynamic) \
while (self->field != NULL) { \
Type* value = self->field; \
Type##_Dynamic* value_Dynamic = self->field_Dynamic; \
self->field = value->field; \
self->field_Dynamic = value->field_Dynamic; \
value->field = NULL; \
value->field_Dynamic = NULL; \
value_Dynamic->bases##del(value, value_Dynamic); \
free(value); \
}
#define SELF_REF_DEL_STR_DYN(Type, bases, field, field_Dynamic) \
while (self->field != NULL) { \
Type* value = self->field; \
Ref_Manager* value_Refman = self->field##_Refman; \
Type##_Dynamic* value_Dynamic = self->field_Dynamic; \
self->field = value->field; \
self->field##_Refman = value->field##_Refman; \
self->field_Dynamic = value->field_Dynamic; \
value->field = NULL; \
value->field##_Refman = NULL; \
value->field_Dynamic = NULL; \
value_Dynamic->bases##del(value, value_Dynamic); \
LUMI_owner_dec_ref(value_Refman); \
}
#define INIT_VAR_REFMAN(line, cleanup, name) \
name##_Refman = LUMI_new_ref(&name); \
if (name##_Refman == NULL) { RAISE(line, cleanup, managed_object_memory) }
#define INIT_NEW_REFMAN(line, cleanup, name) \
name##_Refman = LUMI_new_ref(name); \
if (name##_Refman == NULL) { \
free(name); \
name = NULL; \
RAISE(line, cleanup, managed_object_memory) }
#define INIT_NEW(line, cleanup, name, type, size) \
name = LUMI_alloc(sizeof(type) * size); \
if (name == NULL) RAISE(line, cleanup, object_memory)
#define INIT_NEW_LEN_ARRAY(line, cleanup, name, type, length, value_size) \
name##_Length = length; \
INIT_NEW_ARRAY(line, cleanup, name, type, name##_Length, value_size)
#define INIT_NEW_ARRAY(line, cleanup, name, type, length, value_size) \
INIT_NEW(line, cleanup, name, type, length * value_size)
#define SAFE_SUM_LARGER(a, b, c) a > c || b > c - a
#define NULL_OR_VALUE(base, value) base != NULL? value: NULL
/* traceback */
#define CRAISE(message) { \
LUMI_C_trace_print(__LINE__, LUMI_FUNC_NAME, (Byte*)message); \
return ERR; }
#define CCHECK(err) { \
Return_Code LUMI_cerr = err; \
if (LUMI_cerr != OK) return LUMI_cerr; }
char* LUMI_raise_format = "Error raised in %s:%lu %s()\n";
char* LUMI_assert_format = "Assert failed in %s:%lu %s()\n";
char* LUMI_traceline_format = " called from %s:%lu %s()\n";
FILE* LUMI_trace_stream = NULL;
size_t LUMI_trace_ignore_count = 0;
Byte* LUMI_expected_error = NULL;
size_t LUMI_expected_error_trace_ignore_count = 0;
Generic_Type_Dynamic* dynamic_Void = NULL;
void LUMI_nop_Del(void* _, void* __) {}
Generic_Type_Dynamic LUMI_nop_dynamic = { LUMI_nop_Del };
#define ERROR_MESAGE(message) {(Byte*)message, sizeof(message) - 1}
Error_Messages LUMI_error_messages = {
ERROR_MESAGE("empty object used"),
ERROR_MESAGE("outdated weak reference used"),
ERROR_MESAGE("insufficient memory for object dynamic allocation"),
ERROR_MESAGE("insufficient memory for managed object"),
ERROR_MESAGE("integer overflow"),
ERROR_MESAGE("slice index out of bounds"),
ERROR_MESAGE("array too short"),
ERROR_MESAGE("file not opened"),
ERROR_MESAGE("file read failed"),
ERROR_MESAGE("file write failed"),
ERROR_MESAGE("zero division"),
ERROR_MESAGE("loop limit reached")
};
enum {
LUMI_DEBUG_NOTHING = 0,
LUMI_DEBUG_FAIL,
LUMI_DEBUG_SUCCESS
};
int lumi_debug_value = LUMI_DEBUG_NOTHING;
void LUMI_trace_print(
char const* format,
char const* filename,
Line_Count line,
char const* funcname,
Byte const* message,
uint32_t message_length) {
if (LUMI_trace_ignore_count == 0) {
if (message != NULL) {
fprintf(
LUMI_trace_stream,
"Error: %.*s\n ",
message_length,
message);
}
fprintf(LUMI_trace_stream, format, filename, line, funcname);
}
else if (LUMI_expected_error != NULL &&
LUMI_expected_error_trace_ignore_count == LUMI_trace_ignore_count &&
format != LUMI_traceline_format) {
uint32_t n;
if (message == NULL) {
LUMI_expected_error = NULL;
if (LUMI_trace_ignore_count == 1) {
fprintf(
LUMI_trace_stream,
"Assert failed: error with no message raised\n ");
}
return;
}
for (n = 0; n <= message_length; ++n) {
if (((n == message_length)? '\0': message[n]) !=
LUMI_expected_error[n]) {
LUMI_expected_error = NULL;
if (LUMI_trace_ignore_count == 1) {
fprintf(
LUMI_trace_stream,
"Assert failed: unexpected error message \"%.*s\"\n ",
message_length,
message);
}
return;
}
}
}
}
/* like strnlen */
uint32_t cstring_length(Byte* cstring) {
uint32_t length = 0;
while (cstring[length] != '\0' && length < UINT32_MAX - 1) {
++length;
}
return length;
}
void LUMI_C_trace_print(Line_Count line, char const* funcname, Byte* message) {
LUMI_trace_print(
LUMI_raise_format,
"builtin",
line,
funcname,
message,
cstring_length(message));
}
/* main */
Return_Code LUMI_user_main(void);
Return_Code set_sys(int argc, char* argv[]);
#define SET_SYS err = set_sys(argc, argv); if (err != OK) return err;
int LUMI_main(int argc, char* argv[]) {
Return_Code err;
LUMI_trace_stream = stderr;
SET_SYS
err = LUMI_user_main();
if (err != OK) {
fprintf(stderr, " called from executable start\n");
}
return err;
}
/* tests */
int LUMI_test_main(int argc, char* argv[]) {
Return_Code err;
LUMI_trace_stream = stdout;
SET_SYS
printf("Running tests:\n");
err = LUMI_user_main();
if (err == OK) {
printf("Tests passed\n");
}
else {
printf("Tests failed\n");
return ERR;
}
return OK;
}
Bool LUMI_run_test(char* test_name, Return_Code (*test_func)(void)) {
Return_Code err;
printf("testing %s... ", test_name);
fflush(stdout);
err = test_func();
if (err == OK) {
printf("OK\n");
return true;
}
return false;
}
unsigned calc_coverage(File_Coverage* files_coverage, size_t files_number) {
size_t n;
size_t all_lines = 0;
size_t covered_lines = 0;
for (n = 0; n < files_number; ++n) {
Line_Count line;
for (line = 0; line < files_coverage[n].lines_number; ++line) {
if (files_coverage[n].line_count[line] >= 0) {
++all_lines;
}
if (files_coverage[n].line_count[line] > 0) {
++covered_lines;
}
}
}
return covered_lines * 100 / all_lines;
}
void make_coverage_xml(File_Coverage* files_coverage, size_t files_number) {
size_t n;
FILE* xml = NULL;
xml = fopen("cobertura.xml", "w");
if (xml == NULL) {
return;
}
fputs("<?xml version=\"1.0\" ?>\n", xml);
fputs(
"<!DOCTYPE coverage SYSTEM 'https://raw.githubusercontent.com/cobertura/"
"cobertura/master/cobertura/src/site/htdocs/xml/coverage-loose.dtd'>\n",
xml);
fputs("<coverage timestamp=\"0\" version=\"lumi 0.0.5\">\n", xml);
fputs(" <packages>\n", xml);
for (n = 0; n < files_number; ++n) {
Line_Count line;
fputs(" <package name=\"\">\n", xml);
fputs(" <classes>\n", xml);
fprintf(
xml,
" <class name=\"%s\" filename=\"%s\">\n",
files_coverage[n].filename,
files_coverage[n].filename);
fputs(" <methods/>\n", xml);
fputs(" <lines>\n", xml);
for (line = 0; line < files_coverage[n].lines_number; ++line) {
if (files_coverage[n].line_count[line] >= 0) {
fprintf(
xml,
" <line branch=\"false\" hits=\"%ld\" number=\"%ld\"/>\n",
files_coverage[n].line_count[line],
line);
}
}
fputs(" </lines>\n", xml);
fputs(" </class>\n", xml);
fputs(" </classes>\n", xml);
fputs(" </package>\n", xml);
}
fputs(" </packages>\n", xml);
fputs("</coverage>\n", xml);
fclose(xml);
}
Bool LUMI_test_coverage(File_Coverage* files_coverage, size_t files_number) {
size_t n;
unsigned coverage;
Bool generate_xml = false;
if (sys_M_argv != NULL && sys_M_argv_Refman->value != NULL &&
sys_M_argv_Length > 1 && sys_M_argv[1].length > 1) {
String* arg = sys_M_argv + 1;
generate_xml = arg->bytes[0] == '-' && arg->bytes[1] == 'x';
}
printf("testing code coverage... ");
coverage = calc_coverage(files_coverage, files_number);
if (coverage == 100) {
printf("100%%\n");
if (generate_xml) {
make_coverage_xml(files_coverage, files_number);
}
return true;
}
printf("%u%% - failed, lines not covered:\n", coverage);
for (n = 0; n < files_number; ++n) {
coverage = calc_coverage(files_coverage + n, 1);
if (coverage < 100) {
Line_Count line;
Line_Count first_uncovered;
Bool prev_uncovered = false;
printf(" %s(%u%%):", files_coverage[n].filename, coverage);
for (line = 0; line < files_coverage[n].lines_number; ++line) {
if (files_coverage[n].line_count[line] == 0) {
if (!prev_uncovered) {
first_uncovered = line;
prev_uncovered = true;
}
}
else if (prev_uncovered) {
printf(" %ld", first_uncovered);
if (first_uncovered < line - 1) {
printf("-%ld", line - 1);
}
prev_uncovered = false;
}
}
printf("\n");
}
}
if (generate_xml) {
make_coverage_xml(files_coverage, files_number);
}
return false;
}
/* reference counting */
void new_Mock(Bool*);
Return_Code delete_Mock(Ref);
void* LUMI_alloc(size_t size) {
Bool allocate_success = true;
new_Mock(&allocate_success);
if (allocate_success) {
return calloc(1, size);
}
return NULL;
}
Ref_Manager* LUMI_new_ref(void* value) {
Ref_Manager* ref = NULL;
Bool allocate_success = true;
new_Mock(&allocate_success);
if (allocate_success) {
ref = malloc(sizeof(Ref_Manager));
if (ref != NULL) {
ref->count = 1;
ref->value = value;
ref->ref = value;
}
}
return ref;
}
void LUMI_inc_ref(Ref_Manager* ref) {
if (ref != NULL) {
++ref->count;
}
}
void dec_ref(Ref_Manager* ref) {
--ref->count;
if (ref->count == 0) {
IGNORE_ERRORS( delete_Mock(ref->ref); )
free(ref);
}
}
void LUMI_dec_ref(Ref_Manager* ref) {
if (ref != NULL) {
dec_ref(ref);
}
}
void LUMI_var_dec_ref(Ref_Manager* ref) {
if (ref != NULL) {
ref->value = NULL;
dec_ref(ref);
}
}
void LUMI_owner_dec_ref(Ref_Manager* ref) {
if (ref != NULL) {
free(ref->value);
ref->value = NULL;
dec_ref(ref);
}
}
/* Pointer */
#define cdef_M_Pointer_set_point_to(pointer, value, _) pointer = &value
#define cdef_M_Pointer_get_pointed_at(pointer, index) pointer[index]
#define cdef_M_Pointer_get_ref_at(pointer, index) (pointer + index)
/* Int */
void String_clear(String* self);
#define LUMI_FUNC_NAME "Int.str"
Return_Code Int_str(uint64_t abs, Bool is_neg, String* str, Bool is_append) {
uint64_t tmp;
uint64_t swaped = 0;
uint32_t digits = 1;
Byte* bytes = NULL;
tmp = abs;
while (tmp > 9) {
++digits;
swaped = swaped * 10 + tmp % 10;
tmp /= 10;
}
if (lumi_debug_value == LUMI_DEBUG_FAIL) {
bytes = NULL;
} else if (is_append) {
bytes = realloc(str->bytes, str->length + digits + is_neg + 1);
} else {
bytes = malloc(digits + is_neg + 1);
}
if (bytes == NULL) CRAISE(LUMI_error_messages.object_memory.str)
if (!is_append) {
String_clear(str);
}
str->bytes = bytes;
if (is_append) {
bytes += str->length;
str->length += digits + is_neg;
}
else {
str->length = digits + is_neg;
}
if (is_neg) {
*bytes = '-';
++bytes;
}
*bytes = '0' + tmp;
while (digits > 1) {
++bytes;
*bytes = '0' + swaped % 10;
swaped /= 10;
--digits;
}
bytes[1] = '\0';
return OK;
}
#undef LUMI_FUNC_NAME
#define Int_strU(value, str) Int_str(value, false, str, false)
#define Int_strS(value, str) Int_strS_append(value, str, false)
#define Int_strS_append(value, str, is_append) \
Int_str((value) < 0? -(value): (value), (value) < 0, str, is_append)
#define CHECK_MIN_ADD(a, b) ((a < 0) && (b < 0) && (-a > INT64_MAX + b))
#define CHECK_MAX_ADD(a, b, limit) ((a > 0) && (b > 0) && (a > limit - b))
#define CHECK_MIN_SUB(a, b) \
((b > 0) && ((int64_t)a < (int64_t)(-INT64_MAX + b)))
#define CHECK_MAX_SUB(a, b, limit) ((a > 0) && (b < 0) && (a > limit + b))
#define CHECK_MIN_MUL(a, b) \
((a < 0) && (b > INT64_MAX / (-a))) || ((b < 0) && (a > INT64_MAX / (-b)))
#define CHECK_MAX_MUL(a, b, limit) \
((a > 0) && (b > limit / a)) || ((b < 0) && (-a > limit / (-b)))
#define CLAMPED_ADD_UU_LIMIT(a, b, max, LIMIT) \
((a > LIMIT - b) || (a + b > max))? max: (a + b)
#define CLAMPED_ADD_UU(a, b, min, max) \
CLAMPED_ADD_UU_LIMIT(a, b, max, UINT64_MAX)
#define CLAMPED_ADD_US(a, b, min, max) (b > 0)? \
(CLAMPED_ADD_UU(a, b, min, max)): (((-b > a) || (a + b < min))? min: (a + b))
#define CLAMPED_ADD_SU(a, b, min, max) \
(a > 0)? (CLAMPED_ADD_UU(a, b, min, max)): ((a + b > max)? max: (a + b))
#define CLAMPED_ADD_SS(a, b, min, max) (b > 0)? \
(CLAMPED_ADD_UU_LIMIT(a, b, max, INT64_MAX)): \
(((a < INT64_MIN - b) || (a + b < min))? min: (a + b))
#define CLAMPED_SUB_SN_LIMIT(a, b, max, LIMIT) \
(((a > LIMIT + b) || (a - b > max))? max: (a - b))
#define CLAMPED_SUB_UU(a, b, min, max) ((a < b) || (a - b < min))? min: (a - b)
#define CLAMPED_SUB_US(a, b, min, max) (b > 0)? \
(CLAMPED_SUB_UU(a, b, min, max)): CLAMPED_SUB_SN_LIMIT(a, b, max, UINT64_MAX)
#define CLAMPED_SUB_SU(a, b, min, max) \
((a < (int64_t)(INT64_MIN + b)) || (a - b < min))? min: (a - b)
#define CLAMPED_SUB_SS(a, b, min, max) (b > 0)? \
(CLAMPED_SUB_SU(a, b, min, max)): CLAMPED_SUB_SN_LIMIT(a, b, max, INT64_MAX)
#define CLAMPED_MUL_UP_LIMIT(a, b, max, CMP_LIMIT) \
(((a CMP_LIMIT / b) || (a * b > max))? max: (a * b))
#define CLAMPED_MUL_UP(a, b, max) CLAMPED_MUL_UP_LIMIT(a, b, max, > UINT64_MAX)
#define CLAMPED_MUL_UN(a, b, min, cmp) \
(((a cmp INT64_MIN / b) || (a * b < min))? min: (a * b))
#define CLAMPED_MUL_UU(a, b, min, max) (a == 0 || b == 0)? min: \
CLAMPED_MUL_UP(a, b, max)
#define CLAMPED_MUL_US(a, b, min, max) (a == 0 || b == 0)? min: \
((b > 0)? CLAMPED_MUL_UP(a, b, max): CLAMPED_MUL_UN(a, b, min, >=))
#define CLAMPED_MUL_SU(a, b, min, max) (a == 0 || b == 0)? (max < 0? max: 0): \
(a > 0)? CLAMPED_MUL_UP(a, b, max): CLAMPED_MUL_UN(a, b, min, >=)
#define CLAMPED_MUL_SS(a, b, min, max) (a == 0 || b == 0)? (max < 0? max: 0): \
((a > 0)? \
((b > 0)? CLAMPED_MUL_UP_LIMIT(a, b, max, > INT64_MAX): \
CLAMPED_MUL_UN(a, b, min, >=)): \
((b > 0)? CLAMPED_MUL_UN(a, b, min, <=): \
CLAMPED_MUL_UP_LIMIT(a, b, max, < INT64_MAX)))
/* Buffer */
void cdef_M_copy_to_buffer(
Byte* source, Byte* target, uint32_t target_length) {
if (source != NULL) {
memcpy(target, source, target_length);
}
}
/* String */
Byte String_empty_string[1] = {'\0'};
void String_Del(String* self, void* _) {
if (self == NULL) return;
if (self->bytes != String_empty_string) {
free(self->bytes);
}
self->bytes = NULL;
}
Generic_Type_Dynamic String_dynamic = { (Dynamic_Del)String_Del };
#define String_length(self, length_out) *(length_out) = (self)->length
void String_clear(String* self) {
if (self->bytes != String_empty_string) {
free(self->bytes);
}
self->bytes = String_empty_string;
self->length = 0;
}
#define LUMI_FUNC_NAME "String.new"
Return_Code String_new(String* self, Byte* source, uint32_t source_length) {
Byte* new_bytes = NULL;
if (source_length == 0) {
new_bytes = String_empty_string;
} else {
if (lumi_debug_value == LUMI_DEBUG_FAIL) {
new_bytes = NULL;
} else {
new_bytes = malloc(source_length + 1);
}
if (new_bytes == NULL) CRAISE(LUMI_error_messages.object_memory.str)
memcpy(new_bytes, source, source_length);
new_bytes[source_length] = '\0';
}
String_clear(self);
self->bytes = new_bytes;
self->length = source_length;
return OK;
}
#undef LUMI_FUNC_NAME
void String_bytes(String* self, Byte** bytes, uint32_t* bytes_length) {
if (self->bytes == NULL) {
self->bytes = String_empty_string;
}
*bytes = self->bytes;
*bytes_length = self->length;
}
char* cdef_M_string_pointer(String* self) {
if (self->bytes == NULL) {
self->bytes = String_empty_string;
}
return (char*)(self->bytes);
}
#define LUMI_FUNC_NAME "cdef.copy-to-string"
Return_Code cdef_M_copy_to_string(char* source, String* self) {
CCHECK(String_new(
self, (Byte*)source, cstring_length((Byte*)source)))
return OK;
}
#undef LUMI_FUNC_NAME
void String_equal(
String* self, Byte* other, uint32_t other_length, Bool* out_equal) {
if (self->bytes == NULL) {
self->bytes = String_empty_string;
}
if (self->length != other_length) {
*out_equal = false;
return;
}
if (self->bytes == other) {
*out_equal = true;
return;
}
*out_equal = strncmp((char*)(self->bytes), (char*)other, other_length) == 0;
}
#define LUMI_FUNC_NAME "String.get"
Return_Code String_get(String* self, uint32_t index, Char* out_char) {
/*CHECK_INDEX(index, length)
*out_char = self[index];*/
return OK;
}
#undef LUMI_FUNC_NAME
#define LUMI_FUNC_NAME "String.set"
Return_Code String_set(String* self, uint32_t index, Char ch) {
/*CHECK_INDEX(index, length)
self[index] = ch;*/
return OK;
}
#undef LUMI_FUNC_NAME
#define LUMI_FUNC_NAME "String.concat"
Return_Code String_concat(String* self, Byte* ext, uint32_t ext_length) {
Byte *new_bytes;
if (lumi_debug_value == LUMI_DEBUG_FAIL) {
new_bytes = NULL;
} else if (self->length == 0) {
new_bytes = malloc(ext_length + 1);
} else {
new_bytes = realloc(self->bytes, self->length + ext_length + 1);
}
if (new_bytes == NULL) CRAISE(LUMI_error_messages.object_memory.str)
memcpy(new_bytes + self->length, ext, ext_length);
self->length += ext_length;
new_bytes[self->length] = '\0';
self->bytes = new_bytes;
return OK;
}
#undef LUMI_FUNC_NAME
#define LUMI_FUNC_NAME "String.append"
Return_Code String_append(String* self, Char ch) {
Byte tmp;
if (ch > 255) CRAISE("appending character values over 255 not suppored yet")
tmp = ch;
CCHECK(String_concat(self, &tmp, 1))
return OK;
}
#undef LUMI_FUNC_NAME
#define String_concat_int(self, value) \
Int_strS_append(value, self, (self)->length > 0)
void String_find(
String* self,
Byte* pattern, uint32_t pattern_length,
uint32_t* out_index) {
/*uint32_t n;
for (n = 0; n <= *length - pattern_length; ++n) {
if (strncmp((char*)self + n, (char*)pattern, pattern_length) == 0) {
*out_index = n;
return;
}
}
*out_index = *length;*/
}
void String_has(
String* self, Char ch, Bool* found) {
uint32_t n;
for (n = 0; n < self->length; ++n) {
if (self->bytes[n] == ch) {
*found = true;
return;
}
}
*found = false;
}
/* File */
void File_Del(File* self, void* _) {
if (self != NULL && self->fobj != NULL) {
fclose(self->fobj);
self->fobj = NULL;
}
}
#define FileReadText_Del(self, _) File_Del(self, _)
#define FileReadBinary_Del(self, _) File_Del(self, _)
#define FileWriteText_Del(self, _) File_Del(self, _)
#define FileWriteBinary_Del(self, _) File_Del(self, _)
#define FileReadWriteText_Del(self, _) File_Del(self, _)
#define FileReadWriteBinary_Del(self, _) File_Del(self, _)
Generic_Type_Dynamic File_dynamic = { (Dynamic_Del)File_Del };
#define FileReadText_dynamic File_dynamic
#define FileReadBinary_dynamic File_dynamic
#define FileWriteText_dynamic File_dynamic
#define FileWriteBinary_dynamic File_dynamic
#define FileReadWriteText_dynamic File_dynamic
#define FileReadWriteBinary_dynamic File_dynamic
#define LUMI_FUNC_NAME "File.close"
Return_Code File_close(File* self) {
if (lumi_debug_value == LUMI_DEBUG_FAIL || self->fobj != NULL) {
if (lumi_debug_value == LUMI_DEBUG_FAIL || fclose(self->fobj) != 0)
CRAISE("close file failed")
self->fobj = NULL;
}
return OK;
}
#undef LUMI_FUNC_NAME
#define FileReadText_close(self) File_close(self)
#define FileReadBinary_close(self) File_close(self)
#define FileWriteText_close(self) File_close(self)
#define FileWriteBinary_close(self) File_close(self)
#define FileReadWriteText_close(self) File_close(self)
#define FileReadWriteBinary_close(self) File_close(self)
#define LUMI_FUNC_NAME "File.new"
Return_Code File_new(File* self, String* name, char* mode) {
if (lumi_debug_value == LUMI_DEBUG_NOTHING) {
CCHECK(File_close(self))
}
if (lumi_debug_value != LUMI_DEBUG_SUCCESS) {
if (lumi_debug_value != LUMI_DEBUG_FAIL) {
self->fobj = fopen((char*)(name->bytes), mode);
}
if (self->fobj == NULL) CRAISE("open file failed")
}
return OK;
}
#undef LUMI_FUNC_NAME
#define FileReadText_new(self, name) File_new(self, name, "r")
#define FileReadBinary_new(self, name) File_new(self, name, "rb")
#define FileWriteText_new(self, name, append) \
File_new(self, name, append? "a": "w")
#define FileWriteBinary_new(self, name, append) \
File_new(self, name, append? "ab": "wb")
#define FileReadWriteText_new(self, name, append, exist) \
File_new(self, name, append? "a+": exist? "r+": "w+")
#define FileReadWriteBinary_new(self, name, append, exist) \
File_new(self, name, append? "ab+": exist? "rb+": "wb+")
#define CHECK_OPEN(self) \
if (lumi_debug_value != LUMI_DEBUG_FAIL && self->fobj == NULL) \
CRAISE(LUMI_error_messages.file_not_opened.str)
#define LUMI_FUNC_NAME "File.tell"
Return_Code File_tell(File* self, int64_t* offset) {
long ret = -1;
CHECK_OPEN(self)
if (lumi_debug_value != LUMI_DEBUG_FAIL) {
ret = ftell(self->fobj);
}
if (ret < 0) CRAISE("getting file offset failed")
*offset = ret;
return OK;
}
#undef LUMI_FUNC_NAME
#define FileReadText_tell(self, offset) File_tell(self, offset)
#define FileReadBinary_tell(self, offset) File_tell(self, offset)
#define FileWriteText_tell(self, offset) File_tell(self, offset)
#define FileWriteBinary_tell(self, offset) File_tell(self, offset)
#define FileReadWriteText_tell(self, offset) File_tell(self, offset)
#define FileReadWriteBinary_tell(self, offset) File_tell(self, offset)
#define LUMI_FUNC_NAME "File.seek"
Return_Code File_seek(File* self, int64_t offset, int whence) {
int ret = -1;
CHECK_OPEN(self)
if (lumi_debug_value != LUMI_DEBUG_FAIL) {
ret = fseek(self->fobj, offset, whence);
}
if (ret != 0) CRAISE("setting file offset failed")
return OK;
}
#undef LUMI_FUNC_NAME
#define File_seek_set(self, offset) File_seek(self, offset, SEEK_SET)
#define File_seek_cur(self, offset) File_seek(self, offset, SEEK_CUR)
#define File_seek_end(self, offset) File_seek(self, offset, SEEK_END)
#define FileReadText_seek_set(self, offset) File_seek_set(self, offset)
#define FileReadBinary_seek_set(self, offset) File_seek_set(self, offset)
#define FileWriteText_seek_set(self, offset) File_seek_set(self, offset)
#define FileWriteBinary_seek_set(self, offset) File_seek_set(self, offset)
#define FileReadWriteText_seek_set(self, offset) File_seek_set(self, offset)
#define FileReadWriteBinary_seek_set(self, offset) File_seek_set(self, offset)
#define FileReadText_seek_cur(self, offset) File_seek_cur(self, offset)
#define FileReadBinary_seek_cur(self, offset) File_seek_cur(self, offset)
#define FileWriteText_seek_cur(self, offset) File_seek_cur(self, offset)
#define FileWriteBinary_seek_cur(self, offset) File_seek_cur(self, offset)
#define FileReadWriteText_seek_cur(self, offset) File_seek_cur(self, offset)
#define FileReadWriteBinary_seek_cur(self, offset) File_seek_cur(self, offset)
#define FileReadText_seek_end(self, offset) File_seek_end(self, offset)
#define FileReadBinary_seek_end(self, offset) File_seek_end(self, offset)
#define FileWriteText_seek_end(self, offset) File_seek_end(self, offset)
#define FileWriteBinary_seek_end(self, offset) File_seek_end(self, offset)
#define FileReadWriteText_seek_end(self, offset) File_seek_end(self, offset)
#define FileReadWriteBinary_seek_end(self, offset) File_seek_end(self, offset)
#define LUMI_FUNC_NAME "File.flush"
Return_Code File_flush(File* self) {
int ret = EOF;
CHECK_OPEN(self)
if (lumi_debug_value != LUMI_DEBUG_FAIL) {
ret = fflush(self->fobj);
}
if (ret != 0) CRAISE("flush file failed")
return OK;
}
#undef LUMI_FUNC_NAME
#define FileReadText_flush(self) File_flush(self)
#define FileReadBinary_flush(self) File_flush(self)
#define FileWriteText_flush(self) File_flush(self)
#define FileWriteBinary_flush(self) File_flush(self)
#define FileReadWriteText_flush(self) File_flush(self)
#define FileReadWriteBinary_flush(self) File_flush(self)
Bool getc_is_not_ok(int get, Byte* ch) {
if (get == EOF) {
return true;
}
else {
*ch = get;
return false;
}
}
#define CHECK_READ(self, is_eof, read_fail) \
if (lumi_debug_value == LUMI_DEBUG_FAIL || read_fail) { \
if (lumi_debug_value == LUMI_DEBUG_FAIL || feof(self->fobj) != 0) \
CRAISE(LUMI_error_messages.file_read_failed.str); \
is_eof = true; }
#define LUMI_FUNC_NAME "FileReadText.get"
Return_Code FileReadText_get(FileReadText* self, Byte* out_char, Bool* is_eof) {
CHECK_OPEN(self)
CHECK_READ(self, *is_eof, getc_is_not_ok(getc(self->fobj), out_char))
return OK;
}
#undef LUMI_FUNC_NAME
#define FileReadWriteText_get(self, out_char, is_eof) \
FileReadText_get(self, out_char, is_eof)
#define LUMI_FUNC_NAME "FileReadBinary.get"
Return_Code FileReadBinary_get(
FileReadBinary* self, Byte* out_byte, Bool* is_eof) {
CHECK_OPEN(self)
CHECK_READ(self, *is_eof, fread(out_byte, sizeof(Byte), 1, self->fobj) < 1)
return OK;
}
#undef LUMI_FUNC_NAME
#define FileReadWriteBinary_get(self, out_byte, is_eof) \
FileReadBinary_get(self, out_byte, is_eof)
#define LUMI_FUNC_NAME "FileReadText.getline-internal"
Return_Code FileReadText_getline_internal(
FileReadText* self,
Byte* target, uint32_t target_length,
Byte** line, uint32_t* line_length,
Bool* is_eof,
int (*char_getter)(FileReadText*)) {
int ch = EOF;
*line = target;
*line_length = 0;
if (lumi_debug_value == LUMI_DEBUG_NOTHING) {
ch = char_getter(self);
} else if (lumi_debug_value == LUMI_DEBUG_SUCCESS) {
ch = 'a';
}
while (ch != EOF && ch != '\n') {
if (*line_length >= target_length)
CRAISE(LUMI_error_messages.array_too_short.str)
target[*line_length] = ch;
++(*line_length);
if (lumi_debug_value != LUMI_DEBUG_SUCCESS) {
ch = getc(self->fobj);
}
}
CHECK_READ(self, *is_eof, ch == EOF)
return OK;
}
#undef LUMI_FUNC_NAME
int getc_char_getter(FileReadText* self) {
return getc(self->fobj);
}
#define LUMI_FUNC_NAME "FileReadText.getline"
Return_Code FileReadText_getline(
FileReadText* self,
Byte* target, uint32_t target_length,
Byte** line, uint32_t* line_length,
Bool* is_eof) {
CHECK_OPEN(self)
CCHECK(FileReadText_getline_internal(
self, target, target_length, line, line_length, is_eof, getc_char_getter))
return OK;
}
#undef LUMI_FUNC_NAME
#define FileReadWriteText_getline(self, line, line_max_length, line_length, is_eof) \
FileReadText_getline(self, line, line_max_length, line_length, is_eof)
#define LUMI_FUNC_NAME "FileReadBinary.read"
Return_Code FileReadBinary_read(
FileReadBinary* self,
Byte* data, uint32_t data_length,
uint32_t* bytes_read) {
Bool is_eof;
*bytes_read = 0;
CHECK_OPEN(self)
if (lumi_debug_value != LUMI_DEBUG_FAIL) {
*bytes_read = fread(data, sizeof(Byte), data_length, self->fobj);
}
CHECK_READ(self, is_eof, *bytes_read < data_length)
return OK;
}
#undef LUMI_FUNC_NAME
#define FileReadWriteBinary_read(self, data, data_length, bytes_read) \
FileReadBinary_read(self, data, data_length, bytes_read)
#define LUMI_FUNC_NAME "FileWriteText.put"
Return_Code FileWriteText_put(FileWriteText* self, Char ch) {
CHECK_OPEN(self)
if (lumi_debug_value == LUMI_DEBUG_FAIL || putc(ch, self->fobj) != ch)
CRAISE(LUMI_error_messages.file_write_failed.str)
return OK;
}
#undef LUMI_FUNC_NAME
#define FileReadWriteText_put(self, ch) FileWriteText_put(self, ch)
#define LUMI_FUNC_NAME "FileWriteBinary.put"
Return_Code FileWriteBinary_put(FileWriteBinary* self, Byte value) {
CHECK_OPEN(self)
if (lumi_debug_value == LUMI_DEBUG_FAIL ||
fwrite(&value, sizeof(value), 1, self->fobj) < 1)
CRAISE(LUMI_error_messages.file_write_failed.str)
return OK;
}
#undef LUMI_FUNC_NAME
#define FileReadWriteBinary_put(self, value) FileWriteBinary_put(self, value)
#define LUMI_FUNC_NAME "FileWriteText.write"
Return_Code FileWriteText_write(
FileWriteText* self, Byte* text, uint32_t text_length, uint32_t* written) {
*written = 0;
CHECK_OPEN(self)
while (*written < text_length) {
int ch;
ch = text[*written];
if (lumi_debug_value == LUMI_DEBUG_FAIL || putc(ch, self->fobj) != ch)
CRAISE(LUMI_error_messages.file_write_failed.str)
++(*written);
}
return OK;
}
#undef LUMI_FUNC_NAME
#define FileReadWriteText_write(self, text, text_length, written) \
FileWriteText_write(self, text, text_length, written)
#define LUMI_FUNC_NAME "FileWriteBinary.write"
Return_Code FileWriteBinary_write(
FileWriteBinary* self,
Byte* data, uint32_t data_length,
uint32_t* written) {
*written = 0;
CHECK_OPEN(self)
if (lumi_debug_value != LUMI_DEBUG_FAIL) {
*written = fwrite(data, sizeof(Byte), data_length, self->fobj);
}
if (*written < data_length) CRAISE(LUMI_error_messages.file_write_failed.str)
return OK;
}
#undef LUMI_FUNC_NAME
#define FileReadWriteBinary_write(self, data, data_length, written) \
FileWriteBinary_write(self, data, data_length, written)
/* system */
#define INIT_REFMAN(name) \
name##_Refman->count = 2; \
name##_Refman->value = name; \
name##_Refman->ref = name;
Return_Code set_sys(int argc, char* argv[]) {
int arg;
sys_M_argv_Length = argc;
sys_M_argv = LUMI_alloc(sizeof(String) * argc);
if (sys_M_argv == NULL) {
fprintf(stderr, "insufficient memory\n");
return ERR;
}
INIT_REFMAN(sys_M_argv)
INIT_REFMAN(sys_M_stdin)
INIT_REFMAN(sys_M_stdout)
INIT_REFMAN(sys_M_stderr)
sys_M_stdin->fobj = stdin;
sys_M_stdout->fobj = stdout;
sys_M_stderr->fobj = stderr;
for (arg = 0; arg < argc; ++arg) {
sys_M_argv[arg].bytes = (Byte*)(argv[arg]);
sys_M_argv[arg].length = cstring_length(sys_M_argv[arg].bytes);
}
return OK;
}
#define LUMI_FUNC_NAME "sys.print"
Return_Code sys_M_print(Byte* text, uint32_t text_length) {
uint32_t n;
int ch;
for (n = 0; n < text_length; ++n) {
ch = text[n];
if (lumi_debug_value == LUMI_DEBUG_FAIL || ch != putchar(ch))
CRAISE(LUMI_error_messages.file_write_failed.str)
}
return OK;
}
#undef LUMI_FUNC_NAME
#define LUMI_FUNC_NAME "sys.println"
Return_Code sys_M_println(Byte* text, uint32_t text_length) {
sys_M_print(text, text_length);
if (lumi_debug_value == LUMI_DEBUG_FAIL || putchar('\n') != '\n')
CRAISE(LUMI_error_messages.file_write_failed.str)
return OK;
}
#undef LUMI_FUNC_NAME
#define LUMI_FUNC_NAME "sys.getchar"
Return_Code sys_M_getchar(Char* out_char, Bool* is_eof) {
Byte byte;
CHECK_READ(sys_M_stdin, *is_eof, getc_is_not_ok(getchar(), &byte))
*out_char = byte;
return OK;
}
#undef LUMI_FUNC_NAME
int getchar_char_getter(FileReadText* self) {
return getchar();
}
#define LUMI_FUNC_NAME "sys.getline"
Return_Code sys_M_getline(
Byte* target, uint32_t target_length,
Byte** line, uint32_t* line_length,
Bool* is_eof) {
CCHECK(FileReadText_getline_internal(
sys_M_stdin,
target, target_length,
line, line_length,
is_eof,
getchar_char_getter))
return OK;
}
#undef LUMI_FUNC_NAME
#define LUMI_FUNC_NAME "sys.exit"
Return_Code sys_M_exit(int32_t status) {
if (lumi_debug_value != LUMI_DEBUG_FAIL) {
exit(status);
}
CRAISE("exit failed")
}
#undef LUMI_FUNC_NAME
#define LUMI_FUNC_NAME "sys.system"
Return_Code sys_M_system(String* command, int32_t* status) {
int res = -1;
if (lumi_debug_value != LUMI_DEBUG_FAIL) {
res = system((char*)(command->bytes));
}
if (res == -1) CRAISE("command execution failed")
*status = res;
return OK;
}
#undef LUMI_FUNC_NAME
#define LUMI_FUNC_NAME "sys.getenv"
Return_Code sys_M_getenv(String* name, String* value, Bool* exists) {
char* ret;
Byte* new_bytes = NULL;
uint32_t length;
if (lumi_debug_value != LUMI_DEBUG_FAIL) {
ret = getenv((char*)(name->bytes));
if (ret == NULL) {
*exists = false;
return OK;
}
length = cstring_length((Byte*)ret);
new_bytes = malloc(length + 1);
}
if (new_bytes == NULL) CRAISE(LUMI_error_messages.object_memory.str)
memcpy(new_bytes, ret, length + 1);
String_clear(value);
value->bytes = new_bytes;
value->length = length;
*exists = true;
return OK;
}
#undef LUMI_FUNC_NAME
|
the_stack_data/150140022.c | #include <stdio.h>
#include <assert.h>
#include <stdlib.h>
int main(int argc,char** argv)
{
return 0;
}
|
the_stack_data/132952408.c | /*
* getopt.c
*
* Replacement for a Unix style getopt function
*
* Quick, clean, and portable to funky systems that don't have getopt()
* for whatever reason.
*
*/
#include <stdio.h>
#include <string.h>
#ifndef MSDOS_16BIT
#define cdecl
#endif
int optind = 1;
int optopt = 0;
const char *optarg = NULL;
int cdecl getopt (int argc, char *argv[], const char *options)
{
static int pos = 1;
const char *p;
if (optind >= argc || argv[optind][0] != '-' || argv[optind][1] == 0)
return EOF;
optopt = argv[optind][pos++];
optarg = NULL;
if (argv[optind][pos] == 0)
{ pos = 1; optind++; }
p = strchr (options, optopt);
if (optopt == ':' || p == NULL) {
fputs ("illegal option -- ", stdout);
goto error;
} else if (p[1] == ':') {
if (optind >= argc) {
fputs ("option requires an argument -- ", stdout);
goto error;
} else {
optarg = argv[optind];
if (pos != 1)
optarg += pos;
pos = 1; optind++;
}
}
return optopt;
error:
fputc (optopt, stdout);
fputc ('\n', stdout);
return '?';
}/* getopt */
|
the_stack_data/161081908.c | /* { dg-do run } */
/* { dg-options "-O3 -mzarch -march=arch12 --save-temps" } */
/* { dg-require-effective-target s390_vxe } */
typedef unsigned int uv4si __attribute__((vector_size(16)));
uv4si __attribute__((noinline))
not_xor (uv4si a, uv4si b)
{
return ~(a ^ b);
}
/* { dg-final { scan-assembler-times "vnx\t%v24,%v24,%v26" 1 } } */
uv4si __attribute__((noinline))
not_and (uv4si a, uv4si b)
{
return ~(a & b);
}
/* { dg-final { scan-assembler-times "vnn\t%v24,%v24,%v26" 1 } } */
uv4si __attribute__((noinline))
or_not (uv4si a, uv4si b)
{
return a | ~b;
}
/* { dg-final { scan-assembler-times "voc\t%v24,%v24,%v26" 1 } } */
int
main ()
{
uv4si a = (uv4si){ 42, 1, 0, 2 };
uv4si b = (uv4si){ 42, 2, 0, 2 };
uv4si c;
c = not_xor (a, b);
if (c[0] != ~0 || c[1] != ~3 || c[2] != ~0 || c[3] != ~0)
__builtin_abort ();
c = not_and (a, b);
if (c[0] != ~42 || c[1] != ~0 || c[2] != ~0 || c[3] != ~2)
__builtin_abort ();
c = or_not (a, b);
if (c[0] != ~0 || c[1] != ~2 || c[2] != ~0 || c[3] != ~0)
__builtin_abort ();
return 0;
}
|
the_stack_data/6388095.c | # include <stdio.h>
int main(){
float array[100] = {0};
int c;
for (c = 0; c < 100; c++){
scanf("%f", &array[c]);
}
for (c = 0; c < 100; c++){
if(array[c] <= 10.0){printf("A[%i] = %.1f\n", c, array[c]);}
}
return 0;
} |
the_stack_data/132953780.c | #include <stdio.h>
#include <stdlib.h>
static const int prime = 1000000007;
struct hash_table {
int a, b; // Parametri per la funzione di hash
int n_bucket; // Numero di bucket presenti nella tabella di hash
// Riempite con ulteriori campi necessari
};
int hash(struct hash_table* ht, int val) {
// Come visto a lezione. Nota: ((a%prime)+prime)%prime serve per evitare
// scherzi se a è negativo.
return ((((ht->a*(long long)val+ht->b) % prime) + prime ) % prime) % ht->n_bucket;
}
struct hash_table* create_hash_table(int expected_size) {
// Costruisce una tabella di hash vuota che si aspetta di contenere
// fino a O(expected_size) elementi
return NULL;
}
int find(struct hash_table* ht, int val) {
// Restituisce 1 se val è presente in ht, 0 altrimenti
return 0;
}
void insert(struct hash_table* ht, int val) {
// Inserisce val nella tabella di hash ht
}
void delete(struct hash_table* ht, int val) {
// Elimina val dalla tabella di hash ht
}
int main() {
int o, i;
scanf("%d", &o);
struct hash_table* ht = create_hash_table(o);
for (i=0; i<o; i++) {
char op;
int num;
scanf(" %c%d", &op, &num);
if (op == 'f') {
printf("%d\n", find(ht, num));
} else if (op == 'i') {
insert(ht, num);
} else if (op == 'd') {
delete(ht, num);
}
}
return 0;
}
|
the_stack_data/59513769.c | #include <stdint.h>
struct tss_entry
{
uint32_t prev_tss;
uint32_t esp0;
uint32_t ss0;
uint32_t esp1;
uint32_t ss1;
uint32_t esp2;
uint32_t ss2;
uint32_t cr3;
uint32_t eip;
uint32_t eflags;
uint32_t eax;
uint32_t ecx;
uint32_t edx;
uint32_t ebx;
uint32_t esp;
uint32_t ebp;
uint32_t esi;
uint32_t edi;
uint32_t es;
uint32_t cs;
uint32_t ss;
uint32_t ds;
uint32_t fs;
uint32_t gs;
uint32_t ldt;
uint16_t trap;
uint16_t iomap_base;
};
struct tss_entry tss =
{
.ss0 = 0x10 /* Kernel Data Segment */,
.esp0 = 0,
.es = 0x10 /* Kernel Data Segment */,
.cs = 0x08 /* Kernel Code Segment */,
.ds = 0x13 /* Kernel Data Segment */,
.fs = 0x13 /* Kernel Data Segment */,
.gs = 0x13 /* Kernel Data Segment */,
};
// TODO: Magic values ohoy! Fix that.
#define GRAN_64_BIT_MODE (1 << 5)
#define GRAN_32_BIT_MODE (1 << 6)
#define GRAN_4KIB_BLOCKS (1 << 7)
struct gdt_entry
{
uint16_t limit_low;
uint16_t base_low;
uint8_t base_middle;
uint8_t access;
uint8_t granularity;
uint8_t base_high;
};
#define GDT_ENTRY(base, limit, access, granularity) \
{ (limit) & 0xFFFF, /* limit_low */ \
(base) >> 0 & 0xFFFF, /* base_low */ \
(base) >> 16 & 0xFF, /* base_middle */ \
(access) & 0xFF, /* access */ \
((limit) >> 16 & 0x0F) | ((granularity) & 0xF0), /* granularity */ \
(base) >> 24 & 0xFF, /* base_high */ }
struct gdt_entry gdt[] =
{
/* 0x00: Null segment */
GDT_ENTRY(0, 0, 0, 0),
/* 0x08: Kernel Code Segment. */
GDT_ENTRY(0, 0xFFFFFFFF, 0x9A, GRAN_32_BIT_MODE | GRAN_4KIB_BLOCKS),
/* 0x10: Kernel Data Segment. */
GDT_ENTRY(0, 0xFFFFFFFF, 0x92, GRAN_32_BIT_MODE | GRAN_4KIB_BLOCKS),
/* 0x18: User Code Segment. */
GDT_ENTRY(0, 0xFFFFFFFF, 0xFA, GRAN_32_BIT_MODE | GRAN_4KIB_BLOCKS),
/* 0x20: User Data Segment. */
GDT_ENTRY(0, 0xFFFFFFFF, 0xF2, GRAN_32_BIT_MODE | GRAN_4KIB_BLOCKS),
/* 0x28: Task Switch Segment. */
GDT_ENTRY(0 /*((uintptr_t) &tss)*/, sizeof(tss) - 1, 0xE9, 0x00),
};
uint16_t gdt_size_minus_one = sizeof(gdt) - 1;
|
the_stack_data/778790.c | #include <stdio.h>
int main(void)
{
int fibo, nacci;
fibo = 0;
nacci = 1;
do
{
printf("%d ", fibo);
fibo = fibo + nacci;
printf("%d ", nacci);
nacci = nacci + fibo;
}while (nacci < 300);
putchar('\n');
return(0);
}
|
the_stack_data/167330286.c | #include<stdio.h>
void absoluto (int* x);
int main() {
int x;
int n, i;
scanf("%d", &n);
for(int i=0; i<n; i++) {
scanf("%d", &x);
absoluto(&x);
printf("%d\n", x);
}
return 0;
}
void absoluto (int* x){
if(*x<0){
*x=-*x;
}
} |
the_stack_data/97391.c | /* an example to show how to use parallel_crc_calculate.c
* compile: gcc test_crc.c parallel_crc_calculate.c -o test_crc
* run: ./test_crc
*
*/
#include <stdio.h>
#include <stdlib.h>
int main()
{
int input_bits[10] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
int * crc = (int *) malloc(sizeof(int) * 24);
int index;
parallel_crc_calculate(crc, input_bits, 10, 2);
for(index = 0; index < 24; index++)
printf("%d", crc[index]);
printf("\n");
free(crc);
return 0;
}
|
the_stack_data/117924.c | #include<stdio.h>
int main() {
int num, equal;
int front, back, front_back;
int count=0;
scanf_s("%d", &num);
equal = num;
for (int i = 0; ; i++) {
front = num / 10;
back = num % 10;
front_back = front + back;
if (front_back >= 10) {
front_back %= 10;
}
num = back * 10 + front_back;
count++;
if (num == equal) {
printf("%d\n", count);
break;
}
}
return 0;
} |
the_stack_data/51219.c | #include<stdio.h>
int main()
{
int i = 1;
for(;i<=100 && i>=-100;){
printf("%d ",i);
i*=2;
}
return 0;
}
|
the_stack_data/62636562.c | #include <stdio.h>
#include <stdlib.h>
typedef struct node {
struct node * left;
int key;
struct node * right;
struct node * parent;
} node;
node * insert(int, node *, node *);
int compare(node *, node *);
int main()
{
int t;
int n;
scanf("%d%d", &t, &n);
for(int j = 0; j < t; j++) {
node * root1;
node * root2;
root1 = NULL;
root2 = NULL;
for (int i = 0; i < 2 * n; i++) {
int data;
scanf("%d", &data);
if(i < n)
root1 = insert(data, root1, NULL);
else
root2 = insert(data, root2, NULL);
}
if(compare(root1, root2))
printf("y\n");
else
printf("n\n");
}
return 0;
}
node * insert(int key, node * root, node * parent)
{
if(!root) {
node * new;
new = malloc(sizeof(node));
*new = (node) {NULL, key, NULL, parent};
return new;
}
if (key < root->key)
root->left = insert(key, root->left, root);
else
root->right = insert(key, root->right, root);
return root;
}
int compare(node * root1, node * root2)
{
if(root1 && !root2)
return 0;
if(!root1 && root2)
return 0;
if(!root1 && !root2)
return 1;
if(root1->key != root2->key)
return 0;
if(!compare(root1->left, root2->left))
return 0;
if(!compare(root1->right, root2->right))
return 0;
return 1;
}
|
the_stack_data/236141.c | #include <stdio.h>
int main(int argc, const char * argv[]) {
int c,i;
int freqc[90]; // reference ASCII table, here we choose character from 33-122
for(i=0;i<=89;i++)
freqc[i] = 0;
while((c=getchar()) != EOF){
++freqc[c -'!'];
}
for(i=0;i<=89;i++)
printf("frequence of characgter %c : %d \n", i+33, freqc[i]);
}
|
the_stack_data/299903.c | /*
Instituto Tecnológico de Aeronáutica
Vinícius Freitas de Almeida - Aluno da Graduação, Turma de 2024
16/03/2020
---------------------------------------------------------------
Essa aqui é a resolução esperada do problema, usando o conceito de recursão.
Se você resolveu de maneira diferente, mas funcionou, sem problemas! :D
A ideia é que você entenda como a recursão pode facilitar a vida na hora
de resolver os problemas de CES-10, CES-11 ou de programação em geral.
*/
#include <stdio.h>
//DICA: È melhor criar constantes com nomes que têm significado do que jogar números aleatórios no código!
#define N_MAX 3
//A matriz onde o modelo ficará armazenado
//O '+1' é para armazenar o terminador de string '\0' e facilitar a vida
char modelo[N_MAX][N_MAX];
//Faz a potencia n^k
int potencia(int n, int k) {
//k negativo será desprezado
//Para k >= 0:
//Valor da potência
int p = 1;
//Repetir k vezes
for (int i = 0; i < k; i++)
p *= n;
return p;
}
//Função recursiva da fractal
char fractal(int i, int j, int contagem, int n) {
//A princípio, não pintar de preto
char c = '.';
//Limite da recursão
if (contagem > 1)
c = fractal(i / n, j / n, contagem - 1, n);
//Quadrado preto '*'
if (c == '*') {
return '*';
} else {
//c é, a princípio, quadrado branco '.'
//Mas vamos consultar o modelo para pintar de preto, se necessário
return modelo[i % n][j % n];
}
}
int main() {
//Variáveis de entrada
//n: dimensão do modelo (2 <= n <= 3)
//k: passos do algoritmo (1 <= k <= 5)
int n, k;
//Arquivos de entrada e saida
FILE *entrada, *saida;
entrada = fopen("input.txt", "r");
saida = fopen("output.txt", "w");
//Leitura da linha inicial
fscanf(entrada, "%d %d\n", &n, &k);
for (int i = 0; i < n; i++) {
//Ler cada linha e colocar na matriz
for (int j = 0; j < n; j++) {
modelo[i][j] = fgetc(entrada);
}
//Descartar o '\n'
fgetc(entrada);
}
//M é o tamanho da matriz de saída
//M = n^k
int M = potencia(n, k);
//Escrever a matriz de saída
//caractere por caractere
for (int i = 0; i < M; i++) {
for (int j = 0; j < M; j++) {
//Aqui usamos a função da fractal para cada i,j da matriz
fputc(fractal(i, j, k, n), saida);
}
fputc('\n', saida);
}
//Nunca esqueça de fechar os arquivos de saída e entrada ;)
fclose(entrada);
fclose(saida);
return 0;
} |
the_stack_data/40763893.c | #include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
int get_word(char *buf,int buf_size,FILE *fp)
{
int len;
int ch;
while ((ch=getc(fp)) != EOF && !isalnum(ch)) //跳过读空白字符
;
if(ch ==EOF)
return EOF;
len=0;
do
{
buf[len] = ch;
len++;
if(len >= buf_size)
{
fprintf(stderr,"word too long.\n");
exit(1);
}
}while((ch=getc(fp)) != EOF && isalnum(ch));
buf[len]='\0';
return 0;
}
/*
int main(void)
{
char buf[256];
while(get_word(buf,256,stdin) != EOF)
{
printf("<<%s>>\n",buf);
}
return 0;
}
*/
|
the_stack_data/129826709.c | #include <stdio.h>
#include <string.h>
int main(void) {
char buff[10];
int pass = 0;
// printf ("%p %p %p %p", (void*)&buff[0], (void*)&buff[9] , (void*)&pass, &x);
printf("\n Enter the password : \n");
gets(buff);
if(strcmp(buff, "thegeekstuff")) {
printf ("\n Wrong Password \n");
}
else {
printf ("\n Correct Password \n");
pass = 1;
}
if(pass == 1) {
/* Now give root or admin rights to user*/
printf ("\n Root privileges given to the user \n");
}
//
return 0;
} |
the_stack_data/170453674.c | /*
*******************************************************************************
* Copyright (c) 2020, STMicroelectronics
* All rights reserved.
*
* This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause
*
*******************************************************************************
*/
#if defined(ARDUINO_GENERIC_H725VEHX) || defined(ARDUINO_GENERIC_H725VGHX) ||\
defined(ARDUINO_GENERIC_H735VGHX)
#include "pins_arduino.h"
/**
* @brief System Clock Configuration
* @param None
* @retval None
*/
WEAK void SystemClock_Config(void)
{
/* SystemClock_Config can be generated by STM32CubeMX */
#warning "SystemClock_Config() is empty. Default clock at reset is used."
}
#endif /* ARDUINO_GENERIC_* */
|
the_stack_data/50191.c | #include <stdio.h>
#include <string.h>
/*
* arg
* handles all command line argument checking code
*/
static int argc = 0;
static char **argv = NULL;
/*
* pass the programs argument count and pointer to the arg module
*/
void arg_init(int arg_count, char **arg_ptr)
{
argc = arg_count;
argv = arg_ptr;
}
/*
* get number of arguments
*/
int arg_number(void)
{
return argc;
}
/*
* check if a parameter exists and give its index in the list
* returns 0 if parameter not found
*/
int arg_check(char *arg)
{
int i;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], arg) == 0) {
return i;
}
}
return 0;
}
/*
* return a pointer to the argument at the given index, NULL on fail
*/
char *arg_get(int i)
{
if (i >= 0 && i < argc) {
return argv[i];
}
return NULL;
}
|
the_stack_data/220456638.c | /*
* Copyright 2020, Data61, CSIRO (ABN 41 687 119 230)
*
* SPDX-License-Identifier: GPL-2.0-only
*/
#ifdef CONFIG_ENABLE_BENCHMARK
#endif /* CONFIG_ENABLE_BENCHMARK */
|
the_stack_data/1127479.c | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
float calculaDelta(float, float, float);
main ()
{
float a, b, c, resultado;
printf("Digite o valor de a: ");
scanf("%f", &a);
printf("Digite o valor de b: ");
scanf("%f", &b);
printf("Digite o valor de c: ");
scanf("%f", &c);
resultado = calculaDelta(a,b,c); printf("O delta e: %f", resultado);
}
float calculaDelta(float a, float b, float c)
{
return pow(b,2) - 4*a*c;
}
|
the_stack_data/96019.c | #include <stdio.h>
#define MAX_ELEMENT 200
typedef struct {
int key;
} element;
typedef struct {
element heap[MAX_ELEMENT];
int heapSize;
} HeapType;
void insertMaxHeap(HeapType* h, element item) {
int i;
i = ++(h->heapSize);
while ((i != 1) && (item.key > h->heap[i / 2].key)) {
h->heap[i] = h->heap[i / 2];
i /= 2;
}
h->heap[i] = item;
}
element deleteMaxHeap(HeapType* h) {
int parent, child;
element item, temp;
item = h->heap[1];
temp = h->heap[(h->heapSize)--];
parent = 1;
child = 2;
while (child <= h->heapSize) {
if ((child < h->heapSize) && (h->heap[child].key < h->heap[child + 1].key)) {
child++;
}
if (temp.key >= h->heap[child].key) {
break;
}
h->heap[parent] = h->heap[child];
parent = child;
child *= 2;
}
h->heap[parent] = temp;
return item;
}
void printHeap(HeapType* h) {
printf("HEAP : [ ");
for (int i = 1; i <= h->heapSize; i++) {
printf("%d ", h->heap[i].key);
}
printf("] \n");
}
int main(void) {
HeapType heap;
heap.heapSize = 0;
element e1 = { 10 }, e2 = { 5 }, e3 = { 30 };
element e4, e5, e6;
insertMaxHeap(&heap, e1);
insertMaxHeap(&heap, e2);
insertMaxHeap(&heap, e3);
e4 = deleteMaxHeap(&heap);
e5 = deleteMaxHeap(&heap);
e6 = deleteMaxHeap(&heap);
printf("< %d > ", e4.key);
printf("< %d > ", e5.key);
printf("< %d > ", e6.key);
return 0;
}
|
the_stack_data/318672.c | #include <stdlib.h>
typedef struct node {
int data;
struct node *next;
} node_t;
int foo(int n){
node_t *root;
node_t *tmp;
int i;
root = 0;
// csolve_assert(0); //SANITY
for(i = 0; i < n; i++){
tmp = (node_t *) malloc(sizeof(node_t));
tmp->data = i;
tmp->next = root;
root = tmp;
}
// csolve_assert(0); //SANITY
for(tmp = root; tmp != (node_t*) 0; tmp = tmp->next){
csolve_assert(tmp->data >= 0);
csolve_assert(tmp->data < n);
csolve_assert(tmp->data < 100);
// csolve_assert(0); //SANITY
}
return 0;
}
int main(){
foo(100);
return 0;
}
|
the_stack_data/8096.c | /**
* Authors: PPT Team
**/
#include<stdio.h>
void rotire(int *a,int *b,int *c)
{
int temp;
temp = *b;
*b = *a;
*a = *c;
*c = temp;
}
int main()
{
int a, b, c;
printf("Dati a, b si c: ");
scanf("%d %d %d",&a,&b,&c);
printf("Valorile inainte de rotire:\n");
printf("a = %d \nb = %d \nc = %d\n",a,b,c);
rotire(&a, &b, &c);
printf("Valorile dupa rotire:\n");
printf("a = %d \nb = %d \nc = %d",a, b, c);
return 0;
}
|
the_stack_data/67326100.c | __attribute__((weak))
int mydata;
int bar()
{
return mydata;
}
|
the_stack_data/237642199.c | #include <stdio.h>
#include <math.h>
int main()
{
int n, i;
scanf(" %d", &n);
for(i=1; i<=n; i++)
{
printf("%d %.0lf %.0lf\n",i, pow(i, 2), pow(i, 3));
}
return 0;
}
|
the_stack_data/31386865.c | /*
* POK header
*
* The following file is a part of the POK project. Any modification should
* made according to the POK licence. You CANNOT use this file or a part of
* this file is this part of a file for your own project
*
* For more information on the POK licence, please see our LICENCE FILE
*
* Please follow the coding guidelines described in doc/CODING_GUIDELINES
*
* Copyright (c) 2007-2009 POK team
*
* Created by julien on Thu Jan 15 23:34:13 2009
*/
/**
* \file middleware/portutils.c
* \date 2008-2009
* \brief Various functions for ports management.
* \author Julien Delange
*/
#if defined (POK_NEEDS_PORTS_SAMPLING) || defined (POK_NEEDS_PORTS_QUEUEING)
#include <types.h>
#include <libc.h>
#include <core/time.h>
#include <middleware/port.h>
#include <middleware/queue.h>
extern pok_port_t pok_ports[POK_CONFIG_NB_PORTS];
extern pok_queue_t pok_queue;
extern uint8_t pok_current_partition;
pok_port_size_t pok_port_available_size (uint8_t pid)
{
if (pok_ports[pid].full == TRUE)
{
return 0;
}
if (pok_ports[pid].off_b < pok_ports[pid].off_e)
{
return (pok_ports[pid].off_b - pok_ports[pid].off_e);
}
else
{
return (pok_ports[pid].size - pok_ports[pid].off_e + pok_ports[pid].off_b);
}
}
pok_port_size_t pok_port_consumed_size (uint8_t pid)
{
if (pok_ports[pid].empty == TRUE)
{
return 0;
}
if (pok_ports[pid].off_b < pok_ports[pid].off_e )
{
return (pok_ports[pid].off_e - pok_ports[pid].off_b);
}
else
{
return (pok_ports[pid].size - pok_ports[pid].off_b + pok_ports[pid].off_e);
}
}
pok_ret_t pok_port_get (const uint32_t pid, void *data, const pok_port_size_t size)
{
#ifdef POK_NEEDS_PORTS_QUEUEING
pok_port_size_t tmp_size;
pok_port_size_t tmp_size2;
#endif
switch (pok_ports[pid].kind)
{
#ifdef POK_NEEDS_PORTS_QUEUEING
case POK_PORT_KIND_QUEUEING:
if (pok_ports[pid].empty == TRUE)
{
return POK_ERRNO_EINVAL;
}
if (pok_ports[pid].size < size)
{
return POK_ERRNO_SIZE;
}
if ((pok_ports[pid].off_b + size) > pok_ports[pid].size)
{
tmp_size = pok_ports[pid].size - pok_ports[pid].off_b;
memcpy (data, &pok_queue.data[pok_ports[pid].index + pok_ports[pid].off_b], tmp_size);
tmp_size2 = size - tmp_size;
memcpy (data + tmp_size, &pok_queue.data[pok_ports[pid].index], tmp_size2);
}
else
{
memcpy (data, &pok_queue.data[pok_ports[pid].index + pok_ports[pid].off_b], size);
}
pok_ports[pid].off_b = (pok_ports[pid].off_b + size) % pok_ports[pid].size;
if (pok_ports[pid].off_b == pok_ports[pid].off_e)
{
pok_ports[pid].empty = TRUE;
pok_ports[pid].full = FALSE;
}
return POK_ERRNO_OK;
break;
#endif
#ifdef POK_NEEDS_PORTS_SAMPLING
case POK_PORT_KIND_SAMPLING:
if (pok_ports[pid].empty == TRUE)
{
return POK_ERRNO_EMPTY;
}
if (size > pok_ports[pid].size)
{
return POK_ERRNO_SIZE;
}
memcpy (data, &pok_queue.data[pok_ports[pid].index + pok_ports[pid].off_b], size);
return POK_ERRNO_OK;
break;
#endif
default:
return POK_ERRNO_EINVAL;
}
}
pok_ret_t pok_port_write (const uint8_t pid, const void *data, const pok_port_size_t size)
{
#ifdef POK_NEEDS_PORTS_QUEUEING
pok_port_size_t tmp_size;
pok_port_size_t tmp_size2;
#endif
switch (pok_ports[pid].kind)
{
#ifdef POK_NEEDS_PORTS_QUEUEING
case POK_PORT_KIND_QUEUEING:
if (pok_ports[pid].full == TRUE)
{
return POK_ERRNO_SIZE;
}
if (size > pok_ports[pid].size)
{
return POK_ERRNO_SIZE;
}
if ((pok_ports[pid].off_e + size) > pok_ports[pid].size)
{
tmp_size = pok_ports[pid].size - pok_ports[pid].off_e;
memcpy (&pok_queue.data[pok_ports[pid].index + pok_ports[pid].off_e], data, tmp_size);
tmp_size2 = size - tmp_size;
memcpy (&pok_queue.data[pok_ports[pid].index], data + tmp_size, tmp_size2);
}
else
{
memcpy (&pok_queue.data[pok_ports[pid].index + pok_ports[pid].off_e], data, size);
}
pok_ports[pid].off_e = (pok_ports[pid].off_e + size) % pok_ports[pid].size;
if (pok_ports[pid].off_e == pok_ports[pid].off_b)
{
pok_ports[pid].full = TRUE;
}
pok_ports[pid].empty = FALSE;
return POK_ERRNO_OK;
break;
#endif
#ifdef POK_NEEDS_PORTS_SAMPLING
case POK_PORT_KIND_SAMPLING:
if (size > pok_ports[pid].size)
{
return POK_ERRNO_SIZE;
}
memcpy (&pok_queue.data[pok_ports[pid].index + pok_ports[pid].off_e], data, size);
pok_ports[pid].empty = FALSE;
pok_ports[pid].last_receive = POK_GETTICK ();
return POK_ERRNO_OK;
break;
#endif
default:
return POK_ERRNO_EINVAL;
}
}
/*
* This function is designed to transfer data from one port to another
* It is called when we transfer all data from one partition to the
* others.
*/
pok_ret_t pok_port_transfer (const uint8_t pid_dst, const uint8_t pid_src)
{
pok_port_size_t len = 0;
pok_port_size_t src_len_consumed = 0;
if (pok_ports[pid_src].empty == TRUE)
{
return POK_ERRNO_EMPTY;
}
if (pok_ports[pid_src].kind == POK_PORT_KIND_QUEUEING)
{
len = pok_port_available_size (pid_dst);
}
else
{
if (pok_ports[pid_src].size != pok_ports[pid_dst].size)
{
return POK_ERRNO_SIZE;
}
len = pok_ports[pid_src].size;
}
if (pok_ports[pid_src].kind == POK_PORT_KIND_QUEUEING)
{
src_len_consumed = pok_port_consumed_size (pid_src);
if (src_len_consumed == 0)
{
return POK_ERRNO_SIZE;
}
if (len > src_len_consumed)
{
len = src_len_consumed;
}
/*
* Here, we check the size of data produced in the source port.
* If there is more free space in the destination port, the size
* of copied data will be the occupied size in the source port.
*/
}
if (len == 0)
{
return POK_ERRNO_SIZE;
}
/*
* Len is the size to copy. If size is null, it's better to return
* directly
*/
memcpy (&pok_queue.data[pok_ports[pid_dst].index + pok_ports[pid_dst].off_e], &pok_queue.data[pok_ports[pid_src].index + pok_ports[pid_src].off_b], len);
if (pok_ports[pid_src].kind == POK_PORT_KIND_QUEUEING)
{
pok_ports[pid_dst].off_e = (pok_ports[pid_dst].off_e + len) % pok_ports[pid_dst].size;
pok_ports[pid_src].off_b = (pok_ports[pid_src].off_b + len) % pok_ports[pid_src].size;
if (pok_ports[pid_src].off_b == pok_ports[pid_src].off_e)
{
pok_ports[pid_src].empty = TRUE;
pok_ports[pid_src].full = FALSE;
}
}
else
{
pok_ports[pid_src].empty = TRUE;
}
pok_ports[pid_src].full = FALSE;
pok_ports[pid_dst].empty = FALSE;
return POK_ERRNO_OK;
}
#endif
#if defined (POK_NEEDS_PORTS_SAMPLING) || defined (POK_NEEDS_PORTS_QUEUEING) || defined (POK_NEEDS_PORTS_VIRTUAL)
bool_t pok_own_port (const uint8_t partition, const uint8_t port)
{
if (port > POK_CONFIG_NB_PORTS)
{
return FALSE;
}
#ifdef POK_CONFIG_PARTITIONS_PORTS
if ((((uint8_t[]) POK_CONFIG_PARTITIONS_PORTS)[port]) == partition)
{
return TRUE;
}
#endif
return FALSE;
}
#endif
|
the_stack_data/111078392.c | /**
******************************************************************************
* @file stm32l4xx_ll_tim.c
* @author MCD Application Team
* @version V1.7.2
* @date 16-June-2017
* @brief TIM LL module driver.
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
#if defined(USE_FULL_LL_DRIVER)
/* Includes ------------------------------------------------------------------*/
#include "stm32l4xx_ll_tim.h"
#include "stm32l4xx_ll_bus.h"
#ifdef USE_FULL_ASSERT
#include "stm32_assert.h"
#else
#define assert_param(expr) ((void)0U)
#endif
/** @addtogroup STM32L4xx_LL_Driver
* @{
*/
#if defined (TIM1) || defined (TIM8) || defined (TIM2) || defined (TIM3) || defined (TIM4) || defined (TIM5) || defined (TIM15) || defined (TIM16) || defined (TIM17) || defined (TIM6) || defined (TIM7)
/** @addtogroup TIM_LL
* @{
*/
/* Private types -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private constants ---------------------------------------------------------*/
/* Private macros ------------------------------------------------------------*/
/** @addtogroup TIM_LL_Private_Macros
* @{
*/
#define IS_LL_TIM_COUNTERMODE(__VALUE__) (((__VALUE__) == LL_TIM_COUNTERMODE_UP) \
|| ((__VALUE__) == LL_TIM_COUNTERMODE_DOWN) \
|| ((__VALUE__) == LL_TIM_COUNTERMODE_CENTER_UP) \
|| ((__VALUE__) == LL_TIM_COUNTERMODE_CENTER_DOWN) \
|| ((__VALUE__) == LL_TIM_COUNTERMODE_CENTER_UP_DOWN))
#define IS_LL_TIM_CLOCKDIVISION(__VALUE__) (((__VALUE__) == LL_TIM_CLOCKDIVISION_DIV1) \
|| ((__VALUE__) == LL_TIM_CLOCKDIVISION_DIV2) \
|| ((__VALUE__) == LL_TIM_CLOCKDIVISION_DIV4))
#define IS_LL_TIM_OCMODE(__VALUE__) (((__VALUE__) == LL_TIM_OCMODE_FROZEN) \
|| ((__VALUE__) == LL_TIM_OCMODE_ACTIVE) \
|| ((__VALUE__) == LL_TIM_OCMODE_INACTIVE) \
|| ((__VALUE__) == LL_TIM_OCMODE_TOGGLE) \
|| ((__VALUE__) == LL_TIM_OCMODE_FORCED_INACTIVE) \
|| ((__VALUE__) == LL_TIM_OCMODE_FORCED_ACTIVE) \
|| ((__VALUE__) == LL_TIM_OCMODE_PWM1) \
|| ((__VALUE__) == LL_TIM_OCMODE_PWM2) \
|| ((__VALUE__) == LL_TIM_OCMODE_RETRIG_OPM1) \
|| ((__VALUE__) == LL_TIM_OCMODE_RETRIG_OPM2) \
|| ((__VALUE__) == LL_TIM_OCMODE_COMBINED_PWM1) \
|| ((__VALUE__) == LL_TIM_OCMODE_COMBINED_PWM2) \
|| ((__VALUE__) == LL_TIM_OCMODE_ASSYMETRIC_PWM1) \
|| ((__VALUE__) == LL_TIM_OCMODE_ASSYMETRIC_PWM2))
#define IS_LL_TIM_OCSTATE(__VALUE__) (((__VALUE__) == LL_TIM_OCSTATE_DISABLE) \
|| ((__VALUE__) == LL_TIM_OCSTATE_ENABLE))
#define IS_LL_TIM_OCPOLARITY(__VALUE__) (((__VALUE__) == LL_TIM_OCPOLARITY_HIGH) \
|| ((__VALUE__) == LL_TIM_OCPOLARITY_LOW))
#define IS_LL_TIM_OCIDLESTATE(__VALUE__) (((__VALUE__) == LL_TIM_OCIDLESTATE_LOW) \
|| ((__VALUE__) == LL_TIM_OCIDLESTATE_HIGH))
#define IS_LL_TIM_ACTIVEINPUT(__VALUE__) (((__VALUE__) == LL_TIM_ACTIVEINPUT_DIRECTTI) \
|| ((__VALUE__) == LL_TIM_ACTIVEINPUT_INDIRECTTI) \
|| ((__VALUE__) == LL_TIM_ACTIVEINPUT_TRC))
#define IS_LL_TIM_ICPSC(__VALUE__) (((__VALUE__) == LL_TIM_ICPSC_DIV1) \
|| ((__VALUE__) == LL_TIM_ICPSC_DIV2) \
|| ((__VALUE__) == LL_TIM_ICPSC_DIV4) \
|| ((__VALUE__) == LL_TIM_ICPSC_DIV8))
#define IS_LL_TIM_IC_FILTER(__VALUE__) (((__VALUE__) == LL_TIM_IC_FILTER_FDIV1) \
|| ((__VALUE__) == LL_TIM_IC_FILTER_FDIV1_N2) \
|| ((__VALUE__) == LL_TIM_IC_FILTER_FDIV1_N4) \
|| ((__VALUE__) == LL_TIM_IC_FILTER_FDIV1_N8) \
|| ((__VALUE__) == LL_TIM_IC_FILTER_FDIV2_N6) \
|| ((__VALUE__) == LL_TIM_IC_FILTER_FDIV2_N8) \
|| ((__VALUE__) == LL_TIM_IC_FILTER_FDIV4_N6) \
|| ((__VALUE__) == LL_TIM_IC_FILTER_FDIV4_N8) \
|| ((__VALUE__) == LL_TIM_IC_FILTER_FDIV8_N6) \
|| ((__VALUE__) == LL_TIM_IC_FILTER_FDIV8_N8) \
|| ((__VALUE__) == LL_TIM_IC_FILTER_FDIV16_N5) \
|| ((__VALUE__) == LL_TIM_IC_FILTER_FDIV16_N6) \
|| ((__VALUE__) == LL_TIM_IC_FILTER_FDIV16_N8) \
|| ((__VALUE__) == LL_TIM_IC_FILTER_FDIV32_N5) \
|| ((__VALUE__) == LL_TIM_IC_FILTER_FDIV32_N6) \
|| ((__VALUE__) == LL_TIM_IC_FILTER_FDIV32_N8))
#define IS_LL_TIM_IC_POLARITY(__VALUE__) (((__VALUE__) == LL_TIM_IC_POLARITY_RISING) \
|| ((__VALUE__) == LL_TIM_IC_POLARITY_FALLING) \
|| ((__VALUE__) == LL_TIM_IC_POLARITY_BOTHEDGE))
#define IS_LL_TIM_ENCODERMODE(__VALUE__) (((__VALUE__) == LL_TIM_ENCODERMODE_X2_TI1) \
|| ((__VALUE__) == LL_TIM_ENCODERMODE_X2_TI2) \
|| ((__VALUE__) == LL_TIM_ENCODERMODE_X4_TI12))
#define IS_LL_TIM_IC_POLARITY_ENCODER(__VALUE__) (((__VALUE__) == LL_TIM_IC_POLARITY_RISING) \
|| ((__VALUE__) == LL_TIM_IC_POLARITY_FALLING))
#define IS_LL_TIM_OSSR_STATE(__VALUE__) (((__VALUE__) == LL_TIM_OSSR_DISABLE) \
|| ((__VALUE__) == LL_TIM_OSSR_ENABLE))
#define IS_LL_TIM_OSSI_STATE(__VALUE__) (((__VALUE__) == LL_TIM_OSSI_DISABLE) \
|| ((__VALUE__) == LL_TIM_OSSI_ENABLE))
#define IS_LL_TIM_LOCK_LEVEL(__VALUE__) (((__VALUE__) == LL_TIM_LOCKLEVEL_OFF) \
|| ((__VALUE__) == LL_TIM_LOCKLEVEL_1) \
|| ((__VALUE__) == LL_TIM_LOCKLEVEL_2) \
|| ((__VALUE__) == LL_TIM_LOCKLEVEL_3))
#define IS_LL_TIM_BREAK_STATE(__VALUE__) (((__VALUE__) == LL_TIM_BREAK_DISABLE) \
|| ((__VALUE__) == LL_TIM_BREAK_ENABLE))
#define IS_LL_TIM_BREAK_POLARITY(__VALUE__) (((__VALUE__) == LL_TIM_BREAK_POLARITY_LOW) \
|| ((__VALUE__) == LL_TIM_BREAK_POLARITY_HIGH))
#define IS_LL_TIM_BREAK_FILTER(__VALUE__) (((__VALUE__) == LL_TIM_BREAK_FILTER_FDIV1) \
|| ((__VALUE__) == LL_TIM_BREAK_FILTER_FDIV1_N2) \
|| ((__VALUE__) == LL_TIM_BREAK_FILTER_FDIV1_N4) \
|| ((__VALUE__) == LL_TIM_BREAK_FILTER_FDIV1_N8) \
|| ((__VALUE__) == LL_TIM_BREAK_FILTER_FDIV2_N6) \
|| ((__VALUE__) == LL_TIM_BREAK_FILTER_FDIV2_N8) \
|| ((__VALUE__) == LL_TIM_BREAK_FILTER_FDIV4_N6) \
|| ((__VALUE__) == LL_TIM_BREAK_FILTER_FDIV4_N8) \
|| ((__VALUE__) == LL_TIM_BREAK_FILTER_FDIV8_N6) \
|| ((__VALUE__) == LL_TIM_BREAK_FILTER_FDIV8_N8) \
|| ((__VALUE__) == LL_TIM_BREAK_FILTER_FDIV16_N5) \
|| ((__VALUE__) == LL_TIM_BREAK_FILTER_FDIV16_N6) \
|| ((__VALUE__) == LL_TIM_BREAK_FILTER_FDIV16_N8) \
|| ((__VALUE__) == LL_TIM_BREAK_FILTER_FDIV32_N5) \
|| ((__VALUE__) == LL_TIM_BREAK_FILTER_FDIV32_N6) \
|| ((__VALUE__) == LL_TIM_BREAK_FILTER_FDIV32_N8))
#define IS_LL_TIM_BREAK2_STATE(__VALUE__) (((__VALUE__) == LL_TIM_BREAK2_DISABLE) \
|| ((__VALUE__) == LL_TIM_BREAK2_ENABLE))
#define IS_LL_TIM_BREAK2_POLARITY(__VALUE__) (((__VALUE__) == LL_TIM_BREAK2_POLARITY_LOW) \
|| ((__VALUE__) == LL_TIM_BREAK2_POLARITY_HIGH))
#define IS_LL_TIM_BREAK2_FILTER(__VALUE__) (((__VALUE__) == LL_TIM_BREAK2_FILTER_FDIV1) \
|| ((__VALUE__) == LL_TIM_BREAK2_FILTER_FDIV1_N2) \
|| ((__VALUE__) == LL_TIM_BREAK2_FILTER_FDIV1_N4) \
|| ((__VALUE__) == LL_TIM_BREAK2_FILTER_FDIV1_N8) \
|| ((__VALUE__) == LL_TIM_BREAK2_FILTER_FDIV2_N6) \
|| ((__VALUE__) == LL_TIM_BREAK2_FILTER_FDIV2_N8) \
|| ((__VALUE__) == LL_TIM_BREAK2_FILTER_FDIV4_N6) \
|| ((__VALUE__) == LL_TIM_BREAK2_FILTER_FDIV4_N8) \
|| ((__VALUE__) == LL_TIM_BREAK2_FILTER_FDIV8_N6) \
|| ((__VALUE__) == LL_TIM_BREAK2_FILTER_FDIV8_N8) \
|| ((__VALUE__) == LL_TIM_BREAK2_FILTER_FDIV16_N5) \
|| ((__VALUE__) == LL_TIM_BREAK2_FILTER_FDIV16_N6) \
|| ((__VALUE__) == LL_TIM_BREAK2_FILTER_FDIV16_N8) \
|| ((__VALUE__) == LL_TIM_BREAK2_FILTER_FDIV32_N5) \
|| ((__VALUE__) == LL_TIM_BREAK2_FILTER_FDIV32_N6) \
|| ((__VALUE__) == LL_TIM_BREAK2_FILTER_FDIV32_N8))
#define IS_LL_TIM_AUTOMATIC_OUTPUT_STATE(__VALUE__) (((__VALUE__) == LL_TIM_AUTOMATICOUTPUT_DISABLE) \
|| ((__VALUE__) == LL_TIM_AUTOMATICOUTPUT_ENABLE))
/**
* @}
*/
/* Private function prototypes -----------------------------------------------*/
/** @defgroup TIM_LL_Private_Functions TIM Private Functions
* @{
*/
static ErrorStatus OC1Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct);
static ErrorStatus OC2Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct);
static ErrorStatus OC3Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct);
static ErrorStatus OC4Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct);
static ErrorStatus OC5Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct);
static ErrorStatus OC6Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct);
static ErrorStatus IC1Config(TIM_TypeDef *TIMx, LL_TIM_IC_InitTypeDef *TIM_ICInitStruct);
static ErrorStatus IC2Config(TIM_TypeDef *TIMx, LL_TIM_IC_InitTypeDef *TIM_ICInitStruct);
static ErrorStatus IC3Config(TIM_TypeDef *TIMx, LL_TIM_IC_InitTypeDef *TIM_ICInitStruct);
static ErrorStatus IC4Config(TIM_TypeDef *TIMx, LL_TIM_IC_InitTypeDef *TIM_ICInitStruct);
/**
* @}
*/
/* Exported functions --------------------------------------------------------*/
/** @addtogroup TIM_LL_Exported_Functions
* @{
*/
/** @addtogroup TIM_LL_EF_Init
* @{
*/
/**
* @brief Set TIMx registers to their reset values.
* @param TIMx Timer instance
* @retval An ErrorStatus enumeration value:
* - SUCCESS: TIMx registers are de-initialized
* - ERROR: invalid TIMx instance
*/
ErrorStatus LL_TIM_DeInit(TIM_TypeDef *TIMx)
{
ErrorStatus result = SUCCESS;
/* Check the parameters */
assert_param(IS_TIM_INSTANCE(TIMx));
if (TIMx == TIM1)
{
LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_TIM1);
LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_TIM1);
}
else if (TIMx == TIM2)
{
LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_TIM2);
LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_TIM2);
}
#if defined(TIM3)
else if (TIMx == TIM3)
{
LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_TIM3);
LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_TIM3);
}
#endif
#if defined(TIM4)
else if (TIMx == TIM4)
{
LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_TIM4);
LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_TIM4);
}
#endif
#if defined(TIM5)
else if (TIMx == TIM5)
{
LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_TIM5);
LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_TIM5);
}
#endif
else if (TIMx == TIM6)
{
LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_TIM6);
LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_TIM6);
}
#if defined (TIM7)
else if (TIMx == TIM7)
{
LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_TIM7);
LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_TIM7);
}
#endif
#if defined(TIM8)
else if (TIMx == TIM8)
{
LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_TIM8);
LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_TIM8);
}
#endif
else if (TIMx == TIM15)
{
LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_TIM15);
LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_TIM15);
}
else if (TIMx == TIM16)
{
LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_TIM16);
LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_TIM16);
}
#if defined(TIM17)
else if (TIMx == TIM17)
{
LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_TIM17);
LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_TIM17);
}
#endif
else
{
result = ERROR;
}
return result;
}
/**
* @brief Set the fields of the time base unit configuration data structure
* to their default values.
* @param TIM_InitStruct pointer to a @ref LL_TIM_InitTypeDef structure (time base unit configuration data structure)
* @retval None
*/
void LL_TIM_StructInit(LL_TIM_InitTypeDef *TIM_InitStruct)
{
/* Set the default configuration */
TIM_InitStruct->Prescaler = (uint16_t)0x0000U;
TIM_InitStruct->CounterMode = LL_TIM_COUNTERMODE_UP;
TIM_InitStruct->Autoreload = 0xFFFFFFFFU;
TIM_InitStruct->ClockDivision = LL_TIM_CLOCKDIVISION_DIV1;
TIM_InitStruct->RepetitionCounter = (uint8_t)0x00U;
}
/**
* @brief Configure the TIMx time base unit.
* @param TIMx Timer Instance
* @param TIM_InitStruct pointer to a @ref LL_TIM_InitTypeDef structure (TIMx time base unit configuration data structure)
* @retval An ErrorStatus enumeration value:
* - SUCCESS: TIMx registers are de-initialized
* - ERROR: not applicable
*/
ErrorStatus LL_TIM_Init(TIM_TypeDef *TIMx, LL_TIM_InitTypeDef *TIM_InitStruct)
{
uint32_t tmpcr1 = 0U;
/* Check the parameters */
assert_param(IS_TIM_INSTANCE(TIMx));
assert_param(IS_LL_TIM_COUNTERMODE(TIM_InitStruct->CounterMode));
assert_param(IS_LL_TIM_CLOCKDIVISION(TIM_InitStruct->ClockDivision));
tmpcr1 = LL_TIM_ReadReg(TIMx, CR1);
if (IS_TIM_COUNTER_MODE_SELECT_INSTANCE(TIMx))
{
/* Select the Counter Mode */
MODIFY_REG(tmpcr1, (TIM_CR1_DIR | TIM_CR1_CMS), TIM_InitStruct->CounterMode);
}
if (IS_TIM_CLOCK_DIVISION_INSTANCE(TIMx))
{
/* Set the clock division */
MODIFY_REG(tmpcr1, TIM_CR1_CKD, TIM_InitStruct->ClockDivision);
}
/* Write to TIMx CR1 */
LL_TIM_WriteReg(TIMx, CR1, tmpcr1);
/* Set the Autoreload value */
LL_TIM_SetAutoReload(TIMx, TIM_InitStruct->Autoreload);
/* Set the Prescaler value */
LL_TIM_SetPrescaler(TIMx, TIM_InitStruct->Prescaler);
if (IS_TIM_REPETITION_COUNTER_INSTANCE(TIMx))
{
/* Set the Repetition Counter value */
LL_TIM_SetRepetitionCounter(TIMx, TIM_InitStruct->RepetitionCounter);
}
/* Generate an update event to reload the Prescaler
and the repetition counter value (if applicable) immediately */
LL_TIM_GenerateEvent_UPDATE(TIMx);
return SUCCESS;
}
/**
* @brief Set the fields of the TIMx output channel configuration data
* structure to their default values.
* @param TIM_OC_InitStruct pointer to a @ref LL_TIM_OC_InitTypeDef structure (the output channel configuration data structure)
* @retval None
*/
void LL_TIM_OC_StructInit(LL_TIM_OC_InitTypeDef *TIM_OC_InitStruct)
{
/* Set the default configuration */
TIM_OC_InitStruct->OCMode = LL_TIM_OCMODE_FROZEN;
TIM_OC_InitStruct->OCState = LL_TIM_OCSTATE_DISABLE;
TIM_OC_InitStruct->OCNState = LL_TIM_OCSTATE_DISABLE;
TIM_OC_InitStruct->CompareValue = 0x00000000U;
TIM_OC_InitStruct->OCPolarity = LL_TIM_OCPOLARITY_HIGH;
TIM_OC_InitStruct->OCNPolarity = LL_TIM_OCPOLARITY_HIGH;
TIM_OC_InitStruct->OCIdleState = LL_TIM_OCIDLESTATE_LOW;
TIM_OC_InitStruct->OCNIdleState = LL_TIM_OCIDLESTATE_LOW;
}
/**
* @brief Configure the TIMx output channel.
* @param TIMx Timer Instance
* @param Channel This parameter can be one of the following values:
* @arg @ref LL_TIM_CHANNEL_CH1
* @arg @ref LL_TIM_CHANNEL_CH2
* @arg @ref LL_TIM_CHANNEL_CH3
* @arg @ref LL_TIM_CHANNEL_CH4
* @arg @ref LL_TIM_CHANNEL_CH5
* @arg @ref LL_TIM_CHANNEL_CH6
* @param TIM_OC_InitStruct pointer to a @ref LL_TIM_OC_InitTypeDef structure (TIMx output channel configuration data structure)
* @retval An ErrorStatus enumeration value:
* - SUCCESS: TIMx output channel is initialized
* - ERROR: TIMx output channel is not initialized
*/
ErrorStatus LL_TIM_OC_Init(TIM_TypeDef *TIMx, uint32_t Channel, LL_TIM_OC_InitTypeDef *TIM_OC_InitStruct)
{
ErrorStatus result = ERROR;
switch (Channel)
{
case LL_TIM_CHANNEL_CH1:
result = OC1Config(TIMx, TIM_OC_InitStruct);
break;
case LL_TIM_CHANNEL_CH2:
result = OC2Config(TIMx, TIM_OC_InitStruct);
break;
case LL_TIM_CHANNEL_CH3:
result = OC3Config(TIMx, TIM_OC_InitStruct);
break;
case LL_TIM_CHANNEL_CH4:
result = OC4Config(TIMx, TIM_OC_InitStruct);
break;
case LL_TIM_CHANNEL_CH5:
result = OC5Config(TIMx, TIM_OC_InitStruct);
break;
case LL_TIM_CHANNEL_CH6:
result = OC6Config(TIMx, TIM_OC_InitStruct);
break;
default:
break;
}
return result;
}
/**
* @brief Set the fields of the TIMx input channel configuration data
* structure to their default values.
* @param TIM_ICInitStruct pointer to a @ref LL_TIM_IC_InitTypeDef structure (the input channel configuration data structure)
* @retval None
*/
void LL_TIM_IC_StructInit(LL_TIM_IC_InitTypeDef *TIM_ICInitStruct)
{
/* Set the default configuration */
TIM_ICInitStruct->ICPolarity = LL_TIM_IC_POLARITY_RISING;
TIM_ICInitStruct->ICActiveInput = LL_TIM_ACTIVEINPUT_DIRECTTI;
TIM_ICInitStruct->ICPrescaler = LL_TIM_ICPSC_DIV1;
TIM_ICInitStruct->ICFilter = LL_TIM_IC_FILTER_FDIV1;
}
/**
* @brief Configure the TIMx input channel.
* @param TIMx Timer Instance
* @param Channel This parameter can be one of the following values:
* @arg @ref LL_TIM_CHANNEL_CH1
* @arg @ref LL_TIM_CHANNEL_CH2
* @arg @ref LL_TIM_CHANNEL_CH3
* @arg @ref LL_TIM_CHANNEL_CH4
* @param TIM_IC_InitStruct pointer to a @ref LL_TIM_IC_InitTypeDef structure (TIMx input channel configuration data structure)
* @retval An ErrorStatus enumeration value:
* - SUCCESS: TIMx output channel is initialized
* - ERROR: TIMx output channel is not initialized
*/
ErrorStatus LL_TIM_IC_Init(TIM_TypeDef *TIMx, uint32_t Channel, LL_TIM_IC_InitTypeDef *TIM_IC_InitStruct)
{
ErrorStatus result = ERROR;
switch (Channel)
{
case LL_TIM_CHANNEL_CH1:
result = IC1Config(TIMx, TIM_IC_InitStruct);
break;
case LL_TIM_CHANNEL_CH2:
result = IC2Config(TIMx, TIM_IC_InitStruct);
break;
case LL_TIM_CHANNEL_CH3:
result = IC3Config(TIMx, TIM_IC_InitStruct);
break;
case LL_TIM_CHANNEL_CH4:
result = IC4Config(TIMx, TIM_IC_InitStruct);
break;
default:
break;
}
return result;
}
/**
* @brief Fills each TIM_EncoderInitStruct field with its default value
* @param TIM_EncoderInitStruct pointer to a @ref LL_TIM_ENCODER_InitTypeDef structure (encoder interface configuration data structure)
* @retval None
*/
void LL_TIM_ENCODER_StructInit(LL_TIM_ENCODER_InitTypeDef *TIM_EncoderInitStruct)
{
/* Set the default configuration */
TIM_EncoderInitStruct->EncoderMode = LL_TIM_ENCODERMODE_X2_TI1;
TIM_EncoderInitStruct->IC1Polarity = LL_TIM_IC_POLARITY_RISING;
TIM_EncoderInitStruct->IC1ActiveInput = LL_TIM_ACTIVEINPUT_DIRECTTI;
TIM_EncoderInitStruct->IC1Prescaler = LL_TIM_ICPSC_DIV1;
TIM_EncoderInitStruct->IC1Filter = LL_TIM_IC_FILTER_FDIV1;
TIM_EncoderInitStruct->IC2Polarity = LL_TIM_IC_POLARITY_RISING;
TIM_EncoderInitStruct->IC2ActiveInput = LL_TIM_ACTIVEINPUT_DIRECTTI;
TIM_EncoderInitStruct->IC2Prescaler = LL_TIM_ICPSC_DIV1;
TIM_EncoderInitStruct->IC2Filter = LL_TIM_IC_FILTER_FDIV1;
}
/**
* @brief Configure the encoder interface of the timer instance.
* @param TIMx Timer Instance
* @param TIM_EncoderInitStruct pointer to a @ref LL_TIM_ENCODER_InitTypeDef structure (TIMx encoder interface configuration data structure)
* @retval An ErrorStatus enumeration value:
* - SUCCESS: TIMx registers are de-initialized
* - ERROR: not applicable
*/
ErrorStatus LL_TIM_ENCODER_Init(TIM_TypeDef *TIMx, LL_TIM_ENCODER_InitTypeDef *TIM_EncoderInitStruct)
{
uint32_t tmpccmr1 = 0U;
uint32_t tmpccer = 0U;
/* Check the parameters */
assert_param(IS_TIM_ENCODER_INTERFACE_INSTANCE(TIMx));
assert_param(IS_LL_TIM_ENCODERMODE(TIM_EncoderInitStruct->EncoderMode));
assert_param(IS_LL_TIM_IC_POLARITY_ENCODER(TIM_EncoderInitStruct->IC1Polarity));
assert_param(IS_LL_TIM_ACTIVEINPUT(TIM_EncoderInitStruct->IC1ActiveInput));
assert_param(IS_LL_TIM_ICPSC(TIM_EncoderInitStruct->IC1Prescaler));
assert_param(IS_LL_TIM_IC_FILTER(TIM_EncoderInitStruct->IC1Filter));
assert_param(IS_LL_TIM_IC_POLARITY_ENCODER(TIM_EncoderInitStruct->IC2Polarity));
assert_param(IS_LL_TIM_ACTIVEINPUT(TIM_EncoderInitStruct->IC2ActiveInput));
assert_param(IS_LL_TIM_ICPSC(TIM_EncoderInitStruct->IC2Prescaler));
assert_param(IS_LL_TIM_IC_FILTER(TIM_EncoderInitStruct->IC2Filter));
/* Disable the CC1 and CC2: Reset the CC1E and CC2E Bits */
TIMx->CCER &= (uint32_t)~(TIM_CCER_CC1E | TIM_CCER_CC2E);
/* Get the TIMx CCMR1 register value */
tmpccmr1 = LL_TIM_ReadReg(TIMx, CCMR1);
/* Get the TIMx CCER register value */
tmpccer = LL_TIM_ReadReg(TIMx, CCER);
/* Configure TI1 */
tmpccmr1 &= (uint32_t)~(TIM_CCMR1_CC1S | TIM_CCMR1_IC1F | TIM_CCMR1_IC1PSC);
tmpccmr1 |= (uint32_t)(TIM_EncoderInitStruct->IC1ActiveInput >> 16U);
tmpccmr1 |= (uint32_t)(TIM_EncoderInitStruct->IC1Filter >> 16U);
tmpccmr1 |= (uint32_t)(TIM_EncoderInitStruct->IC1Prescaler >> 16U);
/* Configure TI2 */
tmpccmr1 &= (uint32_t)~(TIM_CCMR1_CC2S | TIM_CCMR1_IC2F | TIM_CCMR1_IC2PSC);
tmpccmr1 |= (uint32_t)(TIM_EncoderInitStruct->IC2ActiveInput >> 8U);
tmpccmr1 |= (uint32_t)(TIM_EncoderInitStruct->IC2Filter >> 8U);
tmpccmr1 |= (uint32_t)(TIM_EncoderInitStruct->IC2Prescaler >> 8U);
/* Set TI1 and TI2 polarity and enable TI1 and TI2 */
tmpccer &= (uint32_t)~(TIM_CCER_CC1P | TIM_CCER_CC1NP | TIM_CCER_CC2P | TIM_CCER_CC2NP);
tmpccer |= (uint32_t)(TIM_EncoderInitStruct->IC1Polarity);
tmpccer |= (uint32_t)(TIM_EncoderInitStruct->IC2Polarity << 4U);
tmpccer |= (uint32_t)(TIM_CCER_CC1E | TIM_CCER_CC2E);
/* Set encoder mode */
LL_TIM_SetEncoderMode(TIMx, TIM_EncoderInitStruct->EncoderMode);
/* Write to TIMx CCMR1 */
LL_TIM_WriteReg(TIMx, CCMR1, tmpccmr1);
/* Write to TIMx CCER */
LL_TIM_WriteReg(TIMx, CCER, tmpccer);
return SUCCESS;
}
/**
* @brief Set the fields of the TIMx Hall sensor interface configuration data
* structure to their default values.
* @param TIM_HallSensorInitStruct pointer to a @ref LL_TIM_HALLSENSOR_InitTypeDef structure (HALL sensor interface configuration data structure)
* @retval None
*/
void LL_TIM_HALLSENSOR_StructInit(LL_TIM_HALLSENSOR_InitTypeDef *TIM_HallSensorInitStruct)
{
/* Set the default configuration */
TIM_HallSensorInitStruct->IC1Polarity = LL_TIM_IC_POLARITY_RISING;
TIM_HallSensorInitStruct->IC1Prescaler = LL_TIM_ICPSC_DIV1;
TIM_HallSensorInitStruct->IC1Filter = LL_TIM_IC_FILTER_FDIV1;
TIM_HallSensorInitStruct->CommutationDelay = 0U;
}
/**
* @brief Configure the Hall sensor interface of the timer instance.
* @note TIMx CH1, CH2 and CH3 inputs connected through a XOR
* to the TI1 input channel
* @note TIMx slave mode controller is configured in reset mode.
Selected internal trigger is TI1F_ED.
* @note Channel 1 is configured as input, IC1 is mapped on TRC.
* @note Captured value stored in TIMx_CCR1 correspond to the time elapsed
* between 2 changes on the inputs. It gives information about motor speed.
* @note Channel 2 is configured in output PWM 2 mode.
* @note Compare value stored in TIMx_CCR2 corresponds to the commutation delay.
* @note OC2REF is selected as trigger output on TRGO.
* @note LL_TIM_IC_POLARITY_BOTHEDGE must not be used for TI1 when it is used
* when TIMx operates in Hall sensor interface mode.
* @param TIMx Timer Instance
* @param TIM_HallSensorInitStruct pointer to a @ref LL_TIM_HALLSENSOR_InitTypeDef structure (TIMx HALL sensor interface configuration data structure)
* @retval An ErrorStatus enumeration value:
* - SUCCESS: TIMx registers are de-initialized
* - ERROR: not applicable
*/
ErrorStatus LL_TIM_HALLSENSOR_Init(TIM_TypeDef *TIMx, LL_TIM_HALLSENSOR_InitTypeDef *TIM_HallSensorInitStruct)
{
uint32_t tmpcr2 = 0U;
uint32_t tmpccmr1 = 0U;
uint32_t tmpccer = 0U;
uint32_t tmpsmcr = 0U;
/* Check the parameters */
assert_param(IS_TIM_HALL_SENSOR_INTERFACE_INSTANCE(TIMx));
assert_param(IS_LL_TIM_IC_POLARITY_ENCODER(TIM_HallSensorInitStruct->IC1Polarity));
assert_param(IS_LL_TIM_ICPSC(TIM_HallSensorInitStruct->IC1Prescaler));
assert_param(IS_LL_TIM_IC_FILTER(TIM_HallSensorInitStruct->IC1Filter));
/* Disable the CC1 and CC2: Reset the CC1E and CC2E Bits */
TIMx->CCER &= (uint32_t)~(TIM_CCER_CC1E | TIM_CCER_CC2E);
/* Get the TIMx CR2 register value */
tmpcr2 = LL_TIM_ReadReg(TIMx, CR2);
/* Get the TIMx CCMR1 register value */
tmpccmr1 = LL_TIM_ReadReg(TIMx, CCMR1);
/* Get the TIMx CCER register value */
tmpccer = LL_TIM_ReadReg(TIMx, CCER);
/* Get the TIMx SMCR register value */
tmpsmcr = LL_TIM_ReadReg(TIMx, SMCR);
/* Connect TIMx_CH1, CH2 and CH3 pins to the TI1 input */
tmpcr2 |= TIM_CR2_TI1S;
/* OC2REF signal is used as trigger output (TRGO) */
tmpcr2 |= LL_TIM_TRGO_OC2REF;
/* Configure the slave mode controller */
tmpsmcr &= (uint32_t)~(TIM_SMCR_TS | TIM_SMCR_SMS);
tmpsmcr |= LL_TIM_TS_TI1F_ED;
tmpsmcr |= LL_TIM_SLAVEMODE_RESET;
/* Configure input channel 1 */
tmpccmr1 &= (uint32_t)~(TIM_CCMR1_CC1S | TIM_CCMR1_IC1F | TIM_CCMR1_IC1PSC);
tmpccmr1 |= (uint32_t)(LL_TIM_ACTIVEINPUT_TRC >> 16U);
tmpccmr1 |= (uint32_t)(TIM_HallSensorInitStruct->IC1Filter >> 16U);
tmpccmr1 |= (uint32_t)(TIM_HallSensorInitStruct->IC1Prescaler >> 16U);
/* Configure input channel 2 */
tmpccmr1 &= (uint32_t)~(TIM_CCMR1_OC2M | TIM_CCMR1_OC2FE | TIM_CCMR1_OC2PE | TIM_CCMR1_OC2CE);
tmpccmr1 |= (uint32_t)(LL_TIM_OCMODE_PWM2 << 8U);
/* Set Channel 1 polarity and enable Channel 1 and Channel2 */
tmpccer &= (uint32_t)~(TIM_CCER_CC1P | TIM_CCER_CC1NP | TIM_CCER_CC2P | TIM_CCER_CC2NP);
tmpccer |= (uint32_t)(TIM_HallSensorInitStruct->IC1Polarity);
tmpccer |= (uint32_t)(TIM_CCER_CC1E | TIM_CCER_CC2E);
/* Write to TIMx CR2 */
LL_TIM_WriteReg(TIMx, CR2, tmpcr2);
/* Write to TIMx SMCR */
LL_TIM_WriteReg(TIMx, SMCR, tmpsmcr);
/* Write to TIMx CCMR1 */
LL_TIM_WriteReg(TIMx, CCMR1, tmpccmr1);
/* Write to TIMx CCER */
LL_TIM_WriteReg(TIMx, CCER, tmpccer);
/* Write to TIMx CCR2 */
LL_TIM_OC_SetCompareCH2(TIMx, TIM_HallSensorInitStruct->CommutationDelay);
return SUCCESS;
}
/**
* @brief Set the fields of the Break and Dead Time configuration data structure
* to their default values.
* @param TIM_BDTRInitStruct pointer to a @ref LL_TIM_BDTR_InitTypeDef structure (Break and Dead Time configuration data structure)
* @retval None
*/
void LL_TIM_BDTR_StructInit(LL_TIM_BDTR_InitTypeDef *TIM_BDTRInitStruct)
{
/* Set the default configuration */
TIM_BDTRInitStruct->OSSRState = LL_TIM_OSSR_DISABLE;
TIM_BDTRInitStruct->OSSIState = LL_TIM_OSSI_DISABLE;
TIM_BDTRInitStruct->LockLevel = LL_TIM_LOCKLEVEL_OFF;
TIM_BDTRInitStruct->DeadTime = (uint8_t)0x00U;
TIM_BDTRInitStruct->BreakState = LL_TIM_BREAK_DISABLE;
TIM_BDTRInitStruct->BreakPolarity = LL_TIM_BREAK_POLARITY_LOW;
TIM_BDTRInitStruct->BreakFilter = LL_TIM_BREAK_FILTER_FDIV1;
TIM_BDTRInitStruct->Break2State = LL_TIM_BREAK2_DISABLE;
TIM_BDTRInitStruct->Break2Polarity = LL_TIM_BREAK2_POLARITY_LOW;
TIM_BDTRInitStruct->Break2Filter = LL_TIM_BREAK2_FILTER_FDIV1;
TIM_BDTRInitStruct->AutomaticOutput = LL_TIM_AUTOMATICOUTPUT_DISABLE;
}
/**
* @brief Configure the Break and Dead Time feature of the timer instance.
* @note As the bits BK2P, BK2E, BK2F[3:0], BKF[3:0], AOE, BKP, BKE, OSSI, OSSR
* and DTG[7:0] can be write-locked depending on the LOCK configuration, it
* can be necessary to configure all of them during the first write access to
* the TIMx_BDTR register.
* @note Macro @ref IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not
* a timer instance provides a break input.
* @note Macro @ref IS_TIM_BKIN2_INSTANCE(TIMx) can be used to check whether or not
* a timer instance provides a second break input.
* @param TIMx Timer Instance
* @param TIM_BDTRInitStruct pointer to a @ref LL_TIM_BDTR_InitTypeDef structure (Break and Dead Time configuration data structure)
* @retval An ErrorStatus enumeration value:
* - SUCCESS: Break and Dead Time is initialized
* - ERROR: not applicable
*/
ErrorStatus LL_TIM_BDTR_Init(TIM_TypeDef *TIMx, LL_TIM_BDTR_InitTypeDef *TIM_BDTRInitStruct)
{
uint32_t tmpbdtr = 0;
/* Check the parameters */
assert_param(IS_TIM_BREAK_INSTANCE(TIMx));
assert_param(IS_LL_TIM_OSSR_STATE(TIM_BDTRInitStruct->OSSRState));
assert_param(IS_LL_TIM_OSSI_STATE(TIM_BDTRInitStruct->OSSIState));
assert_param(IS_LL_TIM_LOCK_LEVEL(TIM_BDTRInitStruct->LockLevel));
assert_param(IS_LL_TIM_BREAK_STATE(TIM_BDTRInitStruct->BreakState));
assert_param(IS_LL_TIM_BREAK_POLARITY(TIM_BDTRInitStruct->BreakPolarity));
assert_param(IS_LL_TIM_AUTOMATIC_OUTPUT_STATE(TIM_BDTRInitStruct->AutomaticOutput));
/* Set the Lock level, the Break enable Bit and the Polarity, the OSSR State,
the OSSI State, the dead time value and the Automatic Output Enable Bit */
/* Set the BDTR bits */
MODIFY_REG(tmpbdtr, TIM_BDTR_DTG, TIM_BDTRInitStruct->DeadTime);
MODIFY_REG(tmpbdtr, TIM_BDTR_LOCK, TIM_BDTRInitStruct->LockLevel);
MODIFY_REG(tmpbdtr, TIM_BDTR_OSSI, TIM_BDTRInitStruct->OSSIState);
MODIFY_REG(tmpbdtr, TIM_BDTR_OSSR, TIM_BDTRInitStruct->OSSRState);
MODIFY_REG(tmpbdtr, TIM_BDTR_BKE, TIM_BDTRInitStruct->BreakState);
MODIFY_REG(tmpbdtr, TIM_BDTR_BKP, TIM_BDTRInitStruct->BreakPolarity);
MODIFY_REG(tmpbdtr, TIM_BDTR_AOE, TIM_BDTRInitStruct->AutomaticOutput);
MODIFY_REG(tmpbdtr, TIM_BDTR_MOE, TIM_BDTRInitStruct->AutomaticOutput);
if (IS_TIM_ADVANCED_INSTANCE(TIMx))
{
assert_param(IS_LL_TIM_BREAK_FILTER(TIM_BDTRInitStruct->BreakFilter));
MODIFY_REG(tmpbdtr, TIM_BDTR_BKF, TIM_BDTRInitStruct->BreakFilter);
}
if (IS_TIM_BKIN2_INSTANCE(TIMx))
{
assert_param(IS_LL_TIM_BREAK2_STATE(TIM_BDTRInitStruct->Break2State));
assert_param(IS_LL_TIM_BREAK2_POLARITY(TIM_BDTRInitStruct->Break2Polarity));
assert_param(IS_LL_TIM_BREAK2_FILTER(TIM_BDTRInitStruct->Break2Filter));
/* Set the BREAK2 input related BDTR bit-fields */
MODIFY_REG(tmpbdtr, TIM_BDTR_BK2F, (TIM_BDTRInitStruct->Break2Filter));
MODIFY_REG(tmpbdtr, TIM_BDTR_BK2E, TIM_BDTRInitStruct->Break2State);
MODIFY_REG(tmpbdtr, TIM_BDTR_BK2P, TIM_BDTRInitStruct->Break2Polarity);
}
/* Set TIMx_BDTR */
LL_TIM_WriteReg(TIMx, BDTR, tmpbdtr);
return SUCCESS;
}
/**
* @}
*/
/**
* @}
*/
/** @addtogroup TIM_LL_Private_Functions TIM Private Functions
* @brief Private functions
* @{
*/
/**
* @brief Configure the TIMx output channel 1.
* @param TIMx Timer Instance
* @param TIM_OCInitStruct pointer to the the TIMx output channel 1 configuration data structure
* @retval An ErrorStatus enumeration value:
* - SUCCESS: TIMx registers are de-initialized
* - ERROR: not applicable
*/
static ErrorStatus OC1Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct)
{
uint32_t tmpccmr1 = 0U;
uint32_t tmpccer = 0U;
uint32_t tmpcr2 = 0U;
/* Check the parameters */
assert_param(IS_TIM_CC1_INSTANCE(TIMx));
assert_param(IS_LL_TIM_OCMODE(TIM_OCInitStruct->OCMode));
assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCState));
assert_param(IS_LL_TIM_OCPOLARITY(TIM_OCInitStruct->OCPolarity));
assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCNState));
assert_param(IS_LL_TIM_OCPOLARITY(TIM_OCInitStruct->OCNPolarity));
/* Disable the Channel 1: Reset the CC1E Bit */
CLEAR_BIT(TIMx->CCER, TIM_CCER_CC1E);
/* Get the TIMx CCER register value */
tmpccer = LL_TIM_ReadReg(TIMx, CCER);
/* Get the TIMx CR2 register value */
tmpcr2 = LL_TIM_ReadReg(TIMx, CR2);
/* Get the TIMx CCMR1 register value */
tmpccmr1 = LL_TIM_ReadReg(TIMx, CCMR1);
/* Reset Capture/Compare selection Bits */
CLEAR_BIT(tmpccmr1, TIM_CCMR1_CC1S);
/* Set the Output Compare Mode */
MODIFY_REG(tmpccmr1, TIM_CCMR1_OC1M, TIM_OCInitStruct->OCMode);
/* Set the Output Compare Polarity */
MODIFY_REG(tmpccer, TIM_CCER_CC1P, TIM_OCInitStruct->OCPolarity);
/* Set the Output State */
MODIFY_REG(tmpccer, TIM_CCER_CC1E, TIM_OCInitStruct->OCState);
if (IS_TIM_BREAK_INSTANCE(TIMx))
{
assert_param(IS_LL_TIM_OCIDLESTATE(TIM_OCInitStruct->OCNIdleState));
assert_param(IS_LL_TIM_OCIDLESTATE(TIM_OCInitStruct->OCIdleState));
/* Set the complementary output Polarity */
MODIFY_REG(tmpccer, TIM_CCER_CC1NP, TIM_OCInitStruct->OCNPolarity << 2U);
/* Set the complementary output State */
MODIFY_REG(tmpccer, TIM_CCER_CC1NE, TIM_OCInitStruct->OCNState << 2U);
/* Set the Output Idle state */
MODIFY_REG(tmpcr2, TIM_CR2_OIS1, TIM_OCInitStruct->OCIdleState);
/* Set the complementary output Idle state */
MODIFY_REG(tmpcr2, TIM_CR2_OIS1N, TIM_OCInitStruct->OCNIdleState << 1U);
}
/* Write to TIMx CR2 */
LL_TIM_WriteReg(TIMx, CR2, tmpcr2);
/* Write to TIMx CCMR1 */
LL_TIM_WriteReg(TIMx, CCMR1, tmpccmr1);
/* Set the Capture Compare Register value */
LL_TIM_OC_SetCompareCH1(TIMx, TIM_OCInitStruct->CompareValue);
/* Write to TIMx CCER */
LL_TIM_WriteReg(TIMx, CCER, tmpccer);
return SUCCESS;
}
/**
* @brief Configure the TIMx output channel 2.
* @param TIMx Timer Instance
* @param TIM_OCInitStruct pointer to the the TIMx output channel 2 configuration data structure
* @retval An ErrorStatus enumeration value:
* - SUCCESS: TIMx registers are de-initialized
* - ERROR: not applicable
*/
static ErrorStatus OC2Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct)
{
uint32_t tmpccmr1 = 0U;
uint32_t tmpccer = 0U;
uint32_t tmpcr2 = 0U;
/* Check the parameters */
assert_param(IS_TIM_CC2_INSTANCE(TIMx));
assert_param(IS_LL_TIM_OCMODE(TIM_OCInitStruct->OCMode));
assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCState));
assert_param(IS_LL_TIM_OCPOLARITY(TIM_OCInitStruct->OCPolarity));
assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCNState));
assert_param(IS_LL_TIM_OCPOLARITY(TIM_OCInitStruct->OCNPolarity));
/* Disable the Channel 2: Reset the CC2E Bit */
CLEAR_BIT(TIMx->CCER, TIM_CCER_CC2E);
/* Get the TIMx CCER register value */
tmpccer = LL_TIM_ReadReg(TIMx, CCER);
/* Get the TIMx CR2 register value */
tmpcr2 = LL_TIM_ReadReg(TIMx, CR2);
/* Get the TIMx CCMR1 register value */
tmpccmr1 = LL_TIM_ReadReg(TIMx, CCMR1);
/* Reset Capture/Compare selection Bits */
CLEAR_BIT(tmpccmr1, TIM_CCMR1_CC2S);
/* Select the Output Compare Mode */
MODIFY_REG(tmpccmr1, TIM_CCMR1_OC2M, TIM_OCInitStruct->OCMode << 8U);
/* Set the Output Compare Polarity */
MODIFY_REG(tmpccer, TIM_CCER_CC2P, TIM_OCInitStruct->OCPolarity << 4U);
/* Set the Output State */
MODIFY_REG(tmpccer, TIM_CCER_CC2E, TIM_OCInitStruct->OCState << 4U);
if (IS_TIM_BREAK_INSTANCE(TIMx))
{
assert_param(IS_LL_TIM_OCIDLESTATE(TIM_OCInitStruct->OCNIdleState));
assert_param(IS_LL_TIM_OCIDLESTATE(TIM_OCInitStruct->OCIdleState));
/* Set the complementary output Polarity */
MODIFY_REG(tmpccer, TIM_CCER_CC2NP, TIM_OCInitStruct->OCNPolarity << 6U);
/* Set the complementary output State */
MODIFY_REG(tmpccer, TIM_CCER_CC2NE, TIM_OCInitStruct->OCNState << 6U);
/* Set the Output Idle state */
MODIFY_REG(tmpcr2, TIM_CR2_OIS2, TIM_OCInitStruct->OCIdleState << 2U);
/* Set the complementary output Idle state */
MODIFY_REG(tmpcr2, TIM_CR2_OIS2N, TIM_OCInitStruct->OCNIdleState << 3U);
}
/* Write to TIMx CR2 */
LL_TIM_WriteReg(TIMx, CR2, tmpcr2);
/* Write to TIMx CCMR1 */
LL_TIM_WriteReg(TIMx, CCMR1, tmpccmr1);
/* Set the Capture Compare Register value */
LL_TIM_OC_SetCompareCH2(TIMx, TIM_OCInitStruct->CompareValue);
/* Write to TIMx CCER */
LL_TIM_WriteReg(TIMx, CCER, tmpccer);
return SUCCESS;
}
/**
* @brief Configure the TIMx output channel 3.
* @param TIMx Timer Instance
* @param TIM_OCInitStruct pointer to the the TIMx output channel 3 configuration data structure
* @retval An ErrorStatus enumeration value:
* - SUCCESS: TIMx registers are de-initialized
* - ERROR: not applicable
*/
static ErrorStatus OC3Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct)
{
uint32_t tmpccmr2 = 0U;
uint32_t tmpccer = 0U;
uint32_t tmpcr2 = 0U;
/* Check the parameters */
assert_param(IS_TIM_CC3_INSTANCE(TIMx));
assert_param(IS_LL_TIM_OCMODE(TIM_OCInitStruct->OCMode));
assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCState));
assert_param(IS_LL_TIM_OCPOLARITY(TIM_OCInitStruct->OCPolarity));
assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCNState));
assert_param(IS_LL_TIM_OCPOLARITY(TIM_OCInitStruct->OCNPolarity));
/* Disable the Channel 3: Reset the CC3E Bit */
CLEAR_BIT(TIMx->CCER, TIM_CCER_CC3E);
/* Get the TIMx CCER register value */
tmpccer = LL_TIM_ReadReg(TIMx, CCER);
/* Get the TIMx CR2 register value */
tmpcr2 = LL_TIM_ReadReg(TIMx, CR2);
/* Get the TIMx CCMR2 register value */
tmpccmr2 = LL_TIM_ReadReg(TIMx, CCMR2);
/* Reset Capture/Compare selection Bits */
CLEAR_BIT(tmpccmr2, TIM_CCMR2_CC3S);
/* Select the Output Compare Mode */
MODIFY_REG(tmpccmr2, TIM_CCMR2_OC3M, TIM_OCInitStruct->OCMode);
/* Set the Output Compare Polarity */
MODIFY_REG(tmpccer, TIM_CCER_CC3P, TIM_OCInitStruct->OCPolarity << 8U);
/* Set the Output State */
MODIFY_REG(tmpccer, TIM_CCER_CC3E, TIM_OCInitStruct->OCState << 8U);
if (IS_TIM_BREAK_INSTANCE(TIMx))
{
assert_param(IS_LL_TIM_OCIDLESTATE(TIM_OCInitStruct->OCNIdleState));
assert_param(IS_LL_TIM_OCIDLESTATE(TIM_OCInitStruct->OCIdleState));
/* Set the complementary output Polarity */
MODIFY_REG(tmpccer, TIM_CCER_CC3NP, TIM_OCInitStruct->OCNPolarity << 10U);
/* Set the complementary output State */
MODIFY_REG(tmpccer, TIM_CCER_CC3NE, TIM_OCInitStruct->OCNState << 10U);
/* Set the Output Idle state */
MODIFY_REG(tmpcr2, TIM_CR2_OIS3, TIM_OCInitStruct->OCIdleState << 4U);
/* Set the complementary output Idle state */
MODIFY_REG(tmpcr2, TIM_CR2_OIS3N, TIM_OCInitStruct->OCNIdleState << 5U);
}
/* Write to TIMx CR2 */
LL_TIM_WriteReg(TIMx, CR2, tmpcr2);
/* Write to TIMx CCMR2 */
LL_TIM_WriteReg(TIMx, CCMR2, tmpccmr2);
/* Set the Capture Compare Register value */
LL_TIM_OC_SetCompareCH3(TIMx, TIM_OCInitStruct->CompareValue);
/* Write to TIMx CCER */
LL_TIM_WriteReg(TIMx, CCER, tmpccer);
return SUCCESS;
}
/**
* @brief Configure the TIMx output channel 4.
* @param TIMx Timer Instance
* @param TIM_OCInitStruct pointer to the the TIMx output channel 4 configuration data structure
* @retval An ErrorStatus enumeration value:
* - SUCCESS: TIMx registers are de-initialized
* - ERROR: not applicable
*/
static ErrorStatus OC4Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct)
{
uint32_t tmpccmr2 = 0U;
uint32_t tmpccer = 0U;
uint32_t tmpcr2 = 0U;
/* Check the parameters */
assert_param(IS_TIM_CC4_INSTANCE(TIMx));
assert_param(IS_LL_TIM_OCMODE(TIM_OCInitStruct->OCMode));
assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCState));
assert_param(IS_LL_TIM_OCPOLARITY(TIM_OCInitStruct->OCPolarity));
assert_param(IS_LL_TIM_OCPOLARITY(TIM_OCInitStruct->OCNPolarity));
assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCNState));
/* Disable the Channel 4: Reset the CC4E Bit */
CLEAR_BIT(TIMx->CCER, TIM_CCER_CC4E);
/* Get the TIMx CCER register value */
tmpccer = LL_TIM_ReadReg(TIMx, CCER);
/* Get the TIMx CR2 register value */
tmpcr2 = LL_TIM_ReadReg(TIMx, CR2);
/* Get the TIMx CCMR2 register value */
tmpccmr2 = LL_TIM_ReadReg(TIMx, CCMR2);
/* Reset Capture/Compare selection Bits */
CLEAR_BIT(tmpccmr2, TIM_CCMR2_CC4S);
/* Select the Output Compare Mode */
MODIFY_REG(tmpccmr2, TIM_CCMR2_OC4M, TIM_OCInitStruct->OCMode << 8U);
/* Set the Output Compare Polarity */
MODIFY_REG(tmpccer, TIM_CCER_CC4P, TIM_OCInitStruct->OCPolarity << 12U);
/* Set the Output State */
MODIFY_REG(tmpccer, TIM_CCER_CC4E, TIM_OCInitStruct->OCState << 12U);
if (IS_TIM_BREAK_INSTANCE(TIMx))
{
assert_param(IS_LL_TIM_OCIDLESTATE(TIM_OCInitStruct->OCNIdleState));
assert_param(IS_LL_TIM_OCIDLESTATE(TIM_OCInitStruct->OCIdleState));
/* Set the Output Idle state */
MODIFY_REG(tmpcr2, TIM_CR2_OIS4, TIM_OCInitStruct->OCIdleState << 6U);
}
/* Write to TIMx CR2 */
LL_TIM_WriteReg(TIMx, CR2, tmpcr2);
/* Write to TIMx CCMR2 */
LL_TIM_WriteReg(TIMx, CCMR2, tmpccmr2);
/* Set the Capture Compare Register value */
LL_TIM_OC_SetCompareCH4(TIMx, TIM_OCInitStruct->CompareValue);
/* Write to TIMx CCER */
LL_TIM_WriteReg(TIMx, CCER, tmpccer);
return SUCCESS;
}
/**
* @brief Configure the TIMx output channel 5.
* @param TIMx Timer Instance
* @param TIM_OCInitStruct pointer to the the TIMx output channel 5 configuration data structure
* @retval An ErrorStatus enumeration value:
* - SUCCESS: TIMx registers are de-initialized
* - ERROR: not applicable
*/
static ErrorStatus OC5Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct)
{
uint32_t tmpccmr3 = 0U;
uint32_t tmpccer = 0U;
/* Check the parameters */
assert_param(IS_TIM_CC5_INSTANCE(TIMx));
assert_param(IS_LL_TIM_OCMODE(TIM_OCInitStruct->OCMode));
assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCState));
assert_param(IS_LL_TIM_OCPOLARITY(TIM_OCInitStruct->OCPolarity));
assert_param(IS_LL_TIM_OCPOLARITY(TIM_OCInitStruct->OCNPolarity));
assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCNState));
/* Disable the Channel 5: Reset the CC5E Bit */
CLEAR_BIT(TIMx->CCER, TIM_CCER_CC5E);
/* Get the TIMx CCER register value */
tmpccer = LL_TIM_ReadReg(TIMx, CCER);
/* Get the TIMx CCMR3 register value */
tmpccmr3 = LL_TIM_ReadReg(TIMx, CCMR3);
/* Select the Output Compare Mode */
MODIFY_REG(tmpccmr3, TIM_CCMR3_OC5M, TIM_OCInitStruct->OCMode);
/* Set the Output Compare Polarity */
MODIFY_REG(tmpccer, TIM_CCER_CC5P, TIM_OCInitStruct->OCPolarity << 16U);
/* Set the Output State */
MODIFY_REG(tmpccer, TIM_CCER_CC5E, TIM_OCInitStruct->OCState << 16U);
if (IS_TIM_BREAK_INSTANCE(TIMx))
{
assert_param(IS_LL_TIM_OCIDLESTATE(TIM_OCInitStruct->OCNIdleState));
assert_param(IS_LL_TIM_OCIDLESTATE(TIM_OCInitStruct->OCIdleState));
/* Set the Output Idle state */
MODIFY_REG(TIMx->CR2, TIM_CR2_OIS5, TIM_OCInitStruct->OCIdleState << 8U);
}
/* Write to TIMx CCMR3 */
LL_TIM_WriteReg(TIMx, CCMR3, tmpccmr3);
/* Set the Capture Compare Register value */
LL_TIM_OC_SetCompareCH5(TIMx, TIM_OCInitStruct->CompareValue);
/* Write to TIMx CCER */
LL_TIM_WriteReg(TIMx, CCER, tmpccer);
return SUCCESS;
}
/**
* @brief Configure the TIMx output channel 6.
* @param TIMx Timer Instance
* @param TIM_OCInitStruct pointer to the the TIMx output channel 6 configuration data structure
* @retval An ErrorStatus enumeration value:
* - SUCCESS: TIMx registers are de-initialized
* - ERROR: not applicable
*/
static ErrorStatus OC6Config(TIM_TypeDef *TIMx, LL_TIM_OC_InitTypeDef *TIM_OCInitStruct)
{
uint32_t tmpccmr3 = 0U;
uint32_t tmpccer = 0U;
/* Check the parameters */
assert_param(IS_TIM_CC6_INSTANCE(TIMx));
assert_param(IS_LL_TIM_OCMODE(TIM_OCInitStruct->OCMode));
assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCState));
assert_param(IS_LL_TIM_OCPOLARITY(TIM_OCInitStruct->OCPolarity));
assert_param(IS_LL_TIM_OCPOLARITY(TIM_OCInitStruct->OCNPolarity));
assert_param(IS_LL_TIM_OCSTATE(TIM_OCInitStruct->OCNState));
/* Disable the Channel 5: Reset the CC6E Bit */
CLEAR_BIT(TIMx->CCER, TIM_CCER_CC6E);
/* Get the TIMx CCER register value */
tmpccer = LL_TIM_ReadReg(TIMx, CCER);
/* Get the TIMx CCMR3 register value */
tmpccmr3 = LL_TIM_ReadReg(TIMx, CCMR3);
/* Select the Output Compare Mode */
MODIFY_REG(tmpccmr3, TIM_CCMR3_OC6M, TIM_OCInitStruct->OCMode << 8U);
/* Set the Output Compare Polarity */
MODIFY_REG(tmpccer, TIM_CCER_CC6P, TIM_OCInitStruct->OCPolarity << 20U);
/* Set the Output State */
MODIFY_REG(tmpccer, TIM_CCER_CC6E, TIM_OCInitStruct->OCState << 20U);
if (IS_TIM_BREAK_INSTANCE(TIMx))
{
assert_param(IS_LL_TIM_OCIDLESTATE(TIM_OCInitStruct->OCNIdleState));
assert_param(IS_LL_TIM_OCIDLESTATE(TIM_OCInitStruct->OCIdleState));
/* Set the Output Idle state */
MODIFY_REG(TIMx->CR2, TIM_CR2_OIS6, TIM_OCInitStruct->OCIdleState << 10U);
}
/* Write to TIMx CCMR3 */
LL_TIM_WriteReg(TIMx, CCMR3, tmpccmr3);
/* Set the Capture Compare Register value */
LL_TIM_OC_SetCompareCH6(TIMx, TIM_OCInitStruct->CompareValue);
/* Write to TIMx CCER */
LL_TIM_WriteReg(TIMx, CCER, tmpccer);
return SUCCESS;
}
/**
* @brief Configure the TIMx input channel 1.
* @param TIMx Timer Instance
* @param TIM_ICInitStruct pointer to the the TIMx input channel 1 configuration data structure
* @retval An ErrorStatus enumeration value:
* - SUCCESS: TIMx registers are de-initialized
* - ERROR: not applicable
*/
static ErrorStatus IC1Config(TIM_TypeDef *TIMx, LL_TIM_IC_InitTypeDef *TIM_ICInitStruct)
{
/* Check the parameters */
assert_param(IS_TIM_CC1_INSTANCE(TIMx));
assert_param(IS_LL_TIM_IC_POLARITY(TIM_ICInitStruct->ICPolarity));
assert_param(IS_LL_TIM_ACTIVEINPUT(TIM_ICInitStruct->ICActiveInput));
assert_param(IS_LL_TIM_ICPSC(TIM_ICInitStruct->ICPrescaler));
assert_param(IS_LL_TIM_IC_FILTER(TIM_ICInitStruct->ICFilter));
/* Disable the Channel 1: Reset the CC1E Bit */
TIMx->CCER &= (uint32_t)~TIM_CCER_CC1E;
/* Select the Input and set the filter and the prescaler value */
MODIFY_REG(TIMx->CCMR1,
(TIM_CCMR1_CC1S | TIM_CCMR1_IC1F | TIM_CCMR1_IC1PSC),
(TIM_ICInitStruct->ICActiveInput | TIM_ICInitStruct->ICFilter | TIM_ICInitStruct->ICPrescaler) >> 16U);
/* Select the Polarity and set the CC1E Bit */
MODIFY_REG(TIMx->CCER,
(TIM_CCER_CC1P | TIM_CCER_CC1NP),
(TIM_ICInitStruct->ICPolarity | TIM_CCER_CC1E));
return SUCCESS;
}
/**
* @brief Configure the TIMx input channel 2.
* @param TIMx Timer Instance
* @param TIM_ICInitStruct pointer to the the TIMx input channel 2 configuration data structure
* @retval An ErrorStatus enumeration value:
* - SUCCESS: TIMx registers are de-initialized
* - ERROR: not applicable
*/
static ErrorStatus IC2Config(TIM_TypeDef *TIMx, LL_TIM_IC_InitTypeDef *TIM_ICInitStruct)
{
/* Check the parameters */
assert_param(IS_TIM_CC2_INSTANCE(TIMx));
assert_param(IS_LL_TIM_IC_POLARITY(TIM_ICInitStruct->ICPolarity));
assert_param(IS_LL_TIM_ACTIVEINPUT(TIM_ICInitStruct->ICActiveInput));
assert_param(IS_LL_TIM_ICPSC(TIM_ICInitStruct->ICPrescaler));
assert_param(IS_LL_TIM_IC_FILTER(TIM_ICInitStruct->ICFilter));
/* Disable the Channel 2: Reset the CC2E Bit */
TIMx->CCER &= (uint32_t)~TIM_CCER_CC2E;
/* Select the Input and set the filter and the prescaler value */
MODIFY_REG(TIMx->CCMR1,
(TIM_CCMR1_CC2S | TIM_CCMR1_IC2F | TIM_CCMR1_IC2PSC),
(TIM_ICInitStruct->ICActiveInput | TIM_ICInitStruct->ICFilter | TIM_ICInitStruct->ICPrescaler) >> 8U);
/* Select the Polarity and set the CC2E Bit */
MODIFY_REG(TIMx->CCER,
(TIM_CCER_CC2P | TIM_CCER_CC2NP),
((TIM_ICInitStruct->ICPolarity << 4U) | TIM_CCER_CC2E));
return SUCCESS;
}
/**
* @brief Configure the TIMx input channel 3.
* @param TIMx Timer Instance
* @param TIM_ICInitStruct pointer to the the TIMx input channel 3 configuration data structure
* @retval An ErrorStatus enumeration value:
* - SUCCESS: TIMx registers are de-initialized
* - ERROR: not applicable
*/
static ErrorStatus IC3Config(TIM_TypeDef *TIMx, LL_TIM_IC_InitTypeDef *TIM_ICInitStruct)
{
/* Check the parameters */
assert_param(IS_TIM_CC3_INSTANCE(TIMx));
assert_param(IS_LL_TIM_IC_POLARITY(TIM_ICInitStruct->ICPolarity));
assert_param(IS_LL_TIM_ACTIVEINPUT(TIM_ICInitStruct->ICActiveInput));
assert_param(IS_LL_TIM_ICPSC(TIM_ICInitStruct->ICPrescaler));
assert_param(IS_LL_TIM_IC_FILTER(TIM_ICInitStruct->ICFilter));
/* Disable the Channel 3: Reset the CC3E Bit */
TIMx->CCER &= (uint32_t)~TIM_CCER_CC3E;
/* Select the Input and set the filter and the prescaler value */
MODIFY_REG(TIMx->CCMR2,
(TIM_CCMR2_CC3S | TIM_CCMR2_IC3F | TIM_CCMR2_IC3PSC),
(TIM_ICInitStruct->ICActiveInput | TIM_ICInitStruct->ICFilter | TIM_ICInitStruct->ICPrescaler) >> 16U);
/* Select the Polarity and set the CC3E Bit */
MODIFY_REG(TIMx->CCER,
(TIM_CCER_CC3P | TIM_CCER_CC3NP),
((TIM_ICInitStruct->ICPolarity << 8U) | TIM_CCER_CC3E));
return SUCCESS;
}
/**
* @brief Configure the TIMx input channel 4.
* @param TIMx Timer Instance
* @param TIM_ICInitStruct pointer to the the TIMx input channel 4 configuration data structure
* @retval An ErrorStatus enumeration value:
* - SUCCESS: TIMx registers are de-initialized
* - ERROR: not applicable
*/
static ErrorStatus IC4Config(TIM_TypeDef *TIMx, LL_TIM_IC_InitTypeDef *TIM_ICInitStruct)
{
/* Check the parameters */
assert_param(IS_TIM_CC4_INSTANCE(TIMx));
assert_param(IS_LL_TIM_IC_POLARITY(TIM_ICInitStruct->ICPolarity));
assert_param(IS_LL_TIM_ACTIVEINPUT(TIM_ICInitStruct->ICActiveInput));
assert_param(IS_LL_TIM_ICPSC(TIM_ICInitStruct->ICPrescaler));
assert_param(IS_LL_TIM_IC_FILTER(TIM_ICInitStruct->ICFilter));
/* Disable the Channel 4: Reset the CC4E Bit */
TIMx->CCER &= (uint32_t)~TIM_CCER_CC4E;
/* Select the Input and set the filter and the prescaler value */
MODIFY_REG(TIMx->CCMR2,
(TIM_CCMR2_CC4S | TIM_CCMR2_IC4F | TIM_CCMR2_IC4PSC),
(TIM_ICInitStruct->ICActiveInput | TIM_ICInitStruct->ICFilter | TIM_ICInitStruct->ICPrescaler) >> 8U);
/* Select the Polarity and set the CC2E Bit */
MODIFY_REG(TIMx->CCER,
(TIM_CCER_CC4P | TIM_CCER_CC4NP),
((TIM_ICInitStruct->ICPolarity << 12U) | TIM_CCER_CC4E));
return SUCCESS;
}
/**
* @}
*/
/**
* @}
*/
#endif /* TIM1 || TIM8 || TIM2 || TIM3 || TIM4 || TIM5 || TIM15 || TIM16 || TIM17 || TIM6 || TIM7 */
/**
* @}
*/
#endif /* USE_FULL_LL_DRIVER */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
the_stack_data/108868.c | // this test is based off of 2071202-1.c in the gcc c torture test suite
#include <stdio.h>
struct T { int t; int r[8]; };
struct S { int a; int b; int c[6]; struct T d; };
void foo (struct S *s) {
printf("%d\n", s->a);
printf("%d\n", s->b);
printf("%d\n", s->c[0]);
printf("%d\n", s->c[1]);
printf("%d\n", s->c[2]);
printf("%d\n", s->c[3]);
printf("%d\n", s->c[4]);
printf("%d\n", s->c[5]);
printf("%d\n", s->d.t);
printf("%d\n", s->d.r[0]);
printf("%d\n", s->d.r[1]);
printf("%d\n", s->d.r[2]);
printf("%d\n", s->d.r[3]);
printf("%d\n", s->d.r[4]);
printf("%d\n", s->d.r[5]);
printf("%d\n", s->d.r[6]);
printf("%d\n", s->d.r[7]);
*s = (struct S) { s->b, s->a, { 0, 0, 0, 0, 0, 0 }, s->d };
}
int main (void) {
struct S s = { 6, 12, { 1, 2, 3, 4, 5, 6 }, { 7, { 8, 9, 10, 11, 12, 13, 14, 15 } } };
foo (&s);
printf("%d\n", s.a);
printf("%d\n", s.b);
printf("%d\n", s.c[0]);
printf("%d\n", s.c[1]);
printf("%d\n", s.c[2]);
printf("%d\n", s.c[3]);
printf("%d\n", s.c[4]);
printf("%d\n", s.c[5]);
printf("%d\n", s.d.t);
printf("%d\n", s.d.r[0]);
printf("%d\n", s.d.r[1]);
printf("%d\n", s.d.r[2]);
printf("%d\n", s.d.r[3]);
printf("%d\n", s.d.r[4]);
printf("%d\n", s.d.r[5]);
printf("%d\n", s.d.r[6]);
printf("%d\n", s.d.r[7]);
return 0;
}
|
the_stack_data/69413.c | #include<stdio.h>
extern char **environ;
int main(void){
int i;
for(i=0;environ!=NULL;i++){
printf("environ[%d]; %s \n",i,environ[i]);
}
return 0;
}
|
the_stack_data/20450569.c | #include<stdio.h>
int main(){
int A,B,C,D,E,F,OTHER,DIGIT,ALPHA;
char c;
A = B = C = D = OTHER = DIGIT = ALPHA = 1;
while(A) {
if (!B)
C;
}
while (A) {
B;
C;
}
if (A & B & C) D;
else
if (!A & B & C) E;
if (!A & B & !C) F;
while ( (c=getchar()) != '\n') {
if ( c != ' ' && c != '\t') return OTHER;
else if (c >= '0' && c <= '9') return DIGIT;
else if (c >= 'a' && c <= 'z') return ALPHA;
return (OTHER);
}
}
|
the_stack_data/237643211.c | /* -== Xternal ==-
*
* Utility and functions that rely on external libs for common usage
*
* @autors
* - Maeiky
*
* Copyright (c) 2021 - V·Liance
*
* The contents of this file are subject to the Apache License Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* If a copy of the Apache License Version 2.0 was not distributed with this file,
* You can obtain one at https://www.apache.org/licenses/LICENSE-2.0.html
*
*/
/*
#include "xMemory.h"
#include "xIO.h"
#include <stdlib.h>
#include <string.h>
#ifdef D_MemoryCheck
uint nFPtr_Instance_Counted = 0;
static uint nAlloc_Count = 0;
static uint nAllocated = 0;
static uint nFreed = 0;
static void Alloc_Add(){
nAlloc_Count++;
nAllocated++;
}
static void Alloc_Sub(){
nAlloc_Count--;
nFreed++;
}
fn int atExit_ShowMemLeak(){
int ret = 0;
_printl("I: -- ====== MEM CHECK ======= --");
if(nAlloc_Count == 0){
_printl("P: -- No Memory Leak -- [Allocated: %d]", nAllocated);
}else{
_printl("W: Has Memory leak! Leaked: %d [Allocated: %d, nFreed: %d]", nAlloc_Count, nAllocated, nFreed);
ret = 1;
}
_printl("I: -- Total FPtr instance counted -- [Counted: %d]", nFPtr_Instance_Counted);
return ret;
}
#endif
fn void* xx_malloc(size_t size){
#ifdef D_MemoryCheck
Alloc_Add();
#endif
return malloc(size);
};
fn void* x_malloc(size_t num, size_t size){
return xx_malloc(num * size);
};
fn void* x_calloc(size_t num, size_t size){
#ifdef D_MemoryCheck
Alloc_Add();
#endif
return calloc(num, size);
};
fn void* x_mallocpy(void* src, size_t num, size_t size){
#ifdef D_MemoryCheck
Alloc_Add();
#endif
void* ptr = malloc(num * size);
return _memcpy(ptr,src, num * size);
};
fn void _free(void* ptr){
#ifdef D_MemoryCheck
Alloc_Sub();
#endif
#ifndef D_TestIf_UsingFreedMemory
free(ptr);
#endif
};
fn void* _realloc(void* ptr, size_t size){
#ifdef D_MemoryCheck
if(ptr == 0){
nAlloc_Count++;
nAllocated++;
}
#endif
return realloc(ptr, size);
};
#ifdef D_NO_INTRINSIC
fn void* x_memset (void* ptr, int value, size_t num ){return memset(ptr,value,num);};
fn void* x_memmove(void* destination, const void * source, size_t num ){return memmove(destination,source,num);};
fn void* x_memcpy (void* destination, const void * source, size_t num ){return memcpy(destination,source,num);};
#endif
*/ |
the_stack_data/175143216.c | #include <stdio.h>
#include <stdlib.h>
#include <sqlite3.h>
static int callback(void *NotUsed, int argc, char **argv, char **azColName){
int i;
for(i=0; i<argc; i++){
printf("%s = %s\n", azColName[i], argv[i] ? argv[i] : "NULL");
}
printf("\n");
return 0;
}
int main(int argc, char* argv[])
{
sqlite3 *db;
char *zErrMsg = 0;
int rc;
char *sql;
/* Open database */
rc = sqlite3_open("test.db", &db);
if( rc ){
fprintf(stderr, "Can't open database: %s\n", sqlite3_errmsg(db));
exit(0);
}else{
fprintf(stdout, "Opened database successfully\n");
}
/* Create SQL statement */
sql = "CREATE TABLE COMPANY(" \
"ID INT PRIMARY KEY NOT NULL," \
"NAME TEXT NOT NULL," \
"AGE INT NOT NULL," \
"ADDRESS CHAR(50)," \
"SALARY REAL );";
/* Execute SQL statement */
rc = sqlite3_exec(db, sql, callback, 0, &zErrMsg);
if( rc != SQLITE_OK ){
fprintf(stderr, "SQL error: %s\n", zErrMsg);
sqlite3_free(zErrMsg);
}else{
fprintf(stdout, "Table created successfully\n");
}
sqlite3_close(db);
return 0;
}
|
the_stack_data/648267.c | #ifndef TH_GENERIC_FILE
#define TH_GENERIC_FILE "generic/TemporalConvolution.c"
#else
static inline void THNN_(TemporalConvolution_shapeCheck)(
THNNState *state,
THTensor *input,
int kW,
int dW,
int *inputFrameSize) {
THArgCheck(kW > 0, 9,
"kernel size should be greater than zero, but got kW: %d", kW);
THArgCheck(dW > 0, 11,
"stride should be greater than zero, but got dW: %d", dW);
int dimS = 0; // sequence dimension
int dimF = 1; // feature dimension
if (input->dim() == 3)
{
dimS = 1;
dimF = 2;
}
THNN_ARGCHECK(!input->is_empty() && (input->dim() == 2 || input->dim() == 3), 2, input,
"non-empty 2D or 3D (batch mode) tensor expected for input, but got: %s");
if (inputFrameSize != NULL) {
THArgCheck(input->size(dimF) == *inputFrameSize, 2,
"invalid input frame size. Got: %d, Expected: %d",
input->size(dimF), *inputFrameSize);
}
THArgCheck(input->size(dimS) >= kW, 2,
"input sequence smaller than kernel size. Got: %d, Expected: %d",
input->size(dimS), kW);
}
void THNN_(TemporalConvolution_updateOutput)(
THNNState *state,
THTensor *input,
THTensor *output,
THTensor *weight,
THTensor *bias,
int kW,
int dW,
int inputFrameSize,
int outputFrameSize)
{
THTensor *outputWindow, *inputWindow;
int nInputFrame, nOutputFrame;
int64_t k, i;
int dimS = 0; // sequence dimension
if (input->dim() == 3)
{
dimS = 1;
}
THArgCheck(THTensor_(isContiguous)(weight), 4, "weight must be contiguous");
THArgCheck(!bias || THTensor_(isContiguous)(bias), 5, "bias must be contiguous");
THNN_(TemporalConvolution_shapeCheck)
(state, input, kW, dW, &inputFrameSize);
input = THTensor_(newContiguous)(input);
outputWindow = THTensor_(new)();
inputWindow = THTensor_(new)();
nInputFrame = input->size(dimS);
nOutputFrame = (nInputFrame - kW) / dW + 1;
if (input->dim() == 2)
{
THTensor_(resize2d)(output,
nOutputFrame,
outputFrameSize);
/* bias first */
for(k = 0; k < nOutputFrame; k++)
{
THTensor_(select)(outputWindow, output, 0, k);
THTensor_(copy)(outputWindow, bias);
}
/* ouch */
for(k = 0; nOutputFrame > 0; k++)
{
int64_t outputFrameStride = (kW-1)/dW+1;
int64_t inputFrameStride = outputFrameStride*dW;
int64_t nFrame = (nInputFrame-k*dW-kW)/inputFrameStride + 1;
nOutputFrame -= nFrame;
THTensor_(setStorage2d)(inputWindow, THTensor_getStoragePtr(input),
input->storage_offset()+k*dW*input->size(1),
nFrame, inputFrameStride*input->size(1),
kW*input->size(1), 1);
THTensor_(setStorage2d)(outputWindow, THTensor_getStoragePtr(output),
output->storage_offset() + k*output->size(1),
nFrame, outputFrameStride*output->size(1),
output->size(1), 1);
THTensor *tweight = THTensor_(new)();
THTensor_(transpose)(tweight, weight, 0, 1);
THTensor_(addmm)(outputWindow, 1, outputWindow, 1, inputWindow, tweight);
THTensor_(free)(tweight);
}
}
else
{
THTensor *outputSample = THTensor_(new)();
THTensor *inputSample = THTensor_(new)();
int nBatchFrame = input->size(0);
THTensor_(resize3d)(output,
nBatchFrame,
nOutputFrame,
outputFrameSize);
for(i = 0; i < nBatchFrame; i++)
{
THTensor_(select)(outputSample, output, 0, i);
THTensor_(select)(inputSample, input, 0, i);
int64_t nOutputSampleFrame = nOutputFrame;
/* bias first */
for(k = 0; k < nOutputFrame; k++)
{
THTensor_(select)(outputWindow, outputSample, 0, k);
THTensor_(copy)(outputWindow, bias);
}
/* ouch */
for(k = 0; nOutputSampleFrame > 0; k++)
{
int64_t outputFrameStride = (kW-1)/dW+1;
int64_t inputFrameStride = outputFrameStride*dW;
int64_t nFrame = (nInputFrame-k*dW-kW)/inputFrameStride + 1;
nOutputSampleFrame -= nFrame;
THTensor_(setStorage2d)(inputWindow, THTensor_getStoragePtr(inputSample),
inputSample->storage_offset()+k*dW*inputSample->size(1),
nFrame, inputFrameStride*inputSample->size(1),
kW*inputSample->size(1), 1);
THTensor_(setStorage2d)(outputWindow, THTensor_getStoragePtr(outputSample),
outputSample->storage_offset() + k*outputSample->size(1),
nFrame, outputFrameStride*outputSample->size(1),
outputSample->size(1), 1);
THTensor *tweight = THTensor_(new)();
THTensor_(transpose)(tweight, weight, 0, 1);
THTensor_(addmm)(outputWindow, 1, outputWindow, 1, inputWindow, tweight);
THTensor_(free)(tweight);
}
}
THTensor_(free)(outputSample);
THTensor_(free)(inputSample);
}
THTensor_(free)(outputWindow);
THTensor_(free)(inputWindow);
THTensor_(free)(input);
}
void THNN_(TemporalConvolution_updateGradInput)(
THNNState *state,
THTensor *input,
THTensor *gradOutput,
THTensor *gradInput,
THTensor *weight,
int kW,
int dW)
{
int64_t nInputFrame;
int64_t nOutputFrame;
THTensor *gradOutputWindow;
THTensor *gradInputWindow;
int64_t k, i;
int dimS = 0; // sequence dimension
if (gradOutput->dim() == 3)
{
dimS = 1;
}
THArgCheck(THTensor_(isContiguous)(weight), 4, "weight must be contiguous");
THNN_(TemporalConvolution_shapeCheck)(
state, input, kW, dW, NULL);
nInputFrame = input->size(dimS);
nOutputFrame = gradOutput->size(dimS);
input = THTensor_(newContiguous)(input);
gradOutput = THTensor_(newContiguous)(gradOutput);
gradOutputWindow = THTensor_(new)();
gradInputWindow = THTensor_(new)();
THTensor_(resizeAs)(gradInput, input);
THTensor_(zero)(gradInput);
if (gradOutput->dim() == 2)
{
/* ouch */
for(k = 0; nOutputFrame > 0; k++)
{
int64_t outputFrameStride = (kW-1)/dW+1;
int64_t inputFrameStride = outputFrameStride*dW;
int64_t nFrame = (nInputFrame-k*dW-kW)/inputFrameStride + 1;
nOutputFrame -= nFrame;
THTensor_(setStorage2d)(gradOutputWindow, THTensor_getStoragePtr(gradOutput),
gradOutput->storage_offset() + k*gradOutput->size(1),
nFrame, outputFrameStride*gradOutput->size(1),
gradOutput->size(1), 1);
THTensor_(setStorage2d)(gradInputWindow, THTensor_getStoragePtr(gradInput),
gradInput->storage_offset()+k*dW*gradInput->size(1),
nFrame, inputFrameStride*gradInput->size(1),
kW*gradInput->size(1), 1);
THTensor_(addmm)(gradInputWindow, 1, gradInputWindow, 1, gradOutputWindow, weight);
}
}
else
{
THTensor *gradOutputSample = THTensor_(new)();
THTensor *gradInputSample = THTensor_(new)();
int nBatchFrame = input->size(0);
for(i = 0; i < nBatchFrame; i++)
{
THTensor_(select)(gradOutputSample, gradOutput, 0, i);
THTensor_(select)(gradInputSample, gradInput, 0, i);
int nOutputSampleFrame = nOutputFrame;
/* ouch */
for(k = 0; nOutputSampleFrame > 0; k++)
{
int64_t outputFrameStride = (kW-1)/dW+1;
int64_t inputFrameStride = outputFrameStride*dW;
int64_t nFrame = (nInputFrame-k*dW-kW)/inputFrameStride + 1;
nOutputSampleFrame -= nFrame;
THTensor_(setStorage2d)(gradOutputWindow, THTensor_getStoragePtr(gradOutputSample),
gradOutputSample->storage_offset() + k*gradOutputSample->size(1),
nFrame, outputFrameStride*gradOutputSample->size(1),
gradOutputSample->size(1), 1);
THTensor_(setStorage2d)(gradInputWindow, THTensor_getStoragePtr(gradInputSample),
gradInputSample->storage_offset()+k*dW*gradInputSample->size(1),
nFrame, inputFrameStride*gradInputSample->size(1),
kW*gradInputSample->size(1), 1);
THTensor_(addmm)(gradInputWindow, 1, gradInputWindow, 1, gradOutputWindow, weight);
}
}
THTensor_(free)(gradOutputSample);
THTensor_(free)(gradInputSample);
}
THTensor_(free)(gradOutputWindow);
THTensor_(free)(gradInputWindow);
THTensor_(free)(gradOutput);
THTensor_(free)(input);
}
void THNN_(TemporalConvolution_accGradParameters)(
THNNState *state,
THTensor *input,
THTensor *gradOutput,
THTensor *gradWeight,
THTensor *gradBias,
int kW,
int dW,
accreal scale_)
{
real scale = TH_CONVERT_ACCREAL_TO_REAL(scale_);
int64_t nInputFrame;
int64_t nOutputFrame;
THTensor *gradOutputWindow;
THTensor *inputWindow;
int64_t k, i;
int dimS = 0; // sequence dimension
if (gradOutput->dim() == 3)
{
dimS = 1;
}
THNN_(TemporalConvolution_shapeCheck)(
state, input, kW, dW, NULL);
nInputFrame = input->size(dimS);
nOutputFrame = gradOutput->size(dimS);
input = THTensor_(newContiguous)(input);
gradOutput = THTensor_(newContiguous)(gradOutput);
gradOutputWindow = THTensor_(new)();
inputWindow = THTensor_(new)();
if (input->dim() == 2)
{
/* bias first */
for(k = 0; k < nOutputFrame; k++)
{
THTensor_(select)(gradOutputWindow, gradOutput, 0, k);
THTensor_(cadd)(gradBias, gradBias, scale, gradOutputWindow);
}
/* ouch */
for(k = 0; nOutputFrame > 0; k++)
{
int64_t outputFrameStride = (kW-1)/dW+1;
int64_t inputFrameStride = outputFrameStride*dW;
int64_t nFrame = (nInputFrame-k*dW-kW)/inputFrameStride + 1;
nOutputFrame -= nFrame;
THTensor_(setStorage2d)(inputWindow, THTensor_getStoragePtr(input),
input->storage_offset()+k*dW*input->size(1),
nFrame, inputFrameStride*input->size(1),
kW*input->size(1), 1);
THTensor_(setStorage2d)(gradOutputWindow, THTensor_getStoragePtr(gradOutput),
gradOutput->storage_offset() + k*gradOutput->size(1),
nFrame, outputFrameStride*gradOutput->size(1),
gradOutput->size(1), 1);
THTensor *tgradOutputWindow = THTensor_(new)();
THTensor_(transpose)(tgradOutputWindow, gradOutputWindow, 0, 1);
THTensor_(addmm)(gradWeight, 1, gradWeight, scale, tgradOutputWindow, inputWindow);
THTensor_(free)(tgradOutputWindow);
}
}
else
{
THTensor *gradOutputSample = THTensor_(new)();
THTensor *inputSample = THTensor_(new)();
int nBatchFrame = input->size(0);
for(i = 0; i < nBatchFrame; i++)
{
THTensor_(select)(gradOutputSample, gradOutput, 0, i);
THTensor_(select)(inputSample, input, 0, i);
int nOutputSampleFrame = nOutputFrame;
/* bias first */
for(k = 0; k < nOutputFrame; k++)
{
THTensor_(select)(gradOutputWindow, gradOutputSample, 0, k);
THTensor_(cadd)(gradBias, gradBias, scale, gradOutputWindow);
}
/* ouch */
for(k = 0; nOutputSampleFrame > 0; k++)
{
int64_t outputFrameStride = (kW-1)/dW+1;
int64_t inputFrameStride = outputFrameStride*dW;
int64_t nFrame = (nInputFrame-k*dW-kW)/inputFrameStride + 1;
nOutputSampleFrame -= nFrame;
THTensor_(setStorage2d)(inputWindow, THTensor_getStoragePtr(inputSample),
inputSample->storage_offset()+k*dW*inputSample->size(1),
nFrame, inputFrameStride*inputSample->size(1),
kW*inputSample->size(1), 1);
THTensor_(setStorage2d)(gradOutputWindow, THTensor_getStoragePtr(gradOutputSample),
gradOutputSample->storage_offset() + k*gradOutputSample->size(1),
nFrame, outputFrameStride*gradOutputSample->size(1),
gradOutputSample->size(1), 1);
THTensor *tgradOutputWindow = THTensor_(new)();
THTensor_(transpose)(tgradOutputWindow, gradOutputWindow, 0, 1);
THTensor_(addmm)(gradWeight, 1, gradWeight, scale, tgradOutputWindow, inputWindow);
THTensor_(free)(tgradOutputWindow);
}
}
THTensor_(free)(gradOutputSample);
THTensor_(free)(inputSample);
}
THTensor_(free)(gradOutputWindow);
THTensor_(free)(inputWindow);
THTensor_(free)(gradOutput);
THTensor_(free)(input);
}
#endif
|
the_stack_data/89155.c | #include <limits.h>
int smallestRangeI(int *A, int ASize, int K)
{
int max = A[0], min = A[0];
for (int i = 0; i < ASize; ++i)
{
if (A[i] > max)
max = A[i];
else if (A[i] < min)
min = A[i];
}
int res = max - min - K * 2;
return res < 0 ? 0 : res;
} |
the_stack_data/61074113.c |
int scilab_rt_max_i3_(int si00, int si01, int si02, int in0[si00][si01][si02])
{
int i, j, k;
int val1 = 0;
for (i = 0; i < si00; ++i) {
for (j = 0; j < si01; ++j) {
for (k = 0; k < si02; ++k) {
val1 += in0[i][j][k];
}
}
}
return val1;
}
|
the_stack_data/26917.c | // RUN: %clang_cc1 -fprofile-instr-generate -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name switch.c %s | FileCheck %s
// CHECK: foo
void foo(int i) { // CHECK-NEXT: File 0, [[@LINE]]:17 -> [[@LINE+8]]:2 = #0
switch(i) {
case 1: // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+3]]:10 = #2
return;
case 2: // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:10 = #3
break;
}
int x = 0; // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:2 = #1
}
void nop() {}
// CHECK: bar
void bar(int i) { // CHECK-NEXT: File 0, [[@LINE]]:17 -> [[@LINE+20]]:2 = #0
switch (i)
; // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE]]:6 = 0
switch (i) { // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+16]]:2 = #1
}
switch (i) // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+13]]:2 = #2
nop(); // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE]]:10 = 0
switch (i) // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+10]]:2 = #3
case 1: // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:10 = #5
nop();
switch (i) { // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+6]]:2 = #4
nop(); // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE+2]]:10 = 0
case 1: // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:10 = #7
nop();
}
nop(); // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:2 = #6
}
// CHECK-NEXT: main
int main() { // CHECK-NEXT: File 0, [[@LINE]]:12 -> [[@LINE+34]]:2 = #0
int i = 0;
switch(i) {
case 0: // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+7]]:10 = #2
i = 1;
break;
case 1: // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+2]]:10 = #3
i = 2;
break;
default: // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:10 = #4
break;
}
switch(i) { // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+22]]:2 = #1
case 0: // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+6]]:10 = #6
i = 1;
break;
case 1: // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+3]]:10 = #7
i = 2;
default: // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:10 = (#7 + #8)
break;
}
switch(i) { // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+12]]:2 = #5
case 1: // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+5]]:11 = #10
case 2: // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+4]]:11 = (#10 + #11)
i = 11;
case 3: // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+2]]:11 = ((#10 + #11) + #12)
case 4: // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:11 = (((#10 + #11) + #12) + #13)
i = 99;
}
foo(1); // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+2]]:11 = #9
bar(1);
return 0;
}
|
the_stack_data/482329.c | // This file is part of CPAchecker,
// a tool for configurable software verification:
// https://cpachecker.sosy-lab.org
//
// SPDX-FileCopyrightText: 2007-2020 Dirk Beyer <https://www.sosy-lab.org>
//
// SPDX-License-Identifier: Apache-2.0
int algorithm(int a, int b)
{
int result;
result = a * b;
result = result / 8;
result = result + 1024;
result = result / 16;
return result;
}
int main()
{
int t1, t2, t3, value, a, b;
if(a > -513)
{
if(a < 513)
{
if(b > -1025)
{
if(b < 1025)
{
t1 = a * b;
t2 = t1 >> 3;
t3 = (t2 + 1024) >> 4;
value = algorithm(a,b);
if(value == t3)
goto EXIT;
else
{
int inputA = a;
int inputB = b;
goto ERROR;
}
}
}
}
}
goto EXIT;
ERROR:
;
EXIT:
;
}
|
the_stack_data/145974.c | int main()
{
int p = 1;
for(int i = 0; !(i == 5); ++i)
p += p;
}
|
the_stack_data/45451359.c | /* { dg-do run } */
/* { dg-require-effective-target sync_char_short } */
/* { dg-options "-mcpu=v9" { target sparc*-*-* } } */
/* This testcase failed on s390 because no compare instruction for
the check of FLAG was emitted. */
unsigned short int count = 0;
int flag = 1;
extern void abort (void);
extern void exit (int);
int
main ()
{
__sync_add_and_fetch (&count, -1);
if (!flag)
abort ();
exit (0);
}
|
the_stack_data/182954333.c | #include <stdio.h>
typedef long long ll;
void pt(int x) {
switch (x) {
case 0:printf("Zero ");break;
case 1:printf("One ");break;
case 2:printf("Two ");break;
case 3:printf("Three ");break;
case 4:printf("Four ");break;
case 5:printf("Five ");break;
case 6:printf("Six ");break;
case 7:printf("Seven ");break;
case 8:printf("Eight ");break;
case 9:printf("Nine ");break;
}
}
void prt(int x) {
if (x) {
prt(x / 10);
pt(x % 10);
}
}
int x;
int main() {
#ifndef ONLINE_JUDGE
freopen("1.in", "r", stdin);
freopen("1.out", "w", stdout);
freopen("1.err", "w", stderr);
#endif
while (~scanf("%d", &x)) {
if (x > 0) {
prt(x);
putchar('\n');
} else
puts("Error");
}
#ifndef ONLINE_JUDGE
fclose(stdin);
fclose(stdout);
fclose(stderr);
#endif
return 0;
} |
the_stack_data/26700962.c | //@ ltl invariant negative: ( ( ([] (<> ( (! AP((p0_l3 != 0))) && ( AP((p0_l2 != 0)) && ( AP((p0_l1 != 0)) && (! AP((p0_l0 != 0)))))))) || (! ([] (<> AP((v1 == 1)))))) || (! ([] (<> AP((1.0 <= _diverge_delta))))));
extern float __VERIFIER_nondet_float(void);
extern int __VERIFIER_nondet_int(void);
char __VERIFIER_nondet_bool(void) {
return __VERIFIER_nondet_int() != 0;
}
char p12_l3, _x_p12_l3;
char p12_l2, _x_p12_l2;
char p12_l1, _x_p12_l1;
float _diverge_delta, _x__diverge_delta;
char p12_l0, _x_p12_l0;
char p12_evt, _x_p12_evt;
float p12_c, _x_p12_c;
char p10_l3, _x_p10_l3;
char p10_l2, _x_p10_l2;
char p10_l1, _x_p10_l1;
char p10_l0, _x_p10_l0;
char p10_evt, _x_p10_evt;
float p10_c, _x_p10_c;
char p3_l3, _x_p3_l3;
char p3_evt, _x_p3_evt;
char p0_l2, _x_p0_l2;
char p8_l3, _x_p8_l3;
char p0_l1, _x_p0_l1;
char p2_l3, _x_p2_l3;
char p2_evt, _x_p2_evt;
float delta, _x_delta;
int v1, _x_v1;
char v2, _x_v2;
float p8_c, _x_p8_c;
char p0_l3, _x_p0_l3;
char p8_evt, _x_p8_evt;
char p8_l2, _x_p8_l2;
char p13_evt, _x_p13_evt;
char p4_evt, _x_p4_evt;
float p1_c, _x_p1_c;
char p9_l3, _x_p9_l3;
char p3_l2, _x_p3_l2;
char p6_l3, _x_p6_l3;
char p1_l3, _x_p1_l3;
char p0_l0, _x_p0_l0;
char p8_l1, _x_p8_l1;
char p1_evt, _x_p1_evt;
char p13_l2, _x_p13_l2;
char p1_l1, _x_p1_l1;
char p7_l3, _x_p7_l3;
char p4_l2, _x_p4_l2;
char p13_l3, _x_p13_l3;
char p1_l2, _x_p1_l2;
char p4_l3, _x_p4_l3;
float p11_c, _x_p11_c;
float p5_c, _x_p5_c;
char p11_evt, _x_p11_evt;
float p2_c, _x_p2_c;
char p5_evt, _x_p5_evt;
char p11_l0, _x_p11_l0;
float p0_c, _x_p0_c;
char p5_l0, _x_p5_l0;
char p11_l1, _x_p11_l1;
char p2_l0, _x_p2_l0;
char p0_evt, _x_p0_evt;
char p5_l1, _x_p5_l1;
char p11_l2, _x_p11_l2;
char p2_l1, _x_p2_l1;
char p5_l2, _x_p5_l2;
char p11_l3, _x_p11_l3;
char p2_l2, _x_p2_l2;
char p5_l3, _x_p5_l3;
char p9_l0, _x_p9_l0;
char p6_l0, _x_p6_l0;
char p9_l1, _x_p9_l1;
char p3_l0, _x_p3_l0;
char p6_l1, _x_p6_l1;
char p9_l2, _x_p9_l2;
char p3_l1, _x_p3_l1;
char p6_l2, _x_p6_l2;
float p7_c, _x_p7_c;
float p13_c, _x_p13_c;
float p4_c, _x_p4_c;
char p7_evt, _x_p7_evt;
char p7_l0, _x_p7_l0;
char p13_l0, _x_p13_l0;
char p4_l0, _x_p4_l0;
char p7_l1, _x_p7_l1;
char p13_l1, _x_p13_l1;
char p1_l0, _x_p1_l0;
char p4_l1, _x_p4_l1;
char p7_l2, _x_p7_l2;
char p8_l0, _x_p8_l0;
float p6_c, _x_p6_c;
float p9_c, _x_p9_c;
float p3_c, _x_p3_c;
char p6_evt, _x_p6_evt;
char p9_evt, _x_p9_evt;
int main()
{
p12_l3 = __VERIFIER_nondet_bool();
p12_l2 = __VERIFIER_nondet_bool();
p12_l1 = __VERIFIER_nondet_bool();
_diverge_delta = __VERIFIER_nondet_float();
p12_l0 = __VERIFIER_nondet_bool();
p12_evt = __VERIFIER_nondet_bool();
p12_c = __VERIFIER_nondet_float();
p10_l3 = __VERIFIER_nondet_bool();
p10_l2 = __VERIFIER_nondet_bool();
p10_l1 = __VERIFIER_nondet_bool();
p10_l0 = __VERIFIER_nondet_bool();
p10_evt = __VERIFIER_nondet_bool();
p10_c = __VERIFIER_nondet_float();
p3_l3 = __VERIFIER_nondet_bool();
p3_evt = __VERIFIER_nondet_bool();
p0_l2 = __VERIFIER_nondet_bool();
p8_l3 = __VERIFIER_nondet_bool();
p0_l1 = __VERIFIER_nondet_bool();
p2_l3 = __VERIFIER_nondet_bool();
p2_evt = __VERIFIER_nondet_bool();
delta = __VERIFIER_nondet_float();
v1 = __VERIFIER_nondet_int();
v2 = __VERIFIER_nondet_bool();
p8_c = __VERIFIER_nondet_float();
p0_l3 = __VERIFIER_nondet_bool();
p8_evt = __VERIFIER_nondet_bool();
p8_l2 = __VERIFIER_nondet_bool();
p13_evt = __VERIFIER_nondet_bool();
p4_evt = __VERIFIER_nondet_bool();
p1_c = __VERIFIER_nondet_float();
p9_l3 = __VERIFIER_nondet_bool();
p3_l2 = __VERIFIER_nondet_bool();
p6_l3 = __VERIFIER_nondet_bool();
p1_l3 = __VERIFIER_nondet_bool();
p0_l0 = __VERIFIER_nondet_bool();
p8_l1 = __VERIFIER_nondet_bool();
p1_evt = __VERIFIER_nondet_bool();
p13_l2 = __VERIFIER_nondet_bool();
p1_l1 = __VERIFIER_nondet_bool();
p7_l3 = __VERIFIER_nondet_bool();
p4_l2 = __VERIFIER_nondet_bool();
p13_l3 = __VERIFIER_nondet_bool();
p1_l2 = __VERIFIER_nondet_bool();
p4_l3 = __VERIFIER_nondet_bool();
p11_c = __VERIFIER_nondet_float();
p5_c = __VERIFIER_nondet_float();
p11_evt = __VERIFIER_nondet_bool();
p2_c = __VERIFIER_nondet_float();
p5_evt = __VERIFIER_nondet_bool();
p11_l0 = __VERIFIER_nondet_bool();
p0_c = __VERIFIER_nondet_float();
p5_l0 = __VERIFIER_nondet_bool();
p11_l1 = __VERIFIER_nondet_bool();
p2_l0 = __VERIFIER_nondet_bool();
p0_evt = __VERIFIER_nondet_bool();
p5_l1 = __VERIFIER_nondet_bool();
p11_l2 = __VERIFIER_nondet_bool();
p2_l1 = __VERIFIER_nondet_bool();
p5_l2 = __VERIFIER_nondet_bool();
p11_l3 = __VERIFIER_nondet_bool();
p2_l2 = __VERIFIER_nondet_bool();
p5_l3 = __VERIFIER_nondet_bool();
p9_l0 = __VERIFIER_nondet_bool();
p6_l0 = __VERIFIER_nondet_bool();
p9_l1 = __VERIFIER_nondet_bool();
p3_l0 = __VERIFIER_nondet_bool();
p6_l1 = __VERIFIER_nondet_bool();
p9_l2 = __VERIFIER_nondet_bool();
p3_l1 = __VERIFIER_nondet_bool();
p6_l2 = __VERIFIER_nondet_bool();
p7_c = __VERIFIER_nondet_float();
p13_c = __VERIFIER_nondet_float();
p4_c = __VERIFIER_nondet_float();
p7_evt = __VERIFIER_nondet_bool();
p7_l0 = __VERIFIER_nondet_bool();
p13_l0 = __VERIFIER_nondet_bool();
p4_l0 = __VERIFIER_nondet_bool();
p7_l1 = __VERIFIER_nondet_bool();
p13_l1 = __VERIFIER_nondet_bool();
p1_l0 = __VERIFIER_nondet_bool();
p4_l1 = __VERIFIER_nondet_bool();
p7_l2 = __VERIFIER_nondet_bool();
p8_l0 = __VERIFIER_nondet_bool();
p6_c = __VERIFIER_nondet_float();
p9_c = __VERIFIER_nondet_float();
p3_c = __VERIFIER_nondet_float();
p6_evt = __VERIFIER_nondet_bool();
p9_evt = __VERIFIER_nondet_bool();
int __ok = ((((((( !(p13_l3 != 0)) && (( !(p13_l2 != 0)) && (( !(p13_l0 != 0)) && ( !(p13_l1 != 0))))) && (p13_c == 0.0)) && (((p13_l3 != 0) && (( !(p13_l2 != 0)) && (( !(p13_l0 != 0)) && ( !(p13_l1 != 0))))) || ((( !(p13_l3 != 0)) && ((p13_l2 != 0) && ((p13_l0 != 0) && (p13_l1 != 0)))) || ((( !(p13_l3 != 0)) && ((p13_l2 != 0) && ((p13_l1 != 0) && ( !(p13_l0 != 0))))) || ((( !(p13_l3 != 0)) && ((p13_l2 != 0) && ((p13_l0 != 0) && ( !(p13_l1 != 0))))) || ((( !(p13_l3 != 0)) && ((p13_l2 != 0) && (( !(p13_l0 != 0)) && ( !(p13_l1 != 0))))) || ((( !(p13_l3 != 0)) && (( !(p13_l2 != 0)) && ((p13_l0 != 0) && (p13_l1 != 0)))) || ((( !(p13_l3 != 0)) && (( !(p13_l2 != 0)) && ((p13_l1 != 0) && ( !(p13_l0 != 0))))) || ((( !(p13_l3 != 0)) && (( !(p13_l2 != 0)) && (( !(p13_l0 != 0)) && ( !(p13_l1 != 0))))) || (( !(p13_l3 != 0)) && (( !(p13_l2 != 0)) && ((p13_l0 != 0) && ( !(p13_l1 != 0)))))))))))))) && ((p13_c <= 16.0) || ( !(((( !(p13_l3 != 0)) && (( !(p13_l2 != 0)) && ((p13_l0 != 0) && ( !(p13_l1 != 0))))) || (( !(p13_l3 != 0)) && ((p13_l2 != 0) && (( !(p13_l0 != 0)) && ( !(p13_l1 != 0)))))) || ((( !(p13_l3 != 0)) && ((p13_l2 != 0) && ((p13_l0 != 0) && (p13_l1 != 0)))) || ((p13_l3 != 0) && (( !(p13_l2 != 0)) && (( !(p13_l0 != 0)) && ( !(p13_l1 != 0)))))))))) && (((((( !(p12_l3 != 0)) && (( !(p12_l2 != 0)) && (( !(p12_l0 != 0)) && ( !(p12_l1 != 0))))) && (p12_c == 0.0)) && (((p12_l3 != 0) && (( !(p12_l2 != 0)) && (( !(p12_l0 != 0)) && ( !(p12_l1 != 0))))) || ((( !(p12_l3 != 0)) && ((p12_l2 != 0) && ((p12_l0 != 0) && (p12_l1 != 0)))) || ((( !(p12_l3 != 0)) && ((p12_l2 != 0) && ((p12_l1 != 0) && ( !(p12_l0 != 0))))) || ((( !(p12_l3 != 0)) && ((p12_l2 != 0) && ((p12_l0 != 0) && ( !(p12_l1 != 0))))) || ((( !(p12_l3 != 0)) && ((p12_l2 != 0) && (( !(p12_l0 != 0)) && ( !(p12_l1 != 0))))) || ((( !(p12_l3 != 0)) && (( !(p12_l2 != 0)) && ((p12_l0 != 0) && (p12_l1 != 0)))) || ((( !(p12_l3 != 0)) && (( !(p12_l2 != 0)) && ((p12_l1 != 0) && ( !(p12_l0 != 0))))) || ((( !(p12_l3 != 0)) && (( !(p12_l2 != 0)) && (( !(p12_l0 != 0)) && ( !(p12_l1 != 0))))) || (( !(p12_l3 != 0)) && (( !(p12_l2 != 0)) && ((p12_l0 != 0) && ( !(p12_l1 != 0)))))))))))))) && ((p12_c <= 16.0) || ( !(((( !(p12_l3 != 0)) && (( !(p12_l2 != 0)) && ((p12_l0 != 0) && ( !(p12_l1 != 0))))) || (( !(p12_l3 != 0)) && ((p12_l2 != 0) && (( !(p12_l0 != 0)) && ( !(p12_l1 != 0)))))) || ((( !(p12_l3 != 0)) && ((p12_l2 != 0) && ((p12_l0 != 0) && (p12_l1 != 0)))) || ((p12_l3 != 0) && (( !(p12_l2 != 0)) && (( !(p12_l0 != 0)) && ( !(p12_l1 != 0)))))))))) && (((((( !(p11_l3 != 0)) && (( !(p11_l2 != 0)) && (( !(p11_l0 != 0)) && ( !(p11_l1 != 0))))) && (p11_c == 0.0)) && (((p11_l3 != 0) && (( !(p11_l2 != 0)) && (( !(p11_l0 != 0)) && ( !(p11_l1 != 0))))) || ((( !(p11_l3 != 0)) && ((p11_l2 != 0) && ((p11_l0 != 0) && (p11_l1 != 0)))) || ((( !(p11_l3 != 0)) && ((p11_l2 != 0) && ((p11_l1 != 0) && ( !(p11_l0 != 0))))) || ((( !(p11_l3 != 0)) && ((p11_l2 != 0) && ((p11_l0 != 0) && ( !(p11_l1 != 0))))) || ((( !(p11_l3 != 0)) && ((p11_l2 != 0) && (( !(p11_l0 != 0)) && ( !(p11_l1 != 0))))) || ((( !(p11_l3 != 0)) && (( !(p11_l2 != 0)) && ((p11_l0 != 0) && (p11_l1 != 0)))) || ((( !(p11_l3 != 0)) && (( !(p11_l2 != 0)) && ((p11_l1 != 0) && ( !(p11_l0 != 0))))) || ((( !(p11_l3 != 0)) && (( !(p11_l2 != 0)) && (( !(p11_l0 != 0)) && ( !(p11_l1 != 0))))) || (( !(p11_l3 != 0)) && (( !(p11_l2 != 0)) && ((p11_l0 != 0) && ( !(p11_l1 != 0)))))))))))))) && ((p11_c <= 16.0) || ( !(((( !(p11_l3 != 0)) && (( !(p11_l2 != 0)) && ((p11_l0 != 0) && ( !(p11_l1 != 0))))) || (( !(p11_l3 != 0)) && ((p11_l2 != 0) && (( !(p11_l0 != 0)) && ( !(p11_l1 != 0)))))) || ((( !(p11_l3 != 0)) && ((p11_l2 != 0) && ((p11_l0 != 0) && (p11_l1 != 0)))) || ((p11_l3 != 0) && (( !(p11_l2 != 0)) && (( !(p11_l0 != 0)) && ( !(p11_l1 != 0)))))))))) && (((((( !(p10_l3 != 0)) && (( !(p10_l2 != 0)) && (( !(p10_l0 != 0)) && ( !(p10_l1 != 0))))) && (p10_c == 0.0)) && (((p10_l3 != 0) && (( !(p10_l2 != 0)) && (( !(p10_l0 != 0)) && ( !(p10_l1 != 0))))) || ((( !(p10_l3 != 0)) && ((p10_l2 != 0) && ((p10_l0 != 0) && (p10_l1 != 0)))) || ((( !(p10_l3 != 0)) && ((p10_l2 != 0) && ((p10_l1 != 0) && ( !(p10_l0 != 0))))) || ((( !(p10_l3 != 0)) && ((p10_l2 != 0) && ((p10_l0 != 0) && ( !(p10_l1 != 0))))) || ((( !(p10_l3 != 0)) && ((p10_l2 != 0) && (( !(p10_l0 != 0)) && ( !(p10_l1 != 0))))) || ((( !(p10_l3 != 0)) && (( !(p10_l2 != 0)) && ((p10_l0 != 0) && (p10_l1 != 0)))) || ((( !(p10_l3 != 0)) && (( !(p10_l2 != 0)) && ((p10_l1 != 0) && ( !(p10_l0 != 0))))) || ((( !(p10_l3 != 0)) && (( !(p10_l2 != 0)) && (( !(p10_l0 != 0)) && ( !(p10_l1 != 0))))) || (( !(p10_l3 != 0)) && (( !(p10_l2 != 0)) && ((p10_l0 != 0) && ( !(p10_l1 != 0)))))))))))))) && ((p10_c <= 16.0) || ( !(((( !(p10_l3 != 0)) && (( !(p10_l2 != 0)) && ((p10_l0 != 0) && ( !(p10_l1 != 0))))) || (( !(p10_l3 != 0)) && ((p10_l2 != 0) && (( !(p10_l0 != 0)) && ( !(p10_l1 != 0)))))) || ((( !(p10_l3 != 0)) && ((p10_l2 != 0) && ((p10_l0 != 0) && (p10_l1 != 0)))) || ((p10_l3 != 0) && (( !(p10_l2 != 0)) && (( !(p10_l0 != 0)) && ( !(p10_l1 != 0)))))))))) && (((((( !(p9_l3 != 0)) && (( !(p9_l2 != 0)) && (( !(p9_l0 != 0)) && ( !(p9_l1 != 0))))) && (p9_c == 0.0)) && (((p9_l3 != 0) && (( !(p9_l2 != 0)) && (( !(p9_l0 != 0)) && ( !(p9_l1 != 0))))) || ((( !(p9_l3 != 0)) && ((p9_l2 != 0) && ((p9_l0 != 0) && (p9_l1 != 0)))) || ((( !(p9_l3 != 0)) && ((p9_l2 != 0) && ((p9_l1 != 0) && ( !(p9_l0 != 0))))) || ((( !(p9_l3 != 0)) && ((p9_l2 != 0) && ((p9_l0 != 0) && ( !(p9_l1 != 0))))) || ((( !(p9_l3 != 0)) && ((p9_l2 != 0) && (( !(p9_l0 != 0)) && ( !(p9_l1 != 0))))) || ((( !(p9_l3 != 0)) && (( !(p9_l2 != 0)) && ((p9_l0 != 0) && (p9_l1 != 0)))) || ((( !(p9_l3 != 0)) && (( !(p9_l2 != 0)) && ((p9_l1 != 0) && ( !(p9_l0 != 0))))) || ((( !(p9_l3 != 0)) && (( !(p9_l2 != 0)) && (( !(p9_l0 != 0)) && ( !(p9_l1 != 0))))) || (( !(p9_l3 != 0)) && (( !(p9_l2 != 0)) && ((p9_l0 != 0) && ( !(p9_l1 != 0)))))))))))))) && ((p9_c <= 16.0) || ( !(((( !(p9_l3 != 0)) && (( !(p9_l2 != 0)) && ((p9_l0 != 0) && ( !(p9_l1 != 0))))) || (( !(p9_l3 != 0)) && ((p9_l2 != 0) && (( !(p9_l0 != 0)) && ( !(p9_l1 != 0)))))) || ((( !(p9_l3 != 0)) && ((p9_l2 != 0) && ((p9_l0 != 0) && (p9_l1 != 0)))) || ((p9_l3 != 0) && (( !(p9_l2 != 0)) && (( !(p9_l0 != 0)) && ( !(p9_l1 != 0)))))))))) && (((((( !(p8_l3 != 0)) && (( !(p8_l2 != 0)) && (( !(p8_l0 != 0)) && ( !(p8_l1 != 0))))) && (p8_c == 0.0)) && (((p8_l3 != 0) && (( !(p8_l2 != 0)) && (( !(p8_l0 != 0)) && ( !(p8_l1 != 0))))) || ((( !(p8_l3 != 0)) && ((p8_l2 != 0) && ((p8_l0 != 0) && (p8_l1 != 0)))) || ((( !(p8_l3 != 0)) && ((p8_l2 != 0) && ((p8_l1 != 0) && ( !(p8_l0 != 0))))) || ((( !(p8_l3 != 0)) && ((p8_l2 != 0) && ((p8_l0 != 0) && ( !(p8_l1 != 0))))) || ((( !(p8_l3 != 0)) && ((p8_l2 != 0) && (( !(p8_l0 != 0)) && ( !(p8_l1 != 0))))) || ((( !(p8_l3 != 0)) && (( !(p8_l2 != 0)) && ((p8_l0 != 0) && (p8_l1 != 0)))) || ((( !(p8_l3 != 0)) && (( !(p8_l2 != 0)) && ((p8_l1 != 0) && ( !(p8_l0 != 0))))) || ((( !(p8_l3 != 0)) && (( !(p8_l2 != 0)) && (( !(p8_l0 != 0)) && ( !(p8_l1 != 0))))) || (( !(p8_l3 != 0)) && (( !(p8_l2 != 0)) && ((p8_l0 != 0) && ( !(p8_l1 != 0)))))))))))))) && ((p8_c <= 16.0) || ( !(((( !(p8_l3 != 0)) && (( !(p8_l2 != 0)) && ((p8_l0 != 0) && ( !(p8_l1 != 0))))) || (( !(p8_l3 != 0)) && ((p8_l2 != 0) && (( !(p8_l0 != 0)) && ( !(p8_l1 != 0)))))) || ((( !(p8_l3 != 0)) && ((p8_l2 != 0) && ((p8_l0 != 0) && (p8_l1 != 0)))) || ((p8_l3 != 0) && (( !(p8_l2 != 0)) && (( !(p8_l0 != 0)) && ( !(p8_l1 != 0)))))))))) && (((((( !(p7_l3 != 0)) && (( !(p7_l2 != 0)) && (( !(p7_l0 != 0)) && ( !(p7_l1 != 0))))) && (p7_c == 0.0)) && (((p7_l3 != 0) && (( !(p7_l2 != 0)) && (( !(p7_l0 != 0)) && ( !(p7_l1 != 0))))) || ((( !(p7_l3 != 0)) && ((p7_l2 != 0) && ((p7_l0 != 0) && (p7_l1 != 0)))) || ((( !(p7_l3 != 0)) && ((p7_l2 != 0) && ((p7_l1 != 0) && ( !(p7_l0 != 0))))) || ((( !(p7_l3 != 0)) && ((p7_l2 != 0) && ((p7_l0 != 0) && ( !(p7_l1 != 0))))) || ((( !(p7_l3 != 0)) && ((p7_l2 != 0) && (( !(p7_l0 != 0)) && ( !(p7_l1 != 0))))) || ((( !(p7_l3 != 0)) && (( !(p7_l2 != 0)) && ((p7_l0 != 0) && (p7_l1 != 0)))) || ((( !(p7_l3 != 0)) && (( !(p7_l2 != 0)) && ((p7_l1 != 0) && ( !(p7_l0 != 0))))) || ((( !(p7_l3 != 0)) && (( !(p7_l2 != 0)) && (( !(p7_l0 != 0)) && ( !(p7_l1 != 0))))) || (( !(p7_l3 != 0)) && (( !(p7_l2 != 0)) && ((p7_l0 != 0) && ( !(p7_l1 != 0)))))))))))))) && ((p7_c <= 16.0) || ( !(((( !(p7_l3 != 0)) && (( !(p7_l2 != 0)) && ((p7_l0 != 0) && ( !(p7_l1 != 0))))) || (( !(p7_l3 != 0)) && ((p7_l2 != 0) && (( !(p7_l0 != 0)) && ( !(p7_l1 != 0)))))) || ((( !(p7_l3 != 0)) && ((p7_l2 != 0) && ((p7_l0 != 0) && (p7_l1 != 0)))) || ((p7_l3 != 0) && (( !(p7_l2 != 0)) && (( !(p7_l0 != 0)) && ( !(p7_l1 != 0)))))))))) && (((((( !(p6_l3 != 0)) && (( !(p6_l2 != 0)) && (( !(p6_l0 != 0)) && ( !(p6_l1 != 0))))) && (p6_c == 0.0)) && (((p6_l3 != 0) && (( !(p6_l2 != 0)) && (( !(p6_l0 != 0)) && ( !(p6_l1 != 0))))) || ((( !(p6_l3 != 0)) && ((p6_l2 != 0) && ((p6_l0 != 0) && (p6_l1 != 0)))) || ((( !(p6_l3 != 0)) && ((p6_l2 != 0) && ((p6_l1 != 0) && ( !(p6_l0 != 0))))) || ((( !(p6_l3 != 0)) && ((p6_l2 != 0) && ((p6_l0 != 0) && ( !(p6_l1 != 0))))) || ((( !(p6_l3 != 0)) && ((p6_l2 != 0) && (( !(p6_l0 != 0)) && ( !(p6_l1 != 0))))) || ((( !(p6_l3 != 0)) && (( !(p6_l2 != 0)) && ((p6_l0 != 0) && (p6_l1 != 0)))) || ((( !(p6_l3 != 0)) && (( !(p6_l2 != 0)) && ((p6_l1 != 0) && ( !(p6_l0 != 0))))) || ((( !(p6_l3 != 0)) && (( !(p6_l2 != 0)) && (( !(p6_l0 != 0)) && ( !(p6_l1 != 0))))) || (( !(p6_l3 != 0)) && (( !(p6_l2 != 0)) && ((p6_l0 != 0) && ( !(p6_l1 != 0)))))))))))))) && ((p6_c <= 16.0) || ( !(((( !(p6_l3 != 0)) && (( !(p6_l2 != 0)) && ((p6_l0 != 0) && ( !(p6_l1 != 0))))) || (( !(p6_l3 != 0)) && ((p6_l2 != 0) && (( !(p6_l0 != 0)) && ( !(p6_l1 != 0)))))) || ((( !(p6_l3 != 0)) && ((p6_l2 != 0) && ((p6_l0 != 0) && (p6_l1 != 0)))) || ((p6_l3 != 0) && (( !(p6_l2 != 0)) && (( !(p6_l0 != 0)) && ( !(p6_l1 != 0)))))))))) && (((((( !(p5_l3 != 0)) && (( !(p5_l2 != 0)) && (( !(p5_l0 != 0)) && ( !(p5_l1 != 0))))) && (p5_c == 0.0)) && (((p5_l3 != 0) && (( !(p5_l2 != 0)) && (( !(p5_l0 != 0)) && ( !(p5_l1 != 0))))) || ((( !(p5_l3 != 0)) && ((p5_l2 != 0) && ((p5_l0 != 0) && (p5_l1 != 0)))) || ((( !(p5_l3 != 0)) && ((p5_l2 != 0) && ((p5_l1 != 0) && ( !(p5_l0 != 0))))) || ((( !(p5_l3 != 0)) && ((p5_l2 != 0) && ((p5_l0 != 0) && ( !(p5_l1 != 0))))) || ((( !(p5_l3 != 0)) && ((p5_l2 != 0) && (( !(p5_l0 != 0)) && ( !(p5_l1 != 0))))) || ((( !(p5_l3 != 0)) && (( !(p5_l2 != 0)) && ((p5_l0 != 0) && (p5_l1 != 0)))) || ((( !(p5_l3 != 0)) && (( !(p5_l2 != 0)) && ((p5_l1 != 0) && ( !(p5_l0 != 0))))) || ((( !(p5_l3 != 0)) && (( !(p5_l2 != 0)) && (( !(p5_l0 != 0)) && ( !(p5_l1 != 0))))) || (( !(p5_l3 != 0)) && (( !(p5_l2 != 0)) && ((p5_l0 != 0) && ( !(p5_l1 != 0)))))))))))))) && ((p5_c <= 16.0) || ( !(((( !(p5_l3 != 0)) && (( !(p5_l2 != 0)) && ((p5_l0 != 0) && ( !(p5_l1 != 0))))) || (( !(p5_l3 != 0)) && ((p5_l2 != 0) && (( !(p5_l0 != 0)) && ( !(p5_l1 != 0)))))) || ((( !(p5_l3 != 0)) && ((p5_l2 != 0) && ((p5_l0 != 0) && (p5_l1 != 0)))) || ((p5_l3 != 0) && (( !(p5_l2 != 0)) && (( !(p5_l0 != 0)) && ( !(p5_l1 != 0)))))))))) && (((((( !(p4_l3 != 0)) && (( !(p4_l2 != 0)) && (( !(p4_l0 != 0)) && ( !(p4_l1 != 0))))) && (p4_c == 0.0)) && (((p4_l3 != 0) && (( !(p4_l2 != 0)) && (( !(p4_l0 != 0)) && ( !(p4_l1 != 0))))) || ((( !(p4_l3 != 0)) && ((p4_l2 != 0) && ((p4_l0 != 0) && (p4_l1 != 0)))) || ((( !(p4_l3 != 0)) && ((p4_l2 != 0) && ((p4_l1 != 0) && ( !(p4_l0 != 0))))) || ((( !(p4_l3 != 0)) && ((p4_l2 != 0) && ((p4_l0 != 0) && ( !(p4_l1 != 0))))) || ((( !(p4_l3 != 0)) && ((p4_l2 != 0) && (( !(p4_l0 != 0)) && ( !(p4_l1 != 0))))) || ((( !(p4_l3 != 0)) && (( !(p4_l2 != 0)) && ((p4_l0 != 0) && (p4_l1 != 0)))) || ((( !(p4_l3 != 0)) && (( !(p4_l2 != 0)) && ((p4_l1 != 0) && ( !(p4_l0 != 0))))) || ((( !(p4_l3 != 0)) && (( !(p4_l2 != 0)) && (( !(p4_l0 != 0)) && ( !(p4_l1 != 0))))) || (( !(p4_l3 != 0)) && (( !(p4_l2 != 0)) && ((p4_l0 != 0) && ( !(p4_l1 != 0)))))))))))))) && ((p4_c <= 16.0) || ( !(((( !(p4_l3 != 0)) && (( !(p4_l2 != 0)) && ((p4_l0 != 0) && ( !(p4_l1 != 0))))) || (( !(p4_l3 != 0)) && ((p4_l2 != 0) && (( !(p4_l0 != 0)) && ( !(p4_l1 != 0)))))) || ((( !(p4_l3 != 0)) && ((p4_l2 != 0) && ((p4_l0 != 0) && (p4_l1 != 0)))) || ((p4_l3 != 0) && (( !(p4_l2 != 0)) && (( !(p4_l0 != 0)) && ( !(p4_l1 != 0)))))))))) && (((((( !(p3_l3 != 0)) && (( !(p3_l2 != 0)) && (( !(p3_l0 != 0)) && ( !(p3_l1 != 0))))) && (p3_c == 0.0)) && (((p3_l3 != 0) && (( !(p3_l2 != 0)) && (( !(p3_l0 != 0)) && ( !(p3_l1 != 0))))) || ((( !(p3_l3 != 0)) && ((p3_l2 != 0) && ((p3_l0 != 0) && (p3_l1 != 0)))) || ((( !(p3_l3 != 0)) && ((p3_l2 != 0) && ((p3_l1 != 0) && ( !(p3_l0 != 0))))) || ((( !(p3_l3 != 0)) && ((p3_l2 != 0) && ((p3_l0 != 0) && ( !(p3_l1 != 0))))) || ((( !(p3_l3 != 0)) && ((p3_l2 != 0) && (( !(p3_l0 != 0)) && ( !(p3_l1 != 0))))) || ((( !(p3_l3 != 0)) && (( !(p3_l2 != 0)) && ((p3_l0 != 0) && (p3_l1 != 0)))) || ((( !(p3_l3 != 0)) && (( !(p3_l2 != 0)) && ((p3_l1 != 0) && ( !(p3_l0 != 0))))) || ((( !(p3_l3 != 0)) && (( !(p3_l2 != 0)) && (( !(p3_l0 != 0)) && ( !(p3_l1 != 0))))) || (( !(p3_l3 != 0)) && (( !(p3_l2 != 0)) && ((p3_l0 != 0) && ( !(p3_l1 != 0)))))))))))))) && ((p3_c <= 16.0) || ( !(((( !(p3_l3 != 0)) && (( !(p3_l2 != 0)) && ((p3_l0 != 0) && ( !(p3_l1 != 0))))) || (( !(p3_l3 != 0)) && ((p3_l2 != 0) && (( !(p3_l0 != 0)) && ( !(p3_l1 != 0)))))) || ((( !(p3_l3 != 0)) && ((p3_l2 != 0) && ((p3_l0 != 0) && (p3_l1 != 0)))) || ((p3_l3 != 0) && (( !(p3_l2 != 0)) && (( !(p3_l0 != 0)) && ( !(p3_l1 != 0)))))))))) && (((((( !(p2_l3 != 0)) && (( !(p2_l2 != 0)) && (( !(p2_l0 != 0)) && ( !(p2_l1 != 0))))) && (p2_c == 0.0)) && (((p2_l3 != 0) && (( !(p2_l2 != 0)) && (( !(p2_l0 != 0)) && ( !(p2_l1 != 0))))) || ((( !(p2_l3 != 0)) && ((p2_l2 != 0) && ((p2_l0 != 0) && (p2_l1 != 0)))) || ((( !(p2_l3 != 0)) && ((p2_l2 != 0) && ((p2_l1 != 0) && ( !(p2_l0 != 0))))) || ((( !(p2_l3 != 0)) && ((p2_l2 != 0) && ((p2_l0 != 0) && ( !(p2_l1 != 0))))) || ((( !(p2_l3 != 0)) && ((p2_l2 != 0) && (( !(p2_l0 != 0)) && ( !(p2_l1 != 0))))) || ((( !(p2_l3 != 0)) && (( !(p2_l2 != 0)) && ((p2_l0 != 0) && (p2_l1 != 0)))) || ((( !(p2_l3 != 0)) && (( !(p2_l2 != 0)) && ((p2_l1 != 0) && ( !(p2_l0 != 0))))) || ((( !(p2_l3 != 0)) && (( !(p2_l2 != 0)) && (( !(p2_l0 != 0)) && ( !(p2_l1 != 0))))) || (( !(p2_l3 != 0)) && (( !(p2_l2 != 0)) && ((p2_l0 != 0) && ( !(p2_l1 != 0)))))))))))))) && ((p2_c <= 16.0) || ( !(((( !(p2_l3 != 0)) && (( !(p2_l2 != 0)) && ((p2_l0 != 0) && ( !(p2_l1 != 0))))) || (( !(p2_l3 != 0)) && ((p2_l2 != 0) && (( !(p2_l0 != 0)) && ( !(p2_l1 != 0)))))) || ((( !(p2_l3 != 0)) && ((p2_l2 != 0) && ((p2_l0 != 0) && (p2_l1 != 0)))) || ((p2_l3 != 0) && (( !(p2_l2 != 0)) && (( !(p2_l0 != 0)) && ( !(p2_l1 != 0)))))))))) && (((((( !(p1_l3 != 0)) && (( !(p1_l2 != 0)) && (( !(p1_l0 != 0)) && ( !(p1_l1 != 0))))) && (p1_c == 0.0)) && (((p1_l3 != 0) && (( !(p1_l2 != 0)) && (( !(p1_l0 != 0)) && ( !(p1_l1 != 0))))) || ((( !(p1_l3 != 0)) && ((p1_l2 != 0) && ((p1_l0 != 0) && (p1_l1 != 0)))) || ((( !(p1_l3 != 0)) && ((p1_l2 != 0) && ((p1_l1 != 0) && ( !(p1_l0 != 0))))) || ((( !(p1_l3 != 0)) && ((p1_l2 != 0) && ((p1_l0 != 0) && ( !(p1_l1 != 0))))) || ((( !(p1_l3 != 0)) && ((p1_l2 != 0) && (( !(p1_l0 != 0)) && ( !(p1_l1 != 0))))) || ((( !(p1_l3 != 0)) && (( !(p1_l2 != 0)) && ((p1_l0 != 0) && (p1_l1 != 0)))) || ((( !(p1_l3 != 0)) && (( !(p1_l2 != 0)) && ((p1_l1 != 0) && ( !(p1_l0 != 0))))) || ((( !(p1_l3 != 0)) && (( !(p1_l2 != 0)) && (( !(p1_l0 != 0)) && ( !(p1_l1 != 0))))) || (( !(p1_l3 != 0)) && (( !(p1_l2 != 0)) && ((p1_l0 != 0) && ( !(p1_l1 != 0)))))))))))))) && ((p1_c <= 16.0) || ( !(((( !(p1_l3 != 0)) && (( !(p1_l2 != 0)) && ((p1_l0 != 0) && ( !(p1_l1 != 0))))) || (( !(p1_l3 != 0)) && ((p1_l2 != 0) && (( !(p1_l0 != 0)) && ( !(p1_l1 != 0)))))) || ((( !(p1_l3 != 0)) && ((p1_l2 != 0) && ((p1_l0 != 0) && (p1_l1 != 0)))) || ((p1_l3 != 0) && (( !(p1_l2 != 0)) && (( !(p1_l0 != 0)) && ( !(p1_l1 != 0)))))))))) && (((((( !(p0_l3 != 0)) && (( !(p0_l2 != 0)) && (( !(p0_l0 != 0)) && ( !(p0_l1 != 0))))) && (p0_c == 0.0)) && (((p0_l3 != 0) && (( !(p0_l2 != 0)) && (( !(p0_l0 != 0)) && ( !(p0_l1 != 0))))) || ((( !(p0_l3 != 0)) && ((p0_l2 != 0) && ((p0_l0 != 0) && (p0_l1 != 0)))) || ((( !(p0_l3 != 0)) && ((p0_l2 != 0) && ((p0_l1 != 0) && ( !(p0_l0 != 0))))) || ((( !(p0_l3 != 0)) && ((p0_l2 != 0) && ((p0_l0 != 0) && ( !(p0_l1 != 0))))) || ((( !(p0_l3 != 0)) && ((p0_l2 != 0) && (( !(p0_l0 != 0)) && ( !(p0_l1 != 0))))) || ((( !(p0_l3 != 0)) && (( !(p0_l2 != 0)) && ((p0_l0 != 0) && (p0_l1 != 0)))) || ((( !(p0_l3 != 0)) && (( !(p0_l2 != 0)) && ((p0_l1 != 0) && ( !(p0_l0 != 0))))) || ((( !(p0_l3 != 0)) && (( !(p0_l2 != 0)) && (( !(p0_l0 != 0)) && ( !(p0_l1 != 0))))) || (( !(p0_l3 != 0)) && (( !(p0_l2 != 0)) && ((p0_l0 != 0) && ( !(p0_l1 != 0)))))))))))))) && ((p0_c <= 16.0) || ( !(((( !(p0_l3 != 0)) && (( !(p0_l2 != 0)) && ((p0_l0 != 0) && ( !(p0_l1 != 0))))) || (( !(p0_l3 != 0)) && ((p0_l2 != 0) && (( !(p0_l0 != 0)) && ( !(p0_l1 != 0)))))) || ((( !(p0_l3 != 0)) && ((p0_l2 != 0) && ((p0_l0 != 0) && (p0_l1 != 0)))) || ((p0_l3 != 0) && (( !(p0_l2 != 0)) && (( !(p0_l0 != 0)) && ( !(p0_l1 != 0)))))))))) && ((0.0 <= delta) && ((v1 == 14) || ((v1 == 13) || ((v1 == 12) || ((v1 == 11) || ((v1 == 10) || ((v1 == 9) || ((v1 == 8) || ((v1 == 7) || ((v1 == 6) || ((v1 == 5) || ((v1 == 4) || ((v1 == 3) || ((v1 == 2) || ((v1 == 0) || (v1 == 1)))))))))))))))))))))))))))))) && (delta == _diverge_delta));
while (__ok) {
_x_p12_l3 = __VERIFIER_nondet_bool();
_x_p12_l2 = __VERIFIER_nondet_bool();
_x_p12_l1 = __VERIFIER_nondet_bool();
_x__diverge_delta = __VERIFIER_nondet_float();
_x_p12_l0 = __VERIFIER_nondet_bool();
_x_p12_evt = __VERIFIER_nondet_bool();
_x_p12_c = __VERIFIER_nondet_float();
_x_p10_l3 = __VERIFIER_nondet_bool();
_x_p10_l2 = __VERIFIER_nondet_bool();
_x_p10_l1 = __VERIFIER_nondet_bool();
_x_p10_l0 = __VERIFIER_nondet_bool();
_x_p10_evt = __VERIFIER_nondet_bool();
_x_p10_c = __VERIFIER_nondet_float();
_x_p3_l3 = __VERIFIER_nondet_bool();
_x_p3_evt = __VERIFIER_nondet_bool();
_x_p0_l2 = __VERIFIER_nondet_bool();
_x_p8_l3 = __VERIFIER_nondet_bool();
_x_p0_l1 = __VERIFIER_nondet_bool();
_x_p2_l3 = __VERIFIER_nondet_bool();
_x_p2_evt = __VERIFIER_nondet_bool();
_x_delta = __VERIFIER_nondet_float();
_x_v1 = __VERIFIER_nondet_int();
_x_v2 = __VERIFIER_nondet_bool();
_x_p8_c = __VERIFIER_nondet_float();
_x_p0_l3 = __VERIFIER_nondet_bool();
_x_p8_evt = __VERIFIER_nondet_bool();
_x_p8_l2 = __VERIFIER_nondet_bool();
_x_p13_evt = __VERIFIER_nondet_bool();
_x_p4_evt = __VERIFIER_nondet_bool();
_x_p1_c = __VERIFIER_nondet_float();
_x_p9_l3 = __VERIFIER_nondet_bool();
_x_p3_l2 = __VERIFIER_nondet_bool();
_x_p6_l3 = __VERIFIER_nondet_bool();
_x_p1_l3 = __VERIFIER_nondet_bool();
_x_p0_l0 = __VERIFIER_nondet_bool();
_x_p8_l1 = __VERIFIER_nondet_bool();
_x_p1_evt = __VERIFIER_nondet_bool();
_x_p13_l2 = __VERIFIER_nondet_bool();
_x_p1_l1 = __VERIFIER_nondet_bool();
_x_p7_l3 = __VERIFIER_nondet_bool();
_x_p4_l2 = __VERIFIER_nondet_bool();
_x_p13_l3 = __VERIFIER_nondet_bool();
_x_p1_l2 = __VERIFIER_nondet_bool();
_x_p4_l3 = __VERIFIER_nondet_bool();
_x_p11_c = __VERIFIER_nondet_float();
_x_p5_c = __VERIFIER_nondet_float();
_x_p11_evt = __VERIFIER_nondet_bool();
_x_p2_c = __VERIFIER_nondet_float();
_x_p5_evt = __VERIFIER_nondet_bool();
_x_p11_l0 = __VERIFIER_nondet_bool();
_x_p0_c = __VERIFIER_nondet_float();
_x_p5_l0 = __VERIFIER_nondet_bool();
_x_p11_l1 = __VERIFIER_nondet_bool();
_x_p2_l0 = __VERIFIER_nondet_bool();
_x_p0_evt = __VERIFIER_nondet_bool();
_x_p5_l1 = __VERIFIER_nondet_bool();
_x_p11_l2 = __VERIFIER_nondet_bool();
_x_p2_l1 = __VERIFIER_nondet_bool();
_x_p5_l2 = __VERIFIER_nondet_bool();
_x_p11_l3 = __VERIFIER_nondet_bool();
_x_p2_l2 = __VERIFIER_nondet_bool();
_x_p5_l3 = __VERIFIER_nondet_bool();
_x_p9_l0 = __VERIFIER_nondet_bool();
_x_p6_l0 = __VERIFIER_nondet_bool();
_x_p9_l1 = __VERIFIER_nondet_bool();
_x_p3_l0 = __VERIFIER_nondet_bool();
_x_p6_l1 = __VERIFIER_nondet_bool();
_x_p9_l2 = __VERIFIER_nondet_bool();
_x_p3_l1 = __VERIFIER_nondet_bool();
_x_p6_l2 = __VERIFIER_nondet_bool();
_x_p7_c = __VERIFIER_nondet_float();
_x_p13_c = __VERIFIER_nondet_float();
_x_p4_c = __VERIFIER_nondet_float();
_x_p7_evt = __VERIFIER_nondet_bool();
_x_p7_l0 = __VERIFIER_nondet_bool();
_x_p13_l0 = __VERIFIER_nondet_bool();
_x_p4_l0 = __VERIFIER_nondet_bool();
_x_p7_l1 = __VERIFIER_nondet_bool();
_x_p13_l1 = __VERIFIER_nondet_bool();
_x_p1_l0 = __VERIFIER_nondet_bool();
_x_p4_l1 = __VERIFIER_nondet_bool();
_x_p7_l2 = __VERIFIER_nondet_bool();
_x_p8_l0 = __VERIFIER_nondet_bool();
_x_p6_c = __VERIFIER_nondet_float();
_x_p9_c = __VERIFIER_nondet_float();
_x_p3_c = __VERIFIER_nondet_float();
_x_p6_evt = __VERIFIER_nondet_bool();
_x_p9_evt = __VERIFIER_nondet_bool();
__ok = ((((((((((((((((((((((((_x_p13_l3 != 0) && (( !(_x_p13_l2 != 0)) && (( !(_x_p13_l0 != 0)) && ( !(_x_p13_l1 != 0))))) || ((( !(_x_p13_l3 != 0)) && ((_x_p13_l2 != 0) && ((_x_p13_l0 != 0) && (_x_p13_l1 != 0)))) || ((( !(_x_p13_l3 != 0)) && ((_x_p13_l2 != 0) && ((_x_p13_l1 != 0) && ( !(_x_p13_l0 != 0))))) || ((( !(_x_p13_l3 != 0)) && ((_x_p13_l2 != 0) && ((_x_p13_l0 != 0) && ( !(_x_p13_l1 != 0))))) || ((( !(_x_p13_l3 != 0)) && ((_x_p13_l2 != 0) && (( !(_x_p13_l0 != 0)) && ( !(_x_p13_l1 != 0))))) || ((( !(_x_p13_l3 != 0)) && (( !(_x_p13_l2 != 0)) && ((_x_p13_l0 != 0) && (_x_p13_l1 != 0)))) || ((( !(_x_p13_l3 != 0)) && (( !(_x_p13_l2 != 0)) && ((_x_p13_l1 != 0) && ( !(_x_p13_l0 != 0))))) || ((( !(_x_p13_l3 != 0)) && (( !(_x_p13_l2 != 0)) && (( !(_x_p13_l0 != 0)) && ( !(_x_p13_l1 != 0))))) || (( !(_x_p13_l3 != 0)) && (( !(_x_p13_l2 != 0)) && ((_x_p13_l0 != 0) && ( !(_x_p13_l1 != 0))))))))))))) && ((_x_p13_c <= 16.0) || ( !(((( !(_x_p13_l3 != 0)) && (( !(_x_p13_l2 != 0)) && ((_x_p13_l0 != 0) && ( !(_x_p13_l1 != 0))))) || (( !(_x_p13_l3 != 0)) && ((_x_p13_l2 != 0) && (( !(_x_p13_l0 != 0)) && ( !(_x_p13_l1 != 0)))))) || ((( !(_x_p13_l3 != 0)) && ((_x_p13_l2 != 0) && ((_x_p13_l0 != 0) && (_x_p13_l1 != 0)))) || ((_x_p13_l3 != 0) && (( !(_x_p13_l2 != 0)) && (( !(_x_p13_l0 != 0)) && ( !(_x_p13_l1 != 0)))))))))) && ((delta <= 0.0) || ((((((p13_l0 != 0) == (_x_p13_l0 != 0)) && ((p13_l1 != 0) == (_x_p13_l1 != 0))) && ((p13_l2 != 0) == (_x_p13_l2 != 0))) && ((p13_l3 != 0) == (_x_p13_l3 != 0))) && ((delta + (p13_c + (-1.0 * _x_p13_c))) == 0.0)))) && ((p13_evt != 0) || ((((((p13_l0 != 0) == (_x_p13_l0 != 0)) && ((p13_l1 != 0) == (_x_p13_l1 != 0))) && ((p13_l2 != 0) == (_x_p13_l2 != 0))) && ((p13_l3 != 0) == (_x_p13_l3 != 0))) && ((delta + (p13_c + (-1.0 * _x_p13_c))) == 0.0)))) && (((v1 == _x_v1) && (((v1 == 0) && (( !(_x_p13_l3 != 0)) && (( !(_x_p13_l2 != 0)) && ((_x_p13_l0 != 0) && ( !(_x_p13_l1 != 0)))))) && (((v2 != 0) == (_x_v2 != 0)) && (_x_p13_c == 0.0)))) || ( !((( !(p13_l3 != 0)) && (( !(p13_l2 != 0)) && (( !(p13_l0 != 0)) && ( !(p13_l1 != 0))))) && ((delta == 0.0) && (p13_evt != 0)))))) && (((((v2 != 0) == (_x_v2 != 0)) && (_x_p13_c == 0.0)) && ((( !(_x_p13_l3 != 0)) && (( !(_x_p13_l2 != 0)) && ((_x_p13_l1 != 0) && ( !(_x_p13_l0 != 0))))) && (_x_v1 == 14))) || ( !((( !(p13_l3 != 0)) && (( !(p13_l2 != 0)) && ((p13_l0 != 0) && ( !(p13_l1 != 0))))) && ((delta == 0.0) && (p13_evt != 0)))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && (((( !(_x_p13_l3 != 0)) && (( !(_x_p13_l2 != 0)) && (( !(_x_p13_l0 != 0)) && ( !(_x_p13_l1 != 0))))) || (( !(_x_p13_l3 != 0)) && (( !(_x_p13_l2 != 0)) && ((_x_p13_l0 != 0) && (_x_p13_l1 != 0))))) && (p13_c == _x_p13_c))) || ( !((( !(p13_l3 != 0)) && (( !(p13_l2 != 0)) && ((p13_l1 != 0) && ( !(p13_l0 != 0))))) && ((delta == 0.0) && (p13_evt != 0)))))) && (( !(v1 == 14)) || ( !((( !(_x_p13_l3 != 0)) && (( !(_x_p13_l2 != 0)) && (( !(_x_p13_l0 != 0)) && ( !(_x_p13_l1 != 0))))) && ((( !(p13_l3 != 0)) && (( !(p13_l2 != 0)) && ((p13_l1 != 0) && ( !(p13_l0 != 0))))) && ((delta == 0.0) && (p13_evt != 0))))))) && (((v1 == 14) && ( !(p13_c <= 16.0))) || ( !((( !(_x_p13_l3 != 0)) && (( !(_x_p13_l2 != 0)) && ((_x_p13_l0 != 0) && (_x_p13_l1 != 0)))) && ((( !(p13_l3 != 0)) && (( !(p13_l2 != 0)) && ((p13_l1 != 0) && ( !(p13_l0 != 0))))) && ((delta == 0.0) && (p13_evt != 0))))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && ((( !(_x_p13_l3 != 0)) && (( !(_x_p13_l2 != 0)) && (( !(_x_p13_l0 != 0)) && ( !(_x_p13_l1 != 0))))) || (( !(_x_p13_l3 != 0)) && ((_x_p13_l2 != 0) && (( !(_x_p13_l0 != 0)) && ( !(_x_p13_l1 != 0))))))) || ( !((( !(p13_l3 != 0)) && (( !(p13_l2 != 0)) && ((p13_l0 != 0) && (p13_l1 != 0)))) && ((delta == 0.0) && (p13_evt != 0)))))) && (((v2 != 0) && (p13_c == _x_p13_c)) || ( !(((delta == 0.0) && (p13_evt != 0)) && ((( !(_x_p13_l3 != 0)) && (( !(_x_p13_l2 != 0)) && (( !(_x_p13_l0 != 0)) && ( !(_x_p13_l1 != 0))))) && (( !(p13_l3 != 0)) && (( !(p13_l2 != 0)) && ((p13_l0 != 0) && (p13_l1 != 0))))))))) && ((( !(v2 != 0)) && (_x_p13_c == 0.0)) || ( !(((delta == 0.0) && (p13_evt != 0)) && ((( !(p13_l3 != 0)) && (( !(p13_l2 != 0)) && ((p13_l0 != 0) && (p13_l1 != 0)))) && (( !(_x_p13_l3 != 0)) && ((_x_p13_l2 != 0) && (( !(_x_p13_l0 != 0)) && ( !(_x_p13_l1 != 0)))))))))) && ((((_x_v2 != 0) && (( !(_x_p13_l3 != 0)) && ((_x_p13_l2 != 0) && ((_x_p13_l0 != 0) && ( !(_x_p13_l1 != 0)))))) && ((v1 == _x_v1) && (_x_p13_c == 0.0))) || ( !((( !(p13_l3 != 0)) && ((p13_l2 != 0) && (( !(p13_l0 != 0)) && ( !(p13_l1 != 0))))) && ((delta == 0.0) && (p13_evt != 0)))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && ((p13_c == _x_p13_c) && ((( !(_x_p13_l3 != 0)) && (( !(_x_p13_l2 != 0)) && (( !(_x_p13_l0 != 0)) && ( !(_x_p13_l1 != 0))))) || (( !(_x_p13_l3 != 0)) && ((_x_p13_l2 != 0) && ((_x_p13_l1 != 0) && ( !(_x_p13_l0 != 0)))))))) || ( !((( !(p13_l3 != 0)) && ((p13_l2 != 0) && ((p13_l0 != 0) && ( !(p13_l1 != 0))))) && ((delta == 0.0) && (p13_evt != 0)))))) && (( !(v1 == 14)) || ( !(((delta == 0.0) && (p13_evt != 0)) && ((( !(_x_p13_l3 != 0)) && (( !(_x_p13_l2 != 0)) && (( !(_x_p13_l0 != 0)) && ( !(_x_p13_l1 != 0))))) && (( !(p13_l3 != 0)) && ((p13_l2 != 0) && ((p13_l0 != 0) && ( !(p13_l1 != 0)))))))))) && ((v1 == 14) || ( !(((delta == 0.0) && (p13_evt != 0)) && ((( !(p13_l3 != 0)) && ((p13_l2 != 0) && ((p13_l0 != 0) && ( !(p13_l1 != 0))))) && (( !(_x_p13_l3 != 0)) && ((_x_p13_l2 != 0) && ((_x_p13_l1 != 0) && ( !(_x_p13_l0 != 0)))))))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && ((( !(_x_p13_l3 != 0)) && ((_x_p13_l2 != 0) && ((_x_p13_l0 != 0) && (_x_p13_l1 != 0)))) && (_x_p13_c == 0.0))) || ( !((( !(p13_l3 != 0)) && ((p13_l2 != 0) && ((p13_l1 != 0) && ( !(p13_l0 != 0))))) && ((delta == 0.0) && (p13_evt != 0)))))) && ((((v1 == _x_v1) && (_x_p13_c == 0.0)) && (( !(_x_v2 != 0)) && ((_x_p13_l3 != 0) && (( !(_x_p13_l2 != 0)) && (( !(_x_p13_l0 != 0)) && ( !(_x_p13_l1 != 0))))))) || ( !((( !(p13_l3 != 0)) && ((p13_l2 != 0) && ((p13_l0 != 0) && (p13_l1 != 0)))) && ((delta == 0.0) && (p13_evt != 0)))))) && ((((_x_v1 == 0) && (( !(_x_p13_l3 != 0)) && (( !(_x_p13_l2 != 0)) && (( !(_x_p13_l0 != 0)) && ( !(_x_p13_l1 != 0)))))) && (((v2 != 0) == (_x_v2 != 0)) && (p13_c == _x_p13_c))) || ( !(((p13_l3 != 0) && (( !(p13_l2 != 0)) && (( !(p13_l0 != 0)) && ( !(p13_l1 != 0))))) && ((delta == 0.0) && (p13_evt != 0)))))) && ((((((((((((((((((((((_x_p12_l3 != 0) && (( !(_x_p12_l2 != 0)) && (( !(_x_p12_l0 != 0)) && ( !(_x_p12_l1 != 0))))) || ((( !(_x_p12_l3 != 0)) && ((_x_p12_l2 != 0) && ((_x_p12_l0 != 0) && (_x_p12_l1 != 0)))) || ((( !(_x_p12_l3 != 0)) && ((_x_p12_l2 != 0) && ((_x_p12_l1 != 0) && ( !(_x_p12_l0 != 0))))) || ((( !(_x_p12_l3 != 0)) && ((_x_p12_l2 != 0) && ((_x_p12_l0 != 0) && ( !(_x_p12_l1 != 0))))) || ((( !(_x_p12_l3 != 0)) && ((_x_p12_l2 != 0) && (( !(_x_p12_l0 != 0)) && ( !(_x_p12_l1 != 0))))) || ((( !(_x_p12_l3 != 0)) && (( !(_x_p12_l2 != 0)) && ((_x_p12_l0 != 0) && (_x_p12_l1 != 0)))) || ((( !(_x_p12_l3 != 0)) && (( !(_x_p12_l2 != 0)) && ((_x_p12_l1 != 0) && ( !(_x_p12_l0 != 0))))) || ((( !(_x_p12_l3 != 0)) && (( !(_x_p12_l2 != 0)) && (( !(_x_p12_l0 != 0)) && ( !(_x_p12_l1 != 0))))) || (( !(_x_p12_l3 != 0)) && (( !(_x_p12_l2 != 0)) && ((_x_p12_l0 != 0) && ( !(_x_p12_l1 != 0))))))))))))) && ((_x_p12_c <= 16.0) || ( !(((( !(_x_p12_l3 != 0)) && (( !(_x_p12_l2 != 0)) && ((_x_p12_l0 != 0) && ( !(_x_p12_l1 != 0))))) || (( !(_x_p12_l3 != 0)) && ((_x_p12_l2 != 0) && (( !(_x_p12_l0 != 0)) && ( !(_x_p12_l1 != 0)))))) || ((( !(_x_p12_l3 != 0)) && ((_x_p12_l2 != 0) && ((_x_p12_l0 != 0) && (_x_p12_l1 != 0)))) || ((_x_p12_l3 != 0) && (( !(_x_p12_l2 != 0)) && (( !(_x_p12_l0 != 0)) && ( !(_x_p12_l1 != 0)))))))))) && ((delta <= 0.0) || ((((((p12_l0 != 0) == (_x_p12_l0 != 0)) && ((p12_l1 != 0) == (_x_p12_l1 != 0))) && ((p12_l2 != 0) == (_x_p12_l2 != 0))) && ((p12_l3 != 0) == (_x_p12_l3 != 0))) && ((delta + (p12_c + (-1.0 * _x_p12_c))) == 0.0)))) && ((p12_evt != 0) || ((((((p12_l0 != 0) == (_x_p12_l0 != 0)) && ((p12_l1 != 0) == (_x_p12_l1 != 0))) && ((p12_l2 != 0) == (_x_p12_l2 != 0))) && ((p12_l3 != 0) == (_x_p12_l3 != 0))) && ((delta + (p12_c + (-1.0 * _x_p12_c))) == 0.0)))) && (((v1 == _x_v1) && (((v1 == 0) && (( !(_x_p12_l3 != 0)) && (( !(_x_p12_l2 != 0)) && ((_x_p12_l0 != 0) && ( !(_x_p12_l1 != 0)))))) && (((v2 != 0) == (_x_v2 != 0)) && (_x_p12_c == 0.0)))) || ( !((( !(p12_l3 != 0)) && (( !(p12_l2 != 0)) && (( !(p12_l0 != 0)) && ( !(p12_l1 != 0))))) && ((delta == 0.0) && (p12_evt != 0)))))) && (((((v2 != 0) == (_x_v2 != 0)) && (_x_p12_c == 0.0)) && ((( !(_x_p12_l3 != 0)) && (( !(_x_p12_l2 != 0)) && ((_x_p12_l1 != 0) && ( !(_x_p12_l0 != 0))))) && (_x_v1 == 13))) || ( !((( !(p12_l3 != 0)) && (( !(p12_l2 != 0)) && ((p12_l0 != 0) && ( !(p12_l1 != 0))))) && ((delta == 0.0) && (p12_evt != 0)))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && (((( !(_x_p12_l3 != 0)) && (( !(_x_p12_l2 != 0)) && (( !(_x_p12_l0 != 0)) && ( !(_x_p12_l1 != 0))))) || (( !(_x_p12_l3 != 0)) && (( !(_x_p12_l2 != 0)) && ((_x_p12_l0 != 0) && (_x_p12_l1 != 0))))) && (p12_c == _x_p12_c))) || ( !((( !(p12_l3 != 0)) && (( !(p12_l2 != 0)) && ((p12_l1 != 0) && ( !(p12_l0 != 0))))) && ((delta == 0.0) && (p12_evt != 0)))))) && (( !(v1 == 13)) || ( !((( !(_x_p12_l3 != 0)) && (( !(_x_p12_l2 != 0)) && (( !(_x_p12_l0 != 0)) && ( !(_x_p12_l1 != 0))))) && ((( !(p12_l3 != 0)) && (( !(p12_l2 != 0)) && ((p12_l1 != 0) && ( !(p12_l0 != 0))))) && ((delta == 0.0) && (p12_evt != 0))))))) && (((v1 == 13) && ( !(p12_c <= 16.0))) || ( !((( !(_x_p12_l3 != 0)) && (( !(_x_p12_l2 != 0)) && ((_x_p12_l0 != 0) && (_x_p12_l1 != 0)))) && ((( !(p12_l3 != 0)) && (( !(p12_l2 != 0)) && ((p12_l1 != 0) && ( !(p12_l0 != 0))))) && ((delta == 0.0) && (p12_evt != 0))))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && ((( !(_x_p12_l3 != 0)) && (( !(_x_p12_l2 != 0)) && (( !(_x_p12_l0 != 0)) && ( !(_x_p12_l1 != 0))))) || (( !(_x_p12_l3 != 0)) && ((_x_p12_l2 != 0) && (( !(_x_p12_l0 != 0)) && ( !(_x_p12_l1 != 0))))))) || ( !((( !(p12_l3 != 0)) && (( !(p12_l2 != 0)) && ((p12_l0 != 0) && (p12_l1 != 0)))) && ((delta == 0.0) && (p12_evt != 0)))))) && (((v2 != 0) && (p12_c == _x_p12_c)) || ( !(((delta == 0.0) && (p12_evt != 0)) && ((( !(_x_p12_l3 != 0)) && (( !(_x_p12_l2 != 0)) && (( !(_x_p12_l0 != 0)) && ( !(_x_p12_l1 != 0))))) && (( !(p12_l3 != 0)) && (( !(p12_l2 != 0)) && ((p12_l0 != 0) && (p12_l1 != 0))))))))) && ((( !(v2 != 0)) && (_x_p12_c == 0.0)) || ( !(((delta == 0.0) && (p12_evt != 0)) && ((( !(p12_l3 != 0)) && (( !(p12_l2 != 0)) && ((p12_l0 != 0) && (p12_l1 != 0)))) && (( !(_x_p12_l3 != 0)) && ((_x_p12_l2 != 0) && (( !(_x_p12_l0 != 0)) && ( !(_x_p12_l1 != 0)))))))))) && ((((_x_v2 != 0) && (( !(_x_p12_l3 != 0)) && ((_x_p12_l2 != 0) && ((_x_p12_l0 != 0) && ( !(_x_p12_l1 != 0)))))) && ((v1 == _x_v1) && (_x_p12_c == 0.0))) || ( !((( !(p12_l3 != 0)) && ((p12_l2 != 0) && (( !(p12_l0 != 0)) && ( !(p12_l1 != 0))))) && ((delta == 0.0) && (p12_evt != 0)))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && ((p12_c == _x_p12_c) && ((( !(_x_p12_l3 != 0)) && (( !(_x_p12_l2 != 0)) && (( !(_x_p12_l0 != 0)) && ( !(_x_p12_l1 != 0))))) || (( !(_x_p12_l3 != 0)) && ((_x_p12_l2 != 0) && ((_x_p12_l1 != 0) && ( !(_x_p12_l0 != 0)))))))) || ( !((( !(p12_l3 != 0)) && ((p12_l2 != 0) && ((p12_l0 != 0) && ( !(p12_l1 != 0))))) && ((delta == 0.0) && (p12_evt != 0)))))) && (( !(v1 == 13)) || ( !(((delta == 0.0) && (p12_evt != 0)) && ((( !(_x_p12_l3 != 0)) && (( !(_x_p12_l2 != 0)) && (( !(_x_p12_l0 != 0)) && ( !(_x_p12_l1 != 0))))) && (( !(p12_l3 != 0)) && ((p12_l2 != 0) && ((p12_l0 != 0) && ( !(p12_l1 != 0)))))))))) && ((v1 == 13) || ( !(((delta == 0.0) && (p12_evt != 0)) && ((( !(p12_l3 != 0)) && ((p12_l2 != 0) && ((p12_l0 != 0) && ( !(p12_l1 != 0))))) && (( !(_x_p12_l3 != 0)) && ((_x_p12_l2 != 0) && ((_x_p12_l1 != 0) && ( !(_x_p12_l0 != 0)))))))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && ((( !(_x_p12_l3 != 0)) && ((_x_p12_l2 != 0) && ((_x_p12_l0 != 0) && (_x_p12_l1 != 0)))) && (_x_p12_c == 0.0))) || ( !((( !(p12_l3 != 0)) && ((p12_l2 != 0) && ((p12_l1 != 0) && ( !(p12_l0 != 0))))) && ((delta == 0.0) && (p12_evt != 0)))))) && ((((v1 == _x_v1) && (_x_p12_c == 0.0)) && (( !(_x_v2 != 0)) && ((_x_p12_l3 != 0) && (( !(_x_p12_l2 != 0)) && (( !(_x_p12_l0 != 0)) && ( !(_x_p12_l1 != 0))))))) || ( !((( !(p12_l3 != 0)) && ((p12_l2 != 0) && ((p12_l0 != 0) && (p12_l1 != 0)))) && ((delta == 0.0) && (p12_evt != 0)))))) && ((((_x_v1 == 0) && (( !(_x_p12_l3 != 0)) && (( !(_x_p12_l2 != 0)) && (( !(_x_p12_l0 != 0)) && ( !(_x_p12_l1 != 0)))))) && (((v2 != 0) == (_x_v2 != 0)) && (p12_c == _x_p12_c))) || ( !(((p12_l3 != 0) && (( !(p12_l2 != 0)) && (( !(p12_l0 != 0)) && ( !(p12_l1 != 0))))) && ((delta == 0.0) && (p12_evt != 0)))))) && ((((((((((((((((((((((_x_p11_l3 != 0) && (( !(_x_p11_l2 != 0)) && (( !(_x_p11_l0 != 0)) && ( !(_x_p11_l1 != 0))))) || ((( !(_x_p11_l3 != 0)) && ((_x_p11_l2 != 0) && ((_x_p11_l0 != 0) && (_x_p11_l1 != 0)))) || ((( !(_x_p11_l3 != 0)) && ((_x_p11_l2 != 0) && ((_x_p11_l1 != 0) && ( !(_x_p11_l0 != 0))))) || ((( !(_x_p11_l3 != 0)) && ((_x_p11_l2 != 0) && ((_x_p11_l0 != 0) && ( !(_x_p11_l1 != 0))))) || ((( !(_x_p11_l3 != 0)) && ((_x_p11_l2 != 0) && (( !(_x_p11_l0 != 0)) && ( !(_x_p11_l1 != 0))))) || ((( !(_x_p11_l3 != 0)) && (( !(_x_p11_l2 != 0)) && ((_x_p11_l0 != 0) && (_x_p11_l1 != 0)))) || ((( !(_x_p11_l3 != 0)) && (( !(_x_p11_l2 != 0)) && ((_x_p11_l1 != 0) && ( !(_x_p11_l0 != 0))))) || ((( !(_x_p11_l3 != 0)) && (( !(_x_p11_l2 != 0)) && (( !(_x_p11_l0 != 0)) && ( !(_x_p11_l1 != 0))))) || (( !(_x_p11_l3 != 0)) && (( !(_x_p11_l2 != 0)) && ((_x_p11_l0 != 0) && ( !(_x_p11_l1 != 0))))))))))))) && ((_x_p11_c <= 16.0) || ( !(((( !(_x_p11_l3 != 0)) && (( !(_x_p11_l2 != 0)) && ((_x_p11_l0 != 0) && ( !(_x_p11_l1 != 0))))) || (( !(_x_p11_l3 != 0)) && ((_x_p11_l2 != 0) && (( !(_x_p11_l0 != 0)) && ( !(_x_p11_l1 != 0)))))) || ((( !(_x_p11_l3 != 0)) && ((_x_p11_l2 != 0) && ((_x_p11_l0 != 0) && (_x_p11_l1 != 0)))) || ((_x_p11_l3 != 0) && (( !(_x_p11_l2 != 0)) && (( !(_x_p11_l0 != 0)) && ( !(_x_p11_l1 != 0)))))))))) && ((delta <= 0.0) || ((((((p11_l0 != 0) == (_x_p11_l0 != 0)) && ((p11_l1 != 0) == (_x_p11_l1 != 0))) && ((p11_l2 != 0) == (_x_p11_l2 != 0))) && ((p11_l3 != 0) == (_x_p11_l3 != 0))) && ((delta + (p11_c + (-1.0 * _x_p11_c))) == 0.0)))) && ((p11_evt != 0) || ((((((p11_l0 != 0) == (_x_p11_l0 != 0)) && ((p11_l1 != 0) == (_x_p11_l1 != 0))) && ((p11_l2 != 0) == (_x_p11_l2 != 0))) && ((p11_l3 != 0) == (_x_p11_l3 != 0))) && ((delta + (p11_c + (-1.0 * _x_p11_c))) == 0.0)))) && (((v1 == _x_v1) && (((v1 == 0) && (( !(_x_p11_l3 != 0)) && (( !(_x_p11_l2 != 0)) && ((_x_p11_l0 != 0) && ( !(_x_p11_l1 != 0)))))) && (((v2 != 0) == (_x_v2 != 0)) && (_x_p11_c == 0.0)))) || ( !((( !(p11_l3 != 0)) && (( !(p11_l2 != 0)) && (( !(p11_l0 != 0)) && ( !(p11_l1 != 0))))) && ((delta == 0.0) && (p11_evt != 0)))))) && (((((v2 != 0) == (_x_v2 != 0)) && (_x_p11_c == 0.0)) && ((( !(_x_p11_l3 != 0)) && (( !(_x_p11_l2 != 0)) && ((_x_p11_l1 != 0) && ( !(_x_p11_l0 != 0))))) && (_x_v1 == 12))) || ( !((( !(p11_l3 != 0)) && (( !(p11_l2 != 0)) && ((p11_l0 != 0) && ( !(p11_l1 != 0))))) && ((delta == 0.0) && (p11_evt != 0)))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && (((( !(_x_p11_l3 != 0)) && (( !(_x_p11_l2 != 0)) && (( !(_x_p11_l0 != 0)) && ( !(_x_p11_l1 != 0))))) || (( !(_x_p11_l3 != 0)) && (( !(_x_p11_l2 != 0)) && ((_x_p11_l0 != 0) && (_x_p11_l1 != 0))))) && (p11_c == _x_p11_c))) || ( !((( !(p11_l3 != 0)) && (( !(p11_l2 != 0)) && ((p11_l1 != 0) && ( !(p11_l0 != 0))))) && ((delta == 0.0) && (p11_evt != 0)))))) && (( !(v1 == 12)) || ( !((( !(_x_p11_l3 != 0)) && (( !(_x_p11_l2 != 0)) && (( !(_x_p11_l0 != 0)) && ( !(_x_p11_l1 != 0))))) && ((( !(p11_l3 != 0)) && (( !(p11_l2 != 0)) && ((p11_l1 != 0) && ( !(p11_l0 != 0))))) && ((delta == 0.0) && (p11_evt != 0))))))) && (((v1 == 12) && ( !(p11_c <= 16.0))) || ( !((( !(_x_p11_l3 != 0)) && (( !(_x_p11_l2 != 0)) && ((_x_p11_l0 != 0) && (_x_p11_l1 != 0)))) && ((( !(p11_l3 != 0)) && (( !(p11_l2 != 0)) && ((p11_l1 != 0) && ( !(p11_l0 != 0))))) && ((delta == 0.0) && (p11_evt != 0))))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && ((( !(_x_p11_l3 != 0)) && (( !(_x_p11_l2 != 0)) && (( !(_x_p11_l0 != 0)) && ( !(_x_p11_l1 != 0))))) || (( !(_x_p11_l3 != 0)) && ((_x_p11_l2 != 0) && (( !(_x_p11_l0 != 0)) && ( !(_x_p11_l1 != 0))))))) || ( !((( !(p11_l3 != 0)) && (( !(p11_l2 != 0)) && ((p11_l0 != 0) && (p11_l1 != 0)))) && ((delta == 0.0) && (p11_evt != 0)))))) && (((v2 != 0) && (p11_c == _x_p11_c)) || ( !(((delta == 0.0) && (p11_evt != 0)) && ((( !(_x_p11_l3 != 0)) && (( !(_x_p11_l2 != 0)) && (( !(_x_p11_l0 != 0)) && ( !(_x_p11_l1 != 0))))) && (( !(p11_l3 != 0)) && (( !(p11_l2 != 0)) && ((p11_l0 != 0) && (p11_l1 != 0))))))))) && ((( !(v2 != 0)) && (_x_p11_c == 0.0)) || ( !(((delta == 0.0) && (p11_evt != 0)) && ((( !(p11_l3 != 0)) && (( !(p11_l2 != 0)) && ((p11_l0 != 0) && (p11_l1 != 0)))) && (( !(_x_p11_l3 != 0)) && ((_x_p11_l2 != 0) && (( !(_x_p11_l0 != 0)) && ( !(_x_p11_l1 != 0)))))))))) && ((((_x_v2 != 0) && (( !(_x_p11_l3 != 0)) && ((_x_p11_l2 != 0) && ((_x_p11_l0 != 0) && ( !(_x_p11_l1 != 0)))))) && ((v1 == _x_v1) && (_x_p11_c == 0.0))) || ( !((( !(p11_l3 != 0)) && ((p11_l2 != 0) && (( !(p11_l0 != 0)) && ( !(p11_l1 != 0))))) && ((delta == 0.0) && (p11_evt != 0)))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && ((p11_c == _x_p11_c) && ((( !(_x_p11_l3 != 0)) && (( !(_x_p11_l2 != 0)) && (( !(_x_p11_l0 != 0)) && ( !(_x_p11_l1 != 0))))) || (( !(_x_p11_l3 != 0)) && ((_x_p11_l2 != 0) && ((_x_p11_l1 != 0) && ( !(_x_p11_l0 != 0)))))))) || ( !((( !(p11_l3 != 0)) && ((p11_l2 != 0) && ((p11_l0 != 0) && ( !(p11_l1 != 0))))) && ((delta == 0.0) && (p11_evt != 0)))))) && (( !(v1 == 12)) || ( !(((delta == 0.0) && (p11_evt != 0)) && ((( !(_x_p11_l3 != 0)) && (( !(_x_p11_l2 != 0)) && (( !(_x_p11_l0 != 0)) && ( !(_x_p11_l1 != 0))))) && (( !(p11_l3 != 0)) && ((p11_l2 != 0) && ((p11_l0 != 0) && ( !(p11_l1 != 0)))))))))) && ((v1 == 12) || ( !(((delta == 0.0) && (p11_evt != 0)) && ((( !(p11_l3 != 0)) && ((p11_l2 != 0) && ((p11_l0 != 0) && ( !(p11_l1 != 0))))) && (( !(_x_p11_l3 != 0)) && ((_x_p11_l2 != 0) && ((_x_p11_l1 != 0) && ( !(_x_p11_l0 != 0)))))))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && ((( !(_x_p11_l3 != 0)) && ((_x_p11_l2 != 0) && ((_x_p11_l0 != 0) && (_x_p11_l1 != 0)))) && (_x_p11_c == 0.0))) || ( !((( !(p11_l3 != 0)) && ((p11_l2 != 0) && ((p11_l1 != 0) && ( !(p11_l0 != 0))))) && ((delta == 0.0) && (p11_evt != 0)))))) && ((((v1 == _x_v1) && (_x_p11_c == 0.0)) && (( !(_x_v2 != 0)) && ((_x_p11_l3 != 0) && (( !(_x_p11_l2 != 0)) && (( !(_x_p11_l0 != 0)) && ( !(_x_p11_l1 != 0))))))) || ( !((( !(p11_l3 != 0)) && ((p11_l2 != 0) && ((p11_l0 != 0) && (p11_l1 != 0)))) && ((delta == 0.0) && (p11_evt != 0)))))) && ((((_x_v1 == 0) && (( !(_x_p11_l3 != 0)) && (( !(_x_p11_l2 != 0)) && (( !(_x_p11_l0 != 0)) && ( !(_x_p11_l1 != 0)))))) && (((v2 != 0) == (_x_v2 != 0)) && (p11_c == _x_p11_c))) || ( !(((p11_l3 != 0) && (( !(p11_l2 != 0)) && (( !(p11_l0 != 0)) && ( !(p11_l1 != 0))))) && ((delta == 0.0) && (p11_evt != 0)))))) && ((((((((((((((((((((((_x_p10_l3 != 0) && (( !(_x_p10_l2 != 0)) && (( !(_x_p10_l0 != 0)) && ( !(_x_p10_l1 != 0))))) || ((( !(_x_p10_l3 != 0)) && ((_x_p10_l2 != 0) && ((_x_p10_l0 != 0) && (_x_p10_l1 != 0)))) || ((( !(_x_p10_l3 != 0)) && ((_x_p10_l2 != 0) && ((_x_p10_l1 != 0) && ( !(_x_p10_l0 != 0))))) || ((( !(_x_p10_l3 != 0)) && ((_x_p10_l2 != 0) && ((_x_p10_l0 != 0) && ( !(_x_p10_l1 != 0))))) || ((( !(_x_p10_l3 != 0)) && ((_x_p10_l2 != 0) && (( !(_x_p10_l0 != 0)) && ( !(_x_p10_l1 != 0))))) || ((( !(_x_p10_l3 != 0)) && (( !(_x_p10_l2 != 0)) && ((_x_p10_l0 != 0) && (_x_p10_l1 != 0)))) || ((( !(_x_p10_l3 != 0)) && (( !(_x_p10_l2 != 0)) && ((_x_p10_l1 != 0) && ( !(_x_p10_l0 != 0))))) || ((( !(_x_p10_l3 != 0)) && (( !(_x_p10_l2 != 0)) && (( !(_x_p10_l0 != 0)) && ( !(_x_p10_l1 != 0))))) || (( !(_x_p10_l3 != 0)) && (( !(_x_p10_l2 != 0)) && ((_x_p10_l0 != 0) && ( !(_x_p10_l1 != 0))))))))))))) && ((_x_p10_c <= 16.0) || ( !(((( !(_x_p10_l3 != 0)) && (( !(_x_p10_l2 != 0)) && ((_x_p10_l0 != 0) && ( !(_x_p10_l1 != 0))))) || (( !(_x_p10_l3 != 0)) && ((_x_p10_l2 != 0) && (( !(_x_p10_l0 != 0)) && ( !(_x_p10_l1 != 0)))))) || ((( !(_x_p10_l3 != 0)) && ((_x_p10_l2 != 0) && ((_x_p10_l0 != 0) && (_x_p10_l1 != 0)))) || ((_x_p10_l3 != 0) && (( !(_x_p10_l2 != 0)) && (( !(_x_p10_l0 != 0)) && ( !(_x_p10_l1 != 0)))))))))) && ((delta <= 0.0) || ((((((p10_l0 != 0) == (_x_p10_l0 != 0)) && ((p10_l1 != 0) == (_x_p10_l1 != 0))) && ((p10_l2 != 0) == (_x_p10_l2 != 0))) && ((p10_l3 != 0) == (_x_p10_l3 != 0))) && ((delta + (p10_c + (-1.0 * _x_p10_c))) == 0.0)))) && ((p10_evt != 0) || ((((((p10_l0 != 0) == (_x_p10_l0 != 0)) && ((p10_l1 != 0) == (_x_p10_l1 != 0))) && ((p10_l2 != 0) == (_x_p10_l2 != 0))) && ((p10_l3 != 0) == (_x_p10_l3 != 0))) && ((delta + (p10_c + (-1.0 * _x_p10_c))) == 0.0)))) && (((v1 == _x_v1) && (((v1 == 0) && (( !(_x_p10_l3 != 0)) && (( !(_x_p10_l2 != 0)) && ((_x_p10_l0 != 0) && ( !(_x_p10_l1 != 0)))))) && (((v2 != 0) == (_x_v2 != 0)) && (_x_p10_c == 0.0)))) || ( !((( !(p10_l3 != 0)) && (( !(p10_l2 != 0)) && (( !(p10_l0 != 0)) && ( !(p10_l1 != 0))))) && ((delta == 0.0) && (p10_evt != 0)))))) && (((((v2 != 0) == (_x_v2 != 0)) && (_x_p10_c == 0.0)) && ((( !(_x_p10_l3 != 0)) && (( !(_x_p10_l2 != 0)) && ((_x_p10_l1 != 0) && ( !(_x_p10_l0 != 0))))) && (_x_v1 == 11))) || ( !((( !(p10_l3 != 0)) && (( !(p10_l2 != 0)) && ((p10_l0 != 0) && ( !(p10_l1 != 0))))) && ((delta == 0.0) && (p10_evt != 0)))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && (((( !(_x_p10_l3 != 0)) && (( !(_x_p10_l2 != 0)) && (( !(_x_p10_l0 != 0)) && ( !(_x_p10_l1 != 0))))) || (( !(_x_p10_l3 != 0)) && (( !(_x_p10_l2 != 0)) && ((_x_p10_l0 != 0) && (_x_p10_l1 != 0))))) && (p10_c == _x_p10_c))) || ( !((( !(p10_l3 != 0)) && (( !(p10_l2 != 0)) && ((p10_l1 != 0) && ( !(p10_l0 != 0))))) && ((delta == 0.0) && (p10_evt != 0)))))) && (( !(v1 == 11)) || ( !((( !(_x_p10_l3 != 0)) && (( !(_x_p10_l2 != 0)) && (( !(_x_p10_l0 != 0)) && ( !(_x_p10_l1 != 0))))) && ((( !(p10_l3 != 0)) && (( !(p10_l2 != 0)) && ((p10_l1 != 0) && ( !(p10_l0 != 0))))) && ((delta == 0.0) && (p10_evt != 0))))))) && (((v1 == 11) && ( !(p10_c <= 16.0))) || ( !((( !(_x_p10_l3 != 0)) && (( !(_x_p10_l2 != 0)) && ((_x_p10_l0 != 0) && (_x_p10_l1 != 0)))) && ((( !(p10_l3 != 0)) && (( !(p10_l2 != 0)) && ((p10_l1 != 0) && ( !(p10_l0 != 0))))) && ((delta == 0.0) && (p10_evt != 0))))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && ((( !(_x_p10_l3 != 0)) && (( !(_x_p10_l2 != 0)) && (( !(_x_p10_l0 != 0)) && ( !(_x_p10_l1 != 0))))) || (( !(_x_p10_l3 != 0)) && ((_x_p10_l2 != 0) && (( !(_x_p10_l0 != 0)) && ( !(_x_p10_l1 != 0))))))) || ( !((( !(p10_l3 != 0)) && (( !(p10_l2 != 0)) && ((p10_l0 != 0) && (p10_l1 != 0)))) && ((delta == 0.0) && (p10_evt != 0)))))) && (((v2 != 0) && (p10_c == _x_p10_c)) || ( !(((delta == 0.0) && (p10_evt != 0)) && ((( !(_x_p10_l3 != 0)) && (( !(_x_p10_l2 != 0)) && (( !(_x_p10_l0 != 0)) && ( !(_x_p10_l1 != 0))))) && (( !(p10_l3 != 0)) && (( !(p10_l2 != 0)) && ((p10_l0 != 0) && (p10_l1 != 0))))))))) && ((( !(v2 != 0)) && (_x_p10_c == 0.0)) || ( !(((delta == 0.0) && (p10_evt != 0)) && ((( !(p10_l3 != 0)) && (( !(p10_l2 != 0)) && ((p10_l0 != 0) && (p10_l1 != 0)))) && (( !(_x_p10_l3 != 0)) && ((_x_p10_l2 != 0) && (( !(_x_p10_l0 != 0)) && ( !(_x_p10_l1 != 0)))))))))) && ((((_x_v2 != 0) && (( !(_x_p10_l3 != 0)) && ((_x_p10_l2 != 0) && ((_x_p10_l0 != 0) && ( !(_x_p10_l1 != 0)))))) && ((v1 == _x_v1) && (_x_p10_c == 0.0))) || ( !((( !(p10_l3 != 0)) && ((p10_l2 != 0) && (( !(p10_l0 != 0)) && ( !(p10_l1 != 0))))) && ((delta == 0.0) && (p10_evt != 0)))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && ((p10_c == _x_p10_c) && ((( !(_x_p10_l3 != 0)) && (( !(_x_p10_l2 != 0)) && (( !(_x_p10_l0 != 0)) && ( !(_x_p10_l1 != 0))))) || (( !(_x_p10_l3 != 0)) && ((_x_p10_l2 != 0) && ((_x_p10_l1 != 0) && ( !(_x_p10_l0 != 0)))))))) || ( !((( !(p10_l3 != 0)) && ((p10_l2 != 0) && ((p10_l0 != 0) && ( !(p10_l1 != 0))))) && ((delta == 0.0) && (p10_evt != 0)))))) && (( !(v1 == 11)) || ( !(((delta == 0.0) && (p10_evt != 0)) && ((( !(_x_p10_l3 != 0)) && (( !(_x_p10_l2 != 0)) && (( !(_x_p10_l0 != 0)) && ( !(_x_p10_l1 != 0))))) && (( !(p10_l3 != 0)) && ((p10_l2 != 0) && ((p10_l0 != 0) && ( !(p10_l1 != 0)))))))))) && ((v1 == 11) || ( !(((delta == 0.0) && (p10_evt != 0)) && ((( !(p10_l3 != 0)) && ((p10_l2 != 0) && ((p10_l0 != 0) && ( !(p10_l1 != 0))))) && (( !(_x_p10_l3 != 0)) && ((_x_p10_l2 != 0) && ((_x_p10_l1 != 0) && ( !(_x_p10_l0 != 0)))))))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && ((( !(_x_p10_l3 != 0)) && ((_x_p10_l2 != 0) && ((_x_p10_l0 != 0) && (_x_p10_l1 != 0)))) && (_x_p10_c == 0.0))) || ( !((( !(p10_l3 != 0)) && ((p10_l2 != 0) && ((p10_l1 != 0) && ( !(p10_l0 != 0))))) && ((delta == 0.0) && (p10_evt != 0)))))) && ((((v1 == _x_v1) && (_x_p10_c == 0.0)) && (( !(_x_v2 != 0)) && ((_x_p10_l3 != 0) && (( !(_x_p10_l2 != 0)) && (( !(_x_p10_l0 != 0)) && ( !(_x_p10_l1 != 0))))))) || ( !((( !(p10_l3 != 0)) && ((p10_l2 != 0) && ((p10_l0 != 0) && (p10_l1 != 0)))) && ((delta == 0.0) && (p10_evt != 0)))))) && ((((_x_v1 == 0) && (( !(_x_p10_l3 != 0)) && (( !(_x_p10_l2 != 0)) && (( !(_x_p10_l0 != 0)) && ( !(_x_p10_l1 != 0)))))) && (((v2 != 0) == (_x_v2 != 0)) && (p10_c == _x_p10_c))) || ( !(((p10_l3 != 0) && (( !(p10_l2 != 0)) && (( !(p10_l0 != 0)) && ( !(p10_l1 != 0))))) && ((delta == 0.0) && (p10_evt != 0)))))) && ((((((((((((((((((((((_x_p9_l3 != 0) && (( !(_x_p9_l2 != 0)) && (( !(_x_p9_l0 != 0)) && ( !(_x_p9_l1 != 0))))) || ((( !(_x_p9_l3 != 0)) && ((_x_p9_l2 != 0) && ((_x_p9_l0 != 0) && (_x_p9_l1 != 0)))) || ((( !(_x_p9_l3 != 0)) && ((_x_p9_l2 != 0) && ((_x_p9_l1 != 0) && ( !(_x_p9_l0 != 0))))) || ((( !(_x_p9_l3 != 0)) && ((_x_p9_l2 != 0) && ((_x_p9_l0 != 0) && ( !(_x_p9_l1 != 0))))) || ((( !(_x_p9_l3 != 0)) && ((_x_p9_l2 != 0) && (( !(_x_p9_l0 != 0)) && ( !(_x_p9_l1 != 0))))) || ((( !(_x_p9_l3 != 0)) && (( !(_x_p9_l2 != 0)) && ((_x_p9_l0 != 0) && (_x_p9_l1 != 0)))) || ((( !(_x_p9_l3 != 0)) && (( !(_x_p9_l2 != 0)) && ((_x_p9_l1 != 0) && ( !(_x_p9_l0 != 0))))) || ((( !(_x_p9_l3 != 0)) && (( !(_x_p9_l2 != 0)) && (( !(_x_p9_l0 != 0)) && ( !(_x_p9_l1 != 0))))) || (( !(_x_p9_l3 != 0)) && (( !(_x_p9_l2 != 0)) && ((_x_p9_l0 != 0) && ( !(_x_p9_l1 != 0))))))))))))) && ((_x_p9_c <= 16.0) || ( !(((( !(_x_p9_l3 != 0)) && (( !(_x_p9_l2 != 0)) && ((_x_p9_l0 != 0) && ( !(_x_p9_l1 != 0))))) || (( !(_x_p9_l3 != 0)) && ((_x_p9_l2 != 0) && (( !(_x_p9_l0 != 0)) && ( !(_x_p9_l1 != 0)))))) || ((( !(_x_p9_l3 != 0)) && ((_x_p9_l2 != 0) && ((_x_p9_l0 != 0) && (_x_p9_l1 != 0)))) || ((_x_p9_l3 != 0) && (( !(_x_p9_l2 != 0)) && (( !(_x_p9_l0 != 0)) && ( !(_x_p9_l1 != 0)))))))))) && ((delta <= 0.0) || ((((((p9_l0 != 0) == (_x_p9_l0 != 0)) && ((p9_l1 != 0) == (_x_p9_l1 != 0))) && ((p9_l2 != 0) == (_x_p9_l2 != 0))) && ((p9_l3 != 0) == (_x_p9_l3 != 0))) && ((delta + (p9_c + (-1.0 * _x_p9_c))) == 0.0)))) && ((p9_evt != 0) || ((((((p9_l0 != 0) == (_x_p9_l0 != 0)) && ((p9_l1 != 0) == (_x_p9_l1 != 0))) && ((p9_l2 != 0) == (_x_p9_l2 != 0))) && ((p9_l3 != 0) == (_x_p9_l3 != 0))) && ((delta + (p9_c + (-1.0 * _x_p9_c))) == 0.0)))) && (((v1 == _x_v1) && (((v1 == 0) && (( !(_x_p9_l3 != 0)) && (( !(_x_p9_l2 != 0)) && ((_x_p9_l0 != 0) && ( !(_x_p9_l1 != 0)))))) && (((v2 != 0) == (_x_v2 != 0)) && (_x_p9_c == 0.0)))) || ( !((( !(p9_l3 != 0)) && (( !(p9_l2 != 0)) && (( !(p9_l0 != 0)) && ( !(p9_l1 != 0))))) && ((delta == 0.0) && (p9_evt != 0)))))) && (((((v2 != 0) == (_x_v2 != 0)) && (_x_p9_c == 0.0)) && ((( !(_x_p9_l3 != 0)) && (( !(_x_p9_l2 != 0)) && ((_x_p9_l1 != 0) && ( !(_x_p9_l0 != 0))))) && (_x_v1 == 10))) || ( !((( !(p9_l3 != 0)) && (( !(p9_l2 != 0)) && ((p9_l0 != 0) && ( !(p9_l1 != 0))))) && ((delta == 0.0) && (p9_evt != 0)))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && (((( !(_x_p9_l3 != 0)) && (( !(_x_p9_l2 != 0)) && (( !(_x_p9_l0 != 0)) && ( !(_x_p9_l1 != 0))))) || (( !(_x_p9_l3 != 0)) && (( !(_x_p9_l2 != 0)) && ((_x_p9_l0 != 0) && (_x_p9_l1 != 0))))) && (p9_c == _x_p9_c))) || ( !((( !(p9_l3 != 0)) && (( !(p9_l2 != 0)) && ((p9_l1 != 0) && ( !(p9_l0 != 0))))) && ((delta == 0.0) && (p9_evt != 0)))))) && (( !(v1 == 10)) || ( !((( !(_x_p9_l3 != 0)) && (( !(_x_p9_l2 != 0)) && (( !(_x_p9_l0 != 0)) && ( !(_x_p9_l1 != 0))))) && ((( !(p9_l3 != 0)) && (( !(p9_l2 != 0)) && ((p9_l1 != 0) && ( !(p9_l0 != 0))))) && ((delta == 0.0) && (p9_evt != 0))))))) && (((v1 == 10) && ( !(p9_c <= 16.0))) || ( !((( !(_x_p9_l3 != 0)) && (( !(_x_p9_l2 != 0)) && ((_x_p9_l0 != 0) && (_x_p9_l1 != 0)))) && ((( !(p9_l3 != 0)) && (( !(p9_l2 != 0)) && ((p9_l1 != 0) && ( !(p9_l0 != 0))))) && ((delta == 0.0) && (p9_evt != 0))))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && ((( !(_x_p9_l3 != 0)) && (( !(_x_p9_l2 != 0)) && (( !(_x_p9_l0 != 0)) && ( !(_x_p9_l1 != 0))))) || (( !(_x_p9_l3 != 0)) && ((_x_p9_l2 != 0) && (( !(_x_p9_l0 != 0)) && ( !(_x_p9_l1 != 0))))))) || ( !((( !(p9_l3 != 0)) && (( !(p9_l2 != 0)) && ((p9_l0 != 0) && (p9_l1 != 0)))) && ((delta == 0.0) && (p9_evt != 0)))))) && (((v2 != 0) && (p9_c == _x_p9_c)) || ( !(((delta == 0.0) && (p9_evt != 0)) && ((( !(_x_p9_l3 != 0)) && (( !(_x_p9_l2 != 0)) && (( !(_x_p9_l0 != 0)) && ( !(_x_p9_l1 != 0))))) && (( !(p9_l3 != 0)) && (( !(p9_l2 != 0)) && ((p9_l0 != 0) && (p9_l1 != 0))))))))) && ((( !(v2 != 0)) && (_x_p9_c == 0.0)) || ( !(((delta == 0.0) && (p9_evt != 0)) && ((( !(p9_l3 != 0)) && (( !(p9_l2 != 0)) && ((p9_l0 != 0) && (p9_l1 != 0)))) && (( !(_x_p9_l3 != 0)) && ((_x_p9_l2 != 0) && (( !(_x_p9_l0 != 0)) && ( !(_x_p9_l1 != 0)))))))))) && ((((_x_v2 != 0) && (( !(_x_p9_l3 != 0)) && ((_x_p9_l2 != 0) && ((_x_p9_l0 != 0) && ( !(_x_p9_l1 != 0)))))) && ((v1 == _x_v1) && (_x_p9_c == 0.0))) || ( !((( !(p9_l3 != 0)) && ((p9_l2 != 0) && (( !(p9_l0 != 0)) && ( !(p9_l1 != 0))))) && ((delta == 0.0) && (p9_evt != 0)))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && ((p9_c == _x_p9_c) && ((( !(_x_p9_l3 != 0)) && (( !(_x_p9_l2 != 0)) && (( !(_x_p9_l0 != 0)) && ( !(_x_p9_l1 != 0))))) || (( !(_x_p9_l3 != 0)) && ((_x_p9_l2 != 0) && ((_x_p9_l1 != 0) && ( !(_x_p9_l0 != 0)))))))) || ( !((( !(p9_l3 != 0)) && ((p9_l2 != 0) && ((p9_l0 != 0) && ( !(p9_l1 != 0))))) && ((delta == 0.0) && (p9_evt != 0)))))) && (( !(v1 == 10)) || ( !(((delta == 0.0) && (p9_evt != 0)) && ((( !(_x_p9_l3 != 0)) && (( !(_x_p9_l2 != 0)) && (( !(_x_p9_l0 != 0)) && ( !(_x_p9_l1 != 0))))) && (( !(p9_l3 != 0)) && ((p9_l2 != 0) && ((p9_l0 != 0) && ( !(p9_l1 != 0)))))))))) && ((v1 == 10) || ( !(((delta == 0.0) && (p9_evt != 0)) && ((( !(p9_l3 != 0)) && ((p9_l2 != 0) && ((p9_l0 != 0) && ( !(p9_l1 != 0))))) && (( !(_x_p9_l3 != 0)) && ((_x_p9_l2 != 0) && ((_x_p9_l1 != 0) && ( !(_x_p9_l0 != 0)))))))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && ((( !(_x_p9_l3 != 0)) && ((_x_p9_l2 != 0) && ((_x_p9_l0 != 0) && (_x_p9_l1 != 0)))) && (_x_p9_c == 0.0))) || ( !((( !(p9_l3 != 0)) && ((p9_l2 != 0) && ((p9_l1 != 0) && ( !(p9_l0 != 0))))) && ((delta == 0.0) && (p9_evt != 0)))))) && ((((v1 == _x_v1) && (_x_p9_c == 0.0)) && (( !(_x_v2 != 0)) && ((_x_p9_l3 != 0) && (( !(_x_p9_l2 != 0)) && (( !(_x_p9_l0 != 0)) && ( !(_x_p9_l1 != 0))))))) || ( !((( !(p9_l3 != 0)) && ((p9_l2 != 0) && ((p9_l0 != 0) && (p9_l1 != 0)))) && ((delta == 0.0) && (p9_evt != 0)))))) && ((((_x_v1 == 0) && (( !(_x_p9_l3 != 0)) && (( !(_x_p9_l2 != 0)) && (( !(_x_p9_l0 != 0)) && ( !(_x_p9_l1 != 0)))))) && (((v2 != 0) == (_x_v2 != 0)) && (p9_c == _x_p9_c))) || ( !(((p9_l3 != 0) && (( !(p9_l2 != 0)) && (( !(p9_l0 != 0)) && ( !(p9_l1 != 0))))) && ((delta == 0.0) && (p9_evt != 0)))))) && ((((((((((((((((((((((_x_p8_l3 != 0) && (( !(_x_p8_l2 != 0)) && (( !(_x_p8_l0 != 0)) && ( !(_x_p8_l1 != 0))))) || ((( !(_x_p8_l3 != 0)) && ((_x_p8_l2 != 0) && ((_x_p8_l0 != 0) && (_x_p8_l1 != 0)))) || ((( !(_x_p8_l3 != 0)) && ((_x_p8_l2 != 0) && ((_x_p8_l1 != 0) && ( !(_x_p8_l0 != 0))))) || ((( !(_x_p8_l3 != 0)) && ((_x_p8_l2 != 0) && ((_x_p8_l0 != 0) && ( !(_x_p8_l1 != 0))))) || ((( !(_x_p8_l3 != 0)) && ((_x_p8_l2 != 0) && (( !(_x_p8_l0 != 0)) && ( !(_x_p8_l1 != 0))))) || ((( !(_x_p8_l3 != 0)) && (( !(_x_p8_l2 != 0)) && ((_x_p8_l0 != 0) && (_x_p8_l1 != 0)))) || ((( !(_x_p8_l3 != 0)) && (( !(_x_p8_l2 != 0)) && ((_x_p8_l1 != 0) && ( !(_x_p8_l0 != 0))))) || ((( !(_x_p8_l3 != 0)) && (( !(_x_p8_l2 != 0)) && (( !(_x_p8_l0 != 0)) && ( !(_x_p8_l1 != 0))))) || (( !(_x_p8_l3 != 0)) && (( !(_x_p8_l2 != 0)) && ((_x_p8_l0 != 0) && ( !(_x_p8_l1 != 0))))))))))))) && ((_x_p8_c <= 16.0) || ( !(((( !(_x_p8_l3 != 0)) && (( !(_x_p8_l2 != 0)) && ((_x_p8_l0 != 0) && ( !(_x_p8_l1 != 0))))) || (( !(_x_p8_l3 != 0)) && ((_x_p8_l2 != 0) && (( !(_x_p8_l0 != 0)) && ( !(_x_p8_l1 != 0)))))) || ((( !(_x_p8_l3 != 0)) && ((_x_p8_l2 != 0) && ((_x_p8_l0 != 0) && (_x_p8_l1 != 0)))) || ((_x_p8_l3 != 0) && (( !(_x_p8_l2 != 0)) && (( !(_x_p8_l0 != 0)) && ( !(_x_p8_l1 != 0)))))))))) && ((delta <= 0.0) || ((((((p8_l0 != 0) == (_x_p8_l0 != 0)) && ((p8_l1 != 0) == (_x_p8_l1 != 0))) && ((p8_l2 != 0) == (_x_p8_l2 != 0))) && ((p8_l3 != 0) == (_x_p8_l3 != 0))) && ((delta + (p8_c + (-1.0 * _x_p8_c))) == 0.0)))) && ((p8_evt != 0) || ((((((p8_l0 != 0) == (_x_p8_l0 != 0)) && ((p8_l1 != 0) == (_x_p8_l1 != 0))) && ((p8_l2 != 0) == (_x_p8_l2 != 0))) && ((p8_l3 != 0) == (_x_p8_l3 != 0))) && ((delta + (p8_c + (-1.0 * _x_p8_c))) == 0.0)))) && (((v1 == _x_v1) && (((v1 == 0) && (( !(_x_p8_l3 != 0)) && (( !(_x_p8_l2 != 0)) && ((_x_p8_l0 != 0) && ( !(_x_p8_l1 != 0)))))) && (((v2 != 0) == (_x_v2 != 0)) && (_x_p8_c == 0.0)))) || ( !((( !(p8_l3 != 0)) && (( !(p8_l2 != 0)) && (( !(p8_l0 != 0)) && ( !(p8_l1 != 0))))) && ((delta == 0.0) && (p8_evt != 0)))))) && (((((v2 != 0) == (_x_v2 != 0)) && (_x_p8_c == 0.0)) && ((( !(_x_p8_l3 != 0)) && (( !(_x_p8_l2 != 0)) && ((_x_p8_l1 != 0) && ( !(_x_p8_l0 != 0))))) && (_x_v1 == 9))) || ( !((( !(p8_l3 != 0)) && (( !(p8_l2 != 0)) && ((p8_l0 != 0) && ( !(p8_l1 != 0))))) && ((delta == 0.0) && (p8_evt != 0)))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && (((( !(_x_p8_l3 != 0)) && (( !(_x_p8_l2 != 0)) && (( !(_x_p8_l0 != 0)) && ( !(_x_p8_l1 != 0))))) || (( !(_x_p8_l3 != 0)) && (( !(_x_p8_l2 != 0)) && ((_x_p8_l0 != 0) && (_x_p8_l1 != 0))))) && (p8_c == _x_p8_c))) || ( !((( !(p8_l3 != 0)) && (( !(p8_l2 != 0)) && ((p8_l1 != 0) && ( !(p8_l0 != 0))))) && ((delta == 0.0) && (p8_evt != 0)))))) && (( !(v1 == 9)) || ( !((( !(_x_p8_l3 != 0)) && (( !(_x_p8_l2 != 0)) && (( !(_x_p8_l0 != 0)) && ( !(_x_p8_l1 != 0))))) && ((( !(p8_l3 != 0)) && (( !(p8_l2 != 0)) && ((p8_l1 != 0) && ( !(p8_l0 != 0))))) && ((delta == 0.0) && (p8_evt != 0))))))) && (((v1 == 9) && ( !(p8_c <= 16.0))) || ( !((( !(_x_p8_l3 != 0)) && (( !(_x_p8_l2 != 0)) && ((_x_p8_l0 != 0) && (_x_p8_l1 != 0)))) && ((( !(p8_l3 != 0)) && (( !(p8_l2 != 0)) && ((p8_l1 != 0) && ( !(p8_l0 != 0))))) && ((delta == 0.0) && (p8_evt != 0))))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && ((( !(_x_p8_l3 != 0)) && (( !(_x_p8_l2 != 0)) && (( !(_x_p8_l0 != 0)) && ( !(_x_p8_l1 != 0))))) || (( !(_x_p8_l3 != 0)) && ((_x_p8_l2 != 0) && (( !(_x_p8_l0 != 0)) && ( !(_x_p8_l1 != 0))))))) || ( !((( !(p8_l3 != 0)) && (( !(p8_l2 != 0)) && ((p8_l0 != 0) && (p8_l1 != 0)))) && ((delta == 0.0) && (p8_evt != 0)))))) && (((v2 != 0) && (p8_c == _x_p8_c)) || ( !(((delta == 0.0) && (p8_evt != 0)) && ((( !(_x_p8_l3 != 0)) && (( !(_x_p8_l2 != 0)) && (( !(_x_p8_l0 != 0)) && ( !(_x_p8_l1 != 0))))) && (( !(p8_l3 != 0)) && (( !(p8_l2 != 0)) && ((p8_l0 != 0) && (p8_l1 != 0))))))))) && ((( !(v2 != 0)) && (_x_p8_c == 0.0)) || ( !(((delta == 0.0) && (p8_evt != 0)) && ((( !(p8_l3 != 0)) && (( !(p8_l2 != 0)) && ((p8_l0 != 0) && (p8_l1 != 0)))) && (( !(_x_p8_l3 != 0)) && ((_x_p8_l2 != 0) && (( !(_x_p8_l0 != 0)) && ( !(_x_p8_l1 != 0)))))))))) && ((((_x_v2 != 0) && (( !(_x_p8_l3 != 0)) && ((_x_p8_l2 != 0) && ((_x_p8_l0 != 0) && ( !(_x_p8_l1 != 0)))))) && ((v1 == _x_v1) && (_x_p8_c == 0.0))) || ( !((( !(p8_l3 != 0)) && ((p8_l2 != 0) && (( !(p8_l0 != 0)) && ( !(p8_l1 != 0))))) && ((delta == 0.0) && (p8_evt != 0)))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && ((p8_c == _x_p8_c) && ((( !(_x_p8_l3 != 0)) && (( !(_x_p8_l2 != 0)) && (( !(_x_p8_l0 != 0)) && ( !(_x_p8_l1 != 0))))) || (( !(_x_p8_l3 != 0)) && ((_x_p8_l2 != 0) && ((_x_p8_l1 != 0) && ( !(_x_p8_l0 != 0)))))))) || ( !((( !(p8_l3 != 0)) && ((p8_l2 != 0) && ((p8_l0 != 0) && ( !(p8_l1 != 0))))) && ((delta == 0.0) && (p8_evt != 0)))))) && (( !(v1 == 9)) || ( !(((delta == 0.0) && (p8_evt != 0)) && ((( !(_x_p8_l3 != 0)) && (( !(_x_p8_l2 != 0)) && (( !(_x_p8_l0 != 0)) && ( !(_x_p8_l1 != 0))))) && (( !(p8_l3 != 0)) && ((p8_l2 != 0) && ((p8_l0 != 0) && ( !(p8_l1 != 0)))))))))) && ((v1 == 9) || ( !(((delta == 0.0) && (p8_evt != 0)) && ((( !(p8_l3 != 0)) && ((p8_l2 != 0) && ((p8_l0 != 0) && ( !(p8_l1 != 0))))) && (( !(_x_p8_l3 != 0)) && ((_x_p8_l2 != 0) && ((_x_p8_l1 != 0) && ( !(_x_p8_l0 != 0)))))))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && ((( !(_x_p8_l3 != 0)) && ((_x_p8_l2 != 0) && ((_x_p8_l0 != 0) && (_x_p8_l1 != 0)))) && (_x_p8_c == 0.0))) || ( !((( !(p8_l3 != 0)) && ((p8_l2 != 0) && ((p8_l1 != 0) && ( !(p8_l0 != 0))))) && ((delta == 0.0) && (p8_evt != 0)))))) && ((((v1 == _x_v1) && (_x_p8_c == 0.0)) && (( !(_x_v2 != 0)) && ((_x_p8_l3 != 0) && (( !(_x_p8_l2 != 0)) && (( !(_x_p8_l0 != 0)) && ( !(_x_p8_l1 != 0))))))) || ( !((( !(p8_l3 != 0)) && ((p8_l2 != 0) && ((p8_l0 != 0) && (p8_l1 != 0)))) && ((delta == 0.0) && (p8_evt != 0)))))) && ((((_x_v1 == 0) && (( !(_x_p8_l3 != 0)) && (( !(_x_p8_l2 != 0)) && (( !(_x_p8_l0 != 0)) && ( !(_x_p8_l1 != 0)))))) && (((v2 != 0) == (_x_v2 != 0)) && (p8_c == _x_p8_c))) || ( !(((p8_l3 != 0) && (( !(p8_l2 != 0)) && (( !(p8_l0 != 0)) && ( !(p8_l1 != 0))))) && ((delta == 0.0) && (p8_evt != 0)))))) && ((((((((((((((((((((((_x_p7_l3 != 0) && (( !(_x_p7_l2 != 0)) && (( !(_x_p7_l0 != 0)) && ( !(_x_p7_l1 != 0))))) || ((( !(_x_p7_l3 != 0)) && ((_x_p7_l2 != 0) && ((_x_p7_l0 != 0) && (_x_p7_l1 != 0)))) || ((( !(_x_p7_l3 != 0)) && ((_x_p7_l2 != 0) && ((_x_p7_l1 != 0) && ( !(_x_p7_l0 != 0))))) || ((( !(_x_p7_l3 != 0)) && ((_x_p7_l2 != 0) && ((_x_p7_l0 != 0) && ( !(_x_p7_l1 != 0))))) || ((( !(_x_p7_l3 != 0)) && ((_x_p7_l2 != 0) && (( !(_x_p7_l0 != 0)) && ( !(_x_p7_l1 != 0))))) || ((( !(_x_p7_l3 != 0)) && (( !(_x_p7_l2 != 0)) && ((_x_p7_l0 != 0) && (_x_p7_l1 != 0)))) || ((( !(_x_p7_l3 != 0)) && (( !(_x_p7_l2 != 0)) && ((_x_p7_l1 != 0) && ( !(_x_p7_l0 != 0))))) || ((( !(_x_p7_l3 != 0)) && (( !(_x_p7_l2 != 0)) && (( !(_x_p7_l0 != 0)) && ( !(_x_p7_l1 != 0))))) || (( !(_x_p7_l3 != 0)) && (( !(_x_p7_l2 != 0)) && ((_x_p7_l0 != 0) && ( !(_x_p7_l1 != 0))))))))))))) && ((_x_p7_c <= 16.0) || ( !(((( !(_x_p7_l3 != 0)) && (( !(_x_p7_l2 != 0)) && ((_x_p7_l0 != 0) && ( !(_x_p7_l1 != 0))))) || (( !(_x_p7_l3 != 0)) && ((_x_p7_l2 != 0) && (( !(_x_p7_l0 != 0)) && ( !(_x_p7_l1 != 0)))))) || ((( !(_x_p7_l3 != 0)) && ((_x_p7_l2 != 0) && ((_x_p7_l0 != 0) && (_x_p7_l1 != 0)))) || ((_x_p7_l3 != 0) && (( !(_x_p7_l2 != 0)) && (( !(_x_p7_l0 != 0)) && ( !(_x_p7_l1 != 0)))))))))) && ((delta <= 0.0) || ((((((p7_l0 != 0) == (_x_p7_l0 != 0)) && ((p7_l1 != 0) == (_x_p7_l1 != 0))) && ((p7_l2 != 0) == (_x_p7_l2 != 0))) && ((p7_l3 != 0) == (_x_p7_l3 != 0))) && ((delta + (p7_c + (-1.0 * _x_p7_c))) == 0.0)))) && ((p7_evt != 0) || ((((((p7_l0 != 0) == (_x_p7_l0 != 0)) && ((p7_l1 != 0) == (_x_p7_l1 != 0))) && ((p7_l2 != 0) == (_x_p7_l2 != 0))) && ((p7_l3 != 0) == (_x_p7_l3 != 0))) && ((delta + (p7_c + (-1.0 * _x_p7_c))) == 0.0)))) && (((v1 == _x_v1) && (((v1 == 0) && (( !(_x_p7_l3 != 0)) && (( !(_x_p7_l2 != 0)) && ((_x_p7_l0 != 0) && ( !(_x_p7_l1 != 0)))))) && (((v2 != 0) == (_x_v2 != 0)) && (_x_p7_c == 0.0)))) || ( !((( !(p7_l3 != 0)) && (( !(p7_l2 != 0)) && (( !(p7_l0 != 0)) && ( !(p7_l1 != 0))))) && ((delta == 0.0) && (p7_evt != 0)))))) && (((((v2 != 0) == (_x_v2 != 0)) && (_x_p7_c == 0.0)) && ((( !(_x_p7_l3 != 0)) && (( !(_x_p7_l2 != 0)) && ((_x_p7_l1 != 0) && ( !(_x_p7_l0 != 0))))) && (_x_v1 == 8))) || ( !((( !(p7_l3 != 0)) && (( !(p7_l2 != 0)) && ((p7_l0 != 0) && ( !(p7_l1 != 0))))) && ((delta == 0.0) && (p7_evt != 0)))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && (((( !(_x_p7_l3 != 0)) && (( !(_x_p7_l2 != 0)) && (( !(_x_p7_l0 != 0)) && ( !(_x_p7_l1 != 0))))) || (( !(_x_p7_l3 != 0)) && (( !(_x_p7_l2 != 0)) && ((_x_p7_l0 != 0) && (_x_p7_l1 != 0))))) && (p7_c == _x_p7_c))) || ( !((( !(p7_l3 != 0)) && (( !(p7_l2 != 0)) && ((p7_l1 != 0) && ( !(p7_l0 != 0))))) && ((delta == 0.0) && (p7_evt != 0)))))) && (( !(v1 == 8)) || ( !((( !(_x_p7_l3 != 0)) && (( !(_x_p7_l2 != 0)) && (( !(_x_p7_l0 != 0)) && ( !(_x_p7_l1 != 0))))) && ((( !(p7_l3 != 0)) && (( !(p7_l2 != 0)) && ((p7_l1 != 0) && ( !(p7_l0 != 0))))) && ((delta == 0.0) && (p7_evt != 0))))))) && (((v1 == 8) && ( !(p7_c <= 16.0))) || ( !((( !(_x_p7_l3 != 0)) && (( !(_x_p7_l2 != 0)) && ((_x_p7_l0 != 0) && (_x_p7_l1 != 0)))) && ((( !(p7_l3 != 0)) && (( !(p7_l2 != 0)) && ((p7_l1 != 0) && ( !(p7_l0 != 0))))) && ((delta == 0.0) && (p7_evt != 0))))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && ((( !(_x_p7_l3 != 0)) && (( !(_x_p7_l2 != 0)) && (( !(_x_p7_l0 != 0)) && ( !(_x_p7_l1 != 0))))) || (( !(_x_p7_l3 != 0)) && ((_x_p7_l2 != 0) && (( !(_x_p7_l0 != 0)) && ( !(_x_p7_l1 != 0))))))) || ( !((( !(p7_l3 != 0)) && (( !(p7_l2 != 0)) && ((p7_l0 != 0) && (p7_l1 != 0)))) && ((delta == 0.0) && (p7_evt != 0)))))) && (((v2 != 0) && (p7_c == _x_p7_c)) || ( !(((delta == 0.0) && (p7_evt != 0)) && ((( !(_x_p7_l3 != 0)) && (( !(_x_p7_l2 != 0)) && (( !(_x_p7_l0 != 0)) && ( !(_x_p7_l1 != 0))))) && (( !(p7_l3 != 0)) && (( !(p7_l2 != 0)) && ((p7_l0 != 0) && (p7_l1 != 0))))))))) && ((( !(v2 != 0)) && (_x_p7_c == 0.0)) || ( !(((delta == 0.0) && (p7_evt != 0)) && ((( !(p7_l3 != 0)) && (( !(p7_l2 != 0)) && ((p7_l0 != 0) && (p7_l1 != 0)))) && (( !(_x_p7_l3 != 0)) && ((_x_p7_l2 != 0) && (( !(_x_p7_l0 != 0)) && ( !(_x_p7_l1 != 0)))))))))) && ((((_x_v2 != 0) && (( !(_x_p7_l3 != 0)) && ((_x_p7_l2 != 0) && ((_x_p7_l0 != 0) && ( !(_x_p7_l1 != 0)))))) && ((v1 == _x_v1) && (_x_p7_c == 0.0))) || ( !((( !(p7_l3 != 0)) && ((p7_l2 != 0) && (( !(p7_l0 != 0)) && ( !(p7_l1 != 0))))) && ((delta == 0.0) && (p7_evt != 0)))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && ((p7_c == _x_p7_c) && ((( !(_x_p7_l3 != 0)) && (( !(_x_p7_l2 != 0)) && (( !(_x_p7_l0 != 0)) && ( !(_x_p7_l1 != 0))))) || (( !(_x_p7_l3 != 0)) && ((_x_p7_l2 != 0) && ((_x_p7_l1 != 0) && ( !(_x_p7_l0 != 0)))))))) || ( !((( !(p7_l3 != 0)) && ((p7_l2 != 0) && ((p7_l0 != 0) && ( !(p7_l1 != 0))))) && ((delta == 0.0) && (p7_evt != 0)))))) && (( !(v1 == 8)) || ( !(((delta == 0.0) && (p7_evt != 0)) && ((( !(_x_p7_l3 != 0)) && (( !(_x_p7_l2 != 0)) && (( !(_x_p7_l0 != 0)) && ( !(_x_p7_l1 != 0))))) && (( !(p7_l3 != 0)) && ((p7_l2 != 0) && ((p7_l0 != 0) && ( !(p7_l1 != 0)))))))))) && ((v1 == 8) || ( !(((delta == 0.0) && (p7_evt != 0)) && ((( !(p7_l3 != 0)) && ((p7_l2 != 0) && ((p7_l0 != 0) && ( !(p7_l1 != 0))))) && (( !(_x_p7_l3 != 0)) && ((_x_p7_l2 != 0) && ((_x_p7_l1 != 0) && ( !(_x_p7_l0 != 0)))))))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && ((( !(_x_p7_l3 != 0)) && ((_x_p7_l2 != 0) && ((_x_p7_l0 != 0) && (_x_p7_l1 != 0)))) && (_x_p7_c == 0.0))) || ( !((( !(p7_l3 != 0)) && ((p7_l2 != 0) && ((p7_l1 != 0) && ( !(p7_l0 != 0))))) && ((delta == 0.0) && (p7_evt != 0)))))) && ((((v1 == _x_v1) && (_x_p7_c == 0.0)) && (( !(_x_v2 != 0)) && ((_x_p7_l3 != 0) && (( !(_x_p7_l2 != 0)) && (( !(_x_p7_l0 != 0)) && ( !(_x_p7_l1 != 0))))))) || ( !((( !(p7_l3 != 0)) && ((p7_l2 != 0) && ((p7_l0 != 0) && (p7_l1 != 0)))) && ((delta == 0.0) && (p7_evt != 0)))))) && ((((_x_v1 == 0) && (( !(_x_p7_l3 != 0)) && (( !(_x_p7_l2 != 0)) && (( !(_x_p7_l0 != 0)) && ( !(_x_p7_l1 != 0)))))) && (((v2 != 0) == (_x_v2 != 0)) && (p7_c == _x_p7_c))) || ( !(((p7_l3 != 0) && (( !(p7_l2 != 0)) && (( !(p7_l0 != 0)) && ( !(p7_l1 != 0))))) && ((delta == 0.0) && (p7_evt != 0)))))) && ((((((((((((((((((((((_x_p6_l3 != 0) && (( !(_x_p6_l2 != 0)) && (( !(_x_p6_l0 != 0)) && ( !(_x_p6_l1 != 0))))) || ((( !(_x_p6_l3 != 0)) && ((_x_p6_l2 != 0) && ((_x_p6_l0 != 0) && (_x_p6_l1 != 0)))) || ((( !(_x_p6_l3 != 0)) && ((_x_p6_l2 != 0) && ((_x_p6_l1 != 0) && ( !(_x_p6_l0 != 0))))) || ((( !(_x_p6_l3 != 0)) && ((_x_p6_l2 != 0) && ((_x_p6_l0 != 0) && ( !(_x_p6_l1 != 0))))) || ((( !(_x_p6_l3 != 0)) && ((_x_p6_l2 != 0) && (( !(_x_p6_l0 != 0)) && ( !(_x_p6_l1 != 0))))) || ((( !(_x_p6_l3 != 0)) && (( !(_x_p6_l2 != 0)) && ((_x_p6_l0 != 0) && (_x_p6_l1 != 0)))) || ((( !(_x_p6_l3 != 0)) && (( !(_x_p6_l2 != 0)) && ((_x_p6_l1 != 0) && ( !(_x_p6_l0 != 0))))) || ((( !(_x_p6_l3 != 0)) && (( !(_x_p6_l2 != 0)) && (( !(_x_p6_l0 != 0)) && ( !(_x_p6_l1 != 0))))) || (( !(_x_p6_l3 != 0)) && (( !(_x_p6_l2 != 0)) && ((_x_p6_l0 != 0) && ( !(_x_p6_l1 != 0))))))))))))) && ((_x_p6_c <= 16.0) || ( !(((( !(_x_p6_l3 != 0)) && (( !(_x_p6_l2 != 0)) && ((_x_p6_l0 != 0) && ( !(_x_p6_l1 != 0))))) || (( !(_x_p6_l3 != 0)) && ((_x_p6_l2 != 0) && (( !(_x_p6_l0 != 0)) && ( !(_x_p6_l1 != 0)))))) || ((( !(_x_p6_l3 != 0)) && ((_x_p6_l2 != 0) && ((_x_p6_l0 != 0) && (_x_p6_l1 != 0)))) || ((_x_p6_l3 != 0) && (( !(_x_p6_l2 != 0)) && (( !(_x_p6_l0 != 0)) && ( !(_x_p6_l1 != 0)))))))))) && ((delta <= 0.0) || ((((((p6_l0 != 0) == (_x_p6_l0 != 0)) && ((p6_l1 != 0) == (_x_p6_l1 != 0))) && ((p6_l2 != 0) == (_x_p6_l2 != 0))) && ((p6_l3 != 0) == (_x_p6_l3 != 0))) && ((delta + (p6_c + (-1.0 * _x_p6_c))) == 0.0)))) && ((p6_evt != 0) || ((((((p6_l0 != 0) == (_x_p6_l0 != 0)) && ((p6_l1 != 0) == (_x_p6_l1 != 0))) && ((p6_l2 != 0) == (_x_p6_l2 != 0))) && ((p6_l3 != 0) == (_x_p6_l3 != 0))) && ((delta + (p6_c + (-1.0 * _x_p6_c))) == 0.0)))) && (((v1 == _x_v1) && (((v1 == 0) && (( !(_x_p6_l3 != 0)) && (( !(_x_p6_l2 != 0)) && ((_x_p6_l0 != 0) && ( !(_x_p6_l1 != 0)))))) && (((v2 != 0) == (_x_v2 != 0)) && (_x_p6_c == 0.0)))) || ( !((( !(p6_l3 != 0)) && (( !(p6_l2 != 0)) && (( !(p6_l0 != 0)) && ( !(p6_l1 != 0))))) && ((delta == 0.0) && (p6_evt != 0)))))) && (((((v2 != 0) == (_x_v2 != 0)) && (_x_p6_c == 0.0)) && ((( !(_x_p6_l3 != 0)) && (( !(_x_p6_l2 != 0)) && ((_x_p6_l1 != 0) && ( !(_x_p6_l0 != 0))))) && (_x_v1 == 7))) || ( !((( !(p6_l3 != 0)) && (( !(p6_l2 != 0)) && ((p6_l0 != 0) && ( !(p6_l1 != 0))))) && ((delta == 0.0) && (p6_evt != 0)))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && (((( !(_x_p6_l3 != 0)) && (( !(_x_p6_l2 != 0)) && (( !(_x_p6_l0 != 0)) && ( !(_x_p6_l1 != 0))))) || (( !(_x_p6_l3 != 0)) && (( !(_x_p6_l2 != 0)) && ((_x_p6_l0 != 0) && (_x_p6_l1 != 0))))) && (p6_c == _x_p6_c))) || ( !((( !(p6_l3 != 0)) && (( !(p6_l2 != 0)) && ((p6_l1 != 0) && ( !(p6_l0 != 0))))) && ((delta == 0.0) && (p6_evt != 0)))))) && (( !(v1 == 7)) || ( !((( !(_x_p6_l3 != 0)) && (( !(_x_p6_l2 != 0)) && (( !(_x_p6_l0 != 0)) && ( !(_x_p6_l1 != 0))))) && ((( !(p6_l3 != 0)) && (( !(p6_l2 != 0)) && ((p6_l1 != 0) && ( !(p6_l0 != 0))))) && ((delta == 0.0) && (p6_evt != 0))))))) && (((v1 == 7) && ( !(p6_c <= 16.0))) || ( !((( !(_x_p6_l3 != 0)) && (( !(_x_p6_l2 != 0)) && ((_x_p6_l0 != 0) && (_x_p6_l1 != 0)))) && ((( !(p6_l3 != 0)) && (( !(p6_l2 != 0)) && ((p6_l1 != 0) && ( !(p6_l0 != 0))))) && ((delta == 0.0) && (p6_evt != 0))))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && ((( !(_x_p6_l3 != 0)) && (( !(_x_p6_l2 != 0)) && (( !(_x_p6_l0 != 0)) && ( !(_x_p6_l1 != 0))))) || (( !(_x_p6_l3 != 0)) && ((_x_p6_l2 != 0) && (( !(_x_p6_l0 != 0)) && ( !(_x_p6_l1 != 0))))))) || ( !((( !(p6_l3 != 0)) && (( !(p6_l2 != 0)) && ((p6_l0 != 0) && (p6_l1 != 0)))) && ((delta == 0.0) && (p6_evt != 0)))))) && (((v2 != 0) && (p6_c == _x_p6_c)) || ( !(((delta == 0.0) && (p6_evt != 0)) && ((( !(_x_p6_l3 != 0)) && (( !(_x_p6_l2 != 0)) && (( !(_x_p6_l0 != 0)) && ( !(_x_p6_l1 != 0))))) && (( !(p6_l3 != 0)) && (( !(p6_l2 != 0)) && ((p6_l0 != 0) && (p6_l1 != 0))))))))) && ((( !(v2 != 0)) && (_x_p6_c == 0.0)) || ( !(((delta == 0.0) && (p6_evt != 0)) && ((( !(p6_l3 != 0)) && (( !(p6_l2 != 0)) && ((p6_l0 != 0) && (p6_l1 != 0)))) && (( !(_x_p6_l3 != 0)) && ((_x_p6_l2 != 0) && (( !(_x_p6_l0 != 0)) && ( !(_x_p6_l1 != 0)))))))))) && ((((_x_v2 != 0) && (( !(_x_p6_l3 != 0)) && ((_x_p6_l2 != 0) && ((_x_p6_l0 != 0) && ( !(_x_p6_l1 != 0)))))) && ((v1 == _x_v1) && (_x_p6_c == 0.0))) || ( !((( !(p6_l3 != 0)) && ((p6_l2 != 0) && (( !(p6_l0 != 0)) && ( !(p6_l1 != 0))))) && ((delta == 0.0) && (p6_evt != 0)))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && ((p6_c == _x_p6_c) && ((( !(_x_p6_l3 != 0)) && (( !(_x_p6_l2 != 0)) && (( !(_x_p6_l0 != 0)) && ( !(_x_p6_l1 != 0))))) || (( !(_x_p6_l3 != 0)) && ((_x_p6_l2 != 0) && ((_x_p6_l1 != 0) && ( !(_x_p6_l0 != 0)))))))) || ( !((( !(p6_l3 != 0)) && ((p6_l2 != 0) && ((p6_l0 != 0) && ( !(p6_l1 != 0))))) && ((delta == 0.0) && (p6_evt != 0)))))) && (( !(v1 == 7)) || ( !(((delta == 0.0) && (p6_evt != 0)) && ((( !(_x_p6_l3 != 0)) && (( !(_x_p6_l2 != 0)) && (( !(_x_p6_l0 != 0)) && ( !(_x_p6_l1 != 0))))) && (( !(p6_l3 != 0)) && ((p6_l2 != 0) && ((p6_l0 != 0) && ( !(p6_l1 != 0)))))))))) && ((v1 == 7) || ( !(((delta == 0.0) && (p6_evt != 0)) && ((( !(p6_l3 != 0)) && ((p6_l2 != 0) && ((p6_l0 != 0) && ( !(p6_l1 != 0))))) && (( !(_x_p6_l3 != 0)) && ((_x_p6_l2 != 0) && ((_x_p6_l1 != 0) && ( !(_x_p6_l0 != 0)))))))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && ((( !(_x_p6_l3 != 0)) && ((_x_p6_l2 != 0) && ((_x_p6_l0 != 0) && (_x_p6_l1 != 0)))) && (_x_p6_c == 0.0))) || ( !((( !(p6_l3 != 0)) && ((p6_l2 != 0) && ((p6_l1 != 0) && ( !(p6_l0 != 0))))) && ((delta == 0.0) && (p6_evt != 0)))))) && ((((v1 == _x_v1) && (_x_p6_c == 0.0)) && (( !(_x_v2 != 0)) && ((_x_p6_l3 != 0) && (( !(_x_p6_l2 != 0)) && (( !(_x_p6_l0 != 0)) && ( !(_x_p6_l1 != 0))))))) || ( !((( !(p6_l3 != 0)) && ((p6_l2 != 0) && ((p6_l0 != 0) && (p6_l1 != 0)))) && ((delta == 0.0) && (p6_evt != 0)))))) && ((((_x_v1 == 0) && (( !(_x_p6_l3 != 0)) && (( !(_x_p6_l2 != 0)) && (( !(_x_p6_l0 != 0)) && ( !(_x_p6_l1 != 0)))))) && (((v2 != 0) == (_x_v2 != 0)) && (p6_c == _x_p6_c))) || ( !(((p6_l3 != 0) && (( !(p6_l2 != 0)) && (( !(p6_l0 != 0)) && ( !(p6_l1 != 0))))) && ((delta == 0.0) && (p6_evt != 0)))))) && ((((((((((((((((((((((_x_p5_l3 != 0) && (( !(_x_p5_l2 != 0)) && (( !(_x_p5_l0 != 0)) && ( !(_x_p5_l1 != 0))))) || ((( !(_x_p5_l3 != 0)) && ((_x_p5_l2 != 0) && ((_x_p5_l0 != 0) && (_x_p5_l1 != 0)))) || ((( !(_x_p5_l3 != 0)) && ((_x_p5_l2 != 0) && ((_x_p5_l1 != 0) && ( !(_x_p5_l0 != 0))))) || ((( !(_x_p5_l3 != 0)) && ((_x_p5_l2 != 0) && ((_x_p5_l0 != 0) && ( !(_x_p5_l1 != 0))))) || ((( !(_x_p5_l3 != 0)) && ((_x_p5_l2 != 0) && (( !(_x_p5_l0 != 0)) && ( !(_x_p5_l1 != 0))))) || ((( !(_x_p5_l3 != 0)) && (( !(_x_p5_l2 != 0)) && ((_x_p5_l0 != 0) && (_x_p5_l1 != 0)))) || ((( !(_x_p5_l3 != 0)) && (( !(_x_p5_l2 != 0)) && ((_x_p5_l1 != 0) && ( !(_x_p5_l0 != 0))))) || ((( !(_x_p5_l3 != 0)) && (( !(_x_p5_l2 != 0)) && (( !(_x_p5_l0 != 0)) && ( !(_x_p5_l1 != 0))))) || (( !(_x_p5_l3 != 0)) && (( !(_x_p5_l2 != 0)) && ((_x_p5_l0 != 0) && ( !(_x_p5_l1 != 0))))))))))))) && ((_x_p5_c <= 16.0) || ( !(((( !(_x_p5_l3 != 0)) && (( !(_x_p5_l2 != 0)) && ((_x_p5_l0 != 0) && ( !(_x_p5_l1 != 0))))) || (( !(_x_p5_l3 != 0)) && ((_x_p5_l2 != 0) && (( !(_x_p5_l0 != 0)) && ( !(_x_p5_l1 != 0)))))) || ((( !(_x_p5_l3 != 0)) && ((_x_p5_l2 != 0) && ((_x_p5_l0 != 0) && (_x_p5_l1 != 0)))) || ((_x_p5_l3 != 0) && (( !(_x_p5_l2 != 0)) && (( !(_x_p5_l0 != 0)) && ( !(_x_p5_l1 != 0)))))))))) && ((delta <= 0.0) || ((((((p5_l0 != 0) == (_x_p5_l0 != 0)) && ((p5_l1 != 0) == (_x_p5_l1 != 0))) && ((p5_l2 != 0) == (_x_p5_l2 != 0))) && ((p5_l3 != 0) == (_x_p5_l3 != 0))) && ((delta + (p5_c + (-1.0 * _x_p5_c))) == 0.0)))) && ((p5_evt != 0) || ((((((p5_l0 != 0) == (_x_p5_l0 != 0)) && ((p5_l1 != 0) == (_x_p5_l1 != 0))) && ((p5_l2 != 0) == (_x_p5_l2 != 0))) && ((p5_l3 != 0) == (_x_p5_l3 != 0))) && ((delta + (p5_c + (-1.0 * _x_p5_c))) == 0.0)))) && (((v1 == _x_v1) && (((v1 == 0) && (( !(_x_p5_l3 != 0)) && (( !(_x_p5_l2 != 0)) && ((_x_p5_l0 != 0) && ( !(_x_p5_l1 != 0)))))) && (((v2 != 0) == (_x_v2 != 0)) && (_x_p5_c == 0.0)))) || ( !((( !(p5_l3 != 0)) && (( !(p5_l2 != 0)) && (( !(p5_l0 != 0)) && ( !(p5_l1 != 0))))) && ((delta == 0.0) && (p5_evt != 0)))))) && (((((v2 != 0) == (_x_v2 != 0)) && (_x_p5_c == 0.0)) && ((( !(_x_p5_l3 != 0)) && (( !(_x_p5_l2 != 0)) && ((_x_p5_l1 != 0) && ( !(_x_p5_l0 != 0))))) && (_x_v1 == 6))) || ( !((( !(p5_l3 != 0)) && (( !(p5_l2 != 0)) && ((p5_l0 != 0) && ( !(p5_l1 != 0))))) && ((delta == 0.0) && (p5_evt != 0)))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && (((( !(_x_p5_l3 != 0)) && (( !(_x_p5_l2 != 0)) && (( !(_x_p5_l0 != 0)) && ( !(_x_p5_l1 != 0))))) || (( !(_x_p5_l3 != 0)) && (( !(_x_p5_l2 != 0)) && ((_x_p5_l0 != 0) && (_x_p5_l1 != 0))))) && (p5_c == _x_p5_c))) || ( !((( !(p5_l3 != 0)) && (( !(p5_l2 != 0)) && ((p5_l1 != 0) && ( !(p5_l0 != 0))))) && ((delta == 0.0) && (p5_evt != 0)))))) && (( !(v1 == 6)) || ( !((( !(_x_p5_l3 != 0)) && (( !(_x_p5_l2 != 0)) && (( !(_x_p5_l0 != 0)) && ( !(_x_p5_l1 != 0))))) && ((( !(p5_l3 != 0)) && (( !(p5_l2 != 0)) && ((p5_l1 != 0) && ( !(p5_l0 != 0))))) && ((delta == 0.0) && (p5_evt != 0))))))) && (((v1 == 6) && ( !(p5_c <= 16.0))) || ( !((( !(_x_p5_l3 != 0)) && (( !(_x_p5_l2 != 0)) && ((_x_p5_l0 != 0) && (_x_p5_l1 != 0)))) && ((( !(p5_l3 != 0)) && (( !(p5_l2 != 0)) && ((p5_l1 != 0) && ( !(p5_l0 != 0))))) && ((delta == 0.0) && (p5_evt != 0))))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && ((( !(_x_p5_l3 != 0)) && (( !(_x_p5_l2 != 0)) && (( !(_x_p5_l0 != 0)) && ( !(_x_p5_l1 != 0))))) || (( !(_x_p5_l3 != 0)) && ((_x_p5_l2 != 0) && (( !(_x_p5_l0 != 0)) && ( !(_x_p5_l1 != 0))))))) || ( !((( !(p5_l3 != 0)) && (( !(p5_l2 != 0)) && ((p5_l0 != 0) && (p5_l1 != 0)))) && ((delta == 0.0) && (p5_evt != 0)))))) && (((v2 != 0) && (p5_c == _x_p5_c)) || ( !(((delta == 0.0) && (p5_evt != 0)) && ((( !(_x_p5_l3 != 0)) && (( !(_x_p5_l2 != 0)) && (( !(_x_p5_l0 != 0)) && ( !(_x_p5_l1 != 0))))) && (( !(p5_l3 != 0)) && (( !(p5_l2 != 0)) && ((p5_l0 != 0) && (p5_l1 != 0))))))))) && ((( !(v2 != 0)) && (_x_p5_c == 0.0)) || ( !(((delta == 0.0) && (p5_evt != 0)) && ((( !(p5_l3 != 0)) && (( !(p5_l2 != 0)) && ((p5_l0 != 0) && (p5_l1 != 0)))) && (( !(_x_p5_l3 != 0)) && ((_x_p5_l2 != 0) && (( !(_x_p5_l0 != 0)) && ( !(_x_p5_l1 != 0)))))))))) && ((((_x_v2 != 0) && (( !(_x_p5_l3 != 0)) && ((_x_p5_l2 != 0) && ((_x_p5_l0 != 0) && ( !(_x_p5_l1 != 0)))))) && ((v1 == _x_v1) && (_x_p5_c == 0.0))) || ( !((( !(p5_l3 != 0)) && ((p5_l2 != 0) && (( !(p5_l0 != 0)) && ( !(p5_l1 != 0))))) && ((delta == 0.0) && (p5_evt != 0)))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && ((p5_c == _x_p5_c) && ((( !(_x_p5_l3 != 0)) && (( !(_x_p5_l2 != 0)) && (( !(_x_p5_l0 != 0)) && ( !(_x_p5_l1 != 0))))) || (( !(_x_p5_l3 != 0)) && ((_x_p5_l2 != 0) && ((_x_p5_l1 != 0) && ( !(_x_p5_l0 != 0)))))))) || ( !((( !(p5_l3 != 0)) && ((p5_l2 != 0) && ((p5_l0 != 0) && ( !(p5_l1 != 0))))) && ((delta == 0.0) && (p5_evt != 0)))))) && (( !(v1 == 6)) || ( !(((delta == 0.0) && (p5_evt != 0)) && ((( !(_x_p5_l3 != 0)) && (( !(_x_p5_l2 != 0)) && (( !(_x_p5_l0 != 0)) && ( !(_x_p5_l1 != 0))))) && (( !(p5_l3 != 0)) && ((p5_l2 != 0) && ((p5_l0 != 0) && ( !(p5_l1 != 0)))))))))) && ((v1 == 6) || ( !(((delta == 0.0) && (p5_evt != 0)) && ((( !(p5_l3 != 0)) && ((p5_l2 != 0) && ((p5_l0 != 0) && ( !(p5_l1 != 0))))) && (( !(_x_p5_l3 != 0)) && ((_x_p5_l2 != 0) && ((_x_p5_l1 != 0) && ( !(_x_p5_l0 != 0)))))))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && ((( !(_x_p5_l3 != 0)) && ((_x_p5_l2 != 0) && ((_x_p5_l0 != 0) && (_x_p5_l1 != 0)))) && (_x_p5_c == 0.0))) || ( !((( !(p5_l3 != 0)) && ((p5_l2 != 0) && ((p5_l1 != 0) && ( !(p5_l0 != 0))))) && ((delta == 0.0) && (p5_evt != 0)))))) && ((((v1 == _x_v1) && (_x_p5_c == 0.0)) && (( !(_x_v2 != 0)) && ((_x_p5_l3 != 0) && (( !(_x_p5_l2 != 0)) && (( !(_x_p5_l0 != 0)) && ( !(_x_p5_l1 != 0))))))) || ( !((( !(p5_l3 != 0)) && ((p5_l2 != 0) && ((p5_l0 != 0) && (p5_l1 != 0)))) && ((delta == 0.0) && (p5_evt != 0)))))) && ((((_x_v1 == 0) && (( !(_x_p5_l3 != 0)) && (( !(_x_p5_l2 != 0)) && (( !(_x_p5_l0 != 0)) && ( !(_x_p5_l1 != 0)))))) && (((v2 != 0) == (_x_v2 != 0)) && (p5_c == _x_p5_c))) || ( !(((p5_l3 != 0) && (( !(p5_l2 != 0)) && (( !(p5_l0 != 0)) && ( !(p5_l1 != 0))))) && ((delta == 0.0) && (p5_evt != 0)))))) && ((((((((((((((((((((((_x_p4_l3 != 0) && (( !(_x_p4_l2 != 0)) && (( !(_x_p4_l0 != 0)) && ( !(_x_p4_l1 != 0))))) || ((( !(_x_p4_l3 != 0)) && ((_x_p4_l2 != 0) && ((_x_p4_l0 != 0) && (_x_p4_l1 != 0)))) || ((( !(_x_p4_l3 != 0)) && ((_x_p4_l2 != 0) && ((_x_p4_l1 != 0) && ( !(_x_p4_l0 != 0))))) || ((( !(_x_p4_l3 != 0)) && ((_x_p4_l2 != 0) && ((_x_p4_l0 != 0) && ( !(_x_p4_l1 != 0))))) || ((( !(_x_p4_l3 != 0)) && ((_x_p4_l2 != 0) && (( !(_x_p4_l0 != 0)) && ( !(_x_p4_l1 != 0))))) || ((( !(_x_p4_l3 != 0)) && (( !(_x_p4_l2 != 0)) && ((_x_p4_l0 != 0) && (_x_p4_l1 != 0)))) || ((( !(_x_p4_l3 != 0)) && (( !(_x_p4_l2 != 0)) && ((_x_p4_l1 != 0) && ( !(_x_p4_l0 != 0))))) || ((( !(_x_p4_l3 != 0)) && (( !(_x_p4_l2 != 0)) && (( !(_x_p4_l0 != 0)) && ( !(_x_p4_l1 != 0))))) || (( !(_x_p4_l3 != 0)) && (( !(_x_p4_l2 != 0)) && ((_x_p4_l0 != 0) && ( !(_x_p4_l1 != 0))))))))))))) && ((_x_p4_c <= 16.0) || ( !(((( !(_x_p4_l3 != 0)) && (( !(_x_p4_l2 != 0)) && ((_x_p4_l0 != 0) && ( !(_x_p4_l1 != 0))))) || (( !(_x_p4_l3 != 0)) && ((_x_p4_l2 != 0) && (( !(_x_p4_l0 != 0)) && ( !(_x_p4_l1 != 0)))))) || ((( !(_x_p4_l3 != 0)) && ((_x_p4_l2 != 0) && ((_x_p4_l0 != 0) && (_x_p4_l1 != 0)))) || ((_x_p4_l3 != 0) && (( !(_x_p4_l2 != 0)) && (( !(_x_p4_l0 != 0)) && ( !(_x_p4_l1 != 0)))))))))) && ((delta <= 0.0) || ((((((p4_l0 != 0) == (_x_p4_l0 != 0)) && ((p4_l1 != 0) == (_x_p4_l1 != 0))) && ((p4_l2 != 0) == (_x_p4_l2 != 0))) && ((p4_l3 != 0) == (_x_p4_l3 != 0))) && ((delta + (p4_c + (-1.0 * _x_p4_c))) == 0.0)))) && ((p4_evt != 0) || ((((((p4_l0 != 0) == (_x_p4_l0 != 0)) && ((p4_l1 != 0) == (_x_p4_l1 != 0))) && ((p4_l2 != 0) == (_x_p4_l2 != 0))) && ((p4_l3 != 0) == (_x_p4_l3 != 0))) && ((delta + (p4_c + (-1.0 * _x_p4_c))) == 0.0)))) && (((v1 == _x_v1) && (((v1 == 0) && (( !(_x_p4_l3 != 0)) && (( !(_x_p4_l2 != 0)) && ((_x_p4_l0 != 0) && ( !(_x_p4_l1 != 0)))))) && (((v2 != 0) == (_x_v2 != 0)) && (_x_p4_c == 0.0)))) || ( !((( !(p4_l3 != 0)) && (( !(p4_l2 != 0)) && (( !(p4_l0 != 0)) && ( !(p4_l1 != 0))))) && ((delta == 0.0) && (p4_evt != 0)))))) && (((((v2 != 0) == (_x_v2 != 0)) && (_x_p4_c == 0.0)) && ((( !(_x_p4_l3 != 0)) && (( !(_x_p4_l2 != 0)) && ((_x_p4_l1 != 0) && ( !(_x_p4_l0 != 0))))) && (_x_v1 == 5))) || ( !((( !(p4_l3 != 0)) && (( !(p4_l2 != 0)) && ((p4_l0 != 0) && ( !(p4_l1 != 0))))) && ((delta == 0.0) && (p4_evt != 0)))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && (((( !(_x_p4_l3 != 0)) && (( !(_x_p4_l2 != 0)) && (( !(_x_p4_l0 != 0)) && ( !(_x_p4_l1 != 0))))) || (( !(_x_p4_l3 != 0)) && (( !(_x_p4_l2 != 0)) && ((_x_p4_l0 != 0) && (_x_p4_l1 != 0))))) && (p4_c == _x_p4_c))) || ( !((( !(p4_l3 != 0)) && (( !(p4_l2 != 0)) && ((p4_l1 != 0) && ( !(p4_l0 != 0))))) && ((delta == 0.0) && (p4_evt != 0)))))) && (( !(v1 == 5)) || ( !((( !(_x_p4_l3 != 0)) && (( !(_x_p4_l2 != 0)) && (( !(_x_p4_l0 != 0)) && ( !(_x_p4_l1 != 0))))) && ((( !(p4_l3 != 0)) && (( !(p4_l2 != 0)) && ((p4_l1 != 0) && ( !(p4_l0 != 0))))) && ((delta == 0.0) && (p4_evt != 0))))))) && (((v1 == 5) && ( !(p4_c <= 16.0))) || ( !((( !(_x_p4_l3 != 0)) && (( !(_x_p4_l2 != 0)) && ((_x_p4_l0 != 0) && (_x_p4_l1 != 0)))) && ((( !(p4_l3 != 0)) && (( !(p4_l2 != 0)) && ((p4_l1 != 0) && ( !(p4_l0 != 0))))) && ((delta == 0.0) && (p4_evt != 0))))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && ((( !(_x_p4_l3 != 0)) && (( !(_x_p4_l2 != 0)) && (( !(_x_p4_l0 != 0)) && ( !(_x_p4_l1 != 0))))) || (( !(_x_p4_l3 != 0)) && ((_x_p4_l2 != 0) && (( !(_x_p4_l0 != 0)) && ( !(_x_p4_l1 != 0))))))) || ( !((( !(p4_l3 != 0)) && (( !(p4_l2 != 0)) && ((p4_l0 != 0) && (p4_l1 != 0)))) && ((delta == 0.0) && (p4_evt != 0)))))) && (((v2 != 0) && (p4_c == _x_p4_c)) || ( !(((delta == 0.0) && (p4_evt != 0)) && ((( !(_x_p4_l3 != 0)) && (( !(_x_p4_l2 != 0)) && (( !(_x_p4_l0 != 0)) && ( !(_x_p4_l1 != 0))))) && (( !(p4_l3 != 0)) && (( !(p4_l2 != 0)) && ((p4_l0 != 0) && (p4_l1 != 0))))))))) && ((( !(v2 != 0)) && (_x_p4_c == 0.0)) || ( !(((delta == 0.0) && (p4_evt != 0)) && ((( !(p4_l3 != 0)) && (( !(p4_l2 != 0)) && ((p4_l0 != 0) && (p4_l1 != 0)))) && (( !(_x_p4_l3 != 0)) && ((_x_p4_l2 != 0) && (( !(_x_p4_l0 != 0)) && ( !(_x_p4_l1 != 0)))))))))) && ((((_x_v2 != 0) && (( !(_x_p4_l3 != 0)) && ((_x_p4_l2 != 0) && ((_x_p4_l0 != 0) && ( !(_x_p4_l1 != 0)))))) && ((v1 == _x_v1) && (_x_p4_c == 0.0))) || ( !((( !(p4_l3 != 0)) && ((p4_l2 != 0) && (( !(p4_l0 != 0)) && ( !(p4_l1 != 0))))) && ((delta == 0.0) && (p4_evt != 0)))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && ((p4_c == _x_p4_c) && ((( !(_x_p4_l3 != 0)) && (( !(_x_p4_l2 != 0)) && (( !(_x_p4_l0 != 0)) && ( !(_x_p4_l1 != 0))))) || (( !(_x_p4_l3 != 0)) && ((_x_p4_l2 != 0) && ((_x_p4_l1 != 0) && ( !(_x_p4_l0 != 0)))))))) || ( !((( !(p4_l3 != 0)) && ((p4_l2 != 0) && ((p4_l0 != 0) && ( !(p4_l1 != 0))))) && ((delta == 0.0) && (p4_evt != 0)))))) && (( !(v1 == 5)) || ( !(((delta == 0.0) && (p4_evt != 0)) && ((( !(_x_p4_l3 != 0)) && (( !(_x_p4_l2 != 0)) && (( !(_x_p4_l0 != 0)) && ( !(_x_p4_l1 != 0))))) && (( !(p4_l3 != 0)) && ((p4_l2 != 0) && ((p4_l0 != 0) && ( !(p4_l1 != 0)))))))))) && ((v1 == 5) || ( !(((delta == 0.0) && (p4_evt != 0)) && ((( !(p4_l3 != 0)) && ((p4_l2 != 0) && ((p4_l0 != 0) && ( !(p4_l1 != 0))))) && (( !(_x_p4_l3 != 0)) && ((_x_p4_l2 != 0) && ((_x_p4_l1 != 0) && ( !(_x_p4_l0 != 0)))))))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && ((( !(_x_p4_l3 != 0)) && ((_x_p4_l2 != 0) && ((_x_p4_l0 != 0) && (_x_p4_l1 != 0)))) && (_x_p4_c == 0.0))) || ( !((( !(p4_l3 != 0)) && ((p4_l2 != 0) && ((p4_l1 != 0) && ( !(p4_l0 != 0))))) && ((delta == 0.0) && (p4_evt != 0)))))) && ((((v1 == _x_v1) && (_x_p4_c == 0.0)) && (( !(_x_v2 != 0)) && ((_x_p4_l3 != 0) && (( !(_x_p4_l2 != 0)) && (( !(_x_p4_l0 != 0)) && ( !(_x_p4_l1 != 0))))))) || ( !((( !(p4_l3 != 0)) && ((p4_l2 != 0) && ((p4_l0 != 0) && (p4_l1 != 0)))) && ((delta == 0.0) && (p4_evt != 0)))))) && ((((_x_v1 == 0) && (( !(_x_p4_l3 != 0)) && (( !(_x_p4_l2 != 0)) && (( !(_x_p4_l0 != 0)) && ( !(_x_p4_l1 != 0)))))) && (((v2 != 0) == (_x_v2 != 0)) && (p4_c == _x_p4_c))) || ( !(((p4_l3 != 0) && (( !(p4_l2 != 0)) && (( !(p4_l0 != 0)) && ( !(p4_l1 != 0))))) && ((delta == 0.0) && (p4_evt != 0)))))) && ((((((((((((((((((((((_x_p3_l3 != 0) && (( !(_x_p3_l2 != 0)) && (( !(_x_p3_l0 != 0)) && ( !(_x_p3_l1 != 0))))) || ((( !(_x_p3_l3 != 0)) && ((_x_p3_l2 != 0) && ((_x_p3_l0 != 0) && (_x_p3_l1 != 0)))) || ((( !(_x_p3_l3 != 0)) && ((_x_p3_l2 != 0) && ((_x_p3_l1 != 0) && ( !(_x_p3_l0 != 0))))) || ((( !(_x_p3_l3 != 0)) && ((_x_p3_l2 != 0) && ((_x_p3_l0 != 0) && ( !(_x_p3_l1 != 0))))) || ((( !(_x_p3_l3 != 0)) && ((_x_p3_l2 != 0) && (( !(_x_p3_l0 != 0)) && ( !(_x_p3_l1 != 0))))) || ((( !(_x_p3_l3 != 0)) && (( !(_x_p3_l2 != 0)) && ((_x_p3_l0 != 0) && (_x_p3_l1 != 0)))) || ((( !(_x_p3_l3 != 0)) && (( !(_x_p3_l2 != 0)) && ((_x_p3_l1 != 0) && ( !(_x_p3_l0 != 0))))) || ((( !(_x_p3_l3 != 0)) && (( !(_x_p3_l2 != 0)) && (( !(_x_p3_l0 != 0)) && ( !(_x_p3_l1 != 0))))) || (( !(_x_p3_l3 != 0)) && (( !(_x_p3_l2 != 0)) && ((_x_p3_l0 != 0) && ( !(_x_p3_l1 != 0))))))))))))) && ((_x_p3_c <= 16.0) || ( !(((( !(_x_p3_l3 != 0)) && (( !(_x_p3_l2 != 0)) && ((_x_p3_l0 != 0) && ( !(_x_p3_l1 != 0))))) || (( !(_x_p3_l3 != 0)) && ((_x_p3_l2 != 0) && (( !(_x_p3_l0 != 0)) && ( !(_x_p3_l1 != 0)))))) || ((( !(_x_p3_l3 != 0)) && ((_x_p3_l2 != 0) && ((_x_p3_l0 != 0) && (_x_p3_l1 != 0)))) || ((_x_p3_l3 != 0) && (( !(_x_p3_l2 != 0)) && (( !(_x_p3_l0 != 0)) && ( !(_x_p3_l1 != 0)))))))))) && ((delta <= 0.0) || ((((((p3_l0 != 0) == (_x_p3_l0 != 0)) && ((p3_l1 != 0) == (_x_p3_l1 != 0))) && ((p3_l2 != 0) == (_x_p3_l2 != 0))) && ((p3_l3 != 0) == (_x_p3_l3 != 0))) && ((delta + (p3_c + (-1.0 * _x_p3_c))) == 0.0)))) && ((p3_evt != 0) || ((((((p3_l0 != 0) == (_x_p3_l0 != 0)) && ((p3_l1 != 0) == (_x_p3_l1 != 0))) && ((p3_l2 != 0) == (_x_p3_l2 != 0))) && ((p3_l3 != 0) == (_x_p3_l3 != 0))) && ((delta + (p3_c + (-1.0 * _x_p3_c))) == 0.0)))) && (((v1 == _x_v1) && (((v1 == 0) && (( !(_x_p3_l3 != 0)) && (( !(_x_p3_l2 != 0)) && ((_x_p3_l0 != 0) && ( !(_x_p3_l1 != 0)))))) && (((v2 != 0) == (_x_v2 != 0)) && (_x_p3_c == 0.0)))) || ( !((( !(p3_l3 != 0)) && (( !(p3_l2 != 0)) && (( !(p3_l0 != 0)) && ( !(p3_l1 != 0))))) && ((delta == 0.0) && (p3_evt != 0)))))) && (((((v2 != 0) == (_x_v2 != 0)) && (_x_p3_c == 0.0)) && ((( !(_x_p3_l3 != 0)) && (( !(_x_p3_l2 != 0)) && ((_x_p3_l1 != 0) && ( !(_x_p3_l0 != 0))))) && (_x_v1 == 4))) || ( !((( !(p3_l3 != 0)) && (( !(p3_l2 != 0)) && ((p3_l0 != 0) && ( !(p3_l1 != 0))))) && ((delta == 0.0) && (p3_evt != 0)))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && (((( !(_x_p3_l3 != 0)) && (( !(_x_p3_l2 != 0)) && (( !(_x_p3_l0 != 0)) && ( !(_x_p3_l1 != 0))))) || (( !(_x_p3_l3 != 0)) && (( !(_x_p3_l2 != 0)) && ((_x_p3_l0 != 0) && (_x_p3_l1 != 0))))) && (p3_c == _x_p3_c))) || ( !((( !(p3_l3 != 0)) && (( !(p3_l2 != 0)) && ((p3_l1 != 0) && ( !(p3_l0 != 0))))) && ((delta == 0.0) && (p3_evt != 0)))))) && (( !(v1 == 4)) || ( !((( !(_x_p3_l3 != 0)) && (( !(_x_p3_l2 != 0)) && (( !(_x_p3_l0 != 0)) && ( !(_x_p3_l1 != 0))))) && ((( !(p3_l3 != 0)) && (( !(p3_l2 != 0)) && ((p3_l1 != 0) && ( !(p3_l0 != 0))))) && ((delta == 0.0) && (p3_evt != 0))))))) && (((v1 == 4) && ( !(p3_c <= 16.0))) || ( !((( !(_x_p3_l3 != 0)) && (( !(_x_p3_l2 != 0)) && ((_x_p3_l0 != 0) && (_x_p3_l1 != 0)))) && ((( !(p3_l3 != 0)) && (( !(p3_l2 != 0)) && ((p3_l1 != 0) && ( !(p3_l0 != 0))))) && ((delta == 0.0) && (p3_evt != 0))))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && ((( !(_x_p3_l3 != 0)) && (( !(_x_p3_l2 != 0)) && (( !(_x_p3_l0 != 0)) && ( !(_x_p3_l1 != 0))))) || (( !(_x_p3_l3 != 0)) && ((_x_p3_l2 != 0) && (( !(_x_p3_l0 != 0)) && ( !(_x_p3_l1 != 0))))))) || ( !((( !(p3_l3 != 0)) && (( !(p3_l2 != 0)) && ((p3_l0 != 0) && (p3_l1 != 0)))) && ((delta == 0.0) && (p3_evt != 0)))))) && (((v2 != 0) && (p3_c == _x_p3_c)) || ( !(((delta == 0.0) && (p3_evt != 0)) && ((( !(_x_p3_l3 != 0)) && (( !(_x_p3_l2 != 0)) && (( !(_x_p3_l0 != 0)) && ( !(_x_p3_l1 != 0))))) && (( !(p3_l3 != 0)) && (( !(p3_l2 != 0)) && ((p3_l0 != 0) && (p3_l1 != 0))))))))) && ((( !(v2 != 0)) && (_x_p3_c == 0.0)) || ( !(((delta == 0.0) && (p3_evt != 0)) && ((( !(p3_l3 != 0)) && (( !(p3_l2 != 0)) && ((p3_l0 != 0) && (p3_l1 != 0)))) && (( !(_x_p3_l3 != 0)) && ((_x_p3_l2 != 0) && (( !(_x_p3_l0 != 0)) && ( !(_x_p3_l1 != 0)))))))))) && ((((_x_v2 != 0) && (( !(_x_p3_l3 != 0)) && ((_x_p3_l2 != 0) && ((_x_p3_l0 != 0) && ( !(_x_p3_l1 != 0)))))) && ((v1 == _x_v1) && (_x_p3_c == 0.0))) || ( !((( !(p3_l3 != 0)) && ((p3_l2 != 0) && (( !(p3_l0 != 0)) && ( !(p3_l1 != 0))))) && ((delta == 0.0) && (p3_evt != 0)))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && ((p3_c == _x_p3_c) && ((( !(_x_p3_l3 != 0)) && (( !(_x_p3_l2 != 0)) && (( !(_x_p3_l0 != 0)) && ( !(_x_p3_l1 != 0))))) || (( !(_x_p3_l3 != 0)) && ((_x_p3_l2 != 0) && ((_x_p3_l1 != 0) && ( !(_x_p3_l0 != 0)))))))) || ( !((( !(p3_l3 != 0)) && ((p3_l2 != 0) && ((p3_l0 != 0) && ( !(p3_l1 != 0))))) && ((delta == 0.0) && (p3_evt != 0)))))) && (( !(v1 == 4)) || ( !(((delta == 0.0) && (p3_evt != 0)) && ((( !(_x_p3_l3 != 0)) && (( !(_x_p3_l2 != 0)) && (( !(_x_p3_l0 != 0)) && ( !(_x_p3_l1 != 0))))) && (( !(p3_l3 != 0)) && ((p3_l2 != 0) && ((p3_l0 != 0) && ( !(p3_l1 != 0)))))))))) && ((v1 == 4) || ( !(((delta == 0.0) && (p3_evt != 0)) && ((( !(p3_l3 != 0)) && ((p3_l2 != 0) && ((p3_l0 != 0) && ( !(p3_l1 != 0))))) && (( !(_x_p3_l3 != 0)) && ((_x_p3_l2 != 0) && ((_x_p3_l1 != 0) && ( !(_x_p3_l0 != 0)))))))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && ((( !(_x_p3_l3 != 0)) && ((_x_p3_l2 != 0) && ((_x_p3_l0 != 0) && (_x_p3_l1 != 0)))) && (_x_p3_c == 0.0))) || ( !((( !(p3_l3 != 0)) && ((p3_l2 != 0) && ((p3_l1 != 0) && ( !(p3_l0 != 0))))) && ((delta == 0.0) && (p3_evt != 0)))))) && ((((v1 == _x_v1) && (_x_p3_c == 0.0)) && (( !(_x_v2 != 0)) && ((_x_p3_l3 != 0) && (( !(_x_p3_l2 != 0)) && (( !(_x_p3_l0 != 0)) && ( !(_x_p3_l1 != 0))))))) || ( !((( !(p3_l3 != 0)) && ((p3_l2 != 0) && ((p3_l0 != 0) && (p3_l1 != 0)))) && ((delta == 0.0) && (p3_evt != 0)))))) && ((((_x_v1 == 0) && (( !(_x_p3_l3 != 0)) && (( !(_x_p3_l2 != 0)) && (( !(_x_p3_l0 != 0)) && ( !(_x_p3_l1 != 0)))))) && (((v2 != 0) == (_x_v2 != 0)) && (p3_c == _x_p3_c))) || ( !(((p3_l3 != 0) && (( !(p3_l2 != 0)) && (( !(p3_l0 != 0)) && ( !(p3_l1 != 0))))) && ((delta == 0.0) && (p3_evt != 0)))))) && ((((((((((((((((((((((_x_p2_l3 != 0) && (( !(_x_p2_l2 != 0)) && (( !(_x_p2_l0 != 0)) && ( !(_x_p2_l1 != 0))))) || ((( !(_x_p2_l3 != 0)) && ((_x_p2_l2 != 0) && ((_x_p2_l0 != 0) && (_x_p2_l1 != 0)))) || ((( !(_x_p2_l3 != 0)) && ((_x_p2_l2 != 0) && ((_x_p2_l1 != 0) && ( !(_x_p2_l0 != 0))))) || ((( !(_x_p2_l3 != 0)) && ((_x_p2_l2 != 0) && ((_x_p2_l0 != 0) && ( !(_x_p2_l1 != 0))))) || ((( !(_x_p2_l3 != 0)) && ((_x_p2_l2 != 0) && (( !(_x_p2_l0 != 0)) && ( !(_x_p2_l1 != 0))))) || ((( !(_x_p2_l3 != 0)) && (( !(_x_p2_l2 != 0)) && ((_x_p2_l0 != 0) && (_x_p2_l1 != 0)))) || ((( !(_x_p2_l3 != 0)) && (( !(_x_p2_l2 != 0)) && ((_x_p2_l1 != 0) && ( !(_x_p2_l0 != 0))))) || ((( !(_x_p2_l3 != 0)) && (( !(_x_p2_l2 != 0)) && (( !(_x_p2_l0 != 0)) && ( !(_x_p2_l1 != 0))))) || (( !(_x_p2_l3 != 0)) && (( !(_x_p2_l2 != 0)) && ((_x_p2_l0 != 0) && ( !(_x_p2_l1 != 0))))))))))))) && ((_x_p2_c <= 16.0) || ( !(((( !(_x_p2_l3 != 0)) && (( !(_x_p2_l2 != 0)) && ((_x_p2_l0 != 0) && ( !(_x_p2_l1 != 0))))) || (( !(_x_p2_l3 != 0)) && ((_x_p2_l2 != 0) && (( !(_x_p2_l0 != 0)) && ( !(_x_p2_l1 != 0)))))) || ((( !(_x_p2_l3 != 0)) && ((_x_p2_l2 != 0) && ((_x_p2_l0 != 0) && (_x_p2_l1 != 0)))) || ((_x_p2_l3 != 0) && (( !(_x_p2_l2 != 0)) && (( !(_x_p2_l0 != 0)) && ( !(_x_p2_l1 != 0)))))))))) && ((delta <= 0.0) || ((((((p2_l0 != 0) == (_x_p2_l0 != 0)) && ((p2_l1 != 0) == (_x_p2_l1 != 0))) && ((p2_l2 != 0) == (_x_p2_l2 != 0))) && ((p2_l3 != 0) == (_x_p2_l3 != 0))) && ((delta + (p2_c + (-1.0 * _x_p2_c))) == 0.0)))) && ((p2_evt != 0) || ((((((p2_l0 != 0) == (_x_p2_l0 != 0)) && ((p2_l1 != 0) == (_x_p2_l1 != 0))) && ((p2_l2 != 0) == (_x_p2_l2 != 0))) && ((p2_l3 != 0) == (_x_p2_l3 != 0))) && ((delta + (p2_c + (-1.0 * _x_p2_c))) == 0.0)))) && (((v1 == _x_v1) && (((v1 == 0) && (( !(_x_p2_l3 != 0)) && (( !(_x_p2_l2 != 0)) && ((_x_p2_l0 != 0) && ( !(_x_p2_l1 != 0)))))) && (((v2 != 0) == (_x_v2 != 0)) && (_x_p2_c == 0.0)))) || ( !((( !(p2_l3 != 0)) && (( !(p2_l2 != 0)) && (( !(p2_l0 != 0)) && ( !(p2_l1 != 0))))) && ((delta == 0.0) && (p2_evt != 0)))))) && (((((v2 != 0) == (_x_v2 != 0)) && (_x_p2_c == 0.0)) && ((( !(_x_p2_l3 != 0)) && (( !(_x_p2_l2 != 0)) && ((_x_p2_l1 != 0) && ( !(_x_p2_l0 != 0))))) && (_x_v1 == 3))) || ( !((( !(p2_l3 != 0)) && (( !(p2_l2 != 0)) && ((p2_l0 != 0) && ( !(p2_l1 != 0))))) && ((delta == 0.0) && (p2_evt != 0)))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && (((( !(_x_p2_l3 != 0)) && (( !(_x_p2_l2 != 0)) && (( !(_x_p2_l0 != 0)) && ( !(_x_p2_l1 != 0))))) || (( !(_x_p2_l3 != 0)) && (( !(_x_p2_l2 != 0)) && ((_x_p2_l0 != 0) && (_x_p2_l1 != 0))))) && (p2_c == _x_p2_c))) || ( !((( !(p2_l3 != 0)) && (( !(p2_l2 != 0)) && ((p2_l1 != 0) && ( !(p2_l0 != 0))))) && ((delta == 0.0) && (p2_evt != 0)))))) && (( !(v1 == 3)) || ( !((( !(_x_p2_l3 != 0)) && (( !(_x_p2_l2 != 0)) && (( !(_x_p2_l0 != 0)) && ( !(_x_p2_l1 != 0))))) && ((( !(p2_l3 != 0)) && (( !(p2_l2 != 0)) && ((p2_l1 != 0) && ( !(p2_l0 != 0))))) && ((delta == 0.0) && (p2_evt != 0))))))) && (((v1 == 3) && ( !(p2_c <= 16.0))) || ( !((( !(_x_p2_l3 != 0)) && (( !(_x_p2_l2 != 0)) && ((_x_p2_l0 != 0) && (_x_p2_l1 != 0)))) && ((( !(p2_l3 != 0)) && (( !(p2_l2 != 0)) && ((p2_l1 != 0) && ( !(p2_l0 != 0))))) && ((delta == 0.0) && (p2_evt != 0))))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && ((( !(_x_p2_l3 != 0)) && (( !(_x_p2_l2 != 0)) && (( !(_x_p2_l0 != 0)) && ( !(_x_p2_l1 != 0))))) || (( !(_x_p2_l3 != 0)) && ((_x_p2_l2 != 0) && (( !(_x_p2_l0 != 0)) && ( !(_x_p2_l1 != 0))))))) || ( !((( !(p2_l3 != 0)) && (( !(p2_l2 != 0)) && ((p2_l0 != 0) && (p2_l1 != 0)))) && ((delta == 0.0) && (p2_evt != 0)))))) && (((v2 != 0) && (p2_c == _x_p2_c)) || ( !(((delta == 0.0) && (p2_evt != 0)) && ((( !(_x_p2_l3 != 0)) && (( !(_x_p2_l2 != 0)) && (( !(_x_p2_l0 != 0)) && ( !(_x_p2_l1 != 0))))) && (( !(p2_l3 != 0)) && (( !(p2_l2 != 0)) && ((p2_l0 != 0) && (p2_l1 != 0))))))))) && ((( !(v2 != 0)) && (_x_p2_c == 0.0)) || ( !(((delta == 0.0) && (p2_evt != 0)) && ((( !(p2_l3 != 0)) && (( !(p2_l2 != 0)) && ((p2_l0 != 0) && (p2_l1 != 0)))) && (( !(_x_p2_l3 != 0)) && ((_x_p2_l2 != 0) && (( !(_x_p2_l0 != 0)) && ( !(_x_p2_l1 != 0)))))))))) && ((((_x_v2 != 0) && (( !(_x_p2_l3 != 0)) && ((_x_p2_l2 != 0) && ((_x_p2_l0 != 0) && ( !(_x_p2_l1 != 0)))))) && ((v1 == _x_v1) && (_x_p2_c == 0.0))) || ( !((( !(p2_l3 != 0)) && ((p2_l2 != 0) && (( !(p2_l0 != 0)) && ( !(p2_l1 != 0))))) && ((delta == 0.0) && (p2_evt != 0)))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && ((p2_c == _x_p2_c) && ((( !(_x_p2_l3 != 0)) && (( !(_x_p2_l2 != 0)) && (( !(_x_p2_l0 != 0)) && ( !(_x_p2_l1 != 0))))) || (( !(_x_p2_l3 != 0)) && ((_x_p2_l2 != 0) && ((_x_p2_l1 != 0) && ( !(_x_p2_l0 != 0)))))))) || ( !((( !(p2_l3 != 0)) && ((p2_l2 != 0) && ((p2_l0 != 0) && ( !(p2_l1 != 0))))) && ((delta == 0.0) && (p2_evt != 0)))))) && (( !(v1 == 3)) || ( !(((delta == 0.0) && (p2_evt != 0)) && ((( !(_x_p2_l3 != 0)) && (( !(_x_p2_l2 != 0)) && (( !(_x_p2_l0 != 0)) && ( !(_x_p2_l1 != 0))))) && (( !(p2_l3 != 0)) && ((p2_l2 != 0) && ((p2_l0 != 0) && ( !(p2_l1 != 0)))))))))) && ((v1 == 3) || ( !(((delta == 0.0) && (p2_evt != 0)) && ((( !(p2_l3 != 0)) && ((p2_l2 != 0) && ((p2_l0 != 0) && ( !(p2_l1 != 0))))) && (( !(_x_p2_l3 != 0)) && ((_x_p2_l2 != 0) && ((_x_p2_l1 != 0) && ( !(_x_p2_l0 != 0)))))))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && ((( !(_x_p2_l3 != 0)) && ((_x_p2_l2 != 0) && ((_x_p2_l0 != 0) && (_x_p2_l1 != 0)))) && (_x_p2_c == 0.0))) || ( !((( !(p2_l3 != 0)) && ((p2_l2 != 0) && ((p2_l1 != 0) && ( !(p2_l0 != 0))))) && ((delta == 0.0) && (p2_evt != 0)))))) && ((((v1 == _x_v1) && (_x_p2_c == 0.0)) && (( !(_x_v2 != 0)) && ((_x_p2_l3 != 0) && (( !(_x_p2_l2 != 0)) && (( !(_x_p2_l0 != 0)) && ( !(_x_p2_l1 != 0))))))) || ( !((( !(p2_l3 != 0)) && ((p2_l2 != 0) && ((p2_l0 != 0) && (p2_l1 != 0)))) && ((delta == 0.0) && (p2_evt != 0)))))) && ((((_x_v1 == 0) && (( !(_x_p2_l3 != 0)) && (( !(_x_p2_l2 != 0)) && (( !(_x_p2_l0 != 0)) && ( !(_x_p2_l1 != 0)))))) && (((v2 != 0) == (_x_v2 != 0)) && (p2_c == _x_p2_c))) || ( !(((p2_l3 != 0) && (( !(p2_l2 != 0)) && (( !(p2_l0 != 0)) && ( !(p2_l1 != 0))))) && ((delta == 0.0) && (p2_evt != 0)))))) && ((((((((((((((((((((((_x_p1_l3 != 0) && (( !(_x_p1_l2 != 0)) && (( !(_x_p1_l0 != 0)) && ( !(_x_p1_l1 != 0))))) || ((( !(_x_p1_l3 != 0)) && ((_x_p1_l2 != 0) && ((_x_p1_l0 != 0) && (_x_p1_l1 != 0)))) || ((( !(_x_p1_l3 != 0)) && ((_x_p1_l2 != 0) && ((_x_p1_l1 != 0) && ( !(_x_p1_l0 != 0))))) || ((( !(_x_p1_l3 != 0)) && ((_x_p1_l2 != 0) && ((_x_p1_l0 != 0) && ( !(_x_p1_l1 != 0))))) || ((( !(_x_p1_l3 != 0)) && ((_x_p1_l2 != 0) && (( !(_x_p1_l0 != 0)) && ( !(_x_p1_l1 != 0))))) || ((( !(_x_p1_l3 != 0)) && (( !(_x_p1_l2 != 0)) && ((_x_p1_l0 != 0) && (_x_p1_l1 != 0)))) || ((( !(_x_p1_l3 != 0)) && (( !(_x_p1_l2 != 0)) && ((_x_p1_l1 != 0) && ( !(_x_p1_l0 != 0))))) || ((( !(_x_p1_l3 != 0)) && (( !(_x_p1_l2 != 0)) && (( !(_x_p1_l0 != 0)) && ( !(_x_p1_l1 != 0))))) || (( !(_x_p1_l3 != 0)) && (( !(_x_p1_l2 != 0)) && ((_x_p1_l0 != 0) && ( !(_x_p1_l1 != 0))))))))))))) && ((_x_p1_c <= 16.0) || ( !(((( !(_x_p1_l3 != 0)) && (( !(_x_p1_l2 != 0)) && ((_x_p1_l0 != 0) && ( !(_x_p1_l1 != 0))))) || (( !(_x_p1_l3 != 0)) && ((_x_p1_l2 != 0) && (( !(_x_p1_l0 != 0)) && ( !(_x_p1_l1 != 0)))))) || ((( !(_x_p1_l3 != 0)) && ((_x_p1_l2 != 0) && ((_x_p1_l0 != 0) && (_x_p1_l1 != 0)))) || ((_x_p1_l3 != 0) && (( !(_x_p1_l2 != 0)) && (( !(_x_p1_l0 != 0)) && ( !(_x_p1_l1 != 0)))))))))) && ((delta <= 0.0) || ((((((p1_l0 != 0) == (_x_p1_l0 != 0)) && ((p1_l1 != 0) == (_x_p1_l1 != 0))) && ((p1_l2 != 0) == (_x_p1_l2 != 0))) && ((p1_l3 != 0) == (_x_p1_l3 != 0))) && ((delta + (p1_c + (-1.0 * _x_p1_c))) == 0.0)))) && ((p1_evt != 0) || ((((((p1_l0 != 0) == (_x_p1_l0 != 0)) && ((p1_l1 != 0) == (_x_p1_l1 != 0))) && ((p1_l2 != 0) == (_x_p1_l2 != 0))) && ((p1_l3 != 0) == (_x_p1_l3 != 0))) && ((delta + (p1_c + (-1.0 * _x_p1_c))) == 0.0)))) && (((v1 == _x_v1) && (((v1 == 0) && (( !(_x_p1_l3 != 0)) && (( !(_x_p1_l2 != 0)) && ((_x_p1_l0 != 0) && ( !(_x_p1_l1 != 0)))))) && (((v2 != 0) == (_x_v2 != 0)) && (_x_p1_c == 0.0)))) || ( !((( !(p1_l3 != 0)) && (( !(p1_l2 != 0)) && (( !(p1_l0 != 0)) && ( !(p1_l1 != 0))))) && ((delta == 0.0) && (p1_evt != 0)))))) && (((((v2 != 0) == (_x_v2 != 0)) && (_x_p1_c == 0.0)) && ((( !(_x_p1_l3 != 0)) && (( !(_x_p1_l2 != 0)) && ((_x_p1_l1 != 0) && ( !(_x_p1_l0 != 0))))) && (_x_v1 == 2))) || ( !((( !(p1_l3 != 0)) && (( !(p1_l2 != 0)) && ((p1_l0 != 0) && ( !(p1_l1 != 0))))) && ((delta == 0.0) && (p1_evt != 0)))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && (((( !(_x_p1_l3 != 0)) && (( !(_x_p1_l2 != 0)) && (( !(_x_p1_l0 != 0)) && ( !(_x_p1_l1 != 0))))) || (( !(_x_p1_l3 != 0)) && (( !(_x_p1_l2 != 0)) && ((_x_p1_l0 != 0) && (_x_p1_l1 != 0))))) && (p1_c == _x_p1_c))) || ( !((( !(p1_l3 != 0)) && (( !(p1_l2 != 0)) && ((p1_l1 != 0) && ( !(p1_l0 != 0))))) && ((delta == 0.0) && (p1_evt != 0)))))) && (( !(v1 == 2)) || ( !((( !(_x_p1_l3 != 0)) && (( !(_x_p1_l2 != 0)) && (( !(_x_p1_l0 != 0)) && ( !(_x_p1_l1 != 0))))) && ((( !(p1_l3 != 0)) && (( !(p1_l2 != 0)) && ((p1_l1 != 0) && ( !(p1_l0 != 0))))) && ((delta == 0.0) && (p1_evt != 0))))))) && (((v1 == 2) && ( !(p1_c <= 16.0))) || ( !((( !(_x_p1_l3 != 0)) && (( !(_x_p1_l2 != 0)) && ((_x_p1_l0 != 0) && (_x_p1_l1 != 0)))) && ((( !(p1_l3 != 0)) && (( !(p1_l2 != 0)) && ((p1_l1 != 0) && ( !(p1_l0 != 0))))) && ((delta == 0.0) && (p1_evt != 0))))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && ((( !(_x_p1_l3 != 0)) && (( !(_x_p1_l2 != 0)) && (( !(_x_p1_l0 != 0)) && ( !(_x_p1_l1 != 0))))) || (( !(_x_p1_l3 != 0)) && ((_x_p1_l2 != 0) && (( !(_x_p1_l0 != 0)) && ( !(_x_p1_l1 != 0))))))) || ( !((( !(p1_l3 != 0)) && (( !(p1_l2 != 0)) && ((p1_l0 != 0) && (p1_l1 != 0)))) && ((delta == 0.0) && (p1_evt != 0)))))) && (((v2 != 0) && (p1_c == _x_p1_c)) || ( !(((delta == 0.0) && (p1_evt != 0)) && ((( !(_x_p1_l3 != 0)) && (( !(_x_p1_l2 != 0)) && (( !(_x_p1_l0 != 0)) && ( !(_x_p1_l1 != 0))))) && (( !(p1_l3 != 0)) && (( !(p1_l2 != 0)) && ((p1_l0 != 0) && (p1_l1 != 0))))))))) && ((( !(v2 != 0)) && (_x_p1_c == 0.0)) || ( !(((delta == 0.0) && (p1_evt != 0)) && ((( !(p1_l3 != 0)) && (( !(p1_l2 != 0)) && ((p1_l0 != 0) && (p1_l1 != 0)))) && (( !(_x_p1_l3 != 0)) && ((_x_p1_l2 != 0) && (( !(_x_p1_l0 != 0)) && ( !(_x_p1_l1 != 0)))))))))) && ((((_x_v2 != 0) && (( !(_x_p1_l3 != 0)) && ((_x_p1_l2 != 0) && ((_x_p1_l0 != 0) && ( !(_x_p1_l1 != 0)))))) && ((v1 == _x_v1) && (_x_p1_c == 0.0))) || ( !((( !(p1_l3 != 0)) && ((p1_l2 != 0) && (( !(p1_l0 != 0)) && ( !(p1_l1 != 0))))) && ((delta == 0.0) && (p1_evt != 0)))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && ((p1_c == _x_p1_c) && ((( !(_x_p1_l3 != 0)) && (( !(_x_p1_l2 != 0)) && (( !(_x_p1_l0 != 0)) && ( !(_x_p1_l1 != 0))))) || (( !(_x_p1_l3 != 0)) && ((_x_p1_l2 != 0) && ((_x_p1_l1 != 0) && ( !(_x_p1_l0 != 0)))))))) || ( !((( !(p1_l3 != 0)) && ((p1_l2 != 0) && ((p1_l0 != 0) && ( !(p1_l1 != 0))))) && ((delta == 0.0) && (p1_evt != 0)))))) && (( !(v1 == 2)) || ( !(((delta == 0.0) && (p1_evt != 0)) && ((( !(_x_p1_l3 != 0)) && (( !(_x_p1_l2 != 0)) && (( !(_x_p1_l0 != 0)) && ( !(_x_p1_l1 != 0))))) && (( !(p1_l3 != 0)) && ((p1_l2 != 0) && ((p1_l0 != 0) && ( !(p1_l1 != 0)))))))))) && ((v1 == 2) || ( !(((delta == 0.0) && (p1_evt != 0)) && ((( !(p1_l3 != 0)) && ((p1_l2 != 0) && ((p1_l0 != 0) && ( !(p1_l1 != 0))))) && (( !(_x_p1_l3 != 0)) && ((_x_p1_l2 != 0) && ((_x_p1_l1 != 0) && ( !(_x_p1_l0 != 0)))))))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && ((( !(_x_p1_l3 != 0)) && ((_x_p1_l2 != 0) && ((_x_p1_l0 != 0) && (_x_p1_l1 != 0)))) && (_x_p1_c == 0.0))) || ( !((( !(p1_l3 != 0)) && ((p1_l2 != 0) && ((p1_l1 != 0) && ( !(p1_l0 != 0))))) && ((delta == 0.0) && (p1_evt != 0)))))) && ((((v1 == _x_v1) && (_x_p1_c == 0.0)) && (( !(_x_v2 != 0)) && ((_x_p1_l3 != 0) && (( !(_x_p1_l2 != 0)) && (( !(_x_p1_l0 != 0)) && ( !(_x_p1_l1 != 0))))))) || ( !((( !(p1_l3 != 0)) && ((p1_l2 != 0) && ((p1_l0 != 0) && (p1_l1 != 0)))) && ((delta == 0.0) && (p1_evt != 0)))))) && ((((_x_v1 == 0) && (( !(_x_p1_l3 != 0)) && (( !(_x_p1_l2 != 0)) && (( !(_x_p1_l0 != 0)) && ( !(_x_p1_l1 != 0)))))) && (((v2 != 0) == (_x_v2 != 0)) && (p1_c == _x_p1_c))) || ( !(((p1_l3 != 0) && (( !(p1_l2 != 0)) && (( !(p1_l0 != 0)) && ( !(p1_l1 != 0))))) && ((delta == 0.0) && (p1_evt != 0)))))) && ((((((((((((((((((((((_x_p0_l3 != 0) && (( !(_x_p0_l2 != 0)) && (( !(_x_p0_l0 != 0)) && ( !(_x_p0_l1 != 0))))) || ((( !(_x_p0_l3 != 0)) && ((_x_p0_l2 != 0) && ((_x_p0_l0 != 0) && (_x_p0_l1 != 0)))) || ((( !(_x_p0_l3 != 0)) && ((_x_p0_l2 != 0) && ((_x_p0_l1 != 0) && ( !(_x_p0_l0 != 0))))) || ((( !(_x_p0_l3 != 0)) && ((_x_p0_l2 != 0) && ((_x_p0_l0 != 0) && ( !(_x_p0_l1 != 0))))) || ((( !(_x_p0_l3 != 0)) && ((_x_p0_l2 != 0) && (( !(_x_p0_l0 != 0)) && ( !(_x_p0_l1 != 0))))) || ((( !(_x_p0_l3 != 0)) && (( !(_x_p0_l2 != 0)) && ((_x_p0_l0 != 0) && (_x_p0_l1 != 0)))) || ((( !(_x_p0_l3 != 0)) && (( !(_x_p0_l2 != 0)) && ((_x_p0_l1 != 0) && ( !(_x_p0_l0 != 0))))) || ((( !(_x_p0_l3 != 0)) && (( !(_x_p0_l2 != 0)) && (( !(_x_p0_l0 != 0)) && ( !(_x_p0_l1 != 0))))) || (( !(_x_p0_l3 != 0)) && (( !(_x_p0_l2 != 0)) && ((_x_p0_l0 != 0) && ( !(_x_p0_l1 != 0))))))))))))) && ((_x_p0_c <= 16.0) || ( !(((( !(_x_p0_l3 != 0)) && (( !(_x_p0_l2 != 0)) && ((_x_p0_l0 != 0) && ( !(_x_p0_l1 != 0))))) || (( !(_x_p0_l3 != 0)) && ((_x_p0_l2 != 0) && (( !(_x_p0_l0 != 0)) && ( !(_x_p0_l1 != 0)))))) || ((( !(_x_p0_l3 != 0)) && ((_x_p0_l2 != 0) && ((_x_p0_l0 != 0) && (_x_p0_l1 != 0)))) || ((_x_p0_l3 != 0) && (( !(_x_p0_l2 != 0)) && (( !(_x_p0_l0 != 0)) && ( !(_x_p0_l1 != 0)))))))))) && ((delta <= 0.0) || ((((((p0_l0 != 0) == (_x_p0_l0 != 0)) && ((p0_l1 != 0) == (_x_p0_l1 != 0))) && ((p0_l2 != 0) == (_x_p0_l2 != 0))) && ((p0_l3 != 0) == (_x_p0_l3 != 0))) && ((delta + (p0_c + (-1.0 * _x_p0_c))) == 0.0)))) && ((p0_evt != 0) || ((((((p0_l0 != 0) == (_x_p0_l0 != 0)) && ((p0_l1 != 0) == (_x_p0_l1 != 0))) && ((p0_l2 != 0) == (_x_p0_l2 != 0))) && ((p0_l3 != 0) == (_x_p0_l3 != 0))) && ((delta + (p0_c + (-1.0 * _x_p0_c))) == 0.0)))) && (((((( !(_x_p0_l3 != 0)) && (( !(_x_p0_l2 != 0)) && ((_x_p0_l0 != 0) && ( !(_x_p0_l1 != 0))))) && (v1 == 0)) && ((_x_p0_c == 0.0) && ((v2 != 0) == (_x_v2 != 0)))) && (v1 == _x_v1)) || ( !((( !(p0_l3 != 0)) && (( !(p0_l2 != 0)) && (( !(p0_l0 != 0)) && ( !(p0_l1 != 0))))) && ((p0_evt != 0) && (delta == 0.0)))))) && ((((_x_p0_c == 0.0) && ((v2 != 0) == (_x_v2 != 0))) && ((( !(_x_p0_l3 != 0)) && (( !(_x_p0_l2 != 0)) && ((_x_p0_l1 != 0) && ( !(_x_p0_l0 != 0))))) && (_x_v1 == 1))) || ( !((( !(p0_l3 != 0)) && (( !(p0_l2 != 0)) && ((p0_l0 != 0) && ( !(p0_l1 != 0))))) && ((p0_evt != 0) && (delta == 0.0)))))) && (((((( !(_x_p0_l3 != 0)) && (( !(_x_p0_l2 != 0)) && (( !(_x_p0_l0 != 0)) && ( !(_x_p0_l1 != 0))))) || (( !(_x_p0_l3 != 0)) && (( !(_x_p0_l2 != 0)) && ((_x_p0_l0 != 0) && (_x_p0_l1 != 0))))) && (p0_c == _x_p0_c)) && (((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1))) || ( !((( !(p0_l3 != 0)) && (( !(p0_l2 != 0)) && ((p0_l1 != 0) && ( !(p0_l0 != 0))))) && ((p0_evt != 0) && (delta == 0.0)))))) && (( !(v1 == 1)) || ( !((( !(_x_p0_l3 != 0)) && (( !(_x_p0_l2 != 0)) && (( !(_x_p0_l0 != 0)) && ( !(_x_p0_l1 != 0))))) && ((( !(p0_l3 != 0)) && (( !(p0_l2 != 0)) && ((p0_l1 != 0) && ( !(p0_l0 != 0))))) && ((p0_evt != 0) && (delta == 0.0))))))) && (((v1 == 1) && ( !(p0_c <= 16.0))) || ( !((( !(_x_p0_l3 != 0)) && (( !(_x_p0_l2 != 0)) && ((_x_p0_l0 != 0) && (_x_p0_l1 != 0)))) && ((( !(p0_l3 != 0)) && (( !(p0_l2 != 0)) && ((p0_l1 != 0) && ( !(p0_l0 != 0))))) && ((p0_evt != 0) && (delta == 0.0))))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && ((( !(_x_p0_l3 != 0)) && (( !(_x_p0_l2 != 0)) && (( !(_x_p0_l0 != 0)) && ( !(_x_p0_l1 != 0))))) || (( !(_x_p0_l3 != 0)) && ((_x_p0_l2 != 0) && (( !(_x_p0_l0 != 0)) && ( !(_x_p0_l1 != 0))))))) || ( !((( !(p0_l3 != 0)) && (( !(p0_l2 != 0)) && ((p0_l0 != 0) && (p0_l1 != 0)))) && ((p0_evt != 0) && (delta == 0.0)))))) && (((v2 != 0) && (p0_c == _x_p0_c)) || ( !(((p0_evt != 0) && (delta == 0.0)) && ((( !(_x_p0_l3 != 0)) && (( !(_x_p0_l2 != 0)) && (( !(_x_p0_l0 != 0)) && ( !(_x_p0_l1 != 0))))) && (( !(p0_l3 != 0)) && (( !(p0_l2 != 0)) && ((p0_l0 != 0) && (p0_l1 != 0))))))))) && (((_x_p0_c == 0.0) && ( !(v2 != 0))) || ( !(((p0_evt != 0) && (delta == 0.0)) && ((( !(p0_l3 != 0)) && (( !(p0_l2 != 0)) && ((p0_l0 != 0) && (p0_l1 != 0)))) && (( !(_x_p0_l3 != 0)) && ((_x_p0_l2 != 0) && (( !(_x_p0_l0 != 0)) && ( !(_x_p0_l1 != 0)))))))))) && ((((_x_v2 != 0) && (( !(_x_p0_l3 != 0)) && ((_x_p0_l2 != 0) && ((_x_p0_l0 != 0) && ( !(_x_p0_l1 != 0)))))) && ((_x_p0_c == 0.0) && (v1 == _x_v1))) || ( !((( !(p0_l3 != 0)) && ((p0_l2 != 0) && (( !(p0_l0 != 0)) && ( !(p0_l1 != 0))))) && ((p0_evt != 0) && (delta == 0.0)))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && ((p0_c == _x_p0_c) && ((( !(_x_p0_l3 != 0)) && (( !(_x_p0_l2 != 0)) && (( !(_x_p0_l0 != 0)) && ( !(_x_p0_l1 != 0))))) || (( !(_x_p0_l3 != 0)) && ((_x_p0_l2 != 0) && ((_x_p0_l1 != 0) && ( !(_x_p0_l0 != 0)))))))) || ( !((( !(p0_l3 != 0)) && ((p0_l2 != 0) && ((p0_l0 != 0) && ( !(p0_l1 != 0))))) && ((p0_evt != 0) && (delta == 0.0)))))) && (( !(v1 == 1)) || ( !(((p0_evt != 0) && (delta == 0.0)) && ((( !(_x_p0_l3 != 0)) && (( !(_x_p0_l2 != 0)) && (( !(_x_p0_l0 != 0)) && ( !(_x_p0_l1 != 0))))) && (( !(p0_l3 != 0)) && ((p0_l2 != 0) && ((p0_l0 != 0) && ( !(p0_l1 != 0)))))))))) && ((v1 == 1) || ( !(((p0_evt != 0) && (delta == 0.0)) && ((( !(p0_l3 != 0)) && ((p0_l2 != 0) && ((p0_l0 != 0) && ( !(p0_l1 != 0))))) && (( !(_x_p0_l3 != 0)) && ((_x_p0_l2 != 0) && ((_x_p0_l1 != 0) && ( !(_x_p0_l0 != 0)))))))))) && (((((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)) && ((( !(_x_p0_l3 != 0)) && ((_x_p0_l2 != 0) && ((_x_p0_l0 != 0) && (_x_p0_l1 != 0)))) && (_x_p0_c == 0.0))) || ( !((( !(p0_l3 != 0)) && ((p0_l2 != 0) && ((p0_l1 != 0) && ( !(p0_l0 != 0))))) && ((p0_evt != 0) && (delta == 0.0)))))) && ((((_x_p0_c == 0.0) && (v1 == _x_v1)) && (((_x_p0_l3 != 0) && (( !(_x_p0_l2 != 0)) && (( !(_x_p0_l0 != 0)) && ( !(_x_p0_l1 != 0))))) && ( !(_x_v2 != 0)))) || ( !((( !(p0_l3 != 0)) && ((p0_l2 != 0) && ((p0_l0 != 0) && (p0_l1 != 0)))) && ((p0_evt != 0) && (delta == 0.0)))))) && ((((( !(_x_p0_l3 != 0)) && (( !(_x_p0_l2 != 0)) && (( !(_x_p0_l0 != 0)) && ( !(_x_p0_l1 != 0))))) && (_x_v1 == 0)) && (((v2 != 0) == (_x_v2 != 0)) && (p0_c == _x_p0_c))) || ( !(((p0_l3 != 0) && (( !(p0_l2 != 0)) && (( !(p0_l0 != 0)) && ( !(p0_l1 != 0))))) && ((p0_evt != 0) && (delta == 0.0)))))) && ((((_x_v1 == 14) || ((_x_v1 == 13) || ((_x_v1 == 12) || ((_x_v1 == 11) || ((_x_v1 == 10) || ((_x_v1 == 9) || ((_x_v1 == 8) || ((_x_v1 == 7) || ((_x_v1 == 6) || ((_x_v1 == 5) || ((_x_v1 == 4) || ((_x_v1 == 3) || ((_x_v1 == 2) || ((_x_v1 == 1) || (_x_v1 == 0))))))))))))))) && (0.0 <= _x_delta)) && ((delta <= 0.0) || (((v2 != 0) == (_x_v2 != 0)) && (v1 == _x_v1)))))))))))))))))) && (( !(( !(p13_evt != 0)) && (( !(p12_evt != 0)) && (( !(p11_evt != 0)) && (( !(p10_evt != 0)) && (( !(p9_evt != 0)) && (( !(p8_evt != 0)) && (( !(p7_evt != 0)) && (( !(p6_evt != 0)) && (( !(p5_evt != 0)) && (( !(p4_evt != 0)) && (( !(p3_evt != 0)) && (( !(p2_evt != 0)) && (( !(p0_evt != 0)) && ( !(p1_evt != 0)))))))))))))))) || ( !(delta == 0.0)))) && (((delta == _x__diverge_delta) || ( !(1.0 <= _diverge_delta))) && ((1.0 <= _diverge_delta) || ((delta + (_diverge_delta + (-1.0 * _x__diverge_delta))) == 0.0))));
p12_l3 = _x_p12_l3;
p12_l2 = _x_p12_l2;
p12_l1 = _x_p12_l1;
_diverge_delta = _x__diverge_delta;
p12_l0 = _x_p12_l0;
p12_evt = _x_p12_evt;
p12_c = _x_p12_c;
p10_l3 = _x_p10_l3;
p10_l2 = _x_p10_l2;
p10_l1 = _x_p10_l1;
p10_l0 = _x_p10_l0;
p10_evt = _x_p10_evt;
p10_c = _x_p10_c;
p3_l3 = _x_p3_l3;
p3_evt = _x_p3_evt;
p0_l2 = _x_p0_l2;
p8_l3 = _x_p8_l3;
p0_l1 = _x_p0_l1;
p2_l3 = _x_p2_l3;
p2_evt = _x_p2_evt;
delta = _x_delta;
v1 = _x_v1;
v2 = _x_v2;
p8_c = _x_p8_c;
p0_l3 = _x_p0_l3;
p8_evt = _x_p8_evt;
p8_l2 = _x_p8_l2;
p13_evt = _x_p13_evt;
p4_evt = _x_p4_evt;
p1_c = _x_p1_c;
p9_l3 = _x_p9_l3;
p3_l2 = _x_p3_l2;
p6_l3 = _x_p6_l3;
p1_l3 = _x_p1_l3;
p0_l0 = _x_p0_l0;
p8_l1 = _x_p8_l1;
p1_evt = _x_p1_evt;
p13_l2 = _x_p13_l2;
p1_l1 = _x_p1_l1;
p7_l3 = _x_p7_l3;
p4_l2 = _x_p4_l2;
p13_l3 = _x_p13_l3;
p1_l2 = _x_p1_l2;
p4_l3 = _x_p4_l3;
p11_c = _x_p11_c;
p5_c = _x_p5_c;
p11_evt = _x_p11_evt;
p2_c = _x_p2_c;
p5_evt = _x_p5_evt;
p11_l0 = _x_p11_l0;
p0_c = _x_p0_c;
p5_l0 = _x_p5_l0;
p11_l1 = _x_p11_l1;
p2_l0 = _x_p2_l0;
p0_evt = _x_p0_evt;
p5_l1 = _x_p5_l1;
p11_l2 = _x_p11_l2;
p2_l1 = _x_p2_l1;
p5_l2 = _x_p5_l2;
p11_l3 = _x_p11_l3;
p2_l2 = _x_p2_l2;
p5_l3 = _x_p5_l3;
p9_l0 = _x_p9_l0;
p6_l0 = _x_p6_l0;
p9_l1 = _x_p9_l1;
p3_l0 = _x_p3_l0;
p6_l1 = _x_p6_l1;
p9_l2 = _x_p9_l2;
p3_l1 = _x_p3_l1;
p6_l2 = _x_p6_l2;
p7_c = _x_p7_c;
p13_c = _x_p13_c;
p4_c = _x_p4_c;
p7_evt = _x_p7_evt;
p7_l0 = _x_p7_l0;
p13_l0 = _x_p13_l0;
p4_l0 = _x_p4_l0;
p7_l1 = _x_p7_l1;
p13_l1 = _x_p13_l1;
p1_l0 = _x_p1_l0;
p4_l1 = _x_p4_l1;
p7_l2 = _x_p7_l2;
p8_l0 = _x_p8_l0;
p6_c = _x_p6_c;
p9_c = _x_p9_c;
p3_c = _x_p3_c;
p6_evt = _x_p6_evt;
p9_evt = _x_p9_evt;
}
}
|
the_stack_data/25687.c | /*
Package: dyncall
Library: test
File: test/hacking-arm-thumb-interwork/test.c
Description:
License:
Copyright (c) 2011 Daniel Adler <[email protected]>,
Tassilo Philipp <[email protected]>
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <stddef.h>
#include <stdio.h>
void arm();
void thumb();
int main(int argc, char* argv[])
{
arm();
thumb();
printf("arm: %d\n", (ptrdiff_t) &arm);
printf("thumb: %d\n", (ptrdiff_t) &thumb);
return 0;
}
|
the_stack_data/1062698.c | /* Use pipes to sum N rows concurrently. */
#include <stdio.h>
#include <stdlib.h>
#define N 3
int add_vector(int v[]);
void error_exit(char *s);
int fork(void);
int pipe(int pd[2]);
int read(int fd, void *buf, unsigned len);
int write(int fd, void *buf, unsigned len);
int main(void)
{
int a[N][N] = {{1, 1, 1}, {2, 2, 2}, {3, 3, 3}},
i, row_sum, sum = 0,
pd[2]; /* pipe descriptors */
if (pipe(pd) == -1) /* create a pipe */
error_exit("pipe() failed");
for (i = 0; i < N; ++i)
if (fork() == 0) { /* child process */
row_sum = add_vector(a[i]);
if (write(pd[1], &row_sum, sizeof(int)) == -1)
error_exit("write() failed");
return 0; /* return from child */
}
for (i = 0; i < N; ++i) {
if (read(pd[0], &row_sum, sizeof(int)) == -1)
error_exit("read() failed");
sum += row_sum;
}
printf("Sum of the array = %d\n", sum);
return 0;
}
int add_vector(int v[])
{
int i, vector_sum = 0;
for (i = 0; i < N; ++i)
vector_sum += v[i];
return vector_sum;
}
void error_exit(char *s)
{
fprintf(stderr, "\nERROR: %s - bye!\n", s);
exit(1);
}
|
the_stack_data/59513622.c | /*
* C version of Marsaglia's UNI random number generator
* More or less transliterated from the Fortran -- with 1 bug fix
* Hence horrible style
*
* Features:
* ANSI C
* not callable from Fortran (yet)
*/
/*
* Global variables for rstart & uni
*/
#include <stdio.h>
#include <stdlib.h>
float uni_u[98]; /* Was U(97) in Fortran version -- too lazy to fix */
float uni_c, uni_cd, uni_cm;
int uni_ui, uni_uj;
float uni(void)
{
float luni; /* local variable for uni */
luni = uni_u[uni_ui] - uni_u[uni_uj];
if (luni < 0.0)
luni += 1.0;
uni_u[uni_ui] = luni;
if (--uni_ui == 0)
uni_ui = 97;
if (--uni_uj == 0)
uni_uj = 97;
if ((uni_c -= uni_cd) < 0.0)
uni_c += uni_cm;
if ((luni -= uni_c) < 0.0)
luni += 1.0;
return (float) luni;
}
void rstart(int i, int j, int k, int l)
{
int ii, jj, m;
float s, t;
for (ii = 1; ii <= 97; ii++) {
s = 0.0;
t = 0.5;
for (jj = 1; jj <= 24; jj++) {
m = ((i*j % 179) * k) % 179;
i = j;
j = k;
k = m;
l = (53*l+1) % 169;
if (l*m % 64 >= 32)
s += t;
t *= 0.5;
}
uni_u[ii] = s;
}
uni_c = 362436.0 / 16777216.0;
uni_cd = 7654321.0 / 16777216.0;
uni_cm = 16777213.0 / 16777216.0;
uni_ui = 97; /* There is a bug in the original Fortran version */
uni_uj = 33; /* of UNI -- i and j should be SAVEd in UNI() */
}
/* ~rinit: this takes a single integer in the range
0 <= ijkl <= 900 000 000
and produces the four smaller integers needed for rstart. It is
* based on the ideas contained in the RMARIN subroutine in
* F. James, "A Review of Pseudorandom Number Generators",
* Comp. Phys. Commun. Oct 1990, p.340
* To reduce the modifications to the existing code, rinit now
* takes the role of a preprocessor for rstart.
*
* This is useful for the parallel version of the code as James
* states that any integer ijkl will produce a statistically
* independent sequence of random numbers.
*
* Very funny. If that statement was worth anything he would have provided
* a proof to go with it. spb 12/12/90
*/
void rinit(int ijkl)
{
int i, j, k, l, ij, kl;
/* check ijkl is within range */
if( (ijkl < 0) || (ijkl > 900000000) )
{
printf("rinit: ijkl = %d -- out of range\n\n", ijkl);
exit(3);
}
/* printf("rinit: seed_ijkl = %d\n", ijkl); */
/* decompose the long integer into the the equivalent four
* integers for rstart. This should be a 1-1 mapping
* ijkl <--> (i, j, k, l)
* though not quite all of the possible sets of (i, j, k, l)
* can be produced.
*/
ij = ijkl/30082;
kl = ijkl - (30082 * ij);
i = ((ij/177) % 177) + 2;
j = (ij % 177) + 2;
k = ((kl/169) % 178) + 1;
l = kl % 169;
if( (i <= 0) || (i > 178) )
{
printf("rinit: i = %d -- out of range\n\n", i);
exit(3);
}
if( (j <= 0) || (j > 178) )
{
printf("rinit: j = %d -- out of range\n\n", j);
exit(3);
}
if( (k <= 0) || (k > 178) )
{
printf("rinit: k = %d -- out of range\n\n", k);
exit(3);
}
if( (l < 0) || (l > 168) )
{
printf("rinit: l = %d -- out of range\n\n", l);
exit(3);
}
if (i == 1 && j == 1 && k == 1)
{
printf("rinit: 1 1 1 not allowed for 1st 3 seeds\n\n");
exit(4);
}
/* printf("rinit: initialising RNG via rstart(%d, %d, %d, %d)\n",
i, j, k, l); */
rstart(i, j, k, l);
}
|
the_stack_data/161081843.c | #include <pthread.h>
#include <stdio.h>
#include <unistd.h>
#include <assert.h>
#include <sys/time.h>
pthread_mutex_t m;
void *f( void *a )
{
struct timeval tp;
assert( !gettimeofday( &tp, NULL ) );
assert( !pthread_mutex_lock( &m ) );
assert( !gettimeofday( &tp, NULL ) );
sleep( 1 );
assert( !gettimeofday( &tp, NULL ) );
assert( !pthread_mutex_unlock( &m ) );
assert( !gettimeofday( &tp, NULL ) );
return a;
}
int main( int argc, char **argv )
{
pthread_t t;
struct timeval tp;
assert( !gettimeofday( &tp, NULL ) );
assert( !pthread_mutex_init( &m, NULL ) );
assert( !pthread_create( &t, NULL, f, NULL ) );
assert( !gettimeofday( &tp, NULL ) );
assert( !pthread_mutex_lock( &m ) );
assert( !gettimeofday( &tp, NULL ) );
sleep( 1 );
assert( !gettimeofday( &tp, NULL ) );
assert( !pthread_mutex_unlock( &m ) );
assert( !gettimeofday( &tp, NULL ) );
assert( !pthread_join( t, NULL ) );
return 0;
}
|
the_stack_data/150140169.c | /*
* Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <cuda.h>
#include <errno.h>
#include <stdio.h>
#include <sys/types.h>
char VERSION[] = "2.0.1";
int verboseLogging = 1;
#define CU_CHECK_ERROR(command, string, ...) \
do \
{ \
CUresult cceResult = (command); \
if (verboseLogging) \
printf("%s: line %d: Calling %s\n", getCurrentDateAndTimeMs(), __LINE__, #command); \
if (cceResult != CUDA_SUCCESS) \
{ \
fprintf(stderr, "ERROR %d: " string "\n", __LINE__, ##__VA_ARGS__); \
fprintf(stderr, " '%s' returned %d\n", #command, cceResult); \
return 1; \
} \
} while (0)
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define ROUND_UP(x, n) (((x) + ((n)-1)) & ~((n)-1))
#define MAX_GPUS 64
#define ASSERT(cond, string, ...) \
do \
{ \
if (!(cond)) \
{ \
fprintf(stderr, "ERROR %d: Condition %s failed : " string "\n", __LINE__, #cond, ##__VA_ARGS__); \
exit(1); \
} \
} while (0)
typedef struct
{
unsigned int year;
unsigned int month; // 1-12
unsigned int dayOfMonth; // 1-31
unsigned int dayOfWeek; // 0-6
unsigned int hour; // 0-23
unsigned int min; // 0-59
unsigned int sec; // 0-59
unsigned int msec; // 0-999
} localTime_t;
#if defined(_WIN32)
#include <windows.h>
static double second(void)
{
LARGE_INTEGER t;
static double oofreq;
static int checkedForHighResTimer;
static BOOL hasHighResTimer;
if (!checkedForHighResTimer)
{
hasHighResTimer = QueryPerformanceFrequency(&t);
oofreq = 1.0 / (double)t.QuadPart;
checkedForHighResTimer = 1;
}
if (hasHighResTimer)
{
QueryPerformanceCounter(&t);
return (double)t.QuadPart * oofreq;
}
else
{
return (double)GetTickCount() / 1000.0;
}
}
void getLocalTime(localTime_t *localTime)
{
SYSTEMTIME winTime;
GetLocalTime(&winTime);
localTime->year = winTime.wYear;
localTime->month = winTime.wMonth;
localTime->dayOfMonth = winTime.wDay;
localTime->dayOfWeek = winTime.wDayOfWeek;
localTime->hour = winTime.wHour;
localTime->min = winTime.wMinute;
localTime->sec = winTime.wSecond;
localTime->msec = winTime.wMilliseconds;
}
void mySleep(unsigned int msec)
{
Sleep(msec);
}
#elif defined(__linux__) || defined(__APPLE__)
#include <stddef.h>
#include <sys/time.h>
#include <time.h>
static double second(void)
{
struct timeval tv;
gettimeofday(&tv, NULL);
return (double)tv.tv_sec + (double)tv.tv_usec / 1000000.0;
}
void getLocalTime(localTime_t *localTime)
{
struct tm ttm;
struct timeval timev;
gettimeofday(&timev, NULL);
// This is a hack which "just works": cast the seconds field of the timeval
// struct to a time_t
localtime_r((time_t *)&timev.tv_sec, &ttm);
localTime->year = ttm.tm_year + 1900;
localTime->month = ttm.tm_mon + 1;
localTime->dayOfMonth = ttm.tm_mday;
localTime->dayOfWeek = ttm.tm_wday;
localTime->hour = ttm.tm_hour;
localTime->min = ttm.tm_min;
localTime->sec = ttm.tm_sec;
localTime->msec = timev.tv_usec / 1000;
}
void mySleep(unsigned int msec)
{
struct timespec t_req, t_rem;
int ret = 0;
t_req.tv_sec = msec / 1000;
t_req.tv_nsec = (msec % 1000) * 1000000;
ret = nanosleep(&t_req, &t_rem);
// if interrupted by a non-blocked signal
// copy remaining time to the requested time
while (ret != 0 && errno == EINTR)
{
t_req = t_rem;
ret = nanosleep(&t_req, &t_rem);
}
}
#else
#error unsupported platform
#endif
char *getCurrentDateAndTimeMs(void)
{
localTime_t time;
static char buff[128];
// Get the local time
getLocalTime(&time);
sprintf(buff,
"%u/%02u/%02u %02u:%02u:%02u.%03u",
time.year,
time.month,
time.dayOfMonth,
time.hour,
time.min,
time.sec,
time.msec);
return buff;
}
void usage(int code, char *name)
{
printf(
"\n"
"\n Version %s"
"\n"
"\n Usage %s [-h | --help] [list of commands]"
"\n --ctxCreate,-i <pci bus id>"
"\n --ctxDestroy <pci bus id>"
"\n"
"\n --cuMemAlloc <pci bus id> <size in MB>"
"\n Also frees previous memory buffer before allocating new one."
"\n Requires ctxCreate"
"\n --cuMemFree <pci bus id>"
"\n"
"\n --busyGpu <pci bus id> <ms>"
"\n Runs kernel that causes 100%% gpu & memory utilization (allocates some memory)"
"\n Requires ctxCreate"
"\n"
"\n --assertGpu <pci bus id> <ms>"
"\n Runs kernel and intentionally asserts it as false to generate and XID 43 error (allocates some memory)"
"\n Requires ctxCreate"
"\n"
"\n --busyIter <pci bus id> <num iterations>"
"\n Runs kernel for specified number of iterations that causes 100%% gpu & memory utilization (allocates some memory)"
"\n Requires ctxCreate"
"\n"
"\n --getchar"
"\n pauses application till <enter> is passed"
"\n --sleep <ms>"
"\n"
"\n Notes:"
"\n Order of flags matter!"
"\n Flags are executed from left to right and can be repeat."
"\n"
"\n EXAMPLE:"
"\n ./cuda_ctx_create_64bit --ctxCreate 0:6:0 --cuMemAlloc 0:6:0 100 --cuMemFree 0:6:0 --ctxDestroy 0:6:0"
"\n --ctxCreate 0:6:0 --cuMemAlloc 0:6:0 200 --cuMemFree 0:6:0 --busyGpu 0:6:0 10000"
"\n --ctxCreate 0:6:0 --cuMemAlloc 0:6:0 200 --cuMemFree 0:6:0 --busyIter 0:6:0 100"
"\n --sleep 1000 --ctxDestroy 0:6:0"
"\n"
"\n",
VERSION,
name);
exit(code);
}
int main(int argc, char **argv)
{
CUcontext ctx[MAX_GPUS] = { 0 };
CUdeviceptr ptr[MAX_GPUS] = { 0 };
int i;
// set unbuffered output, no flushing required
setvbuf(stdout, NULL, _IONBF, 0);
setvbuf(stderr, NULL, _IONBF, 0);
printf("My PID: %u\n", getpid());
CU_CHECK_ERROR(cuInit(0), "cuInit failed");
for (i = 1; i < argc; i++)
{
printf("%s: Processing %s\n", getCurrentDateAndTimeMs(), argv[i]);
if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0)
usage(0, argv[0]);
else if (strcmp(argv[i], "-i") == 0 || strcmp(argv[i], "--ctxCreate") == 0)
{
int device;
i++;
CU_CHECK_ERROR(cuDeviceGetByPCIBusId(&device, argv[i]), "Bus id %s not matched", argv[i]);
ASSERT(ctx[device] == NULL, "Previous ctx hasn't been destroyed on this device");
CU_CHECK_ERROR(cuCtxCreate(&ctx[device], 0, device), "could not create context on CUDA device %d", device);
printf("Context created\n");
}
else if (strcmp(argv[i], "--ctxDestroy") == 0)
{
int device;
i++;
CU_CHECK_ERROR(cuDeviceGetByPCIBusId(&device, argv[i]), "Bus id %s not matched", argv[i]);
ASSERT(ctx[device] != NULL, "No ctx was created on this device");
CU_CHECK_ERROR(cuCtxDestroy(ctx[device]), "couldn't destroy context on CUDA device %d", device);
ctx[device] = NULL;
ASSERT(!ptr[device], "There's unfreed memory");
}
else if (strcmp(argv[i], "--busyGpu") == 0)
{
CUfunction kernel;
CUmodule mod;
int device;
CUdeviceptr ptr;
size_t items = 1024 * 1024 * 10;
int iterations = 100;
float ms;
double start, stop, lastSyncSec, prevLastSyncSec;
int pass = 0;
int passMod = 1; /* Maximum of 128 */
CU_CHECK_ERROR(cuDeviceGetByPCIBusId(&device, argv[++i]), "Bus id %s not matched", argv[i]);
ms = atoi(argv[++i]);
ASSERT(ctx[device] != NULL, "No ctx was created on this device");
CU_CHECK_ERROR(cuCtxPushCurrent(ctx[device]), "");
#if _WIN64 || __amd64__
CU_CHECK_ERROR(cuModuleLoad(&mod, "busy_gpu64.ptx"), "couldn't load busy_gpu.ptx module");
#elif __powerpc64__
CU_CHECK_ERROR(cuModuleLoad(&mod, "busy_gpu_ppc64le.ptx"), "couldn't load busy_gpu.ptx module");
#elif __aarch64__
CU_CHECK_ERROR(cuModuleLoad(&mod, "busy_gpu_aarch64.ptx"), "couldn't load busy_gpu.ptx module");
#else
CU_CHECK_ERROR(cuModuleLoad(&mod, "busy_gpu32.ptx"), "couldn't load busy_gpu.ptx module");
#endif
CU_CHECK_ERROR(cuModuleGetFunction(&kernel, mod, "make_gpu_busy"), "couldn't load busy_gpu.ptx module");
CU_CHECK_ERROR(cuMemAlloc(&ptr, items * sizeof(int)), "Failed to allocate memory");
CU_CHECK_ERROR(cuMemsetD32(ptr, 12345, items), "");
{
int offset = 0;
CU_CHECK_ERROR(cuParamSetv(kernel, offset, &ptr, sizeof(void *)), "");
offset = ROUND_UP(offset + sizeof(void *), sizeof(void *));
CU_CHECK_ERROR(cuParamSetv(kernel, offset, &items, sizeof(size_t)), "");
offset = ROUND_UP(offset + sizeof(size_t), sizeof(size_t));
CU_CHECK_ERROR(cuParamSetv(kernel, offset, &iterations, sizeof(int)), "");
offset += sizeof(int);
CU_CHECK_ERROR(cuParamSetSize(kernel, offset), "");
CU_CHECK_ERROR(cuFuncSetBlockShape(kernel, 256, 1, 1), "");
}
start = second();
prevLastSyncSec = start;
do
{
CU_CHECK_ERROR(cuLaunchGridAsync(kernel, 1024, 1, 0), "");
pass++;
if (pass % passMod == 0) // Synchronize every passMod passes
{
CU_CHECK_ERROR(cuCtxSynchronize(), "");
lastSyncSec = second();
/* We want passes before synchronization to take between .5 and 1 second, so stop doubling after .25
* seconds */
if (lastSyncSec - prevLastSyncSec < 0.25)
{
passMod = MIN(128, passMod * 2);
// printf("diff: %f, passMod %d\n", lastSyncSec - prevLastSyncSec, passMod);
}
prevLastSyncSec = lastSyncSec;
}
stop = second();
verboseLogging = 0;
} while ((stop - start) < ms / 1000);
verboseLogging = 1;
CU_CHECK_ERROR(cuCtxSynchronize(), "");
printf("passes %d\n", pass);
CU_CHECK_ERROR(cuMemFree(ptr), "");
CU_CHECK_ERROR(cuModuleUnload(mod), "");
{
CUcontext tmp;
CU_CHECK_ERROR(cuCtxPopCurrent(&tmp), "");
}
}
else if (strcmp(argv[i], "--assertGpu") == 0)
{
CUfunction kernel;
CUmodule mod;
int device;
CUdeviceptr ptr;
size_t items = 1024 * 1024 * 10;
int iterations = 100;
int pass = 0;
CU_CHECK_ERROR(cuDeviceGetByPCIBusId(&device, argv[++i]), "Bus id %s not matched", argv[i]);
ASSERT(ctx[device] != NULL, "No ctx was created on this device");
CU_CHECK_ERROR(cuCtxPushCurrent(ctx[device]), "");
CU_CHECK_ERROR(cuModuleLoad(&mod, "cuda_assert.ptx"), "couldn't load cuda_assert.ptx module");
CU_CHECK_ERROR(cuModuleGetFunction(&kernel, mod, "make_assert"), "couldn't load busy_gpu.ptx module");
CU_CHECK_ERROR(cuMemAlloc(&ptr, items * sizeof(int)), "Failed to allocate memory");
CU_CHECK_ERROR(cuMemsetD32(ptr, 12345, items), "");
{
int offset = 0;
CU_CHECK_ERROR(cuParamSetv(kernel, offset, &ptr, sizeof(void *)), "");
offset = ROUND_UP(offset + sizeof(void *), sizeof(void *));
CU_CHECK_ERROR(cuParamSetv(kernel, offset, &items, sizeof(size_t)), "");
offset = ROUND_UP(offset + sizeof(size_t), sizeof(size_t));
CU_CHECK_ERROR(cuParamSetv(kernel, offset, &iterations, sizeof(int)), "");
offset += sizeof(int);
CU_CHECK_ERROR(cuParamSetSize(kernel, offset), "");
CU_CHECK_ERROR(cuFuncSetBlockShape(kernel, 256, 1, 1), "");
}
CU_CHECK_ERROR(cuLaunchGridAsync(kernel, 1, 1, 0), "");
verboseLogging = 1;
CU_CHECK_ERROR(cuCtxSynchronize(), "");
printf("passes %d\n", pass);
CU_CHECK_ERROR(cuMemFree(ptr), "");
CU_CHECK_ERROR(cuModuleUnload(mod), "");
{
CUcontext tmp;
CU_CHECK_ERROR(cuCtxPopCurrent(&tmp), "");
}
}
else if (strcmp(argv[i], "--busyIter") == 0)
{
CUfunction kernel;
CUmodule mod;
int device;
CUdeviceptr ptr;
size_t items = 1024 * 1024 * 10;
int iterations;
int pass = 0;
int passMod = 2; // Synchronize every 2 iterations to avoid any issues with slower GPUs
CU_CHECK_ERROR(cuDeviceGetByPCIBusId(&device, argv[++i]), "Bus id %s not matched", argv[i]);
iterations = atoi(argv[++i]);
ASSERT(ctx[device] != NULL, "No ctx was created on this device");
CU_CHECK_ERROR(cuCtxPushCurrent(ctx[device]), "");
#if _WIN64 || __amd64__
CU_CHECK_ERROR(cuModuleLoad(&mod, "busy_gpu64.ptx"), "couldn't load busy_gpu.ptx module");
#elif __powerpc64__
CU_CHECK_ERROR(cuModuleLoad(&mod, "busy_gpu_ppc64le.ptx"), "couldn't load busy_gpu.ptx module");
#else
CU_CHECK_ERROR(cuModuleLoad(&mod, "busy_gpu32.ptx"), "couldn't load busy_gpu.ptx module");
#endif
CU_CHECK_ERROR(cuModuleGetFunction(&kernel, mod, "make_gpu_busy"), "couldn't load busy_gpu.ptx module");
CU_CHECK_ERROR(cuMemAlloc(&ptr, items * sizeof(int)), "Failed to allocate memory");
CU_CHECK_ERROR(cuMemsetD32(ptr, 12345, items), "");
{
int offset = 0;
CU_CHECK_ERROR(cuParamSetv(kernel, offset, &ptr, sizeof(void *)), "");
offset = ROUND_UP(offset + sizeof(void *), sizeof(void *));
CU_CHECK_ERROR(cuParamSetv(kernel, offset, &items, sizeof(size_t)), "");
offset = ROUND_UP(offset + sizeof(size_t), sizeof(size_t));
CU_CHECK_ERROR(cuParamSetv(kernel, offset, &iterations, sizeof(int)), "");
offset += sizeof(int);
CU_CHECK_ERROR(cuParamSetSize(kernel, offset), "");
CU_CHECK_ERROR(cuFuncSetBlockShape(kernel, 256, 1, 1), "");
}
do
{
CU_CHECK_ERROR(cuLaunchGridAsync(kernel, 1024, 1, 0), "");
pass++;
if (pass % passMod == 0) // Synchronize every passMod passes
{
CU_CHECK_ERROR(cuCtxSynchronize(), "");
}
verboseLogging = 0;
} while (pass < iterations);
verboseLogging = 1;
CU_CHECK_ERROR(cuCtxSynchronize(), "");
printf("passes %d\n", pass);
CU_CHECK_ERROR(cuMemFree(ptr), "");
CU_CHECK_ERROR(cuModuleUnload(mod), "");
{
CUcontext tmp;
CU_CHECK_ERROR(cuCtxPopCurrent(&tmp), "");
}
}
else if (strcmp(argv[i], "--cuMemAlloc") == 0)
{
int device;
size_t size;
CU_CHECK_ERROR(cuDeviceGetByPCIBusId(&device, argv[++i]), "Bus id %s not matched", argv[i]);
size = atoi(argv[++i]) * 1024 * 1024;
ASSERT(ctx[device] != NULL, "No ctx was created on this device");
CU_CHECK_ERROR(cuCtxPushCurrent(ctx[device]), "");
if (ptr[device])
CU_CHECK_ERROR(cuMemFree(ptr[device]), "");
CU_CHECK_ERROR(cuMemAlloc(&ptr[device], size), "Failed to allocate memory");
{
CUcontext tmp;
CU_CHECK_ERROR(cuCtxPopCurrent(&tmp), "");
}
}
else if (strcmp(argv[i], "--cuMemFree") == 0)
{
int device;
CU_CHECK_ERROR(cuDeviceGetByPCIBusId(&device, argv[++i]), "Bus id %s not matched", argv[i]);
ASSERT(ctx[device] != NULL, "No ctx was created on this device");
CU_CHECK_ERROR(cuCtxPushCurrent(ctx[device]), "");
CU_CHECK_ERROR(cuMemFree(ptr[device]), "");
ptr[device] = 0;
{
CUcontext tmp;
CU_CHECK_ERROR(cuCtxPopCurrent(&tmp), "");
}
}
else if (strcmp(argv[i], "--sleep") == 0)
{
int ms = atoi(argv[++i]);
printf("Sleeping for %d ms\n", ms);
mySleep(ms);
}
else if (strcmp(argv[i], "--getchar") == 0)
{
printf("Waiting for new line char\n");
getchar();
}
else
{
ASSERT(0, "Unrecognized command %s", argv[i]);
}
}
printf("%s: Terminating application.\n", getCurrentDateAndTimeMs());
return 0;
}
|
the_stack_data/64201420.c | /*
* Copyright (c) 2014-2016 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
/******************************************************************************
* wlan_logging_sock_svc.c
*
******************************************************************************/
#ifdef WLAN_LOGGING_SOCK_SVC_ENABLE
#include <linux/rtc.h>
#include <vmalloc.h>
#include <wlan_nlink_srv.h>
#include <vos_status.h>
#include <vos_trace.h>
#include <wlan_nlink_common.h>
#include <wlan_logging_sock_svc.h>
#include <vos_types.h>
#include <kthread.h>
#include "vos_memory.h"
#include <linux/ratelimit.h>
#include <asm/arch_timer.h>
#include <vos_utils.h>
#define LOGGING_TRACE(level, args...) \
VOS_TRACE(VOS_MODULE_ID_SVC, level, ## args)
/* Global variables */
#define ANI_NL_MSG_LOG_TYPE 89
#define ANI_NL_MSG_READY_IND_TYPE 90
#define ANI_NL_MSG_LOG_PKT_TYPE 91
#define ANI_NL_MSG_FW_LOG_PKT_TYPE 92
#define INVALID_PID -1
#define MAX_PKTSTATS_LOG_LENGTH 2048
#define MAX_LOGMSG_LENGTH 4096
#define LOGGER_MGMT_DATA_PKT_POST 0x001
#define HOST_LOG_POST 0x002
#define LOGGER_FW_LOG_PKT_POST 0x003
#define LOGGER_FATAL_EVENT_POST 0x004
#define LOGGER_FW_MEM_DUMP_PKT_POST 0x005
#define LOGGER_FW_MEM_DUMP_PKT_POST_DONE 0x006
#define HOST_PKT_STATS_POST 0x008
#define LOGGER_MAX_DATA_MGMT_PKT_Q_LEN (8)
#define LOGGER_MAX_FW_LOG_PKT_Q_LEN (16)
#define LOGGER_MAX_FW_MEM_DUMP_PKT_Q_LEN (32)
#define NL_BDCAST_RATELIMIT_INTERVAL (5*HZ)
#define NL_BDCAST_RATELIMIT_BURST 1
#define PTT_MSG_DIAG_CMDS_TYPE 0x5050
#define DIAG_TYPE_LOGS 1
/* Limit FW initiated fatal event to ms */
#define LIMIT_FW_FATAL_EVENT_MS 10000
/* Qtimer Frequency */
#define QTIMER_FREQ 19200000
static DEFINE_RATELIMIT_STATE(errCnt, \
NL_BDCAST_RATELIMIT_INTERVAL, \
NL_BDCAST_RATELIMIT_BURST);
struct log_msg {
struct list_head node;
unsigned int radio;
unsigned int index;
/* indicates the current filled log length in logbuf */
unsigned int filled_length;
/*
* Buf to hold the log msg
* tAniHdr + log
*/
char logbuf[MAX_LOGMSG_LENGTH];
};
struct logger_log_complete {
uint32_t is_fatal;
uint32_t indicator;
uint32_t reason_code;
bool is_report_in_progress;
bool is_flush_complete;
uint32_t last_fw_bug_reason;
unsigned long last_fw_bug_timestamp;
};
struct fw_mem_dump_logging{
//It will hold the starting point of mem dump buffer
uint8 *fw_dump_start_loc;
//It will hold the current loc to tell how much data filled
uint8 *fw_dump_current_loc;
uint32 fw_dump_max_size;
vos_pkt_t *fw_mem_dump_queue;
/* Holds number of pkts in fw log vos pkt queue */
unsigned int fw_mem_dump_pkt_qcnt;
/* Number of dropped pkts for fw dump */
unsigned int fw_mem_dump_pkt_drop_cnt;
/* Lock to synchronize of queue/dequeue of pkts in fw log pkt queue */
spinlock_t fw_mem_dump_lock;
/* Fw memory dump status */
enum FW_MEM_DUMP_STATE fw_mem_dump_status;
/* storage for HDD callback which completes fw mem dump request */
void * svc_fw_mem_dump_req_cb;
/* storage for HDD callback which completes fw mem dump request arg */
void * svc_fw_mem_dump_req_cb_arg;
};
struct pkt_stats_msg {
struct list_head node;
/* indicates the current filled log length in pktlogbuf */
struct sk_buff *skb;
};
struct perPktStatsInfo{
v_U32_t lastTxRate; // 802.11 data rate at which the last data frame is transmitted.
v_U32_t txAvgRetry; // Average number of retries per 10 packets.
v_S7_t avgRssi; // Average of the Beacon RSSI.
};
struct wlan_logging {
/* Log Fatal and ERROR to console */
bool log_fe_to_console;
/* Number of buffers to be used for logging */
int num_buf;
/* Lock to synchronize access to shared logging resource */
spinlock_t spin_lock;
/* Holds the free node which can be used for filling logs */
struct list_head free_list;
/* Holds the filled nodes which needs to be indicated to APP */
struct list_head filled_list;
/* Points to head of logger pkt queue */
vos_pkt_t *data_mgmt_pkt_queue;
/* Holds number of pkts in vos pkt queue */
unsigned int data_mgmt_pkt_qcnt;
/* Lock to synchronize of queue/dequeue of pkts in logger pkt queue */
spinlock_t data_mgmt_pkt_lock;
/* Points to head of logger fw log pkt queue */
vos_pkt_t *fw_log_pkt_queue;
/* Holds number of pkts in fw log vos pkt queue */
unsigned int fw_log_pkt_qcnt;
/* Lock to synchronize of queue/dequeue of pkts in fw log pkt queue */
spinlock_t fw_log_pkt_lock;
/* Wait queue for Logger thread */
wait_queue_head_t wait_queue;
/* Logger thread */
struct task_struct *thread;
/* Logging thread sets this variable on exit */
struct completion shutdown_comp;
/* Indicates to logger thread to exit */
bool exit;
/* Holds number of dropped logs*/
unsigned int drop_count;
/* Holds number of dropped vos pkts*/
unsigned int pkt_drop_cnt;
/* Holds number of dropped fw log vos pkts*/
unsigned int fw_log_pkt_drop_cnt;
/* current logbuf to which the log will be filled to */
struct log_msg *pcur_node;
/* Event flag used for wakeup and post indication*/
unsigned long event_flag;
/* Indicates logger thread is activated */
bool is_active;
/* data structure for log complete event*/
struct logger_log_complete log_complete;
spinlock_t bug_report_lock;
struct fw_mem_dump_logging fw_mem_dump_ctx;
int pkt_stat_num_buf;
unsigned int pkt_stat_drop_cnt;
struct list_head pkt_stat_free_list;
struct list_head pkt_stat_filled_list;
struct pkt_stats_msg *pkt_stats_pcur_node;
/* Index of the messages sent to userspace */
unsigned int pkt_stats_msg_idx;
bool pkt_stats_enabled;
spinlock_t pkt_stats_lock;
struct perPktStatsInfo txPktStatsInfo;
};
static struct wlan_logging gwlan_logging;
static struct log_msg *gplog_msg;
static struct pkt_stats_msg *pkt_stats_buffers;
/* PID of the APP to log the message */
static int gapp_pid = INVALID_PID;
static char wlan_logging_ready[] = "WLAN LOGGING READY";
/*
* Broadcast Logging service ready indication to any Logging application
* Each netlink message will have a message of type tAniMsgHdr inside.
*/
void wlan_logging_srv_nl_ready_indication(void)
{
struct sk_buff *skb = NULL;
struct nlmsghdr *nlh;
tAniNlHdr *wnl = NULL;
int payload_len;
int err;
static int rate_limit;
payload_len = sizeof(tAniHdr) + sizeof(wlan_logging_ready) +
sizeof(wnl->radio);
skb = dev_alloc_skb(NLMSG_SPACE(payload_len));
if (NULL == skb) {
if (!rate_limit) {
LOGGING_TRACE(VOS_TRACE_LEVEL_ERROR,
"NLINK: skb alloc fail %s", __func__);
}
rate_limit = 1;
return;
}
rate_limit = 0;
nlh = nlmsg_put(skb, 0, 0, ANI_NL_MSG_LOG, payload_len,
NLM_F_REQUEST);
if (NULL == nlh) {
LOGGING_TRACE(VOS_TRACE_LEVEL_ERROR,
"%s: nlmsg_put() failed for msg size[%d]",
__func__, payload_len);
kfree_skb(skb);
return;
}
wnl = (tAniNlHdr *) nlh;
wnl->radio = 0;
wnl->wmsg.type = ANI_NL_MSG_READY_IND_TYPE;
wnl->wmsg.length = sizeof(wlan_logging_ready);
memcpy((char*)&wnl->wmsg + sizeof(tAniHdr),
wlan_logging_ready,
sizeof(wlan_logging_ready));
/* sender is in group 1<<0 */
NETLINK_CB(skb).dst_group = WLAN_NLINK_MCAST_GRP_ID;
/*multicast the message to all listening processes*/
err = nl_srv_bcast(skb);
if (err) {
LOGGING_TRACE(VOS_TRACE_LEVEL_INFO_LOW,
"NLINK: Ready Indication Send Fail %s, err %d",
__func__, err);
}
return;
}
/* Utility function to send a netlink message to an application
* in user space
*/
static int wlan_send_sock_msg_to_app(tAniHdr *wmsg, int radio,
int src_mod, int pid)
{
int err = -1;
int payload_len;
int tot_msg_len;
tAniNlHdr *wnl = NULL;
struct sk_buff *skb;
struct nlmsghdr *nlh;
int wmsg_length = ntohs(wmsg->length);
static int nlmsg_seq;
if (radio < 0 || radio > ANI_MAX_RADIOS) {
pr_err("%s: invalid radio id [%d]",
__func__, radio);
return -EINVAL;
}
payload_len = wmsg_length + sizeof(wnl->radio) + sizeof(tAniHdr);
tot_msg_len = NLMSG_SPACE(payload_len);
skb = dev_alloc_skb(tot_msg_len);
if (skb == NULL) {
pr_err("%s: dev_alloc_skb() failed for msg size[%d]",
__func__, tot_msg_len);
return -ENOMEM;
}
nlh = nlmsg_put(skb, pid, nlmsg_seq++, src_mod, payload_len,
NLM_F_REQUEST);
if (NULL == nlh) {
pr_err("%s: nlmsg_put() failed for msg size[%d]",
__func__, tot_msg_len);
kfree_skb(skb);
return -ENOMEM;
}
wnl = (tAniNlHdr *) nlh;
wnl->radio = radio;
vos_mem_copy(&wnl->wmsg, wmsg, wmsg_length);
err = nl_srv_ucast(skb, pid, MSG_DONTWAIT);
return err;
}
static void set_default_logtoapp_log_level(void)
{
vos_trace_setValue(VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_ALL, VOS_TRUE);
vos_trace_setValue(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ALL, VOS_TRUE);
vos_trace_setValue(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ALL, VOS_TRUE);
vos_trace_setValue(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ALL, VOS_TRUE);
vos_trace_setValue(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ALL, VOS_TRUE);
vos_trace_setValue(VOS_MODULE_ID_HDD_SOFTAP, VOS_TRACE_LEVEL_ALL,
VOS_TRUE);
vos_trace_setValue(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ALL, VOS_TRUE);
vos_trace_setValue(VOS_MODULE_ID_PMC, VOS_TRACE_LEVEL_ALL, VOS_TRUE);
vos_trace_setValue(VOS_MODULE_ID_SVC, VOS_TRACE_LEVEL_ALL, VOS_TRUE);
}
static void clear_default_logtoapp_log_level(void)
{
int module;
for (module = 0; module < VOS_MODULE_ID_MAX; module++) {
vos_trace_setValue(module, VOS_TRACE_LEVEL_NONE,
VOS_FALSE);
vos_trace_setValue(module, VOS_TRACE_LEVEL_FATAL,
VOS_TRUE);
vos_trace_setValue(module, VOS_TRACE_LEVEL_ERROR,
VOS_TRUE);
}
vos_trace_setValue(VOS_MODULE_ID_RSV4, VOS_TRACE_LEVEL_NONE,
VOS_FALSE);
}
/* Need to call this with spin_lock acquired */
static int wlan_queue_logmsg_for_app(void)
{
char *ptr;
int ret = 0;
ptr = &gwlan_logging.pcur_node->logbuf[sizeof(tAniHdr)];
ptr[gwlan_logging.pcur_node->filled_length] = '\0';
*(unsigned short *)(gwlan_logging.pcur_node->logbuf) =
ANI_NL_MSG_LOG_TYPE;
*(unsigned short *)(gwlan_logging.pcur_node->logbuf + 2) =
gwlan_logging.pcur_node->filled_length;
list_add_tail(&gwlan_logging.pcur_node->node,
&gwlan_logging.filled_list);
if (!list_empty(&gwlan_logging.free_list)) {
/* Get buffer from free list */
gwlan_logging.pcur_node =
(struct log_msg *)(gwlan_logging.free_list.next);
list_del_init(gwlan_logging.free_list.next);
} else if (!list_empty(&gwlan_logging.filled_list)) {
/* Get buffer from filled list */
/* This condition will drop the packet from being
* indicated to app
*/
gwlan_logging.pcur_node =
(struct log_msg *)(gwlan_logging.filled_list.next);
++gwlan_logging.drop_count;
/* print every 64th drop count */
if (vos_is_multicast_logging() &&
(!(gwlan_logging.drop_count % 0x40))) {
pr_err("%s: drop_count = %u index = %d filled_length = %d\n",
__func__, gwlan_logging.drop_count,
gwlan_logging.pcur_node->index,
gwlan_logging.pcur_node->filled_length);
}
list_del_init(gwlan_logging.filled_list.next);
ret = 1;
}
/* Reset the current node values */
gwlan_logging.pcur_node->filled_length = 0;
return ret;
}
void wlan_fillTxStruct(void *pktStat)
{
vos_mem_copy(&gwlan_logging.txPktStatsInfo,
(struct perPktStatsInfo *)pktStat,
sizeof(struct perPktStatsInfo));
}
bool wlan_isPktStatsEnabled(void)
{
return gwlan_logging.pkt_stats_enabled;
}
/* Need to call this with spin_lock acquired */
static int wlan_queue_pkt_stats_for_app(void)
{
int ret = 0;
list_add_tail(&gwlan_logging.pkt_stats_pcur_node->node,
&gwlan_logging.pkt_stat_filled_list);
if (!list_empty(&gwlan_logging.pkt_stat_free_list)) {
/* Get buffer from free list */
gwlan_logging.pkt_stats_pcur_node =
(struct pkt_stats_msg *)(gwlan_logging.pkt_stat_free_list.next);
list_del_init(gwlan_logging.pkt_stat_free_list.next);
} else if (!list_empty(&gwlan_logging.pkt_stat_filled_list)) {
/* Get buffer from filled list */
/* This condition will drop the packet from being
* indicated to app
*/
gwlan_logging.pkt_stats_pcur_node =
(struct pkt_stats_msg *)(gwlan_logging.pkt_stat_filled_list.next);
++gwlan_logging.pkt_stat_drop_cnt;
/* print every 64th drop count */
if (vos_is_multicast_logging() &&
(!(gwlan_logging.pkt_stat_drop_cnt % 0x40))) {
pr_err("%s: drop_count = %u filled_length = %d\n",
__func__, gwlan_logging.pkt_stat_drop_cnt,
gwlan_logging.pkt_stats_pcur_node->skb->len);
}
list_del_init(gwlan_logging.pkt_stat_filled_list.next);
ret = 1;
}
/* Reset the current node values */
gwlan_logging.pkt_stats_pcur_node-> skb->len = 0;
return ret;
}
int wlan_pkt_stats_to_user(void *perPktStat)
{
bool wake_up_thread = false;
tPerPacketStats *pktstats = perPktStat;
unsigned long flags;
tx_rx_pkt_stats rx_tx_stats;
int total_log_len = 0;
struct sk_buff *ptr;
tpSirMacMgmtHdr hdr;
uint32 rateIdx;
if (!vos_is_multicast_logging())
{
return -EIO;
}
if (vos_is_multicast_logging()) {
vos_mem_zero(&rx_tx_stats, sizeof(tx_rx_pkt_stats));
if (pktstats->is_rx){
rx_tx_stats.ps_hdr.flags = (1 << PKTLOG_FLG_FRM_TYPE_REMOTE_S);
}else{
rx_tx_stats.ps_hdr.flags = (1 << PKTLOG_FLG_FRM_TYPE_LOCAL_S);
}
/*Send log type as PKTLOG_TYPE_PKT_STAT (9)*/
rx_tx_stats.ps_hdr.log_type = PKTLOG_TYPE_PKT_STAT;
rx_tx_stats.ps_hdr.timestamp = vos_timer_get_system_ticks();
rx_tx_stats.ps_hdr.missed_cnt = 0;
rx_tx_stats.ps_hdr.size = sizeof(tx_rx_pkt_stats) -
sizeof(pkt_stats_hdr) + pktstats->data_len-
MAX_PKT_STAT_DATA_LEN;
rx_tx_stats.stats.flags |= PER_PACKET_ENTRY_FLAGS_TX_SUCCESS;
rx_tx_stats.stats.flags |= PER_PACKET_ENTRY_FLAGS_80211_HEADER;
if (pktstats->is_rx)
rx_tx_stats.stats.flags |= PER_PACKET_ENTRY_FLAGS_DIRECTION_TX;
hdr = (tpSirMacMgmtHdr)pktstats->data;
if (hdr->fc.wep) {
rx_tx_stats.stats.flags |= PER_PACKET_ENTRY_FLAGS_PROTECTED;
/* Reset wep bit to parse frame properly */
hdr->fc.wep = 0;
}
rx_tx_stats.stats.tid = pktstats->tid;
rx_tx_stats.stats.dxe_timestamp = pktstats->dxe_timestamp;
if (!pktstats->is_rx)
{
rx_tx_stats.stats.rssi = gwlan_logging.txPktStatsInfo.avgRssi;
rx_tx_stats.stats.num_retries = gwlan_logging.txPktStatsInfo.txAvgRetry;
rateIdx = gwlan_logging.txPktStatsInfo.lastTxRate;
}
else
{
rx_tx_stats.stats.rssi = pktstats->rssi;
rx_tx_stats.stats.num_retries = pktstats->num_retries;
rateIdx = pktstats->rate_idx;
}
rx_tx_stats.stats.link_layer_transmit_sequence = pktstats->seq_num;
/* Calculate rate and MCS from rate index */
if( rateIdx >= 210 && rateIdx <= 217)
rateIdx-=202;
if( rateIdx >= 218 && rateIdx <= 225 )
rateIdx-=210;
get_rate_and_MCS(&rx_tx_stats.stats, rateIdx);
vos_mem_copy(rx_tx_stats.stats.data,pktstats->data, pktstats->data_len);
/* 1+1 indicate '\n'+'\0' */
total_log_len = sizeof(tx_rx_pkt_stats) + pktstats->data_len -
MAX_PKT_STAT_DATA_LEN;
spin_lock_irqsave(&gwlan_logging.pkt_stats_lock, flags);
// wlan logging svc resources are not yet initialized
if (!gwlan_logging.pkt_stats_pcur_node) {
pr_err("%s, logging svc not initialized", __func__);
spin_unlock_irqrestore(&gwlan_logging.pkt_stats_lock, flags);
return -EIO;
}
;
/* Check if we can accomodate more log into current node/buffer */
if (total_log_len + sizeof(vos_log_pktlog_info) + sizeof(tAniNlHdr) >=
skb_tailroom(gwlan_logging.pkt_stats_pcur_node->skb)) {
wake_up_thread = true;
wlan_queue_pkt_stats_for_app();
}
ptr = gwlan_logging.pkt_stats_pcur_node->skb;
vos_mem_copy(skb_put(ptr, total_log_len), &rx_tx_stats, total_log_len);
spin_unlock_irqrestore(&gwlan_logging.pkt_stats_lock, flags);
/* Wakeup logger thread */
if ((true == wake_up_thread)) {
/* If there is logger app registered wakeup the logging
* thread
*/
set_bit(HOST_PKT_STATS_POST, &gwlan_logging.event_flag);
wake_up_interruptible(&gwlan_logging.wait_queue);
}
}
return 0;
}
void wlan_disable_and_flush_pkt_stats()
{
unsigned long flags;
spin_lock_irqsave(&gwlan_logging.pkt_stats_lock, flags);
if(gwlan_logging.pkt_stats_pcur_node->skb->len){
wlan_queue_pkt_stats_for_app();
}
spin_unlock_irqrestore(&gwlan_logging.pkt_stats_lock, flags);
set_bit(HOST_PKT_STATS_POST, &gwlan_logging.event_flag);
wake_up_interruptible(&gwlan_logging.wait_queue);
}
int wlan_log_to_user(VOS_TRACE_LEVEL log_level, char *to_be_sent, int length)
{
/* Add the current time stamp */
char *ptr;
char tbuf[100];
int tlen;
int total_log_len;
unsigned int *pfilled_length;
bool wake_up_thread = false;
unsigned long flags;
struct timeval tv;
struct rtc_time tm;
unsigned long local_time;
u64 qtimer_ticks;
if (!vos_is_multicast_logging()) {
/*
* This is to make sure that we print the logs to kmsg console
* when no logger app is running. This is also needed to
* log the initial messages during loading of driver where even
* if app is running it will not be able to
* register with driver immediately and start logging all the
* messages.
*/
pr_err("%s\n", to_be_sent);
} else {
/* Format the Log time [hr:min:sec.microsec] */
do_gettimeofday(&tv);
/* Convert rtc to local time */
local_time = (u32)(tv.tv_sec - (sys_tz.tz_minuteswest * 60));
rtc_time_to_tm(local_time, &tm);
/* Firmware Time Stamp */
qtimer_ticks = arch_counter_get_cntpct();
tlen = snprintf(tbuf, sizeof(tbuf), "[%02d:%02d:%02d.%06lu] [%016llX]"
" [%.5s] ", tm.tm_hour, tm.tm_min, tm.tm_sec, tv.tv_usec,
qtimer_ticks, current->comm);
/* 1+1 indicate '\n'+'\0' */
total_log_len = length + tlen + 1 + 1;
spin_lock_irqsave(&gwlan_logging.spin_lock, flags);
// wlan logging svc resources are not yet initialized
if (!gwlan_logging.pcur_node) {
spin_unlock_irqrestore(&gwlan_logging.spin_lock, flags);
return -EIO;
}
pfilled_length = &gwlan_logging.pcur_node->filled_length;
/* Check if we can accomodate more log into current node/buffer */
if (MAX_LOGMSG_LENGTH < (*pfilled_length + sizeof(tAniNlHdr) +
total_log_len)) {
wake_up_thread = true;
wlan_queue_logmsg_for_app();
pfilled_length = &gwlan_logging.pcur_node->filled_length;
}
ptr = &gwlan_logging.pcur_node->logbuf[sizeof(tAniHdr)];
/* Assumption here is that we receive logs which is always less than
* MAX_LOGMSG_LENGTH, where we can accomodate the
* tAniNlHdr + [context][timestamp] + log
* VOS_ASSERT if we cannot accomodate the the complete log into
* the available buffer.
*
* Continue and copy logs to the available length and discard the rest.
*/
if (MAX_LOGMSG_LENGTH < (sizeof(tAniNlHdr) + total_log_len)) {
VOS_ASSERT(0);
total_log_len = MAX_LOGMSG_LENGTH - sizeof(tAniNlHdr) - 2;
}
vos_mem_copy(&ptr[*pfilled_length], tbuf, tlen);
vos_mem_copy(&ptr[*pfilled_length + tlen], to_be_sent,
min(length, (total_log_len - tlen)));
*pfilled_length += tlen + min(length, total_log_len - tlen);
ptr[*pfilled_length] = '\n';
*pfilled_length += 1;
spin_unlock_irqrestore(&gwlan_logging.spin_lock, flags);
/* Wakeup logger thread */
if ((true == wake_up_thread)) {
/* If there is logger app registered wakeup the logging
* thread
*/
set_bit(HOST_LOG_POST, &gwlan_logging.event_flag);
wake_up_interruptible(&gwlan_logging.wait_queue);
}
if (gwlan_logging.log_fe_to_console
&& ((VOS_TRACE_LEVEL_FATAL == log_level)
|| (VOS_TRACE_LEVEL_ERROR == log_level))) {
pr_err("%s %s\n",tbuf, to_be_sent);
}
}
return 0;
}
static int send_fw_log_pkt_to_user(void)
{
int ret = -1;
int extra_header_len, nl_payload_len;
struct sk_buff *skb = NULL;
static int nlmsg_seq;
vos_pkt_t *current_pkt;
vos_pkt_t *next_pkt;
VOS_STATUS status = VOS_STATUS_E_FAILURE;
unsigned long flags;
tAniNlHdr msg_header;
do {
spin_lock_irqsave(&gwlan_logging.fw_log_pkt_lock, flags);
if (!gwlan_logging.fw_log_pkt_queue) {
spin_unlock_irqrestore(
&gwlan_logging.fw_log_pkt_lock, flags);
return -EIO;
}
/* pick first pkt from queued chain */
current_pkt = gwlan_logging.fw_log_pkt_queue;
/* get the pointer to the next packet in the chain */
status = vos_pkt_walk_packet_chain(current_pkt, &next_pkt,
TRUE);
/* both "success" and "empty" are acceptable results */
if (!((status == VOS_STATUS_SUCCESS) ||
(status == VOS_STATUS_E_EMPTY))) {
++gwlan_logging.fw_log_pkt_drop_cnt;
spin_unlock_irqrestore(
&gwlan_logging.fw_log_pkt_lock, flags);
pr_err("%s: Failure walking packet chain", __func__);
return -EIO;
}
/* update queue head with next pkt ptr which could be NULL */
gwlan_logging.fw_log_pkt_queue = next_pkt;
--gwlan_logging.fw_log_pkt_qcnt;
spin_unlock_irqrestore(&gwlan_logging.fw_log_pkt_lock, flags);
status = vos_pkt_get_os_packet(current_pkt, (v_VOID_t **)&skb,
TRUE);
if (!VOS_IS_STATUS_SUCCESS(status)) {
++gwlan_logging.fw_log_pkt_drop_cnt;
pr_err("%s: Failure extracting skb from vos pkt",
__func__);
return -EIO;
}
/*return vos pkt since skb is already detached */
vos_pkt_return_packet(current_pkt);
extra_header_len = sizeof(msg_header.radio) + sizeof(tAniHdr);
nl_payload_len = extra_header_len + skb->len;
msg_header.nlh.nlmsg_type = ANI_NL_MSG_LOG;
msg_header.nlh.nlmsg_len = nlmsg_msg_size(nl_payload_len);
msg_header.nlh.nlmsg_flags = NLM_F_REQUEST;
msg_header.nlh.nlmsg_pid = gapp_pid;
msg_header.nlh.nlmsg_seq = nlmsg_seq++;
msg_header.radio = 0;
msg_header.wmsg.type = ANI_NL_MSG_FW_LOG_PKT_TYPE;
msg_header.wmsg.length = skb->len;
if (unlikely(skb_headroom(skb) < sizeof(msg_header))) {
pr_err("VPKT [%d]: Insufficient headroom, head[%p],"
" data[%p], req[%zu]", __LINE__, skb->head,
skb->data, sizeof(msg_header));
return -EIO;
}
vos_mem_copy(skb_push(skb, sizeof(msg_header)), &msg_header,
sizeof(msg_header));
ret = nl_srv_bcast(skb);
if ((ret < 0) && (ret != -ESRCH)) {
pr_info("%s: Send Failed %d drop_count = %u\n",
__func__, ret, ++gwlan_logging.fw_log_pkt_drop_cnt);
} else {
ret = 0;
}
} while (next_pkt);
return ret;
}
static int send_data_mgmt_log_pkt_to_user(void)
{
int ret = -1;
int extra_header_len, nl_payload_len;
struct sk_buff *skb = NULL;
static int nlmsg_seq;
vos_pkt_t *current_pkt;
vos_pkt_t *next_pkt;
VOS_STATUS status = VOS_STATUS_E_FAILURE;
unsigned long flags;
tAniNlLogHdr msg_header;
do {
spin_lock_irqsave(&gwlan_logging.data_mgmt_pkt_lock, flags);
if (!gwlan_logging.data_mgmt_pkt_queue) {
spin_unlock_irqrestore(
&gwlan_logging.data_mgmt_pkt_lock, flags);
return -EIO;
}
/* pick first pkt from queued chain */
current_pkt = gwlan_logging.data_mgmt_pkt_queue;
/* get the pointer to the next packet in the chain */
status = vos_pkt_walk_packet_chain(current_pkt, &next_pkt,
TRUE);
/* both "success" and "empty" are acceptable results */
if (!((status == VOS_STATUS_SUCCESS) ||
(status == VOS_STATUS_E_EMPTY))) {
++gwlan_logging.pkt_drop_cnt;
spin_unlock_irqrestore(
&gwlan_logging.data_mgmt_pkt_lock, flags);
pr_err("%s: Failure walking packet chain", __func__);
return -EIO;
}
/* update queue head with next pkt ptr which could be NULL */
gwlan_logging.data_mgmt_pkt_queue = next_pkt;
--gwlan_logging.data_mgmt_pkt_qcnt;
spin_unlock_irqrestore(&gwlan_logging.data_mgmt_pkt_lock, flags);
status = vos_pkt_get_os_packet(current_pkt, (v_VOID_t **)&skb,
TRUE);
if (!VOS_IS_STATUS_SUCCESS(status)) {
++gwlan_logging.pkt_drop_cnt;
pr_err("%s: Failure extracting skb from vos pkt",
__func__);
return -EIO;
}
/*return vos pkt since skb is already detached */
vos_pkt_return_packet(current_pkt);
extra_header_len = sizeof(msg_header.radio) + sizeof(tAniHdr) +
sizeof(msg_header.frameSize);
nl_payload_len = extra_header_len + skb->len;
msg_header.nlh.nlmsg_type = ANI_NL_MSG_LOG;
msg_header.nlh.nlmsg_len = nlmsg_msg_size(nl_payload_len);
msg_header.nlh.nlmsg_flags = NLM_F_REQUEST;
msg_header.nlh.nlmsg_pid = 0;
msg_header.nlh.nlmsg_seq = nlmsg_seq++;
msg_header.radio = 0;
msg_header.wmsg.type = ANI_NL_MSG_LOG_PKT_TYPE;
msg_header.wmsg.length = skb->len + sizeof(uint32);
msg_header.frameSize = WLAN_MGMT_LOGGING_FRAMESIZE_128BYTES;
if (unlikely(skb_headroom(skb) < sizeof(msg_header))) {
pr_err("VPKT [%d]: Insufficient headroom, head[%p],"
" data[%p], req[%zu]", __LINE__, skb->head,
skb->data, sizeof(msg_header));
return -EIO;
}
vos_mem_copy(skb_push(skb, sizeof(msg_header)), &msg_header,
sizeof(msg_header));
ret = nl_srv_bcast(skb);
if (ret < 0) {
pr_info("%s: Send Failed %d drop_count = %u\n",
__func__, ret, ++gwlan_logging.pkt_drop_cnt);
} else {
ret = 0;
}
} while (next_pkt);
return ret;
}
static int fill_fw_mem_dump_buffer(void)
{
struct sk_buff *skb = NULL;
vos_pkt_t *current_pkt;
vos_pkt_t *next_pkt;
VOS_STATUS status = VOS_STATUS_E_FAILURE;
unsigned long flags;
int byte_left = 0;
do {
spin_lock_irqsave(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock, flags);
if (!gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_queue) {
spin_unlock_irqrestore(
&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock, flags);
return -EIO;
}
/* pick first pkt from queued chain */
current_pkt = gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_queue;
/* get the pointer to the next packet in the chain */
status = vos_pkt_walk_packet_chain(current_pkt, &next_pkt,
TRUE);
/* both "success" and "empty" are acceptable results */
if (!((status == VOS_STATUS_SUCCESS) ||
(status == VOS_STATUS_E_EMPTY))) {
spin_unlock_irqrestore(
&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock, flags);
pr_err("%s: Failure walking packet chain", __func__);
return -EIO;
}
/* update queue head with next pkt ptr which could be NULL */
gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_queue = next_pkt;
--gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_pkt_qcnt;
spin_unlock_irqrestore(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock, flags);
status = vos_pkt_get_os_packet(current_pkt, (v_VOID_t **)&skb,
VOS_FALSE);
if (!VOS_IS_STATUS_SUCCESS(status)) {
pr_err("%s: Failure extracting skb from vos pkt",
__func__);
return -EIO;
}
//Copy data from SKB to mem dump buffer
spin_lock_irqsave(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock, flags);
if((skb) && (skb->len != 0))
{
// Prevent buffer overflow
byte_left = ((int)gwlan_logging.fw_mem_dump_ctx.fw_dump_max_size -
(int)(gwlan_logging.fw_mem_dump_ctx.fw_dump_current_loc - gwlan_logging.fw_mem_dump_ctx.fw_dump_start_loc));
if(skb->len > byte_left)
{
vos_mem_copy(gwlan_logging.fw_mem_dump_ctx.fw_dump_current_loc, skb->data, byte_left);
//Update the current location ptr
gwlan_logging.fw_mem_dump_ctx.fw_dump_current_loc += byte_left;
}
else
{
vos_mem_copy(gwlan_logging.fw_mem_dump_ctx.fw_dump_current_loc, skb->data, skb->len);
//Update the current location ptr
gwlan_logging.fw_mem_dump_ctx.fw_dump_current_loc += skb->len;
}
}
spin_unlock_irqrestore(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock, flags);
/*return vos pkt since skb is already detached */
vos_pkt_return_packet(current_pkt);
} while (next_pkt);
return 0;
}
static int send_filled_buffers_to_user(void)
{
int ret = -1;
struct log_msg *plog_msg;
int payload_len;
int tot_msg_len;
tAniNlHdr *wnl;
struct sk_buff *skb = NULL;
struct nlmsghdr *nlh;
static int nlmsg_seq;
unsigned long flags;
static int rate_limit;
while (!list_empty(&gwlan_logging.filled_list)
&& !gwlan_logging.exit) {
skb = dev_alloc_skb(MAX_LOGMSG_LENGTH);
if (skb == NULL) {
if (!rate_limit) {
pr_err("%s: dev_alloc_skb() failed for msg size[%d] drop count = %u\n",
__func__, MAX_LOGMSG_LENGTH,
gwlan_logging.drop_count);
}
rate_limit = 1;
ret = -ENOMEM;
break;
}
rate_limit = 0;
spin_lock_irqsave(&gwlan_logging.spin_lock, flags);
plog_msg = (struct log_msg *)
(gwlan_logging.filled_list.next);
list_del_init(gwlan_logging.filled_list.next);
spin_unlock_irqrestore(&gwlan_logging.spin_lock, flags);
/* 4 extra bytes for the radio idx */
payload_len = plog_msg->filled_length +
sizeof(wnl->radio) + sizeof(tAniHdr);
tot_msg_len = NLMSG_SPACE(payload_len);
nlh = nlmsg_put(skb, 0, nlmsg_seq++,
ANI_NL_MSG_LOG, payload_len,
NLM_F_REQUEST);
if (NULL == nlh) {
spin_lock_irqsave(&gwlan_logging.spin_lock, flags);
list_add_tail(&plog_msg->node,
&gwlan_logging.free_list);
spin_unlock_irqrestore(&gwlan_logging.spin_lock,
flags);
pr_err("%s: drop_count = %u\n", __func__,
++gwlan_logging.drop_count);
pr_err("%s: nlmsg_put() failed for msg size[%d]\n",
__func__, tot_msg_len);
dev_kfree_skb(skb);
skb = NULL;
ret = -EINVAL;
continue;
}
wnl = (tAniNlHdr *) nlh;
wnl->radio = plog_msg->radio;
vos_mem_copy(&wnl->wmsg, plog_msg->logbuf,
plog_msg->filled_length +
sizeof(tAniHdr));
spin_lock_irqsave(&gwlan_logging.spin_lock, flags);
list_add_tail(&plog_msg->node,
&gwlan_logging.free_list);
spin_unlock_irqrestore(&gwlan_logging.spin_lock, flags);
ret = nl_srv_bcast(skb);
if (ret < 0) {
if (__ratelimit(&errCnt))
{
pr_info("%s: Send Failed %d drop_count = %u\n",
__func__, ret, gwlan_logging.drop_count);
}
gwlan_logging.drop_count++;
skb = NULL;
break;
} else {
skb = NULL;
ret = 0;
}
}
return ret;
}
static int send_per_pkt_stats_to_user(void)
{
int ret = -1;
struct pkt_stats_msg *plog_msg;
unsigned long flags;
struct sk_buff *skb_new = NULL;
vos_log_pktlog_info pktlog;
tAniNlHdr msg_header;
int extra_header_len, nl_payload_len;
static int nlmsg_seq;
static int rate_limit;
int diag_type;
bool free_old_skb = false;
while (!list_empty(&gwlan_logging.pkt_stat_filled_list)
&& !gwlan_logging.exit) {
skb_new= dev_alloc_skb(MAX_PKTSTATS_LOG_LENGTH);
if (skb_new == NULL) {
if (!rate_limit) {
pr_err("%s: dev_alloc_skb() failed for msg size[%d] drop count = %u\n",
__func__, MAX_LOGMSG_LENGTH,
gwlan_logging.drop_count);
}
rate_limit = 1;
ret = -ENOMEM;
break;
}
spin_lock_irqsave(&gwlan_logging.pkt_stats_lock, flags);
plog_msg = (struct pkt_stats_msg *)
(gwlan_logging.pkt_stat_filled_list.next);
list_del_init(gwlan_logging.pkt_stat_filled_list.next);
spin_unlock_irqrestore(&gwlan_logging.pkt_stats_lock, flags);
vos_mem_zero(&pktlog, sizeof(vos_log_pktlog_info));
vos_log_set_code(&pktlog, LOG_WLAN_PKT_LOG_INFO_C);
pktlog.version = VERSION_LOG_WLAN_PKT_LOG_INFO_C;
pktlog.buf_len = plog_msg->skb->len;
vos_log_set_length(&pktlog.log_hdr, plog_msg->skb->len +
sizeof(vos_log_pktlog_info));
pktlog.seq_no = gwlan_logging.pkt_stats_msg_idx++;
if (unlikely(skb_headroom(plog_msg->skb) < sizeof(vos_log_pktlog_info))) {
pr_err("VPKT [%d]: Insufficient headroom, head[%p],"
" data[%p], req[%zu]", __LINE__, plog_msg->skb->head,
plog_msg->skb->data, sizeof(msg_header));
ret = -EIO;
free_old_skb = true;
goto err;
}
vos_mem_copy(skb_push(plog_msg->skb, sizeof(vos_log_pktlog_info)), &pktlog,
sizeof(vos_log_pktlog_info));
if (unlikely(skb_headroom(plog_msg->skb) < sizeof(int))) {
pr_err("VPKT [%d]: Insufficient headroom, head[%p],"
" data[%p], req[%zu]", __LINE__, plog_msg->skb->head,
plog_msg->skb->data, sizeof(int));
ret = -EIO;
free_old_skb = true;
goto err;
}
diag_type = DIAG_TYPE_LOGS;
vos_mem_copy(skb_push(plog_msg->skb, sizeof(int)), &diag_type,
sizeof(int));
extra_header_len = sizeof(msg_header.radio) + sizeof(tAniHdr);
nl_payload_len = extra_header_len + plog_msg->skb->len;
msg_header.nlh.nlmsg_type = ANI_NL_MSG_PUMAC;
msg_header.nlh.nlmsg_len = nlmsg_msg_size(nl_payload_len);
msg_header.nlh.nlmsg_flags = NLM_F_REQUEST;
msg_header.nlh.nlmsg_pid = 0;
msg_header.nlh.nlmsg_seq = nlmsg_seq++;
msg_header.radio = 0;
msg_header.wmsg.type = PTT_MSG_DIAG_CMDS_TYPE;
msg_header.wmsg.length = cpu_to_be16(plog_msg->skb->len);
if (unlikely(skb_headroom(plog_msg->skb) < sizeof(msg_header))) {
pr_err("VPKT [%d]: Insufficient headroom, head[%p],"
" data[%p], req[%zu]", __LINE__, plog_msg->skb->head,
plog_msg->skb->data, sizeof(msg_header));
ret = -EIO;
free_old_skb = true;
goto err;
}
vos_mem_copy(skb_push(plog_msg->skb, sizeof(msg_header)), &msg_header,
sizeof(msg_header));
ret = nl_srv_bcast(plog_msg->skb);
if (ret < 0) {
pr_info("%s: Send Failed %d drop_count = %u\n",
__func__, ret, ++gwlan_logging.fw_log_pkt_drop_cnt);
} else {
ret = 0;
}
err:
/*
* Free old skb in case or error before assigning new skb
* to the free list.
*/
if (free_old_skb)
dev_kfree_skb(plog_msg->skb);
spin_lock_irqsave(&gwlan_logging.pkt_stats_lock, flags);
plog_msg->skb = skb_new;
list_add_tail(&plog_msg->node,
&gwlan_logging.pkt_stat_free_list);
spin_unlock_irqrestore(&gwlan_logging.pkt_stats_lock, flags);
ret = 0;
}
return ret;
}
/**
* wlan_logging_thread() - The WLAN Logger thread
* @Arg - pointer to the HDD context
*
* This thread logs log message to App registered for the logs.
*/
static int wlan_logging_thread(void *Arg)
{
int ret_wait_status = 0;
int ret = 0;
unsigned long flags;
set_user_nice(current, -2);
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0))
daemonize("wlan_logging_thread");
#endif
while (!gwlan_logging.exit) {
ret_wait_status = wait_event_interruptible(
gwlan_logging.wait_queue,
(test_bit(HOST_LOG_POST, &gwlan_logging.event_flag) ||
gwlan_logging.exit ||
test_bit(LOGGER_MGMT_DATA_PKT_POST,
&gwlan_logging.event_flag) ||
test_bit(LOGGER_FW_LOG_PKT_POST,
&gwlan_logging.event_flag) ||
test_bit(LOGGER_FATAL_EVENT_POST,
&gwlan_logging.event_flag) ||
test_bit(LOGGER_FW_MEM_DUMP_PKT_POST, &gwlan_logging.event_flag) ||
test_bit(LOGGER_FW_MEM_DUMP_PKT_POST_DONE, &gwlan_logging.event_flag)||
test_bit(HOST_PKT_STATS_POST,
&gwlan_logging.event_flag)));
if (ret_wait_status == -ERESTARTSYS) {
pr_err("%s: wait_event return -ERESTARTSYS", __func__);
break;
}
if (gwlan_logging.exit) {
break;
}
if (test_and_clear_bit(HOST_LOG_POST,
&gwlan_logging.event_flag)) {
ret = send_filled_buffers_to_user();
if (-ENOMEM == ret) {
msleep(200);
}
if (WLAN_LOG_INDICATOR_HOST_ONLY ==
gwlan_logging.log_complete.indicator)
{
vos_send_fatal_event_done();
}
}
if (test_and_clear_bit(LOGGER_FW_LOG_PKT_POST,
&gwlan_logging.event_flag)) {
send_fw_log_pkt_to_user();
}
if (test_and_clear_bit(LOGGER_MGMT_DATA_PKT_POST,
&gwlan_logging.event_flag)) {
send_data_mgmt_log_pkt_to_user();
}
if (test_and_clear_bit(LOGGER_FATAL_EVENT_POST,
&gwlan_logging.event_flag)) {
if (gwlan_logging.log_complete.is_flush_complete == true) {
gwlan_logging.log_complete.is_flush_complete = false;
vos_send_fatal_event_done();
}
else {
gwlan_logging.log_complete.is_flush_complete = true;
spin_lock_irqsave(&gwlan_logging.spin_lock, flags);
/* Flush all current host logs*/
wlan_queue_logmsg_for_app();
spin_unlock_irqrestore(&gwlan_logging.spin_lock, flags);
set_bit(HOST_LOG_POST,&gwlan_logging.event_flag);
set_bit(LOGGER_FW_LOG_PKT_POST, &gwlan_logging.event_flag);
set_bit(LOGGER_FATAL_EVENT_POST, &gwlan_logging.event_flag);
wake_up_interruptible(&gwlan_logging.wait_queue);
}
}
if (test_and_clear_bit(LOGGER_FW_MEM_DUMP_PKT_POST,
&gwlan_logging.event_flag)) {
fill_fw_mem_dump_buffer();
}
if(test_and_clear_bit(LOGGER_FW_MEM_DUMP_PKT_POST_DONE, &gwlan_logging.event_flag)){
spin_lock_irqsave(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock,flags);
/*Chnage fw memory dump to indicate write done*/
gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_status = FW_MEM_DUMP_WRITE_DONE;
/*reset dropped packet count upon completion of this request*/
gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_pkt_drop_cnt = 0;
spin_unlock_irqrestore(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock,flags);
fill_fw_mem_dump_buffer();
/*
* Call the registered HDD callback for indicating
* memdump complete. If it's null,then something is
* not right.
*/
if (gwlan_logging.fw_mem_dump_ctx.svc_fw_mem_dump_req_cb &&
gwlan_logging.fw_mem_dump_ctx.svc_fw_mem_dump_req_cb_arg) {
((hdd_fw_mem_dump_req_cb)
gwlan_logging.fw_mem_dump_ctx.svc_fw_mem_dump_req_cb)(
(struct hdd_fw_mem_dump_req_ctx*)
gwlan_logging.fw_mem_dump_ctx.svc_fw_mem_dump_req_cb_arg);
/*invalidate the callback pointers*/
spin_lock_irqsave(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock,flags);
gwlan_logging.fw_mem_dump_ctx.svc_fw_mem_dump_req_cb = NULL;
gwlan_logging.fw_mem_dump_ctx.svc_fw_mem_dump_req_cb_arg = NULL;
spin_unlock_irqrestore(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock,flags);
}
}
if (test_and_clear_bit(HOST_PKT_STATS_POST,
&gwlan_logging.event_flag)) {
send_per_pkt_stats_to_user();
}
}
complete_and_exit(&gwlan_logging.shutdown_comp, 0);
return 0;
}
/*
* Process all the Netlink messages from Logger Socket app in user space
*/
static int wlan_logging_proc_sock_rx_msg(struct sk_buff *skb)
{
tAniNlHdr *wnl;
int radio;
int type;
int ret, len;
unsigned long flags;
if (TRUE == vos_isUnloadInProgress())
{
pr_info("%s: unload in progress\n",__func__);
return -ENODEV;
}
wnl = (tAniNlHdr *) skb->data;
radio = wnl->radio;
type = wnl->nlh.nlmsg_type;
if (radio < 0 || radio > ANI_MAX_RADIOS) {
pr_err("%s: invalid radio id [%d]\n",
__func__, radio);
return -EINVAL;
}
len = ntohs(wnl->wmsg.length) + sizeof(tAniNlHdr);
if (len > skb_headlen(skb))
{
pr_err("%s: invalid length, msgLen:%x skb len:%x headLen: %d data_len: %d",
__func__, len, skb->len, skb_headlen(skb), skb->data_len);
return -EINVAL;
}
if (gapp_pid != INVALID_PID) {
if (wnl->nlh.nlmsg_pid > gapp_pid) {
gapp_pid = wnl->nlh.nlmsg_pid;
}
spin_lock_irqsave(&gwlan_logging.spin_lock, flags);
if (gwlan_logging.pcur_node->filled_length) {
wlan_queue_logmsg_for_app();
}
spin_unlock_irqrestore(&gwlan_logging.spin_lock, flags);
set_bit(HOST_LOG_POST, &gwlan_logging.event_flag);
wake_up_interruptible(&gwlan_logging.wait_queue);
} else {
/* This is to set the default levels (WLAN logging
* default values not the VOS trace default) when
* logger app is registered for the first time.
*/
gapp_pid = wnl->nlh.nlmsg_pid;
}
ret = wlan_send_sock_msg_to_app(&wnl->wmsg, 0,
ANI_NL_MSG_LOG, wnl->nlh.nlmsg_pid);
if (ret < 0) {
pr_err("wlan_send_sock_msg_to_app: failed");
}
return ret;
}
void wlan_init_log_completion(void)
{
gwlan_logging.log_complete.indicator = WLAN_LOG_INDICATOR_UNUSED;
gwlan_logging.log_complete.is_fatal = WLAN_LOG_TYPE_NON_FATAL;
gwlan_logging.log_complete.is_report_in_progress = false;
gwlan_logging.log_complete.reason_code = WLAN_LOG_REASON_CODE_UNUSED;
gwlan_logging.log_complete.last_fw_bug_reason = 0;
gwlan_logging.log_complete.last_fw_bug_timestamp = 0;
spin_lock_init(&gwlan_logging.bug_report_lock);
}
int wlan_set_log_completion(uint32 is_fatal,
uint32 indicator,
uint32 reason_code)
{
unsigned long flags;
spin_lock_irqsave(&gwlan_logging.bug_report_lock, flags);
gwlan_logging.log_complete.indicator = indicator;
gwlan_logging.log_complete.is_fatal = is_fatal;
gwlan_logging.log_complete.is_report_in_progress = true;
gwlan_logging.log_complete.reason_code = reason_code;
spin_unlock_irqrestore(&gwlan_logging.bug_report_lock, flags);
return 0;
}
void wlan_get_log_and_reset_completion(uint32 *is_fatal,
uint32 *indicator,
uint32 *reason_code,
bool reset)
{
unsigned long flags;
spin_lock_irqsave(&gwlan_logging.bug_report_lock, flags);
*indicator = gwlan_logging.log_complete.indicator;
*is_fatal = gwlan_logging.log_complete.is_fatal;
*reason_code = gwlan_logging.log_complete.reason_code;
if (reset) {
gwlan_logging.log_complete.indicator =
WLAN_LOG_INDICATOR_UNUSED;
gwlan_logging.log_complete.is_fatal = WLAN_LOG_TYPE_NON_FATAL;
gwlan_logging.log_complete.is_report_in_progress = false;
gwlan_logging.log_complete.reason_code =
WLAN_LOG_REASON_CODE_UNUSED;
}
spin_unlock_irqrestore(&gwlan_logging.bug_report_lock, flags);
}
bool wlan_is_log_report_in_progress(void)
{
return gwlan_logging.log_complete.is_report_in_progress;
}
void wlan_reset_log_report_in_progress(void)
{
unsigned long flags;
spin_lock_irqsave(&gwlan_logging.bug_report_lock, flags);
gwlan_logging.log_complete.is_report_in_progress = false;
spin_unlock_irqrestore(&gwlan_logging.bug_report_lock, flags);
}
void wlan_deinit_log_completion(void)
{
return;
}
int wlan_logging_sock_activate_svc(int log_fe_to_console, int num_buf,
int pkt_stats_enabled, int pkt_stats_buff)
{
int i, j = 0;
unsigned long irq_flag;
bool failure = FALSE;
pr_info("%s: Initalizing FEConsoleLog = %d NumBuff = %d\n",
__func__, log_fe_to_console, num_buf);
gapp_pid = INVALID_PID;
gplog_msg = (struct log_msg *) vmalloc(
num_buf * sizeof(struct log_msg));
if (!gplog_msg) {
pr_err("%s: Could not allocate memory\n", __func__);
return -ENOMEM;
}
vos_mem_zero(gplog_msg, (num_buf * sizeof(struct log_msg)));
gwlan_logging.log_fe_to_console = !!log_fe_to_console;
gwlan_logging.num_buf = num_buf;
spin_lock_irqsave(&gwlan_logging.spin_lock, irq_flag);
INIT_LIST_HEAD(&gwlan_logging.free_list);
INIT_LIST_HEAD(&gwlan_logging.filled_list);
for (i = 0; i < num_buf; i++) {
list_add(&gplog_msg[i].node, &gwlan_logging.free_list);
gplog_msg[i].index = i;
}
gwlan_logging.pcur_node = (struct log_msg *)
(gwlan_logging.free_list.next);
list_del_init(gwlan_logging.free_list.next);
spin_unlock_irqrestore(&gwlan_logging.spin_lock, irq_flag);
if(pkt_stats_enabled)
{
pr_info("%s: Initalizing Pkt stats pkt_stats_buff = %d\n",
__func__, pkt_stats_buff);
pkt_stats_buffers = (struct pkt_stats_msg *) kzalloc(
pkt_stats_buff * sizeof(struct pkt_stats_msg), GFP_KERNEL);
if (!pkt_stats_buffers) {
pr_err("%s: Could not allocate memory for Pkt stats\n", __func__);
failure = TRUE;
goto err;
}
gwlan_logging.pkt_stat_num_buf = pkt_stats_buff;
gwlan_logging.pkt_stats_msg_idx = 0;
INIT_LIST_HEAD(&gwlan_logging.pkt_stat_free_list);
INIT_LIST_HEAD(&gwlan_logging.pkt_stat_filled_list);
for (i = 0; i < pkt_stats_buff; i++) {
pkt_stats_buffers[i].skb= dev_alloc_skb(MAX_PKTSTATS_LOG_LENGTH);
if (pkt_stats_buffers[i].skb == NULL)
{
pr_err("%s: Memory alloc failed for skb",__func__);
/* free previously allocated skb and return;*/
for (j = 0; j<i ; j++)
{
dev_kfree_skb(pkt_stats_buffers[j].skb);
}
spin_lock_irqsave(&gwlan_logging.spin_lock, irq_flag);
vos_mem_free(pkt_stats_buffers);
pkt_stats_buffers = NULL;
spin_unlock_irqrestore(&gwlan_logging.spin_lock, irq_flag);
failure = TRUE;
goto err;
}
list_add(&pkt_stats_buffers[i].node,
&gwlan_logging.pkt_stat_free_list);
}
gwlan_logging.pkt_stats_pcur_node = (struct pkt_stats_msg *)
(gwlan_logging.pkt_stat_free_list.next);
list_del_init(gwlan_logging.pkt_stat_free_list.next);
gwlan_logging.pkt_stats_enabled = TRUE;
}
err:
if (failure)
gwlan_logging.pkt_stats_enabled = false;
init_waitqueue_head(&gwlan_logging.wait_queue);
gwlan_logging.exit = false;
clear_bit(HOST_LOG_POST, &gwlan_logging.event_flag);
clear_bit(LOGGER_MGMT_DATA_PKT_POST, &gwlan_logging.event_flag);
clear_bit(LOGGER_FW_LOG_PKT_POST, &gwlan_logging.event_flag);
clear_bit(LOGGER_FATAL_EVENT_POST, &gwlan_logging.event_flag);
clear_bit(HOST_PKT_STATS_POST, &gwlan_logging.event_flag);
init_completion(&gwlan_logging.shutdown_comp);
gwlan_logging.thread = kthread_create(wlan_logging_thread, NULL,
"wlan_logging_thread");
if (IS_ERR(gwlan_logging.thread)) {
pr_err("%s: Could not Create LogMsg Thread Controller",
__func__);
spin_lock_irqsave(&gwlan_logging.spin_lock, irq_flag);
vfree(gplog_msg);
gplog_msg = NULL;
gwlan_logging.pcur_node = NULL;
spin_unlock_irqrestore(&gwlan_logging.spin_lock, irq_flag);
return -ENOMEM;
}
wake_up_process(gwlan_logging.thread);
gwlan_logging.is_active = true;
nl_srv_register(ANI_NL_MSG_LOG, wlan_logging_proc_sock_rx_msg);
//Broadcast SVC ready message to logging app/s running
wlan_logging_srv_nl_ready_indication();
return 0;
}
int wlan_logging_flush_pkt_queue(void)
{
vos_pkt_t *pkt_queue_head;
unsigned long flags;
spin_lock_irqsave(&gwlan_logging.data_mgmt_pkt_lock, flags);
if (NULL != gwlan_logging.data_mgmt_pkt_queue) {
pkt_queue_head = gwlan_logging.data_mgmt_pkt_queue;
gwlan_logging.data_mgmt_pkt_queue = NULL;
gwlan_logging.pkt_drop_cnt = 0;
gwlan_logging.data_mgmt_pkt_qcnt = 0;
spin_unlock_irqrestore(&gwlan_logging.data_mgmt_pkt_lock,
flags);
vos_pkt_return_packet(pkt_queue_head);
} else {
spin_unlock_irqrestore(&gwlan_logging.data_mgmt_pkt_lock,
flags);
}
spin_lock_irqsave(&gwlan_logging.fw_log_pkt_lock, flags);
if (NULL != gwlan_logging.fw_log_pkt_queue) {
pkt_queue_head = gwlan_logging.fw_log_pkt_queue;
gwlan_logging.fw_log_pkt_queue = NULL;
gwlan_logging.fw_log_pkt_drop_cnt = 0;
gwlan_logging.fw_log_pkt_qcnt = 0;
spin_unlock_irqrestore(&gwlan_logging.fw_log_pkt_lock,
flags);
vos_pkt_return_packet(pkt_queue_head);
} else {
spin_unlock_irqrestore(&gwlan_logging.fw_log_pkt_lock,
flags);
}
spin_lock_irqsave(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock, flags);
if (NULL != gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_queue) {
pkt_queue_head = gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_queue;
spin_unlock_irqrestore(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock,
flags);
vos_pkt_return_packet(pkt_queue_head);
wlan_free_fwr_mem_dump_buffer();
} else {
spin_unlock_irqrestore(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock,
flags);
}
return 0;
}
int wlan_logging_sock_deactivate_svc(void)
{
unsigned long irq_flag;
int i;
if (!gplog_msg)
return 0;
nl_srv_unregister(ANI_NL_MSG_LOG, wlan_logging_proc_sock_rx_msg);
clear_default_logtoapp_log_level();
gapp_pid = INVALID_PID;
INIT_COMPLETION(gwlan_logging.shutdown_comp);
gwlan_logging.exit = true;
gwlan_logging.is_active = false;
vos_set_multicast_logging(0);
wake_up_interruptible(&gwlan_logging.wait_queue);
wait_for_completion(&gwlan_logging.shutdown_comp);
spin_lock_irqsave(&gwlan_logging.spin_lock, irq_flag);
vfree(gplog_msg);
gplog_msg = NULL;
gwlan_logging.pcur_node = NULL;
spin_unlock_irqrestore(&gwlan_logging.spin_lock, irq_flag);
spin_lock_irqsave(&gwlan_logging.pkt_stats_lock, irq_flag);
/* free allocated skb */
for (i = 0; i < gwlan_logging.pkt_stat_num_buf; i++)
{
if (pkt_stats_buffers[i].skb)
dev_kfree_skb(pkt_stats_buffers[i].skb);
}
if(pkt_stats_buffers)
vos_mem_free(pkt_stats_buffers);
pkt_stats_buffers = NULL;
gwlan_logging.pkt_stats_pcur_node = NULL;
gwlan_logging.pkt_stats_enabled = false;
spin_unlock_irqrestore(&gwlan_logging.pkt_stats_lock, irq_flag);
wlan_logging_flush_pkt_queue();
return 0;
}
int wlan_logging_sock_init_svc(void)
{
spin_lock_init(&gwlan_logging.spin_lock);
spin_lock_init(&gwlan_logging.data_mgmt_pkt_lock);
spin_lock_init(&gwlan_logging.fw_log_pkt_lock);
spin_lock_init(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock);
spin_lock_init(&gwlan_logging.pkt_stats_lock);
gapp_pid = INVALID_PID;
gwlan_logging.pcur_node = NULL;
gwlan_logging.pkt_stats_pcur_node= NULL;
wlan_init_log_completion();
return 0;
}
int wlan_logging_sock_deinit_svc(void)
{
gwlan_logging.pcur_node = NULL;
gwlan_logging.pkt_stats_pcur_node = NULL;
gapp_pid = INVALID_PID;
wlan_deinit_log_completion();
return 0;
}
int wlan_queue_data_mgmt_pkt_for_app(vos_pkt_t *pPacket)
{
unsigned long flags;
vos_pkt_t *next_pkt;
vos_pkt_t *free_pkt;
VOS_STATUS status = VOS_STATUS_E_FAILURE;
spin_lock_irqsave(&gwlan_logging.data_mgmt_pkt_lock, flags);
if (gwlan_logging.data_mgmt_pkt_qcnt >= LOGGER_MAX_DATA_MGMT_PKT_Q_LEN) {
status = vos_pkt_walk_packet_chain(
gwlan_logging.data_mgmt_pkt_queue, &next_pkt, TRUE);
/*both "success" and "empty" are acceptable results*/
if (!((status == VOS_STATUS_SUCCESS) ||
(status == VOS_STATUS_E_EMPTY))) {
++gwlan_logging.pkt_drop_cnt;
spin_unlock_irqrestore(
&gwlan_logging.data_mgmt_pkt_lock, flags);
pr_err("%s: Failure walking packet chain", __func__);
/*keep returning pkts to avoid low resource cond*/
vos_pkt_return_packet(pPacket);
return VOS_STATUS_E_FAILURE;
}
free_pkt = gwlan_logging.data_mgmt_pkt_queue;
gwlan_logging.data_mgmt_pkt_queue = next_pkt;
/*returning head of pkt queue. latest pkts are important*/
--gwlan_logging.data_mgmt_pkt_qcnt;
spin_unlock_irqrestore(&gwlan_logging.data_mgmt_pkt_lock,
flags);
vos_pkt_return_packet(free_pkt);
} else {
spin_unlock_irqrestore(&gwlan_logging.data_mgmt_pkt_lock,
flags);
}
spin_lock_irqsave(&gwlan_logging.data_mgmt_pkt_lock, flags);
if (gwlan_logging.data_mgmt_pkt_queue) {
vos_pkt_chain_packet(gwlan_logging.data_mgmt_pkt_queue,
pPacket, TRUE);
} else {
gwlan_logging.data_mgmt_pkt_queue = pPacket;
}
++gwlan_logging.data_mgmt_pkt_qcnt;
spin_unlock_irqrestore(&gwlan_logging.data_mgmt_pkt_lock, flags);
set_bit(LOGGER_MGMT_DATA_PKT_POST, &gwlan_logging.event_flag);
wake_up_interruptible(&gwlan_logging.wait_queue);
return VOS_STATUS_SUCCESS;
}
/**
* wlan_logging_set_log_level() - Set the logging level
*
* This function is used to set the logging level of host debug messages
*
* Return: None
*/
void wlan_logging_set_log_level(void)
{
set_default_logtoapp_log_level();
}
int wlan_queue_fw_log_pkt_for_app(vos_pkt_t *pPacket)
{
unsigned long flags;
vos_pkt_t *next_pkt;
vos_pkt_t *free_pkt;
VOS_STATUS status = VOS_STATUS_E_FAILURE;
spin_lock_irqsave(&gwlan_logging.fw_log_pkt_lock, flags);
if (gwlan_logging.fw_log_pkt_qcnt >= LOGGER_MAX_FW_LOG_PKT_Q_LEN) {
status = vos_pkt_walk_packet_chain(
gwlan_logging.fw_log_pkt_queue, &next_pkt, TRUE);
/*both "success" and "empty" are acceptable results*/
if (!((status == VOS_STATUS_SUCCESS) ||
(status == VOS_STATUS_E_EMPTY))) {
++gwlan_logging.fw_log_pkt_drop_cnt;
spin_unlock_irqrestore(
&gwlan_logging.fw_log_pkt_lock, flags);
pr_err("%s: Failure walking packet chain", __func__);
/*keep returning pkts to avoid low resource cond*/
vos_pkt_return_packet(pPacket);
return VOS_STATUS_E_FAILURE;
}
free_pkt = gwlan_logging.fw_log_pkt_queue;
gwlan_logging.fw_log_pkt_queue = next_pkt;
/*returning head of pkt queue. latest pkts are important*/
--gwlan_logging.fw_log_pkt_qcnt;
spin_unlock_irqrestore(&gwlan_logging.fw_log_pkt_lock,
flags);
vos_pkt_return_packet(free_pkt);
} else {
spin_unlock_irqrestore(&gwlan_logging.fw_log_pkt_lock,
flags);
}
spin_lock_irqsave(&gwlan_logging.fw_log_pkt_lock, flags);
if (gwlan_logging.fw_log_pkt_queue) {
vos_pkt_chain_packet(gwlan_logging.fw_log_pkt_queue,
pPacket, TRUE);
} else {
gwlan_logging.fw_log_pkt_queue = pPacket;
}
++gwlan_logging.fw_log_pkt_qcnt;
spin_unlock_irqrestore(&gwlan_logging.fw_log_pkt_lock, flags);
set_bit(LOGGER_FW_LOG_PKT_POST, &gwlan_logging.event_flag);
wake_up_interruptible(&gwlan_logging.wait_queue);
return VOS_STATUS_SUCCESS;
}
int wlan_queue_fw_mem_dump_for_app(vos_pkt_t *pPacket)
{
unsigned long flags;
vos_pkt_t *next_pkt;
vos_pkt_t *free_pkt;
VOS_STATUS status = VOS_STATUS_E_FAILURE;
spin_lock_irqsave(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock, flags);
if (gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_pkt_qcnt >= LOGGER_MAX_FW_MEM_DUMP_PKT_Q_LEN) {
status = vos_pkt_walk_packet_chain(
gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_queue, &next_pkt, TRUE);
/*both "success" and "empty" are acceptable results*/
if (!((status == VOS_STATUS_SUCCESS) ||
(status == VOS_STATUS_E_EMPTY))) {
spin_unlock_irqrestore(
&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock, flags);
pr_err("%s: Failure walking packet chain", __func__);
/*keep returning pkts to avoid low resource cond*/
vos_pkt_return_packet(pPacket);
return VOS_STATUS_E_FAILURE;
}
free_pkt = gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_queue;
gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_queue = next_pkt;
/*returning head of pkt queue. latest pkts are important*/
--gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_pkt_qcnt;
++gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_pkt_drop_cnt ;
spin_unlock_irqrestore(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock,
flags);
pr_info("%s : fw mem_dump pkt cnt --> %d\n" ,__func__, gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_pkt_drop_cnt);
vos_pkt_return_packet(free_pkt);
} else {
spin_unlock_irqrestore(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock,
flags);
}
spin_lock_irqsave(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock, flags);
if (gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_queue) {
vos_pkt_chain_packet(gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_queue,
pPacket, TRUE);
} else {
gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_queue = pPacket;
}
++gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_pkt_qcnt;
spin_unlock_irqrestore(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock, flags);
set_bit(LOGGER_FW_MEM_DUMP_PKT_POST, &gwlan_logging.event_flag);
wake_up_interruptible(&gwlan_logging.wait_queue);
return VOS_STATUS_SUCCESS;
}
int wlan_queue_logpkt_for_app(vos_pkt_t *pPacket, uint32 pkt_type)
{
VOS_STATUS status = VOS_STATUS_E_FAILURE;
if (pPacket == NULL) {
pr_err("%s: Null param", __func__);
VOS_ASSERT(0);
return VOS_STATUS_E_FAILURE;
}
if (gwlan_logging.is_active == false) {
/*return all packets queued*/
wlan_logging_flush_pkt_queue();
/*return currently received pkt*/
vos_pkt_return_packet(pPacket);
return VOS_STATUS_E_FAILURE;
}
switch (pkt_type) {
case WLAN_MGMT_FRAME_LOGS:
status = wlan_queue_data_mgmt_pkt_for_app(pPacket);
break;
case WLAN_FW_LOGS:
status = wlan_queue_fw_log_pkt_for_app(pPacket);
break;
case WLAN_FW_MEMORY_DUMP:
status = wlan_queue_fw_mem_dump_for_app(pPacket);
break;
default:
pr_info("%s: Unknown pkt received %d", __func__, pkt_type);
status = VOS_STATUS_E_INVAL;
break;
};
return status;
}
void wlan_process_done_indication(uint8 type, uint32 reason_code)
{
if (FALSE == sme_IsFeatureSupportedByFW(MEMORY_DUMP_SUPPORTED))
{
if ((type == WLAN_FW_LOGS) &&
(wlan_is_log_report_in_progress() == TRUE))
{
pr_info("%s: Setting LOGGER_FATAL_EVENT %d\n",
__func__, reason_code);
set_bit(LOGGER_FATAL_EVENT_POST, &gwlan_logging.event_flag);
wake_up_interruptible(&gwlan_logging.wait_queue);
}
return;
}
if ((type == WLAN_FW_LOGS) && reason_code &&
vos_isFatalEventEnabled() &&
vos_is_wlan_logging_enabled())
{
if(wlan_is_log_report_in_progress() == TRUE)
{
pr_info("%s: Setting LOGGER_FATAL_EVENT %d\n",
__func__, reason_code);
set_bit(LOGGER_FATAL_EVENT_POST, &gwlan_logging.event_flag);
wake_up_interruptible(&gwlan_logging.wait_queue);
}
else
{
unsigned long flags;
/* Drop FW initiated fatal event for
* LIMIT_FW_FATAL_EVENT_MS if received for same reason.
*/
spin_lock_irqsave(&gwlan_logging.bug_report_lock,
flags);
if ((reason_code ==
gwlan_logging.log_complete.last_fw_bug_reason) &&
((vos_timer_get_system_time() -
gwlan_logging.log_complete.last_fw_bug_timestamp)
< LIMIT_FW_FATAL_EVENT_MS)) {
spin_unlock_irqrestore(
&gwlan_logging.bug_report_lock,
flags);
pr_info("%s: Ignoring Fatal event from firmware for reason %d\n",
__func__, reason_code);
return;
}
gwlan_logging.log_complete.last_fw_bug_reason =
reason_code;
gwlan_logging.log_complete.last_fw_bug_timestamp =
vos_timer_get_system_time();
spin_unlock_irqrestore(&gwlan_logging.bug_report_lock,
flags);
/*Firmware Initiated*/
pr_info("%s : FW triggered Fatal Event, reason_code : %d\n", __func__,
reason_code);
wlan_set_log_completion(WLAN_LOG_TYPE_FATAL,
WLAN_LOG_INDICATOR_FIRMWARE,
reason_code);
set_bit(LOGGER_FATAL_EVENT_POST, &gwlan_logging.event_flag);
wake_up_interruptible(&gwlan_logging.wait_queue);
}
}
if(type == WLAN_FW_MEMORY_DUMP && vos_is_wlan_logging_enabled())
{
pr_info("%s: Setting FW MEM DUMP LOGGER event\n", __func__);
set_bit(LOGGER_FW_MEM_DUMP_PKT_POST_DONE, &gwlan_logging.event_flag);
wake_up_interruptible(&gwlan_logging.wait_queue);
}
}
/**
* wlan_flush_host_logs_for_fatal() -flush host logs and send
* fatal event to upper layer.
*/
void wlan_flush_host_logs_for_fatal()
{
unsigned long flags;
if (wlan_is_log_report_in_progress()) {
pr_info("%s:flush all host logs Setting HOST_LOG_POST\n",
__func__);
spin_lock_irqsave(&gwlan_logging.spin_lock, flags);
wlan_queue_logmsg_for_app();
spin_unlock_irqrestore(&gwlan_logging.spin_lock, flags);
set_bit(HOST_LOG_POST, &gwlan_logging.event_flag);
wake_up_interruptible(&gwlan_logging.wait_queue);
}
}
/**
* wlan_is_logger_thread()- Check if threadid is
* of logger thread
*
* @threadId: passed threadid
*
* This function is called to check if threadid is
* of logger thread.
*
* Return: true if threadid is of logger thread.
*/
bool wlan_is_logger_thread(int threadId)
{
return ((gwlan_logging.thread) &&
(threadId == gwlan_logging.thread->pid));
}
int wlan_fwr_mem_dump_buffer_allocation(void)
{
/*Allocate the dump memory as reported by fw.
or if feature not supported just report to the user */
if(gwlan_logging.fw_mem_dump_ctx.fw_dump_max_size <= 0)
{
pr_err("%s: fw_mem_dump_req not supported by firmware", __func__);
return -EFAULT;
}
gwlan_logging.fw_mem_dump_ctx.fw_dump_start_loc =
(uint8 *)vos_mem_vmalloc(gwlan_logging.fw_mem_dump_ctx.fw_dump_max_size);
gwlan_logging.fw_mem_dump_ctx.fw_dump_current_loc = gwlan_logging.fw_mem_dump_ctx.fw_dump_start_loc;
if(NULL == gwlan_logging.fw_mem_dump_ctx.fw_dump_start_loc)
{
pr_err("%s: fw_mem_dump_req alloc failed for size %d bytes", __func__,gwlan_logging.fw_mem_dump_ctx.fw_dump_max_size);
return -ENOMEM;
}
vos_mem_zero(gwlan_logging.fw_mem_dump_ctx.fw_dump_start_loc,gwlan_logging.fw_mem_dump_ctx.fw_dump_max_size);
return 0;
}
/*set the current fw mem dump state*/
void wlan_set_fwr_mem_dump_state(enum FW_MEM_DUMP_STATE fw_mem_dump_state)
{
unsigned long flags;
spin_lock_irqsave(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock, flags);
gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_status = fw_mem_dump_state;
spin_unlock_irqrestore(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock, flags);
}
/*check for new request validity and free memory if present from previous request */
bool wlan_fwr_mem_dump_test_and_set_write_allowed_bit(){
unsigned long flags;
bool ret = false;
bool write_done = false;
spin_lock_irqsave(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock, flags);
if(gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_status == FW_MEM_DUMP_IDLE){
ret = true;
gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_status = FW_MEM_DUMP_WRITE_IN_PROGRESS;
}
else if(gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_status == FW_MEM_DUMP_WRITE_DONE){
ret = true;
write_done = true;
gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_status = FW_MEM_DUMP_WRITE_IN_PROGRESS;
}
spin_unlock_irqrestore(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock, flags);
pr_info("%s:fw mem dump state --> %d ", __func__,gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_status);
if(write_done)
wlan_free_fwr_mem_dump_buffer();
return ret;
}
bool wlan_fwr_mem_dump_test_and_set_read_allowed_bit(){
unsigned long flags;
bool ret=false;
spin_lock_irqsave(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock, flags);
if(gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_status == FW_MEM_DUMP_WRITE_DONE ||
gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_status == FW_MEM_DUMP_READ_IN_PROGRESS ){
ret = true;
gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_status = FW_MEM_DUMP_READ_IN_PROGRESS;
}
spin_unlock_irqrestore(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock, flags);
//pr_info("%s:fw mem dump state --> %d ", __func__,gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_status);
return ret;
}
size_t wlan_fwr_mem_dump_fsread_handler(char __user *buf,
size_t count, loff_t *pos,loff_t* bytes_left)
{
if (buf == NULL || gwlan_logging.fw_mem_dump_ctx.fw_dump_start_loc == NULL)
{
pr_err("%s : start loc : %p buf : %p ",__func__,gwlan_logging.fw_mem_dump_ctx.fw_dump_start_loc,buf);
return 0;
}
if (*pos < 0) {
pr_err("Invalid start offset for memdump read");
return 0;
} else if (*pos >= gwlan_logging.fw_mem_dump_ctx.fw_dump_max_size || !count) {
pr_err("No more data to copy");
return 0;
} else if (count > gwlan_logging.fw_mem_dump_ctx.fw_dump_max_size - *pos) {
count = gwlan_logging.fw_mem_dump_ctx.fw_dump_max_size - *pos;
}
if (copy_to_user(buf, gwlan_logging.fw_mem_dump_ctx.fw_dump_start_loc, count)) {
pr_err("%s copy to user space failed",__func__);
return 0;
}
/* offset(pos) should be updated here based on the copy done*/
*pos += count;
*bytes_left = gwlan_logging.fw_mem_dump_ctx.fw_dump_max_size - *pos;
return count;
}
void wlan_set_svc_fw_mem_dump_req_cb (void * fw_mem_dump_req_cb, void * fw_mem_dump_req_cb_arg)
{
unsigned long flags;
spin_lock_irqsave(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock, flags);
gwlan_logging.fw_mem_dump_ctx.svc_fw_mem_dump_req_cb = fw_mem_dump_req_cb;
gwlan_logging.fw_mem_dump_ctx.svc_fw_mem_dump_req_cb_arg = fw_mem_dump_req_cb_arg;
spin_unlock_irqrestore(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock, flags);
}
void wlan_free_fwr_mem_dump_buffer (void )
{
unsigned long flags;
void * tmp = NULL;
spin_lock_irqsave(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock, flags);
tmp = gwlan_logging.fw_mem_dump_ctx.fw_dump_start_loc;
gwlan_logging.fw_mem_dump_ctx.fw_dump_start_loc = NULL;
gwlan_logging.fw_mem_dump_ctx.fw_dump_current_loc = NULL;
spin_unlock_irqrestore(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock, flags);
// Don't set fw_dump_max_size to 0, only free the buffera
if(tmp != NULL)
vos_mem_vfree((void *)tmp);
}
void wlan_store_fwr_mem_dump_size(uint32 dump_size)
{
unsigned long flags;
spin_lock_irqsave(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock, flags);
//Store the dump size
gwlan_logging.fw_mem_dump_ctx.fw_dump_max_size = dump_size;
spin_unlock_irqrestore(&gwlan_logging.fw_mem_dump_ctx.fw_mem_dump_lock, flags);
}
/**
* wlan_indicate_mem_dump_complete() - When H2H for mem
* dump finish invoke the handler.
*
* This is a handler used to indicate user space about the
* availability for firmware memory dump via vendor event.
*
* Return: None
*/
void wlan_indicate_mem_dump_complete(bool status )
{
hdd_context_t *hdd_ctx;
void *vos_ctx;
int ret;
struct sk_buff *skb = NULL;
vos_ctx = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
if (!vos_ctx) {
pr_err("Invalid VOS context");
return;
}
hdd_ctx = vos_get_context(VOS_MODULE_ID_HDD, vos_ctx);
if(!hdd_ctx) {
pr_err("Invalid HDD context");
return;
}
ret = wlan_hdd_validate_context(hdd_ctx);
if (0 != ret) {
pr_err("HDD context is not valid");
return;
}
skb = cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy,
sizeof(uint32_t) + NLA_HDRLEN + NLMSG_HDRLEN);
if (!skb) {
pr_err("cfg80211_vendor_event_alloc failed");
return;
}
if(status)
{
if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_MEMDUMP_SIZE,
gwlan_logging.fw_mem_dump_ctx.fw_dump_max_size)) {
pr_err("nla put fail");
goto nla_put_failure;
}
}
else
{
pr_err("memdump failed.Returning size 0 to user");
if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_MEMDUMP_SIZE,
0)) {
pr_err("nla put fail");
goto nla_put_failure;
}
}
/*indicate mem dump complete*/
cfg80211_vendor_cmd_reply(skb);
pr_info("Memdump event sent successfully to user space : recvd size %d",(int)(gwlan_logging.fw_mem_dump_ctx.fw_dump_current_loc - gwlan_logging.fw_mem_dump_ctx.fw_dump_start_loc));
return;
nla_put_failure:
kfree_skb(skb);
return;
}
#ifdef FEATURE_WLAN_DIAG_SUPPORT
/**
* wlan_report_log_completion() - Report bug report completion to userspace
* @is_fatal: Type of event, fatal or not
* @indicator: Source of bug report, framework/host/firmware
* @reason_code: Reason for triggering bug report
*
* This function is used to report the bug report completion to userspace
*
* Return: None
*/
void wlan_report_log_completion(uint32_t is_fatal,
uint32_t indicator,
uint32_t reason_code)
{
WLAN_VOS_DIAG_EVENT_DEF(wlan_diag_event,
struct vos_event_wlan_log_complete);
wlan_diag_event.is_fatal = is_fatal;
wlan_diag_event.indicator = indicator;
wlan_diag_event.reason_code = reason_code;
wlan_diag_event.reserved = 0;
WLAN_VOS_DIAG_EVENT_REPORT(&wlan_diag_event, EVENT_WLAN_LOG_COMPLETE);
}
#endif
#endif /* WLAN_LOGGING_SOCK_SVC_ENABLE */
|
the_stack_data/132952543.c | #include <assert.h>
#include <ctype.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char* readline();
char* ltrim(char*);
char* rtrim(char*);
char** split_string(char*);
int parse_int(char*);
/*
* Complete the 'solve' function below.
*
* The function is expected to return a STRING.
* The function accepts 2D_INTEGER_ARRAY points as parameter.
*/
/*
* To return the string from the function, you should either do static allocation or dynamic allocation
*
* For example,
* char* return_string_using_static_allocation() {
* static char s[] = "static allocation of string";
*
* return s;
* }
*
* char* return_string_using_dynamic_allocation() {
* char* s = malloc(100 * sizeof(char));
*
* s = "dynamic allocation of string";
*
* return s;
* }
*
*/
char* solve(int points_rows, int points_columns, int** points) {
int x[4] = {0}, y[4] = {0}, z[4] = {0};
for (int i = 0; i < points_rows; i++) {
for (int j = 0; j < points_columns; j++) {
if (j ==0)
{
x[i] = *(*(points + i) + j);
}
else if (j ==1)
{
y[i] = *(*(points + i) + j);
}
else if (j ==2)
{
z[i] = *(*(points + i) + j);
}
}
}
for(int i = 1;i < 4;++i){
x[i] -= x[0];
y[i] -= y[0];
z[i] -= z[0];
}
int det = x[1] * y[2] * z[3] + x[2] * y[3] * z[1] + x[3] * y[1] * z[2] - z[1] * y[2] * x[3] - z[2] * y[3] * x[1] - z[3] * y[1] * x[2];
return det == 0? "YES" : "NO";
}
int main()
{
FILE* fptr = fopen(getenv("OUTPUT_PATH"), "w");
int t = parse_int(ltrim(rtrim(readline())));
for (int t_itr = 0; t_itr < t; t_itr++) {
int** points = malloc(4 * sizeof(int*));
for (int i = 0; i < 4; i++) {
*(points + i) = malloc(3 * (sizeof(int)));
char** points_item_temp = split_string(rtrim(readline()));
for (int j = 0; j < 3; j++) {
int points_item = parse_int(*(points_item_temp + j));
*(*(points + i) + j) = points_item;
}
}
char* result = solve(4, 3, points);
fprintf(fptr, "%s\n", result);
}
fclose(fptr);
return 0;
}
char* readline() {
size_t alloc_length = 1024;
size_t data_length = 0;
char* data = malloc(alloc_length);
while (true) {
char* cursor = data + data_length;
char* line = fgets(cursor, alloc_length - data_length, stdin);
if (!line) {
break;
}
data_length += strlen(cursor);
if (data_length < alloc_length - 1 || data[data_length - 1] == '\n') {
break;
}
alloc_length <<= 1;
data = realloc(data, alloc_length);
if (!data) {
data = '\0';
break;
}
}
if (data[data_length - 1] == '\n') {
data[data_length - 1] = '\0';
data = realloc(data, data_length);
if (!data) {
data = '\0';
}
} else {
data = realloc(data, data_length + 1);
if (!data) {
data = '\0';
} else {
data[data_length] = '\0';
}
}
return data;
}
char* ltrim(char* str) {
if (!str) {
return '\0';
}
if (!*str) {
return str;
}
while (*str != '\0' && isspace(*str)) {
str++;
}
return str;
}
char* rtrim(char* str) {
if (!str) {
return '\0';
}
if (!*str) {
return str;
}
char* end = str + strlen(str) - 1;
while (end >= str && isspace(*end)) {
end--;
}
*(end + 1) = '\0';
return str;
}
char** split_string(char* str) {
char** splits = NULL;
char* token = strtok(str, " ");
int spaces = 0;
while (token) {
splits = realloc(splits, sizeof(char*) * ++spaces);
if (!splits) {
return splits;
}
splits[spaces - 1] = token;
token = strtok(NULL, " ");
}
return splits;
}
int parse_int(char* str) {
char* endptr;
int value = strtol(str, &endptr, 10);
if (endptr == str || *endptr != '\0') {
exit(EXIT_FAILURE);
}
return value;
}
|
the_stack_data/1063510.c | /*
** 注意一个特征,left最小到0,而right可以无限扩大。
** 这恰好与left的值一致。
*/
int searchInsert(int* nums, int numsSize, int target) {
int l, r, m;
l = 0;
r = numsSize-1;
while (l <= r) {
m = l + (r-l)/2;
if (nums[m] == target)
return m;
else if (target > nums[m])
l = m + 1;
else
r = m - 1;
}
return l;
} |
the_stack_data/179830802.c | #include <stdlib.h>
int main()
{
system("ps -f");
system("mkdir aaa");
system("ls -l");
system("rm -r aaa");
system("ls -l");
return 0;
}
|
the_stack_data/74947.c | // ----------------------------------------------------------------------------
// Copyright 2015-2017 ARM Ltd.
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------
// This critical section implementation is generic for mbed OS targets,
// except Nordic ones
#if defined(TARGET_LIKE_MBED) && !defined(TARGET_NORDIC)
#include <stdint.h> // uint32_t, UINT32_MAX
#include <stddef.h> // NULL
#if defined(MBED_EDGE_BUILD_CFG_MBED_OS)
#include "cmsis-core/core_generic.h" //__disable_irq, __enable_irq
#else
#include "cmsis.h"
#endif
#include <assert.h>
// Module include
#include "aq_critical.h"
static volatile uint32_t interruptEnableCounter = 0;
static volatile uint32_t critical_primask = 0;
void aq_critical_section_enter()
{
uint32_t primask = __get_PRIMASK(); // get the current interrupt enabled state
__disable_irq();
// Save the interrupt enabled state as it was prior to any nested critical section lock use
if (!interruptEnableCounter) {
critical_primask = primask & 0x1;
}
/* If the interruptEnableCounter overflows or we are in a nested critical section and interrupts
are enabled, then something has gone badly wrong thus assert an error.
*/
/* FIXME: This assertion needs to be commented out for the moment, as it
* triggers a fault when uVisor is enabled. For more information on
* the fault please checkout ARMmbed/mbed-drivers#176. */
/* assert(interruptEnableCounter < UINT32_MAX); */
if (interruptEnableCounter > 0) {
/* FIXME: This assertion needs to be commented out for the moment, as it
* triggers a fault when uVisor is enabled. For more information
* on the fault please checkout ARMmbed/mbed-drivers#176. */
/* assert(primask & 0x1); */
}
interruptEnableCounter++;
}
void aq_critical_section_exit()
{
// If critical_section_enter has not previously been called, do nothing
if (interruptEnableCounter) {
uint32_t primask = __get_PRIMASK(); // get the current interrupt enabled state
/* FIXME: This assertion needs to be commented out for the moment, as it
* triggers a fault when uVisor is enabled. For more information
* on the fault please checkout ARMmbed/mbed-drivers#176. */
/* assert(primask & 0x1); // Interrupts must be disabled on invoking an exit from a critical section */
interruptEnableCounter--;
/* Only re-enable interrupts if we are exiting the last of the nested critical sections and
interrupts were enabled on entry to the first critical section.
*/
if (!interruptEnableCounter && !critical_primask) {
__enable_irq();
}
}
}
#endif // defined(TARGET_LIKE_MBED) && !defined(TARGET_NORDIC)
|
the_stack_data/43886928.c |
/*
* Compile using the command:
* `cc 27Stencil.c -o oa -fopenmp -lm`
*/
#include <math.h>
#include <omp.h>
#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#ifdef _OPENACC
#include <openacc.h>
#endif
#define DEFAULT_DATASIZE 1048576 /* Default datasize. */
#define DEFAULT_REPS 10 /* Default repetitions. */
#define CONF95 1.96
#define ITERATIONS 10
#define FAC (1./26)
#define TOLERANCE 1.0e-15
extern int reps; /* Repetitions. */
extern double *times; /* Array to store results in. */
extern int flag; /* Flag to set CPU or GPU invocation. */
extern unsigned int datasize; /* Datasize passed to benchmark functions. */
unsigned int datasize = -1; /* Datasize for tests in bytes. */
int reps = -1; /* Repetitions. */
double *times; /* Array of doubles storing the benchmark times in microseconds. */
double testtime; /* The average test time in microseconds for reps runs. */
double testsd; /* The standard deviation in the test time in microseconds for reps runs. */
int flag = 0; /* 0 indicates CPU. */
/*
* Function prototypes for common functions.
*/
void init(int argc, char **argv);
void finalisetest(char *);
void finalise(void);
void benchmark(char *, double (*test)(void));
void print_results(char *, double, double);
/* Forward Declarations of utility functions*/
double max_diff(double *, double *, int);
void wul();
void usage(char *argv[]) {
printf("Usage: %s \n"
"\t--reps <repetitions> (default %d)\n"
"\t--datasize <datasize> (default %d bytes)\n",
argv[0],
DEFAULT_REPS, DEFAULT_DATASIZE);
}
/*
* This function parses the parameters from the command line.
*/
void parse_args(int argc, char *argv[]) {
int arg;
for (arg = 1; arg < argc; arg++) {
if (strcmp(argv[arg], "--reps") == 0) {
reps = atoi(argv[++arg]);
if (reps == 0) {
printf("Invalid integer:--reps: %s\n", argv[arg]);
usage(argv);
exit(EXIT_FAILURE);
}
} else if (strcmp(argv[arg], "--datasize") == 0) {
datasize = atoi(argv[++arg]);
if (datasize == 0) {
printf("Invalid integer:--datasize: %s\n", argv[arg]);
usage(argv);
exit(EXIT_FAILURE);
}
} else if (strcmp(argv[arg], "-h") == 0) {
usage(argv);
exit(EXIT_SUCCESS);
} else {
printf("Invalid parameters: %s\n", argv[arg]);
usage(argv);
exit(EXIT_FAILURE);
}
}
}
void stats(double *mtp, double *sdp) {
double meantime, totaltime, sumsq, mintime, maxtime, sd;
int i, good_reps;
mintime = 1.0e10;
maxtime = 0.;
totaltime = 0.;
good_reps = 0;
for (i = 0; i < reps; i++) {
/* Skip entries where times is 0, this indicates an error occured */
if (times[i] != 0){
mintime = (mintime < times[i]) ? mintime : times[i];
maxtime = (maxtime > times[i]) ? maxtime : times[i];
totaltime += times[i];
good_reps++;
}
}
meantime = totaltime / good_reps;
sumsq = 0;
for (i = 0; i < reps; i++) {
if (times[i] != 0){
sumsq += (times[i] - meantime) * (times[i] - meantime);
}
}
sd = sqrt(sumsq / good_reps);
*mtp = meantime;
*sdp = sd;
}
/*
* This function prints the results of the tests.
* If you use a compiler which sets a different preprocessor flag
* you may wish to add it here.
*/
void print_results(char *name, double testtime, double testsd) {
char compiler[20];
/* Set default compiler idetifier. */
sprintf(compiler, "COMPILER");
/* Set compiler identifier based on known preprocessor flags. */
#ifdef __PGI
sprintf(compiler, "PGI");
#endif
#ifdef __HMPP
sprintf(compiler, "CAPS");
#endif
//printf("%s %s %d %f %f\n", compiler, name, datasize, testtime*1e6, CONF95*testsd*1e6);
printf("%f\n", testtime*1e6);
}
/*
* This function initialises the storage for the test results and set the defaults.
*/
void init(int argc, char **argv)
{
parse_args(argc, argv);
if (reps == -1) {
reps = DEFAULT_REPS;
}
if (datasize == (unsigned int)-1) {
datasize = DEFAULT_DATASIZE;
}
times = (double *)malloc((reps) * sizeof(double));
/*
#ifdef __PGI
acc_init(acc_device_nvidia);
// printf("PGI INIT\n");
#endif
#ifdef __HMPP
int a[5] = {1,2,3,4,5};
#pragma acc data copyin(a[0:5])
{}
#endif
#ifdef _CRAYC
int a[5] = {1,2,3,4,5};
#pragma acc data copyin(a[0:5])
{}
#endif
*/
}
void finalise(void) {
free(times);
}
/*
* This function runs the benchmark specified.
*/
void benchmark(char *name, double (*test)(void))
{
int i = 0;
double tmp = 0;
for (i=0; i<reps; i++) {
tmp = test();
if (tmp == -10000){
printf("Memory allocation failure in %s\n", name);
times[i] = 0;
}
else if (tmp == -11000){
printf("CPU/GPU mismatch in %s\n", name);
times[i] = 0;
}
else{
times[i] = tmp;
}
}
stats(&testtime, &testsd);
//printf("in benchmark\n");
print_results(name, testtime, testsd);
//printf("printed result\n");
}
double stencil()
{
extern unsigned int datasize;
int sz = cbrt((datasize/sizeof(double))/2);
int i, j, k, iter;
int n = sz-2;
double fac = FAC;
double t1, t2;
double md;
//printf("size = %d\n", sz);
/* Work buffers, with halos */
double *a0 = (double*)malloc(sizeof(double)*sz*sz*sz);
double *device_result = (double*)malloc(sizeof(double)*sz*sz*sz);
double *a1 = (double*)malloc(sizeof(double)*sz*sz*sz);
double *host_result = (double*)malloc(sizeof(double)*sz*sz*sz);
double *a0_init = (double*)malloc(sizeof(double)*sz*sz*sz);
if(a0==NULL||device_result==NULL||a1==NULL||host_result==NULL||a0_init==NULL){
/* Something went wrong in the memory allocation here, fail gracefully */
return(-10000);
}
/* initialize input array a0 */
/* zero all of array (including halos) */
//printf("size = %d\n", sz);
for (i = 0; i < sz; i++) {
for (j = 0; j < sz; j++) {
for (k = 0; k < sz; k++) {
a0[i*sz*sz+j*sz+k] = 0.0;
//printf("%d\t", (i*sz*sz+j*sz+k));
}
}
}
//printf("\n");
//int size_of_a0 = sizeof(a0) / sizeof(*a0);
//printf("size of a0 = %d\n", size_of_a0);
/* use random numbers to fill interior */
for (i = 1; i < n+1; i++) {
for (j = 1; j < n+1; j++) {
for (k = 1; k < n+1; k++) {
a0[i*sz*sz+j*sz+k] = (double) rand()/ (double)(1.0 + RAND_MAX);
}
}
}
/* memcpy(&a0_init[0], &a0[0], sizeof(double)*sz*sz*sz); */
/* save initial input array for later GPU run */
for (i = 0; i < sz; i++) {
for (j = 0; j < sz; j++) {
for (k = 0; k < sz; k++) {
a0_init[i*sz*sz+j*sz+k] = a0[i*sz*sz+j*sz+k];
}
}
}
//printf("Host computation\n");
/* run main computation on host */
for (iter = 0; iter < ITERATIONS; iter++) {
for (i = 1; i < n+1; i++) {
for (j = 1; j < n+1; j++) {
for (k = 1; k < n+1; k++) {
a1[i*sz*sz+j*sz+k] = (
a0[i*sz*sz+(j-1)*sz+k] + a0[i*sz*sz+(j+1)*sz+k] +
a0[(i-1)*sz*sz+j*sz+k] + a0[(i+1)*sz*sz+j*sz+k] +
a0[(i-1)*sz*sz+(j-1)*sz+k] + a0[(i-1)*sz*sz+(j+1)*sz+k] +
a0[(i+1)*sz*sz+(j-1)*sz+k] + a0[(i+1)*sz*sz+(j+1)*sz+k] +
a0[i*sz*sz+(j-1)*sz+(k-1)] + a0[i*sz*sz+(j+1)*sz+(k-1)] +
a0[(i-1)*sz*sz+j*sz+(k-1)] + a0[(i+1)*sz*sz+j*sz+(k-1)] +
a0[(i-1)*sz*sz+(j-1)*sz+(k-1)] + a0[(i-1)*sz*sz+(j+1)*sz+(k-1)] +
a0[(i+1)*sz*sz+(j-1)*sz+(k-1)] + a0[(i+1)*sz*sz+(j+1)*sz+(k-1)] +
a0[i*sz*sz+(j-1)*sz+(k+1)] + a0[i*sz*sz+(j+1)*sz+(k+1)] +
a0[(i-1)*sz*sz+j*sz+(k+1)] + a0[(i+1)*sz*sz+j*sz+(k+1)] +
a0[(i-1)*sz*sz+(j-1)*sz+(k+1)] + a0[(i-1)*sz*sz+(j+1)*sz+(k+1)] +
a0[(i+1)*sz*sz+(j-1)*sz+(k+1)] + a0[(i+1)*sz*sz+(j+1)*sz+(k+1)] +
a0[i*sz*sz+j*sz+(k-1)] + a0[i*sz*sz+j*sz+(k+1)]
) * fac;
}
}
}
for (i = 1; i < n+1; i++) {
for (j = 1; j < n+1; j++) {
for (k = 1; k < n+1; k++) {
a0[i*sz*sz+j*sz+k] = a1[i*sz*sz+j*sz+k];
}
}
}
} /* end iteration loop */
/* save result */
/* memcpy(&host_result[0], &a0[0], sizeof(double)*sz*sz*sz); */
for (i = 0; i < sz; i++) {
for (j = 0; j < sz; j++) {
for (k = 0; k < sz; k++) {
host_result[i*sz*sz+j*sz+k] = a0[i*sz*sz+j*sz+k];
// printf("%lf\t", a0[i*sz*sz+j*sz+k]);
}
}
}
//int size = sizeof(host_result)/sizeof(host_result[0]);
//for(i = 0; i < size; i++) {
// printf("%lf\t", host_result[i]);
//}
//printf("\n");
/* copy initial array back to a0 */
/* memcpy(&a0[0], &a0_init[0], sizeof(double)*sz*sz*sz); */
for (i = 0; i < sz; i++) {
for (j = 0; j < sz; j++) {
for (k = 0; k < sz; k++) {
a0[i*sz*sz+j*sz+k] = a0_init[i*sz*sz+j*sz+k];
}
}
}
//printf("Starting acc pragma code\n");
t1 = omp_get_wtime();
#pragma acc data copy(a0[0:sz*sz*sz]), create(a1[0:sz*sz*sz], i,j,k,iter), copyin(sz,fac,n)
{
for (iter = 0; iter < ITERATIONS; iter++) {
#pragma omp parallel for
for (i = 1; i < n+1; i++) {
#pragma omp parallel for num_threads(2)
for (j = 1; j < n+1; j++) {
for (k = 1; k < n+1; k++) {
a1[i*sz*sz+j*sz+k] = (
a0[i*sz*sz+(j-1)*sz+k] + a0[i*sz*sz+(j+1)*sz+k] +
a0[(i-1)*sz*sz+j*sz+k] + a0[(i+1)*sz*sz+j*sz+k] +
a0[(i-1)*sz*sz+(j-1)*sz+k] + a0[(i-1)*sz*sz+(j+1)*sz+k] +
a0[(i+1)*sz*sz+(j-1)*sz+k] + a0[(i+1)*sz*sz+(j+1)*sz+k] +
a0[i*sz*sz+(j-1)*sz+(k-1)] + a0[i*sz*sz+(j+1)*sz+(k-1)] +
a0[(i-1)*sz*sz+j*sz+(k-1)] + a0[(i+1)*sz*sz+j*sz+(k-1)] +
a0[(i-1)*sz*sz+(j-1)*sz+(k-1)] + a0[(i-1)*sz*sz+(j+1)*sz+(k-1)] +
a0[(i+1)*sz*sz+(j-1)*sz+(k-1)] + a0[(i+1)*sz*sz+(j+1)*sz+(k-1)] +
a0[i*sz*sz+(j-1)*sz+(k+1)] + a0[i*sz*sz+(j+1)*sz+(k+1)] +
a0[(i-1)*sz*sz+j*sz+(k+1)] + a0[(i+1)*sz*sz+j*sz+(k+1)] +
a0[(i-1)*sz*sz+(j-1)*sz+(k+1)] + a0[(i-1)*sz*sz+(j+1)*sz+(k+1)] +
a0[(i+1)*sz*sz+(j-1)*sz+(k+1)] + a0[(i+1)*sz*sz+(j+1)*sz+(k+1)] +
a0[i*sz*sz+j*sz+(k-1)] + a0[i*sz*sz+j*sz+(k+1)]
) * fac;
}
}
}
#pragma acc parallel loop
for (i = 1; i < n+1; i++) {
#pragma acc loop
for (j = 1; j < n+1; j++) {
#pragma acc loop
for (k = 1; k < n+1; k++) {
a0[i*sz*sz+j*sz+k] = a1[i*sz*sz+j*sz+k];
}
}
}
} /* end iteration loop */
} /* end data region */
#pragma acc wait
t2 = omp_get_wtime();
memcpy(&device_result[0], &a0[0], sizeof(double)*sz*sz*sz);
md = max_diff(&host_result[0],&device_result[0], sz);
/* Free malloc'd memory to prevent leaks */
free(a0);
free(a0_init);
free(a1);
free(host_result);
free(device_result);
//printf("md: %lf \t tolerance: %lf", md, TOLERANCE);
if (md < TOLERANCE ){
//printf ("GPU matches host to within tolerance of %1.1e\n\n", TOLERANCE);
return(t2 - t1);
}
else{
// printf ("WARNING: GPU does not match to within tolerance of %1.1e\nIt is %lf\n", TOLERANCE, md);
return(-11000);
}
}
/* Utility Functions */
double max_diff(double *array1,double *array2, int sz)
{
double tmpdiff, diff;
int i,j,k;
int n = sz-2;
diff=0.0;
for (i = 1; i < n+1; i++) {
for (j = 1; j < n+1; j++) {
for (k = 1; k < n+1; k++) {
tmpdiff = fabs(array1[i*sz*sz+j*sz+k] - array2[i*sz*sz+j*sz+k]);
//printf("diff: %lf", tmpdiff);
if (tmpdiff > diff) diff = tmpdiff;
}
}
}
return diff;
}
/*
* This function ensures the device is awake.
* It is more portable than acc_init().
*/
void wul(){
int data = 8192;
double *arr_a = (double *)malloc(sizeof(double) * data);
double *arr_b = (double *)malloc(sizeof(double) * data);
int i = 0;
if (arr_a==NULL||arr_b==NULL) {
printf("Unable to allocate memory in wul.\n");
}
for (i=0;i<data;i++){
arr_a[i] = (double) (rand()/(1.0+RAND_MAX));
}
#pragma acc data copy(arr_b[0:data]), copyin(arr_a[0:data])
{
#pragma acc parallel loop
for (i=0;i<data;i++){
arr_b[i] = arr_a[i] * 2;
}
}
if (arr_a[0] < 0){
printf("Error in WUL\n");
/*
* This should never be called as rands should be in the range (0,1].
* This stops clever optimizers.
*/
}
free(arr_a);
free(arr_b);
}
int main(int argc, char **argv) {
char testName[32];
//printf("compiler name datasize testtime*1e6 CONF95*testsd*1e6\n");
/* Initialise storage for test results & parse input arguements. */
init(argc, argv);
/* Ensure device is awake. */
wul();
sprintf(testName, "27S");
benchmark(testName, &stencil);
/* Print results & free results storage */
finalise();
return EXIT_SUCCESS;
}
|
the_stack_data/220456773.c | int __return_main;
void __VERIFIER_error();
void __VERIFIER_assume(int);
void __VERIFIER_assert(int cond);
int __VERIFIER_nondet_int();
int main();
int __return_1121;
int main()
{
int main__x = 0;
int main__y = 50;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_649:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_656:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_663:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_670:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_677:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_684:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_691:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_698:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_705:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_712:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_719:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_726:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_733:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_740:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_747:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_754:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_761:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_768:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_775:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_782:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_789:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_796:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_803:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_810:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_817:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_824:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_831:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_838:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_845:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_852:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_859:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_866:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_873:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_880:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_887:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_894:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_901:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_908:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_915:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_922:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_929:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_936:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_943:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_950:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_957:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_964:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_971:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_978:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_985:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_992:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_999:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_1006:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_1013:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_1020:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_1027:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_1034:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_1041:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_1048:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_1055:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_1062:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_1069:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_1076:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_1083:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_1090:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_1097:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_1104:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_1111:;
label_1112:;
if (main__x < 100)
{
if (main__x < 50)
{
main__x = main__x + 1;
label_1128:;
goto label_1112;
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_1128;
}
}
else
{
{
int __tmp_1;
__tmp_1 = main__y == 100;
int __VERIFIER_assert__cond;
__VERIFIER_assert__cond = __tmp_1;
if (__VERIFIER_assert__cond == 0)
{
__VERIFIER_error();
return __return_main;
}
else
{
__return_1121 = 0;
return __return_1121;
}
}
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_1111;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_1104;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_1097;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_1090;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_1083;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_1076;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_1069;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_1062;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_1055;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_1048;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_1041;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_1034;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_1027;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_1020;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_1013;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_1006;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_999;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_992;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_985;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_978;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_971;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_964;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_957;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_950;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_943;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_936;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_929;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_922;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_915;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_908;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_901;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_894;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_887;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_880;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_873;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_866;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_859;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_852;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_845;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_838;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_831;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_824;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_817;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_810;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_803;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_796;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_789;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_782;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_775;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_768;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_761;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_754;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_747;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_740;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_733;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_726;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_719;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_712;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_705;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_698;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_691;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_684;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_677;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_670;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_663;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_656;
}
}
else
{
return __return_main;
}
}
else
{
main__x = main__x + 1;
main__y = main__y + 1;
goto label_649;
}
}
else
{
return __return_main;
}
}
|
the_stack_data/39910.c | #include <stdio.h>
void main() {
FILE *file = fopen("/home/Documentos/teste.odt", "w");
fprintf(file, "alo\n");
fclose(file);
}
//https://pt.stackoverflow.com/a/40841/101
|
the_stack_data/96152.c | /*
* daemonize-sigusr1-wait.c Daemonize child after receiving sigusr1
*
* Copyright (c) 2017 Wind River Systems, Inc. - Jason Wessel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#define _GNU_SOURCE
#include <signal.h>
#include <stdio.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
#include <stdlib.h>
static void daemonize(void)
{
int ret = fork();
if (ret == 0) {
exit(0);
}
}
static void sig_handler(int signo)
{
if (signo == SIGUSR1) {
daemonize();
}
return;
}
int main( int argc, char *argv[])
{
int ret;
int status;
char *env_str;
if( signal( SIGUSR1, sig_handler) == SIG_ERR ) {
perror("ERROR: Could not create handler SIGUSR1");
exit(-1);
}
/* Run child process */
if (argc < 2) {
printf("Usage: %s <child command>\n", argv[0]);
exit(-1);
}
if (!asprintf(&env_str, "%i", getpid())) {
perror("Alloc failed");
exit(-1);
}
setenv("SIGUSR1_PARENT_PID", env_str, 1);
argv += 1;
ret = fork();
if (ret == 0) {
/* Child */
execvp(argv[0], argv);
exit(-1);
}
if (ret < 0) {
printf("Error fork failed\n");
exit(-1);
}
wait(&status);
return(status);
}
|
the_stack_data/430774.c | #include<stdio.h>
int A[100] , n ,i , counter;
void createArray();
void displaySteps();
void sortArray();
void showArray();
int main()
{
printf("\t\t\tHello friend\n");
createArray();
sortArray();
showArray();
printf("\n\t\t\tThank you");
return 0;
}
void createArray()
{
printf(" Enter the number of values to enter in the array : ");
scanf("%d",&n);
printf("\n Enter the values in the array : ");
for(i=0;i<n;i++)
{
scanf("%d",&A[i]);
}
}
void displaySteps()
{
for(i=0;i<n;i++)
{
printf(" %d",A[i]);
}
printf("\n");
}
void sortArray()
{
int temp;
counter =1;
printf("\n Bubble sorting steps are : \n");
while(counter<n)
{
displaySteps();
for(i=0;i<n-counter;i++)
{
if(A[i]>A[i+1])
{
temp = A[i];
A[i]=A[i+1];
A[i+1]=temp;
}
}
counter++;
}
}
void showArray()
{
printf("\n Sorted Array values are : ");
for(i=0;i<n;i++)
{
printf(" %d",A[i]);
}
}
|
the_stack_data/167331045.c | #include <stdio.h>
#define N 239
int wcount(char*);
int main(int argc, char **argv) {
char str[N] = { 0 };
gets(str);
int ot = 0;
ot = wcount(str);
printf("%d", ot);
return 0;
}
int wcount(char *s) {
int flagin, count, i;
flagin = count = i = 0;
while(s[i] != '\n') {
flagin = 0;
while(s[i] && s[i] != ' ' && s[i] != '\n') {
i++;
flagin++;
count++;
}
if (!flagin) i++;
}
return count;
}
|
the_stack_data/206394314.c | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct fm10k_hw {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
int /*<<< orphan*/ FM10K_PFVTCTL (int) ;
int /*<<< orphan*/ FM10K_QBRC_H (int) ;
int /*<<< orphan*/ FM10K_QBRC_L (int) ;
int /*<<< orphan*/ FM10K_QBTC_H (int) ;
int /*<<< orphan*/ FM10K_QBTC_L (int) ;
int /*<<< orphan*/ FM10K_QPRC (int) ;
int /*<<< orphan*/ FM10K_QPRDC (int) ;
int /*<<< orphan*/ FM10K_QPTC (int) ;
int /*<<< orphan*/ FM10K_RDBAH (int) ;
int /*<<< orphan*/ FM10K_RDBAL (int) ;
int /*<<< orphan*/ FM10K_RDH (int) ;
int /*<<< orphan*/ FM10K_RDLEN (int) ;
int /*<<< orphan*/ FM10K_RDT (int) ;
int FM10K_REGS_LEN_Q ;
int /*<<< orphan*/ FM10K_RXDCTL (int) ;
int /*<<< orphan*/ FM10K_RXINT (int) ;
int /*<<< orphan*/ FM10K_RXQCTL (int) ;
int /*<<< orphan*/ FM10K_SRRCTL (int) ;
int /*<<< orphan*/ FM10K_TDBAH (int) ;
int /*<<< orphan*/ FM10K_TDBAL (int) ;
int /*<<< orphan*/ FM10K_TDH (int) ;
int /*<<< orphan*/ FM10K_TDLEN (int) ;
int /*<<< orphan*/ FM10K_TDT (int) ;
int /*<<< orphan*/ FM10K_TPH_RXCTRL (int) ;
int /*<<< orphan*/ FM10K_TPH_TXCTRL (int) ;
int /*<<< orphan*/ FM10K_TQDLOC (int) ;
int /*<<< orphan*/ FM10K_TXDCTL (int) ;
int /*<<< orphan*/ FM10K_TXINT (int) ;
int /*<<< orphan*/ FM10K_TXQCTL (int) ;
int /*<<< orphan*/ FM10K_TX_SGLORT (int) ;
int /*<<< orphan*/ fm10k_read_reg (struct fm10k_hw*,int /*<<< orphan*/ ) ;
__attribute__((used)) static void fm10k_get_reg_q(struct fm10k_hw *hw, u32 *buff, int i)
{
int idx = 0;
buff[idx++] = fm10k_read_reg(hw, FM10K_RDBAL(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_RDBAH(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_RDLEN(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_TPH_RXCTRL(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_RDH(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_RDT(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_RXQCTL(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_RXDCTL(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_RXINT(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_SRRCTL(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_QPRC(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_QPRDC(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_QBRC_L(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_QBRC_H(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_TDBAL(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_TDBAH(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_TDLEN(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_TPH_TXCTRL(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_TDH(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_TDT(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_TXDCTL(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_TXQCTL(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_TXINT(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_QPTC(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_QBTC_L(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_QBTC_H(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_TQDLOC(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_TX_SGLORT(i));
buff[idx++] = fm10k_read_reg(hw, FM10K_PFVTCTL(i));
BUG_ON(idx != FM10K_REGS_LEN_Q);
} |
the_stack_data/9255.c | #include <stdio.h>
// Funktion berechnet die Potenz x^n (mit n in R)
double potenz(double x, int n) {
int nIsNeg = 0; // Merker fuer den Fall, dass n < 0 ist
double r = 1.0; // Ergebnisvariable
if (n < 0) {
nIsNeg = 1; // Merker wird gesetzt
n = -n; // Betrag von n bilden
}
// Berechnung von x^n
for (int i = 1; i <= n; i++) {
r = r * x;
}
if (nIsNeg)
return 1 / r; // Rueckgabe, falls n < 0
else
return r; // Rueckgabe fuer n >= 0
}
int main() {
double x_inp; // Variable fuer die Basis
int n_inp; // Variable fuer die Potenz
// Benutzereingabe
printf("Bitte geben Sie x und n ein.\n");
scanf_s("%lf%i", &x_inp, &n_inp);
// Achtung: Zum Einlesen einer Variablen vom Typ double muss
// die Formatierung %lf verwendet werden.
// Testausgabe
printf("\nErgebnis der Berechnung:\n");
printf("%.2f^%i = %.4f\n", x_inp, n_inp, potenz(x_inp, n_inp));
} |
the_stack_data/62636429.c | #include <stdio.h>
int main(void) {
int i, j, k, l;
char ch;
printf("Enter a charactor:");
if (scanf("%c", &ch) == 1) {
for (i = 0; i < 5; i++) {
for (j = 5; j > i; j--) {
printf(" ");
}
for (k = 0; k <= i; k++) {
printf("%c", ch + k);
}
for (l = 1; l <= i; l++) {
printf("%c", ch + k - l - 1);
}
printf("\n");
}
}
else {
printf("Wrong input\n");
}
return 0;
}
|
the_stack_data/76414.c | #include <stdio.h>
#define MAX (10000)
char input[MAX + 1];
int main(void)
{
int TC, tc;
int answer;
int i, j, k;
freopen("sample_input.txt", "r", stdin);
setbuf(stdout, NULL);
scanf("%d", &TC);
for (tc = 1; tc <= TC; ++tc) {
scanf("%s\n", input);
answer = 0;
k = 0;
for (i = 1; input[i] != '\0'; ++i) {
j = (0x1 << (input[i] - '0'));
if ((k & j) > 0) {
--answer;
k &= ~j;
} else {
++answer;
k |= j;
}
}
printf("#%d %d\n", tc, answer);
}
return 0;
}
|
the_stack_data/51352.c | /*-------------------------------------------------------------------------
*
* win32stat.c
* Replacements for <sys/stat.h> functions using GetFileInformationByHandle
*
* Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* src/port/win32stat.c
*
*-------------------------------------------------------------------------
*/
#ifdef WIN32
#include "c.h"
#include <windows.h>
/*
* In order to support MinGW and MSVC2013 we use NtQueryInformationFile as an
* alternative for GetFileInformationByHandleEx. It is loaded from the ntdll
* library.
*/
#if _WIN32_WINNT < 0x0600
#include <winternl.h>
#if !defined(__MINGW32__) && !defined(__MINGW64__)
/* MinGW includes this in <winternl.h>, but it is missing in MSVC */
typedef struct _FILE_STANDARD_INFORMATION
{
LARGE_INTEGER AllocationSize;
LARGE_INTEGER EndOfFile;
ULONG NumberOfLinks;
BOOLEAN DeletePending;
BOOLEAN Directory;
} FILE_STANDARD_INFORMATION;
#define FileStandardInformation 5
#endif /* !defined(__MINGW32__) &&
* !defined(__MINGW64__) */
typedef NTSTATUS (NTAPI * PFN_NTQUERYINFORMATIONFILE)
(IN HANDLE FileHandle,
OUT PIO_STATUS_BLOCK IoStatusBlock,
OUT PVOID FileInformation,
IN ULONG Length,
IN FILE_INFORMATION_CLASS FileInformationClass);
static PFN_NTQUERYINFORMATIONFILE _NtQueryInformationFile = NULL;
static HMODULE ntdll = NULL;
/*
* Load DLL file just once regardless of how many functions we load/call in it.
*/
static void
LoadNtdll(void)
{
if (ntdll != NULL)
return;
ntdll = LoadLibraryEx("ntdll.dll", NULL, 0);
}
#endif /* _WIN32_WINNT < 0x0600 */
/*
* Convert a FILETIME struct into a 64 bit time_t.
*/
static __time64_t
filetime_to_time(const FILETIME *ft)
{
ULARGE_INTEGER unified_ft = {0};
static const uint64 EpochShift = UINT64CONST(116444736000000000);
unified_ft.LowPart = ft->dwLowDateTime;
unified_ft.HighPart = ft->dwHighDateTime;
if (unified_ft.QuadPart < EpochShift)
return -1;
unified_ft.QuadPart -= EpochShift;
unified_ft.QuadPart /= 10 * 1000 * 1000;
return unified_ft.QuadPart;
}
/*
* Convert WIN32 file attributes to a Unix-style mode.
*
* Only owner permissions are set.
*/
static unsigned short
fileattr_to_unixmode(int attr)
{
unsigned short uxmode = 0;
uxmode |= (unsigned short) ((attr & FILE_ATTRIBUTE_DIRECTORY) ?
(_S_IFDIR) : (_S_IFREG));
uxmode |= (unsigned short) ((attr & FILE_ATTRIBUTE_READONLY) ?
(_S_IREAD) : (_S_IREAD | _S_IWRITE));
/* there is no need to simulate _S_IEXEC using CMD's PATHEXT extensions */
uxmode |= _S_IEXEC;
return uxmode;
}
/*
* Convert WIN32 file information (from a HANDLE) to a struct stat.
*/
static int
fileinfo_to_stat(HANDLE hFile, struct stat *buf)
{
BY_HANDLE_FILE_INFORMATION fiData;
memset(buf, 0, sizeof(*buf));
/*
* GetFileInformationByHandle minimum supported version: Windows XP and
* Windows Server 2003, so it exists everywhere we care about.
*/
if (!GetFileInformationByHandle(hFile, &fiData))
{
_dosmaperr(GetLastError());
return -1;
}
if (fiData.ftLastWriteTime.dwLowDateTime ||
fiData.ftLastWriteTime.dwHighDateTime)
buf->st_mtime = filetime_to_time(&fiData.ftLastWriteTime);
if (fiData.ftLastAccessTime.dwLowDateTime ||
fiData.ftLastAccessTime.dwHighDateTime)
buf->st_atime = filetime_to_time(&fiData.ftLastAccessTime);
else
buf->st_atime = buf->st_mtime;
if (fiData.ftCreationTime.dwLowDateTime ||
fiData.ftCreationTime.dwHighDateTime)
buf->st_ctime = filetime_to_time(&fiData.ftCreationTime);
else
buf->st_ctime = buf->st_mtime;
buf->st_mode = fileattr_to_unixmode(fiData.dwFileAttributes);
buf->st_nlink = fiData.nNumberOfLinks;
buf->st_size = ((((uint64) fiData.nFileSizeHigh) << 32) |
fiData.nFileSizeLow);
return 0;
}
/*
* Windows implementation of stat().
*
* This currently also implements lstat(), though perhaps that should change.
*/
int
_pgstat64(const char *name, struct stat *buf)
{
/*
* We must use a handle so lstat() returns the information of the target
* file. To have a reliable test for ERROR_DELETE_PENDING, we use
* NtQueryInformationFile from Windows 2000 or
* GetFileInformationByHandleEx from Server 2008 / Vista.
*/
SECURITY_ATTRIBUTES sa;
HANDLE hFile;
int ret;
#if _WIN32_WINNT < 0x0600
IO_STATUS_BLOCK ioStatus;
FILE_STANDARD_INFORMATION standardInfo;
#else
FILE_STANDARD_INFO standardInfo;
#endif
if (name == NULL || buf == NULL)
{
errno = EINVAL;
return -1;
}
/* fast not-exists check */
if (GetFileAttributes(name) == INVALID_FILE_ATTRIBUTES)
{
_dosmaperr(GetLastError());
return -1;
}
/* get a file handle as lightweight as we can */
sa.nLength = sizeof(SECURITY_ATTRIBUTES);
sa.bInheritHandle = TRUE;
sa.lpSecurityDescriptor = NULL;
hFile = CreateFile(name,
GENERIC_READ,
(FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE),
&sa,
OPEN_EXISTING,
(FILE_FLAG_NO_BUFFERING | FILE_FLAG_BACKUP_SEMANTICS |
FILE_FLAG_OVERLAPPED),
NULL);
if (hFile == INVALID_HANDLE_VALUE)
{
DWORD err = GetLastError();
CloseHandle(hFile);
_dosmaperr(err);
return -1;
}
memset(&standardInfo, 0, sizeof(standardInfo));
#if _WIN32_WINNT < 0x0600
if (_NtQueryInformationFile == NULL)
{
/* First time through: load ntdll.dll and find NtQueryInformationFile */
LoadNtdll();
if (ntdll == NULL)
{
DWORD err = GetLastError();
CloseHandle(hFile);
_dosmaperr(err);
return -1;
}
_NtQueryInformationFile = (PFN_NTQUERYINFORMATIONFILE) (pg_funcptr_t)
GetProcAddress(ntdll, "NtQueryInformationFile");
if (_NtQueryInformationFile == NULL)
{
DWORD err = GetLastError();
CloseHandle(hFile);
_dosmaperr(err);
return -1;
}
}
if (!NT_SUCCESS(_NtQueryInformationFile(hFile, &ioStatus, &standardInfo,
sizeof(standardInfo),
FileStandardInformation)))
{
DWORD err = GetLastError();
CloseHandle(hFile);
_dosmaperr(err);
return -1;
}
#else
if (!GetFileInformationByHandleEx(hFile, FileStandardInfo, &standardInfo,
sizeof(standardInfo)))
{
DWORD err = GetLastError();
CloseHandle(hFile);
_dosmaperr(err);
return -1;
}
#endif /* _WIN32_WINNT < 0x0600 */
if (standardInfo.DeletePending)
{
/*
* File has been deleted, but is not gone from the filesystem yet.
* This can happen when some process with FILE_SHARE_DELETE has it
* open, and it will be fully removed once that handle is closed.
* Meanwhile, we can't open it, so indicate that the file just doesn't
* exist.
*/
CloseHandle(hFile);
errno = ENOENT;
return -1;
}
/* At last we can invoke fileinfo_to_stat */
ret = fileinfo_to_stat(hFile, buf);
CloseHandle(hFile);
return ret;
}
/*
* Windows implementation of fstat().
*/
int
_pgfstat64(int fileno, struct stat *buf)
{
HANDLE hFile = (HANDLE) _get_osfhandle(fileno);
if (hFile == INVALID_HANDLE_VALUE || buf == NULL)
{
errno = EINVAL;
return -1;
}
/*
* Since we already have a file handle there is no need to check for
* ERROR_DELETE_PENDING.
*/
return fileinfo_to_stat(hFile, buf);
}
#endif /* WIN32 */
|
the_stack_data/154826748.c | /* f2c.h -- Standard Fortran to C header file */
/** barf [ba:rf] 2. "He suggested using FORTRAN, and everybody barfed."
- From The Shogakukan DICTIONARY OF NEW ENGLISH (Second edition) */
#ifndef F2C_INCLUDE
#define F2C_INCLUDE
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <complex.h>
#ifdef complex
#undef complex
#endif
#ifdef I
#undef I
#endif
#if defined(_WIN64)
typedef long long BLASLONG;
typedef unsigned long long BLASULONG;
#else
typedef long BLASLONG;
typedef unsigned long BLASULONG;
#endif
#ifdef LAPACK_ILP64
typedef BLASLONG blasint;
#if defined(_WIN64)
#define blasabs(x) llabs(x)
#else
#define blasabs(x) labs(x)
#endif
#else
typedef int blasint;
#define blasabs(x) abs(x)
#endif
typedef blasint integer;
typedef unsigned int uinteger;
typedef char *address;
typedef short int shortint;
typedef float real;
typedef double doublereal;
typedef struct { real r, i; } complex;
typedef struct { doublereal r, i; } doublecomplex;
static inline _Complex float Cf(complex *z) {return z->r + z->i*_Complex_I;}
static inline _Complex double Cd(doublecomplex *z) {return z->r + z->i*_Complex_I;}
static inline _Complex float * _pCf(complex *z) {return (_Complex float*)z;}
static inline _Complex double * _pCd(doublecomplex *z) {return (_Complex double*)z;}
#define pCf(z) (*_pCf(z))
#define pCd(z) (*_pCd(z))
typedef int logical;
typedef short int shortlogical;
typedef char logical1;
typedef char integer1;
#define TRUE_ (1)
#define FALSE_ (0)
/* Extern is for use with -E */
#ifndef Extern
#define Extern extern
#endif
/* I/O stuff */
typedef int flag;
typedef int ftnlen;
typedef int ftnint;
/*external read, write*/
typedef struct
{ flag cierr;
ftnint ciunit;
flag ciend;
char *cifmt;
ftnint cirec;
} cilist;
/*internal read, write*/
typedef struct
{ flag icierr;
char *iciunit;
flag iciend;
char *icifmt;
ftnint icirlen;
ftnint icirnum;
} icilist;
/*open*/
typedef struct
{ flag oerr;
ftnint ounit;
char *ofnm;
ftnlen ofnmlen;
char *osta;
char *oacc;
char *ofm;
ftnint orl;
char *oblnk;
} olist;
/*close*/
typedef struct
{ flag cerr;
ftnint cunit;
char *csta;
} cllist;
/*rewind, backspace, endfile*/
typedef struct
{ flag aerr;
ftnint aunit;
} alist;
/* inquire */
typedef struct
{ flag inerr;
ftnint inunit;
char *infile;
ftnlen infilen;
ftnint *inex; /*parameters in standard's order*/
ftnint *inopen;
ftnint *innum;
ftnint *innamed;
char *inname;
ftnlen innamlen;
char *inacc;
ftnlen inacclen;
char *inseq;
ftnlen inseqlen;
char *indir;
ftnlen indirlen;
char *infmt;
ftnlen infmtlen;
char *inform;
ftnint informlen;
char *inunf;
ftnlen inunflen;
ftnint *inrecl;
ftnint *innrec;
char *inblank;
ftnlen inblanklen;
} inlist;
#define VOID void
union Multitype { /* for multiple entry points */
integer1 g;
shortint h;
integer i;
/* longint j; */
real r;
doublereal d;
complex c;
doublecomplex z;
};
typedef union Multitype Multitype;
struct Vardesc { /* for Namelist */
char *name;
char *addr;
ftnlen *dims;
int type;
};
typedef struct Vardesc Vardesc;
struct Namelist {
char *name;
Vardesc **vars;
int nvars;
};
typedef struct Namelist Namelist;
#define abs(x) ((x) >= 0 ? (x) : -(x))
#define dabs(x) (fabs(x))
#define f2cmin(a,b) ((a) <= (b) ? (a) : (b))
#define f2cmax(a,b) ((a) >= (b) ? (a) : (b))
#define dmin(a,b) (f2cmin(a,b))
#define dmax(a,b) (f2cmax(a,b))
#define bit_test(a,b) ((a) >> (b) & 1)
#define bit_clear(a,b) ((a) & ~((uinteger)1 << (b)))
#define bit_set(a,b) ((a) | ((uinteger)1 << (b)))
#define abort_() { sig_die("Fortran abort routine called", 1); }
#define c_abs(z) (cabsf(Cf(z)))
#define c_cos(R,Z) { pCf(R)=ccos(Cf(Z)); }
#define c_div(c, a, b) {pCf(c) = Cf(a)/Cf(b);}
#define z_div(c, a, b) {pCd(c) = Cd(a)/Cd(b);}
#define c_exp(R, Z) {pCf(R) = cexpf(Cf(Z));}
#define c_log(R, Z) {pCf(R) = clogf(Cf(Z));}
#define c_sin(R, Z) {pCf(R) = csinf(Cf(Z));}
//#define c_sqrt(R, Z) {*(R) = csqrtf(Cf(Z));}
#define c_sqrt(R, Z) {pCf(R) = csqrtf(Cf(Z));}
#define d_abs(x) (fabs(*(x)))
#define d_acos(x) (acos(*(x)))
#define d_asin(x) (asin(*(x)))
#define d_atan(x) (atan(*(x)))
#define d_atn2(x, y) (atan2(*(x),*(y)))
#define d_cnjg(R, Z) { pCd(R) = conj(Cd(Z)); }
#define r_cnjg(R, Z) { pCf(R) = conj(Cf(Z)); }
#define d_cos(x) (cos(*(x)))
#define d_cosh(x) (cosh(*(x)))
#define d_dim(__a, __b) ( *(__a) > *(__b) ? *(__a) - *(__b) : 0.0 )
#define d_exp(x) (exp(*(x)))
#define d_imag(z) (cimag(Cd(z)))
#define r_imag(z) (cimag(Cf(z)))
#define d_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x)))
#define r_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x)))
#define d_lg10(x) ( 0.43429448190325182765 * log(*(x)) )
#define r_lg10(x) ( 0.43429448190325182765 * log(*(x)) )
#define d_log(x) (log(*(x)))
#define d_mod(x, y) (fmod(*(x), *(y)))
#define u_nint(__x) ((__x)>=0 ? floor((__x) + .5) : -floor(.5 - (__x)))
#define d_nint(x) u_nint(*(x))
#define u_sign(__a,__b) ((__b) >= 0 ? ((__a) >= 0 ? (__a) : -(__a)) : -((__a) >= 0 ? (__a) : -(__a)))
#define d_sign(a,b) u_sign(*(a),*(b))
#define r_sign(a,b) u_sign(*(a),*(b))
#define d_sin(x) (sin(*(x)))
#define d_sinh(x) (sinh(*(x)))
#define d_sqrt(x) (sqrt(*(x)))
#define d_tan(x) (tan(*(x)))
#define d_tanh(x) (tanh(*(x)))
#define i_abs(x) abs(*(x))
#define i_dnnt(x) ((integer)u_nint(*(x)))
#define i_len(s, n) (n)
#define i_nint(x) ((integer)u_nint(*(x)))
#define i_sign(a,b) ((integer)u_sign((integer)*(a),(integer)*(b)))
#define pow_dd(ap, bp) ( pow(*(ap), *(bp)))
#define pow_si(B,E) spow_ui(*(B),*(E))
#define pow_ri(B,E) spow_ui(*(B),*(E))
#define pow_di(B,E) dpow_ui(*(B),*(E))
#define pow_zi(p, a, b) {pCd(p) = zpow_ui(Cd(a), *(b));}
#define pow_ci(p, a, b) {pCf(p) = cpow_ui(Cf(a), *(b));}
#define pow_zz(R,A,B) {pCd(R) = cpow(Cd(A),*(B));}
#define s_cat(lpp, rpp, rnp, np, llp) { ftnlen i, nc, ll; char *f__rp, *lp; ll = (llp); lp = (lpp); for(i=0; i < (int)*(np); ++i) { nc = ll; if((rnp)[i] < nc) nc = (rnp)[i]; ll -= nc; f__rp = (rpp)[i]; while(--nc >= 0) *lp++ = *(f__rp)++; } while(--ll >= 0) *lp++ = ' '; }
#define s_cmp(a,b,c,d) ((integer)strncmp((a),(b),f2cmin((c),(d))))
#define s_copy(A,B,C,D) { int __i,__m; for (__i=0, __m=f2cmin((C),(D)); __i<__m && (B)[__i] != 0; ++__i) (A)[__i] = (B)[__i]; }
#define sig_die(s, kill) { exit(1); }
#define s_stop(s, n) {exit(0);}
static char junk[] = "\n@(#)LIBF77 VERSION 19990503\n";
#define z_abs(z) (cabs(Cd(z)))
#define z_exp(R, Z) {pCd(R) = cexp(Cd(Z));}
#define z_sqrt(R, Z) {pCd(R) = csqrt(Cd(Z));}
#define myexit_() break;
#define mycycle() continue;
#define myceiling(w) {ceil(w)}
#define myhuge(w) {HUGE_VAL}
//#define mymaxloc_(w,s,e,n) {if (sizeof(*(w)) == sizeof(double)) dmaxloc_((w),*(s),*(e),n); else dmaxloc_((w),*(s),*(e),n);}
#define mymaxloc(w,s,e,n) {dmaxloc_(w,*(s),*(e),n)}
/* procedure parameter types for -A and -C++ */
#define F2C_proc_par_types 1
#ifdef __cplusplus
typedef logical (*L_fp)(...);
#else
typedef logical (*L_fp)();
#endif
static float spow_ui(float x, integer n) {
float pow=1.0; unsigned long int u;
if(n != 0) {
if(n < 0) n = -n, x = 1/x;
for(u = n; ; ) {
if(u & 01) pow *= x;
if(u >>= 1) x *= x;
else break;
}
}
return pow;
}
static double dpow_ui(double x, integer n) {
double pow=1.0; unsigned long int u;
if(n != 0) {
if(n < 0) n = -n, x = 1/x;
for(u = n; ; ) {
if(u & 01) pow *= x;
if(u >>= 1) x *= x;
else break;
}
}
return pow;
}
static _Complex float cpow_ui(_Complex float x, integer n) {
_Complex float pow=1.0; unsigned long int u;
if(n != 0) {
if(n < 0) n = -n, x = 1/x;
for(u = n; ; ) {
if(u & 01) pow *= x;
if(u >>= 1) x *= x;
else break;
}
}
return pow;
}
static _Complex double zpow_ui(_Complex double x, integer n) {
_Complex double pow=1.0; unsigned long int u;
if(n != 0) {
if(n < 0) n = -n, x = 1/x;
for(u = n; ; ) {
if(u & 01) pow *= x;
if(u >>= 1) x *= x;
else break;
}
}
return pow;
}
static integer pow_ii(integer x, integer n) {
integer pow; unsigned long int u;
if (n <= 0) {
if (n == 0 || x == 1) pow = 1;
else if (x != -1) pow = x == 0 ? 1/x : 0;
else n = -n;
}
if ((n > 0) || !(n == 0 || x == 1 || x != -1)) {
u = n;
for(pow = 1; ; ) {
if(u & 01) pow *= x;
if(u >>= 1) x *= x;
else break;
}
}
return pow;
}
static integer dmaxloc_(double *w, integer s, integer e, integer *n)
{
double m; integer i, mi;
for(m=w[s-1], mi=s, i=s+1; i<=e; i++)
if (w[i-1]>m) mi=i ,m=w[i-1];
return mi-s+1;
}
static integer smaxloc_(float *w, integer s, integer e, integer *n)
{
float m; integer i, mi;
for(m=w[s-1], mi=s, i=s+1; i<=e; i++)
if (w[i-1]>m) mi=i ,m=w[i-1];
return mi-s+1;
}
static inline void cdotc_(complex *z, integer *n_, complex *x, integer *incx_, complex *y, integer *incy_) {
integer n = *n_, incx = *incx_, incy = *incy_, i;
_Complex float zdotc = 0.0;
if (incx == 1 && incy == 1) {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += conjf(Cf(&x[i])) * Cf(&y[i]);
}
} else {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += conjf(Cf(&x[i*incx])) * Cf(&y[i*incy]);
}
}
pCf(z) = zdotc;
}
static inline void zdotc_(doublecomplex *z, integer *n_, doublecomplex *x, integer *incx_, doublecomplex *y, integer *incy_) {
integer n = *n_, incx = *incx_, incy = *incy_, i;
_Complex double zdotc = 0.0;
if (incx == 1 && incy == 1) {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += conj(Cd(&x[i])) * Cd(&y[i]);
}
} else {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += conj(Cd(&x[i*incx])) * Cd(&y[i*incy]);
}
}
pCd(z) = zdotc;
}
static inline void cdotu_(complex *z, integer *n_, complex *x, integer *incx_, complex *y, integer *incy_) {
integer n = *n_, incx = *incx_, incy = *incy_, i;
_Complex float zdotc = 0.0;
if (incx == 1 && incy == 1) {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += Cf(&x[i]) * Cf(&y[i]);
}
} else {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += Cf(&x[i*incx]) * Cf(&y[i*incy]);
}
}
pCf(z) = zdotc;
}
static inline void zdotu_(doublecomplex *z, integer *n_, doublecomplex *x, integer *incx_, doublecomplex *y, integer *incy_) {
integer n = *n_, incx = *incx_, incy = *incy_, i;
_Complex double zdotc = 0.0;
if (incx == 1 && incy == 1) {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += Cd(&x[i]) * Cd(&y[i]);
}
} else {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += Cd(&x[i*incx]) * Cd(&y[i*incy]);
}
}
pCd(z) = zdotc;
}
#endif
/* -- translated by f2c (version 20000121).
You must link the resulting object file with the libraries:
-lf2c -lm (in that order)
*/
/* > \brief \b DGEEQU */
/* =========== DOCUMENTATION =========== */
/* Online html documentation available at */
/* http://www.netlib.org/lapack/explore-html/ */
/* > \htmlonly */
/* > Download DGEEQU + dependencies */
/* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dgeequ.
f"> */
/* > [TGZ]</a> */
/* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dgeequ.
f"> */
/* > [ZIP]</a> */
/* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dgeequ.
f"> */
/* > [TXT]</a> */
/* > \endhtmlonly */
/* Definition: */
/* =========== */
/* SUBROUTINE DGEEQU( M, N, A, LDA, R, C, ROWCND, COLCND, AMAX, */
/* INFO ) */
/* INTEGER INFO, LDA, M, N */
/* DOUBLE PRECISION AMAX, COLCND, ROWCND */
/* DOUBLE PRECISION A( LDA, * ), C( * ), R( * ) */
/* > \par Purpose: */
/* ============= */
/* > */
/* > \verbatim */
/* > */
/* > DGEEQU computes row and column scalings intended to equilibrate an */
/* > M-by-N matrix A and reduce its condition number. R returns the row */
/* > scale factors and C the column scale factors, chosen to try to make */
/* > the largest element in each row and column of the matrix B with */
/* > elements B(i,j)=R(i)*A(i,j)*C(j) have absolute value 1. */
/* > */
/* > R(i) and C(j) are restricted to be between SMLNUM = smallest safe */
/* > number and BIGNUM = largest safe number. Use of these scaling */
/* > factors is not guaranteed to reduce the condition number of A but */
/* > works well in practice. */
/* > \endverbatim */
/* Arguments: */
/* ========== */
/* > \param[in] M */
/* > \verbatim */
/* > M is INTEGER */
/* > The number of rows of the matrix A. M >= 0. */
/* > \endverbatim */
/* > */
/* > \param[in] N */
/* > \verbatim */
/* > N is INTEGER */
/* > The number of columns of the matrix A. N >= 0. */
/* > \endverbatim */
/* > */
/* > \param[in] A */
/* > \verbatim */
/* > A is DOUBLE PRECISION array, dimension (LDA,N) */
/* > The M-by-N matrix whose equilibration factors are */
/* > to be computed. */
/* > \endverbatim */
/* > */
/* > \param[in] LDA */
/* > \verbatim */
/* > LDA is INTEGER */
/* > The leading dimension of the array A. LDA >= f2cmax(1,M). */
/* > \endverbatim */
/* > */
/* > \param[out] R */
/* > \verbatim */
/* > R is DOUBLE PRECISION array, dimension (M) */
/* > If INFO = 0 or INFO > M, R contains the row scale factors */
/* > for A. */
/* > \endverbatim */
/* > */
/* > \param[out] C */
/* > \verbatim */
/* > C is DOUBLE PRECISION array, dimension (N) */
/* > If INFO = 0, C contains the column scale factors for A. */
/* > \endverbatim */
/* > */
/* > \param[out] ROWCND */
/* > \verbatim */
/* > ROWCND is DOUBLE PRECISION */
/* > If INFO = 0 or INFO > M, ROWCND contains the ratio of the */
/* > smallest R(i) to the largest R(i). If ROWCND >= 0.1 and */
/* > AMAX is neither too large nor too small, it is not worth */
/* > scaling by R. */
/* > \endverbatim */
/* > */
/* > \param[out] COLCND */
/* > \verbatim */
/* > COLCND is DOUBLE PRECISION */
/* > If INFO = 0, COLCND contains the ratio of the smallest */
/* > C(i) to the largest C(i). If COLCND >= 0.1, it is not */
/* > worth scaling by C. */
/* > \endverbatim */
/* > */
/* > \param[out] AMAX */
/* > \verbatim */
/* > AMAX is DOUBLE PRECISION */
/* > Absolute value of largest matrix element. If AMAX is very */
/* > close to overflow or very close to underflow, the matrix */
/* > should be scaled. */
/* > \endverbatim */
/* > */
/* > \param[out] INFO */
/* > \verbatim */
/* > INFO is INTEGER */
/* > = 0: successful exit */
/* > < 0: if INFO = -i, the i-th argument had an illegal value */
/* > > 0: if INFO = i, and i is */
/* > <= M: the i-th row of A is exactly zero */
/* > > M: the (i-M)-th column of A is exactly zero */
/* > \endverbatim */
/* Authors: */
/* ======== */
/* > \author Univ. of Tennessee */
/* > \author Univ. of California Berkeley */
/* > \author Univ. of Colorado Denver */
/* > \author NAG Ltd. */
/* > \date December 2016 */
/* > \ingroup doubleGEcomputational */
/* ===================================================================== */
/* Subroutine */ int dgeequ_(integer *m, integer *n, doublereal *a, integer *
lda, doublereal *r__, doublereal *c__, doublereal *rowcnd, doublereal
*colcnd, doublereal *amax, integer *info)
{
/* System generated locals */
integer a_dim1, a_offset, i__1, i__2;
doublereal d__1, d__2, d__3;
/* Local variables */
integer i__, j;
doublereal rcmin, rcmax;
extern doublereal dlamch_(char *);
extern /* Subroutine */ int xerbla_(char *, integer *, ftnlen);
doublereal bignum, smlnum;
/* -- LAPACK computational routine (version 3.7.0) -- */
/* -- LAPACK is a software package provided by Univ. of Tennessee, -- */
/* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- */
/* December 2016 */
/* ===================================================================== */
/* Test the input parameters. */
/* Parameter adjustments */
a_dim1 = *lda;
a_offset = 1 + a_dim1 * 1;
a -= a_offset;
--r__;
--c__;
/* Function Body */
*info = 0;
if (*m < 0) {
*info = -1;
} else if (*n < 0) {
*info = -2;
} else if (*lda < f2cmax(1,*m)) {
*info = -4;
}
if (*info != 0) {
i__1 = -(*info);
xerbla_("DGEEQU", &i__1, (ftnlen)6);
return 0;
}
/* Quick return if possible */
if (*m == 0 || *n == 0) {
*rowcnd = 1.;
*colcnd = 1.;
*amax = 0.;
return 0;
}
/* Get machine constants. */
smlnum = dlamch_("S");
bignum = 1. / smlnum;
/* Compute row scale factors. */
i__1 = *m;
for (i__ = 1; i__ <= i__1; ++i__) {
r__[i__] = 0.;
/* L10: */
}
/* Find the maximum element in each row. */
i__1 = *n;
for (j = 1; j <= i__1; ++j) {
i__2 = *m;
for (i__ = 1; i__ <= i__2; ++i__) {
/* Computing MAX */
d__2 = r__[i__], d__3 = (d__1 = a[i__ + j * a_dim1], abs(d__1));
r__[i__] = f2cmax(d__2,d__3);
/* L20: */
}
/* L30: */
}
/* Find the maximum and minimum scale factors. */
rcmin = bignum;
rcmax = 0.;
i__1 = *m;
for (i__ = 1; i__ <= i__1; ++i__) {
/* Computing MAX */
d__1 = rcmax, d__2 = r__[i__];
rcmax = f2cmax(d__1,d__2);
/* Computing MIN */
d__1 = rcmin, d__2 = r__[i__];
rcmin = f2cmin(d__1,d__2);
/* L40: */
}
*amax = rcmax;
if (rcmin == 0.) {
/* Find the first zero scale factor and return an error code. */
i__1 = *m;
for (i__ = 1; i__ <= i__1; ++i__) {
if (r__[i__] == 0.) {
*info = i__;
return 0;
}
/* L50: */
}
} else {
/* Invert the scale factors. */
i__1 = *m;
for (i__ = 1; i__ <= i__1; ++i__) {
/* Computing MIN */
/* Computing MAX */
d__2 = r__[i__];
d__1 = f2cmax(d__2,smlnum);
r__[i__] = 1. / f2cmin(d__1,bignum);
/* L60: */
}
/* Compute ROWCND = f2cmin(R(I)) / f2cmax(R(I)) */
*rowcnd = f2cmax(rcmin,smlnum) / f2cmin(rcmax,bignum);
}
/* Compute column scale factors */
i__1 = *n;
for (j = 1; j <= i__1; ++j) {
c__[j] = 0.;
/* L70: */
}
/* Find the maximum element in each column, */
/* assuming the row scaling computed above. */
i__1 = *n;
for (j = 1; j <= i__1; ++j) {
i__2 = *m;
for (i__ = 1; i__ <= i__2; ++i__) {
/* Computing MAX */
d__2 = c__[j], d__3 = (d__1 = a[i__ + j * a_dim1], abs(d__1)) *
r__[i__];
c__[j] = f2cmax(d__2,d__3);
/* L80: */
}
/* L90: */
}
/* Find the maximum and minimum scale factors. */
rcmin = bignum;
rcmax = 0.;
i__1 = *n;
for (j = 1; j <= i__1; ++j) {
/* Computing MIN */
d__1 = rcmin, d__2 = c__[j];
rcmin = f2cmin(d__1,d__2);
/* Computing MAX */
d__1 = rcmax, d__2 = c__[j];
rcmax = f2cmax(d__1,d__2);
/* L100: */
}
if (rcmin == 0.) {
/* Find the first zero scale factor and return an error code. */
i__1 = *n;
for (j = 1; j <= i__1; ++j) {
if (c__[j] == 0.) {
*info = *m + j;
return 0;
}
/* L110: */
}
} else {
/* Invert the scale factors. */
i__1 = *n;
for (j = 1; j <= i__1; ++j) {
/* Computing MIN */
/* Computing MAX */
d__2 = c__[j];
d__1 = f2cmax(d__2,smlnum);
c__[j] = 1. / f2cmin(d__1,bignum);
/* L120: */
}
/* Compute COLCND = f2cmin(C(J)) / f2cmax(C(J)) */
*colcnd = f2cmax(rcmin,smlnum) / f2cmin(rcmax,bignum);
}
return 0;
/* End of DGEEQU */
} /* dgeequ_ */
|
the_stack_data/147427.c | /*
Copyright 2015 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#ifdef _REMOTELOGGING
#include "ILibParsers.h"
#include "ILibWebServer.h"
#include "ILibRemoteLogging.h"
#ifndef MICROSTACK_NOTLS
#include "../core/utils.h"
#endif
char ILibScratchPad_RemoteLogging[255];
#if defined(WIN32) && !defined(snprintf) && (_MSC_PLATFORM_TOOLSET <= 120)
#define snprintf(dst, len, frm, ...) _snprintf_s(dst, len, _TRUNCATE, frm, __VA_ARGS__)
#endif
typedef struct ILibRemoteLogging_Session
{
unsigned int Flags;
void* UserContext;
}ILibRemoteLogging_Session;
typedef struct ILibRemoteLogging_Module
{
sem_t LogSyncLock;
unsigned int LogFlags;
ILibRemoteLogging_OnWrite OutputSink;
ILibRemoteLogging_OnCommand CommandSink[15];
ILibRemoteLogging_Session Sessions[5];
}ILibRemoteLogging_Module;
void ILibRemoteLogging_Destroy(ILibRemoteLogging module)
{
ILibRemoteLogging_Module *obj = (ILibRemoteLogging_Module*)module;
if (obj != NULL)
{
sem_destroy(&(obj->LogSyncLock));
free(module);
}
}
void ILibRemoteLogging_CompactSessions(ILibRemoteLogging_Session sessions[], int sessionsLength)
{
int x=0,y=0;
for(x=0;x<sessionsLength;++x)
{
if(sessions[x].UserContext == NULL)
{
for(y=x+1;y<sessionsLength;++y)
{
if(sessions[y].UserContext != NULL)
{
memcpy(&sessions[x], &sessions[y], sizeof(ILibRemoteLogging_Session));
memset(&sessions[y], 0, sizeof(ILibRemoteLogging_Session));
break;
}
}
}
}
}
void ILibRemoteLogging_RemoveUserContext(ILibRemoteLogging_Session sessions[], int sessionsLength, void *userContext)
{
int i;
for(i=0;i<sessionsLength;++i)
{
if(sessions[i].UserContext == NULL){break;}
if(sessions[i].UserContext == userContext)
{
memset(&sessions[i], 0, sizeof(ILibRemoteLogging_Session));
ILibRemoteLogging_CompactSessions(sessions, sessionsLength);
break;
}
}
}
ILibRemoteLogging_Session* ILibRemoteLogging_GetSession(ILibRemoteLogging_Session sessions[], int sessionsLength, void *userContext)
{
int i;
ILibRemoteLogging_Session *retVal = NULL;
for(i=0;i<sessionsLength;++i)
{
if(sessions[i].UserContext == NULL)
{
sessions[i].Flags = 0x00;
sessions[i].UserContext = userContext;
retVal = &sessions[i];
break;
}
else if(sessions[i].UserContext == userContext)
{
retVal = &sessions[i];
break;
}
}
return(retVal);
}
ILibRemoteLogging ILibRemoteLogging_Create(ILibRemoteLogging_OnWrite onOutput)
{
ILibRemoteLogging_Module *retVal;
if((retVal = (ILibRemoteLogging_Module*)malloc(sizeof(ILibRemoteLogging_Module)))==NULL) {ILIBCRITICALEXIT(254);}
memset(retVal, 0, sizeof(ILibRemoteLogging_Module));
sem_init(&(retVal->LogSyncLock), 0, 1);
retVal->OutputSink = onOutput;
return(retVal);
}
void ILibRemoteLogging_RegisterCommandSink(ILibRemoteLogging logger, ILibRemoteLogging_Modules module, ILibRemoteLogging_OnCommand sink)
{
ILibRemoteLogging_Module *obj = (ILibRemoteLogging_Module*)logger;
sem_wait(&(obj->LogSyncLock));
obj->CommandSink[ILibWhichPowerOfTwo((int)module)] = sink;
sem_post(&(obj->LogSyncLock));
}
void ILibRemoteLogging_DeleteUserContext(ILibRemoteLogging logger, void *userContext)
{
ILibRemoteLogging_Module *obj = (ILibRemoteLogging_Module*)logger;
sem_wait(&(obj->LogSyncLock));
ILibRemoteLogging_RemoveUserContext(obj->Sessions, sizeof(obj->Sessions) / sizeof(ILibRemoteLogging_Session), userContext);
sem_post(&(obj->LogSyncLock));
}
char* ILibRemoteLogging_ConvertAddress(struct sockaddr* addr)
{
ILibInet_ntop2((struct sockaddr*)addr, ILibScratchPad_RemoteLogging, sizeof(ILibScratchPad_RemoteLogging));
return(ILibScratchPad_RemoteLogging);
}
char* ILibRemoteLogging_ConvertToHex(char* inVal, int inValLength)
{
util_tohex(inVal, inValLength<255?inValLength:254, ILibScratchPad_RemoteLogging);
return(ILibScratchPad_RemoteLogging);
}
void ILibRemoteLogging_SendCommand(ILibRemoteLogging loggingModule, ILibRemoteLogging_Modules module, ILibRemoteLogging_Flags flags, char *data, int dataLen, void *userContext)
{
ILibRemoteLogging_Module *obj = (ILibRemoteLogging_Module*)loggingModule;
char dest[4096];
if(obj->OutputSink != NULL && ((dataLen + 4) < 4096))
{
((unsigned short*)dest)[0] = htons(module);
((unsigned short*)dest)[1] = htons(flags);
if(dataLen > 0) {memcpy(dest+4, data, dataLen);}
obj->OutputSink(loggingModule, dest, 4+dataLen, userContext);
}
}
void ILibRemoteLogging_printf(ILibRemoteLogging loggingModule, ILibRemoteLogging_Modules module, ILibRemoteLogging_Flags flags, char* format, ...)
{
int i;
char dest[4096];
int len;
ILibRemoteLogging_Module *obj = (ILibRemoteLogging_Module*)loggingModule;
va_list argptr;
va_start(argptr, format);
len = vsnprintf(dest+4, 4092, format, argptr);
va_end(argptr);
if(obj != NULL && obj->OutputSink != NULL)
{
((unsigned short*)dest)[0] = htons(module | 0x8000);
((unsigned short*)dest)[1] = htons(flags);
sem_wait(&(obj->LogSyncLock));
for(i=0;i<(sizeof(obj->Sessions)/sizeof(ILibRemoteLogging_Session)); ++i)
{
if(obj->Sessions[i].UserContext == NULL) {break;} // No more Sessions
if((obj->Sessions[i].Flags & (unsigned int)module) == 0) {continue;} // Logging for this module is not enabled
if(((obj->Sessions[i].Flags >> 16) & 0x3E) < (unsigned short)flags) {continue;} // Verbosity is not high enough
sem_post(&(obj->LogSyncLock));
obj->OutputSink(obj, dest, len+4, obj->Sessions[i].UserContext);
sem_wait(&(obj->LogSyncLock));
}
sem_post(&(obj->LogSyncLock));
}
}
void ILibRemoteLogging_Dispatch_Update(ILibRemoteLogging_Module *obj, unsigned short module, char* updateString, void *userContext)
{
char temp[255];
int tempLen;
if((module & ILibRemoteLogging_Modules_WebRTC_STUN_ICE) == ILibRemoteLogging_Modules_WebRTC_STUN_ICE)
{
tempLen = snprintf(temp, sizeof(temp), "WebRTC Module: STUN/ICE [%s]", updateString);
ILibRemoteLogging_SendCommand(obj, (ILibRemoteLogging_Modules)(ILibRemoteLogging_Modules_WebRTC_STUN_ICE | 0x8000), ILibRemoteLogging_Flags_VerbosityLevel_1, temp, tempLen, userContext);
}
if((module & ILibRemoteLogging_Modules_WebRTC_DTLS) == ILibRemoteLogging_Modules_WebRTC_DTLS)
{
tempLen = snprintf(temp, sizeof(temp), "WebRTC Module: DTLS [%s]", updateString);
ILibRemoteLogging_SendCommand(obj, (ILibRemoteLogging_Modules)(ILibRemoteLogging_Modules_WebRTC_DTLS | 0x8000), ILibRemoteLogging_Flags_VerbosityLevel_1, temp, tempLen, userContext);
}
if((module & ILibRemoteLogging_Modules_WebRTC_SCTP) == ILibRemoteLogging_Modules_WebRTC_SCTP)
{
tempLen = snprintf(temp, sizeof(temp), "WebRTC Module: SCTP [%s]", updateString);
ILibRemoteLogging_SendCommand(obj, (ILibRemoteLogging_Modules)(ILibRemoteLogging_Modules_WebRTC_SCTP | 0x8000), ILibRemoteLogging_Flags_VerbosityLevel_1, temp, tempLen, userContext);
}
if ((module & ILibRemoteLogging_Modules_Agent_GuardPost) == ILibRemoteLogging_Modules_Agent_GuardPost)
{
tempLen = snprintf(temp, sizeof(temp), "Agent Module: GuardPost [%s]", updateString);
ILibRemoteLogging_SendCommand(obj, (ILibRemoteLogging_Modules)(ILibRemoteLogging_Modules_Agent_GuardPost | 0x8000), ILibRemoteLogging_Flags_VerbosityLevel_1, temp, tempLen, userContext);
}
if ((module & ILibRemoteLogging_Modules_Agent_P2P) == ILibRemoteLogging_Modules_Agent_P2P)
{
tempLen = snprintf(temp, sizeof(temp), "Agent Module: Peer2Peer [%s]", updateString);
ILibRemoteLogging_SendCommand(obj, (ILibRemoteLogging_Modules)(ILibRemoteLogging_Modules_Agent_P2P | 0x8000), ILibRemoteLogging_Flags_VerbosityLevel_1, temp, tempLen, userContext);
}
if ((module & ILibRemoteLogging_Modules_Microstack_AsyncSocket) == ILibRemoteLogging_Modules_Microstack_AsyncSocket)
{
tempLen = snprintf(temp, sizeof(temp), "Microstack Module: AsyncSocket [%s]", updateString);
ILibRemoteLogging_SendCommand(obj, (ILibRemoteLogging_Modules)(ILibRemoteLogging_Modules_Microstack_AsyncSocket | 0x8000), ILibRemoteLogging_Flags_VerbosityLevel_1, temp, tempLen, userContext);
}
if ((module & ILibRemoteLogging_Modules_Microstack_Web) == ILibRemoteLogging_Modules_Microstack_Web)
{
tempLen = snprintf(temp, sizeof(temp), "Microstack Module: WebServer/Client [%s]", updateString);
ILibRemoteLogging_SendCommand(obj, (ILibRemoteLogging_Modules)(ILibRemoteLogging_Modules_Microstack_Web | 0x8000), ILibRemoteLogging_Flags_VerbosityLevel_1, temp, tempLen, userContext);
}
if ((module & ILibRemoteLogging_Modules_Microstack_Generic) == ILibRemoteLogging_Modules_Microstack_Generic)
{
tempLen = snprintf(temp, sizeof(temp), "Microstack Module: Generic [%s]", updateString);
ILibRemoteLogging_SendCommand(obj, (ILibRemoteLogging_Modules)(ILibRemoteLogging_Modules_Microstack_Generic | 0x8000), ILibRemoteLogging_Flags_VerbosityLevel_1, temp, tempLen, userContext);
}
if ((module & ILibRemoteLogging_Modules_Agent_KVM) == ILibRemoteLogging_Modules_Agent_KVM)
{
tempLen = snprintf(temp, sizeof(temp), "Agent Module: KVM [%s]", updateString);
ILibRemoteLogging_SendCommand(obj, (ILibRemoteLogging_Modules)(ILibRemoteLogging_Modules_Agent_KVM | 0x8000), ILibRemoteLogging_Flags_VerbosityLevel_1, temp, tempLen, userContext);
}
if ((module & ILibRemoteLogging_Modules_Microstack_NamedPipe) == ILibRemoteLogging_Modules_Microstack_NamedPipe)
{
tempLen = snprintf(temp, sizeof(temp), "Microstack Module: NamedPipe [%s]", updateString);
ILibRemoteLogging_SendCommand(obj, (ILibRemoteLogging_Modules)(ILibRemoteLogging_Modules_Microstack_NamedPipe | 0x8000), ILibRemoteLogging_Flags_VerbosityLevel_1, temp, tempLen, userContext);
}
}
int ILibRemoteLogging_IsModuleSet(ILibRemoteLogging loggingModule, ILibRemoteLogging_Modules module)
{
ILibRemoteLogging_Module *obj = (ILibRemoteLogging_Module*)loggingModule;
int i;
int retVal = 0;
sem_wait(&(obj->LogSyncLock));
for (i = 0; i < sizeof(obj->Sessions) / sizeof(ILibRemoteLogging_Session); ++i)
{
if (obj->Sessions[i].UserContext == NULL) { break; }
if ((obj->Sessions[i].Flags & module) == module) { retVal = 1; break; }
}
sem_post(&(obj->LogSyncLock));
return(retVal);
}
void ILibRemoteLogging_Forward(ILibRemoteLogging loggingModule, char* data, int dataLen)
{
ILibRemoteLogging_Module *obj = (ILibRemoteLogging_Module*)loggingModule;
int i;
if (obj->OutputSink == NULL) { return; }
sem_wait(&(obj->LogSyncLock));
for (i = 0; i < sizeof(obj->Sessions) / sizeof(ILibRemoteLogging_Session); ++i)
{
if (obj->Sessions[i].UserContext == NULL) { sem_post(&(obj->LogSyncLock)); return; }
sem_post(&(obj->LogSyncLock));
obj->OutputSink(obj, data, dataLen, obj->Sessions[i].UserContext);
sem_wait(&(obj->LogSyncLock));
}
sem_post(&(obj->LogSyncLock));
}
int ILibRemoteLogging_Dispatch(ILibRemoteLogging loggingModule, char* data, int dataLen, void *userContext)
{
ILibRemoteLogging_Module *obj = (ILibRemoteLogging_Module*)loggingModule;
unsigned short module;
unsigned short flags;
ILibRemoteLogging_Session *session = NULL;
if(dataLen == 0 || userContext == NULL)
{
return(1);
}
module = ILibRemoteLogging_ReadModuleType(data);
flags = ILibRemoteLogging_ReadFlags(data);
sem_wait(&(obj->LogSyncLock));
session = ILibRemoteLogging_GetSession(obj->Sessions, sizeof(obj->Sessions) / sizeof(ILibRemoteLogging_Session), userContext);
if(session == NULL) {sem_post(&(obj->LogSyncLock)); return(1);} // Too many users
if((flags & 0x3F) != 0x00)
{
// Change Verbosity of Logs
if((flags & 0x01) == 0x01)
{
// Disable Modules
session->Flags &= (0xFFFFFFFF ^ module);
sem_post(&(obj->LogSyncLock));
ILibRemoteLogging_Dispatch_Update(obj, module, "DISABLED", userContext);
}
else
{
// Enable Modules and Set Verbosity
session->Flags &= 0xFFC0FFFF; // Reset Verbosity Flags
session->Flags |= (flags << 16); // Set Verbosity Flags
session->Flags |= (unsigned int)module; // Enable Modules
sem_post(&(obj->LogSyncLock));
ILibRemoteLogging_Dispatch_Update(obj, module, "ENABLED", userContext);
}
}
else
{
// Module Specific Commands
ILibRemoteLogging_OnCommand command = obj->CommandSink[ILibWhichPowerOfTwo((int)module)];
sem_post(&(obj->LogSyncLock));
if(command!=NULL)
{
command(loggingModule, (ILibRemoteLogging_Modules)module, flags, data, dataLen, userContext);
}
}
return(0);
}
#endif |
the_stack_data/61074058.c | /* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*****************************************************************************
** The following is a simple implementation of posix conditions
*****************************************************************************/
#if defined(_WIN32)
#undef SAFE_MUTEX /* Avoid safe_mutex redefinitions */
#include "mysys_priv.h"
#include <m_string.h>
#include <process.h>
#include <sys/timeb.h>
int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr)
{
cond->waiting= 0;
InitializeCriticalSection(&cond->lock_waiting);
cond->events[SIGNAL]= CreateEvent(NULL, /* no security */
FALSE, /* auto-reset event */
FALSE, /* non-signaled initially */
NULL); /* unnamed */
/* Create a manual-reset event. */
cond->events[BROADCAST]= CreateEvent(NULL, /* no security */
TRUE, /* manual-reset */
FALSE, /* non-signaled initially */
NULL); /* unnamed */
cond->broadcast_block_event= CreateEvent(NULL, /* no security */
TRUE, /* manual-reset */
TRUE, /* signaled initially */
NULL); /* unnamed */
if( cond->events[SIGNAL] == NULL ||
cond->events[BROADCAST] == NULL ||
cond->broadcast_block_event == NULL )
return ENOMEM;
return 0;
}
int pthread_cond_destroy(pthread_cond_t *cond)
{
DeleteCriticalSection(&cond->lock_waiting);
if (CloseHandle(cond->events[SIGNAL]) == 0 ||
CloseHandle(cond->events[BROADCAST]) == 0 ||
CloseHandle(cond->broadcast_block_event) == 0)
return EINVAL;
return 0;
}
int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
{
return pthread_cond_timedwait(cond,mutex,NULL);
}
int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
struct timespec *abstime)
{
int result;
long timeout;
union ft64 now;
if( abstime != NULL )
{
GetSystemTimeAsFileTime(&now.ft);
/*
Calculate time left to abstime
- subtract start time from current time(values are in 100ns units)
- convert to millisec by dividing with 10000
*/
timeout= (long)((abstime->tv.i64 - now.i64) / 10000);
/* Don't allow the timeout to be negative */
if (timeout < 0)
timeout= 0L;
/*
Make sure the calucated timeout does not exceed original timeout
value which could cause "wait for ever" if system time changes
*/
if (timeout > abstime->max_timeout_msec)
timeout= abstime->max_timeout_msec;
}
else
{
/* No time specified; don't expire */
timeout= INFINITE;
}
/*
Block access if previous broadcast hasn't finished.
This is just for safety and should normally not
affect the total time spent in this function.
*/
WaitForSingleObject(cond->broadcast_block_event, INFINITE);
EnterCriticalSection(&cond->lock_waiting);
cond->waiting++;
LeaveCriticalSection(&cond->lock_waiting);
LeaveCriticalSection(mutex);
result= WaitForMultipleObjects(2, cond->events, FALSE, timeout);
EnterCriticalSection(&cond->lock_waiting);
cond->waiting--;
if (cond->waiting == 0)
{
/*
We're the last waiter to be notified or to stop waiting, so
reset the manual event.
*/
/* Close broadcast gate */
ResetEvent(cond->events[BROADCAST]);
/* Open block gate */
SetEvent(cond->broadcast_block_event);
}
LeaveCriticalSection(&cond->lock_waiting);
EnterCriticalSection(mutex);
return result == WAIT_TIMEOUT ? ETIMEDOUT : 0;
}
int pthread_cond_signal(pthread_cond_t *cond)
{
EnterCriticalSection(&cond->lock_waiting);
if(cond->waiting > 0)
SetEvent(cond->events[SIGNAL]);
LeaveCriticalSection(&cond->lock_waiting);
return 0;
}
int pthread_cond_broadcast(pthread_cond_t *cond)
{
EnterCriticalSection(&cond->lock_waiting);
/*
The mutex protect us from broadcasting if
there isn't any thread waiting to open the
block gate after this call has closed it.
*/
if(cond->waiting > 0)
{
/* Close block gate */
ResetEvent(cond->broadcast_block_event);
/* Open broadcast gate */
SetEvent(cond->events[BROADCAST]);
}
LeaveCriticalSection(&cond->lock_waiting);
return 0;
}
int pthread_attr_init(pthread_attr_t *connect_att)
{
connect_att->dwStackSize = 0;
connect_att->dwCreatingFlag = 0;
return 0;
}
int pthread_attr_setstacksize(pthread_attr_t *connect_att,DWORD stack)
{
connect_att->dwStackSize=stack;
return 0;
}
int pthread_attr_destroy(pthread_attr_t *connect_att)
{
bzero((uchar*) connect_att,sizeof(*connect_att));
return 0;
}
/****************************************************************************
** Fix localtime_r() to be a bit safer
****************************************************************************/
struct tm *localtime_r(const time_t *timep,struct tm *tmp)
{
if (*timep == (time_t) -1) /* This will crash win32 */
{
bzero(tmp,sizeof(*tmp));
}
else
{
struct tm *res=localtime(timep);
if (!res) /* Wrong date */
{
bzero(tmp,sizeof(*tmp)); /* Keep things safe */
return 0;
}
*tmp= *res;
}
return tmp;
}
#endif /* __WIN__ */
|
the_stack_data/111079151.c | /*Copyright (c) 2016 CareerMonk Publications and others.
#E-Mail : [email protected]
#Creation Date : 2008-01-10 06:15:46
#Created by : Narasimha Karumanchi
#Book Title : Data Structures And Algorithms Made Easy
#Warranty : This software is provided "as is" without any
# warranty; without even the implied warranty of
# merchantability or fitness for a particular purpose.*/
#include<stdio.h>
int countingNumberofOneswithBitwiseAND(unsigned int n){
int count =0;
while(n){
if(n&1){
count++;
}
n=n>>1;
}
return count;
}
void countingNumberofOneswithBitwiseAND_test(){
int i=10;
printf("Number of one's in %d is/are %d\n",i, countingNumberofOneswithBitwiseAND(i));
i = 5;
printf("Number of one's in %d is/are %d\n",i, countingNumberofOneswithBitwiseAND(i));
i = 100;
printf("Number of one's in %d is/are %d\n",i, countingNumberofOneswithBitwiseAND(i));
i = 1;
printf("Number of one's in %d is/are %d\n",i, countingNumberofOneswithBitwiseAND(i));
i = 0;
printf("Number of one's in %d is/are %d\n",i, countingNumberofOneswithBitwiseAND(i));
}
|
the_stack_data/20450422.c | #include <stdio.h>
int main()
{
int number;
scanf("%d",&number);
switch (number)
{
case 10:
printf("Number is 10\n");
break;
case 9:
printf("Number is 9\n");
case 8:
printf("Number is 8\n");
}
return 0;
}
//This program shows how to check any given numbers
// If it is matched then it will be printed
// If it is not matched then it will not be printed
|
the_stack_data/229146.c | # include<stdio.h>
# define llu unsigned long long int
int main()
{
int t,i,n;
llu power[70];
power[0]=1;
power[1]=3;
for(i=2;i<=70;i++)
{
power[i]=power[i-1]*3;
}
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
printf("%llu\n",power[n]-1);
}
return 0;
} |
the_stack_data/88396.c | #include <stdio.h>
int main() {
int t;
scanf("%d", &t);
while (t--) {
long int n, m, s;
scanf("%ld %ld %ld", &n, &m, &s);
int r = (s + m - 1) % n;
if (0 == r) {
printf("%ld\n", n);
} else {
printf("%d\n", r);
}
}
return 0;
}
|
the_stack_data/108923.c | int a;
int func(void) {
a = 10;
return a;
}
void main(void) {
a = func() + 1;
a;
}
|
the_stack_data/69558.c | // Copyright (c) 2016 Wladimir J. van der Laan
// Distributed under the MIT software license.
// Based on the Apple OpenCL "Hello World" demo
// gcc hello.c -o hello -O2 /usr/lib/x86_64-linux-gnu/libOpenCL.so.1
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#define CL_USE_DEPRECATED_OPENCL_1_2_APIS
#include <CL/cl.h>
#ifndef CL_DEVICE_PCI_BUS_ID_NV
#define CL_DEVICE_PCI_BUS_ID_NV (0x4008)
#endif
struct platform_data_item {
int id;
char *name;
};
struct platform_data_item platform_data_items[] = {
{ CL_PLATFORM_PROFILE, "Profile"},
{ CL_PLATFORM_VERSION, "Version"},
{ CL_PLATFORM_NAME, "Name"},
{ CL_PLATFORM_VENDOR, "Vendor"},
{ CL_PLATFORM_EXTENSIONS, "Extensions"},
};
#define ARRAYLEN(array) (sizeof(array)/sizeof((array)[0]))
////////////////////////////////////////////////////////////////////////////////
// Use a static data size for simplicity
//
#define DATA_SIZE (1024)
////////////////////////////////////////////////////////////////////////////////
// Simple compute kernel which computes the square of an input array
//
const char *KernelSource = "\n" \
"__kernel void square( \n" \
" __global float* input, \n" \
" __global float* output, \n" \
" const unsigned int count) \n" \
"{ \n" \
" int i = get_global_id(0); \n" \
" if(i < count) \n" \
" output[i] = input[i] * input[i]; \n" \
"} \n" \
"\n";
////////////////////////////////////////////////////////////////////////////////
// Dump binary to disk
void dump_binaries(cl_program program, const char *name)
{
int err;
size_t retsize;
size_t progcount = 0;
size_t *sizes = NULL;
void *data = NULL;
void **binaries = NULL;
err = clGetProgramInfo(program, CL_PROGRAM_BINARY_SIZES, 0, NULL, &retsize);
if (err != CL_SUCCESS) {
printf("error requesting program binary sizes\n");
goto cleanup;
}
progcount = retsize / sizeof(size_t);
sizes = calloc(progcount, sizeof(size_t));
err = clGetProgramInfo(program, CL_PROGRAM_BINARY_SIZES, progcount*sizeof(void*), sizes, &retsize);
size_t total_size = 0;
for (size_t bid=0; bid<progcount; ++bid) {
total_size += sizes[bid];
}
printf("success: got back %i binaries, total size %i\n", (int)progcount, (int)total_size);
data = malloc(total_size);
binaries = calloc(progcount, sizeof(void*));
void *ptr = data;
for (size_t bid=0; bid<progcount; ++bid) {
binaries[bid] = ptr;
ptr += sizes[bid];
}
err = clGetProgramInfo(program, CL_PROGRAM_BINARIES, progcount*sizeof(void*), binaries, &retsize);
if (err != CL_SUCCESS) {
printf("error: CL_PROGRAM_BINARIES error\n");
goto cleanup;
}
if (retsize != progcount * sizeof(void*)) {
printf("error: CL_PROGRAM_BINARIES size mismatch\n");
goto cleanup;
}
for (size_t bid=0; bid<progcount; ++bid) {
char filename[80];
FILE *f;
snprintf(filename, sizeof(filename), "%s%i.gallium_bin", name, (int)bid);
f = fopen(filename, "wb");
fwrite(binaries[bid], sizes[bid], 1, f);
fclose(f);
printf("binary %i: size %i dumped to %s\n", (int)bid, (int)sizes[bid], filename);
}
cleanup:
if (sizes)
free(sizes);
if (binaries)
free(binaries);
if (data)
free(data);
}
void print_info(cl_device_id device) {
char* value;
size_t valueSize;
// print device name
clGetDeviceInfo(device, CL_DEVICE_NAME, 0, NULL, &valueSize);
value = (char*) malloc(valueSize);
clGetDeviceInfo(device, CL_DEVICE_NAME, valueSize, value, NULL);
printf("Device: %s\n", value);
free(value);
unsigned bus_id = 0;
clGetDeviceInfo(device, CL_DEVICE_PCI_BUS_ID_NV, sizeof(unsigned), &bus_id, NULL);
printf(" PCI bus id: %d\n", bus_id);
// print hardware device version
clGetDeviceInfo(device, CL_DEVICE_VERSION, 0, NULL, &valueSize);
value = (char*) malloc(valueSize);
clGetDeviceInfo(device, CL_DEVICE_VERSION, valueSize, value, NULL);
printf(" %d Hardware version: %s\n", 1, value);
free(value);
// print software driver version
clGetDeviceInfo(device, CL_DRIVER_VERSION, 0, NULL, &valueSize);
value = (char*) malloc(valueSize);
clGetDeviceInfo(device, CL_DRIVER_VERSION, valueSize, value, NULL);
printf(" %d Software version: %s\n", 2, value);
free(value);
// print c version supported by compiler for device
clGetDeviceInfo(device, CL_DEVICE_OPENCL_C_VERSION, 0, NULL, &valueSize);
value = (char*) malloc(valueSize);
clGetDeviceInfo(device, CL_DEVICE_OPENCL_C_VERSION, valueSize, value, NULL);
printf(" %d OpenCL C version: %s\n", 3, value);
free(value);
}
int main(int argc, char** argv)
{
int err; // error code returned from api calls
float data[DATA_SIZE]; // original data set given to device
float results[DATA_SIZE]; // results returned from device
unsigned int correct; // number of correct results returned
size_t global; // global domain size for our calculation
size_t local; // local domain size for our calculation
cl_uint platformCount = 0;
cl_platform_id* platforms;
int deviceCount = 0;
cl_device_id* devices;
cl_device_id device_id;
cl_context_properties props[3] = { CL_CONTEXT_PLATFORM, 0, 0 };
cl_context context; // compute context
cl_command_queue commands; // compute command queue
cl_program program; // compute program
cl_kernel kernel; // compute kernel
cl_mem input; // device memory used for the input array
cl_mem output; // device memory used for the output array
// Fill our data set with random float values
//
int i = 0;
unsigned int count = DATA_SIZE;
for(i = 0; i < count; i++)
data[i] = rand() / (float)RAND_MAX;
// get all platforms
if (clGetPlatformIDs(0, NULL, &platformCount) != CL_SUCCESS) {
printf("Unable to get platform IDs\n");
exit(1);
}
platforms = (cl_platform_id*) malloc(sizeof(cl_platform_id) * platformCount);
if (clGetPlatformIDs(platformCount, platforms, NULL) != CL_SUCCESS) {
printf("Unable to get platform IDs\n");
exit(1);
}
for (i = 0; i < 1; i++) {
printf("%i. Platform %p\n", i+1, platforms[i]);
char data[1024];
size_t retsize;
for (int j=0; j<ARRAYLEN(platform_data_items); ++j) {
if (clGetPlatformInfo(platforms[i], platform_data_items[j].id, sizeof(data), data, &retsize) != CL_SUCCESS || retsize == sizeof(data)) {
printf("Unable to get platform %s\n", platform_data_items[j].name);
continue;
}
printf(" %s: %s\n", platform_data_items[j].name, data);
}
}
// get device number
clGetDeviceIDs(platforms[0], CL_DEVICE_TYPE_GPU, 0, NULL, &deviceCount);
printf("Get GPU device number: %d\n", deviceCount);
devices = (cl_device_id*) malloc(sizeof(cl_device_id) * deviceCount);
// Connect to a compute device
//
int gpu = 1;
err = clGetDeviceIDs(platforms[0], gpu ? CL_DEVICE_TYPE_GPU : CL_DEVICE_TYPE_CPU, deviceCount, devices, NULL);
if (err != CL_SUCCESS)
{
printf("Error: Failed to get device IDs, code %d!\n", err);
return EXIT_FAILURE;
}
device_id = devices[0];
print_info(device_id);
props[1] = (cl_context_properties)platforms[0];
// Create a compute context
//
context = clCreateContext(props, 1, &device_id, NULL, NULL, &err);
if (!context)
{
printf("Error: Failed to create a compute context, code %d\n", err);
return EXIT_FAILURE;
}
// Create a command commands
//
commands = clCreateCommandQueue(context, device_id, 0, &err);
if (!commands)
{
printf("Error: Failed to create a command commands!\n");
return EXIT_FAILURE;
}
// Create the compute program from the source buffer
//
program = clCreateProgramWithSource(context, 1, (const char **) & KernelSource, NULL, &err);
if (!program)
{
printf("Error: Failed to create compute program!\n");
return EXIT_FAILURE;
}
// Build the program executable
//
const char *options = "-cl-std=CL1.2";
err = clBuildProgram(program, 1, &device_id, options, NULL, NULL);
if (err != CL_SUCCESS)
{
size_t len;
char buffer[2048];
printf("Error: Failed to build program executable, code %d\n", err);
clGetProgramBuildInfo(program, device_id, CL_PROGRAM_BUILD_LOG, 0, NULL, &len);
printf("Build log size: %ld\n", len);
clGetProgramBuildInfo(program, device_id, CL_PROGRAM_BUILD_LOG, len, buffer, NULL);
printf("%s\n", buffer);
exit(1);
}
dump_binaries(program, "square");
// Create the compute kernel in the program we wish to run
//
kernel = clCreateKernel(program, "square", &err);
if (!kernel || err != CL_SUCCESS)
{
printf("Error: Failed to create compute kernel!\n");
exit(1);
}
// Create the input and output arrays in device memory for our calculation
//
input = clCreateBuffer(context, CL_MEM_READ_ONLY, sizeof(float) * count, NULL, NULL);
output = clCreateBuffer(context, CL_MEM_WRITE_ONLY, sizeof(float) * count, NULL, NULL);
if (!input || !output)
{
printf("Error: Failed to allocate device memory!\n");
exit(1);
}
// Write our data set into the input array in device memory
//
err = clEnqueueWriteBuffer(commands, input, CL_TRUE, 0, sizeof(float) * count, data, 0, NULL, NULL);
if (err != CL_SUCCESS)
{
printf("Error: Failed to write to source array!\n");
exit(1);
}
// Set the arguments to our compute kernel
//
err = 0;
err = clSetKernelArg(kernel, 0, sizeof(cl_mem), &input);
err |= clSetKernelArg(kernel, 1, sizeof(cl_mem), &output);
err |= clSetKernelArg(kernel, 2, sizeof(unsigned int), &count);
if (err != CL_SUCCESS)
{
printf("Error: Failed to set kernel arguments! %d\n", err);
exit(1);
}
// Get the maximum work group size for executing the kernel on the device
//
err = clGetKernelWorkGroupInfo(kernel, device_id, CL_KERNEL_WORK_GROUP_SIZE, sizeof(local), &local, NULL);
if (err != CL_SUCCESS)
{
printf("Error: Failed to retrieve kernel work group info! %d\n", err);
exit(1);
}
// Execute the kernel over the entire range of our 1d input data set
// using the maximum number of work group items for this device
//
global = count;
err = clEnqueueNDRangeKernel(commands, kernel, 1, NULL, &global, &local, 0, NULL, NULL);
if (err)
{
printf("Error: Failed to execute kernel!\n");
return EXIT_FAILURE;
}
// Wait for the command commands to get serviced before reading back results
//
clFinish(commands);
// Read back the results from the device to verify the output
//
err = clEnqueueReadBuffer( commands, output, CL_TRUE, 0, sizeof(float) * count, results, 0, NULL, NULL );
if (err != CL_SUCCESS)
{
printf("Error: Failed to read output array! %d\n", err);
exit(1);
}
// Validate our results
//
correct = 0;
for(i = 0; i < count; i++)
{
if(results[i] == data[i] * data[i])
correct++;
}
// Print a brief summary detailing the results
//
printf("Computed '%d/%d' correct values!\n", correct, count);
// Shutdown and cleanup
//
clReleaseMemObject(input);
clReleaseMemObject(output);
clReleaseProgram(program);
clReleaseKernel(kernel);
clReleaseCommandQueue(commands);
clReleaseContext(context);
free(devices);
return 0;
}
|
the_stack_data/874035.c | #include <stdio.h>
#include <string.h>
main()
{
int t,a,n;
long long sum=0;
char ch[10];
scanf("%d",&t);
while(t--)
{
scanf("%s",ch);
if(strcmp(ch,"donate")==0)
{
scanf("%d",&n);
sum=sum+n;
}
else if(strcmp(ch,"report")==0)
{
printf("%lld\n",sum);
}
}
return 0;
}
|
the_stack_data/86075954.c | /*
Author : Arnob Mahmud
mail : [email protected]
*/
#include <stdio.h>
#include <math.h>
int main(int argc, char const *argv[])
{
float a, b, x, side;
printf("Enter value of a:\n");
scanf("%f", &a);
printf("Enter value of b:\n");
scanf("%f", &b);
printf("Enter value of x in radian:\n");
scanf("%f", &x);
side = sqrt(pow(a, 2) + pow(b, 2) - 2 * a * b * cos(x));
printf("Side is %.2f.\n", side);
return 0;
}
|
the_stack_data/500283.c | #include <curses.h>
#include <stdlib.h>
#include <time.h>
#define STARTX 9
#define STARTY 3
#define WIDTH 6
#define HEIGHT 4
#define BLANK 0
typedef struct _tile {
int x;
int y;
}tile;
void init_board(int **board, int n, tile *blank);
void board(WINDOW *win, int starty, int startx, int lines, int cols,
int tile_width, int tile_height);
void shuffle_board(int **board, int n);
void move_blank(int direction, int **s_board, int n, tile *blank);
int check_win(int **s_board, int n, tile *blank);
enum { LEFT, RIGHT, UP, DOWN };
int main(int argc, char *argv[])
{ int **s_board;
int n, i, ch;
tile blank;
if(argc != 2)
{ printf("Usage: %s <shuffle board order>\n", argv[0]);
exit(1);
}
n = atoi(argv[1]);
s_board = (int **)calloc(n, sizeof(int *));
for(i = 0;i < n; ++i)
s_board[i] = (int *)calloc(n, sizeof(int));
init_board(s_board, n, &blank);
initscr();
keypad(stdscr, TRUE);
cbreak();
shuffle_board(s_board, n);
while((ch = getch()) != KEY_F(1))
{ switch(ch)
{ case KEY_LEFT:
move_blank(RIGHT, s_board, n, &blank);
break;
case KEY_RIGHT:
move_blank(LEFT, s_board, n, &blank);
break;
case KEY_UP:
move_blank(DOWN, s_board, n, &blank);
break;
case KEY_DOWN:
move_blank(UP, s_board, n, &blank);
break;
}
shuffle_board(s_board, n);
if(check_win(s_board, n, &blank) == TRUE)
{ mvprintw(24, 0, "You Win !!!\n");
refresh();
break;
}
}
endwin();
return 0;
}
void move_blank(int direction, int **s_board, int n, tile *blank)
{ int temp;
switch(direction)
{ case LEFT:
{ if(blank->x != 0)
{ --blank->x;
temp = s_board[blank->x][blank->y];
s_board[blank->x + 1][blank->y] = temp;
s_board[blank->x][blank->y] = BLANK;
}
}
break;
case RIGHT:
{ if(blank->x != n - 1)
{ ++blank->x;
temp = s_board[blank->x][blank->y];
s_board[blank->x - 1][blank->y] = temp;
s_board[blank->x][blank->y] = BLANK;
}
}
break;
case UP:
{ if(blank->y != 0)
{ --blank->y;
temp = s_board[blank->x][blank->y];
s_board[blank->x][blank->y + 1] = temp;
s_board[blank->x][blank->y] = BLANK;
}
}
break;
case DOWN:
{ if(blank->y != n - 1)
{ ++blank->y;
temp = s_board[blank->x][blank->y];
s_board[blank->x][blank->y - 1] = temp;
s_board[blank->x][blank->y] = BLANK;
}
}
break;
}
}
int check_win(int **s_board, int n, tile *blank)
{ int i, j;
s_board[blank->x][blank->y] = n * n;
for(i = 0;i < n; ++i)
for(j = 0;j < n; ++j)
if(s_board[i][j] != j * n + i + 1)
{ s_board[blank->x][blank->y] = BLANK;
return FALSE;
}
s_board[blank->x][blank->y] = BLANK;
return TRUE;
}
void init_board(int **s_board, int n, tile *blank)
{ int i, j, k;
int *temp_board;
temp_board = (int *)calloc(n * n, sizeof(int));
srand(time(NULL));
for(i = 0;i < n * n; ++i)
{
repeat :
k = rand() % (n * n);
for(j = 0;j <= i - 1; ++j)
if (k == temp_board[j])
goto repeat;
else
temp_board[i] = k;
}
k = 0;
for (i = 0;i < n;++i)
for(j = 0;j < n; ++j,++k)
{ if(temp_board[k] == 0)
{ blank->x = i;
blank->y = j;
}
s_board[i][j] = temp_board[k];
}
free(temp_board);
}
void board(WINDOW *win, int starty, int startx, int lines, int cols,
int tile_width, int tile_height)
{ int endy, endx, i, j;
endy = starty + lines * tile_height;
endx = startx + cols * tile_width;
for(j = starty; j <= endy; j += tile_height)
for(i = startx; i <= endx; ++i)
mvwaddch(win, j, i, ACS_HLINE);
for(i = startx; i <= endx; i += tile_width)
for(j = starty; j <= endy; ++j)
mvwaddch(win, j, i, ACS_VLINE);
mvwaddch(win, starty, startx, ACS_ULCORNER);
mvwaddch(win, endy, startx, ACS_LLCORNER);
mvwaddch(win, starty, endx, ACS_URCORNER);
mvwaddch(win, endy, endx, ACS_LRCORNER);
for(j = starty + tile_height; j <= endy - tile_height; j += tile_height)
{ mvwaddch(win, j, startx, ACS_LTEE);
mvwaddch(win, j, endx, ACS_RTEE);
for(i = startx + tile_width; i <= endx - tile_width; i += tile_width)
mvwaddch(win, j, i, ACS_PLUS);
}
for(i = startx + tile_width; i <= endx - tile_width; i += tile_width)
{ mvwaddch(win, starty, i, ACS_TTEE);
mvwaddch(win, endy, i, ACS_BTEE);
}
wrefresh(win);
}
void shuffle_board(int **s_board, int n)
{ int i,j, deltax, deltay;
int startx, starty;
starty = (LINES - n * HEIGHT) / 2;
startx = (COLS - n * WIDTH) / 2;
clear();
mvprintw(24, 0, "Press F1 to Exit");
board(stdscr, starty, startx, n, n, WIDTH, HEIGHT);
deltay = HEIGHT / 2;
deltax = WIDTH / 2;
for(j = 0; j < n; ++j)
for(i = 0;i < n; ++i)
if(s_board[i][j] != BLANK)
mvprintw(starty + j * HEIGHT + deltay,
startx + i * WIDTH + deltax,
"%-2d", s_board[i][j]);
refresh();
}
|
the_stack_data/41208.c | #include <stdio.h>
int * SortMe(int* arr){
int n=10;
int i, j, position, swap;
for (i = 0; i < (n - 1); i++) {
position = i;
for (j = i + 1; j < n; j++) {
if ( arr[position] > arr[j] )
position = j;
}
if ( position != i ) {
swap = arr[i];
arr[i] = arr[position];
arr[position] = swap;
}
}
return arr;
}
int main() {
int arr[10]={6,12,0,18,11,99,55,45,34,2};
printf("Unsorted!\n[ ");
for (int i = 0; i < 10; i++){
printf("%d ,", arr[i]);
}
int* sorted = SortMe(arr);
printf(" ]\nSorted!\n[ ");
for (int i = 0; i < 10; i++){
printf("%d ,", sorted[i] );
}
printf(" ]\n");
return 0;
}
|
the_stack_data/107935.c | #include <time.h>
time_t time(time_t* t) {
// TODO
return 0;
}
double difftime(time_t time1, time_t time0) {
// TODO
return 0;
}
char *asctime(const struct tm *tm) {
// TODO --
return 0;
}
char *ctime(const time_t *timep) {
// TODO --
return 0;
}
struct tm *gmtime(const time_t *timep) {
// TODO
return 0;
}
struct tm *localtime(const time_t *timep) {
// TODO
return 0;
}
time_t mktime(struct tm *tm) {
// TODO
return 0;
}
size_t strftime(char *s, size_t max, const char *format, const struct tm *tm) {
// TODO
return 0;
}
clock_t clock(void) {
// TODO
return 0;
}
/* vim: set sts=0 ts=4 sw=4 tw=0 noet :*/
|
the_stack_data/87380.c | #ifdef BAKING_APP
#include "baking_auth.h"
#include "apdu.h"
#include "globals.h"
#include "keys.h"
#include "memory.h"
#include "protocol.h"
#include "to_string.h"
#include "ui.h"
#include "os_cx.h"
#include <string.h>
bool is_valid_level(level_t lvl) {
return !(lvl & 0xC0000000);
}
void write_high_water_mark(parsed_baking_data_t const *const in) {
check_null(in);
if (!is_valid_level(in->level)) THROW(EXC_WRONG_VALUES);
UPDATE_NVRAM(ram, {
// If the chain matches the main chain *or* the main chain is not set, then use 'main' HWM.
high_watermark_t volatile *const dest = select_hwm_by_chain(in->chain_id, ram);
if ((in->level > dest->highest_level) || (in->round > dest->highest_round)) {
dest->had_endorsement = false;
dest->had_preendorsement = false;
};
dest->highest_level = CUSTOM_MAX(in->level, dest->highest_level);
dest->highest_round = in->round;
dest->had_endorsement |=
(in->type == BAKING_TYPE_ENDORSEMENT || in->type == BAKING_TYPE_TENDERBAKE_ENDORSEMENT);
dest->had_preendorsement |= in->type == BAKING_TYPE_TENDERBAKE_PREENDORSEMENT;
dest->migrated_to_tenderbake |= in->is_tenderbake;
});
}
void authorize_baking(derivation_type_t const derivation_type,
bip32_path_t const *const bip32_path) {
check_null(bip32_path);
if (bip32_path->length > NUM_ELEMENTS(N_data.baking_key.bip32_path.components) ||
bip32_path->length == 0)
return;
UPDATE_NVRAM(ram, {
ram->baking_key.derivation_type = derivation_type;
copy_bip32_path(&ram->baking_key.bip32_path, bip32_path);
});
}
static bool is_level_authorized(parsed_baking_data_t const *const baking_info) {
check_null(baking_info);
if (!is_valid_level(baking_info->level)) return false;
high_watermark_t volatile const *const hwm =
select_hwm_by_chain(baking_info->chain_id, &N_data);
if (baking_info->is_tenderbake) {
return baking_info->level > hwm->highest_level ||
(baking_info->level == hwm->highest_level &&
baking_info->round > hwm->highest_round) ||
// It is ok to sign an endorsement if we have not already signed an endorsement for
// the level/round
(baking_info->level == hwm->highest_level &&
baking_info->round == hwm->highest_round &&
baking_info->type == BAKING_TYPE_TENDERBAKE_ENDORSEMENT && !hwm->had_endorsement) ||
// It is ok to sign a preendorsement if we have not already signed neither an
// endorsement nor a preendorsement for the level/round
(baking_info->level == hwm->highest_level &&
baking_info->round == hwm->highest_round &&
baking_info->type == BAKING_TYPE_TENDERBAKE_PREENDORSEMENT &&
!hwm->had_endorsement && !hwm->had_preendorsement);
} else {
if (hwm->migrated_to_tenderbake) return false;
return baking_info->level > hwm->highest_level
// Levels are tied. In order for this to be OK, this must be an endorsement, and we
// must not have previously seen an endorsement.
|| (baking_info->level == hwm->highest_level &&
baking_info->type == BAKING_TYPE_ENDORSEMENT && !hwm->had_endorsement);
}
}
bool is_path_authorized(derivation_type_t const derivation_type,
bip32_path_t const *const bip32_path) {
check_null(bip32_path);
return derivation_type != 0 && derivation_type == N_data.baking_key.derivation_type &&
bip32_path->length > 0 &&
bip32_paths_eq(bip32_path, (const bip32_path_t *) &N_data.baking_key.bip32_path);
}
void guard_baking_authorized(parsed_baking_data_t const *const baking_info,
bip32_path_with_curve_t const *const key) {
check_null(baking_info);
check_null(key);
if (!is_path_authorized(key->derivation_type, &key->bip32_path)) THROW(EXC_SECURITY);
if (!is_level_authorized(baking_info)) THROW(EXC_WRONG_VALUES);
}
struct block_wire {
uint8_t magic_byte;
uint32_t chain_id;
uint32_t level;
uint8_t proto;
uint8_t predecessor[32];
uint64_t timestamp;
uint8_t validation_pass;
uint8_t operation_hash[32];
uint32_t fitness_size;
// ... beyond this we don't care
} __attribute__((packed));
struct consensus_op_wire {
uint8_t magic_byte;
uint32_t chain_id;
uint8_t branch[32];
uint8_t tag;
uint32_t level;
// ... beyond this we don't care
} __attribute__((packed));
struct tenderbake_consensus_op_wire {
uint8_t magic_byte;
uint32_t chain_id;
uint8_t branch[32];
uint8_t tag;
uint16_t slot;
uint32_t level;
uint32_t round;
uint8_t block_payload_hash[32];
} __attribute__((packed));
#define EMMY_FITNESS_SIZE 17
#define MAXIMUM_TENDERBAKE_FITNESS_SIZE 37 // When 'locked_round' != none
#define TENDERBAKE_PROTO_FITNESS_VERSION 2
uint8_t get_proto_version(void const *const fitness) {
return READ_UNALIGNED_BIG_ENDIAN(uint8_t, fitness + sizeof(uint32_t));
}
bool parse_block(parsed_baking_data_t *const out, void const *const data, size_t const length) {
if (length < sizeof(struct block_wire) + EMMY_FITNESS_SIZE) return false;
struct block_wire const *const block = data;
out->chain_id.v = READ_UNALIGNED_BIG_ENDIAN(uint32_t, &block->chain_id);
out->level = READ_UNALIGNED_BIG_ENDIAN(level_t, &block->level);
void const *const fitness = data + sizeof(struct block_wire);
uint8_t proto_version = get_proto_version(fitness);
switch (proto_version) {
case 0: // Emmy 0 to 4
case 1: // Emmy 5 to 11
out->type = BAKING_TYPE_BLOCK;
out->is_tenderbake = false;
out->round = 0; // irrelevant
return true;
case 2: // Tenderbake
out->type = BAKING_TYPE_TENDERBAKE_BLOCK;
out->is_tenderbake = true;
uint32_t fitness_size = READ_UNALIGNED_BIG_ENDIAN(uint32_t, &block->fitness_size);
if (fitness_size < (4 + sizeof(uint32_t)) || fitness + fitness_size > data + length ||
fitness_size > MAXIMUM_TENDERBAKE_FITNESS_SIZE) {
return false;
}
out->round = READ_UNALIGNED_BIG_ENDIAN(uint32_t, (fitness + fitness_size - 4));
return true;
default:
return false;
}
}
bool parse_consensus_operation(parsed_baking_data_t *const out,
void const *const data,
size_t const length) {
if (length < sizeof(struct consensus_op_wire)) return false;
struct consensus_op_wire const *const op = data;
out->chain_id.v = READ_UNALIGNED_BIG_ENDIAN(uint32_t, &op->chain_id);
out->level = READ_UNALIGNED_BIG_ENDIAN(uint32_t, &op->level);
switch (op->tag) {
case 0: // emmy endorsement (without slot)
out->type = BAKING_TYPE_ENDORSEMENT;
out->is_tenderbake = false;
out->round = 0; // irrelevant
return true;
case 20: // tenderbake preendorsement
case 21: // tenderbake endorsement
if (length < sizeof(struct tenderbake_consensus_op_wire)) return false;
struct tenderbake_consensus_op_wire const *const op = data;
out->is_tenderbake = true;
out->level = READ_UNALIGNED_BIG_ENDIAN(uint32_t, &op->level);
out->round = READ_UNALIGNED_BIG_ENDIAN(uint32_t, &op->round);
if (op->tag == 20) {
out->type = BAKING_TYPE_TENDERBAKE_PREENDORSEMENT;
} else {
out->type = BAKING_TYPE_TENDERBAKE_ENDORSEMENT;
}
return true;
default:
return false;
}
}
bool parse_baking_data(parsed_baking_data_t *const out,
void const *const data,
size_t const length) {
switch (get_magic_byte(data, length)) {
case MAGIC_BYTE_BAKING_OP:
case MAGIC_BYTE_TENDERBAKE_PREENDORSEMENT:
case MAGIC_BYTE_TENDERBAKE_ENDORSEMENT:
return parse_consensus_operation(out, data, length);
case MAGIC_BYTE_BLOCK:
case MAGIC_BYTE_TENDERBAKE_BLOCK:
return parse_block(out, data, length);
case MAGIC_BYTE_INVALID:
default:
return false;
}
}
#endif // #ifdef BAKING_APP
|
the_stack_data/993698.c | // if_scopes.c
typedef int T, U;
int x;
void f(void) {
if(sizeof(enum {T}))
// The declaration of T as an enumeration constant is
// visible in both branches:
x = sizeof(enum {U}) + T;
else {
// Here, the declaration of U as an enumeration constant
// is no longer visible, but that of T still is.
U u = (int)T;
}
switch(sizeof(enum {U})) x = U;
// Here, T and U are typedef names again:
T t; U u;
}
|
the_stack_data/165764463.c | /*-------------------------------------------------------------
es.c -- ETicket services
Copyright (C) 2008
Michael Wiedenbauer (shagkur)
Dave Murphy (WinterMute)
Hector Martin (marcan)
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
damages arising from the use of this software.
Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you
must not claim that you wrote the original software. If you use
this software in a product, an acknowledgment in the product
documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
-------------------------------------------------------------*/
#if defined(HW_RVL)
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <malloc.h>
#include <time.h>
#include <gcutil.h>
#include <ipc.h>
#include "isfs.h"
#define ISFS_STRUCTSIZE (sizeof(struct isfs_cb))
#define ISFS_HEAPSIZE (ISFS_STRUCTSIZE<<4)
#define ISFS_FUNCNULL 0
#define ISFS_FUNCGETSTAT 1
#define ISFS_FUNCREADDIR 2
#define ISFS_FUNCGETATTR 3
#define ISFS_FUNCGETUSAGE 4
#define ISFS_IOCTL_FORMAT 1
#define ISFS_IOCTL_GETSTATS 2
#define ISFS_IOCTL_CREATEDIR 3
#define ISFS_IOCTL_READDIR 4
#define ISFS_IOCTL_SETATTR 5
#define ISFS_IOCTL_GETATTR 6
#define ISFS_IOCTL_DELETE 7
#define ISFS_IOCTL_RENAME 8
#define ISFS_IOCTL_CREATEFILE 9
#define ISFS_IOCTL_SETFILEVERCTRL 10
#define ISFS_IOCTL_GETFILESTATS 11
#define ISFS_IOCTL_GETUSAGE 12
#define ISFS_IOCTL_SHUTDOWN 13
struct isfs_cb
{
char filepath[ISFS_MAXPATH];
union {
struct {
char filepathOld[ISFS_MAXPATH];
char filepathNew[ISFS_MAXPATH];
} fsrename;
struct {
u32 owner_id;
u16 group_id;
char filepath[ISFS_MAXPATH];
u8 ownerperm;
u8 groupperm;
u8 otherperm;
u8 attributes;
u8 pad0[2];
} fsattr;
struct {
ioctlv vector[4];
u32 no_entries;
} fsreaddir;
struct {
ioctlv vector[4];
u32 usage1;
u8 pad0[28];
u32 usage2;
} fsusage;
struct {
u32 a;
u32 b;
u32 c;
u32 d;
u32 e;
u32 f;
u32 g;
} fsstats;
};
isfscallback cb;
void *usrdata;
u32 functype;
void *funcargv[8];
};
static s32 hId = -1;
static s32 _fs_fd = -1;
static char _dev_fs[] ATTRIBUTE_ALIGN(32) = "/dev/fs";
static s32 __isfsGetStatsCB(s32 result,void *usrdata)
{
struct isfs_cb *param = (struct isfs_cb*)usrdata;
if(result==0) memcpy(param->funcargv[0],¶m->fsstats,sizeof(param->fsstats));
return result;
}
static s32 __isfsGetAttrCB(s32 result,void *usrdata)
{
struct isfs_cb *param = (struct isfs_cb*)usrdata;
if(result==0) {
*(u32*)(param->funcargv[0]) = param->fsattr.owner_id;
*(u16*)(param->funcargv[1]) = param->fsattr.group_id;
*(u8*)(param->funcargv[2]) = param->fsattr.attributes;
*(u8*)(param->funcargv[3]) = param->fsattr.ownerperm;
*(u8*)(param->funcargv[4]) = param->fsattr.groupperm;
*(u8*)(param->funcargv[5]) = param->fsattr.otherperm;
}
return result;
}
static s32 __isfsGetUsageCB(s32 result,void *usrdata)
{
struct isfs_cb *param = (struct isfs_cb*)usrdata;
if(result==0) {
*(u32*)(param->funcargv[0]) = param->fsusage.usage1;
*(u32*)(param->funcargv[1]) = param->fsusage.usage2;
}
return result;
}
static s32 __isfsReadDirCB(s32 result,void *usrdata)
{
struct isfs_cb *param = (struct isfs_cb*)usrdata;
if(result==0) *(u32*)(param->funcargv[0]) = param->fsreaddir.no_entries;
return result;
}
static s32 __isfsFunctionCB(s32 result,void *usrdata)
{
struct isfs_cb *param = (struct isfs_cb*)usrdata;
if(result>=0) {
if(param->functype==ISFS_FUNCGETSTAT) __isfsGetStatsCB(result,usrdata);
else if(param->functype==ISFS_FUNCREADDIR) __isfsReadDirCB(result,usrdata);
else if(param->functype==ISFS_FUNCGETATTR) __isfsGetAttrCB(result,usrdata);
else if(param->functype==ISFS_FUNCGETUSAGE) __isfsGetUsageCB(result,usrdata);
}
if(param->cb!=NULL) param->cb(result,param->usrdata);
iosFree(hId,param);
return result;
}
s32 ISFS_Initialize()
{
s32 ret = IPC_OK;
if(_fs_fd<0) {
_fs_fd = IOS_Open(_dev_fs,0);
if(_fs_fd<0) return _fs_fd;
}
if(hId<0) {
hId = iosCreateHeap(ISFS_HEAPSIZE);
if(hId<0) return IPC_ENOMEM;
}
return ret;
}
s32 ISFS_Deinitialize()
{
if(_fs_fd<0) return ISFS_EINVAL;
IOS_Close(_fs_fd);
_fs_fd = -1;
return 0;
}
s32 ISFS_ReadDir(const char *filepath,char *name_list,u32 *num)
{
s32 ret;
s32 len,cnt;
s32 ilen,olen;
struct isfs_cb *param;
if(_fs_fd<0 || filepath==NULL || num==NULL) return ISFS_EINVAL;
if(name_list!=NULL && ((u32)name_list%32)!=0) return ISFS_EINVAL;
len = strnlen(filepath,ISFS_MAXPATH);
if(len>=ISFS_MAXPATH) return ISFS_EINVAL;
param = (struct isfs_cb*)iosAlloc(hId,ISFS_STRUCTSIZE);
if(param==NULL) return ISFS_ENOMEM;
memcpy(param->filepath,filepath,(len+1));
param->fsreaddir.vector[0].data = param->filepath;
param->fsreaddir.vector[0].len = ISFS_MAXPATH;
param->fsreaddir.vector[1].data = ¶m->fsreaddir.no_entries;
param->fsreaddir.vector[1].len = sizeof(u32);
if(name_list!=NULL) {
ilen = olen = 2;
cnt = *num;
param->fsreaddir.no_entries = cnt;
param->fsreaddir.vector[2].data = name_list;
param->fsreaddir.vector[2].len = (cnt*13);
param->fsreaddir.vector[3].data = ¶m->fsreaddir.no_entries;
param->fsreaddir.vector[3].len = sizeof(u32);
} else
ilen = olen = 1;
ret = IOS_Ioctlv(_fs_fd,ISFS_IOCTL_READDIR,ilen,olen,param->fsreaddir.vector);
if(ret==0) *num = param->fsreaddir.no_entries;
if(param!=NULL) iosFree(hId,param);
return ret;
}
s32 ISFS_ReadDirAsync(const char *filepath,char *name_list,u32 *num,isfscallback cb,void *usrdata)
{
s32 len,cnt;
s32 ilen,olen;
struct isfs_cb *param;
if(_fs_fd<0 || filepath==NULL || num==NULL) return ISFS_EINVAL;
if(name_list!=NULL && ((u32)name_list%32)!=0) return ISFS_EINVAL;
len = strnlen(filepath,ISFS_MAXPATH);
if(len>=ISFS_MAXPATH) return ISFS_EINVAL;
param = (struct isfs_cb*)iosAlloc(hId,ISFS_STRUCTSIZE);
if(param==NULL) return ISFS_ENOMEM;
param->cb = cb;
param->usrdata = usrdata;
param->funcargv[0] = num;
param->functype = ISFS_FUNCREADDIR;
memcpy(param->filepath,filepath,(len+1));
param->fsreaddir.vector[0].data = param->filepath;
param->fsreaddir.vector[0].len = ISFS_MAXPATH;
param->fsreaddir.vector[1].data = ¶m->fsreaddir.no_entries;
param->fsreaddir.vector[1].len = sizeof(u32);
if(name_list!=NULL) {
ilen = olen = 2;
cnt = *num;
param->fsreaddir.no_entries = cnt;
param->fsreaddir.vector[2].data = name_list;
param->fsreaddir.vector[2].len = (cnt*13);
param->fsreaddir.vector[3].data = ¶m->fsreaddir.no_entries;
param->fsreaddir.vector[3].len = sizeof(u32);
} else
ilen = olen = 1;
return IOS_IoctlvAsync(_fs_fd,ISFS_IOCTL_READDIR,ilen,olen,param->fsreaddir.vector,__isfsFunctionCB,param);
}
s32 ISFS_CreateDir(const char *filepath,u8 attributes,u8 owner_perm,u8 group_perm,u8 other_perm)
{
s32 ret;
s32 len;
struct isfs_cb *param;
if(_fs_fd<0 || filepath==NULL) return ISFS_EINVAL;
len = strnlen(filepath,ISFS_MAXPATH);
if(len>=ISFS_MAXPATH) return ISFS_EINVAL;
param = (struct isfs_cb*)iosAlloc(hId,ISFS_STRUCTSIZE);
if(param==NULL) return ISFS_ENOMEM;
memcpy(param->fsattr.filepath ,filepath,(len+1));
param->fsattr.attributes = attributes;
param->fsattr.ownerperm = owner_perm;
param->fsattr.groupperm = group_perm;
param->fsattr.otherperm = other_perm;
ret = IOS_Ioctl(_fs_fd,ISFS_IOCTL_CREATEDIR,¶m->fsattr,sizeof(param->fsattr),NULL,0);
if(param!=NULL) iosFree(hId,param);
return ret;
}
s32 ISFS_CreateDirAsync(const char *filepath,u8 attributes,u8 owner_perm,u8 group_perm,u8 other_perm,isfscallback cb,void *usrdata)
{
s32 len;
struct isfs_cb *param;
if(_fs_fd<0 || filepath==NULL) return ISFS_EINVAL;
len = strnlen(filepath,ISFS_MAXPATH);
if(len>=ISFS_MAXPATH) return ISFS_EINVAL;
param = (struct isfs_cb*)iosAlloc(hId,ISFS_STRUCTSIZE);
if(param==NULL) return ISFS_ENOMEM;
param->cb = cb;
param->usrdata = usrdata;
param->functype = ISFS_FUNCNULL;
memcpy(param->fsattr.filepath,filepath,(len+1));
param->fsattr.attributes = attributes;
param->fsattr.ownerperm = owner_perm;
param->fsattr.groupperm = group_perm;
param->fsattr.otherperm = other_perm;
return IOS_IoctlAsync(_fs_fd,ISFS_IOCTL_CREATEDIR,¶m->fsattr,sizeof(param->fsattr),NULL,0,__isfsFunctionCB,param);
}
s32 ISFS_Open(const char *filepath,u8 mode)
{
s32 ret;
s32 len;
struct isfs_cb *param;
if(_fs_fd<0 || filepath==NULL) return ISFS_EINVAL;
len = strnlen(filepath,ISFS_MAXPATH);
if(len>=ISFS_MAXPATH) return ISFS_EINVAL;
param = (struct isfs_cb*)iosAlloc(hId,ISFS_STRUCTSIZE);
if(param==NULL) return ISFS_ENOMEM;
memcpy(param->filepath,filepath,(len+1));
ret = IOS_Open(param->filepath,mode);
if(param!=NULL) iosFree(hId,param);
return ret;
}
s32 ISFS_OpenAsync(const char *filepath,u8 mode,isfscallback cb,void *usrdata)
{
s32 len;
struct isfs_cb *param;
if(_fs_fd<0 || filepath==NULL) return ISFS_EINVAL;
len = strnlen(filepath,ISFS_MAXPATH);
if(len>=ISFS_MAXPATH) return ISFS_EINVAL;
param = (struct isfs_cb*)iosAlloc(hId,ISFS_STRUCTSIZE);
if(param==NULL) return ISFS_ENOMEM;
param->cb = cb;
param->usrdata = usrdata;
param->functype = ISFS_FUNCNULL;
memcpy(param->filepath,filepath,(len+1));
return IOS_OpenAsync(param->filepath,mode,__isfsFunctionCB,param);
}
s32 ISFS_Format()
{
if(_fs_fd<0) return ISFS_EINVAL;
return IOS_Ioctl(_fs_fd,ISFS_IOCTL_FORMAT,NULL,0,NULL,0);
}
s32 ISFS_FormatAsync(isfscallback cb,void *usrdata)
{
struct isfs_cb *param;
if(_fs_fd<0) return ISFS_EINVAL;
param = (struct isfs_cb*)iosAlloc(hId,ISFS_STRUCTSIZE);
if(param==NULL) return ISFS_ENOMEM;
param->cb = cb;
param->usrdata = usrdata;
param->functype = ISFS_FUNCNULL;
return IOS_IoctlAsync(_fs_fd,ISFS_IOCTL_FORMAT,NULL,0,NULL,0,__isfsFunctionCB,param);
}
s32 ISFS_GetStats(void *stats)
{
s32 ret = ISFS_OK;
struct isfs_cb *param;
if(_fs_fd<0 || stats==NULL) return ISFS_EINVAL;
param = (struct isfs_cb*)iosAlloc(hId,ISFS_STRUCTSIZE);
if(param==NULL) return ISFS_ENOMEM;
ret = IOS_Ioctl(_fs_fd,ISFS_IOCTL_GETSTATS,NULL,0,¶m->fsstats,sizeof(param->fsstats));
if(ret==IPC_OK) memcpy(stats,¶m->fsstats,sizeof(param->fsstats));
if(param!=NULL) iosFree(hId,param);
return ret;
}
s32 ISFS_GetStatsAsync(void *stats,isfscallback cb,void *usrdata)
{
struct isfs_cb *param;
if(_fs_fd<0 || stats==NULL) return ISFS_EINVAL;
param = (struct isfs_cb*)iosAlloc(hId,ISFS_STRUCTSIZE);
if(param==NULL) return ISFS_ENOMEM;
param->cb = cb;
param->usrdata = usrdata;
param->functype = ISFS_FUNCGETSTAT;
param->funcargv[0] = stats;
return IOS_IoctlAsync(_fs_fd,ISFS_IOCTL_GETSTATS,NULL,0,¶m->fsstats,sizeof(param->fsstats),__isfsFunctionCB,param);
}
s32 ISFS_Write(s32 fd,const void *buffer,u32 length)
{
if(length<=0 || buffer==NULL) return ISFS_EINVAL;
return IOS_Write(fd,buffer,length);
}
s32 ISFS_WriteAsync(s32 fd,const void *buffer,u32 length,isfscallback cb,void *usrdata)
{
struct isfs_cb *param;
if(length<=0 || buffer==NULL) return ISFS_EINVAL;
param = (struct isfs_cb*)iosAlloc(hId,ISFS_STRUCTSIZE);
if(param==NULL) return ISFS_ENOMEM;
param->cb = cb;
param->usrdata = usrdata;
param->functype = ISFS_FUNCNULL;
return IOS_WriteAsync(fd,buffer,length,__isfsFunctionCB,param);
}
s32 ISFS_Read(s32 fd,void *buffer,u32 length)
{
if(length<=0 || buffer==NULL || ((u32)buffer%32)!=0) return ISFS_EINVAL;
return IOS_Read(fd,buffer,length);
}
s32 ISFS_ReadAsync(s32 fd,void *buffer,u32 length,isfscallback cb,void *usrdata)
{
struct isfs_cb *param;
if(length<=0 || buffer==NULL || ((u32)buffer%32)!=0) return ISFS_EINVAL;
param = (struct isfs_cb*)iosAlloc(hId,ISFS_STRUCTSIZE);
if(param==NULL) return ISFS_ENOMEM;
param->cb = cb;
param->usrdata = usrdata;
param->functype = ISFS_FUNCNULL;
return IOS_ReadAsync(fd,buffer,length,__isfsFunctionCB,param);
}
s32 ISFS_Seek(s32 fd,s32 where,s32 whence)
{
return IOS_Seek(fd,where,whence);
}
s32 ISFS_SeekAsync(s32 fd,s32 where,s32 whence,isfscallback cb,void *usrdata)
{
struct isfs_cb *param;
param = (struct isfs_cb*)iosAlloc(hId,ISFS_STRUCTSIZE);
if(param==NULL) return ISFS_ENOMEM;
param->cb = cb;
param->usrdata = usrdata;
param->functype = ISFS_FUNCNULL;
return IOS_SeekAsync(fd,where,whence,__isfsFunctionCB,param);
}
s32 ISFS_CreateFile(const char *filepath,u8 attributes,u8 owner_perm,u8 group_perm,u8 other_perm)
{
s32 ret;
s32 len;
struct isfs_cb *param;
if(_fs_fd<0 || filepath==NULL) return ISFS_EINVAL;
len = strnlen(filepath,ISFS_MAXPATH);
if(len>=ISFS_MAXPATH) return ISFS_EINVAL;
param = (struct isfs_cb*)iosAlloc(hId,ISFS_STRUCTSIZE);
if(param==NULL) return ISFS_ENOMEM;
memcpy(param->fsattr.filepath,filepath,(len+1));
param->fsattr.attributes = attributes;
param->fsattr.ownerperm = owner_perm;
param->fsattr.groupperm = group_perm;
param->fsattr.otherperm = other_perm;
ret = IOS_Ioctl(_fs_fd,ISFS_IOCTL_CREATEFILE,¶m->fsattr,sizeof(param->fsattr),NULL,0);
if(param!=NULL) iosFree(hId,param);
return ret;
}
s32 ISFS_CreateFileAsync(const char *filepath,u8 attributes,u8 owner_perm,u8 group_perm,u8 other_perm,isfscallback cb,void *usrdata)
{
s32 len;
struct isfs_cb *param;
if(_fs_fd<0 || filepath==NULL) return ISFS_EINVAL;
len = strnlen(filepath,ISFS_MAXPATH);
if(len>=ISFS_MAXPATH) return ISFS_EINVAL;
param = (struct isfs_cb*)iosAlloc(hId,ISFS_STRUCTSIZE);
if(param==NULL) return ISFS_ENOMEM;
param->cb = cb;
param->usrdata = usrdata;
param->functype = ISFS_FUNCNULL;
memcpy(param->fsattr.filepath,filepath,(len+1));
param->fsattr.attributes = attributes;
param->fsattr.ownerperm = owner_perm;
param->fsattr.groupperm = group_perm;
param->fsattr.otherperm = other_perm;
return IOS_IoctlAsync(_fs_fd,ISFS_IOCTL_CREATEFILE,¶m->fsattr,sizeof(param->fsattr),NULL,0,__isfsFunctionCB,param);
}
s32 ISFS_Delete(const char *filepath)
{
s32 ret;
s32 len;
struct isfs_cb *param;
if(_fs_fd<0 || filepath==NULL) return ISFS_EINVAL;
len = strnlen(filepath,ISFS_MAXPATH);
if(len>=ISFS_MAXPATH) return ISFS_EINVAL;
param = (struct isfs_cb*)iosAlloc(hId,ISFS_STRUCTSIZE);
if(param==NULL) return ISFS_ENOMEM;
memcpy(param->filepath,filepath,(len+1));
ret = IOS_Ioctl(_fs_fd,ISFS_IOCTL_DELETE,param->filepath,ISFS_MAXPATH,NULL,0);
if(param!=NULL) iosFree(hId,param);
return ret;
}
s32 ISFS_DeleteAsync(const char *filepath,isfscallback cb,void *usrdata)
{
s32 len;
struct isfs_cb *param;
if(_fs_fd<0 || filepath==NULL) return ISFS_EINVAL;
len = strnlen(filepath,ISFS_MAXPATH);
if(len>=ISFS_MAXPATH) return ISFS_EINVAL;
param = (struct isfs_cb*)iosAlloc(hId,ISFS_STRUCTSIZE);
if(param==NULL) return ISFS_ENOMEM;
param->cb = cb;
param->usrdata = usrdata;
param->functype = ISFS_FUNCNULL;
memcpy(param->filepath,filepath,(len+1));
return IOS_IoctlAsync(_fs_fd,ISFS_IOCTL_DELETE,param->filepath,ISFS_MAXPATH,NULL,0,__isfsFunctionCB,param);
}
s32 ISFS_Close(s32 fd)
{
if(fd<0) return 0;
return IOS_Close(fd);
}
s32 ISFS_CloseAsync(s32 fd,isfscallback cb,void *usrdata)
{
struct isfs_cb *param;
if(fd<0) return 0;
param = (struct isfs_cb*)iosAlloc(hId,ISFS_STRUCTSIZE);
if(param==NULL) return ISFS_ENOMEM;
param->cb = cb;
param->usrdata = usrdata;
param->functype = ISFS_FUNCNULL;
return IOS_CloseAsync(fd,__isfsFunctionCB,param);
}
s32 ISFS_GetFileStats(s32 fd,fstats *status)
{
if(status==NULL || ((u32)status%32)!=0) return ISFS_EINVAL;
return IOS_Ioctl(fd,ISFS_IOCTL_GETFILESTATS,NULL,0,status,sizeof(fstats));
}
s32 ISFS_GetFileStatsAsync(s32 fd,fstats *status,isfscallback cb,void *usrdata)
{
struct isfs_cb *param;
if(status==NULL || ((u32)status%32)!=0) return ISFS_EINVAL;
param = (struct isfs_cb*)iosAlloc(hId,ISFS_STRUCTSIZE);
if(param==NULL) return ISFS_ENOMEM;
param->cb = cb;
param->usrdata = usrdata;
param->functype = ISFS_FUNCNULL;
return IOS_IoctlAsync(fd,ISFS_IOCTL_GETFILESTATS,NULL,0,status,sizeof(fstats),__isfsFunctionCB,param);
}
s32 ISFS_GetAttr(const char *filepath,u32 *ownerID,u16 *groupID,u8 *attributes,u8 *ownerperm,u8 *groupperm,u8 *otherperm)
{
s32 ret;
s32 len;
struct isfs_cb *param;
if(_fs_fd<0 || filepath==NULL || ownerID==NULL || groupID==NULL
|| attributes==NULL || ownerperm==NULL || groupperm==NULL || otherperm==NULL) return ISFS_EINVAL;
len = strnlen(filepath,ISFS_MAXPATH);
if(len>=ISFS_MAXPATH) return ISFS_EINVAL;
param = (struct isfs_cb*)iosAlloc(hId,ISFS_STRUCTSIZE);
if(param==NULL) return ISFS_ENOMEM;
memcpy(param->filepath,filepath,(len+1));
ret = IOS_Ioctl(_fs_fd,ISFS_IOCTL_GETATTR,param->filepath,ISFS_MAXPATH,¶m->fsattr,sizeof(param->fsattr));
if(ret==IPC_OK) {
*ownerID = param->fsattr.owner_id;
*groupID = param->fsattr.group_id;
*ownerperm = param->fsattr.ownerperm;
*groupperm = param->fsattr.groupperm;
*otherperm = param->fsattr.otherperm;
*attributes = param->fsattr.attributes;
}
if(param!=NULL) iosFree(hId,param);
return ret;
}
s32 ISFS_GetAttrAsync(const char *filepath,u32 *ownerID,u16 *groupID,u8 *attributes,u8 *ownerperm,u8 *groupperm,u8 *otherperm,isfscallback cb,void *usrdata)
{
s32 len;
struct isfs_cb *param;
if(_fs_fd<0 || filepath==NULL || ownerID==NULL || groupID==NULL
|| attributes==NULL || ownerperm==NULL || groupperm==NULL || otherperm==NULL) return ISFS_EINVAL;
len = strnlen(filepath,ISFS_MAXPATH);
if(len>=ISFS_MAXPATH) return ISFS_EINVAL;
param = (struct isfs_cb*)iosAlloc(hId,ISFS_STRUCTSIZE);
if(param==NULL) return ISFS_ENOMEM;
param->cb = cb;
param->usrdata = usrdata;
param->functype = ISFS_FUNCGETATTR;
param->funcargv[0] = ownerID;
param->funcargv[1] = groupID;
param->funcargv[2] = attributes;
param->funcargv[3] = ownerperm;
param->funcargv[4] = groupperm;
param->funcargv[5] = otherperm;
memcpy(param->filepath,filepath,(len+1));
return IOS_IoctlAsync(_fs_fd,ISFS_IOCTL_GETATTR,param->filepath,ISFS_MAXPATH,¶m->fsattr,sizeof(param->fsattr),__isfsFunctionCB,param);
}
s32 ISFS_Rename(const char *filepathOld,const char *filepathNew)
{
s32 ret;
s32 len0,len1;
struct isfs_cb *param;
if(_fs_fd<0 || filepathOld==NULL || filepathNew==NULL) return ISFS_EINVAL;
len0 = strnlen(filepathOld,ISFS_MAXPATH);
if(len0>=ISFS_MAXPATH) return ISFS_EINVAL;
len1 = strnlen(filepathNew,ISFS_MAXPATH);
if(len1>=ISFS_MAXPATH) return ISFS_EINVAL;
param = (struct isfs_cb*)iosAlloc(hId,ISFS_STRUCTSIZE);
if(param==NULL) return ISFS_ENOMEM;
memcpy(param->fsrename.filepathOld,filepathOld,(len0+1));
memcpy(param->fsrename.filepathNew,filepathNew,(len1+1));
ret = IOS_Ioctl(_fs_fd,ISFS_IOCTL_RENAME,¶m->fsrename,sizeof(param->fsrename),NULL,0);
if(param!=NULL) iosFree(hId,param);
return ret;
}
s32 ISFS_RenameAsync(const char *filepathOld,const char *filepathNew,isfscallback cb,void *usrdata)
{
s32 len0,len1;
struct isfs_cb *param;
if(_fs_fd<0 || filepathOld==NULL || filepathNew==NULL) return ISFS_EINVAL;
len0 = strnlen(filepathOld,ISFS_MAXPATH);
if(len0>=ISFS_MAXPATH) return ISFS_EINVAL;
len1 = strnlen(filepathNew,ISFS_MAXPATH);
if(len1>=ISFS_MAXPATH) return ISFS_EINVAL;
param = (struct isfs_cb*)iosAlloc(hId,ISFS_STRUCTSIZE);
if(param==NULL) return ISFS_ENOMEM;
param->cb = cb;
param->usrdata = usrdata;
param->functype = ISFS_FUNCNULL;
memcpy(param->fsrename.filepathOld,filepathOld,(len0+1));
memcpy(param->fsrename.filepathNew,filepathNew,(len1+1));
return IOS_IoctlAsync(_fs_fd,ISFS_IOCTL_RENAME,¶m->fsrename,sizeof(param->fsrename),NULL,0,__isfsFunctionCB,param);
}
s32 ISFS_SetAttr(const char *filepath,u32 ownerID,u16 groupID,u8 attributes,u8 ownerperm,u8 groupperm,u8 otherperm)
{
s32 ret, len;
struct isfs_cb *param;
if(_fs_fd<0 || filepath==NULL) return ISFS_EINVAL;
len = strnlen(filepath, ISFS_MAXPATH);
if(len>=ISFS_MAXPATH) return ISFS_EINVAL;
param = (struct isfs_cb*)iosAlloc(hId, ISFS_STRUCTSIZE);
if(param==NULL) return ISFS_ENOMEM;
memcpy(param->fsattr.filepath, filepath, (len+1));
param->fsattr.owner_id = ownerID;
param->fsattr.group_id = groupID;
param->fsattr.ownerperm = ownerperm;
param->fsattr.groupperm = groupperm;
param->fsattr.otherperm = otherperm;
param->fsattr.attributes = attributes;
ret = IOS_Ioctl(_fs_fd,ISFS_IOCTL_SETATTR,¶m->fsattr,sizeof(param->fsattr),NULL,0);
if(param!=NULL) iosFree(hId,param);
return ret;
}
s32 ISFS_SetAttrAsync(const char *filepath,u32 ownerID,u16 groupID,u8 attributes,u8 ownerperm,u8 groupperm,u8 otherperm,isfscallback cb,void *usrdata)
{
s32 len;
struct isfs_cb *param;
if(_fs_fd<0 || filepath==NULL) return ISFS_EINVAL;
len = strnlen(filepath, ISFS_MAXPATH);
if(len>=ISFS_MAXPATH) return ISFS_EINVAL;
param = (struct isfs_cb*)iosAlloc(hId, ISFS_STRUCTSIZE);
if(param==NULL) return ISFS_ENOMEM;
param->cb = cb;
param->usrdata = usrdata;
param->functype = ISFS_FUNCNULL;
memcpy(param->fsattr.filepath, filepath, (len+1));
param->fsattr.owner_id = ownerID;
param->fsattr.group_id = groupID;
param->fsattr.ownerperm = ownerperm;
param->fsattr.groupperm = groupperm;
param->fsattr.otherperm = otherperm;
param->fsattr.attributes = attributes;
return IOS_IoctlAsync(_fs_fd,ISFS_IOCTL_SETATTR,¶m->fsattr,sizeof(param->fsattr),NULL,0,__isfsFunctionCB,param);
}
s32 ISFS_GetUsage(const char* filepath, u32* usage1, u32* usage2)
{
s32 ret,len;
struct isfs_cb *param;
if(_fs_fd<0 || filepath==NULL || usage1==NULL || usage2 == NULL)
return ISFS_EINVAL;
len = strnlen(filepath, ISFS_MAXPATH);
if(len>=ISFS_MAXPATH) return ISFS_EINVAL;
param = (struct isfs_cb*)iosAlloc(hId, ISFS_STRUCTSIZE);
if(param==NULL) return ISFS_ENOMEM;
memcpy(param->filepath,filepath,(len+1));
param->fsusage.vector[0].data = param->filepath;
param->fsusage.vector[0].len = ISFS_MAXPATH;
param->fsusage.vector[1].data = ¶m->fsusage.usage1;
param->fsusage.vector[1].len = sizeof(u32);
param->fsusage.vector[2].data = ¶m->fsusage.usage2;
param->fsusage.vector[2].len = sizeof(u32);
ret = IOS_Ioctlv(_fs_fd,ISFS_IOCTL_GETUSAGE,1,2,param->fsusage.vector);
if(ret==IPC_OK) {
*usage1 = param->fsusage.usage1;
*usage2 = param->fsusage.usage2;
}
if(param!=NULL) iosFree(hId, param);
return ret;
}
s32 ISFS_GetUsageAsync(const char* filepath, u32* usage1, u32* usage2,isfscallback cb,void *usrdata)
{
s32 len;
struct isfs_cb *param;
if(_fs_fd<0 || filepath==NULL || usage1==NULL || usage2 == NULL)
return ISFS_EINVAL;
len = strnlen(filepath, ISFS_MAXPATH);
if(len>=ISFS_MAXPATH) return ISFS_EINVAL;
param = (struct isfs_cb*)iosAlloc(hId, ISFS_STRUCTSIZE);
if(param==NULL) return ISFS_ENOMEM;
param->cb = cb;
param->usrdata = usrdata;
param->functype = ISFS_FUNCGETUSAGE;
param->funcargv[0] = usage1;
param->funcargv[1] = usage2;
memcpy(param->filepath,filepath,(len+1));
param->fsusage.vector[0].data = param->filepath;
param->fsusage.vector[0].len = ISFS_MAXPATH;
param->fsusage.vector[1].data = ¶m->fsusage.usage1;
param->fsusage.vector[1].len = sizeof(u32);
param->fsusage.vector[2].data = ¶m->fsusage.usage2;
param->fsusage.vector[2].len = sizeof(u32);
return IOS_IoctlvAsync(_fs_fd,ISFS_IOCTL_GETUSAGE,1,2,param->fsusage.vector,__isfsFunctionCB,param);
}
#endif /* defined(HW_RVL) */
|
the_stack_data/9513734.c | #include<stdio.h>
#include<stdlib.h>
void ReadArray(int *a, int size);
void PrintArray(int *a, int size);
int* CreateArray( int size);
void FreeArray(int *a);
int main(void)
{
int *ptr=NULL;
int no;
printf("\n Enter No :: ");
scanf("%d", &no);
ptr= CreateArray(no);
if(ptr==NULL)
printf("\n unable to allocate memory");
else
{
printf("\n ptr=%u &ptr=%u", ptr, &ptr);
printf("\n Enter Elements of array :: ");
ReadArray(ptr, no);
printf("\n Elements of Array :: ");
PrintArray(ptr, no);
FreeArray(ptr);
}
return 0;
}
void ReadArray(int *a, int size)
{
int i;
for(i=0; i<size; i++)
{
printf("\n a[%d] :: ", i);
// scanf("%d",(a+i) );
// scanf("%d",(i+a) );
//scanf("%d",&a[i] );
scanf("%d",&i[a] );
}
return;
}
void PrintArray(int *a, int size)
{
int i;
for(i=0; i<size; i++)
{
//printf("\n %d [%u]", *(a+i), (a+i));
// printf("\n %d [%u]", *(i+a), (i+a));
//printf("\n %d [%u]", a[i], &a[i]);
printf("\n %5d [%u]", i[a], &i[a]);
}
return;
}
int* CreateArray(int size)
{
int *arr=NULL;
arr= (int*)malloc(sizeof(int)*size);
return arr;
}
void FreeArray(int *a)
{
free(a);
a=NULL; // ptr=0;
printf("\n memory is freed");
return ;
}
|
the_stack_data/380967.c | #include<stdio.h>
int main ()
{
int x,value,i;
scanf("%d",&x);
for (i = 0; i < x; i++)
{
scanf("%d",&value);
if (value==0)
{
printf("NULL\n");
}else if(value>0){
if (value%2==0){
printf("EVEN POSITIVE\n");
}else{
printf("ODD POSITIVE\n");
}
}else if (value<0){
if (value%2==0)
{
printf("EVEN NEGATIVE\n");
}else
{
printf("ODD NEGATIVE\n");
}
}
}
return 0;
} |
the_stack_data/86008.c | #include<stdio.h>
//Function to calculate the maximum sum of a sub-array of a given array
int maxSumarray(int a[], int size){
int i;
int max_sum_so_far=0;
int max_ending_here = 0;
for(i=0;i<size;i++){
max_ending_here = max_ending_here + a[i];
if(max_ending_here < 0){
max_ending_here =0;
}
if(max_sum_so_far < max_ending_here){
max_sum_so_far = max_ending_here;
}
}
return max_sum_so_far;
}
int main(){
int i,size;
printf("Enter the size of the array ");
scanf("%d",&size);
int a[size];
printf("\n Enter the elements of the array");
for(i=0; i<size; i++){
scanf("%d",&a[i]);
}
int max_sum = maxSumarray(a,size);
printf("\n The Maximum Sum of the Sub Array is : %d",max_sum);
return 0;
}
|
the_stack_data/148431.c | /* { dg-do compile } */
/* { dg-options "-O -fdump-tree-fre1" } */
typedef int v4si __attribute__ ((vector_size (16)));
int
main (int argc, char** argv)
{
int i = 2;
int j = ((v4si){0, 1, 2, 3})[i];
return ((v4si){1, 2, 42, 0})[j];
}
/* { dg-final { scan-tree-dump "return 42;" "fre1" } } */
|
the_stack_data/40180.c | #include <stdio.h>
int compareDate(int d1,int m1,int y1,int d2,int m2,int y2);
int isDateValid (int dd ,int mm, int yy);
int isLeapYear(int yy);
int daysInMonths(int mm, int yy);
int getWeekDayForDate(int d2,int m2,int y2);
int dayOfWeekByWeekDayNo(int n);
int dayOfWeek(int n);
int gapBetweenDates(int d1,int m1,int y1,int d2,int m2,int y2);
void dayDifferenceFromToday(int d,int m,int y);
int monthNames(int m);
int printingCalender(int month,int year);
int main()
{
int year = 2003;
for(int m=1;m<=12;m++)
{
printingCalender(m,year);
printf("\n\n");
}
}
int printingCalender(int month,int year)
{
int startday=getWeekDayForDate(1,month,year);
int x = daysInMonths( month, year);
//printf("\nSTartday=%d\n",startday);
//printf("Month starts on %d and month has %d days.\n",startday,x);
printf("%13s"," ");
monthNames(month);
printf(" - %d",year);
printf("\n");
for(int n=0;n<=6;n++)
{
dayOfWeek(n);
}
printf("\n");
for(int i =1 ; i<=startday;i++)
{
printf("%6s"," ");
}
//printf("%6s","1");
for(int i =1 ; i<=x;i++)
{
printf("%6d",i);
if((i + startday )%7==0)
printf("\n");
}
}
int isDateValid(int dd ,int mm, int yy) // function to check date is valid or not
{
if(yy<1) // if entered year is less than zero
return 0;
if(mm<1 || mm>12)
return 0;
if(dd<1)
return 0;
int ndays=daysInMonths(mm,yy);
if(dd>ndays)
return 0;
return 1;
}
//function to check leap year..
int isLeapYear(int yy)
{
if(yy % 400 == 0 || (yy % 4 == 0 && yy % 100 !=0) )
{
return 1;
}
else
return 0;
}
int daysInMonths(int mm, int yy) //function to check days in month..
{
if(mm==4 || mm==6 || mm==9 || mm==11)
return(30);
if(mm==2)
{
if(isLeapYear(yy)) // year will be passed to leap year function
return 29;
else
return 28;
}
return 31;
}
int gapBetweenDates(int d1,int m1,int y1,int d2,int m2,int y2)
{
//D2>D1 // if Day2>Day1 then only program will work correctly...
//d2-m2-y2 to d1-m1-y1
int cmp=compareDate(d1,m1,y1,d2,m2,y2);
if(cmp==0)
return 0;
if(cmp==-1)
{
int t=d1; // we will reverse the date here ....
d1=d2;
d2=t;
t=m1; // we will reverse the month here ....
m1=m2;
m2=t;
t=y1; // we are reversing year here ......
y1=y2;
y2=t;
}
int diff1 = d2-1;
int diff2=d1-1;
//1-m2-y2 to 1-m1-y1
int diff3=0;
for(int m=1;m<=m2-1;m++)
diff3=diff3+ daysInMonths(m,y2);
int diff4=0;
for(int m=1;m<=m1-1;m++)
diff4=diff4+ daysInMonths(m,y1);
//1-1-y2 to 1-1-y1
int diff5=0;
for(int y=y1;y<=y2-1;y++)
if(isLeapYear(y))
diff5=diff5+366;
else
diff5=diff5 + 365;
int gap=diff1 + diff3 + diff5 -diff4-diff2;
return cmp*gap;
}
// comparing which date is greater
int compareDate(int d1,int m1,int y1,int d2,int m2,int y2)
{
//Return 0 if equal, -1 if D1<D2, 1 if D2>D1
if(y2>y1)
return 1;
if(y2<y1)
return -1;
if(m2>m1)
return 1;
if(m2<m1)
return -1;
if(d2>d1)
return 1;
if(d2<d1)
return -1;
return 0;
}
int dayOfWeekByWeekDayNo(int n)
{
switch (n)
{
case 5:
printf("Friday ");
break;
case 6:
printf("Saturday ");
break;
case 0:
printf("Sunday ");
break;
case 1:
printf("Monday ");
break;
case 2:
printf("Tuesday ");
break;
case 3:
printf("Wednesday ");
break;
case 4:
printf("Thursday ");
break;
default:
{
printf("wrong day");
}
}
}
void dayDifferenceFromToday(int d2,int m2,int y2)
{
int d1=31,m1=10,y1=2021;
int ndays=gapBetweenDates(d1,m1,y1,d2,m2,y2);
ndays = ndays % 7;
ndays = ndays + 7;
ndays=ndays%7;
//ndays=(ndays + 2) %7;
dayOfWeekByWeekDayNo(ndays);
}
int getWeekDayForDate(int d2,int m2,int y2)
{
int d1=31,m1=10,y1=2021;
int ndays=gapBetweenDates(d1,m1,y1,d2,m2,y2);
ndays = ndays % 7;
ndays = ndays + 7;
ndays=ndays%7;
//ndays = (ndays + 2) %7;
return ndays;
}
//Function for Entering months name
int monthNames(int m)
{
switch (m)
{
case 1:
printf("January ");
break;
case 2:
printf("February ");
break;
case 3:
printf("March ");
break;
case 4:
printf("April ");
break;
case 5:
printf("May ");
break;
case 6:
printf("June ");
break;
case 7:
printf("July ");
break;
case 8:
printf("August ");
break;
case 9:
printf("September ");
break;
case 10:
printf("October ");
break;
case 11:
printf("November ");
break;
case 12:
printf("December ");
break;
default:
{
printf("wrong Month");
}
}
}
int dayOfWeek(int n)
{
switch (n)
{
case 0:
printf("%6s","Sun");
break;
case 1:
printf("%6s","Mon");
break;
case 2:
printf("%6s","Tue");
break;
case 3:
printf("%6s","Wed");
break;
case 4:
printf("%6s","Thu");
break;
case 5:
printf("%6s","Fri");
break;
case 6:
printf("%6s","Sat");
break;
default:
{
printf("wrong day");
}
}
}
|
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.