file
stringlengths
18
26
data
stringlengths
3
1.04M
the_stack_data/165767355.c
// RUN: %clang -emit-llvm -S -o - %s | FileCheck %s typedef float float4 __attribute__((ext_vector_type(4))); typedef unsigned int uint4 __attribute__((ext_vector_type(4))); // CHECK-LABEL: define void @clang_shufflevector_v_v( void clang_shufflevector_v_v( float4* A, float4 x, uint4 mask ) { // CHECK: [[MASK:%.*]] = and <4 x i32> {{%.*}}, <i32 3, i32 3, i32 3, i32 3> // CHECK: [[I:%.*]] = extractelement <4 x i32> [[MASK]], i{{[0-9]+}} 0 // CHECK: [[E:%.*]] = extractelement <4 x float> [[X:%.*]], i{{[0-9]+}} [[I]] // // Here is where ToT Clang code generation makes a mistake. // It uses [[I]] as the insertion index instead of 0. // Similarly on the remaining insertelement. // CHECK: [[V:%[a-zA-Z0-9._]+]] = insertelement <4 x float> undef, float [[E]], i{{[0-9]+}} 0 // CHECK: [[I:%.*]] = extractelement <4 x i32> [[MASK]], i{{[0-9]+}} 1 // CHECK: [[E:%.*]] = extractelement <4 x float> [[X]], i{{[0-9]+}} [[I]] // CHECK: [[V2:%.*]] = insertelement <4 x float> [[V]], float [[E]], i{{[0-9]+}} 1 // CHECK: [[I:%.*]] = extractelement <4 x i32> [[MASK]], i{{[0-9]+}} 2 // CHECK: [[E:%.*]] = extractelement <4 x float> [[X]], i{{[0-9]+}} [[I]] // CHECK: [[V3:%.*]] = insertelement <4 x float> [[V2]], float [[E]], i{{[0-9]+}} 2 // CHECK: [[I:%.*]] = extractelement <4 x i32> [[MASK]], i{{[0-9]+}} 3 // CHECK: [[E:%.*]] = extractelement <4 x float> [[X]], i{{[0-9]+}} [[I]] // CHECK: [[V4:%.*]] = insertelement <4 x float> [[V3]], float [[E]], i{{[0-9]+}} 3 // CHECK: store <4 x float> [[V4]], <4 x float>* {{%.*}}, *A = __builtin_shufflevector( x, mask ); } // CHECK-LABEL: define void @clang_shufflevector_v_v_c( void clang_shufflevector_v_v_c( float4* A, float4 x, float4 y) { // CHECK: [[V:%.*]] = shufflevector <4 x float> {{%.*}}, <4 x float> {{%.*}}, <4 x i32> <i32 0, i32 4, i32 1, i32 5> // CHECK: store <4 x float> [[V]], <4 x float>* {{%.*}} *A = __builtin_shufflevector( x, y, 0, 4, 1, 5 ); } // CHECK-LABEL: define void @clang_shufflevector_v_v_undef( void clang_shufflevector_v_v_undef( float4* A, float4 x, float4 y) { // CHECK: [[V:%.*]] = shufflevector <4 x float> {{%.*}}, <4 x float> {{%.*}}, <4 x i32> <i32 0, i32 4, i32 undef, i32 5> // CHECK: store <4 x float> [[V]], <4 x float>* {{%.*}} *A = __builtin_shufflevector( x, y, 0, 4, -1, 5 ); }
the_stack_data/117327662.c
/* * SDL_sound -- An abstract sound format decoding API. * Copyright (C) 2001 Ryan C. Gordon. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* * FLAC decoder for SDL_sound. * * This driver handles FLAC audio, that is to say the Free Lossless Audio * Codec. It depends on libFLAC for decoding, which can be grabbed from: * http://flac.sourceforge.net * * Please see the file COPYING in the source's root directory. * * This file written by Torbjörn Andersson. ([email protected]) */ #if HAVE_CONFIG_H # include <config.h> #endif #ifdef SOUND_SUPPORTS_FLAC #include <stdio.h> #include <stdlib.h> #include <string.h> #include "SDL_sound.h" #define __SDL_SOUND_INTERNAL__ #include "SDL_sound_internal.h" #include <FLAC/export.h> /* FLAC 1.1.3 has FLAC_API_VERSION_CURRENT == 8 */ #if !defined(FLAC_API_VERSION_CURRENT) || FLAC_API_VERSION_CURRENT < 8 #define LEGACY_FLAC #else #undef LEGACY_FLAC #endif #ifdef LEGACY_FLAC #include <FLAC/seekable_stream_decoder.h> #define D_END_OF_STREAM FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM #define d_new() FLAC__seekable_stream_decoder_new() #define d_init(x) FLAC__seekable_stream_decoder_init(x) #define d_process_metadata(x) FLAC__seekable_stream_decoder_process_until_end_of_metadata(x) #define d_process_one_frame(x) FLAC__seekable_stream_decoder_process_single(x) #define d_get_state(x) FLAC__seekable_stream_decoder_get_state(x) #define d_finish(x) FLAC__seekable_stream_decoder_finish(x) #define d_delete(x) FLAC__seekable_stream_decoder_delete(x) #define d_set_read_callback(x, y) FLAC__seekable_stream_decoder_set_read_callback(x, y) #define d_set_write_callback(x, y) FLAC__seekable_stream_decoder_set_write_callback(x, y) #define d_set_metadata_callback(x, y) FLAC__seekable_stream_decoder_set_metadata_callback(x, y) #define d_set_error_callback(x, y) FLAC__seekable_stream_decoder_set_error_callback(x, y) #define d_set_client_data(x, y) FLAC__seekable_stream_decoder_set_client_data(x, y) typedef FLAC__SeekableStreamDecoder decoder_t; typedef FLAC__SeekableStreamDecoderReadStatus d_read_status_t; #define D_SEEK_STATUS_OK FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_OK #define D_SEEK_STATUS_ERROR FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_ERROR #define D_TELL_STATUS_OK FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_OK #define D_TELL_STATUS_ERROR FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_ERROR #define D_LENGTH_STATUS_OK FLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_OK #define D_LENGTH_STATUS_ERROR FLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_ERROR #define d_set_seek_callback(x, y) FLAC__seekable_stream_decoder_set_seek_callback(x, y) #define d_set_tell_callback(x, y) FLAC__seekable_stream_decoder_set_tell_callback(x, y) #define d_set_length_callback(x, y) FLAC__seekable_stream_decoder_set_length_callback(x, y) #define d_set_eof_callback(x, y) FLAC__seekable_stream_decoder_set_eof_callback(x, y) #define d_seek_absolute(x, y) FLAC__seekable_stream_decoder_seek_absolute(x, y) typedef FLAC__SeekableStreamDecoderSeekStatus d_seek_status_t; typedef FLAC__SeekableStreamDecoderTellStatus d_tell_status_t; typedef FLAC__SeekableStreamDecoderLengthStatus d_length_status_t; #else #include <FLAC/stream_decoder.h> #define D_END_OF_STREAM FLAC__STREAM_DECODER_END_OF_STREAM #define d_new() FLAC__stream_decoder_new() #define d_process_metadata(x) FLAC__stream_decoder_process_until_end_of_metadata(x) #define d_process_one_frame(x) FLAC__stream_decoder_process_single(x) #define d_get_state(x) FLAC__stream_decoder_get_state(x) #define d_finish(x) FLAC__stream_decoder_finish(x) #define d_delete(x) FLAC__stream_decoder_delete(x) typedef FLAC__StreamDecoder decoder_t; typedef FLAC__StreamDecoderReadStatus d_read_status_t; #define D_SEEK_STATUS_OK FLAC__STREAM_DECODER_SEEK_STATUS_OK #define D_SEEK_STATUS_ERROR FLAC__STREAM_DECODER_SEEK_STATUS_ERROR #define D_TELL_STATUS_OK FLAC__STREAM_DECODER_TELL_STATUS_OK #define D_TELL_STATUS_ERROR FLAC__STREAM_DECODER_TELL_STATUS_ERROR #define D_LENGTH_STATUS_OK FLAC__STREAM_DECODER_LENGTH_STATUS_OK #define D_LENGTH_STATUS_ERROR FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR #define d_seek_absolute(x, y) FLAC__stream_decoder_seek_absolute(x, y) typedef FLAC__StreamDecoderSeekStatus d_seek_status_t; typedef FLAC__StreamDecoderTellStatus d_tell_status_t; typedef FLAC__StreamDecoderLengthStatus d_length_status_t; #endif #define D_WRITE_CONTINUE FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE #define D_READ_END_OF_STREAM FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM #define D_READ_ABORT FLAC__STREAM_DECODER_READ_STATUS_ABORT #define D_READ_CONTINUE FLAC__STREAM_DECODER_READ_STATUS_CONTINUE #define d_error_status_string FLAC__StreamDecoderErrorStatusString typedef FLAC__StreamDecoderErrorStatus d_error_status_t; typedef FLAC__StreamMetadata d_metadata_t; typedef FLAC__StreamDecoderWriteStatus d_write_status_t; static int FLAC_init(void); static void FLAC_quit(void); static int FLAC_open(Sound_Sample *sample, const char *ext); static void FLAC_close(Sound_Sample *sample); static Uint32 FLAC_read(Sound_Sample *sample); static int FLAC_rewind(Sound_Sample *sample); static int FLAC_seek(Sound_Sample *sample, Uint32 ms); static const char *extensions_flac[] = { "FLAC", "FLA", NULL }; const Sound_DecoderFunctions __Sound_DecoderFunctions_FLAC = { { extensions_flac, "Free Lossless Audio Codec", "Torbjörn Andersson <[email protected]>", "http://flac.sourceforge.net/" }, FLAC_init, /* init() method */ FLAC_quit, /* quit() method */ FLAC_open, /* open() method */ FLAC_close, /* close() method */ FLAC_read, /* read() method */ FLAC_rewind, /* rewind() method */ FLAC_seek /* seek() method */ }; /* This is what we store in our internal->decoder_private field. */ typedef struct { decoder_t *decoder; SDL_RWops *rw; Sound_Sample *sample; Uint32 frame_size; Uint8 is_flac; Uint32 stream_length; } flac_t; static void free_flac(flac_t *f) { d_finish(f->decoder); d_delete(f->decoder); free(f); } /* free_flac */ #ifdef LEGACY_FLAC static d_read_status_t read_callback( const decoder_t *decoder, FLAC__byte buffer[], unsigned int *bytes, void *client_data) #else static d_read_status_t read_callback( const decoder_t *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data) #endif { flac_t *f = (flac_t *) client_data; Uint32 retval; retval = SDL_RWread(f->rw, (Uint8 *) buffer, 1, *bytes); if (retval == 0) { *bytes = 0; f->sample->flags |= SOUND_SAMPLEFLAG_EOF; return(D_READ_END_OF_STREAM); } /* if */ if (retval == -1) { *bytes = 0; f->sample->flags |= SOUND_SAMPLEFLAG_ERROR; return(D_READ_ABORT); } /* if */ if (retval < *bytes) { *bytes = retval; f->sample->flags |= SOUND_SAMPLEFLAG_EAGAIN; } /* if */ return(D_READ_CONTINUE); } /* read_callback */ static d_write_status_t write_callback( const decoder_t *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data) { flac_t *f = (flac_t *) client_data; Uint32 i, j; Uint32 sample; Uint8 *dst; f->frame_size = frame->header.channels * frame->header.blocksize * frame->header.bits_per_sample / 8; if (f->frame_size > f->sample->buffer_size) Sound_SetBufferSize(f->sample, f->frame_size); dst = f->sample->buffer; /* If the sample is neither exactly 8-bit nor 16-bit, it will have to * be converted. Unfortunately the buffer is read-only, so we either * have to check for each sample, or make a copy of the buffer. I'm * not sure which way is best, so I've arbitrarily picked the former. */ if (f->sample->actual.format == AUDIO_S8) { for (i = 0; i < frame->header.blocksize; i++) for (j = 0; j < frame->header.channels; j++) { sample = buffer[j][i]; if (frame->header.bits_per_sample < 8) sample <<= (8 - frame->header.bits_per_sample); *dst++ = sample & 0x00ff; } /* for */ } /* if */ else { for (i = 0; i < frame->header.blocksize; i++) for (j = 0; j < frame->header.channels; j++) { sample = buffer[j][i]; if (frame->header.bits_per_sample < 16) sample <<= (16 - frame->header.bits_per_sample); else if (frame->header.bits_per_sample > 16) sample >>= (frame->header.bits_per_sample - 16); *dst++ = (sample & 0xff00) >> 8; *dst++ = sample & 0x00ff; } /* for */ } /* else */ return(D_WRITE_CONTINUE); } /* write_callback */ static void metadata_callback( const decoder_t *decoder, const d_metadata_t *metadata, void *client_data) { flac_t *f = (flac_t *) client_data; SNDDBG(("FLAC: Metadata callback.\n")); /* There are several kinds of metadata, but STREAMINFO is the only * one that always has to be there. */ if (metadata->type == FLAC__METADATA_TYPE_STREAMINFO) { SNDDBG(("FLAC: Metadata is streaminfo.\n")); f->is_flac = 1; f->sample->actual.channels = metadata->data.stream_info.channels; f->sample->actual.rate = metadata->data.stream_info.sample_rate; if (metadata->data.stream_info.bits_per_sample > 8) f->sample->actual.format = AUDIO_S16MSB; else f->sample->actual.format = AUDIO_S8; } /* if */ } /* metadata_callback */ static void error_callback( const decoder_t *decoder, d_error_status_t status, void *client_data) { flac_t *f = (flac_t *) client_data; __Sound_SetError(d_error_status_string[status]); f->sample->flags |= SOUND_SAMPLEFLAG_ERROR; } /* error_callback */ static d_seek_status_t seek_callback( const decoder_t *decoder, FLAC__uint64 absolute_byte_offset, void *client_data) { flac_t *f = (flac_t *) client_data; if (SDL_RWseek(f->rw, absolute_byte_offset, SEEK_SET) >= 0) { return(D_SEEK_STATUS_OK); } /* if */ return(D_SEEK_STATUS_ERROR); } /* seek_callback*/ static d_tell_status_t tell_callback( const decoder_t *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data) { flac_t *f = (flac_t *) client_data; int pos; pos = SDL_RWtell(f->rw); if (pos < 0) { return(D_TELL_STATUS_ERROR); } /* if */ *absolute_byte_offset = pos; return(D_TELL_STATUS_OK); } /* tell_callback */ static d_length_status_t length_callback( const decoder_t *decoder, FLAC__uint64 *stream_length, void *client_data) { flac_t *f = (flac_t *) client_data; if (f->sample->flags & SOUND_SAMPLEFLAG_CANSEEK) { *stream_length = f->stream_length; return(D_LENGTH_STATUS_OK); } /* if */ return(D_LENGTH_STATUS_ERROR); } /* length_callback */ static FLAC__bool eof_callback( const decoder_t *decoder, void *client_data) { flac_t *f = (flac_t *) client_data; int pos; /* Maybe we could check for SOUND_SAMPLEFLAG_EOF here instead? */ pos = SDL_RWtell(f->rw); if (pos >= 0 && pos >= f->stream_length) { return(true); } /* if */ return(false); } /* eof_callback */ static int FLAC_init(void) { return(1); /* always succeeds. */ } /* FLAC_init */ static void FLAC_quit(void) { /* it's a no-op. */ } /* FLAC_quit */ #define FLAC_MAGIC 0x43614C66 /* "fLaC" in ASCII. */ static int FLAC_open(Sound_Sample *sample, const char *ext) { Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque; SDL_RWops *rw = internal->rw; decoder_t *decoder; flac_t *f; int i; int has_extension = 0; Uint32 pos; /* * If the extension is "flac", we'll believe that this is really meant * to be a FLAC stream, and will try to grok it from existing metadata. * metadata searching can be a very expensive operation, however, so * unless the user swears that it is a FLAC stream through the extension, * we decide what to do based on the existance of a 32-bit magic number. */ for (i = 0; extensions_flac[i] != NULL; i++) { if (__Sound_strcasecmp(ext, extensions_flac[i]) == 0) { has_extension = 1; break; } /* if */ } /* for */ if (!has_extension) { int rc; Uint32 flac_magic = SDL_ReadLE32(rw); BAIL_IF_MACRO(flac_magic != FLAC_MAGIC, "FLAC: Not a FLAC stream.", 0); /* move back over magic number for metadata scan... */ rc = SDL_RWseek(internal->rw, -sizeof (flac_magic), SEEK_CUR); BAIL_IF_MACRO(rc < 0, ERR_IO_ERROR, 0); } /* if */ f = (flac_t *) malloc(sizeof (flac_t)); BAIL_IF_MACRO(f == NULL, ERR_OUT_OF_MEMORY, 0); decoder = d_new(); if (decoder == NULL) { free(f); BAIL_MACRO(ERR_OUT_OF_MEMORY, 0); } /* if */ #ifdef LEGACY_FLAC d_set_read_callback(decoder, read_callback); d_set_write_callback(decoder, write_callback); d_set_metadata_callback(decoder, metadata_callback); d_set_error_callback(decoder, error_callback); d_set_seek_callback(decoder, seek_callback); d_set_tell_callback(decoder, tell_callback); d_set_length_callback(decoder, length_callback); d_set_eof_callback(decoder, eof_callback); d_set_client_data(decoder, f); #endif f->rw = internal->rw; f->sample = sample; f->decoder = decoder; f->sample->actual.format = 0; f->is_flac = 0 /* !!! FIXME: should be "has_extension", not "0". */; internal->decoder_private = f; /* really should check the init return value here: */ #ifdef LEGACY_FLAC d_init(decoder); #else FLAC__stream_decoder_init_stream(decoder, read_callback, seek_callback, tell_callback, length_callback, eof_callback, write_callback, metadata_callback, error_callback, f); #endif sample->flags = SOUND_SAMPLEFLAG_NONE; pos = SDL_RWtell(f->rw); if (SDL_RWseek(f->rw, 0, SEEK_END) > 0) { f->stream_length = SDL_RWtell(f->rw); if (SDL_RWseek(f->rw, pos, SEEK_SET) == -1) { free_flac(f); BAIL_MACRO(ERR_IO_ERROR, 0); } /* if */ sample->flags = SOUND_SAMPLEFLAG_CANSEEK; } /* if */ /* * If we are not sure this is a FLAC stream, check for the STREAMINFO * metadata block. If not, we'd have to peek at the first audio frame * and get the sound format from there, but that is not yet * implemented. */ if (!f->is_flac) { d_process_metadata(decoder); /* Still not FLAC? Give up. */ if (!f->is_flac) { free_flac(f); BAIL_MACRO("FLAC: No metadata found. Not a FLAC stream?", 0); } /* if */ } /* if */ SNDDBG(("FLAC: Accepting data stream.\n")); return(1); } /* FLAC_open */ static void FLAC_close(Sound_Sample *sample) { Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque; flac_t *f = (flac_t *) internal->decoder_private; free_flac(f); } /* FLAC_close */ static Uint32 FLAC_read(Sound_Sample *sample) { Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque; flac_t *f = (flac_t *) internal->decoder_private; Uint32 len; if (!d_process_one_frame(f->decoder)) { sample->flags |= SOUND_SAMPLEFLAG_ERROR; BAIL_MACRO("FLAC: Couldn't decode frame.", 0); } /* if */ if (d_get_state(f->decoder) == D_END_OF_STREAM) { sample->flags |= SOUND_SAMPLEFLAG_EOF; return(0); } /* if */ /* An error may have been signalled through the error callback. */ if (sample->flags & SOUND_SAMPLEFLAG_ERROR) return(0); return(f->frame_size); } /* FLAC_read */ static int FLAC_rewind(Sound_Sample *sample) { return FLAC_seek(sample, 0); } /* FLAC_rewind */ static int FLAC_seek(Sound_Sample *sample, Uint32 ms) { Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque; flac_t *f = (flac_t *) internal->decoder_private; d_seek_absolute(f->decoder, (ms * sample->actual.rate) / 1000); return(1); } /* FLAC_seek */ #endif /* SOUND_SUPPORTS_FLAC */ /* end of flac.c ... */
the_stack_data/971760.c
/* Autogenerated: 'src/ExtractionOCaml/bedrock2_word_by_word_montgomery' --lang bedrock2 --static --no-wide-int --widen-carry --widen-bytes --split-multiret --no-select secp256k1 64 '2^256 - 2^32 - 977' mul square add sub opp from_montgomery to_montgomery nonzero selectznz to_bytes from_bytes one msat divstep divstep_precomp */ /* curve description: secp256k1 */ /* machine_wordsize = 64 (from "64") */ /* requested operations: mul, square, add, sub, opp, from_montgomery, to_montgomery, nonzero, selectznz, to_bytes, from_bytes, one, msat, divstep, divstep_precomp */ /* m = 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f (from "2^256 - 2^32 - 977") */ /* */ /* NOTE: In addition to the bounds specified above each function, all */ /* functions synthesized for this Montgomery arithmetic require the */ /* input to be strictly less than the prime modulus (m), and also */ /* require the input to be in the unique saturated representation. */ /* All functions also ensure that these two properties are true of */ /* return values. */ /* */ /* Computed values: */ /* eval z = z[0] + (z[1] << 64) + (z[2] << 128) + (z[3] << 192) */ /* bytes_eval z = z[0] + (z[1] << 8) + (z[2] << 16) + (z[3] << 24) + (z[4] << 32) + (z[5] << 40) + (z[6] << 48) + (z[7] << 56) + (z[8] << 64) + (z[9] << 72) + (z[10] << 80) + (z[11] << 88) + (z[12] << 96) + (z[13] << 104) + (z[14] << 112) + (z[15] << 120) + (z[16] << 128) + (z[17] << 136) + (z[18] << 144) + (z[19] << 152) + (z[20] << 160) + (z[21] << 168) + (z[22] << 176) + (z[23] << 184) + (z[24] << 192) + (z[25] << 200) + (z[26] << 208) + (z[27] << 216) + (z[28] << 224) + (z[29] << 232) + (z[30] << 240) + (z[31] << 248) */ /* twos_complement_eval z = let x1 := z[0] + (z[1] << 64) + (z[2] << 128) + (z[3] << 192) in */ /* if x1 & (2^256-1) < 2^255 then x1 & (2^256-1) else (x1 & (2^256-1)) - 2^256 */ #include <stdint.h> #include <memory.h> // LITTLE-ENDIAN memory access is REQUIRED // the following two functions are required to work around -fstrict-aliasing static inline uintptr_t _br2_load(uintptr_t a, size_t sz) { uintptr_t r = 0; memcpy(&r, (void*)a, sz); return r; } static inline void _br2_store(uintptr_t a, uintptr_t v, size_t sz) { memcpy((void*)a, &v, sz); } /* * Input Bounds: * in0: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] * in1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] * Output Bounds: * out0: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] */ static void internal_fiat_secp256k1_mul(uintptr_t out0, uintptr_t in0, uintptr_t in1) { uintptr_t x1, x2, x3, x0, x11, x16, x19, x21, x17, x22, x14, x23, x25, x26, x15, x27, x12, x28, x30, x31, x13, x33, x38, x41, x43, x39, x44, x36, x45, x47, x48, x37, x49, x34, x50, x52, x53, x35, x40, x55, x18, x56, x20, x57, x42, x58, x60, x61, x24, x62, x46, x63, x65, x66, x29, x67, x51, x68, x70, x71, x32, x72, x54, x73, x75, x8, x81, x84, x86, x82, x87, x79, x88, x90, x91, x80, x92, x77, x93, x95, x96, x78, x83, x59, x99, x64, x100, x85, x101, x103, x104, x69, x105, x89, x106, x108, x109, x74, x110, x94, x111, x113, x114, x76, x115, x97, x116, x118, x120, x125, x128, x130, x126, x131, x123, x132, x134, x135, x124, x136, x121, x137, x139, x140, x122, x127, x142, x98, x143, x102, x144, x129, x145, x147, x148, x107, x149, x133, x150, x152, x153, x112, x154, x138, x155, x157, x158, x117, x159, x141, x160, x162, x163, x119, x9, x169, x172, x174, x170, x175, x167, x176, x178, x179, x168, x180, x165, x181, x183, x184, x166, x171, x146, x187, x151, x188, x173, x189, x191, x192, x156, x193, x177, x194, x196, x197, x161, x198, x182, x199, x201, x202, x164, x203, x185, x204, x206, x208, x213, x216, x218, x214, x219, x211, x220, x222, x223, x212, x224, x209, x225, x227, x228, x210, x215, x230, x186, x231, x190, x232, x217, x233, x235, x236, x195, x237, x221, x238, x240, x241, x200, x242, x226, x243, x245, x246, x205, x247, x229, x248, x250, x251, x207, x7, x6, x5, x10, x4, x257, x260, x262, x258, x263, x255, x264, x266, x267, x256, x268, x253, x269, x271, x272, x254, x259, x234, x275, x239, x276, x261, x277, x279, x280, x244, x281, x265, x282, x284, x285, x249, x286, x270, x287, x289, x290, x252, x291, x273, x292, x294, x296, x301, x304, x306, x302, x307, x299, x308, x310, x311, x300, x312, x297, x313, x315, x316, x298, x303, x318, x274, x319, x278, x320, x305, x321, x323, x324, x283, x325, x309, x326, x328, x329, x288, x330, x314, x331, x333, x334, x293, x335, x317, x336, x338, x339, x295, x342, x343, x344, x346, x347, x348, x349, x351, x352, x353, x354, x356, x357, x340, x358, x322, x360, x341, x361, x327, x363, x345, x364, x332, x366, x350, x367, x359, x337, x369, x355, x370, x362, x365, x368, x371, x372, x373, x374, x375; x0 = _br2_load((in0)+((uintptr_t)0ULL), sizeof(uintptr_t)); x1 = _br2_load((in0)+((uintptr_t)8ULL), sizeof(uintptr_t)); x2 = _br2_load((in0)+((uintptr_t)16ULL), sizeof(uintptr_t)); x3 = _br2_load((in0)+((uintptr_t)24ULL), sizeof(uintptr_t)); /*skip*/ x4 = _br2_load((in1)+((uintptr_t)0ULL), sizeof(uintptr_t)); x5 = _br2_load((in1)+((uintptr_t)8ULL), sizeof(uintptr_t)); x6 = _br2_load((in1)+((uintptr_t)16ULL), sizeof(uintptr_t)); x7 = _br2_load((in1)+((uintptr_t)24ULL), sizeof(uintptr_t)); /*skip*/ /*skip*/ x8 = x1; x9 = x2; x10 = x3; x11 = x0; x12 = (x11)*(x7); x13 = sizeof(intptr_t) == 4 ? ((uint64_t)(x11)*(x7))>>32 : ((__uint128_t)(x11)*(x7))>>64; x14 = (x11)*(x6); x15 = sizeof(intptr_t) == 4 ? ((uint64_t)(x11)*(x6))>>32 : ((__uint128_t)(x11)*(x6))>>64; x16 = (x11)*(x5); x17 = sizeof(intptr_t) == 4 ? ((uint64_t)(x11)*(x5))>>32 : ((__uint128_t)(x11)*(x5))>>64; x18 = (x11)*(x4); x19 = sizeof(intptr_t) == 4 ? ((uint64_t)(x11)*(x4))>>32 : ((__uint128_t)(x11)*(x4))>>64; x20 = (x19)+(x16); x21 = (x20)<(x19); x22 = (x21)+(x17); x23 = (x22)<(x17); x24 = (x22)+(x14); x25 = (x24)<(x14); x26 = (x23)+(x25); x27 = (x26)+(x15); x28 = (x27)<(x15); x29 = (x27)+(x12); x30 = (x29)<(x12); x31 = (x28)+(x30); x32 = (x31)+(x13); x33 = (x18)*((uintptr_t)15580212934572586289ULL); x34 = (x33)*((uintptr_t)18446744073709551615ULL); x35 = sizeof(intptr_t) == 4 ? ((uint64_t)(x33)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x33)*((uintptr_t)18446744073709551615ULL))>>64; x36 = (x33)*((uintptr_t)18446744073709551615ULL); x37 = sizeof(intptr_t) == 4 ? ((uint64_t)(x33)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x33)*((uintptr_t)18446744073709551615ULL))>>64; x38 = (x33)*((uintptr_t)18446744073709551615ULL); x39 = sizeof(intptr_t) == 4 ? ((uint64_t)(x33)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x33)*((uintptr_t)18446744073709551615ULL))>>64; x40 = (x33)*((uintptr_t)18446744069414583343ULL); x41 = sizeof(intptr_t) == 4 ? ((uint64_t)(x33)*((uintptr_t)18446744069414583343ULL))>>32 : ((__uint128_t)(x33)*((uintptr_t)18446744069414583343ULL))>>64; x42 = (x41)+(x38); x43 = (x42)<(x41); x44 = (x43)+(x39); x45 = (x44)<(x39); x46 = (x44)+(x36); x47 = (x46)<(x36); x48 = (x45)+(x47); x49 = (x48)+(x37); x50 = (x49)<(x37); x51 = (x49)+(x34); x52 = (x51)<(x34); x53 = (x50)+(x52); x54 = (x53)+(x35); x55 = (x18)+(x40); x56 = (x55)<(x18); x57 = (x56)+(x20); x58 = (x57)<(x20); x59 = (x57)+(x42); x60 = (x59)<(x42); x61 = (x58)+(x60); x62 = (x61)+(x24); x63 = (x62)<(x24); x64 = (x62)+(x46); x65 = (x64)<(x46); x66 = (x63)+(x65); x67 = (x66)+(x29); x68 = (x67)<(x29); x69 = (x67)+(x51); x70 = (x69)<(x51); x71 = (x68)+(x70); x72 = (x71)+(x32); x73 = (x72)<(x32); x74 = (x72)+(x54); x75 = (x74)<(x54); x76 = (x73)+(x75); x77 = (x8)*(x7); x78 = sizeof(intptr_t) == 4 ? ((uint64_t)(x8)*(x7))>>32 : ((__uint128_t)(x8)*(x7))>>64; x79 = (x8)*(x6); x80 = sizeof(intptr_t) == 4 ? ((uint64_t)(x8)*(x6))>>32 : ((__uint128_t)(x8)*(x6))>>64; x81 = (x8)*(x5); x82 = sizeof(intptr_t) == 4 ? ((uint64_t)(x8)*(x5))>>32 : ((__uint128_t)(x8)*(x5))>>64; x83 = (x8)*(x4); x84 = sizeof(intptr_t) == 4 ? ((uint64_t)(x8)*(x4))>>32 : ((__uint128_t)(x8)*(x4))>>64; x85 = (x84)+(x81); x86 = (x85)<(x84); x87 = (x86)+(x82); x88 = (x87)<(x82); x89 = (x87)+(x79); x90 = (x89)<(x79); x91 = (x88)+(x90); x92 = (x91)+(x80); x93 = (x92)<(x80); x94 = (x92)+(x77); x95 = (x94)<(x77); x96 = (x93)+(x95); x97 = (x96)+(x78); x98 = (x59)+(x83); x99 = (x98)<(x59); x100 = (x99)+(x64); x101 = (x100)<(x64); x102 = (x100)+(x85); x103 = (x102)<(x85); x104 = (x101)+(x103); x105 = (x104)+(x69); x106 = (x105)<(x69); x107 = (x105)+(x89); x108 = (x107)<(x89); x109 = (x106)+(x108); x110 = (x109)+(x74); x111 = (x110)<(x74); x112 = (x110)+(x94); x113 = (x112)<(x94); x114 = (x111)+(x113); x115 = (x114)+(x76); x116 = (x115)<(x76); x117 = (x115)+(x97); x118 = (x117)<(x97); x119 = (x116)+(x118); x120 = (x98)*((uintptr_t)15580212934572586289ULL); x121 = (x120)*((uintptr_t)18446744073709551615ULL); x122 = sizeof(intptr_t) == 4 ? ((uint64_t)(x120)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x120)*((uintptr_t)18446744073709551615ULL))>>64; x123 = (x120)*((uintptr_t)18446744073709551615ULL); x124 = sizeof(intptr_t) == 4 ? ((uint64_t)(x120)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x120)*((uintptr_t)18446744073709551615ULL))>>64; x125 = (x120)*((uintptr_t)18446744073709551615ULL); x126 = sizeof(intptr_t) == 4 ? ((uint64_t)(x120)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x120)*((uintptr_t)18446744073709551615ULL))>>64; x127 = (x120)*((uintptr_t)18446744069414583343ULL); x128 = sizeof(intptr_t) == 4 ? ((uint64_t)(x120)*((uintptr_t)18446744069414583343ULL))>>32 : ((__uint128_t)(x120)*((uintptr_t)18446744069414583343ULL))>>64; x129 = (x128)+(x125); x130 = (x129)<(x128); x131 = (x130)+(x126); x132 = (x131)<(x126); x133 = (x131)+(x123); x134 = (x133)<(x123); x135 = (x132)+(x134); x136 = (x135)+(x124); x137 = (x136)<(x124); x138 = (x136)+(x121); x139 = (x138)<(x121); x140 = (x137)+(x139); x141 = (x140)+(x122); x142 = (x98)+(x127); x143 = (x142)<(x98); x144 = (x143)+(x102); x145 = (x144)<(x102); x146 = (x144)+(x129); x147 = (x146)<(x129); x148 = (x145)+(x147); x149 = (x148)+(x107); x150 = (x149)<(x107); x151 = (x149)+(x133); x152 = (x151)<(x133); x153 = (x150)+(x152); x154 = (x153)+(x112); x155 = (x154)<(x112); x156 = (x154)+(x138); x157 = (x156)<(x138); x158 = (x155)+(x157); x159 = (x158)+(x117); x160 = (x159)<(x117); x161 = (x159)+(x141); x162 = (x161)<(x141); x163 = (x160)+(x162); x164 = (x163)+(x119); x165 = (x9)*(x7); x166 = sizeof(intptr_t) == 4 ? ((uint64_t)(x9)*(x7))>>32 : ((__uint128_t)(x9)*(x7))>>64; x167 = (x9)*(x6); x168 = sizeof(intptr_t) == 4 ? ((uint64_t)(x9)*(x6))>>32 : ((__uint128_t)(x9)*(x6))>>64; x169 = (x9)*(x5); x170 = sizeof(intptr_t) == 4 ? ((uint64_t)(x9)*(x5))>>32 : ((__uint128_t)(x9)*(x5))>>64; x171 = (x9)*(x4); x172 = sizeof(intptr_t) == 4 ? ((uint64_t)(x9)*(x4))>>32 : ((__uint128_t)(x9)*(x4))>>64; x173 = (x172)+(x169); x174 = (x173)<(x172); x175 = (x174)+(x170); x176 = (x175)<(x170); x177 = (x175)+(x167); x178 = (x177)<(x167); x179 = (x176)+(x178); x180 = (x179)+(x168); x181 = (x180)<(x168); x182 = (x180)+(x165); x183 = (x182)<(x165); x184 = (x181)+(x183); x185 = (x184)+(x166); x186 = (x146)+(x171); x187 = (x186)<(x146); x188 = (x187)+(x151); x189 = (x188)<(x151); x190 = (x188)+(x173); x191 = (x190)<(x173); x192 = (x189)+(x191); x193 = (x192)+(x156); x194 = (x193)<(x156); x195 = (x193)+(x177); x196 = (x195)<(x177); x197 = (x194)+(x196); x198 = (x197)+(x161); x199 = (x198)<(x161); x200 = (x198)+(x182); x201 = (x200)<(x182); x202 = (x199)+(x201); x203 = (x202)+(x164); x204 = (x203)<(x164); x205 = (x203)+(x185); x206 = (x205)<(x185); x207 = (x204)+(x206); x208 = (x186)*((uintptr_t)15580212934572586289ULL); x209 = (x208)*((uintptr_t)18446744073709551615ULL); x210 = sizeof(intptr_t) == 4 ? ((uint64_t)(x208)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x208)*((uintptr_t)18446744073709551615ULL))>>64; x211 = (x208)*((uintptr_t)18446744073709551615ULL); x212 = sizeof(intptr_t) == 4 ? ((uint64_t)(x208)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x208)*((uintptr_t)18446744073709551615ULL))>>64; x213 = (x208)*((uintptr_t)18446744073709551615ULL); x214 = sizeof(intptr_t) == 4 ? ((uint64_t)(x208)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x208)*((uintptr_t)18446744073709551615ULL))>>64; x215 = (x208)*((uintptr_t)18446744069414583343ULL); x216 = sizeof(intptr_t) == 4 ? ((uint64_t)(x208)*((uintptr_t)18446744069414583343ULL))>>32 : ((__uint128_t)(x208)*((uintptr_t)18446744069414583343ULL))>>64; x217 = (x216)+(x213); x218 = (x217)<(x216); x219 = (x218)+(x214); x220 = (x219)<(x214); x221 = (x219)+(x211); x222 = (x221)<(x211); x223 = (x220)+(x222); x224 = (x223)+(x212); x225 = (x224)<(x212); x226 = (x224)+(x209); x227 = (x226)<(x209); x228 = (x225)+(x227); x229 = (x228)+(x210); x230 = (x186)+(x215); x231 = (x230)<(x186); x232 = (x231)+(x190); x233 = (x232)<(x190); x234 = (x232)+(x217); x235 = (x234)<(x217); x236 = (x233)+(x235); x237 = (x236)+(x195); x238 = (x237)<(x195); x239 = (x237)+(x221); x240 = (x239)<(x221); x241 = (x238)+(x240); x242 = (x241)+(x200); x243 = (x242)<(x200); x244 = (x242)+(x226); x245 = (x244)<(x226); x246 = (x243)+(x245); x247 = (x246)+(x205); x248 = (x247)<(x205); x249 = (x247)+(x229); x250 = (x249)<(x229); x251 = (x248)+(x250); x252 = (x251)+(x207); x253 = (x10)*(x7); x254 = sizeof(intptr_t) == 4 ? ((uint64_t)(x10)*(x7))>>32 : ((__uint128_t)(x10)*(x7))>>64; x255 = (x10)*(x6); x256 = sizeof(intptr_t) == 4 ? ((uint64_t)(x10)*(x6))>>32 : ((__uint128_t)(x10)*(x6))>>64; x257 = (x10)*(x5); x258 = sizeof(intptr_t) == 4 ? ((uint64_t)(x10)*(x5))>>32 : ((__uint128_t)(x10)*(x5))>>64; x259 = (x10)*(x4); x260 = sizeof(intptr_t) == 4 ? ((uint64_t)(x10)*(x4))>>32 : ((__uint128_t)(x10)*(x4))>>64; x261 = (x260)+(x257); x262 = (x261)<(x260); x263 = (x262)+(x258); x264 = (x263)<(x258); x265 = (x263)+(x255); x266 = (x265)<(x255); x267 = (x264)+(x266); x268 = (x267)+(x256); x269 = (x268)<(x256); x270 = (x268)+(x253); x271 = (x270)<(x253); x272 = (x269)+(x271); x273 = (x272)+(x254); x274 = (x234)+(x259); x275 = (x274)<(x234); x276 = (x275)+(x239); x277 = (x276)<(x239); x278 = (x276)+(x261); x279 = (x278)<(x261); x280 = (x277)+(x279); x281 = (x280)+(x244); x282 = (x281)<(x244); x283 = (x281)+(x265); x284 = (x283)<(x265); x285 = (x282)+(x284); x286 = (x285)+(x249); x287 = (x286)<(x249); x288 = (x286)+(x270); x289 = (x288)<(x270); x290 = (x287)+(x289); x291 = (x290)+(x252); x292 = (x291)<(x252); x293 = (x291)+(x273); x294 = (x293)<(x273); x295 = (x292)+(x294); x296 = (x274)*((uintptr_t)15580212934572586289ULL); x297 = (x296)*((uintptr_t)18446744073709551615ULL); x298 = sizeof(intptr_t) == 4 ? ((uint64_t)(x296)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x296)*((uintptr_t)18446744073709551615ULL))>>64; x299 = (x296)*((uintptr_t)18446744073709551615ULL); x300 = sizeof(intptr_t) == 4 ? ((uint64_t)(x296)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x296)*((uintptr_t)18446744073709551615ULL))>>64; x301 = (x296)*((uintptr_t)18446744073709551615ULL); x302 = sizeof(intptr_t) == 4 ? ((uint64_t)(x296)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x296)*((uintptr_t)18446744073709551615ULL))>>64; x303 = (x296)*((uintptr_t)18446744069414583343ULL); x304 = sizeof(intptr_t) == 4 ? ((uint64_t)(x296)*((uintptr_t)18446744069414583343ULL))>>32 : ((__uint128_t)(x296)*((uintptr_t)18446744069414583343ULL))>>64; x305 = (x304)+(x301); x306 = (x305)<(x304); x307 = (x306)+(x302); x308 = (x307)<(x302); x309 = (x307)+(x299); x310 = (x309)<(x299); x311 = (x308)+(x310); x312 = (x311)+(x300); x313 = (x312)<(x300); x314 = (x312)+(x297); x315 = (x314)<(x297); x316 = (x313)+(x315); x317 = (x316)+(x298); x318 = (x274)+(x303); x319 = (x318)<(x274); x320 = (x319)+(x278); x321 = (x320)<(x278); x322 = (x320)+(x305); x323 = (x322)<(x305); x324 = (x321)+(x323); x325 = (x324)+(x283); x326 = (x325)<(x283); x327 = (x325)+(x309); x328 = (x327)<(x309); x329 = (x326)+(x328); x330 = (x329)+(x288); x331 = (x330)<(x288); x332 = (x330)+(x314); x333 = (x332)<(x314); x334 = (x331)+(x333); x335 = (x334)+(x293); x336 = (x335)<(x293); x337 = (x335)+(x317); x338 = (x337)<(x317); x339 = (x336)+(x338); x340 = (x339)+(x295); x341 = (x322)-((uintptr_t)18446744069414583343ULL); x342 = (x322)<(x341); x343 = (x327)-((uintptr_t)18446744073709551615ULL); x344 = (x327)<(x343); x345 = (x343)-(x342); x346 = (x343)<(x345); x347 = (x344)+(x346); x348 = (x332)-((uintptr_t)18446744073709551615ULL); x349 = (x332)<(x348); x350 = (x348)-(x347); x351 = (x348)<(x350); x352 = (x349)+(x351); x353 = (x337)-((uintptr_t)18446744073709551615ULL); x354 = (x337)<(x353); x355 = (x353)-(x352); x356 = (x353)<(x355); x357 = (x354)+(x356); x358 = (x340)-(x357); x359 = (x340)<(x358); x360 = ((uintptr_t)-1ULL)+((x359)==((uintptr_t)0ULL)); x361 = (x360)^((uintptr_t)18446744073709551615ULL); x362 = ((x322)&(x360))|((x341)&(x361)); x363 = ((uintptr_t)-1ULL)+((x359)==((uintptr_t)0ULL)); x364 = (x363)^((uintptr_t)18446744073709551615ULL); x365 = ((x327)&(x363))|((x345)&(x364)); x366 = ((uintptr_t)-1ULL)+((x359)==((uintptr_t)0ULL)); x367 = (x366)^((uintptr_t)18446744073709551615ULL); x368 = ((x332)&(x366))|((x350)&(x367)); x369 = ((uintptr_t)-1ULL)+((x359)==((uintptr_t)0ULL)); x370 = (x369)^((uintptr_t)18446744073709551615ULL); x371 = ((x337)&(x369))|((x355)&(x370)); x372 = x362; x373 = x365; x374 = x368; x375 = x371; /*skip*/ _br2_store((out0)+((uintptr_t)0ULL), x372, sizeof(uintptr_t)); _br2_store((out0)+((uintptr_t)8ULL), x373, sizeof(uintptr_t)); _br2_store((out0)+((uintptr_t)16ULL), x374, sizeof(uintptr_t)); _br2_store((out0)+((uintptr_t)24ULL), x375, sizeof(uintptr_t)); /*skip*/ return; } /* NOTE: The following wrapper function is not covered by Coq proofs */ static void fiat_secp256k1_mul(uint64_t out1[4], const uint64_t arg1[4], const uint64_t arg2[4]) { internal_fiat_secp256k1_mul((uintptr_t)out1, (uintptr_t)arg1, (uintptr_t)arg2); } /* * Input Bounds: * in0: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] * Output Bounds: * out0: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] */ static void internal_fiat_secp256k1_square(uintptr_t out0, uintptr_t in0) { uintptr_t x7, x12, x15, x17, x13, x18, x10, x19, x21, x22, x11, x23, x8, x24, x26, x27, x9, x29, x34, x37, x39, x35, x40, x32, x41, x43, x44, x33, x45, x30, x46, x48, x49, x31, x36, x51, x14, x52, x16, x53, x38, x54, x56, x57, x20, x58, x42, x59, x61, x62, x25, x63, x47, x64, x66, x67, x28, x68, x50, x69, x71, x4, x77, x80, x82, x78, x83, x75, x84, x86, x87, x76, x88, x73, x89, x91, x92, x74, x79, x55, x95, x60, x96, x81, x97, x99, x100, x65, x101, x85, x102, x104, x105, x70, x106, x90, x107, x109, x110, x72, x111, x93, x112, x114, x116, x121, x124, x126, x122, x127, x119, x128, x130, x131, x120, x132, x117, x133, x135, x136, x118, x123, x138, x94, x139, x98, x140, x125, x141, x143, x144, x103, x145, x129, x146, x148, x149, x108, x150, x134, x151, x153, x154, x113, x155, x137, x156, x158, x159, x115, x5, x165, x168, x170, x166, x171, x163, x172, x174, x175, x164, x176, x161, x177, x179, x180, x162, x167, x142, x183, x147, x184, x169, x185, x187, x188, x152, x189, x173, x190, x192, x193, x157, x194, x178, x195, x197, x198, x160, x199, x181, x200, x202, x204, x209, x212, x214, x210, x215, x207, x216, x218, x219, x208, x220, x205, x221, x223, x224, x206, x211, x226, x182, x227, x186, x228, x213, x229, x231, x232, x191, x233, x217, x234, x236, x237, x196, x238, x222, x239, x241, x242, x201, x243, x225, x244, x246, x247, x203, x3, x2, x1, x6, x0, x253, x256, x258, x254, x259, x251, x260, x262, x263, x252, x264, x249, x265, x267, x268, x250, x255, x230, x271, x235, x272, x257, x273, x275, x276, x240, x277, x261, x278, x280, x281, x245, x282, x266, x283, x285, x286, x248, x287, x269, x288, x290, x292, x297, x300, x302, x298, x303, x295, x304, x306, x307, x296, x308, x293, x309, x311, x312, x294, x299, x314, x270, x315, x274, x316, x301, x317, x319, x320, x279, x321, x305, x322, x324, x325, x284, x326, x310, x327, x329, x330, x289, x331, x313, x332, x334, x335, x291, x338, x339, x340, x342, x343, x344, x345, x347, x348, x349, x350, x352, x353, x336, x354, x318, x356, x337, x357, x323, x359, x341, x360, x328, x362, x346, x363, x355, x333, x365, x351, x366, x358, x361, x364, x367, x368, x369, x370, x371; x0 = _br2_load((in0)+((uintptr_t)0ULL), sizeof(uintptr_t)); x1 = _br2_load((in0)+((uintptr_t)8ULL), sizeof(uintptr_t)); x2 = _br2_load((in0)+((uintptr_t)16ULL), sizeof(uintptr_t)); x3 = _br2_load((in0)+((uintptr_t)24ULL), sizeof(uintptr_t)); /*skip*/ /*skip*/ x4 = x1; x5 = x2; x6 = x3; x7 = x0; x8 = (x7)*(x3); x9 = sizeof(intptr_t) == 4 ? ((uint64_t)(x7)*(x3))>>32 : ((__uint128_t)(x7)*(x3))>>64; x10 = (x7)*(x2); x11 = sizeof(intptr_t) == 4 ? ((uint64_t)(x7)*(x2))>>32 : ((__uint128_t)(x7)*(x2))>>64; x12 = (x7)*(x1); x13 = sizeof(intptr_t) == 4 ? ((uint64_t)(x7)*(x1))>>32 : ((__uint128_t)(x7)*(x1))>>64; x14 = (x7)*(x0); x15 = sizeof(intptr_t) == 4 ? ((uint64_t)(x7)*(x0))>>32 : ((__uint128_t)(x7)*(x0))>>64; x16 = (x15)+(x12); x17 = (x16)<(x15); x18 = (x17)+(x13); x19 = (x18)<(x13); x20 = (x18)+(x10); x21 = (x20)<(x10); x22 = (x19)+(x21); x23 = (x22)+(x11); x24 = (x23)<(x11); x25 = (x23)+(x8); x26 = (x25)<(x8); x27 = (x24)+(x26); x28 = (x27)+(x9); x29 = (x14)*((uintptr_t)15580212934572586289ULL); x30 = (x29)*((uintptr_t)18446744073709551615ULL); x31 = sizeof(intptr_t) == 4 ? ((uint64_t)(x29)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x29)*((uintptr_t)18446744073709551615ULL))>>64; x32 = (x29)*((uintptr_t)18446744073709551615ULL); x33 = sizeof(intptr_t) == 4 ? ((uint64_t)(x29)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x29)*((uintptr_t)18446744073709551615ULL))>>64; x34 = (x29)*((uintptr_t)18446744073709551615ULL); x35 = sizeof(intptr_t) == 4 ? ((uint64_t)(x29)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x29)*((uintptr_t)18446744073709551615ULL))>>64; x36 = (x29)*((uintptr_t)18446744069414583343ULL); x37 = sizeof(intptr_t) == 4 ? ((uint64_t)(x29)*((uintptr_t)18446744069414583343ULL))>>32 : ((__uint128_t)(x29)*((uintptr_t)18446744069414583343ULL))>>64; x38 = (x37)+(x34); x39 = (x38)<(x37); x40 = (x39)+(x35); x41 = (x40)<(x35); x42 = (x40)+(x32); x43 = (x42)<(x32); x44 = (x41)+(x43); x45 = (x44)+(x33); x46 = (x45)<(x33); x47 = (x45)+(x30); x48 = (x47)<(x30); x49 = (x46)+(x48); x50 = (x49)+(x31); x51 = (x14)+(x36); x52 = (x51)<(x14); x53 = (x52)+(x16); x54 = (x53)<(x16); x55 = (x53)+(x38); x56 = (x55)<(x38); x57 = (x54)+(x56); x58 = (x57)+(x20); x59 = (x58)<(x20); x60 = (x58)+(x42); x61 = (x60)<(x42); x62 = (x59)+(x61); x63 = (x62)+(x25); x64 = (x63)<(x25); x65 = (x63)+(x47); x66 = (x65)<(x47); x67 = (x64)+(x66); x68 = (x67)+(x28); x69 = (x68)<(x28); x70 = (x68)+(x50); x71 = (x70)<(x50); x72 = (x69)+(x71); x73 = (x4)*(x3); x74 = sizeof(intptr_t) == 4 ? ((uint64_t)(x4)*(x3))>>32 : ((__uint128_t)(x4)*(x3))>>64; x75 = (x4)*(x2); x76 = sizeof(intptr_t) == 4 ? ((uint64_t)(x4)*(x2))>>32 : ((__uint128_t)(x4)*(x2))>>64; x77 = (x4)*(x1); x78 = sizeof(intptr_t) == 4 ? ((uint64_t)(x4)*(x1))>>32 : ((__uint128_t)(x4)*(x1))>>64; x79 = (x4)*(x0); x80 = sizeof(intptr_t) == 4 ? ((uint64_t)(x4)*(x0))>>32 : ((__uint128_t)(x4)*(x0))>>64; x81 = (x80)+(x77); x82 = (x81)<(x80); x83 = (x82)+(x78); x84 = (x83)<(x78); x85 = (x83)+(x75); x86 = (x85)<(x75); x87 = (x84)+(x86); x88 = (x87)+(x76); x89 = (x88)<(x76); x90 = (x88)+(x73); x91 = (x90)<(x73); x92 = (x89)+(x91); x93 = (x92)+(x74); x94 = (x55)+(x79); x95 = (x94)<(x55); x96 = (x95)+(x60); x97 = (x96)<(x60); x98 = (x96)+(x81); x99 = (x98)<(x81); x100 = (x97)+(x99); x101 = (x100)+(x65); x102 = (x101)<(x65); x103 = (x101)+(x85); x104 = (x103)<(x85); x105 = (x102)+(x104); x106 = (x105)+(x70); x107 = (x106)<(x70); x108 = (x106)+(x90); x109 = (x108)<(x90); x110 = (x107)+(x109); x111 = (x110)+(x72); x112 = (x111)<(x72); x113 = (x111)+(x93); x114 = (x113)<(x93); x115 = (x112)+(x114); x116 = (x94)*((uintptr_t)15580212934572586289ULL); x117 = (x116)*((uintptr_t)18446744073709551615ULL); x118 = sizeof(intptr_t) == 4 ? ((uint64_t)(x116)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x116)*((uintptr_t)18446744073709551615ULL))>>64; x119 = (x116)*((uintptr_t)18446744073709551615ULL); x120 = sizeof(intptr_t) == 4 ? ((uint64_t)(x116)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x116)*((uintptr_t)18446744073709551615ULL))>>64; x121 = (x116)*((uintptr_t)18446744073709551615ULL); x122 = sizeof(intptr_t) == 4 ? ((uint64_t)(x116)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x116)*((uintptr_t)18446744073709551615ULL))>>64; x123 = (x116)*((uintptr_t)18446744069414583343ULL); x124 = sizeof(intptr_t) == 4 ? ((uint64_t)(x116)*((uintptr_t)18446744069414583343ULL))>>32 : ((__uint128_t)(x116)*((uintptr_t)18446744069414583343ULL))>>64; x125 = (x124)+(x121); x126 = (x125)<(x124); x127 = (x126)+(x122); x128 = (x127)<(x122); x129 = (x127)+(x119); x130 = (x129)<(x119); x131 = (x128)+(x130); x132 = (x131)+(x120); x133 = (x132)<(x120); x134 = (x132)+(x117); x135 = (x134)<(x117); x136 = (x133)+(x135); x137 = (x136)+(x118); x138 = (x94)+(x123); x139 = (x138)<(x94); x140 = (x139)+(x98); x141 = (x140)<(x98); x142 = (x140)+(x125); x143 = (x142)<(x125); x144 = (x141)+(x143); x145 = (x144)+(x103); x146 = (x145)<(x103); x147 = (x145)+(x129); x148 = (x147)<(x129); x149 = (x146)+(x148); x150 = (x149)+(x108); x151 = (x150)<(x108); x152 = (x150)+(x134); x153 = (x152)<(x134); x154 = (x151)+(x153); x155 = (x154)+(x113); x156 = (x155)<(x113); x157 = (x155)+(x137); x158 = (x157)<(x137); x159 = (x156)+(x158); x160 = (x159)+(x115); x161 = (x5)*(x3); x162 = sizeof(intptr_t) == 4 ? ((uint64_t)(x5)*(x3))>>32 : ((__uint128_t)(x5)*(x3))>>64; x163 = (x5)*(x2); x164 = sizeof(intptr_t) == 4 ? ((uint64_t)(x5)*(x2))>>32 : ((__uint128_t)(x5)*(x2))>>64; x165 = (x5)*(x1); x166 = sizeof(intptr_t) == 4 ? ((uint64_t)(x5)*(x1))>>32 : ((__uint128_t)(x5)*(x1))>>64; x167 = (x5)*(x0); x168 = sizeof(intptr_t) == 4 ? ((uint64_t)(x5)*(x0))>>32 : ((__uint128_t)(x5)*(x0))>>64; x169 = (x168)+(x165); x170 = (x169)<(x168); x171 = (x170)+(x166); x172 = (x171)<(x166); x173 = (x171)+(x163); x174 = (x173)<(x163); x175 = (x172)+(x174); x176 = (x175)+(x164); x177 = (x176)<(x164); x178 = (x176)+(x161); x179 = (x178)<(x161); x180 = (x177)+(x179); x181 = (x180)+(x162); x182 = (x142)+(x167); x183 = (x182)<(x142); x184 = (x183)+(x147); x185 = (x184)<(x147); x186 = (x184)+(x169); x187 = (x186)<(x169); x188 = (x185)+(x187); x189 = (x188)+(x152); x190 = (x189)<(x152); x191 = (x189)+(x173); x192 = (x191)<(x173); x193 = (x190)+(x192); x194 = (x193)+(x157); x195 = (x194)<(x157); x196 = (x194)+(x178); x197 = (x196)<(x178); x198 = (x195)+(x197); x199 = (x198)+(x160); x200 = (x199)<(x160); x201 = (x199)+(x181); x202 = (x201)<(x181); x203 = (x200)+(x202); x204 = (x182)*((uintptr_t)15580212934572586289ULL); x205 = (x204)*((uintptr_t)18446744073709551615ULL); x206 = sizeof(intptr_t) == 4 ? ((uint64_t)(x204)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x204)*((uintptr_t)18446744073709551615ULL))>>64; x207 = (x204)*((uintptr_t)18446744073709551615ULL); x208 = sizeof(intptr_t) == 4 ? ((uint64_t)(x204)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x204)*((uintptr_t)18446744073709551615ULL))>>64; x209 = (x204)*((uintptr_t)18446744073709551615ULL); x210 = sizeof(intptr_t) == 4 ? ((uint64_t)(x204)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x204)*((uintptr_t)18446744073709551615ULL))>>64; x211 = (x204)*((uintptr_t)18446744069414583343ULL); x212 = sizeof(intptr_t) == 4 ? ((uint64_t)(x204)*((uintptr_t)18446744069414583343ULL))>>32 : ((__uint128_t)(x204)*((uintptr_t)18446744069414583343ULL))>>64; x213 = (x212)+(x209); x214 = (x213)<(x212); x215 = (x214)+(x210); x216 = (x215)<(x210); x217 = (x215)+(x207); x218 = (x217)<(x207); x219 = (x216)+(x218); x220 = (x219)+(x208); x221 = (x220)<(x208); x222 = (x220)+(x205); x223 = (x222)<(x205); x224 = (x221)+(x223); x225 = (x224)+(x206); x226 = (x182)+(x211); x227 = (x226)<(x182); x228 = (x227)+(x186); x229 = (x228)<(x186); x230 = (x228)+(x213); x231 = (x230)<(x213); x232 = (x229)+(x231); x233 = (x232)+(x191); x234 = (x233)<(x191); x235 = (x233)+(x217); x236 = (x235)<(x217); x237 = (x234)+(x236); x238 = (x237)+(x196); x239 = (x238)<(x196); x240 = (x238)+(x222); x241 = (x240)<(x222); x242 = (x239)+(x241); x243 = (x242)+(x201); x244 = (x243)<(x201); x245 = (x243)+(x225); x246 = (x245)<(x225); x247 = (x244)+(x246); x248 = (x247)+(x203); x249 = (x6)*(x3); x250 = sizeof(intptr_t) == 4 ? ((uint64_t)(x6)*(x3))>>32 : ((__uint128_t)(x6)*(x3))>>64; x251 = (x6)*(x2); x252 = sizeof(intptr_t) == 4 ? ((uint64_t)(x6)*(x2))>>32 : ((__uint128_t)(x6)*(x2))>>64; x253 = (x6)*(x1); x254 = sizeof(intptr_t) == 4 ? ((uint64_t)(x6)*(x1))>>32 : ((__uint128_t)(x6)*(x1))>>64; x255 = (x6)*(x0); x256 = sizeof(intptr_t) == 4 ? ((uint64_t)(x6)*(x0))>>32 : ((__uint128_t)(x6)*(x0))>>64; x257 = (x256)+(x253); x258 = (x257)<(x256); x259 = (x258)+(x254); x260 = (x259)<(x254); x261 = (x259)+(x251); x262 = (x261)<(x251); x263 = (x260)+(x262); x264 = (x263)+(x252); x265 = (x264)<(x252); x266 = (x264)+(x249); x267 = (x266)<(x249); x268 = (x265)+(x267); x269 = (x268)+(x250); x270 = (x230)+(x255); x271 = (x270)<(x230); x272 = (x271)+(x235); x273 = (x272)<(x235); x274 = (x272)+(x257); x275 = (x274)<(x257); x276 = (x273)+(x275); x277 = (x276)+(x240); x278 = (x277)<(x240); x279 = (x277)+(x261); x280 = (x279)<(x261); x281 = (x278)+(x280); x282 = (x281)+(x245); x283 = (x282)<(x245); x284 = (x282)+(x266); x285 = (x284)<(x266); x286 = (x283)+(x285); x287 = (x286)+(x248); x288 = (x287)<(x248); x289 = (x287)+(x269); x290 = (x289)<(x269); x291 = (x288)+(x290); x292 = (x270)*((uintptr_t)15580212934572586289ULL); x293 = (x292)*((uintptr_t)18446744073709551615ULL); x294 = sizeof(intptr_t) == 4 ? ((uint64_t)(x292)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x292)*((uintptr_t)18446744073709551615ULL))>>64; x295 = (x292)*((uintptr_t)18446744073709551615ULL); x296 = sizeof(intptr_t) == 4 ? ((uint64_t)(x292)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x292)*((uintptr_t)18446744073709551615ULL))>>64; x297 = (x292)*((uintptr_t)18446744073709551615ULL); x298 = sizeof(intptr_t) == 4 ? ((uint64_t)(x292)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x292)*((uintptr_t)18446744073709551615ULL))>>64; x299 = (x292)*((uintptr_t)18446744069414583343ULL); x300 = sizeof(intptr_t) == 4 ? ((uint64_t)(x292)*((uintptr_t)18446744069414583343ULL))>>32 : ((__uint128_t)(x292)*((uintptr_t)18446744069414583343ULL))>>64; x301 = (x300)+(x297); x302 = (x301)<(x300); x303 = (x302)+(x298); x304 = (x303)<(x298); x305 = (x303)+(x295); x306 = (x305)<(x295); x307 = (x304)+(x306); x308 = (x307)+(x296); x309 = (x308)<(x296); x310 = (x308)+(x293); x311 = (x310)<(x293); x312 = (x309)+(x311); x313 = (x312)+(x294); x314 = (x270)+(x299); x315 = (x314)<(x270); x316 = (x315)+(x274); x317 = (x316)<(x274); x318 = (x316)+(x301); x319 = (x318)<(x301); x320 = (x317)+(x319); x321 = (x320)+(x279); x322 = (x321)<(x279); x323 = (x321)+(x305); x324 = (x323)<(x305); x325 = (x322)+(x324); x326 = (x325)+(x284); x327 = (x326)<(x284); x328 = (x326)+(x310); x329 = (x328)<(x310); x330 = (x327)+(x329); x331 = (x330)+(x289); x332 = (x331)<(x289); x333 = (x331)+(x313); x334 = (x333)<(x313); x335 = (x332)+(x334); x336 = (x335)+(x291); x337 = (x318)-((uintptr_t)18446744069414583343ULL); x338 = (x318)<(x337); x339 = (x323)-((uintptr_t)18446744073709551615ULL); x340 = (x323)<(x339); x341 = (x339)-(x338); x342 = (x339)<(x341); x343 = (x340)+(x342); x344 = (x328)-((uintptr_t)18446744073709551615ULL); x345 = (x328)<(x344); x346 = (x344)-(x343); x347 = (x344)<(x346); x348 = (x345)+(x347); x349 = (x333)-((uintptr_t)18446744073709551615ULL); x350 = (x333)<(x349); x351 = (x349)-(x348); x352 = (x349)<(x351); x353 = (x350)+(x352); x354 = (x336)-(x353); x355 = (x336)<(x354); x356 = ((uintptr_t)-1ULL)+((x355)==((uintptr_t)0ULL)); x357 = (x356)^((uintptr_t)18446744073709551615ULL); x358 = ((x318)&(x356))|((x337)&(x357)); x359 = ((uintptr_t)-1ULL)+((x355)==((uintptr_t)0ULL)); x360 = (x359)^((uintptr_t)18446744073709551615ULL); x361 = ((x323)&(x359))|((x341)&(x360)); x362 = ((uintptr_t)-1ULL)+((x355)==((uintptr_t)0ULL)); x363 = (x362)^((uintptr_t)18446744073709551615ULL); x364 = ((x328)&(x362))|((x346)&(x363)); x365 = ((uintptr_t)-1ULL)+((x355)==((uintptr_t)0ULL)); x366 = (x365)^((uintptr_t)18446744073709551615ULL); x367 = ((x333)&(x365))|((x351)&(x366)); x368 = x358; x369 = x361; x370 = x364; x371 = x367; /*skip*/ _br2_store((out0)+((uintptr_t)0ULL), x368, sizeof(uintptr_t)); _br2_store((out0)+((uintptr_t)8ULL), x369, sizeof(uintptr_t)); _br2_store((out0)+((uintptr_t)16ULL), x370, sizeof(uintptr_t)); _br2_store((out0)+((uintptr_t)24ULL), x371, sizeof(uintptr_t)); /*skip*/ return; } /* NOTE: The following wrapper function is not covered by Coq proofs */ static void fiat_secp256k1_square(uint64_t out1[4], const uint64_t arg1[4]) { internal_fiat_secp256k1_square((uintptr_t)out1, (uintptr_t)arg1); } /* * Input Bounds: * in0: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] * in1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] * Output Bounds: * out0: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] */ static void internal_fiat_secp256k1_add(uintptr_t out0, uintptr_t in0, uintptr_t in1) { uintptr_t x4, x0, x9, x1, x5, x11, x2, x6, x13, x3, x7, x17, x19, x15, x21, x8, x24, x16, x25, x10, x27, x18, x28, x12, x30, x20, x31, x23, x14, x33, x22, x34, x26, x29, x32, x35, x36, x37, x38, x39; x0 = _br2_load((in0)+((uintptr_t)0ULL), sizeof(uintptr_t)); x1 = _br2_load((in0)+((uintptr_t)8ULL), sizeof(uintptr_t)); x2 = _br2_load((in0)+((uintptr_t)16ULL), sizeof(uintptr_t)); x3 = _br2_load((in0)+((uintptr_t)24ULL), sizeof(uintptr_t)); /*skip*/ x4 = _br2_load((in1)+((uintptr_t)0ULL), sizeof(uintptr_t)); x5 = _br2_load((in1)+((uintptr_t)8ULL), sizeof(uintptr_t)); x6 = _br2_load((in1)+((uintptr_t)16ULL), sizeof(uintptr_t)); x7 = _br2_load((in1)+((uintptr_t)24ULL), sizeof(uintptr_t)); /*skip*/ /*skip*/ x8 = (x0)+(x4); x9 = ((x8)<(x0))+(x1); x10 = (x9)+(x5); x11 = (((x9)<(x1))+((x10)<(x5)))+(x2); x12 = (x11)+(x6); x13 = (((x11)<(x2))+((x12)<(x6)))+(x3); x14 = (x13)+(x7); x15 = ((x13)<(x3))+((x14)<(x7)); x16 = (x8)-((uintptr_t)18446744069414583343ULL); x17 = (x10)-((uintptr_t)18446744073709551615ULL); x18 = (x17)-((x8)<(x16)); x19 = (x12)-((uintptr_t)18446744073709551615ULL); x20 = (x19)-(((x10)<(x17))+((x17)<(x18))); x21 = (x14)-((uintptr_t)18446744073709551615ULL); x22 = (x21)-(((x12)<(x19))+((x19)<(x20))); x23 = (x15)<((x15)-(((x14)<(x21))+((x21)<(x22)))); x24 = ((uintptr_t)-1ULL)+((x23)==((uintptr_t)0ULL)); x25 = (x24)^((uintptr_t)18446744073709551615ULL); x26 = ((x8)&(x24))|((x16)&(x25)); x27 = ((uintptr_t)-1ULL)+((x23)==((uintptr_t)0ULL)); x28 = (x27)^((uintptr_t)18446744073709551615ULL); x29 = ((x10)&(x27))|((x18)&(x28)); x30 = ((uintptr_t)-1ULL)+((x23)==((uintptr_t)0ULL)); x31 = (x30)^((uintptr_t)18446744073709551615ULL); x32 = ((x12)&(x30))|((x20)&(x31)); x33 = ((uintptr_t)-1ULL)+((x23)==((uintptr_t)0ULL)); x34 = (x33)^((uintptr_t)18446744073709551615ULL); x35 = ((x14)&(x33))|((x22)&(x34)); x36 = x26; x37 = x29; x38 = x32; x39 = x35; /*skip*/ _br2_store((out0)+((uintptr_t)0ULL), x36, sizeof(uintptr_t)); _br2_store((out0)+((uintptr_t)8ULL), x37, sizeof(uintptr_t)); _br2_store((out0)+((uintptr_t)16ULL), x38, sizeof(uintptr_t)); _br2_store((out0)+((uintptr_t)24ULL), x39, sizeof(uintptr_t)); /*skip*/ return; } /* NOTE: The following wrapper function is not covered by Coq proofs */ static void fiat_secp256k1_add(uint64_t out1[4], const uint64_t arg1[4], const uint64_t arg2[4]) { internal_fiat_secp256k1_add((uintptr_t)out1, (uintptr_t)arg1, (uintptr_t)arg2); } /* * Input Bounds: * in0: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] * in1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] * Output Bounds: * out0: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] */ static void internal_fiat_secp256k1_sub(uintptr_t out0, uintptr_t in0, uintptr_t in1) { uintptr_t x4, x5, x0, x6, x1, x9, x7, x2, x11, x3, x13, x8, x17, x10, x19, x12, x14, x15, x16, x18, x20, x21, x22, x23, x24, x25; x0 = _br2_load((in0)+((uintptr_t)0ULL), sizeof(uintptr_t)); x1 = _br2_load((in0)+((uintptr_t)8ULL), sizeof(uintptr_t)); x2 = _br2_load((in0)+((uintptr_t)16ULL), sizeof(uintptr_t)); x3 = _br2_load((in0)+((uintptr_t)24ULL), sizeof(uintptr_t)); /*skip*/ x4 = _br2_load((in1)+((uintptr_t)0ULL), sizeof(uintptr_t)); x5 = _br2_load((in1)+((uintptr_t)8ULL), sizeof(uintptr_t)); x6 = _br2_load((in1)+((uintptr_t)16ULL), sizeof(uintptr_t)); x7 = _br2_load((in1)+((uintptr_t)24ULL), sizeof(uintptr_t)); /*skip*/ /*skip*/ x8 = (x0)-(x4); x9 = (x1)-(x5); x10 = (x9)-((x0)<(x8)); x11 = (x2)-(x6); x12 = (x11)-(((x1)<(x9))+((x9)<(x10))); x13 = (x3)-(x7); x14 = (x13)-(((x2)<(x11))+((x11)<(x12))); x15 = ((uintptr_t)-1ULL)+((((x3)<(x13))+((x13)<(x14)))==((uintptr_t)0ULL)); x16 = (x8)+((x15)&((uintptr_t)18446744069414583343ULL)); x17 = ((x16)<(x8))+(x10); x18 = (x17)+(x15); x19 = (((x17)<(x10))+((x18)<(x15)))+(x12); x20 = (x19)+(x15); x21 = ((((x19)<(x12))+((x20)<(x15)))+(x14))+(x15); x22 = x16; x23 = x18; x24 = x20; x25 = x21; /*skip*/ _br2_store((out0)+((uintptr_t)0ULL), x22, sizeof(uintptr_t)); _br2_store((out0)+((uintptr_t)8ULL), x23, sizeof(uintptr_t)); _br2_store((out0)+((uintptr_t)16ULL), x24, sizeof(uintptr_t)); _br2_store((out0)+((uintptr_t)24ULL), x25, sizeof(uintptr_t)); /*skip*/ return; } /* NOTE: The following wrapper function is not covered by Coq proofs */ static void fiat_secp256k1_sub(uint64_t out1[4], const uint64_t arg1[4], const uint64_t arg2[4]) { internal_fiat_secp256k1_sub((uintptr_t)out1, (uintptr_t)arg1, (uintptr_t)arg2); } /* * Input Bounds: * in0: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] * Output Bounds: * out0: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] */ static void internal_fiat_secp256k1_opp(uintptr_t out0, uintptr_t in0) { uintptr_t x0, x1, x2, x5, x3, x7, x9, x4, x13, x6, x15, x8, x10, x11, x12, x14, x16, x17, x18, x19, x20, x21; x0 = _br2_load((in0)+((uintptr_t)0ULL), sizeof(uintptr_t)); x1 = _br2_load((in0)+((uintptr_t)8ULL), sizeof(uintptr_t)); x2 = _br2_load((in0)+((uintptr_t)16ULL), sizeof(uintptr_t)); x3 = _br2_load((in0)+((uintptr_t)24ULL), sizeof(uintptr_t)); /*skip*/ /*skip*/ x4 = ((uintptr_t)0ULL)-(x0); x5 = ((uintptr_t)0ULL)-(x1); x6 = (x5)-(((uintptr_t)0ULL)<(x4)); x7 = ((uintptr_t)0ULL)-(x2); x8 = (x7)-((((uintptr_t)0ULL)<(x5))+((x5)<(x6))); x9 = ((uintptr_t)0ULL)-(x3); x10 = (x9)-((((uintptr_t)0ULL)<(x7))+((x7)<(x8))); x11 = ((uintptr_t)-1ULL)+(((((uintptr_t)0ULL)<(x9))+((x9)<(x10)))==((uintptr_t)0ULL)); x12 = (x4)+((x11)&((uintptr_t)18446744069414583343ULL)); x13 = ((x12)<(x4))+(x6); x14 = (x13)+(x11); x15 = (((x13)<(x6))+((x14)<(x11)))+(x8); x16 = (x15)+(x11); x17 = ((((x15)<(x8))+((x16)<(x11)))+(x10))+(x11); x18 = x12; x19 = x14; x20 = x16; x21 = x17; /*skip*/ _br2_store((out0)+((uintptr_t)0ULL), x18, sizeof(uintptr_t)); _br2_store((out0)+((uintptr_t)8ULL), x19, sizeof(uintptr_t)); _br2_store((out0)+((uintptr_t)16ULL), x20, sizeof(uintptr_t)); _br2_store((out0)+((uintptr_t)24ULL), x21, sizeof(uintptr_t)); /*skip*/ return; } /* NOTE: The following wrapper function is not covered by Coq proofs */ static void fiat_secp256k1_opp(uint64_t out1[4], const uint64_t arg1[4]) { internal_fiat_secp256k1_opp((uintptr_t)out1, (uintptr_t)arg1); } /* * Input Bounds: * in0: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] * Output Bounds: * out0: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] */ static void internal_fiat_secp256k1_from_montgomery(uintptr_t out0, uintptr_t in0) { uintptr_t x0, x11, x13, x10, x8, x15, x9, x6, x5, x4, x12, x14, x16, x17, x7, x1, x18, x19, x20, x21, x34, x36, x33, x31, x38, x32, x29, x28, x23, x41, x24, x35, x43, x25, x37, x45, x26, x39, x47, x27, x22, x40, x30, x2, x42, x44, x46, x48, x61, x63, x60, x58, x65, x59, x56, x55, x50, x68, x51, x62, x70, x52, x64, x72, x53, x66, x74, x54, x49, x67, x57, x3, x69, x71, x73, x75, x88, x90, x87, x85, x92, x86, x83, x82, x77, x95, x78, x89, x97, x79, x91, x99, x80, x93, x101, x81, x76, x94, x84, x105, x107, x103, x109, x96, x112, x104, x113, x98, x115, x106, x116, x100, x118, x108, x119, x111, x102, x121, x110, x122, x114, x117, x120, x123, x124, x125, x126, x127; x0 = _br2_load((in0)+((uintptr_t)0ULL), sizeof(uintptr_t)); x1 = _br2_load((in0)+((uintptr_t)8ULL), sizeof(uintptr_t)); x2 = _br2_load((in0)+((uintptr_t)16ULL), sizeof(uintptr_t)); x3 = _br2_load((in0)+((uintptr_t)24ULL), sizeof(uintptr_t)); /*skip*/ /*skip*/ x4 = x0; x5 = (x4)*((uintptr_t)15580212934572586289ULL); x6 = (x5)*((uintptr_t)18446744073709551615ULL); x7 = sizeof(intptr_t) == 4 ? ((uint64_t)(x5)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x5)*((uintptr_t)18446744073709551615ULL))>>64; x8 = (x5)*((uintptr_t)18446744073709551615ULL); x9 = sizeof(intptr_t) == 4 ? ((uint64_t)(x5)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x5)*((uintptr_t)18446744073709551615ULL))>>64; x10 = sizeof(intptr_t) == 4 ? ((uint64_t)(x5)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x5)*((uintptr_t)18446744073709551615ULL))>>64; x11 = sizeof(intptr_t) == 4 ? ((uint64_t)(x5)*((uintptr_t)18446744069414583343ULL))>>32 : ((__uint128_t)(x5)*((uintptr_t)18446744069414583343ULL))>>64; x12 = (x11)+((x5)*((uintptr_t)18446744073709551615ULL)); x13 = ((x12)<(x11))+(x10); x14 = (x13)+(x8); x15 = (((x13)<(x10))+((x14)<(x8)))+(x9); x16 = (x15)+(x6); x17 = ((x15)<(x9))+((x16)<(x6)); x18 = (((x4)+((x5)*((uintptr_t)18446744069414583343ULL)))<(x4))+(x12); x19 = ((x18)<(x12))+(x14); x20 = ((x19)<(x14))+(x16); x21 = ((x20)<(x16))+((x17)+(x7)); x22 = (x21)<((x17)+(x7)); x23 = (x18)+(x1); x24 = ((x23)<(x18))+(x19); x25 = ((x24)<(x19))+(x20); x26 = ((x25)<(x20))+(x21); x27 = (x26)<(x21); x28 = (x23)*((uintptr_t)15580212934572586289ULL); x29 = (x28)*((uintptr_t)18446744073709551615ULL); x30 = sizeof(intptr_t) == 4 ? ((uint64_t)(x28)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x28)*((uintptr_t)18446744073709551615ULL))>>64; x31 = (x28)*((uintptr_t)18446744073709551615ULL); x32 = sizeof(intptr_t) == 4 ? ((uint64_t)(x28)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x28)*((uintptr_t)18446744073709551615ULL))>>64; x33 = sizeof(intptr_t) == 4 ? ((uint64_t)(x28)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x28)*((uintptr_t)18446744073709551615ULL))>>64; x34 = sizeof(intptr_t) == 4 ? ((uint64_t)(x28)*((uintptr_t)18446744069414583343ULL))>>32 : ((__uint128_t)(x28)*((uintptr_t)18446744069414583343ULL))>>64; x35 = (x34)+((x28)*((uintptr_t)18446744073709551615ULL)); x36 = ((x35)<(x34))+(x33); x37 = (x36)+(x31); x38 = (((x36)<(x33))+((x37)<(x31)))+(x32); x39 = (x38)+(x29); x40 = ((x38)<(x32))+((x39)<(x29)); x41 = (((x23)+((x28)*((uintptr_t)18446744069414583343ULL)))<(x23))+(x24); x42 = (x41)+(x35); x43 = (((x41)<(x24))+((x42)<(x35)))+(x25); x44 = (x43)+(x37); x45 = (((x43)<(x25))+((x44)<(x37)))+(x26); x46 = (x45)+(x39); x47 = (((x45)<(x26))+((x46)<(x39)))+((x27)+(x22)); x48 = (x47)+((x40)+(x30)); x49 = ((x47)<((x27)+(x22)))+((x48)<((x40)+(x30))); x50 = (x42)+(x2); x51 = ((x50)<(x42))+(x44); x52 = ((x51)<(x44))+(x46); x53 = ((x52)<(x46))+(x48); x54 = (x53)<(x48); x55 = (x50)*((uintptr_t)15580212934572586289ULL); x56 = (x55)*((uintptr_t)18446744073709551615ULL); x57 = sizeof(intptr_t) == 4 ? ((uint64_t)(x55)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x55)*((uintptr_t)18446744073709551615ULL))>>64; x58 = (x55)*((uintptr_t)18446744073709551615ULL); x59 = sizeof(intptr_t) == 4 ? ((uint64_t)(x55)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x55)*((uintptr_t)18446744073709551615ULL))>>64; x60 = sizeof(intptr_t) == 4 ? ((uint64_t)(x55)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x55)*((uintptr_t)18446744073709551615ULL))>>64; x61 = sizeof(intptr_t) == 4 ? ((uint64_t)(x55)*((uintptr_t)18446744069414583343ULL))>>32 : ((__uint128_t)(x55)*((uintptr_t)18446744069414583343ULL))>>64; x62 = (x61)+((x55)*((uintptr_t)18446744073709551615ULL)); x63 = ((x62)<(x61))+(x60); x64 = (x63)+(x58); x65 = (((x63)<(x60))+((x64)<(x58)))+(x59); x66 = (x65)+(x56); x67 = ((x65)<(x59))+((x66)<(x56)); x68 = (((x50)+((x55)*((uintptr_t)18446744069414583343ULL)))<(x50))+(x51); x69 = (x68)+(x62); x70 = (((x68)<(x51))+((x69)<(x62)))+(x52); x71 = (x70)+(x64); x72 = (((x70)<(x52))+((x71)<(x64)))+(x53); x73 = (x72)+(x66); x74 = (((x72)<(x53))+((x73)<(x66)))+((x54)+(x49)); x75 = (x74)+((x67)+(x57)); x76 = ((x74)<((x54)+(x49)))+((x75)<((x67)+(x57))); x77 = (x69)+(x3); x78 = ((x77)<(x69))+(x71); x79 = ((x78)<(x71))+(x73); x80 = ((x79)<(x73))+(x75); x81 = (x80)<(x75); x82 = (x77)*((uintptr_t)15580212934572586289ULL); x83 = (x82)*((uintptr_t)18446744073709551615ULL); x84 = sizeof(intptr_t) == 4 ? ((uint64_t)(x82)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x82)*((uintptr_t)18446744073709551615ULL))>>64; x85 = (x82)*((uintptr_t)18446744073709551615ULL); x86 = sizeof(intptr_t) == 4 ? ((uint64_t)(x82)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x82)*((uintptr_t)18446744073709551615ULL))>>64; x87 = sizeof(intptr_t) == 4 ? ((uint64_t)(x82)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x82)*((uintptr_t)18446744073709551615ULL))>>64; x88 = sizeof(intptr_t) == 4 ? ((uint64_t)(x82)*((uintptr_t)18446744069414583343ULL))>>32 : ((__uint128_t)(x82)*((uintptr_t)18446744069414583343ULL))>>64; x89 = (x88)+((x82)*((uintptr_t)18446744073709551615ULL)); x90 = ((x89)<(x88))+(x87); x91 = (x90)+(x85); x92 = (((x90)<(x87))+((x91)<(x85)))+(x86); x93 = (x92)+(x83); x94 = ((x92)<(x86))+((x93)<(x83)); x95 = (((x77)+((x82)*((uintptr_t)18446744069414583343ULL)))<(x77))+(x78); x96 = (x95)+(x89); x97 = (((x95)<(x78))+((x96)<(x89)))+(x79); x98 = (x97)+(x91); x99 = (((x97)<(x79))+((x98)<(x91)))+(x80); x100 = (x99)+(x93); x101 = (((x99)<(x80))+((x100)<(x93)))+((x81)+(x76)); x102 = (x101)+((x94)+(x84)); x103 = ((x101)<((x81)+(x76)))+((x102)<((x94)+(x84))); x104 = (x96)-((uintptr_t)18446744069414583343ULL); x105 = (x98)-((uintptr_t)18446744073709551615ULL); x106 = (x105)-((x96)<(x104)); x107 = (x100)-((uintptr_t)18446744073709551615ULL); x108 = (x107)-(((x98)<(x105))+((x105)<(x106))); x109 = (x102)-((uintptr_t)18446744073709551615ULL); x110 = (x109)-(((x100)<(x107))+((x107)<(x108))); x111 = (x103)<((x103)-(((x102)<(x109))+((x109)<(x110)))); x112 = ((uintptr_t)-1ULL)+((x111)==((uintptr_t)0ULL)); x113 = (x112)^((uintptr_t)18446744073709551615ULL); x114 = ((x96)&(x112))|((x104)&(x113)); x115 = ((uintptr_t)-1ULL)+((x111)==((uintptr_t)0ULL)); x116 = (x115)^((uintptr_t)18446744073709551615ULL); x117 = ((x98)&(x115))|((x106)&(x116)); x118 = ((uintptr_t)-1ULL)+((x111)==((uintptr_t)0ULL)); x119 = (x118)^((uintptr_t)18446744073709551615ULL); x120 = ((x100)&(x118))|((x108)&(x119)); x121 = ((uintptr_t)-1ULL)+((x111)==((uintptr_t)0ULL)); x122 = (x121)^((uintptr_t)18446744073709551615ULL); x123 = ((x102)&(x121))|((x110)&(x122)); x124 = x114; x125 = x117; x126 = x120; x127 = x123; /*skip*/ _br2_store((out0)+((uintptr_t)0ULL), x124, sizeof(uintptr_t)); _br2_store((out0)+((uintptr_t)8ULL), x125, sizeof(uintptr_t)); _br2_store((out0)+((uintptr_t)16ULL), x126, sizeof(uintptr_t)); _br2_store((out0)+((uintptr_t)24ULL), x127, sizeof(uintptr_t)); /*skip*/ return; } /* NOTE: The following wrapper function is not covered by Coq proofs */ static void fiat_secp256k1_from_montgomery(uint64_t out1[4], const uint64_t arg1[4]) { internal_fiat_secp256k1_from_montgomery((uintptr_t)out1, (uintptr_t)arg1); } /* * Input Bounds: * in0: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] * Output Bounds: * out0: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] */ static void internal_fiat_secp256k1_to_montgomery(uintptr_t out0, uintptr_t in0) { uintptr_t x1, x2, x3, x0, x7, x9, x18, x20, x17, x15, x22, x16, x13, x12, x8, x25, x10, x19, x27, x11, x21, x23, x24, x14, x32, x4, x26, x36, x28, x33, x38, x29, x34, x30, x48, x50, x47, x45, x52, x46, x43, x42, x35, x55, x37, x49, x57, x39, x51, x59, x40, x53, x61, x41, x31, x54, x44, x64, x5, x56, x68, x58, x65, x70, x60, x66, x62, x80, x82, x79, x77, x84, x78, x75, x74, x67, x87, x69, x81, x89, x71, x83, x91, x72, x85, x93, x73, x63, x86, x76, x96, x6, x88, x100, x90, x97, x102, x92, x98, x94, x112, x114, x111, x109, x116, x110, x107, x106, x99, x119, x101, x113, x121, x103, x115, x123, x104, x117, x125, x105, x95, x118, x108, x129, x131, x127, x133, x120, x136, x128, x137, x122, x139, x130, x140, x124, x142, x132, x143, x135, x126, x145, x134, x146, x138, x141, x144, x147, x148, x149, x150, x151; x0 = _br2_load((in0)+((uintptr_t)0ULL), sizeof(uintptr_t)); x1 = _br2_load((in0)+((uintptr_t)8ULL), sizeof(uintptr_t)); x2 = _br2_load((in0)+((uintptr_t)16ULL), sizeof(uintptr_t)); x3 = _br2_load((in0)+((uintptr_t)24ULL), sizeof(uintptr_t)); /*skip*/ /*skip*/ x4 = x1; x5 = x2; x6 = x3; x7 = x0; x8 = (x7)*((uintptr_t)8392367050913ULL); x9 = sizeof(intptr_t) == 4 ? ((uint64_t)(x7)*((uintptr_t)8392367050913ULL))>>32 : ((__uint128_t)(x7)*((uintptr_t)8392367050913ULL))>>64; x10 = (x9)+(x7); x11 = (x10)<(x9); x12 = (x8)*((uintptr_t)15580212934572586289ULL); x13 = (x12)*((uintptr_t)18446744073709551615ULL); x14 = sizeof(intptr_t) == 4 ? ((uint64_t)(x12)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x12)*((uintptr_t)18446744073709551615ULL))>>64; x15 = (x12)*((uintptr_t)18446744073709551615ULL); x16 = sizeof(intptr_t) == 4 ? ((uint64_t)(x12)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x12)*((uintptr_t)18446744073709551615ULL))>>64; x17 = sizeof(intptr_t) == 4 ? ((uint64_t)(x12)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x12)*((uintptr_t)18446744073709551615ULL))>>64; x18 = sizeof(intptr_t) == 4 ? ((uint64_t)(x12)*((uintptr_t)18446744069414583343ULL))>>32 : ((__uint128_t)(x12)*((uintptr_t)18446744069414583343ULL))>>64; x19 = (x18)+((x12)*((uintptr_t)18446744073709551615ULL)); x20 = ((x19)<(x18))+(x17); x21 = (x20)+(x15); x22 = (((x20)<(x17))+((x21)<(x15)))+(x16); x23 = (x22)+(x13); x24 = ((x22)<(x16))+((x23)<(x13)); x25 = (((x8)+((x12)*((uintptr_t)18446744069414583343ULL)))<(x8))+(x10); x26 = (x25)+(x19); x27 = (((x25)<(x10))+((x26)<(x19)))+(x11); x28 = (x27)+(x21); x29 = (((x27)<(x11))+((x28)<(x21)))+(x23); x30 = ((x29)<(x23))+((x24)+(x14)); x31 = (x30)<((x24)+(x14)); x32 = sizeof(intptr_t) == 4 ? ((uint64_t)(x4)*((uintptr_t)8392367050913ULL))>>32 : ((__uint128_t)(x4)*((uintptr_t)8392367050913ULL))>>64; x33 = (x32)+(x4); x34 = (x33)<(x32); x35 = (x26)+((x4)*((uintptr_t)8392367050913ULL)); x36 = ((x35)<(x26))+(x28); x37 = (x36)+(x33); x38 = (((x36)<(x28))+((x37)<(x33)))+(x29); x39 = (x38)+(x34); x40 = (((x38)<(x29))+((x39)<(x34)))+(x30); x41 = (x40)<(x30); x42 = (x35)*((uintptr_t)15580212934572586289ULL); x43 = (x42)*((uintptr_t)18446744073709551615ULL); x44 = sizeof(intptr_t) == 4 ? ((uint64_t)(x42)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x42)*((uintptr_t)18446744073709551615ULL))>>64; x45 = (x42)*((uintptr_t)18446744073709551615ULL); x46 = sizeof(intptr_t) == 4 ? ((uint64_t)(x42)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x42)*((uintptr_t)18446744073709551615ULL))>>64; x47 = sizeof(intptr_t) == 4 ? ((uint64_t)(x42)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x42)*((uintptr_t)18446744073709551615ULL))>>64; x48 = sizeof(intptr_t) == 4 ? ((uint64_t)(x42)*((uintptr_t)18446744069414583343ULL))>>32 : ((__uint128_t)(x42)*((uintptr_t)18446744069414583343ULL))>>64; x49 = (x48)+((x42)*((uintptr_t)18446744073709551615ULL)); x50 = ((x49)<(x48))+(x47); x51 = (x50)+(x45); x52 = (((x50)<(x47))+((x51)<(x45)))+(x46); x53 = (x52)+(x43); x54 = ((x52)<(x46))+((x53)<(x43)); x55 = (((x35)+((x42)*((uintptr_t)18446744069414583343ULL)))<(x35))+(x37); x56 = (x55)+(x49); x57 = (((x55)<(x37))+((x56)<(x49)))+(x39); x58 = (x57)+(x51); x59 = (((x57)<(x39))+((x58)<(x51)))+(x40); x60 = (x59)+(x53); x61 = (((x59)<(x40))+((x60)<(x53)))+((x41)+(x31)); x62 = (x61)+((x54)+(x44)); x63 = ((x61)<((x41)+(x31)))+((x62)<((x54)+(x44))); x64 = sizeof(intptr_t) == 4 ? ((uint64_t)(x5)*((uintptr_t)8392367050913ULL))>>32 : ((__uint128_t)(x5)*((uintptr_t)8392367050913ULL))>>64; x65 = (x64)+(x5); x66 = (x65)<(x64); x67 = (x56)+((x5)*((uintptr_t)8392367050913ULL)); x68 = ((x67)<(x56))+(x58); x69 = (x68)+(x65); x70 = (((x68)<(x58))+((x69)<(x65)))+(x60); x71 = (x70)+(x66); x72 = (((x70)<(x60))+((x71)<(x66)))+(x62); x73 = (x72)<(x62); x74 = (x67)*((uintptr_t)15580212934572586289ULL); x75 = (x74)*((uintptr_t)18446744073709551615ULL); x76 = sizeof(intptr_t) == 4 ? ((uint64_t)(x74)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x74)*((uintptr_t)18446744073709551615ULL))>>64; x77 = (x74)*((uintptr_t)18446744073709551615ULL); x78 = sizeof(intptr_t) == 4 ? ((uint64_t)(x74)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x74)*((uintptr_t)18446744073709551615ULL))>>64; x79 = sizeof(intptr_t) == 4 ? ((uint64_t)(x74)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x74)*((uintptr_t)18446744073709551615ULL))>>64; x80 = sizeof(intptr_t) == 4 ? ((uint64_t)(x74)*((uintptr_t)18446744069414583343ULL))>>32 : ((__uint128_t)(x74)*((uintptr_t)18446744069414583343ULL))>>64; x81 = (x80)+((x74)*((uintptr_t)18446744073709551615ULL)); x82 = ((x81)<(x80))+(x79); x83 = (x82)+(x77); x84 = (((x82)<(x79))+((x83)<(x77)))+(x78); x85 = (x84)+(x75); x86 = ((x84)<(x78))+((x85)<(x75)); x87 = (((x67)+((x74)*((uintptr_t)18446744069414583343ULL)))<(x67))+(x69); x88 = (x87)+(x81); x89 = (((x87)<(x69))+((x88)<(x81)))+(x71); x90 = (x89)+(x83); x91 = (((x89)<(x71))+((x90)<(x83)))+(x72); x92 = (x91)+(x85); x93 = (((x91)<(x72))+((x92)<(x85)))+((x73)+(x63)); x94 = (x93)+((x86)+(x76)); x95 = ((x93)<((x73)+(x63)))+((x94)<((x86)+(x76))); x96 = sizeof(intptr_t) == 4 ? ((uint64_t)(x6)*((uintptr_t)8392367050913ULL))>>32 : ((__uint128_t)(x6)*((uintptr_t)8392367050913ULL))>>64; x97 = (x96)+(x6); x98 = (x97)<(x96); x99 = (x88)+((x6)*((uintptr_t)8392367050913ULL)); x100 = ((x99)<(x88))+(x90); x101 = (x100)+(x97); x102 = (((x100)<(x90))+((x101)<(x97)))+(x92); x103 = (x102)+(x98); x104 = (((x102)<(x92))+((x103)<(x98)))+(x94); x105 = (x104)<(x94); x106 = (x99)*((uintptr_t)15580212934572586289ULL); x107 = (x106)*((uintptr_t)18446744073709551615ULL); x108 = sizeof(intptr_t) == 4 ? ((uint64_t)(x106)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x106)*((uintptr_t)18446744073709551615ULL))>>64; x109 = (x106)*((uintptr_t)18446744073709551615ULL); x110 = sizeof(intptr_t) == 4 ? ((uint64_t)(x106)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x106)*((uintptr_t)18446744073709551615ULL))>>64; x111 = sizeof(intptr_t) == 4 ? ((uint64_t)(x106)*((uintptr_t)18446744073709551615ULL))>>32 : ((__uint128_t)(x106)*((uintptr_t)18446744073709551615ULL))>>64; x112 = sizeof(intptr_t) == 4 ? ((uint64_t)(x106)*((uintptr_t)18446744069414583343ULL))>>32 : ((__uint128_t)(x106)*((uintptr_t)18446744069414583343ULL))>>64; x113 = (x112)+((x106)*((uintptr_t)18446744073709551615ULL)); x114 = ((x113)<(x112))+(x111); x115 = (x114)+(x109); x116 = (((x114)<(x111))+((x115)<(x109)))+(x110); x117 = (x116)+(x107); x118 = ((x116)<(x110))+((x117)<(x107)); x119 = (((x99)+((x106)*((uintptr_t)18446744069414583343ULL)))<(x99))+(x101); x120 = (x119)+(x113); x121 = (((x119)<(x101))+((x120)<(x113)))+(x103); x122 = (x121)+(x115); x123 = (((x121)<(x103))+((x122)<(x115)))+(x104); x124 = (x123)+(x117); x125 = (((x123)<(x104))+((x124)<(x117)))+((x105)+(x95)); x126 = (x125)+((x118)+(x108)); x127 = ((x125)<((x105)+(x95)))+((x126)<((x118)+(x108))); x128 = (x120)-((uintptr_t)18446744069414583343ULL); x129 = (x122)-((uintptr_t)18446744073709551615ULL); x130 = (x129)-((x120)<(x128)); x131 = (x124)-((uintptr_t)18446744073709551615ULL); x132 = (x131)-(((x122)<(x129))+((x129)<(x130))); x133 = (x126)-((uintptr_t)18446744073709551615ULL); x134 = (x133)-(((x124)<(x131))+((x131)<(x132))); x135 = (x127)<((x127)-(((x126)<(x133))+((x133)<(x134)))); x136 = ((uintptr_t)-1ULL)+((x135)==((uintptr_t)0ULL)); x137 = (x136)^((uintptr_t)18446744073709551615ULL); x138 = ((x120)&(x136))|((x128)&(x137)); x139 = ((uintptr_t)-1ULL)+((x135)==((uintptr_t)0ULL)); x140 = (x139)^((uintptr_t)18446744073709551615ULL); x141 = ((x122)&(x139))|((x130)&(x140)); x142 = ((uintptr_t)-1ULL)+((x135)==((uintptr_t)0ULL)); x143 = (x142)^((uintptr_t)18446744073709551615ULL); x144 = ((x124)&(x142))|((x132)&(x143)); x145 = ((uintptr_t)-1ULL)+((x135)==((uintptr_t)0ULL)); x146 = (x145)^((uintptr_t)18446744073709551615ULL); x147 = ((x126)&(x145))|((x134)&(x146)); x148 = x138; x149 = x141; x150 = x144; x151 = x147; /*skip*/ _br2_store((out0)+((uintptr_t)0ULL), x148, sizeof(uintptr_t)); _br2_store((out0)+((uintptr_t)8ULL), x149, sizeof(uintptr_t)); _br2_store((out0)+((uintptr_t)16ULL), x150, sizeof(uintptr_t)); _br2_store((out0)+((uintptr_t)24ULL), x151, sizeof(uintptr_t)); /*skip*/ return; } /* NOTE: The following wrapper function is not covered by Coq proofs */ static void fiat_secp256k1_to_montgomery(uint64_t out1[4], const uint64_t arg1[4]) { internal_fiat_secp256k1_to_montgomery((uintptr_t)out1, (uintptr_t)arg1); } /* * Input Bounds: * in0: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] * Output Bounds: * out0: [0x0 ~> 0xffffffffffffffff] */ static uintptr_t internal_fiat_secp256k1_nonzero(uintptr_t in0) { uintptr_t x0, x1, x2, x3, x4, out0, x5; x0 = _br2_load((in0)+((uintptr_t)0ULL), sizeof(uintptr_t)); x1 = _br2_load((in0)+((uintptr_t)8ULL), sizeof(uintptr_t)); x2 = _br2_load((in0)+((uintptr_t)16ULL), sizeof(uintptr_t)); x3 = _br2_load((in0)+((uintptr_t)24ULL), sizeof(uintptr_t)); /*skip*/ /*skip*/ x4 = (x0)|((x1)|((x2)|(x3))); x5 = x4; out0 = x5; return out0; } /* NOTE: The following wrapper function is not covered by Coq proofs */ static void fiat_secp256k1_nonzero(uint64_t* out1, const uint64_t arg1[4]) { *out1 = (uint64_t)internal_fiat_secp256k1_nonzero((uintptr_t)arg1); } /* * Input Bounds: * in0: [0x0 ~> 0x1] * in1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] * in2: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] * Output Bounds: * out0: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] */ static void internal_fiat_secp256k1_selectznz(uintptr_t out0, uintptr_t in0, uintptr_t in1, uintptr_t in2) { uintptr_t x4, x8, x0, x9, x5, x11, x1, x12, x6, x14, x2, x15, x7, x17, x3, x18, x10, x13, x16, x19, x20, x21, x22, x23; /*skip*/ x0 = _br2_load((in1)+((uintptr_t)0ULL), sizeof(uintptr_t)); x1 = _br2_load((in1)+((uintptr_t)8ULL), sizeof(uintptr_t)); x2 = _br2_load((in1)+((uintptr_t)16ULL), sizeof(uintptr_t)); x3 = _br2_load((in1)+((uintptr_t)24ULL), sizeof(uintptr_t)); /*skip*/ x4 = _br2_load((in2)+((uintptr_t)0ULL), sizeof(uintptr_t)); x5 = _br2_load((in2)+((uintptr_t)8ULL), sizeof(uintptr_t)); x6 = _br2_load((in2)+((uintptr_t)16ULL), sizeof(uintptr_t)); x7 = _br2_load((in2)+((uintptr_t)24ULL), sizeof(uintptr_t)); /*skip*/ /*skip*/ x8 = ((uintptr_t)-1ULL)+((in0)==((uintptr_t)0ULL)); x9 = (x8)^((uintptr_t)18446744073709551615ULL); x10 = ((x4)&(x8))|((x0)&(x9)); x11 = ((uintptr_t)-1ULL)+((in0)==((uintptr_t)0ULL)); x12 = (x11)^((uintptr_t)18446744073709551615ULL); x13 = ((x5)&(x11))|((x1)&(x12)); x14 = ((uintptr_t)-1ULL)+((in0)==((uintptr_t)0ULL)); x15 = (x14)^((uintptr_t)18446744073709551615ULL); x16 = ((x6)&(x14))|((x2)&(x15)); x17 = ((uintptr_t)-1ULL)+((in0)==((uintptr_t)0ULL)); x18 = (x17)^((uintptr_t)18446744073709551615ULL); x19 = ((x7)&(x17))|((x3)&(x18)); x20 = x10; x21 = x13; x22 = x16; x23 = x19; /*skip*/ _br2_store((out0)+((uintptr_t)0ULL), x20, sizeof(uintptr_t)); _br2_store((out0)+((uintptr_t)8ULL), x21, sizeof(uintptr_t)); _br2_store((out0)+((uintptr_t)16ULL), x22, sizeof(uintptr_t)); _br2_store((out0)+((uintptr_t)24ULL), x23, sizeof(uintptr_t)); /*skip*/ return; } /* NOTE: The following wrapper function is not covered by Coq proofs */ static void fiat_secp256k1_selectznz(uint64_t out1[4], uint8_t arg1, const uint64_t arg2[4], const uint64_t arg3[4]) { internal_fiat_secp256k1_selectznz((uintptr_t)out1, (uintptr_t)arg1, (uintptr_t)arg2, (uintptr_t)arg3); } /* * Input Bounds: * in0: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] * Output Bounds: * out0: [[0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff]] */ static void internal_fiat_secp256k1_to_bytes(uintptr_t out0, uintptr_t in0) { uintptr_t x3, x2, x1, x0, x7, x9, x11, x13, x15, x17, x19, x6, x23, x25, x27, x29, x31, x33, x5, x37, x39, x41, x43, x45, x47, x4, x51, x53, x55, x57, x59, x61, x8, x10, x12, x14, x16, x18, x20, x21, x22, x24, x26, x28, x30, x32, x34, x35, x36, x38, x40, x42, x44, x46, x48, x49, x50, x52, x54, x56, x58, x60, x62, x63, x64, x65, x66, x67, x68, x69, x70, x71, x72, x73, x74, x75, x76, x77, x78, x79, x80, x81, x82, x83, x84, x85, x86, x87, x88, x89, x90, x91, x92, x93, x94, x95; x0 = _br2_load((in0)+((uintptr_t)0ULL), sizeof(uintptr_t)); x1 = _br2_load((in0)+((uintptr_t)8ULL), sizeof(uintptr_t)); x2 = _br2_load((in0)+((uintptr_t)16ULL), sizeof(uintptr_t)); x3 = _br2_load((in0)+((uintptr_t)24ULL), sizeof(uintptr_t)); /*skip*/ /*skip*/ x4 = x3; x5 = x2; x6 = x1; x7 = x0; x8 = (x7)&((uintptr_t)255ULL); x9 = (x7)>>((uintptr_t)8ULL); x10 = (x9)&((uintptr_t)255ULL); x11 = (x9)>>((uintptr_t)8ULL); x12 = (x11)&((uintptr_t)255ULL); x13 = (x11)>>((uintptr_t)8ULL); x14 = (x13)&((uintptr_t)255ULL); x15 = (x13)>>((uintptr_t)8ULL); x16 = (x15)&((uintptr_t)255ULL); x17 = (x15)>>((uintptr_t)8ULL); x18 = (x17)&((uintptr_t)255ULL); x19 = (x17)>>((uintptr_t)8ULL); x20 = (x19)&((uintptr_t)255ULL); x21 = (x19)>>((uintptr_t)8ULL); x22 = (x6)&((uintptr_t)255ULL); x23 = (x6)>>((uintptr_t)8ULL); x24 = (x23)&((uintptr_t)255ULL); x25 = (x23)>>((uintptr_t)8ULL); x26 = (x25)&((uintptr_t)255ULL); x27 = (x25)>>((uintptr_t)8ULL); x28 = (x27)&((uintptr_t)255ULL); x29 = (x27)>>((uintptr_t)8ULL); x30 = (x29)&((uintptr_t)255ULL); x31 = (x29)>>((uintptr_t)8ULL); x32 = (x31)&((uintptr_t)255ULL); x33 = (x31)>>((uintptr_t)8ULL); x34 = (x33)&((uintptr_t)255ULL); x35 = (x33)>>((uintptr_t)8ULL); x36 = (x5)&((uintptr_t)255ULL); x37 = (x5)>>((uintptr_t)8ULL); x38 = (x37)&((uintptr_t)255ULL); x39 = (x37)>>((uintptr_t)8ULL); x40 = (x39)&((uintptr_t)255ULL); x41 = (x39)>>((uintptr_t)8ULL); x42 = (x41)&((uintptr_t)255ULL); x43 = (x41)>>((uintptr_t)8ULL); x44 = (x43)&((uintptr_t)255ULL); x45 = (x43)>>((uintptr_t)8ULL); x46 = (x45)&((uintptr_t)255ULL); x47 = (x45)>>((uintptr_t)8ULL); x48 = (x47)&((uintptr_t)255ULL); x49 = (x47)>>((uintptr_t)8ULL); x50 = (x4)&((uintptr_t)255ULL); x51 = (x4)>>((uintptr_t)8ULL); x52 = (x51)&((uintptr_t)255ULL); x53 = (x51)>>((uintptr_t)8ULL); x54 = (x53)&((uintptr_t)255ULL); x55 = (x53)>>((uintptr_t)8ULL); x56 = (x55)&((uintptr_t)255ULL); x57 = (x55)>>((uintptr_t)8ULL); x58 = (x57)&((uintptr_t)255ULL); x59 = (x57)>>((uintptr_t)8ULL); x60 = (x59)&((uintptr_t)255ULL); x61 = (x59)>>((uintptr_t)8ULL); x62 = (x61)&((uintptr_t)255ULL); x63 = (x61)>>((uintptr_t)8ULL); x64 = x8; x65 = x10; x66 = x12; x67 = x14; x68 = x16; x69 = x18; x70 = x20; x71 = x21; x72 = x22; x73 = x24; x74 = x26; x75 = x28; x76 = x30; x77 = x32; x78 = x34; x79 = x35; x80 = x36; x81 = x38; x82 = x40; x83 = x42; x84 = x44; x85 = x46; x86 = x48; x87 = x49; x88 = x50; x89 = x52; x90 = x54; x91 = x56; x92 = x58; x93 = x60; x94 = x62; x95 = x63; /*skip*/ _br2_store((out0)+((uintptr_t)0ULL), x64, 1); _br2_store((out0)+((uintptr_t)1ULL), x65, 1); _br2_store((out0)+((uintptr_t)2ULL), x66, 1); _br2_store((out0)+((uintptr_t)3ULL), x67, 1); _br2_store((out0)+((uintptr_t)4ULL), x68, 1); _br2_store((out0)+((uintptr_t)5ULL), x69, 1); _br2_store((out0)+((uintptr_t)6ULL), x70, 1); _br2_store((out0)+((uintptr_t)7ULL), x71, 1); _br2_store((out0)+((uintptr_t)8ULL), x72, 1); _br2_store((out0)+((uintptr_t)9ULL), x73, 1); _br2_store((out0)+((uintptr_t)10ULL), x74, 1); _br2_store((out0)+((uintptr_t)11ULL), x75, 1); _br2_store((out0)+((uintptr_t)12ULL), x76, 1); _br2_store((out0)+((uintptr_t)13ULL), x77, 1); _br2_store((out0)+((uintptr_t)14ULL), x78, 1); _br2_store((out0)+((uintptr_t)15ULL), x79, 1); _br2_store((out0)+((uintptr_t)16ULL), x80, 1); _br2_store((out0)+((uintptr_t)17ULL), x81, 1); _br2_store((out0)+((uintptr_t)18ULL), x82, 1); _br2_store((out0)+((uintptr_t)19ULL), x83, 1); _br2_store((out0)+((uintptr_t)20ULL), x84, 1); _br2_store((out0)+((uintptr_t)21ULL), x85, 1); _br2_store((out0)+((uintptr_t)22ULL), x86, 1); _br2_store((out0)+((uintptr_t)23ULL), x87, 1); _br2_store((out0)+((uintptr_t)24ULL), x88, 1); _br2_store((out0)+((uintptr_t)25ULL), x89, 1); _br2_store((out0)+((uintptr_t)26ULL), x90, 1); _br2_store((out0)+((uintptr_t)27ULL), x91, 1); _br2_store((out0)+((uintptr_t)28ULL), x92, 1); _br2_store((out0)+((uintptr_t)29ULL), x93, 1); _br2_store((out0)+((uintptr_t)30ULL), x94, 1); _br2_store((out0)+((uintptr_t)31ULL), x95, 1); /*skip*/ return; } /* NOTE: The following wrapper function is not covered by Coq proofs */ static void fiat_secp256k1_to_bytes(uint8_t out1[32], const uint64_t arg1[4]) { internal_fiat_secp256k1_to_bytes((uintptr_t)out1, (uintptr_t)arg1); } /* * Input Bounds: * in0: [[0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff]] * Output Bounds: * out0: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] */ static void internal_fiat_secp256k1_from_bytes(uintptr_t out0, uintptr_t in0) { uintptr_t x31, x30, x29, x28, x27, x26, x25, x24, x23, x22, x21, x20, x19, x18, x17, x16, x15, x14, x13, x12, x11, x10, x9, x8, x7, x6, x5, x4, x3, x2, x1, x0, x62, x63, x61, x64, x60, x65, x59, x66, x58, x67, x57, x68, x56, x69, x54, x55, x53, x71, x52, x72, x51, x73, x50, x74, x49, x75, x48, x76, x46, x47, x45, x78, x44, x79, x43, x80, x42, x81, x41, x82, x40, x83, x38, x39, x37, x85, x36, x86, x35, x87, x34, x88, x33, x89, x32, x90, x70, x77, x84, x91, x92, x93, x94, x95; x0 = _br2_load((in0)+((uintptr_t)0ULL), 1); x1 = _br2_load((in0)+((uintptr_t)1ULL), 1); x2 = _br2_load((in0)+((uintptr_t)2ULL), 1); x3 = _br2_load((in0)+((uintptr_t)3ULL), 1); x4 = _br2_load((in0)+((uintptr_t)4ULL), 1); x5 = _br2_load((in0)+((uintptr_t)5ULL), 1); x6 = _br2_load((in0)+((uintptr_t)6ULL), 1); x7 = _br2_load((in0)+((uintptr_t)7ULL), 1); x8 = _br2_load((in0)+((uintptr_t)8ULL), 1); x9 = _br2_load((in0)+((uintptr_t)9ULL), 1); x10 = _br2_load((in0)+((uintptr_t)10ULL), 1); x11 = _br2_load((in0)+((uintptr_t)11ULL), 1); x12 = _br2_load((in0)+((uintptr_t)12ULL), 1); x13 = _br2_load((in0)+((uintptr_t)13ULL), 1); x14 = _br2_load((in0)+((uintptr_t)14ULL), 1); x15 = _br2_load((in0)+((uintptr_t)15ULL), 1); x16 = _br2_load((in0)+((uintptr_t)16ULL), 1); x17 = _br2_load((in0)+((uintptr_t)17ULL), 1); x18 = _br2_load((in0)+((uintptr_t)18ULL), 1); x19 = _br2_load((in0)+((uintptr_t)19ULL), 1); x20 = _br2_load((in0)+((uintptr_t)20ULL), 1); x21 = _br2_load((in0)+((uintptr_t)21ULL), 1); x22 = _br2_load((in0)+((uintptr_t)22ULL), 1); x23 = _br2_load((in0)+((uintptr_t)23ULL), 1); x24 = _br2_load((in0)+((uintptr_t)24ULL), 1); x25 = _br2_load((in0)+((uintptr_t)25ULL), 1); x26 = _br2_load((in0)+((uintptr_t)26ULL), 1); x27 = _br2_load((in0)+((uintptr_t)27ULL), 1); x28 = _br2_load((in0)+((uintptr_t)28ULL), 1); x29 = _br2_load((in0)+((uintptr_t)29ULL), 1); x30 = _br2_load((in0)+((uintptr_t)30ULL), 1); x31 = _br2_load((in0)+((uintptr_t)31ULL), 1); /*skip*/ /*skip*/ x32 = (x31)<<((uintptr_t)56ULL); x33 = (x30)<<((uintptr_t)48ULL); x34 = (x29)<<((uintptr_t)40ULL); x35 = (x28)<<((uintptr_t)32ULL); x36 = (x27)<<((uintptr_t)24ULL); x37 = (x26)<<((uintptr_t)16ULL); x38 = (x25)<<((uintptr_t)8ULL); x39 = x24; x40 = (x23)<<((uintptr_t)56ULL); x41 = (x22)<<((uintptr_t)48ULL); x42 = (x21)<<((uintptr_t)40ULL); x43 = (x20)<<((uintptr_t)32ULL); x44 = (x19)<<((uintptr_t)24ULL); x45 = (x18)<<((uintptr_t)16ULL); x46 = (x17)<<((uintptr_t)8ULL); x47 = x16; x48 = (x15)<<((uintptr_t)56ULL); x49 = (x14)<<((uintptr_t)48ULL); x50 = (x13)<<((uintptr_t)40ULL); x51 = (x12)<<((uintptr_t)32ULL); x52 = (x11)<<((uintptr_t)24ULL); x53 = (x10)<<((uintptr_t)16ULL); x54 = (x9)<<((uintptr_t)8ULL); x55 = x8; x56 = (x7)<<((uintptr_t)56ULL); x57 = (x6)<<((uintptr_t)48ULL); x58 = (x5)<<((uintptr_t)40ULL); x59 = (x4)<<((uintptr_t)32ULL); x60 = (x3)<<((uintptr_t)24ULL); x61 = (x2)<<((uintptr_t)16ULL); x62 = (x1)<<((uintptr_t)8ULL); x63 = x0; x64 = (x62)+(x63); x65 = (x61)+(x64); x66 = (x60)+(x65); x67 = (x59)+(x66); x68 = (x58)+(x67); x69 = (x57)+(x68); x70 = (x56)+(x69); x71 = (x54)+(x55); x72 = (x53)+(x71); x73 = (x52)+(x72); x74 = (x51)+(x73); x75 = (x50)+(x74); x76 = (x49)+(x75); x77 = (x48)+(x76); x78 = (x46)+(x47); x79 = (x45)+(x78); x80 = (x44)+(x79); x81 = (x43)+(x80); x82 = (x42)+(x81); x83 = (x41)+(x82); x84 = (x40)+(x83); x85 = (x38)+(x39); x86 = (x37)+(x85); x87 = (x36)+(x86); x88 = (x35)+(x87); x89 = (x34)+(x88); x90 = (x33)+(x89); x91 = (x32)+(x90); x92 = x70; x93 = x77; x94 = x84; x95 = x91; /*skip*/ _br2_store((out0)+((uintptr_t)0ULL), x92, sizeof(uintptr_t)); _br2_store((out0)+((uintptr_t)8ULL), x93, sizeof(uintptr_t)); _br2_store((out0)+((uintptr_t)16ULL), x94, sizeof(uintptr_t)); _br2_store((out0)+((uintptr_t)24ULL), x95, sizeof(uintptr_t)); /*skip*/ return; } /* NOTE: The following wrapper function is not covered by Coq proofs */ static void fiat_secp256k1_from_bytes(uint64_t out1[4], const uint8_t arg1[32]) { internal_fiat_secp256k1_from_bytes((uintptr_t)out1, (uintptr_t)arg1); } /* * Input Bounds: * Output Bounds: * out0: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] */ static void internal_fiat_secp256k1_set_one(uintptr_t out0) { uintptr_t x0, x1, x2, x3; /*skip*/ x0 = (uintptr_t)4294968273ULL; x1 = (uintptr_t)0ULL; x2 = (uintptr_t)0ULL; x3 = (uintptr_t)0ULL; /*skip*/ _br2_store((out0)+((uintptr_t)0ULL), x0, sizeof(uintptr_t)); _br2_store((out0)+((uintptr_t)8ULL), x1, sizeof(uintptr_t)); _br2_store((out0)+((uintptr_t)16ULL), x2, sizeof(uintptr_t)); _br2_store((out0)+((uintptr_t)24ULL), x3, sizeof(uintptr_t)); /*skip*/ return; } /* NOTE: The following wrapper function is not covered by Coq proofs */ static void fiat_secp256k1_set_one(uint64_t out1[4]) { internal_fiat_secp256k1_set_one((uintptr_t)out1); } /* * Input Bounds: * Output Bounds: * out0: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] */ static void internal_fiat_secp256k1_msat(uintptr_t out0) { uintptr_t x0, x1, x2, x3, x4; /*skip*/ x0 = (uintptr_t)18446744069414583343ULL; x1 = (uintptr_t)18446744073709551615ULL; x2 = (uintptr_t)18446744073709551615ULL; x3 = (uintptr_t)18446744073709551615ULL; x4 = (uintptr_t)0ULL; /*skip*/ _br2_store((out0)+((uintptr_t)0ULL), x0, sizeof(uintptr_t)); _br2_store((out0)+((uintptr_t)8ULL), x1, sizeof(uintptr_t)); _br2_store((out0)+((uintptr_t)16ULL), x2, sizeof(uintptr_t)); _br2_store((out0)+((uintptr_t)24ULL), x3, sizeof(uintptr_t)); _br2_store((out0)+((uintptr_t)32ULL), x4, sizeof(uintptr_t)); /*skip*/ return; } /* NOTE: The following wrapper function is not covered by Coq proofs */ static void fiat_secp256k1_msat(uint64_t out1[5]) { internal_fiat_secp256k1_msat((uintptr_t)out1); } /* * Input Bounds: * in0: [0x0 ~> 0xffffffffffffffff] * in1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] * in2: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] * in3: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] * in4: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] * Output Bounds: * out0: [0x0 ~> 0xffffffffffffffff] * out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] * out2: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] * out3: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] * out4: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] */ static uintptr_t internal_fiat_secp256k1_divstep(uintptr_t out1, uintptr_t out2, uintptr_t out3, uintptr_t out4, uintptr_t in0, uintptr_t in1, uintptr_t in2, uintptr_t in3, uintptr_t in4) { uintptr_t x18, x20, x21, x22, x24, x25, x27, x28, x30, x31, x33, x34, x36, x37, x0, x40, x1, x42, x2, x44, x3, x46, x4, x39, x48, x5, x49, x41, x51, x6, x52, x43, x54, x7, x55, x45, x57, x8, x58, x47, x60, x9, x61, x63, x64, x66, x67, x69, x70, x72, x73, x76, x77, x78, x80, x81, x82, x83, x85, x86, x87, x88, x90, x93, x94, x95, x97, x98, x99, x100, x102, x103, x104, x105, x107, x108, x91, x109, x13, x12, x11, x10, x115, x113, x116, x118, x119, x112, x120, x122, x123, x111, x124, x126, x127, x114, x130, x117, x131, x132, x134, x135, x121, x136, x137, x139, x140, x125, x141, x128, x129, x143, x14, x144, x133, x146, x15, x147, x138, x149, x16, x150, x19, x142, x152, x17, x153, x156, x157, x159, x160, x162, x163, x165, x166, x168, x169, x158, x50, x172, x53, x173, x161, x174, x176, x177, x56, x178, x164, x179, x181, x182, x59, x183, x167, x184, x186, x187, x62, x188, x170, x65, x190, x191, x68, x193, x194, x71, x196, x197, x155, x74, x199, x200, x192, x145, x203, x148, x204, x195, x205, x207, x208, x151, x209, x198, x210, x212, x213, x154, x214, x201, x215, x217, x220, x221, x222, x224, x225, x226, x227, x229, x230, x231, x232, x234, x235, x218, x236, x23, x171, x175, x180, x185, x189, x75, x244, x92, x245, x79, x247, x96, x248, x84, x250, x101, x251, x110, x89, x253, x106, x254, x202, x256, x219, x257, x206, x259, x223, x260, x211, x262, x228, x263, x237, x216, x265, x233, x266, x238, x26, x29, x32, x35, x38, x239, x240, x241, x242, x243, x246, x249, x252, x255, x258, x261, x264, x267, out0, x268, x269, x270, x271, x272, x273, x274, x275, x276, x277, x278, x279, x280, x281, x282, x283, x284, x285, x286; /*skip*/ x0 = _br2_load((in1)+((uintptr_t)0ULL), sizeof(uintptr_t)); x1 = _br2_load((in1)+((uintptr_t)8ULL), sizeof(uintptr_t)); x2 = _br2_load((in1)+((uintptr_t)16ULL), sizeof(uintptr_t)); x3 = _br2_load((in1)+((uintptr_t)24ULL), sizeof(uintptr_t)); x4 = _br2_load((in1)+((uintptr_t)32ULL), sizeof(uintptr_t)); /*skip*/ x5 = _br2_load((in2)+((uintptr_t)0ULL), sizeof(uintptr_t)); x6 = _br2_load((in2)+((uintptr_t)8ULL), sizeof(uintptr_t)); x7 = _br2_load((in2)+((uintptr_t)16ULL), sizeof(uintptr_t)); x8 = _br2_load((in2)+((uintptr_t)24ULL), sizeof(uintptr_t)); x9 = _br2_load((in2)+((uintptr_t)32ULL), sizeof(uintptr_t)); /*skip*/ x10 = _br2_load((in3)+((uintptr_t)0ULL), sizeof(uintptr_t)); x11 = _br2_load((in3)+((uintptr_t)8ULL), sizeof(uintptr_t)); x12 = _br2_load((in3)+((uintptr_t)16ULL), sizeof(uintptr_t)); x13 = _br2_load((in3)+((uintptr_t)24ULL), sizeof(uintptr_t)); /*skip*/ x14 = _br2_load((in4)+((uintptr_t)0ULL), sizeof(uintptr_t)); x15 = _br2_load((in4)+((uintptr_t)8ULL), sizeof(uintptr_t)); x16 = _br2_load((in4)+((uintptr_t)16ULL), sizeof(uintptr_t)); x17 = _br2_load((in4)+((uintptr_t)24ULL), sizeof(uintptr_t)); /*skip*/ /*skip*/ x18 = ((in0)^((uintptr_t)18446744073709551615ULL))+((uintptr_t)1ULL); x19 = ((x18)>>((uintptr_t)63ULL))&((x5)&((uintptr_t)1ULL)); x20 = ((in0)^((uintptr_t)18446744073709551615ULL))+((uintptr_t)1ULL); x21 = ((uintptr_t)-1ULL)+((x19)==((uintptr_t)0ULL)); x22 = (x21)^((uintptr_t)18446744073709551615ULL); x23 = ((x20)&(x21))|((in0)&(x22)); x24 = ((uintptr_t)-1ULL)+((x19)==((uintptr_t)0ULL)); x25 = (x24)^((uintptr_t)18446744073709551615ULL); x26 = ((x5)&(x24))|((x0)&(x25)); x27 = ((uintptr_t)-1ULL)+((x19)==((uintptr_t)0ULL)); x28 = (x27)^((uintptr_t)18446744073709551615ULL); x29 = ((x6)&(x27))|((x1)&(x28)); x30 = ((uintptr_t)-1ULL)+((x19)==((uintptr_t)0ULL)); x31 = (x30)^((uintptr_t)18446744073709551615ULL); x32 = ((x7)&(x30))|((x2)&(x31)); x33 = ((uintptr_t)-1ULL)+((x19)==((uintptr_t)0ULL)); x34 = (x33)^((uintptr_t)18446744073709551615ULL); x35 = ((x8)&(x33))|((x3)&(x34)); x36 = ((uintptr_t)-1ULL)+((x19)==((uintptr_t)0ULL)); x37 = (x36)^((uintptr_t)18446744073709551615ULL); x38 = ((x9)&(x36))|((x4)&(x37)); x39 = ((uintptr_t)1ULL)+((x0)^((uintptr_t)18446744073709551615ULL)); x40 = (x39)<((uintptr_t)1ULL); x41 = (x40)+((x1)^((uintptr_t)18446744073709551615ULL)); x42 = (x41)<((x1)^((uintptr_t)18446744073709551615ULL)); x43 = (x42)+((x2)^((uintptr_t)18446744073709551615ULL)); x44 = (x43)<((x2)^((uintptr_t)18446744073709551615ULL)); x45 = (x44)+((x3)^((uintptr_t)18446744073709551615ULL)); x46 = (x45)<((x3)^((uintptr_t)18446744073709551615ULL)); x47 = (x46)+((x4)^((uintptr_t)18446744073709551615ULL)); x48 = ((uintptr_t)-1ULL)+((x19)==((uintptr_t)0ULL)); x49 = (x48)^((uintptr_t)18446744073709551615ULL); x50 = ((x39)&(x48))|((x5)&(x49)); x51 = ((uintptr_t)-1ULL)+((x19)==((uintptr_t)0ULL)); x52 = (x51)^((uintptr_t)18446744073709551615ULL); x53 = ((x41)&(x51))|((x6)&(x52)); x54 = ((uintptr_t)-1ULL)+((x19)==((uintptr_t)0ULL)); x55 = (x54)^((uintptr_t)18446744073709551615ULL); x56 = ((x43)&(x54))|((x7)&(x55)); x57 = ((uintptr_t)-1ULL)+((x19)==((uintptr_t)0ULL)); x58 = (x57)^((uintptr_t)18446744073709551615ULL); x59 = ((x45)&(x57))|((x8)&(x58)); x60 = ((uintptr_t)-1ULL)+((x19)==((uintptr_t)0ULL)); x61 = (x60)^((uintptr_t)18446744073709551615ULL); x62 = ((x47)&(x60))|((x9)&(x61)); x63 = ((uintptr_t)-1ULL)+((x19)==((uintptr_t)0ULL)); x64 = (x63)^((uintptr_t)18446744073709551615ULL); x65 = ((x14)&(x63))|((x10)&(x64)); x66 = ((uintptr_t)-1ULL)+((x19)==((uintptr_t)0ULL)); x67 = (x66)^((uintptr_t)18446744073709551615ULL); x68 = ((x15)&(x66))|((x11)&(x67)); x69 = ((uintptr_t)-1ULL)+((x19)==((uintptr_t)0ULL)); x70 = (x69)^((uintptr_t)18446744073709551615ULL); x71 = ((x16)&(x69))|((x12)&(x70)); x72 = ((uintptr_t)-1ULL)+((x19)==((uintptr_t)0ULL)); x73 = (x72)^((uintptr_t)18446744073709551615ULL); x74 = ((x17)&(x72))|((x13)&(x73)); x75 = (x65)+(x65); x76 = (x75)<(x65); x77 = (x76)+(x68); x78 = (x77)<(x68); x79 = (x77)+(x68); x80 = (x79)<(x68); x81 = (x78)+(x80); x82 = (x81)+(x71); x83 = (x82)<(x71); x84 = (x82)+(x71); x85 = (x84)<(x71); x86 = (x83)+(x85); x87 = (x86)+(x74); x88 = (x87)<(x74); x89 = (x87)+(x74); x90 = (x89)<(x74); x91 = (x88)+(x90); x92 = (x75)-((uintptr_t)18446744069414583343ULL); x93 = (x75)<(x92); x94 = (x79)-((uintptr_t)18446744073709551615ULL); x95 = (x79)<(x94); x96 = (x94)-(x93); x97 = (x94)<(x96); x98 = (x95)+(x97); x99 = (x84)-((uintptr_t)18446744073709551615ULL); x100 = (x84)<(x99); x101 = (x99)-(x98); x102 = (x99)<(x101); x103 = (x100)+(x102); x104 = (x89)-((uintptr_t)18446744073709551615ULL); x105 = (x89)<(x104); x106 = (x104)-(x103); x107 = (x104)<(x106); x108 = (x105)+(x107); x109 = (x91)-(x108); x110 = (x91)<(x109); x111 = x13; x112 = x12; x113 = x11; x114 = x10; x115 = ((uintptr_t)0ULL)<(((uintptr_t)0ULL)-(x114)); x116 = ((uintptr_t)0ULL)<(((uintptr_t)0ULL)-(x113)); x117 = (((uintptr_t)0ULL)-(x113))-(x115); x118 = (((uintptr_t)0ULL)-(x113))<(x117); x119 = (x116)+(x118); x120 = ((uintptr_t)0ULL)<(((uintptr_t)0ULL)-(x112)); x121 = (((uintptr_t)0ULL)-(x112))-(x119); x122 = (((uintptr_t)0ULL)-(x112))<(x121); x123 = (x120)+(x122); x124 = ((uintptr_t)0ULL)<(((uintptr_t)0ULL)-(x111)); x125 = (((uintptr_t)0ULL)-(x111))-(x123); x126 = (((uintptr_t)0ULL)-(x111))<(x125); x127 = (x124)+(x126); x128 = ((uintptr_t)-1ULL)+((x127)==((uintptr_t)0ULL)); x129 = (((uintptr_t)0ULL)-(x114))+((x128)&((uintptr_t)18446744069414583343ULL)); x130 = (x129)<(((uintptr_t)0ULL)-(x114)); x131 = (x130)+(x117); x132 = (x131)<(x117); x133 = (x131)+(x128); x134 = (x133)<(x128); x135 = (x132)+(x134); x136 = (x135)+(x121); x137 = (x136)<(x121); x138 = (x136)+(x128); x139 = (x138)<(x128); x140 = (x137)+(x139); x141 = (x140)+(x125); x142 = (x141)+(x128); x143 = ((uintptr_t)-1ULL)+((x19)==((uintptr_t)0ULL)); x144 = (x143)^((uintptr_t)18446744073709551615ULL); x145 = ((x129)&(x143))|((x14)&(x144)); x146 = ((uintptr_t)-1ULL)+((x19)==((uintptr_t)0ULL)); x147 = (x146)^((uintptr_t)18446744073709551615ULL); x148 = ((x133)&(x146))|((x15)&(x147)); x149 = ((uintptr_t)-1ULL)+((x19)==((uintptr_t)0ULL)); x150 = (x149)^((uintptr_t)18446744073709551615ULL); x151 = ((x138)&(x149))|((x16)&(x150)); x152 = ((uintptr_t)-1ULL)+((x19)==((uintptr_t)0ULL)); x153 = (x152)^((uintptr_t)18446744073709551615ULL); x154 = ((x142)&(x152))|((x17)&(x153)); x155 = (x50)&((uintptr_t)1ULL); x156 = ((uintptr_t)-1ULL)+((x155)==((uintptr_t)0ULL)); x157 = (x156)^((uintptr_t)18446744073709551615ULL); x158 = ((x26)&(x156))|(((uintptr_t)0ULL)&(x157)); x159 = ((uintptr_t)-1ULL)+((x155)==((uintptr_t)0ULL)); x160 = (x159)^((uintptr_t)18446744073709551615ULL); x161 = ((x29)&(x159))|(((uintptr_t)0ULL)&(x160)); x162 = ((uintptr_t)-1ULL)+((x155)==((uintptr_t)0ULL)); x163 = (x162)^((uintptr_t)18446744073709551615ULL); x164 = ((x32)&(x162))|(((uintptr_t)0ULL)&(x163)); x165 = ((uintptr_t)-1ULL)+((x155)==((uintptr_t)0ULL)); x166 = (x165)^((uintptr_t)18446744073709551615ULL); x167 = ((x35)&(x165))|(((uintptr_t)0ULL)&(x166)); x168 = ((uintptr_t)-1ULL)+((x155)==((uintptr_t)0ULL)); x169 = (x168)^((uintptr_t)18446744073709551615ULL); x170 = ((x38)&(x168))|(((uintptr_t)0ULL)&(x169)); x171 = (x50)+(x158); x172 = (x171)<(x50); x173 = (x172)+(x53); x174 = (x173)<(x53); x175 = (x173)+(x161); x176 = (x175)<(x161); x177 = (x174)+(x176); x178 = (x177)+(x56); x179 = (x178)<(x56); x180 = (x178)+(x164); x181 = (x180)<(x164); x182 = (x179)+(x181); x183 = (x182)+(x59); x184 = (x183)<(x59); x185 = (x183)+(x167); x186 = (x185)<(x167); x187 = (x184)+(x186); x188 = (x187)+(x62); x189 = (x188)+(x170); x190 = ((uintptr_t)-1ULL)+((x155)==((uintptr_t)0ULL)); x191 = (x190)^((uintptr_t)18446744073709551615ULL); x192 = ((x65)&(x190))|(((uintptr_t)0ULL)&(x191)); x193 = ((uintptr_t)-1ULL)+((x155)==((uintptr_t)0ULL)); x194 = (x193)^((uintptr_t)18446744073709551615ULL); x195 = ((x68)&(x193))|(((uintptr_t)0ULL)&(x194)); x196 = ((uintptr_t)-1ULL)+((x155)==((uintptr_t)0ULL)); x197 = (x196)^((uintptr_t)18446744073709551615ULL); x198 = ((x71)&(x196))|(((uintptr_t)0ULL)&(x197)); x199 = ((uintptr_t)-1ULL)+((x155)==((uintptr_t)0ULL)); x200 = (x199)^((uintptr_t)18446744073709551615ULL); x201 = ((x74)&(x199))|(((uintptr_t)0ULL)&(x200)); x202 = (x145)+(x192); x203 = (x202)<(x145); x204 = (x203)+(x148); x205 = (x204)<(x148); x206 = (x204)+(x195); x207 = (x206)<(x195); x208 = (x205)+(x207); x209 = (x208)+(x151); x210 = (x209)<(x151); x211 = (x209)+(x198); x212 = (x211)<(x198); x213 = (x210)+(x212); x214 = (x213)+(x154); x215 = (x214)<(x154); x216 = (x214)+(x201); x217 = (x216)<(x201); x218 = (x215)+(x217); x219 = (x202)-((uintptr_t)18446744069414583343ULL); x220 = (x202)<(x219); x221 = (x206)-((uintptr_t)18446744073709551615ULL); x222 = (x206)<(x221); x223 = (x221)-(x220); x224 = (x221)<(x223); x225 = (x222)+(x224); x226 = (x211)-((uintptr_t)18446744073709551615ULL); x227 = (x211)<(x226); x228 = (x226)-(x225); x229 = (x226)<(x228); x230 = (x227)+(x229); x231 = (x216)-((uintptr_t)18446744073709551615ULL); x232 = (x216)<(x231); x233 = (x231)-(x230); x234 = (x231)<(x233); x235 = (x232)+(x234); x236 = (x218)-(x235); x237 = (x218)<(x236); x238 = (x23)+((uintptr_t)1ULL); x239 = ((x171)>>((uintptr_t)1ULL))|((x175)<<((uintptr_t)63ULL)); x240 = ((x175)>>((uintptr_t)1ULL))|((x180)<<((uintptr_t)63ULL)); x241 = ((x180)>>((uintptr_t)1ULL))|((x185)<<((uintptr_t)63ULL)); x242 = ((x185)>>((uintptr_t)1ULL))|((x189)<<((uintptr_t)63ULL)); x243 = ((x189)&((uintptr_t)9223372036854775808ULL))|((x189)>>((uintptr_t)1ULL)); x244 = ((uintptr_t)-1ULL)+((x110)==((uintptr_t)0ULL)); x245 = (x244)^((uintptr_t)18446744073709551615ULL); x246 = ((x75)&(x244))|((x92)&(x245)); x247 = ((uintptr_t)-1ULL)+((x110)==((uintptr_t)0ULL)); x248 = (x247)^((uintptr_t)18446744073709551615ULL); x249 = ((x79)&(x247))|((x96)&(x248)); x250 = ((uintptr_t)-1ULL)+((x110)==((uintptr_t)0ULL)); x251 = (x250)^((uintptr_t)18446744073709551615ULL); x252 = ((x84)&(x250))|((x101)&(x251)); x253 = ((uintptr_t)-1ULL)+((x110)==((uintptr_t)0ULL)); x254 = (x253)^((uintptr_t)18446744073709551615ULL); x255 = ((x89)&(x253))|((x106)&(x254)); x256 = ((uintptr_t)-1ULL)+((x237)==((uintptr_t)0ULL)); x257 = (x256)^((uintptr_t)18446744073709551615ULL); x258 = ((x202)&(x256))|((x219)&(x257)); x259 = ((uintptr_t)-1ULL)+((x237)==((uintptr_t)0ULL)); x260 = (x259)^((uintptr_t)18446744073709551615ULL); x261 = ((x206)&(x259))|((x223)&(x260)); x262 = ((uintptr_t)-1ULL)+((x237)==((uintptr_t)0ULL)); x263 = (x262)^((uintptr_t)18446744073709551615ULL); x264 = ((x211)&(x262))|((x228)&(x263)); x265 = ((uintptr_t)-1ULL)+((x237)==((uintptr_t)0ULL)); x266 = (x265)^((uintptr_t)18446744073709551615ULL); x267 = ((x216)&(x265))|((x233)&(x266)); x268 = x238; x269 = x26; x270 = x29; x271 = x32; x272 = x35; x273 = x38; /*skip*/ x274 = x239; x275 = x240; x276 = x241; x277 = x242; x278 = x243; /*skip*/ x279 = x246; x280 = x249; x281 = x252; x282 = x255; /*skip*/ x283 = x258; x284 = x261; x285 = x264; x286 = x267; /*skip*/ out0 = x268; _br2_store((out1)+((uintptr_t)0ULL), x269, sizeof(uintptr_t)); _br2_store((out1)+((uintptr_t)8ULL), x270, sizeof(uintptr_t)); _br2_store((out1)+((uintptr_t)16ULL), x271, sizeof(uintptr_t)); _br2_store((out1)+((uintptr_t)24ULL), x272, sizeof(uintptr_t)); _br2_store((out1)+((uintptr_t)32ULL), x273, sizeof(uintptr_t)); /*skip*/ _br2_store((out2)+((uintptr_t)0ULL), x274, sizeof(uintptr_t)); _br2_store((out2)+((uintptr_t)8ULL), x275, sizeof(uintptr_t)); _br2_store((out2)+((uintptr_t)16ULL), x276, sizeof(uintptr_t)); _br2_store((out2)+((uintptr_t)24ULL), x277, sizeof(uintptr_t)); _br2_store((out2)+((uintptr_t)32ULL), x278, sizeof(uintptr_t)); /*skip*/ _br2_store((out3)+((uintptr_t)0ULL), x279, sizeof(uintptr_t)); _br2_store((out3)+((uintptr_t)8ULL), x280, sizeof(uintptr_t)); _br2_store((out3)+((uintptr_t)16ULL), x281, sizeof(uintptr_t)); _br2_store((out3)+((uintptr_t)24ULL), x282, sizeof(uintptr_t)); /*skip*/ _br2_store((out4)+((uintptr_t)0ULL), x283, sizeof(uintptr_t)); _br2_store((out4)+((uintptr_t)8ULL), x284, sizeof(uintptr_t)); _br2_store((out4)+((uintptr_t)16ULL), x285, sizeof(uintptr_t)); _br2_store((out4)+((uintptr_t)24ULL), x286, sizeof(uintptr_t)); /*skip*/ return out0; } /* NOTE: The following wrapper function is not covered by Coq proofs */ static void fiat_secp256k1_divstep(uint64_t* out1, uint64_t out2[5], uint64_t out3[5], uint64_t out4[4], uint64_t out5[4], uint64_t arg1, const uint64_t arg2[5], const uint64_t arg3[5], const uint64_t arg4[4], const uint64_t arg5[4]) { *out1 = (uint64_t)internal_fiat_secp256k1_divstep((uintptr_t)out2, (uintptr_t)out3, (uintptr_t)out4, (uintptr_t)out5, (uintptr_t)arg1, (uintptr_t)arg2, (uintptr_t)arg3, (uintptr_t)arg4, (uintptr_t)arg5); } /* * Input Bounds: * Output Bounds: * out0: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] */ static void internal_fiat_secp256k1_divstep_precomp(uintptr_t out0) { uintptr_t x0, x1, x2, x3; /*skip*/ x0 = (uintptr_t)17438399655968923146ULL; x1 = (uintptr_t)11048449041898966405ULL; x2 = (uintptr_t)16744428796223033513ULL; x3 = (uintptr_t)2664875547656468233ULL; /*skip*/ _br2_store((out0)+((uintptr_t)0ULL), x0, sizeof(uintptr_t)); _br2_store((out0)+((uintptr_t)8ULL), x1, sizeof(uintptr_t)); _br2_store((out0)+((uintptr_t)16ULL), x2, sizeof(uintptr_t)); _br2_store((out0)+((uintptr_t)24ULL), x3, sizeof(uintptr_t)); /*skip*/ return; } /* NOTE: The following wrapper function is not covered by Coq proofs */ static void fiat_secp256k1_divstep_precomp(uint64_t out1[4]) { internal_fiat_secp256k1_divstep_precomp((uintptr_t)out1); }
the_stack_data/65278.c
/* { dg-do compile } */ /* { dg-options "-fno-dse" } */ void bar(void); void foo (int i, ...) { __builtin_va_list ap; __builtin_va_start (ap, i); __builtin_va_arg (ap, int); while (i) i++; __builtin_va_arg (ap, int); while (i) i++; __builtin_va_arg (ap, int); while (i) i++; __builtin_va_arg (ap, int); if (i) bar (); }
the_stack_data/192329865.c
// %%cpp ub.c int main(int argc, char** argv) { return -argc << 31; // return (argc * (int)((1ull << 31) - 1)) + 1; }
the_stack_data/422290.c
//function to find greatest of 3 numbers #include <stdio.h> #include <stdlib.h> int large(int a,int b,int c) { if (a>b && a>c) printf("\n%d is largest \n",a); else if (b>c && b>a) printf("\n%d is largest \n",b); else printf("\n%d is largest \n",c); } int main() { int x,y,z; printf("\nEnter 1st number = "); scanf("%d",&x); printf("\nEnter 2nd number = "); scanf("%d",&y); printf("\nEnter 3rd number = "); scanf("%d",&z); large(x,y,z); }
the_stack_data/123945.c
/* * @(#)dir.c 1.4 87/11/06 Public Domain. * * A public domain implementation of BSD directory routines for * MS-DOS. Written by Michael Rendell ({uunet,utai}michael@garfield), * August 1987 * * Ported to OS/2 by Kai Uwe Rommel * Addition of other OS/2 file system specific code * Placed into the public domain */ /* does also contain EA access code for use in ZIP */ #ifdef OS2 #if defined(__EMX__) && !defined(__32BIT__) # define __32BIT__ #endif #include "zip.h" #include <stdlib.h> #include <time.h> #include <ctype.h> #ifndef __BORLANDC__ #include <malloc.h> #endif #define INCL_NOPM #define INCL_DOSNLS #define INCL_DOSERRORS #include <os2.h> #include "os2zip.h" #include "os2acl.h" #ifndef max #define max(a, b) ((a) < (b) ? (b) : (a)) #endif #ifdef __32BIT__ #define DosFindFirst(p1, p2, p3, p4, p5, p6) \ DosFindFirst(p1, p2, p3, p4, p5, p6, 1) #else #define DosQueryCurrentDisk DosQCurDisk #define DosQueryFSAttach(p1, p2, p3, p4, p5) \ DosQFSAttach(p1, p2, p3, p4, p5, 0) #define DosQueryFSInfo(d, l, b, s) \ DosQFSInfo(d, l, b, s) #define DosQueryPathInfo(p1, p2, p3, p4) \ DosQPathInfo(p1, p2, p3, p4, 0) #define DosSetPathInfo(p1, p2, p3, p4, p5) \ DosSetPathInfo(p1, p2, p3, p4, p5, 0) #define DosEnumAttribute(p1, p2, p3, p4, p5, p6, p7) \ DosEnumAttribute(p1, p2, p3, p4, p5, p6, p7, 0) #define DosFindFirst(p1, p2, p3, p4, p5, p6) \ DosFindFirst(p1, p2, p3, p4, p5, p6, 0) #define DosMapCase DosCaseMap #endif #ifndef UTIL #ifndef S_IFMT # define S_IFMT 0xF000 #endif #ifndef S_ISDIR # define S_ISDIR( m) (((m)& S_IFMT) == S_IFDIR) #endif static int attributes = _A_DIR | _A_HIDDEN | _A_SYSTEM; static char *getdirent(char *); static void free_dircontents(struct _dircontents *); #ifdef __32BIT__ static HDIR hdir; static ULONG count; static FILEFINDBUF3 find; #else static HDIR hdir; static USHORT count; static FILEFINDBUF find; #endif DIR *opendir(const char *name) { struct stat statb; DIR *dirp; char c; char *s; struct _dircontents *dp; char nbuf[MAXPATHLEN + 1]; int len; attributes = hidden_files ? (_A_DIR | _A_HIDDEN | _A_SYSTEM) : _A_DIR; strcpy(nbuf, name); if ((len = strlen(nbuf)) == 0) return NULL; if (((c = nbuf[len - 1]) == '\\' || c == '/') && (len > 1)) { nbuf[len - 1] = 0; --len; if (nbuf[len - 1] == ':') { strcpy(nbuf+len, "\\."); len += 2; } } else if (nbuf[len - 1] == ':') { strcpy(nbuf+len, "."); ++len; } #ifndef __BORLANDC__ /* when will we ever see a Borland compiler that can properly stat !!! */ if (stat(nbuf, &statb) < 0 || (!S_ISDIR( statb.st_mode)) return NULL; #endif if ((dirp = malloc(sizeof(DIR))) == NULL) return NULL; if (nbuf[len - 1] == '.' && (len == 1 || nbuf[len - 2] != '.')) strcpy(nbuf+len-1, "*.*"); else if (((c = nbuf[len - 1]) == '\\' || c == '/') && (len == 1)) strcpy(nbuf+len, "*"); else strcpy(nbuf+len, "\\*"); /* len is no longer correct (but no longer needed) */ dirp -> dd_loc = 0; dirp -> dd_contents = dirp -> dd_cp = NULL; if ((s = getdirent(nbuf)) == NULL) return dirp; do { if (((dp = malloc(sizeof(struct _dircontents))) == NULL) || ((dp -> _d_entry = malloc(strlen(s) + 1)) == NULL) ) { if (dp) free(dp); free_dircontents(dirp -> dd_contents); return NULL; } if (dirp -> dd_contents) { dirp -> dd_cp -> _d_next = dp; dirp -> dd_cp = dirp -> dd_cp -> _d_next; } else dirp -> dd_contents = dirp -> dd_cp = dp; strcpy(dp -> _d_entry, s); dp -> _d_next = NULL; dp -> _d_size = find.cbFile; dp -> _d_mode = find.attrFile; dp -> _d_time = *(unsigned *) &(find.ftimeLastWrite); dp -> _d_date = *(unsigned *) &(find.fdateLastWrite); } while ((s = getdirent(NULL)) != NULL); dirp -> dd_cp = dirp -> dd_contents; return dirp; } void closedir(DIR * dirp) { free_dircontents(dirp -> dd_contents); free(dirp); } struct dirent *readdir(DIR * dirp) { static struct dirent dp; if (dirp -> dd_cp == NULL) return NULL; dp.d_namlen = dp.d_reclen = strlen(strcpy(dp.d_name, dirp -> dd_cp -> _d_entry)); dp.d_ino = 0; dp.d_size = dirp -> dd_cp -> _d_size; dp.d_mode = dirp -> dd_cp -> _d_mode; dp.d_time = dirp -> dd_cp -> _d_time; dp.d_date = dirp -> dd_cp -> _d_date; dirp -> dd_cp = dirp -> dd_cp -> _d_next; dirp -> dd_loc++; return &dp; } void seekdir(DIR * dirp, long off) { long i = off; struct _dircontents *dp; if (off >= 0) { for (dp = dirp -> dd_contents; --i >= 0 && dp; dp = dp -> _d_next); dirp -> dd_loc = off - (i + 1); dirp -> dd_cp = dp; } } long telldir(DIR * dirp) { return dirp -> dd_loc; } static void free_dircontents(struct _dircontents * dp) { struct _dircontents *odp; while (dp) { if (dp -> _d_entry) free(dp -> _d_entry); dp = (odp = dp) -> _d_next; free(odp); } } static char *getdirent(char *dir) { int done; static int lower; if (dir != NULL) { /* get first entry */ hdir = HDIR_SYSTEM; count = 1; done = DosFindFirst(dir, &hdir, attributes, &find, sizeof(find), &count); lower = IsFileSystemFAT(dir); } else /* get next entry */ done = DosFindNext(hdir, &find, sizeof(find), &count); if (done == 0) { if (lower) StringLower(find.achName); return find.achName; } else { DosFindClose(hdir); return NULL; } } /* FAT / HPFS detection */ int IsFileSystemFAT(char *dir) { static USHORT nLastDrive = -1, nResult; ULONG lMap; BYTE bData[64]; char bName[3]; #ifdef __32BIT__ ULONG nDrive, cbData; PFSQBUFFER2 pData = (PFSQBUFFER2) bData; #else USHORT nDrive, cbData; PFSQBUFFER pData = (PFSQBUFFER) bData; #endif /* We separate FAT and HPFS+other file systems here. at the moment I consider other systems to be similar to HPFS, i.e. support long file names and being case sensitive */ if (isalpha(dir[0]) && (dir[1] == ':')) nDrive = to_up(dir[0]) - '@'; else DosQueryCurrentDisk(&nDrive, &lMap); if (nDrive == nLastDrive) return nResult; bName[0] = (char) (nDrive + '@'); bName[1] = ':'; bName[2] = 0; nLastDrive = nDrive; cbData = sizeof(bData); if (!DosQueryFSAttach(bName, 0, FSAIL_QUERYNAME, (PVOID) pData, &cbData)) nResult = !strcmp((char *) pData -> szFSDName + pData -> cbName, "FAT"); else nResult = FALSE; /* End of this ugly code */ return nResult; } /* access mode bits and time stamp */ int GetFileMode(char *name) { #ifdef __32BIT__ FILESTATUS3 fs; return DosQueryPathInfo(name, 1, &fs, sizeof(fs)) ? -1 : fs.attrFile; #else USHORT mode; return DosQFileMode(name, &mode, 0L) ? -1 : mode; #endif } ulg GetFileTime(char *name) { #ifdef __32BIT__ FILESTATUS3 fs; #else FILESTATUS fs; #endif USHORT nDate, nTime; DATETIME dtCurrent; if (strcmp(name, "-") == 0) { DosGetDateTime(&dtCurrent); fs.fdateLastWrite.day = dtCurrent.day; fs.fdateLastWrite.month = dtCurrent.month; fs.fdateLastWrite.year = dtCurrent.year - 1980; fs.ftimeLastWrite.hours = dtCurrent.hours; fs.ftimeLastWrite.minutes = dtCurrent.minutes; fs.ftimeLastWrite.twosecs = dtCurrent.seconds / 2; } else if (DosQueryPathInfo(name, 1, (PBYTE) &fs, sizeof(fs))) return -1; nDate = * (USHORT *) &fs.fdateLastWrite; nTime = * (USHORT *) &fs.ftimeLastWrite; return ((ULONG) nDate) << 16 | nTime; } void SetFileTime(char *path, ulg stamp) { FILESTATUS fs; USHORT fd, ft; if (DosQueryPathInfo(path, FIL_STANDARD, (PBYTE) &fs, sizeof(fs))) return; fd = (USHORT) (stamp >> 16); ft = (USHORT) stamp; fs.fdateLastWrite = fs.fdateCreation = * (FDATE *) &fd; fs.ftimeLastWrite = fs.ftimeCreation = * (FTIME *) &ft; DosSetPathInfo(path, FIL_STANDARD, (PBYTE) &fs, sizeof(fs), 0); } /* read volume label */ char *getVolumeLabel(int drive, unsigned long *vtime, unsigned long *vmode, time_t *utim) { static FSINFO fi; if (DosQueryFSInfo(drive ? drive - 'A' + 1 : 0, FSIL_VOLSER, (PBYTE) &fi, sizeof(fi))) return NULL; time(utim); *vtime = unix2dostime(utim); *vmode = _A_VOLID | _A_ARCHIVE; return (fi.vol.cch > 0) ? fi.vol.szVolLabel : NULL; } /* FAT / HPFS name conversion stuff */ int IsFileNameValid(char *name) { HFILE hf; #ifdef __32BIT__ ULONG uAction; #else USHORT uAction; #endif switch(DosOpen(name, &hf, &uAction, 0, 0, FILE_OPEN, OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE, 0)) { case ERROR_INVALID_NAME: case ERROR_FILENAME_EXCED_RANGE: return FALSE; case NO_ERROR: DosClose(hf); default: return TRUE; } } void ChangeNameForFAT(char *name) { char *src, *dst, *next, *ptr, *dot, *start; static char invalid[] = ":;,=+\"[]<>| \t"; if (isalpha(name[0]) && (name[1] == ':')) start = name + 2; else start = name; src = dst = start; if ((*src == '/') || (*src == '\\')) src++, dst++; while (*src) { for (next = src; *next && (*next != '/') && (*next != '\\'); next++); for (ptr = src, dot = NULL; ptr < next; ptr++) if (*ptr == '.') { dot = ptr; /* remember last dot */ *ptr = '_'; } if (dot == NULL) for (ptr = src; ptr < next; ptr++) if (*ptr == '_') dot = ptr; /* remember last _ as if it were a dot */ if (dot && (dot > src) && ((next - dot <= 4) || ((next - src > 8) && (dot - src > 3)))) { if (dot) *dot = '.'; for (ptr = src; (ptr < dot) && ((ptr - src) < 8); ptr++) *dst++ = *ptr; for (ptr = dot; (ptr < next) && ((ptr - dot) < 4); ptr++) *dst++ = *ptr; } else { if (dot && (next - src == 1)) *dot = '.'; /* special case: "." as a path component */ for (ptr = src; (ptr < next) && ((ptr - src) < 8); ptr++) *dst++ = *ptr; } *dst++ = *next; /* either '/' or 0 */ if (*next) { src = next + 1; if (*src == 0) /* handle trailing '/' on dirs ! */ *dst = 0; } else break; } for (src = start; *src != 0; ++src) if ((strchr(invalid, *src) != NULL) || (*src == ' ')) *src = '_'; } /* .LONGNAME EA code */ typedef struct { ULONG cbList; /* length of value + 22 */ #ifdef __32BIT__ ULONG oNext; #endif BYTE fEA; /* 0 */ BYTE cbName; /* length of ".LONGNAME" = 9 */ USHORT cbValue; /* length of value + 4 */ BYTE szName[10]; /* ".LONGNAME" */ USHORT eaType; /* 0xFFFD for length-preceded ASCII */ USHORT eaSize; /* length of value */ BYTE szValue[CCHMAXPATH]; } FEALST; typedef struct { ULONG cbList; #ifdef __32BIT__ ULONG oNext; #endif BYTE cbName; BYTE szName[10]; /* ".LONGNAME" */ } GEALST; char *GetLongNameEA(const char *name) { EAOP eaop; GEALST gealst; static FEALST fealst; char *ptr; eaop.fpGEAList = (PGEALIST) &gealst; eaop.fpFEAList = (PFEALIST) &fealst; eaop.oError = 0; strcpy((char *) gealst.szName, ".LONGNAME"); gealst.cbName = (BYTE) strlen((char *) gealst.szName); #ifdef __32BIT__ gealst.oNext = 0; #endif gealst.cbList = sizeof(gealst); fealst.cbList = sizeof(fealst); if (DosQueryPathInfo(name, FIL_QUERYEASFROMLIST, (PBYTE) &eaop, sizeof(eaop))) return NULL; if (fealst.cbValue > 4 && fealst.eaType == 0xFFFD) { fealst.szValue[fealst.eaSize] = 0; for (ptr = fealst.szValue; *ptr; ptr++) if (*ptr == '/' || *ptr == '\\') *ptr = '!'; return (char *) fealst.szValue; } return NULL; } char *GetLongPathEA(const char *name) { static char nbuf[CCHMAXPATH + 1]; char tempbuf[CCHMAXPATH + 1]; char *comp, *next, *ea, sep; BOOL bFound = FALSE; nbuf[0] = 0; strncpy(tempbuf, name, CCHMAXPATH); tempbuf[CCHMAXPATH] = '\0'; next = tempbuf; while (*next) { comp = next; while (*next != '\\' && *next != '/' && *next != 0) next++; sep = *next; *next = 0; ea = GetLongNameEA(tempbuf); strcat(nbuf, ea ? ea : comp); bFound = bFound || (ea != NULL); if (sep) { strcat(nbuf, "\\"); *next++ = sep; } } return (nbuf[0] != 0) && bFound ? nbuf : NULL; } /* general EA code */ typedef struct { USHORT nID; USHORT nSize; ULONG lSize; } EFHEADER, *PEFHEADER; #ifdef __32BIT__ /* Perhaps due to bugs in the current OS/2 2.0 kernel, the success or failure of the DosEnumAttribute() and DosQueryPathInfo() system calls depends on the area where the return buffers are allocated. This differs for the various compilers, for some alloca() works, for some malloc() works, for some, both work. We'll have to live with that. */ /* The use of malloc() is not very convenient, because it requires backtracking (i.e. free()) at error returns. We do that for system calls that may fail, but not for malloc() calls, because they are VERY unlikely to fail. If ever, we just leave some memory allocated over the usually short lifetime of a zip process ... */ #ifdef __GNUC__ #define alloc(x) alloca(x) #define unalloc(x) #else #define alloc(x) malloc(x) #define unalloc(x) free(x) #endif void GetEAs(char *path, char **bufptr, size_t *size, char **cbufptr, size_t *csize) { FILESTATUS4 fs; PDENA2 pDENA, pFound; EAOP2 eaop; PGEA2 pGEA; PGEA2LIST pGEAlist; PFEA2LIST pFEAlist; PEFHEADER pEAblock; ULONG ulAttributes, ulMemoryBlock; ULONG nLength; ULONG nBlock; char szName[CCHMAXPATH]; *size = *csize = 0; strcpy(szName, path); nLength = strlen(szName); if (szName[nLength - 1] == '/') szName[nLength - 1] = 0; if (DosQueryPathInfo(szName, FIL_QUERYEASIZE, (PBYTE) &fs, sizeof(fs))) return; nBlock = max(fs.cbList, 65535); if ((pDENA = alloc((size_t) nBlock)) == NULL) return; ulAttributes = -1; if (DosEnumAttribute(ENUMEA_REFTYPE_PATH, szName, 1, pDENA, nBlock, &ulAttributes, ENUMEA_LEVEL_NO_VALUE) || ulAttributes == 0 || (pGEAlist = alloc((size_t) nBlock)) == NULL) { unalloc(pDENA); return; } pGEA = pGEAlist -> list; memset(pGEAlist, 0, nBlock); pFound = pDENA; while (ulAttributes--) { if (!(strcmp(pFound -> szName, ".LONGNAME") == 0 && use_longname_ea)) { pGEA -> cbName = pFound -> cbName; strcpy(pGEA -> szName, pFound -> szName); nLength = sizeof(GEA2) + strlen(pGEA -> szName); nLength = ((nLength - 1) / sizeof(ULONG) + 1) * sizeof(ULONG); pGEA -> oNextEntryOffset = ulAttributes ? nLength : 0; pGEA = (PGEA2) ((PCH) pGEA + nLength); } pFound = (PDENA2) ((PCH) pFound + pFound -> oNextEntryOffset); } if (pGEA == pGEAlist -> list) /* no attributes to save */ { unalloc(pDENA); unalloc(pGEAlist); return; } pGEAlist -> cbList = (PCH) pGEA - (PCH) pGEAlist; pFEAlist = (PVOID) pDENA; /* reuse buffer */ pFEAlist -> cbList = nBlock; eaop.fpGEA2List = pGEAlist; eaop.fpFEA2List = pFEAlist; eaop.oError = 0; if (DosQueryPathInfo(szName, FIL_QUERYEASFROMLIST, (PBYTE) &eaop, sizeof(eaop))) { unalloc(pDENA); unalloc(pGEAlist); return; } /* The maximum compressed size is (in case of STORE type) the uncompressed size plus the size of the compression type field plus the size of the CRC field + 2*5 deflate overhead bytes for uncompressable data. (5 bytes per 32Kb block, max compressed size = 2 blocks) */ ulAttributes = pFEAlist -> cbList; ulMemoryBlock = ulAttributes + sizeof(USHORT) + sizeof(ULONG) + EB_DEFLAT_EXTRA; pEAblock = (PEFHEADER) malloc(sizeof(EFHEADER) + ulMemoryBlock); if (pEAblock == NULL) { unalloc(pDENA); unalloc(pGEAlist); return; } *bufptr = (char *) pEAblock; *size = sizeof(EFHEADER); pEAblock -> nID = EF_OS2EA; pEAblock -> nSize = sizeof(pEAblock -> lSize); pEAblock -> lSize = ulAttributes; /* uncompressed size */ nLength = memcompress((char *) (pEAblock + 1), ulMemoryBlock, (char *) pFEAlist, ulAttributes); *size += nLength; pEAblock -> nSize += nLength; if ((pEAblock = (PEFHEADER) malloc(sizeof(EFHEADER))) == NULL) { unalloc(pDENA); unalloc(pGEAlist); return; } *cbufptr = (char *) pEAblock; *csize = sizeof(EFHEADER); pEAblock -> nID = EF_OS2EA; pEAblock -> nSize = sizeof(pEAblock -> lSize); pEAblock -> lSize = ulAttributes; if (noisy) printf(" (%ld bytes EA's)", ulAttributes); unalloc(pDENA); unalloc(pGEAlist); } #else /* !__32BIT__ */ typedef struct { ULONG oNextEntryOffset; BYTE fEA; BYTE cbName; USHORT cbValue; CHAR szName[1]; } FEA2, *PFEA2; typedef struct { ULONG cbList; FEA2 list[1]; } FEA2LIST, *PFEA2LIST; void GetEAs(char *path, char **bufptr, size_t *size, char **cbufptr, size_t *csize) { FILESTATUS2 fs; PDENA1 pDENA, pFound; EAOP eaop; PGEALIST pGEAlist; PGEA pGEA; PFEALIST pFEAlist; PFEA pFEA; PFEA2LIST pFEA2list; PFEA2 pFEA2; EFHEADER *pEAblock; ULONG ulAttributes; USHORT nLength, nMaxSize; char szName[CCHMAXPATH]; *size = *csize = 0; strcpy(szName, path); nLength = strlen(szName); if (szName[nLength - 1] == '/') szName[nLength - 1] = 0; if (DosQueryPathInfo(szName, FIL_QUERYEASIZE, (PBYTE) &fs, sizeof(fs)) || fs.cbList <= 2 * sizeof(ULONG)) return; ulAttributes = -1; nMaxSize = (USHORT) min(fs.cbList * 2, 65520L); if ((pDENA = malloc((size_t) nMaxSize)) == NULL) return; if (DosEnumAttribute(ENUMEA_REFTYPE_PATH, szName, 1, pDENA, fs.cbList, &ulAttributes, ENUMEA_LEVEL_NO_VALUE) || ulAttributes == 0 || (pGEAlist = malloc(nMaxSize)) == NULL) { free(pDENA); return; } pGEA = pGEAlist -> list; pFound = pDENA; while (ulAttributes--) { nLength = strlen(pFound -> szName); if (!(strcmp(pFound -> szName, ".LONGNAME") == 0 && use_longname_ea)) { pGEA -> cbName = pFound -> cbName; strcpy(pGEA -> szName, pFound -> szName); pGEA++; pGEA = (PGEA) (((PCH) pGEA) + nLength); } pFound++; pFound = (PDENA1) (((PCH) pFound) + nLength); } if (pGEA == pGEAlist -> list) { free(pDENA); free(pGEAlist); return; } pGEAlist -> cbList = (PCH) pGEA - (PCH) pGEAlist; pFEAlist = (PFEALIST) pDENA; /* reuse buffer */ pFEAlist -> cbList = fs.cbList; pFEA = pFEAlist -> list; eaop.fpGEAList = pGEAlist; eaop.fpFEAList = pFEAlist; eaop.oError = 0; if (DosQueryPathInfo(szName, FIL_QUERYEASFROMLIST, (PBYTE) &eaop, sizeof(eaop))) { free(pDENA); free(pGEAlist); return; } /* now convert into new OS/2 2.0 32-bit format */ pFEA2list = (PFEA2LIST) pGEAlist; /* reuse buffer */ pFEA2 = pFEA2list -> list; while ((PCH) pFEA - (PCH) pFEAlist < pFEAlist -> cbList) { nLength = sizeof(FEA) + pFEA -> cbName + 1 + pFEA -> cbValue; memcpy((PCH) pFEA2 + sizeof(pFEA2 -> oNextEntryOffset), pFEA, nLength); memset((PCH) pFEA2 + sizeof(pFEA2 -> oNextEntryOffset) + nLength, 0, 3); pFEA = (PFEA) ((PCH) pFEA + nLength); nLength = sizeof(FEA2) + pFEA2 -> cbName + 1 + pFEA2 -> cbValue; nLength = ((nLength - 1) / sizeof(ULONG) + 1) * sizeof(ULONG); /* rounded up to 4-byte boundary */ pFEA2 -> oNextEntryOffset = ((PCH) pFEA - (PCH) pFEAlist < pFEAlist -> cbList) ? nLength : 0; pFEA2 = (PFEA2) ((PCH) pFEA2 + nLength); } pFEA2list -> cbList = (PCH) pFEA2 - (PCH) pFEA2list; ulAttributes = pFEA2list -> cbList; pEAblock = (PEFHEADER) pDENA; /* reuse buffer */ *bufptr = (char *) pEAblock; *size = sizeof(EFHEADER); pEAblock -> nID = EF_OS2EA; pEAblock -> nSize = sizeof(pEAblock -> lSize); pEAblock -> lSize = ulAttributes; /* uncompressed size */ nLength = (USHORT) memcompress((char *) (pEAblock + 1), nMaxSize - sizeof(EFHEADER), (char *) pFEA2list, ulAttributes); *size += nLength; pEAblock -> nSize += nLength; pEAblock = (PEFHEADER) pGEAlist; *cbufptr = (char *) pEAblock; *csize = sizeof(EFHEADER); pEAblock -> nID = EF_OS2EA; pEAblock -> nSize = sizeof(pEAblock -> lSize); pEAblock -> lSize = ulAttributes; if (noisy) printf(" (%ld bytes EA's)", ulAttributes); } #endif /* __32BIT__ */ void GetACL(char *path, char **bufptr, size_t *size, char **cbufptr, size_t *csize) { static char *buffer; char *cbuffer; long bytes, cbytes; PEFHEADER pACLblock; if (buffer == NULL) /* avoid frequent allocation (for every file) */ if ((buffer = malloc(ACL_BUFFERSIZE)) == NULL) return; if (acl_get(NULL, path, buffer)) return; /* this will be the most likely case */ bytes = strlen(buffer); /* The maximum compressed size is (in case of STORE type) the uncompressed size plus the size of the compression type field plus the size of the CRC field + 2*5 deflate overhead bytes for uncompressable data. (5 bytes per 32Kb block, max compressed size = 2 blocks) */ cbytes = bytes + sizeof(USHORT) + sizeof(ULONG) + EB_DEFLAT_EXTRA; if ((*bufptr = realloc(*bufptr, *size + sizeof(EFHEADER) + cbytes)) == NULL) return; pACLblock = (PEFHEADER) (*bufptr + *size); cbuffer = (char *) (pACLblock + 1); cbytes = memcompress(cbuffer, cbytes, buffer, bytes); *size += sizeof(EFHEADER) + cbytes; pACLblock -> nID = EF_ACL; pACLblock -> nSize = sizeof(pACLblock -> lSize) + cbytes; pACLblock -> lSize = bytes; /* uncompressed size */ if ((*cbufptr = realloc(*cbufptr, *csize + sizeof(EFHEADER))) == NULL) return; pACLblock = (PEFHEADER) (*cbufptr + *csize); *csize += sizeof(EFHEADER); pACLblock -> nID = EF_ACL; pACLblock -> nSize = sizeof(pACLblock -> lSize); pACLblock -> lSize = bytes; if (noisy) printf(" (%ld bytes ACL)", bytes); } #ifdef USE_EF_UT_TIME int GetExtraTime(struct zlist far *z, iztimes *z_utim) { int eb_c_size = EB_HEADSIZE + EB_UT_LEN(1); int eb_l_size = eb_c_size; char *eb_c_ptr; char *eb_l_ptr; unsigned long ultime; #ifdef IZ_CHECK_TZ if (!zp_tz_is_valid) return ZE_OK; /* skip silently no correct tz info */ #endif eb_c_ptr = realloc(z->cextra, (z->cext + eb_c_size)); if (eb_c_ptr == NULL) return ZE_MEM; z->cextra = eb_c_ptr; eb_c_ptr += z->cext; z->cext += eb_c_size; eb_c_ptr[0] = 'U'; eb_c_ptr[1] = 'T'; eb_c_ptr[2] = EB_UT_LEN(1); /* length of data part of e.f. */ eb_c_ptr[3] = 0; eb_c_ptr[4] = EB_UT_FL_MTIME; ultime = (unsigned long) z_utim->mtime; eb_c_ptr[5] = (char)(ultime); eb_c_ptr[6] = (char)(ultime >> 8); eb_c_ptr[7] = (char)(ultime >> 16); eb_c_ptr[8] = (char)(ultime >> 24); if (z_utim->mtime != z_utim->atime || z_utim->mtime != z_utim->ctime) { eb_c_ptr[4] = EB_UT_FL_MTIME | EB_UT_FL_ATIME | EB_UT_FL_CTIME; eb_l_size = EB_HEADSIZE + EB_UT_LEN(3); /* only on HPFS they can differ */ /* so only then it makes sense to store all three time stamps */ } eb_l_ptr = realloc(z->extra, (z->ext + eb_l_size)); if (eb_l_ptr == NULL) return ZE_MEM; z->extra = eb_l_ptr; eb_l_ptr += z->ext; z->ext += eb_l_size; memcpy(eb_l_ptr, eb_c_ptr, eb_c_size); if (eb_l_size > eb_c_size) { eb_l_ptr[2] = EB_UT_LEN(3); ultime = (unsigned long) z_utim->atime; eb_l_ptr[9] = (char)(ultime); eb_l_ptr[10] = (char)(ultime >> 8); eb_l_ptr[11] = (char)(ultime >> 16); eb_l_ptr[12] = (char)(ultime >> 24); ultime = (unsigned long) z_utim->ctime; eb_l_ptr[13] = (char)(ultime); eb_l_ptr[14] = (char)(ultime >> 8); eb_l_ptr[15] = (char)(ultime >> 16); eb_l_ptr[16] = (char)(ultime >> 24); } return ZE_OK; } #endif /* USE_EF_UT_TIME */ int set_extra_field(struct zlist far *z, iztimes *z_utim) { /* store EA data in local header, and size only in central headers */ GetEAs(z->name, &z->extra, &z->ext, &z->cextra, &z->cext); /* store ACL data in local header, and size only in central headers */ GetACL(z->name, &z->extra, &z->ext, &z->cextra, &z->cext); #ifdef USE_EF_UT_TIME /* store extended time stamps in both headers */ return GetExtraTime(z, z_utim); #else /* !USE_EF_UT_TIME */ return ZE_OK; #endif /* ?USE_EF_UT_TIME */ } #endif /* !UTIL */ /* Initialize the table of uppercase characters including handling of country dependent characters. */ void init_upper() { COUNTRYCODE cc; unsigned nCnt, nU; for (nCnt = 0; nCnt < sizeof(upper); nCnt++) upper[nCnt] = lower[nCnt] = (unsigned char) nCnt; cc.country = cc.codepage = 0; DosMapCase(sizeof(upper), &cc, (PCHAR) upper); for (nCnt = 0; nCnt < 256; nCnt++) { nU = upper[nCnt]; if (nU != nCnt && lower[nU] == (unsigned char) nU) lower[nU] = (unsigned char) nCnt; } for (nCnt = 'A'; nCnt <= 'Z'; nCnt++) lower[nCnt] = (unsigned char) (nCnt - 'A' + 'a'); } char *StringLower(char *szArg) { unsigned char *szPtr; for (szPtr = (unsigned char *) szArg; *szPtr; szPtr++) *szPtr = lower[*szPtr]; return szArg; } #if defined(__IBMC__) && defined(__DEBUG_ALLOC__) void DebugMalloc(void) { _dump_allocated(0); /* print out debug malloc memory statistics */ } #endif /******************************/ /* Function version_local() */ /******************************/ void version_local() { static ZCONST char CompiledWith[] = "Compiled with %s%s for %s%s%s%s.\n\n"; #if defined(__IBMC__) || defined(__WATCOMC__) || defined(_MSC_VER) char buf[80]; #endif printf(CompiledWith, #ifdef __GNUC__ # ifdef __EMX__ /* __EMX__ is defined as "1" only (sigh) */ "emx+gcc ", __VERSION__, # else "gcc/2 ", __VERSION__, # endif #elif defined(__IBMC__) "IBM ", # if (__IBMC__ < 200) (sprintf(buf, "C Set/2 %d.%02d", __IBMC__/100,__IBMC__%100), buf), # elif (__IBMC__ < 300) (sprintf(buf, "C Set++ %d.%02d", __IBMC__/100,__IBMC__%100), buf), # else (sprintf(buf, "Visual Age C++ %d.%02d", __IBMC__/100,__IBMC__%100), buf), # endif #elif defined(__WATCOMC__) "Watcom C", (sprintf(buf, " (__WATCOMC__ = %d)", __WATCOMC__), buf), #elif defined(__TURBOC__) # ifdef __BORLANDC__ "Borland C++", # if (__BORLANDC__ < 0x0460) " 1.0", # elif (__BORLANDC__ == 0x0460) " 1.5", # else " 2.0", # endif # else "Turbo C", # if (__TURBOC__ >= 661) "++ 1.0 or later", # elif (__TURBOC__ == 661) " 3.0?", # elif (__TURBOC__ == 397) " 2.0", # else " 1.0 or 1.5?", # endif # endif #elif defined(MSC) "Microsoft C ", # ifdef _MSC_VER (sprintf(buf, "%d.%02d", _MSC_VER/100, _MSC_VER%100), buf), # else "5.1 or earlier", # endif #else "unknown compiler", "", #endif /* __GNUC__ */ "OS/2", /* GRR: does IBM C/2 identify itself as IBM rather than Microsoft? */ #if (defined(MSC) || (defined(__WATCOMC__) && !defined(__386__))) # if defined(M_I86HM) || defined(__HUGE__) " (16-bit, huge)", # elif defined(M_I86LM) || defined(__LARGE__) " (16-bit, large)", # elif defined(M_I86MM) || defined(__MEDIUM__) " (16-bit, medium)", # elif defined(M_I86CM) || defined(__COMPACT__) " (16-bit, compact)", # elif defined(M_I86SM) || defined(__SMALL__) " (16-bit, small)", # elif defined(M_I86TM) || defined(__TINY__) " (16-bit, tiny)", # else " (16-bit)", # endif #else " 2.x/3.x (32-bit)", #endif #if defined( __DATE__) && !defined( NO_BUILD_DATE) " on ", __DATE__ #else "", "" #endif ); /* temporary debugging code for Borland compilers only */ #ifdef __TURBOC__ printf("\t(__TURBOC__ = 0x%04x = %d)\n", __TURBOC__, __TURBOC__); #ifdef __BORLANDC__ printf("\t(__BORLANDC__ = 0x%04x)\n",__BORLANDC__); #else printf("\tdebug(__BORLANDC__ not defined)\n"); #endif #ifdef __TCPLUSPLUS__ printf("\t(__TCPLUSPLUS__ = 0x%04x)\n", __TCPLUSPLUS__); #else printf("\tdebug(__TCPLUSPLUS__ not defined)\n"); #endif #ifdef __BCPLUSPLUS__ printf("\t(__BCPLUSPLUS__ = 0x%04x)\n\n", __BCPLUSPLUS__); #else printf("\tdebug(__BCPLUSPLUS__ not defined)\n\n"); #endif #endif /* __TURBOC__ */ } /* end function version_local() */ #endif /* OS2 */
the_stack_data/898253.c
#include <stddef.h> #include <stdint.h> #ifdef VMWOS #include "syscalls.h" #include "vlibc.h" #include "vmwos.h" #else #include <stdio.h> #include <errno.h> #include <string.h> #include <fcntl.h> #include <unistd.h> #endif #define BUF_SIZE 128 static int cat(int in_fd, int out_fd) { char buffer[BUF_SIZE]; int result; while(1) { result=read(in_fd,buffer,BUF_SIZE); if (result<=0) break; result=write(out_fd,buffer,result); if (result<=0) break; } return 0; } int main(int argc, char **argv) { int i; int input_fd; int output_fd=1; /* stdout */ if (argc<2) { input_fd=0; /* stdin */ cat(input_fd,output_fd); } else { for(i=1;i<argc;i++) { input_fd=open(argv[i],O_RDONLY,0); if (input_fd<0) { printf("Error opening %s\n",argv[i]); return -1; } cat(input_fd,output_fd); close(input_fd); } } return 0; }
the_stack_data/70449399.c
int x = 0; void foo() { if (1) { return; } else { return; } } int main(int argc, char * argv[]) { do { } while (2); x++; int i; for (i = 0; i < 10; i++) { } // foo(); // return; // int i; // i = 10; //#pragma omp master // { // int i; // i++; // } // foo(); // l1: l2: 55+i; // 50+3; //#pragma omp for // for (i = 0; i < 10; i++) { // int x; //// if (1) { // x + 13; // continue; //// } // } // // l1: 33; // if (1) { // int x; // x + 11; // } // if (2) { // int x; // x + 12; // } else { // int x; // x + 13; // } // if (1) { // int x; // x+1; // return 1; // } // l1: l2: 31; // 32; // 33; // int x; // if (11) { // } //#pragma omp task if (1) final(1) // { // // } // if (51) { // // } else { // // } // int k; while (k) { } while (1) { int x; x + 3; continue; } while (1) { if (1) { continue; } else { break; } } while (0) { 13; } while (1) { break; } // switch(i) { // case 1: // 11; // break; // } // switch (i) { // case 1: // 11; // int x; // x + 3; // break; // case 2: // break; // } // switch (i) { // case 1: // 11; // int x; // x + 3; // case 2: // break; // } // switch (i) { // case 1: // 11; // int x; // x + 3; // break; // default: // break; // } // switch (i) { // case 1: // 11; // int x; // x + 3; // break; // default: // ; // } // if (1) { // goto l1; // } else if (2){ // goto l2; // } // int j = 10; // do { // int x; // x + 33; // continue; // } while (j++ < 10); //#pragma omp parallel //#pragma omp for // for (j = 0; j< 10; j++) { // continue; // } // do { // int x; // x+3; // if (1) { // break; // } else if (2) { // continue; // } else if (3) { // int x; // x+13; // continue; // } // } while (x); // while (x) { // if (1) { // break; // } else if (2) { // continue; // } else if (3) { // continue; // } // } // // for (i = 0; i < 10; i++) { // int x; // x + 2; // continue; // } // for (i = 0; i < 10;) { // if (1) { // if (11) { // int x; // x + 3; // } // continue; // } // if (12) { //// if (11) { // int i; // i + 3; //// } // continue; // } //// if (1) { //// int x; //// x + 333; //// continue; //// } else if (2) { //// int x; //// x + 3; //// break; //// } // } // for (i = 0; i < 10; i++) { // int i; // i++; // if (1) { // break; // } else if (2) { // int x; // x + 3; // continue; // } else if (3) { // continue; // } // 111; // } // // for (; i < 10; i++) { // if (1) { // break; // } else if (2) { // continue; // } else if (3) { // continue; // } // 111; // } // // for (; i < 10;) { // int x; // x + 3; // if (1) { // break; // } else if (2) { // continue; // } else if (3) { // continue; // } // 111; // } // // for (i = 0; i < 10; i++) { // if (1) { // break; // } else if (2) { // continue; // } else if (3) { // continue; // } // 111; // } // // do { // 8; // } while (7); //#pragma omp parallel num_threads(1) // { // int x = 0; // 31+x; // } // //#pragma omp parallel // { //#pragma omp single // { // int x; // x+31; // } // //#pragma omp task if (1) // { // int x; // x+41; // } // //#pragma omp master // { // int x; // x+61; // } // //#pragma omp critical // { // int x; // x+51; // } // //#pragma omp atomic write // x = 61; // //#pragma omp ordered // { // int x; // x+71; // } // } // //#pragma omp parallel // { //#pragma omp sections // { //#pragma omp section // { // int x; // x+31; // } //#pragma omp section // { // int x; // x+41; // } // } // } ////////////////////////// //#pragma omp parallel // { //#pragma omp for // for (i = 0; i < 8; i++) { // 111; // if (1) { // continue; // } //// if (1) { //// break; //// } else if (2) { //// continue; //// } else if (3) { //// continue; //// } // } // } //////////////////////// // //#pragma omp parallel // { // 3; // } }
the_stack_data/6387825.c
/* Verify whether math functions are simplified. */ double sin(double); double floor(double); float t(float a) { return sin(a); } float q(float a) { return floor(a); } double q1(float a) { return floor(a); } main() { #ifdef __OPTIMIZE__ if (t(0)!=0) abort (); if (q(0)!=0) abort (); if (q1(0)!=0) abort (); #endif return 0; } __attribute__ ((noinline)) double floor(double a) { abort (); } __attribute__ ((noinline)) float floorf(float a) { return a; } __attribute__ ((noinline)) double sin(double a) { abort (); } __attribute__ ((noinline)) float sinf(float a) { return a; }
the_stack_data/614844.c
#include <stdio.h> int main(void) { int A,B,C,D; scanf("%d %d %d %d",&A,&B,&C,&D); if(B > C && D > A && (C + D > A + B) && C > 0 && D > 0 && A % 2 == 0){ printf("Valores aceitos\n"); }else{ printf("Valores nao aceitos\n"); } return 0; }
the_stack_data/5575.c
#include <stdio.h> void subsetSum(int set[], int subSet[], int n, int subSize, int total, int nodeCount ,int sum) { int i; if(total==sum && subSize >1) { printf("\n"); for(i = 0; i < subSize; i++) printf(" %d",subSet[i]); subsetSum(set,subSet,n,subSize-1,total-set[nodeCount],nodeCount+1,sum); //for other subsets return; } else { for(i=nodeCount; i < n; i++ ) { //find node along breadth subSet[subSize] = set[i]; subsetSum(set,subSet,n,subSize+1,total+set[i],i+1,sum); //do for next node in depth } } } void main() { int weights[50], size, sum,i,n; int subSet[50]; //create subset array to pass parameter of subsetSum printf("\n Enter the sum : "); scanf("%d",&sum); printf("\n Enter the no. of elements: "); scanf("%d",&n); printf("\n Enter the of elements: "); for(i=0;i<n;i++) scanf("%d",&weights[i]); subsetSum(weights, subSet, n, 0, 0, 0, sum); }
the_stack_data/68887376.c
//Classification: n/DAM/NP/aS/D(v)/fr/rp //Written by: Sergey Pomelov //Reviewed by: Igor Eremeev //Comment: #include <stdio.h> int *func(void) { int *p = NULL; return p; }; int main(void) { int a; int i; for(i=1; i<100; i++) { a = *func(); printf("%d",a); } return 0; }
the_stack_data/51699044.c
#include <stdio.h> #include <assert.h> int mainQ(int a){ float x,s; int r; x = (double)a; r = 1; s = 3.25; while (1){ //%%%traces: int a, double x, int r, double s if(!(x-s > 0.0)) break; //assert(((int)(4*r*r*r - 6*r*r + 3*r) + (int)(4*x - 4*a)) == 1); //assert((int)(4*s) -12*r*r == 1); x = x - s; s = s + 6 * r + 3; r = r + 1; } return r; } int main(int argc, char **argv){ mainQ(atoi(argv[1])); return 0; }
the_stack_data/512767.c
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/types.h> #include <string.h> #include <sys/stat.h> int main() { int fd[2]; int ret = pipe(fd); if(ret == -1){ perror("pipe"); exit(1); } pid_t pid = fork(); if(pid == -1){ perror("fork"); exit(1); } //父进程 ps aux //子进程 grep "bush" if(pid > 0){ //写管道操作,关闭读端 close(fd[0]); //重定向,STDOUT -> 管道的写端 dup2(fd[1], STDOUT_FILENO); //执行ps aux execlp("ps", "ps", "aux", NULL); perror("execlp"); exit(1); } else if(pid == 0){ close(fd[1]); dup2(fd[0], STDIN_FILENO); execlp("grep", "grep", "bash", "--color=auto", NULL); perror("execlp"); exit(1); } printf("pipe[0] = %d\n", fd[0]); printf("pipe[1] = %d\n", fd[1]); close(fd[0]); close(fd[1]); return 0; }
the_stack_data/12976.c
#include <string.h> void* memcpy(void* dstptr, const void* srcptr, size_t size) { unsigned char* dst = (unsigned char*) dstptr; const unsigned char* src = (const unsigned char*) srcptr; for (size_t i = 0; i < size; i++) { dst[i] = src[i]; } return dstptr; }
the_stack_data/72012421.c
/* * Copyright (C) 2015-2018 Alibaba Group Holding Limited */ #ifdef DEV_OFFLINE_OTA_ENABLE #include <stdio.h> #include <string.h> #include "iot_export.h" #include "dev_diagnosis_log.h" #include "dev_offline_ota.h" #include "awss_cmp.h" #include "awss_packet.h" #include "awss_log.h" #include "json_parser.h" #define DEFAULT_NOTIFY_PORT (5683) #define DEFAULT_NOTIFY_HOST "255.255.255.255" static platform_netaddr_t g_networkaddr; static void* g_ota_service_ctx = NULL; static OFFLINE_OTA_UPGRADE_CB g_offline_upgrate_callback = NULL; static char topic[TOPIC_LEN_MAX]; static char resp_data[DEV_OFFLINE_OTA_TOPIC_RSP_MAX_LEN]; void dev_offline_ota_module_init(void* ota_service_ctx,OFFLINE_OTA_UPGRADE_CB cb) { g_ota_service_ctx = ota_service_ctx; g_offline_upgrate_callback = cb; memset(&g_networkaddr, 0, sizeof(platform_netaddr_t)); memcpy(g_networkaddr.host, DEFAULT_NOTIFY_HOST, strlen(DEFAULT_NOTIFY_HOST)); g_networkaddr.port = DEFAULT_NOTIFY_PORT; memset(topic, 0, sizeof(char)*TOPIC_LEN_MAX); memset(resp_data, 0, sizeof(char)*DEV_OFFLINE_OTA_TOPIC_RSP_MAX_LEN); } static int dev_offline_ota_resp(void *context, int result, void *userdata, void *remote, void *message) { if (result == 2) { /* success */ awss_trace("dev offline ota resp/notify sucess\r\n"); } else { awss_trace("dev offline ota resp/notify failed\r\n"); } return 0; } static void prepare_resp_payload(int resp_code,char* id) { memset(topic, 0, sizeof(char)*TOPIC_LEN_MAX); memset(resp_data, 0, sizeof(char)*DEV_OFFLINE_OTA_TOPIC_RSP_MAX_LEN); int data_len = 0; resp_data[0] = '{'; data_len++; data_len += snprintf((char*)resp_data + data_len, DEV_OFFLINE_OTA_TOPIC_RSP_MAX_LEN - 2, DEV_OFFLINE_OTA_TOPIC_RSP_FMT, id, resp_code); resp_data[strlen(resp_data)] = '}'; resp_data[DEV_OFFLINE_OTA_TOPIC_RSP_MAX_LEN - 1] = '\0'; awss_trace("Sending offline ota Resp to app: %s", resp_data); } int wifimgr_process_dev_offline_ota_request(void *ctx, void *resource, void *remote, void *request) { int str_len = 0; int len = 0; char req_msg_id[MSG_REQ_ID_LEN] = {0}; char *str = NULL; char *str_data = NULL; char *json = NULL; int resp_code = 0; if(AWSS_STATE_START != dev_awss_state_get(AWSS_PATTERN_DEV_AP_CONFIG)) return -1; // Parse request from peer dev, to confirm request format correct json = awss_cmp_get_coap_payload(request, &len); str = (char*)json_get_value_by_name(json, len, "id", &str_len, (int*)NULL); if (str != NULL) memcpy(req_msg_id, str, str_len > MSG_REQ_ID_LEN - 1 ? MSG_REQ_ID_LEN - 1 : str_len); awss_trace("dev offline ota, len:%u, %s, req_msg_id(%s)\r\n", len, json, req_msg_id); str_data = (char*)json_get_value_by_name(json, len, "params", &str_len, (int*)NULL); if (str_data == NULL) { awss_err("dev offline ota json data parse fail!\r\n"); return -1; } awss_trace("dev offline ota rec request from app\r\n"); //save ip and port g_networkaddr = *(platform_netaddr_t*)remote; /*callback to upgrate*/ resp_code = g_offline_upgrate_callback(g_ota_service_ctx, json); //prepare resp and send prepare_resp_payload(resp_code,req_msg_id); awss_build_topic((const char *)TOPIC_DEV_OFFLINE_OTA_REPLY, topic, TOPIC_LEN_MAX); awss_trace("dev offline ota resp topic:%s\r\n",topic); //send uint16_t msgid = -1; int result = awss_cmp_coap_send_resp(resp_data, strlen(resp_data), remote, topic, request, dev_offline_ota_resp, &msgid, 1); (void)result; /* remove complier warnings */ awss_trace("coap send resp %s.", result == 0 ? "success" : "fail"); return 0; } int dev_notify_offline_ota_result(int resp_code) { awss_trace("dev offline ota sending notify,code=%d.\r\n",resp_code); //prepare resp and send prepare_resp_payload(resp_code,"123456"); awss_build_topic((const char *)TOPIC_DEV_OFFLINE_OTA_FINISH_NOTIFY, topic, TOPIC_LEN_MAX); awss_trace("dev offline ota notify topic:%s\r\n",topic); //send uint16_t msgid = -1; int result = awss_cmp_coap_send(resp_data, strlen(resp_data), &g_networkaddr, topic, dev_offline_ota_resp, &msgid); (void)result; /* remove complier warnings */ awss_info("coap send notify %s", result == 0 ? "success" : "fail"); return 0; } #endif
the_stack_data/7826.c
/* $OpenBSD: wmemmove.c,v 1.3 2005/08/08 08:05:37 espie Exp $ */ /* $NetBSD: wmemmove.c,v 1.2 2001/01/03 14:29:37 lukem Exp $ */ /*- * Copyright (c)1999 Citrus Project, * All rights reserved. * * 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. * * citrus Id: wmemmove.c,v 1.2 2000/12/20 14:08:31 itojun Exp */ #include <string.h> #include <wchar.h> wchar_t * wmemmove(wchar_t *d, const wchar_t *s, size_t n) { return (wchar_t *)memmove(d, s, n * sizeof(wchar_t)); }
the_stack_data/330984.c
#include <stdio.h> #include <ctype.h> int main(void) { int ch; while ((ch = getchar()) != EOF) { putchar(toupper(ch)); } return 0; }
the_stack_data/211079931.c
/** * @authors Moe_Sakiya [email protected] * @date 2017-10-11 17:16:38 * #滑稽 试试新东西 */ #include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> int main(void) { struct tv { //开始时间 int tis; //结束时间 int tie; //花费时间 int sti; }; struct tv play[100]; struct tv tmp; int line, i, j, time, watch; while (scanf("%d", &line) != EOF) { //输入结束 if (line == 0) { return 0; } //循环读入 for (i = 0; i < line; i++) { scanf("%d %d", &play[i].tis, &play[i].tie); play[i].sti = play[i].tie - play[i].tis; } //排序 结束时间由低到高排列 for (i = 0; i < line - 1; i++) { for (j = 0; j < line - 1; j++) { if (play[j].tie > play[j + 1].tie) { tmp = play[j]; play[j] = play[j + 1]; play[j + 1] = tmp; } } } //调试输出 // for (i = 0; i < line; i++) // { // printf("%d %d %d\n", play[i].tis, play[i].tie, play[i].sti ); // } //利用现在时间判断是否继续循环 结束时间减去花费时间看是否允许观看 最优选择 //初始化变量 time = 0; watch = 0; for (i = 0; i < line; i++) { if (play[i].tie >= time && play[i].tis >= time) { //emmmm...突然发现并不需要计算花费时间.... time=play[i].tie; watch++; } } printf("%d\n",watch ); } return 0; }
the_stack_data/1048576.c
/* itoa: convert n to characters in s */ int abs(int n) { if (n < 0) return -n; else return n; } /* itoa: convert n to character in s */ void itoa(int n, char s[], int width) { int i, sign; sign = n; i = 0; do { s[i++] = abs(n % 10) + '0'; } while ((n /= 10) != 0); if (sign < 0) s[i++] = '-'; while (i < width) s[i++] = ' '; s[i] = '\0'; reverse(s); }
the_stack_data/738224.c
# include <stdio.h> # include <stdlib.h> # include <locale.h> struct aluno{ int matricula; char nome[50]; int serie; char turma[2]; char sexo[2]; float media; int situacao, ano_nasc; char naturalidade[30]; }; typedef struct aluno Aluno; struct lista{ Aluno info; struct lista *prox; }; typedef struct lista Lista; // Prototipo das Funções Lista *inserir(Lista *l, Aluno a); Aluno cadastrar(); void *exibir(Lista *l); void *aprovados(Lista *l); void *genero(Lista *l); void *calc_idade(Lista *l); main(){ setlocale(LC_ALL,"Portuguese"); Aluno a; Lista *l, *p; l = NULL; int op; do{ puts("----------- Menu ----------"); puts("1 - Cadastrar aluno"); puts("2 - Exibir lista de alunos"); puts("3 - Porcentagem de alunos aprovados"); puts("4 - Porcentagem de alunos por genero"); puts("5 - Media de idade"); puts("0 - Sair"); scanf("%d",&op); switch(op){ case 1: a = cadastrar(); l = inserir(l, a); break; case 2: system("cls"); exibir(l); system("pause"); system("cls"); break; case 3: system("cls"); aprovados(l); system("pause"); system("cls"); break; case 4: system("cls"); genero(l); system("pause"); system("cls"); break; case 5: system("cls"); calc_idade(l); system("pause"); system("cls"); break; case 0: exit(1); break; default: puts("Opção Inválida."); break; } } while(1); } // Implementaçõa das funções Lista *inserir(Lista *l, Aluno a){ Lista *novo; novo = (Lista *)malloc(sizeof(Lista)); novo -> info = a; novo -> prox = l; return novo; } Aluno cadastrar(){ Aluno a; printf("Matricula Nº: "); scanf("%d", &a.matricula); printf("Nome: "); fflush(stdin); gets(a.nome); printf("Série 1 2 ou 3: "); scanf("%d", &a.serie); printf("Turma A B ou C: "); fflush(stdin); gets(a.turma); printf("Sexo: "); fflush(stdin); gets(a.sexo); printf("Media: "); scanf("%f", &a.media); if (a.media >= 6){ a.situacao = 1; }else{ a.situacao = 0; } printf("Ano Nascimento: "); scanf("%d", &a.ano_nasc); printf("Naturalidade: "); fflush(stdin); gets(a.naturalidade); return a; } void *exibir(Lista *l){ Lista *p; puts("----- Lista de Alunos Cadastrados ----"); for (p = l; p != NULL; p = p -> prox){ puts("-----------------------------"); printf("Matricula: %d \n", p -> info.matricula); printf("Nome: %s \n", p -> info.nome); printf("Serie: %d Turma: %s \n", p -> info.serie, p -> info.turma); printf("Sexo: %s \n", p -> info.sexo); printf("Média: %.2f \n", p -> info.media); printf("Situação: %s \n", p -> info.situacao == 1 ? "APROVADO(A)" : "REPROVADO(A)"); printf("Ano Nascimento: %d \n", p -> info.ano_nasc); printf("Naturalidade: %s \n", p -> info.naturalidade); puts(""); } } void *aprovados(Lista *l){ Lista *p; int aprov[3][3], reprov[3][3]; int alunos[3][3]; int i, j, tot_alunos, tot_aprov, tot_reprov; float porcent_aprov, porcent_reprov; for (i = 0; i < 3; i++){ for (j = 0; j < 3; j++){ alunos[i][j] = 0; aprov[i][j] = 0; reprov[i][j] = 0; } } for (i = 0; i < 3; i++){ for (p = l; p != NULL; p = p -> prox){ if (p -> info.serie == i + 1){ if (toupper(p -> info.turma[0]) == 'A' ){ if (p -> info.situacao == 1){ aprov[i][0] += 1; } else { reprov[i][0] += 1; } } else if (toupper(p -> info.turma[0]) == 'B' ){ if (p -> info.situacao == 1){ aprov[i][1] += 1; } else { reprov[i][1] += 1; } } else if (toupper(p -> info.turma[0]) == 'C' ){ if (p -> info.situacao == 1){ aprov[i][2] += 1; } else { reprov[i][2] += 1; } } } } } puts(" ------- Porcentagem de Aprovados e Reprovados ----------"); for (i = 0; i < 3; i++){ puts("--------------------------------------"); printf("Alunos da Serie %d \n", i + 1); for (j = 0; j < 3; j++){ tot_alunos = aprov[i][j] + reprov[i][j]; porcent_aprov = (float) 100 * aprov[i][j] / tot_alunos; porcent_reprov = (float) 100 * reprov[i][j] / tot_alunos; if (j == 0){ puts("Turma A"); } else if (j == 1){ puts("Turma B"); } else { puts("Turma C"); } printf("Aprovados: %.2f%% \n", porcent_aprov > 0 ? porcent_aprov : 0); printf("Rerovados: %.2f%% \n", porcent_reprov > 0 ? porcent_reprov : 0); } tot_aprov = 0, tot_reprov = 0; for (j = 0; j < 3; j++){ tot_aprov += aprov[i][j]; tot_reprov += reprov[i][j]; } tot_alunos = tot_aprov + tot_reprov; porcent_aprov = (float) 100 * tot_aprov / tot_alunos; porcent_reprov = (float) 100 * tot_reprov / tot_alunos; puts(""); printf("Total na Serie: %d \n", i + 1); printf("Aprovados: %.2f%% \n", porcent_aprov > 0 ? porcent_aprov : 0); printf("Rerovados: %.2f%% \n", porcent_reprov > 0 ? porcent_reprov : 0); } } void *genero(Lista *l){ Lista *p; int masc[3][3], fem[3][3]; int alunos[3][3]; int i, j, tot_alunos, tot_masc, tot_fem; float porcent_masc, porcent_fem; for (i = 0; i < 3; i++){ for (j = 0; j < 3; j++){ alunos[i][j] = 0; masc[i][j] = 0; fem[i][j] = 0; } } for (i = 0; i < 3; i++){ for (p = l; p != NULL; p = p -> prox){ if (p -> info.serie == i + 1){ if (toupper(p -> info.turma[0]) == 'A' ){ if (toupper(p -> info.sexo[0])== 'M'){ masc[i][0] += 1; } else { fem[i][0] += 1; } } else if (toupper(p -> info.turma[0]) == 'B' ){ if (toupper(p -> info.sexo[0])== 'M'){ masc[i][1] += 1; } else { fem[i][1] += 1; } } else if (toupper(p -> info.turma[0]) == 'C' ){ if (toupper(p -> info.sexo[0])== 'M'){ masc[i][2] += 1; } else { fem[i][2] += 1; } } } } } puts(" ------- Porcentagem de Alunos Por Genero ----------"); for (i = 0; i < 3; i++){ puts("--------------------------------------"); printf("Alunos da Serie %d \n", i + 1); for (j = 0; j < 3; j++){ tot_alunos = masc[i][j] + fem[i][j]; porcent_masc = (float) 100 * masc[i][j] / tot_alunos; porcent_fem = (float) 100 * fem[i][j] / tot_alunos; if (j == 0){ puts("Turma A"); } else if (j == 1){ puts("Turma B"); } else { puts("Turma C"); } printf("Homens: %.2f%% \n", porcent_masc > 0 ? porcent_masc : 0); printf("Mulheres: %.2f%% \n", porcent_fem > 0 ? porcent_fem : 0); } tot_masc = 0, tot_fem = 0; for (j = 0; j < 3; j++){ tot_masc += masc[i][j]; tot_fem += fem[i][j]; } tot_alunos = tot_masc + tot_fem; porcent_masc = (float) 100 * tot_masc / tot_alunos; porcent_fem = (float) 100 * tot_fem / tot_alunos; puts(""); printf("Total na Serie: %d \n", i + 1); printf("Homens: %.2f%% \n", porcent_masc > 0 ? porcent_masc : 0); printf("Mulheres: %.2f%% \n", porcent_fem > 0 ? porcent_fem : 0); } } void *calc_idade(Lista *l){ Lista *p; float m1, m2, m3; int s1, s2, s3, cont1 = 0, cont2 = 0, cont3 = 0, ano_atual = 2019; for (p = l; p != NULL; p = p -> prox){ if( p -> info.serie == 1){ s1 = s1 + (ano_atual - p -> info.ano_nasc); cont1++; } else if (p -> info.serie == 2){ s2 = s2 + (ano_atual - p -> info.ano_nasc); cont2++; }else{ s3 = s3 + (ano_atual - p -> info.ano_nasc); cont3++; } } m1 = (float) s1 / cont1; m2 = (float) s2 / cont2; m3 = (float) s3 / cont3; puts("Media de idade"); printf("Serie 1: %.0f anos\n", m1 >= 0 ? m1 : 0); printf("Serie 2: %.0f anos\n", m2 >= 0 ? m2 : 0); printf("Serie 3: %.0f anos\n", m3 >= 0 ? m3 : 0); }
the_stack_data/242330742.c
typedef unsigned char uint8_t; static unsigned int generate_row(uint8_t row, uint8_t maxnodes) { unsigned int ret=0x00010101; static const unsigned int rows_2p[2][2] = { { 0x00050101, 0x00010404 }, { 0x00010404, 0x00050101 } }; if(maxnodes>2) { maxnodes=2; } if (row < maxnodes) { ret=rows_2p[0][row]; } return ret; } static void setup_node(void) { unsigned char row; for(row=0; row< 2; row++) { __builtin_outl(generate_row(row, 2), 0x1234); } }
the_stack_data/10425.c
/* ** 2014-09-08 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** ** This file contains the bulk of the implementation of the ** user-authentication extension feature. Some parts of the user- ** authentication code are contained within the SQLite core (in the ** src/ subdirectory of the main source code tree) but those parts ** that could reasonable be separated out are moved into this file. ** ** To compile with the user-authentication feature, append this file to ** end of an SQLite amalgamation, then add the SQLITE_USER_AUTHENTICATION ** compile-time option. See the user-auth.txt file in the same source ** directory as this file for additional information. */ #ifdef SQLITE_USER_AUTHENTICATION #ifndef SQLITEINT_H # include "sqliteInt.h" #endif /* ** Prepare an SQL statement for use by the user authentication logic. ** Return a pointer to the prepared statement on success. Return a ** NULL pointer if there is an error of any kind. */ static sqlite3_stmt *sqlite3UserAuthPrepare( sqlite3 *db, const char *zFormat, ... ){ sqlite3_stmt *pStmt; char *zSql; int rc; va_list ap; u64 savedFlags = db->flags; va_start(ap, zFormat); zSql = sqlite3_vmprintf(zFormat, ap); va_end(ap); if( zSql==0 ) return 0; db->flags |= SQLITE_WriteSchema; rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0); db->flags = savedFlags; sqlite3_free(zSql); if( rc ){ sqlite3_finalize(pStmt); pStmt = 0; } return pStmt; } /* ** Check to see if the sqlite_user table exists in database zDb. */ static int userTableExists(sqlite3 *db, const char *zDb){ int rc; sqlite3_mutex_enter(db->mutex); sqlite3BtreeEnterAll(db); if( db->init.busy==0 ){ char *zErr = 0; sqlite3Init(db, &zErr); sqlite3DbFree(db, zErr); } rc = sqlite3FindTable(db, "sqlite_user", zDb)!=0; sqlite3BtreeLeaveAll(db); sqlite3_mutex_leave(db->mutex); return rc; } /* ** Check to see if database zDb has a "sqlite_user" table and if it does ** whether that table can authenticate zUser with nPw,zPw. Write one of ** the UAUTH_* user authorization level codes into *peAuth and return a ** result code. */ static int userAuthCheckLogin( sqlite3 *db, /* The database connection to check */ const char *zDb, /* Name of specific database to check */ u8 *peAuth /* OUT: One of UAUTH_* constants */ ){ sqlite3_stmt *pStmt; int rc; *peAuth = UAUTH_Unknown; if( !userTableExists(db, zDb) ){ *peAuth = UAUTH_Admin; /* No sqlite_user table. Everybody is admin. */ return SQLITE_OK; } if( db->auth.zAuthUser==0 ){ *peAuth = UAUTH_Fail; return SQLITE_OK; } pStmt = sqlite3UserAuthPrepare(db, "SELECT pw=sqlite_crypt(?1,pw), isAdmin FROM \"%w\".sqlite_user" " WHERE uname=?2", zDb); if( pStmt==0 ) return SQLITE_NOMEM; sqlite3_bind_blob(pStmt, 1, db->auth.zAuthPW, db->auth.nAuthPW,SQLITE_STATIC); sqlite3_bind_text(pStmt, 2, db->auth.zAuthUser, -1, SQLITE_STATIC); rc = sqlite3_step(pStmt); if( rc==SQLITE_ROW && sqlite3_column_int(pStmt,0) ){ *peAuth = sqlite3_column_int(pStmt, 1) + UAUTH_User; }else{ *peAuth = UAUTH_Fail; } return sqlite3_finalize(pStmt); } int sqlite3UserAuthCheckLogin( sqlite3 *db, /* The database connection to check */ const char *zDb, /* Name of specific database to check */ u8 *peAuth /* OUT: One of UAUTH_* constants */ ){ int rc; u8 savedAuthLevel; assert( zDb!=0 ); assert( peAuth!=0 ); savedAuthLevel = db->auth.authLevel; db->auth.authLevel = UAUTH_Admin; rc = userAuthCheckLogin(db, zDb, peAuth); db->auth.authLevel = savedAuthLevel; return rc; } /* ** If the current authLevel is UAUTH_Unknown, the take actions to figure ** out what authLevel should be */ void sqlite3UserAuthInit(sqlite3 *db){ if( db->auth.authLevel==UAUTH_Unknown ){ u8 authLevel = UAUTH_Fail; sqlite3UserAuthCheckLogin(db, "main", &authLevel); db->auth.authLevel = authLevel; if( authLevel<UAUTH_Admin ) db->flags &= ~SQLITE_WriteSchema; } } /* ** Implementation of the sqlite_crypt(X,Y) function. ** ** If Y is NULL then generate a new hash for password X and return that ** hash. If Y is not null, then generate a hash for password X using the ** same salt as the previous hash Y and return the new hash. */ void sqlite3CryptFunc( sqlite3_context *context, int NotUsed, sqlite3_value **argv ){ const char *zIn; int nIn; u8 *zData; u8 *zOut; char zSalt[16]; int nHash = 32; zIn = sqlite3_value_blob(argv[0]); nIn = sqlite3_value_bytes(argv[0]); if( sqlite3_value_type(argv[1])==SQLITE_BLOB && sqlite3_value_bytes(argv[1])==nHash+sizeof(zSalt) ){ memcpy(zSalt, sqlite3_value_blob(argv[1]), sizeof(zSalt)); }else{ sqlite3_randomness(sizeof(zSalt), zSalt); } zData = sqlite3_malloc( nIn+sizeof(zSalt) ); zOut = sqlite3_malloc( nHash+sizeof(zSalt) ); if( zOut==0 ){ sqlite3_result_error_nomem(context); }else{ memcpy(zData, zSalt, sizeof(zSalt)); memcpy(zData+sizeof(zSalt), zIn, nIn); memcpy(zOut, zSalt, sizeof(zSalt)); sha256(zData, (unsigned int) nIn+sizeof(zSalt), zOut+sizeof(zSalt)); sqlite3_result_blob(context, zOut, nHash+sizeof(zSalt), sqlite3_free); } if (zData != 0) sqlite3_free(zData); } /* ** If a database contains the SQLITE_USER table, then the ** sqlite3_user_authenticate() interface must be invoked with an ** appropriate username and password prior to enable read and write ** access to the database. ** ** Return SQLITE_OK on success or SQLITE_ERROR if the username/password ** combination is incorrect or unknown. ** ** If the SQLITE_USER table is not present in the database file, then ** this interface is a harmless no-op returnning SQLITE_OK. */ int sqlite3_user_authenticate( sqlite3 *db, /* The database connection */ const char *zUsername, /* Username */ const char *zPW, /* Password or credentials */ int nPW /* Number of bytes in aPW[] */ ){ int rc; u8 authLevel = UAUTH_Fail; db->auth.authLevel = UAUTH_Unknown; sqlite3_free(db->auth.zAuthUser); sqlite3_free(db->auth.zAuthPW); memset(&db->auth, 0, sizeof(db->auth)); db->auth.zAuthUser = sqlite3_mprintf("%s", zUsername); if( db->auth.zAuthUser==0 ) return SQLITE_NOMEM; db->auth.zAuthPW = sqlite3_malloc( nPW+1 ); if( db->auth.zAuthPW==0 ) return SQLITE_NOMEM; memcpy(db->auth.zAuthPW,zPW,nPW); db->auth.nAuthPW = nPW; rc = sqlite3UserAuthCheckLogin(db, "main", &authLevel); db->auth.authLevel = authLevel; sqlite3ExpirePreparedStatements(db, 0); if( rc ){ return rc; /* OOM error, I/O error, etc. */ } if( authLevel<UAUTH_User ){ return SQLITE_AUTH; /* Incorrect username and/or password */ } return SQLITE_OK; /* Successful login */ } /* ** The sqlite3_user_add() interface can be used (by an admin user only) ** to create a new user. When called on a no-authentication-required ** database, this routine converts the database into an authentication- ** required database, automatically makes the added user an ** administrator, and logs in the current connection as that user. ** The sqlite3_user_add() interface only works for the "main" database, not ** for any ATTACH-ed databases. Any call to sqlite3_user_add() by a ** non-admin user results in an error. */ int sqlite3_user_add( sqlite3 *db, /* Database connection */ const char *zUsername, /* Username to be added */ const char *aPW, /* Password or credentials */ int nPW, /* Number of bytes in aPW[] */ int isAdmin /* True to give new user admin privilege */ ){ sqlite3_stmt *pStmt; int rc; sqlite3UserAuthInit(db); if( db->auth.authLevel<UAUTH_Admin ) return SQLITE_AUTH; if( !userTableExists(db, "main") ){ if( !isAdmin ) return SQLITE_AUTH; pStmt = sqlite3UserAuthPrepare(db, "CREATE TABLE sqlite_user(\n" " uname TEXT PRIMARY KEY,\n" " isAdmin BOOLEAN,\n" " pw BLOB\n" ") WITHOUT ROWID;"); if( pStmt==0 ) return SQLITE_NOMEM; sqlite3_step(pStmt); rc = sqlite3_finalize(pStmt); if( rc ) return rc; } pStmt = sqlite3UserAuthPrepare(db, "INSERT INTO sqlite_user(uname,isAdmin,pw)" " VALUES(%Q,%d,sqlite_crypt(?1,NULL))", zUsername, isAdmin!=0); if( pStmt==0 ) return SQLITE_NOMEM; sqlite3_bind_blob(pStmt, 1, aPW, nPW, SQLITE_STATIC); sqlite3_step(pStmt); rc = sqlite3_finalize(pStmt); if( rc ) return rc; if( db->auth.zAuthUser==0 ){ assert( isAdmin!=0 ); sqlite3_user_authenticate(db, zUsername, aPW, nPW); } return SQLITE_OK; } /* ** The sqlite3_user_change() interface can be used to change a users ** login credentials or admin privilege. Any user can change their own ** login credentials. Only an admin user can change another users login ** credentials or admin privilege setting. No user may change their own ** admin privilege setting. */ int sqlite3_user_change( sqlite3 *db, /* Database connection */ const char *zUsername, /* Username to change */ const char *aPW, /* Modified password or credentials */ int nPW, /* Number of bytes in aPW[] */ int isAdmin /* Modified admin privilege for the user */ ){ sqlite3_stmt *pStmt; int rc = SQLITE_OK; u8 authLevel; authLevel = db->auth.authLevel; if( authLevel<UAUTH_User ){ /* Must be logged in to make a change */ return SQLITE_AUTH; } if( strcmp(db->auth.zAuthUser, zUsername)!=0 ){ if( db->auth.authLevel<UAUTH_Admin ){ /* Must be an administrator to change a different user */ return SQLITE_AUTH; } }else if( isAdmin!=(authLevel==UAUTH_Admin) ){ /* Cannot change the isAdmin setting for self */ return SQLITE_AUTH; } db->auth.authLevel = UAUTH_Admin; if( !userTableExists(db, "main") ){ /* This routine is a no-op if the user to be modified does not exist */ }else{ pStmt = sqlite3UserAuthPrepare(db, "UPDATE sqlite_user SET isAdmin=%d, pw=sqlite_crypt(?1,NULL)" " WHERE uname=%Q", isAdmin, zUsername); if( pStmt==0 ){ rc = SQLITE_NOMEM; }else{ sqlite3_bind_blob(pStmt, 1, aPW, nPW, SQLITE_STATIC); sqlite3_step(pStmt); rc = sqlite3_finalize(pStmt); } } db->auth.authLevel = authLevel; return rc; } /* ** The sqlite3_user_delete() interface can be used (by an admin user only) ** to delete a user. The currently logged-in user cannot be deleted, ** which guarantees that there is always an admin user and hence that ** the database cannot be converted into a no-authentication-required ** database. */ int sqlite3_user_delete( sqlite3 *db, /* Database connection */ const char *zUsername /* Username to remove */ ){ sqlite3_stmt *pStmt; if( db->auth.authLevel<UAUTH_Admin ){ /* Must be an administrator to delete a user */ return SQLITE_AUTH; } if( strcmp(db->auth.zAuthUser, zUsername)==0 ){ /* Cannot delete self */ return SQLITE_AUTH; } if( !userTableExists(db, "main") ){ /* This routine is a no-op if the user to be deleted does not exist */ return SQLITE_OK; } pStmt = sqlite3UserAuthPrepare(db, "DELETE FROM sqlite_user WHERE uname=%Q", zUsername); if( pStmt==0 ) return SQLITE_NOMEM; sqlite3_step(pStmt); return sqlite3_finalize(pStmt); } #endif /* SQLITE_USER_AUTHENTICATION */
the_stack_data/37363.c
// gcc -O2 algo.c -o nombre -fopenmp #include <stdlib.h> #include <stdio.h> #ifdef _OPENMP #include <omp.h> #else #define omp_get_thread_num() 0 #define omp_get_num_threads() 1 #endif int main(int argc, char** argv) { int i, j; double t1, t2, total; //Argumento de entrada, N es el número de componentes del vector if (argc<2){ printf("Falta tamaño de la matriz y del vector\n"); exit(-1); } unsigned int N = atoi(argv[1]); // Máximo N =2^32-1=4294967295 (sizeof(unsigned int) = 4 B) double *v1, *v2, **M; v1 = (double*) malloc(N*sizeof(double));// malloc necesita el tamaño en bytes v2 = (double*) malloc(N*sizeof(double)); //si no hay espacio suficiente malloc devuelve NULL M = (double**) malloc(N*sizeof(double *)); if ( (v1==NULL) || (v2==NULL) || (M==NULL) ){ printf("Error en la reserva de espacio para los vectores\n"); exit(-2); } for (i=0; i<N; i++){ M[i] = (double*) malloc(N*sizeof(double)); if ( M[i]==NULL ){ printf("Error en la reserva de espacio para la matriz\n"); exit(-2); } } //Inicializar matriz y vectores for (i=0; i<N;i++){ v1[i] = i; v2[i] = 0; for(j=0;j<N;j++) M[i][j] = i+j; } //Tomamos tiempo antes de operar t1 = omp_get_wtime(); //Calcular producto de matriz por vector M * v1 = v2 for (i=0; i<N;i++){ double acumula = 0; #pragma omp parallel { #pragma omp for reduction(+:acumula) for(j=0;j<N;j++){ acumula += M[i][j] * v1[j]; } v2[i] =acumula; } } //Tomamos tiempo después de operar t2 = omp_get_wtime(); total = t2 - t1; //Imprimir el resultado primero y último, además del tiempo de ejecución printf("Tiempo(seg.):%11.9f\t / Tamaño:%u\t/ V2[0]=%8.6f V2[%d]=%8.6f\n", total,N,v2[0],N-1,v2[N-1]); // Imprimir todos los componentes de v2 para valores de entrada no muy altos if (N<20){ for (i=0; i<N;i++){ printf(" V2[%d]=%5.2f\n", i, v2[i]); } } free(v1); // libera el espacio reservado para v1 free(v2); // libera el espacio reservado para v2 for (i=0; i<N; i++) free(M[i]); free(M); return 0; }
the_stack_data/118194.c
/**************************************************************** * Name : Jesus Valdes * * Class : CSC 415 * * Date : 10/24/18 * * Description : Writting a simple bash shell program * * that will execute simple commands. The main * * goal of the assignment is working with * * fork, pipes and exec system calls. * ****************************************************************/ #include <string.h> #include <unistd.h> #include <stdlib.h> #include <stdbool.h> #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <sys/wait.h> #include <readline/readline.h> #include <readline/history.h> #define MAXCOMMAND 16 #define BUFFERSIZE 256 #define PROMPT "myShell" #define PROMPTSIZE sizeof(PROMPT) #define USERNAME getenv("USER") // built in cd int cd(char *newDir) { return chdir(newDir); } // built in pwd void pwd () { char dir[512]; getcwd(dir, sizeof(dir)); printf("%s", dir); } // prints out directory void curDirectory() { printf("\n%s ", PROMPT); char homeDir[512]; getcwd(homeDir, sizeof(homeDir)); char *token; char *delimiter = "/"; token = strtok(homeDir, delimiter); // since '/' is delimiter, should return NULL if in root directory // this avoids a segmentation fault if (token == NULL) { printf("/"); // in home directory at this step } else if (strcmp("home", token) == 0) { // prints /home if next token is NULL token = strtok(NULL, delimiter); if (token == NULL) { printf("/home"); // prints out ~/... if in USER home directory } else if (strcmp(USERNAME, token) == 0) { printf("~"); token = strtok(NULL, delimiter); if (token == NULL) { printf("/"); } while (token != NULL) { printf("/%s", token); token = strtok(NULL, delimiter); } // this is when in a different user directory than the one signed in } else { printf("/home"); token = strtok(NULL, delimiter); while (token != NULL) { printf("/%s", token); token = strtok(NULL, delimiter); } } // anything other than /home } else { while (token != NULL) { printf("/%s", token); token = strtok(NULL, delimiter); } } printf(" >> "); } // takes user input using readline void user_input(char* input) { char* buffer; buffer = readline(""); if (strlen(buffer) != 0) { add_history(buffer); strcpy(input, buffer); free(buffer); } else { printf("Please type out a command!\n"); } } // this is to check if there will be any pipes in the command // limited to one pipe per command int pipeTok(char* input, char** pipedInput) { for (int i = 0; i < 2; i++) { pipedInput[i] = strsep(&input, "|"); if (pipedInput[i] == NULL) { break; } } if (pipedInput[1] == NULL) { return 0; } else { return 1; } } // chops up the user input using string tokenizer void inputTok(char* input, char** parsedInput, bool *background, int *process, char** file) { char *token; char *delimiter = " "; int i = 0; bool ignore = false; token = strtok(input, delimiter); while (token != NULL) { // special character detection // for running background process if (*token == '&') { *background = true; token = strtok(NULL, delimiter); // next 3 are for redirection } else if (*token == '<') { *process = 1; token = strtok(NULL, delimiter); ignore = true; } else if (strcmp(">>", token) == 0) { *process = 4; token = strtok(NULL, delimiter); ignore = true; } else if (*token == '>') { *process = 3; token = strtok(NULL, delimiter); ignore = true; // if there is redirection, then this ignores the file name to redirect to // instead it places it in a different char* to be used later } else if (ignore) { *file = token; token = strtok(NULL, delimiter); ignore = false; // everything else is added to be executed later } else { parsedInput[i] = token; i++; token = strtok(NULL, delimiter); } } // execvp expects last argument to be NULL parsedInput[i] = NULL; } // checks to see if there is pipes // if there is then we need 2 char*, if not then just send input straight to inputTok int inputProcessor(char* input, char** parsedInput, char** parsedPipedInput, bool *background, int *process, char** file) { char* pipedInput[2]; int numPipes = 0; numPipes = pipeTok(input, pipedInput); if (numPipes) { inputTok(pipedInput[0], parsedInput, background, process, file); inputTok(pipedInput[1], parsedPipedInput, background, process, file); } else { inputTok(input, parsedInput, background, process, file); } return 0 + numPipes; } // used when redirection is detected void ioRedirection(char** parsedInput, int process, char* file) { // opens the file, then copies the file's file descriptor into In/Out so that the command read/writes the file // < if (process == 1) { int fd1 = open(file, O_RDONLY); dup2(fd1, STDIN_FILENO); close(fd1); // > } else if (process == 3) { int fd3 = open(file, O_WRONLY | O_TRUNC | O_CREAT, 0644); dup2(fd3, STDOUT_FILENO); close(fd3); // >> } else if (process == 4) { int fd4 = open(file, O_WRONLY | O_APPEND | O_CREAT, 0644); dup2(fd4, STDOUT_FILENO); close(fd4); } execvp(parsedInput[0], parsedInput); perror("Something went wrong..."); exit(1); } // used when there are no pipes void commands(char** parsedInput, bool background, int process, char* file) { int stat_loc; pid_t child_pid = fork(); if (child_pid < 0) { perror("Fork failed!"); exit(1); } if (child_pid == 0) { if (process > 0) { ioRedirection(parsedInput, process, file); } else { execvp(parsedInput[0], parsedInput); perror("You messed up somewhere..."); exit(1); } } else { if (!background) { waitpid(child_pid, &stat_loc, WUNTRACED); } } } // pipe commands here void pipedCommands(char** parsedInput, char** parsedPipedInput, bool background, int process, char* file) { // 0 = read // 1 = write int stat_loc; int pipefd[2]; pid_t p1, p2; // pipe creation if (pipe(pipefd) < 0) { printf("\nPipe could not be initialized"); return; } // 1st process p1 = fork(); if (p1 < 0) { perror("Fork failed!"); exit(1); } if (p1 == 0) { // connects stdout to write // closes read end of pipe dup2(pipefd[1], STDOUT_FILENO); close(pipefd[0]); if (process > 0) { ioRedirection(parsedInput, process, file); } else { execvp(parsedInput[0], parsedInput); perror("1st process failed..."); exit(0); } } // 2nd process p2 = fork(); if (p2 < 0) { perror("Fork failed!"); exit(1); } if (p2 == 0) { // connects stdin to read // closes write end of pipe dup2(pipefd[0], STDIN_FILENO); close(pipefd[1]); if (process > 0) { ioRedirection(parsedInput, process, file); } else { execvp(parsedPipedInput[0], parsedPipedInput); perror("2nd process failed..."); exit(0); } } // close both ends of the pipe close( pipefd[0] ); close( pipefd[1] ); // used to wait for children if (!background) { waitpid(p1, &stat_loc, WUNTRACED); waitpid(p2, &stat_loc, WUNTRACED); } } int main() { char input[BUFFERSIZE], *file; char *parsedInput[MAXCOMMAND], *parsedPipedInput[MAXCOMMAND]; int numPipes; int process; bool background; using_history(); printf("\nEnter 'quit' to exit...\nUse arrow keys for history..."); while (1) { process = 0; background = false; curDirectory(); user_input(input); // allows user to quit whenever if (strcmp("quit", input) == 0) { exit(0); } numPipes = inputProcessor(input, parsedInput, parsedPipedInput, &background, &process, &file); // built in cd if (strcmp(parsedInput[0], "cd") == 0) { if (cd(parsedInput[1]) < 0) { perror(parsedInput[1]); } /* Skip the fork */ continue; } // built in pwd if (strcmp(parsedInput[0], "pwd") == 0) { pwd(); /* Skip the fork */ continue; } if (numPipes >= 1) { pipedCommands(parsedInput, parsedPipedInput, background, process, file); } if (numPipes == 0) { commands(parsedInput, background, process, file); } } return 0; }
the_stack_data/864882.c
#include <stdio.h> int main() { int T,count=1; long long int s,i; scanf("%d",&T); if(T>200) return 0; while(scanf("%lld",&s) !=EOF) { i=pow(10,15); if(s>=1 && s<=i) { if(s<=25) { if(s==1) printf("Case %d: 1 1\n",count); else if(s==2) printf("Case %d: 1 2\n",count); else if(s==3) printf("Case %d: 2 2\n",count); else if(s==4) printf("Case %d: 2 1\n",count); else if(s==5) printf("Case %d: 3 1\n",count); else if(s==6) printf("Case %d: 3 2\n",count); else if(s==7) printf("Case %d: 3 3\n",count); else if(s==8) printf("Case %d: 2 3\n",count); else if(s==9) printf("Case %d: 1 3\n",count); else if(s==10) printf("Case %d: 1 4\n",count); else if(s==11) printf("Case %d: 2 4\n",count); else if(s==12) printf("Case %d: 3 4\n",count); else if(s==13) printf("Case %d: 4 4\n",count); else if(s==14) printf("Case %d: 4 3\n",count); else if(s==15) printf("Case %d: 4 2\n",count); else if(s==16) printf("Case %d: 4 1\n",count); else if(s==17) printf("Case %d: 5 1\n",count); else if(s==18) printf("Case %d: 5 2\n",count); else if(s==19) printf("Case %d: 5 3\n",count); else if(s==20) printf("Case %d: 5 4\n",count); else if(s==21) printf("Case %d: 5 5\n",count); else if(s==22) printf("Case %d: 4 5\n",count); else if(s==23) printf("Case %d: 3 5\n",count); else if(s==24) printf("Case %d: 2 5\n",count); else if(s==25) printf("Case %d: 1 5\n",count); } else if(s>25) { s=s%25; if(s==1) printf("Case %d: 1 1\n",count); else if(s==2) printf("Case %d: 1 2\n",count); else if(s==3) printf("Case %d: 2 2\n",count); else if(s==4) printf("Case %d: 2 1\n",count); else if(s==5) printf("Case %d: 3 1\n",count); else if(s==6) printf("Case %d: 3 2\n",count); else if(s==7) printf("Case %d: 3 3\n",count); else if(s==8) printf("Case %d: 2 3\n",count); else if(s==9) printf("Case %d: 1 3\n",count); else if(s==10) printf("Case %d: 1 4\n",count); else if(s==11) printf("Case %d: 2 4\n",count); else if(s==12) printf("Case %d: 3 4\n",count); else if(s==13) printf("Case %d: 4 4\n",count); else if(s==14) printf("Case %d: 4 3\n",count); else if(s==15) printf("Case %d: 4 2\n",count); else if(s==16) printf("Case %d: 4 1\n",count); else if(s==17) printf("Case %d: 5 1\n",count); else if(s==18) printf("Case %d: 5 2\n",count); else if(s==19) printf("Case %d: 5 3\n",count); else if(s==20) printf("Case %d: 5 4\n",count); else if(s==21) printf("Case %d: 5 5\n",count); else if(s==22) printf("Case %d: 4 5\n",count); else if(s==23) printf("Case %d: 3 5\n",count); else if(s==24) printf("Case %d: 2 5\n",count); else if(s==0) printf("Case %d: 1 5\n",count); } count++; if(count>T) break; } } return 0; }
the_stack_data/106350.c
/* Calculating length of string */ // ================================================= #include<stdio.h> #include<string.h> void main() { char str[10] = "AbelRoy"; int len = strlen(str); printf("Length of string: %d\n", len); } // ================================================ /* Code by Abel Roy */
the_stack_data/90766108.c
#include <stdio.h> int main() { //void pointer void *p; printf("The size of pointer is: %ld\n", sizeof(p)); return 0; }
the_stack_data/121416.c
#include <stdio.h> // Print odd numbers from 1-100 //Using Break main() { int i; for(i=1; ;i=i+2) { printf("\t %d", i); if(i>=99) break; } } //using continue //for(i=1;i<100;i=i+2) //{ // if(i%2==0) continue; //Only Odd Numbers will be printed // printf("\t %d", i); //}
the_stack_data/1179309.c
/* * i2c-pca-isa.c driver for PCA9564 on ISA boards * Copyright (C) 2004 Arcom Control Systems * Copyright (C) 2008 Pengutronix * * 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; either version 2 of the License, or * (at your option) any later version. * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <stdio.h> #include <pthread.h> #include <assert.h> #if FULLCODE #include <linux/kernel.h> #include <linux/ioport.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/delay.h> #include <linux/jiffies.h> #include <linux/init.h> #include <linux/interrupt.h> #include <linux/wait.h> #include <linux/isa.h> #include <linux/i2c.h> #include <linux/i2c-algo-pca.h> #include <asm/io.h> #include <asm/irq.h> #define DRIVER "i2c-pca-isa" #define IO_SIZE 4 static unsigned long base; static int irq = -1; /* Data sheet recommends 59kHz for 100kHz operation due to variation * in the actual clock rate */ static int clock = 59000; static struct i2c_adapter pca_isa_ops; static wait_queue_head_t pca_wait; static void pca_isa_writebyte(void *pd, int reg, int val) { #ifdef DEBUG_IO static char *names[] = { "T/O", "DAT", "ADR", "CON" }; printk(KERN_DEBUG "*** write %s at %#lx <= %#04x\n", names[reg], base+reg, val); #endif outb(val, base+reg); } static int pca_isa_readbyte(void *pd, int reg) { int res = inb(base+reg); #ifdef DEBUG_IO { static char *names[] = { "STA", "DAT", "ADR", "CON" }; printk(KERN_DEBUG "*** read %s => %#04x\n", names[reg], res); } #endif return res; } static int pca_isa_waitforcompletion(void *pd) { unsigned long timeout; long ret; if (irq > -1) { ret = wait_event_timeout(pca_wait, pca_isa_readbyte(pd, I2C_PCA_CON) & I2C_PCA_CON_SI, pca_isa_ops.timeout); } else { /* Do polling */ timeout = jiffies + pca_isa_ops.timeout; do { ret = time_before(jiffies, timeout); if (pca_isa_readbyte(pd, I2C_PCA_CON) & I2C_PCA_CON_SI) break; udelay(100); } while (ret); } return ret > 0; } static void pca_isa_resetchip(void *pd) { /* apparently only an external reset will do it. not a lot can be done */ printk(KERN_WARNING DRIVER ": Haven't figured out how to do a reset yet\n"); } static irqreturn_t pca_handler(int this_irq, void *dev_id) { wake_up(&pca_wait); return IRQ_HANDLED; } static struct i2c_algo_pca_data pca_isa_data = { /* .data intentionally left NULL, not needed with ISA */ .write_byte = pca_isa_writebyte, .read_byte = pca_isa_readbyte, .wait_for_completion = pca_isa_waitforcompletion, .reset_chip = pca_isa_resetchip, }; static struct i2c_adapter pca_isa_ops = { .owner = THIS_MODULE, .algo_data = &pca_isa_data, .name = "PCA9564/PCA9665 ISA Adapter", .timeout = HZ, }; static int __devinit pca_isa_match(struct device *dev, unsigned int id) { int match = base != 0; if (match) { if (irq <= -1) dev_warn(dev, "Using polling mode (specify irq)\n"); } else dev_err(dev, "Please specify I/O base\n"); return match; } #endif #if FULLCODE static int __devinit pca_isa_probe(struct device *dev, unsigned int id) { init_waitqueue_head(&pca_wait); dev_info(dev, "i/o base %#08lx. irq %d\n", base, irq); #ifdef CONFIG_PPC if (check_legacy_ioport(base)) { dev_err(dev, "I/O address %#08lx is not available\n", base); goto out; } #endif if (!request_region(base, IO_SIZE, "i2c-pca-isa")) { dev_err(dev, "I/O address %#08lx is in use\n", base); goto out; } if (irq > -1) { if (request_irq(irq, pca_handler, 0, "i2c-pca-isa", &pca_isa_ops) < 0) { dev_err(dev, "Request irq%d failed\n", irq); goto out_region; } } pca_isa_data.i2c_clock = clock; if (i2c_pca_add_bus(&pca_isa_ops) < 0) { dev_err(dev, "Failed to add i2c bus\n"); goto out_irq; } return 0; out_irq: if (irq > -1) free_irq(irq, &pca_isa_ops); out_region: release_region(base, IO_SIZE); out: return -ENODEV; } #endif int global_clock; int irq; int global_id; int global_dev; #define pca_isa_probe(dev, id)\ if (global_dev != dev) { \ assert(0); \ } \ if (irq > -1) { \ if (global_id != id) {\ assert(0);\ }\ } \ #if FULLCODE static int __devexit pca_isa_remove(struct device *dev, unsigned int id) { i2c_del_adapter(&pca_isa_ops); if (irq > -1) { disable_irq(irq); free_irq(irq, &pca_isa_ops); } release_region(base, IO_SIZE); return 0; } static struct isa_driver pca_isa_driver = { .match = pca_isa_match, .probe = pca_isa_probe, .remove = __devexit_p(pca_isa_remove), .driver = { .owner = THIS_MODULE, .name = DRIVER, } }; #endif #define pca_isa_init(dev, id) { \ global_id = id; \ global_dev = dev; \ } #define pca_isa_exit() {\ global_id = -1; \ global_dev = -1; \ } #if FULLCODE static int __init pca_isa_init(void) { return isa_register_driver(&pca_isa_driver, 1); } static void __exit pca_isa_exit(void) { isa_unregister_driver(&pca_isa_driver); } MODULE_AUTHOR("Ian Campbell <[email protected]>"); MODULE_DESCRIPTION("ISA base PCA9564/PCA9665 driver"); MODULE_LICENSE("GPL"); module_param(base, ulong, 0); MODULE_PARM_DESC(base, "I/O base address"); module_param(irq, int, 0); MODULE_PARM_DESC(irq, "IRQ"); module_param(clock, int, 0); MODULE_PARM_DESC(clock, "Clock rate in hertz.\n\t\t" "For PCA9564: 330000,288000,217000,146000," "88000,59000,44000,36000\n" "\t\tFor PCA9665:\tStandard: 60300 - 100099\n" "\t\t\t\tFast: 100100 - 400099\n" "\t\t\t\tFast+: 400100 - 10000099\n" "\t\t\t\tTurbo: Up to 1265800"); module_init(pca_isa_init); module_exit(pca_isa_exit); #endif #define LIMIT 20 int cnt1, cnt2, cnt3, cnt4, cnt5, cnt6; void *req1(void *unused) { //while(cnt1< LIMIT) { irq = 0; pca_isa_init(1, 1); pca_isa_probe(1, 1); pca_isa_exit(); //cnt1++; //} } void *req2(void *unused) { //while(cnt2 < LIMIT) { irq = 0; pca_isa_init(2, 2); pca_isa_probe(2, 2); pca_isa_exit(); //cnt2++; //} } void *req3(void *unused) { //while(cnt3 < LIMIT) { irq = 0; pca_isa_init(3, 3); pca_isa_probe(3, 3); pca_isa_exit(); //cnt3++; //} } void *req4(void *unused) { //while(cnt4 < LIMIT) { irq = 0; pca_isa_init(4, 4); pca_isa_probe(4, 4); pca_isa_exit(); //cnt4++; //} } void *req5(void *unused) { //while(cnt5 < LIMIT) { irq = 0; pca_isa_init(5, 5); pca_isa_probe(5, 5); pca_isa_exit(); //cnt5++; //} } void *req6(void *unused) { //while(cnt6 < LIMIT) { irq = -1; //cnt6++; //} } int main(void) { pthread_t t1, t2, t3, t4, t5, t6; pthread_create(&t1, NULL, &req1, NULL); pthread_create(&t2, NULL, &req2, NULL); pthread_create(&t2, NULL, &req3, NULL); pthread_create(&t2, NULL, &req4, NULL); pthread_create(&t2, NULL, &req5, NULL); pthread_create(&t2, NULL, &req6, NULL); return 0; }
the_stack_data/449609.c
#include<stdio.h> #include<string.h> main() { char str[20], str1[20], str2[20], str3[20]; int i=0; printf("\nEnter a string\n"); gets(str); strcpy(str1,str); printf("\nCopied string is : %s\n",str1); printf("\nEnter a string\n"); gets(str2); if((strcmp(str,str2))==0) printf("\nStrings are equal\n"); else printf("\nStrings are not equal\n"); i = strlen(str); printf("\nLength of string %s is : %d\n",str,i); printf("\nConcatenated String is : %s\n",strcat(str,str2)); }
the_stack_data/14199220.c
// compile with "gcc -std=gnu99 -O3 contention.c -lpthread -o con" // outputs a CSV, one line for each test with all data points // cat /sys/devices/system/cpu/cpu0/topology/thread_siblings_list #define _GNU_SOURCE #include <stdio.h> #include <stdlib.h> #include <pthread.h> #include <sched.h> #define HT1 0 #define HT2 4 #ifndef HT1 #error "edit source to define ids of sibling hyperthreads" #endif volatile unsigned int ticks; unsigned int __attribute__ ((aligned (512))) array[8] = {0,1,2,3,4,5,6,7}; double __attribute__ ((aligned (512))) val_array[4] = {0.0,2.0,3.0,5.0}; void setaffinity(int cpu) { cpu_set_t c; CPU_ZERO(&c); CPU_SET(cpu, &c); if (sched_setaffinity(0, sizeof(c), &c) < 0) { perror("sched_setaffinity"); exit(1); } } int __attribute__((noinline)) baseline_test(void) { volatile unsigned int *t = &ticks; unsigned int cycle; double result; unsigned int rdtsc0; unsigned int rdtsc1; unsigned int *arrptr = (unsigned int *)malloc(4*8*8); arrptr[0] = 0; arrptr[1] = 1; arrptr[2] = 2; arrptr[3] = 3; arrptr[4] = 4; arrptr[5] = 5; arrptr[6] = 6; arrptr[7] = 7; unsigned int *indicies = &array[0]; double *valptr = (double *)malloc(8*4*8); valptr[0] = 7.0; valptr[1] = 2.0; valptr[2] = 2.0; valptr[3] = 8.0; double *values = &val_array[0]; asm( R"( vzeroall vmovdqa (%2), %%ymm0 vmovdqa (%3), %%ymm1 vmovapd %%ymm1, %%ymm2 vmovapd %%ymm1, %%ymm3 vmovapd %%ymm1, %%ymm4 vmovapd %%ymm1, %%ymm5 vmovapd %%ymm1, %%ymm6 vmovapd %%ymm1, %%ymm7 vmovapd %%ymm1, %%ymm8 vmovapd %%ymm1, %%ymm9 vmovapd %%ymm1, %%ymm10 vmovapd %%ymm1, %%ymm11 vmovapd %%ymm1, %%ymm12 vmovapd %%ymm1, %%ymm13 vmovapd %%ymm1, %%ymm14 vmovapd %%ymm1, %%ymm15 lfence movl (%1), %0 // Sample clock_ticks start value lfence .REPT 32 vsqrtpd %%ymm1,%%ymm1 //vpermd %%ymm1, %%ymm0, %%ymm1 .ENDR vmovq %%xmm1, %%rax movl (%1,%%rax,1), %%r13d // Sample clock_ticks end value (data dependent on completion of vsqrtpd chain) .REPT 1024 // Non-contending instructions NOP .ENDR sub %0, %%r13d movl %%r13d, %0 )" : "=r"(cycle), "+r"(t), "+r"(indicies), "+r"(values), "=r"(result), "=r"(rdtsc0), "=r"(rdtsc1) : : "%r12", "%r13", "%eax", "%ebx", "%ecx", "%edx", "%ymm0", "%ymm1", "%ymm2", "%ymm3", "%ymm4", "%ymm5", "%ymm6", "%ymm7", "%ymm8", "%ymm9", "%ymm10", "%ymm11", "%ymm12", "%ymm13", "%ymm14", "%ymm15" ); //printf("cycle = %d, rdtsc = %d, ratio = %f\n", cycle, rdtsc1-rdtsc0, (double)(rdtsc1-rdtsc0)/cycle); return cycle; } int __attribute__((noinline)) contention_test(void) { volatile unsigned int *t = &ticks; unsigned int cycle; double result; unsigned int rdtsc0; unsigned int rdtsc1; unsigned int *arrptr = (unsigned int *)malloc(4*8*8); arrptr[0] = 0; arrptr[1] = 1; arrptr[2] = 2; arrptr[3] = 3; arrptr[4] = 4; arrptr[5] = 5; arrptr[6] = 6; arrptr[7] = 7; unsigned int *indicies = &array[0]; double *valptr = (double *)malloc(8*4*8); valptr[0] = 7.0; valptr[1] = 2.0; valptr[2] = 2.0; valptr[3] = 8.0; double *values = &val_array[0]; asm( R"( vzeroall vmovdqa (%2), %%ymm0 vmovdqa (%3), %%ymm1 vmovapd %%ymm1, %%ymm2 vmovapd %%ymm1, %%ymm3 vmovapd %%ymm1, %%ymm4 vmovapd %%ymm1, %%ymm5 vmovapd %%ymm1, %%ymm6 vmovapd %%ymm1, %%ymm7 vmovapd %%ymm1, %%ymm8 vmovapd %%ymm1, %%ymm9 vmovapd %%ymm1, %%ymm10 vmovapd %%ymm1, %%ymm11 vmovapd %%ymm1, %%ymm12 vmovapd %%ymm1, %%ymm13 vmovapd %%ymm1, %%ymm14 vmovapd %%ymm1, %%ymm15 lfence movl (%1), %0 // Sample clock_ticks start value lfence .REPT 32 vsqrtpd %%ymm1,%%ymm1 //vpermd %%ymm1, %%ymm0, %%ymm1 .ENDR vmovq %%xmm1, %%rax movl (%1,%%rax,1), %%r13d // Sample clock_ticks end value (data dependent on completion of vsqrtpd chain) // [CON_LOOPS] .REPT 1 // Contending instructions vsqrtpd %%ymm2,%%ymm2 vsqrtpd %%ymm3,%%ymm3 vsqrtpd %%ymm4,%%ymm4 vsqrtpd %%ymm5,%%ymm5 vsqrtpd %%ymm6,%%ymm6 vsqrtpd %%ymm7,%%ymm7 vsqrtpd %%ymm8,%%ymm8 vsqrtpd %%ymm9,%%ymm9 vsqrtpd %%ymm10,%%ymm10 vsqrtpd %%ymm11,%%ymm11 vsqrtpd %%ymm12,%%ymm12 vsqrtpd %%ymm13,%%ymm13 vsqrtpd %%ymm14,%%ymm14 vsqrtpd %%ymm15,%%ymm15 .ENDR sub %0, %%r13d movl %%r13d, %0 )" : "=r"(cycle), "+r"(t), "+r"(indicies), "+r"(values), "=r"(result), "=r"(rdtsc0), "=r"(rdtsc1) : : "%r12", "%r13", "%eax", "%ebx", "%ecx", "%edx", "%ymm0", "%ymm1", "%ymm2", "%ymm3", "%ymm4", "%ymm5", "%ymm6", "%ymm7", "%ymm8", "%ymm9", "%ymm10", "%ymm11", "%ymm12", "%ymm13", "%ymm14", "%ymm15" ); //printf("cycle = %d, rdtsc = %d, ratio = %f\n", cycle, rdtsc1-rdtsc0, (double)(rdtsc1-rdtsc0)/cycle); return cycle; } void measure(char *msg, int (*f)(void)) { int i,n; //printf("%s", msg); printf("0"); for(n=0;n<10000;n++) { i = f(); printf(",%d", i); } printf("\n"); fflush(stdout); } void* clock_thread(void *p) { setaffinity(HT2); while (1) { ticks++; } return 0; } int main(void) { pthread_t t; setaffinity(HT1); pthread_create(&t, NULL, clock_thread, NULL); while (ticks == 0) {} measure("baseline-1", baseline_test); measure("contention-1", contention_test); measure("contention-2", contention_test); measure("baseline-2", baseline_test); return 0; }
the_stack_data/268631.c
/* $NetBSD: defines3.calc.c,v 1.1.1.2 2021/02/20 20:30:09 christos Exp $ */ /* original parser id follows */ /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ /* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ #define YYBYACC 1 #define YYMAJOR 2 #define YYMINOR 0 #define YYCHECK "yyyymmdd" #define YYEMPTY (-1) #define yyclearin (yychar = YYEMPTY) #define yyerrok (yyerrflag = 0) #define YYRECOVERING() (yyerrflag != 0) #define YYENOMEM (-2) #define YYEOF 0 #define YYPREFIX "yy" #define YYPURE 0 #line 2 "calc.y" # include <stdio.h> # include <ctype.h> int regs[26]; int base; extern int yylex(void); static void yyerror(const char *s); #line 31 "prefix.tab.c" #if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED) /* Default: YYSTYPE is the semantic value type. */ typedef int YYSTYPE; # define YYSTYPE_IS_DECLARED 1 #endif /* compatibility with bison */ #ifdef YYPARSE_PARAM /* compatibility with FreeBSD */ # ifdef YYPARSE_PARAM_TYPE # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM) # else # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM) # endif #else # define YYPARSE_DECL() yyparse(void) #endif /* Parameters sent to lex. */ #ifdef YYLEX_PARAM # define YYLEX_DECL() yylex(void *YYLEX_PARAM) # define YYLEX yylex(YYLEX_PARAM) #else # define YYLEX_DECL() yylex(void) # define YYLEX yylex() #endif #if !(defined(yylex) || defined(YYSTATE)) int YYLEX_DECL(); #endif /* Parameters sent to yyerror. */ #ifndef YYERROR_DECL #define YYERROR_DECL() yyerror(const char *s) #endif #ifndef YYERROR_CALL #define YYERROR_CALL(msg) yyerror(msg) #endif extern int YYPARSE_DECL(); #define DIGIT 257 #define LETTER 258 #define UMINUS 259 #define YYERRCODE 256 typedef short YYINT; static const YYINT yylhs[] = { -1, 0, 0, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, }; static const YYINT yylen[] = { 2, 0, 3, 3, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 1, 1, 1, 2, }; static const YYINT yydefred[] = { 1, 0, 0, 17, 0, 0, 0, 0, 0, 0, 3, 0, 15, 14, 0, 2, 0, 0, 0, 0, 0, 0, 0, 18, 0, 6, 0, 0, 0, 0, 9, 10, 11, }; static const YYINT yydgoto[] = { 1, 7, 8, 9, }; static const YYINT yysindex[] = { 0, -40, -7, 0, -55, -38, -38, 1, -29, -247, 0, -38, 0, 0, 22, 0, -38, -38, -38, -38, -38, -38, -38, 0, -29, 0, 51, 60, -20, -20, 0, 0, 0, }; static const YYINT yyrindex[] = { 0, 0, 0, 0, 2, 0, 0, 0, 9, -9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, -6, 14, 5, 13, 0, 0, 0, }; static const YYINT yygindex[] = { 0, 0, 65, 0, }; #define YYTABLESIZE 220 static const YYINT yytable[] = { 6, 16, 6, 10, 13, 5, 11, 5, 22, 17, 23, 15, 15, 20, 18, 7, 19, 22, 21, 4, 5, 0, 20, 8, 12, 0, 0, 21, 16, 16, 0, 0, 16, 16, 16, 13, 16, 0, 16, 15, 15, 0, 0, 7, 15, 15, 7, 15, 7, 15, 7, 8, 12, 0, 8, 12, 8, 0, 8, 22, 17, 0, 0, 25, 20, 18, 0, 19, 0, 21, 13, 14, 0, 0, 0, 0, 24, 0, 0, 0, 0, 26, 27, 28, 29, 30, 31, 32, 22, 17, 0, 0, 0, 20, 18, 16, 19, 22, 21, 0, 0, 0, 20, 18, 0, 19, 0, 21, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 13, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 8, 12, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 4, 3, 12, }; static const YYINT yycheck[] = { 40, 10, 40, 10, 10, 45, 61, 45, 37, 38, 257, 10, 10, 42, 43, 10, 45, 37, 47, 10, 10, -1, 42, 10, 10, -1, -1, 47, 37, 38, -1, -1, 41, 42, 43, 41, 45, -1, 47, 37, 38, -1, -1, 38, 42, 43, 41, 45, 43, 47, 45, 38, 38, -1, 41, 41, 43, -1, 45, 37, 38, -1, -1, 41, 42, 43, -1, 45, -1, 47, 5, 6, -1, -1, -1, -1, 11, -1, -1, -1, -1, 16, 17, 18, 19, 20, 21, 22, 37, 38, -1, -1, -1, 42, 43, 124, 45, 37, 47, -1, -1, -1, 42, 43, -1, 45, -1, 47, -1, -1, -1, -1, -1, -1, -1, 124, -1, -1, 124, -1, -1, -1, -1, -1, -1, -1, 124, -1, -1, 124, -1, -1, -1, -1, -1, -1, -1, 124, 124, -1, -1, -1, -1, -1, -1, -1, 124, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 256, 257, 258, 257, 258, }; #define YYFINAL 1 #ifndef YYDEBUG #define YYDEBUG 0 #endif #define YYMAXTOKEN 259 #define YYUNDFTOKEN 265 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a)) #if YYDEBUG static const char *const yyname[] = { "end-of-file",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,0,0,0, 0,0,0,0,0,0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,"DIGIT","LETTER","UMINUS",0,0,0,0,0,"illegal-symbol", }; static const char *const yyrule[] = { "$accept : list", "list :", "list : list stat '\\n'", "list : list error '\\n'", "stat : expr", "stat : LETTER '=' expr", "expr : '(' expr ')'", "expr : expr '+' expr", "expr : expr '-' expr", "expr : expr '*' expr", "expr : expr '/' expr", "expr : expr '%' expr", "expr : expr '&' expr", "expr : expr '|' expr", "expr : '-' expr", "expr : LETTER", "expr : number", "number : DIGIT", "number : number DIGIT", }; #endif #if YYDEBUG int yydebug; #endif int yyerrflag; int yychar; YYSTYPE yyval; YYSTYPE yylval; int yynerrs; /* define the initial stack-sizes */ #ifdef YYSTACKSIZE #undef YYMAXDEPTH #define YYMAXDEPTH YYSTACKSIZE #else #ifdef YYMAXDEPTH #define YYSTACKSIZE YYMAXDEPTH #else #define YYSTACKSIZE 10000 #define YYMAXDEPTH 10000 #endif #endif #define YYINITSTACKSIZE 200 typedef struct { unsigned stacksize; YYINT *s_base; YYINT *s_mark; YYINT *s_last; YYSTYPE *l_base; YYSTYPE *l_mark; } YYSTACKDATA; /* variables for the parser stack */ static YYSTACKDATA yystack; #line 66 "calc.y" /* start of programs */ int main (void) { while(!feof(stdin)) { yyparse(); } return 0; } static void yyerror(const char *s) { fprintf(stderr, "%s\n", s); } int yylex(void) { /* lexical analysis routine */ /* returns LETTER for a lower case letter, yylval = 0 through 25 */ /* return DIGIT for a digit, yylval = 0 through 9 */ /* all other characters are returned immediately */ int c; while( (c=getchar()) == ' ' ) { /* skip blanks */ } /* c is now nonblank */ if( islower( c )) { yylval = c - 'a'; return ( LETTER ); } if( isdigit( c )) { yylval = c - '0'; return ( DIGIT ); } return( c ); } #line 280 "prefix.tab.c" #if YYDEBUG #include <stdio.h> /* needed for printf */ #endif #include <stdlib.h> /* needed for malloc, etc */ #include <string.h> /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) { int i; unsigned newsize; YYINT *newss; YYSTYPE *newvs; if ((newsize = data->stacksize) == 0) newsize = YYINITSTACKSIZE; else if (newsize >= YYMAXDEPTH) return YYENOMEM; else if ((newsize *= 2) > YYMAXDEPTH) newsize = YYMAXDEPTH; i = (int) (data->s_mark - data->s_base); newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss)); if (newss == 0) return YYENOMEM; data->s_base = newss; data->s_mark = newss + i; newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)); if (newvs == 0) return YYENOMEM; data->l_base = newvs; data->l_mark = newvs + i; data->stacksize = newsize; data->s_last = data->s_base + newsize - 1; return 0; } #if YYPURE || defined(YY_NO_LEAKS) static void yyfreestack(YYSTACKDATA *data) { free(data->s_base); free(data->l_base); memset(data, 0, sizeof(*data)); } #else #define yyfreestack(data) /* nothing */ #endif #define YYABORT goto yyabort #define YYREJECT goto yyabort #define YYACCEPT goto yyaccept #define YYERROR goto yyerrlab int YYPARSE_DECL() { int yym, yyn, yystate; #if YYDEBUG const char *yys; if ((yys = getenv("YYDEBUG")) != 0) { yyn = *yys; if (yyn >= '0' && yyn <= '9') yydebug = yyn - '0'; } #endif yym = 0; yyn = 0; yynerrs = 0; yyerrflag = 0; yychar = YYEMPTY; yystate = 0; #if YYPURE memset(&yystack, 0, sizeof(yystack)); #endif if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystack.s_mark = yystack.s_base; yystack.l_mark = yystack.l_base; yystate = 0; *yystack.s_mark = 0; yyloop: if ((yyn = yydefred[yystate]) != 0) goto yyreduce; if (yychar < 0) { yychar = YYLEX; if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, yystate, yychar, yys); } #endif } if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, shifting to state %d\n", YYPREFIX, yystate, yytable[yyn]); #endif if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; yychar = YYEMPTY; if (yyerrflag > 0) --yyerrflag; goto yyloop; } if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { yyn = yytable[yyn]; goto yyreduce; } if (yyerrflag != 0) goto yyinrecovery; YYERROR_CALL("syntax error"); goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: ++yynerrs; yyinrecovery: if (yyerrflag < 3) { yyerrflag = 3; for (;;) { if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, error recovery shifting\ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]); #endif if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; goto yyloop; } else { #if YYDEBUG if (yydebug) printf("%sdebug: error recovery discarding state %d\n", YYPREFIX, *yystack.s_mark); #endif if (yystack.s_mark <= yystack.s_base) goto yyabort; --yystack.s_mark; --yystack.l_mark; } } } else { if (yychar == YYEOF) goto yyabort; #if YYDEBUG if (yydebug) { if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } #endif yychar = YYEMPTY; goto yyloop; } yyreduce: #if YYDEBUG if (yydebug) printf("%sdebug: state %d, reducing by rule %d (%s)\n", YYPREFIX, yystate, yyn, yyrule[yyn]); #endif yym = yylen[yyn]; if (yym > 0) yyval = yystack.l_mark[1-yym]; else memset(&yyval, 0, sizeof yyval); switch (yyn) { case 3: #line 28 "calc.y" { yyerrok ; } break; case 4: #line 32 "calc.y" { printf("%d\n",yystack.l_mark[0]);} break; case 5: #line 34 "calc.y" { regs[yystack.l_mark[-2]] = yystack.l_mark[0]; } break; case 6: #line 38 "calc.y" { yyval = yystack.l_mark[-1]; } break; case 7: #line 40 "calc.y" { yyval = yystack.l_mark[-2] + yystack.l_mark[0]; } break; case 8: #line 42 "calc.y" { yyval = yystack.l_mark[-2] - yystack.l_mark[0]; } break; case 9: #line 44 "calc.y" { yyval = yystack.l_mark[-2] * yystack.l_mark[0]; } break; case 10: #line 46 "calc.y" { yyval = yystack.l_mark[-2] / yystack.l_mark[0]; } break; case 11: #line 48 "calc.y" { yyval = yystack.l_mark[-2] % yystack.l_mark[0]; } break; case 12: #line 50 "calc.y" { yyval = yystack.l_mark[-2] & yystack.l_mark[0]; } break; case 13: #line 52 "calc.y" { yyval = yystack.l_mark[-2] | yystack.l_mark[0]; } break; case 14: #line 54 "calc.y" { yyval = - yystack.l_mark[0]; } break; case 15: #line 56 "calc.y" { yyval = regs[yystack.l_mark[0]]; } break; case 17: #line 61 "calc.y" { yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; } break; case 18: #line 63 "calc.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; #line 539 "prefix.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; yystack.l_mark -= yym; yym = yylhs[yyn]; if (yystate == 0 && yym == 0) { #if YYDEBUG if (yydebug) printf("%sdebug: after reduction, shifting from state 0 to\ state %d\n", YYPREFIX, YYFINAL); #endif yystate = YYFINAL; *++yystack.s_mark = YYFINAL; *++yystack.l_mark = yyval; if (yychar < 0) { yychar = YYLEX; if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } #endif } if (yychar == YYEOF) goto yyaccept; goto yyloop; } if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) yystate = yytable[yyn]; else yystate = yydgoto[yym]; #if YYDEBUG if (yydebug) printf("%sdebug: after reduction, shifting from state %d \ to state %d\n", YYPREFIX, *yystack.s_mark, yystate); #endif if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; *++yystack.s_mark = (YYINT) yystate; *++yystack.l_mark = yyval; goto yyloop; yyoverflow: YYERROR_CALL("yacc stack overflow"); yyabort: yyfreestack(&yystack); return (1); yyaccept: yyfreestack(&yystack); return (0); }
the_stack_data/173578474.c
extern void __VERIFIER_error() __attribute__ ((__noreturn__)); void __VERIFIER_assert(int expression) { if (!expression) { ERROR: /* assert not proved */ /* assert not proved */ __VERIFIER_error(); }; return; } int __global_lock; void __VERIFIER_atomic_begin() { /* reachable */ /* reachable */ /* reachable */ /* reachable */ /* reachable */ /* reachable */ /* reachable */ __VERIFIER_assume(__global_lock==0); __global_lock=1; return; } void __VERIFIER_atomic_end() { __VERIFIER_assume(__global_lock==1); __global_lock=0; return; } #include "assert.h" #include "pthread.h" #ifndef TRUE #define TRUE (_Bool)1 #endif #ifndef FALSE #define FALSE (_Bool)0 #endif #ifndef NULL #define NULL ((void*)0) #endif #ifndef FENCE #define FENCE(x) ((void)0) #endif #ifndef IEEE_FLOAT_EQUAL #define IEEE_FLOAT_EQUAL(x,y) (x==y) #endif #ifndef IEEE_FLOAT_NOTEQUAL #define IEEE_FLOAT_NOTEQUAL(x,y) (x!=y) #endif void * P0(void *arg); void * P1(void *arg); void * P2(void *arg); void fence(); void isync(); void lwfence(); int __unbuffered_cnt; int __unbuffered_cnt = 0; int __unbuffered_p2_EAX; int __unbuffered_p2_EAX = 0; int __unbuffered_p2_EBX; int __unbuffered_p2_EBX = 0; _Bool main$tmp_guard0; _Bool main$tmp_guard1; int x; int x = 0; _Bool x$flush_delayed; int x$mem_tmp; _Bool x$r_buff0_thd0; _Bool x$r_buff0_thd1; _Bool x$r_buff0_thd2; _Bool x$r_buff0_thd3; _Bool x$r_buff1_thd0; _Bool x$r_buff1_thd1; _Bool x$r_buff1_thd2; _Bool x$r_buff1_thd3; _Bool x$read_delayed; int *x$read_delayed_var; int x$w_buff0; _Bool x$w_buff0_used; int x$w_buff1; _Bool x$w_buff1_used; int y; int y = 0; _Bool weak$$choice0; _Bool weak$$choice2; void * P0(void *arg) { __VERIFIER_atomic_begin(); y = 2; __VERIFIER_atomic_end(); __VERIFIER_atomic_begin(); x = 1; __VERIFIER_atomic_end(); __VERIFIER_atomic_begin(); x = x$w_buff0_used && x$r_buff0_thd1 ? x$w_buff0 : (x$w_buff1_used && x$r_buff1_thd1 ? x$w_buff1 : x); x$w_buff0_used = x$w_buff0_used && x$r_buff0_thd1 ? FALSE : x$w_buff0_used; x$w_buff1_used = x$w_buff0_used && x$r_buff0_thd1 || x$w_buff1_used && x$r_buff1_thd1 ? FALSE : x$w_buff1_used; x$r_buff0_thd1 = x$w_buff0_used && x$r_buff0_thd1 ? FALSE : x$r_buff0_thd1; x$r_buff1_thd1 = x$w_buff0_used && x$r_buff0_thd1 || x$w_buff1_used && x$r_buff1_thd1 ? FALSE : x$r_buff1_thd1; __VERIFIER_atomic_end(); __VERIFIER_atomic_begin(); __unbuffered_cnt = __unbuffered_cnt + 1; __VERIFIER_atomic_end(); return nondet_0(); } void * P1(void *arg) { __VERIFIER_atomic_begin(); x$w_buff1 = x$w_buff0; x$w_buff0 = 2; x$w_buff1_used = x$w_buff0_used; x$w_buff0_used = TRUE; __VERIFIER_assert(!(x$w_buff1_used && x$w_buff0_used)); x$r_buff1_thd0 = x$r_buff0_thd0; x$r_buff1_thd1 = x$r_buff0_thd1; x$r_buff1_thd2 = x$r_buff0_thd2; x$r_buff1_thd3 = x$r_buff0_thd3; x$r_buff0_thd2 = TRUE; __VERIFIER_atomic_end(); __VERIFIER_atomic_begin(); y = 1; __VERIFIER_atomic_end(); __VERIFIER_atomic_begin(); x = x$w_buff0_used && x$r_buff0_thd2 ? x$w_buff0 : (x$w_buff1_used && x$r_buff1_thd2 ? x$w_buff1 : x); x$w_buff0_used = x$w_buff0_used && x$r_buff0_thd2 ? FALSE : x$w_buff0_used; x$w_buff1_used = x$w_buff0_used && x$r_buff0_thd2 || x$w_buff1_used && x$r_buff1_thd2 ? FALSE : x$w_buff1_used; x$r_buff0_thd2 = x$w_buff0_used && x$r_buff0_thd2 ? FALSE : x$r_buff0_thd2; x$r_buff1_thd2 = x$w_buff0_used && x$r_buff0_thd2 || x$w_buff1_used && x$r_buff1_thd2 ? FALSE : x$r_buff1_thd2; __VERIFIER_atomic_end(); __VERIFIER_atomic_begin(); __unbuffered_cnt = __unbuffered_cnt + 1; __VERIFIER_atomic_end(); return nondet_0(); } void * P2(void *arg) { __VERIFIER_atomic_begin(); __unbuffered_p2_EAX = y; __VERIFIER_atomic_end(); __VERIFIER_atomic_begin(); __unbuffered_p2_EBX = y; __VERIFIER_atomic_end(); __VERIFIER_atomic_begin(); x = x$w_buff0_used && x$r_buff0_thd3 ? x$w_buff0 : (x$w_buff1_used && x$r_buff1_thd3 ? x$w_buff1 : x); x$w_buff0_used = x$w_buff0_used && x$r_buff0_thd3 ? FALSE : x$w_buff0_used; x$w_buff1_used = x$w_buff0_used && x$r_buff0_thd3 || x$w_buff1_used && x$r_buff1_thd3 ? FALSE : x$w_buff1_used; x$r_buff0_thd3 = x$w_buff0_used && x$r_buff0_thd3 ? FALSE : x$r_buff0_thd3; x$r_buff1_thd3 = x$w_buff0_used && x$r_buff0_thd3 || x$w_buff1_used && x$r_buff1_thd3 ? FALSE : x$r_buff1_thd3; __VERIFIER_atomic_end(); __VERIFIER_atomic_begin(); __unbuffered_cnt = __unbuffered_cnt + 1; __VERIFIER_atomic_end(); return nondet_0(); } void fence() { } void isync() { } void lwfence() { } int main() { pthread_create(NULL, NULL, P0, NULL); pthread_create(NULL, NULL, P1, NULL); pthread_create(NULL, NULL, P2, NULL); __VERIFIER_atomic_begin(); main$tmp_guard0 = __unbuffered_cnt == 3; __VERIFIER_atomic_end(); __VERIFIER_assume(main$tmp_guard0); __VERIFIER_atomic_begin(); x = x$w_buff0_used && x$r_buff0_thd0 ? x$w_buff0 : (x$w_buff1_used && x$r_buff1_thd0 ? x$w_buff1 : x); x$w_buff0_used = x$w_buff0_used && x$r_buff0_thd0 ? FALSE : x$w_buff0_used; x$w_buff1_used = x$w_buff0_used && x$r_buff0_thd0 || x$w_buff1_used && x$r_buff1_thd0 ? FALSE : x$w_buff1_used; x$r_buff0_thd0 = x$w_buff0_used && x$r_buff0_thd0 ? FALSE : x$r_buff0_thd0; x$r_buff1_thd0 = x$w_buff0_used && x$r_buff0_thd0 || x$w_buff1_used && x$r_buff1_thd0 ? FALSE : x$r_buff1_thd0; __VERIFIER_atomic_end(); __VERIFIER_atomic_begin(); /* Program was expected to be safe for X86, model checker should have said NO. This likely is a bug in the tool chain. */ weak$$choice0 = nondet_1(); /* Program was expected to be safe for X86, model checker should have said NO. This likely is a bug in the tool chain. */ weak$$choice2 = nondet_1(); /* Program was expected to be safe for X86, model checker should have said NO. This likely is a bug in the tool chain. */ x$flush_delayed = weak$$choice2; /* Program was expected to be safe for X86, model checker should have said NO. This likely is a bug in the tool chain. */ x$mem_tmp = x; /* Program was expected to be safe for X86, model checker should have said NO. This likely is a bug in the tool chain. */ x = !x$w_buff0_used || !x$r_buff0_thd0 && !x$w_buff1_used || !x$r_buff0_thd0 && !x$r_buff1_thd0 ? x : (x$w_buff0_used && x$r_buff0_thd0 ? x$w_buff0 : x$w_buff1); /* Program was expected to be safe for X86, model checker should have said NO. This likely is a bug in the tool chain. */ x$w_buff0 = weak$$choice2 ? x$w_buff0 : (!x$w_buff0_used || !x$r_buff0_thd0 && !x$w_buff1_used || !x$r_buff0_thd0 && !x$r_buff1_thd0 ? x$w_buff0 : (x$w_buff0_used && x$r_buff0_thd0 ? x$w_buff0 : x$w_buff0)); /* Program was expected to be safe for X86, model checker should have said NO. This likely is a bug in the tool chain. */ x$w_buff1 = weak$$choice2 ? x$w_buff1 : (!x$w_buff0_used || !x$r_buff0_thd0 && !x$w_buff1_used || !x$r_buff0_thd0 && !x$r_buff1_thd0 ? x$w_buff1 : (x$w_buff0_used && x$r_buff0_thd0 ? x$w_buff1 : x$w_buff1)); /* Program was expected to be safe for X86, model checker should have said NO. This likely is a bug in the tool chain. */ x$w_buff0_used = weak$$choice2 ? x$w_buff0_used : (!x$w_buff0_used || !x$r_buff0_thd0 && !x$w_buff1_used || !x$r_buff0_thd0 && !x$r_buff1_thd0 ? x$w_buff0_used : (x$w_buff0_used && x$r_buff0_thd0 ? FALSE : x$w_buff0_used)); /* Program was expected to be safe for X86, model checker should have said NO. This likely is a bug in the tool chain. */ x$w_buff1_used = weak$$choice2 ? x$w_buff1_used : (!x$w_buff0_used || !x$r_buff0_thd0 && !x$w_buff1_used || !x$r_buff0_thd0 && !x$r_buff1_thd0 ? x$w_buff1_used : (x$w_buff0_used && x$r_buff0_thd0 ? FALSE : FALSE)); /* Program was expected to be safe for X86, model checker should have said NO. This likely is a bug in the tool chain. */ x$r_buff0_thd0 = weak$$choice2 ? x$r_buff0_thd0 : (!x$w_buff0_used || !x$r_buff0_thd0 && !x$w_buff1_used || !x$r_buff0_thd0 && !x$r_buff1_thd0 ? x$r_buff0_thd0 : (x$w_buff0_used && x$r_buff0_thd0 ? FALSE : x$r_buff0_thd0)); /* Program was expected to be safe for X86, model checker should have said NO. This likely is a bug in the tool chain. */ x$r_buff1_thd0 = weak$$choice2 ? x$r_buff1_thd0 : (!x$w_buff0_used || !x$r_buff0_thd0 && !x$w_buff1_used || !x$r_buff0_thd0 && !x$r_buff1_thd0 ? x$r_buff1_thd0 : (x$w_buff0_used && x$r_buff0_thd0 ? FALSE : FALSE)); /* Program was expected to be safe for X86, model checker should have said NO. This likely is a bug in the tool chain. */ main$tmp_guard1 = !(x == 2 && y == 2 && __unbuffered_p2_EAX == 1 && __unbuffered_p2_EBX == 1); /* Program was expected to be safe for X86, model checker should have said NO. This likely is a bug in the tool chain. */ x = x$flush_delayed ? x$mem_tmp : x; /* Program was expected to be safe for X86, model checker should have said NO. This likely is a bug in the tool chain. */ x$flush_delayed = FALSE; __VERIFIER_atomic_end(); /* Program was expected to be safe for X86, model checker should have said NO. This likely is a bug in the tool chain. */ __VERIFIER_assert(main$tmp_guard1); /* reachable */ return 0; }
the_stack_data/76699220.c
// Created by ganesh bhandarkar #include<stdio.h> #include<stdlib.h> #include<time.h> int main(){ srand(time(0)); int n;scanf("%d",&n); int m;scanf("%d",&m); int a[n],b[m]; for(int i=0;i<n;i++)scanf("%d",&a[i]); for(int i=0;i<m;i++)scanf("%d",&b[i]); int i=0; int j=0; int k=0; int t[m+n]; while(i<=n && j<=(n+m)){ if(a[i]<b[j]){ t[k++]=a[i++]; }else{ t[k++]=b[j++]; } } while(i<n){ t[k++]=a[i++]; } while(j<(m+n)){ t[k++]=b[j++]; } for(int i=0;i<(m+n);i++)printf("%d ",t[i]); return 0; }
the_stack_data/95449796.c
#include <stdio.h> #include <stdlib.h> #define ARR_SIZE 11 void findBruteForce( int * arr, int arr_size){ int * visited = calloc(arr_size, sizeof(int)); for (int i = 0; i < arr_size ; i++) { int x = arr[i]; if(visited[i]==0) { int isDuplicate = 0; for (int j = i + 1; j < arr_size; j++) { if (x == arr[j]) { isDuplicate = 1; visited[j] = 1; } } if (isDuplicate == 0) printf("Element appear only once in array - %d\n", x); } } free(visited); } int main(int argc, char *argv[]) { int arr[ARR_SIZE] = { 1,5,6,2,1,6,4,3,2,5,3 }; findBruteForce(arr, ARR_SIZE); return 0; }
the_stack_data/82950551.c
#include <unistd.h> int main(int argc, char **argv) { int i, aux; do { i = read(0, &aux, 1); } while (i > 0); return 0; }
the_stack_data/27239.c
/* Defined in scandir.c. */
the_stack_data/173577462.c
#include <stdio.h> #include <stdint.h> int main(void) { printf("Hello from our custom Yocto app!"); return 0; }
the_stack_data/175142938.c
/* * emcc -g0 -O3 -s SIDE_MODULE=1 -s STRICT=1 -s WASM=1 -s ONLY_MY_CODE=1 -o fib.c.wasm fib.c * gcc -g0 -O3 fib.c -o fib.c.elf */ #include <stdint.h> #define WASM_EXPORT __attribute__((used)) __attribute__((visibility ("default"))) WASM_EXPORT uint32_t fib(uint32_t n) { if(n < 2) { return n; } return fib(n-1) + fib(n-2); } int parseInt(char* str) { int res = 0; for (int i = 0; str[i] != '\0'; ++i) { res = res * 10 + str[i] - '0'; } return res; } WASM_EXPORT int main(int args, char* argv[]) { uint32_t n = parseInt(argv[1]); return fib(n); }
the_stack_data/153269031.c
#include <stdio.h> #include <stdlib.h> int *merge(int *arr1, int size1, int *arr2, int size2) { int *merged_array = malloc(sizeof(int) * (size1 + size2)); int merged_length = 0; int i = 0; int k = 0; // While merged array not full while (merged_length < (size1 + size2)) { // If done with arr1 if (i == size1) { // while k != size2 while (k != size2) { // Add arr2[k] to merged_array *(merged_array + merged_length) = *(arr2 + k); // increment k and merged_length k ++; merged_length ++; }; // else if done with arr2 } else if (k == size2) { // while i != size1 while (i != size1) { // Add arr1[i] to merged_array *(merged_array + merged_length) = *(arr1 + i); // increment i and merged_length i ++; merged_length ++; }; // else if arr1[i] < arr2[k] } else if (*(arr1 + i) < *(arr2 + k)) { // Add arr1[i] to merged_array *(merged_array + merged_length) = *(arr1 + i); // Increment i and merged_length i ++; merged_length ++; // else if arr2[k] < arr1[i] } else if (*(arr2 + k) < *(arr1 + i)) { // Add arr2[k] to merged_array *(merged_array + merged_length) = *(arr2 + k); // Increment k and merged_length k ++; merged_length ++; }; }; return merged_array; } int main() { int arr_a[2] = {1, 3}; int arr_b[2] = {2, 5}; int *merged_array = merge(arr_a, 2, arr_b, 2); int x = 0; for (x = 0; x < 4; x++) { printf("Value %d: %d\n", x, *(merged_array + x)); } return 0; }
the_stack_data/248580546.c
/*****************************************************************/ /* evalb [-p param_file] [-dh] [-e n] gold-file test-file */ /* */ /* Evaluate bracketing in test-file against gold-file. */ /* Return recall, precision, tagging accuracy. */ /* */ /* <option> */ /* -p param_file parameter file */ /* -d debug mode */ /* -e n number of error to kill (default=10) */ /* -h help */ /* */ /* Satoshi Sekine (NYU) */ /* Mike Collins (UPenn) */ /* */ /* October.1997 */ /*****************************************************************/ #include <stdio.h> #include <stdlib.h> //### added for exit, atoi decls #include <ctype.h> #include <string.h> #include <malloc.h> /* Internal Data format -------------------------------------------*/ /* */ /* (S (NP (NNX this)) (VP (VBX is) (NP (DT a) (NNX pen))) (SYM .)) */ /* */ /* wn=5 */ /* word label */ /* terminal[0] = this NNX */ /* terminal[1] = is VBX */ /* terminal[2] = a DT */ /* terminal[3] = pen NNX */ /* terminal[4] = . SYM */ /* */ /* bn=4 */ /* start end label */ /* bracket[0] = 0 5 S */ /* bracket[1] = 0 0 NP */ /* bracket[2] = 1 4 VP */ /* bracket[3] = 2 4 NP */ /* */ /* matched bracketing */ /* Recall = --------------------------- */ /* # of bracket in ref-data */ /* */ /* matched bracketing */ /* Recall = --------------------------- */ /* # of bracket in test-data */ /* */ /*-----------------------------------------------------------------*/ /******************/ /* constant macro */ /******************/ #define MAX_SENT_LEN 5000 #define MAX_WORD_IN_SENT 200 #define MAX_BRACKET_IN_SENT 200 #define MAX_WORD_LEN 100 #define MAX_LABEL_LEN 30 #define MAX_DELETE_LABEL 100 #define MAX_EQ_LABEL 100 #define MAX_EQ_WORD 100 #define MAX_LINE_LEN 500 #define DEFAULT_MAX_ERROR 10 #define DEFAULT_CUT_LEN 40 /*************/ /* structure */ /*************/ typedef struct ss_terminal { char word[MAX_WORD_LEN]; char label[MAX_LABEL_LEN]; int result; /* 0:unmatch, 1:match, 9:undef */ } s_terminal; typedef struct ss_bracket { int start; int end; unsigned int buf_start; unsigned int buf_end; char label[MAX_LABEL_LEN]; int result; /* 0: unmatch, 1:match, 5:delete 9:undef */ } s_bracket; typedef struct ss_equiv { char *s1; char *s2; } s_equiv; /****************************/ /* global variables */ /* gold-data: suffix = 1 */ /* test-data: suffix = 2 */ /****************************/ /*---------------*/ /* Sentence data */ /*---------------*/ int wn1, wn2; /* number of words in sentence */ int r_wn1; /* number of words in sentence */ /* which only ignores labels in */ /* DELETE_LABEL_FOR_LENGTH */ s_terminal terminal1[MAX_WORD_IN_SENT]; /* terminal information */ s_terminal terminal2[MAX_WORD_IN_SENT]; int bn1, bn2; /* number of brackets */ int r_bn1, r_bn2; /* number of brackets */ /* after deletion */ s_bracket bracket1[MAX_BRACKET_IN_SENT]; /* bracket information */ s_bracket bracket2[MAX_BRACKET_IN_SENT]; /*------------*/ /* Total data */ /*------------*/ int TOTAL_bn1, TOTAL_bn2, TOTAL_match; /* total number of brackets */ int TOTAL_sent; /* No. of sentence */ int TOTAL_error_sent; /* No. of error sentence */ int TOTAL_skip_sent; /* No. of skip sentence */ int TOTAL_comp_sent; /* No. of complete match sent */ int TOTAL_word; /* total number of word */ int TOTAL_crossing; /* total crossing */ int TOTAL_no_crossing; /* no crossing sentence */ int TOTAL_2L_crossing; /* 2 or less crossing sentence */ int TOTAL_correct_tag; /* total correct tagging */ int TOT_cut_len = DEFAULT_CUT_LEN; /* Cut-off length in statistics */ /* data for sentences with len <= CUT_LEN */ /* Historically it was 40. */ int TOT40_bn1, TOT40_bn2, TOT40_match; /* total number of brackets */ int TOT40_sent; /* No. of sentence */ int TOT40_error_sent; /* No. of error sentence */ int TOT40_skip_sent; /* No. of skip sentence */ int TOT40_comp_sent; /* No. of complete match sent */ int TOT40_word; /* total number of word */ int TOT40_crossing; /* total crossing */ int TOT40_no_crossing; /* no crossing sentence */ int TOT40_2L_crossing; /* 2 or less crossing sentence */ int TOT40_correct_tag; /* total correct tagging */ /*------------*/ /* miscallous */ /*------------*/ int Line; /* line number */ int Error_count = 0; /* Error count */ int Status; /* Result status for each sent */ /* 0: OK, 1: skip, 2: error */ /*-------------------*/ /* stack manuplation */ /*-------------------*/ int stack_top; int stack[MAX_BRACKET_IN_SENT]; /************************************************************/ /* User parameters which can be specified in parameter file */ /************************************************************/ /*------------------------------------------*/ /* Debug mode */ /* print out data for individual sentence */ /*------------------------------------------*/ int DEBUG=0; /*------------------------------------------*/ /* MAX error */ /* Number of error to stop the process. */ /* This is useful if there could be */ /* tokanization error. */ /* The process will stop when this number*/ /* of errors are accumulated. */ /*------------------------------------------*/ int Max_error = DEFAULT_MAX_ERROR; /*------------------------------------------*/ /* Cut-off length for statistics */ /* int TOT_cut_len = DEFAULT_CUT_LEN; */ /* (Defined above) */ /*------------------------------------------*/ /*------------------------------------------*/ /* unlabeled or labeled bracketing */ /* 0: unlabeled bracketing */ /* 1: labeled bracketing */ /*------------------------------------------*/ int F_label = 1; /*------------------------------------------*/ /* Delete labels */ /* list of labels to be ignored. */ /* If it is a pre-terminal label, delete */ /* the word along with the brackets. */ /* If it is a non-terminal label, just */ /* delete the brackets (don't delete */ /* childrens). */ /*------------------------------------------*/ char *Delete_label[MAX_DELETE_LABEL]; int Delete_label_n = 0; /*------------------------------------------*/ /* Delete labels for length calculation */ /* list of labels to be ignored for */ /* length calculation purpose */ /*------------------------------------------*/ char *Delete_label_for_length[MAX_DELETE_LABEL]; int Delete_label_for_length_n = 0; /*------------------------------------------*/ /* Equivalent labels, words */ /* the pairs are considered equivalent */ /* This is non-directional. */ /*------------------------------------------*/ s_equiv EQ_label[MAX_EQ_LABEL]; int EQ_label_n = 0; s_equiv EQ_word[MAX_EQ_WORD]; int EQ_word_n = 0; /************************/ /* Function return-type */ /************************/ int main(); void init_global(); void print_head(); void init(); void read_parameter_file(); void set_param(); int narg(); int read_line(); void pushb(); int popb(); int stackempty(); void calc_result(unsigned char *buf1,unsigned char *buf); void massage_data(); void modify_label(); void individual_result(); void print_total(); void dsp_info(); int is_terminator(); int is_deletelabel(); int is_deletelabel_for_length(); int word_comp(); int label_comp(); void Error(); void Fatal(); void Usage(); /* ### provided by std headers int fprintf(); int printf(); int atoi(); int fclose(); int sscanf(); */ /***********/ /* program */ /***********/ #define ARG_CHECK(st) if(!(*++(*argv) || (--argc && *++argv))){ \ fprintf(stderr,"Missing argument: %s\n",st); \ } int main(argc,argv) int argc; char *argv[]; { char *filename1, *filename2; FILE *fd1, *fd2; unsigned char buff[5000]; unsigned char buff1[5000]; filename1=NULL; filename2=NULL; for(argc--,argv++;argc>0;argc--,argv++){ if(**argv == '-'){ while(*++(*argv)){ switch(**argv){ case 'h': /* help */ Usage(); exit(1); case 'd': /* debug mode */ DEBUG = 1; goto nextarg; case 'c': /* cut-off length */ ARG_CHECK("cut-off length for statistices"); TOT_cut_len = atoi(*argv); goto nextarg; case 'e': /* max error */ ARG_CHECK("number of error to kill"); Max_error = atoi(*argv); goto nextarg; case 'p': /* parameter file */ ARG_CHECK("parameter file"); read_parameter_file(*argv); goto nextarg; default: Usage(); exit(0); } } } else { if(filename1==NULL){ filename1 = *argv; }else if(filename2==NULL){ filename2 = *argv; } } nextarg: continue; } init_global(); if((fd1 = fopen(filename1,"r"))==NULL){ Fatal("Can't open gold file (%s)\n",filename1); } if((fd2 = fopen(filename2,"r"))==NULL){ Fatal("Can't open test file (%s)\n",filename2); } print_head(); for(Line=1;fgets(buff,5000,fd1)!=NULL;Line++){ init(); /* READ 1 */ r_wn1 = read_line(buff,terminal1,&wn1,bracket1,&bn1); strcpy(buff1,buff); /* READ 2 */ if(fgets(buff,5000,fd2)==NULL){ Error("Number of lines unmatch (too many lines in gold file)\n"); break; } read_line(buff,terminal2,&wn2,bracket2,&bn2); /* Calculate result and print it */ calc_result(buff1,buff); if(DEBUG==1){ dsp_info(); } } if(fgets(buff,5000,fd2)!=NULL){ Error("Number of lines unmatch (too many lines in test file)\n"); } print_total(); return (0); } /*-----------------------------*/ /* initialize global variables */ /*-----------------------------*/ void init_global() { TOTAL_bn1 = TOTAL_bn2 = TOTAL_match = 0; TOTAL_sent = TOTAL_error_sent = TOTAL_skip_sent = TOTAL_comp_sent = 0; TOTAL_word = TOTAL_correct_tag = 0; TOTAL_crossing = 0; TOTAL_no_crossing = TOTAL_2L_crossing = 0; TOT40_bn1 = TOT40_bn2 = TOT40_match = 0; TOT40_sent = TOT40_error_sent = TOT40_skip_sent = TOT40_comp_sent = 0; TOT40_word = TOT40_correct_tag = 0; TOT40_crossing = 0; TOT40_no_crossing = TOT40_2L_crossing = 0; } /*------------------*/ /* print head title */ /*------------------*/ void print_head() { printf(" Sent. Matched Bracket Cross Correct Tag\n"); printf(" ID Len. Stat. Recal Prec. Bracket gold test Bracket Words Tags Accracy\n"); printf("============================================================================\n"); } /*-----------------------------------------------*/ /* initialization at each individual computation */ /*-----------------------------------------------*/ void init() { int i; wn1 = 0; wn2 = 0; bn1 = 0; bn2 = 0; r_bn1 = 0; r_bn2 = 0; for(i=0;i<MAX_WORD_IN_SENT;i++){ terminal1[i].word[0] = '\0'; terminal1[i].label[0] = '\0'; terminal1[i].result = 9; terminal2[i].word[0] = '\0'; terminal2[i].label[0] = '\0'; terminal2[i].result = 9; } for(i=0;i<MAX_BRACKET_IN_SENT;i++){ bracket1[i].start = -1; bracket1[i].end = -1; bracket1[i].label[0] = '\0'; bracket1[i].result = 9; bracket2[i].start = -1; bracket2[i].end = -1; bracket2[i].label[0] = '\0'; bracket2[i].result = 9; } Status = 0; } /*----------------*/ /* parameter file */ /*----------------*/ void read_parameter_file(filename) char *filename; { char buff[MAX_LINE_LEN]; FILE *fd; int line; int i; if((fd=fopen(filename,"r"))==NULL){ Fatal("Can't open parameter file (%s)\n",filename); } for(line=1;fgets(buff,MAX_LINE_LEN,fd)!=NULL;line++){ /* clean up the tail and find unvalid line */ /*-----------------------------------------*/ for(i=strlen(buff)-1;i>0 && (isspace(buff[i]) || buff[i]=='\n');i--){ buff[i]='\0'; } if(buff[0]=='#' || /* comment-line */ strlen(buff)<3){ /* too short, just ignore */ continue; } /* place the parameter and value */ /*-------------------------------*/ for(i=0;!isspace(buff[i]);i++); for(;isspace(buff[i]) && buff[i]!='\0';i++); if(buff[i]=='\0'){ fprintf(stderr,"Empty value in parameter file (%d)\n",line); } /* set parameter and value */ /*-------------------------*/ set_param(buff,buff+i); } fclose(fd); } #define STRNCMP(s) (strncmp(param,s,strlen(s))==0 && \ (param[strlen(s)]=='\0' || isspace(param[strlen(s)]))) void set_param(param,value) char *param, *value; { char l1[MAX_LABEL_LEN], l2[MAX_LABEL_LEN]; if(STRNCMP("DEBUG")){ DEBUG = atoi(value); }else if(STRNCMP("MAX_ERROR")){ Max_error = atoi(value); }else if(STRNCMP("CUTOFF_LEN")){ TOT_cut_len = atoi(value); }else if(STRNCMP("LABELED")){ F_label = atoi(value); }else if(STRNCMP("DELETE_LABEL")){ Delete_label[Delete_label_n] = (char *)malloc(strlen(value)+1); strcpy(Delete_label[Delete_label_n],value); Delete_label_n++; }else if(STRNCMP("DELETE_LABEL_FOR_LENGTH")){ Delete_label_for_length[Delete_label_for_length_n] = (char *)malloc(strlen(value)+1); strcpy(Delete_label_for_length[Delete_label_for_length_n],value); Delete_label_for_length_n++; }else if(STRNCMP("EQ_LABEL")){ if(narg(value)!=2){ fprintf(stderr,"EQ_LABEL requires two values\n"); return; } sscanf(value,"%s %s",l1,l2); EQ_label[EQ_label_n].s1 = (char *)malloc(strlen(l1)+1); strcpy(EQ_label[EQ_label_n].s1,l1); EQ_label[EQ_label_n].s2 = (char *)malloc(strlen(l2)+1); strcpy(EQ_label[EQ_label_n].s2,l2); EQ_label_n++; }else if(STRNCMP("EQ_WORD")){ if(narg(value)!=2){ fprintf(stderr,"EQ_WORD requires two values\n"); return; } sscanf(value,"%s %s",l1,l2); EQ_word[EQ_word_n].s1 = (char *)malloc(strlen(l1)+1); strcpy(EQ_word[EQ_word_n].s1,l1); EQ_word[EQ_word_n].s2 = (char *)malloc(strlen(l2)+1); strcpy(EQ_word[EQ_word_n].s2,l2); EQ_word_n++; }else{ fprintf(stderr,"Unknown keyword (%s) in parameter file\n",param); } } int narg(s) char *s; { int n; for(n=0;*s!='\0';){ for(;isspace(*s);s++); if(*s=='\0'){ break; } n++; for(;!isspace(*s);s++){ if(*s=='\0'){ break; } } } return(n); } /*-----------------------------*/ /* Read line and gather data. */ /* Return langth of sentence. */ /*-----------------------------*/ int read_line(buff, terminal, wn, bracket, bn) char *buff; s_terminal terminal[]; int *wn; s_bracket bracket[]; int *bn; { char *p, *q, label[MAX_LABEL_LEN], word[MAX_WORD_LEN]; int wid, bid; /* word ID, bracket ID */ int n; /* temporary remembering the position */ int b; /* temporary remembering bid */ int i; int len; /* length of the sentence */ len = 0; stack_top=0; for(p=buff,wid=0,bid=0;*p!='\0';){ if(isspace(*p)){ p++; continue; /* open bracket */ /*--------------*/ }else if(*p=='('){ n=wid; for(p++,i=0;!is_terminator(*p);p++,i++){ label[i]=*p; } label[i]='\0'; /* Find terminals */ q = p; if(isspace(*q)){ for(q++;isspace(*q);q++); for(i=0;!is_terminator(*q);q++,i++){ word[i]=*q; } word[i]='\0'; /* compute length */ if(*q==')' && !is_deletelabel_for_length(label)==1){ len++; } /* delete terminal */ if(*q==')' && is_deletelabel(label)==1){ p = q+1; continue; /* valid terminal */ }else if(*q==')'){ strcpy(terminal[wid].word,word); strcpy(terminal[wid].label,label); wid++; p = q+1; continue; /* error */ }else if(*q!='('){ Error("More than two elements in a bracket\n"); } } /* otherwise non-terminal label */ bracket[bid].start = wid; bracket[bid].buf_start = p-buff; strcpy(bracket[bid].label,label); pushb(bid); bid++; /* close bracket */ /*---------------*/ }else if(*p==')'){ b = popb(); bracket[b].end = wid; bracket[b].buf_end = p-buff; p++; /* error */ /*-------*/ }else{ Error("Reading sentence\n"); } } if(!stackempty()){ Error("Bracketing is unbalanced (too many open bracket)\n"); } *wn = wid; *bn = bid; return(len); } /*----------------------*/ /* stack operation */ /* for bracketing pairs */ /*----------------------*/ void pushb(item) int item; { stack[stack_top++]=item; } int popb() { int item; item = stack[stack_top-1]; if(stack_top-- < 0){ Error("Bracketing unbalance (too many close bracket)\n"); } return(item); } int stackempty() { if(stack_top==0){ return(1); }else{ return(0); } } /*------------------*/ /* calculate result */ /*------------------*/ void calc_result(unsigned char *buf1,unsigned char *buf) { int i, j, l; int match, crossing, correct_tag; int last_i = -1; char my_buf[1000]; int match_found = 0; char match_j[200]; for (j = 0; j < bn2; ++j) { match_j[j] = 0; } /* ML */ printf("\n"); /* Find skip and error */ /*---------------------*/ if(wn2==0){ Status = 2; individual_result(0,0,0,0,0,0); return; } if(wn1 != wn2){ Error("Length unmatch (%d|%d)\n",wn1,wn2); individual_result(0,0,0,0,0,0); return; } for(i=0;i<wn1;i++){ if(word_comp(terminal1[i].word,terminal2[i].word)==0){ Error("Words unmatch (%s|%s)\n",terminal1[i].word, terminal2[i].word); individual_result(0,0,0,0,0,0); return; } } /* massage the data */ /*------------------*/ massage_data(); /* matching brackets */ /*-------------------*/ match = 0; for(i=0;i<bn1;i++){ for(j=0;j<bn2;j++){ // does bracket match? if(bracket1[i].result != 5 && bracket2[j].result == 0 && bracket1[i].start == bracket2[j].start && bracket1[i].end == bracket2[j].end) { // (1) do we not care about the label or (2) does the label match? if (F_label==0 || label_comp(bracket1[i].label,bracket2[j].label)==1) { bracket1[i].result = bracket2[j].result = 1; match++; match_found = 1; break; } else { printf(" LABEL[%d-%d]: ",bracket1[i].start,bracket1[i].end-1); l = bracket1[i].buf_end-bracket1[i].buf_start; strncpy(my_buf,buf1+bracket1[i].buf_start,l); my_buf[l] = '\0'; printf("%s\n",my_buf); match_found = 1; match_j[j] = 1; } } } if (!match_found && bracket1[i].result != 5) { /* ### ML 09/28/03: gold bracket with no corresponding test bracket */ printf(" BRACKET[%d-%d]: ",bracket1[i].start,bracket1[i].end-1); l = bracket1[i].buf_end-bracket1[i].buf_start; strncpy(my_buf,buf1+bracket1[i].buf_start,l); my_buf[l] = '\0'; printf("%s\n",my_buf); } match_found = 0; } for(j=0;j<bn2;j++){ if (bracket2[j].result==0 && !match_j[j]) { /* test bracket with no corresponding gold bracket */ printf(" EXTRA[%d-%d]: ",bracket2[j].start,bracket2[j].end-1); l = bracket2[j].buf_end-bracket2[j].buf_start; strncpy(my_buf,buf+bracket2[j].buf_start,l); my_buf[l] = '\0'; printf("%s\n",my_buf); } } /* crossing */ /*----------*/ crossing = 0; /* crossing is counted based on the brackets */ /* in test rather than gold file (by Mike) */ for(j=0;j<bn2;j++){ for(i=0;i<bn1;i++){ if(bracket1[i].result != 5 && bracket2[j].result != 5 && ((bracket1[i].start < bracket2[j].start && bracket1[i].end > bracket2[j].start && bracket1[i].end < bracket2[j].end) || (bracket1[i].start > bracket2[j].start && bracket1[i].start < bracket2[j].end && bracket1[i].end > bracket2[j].end))){ /* ### ML 09/01/03: get details on cross-brackettings */ if (i != last_i) { printf(" CROSSING[%d-%d]: ",bracket1[i].start,bracket1[i].end-1); l = bracket1[i].buf_end-bracket1[i].buf_start; strncpy(my_buf,buf1+bracket1[i].buf_start,l); my_buf[l] = '\0'; printf("%s\n",my_buf); /* ML printf("\n CROSSING at bracket %d:\n",i-1); printf(" GOLD (tokens %d-%d): ",bracket1[i].start,bracket1[i].end-1); l = bracket1[i].buf_end-bracket1[i].buf_start; strncpy(my_buf,buf1+bracket1[i].buf_start,l); my_buf[l] = '\0'; printf("%s\n",my_buf); */ last_i = i; } /* ML printf(" TEST (tokens %d-%d): ",bracket2[j].start,bracket2[j].end-1); l = bracket2[j].buf_end-bracket2[j].buf_start; strncpy(my_buf,buf+bracket2[j].buf_start,l); my_buf[l] = '\0'; printf("%s\n",my_buf); */ crossing++; break; } } } /* Tagging accuracy */ /*------------------*/ correct_tag=0; for(i=0;i<wn1;i++){ if(label_comp(terminal1[i].label,terminal2[i].label)==1){ terminal1[i].result = terminal2[i].result = 1; correct_tag++; } else { terminal1[i].result = terminal2[i].result = 0; } } individual_result(wn1,r_bn1,r_bn2,match,crossing,correct_tag); } void massage_data() { int i, j; /* for GOLD */ /*----------*/ for(i=0;i<bn1;i++){ bracket1[i].result = 0; /* Zero element */ if(bracket1[i].start == bracket1[i].end){ bracket1[i].result = 5; continue; } /* Modify label */ modify_label(bracket1[i].label); /* Delete label */ for(j=0;j<Delete_label_n;j++){ if(label_comp(bracket1[i].label,Delete_label[j])==1){ bracket1[i].result = 5; } } } /* for TEST */ /*----------*/ for(i=0;i<bn2;i++){ bracket2[i].result = 0; /* Zero element */ if(bracket2[i].start == bracket2[i].end){ bracket2[i].result = 5; continue; } /* Modify label */ modify_label(bracket2[i].label); /* Delete label */ for(j=0;j<Delete_label_n;j++){ if(label_comp(bracket2[i].label,Delete_label[j])==1){ bracket2[i].result = 5; } } } /* count up real number of brackets (exclude deleted ones) */ /*---------------------------------------------------------*/ r_bn1 = r_bn2 = 0; for(i=0;i<bn1;i++){ if(bracket1[i].result != 5){ r_bn1++; } } for(i=0;i<bn2;i++){ if(bracket2[i].result != 5){ r_bn2++; } } } /*------------------------*/ /* trim the tail of label */ /*------------------------*/ void modify_label(label) char *label; { char *p; for(p=label;*p!='\0';p++){ if(*p=='-' || *p=='='){ *p='\0'; break; } } } /*-----------------------------------------------*/ /* add individual statistics to TOTAL statictics */ /*-----------------------------------------------*/ void individual_result(wn1,bn1,bn2,match,crossing,correct_tag) int wn1,bn1,bn2,match,crossing,correct_tag; { /* Statistics for ALL */ /*--------------------*/ TOTAL_sent++; if(Status==1){ TOTAL_error_sent++; }else if(Status==2){ TOTAL_skip_sent++; }else{ TOTAL_bn1 += bn1; TOTAL_bn2 += bn2; TOTAL_match += match; if(bn1==bn2 && bn2==match){ TOTAL_comp_sent++; } TOTAL_word += wn1; TOTAL_crossing += crossing; if(crossing==0){ TOTAL_no_crossing++; } if(crossing <= 2){ TOTAL_2L_crossing++; } TOTAL_correct_tag += correct_tag; } /* Statistics for sent length <= TOT_cut_len */ /*-------------------------------------------*/ if(r_wn1<=TOT_cut_len){ TOT40_sent++; if(Status==1){ TOT40_error_sent++; }else if(Status==2){ TOT40_skip_sent++; }else{ TOT40_bn1 += bn1; TOT40_bn2 += bn2; TOT40_match += match; if(bn1==bn2 && bn2==match){ TOT40_comp_sent++; } TOT40_word += wn1; TOT40_crossing += crossing; if(crossing==0){ TOT40_no_crossing++; } if(crossing <= 2){ TOT40_2L_crossing++; } TOT40_correct_tag += correct_tag; } } /* Print individual result */ /*-------------------------*/ printf("%4d %3d %d ",Line,r_wn1,Status); printf("%6.2f %6.2f %3d %3d %3d %3d", (r_bn1==0?0.0:100.0*match/r_bn1), (r_bn2==0?0.0:100.0*match/r_bn2), match, r_bn1, r_bn2, crossing); printf(" %4d %4d %6.2f\n",wn1,correct_tag, (wn1==0?0.0:100.0*correct_tag/wn1)); } /*------------------------*/ /* print total statistics */ /*------------------------*/ void print_total() { int sentn; printf("============================================================================\n"); if(TOTAL_bn1>0 && TOTAL_bn2>0){ printf(" %6.2f %6.2f %6d %5d %5d %5d", (TOTAL_bn1>0?100.0*TOTAL_match/TOTAL_bn1:0.0), (TOTAL_bn2>0?100.0*TOTAL_match/TOTAL_bn2:0.0), TOTAL_match, TOTAL_bn1, TOTAL_bn2, TOTAL_no_crossing); } printf(" %5d %5d %6.2f", TOTAL_word, TOTAL_correct_tag, (TOTAL_word>0?100.0*TOTAL_correct_tag/TOTAL_word:0.0)); printf("\n"); printf("=== Summary ===\n"); sentn = TOTAL_sent - TOTAL_error_sent - TOTAL_skip_sent; printf("\n-- All --\n"); printf("Number of sentence = %6d\n",TOTAL_sent); printf("Number of Error sentence = %6d\n",TOTAL_error_sent); printf("Number of Skip sentence = %6d\n",TOTAL_skip_sent); printf("Number of Valid sentence = %6d\n",sentn); printf("Bracketing Recall = %6.2f\n", (TOTAL_bn1>0?100.0*TOTAL_match/TOTAL_bn1:0.0)); printf("Bracketing Precision = %6.2f\n", (TOTAL_bn2>0?100.0*TOTAL_match/TOTAL_bn2:0.0)); printf("Complete match = %6.2f\n", (sentn>0?100.0*TOTAL_comp_sent/sentn:0.0)); printf("Average crossing = %6.2f\n", (sentn>0?1.0*TOTAL_crossing/sentn:0.0)); printf("No crossing = %6.2f\n", (sentn>0?100.0*TOTAL_no_crossing/sentn:0.0)); printf("2 or less crossing = %6.2f\n", (sentn>0?100.0*TOTAL_2L_crossing/sentn:0.0)); printf("Tagging accuracy = %6.2f\n", (TOTAL_word>0?100.0*TOTAL_correct_tag/TOTAL_word:0.0)); sentn = TOT40_sent - TOT40_error_sent - TOT40_skip_sent; printf("\n-- len<=%d --\n",TOT_cut_len); printf("Number of sentence = %6d\n",TOT40_sent); printf("Number of Error sentence = %6d\n",TOT40_error_sent); printf("Number of Skip sentence = %6d\n",TOT40_skip_sent); printf("Number of Valid sentence = %6d\n",sentn); printf("Bracketing Recall = %6.2f\n", (TOT40_bn1>0?100.0*TOT40_match/TOT40_bn1:0.0)); printf("Bracketing Precision = %6.2f\n", (TOT40_bn2>0?100.0*TOT40_match/TOT40_bn2:0.0)); printf("Complete match = %6.2f\n", (sentn>0?100.0*TOT40_comp_sent/sentn:0.0)); printf("Average crossing = %6.2f\n", (sentn>0?1.0*TOT40_crossing/sentn:0.0)); printf("No crossing = %6.2f\n", (sentn>0?100.0*TOT40_no_crossing/sentn:0.0)); printf("2 or less crossing = %6.2f\n", (sentn>0?100.0*TOT40_2L_crossing/sentn:0.0)); printf("Tagging accuracy = %6.2f\n", (TOT40_word>0?100.0*TOT40_correct_tag/TOT40_word:0.0)); } /*--------------------------------*/ /* display individual information */ /*--------------------------------*/ void dsp_info() { int i, n; printf("-<1>---(wn1=%3d, bn1=%3d)- ",wn1,bn1); printf("-<2>---(wn2=%3d, bn2=%3d)-\n",wn2,bn2); n = (wn1>wn2?wn1:wn2); for(i=0;i<n;i++){ if(terminal1[i].word[0]!='\0'){ printf("%3d : %d : %-6s %-16s ",i,terminal1[i].result, terminal1[i].label,terminal1[i].word); }else{ printf(" "); } if(terminal2[i].word[0]!='\0'){ printf("%3d : %d : %-6s %-16s\n",i,terminal2[i].result, terminal2[i].label,terminal2[i].word); }else{ printf("\n"); } } printf("\n"); n = (bn1>bn2?bn1:bn2); for(i=0;i<n;i++){ if(bracket1[i].start != -1){ printf("%3d : %d : %3d %3d %-6s ",i,bracket1[i].result, bracket1[i].start,bracket1[i].end, bracket1[i].label); } else { printf(" "); } if(bracket2[i].start != -1){ printf("%3d : %d : %3d %3d %-6s\n",i,bracket2[i].result, bracket2[i].start,bracket2[i].end, bracket2[i].label); } else { printf("\n"); } } printf("\n"); printf("========\n"); } /*-----------------*/ /* some predicates */ /*-----------------*/ int is_terminator(c) char c; { if(isspace(c) || c=='(' || c==')'){ return(1); }else{ return(0); } } int is_deletelabel(s) char *s; { int i; for(i=0;i<Delete_label_n;i++){ if(strcmp(s,Delete_label[i])==0){ return(1); } } return(0); } int is_deletelabel_for_length(s) char *s; { int i; for(i=0;i<Delete_label_for_length_n;i++){ if(strcmp(s,Delete_label_for_length[i])==0){ return(1); } } return(0); } /*---------------*/ /* compare words */ /*---------------*/ int word_comp(s1,s2) char *s1,*s2; { int i; if(strcmp(s1,s2)==0){ return(1); } for(i=0;i<EQ_word_n;i++){ if((strcmp(s1,EQ_word[i].s1)==0 && strcmp(s2,EQ_word[i].s2)==0) || (strcmp(s1,EQ_word[i].s2)==0 && strcmp(s2,EQ_word[i].s1)==0)){ return(1); } } return(0); } /*----------------*/ /* compare labels */ /*----------------*/ int label_comp(s1,s2) char *s1,*s2; { int i; if(strcmp(s1,s2)==0){ return(1); } for(i=0;i<EQ_label_n;i++){ if((strcmp(s1,EQ_label[i].s1)==0 && strcmp(s2,EQ_label[i].s2)==0) || (strcmp(s1,EQ_label[i].s2)==0 && strcmp(s2,EQ_label[i].s1)==0)){ return(1); } } return(0); } /*--------*/ /* errors */ /*--------*/ void Error(s,arg1,arg2,arg3) char *s, *arg1, *arg2, *arg3; { Status = 1; fprintf(stderr,"%d : ",Line); fprintf(stderr,s,arg1,arg2,arg3); if(Error_count++>Max_error){ exit(1); } } /*---------------------*/ /* fatal error to exit */ /*---------------------*/ void Fatal(s,arg1,arg2,arg3) char *s, *arg1, *arg2, *arg3; { fprintf(stderr,s,arg1,arg2,arg3); exit(1); } /*-------*/ /* Usage */ /*-------*/ void Usage() { fprintf(stderr," evalb [-dh][-c n][-e n][-p param_file] gold-file test-file \n"); fprintf(stderr," \n"); fprintf(stderr," Evaluate bracketing in test-file against gold-file. \n"); fprintf(stderr," Return recall, precision, tag accuracy. \n"); fprintf(stderr," \n"); fprintf(stderr," <option> \n"); fprintf(stderr," -d debug mode \n"); fprintf(stderr," -c n cut-off length forstatistics (def.=40)\n"); fprintf(stderr," -e n number of error to kill (default=10) \n"); fprintf(stderr," -p param_file parameter file \n"); fprintf(stderr," -h help \n"); }
the_stack_data/109346.c
#include <unistd.h> #include <stdio.h> #include <stdlib.h> #define DEFAULT_THRESHOLD 1000000000 int has_initialized = 0; void *mem_start; void *mem_end; typedef struct mem_header{ int is_available; long size; } mem_header; void malloc_init(){ mem_end = sbrk(0); mem_start = mem_end; has_initialized = 1; } void check_threshold(mem_header *head){ char *thres; int thr_size, dif; //if the last chunk's being used we can't free anything if(!head->is_available) return; //has a custom threshold been set? thres = getenv("M_TRIM_THRESHOLD"); if(thres == NULL) thr_size = DEFAULT_THRESHOLD; else thr_size = strtol(thres, NULL, 0); //is it beyond the threshold? if(head->size>thr_size){ //free the difference dif = thr_size-head->size; //negative value sbrk(dif); mem_end+=dif; head->size+=dif; printf("decreased\n"); } return; } //checks for adjustent free chunks and merges them //also calls threshold check at the last chunk void check_for_merges(){ mem_header *cur, *next, *prev = NULL; cur = mem_start; //we merge cur and prev while(cur != mem_end){ next = (void*)cur+cur->size; //if it's the first iteration if(prev == NULL){ prev = cur; cur = next; continue; } //if it's the last iteration if(next == mem_end){ if(prev->is_available && cur->is_available){ prev->size+=cur->size; cur=prev; } check_threshold(cur); return; } //merge case if(prev->is_available && cur->is_available){ prev->size+=cur->size; cur=(void*)prev+prev->size; continue; } prev=cur; cur=next; } return; } void free(void *addr){ mem_header *head; head = addr-sizeof(mem_header); head->is_available = 1; check_for_merges(); return; } //split an existing chunk in two, one of which will have "bytes" size void split_chunks(mem_header *head, long bytes){ //if there's not enough extra space for a new chunk we just return int extra = head->size - bytes; if(extra<=sizeof(mem_header)){ return; } //init the new chunk mem_header *new_head = head+bytes; new_head->is_available=1; new_head->size=extra; //modify the old chunk's length head->size=bytes; return; } void *malloc(size_t bytes){ void *cur, *result; int worst_size = 0; //size of the biggest block we've seen int cur_size; mem_header *cur_head, *worst_head = NULL; if(!has_initialized){ malloc_init(); } bytes+=sizeof(mem_header); //start from the beginning cur = mem_start; while(cur != mem_end){ cur_head = (mem_header*) cur; //check available if(cur_head->is_available){ cur_size = cur_head->size; //check big enough if(cur_size >= bytes){ //chunk bigger than any we've seen before if(cur_size>worst_size){ worst_size = cur_size; worst_head = cur_head; } } } cur+=cur_head->size; } //if we haven't found an available chunk we allocate a new one if(worst_head == NULL){ sbrk(bytes); result = mem_end; mem_end+=bytes; worst_head = (mem_header*)result; worst_head->is_available = 0; worst_head->size = bytes; } else{ result = worst_head; worst_head->is_available = 0; split_chunks(worst_head, bytes); check_for_merges(); } result+=sizeof(mem_header); return result; } void meminfo(){ int i = 0; mem_header *head; head = mem_start; while(head != mem_end){ i++; printf("Chunk #%d\n", i); printf("Address: %p\n", head); printf("Size: %lu\n", head->size); printf("Status: "); if(head->is_available) printf("Available\n"); else printf("In Use\n"); printf("\n"); head=(void*)head+head->size; } }
the_stack_data/86074331.c
#include <stdio.h> #include <stdlib.h> #include <check.h> START_TEST(test_1) { /* here's a template we can use for unit testing lol */ ck_assert (1); } END_TEST int main (int argc, char **argv) { TCase *test_case; Suite *test_suite; SRunner *suite_runner; int n_failures; test_case = tcase_create ("Test case 1"); tcase_add_test (test_case, test_1); test_suite = suite_create ("Test suite 1"); suite_add_tcase (test_suite, test_case); suite_runner = srunner_create (test_suite); srunner_run_all (suite_runner, CK_NORMAL); n_failures = srunner_ntests_failed (suite_runner); srunner_free (suite_runner); return n_failures == 0 ? EXIT_SUCCESS : EXIT_FAILURE; }
the_stack_data/1101811.c
/****************************************************************************/ /* strncmp v2.2.1 */ /* */ /* Copyright (c) 1993-2017 Texas Instruments Incorporated */ /* http://www.ti.com/ */ /* */ /* Redistribution and use in source and binary forms, with or without */ /* modification, are permitted provided that the following conditions */ /* are met: */ /* */ /* Redistributions of source code must retain the above copyright */ /* notice, this list of conditions and the following disclaimer. */ /* */ /* 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. */ /* */ /* Neither the name of Texas Instruments Incorporated 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 */ /* OWNER 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. */ /* */ /****************************************************************************/ #undef _INLINE #define _STRING_IMPLEMENTATION #define _STRNCMP #include <string.h>
the_stack_data/117182.c
extern void abort(void); void reach_error(){} extern char __VERIFIER_nondet_char(void); extern int __VERIFIER_nondet_int(void); extern long __VERIFIER_nondet_long(void); extern int __VERIFIER_nondet_int(); /* Generated by CIL v. 1.3.6 */ /* print_CIL_Input is true */ int ssl3_connect(int initial_state ) { int s__info_callback = __VERIFIER_nondet_int() ; int s__in_handshake = __VERIFIER_nondet_int() ; int s__state ; int s__new_session ; int s__server ; int s__version = __VERIFIER_nondet_int() ; int s__type ; int s__init_num ; int s__bbio = __VERIFIER_nondet_int() ; int s__wbio = __VERIFIER_nondet_int() ; int s__hit = __VERIFIER_nondet_int() ; int s__rwstate ; int s__init_buf___0 = 1; int s__debug = __VERIFIER_nondet_int() ; int s__shutdown ; int s__ctx__info_callback = __VERIFIER_nondet_int() ; int s__ctx__stats__sess_connect_renegotiate = __VERIFIER_nondet_int() ; int s__ctx__stats__sess_connect = __VERIFIER_nondet_int() ; int s__ctx__stats__sess_hit = __VERIFIER_nondet_int() ; int s__ctx__stats__sess_connect_good = __VERIFIER_nondet_int() ; int s__s3__change_cipher_spec ; int s__s3__flags ; int s__s3__delay_buf_pop_ret ; int s__s3__tmp__cert_req = __VERIFIER_nondet_int() ; int s__s3__tmp__new_compression = __VERIFIER_nondet_int() ; int s__s3__tmp__reuse_message = __VERIFIER_nondet_int() ; int s__s3__tmp__new_cipher = __VERIFIER_nondet_int() ; int s__s3__tmp__new_cipher__algorithms = __VERIFIER_nondet_int() ; int s__s3__tmp__next_state___0 ; int s__s3__tmp__new_compression__id = __VERIFIER_nondet_int() ; int s__session__cipher ; int s__session__compress_meth ; int buf ; unsigned long tmp ; unsigned long l ; int num1 ; int cb ; int ret ; int new_state ; int state ; int skip ; int tmp___0 ; int tmp___1 = __VERIFIER_nondet_int() ; int tmp___2 = __VERIFIER_nondet_int() ; int tmp___3 = __VERIFIER_nondet_int() ; int tmp___4 = __VERIFIER_nondet_int() ; int tmp___5 = __VERIFIER_nondet_int() ; int tmp___6 = __VERIFIER_nondet_int() ; int tmp___7 = __VERIFIER_nondet_int() ; int tmp___8 = __VERIFIER_nondet_int() ; int tmp___9 = __VERIFIER_nondet_int() ; int blastFlag ; int __cil_tmp55 ; long __cil_tmp56 ; long __cil_tmp57 ; long __cil_tmp58 ; long __cil_tmp59 ; long __cil_tmp60 ; long __cil_tmp61 ; long __cil_tmp62 ; long __cil_tmp63 ; long __cil_tmp64 ; ; { s__state = initial_state; blastFlag = 0; tmp = __VERIFIER_nondet_int(); cb = 0; ret = -1; skip = 0; tmp___0 = 0; if (s__info_callback != 0) { cb = s__info_callback; } else { if (s__ctx__info_callback != 0) { cb = s__ctx__info_callback; } } s__in_handshake ++; if (tmp___1 - 12288) { if (tmp___2 - 16384) { } } { while (1) { while_0_continue: /* CIL Label */ ; state = s__state; if (s__state == 12292) { goto switch_1_12292; } else { if (s__state == 16384) { goto switch_1_16384; } else { if (s__state == 4096) { goto switch_1_4096; } else { if (s__state == 20480) { goto switch_1_20480; } else { if (s__state == 4099) { goto switch_1_4099; } else { if (s__state == 4368) { goto switch_1_4368; } else { if (s__state == 4369) { goto switch_1_4369; } else { if (s__state == 4384) { goto switch_1_4384; } else { if (s__state == 4385) { goto switch_1_4385; } else { if (s__state == 4400) { goto switch_1_4400; } else { if (s__state == 4401) { goto switch_1_4401; } else { if (s__state == 4416) { goto switch_1_4416; } else { if (s__state == 4417) { goto switch_1_4417; } else { if (s__state == 4432) { goto switch_1_4432; } else { if (s__state == 4433) { goto switch_1_4433; } else { if (s__state == 4448) { goto switch_1_4448; } else { if (s__state == 4449) { goto switch_1_4449; } else { if (s__state == 4464) { goto switch_1_4464; } else { if (s__state == 4465) { goto switch_1_4465; } else { if (s__state == 4466) { goto switch_1_4466; } else { if (s__state == 4467) { goto switch_1_4467; } else { if (s__state == 4480) { goto switch_1_4480; } else { if (s__state == 4481) { goto switch_1_4481; } else { if (s__state == 4496) { goto switch_1_4496; } else { if (s__state == 4497) { goto switch_1_4497; } else { if (s__state == 4512) { goto switch_1_4512; } else { if (s__state == 4513) { goto switch_1_4513; } else { if (s__state == 4528) { goto switch_1_4528; } else { if (s__state == 4529) { goto switch_1_4529; } else { if (s__state == 4560) { goto switch_1_4560; } else { if (s__state == 4561) { goto switch_1_4561; } else { if (s__state == 4352) { goto switch_1_4352; } else { if (s__state == 3) { goto switch_1_3; } else { goto switch_1_default; if (0) { switch_1_12292: s__new_session = 1; s__state = 4096; s__ctx__stats__sess_connect_renegotiate ++; switch_1_16384: ; switch_1_4096: ; switch_1_20480: ; switch_1_4099: s__server = 0; if (cb != 0) { } { __cil_tmp55 = s__version - 65280; if (__cil_tmp55 != 768) { ret = -1; goto end; } } s__type = 4096; if (s__init_buf___0 == 0) { buf = __VERIFIER_nondet_int(); if (buf == 0) { ret = -1; goto end; } if (! tmp___3) { ret = -1; goto end; } s__init_buf___0 = buf; } if (! tmp___4) { ret = -1; goto end; } if (! tmp___5) { ret = -1; goto end; } s__state = 4368; s__ctx__stats__sess_connect ++; s__init_num = 0; goto switch_1_break; switch_1_4368: ; switch_1_4369: s__shutdown = 0; ret = __VERIFIER_nondet_int(); if (blastFlag == 0) { blastFlag = 1; } if (ret <= 0) { goto end; } s__state = 4384; s__init_num = 0; if (s__bbio != s__wbio) { } goto switch_1_break; switch_1_4384: ; switch_1_4385: ret = __VERIFIER_nondet_int(); if (blastFlag == 1) { blastFlag = 2; } if (ret <= 0) { goto end; } if (s__hit) { s__state = 4560; } else { s__state = 4400; } s__init_num = 0; goto switch_1_break; switch_1_4400: ; switch_1_4401: ; if (s__s3__tmp__new_cipher__algorithms - 256) { skip = 1; } else { ret = __VERIFIER_nondet_int(); if (blastFlag == 2) { blastFlag = 3; } if (ret <= 0) { goto end; } } s__state = 4416; s__init_num = 0; goto switch_1_break; switch_1_4416: ; switch_1_4417: ret = __VERIFIER_nondet_int(); if (blastFlag == 3) { blastFlag = 4; } if (ret <= 0) { goto end; } s__state = 4432; s__init_num = 0; if (! tmp___6) { ret = -1; goto end; } goto switch_1_break; switch_1_4432: ; switch_1_4433: ret = __VERIFIER_nondet_int(); if (blastFlag == 5) { goto ERROR; } if (ret <= 0) { goto end; } s__state = 4448; s__init_num = 0; goto switch_1_break; switch_1_4448: ; switch_1_4449: ret = __VERIFIER_nondet_int(); if (blastFlag == 4) { blastFlag = 5; } if (ret <= 0) { goto end; } if (s__s3__tmp__cert_req) { s__state = 4464; } else { s__state = 4480; } s__init_num = 0; goto switch_1_break; switch_1_4464: ; switch_1_4465: ; switch_1_4466: ; switch_1_4467: ret = __VERIFIER_nondet_int(); if (ret <= 0) { goto end; } s__state = 4480; s__init_num = 0; goto switch_1_break; switch_1_4480: ; switch_1_4481: ret = __VERIFIER_nondet_int(); if (ret <= 0) { goto end; } l = (unsigned long )s__s3__tmp__new_cipher__algorithms; if (s__s3__tmp__cert_req == 1) { s__state = 4496; } else { s__state = 4512; s__s3__change_cipher_spec = 0; } s__init_num = 0; goto switch_1_break; switch_1_4496: ; switch_1_4497: ret = __VERIFIER_nondet_int(); if (ret <= 0) { goto end; } s__state = 4512; s__init_num = 0; s__s3__change_cipher_spec = 0; goto switch_1_break; switch_1_4512: ; switch_1_4513: ret = __VERIFIER_nondet_int(); if (ret <= 0) { goto end; } s__state = 4528; s__init_num = 0; s__session__cipher = s__s3__tmp__new_cipher; if (s__s3__tmp__new_compression == 0) { s__session__compress_meth = 0; } else { s__session__compress_meth = s__s3__tmp__new_compression__id; } if (! tmp___7) { ret = -1; goto end; } if (! tmp___8) { ret = -1; goto end; } goto switch_1_break; switch_1_4528: ; switch_1_4529: ret = __VERIFIER_nondet_int(); if (ret <= 0) { goto end; } s__state = 4352; __cil_tmp56 = (long )s__s3__flags; __cil_tmp57 = __cil_tmp56 + 5; s__s3__flags = (int )__cil_tmp57; if (s__hit) { s__s3__tmp__next_state___0 = 3; { __cil_tmp58 = (long )s__s3__flags; if (__cil_tmp58 - 2L) { s__state = 3; __cil_tmp59 = (long )s__s3__flags; __cil_tmp60 = __cil_tmp59 + 4L; s__s3__flags = (int )__cil_tmp60; s__s3__delay_buf_pop_ret = 0; } } } else { s__s3__tmp__next_state___0 = 4560; } s__init_num = 0; goto switch_1_break; switch_1_4560: ; switch_1_4561: ret = __VERIFIER_nondet_int(); if (ret <= 0) { goto end; } if (s__hit) { s__state = 4512; } else { s__state = 3; } s__init_num = 0; goto switch_1_break; switch_1_4352: { __cil_tmp61 = (long )num1; if (__cil_tmp61 > 0L) { s__rwstate = 2; num1 = tmp___9; { __cil_tmp62 = (long )num1; if (__cil_tmp62 <= 0L) { ret = -1; goto end; } } s__rwstate = 1; } } s__state = s__s3__tmp__next_state___0; goto switch_1_break; switch_1_3: if (s__init_buf___0 != 0) { s__init_buf___0 = 0; } { __cil_tmp63 = (long )s__s3__flags; __cil_tmp64 = __cil_tmp63 - 4L; if (! __cil_tmp64) { } } s__init_num = 0; s__new_session = 0; if (s__hit) { s__ctx__stats__sess_hit ++; } ret = 1; s__ctx__stats__sess_connect_good ++; if (cb != 0) { } goto end; switch_1_default: ret = -1; goto end; } else { switch_1_break: ; } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } if (! s__s3__tmp__reuse_message) { if (! skip) { if (s__debug) { ret = __VERIFIER_nondet_int(); if (ret <= 0) { goto end; } } if (cb != 0) { if (s__state != state) { new_state = s__state; s__state = state; s__state = new_state; } } } } skip = 0; } while_0_break: /* CIL Label */ ; } end: s__in_handshake --; if (cb != 0) { } return (ret); ERROR: {reach_error();abort();} return (-1); } } int main(void) { int s ; { { s = 12292; ssl3_connect(12292); } return (0); } }
the_stack_data/38375.c
/* * Exercise 4-7 * * Write a routine ungets(s) that will push back an entire string onto the * input. Should ungets know about buf and bufp, or should it just use * ungetch? */ #include <stdio.h> #include <string.h> int getch(void); void ungetch(int); void ungets(char []); int main(void) { /* test for ungets() */ char s[] = "This is a test string."; int c; ungets(s); while ((c = getch()) != EOF && c != '\n') putchar(c); return 0; } #define BUFSIZE 100 char buf[BUFSIZE]; /* buffer for ungetch */ int bufp = 0; /* next free position in buf */ int getch(void) { /* getch: gets a (possibly pushed-back) character */ return (bufp > 0) ? buf[--bufp] : getchar(); } void ungetch(int c) { /* ungetch: pushes character back on input */ if (bufp >= BUFSIZE) printf("ungetch: too many characters\n"); else buf[bufp++] = c; } void ungets(char s[]) { /* ungets: push back an entire string onto output */ int len; len = strlen(s); while (len > 0) ungetch(s[--len]); }
the_stack_data/370496.c
/* p400.c page 400 */ int main() { int ret; char msg[] = "Hello\n"; __asm__ volatile ( "call *%%esi" : "=a" (ret) : "a" (4), "S" (0xffffe000), "b" ((long) 1), "c" ((long) msg), "d" ((long) sizeof(msg))); return 0; }
the_stack_data/656805.c
//KryptoPal - Simulator Mining //Oleh: Kelompok 12 untuk Kuliah Pemrograman Lanjut Teknik Komputer FTUI (ENCE602003) // Afif Yudhistira - 2006522631 // Binar Qalbu Cimuema - 2006526296 // M. Hafiz Widyawan - 2006468762 // Syamsul Erisandy Arief - 2006577611 //Kontribusi: // Afif Yudhistira: fungsi mining // Binar Qalbu Cimuema: fungsi main (dengan bantuan Syamsul Erisandy Arief) // M. Hafiz Widyawan: fungsi dispPanduan dan display menu // Syamsul Erisandy Arief: pengaturan akun (dengan bantuan Binar Qalbu Cimuema dan M. Hafiz Widyawan) #include <stdlib.h> #include <string.h> #include <stdio.h> #include <omp.h> struct listAkun { int urutan; char nama[100]; char uname[100]; char pass[100]; float saldo; struct listAkun * next; }* head; void dispPanduan() { printf("\tKryptoPal - Simulator Mining Cryptocurrency\n"); printf("\tSelamat datang di halaman panduan program kami.\n"); printf("\tPanduan Program\n"); printf("\tUntuk menggunakan program ini, harap mengikuti instruksi di bawah ini:\n"); printf("\tOpsi 1\n"); printf("\t Pada opsi ini, Anda akan membuat akun baru.\n"); printf("\t Jika membuat akun baru terpilih, data data yang diminta adalah:\n"); printf("\t - Nama, yaitu nama anda.\n"); printf("\t - Username, yaitu nama pengguna Anda.\n"); printf("\t - Password, yaitu kata sandi Anda\n"); printf("\t Setelah itu, untuk kembali ke tampilan utama, Anda dapat memasukkan angka 0.\n"); printf("\tOpsi 2\n"); printf("\t Pada opsi ini, Anda bisa mencari akun yang sudah Anda buat sebelumnya.\n"); printf("\t Setelah itu, untuk kembali ke tampilan utama, Anda dapat memasukkan angka 0.\n"); printf("\tOpsi 3\n"); printf("\t Pada opsi ini, Anda bisa menghapus akun yang sudah Anda buat sebelumnya.\n"); printf("\t Setelah itu, untuk kembali ke tampilan utama, Anda dapat memasukkan angka 0.\n"); printf("\tOpsi 4\n"); printf("\t Pada opsi ini, Anda dapat mengubah username atau kata sandi akun Anda.\n"); printf("\t Pilih opsi 1 untuk mengubah username dan opsi 2 untuk mengubah kata sandi.\n"); printf("\t Anda akan diminta username atau kata sandi yang lama serta barunya.\n"); printf("\t Penggantian berhasil dilakukan jika muncul kata 'Berhasil' pada program.\n"); printf("\t Setelah itu, untuk kembali ke tampilan user, Anda dapat memasukkan angka 0.\n"); printf("\tOpsi 5\n"); printf("\t Pada opsi ini, Anda bisa melihat semua akun yang sudah Anda buat sebelumnya.\n"); printf("\t Setelah itu, untuk kembali ke tampilan utama, Anda dapat memasukkan angka 0.\n"); printf("\tOpsi 6\n"); printf("\t Pada opsi ini, Anda bisa melakukan mining Cryptocurrency.\n"); printf("\t Anda akan diminta untuk memasukkan nomor urut Anda dan jumlah proses mining yang ingin Anda lakukan\n"); printf("\t Disarankan untuk melakukan 10.000 proses ke atas.\n"); printf("\t Mining berhasil dilakukan jika muncul kata 'Berhasil' pada program.\n"); printf("\t PERINGATAN : Mining akan membebankan cpu hingga 100%* sampai proses mining selesai.\n"); printf("\t *CATATAN : Beban 100% hanya didapatkan jika penggunakan intel .\n"); printf("\t Setelah itu, untuk kembali ke tampilan user, Anda dapat memasukkan angka 0.\n"); printf("\tOpsi 7\n"); printf("\t Pada opsi ini, Anda bisa menyimpan data akun anda ke file.txt.\n"); printf("\t Setelah itu, untuk kembali ke tampilan utama, Anda dapat memasukkan angka 0.\n"); printf("\tOpsi 8\n"); printf("\t Pada opsi ini, akan dimunculkan panduan dalam menjalankan program. \n"); printf("\t Setelah itu, untuk kembali ke tampilan utama, Anda dapat memasukkan angka 0.\n"); printf("\tOpsi 0\n"); printf("\t Pada opsi ini, Anda dapat keluar dari program.\n"); } void displayMenu() { printf("==========KryptoPal - Cryptocurrency Mining Simulation==========\n"); printf("1. Buat Akun\n"); printf("2. Pencarian Akun\n"); printf("3. Hapus Akun\n"); printf("4. Update Akun\n"); printf("5. Display Akun\n"); printf("6. Mulai Mining\n"); printf("7. Simpan Data Akun ke File .txt\n"); printf("8. Display Panduan\n"); printf("0. Keluar\n"); printf("\nSilahkan pilih opsi sesuai nomor: "); } void masuk(int urutan, char * nama, char * uname, char * pass, float saldo) { struct listAkun * insert = (struct listAkun * ) malloc(sizeof(struct listAkun)); insert -> urutan = urutan; strcpy(insert -> nama, nama); strcpy(insert -> uname, uname); strcpy(insert -> pass, pass); insert -> saldo = saldo; insert -> next = NULL; if (head == NULL) { head = insert; } else { insert -> next = head; head = insert; } } void cari(int urutan) { struct listAkun * temp = head; while (temp != NULL) { if (temp -> urutan == urutan) { printf("Detail Akun %d\n", temp -> urutan); printf("Name: %s\n", temp -> nama); printf("Username: %s\n", temp -> uname); printf("Saldo: %.8f\n", temp -> saldo); return; } temp = temp -> next; } printf("Data akun tidak ditemukan\n"); } void update(int urutan) { struct listAkun * temp = head; while (temp != NULL) { if (temp -> urutan == urutan) { printf("Akun %d ditemukan\n", urutan); printf("Enter new name: "); scanf("%s", temp -> nama); printf("Enter new username: "); scanf("%s", temp -> uname); printf("Enter new password: "); scanf("%s", temp -> pass); return; } temp = temp -> next; } printf("Data akun tidak ditemukan\n"); } void updatesaldo(int urutan, float saldobaru) { struct listAkun * temp = head; while (temp != NULL) { if (temp -> urutan == urutan) { temp -> saldo += saldobaru; printf("Saldo Anda telah berhasil diperbarui!\n"); return; } temp = temp -> next; } printf("Data akun tidak ditemukan\n"); } void hapus(int urutan) { struct listAkun * temp1 = head; struct listAkun * temp2 = head; while (temp1 != NULL) { if (temp1 -> urutan == urutan) { if (temp1 == temp2) { head = head -> next; free(temp1); } else { temp2 -> next = temp1 -> next; free(temp1); } printf("Data telah dihapus\n"); return; } temp2 = temp1; temp1 = temp1 -> next; } printf("Data akun tidak ditemukan\n"); } void display() { struct listAkun * temp = head; while (temp != NULL) { printf("No. Urut %d\n", temp -> urutan); printf("Nama: %s\n", temp -> nama); printf("Username: %s\n", temp -> uname); printf("Password: %s\n", temp -> pass); printf("Saldo: %0.8f\n\n", temp -> saldo); temp = temp -> next; } } int mining(int limit) { double start, end; double runTime; start = omp_get_wtime(); int num = 1, primes = 0; #pragma omp parallel for schedule(dynamic) reduction(+: primes) for (num = 1; num <= limit; num++) { int i = 2; while (i <= num) { if (num % i == 0) break; i++; } if (i == num) primes++; } end = omp_get_wtime(); runTime = end - start; printf("Mining telah menghitung %d bilangan prima dibawah %d dalam %g detik\n", primes, limit, runTime); } int main() { head = NULL; int opsi; char nama[100]; char uname[100]; char pass[100]; char address[100]; char temp; int urutan = 0, limcount, urutemp; float saldo, saldonew, limit; FILE * kpw, * kpr; kpw = fopen("D:\\KryptoPal.txt", "a"); kpr = fopen("D:\\KryptoPal.txt", "r"); do { displayMenu(); printf("\nMasukkan opsi: "); scanf("%d", & opsi); system("cls"); switch (opsi) { case 1: printf("Enter name: "); scanf("%s", nama); fflush(stdin); printf("Enter username: "); scanf("%s", uname); printf("Enter password: "); scanf("%s", pass); saldo = 0; urutan += 1; masuk(urutan, nama, uname, pass, saldo); break; case 2: printf("Masukkan no. urut yang ingin dicari: "); scanf("%d", & urutan); cari(urutan); break; case 3: printf("Masukkan no.urut yang ingin dihapus: "); scanf("%d", & urutan); hapus(urutan); break; case 4: printf("Masukkan no.urut yang ingin diperbarui: "); scanf("%d", & urutan); update(urutan); break; case 5: display(); break; case 6: printf("Masukkan no. urutan Anda: "); scanf("%d", & urutemp); printf("Masukkan jumlah proses yang Anda ingin lakukan (proses bil.prima): "); scanf("%f", & limit); mining(limit); limcount += limit; saldonew = limit / 200000; updatesaldo(urutemp, saldonew); break; case 7: fprintf(kpw, "\nDetail Akun %d:\nName: %s\nUsername: %s\nPassword: %s\nSaldo%d: %.8f\nEOA%d", urutan, nama, uname, pass, urutan, saldonew, urutan); fclose(kpw); printf("Data Anda telah berhasil disimpan!\n"); break; case 8: dispPanduan(); break; } } while (opsi != 0); return 0; }
the_stack_data/7949788.c
/* scale_bugs.c * Copyright (C) 2020 devel <[email protected]> */ /* #include "scale_bugs.h" */ struct entrypoint { int size; char bogus[25]; } default_struct = { sizeof(struct entrypoint), {0} }; int main(int argc, char* argv[]) { struct entrypoint entry = default_struct; struct entrypoint *ptr = &entry; memcpy(ptr->bogus, "Hello world foo bar baz funk etc",32); /* XXX: overflow, won't stop at 25th byte! */ ptr += ptr->size; /* size = 32 so this is 32*32 increment !!! */ /* the correct syntax is ++ptr because scaling is auto. always remember that. * if you want finer shifts, define a new ptr of smaller size and cast cast cast. */ /* char* reader = (void*) ptr; */ /* reader += ptr->size; */ return 0; }
the_stack_data/28264089.c
#if defined(BGQDONT) #include <pio.h> #include <pio_internal.h> #include <math.h> #include <kernel/process.h> #include <kernel/location.h> #include <firmware/include/personality.h> #include <mpix.h> #define Personality Personality_t int rank; int np; int my_name_len; char my_name[255]; void identity(const MPI_Comm comm, int *iotask) { MPIX_Hardware_t hw; char message[100]; /* Number of MPI tasks per Pset */ int coreId; int *TasksPerPset; int *tmp; int i,ierr; Personality_t pers; MPI_Comm_rank(comm,&rank); MPI_Comm_size(comm,&np); MPI_Get_processor_name(my_name, &my_name_len); MPIX_Hardware(&hw); Kernel_GetPersonality(&pers, sizeof(pers)); int numIONodes,numPsets,numNodesInPset,rankInPset; int numpsets, psetID, psetsize, psetrank; bgq_pset_info (comm, &numpsets, &psetID, &psetsize, &psetrank); numIONodes = numpsets; numNodesInPset = psetsize; rankInPset = rank; numPsets = numpsets; if(rank == 0) { printf("number of IO nodes in block: %i \n",numIONodes);} if(rank == 0) { printf("number of Psets in block : %i \n",numPsets);} if(rank == 0) { printf("number of compute nodes in Pset: %i \n",numNodesInPset);} int psetNum; psetNum = psetID; #ifdef DEBUG if((*iotask)>0) { printf( "%04i (%-50s %s) %i yes\n", rank, my_name, message, psetNum ); } else { printf( "%04i (%-50s %s) %i --\n", rank, my_name, message, psetNum); } printf("MPI task %6i is rank %3i in Pset: %3i \n",rank, rankInPset,psetNum); #endif /* Determine which core on node.... I don't want to put more than one io-task per node */ coreId = Kernel_PhysicalProcessorID (); TasksPerPset = malloc(numPsets*sizeof(int)); tmp = malloc(numPsets*sizeof(int)); for(i=0;i<numPsets;i++) tmp[i]=0; if(coreId == 0) {tmp[psetNum]=1;} ierr = MPI_Allreduce(tmp,TasksPerPset,numPsets,MPI_INT,MPI_SUM,comm); if(rank == 0) { for(i=0;i<numPsets;i++) {printf("Pset: %3i has %3i nodes \n",i,TasksPerPset[i]);} } free(tmp); free(TasksPerPset); } void determineiotasks(const MPI_Comm comm, int *numiotasks,int *base, int *stride, int *rearr, bool *iamIOtask) { /* Returns the correct numiotasks and the flag iamIOtask Some concepts: processor set: A group of processors on the Blue Gene system which have one or more IO processor (Pset) IO-node: A special Blue Gene node dedicated to performing IO. There are one or more per processor set IO-client: This is software concept. This refers to the MPI task which performs IO for the PIO library */ int psetNum; int coreId; int iam; int task_count; MPIX_Hardware_t hw; /* Get the personality */ Personality_t pers; MPIX_Hardware(&hw); MPI_Comm_rank(comm, &rank); MPI_Comm_size(comm, &np); MPI_Get_processor_name(my_name, &my_name_len); /* printf("Determine io tasks: proc %i: tasks= %i numiotasks=%i stride= %i \n", rank, np, (*numiotasks), (*stride)); */ if((*rearr) > 0) { Kernel_GetPersonality(&pers, sizeof(pers)); int numIONodes,numPsets,numNodesInPset,rankInPset; int numiotasks_per_node,remainder,numIONodes_per_pset; int lstride; /* Number of computational nodes in processor set */ int numpsets, psetID, psetsize, psetrank; bgq_pset_info (comm,&numpsets, &psetID, &psetsize, &psetrank); numIONodes = numpsets; numNodesInPset = psetsize; /* printf("Determine io tasks: me %i : nodes in pset= %i ionodes = %i\n", rank, numNodesInPset, numIONodes); */ if((*numiotasks) < 0 ) { /* negative numiotasks value indicates that this is the number per IO-node */ (*numiotasks) = - (*numiotasks); if((*numiotasks) > numNodesInPset) { numiotasks_per_node = numNodesInPset; } else { numiotasks_per_node = (*numiotasks); } remainder = 0; } else if ((*numiotasks) > 0 ) { /* balance the number of iotasks to number of IO nodes */ numiotasks_per_node = floor((float)(*numiotasks)/ (float) numIONodes); /* put a minumum here so that we have a chance - though this may be too low */ if (numiotasks_per_node < 1) { numiotasks_per_node = 1; *numiotasks = numIONodes; } remainder = (*numiotasks) - numiotasks_per_node * numIONodes; } else if ((*numiotasks) == 0 ) { if((*stride) > 0) { numiotasks_per_node = numNodesInPset/(*stride); if (numiotasks_per_node < 1) { numiotasks_per_node = 1; *numiotasks = numIONodes; } } else { numiotasks_per_node = 8; /* default number of IO-client per IO-node is not otherwise specificied */ } remainder = 0; } /* number of IO nodes with a larger number of io-client per io-node */ if(remainder > 0) { if(rank ==0) {printf("Unbalanced IO-configuration: %i IO-nodes have %i IO-clients : %i IO-nodes have %i IO-clients \n", remainder, numiotasks_per_node+1, numIONodes-remainder,numiotasks_per_node);} lstride = min(np,floor((float)numNodesInPset/(float)(numiotasks_per_node+1))); } else { if(rank == 0) { printf("Balanced IO-configuration: %i IO-nodes have %i IO-clients\n",numIONodes-remainder, numiotasks_per_node); } lstride = min(np,floor((float)numNodesInPset/(float)numiotasks_per_node)); } /* Number of processor sets */ numPsets = numpsets; /* number of IO nodes in processor set (I need to add code to deal with the case where numIONodes_per_pset != 1 works correctly) */ numIONodes_per_pset = numIONodes/numPsets; /* Determine which core on node.... I don't want to put more than one io-task per node */ coreId = Kernel_PhysicalProcessorID (); /* What is the rank of this node in the processor set */ psetNum = psetID; rankInPset = psetrank; /* printf("Pset #: %i has %i nodes in Pset; base = %i\n",psetNum,numNodesInPset, *base); */ (*iamIOtask) = false; /* initialize to zero */ if (numiotasks_per_node == numNodesInPset)(*base) = 0; /* Reset the base to 0 if we are using all tasks */ /* start stridding MPI tasks from base task */ iam = max(0,rankInPset-(*base)); if (iam >= 0) { /* mark tasks that will be IO-tasks or IO-clients */ /* printf("iam = %d lstride = %d coreID = %d\n",iam,lstride,coreId); */ if((iam % lstride == 0) && (coreId == 0) ) { /* only io tasks indicated by stride and coreId = 0 */ if((iam/lstride) < numiotasks_per_node) { /* only set the first (numiotasks_per_node - 1) tasks */ (*iamIOtask) = true; } else if ((iam/lstride) == numiotasks_per_node) { /* If there is an uneven number of io-clients to io-nodes allocate the first remainder - 1 processor sets to have a total of numiotasks_per_node */ if(psetNum < remainder) {(*iamIOtask) = true; }; } } /* printf("comm = %d iam = %d lstride = %d coreID = %d iamIOtask = %i \n",comm, iam,lstride,coreId,(*iamIOtask)); */ } }else{ /* We are not doing rearrangement.... so all tasks are io-tasks */ (*iamIOtask) = true; } /*printf("comm = %d myrank = %i iotask = %i \n", comm, rank, (*iamIOtask));*/ /* now we need to correctly determine the numiotasks */ MPI_Allreduce(iamIOtask, &task_count, 1, MPI_INT, MPI_SUM, comm); (*numiotasks) = task_count; } int bgq_ion_id (void) { int iA, iB, iC, iD, iE; /* The local node's coordinates */ int nA, nB, nC, nD, nE; /* Size of each torus dimension */ int brA, brB, brC, brD, brE; /* The bridge node's coordinates */ int io_node_route_id; Personality_t personality; Kernel_GetPersonality(&personality, sizeof(personality)); iA = personality.Network_Config.Acoord; iB = personality.Network_Config.Bcoord; iC = personality.Network_Config.Ccoord; iD = personality.Network_Config.Dcoord; iE = personality.Network_Config.Ecoord; nA = personality.Network_Config.Anodes; nB = personality.Network_Config.Bnodes; nC = personality.Network_Config.Cnodes; nD = personality.Network_Config.Dnodes; nE = personality.Network_Config.Enodes; brA = personality.Network_Config.cnBridge_A; brB = personality.Network_Config.cnBridge_B; brC = personality.Network_Config.cnBridge_C; brD = personality.Network_Config.cnBridge_D; brE = personality.Network_Config.cnBridge_E; /* * This is the bridge node, numbered in ABCDE order, E increments first. * It is considered the unique "io node route identifer" because each * bridge node only has one torus link to one io node. */ io_node_route_id = brE + brD*nE + brC*nD*nE + brB*nC*nD*nE + brA*nB*nC*nD*nE; return io_node_route_id; } int bgq_pset_info (MPI_Comm comm, int* tot_pset, int* psetID, int* pset_size, int* rank_in_pset) { MPI_Comm comp_comm, pset_comm, bridge_comm; int comp_rank, status, key, bridge_root, tot_bridges, cur_pset, itr, t_buf; int temp_id, rem_psets; MPI_Status mpi_status; MPI_Comm_rank (comm, &comp_rank); status = MPI_Comm_dup ( comm, &comp_comm); if ( MPI_SUCCESS != status) { printf(" Error duplicating communicator \n"); MPI_Abort(comm, status); } // Compute the ION BridgeNode ID key = bgq_ion_id (); // Create the pset_comm per bridge node status = MPI_Comm_split ( comp_comm, key, comp_rank, &pset_comm); if ( MPI_SUCCESS != status) { printf(" Error splitting communicator \n"); MPI_Abort(comm, status); } // Calculate the rank in pset and pset size MPI_Comm_rank (pset_comm, rank_in_pset); MPI_Comm_size (pset_comm, pset_size); // Create the Bridge root nodes communicator bridge_root = 0; if (0 == *rank_in_pset) bridge_root = 1; // Calculate the total number of bridge nodes / psets tot_bridges = 0; MPI_Allreduce (&bridge_root, &tot_bridges, 1, MPI_INT, MPI_SUM, comm); *tot_pset = tot_bridges; // Calculate the Pset ID cur_pset = 0; rem_psets = tot_bridges; if ((0 == comp_rank) && (bridge_root ==1)) { *psetID = 0; rem_psets = tot_bridges-1; cur_pset++; } t_buf = 0; // Dummy value if (0 == comp_rank) { for (itr = 0; itr < rem_psets; itr++) { MPI_Recv (&t_buf,1, MPI_INT, MPI_ANY_SOURCE, MPI_ANY_TAG,comm, &mpi_status); MPI_Send (&cur_pset, 1, MPI_INT, mpi_status.MPI_SOURCE, 0, comm); cur_pset++; } } if ((1 == bridge_root) && ( 0 != comp_rank)) { MPI_Send (&t_buf, 1, MPI_INT, 0, 0, comm); MPI_Recv (&temp_id,1, MPI_INT, 0, 0, comm, &mpi_status); *psetID = temp_id; /*printf (" Pset ID is %d \n", *psetID);*/ } // Broadcast the PSET ID to all ranks in the psetcomm MPI_Bcast ( psetID, 1, MPI_INT, 0, pset_comm); // Free the split comm MPI_Comm_free (&pset_comm); MPI_Barrier (comm); return 0; } #endif
the_stack_data/50937.c
/**~action~ * AcceptEventAction [Class] * * Description * * An AcceptEventAction is an Action that waits for the occurrence of one or more specific Events. * * Diagrams * * Accept Event Actions * * Generalizations * * Action * * Specializations * * AcceptCallAction * * Attributes * *  isUnmarshall : Boolean [1..1] = false * * Indicates whether there is a single OutputPin for a SignalEvent occurrence, or multiple OutputPins for attribute * values of the instance of the Signal associated with a SignalEvent occurrence. * * Association Ends * *  ♦ result : OutputPin [0..*]{ordered, subsets Action::output} (opposite * A_result_acceptEventAction::acceptEventAction) * * OutputPins holding the values received from an Event occurrence. * *  ♦ trigger : Trigger [1..*]{subsets Element::ownedElement} (opposite * A_trigger_acceptEventAction::acceptEventAction) * * The Triggers specifying the Events of which the AcceptEventAction waits for occurrences. * * Constraints * *  one_output_pin * * If isUnmarshall=false and any of the triggers are for SignalEvents or TimeEvents, there must be exactly one * result OutputPin with multiplicity 1..1. * * inv: not isUnmarshall and trigger->exists(event.oclIsKindOf(SignalEvent) or * event.oclIsKindOf(TimeEvent)) implies * output->size() = 1 and output->first().is(1,1) * *  no_input_pins * * AcceptEventActions may have no input pins. * inv: input->size() = 0 * *  no_output_pins * * There are no OutputPins if the trigger events are only ChangeEvents and/or CallEvents when this action is an * instance of AcceptEventAction and not an instance of a descendant of AcceptEventAction (such as * AcceptCallAction). * * inv: (self.oclIsTypeOf(AcceptEventAction) and * (trigger->forAll(event.oclIsKindOf(ChangeEvent) or * event.oclIsKindOf(CallEvent)))) * implies output->size() = 0 * *  unmarshall_signal_events * * If isUnmarshall is true (and this is not an AcceptCallAction), there must be exactly one trigger, which is for a * SignalEvent. The number of result output pins must be the same as the number of attributes of the signal. The * type and ordering of each result output pin must be the same as the corresponding attribute of the signal. The * multiplicity of each result output pin must be compatible with the multiplicity of the corresponding attribute. * * inv: isUnmarshall and self.oclIsTypeOf(AcceptEventAction) implies * trigger->size()=1 and * trigger->asSequence()->first().event.oclIsKindOf(SignalEvent) and * let attribute: OrderedSet(Property) = trigger->asSequence()- * >first().event.oclAsType(SignalEvent).signal.allAttributes() in * attribute->size()>0 and result->size() = attribute->size() and * Sequence{1..result->size()}->forAll(i | * result->at(i).type = attribute->at(i).type and * result->at(i).isOrdered = attribute->at(i).isOrdered and * result->at(i).includesMultiplicity(attribute->at(i))) * *  conforming_type * * If isUnmarshall=false and all the triggers are for SignalEvents, then the type of the single result OutputPin * must either be null or all the signals must conform to it. * * inv: not isUnmarshall implies * result->isEmpty() or * let type: Type = result->first().type in * type=null or * (trigger->forAll(event.oclIsKindOf(SignalEvent)) and * trigger.event.oclAsType(SignalEvent).signal->forAll(s | s.conformsTo(type))) **/
the_stack_data/8830.c
#if __LITTLE_ENDIAN__ // THIS IS BROKEN FOR CROQUET /* ppc-sysv.c -- FFI support for PowerPC SVr4 ABI * * Author: [email protected] * * Last edited: 2003-02-06 20:08:58 by piumarta on felina.inria.fr * * Copyright (C) 1996-2004 by Ian Piumarta and other authors/contributors * listed elsewhere in this file. * All rights reserved. * * This file is part of Unix Squeak. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * * BUGS: * * Because of the way strings and structs are handled, this implementation * is neither reentrant nor thread safe. */ #include "sq.h" #include "sqFFI.h" #include <stdio.h> #include <stdlib.h> #ifndef LONGLONG # define LONGLONG long long #endif #if 1 # define DPRINTF(ARGS)printf ARGS #else # define DPRINTF(ARGS) #endif #if defined(FFI_TEST) static int primitiveFail(void) { puts("primitive fail"); exit(1); return 0; } #else extern struct VirtualMachine *interpreterProxy; # define primitiveFail() interpreterProxy->primitiveFail() #endif enum { FFI_MAX_STACK= 512 }; int ffiStack[FFI_MAX_STACK]; int ffiStackIndex= 0; static int giLocker; static char *ffiTempStrings[FFI_MAX_STACK]; static int ffiTempStringCount= 0; volatile int ffiIntReturnValue; volatile int ffiLongReturnValue; volatile double ffiFloatReturnValue; volatile int *ffiStructReturnValue; extern int ffiCallAddressOf(void *addr, void *stack, int size); static FILE *ffiLogFile = NULL; int ffiLogFileNameOfLength(void *nameIndex, int nameLength) { char fileName[MAX_PATH]; FILE *fp; if(nameIndex && nameLength) { if(nameLength >= MAX_PATH) return 0; strncpy(fileName, nameIndex, nameLength); fileName[nameLength] = 0; /* attempt to open the file and if we can't fail */ fp = fopen(fileName, "at"); if(fp == NULL) return 0; /* close the old log file if needed and use the new one */ if(ffiLogFile) fclose(ffiLogFile); ffiLogFile = fp; fprintf(ffiLogFile, "------- Log started -------\n"); fflush(fp); } else { if(ffiLogFile) fclose(ffiLogFile); ffiLogFile = NULL; } return 1; } int ffiLogCallOfLength(void *nameIndex, int nameLength) { if(ffiLogFile == NULL) return 0; fprintf(ffiLogFile, "%.*s\n", nameIndex, nameLength); fflush(ffiLogFile); } int ffiInitialize(void) { ffiStackIndex= 0; ffiFloatReturnValue= 0.0; return 1; } int ffiSupportsCallingConvention(int callType) { return (callType == FFICallTypeCDecl) || (callType == FFICallTypeApi); } int ffiAlloc(int byteSize) { return (int)malloc(byteSize); } int ffiFree(int ptr) { if (ptr) free((void *)ptr); return 1; } #define checkStack() \ if (ffiStackIndex >= FFI_MAX_STACK) \ return primitiveFail(); #define pushInt(value) \ checkStack(); \ ffiStack[ffiStackIndex++]= (value) int ffiCanReturn(int *structSpec, int specSize) { int header= *structSpec; DPRINTF(("ffiCanReturn structSpec %d specSize %d\n", structSpec, specSize)); if (header & FFIFlagPointer) return 1; if (header & FFIFlagStructure) { /* structs are always returned as pointers to hidden structures */ int structSize= header & FFIStructSizeMask; ffiStructReturnValue= malloc(structSize); if (!ffiStructReturnValue) return 0; DPRINTF(("ffiCanReturn allocated Spec %d \n", ffiStructReturnValue)); pushInt((int)ffiStructReturnValue); } return 1; } int ffiPushSignedChar(int value) { DPRINTF(("ffiPushSignedChar %d\n", value)); pushInt(value); return 1; } int ffiPushUnsignedChar(int value) { DPRINTF(("ffiPushUnsignedChar %d\n", value)); pushInt(value); return 1; } int ffiPushSignedByte(int value) { DPRINTF(("ffiPushSignedByte %d\n", value)); pushInt(value); return 1; } int ffiPushUnsignedByte(int value) { DPRINTF(("ffiPushUnsignedByte %d\n", value)); pushInt(value); return 1; } int ffiPushSignedShort(int value) { DPRINTF(("ffiPushSignedShort %d\n", value)); pushInt(value); return 1; } int ffiPushUnsignedShort(int value) { DPRINTF(("ffiPushUnsignedShort %d\n", value)); pushInt(value); return 1; } int ffiPushSignedInt(int value) { DPRINTF(("ffiPushSignedInt %d\n", value)); pushInt(value); return 1; } int ffiPushUnsignedInt(int value) { DPRINTF(("ffiPushUnsignedInt %d\n", value)); pushInt(value); return 1; } int ffiPushSignedLongLong(int low, int high) { DPRINTF(("ffiPushSignedLongLong %d %d\n", low, high)); pushInt(low); pushInt(high); return 1; } int ffiPushUnsignedLongLong(int low, int high) { DPRINTF(("ffiPushUnsignedLongLong %d %d\n", low, high)); pushInt(low); pushInt(high); return 1; } int ffiPushPointer(int pointer) { DPRINTF(("ffiPushPointer %d\n", pointer)); pushInt(pointer); return 1; } int ffiPushSingleFloat(double value) { float f= (float)value; DPRINTF(("ffiPushSingleFloat %f\n", value)); pushInt(*(int *)&f); return 1; } int ffiPushDoubleFloat(double value) { DPRINTF(("ffiPushDoubleFloat %f\n", value)); pushInt(((int *)&value)[0]); pushInt(((int *)&value)[1]); return 1; } int ffiPushStringOfLength(int srcIndex, int length) { char *ptr; DPRINTF(("ffiPushStringOfLength %d\n", length)); checkStack(); ptr= (char *)malloc(length + 1); if (!ptr) return primitiveFail(); DPRINTF((" ++ alloc string\n")); memcpy(ptr, (void *)srcIndex, length); ptr[length]= '\0'; ffiTempStrings[ffiTempStringCount++]= ptr; pushInt((int)ptr); return 1; } int ffiPushStructureOfLength(int pointer, int *structSpec, int specSize) { int lbs= *structSpec & FFIStructSizeMask; int size= (lbs + sizeof(int) - 1) / sizeof(int); DPRINTF(("ffiPushStructureOfLength %d (%db %dw)\n", specSize, lbs, size)); if (ffiStackIndex + size > FFI_MAX_STACK) return primitiveFail(); memcpy((void *)(ffiStack + ffiStackIndex), (void *)pointer, lbs); ffiStackIndex += size; return 1; } double ffiReturnFloatValue(void) { return ffiFloatReturnValue; } int ffiLongLongResultLow(void) { return ffiIntReturnValue; } int ffiLongLongResultHigh(void) { return ffiLongReturnValue; } int ffiStoreStructure(int address, int structSize) { DPRINTF(("ffiStoreStructure %d %d\n", address, structSize)); // JMM memcpy((void *)address, (ffiStructReturnValue // ? (void *)ffiStructReturnValue // : (void *)&ffiIntReturnValue), // structSize); if(structSize <= 4) { *(int*)address = ffiIntReturnValue; return 1; } if(structSize <= 8) { *(int*)address = ffiIntReturnValue; *(int*)(address+4) = ffiLongReturnValue; return 1; } /* assume pointer to hidden structure */ memcpy((void*)address, (void*) ffiStructReturnValue, structSize); return 1; } int ffiCleanup(void) { int i; DPRINTF(("ffiCleanup\n")); for (i= 0; i < ffiTempStringCount; ++i) { DPRINTF((" ++ free string\n")); free(ffiTempStrings[i]); } ffiTempStringCount= 0; if (ffiStructReturnValue) { DPRINTF((" ++ free struct\n")); free(ffiStructReturnValue); ffiStructReturnValue= 0; } return 1; } int ffiCallAddressOfWithPointerReturnx(int fn, int callType) { DPRINTF(("ffiCallAddressOfWithPointerReturnx fn %d callType %d \n", fn, callType)); return ffiCallAddressOf((void *)fn, (void *)ffiStack, ffiStackIndex * sizeof(int)); } int ffiCallAddressOfWithStructReturnx(int fn, int callType, int* structSpec, int specSize) { DPRINTF(("ffiCallAddressOfWithStructReturnx fn %d callType %d structSpec %d specSize %d\n", fn, callType, structSpec, specSize)); return ffiCallAddressOf((void *)fn, (void *)ffiStack, ffiStackIndex * sizeof(int)); } int ffiCallAddressOfWithReturnTypex(int fn, int callType, int typeSpec) { DPRINTF(("ffiCallAddressOfWithReturnTypex fn %d callType %d \n", fn, callType, typeSpec)); return ffiCallAddressOf((void *)fn, (void *)ffiStack, ffiStackIndex * sizeof(int)); } int ffiCallAddressOfWithPointerReturn(int fn, int callType) { int resultsOfCall; if (giLocker == 0) giLocker = interpreterProxy->ioLoadFunctionFrom("getUIToLock", ""); if (giLocker != 0) { long *foo; foo = malloc(sizeof(long)*5); foo[0] = 2; foo[1] = ffiCallAddressOfWithPointerReturnx; foo[2] = fn; foo[3] = callType; foo[4] = 0; ((int (*) (void *)) giLocker)(foo); resultsOfCall = foo[4]; free(foo); return resultsOfCall; } } int ffiCallAddressOfWithStructReturn(int fn, int callType, int* structSpec, int specSize) { int resultsOfCall; if (giLocker == 0) giLocker = interpreterProxy->ioLoadFunctionFrom("getUIToLock", ""); if (giLocker != 0) { long *foo; foo = malloc(sizeof(long)*7); foo[0] = 4; foo[1] = ffiCallAddressOfWithStructReturnx; foo[2] = fn; foo[3] = callType; foo[4] = structSpec; foo[5] = specSize; foo[6] = 0; ((int (*) (void *)) giLocker)(foo); resultsOfCall = foo[6]; free(foo); return resultsOfCall; } } int ffiCallAddressOfWithReturnType(int fn, int callType, int typeSpec) { int resultsOfCall; if (giLocker == 0) giLocker = interpreterProxy->ioLoadFunctionFrom("getUIToLock", ""); if (giLocker != 0) { long *foo; foo = malloc(sizeof(long)*6); foo[0] = 3; foo[1] = ffiCallAddressOfWithReturnTypex; foo[2] = fn; foo[3] = callType; foo[4] = typeSpec; foo[5] = 0; ((int (*) (void *)) giLocker)(foo); resultsOfCall = foo[5]; free(foo); return resultsOfCall; } } #if defined(FFI_TEST) void ffiDoAssertions(void) {} #endif #endif
the_stack_data/1207732.c
#include <assert.h> int main (void) { int i; int j; if (i <= 0 && j < i) assert(j < 0); if (j < i && i <= 0) assert(j < 0); return 0; }
the_stack_data/40763035.c
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> #include <time.h> #include <ctype.h> typedef struct coordinate { int row; int col; }Coordinate; typedef struct cell { int occupied; char symbol; Coordinate location; }Cell; typedef struct game_info { int wins; int loss; int games; }Game_info; void init_board(Cell board[][10], int num_rows, int num_cols); int main(void) { srand(time(NULL)); char *article[] = { "the", "a", "one", "some", "any" }; //Because this is char * the data cannot be changed char *noun[] = { "boy", "girl", "dog", "town", "car" }; char *verb[] = { "drove","jumped", "ran", "walked", "skipped" }; char *preposition[] = { "to", "from", "over", "under", "on" }; char sentance[100] = { '\0' }; char *space = { ' ' }; char *exclaim = { '!' }; char temp = '\0'; int index = 0; for (index = 0; index < 19; ++index) { sentance[0] = article[(rand() % 5)]; strcat(sentance, &space); strcpy(sentance, article[rand() % 5]); strcat(sentance, &space); strcat(sentance, noun[rand() % 5]); strcat(sentance, &space); strcat(sentance, verb[rand() % 5]); strcat(sentance, &space); strcat(sentance, preposition[rand() % 5]); strcat(sentance, &space); strcat(sentance, article[rand() % 5]); strcat(sentance, &space); strcat(sentance, noun[rand() % 5]); puts(sentance); //putchar('\n'); } sentance[0] = article[(rand() % 5)]; strcat(sentance, &space); strcpy(sentance, article[rand() % 5]); strcat(sentance, &space); strcat(sentance, noun[rand() % 5]); strcat(sentance, &space); strcat(sentance, verb[rand() % 5]); strcat(sentance, &space); strcat(sentance, preposition[rand() % 5]); strcat(sentance, &space); strcat(sentance, article[rand() % 5]); strcat(sentance, &space); strcat(sentance, noun[rand() % 5]); temp = sentance[0]; sentance[0] = (toupper(temp)); strcat(sentance, &exclaim); puts(sentance); /********************************/ /************Task 2**************/ int player = 0; int size = 0; int first_player = rand() % 2; printf("Enter size of game board: "); scanf("%d", &size); Cell game_board[][100] = { 0 }; init_board(game_board, size, size); } void init_board(Cell board[][10], int num_rows, int num_cols) { int row_index = 0, col_index = 0; for (; row_index < num_rows; ++row_index) { for (col_index = 0; col_index < num_cols; ++col_index) { board[row_index][col_index].location.row = row_index; board[row_index][col_index].location.col = col_index; board[row_index][col_index].symbol = '\0'; board[row_index][col_index].occupied = 0; } } }
the_stack_data/212643658.c
/* P0101: Add two polynomials * */ #include <stdio.h> #include <stdlib.h> #include <limits.h> #define MAX_LEN 300 #define DIGIT_LEN 10 /* Should be placed in a speparated header file */ struct Term; typedef struct Term *PtrToTerm; typedef PtrToTerm Polynomial; typedef Polynomial *ListOfPoly; PtrToTerm createTerm(int coefficient, int exponent); Polynomial initPoly(); Polynomial line2Poly(char *line); void insertTerm(Polynomial poly, PtrToTerm term); Polynomial addTwo(Polynomial a, Polynomial b); void destroyPoly(Polynomial poly); Polynomial resetPoly(Polynomial poly); void printPoly(Polynomial poly); void printResult(ListOfPoly list, int n); /* The implementation begins here */ struct Term { int coefficient; // the coefficient of the term int exponent; // the exponent of the term PtrToTerm next; }; int main() { int n = 0; scanf("%d", &n); if (n < 1 || n > 99) { printf("n should be within (1, 100)\n"); return 1; } ListOfPoly inputs = (ListOfPoly) malloc(sizeof(struct Term) * (n * 2)); int lineCount = 0; int numCount = 0; int coefficient; int exponent; int k; Polynomial poly = initPoly(); PtrToTerm term; for (lineCount = 0; lineCount < 2 * n; lineCount++) { while (1) { scanf("%d", &k); if (numCount % 2 == 0) { coefficient = k; numCount++; } else { if (k >= 0) { exponent = k; numCount++; term = createTerm(coefficient, exponent); insertTerm(poly, term); } else break; } } numCount = 0; coefficient = 0; inputs[lineCount] = poly; //destroyPoly(poly); if (lineCount < 2 * n - 1) poly = initPoly(); } int j; ListOfPoly outputs = (ListOfPoly) malloc(sizeof(struct Term) * n); for (j = 0; j < n; j++) { outputs[j] = addTwo(inputs[2 * j], inputs[2 * j + 1]); } printResult(outputs, n); return 0; } void printPoly(Polynomial poly) { poly = poly->next; while (poly != NULL) { if (poly->exponent > 0) { if (poly->next == NULL) printf("[ %d %d ]", poly->coefficient, poly->exponent); else printf("[ %d %d ] ", poly->coefficient, poly->exponent); } poly = poly->next; } printf("\n"); } void printResult(ListOfPoly list, int n) { int i = 0; Polynomial poly; for (i = 0; i < n; i++) { poly = list[i]; poly = poly->next; while (poly != NULL) { if (poly->exponent >= 0 && poly->coefficient != 0) { if (poly->next == NULL) printf("[ %d %d ]", poly->coefficient, poly->exponent); else printf("[ %d %d ] ", poly->coefficient, poly->exponent); } poly = poly->next; } printf("\n"); } } PtrToTerm createTerm(int coefficient, int exponent) { PtrToTerm pos = malloc(sizeof(struct Term)); pos->coefficient = coefficient; pos->exponent = exponent; pos->next = NULL; return pos; } Polynomial initPoly() { Polynomial poly = malloc(sizeof(struct Term)); if (poly == NULL) { printf("Fatal error: out of space!\n"); } else { poly->coefficient = INT_MAX; poly->exponent = INT_MAX; poly->next = NULL; } return poly; } Polynomial resetPoly(Polynomial poly) { PtrToTerm pos = poly->next; poly->next = NULL; destroyPoly(pos); return poly; } void destroyPoly(Polynomial poly) { PtrToTerm cursor = poly; while (cursor != NULL) { PtrToTerm tmp = cursor; cursor = cursor->next; free(tmp); } } /* insert a term to a given polynomial sorted by exponents increasingly */ void insertTerm(Polynomial poly, PtrToTerm term) { if (poly == NULL || term == NULL) { printf("Invalid input: NULL polynomial or term."); return; } if (poly->next == NULL) { poly->next = term; return; } // skip the head of the polynomial //poly = poly->next; while (poly->next != NULL) { if (poly->exponent >= term->exponent && poly->next->exponent < term->exponent) break; poly = poly->next; } if (poly->exponent == term->exponent) poly->coefficient += term->coefficient; else { term->next = poly->next; poly->next = term; } /* if (poly->next == NULL) poly->next = term; else { term->next = poly->next; poly->next = term; } */ return; } /* both polynomials are orderd by exponents increasingly */ Polynomial addTwo(Polynomial a, Polynomial b) { PtrToTerm pa = a->next; PtrToTerm pb = b->next; Polynomial result = initPoly(); PtrToTerm tmp = result; int coefficient, exponent; while (pa != NULL && pb != NULL) { if (pa->exponent < pb->exponent) { //pb = pb->next; coefficient = pb->coefficient; exponent = pb->exponent; pb = pb->next; } else if (pa->exponent > pb->exponent) { coefficient = pa->coefficient; exponent = pa->exponent; pa = pa->next; } else { coefficient = pa->coefficient + pb->coefficient; exponent = pa->exponent; pa = pa->next; pb = pb->next; } PtrToTerm term = createTerm(coefficient, exponent); tmp->next = term; tmp = tmp->next; } if (pa == NULL) tmp->next = pb; else if (pb == NULL) tmp->next = pa; return result; }
the_stack_data/150140884.c
#include<stdio.h> typedef unsigned char *byte_pointer; void show_bytes(byte_pointer start, size_t len) { size_t i; for(i=0;i<len;i++) printf("%.2x ",start[i]); } void main() { int x = 0x01234567; show_bytes((byte_pointer)&x, sizeof(float)); system("pause"); }
the_stack_data/68888360.c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strncmp.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: odursun <42istanbul.com.tr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2021/11/03 20:22:41 by odursun #+# #+# */ /* Updated: 2021/11/03 20:22:42 by odursun ### ########.tr */ /* */ /* ************************************************************************** */ int ft_strncmp(char *s1, char *s2, unsigned int n) { unsigned int i; i = 0; while ((s1[i] || s2[i]) && (i < n)) { if (s1[i] < s2[i]) return (-1); if (s1[i] > s2[i]) return (1); i++; } return (0); }
the_stack_data/220455045.c
/** * Copyright (c) 2017-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ #ifndef TH_GENERIC_FILE #define TH_GENERIC_FILE "generic/fftw.c" #else static int speech_(Fftw_forward)(lua_State *L) { THTensor *in = luaT_checkudata(L, 1, torch_Tensor); THTensor *out = luaT_checkudata(L, 2, torch_Tensor); THArgCheck(THTensor_(nDimension)(in) == 1, 1, "Input tensor is expected to be 1D"); THArgCheck(THTensor_(nDimension)(out) == 2, 2, "Output tensor is expected to be 2D"); in = THTensor_(newContiguous)(in); int n = THTensor_(size)(in, 0); real *out_data = THTensor_(data)(out); real *in_data = THTensor_(data)(in); #if defined(TH_REAL_IS_DOUBLE) fftw_complex *out_complex = (fftw_complex*)out_data; double *in_real = (double*)in_data; pthread_mutex_lock(&speech_fftw_plan_mutex); fftw_plan p = fftw_plan_dft_r2c_1d(n, in_real, out_complex, FFTW_ESTIMATE); pthread_mutex_unlock(&speech_fftw_plan_mutex); fftw_execute(p); pthread_mutex_lock(&speech_fftw_plan_mutex); fftw_destroy_plan(p); pthread_mutex_unlock(&speech_fftw_plan_mutex); #else fftwf_complex *out_complex = (fftwf_complex*)out_data; float *in_real = (float*)in_data; pthread_mutex_lock(&speech_fftw_plan_mutex); fftwf_plan p = fftwf_plan_dft_r2c_1d(n, in_real, out_complex, FFTW_ESTIMATE); pthread_mutex_unlock(&speech_fftw_plan_mutex); fftwf_execute(p); pthread_mutex_lock(&speech_fftw_plan_mutex); fftwf_destroy_plan(p); pthread_mutex_unlock(&speech_fftw_plan_mutex); #endif /* Copy stuff to the redundant part */ int i; for(i=n/2+1; i<n; i++) { out_data[2*i] = out_data[2*n-2*i]; out_data[2*i+1] = -out_data[2*n-2*i+1]; } /* clean up */ lua_pushvalue(L, 2); THTensor_(free)(in); return 1; } static const struct luaL_Reg speech_(Fftw__) [] = { {"Fftw_forward", speech_(Fftw_forward)}, {NULL, NULL} }; static void speech_(Fftw_init)(lua_State *L) { luaT_pushmetatable(L, torch_Tensor); luaT_registeratname(L, speech_(Fftw__), "speech"); lua_pop(L,1); } #endif
the_stack_data/161080226.c
// #23 typedef const int foo; /*=== Declaration DeclarationSpecifier StorageClassSpecifier Typedef DeclarationSpecifier TypeQualifier Const DeclarationSpecifier TypeSpecifier Int InitDeclarator Declarator DeclaratorKind Identifier "foo" ===*/
the_stack_data/95664.c
/* * Copyright (c) 2006 Apple Computer, Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ void baz() { }
the_stack_data/433042.c
#if defined(_WIN32) || defined(__CYGWIN__) #define testLibNoSONAME_EXPORT __declspec(dllexport) #else #define testLibNoSONAME_EXPORT #endif testLibNoSONAME_EXPORT int testLibNoSoName(void) { return 0; }
the_stack_data/157951686.c
/* * There are no source files here, but libboard.a can't be empty, so * we have this empty source file to keep it company. */
the_stack_data/75322.c
/* discard_locals_test.c -- test --discard-locals option. Copyright (C) 2009-2014 Free Software Foundation, Inc. Doug Kwan <[email protected]>. This file is part of gold. 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; either version 3 of the License, or (at your option) any later version. 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. This is a test of a common symbol in the main program and a versioned symbol in a shared library. The common symbol in the main program should override the shared library symbol. */ /* Local symbol format for generic ELF target. */ asm (".Lshould_be_discarded:"); #ifdef __i386__ /* Additional local symbol format for the i386 target. */ asm (".Xshould_be_discarded:"); #endif int main (void) { return 0; }
the_stack_data/218894136.c
#include <sys/socket.h> //socket function #include <unistd.h> //fork,exec,read,write #include <netinet/in.h> //seq bytes adjust,socket address #include <arpa/inet.h> //inet_pton,inet_ntop #include <strings.h> //bzero #include <stdio.h> //printf #include <sys/errno.h> //errno #include <stdlib.h> //exit #include <string.h> //strlen #include <netdb.h> //DNS,addr-name,name-addr #include <signal.h> //signal #include <sys/select.h> //select #include <sys/time.h> //struct timeval typedef void Sigfun (int); void str_cli(FILE *fp,int sockfd); void AlarmDispose(int sig); int main(int args,char **argv) { int sockfd; struct addrinfo hints,*result = NULL; struct addrinfo *tmpAddrinfoPtr = NULL; int reValue; Sigfun * sAlarmFun; int nsec = 20; bzero(&hints,sizeof(struct addrinfo)); hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; if(args != 2) //如果用户忘记输入地址,使用默认地址 { printf("Use localhost!\n"); reValue = getaddrinfo("localhost","echo",&hints,&result); } else { reValue = getaddrinfo(argv[1],"echo",&hints,&result); } if(reValue != 0) { printf("%s",gai_strerror(reValue)); exit(-1); } sAlarmFun = signal(SIGHUP,AlarmDispose); //将ALarm处理函数和信号绑定 tmpAddrinfoPtr = result; while(tmpAddrinfoPtr != NULL) //顺序检验返回结果,寻找有效的地址 { if((sockfd = socket(tmpAddrinfoPtr->ai_family,tmpAddrinfoPtr->ai_socktype,tmpAddrinfoPtr->ai_protocol)) < 0) { printf("socketfd create wrong"); exit(-1); } if(alarm(nsec) != 0) //version4,设置超时位20s printf("alarm was already set\n"); if(connect(sockfd,tmpAddrinfoPtr->ai_addr,tmpAddrinfoPtr->ai_addrlen) < 0) { if(errno == EINTR) { printf("connect timeout:%d s!",nsec); } alarm(0); //关闭时钟 close(sockfd); tmpAddrinfoPtr = tmpAddrinfoPtr->ai_next; } else { alarm(0); break; } } signal(SIGALRM,sAlarmFun); //还原信号处理函数 if(tmpAddrinfoPtr == NULL) //连接失败,退出 { printf("can not connect to the host!"); exit(-1); } freeaddrinfo(result); //释放getaddrinfo函数内分配的空间 str_cli(stdin,sockfd); printf("The client is shut!"); } const unsigned int MAXLEN = 100; void str_cli(FILE *fp,int sockfd) { char inStr[MAXLEN]; unsigned int curLen; int n; unsigned int sendNum = 0; fd_set rdSet; //version4 用于给read函数设置超时 struct timeval tVal; int seconds = 10; //select的计时秒数 int wdSeconds = 8; //setsockopt设置write超时的秒数 //设置套接字选项,所有该套接字的写都不能超多wdSeconds tVal.tv_sec = wdSeconds; tVal.tv_usec = 0; if(setsockopt(sockfd,SOL_SOCKET,SO_SNDTIMEO,&tVal,sizeof(struct timeval)) < 0) { printf("Set socket write timeout option failed!"); } while(fgets(inStr,MAXLEN,fp)) { sendNum = 0; curLen = strlen(inStr); while(sendNum < curLen) //make sure all data was written { n = write(sockfd,inStr + sendNum,curLen - sendNum); if(n < 0) { if(errno == EINTR || errno == EWOULDBLOCK) { n = 0; //清零,防止后面影响发送计数 continue; } else { printf("Write to socket wrong!"); exit(-1); } } if(n == 0) break; sendNum += n; } if(sendNum != curLen) printf("This data can not send completely!\n"); //适用select监测套接字可读,如果超时不可读则报错 FD_ZERO(&rdSet); //设置select监测的集合 FD_SET(sockfd,&rdSet); tVal.tv_sec = seconds; tVal.tv_usec = 0; n = select(sockfd + 1,&rdSet,NULL,NULL,&tVal); if(n == 0) printf("read from server:time out!"); else { n = read(sockfd,inStr,MAXLEN); if(n <= 0) //read after write can not be EOF { printf("Read from server failed!"); exit(-1); } } if(fputs(inStr,stdout) == EOF) { printf("fputs error!"); exit(-1); } } } //该函数不必处理任何事情,使用alarm信号的原因是,其超时会中断connect程序。 void AlarmDispose(int sig) { return; }
the_stack_data/179831267.c
#include <stdio.h> int main(int argc, char const *argv[]) { int n; scanf("%d", &n); if (n > 2) { printf("%s\n", ((n & 1) == 0)?"YES":"NO"); } else { printf("NO\n"); } return 0; }
the_stack_data/6388833.c
/*WAP to reverse the first m elements of a linked list of n nodes.*/ #include <stdio.h> #include <stdlib.h> struct Node{ int data; struct Node* next; }; struct Node* createNode(int data){ struct Node* t=(struct Node* )malloc(sizeof(struct Node)); t->data=data; t->next=NULL; return t; } void dealloc(struct Node* ptr){ // in this case LL struct Node* t=0; while(ptr){ t=ptr; t=t->next; free(ptr); ptr=t; } free(t); } void print(struct Node* k){ do{ printf("%d ",k->data); k=k->next; }while(k && printf("->")); printf("\n"); } struct Node* exec(struct Node* h, int m){ // assumming the m<n struct Node* start=h; //savingthe1asitwillbethelasttobeconnected struct Node* curr=h; struct Node* prev=NULL; struct Node* next=h; while(m-- && curr){ next=next->next; curr->next=prev; prev=curr; curr=next; } start->next = next; return prev; } int main(int argc, char const *argv[]){ struct Node* head=NULL; head=createNode(1); head->next=createNode(2); head->next->next=createNode(3); head->next->next->next=createNode(4); head->next->next->next->next=createNode(5); head->next->next->next->next->next=createNode(6); int m; print(head); printf("enter a element: "); scanf("%d",&m); head=exec(head,m); print(head); dealloc(head); remove(argv[0]); return 0; }
the_stack_data/52464.c
#include <stdlib.h> int main(void) { void *ptr1 = calloc(1, sizeof(char)); if (ptr1 == NULL) return EXIT_SUCCESS; char *ptr2 = realloc(ptr1, 2 * sizeof(char)); if (ptr2 == NULL) { *ptr2 = 'A'; /* error */ free(ptr1); return EXIT_SUCCESS; } free(ptr2); } /** * @file 0052-test.c * * @brief Usage of pointer after possible realloc failure. */
the_stack_data/144311.c
// WARNING: ODEBUG bug in exit_to_usermode_loop // https://syzkaller.appspot.com/bug?id=55c67ce74d4586507d2f // status:6 // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include <arpa/inet.h> #include <dirent.h> #include <endian.h> #include <errno.h> #include <fcntl.h> #include <net/if.h> #include <net/if_arp.h> #include <netinet/in.h> #include <pthread.h> #include <sched.h> #include <setjmp.h> #include <signal.h> #include <stdarg.h> #include <stdbool.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/epoll.h> #include <sys/ioctl.h> #include <sys/mount.h> #include <sys/prctl.h> #include <sys/resource.h> #include <sys/socket.h> #include <sys/stat.h> #include <sys/syscall.h> #include <sys/time.h> #include <sys/types.h> #include <sys/uio.h> #include <sys/wait.h> #include <time.h> #include <unistd.h> #include <linux/capability.h> #include <linux/futex.h> #include <linux/genetlink.h> #include <linux/if_addr.h> #include <linux/if_ether.h> #include <linux/if_link.h> #include <linux/if_tun.h> #include <linux/in6.h> #include <linux/ip.h> #include <linux/neighbour.h> #include <linux/net.h> #include <linux/netlink.h> #include <linux/rfkill.h> #include <linux/rtnetlink.h> #include <linux/tcp.h> #include <linux/veth.h> static unsigned long long procid; static __thread int skip_segv; static __thread jmp_buf segv_env; static void segv_handler(int sig, siginfo_t* info, void* ctx) { uintptr_t addr = (uintptr_t)info->si_addr; const uintptr_t prog_start = 1 << 20; const uintptr_t prog_end = 100 << 20; int skip = __atomic_load_n(&skip_segv, __ATOMIC_RELAXED) != 0; int valid = addr < prog_start || addr > prog_end; if (skip && valid) { _longjmp(segv_env, 1); } exit(sig); } static void install_segv_handler(void) { struct sigaction sa; memset(&sa, 0, sizeof(sa)); sa.sa_handler = SIG_IGN; syscall(SYS_rt_sigaction, 0x20, &sa, NULL, 8); syscall(SYS_rt_sigaction, 0x21, &sa, NULL, 8); memset(&sa, 0, sizeof(sa)); sa.sa_sigaction = segv_handler; sa.sa_flags = SA_NODEFER | SA_SIGINFO; sigaction(SIGSEGV, &sa, NULL); sigaction(SIGBUS, &sa, NULL); } #define NONFAILING(...) \ { \ __atomic_fetch_add(&skip_segv, 1, __ATOMIC_SEQ_CST); \ if (_setjmp(segv_env) == 0) { \ __VA_ARGS__; \ } \ __atomic_fetch_sub(&skip_segv, 1, __ATOMIC_SEQ_CST); \ } static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); syscall(SYS_futex, &ev->state, FUTEX_WAKE | FUTEX_PRIVATE_FLAG, 1000000); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) syscall(SYS_futex, &ev->state, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, 0, 0); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout) { uint64_t start = current_time_ms(); uint64_t now = start; for (;;) { uint64_t remain = timeout - (now - start); struct timespec ts; ts.tv_sec = remain / 1000; ts.tv_nsec = (remain % 1000) * 1000 * 1000; syscall(SYS_futex, &ev->state, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, 0, &ts); if (__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) return 1; now = current_time_ms(); if (now - start > timeout) return 0; } } static bool write_file(const char* file, const char* what, ...) { char buf[1024]; va_list args; va_start(args, what); vsnprintf(buf, sizeof(buf), what, args); va_end(args); buf[sizeof(buf) - 1] = 0; int len = strlen(buf); int fd = open(file, O_WRONLY | O_CLOEXEC); if (fd == -1) return false; if (write(fd, buf, len) != len) { int err = errno; close(fd); errno = err; return false; } close(fd); return true; } struct nlmsg { char* pos; int nesting; struct nlattr* nested[8]; char buf[1024]; }; static struct nlmsg nlmsg; static void netlink_init(struct nlmsg* nlmsg, int typ, int flags, const void* data, int size) { memset(nlmsg, 0, sizeof(*nlmsg)); struct nlmsghdr* hdr = (struct nlmsghdr*)nlmsg->buf; hdr->nlmsg_type = typ; hdr->nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK | flags; memcpy(hdr + 1, data, size); nlmsg->pos = (char*)(hdr + 1) + NLMSG_ALIGN(size); } static void netlink_attr(struct nlmsg* nlmsg, int typ, const void* data, int size) { struct nlattr* attr = (struct nlattr*)nlmsg->pos; attr->nla_len = sizeof(*attr) + size; attr->nla_type = typ; memcpy(attr + 1, data, size); nlmsg->pos += NLMSG_ALIGN(attr->nla_len); } static void netlink_nest(struct nlmsg* nlmsg, int typ) { struct nlattr* attr = (struct nlattr*)nlmsg->pos; attr->nla_type = typ; nlmsg->pos += sizeof(*attr); nlmsg->nested[nlmsg->nesting++] = attr; } static void netlink_done(struct nlmsg* nlmsg) { struct nlattr* attr = nlmsg->nested[--nlmsg->nesting]; attr->nla_len = nlmsg->pos - (char*)attr; } static int netlink_send_ext(struct nlmsg* nlmsg, int sock, uint16_t reply_type, int* reply_len) { if (nlmsg->pos > nlmsg->buf + sizeof(nlmsg->buf) || nlmsg->nesting) exit(1); struct nlmsghdr* hdr = (struct nlmsghdr*)nlmsg->buf; hdr->nlmsg_len = nlmsg->pos - nlmsg->buf; struct sockaddr_nl addr; memset(&addr, 0, sizeof(addr)); addr.nl_family = AF_NETLINK; unsigned n = sendto(sock, nlmsg->buf, hdr->nlmsg_len, 0, (struct sockaddr*)&addr, sizeof(addr)); if (n != hdr->nlmsg_len) exit(1); n = recv(sock, nlmsg->buf, sizeof(nlmsg->buf), 0); if (reply_len) *reply_len = 0; if (hdr->nlmsg_type == NLMSG_DONE) return 0; if (n < sizeof(struct nlmsghdr)) exit(1); if (reply_len && hdr->nlmsg_type == reply_type) { *reply_len = n; return 0; } if (n < sizeof(struct nlmsghdr) + sizeof(struct nlmsgerr)) exit(1); if (hdr->nlmsg_type != NLMSG_ERROR) exit(1); return -((struct nlmsgerr*)(hdr + 1))->error; } static int netlink_send(struct nlmsg* nlmsg, int sock) { return netlink_send_ext(nlmsg, sock, 0, NULL); } static int netlink_next_msg(struct nlmsg* nlmsg, unsigned int offset, unsigned int total_len) { struct nlmsghdr* hdr = (struct nlmsghdr*)(nlmsg->buf + offset); if (offset == total_len || offset + hdr->nlmsg_len > total_len) return -1; return hdr->nlmsg_len; } static void netlink_add_device_impl(struct nlmsg* nlmsg, const char* type, const char* name) { struct ifinfomsg hdr; memset(&hdr, 0, sizeof(hdr)); netlink_init(nlmsg, RTM_NEWLINK, NLM_F_EXCL | NLM_F_CREATE, &hdr, sizeof(hdr)); if (name) netlink_attr(nlmsg, IFLA_IFNAME, name, strlen(name)); netlink_nest(nlmsg, IFLA_LINKINFO); netlink_attr(nlmsg, IFLA_INFO_KIND, type, strlen(type)); } static void netlink_add_device(struct nlmsg* nlmsg, int sock, const char* type, const char* name) { netlink_add_device_impl(nlmsg, type, name); netlink_done(nlmsg); int err = netlink_send(nlmsg, sock); (void)err; } static void netlink_add_veth(struct nlmsg* nlmsg, int sock, const char* name, const char* peer) { netlink_add_device_impl(nlmsg, "veth", name); netlink_nest(nlmsg, IFLA_INFO_DATA); netlink_nest(nlmsg, VETH_INFO_PEER); nlmsg->pos += sizeof(struct ifinfomsg); netlink_attr(nlmsg, IFLA_IFNAME, peer, strlen(peer)); netlink_done(nlmsg); netlink_done(nlmsg); netlink_done(nlmsg); int err = netlink_send(nlmsg, sock); (void)err; } static void netlink_add_hsr(struct nlmsg* nlmsg, int sock, const char* name, const char* slave1, const char* slave2) { netlink_add_device_impl(nlmsg, "hsr", name); netlink_nest(nlmsg, IFLA_INFO_DATA); int ifindex1 = if_nametoindex(slave1); netlink_attr(nlmsg, IFLA_HSR_SLAVE1, &ifindex1, sizeof(ifindex1)); int ifindex2 = if_nametoindex(slave2); netlink_attr(nlmsg, IFLA_HSR_SLAVE2, &ifindex2, sizeof(ifindex2)); netlink_done(nlmsg); netlink_done(nlmsg); int err = netlink_send(nlmsg, sock); (void)err; } static void netlink_add_linked(struct nlmsg* nlmsg, int sock, const char* type, const char* name, const char* link) { netlink_add_device_impl(nlmsg, type, name); netlink_done(nlmsg); int ifindex = if_nametoindex(link); netlink_attr(nlmsg, IFLA_LINK, &ifindex, sizeof(ifindex)); int err = netlink_send(nlmsg, sock); (void)err; } static void netlink_add_vlan(struct nlmsg* nlmsg, int sock, const char* name, const char* link, uint16_t id, uint16_t proto) { netlink_add_device_impl(nlmsg, "vlan", name); netlink_nest(nlmsg, IFLA_INFO_DATA); netlink_attr(nlmsg, IFLA_VLAN_ID, &id, sizeof(id)); netlink_attr(nlmsg, IFLA_VLAN_PROTOCOL, &proto, sizeof(proto)); netlink_done(nlmsg); netlink_done(nlmsg); int ifindex = if_nametoindex(link); netlink_attr(nlmsg, IFLA_LINK, &ifindex, sizeof(ifindex)); int err = netlink_send(nlmsg, sock); (void)err; } static void netlink_add_macvlan(struct nlmsg* nlmsg, int sock, const char* name, const char* link) { netlink_add_device_impl(nlmsg, "macvlan", name); netlink_nest(nlmsg, IFLA_INFO_DATA); uint32_t mode = MACVLAN_MODE_BRIDGE; netlink_attr(nlmsg, IFLA_MACVLAN_MODE, &mode, sizeof(mode)); netlink_done(nlmsg); netlink_done(nlmsg); int ifindex = if_nametoindex(link); netlink_attr(nlmsg, IFLA_LINK, &ifindex, sizeof(ifindex)); int err = netlink_send(nlmsg, sock); (void)err; } static void netlink_add_geneve(struct nlmsg* nlmsg, int sock, const char* name, uint32_t vni, struct in_addr* addr4, struct in6_addr* addr6) { netlink_add_device_impl(nlmsg, "geneve", name); netlink_nest(nlmsg, IFLA_INFO_DATA); netlink_attr(nlmsg, IFLA_GENEVE_ID, &vni, sizeof(vni)); if (addr4) netlink_attr(nlmsg, IFLA_GENEVE_REMOTE, addr4, sizeof(*addr4)); if (addr6) netlink_attr(nlmsg, IFLA_GENEVE_REMOTE6, addr6, sizeof(*addr6)); netlink_done(nlmsg); netlink_done(nlmsg); int err = netlink_send(nlmsg, sock); (void)err; } #define IFLA_IPVLAN_FLAGS 2 #define IPVLAN_MODE_L3S 2 #undef IPVLAN_F_VEPA #define IPVLAN_F_VEPA 2 static void netlink_add_ipvlan(struct nlmsg* nlmsg, int sock, const char* name, const char* link, uint16_t mode, uint16_t flags) { netlink_add_device_impl(nlmsg, "ipvlan", name); netlink_nest(nlmsg, IFLA_INFO_DATA); netlink_attr(nlmsg, IFLA_IPVLAN_MODE, &mode, sizeof(mode)); netlink_attr(nlmsg, IFLA_IPVLAN_FLAGS, &flags, sizeof(flags)); netlink_done(nlmsg); netlink_done(nlmsg); int ifindex = if_nametoindex(link); netlink_attr(nlmsg, IFLA_LINK, &ifindex, sizeof(ifindex)); int err = netlink_send(nlmsg, sock); (void)err; } static void netlink_device_change(struct nlmsg* nlmsg, int sock, const char* name, bool up, const char* master, const void* mac, int macsize, const char* new_name) { struct ifinfomsg hdr; memset(&hdr, 0, sizeof(hdr)); if (up) hdr.ifi_flags = hdr.ifi_change = IFF_UP; hdr.ifi_index = if_nametoindex(name); netlink_init(nlmsg, RTM_NEWLINK, 0, &hdr, sizeof(hdr)); if (new_name) netlink_attr(nlmsg, IFLA_IFNAME, new_name, strlen(new_name)); if (master) { int ifindex = if_nametoindex(master); netlink_attr(nlmsg, IFLA_MASTER, &ifindex, sizeof(ifindex)); } if (macsize) netlink_attr(nlmsg, IFLA_ADDRESS, mac, macsize); int err = netlink_send(nlmsg, sock); (void)err; } static int netlink_add_addr(struct nlmsg* nlmsg, int sock, const char* dev, const void* addr, int addrsize) { struct ifaddrmsg hdr; memset(&hdr, 0, sizeof(hdr)); hdr.ifa_family = addrsize == 4 ? AF_INET : AF_INET6; hdr.ifa_prefixlen = addrsize == 4 ? 24 : 120; hdr.ifa_scope = RT_SCOPE_UNIVERSE; hdr.ifa_index = if_nametoindex(dev); netlink_init(nlmsg, RTM_NEWADDR, NLM_F_CREATE | NLM_F_REPLACE, &hdr, sizeof(hdr)); netlink_attr(nlmsg, IFA_LOCAL, addr, addrsize); netlink_attr(nlmsg, IFA_ADDRESS, addr, addrsize); return netlink_send(nlmsg, sock); } static void netlink_add_addr4(struct nlmsg* nlmsg, int sock, const char* dev, const char* addr) { struct in_addr in_addr; inet_pton(AF_INET, addr, &in_addr); int err = netlink_add_addr(nlmsg, sock, dev, &in_addr, sizeof(in_addr)); (void)err; } static void netlink_add_addr6(struct nlmsg* nlmsg, int sock, const char* dev, const char* addr) { struct in6_addr in6_addr; inet_pton(AF_INET6, addr, &in6_addr); int err = netlink_add_addr(nlmsg, sock, dev, &in6_addr, sizeof(in6_addr)); (void)err; } static void netlink_add_neigh(struct nlmsg* nlmsg, int sock, const char* name, const void* addr, int addrsize, const void* mac, int macsize) { struct ndmsg hdr; memset(&hdr, 0, sizeof(hdr)); hdr.ndm_family = addrsize == 4 ? AF_INET : AF_INET6; hdr.ndm_ifindex = if_nametoindex(name); hdr.ndm_state = NUD_PERMANENT; netlink_init(nlmsg, RTM_NEWNEIGH, NLM_F_EXCL | NLM_F_CREATE, &hdr, sizeof(hdr)); netlink_attr(nlmsg, NDA_DST, addr, addrsize); netlink_attr(nlmsg, NDA_LLADDR, mac, macsize); int err = netlink_send(nlmsg, sock); (void)err; } static int tunfd = -1; #define TUN_IFACE "syz_tun" #define LOCAL_MAC 0xaaaaaaaaaaaa #define REMOTE_MAC 0xaaaaaaaaaabb #define LOCAL_IPV4 "172.20.20.170" #define REMOTE_IPV4 "172.20.20.187" #define LOCAL_IPV6 "fe80::aa" #define REMOTE_IPV6 "fe80::bb" #define IFF_NAPI 0x0010 static void initialize_tun(void) { tunfd = open("/dev/net/tun", O_RDWR | O_NONBLOCK); if (tunfd == -1) { printf("tun: can't open /dev/net/tun: please enable CONFIG_TUN=y\n"); printf("otherwise fuzzing or reproducing might not work as intended\n"); return; } const int kTunFd = 240; if (dup2(tunfd, kTunFd) < 0) exit(1); close(tunfd); tunfd = kTunFd; struct ifreq ifr; memset(&ifr, 0, sizeof(ifr)); strncpy(ifr.ifr_name, TUN_IFACE, IFNAMSIZ); ifr.ifr_flags = IFF_TAP | IFF_NO_PI; if (ioctl(tunfd, TUNSETIFF, (void*)&ifr) < 0) { exit(1); } char sysctl[64]; sprintf(sysctl, "/proc/sys/net/ipv6/conf/%s/accept_dad", TUN_IFACE); write_file(sysctl, "0"); sprintf(sysctl, "/proc/sys/net/ipv6/conf/%s/router_solicitations", TUN_IFACE); write_file(sysctl, "0"); int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE); if (sock == -1) exit(1); netlink_add_addr4(&nlmsg, sock, TUN_IFACE, LOCAL_IPV4); netlink_add_addr6(&nlmsg, sock, TUN_IFACE, LOCAL_IPV6); uint64_t macaddr = REMOTE_MAC; struct in_addr in_addr; inet_pton(AF_INET, REMOTE_IPV4, &in_addr); netlink_add_neigh(&nlmsg, sock, TUN_IFACE, &in_addr, sizeof(in_addr), &macaddr, ETH_ALEN); struct in6_addr in6_addr; inet_pton(AF_INET6, REMOTE_IPV6, &in6_addr); netlink_add_neigh(&nlmsg, sock, TUN_IFACE, &in6_addr, sizeof(in6_addr), &macaddr, ETH_ALEN); macaddr = LOCAL_MAC; netlink_device_change(&nlmsg, sock, TUN_IFACE, true, 0, &macaddr, ETH_ALEN, NULL); close(sock); } #define DEVLINK_FAMILY_NAME "devlink" #define DEVLINK_CMD_PORT_GET 5 #define DEVLINK_ATTR_BUS_NAME 1 #define DEVLINK_ATTR_DEV_NAME 2 #define DEVLINK_ATTR_NETDEV_NAME 7 static int netlink_devlink_id_get(struct nlmsg* nlmsg, int sock) { struct genlmsghdr genlhdr; memset(&genlhdr, 0, sizeof(genlhdr)); genlhdr.cmd = CTRL_CMD_GETFAMILY; netlink_init(nlmsg, GENL_ID_CTRL, 0, &genlhdr, sizeof(genlhdr)); netlink_attr(nlmsg, CTRL_ATTR_FAMILY_NAME, DEVLINK_FAMILY_NAME, strlen(DEVLINK_FAMILY_NAME) + 1); int n = 0; int err = netlink_send_ext(nlmsg, sock, GENL_ID_CTRL, &n); if (err) { return -1; } uint16_t id = 0; struct nlattr* attr = (struct nlattr*)(nlmsg->buf + NLMSG_HDRLEN + NLMSG_ALIGN(sizeof(genlhdr))); for (; (char*)attr < nlmsg->buf + n; attr = (struct nlattr*)((char*)attr + NLMSG_ALIGN(attr->nla_len))) { if (attr->nla_type == CTRL_ATTR_FAMILY_ID) { id = *(uint16_t*)(attr + 1); break; } } if (!id) { return -1; } recv(sock, nlmsg->buf, sizeof(nlmsg->buf), 0); return id; } static struct nlmsg nlmsg2; static void initialize_devlink_ports(const char* bus_name, const char* dev_name, const char* netdev_prefix) { struct genlmsghdr genlhdr; int len, total_len, id, err, offset; uint16_t netdev_index; int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC); if (sock == -1) exit(1); int rtsock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE); if (rtsock == -1) exit(1); id = netlink_devlink_id_get(&nlmsg, sock); if (id == -1) goto error; memset(&genlhdr, 0, sizeof(genlhdr)); genlhdr.cmd = DEVLINK_CMD_PORT_GET; netlink_init(&nlmsg, id, NLM_F_DUMP, &genlhdr, sizeof(genlhdr)); netlink_attr(&nlmsg, DEVLINK_ATTR_BUS_NAME, bus_name, strlen(bus_name) + 1); netlink_attr(&nlmsg, DEVLINK_ATTR_DEV_NAME, dev_name, strlen(dev_name) + 1); err = netlink_send_ext(&nlmsg, sock, id, &total_len); if (err) { goto error; } offset = 0; netdev_index = 0; while ((len = netlink_next_msg(&nlmsg, offset, total_len)) != -1) { struct nlattr* attr = (struct nlattr*)(nlmsg.buf + offset + NLMSG_HDRLEN + NLMSG_ALIGN(sizeof(genlhdr))); for (; (char*)attr < nlmsg.buf + offset + len; attr = (struct nlattr*)((char*)attr + NLMSG_ALIGN(attr->nla_len))) { if (attr->nla_type == DEVLINK_ATTR_NETDEV_NAME) { char* port_name; char netdev_name[IFNAMSIZ]; port_name = (char*)(attr + 1); snprintf(netdev_name, sizeof(netdev_name), "%s%d", netdev_prefix, netdev_index); netlink_device_change(&nlmsg2, rtsock, port_name, true, 0, 0, 0, netdev_name); break; } } offset += len; netdev_index++; } error: close(rtsock); close(sock); } #define DEV_IPV4 "172.20.20.%d" #define DEV_IPV6 "fe80::%02x" #define DEV_MAC 0x00aaaaaaaaaa static void netdevsim_add(unsigned int addr, unsigned int port_count) { char buf[16]; sprintf(buf, "%u %u", addr, port_count); if (write_file("/sys/bus/netdevsim/new_device", buf)) { snprintf(buf, sizeof(buf), "netdevsim%d", addr); initialize_devlink_ports("netdevsim", buf, "netdevsim"); } } #define WG_GENL_NAME "wireguard" enum wg_cmd { WG_CMD_GET_DEVICE, WG_CMD_SET_DEVICE, }; enum wgdevice_attribute { WGDEVICE_A_UNSPEC, WGDEVICE_A_IFINDEX, WGDEVICE_A_IFNAME, WGDEVICE_A_PRIVATE_KEY, WGDEVICE_A_PUBLIC_KEY, WGDEVICE_A_FLAGS, WGDEVICE_A_LISTEN_PORT, WGDEVICE_A_FWMARK, WGDEVICE_A_PEERS, }; enum wgpeer_attribute { WGPEER_A_UNSPEC, WGPEER_A_PUBLIC_KEY, WGPEER_A_PRESHARED_KEY, WGPEER_A_FLAGS, WGPEER_A_ENDPOINT, WGPEER_A_PERSISTENT_KEEPALIVE_INTERVAL, WGPEER_A_LAST_HANDSHAKE_TIME, WGPEER_A_RX_BYTES, WGPEER_A_TX_BYTES, WGPEER_A_ALLOWEDIPS, WGPEER_A_PROTOCOL_VERSION, }; enum wgallowedip_attribute { WGALLOWEDIP_A_UNSPEC, WGALLOWEDIP_A_FAMILY, WGALLOWEDIP_A_IPADDR, WGALLOWEDIP_A_CIDR_MASK, }; static int netlink_wireguard_id_get(struct nlmsg* nlmsg, int sock) { struct genlmsghdr genlhdr; memset(&genlhdr, 0, sizeof(genlhdr)); genlhdr.cmd = CTRL_CMD_GETFAMILY; netlink_init(nlmsg, GENL_ID_CTRL, 0, &genlhdr, sizeof(genlhdr)); netlink_attr(nlmsg, CTRL_ATTR_FAMILY_NAME, WG_GENL_NAME, strlen(WG_GENL_NAME) + 1); int n = 0; int err = netlink_send_ext(nlmsg, sock, GENL_ID_CTRL, &n); if (err) { return -1; } uint16_t id = 0; struct nlattr* attr = (struct nlattr*)(nlmsg->buf + NLMSG_HDRLEN + NLMSG_ALIGN(sizeof(genlhdr))); for (; (char*)attr < nlmsg->buf + n; attr = (struct nlattr*)((char*)attr + NLMSG_ALIGN(attr->nla_len))) { if (attr->nla_type == CTRL_ATTR_FAMILY_ID) { id = *(uint16_t*)(attr + 1); break; } } if (!id) { return -1; } recv(sock, nlmsg->buf, sizeof(nlmsg->buf), 0); return id; } static void netlink_wireguard_setup(void) { const char ifname_a[] = "wg0"; const char ifname_b[] = "wg1"; const char ifname_c[] = "wg2"; const char private_a[] = "\xa0\x5c\xa8\x4f\x6c\x9c\x8e\x38\x53\xe2\xfd\x7a\x70\xae\x0f\xb2\x0f\xa1" "\x52\x60\x0c\xb0\x08\x45\x17\x4f\x08\x07\x6f\x8d\x78\x43"; const char private_b[] = "\xb0\x80\x73\xe8\xd4\x4e\x91\xe3\xda\x92\x2c\x22\x43\x82\x44\xbb\x88\x5c" "\x69\xe2\x69\xc8\xe9\xd8\x35\xb1\x14\x29\x3a\x4d\xdc\x6e"; const char private_c[] = "\xa0\xcb\x87\x9a\x47\xf5\xbc\x64\x4c\x0e\x69\x3f\xa6\xd0\x31\xc7\x4a\x15" "\x53\xb6\xe9\x01\xb9\xff\x2f\x51\x8c\x78\x04\x2f\xb5\x42"; const char public_a[] = "\x97\x5c\x9d\x81\xc9\x83\xc8\x20\x9e\xe7\x81\x25\x4b\x89\x9f\x8e\xd9\x25" "\xae\x9f\x09\x23\xc2\x3c\x62\xf5\x3c\x57\xcd\xbf\x69\x1c"; const char public_b[] = "\xd1\x73\x28\x99\xf6\x11\xcd\x89\x94\x03\x4d\x7f\x41\x3d\xc9\x57\x63\x0e" "\x54\x93\xc2\x85\xac\xa4\x00\x65\xcb\x63\x11\xbe\x69\x6b"; const char public_c[] = "\xf4\x4d\xa3\x67\xa8\x8e\xe6\x56\x4f\x02\x02\x11\x45\x67\x27\x08\x2f\x5c" "\xeb\xee\x8b\x1b\xf5\xeb\x73\x37\x34\x1b\x45\x9b\x39\x22"; const uint16_t listen_a = 20001; const uint16_t listen_b = 20002; const uint16_t listen_c = 20003; const uint16_t af_inet = AF_INET; const uint16_t af_inet6 = AF_INET6; const struct sockaddr_in endpoint_b_v4 = { .sin_family = AF_INET, .sin_port = htons(listen_b), .sin_addr = {htonl(INADDR_LOOPBACK)}}; const struct sockaddr_in endpoint_c_v4 = { .sin_family = AF_INET, .sin_port = htons(listen_c), .sin_addr = {htonl(INADDR_LOOPBACK)}}; struct sockaddr_in6 endpoint_a_v6 = {.sin6_family = AF_INET6, .sin6_port = htons(listen_a)}; endpoint_a_v6.sin6_addr = in6addr_loopback; struct sockaddr_in6 endpoint_c_v6 = {.sin6_family = AF_INET6, .sin6_port = htons(listen_c)}; endpoint_c_v6.sin6_addr = in6addr_loopback; const struct in_addr first_half_v4 = {0}; const struct in_addr second_half_v4 = {(uint32_t)htonl(128 << 24)}; const struct in6_addr first_half_v6 = {{{0}}}; const struct in6_addr second_half_v6 = {{{0x80}}}; const uint8_t half_cidr = 1; const uint16_t persistent_keepalives[] = {1, 3, 7, 9, 14, 19}; struct genlmsghdr genlhdr = {.cmd = WG_CMD_SET_DEVICE, .version = 1}; int sock; int id, err; sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC); if (sock == -1) { return; } id = netlink_wireguard_id_get(&nlmsg, sock); if (id == -1) goto error; netlink_init(&nlmsg, id, 0, &genlhdr, sizeof(genlhdr)); netlink_attr(&nlmsg, WGDEVICE_A_IFNAME, ifname_a, strlen(ifname_a) + 1); netlink_attr(&nlmsg, WGDEVICE_A_PRIVATE_KEY, private_a, 32); netlink_attr(&nlmsg, WGDEVICE_A_LISTEN_PORT, &listen_a, 2); netlink_nest(&nlmsg, NLA_F_NESTED | WGDEVICE_A_PEERS); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGPEER_A_PUBLIC_KEY, public_b, 32); netlink_attr(&nlmsg, WGPEER_A_ENDPOINT, &endpoint_b_v4, sizeof(endpoint_b_v4)); netlink_attr(&nlmsg, WGPEER_A_PERSISTENT_KEEPALIVE_INTERVAL, &persistent_keepalives[0], 2); netlink_nest(&nlmsg, NLA_F_NESTED | WGPEER_A_ALLOWEDIPS); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGALLOWEDIP_A_FAMILY, &af_inet, 2); netlink_attr(&nlmsg, WGALLOWEDIP_A_IPADDR, &first_half_v4, sizeof(first_half_v4)); netlink_attr(&nlmsg, WGALLOWEDIP_A_CIDR_MASK, &half_cidr, 1); netlink_done(&nlmsg); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGALLOWEDIP_A_FAMILY, &af_inet6, 2); netlink_attr(&nlmsg, WGALLOWEDIP_A_IPADDR, &first_half_v6, sizeof(first_half_v6)); netlink_attr(&nlmsg, WGALLOWEDIP_A_CIDR_MASK, &half_cidr, 1); netlink_done(&nlmsg); netlink_done(&nlmsg); netlink_done(&nlmsg); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGPEER_A_PUBLIC_KEY, public_c, 32); netlink_attr(&nlmsg, WGPEER_A_ENDPOINT, &endpoint_c_v6, sizeof(endpoint_c_v6)); netlink_attr(&nlmsg, WGPEER_A_PERSISTENT_KEEPALIVE_INTERVAL, &persistent_keepalives[1], 2); netlink_nest(&nlmsg, NLA_F_NESTED | WGPEER_A_ALLOWEDIPS); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGALLOWEDIP_A_FAMILY, &af_inet, 2); netlink_attr(&nlmsg, WGALLOWEDIP_A_IPADDR, &second_half_v4, sizeof(second_half_v4)); netlink_attr(&nlmsg, WGALLOWEDIP_A_CIDR_MASK, &half_cidr, 1); netlink_done(&nlmsg); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGALLOWEDIP_A_FAMILY, &af_inet6, 2); netlink_attr(&nlmsg, WGALLOWEDIP_A_IPADDR, &second_half_v6, sizeof(second_half_v6)); netlink_attr(&nlmsg, WGALLOWEDIP_A_CIDR_MASK, &half_cidr, 1); netlink_done(&nlmsg); netlink_done(&nlmsg); netlink_done(&nlmsg); netlink_done(&nlmsg); err = netlink_send(&nlmsg, sock); if (err) { } netlink_init(&nlmsg, id, 0, &genlhdr, sizeof(genlhdr)); netlink_attr(&nlmsg, WGDEVICE_A_IFNAME, ifname_b, strlen(ifname_b) + 1); netlink_attr(&nlmsg, WGDEVICE_A_PRIVATE_KEY, private_b, 32); netlink_attr(&nlmsg, WGDEVICE_A_LISTEN_PORT, &listen_b, 2); netlink_nest(&nlmsg, NLA_F_NESTED | WGDEVICE_A_PEERS); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGPEER_A_PUBLIC_KEY, public_a, 32); netlink_attr(&nlmsg, WGPEER_A_ENDPOINT, &endpoint_a_v6, sizeof(endpoint_a_v6)); netlink_attr(&nlmsg, WGPEER_A_PERSISTENT_KEEPALIVE_INTERVAL, &persistent_keepalives[2], 2); netlink_nest(&nlmsg, NLA_F_NESTED | WGPEER_A_ALLOWEDIPS); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGALLOWEDIP_A_FAMILY, &af_inet, 2); netlink_attr(&nlmsg, WGALLOWEDIP_A_IPADDR, &first_half_v4, sizeof(first_half_v4)); netlink_attr(&nlmsg, WGALLOWEDIP_A_CIDR_MASK, &half_cidr, 1); netlink_done(&nlmsg); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGALLOWEDIP_A_FAMILY, &af_inet6, 2); netlink_attr(&nlmsg, WGALLOWEDIP_A_IPADDR, &first_half_v6, sizeof(first_half_v6)); netlink_attr(&nlmsg, WGALLOWEDIP_A_CIDR_MASK, &half_cidr, 1); netlink_done(&nlmsg); netlink_done(&nlmsg); netlink_done(&nlmsg); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGPEER_A_PUBLIC_KEY, public_c, 32); netlink_attr(&nlmsg, WGPEER_A_ENDPOINT, &endpoint_c_v4, sizeof(endpoint_c_v4)); netlink_attr(&nlmsg, WGPEER_A_PERSISTENT_KEEPALIVE_INTERVAL, &persistent_keepalives[3], 2); netlink_nest(&nlmsg, NLA_F_NESTED | WGPEER_A_ALLOWEDIPS); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGALLOWEDIP_A_FAMILY, &af_inet, 2); netlink_attr(&nlmsg, WGALLOWEDIP_A_IPADDR, &second_half_v4, sizeof(second_half_v4)); netlink_attr(&nlmsg, WGALLOWEDIP_A_CIDR_MASK, &half_cidr, 1); netlink_done(&nlmsg); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGALLOWEDIP_A_FAMILY, &af_inet6, 2); netlink_attr(&nlmsg, WGALLOWEDIP_A_IPADDR, &second_half_v6, sizeof(second_half_v6)); netlink_attr(&nlmsg, WGALLOWEDIP_A_CIDR_MASK, &half_cidr, 1); netlink_done(&nlmsg); netlink_done(&nlmsg); netlink_done(&nlmsg); netlink_done(&nlmsg); err = netlink_send(&nlmsg, sock); if (err) { } netlink_init(&nlmsg, id, 0, &genlhdr, sizeof(genlhdr)); netlink_attr(&nlmsg, WGDEVICE_A_IFNAME, ifname_c, strlen(ifname_c) + 1); netlink_attr(&nlmsg, WGDEVICE_A_PRIVATE_KEY, private_c, 32); netlink_attr(&nlmsg, WGDEVICE_A_LISTEN_PORT, &listen_c, 2); netlink_nest(&nlmsg, NLA_F_NESTED | WGDEVICE_A_PEERS); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGPEER_A_PUBLIC_KEY, public_a, 32); netlink_attr(&nlmsg, WGPEER_A_ENDPOINT, &endpoint_a_v6, sizeof(endpoint_a_v6)); netlink_attr(&nlmsg, WGPEER_A_PERSISTENT_KEEPALIVE_INTERVAL, &persistent_keepalives[4], 2); netlink_nest(&nlmsg, NLA_F_NESTED | WGPEER_A_ALLOWEDIPS); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGALLOWEDIP_A_FAMILY, &af_inet, 2); netlink_attr(&nlmsg, WGALLOWEDIP_A_IPADDR, &first_half_v4, sizeof(first_half_v4)); netlink_attr(&nlmsg, WGALLOWEDIP_A_CIDR_MASK, &half_cidr, 1); netlink_done(&nlmsg); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGALLOWEDIP_A_FAMILY, &af_inet6, 2); netlink_attr(&nlmsg, WGALLOWEDIP_A_IPADDR, &first_half_v6, sizeof(first_half_v6)); netlink_attr(&nlmsg, WGALLOWEDIP_A_CIDR_MASK, &half_cidr, 1); netlink_done(&nlmsg); netlink_done(&nlmsg); netlink_done(&nlmsg); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGPEER_A_PUBLIC_KEY, public_b, 32); netlink_attr(&nlmsg, WGPEER_A_ENDPOINT, &endpoint_b_v4, sizeof(endpoint_b_v4)); netlink_attr(&nlmsg, WGPEER_A_PERSISTENT_KEEPALIVE_INTERVAL, &persistent_keepalives[5], 2); netlink_nest(&nlmsg, NLA_F_NESTED | WGPEER_A_ALLOWEDIPS); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGALLOWEDIP_A_FAMILY, &af_inet, 2); netlink_attr(&nlmsg, WGALLOWEDIP_A_IPADDR, &second_half_v4, sizeof(second_half_v4)); netlink_attr(&nlmsg, WGALLOWEDIP_A_CIDR_MASK, &half_cidr, 1); netlink_done(&nlmsg); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGALLOWEDIP_A_FAMILY, &af_inet6, 2); netlink_attr(&nlmsg, WGALLOWEDIP_A_IPADDR, &second_half_v6, sizeof(second_half_v6)); netlink_attr(&nlmsg, WGALLOWEDIP_A_CIDR_MASK, &half_cidr, 1); netlink_done(&nlmsg); netlink_done(&nlmsg); netlink_done(&nlmsg); netlink_done(&nlmsg); err = netlink_send(&nlmsg, sock); if (err) { } error: close(sock); } static void initialize_netdevices(void) { char netdevsim[16]; sprintf(netdevsim, "netdevsim%d", (int)procid); struct { const char* type; const char* dev; } devtypes[] = { {"ip6gretap", "ip6gretap0"}, {"bridge", "bridge0"}, {"vcan", "vcan0"}, {"bond", "bond0"}, {"team", "team0"}, {"dummy", "dummy0"}, {"nlmon", "nlmon0"}, {"caif", "caif0"}, {"batadv", "batadv0"}, {"vxcan", "vxcan1"}, {"netdevsim", netdevsim}, {"veth", 0}, {"xfrm", "xfrm0"}, {"wireguard", "wg0"}, {"wireguard", "wg1"}, {"wireguard", "wg2"}, }; const char* devmasters[] = {"bridge", "bond", "team", "batadv"}; struct { const char* name; int macsize; bool noipv6; } devices[] = { {"lo", ETH_ALEN}, {"sit0", 0}, {"bridge0", ETH_ALEN}, {"vcan0", 0, true}, {"tunl0", 0}, {"gre0", 0}, {"gretap0", ETH_ALEN}, {"ip_vti0", 0}, {"ip6_vti0", 0}, {"ip6tnl0", 0}, {"ip6gre0", 0}, {"ip6gretap0", ETH_ALEN}, {"erspan0", ETH_ALEN}, {"bond0", ETH_ALEN}, {"veth0", ETH_ALEN}, {"veth1", ETH_ALEN}, {"team0", ETH_ALEN}, {"veth0_to_bridge", ETH_ALEN}, {"veth1_to_bridge", ETH_ALEN}, {"veth0_to_bond", ETH_ALEN}, {"veth1_to_bond", ETH_ALEN}, {"veth0_to_team", ETH_ALEN}, {"veth1_to_team", ETH_ALEN}, {"veth0_to_hsr", ETH_ALEN}, {"veth1_to_hsr", ETH_ALEN}, {"hsr0", 0}, {"dummy0", ETH_ALEN}, {"nlmon0", 0}, {"vxcan0", 0, true}, {"vxcan1", 0, true}, {"caif0", ETH_ALEN}, {"batadv0", ETH_ALEN}, {netdevsim, ETH_ALEN}, {"xfrm0", ETH_ALEN}, {"veth0_virt_wifi", ETH_ALEN}, {"veth1_virt_wifi", ETH_ALEN}, {"virt_wifi0", ETH_ALEN}, {"veth0_vlan", ETH_ALEN}, {"veth1_vlan", ETH_ALEN}, {"vlan0", ETH_ALEN}, {"vlan1", ETH_ALEN}, {"macvlan0", ETH_ALEN}, {"macvlan1", ETH_ALEN}, {"ipvlan0", ETH_ALEN}, {"ipvlan1", ETH_ALEN}, {"veth0_macvtap", ETH_ALEN}, {"veth1_macvtap", ETH_ALEN}, {"macvtap0", ETH_ALEN}, {"macsec0", ETH_ALEN}, {"veth0_to_batadv", ETH_ALEN}, {"veth1_to_batadv", ETH_ALEN}, {"batadv_slave_0", ETH_ALEN}, {"batadv_slave_1", ETH_ALEN}, {"geneve0", ETH_ALEN}, {"geneve1", ETH_ALEN}, {"wg0", 0}, {"wg1", 0}, {"wg2", 0}, }; int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE); if (sock == -1) exit(1); unsigned i; for (i = 0; i < sizeof(devtypes) / sizeof(devtypes[0]); i++) netlink_add_device(&nlmsg, sock, devtypes[i].type, devtypes[i].dev); for (i = 0; i < sizeof(devmasters) / (sizeof(devmasters[0])); i++) { char master[32], slave0[32], veth0[32], slave1[32], veth1[32]; sprintf(slave0, "%s_slave_0", devmasters[i]); sprintf(veth0, "veth0_to_%s", devmasters[i]); netlink_add_veth(&nlmsg, sock, slave0, veth0); sprintf(slave1, "%s_slave_1", devmasters[i]); sprintf(veth1, "veth1_to_%s", devmasters[i]); netlink_add_veth(&nlmsg, sock, slave1, veth1); sprintf(master, "%s0", devmasters[i]); netlink_device_change(&nlmsg, sock, slave0, false, master, 0, 0, NULL); netlink_device_change(&nlmsg, sock, slave1, false, master, 0, 0, NULL); } netlink_device_change(&nlmsg, sock, "bridge_slave_0", true, 0, 0, 0, NULL); netlink_device_change(&nlmsg, sock, "bridge_slave_1", true, 0, 0, 0, NULL); netlink_add_veth(&nlmsg, sock, "hsr_slave_0", "veth0_to_hsr"); netlink_add_veth(&nlmsg, sock, "hsr_slave_1", "veth1_to_hsr"); netlink_add_hsr(&nlmsg, sock, "hsr0", "hsr_slave_0", "hsr_slave_1"); netlink_device_change(&nlmsg, sock, "hsr_slave_0", true, 0, 0, 0, NULL); netlink_device_change(&nlmsg, sock, "hsr_slave_1", true, 0, 0, 0, NULL); netlink_add_veth(&nlmsg, sock, "veth0_virt_wifi", "veth1_virt_wifi"); netlink_add_linked(&nlmsg, sock, "virt_wifi", "virt_wifi0", "veth1_virt_wifi"); netlink_add_veth(&nlmsg, sock, "veth0_vlan", "veth1_vlan"); netlink_add_vlan(&nlmsg, sock, "vlan0", "veth0_vlan", 0, htons(ETH_P_8021Q)); netlink_add_vlan(&nlmsg, sock, "vlan1", "veth0_vlan", 1, htons(ETH_P_8021AD)); netlink_add_macvlan(&nlmsg, sock, "macvlan0", "veth1_vlan"); netlink_add_macvlan(&nlmsg, sock, "macvlan1", "veth1_vlan"); netlink_add_ipvlan(&nlmsg, sock, "ipvlan0", "veth0_vlan", IPVLAN_MODE_L2, 0); netlink_add_ipvlan(&nlmsg, sock, "ipvlan1", "veth0_vlan", IPVLAN_MODE_L3S, IPVLAN_F_VEPA); netlink_add_veth(&nlmsg, sock, "veth0_macvtap", "veth1_macvtap"); netlink_add_linked(&nlmsg, sock, "macvtap", "macvtap0", "veth0_macvtap"); netlink_add_linked(&nlmsg, sock, "macsec", "macsec0", "veth1_macvtap"); char addr[32]; sprintf(addr, DEV_IPV4, 14 + 10); struct in_addr geneve_addr4; if (inet_pton(AF_INET, addr, &geneve_addr4) <= 0) exit(1); struct in6_addr geneve_addr6; if (inet_pton(AF_INET6, "fc00::01", &geneve_addr6) <= 0) exit(1); netlink_add_geneve(&nlmsg, sock, "geneve0", 0, &geneve_addr4, 0); netlink_add_geneve(&nlmsg, sock, "geneve1", 1, 0, &geneve_addr6); netdevsim_add((int)procid, 4); netlink_wireguard_setup(); for (i = 0; i < sizeof(devices) / (sizeof(devices[0])); i++) { char addr[32]; sprintf(addr, DEV_IPV4, i + 10); netlink_add_addr4(&nlmsg, sock, devices[i].name, addr); if (!devices[i].noipv6) { sprintf(addr, DEV_IPV6, i + 10); netlink_add_addr6(&nlmsg, sock, devices[i].name, addr); } uint64_t macaddr = DEV_MAC + ((i + 10ull) << 40); netlink_device_change(&nlmsg, sock, devices[i].name, true, 0, &macaddr, devices[i].macsize, NULL); } close(sock); } static void initialize_netdevices_init(void) { int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE); if (sock == -1) exit(1); struct { const char* type; int macsize; bool noipv6; bool noup; } devtypes[] = { {"nr", 7, true}, {"rose", 5, true, true}, }; unsigned i; for (i = 0; i < sizeof(devtypes) / sizeof(devtypes[0]); i++) { char dev[32], addr[32]; sprintf(dev, "%s%d", devtypes[i].type, (int)procid); sprintf(addr, "172.30.%d.%d", i, (int)procid + 1); netlink_add_addr4(&nlmsg, sock, dev, addr); if (!devtypes[i].noipv6) { sprintf(addr, "fe88::%02x:%02x", i, (int)procid + 1); netlink_add_addr6(&nlmsg, sock, dev, addr); } int macsize = devtypes[i].macsize; uint64_t macaddr = 0xbbbbbb + ((unsigned long long)i << (8 * (macsize - 2))) + (procid << (8 * (macsize - 1))); netlink_device_change(&nlmsg, sock, dev, !devtypes[i].noup, 0, &macaddr, macsize, NULL); } close(sock); } static int read_tun(char* data, int size) { if (tunfd < 0) return -1; int rv = read(tunfd, data, size); if (rv < 0) { if (errno == EAGAIN || errno == EBADFD) return -1; exit(1); } return rv; } static void flush_tun() { char data[1000]; while (read_tun(&data[0], sizeof(data)) != -1) { } } #define MAX_FDS 30 #define BTPROTO_HCI 1 #define ACL_LINK 1 #define SCAN_PAGE 2 typedef struct { uint8_t b[6]; } __attribute__((packed)) bdaddr_t; #define HCI_COMMAND_PKT 1 #define HCI_EVENT_PKT 4 #define HCI_VENDOR_PKT 0xff struct hci_command_hdr { uint16_t opcode; uint8_t plen; } __attribute__((packed)); struct hci_event_hdr { uint8_t evt; uint8_t plen; } __attribute__((packed)); #define HCI_EV_CONN_COMPLETE 0x03 struct hci_ev_conn_complete { uint8_t status; uint16_t handle; bdaddr_t bdaddr; uint8_t link_type; uint8_t encr_mode; } __attribute__((packed)); #define HCI_EV_CONN_REQUEST 0x04 struct hci_ev_conn_request { bdaddr_t bdaddr; uint8_t dev_class[3]; uint8_t link_type; } __attribute__((packed)); #define HCI_EV_REMOTE_FEATURES 0x0b struct hci_ev_remote_features { uint8_t status; uint16_t handle; uint8_t features[8]; } __attribute__((packed)); #define HCI_EV_CMD_COMPLETE 0x0e struct hci_ev_cmd_complete { uint8_t ncmd; uint16_t opcode; } __attribute__((packed)); #define HCI_OP_WRITE_SCAN_ENABLE 0x0c1a #define HCI_OP_READ_BUFFER_SIZE 0x1005 struct hci_rp_read_buffer_size { uint8_t status; uint16_t acl_mtu; uint8_t sco_mtu; uint16_t acl_max_pkt; uint16_t sco_max_pkt; } __attribute__((packed)); #define HCI_OP_READ_BD_ADDR 0x1009 struct hci_rp_read_bd_addr { uint8_t status; bdaddr_t bdaddr; } __attribute__((packed)); #define HCI_EV_LE_META 0x3e struct hci_ev_le_meta { uint8_t subevent; } __attribute__((packed)); #define HCI_EV_LE_CONN_COMPLETE 0x01 struct hci_ev_le_conn_complete { uint8_t status; uint16_t handle; uint8_t role; uint8_t bdaddr_type; bdaddr_t bdaddr; uint16_t interval; uint16_t latency; uint16_t supervision_timeout; uint8_t clk_accurancy; } __attribute__((packed)); struct hci_dev_req { uint16_t dev_id; uint32_t dev_opt; }; struct vhci_vendor_pkt { uint8_t type; uint8_t opcode; uint16_t id; }; #define HCIDEVUP _IOW('H', 201, int) #define HCISETSCAN _IOW('H', 221, int) static int vhci_fd = -1; static void rfkill_unblock_all() { int fd = open("/dev/rfkill", O_WRONLY); if (fd < 0) exit(1); struct rfkill_event event = {0}; event.idx = 0; event.type = RFKILL_TYPE_ALL; event.op = RFKILL_OP_CHANGE_ALL; event.soft = 0; event.hard = 0; if (write(fd, &event, sizeof(event)) < 0) exit(1); close(fd); } static void hci_send_event_packet(int fd, uint8_t evt, void* data, size_t data_len) { struct iovec iv[3]; struct hci_event_hdr hdr; hdr.evt = evt; hdr.plen = data_len; uint8_t type = HCI_EVENT_PKT; iv[0].iov_base = &type; iv[0].iov_len = sizeof(type); iv[1].iov_base = &hdr; iv[1].iov_len = sizeof(hdr); iv[2].iov_base = data; iv[2].iov_len = data_len; if (writev(fd, iv, sizeof(iv) / sizeof(struct iovec)) < 0) exit(1); } static void hci_send_event_cmd_complete(int fd, uint16_t opcode, void* data, size_t data_len) { struct iovec iv[4]; struct hci_event_hdr hdr; hdr.evt = HCI_EV_CMD_COMPLETE; hdr.plen = sizeof(struct hci_ev_cmd_complete) + data_len; struct hci_ev_cmd_complete evt_hdr; evt_hdr.ncmd = 1; evt_hdr.opcode = opcode; uint8_t type = HCI_EVENT_PKT; iv[0].iov_base = &type; iv[0].iov_len = sizeof(type); iv[1].iov_base = &hdr; iv[1].iov_len = sizeof(hdr); iv[2].iov_base = &evt_hdr; iv[2].iov_len = sizeof(evt_hdr); iv[3].iov_base = data; iv[3].iov_len = data_len; if (writev(fd, iv, sizeof(iv) / sizeof(struct iovec)) < 0) exit(1); } static bool process_command_pkt(int fd, char* buf, ssize_t buf_size) { struct hci_command_hdr* hdr = (struct hci_command_hdr*)buf; if (buf_size < (ssize_t)sizeof(struct hci_command_hdr) || hdr->plen != buf_size - sizeof(struct hci_command_hdr)) { exit(1); } switch (hdr->opcode) { case HCI_OP_WRITE_SCAN_ENABLE: { uint8_t status = 0; hci_send_event_cmd_complete(fd, hdr->opcode, &status, sizeof(status)); return true; } case HCI_OP_READ_BD_ADDR: { struct hci_rp_read_bd_addr rp = {0}; rp.status = 0; memset(&rp.bdaddr, 0xaa, 6); hci_send_event_cmd_complete(fd, hdr->opcode, &rp, sizeof(rp)); return false; } case HCI_OP_READ_BUFFER_SIZE: { struct hci_rp_read_buffer_size rp = {0}; rp.status = 0; rp.acl_mtu = 1021; rp.sco_mtu = 96; rp.acl_max_pkt = 4; rp.sco_max_pkt = 6; hci_send_event_cmd_complete(fd, hdr->opcode, &rp, sizeof(rp)); return false; } } char dummy[0xf9] = {0}; hci_send_event_cmd_complete(fd, hdr->opcode, dummy, sizeof(dummy)); return false; } static void* event_thread(void* arg) { while (1) { char buf[1024] = {0}; ssize_t buf_size = read(vhci_fd, buf, sizeof(buf)); if (buf_size < 0) exit(1); if (buf_size > 0 && buf[0] == HCI_COMMAND_PKT) { if (process_command_pkt(vhci_fd, buf + 1, buf_size - 1)) break; } } return NULL; } #define HCI_HANDLE_1 200 #define HCI_HANDLE_2 201 static void initialize_vhci() { int hci_sock = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI); if (hci_sock < 0) exit(1); vhci_fd = open("/dev/vhci", O_RDWR); if (vhci_fd == -1) exit(1); const int kVhciFd = 241; if (dup2(vhci_fd, kVhciFd) < 0) exit(1); close(vhci_fd); vhci_fd = kVhciFd; struct vhci_vendor_pkt vendor_pkt; if (read(vhci_fd, &vendor_pkt, sizeof(vendor_pkt)) != sizeof(vendor_pkt)) exit(1); if (vendor_pkt.type != HCI_VENDOR_PKT) exit(1); pthread_t th; if (pthread_create(&th, NULL, event_thread, NULL)) exit(1); int ret = ioctl(hci_sock, HCIDEVUP, vendor_pkt.id); if (ret) { if (errno == ERFKILL) { rfkill_unblock_all(); ret = ioctl(hci_sock, HCIDEVUP, vendor_pkt.id); } if (ret && errno != EALREADY) exit(1); } struct hci_dev_req dr = {0}; dr.dev_id = vendor_pkt.id; dr.dev_opt = SCAN_PAGE; if (ioctl(hci_sock, HCISETSCAN, &dr)) exit(1); struct hci_ev_conn_request request; memset(&request, 0, sizeof(request)); memset(&request.bdaddr, 0xaa, 6); *(uint8_t*)&request.bdaddr.b[5] = 0x10; request.link_type = ACL_LINK; hci_send_event_packet(vhci_fd, HCI_EV_CONN_REQUEST, &request, sizeof(request)); struct hci_ev_conn_complete complete; memset(&complete, 0, sizeof(complete)); complete.status = 0; complete.handle = HCI_HANDLE_1; memset(&complete.bdaddr, 0xaa, 6); *(uint8_t*)&complete.bdaddr.b[5] = 0x10; complete.link_type = ACL_LINK; complete.encr_mode = 0; hci_send_event_packet(vhci_fd, HCI_EV_CONN_COMPLETE, &complete, sizeof(complete)); struct hci_ev_remote_features features; memset(&features, 0, sizeof(features)); features.status = 0; features.handle = HCI_HANDLE_1; hci_send_event_packet(vhci_fd, HCI_EV_REMOTE_FEATURES, &features, sizeof(features)); struct { struct hci_ev_le_meta le_meta; struct hci_ev_le_conn_complete le_conn; } le_conn; memset(&le_conn, 0, sizeof(le_conn)); le_conn.le_meta.subevent = HCI_EV_LE_CONN_COMPLETE; memset(&le_conn.le_conn.bdaddr, 0xaa, 6); *(uint8_t*)&le_conn.le_conn.bdaddr.b[5] = 0x11; le_conn.le_conn.role = 1; le_conn.le_conn.handle = HCI_HANDLE_2; hci_send_event_packet(vhci_fd, HCI_EV_LE_META, &le_conn, sizeof(le_conn)); pthread_join(th, NULL); close(hci_sock); } #define XT_TABLE_SIZE 1536 #define XT_MAX_ENTRIES 10 struct xt_counters { uint64_t pcnt, bcnt; }; struct ipt_getinfo { char name[32]; unsigned int valid_hooks; unsigned int hook_entry[5]; unsigned int underflow[5]; unsigned int num_entries; unsigned int size; }; struct ipt_get_entries { char name[32]; unsigned int size; void* entrytable[XT_TABLE_SIZE / sizeof(void*)]; }; struct ipt_replace { char name[32]; unsigned int valid_hooks; unsigned int num_entries; unsigned int size; unsigned int hook_entry[5]; unsigned int underflow[5]; unsigned int num_counters; struct xt_counters* counters; char entrytable[XT_TABLE_SIZE]; }; struct ipt_table_desc { const char* name; struct ipt_getinfo info; struct ipt_replace replace; }; static struct ipt_table_desc ipv4_tables[] = { {.name = "filter"}, {.name = "nat"}, {.name = "mangle"}, {.name = "raw"}, {.name = "security"}, }; static struct ipt_table_desc ipv6_tables[] = { {.name = "filter"}, {.name = "nat"}, {.name = "mangle"}, {.name = "raw"}, {.name = "security"}, }; #define IPT_BASE_CTL 64 #define IPT_SO_SET_REPLACE (IPT_BASE_CTL) #define IPT_SO_GET_INFO (IPT_BASE_CTL) #define IPT_SO_GET_ENTRIES (IPT_BASE_CTL + 1) struct arpt_getinfo { char name[32]; unsigned int valid_hooks; unsigned int hook_entry[3]; unsigned int underflow[3]; unsigned int num_entries; unsigned int size; }; struct arpt_get_entries { char name[32]; unsigned int size; void* entrytable[XT_TABLE_SIZE / sizeof(void*)]; }; struct arpt_replace { char name[32]; unsigned int valid_hooks; unsigned int num_entries; unsigned int size; unsigned int hook_entry[3]; unsigned int underflow[3]; unsigned int num_counters; struct xt_counters* counters; char entrytable[XT_TABLE_SIZE]; }; struct arpt_table_desc { const char* name; struct arpt_getinfo info; struct arpt_replace replace; }; static struct arpt_table_desc arpt_tables[] = { {.name = "filter"}, }; #define ARPT_BASE_CTL 96 #define ARPT_SO_SET_REPLACE (ARPT_BASE_CTL) #define ARPT_SO_GET_INFO (ARPT_BASE_CTL) #define ARPT_SO_GET_ENTRIES (ARPT_BASE_CTL + 1) static void checkpoint_iptables(struct ipt_table_desc* tables, int num_tables, int family, int level) { int fd = socket(family, SOCK_STREAM, IPPROTO_TCP); if (fd == -1) { switch (errno) { case EAFNOSUPPORT: case ENOPROTOOPT: return; } exit(1); } for (int i = 0; i < num_tables; i++) { struct ipt_table_desc* table = &tables[i]; strcpy(table->info.name, table->name); strcpy(table->replace.name, table->name); socklen_t optlen = sizeof(table->info); if (getsockopt(fd, level, IPT_SO_GET_INFO, &table->info, &optlen)) { switch (errno) { case EPERM: case ENOENT: case ENOPROTOOPT: continue; } exit(1); } if (table->info.size > sizeof(table->replace.entrytable)) exit(1); if (table->info.num_entries > XT_MAX_ENTRIES) exit(1); struct ipt_get_entries entries; memset(&entries, 0, sizeof(entries)); strcpy(entries.name, table->name); entries.size = table->info.size; optlen = sizeof(entries) - sizeof(entries.entrytable) + table->info.size; if (getsockopt(fd, level, IPT_SO_GET_ENTRIES, &entries, &optlen)) exit(1); table->replace.valid_hooks = table->info.valid_hooks; table->replace.num_entries = table->info.num_entries; table->replace.size = table->info.size; memcpy(table->replace.hook_entry, table->info.hook_entry, sizeof(table->replace.hook_entry)); memcpy(table->replace.underflow, table->info.underflow, sizeof(table->replace.underflow)); memcpy(table->replace.entrytable, entries.entrytable, table->info.size); } close(fd); } static void reset_iptables(struct ipt_table_desc* tables, int num_tables, int family, int level) { int fd = socket(family, SOCK_STREAM, IPPROTO_TCP); if (fd == -1) { switch (errno) { case EAFNOSUPPORT: case ENOPROTOOPT: return; } exit(1); } for (int i = 0; i < num_tables; i++) { struct ipt_table_desc* table = &tables[i]; if (table->info.valid_hooks == 0) continue; struct ipt_getinfo info; memset(&info, 0, sizeof(info)); strcpy(info.name, table->name); socklen_t optlen = sizeof(info); if (getsockopt(fd, level, IPT_SO_GET_INFO, &info, &optlen)) exit(1); if (memcmp(&table->info, &info, sizeof(table->info)) == 0) { struct ipt_get_entries entries; memset(&entries, 0, sizeof(entries)); strcpy(entries.name, table->name); entries.size = table->info.size; optlen = sizeof(entries) - sizeof(entries.entrytable) + entries.size; if (getsockopt(fd, level, IPT_SO_GET_ENTRIES, &entries, &optlen)) exit(1); if (memcmp(table->replace.entrytable, entries.entrytable, table->info.size) == 0) continue; } struct xt_counters counters[XT_MAX_ENTRIES]; table->replace.num_counters = info.num_entries; table->replace.counters = counters; optlen = sizeof(table->replace) - sizeof(table->replace.entrytable) + table->replace.size; if (setsockopt(fd, level, IPT_SO_SET_REPLACE, &table->replace, optlen)) exit(1); } close(fd); } static void checkpoint_arptables(void) { int fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (fd == -1) { switch (errno) { case EAFNOSUPPORT: case ENOPROTOOPT: return; } exit(1); } for (unsigned i = 0; i < sizeof(arpt_tables) / sizeof(arpt_tables[0]); i++) { struct arpt_table_desc* table = &arpt_tables[i]; strcpy(table->info.name, table->name); strcpy(table->replace.name, table->name); socklen_t optlen = sizeof(table->info); if (getsockopt(fd, SOL_IP, ARPT_SO_GET_INFO, &table->info, &optlen)) { switch (errno) { case EPERM: case ENOENT: case ENOPROTOOPT: continue; } exit(1); } if (table->info.size > sizeof(table->replace.entrytable)) exit(1); if (table->info.num_entries > XT_MAX_ENTRIES) exit(1); struct arpt_get_entries entries; memset(&entries, 0, sizeof(entries)); strcpy(entries.name, table->name); entries.size = table->info.size; optlen = sizeof(entries) - sizeof(entries.entrytable) + table->info.size; if (getsockopt(fd, SOL_IP, ARPT_SO_GET_ENTRIES, &entries, &optlen)) exit(1); table->replace.valid_hooks = table->info.valid_hooks; table->replace.num_entries = table->info.num_entries; table->replace.size = table->info.size; memcpy(table->replace.hook_entry, table->info.hook_entry, sizeof(table->replace.hook_entry)); memcpy(table->replace.underflow, table->info.underflow, sizeof(table->replace.underflow)); memcpy(table->replace.entrytable, entries.entrytable, table->info.size); } close(fd); } static void reset_arptables() { int fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (fd == -1) { switch (errno) { case EAFNOSUPPORT: case ENOPROTOOPT: return; } exit(1); } for (unsigned i = 0; i < sizeof(arpt_tables) / sizeof(arpt_tables[0]); i++) { struct arpt_table_desc* table = &arpt_tables[i]; if (table->info.valid_hooks == 0) continue; struct arpt_getinfo info; memset(&info, 0, sizeof(info)); strcpy(info.name, table->name); socklen_t optlen = sizeof(info); if (getsockopt(fd, SOL_IP, ARPT_SO_GET_INFO, &info, &optlen)) exit(1); if (memcmp(&table->info, &info, sizeof(table->info)) == 0) { struct arpt_get_entries entries; memset(&entries, 0, sizeof(entries)); strcpy(entries.name, table->name); entries.size = table->info.size; optlen = sizeof(entries) - sizeof(entries.entrytable) + entries.size; if (getsockopt(fd, SOL_IP, ARPT_SO_GET_ENTRIES, &entries, &optlen)) exit(1); if (memcmp(table->replace.entrytable, entries.entrytable, table->info.size) == 0) continue; } else { } struct xt_counters counters[XT_MAX_ENTRIES]; table->replace.num_counters = info.num_entries; table->replace.counters = counters; optlen = sizeof(table->replace) - sizeof(table->replace.entrytable) + table->replace.size; if (setsockopt(fd, SOL_IP, ARPT_SO_SET_REPLACE, &table->replace, optlen)) exit(1); } close(fd); } #define NF_BR_NUMHOOKS 6 #define EBT_TABLE_MAXNAMELEN 32 #define EBT_CHAIN_MAXNAMELEN 32 #define EBT_BASE_CTL 128 #define EBT_SO_SET_ENTRIES (EBT_BASE_CTL) #define EBT_SO_GET_INFO (EBT_BASE_CTL) #define EBT_SO_GET_ENTRIES (EBT_SO_GET_INFO + 1) #define EBT_SO_GET_INIT_INFO (EBT_SO_GET_ENTRIES + 1) #define EBT_SO_GET_INIT_ENTRIES (EBT_SO_GET_INIT_INFO + 1) struct ebt_replace { char name[EBT_TABLE_MAXNAMELEN]; unsigned int valid_hooks; unsigned int nentries; unsigned int entries_size; struct ebt_entries* hook_entry[NF_BR_NUMHOOKS]; unsigned int num_counters; struct ebt_counter* counters; char* entries; }; struct ebt_entries { unsigned int distinguisher; char name[EBT_CHAIN_MAXNAMELEN]; unsigned int counter_offset; int policy; unsigned int nentries; char data[0] __attribute__((aligned(__alignof__(struct ebt_replace)))); }; struct ebt_table_desc { const char* name; struct ebt_replace replace; char entrytable[XT_TABLE_SIZE]; }; static struct ebt_table_desc ebt_tables[] = { {.name = "filter"}, {.name = "nat"}, {.name = "broute"}, }; static void checkpoint_ebtables(void) { int fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (fd == -1) { switch (errno) { case EAFNOSUPPORT: case ENOPROTOOPT: return; } exit(1); } for (size_t i = 0; i < sizeof(ebt_tables) / sizeof(ebt_tables[0]); i++) { struct ebt_table_desc* table = &ebt_tables[i]; strcpy(table->replace.name, table->name); socklen_t optlen = sizeof(table->replace); if (getsockopt(fd, SOL_IP, EBT_SO_GET_INIT_INFO, &table->replace, &optlen)) { switch (errno) { case EPERM: case ENOENT: case ENOPROTOOPT: continue; } exit(1); } if (table->replace.entries_size > sizeof(table->entrytable)) exit(1); table->replace.num_counters = 0; table->replace.entries = table->entrytable; optlen = sizeof(table->replace) + table->replace.entries_size; if (getsockopt(fd, SOL_IP, EBT_SO_GET_INIT_ENTRIES, &table->replace, &optlen)) exit(1); } close(fd); } static void reset_ebtables() { int fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (fd == -1) { switch (errno) { case EAFNOSUPPORT: case ENOPROTOOPT: return; } exit(1); } for (unsigned i = 0; i < sizeof(ebt_tables) / sizeof(ebt_tables[0]); i++) { struct ebt_table_desc* table = &ebt_tables[i]; if (table->replace.valid_hooks == 0) continue; struct ebt_replace replace; memset(&replace, 0, sizeof(replace)); strcpy(replace.name, table->name); socklen_t optlen = sizeof(replace); if (getsockopt(fd, SOL_IP, EBT_SO_GET_INFO, &replace, &optlen)) exit(1); replace.num_counters = 0; table->replace.entries = 0; for (unsigned h = 0; h < NF_BR_NUMHOOKS; h++) table->replace.hook_entry[h] = 0; if (memcmp(&table->replace, &replace, sizeof(table->replace)) == 0) { char entrytable[XT_TABLE_SIZE]; memset(&entrytable, 0, sizeof(entrytable)); replace.entries = entrytable; optlen = sizeof(replace) + replace.entries_size; if (getsockopt(fd, SOL_IP, EBT_SO_GET_ENTRIES, &replace, &optlen)) exit(1); if (memcmp(table->entrytable, entrytable, replace.entries_size) == 0) continue; } for (unsigned j = 0, h = 0; h < NF_BR_NUMHOOKS; h++) { if (table->replace.valid_hooks & (1 << h)) { table->replace.hook_entry[h] = (struct ebt_entries*)table->entrytable + j; j++; } } table->replace.entries = table->entrytable; optlen = sizeof(table->replace) + table->replace.entries_size; if (setsockopt(fd, SOL_IP, EBT_SO_SET_ENTRIES, &table->replace, optlen)) exit(1); } close(fd); } static void checkpoint_net_namespace(void) { checkpoint_ebtables(); checkpoint_arptables(); checkpoint_iptables(ipv4_tables, sizeof(ipv4_tables) / sizeof(ipv4_tables[0]), AF_INET, SOL_IP); checkpoint_iptables(ipv6_tables, sizeof(ipv6_tables) / sizeof(ipv6_tables[0]), AF_INET6, SOL_IPV6); } static void reset_net_namespace(void) { reset_ebtables(); reset_arptables(); reset_iptables(ipv4_tables, sizeof(ipv4_tables) / sizeof(ipv4_tables[0]), AF_INET, SOL_IP); reset_iptables(ipv6_tables, sizeof(ipv6_tables) / sizeof(ipv6_tables[0]), AF_INET6, SOL_IPV6); } static void setup_cgroups() { if (mkdir("/syzcgroup", 0777)) { } if (mkdir("/syzcgroup/unified", 0777)) { } if (mount("none", "/syzcgroup/unified", "cgroup2", 0, NULL)) { } if (chmod("/syzcgroup/unified", 0777)) { } write_file("/syzcgroup/unified/cgroup.subtree_control", "+cpu +memory +io +pids +rdma"); if (mkdir("/syzcgroup/cpu", 0777)) { } if (mount("none", "/syzcgroup/cpu", "cgroup", 0, "cpuset,cpuacct,perf_event,hugetlb")) { } write_file("/syzcgroup/cpu/cgroup.clone_children", "1"); write_file("/syzcgroup/cpu/cpuset.memory_pressure_enabled", "1"); if (chmod("/syzcgroup/cpu", 0777)) { } if (mkdir("/syzcgroup/net", 0777)) { } if (mount("none", "/syzcgroup/net", "cgroup", 0, "net_cls,net_prio,devices,freezer")) { } if (chmod("/syzcgroup/net", 0777)) { } } static void setup_cgroups_loop() { int pid = getpid(); char file[128]; char cgroupdir[64]; snprintf(cgroupdir, sizeof(cgroupdir), "/syzcgroup/unified/syz%llu", procid); if (mkdir(cgroupdir, 0777)) { } snprintf(file, sizeof(file), "%s/pids.max", cgroupdir); write_file(file, "32"); snprintf(file, sizeof(file), "%s/memory.low", cgroupdir); write_file(file, "%d", 298 << 20); snprintf(file, sizeof(file), "%s/memory.high", cgroupdir); write_file(file, "%d", 299 << 20); snprintf(file, sizeof(file), "%s/memory.max", cgroupdir); write_file(file, "%d", 300 << 20); snprintf(file, sizeof(file), "%s/cgroup.procs", cgroupdir); write_file(file, "%d", pid); snprintf(cgroupdir, sizeof(cgroupdir), "/syzcgroup/cpu/syz%llu", procid); if (mkdir(cgroupdir, 0777)) { } snprintf(file, sizeof(file), "%s/cgroup.procs", cgroupdir); write_file(file, "%d", pid); snprintf(cgroupdir, sizeof(cgroupdir), "/syzcgroup/net/syz%llu", procid); if (mkdir(cgroupdir, 0777)) { } snprintf(file, sizeof(file), "%s/cgroup.procs", cgroupdir); write_file(file, "%d", pid); } static void setup_cgroups_test() { char cgroupdir[64]; snprintf(cgroupdir, sizeof(cgroupdir), "/syzcgroup/unified/syz%llu", procid); if (symlink(cgroupdir, "./cgroup")) { } snprintf(cgroupdir, sizeof(cgroupdir), "/syzcgroup/cpu/syz%llu", procid); if (symlink(cgroupdir, "./cgroup.cpu")) { } snprintf(cgroupdir, sizeof(cgroupdir), "/syzcgroup/net/syz%llu", procid); if (symlink(cgroupdir, "./cgroup.net")) { } } static void setup_common() { if (mount(0, "/sys/fs/fuse/connections", "fusectl", 0, 0)) { } setup_cgroups(); } static void loop(); static void sandbox_common() { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); setpgrp(); setsid(); struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = (200 << 20); setrlimit(RLIMIT_AS, &rlim); rlim.rlim_cur = rlim.rlim_max = 32 << 20; setrlimit(RLIMIT_MEMLOCK, &rlim); rlim.rlim_cur = rlim.rlim_max = 136 << 20; setrlimit(RLIMIT_FSIZE, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_STACK, &rlim); rlim.rlim_cur = rlim.rlim_max = 0; setrlimit(RLIMIT_CORE, &rlim); rlim.rlim_cur = rlim.rlim_max = 256; setrlimit(RLIMIT_NOFILE, &rlim); if (unshare(CLONE_NEWNS)) { } if (mount(NULL, "/", NULL, MS_REC | MS_PRIVATE, NULL)) { } if (unshare(CLONE_NEWIPC)) { } if (unshare(0x02000000)) { } if (unshare(CLONE_NEWUTS)) { } if (unshare(CLONE_SYSVSEM)) { } typedef struct { const char* name; const char* value; } sysctl_t; static const sysctl_t sysctls[] = { {"/proc/sys/kernel/shmmax", "16777216"}, {"/proc/sys/kernel/shmall", "536870912"}, {"/proc/sys/kernel/shmmni", "1024"}, {"/proc/sys/kernel/msgmax", "8192"}, {"/proc/sys/kernel/msgmni", "1024"}, {"/proc/sys/kernel/msgmnb", "1024"}, {"/proc/sys/kernel/sem", "1024 1048576 500 1024"}, }; unsigned i; for (i = 0; i < sizeof(sysctls) / sizeof(sysctls[0]); i++) write_file(sysctls[i].name, sysctls[i].value); } static int wait_for_loop(int pid) { if (pid < 0) exit(1); int status = 0; while (waitpid(-1, &status, __WALL) != pid) { } return WEXITSTATUS(status); } static void drop_caps(void) { struct __user_cap_header_struct cap_hdr = {}; struct __user_cap_data_struct cap_data[2] = {}; cap_hdr.version = _LINUX_CAPABILITY_VERSION_3; cap_hdr.pid = getpid(); if (syscall(SYS_capget, &cap_hdr, &cap_data)) exit(1); const int drop = (1 << CAP_SYS_PTRACE) | (1 << CAP_SYS_NICE); cap_data[0].effective &= ~drop; cap_data[0].permitted &= ~drop; cap_data[0].inheritable &= ~drop; if (syscall(SYS_capset, &cap_hdr, &cap_data)) exit(1); } static int do_sandbox_none(void) { if (unshare(CLONE_NEWPID)) { } int pid = fork(); if (pid != 0) return wait_for_loop(pid); setup_common(); initialize_vhci(); sandbox_common(); drop_caps(); initialize_netdevices_init(); if (unshare(CLONE_NEWNET)) { } initialize_tun(); initialize_netdevices(); loop(); exit(1); } #define FS_IOC_SETFLAGS _IOW('f', 2, long) static void remove_dir(const char* dir) { int iter = 0; DIR* dp = 0; retry: while (umount2(dir, MNT_DETACH) == 0) { } dp = opendir(dir); if (dp == NULL) { if (errno == EMFILE) { exit(1); } exit(1); } struct dirent* ep = 0; while ((ep = readdir(dp))) { if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0) continue; char filename[FILENAME_MAX]; snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name); while (umount2(filename, MNT_DETACH) == 0) { } struct stat st; if (lstat(filename, &st)) exit(1); if (S_ISDIR(st.st_mode)) { remove_dir(filename); continue; } int i; for (i = 0;; i++) { if (unlink(filename) == 0) break; if (errno == EPERM) { int fd = open(filename, O_RDONLY); if (fd != -1) { long flags = 0; if (ioctl(fd, FS_IOC_SETFLAGS, &flags) == 0) { } close(fd); continue; } } if (errno == EROFS) { break; } if (errno != EBUSY || i > 100) exit(1); if (umount2(filename, MNT_DETACH)) exit(1); } } closedir(dp); for (int i = 0;; i++) { if (rmdir(dir) == 0) break; if (i < 100) { if (errno == EPERM) { int fd = open(dir, O_RDONLY); if (fd != -1) { long flags = 0; if (ioctl(fd, FS_IOC_SETFLAGS, &flags) == 0) { } close(fd); continue; } } if (errno == EROFS) { break; } if (errno == EBUSY) { if (umount2(dir, MNT_DETACH)) exit(1); continue; } if (errno == ENOTEMPTY) { if (iter < 100) { iter++; goto retry; } } } exit(1); } } static void kill_and_wait(int pid, int* status) { kill(-pid, SIGKILL); kill(pid, SIGKILL); for (int i = 0; i < 100; i++) { if (waitpid(-1, status, WNOHANG | __WALL) == pid) return; usleep(1000); } DIR* dir = opendir("/sys/fs/fuse/connections"); if (dir) { for (;;) { struct dirent* ent = readdir(dir); if (!ent) break; if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) continue; char abort[300]; snprintf(abort, sizeof(abort), "/sys/fs/fuse/connections/%s/abort", ent->d_name); int fd = open(abort, O_WRONLY); if (fd == -1) { continue; } if (write(fd, abort, 1) < 0) { } close(fd); } closedir(dir); } else { } while (waitpid(-1, status, __WALL) != pid) { } } static void setup_loop() { setup_cgroups_loop(); checkpoint_net_namespace(); } static void reset_loop() { reset_net_namespace(); } static void setup_test() { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); setpgrp(); setup_cgroups_test(); write_file("/proc/self/oom_score_adj", "1000"); flush_tun(); } static void close_fds() { for (int fd = 3; fd < MAX_FDS; fd++) close(fd); } static void setup_binfmt_misc() { if (mount(0, "/proc/sys/fs/binfmt_misc", "binfmt_misc", 0, 0)) { } write_file("/proc/sys/fs/binfmt_misc/register", ":syz0:M:0:\x01::./file0:"); write_file("/proc/sys/fs/binfmt_misc/register", ":syz1:M:1:\x02::./file0:POC"); } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; int collide = 0; again: for (call = 0; call < 5; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (collide && (call % 2) == 0) break; event_timedwait(&th->done, 45); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); close_fds(); if (!collide) { collide = 1; goto again; } } static void execute_one(void); #define WAIT_FLAGS __WALL static void loop(void) { setup_loop(); int iter = 0; for (;; iter++) { char cwdbuf[32]; sprintf(cwdbuf, "./%d", iter); if (mkdir(cwdbuf, 0777)) exit(1); reset_loop(); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { if (chdir(cwdbuf)) exit(1); setup_test(); execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5 * 1000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[3] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff}; void execute_call(int call) { intptr_t res = 0; switch (call) { case 0: res = syscall(__NR_epoll_create, 1); if (res != -1) r[0] = res; break; case 1: NONFAILING(memcpy((void*)0x20000000, "/dev/adsp1\000", 11)); res = syscall(__NR_openat, 0xffffffffffffff9cul, 0x20000000ul, 0ul, 0ul); if (res != -1) r[1] = res; break; case 2: NONFAILING(*(uint32_t*)0x200000c0 = 0x60000001); NONFAILING(*(uint64_t*)0x200000c4 = 0); syscall(__NR_epoll_ctl, r[0], 1ul, r[1], 0x200000c0ul); break; case 3: res = syscall(__NR_epoll_create, 0xaf); if (res != -1) r[2] = res; break; case 4: NONFAILING(*(uint32_t*)0x20000100 = 0); NONFAILING(*(uint64_t*)0x20000104 = 0); syscall(__NR_epoll_ctl, r[2], 1ul, r[0], 0x20000100ul); break; } } int main(void) { syscall(__NR_mmap, 0x1ffff000ul, 0x1000ul, 0ul, 0x32ul, -1, 0ul); syscall(__NR_mmap, 0x20000000ul, 0x1000000ul, 7ul, 0x32ul, -1, 0ul); syscall(__NR_mmap, 0x21000000ul, 0x1000ul, 0ul, 0x32ul, -1, 0ul); setup_binfmt_misc(); install_segv_handler(); for (procid = 0; procid < 6; procid++) { if (fork() == 0) { use_temporary_dir(); do_sandbox_none(); } } sleep(1000000); return 0; }
the_stack_data/323605.c
/* ** EPITECH PROJECT, 2017 ** my_str_isnum ** File description: ** is_it_a_num */ int my_str_isnum(char *str) { int i = 0; int n = 0; if (!(str)) return (1); while (str[i]) { i++; } n = i; i = 0; while (i < n) { if ((str[i] >= 48 && str[i] <=57) || str[i] == '\0') { i++; } else { return (0); } } return (1); }
the_stack_data/165768343.c
/* convert an unsigned long value into a numeral string of a given system */ #include <stdio.h> #include <string.h> enum { NUM_DEVANAGARI, NUM_GUJARATI, NUM_GURMUKHI, NUM_TIBETAN, NUM_BENGALI, NUM_KANNADA, NUM_ODIA, NUM_MALAYALAM, NUM_TAMIL, NUM_TELUGU, NUM_KHMER, NUM_THAI, NUM_LAO, NUM_BURMESE, NUM_ARABIC, NUM_PERSIAN }; int num_to_string(char *str, size_t size, int system, unsigned long n) { char z[] = { '\xE0','\xA5','\xA6', 0 }; /* zero in Devanagari */ int i, j, len = 3; switch (system) { case NUM_DEVANAGARI: break; case NUM_GUJARATI: z[1] = '\xAB'; break; case NUM_GURMUKHI: z[1] = '\xA9'; break; case NUM_TIBETAN: z[1] = '\xBC'; z[2] = '\xA0'; break; case NUM_BENGALI: z[1] = '\xA7'; break; case NUM_KANNADA: z[1] = '\xB3'; break; case NUM_ODIA: z[1] = '\xAD'; break; case NUM_MALAYALAM: z[1] = '\xB5'; break; case NUM_TAMIL: z[1] = '\xAF'; break; case NUM_TELUGU: z[1] = '\xB1'; break; case NUM_KHMER: z[0] = '\xE1'; z[1] = '\x9F'; z[2] = '\xA0'; break; case NUM_THAI: z[1] = '\xB9'; z[2] = '\x90'; break; case NUM_LAO: z[1] = '\xBB'; z[2] = '\x90'; break; case NUM_BURMESE: z[0] = '\xE1'; z[1] = '\x81'; z[2] = '\x80'; break; case NUM_ARABIC: z[0] = '\xD9'; z[2] = '\xA0'; len = 2; break; case NUM_PERSIAN: z[0] = '\xDB'; z[2] = '\xB0'; len = 2; break; default: break; } /* only one digit */ if (n < 10) { str[0] = z[0]; if (len == 3) { str[1] = z[1]; i = 1; } else { i = 0; } str[1+i] = z[2] + n; str[2+i] = '\0'; return len; } /* insert last byte, reversing the order */ for (i=0; i < (size - 1) && n != 0; i+=len, n/=10) { str[i] = z[2] + n%10; } /* return 0 length if buffer wasn't large enough */ if (n > 0) { str[0] = '\0'; return 0; } /* correct order, add missing first bytes */ for (j=0, --i; i >= 1; j+=len, i-=len) { str[i] = str[j]; str[j] = z[0]; if (len == 3) { str[j+1] = z[1]; } } str[j] = '\0'; return j; } int main(void) { char buf[64]; int len = num_to_string(buf, sizeof(buf), NUM_TAMIL, 2015); printf("%s\n", buf); printf("%d bytes\n", len); return 0; }
the_stack_data/117328674.c
#include <sys/types.h> #include <sys/socket.h> #include <unistd.h> #include <netinet/in.h> #include <arpa/inet.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #define QUEUE_LEN 5 /* 默认IP&Port */ char strIP[] = "192.168.0.81"; int port = 12345; int identifyARG(int argc,char **argv); int sockProcess(int sockFD); int main(int argc,char **argv) { printf("Server Task\n"); identifyARG(argc,argv); /* 建立监听套接字 */ int listFD = socket(AF_INET,SOCK_STREAM,0); if(listFD < 0) { printf("无法创建套接字\n"); return -1; } /* 绑定IP&Port */ struct sockaddr_in sockAddr; memset(&sockAddr,0,sizeof(sockAddr)); sockAddr.sin_family = AF_INET; sockAddr.sin_port = htons(port); sockAddr.sin_addr.s_addr = inet_addr(strIP); socklen_t addrLen = sizeof(sockAddr); if(bind(listFD,(struct sockaddr *)&sockAddr,addrLen) != 0) { printf("无法绑定IP&Port\n"); close(listFD); return -1; } /* 监听客户端请求 */ if(listen(listFD,QUEUE_LEN) != 0) { printf("无法监听\n"); close(listFD); return -1; } int sockFD; while(1) { printf("监听中\n"); sockFD = accept(listFD, (struct sockaddr *)&sockAddr, &addrLen); printf("Sock FD:%d\n",sockFD); if(sockFD < 0) { printf("无法处理请求\n"); } else { sockProcess(sockFD); } } close(listFD); return 0; } int identifyARG(int argc,char **argv) { switch(argc) { case 1: printf("使用默认地址及端口\n"); break; case 2: port = atoi(argv[1]); break; default: printf("参数数量错误\n"); } printf("IP address:%s Port:%d\n",strIP,port); return 0; } int sockProcess(int sockFD) { char msgBuff[1024]; char sendMsgBuff[2048]; ssize_t recvLen; pid_t pid = fork(); if(pid > 0)// Parent Process { printf("Child ID:%08x\n",pid); close(sockFD); } else if(pid == 0)// Child Process { while(1) { memset(msgBuff,0,sizeof(msgBuff)); memset(sendMsgBuff,0,sizeof(sendMsgBuff)); recvLen = recv(sockFD,msgBuff,sizeof(msgBuff)-1,0); if(recvLen == -1) { printf("Receive Error\n"); close(sockFD); exit(-1); } else if(recvLen == 0) { printf("Receive timeout\n"); close(sockFD); exit(0); } else { sprintf(sendMsgBuff, "PID:%d Client:%d Message:%s\n", getpid(), sockFD, msgBuff); printf("%s\n",sendMsgBuff); send(sockFD, sendMsgBuff, strlen(sendMsgBuff)+1, 0); } } } else { printf("Could not create new process\n"); return -1; } return 0; }
the_stack_data/26701307.c
#include <stdio.h> void selection(long a[], int n) { int i,j,temp; for(i=0;i<n;i++) { for(j=i+1;j<n;j++) { if(a[i]>a[j]) { temp=a[i]; a[i]=a[j]; a[j]=temp; } } } } int main(void) { // your code goes here int n,i,t,k; scanf("%d",&t); for(k=0;k<t;k++) { scanf("%d",&n); long a[n]; for(i=0;i<n;i++) scanf("%ld",&a[i]); selection(a,n); for(i=0;i<n;i++) printf("%ld\t",a[i]); printf("\n"); } return 0; }
the_stack_data/145099.c
#include <pthread.h> #include <assert.h> #include <stdlib.h> //typedef unsigned int int; //typedef unsigned short int; //typedef unsigned char int; #define MAX_RECORDS 64 int numberOfRecords; //int records[MAX_RECORDS]; int records; #define MAX_BUFFER 64 int msgBuffer[MAX_BUFFER]; int intervalCounter; int tickCounter; int interval; int startTime; int decodingStatus; int cmd; int sendit; #define IDLE 0 #define LOGGING 1 int systemState; int rspStatus; #define CMD_DEC_OK 1 #define CMD_DEC_ERROR 0 #define RSP_SUCCESS 1 #define RSP_ERROR 0 #define TASK_COMMUNICATE 1 #define TASK_MEASURE 2 #define CMD_START 1 #define CMD_STOP 2 #define CMD_READ_STATE 3 #define CMD_READ_DATA 4 void task_communicate(); void task_measure(); const int __CPROVER_thread_priorities[] = {5, 2}; const char* __CPROVER_threads[] = {"c::task_communicate", "c::task_measure"}; #define LIMIT 10 int cnt1, cnt2, cnt3; void stop(void) { //systemState = IDLE; systemState = 0; } void start(int _startTime, int _interval) { if (numberOfRecords+1 >= 64) {//stop(); //systemState = IDLE; systemState = 0; } intervalCounter = 0; tickCounter = 0; numberOfRecords = 0; startTime = _startTime; interval = _interval; systemState = 1; //assert(numberOfRecords==0); //if(numberOfRecords!=0) irq_err(); } void task_measure(void) { __CPROVER_ASYNC_1: task_communicate(); //while (cnt1 < LIMIT) { tickCounter++; int tmp_tickCounter = tickCounter; int tmp_interval = interval; //int value = read_sensor_value(); int value = 1; tickCounter = 0; intervalCounter++; //records[numberOfRecords] = value; records = value; numberOfRecords++; cnt1++; //} } void task_communicate(void) { //while (cnt2 < LIMIT) { //int _startTime = get_uint32(); //int _interval = get_uint16(); int _startTime = 1; int _interval = 1; //start(_startTime,_interval); cmd = rand() %4 +1; rspStatus = rand() %2 + 1; decodingStatus = 0; if(cmd==2 || cmd==3 || cmd==4 || cmd==1) { decodingStatus = 1; } if (rspStatus == 1) { if (cmd == 2) { if (systemState != 1) { rspStatus = 0; } else { //stop(); //systemState = IDLE; systemState = 0; } //send_response(); sendit = 1; } if (cmd == 3) { //send_response(); sendit= 1; } if (cmd == 4) { //send_response(); sendit= 1; } if (cmd == 0) { if (systemState != 0) { rspStatus = 0; } else { int tmp_num = numberOfRecords + 1; if (tmp_num >= 64) { //stop(); systemState = 0; } intervalCounter = 0; tickCounter = 0; numberOfRecords = 0; startTime = _startTime; interval = _interval; systemState = 1; // assert(numberOfRecords==0); if (numberOfRecords != 0) { assert(0); } //if(numberOfRecords!=0) irq_err(); sendit = 1; //send_response(); } } } //cnt2++; //} } int main() { systemState = 0; __CPROVER_ASYNC_1: task_measure(); /* pthread_t t1, t2; pthread_create(&t1, 0, task_communicate, 0); pthread_create(&t2, 0, task_measure, 0); */ return 0; }
the_stack_data/959030.c
#include <stdio.h> #define MAXLINE 512 main() { int i = 0, brackets = 0, braces = 0, parens = 0, in_quote = 0; char c = '\0'; while((c = getchar()) != EOF) { in_quote = (c == '"' || c == '\''); if(!in_quote) { switch(c) { case '{': braces++; break; case '}': braces--; break; case '[': brackets++; break; case ']': brackets--; break; case '(': parens++; break; case ')': parens--; break; } } } if(braces != 0 || brackets != 0 || parens != 0) { fprintf(stderr, "Invalid syntax.\n"); } }
the_stack_data/248581785.c
#include <stdio.h> int main() { int order, square_order; int i = 0, j = 0, inc = 1; int SpiralMatrix[100][100] = {0}; scanf("%d", &order); square_order = order * order; while (inc <= square_order) { /* go right */ while ((i < order) && (j < order) && (SpiralMatrix[i][j] == 0)) { SpiralMatrix[i][j] = inc; inc++; j++; } j--; i++; /* go down */ while ((i < order) && (j < order) && (SpiralMatrix[i][j] == 0)) { SpiralMatrix[i][j] = inc; inc++; i++; } i--; j--; /* go left */ while ((j >= 0) && (j < order) && (SpiralMatrix[i][j] == 0)) { SpiralMatrix[i][j] = inc; inc++; j--; } j++; i--; /* go up */ while ((i > 0) && (i < order) && (SpiralMatrix[i][j] == 0)) { SpiralMatrix[i][j] = inc; inc++; i--; //printf("SpiralMatrix[%d][%d]=%d\n", i+1, j, SpiralMatrix[i+1][j]); } i++; j++; } for (i = 0; i < order; i++) { for (j = 0; j < order; j++) { printf("%4d", SpiralMatrix[i][j]); } printf("\n"); } return 0; }
the_stack_data/568067.c
struct s { int a:8; int b:8; }; int foo(void) { struct s x = { .a = 12, .b = 34, }; return x.b; } int bar(int a) { struct s x = { .a = 12, .b = a, }; return x.b; } /* * check-name: bitfield expand deref * check-command: test-linearize -Wno-decl $file * * check-output-ignore * check-output-excludes: ret\\..*\\$12 * check-output-contains: ret\\..*\\$34 */
the_stack_data/178266157.c
/* * STUDENT: (Type your name here) */ /* * ConcurrencyLab (c) 2021 Christopher A. Bohn */ /****************************************************************************** * This program simulates the Pleistocene Petting Zoo's revenues (such as * visitors paying admission) and expenses (such as visitors obtaining a * refund). The revenues and expenses arrive concurrently and are recorded in * the bookkeeping ledger. Unfortunately, the sum of the revenues and expenses * don't add up to the sum of the ledger entries. Students will need to * understand why this happens and will need to correct it. ******************************************************************************/ #define _XOPEN_SOURCE 500 #include <pthread.h> #include <signal.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <unistd.h> #define LINEAR_BUFFER_SIZE (2*1024) #define CIRCULAR_BUFFER_SIZE 32 #define THREAD_COUNT 5 #define TIME_SCALE 128 typedef struct { const char *location; const char *description; clock_t timestamp; int value; int gain_loss; } entry; volatile entry ledger[LINEAR_BUFFER_SIZE]; bool uses_circular_buffer; int ledger_size; volatile unsigned int write_position; volatile unsigned int read_position; volatile bool running; /** * Simulates a recurring revenue or expense for the Zoo. This function will semi-periodically generate a revenue/expense, print it * to the console, and record it in the ledger. * @param args the runtime arguments for this thread: * <ul> * <li>args[0] (char *) the name of the zoo location</li> * <li>args[1] (char *) the description of the revenue/expense</li> * <li>args[2] (int *) the lower bound for the value</li> * <li>args[3] (int *) the upper bound for the value</li> * <li>args[4] (int *) the mean duration between revenues/expenses being generated</li> * <li>args[5] (int *) the <i>local</i> gain/loss, to be used as a return value * </ul> * @return the <i>local</i> gain/loss */ void *revenue_expense_generator(void *args) { const char *location = ((char **)args)[0]; const char *description = ((char **)args)[1]; int lower_bound = *((int **)args)[2]; int upper_bound = *((int **)args)[3]; int difference = upper_bound - lower_bound; int mean_pause = *((int **)args)[4] * TIME_SCALE; int *gain_loss; gain_loss = ((int **)args)[5]; *gain_loss = 0; bool reached_end_of_ledger = false; struct timespec real_time; clock_gettime(CLOCK_REALTIME, &real_time); long now = 1000000000 * real_time.tv_sec + real_time.tv_nsec; unsigned int seed = (unsigned int)(now + (long)pthread_self()); while (running && !reached_end_of_ledger) { clock_gettime(CLOCK_REALTIME, &real_time); now = 1000000000 * real_time.tv_sec + real_time.tv_nsec; int value = difference == 0 ? lower_bound : rand_r(&seed) % difference + lower_bound; int pause = rand_r(&seed) % (2 * TIME_SCALE) - TIME_SCALE + mean_pause; unsigned int my_write_position = write_position; ledger[my_write_position].location = location; ledger[my_write_position].description = description; ledger[my_write_position].timestamp = now; ledger[my_write_position].value = value; ledger[my_write_position].gain_loss += value; *gain_loss += value; write_position++; if (uses_circular_buffer) { write_position = write_position % ledger_size; } else { reached_end_of_ledger = (write_position >= ledger_size - THREAD_COUNT + 1); } printf("%ld (%d) - %s, %dzm\n", (unsigned long)now, my_write_position, description, value); fflush(stdout); usleep(pause); } running = false; return gain_loss; } /** * Reads ledger entries and maintains a running tally of the total gain/loss. * @param args the runtime arguments for this thread: * <ul> * <li>args[0] ignored</li> * <li>args[1] (char *) the description of the accountant</li> * <li>args[2] ignored</li> * <li>args[3] ignored</li> * <li>args[4] (int *) the mean duration between ledger entries being read</li> * <li>args[5] (int *) the gain/loss tally, to be used as a return value * </ul> * @return */ void *accounting(void *args) { const char *description = ((char **)args)[1]; int mean_pause = *((int **)args)[4] * TIME_SCALE; struct timespec real_time; clock_gettime(CLOCK_REALTIME, &real_time); long now = 1000000000 * real_time.tv_sec + real_time.tv_nsec; unsigned int seed = (unsigned int)(now + (long)pthread_self()); int tally = 0; while (running) { if (read_position != write_position) { int pause = rand_r(&seed) % (2 * TIME_SCALE) - TIME_SCALE + mean_pause; printf("\t%s (%d) - %s, %dzm\n", description, read_position, ledger[read_position].description, ledger[read_position].value); fflush(stdout); tally += ledger[read_position].value; read_position++; if (uses_circular_buffer) { read_position = read_position % ledger_size; } usleep(pause); } } *((int **)args)[5] = tally; return ((int **)args)[5]; } void terminate() { running = false; } int main(int argc, const char **argv) { // INITIALIZATION uses_circular_buffer = false; ledger_size = LINEAR_BUFFER_SIZE; if (argc > 1) { long requested_ledger_size = strtol(argv[1], NULL, 10); if (requested_ledger_size < ledger_size) { ledger_size = (int)requested_ledger_size; } else { fprintf(stderr, "Requested ledger size %ld is too great; setting ledger size to %d.\n", requested_ledger_size, ledger_size); } } printf("Ledger is a %d-entry %s buffer\n", ledger_size, uses_circular_buffer ? "circular" : "linear"); write_position = read_position = 0; running = true; sigset(SIGINT, terminate); // PREPARING THREAD PARAMETERS pthread_t tid[THREAD_COUNT]; char *locations[THREAD_COUNT] = {"Admissions-1", "Admissions-2", "Admissions-3", "Customer Service", "Accountant"}; char *descriptions[THREAD_COUNT] = {"visitor buys admission at gate 1", "visitor buys admission at gate 2", "visitor buys admission at gate 3", "refund issued at Customer Service", "Accounting reviews ledger"}; int lower_bounds[THREAD_COUNT] = {10, 10, 10, -15, 0}; int upper_bounds[THREAD_COUNT] = {10, 10, 10, -5, 0}; int pauses[THREAD_COUNT] = {500, 450, 600, 5000, 400}; int gains_losses[THREAD_COUNT]; // CREATING THREADS FOR REVENUE/EXPENSE GENERATORS int i; for (i = 0; i < THREAD_COUNT - 1; i++) { void **args = calloc(6, sizeof(void *)); args[0] = locations[i]; args[1] = descriptions[i]; args[2] = lower_bounds + i; args[3] = upper_bounds + i; args[4] = pauses + i; args[5] = gains_losses + i; pthread_create(tid + i, NULL, revenue_expense_generator, args); printf("Created thread %ld for %s\n", (long)tid[i], ((char **)args)[0]); } // CREATING THREAD FOR ACCOUNTANT void **args = calloc(6, sizeof(void *)); args[0] = locations[i]; args[1] = descriptions[i]; args[2] = lower_bounds + i; args[3] = upper_bounds + i; args[4] = pauses + i; args[5] = gains_losses + i; pthread_create(tid + i, NULL, accounting, args); printf("Created thread %ld for %s\n", (long)tid[i], ((char **)args)[0]); // WAIT UNTIL THE END OF THE LEDGER IS REACHED OR THE USER INTERRUPTS EXECUTION for (i = 0; i < THREAD_COUNT; i++) { pthread_join(tid[i], NULL); printf("Thread %ld terminated.\n", (long)tid[i]); } // FINISH READING THE LEDGER int ledger_tally = gains_losses[THREAD_COUNT - 1]; while (read_position != write_position) { printf("\t%s (%d) - %s, %dzm\n", descriptions[THREAD_COUNT - 1], read_position, ledger[read_position].description, ledger[read_position].value); ledger_tally += ledger[read_position].value; read_position++; if (uses_circular_buffer) { read_position = read_position % ledger_size; } } // ACCOUNTING REPORT int gain_loss = 0; printf("Revenue/Expense Report\n"); for (i = 0; i < THREAD_COUNT - 1; i++) { printf("%20s %10dzm\n", locations[i], gains_losses[i]); gain_loss += gains_losses[i]; } printf(" ------------\n"); printf("Total gains/losses: %10dzm\n", gain_loss); printf("Accounting crosscheck: %10dzm\n", ledger_tally); }
the_stack_data/31387200.c
#include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> int main(int argc, char *argv[]) { if (argc < 2) { printf("ERROR: Se debe especificar la ruta.\n"); return -1; } int fd = open(argv[1], O_CREAT | O_RDWR | O_APPEND, 0777); if (fd == -1) { printf("ERROR: No se ha podido abrir/crear el fichero.\n"); return -1; } if(dup2(fd, 1) == -1){ printf("ERROR: Fallo en dup2."); } printf("Esto se ha redirigido de la salida estandar del fichero.\n"); return 1; }
the_stack_data/184517177.c
void main() { const char CharConst = 'a'; const int IntConst = 1; char CharVar; int IntVar; CharVar = (IntConst); CharVar = (CharConst); IntVar = (CharConst); IntVar = (IntConst); }
the_stack_data/175142873.c
/* $OpenBSD: reallocarray.c,v 1.1 2014/05/08 21:43:49 deraadt Exp $ */ /* * Copyright (c) 2008 Otto Moerbeek <[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 <sys/types.h> #include <errno.h> #include <stdint.h> #include <stdlib.h> /* * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW */ #define MUL_NO_OVERFLOW ((size_t)1 << (sizeof(size_t) * 4)) void * reallocarray(void *optr, size_t nmemb, size_t size) { if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) && nmemb > 0 && SIZE_MAX / nmemb < size) { errno = ENOMEM; return NULL; } return realloc(optr, size * nmemb); }
the_stack_data/237642874.c
*S="*S=%c%s%c;main(){printf(S,34,S,34);}";main(){printf(S,34,S,34);} // *S="*S=%c%s%c;M(){P(S,Q,S,Q);}";M(){P(S,Q,S,Q);}
the_stack_data/27372.c
#include <stdio.h> int main(char argc, char** argv) { printf("Das ist ein Backslash \"\\\".\n"); return 0; }
the_stack_data/108185.c
/* * --INFO-- * Address: 800C0F94 * Size: 000108 */ void CircleBufferReadBytes(void) { /* .loc_0x0: stwu r1, -0x20(r1) mflr r0 stw r0, 0x24(r1) stw r31, 0x1C(r1) mr r31, r5 stw r30, 0x18(r1) mr r30, r3 stw r29, 0x14(r1) stw r28, 0x10(r1) mr r28, r4 lwz r0, 0x10(r3) cmplw r31, r0 ble- .loc_0x3C li r3, -0x1 b .loc_0xE8 .loc_0x3C: addi r3, r30, 0x18 bl 0x5E8 lwz r3, 0x8(r30) lwz r4, 0x0(r30) lwz r0, 0xC(r30) sub r3, r4, r3 sub r29, r0, r3 cmplw r31, r29 bge- .loc_0x7C mr r3, r28 mr r5, r31 bl -0xBBE60 lwz r0, 0x0(r30) add r0, r0, r31 stw r0, 0x0(r30) b .loc_0xA8 .loc_0x7C: mr r3, r28 mr r5, r29 bl -0xBBE7C lwz r4, 0x8(r30) add r3, r28, r29 sub r5, r31, r29 bl -0xBBE8C lwz r0, 0x8(r30) add r0, r0, r31 sub r0, r0, r29 stw r0, 0x0(r30) .loc_0xA8: lwz r4, 0x8(r30) lwz r0, 0x0(r30) lwz r3, 0xC(r30) sub r0, r0, r4 cmplw r3, r0 bne- .loc_0xC4 stw r4, 0x0(r30) .loc_0xC4: lwz r0, 0x14(r30) addi r3, r30, 0x18 add r0, r0, r31 stw r0, 0x14(r30) lwz r0, 0x10(r30) sub r0, r0, r31 stw r0, 0x10(r30) bl 0x524 li r3, 0 .loc_0xE8: lwz r0, 0x24(r1) lwz r31, 0x1C(r1) lwz r30, 0x18(r1) lwz r29, 0x14(r1) lwz r28, 0x10(r1) mtlr r0 addi r1, r1, 0x20 blr */ } /* * --INFO-- * Address: 800C109C * Size: 000108 */ void CircleBufferWriteBytes(void) { /* .loc_0x0: stwu r1, -0x20(r1) mflr r0 stw r0, 0x24(r1) stw r31, 0x1C(r1) mr r31, r5 stw r30, 0x18(r1) mr r30, r3 stw r29, 0x14(r1) stw r28, 0x10(r1) mr r28, r4 lwz r0, 0x14(r3) cmplw r31, r0 ble- .loc_0x3C li r3, -0x1 b .loc_0xE8 .loc_0x3C: addi r3, r30, 0x18 bl 0x4E0 lwz r4, 0x8(r30) lwz r3, 0x4(r30) lwz r0, 0xC(r30) sub r4, r3, r4 sub r29, r0, r4 cmplw r29, r31 blt- .loc_0x7C mr r4, r28 mr r5, r31 bl -0xBBF68 lwz r0, 0x4(r30) add r0, r0, r31 stw r0, 0x4(r30) b .loc_0xA8 .loc_0x7C: mr r4, r28 mr r5, r29 bl -0xBBF84 lwz r3, 0x8(r30) add r4, r28, r29 sub r5, r31, r29 bl -0xBBF94 lwz r0, 0x8(r30) add r0, r0, r31 sub r0, r0, r29 stw r0, 0x4(r30) .loc_0xA8: lwz r4, 0x8(r30) lwz r0, 0x4(r30) lwz r3, 0xC(r30) sub r0, r0, r4 cmplw r3, r0 bne- .loc_0xC4 stw r4, 0x4(r30) .loc_0xC4: lwz r0, 0x14(r30) addi r3, r30, 0x18 sub r0, r0, r31 stw r0, 0x14(r30) lwz r0, 0x10(r30) add r0, r0, r31 stw r0, 0x10(r30) bl 0x41C li r3, 0 .loc_0xE8: lwz r0, 0x24(r1) lwz r31, 0x1C(r1) lwz r30, 0x18(r1) lwz r29, 0x14(r1) lwz r28, 0x10(r1) mtlr r0 addi r1, r1, 0x20 blr */ } /* * --INFO-- * Address: ........ * Size: 000040 */ void CircleBufferTerminate(void) { // UNUSED FUNCTION } /* * --INFO-- * Address: 800C11A4 * Size: 000050 */ void CircleBufferInitialize(void) { /* .loc_0x0: stwu r1, -0x10(r1) mflr r0 mr r6, r3 stw r0, 0x14(r1) li r0, 0 stw r4, 0x8(r3) addi r3, r6, 0x18 stw r5, 0xC(r6) lwz r4, 0x8(r6) stw r4, 0x0(r6) lwz r4, 0x8(r6) stw r4, 0x4(r6) stw r0, 0x10(r6) lwz r0, 0xC(r6) stw r0, 0x14(r6) bl 0x40C lwz r0, 0x14(r1) mtlr r0 addi r1, r1, 0x10 blr */ } /* * --INFO-- * Address: ........ * Size: 000008 */ void CBGetBytesAvailableForWrite(void) { // UNUSED FUNCTION } /* * --INFO-- * Address: 800C11F4 * Size: 000008 */ void CBGetBytesAvailableForRead(void) { /* .loc_0x0: lwz r3, 0x10(r3) blr */ }
the_stack_data/173577529.c
/* command to compile: gcc -O3 adc-test-server.c -o adc-test-server */ #include <stdio.h> #include <stdint.h> #include <string.h> #include <unistd.h> #include <signal.h> #include <fcntl.h> #include <math.h> #include <sys/mman.h> #include <sys/types.h> #include <sys/ioctl.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #define TCP_PORT 1001 int interrupted = 0; void signal_handler(int sig) { interrupted = 1; } int main () { pid_t pid; int pipefd[2], mmapfd, sockServer, sockClient; int position, limit, offset; volatile uint32_t *slcr, *axi_hp0; volatile void *cfg, *sts, *ram, *buf; struct sockaddr_in addr; int yes = 1, buffer = 0; if((mmapfd = open("/dev/mem", O_RDWR)) < 0) { perror("open"); return 1; } slcr = mmap(NULL, sysconf(_SC_PAGESIZE), PROT_READ|PROT_WRITE, MAP_SHARED, mmapfd, 0xF8000000); axi_hp0 = mmap(NULL, sysconf(_SC_PAGESIZE), PROT_READ|PROT_WRITE, MAP_SHARED, mmapfd, 0xF8008000); cfg = mmap(NULL, sysconf(_SC_PAGESIZE), PROT_READ|PROT_WRITE, MAP_SHARED, mmapfd, 0x40000000); sts = mmap(NULL, sysconf(_SC_PAGESIZE), PROT_READ|PROT_WRITE, MAP_SHARED, mmapfd, 0x40001000); ram = mmap(NULL, 2048*sysconf(_SC_PAGESIZE), PROT_READ|PROT_WRITE, MAP_SHARED, mmapfd, 0x1E000000); buf = mmap(NULL, 2048*sysconf(_SC_PAGESIZE), PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, -1, 0); /* set HP0 bus width to 64 bits */ slcr[2] = 0xDF0D; slcr[144] = 0; axi_hp0[0] &= ~1; axi_hp0[5] &= ~1; limit = 512*1024; /* create a pipe */ pipe(pipefd); pid = fork(); if(pid == 0) { /* child process */ close(pipefd[0]); while(1) { /* read ram writer position */ position = *((uint32_t *)(sts + 0)); /* send 4 MB if ready, otherwise sleep 1 ms */ if((limit > 0 && position > limit) || (limit == 0 && position < 512*1024)) { offset = limit > 0 ? 0 : 4096*1024; limit = limit > 0 ? 0 : 512*1024; memcpy(buf + offset, ram + offset, 4096*1024); write(pipefd[1], &buffer, sizeof(buffer)); } else { usleep(1000); } } } else if(pid > 0) { /* parent process */ close(pipefd[1]); if((sockServer = socket(AF_INET, SOCK_STREAM, 0)) < 0) { perror("socket"); return 1; } setsockopt(sockServer, SOL_SOCKET, SO_REUSEADDR, (void *)&yes , sizeof(yes)); /* setup listening address */ memset(&addr, 0, sizeof(addr)); addr.sin_family = AF_INET; addr.sin_addr.s_addr = htonl(INADDR_ANY); addr.sin_port = htons(TCP_PORT); if(bind(sockServer, (struct sockaddr *)&addr, sizeof(addr)) < 0) { perror("bind"); return 1; } listen(sockServer, 1024); while(!interrupted) { /* enter reset mode */ *((uint16_t *)(cfg + 0)) &= ~1; /* set default sample rate */ *((uint16_t *)(cfg + 2)) = 4; if((sockClient = accept(sockServer, NULL, NULL)) < 0) { perror("accept"); return 1; } signal(SIGINT, signal_handler); printf("new connection\n"); /* enter normal operating mode */ *((uint16_t *)(cfg + 0)) |= 1; while(!interrupted) { read(pipefd[0], &buffer, sizeof(buffer)); if(send(sockClient, buf, 4096*1024, 0) < 0) break; read(pipefd[0], &buffer, sizeof(buffer)); if(send(sockClient, buf + 4096*1024, 4096*1024, 0) < 0) break; } signal(SIGINT, SIG_DFL); close(sockClient); } /* enter reset mode */ *((uint16_t *)(cfg + 0)) &= ~1; close(sockServer); kill(pid, SIGTERM); return 0; } }
the_stack_data/150143714.c
#include <stdio.h> #include <sys/types.h> #include <unistd.h> #include <sys/wait.h> int main(void) { int status; pid_t pid; pid = fork(); if (pid == -1) { perror("Fork"); } else if (pid == 0) { wait(&status); pid = fork(); if (pid == -1) { perror("Fork"); } else if (pid == 0) { wait(&status); write(STDOUT_FILENO, " friends!\n", 10); } else{ write(STDOUT_FILENO, "my", 2); } } else { write(STDOUT_FILENO, "Hello ", 6); } return 0; }
the_stack_data/737379.c
#include <stdarg.h> f (int n, ...) { va_list args; va_start (args, n); if (va_arg (args, int) != 10) abort (); if (va_arg (args, long long) != 10000000000LL) abort (); if (va_arg (args, int) != 11) abort (); if (va_arg (args, long double) != 3.14L) abort (); if (va_arg (args, int) != 12) abort (); if (va_arg (args, int) != 13) abort (); if (va_arg (args, long long) != 20000000000LL) abort (); if (va_arg (args, int) != 14) abort (); if (va_arg (args, double) != 2.72) abort (); va_end(args); } main () { f (4, 10, 10000000000LL, 11, 3.14L, 12, 13, 20000000000LL, 14, 2.72); exit (0); }
the_stack_data/212643713.c
// PC DEAD, WAITING FOR A NEW LAPTOP // could a C++ template reduce for example, a 1k LOC files with say 500 lines of the same code but slightly different, with the 500 lines consisting of 25 blocks of code and each block is 20 lines, with the only changes in each block is say filenames and variable names, to only a 500 LOC file with only 1 block but still be as if there are 25 blocks * /* git clone https://github.com/mgood7123/min-dl-dynamic-loader.git cd min-dl-dynamic-loader/loader git checkout -b test_branch f74e804a974b27e02033ea97a6ab19ff7692194c ./make_loader should end up with example1: readelf_.c:2487: get_needed: Assertion `bytecmpq(lib_now, library[3].last_lib) == 0' failed. ) */ /* printf resolution: initialization: in during relocation JMP_SLOT relocations are preformed, which write directly to the GOT, in this case "printf" is translated directly to "puts" at compile time -> R_X86_64_JUMP_SLOT calculation: S (symbol value) library[library_index].mappingb = 0x7ffff0000000 reloc->r_offset = 0x7ffff0000000+0x000000201018=0x7ffff0201018 attempting to look up symbol, index = 2 looking up index 2 of table 3 requested symbol name for index 2 is puts symbol = 0 ( (nil)) 0x7ffff0201018 = 0x7ffff0000000 in gdb tracing/examining the calls: callq 540 <puts@plt> -> jmpq *0x200ad2(%rip) # 201018 <puts@GLIBC_2.2.5> -> retrieves the _GLOBAL_OFFSET_TABLE_ as an array called GOT address of GOT[3] = 0x7ffff0000000 ( pwndbg> x /g 0x7ffff0201000+0x8+0x10 0x7ffff0201018: 0x00007ffff0000000 ) -> jumps to 0x00007ffff0000000 wich is incorrect as it is not the location of printf ► 0x7ffff0000540 jmp qword ptr [rip + 0x200ad2] // callq 540 <puts@plt> ↓ 0x7ffff0000000 jg 0x7ffff0000047 since the jump can be modified we can make it jump to whatever we like wich would be bad in normal cases but usefull in specific cases, but for now we will try to make it jump to the actual location of puts in the libc library "ld.so takes the first symbol it finds" */ char ** argv; #ifndef __SHARED__ // compiled without -fpic or -fPIC #warning recompile this with the flag -D__SHARED__ to enable compiling this as a shared library int readelf_(const char * filename); int main() { readelf_(argv[1]); } #else // compiled with -fpic or -fPIC int self = 0; int readelf = 0; const char * sleep_ = "no"; // no | YES const char * sleep_r = "no"; // no | yes const char * GQ = "no"; // no | yes const char * symbol_quiet = "no"; // no | yes const char * relocation_quiet = "no"; // no | yes const char * analysis_quiet = "no"; // no | yes const char * ldd_quiet = "no"; // no | yes const int do_tests = 0; // tests are REQUIRED to be done, cannot be skipped // define all headers first #include <elf.h> #include <libiberty/libiberty.h> #include <libiberty/demangle.h> #include <libiberty/safe-ctype.h> #include <stdlib.h> #include <stdio.h> #include <assert.h> #include <signal.h> #include <ucontext.h> #include <setjmp.h> #include <errno.h> extern int errno; #include <string.h> #include <unistd.h> #include <locale.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <assert.h> #include <sys/mman.h> // need to add every needed declaration into this struct int library_index = 0; // must be global #include "lib.h" int init_needed_struct() { library[library_index].struct_needed_init = "initialized"; library[library_index].parent = "-1"; library[library_index].NEEDED = malloc(sizeof(library[library_index].NEEDED)); library[library_index].current_lib = "NULL"; library[library_index].last_lib = "NULL"; } int init_struct() { library[library_index].struct_init = "initialized"; library[library_index].Resolve_Index[0] = 0; library[library_index].Resolved = malloc(sizeof(library[library_index].Resolved)); library[library_index].Resolved[0] = "NULL"; library[library_index].library_name; library[library_index].library_first_character; library[library_index].library_len; library[library_index].library_symbol; library[library_index].mappingb; library[library_index]._elf_header; library[library_index]._elf_program_header; library[library_index]._elf_symbol_table; library[library_index].strtab = NULL; if (library[library_index].current_lib == NULL && library[library_index].last_lib == NULL) { library[library_index].current_lib = "NULL"; library[library_index].last_lib = "NULL"; } library[library_index].len; library[library_index].array; library[library_index].is_mapped = 0; library[library_index].align; library[library_index].base_address = 0x00000000; library[library_index].mappingb_end = 0x00000000; library[library_index].init__ = 0; library[library_index].PT_DYNAMIC_ = NULL; library[library_index].interp = ""; library[library_index].tmp99D; library[library_index].First_Load_Header_index = NULL; library[library_index].Last_Load_Header_index = NULL; library[library_index].RELA_PLT_SIZE = 0; library[library_index]._R_X86_64_NONE = 0; library[library_index]._R_X86_64_64 = 0; library[library_index]._R_X86_64_PC32 = 0; library[library_index]._R_X86_64_GOT32 = 0; library[library_index]._R_X86_64_PLT32 = 0; library[library_index]._R_X86_64_COPY = 0; library[library_index]._R_X86_64_GLOB_DAT = 0; library[library_index]._R_X86_64_JUMP_SLOT = 0; library[library_index]._R_X86_64_RELATIVE = 0; library[library_index]._R_X86_64_GOTPCREL = 0; library[library_index]._R_X86_64_32 = 0; library[library_index]._R_X86_64_32S = 0; library[library_index]._R_X86_64_16 = 0; library[library_index]._R_X86_64_PC16 = 0; library[library_index]._R_X86_64_8 = 0; library[library_index]._R_X86_64_PC8 = 0; library[library_index]._R_X86_64_DTPMOD64 = 0; library[library_index]._R_X86_64_DTPOFF64 = 0; library[library_index]._R_X86_64_TPOFF64 = 0; library[library_index]._R_X86_64_TLSGD = 0; library[library_index]._R_X86_64_TLSLD = 0; library[library_index]._R_X86_64_DTPOFF32 = 0; library[library_index]._R_X86_64_GOTTPOFF = 0; library[library_index]._R_X86_64_TPOFF32 = 0; library[library_index]._R_X86_64_PC64 = 0; library[library_index]._R_X86_64_GOTOFF64 = 0; library[library_index]._R_X86_64_GOTPC32 = 0; library[library_index]._R_X86_64_GOT64 = 0; library[library_index]._R_X86_64_GOTPCREL64 = 0; library[library_index]._R_X86_64_GOTPC64 = 0; library[library_index]._Deprecated1 = 0; library[library_index]._R_X86_64_PLTOFF64 = 0; library[library_index]._R_X86_64_SIZE32 = 0; library[library_index]._R_X86_64_SIZE64 = 0; library[library_index]._R_X86_64_GOTPC32_TLSDESC = 0; library[library_index]._R_X86_64_TLSDESC_CALL = 0; library[library_index]._R_X86_64_TLSDESC = 0; library[library_index]._R_X86_64_IRELATIVE = 0; library[library_index]._R_X86_64_RELATIVE64 = 0; library[library_index]._Deprecated2 = 0; library[library_index]._Deprecated3 = 0; library[library_index]._R_X86_64_GOTPLT64 = 0; library[library_index]._R_X86_64_GOTPCRELX = 0; library[library_index]._R_X86_64_REX_GOTPCRELX = 0; library[library_index]._R_X86_64_NUM = 0; library[library_index]._R_X86_64_UNKNOWN = 0; library[library_index].GOT = NULL; library[library_index].GOT2 = NULL; library[library_index].PLT = NULL; } int init_(const char * filename); int initv_(const char * filename); void * lookup_symbol_by_name_(const char * lib, const char * name); // for C++ symbol name demangling should libirty become incompatible // http://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling // https://itanium-cxx-abi.github.io/cxx-abi/gcc-cxxabi.h // https://github.com/xaxxon/xl/blob/master/include/xl/demangle.h // gdb and c++filt use demangler provided by libiberty // allow for demangling of C++ symbols, link with -liberty int flags = DMGL_PARAMS | DMGL_ANSI | DMGL_VERBOSE; int strip_underscore = 0; char * demangle_it (char *mangled_name) { char *result; unsigned int skip_first = 0; /* _ and $ are sometimes found at the start of function names in assembler sources in order to distinguish them from other names (eg register names). So skip them here. */ if (mangled_name[0] == '.' || mangled_name[0] == '$') ++skip_first; if (strip_underscore && mangled_name[skip_first] == '_') ++skip_first; result = cplus_demangle (mangled_name + skip_first, flags); // bytecmpq(mangled_name, mangled_name); // mangled_name[strlen(mangled_name)-2] = '\0'; int len = strlen(mangled_name); // for (int i = 0; i=len-2; i++) // if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "trimming %s", mangled_name); if (result == NULL) return mangled_name; else { if ( result[strlen(result)-2] == '(' && result[strlen(result)-1] == ')' ) result[strlen(result)-2] = '\0'; if (mangled_name[0] == '.') return strjoin_(".", result); else return result; } } char * __print_quoted_string__(const char *str, unsigned int size, const unsigned int style, const char * return_type); #define _GNU_SOURCE #define __USE_GNU // ELF Spec FULL: http://refspecs.linuxbase.org/elf/elf.pdf // ELF Spec ABI FULL: https://github.com/hjl-tools/x86-psABI/wiki/x86-64-psABI-1.0.pdf //sig handling jmp_buf restore_point; struct sigaction sa; void Handler(int sig, siginfo_t *si, ucontext_t *context) { if (sig == SIGSEGV) { void * h = &Handler; signal(SIGSEGV, h); longjmp(restore_point, SIGSEGV); } } void init_handler() { sa.sa_flags = SA_SIGINFO|SA_NODEFER; sigemptyset(&sa.sa_mask); sa.sa_sigaction = Handler; if (sigaction(SIGSEGV, &sa, NULL) == -1) perror("failed to set handler"); } int test(char * address) { if (do_tests == 1) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "TESTS DISABLED"); return -1; } init_handler(); int fault_code = setjmp(restore_point); if (fault_code == 0) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "value: %15d\t", *(int*)address); return 0; } else { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "value: %s\t", " is not int"); return -1; } } int pointers=0; int is_pointer_valid(void *p) { int page_size = getpagesize(); void *aligned = (void *)((uintptr_t)p & ~(page_size - 1)); if (msync(aligned, page_size, MS_ASYNC) == -1) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Seg faulted, restoring\n"); longjmp(restore_point, -1); } return 0; } int test_address(char ** addr) { if (do_tests == 1) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "TESTS DISABLED"); return -1; } init_handler(); int fault_code = setjmp(restore_point); if (fault_code == 0) { // is_pointer_valid(addr); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "TEST ADDRESS %014p = %014p\n", addr, *addr); bt(); pointers++; return 0; } else { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "TEST ADDRESS %014p = %s\n", addr, "INVALID"); pointers--; return -1; } } int test_string(char * addr) { if (do_tests == 1) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "TESTS DISABLED"); return -1; } init_handler(); int fault_code = setjmp(restore_point); if (fault_code == 0) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "%s", addr); for (int i = 0; i <= strlen(addr); i++) if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "\b"); return 0; } else { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "INVALID"); for (int i = 0; i <= strlen("INVALID"); i++) if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "\b"); return -1; } } char * analyse_address(char ** addr, char * name) { if (do_tests == 1) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "CANNOT ALALYSE: TESTS DISABLED"); return addr; } if (bytecmpq(GQ, "no") == 0) if (bytecmpq(analysis_quiet, "no") == 0) fprintf(stderr, "analysing address %014p\n", addr); char ** addr_original = addr; pointers = 0; while( test_address(addr) == 0) addr = *addr; if (bytecmpq(GQ, "no") == 0) if (bytecmpq(analysis_quiet, "no") == 0) fprintf(stderr, "pointers: %d\n", pointers); if (bytecmpq(GQ, "no") == 0) if (bytecmpq(analysis_quiet, "no") == 0) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "data "); for (int i = 1; i<=pointers; i++) fprintf(stderr, "*"); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, " %s\n", name); } if (pointers == 0) { pointers = 0; if (bytecmpq(GQ, "no") == 0) if (bytecmpq(analysis_quiet, "no") == 0) fprintf(stderr, "%s:%d:%s: returning %014p\n", __FILE__, __LINE__, __func__, addr_original); return addr_original; } else { pointers = 0; if (bytecmpq(GQ, "no") == 0) if (bytecmpq(analysis_quiet, "no") == 0) fprintf(stderr, "%s:%d:%s: returning %014p\n", __FILE__, __LINE__, __func__, *addr_original); return *addr_original; } } int testh(char * address) { init_handler(); int fault_code = setjmp(restore_point); if (fault_code == 0) { /* if this seg faults in gdb, pass "handle SIGSEGV nostop pass noprint" to gdb command line to allow the hander init_handler() to handle this instead of gdb: (gdb) handle SIGSEGV nostop pass noprint <enter> (gdb) r <enter> if u use pwndbg the instructions are the same: pwndbg> handle SIGSEGV nostop pass noprint <enter> pwndbg> r <enter> alternatively start gdb like this (this assumes this is run inside a script and the executable this is compiled into is named ./loader and compiled with test_loader.c containing a main() { ... ; return 0; } with return 0; being on line 22, note the ... signifies a variable amount of text as we do not know what code main() {} can contain) : gdb ./loader -ex "set args $1" -ex "break test_loader.c:22" -ex "handle SIGSEGV nostop pass noprint" -ex "r" else this works fine: gdb <file> -ex "handle SIGSEGV nostop pass noprint" -ex "r" */ if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "value: %15x\t", *(int*)address); return 0; } else { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "value: %s\t", " is not hex"); return -1; } } #define QUOTE_0_TERMINATED 0x01 #define QUOTE_OMIT_LEADING_TRAILING_QUOTES 0x02 #define QUOTE_OMIT_TRAILING_0 0x08 #define QUOTE_FORCE_HEX 0x10 #define QUOTE_FORCE_HEXOLD 9998 #define QUOTE_FORCE_LEN 9999 #define error_msg printf int search(const char * lib) { // need to be smarter int i = 0; while(1) { if (library[i].struct_init == "initialized") { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "current index %d holds \"%s\"\n", i, library[i].last_lib); if ( bytecmpq(lib, library[i].last_lib) == -1 && bytecmpq("NULL", library[i].last_lib) == -1 ) i++; else if ( bytecmpq("NULL", library[i].last_lib) == -1 ) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "index %d holds desired library \"%s\"\n", i, lib); // bugs break; } else { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "attempting to save to index %d\n", i); break; } } else { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "WARNING: index %d is %s\n", i, library[i].struct_init); break; } } return i; } int search_resolved(const char * symbol) { // need to be smarter int i = 0; while(1) { if (library[i].struct_init == "initialized") { for (int ii = 0; ii <= library[i].Resolve_Index[0]; ii++) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "current index %d of %s holds (%d) \"%s\"\n", ii, library[i].last_lib, library[i].Resolve_Index[0], library[i].Resolved[ii]); if ( bytecmpq(symbol, library[i].Resolved[ii]) == 0 ) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "index %d of (%d) %s holds desired symbol \"%s\"\n", ii, library[i].Resolve_Index[0], library[i].last_lib, symbol); return 0; } } i++; } else { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "WARNING: index %d is %s\n", i, library[i].struct_init); break; } } return -1; } int searchq(const char * lib) { // need to be smarter int i = 0; while(1) { if (library[i].struct_init == "initialized") { if ( bytecmpq(lib, library[i].last_lib) == -1 && bytecmpq("NULL", library[i].last_lib) == -1 ) i++; else if ( bytecmpq("NULL", library[i].last_lib) == -1 ) { break; } else { break; } } else { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "WARNING: index %d is %s\n", i, library[i].struct_init); break; } } return i; } int search_neededq(const char * lib) { // need to be smarter int i = 0; while(1) { if (library[i].struct_needed_init == "initialized") { if ( bytecmpq(lib, library[i].last_lib) == -1 && bytecmpq("NULL", library[i].last_lib) == -1 ) i++; else if ( bytecmpq("NULL", library[i].last_lib) == -1 ) { break; } else { break; } } else { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "WARNING: index %d is %s\n", i, library[i].struct_needed_init); break; } } return i; } int init(char * lib) { if (library[library_index].struct_init != "initialized") init_struct(); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "current index %d holds \"%s\"\nsearching indexes for \"%s\" incase it has already been loaded\n", library_index, library[library_index].last_lib, lib); library_index = search(lib); library[library_index].last_lib = lib; library[library_index].current_lib = lib; if (library[library_index].array == NULL) { int fd = open(lib, O_RDONLY); if (fd < 0) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "cannot open \"%s\", returned %i\n", lib, fd); return -1; } library[library_index].len = 0; library[library_index].len = lseek(fd, 0, SEEK_END); lseek(fd, 0, 0); library[library_index].array = mmap (NULL, library[library_index].len, PROT_READ, MAP_PRIVATE, fd, 0); if (library[library_index].array == MAP_FAILED) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "map failed\n"); exit; } else { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "map succeded with address: %014p\n", library[library_index].array); return 0; } } else return 0; return -1; } int prot_from_phdr(const int p_flags) { int prot = 0; if (p_flags & PF_R) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "PROT_READ|"); prot |= PROT_READ; } if (p_flags & PF_W) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "PROT_WRITE|"); prot |= PROT_WRITE; } if (p_flags & PF_X) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "PROT_EXEC|"); prot |= PROT_EXEC; } return prot; } void map() { if (library[library_index].is_mapped == 0) { library[library_index]._elf_header = (Elf64_Ehdr *) library[library_index].array; library[library_index]._elf_program_header = (Elf64_Phdr *)((unsigned long)library[library_index]._elf_header + library[library_index]._elf_header->e_phoff); // the very first thing we do is obtain the base address // Base Address // The virtual addresses in the program headers might not represent the actual virtual addresses // of the program's memory image. Executable files typically contain absolute code. To let the // process execute correctly, the segments must reside at the virtual addresses used to build the // executable file. On the other hand, shared object segments typically contain // position-independent code. This lets a segment's virtual address change from one process to // another, without invalidating execution behavior. Though the system chooses virtual addresses // for individual processes, it maintains the segments’ relative positions. Because // position-independent code uses relative addressing between segments, the difference between // virtual addresses in memory must match the difference between virtual addresses in the file. // // The difference between the virtual address of any segment in memory and the corresponding // virtual address in the file is thus a single constant value for any one executable or shared object // in a given process. This difference is the base address. One use of the base address is to relocate // the memory image of the program during dynamic linking. // // An executable or shared object file's base address is calculated during execution from three // values: the virtual memory load address, the maximum page size, and the lowest virtual address // of a program's loadable segment. To compute the base address, one determines the memory // address associated with the lowest p_vaddr value for a PT_LOAD segment. This address is // truncated to the nearest multiple of the maximum page size. The corresponding p_vaddr value // itself is also truncated to the nearest multiple of the maximum page size. The base address is // the difference between the truncated memory address and the truncated p_vaddr value. int PT_LOADS=0; for (int i = 0; i < library[library_index]._elf_header->e_phnum; ++i) { switch(library[library_index]._elf_program_header[i].p_type) { case PT_LOAD: // if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "i = %d\n", i); // if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "PT_LOADS = %d\n", PT_LOADS); if (!PT_LOADS) { // if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "saving first load\n"); library[library_index].First_Load_Header_index = i; } if (PT_LOADS) { // if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "saving last load\n"); library[library_index].Last_Load_Header_index = i; } PT_LOADS=PT_LOADS+1; break; } } size_t span = library[library_index]._elf_program_header[library[library_index].Last_Load_Header_index].p_vaddr + library[library_index]._elf_program_header[library[library_index].Last_Load_Header_index].p_memsz - library[library_index]._elf_program_header[library[library_index].First_Load_Header_index].p_vaddr; size_t pagesize = 0x1000; read_fast_verifyb(library[library_index].array, library[library_index].len, &library[library_index].mappingb, span, library[library_index]._elf_program_header[library[library_index].First_Load_Header_index], library[library_index]._elf_program_header[library[library_index].Last_Load_Header_index]); library[library_index].align = round_down(library[library_index]._elf_program_header[library[library_index].Last_Load_Header_index].p_vaddr, pagesize); library[library_index].base_address = library[library_index].mappingb - library[library_index].align; library[library_index].mappingb_end = library[library_index].mappingb+span; // if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "base address range = %014p - %014p\nmapping = %014p\n", library[library_index].mappingb, library[library_index].mappingb_end, mapping); // base address aquired, map all PT_LOAD segments adjusting by base address then continue with the rest if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "\n\n\nfind %014p, %014p, (int) 1239\n\n\n\n", library[library_index].mappingb, library[library_index].mappingb_end); if (library[library_index].mappingb == 0x00000000) abort_(); int PT_LOADS_CURRENT = 0; for (int i = 0; i < library[library_index]._elf_header->e_phnum; ++i) { switch(library[library_index]._elf_program_header[i].p_type) { case PT_LOAD: PT_LOADS_CURRENT = PT_LOADS_CURRENT + 1; // if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "mapping PT_LOAD number %d\n", PT_LOADS_CURRENT); // if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "\t\tp_flags: %014p\n", library[library_index]._elf_program_header[i].p_flags); // if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "\t\tp_offset: %014p\n", library[library_index]._elf_program_header[i].p_offset); // if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "\t\tp_vaddr: %014p\n", library[library_index]._elf_program_header[i].p_vaddr+library[library_index].mappingb); // if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "\t\tp_paddr: %014p\n", library[library_index]._elf_program_header[i].p_paddr); // if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "\t\tp_filesz: %014p\n", library[library_index]._elf_program_header[i].p_filesz); // if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "\t\tp_memsz: %014p\n", library[library_index]._elf_program_header[i].p_memsz); // if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "\t\tp_align: %014p\n\n", library[library_index]._elf_program_header[i].p_align); // // if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "\tp_flags: %014p", library[library_index]._elf_program_header[i].p_flags); // if (bytecmpq(GQ, "no") == 0) fprintf(stderr, " p_offset: %014p", library[library_index]._elf_program_header[i].p_offset); // if (bytecmpq(GQ, "no") == 0) fprintf(stderr, " p_vaddr: %014p", library[library_index]._elf_program_header[i].p_vaddr+library[library_index].mappingb); // if (bytecmpq(GQ, "no") == 0) fprintf(stderr, " p_paddr: %014p", library[library_index]._elf_program_header[i].p_paddr); // if (bytecmpq(GQ, "no") == 0) fprintf(stderr, " p_filesz: %014p", library[library_index]._elf_program_header[i].p_filesz); // if (bytecmpq(GQ, "no") == 0) fprintf(stderr, " p_memsz: %014p", library[library_index]._elf_program_header[i].p_memsz); // if (bytecmpq(GQ, "no") == 0) fprintf(stderr, " p_align: %014p\n\n\n", library[library_index]._elf_program_header[i].p_align); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "mprotect(%014p+round_down(%014p, %014p), %014p, ", library[library_index].mappingb, library[library_index]._elf_program_header[i].p_vaddr, library[library_index]._elf_program_header[i].p_align, library[library_index]._elf_program_header[i].p_memsz); prot_from_phdr(library[library_index]._elf_program_header[i].p_flags); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, ");\n"); errno = 0; int check_mprotect_success = mprotect(library[library_index].mappingb+round_down(library[library_index]._elf_program_header[i].p_vaddr, library[library_index]._elf_program_header[i].p_align), round_up(library[library_index]._elf_program_header[i].p_memsz, library[library_index]._elf_program_header[i].p_align), library[library_index]._elf_program_header[i].p_flags); if (errno == 0) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "mprotect on %014p succeded with size: %014p\n", library[library_index].mappingb+round_down(library[library_index]._elf_program_header[i].p_vaddr, library[library_index]._elf_program_header[i].p_align), round_up(library[library_index]._elf_program_header[i].p_memsz, library[library_index]._elf_program_header[i].p_align)); print_maps(); } else { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "mprotect failed with: %s (errno: %d, check_mprotect_success = %d)\n", strerror(errno), errno, check_mprotect_success); print_maps(); abort_(); } break; } } library[library_index].is_mapped = 1; } } // not used but kept incase needed void __lseek_string__(char **src, int len, int offset) { char *p = malloc(len); memcpy(p, *src+offset, len); *src = p; } // not used but kept incase needed, a version of lseek_string that has an offset multiplier as so this does not need to be specified multiple times, eg if offset is 64 and multiplier is 2 the offset is then 128, this is intended for loops and related void __lseek_stringb__(char **src, int len, int offset, int offsetT) { char *p = malloc(len); int off; off=((len*offsetT)); memcpy(p, *src+offset+off, len); *src = p; } int __stream__(char *file, char **p, int *q, int LINES_TO_READ) { const char *filename = file; int fd = open(filename, O_RDONLY); if (fd < 0) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "cannot open \"%s\", returned %i\n", filename, fd); return -1; } char * array; char ch; size_t lines = 1; // Read the file byte by byte int bytes=1; int count=1; array = malloc(sizeof(char) * 2048); char *array_tmp; while (read(fd, &ch, 1) == 1) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "\rbytes read: %'i", bytes); if (count == 1024) { array_tmp = realloc(array, bytes+1024); if (array_tmp == NULL) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "failed to allocate array to new size"); free(array); exit(1); } else { array = array_tmp; } count=1; } array[bytes-1] = ch; if (ch == '\n') { if (lines == LINES_TO_READ) { break; } lines++; } count++; bytes++; } bytes--; array_tmp = realloc(array, bytes); if (array_tmp == NULL) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "failed to allocate array to new size"); free(array); exit(1); } else { array = array_tmp; } if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "\rbytes read: %'i\n", bytes); *p = array; *q = bytes; return bytes; } // not used but kept incase needed, a version of stream__ that only outputs the last line read int __streamb__(char *file, char **p, int *q, int LINES_TO_READ) { const char *filename = file; int fd = open(filename, O_RDONLY); if (fd < 0) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "cannot open \"%s\", returned %i\n", filename, fd); return -1; } char * array; char * array_tmp; char * array_lines; char * array_lines_tmp; char ch; size_t lines = 1; // Read the file byte by byte int bytes=1; int count=1; array = malloc(sizeof(char) * 2048); while (read(fd, &ch, 1) == 1) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "\rbytes read: %'i", bytes); if (count == 1024) { array_tmp = realloc(array, bytes+1024); if (array_tmp == NULL) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "failed to allocate array to new size"); free(array); exit(1); } else { array = array_tmp; } count=1; } array[bytes-1] = ch; if (ch == '\n') { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "attempting to reset array\n"); if (lines == LINES_TO_READ) { break; } else { // reset array to as if we just executed this function int y; for (y=0; y<bytes; y++) { array[y] = 0; } free(array); array = malloc(sizeof(char) * 2048); bytes=1; count=1; } lines++; } // count++; bytes++; } bytes--; array_tmp = realloc(array, bytes); if (array_tmp == NULL) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "failed to allocate array to new size"); free(array); exit(1); } else { array = array_tmp; } if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "\rbytes read: %'i\n", bytes); *p = array; *q = bytes; return bytes; } // reads a entire file int __readb__(char *file, char **p, size_t *q) { int fd; size_t len = 0; char *o; if (!(fd = open(file, O_RDONLY))) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "open() failure\n"); return (1); } len = lseek(fd, 0, SEEK_END); lseek(fd, 0, 0); if (!(o = malloc(len))) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "failure to malloc()\n"); } if ((read(fd, o, len)) == -1) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "failure to read()\n"); } int cl = close(fd); if (cl < 0) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "cannot close \"%s\", returned %i\n", file, cl); return -1; } *p = o; *q = len; return len; } int __string_quote__(const char *instr, char *outstr, const unsigned int size, const unsigned int style); #ifndef ALLOCA_CUTOFF # define ALLOCA_CUTOFF 4032 #endif #define use_alloca(n) ((n) <= ALLOCA_CUTOFF) char * __print_quoted_string__(const char *str, unsigned int size, const unsigned int style, const char * return_type) { char *buf; char *outstr; unsigned int alloc_size; int rc; if (size && style & QUOTE_0_TERMINATED) --size; alloc_size = 4 * size; if (alloc_size / 4 != size) { error_msg("Out of memory"); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "???"); return "-1"; } alloc_size += 1 + (style & QUOTE_OMIT_LEADING_TRAILING_QUOTES ? 0 : 2); if (use_alloca(alloc_size)) { outstr = alloca(alloc_size); buf = NULL; } else { outstr = buf = malloc(alloc_size); if (!buf) { error_msg("Out of memory"); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "???"); return "-1"; } } // rc = string_quote(str, outstr, size, style); __string_quote__(str, outstr, size, style); if ( return_type == "return") { return outstr; } else if ( return_type == "print") { if (bytecmpq(GQ, "no") == 0) printf(outstr); } free(buf); // return rc; } Elf64_Word get_dynamic_entryq(Elf64_Dyn *dynamic, int field); // read section header table int read_section_header_table_(const char * arrayb, Elf64_Ehdr * eh, Elf64_Shdr * sh_table[]) { *sh_table = (Elf64_Shdr *)(arrayb + eh->e_shoff); if(!sh_table) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Failed to read table\n"); return -1; } return 0; } char * read_section_(char * ar, Elf64_Shdr sh) { char * buff = (char *)(ar + sh.sh_offset); return buff ; } int get_section(char * sourcePtr, Elf64_Ehdr * eh, Elf64_Shdr sh_table[], char * section) { fprintf(stderr, "\nreading section: %s\n", section); char * sh_str = read_section_(sourcePtr, sh_table[eh->e_shstrndx]); // will fail untill section header table can be read for(int i=0; i<eh->e_shnum; i++) if (bytecmpq((sh_str + sh_table[i].sh_name), section) == 0) { return i; } return 0; // if section cannot be found } char * print_section_headers_(char * sourcePtr, Elf64_Ehdr * eh, Elf64_Shdr sh_table[]) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "\n"); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "eh->e_shstrndx = 0x%x (%d)\n", eh->e_shstrndx+library[library_index].mappingb, eh->e_shstrndx); char * sh_str; sh_str = read_section_(sourcePtr, sh_table[eh->e_shstrndx]); // will fail untill section header table can be read if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "\t========================================"); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "========================================\n"); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "\tidx offset load-addr size algn type flags section\n"); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "\t========================================"); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "========================================\n"); for(int i=0; i<eh->e_shnum; i++) { // will fail untill section header table can be read if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "\t%03d ", i); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "%014p ", library[library_index]._elf_symbol_table[i].sh_offset); // not sure if this should be adjusted to base address if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "%014p ", library[library_index]._elf_symbol_table[i].sh_addr+library[library_index].mappingb); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "%014p ", library[library_index]._elf_symbol_table[i].sh_size); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "%4d ", library[library_index]._elf_symbol_table[i].sh_addralign); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "%014p ", library[library_index]._elf_symbol_table[i].sh_type); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "%014p ", library[library_index]._elf_symbol_table[i].sh_flags); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "%s\t", (sh_str + sh_table[i].sh_name)); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "\n"); if (bytecmpq((sh_str + sh_table[i].sh_name), ".rela.plt") == 0) library[library_index].RELA_PLT_SIZE=library[library_index]._elf_symbol_table[i].sh_size; } if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "\t========================================"); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "========================================\n"); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "\n"); } void read_symbol(char * arrayc, Elf64_Shdr sh_table[], uint64_t symbol_table) { char *str_tbl; Elf64_Sym* sym_tbl; uint64_t i, symbol_count; if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "symbol_table = %d\n", symbol_table); sym_tbl = (Elf64_Sym*)read_section_(arrayc, sh_table[symbol_table]); /* Read linked string-table * Section containing the string table having names of * symbols of this section */ uint64_t str_tbl_ndx = sh_table[symbol_table].sh_link; if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "string/symbol table index = %d\n", str_tbl_ndx); str_tbl = read_section_(arrayc, sh_table[str_tbl_ndx]); symbol_count = sh_table[symbol_table].sh_size/sizeof(Elf64_Sym); int link_ = sh_table[symbol_table].sh_link; link_ = sh_table[link_].sh_link; int linkn = 0; while (link_ != 0) { link_ = sh_table[link_].sh_link; linkn++; } if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "links: %d\n", linkn); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "%d symbols\n", symbol_count); // Elf64_Word st_name; /* Symbol name (string tbl index) */ // unsigned char st_info; /* Symbol type and binding */ // unsigned char st_other; /* Symbol visibility */ // Elf64_Section st_shndx; /* Section index */ // Elf64_Addr st_value; /* Symbol value */ // Elf64_Xword st_size; /* Symbol size */ for(int i=0; i< symbol_count; i++) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "index: %d\t", i); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "size: %10d \t", sym_tbl[i].st_size); // /* Legal values for ST_BIND subfield of st_info (symbol binding). */ // // #define STB_LOCAL 0 /* Local symbol */ // #define STB_GLOBAL 1 /* Global symbol */ // #define STB_WEAK 2 /* Weak symbol */ // #define STB_NUM 3 /* Number of defined types. */ // #define STB_LOOS 10 /* Start of OS-specific */ // #define STB_GNU_UNIQUE 10 /* Unique symbol. */ // #define STB_HIOS 12 /* End of OS-specific */ // #define STB_LOPROC 13 /* Start of processor-specific */ // #define STB_HIPROC 15 /* End of processor-specific */ if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "binding: "); switch (ELF64_ST_BIND(sym_tbl[i].st_info)) { case STB_LOCAL: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "LOCAL ( Local symbol ) "); break; case STB_GLOBAL: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "GLOBAL ( Global symbol ) "); break; case STB_WEAK: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "WEAK ( Weak symbol ) "); break; default: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "UNKNOWN (%d) ", ELF64_ST_BIND(sym_tbl[i].st_info)); break; } // /* Legal values for ST_TYPE subfield of st_info (symbol type). */ // // #define STT_NOTYPE 0 /* Symbol type is unspecified */ // #define STT_OBJECT 1 /* Symbol is a data object */ // #define STT_FUNC 2 /* Symbol is a code object */ // #define STT_SECTION 3 /* Symbol associated with a section */ // #define STT_FILE 4 /* Symbol's name is file name */ // #define STT_COMMON 5 /* Symbol is a common data object */ // #define STT_TLS 6 /* Symbol is thread-local data object*/ // #define STT_NUM 7 /* Number of defined types. */ // #define STT_LOOS 10 /* Start of OS-specific */ // #define STT_GNU_IFUNC 10 /* Symbol is indirect code object */ // #define STT_HIOS 12 /* End of OS-specific */ // #define STT_LOPROC 13 /* Start of processor-specific */ // #define STT_HIPROC 15 /* End of processor-specific */ // /* Symbol visibility specification encoded in the st_other field. */ // #define STV_DEFAULT 0 /* Default symbol visibility rules */ // #define STV_INTERNAL 1 /* Processor specific hidden class */ // #define STV_HIDDEN 2 /* Sym unavailable in other modules */ // #define STV_PROTECTED 3 /* Not preemptible, not exported */ if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "visibility: "); switch (ELF64_ST_VISIBILITY(sym_tbl[i].st_other)) { case STV_DEFAULT: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "default (Default symbol visibility rules) "); break; case STV_INTERNAL: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "internal (Processor specific hidden class) "); break; case STV_HIDDEN: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "hidden (Symbol unavailable in other modules) "); break; case STV_PROTECTED: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "protected (Not preemptible, not exported) "); break; } char * address = sym_tbl[i].st_value+library[library_index].mappingb; if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "address: %014p\t", address); if ( address > library[library_index].mappingb && address < library[library_index].mappingb_end ) test(address); else if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "value: %015p\t", sym_tbl[i].st_value); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "type: "); switch (ELF64_ST_TYPE(sym_tbl[i].st_info)) { case STT_NOTYPE: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "NOTYPE (Symbol type is unspecified) "); break; case STT_OBJECT: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "OBJECT (Symbol is a data object) "); break; case STT_FUNC: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "FUNCTION (Symbol is a code object) "); break; case STT_SECTION: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "SECTION (Symbol associated with a section) "); break; case STT_FILE: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "FILE (Symbol's name is file name) "); break; case STT_COMMON: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "COMMON (Symbol is a common data object) "); break; case STT_TLS: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "TLS (Symbol is thread-local data object) "); break; default: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "UNKNOWN (%d) ", ELF64_ST_TYPE(sym_tbl[i].st_info)); break; } char * name; if (test_string(str_tbl + sym_tbl[i].st_name) == 0) name = str_tbl + sym_tbl[i].st_name; else name = "INVALID"; if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "name: %s\n", demangle_it(name)); if (bytecmpq(GQ, "no") == 0) nl(); } } void print_elf_symbol_table(char * arrayc, Elf64_Ehdr * eh, Elf64_Shdr sh_table[], uint64_t symbol_table) { int level = 0; switch(sh_table[symbol_table].sh_type) { case SHT_NULL: if (level == 3) read_symbol(arrayc, sh_table, symbol_table); break; case SHT_PROGBITS: if (level == 3) read_symbol(arrayc, sh_table, symbol_table); break; case SHT_SYMTAB: read_symbol(arrayc, sh_table, symbol_table); break; case SHT_STRTAB: if (level == 3) read_symbol(arrayc, sh_table, symbol_table); break; case SHT_RELA: if (level == 3) read_symbol(arrayc, sh_table, symbol_table); break; case SHT_HASH: if (level == 3) read_symbol(arrayc, sh_table, symbol_table); break; case SHT_DYNAMIC: if (level == 3) read_symbol(arrayc, sh_table, symbol_table); break; case SHT_NOTE: if (level == 3) read_symbol(arrayc, sh_table, symbol_table); break; case SHT_NOBITS: if (level == 3) read_symbol(arrayc, sh_table, symbol_table); break; case SHT_REL: if (level == 3) read_symbol(arrayc, sh_table, symbol_table); break; case SHT_SHLIB: if (level == 3) read_symbol(arrayc, sh_table, symbol_table); break; case SHT_DYNSYM: read_symbol(arrayc, sh_table, symbol_table); break; case SHT_INIT_ARRAY: if (level == 3) read_symbol(arrayc, sh_table, symbol_table); break; case SHT_FINI_ARRAY: if (level == 3) read_symbol(arrayc, sh_table, symbol_table); break; case SHT_PREINIT_ARRAY: if (level == 3) read_symbol(arrayc, sh_table, symbol_table); break; case SHT_GROUP: if (level == 3) read_symbol(arrayc, sh_table, symbol_table); break; case SHT_SYMTAB_SHNDX: if (level == 3) read_symbol(arrayc, sh_table, symbol_table); break; case SHT_NUM: if (level == 3) read_symbol(arrayc, sh_table, symbol_table); break; case SHT_LOOS: if (level == 3) read_symbol(arrayc, sh_table, symbol_table); break; case SHT_GNU_ATTRIBUTES: if (level == 3) read_symbol(arrayc, sh_table, symbol_table); break; case SHT_GNU_HASH: if (level == 3) read_symbol(arrayc, sh_table, symbol_table); break; case SHT_GNU_LIBLIST: if (level == 3) read_symbol(arrayc, sh_table, symbol_table); break; case SHT_CHECKSUM: if (level == 3) read_symbol(arrayc, sh_table, symbol_table); break; case SHT_LOSUNW: if (level == 3) read_symbol(arrayc, sh_table, symbol_table); break; case SHT_SUNW_COMDAT: if (level == 3) read_symbol(arrayc, sh_table, symbol_table); break; case SHT_SUNW_syminfo: if (level == 3) read_symbol(arrayc, sh_table, symbol_table); break; case SHT_GNU_verdef: if (level == 3) read_symbol(arrayc, sh_table, symbol_table); break; case SHT_GNU_verneed: if (level == 3) read_symbol(arrayc, sh_table, symbol_table); break; case SHT_GNU_versym: if (level == 3) read_symbol(arrayc, sh_table, symbol_table); break; case SHT_LOPROC: if (level == 3) read_symbol(arrayc, sh_table, symbol_table); break; case SHT_HIPROC: if (level == 3) read_symbol(arrayc, sh_table, symbol_table); break; case SHT_LOUSER: if (level == 3) read_symbol(arrayc, sh_table, symbol_table); break; case SHT_HIUSER: if (level == 3) read_symbol(arrayc, sh_table, symbol_table); break; default: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "UNKNOWN "); break; } } void print_symbols(char * arrayd, Elf64_Ehdr * eh, Elf64_Shdr sh_table[]) { // /* Legal values for sh_type (section type). */ // // #define SHT_NULL 0 /* Section header table entry unused */ // #define SHT_PROGBITS 1 /* Program data */ // #define SHT_SYMTAB 2 /* Symbol table */ // #define SHT_STRTAB 3 /* String table */ // #define SHT_RELA 4 /* Relocation entries with addends */ // #define SHT_HASH 5 /* Symbol hash table */ // #define SHT_DYNAMIC 6 /* Dynamic linking information */ // #define SHT_NOTE 7 /* Notes */ // #define SHT_NOBITS 8 /* Program space with no data (bss) */ // #define SHT_REL 9 /* Relocation entries, no addends */ // #define SHT_SHLIB 10 /* Reserved */ // #define SHT_DYNSYM 11 /* Dynamic linker symbol table */ // #define SHT_INIT_ARRAY 14 /* Array of constructors */ // #define SHT_FINI_ARRAY 15 /* Array of destructors */ // #define SHT_PREINIT_ARRAY 16 /* Array of pre-constructors */ // #define SHT_GROUP 17 /* Section group */ // #define SHT_SYMTAB_SHNDX 18 /* Extended section indeces */ // #define SHT_NUM 19 /* Number of defined types. */ // #define SHT_LOOS 0x60000000 /* Start OS-specific. */ // #define SHT_GNU_ATTRIBUTES 0x6ffffff5 /* Object attributes. */ // #define SHT_GNU_HASH 0x6ffffff6 /* GNU-style hash table. */ // #define SHT_GNU_LIBLIST 0x6ffffff7 /* Prelink library list */ // #define SHT_CHECKSUM 0x6ffffff8 /* Checksum for DSO content. */ // #define SHT_LOSUNW 0x6ffffffa /* Sun-specific low bound. */ // #define SHT_SUNW_move 0x6ffffffa // #define SHT_SUNW_COMDAT 0x6ffffffb // #define SHT_SUNW_syminfo 0x6ffffffc // #define SHT_GNU_verdef 0x6ffffffd /* Version definition section. */ // #define SHT_GNU_verneed 0x6ffffffe /* Version needs section. */ // #define SHT_GNU_versym 0x6fffffff /* Version symbol table. */ // #define SHT_HISUNW 0x6fffffff /* Sun-specific high bound. */ // #define SHT_HIOS 0x6fffffff /* End OS-specific type */ // #define SHT_LOPROC 0x70000000 /* Start of processor-specific */ // #define SHT_HIPROC 0x7fffffff /* End of processor-specific */ // #define SHT_LOUSER 0x80000000 /* Start of application-specific */ // #define SHT_HIUSER 0x8fffffff /* End of application-specific */ int ii = 0; for(int i=0; i<eh->e_shnum; i++) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "\n["); switch(sh_table[i].sh_type) { case SHT_NULL: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "NULL (Section header table entry unused) "); break; case SHT_PROGBITS: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "PROGBITS (Program data) "); break; case SHT_SYMTAB: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "SYMTAB (Symbol table) "); break; case SHT_STRTAB: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "STRTAB (String table) "); break; case SHT_RELA: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "RELA (Relocation entries with addends) "); break; case SHT_HASH: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "HASH (Symbol hash table) "); break; case SHT_DYNAMIC: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DYNAMIC (Dynamic linking information) "); break; case SHT_NOTE: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "NOTE (Notes) "); break; case SHT_NOBITS: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "NOBITS (Program space with no data (bss)) "); break; case SHT_REL: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "REL (Relocation entries, no addends) "); break; case SHT_SHLIB: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "SHLIB (Reserved) "); break; case SHT_DYNSYM: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DYNSYM (Dynamic linker symbol table) "); break; case SHT_INIT_ARRAY: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "INIT_ARRAY (Array of constructors) "); break; case SHT_FINI_ARRAY: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "FINI_ARRAY (Array of destructors) "); break; case SHT_PREINIT_ARRAY: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "PREINIT_ARRAY (Array of pre-constructors) "); break; case SHT_GROUP: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "GROUP (Section group) "); break; case SHT_SYMTAB_SHNDX: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "SYMTAB_SHNDX (Extended section indeces) "); break; case SHT_NUM: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "NUM (Number of defined types) "); break; case SHT_LOOS: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "LOOS (Start OS-specific) "); break; case SHT_GNU_ATTRIBUTES: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "GNU_ATTRIBUTES (Object attributes) "); break; case SHT_GNU_HASH: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "GNU_HASH (GNU-style hash table) "); break; case SHT_GNU_LIBLIST: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "GNU_LIBLIST (Prelink library list) "); break; case SHT_CHECKSUM: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "CHECKSUM (Checksum for DSO content) "); break; case SHT_LOSUNW: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "LOSUNW or SUNW_move "); break; case SHT_SUNW_COMDAT: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "SUNW_COMDAT "); break; case SHT_SUNW_syminfo: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "SUNW_syminfo "); break; case SHT_GNU_verdef: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "GNU_verdef (Version definition section) "); break; case SHT_GNU_verneed: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "GNU_verneed (Version needs section) "); break; case SHT_GNU_versym: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "GNU_versym (Version symbol table) or HISUNW (Sun-specific high bound) or HIOS (End OS-specific type) "); break; case SHT_LOPROC: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "LOPROC (Start of processor-specific) "); break; case SHT_HIPROC: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "HIPROC (End of processor-specific) "); break; case SHT_LOUSER: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "LOUSER (Start of application-specific) "); break; case SHT_HIUSER: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "HIUSER (End of application-specific) "); break; default: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "UNKNOWN "); } if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Section %d, Index %d]\n", ii, i); print_elf_symbol_table(arrayd, eh, sh_table, i); ii++; } } char * find_needed(const char * lib, const char * symbol); int JUMP = 0; int a = 0; char * lib_origin = NULL; const char * interp = "./supplied/lib/ld-2.26.so"; const char * libc = "./supplied/lib/libc-2.26.so"; int first = 0; char * current_symbol; char * symbol_lookup(char * arrayc, Elf64_Shdr sh_table[], uint64_t symbol_table, int index, int mode, const char * am_i_quiet, const char * is_jump) { char * k = library[library_index].last_lib; if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "%s:%d:%s: finding index %d\n", __FILE__, __LINE__, __func__, index); if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "looking up index %d of table %d\n", index, symbol_table); Elf64_Sym* sym_tbl = (Elf64_Sym*)read_section_(arrayc, sh_table[symbol_table]); uint64_t str_tbl_ndx = sh_table[symbol_table].sh_link; char *str_tbl = read_section_(arrayc, sh_table[str_tbl_ndx]); uint64_t symbol_count = (sh_table[symbol_table].sh_size/sizeof(Elf64_Sym)); current_symbol = demangle_it(str_tbl + sym_tbl[index].st_name); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "searching for %s in %s\n", demangle_it(str_tbl + sym_tbl[index].st_name), library[library_index].last_lib); if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "%s:%d:%s: requested symbol name for index %d of %s is %s\n", __FILE__, __LINE__, __func__, index, library[library_index].last_lib, demangle_it(str_tbl + sym_tbl[index].st_name)); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "%s:%d:%s: readelf = %d, JUMP = %d, a = %d, is_jump = %s\n", __FILE__, __LINE__, __func__, readelf, JUMP, a, is_jump); if (readelf == 0 && bytecmpq(is_jump, "yes") == 0 && a == 0) { lib_origin = library[library_index].last_lib; if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "lib_origin = %s\n", lib_origin); char * sym = NULL; first = 0; if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "calling find_needed\n"); bt(); sym = find_needed(lib_origin, demangle_it(str_tbl + sym_tbl[index].st_name)); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "called find_needed\n"); bt(); if (sym == NULL && bytecmpq(lib_origin, "/lib/ld-linux-x86-64.so.2") == -1) { // if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "%s not found, searching interpreter %s\n", demangle_it(str_tbl + sym_tbl[index].st_name), interp); // sym = find_needed(interp, demangle_it(str_tbl + sym_tbl[index].st_name)); if (sym == NULL) { lib_origin = k; if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "symbol has not been found in %s, searching dependancies of %s\n", interp, lib_origin); if (bytecmpq(sleep_, "YES") == 0) sleep(12); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "calling find_needed\n"); bt(); sym = find_needed(lib_origin, demangle_it(str_tbl + sym_tbl[index].st_name)); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "called find_needed\n"); bt(); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "%s still not found, trying self (%s)\n", demangle_it(str_tbl + sym_tbl[index].st_name), lib_origin); a = 1; self = 1; first = 1; if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "calling find_needed\n"); bt(); sym = lookup_symbol_by_name_(lib_origin, demangle_it(str_tbl + sym_tbl[index].st_name)); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "called find_needed\n"); bt(); first = 0; self = 0; a = 0; if (sym == NULL) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "%s still not found, aborting\n", demangle_it(str_tbl + sym_tbl[index].st_name)); if (!(bytecmpq(library[library_index].last_lib, interp) == 0 || bytecmpq(library[library_index].last_lib, libc) == 0)) abort_(); } } } if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "found %014p for symbol %s in %s\n", sym, demangle_it(str_tbl + sym_tbl[index].st_name), library[library_index].last_lib); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "%s:%d:%s: returning %014p\n", __FILE__, __LINE__, __func__, sym); if (bytecmpq(sleep_r, "yes") == 0) sleep(15); if (sym != NULL && mode == 1) return sym; } if ( mode == 1) return sym_tbl[index].st_value; else if (mode == 2) return sym_tbl[index].st_size; } char * symbol_lookup_name(char * arrayc, Elf64_Shdr sh_table[], uint64_t symbol_table, char * name_); char * symbol_lookup_plt(char * arrayc, Elf64_Shdr sh_table[], uint64_t symbol_table, int index, int mode, const char * am_i_quiet) { char *str_tbl; Elf64_Sym* sym_tbl; uint64_t i, symbol_count; sym_tbl = (Elf64_Sym*)read_section_(arrayc, sh_table[symbol_table]); uint64_t str_tbl_ndx = sh_table[symbol_table].sh_link; str_tbl = read_section_(arrayc, sh_table[str_tbl_ndx]); symbol_count = (sh_table[symbol_table].sh_size/sizeof(Elf64_Sym)); char * name_ = demangle_it(str_tbl + sym_tbl[index].st_name); // read_symbol(arrayc, sh_table, symbol_table); printf("looking up index %d value %014p\n", index, sym_tbl[index].st_value); for(int i=0; i< symbol_count; i++) { char * name = demangle_it(str_tbl + sym_tbl[i].st_name); if (bytecmpq(name,name_) == 0) { current_symbol = name_; char * address = sym_tbl[i].st_value; if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "%s:%d:%s: requested symbol name \"%s\" found in table %d at address %014p is \"%s\"\n", __FILE__, __LINE__, __func__, name_, symbol_table, address, name); if (sym_tbl[i].st_value == 0) return name_; else if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "\n%s:%d:%s: requested symbol name \"%s\" in PLT table %d does not have a valid JUMP relocation value\n\n", __FILE__, __LINE__, __func__, name_, symbol_table); } } if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "\n%s:%d:%s: requested symbol name \"%s\" could not be found in PLT table %d\n\n", __FILE__, __LINE__, __func__, name_, symbol_table); return "NOT_PLT"; } char * symbol_lookupb(char * arrayc, Elf64_Shdr sh_table[], uint64_t symbol_table, int index, int mode, const char * am_i_quiet, const char * is_jump) { char * k = library[library_index].last_lib; if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "%s:%d:%s: finding index %d\n", __FILE__, __LINE__, __func__, index); if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "looking up index %d of table %d\n", index, symbol_table); Elf64_Sym* sym_tbl = (Elf64_Sym*)read_section_(arrayc, sh_table[symbol_table]); uint64_t str_tbl_ndx = sh_table[symbol_table].sh_link; char *str_tbl = read_section_(arrayc, sh_table[str_tbl_ndx]); uint64_t symbol_count = (sh_table[symbol_table].sh_size/sizeof(Elf64_Sym)); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "searching for %s in %s\n", demangle_it(str_tbl + sym_tbl[index].st_name), library[library_index].last_lib); if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "%s:%d:%s: requested symbol name for index %d of %s is %s\n", __FILE__, __LINE__, __func__, index, library[library_index].last_lib, demangle_it(str_tbl + sym_tbl[index].st_name)); if (bytecmpq(is_jump, "yes") == 0 && a == 0) { lib_origin = library[library_index].last_lib; if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "lib_origin = %s\n", lib_origin); char * sym; sym = find_needed(lib_origin, demangle_it(str_tbl + sym_tbl[index].st_name)); if (sym == NULL && bytecmpq(lib_origin, interp) == -1) { if (bytecmpq(library[library_index].last_lib, interp) == 0) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "%s not found, searching libc %s\n", demangle_it(str_tbl + sym_tbl[index].st_name), libc); sym = lookup_symbol_by_name_(libc, demangle_it(str_tbl + sym_tbl[index].st_name)); lib_origin = k; } else if (bytecmpq(library[library_index].last_lib, libc) == 0) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "%s not found, searching gnu interpreter %s as required by %s\n", demangle_it(str_tbl + sym_tbl[index].st_name), interp, libc); sym = lookup_symbol_by_name_(interp, demangle_it(str_tbl + sym_tbl[index].st_name)); lib_origin = k; } if (sym == NULL) { lib_origin = k; if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "%s still not found, trying self (%s)\n", demangle_it(str_tbl + sym_tbl[index].st_name), lib_origin); self = 1; a = 1; sym = lookup_symbol_by_name_(lib_origin, demangle_it(str_tbl + sym_tbl[index].st_name)); self = 0; a = 0; if (sym == NULL) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "%s still not found, aborting\n", demangle_it(str_tbl + sym_tbl[index].st_name)); if (bytecmpq(library[library_index].last_lib, interp) == 0 || bytecmpq(library[library_index].last_lib, libc) == 0) if (bytecmpq(sleep_, "YES") == 0) sleep(4); else abort_(); } } } if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "found %014p for symbol %s in %s\n", sym, demangle_it(str_tbl + sym_tbl[index].st_name), library[library_index].last_lib); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "%s:%d:%s: returning %014p\n", __FILE__, __LINE__, __func__, sym); if (bytecmpq(library[library_index].last_lib, interp) == 0 || bytecmpq(library[library_index].last_lib, libc) == 0) if (bytecmpq(sleep_, "YES") == 0) sleep(15); if (sym != NULL && mode == 1) return sym; } if ( mode == 1) return sym_tbl[index].st_value; else if (mode == 2) return sym_tbl[index].st_size; } char * symbol_lookup_name(char * arrayc, Elf64_Shdr sh_table[], uint64_t symbol_table, char * name_) { char *str_tbl; Elf64_Sym* sym_tbl; uint64_t i, symbol_count; sym_tbl = (Elf64_Sym*)read_section_(arrayc, sh_table[symbol_table]); uint64_t str_tbl_ndx = sh_table[symbol_table].sh_link; str_tbl = read_section_(arrayc, sh_table[str_tbl_ndx]); symbol_count = (sh_table[symbol_table].sh_size/sizeof(Elf64_Sym)); for(int i=0; i< symbol_count; i++) { char * name = demangle_it(str_tbl + sym_tbl[i].st_name); if (bytecmpq(name,name_) == 0) { current_symbol = name; char * address = sym_tbl[i].st_value+library[library_index].mappingb; if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "%s:%d:%s requested symbol name \"%s\" found in table %d at address %014p is \"%s\"\n", __FILE__, __LINE__, __func__, name_, symbol_table, address, name); fprintf(stderr, "lib = %s\n", library[library_index].last_lib); if (sym_tbl[i].st_value != 0) return analyse_address(address, name); else fprintf(stderr, "sym_tbl[%d].st_value is zero\n", i); switch (ELF64_ST_BIND(sym_tbl[i].st_info)) { case STB_WEAK: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "however symbol is defined as WEAK\n"); return "WEAK ZERO"; break; } } } if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "\n%s:%d:%s: requested symbol name \"%s\" could not be found in table %d\n\n", __FILE__, __LINE__, __func__, name_, symbol_table); bt(); return NULL; } char * print_elf_symbol_table_lookup(char * arrayc, Elf64_Ehdr * eh, Elf64_Shdr sh_table[], uint64_t symbol_table, int index, int mode, const char * is_jump) { char * name_; switch(sh_table[symbol_table].sh_type) { case SHT_DYNSYM: name_ = symbol_lookup(arrayc, sh_table, symbol_table, index, mode, relocation_quiet, is_jump); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "%s:%d:%s: returning %014p\n", __FILE__, __LINE__, __func__, name_); if (name_ != NULL) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "%s:%d:%s: returning VALUED %014p\n", __FILE__, __LINE__, __func__, name_); return name_; } else { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "%s:%d:%s: returning NULLED %014p\n", __FILE__, __LINE__, __func__, name_); // abort_(); return NULL; } break; case SHT_SYMTAB: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "%s:%d:%s: JUMP = %d, is_jump = %s\n", __FILE__, __LINE__, __func__, JUMP, is_jump); name_ = symbol_lookup(arrayc, sh_table, symbol_table, index, mode, relocation_quiet, is_jump); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "%s:%d:%s: returning %014p\n", __FILE__, __LINE__, __func__, name_); if (name_ != NULL) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "%s:%d:%s: returning VALUED %014p\n", __FILE__, __LINE__, __func__, name_); return name_; } else { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "%s:%d:%s: returning NULLED %014p\n", __FILE__, __LINE__, __func__, name_); // abort_(); return NULL; } break; default: return NULL; break; } } char * print_elf_symbol_table_lookup_plt(char * arrayc, Elf64_Ehdr * eh, Elf64_Shdr sh_table[], uint64_t symbol_table, int index, int mode) { char * name_; switch(sh_table[symbol_table].sh_type) { case SHT_DYNSYM: name_ = symbol_lookup_plt(arrayc, sh_table, symbol_table, index, mode, relocation_quiet); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "%s:%d:%s: returning %s\n", __FILE__, __LINE__, __func__, name_); return name_; break; default: return NULL; break; } } char * print_elf_symbol_table_lookup_name(char * arrayc, Elf64_Ehdr * eh, Elf64_Shdr sh_table[], uint64_t symbol_table, char * index) { char * name_; switch(sh_table[symbol_table].sh_type) { case SHT_DYNSYM: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "searching for symbol %s in SHT_DYNSYM\n", index); name_ = symbol_lookup_name(arrayc, sh_table, symbol_table, index); if (name_ != NULL) { return name_; } else { return NULL; } break; case SHT_SYMTAB: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "searching for symbol %s in SHT_SYMTAB\n", index); name_ = symbol_lookup_name(arrayc, sh_table, symbol_table, index); if (name_ != NULL) { return name_; } else { return NULL; } break; default: return NULL; break; } } char * print_symbols_lookup(char * arrayd, Elf64_Ehdr * eh, Elf64_Shdr sh_table[], int index, int mode, const char * is_jump) { char * sym; for(int i=0; i<eh->e_shnum; i++) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "%s:%d:%s: looking for index %d\n", __FILE__, __LINE__, __func__, i); sym = print_elf_symbol_table_lookup(arrayd, eh, sh_table, i, index, mode, is_jump); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "%s:%d:%s: returning %014p\n", __FILE__, __LINE__, __func__, sym); if ( sym != NULL ) { return sym; } } if (sym == NULL) return NULL; } char * print_symbols_lookup_plt(char * arrayd, Elf64_Ehdr * eh, Elf64_Shdr sh_table[], int index, int mode) { char * sym; for(int i=0; i<eh->e_shnum; i++) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "%s:%d:%s: looking for index %d\n", __FILE__, __LINE__, __func__, i); sym = print_elf_symbol_table_lookup_plt(arrayd, eh, sh_table, i, index, mode); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "%s:%d:%s: returning %s\n", __FILE__, __LINE__, __func__, sym); if ( sym != NULL ) { return sym; } } if (sym == NULL) return NULL; } char * print_symbols_lookup_name(char * arrayd, Elf64_Ehdr * eh, Elf64_Shdr sh_table[], char * index) { char * value; for(int i=0; i<eh->e_shnum; i++) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "searching for symbol %s in index %d\n", index, i); value = print_elf_symbol_table_lookup_name(arrayd, eh, sh_table, i, index); if ( value != NULL ) { return value; } } if (value == NULL) return NULL; } void * lookup_symbol_by_name(const char * arrayb, Elf64_Ehdr * eh, char * name) { read_section_header_table_(arrayb, eh, &library[library_index]._elf_symbol_table); char * symbol = print_symbols_lookup_name(arrayb, eh, library[library_index]._elf_symbol_table, name); return symbol; } void * lookup_symbol_by_name_(const char * lib, const char * name) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "attempting to look up symbol %s in lib %s\n", name, lib); init_(lib); bt(); const char * arrayb = library[library_index].array; Elf64_Ehdr * eh = (Elf64_Ehdr *) arrayb; Elf64_Shdr *_elf_symbol_tableb; if(!strncmp((char*)eh->e_ident, "\177ELF", 4)) { if ( read_section_header_table_(arrayb, eh, &_elf_symbol_tableb) == 0) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "init done, looking up symbol %s in lib %s\n", name, lib); char * symbol = print_symbols_lookup_name(arrayb, eh, _elf_symbol_tableb, name); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "%s:%d:%s: returning %014p\n", __FILE__, __LINE__, __func__, symbol); return symbol; } } else abort_(); } void * lookup_symbol_by_index(const char * arrayb, Elf64_Ehdr * eh, int symbol_index, int mode, const char * am_i_quiet, const char * is_jump) { if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "attempting to look up symbol, index = %d\n", symbol_index); read_section_header_table_(arrayb, eh, &library[library_index]._elf_symbol_table); char * symbol = print_symbols_lookup(arrayb, eh, library[library_index]._elf_symbol_table, symbol_index, mode, is_jump); bt(); if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "%s:%d:%s: symbol = %d (%014p)\n", __FILE__, __LINE__, __func__, symbol, symbol); return symbol; } char * lookup_symbol_by_index_plt(const char * arrayb, Elf64_Ehdr * eh, int symbol_index, int mode, const char * am_i_quiet) { if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "%s:%d:%s: attempting to look up symbol, index = %d\n", __FILE__, __LINE__, __func__, symbol_index); read_section_header_table_(arrayb, eh, &library[library_index]._elf_symbol_table); char * symbol = print_symbols_lookup_plt(arrayb, eh, library[library_index]._elf_symbol_table, symbol_index, mode); fprintf(stderr, "%s:%d:%s: returning %s\n", __FILE__, __LINE__, __func__, symbol); return symbol; } Elf64_Word get_dynamic_entry(Elf64_Dyn *dynamic, int field) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "called get_dynamic_entry\n"); // Name Value d_un Executable Shared Object // DT_NULL 0 ignored mandatory mandatory // DT_NEEDED 1 d_val optional optional // DT_PLTRELSZ 2 d_val optional optional // DT_PLTGOT 3 d_ptr optional optional // DT_HASH 4 d_ptr mandatory mandatory // DT_STRTAB 5 d_ptr mandatory mandatory // DT_SYMTAB 6 d_ptr mandatory mandatory // DT_RELA 7 d_ptr mandatory optional // DT_RELASZ 8 d_val mandatory optional // DT_RELAENT 9 d_val mandatory optional // DT_STRSZ 10 d_val mandatory mandatory // DT_SYMENT 11 d_val mandatory mandatory // DT_INIT 12 d_ptr optional optional // DT_FINI 13 d_ptr optional optional // DT_SONAME 14 d_val ignored optional // DT_RPATH 15 d_val optional ignored // DT_SYMBOLIC 16 ignored ignored optional // DT_REL 17 d_ptr mandatory optional // DT_RELSZ 18 d_val mandatory optional // DT_RELENT 19 d_val mandatory optional // DT_PLTREL 20 d_val optional optional // DT_DEBUG 21 d_ptr optional ignored // DT_TEXTREL 22 ignored optional optional // DT_JMPREL 23 d_ptr optional optional // DT_BIND_NOW 24 ignored optional optional // DT_LOPROC 0x70000000 unspecified unspecified unspecified // DT_HIPROC 0x7fffffff unspecified unspecified unspecified // // DT_NULL An entry with a DT_NULL tag marks the end of the _DYNAMIC array. // DT_NEEDED This element holds the string table offset of a null-terminated string, giving // the name of a needed library. The offset is an index into the table recorded // in the DT_STRTAB entry. See "Shared Object Dependencies'' for more // information about these names. The dynamic array may contain multiple // entries with this type. These entries' relative order is significant, though // their relation to entries of other types is not. // // DT_PLTRELSZ This element holds the total size, in bytes, of the relocation entries // associated with the procedure linkage table. If an entry of type DT_JMPREL // is present, a DT_PLTRELSZ must accompany it. // // DT_PLTGOT This element holds an address associated with the procedure linkage table // and/or the global offset table. // // DT_HASH This element holds the address of the symbol hash table, described in "Hash // Table". This hash table refers to the symbol table referenced by the // DT_SYMTAB element. // // DT_STRTAB This element holds the address of the string table, described in Chapter 1. // Symbol names, library names, and other strings reside in this table. // // DT_SYMTAB This element holds the address of the symbol table, described in // Chapter 1, with Elf32_Sym entries for the 32-bit class of files. // // DT_RELA This element holds the address of a relocation table, described in // Chapter 1. Entries in the table have explicit addends, such as Elf32_Rela // for the 32-bit file class. An object file may have multiple relocation // sections. When building the relocation table for an executable or shared // object file, the link editor catenates those sections to form a single table. // Although the sections remain independent in the object file, the dynamic // linker sees a single table. When the dynamic linker creates the process // image for an executable file or adds a shared object to the process image, // it reads the relocation table and performs the associated actions. If this // element is present, the dynamic structure must also have DT_RELASZ and // DT_RELAENT elements. When relocation is "mandatory" for a file, either // DT_RELA or DT_REL may occur (both are permitted but not required). // // DT_RELASZ This element holds the total size, in bytes, of the DT_RELA relocation table. // // DT_RELAENT This element holds the size, in bytes, of the DT_RELA relocation entry. // // DT_STRSZ This element holds the size, in bytes, of the string table. // // DT_SYMENT This element holds the size, in bytes, of a symbol table entry. // // DT_INIT This element holds the address of the initialization function, discussed in // "Initialization and Termination Functions" below. // // DT_FINI This element holds the address of the termination function, discussed in // "Initialization and Termination Functions" below. // // DT_SONAME This element holds the string table offset of a null-terminated string, giving // the name of the shared object. The offset is an index into the table recorded // in the DT_STRTAB entry. See "Shared Object Dependencies" below for // more information about these names. // // DT_RPATH This element holds the string table offset of a null-terminated search library // search path string, discussed in "Shared Object Dependencies". The offset // is an index into the table recorded in the DT_STRTAB entry. // // DT_SYMBOLIC This element's presence in a shared object library alters the dynamic linker's // symbol resolution algorithm for references within the library. Instead of // starting a symbol search with the executable file, the dynamic linker starts // from the shared object itself. If the shared object fails to supply the // referenced symbol, the dynamic linker then searches the executable file and // other shared objects as usual. // // DT_REL This element is similar to DT_RELA, except its table has implicit addends, // such as Elf32_Rel for the 32-bit file class. If this element is present, the // dynamic structure must also have DT_RELSZ and DT_RELENT elements. // // DT_RELSZ This element holds the total size, in bytes, of the DT_REL relocation table. // // DT_RELENT This element holds the size, in bytes, of the DT_REL relocation entry. // // DT_PLTREL This member specifies the type of relocation entry to which the procedure // linkage table refers. The d_val member holds DT_REL or DT_RELA , as // appropriate. All relocations in a procedure linkage table must use the same // relocation. // // DT_DEBUG This member is used for debugging. Its contents are not specified in this // document. // // DT_TEXTREL This member's absence signifies that no relocation entry should cause a // modification to a non-writable segment, as specified by the segment // permissions in the program header table. If this member is present, one or // more relocation entries might request modifications to a non-writable // segment, and the dynamic linker can prepare accordingly. // // DT_JMPREL If present, this entries d_ptr member holds the address of relocation // entries associated solely with the procedure linkage table. Separating these // relocation entries lets the dynamic linker ignore them during process // initialization, if lazy binding is enabled. If this entry is present, the related // entries of types DT_PLTRELSZ and DT_PLTREL must also be present. // // DT_BIND_NOW If present in a shared object or executable, this entry instructs the dynamic // linker to process all relocations for the object containing this entry before // transferring control to the program. The presence of this entry takes // precedence over a directive to use lazy binding for this object when // specified through the environment or via dlopen( BA_LIB). // // DT_LOPROC through DT_HIPROC // Values in this inclusive range are reserved for processor-specific semantics. // If meanings are specified, the processor supplement explains them. // // Except for the DT_NULL element at the end of the library[library_index].array, and the relative order of DT_NEEDED // elements, entries may appear in any order. Tag values not appearing in the table are reserved. for (; dynamic->d_tag != DT_NULL; dynamic++) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "testing if "); /* Legal values for d_tag (dynamic entry type). */ // #define DT_NULL 0 /* Marks end of dynamic section */ // #define DT_NEEDED 1 /* Name of needed library */ // #define DT_PLTRELSZ 2 /* Size in bytes of PLT relocs */ // #define DT_PLTGOT 3 /* Processor defined value */ // #define DT_HASH 4 /* Address of symbol hash table */ // #define DT_STRTAB 5 /* Address of string table */ // #define DT_SYMTAB 6 /* Address of symbol table */ // #define DT_RELA 7 /* Address of Rela relocs */ // #define DT_RELASZ 8 /* Total size of Rela relocs */ // #define DT_RELAENT 9 /* Size of one Rela reloc */ // #define DT_STRSZ 10 /* Size of string table */ // #define DT_SYMENT 11 /* Size of one symbol table entry */ // #define DT_INIT 12 /* Address of init function */ // #define DT_FINI 13 /* Address of termination function */ // #define DT_SONAME 14 /* Name of shared object */ // #define DT_RPATH 15 /* Library search path (deprecated) */ // #define DT_SYMBOLIC 16 /* Start symbol search here */ // #define DT_REL 17 /* Address of Rel relocs */ // #define DT_RELSZ 18 /* Total size of Rel relocs */ // #define DT_RELENT 19 /* Size of one Rel reloc */ // #define DT_PLTREL 20 /* Type of reloc in PLT */ // #define DT_DEBUG 21 /* For debugging; unspecified */ // #define DT_TEXTREL 22 /* Reloc might modify .text */ // #define DT_JMPREL 23 /* Address of PLT relocs */ // #define DT_BIND_NOW 24 /* Process relocations of object */ // #define DT_INIT_ARRAY 25 /* Array with addresses of init fct */ // #define DT_FINI_ARRAY 26 /* Array with addresses of fini fct */ // #define DT_INIT_ARRAYSZ 27 /* Size in bytes of DT_INIT_ARRAY */ // #define DT_FINI_ARRAYSZ 28 /* Size in bytes of DT_FINI_ARRAY */ // #define DT_RUNPATH 29 /* Library search path */ // #define DT_FLAGS 30 /* Flags for the object being loaded */ // #define DT_ENCODING 32 /* Start of encoded range */ // #define DT_PREINIT_ARRAY 32 /* Array with addresses of preinit fct*/ // #define DT_PREINIT_ARRAYSZ 33 /* size in bytes of DT_PREINIT_ARRAY */ // #define DT_NUM 34 /* Number used */ // #define DT_LOOS 0x6000000d /* Start of OS-specific */ // #define DT_HIOS 0x6ffff000 /* End of OS-specific */ // #define DT_LOPROC 0x70000000 /* Start of processor-specific */ // #define DT_HIPROC 0x7fffffff /* End of processor-specific */ // #define DT_PROCNUM DT_MIPS_NUM /* Most used by any processor */ switch (dynamic->d_tag) { case DT_NULL: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_NULL"); break; case DT_NEEDED: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_NEEDED"); break; case DT_PLTRELSZ: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_PLTRELSZ"); break; case DT_PLTGOT: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_PLTGOT"); break; case DT_HASH: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_HASH"); break; case DT_STRTAB: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_STRTAB"); break; case DT_SYMTAB: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_SYMTAB"); break; case DT_RELA: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_RELA"); break; case DT_RELASZ: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_RELASZ"); break; case DT_RELAENT: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_RELAENT"); break; case DT_STRSZ: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_STRSZ"); break; case DT_SYMENT: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_SYMENT"); break; case DT_INIT: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_INIT"); break; case DT_FINI: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_FINI"); break; case DT_SONAME: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_SONAME"); break; case DT_RPATH: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_RPATH"); break; case DT_SYMBOLIC: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_SYMBOLIC"); break; case DT_REL: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_REL"); break; case DT_RELSZ: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_RELSZ"); break; case DT_RELENT: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_RELENT"); break; case DT_PLTREL: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_PLTREL"); break; case DT_DEBUG: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_DEBUG"); break; case DT_TEXTREL: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_TEXTREL"); break; case DT_JMPREL: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_JMPREL"); break; case DT_BIND_NOW: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_BIND_NOW"); break; case DT_INIT_ARRAY: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_INIT_ARRAY"); break; case DT_FINI_ARRAY: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_FINI_ARRAY"); break; case DT_INIT_ARRAYSZ: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_INIT_ARRAYSZ"); break; case DT_FINI_ARRAYSZ: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_FINI_ARRAYSZ"); break; case DT_RUNPATH: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_RUNPATH"); break; case DT_FLAGS: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_FLAGS"); break; case DT_ENCODING: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_ENCODING (or DT_PREINIT_ARRAY)"); break; case DT_PREINIT_ARRAYSZ: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_PREINIT_ARRAYSZ"); break; case DT_NUM: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_NUM"); break; case DT_LOOS: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_LOOS"); break; case DT_HIOS: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_HIOS"); break; case DT_LOPROC: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_LOPROC"); break; case DT_HIPROC: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_HIPROC (or DT_FILTER)"); break; case DT_PROCNUM: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_PROCNUM"); break; case DT_VERSYM: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_VERSYM"); break; case DT_RELACOUNT: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_RELACOUNT"); break; case DT_RELCOUNT: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_RELCOUNT"); break; case DT_FLAGS_1: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_FLAGS_1"); break; case DT_VERDEF: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_VERDEF"); break; case DT_VERDEFNUM: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_VERDEFNUM"); break; case DT_VERNEED: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_VERNEED"); break; case DT_VERNEEDNUM: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_VERNEEDNUM"); break; case DT_AUXILIARY: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_AUXILIARY"); break; default: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "%d", dynamic->d_tag); break; } if (bytecmpq(GQ, "no") == 0) fprintf(stderr, " == "); switch (field) { case DT_NULL: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_NULL"); break; case DT_NEEDED: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_NEEDED"); break; case DT_PLTRELSZ: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_PLTRELSZ"); break; case DT_PLTGOT: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_PLTGOT"); break; case DT_HASH: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_HASH"); break; case DT_STRTAB: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_STRTAB"); break; case DT_SYMTAB: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_SYMTAB"); break; case DT_RELA: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_RELA"); break; case DT_RELASZ: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_RELASZ"); break; case DT_RELAENT: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_RELAENT"); break; case DT_STRSZ: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_STRSZ"); break; case DT_SYMENT: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_SYMENT"); break; case DT_INIT: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_INIT"); break; case DT_FINI: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_FINI"); break; case DT_SONAME: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_SONAME"); break; case DT_RPATH: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_RPATH"); break; case DT_SYMBOLIC: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_SYMBOLIC"); break; case DT_REL: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_REL"); break; case DT_RELSZ: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_RELSZ"); break; case DT_RELENT: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_RELENT"); break; case DT_PLTREL: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_PLTREL"); break; case DT_DEBUG: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_DEBUG"); break; case DT_TEXTREL: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_TEXTREL"); break; case DT_JMPREL: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_JMPREL"); break; case DT_BIND_NOW: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_BIND_NOW"); break; case DT_INIT_ARRAY: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_INIT_ARRAY"); break; case DT_FINI_ARRAY: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_FINI_ARRAY"); break; case DT_INIT_ARRAYSZ: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_INIT_ARRAYSZ"); break; case DT_FINI_ARRAYSZ: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_FINI_ARRAYSZ"); break; case DT_RUNPATH: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_RUNPATH"); break; case DT_FLAGS: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_FLAGS"); break; case DT_ENCODING: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_ENCODING (or DT_PREINIT_ARRAY)"); break; case DT_PREINIT_ARRAYSZ: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_PREINIT_ARRAYSZ"); break; case DT_NUM: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_NUM"); break; case DT_LOOS: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_LOOS"); break; case DT_HIOS: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_HIOS"); break; case DT_LOPROC: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_LOPROC"); break; case DT_HIPROC: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_HIPROC (or DT_FILTER)"); break; case DT_PROCNUM: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_PROCNUM"); break; case DT_VERSYM: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_VERSYM"); break; case DT_RELACOUNT: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_RELACOUNT"); break; case DT_RELCOUNT: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_RELCOUNT"); break; case DT_FLAGS_1: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_FLAGS_1"); break; case DT_VERDEF: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_VERDEF"); break; case DT_VERDEFNUM: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_VERDEFNUM"); break; case DT_VERNEED: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_VERNEED"); break; case DT_VERNEEDNUM: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_VERNEEDNUM"); break; case DT_AUXILIARY: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "DT_AUXILIARY"); break; default: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "%d (unknown)", field); break; } if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "\n"); if (dynamic->d_tag == field) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "%s:%d:%s: returning %014p\n", __FILE__, __LINE__, __func__, dynamic->d_un.d_val); return dynamic->d_un.d_val; } } if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "%s:%d:%s: returning 0\n", __FILE__, __LINE__, __func__); return 0; } Elf64_Word get_dynamic_entryq(Elf64_Dyn *dynamic, int field) { for (; dynamic->d_tag != DT_NULL; dynamic++) if (dynamic->d_tag == field) return dynamic->d_un.d_val; return 0; } int if_valid(const char * file) { fprintf(stderr, " if(!access(%s, %d)) return 0;\n", file, F_OK); if(!access(file, F_OK)) return 0; else return -1; } void * dlopen_(const char * cc); void * dlsym_(const char * cc1, const char * cc2); Elf64_Word get_needed(const char * lib, const char * parent); int dl = 0; extern void bt(void); void info(void) { read_section_header_table_(library[library_index].array, library[library_index]._elf_header, &library[library_index]._elf_symbol_table); read_symbol(library[library_index].array, library[library_index]._elf_symbol_table, get_section(library[library_index].array, library[library_index]._elf_header, library[library_index]._elf_symbol_table, ".dynsym")); read_symbol(library[library_index].array, library[library_index]._elf_symbol_table, get_section(library[library_index].array, library[library_index]._elf_header, library[library_index]._elf_symbol_table, ".symtab")); read_symbol(library[library_index].array, library[library_index]._elf_symbol_table, get_section(library[library_index].array, library[library_index]._elf_header, library[library_index]._elf_symbol_table, ".plt.got")); read_symbol( library[library_index].array, library[library_index]._elf_symbol_table, get_section( library[library_index].array, library[library_index]._elf_header, library[library_index]._elf_symbol_table, ".plt" ) ); print_section_headers_(library[library_index].array, library[library_index]._elf_header, library[library_index]._elf_symbol_table); Elf64_Addr * GOT = library [ library_index ] . _elf_symbol_table [ get_section ( library[library_index].array, library[library_index]._elf_header, library[library_index]._elf_symbol_table, ".got" ) ] .sh_addr+library[library_index].mappingb; fprintf(stderr, "\n\naddress of GOT = %014p\n", GOT); for (int i = 0; i<=10; i++) { // if (i == 3) GOT[i] = &bt; // puts is located at GOT[3] fprintf(stderr, "address of GOT[%02d] = %014p, value of GOT[%02d] = %014p\n", i, &GOT[i], i, GOT[i]); } Elf64_Addr * PLT = library [ library_index ] . _elf_symbol_table [ get_section ( library[library_index].array, library[library_index]._elf_header, library[library_index]._elf_symbol_table, ".plt" ) ] .sh_addr+library[library_index].mappingb; fprintf(stderr, "\n\naddress of PLT = %014p\n", PLT); int align = library[library_index]._elf_symbol_table[get_section(library[library_index].array,library[library_index]._elf_header,library[library_index]._elf_symbol_table,".plt")].sh_addralign/8; for (int i = 0; i<=10; i++) { int ii = i*align; // if (i == 1 || i == 2) PLT[ii] = &bt; fprintf(stderr, "address of PLT[%02d] = %014p, value of PLT[%02d] = %014p\n", i, &PLT[ii], i, PLT[ii]); } } char * find_needed(const char * lib, const char * symbol) { char * sym = NULL; if (bytecmpq(ldd_quiet, "no") == 1) fprintf(stderr, "\n\naquiring symbol \"%s\"\n", symbol); if (bytecmpq(ldd_quiet, "no") == 0) fprintf(stderr, "current index %d holds \"%s\"\nsearching indexes for \"%s\" incase it has already been loaded\n", library_index, library[library_index].last_lib, lib); if (bytecmpq(sleep_r, "yes") == 0) sleep(12); library_index = searchq(lib); int local_index = library_index; int local_indexb = library_index; if ( if_valid(lib) == -1) { if (bytecmpq(ldd_quiet, "no") == 0) fprintf(stderr, "\"%s\" not found\n", lib); errno = 0; abort_(); return "-1"; } if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "%s:%d:%s: looking in %s for \"%s\"\n", __FILE__, __LINE__, __func__, lib, symbol); if (bytecmpq(sleep_r, "yes") == 0) sleep(12); if (bytecmpq(lib_origin, lib) == -1) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "\n\n\n\n\nlooking in %s for \"%s\" (origin: %s)\n\n\n\n\n\n", lib, symbol, lib_origin); if (bytecmpq(sleep_, "YES") == 0) sleep(12); sym = lookup_symbol_by_name_(lib, symbol); } else if ((bytecmpq(lib_origin, lib) == 0 && first == 1) || dl == 1) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "\n\n\n\n\nlooking in origin: %s for \"%s\" (origin: %s)\n\n\n\n\n\n", lib, symbol, lib_origin); if (bytecmpq(sleep_, "YES") == 0) sleep(12); sym = lookup_symbol_by_name_(lib, symbol); } else sym = NULL; library_index = searchq(lib); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "checking symbol \"%s\" has been found in %s\n", symbol, lib); if(sym == NULL) { if ((bytecmpq(lib_origin, lib) == 0 && first == 0) || dl == 0) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "skipping %s on first search for PLT (@plt) relocations, searching dependancies of %s\n", lib, lib); if (bytecmpq(sleep_r, "yes") == 0) sleep(12); } else if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "symbol has not been found in %s, searching dependancies of %s\n", lib, lib); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "\n\nneeded for %s: %d\n", library[library_index].last_lib, library[library_index].NEEDED_COUNT); if (library[library_index].NEEDED_COUNT != 0) for (int i = 0; i<=library[library_index].NEEDED_COUNT-1; i++) fprintf(stderr, "library[%d].NEEDED[%d] = %s\n", library_index, i, library[library_index].NEEDED[i]); if (bytecmpq(sleep_r, "yes") == 0) sleep(15); for (int i = 0; i<=library[library_index].NEEDED_COUNT-1; i++) { if (bytecmpq(lib, libc) == 0) { library[library_index].NEEDED[i] = interp; if (bytecmpq(ldd_quiet, "no") == 0) fprintf(stderr, "gnu libc detected, redirecting needed %s to %s\n", "ld-linux-x86-64.so.2", library[library_index].NEEDED[i]); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "looking in %s for \"%s\"\n", library[library_index].NEEDED[i], symbol); } if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "looking in %s for \"%s\"\n", library[library_index].NEEDED[i], symbol); sym = find_needed(library[library_index].NEEDED[i], symbol); library_index = searchq(lib); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "checking symbol \"%s\" has been found in %s of %s\n", symbol, library[library_index].NEEDED[i], lib); if(sym == NULL) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "symbol \"%s\" has not been found in %s of %s\n", symbol, library[library_index].NEEDED[i], lib); return NULL; } else { if (dl == 1) { info(); dl = 0; } return sym; } } if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "error, %s has no dependancies, parent dependancy is %s\n", lib, library[library_index].parent); return NULL; // has no dependancies } else { if (dl == 1) { info(); dl = 0; } return sym; } } Elf64_Word get_needed(const char * lib, const char * parent) { if (bytecmpq(ldd_quiet, "no") == 0) fprintf(stderr, "\n\naquiring \"%s\"\n", lib); if (library[library_index].struct_needed_init != "initialized") init_needed_struct(); if (bytecmpq(ldd_quiet, "no") == 0) fprintf(stderr, "current index %d holds \"%s\"\nsearching indexes for \"%s\" incase it has already been loaded\n", library_index, library[library_index].last_lib, lib); library_index = search_neededq(lib); int local_index = library_index; int local_indexb = library_index; library[library_index].last_lib = lib; library[library_index].current_lib = lib; if (bytecmpq(ldd_quiet, "no") == 0) fprintf(stderr, "checking if %s index %d is locked\n", library[library_index].last_lib, library_index); if (library[library_index].init_lock == 1) { if (bytecmpq(ldd_quiet, "no") == 0) fprintf(stderr, "get_needed: LOCKED\n"); } else { if (bytecmpq(ldd_quiet, "no") == 0) fprintf(stderr, "get_needed: UNLOCKED\n"); } if ( if_valid(lib) == -1) { if (bytecmpq(ldd_quiet, "no") == 0) fprintf(stderr, "\"%s\" not found\n", lib); errno = 0; abort_(); return "-1"; } if (bytecmpq(ldd_quiet, "no") == 0) fprintf(stderr, "init\n"); if (library[library_index].array != NULL) { if (bytecmpq(ldd_quiet, "no") == 0) fprintf(stderr, "%s has a non null array\n", library[library_index].last_lib); if (bytecmpq(ldd_quiet, "no") == 0) fprintf(stderr, "index %d get_needed: LOCKING\n", library_index); library[library_index].init_lock = 1; if (library[library_index].init_lock == 1) { if (bytecmpq(ldd_quiet, "no") == 0) fprintf(stderr, "status: LOCKED\n"); } else { if (bytecmpq(ldd_quiet, "no") == 0) fprintf(stderr, "status: UNLOCKED\n"); } } else { if (bytecmpq(ldd_quiet, "no") == 0) fprintf(stderr, "%s has a null array\n", library[library_index].last_lib); if (bytecmpq(ldd_quiet, "no") == 0) fprintf(stderr, "index %d get_needed: UNLOCKING\n", library_index); library[library_index].init_lock = 0; if (library[library_index].init_lock == 1) { if (bytecmpq(ldd_quiet, "no") == 0) fprintf(stderr, "status: LOCKED\n"); } else { if (bytecmpq(ldd_quiet, "no") == 0) fprintf(stderr, "status: UNLOCKED\n"); } } if (bytecmpq(ldd_quiet, "no") == 0) fprintf(stderr, "init done\n"); if (bytecmpq(ldd_quiet, "no") == 0) fprintf(stderr, "current index %d holds \"%s\"\nsearching indexes for \"%s\" incase it has already been loaded\n", library_index, library[library_index].last_lib, lib); library_index = search_neededq(lib); local_index = library_index; library[library_index].last_lib = lib; library[library_index].current_lib = lib; Elf64_Dyn *dynamic = library[library_index].dynamic; Elf64_Dyn *dynamicb = library[library_index].dynamic; const char * arrayb = library[library_index].array; print_needed(lib, parent,depth_default, LDD); fprintf(stderr, "got needed\n"); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "\n\nneeded for %s: %d\n", library[library_index].last_lib, library[library_index].NEEDED_COUNT); if (library[library_index].NEEDED_COUNT != 0) for (int i = 0; i<=library[library_index].NEEDED_COUNT-1; i++) fprintf(stderr, "library[%d].NEEDED[%d] = %s\n", library_index, i, library[library_index].NEEDED[i]); if (bytecmpq(sleep_r, "yes") == 0) sleep(15); for (int i = 0; i<=library[library_index].NEEDED_COUNT-1; i++) get_needed(library[library_index].NEEDED[i], lib); library_index = local_indexb; if (bytecmpq(ldd_quiet, "no") == 0) fprintf(stderr, "index %d get_needed: UNLOCKING\n", library_index); library[library_index].init_lock = 0; if (library[library_index].init_lock == 1) { if (bytecmpq(ldd_quiet, "no") == 0) fprintf(stderr, "status: LOCKED\n"); } else { if (bytecmpq(ldd_quiet, "no") == 0) fprintf(stderr, "status: UNLOCKED\n"); } // dlopen_(lib); // dlsym_(lib, ""); } #define symbol_mode_S 1 #define symbol_mode_Z 2 void r_init() { library[library_index]._R_X86_64_NONE = 0; library[library_index]._R_X86_64_64 = 0; library[library_index]._R_X86_64_PC32 = 0; library[library_index]._R_X86_64_GOT32 = 0; library[library_index]._R_X86_64_PLT32 = 0; library[library_index]._R_X86_64_COPY = 0; library[library_index]._R_X86_64_GLOB_DAT = 0; library[library_index]._R_X86_64_JUMP_SLOT = 0; library[library_index]._R_X86_64_RELATIVE = 0; library[library_index]._R_X86_64_GOTPCREL = 0; library[library_index]._R_X86_64_32 = 0; library[library_index]._R_X86_64_32S = 0; library[library_index]._R_X86_64_16 = 0; library[library_index]._R_X86_64_PC16 = 0; library[library_index]._R_X86_64_8 = 0; library[library_index]._R_X86_64_PC8 = 0; library[library_index]._R_X86_64_DTPMOD64 = 0; library[library_index]._R_X86_64_DTPOFF64 = 0; library[library_index]._R_X86_64_TPOFF64 = 0; library[library_index]._R_X86_64_TLSGD = 0; library[library_index]._R_X86_64_TLSLD = 0; library[library_index]._R_X86_64_DTPOFF32 = 0; library[library_index]._R_X86_64_GOTTPOFF = 0; library[library_index]._R_X86_64_TPOFF32 = 0; library[library_index]._R_X86_64_PC64 = 0; library[library_index]._R_X86_64_GOTOFF64 = 0; library[library_index]._R_X86_64_GOTPC32 = 0; library[library_index]._R_X86_64_GOT64 = 0; library[library_index]._R_X86_64_GOTPCREL64 = 0; library[library_index]._R_X86_64_GOTPC64 = 0; library[library_index]._Deprecated1 = 0; library[library_index]._R_X86_64_PLTOFF64 = 0; library[library_index]._R_X86_64_SIZE32 = 0; library[library_index]._R_X86_64_SIZE64 = 0; library[library_index]._R_X86_64_GOTPC32_TLSDESC = 0; library[library_index]._R_X86_64_TLSDESC_CALL = 0; library[library_index]._R_X86_64_TLSDESC = 0; library[library_index]._R_X86_64_IRELATIVE = 0; library[library_index]._R_X86_64_RELATIVE64 = 0; library[library_index]._Deprecated2 = 0; library[library_index]._Deprecated3 = 0; library[library_index]._R_X86_64_GOTPLT64 = 0; library[library_index]._R_X86_64_GOTPCRELX = 0; library[library_index]._R_X86_64_REX_GOTPCRELX = 0; library[library_index]._R_X86_64_NUM = 0; library[library_index]._R_X86_64_UNKNOWN = 0; } int r(Elf64_Rela *relocs, size_t relocs_size, const char * am_i_quiet) { /* Relocation Relocation Types Relocation entries describe how to alter the following instruction and data fields (bit numbers appear in the lower box corners). word32 31 0 word32 This specifies a 32-bit field occupying 4 bytes with arbitrary byte alignment. These values use the same byte order as other word values in the Intel architecture. 3 2 1 0 0x01020304 01 02 03 04 31 0 Calculations below assume the actions are transforming a relocatable file into either an executable or a shared object file. Conceptually, the link editor merges one or more relocatable files to form the output. It first decides how to combine and locate the input files, then updates the symbol values, and finally performs the relocation. Relocations applied to executable or shared object files are similar and accomplish the same result. Descriptions below use the following notation. A This means the addend used to compute the value of the relocatable field. B This means the base address at which a shared object has been loaded into memory during execution. Generally, a shared object file is built with a 0 base virtual address, but the execution address will be different. G This means the offset into the global offset table at which the address of the relocation entry's symbol will reside during execution. See "Global Offset Table'' below for more information. GOT This means the address of the global offset table. See "Global Offset Table'' below for more information. L This means the place (section offset or address) of the procedure linkage table entry for a symbol. A procedure linkage table entry redirects a function call to the proper destination. The link editor builds the initial procedure linkage table, and the dynamic linker modifies the entries during execution. See "Procedure Linkage Table'' below for more information. P This means the place (section offset or address) of the storage unit being relocated (computed using r_offset ). S This means the value of the symbol whose index resides in the relocation entry. A relocation entry's r_offset value designates the offset or virtual address of the first byte of the affected storage unit. The relocation type specifies which bits to change and how to calculate their values. The Intel architecture uses only Elf32_Rel relocation entries, the field to be relocated holds the addend. In all cases, the addend and the computed result use the same byte order. Name Value Field Calculation R_386_NONE 0 none none R_386_32 1 word32 S + A R_386_PC32 2 word32 S + A - P R_386_GOT32 3 word32 G + A R_386_PLT32 4 word32 L + A - P R_386_COPY 5 none none R_386_GLOB_DAT 6 word32 S R_386_JMP_SLOT 7 word32 S R_386_RELATIVE 8 word32 B + A R_386_GOTOFF 9 word32 S + A - GOT R_386_GOTPC 10 word32 GOT + A - P Some relocation types have semantics beyond simple calculation. R_386_GLOB_DAT This relocation type is used to set a global offset table entry to the address of the specified symbol. The special relocation type allows one to determine the correspondence between symbols and global offset table entries. R_386_JMP_SLOT The link editor creates this relocation type for dynamic linking. Its offset member gives the location of a procedure linkage table entry. The dynamic linker modifies the procedure linkage table entry to transfer control to the designated symbol's address [see "Procedure Linkage Table'' below]. R_386_RELATIVE The link editor creates this relocation type for dynamic linking. Its offset member gives a location within a shared object that contains a value representing a relative address. The dynamic linker computes the corresponding virtual address by adding the virtual address at which the shared object was loaded to the relative address. Relocation entries for this type must specify 0 for the symbol table index. R_386_GOTOFF This relocation type computes the difference between a symbol's value and the address of the global offset table. It additionally instructs the link editor to build the global offset table. R_386_GOTPC This relocation type resembles R_386_PC32, except it uses the address of the global offset table in its calculation. The symbol referenced in this relocation normally is _GLOBAL_OFFSET_TABLE_, which additionally instructs the link editor to build the global offset table. */ /* Relocation Relocation Types Relocation entries describe how to alter the following instruction and data fields (bit numbers appear in the lower box corners). word8 7 0 word16 15 0 word32 31 0 word64 63 0 word8 This specifies a 8-bit field occupying 1 byte. word16 This specifies a 16-bit field occupying 2 bytes with arbitrary byte alignment. These values use the same byte order as other word values in the AMD64 architecture. word32 This specifies a 32-bit field occupying 4 bytes with arbitrary byte alignment. These values use the same byte order as other word values in the AMD64 architecture. word64 This specifies a 64-bit field occupying 8 bytes with arbitrary byte alignment. These values use the same byte order as other word values in the AMD64 architecture. wordclass This specifies word64 for LP64 and specifies word32 for ILP32. Calculations below assume the actions are transforming a relocatable file into either an executable or a shared object file. Conceptually, the link editor merges one or more relocatable files to form the output. It first decides how to combine and locate the input files, then updates the symbol values, and finally performs the relocation. Relocations applied to executable or shared object files are similar and accomplish the same result. Descriptions below use the following notation. A Represents the addend used to compute the value of the relocatable field. B Represents the base address at which a shared object has been loaded into memory during execution. Generally, a shared object is built with a 0 base virtual address, but the execution address will be different. G Represents the offset into the global offset table at which the relocation entry’s symbol will reside during execution. GOT Represents the address of the global offset table. L Represents the place (section offset or address) of the Procedure Linkage Table entry for a symbol. P Represents the place (section offset or address) of the storage unit being relocated (computed using r_offset). S Represents the value of the symbol whose index resides in the relocation entry. Z Represents the size of the symbol whose index resides in the relocation entry. A relocation entry's r_offset value designates the offset or virtual address of the first byte of the affected storage unit. The relocation type specifies which bits to change and how to calculate their values. The Intel architecture uses only Elf32_Rel relocation entries, the field to be relocated holds the addend. In all cases, the addend and the computed result use the same byte order. The AMD64 LP64 ABI architecture uses only Elf64_Rela relocation entries with explicit addends. The r_addend member serves as the relocation addend. The AMD64 ILP32 ABI architecture uses only Elf32_Rela relocation entries in relocatable files. Executable files or shared objects may use either Elf32_Rela or Elf32_Rel relocation entries. Name Value Field Calculation R_X86_64_NONE 0 none none R_X86_64_64 1 word64 S + A R_X86_64_PC32 2 word32 S + A - P R_X86_64_GOT32 3 word32 G + A R_X86_64_PLT32 4 word32 L + A - P R_X86_64_COPY 5 none none R_X86_64_GLOB_DAT 6 wordclass S R_X86_64_JUMP_SLOT 7 wordclass S R_X86_64_RELATIVE 8 wordclass B + A R_X86_64_GOTPCREL 9 word32 G + GOT + A - P R_X86_64_32 10 word32 S + A R_X86_64_32S 11 word32 S + A R_X86_64_16 12 word16 S + A R_X86_64_PC16 13 word16 S + A - P R_X86_64_8 14 word8 S + A R_X86_64_PC8 15 word8 S + A - P R_X86_64_DTPMOD64 16 word64 none R_X86_64_DTPOFF64 17 word64 none R_X86_64_TPOFF64 18 word64 none R_X86_64_TLSGD 19 word32 none R_X86_64_TLSLD 20 word32 none R_X86_64_DTPOFF32 21 word32 none R_X86_64_GOTTPOFF 22 word32 none R_X86_64_TPOFF32 23 word32 none † R_X86_64_PC64 24 word64 S + A - P † R_X86_64_GOTOFF64 25 word64 S + A - GOT R_X86_64_GOTPC32 26 word32 GOT + A - P R_X86_64_GOT64 27 word64 G + A R_X86_64_GOTPCREL64 28 word64 G + GOT - P + A R_X86_64_GOTPC64 29 word64 GOT - P + A Deprecated 30 none none R_X86_64_PLTOFF64 31 word64 L - GOT + A R_X86_64_SIZE32 32 word32 Z + A † R_X86_64_SIZE64 33 word64 Z + A R_X86_64_GOTPC32_TLSDESC 34 word32 none R_X86_64_TLSDESC_CALL 35 none none R_X86_64_TLSDESC 36 word64×2 none R_X86_64_IRELATIVE 37 wordclass indirect (B + A) †† R_X86_64_RELATIVE64 38 word64 B + A Deprecated 39 none none Deprecated 40 none none R_X86_64_GOTPCRELX 41 word32 G + GOT + A - P R_X86_64_REX_GOTPCRELX 42 word32 G + GOT + A - P † This relocation is used only for LP64. †† This relocation only appears in ILP32 executable files or shared objects. Some relocation types have semantics beyond simple calculation. R_386_GLOB_DAT This relocation type is used to set a global offset table entry to the address of the specified symbol. The special relocation type allows one to determine the correspondence between symbols and global offset table entries. R_386_JMP_SLOT The link editor creates this relocation type for dynamic linking. Its offset member gives the location of a procedure linkage table entry. The dynamic linker modifies the procedure linkage table entry to transfer control to the designated symbol's address [see "Procedure Linkage Table'' below]. R_386_RELATIVE The link editor creates this relocation type for dynamic linking. Its offset member gives a location within a shared object that contains a value representing a relative address. The dynamic linker computes the corresponding virtual address by adding the virtual address at which the shared object was loaded to the relative address. Relocation entries for this type must specify 0 for the symbol table index. R_386_GOTOFF This relocation type computes the difference between a symbol's value and the address of the global offset table. It additionally instructs the link editor to build the global offset table. R_386_GOTPC This relocation type resembles R_386_PC32, except it uses the address of the global offset table in its calculation. The symbol referenced in this relocation normally is _GLOBAL_OFFSET_TABLE_, which additionally instructs the link editor to build the global offset table. */ if (relocs != library[library_index].mappingb && relocs_size != 0) { for (int i = 0; i < relocs_size / sizeof(Elf64_Rela); i++) { Elf64_Rela *reloc = &relocs[i]; int reloc_type = ELF64_R_TYPE(reloc->r_info); if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "i = %d,\t\tELF64_R_TYPE(reloc->r_info)\t= ", i); switch (reloc_type) { #if defined(__x86_64__) case R_X86_64_NONE: { if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "\n\n\nR_X86_64_NONE calculation: none\n"); library[library_index]._R_X86_64_NONE++; break; } case R_X86_64_64: { if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "\n\n\nR_X86_64_64 calculation: S + A (symbol value + r_addend)\n"); if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "reloc->r_offset = %014p\n", reloc->r_offset); *((char**)((char*)library[library_index].mappingb + reloc->r_offset)) = lookup_symbol_by_index(library[library_index].array, library[library_index]._elf_header, ELF64_R_SYM(reloc->r_info), symbol_mode_S, symbol_quiet, "no") + reloc->r_addend+library[library_index].mappingb; if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "((char*)library[library_index].mappingb + reloc->r_offset) = %014p\n", ((char*)library[library_index].mappingb + reloc->r_offset)); library[library_index]._R_X86_64_64++; break; } case R_X86_64_PC32: { if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "\n\n\nR_X86_64_PC32 calculation: S + A - P (symbol value + r_addend - (P: This means the place (section offset or address) of the storage unit being relocated (computed using r_offset ).)\n"); if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "reloc->r_offset = %014p\n", reloc->r_offset); *((char**)((char*)library[library_index].mappingb + reloc->r_offset)) = lookup_symbol_by_index(library[library_index].array, library[library_index]._elf_header, ELF64_R_SYM(reloc->r_info), symbol_mode_S, symbol_quiet, "no") + reloc->r_addend+library[library_index].mappingb; if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "((char*)library[library_index].mappingb + reloc->r_offset) = %014p\n", ((char*)library[library_index].mappingb + reloc->r_offset)); library[library_index]._R_X86_64_PC32++; break; } case R_X86_64_GOT32: { if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "\n\n\nR_X86_64_GOT32 calculation: G + A (address of global offset table + r_addend)\n"); Elf64_Addr * GOT = lookup_symbol_by_name(library[library_index].array, library[library_index]._elf_header, "_GLOBAL_OFFSET_TABLE_"); library[library_index]._R_X86_64_GOT32++; break; } case R_X86_64_PLT32: { if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "\n\n\nR_X86_64_PLT32 calculation: L + A - P ((L: This means the place (section offset or address) of the procedure linkage table entry for a symbol) + r_addend - (P: This means the place (section offset or address) of the storage unit being relocated (computed using r_offset ).) \n"); library[library_index]._R_X86_64_PLT32++; break; } case R_X86_64_COPY: { if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "\n\n\nR_X86_64_COPY calculation: none\n"); library[library_index]._R_X86_64_COPY++; break; } case R_X86_64_GLOB_DAT: { if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "\n\n\nR_X86_64_GLOB_DAT calculation: S (symbol value)\n"); fprintf(stderr, "%d\n", __LINE__); if (bytecmpq(sleep_, "YES") == 0) sleep(5); fprintf(stderr, "%d\n", __LINE__); if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "reloc->r_offset = %014p+%014p=%014p\n", library[library_index].mappingb, reloc->r_offset, library[library_index].mappingb+reloc->r_offset); fprintf(stderr, "%d\n", __LINE__); char * symbol = NULL; fprintf(stderr, "%d\n", __LINE__); if (bytecmpq(sleep_, "YES") == 0) sleep(5); fprintf(stderr, "%d\n", __LINE__); fprintf(stderr, "retrieving sample symbol\n"); if (self == 1 || readelf == 1) { fprintf(stderr, "skipping\n"); symbol = "NOT_PLT"; } else symbol = lookup_symbol_by_index_plt(library[library_index].array, library[library_index]._elf_header, ELF64_R_SYM(reloc->r_info), symbol_mode_S, symbol_quiet); fprintf(stderr, "%d\n", __LINE__); fprintf(stderr, "sample symbol retrieved\n"); if (bytecmpq(sleep_, "YES") == 0) sleep(5); fprintf(stderr, "%d\n", __LINE__); if (bytecmpq(sleep_, "YES") == 0) sleep(15); fprintf(stderr, "%d\n", __LINE__); char * symbol_; if (bytecmpq(symbol, "NOT_PLT") == -1) { printf("\n\n\n\n\n\n\n\n%s\n\n\n\n\n\n\n", symbol); int a_; a?(a_ = 1):(a_ = 0); a = 0; printf("\n\n\n\n\n\n\n\n%d\n\n\n\n\n\n\n", a); symbol_ = lookup_symbol_by_index(library[library_index].array, library[library_index]._elf_header, ELF64_R_SYM(reloc->r_info), symbol_mode_S, symbol_quiet, "yes"); fprintf(stderr, "TESTING IF SYMBOL IS STRING\n"); if (test_string(symbol_) == 0) { fprintf(stderr, "SYMBOL IS STRING\nSYMBOL IS %s\nTESTING IF %s IS \"WEAK ZERO\"\n", symbol_, symbol_); if (bytecmp(symbol_, "WEAK ZERO") == 0) { // symbol_ = 0x7FFFFFFFFFFFFF; symbol_ = 0x0; } else fprintf(stderr, "SYMBOL IS NOT WEAK ZERO\n", symbol_); } else fprintf(stderr, "SYMBOL IS NOT STRING\n"); a = a_; printf("\n\n\n\n\n\n\n\n%d\n\n\n\n\n\n\n", a); library[library_index]._R_X86_64_JUMP_SLOT++; printf("\n\n\n\n\n\n\n\n%014p\n\n\n\n\n\n\n", symbol_); char * current = strdup(current_symbol); fprintf(stderr, "current symbol = %s\n", current); if (search_resolved(current) == 0) { fprintf(stderr, "symbol \"%s\" is already resolved\n", current); } else { fprintf(stderr, "symbol \"%s\" is not resolved, attempting to resolve\n", current); library[library_index].Resolved[library[library_index].Resolve_Index[0]] = current_symbol; library[library_index].Resolve_Index[0] = library[library_index].Resolve_Index[0] + 1; library[library_index].Resolved[library[library_index].Resolve_Index[0]] = "NULL"; *((char**)((char*)library[library_index].mappingb + reloc->r_offset)) = symbol_; // *((char**)((char*)library[library_index].mappingb + reloc->r_offset)) = &bt; } *((char**)((char*)library[library_index].mappingb + reloc->r_offset)) = symbol_; // *((char**)((char*)library[library_index].mappingb + reloc->r_offset)) = &bt; } else { library[library_index]._R_X86_64_GLOB_DAT++; symbol_ = lookup_symbol_by_index(library[library_index].array, library[library_index]._elf_header, ELF64_R_SYM(reloc->r_info), symbol_mode_S, symbol_quiet, "no"); char * current = strdup(current_symbol); fprintf(stderr, "current symbol = %s\n", current); if (search_resolved(current) == 0) { fprintf(stderr, "symbol \"%s\" is already resolved\n", current); } else { fprintf(stderr, "symbol \"%s\" is not resolved, attempting to resolve\n", current); library[library_index].Resolved[library[library_index].Resolve_Index[0]] = current_symbol; library[library_index].Resolve_Index[0] = library[library_index].Resolve_Index[0] + 1; library[library_index].Resolved[library[library_index].Resolve_Index[0]] = "NULL"; *((char**)((char*)library[library_index].mappingb + reloc->r_offset)) = symbol_; // *((char**)((char*)library[library_index].mappingb + reloc->r_offset)) = &bt; } } char ** addr = reloc->r_offset + library[library_index].mappingb; test_address(addr); // %014p = %014p break; } case R_X86_64_JUMP_SLOT: { if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "\n\n\nR_X86_64_JUMP_SLOT calculation: S (symbol value)\n"); if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "library[library_index].mappingb = %014p\n", library[library_index].mappingb); if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "reloc->r_offset = %014p+%014p=%014p\n", library[library_index].mappingb, reloc->r_offset, library[library_index].mappingb+reloc->r_offset); *((char**)((char*)library[library_index].mappingb + reloc->r_offset)) = lookup_symbol_by_index(library[library_index].array, library[library_index]._elf_header, ELF64_R_SYM(reloc->r_info), symbol_mode_S, symbol_quiet, "yes"); char ** addr = reloc->r_offset + library[library_index].mappingb; test_address(addr); library[library_index]._R_X86_64_JUMP_SLOT++; break; } case R_X86_64_RELATIVE: { if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "\n\n\nR_X86_64_RELATIVE calculation: B + A (base address + r_addend)\n"); if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "library[library_index].mappingb = %014p\n", library[library_index].mappingb); if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "reloc->r_offset = %014p+%014p=%014p\n", library[library_index].mappingb, reloc->r_offset, library[library_index].mappingb+reloc->r_offset); if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "reloc->r_addend = %014p+%014p=%014p\n", library[library_index].mappingb, reloc->r_addend, ((char*)library[library_index].mappingb + reloc->r_addend) ); *((char**)((char*)library[library_index].mappingb + reloc->r_offset)) = ((char*)library[library_index].mappingb + reloc->r_addend); char ** addr = reloc->r_offset + library[library_index].mappingb; test_address(addr); if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "((char*)library[library_index].mappingb + reloc->r_offset) = %014p\n", ((char*)library[library_index].mappingb + reloc->r_offset)); library[library_index]._R_X86_64_RELATIVE++; break; } case R_X86_64_GOTPCREL: { // if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(\ stderr, "\n\naddress of GOT[0] = %014p\n", \ (\ (Elf64_Addr *) \ lookup_symbol_by_name(library[library_index].array, library[library_index]._elf_header, "_GLOBAL_OFFSET_TABLE_")\ )\ [0]\ ); if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "\n\n\nR_X86_64_GOTPCREL calculation: (_GOTPC: GOT + A - P (address of global offset table + r_addend - (P: This means the place (section offset or address) of the storage unit being relocated (computed using r_offset ).))) \n"); Elf64_Addr * GOT = lookup_symbol_by_name(library[library_index].array, library[library_index]._elf_header, "_GLOBAL_OFFSET_TABLE_"); library[library_index]._R_X86_64_GOTPCREL++; break; } case R_X86_64_32: { if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "\n\n\nR_X86_64_32 calculation: S + A (symbol value + r_addend)\n"); if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "reloc->r_offset = %014p\n", reloc->r_offset); *((char**)((char*)library[library_index].mappingb + reloc->r_offset)) = lookup_symbol_by_index(library[library_index].array, library[library_index]._elf_header, ELF64_R_SYM(reloc->r_info), symbol_mode_S, symbol_quiet, "no") + reloc->r_addend+library[library_index].mappingb; if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "((char*)library[library_index].mappingb + reloc->r_offset) = %014p\n", ((char*)library[library_index].mappingb + reloc->r_offset)); library[library_index]._R_X86_64_32++; break; } case R_X86_64_32S: { if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "\n\n\nR_X86_64_32S calculation: S + A (symbol value + r_addend)\n"); if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "reloc->r_offset = %014p\n", reloc->r_offset); *((char**)((char*)library[library_index].mappingb + reloc->r_offset)) = lookup_symbol_by_index(library[library_index].array, library[library_index]._elf_header, ELF64_R_SYM(reloc->r_info), symbol_mode_S, symbol_quiet, "no") + reloc->r_addend+library[library_index].mappingb; if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "((char*)library[library_index].mappingb + reloc->r_offset) = %014p\n", ((char*)library[library_index].mappingb + reloc->r_offset)); library[library_index]._R_X86_64_32S++; break; } case R_X86_64_16: { if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "\n\n\nR_X86_64_16 calculation: S + A (symbol value + r_addend)\n"); if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "reloc->r_offset = %014p\n", reloc->r_offset); *((char**)((char*)library[library_index].mappingb + reloc->r_offset)) = lookup_symbol_by_index(library[library_index].array, library[library_index]._elf_header, ELF64_R_SYM(reloc->r_info), symbol_mode_S, symbol_quiet, "no") + reloc->r_addend+library[library_index].mappingb; if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "((char*)library[library_index].mappingb + reloc->r_offset) = %014p\n", ((char*)library[library_index].mappingb + reloc->r_offset)); library[library_index]._R_X86_64_16++; break; } case R_X86_64_PC16: { if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "\n\n\nR_X86_64_PC16 calculation: S + A - P (symbol value + r_addend - (P: This means the place (section offset or address) of the storage unit being relocated (computed using r_offset ).))\n"); if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "reloc->r_offset = %014p\n", reloc->r_offset); *((char**)((char*)library[library_index].mappingb + reloc->r_offset)) = lookup_symbol_by_index(library[library_index].array, library[library_index]._elf_header, ELF64_R_SYM(reloc->r_info), symbol_mode_S, symbol_quiet, "no") + reloc->r_addend+library[library_index].mappingb; if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "((char*)library[library_index].mappingb + reloc->r_offset) = %014p\n", ((char*)library[library_index].mappingb + reloc->r_offset)); library[library_index]._R_X86_64_PC16++; break; } case R_X86_64_8: { if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "\n\n\nR_X86_64_8 calculation: S + A (symbol value + r_addend)\n"); if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "reloc->r_offset = %014p\n", reloc->r_offset); *((char**)((char*)library[library_index].mappingb + reloc->r_offset)) = lookup_symbol_by_index(library[library_index].array, library[library_index]._elf_header, ELF64_R_SYM(reloc->r_info), symbol_mode_S, symbol_quiet, "no") + reloc->r_addend+library[library_index].mappingb; if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "((char*)library[library_index].mappingb + reloc->r_offset) = %014p\n", ((char*)library[library_index].mappingb + reloc->r_offset)); library[library_index]._R_X86_64_8++; break; } case R_X86_64_PC8: { if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "\n\n\nR_X86_64_PC8 calculation: S + A - P (symbol value + r_addend - (P: This means the place (section offset or address) of the storage unit being relocated (computed using r_offset ).))\n"); if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "reloc->r_offset = %014p\n", reloc->r_offset); *((char**)((char*)library[library_index].mappingb + reloc->r_offset)) = lookup_symbol_by_index(library[library_index].array, library[library_index]._elf_header, ELF64_R_SYM(reloc->r_info), symbol_mode_S, symbol_quiet, "no") + reloc->r_addend+library[library_index].mappingb; if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "((char*)library[library_index].mappingb + reloc->r_offset) = %014p\n", ((char*)library[library_index].mappingb + reloc->r_offset)); library[library_index]._R_X86_64_PC8++; break; } case R_X86_64_DTPMOD64: { if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "\n\n\nR_X86_64_DTPMOD64\n"); library[library_index]._R_X86_64_DTPMOD64++; break; } case R_X86_64_DTPOFF64: { if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "\n\n\nR_X86_64_DTPOFF64\n"); library[library_index]._R_X86_64_DTPOFF64++; break; } case R_X86_64_TPOFF64: { if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "\n\n\nR_X86_64_TPOFF64\n"); library[library_index]._R_X86_64_TPOFF64++; break; } case R_X86_64_TLSGD: { if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "\n\n\nR_X86_64_TLSGD\n"); library[library_index]._R_X86_64_TLSGD++; break; } case R_X86_64_TLSLD: { if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "\n\n\nR_X86_64_TLSLD\n"); library[library_index]._R_X86_64_TLSLD++; break; } case R_X86_64_DTPOFF32: { if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "\n\n\nR_X86_64_DTPOFF32\n"); library[library_index]._R_X86_64_DTPOFF32++; break; } case R_X86_64_GOTTPOFF: { if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "\n\n\nR_X86_64_GOTTPOFF\n"); Elf64_Addr * GOT = lookup_symbol_by_name(library[library_index].array, library[library_index]._elf_header, "_GLOBAL_OFFSET_TABLE_"); library[library_index]._R_X86_64_GOTTPOFF++; break; } case R_X86_64_TPOFF32: { if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "\n\n\nR_X86_64_TPOFF32\n"); library[library_index]._R_X86_64_TPOFF32++; break; } case R_X86_64_PC64: { if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "\n\n\nR_X86_64_PC64 calculation: S + A - P (symbol value + r_addend - (P: This means the place (section offset or address) of the storage unit being relocated (computed using r_offset ).))\n"); if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "reloc->r_offset = %014p\n", reloc->r_offset); *((char**)((char*)library[library_index].mappingb + reloc->r_offset)) = lookup_symbol_by_index(library[library_index].array, library[library_index]._elf_header, ELF64_R_SYM(reloc->r_info), symbol_mode_S, symbol_quiet, "no") + reloc->r_addend+library[library_index].mappingb; if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "((char*)library[library_index].mappingb + reloc->r_offset) = %014p\n", ((char*)library[library_index].mappingb + reloc->r_offset)); library[library_index]._R_X86_64_PC64++; break; } case R_X86_64_GOTOFF64: { if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "\n\n\nR_X86_64_GOTOFF64 calculation: S + A - GOT (symbol value + r_addend - address of global offset table)\n"); if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "reloc->r_offset = %014p\n", reloc->r_offset); *((char**)((char*)library[library_index].mappingb + reloc->r_offset)) = lookup_symbol_by_index(library[library_index].array, library[library_index]._elf_header, ELF64_R_SYM(reloc->r_info), symbol_mode_S, symbol_quiet, "no") + reloc->r_addend+library[library_index].mappingb; if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "((char*)library[library_index].mappingb + reloc->r_offset) = %014p\n", ((char*)library[library_index].mappingb + reloc->r_offset)); Elf64_Addr * GOT = lookup_symbol_by_name(library[library_index].array, library[library_index]._elf_header, "_GLOBAL_OFFSET_TABLE_"); library[library_index]._R_X86_64_GOTOFF64++; break; } case R_X86_64_GOTPC32: { if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "\n\n\nR_X86_64_GOTPC32 calculation: (_GOTPC: GOT + A - P (address of global offset table + r_addend - (P: This means the place (section offset or address) of the storage unit being relocated (computed using r_offset ).)))\n"); Elf64_Addr * GOT = lookup_symbol_by_name(library[library_index].array, library[library_index]._elf_header, "_GLOBAL_OFFSET_TABLE_"); library[library_index]._R_X86_64_GOTPC32++; break; } case R_X86_64_GOT64: { if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "\n\n\nR_X86_64_GOT64 calculation: (_GOTPC: GOT + A - P (address of global offset table + r_addend - (P: This means the place (section offset or address) of the storage unit being relocated (computed using r_offset ).)))\n"); Elf64_Addr * GOT = lookup_symbol_by_name(library[library_index].array, library[library_index]._elf_header, "_GLOBAL_OFFSET_TABLE_"); library[library_index]._R_X86_64_GOT64++; break; } case R_X86_64_GOTPCREL64: { if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "\n\n\nR_X86_64_GOTPCREL64 calculation: (_GOTPC: GOT + A - P (address of global offset table + r_addend - (P: This means the place (section offset or address) of the storage unit being relocated (computed using r_offset ).)))\n"); Elf64_Addr * GOT = lookup_symbol_by_name(library[library_index].array, library[library_index]._elf_header, "_GLOBAL_OFFSET_TABLE_"); library[library_index]._R_X86_64_GOTPCREL64++; break; } case R_X86_64_GOTPC64: { if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "\n\n\nR_X86_64_GOTPC64 calculation: (_GOTPC: GOT + A - P (address of global offset table + r_addend - (P: This means the place (section offset or address) of the storage unit being relocated (computed using r_offset ).)))\n"); Elf64_Addr * GOT = lookup_symbol_by_name(library[library_index].array, library[library_index]._elf_header, "_GLOBAL_OFFSET_TABLE_"); library[library_index]._R_X86_64_GOTPC64++; break; } case R_X86_64_GOTPLT64: { if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "\n\n\nR_X86_64_GOTPLT64 calculation: (_GOTPC: GOT + A - P (address of global offset table + r_addend - (P: This means the place (section offset or address) of the storage unit being relocated (computed using r_offset ).)))\n"); Elf64_Addr * GOT = lookup_symbol_by_name(library[library_index].array, library[library_index]._elf_header, "_GLOBAL_OFFSET_TABLE_"); library[library_index]._R_X86_64_GOTPLT64++; break; } case R_X86_64_PLTOFF64: { if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "\n\n\nR_X86_64_PLTOFF64\n"); Elf64_Addr * GOT = lookup_symbol_by_name(library[library_index].array, library[library_index]._elf_header, "_GLOBAL_OFFSET_TABLE_"); library[library_index]._R_X86_64_PLTOFF64++; break; } case R_X86_64_SIZE32: { if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "\n\n\nR_X86_64_SIZE32 calculation: Z + A (symbol size + r_addend)\n"); if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "reloc->r_offset = %014p\n", reloc->r_offset); *((char**)((char*)library[library_index].mappingb + reloc->r_offset)) = lookup_symbol_by_index(library[library_index].array, library[library_index]._elf_header, ELF64_R_SYM(reloc->r_info), symbol_mode_Z, symbol_quiet, "no") + reloc->r_addend+library[library_index].mappingb; if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "((char*)library[library_index].mappingb + reloc->r_offset) = %014p\n", ((char*)library[library_index].mappingb + reloc->r_offset)); library[library_index]._R_X86_64_SIZE32++; break; } case R_X86_64_SIZE64: { if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "\n\n\nR_X86_64_SIZE64 calculation: Z + A (symbol size + r_addend)\n"); if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "reloc->r_offset = %014p\n", reloc->r_offset); *((char**)((char*)library[library_index].mappingb + reloc->r_offset)) = lookup_symbol_by_index(library[library_index].array, library[library_index]._elf_header, ELF64_R_SYM(reloc->r_info), symbol_mode_Z, symbol_quiet, "no") + reloc->r_addend+library[library_index].mappingb; if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "((char*)library[library_index].mappingb + reloc->r_offset) = %014p\n", ((char*)library[library_index].mappingb + reloc->r_offset)); library[library_index]._R_X86_64_SIZE64++; break; } case R_X86_64_GOTPC32_TLSDESC: { if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "\n\n\nR_X86_64_GOTPC32_TLSDESC calculation: (_GOTPC: GOT + A - P (address of global offset table + r_addend - (P: This means the place (section offset or address) of the storage unit being relocated (computed using r_offset ).)))\n"); Elf64_Addr * GOT = lookup_symbol_by_name(library[library_index].array, library[library_index]._elf_header, "_GLOBAL_OFFSET_TABLE_"); library[library_index]._R_X86_64_GOTPC32_TLSDESC++; break; } case R_X86_64_TLSDESC_CALL: { if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "\n\n\nR_X86_64_TLSDESC_CALL\n"); library[library_index]._R_X86_64_TLSDESC_CALL++; break; } case R_X86_64_TLSDESC: { if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "\n\n\nR_X86_64_TLSDESC\n"); library[library_index]._R_X86_64_TLSDESC++; break; } case R_X86_64_IRELATIVE: { if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "\n\n\nR_X86_64_IRELATIVE calculation: (indirect) B + A (base address + r_addend)\n"); if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "library[library_index].mappingb = %014p\n", library[library_index].mappingb); if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "reloc->r_offset = %014p+%014p=%014p\n", library[library_index].mappingb, reloc->r_offset, library[library_index].mappingb+reloc->r_offset); if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "reloc->r_addend = %014p+%014p=%014p\n", library[library_index].mappingb, reloc->r_addend, ((char*)library[library_index].mappingb + reloc->r_addend) ); Elf64_Addr value; // // changed, somehow this may cause a seg fault, dont use // value = ((char*)library[library_index].mappingb + reloc->r_addend); // value = ((Elf64_Addr (*) (void)) value) (); // *((char**)((char*)library[library_index].mappingb + reloc->r_offset)) = value; // original *((char**)((char*)library[library_index].mappingb + reloc->r_offset)) = ((char*)library[library_index].mappingb + reloc->r_addend); // char ** addr = reloc->r_offset + library[library_index].mappingb; test_address(addr); if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "((char*)library[library_index].mappingb + reloc->r_offset) = %014p\n", ((char*)library[library_index].mappingb + reloc->r_offset)); library[library_index]._R_X86_64_IRELATIVE++; break; } case R_X86_64_RELATIVE64: { if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "\n\n\nR_X86_64_RELATIVE64 calculation: B + A (base address + r_addend)\n"); if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "library[library_index].mappingb = %014p\n", library[library_index].mappingb); if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "reloc->r_offset = %014p+%014p=%014p\n", library[library_index].mappingb, reloc->r_offset, library[library_index].mappingb+reloc->r_offset); if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "reloc->r_addend = %014p+%014p=%014p\n", library[library_index].mappingb, reloc->r_addend, ((char*)library[library_index].mappingb + reloc->r_addend) ); *((char**)((char*)library[library_index].mappingb + reloc->r_offset)) = ((char*)library[library_index].mappingb + reloc->r_addend); char ** addr = reloc->r_offset + library[library_index].mappingb; test_address(addr); if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "((char*)library[library_index].mappingb + reloc->r_offset) = %014p\n", ((char*)library[library_index].mappingb + reloc->r_offset)); library[library_index]._R_X86_64_RELATIVE64++; break; } case R_X86_64_GOTPCRELX: { if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "\n\n\nR_X86_64_GOTPCRELX calculation: (_GOTPC: GOT + A - P (address of global offset table + r_addend - (P: This means the place (section offset or address) of the storage unit being relocated (computed using r_offset ).)))\n"); Elf64_Addr * GOT = lookup_symbol_by_name(library[library_index].array, library[library_index]._elf_header, "_GLOBAL_OFFSET_TABLE_"); library[library_index]._R_X86_64_GOTPCRELX++; break; } case R_X86_64_REX_GOTPCRELX: { if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "\n\n\nR_X86_64_REX_GOTPCRELX calculation: (_GOTPC: GOT + A - P (address of global offset table + r_addend - (P: This means the place (section offset or address) of the storage unit being relocated (computed using r_offset ).)))\n"); Elf64_Addr * GOT = lookup_symbol_by_name(library[library_index].array, library[library_index]._elf_header, "_GLOBAL_OFFSET_TABLE_"); library[library_index]._R_X86_64_REX_GOTPCRELX++; break; } case R_X86_64_NUM: { if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "\n\n\nR_X86_64_NUM\n"); library[library_index]._R_X86_64_NUM++; break; } #endif default: if (bytecmpq(GQ, "no") == 0) if (bytecmpq(am_i_quiet, "no") == 0) fprintf(stderr, "unknown type, got %d\n", reloc_type); library[library_index]._R_X86_64_UNKNOWN++; break; } } } if (bytecmpq(GQ, "no") == 0) nl(); if (bytecmpq(GQ, "no") == 0) nl(); if (bytecmpq(GQ, "no") == 0) nl(); } int r_summary() { if (bytecmpq(GQ, "no") == 0) printf( "relocation summary:\n \ _R_X86_64_NONE = %d\n \ _R_X86_64_64 = %d\n \ _R_X86_64_PC32 = %d\n \ _R_X86_64_GOT32 = %d\n \ _R_X86_64_PLT32 = %d\n \ _R_X86_64_COPY = %d\n \ _R_X86_64_GLOB_DAT = %d\n \ _R_X86_64_JUMP_SLOT = %d\n \ _R_X86_64_RELATIVE = %d\n \ _R_X86_64_GOTPCREL = %d\n \ _R_X86_64_32 = %d\n \ _R_X86_64_32S = %d\n \ _R_X86_64_16 = %d\n \ _R_X86_64_PC16 = %d\n \ _R_X86_64_8 = %d\n \ _R_X86_64_PC8 = %d\n \ _R_X86_64_DTPMOD64 = %d\n \ _R_X86_64_DTPOFF64 = %d\n \ _R_X86_64_TPOFF64 = %d\n \ _R_X86_64_TLSGD = %d\n \ _R_X86_64_TLSLD = %d\n \ _R_X86_64_DTPOFF32 = %d\n \ _R_X86_64_GOTTPOFF = %d\n \ _R_X86_64_TPOFF32 = %d\n \ _R_X86_64_PC64 = %d\n \ _R_X86_64_GOTOFF64 = %d\n \ _R_X86_64_GOTPC32 = %d\n \ _R_X86_64_GOT64 = %d\n \ _R_X86_64_GOTPCREL64 = %d\n \ _R_X86_64_GOTPC64 = %d\n \ _Deprecated1 = %d\n \ _R_X86_64_PLTOFF64 = %d\n \ _R_X86_64_SIZE32 = %d\n \ _R_X86_64_SIZE64 = %d\n \ _R_X86_64_GOTPC32_TLSDESC = %d\n \ _R_X86_64_TLSDESC_CALL = %d\n \ _R_X86_64_TLSDESC = %d\n \ _R_X86_64_IRELATIVE = %d\n \ _R_X86_64_RELATIVE64 = %d\n \ _Deprecated2 = %d\n \ _Deprecated3 = %d\n \ _R_X86_64_GOTPLT64 = %d\n \ _R_X86_64_GOTPCRELX = %d\n \ _R_X86_64_REX_GOTPCRELX = %d\n \ _R_X86_64_NUM = %d\n \ _R_X86_64_UNKNOWN = %d\n \ total = %d\n", library[library_index]._R_X86_64_NONE, library[library_index]._R_X86_64_64, library[library_index]._R_X86_64_PC32, library[library_index]._R_X86_64_GOT32, library[library_index]._R_X86_64_PLT32, library[library_index]._R_X86_64_COPY, library[library_index]._R_X86_64_GLOB_DAT, library[library_index]._R_X86_64_JUMP_SLOT, library[library_index]._R_X86_64_RELATIVE, library[library_index]._R_X86_64_GOTPCREL, library[library_index]._R_X86_64_32, library[library_index]._R_X86_64_32S, library[library_index]._R_X86_64_16, library[library_index]._R_X86_64_PC16, library[library_index]._R_X86_64_8, library[library_index]._R_X86_64_PC8, library[library_index]._R_X86_64_DTPMOD64, library[library_index]._R_X86_64_DTPOFF64, library[library_index]._R_X86_64_TPOFF64, library[library_index]._R_X86_64_TLSGD, library[library_index]._R_X86_64_TLSLD, library[library_index]._R_X86_64_DTPOFF32, library[library_index]._R_X86_64_GOTTPOFF, library[library_index]._R_X86_64_TPOFF32, library[library_index]._R_X86_64_PC64, library[library_index]._R_X86_64_GOTOFF64, library[library_index]._R_X86_64_GOTPC32, library[library_index]._R_X86_64_GOT64, library[library_index]._R_X86_64_GOTPCREL64, library[library_index]._R_X86_64_GOTPC64, library[library_index]._Deprecated1, library[library_index]._R_X86_64_PLTOFF64, library[library_index]._R_X86_64_SIZE32, library[library_index]._R_X86_64_SIZE64, library[library_index]._R_X86_64_GOTPC32_TLSDESC, library[library_index]._R_X86_64_TLSDESC_CALL, library[library_index]._R_X86_64_TLSDESC, library[library_index]._R_X86_64_IRELATIVE, library[library_index]._R_X86_64_RELATIVE64, library[library_index]._Deprecated2, library[library_index]._Deprecated3, library[library_index]._R_X86_64_GOTPLT64, library[library_index]._R_X86_64_GOTPCRELX, library[library_index]._R_X86_64_REX_GOTPCRELX, library[library_index]._R_X86_64_NUM, library[library_index]._R_X86_64_UNKNOWN, library[library_index]._R_X86_64_NONE + library[library_index]._R_X86_64_64 + library[library_index]._R_X86_64_PC32 + library[library_index]._R_X86_64_GOT32 + library[library_index]._R_X86_64_PLT32 + library[library_index]._R_X86_64_COPY + library[library_index]._R_X86_64_GLOB_DAT + library[library_index]._R_X86_64_JUMP_SLOT + library[library_index]._R_X86_64_RELATIVE + library[library_index]._R_X86_64_GOTPCREL + library[library_index]._R_X86_64_32 + library[library_index]._R_X86_64_32S + library[library_index]._R_X86_64_16 + library[library_index]._R_X86_64_PC16 + library[library_index]._R_X86_64_8 + library[library_index]._R_X86_64_PC8 + library[library_index]._R_X86_64_DTPMOD64 + library[library_index]._R_X86_64_DTPOFF64 + library[library_index]._R_X86_64_TPOFF64 + library[library_index]._R_X86_64_TLSGD + library[library_index]._R_X86_64_TLSLD + library[library_index]._R_X86_64_DTPOFF32 + library[library_index]._R_X86_64_GOTTPOFF + library[library_index]._R_X86_64_TPOFF32 + library[library_index]._R_X86_64_PC64 + library[library_index]._R_X86_64_GOTOFF64 + library[library_index]._R_X86_64_GOTPC32 + library[library_index]._R_X86_64_GOT64 + library[library_index]._R_X86_64_GOTPCREL64 + library[library_index]._R_X86_64_GOTPC64 + library[library_index]._Deprecated1 + library[library_index]._R_X86_64_PLTOFF64 + library[library_index]._R_X86_64_SIZE32 + library[library_index]._R_X86_64_SIZE64 + library[library_index]._R_X86_64_GOTPC32_TLSDESC + library[library_index]._R_X86_64_TLSDESC_CALL + library[library_index]._R_X86_64_TLSDESC + library[library_index]._R_X86_64_IRELATIVE + library[library_index]._R_X86_64_RELATIVE64 + library[library_index]._Deprecated2 + library[library_index]._Deprecated3 + library[library_index]._R_X86_64_GOTPLT64 + library[library_index]._R_X86_64_GOTPCRELX + library[library_index]._R_X86_64_REX_GOTPCRELX + library[library_index]._R_X86_64_NUM + library[library_index]._R_X86_64_UNKNOWN); } int init_(const char * filename) { init(filename); if (library[library_index].init__ == 1) return 0; library[library_index]._elf_header = (Elf64_Ehdr *) library[library_index].array; read_section_header_table_(library[library_index].array, library[library_index]._elf_header, &library[library_index]._elf_symbol_table); library[library_index].RELA_PLT_SIZE=library[library_index]._elf_symbol_table[get_section(library[library_index].array, library[library_index]._elf_header, library[library_index]._elf_symbol_table, ".rela.plt")].sh_size; if(!strncmp((char*)library[library_index]._elf_header->e_ident, "\177ELF", 4)) { map(); char *load_addr = NULL; uint32_t load_offset = 0; for (int i = 0; i < library[library_index]._elf_header->e_phnum; ++i) { char * section_; switch(library[library_index]._elf_program_header[i].p_type) { case PT_NULL: section_="PT_NULL"; break; case PT_LOAD: section_="PT_LOAD"; load_addr = (const char *)library[library_index]._elf_program_header->p_vaddr; load_offset = library[library_index]._elf_program_header->p_offset; break; case PT_DYNAMIC: section_="PT_DYNAMIC"; library[library_index].PT_DYNAMIC_=i; break; case PT_INTERP: section_="PT_INTERP"; break; case PT_NOTE: section_="PT_NOTE"; break; case PT_SHLIB: section_="PT_SHLIB"; break; case PT_PHDR: section_="PT_PHDR"; break; case PT_TLS: section_="PT_TLS"; break; case PT_NUM: section_="PT_NUM"; break; case PT_LOOS: section_="PT_LOOS"; break; case PT_GNU_EH_FRAME: section_="PT_GNU_EH_FRAME"; break; case PT_GNU_STACK: section_="PT_GNU_STACK"; break; case PT_GNU_RELRO: section_="PT_GNU_RELRO"; break; case PT_SUNWBSS: section_="PT_SUNWBSS"; break; case PT_SUNWSTACK: section_="PT_SUNWSTACK"; break; case PT_HIOS: section_="PT_HIOS"; break; case PT_LOPROC: section_="PT_LOPROC"; break; case PT_HIPROC: section_="PT_HIPROC"; break; default: section_="Unknown"; break; } if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "attempting to read PT_INTERP of %s\n", library[library_index].last_lib); if (section_ == "PT_INTERP") { read_fast_verify(library[library_index].array, library[library_index].len, &library[library_index].interp, (library[library_index]._elf_program_header[i].p_memsz + library[library_index]._elf_program_header[i].p_offset)); __lseek_string__(&library[library_index].interp, library[library_index]._elf_program_header[i].p_memsz, library[library_index]._elf_program_header[i].p_offset); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "interp of %s PT_INTERP = %s\n", library[library_index].last_lib, library[library_index].interp); } if (section_ == "PT_DYNAMIC") { read_fast_verify(library[library_index].array, library[library_index].len, &library[library_index].tmp99D, (library[library_index]._elf_program_header[i].p_memsz + library[library_index]._elf_program_header[i].p_offset)); __lseek_string__(&library[library_index].tmp99D, library[library_index]._elf_program_header[i].p_memsz, library[library_index]._elf_program_header[i].p_offset); } } if (library[library_index].PT_DYNAMIC_ != 0) { library[library_index].dynamic = library[library_index].tmp99D; for (; library[library_index].dynamic->d_tag != DT_NULL; library[library_index].dynamic++) { if (library[library_index].dynamic->d_tag == DT_STRTAB) { const char *strtab_addr = (const char *)library[library_index].dynamic->d_un.d_ptr; uint32_t strtab_offset = load_offset + (strtab_addr - load_addr); library[library_index].strtab = library[library_index].array + strtab_offset; } } if (library[library_index].strtab == NULL) { abort_(); } library[library_index].dynamic = library[library_index].tmp99D; library[library_index].GOT2 = library[library_index].mappingb + get_dynamic_entry(library[library_index].dynamic, DT_PLTGOT); r_init(); r(library[library_index].mappingb + get_dynamic_entry(library[library_index].dynamic, DT_RELA), get_dynamic_entry(library[library_index].dynamic, DT_RELASZ), relocation_quiet); r(library[library_index].mappingb + get_dynamic_entry(library[library_index].dynamic, DT_JMPREL), library[library_index].RELA_PLT_SIZE, relocation_quiet); r(library[library_index].mappingb + get_dynamic_entry(library[library_index].dynamic, DT_BIND_NOW), library[library_index].RELA_PLT_SIZE, relocation_quiet); // r(library[library_index].mappingb + get_dynamic_entry(library[library_index].dynamic, DT_PLTREL), get_dynamic_entry(library[library_index].dynamic, DT_PLTRELSZ), relocation_quiet); r_summary(); bt(); } } else return -1; library[library_index].init__ = 1; return 0; } int initv_(const char * filename) { init(filename); if (library[library_index].init__ == 1) return 0; setlocale(LC_NUMERIC, "en_US.utf-8"); /* important */ library[library_index]._elf_header = (Elf64_Ehdr *) library[library_index].array; read_section_header_table_(library[library_index].array, library[library_index]._elf_header, &library[library_index]._elf_symbol_table); library[library_index].RELA_PLT_SIZE=library[library_index]._elf_symbol_table[get_section(library[library_index].array, library[library_index]._elf_header, library[library_index]._elf_symbol_table, ".rela.plt")].sh_size; if(!strncmp((char*)library[library_index]._elf_header->e_ident, "\177ELF", 4)) { // ELF Header: // Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 // Class: ELF64 // Data: 2's complement, little endian // Version: 1 (current) // OS/ABI: UNIX - System V // ABI Version: 0 // Type: EXEC (Executable file) // Machine: Advanced Micro Devices X86-64 // Version: 0x1 // Entry point address: 0x400820 // Start of program headers: 64 (bytes into file) // Start of section headers: 11408 (bytes into file) // Flags: 0x0 // Size of this header: 64 (bytes) // Size of program headers: 56 (bytes) // Number of program headers: 9 // Size of section headers: 64 (bytes) // Number of section headers: 30 // Section header string table index: 29 // if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Name:\t\t %s\n", filename); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "ELF Identifier\t %s (", library[library_index]._elf_header->e_ident); __print_quoted_string__(library[library_index]._elf_header->e_ident, sizeof(library[library_index]._elf_header->e_ident), QUOTE_FORCE_HEX|QUOTE_OMIT_LEADING_TRAILING_QUOTES, "print"); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, " )\n"); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Architecture\t "); switch(library[library_index]._elf_header->e_ident[EI_CLASS]) { case ELFCLASSNONE: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "None\n"); break; case ELFCLASS32: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "32-bit\n"); break; case ELFCLASS64: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "64-bit\n"); break; case ELFCLASSNUM: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "NUM ( unspecified )\n"); break; default: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Unknown CLASS\n"); break; } if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Data Type\t "); switch(library[library_index]._elf_header->e_ident[EI_DATA]) { case ELFDATANONE: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "None\n"); break; case ELFDATA2LSB: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "2's complement, little endian\n"); break; case ELFDATA2MSB: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "2's complement, big endian\n"); break; case ELFDATANUM: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "NUM ( unspecified )\n"); break; default: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Unknown \n"); break; } if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Version\t\t "); switch(library[library_index]._elf_header->e_ident[EI_VERSION]) { case EV_NONE: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "None\n"); break; case EV_CURRENT: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Current\n"); break; case EV_NUM: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "NUM ( Unspecified )\n"); break; default: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Unknown \n"); break; } if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "OS ABI\t\t "); switch(library[library_index]._elf_header->e_ident[EI_OSABI]) { case ELFOSABI_NONE: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "UNIX System V ABI\n"); break; // case ELFOSABI_SYSV: // if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "SYSV\n"); // break; // case ELFOSABI_HPUX: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "HP-UX\n"); break; case ELFOSABI_NETBSD: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "NetBSD\n"); break; case ELFOSABI_GNU: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "GNU\n"); break; // case ELFOSABI_LINUX: // if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Linux\n"); // break; // case ELFOSABI_SOLARIS: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Sun Solaris\n"); break; case ELFOSABI_AIX: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "ABM AIX\n"); break; case ELFOSABI_FREEBSD: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "FreeBSD\n"); break; case ELFOSABI_TRU64: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Compaq Tru64\n"); break; case ELFOSABI_MODESTO: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Novell Modesto\n"); break; case ELFOSABI_OPENBSD: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "OpenBSD\n"); break; // case ELFOSABI_ARM_AEABI: // not in musl // if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "ARM EABI\n"); // break; // case ELFOSABI_ARM: // not in musl // if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "ARM\n"); // break; case ELFOSABI_STANDALONE: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Standalone (embedded) application\n"); break; default: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Unknown \n"); break; } if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "File Type\t "); switch(library[library_index]._elf_header->e_type) { case ET_NONE: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "None\n"); break; case ET_REL: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Relocatable file\n"); break; case ET_EXEC: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Executable file\n"); break; case ET_DYN: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Shared object file\n"); break; case ET_CORE: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Core file\n"); break; case ET_NUM: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Number of defined types\n"); break; case ET_LOOS: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "OS-specific range start\n"); break; case ET_HIOS: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "OS-specific range end\n"); break; case ET_LOPROC: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Processor-specific range start\n"); break; case ET_HIPROC: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Processor-specific range end\n"); break; default: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Unknown \n"); break; } if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Machine\t\t "); switch(library[library_index]._elf_header->e_machine) { case EM_NONE: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "None\n"); break; case EM_386: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "INTEL x86\n"); break; case EM_X86_64: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "AMD x86-64 architecture\n"); break; case EM_ARM: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "ARM\n"); break; default: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Unknown\n"); break; } /* Entry point */ int entry=library[library_index]._elf_header->e_entry; if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Entry point\t %014p\n", library[library_index]._elf_header->e_entry); /* ELF header size in bytes */ if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "ELF header size\t %014p\n", library[library_index]._elf_header->e_ehsize); /* Program Header */ if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Program Header\t %014p (%d entries with a total of %d bytes)\n", library[library_index]._elf_header->e_phoff, library[library_index]._elf_header->e_phnum, library[library_index]._elf_header->e_phentsize ); map(); // continue analysis char *load_addr = NULL; uint32_t load_offset = 0; for (int i = 0; i < library[library_index]._elf_header->e_phnum; ++i) { char * section_; if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "p_type:\t\t\t/* Segment type */\t\t= "); switch(library[library_index]._elf_program_header[i].p_type) { case PT_NULL: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "PT_NULL\t\t/* Program header table entry unused */\n"); section_="PT_NULL"; break; case PT_LOAD: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "PT_LOAD\t\t/* Loadable program segment */\n"); section_="PT_LOAD"; load_addr = (const char *)library[library_index]._elf_program_header->p_vaddr; load_offset = library[library_index]._elf_program_header->p_offset; break; case PT_DYNAMIC: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "PT_DYNAMIC\t\t/* Dynamic linking information */\n"); section_="PT_DYNAMIC"; library[library_index].PT_DYNAMIC_=i; break; case PT_INTERP: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "PT_INTERP\t\t/* Program interpreter */\n"); section_="PT_INTERP"; break; case PT_NOTE: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "PT_NOTE\t\t/* Auxiliary information */\n"); section_="PT_NOTE"; break; case PT_SHLIB: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "PT_SHLIB\t\t/* Reserved */\n"); section_="PT_SHLIB"; break; case PT_PHDR: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "PT_PHDR\t\t/* Entry for header table itself */\n"); section_="PT_PHDR"; break; case PT_TLS: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "PT_TLS\t\t/* Thread-local storage segment */\n"); section_="PT_TLS"; break; case PT_NUM: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "PT_NUM\t\t/* Number of defined types */\n"); section_="PT_NUM"; break; case PT_LOOS: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "PT_LOOS\t\t/* Start of OS-specific */\n"); section_="PT_LOOS"; break; case PT_GNU_EH_FRAME: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "PT_GNU_EH_FRAME\t/* GCC .eh_frame_hdr segment */\n"); section_="PT_GNU_EH_FRAME"; break; case PT_GNU_STACK: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "PT_GNU_STACK\t\t/* Indicates stack executability */\n"); section_="PT_GNU_STACK"; break; case PT_GNU_RELRO: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "PT_GNU_RELRO\t\t/* Read-only after relocation */\n"); section_="PT_GNU_RELRO"; break; case PT_SUNWBSS: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "PT_SUNWBSS\t\t/* Sun Specific segment */\n"); section_="PT_SUNWBSS"; break; case PT_SUNWSTACK: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "PT_SUNWSTACK\t\t/* Stack segment */\n"); section_="PT_SUNWSTACK"; break; case PT_HIOS: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "PT_HIOS\t\t/* End of OS-specific */\n"); section_="PT_HIOS"; break; case PT_LOPROC: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "PT_LOPROC\t\t/* Start of processor-specific */\n"); section_="PT_LOPROC"; break; case PT_HIPROC: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "PT_HIPROC\t\t/* End of processor-specific */\n"); section_="PT_HIPROC"; break; default: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Unknown\n"); section_="Unknown"; break; } if (section_ == "PT_DYNAMIC") { // obtain PT_DYNAMIC into seperate library[library_index].array for use later read_fast_verify(library[library_index].array, library[library_index].len, &library[library_index].tmp99D, (library[library_index]._elf_program_header[i].p_memsz + library[library_index]._elf_program_header[i].p_offset)); __lseek_string__(&library[library_index].tmp99D, library[library_index]._elf_program_header[i].p_memsz, library[library_index]._elf_program_header[i].p_offset); } char * tmp99;/* = malloc((library[library_index]._elf_program_header[i].p_memsz + library[library_index]._elf_program_header[i].p_offset));*/ if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "ATTEMPING TO READ\n"); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "reading %014p\n", (library[library_index]._elf_program_header[i].p_memsz + library[library_index]._elf_program_header[i].p_offset)); read_fast_verify(library[library_index].array, library[library_index].len, &tmp99, (library[library_index]._elf_program_header[i].p_memsz + library[library_index]._elf_program_header[i].p_offset)); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "correcting position by %014p\n", library[library_index]._elf_program_header[i].p_offset); __lseek_string__(&tmp99, library[library_index]._elf_program_header[i].p_memsz, library[library_index]._elf_program_header[i].p_offset); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "reading %d\n", library[library_index]._elf_program_header[i].p_memsz); __print_quoted_string__(tmp99, library[library_index]._elf_program_header[i].p_memsz, 0, "print"); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "\nREAD\n"); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "p_flags:\t\t/* Segment flags */\t\t= %014p\np_offset:\t\t/* Segment file offset */\t= %014p\np_vaddr:\t\t/* Segment virtual address */\t= %014p\np_paddr:\t\t/* Segment physical address */\t= %014p\np_filesz:\t\t/* Segment size in file */\t= %014p\np_memsz:\t\t/* Segment size in memory */\t= %014p\np_align:\t\t/* Segment alignment */\t\t= %014p\n\n\n", library[library_index]._elf_program_header[i].p_flags, library[library_index]._elf_program_header[i].p_offset, library[library_index]._elf_program_header[i].p_vaddr+library[library_index].mappingb, library[library_index]._elf_program_header[i].p_paddr, library[library_index]._elf_program_header[i].p_filesz, library[library_index]._elf_program_header[i].p_memsz, library[library_index]._elf_program_header[i].p_align); if (bytecmpq(GQ, "no") == 0) nl(); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "\t\tp_flags: %014p", library[library_index]._elf_program_header[i].p_flags); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, " p_offset: %014p", library[library_index]._elf_program_header[i].p_offset); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, " p_vaddr: %014p", library[library_index]._elf_program_header[i].p_vaddr+library[library_index].mappingb); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, " p_paddr: %014p", library[library_index]._elf_program_header[i].p_paddr); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, " p_filesz: %014p", library[library_index]._elf_program_header[i].p_filesz); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, " p_memsz: %014p", library[library_index]._elf_program_header[i].p_memsz); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, " p_align: %014p\n", library[library_index]._elf_program_header[i].p_align); } if (library[library_index].PT_DYNAMIC_ != 0) { // A PT_DYNAMIC program header element points at the .dynamic section, explained in // "Dynamic Section" below. The .got and .plt sections also hold information related to // position-independent code and dynamic linking. Although the .plt appears in a text segment // above, it may reside in a text or a data segment, depending on the processor. // // As "Sections" describes, the .bss section has the type SHT_NOBITS. Although it occupies no // space in the file, it contributes to the segment's memory image. Normally, these uninitialized // data reside at the end of the segment, thereby making p_memsz larger than p_filesz. // if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "PT_LOAD 1 = \n"); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "p_flags:\t\t/* Segment flags */\t\t= %014p\np_offset:\t\t/* Segment file offset */\t= %014p\np_vaddr:\t\t/* Segment virtual address */\t= %014p\np_paddr:\t\t/* Segment physical address */\t= %014p\np_filesz:\t\t/* Segment size in file */\t= %014p\np_memsz:\t\t/* Segment size in memory */\t= %014p\np_align:\t\t/* Segment alignment */\t\t= %014p\n\n\n", library[library_index]._elf_program_header[library[library_index].First_Load_Header_index].p_flags, library[library_index]._elf_program_header[library[library_index].First_Load_Header_index].p_offset, library[library_index]._elf_program_header[library[library_index].First_Load_Header_index].p_vaddr+library[library_index].mappingb, library[library_index]._elf_program_header[library[library_index].First_Load_Header_index].p_paddr, library[library_index]._elf_program_header[library[library_index].First_Load_Header_index].p_filesz, library[library_index]._elf_program_header[library[library_index].First_Load_Header_index].p_memsz, library[library_index]._elf_program_header[library[library_index].First_Load_Header_index].p_align); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "PT_LOAD 2 = \n"); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "p_flags:\t\t/* Segment flags */\t\t= %014p\np_offset:\t\t/* Segment file offset */\t= %014p\np_vaddr:\t\t/* Segment virtual address */\t= %014p\np_paddr:\t\t/* Segment physical address */\t= %014p\np_filesz:\t\t/* Segment size in file */\t= %014p\np_memsz:\t\t/* Segment size in memory */\t= %014p\np_align:\t\t/* Segment alignment */\t\t= %014p\n\n\n", library[library_index]._elf_program_header[library[library_index].Last_Load_Header_index].p_flags, library[library_index]._elf_program_header[library[library_index].Last_Load_Header_index].p_offset, library[library_index]._elf_program_header[library[library_index].Last_Load_Header_index].p_vaddr+library[library_index].mappingb, library[library_index]._elf_program_header[library[library_index].Last_Load_Header_index].p_paddr, library[library_index]._elf_program_header[library[library_index].Last_Load_Header_index].p_filesz, library[library_index]._elf_program_header[library[library_index].Last_Load_Header_index].p_memsz, library[library_index]._elf_program_header[library[library_index].Last_Load_Header_index].p_align); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "first PT_LOAD library[library_index]._elf_program_header[%d]->p_paddr = \n%014p\n", library[library_index].First_Load_Header_index, library[library_index]._elf_program_header[library[library_index].First_Load_Header_index].p_paddr+library[library_index].mappingb); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Second PT_LOAD library[library_index]._elf_program_header[%d]->p_paddr = \n%014p\n", library[library_index].Last_Load_Header_index, library[library_index]._elf_program_header[library[library_index].Last_Load_Header_index].p_paddr+library[library_index].mappingb); library[library_index].dynamic = library[library_index].tmp99D; for (; library[library_index].dynamic->d_tag != DT_NULL; library[library_index].dynamic++) { if (library[library_index].dynamic->d_tag == DT_STRTAB) { const char *strtab_addr = (const char *)library[library_index].dynamic->d_un.d_ptr; uint32_t strtab_offset = load_offset + (strtab_addr - load_addr); library[library_index].strtab = library[library_index].array + strtab_offset; } } if (library[library_index].strtab == NULL) { abort_(); } library[library_index].dynamic = library[library_index].tmp99D; library[library_index].GOT2 = library[library_index].mappingb + get_dynamic_entry(library[library_index].dynamic, DT_PLTGOT); // library[library_index].PLT = library[library_index].mappingb + get_dynamic_entry(library[library_index].dynamic, DT_PLTREL); // if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "printing symbol data\n"); // Elf64_Sym *syms = library[library_index].mappingb + get_dynamic_entry(library[library_index].dynamic, DT_SYMTAB); // symbol1(library[library_index].array, syms, 0); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "examining current entries:\n"); get_dynamic_entry(library[library_index].dynamic, -1); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "printing relocation data\n"); // needs to be the address of the mapping itself, not the base address r_init(); r(library[library_index].mappingb + get_dynamic_entry(library[library_index].dynamic, DT_RELA), get_dynamic_entry(library[library_index].dynamic, DT_RELASZ), relocation_quiet); r(library[library_index].mappingb + get_dynamic_entry(library[library_index].dynamic, DT_JMPREL), library[library_index].RELA_PLT_SIZE, relocation_quiet); r(library[library_index].mappingb + get_dynamic_entry(library[library_index].dynamic, DT_BIND_NOW), library[library_index].RELA_PLT_SIZE, relocation_quiet); // r(library[library_index].mappingb + get_dynamic_entry(library[library_index].dynamic, DT_PLTREL), get_dynamic_entry(library[library_index].dynamic, DT_PLTRELSZ), relocation_quiet); r_summary(); } // if (bytecmpq(GQ, "no") == 0) nl(); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Section Header\t \ library[library_index]._elf_header->e_shstrndx %014p (\ library[library_index]._elf_header->e_shnum = %d entries with a total of \ library[library_index]._elf_header->e_shentsize = %d (should match %d) bytes, offset is \ library[library_index]._elf_header->e_shoff = %014p)\n",\ library[library_index]._elf_header->e_shstrndx,\ library[library_index]._elf_header->e_shnum,\ library[library_index]._elf_header->e_shentsize,\ sizeof(Elf64_Shdr),\ library[library_index]._elf_header->e_shoff,\ (char *)library[library_index].array + library[library_index]._elf_header->e_shoff\ ); read_section_header_table_(library[library_index].array, library[library_index]._elf_header, &library[library_index]._elf_symbol_table); print_section_headers_(library[library_index].array, library[library_index]._elf_header, library[library_index]._elf_symbol_table); print_symbols(library[library_index].array, library[library_index]._elf_header, library[library_index]._elf_symbol_table); } else { /* Not ELF file */ if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "ELFMAGIC not found\n"); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "header = "); __print_quoted_string__(library[library_index].array, sizeof(library[library_index]._elf_header->e_ident), QUOTE_OMIT_LEADING_TRAILING_QUOTES, "print"); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "\n"); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "ELF Identifier\t %s (", library[library_index]._elf_header->e_ident); __print_quoted_string__(library[library_index]._elf_header->e_ident, sizeof(library[library_index]._elf_header->e_ident), QUOTE_FORCE_HEX|QUOTE_OMIT_LEADING_TRAILING_QUOTES, "print"); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, " )\n"); return 0; } library[library_index].init__ = 1; return 0; } int readelf_(const char * filename); void * dlopen_(const char * cc) { if (library[library_index].init_lock == 1) { if (bytecmpq(ldd_quiet, "no") == 0) fprintf(stderr, "dlopen: LOCKED\n"); return "-1"; }; if ( if_valid(cc) == -1) { if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "\"%s\" not found\n", cc); errno = 0; abort_(); return "-1"; } init_(cc); // library_index++; library[library_index].library_name = cc; library[library_index].library_first_character = library[library_index].library_name[0]; library[library_index].library_len = strlen(library[library_index].library_name); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "dlopen: adding %s to index %d\n", cc, library_index); return cc; } void * dlopen(const char * cc) { // readelf_(cc); // abort_(); get_needed(cc, "-1"); return dlopen_(cc); } void * dlsym(const char * cc1, const char * cc2) { if (library[library_index].init_lock == 1) { if (bytecmpq(ldd_quiet, "no") == 0) fprintf(stderr, "dlsym: LOCKED\n"); return "-1"; }; if (bytecmpq(cc1,"-1") == 0) return "-1"; library_index = search(cc1); library[library_index].library_symbol = cc2; if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "dlsym: adding %s from %s\n", library[library_index].library_symbol, library[library_index].library_name); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "calling find needed\n"); dl = 1; find_needed(cc1, cc2); } void * dlsym_(const char * cc1, const char * cc2) { if (library[library_index].init_lock == 1) { if (bytecmpq(ldd_quiet, "no") == 0) fprintf(stderr, "dlsym: LOCKED\n"); return "-1"; } if (bytecmpq(cc1,"-1") == 0) return "-1"; library_index = search(cc1); return lookup_symbol_by_name_(cc1, cc2); } int readelf_(const char * filename) { readelf = 1; setlocale(LC_NUMERIC, "en_US.utf-8"); /* important */ init_(filename); if(!strncmp((char*)library[library_index]._elf_header->e_ident, "\177ELF", 4)) { // ELF Header: // Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 // Class: ELF64 // Data: 2's complement, little endian // Version: 1 (current) // OS/ABI: UNIX - System V // ABI Version: 0 // Type: EXEC (Executable file) // Machine: Advanced Micro Devices X86-64 // Version: 0x1 // Entry point address: 0x400820 // Start of program headers: 64 (bytes into file) // Start of section headers: 11408 (bytes into file) // Flags: 0x0 // Size of this header: 64 (bytes) // Size of program headers: 56 (bytes) // Number of program headers: 9 // Size of section headers: 64 (bytes) // Number of section headers: 30 // Section header string table index: 29 // if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Name:\t\t %s\n", filename); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "ELF Identifier\t %s (", library[library_index]._elf_header->e_ident); __print_quoted_string__(library[library_index]._elf_header->e_ident, sizeof(library[library_index]._elf_header->e_ident), QUOTE_FORCE_HEX|QUOTE_OMIT_LEADING_TRAILING_QUOTES, "print"); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, " )\n"); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Architecture\t "); switch(library[library_index]._elf_header->e_ident[EI_CLASS]) { case ELFCLASSNONE: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "None\n"); break; case ELFCLASS32: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "32-bit\n"); break; case ELFCLASS64: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "64-bit\n"); break; case ELFCLASSNUM: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "NUM ( unspecified )\n"); break; default: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Unknown CLASS\n"); break; } if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Data Type\t "); switch(library[library_index]._elf_header->e_ident[EI_DATA]) { case ELFDATANONE: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "None\n"); break; case ELFDATA2LSB: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "2's complement, little endian\n"); break; case ELFDATA2MSB: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "2's complement, big endian\n"); break; case ELFDATANUM: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "NUM ( unspecified )\n"); break; default: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Unknown \n"); break; } if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Version\t\t "); switch(library[library_index]._elf_header->e_ident[EI_VERSION]) { case EV_NONE: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "None\n"); break; case EV_CURRENT: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Current\n"); break; case EV_NUM: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "NUM ( Unspecified )\n"); break; default: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Unknown \n"); break; } if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "OS ABI\t\t "); switch(library[library_index]._elf_header->e_ident[EI_OSABI]) { case ELFOSABI_NONE: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "UNIX System V ABI\n"); break; // case ELFOSABI_SYSV: // if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "SYSV\n"); // break; // case ELFOSABI_HPUX: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "HP-UX\n"); break; case ELFOSABI_NETBSD: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "NetBSD\n"); break; case ELFOSABI_GNU: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "GNU\n"); break; // case ELFOSABI_LINUX: // if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Linux\n"); // break; // case ELFOSABI_SOLARIS: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Sun Solaris\n"); break; case ELFOSABI_AIX: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "ABM AIX\n"); break; case ELFOSABI_FREEBSD: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "FreeBSD\n"); break; case ELFOSABI_TRU64: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Compaq Tru64\n"); break; case ELFOSABI_MODESTO: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Novell Modesto\n"); break; case ELFOSABI_OPENBSD: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "OpenBSD\n"); break; // case ELFOSABI_ARM_AEABI: // if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "ARM EABI\n"); // break; // case ELFOSABI_ARM: // if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "ARM\n"); // break; case ELFOSABI_STANDALONE: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Standalone (embedded) application\n"); break; default: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Unknown \n"); break; } if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "File Type\t "); switch(library[library_index]._elf_header->e_type) { case ET_NONE: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "None\n"); break; case ET_REL: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Relocatable file\n"); break; case ET_EXEC: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Executable file\n"); break; case ET_DYN: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Shared object file\n"); break; case ET_CORE: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Core file\n"); break; case ET_NUM: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Number of defined types\n"); break; case ET_LOOS: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "OS-specific range start\n"); break; case ET_HIOS: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "OS-specific range end\n"); break; case ET_LOPROC: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Processor-specific range start\n"); break; case ET_HIPROC: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Processor-specific range end\n"); break; default: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Unknown \n"); break; } if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Machine\t\t "); switch(library[library_index]._elf_header->e_machine) { case EM_NONE: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "None\n"); break; case EM_386: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "INTEL x86\n"); break; case EM_X86_64: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "AMD x86-64 architecture\n"); break; case EM_ARM: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "ARM\n"); break; default: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Unknown\n"); break; } /* Entry point */ int entry=library[library_index]._elf_header->e_entry; if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Entry point\t %014p\n", library[library_index]._elf_header->e_entry); /* ELF header size in bytes */ if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "ELF header size\t %014p\n", library[library_index]._elf_header->e_ehsize); /* Program Header */ if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Program Header\t %014p (%d entries with a total of %d bytes)\n", library[library_index]._elf_header->e_phoff, library[library_index]._elf_header->e_phnum, library[library_index]._elf_header->e_phentsize ); // continue analysis for (int i = 0; i < library[library_index]._elf_header->e_phnum; ++i) { char * section_; if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "p_type:\t\t\t/* Segment type */\t\t= "); switch(library[library_index]._elf_program_header[i].p_type) { case PT_NULL: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "PT_NULL\t\t/* Program header table entry unused */\n"); section_="PT_NULL"; break; case PT_LOAD: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "PT_LOAD\t\t/* Loadable program segment */\n"); section_="PT_LOAD"; break; case PT_DYNAMIC: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "PT_DYNAMIC\t\t/* Dynamic linking information */\n"); section_="PT_DYNAMIC"; library[library_index].PT_DYNAMIC_=i; break; case PT_INTERP: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "PT_INTERP\t\t/* Program interpreter */\n"); section_="PT_INTERP"; break; case PT_NOTE: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "PT_NOTE\t\t/* Auxiliary information */\n"); section_="PT_NOTE"; break; case PT_SHLIB: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "PT_SHLIB\t\t/* Reserved */\n"); section_="PT_SHLIB"; break; case PT_PHDR: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "PT_PHDR\t\t/* Entry for header table itself */\n"); section_="PT_PHDR"; break; case PT_TLS: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "PT_TLS\t\t/* Thread-local storage segment */\n"); section_="PT_TLS"; break; case PT_NUM: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "PT_NUM\t\t/* Number of defined types */\n"); section_="PT_NUM"; break; case PT_LOOS: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "PT_LOOS\t\t/* Start of OS-specific */\n"); section_="PT_LOOS"; break; case PT_GNU_EH_FRAME: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "PT_GNU_EH_FRAME\t/* GCC .eh_frame_hdr segment */\n"); section_="PT_GNU_EH_FRAME"; break; case PT_GNU_STACK: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "PT_GNU_STACK\t\t/* Indicates stack executability */\n"); section_="PT_GNU_STACK"; break; case PT_GNU_RELRO: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "PT_GNU_RELRO\t\t/* Read-only after relocation */\n"); section_="PT_GNU_RELRO"; break; case PT_SUNWBSS: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "PT_SUNWBSS\t\t/* Sun Specific segment */\n"); section_="PT_SUNWBSS"; break; case PT_SUNWSTACK: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "PT_SUNWSTACK\t\t/* Stack segment */\n"); section_="PT_SUNWSTACK"; break; case PT_HIOS: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "PT_HIOS\t\t/* End of OS-specific */\n"); section_="PT_HIOS"; break; case PT_LOPROC: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "PT_LOPROC\t\t/* Start of processor-specific */\n"); section_="PT_LOPROC"; break; case PT_HIPROC: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "PT_HIPROC\t\t/* End of processor-specific */\n"); section_="PT_HIPROC"; break; default: if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Unknown\n"); section_="Unknown"; break; } if (section_ == "PT_DYNAMIC") { // obtain PT_DYNAMIC into seperate library[library_index].array for use later read_fast_verify(library[library_index].array, library[library_index].len, &library[library_index].tmp99D, (library[library_index]._elf_program_header[i].p_memsz + library[library_index]._elf_program_header[i].p_offset)); __lseek_string__(&library[library_index].tmp99D, library[library_index]._elf_program_header[i].p_memsz, library[library_index]._elf_program_header[i].p_offset); } char * tmp99;/* = malloc((library[library_index]._elf_program_header[i].p_memsz + library[library_index]._elf_program_header[i].p_offset));*/ if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "ATTEMPING TO READ\n"); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "reading %014p\n", (library[library_index]._elf_program_header[i].p_memsz + library[library_index]._elf_program_header[i].p_offset)); read_fast_verify(library[library_index].array, library[library_index].len, &tmp99, (library[library_index]._elf_program_header[i].p_memsz + library[library_index]._elf_program_header[i].p_offset)); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "correcting position by %014p\n", library[library_index]._elf_program_header[i].p_offset); __lseek_string__(&tmp99, library[library_index]._elf_program_header[i].p_memsz, library[library_index]._elf_program_header[i].p_offset); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "reading %d\n", library[library_index]._elf_program_header[i].p_memsz); __print_quoted_string__(tmp99, library[library_index]._elf_program_header[i].p_memsz, 0, "print"); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "\nREAD\n"); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "p_flags:\t\t/* Segment flags */\t\t= %014p\np_offset:\t\t/* Segment file offset */\t= %014p\np_vaddr:\t\t/* Segment virtual address */\t= %014p\np_paddr:\t\t/* Segment physical address */\t= %014p\np_filesz:\t\t/* Segment size in file */\t= %014p\np_memsz:\t\t/* Segment size in memory */\t= %014p\np_align:\t\t/* Segment alignment */\t\t= %014p\n\n\n", library[library_index]._elf_program_header[i].p_flags, library[library_index]._elf_program_header[i].p_offset, library[library_index]._elf_program_header[i].p_vaddr+library[library_index].mappingb, library[library_index]._elf_program_header[i].p_paddr, library[library_index]._elf_program_header[i].p_filesz, library[library_index]._elf_program_header[i].p_memsz, library[library_index]._elf_program_header[i].p_align); if (bytecmpq(GQ, "no") == 0) nl(); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "\t\tp_flags: %014p", library[library_index]._elf_program_header[i].p_flags); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, " p_offset: %014p", library[library_index]._elf_program_header[i].p_offset); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, " p_vaddr: %014p", library[library_index]._elf_program_header[i].p_vaddr+library[library_index].mappingb); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, " p_paddr: %014p", library[library_index]._elf_program_header[i].p_paddr); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, " p_filesz: %014p", library[library_index]._elf_program_header[i].p_filesz); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, " p_memsz: %014p", library[library_index]._elf_program_header[i].p_memsz); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, " p_align: %014p\n", library[library_index]._elf_program_header[i].p_align); } if (library[library_index].PT_DYNAMIC_ != 0) { // A PT_DYNAMIC program header element points at the .dynamic section, explained in // "Dynamic Section" below. The .got and .plt sections also hold information related to // position-independent code and dynamic linking. Although the .plt appears in a text segment // above, it may reside in a text or a data segment, depending on the processor. // // As "Sections" describes, the .bss section has the type SHT_NOBITS. Although it occupies no // space in the file, it contributes to the segment's memory image. Normally, these uninitialized // data reside at the end of the segment, thereby making p_memsz larger than p_filesz. // if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "PT_LOAD 1 = \n"); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "p_flags:\t\t/* Segment flags */\t\t= %014p\np_offset:\t\t/* Segment file offset */\t= %014p\np_vaddr:\t\t/* Segment virtual address */\t= %014p\np_paddr:\t\t/* Segment physical address */\t= %014p\np_filesz:\t\t/* Segment size in file */\t= %014p\np_memsz:\t\t/* Segment size in memory */\t= %014p\np_align:\t\t/* Segment alignment */\t\t= %014p\n\n\n", library[library_index]._elf_program_header[library[library_index].First_Load_Header_index].p_flags, library[library_index]._elf_program_header[library[library_index].First_Load_Header_index].p_offset, library[library_index]._elf_program_header[library[library_index].First_Load_Header_index].p_vaddr+library[library_index].mappingb, library[library_index]._elf_program_header[library[library_index].First_Load_Header_index].p_paddr, library[library_index]._elf_program_header[library[library_index].First_Load_Header_index].p_filesz, library[library_index]._elf_program_header[library[library_index].First_Load_Header_index].p_memsz, library[library_index]._elf_program_header[library[library_index].First_Load_Header_index].p_align); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "PT_LOAD 2 = \n"); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "p_flags:\t\t/* Segment flags */\t\t= %014p\np_offset:\t\t/* Segment file offset */\t= %014p\np_vaddr:\t\t/* Segment virtual address */\t= %014p\np_paddr:\t\t/* Segment physical address */\t= %014p\np_filesz:\t\t/* Segment size in file */\t= %014p\np_memsz:\t\t/* Segment size in memory */\t= %014p\np_align:\t\t/* Segment alignment */\t\t= %014p\n\n\n", library[library_index]._elf_program_header[library[library_index].Last_Load_Header_index].p_flags, library[library_index]._elf_program_header[library[library_index].Last_Load_Header_index].p_offset, library[library_index]._elf_program_header[library[library_index].Last_Load_Header_index].p_vaddr+library[library_index].mappingb, library[library_index]._elf_program_header[library[library_index].Last_Load_Header_index].p_paddr, library[library_index]._elf_program_header[library[library_index].Last_Load_Header_index].p_filesz, library[library_index]._elf_program_header[library[library_index].Last_Load_Header_index].p_memsz, library[library_index]._elf_program_header[library[library_index].Last_Load_Header_index].p_align); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "first PT_LOAD library[library_index]._elf_program_header[%d]->p_paddr = \n%014p\n", library[library_index].First_Load_Header_index, library[library_index]._elf_program_header[library[library_index].First_Load_Header_index].p_paddr+library[library_index].mappingb); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Second PT_LOAD library[library_index]._elf_program_header[%d]->p_paddr = \n%014p\n", library[library_index].Last_Load_Header_index, library[library_index]._elf_program_header[library[library_index].Last_Load_Header_index].p_paddr+library[library_index].mappingb); Elf64_Dyn * dynamic = library[library_index].tmp99D; if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "examining current entries:\n"); get_dynamic_entry(library[library_index].dynamic, -1); } if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "Section Header\t \ library[library_index]._elf_header->e_shstrndx %014p (\ library[library_index]._elf_header->e_shnum = %d entries with a total of \ library[library_index]._elf_header->e_shentsize = %d (should match %d) bytes, offset is \ library[library_index]._elf_header->e_shoff = %014p)\n",\ library[library_index]._elf_header->e_shstrndx,\ library[library_index]._elf_header->e_shnum,\ library[library_index]._elf_header->e_shentsize,\ sizeof(Elf64_Shdr),\ library[library_index]._elf_header->e_shoff,\ (char *)library[library_index].array + library[library_index]._elf_header->e_shoff\ ); read_section_header_table_(library[library_index].array, library[library_index]._elf_header, &library[library_index]._elf_symbol_table); print_section_headers_(library[library_index].array, library[library_index]._elf_header, library[library_index]._elf_symbol_table); print_symbols(library[library_index].array, library[library_index]._elf_header, library[library_index]._elf_symbol_table); } else { /* Not ELF file */ if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "ELFMAGIC not found\n"); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "header = "); __print_quoted_string__(library[library_index].array, sizeof(library[library_index]._elf_header->e_ident), QUOTE_OMIT_LEADING_TRAILING_QUOTES, "print"); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "\n"); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, "ELF Identifier\t %s (", library[library_index]._elf_header->e_ident); __print_quoted_string__(library[library_index]._elf_header->e_ident, sizeof(library[library_index]._elf_header->e_ident), QUOTE_FORCE_HEX|QUOTE_OMIT_LEADING_TRAILING_QUOTES, "print"); if (bytecmpq(GQ, "no") == 0) fprintf(stderr, " )\n"); readelf = 0; return 0; } readelf = 0; return 0; } int __string_quote__(const char *instr, char *outstr, const unsigned int size, const unsigned int style) { const unsigned char *ustr = (const unsigned char *) instr; char *s = outstr; unsigned int i; int usehex, usehexX, uselen, c; int xflag = 0; usehex = 0; usehexX = 0; uselen = 0; if ((style == 9998)) { usehexX = 1; } else if ((style == 9999)) { uselen = 1; } else if ((xflag > 1) || (style & QUOTE_FORCE_HEX)) { usehex = 1; } else if (xflag) { /* Check for presence of symbol which require to hex-quote the whole string. */ for (i = 0; i < size; ++i) { c = ustr[i]; /* Check for NUL-terminated string. */ if (c == 0x100) break; /* Force hex unless c is printable or whitespace */ if (c > 0x7e) { usehex = 1; break; } /* In ASCII isspace is only these chars: "\t\n\v\f\r". * They happen to have ASCII codes 9,10,11,12,13. */ if (c < ' ' && (unsigned)(c - 9) >= 5) { usehex = 1; break; } } } if (!(style & QUOTE_OMIT_LEADING_TRAILING_QUOTES)) *s++ = '\"'; if (usehexX) { /* Hex-quote the whole string. */ for (i = 0; i < size; ++i) { c = ustr[i]; /* Check for NUL-terminated string. */ if (c == 0x100) goto asciz_ended; // print hex in " 00 00" format instead of "\x00\x00" format // *s++ = '\\'; *s++ = ' '; *s++ = "0123456789abcdef"[c >> 4]; *s++ = "0123456789abcdef"[c & 0xf]; } } else if (usehex) { /* Hex-quote the whole string. */ for (i = 0; i < size; ++i) { c = ustr[i]; /* Check for NUL-terminated string. */ if (c == 0x100) goto asciz_ended; *s++ = '\\'; *s++ = 'x'; *s++ = "0123456789abcdef"[c >> 4]; *s++ = "0123456789abcdef"[c & 0xf]; } } else if (uselen) { /* Hex-quote the whole string. */ for (i = 0; i < size; ++i) { c = ustr[i]; /* Check for NUL-terminated string. */ if (c == 0x100) goto asciz_ended; *s++ = '1'; } } else { for (i = 0; i < size; ++i) { c = ustr[i]; /* Check for NUL-terminated string. */ if (c == 0x100) goto asciz_ended; if ((i == (size - 1)) && (style & QUOTE_OMIT_TRAILING_0) && (c == '\0')) goto asciz_ended; int pass_one = 0; int pass_two = 0; int pass_three = 0; int pass_four = 0; if (c == '\f') { *s++ = '\\'; *s++ = 'f'; pass_one = 1; pass_three = 1; pass_four= 1; // if i wanted a string to be if (bytecmpq(GQ, "no") == 0) printf safe what characters would i need to replace or modify, for example "hi"ko-pl" would need to be "hi\"ko"'-'"pl" // \x27 is ' // xargs -0 if (bytecmpq(GQ, "no") == 0) printf '%s'<<EOF // "hi"ko-p'l" // EOF } if (pass_one == 0) { if (c == '%'/*FOR PRINTF*/) { *s++ = '%'; *s++ = '%'; pass_two = 1; pass_three = 1; pass_four= 1; } else { pass_two = 1; } } if (pass_two == 0) { if (c == '\"') { /*FOR PRINTF/SHELL*/ *s++ = '\\'; *s++ = '\"'; pass_three = 1; pass_four= 1; } else if (c == '\\') { /*FOR PRINTF/SHELL*/ *s++ = '\\'; *s++ = '\\'; pass_three = 1; pass_four= 1; } else if (c == '`'/*FOR PRINTF*/|| c == '$'/*FOR BASH*/) { // *s++ = '\\'; *s++ = c; pass_three = 1; pass_four= 1; } else if (c == '\''/*FOR PRINTF*/) { // *s++ = '\\'; // *s++ = 'x'; // *s++ = '2'; *s++ = c; pass_three = 1; pass_four= 1; } else if (c == '!'/*FOR BASH*/ || c == '-'/*FOR PRINTF*/) { // *s++ = '"'; // *s++ = '\''; *s++ = c; // *s++ = '\''; // *s++ = '"'; pass_three = 1; pass_four= 1; } else if (c == '%'/*FOR PRINTF*/) { *s++ = '%'; *s++ = '%'; *s++ = '%'; *s++ = '%'; pass_three = 1; pass_four= 1; } } if (pass_three == 0) { if (c == '\n') { *s++ = '\\'; *s++ = 'n'; pass_four = 1; } else if (c == '\r') { *s++ = '\\'; *s++ = 'r'; pass_four = 1; } else if (c == '\t') { *s++ = '\\'; *s++ = 't'; pass_four = 1; } else if (c == '\v') { *s++ = '\\'; *s++ = 'v'; pass_four = 1; } } if (pass_four == 0) { if (c >= ' ' && c <= 0x7e) *s++ = c; else { /* Print \octal */ *s++ = '\\'; if (i + 1 < size && ustr[i + 1] >= '0' && ustr[i + 1] <= '9' ) { /* Print \ooo */ *s++ = '0' + (c >> 6); *s++ = '0' + ((c >> 3) & 0x7); } else { /* Print \[[o]o]o */ if ((c >> 3) != 0) { if ((c >> 6) != 0) *s++ = '0' + (c >> 6); *s++ = '0' + ((c >> 3) & 0x7); } } *s++ = '0' + (c & 0x7); } } } } if (!(style & QUOTE_OMIT_LEADING_TRAILING_QUOTES)) *s++ = '\"'; *s = '\0'; /* Return zero if we printed entire ASCIZ string (didn't truncate it) */ if (style & QUOTE_0_TERMINATED && ustr[i] == '\0') { /* We didn't see NUL yet (otherwise we'd jump to 'asciz_ended') * but next char is NUL. */ return 0; } return 1; asciz_ended: if (!(style & QUOTE_OMIT_LEADING_TRAILING_QUOTES)) *s++ = '\"'; *s = '\0'; /* Return zero: we printed entire ASCIZ string (didn't truncate it) */ return 0; } #endif
the_stack_data/371655.c
// INFO: task hung in nbd_ioctl (3) // https://syzkaller.appspot.com/bug?id=10533a0420aea96ae38a // status:0 // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include <dirent.h> #include <endian.h> #include <errno.h> #include <fcntl.h> #include <signal.h> #include <stdarg.h> #include <stdbool.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/prctl.h> #include <sys/stat.h> #include <sys/syscall.h> #include <sys/types.h> #include <sys/wait.h> #include <time.h> #include <unistd.h> static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static bool write_file(const char* file, const char* what, ...) { char buf[1024]; va_list args; va_start(args, what); vsnprintf(buf, sizeof(buf), what, args); va_end(args); buf[sizeof(buf) - 1] = 0; int len = strlen(buf); int fd = open(file, O_WRONLY | O_CLOEXEC); if (fd == -1) return false; if (write(fd, buf, len) != len) { int err = errno; close(fd); errno = err; return false; } close(fd); return true; } const int kInitNetNsFd = 239; static long syz_open_dev(volatile long a0, volatile long a1, volatile long a2) { if (a0 == 0xc || a0 == 0xb) { char buf[128]; sprintf(buf, "/dev/%s/%d:%d", a0 == 0xc ? "char" : "block", (uint8_t)a1, (uint8_t)a2); return open(buf, O_RDWR, 0); } else { char buf[1024]; char* hash; strncpy(buf, (char*)a0, sizeof(buf) - 1); buf[sizeof(buf) - 1] = 0; while ((hash = strchr(buf, '#'))) { *hash = '0' + (char)(a1 % 10); a1 /= 10; } return open(buf, a2, 0); } } static long syz_init_net_socket(volatile long domain, volatile long type, volatile long proto) { return syscall(__NR_socket, domain, type, proto); } static void kill_and_wait(int pid, int* status) { kill(-pid, SIGKILL); kill(pid, SIGKILL); for (int i = 0; i < 100; i++) { if (waitpid(-1, status, WNOHANG | __WALL) == pid) return; usleep(1000); } DIR* dir = opendir("/sys/fs/fuse/connections"); if (dir) { for (;;) { struct dirent* ent = readdir(dir); if (!ent) break; if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) continue; char abort[300]; snprintf(abort, sizeof(abort), "/sys/fs/fuse/connections/%s/abort", ent->d_name); int fd = open(abort, O_WRONLY); if (fd == -1) { continue; } if (write(fd, abort, 1) < 0) { } close(fd); } closedir(dir); } else { } while (waitpid(-1, status, __WALL) != pid) { } } static void setup_test() { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); setpgrp(); write_file("/proc/self/oom_score_adj", "1000"); } static void execute_one(void); #define WAIT_FLAGS __WALL static void loop(void) { int iter = 0; for (;; iter++) { int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { setup_test(); execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5000) { continue; } kill_and_wait(pid, &status); break; } } } uint64_t r[3] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff}; void execute_one(void) { intptr_t res = 0; memcpy((void*)0x20000080, "/dev/nbd#\000", 10); res = -1; res = syz_open_dev(0x20000080, 0, 0x101040); if (res != -1) r[0] = res; res = -1; res = syz_init_net_socket(0x1f, 1, 0); if (res != -1) r[1] = res; res = syscall(__NR_dup, r[1]); if (res != -1) r[2] = res; syscall(__NR_ioctl, r[0], 0xab00, r[2]); syscall(__NR_ioctl, r[0], 0xab03, 0); } int main(void) { syscall(__NR_mmap, 0x1ffff000ul, 0x1000ul, 0ul, 0x32ul, -1, 0ul); syscall(__NR_mmap, 0x20000000ul, 0x1000000ul, 7ul, 0x32ul, -1, 0ul); syscall(__NR_mmap, 0x21000000ul, 0x1000ul, 0ul, 0x32ul, -1, 0ul); loop(); return 0; }
the_stack_data/116341.c
int funcD() { return 4; }
the_stack_data/131407.c
// Note: %s must be preceded by --, otherwise it may be interpreted as a // command-line option, e.g. on Mac where %s is commonly under /Users. // Alias options: // RUN: %clang_cl /c -### -- %s 2>&1 | FileCheck -check-prefix=c %s // c: -c // RUN: %clang_cl /C -### -- %s 2>&1 | FileCheck -check-prefix=C %s // C: error: invalid argument '/C' only allowed with '/E, /P or /EP' // RUN: %clang_cl /C /P -### -- %s 2>&1 | FileCheck -check-prefix=C_P %s // C_P: "-E" // C_P: "-C" // RUN: %clang_cl /d1reportAllClassLayout -### /c /WX -- %s 2>&1 | \ // RUN: FileCheck -check-prefix=d1reportAllClassLayout %s // d1reportAllClassLayout-NOT: warning: // d1reportAllClassLayout-NOT: error: // d1reportAllClassLayout: -fdump-record-layouts // RUN: %clang_cl /Dfoo=bar /D bar=baz /DMYDEF#value /DMYDEF2=foo#bar /DMYDEF3#a=b /DMYDEF4# \ // RUN: -### -- %s 2>&1 | FileCheck -check-prefix=D %s // D: "-D" "foo=bar" // D: "-D" "bar=baz" // D: "-D" "MYDEF=value" // D: "-D" "MYDEF2=foo#bar" // D: "-D" "MYDEF3=a=b" // D: "-D" "MYDEF4=" // RUN: %clang_cl /E -### -- %s 2>&1 | FileCheck -check-prefix=E %s // E: "-E" // E: "-o" "-" // RUN: %clang_cl /EP -### -- %s 2>&1 | FileCheck -check-prefix=EP %s // EP: "-E" // EP: "-P" // EP: "-o" "-" // RUN: %clang_cl /fp:fast /fp:except -### -- %s 2>&1 | FileCheck -check-prefix=fpexcept %s // fpexcept-NOT: -menable-unsafe-fp-math // RUN: %clang_cl /fp:fast /fp:except /fp:except- -### -- %s 2>&1 | FileCheck -check-prefix=fpexcept_ %s // fpexcept_: -menable-unsafe-fp-math // RUN: %clang_cl /fp:precise /fp:fast -### -- %s 2>&1 | FileCheck -check-prefix=fpfast %s // fpfast: -menable-unsafe-fp-math // fpfast: -ffast-math // RUN: %clang_cl /fp:fast /fp:precise -### -- %s 2>&1 | FileCheck -check-prefix=fpprecise %s // fpprecise-NOT: -menable-unsafe-fp-math // fpprecise-NOT: -ffast-math // RUN: %clang_cl /fp:fast /fp:strict -### -- %s 2>&1 | FileCheck -check-prefix=fpstrict %s // fpstrict-NOT: -menable-unsafe-fp-math // fpstrict-NOT: -ffast-math // RUN: %clang_cl /Z7 -gcolumn-info -### -- %s 2>&1 | FileCheck -check-prefix=gcolumn %s // gcolumn: -dwarf-column-info // RUN: %clang_cl /Z7 -gno-column-info -### -- %s 2>&1 | FileCheck -check-prefix=gnocolumn %s // gnocolumn-NOT: -dwarf-column-info // RUN: %clang_cl /Z7 -### -- %s 2>&1 | FileCheck -check-prefix=gdefcolumn %s // gdefcolumn-NOT: -dwarf-column-info // RUN: %clang_cl -### /FA -fprofile-instr-generate -- %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-INSTR-GENERATE %s // RUN: %clang_cl -### /FA -fprofile-instr-generate=/tmp/somefile.profraw -- %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-INSTR-GENERATE-FILE %s // CHECK-PROFILE-INSTR-GENERATE: "-fprofile-instrument=clang" "--dependent-lib={{[^"]*}}clang_rt.profile-{{[^"]*}}.lib" // CHECK-PROFILE-INSTR-GENERATE-FILE: "-fprofile-instrument-path=/tmp/somefile.profraw" // RUN: %clang_cl -### /FA -fprofile-generate -- %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-GENERATE %s // CHECK-PROFILE-GENERATE: "-fprofile-instrument=llvm" "--dependent-lib={{[^"]*}}clang_rt.profile-{{[^"]*}}.lib" // RUN: %clang_cl -### /FA -fprofile-instr-generate -fprofile-instr-use -- %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s // RUN: %clang_cl -### /FA -fprofile-instr-generate -fprofile-instr-use=file -- %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s // CHECK-NO-MIX-GEN-USE: '{{[a-z=-]*}}' not allowed with '{{[a-z=-]*}}' // RUN: %clang_cl -### /FA -fprofile-instr-use -- %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE %s // RUN: %clang_cl -### /FA -fprofile-instr-use=/tmp/somefile.prof -- %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE-FILE %s // CHECK-PROFILE-USE: "-fprofile-instrument-use-path=default.profdata" // CHECK-PROFILE-USE-FILE: "-fprofile-instrument-use-path=/tmp/somefile.prof" // RUN: %clang_cl /GA -### -- %s 2>&1 | FileCheck -check-prefix=GA %s // GA: -ftls-model=local-exec // RTTI is on by default; just check that we don't error. // RUN: %clang_cl /Zs /GR -- %s 2>&1 // RUN: %clang_cl /GR- -### -- %s 2>&1 | FileCheck -check-prefix=GR_ %s // GR_: -fno-rtti // Security Buffer Check is on by default. // RUN: %clang_cl -### -- %s 2>&1 | FileCheck -check-prefix=GS-default %s // GS-default: "-stack-protector" "2" // RUN: %clang_cl /GS -### -- %s 2>&1 | FileCheck -check-prefix=GS %s // GS: "-stack-protector" "2" // RUN: %clang_cl /GS- -### -- %s 2>&1 | FileCheck -check-prefix=GS_ %s // GS_-NOT: -stack-protector // RUN: %clang_cl /Gy -### -- %s 2>&1 | FileCheck -check-prefix=Gy %s // Gy: -ffunction-sections // RUN: %clang_cl /Gy /Gy- -### -- %s 2>&1 | FileCheck -check-prefix=Gy_ %s // Gy_-NOT: -ffunction-sections // RUN: %clang_cl /Gs -### -- %s 2>&1 | FileCheck -check-prefix=Gs %s // Gs: "-mstack-probe-size=4096" // RUN: %clang_cl /Gs0 -### -- %s 2>&1 | FileCheck -check-prefix=Gs0 %s // Gs0: "-mstack-probe-size=0" // RUN: %clang_cl /Gs4096 -### -- %s 2>&1 | FileCheck -check-prefix=Gs4096 %s // Gs4096: "-mstack-probe-size=4096" // RUN: %clang_cl /Gw -### -- %s 2>&1 | FileCheck -check-prefix=Gw %s // Gw: -fdata-sections // RUN: %clang_cl /Gw /Gw- -### -- %s 2>&1 | FileCheck -check-prefix=Gw_ %s // Gw_-NOT: -fdata-sections // RUN: %clang_cl /Imyincludedir -### -- %s 2>&1 | FileCheck -check-prefix=SLASH_I %s // RUN: %clang_cl /I myincludedir -### -- %s 2>&1 | FileCheck -check-prefix=SLASH_I %s // SLASH_I: "-I" "myincludedir" // RUN: %clang_cl /imsvcmyincludedir -### -- %s 2>&1 | FileCheck -check-prefix=SLASH_imsvc %s // RUN: %clang_cl /imsvc myincludedir -### -- %s 2>&1 | FileCheck -check-prefix=SLASH_imsvc %s // Clang's resource header directory should be first: // SLASH_imsvc: "-internal-isystem" "{{[^"]*}}lib{{(64)?/|\\\\}}clang{{[^"]*}}include" // SLASH_imsvc: "-internal-isystem" "myincludedir" // RUN: %clang_cl /J -### -- %s 2>&1 | FileCheck -check-prefix=J %s // J: -fno-signed-char // RUN: %clang_cl /Ofoo -### -- %s 2>&1 | FileCheck -check-prefix=O %s // O: /Ofoo // RUN: %clang_cl /Ob0 -### -- %s 2>&1 | FileCheck -check-prefix=Ob0 %s // Ob0: -fno-inline // RUN: %clang_cl /Ob2 -### -- %s 2>&1 | FileCheck -check-prefix=Ob2 %s // RUN: %clang_cl /Odb2 -### -- %s 2>&1 | FileCheck -check-prefix=Ob2 %s // RUN: %clang_cl /O2 /Ob2 -### -- %s 2>&1 | FileCheck -check-prefix=Ob2 %s // Ob2-NOT: warning: argument unused during compilation: '/O2' // Ob2: -finline-functions // RUN: %clang_cl /Ob1 -### -- %s 2>&1 | FileCheck -check-prefix=Ob1 %s // RUN: %clang_cl /Odb1 -### -- %s 2>&1 | FileCheck -check-prefix=Ob1 %s // Ob1: -finline-hint-functions // RUN: %clang_cl /Od -### -- %s 2>&1 | FileCheck -check-prefix=Od %s // Od: -O0 // RUN: %clang_cl /Oi- /Oi -### -- %s 2>&1 | FileCheck -check-prefix=Oi %s // Oi-NOT: -fno-builtin // RUN: %clang_cl /Oi- -### -- %s 2>&1 | FileCheck -check-prefix=Oi_ %s // Oi_: -fno-builtin // RUN: %clang_cl /Os --target=i686-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Os %s // RUN: %clang_cl /Os --target=x86_64-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Os %s // Os: -mframe-pointer=none // Os: -Os // RUN: %clang_cl /Ot --target=i686-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Ot %s // RUN: %clang_cl /Ot --target=x86_64-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Ot %s // Ot: -mframe-pointer=none // Ot: -O2 // RUN: %clang_cl /Ox --target=i686-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Ox %s // RUN: %clang_cl /Ox --target=x86_64-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Ox %s // Ox: -mframe-pointer=none // Ox: -O2 // RUN: %clang_cl --target=i686-pc-win32 /O2sy- -### -- %s 2>&1 | FileCheck -check-prefix=PR24003 %s // PR24003: -mframe-pointer=all // PR24003: -Os // RUN: %clang_cl --target=i686-pc-win32 -Werror /Oy- /O2 -### -- %s 2>&1 | FileCheck -check-prefix=Oy_2 %s // Oy_2: -mframe-pointer=all // Oy_2: -O2 // RUN: %clang_cl --target=aarch64-pc-windows-msvc -Werror /Oy- /O2 -### -- %s 2>&1 | FileCheck -check-prefix=Oy_aarch64 %s // Oy_aarch64: -mframe-pointer=all // Oy_aarch64: -O2 // RUN: %clang_cl --target=i686-pc-win32 -Werror /O2 /O2 -### -- %s 2>&1 | FileCheck -check-prefix=O2O2 %s // O2O2: "-O2" // RUN: %clang_cl /Zs -Werror /Oy -- %s 2>&1 // RUN: %clang_cl --target=i686-pc-win32 -Werror /Oy- -### -- %s 2>&1 | FileCheck -check-prefix=Oy_ %s // Oy_: -mframe-pointer=all // RUN: %clang_cl /Qvec -### -- %s 2>&1 | FileCheck -check-prefix=Qvec %s // Qvec: -vectorize-loops // RUN: %clang_cl /Qvec /Qvec- -### -- %s 2>&1 | FileCheck -check-prefix=Qvec_ %s // Qvec_-NOT: -vectorize-loops // RUN: %clang_cl /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes %s // showIncludes: --show-includes // RUN: %clang_cl /E /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes_E %s // RUN: %clang_cl /EP /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes_E %s // RUN: %clang_cl /E /EP /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes_E %s // RUN: %clang_cl /EP /P /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes_E %s // showIncludes_E-NOT: warning: argument unused during compilation: '--show-includes' // /source-charset: should warn on everything except UTF-8. // RUN: %clang_cl /source-charset:utf-16 -### -- %s 2>&1 | FileCheck -check-prefix=source-charset-utf-16 %s // source-charset-utf-16: invalid value 'utf-16' in '/source-charset:utf-16' // /execution-charset: should warn on everything except UTF-8. // RUN: %clang_cl /execution-charset:utf-16 -### -- %s 2>&1 | FileCheck -check-prefix=execution-charset-utf-16 %s // execution-charset-utf-16: invalid value 'utf-16' in '/execution-charset:utf-16' // // RUN: %clang_cl /Umymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s // RUN: %clang_cl /U mymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s // U: "-U" "mymacro" // RUN: %clang_cl /validate-charset -### -- %s 2>&1 | FileCheck -check-prefix=validate-charset %s // validate-charset: -Winvalid-source-encoding // RUN: %clang_cl /validate-charset- -### -- %s 2>&1 | FileCheck -check-prefix=validate-charset_ %s // validate-charset_: -Wno-invalid-source-encoding // RUN: %clang_cl /vd2 -### -- %s 2>&1 | FileCheck -check-prefix=VD2 %s // VD2: -vtordisp-mode=2 // RUN: %clang_cl /vmg -### -- %s 2>&1 | FileCheck -check-prefix=VMG %s // VMG: "-fms-memptr-rep=virtual" // RUN: %clang_cl /vmg /vms -### -- %s 2>&1 | FileCheck -check-prefix=VMS %s // VMS: "-fms-memptr-rep=single" // RUN: %clang_cl /vmg /vmm -### -- %s 2>&1 | FileCheck -check-prefix=VMM %s // VMM: "-fms-memptr-rep=multiple" // RUN: %clang_cl /vmg /vmv -### -- %s 2>&1 | FileCheck -check-prefix=VMV %s // VMV: "-fms-memptr-rep=virtual" // RUN: %clang_cl /vmg /vmb -### -- %s 2>&1 | FileCheck -check-prefix=VMB %s // VMB: '/vmg' not allowed with '/vmb' // RUN: %clang_cl /vmg /vmm /vms -### -- %s 2>&1 | FileCheck -check-prefix=VMX %s // VMX: '/vms' not allowed with '/vmm' // RUN: %clang_cl /volatile:iso -### -- %s 2>&1 | FileCheck -check-prefix=VOLATILE-ISO %s // VOLATILE-ISO-NOT: "-fms-volatile" // RUN: %clang_cl /volatile:ms -### -- %s 2>&1 | FileCheck -check-prefix=VOLATILE-MS %s // VOLATILE-MS: "-fms-volatile" // RUN: %clang_cl /W0 -### -- %s 2>&1 | FileCheck -check-prefix=W0 %s // W0: -w // RUN: %clang_cl /W1 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s // RUN: %clang_cl /W2 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s // RUN: %clang_cl /W3 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s // RUN: %clang_cl /W4 -### -- %s 2>&1 | FileCheck -check-prefix=W4 %s // RUN: %clang_cl /Wall -### -- %s 2>&1 | FileCheck -check-prefix=Weverything %s // W1: -Wall // W4: -WCL4 // Weverything: -Weverything // RUN: %clang_cl /WX -### -- %s 2>&1 | FileCheck -check-prefix=WX %s // WX: -Werror // RUN: %clang_cl /WX- -### -- %s 2>&1 | FileCheck -check-prefix=WX_ %s // WX_: -Wno-error // RUN: %clang_cl /w -### -- %s 2>&1 | FileCheck -check-prefix=w %s // w: -w // RUN: %clang_cl /Zp -### -- %s 2>&1 | FileCheck -check-prefix=ZP %s // ZP: -fpack-struct=1 // RUN: %clang_cl /Zp2 -### -- %s 2>&1 | FileCheck -check-prefix=ZP2 %s // ZP2: -fpack-struct=2 // RUN: %clang_cl /Zs -### -- %s 2>&1 | FileCheck -check-prefix=Zs %s // Zs: -fsyntax-only // RUN: %clang_cl /FIasdf.h -### -- %s 2>&1 | FileCheck -check-prefix=FI %s // FI: "-include" "asdf.h" // RUN: %clang_cl /FI asdf.h -### -- %s 2>&1 | FileCheck -check-prefix=FI_ %s // FI_: "-include" "asdf.h" // RUN: %clang_cl /TP /c -### -- %s 2>&1 | FileCheck -check-prefix=NO-GX %s // NO-GX-NOT: "-fcxx-exceptions" "-fexceptions" // RUN: %clang_cl /TP /c /GX -### -- %s 2>&1 | FileCheck -check-prefix=GX %s // GX: "-fcxx-exceptions" "-fexceptions" // RUN: %clang_cl /TP /c /GX /GX- -### -- %s 2>&1 | FileCheck -check-prefix=GX_ %s // GX_-NOT: "-fcxx-exceptions" "-fexceptions" // RUN: %clang_cl /d1PP -### -- %s 2>&1 | FileCheck -check-prefix=d1PP %s // d1PP: -dD // We forward any unrecognized -W diagnostic options to cc1. // RUN: %clang_cl -Wunused-pragmas -### -- %s 2>&1 | FileCheck -check-prefix=WJoined %s // WJoined: "-cc1" // WJoined: "-Wunused-pragmas" // We recognize -f[no-]strict-aliasing. // RUN: %clang_cl -c -### -- %s 2>&1 | FileCheck -check-prefix=DEFAULTSTRICT %s // DEFAULTSTRICT: "-relaxed-aliasing" // RUN: %clang_cl -c -fstrict-aliasing -### -- %s 2>&1 | FileCheck -check-prefix=STRICT %s // STRICT-NOT: "-relaxed-aliasing" // RUN: %clang_cl -c -fno-strict-aliasing -### -- %s 2>&1 | FileCheck -check-prefix=NOSTRICT %s // NOSTRICT: "-relaxed-aliasing" // We recognize -f[no-]delayed-template-parsing. // /Zc:twoPhase[-] has the opposite meaning. // RUN: %clang_cl -c -fmsc-version=1910 -### -- %s 2>&1 | FileCheck -check-prefix=OLDDELAYEDDEFAULT %s // OLDDELAYEDDEFAULT: "-fdelayed-template-parsing" // RUN: %clang_cl -fmsc-version=1911 -c -### -- %s 2>&1 | FileCheck -check-prefix=NEWDELAYEDDEFAULT %s // NEWDELAYEDDEFAULT-NOT: "-fdelayed-template-parsing" // RUN: %clang_cl -c -fmsc-version=1910 -fdelayed-template-parsing -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDON %s // RUN: %clang_cl -c -fmsc-version=1911 -fdelayed-template-parsing -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDON %s // RUN: %clang_cl -c -fmsc-version=1910 /Zc:twoPhase- -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDON %s // RUN: %clang_cl -c -fmsc-version=1911 /Zc:twoPhase- -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDON %s // DELAYEDON: "-fdelayed-template-parsing" // RUN: %clang_cl -c -fmsc-version=1910 -fno-delayed-template-parsing -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDOFF %s // RUN: %clang_cl -c -fmsc-version=1911 -fno-delayed-template-parsing -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDOFF %s // RUN: %clang_cl -c -fmsc-version=1910 /Zc:twoPhase -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDOFF %s // RUN: %clang_cl -c -fmsc-version=1911 /Zc:twoPhase -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDOFF %s // DELAYEDOFF-NOT: "-fdelayed-template-parsing" // RUN: %clang_cl -c -### /std:c++latest -- %s 2>&1 | FileCheck -check-prefix CHECK-LATEST-CHAR8_T %s // CHECK-LATEST-CHAR8_T-NOT: "-fchar8_t" // RUN: %clang_cl -c -### /Zc:char8_t -- %s 2>&1 | FileCheck -check-prefix CHECK-CHAR8_T %s // CHECK-CHAR8_T: "-fchar8_t" // RUN: %clang_cl -c -### /Zc:char8_t- -- %s 2>&1 | FileCheck -check-prefix CHECK-CHAR8_T_ %s // CHECK-CHAR8_T_: "-fno-char8_t" // For some warning ids, we can map from MSVC warning to Clang warning. // RUN: %clang_cl -wd4005 -wd4100 -wd4910 -wd4996 -### -- %s 2>&1 | FileCheck -check-prefix=Wno %s // Wno: "-cc1" // Wno: "-Wno-macro-redefined" // Wno: "-Wno-unused-parameter" // Wno: "-Wno-dllexport-explicit-instantiation-decl" // Wno: "-Wno-deprecated-declarations" // Ignored options. Check that we don't get "unused during compilation" errors. // RUN: %clang_cl /c \ // RUN: /analyze- \ // RUN: /bigobj \ // RUN: /cgthreads4 \ // RUN: /cgthreads8 \ // RUN: /d2FastFail \ // RUN: /d2Zi+ \ // RUN: /errorReport:foo \ // RUN: /execution-charset:utf-8 \ // RUN: /FC \ // RUN: /Fdfoo \ // RUN: /FS \ // RUN: /Gd \ // RUN: /GF \ // RUN: /GS- \ // RUN: /kernel- \ // RUN: /nologo \ // RUN: /Og \ // RUN: /openmp- \ // RUN: /permissive- \ // RUN: /RTC1 \ // RUN: /sdl \ // RUN: /sdl- \ // RUN: /source-charset:utf-8 \ // RUN: /utf-8 \ // RUN: /vmg \ // RUN: /volatile:iso \ // RUN: /w12345 \ // RUN: /wd1234 \ // RUN: /Zc:__cplusplus \ // RUN: /Zc:auto \ // RUN: /Zc:forScope \ // RUN: /Zc:inline \ // RUN: /Zc:rvalueCast \ // RUN: /Zc:ternary \ // RUN: /Zc:wchar_t \ // RUN: /Zm \ // RUN: /Zo \ // RUN: /Zo- \ // RUN: -### -- %s 2>&1 | FileCheck -check-prefix=IGNORED %s // IGNORED-NOT: argument unused during compilation // IGNORED-NOT: no such file or directory // Don't confuse /openmp- with the /o flag: // IGNORED-NOT: "-o" "penmp-.obj" // Ignored options and compile-only options are ignored for link jobs. // RUN: touch %t.obj // RUN: %clang_cl /nologo -### -- %t.obj 2>&1 | FileCheck -check-prefix=LINKUNUSED %s // RUN: %clang_cl /Dfoo -### -- %t.obj 2>&1 | FileCheck -check-prefix=LINKUNUSED %s // RUN: %clang_cl /MD -### -- %t.obj 2>&1 | FileCheck -check-prefix=LINKUNUSED %s // LINKUNUSED-NOT: argument unused during compilation // Support ignoring warnings about unused arguments. // RUN: %clang_cl /Abracadabra -Qunused-arguments -### -- %s 2>&1 | FileCheck -check-prefix=UNUSED %s // UNUSED-NOT: argument unused during compilation // Unsupported but parsed options. Check that we don't error on them. // (/Zs is for syntax-only) // RUN: %clang_cl /Zs \ // RUN: /await \ // RUN: /constexpr:depth1000 /constexpr:backtrace1000 /constexpr:steps1000 \ // RUN: /AIfoo \ // RUN: /AI foo_does_not_exist \ // RUN: /Bt \ // RUN: /Bt+ \ // RUN: /clr:pure \ // RUN: /d2FH4 \ // RUN: /docname \ // RUN: /EHsc \ // RUN: /F 42 \ // RUN: /FA \ // RUN: /FAc \ // RUN: /Fafilename \ // RUN: /FAs \ // RUN: /FAu \ // RUN: /favor:blend \ // RUN: /Fifoo \ // RUN: /Fmfoo \ // RUN: /FpDebug\main.pch \ // RUN: /Frfoo \ // RUN: /FRfoo \ // RUN: /FU foo \ // RUN: /Fx \ // RUN: /G1 \ // RUN: /G2 \ // RUN: /GA \ // RUN: /Gd \ // RUN: /Ge \ // RUN: /Gh \ // RUN: /GH \ // RUN: /GL \ // RUN: /GL- \ // RUN: /Gm \ // RUN: /Gm- \ // RUN: /Gr \ // RUN: /GS \ // RUN: /GT \ // RUN: /GX \ // RUN: /Gv \ // RUN: /Gz \ // RUN: /GZ \ // RUN: /H \ // RUN: /homeparams \ // RUN: /hotpatch \ // RUN: /JMC \ // RUN: /kernel \ // RUN: /LN \ // RUN: /MP \ // RUN: /o foo.obj \ // RUN: /ofoo.obj \ // RUN: /openmp \ // RUN: /openmp:experimental \ // RUN: /Qfast_transcendentals \ // RUN: /QIfist \ // RUN: /Qimprecise_fwaits \ // RUN: /Qpar \ // RUN: /Qpar-report:1 \ // RUN: /Qsafe_fp_loads \ // RUN: /Qspectre \ // RUN: /Qvec-report:2 \ // RUN: /u \ // RUN: /V \ // RUN: /volatile:ms \ // RUN: /wfoo \ // RUN: /WL \ // RUN: /Wp64 \ // RUN: /X \ // RUN: /Y- \ // RUN: /Yc \ // RUN: /Ycstdafx.h \ // RUN: /Yd \ // RUN: /Yl- \ // RUN: /Ylfoo \ // RUN: /Yustdafx.h \ // RUN: /Z7 \ // RUN: /Za \ // RUN: /Ze \ // RUN: /Zg \ // RUN: /Zi \ // RUN: /ZI \ // RUN: /Zl \ // RUN: /ZW:nostdlib \ // RUN: -- %s 2>&1 // We support -Xclang for forwarding options to cc1. // RUN: %clang_cl -Xclang hellocc1 -### -- %s 2>&1 | FileCheck -check-prefix=Xclang %s // Xclang: "-cc1" // Xclang: "hellocc1" // Files under /Users are often confused with the /U flag. (This could happen // for other flags too, but this is the one people run into.) // RUN: %clang_cl /c /Users/me/myfile.c -### 2>&1 | FileCheck -check-prefix=SlashU %s // SlashU: warning: '/Users/me/myfile.c' treated as the '/U' option // SlashU: note: Use '--' to treat subsequent arguments as filenames // RTTI is on by default. /GR- controls -fno-rtti-data. // RUN: %clang_cl /c /GR- -### -- %s 2>&1 | FileCheck -check-prefix=NoRTTI %s // NoRTTI: "-fno-rtti-data" // NoRTTI-NOT: "-fno-rtti" // RUN: %clang_cl /c /GR -### -- %s 2>&1 | FileCheck -check-prefix=RTTI %s // RTTI-NOT: "-fno-rtti-data" // RTTI-NOT: "-fno-rtti" // thread safe statics are off for versions < 19. // RUN: %clang_cl /c -### -fms-compatibility-version=18 -- %s 2>&1 | FileCheck -check-prefix=NoThreadSafeStatics %s // RUN: %clang_cl /Zc:threadSafeInit /Zc:threadSafeInit- /c -### -- %s 2>&1 | FileCheck -check-prefix=NoThreadSafeStatics %s // NoThreadSafeStatics: "-fno-threadsafe-statics" // RUN: %clang_cl /Zc:threadSafeInit /c -### -- %s 2>&1 | FileCheck -check-prefix=ThreadSafeStatics %s // ThreadSafeStatics-NOT: "-fno-threadsafe-statics" // RUN: %clang_cl /Zc:dllexportInlines- /c -### -- %s 2>&1 | FileCheck -check-prefix=NoDllExportInlines %s // NoDllExportInlines: "-fno-dllexport-inlines" // RUN: %clang_cl /Zc:dllexportInlines /c -### -- %s 2>&1 | FileCheck -check-prefix=DllExportInlines %s // DllExportInlines-NOT: "-fno-dllexport-inlines" // RUN: %clang_cl /fallback /Zc:dllexportInlines- /c -### -- %s 2>&1 | FileCheck -check-prefix=DllExportInlinesFallback %s // DllExportInlinesFallback: error: option '/Zc:dllexportInlines-' is ABI-changing and not compatible with '/fallback' // RUN: %clang_cl /Zi /c -### -- %s 2>&1 | FileCheck -check-prefix=Zi %s // Zi: "-gcodeview" // Zi: "-debug-info-kind=limited" // RUN: %clang_cl /Z7 /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7 %s // Z7: "-gcodeview" // Z7: "-debug-info-kind=limited" // RUN: %clang_cl /Zd /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7GMLT %s // Z7GMLT: "-gcodeview" // Z7GMLT: "-debug-info-kind=line-tables-only" // RUN: %clang_cl -gline-tables-only /c -### -- %s 2>&1 | FileCheck -check-prefix=ZGMLT %s // ZGMLT: "-gcodeview" // ZGMLT: "-debug-info-kind=line-tables-only" // RUN: %clang_cl /c -### -- %s 2>&1 | FileCheck -check-prefix=BreproDefault %s // BreproDefault: "-mincremental-linker-compatible" // RUN: %clang_cl /Brepro- /Brepro /c '-###' -- %s 2>&1 | FileCheck -check-prefix=Brepro %s // Brepro-NOT: "-mincremental-linker-compatible" // RUN: %clang_cl /Brepro /Brepro- /c '-###' -- %s 2>&1 | FileCheck -check-prefix=Brepro_ %s // Brepro_: "-mincremental-linker-compatible" // This test was super sneaky: "/Z7" means "line-tables", but "-gdwarf" occurs // later on the command line, so it should win. Interestingly the cc1 arguments // came out right, but had wrong semantics, because an invariant assumed by // CompilerInvocation was violated: it expects that at most one of {gdwarfN, // line-tables-only} appear. If you assume that, then you can safely use // Args.hasArg to test whether a boolean flag is present without caring // where it appeared. And for this test, it appeared to the left of -gdwarf // which made it "win". This test could not detect that bug. // RUN: %clang_cl /Z7 -gdwarf /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7_gdwarf %s // Z7_gdwarf: "-gcodeview" // Z7_gdwarf: "-debug-info-kind=limited" // Z7_gdwarf: "-dwarf-version=4" // RUN: %clang_cl -fmsc-version=1800 -TP -### -- %s 2>&1 | FileCheck -check-prefix=CXX11 %s // CXX11: -std=c++11 // RUN: %clang_cl -fmsc-version=1900 -TP -### -- %s 2>&1 | FileCheck -check-prefix=CXX14 %s // CXX14: -std=c++14 // RUN: %clang_cl -fmsc-version=1900 -TP -std:c++14 -### -- %s 2>&1 | FileCheck -check-prefix=STDCXX14 %s // STDCXX14: -std=c++14 // RUN: %clang_cl -fmsc-version=1900 -TP -std:c++17 -### -- %s 2>&1 | FileCheck -check-prefix=STDCXX17 %s // STDCXX17: -std=c++17 // RUN: %clang_cl -fmsc-version=1900 -TP -std:c++latest -### -- %s 2>&1 | FileCheck -check-prefix=STDCXXLATEST %s // STDCXXLATEST: -std=c++2a // RUN: env CL="/Gy" %clang_cl -### -- %s 2>&1 | FileCheck -check-prefix=ENV-CL %s // ENV-CL: "-ffunction-sections" // RUN: env CL="/Gy" _CL_="/Gy- -- %s" %clang_cl -### 2>&1 | FileCheck -check-prefix=ENV-_CL_ %s // ENV-_CL_-NOT: "-ffunction-sections" // RUN: env CL="%s" _CL_="%s" not %clang --rsp-quoting=windows -c // RUN: %clang_cl -### /c -flto -- %s 2>&1 | FileCheck -check-prefix=LTO %s // LTO: -flto // RUN: %clang_cl -### /c -flto=thin -- %s 2>&1 | FileCheck -check-prefix=LTO-THIN %s // LTO-THIN: -flto=thin // RUN: %clang_cl -### -Fe%t.exe -entry:main -flto -- %s 2>&1 | FileCheck -check-prefix=LTO-WITHOUT-LLD %s // LTO-WITHOUT-LLD: LTO requires -fuse-ld=lld // RUN: %clang_cl -### -- %s 2>&1 | FileCheck -check-prefix=NOCFGUARD %s // RUN: %clang_cl /guard:cf- -### -- %s 2>&1 | FileCheck -check-prefix=NOCFGUARD %s // NOCFGUARD-NOT: -cfguard // RUN: %clang_cl /guard:cf -### -- %s 2>&1 | FileCheck -check-prefix=CFGUARD %s // RUN: %clang_cl /guard:cf,nochecks -### -- %s 2>&1 | FileCheck -check-prefix=CFGUARD %s // RUN: %clang_cl /guard:nochecks -### -- %s 2>&1 | FileCheck -check-prefix=CFGUARD %s // CFGUARD: -cfguard // RUN: %clang_cl /guard:foo -### -- %s 2>&1 | FileCheck -check-prefix=CFGUARDINVALID %s // CFGUARDINVALID: invalid value 'foo' in '/guard:' // Accept "core" clang options. // (/Zs is for syntax-only, -Werror makes it fail hard on unknown options) // RUN: %clang_cl \ // RUN: --driver-mode=cl \ // RUN: -fblocks \ // RUN: -fcrash-diagnostics-dir=/foo \ // RUN: -fno-crash-diagnostics \ // RUN: -fno-blocks \ // RUN: -fbuiltin \ // RUN: -fno-builtin \ // RUN: -fno-builtin-strcpy \ // RUN: -fcolor-diagnostics \ // RUN: -fno-color-diagnostics \ // RUN: -fcoverage-mapping \ // RUN: -fno-coverage-mapping \ // RUN: -fdiagnostics-color \ // RUN: -fno-diagnostics-color \ // RUN: -fdebug-compilation-dir . \ // RUN: -fdiagnostics-parseable-fixits \ // RUN: -fdiagnostics-absolute-paths \ // RUN: -ferror-limit=10 \ // RUN: -fmsc-version=1800 \ // RUN: -fno-strict-aliasing \ // RUN: -fstrict-aliasing \ // RUN: -fsyntax-only \ // RUN: -fms-compatibility \ // RUN: -fno-ms-compatibility \ // RUN: -fms-extensions \ // RUN: -fno-ms-extensions \ // RUN: -Xclang -disable-llvm-passes \ // RUN: -resource-dir asdf \ // RUN: -resource-dir=asdf \ // RUN: -Wunused-variable \ // RUN: -fmacro-backtrace-limit=0 \ // RUN: -fstandalone-debug \ // RUN: -flimit-debug-info \ // RUN: -flto \ // RUN: -fmerge-all-constants \ // RUN: -no-canonical-prefixes \ // RUN: -march=skylake \ // RUN: -fbracket-depth=123 \ // RUN: -fprofile-generate \ // RUN: -fprofile-generate=dir \ // RUN: -fno-profile-generate \ // RUN: -fno-profile-instr-generate \ // RUN: -fno-profile-instr-use \ // RUN: -fcs-profile-generate \ // RUN: -fcs-profile-generate=dir \ // RUN: -ftime-trace \ // RUN: --version \ // RUN: -Werror /Zs -- %s 2>&1 // Accept clang options under the /clang: flag. // The first test case ensures that the SLP vectorizer is on by default and that // it's being turned off by the /clang:-fno-slp-vectorize flag. // RUN: %clang_cl -O2 -### -- %s 2>&1 | FileCheck -check-prefix=NOCLANG %s // NOCLANG: "--dependent-lib=libcmt" // NOCLANG-SAME: "-vectorize-slp" // NOCLANG-NOT: "--dependent-lib=msvcrt" // RUN: %clang_cl -O2 -MD /clang:-fno-slp-vectorize /clang:-MD /clang:-MF /clang:my_dependency_file.dep -### -- %s 2>&1 | FileCheck -check-prefix=CLANG %s // CLANG: "--dependent-lib=msvcrt" // CLANG-SAME: "-dependency-file" "my_dependency_file.dep" // CLANG-NOT: "--dependent-lib=libcmt" // CLANG-NOT: "-vectorize-slp" void f() { }
the_stack_data/23574634.c
/********************************************************************** # File Name: 1_create.c # Version: 1.0 # Mail: [email protected] # Created Time: 2017-03-20 ************************************************************************/ #include <stdio.h> #include <pthread.h> void *call_back(void *arg) { printf("call back is called ...\n"); printf("the create arg is %d", ((int *)arg)); //pthread_exit(100); } int main(int argc,char **argv) { pthread_t id; int back; void *para = malloc(4); para = 100; pthread_create( &id, NULL,call_back, para); pthread_join(id, NULL); return 0; }
the_stack_data/391313.c
/* PR c/22393 */ /* { dg-options "-O -std=gnu99" } */ __complex__ double foo (__complex__ double x) { return 1.0 / x * -1.0i; }
the_stack_data/133954.c
#include <stdio.h> struct sss{ int i1:14; int i2:31; int i3:26; }; static union u{ struct sss sss; unsigned char a[sizeof (struct sss)]; } u; int main (void) { int i; for (i = 0; i < sizeof (struct sss); i++) u.a[i] = 0; u.sss.i1 = 16383.0; for (i = 0; i < sizeof (struct sss); i++) printf ("%x ", u.a[i]); printf ("\n"); u.sss.i2 = 2147483647.0; for (i = 0; i < sizeof (struct sss); i++) printf ("%x ", u.a[i]); printf ("\n"); u.sss.i3 = 67108863.0; for (i = 0; i < sizeof (struct sss); i++) printf ("%x ", u.a[i]); printf ("\n"); return 0; }
the_stack_data/6388978.c
/** * Copyright (c) 2019 Rockchip Electronic Co.,Ltd * * SPDX-License-Identifier: Apache-2.0 ****************************************************************************** * @file vicap.c * @version V0.0.1 * @brief video capture device abstract for rk2108 * * Change Logs: * Date Author Notes * 2020-07-22 ISP Team first implementation * ****************************************************************************** */ #if defined(__RT_THREAD__) #include "drv_vicap_lite.h" #include "swallow.h" #elif defined(__RK_OS__) #include "driver/drv_vicap_lite.h" #endif #ifdef VICAP_LITE_MODULE_COMPILED #define VICAP_LITE_USE_IRQ 0 #define VIP_DEBUG 0 #if VIP_DEBUG #include <stdio.h> #define VIP_DBG(...) rt_kprintf("[VICAP_LITE]:");rt_kprintf(__VA_ARGS__) #else #define VIP_DBG(...) #endif #define VICAP_LITE_DT(x) ((x & 0x3f) << 10) #define VICAP_LITE_VC(x) ((x & 0x3) << 8) #if defined(__RT_THREAD__) struct rk_vicap_lite_device vicap_lite_instance; static void rk_vicap_lite_irq(int irq, void *param) { struct rk_vicap_lite_device *vicap_lite_dev = &vicap_lite_instance; rt_interrupt_enter(); #if VICAP_LITE_USE_IRQ rt_kprintf("(%s) enter %x \n", __FUNCTION__, *(uint32_t *)(VICAP_LITE_BASE + VICAP_LITE_MIPI_INTSTAT_OFFSET)); #endif /* clr all irq bits */ *(uint32_t *)(VICAP_LITE_BASE + VICAP_LITE_MIPI_INTSTAT_OFFSET) = 0x1fffff; rt_interrupt_leave(); } rt_err_t rk_rtthread_vicap_lite_control(struct rt_device *dev, int cmd, void *args) { struct rk_vicap_lite_cfg *cfg = (struct rk_vicap_lite_cfg *)args; struct rk_vicap_lite_device *vip = (struct rk_vicap_lite_device *)dev; struct VICAP_LITE_REG *pReg = vip->p_reg; rt_err_t ret; VIP_DBG("(%s) enter \n", __FUNCTION__); uint32_t ID_CTRL0 = VICAP_LITE_VC(cfg->vc) | VICAP_LITE_DT(cfg->dt) | 1; uint32_t ID_CTRL1 = (cfg->height << 16) | cfg->width; if (cmd == VICAP_LITE_ENABLE) { if (cfg->mipi_id == VICAP_LITE_MIPI_ID0) { pReg->MIPI_ID0_CTRL0 = ID_CTRL0; pReg->MIPI_ID0_CTRL1 = ID_CTRL1; pReg->MIPI_FRAME0_ADDR_Y_ID0 = cfg->addr_y[0]; pReg->MIPI_FRAME1_ADDR_Y_ID0 = cfg->addr_y[1]; pReg->MIPI_FRAME0_ADDR_UV_ID0 = cfg->addr_uv[0]; pReg->MIPI_FRAME1_ADDR_UV_ID0 = cfg->addr_uv[1]; pReg->MIPI_FRAME0_VLW_Y_ID0 = cfg->stride_y; pReg->MIPI_FRAME1_VLW_Y_ID0 = cfg->stride_y; pReg->MIPI_FRAME0_VLW_UV_ID0 = cfg->stride_uv; pReg->MIPI_FRAME1_VLW_UV_ID0 = cfg->stride_uv; #if VICAP_LITE_USE_IRQ pReg->MIPI_INTEN |= VICAP_LITE_MIPI_INTSTAT_FRAME0_DMA_END_ID0_INTST_MASK | VICAP_LITE_MIPI_INTSTAT_FRAME1_DMA_END_ID0_INTST_MASK; #endif } else if (cfg->mipi_id == VICAP_LITE_MIPI_ID1) { pReg->MIPI_ID1_CTRL0 = ID_CTRL0; pReg->MIPI_ID1_CTRL1 = ID_CTRL1; pReg->MIPI_FRAME0_ADDR_Y_ID1 = cfg->addr_y[0]; pReg->MIPI_FRAME1_ADDR_Y_ID1 = cfg->addr_y[1]; pReg->MIPI_FRAME0_ADDR_UV_ID1 = cfg->addr_uv[0]; pReg->MIPI_FRAME1_ADDR_UV_ID1 = cfg->addr_uv[1]; pReg->MIPI_FRAME0_VLW_Y_ID1 = cfg->stride_y; pReg->MIPI_FRAME1_VLW_Y_ID1 = cfg->stride_y; pReg->MIPI_FRAME0_VLW_UV_ID1 = cfg->stride_uv; pReg->MIPI_FRAME1_VLW_UV_ID1 = cfg->stride_uv; #if VICAP_LITE_USE_IRQ pReg->MIPI_INTEN |= VICAP_LITE_MIPI_INTSTAT_FRAME0_DMA_END_ID1_INTST_MASK | VICAP_LITE_MIPI_INTSTAT_FRAME1_DMA_END_ID1_INTST_MASK; #endif } else if (cfg->mipi_id == VICAP_LITE_MIPI_ID2) { pReg->MIPI_ID2_CTRL0 = ID_CTRL0; pReg->MIPI_ID2_CTRL1 = ID_CTRL1; pReg->MIPI_FRAME0_ADDR_Y_ID2 = cfg->addr_y[0]; pReg->MIPI_FRAME1_ADDR_Y_ID2 = cfg->addr_y[1]; pReg->MIPI_FRAME0_ADDR_UV_ID2 = cfg->addr_uv[0]; pReg->MIPI_FRAME1_ADDR_UV_ID2 = cfg->addr_uv[1]; pReg->MIPI_FRAME0_VLW_Y_ID2 = cfg->stride_y; pReg->MIPI_FRAME1_VLW_Y_ID2 = cfg->stride_y; pReg->MIPI_FRAME0_VLW_UV_ID2 = cfg->stride_uv; pReg->MIPI_FRAME1_VLW_UV_ID2 = cfg->stride_uv; #if VICAP_LITE_USE_IRQ pReg->MIPI_INTEN |= VICAP_LITE_MIPI_INTSTAT_FRAME0_DMA_END_ID2_INTST_MASK | VICAP_LITE_MIPI_INTSTAT_FRAME1_DMA_END_ID2_INTST_MASK; #endif } else { pReg->MIPI_ID3_CTRL1 = ID_CTRL0; pReg->MIPI_ID3_CTRL1 = ID_CTRL1; pReg->MIPI_FRAME0_ADDR_Y_ID3 = cfg->addr_y[0]; pReg->MIPI_FRAME1_ADDR_Y_ID3 = cfg->addr_y[1]; pReg->MIPI_FRAME0_ADDR_UV_ID3 = cfg->addr_uv[0]; pReg->MIPI_FRAME1_ADDR_UV_ID3 = cfg->addr_uv[1]; pReg->MIPI_FRAME0_VLW_Y_ID3 = cfg->stride_y; pReg->MIPI_FRAME1_VLW_Y_ID3 = cfg->stride_y; pReg->MIPI_FRAME0_VLW_UV_ID3 = cfg->stride_uv; pReg->MIPI_FRAME1_VLW_UV_ID3 = cfg->stride_uv; #if VICAP_LITE_USE_IRQ pReg->MIPI_INTEN |= VICAP_LITE_MIPI_INTSTAT_FRAME0_DMA_END_ID3_INTST_MASK | VICAP_LITE_MIPI_INTSTAT_FRAME1_DMA_END_ID3_INTST_MASK; #endif } } else if (cmd == VICAP_LITE_DISABLE) { if (cfg->mipi_id == VICAP_LITE_MIPI_ID0) { pReg->MIPI_ID0_CTRL0 = 0; } else if (cfg->mipi_id == VICAP_LITE_MIPI_ID1) { pReg->MIPI_ID1_CTRL0 = 0; } else if (cfg->mipi_id == VICAP_LITE_MIPI_ID2) { pReg->MIPI_ID2_CTRL0 = 0; } else if (cfg->mipi_id == VICAP_LITE_MIPI_ID3) { pReg->MIPI_ID3_CTRL0 = 0; } } VIP_DBG("(%s) exit \n", __FUNCTION__); return ret; } static rt_err_t rk_rtthread_vicap_lite_init(struct rt_device *dev) { struct rk_vicap_lite_device *vip; VIP_DBG("(%s) enter \n", __FUNCTION__); RT_ASSERT(dev != RT_NULL); vip = (struct rk_vicap_lite_device *)dev; if (vip->ops->init) { return (vip->ops->init(vip)); } VIP_DBG("(%s) exit \n", __FUNCTION__); return RT_ENOSYS; } static rt_err_t rk_rtthread_vicap_lite_open(struct rt_device *dev, rt_uint16_t oflag) { struct rk_vicap_lite_device *vip; VIP_DBG("(%s) enter \n", __FUNCTION__); RT_ASSERT(dev != RT_NULL) vip = (struct rk_vicap_lite_device *)dev; if (vip->ops->open) { return (vip->ops->open(vip, RT_DEVICE_OFLAG_RDWR)); } VIP_DBG("(%s) exit \n", __FUNCTION__); return RT_ENOSYS; } static rt_err_t rk_rtthread_vicap_lite_close(struct rt_device *dev) { struct rk_vicap_lite_device *vip; VIP_DBG("(%s) enter \n", __FUNCTION__); RT_ASSERT(dev != RT_NULL); vip = (struct rk_vicap_lite_device *)dev; if (vip->ops->close) { return vip->ops->close(vip); } VIP_DBG("(%s) exit \n", __FUNCTION__); return RT_ENOSYS; } const static struct rt_device_ops rk_vicap_lite_dev_ops = { rk_rtthread_vicap_lite_init, rk_rtthread_vicap_lite_open, rk_rtthread_vicap_lite_close, RT_NULL, RT_NULL, rk_rtthread_vicap_lite_control }; int rk_rtthread_vicap_lite_register(void) { int ret; struct rt_device *device; struct rk_vicap_lite_device *vip; VIP_DBG("(%s) enter \n", __FUNCTION__); vip = (struct rk_vicap_lite_device *)&vicap_lite_instance; vip->p_reg = (struct VICAP_LITE_REG *)VICAP_LITE_BASE; device = &(vip->dev); device->type = RT_Device_Class_Miscellaneous; device->rx_indicate = RT_NULL; device->tx_complete = RT_NULL; #ifdef RT_USING_DEVICE_OPS device->ops = &rk_vicap_lite_dev_ops; #else device->init = RT_NULL; device->open = RT_NULL; device->close = RT_NULL; device->read = RT_NULL; device->write = RT_NULL; device->control = rk_rtthread_vicap_lite_control; #endif vip->vicap_lite_isr = (rt_isr_handler_t)&rk_vicap_lite_irq; vip->irq = VICAP_IRQn; rt_hw_interrupt_install(vip->irq, vip->vicap_lite_isr, RT_NULL, RT_NULL); rt_hw_interrupt_umask(vip->irq); /* frame start irq */ /* y_fifo_overflow irq */ /* uv_fifo_overflow irq */ /* bus error irq */ /* csi2rx_fifo_overflow irq */ vip->p_reg->MIPI_INTEN = VICAP_LITE_MIPI_INTSTAT_BUS_ERR_INTST_MASK | VICAP_LITE_MIPI_INTSTAT_CSI2RX_FIFO_OVERFLOW_INTST_MASK | VICAP_LITE_MIPI_INTSTAT_BANDWIDTH_LACK_INTST_MASK | VICAP_LITE_MIPI_INTSTAT_CONFIG_FIFO_OVERFLOW_INTST_MASK | VICAP_LITE_MIPI_INTSTAT_DMA_UV_FIFO_OVERFLOW_INTST_MASK | VICAP_LITE_MIPI_INTSTAT_DMA_Y_FIFO_OVERFLOW_INTST_MASK; ret = rt_device_register(device, "vicap_lite", RT_DEVICE_FLAG_RDWR); VIP_DBG("(%s) exit \n", __FUNCTION__); return ret; } #endif #if defined(__RT_THREAD__) INIT_DEVICE_EXPORT(rk_rtthread_vicap_lite_register); #endif #endif
the_stack_data/43887206.c
// Copyright 2015 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build gccgo // +build !aix #include <errno.h> #include <stdint.h> #include <unistd.h> #define _STRINGIFY2_(x) #x #define _STRINGIFY_(x) _STRINGIFY2_(x) #define GOSYM_PREFIX _STRINGIFY_(__USER_LABEL_PREFIX__) // Call syscall from C code because the gccgo support for calling from // Go to C does not support varargs functions. struct ret { uintptr_t r; uintptr_t err; }; struct ret gccgoRealSyscall(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9) { struct ret r; errno = 0; r.r = syscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9); r.err = errno; return r; } uintptr_t gccgoRealSyscallNoError(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9) { return syscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
the_stack_data/75269.c
#include <stdio.h> #include <stdlib.h> #include "omp.h" #define MAX 100 #define STEPS 100 void generate_random_array(int arr[MAX], int N) { int i; for (i = 0; i < N; i++) { arr[i] = rand() % 1000; } } void merge_sort(int arr[MAX], int low, int high) { int N = high - low; int mid = low + N/2; if (N <= 1) return; #pragma omp parallel sections { #pragma omp section merge_sort(arr, low, mid); #pragma omp section merge_sort(arr, mid, high); } int temp[N], i = low, j = mid, k; for (k = 0; k < N; k++) { if (j == high) temp[k] = arr[i++]; else if (i == mid) temp[k] = arr[j++]; else if (arr[i] < arr[j]) temp[k] = arr[i++]; else temp[k] = arr[j++]; } for (k = 0; k < N; k++) arr[low + k] = temp[k]; } int main() { printf ("Merge sort algorithm\n"); omp_set_num_threads(5); int i, j; int arr[MAX]; for (i = 100; i <= MAX; i += STEPS) { printf ("\nGenerating random array of size %d \n", i); generate_random_array(arr, i); printf ("\nSorting\n"); merge_sort(arr, 0, i); for (j = 0; j < i; j++) printf ("%d ", arr[j]); printf ("\n"); } return 0; }
the_stack_data/87636880.c
// Copyright (c) 2015 Nuxi, https://nuxi.nl/ // // SPDX-License-Identifier: BSD-2-Clause #include <locale.h> #include <stdarg.h> #include <stdio.h> int asprintf_l(char **s, locale_t locale, const char *format, ...) { va_list ap; va_start(ap, format); int result = vasprintf_l(s, locale, format, ap); va_end(ap); return result; }
the_stack_data/212131.c
extern void __VERIFIER_error() __attribute__ ((__noreturn__)); /********************************************************************** Copyright (c) 2013 Carnegie Mellon University. All Rights Reserved. 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 acknowledgments and disclaimers. 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. The names "Carnegie Mellon University," "SEI" and/or "Software Engineering Institute" shall not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact [email protected]. 4. Products derived from this software may not be called "SEI" nor may "SEI" appear in their names without prior written permission of [email protected]. 5. Redistributions of any form whatsoever must retain the following acknowledgment: This material is based upon work funded and supported by the Department of Defense under Contract No. FA8721-05-C-0003 with Carnegie Mellon University for the operation of the Software Engineering Institute, a federally funded research and development center. Any opinions, findings and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the United States Department of Defense. NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING INSTITUTE MATERIAL IS FURNISHEDON AN "AS-IS" BASIS. CARNEGIE MELLON UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. This material has been approved for public release and unlimited distribution. DM-0000575 **********************************************************************/ /* Generated by CIL v. 1.4.0 */ /* print_CIL_Input is true */ #line 1 "<startrek builtins>" _Bool __startrek_Assert_t3_i0[8] = #line 1 "<startrek builtins>" {1, 1, 1, 1, 1, 1, 1, 1}; #line 1 "<startrek builtins>" _Bool __startrek_Assert_t2_i0[8] = #line 1 {1, 1, 1, 1, 1, 1, 1, 1}; #line 1 "<startrek builtins>" _Bool __startrek_Assert_t1_i0[8] = #line 1 {1, 1, 1, 1, 1, 1, 1, 1}; #line 1 "<startrek builtins>" _Bool __startrek_Assert_t0_i0[4] = {1, 1, 1, 1}; #line 1 "<startrek builtins>" unsigned char __startrek_start_t3[8] ; #line 1 "<startrek builtins>" unsigned char __startrek_end_t3[8] ; #line 1 "<startrek builtins>" unsigned char __startrek_start_t2[8] ; #line 1 "<startrek builtins>" unsigned char __startrek_end_t2[8] ; #line 1 "<startrek builtins>" unsigned char __startrek_start_t1[8] ; #line 1 "<startrek builtins>" unsigned char __startrek_end_t1[8] ; #line 1 "<startrek builtins>" unsigned char __startrek_start_t0[4] ; #line 1 "<startrek builtins>" unsigned char __startrek_end_t0[4] ; void __startrek_init_shared(void) ; #line 1 __inline static void __startrek_assert_i0(_Bool arg ) ; #line 1 __inline static _Bool __startrek_cs_t3(void) ; #line 1 __inline static _Bool __startrek_cs_t2(void) ; #line 1 __inline static _Bool __startrek_cs_t1(void) ; #line 1 __inline static _Bool __startrek_cs_t0(void) ; unsigned short __VERIFIER_nondet_ushort(void) ; _Bool __VERIFIER_nondet__Bool(void) ; int __VERIFIER_nondet_int(void) ; char __VERIFIER_nondet_char(void) ; unsigned char __VERIFIER_nondet_uchar(void) ; _Bool __VERIFIER_nondet_bool(void) ; #line 1 "<startrek builtins>" unsigned char __startrek_task ; #line 1 "<startrek builtins>" unsigned char __startrek_job ; #line 1 "<startrek builtins>" unsigned char __startrek_job_end ; #line 1 "<startrek builtins>" unsigned char __startrek_error_round ; #line 1 "<startrek builtins>" unsigned char __startrek_round ; #line 1 "<startrek builtins>" _Bool __startrek_lock = (_Bool)0; #line 1 "<startrek builtins>" _Bool __startrek_is_first_cs ; #line 1 "<startrek builtins>" unsigned char __startrek_hyper_period ; #line 1 "ctm.bug2.o" #pragma merger(0,"/tmp/aaaa/ctm.bug2.i","-S") #line 15 "src/startrek.h" extern void __startrek_cpu_lock(void) ; #line 16 extern void __startrek_cpu_unlock(void) ; #line 25 extern void __VERIFIER_assume(_Bool ) ; #line 26 void assert(_Bool arg) { if (!arg) { ERROR: __VERIFIER_error();} } #line 171 "src/startrek.h" int __startrek_pi_locks_held = 0; #line 178 "src/startrek.h" char __startrek_task_base_priority = 0; #line 1 "<startrek builtins>" __inline static char __startrek_read___startrek_current_priority(void) ; #line 1 __inline static void __startrek_write___startrek_current_priority(char arg ) ; #line 1 "<startrek builtins>" char ___startrek_current_priority_[28] ; #line 1 "<startrek builtins>" char _i___startrek_current_priority_[28] ; #line 179 "src/startrek.h" char __startrek_hidden___startrek_current_priority = 0; #line 46 "src/verification.h" extern unsigned char __VERIFIER_nondet_U8() ; #line 47 extern _Bool __VERIFIER_nondet_Bool() ; #line 1 "<startrek builtins>" __inline static int __startrek_read_R_count(void) ; #line 1 __inline static void __startrek_write_R_count(int arg ) ; #line 1 "<startrek builtins>" int _R_count_[28] ; #line 1 "<startrek builtins>" int _i_R_count_[28] ; #line 50 "src/verification.h" int __startrek_hidden_R_count = 0; #line 1 "<startrek builtins>" __inline static char __startrek_read_R_speed(void) ; #line 1 __inline static void __startrek_write_R_speed(char arg ) ; #line 1 "<startrek builtins>" char _R_speed_[28] ; #line 1 "<startrek builtins>" char _i_R_speed_[28] ; #line 51 "src/verification.h" char __startrek_hidden_R_speed = 0; #line 1 "<startrek builtins>" __inline static int __startrek_read_W_count(void) ; #line 1 __inline static void __startrek_write_W_count(int arg ) ; #line 1 "<startrek builtins>" int _W_count_[28] ; #line 1 "<startrek builtins>" int _i_W_count_[28] ; #line 52 "src/verification.h" int __startrek_hidden_W_count = 0; #line 1 "<startrek builtins>" __inline static char __startrek_read_W_speed(void) ; #line 1 __inline static void __startrek_write_W_speed(char arg ) ; #line 1 "<startrek builtins>" char _W_speed_[28] ; #line 1 "<startrek builtins>" char _i_W_speed_[28] ; #line 53 "src/verification.h" char __startrek_hidden_W_speed = 0; #line 1 "<startrek builtins>" __inline static int __startrek_read_T_count(void) ; #line 1 __inline static void __startrek_write_T_count(int arg ) ; #line 1 "<startrek builtins>" int _T_count_[28] ; #line 1 "<startrek builtins>" int _i_T_count_[28] ; #line 54 "src/verification.h" int __startrek_hidden_T_count = 0; #line 1 "<startrek builtins>" __inline static char __startrek_read_T_speed(void) ; #line 1 __inline static void __startrek_write_T_speed(char arg ) ; #line 1 "<startrek builtins>" char _T_speed_[28] ; #line 1 "<startrek builtins>" char _i_T_speed_[28] ; #line 55 "src/verification.h" char __startrek_hidden_T_speed = 0; #line 57 "src/verification.h" int calibrate(void) { unsigned char tmp ; { #line 59 tmp = __VERIFIER_nondet_U8(); #line 59 return (tmp); } } #line 1 "<startrek builtins>" __inline static unsigned char __startrek_read_nxtcolorsensor_data_mode(void) ; #line 1 __inline static void __startrek_write_nxtcolorsensor_data_mode(unsigned char arg ) ; #line 1 "<startrek builtins>" unsigned char _nxtcolorsensor_data_mode_[28] ; #line 1 "<startrek builtins>" unsigned char _i_nxtcolorsensor_data_mode_[28] ; #line 63 "src/verification.h" unsigned char __startrek_hidden_nxtcolorsensor_data_mode ; #line 1 "<startrek builtins>" __inline static unsigned char __startrek_read_nxtcolorsensor_mode(void) ; #line 1 __inline static void __startrek_write_nxtcolorsensor_mode(unsigned char arg ) ; #line 1 "<startrek builtins>" unsigned char _nxtcolorsensor_mode_[28] ; #line 1 "<startrek builtins>" unsigned char _i_nxtcolorsensor_mode_[28] ; #line 66 "src/verification.h" unsigned char __startrek_hidden_nxtcolorsensor_mode ; #line 69 "src/verification.h" void ecrobot_set_nxtcolorsensor(unsigned char port_id , unsigned char mode ) { { #line 71 __startrek_write_nxtcolorsensor_data_mode(mode); #line 72 return; } } #line 74 "src/verification.h" unsigned char ecrobot_get_nxtcolorsensor_mode(unsigned char port_id ) { unsigned char tmp ; { #line 76 tmp = __startrek_read_nxtcolorsensor_mode(); #line 76 return (tmp); } } #line 79 "src/verification.h" void bg_nxtcolorsensor(_Bool take_long_time ) { unsigned char tmp ; unsigned char tmp___0 ; unsigned char tmp___1 ; { #line 81 tmp___0 = __startrek_read_nxtcolorsensor_data_mode(); #line 81 tmp___1 = __startrek_read_nxtcolorsensor_mode(); #line 81 if (tmp___0 != tmp___1) { #line 90 tmp = __startrek_read_nxtcolorsensor_data_mode(); #line 90 __startrek_write_nxtcolorsensor_mode(tmp); } #line 92 return; } } #line 101 "src/verification.h" _Bool ecrobot_is_ENTER_button_pressed(void) { _Bool tmp ; { #line 103 tmp = __VERIFIER_nondet_Bool(); #line 103 return (tmp); } } #line 106 "src/verification.h" void nxt_motor_set_speed(unsigned int n , int speed , _Bool b ) { unsigned char diff ; char prev_speed ; int tmp ; int tmp___0 ; int tmp___1 ; int tmp___2 ; int tmp___3 ; int tmp___4 ; { #line 111 switch (n) { case 0: #line 113 prev_speed = __startrek_read_R_speed(); #line 114 if (prev_speed != 0) { #line 115 diff = __VERIFIER_nondet_U8(); #line 116 tmp = __startrek_read_R_count(); #line 116 if (prev_speed > 0) { #line 116 tmp___0 = diff; } else { #line 116 tmp___0 = - ((int )diff); } #line 116 __startrek_write_R_count(tmp + tmp___0); } #line 118 __startrek_write_R_speed(speed); #line 119 return; case 1: #line 122 prev_speed = __startrek_read_W_speed(); #line 123 if (prev_speed != 0) { #line 124 diff = __VERIFIER_nondet_U8(); #line 125 tmp___1 = __startrek_read_W_count(); #line 125 if (prev_speed > 0) { #line 125 tmp___2 = diff; } else { #line 125 tmp___2 = - ((int )diff); } #line 125 __startrek_write_W_count(tmp___1 + tmp___2); } #line 127 __startrek_write_W_speed(speed); #line 128 return; case 2: #line 131 prev_speed = __startrek_read_T_speed(); #line 132 if (prev_speed != 0) { #line 133 diff = __VERIFIER_nondet_U8(); #line 134 tmp___3 = __startrek_read_T_count(); #line 134 if (prev_speed > 0) { #line 134 tmp___4 = diff; } else { #line 134 tmp___4 = - ((int )diff); } #line 134 __startrek_write_T_count(tmp___3 + tmp___4); } #line 136 __startrek_write_T_speed(speed); #line 137 return; } #line 139 return; } } #line 141 "src/verification.h" int nxt_motor_get_count(unsigned int n ) { unsigned char delta ; int new_count ; int count ; char speed ; char tmp ; char tmp___0 ; char tmp___1 ; { #line 146 count = 0; #line 147 speed = 0; #line 149 switch (n) { case 0: #line 151 tmp = __startrek_read_R_speed(); #line 151 speed = tmp; #line 152 count = __startrek_read_R_count(); #line 153 if ((int )speed == 0) { #line 154 return (count); } else { #line 156 delta = __VERIFIER_nondet_U8(); #line 157 if (count + (int )speed > 0) { #line 157 new_count = delta; } else { #line 157 new_count = - ((int )delta); } #line 158 __startrek_write_R_count(new_count); } #line 160 break; case 1: #line 163 tmp___0 = __startrek_read_W_speed(); #line 163 speed = tmp___0; #line 164 count = __startrek_read_W_count(); #line 165 if ((int )speed == 0) { #line 166 return (count); } else { #line 168 delta = __VERIFIER_nondet_U8(); #line 169 if (count + (int )speed > 0) { #line 169 new_count = delta; } else { #line 169 new_count = - ((int )delta); } #line 170 __startrek_write_W_count(new_count); } #line 172 break; case 2: #line 175 tmp___1 = __startrek_read_T_speed(); #line 175 speed = tmp___1; #line 176 count = __startrek_read_T_count(); #line 177 if ((int )speed == 0) { #line 178 return (count); } else { #line 180 delta = __VERIFIER_nondet_U8(); #line 181 if (count + (int )speed > 0) { #line 181 new_count = delta; } else { #line 181 new_count = - ((int )delta); } #line 182 __startrek_write_T_count(new_count); } #line 184 break; default: ; } #line 188 return (new_count); } } #line 191 "src/verification.h" void nxt_motor_set_count(unsigned int n , int count ) { { #line 194 switch (n) { case 0: #line 196 __startrek_write_R_count(count); #line 197 break; case 1: #line 200 __startrek_write_W_count(count); #line 201 break; case 2: #line 204 __startrek_write_T_count(count); #line 205 break; } #line 207 return; } } #line 210 "src/verification.h" unsigned char ecrobot_get_nxtcolorsensor_light(unsigned char port ) { unsigned char tmp ; { #line 212 tmp = __VERIFIER_nondet_U8(); #line 212 return (tmp); } } #line 216 "src/verification.h" void TerminateTask(void) { { #line 218 return; } } #line 25 "src/ctm.bug2.c" unsigned char state = 0; #line 1 "<startrek builtins>" __inline static _Bool __startrek_read_input(void) ; #line 1 __inline static void __startrek_write_input(_Bool arg ) ; #line 1 "<startrek builtins>" _Bool _input_[28] ; #line 1 "<startrek builtins>" _Bool _i_input_[28] ; #line 26 "src/ctm.bug2.c" _Bool __startrek_hidden_input ; #line 1 "<startrek builtins>" __inline static _Bool __startrek_read_output(void) ; #line 1 __inline static void __startrek_write_output(_Bool arg ) ; #line 1 "<startrek builtins>" _Bool _output_[28] ; #line 1 "<startrek builtins>" _Bool _i_output_[28] ; #line 27 "src/ctm.bug2.c" _Bool __startrek_hidden_output ; #line 1 "<startrek builtins>" __inline static _Bool __startrek_read_dir(void) ; #line 1 __inline static void __startrek_write_dir(_Bool arg ) ; #line 1 "<startrek builtins>" _Bool _dir_[28] ; #line 1 "<startrek builtins>" _Bool _i_dir_[28] ; #line 28 "src/ctm.bug2.c" _Bool __startrek_hidden_dir ; #line 1 "<startrek builtins>" __inline static _Bool __startrek_read_need_to_read(void) ; #line 1 __inline static void __startrek_write_need_to_read(_Bool arg ) ; #line 1 "<startrek builtins>" _Bool _need_to_read_[28] ; #line 1 "<startrek builtins>" _Bool _i_need_to_read_[28] ; #line 29 "src/ctm.bug2.c" _Bool __startrek_hidden_need_to_read = 1; #line 1 "<startrek builtins>" __inline static _Bool __startrek_read_need_to_run_nxtbg(void) ; #line 1 __inline static void __startrek_write_need_to_run_nxtbg(_Bool arg ) ; #line 1 "<startrek builtins>" _Bool _need_to_run_nxtbg_[28] ; #line 1 "<startrek builtins>" _Bool _i_need_to_run_nxtbg_[28] ; #line 30 "src/ctm.bug2.c" _Bool __startrek_hidden_need_to_run_nxtbg = 0; #line 31 "src/ctm.bug2.c" _Bool moved ; #line 1 "<startrek builtins>" __inline static unsigned short __startrek_read_threshold(void) ; #line 1 __inline static void __startrek_write_threshold(unsigned short arg ) ; #line 1 "<startrek builtins>" unsigned short _threshold_[28] ; #line 1 "<startrek builtins>" unsigned short _i_threshold_[28] ; #line 35 "src/ctm.bug2.c" unsigned short __startrek_hidden_threshold = 200; #line 1 "<startrek builtins>" __inline static unsigned char __startrek_read_R_state(void) ; #line 1 __inline static void __startrek_write_R_state(unsigned char arg ) ; #line 1 "<startrek builtins>" unsigned char _R_state_[28] ; #line 1 "<startrek builtins>" unsigned char _i_R_state_[28] ; #line 37 "src/ctm.bug2.c" unsigned char __startrek_hidden_R_state = 0; #line 1 "<startrek builtins>" __inline static unsigned char __startrek_read_W_state(void) ; #line 1 __inline static void __startrek_write_W_state(unsigned char arg ) ; #line 1 "<startrek builtins>" unsigned char _W_state_[28] ; #line 1 "<startrek builtins>" unsigned char _i_W_state_[28] ; #line 38 "src/ctm.bug2.c" unsigned char __startrek_hidden_W_state = 0; #line 1 "<startrek builtins>" __inline static unsigned char __startrek_read_T_state(void) ; #line 1 __inline static void __startrek_write_T_state(unsigned char arg ) ; #line 1 "<startrek builtins>" unsigned char _T_state_[28] ; #line 1 "<startrek builtins>" unsigned char _i_T_state_[28] ; #line 39 "src/ctm.bug2.c" unsigned char __startrek_hidden_T_state = 0; #line 40 "src/ctm.bug2.c" unsigned char C_state = 0; #line 41 "src/ctm.bug2.c" unsigned char TM_mode = 2; #line 1 "src/negation.c" _Bool transition(unsigned short in_state , _Bool input___0 ) { _Bool halt ; { #line 3 halt = 0; #line 4 switch (in_state) { case 0: #line 6 if ((int )input___0 == 0) { #line 7 __startrek_write_output(1); #line 8 state = 0; #line 9 __startrek_write_dir(0); } else { #line 11 __startrek_write_output(0); #line 12 state = 0; #line 13 __startrek_write_dir(0); } #line 15 break; } #line 17 return (halt); } } #line 51 "src/ctm.bug2.c" void init(void) { { #line 53 __startrek_write_R_state(0); #line 54 __startrek_write_W_state(0); #line 55 __startrek_write_T_state(0); #line 57 nxt_motor_set_count(0, 0); #line 58 nxt_motor_set_count(1, 0); #line 59 nxt_motor_set_count(2, 0); #line 62 C_state = 0; #line 63 state = 0; #line 64 __startrek_write_need_to_read(1); #line 65 __startrek_write_need_to_run_nxtbg(0); #line 66 moved = 0; #line 67 return; } } #line 107 "src/ctm.bug2.c" _Bool move_motor(unsigned int n , int speed_percent , int target_count , int sign ) { int count ; int tmp ; int speed ; _Bool ret ; { #line 109 tmp = nxt_motor_get_count(n); #line 109 count = tmp; #line 111 ret = 0; #line 114 if (sign * count >= sign * target_count) { #line 115 speed = 0; #line 116 ret = 1; } else { #line 118 if (sign * (target_count - count) < 60) { #line 119 speed = sign * 15; } else { #line 121 speed = sign * speed_percent; } #line 123 ret = 0; } #line 127 nxt_motor_set_speed(n, speed, 1); #line 128 return (ret); } } #line 132 "src/ctm.bug2.c" void Controller(void) { int old_state ; _Bool tmp ; int tmp___0 ; unsigned short tmp___1 ; int tmp___2 ; unsigned char tmp___3 ; int tmp___4 ; unsigned char tmp___5 ; _Bool tmp___6 ; _Bool tmp___7 ; _Bool tmp___8 ; int tmp___9 ; unsigned char tmp___10 ; int tmp___11 ; unsigned char tmp___12 ; _Bool tmp___13 ; _Bool tmp___14 ; unsigned char tmp___15 ; unsigned char tmp___16 ; _Bool tmp___17 ; { #line 134 old_state = state; #line 135 tmp = __startrek_read_need_to_run_nxtbg(); #line 135 if (tmp) { #line 136 bg_nxtcolorsensor(1); #line 137 __startrek_write_need_to_run_nxtbg(0); } #line 140 switch (TM_mode) { case 0: #line 142 tmp___0 = calibrate(); #line 142 __startrek_write_threshold(tmp___0); #line 143 tmp___1 = __startrek_read_threshold(); #line 143 if (tmp___1 > 0) { #line 144 TM_mode = 1; } #line 146 break; case 1: #line 150 init(); #line 151 TM_mode = 3; #line 152 break; case 2: #line 155 switch (C_state) { case 0: #line 157 tmp___6 = __startrek_read_need_to_read(); #line 157 if (tmp___6) { #line 158 tmp___4 = nxt_motor_get_count(0); #line 158 if (tmp___4 < 45) { #line 158 tmp___5 = __startrek_read_R_state(); #line 158 if (tmp___5 == 0) { #line 159 __startrek_write_R_state(1); } else { #line 158 goto _L; } } else { _L: /* CIL Label */ #line 160 tmp___2 = nxt_motor_get_count(0); #line 160 if (tmp___2 >= 45) { #line 160 tmp___3 = __startrek_read_R_state(); #line 160 if (tmp___3 == 0) { #line 161 __startrek_write_R_state(3); } } } } else { #line 164 __startrek_write_R_state(0); #line 165 C_state = 1; } #line 167 break; case 1: #line 170 old_state = state; #line 171 tmp___7 = __startrek_read_input(); #line 171 tmp___8 = transition(state, tmp___7); #line 171 if (tmp___8) { #line 172 TM_mode = 3; } else { #line 174 C_state = 2; } #line 176 break; case 2: #line 181 tmp___13 = __startrek_read_input(); #line 181 tmp___14 = __startrek_read_output(); #line 181 if (tmp___13 != tmp___14) { #line 183 tmp___9 = nxt_motor_get_count(0); #line 183 if (tmp___9 > 0) { #line 183 tmp___10 = __startrek_read_R_state(); #line 183 if (tmp___10 == 0) { #line 184 __startrek_write_R_state(2); } } #line 188 tmp___11 = nxt_motor_get_count(0); #line 188 if (tmp___11 <= 0) { #line 188 tmp___12 = __startrek_read_W_state(); #line 188 if (tmp___12 == 0) { #line 189 __startrek_write_W_state(1); } } } else { #line 193 __startrek_write_W_state(0); #line 194 C_state = 3; } #line 196 break; case 3: #line 199 tmp___16 = __startrek_read_T_state(); #line 199 if (tmp___16 == 0) { #line 200 __startrek_write_T_state(1); } else { #line 201 tmp___15 = __startrek_read_T_state(); #line 201 if (tmp___15 == 2) { #line 202 __startrek_write_T_state(0); #line 203 C_state = 0; } } #line 205 break; } #line 207 break; case 3: #line 210 tmp___17 = ecrobot_is_ENTER_button_pressed(); #line 210 if (tmp___17) { #line 211 TM_mode = 2; } #line 213 break; } #line 215 TerminateTask(); #line 216 return; } } #line 218 "src/ctm.bug2.c" void Reader(void) { unsigned short color ; unsigned char tmp ; _Bool tmp___0 ; _Bool tmp___1 ; unsigned char tmp___2 ; unsigned char tmp___3 ; unsigned char tmp___4 ; int tmp___6 ; unsigned short tmp___7 ; { #line 224 tmp = __startrek_read_R_state(); #line 224 switch (tmp) { case 0: #line 227 break; case 1: #line 231 tmp___0 = move_motor(0, 15, 45, 1); #line 231 if (tmp___0) { #line 232 __startrek_write_R_state(0); } #line 233 break; case 2: #line 237 tmp___1 = move_motor(0, 15, 0, -1); #line 237 if (tmp___1) { #line 238 __startrek_write_R_state(0); } #line 240 break; case 3: #line 243 tmp___2 = ecrobot_get_nxtcolorsensor_mode(0); #line 243 if ((int )tmp___2 != 2) { #line 244 ecrobot_set_nxtcolorsensor(0, 2); #line 245 __startrek_write_need_to_run_nxtbg(1); } #line 259 tmp___3 = ecrobot_get_nxtcolorsensor_mode(0); #line 259 __startrek_assert_i0((int )tmp___3 == 2); #line 263 bg_nxtcolorsensor(0); #line 264 tmp___4 = ecrobot_get_nxtcolorsensor_light(0); #line 264 color = tmp___4; #line 265 tmp___7 = __startrek_read_threshold(); #line 265 if ((int )color < tmp___7) { #line 265 tmp___6 = 1; } else { #line 265 tmp___6 = 0; } #line 265 __startrek_write_input(tmp___6); #line 280 ecrobot_set_nxtcolorsensor(0, 5); #line 281 __startrek_write_need_to_run_nxtbg(1); #line 283 __startrek_write_R_state(0); #line 284 __startrek_write_need_to_read(0); #line 286 break; } #line 288 TerminateTask(); #line 289 return; } } #line 291 "src/ctm.bug2.c" void Writer(void) { int sign ; _Bool tmp___0 ; unsigned char tmp___1 ; int tmp___2 ; _Bool tmp___3 ; int tmp___4 ; _Bool tmp___5 ; { #line 294 tmp___0 = __startrek_read_output(); #line 294 if (tmp___0 == 1) { #line 294 sign = 1; } else { #line 294 sign = -1; } #line 296 tmp___1 = __startrek_read_W_state(); #line 296 switch (tmp___1) { case 0: #line 299 break; case 1: #line 310 tmp___5 = move_motor(1, 30, sign * 180, sign); #line 310 if (tmp___5) { #line 311 __startrek_write_W_state(0); #line 312 tmp___2 = nxt_motor_get_count(1); #line 312 nxt_motor_set_count(1, tmp___2 % 180); #line 314 tmp___3 = __startrek_read_input(); #line 314 if (tmp___3) { #line 314 tmp___4 = 0; } else { #line 314 tmp___4 = 1; } #line 314 __startrek_write_input(tmp___4); } #line 316 break; } #line 318 TerminateTask(); #line 319 return; } } #line 323 "src/ctm.bug2.c" static int sign ; #line 321 "src/ctm.bug2.c" void TapeMover(void) { _Bool tmp___0 ; unsigned char tmp___1 ; int tmp___2 ; _Bool tmp___3 ; { #line 324 tmp___0 = __startrek_read_dir(); #line 324 if (tmp___0 == 0) { #line 324 sign = 1; } else { #line 324 sign = -1; } #line 326 tmp___1 = __startrek_read_T_state(); #line 326 switch (tmp___1) { case 0: case 2: #line 330 break; case 1: #line 333 __startrek_write_need_to_read(1); #line 344 tmp___3 = move_motor(2, 100, sign * 1800, sign); #line 344 if (tmp___3) { #line 345 __startrek_write_T_state(2); #line 346 tmp___2 = nxt_motor_get_count(2); #line 346 nxt_motor_set_count(2, tmp___2 % 1800); } #line 349 break; } #line 351 TerminateTask(); #line 352 return; } } #line 357 "src/ctm.bug2.c" int __startrek_time_bound = 2000; #line 360 "src/ctm.bug2.c" char __startrek_base_priority_Controller = 1; #line 1 "<startrek builtins>" __inline static char __startrek_read___startrek_job_count_Controller(void) ; #line 1 __inline static void __startrek_write___startrek_job_count_Controller(char arg ) ; #line 1 "<startrek builtins>" char ___startrek_job_count_Controller_[28] ; #line 1 "<startrek builtins>" char _i___startrek_job_count_Controller_[28] ; #line 360 "src/ctm.bug2.c" char __startrek_hidden___startrek_job_count_Controller = 0; #line 360 __inline static _Bool __startrek_entry_pt_Controller(void) ; #line 360 "src/ctm.bug2.c" __inline static _Bool __startrek_entry_pt_Controller(void) { char sp ; char tmp ; char tmp___0 ; { #line 360 __startrek_lock = 1; #line 360 tmp = __startrek_read___startrek_current_priority(); #line 360 sp = tmp; #line 360 __startrek_lock = 0; #line 360 if ((int )__startrek_base_priority_Controller <= (int )sp) { #line 360 __VERIFIER_assume(0); #line 360 return ((_Bool)0); } #line 360 __startrek_lock = 1; #line 360 __startrek_write___startrek_current_priority(__startrek_base_priority_Controller); #line 360 __startrek_lock = 0; #line 360 __startrek_pi_locks_held = 0; #line 360 __startrek_task_base_priority = __startrek_base_priority_Controller; #line 360 Controller(); #line 360 __startrek_lock = 1; #line 360 tmp___0 = __startrek_read___startrek_job_count_Controller(); #line 360 __startrek_write___startrek_job_count_Controller(tmp___0 + 1); #line 360 __startrek_write___startrek_current_priority(sp); #line 360 __startrek_lock = 0; #line 360 return ((_Bool)1); } } #line 360 "src/ctm.bug2.c" void cil_keeperController(void) { { #line 360 __startrek_entry_pt_Controller(); #line 360 return; } } #line 361 "src/ctm.bug2.c" int __startrek_period_Controller = 500; #line 362 "src/ctm.bug2.c" int __startrek_wcet_Controller = 440; #line 363 "src/ctm.bug2.c" int __startrek_arrival_min_Controller = 0; #line 363 "src/ctm.bug2.c" int __startrek_arrival_max_Controller = 0; #line 367 "src/ctm.bug2.c" char __startrek_base_priority_TapeMover = 2; #line 1 "<startrek builtins>" __inline static char __startrek_read___startrek_job_count_TapeMover(void) ; #line 1 __inline static void __startrek_write___startrek_job_count_TapeMover(char arg ) ; #line 1 "<startrek builtins>" char ___startrek_job_count_TapeMover_[28] ; #line 1 "<startrek builtins>" char _i___startrek_job_count_TapeMover_[28] ; #line 367 "src/ctm.bug2.c" char __startrek_hidden___startrek_job_count_TapeMover = 0; #line 367 __inline static _Bool __startrek_entry_pt_TapeMover(void) ; #line 367 "src/ctm.bug2.c" __inline static _Bool __startrek_entry_pt_TapeMover(void) { char sp ; char tmp ; char tmp___0 ; { #line 367 __startrek_lock = 1; #line 367 tmp = __startrek_read___startrek_current_priority(); #line 367 sp = tmp; #line 367 __startrek_lock = 0; #line 367 if ((int )__startrek_base_priority_TapeMover <= (int )sp) { #line 367 __VERIFIER_assume(0); #line 367 return ((_Bool)0); } #line 367 __startrek_lock = 1; #line 367 __startrek_write___startrek_current_priority(__startrek_base_priority_TapeMover); #line 367 __startrek_lock = 0; #line 367 __startrek_pi_locks_held = 0; #line 367 __startrek_task_base_priority = __startrek_base_priority_TapeMover; #line 367 TapeMover(); #line 367 __startrek_lock = 1; #line 367 tmp___0 = __startrek_read___startrek_job_count_TapeMover(); #line 367 __startrek_write___startrek_job_count_TapeMover(tmp___0 + 1); #line 367 __startrek_write___startrek_current_priority(sp); #line 367 __startrek_lock = 0; #line 367 return ((_Bool)1); } } #line 367 "src/ctm.bug2.c" void cil_keeperTapeMover(void) { { #line 367 __startrek_entry_pt_TapeMover(); #line 367 return; } } #line 368 "src/ctm.bug2.c" int __startrek_period_TapeMover = 250; #line 369 "src/ctm.bug2.c" int __startrek_wcet_TapeMover = 10; #line 370 "src/ctm.bug2.c" int __startrek_arrival_min_TapeMover = 0; #line 370 "src/ctm.bug2.c" int __startrek_arrival_max_TapeMover = 0; #line 374 "src/ctm.bug2.c" char __startrek_base_priority_Reader = 3; #line 1 "<startrek builtins>" __inline static char __startrek_read___startrek_job_count_Reader(void) ; #line 1 __inline static void __startrek_write___startrek_job_count_Reader(char arg ) ; #line 1 "<startrek builtins>" char ___startrek_job_count_Reader_[28] ; #line 1 "<startrek builtins>" char _i___startrek_job_count_Reader_[28] ; #line 374 "src/ctm.bug2.c" char __startrek_hidden___startrek_job_count_Reader = 0; #line 374 __inline static _Bool __startrek_entry_pt_Reader(void) ; #line 374 "src/ctm.bug2.c" __inline static _Bool __startrek_entry_pt_Reader(void) { char sp ; char tmp ; char tmp___0 ; { #line 374 __startrek_lock = 1; #line 374 tmp = __startrek_read___startrek_current_priority(); #line 374 sp = tmp; #line 374 __startrek_lock = 0; #line 374 if ((int )__startrek_base_priority_Reader <= (int )sp) { #line 374 __VERIFIER_assume(0); #line 374 return ((_Bool)0); } #line 374 __startrek_lock = 1; #line 374 __startrek_write___startrek_current_priority(__startrek_base_priority_Reader); #line 374 __startrek_lock = 0; #line 374 __startrek_pi_locks_held = 0; #line 374 __startrek_task_base_priority = __startrek_base_priority_Reader; #line 374 Reader(); #line 374 __startrek_lock = 1; #line 374 tmp___0 = __startrek_read___startrek_job_count_Reader(); #line 374 __startrek_write___startrek_job_count_Reader(tmp___0 + 1); #line 374 __startrek_write___startrek_current_priority(sp); #line 374 __startrek_lock = 0; #line 374 return ((_Bool)1); } } #line 374 "src/ctm.bug2.c" void cil_keeperReader(void) { { #line 374 __startrek_entry_pt_Reader(); #line 374 return; } } #line 375 "src/ctm.bug2.c" int __startrek_period_Reader = 250; #line 376 "src/ctm.bug2.c" int __startrek_wcet_Reader = 10; #line 377 "src/ctm.bug2.c" int __startrek_arrival_min_Reader = 0; #line 377 "src/ctm.bug2.c" int __startrek_arrival_max_Reader = 0; #line 381 "src/ctm.bug2.c" char __startrek_base_priority_Writer = 4; #line 1 "<startrek builtins>" __inline static char __startrek_read___startrek_job_count_Writer(void) ; #line 1 __inline static void __startrek_write___startrek_job_count_Writer(char arg ) ; #line 1 "<startrek builtins>" char ___startrek_job_count_Writer_[28] ; #line 1 "<startrek builtins>" char _i___startrek_job_count_Writer_[28] ; #line 381 "src/ctm.bug2.c" char __startrek_hidden___startrek_job_count_Writer = 0; #line 381 __inline static _Bool __startrek_entry_pt_Writer(void) ; #line 381 "src/ctm.bug2.c" __inline static _Bool __startrek_entry_pt_Writer(void) { char sp ; char tmp ; char tmp___0 ; { #line 381 __startrek_lock = 1; #line 381 tmp = __startrek_read___startrek_current_priority(); #line 381 sp = tmp; #line 381 __startrek_lock = 0; #line 381 if ((int )__startrek_base_priority_Writer <= (int )sp) { #line 381 __VERIFIER_assume(0); #line 381 return ((_Bool)0); } #line 381 __startrek_lock = 1; #line 381 __startrek_write___startrek_current_priority(__startrek_base_priority_Writer); #line 381 __startrek_lock = 0; #line 381 __startrek_pi_locks_held = 0; #line 381 __startrek_task_base_priority = __startrek_base_priority_Writer; #line 381 Writer(); #line 381 __startrek_lock = 1; #line 381 tmp___0 = __startrek_read___startrek_job_count_Writer(); #line 381 __startrek_write___startrek_job_count_Writer(tmp___0 + 1); #line 381 __startrek_write___startrek_current_priority(sp); #line 381 __startrek_lock = 0; #line 381 return ((_Bool)1); } } #line 381 "src/ctm.bug2.c" void cil_keeperWriter(void) { { #line 381 __startrek_entry_pt_Writer(); #line 381 return; } } #line 382 "src/ctm.bug2.c" int __startrek_period_Writer = 250; #line 383 "src/ctm.bug2.c" int __startrek_wcet_Writer = 10; #line 384 "src/ctm.bug2.c" int __startrek_arrival_min_Writer = 0; #line 384 "src/ctm.bug2.c" int __startrek_arrival_max_Writer = 0; #line 1 "<compiler builtins>" __inline void __startrek_schedule_jobs(void) { { #line 1 "<startrek builtins>" __startrek_start_t0[0] = __VERIFIER_nondet_uchar(); #line 1 __startrek_end_t0[0] = __VERIFIER_nondet_uchar(); #line 1 __startrek_start_t0[1] = __VERIFIER_nondet_uchar(); #line 1 __startrek_end_t0[1] = __VERIFIER_nondet_uchar(); #line 1 __startrek_start_t0[2] = __VERIFIER_nondet_uchar(); #line 1 __startrek_end_t0[2] = __VERIFIER_nondet_uchar(); #line 1 __startrek_start_t0[3] = __VERIFIER_nondet_uchar(); #line 1 __startrek_end_t0[3] = __VERIFIER_nondet_uchar(); #line 1 __VERIFIER_assume(0 <= __startrek_start_t0[0]); #line 1 __VERIFIER_assume(__startrek_end_t0[3] <= 27); #line 1 __VERIFIER_assume(__startrek_start_t0[0] <= __startrek_end_t0[0]); #line 1 __VERIFIER_assume(__startrek_start_t0[1] <= __startrek_end_t0[1]); #line 1 __VERIFIER_assume(__startrek_start_t0[2] <= __startrek_end_t0[2]); #line 1 __VERIFIER_assume(__startrek_start_t0[3] <= __startrek_end_t0[3]); #line 1 __VERIFIER_assume(__startrek_end_t0[0] <= __startrek_start_t0[1] - 1); #line 1 __VERIFIER_assume(__startrek_end_t0[1] <= __startrek_start_t0[2] - 1); #line 1 __VERIFIER_assume(__startrek_end_t0[2] <= __startrek_start_t0[3] - 1); #line 1 __startrek_start_t1[0] = __VERIFIER_nondet_uchar(); #line 1 __startrek_end_t1[0] = __VERIFIER_nondet_uchar(); #line 1 __startrek_start_t1[1] = __VERIFIER_nondet_uchar(); #line 1 __startrek_end_t1[1] = __VERIFIER_nondet_uchar(); #line 1 __startrek_start_t1[2] = __VERIFIER_nondet_uchar(); #line 1 __startrek_end_t1[2] = __VERIFIER_nondet_uchar(); #line 1 __startrek_start_t1[3] = __VERIFIER_nondet_uchar(); #line 1 __startrek_end_t1[3] = __VERIFIER_nondet_uchar(); #line 1 __startrek_start_t1[4] = __VERIFIER_nondet_uchar(); #line 1 __startrek_end_t1[4] = __VERIFIER_nondet_uchar(); #line 1 __startrek_start_t1[5] = __VERIFIER_nondet_uchar(); #line 1 __startrek_end_t1[5] = __VERIFIER_nondet_uchar(); #line 1 __startrek_start_t1[6] = __VERIFIER_nondet_uchar(); #line 1 __startrek_end_t1[6] = __VERIFIER_nondet_uchar(); #line 1 __startrek_start_t1[7] = __VERIFIER_nondet_uchar(); #line 1 __startrek_end_t1[7] = __VERIFIER_nondet_uchar(); #line 1 __VERIFIER_assume(0 <= __startrek_start_t1[0]); #line 1 __VERIFIER_assume(__startrek_end_t1[7] <= 27); #line 1 __VERIFIER_assume(__startrek_start_t1[0] <= __startrek_end_t1[0]); #line 1 __VERIFIER_assume(__startrek_start_t1[1] <= __startrek_end_t1[1]); #line 1 __VERIFIER_assume(__startrek_start_t1[2] <= __startrek_end_t1[2]); #line 1 __VERIFIER_assume(__startrek_start_t1[3] <= __startrek_end_t1[3]); #line 1 __VERIFIER_assume(__startrek_start_t1[4] <= __startrek_end_t1[4]); #line 1 __VERIFIER_assume(__startrek_start_t1[5] <= __startrek_end_t1[5]); #line 1 __VERIFIER_assume(__startrek_start_t1[6] <= __startrek_end_t1[6]); #line 1 __VERIFIER_assume(__startrek_start_t1[7] <= __startrek_end_t1[7]); #line 1 __VERIFIER_assume(__startrek_end_t1[0] <= __startrek_start_t1[1] - 1); #line 1 __VERIFIER_assume(__startrek_end_t1[1] <= __startrek_start_t1[2] - 1); #line 1 __VERIFIER_assume(__startrek_end_t1[2] <= __startrek_start_t1[3] - 1); #line 1 __VERIFIER_assume(__startrek_end_t1[3] <= __startrek_start_t1[4] - 1); #line 1 __VERIFIER_assume(__startrek_end_t1[4] <= __startrek_start_t1[5] - 1); #line 1 __VERIFIER_assume(__startrek_end_t1[5] <= __startrek_start_t1[6] - 1); #line 1 __VERIFIER_assume(__startrek_end_t1[6] <= __startrek_start_t1[7] - 1); #line 1 if (__startrek_start_t0[0] <= __startrek_end_t1[0]) { #line 1 if (__startrek_start_t1[0] <= __startrek_end_t0[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[0] <= __startrek_start_t1[0]); #line 1 __VERIFIER_assume(__startrek_end_t1[0] < __startrek_end_t0[0]); } } } #line 1 if (__startrek_start_t0[1] <= __startrek_end_t1[0]) { #line 1 if (__startrek_start_t1[0] <= __startrek_end_t0[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[1] <= __startrek_start_t1[0]); #line 1 __VERIFIER_assume(__startrek_end_t1[0] < __startrek_end_t0[1]); } } } #line 1 if (__startrek_start_t0[2] <= __startrek_end_t1[0]) { #line 1 if (__startrek_start_t1[0] <= __startrek_end_t0[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[2] <= __startrek_start_t1[0]); #line 1 __VERIFIER_assume(__startrek_end_t1[0] < __startrek_end_t0[2]); } } } #line 1 if (__startrek_start_t0[3] <= __startrek_end_t1[0]) { #line 1 if (__startrek_start_t1[0] <= __startrek_end_t0[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[3] <= __startrek_start_t1[0]); #line 1 __VERIFIER_assume(__startrek_end_t1[0] < __startrek_end_t0[3]); } } } #line 1 if (__startrek_start_t0[0] <= __startrek_end_t1[1]) { #line 1 if (__startrek_start_t1[1] <= __startrek_end_t0[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[0] <= __startrek_start_t1[1]); #line 1 __VERIFIER_assume(__startrek_end_t1[1] < __startrek_end_t0[0]); } } } #line 1 if (__startrek_start_t0[1] <= __startrek_end_t1[1]) { #line 1 if (__startrek_start_t1[1] <= __startrek_end_t0[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[1] <= __startrek_start_t1[1]); #line 1 __VERIFIER_assume(__startrek_end_t1[1] < __startrek_end_t0[1]); } } } #line 1 if (__startrek_start_t0[2] <= __startrek_end_t1[1]) { #line 1 if (__startrek_start_t1[1] <= __startrek_end_t0[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[2] <= __startrek_start_t1[1]); #line 1 __VERIFIER_assume(__startrek_end_t1[1] < __startrek_end_t0[2]); } } } #line 1 if (__startrek_start_t0[3] <= __startrek_end_t1[1]) { #line 1 if (__startrek_start_t1[1] <= __startrek_end_t0[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[3] <= __startrek_start_t1[1]); #line 1 __VERIFIER_assume(__startrek_end_t1[1] < __startrek_end_t0[3]); } } } #line 1 if (__startrek_start_t0[0] <= __startrek_end_t1[2]) { #line 1 if (__startrek_start_t1[2] <= __startrek_end_t0[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[0] <= __startrek_start_t1[2]); #line 1 __VERIFIER_assume(__startrek_end_t1[2] < __startrek_end_t0[0]); #line 1 __VERIFIER_assume(__startrek_end_t1[0] < __startrek_start_t0[0]); } } } #line 1 if (__startrek_start_t0[1] <= __startrek_end_t1[2]) { #line 1 if (__startrek_start_t1[2] <= __startrek_end_t0[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[1] <= __startrek_start_t1[2]); #line 1 __VERIFIER_assume(__startrek_end_t1[2] < __startrek_end_t0[1]); #line 1 __VERIFIER_assume(__startrek_end_t1[0] < __startrek_start_t0[1]); } } } #line 1 if (__startrek_start_t0[2] <= __startrek_end_t1[2]) { #line 1 if (__startrek_start_t1[2] <= __startrek_end_t0[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[2] <= __startrek_start_t1[2]); #line 1 __VERIFIER_assume(__startrek_end_t1[2] < __startrek_end_t0[2]); #line 1 __VERIFIER_assume(__startrek_end_t1[0] < __startrek_start_t0[2]); } } } #line 1 if (__startrek_start_t0[3] <= __startrek_end_t1[2]) { #line 1 if (__startrek_start_t1[2] <= __startrek_end_t0[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[3] <= __startrek_start_t1[2]); #line 1 __VERIFIER_assume(__startrek_end_t1[2] < __startrek_end_t0[3]); #line 1 __VERIFIER_assume(__startrek_end_t1[0] < __startrek_start_t0[3]); } } } #line 1 if (__startrek_start_t0[0] <= __startrek_end_t1[3]) { #line 1 if (__startrek_start_t1[3] <= __startrek_end_t0[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[0] <= __startrek_start_t1[3]); #line 1 __VERIFIER_assume(__startrek_end_t1[3] < __startrek_end_t0[0]); #line 1 __VERIFIER_assume(__startrek_end_t1[1] < __startrek_start_t0[0]); } } } #line 1 if (__startrek_start_t0[1] <= __startrek_end_t1[3]) { #line 1 if (__startrek_start_t1[3] <= __startrek_end_t0[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[1] <= __startrek_start_t1[3]); #line 1 __VERIFIER_assume(__startrek_end_t1[3] < __startrek_end_t0[1]); #line 1 __VERIFIER_assume(__startrek_end_t1[1] < __startrek_start_t0[1]); } } } #line 1 if (__startrek_start_t0[2] <= __startrek_end_t1[3]) { #line 1 if (__startrek_start_t1[3] <= __startrek_end_t0[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[2] <= __startrek_start_t1[3]); #line 1 __VERIFIER_assume(__startrek_end_t1[3] < __startrek_end_t0[2]); #line 1 __VERIFIER_assume(__startrek_end_t1[1] < __startrek_start_t0[2]); } } } #line 1 if (__startrek_start_t0[3] <= __startrek_end_t1[3]) { #line 1 if (__startrek_start_t1[3] <= __startrek_end_t0[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[3] <= __startrek_start_t1[3]); #line 1 __VERIFIER_assume(__startrek_end_t1[3] < __startrek_end_t0[3]); #line 1 __VERIFIER_assume(__startrek_end_t1[1] < __startrek_start_t0[3]); } } } #line 1 if (__startrek_start_t0[0] <= __startrek_end_t1[4]) { #line 1 if (__startrek_start_t1[4] <= __startrek_end_t0[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[0] <= __startrek_start_t1[4]); #line 1 __VERIFIER_assume(__startrek_end_t1[4] < __startrek_end_t0[0]); #line 1 __VERIFIER_assume(__startrek_end_t1[2] < __startrek_start_t0[0]); } } } #line 1 if (__startrek_start_t0[1] <= __startrek_end_t1[4]) { #line 1 if (__startrek_start_t1[4] <= __startrek_end_t0[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[1] <= __startrek_start_t1[4]); #line 1 __VERIFIER_assume(__startrek_end_t1[4] < __startrek_end_t0[1]); #line 1 __VERIFIER_assume(__startrek_end_t1[2] < __startrek_start_t0[1]); } } } #line 1 if (__startrek_start_t0[2] <= __startrek_end_t1[4]) { #line 1 if (__startrek_start_t1[4] <= __startrek_end_t0[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[2] <= __startrek_start_t1[4]); #line 1 __VERIFIER_assume(__startrek_end_t1[4] < __startrek_end_t0[2]); #line 1 __VERIFIER_assume(__startrek_end_t1[2] < __startrek_start_t0[2]); } } } #line 1 if (__startrek_start_t0[3] <= __startrek_end_t1[4]) { #line 1 if (__startrek_start_t1[4] <= __startrek_end_t0[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[3] <= __startrek_start_t1[4]); #line 1 __VERIFIER_assume(__startrek_end_t1[4] < __startrek_end_t0[3]); #line 1 __VERIFIER_assume(__startrek_end_t1[2] < __startrek_start_t0[3]); } } } #line 1 if (__startrek_start_t0[0] <= __startrek_end_t1[5]) { #line 1 if (__startrek_start_t1[5] <= __startrek_end_t0[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[0] <= __startrek_start_t1[5]); #line 1 __VERIFIER_assume(__startrek_end_t1[5] < __startrek_end_t0[0]); #line 1 __VERIFIER_assume(__startrek_end_t1[3] < __startrek_start_t0[0]); } } } #line 1 if (__startrek_start_t0[1] <= __startrek_end_t1[5]) { #line 1 if (__startrek_start_t1[5] <= __startrek_end_t0[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[1] <= __startrek_start_t1[5]); #line 1 __VERIFIER_assume(__startrek_end_t1[5] < __startrek_end_t0[1]); #line 1 __VERIFIER_assume(__startrek_end_t1[3] < __startrek_start_t0[1]); } } } #line 1 if (__startrek_start_t0[2] <= __startrek_end_t1[5]) { #line 1 if (__startrek_start_t1[5] <= __startrek_end_t0[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[2] <= __startrek_start_t1[5]); #line 1 __VERIFIER_assume(__startrek_end_t1[5] < __startrek_end_t0[2]); #line 1 __VERIFIER_assume(__startrek_end_t1[3] < __startrek_start_t0[2]); } } } #line 1 if (__startrek_start_t0[3] <= __startrek_end_t1[5]) { #line 1 if (__startrek_start_t1[5] <= __startrek_end_t0[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[3] <= __startrek_start_t1[5]); #line 1 __VERIFIER_assume(__startrek_end_t1[5] < __startrek_end_t0[3]); #line 1 __VERIFIER_assume(__startrek_end_t1[3] < __startrek_start_t0[3]); } } } #line 1 if (__startrek_start_t0[0] <= __startrek_end_t1[6]) { #line 1 if (__startrek_start_t1[6] <= __startrek_end_t0[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[0] <= __startrek_start_t1[6]); #line 1 __VERIFIER_assume(__startrek_end_t1[6] < __startrek_end_t0[0]); #line 1 __VERIFIER_assume(__startrek_end_t1[4] < __startrek_start_t0[0]); } } } #line 1 if (__startrek_start_t0[1] <= __startrek_end_t1[6]) { #line 1 if (__startrek_start_t1[6] <= __startrek_end_t0[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[1] <= __startrek_start_t1[6]); #line 1 __VERIFIER_assume(__startrek_end_t1[6] < __startrek_end_t0[1]); #line 1 __VERIFIER_assume(__startrek_end_t1[4] < __startrek_start_t0[1]); } } } #line 1 if (__startrek_start_t0[2] <= __startrek_end_t1[6]) { #line 1 if (__startrek_start_t1[6] <= __startrek_end_t0[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[2] <= __startrek_start_t1[6]); #line 1 __VERIFIER_assume(__startrek_end_t1[6] < __startrek_end_t0[2]); #line 1 __VERIFIER_assume(__startrek_end_t1[4] < __startrek_start_t0[2]); } } } #line 1 if (__startrek_start_t0[3] <= __startrek_end_t1[6]) { #line 1 if (__startrek_start_t1[6] <= __startrek_end_t0[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[3] <= __startrek_start_t1[6]); #line 1 __VERIFIER_assume(__startrek_end_t1[6] < __startrek_end_t0[3]); #line 1 __VERIFIER_assume(__startrek_end_t1[4] < __startrek_start_t0[3]); } } } #line 1 if (__startrek_start_t0[0] <= __startrek_end_t1[7]) { #line 1 if (__startrek_start_t1[7] <= __startrek_end_t0[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[0] <= __startrek_start_t1[7]); #line 1 __VERIFIER_assume(__startrek_end_t1[7] < __startrek_end_t0[0]); #line 1 __VERIFIER_assume(__startrek_end_t1[5] < __startrek_start_t0[0]); } } } #line 1 if (__startrek_start_t0[1] <= __startrek_end_t1[7]) { #line 1 if (__startrek_start_t1[7] <= __startrek_end_t0[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[1] <= __startrek_start_t1[7]); #line 1 __VERIFIER_assume(__startrek_end_t1[7] < __startrek_end_t0[1]); #line 1 __VERIFIER_assume(__startrek_end_t1[5] < __startrek_start_t0[1]); } } } #line 1 if (__startrek_start_t0[2] <= __startrek_end_t1[7]) { #line 1 if (__startrek_start_t1[7] <= __startrek_end_t0[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[2] <= __startrek_start_t1[7]); #line 1 __VERIFIER_assume(__startrek_end_t1[7] < __startrek_end_t0[2]); #line 1 __VERIFIER_assume(__startrek_end_t1[5] < __startrek_start_t0[2]); } } } #line 1 if (__startrek_start_t0[3] <= __startrek_end_t1[7]) { #line 1 if (__startrek_start_t1[7] <= __startrek_end_t0[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[3] <= __startrek_start_t1[7]); #line 1 __VERIFIER_assume(__startrek_end_t1[7] < __startrek_end_t0[3]); #line 1 __VERIFIER_assume(__startrek_end_t1[5] < __startrek_start_t0[3]); } } } #line 1 __startrek_start_t2[0] = __VERIFIER_nondet_uchar(); #line 1 __startrek_end_t2[0] = __VERIFIER_nondet_uchar(); #line 1 __startrek_start_t2[1] = __VERIFIER_nondet_uchar(); #line 1 __startrek_end_t2[1] = __VERIFIER_nondet_uchar(); #line 1 __startrek_start_t2[2] = __VERIFIER_nondet_uchar(); #line 1 __startrek_end_t2[2] = __VERIFIER_nondet_uchar(); #line 1 __startrek_start_t2[3] = __VERIFIER_nondet_uchar(); #line 1 __startrek_end_t2[3] = __VERIFIER_nondet_uchar(); #line 1 __startrek_start_t2[4] = __VERIFIER_nondet_uchar(); #line 1 __startrek_end_t2[4] = __VERIFIER_nondet_uchar(); #line 1 __startrek_start_t2[5] = __VERIFIER_nondet_uchar(); #line 1 __startrek_end_t2[5] = __VERIFIER_nondet_uchar(); #line 1 __startrek_start_t2[6] = __VERIFIER_nondet_uchar(); #line 1 __startrek_end_t2[6] = __VERIFIER_nondet_uchar(); #line 1 __startrek_start_t2[7] = __VERIFIER_nondet_uchar(); #line 1 __startrek_end_t2[7] = __VERIFIER_nondet_uchar(); #line 1 __VERIFIER_assume(0 <= __startrek_start_t2[0]); #line 1 __VERIFIER_assume(__startrek_end_t2[7] <= 27); #line 1 __VERIFIER_assume(__startrek_start_t2[0] <= __startrek_end_t2[0]); #line 1 __VERIFIER_assume(__startrek_start_t2[1] <= __startrek_end_t2[1]); #line 1 __VERIFIER_assume(__startrek_start_t2[2] <= __startrek_end_t2[2]); #line 1 __VERIFIER_assume(__startrek_start_t2[3] <= __startrek_end_t2[3]); #line 1 __VERIFIER_assume(__startrek_start_t2[4] <= __startrek_end_t2[4]); #line 1 __VERIFIER_assume(__startrek_start_t2[5] <= __startrek_end_t2[5]); #line 1 __VERIFIER_assume(__startrek_start_t2[6] <= __startrek_end_t2[6]); #line 1 __VERIFIER_assume(__startrek_start_t2[7] <= __startrek_end_t2[7]); #line 1 __VERIFIER_assume(__startrek_end_t2[0] <= __startrek_start_t2[1] - 1); #line 1 __VERIFIER_assume(__startrek_end_t2[1] <= __startrek_start_t2[2] - 1); #line 1 __VERIFIER_assume(__startrek_end_t2[2] <= __startrek_start_t2[3] - 1); #line 1 __VERIFIER_assume(__startrek_end_t2[3] <= __startrek_start_t2[4] - 1); #line 1 __VERIFIER_assume(__startrek_end_t2[4] <= __startrek_start_t2[5] - 1); #line 1 __VERIFIER_assume(__startrek_end_t2[5] <= __startrek_start_t2[6] - 1); #line 1 __VERIFIER_assume(__startrek_end_t2[6] <= __startrek_start_t2[7] - 1); #line 1 if (__startrek_start_t0[0] <= __startrek_end_t2[0]) { #line 1 if (__startrek_start_t2[0] <= __startrek_end_t0[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[0] <= __startrek_start_t2[0]); #line 1 __VERIFIER_assume(__startrek_end_t2[0] < __startrek_end_t0[0]); } } } #line 1 if (__startrek_start_t0[1] <= __startrek_end_t2[0]) { #line 1 if (__startrek_start_t2[0] <= __startrek_end_t0[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[1] <= __startrek_start_t2[0]); #line 1 __VERIFIER_assume(__startrek_end_t2[0] < __startrek_end_t0[1]); } } } #line 1 if (__startrek_start_t0[2] <= __startrek_end_t2[0]) { #line 1 if (__startrek_start_t2[0] <= __startrek_end_t0[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[2] <= __startrek_start_t2[0]); #line 1 __VERIFIER_assume(__startrek_end_t2[0] < __startrek_end_t0[2]); } } } #line 1 if (__startrek_start_t0[3] <= __startrek_end_t2[0]) { #line 1 if (__startrek_start_t2[0] <= __startrek_end_t0[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[3] <= __startrek_start_t2[0]); #line 1 __VERIFIER_assume(__startrek_end_t2[0] < __startrek_end_t0[3]); } } } #line 1 if (__startrek_start_t1[0] <= __startrek_end_t2[0]) { #line 1 if (__startrek_start_t2[0] <= __startrek_end_t1[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[0] <= __startrek_start_t2[0]); #line 1 __VERIFIER_assume(__startrek_end_t2[0] < __startrek_end_t1[0]); } } } #line 1 if (__startrek_start_t1[1] <= __startrek_end_t2[0]) { #line 1 if (__startrek_start_t2[0] <= __startrek_end_t1[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[1] <= __startrek_start_t2[0]); #line 1 __VERIFIER_assume(__startrek_end_t2[0] < __startrek_end_t1[1]); } } } #line 1 if (__startrek_start_t1[2] <= __startrek_end_t2[0]) { #line 1 if (__startrek_start_t2[0] <= __startrek_end_t1[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[2] <= __startrek_start_t2[0]); #line 1 __VERIFIER_assume(__startrek_end_t2[0] < __startrek_end_t1[2]); } } } #line 1 if (__startrek_start_t1[3] <= __startrek_end_t2[0]) { #line 1 if (__startrek_start_t2[0] <= __startrek_end_t1[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[3] <= __startrek_start_t2[0]); #line 1 __VERIFIER_assume(__startrek_end_t2[0] < __startrek_end_t1[3]); } } } #line 1 if (__startrek_start_t1[4] <= __startrek_end_t2[0]) { #line 1 if (__startrek_start_t2[0] <= __startrek_end_t1[4]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[4] <= __startrek_start_t2[0]); #line 1 __VERIFIER_assume(__startrek_end_t2[0] < __startrek_end_t1[4]); } } } #line 1 if (__startrek_start_t1[5] <= __startrek_end_t2[0]) { #line 1 if (__startrek_start_t2[0] <= __startrek_end_t1[5]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[5] <= __startrek_start_t2[0]); #line 1 __VERIFIER_assume(__startrek_end_t2[0] < __startrek_end_t1[5]); } } } #line 1 if (__startrek_start_t1[6] <= __startrek_end_t2[0]) { #line 1 if (__startrek_start_t2[0] <= __startrek_end_t1[6]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[6] <= __startrek_start_t2[0]); #line 1 __VERIFIER_assume(__startrek_end_t2[0] < __startrek_end_t1[6]); } } } #line 1 if (__startrek_start_t1[7] <= __startrek_end_t2[0]) { #line 1 if (__startrek_start_t2[0] <= __startrek_end_t1[7]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[7] <= __startrek_start_t2[0]); #line 1 __VERIFIER_assume(__startrek_end_t2[0] < __startrek_end_t1[7]); } } } #line 1 if (__startrek_start_t0[0] <= __startrek_end_t2[1]) { #line 1 if (__startrek_start_t2[1] <= __startrek_end_t0[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[0] <= __startrek_start_t2[1]); #line 1 __VERIFIER_assume(__startrek_end_t2[1] < __startrek_end_t0[0]); } } } #line 1 if (__startrek_start_t0[1] <= __startrek_end_t2[1]) { #line 1 if (__startrek_start_t2[1] <= __startrek_end_t0[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[1] <= __startrek_start_t2[1]); #line 1 __VERIFIER_assume(__startrek_end_t2[1] < __startrek_end_t0[1]); } } } #line 1 if (__startrek_start_t0[2] <= __startrek_end_t2[1]) { #line 1 if (__startrek_start_t2[1] <= __startrek_end_t0[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[2] <= __startrek_start_t2[1]); #line 1 __VERIFIER_assume(__startrek_end_t2[1] < __startrek_end_t0[2]); } } } #line 1 if (__startrek_start_t0[3] <= __startrek_end_t2[1]) { #line 1 if (__startrek_start_t2[1] <= __startrek_end_t0[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[3] <= __startrek_start_t2[1]); #line 1 __VERIFIER_assume(__startrek_end_t2[1] < __startrek_end_t0[3]); } } } #line 1 if (__startrek_start_t1[0] <= __startrek_end_t2[1]) { #line 1 if (__startrek_start_t2[1] <= __startrek_end_t1[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[0] <= __startrek_start_t2[1]); #line 1 __VERIFIER_assume(__startrek_end_t2[1] < __startrek_end_t1[0]); #line 1 __VERIFIER_assume(__startrek_end_t2[0] < __startrek_start_t1[0]); } } } #line 1 if (__startrek_start_t1[1] <= __startrek_end_t2[1]) { #line 1 if (__startrek_start_t2[1] <= __startrek_end_t1[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[1] <= __startrek_start_t2[1]); #line 1 __VERIFIER_assume(__startrek_end_t2[1] < __startrek_end_t1[1]); #line 1 __VERIFIER_assume(__startrek_end_t2[0] < __startrek_start_t1[1]); } } } #line 1 if (__startrek_start_t1[2] <= __startrek_end_t2[1]) { #line 1 if (__startrek_start_t2[1] <= __startrek_end_t1[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[2] <= __startrek_start_t2[1]); #line 1 __VERIFIER_assume(__startrek_end_t2[1] < __startrek_end_t1[2]); #line 1 __VERIFIER_assume(__startrek_end_t2[0] < __startrek_start_t1[2]); } } } #line 1 if (__startrek_start_t1[3] <= __startrek_end_t2[1]) { #line 1 if (__startrek_start_t2[1] <= __startrek_end_t1[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[3] <= __startrek_start_t2[1]); #line 1 __VERIFIER_assume(__startrek_end_t2[1] < __startrek_end_t1[3]); #line 1 __VERIFIER_assume(__startrek_end_t2[0] < __startrek_start_t1[3]); } } } #line 1 if (__startrek_start_t1[4] <= __startrek_end_t2[1]) { #line 1 if (__startrek_start_t2[1] <= __startrek_end_t1[4]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[4] <= __startrek_start_t2[1]); #line 1 __VERIFIER_assume(__startrek_end_t2[1] < __startrek_end_t1[4]); #line 1 __VERIFIER_assume(__startrek_end_t2[0] < __startrek_start_t1[4]); } } } #line 1 if (__startrek_start_t1[5] <= __startrek_end_t2[1]) { #line 1 if (__startrek_start_t2[1] <= __startrek_end_t1[5]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[5] <= __startrek_start_t2[1]); #line 1 __VERIFIER_assume(__startrek_end_t2[1] < __startrek_end_t1[5]); #line 1 __VERIFIER_assume(__startrek_end_t2[0] < __startrek_start_t1[5]); } } } #line 1 if (__startrek_start_t1[6] <= __startrek_end_t2[1]) { #line 1 if (__startrek_start_t2[1] <= __startrek_end_t1[6]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[6] <= __startrek_start_t2[1]); #line 1 __VERIFIER_assume(__startrek_end_t2[1] < __startrek_end_t1[6]); #line 1 __VERIFIER_assume(__startrek_end_t2[0] < __startrek_start_t1[6]); } } } #line 1 if (__startrek_start_t1[7] <= __startrek_end_t2[1]) { #line 1 if (__startrek_start_t2[1] <= __startrek_end_t1[7]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[7] <= __startrek_start_t2[1]); #line 1 __VERIFIER_assume(__startrek_end_t2[1] < __startrek_end_t1[7]); #line 1 __VERIFIER_assume(__startrek_end_t2[0] < __startrek_start_t1[7]); } } } #line 1 if (__startrek_start_t0[0] <= __startrek_end_t2[2]) { #line 1 if (__startrek_start_t2[2] <= __startrek_end_t0[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[0] <= __startrek_start_t2[2]); #line 1 __VERIFIER_assume(__startrek_end_t2[2] < __startrek_end_t0[0]); #line 1 __VERIFIER_assume(__startrek_end_t2[0] < __startrek_start_t0[0]); } } } #line 1 if (__startrek_start_t0[1] <= __startrek_end_t2[2]) { #line 1 if (__startrek_start_t2[2] <= __startrek_end_t0[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[1] <= __startrek_start_t2[2]); #line 1 __VERIFIER_assume(__startrek_end_t2[2] < __startrek_end_t0[1]); #line 1 __VERIFIER_assume(__startrek_end_t2[0] < __startrek_start_t0[1]); } } } #line 1 if (__startrek_start_t0[2] <= __startrek_end_t2[2]) { #line 1 if (__startrek_start_t2[2] <= __startrek_end_t0[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[2] <= __startrek_start_t2[2]); #line 1 __VERIFIER_assume(__startrek_end_t2[2] < __startrek_end_t0[2]); #line 1 __VERIFIER_assume(__startrek_end_t2[0] < __startrek_start_t0[2]); } } } #line 1 if (__startrek_start_t0[3] <= __startrek_end_t2[2]) { #line 1 if (__startrek_start_t2[2] <= __startrek_end_t0[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[3] <= __startrek_start_t2[2]); #line 1 __VERIFIER_assume(__startrek_end_t2[2] < __startrek_end_t0[3]); #line 1 __VERIFIER_assume(__startrek_end_t2[0] < __startrek_start_t0[3]); } } } #line 1 if (__startrek_start_t1[0] <= __startrek_end_t2[2]) { #line 1 if (__startrek_start_t2[2] <= __startrek_end_t1[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[0] <= __startrek_start_t2[2]); #line 1 __VERIFIER_assume(__startrek_end_t2[2] < __startrek_end_t1[0]); #line 1 __VERIFIER_assume(__startrek_end_t2[1] < __startrek_start_t1[0]); } } } #line 1 if (__startrek_start_t1[1] <= __startrek_end_t2[2]) { #line 1 if (__startrek_start_t2[2] <= __startrek_end_t1[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[1] <= __startrek_start_t2[2]); #line 1 __VERIFIER_assume(__startrek_end_t2[2] < __startrek_end_t1[1]); #line 1 __VERIFIER_assume(__startrek_end_t2[1] < __startrek_start_t1[1]); } } } #line 1 if (__startrek_start_t1[2] <= __startrek_end_t2[2]) { #line 1 if (__startrek_start_t2[2] <= __startrek_end_t1[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[2] <= __startrek_start_t2[2]); #line 1 __VERIFIER_assume(__startrek_end_t2[2] < __startrek_end_t1[2]); #line 1 __VERIFIER_assume(__startrek_end_t2[1] < __startrek_start_t1[2]); } } } #line 1 if (__startrek_start_t1[3] <= __startrek_end_t2[2]) { #line 1 if (__startrek_start_t2[2] <= __startrek_end_t1[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[3] <= __startrek_start_t2[2]); #line 1 __VERIFIER_assume(__startrek_end_t2[2] < __startrek_end_t1[3]); #line 1 __VERIFIER_assume(__startrek_end_t2[1] < __startrek_start_t1[3]); } } } #line 1 if (__startrek_start_t1[4] <= __startrek_end_t2[2]) { #line 1 if (__startrek_start_t2[2] <= __startrek_end_t1[4]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[4] <= __startrek_start_t2[2]); #line 1 __VERIFIER_assume(__startrek_end_t2[2] < __startrek_end_t1[4]); #line 1 __VERIFIER_assume(__startrek_end_t2[1] < __startrek_start_t1[4]); } } } #line 1 if (__startrek_start_t1[5] <= __startrek_end_t2[2]) { #line 1 if (__startrek_start_t2[2] <= __startrek_end_t1[5]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[5] <= __startrek_start_t2[2]); #line 1 __VERIFIER_assume(__startrek_end_t2[2] < __startrek_end_t1[5]); #line 1 __VERIFIER_assume(__startrek_end_t2[1] < __startrek_start_t1[5]); } } } #line 1 if (__startrek_start_t1[6] <= __startrek_end_t2[2]) { #line 1 if (__startrek_start_t2[2] <= __startrek_end_t1[6]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[6] <= __startrek_start_t2[2]); #line 1 __VERIFIER_assume(__startrek_end_t2[2] < __startrek_end_t1[6]); #line 1 __VERIFIER_assume(__startrek_end_t2[1] < __startrek_start_t1[6]); } } } #line 1 if (__startrek_start_t1[7] <= __startrek_end_t2[2]) { #line 1 if (__startrek_start_t2[2] <= __startrek_end_t1[7]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[7] <= __startrek_start_t2[2]); #line 1 __VERIFIER_assume(__startrek_end_t2[2] < __startrek_end_t1[7]); #line 1 __VERIFIER_assume(__startrek_end_t2[1] < __startrek_start_t1[7]); } } } #line 1 if (__startrek_start_t0[0] <= __startrek_end_t2[3]) { #line 1 if (__startrek_start_t2[3] <= __startrek_end_t0[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[0] <= __startrek_start_t2[3]); #line 1 __VERIFIER_assume(__startrek_end_t2[3] < __startrek_end_t0[0]); #line 1 __VERIFIER_assume(__startrek_end_t2[1] < __startrek_start_t0[0]); } } } #line 1 if (__startrek_start_t0[1] <= __startrek_end_t2[3]) { #line 1 if (__startrek_start_t2[3] <= __startrek_end_t0[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[1] <= __startrek_start_t2[3]); #line 1 __VERIFIER_assume(__startrek_end_t2[3] < __startrek_end_t0[1]); #line 1 __VERIFIER_assume(__startrek_end_t2[1] < __startrek_start_t0[1]); } } } #line 1 if (__startrek_start_t0[2] <= __startrek_end_t2[3]) { #line 1 if (__startrek_start_t2[3] <= __startrek_end_t0[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[2] <= __startrek_start_t2[3]); #line 1 __VERIFIER_assume(__startrek_end_t2[3] < __startrek_end_t0[2]); #line 1 __VERIFIER_assume(__startrek_end_t2[1] < __startrek_start_t0[2]); } } } #line 1 if (__startrek_start_t0[3] <= __startrek_end_t2[3]) { #line 1 if (__startrek_start_t2[3] <= __startrek_end_t0[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[3] <= __startrek_start_t2[3]); #line 1 __VERIFIER_assume(__startrek_end_t2[3] < __startrek_end_t0[3]); #line 1 __VERIFIER_assume(__startrek_end_t2[1] < __startrek_start_t0[3]); } } } #line 1 if (__startrek_start_t1[0] <= __startrek_end_t2[3]) { #line 1 if (__startrek_start_t2[3] <= __startrek_end_t1[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[0] <= __startrek_start_t2[3]); #line 1 __VERIFIER_assume(__startrek_end_t2[3] < __startrek_end_t1[0]); #line 1 __VERIFIER_assume(__startrek_end_t2[2] < __startrek_start_t1[0]); } } } #line 1 if (__startrek_start_t1[1] <= __startrek_end_t2[3]) { #line 1 if (__startrek_start_t2[3] <= __startrek_end_t1[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[1] <= __startrek_start_t2[3]); #line 1 __VERIFIER_assume(__startrek_end_t2[3] < __startrek_end_t1[1]); #line 1 __VERIFIER_assume(__startrek_end_t2[2] < __startrek_start_t1[1]); } } } #line 1 if (__startrek_start_t1[2] <= __startrek_end_t2[3]) { #line 1 if (__startrek_start_t2[3] <= __startrek_end_t1[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[2] <= __startrek_start_t2[3]); #line 1 __VERIFIER_assume(__startrek_end_t2[3] < __startrek_end_t1[2]); #line 1 __VERIFIER_assume(__startrek_end_t2[2] < __startrek_start_t1[2]); } } } #line 1 if (__startrek_start_t1[3] <= __startrek_end_t2[3]) { #line 1 if (__startrek_start_t2[3] <= __startrek_end_t1[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[3] <= __startrek_start_t2[3]); #line 1 __VERIFIER_assume(__startrek_end_t2[3] < __startrek_end_t1[3]); #line 1 __VERIFIER_assume(__startrek_end_t2[2] < __startrek_start_t1[3]); } } } #line 1 if (__startrek_start_t1[4] <= __startrek_end_t2[3]) { #line 1 if (__startrek_start_t2[3] <= __startrek_end_t1[4]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[4] <= __startrek_start_t2[3]); #line 1 __VERIFIER_assume(__startrek_end_t2[3] < __startrek_end_t1[4]); #line 1 __VERIFIER_assume(__startrek_end_t2[2] < __startrek_start_t1[4]); } } } #line 1 if (__startrek_start_t1[5] <= __startrek_end_t2[3]) { #line 1 if (__startrek_start_t2[3] <= __startrek_end_t1[5]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[5] <= __startrek_start_t2[3]); #line 1 __VERIFIER_assume(__startrek_end_t2[3] < __startrek_end_t1[5]); #line 1 __VERIFIER_assume(__startrek_end_t2[2] < __startrek_start_t1[5]); } } } #line 1 if (__startrek_start_t1[6] <= __startrek_end_t2[3]) { #line 1 if (__startrek_start_t2[3] <= __startrek_end_t1[6]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[6] <= __startrek_start_t2[3]); #line 1 __VERIFIER_assume(__startrek_end_t2[3] < __startrek_end_t1[6]); #line 1 __VERIFIER_assume(__startrek_end_t2[2] < __startrek_start_t1[6]); } } } #line 1 if (__startrek_start_t1[7] <= __startrek_end_t2[3]) { #line 1 if (__startrek_start_t2[3] <= __startrek_end_t1[7]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[7] <= __startrek_start_t2[3]); #line 1 __VERIFIER_assume(__startrek_end_t2[3] < __startrek_end_t1[7]); #line 1 __VERIFIER_assume(__startrek_end_t2[2] < __startrek_start_t1[7]); } } } #line 1 if (__startrek_start_t0[0] <= __startrek_end_t2[4]) { #line 1 if (__startrek_start_t2[4] <= __startrek_end_t0[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[0] <= __startrek_start_t2[4]); #line 1 __VERIFIER_assume(__startrek_end_t2[4] < __startrek_end_t0[0]); #line 1 __VERIFIER_assume(__startrek_end_t2[2] < __startrek_start_t0[0]); } } } #line 1 if (__startrek_start_t0[1] <= __startrek_end_t2[4]) { #line 1 if (__startrek_start_t2[4] <= __startrek_end_t0[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[1] <= __startrek_start_t2[4]); #line 1 __VERIFIER_assume(__startrek_end_t2[4] < __startrek_end_t0[1]); #line 1 __VERIFIER_assume(__startrek_end_t2[2] < __startrek_start_t0[1]); } } } #line 1 if (__startrek_start_t0[2] <= __startrek_end_t2[4]) { #line 1 if (__startrek_start_t2[4] <= __startrek_end_t0[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[2] <= __startrek_start_t2[4]); #line 1 __VERIFIER_assume(__startrek_end_t2[4] < __startrek_end_t0[2]); #line 1 __VERIFIER_assume(__startrek_end_t2[2] < __startrek_start_t0[2]); } } } #line 1 if (__startrek_start_t0[3] <= __startrek_end_t2[4]) { #line 1 if (__startrek_start_t2[4] <= __startrek_end_t0[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[3] <= __startrek_start_t2[4]); #line 1 __VERIFIER_assume(__startrek_end_t2[4] < __startrek_end_t0[3]); #line 1 __VERIFIER_assume(__startrek_end_t2[2] < __startrek_start_t0[3]); } } } #line 1 if (__startrek_start_t1[0] <= __startrek_end_t2[4]) { #line 1 if (__startrek_start_t2[4] <= __startrek_end_t1[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[0] <= __startrek_start_t2[4]); #line 1 __VERIFIER_assume(__startrek_end_t2[4] < __startrek_end_t1[0]); #line 1 __VERIFIER_assume(__startrek_end_t2[3] < __startrek_start_t1[0]); } } } #line 1 if (__startrek_start_t1[1] <= __startrek_end_t2[4]) { #line 1 if (__startrek_start_t2[4] <= __startrek_end_t1[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[1] <= __startrek_start_t2[4]); #line 1 __VERIFIER_assume(__startrek_end_t2[4] < __startrek_end_t1[1]); #line 1 __VERIFIER_assume(__startrek_end_t2[3] < __startrek_start_t1[1]); } } } #line 1 if (__startrek_start_t1[2] <= __startrek_end_t2[4]) { #line 1 if (__startrek_start_t2[4] <= __startrek_end_t1[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[2] <= __startrek_start_t2[4]); #line 1 __VERIFIER_assume(__startrek_end_t2[4] < __startrek_end_t1[2]); #line 1 __VERIFIER_assume(__startrek_end_t2[3] < __startrek_start_t1[2]); } } } #line 1 if (__startrek_start_t1[3] <= __startrek_end_t2[4]) { #line 1 if (__startrek_start_t2[4] <= __startrek_end_t1[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[3] <= __startrek_start_t2[4]); #line 1 __VERIFIER_assume(__startrek_end_t2[4] < __startrek_end_t1[3]); #line 1 __VERIFIER_assume(__startrek_end_t2[3] < __startrek_start_t1[3]); } } } #line 1 if (__startrek_start_t1[4] <= __startrek_end_t2[4]) { #line 1 if (__startrek_start_t2[4] <= __startrek_end_t1[4]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[4] <= __startrek_start_t2[4]); #line 1 __VERIFIER_assume(__startrek_end_t2[4] < __startrek_end_t1[4]); #line 1 __VERIFIER_assume(__startrek_end_t2[3] < __startrek_start_t1[4]); } } } #line 1 if (__startrek_start_t1[5] <= __startrek_end_t2[4]) { #line 1 if (__startrek_start_t2[4] <= __startrek_end_t1[5]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[5] <= __startrek_start_t2[4]); #line 1 __VERIFIER_assume(__startrek_end_t2[4] < __startrek_end_t1[5]); #line 1 __VERIFIER_assume(__startrek_end_t2[3] < __startrek_start_t1[5]); } } } #line 1 if (__startrek_start_t1[6] <= __startrek_end_t2[4]) { #line 1 if (__startrek_start_t2[4] <= __startrek_end_t1[6]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[6] <= __startrek_start_t2[4]); #line 1 __VERIFIER_assume(__startrek_end_t2[4] < __startrek_end_t1[6]); #line 1 __VERIFIER_assume(__startrek_end_t2[3] < __startrek_start_t1[6]); } } } #line 1 if (__startrek_start_t1[7] <= __startrek_end_t2[4]) { #line 1 if (__startrek_start_t2[4] <= __startrek_end_t1[7]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[7] <= __startrek_start_t2[4]); #line 1 __VERIFIER_assume(__startrek_end_t2[4] < __startrek_end_t1[7]); #line 1 __VERIFIER_assume(__startrek_end_t2[3] < __startrek_start_t1[7]); } } } #line 1 if (__startrek_start_t0[0] <= __startrek_end_t2[5]) { #line 1 if (__startrek_start_t2[5] <= __startrek_end_t0[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[0] <= __startrek_start_t2[5]); #line 1 __VERIFIER_assume(__startrek_end_t2[5] < __startrek_end_t0[0]); #line 1 __VERIFIER_assume(__startrek_end_t2[3] < __startrek_start_t0[0]); } } } #line 1 if (__startrek_start_t0[1] <= __startrek_end_t2[5]) { #line 1 if (__startrek_start_t2[5] <= __startrek_end_t0[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[1] <= __startrek_start_t2[5]); #line 1 __VERIFIER_assume(__startrek_end_t2[5] < __startrek_end_t0[1]); #line 1 __VERIFIER_assume(__startrek_end_t2[3] < __startrek_start_t0[1]); } } } #line 1 if (__startrek_start_t0[2] <= __startrek_end_t2[5]) { #line 1 if (__startrek_start_t2[5] <= __startrek_end_t0[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[2] <= __startrek_start_t2[5]); #line 1 __VERIFIER_assume(__startrek_end_t2[5] < __startrek_end_t0[2]); #line 1 __VERIFIER_assume(__startrek_end_t2[3] < __startrek_start_t0[2]); } } } #line 1 if (__startrek_start_t0[3] <= __startrek_end_t2[5]) { #line 1 if (__startrek_start_t2[5] <= __startrek_end_t0[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[3] <= __startrek_start_t2[5]); #line 1 __VERIFIER_assume(__startrek_end_t2[5] < __startrek_end_t0[3]); #line 1 __VERIFIER_assume(__startrek_end_t2[3] < __startrek_start_t0[3]); } } } #line 1 if (__startrek_start_t1[0] <= __startrek_end_t2[5]) { #line 1 if (__startrek_start_t2[5] <= __startrek_end_t1[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[0] <= __startrek_start_t2[5]); #line 1 __VERIFIER_assume(__startrek_end_t2[5] < __startrek_end_t1[0]); #line 1 __VERIFIER_assume(__startrek_end_t2[4] < __startrek_start_t1[0]); } } } #line 1 if (__startrek_start_t1[1] <= __startrek_end_t2[5]) { #line 1 if (__startrek_start_t2[5] <= __startrek_end_t1[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[1] <= __startrek_start_t2[5]); #line 1 __VERIFIER_assume(__startrek_end_t2[5] < __startrek_end_t1[1]); #line 1 __VERIFIER_assume(__startrek_end_t2[4] < __startrek_start_t1[1]); } } } #line 1 if (__startrek_start_t1[2] <= __startrek_end_t2[5]) { #line 1 if (__startrek_start_t2[5] <= __startrek_end_t1[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[2] <= __startrek_start_t2[5]); #line 1 __VERIFIER_assume(__startrek_end_t2[5] < __startrek_end_t1[2]); #line 1 __VERIFIER_assume(__startrek_end_t2[4] < __startrek_start_t1[2]); } } } #line 1 if (__startrek_start_t1[3] <= __startrek_end_t2[5]) { #line 1 if (__startrek_start_t2[5] <= __startrek_end_t1[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[3] <= __startrek_start_t2[5]); #line 1 __VERIFIER_assume(__startrek_end_t2[5] < __startrek_end_t1[3]); #line 1 __VERIFIER_assume(__startrek_end_t2[4] < __startrek_start_t1[3]); } } } #line 1 if (__startrek_start_t1[4] <= __startrek_end_t2[5]) { #line 1 if (__startrek_start_t2[5] <= __startrek_end_t1[4]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[4] <= __startrek_start_t2[5]); #line 1 __VERIFIER_assume(__startrek_end_t2[5] < __startrek_end_t1[4]); #line 1 __VERIFIER_assume(__startrek_end_t2[4] < __startrek_start_t1[4]); } } } #line 1 if (__startrek_start_t1[5] <= __startrek_end_t2[5]) { #line 1 if (__startrek_start_t2[5] <= __startrek_end_t1[5]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[5] <= __startrek_start_t2[5]); #line 1 __VERIFIER_assume(__startrek_end_t2[5] < __startrek_end_t1[5]); #line 1 __VERIFIER_assume(__startrek_end_t2[4] < __startrek_start_t1[5]); } } } #line 1 if (__startrek_start_t1[6] <= __startrek_end_t2[5]) { #line 1 if (__startrek_start_t2[5] <= __startrek_end_t1[6]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[6] <= __startrek_start_t2[5]); #line 1 __VERIFIER_assume(__startrek_end_t2[5] < __startrek_end_t1[6]); #line 1 __VERIFIER_assume(__startrek_end_t2[4] < __startrek_start_t1[6]); } } } #line 1 if (__startrek_start_t1[7] <= __startrek_end_t2[5]) { #line 1 if (__startrek_start_t2[5] <= __startrek_end_t1[7]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[7] <= __startrek_start_t2[5]); #line 1 __VERIFIER_assume(__startrek_end_t2[5] < __startrek_end_t1[7]); #line 1 __VERIFIER_assume(__startrek_end_t2[4] < __startrek_start_t1[7]); } } } #line 1 if (__startrek_start_t0[0] <= __startrek_end_t2[6]) { #line 1 if (__startrek_start_t2[6] <= __startrek_end_t0[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[0] <= __startrek_start_t2[6]); #line 1 __VERIFIER_assume(__startrek_end_t2[6] < __startrek_end_t0[0]); #line 1 __VERIFIER_assume(__startrek_end_t2[4] < __startrek_start_t0[0]); } } } #line 1 if (__startrek_start_t0[1] <= __startrek_end_t2[6]) { #line 1 if (__startrek_start_t2[6] <= __startrek_end_t0[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[1] <= __startrek_start_t2[6]); #line 1 __VERIFIER_assume(__startrek_end_t2[6] < __startrek_end_t0[1]); #line 1 __VERIFIER_assume(__startrek_end_t2[4] < __startrek_start_t0[1]); } } } #line 1 if (__startrek_start_t0[2] <= __startrek_end_t2[6]) { #line 1 if (__startrek_start_t2[6] <= __startrek_end_t0[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[2] <= __startrek_start_t2[6]); #line 1 __VERIFIER_assume(__startrek_end_t2[6] < __startrek_end_t0[2]); #line 1 __VERIFIER_assume(__startrek_end_t2[4] < __startrek_start_t0[2]); } } } #line 1 if (__startrek_start_t0[3] <= __startrek_end_t2[6]) { #line 1 if (__startrek_start_t2[6] <= __startrek_end_t0[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[3] <= __startrek_start_t2[6]); #line 1 __VERIFIER_assume(__startrek_end_t2[6] < __startrek_end_t0[3]); #line 1 __VERIFIER_assume(__startrek_end_t2[4] < __startrek_start_t0[3]); } } } #line 1 if (__startrek_start_t1[0] <= __startrek_end_t2[6]) { #line 1 if (__startrek_start_t2[6] <= __startrek_end_t1[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[0] <= __startrek_start_t2[6]); #line 1 __VERIFIER_assume(__startrek_end_t2[6] < __startrek_end_t1[0]); #line 1 __VERIFIER_assume(__startrek_end_t2[5] < __startrek_start_t1[0]); } } } #line 1 if (__startrek_start_t1[1] <= __startrek_end_t2[6]) { #line 1 if (__startrek_start_t2[6] <= __startrek_end_t1[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[1] <= __startrek_start_t2[6]); #line 1 __VERIFIER_assume(__startrek_end_t2[6] < __startrek_end_t1[1]); #line 1 __VERIFIER_assume(__startrek_end_t2[5] < __startrek_start_t1[1]); } } } #line 1 if (__startrek_start_t1[2] <= __startrek_end_t2[6]) { #line 1 if (__startrek_start_t2[6] <= __startrek_end_t1[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[2] <= __startrek_start_t2[6]); #line 1 __VERIFIER_assume(__startrek_end_t2[6] < __startrek_end_t1[2]); #line 1 __VERIFIER_assume(__startrek_end_t2[5] < __startrek_start_t1[2]); } } } #line 1 if (__startrek_start_t1[3] <= __startrek_end_t2[6]) { #line 1 if (__startrek_start_t2[6] <= __startrek_end_t1[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[3] <= __startrek_start_t2[6]); #line 1 __VERIFIER_assume(__startrek_end_t2[6] < __startrek_end_t1[3]); #line 1 __VERIFIER_assume(__startrek_end_t2[5] < __startrek_start_t1[3]); } } } #line 1 if (__startrek_start_t1[4] <= __startrek_end_t2[6]) { #line 1 if (__startrek_start_t2[6] <= __startrek_end_t1[4]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[4] <= __startrek_start_t2[6]); #line 1 __VERIFIER_assume(__startrek_end_t2[6] < __startrek_end_t1[4]); #line 1 __VERIFIER_assume(__startrek_end_t2[5] < __startrek_start_t1[4]); } } } #line 1 if (__startrek_start_t1[5] <= __startrek_end_t2[6]) { #line 1 if (__startrek_start_t2[6] <= __startrek_end_t1[5]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[5] <= __startrek_start_t2[6]); #line 1 __VERIFIER_assume(__startrek_end_t2[6] < __startrek_end_t1[5]); #line 1 __VERIFIER_assume(__startrek_end_t2[5] < __startrek_start_t1[5]); } } } #line 1 if (__startrek_start_t1[6] <= __startrek_end_t2[6]) { #line 1 if (__startrek_start_t2[6] <= __startrek_end_t1[6]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[6] <= __startrek_start_t2[6]); #line 1 __VERIFIER_assume(__startrek_end_t2[6] < __startrek_end_t1[6]); #line 1 __VERIFIER_assume(__startrek_end_t2[5] < __startrek_start_t1[6]); } } } #line 1 if (__startrek_start_t1[7] <= __startrek_end_t2[6]) { #line 1 if (__startrek_start_t2[6] <= __startrek_end_t1[7]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[7] <= __startrek_start_t2[6]); #line 1 __VERIFIER_assume(__startrek_end_t2[6] < __startrek_end_t1[7]); #line 1 __VERIFIER_assume(__startrek_end_t2[5] < __startrek_start_t1[7]); } } } #line 1 if (__startrek_start_t0[0] <= __startrek_end_t2[7]) { #line 1 if (__startrek_start_t2[7] <= __startrek_end_t0[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[0] <= __startrek_start_t2[7]); #line 1 __VERIFIER_assume(__startrek_end_t2[7] < __startrek_end_t0[0]); #line 1 __VERIFIER_assume(__startrek_end_t2[5] < __startrek_start_t0[0]); } } } #line 1 if (__startrek_start_t0[1] <= __startrek_end_t2[7]) { #line 1 if (__startrek_start_t2[7] <= __startrek_end_t0[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[1] <= __startrek_start_t2[7]); #line 1 __VERIFIER_assume(__startrek_end_t2[7] < __startrek_end_t0[1]); #line 1 __VERIFIER_assume(__startrek_end_t2[5] < __startrek_start_t0[1]); } } } #line 1 if (__startrek_start_t0[2] <= __startrek_end_t2[7]) { #line 1 if (__startrek_start_t2[7] <= __startrek_end_t0[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[2] <= __startrek_start_t2[7]); #line 1 __VERIFIER_assume(__startrek_end_t2[7] < __startrek_end_t0[2]); #line 1 __VERIFIER_assume(__startrek_end_t2[5] < __startrek_start_t0[2]); } } } #line 1 if (__startrek_start_t0[3] <= __startrek_end_t2[7]) { #line 1 if (__startrek_start_t2[7] <= __startrek_end_t0[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[3] <= __startrek_start_t2[7]); #line 1 __VERIFIER_assume(__startrek_end_t2[7] < __startrek_end_t0[3]); #line 1 __VERIFIER_assume(__startrek_end_t2[5] < __startrek_start_t0[3]); } } } #line 1 if (__startrek_start_t1[0] <= __startrek_end_t2[7]) { #line 1 if (__startrek_start_t2[7] <= __startrek_end_t1[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[0] <= __startrek_start_t2[7]); #line 1 __VERIFIER_assume(__startrek_end_t2[7] < __startrek_end_t1[0]); #line 1 __VERIFIER_assume(__startrek_end_t2[6] < __startrek_start_t1[0]); } } } #line 1 if (__startrek_start_t1[1] <= __startrek_end_t2[7]) { #line 1 if (__startrek_start_t2[7] <= __startrek_end_t1[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[1] <= __startrek_start_t2[7]); #line 1 __VERIFIER_assume(__startrek_end_t2[7] < __startrek_end_t1[1]); #line 1 __VERIFIER_assume(__startrek_end_t2[6] < __startrek_start_t1[1]); } } } #line 1 if (__startrek_start_t1[2] <= __startrek_end_t2[7]) { #line 1 if (__startrek_start_t2[7] <= __startrek_end_t1[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[2] <= __startrek_start_t2[7]); #line 1 __VERIFIER_assume(__startrek_end_t2[7] < __startrek_end_t1[2]); #line 1 __VERIFIER_assume(__startrek_end_t2[6] < __startrek_start_t1[2]); } } } #line 1 if (__startrek_start_t1[3] <= __startrek_end_t2[7]) { #line 1 if (__startrek_start_t2[7] <= __startrek_end_t1[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[3] <= __startrek_start_t2[7]); #line 1 __VERIFIER_assume(__startrek_end_t2[7] < __startrek_end_t1[3]); #line 1 __VERIFIER_assume(__startrek_end_t2[6] < __startrek_start_t1[3]); } } } #line 1 if (__startrek_start_t1[4] <= __startrek_end_t2[7]) { #line 1 if (__startrek_start_t2[7] <= __startrek_end_t1[4]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[4] <= __startrek_start_t2[7]); #line 1 __VERIFIER_assume(__startrek_end_t2[7] < __startrek_end_t1[4]); #line 1 __VERIFIER_assume(__startrek_end_t2[6] < __startrek_start_t1[4]); } } } #line 1 if (__startrek_start_t1[5] <= __startrek_end_t2[7]) { #line 1 if (__startrek_start_t2[7] <= __startrek_end_t1[5]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[5] <= __startrek_start_t2[7]); #line 1 __VERIFIER_assume(__startrek_end_t2[7] < __startrek_end_t1[5]); #line 1 __VERIFIER_assume(__startrek_end_t2[6] < __startrek_start_t1[5]); } } } #line 1 if (__startrek_start_t1[6] <= __startrek_end_t2[7]) { #line 1 if (__startrek_start_t2[7] <= __startrek_end_t1[6]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[6] <= __startrek_start_t2[7]); #line 1 __VERIFIER_assume(__startrek_end_t2[7] < __startrek_end_t1[6]); #line 1 __VERIFIER_assume(__startrek_end_t2[6] < __startrek_start_t1[6]); } } } #line 1 if (__startrek_start_t1[7] <= __startrek_end_t2[7]) { #line 1 if (__startrek_start_t2[7] <= __startrek_end_t1[7]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[7] <= __startrek_start_t2[7]); #line 1 __VERIFIER_assume(__startrek_end_t2[7] < __startrek_end_t1[7]); #line 1 __VERIFIER_assume(__startrek_end_t2[6] < __startrek_start_t1[7]); } } } #line 1 __startrek_start_t3[0] = __VERIFIER_nondet_uchar(); #line 1 __startrek_end_t3[0] = __startrek_start_t3[0]; #line 1 __startrek_start_t3[1] = __VERIFIER_nondet_uchar(); #line 1 __startrek_end_t3[1] = __startrek_start_t3[1]; #line 1 __startrek_start_t3[2] = __VERIFIER_nondet_uchar(); #line 1 __startrek_end_t3[2] = __startrek_start_t3[2]; #line 1 __startrek_start_t3[3] = __VERIFIER_nondet_uchar(); #line 1 __startrek_end_t3[3] = __startrek_start_t3[3]; #line 1 __startrek_start_t3[4] = __VERIFIER_nondet_uchar(); #line 1 __startrek_end_t3[4] = __startrek_start_t3[4]; #line 1 __startrek_start_t3[5] = __VERIFIER_nondet_uchar(); #line 1 __startrek_end_t3[5] = __startrek_start_t3[5]; #line 1 __startrek_start_t3[6] = __VERIFIER_nondet_uchar(); #line 1 __startrek_end_t3[6] = __startrek_start_t3[6]; #line 1 __startrek_start_t3[7] = __VERIFIER_nondet_uchar(); #line 1 __startrek_end_t3[7] = __startrek_start_t3[7]; #line 1 __VERIFIER_assume(0 <= __startrek_start_t3[0]); #line 1 __VERIFIER_assume(__startrek_end_t3[7] <= 27); #line 1 __VERIFIER_assume(__startrek_end_t3[0] <= __startrek_start_t3[1] - 1); #line 1 __VERIFIER_assume(__startrek_end_t3[1] <= __startrek_start_t3[2] - 1); #line 1 __VERIFIER_assume(__startrek_end_t3[2] <= __startrek_start_t3[3] - 1); #line 1 __VERIFIER_assume(__startrek_end_t3[3] <= __startrek_start_t3[4] - 1); #line 1 __VERIFIER_assume(__startrek_end_t3[4] <= __startrek_start_t3[5] - 1); #line 1 __VERIFIER_assume(__startrek_end_t3[5] <= __startrek_start_t3[6] - 1); #line 1 __VERIFIER_assume(__startrek_end_t3[6] <= __startrek_start_t3[7] - 1); #line 1 if (__startrek_start_t0[0] <= __startrek_end_t3[0]) { #line 1 if (__startrek_start_t3[0] <= __startrek_end_t0[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[0] <= __startrek_start_t3[0]); #line 1 __VERIFIER_assume(__startrek_end_t3[0] < __startrek_end_t0[0]); } } } #line 1 if (__startrek_start_t0[1] <= __startrek_end_t3[0]) { #line 1 if (__startrek_start_t3[0] <= __startrek_end_t0[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[1] <= __startrek_start_t3[0]); #line 1 __VERIFIER_assume(__startrek_end_t3[0] < __startrek_end_t0[1]); } } } #line 1 if (__startrek_start_t0[2] <= __startrek_end_t3[0]) { #line 1 if (__startrek_start_t3[0] <= __startrek_end_t0[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[2] <= __startrek_start_t3[0]); #line 1 __VERIFIER_assume(__startrek_end_t3[0] < __startrek_end_t0[2]); } } } #line 1 if (__startrek_start_t0[3] <= __startrek_end_t3[0]) { #line 1 if (__startrek_start_t3[0] <= __startrek_end_t0[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[3] <= __startrek_start_t3[0]); #line 1 __VERIFIER_assume(__startrek_end_t3[0] < __startrek_end_t0[3]); } } } #line 1 if (__startrek_start_t1[0] <= __startrek_end_t3[0]) { #line 1 if (__startrek_start_t3[0] <= __startrek_end_t1[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[0] <= __startrek_start_t3[0]); #line 1 __VERIFIER_assume(__startrek_end_t3[0] < __startrek_end_t1[0]); } } } #line 1 if (__startrek_start_t1[1] <= __startrek_end_t3[0]) { #line 1 if (__startrek_start_t3[0] <= __startrek_end_t1[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[1] <= __startrek_start_t3[0]); #line 1 __VERIFIER_assume(__startrek_end_t3[0] < __startrek_end_t1[1]); } } } #line 1 if (__startrek_start_t1[2] <= __startrek_end_t3[0]) { #line 1 if (__startrek_start_t3[0] <= __startrek_end_t1[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[2] <= __startrek_start_t3[0]); #line 1 __VERIFIER_assume(__startrek_end_t3[0] < __startrek_end_t1[2]); } } } #line 1 if (__startrek_start_t1[3] <= __startrek_end_t3[0]) { #line 1 if (__startrek_start_t3[0] <= __startrek_end_t1[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[3] <= __startrek_start_t3[0]); #line 1 __VERIFIER_assume(__startrek_end_t3[0] < __startrek_end_t1[3]); } } } #line 1 if (__startrek_start_t1[4] <= __startrek_end_t3[0]) { #line 1 if (__startrek_start_t3[0] <= __startrek_end_t1[4]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[4] <= __startrek_start_t3[0]); #line 1 __VERIFIER_assume(__startrek_end_t3[0] < __startrek_end_t1[4]); } } } #line 1 if (__startrek_start_t1[5] <= __startrek_end_t3[0]) { #line 1 if (__startrek_start_t3[0] <= __startrek_end_t1[5]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[5] <= __startrek_start_t3[0]); #line 1 __VERIFIER_assume(__startrek_end_t3[0] < __startrek_end_t1[5]); } } } #line 1 if (__startrek_start_t1[6] <= __startrek_end_t3[0]) { #line 1 if (__startrek_start_t3[0] <= __startrek_end_t1[6]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[6] <= __startrek_start_t3[0]); #line 1 __VERIFIER_assume(__startrek_end_t3[0] < __startrek_end_t1[6]); } } } #line 1 if (__startrek_start_t1[7] <= __startrek_end_t3[0]) { #line 1 if (__startrek_start_t3[0] <= __startrek_end_t1[7]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[7] <= __startrek_start_t3[0]); #line 1 __VERIFIER_assume(__startrek_end_t3[0] < __startrek_end_t1[7]); } } } #line 1 if (__startrek_start_t2[0] <= __startrek_end_t3[0]) { #line 1 if (__startrek_start_t3[0] <= __startrek_end_t2[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[0] <= __startrek_start_t3[0]); #line 1 __VERIFIER_assume(__startrek_end_t3[0] < __startrek_end_t2[0]); } } } #line 1 if (__startrek_start_t2[1] <= __startrek_end_t3[0]) { #line 1 if (__startrek_start_t3[0] <= __startrek_end_t2[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[1] <= __startrek_start_t3[0]); #line 1 __VERIFIER_assume(__startrek_end_t3[0] < __startrek_end_t2[1]); } } } #line 1 if (__startrek_start_t2[2] <= __startrek_end_t3[0]) { #line 1 if (__startrek_start_t3[0] <= __startrek_end_t2[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[2] <= __startrek_start_t3[0]); #line 1 __VERIFIER_assume(__startrek_end_t3[0] < __startrek_end_t2[2]); } } } #line 1 if (__startrek_start_t2[3] <= __startrek_end_t3[0]) { #line 1 if (__startrek_start_t3[0] <= __startrek_end_t2[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[3] <= __startrek_start_t3[0]); #line 1 __VERIFIER_assume(__startrek_end_t3[0] < __startrek_end_t2[3]); } } } #line 1 if (__startrek_start_t2[4] <= __startrek_end_t3[0]) { #line 1 if (__startrek_start_t3[0] <= __startrek_end_t2[4]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[4] <= __startrek_start_t3[0]); #line 1 __VERIFIER_assume(__startrek_end_t3[0] < __startrek_end_t2[4]); } } } #line 1 if (__startrek_start_t2[5] <= __startrek_end_t3[0]) { #line 1 if (__startrek_start_t3[0] <= __startrek_end_t2[5]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[5] <= __startrek_start_t3[0]); #line 1 __VERIFIER_assume(__startrek_end_t3[0] < __startrek_end_t2[5]); } } } #line 1 if (__startrek_start_t2[6] <= __startrek_end_t3[0]) { #line 1 if (__startrek_start_t3[0] <= __startrek_end_t2[6]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[6] <= __startrek_start_t3[0]); #line 1 __VERIFIER_assume(__startrek_end_t3[0] < __startrek_end_t2[6]); } } } #line 1 if (__startrek_start_t2[7] <= __startrek_end_t3[0]) { #line 1 if (__startrek_start_t3[0] <= __startrek_end_t2[7]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[7] <= __startrek_start_t3[0]); #line 1 __VERIFIER_assume(__startrek_end_t3[0] < __startrek_end_t2[7]); } } } #line 1 if (__startrek_start_t0[0] <= __startrek_end_t3[1]) { #line 1 if (__startrek_start_t3[1] <= __startrek_end_t0[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[0] <= __startrek_start_t3[1]); #line 1 __VERIFIER_assume(__startrek_end_t3[1] < __startrek_end_t0[0]); } } } #line 1 if (__startrek_start_t0[1] <= __startrek_end_t3[1]) { #line 1 if (__startrek_start_t3[1] <= __startrek_end_t0[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[1] <= __startrek_start_t3[1]); #line 1 __VERIFIER_assume(__startrek_end_t3[1] < __startrek_end_t0[1]); } } } #line 1 if (__startrek_start_t0[2] <= __startrek_end_t3[1]) { #line 1 if (__startrek_start_t3[1] <= __startrek_end_t0[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[2] <= __startrek_start_t3[1]); #line 1 __VERIFIER_assume(__startrek_end_t3[1] < __startrek_end_t0[2]); } } } #line 1 if (__startrek_start_t0[3] <= __startrek_end_t3[1]) { #line 1 if (__startrek_start_t3[1] <= __startrek_end_t0[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[3] <= __startrek_start_t3[1]); #line 1 __VERIFIER_assume(__startrek_end_t3[1] < __startrek_end_t0[3]); } } } #line 1 if (__startrek_start_t1[0] <= __startrek_end_t3[1]) { #line 1 if (__startrek_start_t3[1] <= __startrek_end_t1[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[0] <= __startrek_start_t3[1]); #line 1 __VERIFIER_assume(__startrek_end_t3[1] < __startrek_end_t1[0]); #line 1 __VERIFIER_assume(__startrek_end_t3[0] < __startrek_start_t1[0]); } } } #line 1 if (__startrek_start_t1[1] <= __startrek_end_t3[1]) { #line 1 if (__startrek_start_t3[1] <= __startrek_end_t1[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[1] <= __startrek_start_t3[1]); #line 1 __VERIFIER_assume(__startrek_end_t3[1] < __startrek_end_t1[1]); #line 1 __VERIFIER_assume(__startrek_end_t3[0] < __startrek_start_t1[1]); } } } #line 1 if (__startrek_start_t1[2] <= __startrek_end_t3[1]) { #line 1 if (__startrek_start_t3[1] <= __startrek_end_t1[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[2] <= __startrek_start_t3[1]); #line 1 __VERIFIER_assume(__startrek_end_t3[1] < __startrek_end_t1[2]); #line 1 __VERIFIER_assume(__startrek_end_t3[0] < __startrek_start_t1[2]); } } } #line 1 if (__startrek_start_t1[3] <= __startrek_end_t3[1]) { #line 1 if (__startrek_start_t3[1] <= __startrek_end_t1[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[3] <= __startrek_start_t3[1]); #line 1 __VERIFIER_assume(__startrek_end_t3[1] < __startrek_end_t1[3]); #line 1 __VERIFIER_assume(__startrek_end_t3[0] < __startrek_start_t1[3]); } } } #line 1 if (__startrek_start_t1[4] <= __startrek_end_t3[1]) { #line 1 if (__startrek_start_t3[1] <= __startrek_end_t1[4]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[4] <= __startrek_start_t3[1]); #line 1 __VERIFIER_assume(__startrek_end_t3[1] < __startrek_end_t1[4]); #line 1 __VERIFIER_assume(__startrek_end_t3[0] < __startrek_start_t1[4]); } } } #line 1 if (__startrek_start_t1[5] <= __startrek_end_t3[1]) { #line 1 if (__startrek_start_t3[1] <= __startrek_end_t1[5]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[5] <= __startrek_start_t3[1]); #line 1 __VERIFIER_assume(__startrek_end_t3[1] < __startrek_end_t1[5]); #line 1 __VERIFIER_assume(__startrek_end_t3[0] < __startrek_start_t1[5]); } } } #line 1 if (__startrek_start_t1[6] <= __startrek_end_t3[1]) { #line 1 if (__startrek_start_t3[1] <= __startrek_end_t1[6]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[6] <= __startrek_start_t3[1]); #line 1 __VERIFIER_assume(__startrek_end_t3[1] < __startrek_end_t1[6]); #line 1 __VERIFIER_assume(__startrek_end_t3[0] < __startrek_start_t1[6]); } } } #line 1 if (__startrek_start_t1[7] <= __startrek_end_t3[1]) { #line 1 if (__startrek_start_t3[1] <= __startrek_end_t1[7]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[7] <= __startrek_start_t3[1]); #line 1 __VERIFIER_assume(__startrek_end_t3[1] < __startrek_end_t1[7]); #line 1 __VERIFIER_assume(__startrek_end_t3[0] < __startrek_start_t1[7]); } } } #line 1 if (__startrek_start_t2[0] <= __startrek_end_t3[1]) { #line 1 if (__startrek_start_t3[1] <= __startrek_end_t2[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[0] <= __startrek_start_t3[1]); #line 1 __VERIFIER_assume(__startrek_end_t3[1] < __startrek_end_t2[0]); #line 1 __VERIFIER_assume(__startrek_end_t3[0] < __startrek_start_t2[0]); } } } #line 1 if (__startrek_start_t2[1] <= __startrek_end_t3[1]) { #line 1 if (__startrek_start_t3[1] <= __startrek_end_t2[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[1] <= __startrek_start_t3[1]); #line 1 __VERIFIER_assume(__startrek_end_t3[1] < __startrek_end_t2[1]); #line 1 __VERIFIER_assume(__startrek_end_t3[0] < __startrek_start_t2[1]); } } } #line 1 if (__startrek_start_t2[2] <= __startrek_end_t3[1]) { #line 1 if (__startrek_start_t3[1] <= __startrek_end_t2[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[2] <= __startrek_start_t3[1]); #line 1 __VERIFIER_assume(__startrek_end_t3[1] < __startrek_end_t2[2]); #line 1 __VERIFIER_assume(__startrek_end_t3[0] < __startrek_start_t2[2]); } } } #line 1 if (__startrek_start_t2[3] <= __startrek_end_t3[1]) { #line 1 if (__startrek_start_t3[1] <= __startrek_end_t2[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[3] <= __startrek_start_t3[1]); #line 1 __VERIFIER_assume(__startrek_end_t3[1] < __startrek_end_t2[3]); #line 1 __VERIFIER_assume(__startrek_end_t3[0] < __startrek_start_t2[3]); } } } #line 1 if (__startrek_start_t2[4] <= __startrek_end_t3[1]) { #line 1 if (__startrek_start_t3[1] <= __startrek_end_t2[4]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[4] <= __startrek_start_t3[1]); #line 1 __VERIFIER_assume(__startrek_end_t3[1] < __startrek_end_t2[4]); #line 1 __VERIFIER_assume(__startrek_end_t3[0] < __startrek_start_t2[4]); } } } #line 1 if (__startrek_start_t2[5] <= __startrek_end_t3[1]) { #line 1 if (__startrek_start_t3[1] <= __startrek_end_t2[5]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[5] <= __startrek_start_t3[1]); #line 1 __VERIFIER_assume(__startrek_end_t3[1] < __startrek_end_t2[5]); #line 1 __VERIFIER_assume(__startrek_end_t3[0] < __startrek_start_t2[5]); } } } #line 1 if (__startrek_start_t2[6] <= __startrek_end_t3[1]) { #line 1 if (__startrek_start_t3[1] <= __startrek_end_t2[6]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[6] <= __startrek_start_t3[1]); #line 1 __VERIFIER_assume(__startrek_end_t3[1] < __startrek_end_t2[6]); #line 1 __VERIFIER_assume(__startrek_end_t3[0] < __startrek_start_t2[6]); } } } #line 1 if (__startrek_start_t2[7] <= __startrek_end_t3[1]) { #line 1 if (__startrek_start_t3[1] <= __startrek_end_t2[7]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[7] <= __startrek_start_t3[1]); #line 1 __VERIFIER_assume(__startrek_end_t3[1] < __startrek_end_t2[7]); #line 1 __VERIFIER_assume(__startrek_end_t3[0] < __startrek_start_t2[7]); } } } #line 1 if (__startrek_start_t0[0] <= __startrek_end_t3[2]) { #line 1 if (__startrek_start_t3[2] <= __startrek_end_t0[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[0] <= __startrek_start_t3[2]); #line 1 __VERIFIER_assume(__startrek_end_t3[2] < __startrek_end_t0[0]); #line 1 __VERIFIER_assume(__startrek_end_t3[0] < __startrek_start_t0[0]); } } } #line 1 if (__startrek_start_t0[1] <= __startrek_end_t3[2]) { #line 1 if (__startrek_start_t3[2] <= __startrek_end_t0[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[1] <= __startrek_start_t3[2]); #line 1 __VERIFIER_assume(__startrek_end_t3[2] < __startrek_end_t0[1]); #line 1 __VERIFIER_assume(__startrek_end_t3[0] < __startrek_start_t0[1]); } } } #line 1 if (__startrek_start_t0[2] <= __startrek_end_t3[2]) { #line 1 if (__startrek_start_t3[2] <= __startrek_end_t0[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[2] <= __startrek_start_t3[2]); #line 1 __VERIFIER_assume(__startrek_end_t3[2] < __startrek_end_t0[2]); #line 1 __VERIFIER_assume(__startrek_end_t3[0] < __startrek_start_t0[2]); } } } #line 1 if (__startrek_start_t0[3] <= __startrek_end_t3[2]) { #line 1 if (__startrek_start_t3[2] <= __startrek_end_t0[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[3] <= __startrek_start_t3[2]); #line 1 __VERIFIER_assume(__startrek_end_t3[2] < __startrek_end_t0[3]); #line 1 __VERIFIER_assume(__startrek_end_t3[0] < __startrek_start_t0[3]); } } } #line 1 if (__startrek_start_t1[0] <= __startrek_end_t3[2]) { #line 1 if (__startrek_start_t3[2] <= __startrek_end_t1[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[0] <= __startrek_start_t3[2]); #line 1 __VERIFIER_assume(__startrek_end_t3[2] < __startrek_end_t1[0]); #line 1 __VERIFIER_assume(__startrek_end_t3[1] < __startrek_start_t1[0]); } } } #line 1 if (__startrek_start_t1[1] <= __startrek_end_t3[2]) { #line 1 if (__startrek_start_t3[2] <= __startrek_end_t1[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[1] <= __startrek_start_t3[2]); #line 1 __VERIFIER_assume(__startrek_end_t3[2] < __startrek_end_t1[1]); #line 1 __VERIFIER_assume(__startrek_end_t3[1] < __startrek_start_t1[1]); } } } #line 1 if (__startrek_start_t1[2] <= __startrek_end_t3[2]) { #line 1 if (__startrek_start_t3[2] <= __startrek_end_t1[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[2] <= __startrek_start_t3[2]); #line 1 __VERIFIER_assume(__startrek_end_t3[2] < __startrek_end_t1[2]); #line 1 __VERIFIER_assume(__startrek_end_t3[1] < __startrek_start_t1[2]); } } } #line 1 if (__startrek_start_t1[3] <= __startrek_end_t3[2]) { #line 1 if (__startrek_start_t3[2] <= __startrek_end_t1[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[3] <= __startrek_start_t3[2]); #line 1 __VERIFIER_assume(__startrek_end_t3[2] < __startrek_end_t1[3]); #line 1 __VERIFIER_assume(__startrek_end_t3[1] < __startrek_start_t1[3]); } } } #line 1 if (__startrek_start_t1[4] <= __startrek_end_t3[2]) { #line 1 if (__startrek_start_t3[2] <= __startrek_end_t1[4]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[4] <= __startrek_start_t3[2]); #line 1 __VERIFIER_assume(__startrek_end_t3[2] < __startrek_end_t1[4]); #line 1 __VERIFIER_assume(__startrek_end_t3[1] < __startrek_start_t1[4]); } } } #line 1 if (__startrek_start_t1[5] <= __startrek_end_t3[2]) { #line 1 if (__startrek_start_t3[2] <= __startrek_end_t1[5]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[5] <= __startrek_start_t3[2]); #line 1 __VERIFIER_assume(__startrek_end_t3[2] < __startrek_end_t1[5]); #line 1 __VERIFIER_assume(__startrek_end_t3[1] < __startrek_start_t1[5]); } } } #line 1 if (__startrek_start_t1[6] <= __startrek_end_t3[2]) { #line 1 if (__startrek_start_t3[2] <= __startrek_end_t1[6]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[6] <= __startrek_start_t3[2]); #line 1 __VERIFIER_assume(__startrek_end_t3[2] < __startrek_end_t1[6]); #line 1 __VERIFIER_assume(__startrek_end_t3[1] < __startrek_start_t1[6]); } } } #line 1 if (__startrek_start_t1[7] <= __startrek_end_t3[2]) { #line 1 if (__startrek_start_t3[2] <= __startrek_end_t1[7]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[7] <= __startrek_start_t3[2]); #line 1 __VERIFIER_assume(__startrek_end_t3[2] < __startrek_end_t1[7]); #line 1 __VERIFIER_assume(__startrek_end_t3[1] < __startrek_start_t1[7]); } } } #line 1 if (__startrek_start_t2[0] <= __startrek_end_t3[2]) { #line 1 if (__startrek_start_t3[2] <= __startrek_end_t2[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[0] <= __startrek_start_t3[2]); #line 1 __VERIFIER_assume(__startrek_end_t3[2] < __startrek_end_t2[0]); #line 1 __VERIFIER_assume(__startrek_end_t3[1] < __startrek_start_t2[0]); } } } #line 1 if (__startrek_start_t2[1] <= __startrek_end_t3[2]) { #line 1 if (__startrek_start_t3[2] <= __startrek_end_t2[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[1] <= __startrek_start_t3[2]); #line 1 __VERIFIER_assume(__startrek_end_t3[2] < __startrek_end_t2[1]); #line 1 __VERIFIER_assume(__startrek_end_t3[1] < __startrek_start_t2[1]); } } } #line 1 if (__startrek_start_t2[2] <= __startrek_end_t3[2]) { #line 1 if (__startrek_start_t3[2] <= __startrek_end_t2[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[2] <= __startrek_start_t3[2]); #line 1 __VERIFIER_assume(__startrek_end_t3[2] < __startrek_end_t2[2]); #line 1 __VERIFIER_assume(__startrek_end_t3[1] < __startrek_start_t2[2]); } } } #line 1 if (__startrek_start_t2[3] <= __startrek_end_t3[2]) { #line 1 if (__startrek_start_t3[2] <= __startrek_end_t2[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[3] <= __startrek_start_t3[2]); #line 1 __VERIFIER_assume(__startrek_end_t3[2] < __startrek_end_t2[3]); #line 1 __VERIFIER_assume(__startrek_end_t3[1] < __startrek_start_t2[3]); } } } #line 1 if (__startrek_start_t2[4] <= __startrek_end_t3[2]) { #line 1 if (__startrek_start_t3[2] <= __startrek_end_t2[4]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[4] <= __startrek_start_t3[2]); #line 1 __VERIFIER_assume(__startrek_end_t3[2] < __startrek_end_t2[4]); #line 1 __VERIFIER_assume(__startrek_end_t3[1] < __startrek_start_t2[4]); } } } #line 1 if (__startrek_start_t2[5] <= __startrek_end_t3[2]) { #line 1 if (__startrek_start_t3[2] <= __startrek_end_t2[5]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[5] <= __startrek_start_t3[2]); #line 1 __VERIFIER_assume(__startrek_end_t3[2] < __startrek_end_t2[5]); #line 1 __VERIFIER_assume(__startrek_end_t3[1] < __startrek_start_t2[5]); } } } #line 1 if (__startrek_start_t2[6] <= __startrek_end_t3[2]) { #line 1 if (__startrek_start_t3[2] <= __startrek_end_t2[6]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[6] <= __startrek_start_t3[2]); #line 1 __VERIFIER_assume(__startrek_end_t3[2] < __startrek_end_t2[6]); #line 1 __VERIFIER_assume(__startrek_end_t3[1] < __startrek_start_t2[6]); } } } #line 1 if (__startrek_start_t2[7] <= __startrek_end_t3[2]) { #line 1 if (__startrek_start_t3[2] <= __startrek_end_t2[7]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[7] <= __startrek_start_t3[2]); #line 1 __VERIFIER_assume(__startrek_end_t3[2] < __startrek_end_t2[7]); #line 1 __VERIFIER_assume(__startrek_end_t3[1] < __startrek_start_t2[7]); } } } #line 1 if (__startrek_start_t0[0] <= __startrek_end_t3[3]) { #line 1 if (__startrek_start_t3[3] <= __startrek_end_t0[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[0] <= __startrek_start_t3[3]); #line 1 __VERIFIER_assume(__startrek_end_t3[3] < __startrek_end_t0[0]); #line 1 __VERIFIER_assume(__startrek_end_t3[1] < __startrek_start_t0[0]); } } } #line 1 if (__startrek_start_t0[1] <= __startrek_end_t3[3]) { #line 1 if (__startrek_start_t3[3] <= __startrek_end_t0[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[1] <= __startrek_start_t3[3]); #line 1 __VERIFIER_assume(__startrek_end_t3[3] < __startrek_end_t0[1]); #line 1 __VERIFIER_assume(__startrek_end_t3[1] < __startrek_start_t0[1]); } } } #line 1 if (__startrek_start_t0[2] <= __startrek_end_t3[3]) { #line 1 if (__startrek_start_t3[3] <= __startrek_end_t0[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[2] <= __startrek_start_t3[3]); #line 1 __VERIFIER_assume(__startrek_end_t3[3] < __startrek_end_t0[2]); #line 1 __VERIFIER_assume(__startrek_end_t3[1] < __startrek_start_t0[2]); } } } #line 1 if (__startrek_start_t0[3] <= __startrek_end_t3[3]) { #line 1 if (__startrek_start_t3[3] <= __startrek_end_t0[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[3] <= __startrek_start_t3[3]); #line 1 __VERIFIER_assume(__startrek_end_t3[3] < __startrek_end_t0[3]); #line 1 __VERIFIER_assume(__startrek_end_t3[1] < __startrek_start_t0[3]); } } } #line 1 if (__startrek_start_t1[0] <= __startrek_end_t3[3]) { #line 1 if (__startrek_start_t3[3] <= __startrek_end_t1[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[0] <= __startrek_start_t3[3]); #line 1 __VERIFIER_assume(__startrek_end_t3[3] < __startrek_end_t1[0]); #line 1 __VERIFIER_assume(__startrek_end_t3[2] < __startrek_start_t1[0]); } } } #line 1 if (__startrek_start_t1[1] <= __startrek_end_t3[3]) { #line 1 if (__startrek_start_t3[3] <= __startrek_end_t1[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[1] <= __startrek_start_t3[3]); #line 1 __VERIFIER_assume(__startrek_end_t3[3] < __startrek_end_t1[1]); #line 1 __VERIFIER_assume(__startrek_end_t3[2] < __startrek_start_t1[1]); } } } #line 1 if (__startrek_start_t1[2] <= __startrek_end_t3[3]) { #line 1 if (__startrek_start_t3[3] <= __startrek_end_t1[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[2] <= __startrek_start_t3[3]); #line 1 __VERIFIER_assume(__startrek_end_t3[3] < __startrek_end_t1[2]); #line 1 __VERIFIER_assume(__startrek_end_t3[2] < __startrek_start_t1[2]); } } } #line 1 if (__startrek_start_t1[3] <= __startrek_end_t3[3]) { #line 1 if (__startrek_start_t3[3] <= __startrek_end_t1[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[3] <= __startrek_start_t3[3]); #line 1 __VERIFIER_assume(__startrek_end_t3[3] < __startrek_end_t1[3]); #line 1 __VERIFIER_assume(__startrek_end_t3[2] < __startrek_start_t1[3]); } } } #line 1 if (__startrek_start_t1[4] <= __startrek_end_t3[3]) { #line 1 if (__startrek_start_t3[3] <= __startrek_end_t1[4]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[4] <= __startrek_start_t3[3]); #line 1 __VERIFIER_assume(__startrek_end_t3[3] < __startrek_end_t1[4]); #line 1 __VERIFIER_assume(__startrek_end_t3[2] < __startrek_start_t1[4]); } } } #line 1 if (__startrek_start_t1[5] <= __startrek_end_t3[3]) { #line 1 if (__startrek_start_t3[3] <= __startrek_end_t1[5]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[5] <= __startrek_start_t3[3]); #line 1 __VERIFIER_assume(__startrek_end_t3[3] < __startrek_end_t1[5]); #line 1 __VERIFIER_assume(__startrek_end_t3[2] < __startrek_start_t1[5]); } } } #line 1 if (__startrek_start_t1[6] <= __startrek_end_t3[3]) { #line 1 if (__startrek_start_t3[3] <= __startrek_end_t1[6]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[6] <= __startrek_start_t3[3]); #line 1 __VERIFIER_assume(__startrek_end_t3[3] < __startrek_end_t1[6]); #line 1 __VERIFIER_assume(__startrek_end_t3[2] < __startrek_start_t1[6]); } } } #line 1 if (__startrek_start_t1[7] <= __startrek_end_t3[3]) { #line 1 if (__startrek_start_t3[3] <= __startrek_end_t1[7]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[7] <= __startrek_start_t3[3]); #line 1 __VERIFIER_assume(__startrek_end_t3[3] < __startrek_end_t1[7]); #line 1 __VERIFIER_assume(__startrek_end_t3[2] < __startrek_start_t1[7]); } } } #line 1 if (__startrek_start_t2[0] <= __startrek_end_t3[3]) { #line 1 if (__startrek_start_t3[3] <= __startrek_end_t2[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[0] <= __startrek_start_t3[3]); #line 1 __VERIFIER_assume(__startrek_end_t3[3] < __startrek_end_t2[0]); #line 1 __VERIFIER_assume(__startrek_end_t3[2] < __startrek_start_t2[0]); } } } #line 1 if (__startrek_start_t2[1] <= __startrek_end_t3[3]) { #line 1 if (__startrek_start_t3[3] <= __startrek_end_t2[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[1] <= __startrek_start_t3[3]); #line 1 __VERIFIER_assume(__startrek_end_t3[3] < __startrek_end_t2[1]); #line 1 __VERIFIER_assume(__startrek_end_t3[2] < __startrek_start_t2[1]); } } } #line 1 if (__startrek_start_t2[2] <= __startrek_end_t3[3]) { #line 1 if (__startrek_start_t3[3] <= __startrek_end_t2[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[2] <= __startrek_start_t3[3]); #line 1 __VERIFIER_assume(__startrek_end_t3[3] < __startrek_end_t2[2]); #line 1 __VERIFIER_assume(__startrek_end_t3[2] < __startrek_start_t2[2]); } } } #line 1 if (__startrek_start_t2[3] <= __startrek_end_t3[3]) { #line 1 if (__startrek_start_t3[3] <= __startrek_end_t2[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[3] <= __startrek_start_t3[3]); #line 1 __VERIFIER_assume(__startrek_end_t3[3] < __startrek_end_t2[3]); #line 1 __VERIFIER_assume(__startrek_end_t3[2] < __startrek_start_t2[3]); } } } #line 1 if (__startrek_start_t2[4] <= __startrek_end_t3[3]) { #line 1 if (__startrek_start_t3[3] <= __startrek_end_t2[4]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[4] <= __startrek_start_t3[3]); #line 1 __VERIFIER_assume(__startrek_end_t3[3] < __startrek_end_t2[4]); #line 1 __VERIFIER_assume(__startrek_end_t3[2] < __startrek_start_t2[4]); } } } #line 1 if (__startrek_start_t2[5] <= __startrek_end_t3[3]) { #line 1 if (__startrek_start_t3[3] <= __startrek_end_t2[5]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[5] <= __startrek_start_t3[3]); #line 1 __VERIFIER_assume(__startrek_end_t3[3] < __startrek_end_t2[5]); #line 1 __VERIFIER_assume(__startrek_end_t3[2] < __startrek_start_t2[5]); } } } #line 1 if (__startrek_start_t2[6] <= __startrek_end_t3[3]) { #line 1 if (__startrek_start_t3[3] <= __startrek_end_t2[6]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[6] <= __startrek_start_t3[3]); #line 1 __VERIFIER_assume(__startrek_end_t3[3] < __startrek_end_t2[6]); #line 1 __VERIFIER_assume(__startrek_end_t3[2] < __startrek_start_t2[6]); } } } #line 1 if (__startrek_start_t2[7] <= __startrek_end_t3[3]) { #line 1 if (__startrek_start_t3[3] <= __startrek_end_t2[7]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[7] <= __startrek_start_t3[3]); #line 1 __VERIFIER_assume(__startrek_end_t3[3] < __startrek_end_t2[7]); #line 1 __VERIFIER_assume(__startrek_end_t3[2] < __startrek_start_t2[7]); } } } #line 1 if (__startrek_start_t0[0] <= __startrek_end_t3[4]) { #line 1 if (__startrek_start_t3[4] <= __startrek_end_t0[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[0] <= __startrek_start_t3[4]); #line 1 __VERIFIER_assume(__startrek_end_t3[4] < __startrek_end_t0[0]); #line 1 __VERIFIER_assume(__startrek_end_t3[2] < __startrek_start_t0[0]); } } } #line 1 if (__startrek_start_t0[1] <= __startrek_end_t3[4]) { #line 1 if (__startrek_start_t3[4] <= __startrek_end_t0[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[1] <= __startrek_start_t3[4]); #line 1 __VERIFIER_assume(__startrek_end_t3[4] < __startrek_end_t0[1]); #line 1 __VERIFIER_assume(__startrek_end_t3[2] < __startrek_start_t0[1]); } } } #line 1 if (__startrek_start_t0[2] <= __startrek_end_t3[4]) { #line 1 if (__startrek_start_t3[4] <= __startrek_end_t0[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[2] <= __startrek_start_t3[4]); #line 1 __VERIFIER_assume(__startrek_end_t3[4] < __startrek_end_t0[2]); #line 1 __VERIFIER_assume(__startrek_end_t3[2] < __startrek_start_t0[2]); } } } #line 1 if (__startrek_start_t0[3] <= __startrek_end_t3[4]) { #line 1 if (__startrek_start_t3[4] <= __startrek_end_t0[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[3] <= __startrek_start_t3[4]); #line 1 __VERIFIER_assume(__startrek_end_t3[4] < __startrek_end_t0[3]); #line 1 __VERIFIER_assume(__startrek_end_t3[2] < __startrek_start_t0[3]); } } } #line 1 if (__startrek_start_t1[0] <= __startrek_end_t3[4]) { #line 1 if (__startrek_start_t3[4] <= __startrek_end_t1[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[0] <= __startrek_start_t3[4]); #line 1 __VERIFIER_assume(__startrek_end_t3[4] < __startrek_end_t1[0]); #line 1 __VERIFIER_assume(__startrek_end_t3[3] < __startrek_start_t1[0]); } } } #line 1 if (__startrek_start_t1[1] <= __startrek_end_t3[4]) { #line 1 if (__startrek_start_t3[4] <= __startrek_end_t1[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[1] <= __startrek_start_t3[4]); #line 1 __VERIFIER_assume(__startrek_end_t3[4] < __startrek_end_t1[1]); #line 1 __VERIFIER_assume(__startrek_end_t3[3] < __startrek_start_t1[1]); } } } #line 1 if (__startrek_start_t1[2] <= __startrek_end_t3[4]) { #line 1 if (__startrek_start_t3[4] <= __startrek_end_t1[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[2] <= __startrek_start_t3[4]); #line 1 __VERIFIER_assume(__startrek_end_t3[4] < __startrek_end_t1[2]); #line 1 __VERIFIER_assume(__startrek_end_t3[3] < __startrek_start_t1[2]); } } } #line 1 if (__startrek_start_t1[3] <= __startrek_end_t3[4]) { #line 1 if (__startrek_start_t3[4] <= __startrek_end_t1[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[3] <= __startrek_start_t3[4]); #line 1 __VERIFIER_assume(__startrek_end_t3[4] < __startrek_end_t1[3]); #line 1 __VERIFIER_assume(__startrek_end_t3[3] < __startrek_start_t1[3]); } } } #line 1 if (__startrek_start_t1[4] <= __startrek_end_t3[4]) { #line 1 if (__startrek_start_t3[4] <= __startrek_end_t1[4]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[4] <= __startrek_start_t3[4]); #line 1 __VERIFIER_assume(__startrek_end_t3[4] < __startrek_end_t1[4]); #line 1 __VERIFIER_assume(__startrek_end_t3[3] < __startrek_start_t1[4]); } } } #line 1 if (__startrek_start_t1[5] <= __startrek_end_t3[4]) { #line 1 if (__startrek_start_t3[4] <= __startrek_end_t1[5]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[5] <= __startrek_start_t3[4]); #line 1 __VERIFIER_assume(__startrek_end_t3[4] < __startrek_end_t1[5]); #line 1 __VERIFIER_assume(__startrek_end_t3[3] < __startrek_start_t1[5]); } } } #line 1 if (__startrek_start_t1[6] <= __startrek_end_t3[4]) { #line 1 if (__startrek_start_t3[4] <= __startrek_end_t1[6]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[6] <= __startrek_start_t3[4]); #line 1 __VERIFIER_assume(__startrek_end_t3[4] < __startrek_end_t1[6]); #line 1 __VERIFIER_assume(__startrek_end_t3[3] < __startrek_start_t1[6]); } } } #line 1 if (__startrek_start_t1[7] <= __startrek_end_t3[4]) { #line 1 if (__startrek_start_t3[4] <= __startrek_end_t1[7]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[7] <= __startrek_start_t3[4]); #line 1 __VERIFIER_assume(__startrek_end_t3[4] < __startrek_end_t1[7]); #line 1 __VERIFIER_assume(__startrek_end_t3[3] < __startrek_start_t1[7]); } } } #line 1 if (__startrek_start_t2[0] <= __startrek_end_t3[4]) { #line 1 if (__startrek_start_t3[4] <= __startrek_end_t2[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[0] <= __startrek_start_t3[4]); #line 1 __VERIFIER_assume(__startrek_end_t3[4] < __startrek_end_t2[0]); #line 1 __VERIFIER_assume(__startrek_end_t3[3] < __startrek_start_t2[0]); } } } #line 1 if (__startrek_start_t2[1] <= __startrek_end_t3[4]) { #line 1 if (__startrek_start_t3[4] <= __startrek_end_t2[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[1] <= __startrek_start_t3[4]); #line 1 __VERIFIER_assume(__startrek_end_t3[4] < __startrek_end_t2[1]); #line 1 __VERIFIER_assume(__startrek_end_t3[3] < __startrek_start_t2[1]); } } } #line 1 if (__startrek_start_t2[2] <= __startrek_end_t3[4]) { #line 1 if (__startrek_start_t3[4] <= __startrek_end_t2[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[2] <= __startrek_start_t3[4]); #line 1 __VERIFIER_assume(__startrek_end_t3[4] < __startrek_end_t2[2]); #line 1 __VERIFIER_assume(__startrek_end_t3[3] < __startrek_start_t2[2]); } } } #line 1 if (__startrek_start_t2[3] <= __startrek_end_t3[4]) { #line 1 if (__startrek_start_t3[4] <= __startrek_end_t2[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[3] <= __startrek_start_t3[4]); #line 1 __VERIFIER_assume(__startrek_end_t3[4] < __startrek_end_t2[3]); #line 1 __VERIFIER_assume(__startrek_end_t3[3] < __startrek_start_t2[3]); } } } #line 1 if (__startrek_start_t2[4] <= __startrek_end_t3[4]) { #line 1 if (__startrek_start_t3[4] <= __startrek_end_t2[4]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[4] <= __startrek_start_t3[4]); #line 1 __VERIFIER_assume(__startrek_end_t3[4] < __startrek_end_t2[4]); #line 1 __VERIFIER_assume(__startrek_end_t3[3] < __startrek_start_t2[4]); } } } #line 1 if (__startrek_start_t2[5] <= __startrek_end_t3[4]) { #line 1 if (__startrek_start_t3[4] <= __startrek_end_t2[5]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[5] <= __startrek_start_t3[4]); #line 1 __VERIFIER_assume(__startrek_end_t3[4] < __startrek_end_t2[5]); #line 1 __VERIFIER_assume(__startrek_end_t3[3] < __startrek_start_t2[5]); } } } #line 1 if (__startrek_start_t2[6] <= __startrek_end_t3[4]) { #line 1 if (__startrek_start_t3[4] <= __startrek_end_t2[6]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[6] <= __startrek_start_t3[4]); #line 1 __VERIFIER_assume(__startrek_end_t3[4] < __startrek_end_t2[6]); #line 1 __VERIFIER_assume(__startrek_end_t3[3] < __startrek_start_t2[6]); } } } #line 1 if (__startrek_start_t2[7] <= __startrek_end_t3[4]) { #line 1 if (__startrek_start_t3[4] <= __startrek_end_t2[7]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[7] <= __startrek_start_t3[4]); #line 1 __VERIFIER_assume(__startrek_end_t3[4] < __startrek_end_t2[7]); #line 1 __VERIFIER_assume(__startrek_end_t3[3] < __startrek_start_t2[7]); } } } #line 1 if (__startrek_start_t0[0] <= __startrek_end_t3[5]) { #line 1 if (__startrek_start_t3[5] <= __startrek_end_t0[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[0] <= __startrek_start_t3[5]); #line 1 __VERIFIER_assume(__startrek_end_t3[5] < __startrek_end_t0[0]); #line 1 __VERIFIER_assume(__startrek_end_t3[3] < __startrek_start_t0[0]); } } } #line 1 if (__startrek_start_t0[1] <= __startrek_end_t3[5]) { #line 1 if (__startrek_start_t3[5] <= __startrek_end_t0[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[1] <= __startrek_start_t3[5]); #line 1 __VERIFIER_assume(__startrek_end_t3[5] < __startrek_end_t0[1]); #line 1 __VERIFIER_assume(__startrek_end_t3[3] < __startrek_start_t0[1]); } } } #line 1 if (__startrek_start_t0[2] <= __startrek_end_t3[5]) { #line 1 if (__startrek_start_t3[5] <= __startrek_end_t0[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[2] <= __startrek_start_t3[5]); #line 1 __VERIFIER_assume(__startrek_end_t3[5] < __startrek_end_t0[2]); #line 1 __VERIFIER_assume(__startrek_end_t3[3] < __startrek_start_t0[2]); } } } #line 1 if (__startrek_start_t0[3] <= __startrek_end_t3[5]) { #line 1 if (__startrek_start_t3[5] <= __startrek_end_t0[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[3] <= __startrek_start_t3[5]); #line 1 __VERIFIER_assume(__startrek_end_t3[5] < __startrek_end_t0[3]); #line 1 __VERIFIER_assume(__startrek_end_t3[3] < __startrek_start_t0[3]); } } } #line 1 if (__startrek_start_t1[0] <= __startrek_end_t3[5]) { #line 1 if (__startrek_start_t3[5] <= __startrek_end_t1[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[0] <= __startrek_start_t3[5]); #line 1 __VERIFIER_assume(__startrek_end_t3[5] < __startrek_end_t1[0]); #line 1 __VERIFIER_assume(__startrek_end_t3[4] < __startrek_start_t1[0]); } } } #line 1 if (__startrek_start_t1[1] <= __startrek_end_t3[5]) { #line 1 if (__startrek_start_t3[5] <= __startrek_end_t1[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[1] <= __startrek_start_t3[5]); #line 1 __VERIFIER_assume(__startrek_end_t3[5] < __startrek_end_t1[1]); #line 1 __VERIFIER_assume(__startrek_end_t3[4] < __startrek_start_t1[1]); } } } #line 1 if (__startrek_start_t1[2] <= __startrek_end_t3[5]) { #line 1 if (__startrek_start_t3[5] <= __startrek_end_t1[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[2] <= __startrek_start_t3[5]); #line 1 __VERIFIER_assume(__startrek_end_t3[5] < __startrek_end_t1[2]); #line 1 __VERIFIER_assume(__startrek_end_t3[4] < __startrek_start_t1[2]); } } } #line 1 if (__startrek_start_t1[3] <= __startrek_end_t3[5]) { #line 1 if (__startrek_start_t3[5] <= __startrek_end_t1[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[3] <= __startrek_start_t3[5]); #line 1 __VERIFIER_assume(__startrek_end_t3[5] < __startrek_end_t1[3]); #line 1 __VERIFIER_assume(__startrek_end_t3[4] < __startrek_start_t1[3]); } } } #line 1 if (__startrek_start_t1[4] <= __startrek_end_t3[5]) { #line 1 if (__startrek_start_t3[5] <= __startrek_end_t1[4]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[4] <= __startrek_start_t3[5]); #line 1 __VERIFIER_assume(__startrek_end_t3[5] < __startrek_end_t1[4]); #line 1 __VERIFIER_assume(__startrek_end_t3[4] < __startrek_start_t1[4]); } } } #line 1 if (__startrek_start_t1[5] <= __startrek_end_t3[5]) { #line 1 if (__startrek_start_t3[5] <= __startrek_end_t1[5]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[5] <= __startrek_start_t3[5]); #line 1 __VERIFIER_assume(__startrek_end_t3[5] < __startrek_end_t1[5]); #line 1 __VERIFIER_assume(__startrek_end_t3[4] < __startrek_start_t1[5]); } } } #line 1 if (__startrek_start_t1[6] <= __startrek_end_t3[5]) { #line 1 if (__startrek_start_t3[5] <= __startrek_end_t1[6]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[6] <= __startrek_start_t3[5]); #line 1 __VERIFIER_assume(__startrek_end_t3[5] < __startrek_end_t1[6]); #line 1 __VERIFIER_assume(__startrek_end_t3[4] < __startrek_start_t1[6]); } } } #line 1 if (__startrek_start_t1[7] <= __startrek_end_t3[5]) { #line 1 if (__startrek_start_t3[5] <= __startrek_end_t1[7]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[7] <= __startrek_start_t3[5]); #line 1 __VERIFIER_assume(__startrek_end_t3[5] < __startrek_end_t1[7]); #line 1 __VERIFIER_assume(__startrek_end_t3[4] < __startrek_start_t1[7]); } } } #line 1 if (__startrek_start_t2[0] <= __startrek_end_t3[5]) { #line 1 if (__startrek_start_t3[5] <= __startrek_end_t2[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[0] <= __startrek_start_t3[5]); #line 1 __VERIFIER_assume(__startrek_end_t3[5] < __startrek_end_t2[0]); #line 1 __VERIFIER_assume(__startrek_end_t3[4] < __startrek_start_t2[0]); } } } #line 1 if (__startrek_start_t2[1] <= __startrek_end_t3[5]) { #line 1 if (__startrek_start_t3[5] <= __startrek_end_t2[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[1] <= __startrek_start_t3[5]); #line 1 __VERIFIER_assume(__startrek_end_t3[5] < __startrek_end_t2[1]); #line 1 __VERIFIER_assume(__startrek_end_t3[4] < __startrek_start_t2[1]); } } } #line 1 if (__startrek_start_t2[2] <= __startrek_end_t3[5]) { #line 1 if (__startrek_start_t3[5] <= __startrek_end_t2[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[2] <= __startrek_start_t3[5]); #line 1 __VERIFIER_assume(__startrek_end_t3[5] < __startrek_end_t2[2]); #line 1 __VERIFIER_assume(__startrek_end_t3[4] < __startrek_start_t2[2]); } } } #line 1 if (__startrek_start_t2[3] <= __startrek_end_t3[5]) { #line 1 if (__startrek_start_t3[5] <= __startrek_end_t2[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[3] <= __startrek_start_t3[5]); #line 1 __VERIFIER_assume(__startrek_end_t3[5] < __startrek_end_t2[3]); #line 1 __VERIFIER_assume(__startrek_end_t3[4] < __startrek_start_t2[3]); } } } #line 1 if (__startrek_start_t2[4] <= __startrek_end_t3[5]) { #line 1 if (__startrek_start_t3[5] <= __startrek_end_t2[4]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[4] <= __startrek_start_t3[5]); #line 1 __VERIFIER_assume(__startrek_end_t3[5] < __startrek_end_t2[4]); #line 1 __VERIFIER_assume(__startrek_end_t3[4] < __startrek_start_t2[4]); } } } #line 1 if (__startrek_start_t2[5] <= __startrek_end_t3[5]) { #line 1 if (__startrek_start_t3[5] <= __startrek_end_t2[5]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[5] <= __startrek_start_t3[5]); #line 1 __VERIFIER_assume(__startrek_end_t3[5] < __startrek_end_t2[5]); #line 1 __VERIFIER_assume(__startrek_end_t3[4] < __startrek_start_t2[5]); } } } #line 1 if (__startrek_start_t2[6] <= __startrek_end_t3[5]) { #line 1 if (__startrek_start_t3[5] <= __startrek_end_t2[6]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[6] <= __startrek_start_t3[5]); #line 1 __VERIFIER_assume(__startrek_end_t3[5] < __startrek_end_t2[6]); #line 1 __VERIFIER_assume(__startrek_end_t3[4] < __startrek_start_t2[6]); } } } #line 1 if (__startrek_start_t2[7] <= __startrek_end_t3[5]) { #line 1 if (__startrek_start_t3[5] <= __startrek_end_t2[7]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[7] <= __startrek_start_t3[5]); #line 1 __VERIFIER_assume(__startrek_end_t3[5] < __startrek_end_t2[7]); #line 1 __VERIFIER_assume(__startrek_end_t3[4] < __startrek_start_t2[7]); } } } #line 1 if (__startrek_start_t0[0] <= __startrek_end_t3[6]) { #line 1 if (__startrek_start_t3[6] <= __startrek_end_t0[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[0] <= __startrek_start_t3[6]); #line 1 __VERIFIER_assume(__startrek_end_t3[6] < __startrek_end_t0[0]); #line 1 __VERIFIER_assume(__startrek_end_t3[4] < __startrek_start_t0[0]); } } } #line 1 if (__startrek_start_t0[1] <= __startrek_end_t3[6]) { #line 1 if (__startrek_start_t3[6] <= __startrek_end_t0[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[1] <= __startrek_start_t3[6]); #line 1 __VERIFIER_assume(__startrek_end_t3[6] < __startrek_end_t0[1]); #line 1 __VERIFIER_assume(__startrek_end_t3[4] < __startrek_start_t0[1]); } } } #line 1 if (__startrek_start_t0[2] <= __startrek_end_t3[6]) { #line 1 if (__startrek_start_t3[6] <= __startrek_end_t0[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[2] <= __startrek_start_t3[6]); #line 1 __VERIFIER_assume(__startrek_end_t3[6] < __startrek_end_t0[2]); #line 1 __VERIFIER_assume(__startrek_end_t3[4] < __startrek_start_t0[2]); } } } #line 1 if (__startrek_start_t0[3] <= __startrek_end_t3[6]) { #line 1 if (__startrek_start_t3[6] <= __startrek_end_t0[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[3] <= __startrek_start_t3[6]); #line 1 __VERIFIER_assume(__startrek_end_t3[6] < __startrek_end_t0[3]); #line 1 __VERIFIER_assume(__startrek_end_t3[4] < __startrek_start_t0[3]); } } } #line 1 if (__startrek_start_t1[0] <= __startrek_end_t3[6]) { #line 1 if (__startrek_start_t3[6] <= __startrek_end_t1[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[0] <= __startrek_start_t3[6]); #line 1 __VERIFIER_assume(__startrek_end_t3[6] < __startrek_end_t1[0]); #line 1 __VERIFIER_assume(__startrek_end_t3[5] < __startrek_start_t1[0]); } } } #line 1 if (__startrek_start_t1[1] <= __startrek_end_t3[6]) { #line 1 if (__startrek_start_t3[6] <= __startrek_end_t1[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[1] <= __startrek_start_t3[6]); #line 1 __VERIFIER_assume(__startrek_end_t3[6] < __startrek_end_t1[1]); #line 1 __VERIFIER_assume(__startrek_end_t3[5] < __startrek_start_t1[1]); } } } #line 1 if (__startrek_start_t1[2] <= __startrek_end_t3[6]) { #line 1 if (__startrek_start_t3[6] <= __startrek_end_t1[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[2] <= __startrek_start_t3[6]); #line 1 __VERIFIER_assume(__startrek_end_t3[6] < __startrek_end_t1[2]); #line 1 __VERIFIER_assume(__startrek_end_t3[5] < __startrek_start_t1[2]); } } } #line 1 if (__startrek_start_t1[3] <= __startrek_end_t3[6]) { #line 1 if (__startrek_start_t3[6] <= __startrek_end_t1[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[3] <= __startrek_start_t3[6]); #line 1 __VERIFIER_assume(__startrek_end_t3[6] < __startrek_end_t1[3]); #line 1 __VERIFIER_assume(__startrek_end_t3[5] < __startrek_start_t1[3]); } } } #line 1 if (__startrek_start_t1[4] <= __startrek_end_t3[6]) { #line 1 if (__startrek_start_t3[6] <= __startrek_end_t1[4]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[4] <= __startrek_start_t3[6]); #line 1 __VERIFIER_assume(__startrek_end_t3[6] < __startrek_end_t1[4]); #line 1 __VERIFIER_assume(__startrek_end_t3[5] < __startrek_start_t1[4]); } } } #line 1 if (__startrek_start_t1[5] <= __startrek_end_t3[6]) { #line 1 if (__startrek_start_t3[6] <= __startrek_end_t1[5]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[5] <= __startrek_start_t3[6]); #line 1 __VERIFIER_assume(__startrek_end_t3[6] < __startrek_end_t1[5]); #line 1 __VERIFIER_assume(__startrek_end_t3[5] < __startrek_start_t1[5]); } } } #line 1 if (__startrek_start_t1[6] <= __startrek_end_t3[6]) { #line 1 if (__startrek_start_t3[6] <= __startrek_end_t1[6]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[6] <= __startrek_start_t3[6]); #line 1 __VERIFIER_assume(__startrek_end_t3[6] < __startrek_end_t1[6]); #line 1 __VERIFIER_assume(__startrek_end_t3[5] < __startrek_start_t1[6]); } } } #line 1 if (__startrek_start_t1[7] <= __startrek_end_t3[6]) { #line 1 if (__startrek_start_t3[6] <= __startrek_end_t1[7]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[7] <= __startrek_start_t3[6]); #line 1 __VERIFIER_assume(__startrek_end_t3[6] < __startrek_end_t1[7]); #line 1 __VERIFIER_assume(__startrek_end_t3[5] < __startrek_start_t1[7]); } } } #line 1 if (__startrek_start_t2[0] <= __startrek_end_t3[6]) { #line 1 if (__startrek_start_t3[6] <= __startrek_end_t2[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[0] <= __startrek_start_t3[6]); #line 1 __VERIFIER_assume(__startrek_end_t3[6] < __startrek_end_t2[0]); #line 1 __VERIFIER_assume(__startrek_end_t3[5] < __startrek_start_t2[0]); } } } #line 1 if (__startrek_start_t2[1] <= __startrek_end_t3[6]) { #line 1 if (__startrek_start_t3[6] <= __startrek_end_t2[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[1] <= __startrek_start_t3[6]); #line 1 __VERIFIER_assume(__startrek_end_t3[6] < __startrek_end_t2[1]); #line 1 __VERIFIER_assume(__startrek_end_t3[5] < __startrek_start_t2[1]); } } } #line 1 if (__startrek_start_t2[2] <= __startrek_end_t3[6]) { #line 1 if (__startrek_start_t3[6] <= __startrek_end_t2[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[2] <= __startrek_start_t3[6]); #line 1 __VERIFIER_assume(__startrek_end_t3[6] < __startrek_end_t2[2]); #line 1 __VERIFIER_assume(__startrek_end_t3[5] < __startrek_start_t2[2]); } } } #line 1 if (__startrek_start_t2[3] <= __startrek_end_t3[6]) { #line 1 if (__startrek_start_t3[6] <= __startrek_end_t2[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[3] <= __startrek_start_t3[6]); #line 1 __VERIFIER_assume(__startrek_end_t3[6] < __startrek_end_t2[3]); #line 1 __VERIFIER_assume(__startrek_end_t3[5] < __startrek_start_t2[3]); } } } #line 1 if (__startrek_start_t2[4] <= __startrek_end_t3[6]) { #line 1 if (__startrek_start_t3[6] <= __startrek_end_t2[4]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[4] <= __startrek_start_t3[6]); #line 1 __VERIFIER_assume(__startrek_end_t3[6] < __startrek_end_t2[4]); #line 1 __VERIFIER_assume(__startrek_end_t3[5] < __startrek_start_t2[4]); } } } #line 1 if (__startrek_start_t2[5] <= __startrek_end_t3[6]) { #line 1 if (__startrek_start_t3[6] <= __startrek_end_t2[5]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[5] <= __startrek_start_t3[6]); #line 1 __VERIFIER_assume(__startrek_end_t3[6] < __startrek_end_t2[5]); #line 1 __VERIFIER_assume(__startrek_end_t3[5] < __startrek_start_t2[5]); } } } #line 1 if (__startrek_start_t2[6] <= __startrek_end_t3[6]) { #line 1 if (__startrek_start_t3[6] <= __startrek_end_t2[6]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[6] <= __startrek_start_t3[6]); #line 1 __VERIFIER_assume(__startrek_end_t3[6] < __startrek_end_t2[6]); #line 1 __VERIFIER_assume(__startrek_end_t3[5] < __startrek_start_t2[6]); } } } #line 1 if (__startrek_start_t2[7] <= __startrek_end_t3[6]) { #line 1 if (__startrek_start_t3[6] <= __startrek_end_t2[7]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[7] <= __startrek_start_t3[6]); #line 1 __VERIFIER_assume(__startrek_end_t3[6] < __startrek_end_t2[7]); #line 1 __VERIFIER_assume(__startrek_end_t3[5] < __startrek_start_t2[7]); } } } #line 1 if (__startrek_start_t0[0] <= __startrek_end_t3[7]) { #line 1 if (__startrek_start_t3[7] <= __startrek_end_t0[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[0] <= __startrek_start_t3[7]); #line 1 __VERIFIER_assume(__startrek_end_t3[7] < __startrek_end_t0[0]); #line 1 __VERIFIER_assume(__startrek_end_t3[5] < __startrek_start_t0[0]); } } } #line 1 if (__startrek_start_t0[1] <= __startrek_end_t3[7]) { #line 1 if (__startrek_start_t3[7] <= __startrek_end_t0[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[1] <= __startrek_start_t3[7]); #line 1 __VERIFIER_assume(__startrek_end_t3[7] < __startrek_end_t0[1]); #line 1 __VERIFIER_assume(__startrek_end_t3[5] < __startrek_start_t0[1]); } } } #line 1 if (__startrek_start_t0[2] <= __startrek_end_t3[7]) { #line 1 if (__startrek_start_t3[7] <= __startrek_end_t0[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[2] <= __startrek_start_t3[7]); #line 1 __VERIFIER_assume(__startrek_end_t3[7] < __startrek_end_t0[2]); #line 1 __VERIFIER_assume(__startrek_end_t3[5] < __startrek_start_t0[2]); } } } #line 1 if (__startrek_start_t0[3] <= __startrek_end_t3[7]) { #line 1 if (__startrek_start_t3[7] <= __startrek_end_t0[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t0[3] <= __startrek_start_t3[7]); #line 1 __VERIFIER_assume(__startrek_end_t3[7] < __startrek_end_t0[3]); #line 1 __VERIFIER_assume(__startrek_end_t3[5] < __startrek_start_t0[3]); } } } #line 1 if (__startrek_start_t1[0] <= __startrek_end_t3[7]) { #line 1 if (__startrek_start_t3[7] <= __startrek_end_t1[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[0] <= __startrek_start_t3[7]); #line 1 __VERIFIER_assume(__startrek_end_t3[7] < __startrek_end_t1[0]); #line 1 __VERIFIER_assume(__startrek_end_t3[6] < __startrek_start_t1[0]); } } } #line 1 if (__startrek_start_t1[1] <= __startrek_end_t3[7]) { #line 1 if (__startrek_start_t3[7] <= __startrek_end_t1[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[1] <= __startrek_start_t3[7]); #line 1 __VERIFIER_assume(__startrek_end_t3[7] < __startrek_end_t1[1]); #line 1 __VERIFIER_assume(__startrek_end_t3[6] < __startrek_start_t1[1]); } } } #line 1 if (__startrek_start_t1[2] <= __startrek_end_t3[7]) { #line 1 if (__startrek_start_t3[7] <= __startrek_end_t1[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[2] <= __startrek_start_t3[7]); #line 1 __VERIFIER_assume(__startrek_end_t3[7] < __startrek_end_t1[2]); #line 1 __VERIFIER_assume(__startrek_end_t3[6] < __startrek_start_t1[2]); } } } #line 1 if (__startrek_start_t1[3] <= __startrek_end_t3[7]) { #line 1 if (__startrek_start_t3[7] <= __startrek_end_t1[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[3] <= __startrek_start_t3[7]); #line 1 __VERIFIER_assume(__startrek_end_t3[7] < __startrek_end_t1[3]); #line 1 __VERIFIER_assume(__startrek_end_t3[6] < __startrek_start_t1[3]); } } } #line 1 if (__startrek_start_t1[4] <= __startrek_end_t3[7]) { #line 1 if (__startrek_start_t3[7] <= __startrek_end_t1[4]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[4] <= __startrek_start_t3[7]); #line 1 __VERIFIER_assume(__startrek_end_t3[7] < __startrek_end_t1[4]); #line 1 __VERIFIER_assume(__startrek_end_t3[6] < __startrek_start_t1[4]); } } } #line 1 if (__startrek_start_t1[5] <= __startrek_end_t3[7]) { #line 1 if (__startrek_start_t3[7] <= __startrek_end_t1[5]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[5] <= __startrek_start_t3[7]); #line 1 __VERIFIER_assume(__startrek_end_t3[7] < __startrek_end_t1[5]); #line 1 __VERIFIER_assume(__startrek_end_t3[6] < __startrek_start_t1[5]); } } } #line 1 if (__startrek_start_t1[6] <= __startrek_end_t3[7]) { #line 1 if (__startrek_start_t3[7] <= __startrek_end_t1[6]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[6] <= __startrek_start_t3[7]); #line 1 __VERIFIER_assume(__startrek_end_t3[7] < __startrek_end_t1[6]); #line 1 __VERIFIER_assume(__startrek_end_t3[6] < __startrek_start_t1[6]); } } } #line 1 if (__startrek_start_t1[7] <= __startrek_end_t3[7]) { #line 1 if (__startrek_start_t3[7] <= __startrek_end_t1[7]) { { #line 1 __VERIFIER_assume(__startrek_start_t1[7] <= __startrek_start_t3[7]); #line 1 __VERIFIER_assume(__startrek_end_t3[7] < __startrek_end_t1[7]); #line 1 __VERIFIER_assume(__startrek_end_t3[6] < __startrek_start_t1[7]); } } } #line 1 if (__startrek_start_t2[0] <= __startrek_end_t3[7]) { #line 1 if (__startrek_start_t3[7] <= __startrek_end_t2[0]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[0] <= __startrek_start_t3[7]); #line 1 __VERIFIER_assume(__startrek_end_t3[7] < __startrek_end_t2[0]); #line 1 __VERIFIER_assume(__startrek_end_t3[6] < __startrek_start_t2[0]); } } } #line 1 if (__startrek_start_t2[1] <= __startrek_end_t3[7]) { #line 1 if (__startrek_start_t3[7] <= __startrek_end_t2[1]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[1] <= __startrek_start_t3[7]); #line 1 __VERIFIER_assume(__startrek_end_t3[7] < __startrek_end_t2[1]); #line 1 __VERIFIER_assume(__startrek_end_t3[6] < __startrek_start_t2[1]); } } } #line 1 if (__startrek_start_t2[2] <= __startrek_end_t3[7]) { #line 1 if (__startrek_start_t3[7] <= __startrek_end_t2[2]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[2] <= __startrek_start_t3[7]); #line 1 __VERIFIER_assume(__startrek_end_t3[7] < __startrek_end_t2[2]); #line 1 __VERIFIER_assume(__startrek_end_t3[6] < __startrek_start_t2[2]); } } } #line 1 if (__startrek_start_t2[3] <= __startrek_end_t3[7]) { #line 1 if (__startrek_start_t3[7] <= __startrek_end_t2[3]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[3] <= __startrek_start_t3[7]); #line 1 __VERIFIER_assume(__startrek_end_t3[7] < __startrek_end_t2[3]); #line 1 __VERIFIER_assume(__startrek_end_t3[6] < __startrek_start_t2[3]); } } } #line 1 if (__startrek_start_t2[4] <= __startrek_end_t3[7]) { #line 1 if (__startrek_start_t3[7] <= __startrek_end_t2[4]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[4] <= __startrek_start_t3[7]); #line 1 __VERIFIER_assume(__startrek_end_t3[7] < __startrek_end_t2[4]); #line 1 __VERIFIER_assume(__startrek_end_t3[6] < __startrek_start_t2[4]); } } } #line 1 if (__startrek_start_t2[5] <= __startrek_end_t3[7]) { #line 1 if (__startrek_start_t3[7] <= __startrek_end_t2[5]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[5] <= __startrek_start_t3[7]); #line 1 __VERIFIER_assume(__startrek_end_t3[7] < __startrek_end_t2[5]); #line 1 __VERIFIER_assume(__startrek_end_t3[6] < __startrek_start_t2[5]); } } } #line 1 if (__startrek_start_t2[6] <= __startrek_end_t3[7]) { #line 1 if (__startrek_start_t3[7] <= __startrek_end_t2[6]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[6] <= __startrek_start_t3[7]); #line 1 __VERIFIER_assume(__startrek_end_t3[7] < __startrek_end_t2[6]); #line 1 __VERIFIER_assume(__startrek_end_t3[6] < __startrek_start_t2[6]); } } } #line 1 if (__startrek_start_t2[7] <= __startrek_end_t3[7]) { #line 1 if (__startrek_start_t3[7] <= __startrek_end_t2[7]) { { #line 1 __VERIFIER_assume(__startrek_start_t2[7] <= __startrek_start_t3[7]); #line 1 __VERIFIER_assume(__startrek_end_t3[7] < __startrek_end_t2[7]); #line 1 __VERIFIER_assume(__startrek_end_t3[6] < __startrek_start_t2[7]); } } } } } #line 1 "<compiler builtins>" __inline void __startrek_init_globals(void) { { #line 1 "<startrek builtins>" _i___startrek_job_count_Writer_[1] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Writer_[1] = _i___startrek_job_count_Writer_[1]; #line 1 _i___startrek_job_count_Writer_[2] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Writer_[2] = _i___startrek_job_count_Writer_[2]; #line 1 _i___startrek_job_count_Writer_[3] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Writer_[3] = _i___startrek_job_count_Writer_[3]; #line 1 _i___startrek_job_count_Writer_[4] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Writer_[4] = _i___startrek_job_count_Writer_[4]; #line 1 _i___startrek_job_count_Writer_[5] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Writer_[5] = _i___startrek_job_count_Writer_[5]; #line 1 _i___startrek_job_count_Writer_[6] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Writer_[6] = _i___startrek_job_count_Writer_[6]; #line 1 _i___startrek_job_count_Writer_[7] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Writer_[7] = _i___startrek_job_count_Writer_[7]; #line 1 _i___startrek_job_count_Writer_[8] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Writer_[8] = _i___startrek_job_count_Writer_[8]; #line 1 _i___startrek_job_count_Writer_[9] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Writer_[9] = _i___startrek_job_count_Writer_[9]; #line 1 _i___startrek_job_count_Writer_[10] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Writer_[10] = _i___startrek_job_count_Writer_[10]; #line 1 _i___startrek_job_count_Writer_[11] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Writer_[11] = _i___startrek_job_count_Writer_[11]; #line 1 _i___startrek_job_count_Writer_[12] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Writer_[12] = _i___startrek_job_count_Writer_[12]; #line 1 _i___startrek_job_count_Writer_[13] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Writer_[13] = _i___startrek_job_count_Writer_[13]; #line 1 _i___startrek_job_count_Writer_[14] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Writer_[14] = _i___startrek_job_count_Writer_[14]; #line 1 _i___startrek_job_count_Writer_[15] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Writer_[15] = _i___startrek_job_count_Writer_[15]; #line 1 _i___startrek_job_count_Writer_[16] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Writer_[16] = _i___startrek_job_count_Writer_[16]; #line 1 _i___startrek_job_count_Writer_[17] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Writer_[17] = _i___startrek_job_count_Writer_[17]; #line 1 _i___startrek_job_count_Writer_[18] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Writer_[18] = _i___startrek_job_count_Writer_[18]; #line 1 _i___startrek_job_count_Writer_[19] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Writer_[19] = _i___startrek_job_count_Writer_[19]; #line 1 _i___startrek_job_count_Writer_[20] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Writer_[20] = _i___startrek_job_count_Writer_[20]; #line 1 _i___startrek_job_count_Writer_[21] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Writer_[21] = _i___startrek_job_count_Writer_[21]; #line 1 _i___startrek_job_count_Writer_[22] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Writer_[22] = _i___startrek_job_count_Writer_[22]; #line 1 _i___startrek_job_count_Writer_[23] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Writer_[23] = _i___startrek_job_count_Writer_[23]; #line 1 _i___startrek_job_count_Writer_[24] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Writer_[24] = _i___startrek_job_count_Writer_[24]; #line 1 _i___startrek_job_count_Writer_[25] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Writer_[25] = _i___startrek_job_count_Writer_[25]; #line 1 _i___startrek_job_count_Writer_[26] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Writer_[26] = _i___startrek_job_count_Writer_[26]; #line 1 _i___startrek_job_count_Writer_[27] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Writer_[27] = _i___startrek_job_count_Writer_[27]; #line 1 _i___startrek_job_count_Reader_[1] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Reader_[1] = _i___startrek_job_count_Reader_[1]; #line 1 _i___startrek_job_count_Reader_[2] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Reader_[2] = _i___startrek_job_count_Reader_[2]; #line 1 _i___startrek_job_count_Reader_[3] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Reader_[3] = _i___startrek_job_count_Reader_[3]; #line 1 _i___startrek_job_count_Reader_[4] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Reader_[4] = _i___startrek_job_count_Reader_[4]; #line 1 _i___startrek_job_count_Reader_[5] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Reader_[5] = _i___startrek_job_count_Reader_[5]; #line 1 _i___startrek_job_count_Reader_[6] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Reader_[6] = _i___startrek_job_count_Reader_[6]; #line 1 _i___startrek_job_count_Reader_[7] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Reader_[7] = _i___startrek_job_count_Reader_[7]; #line 1 _i___startrek_job_count_Reader_[8] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Reader_[8] = _i___startrek_job_count_Reader_[8]; #line 1 _i___startrek_job_count_Reader_[9] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Reader_[9] = _i___startrek_job_count_Reader_[9]; #line 1 _i___startrek_job_count_Reader_[10] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Reader_[10] = _i___startrek_job_count_Reader_[10]; #line 1 _i___startrek_job_count_Reader_[11] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Reader_[11] = _i___startrek_job_count_Reader_[11]; #line 1 _i___startrek_job_count_Reader_[12] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Reader_[12] = _i___startrek_job_count_Reader_[12]; #line 1 _i___startrek_job_count_Reader_[13] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Reader_[13] = _i___startrek_job_count_Reader_[13]; #line 1 _i___startrek_job_count_Reader_[14] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Reader_[14] = _i___startrek_job_count_Reader_[14]; #line 1 _i___startrek_job_count_Reader_[15] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Reader_[15] = _i___startrek_job_count_Reader_[15]; #line 1 _i___startrek_job_count_Reader_[16] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Reader_[16] = _i___startrek_job_count_Reader_[16]; #line 1 _i___startrek_job_count_Reader_[17] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Reader_[17] = _i___startrek_job_count_Reader_[17]; #line 1 _i___startrek_job_count_Reader_[18] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Reader_[18] = _i___startrek_job_count_Reader_[18]; #line 1 _i___startrek_job_count_Reader_[19] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Reader_[19] = _i___startrek_job_count_Reader_[19]; #line 1 _i___startrek_job_count_Reader_[20] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Reader_[20] = _i___startrek_job_count_Reader_[20]; #line 1 _i___startrek_job_count_Reader_[21] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Reader_[21] = _i___startrek_job_count_Reader_[21]; #line 1 _i___startrek_job_count_Reader_[22] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Reader_[22] = _i___startrek_job_count_Reader_[22]; #line 1 _i___startrek_job_count_Reader_[23] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Reader_[23] = _i___startrek_job_count_Reader_[23]; #line 1 _i___startrek_job_count_Reader_[24] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Reader_[24] = _i___startrek_job_count_Reader_[24]; #line 1 _i___startrek_job_count_Reader_[25] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Reader_[25] = _i___startrek_job_count_Reader_[25]; #line 1 _i___startrek_job_count_Reader_[26] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Reader_[26] = _i___startrek_job_count_Reader_[26]; #line 1 _i___startrek_job_count_Reader_[27] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Reader_[27] = _i___startrek_job_count_Reader_[27]; #line 1 _i___startrek_job_count_TapeMover_[1] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_TapeMover_[1] = _i___startrek_job_count_TapeMover_[1]; #line 1 _i___startrek_job_count_TapeMover_[2] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_TapeMover_[2] = _i___startrek_job_count_TapeMover_[2]; #line 1 _i___startrek_job_count_TapeMover_[3] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_TapeMover_[3] = _i___startrek_job_count_TapeMover_[3]; #line 1 _i___startrek_job_count_TapeMover_[4] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_TapeMover_[4] = _i___startrek_job_count_TapeMover_[4]; #line 1 _i___startrek_job_count_TapeMover_[5] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_TapeMover_[5] = _i___startrek_job_count_TapeMover_[5]; #line 1 _i___startrek_job_count_TapeMover_[6] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_TapeMover_[6] = _i___startrek_job_count_TapeMover_[6]; #line 1 _i___startrek_job_count_TapeMover_[7] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_TapeMover_[7] = _i___startrek_job_count_TapeMover_[7]; #line 1 _i___startrek_job_count_TapeMover_[8] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_TapeMover_[8] = _i___startrek_job_count_TapeMover_[8]; #line 1 _i___startrek_job_count_TapeMover_[9] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_TapeMover_[9] = _i___startrek_job_count_TapeMover_[9]; #line 1 _i___startrek_job_count_TapeMover_[10] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_TapeMover_[10] = _i___startrek_job_count_TapeMover_[10]; #line 1 _i___startrek_job_count_TapeMover_[11] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_TapeMover_[11] = _i___startrek_job_count_TapeMover_[11]; #line 1 _i___startrek_job_count_TapeMover_[12] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_TapeMover_[12] = _i___startrek_job_count_TapeMover_[12]; #line 1 _i___startrek_job_count_TapeMover_[13] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_TapeMover_[13] = _i___startrek_job_count_TapeMover_[13]; #line 1 _i___startrek_job_count_TapeMover_[14] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_TapeMover_[14] = _i___startrek_job_count_TapeMover_[14]; #line 1 _i___startrek_job_count_TapeMover_[15] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_TapeMover_[15] = _i___startrek_job_count_TapeMover_[15]; #line 1 _i___startrek_job_count_TapeMover_[16] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_TapeMover_[16] = _i___startrek_job_count_TapeMover_[16]; #line 1 _i___startrek_job_count_TapeMover_[17] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_TapeMover_[17] = _i___startrek_job_count_TapeMover_[17]; #line 1 _i___startrek_job_count_TapeMover_[18] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_TapeMover_[18] = _i___startrek_job_count_TapeMover_[18]; #line 1 _i___startrek_job_count_TapeMover_[19] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_TapeMover_[19] = _i___startrek_job_count_TapeMover_[19]; #line 1 _i___startrek_job_count_TapeMover_[20] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_TapeMover_[20] = _i___startrek_job_count_TapeMover_[20]; #line 1 _i___startrek_job_count_TapeMover_[21] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_TapeMover_[21] = _i___startrek_job_count_TapeMover_[21]; #line 1 _i___startrek_job_count_TapeMover_[22] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_TapeMover_[22] = _i___startrek_job_count_TapeMover_[22]; #line 1 _i___startrek_job_count_TapeMover_[23] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_TapeMover_[23] = _i___startrek_job_count_TapeMover_[23]; #line 1 _i___startrek_job_count_TapeMover_[24] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_TapeMover_[24] = _i___startrek_job_count_TapeMover_[24]; #line 1 _i___startrek_job_count_TapeMover_[25] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_TapeMover_[25] = _i___startrek_job_count_TapeMover_[25]; #line 1 _i___startrek_job_count_TapeMover_[26] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_TapeMover_[26] = _i___startrek_job_count_TapeMover_[26]; #line 1 _i___startrek_job_count_TapeMover_[27] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_TapeMover_[27] = _i___startrek_job_count_TapeMover_[27]; #line 1 _i___startrek_job_count_Controller_[1] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Controller_[1] = _i___startrek_job_count_Controller_[1]; #line 1 _i___startrek_job_count_Controller_[2] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Controller_[2] = _i___startrek_job_count_Controller_[2]; #line 1 _i___startrek_job_count_Controller_[3] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Controller_[3] = _i___startrek_job_count_Controller_[3]; #line 1 _i___startrek_job_count_Controller_[4] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Controller_[4] = _i___startrek_job_count_Controller_[4]; #line 1 _i___startrek_job_count_Controller_[5] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Controller_[5] = _i___startrek_job_count_Controller_[5]; #line 1 _i___startrek_job_count_Controller_[6] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Controller_[6] = _i___startrek_job_count_Controller_[6]; #line 1 _i___startrek_job_count_Controller_[7] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Controller_[7] = _i___startrek_job_count_Controller_[7]; #line 1 _i___startrek_job_count_Controller_[8] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Controller_[8] = _i___startrek_job_count_Controller_[8]; #line 1 _i___startrek_job_count_Controller_[9] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Controller_[9] = _i___startrek_job_count_Controller_[9]; #line 1 _i___startrek_job_count_Controller_[10] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Controller_[10] = _i___startrek_job_count_Controller_[10]; #line 1 _i___startrek_job_count_Controller_[11] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Controller_[11] = _i___startrek_job_count_Controller_[11]; #line 1 _i___startrek_job_count_Controller_[12] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Controller_[12] = _i___startrek_job_count_Controller_[12]; #line 1 _i___startrek_job_count_Controller_[13] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Controller_[13] = _i___startrek_job_count_Controller_[13]; #line 1 _i___startrek_job_count_Controller_[14] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Controller_[14] = _i___startrek_job_count_Controller_[14]; #line 1 _i___startrek_job_count_Controller_[15] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Controller_[15] = _i___startrek_job_count_Controller_[15]; #line 1 _i___startrek_job_count_Controller_[16] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Controller_[16] = _i___startrek_job_count_Controller_[16]; #line 1 _i___startrek_job_count_Controller_[17] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Controller_[17] = _i___startrek_job_count_Controller_[17]; #line 1 _i___startrek_job_count_Controller_[18] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Controller_[18] = _i___startrek_job_count_Controller_[18]; #line 1 _i___startrek_job_count_Controller_[19] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Controller_[19] = _i___startrek_job_count_Controller_[19]; #line 1 _i___startrek_job_count_Controller_[20] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Controller_[20] = _i___startrek_job_count_Controller_[20]; #line 1 _i___startrek_job_count_Controller_[21] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Controller_[21] = _i___startrek_job_count_Controller_[21]; #line 1 _i___startrek_job_count_Controller_[22] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Controller_[22] = _i___startrek_job_count_Controller_[22]; #line 1 _i___startrek_job_count_Controller_[23] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Controller_[23] = _i___startrek_job_count_Controller_[23]; #line 1 _i___startrek_job_count_Controller_[24] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Controller_[24] = _i___startrek_job_count_Controller_[24]; #line 1 _i___startrek_job_count_Controller_[25] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Controller_[25] = _i___startrek_job_count_Controller_[25]; #line 1 _i___startrek_job_count_Controller_[26] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Controller_[26] = _i___startrek_job_count_Controller_[26]; #line 1 _i___startrek_job_count_Controller_[27] = __VERIFIER_nondet_char(); #line 1 ___startrek_job_count_Controller_[27] = _i___startrek_job_count_Controller_[27]; #line 1 _i_T_state_[1] = __VERIFIER_nondet_uchar(); #line 1 _T_state_[1] = _i_T_state_[1]; #line 1 _i_T_state_[2] = __VERIFIER_nondet_uchar(); #line 1 _T_state_[2] = _i_T_state_[2]; #line 1 _i_T_state_[3] = __VERIFIER_nondet_uchar(); #line 1 _T_state_[3] = _i_T_state_[3]; #line 1 _i_T_state_[4] = __VERIFIER_nondet_uchar(); #line 1 _T_state_[4] = _i_T_state_[4]; #line 1 _i_T_state_[5] = __VERIFIER_nondet_uchar(); #line 1 _T_state_[5] = _i_T_state_[5]; #line 1 _i_T_state_[6] = __VERIFIER_nondet_uchar(); #line 1 _T_state_[6] = _i_T_state_[6]; #line 1 _i_T_state_[7] = __VERIFIER_nondet_uchar(); #line 1 _T_state_[7] = _i_T_state_[7]; #line 1 _i_T_state_[8] = __VERIFIER_nondet_uchar(); #line 1 _T_state_[8] = _i_T_state_[8]; #line 1 _i_T_state_[9] = __VERIFIER_nondet_uchar(); #line 1 _T_state_[9] = _i_T_state_[9]; #line 1 _i_T_state_[10] = __VERIFIER_nondet_uchar(); #line 1 _T_state_[10] = _i_T_state_[10]; #line 1 _i_T_state_[11] = __VERIFIER_nondet_uchar(); #line 1 _T_state_[11] = _i_T_state_[11]; #line 1 _i_T_state_[12] = __VERIFIER_nondet_uchar(); #line 1 _T_state_[12] = _i_T_state_[12]; #line 1 _i_T_state_[13] = __VERIFIER_nondet_uchar(); #line 1 _T_state_[13] = _i_T_state_[13]; #line 1 _i_T_state_[14] = __VERIFIER_nondet_uchar(); #line 1 _T_state_[14] = _i_T_state_[14]; #line 1 _i_T_state_[15] = __VERIFIER_nondet_uchar(); #line 1 _T_state_[15] = _i_T_state_[15]; #line 1 _i_T_state_[16] = __VERIFIER_nondet_uchar(); #line 1 _T_state_[16] = _i_T_state_[16]; #line 1 _i_T_state_[17] = __VERIFIER_nondet_uchar(); #line 1 _T_state_[17] = _i_T_state_[17]; #line 1 _i_T_state_[18] = __VERIFIER_nondet_uchar(); #line 1 _T_state_[18] = _i_T_state_[18]; #line 1 _i_T_state_[19] = __VERIFIER_nondet_uchar(); #line 1 _T_state_[19] = _i_T_state_[19]; #line 1 _i_T_state_[20] = __VERIFIER_nondet_uchar(); #line 1 _T_state_[20] = _i_T_state_[20]; #line 1 _i_T_state_[21] = __VERIFIER_nondet_uchar(); #line 1 _T_state_[21] = _i_T_state_[21]; #line 1 _i_T_state_[22] = __VERIFIER_nondet_uchar(); #line 1 _T_state_[22] = _i_T_state_[22]; #line 1 _i_T_state_[23] = __VERIFIER_nondet_uchar(); #line 1 _T_state_[23] = _i_T_state_[23]; #line 1 _i_T_state_[24] = __VERIFIER_nondet_uchar(); #line 1 _T_state_[24] = _i_T_state_[24]; #line 1 _i_T_state_[25] = __VERIFIER_nondet_uchar(); #line 1 _T_state_[25] = _i_T_state_[25]; #line 1 _i_T_state_[26] = __VERIFIER_nondet_uchar(); #line 1 _T_state_[26] = _i_T_state_[26]; #line 1 _i_T_state_[27] = __VERIFIER_nondet_uchar(); #line 1 _T_state_[27] = _i_T_state_[27]; #line 1 _i_W_state_[1] = __VERIFIER_nondet_uchar(); #line 1 _W_state_[1] = _i_W_state_[1]; #line 1 _i_W_state_[2] = __VERIFIER_nondet_uchar(); #line 1 _W_state_[2] = _i_W_state_[2]; #line 1 _i_W_state_[3] = __VERIFIER_nondet_uchar(); #line 1 _W_state_[3] = _i_W_state_[3]; #line 1 _i_W_state_[4] = __VERIFIER_nondet_uchar(); #line 1 _W_state_[4] = _i_W_state_[4]; #line 1 _i_W_state_[5] = __VERIFIER_nondet_uchar(); #line 1 _W_state_[5] = _i_W_state_[5]; #line 1 _i_W_state_[6] = __VERIFIER_nondet_uchar(); #line 1 _W_state_[6] = _i_W_state_[6]; #line 1 _i_W_state_[7] = __VERIFIER_nondet_uchar(); #line 1 _W_state_[7] = _i_W_state_[7]; #line 1 _i_W_state_[8] = __VERIFIER_nondet_uchar(); #line 1 _W_state_[8] = _i_W_state_[8]; #line 1 _i_W_state_[9] = __VERIFIER_nondet_uchar(); #line 1 _W_state_[9] = _i_W_state_[9]; #line 1 _i_W_state_[10] = __VERIFIER_nondet_uchar(); #line 1 _W_state_[10] = _i_W_state_[10]; #line 1 _i_W_state_[11] = __VERIFIER_nondet_uchar(); #line 1 _W_state_[11] = _i_W_state_[11]; #line 1 _i_W_state_[12] = __VERIFIER_nondet_uchar(); #line 1 _W_state_[12] = _i_W_state_[12]; #line 1 _i_W_state_[13] = __VERIFIER_nondet_uchar(); #line 1 _W_state_[13] = _i_W_state_[13]; #line 1 _i_W_state_[14] = __VERIFIER_nondet_uchar(); #line 1 _W_state_[14] = _i_W_state_[14]; #line 1 _i_W_state_[15] = __VERIFIER_nondet_uchar(); #line 1 _W_state_[15] = _i_W_state_[15]; #line 1 _i_W_state_[16] = __VERIFIER_nondet_uchar(); #line 1 _W_state_[16] = _i_W_state_[16]; #line 1 _i_W_state_[17] = __VERIFIER_nondet_uchar(); #line 1 _W_state_[17] = _i_W_state_[17]; #line 1 _i_W_state_[18] = __VERIFIER_nondet_uchar(); #line 1 _W_state_[18] = _i_W_state_[18]; #line 1 _i_W_state_[19] = __VERIFIER_nondet_uchar(); #line 1 _W_state_[19] = _i_W_state_[19]; #line 1 _i_W_state_[20] = __VERIFIER_nondet_uchar(); #line 1 _W_state_[20] = _i_W_state_[20]; #line 1 _i_W_state_[21] = __VERIFIER_nondet_uchar(); #line 1 _W_state_[21] = _i_W_state_[21]; #line 1 _i_W_state_[22] = __VERIFIER_nondet_uchar(); #line 1 _W_state_[22] = _i_W_state_[22]; #line 1 _i_W_state_[23] = __VERIFIER_nondet_uchar(); #line 1 _W_state_[23] = _i_W_state_[23]; #line 1 _i_W_state_[24] = __VERIFIER_nondet_uchar(); #line 1 _W_state_[24] = _i_W_state_[24]; #line 1 _i_W_state_[25] = __VERIFIER_nondet_uchar(); #line 1 _W_state_[25] = _i_W_state_[25]; #line 1 _i_W_state_[26] = __VERIFIER_nondet_uchar(); #line 1 _W_state_[26] = _i_W_state_[26]; #line 1 _i_W_state_[27] = __VERIFIER_nondet_uchar(); #line 1 _W_state_[27] = _i_W_state_[27]; #line 1 _i_R_state_[1] = __VERIFIER_nondet_uchar(); #line 1 _R_state_[1] = _i_R_state_[1]; #line 1 _i_R_state_[2] = __VERIFIER_nondet_uchar(); #line 1 _R_state_[2] = _i_R_state_[2]; #line 1 _i_R_state_[3] = __VERIFIER_nondet_uchar(); #line 1 _R_state_[3] = _i_R_state_[3]; #line 1 _i_R_state_[4] = __VERIFIER_nondet_uchar(); #line 1 _R_state_[4] = _i_R_state_[4]; #line 1 _i_R_state_[5] = __VERIFIER_nondet_uchar(); #line 1 _R_state_[5] = _i_R_state_[5]; #line 1 _i_R_state_[6] = __VERIFIER_nondet_uchar(); #line 1 _R_state_[6] = _i_R_state_[6]; #line 1 _i_R_state_[7] = __VERIFIER_nondet_uchar(); #line 1 _R_state_[7] = _i_R_state_[7]; #line 1 _i_R_state_[8] = __VERIFIER_nondet_uchar(); #line 1 _R_state_[8] = _i_R_state_[8]; #line 1 _i_R_state_[9] = __VERIFIER_nondet_uchar(); #line 1 _R_state_[9] = _i_R_state_[9]; #line 1 _i_R_state_[10] = __VERIFIER_nondet_uchar(); #line 1 _R_state_[10] = _i_R_state_[10]; #line 1 _i_R_state_[11] = __VERIFIER_nondet_uchar(); #line 1 _R_state_[11] = _i_R_state_[11]; #line 1 _i_R_state_[12] = __VERIFIER_nondet_uchar(); #line 1 _R_state_[12] = _i_R_state_[12]; #line 1 _i_R_state_[13] = __VERIFIER_nondet_uchar(); #line 1 _R_state_[13] = _i_R_state_[13]; #line 1 _i_R_state_[14] = __VERIFIER_nondet_uchar(); #line 1 _R_state_[14] = _i_R_state_[14]; #line 1 _i_R_state_[15] = __VERIFIER_nondet_uchar(); #line 1 _R_state_[15] = _i_R_state_[15]; #line 1 _i_R_state_[16] = __VERIFIER_nondet_uchar(); #line 1 _R_state_[16] = _i_R_state_[16]; #line 1 _i_R_state_[17] = __VERIFIER_nondet_uchar(); #line 1 _R_state_[17] = _i_R_state_[17]; #line 1 _i_R_state_[18] = __VERIFIER_nondet_uchar(); #line 1 _R_state_[18] = _i_R_state_[18]; #line 1 _i_R_state_[19] = __VERIFIER_nondet_uchar(); #line 1 _R_state_[19] = _i_R_state_[19]; #line 1 _i_R_state_[20] = __VERIFIER_nondet_uchar(); #line 1 _R_state_[20] = _i_R_state_[20]; #line 1 _i_R_state_[21] = __VERIFIER_nondet_uchar(); #line 1 _R_state_[21] = _i_R_state_[21]; #line 1 _i_R_state_[22] = __VERIFIER_nondet_uchar(); #line 1 _R_state_[22] = _i_R_state_[22]; #line 1 _i_R_state_[23] = __VERIFIER_nondet_uchar(); #line 1 _R_state_[23] = _i_R_state_[23]; #line 1 _i_R_state_[24] = __VERIFIER_nondet_uchar(); #line 1 _R_state_[24] = _i_R_state_[24]; #line 1 _i_R_state_[25] = __VERIFIER_nondet_uchar(); #line 1 _R_state_[25] = _i_R_state_[25]; #line 1 _i_R_state_[26] = __VERIFIER_nondet_uchar(); #line 1 _R_state_[26] = _i_R_state_[26]; #line 1 _i_R_state_[27] = __VERIFIER_nondet_uchar(); #line 1 _R_state_[27] = _i_R_state_[27]; #line 1 _i_threshold_[1] = __VERIFIER_nondet_ushort(); #line 1 _threshold_[1] = _i_threshold_[1]; #line 1 _i_threshold_[2] = __VERIFIER_nondet_ushort(); #line 1 _threshold_[2] = _i_threshold_[2]; #line 1 _i_threshold_[3] = __VERIFIER_nondet_ushort(); #line 1 _threshold_[3] = _i_threshold_[3]; #line 1 _i_threshold_[4] = __VERIFIER_nondet_ushort(); #line 1 _threshold_[4] = _i_threshold_[4]; #line 1 _i_threshold_[5] = __VERIFIER_nondet_ushort(); #line 1 _threshold_[5] = _i_threshold_[5]; #line 1 _i_threshold_[6] = __VERIFIER_nondet_ushort(); #line 1 _threshold_[6] = _i_threshold_[6]; #line 1 _i_threshold_[7] = __VERIFIER_nondet_ushort(); #line 1 _threshold_[7] = _i_threshold_[7]; #line 1 _i_threshold_[8] = __VERIFIER_nondet_ushort(); #line 1 _threshold_[8] = _i_threshold_[8]; #line 1 _i_threshold_[9] = __VERIFIER_nondet_ushort(); #line 1 _threshold_[9] = _i_threshold_[9]; #line 1 _i_threshold_[10] = __VERIFIER_nondet_ushort(); #line 1 _threshold_[10] = _i_threshold_[10]; #line 1 _i_threshold_[11] = __VERIFIER_nondet_ushort(); #line 1 _threshold_[11] = _i_threshold_[11]; #line 1 _i_threshold_[12] = __VERIFIER_nondet_ushort(); #line 1 _threshold_[12] = _i_threshold_[12]; #line 1 _i_threshold_[13] = __VERIFIER_nondet_ushort(); #line 1 _threshold_[13] = _i_threshold_[13]; #line 1 _i_threshold_[14] = __VERIFIER_nondet_ushort(); #line 1 _threshold_[14] = _i_threshold_[14]; #line 1 _i_threshold_[15] = __VERIFIER_nondet_ushort(); #line 1 _threshold_[15] = _i_threshold_[15]; #line 1 _i_threshold_[16] = __VERIFIER_nondet_ushort(); #line 1 _threshold_[16] = _i_threshold_[16]; #line 1 _i_threshold_[17] = __VERIFIER_nondet_ushort(); #line 1 _threshold_[17] = _i_threshold_[17]; #line 1 _i_threshold_[18] = __VERIFIER_nondet_ushort(); #line 1 _threshold_[18] = _i_threshold_[18]; #line 1 _i_threshold_[19] = __VERIFIER_nondet_ushort(); #line 1 _threshold_[19] = _i_threshold_[19]; #line 1 _i_threshold_[20] = __VERIFIER_nondet_ushort(); #line 1 _threshold_[20] = _i_threshold_[20]; #line 1 _i_threshold_[21] = __VERIFIER_nondet_ushort(); #line 1 _threshold_[21] = _i_threshold_[21]; #line 1 _i_threshold_[22] = __VERIFIER_nondet_ushort(); #line 1 _threshold_[22] = _i_threshold_[22]; #line 1 _i_threshold_[23] = __VERIFIER_nondet_ushort(); #line 1 _threshold_[23] = _i_threshold_[23]; #line 1 _i_threshold_[24] = __VERIFIER_nondet_ushort(); #line 1 _threshold_[24] = _i_threshold_[24]; #line 1 _i_threshold_[25] = __VERIFIER_nondet_ushort(); #line 1 _threshold_[25] = _i_threshold_[25]; #line 1 _i_threshold_[26] = __VERIFIER_nondet_ushort(); #line 1 _threshold_[26] = _i_threshold_[26]; #line 1 _i_threshold_[27] = __VERIFIER_nondet_ushort(); #line 1 _threshold_[27] = _i_threshold_[27]; #line 1 _i_need_to_run_nxtbg_[1] = __VERIFIER_nondet__Bool(); #line 1 _need_to_run_nxtbg_[1] = _i_need_to_run_nxtbg_[1]; #line 1 _i_need_to_run_nxtbg_[2] = __VERIFIER_nondet__Bool(); #line 1 _need_to_run_nxtbg_[2] = _i_need_to_run_nxtbg_[2]; #line 1 _i_need_to_run_nxtbg_[3] = __VERIFIER_nondet__Bool(); #line 1 _need_to_run_nxtbg_[3] = _i_need_to_run_nxtbg_[3]; #line 1 _i_need_to_run_nxtbg_[4] = __VERIFIER_nondet__Bool(); #line 1 _need_to_run_nxtbg_[4] = _i_need_to_run_nxtbg_[4]; #line 1 _i_need_to_run_nxtbg_[5] = __VERIFIER_nondet__Bool(); #line 1 _need_to_run_nxtbg_[5] = _i_need_to_run_nxtbg_[5]; #line 1 _i_need_to_run_nxtbg_[6] = __VERIFIER_nondet__Bool(); #line 1 _need_to_run_nxtbg_[6] = _i_need_to_run_nxtbg_[6]; #line 1 _i_need_to_run_nxtbg_[7] = __VERIFIER_nondet__Bool(); #line 1 _need_to_run_nxtbg_[7] = _i_need_to_run_nxtbg_[7]; #line 1 _i_need_to_run_nxtbg_[8] = __VERIFIER_nondet__Bool(); #line 1 _need_to_run_nxtbg_[8] = _i_need_to_run_nxtbg_[8]; #line 1 _i_need_to_run_nxtbg_[9] = __VERIFIER_nondet__Bool(); #line 1 _need_to_run_nxtbg_[9] = _i_need_to_run_nxtbg_[9]; #line 1 _i_need_to_run_nxtbg_[10] = __VERIFIER_nondet__Bool(); #line 1 _need_to_run_nxtbg_[10] = _i_need_to_run_nxtbg_[10]; #line 1 _i_need_to_run_nxtbg_[11] = __VERIFIER_nondet__Bool(); #line 1 _need_to_run_nxtbg_[11] = _i_need_to_run_nxtbg_[11]; #line 1 _i_need_to_run_nxtbg_[12] = __VERIFIER_nondet__Bool(); #line 1 _need_to_run_nxtbg_[12] = _i_need_to_run_nxtbg_[12]; #line 1 _i_need_to_run_nxtbg_[13] = __VERIFIER_nondet__Bool(); #line 1 _need_to_run_nxtbg_[13] = _i_need_to_run_nxtbg_[13]; #line 1 _i_need_to_run_nxtbg_[14] = __VERIFIER_nondet__Bool(); #line 1 _need_to_run_nxtbg_[14] = _i_need_to_run_nxtbg_[14]; #line 1 _i_need_to_run_nxtbg_[15] = __VERIFIER_nondet__Bool(); #line 1 _need_to_run_nxtbg_[15] = _i_need_to_run_nxtbg_[15]; #line 1 _i_need_to_run_nxtbg_[16] = __VERIFIER_nondet__Bool(); #line 1 _need_to_run_nxtbg_[16] = _i_need_to_run_nxtbg_[16]; #line 1 _i_need_to_run_nxtbg_[17] = __VERIFIER_nondet__Bool(); #line 1 _need_to_run_nxtbg_[17] = _i_need_to_run_nxtbg_[17]; #line 1 _i_need_to_run_nxtbg_[18] = __VERIFIER_nondet__Bool(); #line 1 _need_to_run_nxtbg_[18] = _i_need_to_run_nxtbg_[18]; #line 1 _i_need_to_run_nxtbg_[19] = __VERIFIER_nondet__Bool(); #line 1 _need_to_run_nxtbg_[19] = _i_need_to_run_nxtbg_[19]; #line 1 _i_need_to_run_nxtbg_[20] = __VERIFIER_nondet__Bool(); #line 1 _need_to_run_nxtbg_[20] = _i_need_to_run_nxtbg_[20]; #line 1 _i_need_to_run_nxtbg_[21] = __VERIFIER_nondet__Bool(); #line 1 _need_to_run_nxtbg_[21] = _i_need_to_run_nxtbg_[21]; #line 1 _i_need_to_run_nxtbg_[22] = __VERIFIER_nondet__Bool(); #line 1 _need_to_run_nxtbg_[22] = _i_need_to_run_nxtbg_[22]; #line 1 _i_need_to_run_nxtbg_[23] = __VERIFIER_nondet__Bool(); #line 1 _need_to_run_nxtbg_[23] = _i_need_to_run_nxtbg_[23]; #line 1 _i_need_to_run_nxtbg_[24] = __VERIFIER_nondet__Bool(); #line 1 _need_to_run_nxtbg_[24] = _i_need_to_run_nxtbg_[24]; #line 1 _i_need_to_run_nxtbg_[25] = __VERIFIER_nondet__Bool(); #line 1 _need_to_run_nxtbg_[25] = _i_need_to_run_nxtbg_[25]; #line 1 _i_need_to_run_nxtbg_[26] = __VERIFIER_nondet__Bool(); #line 1 _need_to_run_nxtbg_[26] = _i_need_to_run_nxtbg_[26]; #line 1 _i_need_to_run_nxtbg_[27] = __VERIFIER_nondet__Bool(); #line 1 _need_to_run_nxtbg_[27] = _i_need_to_run_nxtbg_[27]; #line 1 _i_need_to_read_[1] = __VERIFIER_nondet__Bool(); #line 1 _need_to_read_[1] = _i_need_to_read_[1]; #line 1 _i_need_to_read_[2] = __VERIFIER_nondet__Bool(); #line 1 _need_to_read_[2] = _i_need_to_read_[2]; #line 1 _i_need_to_read_[3] = __VERIFIER_nondet__Bool(); #line 1 _need_to_read_[3] = _i_need_to_read_[3]; #line 1 _i_need_to_read_[4] = __VERIFIER_nondet__Bool(); #line 1 _need_to_read_[4] = _i_need_to_read_[4]; #line 1 _i_need_to_read_[5] = __VERIFIER_nondet__Bool(); #line 1 _need_to_read_[5] = _i_need_to_read_[5]; #line 1 _i_need_to_read_[6] = __VERIFIER_nondet__Bool(); #line 1 _need_to_read_[6] = _i_need_to_read_[6]; #line 1 _i_need_to_read_[7] = __VERIFIER_nondet__Bool(); #line 1 _need_to_read_[7] = _i_need_to_read_[7]; #line 1 _i_need_to_read_[8] = __VERIFIER_nondet__Bool(); #line 1 _need_to_read_[8] = _i_need_to_read_[8]; #line 1 _i_need_to_read_[9] = __VERIFIER_nondet__Bool(); #line 1 _need_to_read_[9] = _i_need_to_read_[9]; #line 1 _i_need_to_read_[10] = __VERIFIER_nondet__Bool(); #line 1 _need_to_read_[10] = _i_need_to_read_[10]; #line 1 _i_need_to_read_[11] = __VERIFIER_nondet__Bool(); #line 1 _need_to_read_[11] = _i_need_to_read_[11]; #line 1 _i_need_to_read_[12] = __VERIFIER_nondet__Bool(); #line 1 _need_to_read_[12] = _i_need_to_read_[12]; #line 1 _i_need_to_read_[13] = __VERIFIER_nondet__Bool(); #line 1 _need_to_read_[13] = _i_need_to_read_[13]; #line 1 _i_need_to_read_[14] = __VERIFIER_nondet__Bool(); #line 1 _need_to_read_[14] = _i_need_to_read_[14]; #line 1 _i_need_to_read_[15] = __VERIFIER_nondet__Bool(); #line 1 _need_to_read_[15] = _i_need_to_read_[15]; #line 1 _i_need_to_read_[16] = __VERIFIER_nondet__Bool(); #line 1 _need_to_read_[16] = _i_need_to_read_[16]; #line 1 _i_need_to_read_[17] = __VERIFIER_nondet__Bool(); #line 1 _need_to_read_[17] = _i_need_to_read_[17]; #line 1 _i_need_to_read_[18] = __VERIFIER_nondet__Bool(); #line 1 _need_to_read_[18] = _i_need_to_read_[18]; #line 1 _i_need_to_read_[19] = __VERIFIER_nondet__Bool(); #line 1 _need_to_read_[19] = _i_need_to_read_[19]; #line 1 _i_need_to_read_[20] = __VERIFIER_nondet__Bool(); #line 1 _need_to_read_[20] = _i_need_to_read_[20]; #line 1 _i_need_to_read_[21] = __VERIFIER_nondet__Bool(); #line 1 _need_to_read_[21] = _i_need_to_read_[21]; #line 1 _i_need_to_read_[22] = __VERIFIER_nondet__Bool(); #line 1 _need_to_read_[22] = _i_need_to_read_[22]; #line 1 _i_need_to_read_[23] = __VERIFIER_nondet__Bool(); #line 1 _need_to_read_[23] = _i_need_to_read_[23]; #line 1 _i_need_to_read_[24] = __VERIFIER_nondet__Bool(); #line 1 _need_to_read_[24] = _i_need_to_read_[24]; #line 1 _i_need_to_read_[25] = __VERIFIER_nondet__Bool(); #line 1 _need_to_read_[25] = _i_need_to_read_[25]; #line 1 _i_need_to_read_[26] = __VERIFIER_nondet__Bool(); #line 1 _need_to_read_[26] = _i_need_to_read_[26]; #line 1 _i_need_to_read_[27] = __VERIFIER_nondet__Bool(); #line 1 _need_to_read_[27] = _i_need_to_read_[27]; #line 1 _i_dir_[1] = __VERIFIER_nondet__Bool(); #line 1 _dir_[1] = _i_dir_[1]; #line 1 _i_dir_[2] = __VERIFIER_nondet__Bool(); #line 1 _dir_[2] = _i_dir_[2]; #line 1 _i_dir_[3] = __VERIFIER_nondet__Bool(); #line 1 _dir_[3] = _i_dir_[3]; #line 1 _i_dir_[4] = __VERIFIER_nondet__Bool(); #line 1 _dir_[4] = _i_dir_[4]; #line 1 _i_dir_[5] = __VERIFIER_nondet__Bool(); #line 1 _dir_[5] = _i_dir_[5]; #line 1 _i_dir_[6] = __VERIFIER_nondet__Bool(); #line 1 _dir_[6] = _i_dir_[6]; #line 1 _i_dir_[7] = __VERIFIER_nondet__Bool(); #line 1 _dir_[7] = _i_dir_[7]; #line 1 _i_dir_[8] = __VERIFIER_nondet__Bool(); #line 1 _dir_[8] = _i_dir_[8]; #line 1 _i_dir_[9] = __VERIFIER_nondet__Bool(); #line 1 _dir_[9] = _i_dir_[9]; #line 1 _i_dir_[10] = __VERIFIER_nondet__Bool(); #line 1 _dir_[10] = _i_dir_[10]; #line 1 _i_dir_[11] = __VERIFIER_nondet__Bool(); #line 1 _dir_[11] = _i_dir_[11]; #line 1 _i_dir_[12] = __VERIFIER_nondet__Bool(); #line 1 _dir_[12] = _i_dir_[12]; #line 1 _i_dir_[13] = __VERIFIER_nondet__Bool(); #line 1 _dir_[13] = _i_dir_[13]; #line 1 _i_dir_[14] = __VERIFIER_nondet__Bool(); #line 1 _dir_[14] = _i_dir_[14]; #line 1 _i_dir_[15] = __VERIFIER_nondet__Bool(); #line 1 _dir_[15] = _i_dir_[15]; #line 1 _i_dir_[16] = __VERIFIER_nondet__Bool(); #line 1 _dir_[16] = _i_dir_[16]; #line 1 _i_dir_[17] = __VERIFIER_nondet__Bool(); #line 1 _dir_[17] = _i_dir_[17]; #line 1 _i_dir_[18] = __VERIFIER_nondet__Bool(); #line 1 _dir_[18] = _i_dir_[18]; #line 1 _i_dir_[19] = __VERIFIER_nondet__Bool(); #line 1 _dir_[19] = _i_dir_[19]; #line 1 _i_dir_[20] = __VERIFIER_nondet__Bool(); #line 1 _dir_[20] = _i_dir_[20]; #line 1 _i_dir_[21] = __VERIFIER_nondet__Bool(); #line 1 _dir_[21] = _i_dir_[21]; #line 1 _i_dir_[22] = __VERIFIER_nondet__Bool(); #line 1 _dir_[22] = _i_dir_[22]; #line 1 _i_dir_[23] = __VERIFIER_nondet__Bool(); #line 1 _dir_[23] = _i_dir_[23]; #line 1 _i_dir_[24] = __VERIFIER_nondet__Bool(); #line 1 _dir_[24] = _i_dir_[24]; #line 1 _i_dir_[25] = __VERIFIER_nondet__Bool(); #line 1 _dir_[25] = _i_dir_[25]; #line 1 _i_dir_[26] = __VERIFIER_nondet__Bool(); #line 1 _dir_[26] = _i_dir_[26]; #line 1 _i_dir_[27] = __VERIFIER_nondet__Bool(); #line 1 _dir_[27] = _i_dir_[27]; #line 1 _i_output_[1] = __VERIFIER_nondet__Bool(); #line 1 _output_[1] = _i_output_[1]; #line 1 _i_output_[2] = __VERIFIER_nondet__Bool(); #line 1 _output_[2] = _i_output_[2]; #line 1 _i_output_[3] = __VERIFIER_nondet__Bool(); #line 1 _output_[3] = _i_output_[3]; #line 1 _i_output_[4] = __VERIFIER_nondet__Bool(); #line 1 _output_[4] = _i_output_[4]; #line 1 _i_output_[5] = __VERIFIER_nondet__Bool(); #line 1 _output_[5] = _i_output_[5]; #line 1 _i_output_[6] = __VERIFIER_nondet__Bool(); #line 1 _output_[6] = _i_output_[6]; #line 1 _i_output_[7] = __VERIFIER_nondet__Bool(); #line 1 _output_[7] = _i_output_[7]; #line 1 _i_output_[8] = __VERIFIER_nondet__Bool(); #line 1 _output_[8] = _i_output_[8]; #line 1 _i_output_[9] = __VERIFIER_nondet__Bool(); #line 1 _output_[9] = _i_output_[9]; #line 1 _i_output_[10] = __VERIFIER_nondet__Bool(); #line 1 _output_[10] = _i_output_[10]; #line 1 _i_output_[11] = __VERIFIER_nondet__Bool(); #line 1 _output_[11] = _i_output_[11]; #line 1 _i_output_[12] = __VERIFIER_nondet__Bool(); #line 1 _output_[12] = _i_output_[12]; #line 1 _i_output_[13] = __VERIFIER_nondet__Bool(); #line 1 _output_[13] = _i_output_[13]; #line 1 _i_output_[14] = __VERIFIER_nondet__Bool(); #line 1 _output_[14] = _i_output_[14]; #line 1 _i_output_[15] = __VERIFIER_nondet__Bool(); #line 1 _output_[15] = _i_output_[15]; #line 1 _i_output_[16] = __VERIFIER_nondet__Bool(); #line 1 _output_[16] = _i_output_[16]; #line 1 _i_output_[17] = __VERIFIER_nondet__Bool(); #line 1 _output_[17] = _i_output_[17]; #line 1 _i_output_[18] = __VERIFIER_nondet__Bool(); #line 1 _output_[18] = _i_output_[18]; #line 1 _i_output_[19] = __VERIFIER_nondet__Bool(); #line 1 _output_[19] = _i_output_[19]; #line 1 _i_output_[20] = __VERIFIER_nondet__Bool(); #line 1 _output_[20] = _i_output_[20]; #line 1 _i_output_[21] = __VERIFIER_nondet__Bool(); #line 1 _output_[21] = _i_output_[21]; #line 1 _i_output_[22] = __VERIFIER_nondet__Bool(); #line 1 _output_[22] = _i_output_[22]; #line 1 _i_output_[23] = __VERIFIER_nondet__Bool(); #line 1 _output_[23] = _i_output_[23]; #line 1 _i_output_[24] = __VERIFIER_nondet__Bool(); #line 1 _output_[24] = _i_output_[24]; #line 1 _i_output_[25] = __VERIFIER_nondet__Bool(); #line 1 _output_[25] = _i_output_[25]; #line 1 _i_output_[26] = __VERIFIER_nondet__Bool(); #line 1 _output_[26] = _i_output_[26]; #line 1 _i_output_[27] = __VERIFIER_nondet__Bool(); #line 1 _output_[27] = _i_output_[27]; #line 1 _i_input_[1] = __VERIFIER_nondet__Bool(); #line 1 _input_[1] = _i_input_[1]; #line 1 _i_input_[2] = __VERIFIER_nondet__Bool(); #line 1 _input_[2] = _i_input_[2]; #line 1 _i_input_[3] = __VERIFIER_nondet__Bool(); #line 1 _input_[3] = _i_input_[3]; #line 1 _i_input_[4] = __VERIFIER_nondet__Bool(); #line 1 _input_[4] = _i_input_[4]; #line 1 _i_input_[5] = __VERIFIER_nondet__Bool(); #line 1 _input_[5] = _i_input_[5]; #line 1 _i_input_[6] = __VERIFIER_nondet__Bool(); #line 1 _input_[6] = _i_input_[6]; #line 1 _i_input_[7] = __VERIFIER_nondet__Bool(); #line 1 _input_[7] = _i_input_[7]; #line 1 _i_input_[8] = __VERIFIER_nondet__Bool(); #line 1 _input_[8] = _i_input_[8]; #line 1 _i_input_[9] = __VERIFIER_nondet__Bool(); #line 1 _input_[9] = _i_input_[9]; #line 1 _i_input_[10] = __VERIFIER_nondet__Bool(); #line 1 _input_[10] = _i_input_[10]; #line 1 _i_input_[11] = __VERIFIER_nondet__Bool(); #line 1 _input_[11] = _i_input_[11]; #line 1 _i_input_[12] = __VERIFIER_nondet__Bool(); #line 1 _input_[12] = _i_input_[12]; #line 1 _i_input_[13] = __VERIFIER_nondet__Bool(); #line 1 _input_[13] = _i_input_[13]; #line 1 _i_input_[14] = __VERIFIER_nondet__Bool(); #line 1 _input_[14] = _i_input_[14]; #line 1 _i_input_[15] = __VERIFIER_nondet__Bool(); #line 1 _input_[15] = _i_input_[15]; #line 1 _i_input_[16] = __VERIFIER_nondet__Bool(); #line 1 _input_[16] = _i_input_[16]; #line 1 _i_input_[17] = __VERIFIER_nondet__Bool(); #line 1 _input_[17] = _i_input_[17]; #line 1 _i_input_[18] = __VERIFIER_nondet__Bool(); #line 1 _input_[18] = _i_input_[18]; #line 1 _i_input_[19] = __VERIFIER_nondet__Bool(); #line 1 _input_[19] = _i_input_[19]; #line 1 _i_input_[20] = __VERIFIER_nondet__Bool(); #line 1 _input_[20] = _i_input_[20]; #line 1 _i_input_[21] = __VERIFIER_nondet__Bool(); #line 1 _input_[21] = _i_input_[21]; #line 1 _i_input_[22] = __VERIFIER_nondet__Bool(); #line 1 _input_[22] = _i_input_[22]; #line 1 _i_input_[23] = __VERIFIER_nondet__Bool(); #line 1 _input_[23] = _i_input_[23]; #line 1 _i_input_[24] = __VERIFIER_nondet__Bool(); #line 1 _input_[24] = _i_input_[24]; #line 1 _i_input_[25] = __VERIFIER_nondet__Bool(); #line 1 _input_[25] = _i_input_[25]; #line 1 _i_input_[26] = __VERIFIER_nondet__Bool(); #line 1 _input_[26] = _i_input_[26]; #line 1 _i_input_[27] = __VERIFIER_nondet__Bool(); #line 1 _input_[27] = _i_input_[27]; #line 1 _i_nxtcolorsensor_mode_[1] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_mode_[1] = _i_nxtcolorsensor_mode_[1]; #line 1 _i_nxtcolorsensor_mode_[2] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_mode_[2] = _i_nxtcolorsensor_mode_[2]; #line 1 _i_nxtcolorsensor_mode_[3] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_mode_[3] = _i_nxtcolorsensor_mode_[3]; #line 1 _i_nxtcolorsensor_mode_[4] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_mode_[4] = _i_nxtcolorsensor_mode_[4]; #line 1 _i_nxtcolorsensor_mode_[5] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_mode_[5] = _i_nxtcolorsensor_mode_[5]; #line 1 _i_nxtcolorsensor_mode_[6] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_mode_[6] = _i_nxtcolorsensor_mode_[6]; #line 1 _i_nxtcolorsensor_mode_[7] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_mode_[7] = _i_nxtcolorsensor_mode_[7]; #line 1 _i_nxtcolorsensor_mode_[8] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_mode_[8] = _i_nxtcolorsensor_mode_[8]; #line 1 _i_nxtcolorsensor_mode_[9] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_mode_[9] = _i_nxtcolorsensor_mode_[9]; #line 1 _i_nxtcolorsensor_mode_[10] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_mode_[10] = _i_nxtcolorsensor_mode_[10]; #line 1 _i_nxtcolorsensor_mode_[11] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_mode_[11] = _i_nxtcolorsensor_mode_[11]; #line 1 _i_nxtcolorsensor_mode_[12] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_mode_[12] = _i_nxtcolorsensor_mode_[12]; #line 1 _i_nxtcolorsensor_mode_[13] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_mode_[13] = _i_nxtcolorsensor_mode_[13]; #line 1 _i_nxtcolorsensor_mode_[14] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_mode_[14] = _i_nxtcolorsensor_mode_[14]; #line 1 _i_nxtcolorsensor_mode_[15] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_mode_[15] = _i_nxtcolorsensor_mode_[15]; #line 1 _i_nxtcolorsensor_mode_[16] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_mode_[16] = _i_nxtcolorsensor_mode_[16]; #line 1 _i_nxtcolorsensor_mode_[17] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_mode_[17] = _i_nxtcolorsensor_mode_[17]; #line 1 _i_nxtcolorsensor_mode_[18] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_mode_[18] = _i_nxtcolorsensor_mode_[18]; #line 1 _i_nxtcolorsensor_mode_[19] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_mode_[19] = _i_nxtcolorsensor_mode_[19]; #line 1 _i_nxtcolorsensor_mode_[20] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_mode_[20] = _i_nxtcolorsensor_mode_[20]; #line 1 _i_nxtcolorsensor_mode_[21] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_mode_[21] = _i_nxtcolorsensor_mode_[21]; #line 1 _i_nxtcolorsensor_mode_[22] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_mode_[22] = _i_nxtcolorsensor_mode_[22]; #line 1 _i_nxtcolorsensor_mode_[23] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_mode_[23] = _i_nxtcolorsensor_mode_[23]; #line 1 _i_nxtcolorsensor_mode_[24] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_mode_[24] = _i_nxtcolorsensor_mode_[24]; #line 1 _i_nxtcolorsensor_mode_[25] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_mode_[25] = _i_nxtcolorsensor_mode_[25]; #line 1 _i_nxtcolorsensor_mode_[26] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_mode_[26] = _i_nxtcolorsensor_mode_[26]; #line 1 _i_nxtcolorsensor_mode_[27] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_mode_[27] = _i_nxtcolorsensor_mode_[27]; #line 1 _i_nxtcolorsensor_data_mode_[1] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_data_mode_[1] = _i_nxtcolorsensor_data_mode_[1]; #line 1 _i_nxtcolorsensor_data_mode_[2] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_data_mode_[2] = _i_nxtcolorsensor_data_mode_[2]; #line 1 _i_nxtcolorsensor_data_mode_[3] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_data_mode_[3] = _i_nxtcolorsensor_data_mode_[3]; #line 1 _i_nxtcolorsensor_data_mode_[4] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_data_mode_[4] = _i_nxtcolorsensor_data_mode_[4]; #line 1 _i_nxtcolorsensor_data_mode_[5] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_data_mode_[5] = _i_nxtcolorsensor_data_mode_[5]; #line 1 _i_nxtcolorsensor_data_mode_[6] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_data_mode_[6] = _i_nxtcolorsensor_data_mode_[6]; #line 1 _i_nxtcolorsensor_data_mode_[7] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_data_mode_[7] = _i_nxtcolorsensor_data_mode_[7]; #line 1 _i_nxtcolorsensor_data_mode_[8] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_data_mode_[8] = _i_nxtcolorsensor_data_mode_[8]; #line 1 _i_nxtcolorsensor_data_mode_[9] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_data_mode_[9] = _i_nxtcolorsensor_data_mode_[9]; #line 1 _i_nxtcolorsensor_data_mode_[10] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_data_mode_[10] = _i_nxtcolorsensor_data_mode_[10]; #line 1 _i_nxtcolorsensor_data_mode_[11] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_data_mode_[11] = _i_nxtcolorsensor_data_mode_[11]; #line 1 _i_nxtcolorsensor_data_mode_[12] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_data_mode_[12] = _i_nxtcolorsensor_data_mode_[12]; #line 1 _i_nxtcolorsensor_data_mode_[13] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_data_mode_[13] = _i_nxtcolorsensor_data_mode_[13]; #line 1 _i_nxtcolorsensor_data_mode_[14] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_data_mode_[14] = _i_nxtcolorsensor_data_mode_[14]; #line 1 _i_nxtcolorsensor_data_mode_[15] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_data_mode_[15] = _i_nxtcolorsensor_data_mode_[15]; #line 1 _i_nxtcolorsensor_data_mode_[16] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_data_mode_[16] = _i_nxtcolorsensor_data_mode_[16]; #line 1 _i_nxtcolorsensor_data_mode_[17] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_data_mode_[17] = _i_nxtcolorsensor_data_mode_[17]; #line 1 _i_nxtcolorsensor_data_mode_[18] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_data_mode_[18] = _i_nxtcolorsensor_data_mode_[18]; #line 1 _i_nxtcolorsensor_data_mode_[19] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_data_mode_[19] = _i_nxtcolorsensor_data_mode_[19]; #line 1 _i_nxtcolorsensor_data_mode_[20] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_data_mode_[20] = _i_nxtcolorsensor_data_mode_[20]; #line 1 _i_nxtcolorsensor_data_mode_[21] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_data_mode_[21] = _i_nxtcolorsensor_data_mode_[21]; #line 1 _i_nxtcolorsensor_data_mode_[22] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_data_mode_[22] = _i_nxtcolorsensor_data_mode_[22]; #line 1 _i_nxtcolorsensor_data_mode_[23] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_data_mode_[23] = _i_nxtcolorsensor_data_mode_[23]; #line 1 _i_nxtcolorsensor_data_mode_[24] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_data_mode_[24] = _i_nxtcolorsensor_data_mode_[24]; #line 1 _i_nxtcolorsensor_data_mode_[25] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_data_mode_[25] = _i_nxtcolorsensor_data_mode_[25]; #line 1 _i_nxtcolorsensor_data_mode_[26] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_data_mode_[26] = _i_nxtcolorsensor_data_mode_[26]; #line 1 _i_nxtcolorsensor_data_mode_[27] = __VERIFIER_nondet_uchar(); #line 1 _nxtcolorsensor_data_mode_[27] = _i_nxtcolorsensor_data_mode_[27]; #line 1 _i_T_speed_[1] = __VERIFIER_nondet_char(); #line 1 _T_speed_[1] = _i_T_speed_[1]; #line 1 _i_T_speed_[2] = __VERIFIER_nondet_char(); #line 1 _T_speed_[2] = _i_T_speed_[2]; #line 1 _i_T_speed_[3] = __VERIFIER_nondet_char(); #line 1 _T_speed_[3] = _i_T_speed_[3]; #line 1 _i_T_speed_[4] = __VERIFIER_nondet_char(); #line 1 _T_speed_[4] = _i_T_speed_[4]; #line 1 _i_T_speed_[5] = __VERIFIER_nondet_char(); #line 1 _T_speed_[5] = _i_T_speed_[5]; #line 1 _i_T_speed_[6] = __VERIFIER_nondet_char(); #line 1 _T_speed_[6] = _i_T_speed_[6]; #line 1 _i_T_speed_[7] = __VERIFIER_nondet_char(); #line 1 _T_speed_[7] = _i_T_speed_[7]; #line 1 _i_T_speed_[8] = __VERIFIER_nondet_char(); #line 1 _T_speed_[8] = _i_T_speed_[8]; #line 1 _i_T_speed_[9] = __VERIFIER_nondet_char(); #line 1 _T_speed_[9] = _i_T_speed_[9]; #line 1 _i_T_speed_[10] = __VERIFIER_nondet_char(); #line 1 _T_speed_[10] = _i_T_speed_[10]; #line 1 _i_T_speed_[11] = __VERIFIER_nondet_char(); #line 1 _T_speed_[11] = _i_T_speed_[11]; #line 1 _i_T_speed_[12] = __VERIFIER_nondet_char(); #line 1 _T_speed_[12] = _i_T_speed_[12]; #line 1 _i_T_speed_[13] = __VERIFIER_nondet_char(); #line 1 _T_speed_[13] = _i_T_speed_[13]; #line 1 _i_T_speed_[14] = __VERIFIER_nondet_char(); #line 1 _T_speed_[14] = _i_T_speed_[14]; #line 1 _i_T_speed_[15] = __VERIFIER_nondet_char(); #line 1 _T_speed_[15] = _i_T_speed_[15]; #line 1 _i_T_speed_[16] = __VERIFIER_nondet_char(); #line 1 _T_speed_[16] = _i_T_speed_[16]; #line 1 _i_T_speed_[17] = __VERIFIER_nondet_char(); #line 1 _T_speed_[17] = _i_T_speed_[17]; #line 1 _i_T_speed_[18] = __VERIFIER_nondet_char(); #line 1 _T_speed_[18] = _i_T_speed_[18]; #line 1 _i_T_speed_[19] = __VERIFIER_nondet_char(); #line 1 _T_speed_[19] = _i_T_speed_[19]; #line 1 _i_T_speed_[20] = __VERIFIER_nondet_char(); #line 1 _T_speed_[20] = _i_T_speed_[20]; #line 1 _i_T_speed_[21] = __VERIFIER_nondet_char(); #line 1 _T_speed_[21] = _i_T_speed_[21]; #line 1 _i_T_speed_[22] = __VERIFIER_nondet_char(); #line 1 _T_speed_[22] = _i_T_speed_[22]; #line 1 _i_T_speed_[23] = __VERIFIER_nondet_char(); #line 1 _T_speed_[23] = _i_T_speed_[23]; #line 1 _i_T_speed_[24] = __VERIFIER_nondet_char(); #line 1 _T_speed_[24] = _i_T_speed_[24]; #line 1 _i_T_speed_[25] = __VERIFIER_nondet_char(); #line 1 _T_speed_[25] = _i_T_speed_[25]; #line 1 _i_T_speed_[26] = __VERIFIER_nondet_char(); #line 1 _T_speed_[26] = _i_T_speed_[26]; #line 1 _i_T_speed_[27] = __VERIFIER_nondet_char(); #line 1 _T_speed_[27] = _i_T_speed_[27]; #line 1 _i_T_count_[1] = __VERIFIER_nondet_int(); #line 1 _T_count_[1] = _i_T_count_[1]; #line 1 _i_T_count_[2] = __VERIFIER_nondet_int(); #line 1 _T_count_[2] = _i_T_count_[2]; #line 1 _i_T_count_[3] = __VERIFIER_nondet_int(); #line 1 _T_count_[3] = _i_T_count_[3]; #line 1 _i_T_count_[4] = __VERIFIER_nondet_int(); #line 1 _T_count_[4] = _i_T_count_[4]; #line 1 _i_T_count_[5] = __VERIFIER_nondet_int(); #line 1 _T_count_[5] = _i_T_count_[5]; #line 1 _i_T_count_[6] = __VERIFIER_nondet_int(); #line 1 _T_count_[6] = _i_T_count_[6]; #line 1 _i_T_count_[7] = __VERIFIER_nondet_int(); #line 1 _T_count_[7] = _i_T_count_[7]; #line 1 _i_T_count_[8] = __VERIFIER_nondet_int(); #line 1 _T_count_[8] = _i_T_count_[8]; #line 1 _i_T_count_[9] = __VERIFIER_nondet_int(); #line 1 _T_count_[9] = _i_T_count_[9]; #line 1 _i_T_count_[10] = __VERIFIER_nondet_int(); #line 1 _T_count_[10] = _i_T_count_[10]; #line 1 _i_T_count_[11] = __VERIFIER_nondet_int(); #line 1 _T_count_[11] = _i_T_count_[11]; #line 1 _i_T_count_[12] = __VERIFIER_nondet_int(); #line 1 _T_count_[12] = _i_T_count_[12]; #line 1 _i_T_count_[13] = __VERIFIER_nondet_int(); #line 1 _T_count_[13] = _i_T_count_[13]; #line 1 _i_T_count_[14] = __VERIFIER_nondet_int(); #line 1 _T_count_[14] = _i_T_count_[14]; #line 1 _i_T_count_[15] = __VERIFIER_nondet_int(); #line 1 _T_count_[15] = _i_T_count_[15]; #line 1 _i_T_count_[16] = __VERIFIER_nondet_int(); #line 1 _T_count_[16] = _i_T_count_[16]; #line 1 _i_T_count_[17] = __VERIFIER_nondet_int(); #line 1 _T_count_[17] = _i_T_count_[17]; #line 1 _i_T_count_[18] = __VERIFIER_nondet_int(); #line 1 _T_count_[18] = _i_T_count_[18]; #line 1 _i_T_count_[19] = __VERIFIER_nondet_int(); #line 1 _T_count_[19] = _i_T_count_[19]; #line 1 _i_T_count_[20] = __VERIFIER_nondet_int(); #line 1 _T_count_[20] = _i_T_count_[20]; #line 1 _i_T_count_[21] = __VERIFIER_nondet_int(); #line 1 _T_count_[21] = _i_T_count_[21]; #line 1 _i_T_count_[22] = __VERIFIER_nondet_int(); #line 1 _T_count_[22] = _i_T_count_[22]; #line 1 _i_T_count_[23] = __VERIFIER_nondet_int(); #line 1 _T_count_[23] = _i_T_count_[23]; #line 1 _i_T_count_[24] = __VERIFIER_nondet_int(); #line 1 _T_count_[24] = _i_T_count_[24]; #line 1 _i_T_count_[25] = __VERIFIER_nondet_int(); #line 1 _T_count_[25] = _i_T_count_[25]; #line 1 _i_T_count_[26] = __VERIFIER_nondet_int(); #line 1 _T_count_[26] = _i_T_count_[26]; #line 1 _i_T_count_[27] = __VERIFIER_nondet_int(); #line 1 _T_count_[27] = _i_T_count_[27]; #line 1 _i_W_speed_[1] = __VERIFIER_nondet_char(); #line 1 _W_speed_[1] = _i_W_speed_[1]; #line 1 _i_W_speed_[2] = __VERIFIER_nondet_char(); #line 1 _W_speed_[2] = _i_W_speed_[2]; #line 1 _i_W_speed_[3] = __VERIFIER_nondet_char(); #line 1 _W_speed_[3] = _i_W_speed_[3]; #line 1 _i_W_speed_[4] = __VERIFIER_nondet_char(); #line 1 _W_speed_[4] = _i_W_speed_[4]; #line 1 _i_W_speed_[5] = __VERIFIER_nondet_char(); #line 1 _W_speed_[5] = _i_W_speed_[5]; #line 1 _i_W_speed_[6] = __VERIFIER_nondet_char(); #line 1 _W_speed_[6] = _i_W_speed_[6]; #line 1 _i_W_speed_[7] = __VERIFIER_nondet_char(); #line 1 _W_speed_[7] = _i_W_speed_[7]; #line 1 _i_W_speed_[8] = __VERIFIER_nondet_char(); #line 1 _W_speed_[8] = _i_W_speed_[8]; #line 1 _i_W_speed_[9] = __VERIFIER_nondet_char(); #line 1 _W_speed_[9] = _i_W_speed_[9]; #line 1 _i_W_speed_[10] = __VERIFIER_nondet_char(); #line 1 _W_speed_[10] = _i_W_speed_[10]; #line 1 _i_W_speed_[11] = __VERIFIER_nondet_char(); #line 1 _W_speed_[11] = _i_W_speed_[11]; #line 1 _i_W_speed_[12] = __VERIFIER_nondet_char(); #line 1 _W_speed_[12] = _i_W_speed_[12]; #line 1 _i_W_speed_[13] = __VERIFIER_nondet_char(); #line 1 _W_speed_[13] = _i_W_speed_[13]; #line 1 _i_W_speed_[14] = __VERIFIER_nondet_char(); #line 1 _W_speed_[14] = _i_W_speed_[14]; #line 1 _i_W_speed_[15] = __VERIFIER_nondet_char(); #line 1 _W_speed_[15] = _i_W_speed_[15]; #line 1 _i_W_speed_[16] = __VERIFIER_nondet_char(); #line 1 _W_speed_[16] = _i_W_speed_[16]; #line 1 _i_W_speed_[17] = __VERIFIER_nondet_char(); #line 1 _W_speed_[17] = _i_W_speed_[17]; #line 1 _i_W_speed_[18] = __VERIFIER_nondet_char(); #line 1 _W_speed_[18] = _i_W_speed_[18]; #line 1 _i_W_speed_[19] = __VERIFIER_nondet_char(); #line 1 _W_speed_[19] = _i_W_speed_[19]; #line 1 _i_W_speed_[20] = __VERIFIER_nondet_char(); #line 1 _W_speed_[20] = _i_W_speed_[20]; #line 1 _i_W_speed_[21] = __VERIFIER_nondet_char(); #line 1 _W_speed_[21] = _i_W_speed_[21]; #line 1 _i_W_speed_[22] = __VERIFIER_nondet_char(); #line 1 _W_speed_[22] = _i_W_speed_[22]; #line 1 _i_W_speed_[23] = __VERIFIER_nondet_char(); #line 1 _W_speed_[23] = _i_W_speed_[23]; #line 1 _i_W_speed_[24] = __VERIFIER_nondet_char(); #line 1 _W_speed_[24] = _i_W_speed_[24]; #line 1 _i_W_speed_[25] = __VERIFIER_nondet_char(); #line 1 _W_speed_[25] = _i_W_speed_[25]; #line 1 _i_W_speed_[26] = __VERIFIER_nondet_char(); #line 1 _W_speed_[26] = _i_W_speed_[26]; #line 1 _i_W_speed_[27] = __VERIFIER_nondet_char(); #line 1 _W_speed_[27] = _i_W_speed_[27]; #line 1 _i_W_count_[1] = __VERIFIER_nondet_int(); #line 1 _W_count_[1] = _i_W_count_[1]; #line 1 _i_W_count_[2] = __VERIFIER_nondet_int(); #line 1 _W_count_[2] = _i_W_count_[2]; #line 1 _i_W_count_[3] = __VERIFIER_nondet_int(); #line 1 _W_count_[3] = _i_W_count_[3]; #line 1 _i_W_count_[4] = __VERIFIER_nondet_int(); #line 1 _W_count_[4] = _i_W_count_[4]; #line 1 _i_W_count_[5] = __VERIFIER_nondet_int(); #line 1 _W_count_[5] = _i_W_count_[5]; #line 1 _i_W_count_[6] = __VERIFIER_nondet_int(); #line 1 _W_count_[6] = _i_W_count_[6]; #line 1 _i_W_count_[7] = __VERIFIER_nondet_int(); #line 1 _W_count_[7] = _i_W_count_[7]; #line 1 _i_W_count_[8] = __VERIFIER_nondet_int(); #line 1 _W_count_[8] = _i_W_count_[8]; #line 1 _i_W_count_[9] = __VERIFIER_nondet_int(); #line 1 _W_count_[9] = _i_W_count_[9]; #line 1 _i_W_count_[10] = __VERIFIER_nondet_int(); #line 1 _W_count_[10] = _i_W_count_[10]; #line 1 _i_W_count_[11] = __VERIFIER_nondet_int(); #line 1 _W_count_[11] = _i_W_count_[11]; #line 1 _i_W_count_[12] = __VERIFIER_nondet_int(); #line 1 _W_count_[12] = _i_W_count_[12]; #line 1 _i_W_count_[13] = __VERIFIER_nondet_int(); #line 1 _W_count_[13] = _i_W_count_[13]; #line 1 _i_W_count_[14] = __VERIFIER_nondet_int(); #line 1 _W_count_[14] = _i_W_count_[14]; #line 1 _i_W_count_[15] = __VERIFIER_nondet_int(); #line 1 _W_count_[15] = _i_W_count_[15]; #line 1 _i_W_count_[16] = __VERIFIER_nondet_int(); #line 1 _W_count_[16] = _i_W_count_[16]; #line 1 _i_W_count_[17] = __VERIFIER_nondet_int(); #line 1 _W_count_[17] = _i_W_count_[17]; #line 1 _i_W_count_[18] = __VERIFIER_nondet_int(); #line 1 _W_count_[18] = _i_W_count_[18]; #line 1 _i_W_count_[19] = __VERIFIER_nondet_int(); #line 1 _W_count_[19] = _i_W_count_[19]; #line 1 _i_W_count_[20] = __VERIFIER_nondet_int(); #line 1 _W_count_[20] = _i_W_count_[20]; #line 1 _i_W_count_[21] = __VERIFIER_nondet_int(); #line 1 _W_count_[21] = _i_W_count_[21]; #line 1 _i_W_count_[22] = __VERIFIER_nondet_int(); #line 1 _W_count_[22] = _i_W_count_[22]; #line 1 _i_W_count_[23] = __VERIFIER_nondet_int(); #line 1 _W_count_[23] = _i_W_count_[23]; #line 1 _i_W_count_[24] = __VERIFIER_nondet_int(); #line 1 _W_count_[24] = _i_W_count_[24]; #line 1 _i_W_count_[25] = __VERIFIER_nondet_int(); #line 1 _W_count_[25] = _i_W_count_[25]; #line 1 _i_W_count_[26] = __VERIFIER_nondet_int(); #line 1 _W_count_[26] = _i_W_count_[26]; #line 1 _i_W_count_[27] = __VERIFIER_nondet_int(); #line 1 _W_count_[27] = _i_W_count_[27]; #line 1 _i_R_speed_[1] = __VERIFIER_nondet_char(); #line 1 _R_speed_[1] = _i_R_speed_[1]; #line 1 _i_R_speed_[2] = __VERIFIER_nondet_char(); #line 1 _R_speed_[2] = _i_R_speed_[2]; #line 1 _i_R_speed_[3] = __VERIFIER_nondet_char(); #line 1 _R_speed_[3] = _i_R_speed_[3]; #line 1 _i_R_speed_[4] = __VERIFIER_nondet_char(); #line 1 _R_speed_[4] = _i_R_speed_[4]; #line 1 _i_R_speed_[5] = __VERIFIER_nondet_char(); #line 1 _R_speed_[5] = _i_R_speed_[5]; #line 1 _i_R_speed_[6] = __VERIFIER_nondet_char(); #line 1 _R_speed_[6] = _i_R_speed_[6]; #line 1 _i_R_speed_[7] = __VERIFIER_nondet_char(); #line 1 _R_speed_[7] = _i_R_speed_[7]; #line 1 _i_R_speed_[8] = __VERIFIER_nondet_char(); #line 1 _R_speed_[8] = _i_R_speed_[8]; #line 1 _i_R_speed_[9] = __VERIFIER_nondet_char(); #line 1 _R_speed_[9] = _i_R_speed_[9]; #line 1 _i_R_speed_[10] = __VERIFIER_nondet_char(); #line 1 _R_speed_[10] = _i_R_speed_[10]; #line 1 _i_R_speed_[11] = __VERIFIER_nondet_char(); #line 1 _R_speed_[11] = _i_R_speed_[11]; #line 1 _i_R_speed_[12] = __VERIFIER_nondet_char(); #line 1 _R_speed_[12] = _i_R_speed_[12]; #line 1 _i_R_speed_[13] = __VERIFIER_nondet_char(); #line 1 _R_speed_[13] = _i_R_speed_[13]; #line 1 _i_R_speed_[14] = __VERIFIER_nondet_char(); #line 1 _R_speed_[14] = _i_R_speed_[14]; #line 1 _i_R_speed_[15] = __VERIFIER_nondet_char(); #line 1 _R_speed_[15] = _i_R_speed_[15]; #line 1 _i_R_speed_[16] = __VERIFIER_nondet_char(); #line 1 _R_speed_[16] = _i_R_speed_[16]; #line 1 _i_R_speed_[17] = __VERIFIER_nondet_char(); #line 1 _R_speed_[17] = _i_R_speed_[17]; #line 1 _i_R_speed_[18] = __VERIFIER_nondet_char(); #line 1 _R_speed_[18] = _i_R_speed_[18]; #line 1 _i_R_speed_[19] = __VERIFIER_nondet_char(); #line 1 _R_speed_[19] = _i_R_speed_[19]; #line 1 _i_R_speed_[20] = __VERIFIER_nondet_char(); #line 1 _R_speed_[20] = _i_R_speed_[20]; #line 1 _i_R_speed_[21] = __VERIFIER_nondet_char(); #line 1 _R_speed_[21] = _i_R_speed_[21]; #line 1 _i_R_speed_[22] = __VERIFIER_nondet_char(); #line 1 _R_speed_[22] = _i_R_speed_[22]; #line 1 _i_R_speed_[23] = __VERIFIER_nondet_char(); #line 1 _R_speed_[23] = _i_R_speed_[23]; #line 1 _i_R_speed_[24] = __VERIFIER_nondet_char(); #line 1 _R_speed_[24] = _i_R_speed_[24]; #line 1 _i_R_speed_[25] = __VERIFIER_nondet_char(); #line 1 _R_speed_[25] = _i_R_speed_[25]; #line 1 _i_R_speed_[26] = __VERIFIER_nondet_char(); #line 1 _R_speed_[26] = _i_R_speed_[26]; #line 1 _i_R_speed_[27] = __VERIFIER_nondet_char(); #line 1 _R_speed_[27] = _i_R_speed_[27]; #line 1 _i_R_count_[1] = __VERIFIER_nondet_int(); #line 1 _R_count_[1] = _i_R_count_[1]; #line 1 _i_R_count_[2] = __VERIFIER_nondet_int(); #line 1 _R_count_[2] = _i_R_count_[2]; #line 1 _i_R_count_[3] = __VERIFIER_nondet_int(); #line 1 _R_count_[3] = _i_R_count_[3]; #line 1 _i_R_count_[4] = __VERIFIER_nondet_int(); #line 1 _R_count_[4] = _i_R_count_[4]; #line 1 _i_R_count_[5] = __VERIFIER_nondet_int(); #line 1 _R_count_[5] = _i_R_count_[5]; #line 1 _i_R_count_[6] = __VERIFIER_nondet_int(); #line 1 _R_count_[6] = _i_R_count_[6]; #line 1 _i_R_count_[7] = __VERIFIER_nondet_int(); #line 1 _R_count_[7] = _i_R_count_[7]; #line 1 _i_R_count_[8] = __VERIFIER_nondet_int(); #line 1 _R_count_[8] = _i_R_count_[8]; #line 1 _i_R_count_[9] = __VERIFIER_nondet_int(); #line 1 _R_count_[9] = _i_R_count_[9]; #line 1 _i_R_count_[10] = __VERIFIER_nondet_int(); #line 1 _R_count_[10] = _i_R_count_[10]; #line 1 _i_R_count_[11] = __VERIFIER_nondet_int(); #line 1 _R_count_[11] = _i_R_count_[11]; #line 1 _i_R_count_[12] = __VERIFIER_nondet_int(); #line 1 _R_count_[12] = _i_R_count_[12]; #line 1 _i_R_count_[13] = __VERIFIER_nondet_int(); #line 1 _R_count_[13] = _i_R_count_[13]; #line 1 _i_R_count_[14] = __VERIFIER_nondet_int(); #line 1 _R_count_[14] = _i_R_count_[14]; #line 1 _i_R_count_[15] = __VERIFIER_nondet_int(); #line 1 _R_count_[15] = _i_R_count_[15]; #line 1 _i_R_count_[16] = __VERIFIER_nondet_int(); #line 1 _R_count_[16] = _i_R_count_[16]; #line 1 _i_R_count_[17] = __VERIFIER_nondet_int(); #line 1 _R_count_[17] = _i_R_count_[17]; #line 1 _i_R_count_[18] = __VERIFIER_nondet_int(); #line 1 _R_count_[18] = _i_R_count_[18]; #line 1 _i_R_count_[19] = __VERIFIER_nondet_int(); #line 1 _R_count_[19] = _i_R_count_[19]; #line 1 _i_R_count_[20] = __VERIFIER_nondet_int(); #line 1 _R_count_[20] = _i_R_count_[20]; #line 1 _i_R_count_[21] = __VERIFIER_nondet_int(); #line 1 _R_count_[21] = _i_R_count_[21]; #line 1 _i_R_count_[22] = __VERIFIER_nondet_int(); #line 1 _R_count_[22] = _i_R_count_[22]; #line 1 _i_R_count_[23] = __VERIFIER_nondet_int(); #line 1 _R_count_[23] = _i_R_count_[23]; #line 1 _i_R_count_[24] = __VERIFIER_nondet_int(); #line 1 _R_count_[24] = _i_R_count_[24]; #line 1 _i_R_count_[25] = __VERIFIER_nondet_int(); #line 1 _R_count_[25] = _i_R_count_[25]; #line 1 _i_R_count_[26] = __VERIFIER_nondet_int(); #line 1 _R_count_[26] = _i_R_count_[26]; #line 1 _i_R_count_[27] = __VERIFIER_nondet_int(); #line 1 _R_count_[27] = _i_R_count_[27]; #line 1 _i___startrek_current_priority_[1] = __VERIFIER_nondet_char(); #line 1 ___startrek_current_priority_[1] = _i___startrek_current_priority_[1]; #line 1 _i___startrek_current_priority_[2] = __VERIFIER_nondet_char(); #line 1 ___startrek_current_priority_[2] = _i___startrek_current_priority_[2]; #line 1 _i___startrek_current_priority_[3] = __VERIFIER_nondet_char(); #line 1 ___startrek_current_priority_[3] = _i___startrek_current_priority_[3]; #line 1 _i___startrek_current_priority_[4] = __VERIFIER_nondet_char(); #line 1 ___startrek_current_priority_[4] = _i___startrek_current_priority_[4]; #line 1 _i___startrek_current_priority_[5] = __VERIFIER_nondet_char(); #line 1 ___startrek_current_priority_[5] = _i___startrek_current_priority_[5]; #line 1 _i___startrek_current_priority_[6] = __VERIFIER_nondet_char(); #line 1 ___startrek_current_priority_[6] = _i___startrek_current_priority_[6]; #line 1 _i___startrek_current_priority_[7] = __VERIFIER_nondet_char(); #line 1 ___startrek_current_priority_[7] = _i___startrek_current_priority_[7]; #line 1 _i___startrek_current_priority_[8] = __VERIFIER_nondet_char(); #line 1 ___startrek_current_priority_[8] = _i___startrek_current_priority_[8]; #line 1 _i___startrek_current_priority_[9] = __VERIFIER_nondet_char(); #line 1 ___startrek_current_priority_[9] = _i___startrek_current_priority_[9]; #line 1 _i___startrek_current_priority_[10] = __VERIFIER_nondet_char(); #line 1 ___startrek_current_priority_[10] = _i___startrek_current_priority_[10]; #line 1 _i___startrek_current_priority_[11] = __VERIFIER_nondet_char(); #line 1 ___startrek_current_priority_[11] = _i___startrek_current_priority_[11]; #line 1 _i___startrek_current_priority_[12] = __VERIFIER_nondet_char(); #line 1 ___startrek_current_priority_[12] = _i___startrek_current_priority_[12]; #line 1 _i___startrek_current_priority_[13] = __VERIFIER_nondet_char(); #line 1 ___startrek_current_priority_[13] = _i___startrek_current_priority_[13]; #line 1 _i___startrek_current_priority_[14] = __VERIFIER_nondet_char(); #line 1 ___startrek_current_priority_[14] = _i___startrek_current_priority_[14]; #line 1 _i___startrek_current_priority_[15] = __VERIFIER_nondet_char(); #line 1 ___startrek_current_priority_[15] = _i___startrek_current_priority_[15]; #line 1 _i___startrek_current_priority_[16] = __VERIFIER_nondet_char(); #line 1 ___startrek_current_priority_[16] = _i___startrek_current_priority_[16]; #line 1 _i___startrek_current_priority_[17] = __VERIFIER_nondet_char(); #line 1 ___startrek_current_priority_[17] = _i___startrek_current_priority_[17]; #line 1 _i___startrek_current_priority_[18] = __VERIFIER_nondet_char(); #line 1 ___startrek_current_priority_[18] = _i___startrek_current_priority_[18]; #line 1 _i___startrek_current_priority_[19] = __VERIFIER_nondet_char(); #line 1 ___startrek_current_priority_[19] = _i___startrek_current_priority_[19]; #line 1 _i___startrek_current_priority_[20] = __VERIFIER_nondet_char(); #line 1 ___startrek_current_priority_[20] = _i___startrek_current_priority_[20]; #line 1 _i___startrek_current_priority_[21] = __VERIFIER_nondet_char(); #line 1 ___startrek_current_priority_[21] = _i___startrek_current_priority_[21]; #line 1 _i___startrek_current_priority_[22] = __VERIFIER_nondet_char(); #line 1 ___startrek_current_priority_[22] = _i___startrek_current_priority_[22]; #line 1 _i___startrek_current_priority_[23] = __VERIFIER_nondet_char(); #line 1 ___startrek_current_priority_[23] = _i___startrek_current_priority_[23]; #line 1 _i___startrek_current_priority_[24] = __VERIFIER_nondet_char(); #line 1 ___startrek_current_priority_[24] = _i___startrek_current_priority_[24]; #line 1 _i___startrek_current_priority_[25] = __VERIFIER_nondet_char(); #line 1 ___startrek_current_priority_[25] = _i___startrek_current_priority_[25]; #line 1 _i___startrek_current_priority_[26] = __VERIFIER_nondet_char(); #line 1 ___startrek_current_priority_[26] = _i___startrek_current_priority_[26]; #line 1 _i___startrek_current_priority_[27] = __VERIFIER_nondet_char(); #line 1 ___startrek_current_priority_[27] = _i___startrek_current_priority_[27]; } } #line 1 "<compiler builtins>" __inline static _Bool __startrek_cs_t0(void) { _Bool c1 ; unsigned char o2 ; { #line 1 if (__startrek_is_first_cs) { { #line 1 "<startrek builtins>" __startrek_is_first_cs = 0; } } #line 1 if (__startrek_lock) { #line 1 return (0); } #line 1 c1 = __VERIFIER_nondet_bool(); #line 1 if (c1) { #line 1 return (0); } #line 1 o2 = __startrek_round; #line 1 __startrek_round = __VERIFIER_nondet_uchar(); #line 1 __VERIFIER_assume(__startrek_round > o2); #line 1 __VERIFIER_assume(__startrek_round <= __startrek_job_end); #line 1 if (__startrek_round != __startrek_job_end) { { #line 1 if (__startrek_start_t1[0] < __startrek_round) { #line 1 __VERIFIER_assume(__startrek_round > __startrek_end_t1[0]); } #line 1 if (__startrek_start_t1[1] < __startrek_round) { #line 1 __VERIFIER_assume(__startrek_round > __startrek_end_t1[1]); } #line 1 if (__startrek_start_t1[2] < __startrek_round) { #line 1 __VERIFIER_assume(__startrek_round > __startrek_end_t1[2]); } #line 1 if (__startrek_start_t1[3] < __startrek_round) { #line 1 __VERIFIER_assume(__startrek_round > __startrek_end_t1[3]); } #line 1 if (__startrek_start_t1[4] < __startrek_round) { #line 1 __VERIFIER_assume(__startrek_round > __startrek_end_t1[4]); } #line 1 if (__startrek_start_t1[5] < __startrek_round) { #line 1 __VERIFIER_assume(__startrek_round > __startrek_end_t1[5]); } #line 1 if (__startrek_start_t1[6] < __startrek_round) { #line 1 __VERIFIER_assume(__startrek_round > __startrek_end_t1[6]); } #line 1 if (__startrek_start_t1[7] < __startrek_round) { #line 1 __VERIFIER_assume(__startrek_round > __startrek_end_t1[7]); } #line 1 if (__startrek_start_t2[0] < __startrek_round) { #line 1 __VERIFIER_assume(__startrek_round > __startrek_end_t2[0]); } #line 1 if (__startrek_start_t2[1] < __startrek_round) { #line 1 __VERIFIER_assume(__startrek_round > __startrek_end_t2[1]); } #line 1 if (__startrek_start_t2[2] < __startrek_round) { #line 1 __VERIFIER_assume(__startrek_round > __startrek_end_t2[2]); } #line 1 if (__startrek_start_t2[3] < __startrek_round) { #line 1 __VERIFIER_assume(__startrek_round > __startrek_end_t2[3]); } #line 1 if (__startrek_start_t2[4] < __startrek_round) { #line 1 __VERIFIER_assume(__startrek_round > __startrek_end_t2[4]); } #line 1 if (__startrek_start_t2[5] < __startrek_round) { #line 1 __VERIFIER_assume(__startrek_round > __startrek_end_t2[5]); } #line 1 if (__startrek_start_t2[6] < __startrek_round) { #line 1 __VERIFIER_assume(__startrek_round > __startrek_end_t2[6]); } #line 1 if (__startrek_start_t2[7] < __startrek_round) { #line 1 __VERIFIER_assume(__startrek_round > __startrek_end_t2[7]); } } } #line 1 return (1); } } #line 1 "<compiler builtins>" __inline static _Bool __startrek_cs_t1(void) { _Bool c1 ; unsigned char o2 ; { #line 1 if (__startrek_is_first_cs) { { #line 1 "<startrek builtins>" __startrek_is_first_cs = 0; } } #line 1 if (__startrek_lock) { #line 1 return (0); } #line 1 c1 = __VERIFIER_nondet_bool(); #line 1 if (c1) { #line 1 return (0); } #line 1 o2 = __startrek_round; #line 1 __startrek_round = __VERIFIER_nondet_uchar(); #line 1 __VERIFIER_assume(__startrek_round > o2); #line 1 __VERIFIER_assume(__startrek_round <= __startrek_job_end); #line 1 if (__startrek_round != __startrek_job_end) { { #line 1 if (__startrek_start_t2[0] < __startrek_round) { #line 1 __VERIFIER_assume(__startrek_round > __startrek_end_t2[0]); } #line 1 if (__startrek_start_t2[1] < __startrek_round) { #line 1 __VERIFIER_assume(__startrek_round > __startrek_end_t2[1]); } #line 1 if (__startrek_start_t2[2] < __startrek_round) { #line 1 __VERIFIER_assume(__startrek_round > __startrek_end_t2[2]); } #line 1 if (__startrek_start_t2[3] < __startrek_round) { #line 1 __VERIFIER_assume(__startrek_round > __startrek_end_t2[3]); } #line 1 if (__startrek_start_t2[4] < __startrek_round) { #line 1 __VERIFIER_assume(__startrek_round > __startrek_end_t2[4]); } #line 1 if (__startrek_start_t2[5] < __startrek_round) { #line 1 __VERIFIER_assume(__startrek_round > __startrek_end_t2[5]); } #line 1 if (__startrek_start_t2[6] < __startrek_round) { #line 1 __VERIFIER_assume(__startrek_round > __startrek_end_t2[6]); } #line 1 if (__startrek_start_t2[7] < __startrek_round) { #line 1 __VERIFIER_assume(__startrek_round > __startrek_end_t2[7]); } } } #line 1 return (1); } } #line 1 "<compiler builtins>" __inline static _Bool __startrek_cs_t2(void) { _Bool c1 ; unsigned char o2 ; { #line 1 if (__startrek_is_first_cs) { { #line 1 "<startrek builtins>" __startrek_is_first_cs = 0; } } #line 1 if (__startrek_lock) { #line 1 return (0); } #line 1 c1 = __VERIFIER_nondet_bool(); #line 1 if (c1) { #line 1 return (0); } #line 1 o2 = __startrek_round; #line 1 __startrek_round = __VERIFIER_nondet_uchar(); #line 1 __VERIFIER_assume(__startrek_round > o2); #line 1 __VERIFIER_assume(__startrek_round <= __startrek_job_end); #line 1 if (__startrek_round != __startrek_job_end) { { } } #line 1 return (1); } } #line 1 "<compiler builtins>" __inline static _Bool __startrek_cs_t3(void) { { #line 1 "<startrek builtins>" return (0); } } #line 1 "<compiler builtins>" __inline static void __startrek_assert_i0(_Bool arg ) { { #line 1 if (__startrek_hyper_period != 0) { #line 1 "<startrek builtins>" return; } #line 1 if (arg) { #line 1 return; } #line 1 if (__startrek_round < __startrek_error_round) { #line 1 __startrek_error_round = __startrek_round; } #line 1 switch (__startrek_task) { case 0: #line 1 __startrek_Assert_t0_i0[__startrek_job] = 0; #line 1 "<compiler builtins>" break; case 1: #line 1 "<startrek builtins>" __startrek_Assert_t1_i0[__startrek_job] = 0; #line 1 "<compiler builtins>" break; case 2: #line 1 "<startrek builtins>" __startrek_Assert_t2_i0[__startrek_job] = 0; #line 1 "<compiler builtins>" break; case 3: #line 1 "<startrek builtins>" __startrek_Assert_t3_i0[__startrek_job] = 0; #line 1 "<compiler builtins>" break; } } } #line 1 "<compiler builtins>" __inline void __startrek_check_assumptions(void) { { #line 1 "<startrek builtins>" __VERIFIER_assume(_i___startrek_job_count_Writer_[27] == ___startrek_job_count_Writer_[26]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Writer_[26] == ___startrek_job_count_Writer_[25]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Writer_[25] == ___startrek_job_count_Writer_[24]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Writer_[24] == ___startrek_job_count_Writer_[23]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Writer_[23] == ___startrek_job_count_Writer_[22]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Writer_[22] == ___startrek_job_count_Writer_[21]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Writer_[21] == ___startrek_job_count_Writer_[20]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Writer_[20] == ___startrek_job_count_Writer_[19]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Writer_[19] == ___startrek_job_count_Writer_[18]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Writer_[18] == ___startrek_job_count_Writer_[17]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Writer_[17] == ___startrek_job_count_Writer_[16]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Writer_[16] == ___startrek_job_count_Writer_[15]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Writer_[15] == ___startrek_job_count_Writer_[14]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Writer_[14] == ___startrek_job_count_Writer_[13]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Writer_[13] == ___startrek_job_count_Writer_[12]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Writer_[12] == ___startrek_job_count_Writer_[11]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Writer_[11] == ___startrek_job_count_Writer_[10]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Writer_[10] == ___startrek_job_count_Writer_[9]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Writer_[9] == ___startrek_job_count_Writer_[8]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Writer_[8] == ___startrek_job_count_Writer_[7]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Writer_[7] == ___startrek_job_count_Writer_[6]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Writer_[6] == ___startrek_job_count_Writer_[5]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Writer_[5] == ___startrek_job_count_Writer_[4]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Writer_[4] == ___startrek_job_count_Writer_[3]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Writer_[3] == ___startrek_job_count_Writer_[2]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Writer_[2] == ___startrek_job_count_Writer_[1]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Writer_[1] == ___startrek_job_count_Writer_[0]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Reader_[27] == ___startrek_job_count_Reader_[26]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Reader_[26] == ___startrek_job_count_Reader_[25]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Reader_[25] == ___startrek_job_count_Reader_[24]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Reader_[24] == ___startrek_job_count_Reader_[23]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Reader_[23] == ___startrek_job_count_Reader_[22]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Reader_[22] == ___startrek_job_count_Reader_[21]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Reader_[21] == ___startrek_job_count_Reader_[20]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Reader_[20] == ___startrek_job_count_Reader_[19]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Reader_[19] == ___startrek_job_count_Reader_[18]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Reader_[18] == ___startrek_job_count_Reader_[17]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Reader_[17] == ___startrek_job_count_Reader_[16]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Reader_[16] == ___startrek_job_count_Reader_[15]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Reader_[15] == ___startrek_job_count_Reader_[14]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Reader_[14] == ___startrek_job_count_Reader_[13]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Reader_[13] == ___startrek_job_count_Reader_[12]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Reader_[12] == ___startrek_job_count_Reader_[11]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Reader_[11] == ___startrek_job_count_Reader_[10]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Reader_[10] == ___startrek_job_count_Reader_[9]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Reader_[9] == ___startrek_job_count_Reader_[8]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Reader_[8] == ___startrek_job_count_Reader_[7]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Reader_[7] == ___startrek_job_count_Reader_[6]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Reader_[6] == ___startrek_job_count_Reader_[5]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Reader_[5] == ___startrek_job_count_Reader_[4]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Reader_[4] == ___startrek_job_count_Reader_[3]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Reader_[3] == ___startrek_job_count_Reader_[2]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Reader_[2] == ___startrek_job_count_Reader_[1]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Reader_[1] == ___startrek_job_count_Reader_[0]); #line 1 __VERIFIER_assume(_i___startrek_job_count_TapeMover_[27] == ___startrek_job_count_TapeMover_[26]); #line 1 __VERIFIER_assume(_i___startrek_job_count_TapeMover_[26] == ___startrek_job_count_TapeMover_[25]); #line 1 __VERIFIER_assume(_i___startrek_job_count_TapeMover_[25] == ___startrek_job_count_TapeMover_[24]); #line 1 __VERIFIER_assume(_i___startrek_job_count_TapeMover_[24] == ___startrek_job_count_TapeMover_[23]); #line 1 __VERIFIER_assume(_i___startrek_job_count_TapeMover_[23] == ___startrek_job_count_TapeMover_[22]); #line 1 __VERIFIER_assume(_i___startrek_job_count_TapeMover_[22] == ___startrek_job_count_TapeMover_[21]); #line 1 __VERIFIER_assume(_i___startrek_job_count_TapeMover_[21] == ___startrek_job_count_TapeMover_[20]); #line 1 __VERIFIER_assume(_i___startrek_job_count_TapeMover_[20] == ___startrek_job_count_TapeMover_[19]); #line 1 __VERIFIER_assume(_i___startrek_job_count_TapeMover_[19] == ___startrek_job_count_TapeMover_[18]); #line 1 __VERIFIER_assume(_i___startrek_job_count_TapeMover_[18] == ___startrek_job_count_TapeMover_[17]); #line 1 __VERIFIER_assume(_i___startrek_job_count_TapeMover_[17] == ___startrek_job_count_TapeMover_[16]); #line 1 __VERIFIER_assume(_i___startrek_job_count_TapeMover_[16] == ___startrek_job_count_TapeMover_[15]); #line 1 __VERIFIER_assume(_i___startrek_job_count_TapeMover_[15] == ___startrek_job_count_TapeMover_[14]); #line 1 __VERIFIER_assume(_i___startrek_job_count_TapeMover_[14] == ___startrek_job_count_TapeMover_[13]); #line 1 __VERIFIER_assume(_i___startrek_job_count_TapeMover_[13] == ___startrek_job_count_TapeMover_[12]); #line 1 __VERIFIER_assume(_i___startrek_job_count_TapeMover_[12] == ___startrek_job_count_TapeMover_[11]); #line 1 __VERIFIER_assume(_i___startrek_job_count_TapeMover_[11] == ___startrek_job_count_TapeMover_[10]); #line 1 __VERIFIER_assume(_i___startrek_job_count_TapeMover_[10] == ___startrek_job_count_TapeMover_[9]); #line 1 __VERIFIER_assume(_i___startrek_job_count_TapeMover_[9] == ___startrek_job_count_TapeMover_[8]); #line 1 __VERIFIER_assume(_i___startrek_job_count_TapeMover_[8] == ___startrek_job_count_TapeMover_[7]); #line 1 __VERIFIER_assume(_i___startrek_job_count_TapeMover_[7] == ___startrek_job_count_TapeMover_[6]); #line 1 __VERIFIER_assume(_i___startrek_job_count_TapeMover_[6] == ___startrek_job_count_TapeMover_[5]); #line 1 __VERIFIER_assume(_i___startrek_job_count_TapeMover_[5] == ___startrek_job_count_TapeMover_[4]); #line 1 __VERIFIER_assume(_i___startrek_job_count_TapeMover_[4] == ___startrek_job_count_TapeMover_[3]); #line 1 __VERIFIER_assume(_i___startrek_job_count_TapeMover_[3] == ___startrek_job_count_TapeMover_[2]); #line 1 __VERIFIER_assume(_i___startrek_job_count_TapeMover_[2] == ___startrek_job_count_TapeMover_[1]); #line 1 __VERIFIER_assume(_i___startrek_job_count_TapeMover_[1] == ___startrek_job_count_TapeMover_[0]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Controller_[27] == ___startrek_job_count_Controller_[26]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Controller_[26] == ___startrek_job_count_Controller_[25]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Controller_[25] == ___startrek_job_count_Controller_[24]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Controller_[24] == ___startrek_job_count_Controller_[23]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Controller_[23] == ___startrek_job_count_Controller_[22]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Controller_[22] == ___startrek_job_count_Controller_[21]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Controller_[21] == ___startrek_job_count_Controller_[20]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Controller_[20] == ___startrek_job_count_Controller_[19]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Controller_[19] == ___startrek_job_count_Controller_[18]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Controller_[18] == ___startrek_job_count_Controller_[17]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Controller_[17] == ___startrek_job_count_Controller_[16]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Controller_[16] == ___startrek_job_count_Controller_[15]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Controller_[15] == ___startrek_job_count_Controller_[14]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Controller_[14] == ___startrek_job_count_Controller_[13]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Controller_[13] == ___startrek_job_count_Controller_[12]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Controller_[12] == ___startrek_job_count_Controller_[11]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Controller_[11] == ___startrek_job_count_Controller_[10]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Controller_[10] == ___startrek_job_count_Controller_[9]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Controller_[9] == ___startrek_job_count_Controller_[8]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Controller_[8] == ___startrek_job_count_Controller_[7]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Controller_[7] == ___startrek_job_count_Controller_[6]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Controller_[6] == ___startrek_job_count_Controller_[5]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Controller_[5] == ___startrek_job_count_Controller_[4]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Controller_[4] == ___startrek_job_count_Controller_[3]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Controller_[3] == ___startrek_job_count_Controller_[2]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Controller_[2] == ___startrek_job_count_Controller_[1]); #line 1 __VERIFIER_assume(_i___startrek_job_count_Controller_[1] == ___startrek_job_count_Controller_[0]); #line 1 __VERIFIER_assume(_i_T_state_[27] == _T_state_[26]); #line 1 __VERIFIER_assume(_i_T_state_[26] == _T_state_[25]); #line 1 __VERIFIER_assume(_i_T_state_[25] == _T_state_[24]); #line 1 __VERIFIER_assume(_i_T_state_[24] == _T_state_[23]); #line 1 __VERIFIER_assume(_i_T_state_[23] == _T_state_[22]); #line 1 __VERIFIER_assume(_i_T_state_[22] == _T_state_[21]); #line 1 __VERIFIER_assume(_i_T_state_[21] == _T_state_[20]); #line 1 __VERIFIER_assume(_i_T_state_[20] == _T_state_[19]); #line 1 __VERIFIER_assume(_i_T_state_[19] == _T_state_[18]); #line 1 __VERIFIER_assume(_i_T_state_[18] == _T_state_[17]); #line 1 __VERIFIER_assume(_i_T_state_[17] == _T_state_[16]); #line 1 __VERIFIER_assume(_i_T_state_[16] == _T_state_[15]); #line 1 __VERIFIER_assume(_i_T_state_[15] == _T_state_[14]); #line 1 __VERIFIER_assume(_i_T_state_[14] == _T_state_[13]); #line 1 __VERIFIER_assume(_i_T_state_[13] == _T_state_[12]); #line 1 __VERIFIER_assume(_i_T_state_[12] == _T_state_[11]); #line 1 __VERIFIER_assume(_i_T_state_[11] == _T_state_[10]); #line 1 __VERIFIER_assume(_i_T_state_[10] == _T_state_[9]); #line 1 __VERIFIER_assume(_i_T_state_[9] == _T_state_[8]); #line 1 __VERIFIER_assume(_i_T_state_[8] == _T_state_[7]); #line 1 __VERIFIER_assume(_i_T_state_[7] == _T_state_[6]); #line 1 __VERIFIER_assume(_i_T_state_[6] == _T_state_[5]); #line 1 __VERIFIER_assume(_i_T_state_[5] == _T_state_[4]); #line 1 __VERIFIER_assume(_i_T_state_[4] == _T_state_[3]); #line 1 __VERIFIER_assume(_i_T_state_[3] == _T_state_[2]); #line 1 __VERIFIER_assume(_i_T_state_[2] == _T_state_[1]); #line 1 __VERIFIER_assume(_i_T_state_[1] == _T_state_[0]); #line 1 __VERIFIER_assume(_i_W_state_[27] == _W_state_[26]); #line 1 __VERIFIER_assume(_i_W_state_[26] == _W_state_[25]); #line 1 __VERIFIER_assume(_i_W_state_[25] == _W_state_[24]); #line 1 __VERIFIER_assume(_i_W_state_[24] == _W_state_[23]); #line 1 __VERIFIER_assume(_i_W_state_[23] == _W_state_[22]); #line 1 __VERIFIER_assume(_i_W_state_[22] == _W_state_[21]); #line 1 __VERIFIER_assume(_i_W_state_[21] == _W_state_[20]); #line 1 __VERIFIER_assume(_i_W_state_[20] == _W_state_[19]); #line 1 __VERIFIER_assume(_i_W_state_[19] == _W_state_[18]); #line 1 __VERIFIER_assume(_i_W_state_[18] == _W_state_[17]); #line 1 __VERIFIER_assume(_i_W_state_[17] == _W_state_[16]); #line 1 __VERIFIER_assume(_i_W_state_[16] == _W_state_[15]); #line 1 __VERIFIER_assume(_i_W_state_[15] == _W_state_[14]); #line 1 __VERIFIER_assume(_i_W_state_[14] == _W_state_[13]); #line 1 __VERIFIER_assume(_i_W_state_[13] == _W_state_[12]); #line 1 __VERIFIER_assume(_i_W_state_[12] == _W_state_[11]); #line 1 __VERIFIER_assume(_i_W_state_[11] == _W_state_[10]); #line 1 __VERIFIER_assume(_i_W_state_[10] == _W_state_[9]); #line 1 __VERIFIER_assume(_i_W_state_[9] == _W_state_[8]); #line 1 __VERIFIER_assume(_i_W_state_[8] == _W_state_[7]); #line 1 __VERIFIER_assume(_i_W_state_[7] == _W_state_[6]); #line 1 __VERIFIER_assume(_i_W_state_[6] == _W_state_[5]); #line 1 __VERIFIER_assume(_i_W_state_[5] == _W_state_[4]); #line 1 __VERIFIER_assume(_i_W_state_[4] == _W_state_[3]); #line 1 __VERIFIER_assume(_i_W_state_[3] == _W_state_[2]); #line 1 __VERIFIER_assume(_i_W_state_[2] == _W_state_[1]); #line 1 __VERIFIER_assume(_i_W_state_[1] == _W_state_[0]); #line 1 __VERIFIER_assume(_i_R_state_[27] == _R_state_[26]); #line 1 __VERIFIER_assume(_i_R_state_[26] == _R_state_[25]); #line 1 __VERIFIER_assume(_i_R_state_[25] == _R_state_[24]); #line 1 __VERIFIER_assume(_i_R_state_[24] == _R_state_[23]); #line 1 __VERIFIER_assume(_i_R_state_[23] == _R_state_[22]); #line 1 __VERIFIER_assume(_i_R_state_[22] == _R_state_[21]); #line 1 __VERIFIER_assume(_i_R_state_[21] == _R_state_[20]); #line 1 __VERIFIER_assume(_i_R_state_[20] == _R_state_[19]); #line 1 __VERIFIER_assume(_i_R_state_[19] == _R_state_[18]); #line 1 __VERIFIER_assume(_i_R_state_[18] == _R_state_[17]); #line 1 __VERIFIER_assume(_i_R_state_[17] == _R_state_[16]); #line 1 __VERIFIER_assume(_i_R_state_[16] == _R_state_[15]); #line 1 __VERIFIER_assume(_i_R_state_[15] == _R_state_[14]); #line 1 __VERIFIER_assume(_i_R_state_[14] == _R_state_[13]); #line 1 __VERIFIER_assume(_i_R_state_[13] == _R_state_[12]); #line 1 __VERIFIER_assume(_i_R_state_[12] == _R_state_[11]); #line 1 __VERIFIER_assume(_i_R_state_[11] == _R_state_[10]); #line 1 __VERIFIER_assume(_i_R_state_[10] == _R_state_[9]); #line 1 __VERIFIER_assume(_i_R_state_[9] == _R_state_[8]); #line 1 __VERIFIER_assume(_i_R_state_[8] == _R_state_[7]); #line 1 __VERIFIER_assume(_i_R_state_[7] == _R_state_[6]); #line 1 __VERIFIER_assume(_i_R_state_[6] == _R_state_[5]); #line 1 __VERIFIER_assume(_i_R_state_[5] == _R_state_[4]); #line 1 __VERIFIER_assume(_i_R_state_[4] == _R_state_[3]); #line 1 __VERIFIER_assume(_i_R_state_[3] == _R_state_[2]); #line 1 __VERIFIER_assume(_i_R_state_[2] == _R_state_[1]); #line 1 __VERIFIER_assume(_i_R_state_[1] == _R_state_[0]); #line 1 __VERIFIER_assume(_i_threshold_[27] == _threshold_[26]); #line 1 __VERIFIER_assume(_i_threshold_[26] == _threshold_[25]); #line 1 __VERIFIER_assume(_i_threshold_[25] == _threshold_[24]); #line 1 __VERIFIER_assume(_i_threshold_[24] == _threshold_[23]); #line 1 __VERIFIER_assume(_i_threshold_[23] == _threshold_[22]); #line 1 __VERIFIER_assume(_i_threshold_[22] == _threshold_[21]); #line 1 __VERIFIER_assume(_i_threshold_[21] == _threshold_[20]); #line 1 __VERIFIER_assume(_i_threshold_[20] == _threshold_[19]); #line 1 __VERIFIER_assume(_i_threshold_[19] == _threshold_[18]); #line 1 __VERIFIER_assume(_i_threshold_[18] == _threshold_[17]); #line 1 __VERIFIER_assume(_i_threshold_[17] == _threshold_[16]); #line 1 __VERIFIER_assume(_i_threshold_[16] == _threshold_[15]); #line 1 __VERIFIER_assume(_i_threshold_[15] == _threshold_[14]); #line 1 __VERIFIER_assume(_i_threshold_[14] == _threshold_[13]); #line 1 __VERIFIER_assume(_i_threshold_[13] == _threshold_[12]); #line 1 __VERIFIER_assume(_i_threshold_[12] == _threshold_[11]); #line 1 __VERIFIER_assume(_i_threshold_[11] == _threshold_[10]); #line 1 __VERIFIER_assume(_i_threshold_[10] == _threshold_[9]); #line 1 __VERIFIER_assume(_i_threshold_[9] == _threshold_[8]); #line 1 __VERIFIER_assume(_i_threshold_[8] == _threshold_[7]); #line 1 __VERIFIER_assume(_i_threshold_[7] == _threshold_[6]); #line 1 __VERIFIER_assume(_i_threshold_[6] == _threshold_[5]); #line 1 __VERIFIER_assume(_i_threshold_[5] == _threshold_[4]); #line 1 __VERIFIER_assume(_i_threshold_[4] == _threshold_[3]); #line 1 __VERIFIER_assume(_i_threshold_[3] == _threshold_[2]); #line 1 __VERIFIER_assume(_i_threshold_[2] == _threshold_[1]); #line 1 __VERIFIER_assume(_i_threshold_[1] == _threshold_[0]); #line 1 __VERIFIER_assume(_i_need_to_run_nxtbg_[27] == _need_to_run_nxtbg_[26]); #line 1 __VERIFIER_assume(_i_need_to_run_nxtbg_[26] == _need_to_run_nxtbg_[25]); #line 1 __VERIFIER_assume(_i_need_to_run_nxtbg_[25] == _need_to_run_nxtbg_[24]); #line 1 __VERIFIER_assume(_i_need_to_run_nxtbg_[24] == _need_to_run_nxtbg_[23]); #line 1 __VERIFIER_assume(_i_need_to_run_nxtbg_[23] == _need_to_run_nxtbg_[22]); #line 1 __VERIFIER_assume(_i_need_to_run_nxtbg_[22] == _need_to_run_nxtbg_[21]); #line 1 __VERIFIER_assume(_i_need_to_run_nxtbg_[21] == _need_to_run_nxtbg_[20]); #line 1 __VERIFIER_assume(_i_need_to_run_nxtbg_[20] == _need_to_run_nxtbg_[19]); #line 1 __VERIFIER_assume(_i_need_to_run_nxtbg_[19] == _need_to_run_nxtbg_[18]); #line 1 __VERIFIER_assume(_i_need_to_run_nxtbg_[18] == _need_to_run_nxtbg_[17]); #line 1 __VERIFIER_assume(_i_need_to_run_nxtbg_[17] == _need_to_run_nxtbg_[16]); #line 1 __VERIFIER_assume(_i_need_to_run_nxtbg_[16] == _need_to_run_nxtbg_[15]); #line 1 __VERIFIER_assume(_i_need_to_run_nxtbg_[15] == _need_to_run_nxtbg_[14]); #line 1 __VERIFIER_assume(_i_need_to_run_nxtbg_[14] == _need_to_run_nxtbg_[13]); #line 1 __VERIFIER_assume(_i_need_to_run_nxtbg_[13] == _need_to_run_nxtbg_[12]); #line 1 __VERIFIER_assume(_i_need_to_run_nxtbg_[12] == _need_to_run_nxtbg_[11]); #line 1 __VERIFIER_assume(_i_need_to_run_nxtbg_[11] == _need_to_run_nxtbg_[10]); #line 1 __VERIFIER_assume(_i_need_to_run_nxtbg_[10] == _need_to_run_nxtbg_[9]); #line 1 __VERIFIER_assume(_i_need_to_run_nxtbg_[9] == _need_to_run_nxtbg_[8]); #line 1 __VERIFIER_assume(_i_need_to_run_nxtbg_[8] == _need_to_run_nxtbg_[7]); #line 1 __VERIFIER_assume(_i_need_to_run_nxtbg_[7] == _need_to_run_nxtbg_[6]); #line 1 __VERIFIER_assume(_i_need_to_run_nxtbg_[6] == _need_to_run_nxtbg_[5]); #line 1 __VERIFIER_assume(_i_need_to_run_nxtbg_[5] == _need_to_run_nxtbg_[4]); #line 1 __VERIFIER_assume(_i_need_to_run_nxtbg_[4] == _need_to_run_nxtbg_[3]); #line 1 __VERIFIER_assume(_i_need_to_run_nxtbg_[3] == _need_to_run_nxtbg_[2]); #line 1 __VERIFIER_assume(_i_need_to_run_nxtbg_[2] == _need_to_run_nxtbg_[1]); #line 1 __VERIFIER_assume(_i_need_to_run_nxtbg_[1] == _need_to_run_nxtbg_[0]); #line 1 __VERIFIER_assume(_i_need_to_read_[27] == _need_to_read_[26]); #line 1 __VERIFIER_assume(_i_need_to_read_[26] == _need_to_read_[25]); #line 1 __VERIFIER_assume(_i_need_to_read_[25] == _need_to_read_[24]); #line 1 __VERIFIER_assume(_i_need_to_read_[24] == _need_to_read_[23]); #line 1 __VERIFIER_assume(_i_need_to_read_[23] == _need_to_read_[22]); #line 1 __VERIFIER_assume(_i_need_to_read_[22] == _need_to_read_[21]); #line 1 __VERIFIER_assume(_i_need_to_read_[21] == _need_to_read_[20]); #line 1 __VERIFIER_assume(_i_need_to_read_[20] == _need_to_read_[19]); #line 1 __VERIFIER_assume(_i_need_to_read_[19] == _need_to_read_[18]); #line 1 __VERIFIER_assume(_i_need_to_read_[18] == _need_to_read_[17]); #line 1 __VERIFIER_assume(_i_need_to_read_[17] == _need_to_read_[16]); #line 1 __VERIFIER_assume(_i_need_to_read_[16] == _need_to_read_[15]); #line 1 __VERIFIER_assume(_i_need_to_read_[15] == _need_to_read_[14]); #line 1 __VERIFIER_assume(_i_need_to_read_[14] == _need_to_read_[13]); #line 1 __VERIFIER_assume(_i_need_to_read_[13] == _need_to_read_[12]); #line 1 __VERIFIER_assume(_i_need_to_read_[12] == _need_to_read_[11]); #line 1 __VERIFIER_assume(_i_need_to_read_[11] == _need_to_read_[10]); #line 1 __VERIFIER_assume(_i_need_to_read_[10] == _need_to_read_[9]); #line 1 __VERIFIER_assume(_i_need_to_read_[9] == _need_to_read_[8]); #line 1 __VERIFIER_assume(_i_need_to_read_[8] == _need_to_read_[7]); #line 1 __VERIFIER_assume(_i_need_to_read_[7] == _need_to_read_[6]); #line 1 __VERIFIER_assume(_i_need_to_read_[6] == _need_to_read_[5]); #line 1 __VERIFIER_assume(_i_need_to_read_[5] == _need_to_read_[4]); #line 1 __VERIFIER_assume(_i_need_to_read_[4] == _need_to_read_[3]); #line 1 __VERIFIER_assume(_i_need_to_read_[3] == _need_to_read_[2]); #line 1 __VERIFIER_assume(_i_need_to_read_[2] == _need_to_read_[1]); #line 1 __VERIFIER_assume(_i_need_to_read_[1] == _need_to_read_[0]); #line 1 __VERIFIER_assume(_i_dir_[27] == _dir_[26]); #line 1 __VERIFIER_assume(_i_dir_[26] == _dir_[25]); #line 1 __VERIFIER_assume(_i_dir_[25] == _dir_[24]); #line 1 __VERIFIER_assume(_i_dir_[24] == _dir_[23]); #line 1 __VERIFIER_assume(_i_dir_[23] == _dir_[22]); #line 1 __VERIFIER_assume(_i_dir_[22] == _dir_[21]); #line 1 __VERIFIER_assume(_i_dir_[21] == _dir_[20]); #line 1 __VERIFIER_assume(_i_dir_[20] == _dir_[19]); #line 1 __VERIFIER_assume(_i_dir_[19] == _dir_[18]); #line 1 __VERIFIER_assume(_i_dir_[18] == _dir_[17]); #line 1 __VERIFIER_assume(_i_dir_[17] == _dir_[16]); #line 1 __VERIFIER_assume(_i_dir_[16] == _dir_[15]); #line 1 __VERIFIER_assume(_i_dir_[15] == _dir_[14]); #line 1 __VERIFIER_assume(_i_dir_[14] == _dir_[13]); #line 1 __VERIFIER_assume(_i_dir_[13] == _dir_[12]); #line 1 __VERIFIER_assume(_i_dir_[12] == _dir_[11]); #line 1 __VERIFIER_assume(_i_dir_[11] == _dir_[10]); #line 1 __VERIFIER_assume(_i_dir_[10] == _dir_[9]); #line 1 __VERIFIER_assume(_i_dir_[9] == _dir_[8]); #line 1 __VERIFIER_assume(_i_dir_[8] == _dir_[7]); #line 1 __VERIFIER_assume(_i_dir_[7] == _dir_[6]); #line 1 __VERIFIER_assume(_i_dir_[6] == _dir_[5]); #line 1 __VERIFIER_assume(_i_dir_[5] == _dir_[4]); #line 1 __VERIFIER_assume(_i_dir_[4] == _dir_[3]); #line 1 __VERIFIER_assume(_i_dir_[3] == _dir_[2]); #line 1 __VERIFIER_assume(_i_dir_[2] == _dir_[1]); #line 1 __VERIFIER_assume(_i_dir_[1] == _dir_[0]); #line 1 __VERIFIER_assume(_i_output_[27] == _output_[26]); #line 1 __VERIFIER_assume(_i_output_[26] == _output_[25]); #line 1 __VERIFIER_assume(_i_output_[25] == _output_[24]); #line 1 __VERIFIER_assume(_i_output_[24] == _output_[23]); #line 1 __VERIFIER_assume(_i_output_[23] == _output_[22]); #line 1 __VERIFIER_assume(_i_output_[22] == _output_[21]); #line 1 __VERIFIER_assume(_i_output_[21] == _output_[20]); #line 1 __VERIFIER_assume(_i_output_[20] == _output_[19]); #line 1 __VERIFIER_assume(_i_output_[19] == _output_[18]); #line 1 __VERIFIER_assume(_i_output_[18] == _output_[17]); #line 1 __VERIFIER_assume(_i_output_[17] == _output_[16]); #line 1 __VERIFIER_assume(_i_output_[16] == _output_[15]); #line 1 __VERIFIER_assume(_i_output_[15] == _output_[14]); #line 1 __VERIFIER_assume(_i_output_[14] == _output_[13]); #line 1 __VERIFIER_assume(_i_output_[13] == _output_[12]); #line 1 __VERIFIER_assume(_i_output_[12] == _output_[11]); #line 1 __VERIFIER_assume(_i_output_[11] == _output_[10]); #line 1 __VERIFIER_assume(_i_output_[10] == _output_[9]); #line 1 __VERIFIER_assume(_i_output_[9] == _output_[8]); #line 1 __VERIFIER_assume(_i_output_[8] == _output_[7]); #line 1 __VERIFIER_assume(_i_output_[7] == _output_[6]); #line 1 __VERIFIER_assume(_i_output_[6] == _output_[5]); #line 1 __VERIFIER_assume(_i_output_[5] == _output_[4]); #line 1 __VERIFIER_assume(_i_output_[4] == _output_[3]); #line 1 __VERIFIER_assume(_i_output_[3] == _output_[2]); #line 1 __VERIFIER_assume(_i_output_[2] == _output_[1]); #line 1 __VERIFIER_assume(_i_output_[1] == _output_[0]); #line 1 __VERIFIER_assume(_i_input_[27] == _input_[26]); #line 1 __VERIFIER_assume(_i_input_[26] == _input_[25]); #line 1 __VERIFIER_assume(_i_input_[25] == _input_[24]); #line 1 __VERIFIER_assume(_i_input_[24] == _input_[23]); #line 1 __VERIFIER_assume(_i_input_[23] == _input_[22]); #line 1 __VERIFIER_assume(_i_input_[22] == _input_[21]); #line 1 __VERIFIER_assume(_i_input_[21] == _input_[20]); #line 1 __VERIFIER_assume(_i_input_[20] == _input_[19]); #line 1 __VERIFIER_assume(_i_input_[19] == _input_[18]); #line 1 __VERIFIER_assume(_i_input_[18] == _input_[17]); #line 1 __VERIFIER_assume(_i_input_[17] == _input_[16]); #line 1 __VERIFIER_assume(_i_input_[16] == _input_[15]); #line 1 __VERIFIER_assume(_i_input_[15] == _input_[14]); #line 1 __VERIFIER_assume(_i_input_[14] == _input_[13]); #line 1 __VERIFIER_assume(_i_input_[13] == _input_[12]); #line 1 __VERIFIER_assume(_i_input_[12] == _input_[11]); #line 1 __VERIFIER_assume(_i_input_[11] == _input_[10]); #line 1 __VERIFIER_assume(_i_input_[10] == _input_[9]); #line 1 __VERIFIER_assume(_i_input_[9] == _input_[8]); #line 1 __VERIFIER_assume(_i_input_[8] == _input_[7]); #line 1 __VERIFIER_assume(_i_input_[7] == _input_[6]); #line 1 __VERIFIER_assume(_i_input_[6] == _input_[5]); #line 1 __VERIFIER_assume(_i_input_[5] == _input_[4]); #line 1 __VERIFIER_assume(_i_input_[4] == _input_[3]); #line 1 __VERIFIER_assume(_i_input_[3] == _input_[2]); #line 1 __VERIFIER_assume(_i_input_[2] == _input_[1]); #line 1 __VERIFIER_assume(_i_input_[1] == _input_[0]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_mode_[27] == _nxtcolorsensor_mode_[26]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_mode_[26] == _nxtcolorsensor_mode_[25]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_mode_[25] == _nxtcolorsensor_mode_[24]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_mode_[24] == _nxtcolorsensor_mode_[23]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_mode_[23] == _nxtcolorsensor_mode_[22]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_mode_[22] == _nxtcolorsensor_mode_[21]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_mode_[21] == _nxtcolorsensor_mode_[20]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_mode_[20] == _nxtcolorsensor_mode_[19]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_mode_[19] == _nxtcolorsensor_mode_[18]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_mode_[18] == _nxtcolorsensor_mode_[17]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_mode_[17] == _nxtcolorsensor_mode_[16]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_mode_[16] == _nxtcolorsensor_mode_[15]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_mode_[15] == _nxtcolorsensor_mode_[14]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_mode_[14] == _nxtcolorsensor_mode_[13]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_mode_[13] == _nxtcolorsensor_mode_[12]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_mode_[12] == _nxtcolorsensor_mode_[11]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_mode_[11] == _nxtcolorsensor_mode_[10]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_mode_[10] == _nxtcolorsensor_mode_[9]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_mode_[9] == _nxtcolorsensor_mode_[8]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_mode_[8] == _nxtcolorsensor_mode_[7]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_mode_[7] == _nxtcolorsensor_mode_[6]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_mode_[6] == _nxtcolorsensor_mode_[5]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_mode_[5] == _nxtcolorsensor_mode_[4]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_mode_[4] == _nxtcolorsensor_mode_[3]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_mode_[3] == _nxtcolorsensor_mode_[2]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_mode_[2] == _nxtcolorsensor_mode_[1]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_mode_[1] == _nxtcolorsensor_mode_[0]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_data_mode_[27] == _nxtcolorsensor_data_mode_[26]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_data_mode_[26] == _nxtcolorsensor_data_mode_[25]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_data_mode_[25] == _nxtcolorsensor_data_mode_[24]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_data_mode_[24] == _nxtcolorsensor_data_mode_[23]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_data_mode_[23] == _nxtcolorsensor_data_mode_[22]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_data_mode_[22] == _nxtcolorsensor_data_mode_[21]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_data_mode_[21] == _nxtcolorsensor_data_mode_[20]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_data_mode_[20] == _nxtcolorsensor_data_mode_[19]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_data_mode_[19] == _nxtcolorsensor_data_mode_[18]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_data_mode_[18] == _nxtcolorsensor_data_mode_[17]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_data_mode_[17] == _nxtcolorsensor_data_mode_[16]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_data_mode_[16] == _nxtcolorsensor_data_mode_[15]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_data_mode_[15] == _nxtcolorsensor_data_mode_[14]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_data_mode_[14] == _nxtcolorsensor_data_mode_[13]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_data_mode_[13] == _nxtcolorsensor_data_mode_[12]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_data_mode_[12] == _nxtcolorsensor_data_mode_[11]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_data_mode_[11] == _nxtcolorsensor_data_mode_[10]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_data_mode_[10] == _nxtcolorsensor_data_mode_[9]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_data_mode_[9] == _nxtcolorsensor_data_mode_[8]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_data_mode_[8] == _nxtcolorsensor_data_mode_[7]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_data_mode_[7] == _nxtcolorsensor_data_mode_[6]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_data_mode_[6] == _nxtcolorsensor_data_mode_[5]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_data_mode_[5] == _nxtcolorsensor_data_mode_[4]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_data_mode_[4] == _nxtcolorsensor_data_mode_[3]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_data_mode_[3] == _nxtcolorsensor_data_mode_[2]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_data_mode_[2] == _nxtcolorsensor_data_mode_[1]); #line 1 __VERIFIER_assume(_i_nxtcolorsensor_data_mode_[1] == _nxtcolorsensor_data_mode_[0]); #line 1 __VERIFIER_assume(_i_T_speed_[27] == _T_speed_[26]); #line 1 __VERIFIER_assume(_i_T_speed_[26] == _T_speed_[25]); #line 1 __VERIFIER_assume(_i_T_speed_[25] == _T_speed_[24]); #line 1 __VERIFIER_assume(_i_T_speed_[24] == _T_speed_[23]); #line 1 __VERIFIER_assume(_i_T_speed_[23] == _T_speed_[22]); #line 1 __VERIFIER_assume(_i_T_speed_[22] == _T_speed_[21]); #line 1 __VERIFIER_assume(_i_T_speed_[21] == _T_speed_[20]); #line 1 __VERIFIER_assume(_i_T_speed_[20] == _T_speed_[19]); #line 1 __VERIFIER_assume(_i_T_speed_[19] == _T_speed_[18]); #line 1 __VERIFIER_assume(_i_T_speed_[18] == _T_speed_[17]); #line 1 __VERIFIER_assume(_i_T_speed_[17] == _T_speed_[16]); #line 1 __VERIFIER_assume(_i_T_speed_[16] == _T_speed_[15]); #line 1 __VERIFIER_assume(_i_T_speed_[15] == _T_speed_[14]); #line 1 __VERIFIER_assume(_i_T_speed_[14] == _T_speed_[13]); #line 1 __VERIFIER_assume(_i_T_speed_[13] == _T_speed_[12]); #line 1 __VERIFIER_assume(_i_T_speed_[12] == _T_speed_[11]); #line 1 __VERIFIER_assume(_i_T_speed_[11] == _T_speed_[10]); #line 1 __VERIFIER_assume(_i_T_speed_[10] == _T_speed_[9]); #line 1 __VERIFIER_assume(_i_T_speed_[9] == _T_speed_[8]); #line 1 __VERIFIER_assume(_i_T_speed_[8] == _T_speed_[7]); #line 1 __VERIFIER_assume(_i_T_speed_[7] == _T_speed_[6]); #line 1 __VERIFIER_assume(_i_T_speed_[6] == _T_speed_[5]); #line 1 __VERIFIER_assume(_i_T_speed_[5] == _T_speed_[4]); #line 1 __VERIFIER_assume(_i_T_speed_[4] == _T_speed_[3]); #line 1 __VERIFIER_assume(_i_T_speed_[3] == _T_speed_[2]); #line 1 __VERIFIER_assume(_i_T_speed_[2] == _T_speed_[1]); #line 1 __VERIFIER_assume(_i_T_speed_[1] == _T_speed_[0]); #line 1 __VERIFIER_assume(_i_T_count_[27] == _T_count_[26]); #line 1 __VERIFIER_assume(_i_T_count_[26] == _T_count_[25]); #line 1 __VERIFIER_assume(_i_T_count_[25] == _T_count_[24]); #line 1 __VERIFIER_assume(_i_T_count_[24] == _T_count_[23]); #line 1 __VERIFIER_assume(_i_T_count_[23] == _T_count_[22]); #line 1 __VERIFIER_assume(_i_T_count_[22] == _T_count_[21]); #line 1 __VERIFIER_assume(_i_T_count_[21] == _T_count_[20]); #line 1 __VERIFIER_assume(_i_T_count_[20] == _T_count_[19]); #line 1 __VERIFIER_assume(_i_T_count_[19] == _T_count_[18]); #line 1 __VERIFIER_assume(_i_T_count_[18] == _T_count_[17]); #line 1 __VERIFIER_assume(_i_T_count_[17] == _T_count_[16]); #line 1 __VERIFIER_assume(_i_T_count_[16] == _T_count_[15]); #line 1 __VERIFIER_assume(_i_T_count_[15] == _T_count_[14]); #line 1 __VERIFIER_assume(_i_T_count_[14] == _T_count_[13]); #line 1 __VERIFIER_assume(_i_T_count_[13] == _T_count_[12]); #line 1 __VERIFIER_assume(_i_T_count_[12] == _T_count_[11]); #line 1 __VERIFIER_assume(_i_T_count_[11] == _T_count_[10]); #line 1 __VERIFIER_assume(_i_T_count_[10] == _T_count_[9]); #line 1 __VERIFIER_assume(_i_T_count_[9] == _T_count_[8]); #line 1 __VERIFIER_assume(_i_T_count_[8] == _T_count_[7]); #line 1 __VERIFIER_assume(_i_T_count_[7] == _T_count_[6]); #line 1 __VERIFIER_assume(_i_T_count_[6] == _T_count_[5]); #line 1 __VERIFIER_assume(_i_T_count_[5] == _T_count_[4]); #line 1 __VERIFIER_assume(_i_T_count_[4] == _T_count_[3]); #line 1 __VERIFIER_assume(_i_T_count_[3] == _T_count_[2]); #line 1 __VERIFIER_assume(_i_T_count_[2] == _T_count_[1]); #line 1 __VERIFIER_assume(_i_T_count_[1] == _T_count_[0]); #line 1 __VERIFIER_assume(_i_W_speed_[27] == _W_speed_[26]); #line 1 __VERIFIER_assume(_i_W_speed_[26] == _W_speed_[25]); #line 1 __VERIFIER_assume(_i_W_speed_[25] == _W_speed_[24]); #line 1 __VERIFIER_assume(_i_W_speed_[24] == _W_speed_[23]); #line 1 __VERIFIER_assume(_i_W_speed_[23] == _W_speed_[22]); #line 1 __VERIFIER_assume(_i_W_speed_[22] == _W_speed_[21]); #line 1 __VERIFIER_assume(_i_W_speed_[21] == _W_speed_[20]); #line 1 __VERIFIER_assume(_i_W_speed_[20] == _W_speed_[19]); #line 1 __VERIFIER_assume(_i_W_speed_[19] == _W_speed_[18]); #line 1 __VERIFIER_assume(_i_W_speed_[18] == _W_speed_[17]); #line 1 __VERIFIER_assume(_i_W_speed_[17] == _W_speed_[16]); #line 1 __VERIFIER_assume(_i_W_speed_[16] == _W_speed_[15]); #line 1 __VERIFIER_assume(_i_W_speed_[15] == _W_speed_[14]); #line 1 __VERIFIER_assume(_i_W_speed_[14] == _W_speed_[13]); #line 1 __VERIFIER_assume(_i_W_speed_[13] == _W_speed_[12]); #line 1 __VERIFIER_assume(_i_W_speed_[12] == _W_speed_[11]); #line 1 __VERIFIER_assume(_i_W_speed_[11] == _W_speed_[10]); #line 1 __VERIFIER_assume(_i_W_speed_[10] == _W_speed_[9]); #line 1 __VERIFIER_assume(_i_W_speed_[9] == _W_speed_[8]); #line 1 __VERIFIER_assume(_i_W_speed_[8] == _W_speed_[7]); #line 1 __VERIFIER_assume(_i_W_speed_[7] == _W_speed_[6]); #line 1 __VERIFIER_assume(_i_W_speed_[6] == _W_speed_[5]); #line 1 __VERIFIER_assume(_i_W_speed_[5] == _W_speed_[4]); #line 1 __VERIFIER_assume(_i_W_speed_[4] == _W_speed_[3]); #line 1 __VERIFIER_assume(_i_W_speed_[3] == _W_speed_[2]); #line 1 __VERIFIER_assume(_i_W_speed_[2] == _W_speed_[1]); #line 1 __VERIFIER_assume(_i_W_speed_[1] == _W_speed_[0]); #line 1 __VERIFIER_assume(_i_W_count_[27] == _W_count_[26]); #line 1 __VERIFIER_assume(_i_W_count_[26] == _W_count_[25]); #line 1 __VERIFIER_assume(_i_W_count_[25] == _W_count_[24]); #line 1 __VERIFIER_assume(_i_W_count_[24] == _W_count_[23]); #line 1 __VERIFIER_assume(_i_W_count_[23] == _W_count_[22]); #line 1 __VERIFIER_assume(_i_W_count_[22] == _W_count_[21]); #line 1 __VERIFIER_assume(_i_W_count_[21] == _W_count_[20]); #line 1 __VERIFIER_assume(_i_W_count_[20] == _W_count_[19]); #line 1 __VERIFIER_assume(_i_W_count_[19] == _W_count_[18]); #line 1 __VERIFIER_assume(_i_W_count_[18] == _W_count_[17]); #line 1 __VERIFIER_assume(_i_W_count_[17] == _W_count_[16]); #line 1 __VERIFIER_assume(_i_W_count_[16] == _W_count_[15]); #line 1 __VERIFIER_assume(_i_W_count_[15] == _W_count_[14]); #line 1 __VERIFIER_assume(_i_W_count_[14] == _W_count_[13]); #line 1 __VERIFIER_assume(_i_W_count_[13] == _W_count_[12]); #line 1 __VERIFIER_assume(_i_W_count_[12] == _W_count_[11]); #line 1 __VERIFIER_assume(_i_W_count_[11] == _W_count_[10]); #line 1 __VERIFIER_assume(_i_W_count_[10] == _W_count_[9]); #line 1 __VERIFIER_assume(_i_W_count_[9] == _W_count_[8]); #line 1 __VERIFIER_assume(_i_W_count_[8] == _W_count_[7]); #line 1 __VERIFIER_assume(_i_W_count_[7] == _W_count_[6]); #line 1 __VERIFIER_assume(_i_W_count_[6] == _W_count_[5]); #line 1 __VERIFIER_assume(_i_W_count_[5] == _W_count_[4]); #line 1 __VERIFIER_assume(_i_W_count_[4] == _W_count_[3]); #line 1 __VERIFIER_assume(_i_W_count_[3] == _W_count_[2]); #line 1 __VERIFIER_assume(_i_W_count_[2] == _W_count_[1]); #line 1 __VERIFIER_assume(_i_W_count_[1] == _W_count_[0]); #line 1 __VERIFIER_assume(_i_R_speed_[27] == _R_speed_[26]); #line 1 __VERIFIER_assume(_i_R_speed_[26] == _R_speed_[25]); #line 1 __VERIFIER_assume(_i_R_speed_[25] == _R_speed_[24]); #line 1 __VERIFIER_assume(_i_R_speed_[24] == _R_speed_[23]); #line 1 __VERIFIER_assume(_i_R_speed_[23] == _R_speed_[22]); #line 1 __VERIFIER_assume(_i_R_speed_[22] == _R_speed_[21]); #line 1 __VERIFIER_assume(_i_R_speed_[21] == _R_speed_[20]); #line 1 __VERIFIER_assume(_i_R_speed_[20] == _R_speed_[19]); #line 1 __VERIFIER_assume(_i_R_speed_[19] == _R_speed_[18]); #line 1 __VERIFIER_assume(_i_R_speed_[18] == _R_speed_[17]); #line 1 __VERIFIER_assume(_i_R_speed_[17] == _R_speed_[16]); #line 1 __VERIFIER_assume(_i_R_speed_[16] == _R_speed_[15]); #line 1 __VERIFIER_assume(_i_R_speed_[15] == _R_speed_[14]); #line 1 __VERIFIER_assume(_i_R_speed_[14] == _R_speed_[13]); #line 1 __VERIFIER_assume(_i_R_speed_[13] == _R_speed_[12]); #line 1 __VERIFIER_assume(_i_R_speed_[12] == _R_speed_[11]); #line 1 __VERIFIER_assume(_i_R_speed_[11] == _R_speed_[10]); #line 1 __VERIFIER_assume(_i_R_speed_[10] == _R_speed_[9]); #line 1 __VERIFIER_assume(_i_R_speed_[9] == _R_speed_[8]); #line 1 __VERIFIER_assume(_i_R_speed_[8] == _R_speed_[7]); #line 1 __VERIFIER_assume(_i_R_speed_[7] == _R_speed_[6]); #line 1 __VERIFIER_assume(_i_R_speed_[6] == _R_speed_[5]); #line 1 __VERIFIER_assume(_i_R_speed_[5] == _R_speed_[4]); #line 1 __VERIFIER_assume(_i_R_speed_[4] == _R_speed_[3]); #line 1 __VERIFIER_assume(_i_R_speed_[3] == _R_speed_[2]); #line 1 __VERIFIER_assume(_i_R_speed_[2] == _R_speed_[1]); #line 1 __VERIFIER_assume(_i_R_speed_[1] == _R_speed_[0]); #line 1 __VERIFIER_assume(_i_R_count_[27] == _R_count_[26]); #line 1 __VERIFIER_assume(_i_R_count_[26] == _R_count_[25]); #line 1 __VERIFIER_assume(_i_R_count_[25] == _R_count_[24]); #line 1 __VERIFIER_assume(_i_R_count_[24] == _R_count_[23]); #line 1 __VERIFIER_assume(_i_R_count_[23] == _R_count_[22]); #line 1 __VERIFIER_assume(_i_R_count_[22] == _R_count_[21]); #line 1 __VERIFIER_assume(_i_R_count_[21] == _R_count_[20]); #line 1 __VERIFIER_assume(_i_R_count_[20] == _R_count_[19]); #line 1 __VERIFIER_assume(_i_R_count_[19] == _R_count_[18]); #line 1 __VERIFIER_assume(_i_R_count_[18] == _R_count_[17]); #line 1 __VERIFIER_assume(_i_R_count_[17] == _R_count_[16]); #line 1 __VERIFIER_assume(_i_R_count_[16] == _R_count_[15]); #line 1 __VERIFIER_assume(_i_R_count_[15] == _R_count_[14]); #line 1 __VERIFIER_assume(_i_R_count_[14] == _R_count_[13]); #line 1 __VERIFIER_assume(_i_R_count_[13] == _R_count_[12]); #line 1 __VERIFIER_assume(_i_R_count_[12] == _R_count_[11]); #line 1 __VERIFIER_assume(_i_R_count_[11] == _R_count_[10]); #line 1 __VERIFIER_assume(_i_R_count_[10] == _R_count_[9]); #line 1 __VERIFIER_assume(_i_R_count_[9] == _R_count_[8]); #line 1 __VERIFIER_assume(_i_R_count_[8] == _R_count_[7]); #line 1 __VERIFIER_assume(_i_R_count_[7] == _R_count_[6]); #line 1 __VERIFIER_assume(_i_R_count_[6] == _R_count_[5]); #line 1 __VERIFIER_assume(_i_R_count_[5] == _R_count_[4]); #line 1 __VERIFIER_assume(_i_R_count_[4] == _R_count_[3]); #line 1 __VERIFIER_assume(_i_R_count_[3] == _R_count_[2]); #line 1 __VERIFIER_assume(_i_R_count_[2] == _R_count_[1]); #line 1 __VERIFIER_assume(_i_R_count_[1] == _R_count_[0]); #line 1 __VERIFIER_assume(_i___startrek_current_priority_[27] == ___startrek_current_priority_[26]); #line 1 __VERIFIER_assume(_i___startrek_current_priority_[26] == ___startrek_current_priority_[25]); #line 1 __VERIFIER_assume(_i___startrek_current_priority_[25] == ___startrek_current_priority_[24]); #line 1 __VERIFIER_assume(_i___startrek_current_priority_[24] == ___startrek_current_priority_[23]); #line 1 __VERIFIER_assume(_i___startrek_current_priority_[23] == ___startrek_current_priority_[22]); #line 1 __VERIFIER_assume(_i___startrek_current_priority_[22] == ___startrek_current_priority_[21]); #line 1 __VERIFIER_assume(_i___startrek_current_priority_[21] == ___startrek_current_priority_[20]); #line 1 __VERIFIER_assume(_i___startrek_current_priority_[20] == ___startrek_current_priority_[19]); #line 1 __VERIFIER_assume(_i___startrek_current_priority_[19] == ___startrek_current_priority_[18]); #line 1 __VERIFIER_assume(_i___startrek_current_priority_[18] == ___startrek_current_priority_[17]); #line 1 __VERIFIER_assume(_i___startrek_current_priority_[17] == ___startrek_current_priority_[16]); #line 1 __VERIFIER_assume(_i___startrek_current_priority_[16] == ___startrek_current_priority_[15]); #line 1 __VERIFIER_assume(_i___startrek_current_priority_[15] == ___startrek_current_priority_[14]); #line 1 __VERIFIER_assume(_i___startrek_current_priority_[14] == ___startrek_current_priority_[13]); #line 1 __VERIFIER_assume(_i___startrek_current_priority_[13] == ___startrek_current_priority_[12]); #line 1 __VERIFIER_assume(_i___startrek_current_priority_[12] == ___startrek_current_priority_[11]); #line 1 __VERIFIER_assume(_i___startrek_current_priority_[11] == ___startrek_current_priority_[10]); #line 1 __VERIFIER_assume(_i___startrek_current_priority_[10] == ___startrek_current_priority_[9]); #line 1 __VERIFIER_assume(_i___startrek_current_priority_[9] == ___startrek_current_priority_[8]); #line 1 __VERIFIER_assume(_i___startrek_current_priority_[8] == ___startrek_current_priority_[7]); #line 1 __VERIFIER_assume(_i___startrek_current_priority_[7] == ___startrek_current_priority_[6]); #line 1 __VERIFIER_assume(_i___startrek_current_priority_[6] == ___startrek_current_priority_[5]); #line 1 __VERIFIER_assume(_i___startrek_current_priority_[5] == ___startrek_current_priority_[4]); #line 1 __VERIFIER_assume(_i___startrek_current_priority_[4] == ___startrek_current_priority_[3]); #line 1 __VERIFIER_assume(_i___startrek_current_priority_[3] == ___startrek_current_priority_[2]); #line 1 __VERIFIER_assume(_i___startrek_current_priority_[2] == ___startrek_current_priority_[1]); #line 1 __VERIFIER_assume(_i___startrek_current_priority_[1] == ___startrek_current_priority_[0]); } } #line 1 "<compiler builtins>" __inline void __startrek_user_init(void) { { } } #line 1 "<compiler builtins>" __inline void __startrek_user_final(void) { { } } #line 1 "<compiler builtins>" __inline void __startrek_check_assertions(void) { { #line 1 "<startrek builtins>" assert(__startrek_Assert_t3_i0[7]); #line 1 assert(__startrek_Assert_t3_i0[6]); #line 1 assert(__startrek_Assert_t3_i0[5]); #line 1 assert(__startrek_Assert_t3_i0[4]); #line 1 assert(__startrek_Assert_t3_i0[3]); #line 1 assert(__startrek_Assert_t3_i0[2]); #line 1 assert(__startrek_Assert_t3_i0[1]); #line 1 assert(__startrek_Assert_t3_i0[0]); #line 1 assert(__startrek_Assert_t2_i0[7]); #line 1 assert(__startrek_Assert_t2_i0[6]); #line 1 assert(__startrek_Assert_t2_i0[5]); #line 1 assert(__startrek_Assert_t2_i0[4]); #line 1 assert(__startrek_Assert_t2_i0[3]); #line 1 assert(__startrek_Assert_t2_i0[2]); #line 1 assert(__startrek_Assert_t2_i0[1]); #line 1 assert(__startrek_Assert_t2_i0[0]); #line 1 assert(__startrek_Assert_t1_i0[7]); #line 1 assert(__startrek_Assert_t1_i0[6]); #line 1 assert(__startrek_Assert_t1_i0[5]); #line 1 assert(__startrek_Assert_t1_i0[4]); #line 1 assert(__startrek_Assert_t1_i0[3]); #line 1 assert(__startrek_Assert_t1_i0[2]); #line 1 assert(__startrek_Assert_t1_i0[1]); #line 1 assert(__startrek_Assert_t1_i0[0]); #line 1 assert(__startrek_Assert_t0_i0[3]); #line 1 assert(__startrek_Assert_t0_i0[2]); #line 1 assert(__startrek_Assert_t0_i0[1]); #line 1 assert(__startrek_Assert_t0_i0[0]); } } #line 1 "<compiler builtins>" void __main(void) { _Bool c1 ; { #line 1 "<startrek builtins>" __startrek_error_round = 28; #line 1 __startrek_schedule_jobs(); #line 1 __startrek_init_globals(); { { #line 1 __startrek_task = 0; #line 1 __startrek_job = 0; #line 1 __startrek_is_first_cs = 1; #line 1 __startrek_round = __startrek_start_t0[0]; #line 1 if (__startrek_round < __startrek_error_round) { { #line 1 __startrek_job_end = __startrek_end_t0[0]; #line 1 c1 = __startrek_entry_pt_Controller(); #line 1 __startrek_lock = 0; #line 1 __VERIFIER_assume(__startrek_round == __startrek_job_end); } } #line 1 __startrek_job = 1; #line 1 __startrek_is_first_cs = 1; #line 1 __startrek_round = __startrek_start_t0[1]; #line 1 if (__startrek_round < __startrek_error_round) { { #line 1 __startrek_job_end = __startrek_end_t0[1]; #line 1 c1 = __startrek_entry_pt_Controller(); #line 1 __startrek_lock = 0; #line 1 __VERIFIER_assume(__startrek_round == __startrek_job_end); } } #line 1 __startrek_job = 2; #line 1 __startrek_is_first_cs = 1; #line 1 __startrek_round = __startrek_start_t0[2]; #line 1 if (__startrek_round < __startrek_error_round) { { #line 1 __startrek_job_end = __startrek_end_t0[2]; #line 1 c1 = __startrek_entry_pt_Controller(); #line 1 __startrek_lock = 0; #line 1 __VERIFIER_assume(__startrek_round == __startrek_job_end); } } #line 1 __startrek_job = 3; #line 1 __startrek_is_first_cs = 1; #line 1 __startrek_round = __startrek_start_t0[3]; #line 1 if (__startrek_round < __startrek_error_round) { { #line 1 __startrek_job_end = __startrek_end_t0[3]; #line 1 c1 = __startrek_entry_pt_Controller(); #line 1 __startrek_lock = 0; #line 1 __VERIFIER_assume(__startrek_round == __startrek_job_end); } } } { #line 1 __startrek_task = 1; #line 1 __startrek_job = 0; #line 1 __startrek_is_first_cs = 1; #line 1 __startrek_round = __startrek_start_t1[0]; #line 1 if (__startrek_round < __startrek_error_round) { { #line 1 __startrek_job_end = __startrek_end_t1[0]; #line 1 c1 = __startrek_entry_pt_TapeMover(); #line 1 __startrek_lock = 0; #line 1 __VERIFIER_assume(__startrek_round == __startrek_job_end); } } #line 1 __startrek_job = 1; #line 1 __startrek_is_first_cs = 1; #line 1 __startrek_round = __startrek_start_t1[1]; #line 1 if (__startrek_round < __startrek_error_round) { { #line 1 __startrek_job_end = __startrek_end_t1[1]; #line 1 c1 = __startrek_entry_pt_TapeMover(); #line 1 __startrek_lock = 0; #line 1 __VERIFIER_assume(__startrek_round == __startrek_job_end); } } #line 1 __startrek_job = 2; #line 1 __startrek_is_first_cs = 1; #line 1 __startrek_round = __startrek_start_t1[2]; #line 1 if (__startrek_round < __startrek_error_round) { { #line 1 __startrek_job_end = __startrek_end_t1[2]; #line 1 c1 = __startrek_entry_pt_TapeMover(); #line 1 __startrek_lock = 0; #line 1 __VERIFIER_assume(__startrek_round == __startrek_job_end); } } #line 1 __startrek_job = 3; #line 1 __startrek_is_first_cs = 1; #line 1 __startrek_round = __startrek_start_t1[3]; #line 1 if (__startrek_round < __startrek_error_round) { { #line 1 __startrek_job_end = __startrek_end_t1[3]; #line 1 c1 = __startrek_entry_pt_TapeMover(); #line 1 __startrek_lock = 0; #line 1 __VERIFIER_assume(__startrek_round == __startrek_job_end); } } #line 1 __startrek_job = 4; #line 1 __startrek_is_first_cs = 1; #line 1 __startrek_round = __startrek_start_t1[4]; #line 1 if (__startrek_round < __startrek_error_round) { { #line 1 __startrek_job_end = __startrek_end_t1[4]; #line 1 c1 = __startrek_entry_pt_TapeMover(); #line 1 __startrek_lock = 0; #line 1 __VERIFIER_assume(__startrek_round == __startrek_job_end); } } #line 1 __startrek_job = 5; #line 1 __startrek_is_first_cs = 1; #line 1 __startrek_round = __startrek_start_t1[5]; #line 1 if (__startrek_round < __startrek_error_round) { { #line 1 __startrek_job_end = __startrek_end_t1[5]; #line 1 c1 = __startrek_entry_pt_TapeMover(); #line 1 __startrek_lock = 0; #line 1 __VERIFIER_assume(__startrek_round == __startrek_job_end); } } #line 1 __startrek_job = 6; #line 1 __startrek_is_first_cs = 1; #line 1 __startrek_round = __startrek_start_t1[6]; #line 1 if (__startrek_round < __startrek_error_round) { { #line 1 __startrek_job_end = __startrek_end_t1[6]; #line 1 c1 = __startrek_entry_pt_TapeMover(); #line 1 __startrek_lock = 0; #line 1 __VERIFIER_assume(__startrek_round == __startrek_job_end); } } #line 1 __startrek_job = 7; #line 1 __startrek_is_first_cs = 1; #line 1 __startrek_round = __startrek_start_t1[7]; #line 1 if (__startrek_round < __startrek_error_round) { { #line 1 __startrek_job_end = __startrek_end_t1[7]; #line 1 c1 = __startrek_entry_pt_TapeMover(); #line 1 __startrek_lock = 0; #line 1 __VERIFIER_assume(__startrek_round == __startrek_job_end); } } } { #line 1 __startrek_task = 2; #line 1 __startrek_job = 0; #line 1 __startrek_is_first_cs = 1; #line 1 __startrek_round = __startrek_start_t2[0]; #line 1 if (__startrek_round < __startrek_error_round) { { #line 1 __startrek_job_end = __startrek_end_t2[0]; #line 1 c1 = __startrek_entry_pt_Reader(); #line 1 __startrek_lock = 0; #line 1 __VERIFIER_assume(__startrek_round == __startrek_job_end); } } #line 1 __startrek_job = 1; #line 1 __startrek_is_first_cs = 1; #line 1 __startrek_round = __startrek_start_t2[1]; #line 1 if (__startrek_round < __startrek_error_round) { { #line 1 __startrek_job_end = __startrek_end_t2[1]; #line 1 c1 = __startrek_entry_pt_Reader(); #line 1 __startrek_lock = 0; #line 1 __VERIFIER_assume(__startrek_round == __startrek_job_end); } } #line 1 __startrek_job = 2; #line 1 __startrek_is_first_cs = 1; #line 1 __startrek_round = __startrek_start_t2[2]; #line 1 if (__startrek_round < __startrek_error_round) { { #line 1 __startrek_job_end = __startrek_end_t2[2]; #line 1 c1 = __startrek_entry_pt_Reader(); #line 1 __startrek_lock = 0; #line 1 __VERIFIER_assume(__startrek_round == __startrek_job_end); } } #line 1 __startrek_job = 3; #line 1 __startrek_is_first_cs = 1; #line 1 __startrek_round = __startrek_start_t2[3]; #line 1 if (__startrek_round < __startrek_error_round) { { #line 1 __startrek_job_end = __startrek_end_t2[3]; #line 1 c1 = __startrek_entry_pt_Reader(); #line 1 __startrek_lock = 0; #line 1 __VERIFIER_assume(__startrek_round == __startrek_job_end); } } #line 1 __startrek_job = 4; #line 1 __startrek_is_first_cs = 1; #line 1 __startrek_round = __startrek_start_t2[4]; #line 1 if (__startrek_round < __startrek_error_round) { { #line 1 __startrek_job_end = __startrek_end_t2[4]; #line 1 c1 = __startrek_entry_pt_Reader(); #line 1 __startrek_lock = 0; #line 1 __VERIFIER_assume(__startrek_round == __startrek_job_end); } } #line 1 __startrek_job = 5; #line 1 __startrek_is_first_cs = 1; #line 1 __startrek_round = __startrek_start_t2[5]; #line 1 if (__startrek_round < __startrek_error_round) { { #line 1 __startrek_job_end = __startrek_end_t2[5]; #line 1 c1 = __startrek_entry_pt_Reader(); #line 1 __startrek_lock = 0; #line 1 __VERIFIER_assume(__startrek_round == __startrek_job_end); } } #line 1 __startrek_job = 6; #line 1 __startrek_is_first_cs = 1; #line 1 __startrek_round = __startrek_start_t2[6]; #line 1 if (__startrek_round < __startrek_error_round) { { #line 1 __startrek_job_end = __startrek_end_t2[6]; #line 1 c1 = __startrek_entry_pt_Reader(); #line 1 __startrek_lock = 0; #line 1 __VERIFIER_assume(__startrek_round == __startrek_job_end); } } #line 1 __startrek_job = 7; #line 1 __startrek_is_first_cs = 1; #line 1 __startrek_round = __startrek_start_t2[7]; #line 1 if (__startrek_round < __startrek_error_round) { { #line 1 __startrek_job_end = __startrek_end_t2[7]; #line 1 c1 = __startrek_entry_pt_Reader(); #line 1 __startrek_lock = 0; #line 1 __VERIFIER_assume(__startrek_round == __startrek_job_end); } } } { #line 1 __startrek_task = 3; #line 1 __startrek_job = 0; #line 1 __startrek_is_first_cs = 1; #line 1 __startrek_round = __startrek_start_t3[0]; #line 1 if (__startrek_round < __startrek_error_round) { { #line 1 __startrek_job_end = __startrek_end_t3[0]; #line 1 c1 = __startrek_entry_pt_Writer(); #line 1 __startrek_lock = 0; #line 1 __VERIFIER_assume(__startrek_round == __startrek_job_end); } } #line 1 __startrek_job = 1; #line 1 __startrek_is_first_cs = 1; #line 1 __startrek_round = __startrek_start_t3[1]; #line 1 if (__startrek_round < __startrek_error_round) { { #line 1 __startrek_job_end = __startrek_end_t3[1]; #line 1 c1 = __startrek_entry_pt_Writer(); #line 1 __startrek_lock = 0; #line 1 __VERIFIER_assume(__startrek_round == __startrek_job_end); } } #line 1 __startrek_job = 2; #line 1 __startrek_is_first_cs = 1; #line 1 __startrek_round = __startrek_start_t3[2]; #line 1 if (__startrek_round < __startrek_error_round) { { #line 1 __startrek_job_end = __startrek_end_t3[2]; #line 1 c1 = __startrek_entry_pt_Writer(); #line 1 __startrek_lock = 0; #line 1 __VERIFIER_assume(__startrek_round == __startrek_job_end); } } #line 1 __startrek_job = 3; #line 1 __startrek_is_first_cs = 1; #line 1 __startrek_round = __startrek_start_t3[3]; #line 1 if (__startrek_round < __startrek_error_round) { { #line 1 __startrek_job_end = __startrek_end_t3[3]; #line 1 c1 = __startrek_entry_pt_Writer(); #line 1 __startrek_lock = 0; #line 1 __VERIFIER_assume(__startrek_round == __startrek_job_end); } } #line 1 __startrek_job = 4; #line 1 __startrek_is_first_cs = 1; #line 1 __startrek_round = __startrek_start_t3[4]; #line 1 if (__startrek_round < __startrek_error_round) { { #line 1 __startrek_job_end = __startrek_end_t3[4]; #line 1 c1 = __startrek_entry_pt_Writer(); #line 1 __startrek_lock = 0; #line 1 __VERIFIER_assume(__startrek_round == __startrek_job_end); } } #line 1 __startrek_job = 5; #line 1 __startrek_is_first_cs = 1; #line 1 __startrek_round = __startrek_start_t3[5]; #line 1 if (__startrek_round < __startrek_error_round) { { #line 1 __startrek_job_end = __startrek_end_t3[5]; #line 1 c1 = __startrek_entry_pt_Writer(); #line 1 __startrek_lock = 0; #line 1 __VERIFIER_assume(__startrek_round == __startrek_job_end); } } #line 1 __startrek_job = 6; #line 1 __startrek_is_first_cs = 1; #line 1 __startrek_round = __startrek_start_t3[6]; #line 1 if (__startrek_round < __startrek_error_round) { { #line 1 __startrek_job_end = __startrek_end_t3[6]; #line 1 c1 = __startrek_entry_pt_Writer(); #line 1 __startrek_lock = 0; #line 1 __VERIFIER_assume(__startrek_round == __startrek_job_end); } } #line 1 __startrek_job = 7; #line 1 __startrek_is_first_cs = 1; #line 1 __startrek_round = __startrek_start_t3[7]; #line 1 if (__startrek_round < __startrek_error_round) { { #line 1 __startrek_job_end = __startrek_end_t3[7]; #line 1 c1 = __startrek_entry_pt_Writer(); #line 1 __startrek_lock = 0; #line 1 __VERIFIER_assume(__startrek_round == __startrek_job_end); } } } } #line 1 __startrek_round = 28; #line 1 __startrek_check_assumptions(); #line 1 __startrek_check_assertions(); #line 1 if (__startrek_hyper_period == 0) { { #line 1 __startrek_user_final(); } } } } #line 1 "<compiler builtins>" int main(void) { { #line 1 "<startrek builtins>" __startrek_init_shared(); #line 1 __startrek_user_init(); #line 1 __startrek_hyper_period = 0; #line 1 __main(); } } #line 1 "<startrek builtins>" __inline static char __startrek_read___startrek_current_priority(void) { char r1 ; _Bool c2 ; unsigned char or3 ; { #line 1 switch (__startrek_task) { case 0: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t0(); { } } #line 1 break; case 1: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t1(); { } } #line 1 break; case 2: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t2(); { } } #line 1 break; case 3: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t3(); { } } #line 1 break; } #line 1 r1 = ___startrek_current_priority_[__startrek_round]; #line 1 return (r1); } } #line 1 "<startrek builtins>" __inline static int __startrek_read_R_count(void) { int r1 ; _Bool c2 ; unsigned char or3 ; { #line 1 switch (__startrek_task) { case 0: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t0(); { } } #line 1 break; case 1: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t1(); { } } #line 1 break; case 2: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t2(); { } } #line 1 break; case 3: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t3(); { } } #line 1 break; } #line 1 r1 = _R_count_[__startrek_round]; #line 1 return (r1); } } #line 1 "<startrek builtins>" __inline static char __startrek_read_R_speed(void) { char r1 ; _Bool c2 ; unsigned char or3 ; { #line 1 switch (__startrek_task) { case 0: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t0(); { } } #line 1 break; case 1: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t1(); { } } #line 1 break; case 2: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t2(); { } } #line 1 break; case 3: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t3(); { } } #line 1 break; } #line 1 r1 = _R_speed_[__startrek_round]; #line 1 return (r1); } } #line 1 "<startrek builtins>" __inline static int __startrek_read_W_count(void) { int r1 ; _Bool c2 ; unsigned char or3 ; { #line 1 switch (__startrek_task) { case 0: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t0(); { } } #line 1 break; case 1: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t1(); { } } #line 1 break; case 2: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t2(); { } } #line 1 break; case 3: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t3(); { } } #line 1 break; } #line 1 r1 = _W_count_[__startrek_round]; #line 1 return (r1); } } #line 1 "<startrek builtins>" __inline static char __startrek_read_W_speed(void) { char r1 ; _Bool c2 ; unsigned char or3 ; { #line 1 switch (__startrek_task) { case 0: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t0(); { } } #line 1 break; case 1: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t1(); { } } #line 1 break; case 2: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t2(); { } } #line 1 break; case 3: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t3(); { } } #line 1 break; } #line 1 r1 = _W_speed_[__startrek_round]; #line 1 return (r1); } } #line 1 "<startrek builtins>" __inline static int __startrek_read_T_count(void) { int r1 ; _Bool c2 ; unsigned char or3 ; { #line 1 switch (__startrek_task) { case 0: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t0(); { } } #line 1 break; case 1: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t1(); { } } #line 1 break; case 2: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t2(); { } } #line 1 break; case 3: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t3(); { } } #line 1 break; } #line 1 r1 = _T_count_[__startrek_round]; #line 1 return (r1); } } #line 1 "<startrek builtins>" __inline static char __startrek_read_T_speed(void) { char r1 ; _Bool c2 ; unsigned char or3 ; { #line 1 switch (__startrek_task) { case 0: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t0(); { } } #line 1 break; case 1: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t1(); { } } #line 1 break; case 2: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t2(); { } } #line 1 break; case 3: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t3(); { } } #line 1 break; } #line 1 r1 = _T_speed_[__startrek_round]; #line 1 return (r1); } } #line 1 "<startrek builtins>" __inline static unsigned char __startrek_read_nxtcolorsensor_data_mode(void) { unsigned char r1 ; _Bool c2 ; unsigned char or3 ; { #line 1 switch (__startrek_task) { case 0: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t0(); { } } #line 1 break; case 1: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t1(); { } } #line 1 break; case 2: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t2(); { } } #line 1 break; case 3: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t3(); { } } #line 1 break; } #line 1 r1 = _nxtcolorsensor_data_mode_[__startrek_round]; #line 1 return (r1); } } #line 1 "<startrek builtins>" __inline static unsigned char __startrek_read_nxtcolorsensor_mode(void) { unsigned char r1 ; _Bool c2 ; unsigned char or3 ; { #line 1 switch (__startrek_task) { case 0: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t0(); { } } #line 1 break; case 1: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t1(); { } } #line 1 break; case 2: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t2(); { } } #line 1 break; case 3: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t3(); { } } #line 1 break; } #line 1 r1 = _nxtcolorsensor_mode_[__startrek_round]; #line 1 return (r1); } } #line 1 "<startrek builtins>" __inline static _Bool __startrek_read_input(void) { _Bool r1 ; _Bool c2 ; unsigned char or3 ; { #line 1 switch (__startrek_task) { case 0: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t0(); { } } #line 1 break; case 1: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t1(); { } } #line 1 break; case 2: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t2(); { } } #line 1 break; case 3: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t3(); { } } #line 1 break; } #line 1 r1 = _input_[__startrek_round]; #line 1 return (r1); } } #line 1 "<startrek builtins>" __inline static _Bool __startrek_read_output(void) { _Bool r1 ; _Bool c2 ; unsigned char or3 ; { #line 1 switch (__startrek_task) { case 0: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t0(); { } } #line 1 break; case 1: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t1(); { } } #line 1 break; case 2: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t2(); { } } #line 1 break; case 3: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t3(); { } } #line 1 break; } #line 1 r1 = _output_[__startrek_round]; #line 1 return (r1); } } #line 1 "<startrek builtins>" __inline static _Bool __startrek_read_dir(void) { _Bool r1 ; _Bool c2 ; unsigned char or3 ; { #line 1 switch (__startrek_task) { case 0: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t0(); { } } #line 1 break; case 1: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t1(); { } } #line 1 break; case 2: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t2(); { } } #line 1 break; case 3: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t3(); { } } #line 1 break; } #line 1 r1 = _dir_[__startrek_round]; #line 1 return (r1); } } #line 1 "<startrek builtins>" __inline static _Bool __startrek_read_need_to_read(void) { _Bool r1 ; _Bool c2 ; unsigned char or3 ; { #line 1 switch (__startrek_task) { case 0: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t0(); { } } #line 1 break; case 1: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t1(); { } } #line 1 break; case 2: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t2(); { } } #line 1 break; case 3: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t3(); { } } #line 1 break; } #line 1 r1 = _need_to_read_[__startrek_round]; #line 1 return (r1); } } #line 1 "<startrek builtins>" __inline static _Bool __startrek_read_need_to_run_nxtbg(void) { _Bool r1 ; _Bool c2 ; unsigned char or3 ; { #line 1 switch (__startrek_task) { case 0: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t0(); { } } #line 1 break; case 1: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t1(); { } } #line 1 break; case 2: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t2(); { } } #line 1 break; case 3: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t3(); { } } #line 1 break; } #line 1 r1 = _need_to_run_nxtbg_[__startrek_round]; #line 1 return (r1); } } #line 1 "<startrek builtins>" __inline static unsigned short __startrek_read_threshold(void) { unsigned short r1 ; _Bool c2 ; unsigned char or3 ; { #line 1 switch (__startrek_task) { case 0: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t0(); { } } #line 1 break; case 1: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t1(); { } } #line 1 break; case 2: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t2(); { } } #line 1 break; case 3: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t3(); { } } #line 1 break; } #line 1 r1 = _threshold_[__startrek_round]; #line 1 return (r1); } } #line 1 "<startrek builtins>" __inline static unsigned char __startrek_read_R_state(void) { unsigned char r1 ; _Bool c2 ; unsigned char or3 ; { #line 1 switch (__startrek_task) { case 0: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t0(); { } } #line 1 break; case 1: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t1(); { } } #line 1 break; case 2: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t2(); { } } #line 1 break; case 3: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t3(); { } } #line 1 break; } #line 1 r1 = _R_state_[__startrek_round]; #line 1 return (r1); } } #line 1 "<startrek builtins>" __inline static unsigned char __startrek_read_W_state(void) { unsigned char r1 ; _Bool c2 ; unsigned char or3 ; { #line 1 switch (__startrek_task) { case 0: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t0(); { } } #line 1 break; case 1: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t1(); { } } #line 1 break; case 2: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t2(); { } } #line 1 break; case 3: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t3(); { } } #line 1 break; } #line 1 r1 = _W_state_[__startrek_round]; #line 1 return (r1); } } #line 1 "<startrek builtins>" __inline static unsigned char __startrek_read_T_state(void) { unsigned char r1 ; _Bool c2 ; unsigned char or3 ; { #line 1 switch (__startrek_task) { case 0: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t0(); { } } #line 1 break; case 1: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t1(); { } } #line 1 break; case 2: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t2(); { } } #line 1 break; case 3: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t3(); { } } #line 1 break; } #line 1 r1 = _T_state_[__startrek_round]; #line 1 return (r1); } } #line 1 "<startrek builtins>" __inline static char __startrek_read___startrek_job_count_Controller(void) { char r1 ; _Bool c2 ; unsigned char or3 ; { #line 1 switch (__startrek_task) { case 0: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t0(); { } } #line 1 break; case 1: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t1(); { } } #line 1 break; case 2: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t2(); { } } #line 1 break; case 3: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t3(); { } } #line 1 break; } #line 1 r1 = ___startrek_job_count_Controller_[__startrek_round]; #line 1 return (r1); } } #line 1 "<startrek builtins>" __inline static char __startrek_read___startrek_job_count_TapeMover(void) { char r1 ; _Bool c2 ; unsigned char or3 ; { #line 1 switch (__startrek_task) { case 0: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t0(); { } } #line 1 break; case 1: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t1(); { } } #line 1 break; case 2: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t2(); { } } #line 1 break; case 3: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t3(); { } } #line 1 break; } #line 1 r1 = ___startrek_job_count_TapeMover_[__startrek_round]; #line 1 return (r1); } } #line 1 "<startrek builtins>" __inline static char __startrek_read___startrek_job_count_Reader(void) { char r1 ; _Bool c2 ; unsigned char or3 ; { #line 1 switch (__startrek_task) { case 0: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t0(); { } } #line 1 break; case 1: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t1(); { } } #line 1 break; case 2: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t2(); { } } #line 1 break; case 3: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t3(); { } } #line 1 break; } #line 1 r1 = ___startrek_job_count_Reader_[__startrek_round]; #line 1 return (r1); } } #line 1 "<startrek builtins>" __inline static char __startrek_read___startrek_job_count_Writer(void) { char r1 ; _Bool c2 ; unsigned char or3 ; { #line 1 switch (__startrek_task) { case 0: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t0(); { } } #line 1 break; case 1: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t1(); { } } #line 1 break; case 2: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t2(); { } } #line 1 break; case 3: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t3(); { } } #line 1 break; } #line 1 r1 = ___startrek_job_count_Writer_[__startrek_round]; #line 1 return (r1); } } #line 1 "<startrek builtins>" __inline static void __startrek_write___startrek_current_priority(char arg ) { _Bool c2 ; unsigned char or3 ; { #line 1 switch (__startrek_task) { case 0: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t0(); { } } #line 1 break; case 1: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t1(); { } } #line 1 break; case 2: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t2(); { } } #line 1 break; case 3: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t3(); { } } #line 1 break; } #line 1 ___startrek_current_priority_[__startrek_round] = arg; } } #line 1 "<startrek builtins>" __inline static void __startrek_write_R_count(int arg ) { _Bool c2 ; unsigned char or3 ; { #line 1 switch (__startrek_task) { case 0: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t0(); { } } #line 1 break; case 1: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t1(); { } } #line 1 break; case 2: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t2(); { } } #line 1 break; case 3: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t3(); { } } #line 1 break; } #line 1 _R_count_[__startrek_round] = arg; } } #line 1 "<startrek builtins>" __inline static void __startrek_write_R_speed(char arg ) { _Bool c2 ; unsigned char or3 ; { #line 1 switch (__startrek_task) { case 0: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t0(); { } } #line 1 break; case 1: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t1(); { } } #line 1 break; case 2: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t2(); { } } #line 1 break; case 3: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t3(); { } } #line 1 break; } #line 1 _R_speed_[__startrek_round] = arg; } } #line 1 "<startrek builtins>" __inline static void __startrek_write_W_count(int arg ) { _Bool c2 ; unsigned char or3 ; { #line 1 switch (__startrek_task) { case 0: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t0(); { } } #line 1 break; case 1: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t1(); { } } #line 1 break; case 2: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t2(); { } } #line 1 break; case 3: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t3(); { } } #line 1 break; } #line 1 _W_count_[__startrek_round] = arg; } } #line 1 "<startrek builtins>" __inline static void __startrek_write_W_speed(char arg ) { _Bool c2 ; unsigned char or3 ; { #line 1 switch (__startrek_task) { case 0: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t0(); { } } #line 1 break; case 1: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t1(); { } } #line 1 break; case 2: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t2(); { } } #line 1 break; case 3: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t3(); { } } #line 1 break; } #line 1 _W_speed_[__startrek_round] = arg; } } #line 1 "<startrek builtins>" __inline static void __startrek_write_T_count(int arg ) { _Bool c2 ; unsigned char or3 ; { #line 1 switch (__startrek_task) { case 0: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t0(); { } } #line 1 break; case 1: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t1(); { } } #line 1 break; case 2: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t2(); { } } #line 1 break; case 3: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t3(); { } } #line 1 break; } #line 1 _T_count_[__startrek_round] = arg; } } #line 1 "<startrek builtins>" __inline static void __startrek_write_T_speed(char arg ) { _Bool c2 ; unsigned char or3 ; { #line 1 switch (__startrek_task) { case 0: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t0(); { } } #line 1 break; case 1: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t1(); { } } #line 1 break; case 2: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t2(); { } } #line 1 break; case 3: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t3(); { } } #line 1 break; } #line 1 _T_speed_[__startrek_round] = arg; } } #line 1 "<startrek builtins>" __inline static void __startrek_write_nxtcolorsensor_data_mode(unsigned char arg ) { _Bool c2 ; unsigned char or3 ; { #line 1 switch (__startrek_task) { case 0: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t0(); { } } #line 1 break; case 1: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t1(); { } } #line 1 break; case 2: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t2(); { } } #line 1 break; case 3: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t3(); { } } #line 1 break; } #line 1 _nxtcolorsensor_data_mode_[__startrek_round] = arg; } } #line 1 "<startrek builtins>" __inline static void __startrek_write_nxtcolorsensor_mode(unsigned char arg ) { _Bool c2 ; unsigned char or3 ; { #line 1 switch (__startrek_task) { case 0: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t0(); { } } #line 1 break; case 1: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t1(); { } } #line 1 break; case 2: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t2(); { } } #line 1 break; case 3: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t3(); { } } #line 1 break; } #line 1 _nxtcolorsensor_mode_[__startrek_round] = arg; } } #line 1 "<startrek builtins>" __inline static void __startrek_write_input(_Bool arg ) { _Bool c2 ; unsigned char or3 ; { #line 1 switch (__startrek_task) { case 0: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t0(); { } } #line 1 break; case 1: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t1(); { } } #line 1 break; case 2: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t2(); { } } #line 1 break; case 3: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t3(); { } } #line 1 break; } #line 1 _input_[__startrek_round] = arg; } } #line 1 "<startrek builtins>" __inline static void __startrek_write_output(_Bool arg ) { _Bool c2 ; unsigned char or3 ; { #line 1 switch (__startrek_task) { case 0: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t0(); { } } #line 1 break; case 1: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t1(); { } } #line 1 break; case 2: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t2(); { } } #line 1 break; case 3: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t3(); { } } #line 1 break; } #line 1 _output_[__startrek_round] = arg; } } #line 1 "<startrek builtins>" __inline static void __startrek_write_dir(_Bool arg ) { _Bool c2 ; unsigned char or3 ; { #line 1 switch (__startrek_task) { case 0: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t0(); { } } #line 1 break; case 1: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t1(); { } } #line 1 break; case 2: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t2(); { } } #line 1 break; case 3: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t3(); { } } #line 1 break; } #line 1 _dir_[__startrek_round] = arg; } } #line 1 "<startrek builtins>" __inline static void __startrek_write_need_to_read(_Bool arg ) { _Bool c2 ; unsigned char or3 ; { #line 1 switch (__startrek_task) { case 0: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t0(); { } } #line 1 break; case 1: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t1(); { } } #line 1 break; case 2: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t2(); { } } #line 1 break; case 3: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t3(); { } } #line 1 break; } #line 1 _need_to_read_[__startrek_round] = arg; } } #line 1 "<startrek builtins>" __inline static void __startrek_write_need_to_run_nxtbg(_Bool arg ) { _Bool c2 ; unsigned char or3 ; { #line 1 switch (__startrek_task) { case 0: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t0(); { } } #line 1 break; case 1: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t1(); { } } #line 1 break; case 2: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t2(); { } } #line 1 break; case 3: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t3(); { } } #line 1 break; } #line 1 _need_to_run_nxtbg_[__startrek_round] = arg; } } #line 1 "<startrek builtins>" __inline static void __startrek_write_threshold(unsigned short arg ) { _Bool c2 ; unsigned char or3 ; { #line 1 switch (__startrek_task) { case 0: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t0(); { } } #line 1 break; case 1: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t1(); { } } #line 1 break; case 2: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t2(); { } } #line 1 break; case 3: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t3(); { } } #line 1 break; } #line 1 _threshold_[__startrek_round] = arg; } } #line 1 "<startrek builtins>" __inline static void __startrek_write_R_state(unsigned char arg ) { _Bool c2 ; unsigned char or3 ; { #line 1 switch (__startrek_task) { case 0: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t0(); { } } #line 1 break; case 1: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t1(); { } } #line 1 break; case 2: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t2(); { } } #line 1 break; case 3: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t3(); { } } #line 1 break; } #line 1 _R_state_[__startrek_round] = arg; } } #line 1 "<startrek builtins>" __inline static void __startrek_write_W_state(unsigned char arg ) { _Bool c2 ; unsigned char or3 ; { #line 1 switch (__startrek_task) { case 0: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t0(); { } } #line 1 break; case 1: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t1(); { } } #line 1 break; case 2: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t2(); { } } #line 1 break; case 3: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t3(); { } } #line 1 break; } #line 1 _W_state_[__startrek_round] = arg; } } #line 1 "<startrek builtins>" __inline static void __startrek_write_T_state(unsigned char arg ) { _Bool c2 ; unsigned char or3 ; { #line 1 switch (__startrek_task) { case 0: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t0(); { } } #line 1 break; case 1: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t1(); { } } #line 1 break; case 2: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t2(); { } } #line 1 break; case 3: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t3(); { } } #line 1 break; } #line 1 _T_state_[__startrek_round] = arg; } } #line 1 "<startrek builtins>" __inline static void __startrek_write___startrek_job_count_Controller(char arg ) { _Bool c2 ; unsigned char or3 ; { #line 1 switch (__startrek_task) { case 0: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t0(); { } } #line 1 break; case 1: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t1(); { } } #line 1 break; case 2: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t2(); { } } #line 1 break; case 3: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t3(); { } } #line 1 break; } #line 1 ___startrek_job_count_Controller_[__startrek_round] = arg; } } #line 1 "<startrek builtins>" __inline static void __startrek_write___startrek_job_count_TapeMover(char arg ) { _Bool c2 ; unsigned char or3 ; { #line 1 switch (__startrek_task) { case 0: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t0(); { } } #line 1 break; case 1: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t1(); { } } #line 1 break; case 2: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t2(); { } } #line 1 break; case 3: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t3(); { } } #line 1 break; } #line 1 ___startrek_job_count_TapeMover_[__startrek_round] = arg; } } #line 1 "<startrek builtins>" __inline static void __startrek_write___startrek_job_count_Reader(char arg ) { _Bool c2 ; unsigned char or3 ; { #line 1 switch (__startrek_task) { case 0: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t0(); { } } #line 1 break; case 1: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t1(); { } } #line 1 break; case 2: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t2(); { } } #line 1 break; case 3: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t3(); { } } #line 1 break; } #line 1 ___startrek_job_count_Reader_[__startrek_round] = arg; } } #line 1 "<startrek builtins>" __inline static void __startrek_write___startrek_job_count_Writer(char arg ) { _Bool c2 ; unsigned char or3 ; { #line 1 switch (__startrek_task) { case 0: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t0(); { } } #line 1 break; case 1: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t1(); { } } #line 1 break; case 2: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t2(); { } } #line 1 break; case 3: { #line 1 or3 = __startrek_round; #line 1 c2 = __startrek_cs_t3(); { } } #line 1 break; } #line 1 ___startrek_job_count_Writer_[__startrek_round] = arg; } } #line 1 "<compiler builtins>" __inline void __startrek_init_shared(void) { { #line 1 "<startrek builtins>" ___startrek_job_count_Writer_[0] = __startrek_hidden___startrek_job_count_Writer; #line 1 ___startrek_job_count_Reader_[0] = __startrek_hidden___startrek_job_count_Reader; #line 1 ___startrek_job_count_TapeMover_[0] = __startrek_hidden___startrek_job_count_TapeMover; #line 1 ___startrek_job_count_Controller_[0] = __startrek_hidden___startrek_job_count_Controller; #line 1 _T_state_[0] = __startrek_hidden_T_state; #line 1 _W_state_[0] = __startrek_hidden_W_state; #line 1 _R_state_[0] = __startrek_hidden_R_state; #line 1 _threshold_[0] = __startrek_hidden_threshold; #line 1 _need_to_run_nxtbg_[0] = __startrek_hidden_need_to_run_nxtbg; #line 1 _need_to_read_[0] = __startrek_hidden_need_to_read; #line 1 _dir_[0] = __startrek_hidden_dir; #line 1 _output_[0] = __startrek_hidden_output; #line 1 _input_[0] = __startrek_hidden_input; #line 1 _nxtcolorsensor_mode_[0] = __startrek_hidden_nxtcolorsensor_mode; #line 1 _nxtcolorsensor_data_mode_[0] = __startrek_hidden_nxtcolorsensor_data_mode; #line 1 _T_speed_[0] = __startrek_hidden_T_speed; #line 1 _T_count_[0] = __startrek_hidden_T_count; #line 1 _W_speed_[0] = __startrek_hidden_W_speed; #line 1 _W_count_[0] = __startrek_hidden_W_count; #line 1 _R_speed_[0] = __startrek_hidden_R_speed; #line 1 _R_count_[0] = __startrek_hidden_R_count; #line 1 ___startrek_current_priority_[0] = __startrek_hidden___startrek_current_priority; } }