file
stringlengths
18
26
data
stringlengths
2
1.05M
the_stack_data/106340.c
int main() { int n; printf("Unesite pozitivan ceo broj: "); scanf("%d", &n); int niz[100]; int i; for(i = 0; i < n; i = i + 1) { printf("Unesite ceo broj za %d. element niza: ", i + 1); scanf("%d", &niz[i]); } for(i = 0; i < n; i = i + 1) { int j; for(j = i; j < n; j = j + 1) { if(niz[i] > niz[j]) { int temp; temp = niz[i]; niz[i] = niz[j]; niz[j] = temp; } } } printf("Sortirani niz: "); for(i = 0; i < n; i = i + 1) { printf("%d", niz[i]); if(i == n - 1) { printf("\n"); } else { printf(" "); } } return 0; }
the_stack_data/121406.c
/* Generated by CIL v. 1.7.0 */ /* print_CIL_Input is false */ struct _IO_FILE; struct timeval; extern void signal(int sig , void *func ) ; extern float strtof(char const *str , char const *endptr ) ; typedef struct _IO_FILE FILE; extern int atoi(char const *s ) ; extern double strtod(char const *str , char const *endptr ) ; extern int fclose(void *stream ) ; extern void *fopen(char const *filename , char const *mode ) ; extern void abort() ; extern void exit(int status ) ; extern int raise(int sig ) ; extern int fprintf(struct _IO_FILE *stream , char const *format , ...) ; extern int strcmp(char const *a , char const *b ) ; extern int rand() ; extern unsigned long strtoul(char const *str , char const *endptr , int base ) ; void RandomFunc(unsigned int input[1] , unsigned int output[1] ) ; extern int strncmp(char const *s1 , char const *s2 , unsigned long maxlen ) ; extern int gettimeofday(struct timeval *tv , void *tz , ...) ; extern int printf(char const *format , ...) ; int main(int argc , char *argv[] ) ; void megaInit(void) ; extern unsigned long strlen(char const *s ) ; extern long strtol(char const *str , char const *endptr , int base ) ; extern unsigned long strnlen(char const *s , unsigned long maxlen ) ; extern void *memcpy(void *s1 , void const *s2 , unsigned long size ) ; struct timeval { long tv_sec ; long tv_usec ; }; extern void *malloc(unsigned long size ) ; extern int scanf(char const *format , ...) ; void RandomFunc(unsigned int input[1] , unsigned int output[1] ) { unsigned int state[1] ; unsigned int local1 ; unsigned short copy11 ; { state[0UL] = (input[0UL] + 914778474UL) - 981234615U; local1 = 0UL; while (local1 < input[1UL]) { if (state[0UL] < local1) { if (state[0UL] != local1) { copy11 = *((unsigned short *)(& state[local1]) + 0); *((unsigned short *)(& state[local1]) + 0) = *((unsigned short *)(& state[local1]) + 1); *((unsigned short *)(& state[local1]) + 1) = copy11; } else { state[0UL] = state[local1] + state[local1]; state[0UL] += state[0UL]; } } else { state[0UL] = state[local1] + state[local1]; } local1 ++; } output[0UL] = (state[0UL] + 469123144UL) + 888641092U; } } void megaInit(void) { { } } int main(int argc , char *argv[] ) { unsigned int input[1] ; unsigned int output[1] ; int randomFuns_i5 ; unsigned int randomFuns_value6 ; int randomFuns_main_i7 ; { megaInit(); if (argc != 2) { printf("Call this program with %i arguments\n", 1); exit(-1); } else { } randomFuns_i5 = 0; while (randomFuns_i5 < 1) { randomFuns_value6 = (unsigned int )strtoul(argv[randomFuns_i5 + 1], 0, 10); input[randomFuns_i5] = randomFuns_value6; randomFuns_i5 ++; } RandomFunc(input, output); if (output[0] == 4242424242U) { printf("You win!\n"); } else { } randomFuns_main_i7 = 0; while (randomFuns_main_i7 < 1) { printf("%u\n", output[randomFuns_main_i7]); randomFuns_main_i7 ++; } } }
the_stack_data/1179319.c
/* f2c.h -- Standard Fortran to C header file */ /** barf [ba:rf] 2. "He suggested using FORTRAN, and everybody barfed." - From The Shogakukan DICTIONARY OF NEW ENGLISH (Second edition) */ #ifndef F2C_INCLUDE #define F2C_INCLUDE #include <math.h> #include <stdlib.h> #include <string.h> #include <stdio.h> #include <complex.h> #ifdef complex #undef complex #endif #ifdef I #undef I #endif #if defined(_WIN64) typedef long long BLASLONG; typedef unsigned long long BLASULONG; #else typedef long BLASLONG; typedef unsigned long BLASULONG; #endif #ifdef LAPACK_ILP64 typedef BLASLONG blasint; #if defined(_WIN64) #define blasabs(x) llabs(x) #else #define blasabs(x) labs(x) #endif #else typedef int blasint; #define blasabs(x) abs(x) #endif typedef blasint integer; typedef unsigned int uinteger; typedef char *address; typedef short int shortint; typedef float real; typedef double doublereal; typedef struct { real r, i; } complex; typedef struct { doublereal r, i; } doublecomplex; static inline _Complex float Cf(complex *z) {return z->r + z->i*_Complex_I;} static inline _Complex double Cd(doublecomplex *z) {return z->r + z->i*_Complex_I;} static inline _Complex float * _pCf(complex *z) {return (_Complex float*)z;} static inline _Complex double * _pCd(doublecomplex *z) {return (_Complex double*)z;} #define pCf(z) (*_pCf(z)) #define pCd(z) (*_pCd(z)) typedef int logical; typedef short int shortlogical; typedef char logical1; typedef char integer1; #define TRUE_ (1) #define FALSE_ (0) /* Extern is for use with -E */ #ifndef Extern #define Extern extern #endif /* I/O stuff */ typedef int flag; typedef int ftnlen; typedef int ftnint; /*external read, write*/ typedef struct { flag cierr; ftnint ciunit; flag ciend; char *cifmt; ftnint cirec; } cilist; /*internal read, write*/ typedef struct { flag icierr; char *iciunit; flag iciend; char *icifmt; ftnint icirlen; ftnint icirnum; } icilist; /*open*/ typedef struct { flag oerr; ftnint ounit; char *ofnm; ftnlen ofnmlen; char *osta; char *oacc; char *ofm; ftnint orl; char *oblnk; } olist; /*close*/ typedef struct { flag cerr; ftnint cunit; char *csta; } cllist; /*rewind, backspace, endfile*/ typedef struct { flag aerr; ftnint aunit; } alist; /* inquire */ typedef struct { flag inerr; ftnint inunit; char *infile; ftnlen infilen; ftnint *inex; /*parameters in standard's order*/ ftnint *inopen; ftnint *innum; ftnint *innamed; char *inname; ftnlen innamlen; char *inacc; ftnlen inacclen; char *inseq; ftnlen inseqlen; char *indir; ftnlen indirlen; char *infmt; ftnlen infmtlen; char *inform; ftnint informlen; char *inunf; ftnlen inunflen; ftnint *inrecl; ftnint *innrec; char *inblank; ftnlen inblanklen; } inlist; #define VOID void union Multitype { /* for multiple entry points */ integer1 g; shortint h; integer i; /* longint j; */ real r; doublereal d; complex c; doublecomplex z; }; typedef union Multitype Multitype; struct Vardesc { /* for Namelist */ char *name; char *addr; ftnlen *dims; int type; }; typedef struct Vardesc Vardesc; struct Namelist { char *name; Vardesc **vars; int nvars; }; typedef struct Namelist Namelist; #define abs(x) ((x) >= 0 ? (x) : -(x)) #define dabs(x) (fabs(x)) #define f2cmin(a,b) ((a) <= (b) ? (a) : (b)) #define f2cmax(a,b) ((a) >= (b) ? (a) : (b)) #define dmin(a,b) (f2cmin(a,b)) #define dmax(a,b) (f2cmax(a,b)) #define bit_test(a,b) ((a) >> (b) & 1) #define bit_clear(a,b) ((a) & ~((uinteger)1 << (b))) #define bit_set(a,b) ((a) | ((uinteger)1 << (b))) #define abort_() { sig_die("Fortran abort routine called", 1); } #define c_abs(z) (cabsf(Cf(z))) #define c_cos(R,Z) { pCf(R)=ccos(Cf(Z)); } #define c_div(c, a, b) {pCf(c) = Cf(a)/Cf(b);} #define z_div(c, a, b) {pCd(c) = Cd(a)/Cd(b);} #define c_exp(R, Z) {pCf(R) = cexpf(Cf(Z));} #define c_log(R, Z) {pCf(R) = clogf(Cf(Z));} #define c_sin(R, Z) {pCf(R) = csinf(Cf(Z));} //#define c_sqrt(R, Z) {*(R) = csqrtf(Cf(Z));} #define c_sqrt(R, Z) {pCf(R) = csqrtf(Cf(Z));} #define d_abs(x) (fabs(*(x))) #define d_acos(x) (acos(*(x))) #define d_asin(x) (asin(*(x))) #define d_atan(x) (atan(*(x))) #define d_atn2(x, y) (atan2(*(x),*(y))) #define d_cnjg(R, Z) { pCd(R) = conj(Cd(Z)); } #define r_cnjg(R, Z) { pCf(R) = conj(Cf(Z)); } #define d_cos(x) (cos(*(x))) #define d_cosh(x) (cosh(*(x))) #define d_dim(__a, __b) ( *(__a) > *(__b) ? *(__a) - *(__b) : 0.0 ) #define d_exp(x) (exp(*(x))) #define d_imag(z) (cimag(Cd(z))) #define r_imag(z) (cimag(Cf(z))) #define d_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x))) #define r_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x))) #define d_lg10(x) ( 0.43429448190325182765 * log(*(x)) ) #define r_lg10(x) ( 0.43429448190325182765 * log(*(x)) ) #define d_log(x) (log(*(x))) #define d_mod(x, y) (fmod(*(x), *(y))) #define u_nint(__x) ((__x)>=0 ? floor((__x) + .5) : -floor(.5 - (__x))) #define d_nint(x) u_nint(*(x)) #define u_sign(__a,__b) ((__b) >= 0 ? ((__a) >= 0 ? (__a) : -(__a)) : -((__a) >= 0 ? (__a) : -(__a))) #define d_sign(a,b) u_sign(*(a),*(b)) #define r_sign(a,b) u_sign(*(a),*(b)) #define d_sin(x) (sin(*(x))) #define d_sinh(x) (sinh(*(x))) #define d_sqrt(x) (sqrt(*(x))) #define d_tan(x) (tan(*(x))) #define d_tanh(x) (tanh(*(x))) #define i_abs(x) abs(*(x)) #define i_dnnt(x) ((integer)u_nint(*(x))) #define i_len(s, n) (n) #define i_nint(x) ((integer)u_nint(*(x))) #define i_sign(a,b) ((integer)u_sign((integer)*(a),(integer)*(b))) #define pow_dd(ap, bp) ( pow(*(ap), *(bp))) #define pow_si(B,E) spow_ui(*(B),*(E)) #define pow_ri(B,E) spow_ui(*(B),*(E)) #define pow_di(B,E) dpow_ui(*(B),*(E)) #define pow_zi(p, a, b) {pCd(p) = zpow_ui(Cd(a), *(b));} #define pow_ci(p, a, b) {pCf(p) = cpow_ui(Cf(a), *(b));} #define pow_zz(R,A,B) {pCd(R) = cpow(Cd(A),*(B));} #define s_cat(lpp, rpp, rnp, np, llp) { ftnlen i, nc, ll; char *f__rp, *lp; ll = (llp); lp = (lpp); for(i=0; i < (int)*(np); ++i) { nc = ll; if((rnp)[i] < nc) nc = (rnp)[i]; ll -= nc; f__rp = (rpp)[i]; while(--nc >= 0) *lp++ = *(f__rp)++; } while(--ll >= 0) *lp++ = ' '; } #define s_cmp(a,b,c,d) ((integer)strncmp((a),(b),f2cmin((c),(d)))) #define s_copy(A,B,C,D) { int __i,__m; for (__i=0, __m=f2cmin((C),(D)); __i<__m && (B)[__i] != 0; ++__i) (A)[__i] = (B)[__i]; } #define sig_die(s, kill) { exit(1); } #define s_stop(s, n) {exit(0);} static char junk[] = "\n@(#)LIBF77 VERSION 19990503\n"; #define z_abs(z) (cabs(Cd(z))) #define z_exp(R, Z) {pCd(R) = cexp(Cd(Z));} #define z_sqrt(R, Z) {pCd(R) = csqrt(Cd(Z));} #define myexit_() break; #define mycycle() continue; #define myceiling(w) {ceil(w)} #define myhuge(w) {HUGE_VAL} //#define mymaxloc_(w,s,e,n) {if (sizeof(*(w)) == sizeof(double)) dmaxloc_((w),*(s),*(e),n); else dmaxloc_((w),*(s),*(e),n);} #define mymaxloc(w,s,e,n) {dmaxloc_(w,*(s),*(e),n)} /* procedure parameter types for -A and -C++ */ #define F2C_proc_par_types 1 #ifdef __cplusplus typedef logical (*L_fp)(...); #else typedef logical (*L_fp)(); #endif static float spow_ui(float x, integer n) { float pow=1.0; unsigned long int u; if(n != 0) { if(n < 0) n = -n, x = 1/x; for(u = n; ; ) { if(u & 01) pow *= x; if(u >>= 1) x *= x; else break; } } return pow; } static double dpow_ui(double x, integer n) { double pow=1.0; unsigned long int u; if(n != 0) { if(n < 0) n = -n, x = 1/x; for(u = n; ; ) { if(u & 01) pow *= x; if(u >>= 1) x *= x; else break; } } return pow; } static _Complex float cpow_ui(_Complex float x, integer n) { _Complex float pow=1.0; unsigned long int u; if(n != 0) { if(n < 0) n = -n, x = 1/x; for(u = n; ; ) { if(u & 01) pow *= x; if(u >>= 1) x *= x; else break; } } return pow; } static _Complex double zpow_ui(_Complex double x, integer n) { _Complex double pow=1.0; unsigned long int u; if(n != 0) { if(n < 0) n = -n, x = 1/x; for(u = n; ; ) { if(u & 01) pow *= x; if(u >>= 1) x *= x; else break; } } return pow; } static integer pow_ii(integer x, integer n) { integer pow; unsigned long int u; if (n <= 0) { if (n == 0 || x == 1) pow = 1; else if (x != -1) pow = x == 0 ? 1/x : 0; else n = -n; } if ((n > 0) || !(n == 0 || x == 1 || x != -1)) { u = n; for(pow = 1; ; ) { if(u & 01) pow *= x; if(u >>= 1) x *= x; else break; } } return pow; } static integer dmaxloc_(double *w, integer s, integer e, integer *n) { double m; integer i, mi; for(m=w[s-1], mi=s, i=s+1; i<=e; i++) if (w[i-1]>m) mi=i ,m=w[i-1]; return mi-s+1; } static integer smaxloc_(float *w, integer s, integer e, integer *n) { float m; integer i, mi; for(m=w[s-1], mi=s, i=s+1; i<=e; i++) if (w[i-1]>m) mi=i ,m=w[i-1]; return mi-s+1; } static inline void cdotc_(complex *z, integer *n_, complex *x, integer *incx_, complex *y, integer *incy_) { integer n = *n_, incx = *incx_, incy = *incy_, i; _Complex float zdotc = 0.0; if (incx == 1 && incy == 1) { for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */ zdotc += conjf(Cf(&x[i])) * Cf(&y[i]); } } else { for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */ zdotc += conjf(Cf(&x[i*incx])) * Cf(&y[i*incy]); } } pCf(z) = zdotc; } static inline void zdotc_(doublecomplex *z, integer *n_, doublecomplex *x, integer *incx_, doublecomplex *y, integer *incy_) { integer n = *n_, incx = *incx_, incy = *incy_, i; _Complex double zdotc = 0.0; if (incx == 1 && incy == 1) { for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */ zdotc += conj(Cd(&x[i])) * Cd(&y[i]); } } else { for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */ zdotc += conj(Cd(&x[i*incx])) * Cd(&y[i*incy]); } } pCd(z) = zdotc; } static inline void cdotu_(complex *z, integer *n_, complex *x, integer *incx_, complex *y, integer *incy_) { integer n = *n_, incx = *incx_, incy = *incy_, i; _Complex float zdotc = 0.0; if (incx == 1 && incy == 1) { for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */ zdotc += Cf(&x[i]) * Cf(&y[i]); } } else { for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */ zdotc += Cf(&x[i*incx]) * Cf(&y[i*incy]); } } pCf(z) = zdotc; } static inline void zdotu_(doublecomplex *z, integer *n_, doublecomplex *x, integer *incx_, doublecomplex *y, integer *incy_) { integer n = *n_, incx = *incx_, incy = *incy_, i; _Complex double zdotc = 0.0; if (incx == 1 && incy == 1) { for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */ zdotc += Cd(&x[i]) * Cd(&y[i]); } } else { for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */ zdotc += Cd(&x[i*incx]) * Cd(&y[i*incy]); } } pCd(z) = zdotc; } #endif /* -- translated by f2c (version 20000121). You must link the resulting object file with the libraries: -lf2c -lm (in that order) */ /* > \brief \b CGEBAK */ /* =========== DOCUMENTATION =========== */ /* Online html documentation available at */ /* http://www.netlib.org/lapack/explore-html/ */ /* > \htmlonly */ /* > Download CGEBAK + dependencies */ /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/cgebak. f"> */ /* > [TGZ]</a> */ /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/cgebak. f"> */ /* > [ZIP]</a> */ /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgebak. f"> */ /* > [TXT]</a> */ /* > \endhtmlonly */ /* Definition: */ /* =========== */ /* SUBROUTINE CGEBAK( JOB, SIDE, N, ILO, IHI, SCALE, M, V, LDV, */ /* INFO ) */ /* CHARACTER JOB, SIDE */ /* INTEGER IHI, ILO, INFO, LDV, M, N */ /* REAL SCALE( * ) */ /* COMPLEX V( LDV, * ) */ /* > \par Purpose: */ /* ============= */ /* > */ /* > \verbatim */ /* > */ /* > CGEBAK forms the right or left eigenvectors of a complex general */ /* > matrix by backward transformation on the computed eigenvectors of the */ /* > balanced matrix output by CGEBAL. */ /* > \endverbatim */ /* Arguments: */ /* ========== */ /* > \param[in] JOB */ /* > \verbatim */ /* > JOB is CHARACTER*1 */ /* > Specifies the type of backward transformation required: */ /* > = 'N': do nothing, return immediately; */ /* > = 'P': do backward transformation for permutation only; */ /* > = 'S': do backward transformation for scaling only; */ /* > = 'B': do backward transformations for both permutation and */ /* > scaling. */ /* > JOB must be the same as the argument JOB supplied to CGEBAL. */ /* > \endverbatim */ /* > */ /* > \param[in] SIDE */ /* > \verbatim */ /* > SIDE is CHARACTER*1 */ /* > = 'R': V contains right eigenvectors; */ /* > = 'L': V contains left eigenvectors. */ /* > \endverbatim */ /* > */ /* > \param[in] N */ /* > \verbatim */ /* > N is INTEGER */ /* > The number of rows of the matrix V. N >= 0. */ /* > \endverbatim */ /* > */ /* > \param[in] ILO */ /* > \verbatim */ /* > ILO is INTEGER */ /* > \endverbatim */ /* > */ /* > \param[in] IHI */ /* > \verbatim */ /* > IHI is INTEGER */ /* > The integers ILO and IHI determined by CGEBAL. */ /* > 1 <= ILO <= IHI <= N, if N > 0; ILO=1 and IHI=0, if N=0. */ /* > \endverbatim */ /* > */ /* > \param[in] SCALE */ /* > \verbatim */ /* > SCALE is REAL array, dimension (N) */ /* > Details of the permutation and scaling factors, as returned */ /* > by CGEBAL. */ /* > \endverbatim */ /* > */ /* > \param[in] M */ /* > \verbatim */ /* > M is INTEGER */ /* > The number of columns of the matrix V. M >= 0. */ /* > \endverbatim */ /* > */ /* > \param[in,out] V */ /* > \verbatim */ /* > V is COMPLEX array, dimension (LDV,M) */ /* > On entry, the matrix of right or left eigenvectors to be */ /* > transformed, as returned by CHSEIN or CTREVC. */ /* > On exit, V is overwritten by the transformed eigenvectors. */ /* > \endverbatim */ /* > */ /* > \param[in] LDV */ /* > \verbatim */ /* > LDV is INTEGER */ /* > The leading dimension of the array V. LDV >= f2cmax(1,N). */ /* > \endverbatim */ /* > */ /* > \param[out] INFO */ /* > \verbatim */ /* > INFO is INTEGER */ /* > = 0: successful exit */ /* > < 0: if INFO = -i, the i-th argument had an illegal value. */ /* > \endverbatim */ /* Authors: */ /* ======== */ /* > \author Univ. of Tennessee */ /* > \author Univ. of California Berkeley */ /* > \author Univ. of Colorado Denver */ /* > \author NAG Ltd. */ /* > \date December 2016 */ /* > \ingroup complexGEcomputational */ /* ===================================================================== */ /* Subroutine */ int cgebak_(char *job, char *side, integer *n, integer *ilo, integer *ihi, real *scale, integer *m, complex *v, integer *ldv, integer *info) { /* System generated locals */ integer v_dim1, v_offset, i__1; /* Local variables */ integer i__, k; real s; extern logical lsame_(char *, char *); extern /* Subroutine */ int cswap_(integer *, complex *, integer *, complex *, integer *); logical leftv; integer ii; extern /* Subroutine */ int csscal_(integer *, real *, complex *, integer *), xerbla_(char *, integer *, ftnlen); logical rightv; /* -- LAPACK computational routine (version 3.7.0) -- */ /* -- LAPACK is a software package provided by Univ. of Tennessee, -- */ /* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- */ /* December 2016 */ /* ===================================================================== */ /* Decode and Test the input parameters */ /* Parameter adjustments */ --scale; v_dim1 = *ldv; v_offset = 1 + v_dim1 * 1; v -= v_offset; /* Function Body */ rightv = lsame_(side, "R"); leftv = lsame_(side, "L"); *info = 0; if (! lsame_(job, "N") && ! lsame_(job, "P") && ! lsame_(job, "S") && ! lsame_(job, "B")) { *info = -1; } else if (! rightv && ! leftv) { *info = -2; } else if (*n < 0) { *info = -3; } else if (*ilo < 1 || *ilo > f2cmax(1,*n)) { *info = -4; } else if (*ihi < f2cmin(*ilo,*n) || *ihi > *n) { *info = -5; } else if (*m < 0) { *info = -7; } else if (*ldv < f2cmax(1,*n)) { *info = -9; } if (*info != 0) { i__1 = -(*info); xerbla_("CGEBAK", &i__1, (ftnlen)6); return 0; } /* Quick return if possible */ if (*n == 0) { return 0; } if (*m == 0) { return 0; } if (lsame_(job, "N")) { return 0; } if (*ilo == *ihi) { goto L30; } /* Backward balance */ if (lsame_(job, "S") || lsame_(job, "B")) { if (rightv) { i__1 = *ihi; for (i__ = *ilo; i__ <= i__1; ++i__) { s = scale[i__]; csscal_(m, &s, &v[i__ + v_dim1], ldv); /* L10: */ } } if (leftv) { i__1 = *ihi; for (i__ = *ilo; i__ <= i__1; ++i__) { s = 1.f / scale[i__]; csscal_(m, &s, &v[i__ + v_dim1], ldv); /* L20: */ } } } /* Backward permutation */ /* For I = ILO-1 step -1 until 1, */ /* IHI+1 step 1 until N do -- */ L30: if (lsame_(job, "P") || lsame_(job, "B")) { if (rightv) { i__1 = *n; for (ii = 1; ii <= i__1; ++ii) { i__ = ii; if (i__ >= *ilo && i__ <= *ihi) { goto L40; } if (i__ < *ilo) { i__ = *ilo - ii; } k = scale[i__]; if (k == i__) { goto L40; } cswap_(m, &v[i__ + v_dim1], ldv, &v[k + v_dim1], ldv); L40: ; } } if (leftv) { i__1 = *n; for (ii = 1; ii <= i__1; ++ii) { i__ = ii; if (i__ >= *ilo && i__ <= *ihi) { goto L50; } if (i__ < *ilo) { i__ = *ilo - ii; } k = scale[i__]; if (k == i__) { goto L50; } cswap_(m, &v[i__ + v_dim1], ldv, &v[k + v_dim1], ldv); L50: ; } } } return 0; /* End of CGEBAK */ } /* cgebak_ */
the_stack_data/14199230.c
#include <stdio.h> int var = 0; void func1() { var = 10; printf ("func1: %d\n", var); } int main() { var = 5; printf ("main: %d\n", var); func1(); printf ("main: %d\n", var); return 0; }
the_stack_data/70449389.c
/* APPLE LOCAL file 6308664 */ /* { dg-do compile { target i?86-*-darwin* x86_64-*-darwin* } } */ /* { dg-options { -m64 -mfix-and-continue } } */ /* { dg-final { scan-assembler-not " L.*@GOTPCREL" } } */ extern void doit(double x); void test() { doit(16.0); doit(32.0); }
the_stack_data/117327672.c
/***************************************************************************** @file main.c @author Daljeet Singh @date Tuesday, 6 July 2021 @brief NTP client to communicate with a remote NTP server using UDP on port 123 Compiled with gcc version 4.7.2 20121109 (Red Hat 4.7.2-8) (GCC). To compile: $ gcc main.c -o ntpClient.out Usage: $ ./ntpClient.out *******************************************************************************/ #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #define NTP_TIMESTAMP_DELTA 2208988800ull #define LI(packet) (uint8_t) ((packet.li_vn_mode & 0xC0) >> 6) // (li & 11 000 000) >> 6 #define VN(packet) (uint8_t) ((packet.li_vn_mode & 0x38) >> 3) // (vn & 00 111 000) >> 3 #define MODE(packet) (uint8_t) ((packet.li_vn_mode & 0x07) >> 0) // (mode & 00 000 111) >> 0 void error( char* msg ) { perror( msg ); // Print the error message to stderr. exit( 0 ); // Quit the process. } int main( int argc, char* argv[ ] ) { int sockfd, n; // Socket file descriptor and the n return result from writing/reading from the socket. int portno = 123; // NTP UDP port number. char* host_name = "us.pool.ntp.org"; // NTP server host-name. // Structure that defines the 48 byte NTP packet protocol. typedef struct { uint8_t li_vn_mode; // Eight bits. li, vn, and mode. // li. Two bits. Leap indicator. // vn. Three bits. Version number of the protocol. // mode. Three bits. Client will pick mode 3 for client. uint8_t stratum; // Eight bits. Stratum level of the local clock. uint8_t poll; // Eight bits. Maximum interval between successive messages. uint8_t precision; // Eight bits. Precision of the local clock. uint32_t rootDelay; // 32 bits. Total round trip delay time. uint32_t rootDispersion; // 32 bits. Max error aloud from primary clock source. uint32_t refId; // 32 bits. Reference clock identifier. uint32_t refTm_s; // 32 bits. Reference time-stamp seconds. uint32_t refTm_f; // 32 bits. Reference time-stamp fraction of a second. uint32_t origTm_s; // 32 bits. Originate time-stamp seconds. uint32_t origTm_f; // 32 bits. Originate time-stamp fraction of a second. uint32_t rxTm_s; // 32 bits. Received time-stamp seconds. uint32_t rxTm_f; // 32 bits. Received time-stamp fraction of a second. uint32_t txTm_s; // 32 bits and the most important field the client cares about. Transmit time-stamp seconds. uint32_t txTm_f; // 32 bits. Transmit time-stamp fraction of a second. } ntp_packet; // Total: 384 bits or 48 bytes. // Create and zero out the packet. All 48 bytes worth. ntp_packet packet = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; memset( &packet, 0, sizeof( ntp_packet ) ); // Set the first byte's bits to 00,011,011 for li = 0, vn = 3, and mode = 3. The rest will be left set to zero. *( ( char * ) &packet + 0 ) = 0x1b; // Represents 27 in base 10 or 00011011 in base 2. // Create a UDP socket, convert the host-name to an IP address, set the port number, // connect to the server, send the packet, and then read in the return packet. struct sockaddr_in serv_addr; // Server address data structure. struct hostent *server; // Server data structure. sockfd = socket( AF_INET, SOCK_DGRAM, IPPROTO_UDP ); // Create a UDP socket. if ( sockfd < 0 ) error( "ERROR opening socket" ); server = gethostbyname( host_name ); // Convert URL to IP. if ( server == NULL ) error( "ERROR, no such host" ); // Zero out the server address structure. bzero( ( char* ) &serv_addr, sizeof( serv_addr ) ); serv_addr.sin_family = AF_INET; // Copy the server's IP address to the server address structure. bcopy( ( char* )server->h_addr, ( char* ) &serv_addr.sin_addr.s_addr, server->h_length ); // Convert the port number integer to network big-endian style and save it to the server address structure. serv_addr.sin_port = htons( portno ); // Call up the server using its IP address and port number. if ( connect( sockfd, ( struct sockaddr * ) &serv_addr, sizeof( serv_addr) ) < 0 ) error( "ERROR connecting" ); // Send it the NTP packet it wants. If n == -1, it failed. n = write( sockfd, ( char* ) &packet, sizeof( ntp_packet ) ); if ( n < 0 ) error( "ERROR writing to socket" ); // Wait and receive the packet back from the server. If n == -1, it failed. n = read( sockfd, ( char* ) &packet, sizeof( ntp_packet ) ); if ( n < 0 ) error( "ERROR reading from socket" ); // These two fields contain the time-stamp seconds as the packet left the NTP server. // The number of seconds correspond to the seconds passed since 1900. // ntohl() converts the bit/byte order from the network's to host's "endianness". packet.txTm_s = ntohl( packet.txTm_s ); // Time-stamp seconds. packet.txTm_f = ntohl( packet.txTm_f ); // Time-stamp fraction of a second. // Extract the 32 bits that represent the time-stamp seconds (since NTP epoch) from when the packet left the server. // Subtract 70 years worth of seconds from the seconds since 1900. // This leaves the seconds since the UNIX epoch of 1970. // (1900)------------------(1970)**************************************(Time Packet Left the Server) time_t txTm = ( time_t ) ( packet.txTm_s - NTP_TIMESTAMP_DELTA ); // Print the time we got from the server, accounting for local timezone and conversion from UTC time. printf( "Time: %s", ctime( ( const time_t* ) &txTm ) ); return 0; }
the_stack_data/165767345.c
#include<stdio.h> int main() { /* always declare the variables before using them */ int i = 0; // declaration and initialization at the same time printf("\nPrinting numbers using while loop from 0 to 9\n\n"); /* while i is less than 10 */ while(i<10) { printf("%d\n",i); /* Update i so the condition can be met eventually to terminate the loop */ i++; // same as i=i+1; } return 0; }
the_stack_data/65268.c
int g (int i) { return i * 8 + (i & 15); } void f (int *p, int x) { int i; for (i = x; i < 100; i ++) { p[i] = g (i); } } int main (void) { return 0; }
the_stack_data/192329875.c
/* * tsps.c for tsps * by lenormf */ #include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <unistd.h> #include <sys/types.h>// required on certain implementations of socket(2) #include <sys/socket.h> #include <sys/select.h> #include <netinet/in.h> #include <netinet/ip.h> #include <netinet/tcp.h> #include <arpa/inet.h> #include <netdb.h> #include <limits.h> #include <time.h> #include <string.h> #include <ifaddrs.h> #include <net/if.h> #include <errno.h> #include <fcntl.h> // Preprocessor macros #define MAX_PORTS_SCANNED 1024 #define MAX_FILTERED_RETRIES 3 #define MAX_TIMEOUT_READ_MS (200 * 1000) #define MAX_TIMEOUT_FILTER_S 2 #define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x))) #define RAND_UINT16() ((uint16_t)rand() % (USHRT_MAX + 1)) #define RAND_UINT32() ((uint32_t)rand() % UINT_MAX) #define RAND_UINT32_RANGE(f, t) ((uint32_t)(rand() % ((t) - (f)) + (f))) // Logging macros #define LOG_TO_STREAM(s, fmt, va...) fprintf(s, fmt "\n", ##va) #define LOG_WARNING(fmt, va...) LOG_TO_STREAM(stdout, "[WARNING] " fmt, ##va) #define LOG_ERROR(fmt, va...) LOG_TO_STREAM(stderr, "[ERROR] " fmt, ##va) #define VERBOSE_PRINTF(conf, fmt, va...) if ((conf)->verbose) { LOG_TO_STREAM(stdout, fmt, ##va); } // Debugging macros #ifdef DEBUG #define DEBUG_PRINTF(fmt, va...) fprintf(stderr, "[DEBUG] " fmt "\n", ##va) #define DEBUG_PRINT_IPV4(buff) do { \ struct iphdr *p = (struct iphdr*)(buff); \ DEBUG_PRINTF("IPv4 packet:\n" \ "version: %u\n" \ "IHL: %u\n" \ "TOS: %u\n" \ "tot_len: %u\n" \ "id: %u\n" \ "flags: %u\n" \ "frag_off: %u\n" \ "TTL: %u\n" \ "protocol: %u\n" \ "check: %x\n" \ "saddr: %u\n" \ "daddr: %u\n", \ (p)->version, (p)->ihl, (p)->tos, ntohs((p)->tot_len), ntohs((p)->id), (ntohs((p)->frag_off) & 0xC000) >> 12, ntohs((p)->frag_off) & 0x3FFF, (p)->ttl, (p)->protocol, ntohs((p)->check), ntohl((p)->saddr), ntohl((p)->daddr)); \ (void)p; \ } while (0) #define DEBUG_PRINT_TCPV4(buff) do { \ struct tcphdr *p = (struct tcphdr*)(buff); \ DEBUG_PRINTF("TCPv4 packet:\n" \ "source: %u\n" \ "dest: %u\n" \ "seq: %u\n" \ "ack_seq: %u\n" \ "doff: %u\n" \ "fin: %u\n" \ "syn: %u\n" \ "rst: %u\n" \ "psh: %u\n" \ "ack: %u\n" \ "urg: %u\n" \ "window: %u\n" \ "check: %x\n" \ "urg_ptr: %u\n", \ ntohs((p)->source), ntohs((p)->dest), ntohl((p)->seq), ntohl((p)->ack_seq), (p)->doff, (p)->fin, (p)->syn, (p)->rst, (p)->psh, (p)->ack, (p)->urg, ntohs((p)->window), ntohs((p)->check), ntohs((p)->urg_ptr)); \ (void)p; \ } while (0) #else #define DEBUG_PRINTF(_, ...) #define DEBUG_PRINT_IPV4(_) #define DEBUG_PRINT_TCPV4(_) #endif // Types typedef enum { PACKET_IP4, PACKET_TCP4, } ePacketType; typedef enum { FLAG_NULL = 0, FLAG_FIN = 1, FLAG_SYN = 2, FLAG_XSMAS = 4, } eTCPFlags; typedef enum { METHOD_UNKNOWN = -1, METHOD_SYN = 0, METHOD_CONNECT, } eScanMethod; typedef enum { SERVICE_UNKNOWN = -1, SERVICE_SSH2 = 0, } eService; typedef enum { STATUS_UNKNOWN = -1, STATUS_OPEN = 1, STATUS_CLOSED = 2, STATUS_FILTERED = 4, } ePortStatus; typedef enum { STATE_UNKNOWN = -1, STATE_READ, STATE_WRITE, STATE_TIMEOUT, } eFdState; typedef enum { STATE_REACHED_READY, STATE_REACHED_TIMEOUT, STATE_REACHED_ERROR, } eReachedState; typedef struct ports_list_s { uint16_t port; ePortStatus status; eService service; char meta[64]; struct ports_list_s *next; } ports_list_t; typedef struct scan_config_s { int verbose; int no_fingerprint_services; int no_delay; int no_shuffle; unsigned int ports_amount; eScanMethod method; char const *target_address; struct sockaddr *target_sockaddr; char const *iface_name; struct sockaddr *iface_sockaddr; } scan_config_t; struct tcp_pseudo_header_s { uint32_t saddr; uint32_t taddr; uint8_t zero; uint8_t protocol; uint16_t length; }; // Lookup tables static struct { eService service; char const *s; } const ss_ref[] = { {SERVICE_SSH2, "ssh 2.0"}, }; static struct { eService service; char const *req_buffer; size_t req_buffer_sz; char const *rep_fmt; } const service_fingerprints_ref[] = { {SERVICE_SSH2, NULL, 0, "SSH-2.0-OpenSSH_%3s"}, }; static void crafter_tcp4(char*, struct sockaddr*, struct sockaddr*, uint16_t, uint16_t); static void crafter_ip4(char*, struct sockaddr*, struct sockaddr*, uint16_t, uint16_t); static struct { ePacketType type; void (*craft)(char*, struct sockaddr*, struct sockaddr*, uint16_t, uint16_t); } const packet_crafters_ref[] = { {PACKET_IP4, &crafter_ip4}, {PACKET_TCP4, &crafter_tcp4}, }; static int create_raw_socket_tcp(void); static int create_nonblocking_socket_tcp(void); static ePortStatus scanner_syn(int, struct sockaddr*, struct sockaddr*, uint16_t); static ePortStatus scanner_connect(int, struct sockaddr*, struct sockaddr*, uint16_t); static struct { eScanMethod method; int (*socket_creator)(void); char const *str; ePortStatus (*scanner)(int, struct sockaddr*, struct sockaddr*, uint16_t); } const port_scanners_ref[] = { {METHOD_SYN, &create_raw_socket_tcp, "SYN", &scanner_syn}, {METHOD_CONNECT, &create_nonblocking_socket_tcp, "CONNECT", &scanner_connect}, }; // Utils/private functions static ports_list_t *queue_port(ports_list_t **pl, uint16_t port, ePortStatus status, eService service, char const *meta) { // Since we are not going to remove links between calls to queue_port(), // it is safe to keep a static pointer to the tail of the list static ports_list_t *tail; ports_list_t *new; new = malloc(sizeof(ports_list_t)); if (!new) { LOG_ERROR("[QUEUE_PORT] Memory exhausted (malloc returned NULL)"); return NULL; } new->port = port; new->service = service; new->status = status; strncpy(new->meta, meta, ARRAY_SIZE(new->meta)); new->next = NULL; if (!*pl) { *pl = new; tail = new; } else { tail->next = new; tail = new; } return new; } static char const *ps_to_str(ePortStatus st) { static struct { ePortStatus status; char const *s; } const st_ref[] = { {STATUS_UNKNOWN, "unknown"}, {STATUS_OPEN, "open"}, {STATUS_CLOSED, "closed"}, {STATUS_FILTERED, "filtered"}, }; uint32_t i; for (i = 0; i < ARRAY_SIZE(st_ref); i++) { if (st_ref[i].status == st) { return st_ref[i].s; } } return NULL; } static char const *pss_to_str(eService ss) { #if 0 uint32_t i; for (i = 0; i < ARRAY_SIZE(ss_ref); i++) { if (ss_ref[i].service == ss) { return ss_ref[i].s; } } return NULL; #endif if (ss == SERVICE_UNKNOWN) { return "unknown"; } return ss_ref[(int)ss].s; } static struct sockaddr *dn_to_sockaddr(char const *dn) { static struct sockaddr ret; struct addrinfo hints; struct addrinfo *results; bzero(&hints, sizeof(struct addrinfo)); hints.ai_family = AF_INET; hints.ai_socktype = 0; hints.ai_flags = 0; hints.ai_protocol = 0; DEBUG_PRINTF("[DN_TO_SOCKADDR] Resolving address \"%s\"", dn); if (getaddrinfo(dn, NULL, &hints, &results) < 0) { return NULL; } memcpy(&ret, results->ai_addr, sizeof(struct sockaddr)); freeaddrinfo(results); return &ret; } static struct sockaddr *iface_to_sockaddr(char const **iface_name) { static struct sockaddr ret; struct sockaddr *r; struct ifaddrs *ifap; DEBUG_PRINTF("[IFACE_TO_SOCKADDR] Getting the interfaces addresses"); if (getifaddrs(&ifap) < 0) { return NULL; } r = NULL; struct ifaddrs *iface; for (iface = ifap; iface; iface = iface->ifa_next) { // No network address for the given interface if (!iface->ifa_addr) { continue; } if (iface->ifa_addr->sa_family != AF_INET || (iface->ifa_flags & IFF_LOOPBACK) == IFF_LOOPBACK || (iface->ifa_flags & IFF_UP) != IFF_UP) continue; if (*iface_name && strcmp(*iface_name, iface->ifa_name)) continue; DEBUG_PRINTF("[IFACE_TO_SOCKADDR] Interface detected: %s", iface->ifa_name); r = &ret; memcpy(&ret, iface->ifa_addr, sizeof(struct sockaddr)); if (!*iface_name) { *iface_name = strdup(iface->ifa_name); } break; } freeifaddrs(ifap); return r; } static void array_shuffle(uint16_t *a, size_t n) { size_t i; for (i = 0; i < n - 1; i++) { size_t j = i + rand() / (RAND_MAX / (n - i) + 1); uint16_t tmp = a[j]; a[j] = a[i]; a[i] = tmp; } } static uint16_t tcp4_checksum(uint16_t *buffer, int size) { uint64_t cksum; cksum = 0; while (size > 1) { cksum += *buffer++; size -= sizeof(uint16_t); } if (size) { cksum += *(uint16_t*)buffer; } cksum = (cksum >> 16) + (cksum & 0xFFFF); cksum += (cksum >> 16); return (uint16_t)(~cksum); } // Wait for a certain activity type to occur on a socket // Return values: // unknown state passed: -1 // the socket is now in the awaited state: 0 // timeout reached and STATE_TIMEOUT was passed: 0 // an error occured while multiplexing the socket: 1 // timeout reached and STATE_TIMEOUT was NOT passed: 2 static uint8_t await_fd_state(int fd, eFdState state, uint64_t usec) { int r; fd_set fds; struct timeval tv = { .tv_sec = 0, .tv_usec = usec, }; FD_ZERO(&fds); FD_SET(fd, &fds); switch (state) { case STATE_READ: r = select(fd + 1, &fds, NULL, NULL, usec ? &tv : NULL); break; case STATE_WRITE: r = select(fd + 1, NULL, &fds, NULL, usec ? &tv : NULL); break; case STATE_TIMEOUT: r = select(0, NULL, NULL, NULL, &tv); break; default: return 1; } if (r < 0) { LOG_ERROR("[AWAIT_FD_STATE] File descriptor multiplexing error"); return 1; } if (state == STATE_TIMEOUT || FD_ISSET(fd, &fds)) { return 0; } return (usec ? 2 : 1); } static eReachedState await_fd_state_ntries(int fd, eFdState state, uint64_t usec, uint32_t n) { uint32_t j; uint8_t st; for (j = 0; j < n; j++) { st = await_fd_state(fd, state, usec); switch (st) { case 0: break; case 1: DEBUG_PRINTF("[AWAIT_FD_STATE_N] Random error (%d): %s", state, strerror(errno)); return STATE_REACHED_ERROR; case 2: DEBUG_PRINTF("[AWAIT_FD_STATE_N] Timeout reached"); return STATE_REACHED_TIMEOUT; } } return STATE_REACHED_READY; } // Socket creators int create_raw_socket_tcp(void) { int sock; sock = socket(AF_INET, SOCK_RAW, IPPROTO_TCP); if (sock < 0) { return sock; } // Hint the kernel that we will include the headers in the data passed to send() int const one = 1; if (setsockopt(sock, IPPROTO_IP, IP_HDRINCL, &one, sizeof(one)) < 0) { LOG_ERROR("[CREATE_RAW_SOCKET_TCP] Unable to set option \"IP_HDRINCL\" on the socket"); return -1; } return sock; } int create_nonblocking_socket_tcp(void) { int sock; sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (sock < 0) { return sock; } if (fcntl(sock, F_SETFL, O_NONBLOCK) < 0) { LOG_ERROR("[CREATE_NONBLOCKING_SOCKET_TCP] Unable to set option \"O_NONBLOCK\" on the socket"); return -1; } return sock; } // Packet crafters static void crafter_ip4(char *buffer, struct sockaddr *saddr, struct sockaddr *taddr, uint16_t target_protocol, uint16_t options) { struct iphdr *head = (struct iphdr*)buffer; (void)options; head->ihl = 5; head->version = 4; head->tos = 0; head->id = htons(RAND_UINT16()); head->frag_off = htons(0x4000); head->ttl = 0x40; head->protocol = (uint8_t)target_protocol; head->check = htons(0); head->saddr = ((struct sockaddr_in*)saddr)->sin_addr.s_addr; head->daddr = ((struct sockaddr_in*)taddr)->sin_addr.s_addr; switch (target_protocol) { case IPPROTO_TCP: head->tot_len = htons(sizeof(struct iphdr) + sizeof(struct tcphdr)); // Set by the kernel head->check = 0; break; } } static void crafter_tcp4(char *buffer, struct sockaddr *saddr, struct sockaddr *taddr, uint16_t port, uint16_t options) { struct iphdr *iphead; struct tcphdr *tcphead; struct tcp_pseudo_header_s pseudo; packet_crafters_ref[PACKET_IP4].craft(buffer, saddr, taddr, IPPROTO_TCP, 0); iphead = (struct iphdr*)buffer; tcphead = (struct tcphdr*)(buffer + iphead->ihl * sizeof(uint32_t)); tcphead->source = RAND_UINT16(); tcphead->dest = htons(port); tcphead->seq = RAND_UINT32(); tcphead->ack_seq = 0; tcphead->doff = sizeof(struct tcphdr) / sizeof(uint32_t); tcphead->res1 = 0; tcphead->res2 = 0; tcphead->urg = 0; tcphead->ack = 0; tcphead->psh = 0; tcphead->rst = 0; tcphead->syn = 0; tcphead->fin = 0; if ((options & FLAG_FIN) == FLAG_FIN) { tcphead->fin = 1; } else if ((options & FLAG_SYN) == FLAG_SYN) { tcphead->syn = 1; } else if ((options & FLAG_XSMAS) == FLAG_XSMAS) { tcphead->fin = 1; tcphead->psh = 1; tcphead->urg = 1; } tcphead->window = htons(29200); tcphead->check = 0; tcphead->urg_ptr = 0; char buff[sizeof(struct tcp_pseudo_header_s) + sizeof(struct tcphdr)]; pseudo.saddr = iphead->saddr; pseudo.taddr = iphead->daddr; pseudo.zero = 0; pseudo.protocol = iphead->protocol; pseudo.length = htons(sizeof(struct tcphdr)); memcpy(buff, tcphead, sizeof(struct tcphdr)); memcpy(buff + sizeof(struct tcphdr), &pseudo, sizeof(struct tcp_pseudo_header_s)); tcphead->check = tcp4_checksum((uint16_t*)buff, sizeof(struct tcp_pseudo_header_s) + ntohs(pseudo.length)); } // Port scanners static ePortStatus scanner_syn(int sock, struct sockaddr *saddr, struct sockaddr *taddr, uint16_t port) { struct sockaddr_in sin; char packet[128]; time_t time_scan_started; packet_crafters_ref[PACKET_TCP4].craft(packet, saddr, taddr, port, FLAG_SYN); sin.sin_family = AF_INET; sin.sin_port = htons(port); sin.sin_addr.s_addr = ((struct sockaddr_in*)taddr)->sin_addr.s_addr; if (await_fd_state(sock, STATE_WRITE, 0)) { return STATUS_UNKNOWN; } if (sendto(sock, packet, ntohs(((struct iphdr*)packet)->tot_len), 0, (struct sockaddr*)&sin, sizeof(struct sockaddr_in)) < 0) { LOG_ERROR("[SCANNER_SYN] Unable to write to socket"); return STATUS_UNKNOWN; } // XXX DEBUG_PRINTF("[PACKET] Sent packet:"); DEBUG_PRINT_IPV4(packet); DEBUG_PRINT_TCPV4(packet + ((struct iphdr*)packet)->ihl * sizeof(uint32_t)); // FIXME: handle error on time() time_scan_started = time(NULL); char buffer[256]; struct iphdr *iph; struct tcphdr *tcph; while (1) { ssize_t len; struct sockaddr_in addr; socklen_t addr_len; eReachedState rst; time_t actual_time; // FIXME: handle error on time() actual_time = time(NULL); // 2s timeout on a filtered port if (actual_time - time_scan_started >= MAX_TIMEOUT_FILTER_S) { return STATUS_FILTERED; } // XXX DEBUG_PRINTF("Awaiting packet"); rst = await_fd_state_ntries(sock, STATE_READ, MAX_TIMEOUT_READ_MS, MAX_FILTERED_RETRIES); if (rst == STATE_REACHED_TIMEOUT) { return STATUS_FILTERED; } else if (rst == STATE_REACHED_ERROR) { return STATUS_UNKNOWN; } addr_len = sizeof(struct sockaddr_in); len = recvfrom(sock, buffer, ARRAY_SIZE(buffer), 0, (struct sockaddr*)&addr, &addr_len); if (len < 0) { LOG_ERROR("[SCANNER_SYN] Couldn't read from socket"); return STATUS_UNKNOWN; } if ((size_t)len < sizeof(struct iphdr) + sizeof(struct tcphdr)) { DEBUG_PRINTF("[SCANNER_SYN][PACKET] Packet too short to be parsed"); continue; } // XXX DEBUG_PRINTF("[PACKET] Received packet:"); iph = (struct iphdr*)buffer; // XXX DEBUG_PRINT_IPV4(iph); if (iph->protocol != IPPROTO_TCP) { DEBUG_PRINTF("[PACKET] Packet isn't TCP"); continue; } tcph = (struct tcphdr*)(buffer + iph->ihl * sizeof(uint32_t)); // XXX DEBUG_PRINT_TCPV4(tcph); if (ntohs(tcph->source) != port || addr.sin_addr.s_addr != ((struct sockaddr_in*)taddr)->sin_addr.s_addr) { DEBUG_PRINTF("[SCANNER_SYN][PACKET] Different ports/addresses"); continue; } if (tcph->rst == 1) { return STATUS_CLOSED; } break; } return STATUS_OPEN; } static ePortStatus scanner_connect(int sock, struct sockaddr *saddr, struct sockaddr *taddr, uint16_t port) { struct sockaddr_in sin; int connected; socklen_t connected_sz; (void)saddr; sin.sin_family = AF_INET; sin.sin_port = htons(port); sin.sin_addr.s_addr = ((struct sockaddr_in*)taddr)->sin_addr.s_addr; connect(sock, (struct sockaddr*)&sin, sizeof(struct sockaddr)); if (await_fd_state(sock, STATE_WRITE, 0)) { return STATUS_UNKNOWN; } connected_sz = sizeof(int); if (getsockopt(sock, SOL_SOCKET, SO_ERROR, &connected, &connected_sz)) { return STATUS_UNKNOWN; } if (connected) { LOG_ERROR("%s", strerror(connected)); return STATUS_CLOSED; } shutdown(sock, SHUT_RDWR); return STATUS_OPEN; } static ePortStatus scan_port(int sock, uint16_t port, scan_config_t const *conf) { return port_scanners_ref[conf->method].scanner(sock, conf->iface_sockaddr, conf->target_sockaddr, port); } static eService scan_service(struct sockaddr *target, uint16_t port, eScanMethod method, char *meta, size_t meta_sz) { struct sockaddr_in *sin; eService service; unsigned int i; int sock; switch (method) { case METHOD_SYN: case METHOD_CONNECT: sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); break; default: sock = -1; break; } if (sock < 0) { return SERVICE_UNKNOWN; } sin = (struct sockaddr_in*)target; sin->sin_port = htons(port); service = SERVICE_UNKNOWN; if (connect(sock, (struct sockaddr*)sin, sizeof(struct sockaddr)) < 0) { goto exit; } for (i = 0; i < ARRAY_SIZE(service_fingerprints_ref); i++) { char buffer[512]; ssize_t buffer_sz; if (service_fingerprints_ref[i].req_buffer) { await_fd_state(sock, STATE_WRITE, 500); if (send(sock, service_fingerprints_ref[i].req_buffer, service_fingerprints_ref[i].req_buffer_sz, 0) < 0) { goto exit; } } buffer_sz = recv(sock, buffer, ARRAY_SIZE(buffer) - 1, 0); if (buffer_sz < 0) { goto exit; } buffer[buffer_sz] = 0; bzero(meta, meta_sz); if (sscanf(buffer, service_fingerprints_ref[i].rep_fmt, meta) > 0) { service = service_fingerprints_ref[i].service; break; } } exit: close(sock); return service; } static ports_list_t *scan_ports(int sock, scan_config_t const *conf) { ports_list_t *pl; uint16_t *ports; unsigned int i; ports = malloc(conf->ports_amount * sizeof(uint16_t)); if (!ports) { LOG_ERROR("[SCAN_PORTS] Memory exhausted (malloc returned NULL)"); return NULL; } VERBOSE_PRINTF(conf, "Generating the ports list"); // Generate a list of the ports number to be scanned pl = NULL; for (i = 0; i < conf->ports_amount; i++) { ports[i] = i; } // Shuffle the list, if enabled if (!conf->no_shuffle) { DEBUG_PRINTF("[SCAN_PORTS] Shuffling the ports list"); array_shuffle(ports, conf->ports_amount); } VERBOSE_PRINTF(conf, "Scanning started"); for (i = 0; i < conf->ports_amount; i++) { ePortStatus s; eService ss; char meta[64]; DEBUG_PRINTF("[SCAN_PORTS] Scanning port #%u", ports[i]); // Scan the port s = scan_port(sock, ports[i], conf); ss = SERVICE_UNKNOWN; *meta = 0; // If the port is open, try to guess what service runs on it if ((s & STATUS_OPEN) == STATUS_OPEN && !conf->no_fingerprint_services) { ss = scan_service(conf->target_sockaddr, ports[i], conf->method, meta, ARRAY_SIZE(meta)); } // Add the port to the results if (!queue_port(&pl, ports[i], s, ss, meta)) { return NULL; } if (conf->ports_amount > 19 && i && (i % (conf->ports_amount / 5)) == 0) { VERBOSE_PRINTF(conf, "Scanning progress: %d%%", i * 100 / conf->ports_amount); } // Wait for a random amount of time (between 500ms and 3s) if enabled if (!conf->no_delay) { uint32_t delay_usec; delay_usec = RAND_UINT32_RANGE(500, 3000); DEBUG_PRINTF("[SCAN_PORTS] Delay: %uµs", delay_usec); await_fd_state(0, STATE_TIMEOUT, delay_usec * 1000); } } return pl; } static void print_port_stats(ports_list_t const *port, unsigned int *open_ports, unsigned int *closed_ports, unsigned int *unknown_ports, int services_scanned) { char const * const head_fmt = "%7s %9s %s\n"; char const * const entry_fmt = "%7d | %9s unknown\n"; char const * const entry_fmt_open = "%7d | %9s %s [%s]\n"; switch (port->status) { case STATUS_CLOSED: (*closed_ports)++; break; case STATUS_UNKNOWN: (*unknown_ports)++; break; case STATUS_FILTERED: case STATUS_OPEN: if (!*open_ports) { fprintf(stdout, head_fmt, "port", "status", "service"); } (*open_ports)++; if (port->status == STATUS_OPEN && services_scanned) { fprintf(stdout, entry_fmt_open, port->port, ps_to_str(port->status), pss_to_str(port->service), *port->meta ? port->meta : "none"); } else { fprintf(stdout, entry_fmt, port->port, ps_to_str(port->status)); } break; default: break; } } static void print_report(ports_list_t *report, unsigned int list_size, int verbose, int ordered, int services_scanned) { unsigned int closed_ports; unsigned int unknown_ports; unsigned int open_ports; closed_ports = 0; unknown_ports = 0; open_ports = 0; if (!ordered) { uint32_t i; for (i = 0; i < list_size; i++) { ports_list_t const *pl; pl = report; while (pl) { if (i == pl->port) { print_port_stats(pl, &open_ports, &closed_ports, &unknown_ports, services_scanned); break; } pl = pl->next; } } } else { for (; report; report = report->next) { print_port_stats(report, &open_ports, &closed_ports, &unknown_ports, services_scanned); } } if (verbose) { fprintf(stdout, "Amount of ports scanned: %u\n", list_size); fprintf(stdout, "Amount of ports open/filtered: %u\n", open_ports); if (closed_ports) { fprintf(stdout, "Amount of ports closed: %u\n", closed_ports); } if (unknown_ports) { fprintf(stdout, "Couldn't determine the state of %u port%c\n", unknown_ports, unknown_ports <= 1 ? 0 : 's'); } } } static void usage(char const *av) { fprintf(stdout, "Usage: %s [-h | OPTIONS ] <target address>\n", av); fprintf(stdout, "Available options:\n" "\t-v: enable verbose mode (default: disabled)\n" "\t-m <method>: scan method (default: SYN)\n" "\t-f: disable services fingerprinting (default: enabled)\n" "\t-d: disable random delay between ports (default: enabled)\n" "\t-s: disable random scan order of the ports (default: enabled)\n" "\t-n <number>: amount of ports to be scanned (default: 2014)\n" "\t-i <iface>: interface to use (default will be automatically detected)\n"); fprintf(stdout, "Certain scanning methods require superuser privileges, in order to be able to create raw sockets\n"); } static int set_config(int ac, char **av, scan_config_t *conf) { int opt; bzero(conf, sizeof(scan_config_t)); // Handle flags of the command line conf->ports_amount = MAX_PORTS_SCANNED; conf->method = METHOD_SYN; while ((opt = getopt(ac, av, "hvfdsm:n:i:")) != -1) { switch (opt) { case 'h': usage(*av); return 1; case 'v': conf->verbose = 1; break; case 'f': conf->no_fingerprint_services = 1; break; case 'd': conf->no_delay = 1; break; case 's': conf->no_shuffle = 1; break; case 'm': { conf->method = METHOD_UNKNOWN; uint32_t i; for (i = 0; i < ARRAY_SIZE(port_scanners_ref); i++) { if (!strcasecmp(port_scanners_ref[i].str, optarg)) { conf->method = port_scanners_ref[i].method; break; } } if (conf->method == METHOD_UNKNOWN) { LOG_ERROR("[SET_CONFIG] Unsupported scanning method \"%s\"", optarg); return 1; } break; } case 'n': { int n; n = atoi(optarg); if (n > UINT16_MAX + 1) { LOG_ERROR("[SET_CONFIG] Invalid amount of ports: %d", n); return 1; } else if (n == -1) { n = UINT16_MAX + 1; } conf->ports_amount = n; break; } case 'i': { conf->iface_name = strndup(optarg, IFNAMSIZ); break; } default: return 1; } } if (optind >= ac) { LOG_ERROR("[SET_CONFIG] Option parsing error (not enough parameters)"); return 1; } conf->target_address = av[optind]; // Resolve the address of the target machine conf->target_sockaddr = dn_to_sockaddr(conf->target_address); if (!conf->target_sockaddr) { LOG_ERROR("[SET_CONFIG] Unable to resolve address"); return 1; } // If an interface was provided, get its address // Otherwise, grab the first available interface conf->iface_sockaddr = iface_to_sockaddr(&conf->iface_name); if (!conf->iface_sockaddr) { LOG_ERROR("[SET_CONFIG] Unable to get the interface's address"); return 1; } return 0; } // Entry point int main(int ac, char **av) { int sock; scan_config_t conf; ports_list_t *report; if (ac < 2) { usage(*av); return 1; } srand(getpid() * time(NULL)); // Set all the scanning options according to the user's CLI flags if (set_config(ac, av, &conf)) { return 2; } // Create a socket according to the method selected sock = port_scanners_ref[conf.method].socket_creator(); if (sock < 0) { LOG_ERROR("[MAIN] Unable to create socket"); return 3; } // Bind the socket to a particular device if (setsockopt(sock, SOL_SOCKET, SO_BINDTODEVICE, conf.iface_name, strlen(conf.iface_name)) < 0) { LOG_ERROR("[MAIN] Unable to bind the socket to interface \"%s\"", conf.iface_name); return 5; } VERBOSE_PRINTF(&conf, "Scan summary: host:%s(%s) ports:0-%d method:%s iface:%s", conf.target_address, inet_ntoa(((struct sockaddr_in*)conf.target_sockaddr)->sin_addr), conf.ports_amount - 1, port_scanners_ref[conf.method].str, conf.iface_name ? conf.iface_name : "default"); // Start scanning, and display the results report = scan_ports(sock, &conf); VERBOSE_PRINTF(&conf, "Scan complete, generating results"); print_report(report, conf.ports_amount, conf.verbose, conf.no_shuffle, !conf.no_fingerprint_services); close(sock); for (; report != NULL; report = report->next) free(report); free((void*)conf.iface_name); return 0; }
the_stack_data/123955.c
//--------------- // mini-c, by Sam Nipps (c) 2015 // MIT license //--------------- #include <stdlib.h> #include <string.h> #include <ctype.h> #include <stdio.h> #include <stdbool.h> //No enums :( int ptr_size = 4; int word_size = 4; FILE* output; //==== Lexer ==== char* inputname; FILE* input; int curln; char curch; char* buffer; int buflength; int token; int token_other = 0; int token_ident = 1; int token_int = 2; int token_char = 3; int token_str = 4; char next_char () { if (curch == '\n') curln++; return curch = fgetc(input); } bool prev_char (char before) { ungetc(curch, input); curch = before; return false; } void eat_char () { //The compiler is typeless, so as a compromise indexing is done //in word size jumps, and pointer arithmetic in byte jumps. (buffer + buflength++)[0] = curch; next_char(); } void next () { //Skip whitespace while (curch == ' ' || curch == '\r' || curch == '\n' || curch == '\t') next_char(); //Treat preprocessor lines as line comments if ( curch == '#' || (curch == '/' && (next_char() == '/' || prev_char('/')))) { while (curch != '\n' && !feof(input)) next_char(); //Restart the function (to skip subsequent whitespace, comments and pp) next(); return; } buflength = 0; token = token_other; //Identifier, keyword or integer literal if (isalpha(curch) || isdigit(curch)) { token = isalpha(curch) ? token_ident : token_int; while (token == token_ident ? (isalnum(curch) || curch == '_') && !feof(input) : isdigit(curch) && !feof(input)) eat_char(); //String or character literal } else if (curch == '\'' || curch == '"') { token = curch == '"' ? token_str : token_char; //Can't retrieve this from the buffer - mini-c only has int reads char delimiter = curch; eat_char(); while (curch != delimiter && !feof(input)) { if (curch == '\\') eat_char(); eat_char(); } eat_char(); //Two char operators } else if ( curch == '+' || curch == '-' || curch == '|' || curch == '&' || curch == '=' || curch == '!' || curch == '>' || curch == '<') { eat_char(); if ((curch == buffer[0] && curch != '!') || curch == '=') eat_char(); } else eat_char(); (buffer + buflength++)[0] = 0; } void lex_init (char* filename, int maxlen) { inputname = filename; input = fopen(filename, "r"); //Get the lexer into a usable state for the parser curln = 1; buffer = malloc(maxlen); next_char(); next(); } //==== Parser helper functions ==== int errors; void error (char* format) { printf("%s:%d: error: ", inputname, curln); //Accepting an untrusted format string? Naughty! printf(format, buffer); errors++; } void require (bool condition, char* format) { if (!condition) error(format); } bool see (char* look) { return !strcmp(buffer, look); } bool waiting_for (char* look) { return !see(look) && !feof(input); } void match (char* look) { if (!see(look)) { printf("%s:%d: error: expected '%s', found '%s'\n", inputname, curln, look, buffer); errors++; } next(); } bool try_match (char* look) { bool saw = see(look); if (saw) next(); return saw; } //==== Symbol table ==== char** globals; int global_no = 0; bool* is_fn; char** locals; int local_no = 0; int param_no = 0; int* offsets; void sym_init (int max) { globals = malloc(ptr_size*max); is_fn = calloc(max, ptr_size); locals = malloc(ptr_size*max); offsets = calloc(max, word_size); } void new_global (char* ident) { globals[global_no++] = ident; } void new_fn (char* ident) { is_fn[global_no] = true; new_global(ident); } int new_local (char* ident) { int var_index = local_no - param_no; locals[local_no] = ident; //The first local variable is directly below the base pointer offsets[local_no] = -word_size*(var_index+1); return local_no++; } void new_param (char* ident) { int local = new_local(ident); //At and above the base pointer, in order, are: // 1. the old base pointer, [ebp] // 2. the return address, [ebp+W] // 3. the first parameter, [ebp+2W] // and so on offsets[local] = word_size*(2 + param_no++); } //Enter the scope of a new function void new_scope () { local_no = 0; param_no = 0; } int sym_lookup (char** table, int table_size, char* look) { int i = 0; while (i < table_size) if (!strcmp(table[i++], look)) return i-1; return -1; } //==== Codegen labels ==== int label_no = 0; //The label to jump to on `return` int return_to; int new_label () { return label_no++; } int emit_label (int label) { fprintf(output, "_%08d:\n", label); return label; } //==== One-pass parser and code generator ==== bool lvalue; void needs_lvalue (char* msg) { if (!lvalue) error(msg); lvalue = false; } void expr (int level); //The code generator for expressions works by placing the results //in eax and backing them up to the stack. //Regarding lvalues and assignment: //An expression which can return an lvalue looks head for an //assignment operator. If it finds one, then it pushes the //address of its result. Otherwise, it dereferences it. //The global lvalue flag tracks whether the last operand was an //lvalue; assignment operators check and reset it. void factor () { lvalue = false; if (see("true") || see("false")) { fprintf(output, "mov eax, %d\n", see("true") ? 1 : 0); next(); } else if (token == token_ident) { int global = sym_lookup(globals, global_no, buffer); int local = sym_lookup(locals, local_no, buffer); require(global >= 0 || local >= 0, "no symbol '%s' declared\n"); next(); if (see("=") || see("++") || see("--")) lvalue = true; if (global >= 0) fprintf(output, "%s eax, [%s]\n", is_fn[global] || lvalue ? "lea" : "mov", globals[global]); else if (local >= 0) fprintf(output, "%s eax, [ebp%+d]\n", lvalue ? "lea" : "mov", offsets[local]); } else if (token == token_int || token == token_char) { fprintf(output, "mov eax, %s\n", buffer); next(); } else if (token == token_str) { fputs(".section .rodata\n", output); int str = emit_label(new_label()); //Consecutive string literals are concatenated while (token == token_str) { fprintf(output, ".ascii %s\n", buffer); next(); } fputs(".byte 0\n" ".section .text\n", output); fprintf(output, "mov eax, offset _%08d\n", str); } else if (try_match("(")) { expr(0); match(")"); } else error("expected an expression, found '%s'\n"); } void object () { factor(); while (true) { if (try_match("(")) { fputs("push eax\n", output); int arg_no = 0; if (waiting_for(")")) { //cdecl requires arguments to be pushed on backwards int start_label = new_label(); int end_label = new_label(); int prev_label = end_label; fprintf(output, "jmp _%08d\n", start_label); do { int next_label = emit_label(new_label()); expr(0); fprintf(output, "push eax\n" "jmp _%08d\n", prev_label); arg_no++; prev_label = next_label; } while (try_match(",")); fprintf(output, "_%08d:\n", start_label); fprintf(output, "jmp _%08d\n", prev_label); fprintf(output, "_%08d:\n", end_label); } match(")"); fprintf(output, "call dword ptr [esp+%d]\n", arg_no*word_size); fprintf(output, "add esp, %d\n", (arg_no+1)*word_size); } else if (try_match("[")) { fputs("push eax\n", output); expr(0); match("]"); if (see("=") || see("++") || see("--")) lvalue = true; fprintf(output, "pop ebx\n" "%s eax, [eax*%d+ebx]\n", lvalue ? "lea" : "mov", word_size); } else return; } } void unary () { if (try_match("!")) { //Recurse to allow chains of unary operations, LIFO order unary(); fputs("cmp eax, 0\n" "mov eax, 0\n" "sete al\n", output); } else if (try_match("-")) { unary(); fputs("neg eax\n", output); } else { //This function call compiles itself object(); if (see("++") || see("--")) { fprintf(output, "mov ebx, eax\n" "mov eax, [ebx]\n" "%s dword ptr [ebx], 1\n", see("++") ? "add" : "sub"); needs_lvalue("assignment operator '%s' requires a modifiable object\n"); next(); } } } void branch (bool expr); void expr (int level) { if (level == 5) { unary(); return; } expr(level+1); while ( level == 4 ? see("+") || see("-") || see("*") : level == 3 ? see("==") || see("!=") || see("<") || see(">=") : false) { fputs("push eax\n", output); char* instr = see("+") ? "add" : see("-") ? "sub" : see("*") ? "imul" : see("==") ? "e" : see("!=") ? "ne" : see("<") ? "l" : "ge"; next(); expr(level+1); if (level == 4) fprintf(output, "mov ebx, eax\n" "pop eax\n" "%s eax, ebx\n", instr); else fprintf(output, "pop ebx\n" "cmp ebx, eax\n" "mov eax, 0\n" "set%s al\n", instr); } if (level == 2) while (see("||") || see("&&")) { int shortcircuit = new_label(); fprintf(output, "cmp eax, 0\n" "j%s _%08d\n", see("||") ? "nz" : "z", shortcircuit); next(); expr(level+1); fprintf(output, "\t_%08d:\n", shortcircuit); } if (level == 1 && try_match("?")) branch(true); if (level == 0 && try_match("=")) { fputs("push eax\n", output); needs_lvalue("assignment requires a modifiable object\n"); expr(level+1); fputs("pop ebx\n" "mov dword ptr [ebx], eax\n", output); } } void line (); void branch (bool isexpr) { int false_branch = new_label(); int join = new_label(); fprintf(output, "cmp eax, 0\n" "je _%08d\n", false_branch); isexpr ? expr(1) : line(); fprintf(output, "jmp _%08d\n", join); fprintf(output, "\t_%08d:\n", false_branch); if (isexpr) { match(":"); expr(1); } else if (try_match("else")) line(); fprintf(output, "\t_%08d:\n", join); } void if_branch () { match("if"); match("("); expr(0); match(")"); branch(false); } void while_loop () { int loop_to = emit_label(new_label()); int break_to = new_label(); bool do_while = try_match("do"); if (do_while) line(); match("while"); match("("); expr(0); match(")"); fprintf(output, "cmp eax, 0\n" "je _%08d\n", break_to); if (do_while) match(";"); else line(); fprintf(output, "jmp _%08d\n", loop_to); fprintf(output, "\t_%08d:\n", break_to); } void decl (int kind); //See decl() implementation int decl_module = 1; int decl_local = 2; int decl_param = 3; void line () { if (see("if")) if_branch(); else if (see("while") || see("do")) while_loop(); else if (see("int") || see("char") || see("bool")) decl(decl_local); else if (try_match("{")) { while (waiting_for("}")) line(); match("}"); } else { bool ret = try_match("return"); if (waiting_for(";")) expr(0); if (ret) fprintf(output, "jmp _%08d\n", return_to); match(";"); } } void function (char* ident) { //Body int body = emit_label(new_label()); return_to = new_label(); line(); //Epilogue fprintf(output, "\t_%08d:\n", return_to); fputs("mov esp, ebp\n" "pop ebp\n" "ret\n", output); //Prologue //Only after passing the body do we know how much space to allocate for the //local variables, so we write the prologue here at the end. fprintf(output, ".globl %s\n" "%s:\n", ident, ident); fprintf(output, "push ebp\n" "mov ebp, esp\n" "sub esp, %d\n" "jmp _%08d\n", local_no*word_size, body); } void decl (int kind) { //A C declaration comes in three forms: // - Local decls, which end in a semicolon and can have an initializer. // - Parameter decls, which do not and cannot. // - Module decls, which end in a semicolon unless there is a function body. bool fn = false; bool fn_impl = false; int local; next(); while (try_match("*")) ; //Owned (freed) by the symbol table char* ident = strdup(buffer); next(); //Functions if (try_match("(")) { if (kind == decl_module) new_scope(); //Params if (waiting_for(")")) do { decl(decl_param); } while (try_match(",")); match(")"); new_fn(ident); fn = true; //Body if (see("{")) { require(kind == decl_module, "a function implementation is illegal here\n"); fn_impl = true; function(ident); } //Add it to the symbol table } else { if (kind == decl_local) { local = new_local(ident); } else (kind == decl_module ? new_global : new_param)(ident); } //Initialization if (see("=")) require(!fn && kind != decl_param, fn ? "cannot initialize a function\n" : "cannot initialize a parameter\n"); if (kind == decl_module) { fputs(".section .data\n", output); if (try_match("=")) { if (token == token_int) fprintf(output, "%s: .quad %d\n", ident, atoi(buffer)); else error("expected a constant expression, found '%s'\n"); next(); //Static data defaults to zero if no initializer } else if (!fn) fprintf(output, "%s: .quad 0\n", ident); fputs(".section .text\n", output); } else if (try_match("=")) { expr(0); fprintf(output, "mov dword ptr [ebp%+d], eax\n", offsets[local]); } if (!fn_impl && kind != decl_param) match(";"); } void program () { fputs(".intel_syntax noprefix\n", output); errors = 0; while (!feof(input)) decl(decl_module); } int main (int argc, char** argv) { if (argc != 2) { puts("Usage: cc <file>"); return 1; } output = fopen("a.s", "w"); lex_init(argv[1], 256); sym_init(256); //No arrays? Fine! A 0xFFFFFF terminated string of null terminated strings will do. //A negative-terminated null-terminated strings string, if you will char* std_fns = "malloc\0calloc\0free\0atoi\0fopen\0fclose\0fgetc\0ungetc\0feof\0fputs\0fprintf\0puts\0printf\0" "isalpha\0isdigit\0isalnum\0strlen\0strcmp\0strchr\0strcpy\0strdup\0\xFF\xFF\xFF\xFF"; //Remember that mini-c is typeless, so this is both a byte read and a 4 byte read. //(char) 0xFF == -1, (int) 0xFFFFFF == -1 while (std_fns[0] != -1) { new_fn(strdup(std_fns)); std_fns = std_fns+strlen(std_fns)+1; } program(); return errors != 0; }
the_stack_data/68887366.c
#include <stdio.h> #define MAX_SIZE 1000 typedef struct priority_queue { long long Heap[MAX_SIZE]; int Size; }Queue; Queue q; void swap(long long *a, long long *b) { long long tmp = *a; *a = *b; *b = tmp; } int push(long long value) { if (q.Size + 1 > MAX_SIZE) return 0; q.Heap[q.Size] = value; int current = q.Size; int parent = (q.Size - 1) / 2; while (current > 0 && q.Heap[current] < q.Heap[parent]) { swap(&q.Heap[current], &q.Heap[parent]); current = parent; parent = (parent - 1) / 2; } q.Size++; return 1; } long long pop() { if (q.Size <= 0) return -1; long long ret = q.Heap[0]; q.Size--; q.Heap[0] = q.Heap[q.Size]; int current = 0; int leftChild = current * 2 + 1; int rightChild = current * 2 + 2; int maxNode = current; while (leftChild < q.Size) { if (q.Heap[maxNode] > q.Heap[leftChild]) maxNode = leftChild; if (rightChild < q.Size && q.Heap[maxNode] > q.Heap[rightChild]) maxNode = rightChild; if (maxNode == current) break; else { swap(&q.Heap[current], &q.Heap[maxNode]); current = maxNode; leftChild = current * 2 + 1; rightChild = current * 2 + 2; } } return ret; } int main(void) { int mod = 1e9+7; int T; int test; scanf("%d", &T); for(test=0;test<T;test++) { int N; scanf("%d", &N); int i, j; long long C; for(i=0;i<N;i++) { scanf("%lld", &C); push(C); } long long min = 1; long long mul; for(i=0;i<N-1;i++) { mul = pop() * pop(); min = min * (mul % mod) % mod; push(mul); } pop(); printf("%lld\n", min); } return 0; }
the_stack_data/1005531.c
/* * main.c * * Copyright 2021 chehw <[email protected]> * * The MIT License * * 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. * */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> int main(int argc, char **argv) { // TODO: return 0; }
the_stack_data/51699054.c
/*--------------------------------------------------------------------*/ /*--- Create/destroy signal delivery frames. ---*/ /*--- sigframe-amd64-darwin.c ---*/ /*--------------------------------------------------------------------*/ /* This file is part of Valgrind, a dynamic binary instrumentation framework. Copyright (C) 2006-2013 OpenWorks Ltd [email protected] 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. The GNU General Public License is contained in the file COPYING. */ #if defined(VGP_amd64_darwin) #include "pub_core_basics.h" #include "pub_core_vki.h" #include "pub_core_vkiscnums.h" #include "pub_core_libcsetjmp.h" // to keep _threadstate.h happy #include "pub_core_threadstate.h" #include "pub_core_aspacemgr.h" #include "pub_core_libcbase.h" #include "pub_core_libcassert.h" #include "pub_core_libcprint.h" #include "pub_core_machine.h" #include "pub_core_options.h" #include "pub_core_signals.h" #include "pub_core_tooliface.h" #include "pub_core_trampoline.h" #include "pub_core_sigframe.h" /* self */ /* Cheap-ass hack copied from ppc32-aix5 code, just to get started. Produce a frame with layout entirely of our own choosing. */ /* This module creates and removes signal frames for signal deliveries on amd64-darwin. Kludgey; the machine state ought to be saved in a ucontext and retrieved from it later, so the handler can modify it and return. However .. for now .. just stick the vex guest state in the frame and snarf it again later. Also, don't bother with creating siginfo and ucontext in the handler, although do point them somewhere non-faulting. Frame should have a 16-aligned size, just in case that turns out to be important for Darwin. (be conservative) */ struct hacky_sigframe { /* first word looks like a call to a 3-arg amd64-ELF function */ ULong returnAddr; UChar lower_guardzone[512]; // put nothing here VexGuestAMD64State gst; VexGuestAMD64State gshadow1; VexGuestAMD64State gshadow2; vki_siginfo_t fake_siginfo; struct vki_ucontext fake_ucontext; UInt magicPI; UInt sigNo_private; vki_sigset_t mask; // saved sigmask; restore when hdlr returns UInt __pad[2]; UChar upper_guardzone[512]; // put nothing here // and don't zero it, since that might overwrite the client's // stack redzone, at least on archs which have one }; /* Create a signal frame for thread 'tid'. Make a 3-arg frame regardless of whether the client originally requested a 1-arg version (no SA_SIGINFO) or a 3-arg one (SA_SIGINFO) since in the former case, the amd64 calling conventions will simply cause the extra 2 args to be ignored (inside the handler). (We hope!) */ void VG_(sigframe_create) ( ThreadId tid, Addr sp_top_of_frame, const vki_siginfo_t *siginfo, const struct vki_ucontext *siguc, void *handler, UInt flags, const vki_sigset_t *mask, void *restorer ) { ThreadState* tst; Addr rsp; struct hacky_sigframe* frame; Int sigNo = siginfo->si_signo; vg_assert(VG_IS_16_ALIGNED(sizeof(struct hacky_sigframe))); sp_top_of_frame &= ~0xfUL; rsp = sp_top_of_frame - sizeof(struct hacky_sigframe); rsp -= 8; /* ELF ABI says that rsp+8 must be 16 aligned on entry to a function. */ tst = VG_(get_ThreadState)(tid); if (! ML_(sf_extend_stack)(tst, rsp, sp_top_of_frame - rsp)) return; vg_assert(VG_IS_16_ALIGNED(rsp+8)); frame = (struct hacky_sigframe *) rsp; /* clear it (very conservatively) (why so conservatively??) */ VG_(memset)(&frame->lower_guardzone, 0, sizeof frame->lower_guardzone); VG_(memset)(&frame->gst, 0, sizeof(VexGuestAMD64State)); VG_(memset)(&frame->gshadow1, 0, sizeof(VexGuestAMD64State)); VG_(memset)(&frame->gshadow2, 0, sizeof(VexGuestAMD64State)); VG_(memset)(&frame->fake_siginfo, 0, sizeof(frame->fake_siginfo)); VG_(memset)(&frame->fake_ucontext, 0, sizeof(frame->fake_ucontext)); /* save stuff in frame */ frame->gst = tst->arch.vex; frame->gshadow1 = tst->arch.vex_shadow1; frame->gshadow2 = tst->arch.vex_shadow2; frame->sigNo_private = sigNo; frame->mask = tst->sig_mask; frame->magicPI = 0x31415927; /* Minimally fill in the siginfo and ucontext. Note, utter lameness prevails. Be underwhelmed, be very underwhelmed. */ frame->fake_siginfo.si_signo = sigNo; frame->fake_siginfo.si_code = siginfo->si_code; /* Set up stack pointer */ vg_assert(rsp == (Addr)&frame->returnAddr); VG_(set_SP)(tid, rsp); VG_TRACK( post_reg_write, Vg_CoreSignal, tid, VG_O_STACK_PTR, sizeof(ULong)); /* Set up program counter */ VG_(set_IP)(tid, (ULong)handler); VG_TRACK( post_reg_write, Vg_CoreSignal, tid, VG_O_INSTR_PTR, sizeof(ULong)); /* Set up RA and args for the frame */ VG_TRACK( pre_mem_write, Vg_CoreSignal, tid, "signal handler frame", (Addr)frame, 1*sizeof(ULong) ); frame->returnAddr = (ULong)&VG_(amd64_darwin_SUBST_FOR_sigreturn); /* XXX should tell the tool that these regs got written */ tst->arch.vex.guest_RDI = (ULong) sigNo; tst->arch.vex.guest_RSI = (Addr) &frame->fake_siginfo;/* oh well */ tst->arch.vex.guest_RDX = (Addr) &frame->fake_ucontext; /* oh well */ VG_TRACK( post_mem_write, Vg_CoreSignal, tid, (Addr)frame, 1*sizeof(ULong) ); VG_TRACK( post_mem_write, Vg_CoreSignal, tid, (Addr)&frame->fake_siginfo, sizeof(frame->fake_siginfo)); VG_TRACK( post_mem_write, Vg_CoreSignal, tid, (Addr)&frame->fake_ucontext, sizeof(frame->fake_ucontext)); if (VG_(clo_trace_signals)) VG_(message)(Vg_DebugMsg, "sigframe_create (thread %d): " "next EIP=%#lx, next ESP=%#lx\n", tid, (Addr)handler, (Addr)frame ); } /* Remove a signal frame from thread 'tid's stack, and restore the CPU state from it. Note, isRT is irrelevant here. */ void VG_(sigframe_destroy)( ThreadId tid, Bool isRT ) { ThreadState *tst; Addr rsp; Int sigNo; struct hacky_sigframe* frame; vg_assert(VG_(is_valid_tid)(tid)); tst = VG_(get_ThreadState)(tid); /* Check that the stack frame looks valid */ rsp = VG_(get_SP)(tid); /* why -8 ? because the signal handler's return will have popped the return address off the stack; and the return address is the lowest-addressed element of hacky_sigframe. */ frame = (struct hacky_sigframe*)(rsp - 8); vg_assert(frame->magicPI == 0x31415927); /* This +8 is because of the -8 referred to in the ELF ABI comment in VG_(sigframe_create) just above. */ vg_assert(VG_IS_16_ALIGNED((Addr)frame + 8)); /* restore the entire guest state, and shadows, from the frame. Note, as per comments above, this is a kludge - should restore it from saved ucontext. Oh well. */ tst->arch.vex = frame->gst; tst->arch.vex_shadow1 = frame->gshadow1; tst->arch.vex_shadow2 = frame->gshadow2; tst->sig_mask = frame->mask; tst->tmp_sig_mask = frame->mask; sigNo = frame->sigNo_private; if (VG_(clo_trace_signals)) VG_(message)(Vg_DebugMsg, "sigframe_destroy (thread %d): " "valid magic; next RIP=%#llx\n", tid, tst->arch.vex.guest_RIP); VG_TRACK( die_mem_stack_signal, (Addr)frame - VG_STACK_REDZONE_SZB, sizeof(struct hacky_sigframe) ); /* tell the tools */ VG_TRACK( post_deliver_signal, tid, sigNo ); } #endif // defined(VGP_amd64_darwin) /*--------------------------------------------------------------------*/ /*--- end sigframe-amd64-darwin.c ---*/ /*--------------------------------------------------------------------*/
the_stack_data/12966.c
/* * Copyright 2016, 2017, 2018 Imperial College London * Copyright 2016, 2017 TU Dresden (under SCONE source code license) */ #ifdef SGXLKL_HW #include <setjmp.h> #include <stdio.h> #include <string.h> #include "mpmc_queue.h" #include "sgx_enclave_config.h" #include "sgx_hostcall_interface.h" #include "pthread_impl.h" /* we need this initializer for signer to find this struct in the TLS image */ static __thread enclave_parms_t enclave_parms = {.base = 0xbaadf00ddeadbabe}; enclave_parms_t* get_enclave_parms() { // The enclave parameters are stored in thread-local storage of each // ethread. Early on they can be accessed at an offset added to the fs // segment base which stores the current thread pointer. However, later on // the fs base is modified to point at the TLS of the currently running // lthread. By then, the scheduling context has been initialised and we can // use it to get the address of the enclave parameter struct. enclave_parms_t* ret; if (__scheduler_self()) { ret = __scheduler_self()->enclave_parms; } if (!ret) { __asm("movq %%fs:16,%0\n" : "=r"(ret) : : ); } return ret; } /* * Do not delete. This is required to prevent the thread-local variable from * being removed during optimization. */ void* never_called() { return &enclave_parms; } void* get_exit_address() { if (get_enclave_parms()->eh_handling) return (void*) get_enclave_parms()->eh_exit_addr; return (void*) get_enclave_parms()->exit_addr; } uint64_t get_ursp() { if (get_enclave_parms()->eh_handling) return get_enclave_parms()->eh_ursp; return get_enclave_parms()->ursp; } uint64_t get_urbp() { if (get_enclave_parms()->eh_handling) return get_enclave_parms()->eh_urbp; return get_enclave_parms()->urbp; } uint64_t get_eh_handling() { return get_enclave_parms()->eh_handling; } void set_eh_handling(uint64_t val) { get_enclave_parms()->eh_handling = val; } int get_thread_state() { return get_enclave_parms()->thread_state; } void set_thread_state(int state) { get_enclave_parms()->thread_state = state; } void leave_enclave(uint64_t rdi, uint64_t rsi) { set_thread_state(OUTSIDE); void* exit_address = get_exit_address(); uint64_t ursp = get_ursp(); uint64_t urbp = get_urbp(); if (setjmp(get_enclave_parms()->regs) == 0) { //TODO: clear registers __asm__ volatile( "mov %0,%%rsp\n" "mov %1,%%rbp\n" ".byte 0x0f \n" ".byte 0x01 \n" ".byte 0xd7 \n" : : "r"(ursp), "r"(urbp), "a"(0x4), "b"(exit_address), "D"(rdi), "S"(rsi) : ); } set_thread_state(ACTIVE); } void exit_enclave(uint64_t rdi, uint64_t rsi, void* exit_address, int exit_thread_state) { set_thread_state(exit_thread_state); uint64_t ursp = get_ursp(); uint64_t urbp = get_urbp(); if (get_eh_handling()) set_eh_handling(0); //TODO: clear registers __asm__ volatile( "mov %0,%%rsp\n" "mov %1,%%rbp\n" ".byte 0x0f \n" ".byte 0x01 \n" ".byte 0xd7 \n" : : "r"(ursp), "r"(urbp), "a"(0x4), "b"(exit_address), "D"(rdi), "S"(rsi) : ); } void ereport(void *target, char *report_data, char *report) { __asm__ volatile( ".byte 0x0f \n" ".byte 0x01 \n" ".byte 0xd7 \n" : : "a"(0x0), // EAX = 00H ENCLU[EREPORT] "b"(target), // RBX = Address of TARGETINFO (In) "c"(report_data), // RCX = Address of REPORTDATA (In) "d"(report) // RDX = Address where the REPORT is // written to : ); } /* Exit enclave to do cpuid * TODO: We should do sanity checks on return values * Input: unsigned int request[4], eax in request[0], ecx in request[2] * Output: values of eax, ebx, ecx, edx returned by cpuid in corresponding elements of request array */ void ocall_cpuid(unsigned int* request) { if (request == NULL) return; Arena *a = NULL; getsyscallslot(&a); size_t len = sizeof(*request) * 4; void* req = arena_alloc(a, len) ; if (req != NULL) memcpy(req, request, len); leave_enclave(SGXLKL_EXIT_CPUID, (uint64_t) req); if (req != NULL) memcpy(request, req, len); arena_free(a); } /* Handle CPUID ecall after an illegal instruction has been caught on the host */ void ecall_cpuid(gprsgx_t *regs) { unsigned int request[4]; int clear_tsc = 0; request[0] = (unsigned int)regs->rax; request[2] = (unsigned int)regs->rcx; if (request[0] == 1) clear_tsc = 1; ocall_cpuid(request); if (clear_tsc) { /* clear TSC bit in edx, CPUID_FEAT_EDX_TSC - 5th bit */ unsigned int mask; mask = ~(1<<4); request[3] &= mask; } regs->rax = request[0]; regs->rbx = request[1]; regs->rcx = request[2]; regs->rdx = request[3]; regs->rip += 2; } /* Handle RDTSC ecall after an illegal instruction has been caught on the host */ void ecall_rdtsc(gprsgx_t *regs, uint64_t ts) { uint64_t mask; mask = 0xffffffff; regs->rax = ts & mask; regs->rdx = (ts & ~mask) >> 32; regs->rip += 2; } int in_enclave_range(void *addr, size_t len) { char *encl_start = (char *) get_enclave_parms()->base; char *encl_end = encl_start + get_enclave_parms()->enclave_size; return !((char *)addr >= encl_end || (char *)addr + len <= encl_start); } static void enclave_config_fail(void) { exit_enclave(SGXLKL_EXIT_ERROR, SGXLKL_CONFIG_ASSERT_VIOLATION, get_exit_address(), UNUSED); } static char *enclave_safe_str_copy(char *s) { char *safe_s = NULL; if (s) { size_t s_len = strlen(s); if (in_enclave_range(s, s_len)) enclave_config_fail(); if (!(safe_s = strndup(s, s_len + 1))) enclave_config_fail(); } return safe_s; } enclave_config_t *enclave_config_copy_and_check(enclave_config_t *untrusted) { enclave_config_t *encl; if (!(encl = malloc(sizeof(*encl)))) enclave_config_fail(); *encl = *untrusted; // Check pointers // Panic on assertion failure. The enclave is not set up yet to print // anything/fail gracefully. // TODO Leave the enclave with exit code to indicate assertion failure? // Set base/heap/heapsize to known good values encl->base = (void*)get_enclave_parms()->base; encl->heap = (void*)get_enclave_parms()->heap; encl->heapsize = get_enclave_parms()->heap_size; // Must be outside enclave range if (in_enclave_range(encl->syscallpage, PAGE_SIZE)) enclave_config_fail(); if (in_enclave_range(encl->syscallq, sizeof(struct mpmcq))) enclave_config_fail(); if (in_enclave_range(encl->returnq, sizeof(struct mpmcq))) enclave_config_fail(); if (in_enclave_range(encl->disks, sizeof(*encl->disks) * encl->num_disks)) enclave_config_fail(); if (in_enclave_range(encl->vvar, PAGE_SIZE)) enclave_config_fail(); // TODO Should the kernel command line arguments actually be trusted at // all? // Copy kernel cmd line into enclave encl->kernel_cmd = enclave_safe_str_copy(encl->kernel_cmd); // Copy WG key and peers into enclave encl->wg.key = enclave_safe_str_copy(encl->wg.key); enclave_wg_peer_config_t *safe_peers = malloc(encl->wg.num_peers * sizeof(*safe_peers)); for (int i = 0; i < encl->wg.num_peers; i++) { safe_peers[i].key = enclave_safe_str_copy(encl->wg.peers[i].key); safe_peers[i].allowed_ips = enclave_safe_str_copy(encl->wg.peers[i].allowed_ips); safe_peers[i].endpoint = enclave_safe_str_copy(encl->wg.peers[i].endpoint); } encl->wg.peers = safe_peers; if (in_enclave_range(encl->quote_target_info, sizeof(sgx_target_info_t))) enclave_config_fail(); if (in_enclave_range(encl->report, sizeof(sgx_report_t))) enclave_config_fail(); // Comments on other fields // encl->disks: Individual disk configurations are checked in startmain // encl->auxv: auxv is handled in init_auxv // encl->argv: argv/envp are set before application launch. Host-provided // argv/envp are ignored in release mode // encl->app_config app config is provided remotely in release mode return encl; } void enclave_config_free(enclave_config_t *encl) { free(encl->kernel_cmd); free(encl->wg.key); for (int i = 0; i < encl->wg.num_peers; i++) { free(encl->wg.peers[i].key); free(encl->wg.peers[i].allowed_ips); free(encl->wg.peers[i].endpoint); } free(encl->wg.peers); free(encl); } #endif
the_stack_data/72012431.c
#include <stdio.h> int main(void) { int d, i1, i2, i3, i4, i5, j1, j2, j3, j4, j5, first_sum, second_sum, total; printf("Enter 11 numbers: "); scanf("%1d%1d%1d%1d%1d%1d%1d%1d%1d%1d%1d", &d, &i1, &i2, &i3, &i4, &i5, &j1, &j2, &j3, &j4, &j5); first_sum = d +i2 + i4 + j1 + j3 + j5; second_sum = i1 + i3 + i5 + j2 + j4; total = 3*first_sum + second_sum; printf("Check digit: %d\n", 9 - ((total -1)%10)); return 0; }
the_stack_data/6387835.c
/* * FreeRTOS V202104.00 * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * 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. * * http://www.FreeRTOS.org * http://aws.amazon.com/freertos * * 1 tab == 4 spaces! */ void vRegTest1Task( void ) __attribute__((naked)); void vRegTest2Task( void ) __attribute__((naked)); void vRegTest1Task( void ) { __asm volatile ( ".extern ulRegTest1LoopCounter \n" " \n" " /* Fill the core registers with known values. */ \n" " movs r1, #101 \n" " movs r2, #102 \n" " movs r3, #103 \n" " movs r4, #104 \n" " movs r5, #105 \n" " movs r6, #106 \n" " movs r7, #107 \n" " movs r0, #108 \n" " mov r8, r0 \n" " movs r0, #109 \n" " mov r9, r0 \n" " movs r0, #110 \n" " mov r10, r0 \n" " movs r0, #111 \n" " mov r11, r0 \n" " movs r0, #112 \n" " mov r12, r0 \n" " movs r0, #100 \n" " \n" "reg1_loop: \n" " \n" " cmp r0, #100 \n" " bne reg1_error_loop \n" " cmp r1, #101 \n" " bne reg1_error_loop \n" " cmp r2, #102 \n" " bne reg1_error_loop \n" " cmp r3, #103 \n" " bne reg1_error_loop \n" " cmp r4, #104 \n" " bne reg1_error_loop \n" " cmp r5, #105 \n" " bne reg1_error_loop \n" " cmp r6, #106 \n" " bne reg1_error_loop \n" " cmp r7, #107 \n" " bne reg1_error_loop \n" " movs r0, #108 \n" " cmp r8, r0 \n" " bne reg1_error_loop \n" " movs r0, #109 \n" " cmp r9, r0 \n" " bne reg1_error_loop \n" " movs r0, #110 \n" " cmp r10, r0 \n" " bne reg1_error_loop \n" " movs r0, #111 \n" " cmp r11, r0 \n" " bne reg1_error_loop \n" " movs r0, #112 \n" " cmp r12, r0 \n" " bne reg1_error_loop \n" " \n" " /* Everything passed, increment the loop counter. */ \n" " push { r1 } \n" " ldr r0, =ulRegTest1LoopCounter \n" " ldr r1, [r0] \n" " add r1, r1, #1 \n" " str r1, [r0] \n" " pop { r1 } \n" " \n" " /* Start again. */ \n" " movs r0, #100 \n" " b reg1_loop \n" " \n" "reg1_error_loop: \n" " /* If this line is hit then there was an error in a core register value. \n" " The loop ensures the loop counter stops incrementing. */ \n" " b reg1_error_loop \n" " nop \n" ); } /*-----------------------------------------------------------*/ void vRegTest2Task( void ) { __asm volatile ( ".extern ulRegTest2LoopCounter \n" " \n" " /* Fill the core registers with known values. */ \n" " movs r1, #1 \n" " movs r2, #2 \n" " movs r3, #3 \n" " movs r4, #4 \n" " movs r5, #5 \n" " movs r6, #6 \n" " movs r7, #7 \n" " movs r0, #8 \n" " movs r8, r0 \n" " movs r0, #9 \n" " mov r9, r0 \n" " movs r0, #10 \n" " mov r10, r0 \n" " movs r0, #11 \n" " mov r11, r0 \n" " movs r0, #12 \n" " mov r12, r0 \n" " movs r0, #10 \n" " \n" "reg2_loop: \n" " \n" " cmp r0, #10 \n" " bne reg2_error_loop \n" " cmp r1, #1 \n" " bne reg2_error_loop \n" " cmp r2, #2 \n" " bne reg2_error_loop \n" " cmp r3, #3 \n" " bne reg2_error_loop \n" " cmp r4, #4 \n" " bne reg2_error_loop \n" " cmp r5, #5 \n" " bne reg2_error_loop \n" " cmp r6, #6 \n" " bne reg2_error_loop \n" " cmp r7, #7 \n" " bne reg2_error_loop \n" " movs r0, #8 \n" " cmp r8, r0 \n" " bne reg2_error_loop \n" " movs r0, #9 \n" " cmp r9, r0 \n" " bne reg2_error_loop \n" " movs r0, #10 \n" " cmp r10, r0 \n" " bne reg2_error_loop \n" " movs r0, #11 \n" " cmp r11, r0 \n" " bne reg2_error_loop \n" " movs r0, #12 \n" " cmp r12, r0 \n" " bne reg2_error_loop \n" " \n" " /* Everything passed, increment the loop counter. */ \n" " push { r1 } \n" " ldr r0, =ulRegTest2LoopCounter \n" " ldr r1, [r0] \n" " add r1, r1, #1 \n" " str r1, [r0] \n" " pop { r1 } \n" " \n" " /* Start again. */ \n" " movs r0, #10 \n" " b reg2_loop \n" " \n" "reg2_error_loop: \n" " /* If this line is hit then there was an error in a core register value. \n" " The loop ensures the loop counter stops incrementing. */ \n" " b reg2_error_loop \n" " nop \n" ); } /*-----------------------------------------------------------*/
the_stack_data/5565.c
/* FFTE: A FAST FOURIER TRANSFORM PACKAGE (C) COPYRIGHT SOFTWARE, 2000-2004, 2008-2014, ALL RIGHTS RESERVED BY DAISUKE TAKAHASHI FACULTY OF ENGINEERING, INFORMATION AND SYSTEMS UNIVERSITY OF TSUKUBA 1-1-1 TENNODAI, TSUKUBA, IBARAKI 305-8573, JAPAN E-MAIL: [email protected] WRITTEN BY DAISUKE TAKAHASHI THIS KERNEL WAS GENERATED BY SPIRAL 8.2.0a03 */ void dft24b_(double *Y, double *X, double *TW1, int *lp1, int *mp1) { static double D68[16]; static double D69[32]; double a10760, a10761, a10762, a10763, a10764, a10765, a10766, a10767, a10768, a10769, a10770, a10771, a10773, a10774, a10775, a10776, a10777, a10778, a10779, a10780, a10781, a10782, a10783, a10784, a10785, a10786, a10787, a10788, a10789, a10790, a10791, a10792, a10793, a10794, a10795, a10796, a10797, a10798, a10799, a10800, a10801, a10802, a10803, a10804, a10805, a10806, a10807, a10808, a10809, a10810, a10811, a10812, a10813, a10814, a10815, a10816, a10817, a10818, s4500, s4501, s4502, s4503, s4504, s4505, s4506, s4507, s4508, s4509, s4510, s4511, s4512, s4513, s4514, s4515, s4516, s4517, s4518, s4519, s4520, s4521, s4522, s4523, s4524, s4525, s4526, s4527, s4528, s4529, s4530, s4531, s4532, s4533, s4534, s4535, s4536, s4537, s4538, s4539, s4540, s4541, s4542, s4543, s4544, s4545, s4546, s4547, s4548, s4549, s4550, s4551, s4552, s4553, s4554, s4555, s4556, s4557, s4558, s4559, s4560, s4561, s4562, s4563, s4564, s4565, s4566, s4567, s4568, s4569, s4570, s4571, s4572, s4573, s4574, s4575, s4576, s4577, s4578, s4579, s4580, s4581, s4582, s4583, s4584, s4585, s4586, s4587, s4588, s4589, s4590, s4591, s4592, s4593, s4594, s4595, s4596, s4597, s4598, s4599, s4600, s4601, s4602, s4603, s4604, s4605, s4606, s4607, s4608, s4609, s4610, s4611, s4612, s4613, s4614, s4615, s4616, s4617, s4618, s4619, s4620, s4621, s4622, s4623, s4624, s4625, s4626, s4627, s4628, s4629, s4630, s4631, s4632, s4633, s4634, s4635, s4636, s4637, s4638, s4639, s4640, s4641, s4642, s4643, s4644, s4645, s4646, s4647, s4648, s4649, s4650, s4651, s4652, s4653, s4654, s4655, s4656, s4657, s4658, s4659, s4660, s4661, s4662, s4663, s4664, s4665, s4666, s4667, s4668, s4669, t7514, t7515, t7516, t7517, t7518, t7519, t7520, t7521, t7522, t7523, t7524, t7525, t7526, t7527, t7528, t7529, t7530, t7531, t7532, t7533, t7534, t7535, t7536, t7537, t7538, t7539, t7540, t7541, t7542, t7543, t7544, t7545, t7546, t7547, t7548, t7549, t7550, t7551, t7552, t7553, t7554, t7555, t7556, t7557, t7558, t7559, t7560, t7561, t7562, t7563, t7564, t7565, t7566, t7567, t7568, t7569, t7570, t7571, t7572, t7573, t7574, t7575, t7576, t7577, t7578, t7579, t7580, t7581, t7582, t7583, t7584, t7585, t7586, t7587, t7588, t7589, t7590, t7591, t7592, t7593, t7594, t7595, t7596, t7597, t7598, t7599, t7600, t7601, t7602, t7603, t7604, t7605, t7606, t7607, t7608, t7609, t7610, t7611, t7612, t7613, t7614, t7615, t7616, t7617, t7618, t7619, t7620, t7621, t7622, t7623, t7624, t7625, t7626, t7627, t7628, t7629, t7630, t7631, t7632, t7633, t7634, t7635, t7636, t7637, t7638, t7639, t7640, t7641, t7642, t7643, t7644, t7645, t7646, t7647, t7648, t7649, t7650, t7651, t7652, t7653, t7654, t7655, t7656, t7657, t7658, t7659, t7660, t7661, t7662, t7663, t7664, t7665, t7666, t7667, t7668, t7669, t7670, t7671, t7672, t7673, t7674, t7675, t7676, t7677; int a10734, a10735, a10736, a10737, a10738, a10739, a10740, a10741, a10742, a10743, a10744, a10745, a10746, a10747, a10748, a10749, a10750, a10751, a10752, a10753, a10754, a10755, a10756, a10757, a10758, a10759, a10772, a10819, a10820, a10821, a10822, a10823, a10824, a10825, a10826, a10827, a10828, a10829, a10830, a10831, a10832, a10833, a10834, a10835, a10836, a10837, a10838, a10839, a10840, a10841, a10842, a10843, b360, j1, l1, m1; l1 = *(lp1); m1 = *(mp1); for(int j2 = 0; j2 < (l1 - 1); j2++) { j1 = (j2 + 1); for(int k1 = 0; k1 < m1; k1++) { a10734 = (2*k1); a10735 = (j1*m1); a10736 = (a10734 + (2*a10735)); s4500 = X[a10736]; s4501 = X[(a10736 + 1)]; b360 = (l1*m1); a10737 = (a10736 + (2*b360)); s4502 = X[a10737]; s4503 = X[(a10737 + 1)]; a10738 = (a10736 + (4*b360)); s4504 = X[a10738]; s4505 = X[(a10738 + 1)]; a10739 = (a10736 + (6*b360)); s4506 = X[a10739]; s4507 = X[(a10739 + 1)]; a10740 = (a10736 + (8*b360)); s4508 = X[a10740]; s4509 = X[(a10740 + 1)]; a10741 = (a10736 + (10*b360)); s4510 = X[a10741]; s4511 = X[(a10741 + 1)]; a10742 = (a10736 + (12*b360)); s4512 = X[a10742]; s4513 = X[(a10742 + 1)]; a10743 = (a10736 + (14*b360)); s4514 = X[a10743]; s4515 = X[(a10743 + 1)]; a10744 = (a10736 + (16*b360)); s4516 = X[a10744]; s4517 = X[(a10744 + 1)]; a10745 = (a10736 + (18*b360)); s4518 = X[a10745]; s4519 = X[(a10745 + 1)]; a10746 = (a10736 + (20*b360)); s4520 = X[a10746]; s4521 = X[(a10746 + 1)]; a10747 = (a10736 + (22*b360)); s4522 = X[a10747]; s4523 = X[(a10747 + 1)]; a10748 = (a10736 + (24*b360)); s4524 = X[a10748]; s4525 = X[(a10748 + 1)]; a10749 = (a10736 + (26*b360)); s4526 = X[a10749]; s4527 = X[(a10749 + 1)]; a10750 = (a10736 + (28*b360)); s4528 = X[a10750]; s4529 = X[(a10750 + 1)]; a10751 = (a10736 + (30*b360)); s4530 = X[a10751]; s4531 = X[(a10751 + 1)]; a10752 = (a10736 + (32*b360)); s4532 = X[a10752]; s4533 = X[(a10752 + 1)]; a10753 = (a10736 + (34*b360)); s4534 = X[a10753]; s4535 = X[(a10753 + 1)]; a10754 = (a10736 + (36*b360)); s4536 = X[a10754]; s4537 = X[(a10754 + 1)]; a10755 = (a10736 + (38*b360)); s4538 = X[a10755]; s4539 = X[(a10755 + 1)]; a10756 = (a10736 + (40*b360)); s4540 = X[a10756]; s4541 = X[(a10756 + 1)]; a10757 = (a10736 + (42*b360)); s4542 = X[a10757]; s4543 = X[(a10757 + 1)]; a10758 = (a10736 + (44*b360)); s4544 = X[a10758]; s4545 = X[(a10758 + 1)]; a10759 = (a10736 + (46*b360)); s4546 = X[a10759]; s4547 = X[(a10759 + 1)]; t7514 = (s4516 + s4532); t7515 = (s4517 + s4533); t7516 = (s4500 + t7514); t7517 = (s4501 + t7515); t7518 = (s4500 - (0.5*t7514)); t7519 = (s4501 - (0.5*t7515)); s4548 = (0.8660254037844386*(s4517 - s4533)); s4549 = (0.8660254037844386*(s4516 - s4532)); s4550 = ((D68[0]*t7516) - (D68[1]*t7517)); s4551 = ((D68[1]*t7516) + (D68[0]*t7517)); t7520 = (t7518 + s4548); t7521 = (t7519 - s4549); t7522 = (t7518 - s4548); t7523 = (t7519 + s4549); s4552 = ((D69[0]*t7520) - (D69[1]*t7521)); s4553 = ((D69[1]*t7520) + (D69[0]*t7521)); s4554 = ((D69[2]*t7522) - (D69[3]*t7523)); s4555 = ((D69[3]*t7522) + (D69[2]*t7523)); t7524 = (s4518 + s4534); t7525 = (s4519 + s4535); t7526 = (s4502 + t7524); t7527 = (s4503 + t7525); t7528 = (s4502 - (0.5*t7524)); t7529 = (s4503 - (0.5*t7525)); s4556 = (0.8660254037844386*(s4519 - s4535)); s4557 = (0.8660254037844386*(s4518 - s4534)); s4558 = ((D68[2]*t7526) - (D68[3]*t7527)); s4559 = ((D68[3]*t7526) + (D68[2]*t7527)); t7530 = (t7528 + s4556); t7531 = (t7529 - s4557); t7532 = (t7528 - s4556); t7533 = (t7529 + s4557); s4560 = ((D69[4]*t7530) - (D69[5]*t7531)); s4561 = ((D69[5]*t7530) + (D69[4]*t7531)); s4562 = ((D69[6]*t7532) - (D69[7]*t7533)); s4563 = ((D69[7]*t7532) + (D69[6]*t7533)); t7534 = (s4520 + s4536); t7535 = (s4521 + s4537); t7536 = (s4504 + t7534); t7537 = (s4505 + t7535); t7538 = (s4504 - (0.5*t7534)); t7539 = (s4505 - (0.5*t7535)); s4564 = (0.8660254037844386*(s4521 - s4537)); s4565 = (0.8660254037844386*(s4520 - s4536)); s4566 = ((D68[4]*t7536) - (D68[5]*t7537)); s4567 = ((D68[5]*t7536) + (D68[4]*t7537)); t7540 = (t7538 + s4564); t7541 = (t7539 - s4565); t7542 = (t7538 - s4564); t7543 = (t7539 + s4565); s4568 = ((D69[8]*t7540) - (D69[9]*t7541)); s4569 = ((D69[9]*t7540) + (D69[8]*t7541)); s4570 = ((D69[10]*t7542) - (D69[11]*t7543)); s4571 = ((D69[11]*t7542) + (D69[10]*t7543)); t7544 = (s4522 + s4538); t7545 = (s4523 + s4539); t7546 = (s4506 + t7544); t7547 = (s4507 + t7545); t7548 = (s4506 - (0.5*t7544)); t7549 = (s4507 - (0.5*t7545)); s4572 = (0.8660254037844386*(s4523 - s4539)); s4573 = (0.8660254037844386*(s4522 - s4538)); s4574 = ((D68[6]*t7546) - (D68[7]*t7547)); s4575 = ((D68[7]*t7546) + (D68[6]*t7547)); t7550 = (t7548 + s4572); t7551 = (t7549 - s4573); t7552 = (t7548 - s4572); t7553 = (t7549 + s4573); s4576 = ((D69[12]*t7550) - (D69[13]*t7551)); s4577 = ((D69[13]*t7550) + (D69[12]*t7551)); s4578 = ((D69[14]*t7552) - (D69[15]*t7553)); s4579 = ((D69[15]*t7552) + (D69[14]*t7553)); t7554 = (s4524 + s4540); t7555 = (s4525 + s4541); t7556 = (s4508 + t7554); t7557 = (s4509 + t7555); t7558 = (s4508 - (0.5*t7554)); t7559 = (s4509 - (0.5*t7555)); s4580 = (0.8660254037844386*(s4525 - s4541)); s4581 = (0.8660254037844386*(s4524 - s4540)); s4582 = ((D68[8]*t7556) - (D68[9]*t7557)); s4583 = ((D68[9]*t7556) + (D68[8]*t7557)); t7560 = (t7558 + s4580); t7561 = (t7559 - s4581); t7562 = (t7558 - s4580); t7563 = (t7559 + s4581); s4584 = ((D69[16]*t7560) - (D69[17]*t7561)); s4585 = ((D69[17]*t7560) + (D69[16]*t7561)); s4586 = ((D69[18]*t7562) - (D69[19]*t7563)); s4587 = ((D69[19]*t7562) + (D69[18]*t7563)); t7564 = (s4526 + s4542); t7565 = (s4527 + s4543); t7566 = (s4510 + t7564); t7567 = (s4511 + t7565); t7568 = (s4510 - (0.5*t7564)); t7569 = (s4511 - (0.5*t7565)); s4588 = (0.8660254037844386*(s4527 - s4543)); s4589 = (0.8660254037844386*(s4526 - s4542)); s4590 = ((D68[10]*t7566) - (D68[11]*t7567)); s4591 = ((D68[11]*t7566) + (D68[10]*t7567)); t7570 = (t7568 + s4588); t7571 = (t7569 - s4589); t7572 = (t7568 - s4588); t7573 = (t7569 + s4589); s4592 = ((D69[20]*t7570) - (D69[21]*t7571)); s4593 = ((D69[21]*t7570) + (D69[20]*t7571)); s4594 = ((D69[22]*t7572) - (D69[23]*t7573)); s4595 = ((D69[23]*t7572) + (D69[22]*t7573)); t7574 = (s4528 + s4544); t7575 = (s4529 + s4545); t7576 = (s4512 + t7574); t7577 = (s4513 + t7575); t7578 = (s4512 - (0.5*t7574)); t7579 = (s4513 - (0.5*t7575)); s4596 = (0.8660254037844386*(s4529 - s4545)); s4597 = (0.8660254037844386*(s4528 - s4544)); s4598 = ((D68[12]*t7576) - (D68[13]*t7577)); s4599 = ((D68[13]*t7576) + (D68[12]*t7577)); t7580 = (t7578 + s4596); t7581 = (t7579 - s4597); t7582 = (t7578 - s4596); t7583 = (t7579 + s4597); s4600 = ((D69[24]*t7580) - (D69[25]*t7581)); s4601 = ((D69[25]*t7580) + (D69[24]*t7581)); s4602 = ((D69[26]*t7582) - (D69[27]*t7583)); s4603 = ((D69[27]*t7582) + (D69[26]*t7583)); t7584 = (s4530 + s4546); t7585 = (s4531 + s4547); t7586 = (s4514 + t7584); t7587 = (s4515 + t7585); t7588 = (s4514 - (0.5*t7584)); t7589 = (s4515 - (0.5*t7585)); s4604 = (0.8660254037844386*(s4531 - s4547)); s4605 = (0.8660254037844386*(s4530 - s4546)); s4606 = ((D68[14]*t7586) - (D68[15]*t7587)); s4607 = ((D68[15]*t7586) + (D68[14]*t7587)); t7590 = (t7588 + s4604); t7591 = (t7589 - s4605); t7592 = (t7588 - s4604); t7593 = (t7589 + s4605); s4608 = ((D69[28]*t7590) - (D69[29]*t7591)); s4609 = ((D69[29]*t7590) + (D69[28]*t7591)); s4610 = ((D69[30]*t7592) - (D69[31]*t7593)); s4611 = ((D69[31]*t7592) + (D69[30]*t7593)); t7594 = (s4550 + s4582); t7595 = (s4551 + s4583); t7596 = (s4550 - s4582); t7597 = (s4551 - s4583); t7598 = (s4566 + s4598); t7599 = (s4567 + s4599); t7600 = (s4566 - s4598); t7601 = (s4567 - s4599); t7602 = (t7594 + t7598); t7603 = (t7595 + t7599); t7604 = (t7594 - t7598); t7605 = (t7595 - t7599); t7606 = (t7596 + t7601); t7607 = (t7597 - t7600); t7608 = (t7596 - t7601); t7609 = (t7597 + t7600); t7610 = (s4558 + s4590); t7611 = (s4559 + s4591); t7612 = (s4558 - s4590); t7613 = (s4559 - s4591); t7614 = (s4574 + s4606); t7615 = (s4575 + s4607); t7616 = (s4574 - s4606); t7617 = (s4575 - s4607); t7618 = (t7610 + t7614); t7619 = (t7611 + t7615); t7620 = (t7610 - t7614); t7621 = (t7611 - t7615); a10760 = (0.70710678118654757*(t7612 + t7617)); a10761 = (0.70710678118654757*(t7613 - t7616)); s4612 = (a10760 + a10761); s4613 = (a10761 - a10760); a10762 = (0.70710678118654757*(t7613 + t7616)); a10763 = (0.70710678118654757*(t7612 - t7617)); s4614 = (a10762 - a10763); s4615 = (a10763 + a10762); s4616 = (t7602 - t7618); s4617 = (t7603 - t7619); s4618 = (t7606 + s4612); s4619 = (t7607 + s4613); s4620 = (t7606 - s4612); s4621 = (t7607 - s4613); s4622 = (t7604 + t7621); s4623 = (t7605 - t7620); s4624 = (t7604 - t7621); s4625 = (t7605 + t7620); s4626 = (t7608 + s4614); s4627 = (t7609 - s4615); s4628 = (t7608 - s4614); s4629 = (t7609 + s4615); t7622 = (s4552 + s4584); t7623 = (s4553 + s4585); t7624 = (s4552 - s4584); t7625 = (s4553 - s4585); t7626 = (s4568 + s4600); t7627 = (s4569 + s4601); t7628 = (s4568 - s4600); t7629 = (s4569 - s4601); t7630 = (t7622 + t7626); t7631 = (t7623 + t7627); t7632 = (t7622 - t7626); t7633 = (t7623 - t7627); t7634 = (t7624 + t7629); t7635 = (t7625 - t7628); t7636 = (t7624 - t7629); t7637 = (t7625 + t7628); t7638 = (s4560 + s4592); t7639 = (s4561 + s4593); t7640 = (s4560 - s4592); t7641 = (s4561 - s4593); t7642 = (s4576 + s4608); t7643 = (s4577 + s4609); t7644 = (s4576 - s4608); t7645 = (s4577 - s4609); t7646 = (t7638 + t7642); t7647 = (t7639 + t7643); t7648 = (t7638 - t7642); t7649 = (t7639 - t7643); a10764 = (0.70710678118654757*(t7640 + t7645)); a10765 = (0.70710678118654757*(t7641 - t7644)); s4630 = (a10764 + a10765); s4631 = (a10765 - a10764); a10766 = (0.70710678118654757*(t7641 + t7644)); a10767 = (0.70710678118654757*(t7640 - t7645)); s4632 = (a10766 - a10767); s4633 = (a10767 + a10766); s4634 = (t7630 + t7646); s4635 = (t7631 + t7647); s4636 = (t7630 - t7646); s4637 = (t7631 - t7647); s4638 = (t7634 + s4630); s4639 = (t7635 + s4631); s4640 = (t7634 - s4630); s4641 = (t7635 - s4631); s4642 = (t7632 + t7649); s4643 = (t7633 - t7648); s4644 = (t7632 - t7649); s4645 = (t7633 + t7648); s4646 = (t7636 + s4632); s4647 = (t7637 - s4633); s4648 = (t7636 - s4632); s4649 = (t7637 + s4633); t7650 = (s4554 + s4586); t7651 = (s4555 + s4587); t7652 = (s4554 - s4586); t7653 = (s4555 - s4587); t7654 = (s4570 + s4602); t7655 = (s4571 + s4603); t7656 = (s4570 - s4602); t7657 = (s4571 - s4603); t7658 = (t7650 + t7654); t7659 = (t7651 + t7655); t7660 = (t7650 - t7654); t7661 = (t7651 - t7655); t7662 = (t7652 + t7657); t7663 = (t7653 - t7656); t7664 = (t7652 - t7657); t7665 = (t7653 + t7656); t7666 = (s4562 + s4594); t7667 = (s4563 + s4595); t7668 = (s4562 - s4594); t7669 = (s4563 - s4595); t7670 = (s4578 + s4610); t7671 = (s4579 + s4611); t7672 = (s4578 - s4610); t7673 = (s4579 - s4611); t7674 = (t7666 + t7670); t7675 = (t7667 + t7671); t7676 = (t7666 - t7670); t7677 = (t7667 - t7671); a10768 = (0.70710678118654757*(t7668 + t7673)); a10769 = (0.70710678118654757*(t7669 - t7672)); s4650 = (a10768 + a10769); s4651 = (a10769 - a10768); a10770 = (0.70710678118654757*(t7669 + t7672)); a10771 = (0.70710678118654757*(t7668 - t7673)); s4652 = (a10770 - a10771); s4653 = (a10771 + a10770); s4654 = (t7658 + t7674); s4655 = (t7659 + t7675); s4656 = (t7658 - t7674); s4657 = (t7659 - t7675); s4658 = (t7662 + s4650); s4659 = (t7663 + s4651); s4660 = (t7662 - s4650); s4661 = (t7663 - s4651); s4662 = (t7660 + t7677); s4663 = (t7661 - t7676); s4664 = (t7660 - t7677); s4665 = (t7661 + t7676); s4666 = (t7664 + s4652); s4667 = (t7665 - s4653); s4668 = (t7664 - s4652); s4669 = (t7665 + s4653); a10772 = (46*j1); a10773 = TW1[a10772]; a10774 = TW1[(a10772 + 1)]; a10775 = TW1[(a10772 + 2)]; a10776 = TW1[(a10772 + 3)]; a10777 = TW1[(a10772 + 4)]; a10778 = TW1[(a10772 + 5)]; a10779 = TW1[(a10772 + 6)]; a10780 = TW1[(a10772 + 7)]; a10781 = TW1[(a10772 + 8)]; a10782 = TW1[(a10772 + 9)]; a10783 = TW1[(a10772 + 10)]; a10784 = TW1[(a10772 + 11)]; a10785 = TW1[(a10772 + 12)]; a10786 = TW1[(a10772 + 13)]; a10787 = TW1[(a10772 + 14)]; a10788 = TW1[(a10772 + 15)]; a10789 = TW1[(a10772 + 16)]; a10790 = TW1[(a10772 + 17)]; a10791 = TW1[(a10772 + 18)]; a10792 = TW1[(a10772 + 19)]; a10793 = TW1[(a10772 + 20)]; a10794 = TW1[(a10772 + 21)]; a10795 = TW1[(a10772 + 22)]; a10796 = TW1[(a10772 + 23)]; a10797 = TW1[(a10772 + 24)]; a10798 = TW1[(a10772 + 25)]; a10799 = TW1[(a10772 + 26)]; a10800 = TW1[(a10772 + 27)]; a10801 = TW1[(a10772 + 28)]; a10802 = TW1[(a10772 + 29)]; a10803 = TW1[(a10772 + 30)]; a10804 = TW1[(a10772 + 31)]; a10805 = TW1[(a10772 + 32)]; a10806 = TW1[(a10772 + 33)]; a10807 = TW1[(a10772 + 34)]; a10808 = TW1[(a10772 + 35)]; a10809 = TW1[(a10772 + 36)]; a10810 = TW1[(a10772 + 37)]; a10811 = TW1[(a10772 + 38)]; a10812 = TW1[(a10772 + 39)]; a10813 = TW1[(a10772 + 40)]; a10814 = TW1[(a10772 + 41)]; a10815 = TW1[(a10772 + 42)]; a10816 = TW1[(a10772 + 43)]; a10817 = TW1[(a10772 + 44)]; a10818 = TW1[(a10772 + 45)]; a10819 = (48*a10735); a10820 = (a10734 + a10819); Y[a10820] = (t7602 + t7618); Y[(a10820 + 1)] = (t7603 + t7619); a10821 = (a10734 + (2*m1) + a10819); Y[a10821] = ((a10773*s4634) - (a10774*s4635)); Y[(a10821 + 1)] = ((a10774*s4634) + (a10773*s4635)); a10822 = (a10734 + (4*m1) + a10819); Y[a10822] = ((a10775*s4654) - (a10776*s4655)); Y[(a10822 + 1)] = ((a10776*s4654) + (a10775*s4655)); a10823 = (a10734 + (6*m1) + a10819); Y[a10823] = ((a10777*s4618) - (a10778*s4619)); Y[(a10823 + 1)] = ((a10778*s4618) + (a10777*s4619)); a10824 = (a10734 + (8*m1) + a10819); Y[a10824] = ((a10779*s4638) - (a10780*s4639)); Y[(a10824 + 1)] = ((a10780*s4638) + (a10779*s4639)); a10825 = (a10734 + (10*m1) + a10819); Y[a10825] = ((a10781*s4658) - (a10782*s4659)); Y[(a10825 + 1)] = ((a10782*s4658) + (a10781*s4659)); a10826 = (a10734 + (12*m1) + a10819); Y[a10826] = ((a10783*s4622) - (a10784*s4623)); Y[(a10826 + 1)] = ((a10784*s4622) + (a10783*s4623)); a10827 = (a10734 + (14*m1) + a10819); Y[a10827] = ((a10785*s4642) - (a10786*s4643)); Y[(a10827 + 1)] = ((a10786*s4642) + (a10785*s4643)); a10828 = (a10734 + (16*m1) + a10819); Y[a10828] = ((a10787*s4662) - (a10788*s4663)); Y[(a10828 + 1)] = ((a10788*s4662) + (a10787*s4663)); a10829 = (a10734 + (18*m1) + a10819); Y[a10829] = ((a10789*s4626) - (a10790*s4627)); Y[(a10829 + 1)] = ((a10790*s4626) + (a10789*s4627)); a10830 = (a10734 + (20*m1) + a10819); Y[a10830] = ((a10791*s4646) - (a10792*s4647)); Y[(a10830 + 1)] = ((a10792*s4646) + (a10791*s4647)); a10831 = (a10734 + (22*m1) + a10819); Y[a10831] = ((a10793*s4666) - (a10794*s4667)); Y[(a10831 + 1)] = ((a10794*s4666) + (a10793*s4667)); a10832 = (a10734 + (24*m1) + a10819); Y[a10832] = ((a10795*s4616) - (a10796*s4617)); Y[(a10832 + 1)] = ((a10796*s4616) + (a10795*s4617)); a10833 = (a10734 + (26*m1) + a10819); Y[a10833] = ((a10797*s4636) - (a10798*s4637)); Y[(a10833 + 1)] = ((a10798*s4636) + (a10797*s4637)); a10834 = (a10734 + (28*m1) + a10819); Y[a10834] = ((a10799*s4656) - (a10800*s4657)); Y[(a10834 + 1)] = ((a10800*s4656) + (a10799*s4657)); a10835 = (a10734 + (30*m1) + a10819); Y[a10835] = ((a10801*s4620) - (a10802*s4621)); Y[(a10835 + 1)] = ((a10802*s4620) + (a10801*s4621)); a10836 = (a10734 + (32*m1) + a10819); Y[a10836] = ((a10803*s4640) - (a10804*s4641)); Y[(a10836 + 1)] = ((a10804*s4640) + (a10803*s4641)); a10837 = (a10734 + (34*m1) + a10819); Y[a10837] = ((a10805*s4660) - (a10806*s4661)); Y[(a10837 + 1)] = ((a10806*s4660) + (a10805*s4661)); a10838 = (a10734 + (36*m1) + a10819); Y[a10838] = ((a10807*s4624) - (a10808*s4625)); Y[(a10838 + 1)] = ((a10808*s4624) + (a10807*s4625)); a10839 = (a10734 + (38*m1) + a10819); Y[a10839] = ((a10809*s4644) - (a10810*s4645)); Y[(a10839 + 1)] = ((a10810*s4644) + (a10809*s4645)); a10840 = (a10734 + (40*m1) + a10819); Y[a10840] = ((a10811*s4664) - (a10812*s4665)); Y[(a10840 + 1)] = ((a10812*s4664) + (a10811*s4665)); a10841 = (a10734 + (42*m1) + a10819); Y[a10841] = ((a10813*s4628) - (a10814*s4629)); Y[(a10841 + 1)] = ((a10814*s4628) + (a10813*s4629)); a10842 = (a10734 + (44*m1) + a10819); Y[a10842] = ((a10815*s4648) - (a10816*s4649)); Y[(a10842 + 1)] = ((a10816*s4648) + (a10815*s4649)); a10843 = (a10734 + (46*m1) + a10819); Y[a10843] = ((a10817*s4668) - (a10818*s4669)); Y[(a10843 + 1)] = ((a10818*s4668) + (a10817*s4669)); } } }
the_stack_data/176705625.c
/*********************************************************** Copyright 1992 by Stichting Mathematisch Centrum, Amsterdam, The Netherlands. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of Stichting Mathematisch Centrum or CWI not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE FOR ANY SPECIAL, 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. ******************************************************************/ /* ** Intel/DVI ADPCM coder/decoder. ** ** The algorithm for this coder was taken from the IMA Compatability Project ** proceedings, Vol 2, Number 2; May 1992. ** ** Version 1.2, 18-Dec-92. ** ** Change log: ** - Fixed a stupid bug, where the delta was computed as ** stepsize*code/4 in stead of stepsize*(code+0.5)/4. ** - There was an off-by-one error causing it to pick ** an incorrect delta once in a blue moon. ** - The NODIVMUL define has been removed. Computations are now always done ** using shifts, adds and subtracts. It turned out that, because the standard ** is defined using shift/add/subtract, you needed bits of fixup code ** (because the div/mul simulation using shift/add/sub made some rounding ** errors that real div/mul don't make) and all together the resultant code ** ran slower than just using the shifts all the time. ** - Changed some of the variable names to be more meaningful. */ #ifndef __STDC__ #define signed #endif typedef struct adpcm_state_t { short valprev; /* Previous output value */ char index; /* Index into stepsize table */ }adpcm_state; /* Intel ADPCM step variation table */ static int indexTable[16] = { -1, -1, -1, -1, 2, 4, 6, 8, -1, -1, -1, -1, 2, 4, 6, 8, }; static int stepsizeTable[89] = { 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 19, 21, 23, 25, 28, 31, 34, 37, 41, 45, 50, 55, 60, 66, 73, 80, 88, 97, 107, 118, 130, 143, 157, 173, 190, 209, 230, 253, 279, 307, 337, 371, 408, 449, 494, 544, 598, 658, 724, 796, 876, 963, 1060, 1166, 1282, 1411, 1552, 1707, 1878, 2066, 2272, 2499, 2749, 3024, 3327, 3660, 4026, 4428, 4871, 5358, 5894, 6484, 7132, 7845, 8630, 9493, 10442, 11487, 12635, 13899, 15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794, 32767 }; void adpcm_coder(short *indata, char *outdata, int len, adpcm_state *state) { short *inp; /* Input buffer pointer */ signed char *outp; /* output buffer pointer */ int val; /* Current input sample value */ int sign; /* Current adpcm sign bit */ int delta; /* Current adpcm output value */ int diff; /* Difference between val and valprev */ int step; /* Stepsize */ int valpred; /* Predicted output value */ int vpdiff; /* Current change to valpred */ int index; /* Current step change index */ int outputbuffer; /* place to keep previous 4-bit value */ int bufferstep; /* toggle between outputbuffer/output */ outp = (signed char *)outdata; inp = indata; valpred = state->valprev; index = state->index; step = stepsizeTable[index]; bufferstep = 1; for ( ; len > 0 ; len-- ) { val = *inp++; /* Step 1 - compute difference with previous value */ diff = val - valpred; sign = (diff < 0) ? 8 : 0; if ( sign ) diff = (-diff); /* Step 2 - Divide and clamp */ /* Note: ** This code *approximately* computes: ** delta = diff*4/step; ** vpdiff = (delta+0.5)*step/4; ** but in shift step bits are dropped. The net result of this is ** that even if you have fast mul/div hardware you cannot put it to ** good use since the fixup would be too expensive. */ delta = 0; vpdiff = (step >> 3); if ( diff >= step ) { delta = 4; diff -= step; vpdiff += step; } step >>= 1; if ( diff >= step ) { delta |= 2; diff -= step; vpdiff += step; } step >>= 1; if ( diff >= step ) { delta |= 1; vpdiff += step; } /* Step 3 - Update previous value */ if ( sign ) valpred -= vpdiff; else valpred += vpdiff; /* Step 4 - Clamp previous value to 16 bits */ if ( valpred > 32767 ) valpred = 32767; else if ( valpred < -32768 ) valpred = -32768; /* Step 5 - Assemble value, update index and step values */ delta |= sign; index += indexTable[delta]; if ( index < 0 ) index = 0; if ( index > 88 ) index = 88; step = stepsizeTable[index]; /* Step 6 - Output value */ if ( bufferstep ) { outputbuffer = (delta << 4) & 0xf0; } else { *outp++ = (delta & 0x0f) | outputbuffer; } bufferstep = !bufferstep; } /* Output last step, if needed */ if ( !bufferstep ) *outp++ = outputbuffer; state->valprev = valpred; state->index = index; } // ADPCM->PCM,解码 // indata:数据源 // outdata:输出数据 // len:indata的长度*2 // 最终输出的数据长度为:indata的长度*4 void adpcm_decoder(char *indata, short *outdata, int len, adpcm_state *state) { signed char *inp; /* Input buffer pointer */ short *outp; /* output buffer pointer */ int sign; /* Current adpcm sign bit */ int delta; /* Current adpcm output value */ int step; /* Stepsize */ int valpred; /* Predicted value */ int vpdiff; /* Current change to valpred */ int index; /* Current step change index */ int inputbuffer; /* place to keep next 4-bit value */ int bufferstep; /* toggle between inputbuffer/input */ outp = outdata; inp = (signed char *)indata; valpred = state->valprev; index = state->index; step = stepsizeTable[index]; bufferstep = 0; for ( ; len > 0 ; len-- ) { /* Step 1 - get the delta value */ if ( bufferstep ) { delta = inputbuffer & 0xf; } else { inputbuffer = *inp++; delta = (inputbuffer >> 4) & 0xf; } bufferstep = !bufferstep; /* Step 2 - Find new index value (for later) */ index += indexTable[delta]; if ( index < 0 ) index = 0; if ( index > 88 ) index = 88; /* Step 3 - Separate sign and magnitude */ sign = delta & 8; delta = delta & 7; /* Step 4 - Compute difference and new predicted value */ /* ** Computes 'vpdiff = (delta+0.5)*step/4', but see comment ** in adpcm_coder. */ vpdiff = step >> 3; if ( delta & 4 ) vpdiff += step; if ( delta & 2 ) vpdiff += step>>1; if ( delta & 1 ) vpdiff += step>>2; if ( sign ) valpred -= vpdiff; else valpred += vpdiff; /* Step 5 - clamp output value */ if ( valpred > 32767 ) valpred = 32767; else if ( valpred < -32768 ) valpred = -32768; /* Step 6 - Update step value */ step = stepsizeTable[index]; /* Step 7 - Output value */ *outp++ = valpred; } state->valprev = valpred; state->index = index; }
the_stack_data/113966.c
/* crypto/des/rand_key.c */ /* ==================================================================== * Copyright (c) 1998-2000 The OpenSSL 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. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * [email protected]. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.openssl.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED 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 OpenSSL PROJECT OR * ITS 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. * ==================================================================== * * This product includes cryptographic software written by Eric Young * ([email protected]). This product includes software written by Tim * Hudson ([email protected]). * */ #include <openssl/des.h> #include <openssl/rand.h> int DES_random_key(DES_cblock *ret) { do { if (RAND_bytes((unsigned char *)ret, sizeof(DES_cblock)) != 1) return (0); } while (DES_is_weak_key(ret)); DES_set_odd_parity(ret); return (1); }
the_stack_data/218893709.c
#include <stdio.h> #include <stdlib.h> struct node { int key; struct node *left, *right; }; struct node *newNode(int item) { struct node *temp = (struct node *)malloc(sizeof(struct node)); temp->key = item; temp->left = temp->right = NULL; return temp; } // preorder Traversal void preorderTraversal(struct node *root) { if (root != NULL) { printf("%d ", root->key); preorderTraversal(root->left); preorderTraversal(root->right); } } struct node *insert(struct node *node, int key) { // Return a new node if the tree is empty if (node == NULL) return newNode(key); if (key < node->key) node->left = insert(node->left, key); else node->right = insert(node->right, key); return node; } void inorderTraversal(struct node *root) { if (root != NULL) { inorderTraversal(root->left); printf("%d ", root->key); inorderTraversal(root->right); } } //k_max void kth_max(struct node *root, int k) { static int count = 0; if (root == NULL) return; if (count <= k) { /* first recur on left child */ kth_max(root->left, k); count++; // when count = n then print element if (count == k) printf("%d ", root->key); /* now recur on right child */ kth_max(root->right, k); } } int main() { struct node *root=NULL; printf("Enter the elements of the BST \n"); printf("Enter -1 to stop \n"); int i,j; j=1; for(i=0;i<j;i++){ int num; scanf("%d",&num); if (num==-1){ break; } else{ root=insert(root,num); j++; } } printf("The Preorder Traversal is :\n"); preorderTraversal(root); printf("\nThe Inorder Traversal is :\n"); inorderTraversal(root); printf("\nEnter k value: \n"); int k; scanf("%d",&k); printf("the %d largest element is :",k); kth_max(root,k); }
the_stack_data/75138818.c
#include<stdio.h> #include<stdlib.h> int main(){ int* data = (int *)malloc(100*sizeof(int)); data[100] = 0; free(data); return 0; }
the_stack_data/218892481.c
/*Program to generate a table of prime numbers*/ #include <stdio.h> int main (void) { int p, d; _Bool isPrime; for ( p = 2; p <= 50; ++p ) { isPrime = 1; for ( d = 2; d < p; ++d ) { if ( p % d == 0 ) { isPrime = 0; } } if ( isPrime ) { printf ("%i ", p); } } printf ("\n"); return 0; }
the_stack_data/73695.c
int printf(const char*, ...); int i; void fizzbuzz() { int save = i; if (i % 3 == 0) { i = 4; printf("fizz"); } if (i % 5 == 0) { printf("buzz"); } if ((i % 3 != 0) && (i % 5 != 0)) { printf("%d", i); } i = save; } int main() { for (i = 1; i < 16; i++) { fizzbuzz(); printf("\n"); } }
the_stack_data/225143190.c
/* * who1.c - a first version of the who program * open,read UTMP file, and show results. * */ #include <stdio.h> #include <utmp.h> #include <fcntl.h> #include <unistd.h> #include <stdlib.h> #include <time.h> #include <sys/types.h> /* * display contents of the utmp struct in human readable format */ void show_info(struct utmp * ut_buf_p){ printf("%-8.8s", ut_buf_p->ut_user); printf(" "); printf("%-8.8s", ut_buf_p->ut_line); printf(" "); long sec = (long)ut_buf_p->ut_tv.tv_sec; printf("%s", ctime(&sec)); printf("(%s)", ut_buf_p->ut_host); printf("\n"); } int main(){ struct utmp current_record; int utmpfd; size_t rec_len = sizeof(struct utmp); if (( utmpfd = open("/var/run/utmp", O_RDONLY)) == -1){ perror(UTMP_FILE); exit(-1); } while ((read(utmpfd, &current_record, rec_len) == rec_len)){ show_info(&current_record); } close(utmpfd); return 0; }
the_stack_data/15762475.c
#include <stdio.h> #include <ctype.h> extern int dump_flag; #ifdef TEST main() { static void dump_packet(unsigned char *ptr,int len); char rbuff[128]; sprintf(rbuff,"SIP/2.0 %d %s\r\nVia:SIP\r\n\r\n",200,"OK"); dump_packet(rbuff,strlen(rbuff)); // AnalyzePDU(rbuff,strlen(rbuff),&mes); } #endif void dump_packet(unsigned char *ptr,int len) { unsigned char *ptr1,*ptr2; int count1=0; int count2=0; int i,j,k; char c; printf("Packet len = %d(0x%X)bytes\n",len,len); for(i=0;;i++){ ptr1=ptr2=ptr+i*16 ; for(j=0;j<16;j++){ printf("%02X",*ptr2++); if(j==7){ printf(" - "); }else{ printf(" "); } count1++; if(count1 >= len ) break; } k = 16 - j-1; for(j=0; j < k ; j++) printf(" "); if(k > 8 ) printf(" "); ptr2=ptr1; for(j=0;j<16;j++){ if(isprint(*ptr2)){ c=*ptr2; } else{ c='.'; } ptr2++; printf("%1c",c); if(j==7){ printf(" "); } count2++; if(count2 >= len ) {printf("\n\n");return ;} } printf("\n"); } } /************************/
the_stack_data/179829514.c
// RUN: %clang_cc1 -emit-llvm -o - -O0 -triple x86_64-apple-darwin10 %s | FileCheck %s // Ensure that we don't emit available_externally functions at -O0. int x; inline void f0(int y) { x = y; } // CHECK: define void @test() // CHECK: declare void @f0(i32) void test() { f0(17); } inline int __attribute__((always_inline)) f1(int x) { int blarg = 0; for (int i = 0; i < x; ++i) blarg = blarg + x * i; return blarg; } // CHECK: @test1 int test1(int x) { // CHECK: br i1 // CHECK-NOT: call {{.*}} @f1 // CHECK: ret i32 return f1(x); }
the_stack_data/104828796.c
/** * @file simple_uptime.c * @version 1.4 * @brief Display uptime as: N days, HH:MM:SS.\n * Ex: 1 day, 02:34:56 * * @detail * A fast, simple uptime command for Linux.\n * And, it's 0.001s faster than the default uptime command! * * @author Ryan Jacobs <[email protected]> * @date September 22, 2014 * @bug No known bugs. */ #include <stdio.h> #include <sys/sysinfo.h> int main(void) { long int remainder; struct sysinfo s_info; unsigned int days, hours, minutes, seconds; if (sysinfo(&s_info) == -1) { perror("error: sysinfo"); return 1; } seconds = s_info.uptime; days = seconds / (60 * 60 * 24); remainder = seconds % (60 * 60 * 24); hours = remainder / (60 * 60); remainder = remainder % (60 * 60); minutes = remainder / 60; seconds = remainder % 60; printf("%u %s, %02u:%02u:%02u\n", days, (days == 1 ? "day" : "days"), hours, minutes, seconds); return 0; }
the_stack_data/225142218.c
// // This file is part of the Bones source-to-source compiler examples. This C-code // example is meant to illustrate the use of Bones. For more information on Bones // use the contact information below. // // == More information on Bones // Contact............Cedric Nugteren <[email protected]> // Web address........http://parse.ele.tue.nl/bones/ // // == File information // Filename...........neighbourhood/example02.c // Author.............Cedric Nugteren // Last modified on...10-October-2014 // #include <stdio.h> #define A 256 #define B 512 // This is 'example02', demonstrating a 2D array, a 2D neighbourhood and a for-loop-less notation of the neighbourhood accesses int main(void) { int i,j; // Declare input/output arrays float in[A][B]; float out[A][B]; // Set the input data for(i=0;i<A;i++) { for(j=0;j<B;j++) { in[i][j] = i+j; } } // Perform the computation #pragma scop { #pragma species kernel in[0:A-1,0:B-1]|neighbourhood(-1:1,-1:1) -> out[0:A-1,0:B-1]|element for (i = 0; i < A; i++) { for (j = 0; j < B; j++) { if (i >= 1 && j >= 1 && i < A - 1 && j < B - 1) { out[i][j] = (in[i + 1][j + 1] + in[i + 1][j] + in[i + 1][j - 1] + in[i][j + 1] + in[i][j] + in[i][j - 1] + in[i - 1][j + 1] + in[i - 1][j] + in[i - 1][j - 1]) / 9.0; } else { out[i][j] = in[i][j]; } } } #pragma species endkernel example02_k1 } #pragma endscop // Clean-up and exit the function fflush(stdout); return 0; }
the_stack_data/22955.c
/* * lin-x86-cntsockcode.c * Copyright 2004 Ramon de Carvalho Valle <[email protected]> * * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #define CNTSOCKADDR 18 #define CNTSOCKPORT 24 char cntsockcode[]= /* 71 bytes */ "\x31\xdb" /* xorl %ebx,%ebx */ "\xf7\xe3" /* mull %ebx */ "\x53" /* pushl %ebx */ "\x43" /* incl %ebx */ "\x53" /* pushl %ebx */ "\x6a\x02" /* pushl $0x02 */ "\x89\xe1" /* movl %esp,%ecx */ "\xb0\x66" /* movb $0x66,%al */ "\xcd\x80" /* int $0x80 */ "\x5b" /* popl %ebx */ "\x5e" /* popl %esi */ "\x68\x7f\x00\x00\x01" /* pushl $0x0100007f */ "\x66\x68\x04\xd2" /* pushw $0xd204 */ "\x66\x53" /* pushw %bx */ "\x6a\x10" /* pushl $0x10 */ "\x51" /* pushl %ecx */ "\x50" /* pushl %eax */ "\x89\xe1" /* movl %esp,%ecx */ "\x43" /* incl %ebx */ "\x6a\x66" /* pushl $0x66 */ "\x58" /* popl %eax */ "\xcd\x80" /* int $0x80 */ "\x59" /* popl %ecx */ "\x87\xd9" /* xchgl %ebx,%ecx */ "\xb0\x3f" /* movb $0x3f,%al */ "\xcd\x80" /* int $0x80 */ "\x49" /* decl %ecx */ "\x79\xf9" /* jns <cntsockcode+43> */ "\x50" /* pushl %eax */ "\x68\x2f\x2f\x73\x68" /* pushl $0x68732f2f */ "\x68\x2f\x62\x69\x6e" /* pushl $0x6e69622f */ "\x89\xe3" /* movl %esp,%ebx */ "\x50" /* pushl %eax */ "\x53" /* pushl %ebx */ "\x89\xe1" /* movl %esp,%ecx */ "\xb0\x0b" /* movb $0x0b,%al */ "\xcd\x80" /* int $0x80 */ ;
the_stack_data/37637984.c
//===-- CBackend.cpp - Library for converting LLVM code to C //----------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------------------------------===// // // This code tests to see that the CBE can handle the // Binary Shift Right (a>>b) bitwise operator. // *TW //===------------------------------------------------------------------------===// int main() { unsigned int a = 13; // 1100 unsigned int b = 0; b = a >> 1; // 0110 if (b == 6) { return 6; } return 1; }
the_stack_data/11074292.c
// // Created by kaiser on 18-10-11. // #include <limits.h> int threefourths(int x) { int high = x & ~0x3; int low = x & 0x3; int highd4 = high >> 2; int highd4m3 = (highd4 << 1) + highd4; int neg = x & INT_MIN; int lowm3 = (low << 1) + low; !neg || (lowm3 = lowm3 + (1 << 2) - 1); int lowm3d4 = lowm3 >> 2; return highd4m3 + lowm3d4; }
the_stack_data/7950373.c
#include <stdlib.h> int main(int argc, char **argv) { return system("git rev-parse --abbrev-ref HEAD"); }
the_stack_data/626534.c
#include <stdio.h> #include <stdlib.h> #include <assert.h> int main() { fprintf(stderr, "This file demonstrates a simple double-free attack with fastbins.\n"); fprintf(stderr, "Allocating 3 buffers.\n"); int *a = malloc(8); int *b = malloc(8); int *c = malloc(8); fprintf(stderr, "1st malloc(8): %p\n", a); fprintf(stderr, "2nd malloc(8): %p\n", b); fprintf(stderr, "3rd malloc(8): %p\n", c); fprintf(stderr, "Freeing the first one...\n"); free(a); fprintf(stderr, "If we free %p again, things will crash because %p is at the top of the free list.\n", a, a); // free(a); fprintf(stderr, "So, instead, we'll free %p.\n", b); free(b); fprintf(stderr, "Now, we can free %p again, since it's not the head of the free list.\n", a); free(a); fprintf(stderr, "Now the free list has [ %p, %p, %p ]. If we malloc 3 times, we'll get %p twice!\n", a, b, a, a); a = malloc(8); b = malloc(8); c = malloc(8); fprintf(stderr, "1st malloc(8): %p\n", a); fprintf(stderr, "2nd malloc(8): %p\n", b); fprintf(stderr, "3rd malloc(8): %p\n", c); assert(a == c); }
the_stack_data/151705441.c
//07. Write a program that asks for 2 numbers to the user and show product by sums. Use while loop. #include <stdio.h> int main() { int number01 = 0; int number02 = 0; int product = 0; printf("Introduce one number: "); scanf_s("%i", &number01); printf("Introduce one number: "); scanf_s("%i", &number02); printf("%i * %i\n", number01, number02); while (number02 > 0) { product += number01; number02--; if (number02 == 0) printf("%i", number01); else printf("%i + ", number01); } printf(" = %i\n", product); return 0; }
the_stack_data/708207.c
#include <unistd.h> #include <stdio.h> int main(int argc, char *argv[]) { unsigned int i,j; while(1) { j = 1; for(i = 1; i <= 10; i++) { j = j*i; } } }
the_stack_data/1078555.c
// Check for const before and after pointers typedef int * const ipc_t; int main() { register ipc_t p; register int * const q; return 0; }
the_stack_data/20406.c
#ifndef THC_GENERIC_FILE #define THC_GENERIC_FILE "generic/THCTensor.c" #else /**** access methods ****/ THCStorage *THCTensor_(storage)(THCState *state, const THCTensor *self) { return self->storage; } ptrdiff_t THCTensor_(storageOffset)(THCState *state, const THCTensor *self) { return self->storageOffset; } int THCTensor_(nDimension)(THCState *state, const THCTensor *self) { return self->nDimension; } long THCTensor_(size)(THCState *state, const THCTensor *self, int dim) { THArgCheck((dim >= 0) && (dim < self->nDimension), 2, "out of range"); return self->size[dim]; } long THCTensor_(stride)(THCState *state, const THCTensor *self, int dim) { THArgCheck((dim >= 0) && (dim < self->nDimension), 2, "out of range"); return self->stride[dim]; } THLongStorage *THCTensor_(newSizeOf)(THCState *state, THCTensor *self) { THLongStorage *size = THLongStorage_newWithSize(self->nDimension); THLongStorage_rawCopy(size, self->size); return size; } THLongStorage *THCTensor_(newStrideOf)(THCState *state, THCTensor *self) { THLongStorage *stride = THLongStorage_newWithSize(self->nDimension); THLongStorage_rawCopy(stride, self->stride); return stride; } real *THCTensor_(data)(THCState *state, const THCTensor *self) { if(self->storage) return (self->storage->data+self->storageOffset); else return NULL; } void THCTensor_(setFlag)(THCState *state, THCTensor *self, const char flag) { self->flag |= flag; } void THCTensor_(clearFlag)(THCState *state, THCTensor *self, const char flag) { self->flag &= ~flag; } /**** creation methods ****/ static void THCTensor_(rawInit)(THCState *state, THCTensor *self); static void THCTensor_(rawSet)(THCState *state, THCTensor *self, THCStorage *storage, ptrdiff_t storageOffset, int nDimension, long *size, long *stride); /* Empty init */ THCTensor *THCTensor_(new)(THCState *state) { THCTensor *self = (THCTensor*)THAlloc(sizeof(THCTensor)); THCTensor_(rawInit)(state, self); return self; } /* Pointer-copy init */ THCTensor *THCTensor_(newWithTensor)(THCState *state, THCTensor *tensor) { THCTensor *self = (THCTensor*)THAlloc(sizeof(THCTensor)); THCTensor_(rawInit)(state, self); THCTensor_(rawSet)(state, self, tensor->storage, tensor->storageOffset, tensor->nDimension, tensor->size, tensor->stride); return self; } /* Storage init */ THCTensor *THCTensor_(newWithStorage)(THCState *state, THCStorage *storage, ptrdiff_t storageOffset, THLongStorage *size, THLongStorage *stride) { THCTensor *self = (THCTensor*)THAlloc(sizeof(THCTensor)); if(size && stride) THArgCheck(size->size == stride->size, 4, "inconsistent size"); THCTensor_(rawInit)(state, self); THCTensor_(rawSet)(state, self, storage, storageOffset, (size ? size->size : (stride ? stride->size : 0)), (size ? size->data : NULL), (stride ? stride->data : NULL)); return self; } THCTensor *THCTensor_(newWithStorage1d)(THCState *state, THCStorage *storage, ptrdiff_t storageOffset, long size0, long stride0) { return THCTensor_(newWithStorage4d)(state, storage, storageOffset, size0, stride0, -1, -1, -1, -1, -1, -1); } THCTensor *THCTensor_(newWithStorage2d)(THCState *state, THCStorage *storage, ptrdiff_t storageOffset, long size0, long stride0, long size1, long stride1) { return THCTensor_(newWithStorage4d)(state, storage, storageOffset, size0, stride0, size1, stride1, -1, -1, -1, -1); } THCTensor *THCTensor_(newWithStorage3d)(THCState *state, THCStorage *storage, ptrdiff_t storageOffset, long size0, long stride0, long size1, long stride1, long size2, long stride2) { return THCTensor_(newWithStorage4d)(state, storage, storageOffset, size0, stride0, size1, stride1, size2, stride2, -1, -1); } THCTensor *THCTensor_(newWithStorage4d)(THCState *state, THCStorage *storage, ptrdiff_t storageOffset, long size0, long stride0, long size1, long stride1, long size2, long stride2, long size3, long stride3) { long size[4] = {size0, size1, size2, size3}; long stride[4] = {stride0, stride1, stride2, stride3}; THCTensor *self = (THCTensor*)THAlloc(sizeof(THCTensor)); THCTensor_(rawInit)(state, self); THCTensor_(rawSet)(state, self, storage, storageOffset, 4, size, stride); return self; } THCTensor *THCTensor_(newWithSize)(THCState *state, THLongStorage *size, THLongStorage *stride) { return THCTensor_(newWithStorage)(state, NULL, 0, size, stride); } THCTensor *THCTensor_(newWithSize1d)(THCState *state, long size0) { return THCTensor_(newWithSize4d)(state, size0, -1, -1, -1); } THCTensor *THCTensor_(newWithSize2d)(THCState *state, long size0, long size1) { return THCTensor_(newWithSize4d)(state, size0, size1, -1, -1); } THCTensor *THCTensor_(newWithSize3d)(THCState *state, long size0, long size1, long size2) { return THCTensor_(newWithSize4d)(state, size0, size1, size2, -1); } THCTensor *THCTensor_(newWithSize4d)(THCState *state, long size0, long size1, long size2, long size3) { long size[4] = {size0, size1, size2, size3}; THCTensor *self = (THCTensor*)THAlloc(sizeof(THCTensor)); THCTensor_(rawInit)(state, self); THCTensor_(rawResize)(state, self, 4, size, NULL); return self; } THCTensor *THCTensor_(newClone)(THCState *state, THCTensor *self) { THCTensor *tensor = THCTensor_(new)(state); THCTensor_(resizeAs)(state, tensor, self); THCTensor_(copy)(state, tensor, self); return tensor; } THCTensor *THCTensor_(newContiguous)(THCState *state, THCTensor *self) { if(!THCTensor_(isContiguous)(state, self)) return THCTensor_(newClone)(state, self); else { THCTensor_(retain)(state, self); return self; } } THCTensor *THCTensor_(newSelect)(THCState *state, THCTensor *tensor, int dimension_, long sliceIndex_) { THCTensor *self = THCTensor_(newWithTensor)(state, tensor); THCTensor_(select)(state, self, NULL, dimension_, sliceIndex_); return self; } THCTensor *THCTensor_(newNarrow)(THCState *state, THCTensor *tensor, int dimension_, long firstIndex_, long size_) { THCTensor *self = THCTensor_(newWithTensor)(state, tensor); THCTensor_(narrow)(state, self, NULL, dimension_, firstIndex_, size_); return self; } THCTensor *THCTensor_(newTranspose)(THCState *state, THCTensor *tensor, int dimension1_, int dimension2_) { THCTensor *self = THCTensor_(newWithTensor)(state, tensor); THCTensor_(transpose)(state, self, NULL, dimension1_, dimension2_); return self; } THCTensor *THCTensor_(newUnfold)(THCState *state, THCTensor *tensor, int dimension_, long size_, long step_) { THCTensor *self = THCTensor_(newWithTensor)(state, tensor); THCTensor_(unfold)(state, self, NULL, dimension_, size_, step_); return self; } /* Resize */ void THCTensor_(resize)(THCState *state, THCTensor *self, THLongStorage *size, THLongStorage *stride) { THArgCheck(size != NULL, 2, "invalid size"); if(stride) THArgCheck(stride->size == size->size, 3, "invalid stride"); THCTensor_(rawResize)(state, self, size->size, size->data, (stride ? stride->data : NULL)); } void THCTensor_(resizeAs)(THCState *state, THCTensor *self, THCTensor *src) { int isSame = 0; int d; if(self->nDimension == src->nDimension) { isSame = 1; for(d = 0; d < self->nDimension; d++) { if(self->size[d] != src->size[d]) { isSame = 0; break; } } } if(!isSame) THCTensor_(rawResize)(state, self, src->nDimension, src->size, NULL); } void THCTensor_(resize1d)(THCState *state, THCTensor *tensor, long size0) { THCTensor_(resize4d)(state, tensor, size0, -1, -1, -1); } void THCTensor_(resize2d)(THCState *state, THCTensor *tensor, long size0, long size1) { THCTensor_(resize4d)(state, tensor, size0, size1, -1, -1); } void THCTensor_(resize3d)(THCState *state, THCTensor *tensor, long size0, long size1, long size2) { THCTensor_(resize4d)(state, tensor, size0, size1, size2, -1); } void THCTensor_(resize4d)(THCState *state, THCTensor *self, long size0, long size1, long size2, long size3) { long size[4] = {size0, size1, size2, size3}; THCTensor_(rawResize)(state, self, 4, size, NULL); } void THCTensor_(resize5d)(THCState *state, THCTensor *self, long size0, long size1, long size2, long size3, long size4) { long size[5] = {size0, size1, size2, size3, size4}; THCTensor_(rawResize)(state, self, 5, size, NULL); } void THCTensor_(set)(THCState *state, THCTensor *self, THCTensor *src) { if(self != src) THCTensor_(rawSet)(state, self, src->storage, src->storageOffset, src->nDimension, src->size, src->stride); } void THCTensor_(setStorage)(THCState *state, THCTensor *self, THCStorage *storage_, ptrdiff_t storageOffset_, THLongStorage *size_, THLongStorage *stride_) { if(size_ && stride_) THArgCheck(size_->size == stride_->size, 5, "inconsistent size/stride sizes"); THCTensor_(rawSet)(state, self, storage_, storageOffset_, (size_ ? size_->size : (stride_ ? stride_->size : 0)), (size_ ? size_->data : NULL), (stride_ ? stride_->data : NULL)); } void THCTensor_(setStorage1d)(THCState *state, THCTensor *self, THCStorage *storage_, ptrdiff_t storageOffset_, long size0_, long stride0_) { THCTensor_(setStorage4d)(state, self, storage_, storageOffset_, size0_, stride0_, -1, -1, -1, -1, -1, -1); } void THCTensor_(setStorage2d)(THCState *state, THCTensor *self, THCStorage *storage_, ptrdiff_t storageOffset_, long size0_, long stride0_, long size1_, long stride1_) { THCTensor_(setStorage4d)(state, self, storage_, storageOffset_, size0_, stride0_, size1_, stride1_, -1, -1, -1, -1); } void THCTensor_(setStorage3d)(THCState *state, THCTensor *self, THCStorage *storage_, ptrdiff_t storageOffset_, long size0_, long stride0_, long size1_, long stride1_, long size2_, long stride2_) { THCTensor_(setStorage4d)(state, self, storage_, storageOffset_, size0_, stride0_, size1_, stride1_, size2_, stride2_, -1, -1); } void THCTensor_(setStorage4d)(THCState *state, THCTensor *self, THCStorage *storage_, ptrdiff_t storageOffset_, long size0_, long stride0_, long size1_, long stride1_, long size2_, long stride2_, long size3_, long stride3_) { long size[4] = {size0_, size1_, size2_, size3_}; long stride[4] = {stride0_, stride1_, stride2_, stride3_}; THCTensor_(rawSet)(state, self, storage_, storageOffset_, 4, size, stride); } void THCTensor_(narrow)(THCState *state, THCTensor *self, THCTensor *src, int dimension, long firstIndex, long size) { if(!src) src = self; THArgCheck( (dimension >= 0) && (dimension < src->nDimension), 3, "out of range"); THArgCheck( (firstIndex >= 0) && (firstIndex < src->size[dimension]), 4, "out of range"); THArgCheck( (size > 0) && (firstIndex+size <= src->size[dimension]), 5, "out of range"); THCTensor_(set)(state, self, src); if(firstIndex > 0) self->storageOffset += firstIndex*self->stride[dimension]; self->size[dimension] = size; } void THCTensor_(select)(THCState *state, THCTensor *self, THCTensor *src, int dimension, long sliceIndex) { int d; if(!src) src = self; THArgCheck(src->nDimension > 1, 1, "cannot select on a vector"); THArgCheck((dimension >= 0) && (dimension < src->nDimension), 3, "out of range"); THArgCheck((sliceIndex >= 0) && (sliceIndex < src->size[dimension]), 4, "out of range"); THCTensor_(set)(state, self, src); THCTensor_(narrow)(state, self, NULL, dimension, sliceIndex, 1); for(d = dimension; d < self->nDimension-1; d++) { self->size[d] = self->size[d+1]; self->stride[d] = self->stride[d+1]; } self->nDimension--; } void THCTensor_(transpose)(THCState *state, THCTensor *self, THCTensor *src, int dimension1, int dimension2) { long z; if(!src) src = self; THArgCheck( (dimension1 >= 0) && (dimension1 < src->nDimension), 1, "out of range"); THArgCheck( (dimension2 >= 0) && (dimension2 < src->nDimension), 2, "out of range"); THCTensor_(set)(state, self, src); if(dimension1 == dimension2) return; z = self->stride[dimension1]; self->stride[dimension1] = self->stride[dimension2]; self->stride[dimension2] = z; z = self->size[dimension1]; self->size[dimension1] = self->size[dimension2]; self->size[dimension2] = z; } void THCTensor_(unfold)(THCState *state, THCTensor *self, THCTensor *src, int dimension, long size, long step) { long *newSize; long *newStride; int d; if(!src) src = self; THArgCheck( (src->nDimension > 0), 1, "cannot unfold an empty tensor"); THArgCheck(dimension < src->nDimension, 2, "out of range"); THArgCheck(size <= src->size[dimension], 3, "out of range"); THArgCheck(step > 0, 4, "invalid step"); THCTensor_(set)(state, self, src); newSize = (long*)THAlloc(sizeof(long)*(self->nDimension+1)); newStride = (long*)THAlloc(sizeof(long)*(self->nDimension+1)); newSize[self->nDimension] = size; newStride[self->nDimension] = self->stride[dimension]; for(d = 0; d < self->nDimension; d++) { if(d == dimension) { newSize[d] = (self->size[d] - size) / step + 1; newStride[d] = step*self->stride[d]; } else { newSize[d] = self->size[d]; newStride[d] = self->stride[d]; } } THFree(self->size); THFree(self->stride); self->size = newSize; self->stride = newStride; self->nDimension++; } /* we have to handle the case where the result is a number */ void THCTensor_(squeeze)(THCState *state, THCTensor *self, THCTensor *src) { int ndim = 0; int d; if(!src) src = self; THCTensor_(set)(state, self, src); for(d = 0; d < src->nDimension; d++) { if(src->size[d] != 1) { if(d != ndim) { self->size[ndim] = src->size[d]; self->stride[ndim] = src->stride[d]; } ndim++; } } /* right now, we do not handle 0-dimension tensors */ if(ndim == 0 && src->nDimension > 0) { self->size[0] = 1; self->stride[0] = 1; ndim = 1; } self->nDimension = ndim; } void THCTensor_(squeeze1d)(THCState *state, THCTensor *self, THCTensor *src, int dimension) { int d; if(!src) src = self; THArgCheck(dimension < src->nDimension, 3, "dimension out of range"); THCTensor_(set)(state, self, src); if(src->size[dimension] == 1 && src->nDimension > 1) { for(d = dimension; d < self->nDimension-1; d++) { self->size[d] = self->size[d+1]; self->stride[d] = self->stride[d+1]; } self->nDimension--; } } int THCTensor_(isContiguous)(THCState *state, const THCTensor *self) { long z = 1; int d; for(d = self->nDimension-1; d >= 0; d--) { if(self->size[d] != 1) { if(self->stride[d] == z) z *= self->size[d]; else return 0; } } return 1; } int THCTensor_(isSize)(THCState *state, const THCTensor *self, const THLongStorage *dims) { int d; if (self->nDimension != dims->size) return 0; for (d = 0; d < self->nDimension; ++d) { if (self->size[d] != dims->data[d]) return 0; } return 1; } int THCTensor_(isSetTo)(THCState *state, const THCTensor *self, const THCTensor *src) { if (self->storage == src->storage && self->storageOffset == src->storageOffset && self->nDimension == src->nDimension) { int d; for (d = 0; d < self->nDimension; ++d) { if (self->size[d] != src->size[d] || self->stride[d] != src->stride[d]) return 0; } return 1; } return 0; } int THCTensor_(isSameSizeAs)(THCState *state, const THCTensor *self, const THCTensor* src) { int d; if (self->nDimension != src->nDimension) return 0; for(d = 0; d < self->nDimension; ++d) { if(self->size[d] != src->size[d]) return 0; } return 1; } ptrdiff_t THCTensor_(nElement)(THCState *state, const THCTensor *self) { if(self->nDimension == 0) return 0; else { ptrdiff_t nElement = 1; int d; for(d = 0; d < self->nDimension; d++) nElement *= self->size[d]; return nElement; } } void THCTensor_(retain)(THCState *state, THCTensor *self) { if(self->flag & TH_TENSOR_REFCOUNTED) THAtomicIncrementRef(&self->refcount); } void THCTensor_(free)(THCState *state, THCTensor *self) { if(!self) return; if(self->flag & TH_TENSOR_REFCOUNTED) { if(THAtomicDecrementRef(&self->refcount)) { THFree(self->size); THFree(self->stride); if(self->storage) THCStorage_(free)(state, self->storage); THFree(self); } } } void THCTensor_(freeCopyTo)(THCState *state, THCTensor *self, THCTensor *dst) { if(self != dst) THCTensor_(copy)(state, dst, self); THCTensor_(free)(state, self); } /*******************************************************************************/ static void THCTensor_(rawInit)(THCState *state, THCTensor *self) { self->refcount = 1; self->storage = NULL; self->storageOffset = 0; self->size = NULL; self->stride = NULL; self->nDimension = 0; self->flag = TH_TENSOR_REFCOUNTED; } static void THCTensor_(rawSet)(THCState *state, THCTensor *self, THCStorage *storage, ptrdiff_t storageOffset, int nDimension, long *size, long *stride) { /* storage */ if(self->storage != storage) { if(self->storage) THCStorage_(free)(state, self->storage); if(storage) { self->storage = storage; THCStorage_(retain)(state, self->storage); } else self->storage = NULL; } /* storageOffset */ if(storageOffset < 0) THError("Tensor: invalid storage offset"); self->storageOffset = storageOffset; /* size and stride */ THCTensor_(rawResize)(state, self, nDimension, size, stride); } void THCTensor_(rawResize)(THCState *state, THCTensor *self, int nDimension, long *size, long *stride) { int d; int nDimension_; ptrdiff_t totalSize; int hascorrectsize = 1; nDimension_ = 0; for(d = 0; d < nDimension; d++) { if(size[d] > 0) { nDimension_++; if((self->nDimension > d) && (size[d] != self->size[d])) hascorrectsize = 0; if((self->nDimension > d) && stride && (stride[d] >= 0) && (stride[d] != self->stride[d])) hascorrectsize = 0; } else break; } nDimension = nDimension_; if(nDimension != self->nDimension) hascorrectsize = 0; if(hascorrectsize) return; if(nDimension > 0) { if(nDimension != self->nDimension) { self->size = (long*)THRealloc(self->size, sizeof(long)*nDimension); self->stride = (long*)THRealloc(self->stride, sizeof(long)*nDimension); self->nDimension = nDimension; } totalSize = 1; for(d = self->nDimension-1; d >= 0; d--) { self->size[d] = size[d]; if(stride && (stride[d] >= 0) ) self->stride[d] = stride[d]; else { if(d == self->nDimension-1) self->stride[d] = 1; else self->stride[d] = self->size[d+1]*self->stride[d+1]; } totalSize += (self->size[d]-1)*self->stride[d]; } if(totalSize+self->storageOffset > 0) { if(!self->storage) self->storage = THCStorage_(new)(state); if(totalSize+self->storageOffset > self->storage->size) THCStorage_(resize)(state, self->storage, totalSize+self->storageOffset); } } else self->nDimension = 0; } void THCTensor_(set1d)(THCState *state, THCTensor *tensor, long x0, real value) { THArgCheck(tensor->nDimension == 1, 1, "tensor must have one dimension"); THArgCheck( (x0 >= 0) && (x0 < tensor->size[0]), 2, "out of range"); THCStorage_(set)(state, tensor->storage, tensor->storageOffset+x0*tensor->stride[0], value); } real THCTensor_(get1d)(THCState *state, const THCTensor *tensor, long x0) { THArgCheck(tensor->nDimension == 1, 1, "tensor must have one dimension"); THArgCheck( (x0 >= 0) && (x0 < tensor->size[0]), 2, "out of range"); return THCStorage_(get)(state, tensor->storage, tensor->storageOffset+x0*tensor->stride[0]); } void THCTensor_(set2d)(THCState *state, THCTensor *tensor, long x0, long x1, real value) { THArgCheck(tensor->nDimension == 2, 1, "tensor must have two dimensions"); THArgCheck((x0 >= 0) && (x0 < tensor->size[0]) && (x1 >= 0) && (x1 < tensor->size[1]), 2, "out of range"); THCStorage_(set)(state, tensor->storage, tensor->storageOffset+x0*tensor->stride[0]+x1*tensor->stride[1], value); } real THCTensor_(get2d)(THCState *state, const THCTensor *tensor, long x0, long x1) { THArgCheck(tensor->nDimension == 2, 1, "tensor must have two dimensions"); THArgCheck((x0 >= 0) && (x0 < tensor->size[0]) && (x1 >= 0) && (x1 < tensor->size[1]), 2, "out of range"); return THCStorage_(get)(state, tensor->storage, tensor->storageOffset+x0*tensor->stride[0]+x1*tensor->stride[1]); } void THCTensor_(set3d)(THCState *state, THCTensor *tensor, long x0, long x1, long x2, real value) { THArgCheck(tensor->nDimension == 3, 1, "tensor must have three dimensions"); THArgCheck( (x0 >= 0) && (x0 < tensor->size[0]) && (x1 >= 0) && (x1 < tensor->size[1]) && (x2 >= 0) && (x2 < tensor->size[2]), 2, "out of range"); THCStorage_(set)(state, tensor->storage, tensor->storageOffset+x0*tensor->stride[0]+x1*tensor->stride[1]+x2*tensor->stride[2], value); } real THCTensor_(get3d)(THCState *state, const THCTensor *tensor, long x0, long x1, long x2) { THArgCheck(tensor->nDimension == 3, 1, "tensor must have three dimensions"); THArgCheck( (x0 >= 0) && (x0 < tensor->size[0]) && (x1 >= 0) && (x1 < tensor->size[1]) && (x2 >= 0) && (x2 < tensor->size[2]), 2, "out of range"); return THCStorage_(get)(state, tensor->storage, tensor->storageOffset+x0*tensor->stride[0]+x1*tensor->stride[1]+x2*tensor->stride[2]); } void THCTensor_(set4d)(THCState *state, THCTensor *tensor, long x0, long x1, long x2, long x3, real value) { THArgCheck(tensor->nDimension == 4, 1, "tensor must have four dimensions"); THArgCheck((x0 >= 0) && (x0 < tensor->size[0]) && (x1 >= 0) && (x1 < tensor->size[1]) && (x2 >= 0) && (x2 < tensor->size[2]) && (x3 >= 0) && (x3 < tensor->size[3]), 2, "out of range"); THCStorage_(set)(state, tensor->storage, tensor->storageOffset+x0*tensor->stride[0]+x1*tensor->stride[1]+x2*tensor->stride[2]+x3*tensor->stride[3], value); } real THCTensor_(get4d)(THCState *state, const THCTensor *tensor, long x0, long x1, long x2, long x3) { THArgCheck(tensor->nDimension == 4, 1, "tensor must have four dimensions"); THArgCheck((x0 >= 0) && (x0 < tensor->size[0]) && (x1 >= 0) && (x1 < tensor->size[1]) && (x2 >= 0) && (x2 < tensor->size[2]) && (x3 >= 0) && (x3 < tensor->size[3]), 2, "out of range"); return THCStorage_(get)(state, tensor->storage, tensor->storageOffset+x0*tensor->stride[0]+x1*tensor->stride[1]+x2*tensor->stride[2]+x3*tensor->stride[3]); } int THCTensor_(checkGPU)(THCState *state, unsigned int nTensors, ...) { /* FIXME: remove this flag after any users stop using it since it is now superseded by the runtime option */ #ifdef DISABLE_CHECK_GPU return 1; #else int kernelP2PEnabled = THCState_getKernelPeerToPeerAccessEnabled(state); int curDev = -1; THCudaCheck(cudaGetDevice(&curDev)); va_list(args); va_start(args, nTensors); int valid = 1; for (unsigned int i = 0; i < nTensors; i++) { THCTensor* tensor = va_arg(args, THCTensor*); if (tensor == NULL) { continue; } int tensorDev = THCTensor_(getDevice)(state, tensor); if (tensorDev == -1) { /* This tensor does not have GPU memory (empty) */ continue; } if (tensorDev != curDev) { if (kernelP2PEnabled) { /* Kernel p2p access is allowed */ /* Can `curDev` access `tensorDev` directly? */ if (!THCState_getPeerToPeerAccess(state, curDev, tensorDev)) { valid = 0; break; } } else { /* No kernel p2p access allowed */ valid = 0; break; } } } va_end(args); return valid; #endif // DISABLE_CHECK_GPU } THCDescBuff THCTensor_(sizeDesc)(THCState *state, const THCTensor *tensor) { const int L = THC_DESC_BUFF_LEN; THCDescBuff buf; char *str = buf.str; int n = 0; n += snprintf(str, L-n, "["); int i; for(i = 0; i < tensor->nDimension; i++) { if(n >= L) break; n += snprintf(str+n, L-n, "%ld", tensor->size[i]); if(i < tensor->nDimension-1) { n += snprintf(str+n, L-n, " x "); } } if(n < L - 2) { snprintf(str+n, L-n, "]"); } else { snprintf(str+L-5, 5, "...]"); } return buf; } #endif
the_stack_data/1191066.c
/* * Copyright (c) [2020-2021] Huawei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under Mulan PSL v2. * You can use this software according to the terms and conditions of the Mulan PSL v2. * You may obtain a copy of Mulan PSL v2 at: * * http://license.coscl.org.cn/MulanPSL2 * * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR * FIT FOR A PARTICULAR PURPOSE. * See the Mulan PSL v2 for more details. */ // CHECK: [[# FILENUM:]] "{{.*}}/nonnull_check_cast.c" // expected-no-warning #include <stddef.h> struct Foo { unsigned int a; }; int foo(void *f) { if (f == NULL) return 0; // CHECK: LOC [[# FILENUM]] [[# @LINE + 2 ]]{{$}} // CHECK-NEXT: assertnonnull (dread ptr %f) if (((struct Foo *)f)->a > 0) return 1; return -1; } int main() { return 0; }
the_stack_data/125139656.c
#include <string.h> #include <stdio.h> size_t strlen(const char *s) { const char *p = s; while (*p != '\0') p++; return (size_t)(p - s); } int main() { char *s = "hello world"; printf("length of %s is %zu\n", s, strlen(s)); }
the_stack_data/234518260.c
#include <stdio.h> #include <stdlib.h> #include <string.h> void swap(char* a, char* b) { char* temp = (char*) calloc(sizeof(char), strlen(a) + 1); strcpy(temp, a); strcpy(a, b); strcpy(b, temp); } int get_distinct_letter_count(const char* a) { char* letters = (char*) calloc(sizeof(char), 26); int dcount = 0; int i; for (i = 0; a[i] != '\0'; ++i) letters[a[i] - 'a']++; for (int i = 0; i < 26; ++i) if (letters[i] == 1) dcount++; return dcount; } int lexicographic_sort(const char* a, const char* b) { int flag = -1; int i; for(i = 0;a[i] != '\0' && b[i] != '\0';++i){ if (a[i] != b[i]) { if (a[i] > b[i]) { flag = 1; break; } else { flag = 0; break; } } } if (flag == -1) flag = (a[i] == '\0') ? 0 : 1; return flag; } int lexicographic_sort_reverse(const char* a, const char* b) { int flag = -1; int i; for(i = 0;a[i] != '\0' && b[i] != '\0';++i){ if (a[i] != b[i]) { if (a[i] < b[i]) { flag = 1; break; } else { flag = 0; break; } } } if (flag == -1) flag = a[i] == '\0'; return flag; } int sort_by_number_of_distinct_characters(const char* a, const char* b) { int count_a = get_distinct_letter_count(a); int count_b = get_distinct_letter_count(b); if (count_a > count_b) return 1; else if (count_a < count_b) return 0; else return strlen(a) > strlen(b); } int sort_by_length(const char* a, const char* b) { return strlen(a) > strlen(b); } void string_sort(char** arr,const int len,int (*cmp_func)(const char* a, const char* b)) { for (int i = 0; i < len; ++i) for (int j = 0; j < len - i - 1; ++j) if (cmp_func(arr[j], arr[j+1])) swap(arr[j], arr[j+1]); } int main() { int n; scanf("%d", &n); char** arr; arr = (char**)malloc(n * sizeof(char*)); for(int i = 0; i < n; i++){ *(arr + i) = malloc(1024 * sizeof(char)); scanf("%s", *(arr + i)); *(arr + i) = realloc(*(arr + i), strlen(*(arr + i)) + 1); } string_sort(arr, n, lexicographic_sort); for(int i = 0; i < n; i++) printf("%s\n", arr[i]); printf("\n"); string_sort(arr, n, lexicographic_sort_reverse); for(int i = 0; i < n; i++) printf("%s\n", arr[i]); printf("\n"); string_sort(arr, n, sort_by_length); for(int i = 0; i < n; i++) printf("%s\n", arr[i]); printf("\n"); string_sort(arr, n, sort_by_number_of_distinct_characters); for(int i = 0; i < n; i++) printf("%s\n", arr[i]); printf("\n"); }
the_stack_data/103265451.c
# include <stdio.h> int main() { int *x, *y; *x = 2; // x is pointing 2 y = x; // y is pointing &x printf("(x, &x, *x) = (%p, %p, %d)\n", x, &x, *x); printf("(y, &y, *y) = (%p, %p, %d)\n", y, &y, *y); return 0; }
the_stack_data/136373.c
#include <stdio.h> int main() { int i, j; for (i = 2; i < 100; i++) { for (j = 2; j <= (i / j); j++) if (!(i % j)) break; // if factor exists its not a prime if (j > (i / j)) printf("%d is prime\n", i); } };
the_stack_data/19184.c
/* This testcase is part of GDB, the GNU debugger. Copyright 2020 Free Software Foundation, Inc. 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, see <http://www.gnu.org/licenses/>. */ int a[2] = { 1, 2 };
the_stack_data/111435.c
#include<stdio.h> int main(){ int variable1 = 1; char variable2 = 'h'; float variable3 = 3.1415; double variable4 = 2.7182; printf("variable 1 is an int with a size of %d bytes, at the memory location %p, with a value of %d.\n", sizeof(variable1), &variable1, variable1); printf("variable 2 is an char with a size of %d bytes, at the memory location %p, with a value of %c.\n", sizeof(variable2), &variable2, variable2); printf("variable 3 is an float with a size of %d bytes, at the memory location %p, with a value of %f.\n", sizeof(variable3), &variable3, variable3); printf("variable 4 is an float with a size of %d bytes, at the memory location %p, with a value of %lf.\n", sizeof(variable4), &variable4, variable4); return 0; }
the_stack_data/938.c
/*- * See the file LICENSE for redistribution information. * * Copyright (c) 2001,2008 Oracle. All rights reserved. * * $Id: bench_001.c 63573 2008-05-23 21:43:21Z trent.nelson $ */ /* * bench_001 - time bulk fetch interface. * Without -R builds a btree acording to the arguments. * With -R runs and times bulk fetches. If -d is specified * during reads the DB_MULTIPLE interface is used * otherwise the DB_MULTIPLE_KEY interface is used. * * ARGUMENTS: * -c cachesize [1000 * pagesize] * -d number of duplicates [none] * -E don't use environment * -I Just initialize the environment * -i number of read iterations [1000000] * -l length of data item [20] * -n number of keys [1000000] * -p pagesize [65536] * -R perform read test. * -T incorporate transactions. * * COMPILE: * cc -I /usr/local/BerkeleyDB/include \ * -o bench_001 -O2 bench_001.c /usr/local/BerkeleyDB/lib/libdb.so */ #include <sys/types.h> #include <sys/time.h> #include <stdlib.h> #include <string.h> #ifdef _WIN32 extern int getopt(int, char * const *, const char *); #else #include <unistd.h> #endif #include <db.h> #define DATABASE "bench_001.db" int compare_int(DB *, const DBT *, const DBT *); DB_ENV *db_init(char *, char *, u_int, int); int fill(DB_ENV *, DB *, int, u_int, int, int); int get(DB *, int, u_int, int, int, int, int *); int main(int, char *[]); void usage(void); const char *progname = "bench_001"; /* Program name. */ /* * db_init -- * Initialize the environment. */ DB_ENV * db_init(home, prefix, cachesize, txn) char *home, *prefix; u_int cachesize; int txn; { DB_ENV *dbenv; u_int32_t flags; int ret; if ((ret = db_env_create(&dbenv, 0)) != 0) { dbenv->err(dbenv, ret, "db_env_create"); return (NULL); } dbenv->set_errfile(dbenv, stderr); dbenv->set_errpfx(dbenv, prefix); (void)dbenv->set_cachesize(dbenv, 0, cachesize == 0 ? 50 * 1024 * 1024 : (u_int32_t)cachesize, 0); flags = DB_CREATE | DB_INIT_MPOOL; if (txn) flags |= DB_INIT_TXN | DB_INIT_LOCK; if ((ret = dbenv->open(dbenv, home, flags, 0)) != 0) { dbenv->err(dbenv, ret, "DB_ENV->open: %s", home); (void)dbenv->close(dbenv, 0); return (NULL); } return (dbenv); } /* * get -- loop getting batches of records. * */ int get(dbp, txn, datalen, num, dups, iter, countp) DB *dbp; u_int datalen; int txn, num, dups, iter, *countp; { DBC *dbcp; DBT key, data; DB_ENV *dbenv; DB_TXN *txnp; u_int32_t flags, len, klen; int count, i, j, ret; void *pointer, *dp, *kp; dbenv = dbp->dbenv; klen = 0; /* Lint. */ klen = klen; memset(&key, 0, sizeof(key)); key.data = &j; key.size = sizeof(j); memset(&data, 0, sizeof(data)); data.flags = DB_DBT_USERMEM; data.data = malloc(datalen*1024*1024); data.ulen = data.size = datalen*1024*1024; count = 0; flags = DB_SET; if (!dups) flags |= DB_MULTIPLE_KEY; else flags |= DB_MULTIPLE; for (i = 0; i < iter; i++) { txnp = NULL; if (txn) if ((ret = dbenv->txn_begin(dbenv, NULL, &txnp, 0)) != 0) goto err; if ((ret = dbp->cursor(dbp, txnp, &dbcp, 0)) != 0) goto err; j = random() % num; if ((ret = dbcp->get(dbcp, &key, &data, flags)) != 0) goto err; DB_MULTIPLE_INIT(pointer, &data); if (dups) while (pointer != NULL) { DB_MULTIPLE_NEXT(pointer, &data, dp, len); if (dp != NULL) count++; } else while (pointer != NULL) { DB_MULTIPLE_KEY_NEXT(pointer, &data, kp, klen, dp, len); if (kp != NULL) count++; } if ((ret = dbcp->close(dbcp)) != 0) goto err; if (txn) if ((ret = txnp->commit(txnp, 0)) != 0) goto err; } *countp = count; return (0); err: dbp->err(dbp, ret, "get"); return (ret); } /* * fill - fill a db * Since we open/created the db with transactions (potentially), * we need to populate it with transactions. We'll bundle the puts * 10 to a transaction. */ #define PUTS_PER_TXN 10 int fill(dbenv, dbp, txn, datalen, num, dups) DB_ENV *dbenv; DB *dbp; u_int datalen; int txn, num, dups; { DBT key, data; DB_TXN *txnp; struct data { int id; char str[1]; } *data_val; int count, i, ret; /* * Insert records into the database, where the key is the user * input and the data is the user input in reverse order. */ txnp = NULL; ret = 0; count = 0; memset(&key, 0, sizeof(DBT)); memset(&data, 0, sizeof(DBT)); key.data = &i; key.size = sizeof(i); data.data = data_val = malloc(datalen); memcpy(data_val->str, "0123456789012345678901234567890123456789", datalen - sizeof(data_val->id)); data.size = datalen; data.flags = DB_DBT_USERMEM; for (i = 0; i < num; i++) { if (txn != 0 && i % PUTS_PER_TXN == 0) { if (txnp != NULL) { ret = txnp->commit(txnp, 0); txnp = NULL; if (ret != 0) goto err; } if ((ret = dbenv->txn_begin(dbenv, NULL, &txnp, 0)) != 0) goto err; } data_val->id = 0; do { switch (ret = dbp->put(dbp, txnp, &key, &data, 0)) { case 0: count++; break; default: dbp->err(dbp, ret, "DB->put"); goto err; } } while (++data_val->id < dups); } if (txnp != NULL) ret = txnp->commit(txnp, 0); printf("%d\n", count); return (ret); err: if (txnp != NULL) (void)txnp->abort(txnp); return (ret); } int main(argc, argv) int argc; char *argv[]; { extern char *optarg; extern int optind; DB *dbp; DB_ENV *dbenv; DB_TXN *txnp; struct timeval start_time, end_time; double secs; u_int cache, datalen, pagesize; int ch, count, dups, env, init, iter, num; int ret, rflag, txn; txnp = NULL; datalen = 20; iter = num = 1000000; env = 1; dups = init = rflag = txn = 0; pagesize = 65536; cache = 1000 * pagesize; while ((ch = getopt(argc, argv, "c:d:EIi:l:n:p:RT")) != EOF) switch (ch) { case 'c': cache = (u_int)atoi(optarg); break; case 'd': dups = atoi(optarg); break; case 'E': env = 0; break; case 'I': init = 1; break; case 'i': iter = atoi(optarg); break; case 'l': datalen = (u_int)atoi(optarg); break; case 'n': num = atoi(optarg); break; case 'p': pagesize = (u_int)atoi(optarg); break; case 'R': rflag = 1; break; case 'T': txn = 1; break; case '?': default: usage(); } argc -= optind; argv += optind; /* Remove the previous database. */ if (!rflag) { if (env) (void)system("rm -rf BENCH_001; mkdir BENCH_001"); else (void)unlink(DATABASE); } dbenv = NULL; if (env == 1 && (dbenv = db_init("BENCH_001", "bench_001", cache, txn)) == NULL) return (-1); if (init) exit(0); /* Create and initialize database object, open the database. */ if ((ret = db_create(&dbp, dbenv, 0)) != 0) { fprintf(stderr, "%s: db_create: %s\n", progname, db_strerror(ret)); exit(EXIT_FAILURE); } dbp->set_errfile(dbp, stderr); dbp->set_errpfx(dbp, progname); if ((ret = dbp->set_bt_compare(dbp, compare_int)) != 0) { dbp->err(dbp, ret, "set_bt_compare"); goto err; } if ((ret = dbp->set_pagesize(dbp, pagesize)) != 0) { dbp->err(dbp, ret, "set_pagesize"); goto err; } if (dups && (ret = dbp->set_flags(dbp, DB_DUP)) != 0) { dbp->err(dbp, ret, "set_flags"); goto err; } if (env == 0 && (ret = dbp->set_cachesize(dbp, 0, cache, 0)) != 0) { dbp->err(dbp, ret, "set_cachesize"); goto err; } if ((ret = dbp->set_flags(dbp, DB_DUP)) != 0) { dbp->err(dbp, ret, "set_flags"); goto err; } if (txn != 0) if ((ret = dbenv->txn_begin(dbenv, NULL, &txnp, 0)) != 0) goto err; if ((ret = dbp->open( dbp, txnp, DATABASE, NULL, DB_BTREE, DB_CREATE, 0664)) != 0) { dbp->err(dbp, ret, "%s: open", DATABASE); if (txnp != NULL) (void)txnp->abort(txnp); goto err; } if (txnp != NULL) ret = txnp->commit(txnp, 0); txnp = NULL; if (ret != 0) goto err; if (rflag) { /* If no environment, fill the cache. */ if (!env && (ret = get(dbp, txn, datalen, num, dups, iter, &count)) != 0) goto err; /* Time the get loop. */ (void)gettimeofday(&start_time, NULL); if ((ret = get(dbp, txn, datalen, num, dups, iter, &count)) != 0) goto err; (void)gettimeofday(&end_time, NULL); secs = (((double)end_time.tv_sec * 1000000 + end_time.tv_usec) - ((double)start_time.tv_sec * 1000000 + start_time.tv_usec)) / 1000000; printf("%d records read using %d batches in %.2f seconds: ", count, iter, secs); printf("%.0f records/second\n", (double)count / secs); } else if ((ret = fill(dbenv, dbp, txn, datalen, num, dups)) != 0) goto err; /* Close everything down. */ if ((ret = dbp->close(dbp, rflag ? DB_NOSYNC : 0)) != 0) { fprintf(stderr, "%s: DB->close: %s\n", progname, db_strerror(ret)); return (1); } return (ret); err: (void)dbp->close(dbp, 0); return (1); } int compare_int(dbp, a, b) DB *dbp; const DBT *a, *b; { int ai, bi; dbp = dbp; /* Lint. */ /* * Returns: * < 0 if a < b * = 0 if a = b * > 0 if a > b */ memcpy(&ai, a->data, sizeof(int)); memcpy(&bi, b->data, sizeof(int)); return (ai - bi); } void usage() { (void)fprintf(stderr, "usage: %s %s\n\t%s\n", progname, "[-EIRT] [-c cachesize] [-d dups]", "[-i iterations] [-l datalen] [-n keys] [-p pagesize]"); exit(EXIT_FAILURE); }
the_stack_data/98574509.c
/* { dg-do run } */ struct S1 { int f1:1; }; volatile struct S1 b = { 0 }; int main () { char c = b.f1; b.f1 = 1; if (b.f1 > -1 || c) __builtin_abort (); return 0; }
the_stack_data/150144060.c
#include <stdio.h> #define MIN_VAL -1 int f(int x) { if((-2 <= x) && (x < 2)) { return x * x; } if (x >= 2) { return x * x + 4 * x + 5; } if (x < -2) { return 4; } } int main() { int n, max_num = MIN_VAL; do { scanf("%i", &n); if (f(n) > max_num) { max_num = f(n); } } while(n != 0); printf("%i", max_num); }
the_stack_data/18888847.c
// REQUIRES: powerpc-registered-target // REQUIRES: asserts // RUN: %clang_cc1 -triple powerpc64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s // RUN: %clang_cc1 -triple powerpc-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-PPC #include <stdarg.h> struct x { long a; double b; }; void testva (int n, ...) { va_list ap; struct x t = va_arg (ap, struct x); // CHECK: bitcast i8* %{{[a-z.0-9]*}} to %struct.x* // CHECK: bitcast %struct.x* %t to i8* // CHECK: bitcast %struct.x* %{{[0-9]+}} to i8* // CHECK: call void @llvm.memcpy // CHECK-PPC: [[ARRAYDECAY:%.+]] = getelementptr inbounds [1 x %struct.__va_list_tag], [1 x %struct.__va_list_tag]* %ap, i32 0, i32 0 // CHECK-PPC-NEXT: [[GPRPTR:%.+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* [[ARRAYDECAY]], i32 0, i32 0 // CHECK-PPC-NEXT: [[GPR:%.+]] = load i8, i8* [[GPRPTR]], align 4 // CHECK-PPC-NEXT: [[COND:%.+]] = icmp ult i8 [[GPR]], 8 // CHECK-PPC-NEXT: br i1 [[COND]], label %[[USING_REGS:[a-z_0-9]+]], label %[[USING_OVERFLOW:[a-z_0-9]+]] // // CHECK-PPC:[[USING_REGS]] // CHECK-PPC-NEXT: [[REGSAVE_AREA_P:%.+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* [[ARRAYDECAY]], i32 0, i32 4 // CHECK-PPC-NEXT: [[REGSAVE_AREA:%.+]] = load i8*, i8** [[REGSAVE_AREA_P]], align 4 // CHECK-PPC-NEXT: [[OFFSET:%.+]] = mul i8 [[GPR]], 4 // CHECK-PPC-NEXT: [[RAW_REGADDR:%.+]] = getelementptr inbounds i8, i8* [[REGSAVE_AREA]], i8 [[OFFSET]] // CHECK-PPC-NEXT: [[REGADDR:%.+]] = bitcast i8* [[RAW_REGADDR]] to %struct.x** // CHECK-PPC-NEXT: [[USED_GPR:%[0-9]+]] = add i8 [[GPR]], 1 // CHECK-PPC-NEXT: store i8 [[USED_GPR]], i8* [[GPRPTR]], align 4 // CHECK-PPC-NEXT: br label %[[CONT:[a-z0-9]+]] // // CHECK-PPC:[[USING_OVERFLOW]] // CHECK-PPC-NEXT: [[OVERFLOW_AREA_P:%[0-9]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* [[ARRAYDECAY]], i32 0, i32 3 // CHECK-PPC-NEXT: [[OVERFLOW_AREA:%.+]] = load i8*, i8** [[OVERFLOW_AREA_P]], align 4 // CHECK-PPC-NEXT: %{{[0-9]+}} = ptrtoint i8* %argp.cur to i32 // CHECK-PPC-NEXT: %{{[0-9]+}} = add i32 %{{[0-9]+}}, 7 // CHECK-PPC-NEXT: %{{[0-9]+}} = and i32 %{{[0-9]+}}, -8 // CHECK-PPC-NEXT: %argp.cur.aligned = inttoptr i32 %{{[0-9]+}} to i8* // CHECK-PPC-NEXT: [[MEMADDR:%.+]] = bitcast i8* %argp.cur.aligned to %struct.x** // CHECK-PPC-NEXT: [[NEW_OVERFLOW_AREA:%[0-9]+]] = getelementptr inbounds i8, i8* %argp.cur.aligned, i32 4 // CHECK-PPC-NEXT: store i8* [[NEW_OVERFLOW_AREA:%[0-9]+]], i8** [[OVERFLOW_AREA_P]], align 4 // CHECK-PPC-NEXT: br label %[[CONT]] // // CHECK-PPC:[[CONT]] // CHECK-PPC-NEXT: [[VAARG_ADDR:%[a-z.0-9]+]] = phi %struct.x** [ [[REGADDR]], %[[USING_REGS]] ], [ [[MEMADDR]], %[[USING_OVERFLOW]] ] // CHECK-PPC-NEXT: [[AGGR:%[a-z0-9]+]] = load %struct.x*, %struct.x** [[VAARG_ADDR]] // CHECK-PPC-NEXT: [[DEST:%[0-9]+]] = bitcast %struct.x* %t to i8* // CHECK-PPC-NEXT: [[SRC:%.+]] = bitcast %struct.x* [[AGGR]] to i8* // CHECK-PPC-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* [[DEST]], i8* [[SRC]], i32 16, i32 8, i1 false) int v = va_arg (ap, int); // CHECK: getelementptr inbounds i8, i8* %{{[a-z.0-9]*}}, i64 4 // CHECK: bitcast i8* %{{[0-9]+}} to i32* // CHECK-PPC: [[ARRAYDECAY:%[a-z0-9]+]] = getelementptr inbounds [1 x %struct.__va_list_tag], [1 x %struct.__va_list_tag]* %ap, i32 0, i32 0 // CHECK-PPC-NEXT: [[GPRPTR:%.+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* [[ARRAYDECAY]], i32 0, i32 0 // CHECK-PPC-NEXT: [[GPR:%.+]] = load i8, i8* [[GPRPTR]], align 4 // CHECK-PPC-NEXT: [[COND:%.+]] = icmp ult i8 [[GPR]], 8 // CHECK-PPC-NEXT: br i1 [[COND]], label %[[USING_REGS:.+]], label %[[USING_OVERFLOW:.+]]{{$}} // // CHECK-PPC:[[USING_REGS]] // CHECK-PPC-NEXT: [[REGSAVE_AREA_P:%.+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* [[ARRAYDECAY]], i32 0, i32 4 // CHECK-PPC-NEXT: [[REGSAVE_AREA:%.+]] = load i8*, i8** [[REGSAVE_AREA_P]], align 4 // CHECK-PPC-NEXT: [[OFFSET:%.+]] = mul i8 [[GPR]], 4 // CHECK-PPC-NEXT: [[RAW_REGADDR:%.+]] = getelementptr inbounds i8, i8* [[REGSAVE_AREA]], i8 [[OFFSET]] // CHECK-PPC-NEXT: [[REGADDR:%.+]] = bitcast i8* [[RAW_REGADDR]] to i32* // CHECK-PPC-NEXT: [[USED_GPR:%[0-9]+]] = add i8 [[GPR]], 1 // CHECK-PPC-NEXT: store i8 [[USED_GPR]], i8* [[GPRPTR]], align 4 // CHECK-PPC-NEXT: br label %[[CONT:[a-z0-9]+]] // // CHECK-PPC:[[USING_OVERFLOW]] // CHECK-PPC-NEXT: [[OVERFLOW_AREA_P:%[0-9]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* [[ARRAYDECAY]], i32 0, i32 3 // CHECK-PPC-NEXT: [[OVERFLOW_AREA:%.+]] = load i8*, i8** [[OVERFLOW_AREA_P]], align 4 // CHECK-PPC-NEXT: [[MEMADDR:%.+]] = bitcast i8* [[OVERFLOW_AREA]] to i32* // CHECK-PPC-NEXT: [[NEW_OVERFLOW_AREA:%[0-9]+]] = getelementptr inbounds i8, i8* [[OVERFLOW_AREA]], i32 4 // CHECK-PPC-NEXT: store i8* [[NEW_OVERFLOW_AREA]], i8** [[OVERFLOW_AREA_P]] // CHECK-PPC-NEXT: br label %[[CONT]] // // CHECK-PPC:[[CONT]] // CHECK-PPC-NEXT: [[VAARG_ADDR:%[a-z.0-9]+]] = phi i32* [ [[REGADDR]], %[[USING_REGS]] ], [ [[MEMADDR]], %[[USING_OVERFLOW]] ] // CHECK-PPC-NEXT: [[THIRTYFIVE:%[0-9]+]] = load i32, i32* [[VAARG_ADDR]] // CHECK-PPC-NEXT: store i32 [[THIRTYFIVE]], i32* %v, align 4 #ifdef __powerpc64__ __int128_t u = va_arg (ap, __int128_t); #endif // CHECK: bitcast i8* %{{[a-z.0-9]+}} to i128* // CHECK-NEXT: load i128, i128* %{{[0-9]+}} }
the_stack_data/212644067.c
// *~*~ *~*~ *~*~ *~*~ *~*~ *~*~ *~*~ *~*~ *~*~ *~*~ *~*~ *~*~ *~*~ // ----------------------------------------------------------------- // --------------------- L I B R A R Y --------------------- // ----------------------------------------------------------------- // *~*~ *~*~ *~*~ *~*~ *~*~ *~*~ *~*~ *~*~ *~*~ *~*~ *~*~ *~*~ *~*~ // ----------------------------------------------------------------- // ----------------------- BUILTIN PROCEDURES ---------------------- // ----------------------------------------------------------------- void exit(int code); int read(int fd, int* buffer, int bytesToRead); int write(int fd, int* buffer, int bytesToWrite); int open(int* filename, int flags, int mode); int* malloc(int size); // ----------------------------------------------------------------- // ----------------------- LIBRARY PROCEDURES ---------------------- // ----------------------------------------------------------------- void initLibrary(); void resetLibrary(); int twoToThePowerOf(int p); int leftShift(int n, int b); int rightShift(int n, int b); int loadCharacter(int* s, int i); int* storeCharacter(int* s, int i, int c); int stringLength(int* s); void stringReverse(int* s); int stringCompare(int* s, int* t); int atoi(int* s); int* itoa(int n, int* s, int b, int a, int p); int fixedPointRatio(int a, int b); void putCharacter(int c); void print(int* s); void println(); void printCharacter(int c); void printString(int* s); void printInteger(int n); void printFixedPointPercentage(int a, int b); void printFixedPointRatio(int a, int b); void printHexadecimal(int n, int a); void printOctal(int n, int a); void printBinary(int n, int a); int roundUp(int n, int m); // ------------------------ GLOBAL CONSTANTS ----------------------- int CHAR_EOF = -1; // end of file int CHAR_TAB = 9; // ASCII code 9 = tabulator int CHAR_LF = 10; // ASCII code 10 = line feed int CHAR_CR = 13; // ASCII code 13 = carriage return int CHAR_SPACE = ' '; int CHAR_SEMICOLON = ';'; int CHAR_PLUS = '+'; int CHAR_DASH = '-'; int CHAR_ASTERISK = '*'; int CHAR_SLASH = '/'; int CHAR_UNDERSCORE = '_'; int CHAR_EQUAL = '='; int CHAR_LPARENTHESIS = '('; int CHAR_RPARENTHESIS = ')'; int CHAR_LBRACE = '{'; int CHAR_RBRACE = '}'; int CHAR_COMMA = ','; int CHAR_LT = '<'; int CHAR_GT = '>'; int CHAR_EXCLAMATION = '!'; int CHAR_PERCENTAGE = '%'; int CHAR_SINGLEQUOTE = 39; // ASCII code 39 = ' int CHAR_DOUBLEQUOTE = '"'; int SIZEOFINT = 4; // must be the same as WORDSIZE int SIZEOFINTSTAR = 4; // must be the same as WORDSIZE int* power_of_two_table; int INT_MAX; // maximum numerical value of a signed 32-bit integer int INT_MIN; // minimum numerical value of a signed 32-bit integer int INT16_MAX; // maximum numerical value of a signed 16-bit integer int INT16_MIN; // minimum numerical value of a signed 16-bit integer int maxFilenameLength = 128; int* character_buffer; // buffer for reading and writing characters int* integer_buffer; // buffer for printing integers int* filename_buffer; // buffer for opening files int* binary_buffer; // buffer for binary I/O // flags for opening read-only files // LINUX: 0 = 0x0000 = O_RDONLY (0x0000) // MAC: 0 = 0x0000 = O_RDONLY (0x0000) // WINDOWS: 32768 = 0x8000 = _O_BINARY (0x8000) | _O_RDONLY (0x0000) // since LINUX/MAC do not seem to mind about _O_BINARY set // we use the WINDOWS flags as default int O_RDONLY = 32768; // flags for opening write-only files // MAC: 1537 = 0x0601 = O_CREAT (0x0200) | O_TRUNC (0x0400) | O_WRONLY (0x0001) int MAC_O_CREAT_TRUNC_WRONLY = 1537; // LINUX: 577 = 0x0241 = O_CREAT (0x0040) | O_TRUNC (0x0200) | O_WRONLY (0x0001) int LINUX_O_CREAT_TRUNC_WRONLY = 577; // WINDOWS: 33537 = 0x8301 = _O_BINARY (0x8000) | _O_CREAT (0x0100) | _O_TRUNC (0x0200) | _O_WRONLY (0x0001) int WINDOWS_O_BINARY_CREAT_TRUNC_WRONLY = 33537; // flags for rw-r--r-- file permissions // 420 = 00644 = S_IRUSR (00400) | S_IWUSR (00200) | S_IRGRP (00040) | S_IROTH (00004) // these flags seem to be working for LINUX, MAC, and WINDOWS int S_IRUSR_IWUSR_IRGRP_IROTH = 420; int MEGABYTE = 1048576; int VIRTUALMEMORYSIZE = 67108864; // 64MB of virtual memory int WORDSIZE = 4; // must be the same as SIZEOFINT and SIZEOFINTSTAR // ------------------------ GLOBAL VARIABLES ----------------------- int numberOfWrittenCharacters = 0; int* outputName = (int*) 0; int outputFD = 1; int* selfieName = (int*) 0; // ------------------------- INITIALIZATION ------------------------ void initLibrary() { int i; // powers of two table with 31 entries for 2^0 to 2^30 // avoiding overflow for 2^31 and larger numbers with 32-bit signed integers power_of_two_table = malloc(31 * SIZEOFINT); *power_of_two_table = 1; // 2^0 == 1 i = 1; while (i < 31) { // compute powers of two incrementally using this recurrence relation *(power_of_two_table + i) = *(power_of_two_table + (i - 1)) * 2; i = i + 1; } // compute INT_MAX and INT_MIN without integer overflows INT_MAX = (twoToThePowerOf(30) - 1) * 2 + 1; INT_MIN = -INT_MAX - 1; INT16_MAX = twoToThePowerOf(15) - 1; INT16_MIN = -INT16_MAX - 1; // allocate and touch to make sure memory is mapped for read calls character_buffer = malloc(1); *character_buffer = 0; // accommodate at least 32-bit numbers for itoa, no mapping needed integer_buffer = malloc(33); // does not need to be mapped filename_buffer = malloc(maxFilenameLength); // allocate and touch to make sure memory is mapped for read calls binary_buffer = malloc(SIZEOFINT); *binary_buffer = 0; selfieName=(int*)"testlib"; } void resetLibrary() { numberOfWrittenCharacters = 0; } // *~*~ *~*~ *~*~ *~*~ *~*~ *~*~ *~*~ *~*~ *~*~ *~*~ *~*~ *~*~ *~*~ // ----------------------------------------------------------------- // --------------------- L I B R A R Y --------------------- // ----------------------------------------------------------------- // *~*~ *~*~ *~*~ *~*~ *~*~ *~*~ *~*~ *~*~ *~*~ *~*~ *~*~ *~*~ *~*~ // ----------------------------------------------------------------- // ----------------------- LIBRARY PROCEDURES ---------------------- // ----------------------------------------------------------------- int twoToThePowerOf(int p) { // assert: 0 <= p < 31 return *(power_of_two_table + p); } int leftShift(int n, int b) { // assert: b >= 0; if (b < 31) // left shift of integers works by multiplication with powers of two return n * twoToThePowerOf(b); else if (b == 31) // twoToThePowerOf(b) only works for b < 31 return n * twoToThePowerOf(30) * 2; else // left shift of a 32-bit integer by more than 31 bits is always 0 return 0; } int rightShift(int n, int b) { // assert: b >= 0 if (n >= 0) { if (b < 31) // right shift of positive integers works by division with powers of two return n / twoToThePowerOf(b); else // right shift of a 32-bit integer by more than 31 bits is always 0 return 0; } else if (b < 31) // right shift of negative integers requires resetting the sign bit first, // then dividing with powers of two, and finally restoring the sign bit // but b bits to the right; this works even if n == INT_MIN return ((n + 1) + INT_MAX) / twoToThePowerOf(b) + (INT_MAX / twoToThePowerOf(b) + 1); else if (b == 31) // right shift of a negative 32-bit integer by 31 bits is 1 (the sign bit) return 1; else // right shift of a 32-bit integer by more than 31 bits is always 0 return 0; } int loadCharacter(int* s, int i) { // assert: i >= 0 int a; // a is the index of the word where the to-be-loaded i-th character in s is a = i / SIZEOFINT; // shift to-be-loaded character to the left resetting all bits to the left // then shift to-be-loaded character all the way to the right and return return rightShift(leftShift(*(s + a), ((SIZEOFINT - 1) - (i % SIZEOFINT)) * 8), (SIZEOFINT - 1) * 8); } int* storeCharacter(int* s, int i, int c) { // assert: i >= 0, all characters are 7-bit int a; // a is the index of the word where the with c // to-be-overwritten i-th character in s is a = i / SIZEOFINT; // subtract the to-be-overwritten character resetting its bits in s // then add c setting its bits at the i-th position in s *(s + a) = (*(s + a) - leftShift(loadCharacter(s, i), (i % SIZEOFINT) * 8)) + leftShift(c, (i % SIZEOFINT) * 8); return s; } int stringLength(int* s) { int i; i = 0; while (loadCharacter(s, i) != 0) i = i + 1; return i; } void stringReverse(int* s) { int i; int j; int tmp; i = 0; j = stringLength(s) - 1; while (i < j) { tmp = loadCharacter(s, i); storeCharacter(s, i, loadCharacter(s, j)); storeCharacter(s, j, tmp); i = i + 1; j = j - 1; } } int stringCompare(int* s, int* t) { int i; i = 0; while (1) if (loadCharacter(s, i) == 0) if (loadCharacter(t, i) == 0) return 1; else return 0; else if (loadCharacter(s, i) == loadCharacter(t, i)) i = i + 1; else return 0; } int atoi(int* s) { int i; int n; int c; // the conversion of the ASCII string in s to its numerical value n // begins with the leftmost digit in s i = 0; // and the numerical value 0 for n n = 0; c = loadCharacter(s, i); // loop until s is terminated while (c != 0) { // the numerical value of ASCII-encoded decimal digits // is offset by the ASCII code of '0' (which is 48) c = c - '0'; if (c < 0) // c was not a decimal digit return -1; else if (c > 9) // c was not a decimal digit return -1; // assert: s contains a decimal number, that is, with base 10 n = n * 10 + c; // go to the next digit i = i + 1; c = loadCharacter(s, i); if (n < 0) { // the only negative number for n allowed here is INT_MIN if (n != INT_MIN) // but n is not INT_MIN which may happen because of an earlier // integer overflow if the number in s is larger than INT_MAX return -1; else if (c != 0) // n is INT_MIN but s is not terminated yet return -1; } } return n; } int* itoa(int n, int* s, int b, int a, int p) { // assert: b in {2,4,8,10,16} int i; int sign; int msb; // the conversion of the integer n to an ASCII string in s // with base b, alignment a, and fixed point p // begins with the leftmost digit in s i = 0; // for now assuming n is positive sign = 0; // and msb not set msb = 0; if (n == 0) { storeCharacter(s, 0, '0'); i = 1; } else if (n < 0) { // convert n to a positive number but remember the sign sign = 1; if (b == 10) { if (n == INT_MIN) { // rightmost decimal digit of 32-bit INT_MIN storeCharacter(s, 0, '8'); // avoids overflow n = -(n / 10); i = 1; } else n = -n; } else { if (n == INT_MIN) { // rightmost non-decimal digit of INT_MIN storeCharacter(s, 0, '0'); // avoids setting n to 0 n = (rightShift(INT_MIN, 1) / b) * 2; i = 1; } else { // reset msb, restore below n = rightShift(leftShift(n, 1), 1); msb = 1; } } // assert: n > 0 } while (n != 0) { if (p > 0) if (i == p) { storeCharacter(s, i, '.'); // set point of fixed point number // go to the next digit i = i + 1; // we are done with the fixed point p = 0; } if (n % b > 9) // the ASCII code of hexadecimal digits larger than 9 // is offset by the ASCII code of 'A' (which is 65) storeCharacter(s, i, n % b - 10 + 'A'); else // the ASCII code of digits less than or equal to 9 // is offset by the ASCII code of '0' (which is 48) storeCharacter(s, i, n % b + '0'); // convert n by dividing n with base b n = n / b; i = i + 1; if (msb) { // restore msb from above n = n + (rightShift(INT_MIN, 1) / b) * 2; msb = 0; } } if (p > 0) { while (i < p) { storeCharacter(s, i, '0'); // no point yet, fill with 0s i = i + 1; } storeCharacter(s, i, '.'); // set point storeCharacter(s, i + 1, '0'); // leading 0 // go to the second next digit i = i + 2; // we are done with the fixed point p = 0; } if (b == 10) { if (sign) { storeCharacter(s, i, '-'); // negative decimal numbers start with - i = i + 1; } while (i < a) { storeCharacter(s, i, ' '); // align with spaces i = i + 1; } } else { while (i < a) { storeCharacter(s, i, '0'); // align with 0s i = i + 1; } if (b == 8) { storeCharacter(s, i, '0'); // octal numbers start with 00 storeCharacter(s, i + 1, '0'); i = i + 2; } else if (b == 16) { storeCharacter(s, i, 'x'); // hexadecimal numbers start with 0x storeCharacter(s, i + 1, '0'); i = i + 2; } } storeCharacter(s, i, 0); // null-terminated string // our numeral system is positional hindu-arabic, that is, // the weight of digits increases right to left, which means // that we need to reverse the string we computed above stringReverse(s); return s; } int fixedPointRatio(int a, int b) { // compute fixed point ratio with 2 fractional digits // multiply a/b with 100 but avoid overflow if (a <= INT_MAX / 100) { if (b != 0) return a * 100 / b; } else if (a <= INT_MAX / 10) { if (b / 10 != 0) return a * 10 / (b / 10); } else { if (b / 100 != 0) return a / (b / 100); } return 0; } int fixedPointPercentage(int r) { if (r != 0) // 1000000 = 10000 (for 100.00%) * 100 (for 2 fractional digits of r) return 1000000 / r; else return 0; } void putCharacter(int c) { *character_buffer = c; // assert: character_buffer is mapped // try to write 1 character from character_buffer // into file with outputFD file descriptor if (write(outputFD, character_buffer, 1) == 1) { if (outputFD != 1) // count number of characters written to a file, // not the console which has file descriptor 1 numberOfWrittenCharacters = numberOfWrittenCharacters + 1; } else { // write failed if (outputFD != 1) { // failed write was not to the console which has file descriptor 1 // to report the error we may thus still write to the console via print outputFD = 1; print(selfieName); print((int*) ": could not write character to output file "); print(outputName); println(); } exit(-1); } } void print(int* s) { int i; i = 0; while (loadCharacter(s, i) != 0) { putCharacter(loadCharacter(s, i)); i = i + 1; } } void println() { putCharacter(CHAR_LF); } void printCharacter(int c) { putCharacter(CHAR_SINGLEQUOTE); if (c == CHAR_EOF) print((int*) "end of file"); else if (c == CHAR_TAB) print((int*) "tabulator"); else if (c == CHAR_LF) print((int*) "line feed"); else if (c == CHAR_CR) print((int*) "carriage return"); else putCharacter(c); putCharacter(CHAR_SINGLEQUOTE); } void printString(int* s) { putCharacter(CHAR_DOUBLEQUOTE); print(s); putCharacter(CHAR_DOUBLEQUOTE); } void printInteger(int n) { print(itoa(n, integer_buffer, 10, 0, 0)); } void printFixedPointPercentage(int a, int b) { print(itoa(fixedPointPercentage(fixedPointRatio(a, b)), integer_buffer, 10, 0, 2)); } void printFixedPointRatio(int a, int b) { print(itoa(fixedPointRatio(a, b), integer_buffer, 10, 0, 2)); } void printHexadecimal(int n, int a) { print(itoa(n, integer_buffer, 16, a, 0)); } void printOctal(int n, int a) { print(itoa(n, integer_buffer, 8, a, 0)); } void printBinary(int n, int a) { print(itoa(n, integer_buffer, 2, a, 0)); } int roundUp(int n, int m) { if (n % m == 0) return n; else if (n >= 0) return n + m - n % m; else return n - n % m; } int* zalloc(int size) { // this procedure is only executed at boot level zero // zalloc allocates size bytes rounded up to word size // and then zeroes that memory, similar to calloc, but // called zalloc to avoid redeclaring calloc int* memory; int i; size = roundUp(size, WORDSIZE); memory = malloc(size); size = size / WORDSIZE; i = 0; while (i < size) { // erase memory by setting it to 0 *(memory + i) = 0; i = i + 1; } return memory; }
the_stack_data/14200562.c
#include <stdio.h> #include <string.h> int main() { char isbn[20]; int counter; int dash_counter; scanf("%s", isbn); if(strlen(isbn) != 17){ printf("0"); return 0; } if((isbn[0] != '9' && isbn[1] != '7' && isbn[2] != '8' && isbn[3] != '-') || (isbn[0] != '9' && isbn[1] != '7' && isbn[2] != '9' && isbn[3] != '-')){ printf("0"); return 0; } dash_counter = 0; for(counter = 0; counter < 17; counter++){ if(isbn[counter] == '-'){ dash_counter++; } } if(dash_counter != 4){ printf("0"); return 0; } counter = 3; for(;counter < 17; counter++){ if(isbn[counter] == '-'){ if(isbn[counter + 1] == '-'){ printf("0"); return 0; } } } printf("1"); if(isbn[6] == '9' && isbn[7] == '3' && isbn[8] == '3' && isbn[9] == '3' && isbn[10] == '4' && isbn[11] == '6'){ if(isbn[12] == '-'){ printf("\nBluebridge"); } } if(isbn[6] == '5' && isbn[7] == '5' && isbn[8] == '5' && isbn[9] == '8' && isbn[10] == '3'){ if(isbn[11] == '-'){ printf("\nAlyson Books"); } } if(isbn[6] == '4' && isbn[7] == '2' && isbn[8] == '1' && isbn[9] == '0'){ if(isbn[10] == '-'){ printf("\nFUNimation Productions, Ltd."); } } if(isbn[6] == '0' && isbn[7] == '1'){ if(isbn[8] == '-'){ printf("\nPyramid Books"); } } return 0; }
the_stack_data/822027.c
// DISTRIBUTION STATEMENT A. Approved for public release. Distribution is unlimited. // // This material is based upon work supported by the Department of the Air Force under Air Force Contract No. FA8702-15-D-0001. Any opinions, findings, conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the Department of the Air Force. // // © 2019 Massachusetts Institute of Technology. // // Subject to FAR52.227-11 Patent Rights - Ownership by the contractor (May 2014) // // The software/firmware is provided to you on an As-Is basis // // Delivered to the U.S. Government with Unlimited Rights, as defined in DFARS Part 252.227-7013 or 7014 (Feb 2014). Notwithstanding any copyright notice, U.S. Government rights in this work are defined by DFARS 252.227-7013 or DFARS 252.227-7014 as detailed above. Use of this work other than as specifically authorized by the U.S. Government may violate any copyrights that exist in this work. #include <stdio.h> #include <stdlib.h> #include <signal.h> // copied from the SAGE paper [citation needed] void test(char input[4]) { int cnt = 0; if (input[0] == 'b') { cnt++; } if (input[1] == 'a') { cnt++; } if (input[2] == 'd') { cnt++; } if (input[3] == '!') { cnt++; } if (cnt >= 4) { int *ptr = NULL; ptr = (int *)0x4141414141414141; *ptr = 1; } } void my_pause() { puts("Press any character to continue"); getchar(); } int main(int argc, char *argv[]) { FILE *input_file; char input[4]; my_pause(); if (argc == 2) { input_file = fopen(argv[1], "r"); } else { input_file = stdin; } int c; for (unsigned int i = 0; i < 4; i++) { c = fgetc(input_file); if (c == EOF) { perror("hit EOF\n"); exit(1); } input[i] = (char)c; } test(input); return 0; }
the_stack_data/98575681.c
// This file is part of CPAchecker, // a tool for configurable software verification: // https://cpachecker.sosy-lab.org // // SPDX-FileCopyrightText: 2007-2020 Dirk Beyer <https://www.sosy-lab.org> // // SPDX-License-Identifier: Apache-2.0 #include <stdlib.h> typedef struct node { struct node *next; struct node *prev; int data; } *DLL; DLL node_create(int data) { DLL temp = (DLL) malloc(sizeof(struct node)); temp->next = NULL; temp->prev = NULL; temp->data = data; return temp; } void _assert(int x) { if(!x) { // create memory leak node_create(-1); } } void dll_check_data(DLL head, int expected) { if(NULL != head) { DLL temp = head->next; while(temp != head) { _assert(expected == temp->data); temp = temp->next; } _assert(expected == head->data); } } void dll_circular_destroy(DLL head) { if(NULL != head) { DLL p = head->next; while(p != head) { DLL q = p->next; free(p); p = q; } free(head); } } void dll_circular_append(DLL* head, int data) { DLL new_last = node_create(data); if(NULL == *head) { new_last->prev = new_last; new_last->next = new_last; *head = new_last; } else { DLL last = (*head)->prev; last->next = new_last; new_last->prev = last; new_last->next = *head; (*head)->prev = new_last; } } int main(void) { const int data = 5; DLL a = node_create(data); DLL b = node_create(data); a->next = b; b->prev = a; a->prev = b; b->next = a; b = NULL; dll_circular_append(&a, data); dll_check_data(a, data); dll_circular_destroy(a); return 0; }
the_stack_data/20449934.c
/* This testcase is part of GDB, the GNU debugger. Copyright 2004-2020 Free Software Foundation, Inc. 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, see <http://www.gnu.org/licenses/>. */ #include <stdio.h> #include <string.h> #include <signal.h> #include <sys/time.h> static volatile int done; extern int callee (int param) { return param * done + 1; } extern int caller (int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) { return callee ((a1 << a2 * a3 / a4) + a6 & a6 % a7 - a8) + done; } static void catcher (int sig) { done = 1; } /* handler */ static void thrower (void) { /* Trigger a SIGSEGV. */ *(volatile char *)0 = 0; /* On MMU-less system, previous memory access to address zero doesn't trigger a SIGSEGV. Trigger a SIGILL. Each arch should define its own illegal instruction here. */ #if defined(__arm__) asm(".word 0xf8f00000"); #elif defined(__TMS320C6X__) asm(".word 0x56454313"); #else #endif } int main () { signal (SIGILL, catcher); signal (SIGSEGV, catcher); thrower (); return 0; }
the_stack_data/151927.c
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdint.h> #include <unistd.h> #include <fcntl.h> #include <sys/ioctl.h> #include <errno.h> int hd_main(int argc, char *argv[]) { int c; int fd; unsigned char buf[4096]; int res; int read_len; int rv = 0; int i; int filepos = 0; int sum; int lsum; int base = -1; int count = 0; int repeat = 0; do { c = getopt(argc, argv, "b:c:r:"); if (c == EOF) break; switch (c) { case 'b': base = strtol(optarg, NULL, 0); break; case 'c': count = strtol(optarg, NULL, 0); break; case 'r': repeat = strtol(optarg, NULL, 0); break; case '?': fprintf(stderr, "%s: invalid option -%c\n", argv[0], optopt); exit(1); } } while (1); if (optind + 1 != argc) { fprintf(stderr, "Usage: %s [-b base] [-c count] [-r delay] file\n", argv[0]); exit(1); } fd = open(argv[optind], O_RDONLY); if(fd < 0) { fprintf(stderr, "could not open %s, %s\n", argv[optind], strerror(errno)); return 1; } do { if(base >= 0) { lseek(fd, base, SEEK_SET); filepos = base; } sum = 0; lsum = 0; while(1) { read_len = sizeof(buf); if(count > 0 && base + count - filepos < read_len) read_len = base + count - filepos; res = read(fd, &buf, read_len); if(res == 0) break; for(i = 0; i < res; i++) { if((i & 15) == 0) { printf("%08x: ", filepos + i); } lsum += buf[i]; sum += buf[i]; printf("%02x ", buf[i]); if(((i & 15) == 15) || (i == res - 1)) { printf("s %x\n", lsum); lsum = 0; } } if(res < 0) { printf("Read error on %s, offset %d len %d, %s\n", argv[optind], filepos, read_len, strerror(errno)); return 1; } filepos += res; if(filepos == base + count) break; } printf("sum %x\n", sum); if(repeat) sleep(repeat); } while(repeat); return 0; }
the_stack_data/903702.c
#include <stdio.h> #include <math.h> int main(void) { int λ = 1; double π = M_PI; double π2 = M_PI * 2.; printf ("%d %f %f\n", λ, π, π2); }
the_stack_data/16192.c
/* Autor: Abel Hernández fecha: Wed May 11 19:07:19 CST 2022 compilador: gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0 compilar: gcc -o problema4.out problema4.c Librerias: stdio resumen: */ //librerias #include <stdio.h>
the_stack_data/139365.c
#include <stdlib.h> #include <limits.h> extern void abort (); int test1(int x) { return x ^ INT_MIN; } unsigned int test1u(unsigned int x) { return x ^ (unsigned int)INT_MIN; } int test2(int x) { return x + INT_MIN; } unsigned int test2u(unsigned int x) { return x + (unsigned int)INT_MIN; } int test3(int x) { return x - INT_MIN; } unsigned int test3u(unsigned int x) { return x - (unsigned int)INT_MIN; } int test4(int x) { int y = INT_MIN; return x ^ y; } unsigned int test4u(unsigned int x) { unsigned int y = (unsigned int)INT_MIN; return x ^ y; } int test5(int x) { int y = INT_MIN; return x + y; } unsigned int test5u(unsigned int x) { unsigned int y = (unsigned int)INT_MIN; return x + y; } int test6(int x) { int y = INT_MIN; return x - y; } unsigned int test6u(unsigned int x) { unsigned int y = (unsigned int)INT_MIN; return x - y; } void test(int a, int b) { if (test1(a) != b) abort(); if (test2(a) != b) abort(); if (test3(a) != b) abort(); if (test4(a) != b) abort(); if (test5(a) != b) abort(); if (test6(a) != b) abort(); } void testu(unsigned int a, unsigned int b) { if (test1u(a) != b) abort(); if (test2u(a) != b) abort(); if (test3u(a) != b) abort(); if (test4u(a) != b) abort(); if (test5u(a) != b) abort(); if (test6u(a) != b) abort(); } int main() { #if INT_MAX == 2147483647 test(0x00000000,0x80000000); test(0x80000000,0x00000000); test(0x12345678,0x92345678); test(0x92345678,0x12345678); test(0x7fffffff,0xffffffff); test(0xffffffff,0x7fffffff); testu(0x00000000,0x80000000); testu(0x80000000,0x00000000); testu(0x12345678,0x92345678); testu(0x92345678,0x12345678); testu(0x7fffffff,0xffffffff); testu(0xffffffff,0x7fffffff); #endif #if INT_MAX == 32767 test(0x0000,0x8000); test(0x8000,0x0000); test(0x1234,0x9234); test(0x9234,0x1234); test(0x7fff,0xffff); test(0xffff,0x7fff); testu(0x0000,0x8000); testu(0x8000,0x0000); testu(0x1234,0x9234); testu(0x9234,0x1234); testu(0x7fff,0xffff); testu(0xffff,0x7fff); #endif return 0; }
the_stack_data/32950696.c
#include <stdio.h> #include <errno.h> extern int errno; int main(int argc, char **argv) { char *fname; FILE *fid, *fid2; float *buf,mn,mx; double sum; char subname[240]; char c='A'; int i,j,k,ioff,joff,koff; long nbig,ncube,size; if (argc != 4) { printf("USAGE: ./extract filename orig_size subcube_size \n"); exit(1); } fname=argv[1]; fid=fopen(fname,"r"); /* 256^3 blocks: */ nbig=atoi(argv[2]); ncube=atoi(argv[3]); printf("input file: %s\n ",fname); printf("original size: %i subcube size: %i \n",nbig,ncube); size=ncube; size=size*size*size; buf=(float *)malloc(size*4); if (buf==NULL) { printf("Error: couldn't malloc subcube \n"); exit(1); } for (ioff=0; ioff <= nbig-ncube; ioff+=ncube ) { for (joff=0; joff <= nbig-ncube; joff+=ncube ) { for (koff=0; koff <= nbig-ncube; koff+=ncube ) { k=0; for (i=0; i<ncube; ++i) { for (j=0; j<ncube; ++j) { long pos_big=nbig*(nbig*(i+ioff) + j +joff) + k+koff; long pos_small=ncube*(ncube*i + j) + k; fseek(fid,4*pos_big,SEEK_SET); if (ncube!=fread(&buf[pos_small],4,ncube,fid)) { printf("Error on read \n"); exit(1); } } } mn=buf[0]; mx=buf[0]; sum=0; for (i=0; i<size; ++i) { sum=sum+buf[i]; if (buf[i]<mn) mn=buf[i]; if (buf[i]>mx) mx=buf[i]; } sum=sum/size; /* compute name of subcube: */ strcpy(subname,fname); i=strlen(subname); subname[i++]='.'; subname[i++]=c+(ioff/ncube); subname[i++]=c+(joff/ncube); subname[i++]=c+(koff/ncube); subname[i]=0; printf("%s min=%f max=%f\n",subname,mn,mx); fid2=fopen(subname,"w"); fwrite(buf,4,ncube*ncube*ncube,fid2); fclose(fid2); goto done; } } } done: fclose(fid); return 0; }
the_stack_data/18887851.c
/* Copyright 2019 Rose-Hulman */ #include <stdio.h> #include <pthread.h> #include <semaphore.h> #include <unistd.h> // number of carpenters #define NUM_CARP 3 // number of painters #define NUM_PAIN 3 // number of decorators #define NUM_DECO 3 /** Imagine there is a shared memory space called house. There are 3 different kinds of operations on house: carpenters, painters, and decorators. For any particular kind of operation, there can be an unlimited number of threads doing the same operation at once (e.g. unlimited carpenter threads etc.). However, only one kind of operation can be done at a time (so even a single carpenter should block all painters and vice versa). Use mutex locks and condition variables to enforce this constraint. You don't have to worry about starvation (e.g. that constantly arriving decorators might prevent carpenters from ever running) - though maybe it would be fun to consider how you would solve in that case. This is similar to the readers/writers problem BTW. **/ pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t carpen = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t paint = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t decor = PTHREAD_MUTEX_INITIALIZER; int carpen_number = 0; int paint_number = 0; int decor_number = 0; void* carpenter(void * ignored) { pthread_mutex_lock(&lock); if(paint_number<=0 && decor_number<=0){ pthread_mutex_unlock(&carpen); } carpen_number++; pthread_mutex_unlock(&lock); pthread_mutex_lock(&carpen); printf("starting carpentry\n"); sleep(1); printf("finished carpentry\n"); pthread_mutex_lock(&lock); carpen_number--; if(carpen_number>0){ pthread_mutex_unlock(&carpen); } else if(paint_number>0){ pthread_mutex_unlock(&paint); } else if(decor_number>0){ pthread_mutex_unlock(&decor); } pthread_mutex_unlock(&lock); return NULL; } void* painter(void * ignored) { pthread_mutex_lock(&lock); if(carpen_number<=0 && decor_number<=0){ pthread_mutex_unlock(&paint); } paint_number++; pthread_mutex_unlock(&lock); pthread_mutex_lock(&paint); printf("starting painting\n"); sleep(1); printf("finished painting\n"); pthread_mutex_lock(&lock); paint_number--; if(paint_number>0){ while(paint_number>0){ pthread_mutex_unlock(&paint); paint_number--; } } else if(carpen_number>0){ pthread_mutex_unlock(&carpen); } else if(decor_number>0){ pthread_mutex_unlock(&decor); } pthread_mutex_unlock(&lock); return NULL; } void* decorator(void * ignored) { pthread_mutex_lock(&lock); if(carpen_number<=0 && paint_number<=0){ pthread_mutex_unlock(&decor); } decor_number++; pthread_mutex_unlock(&lock); pthread_mutex_lock(&decor); printf("starting decorating\n"); sleep(1); printf("finished decorating\n"); pthread_mutex_lock(&lock); decor_number--; if(decor_number>0) while (decor_number>0){ pthread_mutex_unlock(&decor); decor_number--; } else if(carpen_number>0){ pthread_mutex_unlock(&carpen); } else if(paint_number>0){ pthread_mutex_unlock(&paint); } pthread_mutex_unlock(&lock); return NULL; } int main(int argc, char **argv) { pthread_t jobs[NUM_CARP + NUM_PAIN + NUM_DECO]; for (int i = 0; i < NUM_CARP + NUM_PAIN + NUM_DECO; i++) { void* (*func) (void*) = NULL; if(i < NUM_CARP) func = carpenter; if(i >= NUM_CARP && i < NUM_CARP + NUM_PAIN) func = painter; if(i >= NUM_CARP + NUM_PAIN) { func = decorator; } pthread_create(&jobs[i], NULL, func, NULL); } for (int i = 0; i < NUM_CARP + NUM_PAIN + NUM_DECO; i++) { pthread_join(jobs[i], NULL); } printf("Everything finished.\n"); }
the_stack_data/73576081.c
#include <stdio.h> #include <stdlib.h> #define ll long long #define f(i,a,b) for(ll i=a;i<b;i++) #define fd(i,b,a) for(ll i=b;i>=a;i--) #define null -1 #define parent(i) ((i)-1)>>1 #define left(i) (((i)<<1)+1) #define right(i) (((i)<<1)+(1<<1)) struct heap { int mi; int* A; int size; }; typedef struct heap heap; void create(heap *h, int type, int cap) { h->mi = type; h->A = malloc(cap*sizeof(int)); h->size = 0; } void swap(int* x, int* y) { int temp = *x; *x = *y; *y = temp; } void heapify(heap *h, int idx) { int l,r, smallest, largest; l = left(idx); r = right(idx); if(h->mi) { if(l < h->size && h->A[l] < h->A[idx]) smallest = l; else smallest=idx; if(r < h->size && h->A[r] < h->A[smallest]) smallest = r; if(smallest!=idx) { swap(&(h->A[idx]), &(h->A[smallest])); heapify(h, smallest); } } else { if(l < h->size && h->A[l] > h->A[idx]) largest=l; else largest=idx; if(r < h->size && h->A[r] > h->A[largest]) largest=r; if(largest!=idx) { swap(&(h->A[idx]), &(h->A[largest])); heapify(h, largest); } } } void buildheap(heap *h) { fd(i,h->size/2,0) { heapify(h, i); } } void push(heap *h, int key) { int idx = h->size; h->A[h->size] = key; h->size++; if(h->mi) { while((idx > 0) && (h->A[idx] < h->A[parent(idx)]) ) { swap(&h->A[idx], &h->A[parent(idx)]); idx = parent(idx); } } else { while((idx > 0) && (h->A[idx] > h->A[parent(idx)]) ) { swap(&(h->A[idx]), &(h->A[parent(idx)])); idx = parent(idx); } } } int top(heap *h) { return h->A[0]; } void pop(heap *h) { h->A[0] = h->A[h->size-1]; h->size--; heapify(h, 0); } void printh(heap *h) { int i; f(i,0,h->size) printf("%d ",h->A[i]); printf("\n"); } int main() { int n,i,k,m1, m2; scanf("%d", &n); heap h; ll ans=0; create(&h, 1, n); f(i,0,n) { scanf("%d",&k); push(&h, k); } while(h.size > 1) { m1 = top(&h); pop(&h); m2 = top(&h); pop(&h); ans+=(m1+m2); push(&h, m1+m2); } printf("%lld\n",ans); return 0; }
the_stack_data/100140229.c
#include <stdio.h> #define LEN 10 int main() { int v[LEN]; int i; for (i = 0; i < LEN; i++) { scanf("%d", &v[i]); } for (i = 0; i < LEN; i++) { printf("%d\n", v[i]); } int tot = 0; for (i = 0; i < LEN; i++) { tot += v[i]; } printf("media: %f\n", ((float)tot / i)); int max = v[0]; int max_pos = 0; for (i = 1; i < LEN; i++) { if (v[i] > max) { max = v[i]; max_pos = i; } } printf("v[%d]:%d\n", max_pos, max); return 0; }
the_stack_data/145452304.c
// q09c // コンソール上で異なる整数n,rを入力し,順列nPrと組合せnCrを算出するプログラムを作成してください。 // ただし、n!を計算する関数fact(n)、順列nPrを計算する関数P(n,r)、組合せnCrを計算する関数C(n,r)、入出力を行う関数main()はそれぞれ異なるファイルに保存し、分割コンパイルを行うものとします。 // ■提出ファイル名: main()→ q09c1.c,fact(n)→q09c2.c, P(n,r)→q09c3.c, C(n,r)→p09c4.c #include <stdio.h> extern double fact(int n); extern double P(int n, int r); extern double C(int n, int r); main () { int n, r; printf("n="); scanf("%d", &n); printf("r="); scanf("%d", &r); printf("nPr=%.0f\n", P(n, r)); printf("nCr=%.0f\n", C(n, r)); }
the_stack_data/580243.c
/************************************************************************/ /* */ /* Board_Data.c -- DP32 Customization Data Declarations */ /* */ /************************************************************************/ /* Author: Gene Apperson */ /* Copyright 2011, Digilent. All rights reserved */ /************************************************************************/ /* File Description: */ /* */ /* This file contains the board specific declartions and data structure */ /* to customize the chipKIT MPIDE for use with a CmodCK1 board using a */ /* PIC32 part in a 44-pin package. */ /* */ /* This code is based on earlier work: */ /* Copyright (c) 2010, 2011 by Mark Sproul */ /* Copyright (c) 2005, 2006 by David A. Mellis */ /* */ /************************************************************************/ /* Revision History: */ /* */ /* 11/28/2011(GeneA): Created by splitting data out of Board_Defs.h */ /* 03/26/2013(KeithV): Modified for DP32 board */ /* */ /************************************************************************/ //* 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 /************************************************************************/ #if !defined(BOARD_DATA_C) #define BOARD_DATA_C #include <inttypes.h> /* ------------------------------------------------------------ */ /* Data Tables */ /* ------------------------------------------------------------ */ /* The following declarations define data used in pin mapping. */ /* ------------------------------------------------------------ */ #if defined(OPT_BOARD_DATA) /* ------------------------------------------------------------ */ /* This table is used to map from port number to the address of ** the TRIS register for the port. This is used for setting the ** pin direction. */ const uint32_t port_to_tris_PGM[] = { NOT_A_PORT, //index value 0 is not used #if defined(_PORTA) (uint32_t)&TRISA, #else NOT_A_PORT, #endif #if defined(_PORTB) (uint32_t)&TRISB, #else NOT_A_PORT, #endif #if defined(_PORTC) (uint32_t)&TRISC, #else NOT_A_PORT, #endif #if defined(_PORTD) (uint32_t)&TRISD, #else NOT_A_PORT, #endif #if defined(_PORTE) (uint32_t)&TRISE, #else NOT_A_PORT, #endif #if defined(_PORTF) (uint32_t)&TRISF, #else NOT_A_PORT, #endif #if defined(_PORTG) (uint32_t)&TRISG, #else NOT_A_PORT, #endif NOT_A_PORT, }; /* ------------------------------------------------------------ */ /* This table is used to map the digital pin number to the port ** containing that pin. The default mapping is to assign pin numbers ** for every possible port bit in order from PORTA to PORTG. */ const uint8_t digital_pin_to_port_PGM[] = { _IOPORT_PC, // 0 = RC8 (RX) _IOPORT_PC, // 1 = RC9 (TX) _IOPORT_PB, // 2 = RB7 (INT0) _IOPORT_PC, // 3 = RC4 (INT1) _IOPORT_PC, // 4 = RC6 (INT2) _IOPORT_PB, // 5 = RB5 (INT3) _IOPORT_PC, // 6 = RC7 (INT4) _IOPORT_PA, // 7 = RA3 _IOPORT_PC, // 8 = RC5 _IOPORT_PC, // 9 = RC3 _IOPORT_PC, // 10 = RC1 _IOPORT_PB, // 11 = RB13 _IOPORT_PB, // 12 = RB1 _IOPORT_PB, // 13 = RB14 _IOPORT_PA, // 14 / A0 = RA1 _IOPORT_PB, // 15 / A1 = RB0 _IOPORT_PC, // 16 / A2 = RC0 _IOPORT_PC, // 17 / A3 = RC2 _IOPORT_PB, // 18 / A4 = RB2 _IOPORT_PB, // 19 / A5 = RB3 _IOPORT_PA, // 20 / AREF = RA0 _IOPORT_PB, // 21 / PROG = RB4 _IOPORT_PA, // 22 / L = RA10 _IOPORT_PA, // 23 / TX = RA7 _IOPORT_PA, // 24 / RX = RA8 _IOPORT_PA, // 25 / MISO = RA4 _IOPORT_PB, // 26 / SCK = RB15 _IOPORT_PA, // 27 / MOSI = RA9 _IOPORT_PB, // 28 / SDA = B9 _IOPORT_PB, // 29 / SCL = B8 }; /* ------------------------------------------------------------ */ /* This table is used to map from digital pin number to a bit mask ** for the corresponding bit within the port. */ const uint16_t digital_pin_to_bit_mask_PGM[] = { _BV( 8), // 0 = RC8 (RX) _BV( 9), // 1 = RC9 (TX) _BV( 7), // 2 = RB7 (INT0) _BV( 4), // 3 = RC4 (INT1) _BV( 6), // 4 = RC6 (INT2) _BV( 5), // 5 = RB5 (INT3) _BV( 7), // 6 = RC7 (INT4) _BV( 3), // 7 = RA3 _BV( 5), // 8 = RC5 _BV( 3), // 9 = RC3 _BV( 1), // 10 = RC1 _BV(13), // 11 = RB13 _BV( 1), // 12 = RB1 _BV(14), // 13 = RB14 _BV( 1), // A0 = RA1 _BV( 0), // A1 = RB0 _BV( 0), // A2 = RC0 _BV( 2), // A3 = RC2 _BV( 2), // A4 = RB2 _BV( 3), // A5 = RB3 _BV( 0), // AREF = RA0 _BV( 4), // PROG = RB4 _BV(10), // L = RA10 _BV( 7), // TX = RA7 _BV( 8), // RX = RA8 _BV( 4), // MISO = RA4 _BV(15), // SCK = RB15 _BV( 9), // MOSI = RA9 _BV( 9), // SDA = B9 _BV( 8), // SCL = B8 }; /* ------------------------------------------------------------ */ /* This table is used to map from digital pin number to the output ** compare number, input capture number, and timer external clock ** input associated with that pin. */ const uint16_t digital_pin_to_timer_PGM[] = { NOT_ON_TIMER, // 0 = RC8 (RX) NOT_ON_TIMER, // 1 = RC9 (TX) _TIMER_IC4, // 2 = RB7 (INT0) _TIMER_OC3, // 3 = RC4 (INT1) _TIMER_IC1, // 4 = RC6 (INT2) _TIMER_OC2, // 5 = RB5 (INT3) _TIMER_OC1, // 6 = RC7 (INT4) _TIMER_IC2, // 7 = RA3 NOT_ON_TIMER, // 8 = RC5 _TIMER_OC4, // 9 = RC3 _TIMER_OC5, // 10 = RC1 _TIMER_IC5, // 11 = RB13 _TIMER_IC3, // 12 = RB1 NOT_ON_TIMER, // 13 = RB14 NOT_ON_TIMER, // A0 = RA1 NOT_ON_TIMER, // A1 = RB0 NOT_ON_TIMER, // A2 = RC0 NOT_ON_TIMER, // A3 = RC2 NOT_ON_TIMER, // A4 = RB2 NOT_ON_TIMER, // A5 = RB3 NOT_ON_TIMER, // AREF = RA0 NOT_ON_TIMER, // PROG = RB4 NOT_ON_TIMER, // L = RA10 NOT_ON_TIMER, // TX = RA7 NOT_ON_TIMER, // RX = RA8 NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, }; /* ------------------------------------------------------------ */ /* This table maps from a digital pin number to the corresponding ** PPS register. This register is used to select the peripheral output ** connected to the pin. The register is set to 0 to disconnedt the ** pin from any peripheral so it can be used as GPIO. ** For PIC32MX1xx/2xx series devices, the PPS output select registers ** are arranged as a contiguous series of 32 bit registers. This table ** treats these registers as an array of DWORDs an stores the index ** to the register. */ const uint8_t digital_pin_to_pps_out_PGM[] = { _PPS_OUT(_PPS_RPC8R ), // 0 = RC8 (RX) _PPS_OUT(_PPS_RPC9R ), // 1 = RC9 (TX) _PPS_OUT(_PPS_RPB7R ), // 2 = RB7 (INT0) _PPS_OUT(_PPS_RPC4R ), // 3 = RC4 (INT1) _PPS_OUT(_PPS_RPC6R ), // 4 = RC6 (INT2) _PPS_OUT(_PPS_RPB5R ), // 5 = RB5 (INT3) _PPS_OUT(_PPS_RPC7R ), // 6 = RC7 (INT4) _PPS_OUT(_PPS_RPA3R ), // 7 = RA3 _PPS_OUT(_PPS_RPC5R ), // 8 = RC5 _PPS_OUT(_PPS_RPC3R ), // 9 = RC3 _PPS_OUT(_PPS_RPC1R ), // 10 = RC1 _PPS_OUT(_PPS_RPB13R), // 11 = RB13 _PPS_OUT(_PPS_RPB1R ), // 12 = RB1 _PPS_OUT(_PPS_RPB14R), // 13 = RB14 _PPS_OUT(_PPS_RPA1R ), // A0 = RA1 _PPS_OUT(_PPS_RPB0R ), // A1 = RB0 _PPS_OUT(_PPS_RPC0R ), // A2 = RC0 _PPS_OUT(_PPS_RPC2R ), // A3 = RC2 _PPS_OUT(_PPS_RPB2R ), // A4 = RB2 _PPS_OUT(_PPS_RPB3R ), // A5 = RB3 _PPS_OUT(_PPS_RPA0R ), // AREF = RA0 _PPS_OUT(_PPS_RPB4R ), // PROG = RB4 NOT_PPS_PIN, // L = RA10 NOT_PPS_PIN, // TX = RA7 _PPS_OUT(_PPS_RPA8R ), // RX = RA8 _PPS_OUT(_PPS_RPA4R ), _PPS_OUT(_PPS_RPB15R), _PPS_OUT(_PPS_RPA9R ), _PPS_OUT(_PPS_RPB9R ), _PPS_OUT(_PPS_RPB8R ), }; /* ------------------------------------------------------------ */ /* This table maps from the digital pin number to the value to be ** loaded into a PPS input select register to select that pin. ** It also maps from digital pin number to input/output pin set to ** which the pin belongs. The set mask is in the high four bits, ** the select value is in the low four bits. ** Note: if the PIC32 device has more than four pin sets, or more than ** 16 pin mapping choices per input function, then this table will have ** to be redefined as a table of uint16_t values and the macros used to ** access the table redefined as well. */ const uint8_t digital_pin_to_pps_in_PGM[] = { _PPS_IN(_PPS_RPC8 ), // 0 = RC8 (RX) _PPS_IN(_PPS_RPC9 ), // 1 = RC9 (TX) _PPS_IN(_PPS_RPB7 ), // 2 = RD5 (INT0) _PPS_IN(_PPS_RPC4 ), // 3 = RC4 (INT1) _PPS_IN(_PPS_RPC6 ), // 4 = RC6 (INT2) _PPS_IN(_PPS_RPB5 ), // 5 = RB5 (INT3) _PPS_IN(_PPS_RPC7 ), // 6 = RC7 (INT4) _PPS_IN(_PPS_RPA3 ), // 7 = RA3 _PPS_IN(_PPS_RPC5 ), // 8 = RC5 _PPS_IN(_PPS_RPC3 ), // 9 = RC3 _PPS_IN(_PPS_RPC1 ), // 10 = RC1 _PPS_IN(_PPS_RPB13), // 11 = RB13 _PPS_IN(_PPS_RPB1 ), // 12 = RB1 _PPS_IN(_PPS_RPB14), // 13 = RB14 _PPS_IN(_PPS_RPA1 ), // A0 = RA1 _PPS_IN(_PPS_RPB0 ), // A1 = RB0 _PPS_IN(_PPS_RPC0 ), // A2 = RC0 _PPS_IN(_PPS_RPC2 ), // A3 = RC2 _PPS_IN(_PPS_RPB2 ), // A4 = RB2 _PPS_IN(_PPS_RPB3 ), // A5 = RB3 _PPS_IN(_PPS_RPA0 ), // AREF = RA0 _PPS_IN(_PPS_RPB4 ), // PROG = RB4 NOT_PPS_PIN, // L = RA10 NOT_PPS_PIN, // TX = RA7 _PPS_IN(_PPS_RPA8 ), // RX = RA8 _PPS_IN(_PPS_RPA4 ), _PPS_IN(_PPS_RPB15), _PPS_IN(_PPS_RPA9 ), _PPS_IN(_PPS_RPB9 ), _PPS_IN(_PPS_RPB8 ), }; /* ------------------------------------------------------------ */ /* This table is used to map from the analog pin number to the ** actual A/D converter channel used for that pin. ** In the default case, where there is a one-to-one mapping, this ** table isn't needed as the analogInPinToChannel() macro is defined ** to provide the mapping. */ //#if defined(_NOT_USED_) const uint8_t analog_pin_to_channel_PGM[] = { //* Arduino Pin PIC32 Analog channel 1, //* A0 11 2, //* A1 10 6, //* A2 9 8, //* A3 0 4, //* A4 1 5, //* A5 2 9, //* A6 3, //* A7 10, //* A8 }; //#endif const uint8_t digital_pin_to_analog_PGM[] = { // Digital pins NOT_ANALOG_PIN, // 0 NOT_ANALOG_PIN, // 1 NOT_ANALOG_PIN, // 2 NOT_ANALOG_PIN, // 3 NOT_ANALOG_PIN, // 4 NOT_ANALOG_PIN, // 5 NOT_ANALOG_PIN, // 6 NOT_ANALOG_PIN, // 7 NOT_ANALOG_PIN, // 8 NOT_ANALOG_PIN, // 9 NOT_ANALOG_PIN, // 10 NOT_ANALOG_PIN, // 11 _BOARD_AN7, // 12 _BOARD_AN8, // 13 // Analog pins _BOARD_AN0, // A0 = RA0 = 14 _BOARD_AN1, // A1 = RA1 = 15 _BOARD_AN2, // A2 = RC0 = 16 _BOARD_AN3, // A3 = RC2 = 17 _BOARD_AN4, // A4 = RB2 = 18 _BOARD_AN5, // A5 = RB3 = 19 // Extra functions - LEDs, buttons, etc NOT_ANALOG_PIN, // 20 NOT_ANALOG_PIN, // 21 NOT_ANALOG_PIN, // 22 NOT_ANALOG_PIN, // 23 NOT_ANALOG_PIN, // 24 NOT_ANALOG_PIN, // 25 _BOARD_AN6, // 26 NOT_ANALOG_PIN, // 27 NOT_ANALOG_PIN, // 28 NOT_ANALOG_PIN, // 29 }; /* ------------------------------------------------------------ */ /* This table maps from an output compare number as stored in the ** digital_pin_to_timer_PGM table to the digital pin number of the ** pin that OC is connected to. This table is only required for ** devices that support peripheral pin select (PPS), i.e. PIC32MX1xx/2xx ** devices. */ const uint8_t output_compare_to_digital_pin_PGM[] = { 0, PIN_OC1, // A0, B3, B4, B15, B7 ; B15 RPB15R = 5 PIN_OC2, // A1, B5, B1, B11, B8 ; B8 RPB8R = 5 PIN_OC3, // A3, B14, B0, B10, B9 ; B9 RPB9R = 5 PIN_OC4, // A2, B6, A4, B13, B2 ; B2 RPB2R = 5 PIN_OC5, // A2, B6, A4, B13, B2 ; B13 RPB13R = 6 }; /* ------------------------------------------------------------ */ /* This table maps from an external interrupt number to the digital ** pin for that interrupt. */ const uint8_t external_int_to_digital_pin_PGM[] = { NOT_PPS_PIN, // INT0 is not mappable; RB7 PIN_INT1, // A3, B14, B0, B10, B9; B9 INT1R = RPB9 = 4 PIN_INT2, // A2, B6, A4, B13, B2; B2 INT2R = RPB2 = 4 PIN_INT3, // A1, B5, B1, B11, B8; B8 INT3R = RPB8 = 4 PIN_INT4 // A0, B3, B4, B15, B7; B4 INT4R = RPB4 = 2 }; /* ------------------------------------------------------------ */ /* Board Customization Functions */ /* ------------------------------------------------------------ */ /* */ /* The following can be used to customize the behavior of some */ /* of the core API functions. These provide hooks that can be */ /* used to extend or replace the default behavior of the core */ /* functions. To use one of these functions, add the desired */ /* code to the function skeleton below and then set the value */ /* of the appropriate compile switch above to 1. This will */ /* cause the hook function to be compiled into the build and */ /* to cause the code to call the hook function to be compiled */ /* into the appropriate core function. */ /* */ /* ------------------------------------------------------------ */ /*** _board_init ** ** Parameters: ** none ** ** Return Value: ** none ** ** Errors: ** none ** ** Description: ** This function is called from the core init() function. ** This can be used to perform any board specific init ** that needs to be done when the processor comes out of ** reset and before the user sketch is run. */ #if (OPT_BOARD_INIT != 0) void _board_init(void) { // Turn Secondary oscillator off as GPIO is needed OSCCONCLR = _OSCCON_SOSCEN_MASK; } #endif /* ------------------------------------------------------------ */ /*** _board_pinMode ** ** Parameters: ** pin - digital pin number to configure ** mode - mode to which the pin should be configured ** ** Return Value: ** Returns 0 if not handled, !0 if handled. ** ** Errors: ** none ** ** Description: ** This function is called at the beginning of the pinMode ** function. It can perform any special processing needed ** when setting the pin mode. If this function returns zero, ** control will pass through the normal pinMode code. If ** it returns a non-zero value the normal pinMode code isn't ** executed. */ #if (OPT_BOARD_DIGITAL_IO != 0) int _board_pinMode(uint8_t pin, uint8_t mode) { return 0; } #endif /* ------------------------------------------------------------ */ /*** _board_getPinMode ** ** Parameters: ** pin - digital pin number ** mode - pointer to variable to receive mode value ** ** Return Value: ** Returns 0 if not handled, !0 if handled. ** ** Errors: ** none ** ** Description: ** This function is called at the beginning of the getPinMode ** function. It can perform any special processing needed ** when getting the pin mode. If this function returns zero, ** control will pass through the normal getPinMode code. If ** it returns a non-zero value the normal getPinMode code isn't ** executed. */ #if (OPT_BOARD_DIGITAL_IO != 0) int _board_getPinMode(uint8_t pin, uint8_t * mode) { return 0; } #endif /* ------------------------------------------------------------ */ /*** _board_digitalWrite ** ** Parameters: ** pin - digital pin number ** val - value to write to the pin ** ** Return Value: ** Returns 0 if not handled, !0 if handled. ** ** Errors: ** none ** ** Description: ** This function is called at the beginning of the digitalWrite ** function. It can perform any special processing needed ** in writing to the pin. If this function returns zero, ** control will pass through the normal digitalWrite code. If ** it returns a non-zero value the normal digitalWrite code isn't ** executed. */#if (OPT_BOARD_DIGITAL_IO != 0) int _board_digitalWrite(uint8_t pin, uint8_t val) { return 0; } #endif /* ------------------------------------------------------------ */ /*** _board_digitalRead ** ** Parameters: ** pin - digital pin number ** val - pointer to variable to receive pin value ** ** Return Value: ** Returns 0 if not handled, !0 if handled. ** ** Errors: ** none ** ** Description: ** This function is called at the beginning of the digitalRead ** function. It can perform any special processing needed ** in reading from the pin. If this function returns zero, ** control will pass through the normal digitalRead code. If ** it returns a non-zero value the normal digitalRead code isn't ** executed. */ #if (OPT_BOARD_DIGITAL_IO != 0) int _board_digitalRead(uint8_t pin, uint8_t * val) { return 0; } #endif /* ------------------------------------------------------------ */ /*** _board_analogRead ** ** Parameters: ** pin - analog channel number ** val - pointer to variable to receive analog value ** ** Return Value: ** Returns 0 if not handled, !0 if handled. ** ** Errors: ** none ** ** Description: ** This function is called at the beginning of the analogRead ** function. It can perform any special processing needed ** in reading from the pin. If this function returns zero, ** control will pass through the normal analogRead code. If ** it returns a non-zero value the normal analogRead code isn't ** executed. */ #if (OPT_BOARD_ANALOG_READ != 0) int _board_analogRead(uint8_t pin, int * val) { return 0; } #endif /* ------------------------------------------------------------ */ /*** _board_analogReference ** ** Parameters: ** ** Return Value: ** Returns 0 if not handled, !0 if handled. ** ** Errors: ** none ** ** Description: ** This function is called at the beginning of the analogReference ** function. It can perform any special processing needed ** to set the reference voltage. If this function returns zero, ** control will pass through the normal analogReference code. If ** it returns a non-zero value the normal analogReference code isn't ** executed. */ #if (OPT_BOARD_ANALOG_READ != 0) int _board_analogReference(uint8_t mode) { return 0; } #endif /* ------------------------------------------------------------ */ /*** _board_analogWrite ** ** Parameters: ** pin - pin number ** val - analog value to write ** ** Return Value: ** Returns 0 if not handled, !0 if handled. ** ** Errors: ** none ** ** Description: ** This function is called at the beginning of the analogWrite ** function. It can perform any special processing needed ** in writing to the pin. If this function returns zero, ** control will pass through the normal analogWrite code. If ** it returns a non-zero value the normal analogWrite code isn't ** executed. */ #if (OPT_BOARD_ANALOG_WRITE != 0) int _board_analogWrite(uint8_t pin, int val) { return 0; } #endif #endif // OPT_BOARD_DATA /* ------------------------------------------------------------ */ #endif // BOARD_DATA_C /************************************************************************/
the_stack_data/706199.c
#include <errno.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> int main(argc, argv) int argc; char **argv; { char buf[16384]; char *p; int t; int c=0; FILE *f = NULL; char fn[32]; if (argc != 2) { fprintf(stderr, "Usage: %s <target folder>\n", argv[0]); exit(1); } if (chdir(argv[1]) != 0) { perror(argv[1]); exit(1); } while(fgets(buf, sizeof(buf) - 1, stdin)) { c++; printf("%d\n", c); fflush(stdout); *(buf + strlen(buf) -1) = 0x00; if (!strncmp(buf + 8, " Query", 6) || !strncmp(buf + 8, " Connect", 8) || !strncmp(buf + 8, " Quit", 5) || !strncmp(buf + 8, " Init DB", 8)) { *(buf + 8) = 0x00; t = atoi(buf + 2); printf("Thread %d\n", t); sprintf(fn, "%d.thread", t); if (f) fclose(f); if ((f = fopen(fn, "a")) == NULL) { perror(fn); exit(1); } *(buf + 8) = 0x20; fprintf(f, "%s\n", buf); continue; } if (!strncmp(buf + 22, " Query", 6) || !strncmp(buf + 22, " Connect", 8) || !strncmp(buf + 22, " Quit", 5) || !strncmp(buf + 22, " Init DB", 8)) { *(buf + 22) = 0x00; t = atoi(buf + 16); printf("Thread %d\n", t); sprintf(fn, "%d.thread", t); if (f) fclose(f); if ((f = fopen(fn, "a")) == NULL) { perror(fn); exit(1); } *(buf + 22) = 0x20; fprintf(f, "%s\n", buf); continue; } if (f) fprintf(f, "%s\n", buf); } if (f) fclose(f); exit(0); }
the_stack_data/234517276.c
#include <stdio.h> #include <limits.h> #include <float.h> void printFromLib(void); void printFromCalculations(void); long long int pow2(long long int); int main(void) { printFromLib(); printFromCalculations(); return 0; } void printFromLib(void) { printf("Printing from limits.h\n"); printf("char MIN=%20d MAX=%20d\n", CHAR_MIN, CHAR_MAX); printf("uchar MIN=%20d MAX=%20u\n", 0, UCHAR_MAX); printf("short MIN=%20d MAX=%20d\n", SHRT_MIN, SHRT_MAX); printf("ushort MIN=%20d MAX=%20u\n", 0, USHRT_MAX); printf("int MIN=%20d MAX=%20d\n", INT_MIN, INT_MAX); printf("uint MIN=%20d MAX=%20u\n", 0, UINT_MAX); printf("long MIN=%20ld MAX=%20ld\n", LONG_MIN, LONG_MAX); printf("ulong MIN=%20d MAX=%20lu\n", 0, ULONG_MAX); printf("FLOATs\n"); printf("float MIN=%20e MAX=%20e\n", FLT_MIN, FLT_MAX); printf("double float MIN=%20e MAX=%20e\n", DBL_MIN, DBL_MAX); printf("long double MIN=%20Le MAX=%20Le\n", LDBL_MIN, LDBL_MAX); } #define SIGNED_MAX(x) (~(-1 << (sizeof(x) * 8 - 1))) void printFromCalculations(void) { printf("Printing from Calculations\n"); printf("char MIN=%20d MAX=%20d\n", SIGNED_MAX(char) * -1 - 1, SIGNED_MAX(char)); unsigned char c = 0; printf("uchar MIN=%20d MAX=%20d\n", c, c--); printf("int MIN=%20d MAX=%20d\n", SIGNED_MAX(int) * -1 - 1, SIGNED_MAX(int)); unsigned int i = 0; i--; printf("uint MIN=%20d MAX=%20u\n", 0, i); printf("short MIN=%20d MAX=%20d\n", SIGNED_MAX(short int) * -1 - 1, SIGNED_MAX(short int)); unsigned short int s = 0; s--; printf("ushort MIN=%20d MAX=%20d\n", 0, s); unsigned long int l = 0; l--; printf("ulong MIN=%20d MAX=%20lu\n", 0, l); l = l / 2 + 1; printf("long MIN=%20ld MAX=%20ld\n", -1 * l, l - 1); // Can calculate floats using only bit mask of number in computer memory. }
the_stack_data/90761737.c
#include <stdio.h> int main() { int row = 3, col = 2; int arr[3][2] = {{2, 3}, {4, 5}, {6, 7}}; int(*ptr)[3][2] = &arr; for (int i = 0; i < 3; i++) { printf("\n"); for (int j = 0; j < 2; j++) { printf("%d, ", (*ptr)[i][j]); } } // TODO return 0; }
the_stack_data/629522.c
/* Generated by re2c */ #line 1 "bug1472770_b.re" // re2c $INPUT -o $OUTPUT -b #define NULL ((char*) 0) #define YYCTYPE char #define YYCURSOR p #define YYLIMIT p #define YYMARKER q #define YYFILL(n) #include <stdio.h> int scan(char *p) { int n = 0; char *q; printf("[--------------\n"); printf("%s\n", p); printf("]--------------\n"); start: #line 24 "bug1472770_b.c" { YYCTYPE yych; static const unsigned char yybm[] = { 0, 128, 128, 128, 128, 128, 128, 128, 128, 128, 0, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, }; goto yy0; yy1: ++YYCURSOR; yy0: if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; if (yybm[0+yych] & 128) { goto yy1; } if (yych >= 0x01) goto yy5; ++YYCURSOR; #line 27 "bug1472770_b.re" { return n; } #line 76 "bug1472770_b.c" yy5: ++YYCURSOR; #line 22 "bug1472770_b.re" { ++n; goto start; } #line 84 "bug1472770_b.c" } #line 30 "bug1472770_b.re" } int main(int argc, char **argv) { int n = 0; char *largv[4]; if (argc < 2) { argc = 4; argv = largv; argv[1] = ""; argv[2] = "1\n\n"; argv[3] = "1\n2\n"; } while(++n < argc) { printf("%d\n", scan(argv[n])); } return 0; }
the_stack_data/126229.c
/*Exercise 4 - Functions Implement the three functions minimum(), maximum() and multiply() below the main() function. Do not change the code given in the main() function when you are implementing your solution.*/ #include <stdio.h> int minimum(int num1,int num2); int maximum(int num1,int num2); int multiply(int num1,int num2); int main() { int no1, no2; printf("Enter a value for no 1 : "); scanf("%d", &no1); printf("Enter a value for no 2 : "); scanf("%d", &no2); printf("%d ", minimum(no1, no2)); printf("%d ", maximum(no1, no2)); printf("%d ", multiply(no1, no2)); return 0; } int minimum(int num1,int num2) { if(num1>num2) { return num2; } else { return num1; } } int maximum(int num1,int num2) { if(num1 > num2) { return num1; } else { return num2; } } int multiply(int num1,int num2) { int multiply; multiply = num1*num2; return multiply; }
the_stack_data/60914.c
#include<stdio.h> #include<stdlib.h> int main() { int small, big, num, lim, range; printf("Enter a Limit:-\n"); scanf("%d",&lim); printf("Enter %d numbers:\n",lim); scanf("%d",&num); small = big = num; lim = lim - 1; while(lim) { scanf("%d",&num); if(num>big) { big =num; } else if(num<small) { small = num; } lim--; } range = big - small; printf("Small Number = %d\nBig Number = %d\n", small, big); printf("Range is %d\n", abs(range)); return 0; }
the_stack_data/115765521.c
#include <stdio.h> #include <string.h> //#define SIZE 30000000 #define SIZE 9 int main(void) { int arr[SIZE]; memset(arr, 99999999, SIZE * sizeof(arr[0])); arr[0] = 0; arr[1] = 3; arr[2] = 6; //arr[3] = 12; //arr[4] = 1; //arr[5] = 3; for (int i = 2; i < SIZE - 1; i++) { int spoken_in_arr = 0; int num = 0; int index = 0; int prev_index = i + 1; int spoken = arr[i]; printf("prev %d, spoken %d\n", prev_index, spoken); for (int k = 0; k < SIZE - 2; k++) { if (spoken == arr[k]) { spoken_in_arr = 1; } } if (spoken_in_arr == 1) { for (int x = 0; x < SIZE - 3; x++) { if (spoken == arr[x]) { index = x + 1; printf("index: %d\n", index); } } num = prev_index - index; arr[i + 1] = num; } else { arr[i + 1] = 0; } int p = 0; while (p < SIZE - 1) { printf("%d, ", arr[p++]); } printf("\n"); } printf("%d\n", arr[SIZE - 1]); }
the_stack_data/122016103.c
// Program which converts infix expression into postfix .. ! #include<stdio.h> #include<string.h> #include<stdlib.h> #include<ctype.h> #define MAX 100 char infix[MAX], postfix[MAX], STACK[MAX], ch; int i,j,pr,top=-1; char pop(); void push(char elem); int pre(char ch); void main() { printf("\n Enter the infix expression \n"); scanf("%s",infix); // '#' is the identification element. if top reaches '#', that means the array postfix is empty. push('#'); while(ch==infix[i++]!='\0') { if(isalnum(ch)) { postfix[j++]=ch; } else if(ch=='(') { push(ch); } // when ')' appears, the elements which is there inside '()' will be moved to postfix array ! else if(ch==')') { while(STACK[top]!='(') { postfix[j++]=pop(); } pop(); } else { pr=pre(ch); if(ch=='^') { pr++; } while(pre(STACK[top])>=pr) { postfix[j++]=pop(); } push(ch); } } while(STACK[top]!='#') { postfix[j++]=pop(); } postfix[j]='\0'; printf("\n The postfix Expression is : \n "); printf("%s\n",postfix); } int pre(char ch) { // returning values according to thier priority..!! switch(ch) { case '+' : case '-' : return 2; case '*' : case '/' : case '%' : return 3; case '^' : return 4; case '#' : return 0; case '(' : return 1; default : printf("\n INVALID ENTRY !! \n"); exit(0); } } void push(char ele) { STACK[++top]=ele; } char pop() { return(STACK[top--]); } /* OUTPUT : 1. Enter the infix expression (a+b) The postfix Expression is : ab+ 2. Enter the infix expression a/b*c+e The postfix Expression is : ab/c*e+ 3. Enter the infix expression a$b INVALID ENTRY !! */
the_stack_data/51700846.c
int test_odd_ones(unsigned x) { int i; int result = 0; for (i = 0; i < 8 * sizeof(int); i++) if (x & (1<<i)) result = !result; return result; }
the_stack_data/37638992.c
// program to print the string constant. #include<stdio.h> int main() { printf("hello, world\n"); return 0; }
the_stack_data/82101.c
#include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <stdlib.h> #include <string.h> /* race_cond.c */ char parent[] = "123456789"; char child[] = "ABCDEFGHIJ"; int pfd1[2]; // padre --> hijo int pfd2[2]; // hijo --> padre void error_y_exit(char *msg) { perror(msg); exit(1); } void Usage() { printf("./race_cond num \n"); printf("num son el número de caracteres que escribirá cada proceso (seguidos)\n"); exit(1); } void tell_wait() { if (pipe(pfd1) < 0 || pipe(pfd2) < 0) error_y_exit("Error --> pipe"); } void tell_parent() { write(pfd2[1], "c", sizeof(char)); } void tell_child() { write(pfd1[1], "p", sizeof(char)); } void wait_parent() { char c = '0'; while (c != 'p') read(pfd1[0], &c, sizeof(char)); } void wait_child() { char c = '0'; while (c != 'c') read(pfd2[0], &c, sizeof(char)); } int main(int argc, char *argv[]) { pid_t pid; int j; if (argc != 2) { Usage(); } int num = atoi(argv[1]); tell_wait(); if ((pid = fork())<0) { perror ("error->fork"); exit(1); } else if (pid==0) { close(pfd2[0]); for (j=0;j<strlen(child);j += num) { wait_parent(); for (int i = 0; i < num && j + i < strlen(child); i++) { write(1,(child+j+i),1); } tell_parent(); } } else if (pid>0) { close(pfd2[0]); for (j=0;j<strlen(parent);j += num) { wait_child(); for (int i = 0; i < num && j + i < strlen(parent); i++) { write(1,(parent+j+i),1); } tell_child(); } } exit(0); }
the_stack_data/664575.c
// Copyright 2015 Richard A Burton // [email protected] // See license.txt for license terms. #include <stdint.h> void call_user_start(void) { uint8_t loop; for(loop = 0; loop < 10; loop++) { ets_printf("testload\n"); ets_delay_us(20000); } }
the_stack_data/64199907.c
extern float __VERIFIER_nondet_float(void); extern int __VERIFIER_nondet_int(void); typedef enum {false, true} bool; bool __VERIFIER_nondet_bool(void) { return __VERIFIER_nondet_int() != 0; } int main() { float x_11, _x_x_11; bool _EL_X_3065, _x__EL_X_3065; bool _EL_X_3067, _x__EL_X_3067; float x_2, _x_x_2; bool _EL_U_3072, _x__EL_U_3072; float x_3, _x_x_3; float x_22, _x_x_22; float x_1, _x_x_1; float x_23, _x_x_23; float x_0, _x_x_0; float x_8, _x_x_8; float x_4, _x_x_4; float x_9, _x_x_9; float x_5, _x_x_5; float x_6, _x_x_6; float x_12, _x_x_12; float x_13, _x_x_13; float x_15, _x_x_15; float x_14, _x_x_14; float x_18, _x_x_18; float x_16, _x_x_16; float x_19, _x_x_19; float x_17, _x_x_17; float x_27, _x_x_27; float x_20, _x_x_20; float x_30, _x_x_30; float x_24, _x_x_24; float x_25, _x_x_25; float x_26, _x_x_26; float x_28, _x_x_28; float x_29, _x_x_29; float x_31, _x_x_31; float x_21, _x_x_21; float x_7, _x_x_7; float x_10, _x_x_10; int __steps_to_fair = __VERIFIER_nondet_int(); x_11 = __VERIFIER_nondet_float(); _EL_X_3065 = __VERIFIER_nondet_bool(); _EL_X_3067 = __VERIFIER_nondet_bool(); x_2 = __VERIFIER_nondet_float(); _EL_U_3072 = __VERIFIER_nondet_bool(); x_3 = __VERIFIER_nondet_float(); x_22 = __VERIFIER_nondet_float(); x_1 = __VERIFIER_nondet_float(); x_23 = __VERIFIER_nondet_float(); x_0 = __VERIFIER_nondet_float(); x_8 = __VERIFIER_nondet_float(); x_4 = __VERIFIER_nondet_float(); x_9 = __VERIFIER_nondet_float(); x_5 = __VERIFIER_nondet_float(); x_6 = __VERIFIER_nondet_float(); x_12 = __VERIFIER_nondet_float(); x_13 = __VERIFIER_nondet_float(); x_15 = __VERIFIER_nondet_float(); x_14 = __VERIFIER_nondet_float(); x_18 = __VERIFIER_nondet_float(); x_16 = __VERIFIER_nondet_float(); x_19 = __VERIFIER_nondet_float(); x_17 = __VERIFIER_nondet_float(); x_27 = __VERIFIER_nondet_float(); x_20 = __VERIFIER_nondet_float(); x_30 = __VERIFIER_nondet_float(); x_24 = __VERIFIER_nondet_float(); x_25 = __VERIFIER_nondet_float(); x_26 = __VERIFIER_nondet_float(); x_28 = __VERIFIER_nondet_float(); x_29 = __VERIFIER_nondet_float(); x_31 = __VERIFIER_nondet_float(); x_21 = __VERIFIER_nondet_float(); x_7 = __VERIFIER_nondet_float(); x_10 = __VERIFIER_nondet_float(); bool __ok = (1 && ( !(_EL_U_3072 || (( !_EL_X_3067) || ( !_EL_X_3065))))); while (__steps_to_fair >= 0 && __ok) { if (((( !_EL_X_3067) || ( !_EL_X_3065)) || ( !(_EL_U_3072 || (( !_EL_X_3067) || ( !_EL_X_3065)))))) { __steps_to_fair = __VERIFIER_nondet_int(); } else { __steps_to_fair--; } _x_x_11 = __VERIFIER_nondet_float(); _x__EL_X_3065 = __VERIFIER_nondet_bool(); _x__EL_X_3067 = __VERIFIER_nondet_bool(); _x_x_2 = __VERIFIER_nondet_float(); _x__EL_U_3072 = __VERIFIER_nondet_bool(); _x_x_3 = __VERIFIER_nondet_float(); _x_x_22 = __VERIFIER_nondet_float(); _x_x_1 = __VERIFIER_nondet_float(); _x_x_23 = __VERIFIER_nondet_float(); _x_x_0 = __VERIFIER_nondet_float(); _x_x_8 = __VERIFIER_nondet_float(); _x_x_4 = __VERIFIER_nondet_float(); _x_x_9 = __VERIFIER_nondet_float(); _x_x_5 = __VERIFIER_nondet_float(); _x_x_6 = __VERIFIER_nondet_float(); _x_x_12 = __VERIFIER_nondet_float(); _x_x_13 = __VERIFIER_nondet_float(); _x_x_15 = __VERIFIER_nondet_float(); _x_x_14 = __VERIFIER_nondet_float(); _x_x_18 = __VERIFIER_nondet_float(); _x_x_16 = __VERIFIER_nondet_float(); _x_x_19 = __VERIFIER_nondet_float(); _x_x_17 = __VERIFIER_nondet_float(); _x_x_27 = __VERIFIER_nondet_float(); _x_x_20 = __VERIFIER_nondet_float(); _x_x_30 = __VERIFIER_nondet_float(); _x_x_24 = __VERIFIER_nondet_float(); _x_x_25 = __VERIFIER_nondet_float(); _x_x_26 = __VERIFIER_nondet_float(); _x_x_28 = __VERIFIER_nondet_float(); _x_x_29 = __VERIFIER_nondet_float(); _x_x_31 = __VERIFIER_nondet_float(); _x_x_21 = __VERIFIER_nondet_float(); _x_x_7 = __VERIFIER_nondet_float(); _x_x_10 = __VERIFIER_nondet_float(); __ok = ((((((((((((((((((((((((((((((((((((x_31 + (-1.0 * _x_x_0)) <= -9.0) && (((x_30 + (-1.0 * _x_x_0)) <= -19.0) && (((x_28 + (-1.0 * _x_x_0)) <= -10.0) && (((x_26 + (-1.0 * _x_x_0)) <= -14.0) && (((x_25 + (-1.0 * _x_x_0)) <= -15.0) && (((x_23 + (-1.0 * _x_x_0)) <= -7.0) && (((x_22 + (-1.0 * _x_x_0)) <= -15.0) && (((x_21 + (-1.0 * _x_x_0)) <= -8.0) && (((x_16 + (-1.0 * _x_x_0)) <= -10.0) && (((x_13 + (-1.0 * _x_x_0)) <= -11.0) && (((x_8 + (-1.0 * _x_x_0)) <= -4.0) && (((x_7 + (-1.0 * _x_x_0)) <= -4.0) && (((x_5 + (-1.0 * _x_x_0)) <= -7.0) && (((x_4 + (-1.0 * _x_x_0)) <= -4.0) && (((x_1 + (-1.0 * _x_x_0)) <= -20.0) && ((x_2 + (-1.0 * _x_x_0)) <= -14.0)))))))))))))))) && (((x_31 + (-1.0 * _x_x_0)) == -9.0) || (((x_30 + (-1.0 * _x_x_0)) == -19.0) || (((x_28 + (-1.0 * _x_x_0)) == -10.0) || (((x_26 + (-1.0 * _x_x_0)) == -14.0) || (((x_25 + (-1.0 * _x_x_0)) == -15.0) || (((x_23 + (-1.0 * _x_x_0)) == -7.0) || (((x_22 + (-1.0 * _x_x_0)) == -15.0) || (((x_21 + (-1.0 * _x_x_0)) == -8.0) || (((x_16 + (-1.0 * _x_x_0)) == -10.0) || (((x_13 + (-1.0 * _x_x_0)) == -11.0) || (((x_8 + (-1.0 * _x_x_0)) == -4.0) || (((x_7 + (-1.0 * _x_x_0)) == -4.0) || (((x_5 + (-1.0 * _x_x_0)) == -7.0) || (((x_4 + (-1.0 * _x_x_0)) == -4.0) || (((x_1 + (-1.0 * _x_x_0)) == -20.0) || ((x_2 + (-1.0 * _x_x_0)) == -14.0))))))))))))))))) && ((((x_31 + (-1.0 * _x_x_1)) <= -19.0) && (((x_30 + (-1.0 * _x_x_1)) <= -10.0) && (((x_27 + (-1.0 * _x_x_1)) <= -7.0) && (((x_26 + (-1.0 * _x_x_1)) <= -20.0) && (((x_25 + (-1.0 * _x_x_1)) <= -11.0) && (((x_23 + (-1.0 * _x_x_1)) <= -18.0) && (((x_22 + (-1.0 * _x_x_1)) <= -13.0) && (((x_21 + (-1.0 * _x_x_1)) <= -10.0) && (((x_18 + (-1.0 * _x_x_1)) <= -5.0) && (((x_16 + (-1.0 * _x_x_1)) <= -15.0) && (((x_15 + (-1.0 * _x_x_1)) <= -4.0) && (((x_10 + (-1.0 * _x_x_1)) <= -10.0) && (((x_5 + (-1.0 * _x_x_1)) <= -13.0) && (((x_4 + (-1.0 * _x_x_1)) <= -18.0) && (((x_0 + (-1.0 * _x_x_1)) <= -9.0) && ((x_3 + (-1.0 * _x_x_1)) <= -8.0)))))))))))))))) && (((x_31 + (-1.0 * _x_x_1)) == -19.0) || (((x_30 + (-1.0 * _x_x_1)) == -10.0) || (((x_27 + (-1.0 * _x_x_1)) == -7.0) || (((x_26 + (-1.0 * _x_x_1)) == -20.0) || (((x_25 + (-1.0 * _x_x_1)) == -11.0) || (((x_23 + (-1.0 * _x_x_1)) == -18.0) || (((x_22 + (-1.0 * _x_x_1)) == -13.0) || (((x_21 + (-1.0 * _x_x_1)) == -10.0) || (((x_18 + (-1.0 * _x_x_1)) == -5.0) || (((x_16 + (-1.0 * _x_x_1)) == -15.0) || (((x_15 + (-1.0 * _x_x_1)) == -4.0) || (((x_10 + (-1.0 * _x_x_1)) == -10.0) || (((x_5 + (-1.0 * _x_x_1)) == -13.0) || (((x_4 + (-1.0 * _x_x_1)) == -18.0) || (((x_0 + (-1.0 * _x_x_1)) == -9.0) || ((x_3 + (-1.0 * _x_x_1)) == -8.0)))))))))))))))))) && ((((x_29 + (-1.0 * _x_x_2)) <= -19.0) && (((x_28 + (-1.0 * _x_x_2)) <= -17.0) && (((x_22 + (-1.0 * _x_x_2)) <= -3.0) && (((x_21 + (-1.0 * _x_x_2)) <= -8.0) && (((x_20 + (-1.0 * _x_x_2)) <= -4.0) && (((x_19 + (-1.0 * _x_x_2)) <= -20.0) && (((x_18 + (-1.0 * _x_x_2)) <= -15.0) && (((x_16 + (-1.0 * _x_x_2)) <= -13.0) && (((x_15 + (-1.0 * _x_x_2)) <= -7.0) && (((x_13 + (-1.0 * _x_x_2)) <= -5.0) && (((x_11 + (-1.0 * _x_x_2)) <= -7.0) && (((x_9 + (-1.0 * _x_x_2)) <= -7.0) && (((x_7 + (-1.0 * _x_x_2)) <= -6.0) && (((x_6 + (-1.0 * _x_x_2)) <= -5.0) && (((x_0 + (-1.0 * _x_x_2)) <= -19.0) && ((x_4 + (-1.0 * _x_x_2)) <= -15.0)))))))))))))))) && (((x_29 + (-1.0 * _x_x_2)) == -19.0) || (((x_28 + (-1.0 * _x_x_2)) == -17.0) || (((x_22 + (-1.0 * _x_x_2)) == -3.0) || (((x_21 + (-1.0 * _x_x_2)) == -8.0) || (((x_20 + (-1.0 * _x_x_2)) == -4.0) || (((x_19 + (-1.0 * _x_x_2)) == -20.0) || (((x_18 + (-1.0 * _x_x_2)) == -15.0) || (((x_16 + (-1.0 * _x_x_2)) == -13.0) || (((x_15 + (-1.0 * _x_x_2)) == -7.0) || (((x_13 + (-1.0 * _x_x_2)) == -5.0) || (((x_11 + (-1.0 * _x_x_2)) == -7.0) || (((x_9 + (-1.0 * _x_x_2)) == -7.0) || (((x_7 + (-1.0 * _x_x_2)) == -6.0) || (((x_6 + (-1.0 * _x_x_2)) == -5.0) || (((x_0 + (-1.0 * _x_x_2)) == -19.0) || ((x_4 + (-1.0 * _x_x_2)) == -15.0)))))))))))))))))) && ((((x_30 + (-1.0 * _x_x_3)) <= -4.0) && (((x_27 + (-1.0 * _x_x_3)) <= -9.0) && (((x_26 + (-1.0 * _x_x_3)) <= -20.0) && (((x_22 + (-1.0 * _x_x_3)) <= -14.0) && (((x_20 + (-1.0 * _x_x_3)) <= -12.0) && (((x_17 + (-1.0 * _x_x_3)) <= -14.0) && (((x_16 + (-1.0 * _x_x_3)) <= -13.0) && (((x_14 + (-1.0 * _x_x_3)) <= -9.0) && (((x_13 + (-1.0 * _x_x_3)) <= -20.0) && (((x_10 + (-1.0 * _x_x_3)) <= -6.0) && (((x_9 + (-1.0 * _x_x_3)) <= -14.0) && (((x_4 + (-1.0 * _x_x_3)) <= -7.0) && (((x_3 + (-1.0 * _x_x_3)) <= -16.0) && (((x_2 + (-1.0 * _x_x_3)) <= -8.0) && (((x_0 + (-1.0 * _x_x_3)) <= -15.0) && ((x_1 + (-1.0 * _x_x_3)) <= -12.0)))))))))))))))) && (((x_30 + (-1.0 * _x_x_3)) == -4.0) || (((x_27 + (-1.0 * _x_x_3)) == -9.0) || (((x_26 + (-1.0 * _x_x_3)) == -20.0) || (((x_22 + (-1.0 * _x_x_3)) == -14.0) || (((x_20 + (-1.0 * _x_x_3)) == -12.0) || (((x_17 + (-1.0 * _x_x_3)) == -14.0) || (((x_16 + (-1.0 * _x_x_3)) == -13.0) || (((x_14 + (-1.0 * _x_x_3)) == -9.0) || (((x_13 + (-1.0 * _x_x_3)) == -20.0) || (((x_10 + (-1.0 * _x_x_3)) == -6.0) || (((x_9 + (-1.0 * _x_x_3)) == -14.0) || (((x_4 + (-1.0 * _x_x_3)) == -7.0) || (((x_3 + (-1.0 * _x_x_3)) == -16.0) || (((x_2 + (-1.0 * _x_x_3)) == -8.0) || (((x_0 + (-1.0 * _x_x_3)) == -15.0) || ((x_1 + (-1.0 * _x_x_3)) == -12.0)))))))))))))))))) && ((((x_28 + (-1.0 * _x_x_4)) <= -19.0) && (((x_25 + (-1.0 * _x_x_4)) <= -20.0) && (((x_24 + (-1.0 * _x_x_4)) <= -9.0) && (((x_21 + (-1.0 * _x_x_4)) <= -15.0) && (((x_20 + (-1.0 * _x_x_4)) <= -11.0) && (((x_19 + (-1.0 * _x_x_4)) <= -10.0) && (((x_14 + (-1.0 * _x_x_4)) <= -14.0) && (((x_12 + (-1.0 * _x_x_4)) <= -9.0) && (((x_10 + (-1.0 * _x_x_4)) <= -2.0) && (((x_9 + (-1.0 * _x_x_4)) <= -4.0) && (((x_6 + (-1.0 * _x_x_4)) <= -1.0) && (((x_5 + (-1.0 * _x_x_4)) <= -16.0) && (((x_4 + (-1.0 * _x_x_4)) <= -2.0) && (((x_2 + (-1.0 * _x_x_4)) <= -18.0) && (((x_0 + (-1.0 * _x_x_4)) <= -8.0) && ((x_1 + (-1.0 * _x_x_4)) <= -15.0)))))))))))))))) && (((x_28 + (-1.0 * _x_x_4)) == -19.0) || (((x_25 + (-1.0 * _x_x_4)) == -20.0) || (((x_24 + (-1.0 * _x_x_4)) == -9.0) || (((x_21 + (-1.0 * _x_x_4)) == -15.0) || (((x_20 + (-1.0 * _x_x_4)) == -11.0) || (((x_19 + (-1.0 * _x_x_4)) == -10.0) || (((x_14 + (-1.0 * _x_x_4)) == -14.0) || (((x_12 + (-1.0 * _x_x_4)) == -9.0) || (((x_10 + (-1.0 * _x_x_4)) == -2.0) || (((x_9 + (-1.0 * _x_x_4)) == -4.0) || (((x_6 + (-1.0 * _x_x_4)) == -1.0) || (((x_5 + (-1.0 * _x_x_4)) == -16.0) || (((x_4 + (-1.0 * _x_x_4)) == -2.0) || (((x_2 + (-1.0 * _x_x_4)) == -18.0) || (((x_0 + (-1.0 * _x_x_4)) == -8.0) || ((x_1 + (-1.0 * _x_x_4)) == -15.0)))))))))))))))))) && ((((x_29 + (-1.0 * _x_x_5)) <= -1.0) && (((x_28 + (-1.0 * _x_x_5)) <= -2.0) && (((x_26 + (-1.0 * _x_x_5)) <= -18.0) && (((x_25 + (-1.0 * _x_x_5)) <= -18.0) && (((x_23 + (-1.0 * _x_x_5)) <= -12.0) && (((x_22 + (-1.0 * _x_x_5)) <= -12.0) && (((x_18 + (-1.0 * _x_x_5)) <= -12.0) && (((x_17 + (-1.0 * _x_x_5)) <= -13.0) && (((x_16 + (-1.0 * _x_x_5)) <= -13.0) && (((x_14 + (-1.0 * _x_x_5)) <= -4.0) && (((x_11 + (-1.0 * _x_x_5)) <= -2.0) && (((x_8 + (-1.0 * _x_x_5)) <= -17.0) && (((x_7 + (-1.0 * _x_x_5)) <= -5.0) && (((x_6 + (-1.0 * _x_x_5)) <= -18.0) && (((x_0 + (-1.0 * _x_x_5)) <= -20.0) && ((x_3 + (-1.0 * _x_x_5)) <= -19.0)))))))))))))))) && (((x_29 + (-1.0 * _x_x_5)) == -1.0) || (((x_28 + (-1.0 * _x_x_5)) == -2.0) || (((x_26 + (-1.0 * _x_x_5)) == -18.0) || (((x_25 + (-1.0 * _x_x_5)) == -18.0) || (((x_23 + (-1.0 * _x_x_5)) == -12.0) || (((x_22 + (-1.0 * _x_x_5)) == -12.0) || (((x_18 + (-1.0 * _x_x_5)) == -12.0) || (((x_17 + (-1.0 * _x_x_5)) == -13.0) || (((x_16 + (-1.0 * _x_x_5)) == -13.0) || (((x_14 + (-1.0 * _x_x_5)) == -4.0) || (((x_11 + (-1.0 * _x_x_5)) == -2.0) || (((x_8 + (-1.0 * _x_x_5)) == -17.0) || (((x_7 + (-1.0 * _x_x_5)) == -5.0) || (((x_6 + (-1.0 * _x_x_5)) == -18.0) || (((x_0 + (-1.0 * _x_x_5)) == -20.0) || ((x_3 + (-1.0 * _x_x_5)) == -19.0)))))))))))))))))) && ((((x_29 + (-1.0 * _x_x_6)) <= -16.0) && (((x_26 + (-1.0 * _x_x_6)) <= -16.0) && (((x_24 + (-1.0 * _x_x_6)) <= -4.0) && (((x_23 + (-1.0 * _x_x_6)) <= -17.0) && (((x_22 + (-1.0 * _x_x_6)) <= -10.0) && (((x_21 + (-1.0 * _x_x_6)) <= -4.0) && (((x_18 + (-1.0 * _x_x_6)) <= -2.0) && (((x_13 + (-1.0 * _x_x_6)) <= -14.0) && (((x_12 + (-1.0 * _x_x_6)) <= -16.0) && (((x_11 + (-1.0 * _x_x_6)) <= -8.0) && (((x_10 + (-1.0 * _x_x_6)) <= -2.0) && (((x_9 + (-1.0 * _x_x_6)) <= -11.0) && (((x_7 + (-1.0 * _x_x_6)) <= -15.0) && (((x_5 + (-1.0 * _x_x_6)) <= -5.0) && (((x_0 + (-1.0 * _x_x_6)) <= -20.0) && ((x_2 + (-1.0 * _x_x_6)) <= -19.0)))))))))))))))) && (((x_29 + (-1.0 * _x_x_6)) == -16.0) || (((x_26 + (-1.0 * _x_x_6)) == -16.0) || (((x_24 + (-1.0 * _x_x_6)) == -4.0) || (((x_23 + (-1.0 * _x_x_6)) == -17.0) || (((x_22 + (-1.0 * _x_x_6)) == -10.0) || (((x_21 + (-1.0 * _x_x_6)) == -4.0) || (((x_18 + (-1.0 * _x_x_6)) == -2.0) || (((x_13 + (-1.0 * _x_x_6)) == -14.0) || (((x_12 + (-1.0 * _x_x_6)) == -16.0) || (((x_11 + (-1.0 * _x_x_6)) == -8.0) || (((x_10 + (-1.0 * _x_x_6)) == -2.0) || (((x_9 + (-1.0 * _x_x_6)) == -11.0) || (((x_7 + (-1.0 * _x_x_6)) == -15.0) || (((x_5 + (-1.0 * _x_x_6)) == -5.0) || (((x_0 + (-1.0 * _x_x_6)) == -20.0) || ((x_2 + (-1.0 * _x_x_6)) == -19.0)))))))))))))))))) && ((((x_30 + (-1.0 * _x_x_7)) <= -9.0) && (((x_29 + (-1.0 * _x_x_7)) <= -13.0) && (((x_28 + (-1.0 * _x_x_7)) <= -6.0) && (((x_24 + (-1.0 * _x_x_7)) <= -15.0) && (((x_23 + (-1.0 * _x_x_7)) <= -4.0) && (((x_22 + (-1.0 * _x_x_7)) <= -20.0) && (((x_20 + (-1.0 * _x_x_7)) <= -11.0) && (((x_17 + (-1.0 * _x_x_7)) <= -13.0) && (((x_15 + (-1.0 * _x_x_7)) <= -7.0) && (((x_13 + (-1.0 * _x_x_7)) <= -7.0) && (((x_11 + (-1.0 * _x_x_7)) <= -9.0) && (((x_10 + (-1.0 * _x_x_7)) <= -7.0) && (((x_9 + (-1.0 * _x_x_7)) <= -17.0) && (((x_4 + (-1.0 * _x_x_7)) <= -4.0) && (((x_1 + (-1.0 * _x_x_7)) <= -19.0) && ((x_2 + (-1.0 * _x_x_7)) <= -4.0)))))))))))))))) && (((x_30 + (-1.0 * _x_x_7)) == -9.0) || (((x_29 + (-1.0 * _x_x_7)) == -13.0) || (((x_28 + (-1.0 * _x_x_7)) == -6.0) || (((x_24 + (-1.0 * _x_x_7)) == -15.0) || (((x_23 + (-1.0 * _x_x_7)) == -4.0) || (((x_22 + (-1.0 * _x_x_7)) == -20.0) || (((x_20 + (-1.0 * _x_x_7)) == -11.0) || (((x_17 + (-1.0 * _x_x_7)) == -13.0) || (((x_15 + (-1.0 * _x_x_7)) == -7.0) || (((x_13 + (-1.0 * _x_x_7)) == -7.0) || (((x_11 + (-1.0 * _x_x_7)) == -9.0) || (((x_10 + (-1.0 * _x_x_7)) == -7.0) || (((x_9 + (-1.0 * _x_x_7)) == -17.0) || (((x_4 + (-1.0 * _x_x_7)) == -4.0) || (((x_1 + (-1.0 * _x_x_7)) == -19.0) || ((x_2 + (-1.0 * _x_x_7)) == -4.0)))))))))))))))))) && ((((x_29 + (-1.0 * _x_x_8)) <= -8.0) && (((x_25 + (-1.0 * _x_x_8)) <= -10.0) && (((x_24 + (-1.0 * _x_x_8)) <= -16.0) && (((x_23 + (-1.0 * _x_x_8)) <= -7.0) && (((x_21 + (-1.0 * _x_x_8)) <= -19.0) && (((x_19 + (-1.0 * _x_x_8)) <= -14.0) && (((x_18 + (-1.0 * _x_x_8)) <= -12.0) && (((x_17 + (-1.0 * _x_x_8)) <= -19.0) && (((x_15 + (-1.0 * _x_x_8)) <= -14.0) && (((x_12 + (-1.0 * _x_x_8)) <= -12.0) && (((x_8 + (-1.0 * _x_x_8)) <= -4.0) && (((x_5 + (-1.0 * _x_x_8)) <= -4.0) && (((x_3 + (-1.0 * _x_x_8)) <= -10.0) && (((x_2 + (-1.0 * _x_x_8)) <= -14.0) && (((x_0 + (-1.0 * _x_x_8)) <= -2.0) && ((x_1 + (-1.0 * _x_x_8)) <= -19.0)))))))))))))))) && (((x_29 + (-1.0 * _x_x_8)) == -8.0) || (((x_25 + (-1.0 * _x_x_8)) == -10.0) || (((x_24 + (-1.0 * _x_x_8)) == -16.0) || (((x_23 + (-1.0 * _x_x_8)) == -7.0) || (((x_21 + (-1.0 * _x_x_8)) == -19.0) || (((x_19 + (-1.0 * _x_x_8)) == -14.0) || (((x_18 + (-1.0 * _x_x_8)) == -12.0) || (((x_17 + (-1.0 * _x_x_8)) == -19.0) || (((x_15 + (-1.0 * _x_x_8)) == -14.0) || (((x_12 + (-1.0 * _x_x_8)) == -12.0) || (((x_8 + (-1.0 * _x_x_8)) == -4.0) || (((x_5 + (-1.0 * _x_x_8)) == -4.0) || (((x_3 + (-1.0 * _x_x_8)) == -10.0) || (((x_2 + (-1.0 * _x_x_8)) == -14.0) || (((x_0 + (-1.0 * _x_x_8)) == -2.0) || ((x_1 + (-1.0 * _x_x_8)) == -19.0)))))))))))))))))) && ((((x_29 + (-1.0 * _x_x_9)) <= -11.0) && (((x_28 + (-1.0 * _x_x_9)) <= -14.0) && (((x_24 + (-1.0 * _x_x_9)) <= -6.0) && (((x_23 + (-1.0 * _x_x_9)) <= -11.0) && (((x_20 + (-1.0 * _x_x_9)) <= -3.0) && (((x_17 + (-1.0 * _x_x_9)) <= -1.0) && (((x_16 + (-1.0 * _x_x_9)) <= -19.0) && (((x_14 + (-1.0 * _x_x_9)) <= -4.0) && (((x_13 + (-1.0 * _x_x_9)) <= -4.0) && (((x_12 + (-1.0 * _x_x_9)) <= -3.0) && (((x_9 + (-1.0 * _x_x_9)) <= -14.0) && (((x_7 + (-1.0 * _x_x_9)) <= -5.0) && (((x_4 + (-1.0 * _x_x_9)) <= -18.0) && (((x_3 + (-1.0 * _x_x_9)) <= -16.0) && (((x_0 + (-1.0 * _x_x_9)) <= -6.0) && ((x_1 + (-1.0 * _x_x_9)) <= -19.0)))))))))))))))) && (((x_29 + (-1.0 * _x_x_9)) == -11.0) || (((x_28 + (-1.0 * _x_x_9)) == -14.0) || (((x_24 + (-1.0 * _x_x_9)) == -6.0) || (((x_23 + (-1.0 * _x_x_9)) == -11.0) || (((x_20 + (-1.0 * _x_x_9)) == -3.0) || (((x_17 + (-1.0 * _x_x_9)) == -1.0) || (((x_16 + (-1.0 * _x_x_9)) == -19.0) || (((x_14 + (-1.0 * _x_x_9)) == -4.0) || (((x_13 + (-1.0 * _x_x_9)) == -4.0) || (((x_12 + (-1.0 * _x_x_9)) == -3.0) || (((x_9 + (-1.0 * _x_x_9)) == -14.0) || (((x_7 + (-1.0 * _x_x_9)) == -5.0) || (((x_4 + (-1.0 * _x_x_9)) == -18.0) || (((x_3 + (-1.0 * _x_x_9)) == -16.0) || (((x_0 + (-1.0 * _x_x_9)) == -6.0) || ((x_1 + (-1.0 * _x_x_9)) == -19.0)))))))))))))))))) && ((((x_31 + (-1.0 * _x_x_10)) <= -15.0) && (((x_30 + (-1.0 * _x_x_10)) <= -9.0) && (((x_26 + (-1.0 * _x_x_10)) <= -4.0) && (((x_25 + (-1.0 * _x_x_10)) <= -8.0) && (((x_24 + (-1.0 * _x_x_10)) <= -6.0) && (((x_22 + (-1.0 * _x_x_10)) <= -1.0) && (((x_21 + (-1.0 * _x_x_10)) <= -10.0) && (((x_20 + (-1.0 * _x_x_10)) <= -14.0) && (((x_18 + (-1.0 * _x_x_10)) <= -5.0) && (((x_17 + (-1.0 * _x_x_10)) <= -18.0) && (((x_16 + (-1.0 * _x_x_10)) <= -4.0) && (((x_14 + (-1.0 * _x_x_10)) <= -16.0) && (((x_10 + (-1.0 * _x_x_10)) <= -18.0) && (((x_9 + (-1.0 * _x_x_10)) <= -3.0) && (((x_0 + (-1.0 * _x_x_10)) <= -8.0) && ((x_1 + (-1.0 * _x_x_10)) <= -2.0)))))))))))))))) && (((x_31 + (-1.0 * _x_x_10)) == -15.0) || (((x_30 + (-1.0 * _x_x_10)) == -9.0) || (((x_26 + (-1.0 * _x_x_10)) == -4.0) || (((x_25 + (-1.0 * _x_x_10)) == -8.0) || (((x_24 + (-1.0 * _x_x_10)) == -6.0) || (((x_22 + (-1.0 * _x_x_10)) == -1.0) || (((x_21 + (-1.0 * _x_x_10)) == -10.0) || (((x_20 + (-1.0 * _x_x_10)) == -14.0) || (((x_18 + (-1.0 * _x_x_10)) == -5.0) || (((x_17 + (-1.0 * _x_x_10)) == -18.0) || (((x_16 + (-1.0 * _x_x_10)) == -4.0) || (((x_14 + (-1.0 * _x_x_10)) == -16.0) || (((x_10 + (-1.0 * _x_x_10)) == -18.0) || (((x_9 + (-1.0 * _x_x_10)) == -3.0) || (((x_0 + (-1.0 * _x_x_10)) == -8.0) || ((x_1 + (-1.0 * _x_x_10)) == -2.0)))))))))))))))))) && ((((x_31 + (-1.0 * _x_x_11)) <= -10.0) && (((x_30 + (-1.0 * _x_x_11)) <= -15.0) && (((x_29 + (-1.0 * _x_x_11)) <= -10.0) && (((x_28 + (-1.0 * _x_x_11)) <= -1.0) && (((x_27 + (-1.0 * _x_x_11)) <= -6.0) && (((x_22 + (-1.0 * _x_x_11)) <= -13.0) && (((x_19 + (-1.0 * _x_x_11)) <= -6.0) && (((x_17 + (-1.0 * _x_x_11)) <= -14.0) && (((x_16 + (-1.0 * _x_x_11)) <= -6.0) && (((x_12 + (-1.0 * _x_x_11)) <= -12.0) && (((x_9 + (-1.0 * _x_x_11)) <= -17.0) && (((x_7 + (-1.0 * _x_x_11)) <= -4.0) && (((x_6 + (-1.0 * _x_x_11)) <= -2.0) && (((x_4 + (-1.0 * _x_x_11)) <= -12.0) && (((x_1 + (-1.0 * _x_x_11)) <= -20.0) && ((x_2 + (-1.0 * _x_x_11)) <= -12.0)))))))))))))))) && (((x_31 + (-1.0 * _x_x_11)) == -10.0) || (((x_30 + (-1.0 * _x_x_11)) == -15.0) || (((x_29 + (-1.0 * _x_x_11)) == -10.0) || (((x_28 + (-1.0 * _x_x_11)) == -1.0) || (((x_27 + (-1.0 * _x_x_11)) == -6.0) || (((x_22 + (-1.0 * _x_x_11)) == -13.0) || (((x_19 + (-1.0 * _x_x_11)) == -6.0) || (((x_17 + (-1.0 * _x_x_11)) == -14.0) || (((x_16 + (-1.0 * _x_x_11)) == -6.0) || (((x_12 + (-1.0 * _x_x_11)) == -12.0) || (((x_9 + (-1.0 * _x_x_11)) == -17.0) || (((x_7 + (-1.0 * _x_x_11)) == -4.0) || (((x_6 + (-1.0 * _x_x_11)) == -2.0) || (((x_4 + (-1.0 * _x_x_11)) == -12.0) || (((x_1 + (-1.0 * _x_x_11)) == -20.0) || ((x_2 + (-1.0 * _x_x_11)) == -12.0)))))))))))))))))) && ((((x_31 + (-1.0 * _x_x_12)) <= -14.0) && (((x_29 + (-1.0 * _x_x_12)) <= -9.0) && (((x_27 + (-1.0 * _x_x_12)) <= -16.0) && (((x_25 + (-1.0 * _x_x_12)) <= -4.0) && (((x_22 + (-1.0 * _x_x_12)) <= -6.0) && (((x_21 + (-1.0 * _x_x_12)) <= -3.0) && (((x_20 + (-1.0 * _x_x_12)) <= -1.0) && (((x_19 + (-1.0 * _x_x_12)) <= -20.0) && (((x_18 + (-1.0 * _x_x_12)) <= -17.0) && (((x_10 + (-1.0 * _x_x_12)) <= -4.0) && (((x_9 + (-1.0 * _x_x_12)) <= -14.0) && (((x_8 + (-1.0 * _x_x_12)) <= -20.0) && (((x_7 + (-1.0 * _x_x_12)) <= -13.0) && (((x_4 + (-1.0 * _x_x_12)) <= -13.0) && (((x_0 + (-1.0 * _x_x_12)) <= -12.0) && ((x_2 + (-1.0 * _x_x_12)) <= -14.0)))))))))))))))) && (((x_31 + (-1.0 * _x_x_12)) == -14.0) || (((x_29 + (-1.0 * _x_x_12)) == -9.0) || (((x_27 + (-1.0 * _x_x_12)) == -16.0) || (((x_25 + (-1.0 * _x_x_12)) == -4.0) || (((x_22 + (-1.0 * _x_x_12)) == -6.0) || (((x_21 + (-1.0 * _x_x_12)) == -3.0) || (((x_20 + (-1.0 * _x_x_12)) == -1.0) || (((x_19 + (-1.0 * _x_x_12)) == -20.0) || (((x_18 + (-1.0 * _x_x_12)) == -17.0) || (((x_10 + (-1.0 * _x_x_12)) == -4.0) || (((x_9 + (-1.0 * _x_x_12)) == -14.0) || (((x_8 + (-1.0 * _x_x_12)) == -20.0) || (((x_7 + (-1.0 * _x_x_12)) == -13.0) || (((x_4 + (-1.0 * _x_x_12)) == -13.0) || (((x_0 + (-1.0 * _x_x_12)) == -12.0) || ((x_2 + (-1.0 * _x_x_12)) == -14.0)))))))))))))))))) && ((((x_29 + (-1.0 * _x_x_13)) <= -11.0) && (((x_27 + (-1.0 * _x_x_13)) <= -12.0) && (((x_25 + (-1.0 * _x_x_13)) <= -19.0) && (((x_24 + (-1.0 * _x_x_13)) <= -2.0) && (((x_23 + (-1.0 * _x_x_13)) <= -8.0) && (((x_22 + (-1.0 * _x_x_13)) <= -20.0) && (((x_20 + (-1.0 * _x_x_13)) <= -7.0) && (((x_17 + (-1.0 * _x_x_13)) <= -2.0) && (((x_16 + (-1.0 * _x_x_13)) <= -3.0) && (((x_14 + (-1.0 * _x_x_13)) <= -15.0) && (((x_13 + (-1.0 * _x_x_13)) <= -6.0) && (((x_11 + (-1.0 * _x_x_13)) <= -14.0) && (((x_9 + (-1.0 * _x_x_13)) <= -11.0) && (((x_5 + (-1.0 * _x_x_13)) <= -12.0) && (((x_2 + (-1.0 * _x_x_13)) <= -2.0) && ((x_4 + (-1.0 * _x_x_13)) <= -6.0)))))))))))))))) && (((x_29 + (-1.0 * _x_x_13)) == -11.0) || (((x_27 + (-1.0 * _x_x_13)) == -12.0) || (((x_25 + (-1.0 * _x_x_13)) == -19.0) || (((x_24 + (-1.0 * _x_x_13)) == -2.0) || (((x_23 + (-1.0 * _x_x_13)) == -8.0) || (((x_22 + (-1.0 * _x_x_13)) == -20.0) || (((x_20 + (-1.0 * _x_x_13)) == -7.0) || (((x_17 + (-1.0 * _x_x_13)) == -2.0) || (((x_16 + (-1.0 * _x_x_13)) == -3.0) || (((x_14 + (-1.0 * _x_x_13)) == -15.0) || (((x_13 + (-1.0 * _x_x_13)) == -6.0) || (((x_11 + (-1.0 * _x_x_13)) == -14.0) || (((x_9 + (-1.0 * _x_x_13)) == -11.0) || (((x_5 + (-1.0 * _x_x_13)) == -12.0) || (((x_2 + (-1.0 * _x_x_13)) == -2.0) || ((x_4 + (-1.0 * _x_x_13)) == -6.0)))))))))))))))))) && ((((x_25 + (-1.0 * _x_x_14)) <= -19.0) && (((x_24 + (-1.0 * _x_x_14)) <= -8.0) && (((x_23 + (-1.0 * _x_x_14)) <= -12.0) && (((x_22 + (-1.0 * _x_x_14)) <= -17.0) && (((x_21 + (-1.0 * _x_x_14)) <= -18.0) && (((x_18 + (-1.0 * _x_x_14)) <= -13.0) && (((x_17 + (-1.0 * _x_x_14)) <= -8.0) && (((x_16 + (-1.0 * _x_x_14)) <= -7.0) && (((x_12 + (-1.0 * _x_x_14)) <= -2.0) && (((x_11 + (-1.0 * _x_x_14)) <= -18.0) && (((x_10 + (-1.0 * _x_x_14)) <= -8.0) && (((x_9 + (-1.0 * _x_x_14)) <= -6.0) && (((x_7 + (-1.0 * _x_x_14)) <= -18.0) && (((x_6 + (-1.0 * _x_x_14)) <= -6.0) && (((x_1 + (-1.0 * _x_x_14)) <= -11.0) && ((x_5 + (-1.0 * _x_x_14)) <= -18.0)))))))))))))))) && (((x_25 + (-1.0 * _x_x_14)) == -19.0) || (((x_24 + (-1.0 * _x_x_14)) == -8.0) || (((x_23 + (-1.0 * _x_x_14)) == -12.0) || (((x_22 + (-1.0 * _x_x_14)) == -17.0) || (((x_21 + (-1.0 * _x_x_14)) == -18.0) || (((x_18 + (-1.0 * _x_x_14)) == -13.0) || (((x_17 + (-1.0 * _x_x_14)) == -8.0) || (((x_16 + (-1.0 * _x_x_14)) == -7.0) || (((x_12 + (-1.0 * _x_x_14)) == -2.0) || (((x_11 + (-1.0 * _x_x_14)) == -18.0) || (((x_10 + (-1.0 * _x_x_14)) == -8.0) || (((x_9 + (-1.0 * _x_x_14)) == -6.0) || (((x_7 + (-1.0 * _x_x_14)) == -18.0) || (((x_6 + (-1.0 * _x_x_14)) == -6.0) || (((x_1 + (-1.0 * _x_x_14)) == -11.0) || ((x_5 + (-1.0 * _x_x_14)) == -18.0)))))))))))))))))) && ((((x_31 + (-1.0 * _x_x_15)) <= -10.0) && (((x_25 + (-1.0 * _x_x_15)) <= -14.0) && (((x_24 + (-1.0 * _x_x_15)) <= -20.0) && (((x_22 + (-1.0 * _x_x_15)) <= -13.0) && (((x_19 + (-1.0 * _x_x_15)) <= -18.0) && (((x_17 + (-1.0 * _x_x_15)) <= -19.0) && (((x_14 + (-1.0 * _x_x_15)) <= -20.0) && (((x_13 + (-1.0 * _x_x_15)) <= -13.0) && (((x_11 + (-1.0 * _x_x_15)) <= -13.0) && (((x_10 + (-1.0 * _x_x_15)) <= -5.0) && (((x_9 + (-1.0 * _x_x_15)) <= -1.0) && (((x_8 + (-1.0 * _x_x_15)) <= -18.0) && (((x_7 + (-1.0 * _x_x_15)) <= -18.0) && (((x_6 + (-1.0 * _x_x_15)) <= -20.0) && (((x_0 + (-1.0 * _x_x_15)) <= -2.0) && ((x_2 + (-1.0 * _x_x_15)) <= -1.0)))))))))))))))) && (((x_31 + (-1.0 * _x_x_15)) == -10.0) || (((x_25 + (-1.0 * _x_x_15)) == -14.0) || (((x_24 + (-1.0 * _x_x_15)) == -20.0) || (((x_22 + (-1.0 * _x_x_15)) == -13.0) || (((x_19 + (-1.0 * _x_x_15)) == -18.0) || (((x_17 + (-1.0 * _x_x_15)) == -19.0) || (((x_14 + (-1.0 * _x_x_15)) == -20.0) || (((x_13 + (-1.0 * _x_x_15)) == -13.0) || (((x_11 + (-1.0 * _x_x_15)) == -13.0) || (((x_10 + (-1.0 * _x_x_15)) == -5.0) || (((x_9 + (-1.0 * _x_x_15)) == -1.0) || (((x_8 + (-1.0 * _x_x_15)) == -18.0) || (((x_7 + (-1.0 * _x_x_15)) == -18.0) || (((x_6 + (-1.0 * _x_x_15)) == -20.0) || (((x_0 + (-1.0 * _x_x_15)) == -2.0) || ((x_2 + (-1.0 * _x_x_15)) == -1.0)))))))))))))))))) && ((((x_31 + (-1.0 * _x_x_16)) <= -14.0) && (((x_29 + (-1.0 * _x_x_16)) <= -3.0) && (((x_28 + (-1.0 * _x_x_16)) <= -2.0) && (((x_25 + (-1.0 * _x_x_16)) <= -6.0) && (((x_22 + (-1.0 * _x_x_16)) <= -10.0) && (((x_21 + (-1.0 * _x_x_16)) <= -14.0) && (((x_19 + (-1.0 * _x_x_16)) <= -6.0) && (((x_18 + (-1.0 * _x_x_16)) <= -1.0) && (((x_15 + (-1.0 * _x_x_16)) <= -10.0) && (((x_13 + (-1.0 * _x_x_16)) <= -13.0) && (((x_12 + (-1.0 * _x_x_16)) <= -5.0) && (((x_11 + (-1.0 * _x_x_16)) <= -8.0) && (((x_10 + (-1.0 * _x_x_16)) <= -5.0) && (((x_3 + (-1.0 * _x_x_16)) <= -11.0) && (((x_0 + (-1.0 * _x_x_16)) <= -4.0) && ((x_2 + (-1.0 * _x_x_16)) <= -5.0)))))))))))))))) && (((x_31 + (-1.0 * _x_x_16)) == -14.0) || (((x_29 + (-1.0 * _x_x_16)) == -3.0) || (((x_28 + (-1.0 * _x_x_16)) == -2.0) || (((x_25 + (-1.0 * _x_x_16)) == -6.0) || (((x_22 + (-1.0 * _x_x_16)) == -10.0) || (((x_21 + (-1.0 * _x_x_16)) == -14.0) || (((x_19 + (-1.0 * _x_x_16)) == -6.0) || (((x_18 + (-1.0 * _x_x_16)) == -1.0) || (((x_15 + (-1.0 * _x_x_16)) == -10.0) || (((x_13 + (-1.0 * _x_x_16)) == -13.0) || (((x_12 + (-1.0 * _x_x_16)) == -5.0) || (((x_11 + (-1.0 * _x_x_16)) == -8.0) || (((x_10 + (-1.0 * _x_x_16)) == -5.0) || (((x_3 + (-1.0 * _x_x_16)) == -11.0) || (((x_0 + (-1.0 * _x_x_16)) == -4.0) || ((x_2 + (-1.0 * _x_x_16)) == -5.0)))))))))))))))))) && ((((x_29 + (-1.0 * _x_x_17)) <= -20.0) && (((x_27 + (-1.0 * _x_x_17)) <= -10.0) && (((x_25 + (-1.0 * _x_x_17)) <= -2.0) && (((x_23 + (-1.0 * _x_x_17)) <= -11.0) && (((x_22 + (-1.0 * _x_x_17)) <= -12.0) && (((x_21 + (-1.0 * _x_x_17)) <= -5.0) && (((x_19 + (-1.0 * _x_x_17)) <= -18.0) && (((x_17 + (-1.0 * _x_x_17)) <= -4.0) && (((x_10 + (-1.0 * _x_x_17)) <= -14.0) && (((x_9 + (-1.0 * _x_x_17)) <= -1.0) && (((x_8 + (-1.0 * _x_x_17)) <= -5.0) && (((x_7 + (-1.0 * _x_x_17)) <= -14.0) && (((x_6 + (-1.0 * _x_x_17)) <= -20.0) && (((x_5 + (-1.0 * _x_x_17)) <= -14.0) && (((x_0 + (-1.0 * _x_x_17)) <= -15.0) && ((x_4 + (-1.0 * _x_x_17)) <= -13.0)))))))))))))))) && (((x_29 + (-1.0 * _x_x_17)) == -20.0) || (((x_27 + (-1.0 * _x_x_17)) == -10.0) || (((x_25 + (-1.0 * _x_x_17)) == -2.0) || (((x_23 + (-1.0 * _x_x_17)) == -11.0) || (((x_22 + (-1.0 * _x_x_17)) == -12.0) || (((x_21 + (-1.0 * _x_x_17)) == -5.0) || (((x_19 + (-1.0 * _x_x_17)) == -18.0) || (((x_17 + (-1.0 * _x_x_17)) == -4.0) || (((x_10 + (-1.0 * _x_x_17)) == -14.0) || (((x_9 + (-1.0 * _x_x_17)) == -1.0) || (((x_8 + (-1.0 * _x_x_17)) == -5.0) || (((x_7 + (-1.0 * _x_x_17)) == -14.0) || (((x_6 + (-1.0 * _x_x_17)) == -20.0) || (((x_5 + (-1.0 * _x_x_17)) == -14.0) || (((x_0 + (-1.0 * _x_x_17)) == -15.0) || ((x_4 + (-1.0 * _x_x_17)) == -13.0)))))))))))))))))) && ((((x_28 + (-1.0 * _x_x_18)) <= -5.0) && (((x_27 + (-1.0 * _x_x_18)) <= -14.0) && (((x_25 + (-1.0 * _x_x_18)) <= -2.0) && (((x_23 + (-1.0 * _x_x_18)) <= -10.0) && (((x_22 + (-1.0 * _x_x_18)) <= -9.0) && (((x_20 + (-1.0 * _x_x_18)) <= -19.0) && (((x_19 + (-1.0 * _x_x_18)) <= -14.0) && (((x_15 + (-1.0 * _x_x_18)) <= -2.0) && (((x_12 + (-1.0 * _x_x_18)) <= -3.0) && (((x_11 + (-1.0 * _x_x_18)) <= -10.0) && (((x_10 + (-1.0 * _x_x_18)) <= -2.0) && (((x_8 + (-1.0 * _x_x_18)) <= -8.0) && (((x_3 + (-1.0 * _x_x_18)) <= -7.0) && (((x_2 + (-1.0 * _x_x_18)) <= -3.0) && (((x_0 + (-1.0 * _x_x_18)) <= -14.0) && ((x_1 + (-1.0 * _x_x_18)) <= -7.0)))))))))))))))) && (((x_28 + (-1.0 * _x_x_18)) == -5.0) || (((x_27 + (-1.0 * _x_x_18)) == -14.0) || (((x_25 + (-1.0 * _x_x_18)) == -2.0) || (((x_23 + (-1.0 * _x_x_18)) == -10.0) || (((x_22 + (-1.0 * _x_x_18)) == -9.0) || (((x_20 + (-1.0 * _x_x_18)) == -19.0) || (((x_19 + (-1.0 * _x_x_18)) == -14.0) || (((x_15 + (-1.0 * _x_x_18)) == -2.0) || (((x_12 + (-1.0 * _x_x_18)) == -3.0) || (((x_11 + (-1.0 * _x_x_18)) == -10.0) || (((x_10 + (-1.0 * _x_x_18)) == -2.0) || (((x_8 + (-1.0 * _x_x_18)) == -8.0) || (((x_3 + (-1.0 * _x_x_18)) == -7.0) || (((x_2 + (-1.0 * _x_x_18)) == -3.0) || (((x_0 + (-1.0 * _x_x_18)) == -14.0) || ((x_1 + (-1.0 * _x_x_18)) == -7.0)))))))))))))))))) && ((((x_29 + (-1.0 * _x_x_19)) <= -18.0) && (((x_28 + (-1.0 * _x_x_19)) <= -15.0) && (((x_25 + (-1.0 * _x_x_19)) <= -2.0) && (((x_24 + (-1.0 * _x_x_19)) <= -9.0) && (((x_23 + (-1.0 * _x_x_19)) <= -5.0) && (((x_22 + (-1.0 * _x_x_19)) <= -10.0) && (((x_21 + (-1.0 * _x_x_19)) <= -10.0) && (((x_19 + (-1.0 * _x_x_19)) <= -7.0) && (((x_14 + (-1.0 * _x_x_19)) <= -1.0) && (((x_13 + (-1.0 * _x_x_19)) <= -8.0) && (((x_9 + (-1.0 * _x_x_19)) <= -9.0) && (((x_6 + (-1.0 * _x_x_19)) <= -8.0) && (((x_4 + (-1.0 * _x_x_19)) <= -3.0) && (((x_3 + (-1.0 * _x_x_19)) <= -4.0) && (((x_1 + (-1.0 * _x_x_19)) <= -13.0) && ((x_2 + (-1.0 * _x_x_19)) <= -17.0)))))))))))))))) && (((x_29 + (-1.0 * _x_x_19)) == -18.0) || (((x_28 + (-1.0 * _x_x_19)) == -15.0) || (((x_25 + (-1.0 * _x_x_19)) == -2.0) || (((x_24 + (-1.0 * _x_x_19)) == -9.0) || (((x_23 + (-1.0 * _x_x_19)) == -5.0) || (((x_22 + (-1.0 * _x_x_19)) == -10.0) || (((x_21 + (-1.0 * _x_x_19)) == -10.0) || (((x_19 + (-1.0 * _x_x_19)) == -7.0) || (((x_14 + (-1.0 * _x_x_19)) == -1.0) || (((x_13 + (-1.0 * _x_x_19)) == -8.0) || (((x_9 + (-1.0 * _x_x_19)) == -9.0) || (((x_6 + (-1.0 * _x_x_19)) == -8.0) || (((x_4 + (-1.0 * _x_x_19)) == -3.0) || (((x_3 + (-1.0 * _x_x_19)) == -4.0) || (((x_1 + (-1.0 * _x_x_19)) == -13.0) || ((x_2 + (-1.0 * _x_x_19)) == -17.0)))))))))))))))))) && ((((x_31 + (-1.0 * _x_x_20)) <= -4.0) && (((x_30 + (-1.0 * _x_x_20)) <= -1.0) && (((x_27 + (-1.0 * _x_x_20)) <= -17.0) && (((x_26 + (-1.0 * _x_x_20)) <= -8.0) && (((x_23 + (-1.0 * _x_x_20)) <= -8.0) && (((x_22 + (-1.0 * _x_x_20)) <= -12.0) && (((x_19 + (-1.0 * _x_x_20)) <= -6.0) && (((x_14 + (-1.0 * _x_x_20)) <= -20.0) && (((x_13 + (-1.0 * _x_x_20)) <= -4.0) && (((x_12 + (-1.0 * _x_x_20)) <= -20.0) && (((x_11 + (-1.0 * _x_x_20)) <= -13.0) && (((x_8 + (-1.0 * _x_x_20)) <= -8.0) && (((x_7 + (-1.0 * _x_x_20)) <= -9.0) && (((x_6 + (-1.0 * _x_x_20)) <= -18.0) && (((x_2 + (-1.0 * _x_x_20)) <= -11.0) && ((x_5 + (-1.0 * _x_x_20)) <= -3.0)))))))))))))))) && (((x_31 + (-1.0 * _x_x_20)) == -4.0) || (((x_30 + (-1.0 * _x_x_20)) == -1.0) || (((x_27 + (-1.0 * _x_x_20)) == -17.0) || (((x_26 + (-1.0 * _x_x_20)) == -8.0) || (((x_23 + (-1.0 * _x_x_20)) == -8.0) || (((x_22 + (-1.0 * _x_x_20)) == -12.0) || (((x_19 + (-1.0 * _x_x_20)) == -6.0) || (((x_14 + (-1.0 * _x_x_20)) == -20.0) || (((x_13 + (-1.0 * _x_x_20)) == -4.0) || (((x_12 + (-1.0 * _x_x_20)) == -20.0) || (((x_11 + (-1.0 * _x_x_20)) == -13.0) || (((x_8 + (-1.0 * _x_x_20)) == -8.0) || (((x_7 + (-1.0 * _x_x_20)) == -9.0) || (((x_6 + (-1.0 * _x_x_20)) == -18.0) || (((x_2 + (-1.0 * _x_x_20)) == -11.0) || ((x_5 + (-1.0 * _x_x_20)) == -3.0)))))))))))))))))) && ((((x_31 + (-1.0 * _x_x_21)) <= -7.0) && (((x_30 + (-1.0 * _x_x_21)) <= -14.0) && (((x_27 + (-1.0 * _x_x_21)) <= -2.0) && (((x_26 + (-1.0 * _x_x_21)) <= -4.0) && (((x_25 + (-1.0 * _x_x_21)) <= -7.0) && (((x_24 + (-1.0 * _x_x_21)) <= -3.0) && (((x_22 + (-1.0 * _x_x_21)) <= -8.0) && (((x_21 + (-1.0 * _x_x_21)) <= -17.0) && (((x_19 + (-1.0 * _x_x_21)) <= -1.0) && (((x_18 + (-1.0 * _x_x_21)) <= -13.0) && (((x_17 + (-1.0 * _x_x_21)) <= -19.0) && (((x_12 + (-1.0 * _x_x_21)) <= -5.0) && (((x_9 + (-1.0 * _x_x_21)) <= -6.0) && (((x_4 + (-1.0 * _x_x_21)) <= -5.0) && (((x_0 + (-1.0 * _x_x_21)) <= -17.0) && ((x_2 + (-1.0 * _x_x_21)) <= -14.0)))))))))))))))) && (((x_31 + (-1.0 * _x_x_21)) == -7.0) || (((x_30 + (-1.0 * _x_x_21)) == -14.0) || (((x_27 + (-1.0 * _x_x_21)) == -2.0) || (((x_26 + (-1.0 * _x_x_21)) == -4.0) || (((x_25 + (-1.0 * _x_x_21)) == -7.0) || (((x_24 + (-1.0 * _x_x_21)) == -3.0) || (((x_22 + (-1.0 * _x_x_21)) == -8.0) || (((x_21 + (-1.0 * _x_x_21)) == -17.0) || (((x_19 + (-1.0 * _x_x_21)) == -1.0) || (((x_18 + (-1.0 * _x_x_21)) == -13.0) || (((x_17 + (-1.0 * _x_x_21)) == -19.0) || (((x_12 + (-1.0 * _x_x_21)) == -5.0) || (((x_9 + (-1.0 * _x_x_21)) == -6.0) || (((x_4 + (-1.0 * _x_x_21)) == -5.0) || (((x_0 + (-1.0 * _x_x_21)) == -17.0) || ((x_2 + (-1.0 * _x_x_21)) == -14.0)))))))))))))))))) && ((((x_29 + (-1.0 * _x_x_22)) <= -5.0) && (((x_28 + (-1.0 * _x_x_22)) <= -16.0) && (((x_27 + (-1.0 * _x_x_22)) <= -1.0) && (((x_24 + (-1.0 * _x_x_22)) <= -11.0) && (((x_23 + (-1.0 * _x_x_22)) <= -10.0) && (((x_22 + (-1.0 * _x_x_22)) <= -11.0) && (((x_19 + (-1.0 * _x_x_22)) <= -13.0) && (((x_18 + (-1.0 * _x_x_22)) <= -16.0) && (((x_17 + (-1.0 * _x_x_22)) <= -6.0) && (((x_15 + (-1.0 * _x_x_22)) <= -20.0) && (((x_14 + (-1.0 * _x_x_22)) <= -5.0) && (((x_13 + (-1.0 * _x_x_22)) <= -1.0) && (((x_11 + (-1.0 * _x_x_22)) <= -13.0) && (((x_9 + (-1.0 * _x_x_22)) <= -8.0) && (((x_3 + (-1.0 * _x_x_22)) <= -16.0) && ((x_8 + (-1.0 * _x_x_22)) <= -3.0)))))))))))))))) && (((x_29 + (-1.0 * _x_x_22)) == -5.0) || (((x_28 + (-1.0 * _x_x_22)) == -16.0) || (((x_27 + (-1.0 * _x_x_22)) == -1.0) || (((x_24 + (-1.0 * _x_x_22)) == -11.0) || (((x_23 + (-1.0 * _x_x_22)) == -10.0) || (((x_22 + (-1.0 * _x_x_22)) == -11.0) || (((x_19 + (-1.0 * _x_x_22)) == -13.0) || (((x_18 + (-1.0 * _x_x_22)) == -16.0) || (((x_17 + (-1.0 * _x_x_22)) == -6.0) || (((x_15 + (-1.0 * _x_x_22)) == -20.0) || (((x_14 + (-1.0 * _x_x_22)) == -5.0) || (((x_13 + (-1.0 * _x_x_22)) == -1.0) || (((x_11 + (-1.0 * _x_x_22)) == -13.0) || (((x_9 + (-1.0 * _x_x_22)) == -8.0) || (((x_3 + (-1.0 * _x_x_22)) == -16.0) || ((x_8 + (-1.0 * _x_x_22)) == -3.0)))))))))))))))))) && ((((x_29 + (-1.0 * _x_x_23)) <= -4.0) && (((x_27 + (-1.0 * _x_x_23)) <= -16.0) && (((x_25 + (-1.0 * _x_x_23)) <= -6.0) && (((x_22 + (-1.0 * _x_x_23)) <= -7.0) && (((x_21 + (-1.0 * _x_x_23)) <= -16.0) && (((x_16 + (-1.0 * _x_x_23)) <= -10.0) && (((x_15 + (-1.0 * _x_x_23)) <= -15.0) && (((x_13 + (-1.0 * _x_x_23)) <= -9.0) && (((x_12 + (-1.0 * _x_x_23)) <= -11.0) && (((x_11 + (-1.0 * _x_x_23)) <= -16.0) && (((x_10 + (-1.0 * _x_x_23)) <= -2.0) && (((x_9 + (-1.0 * _x_x_23)) <= -7.0) && (((x_4 + (-1.0 * _x_x_23)) <= -1.0) && (((x_3 + (-1.0 * _x_x_23)) <= -15.0) && (((x_0 + (-1.0 * _x_x_23)) <= -16.0) && ((x_1 + (-1.0 * _x_x_23)) <= -10.0)))))))))))))))) && (((x_29 + (-1.0 * _x_x_23)) == -4.0) || (((x_27 + (-1.0 * _x_x_23)) == -16.0) || (((x_25 + (-1.0 * _x_x_23)) == -6.0) || (((x_22 + (-1.0 * _x_x_23)) == -7.0) || (((x_21 + (-1.0 * _x_x_23)) == -16.0) || (((x_16 + (-1.0 * _x_x_23)) == -10.0) || (((x_15 + (-1.0 * _x_x_23)) == -15.0) || (((x_13 + (-1.0 * _x_x_23)) == -9.0) || (((x_12 + (-1.0 * _x_x_23)) == -11.0) || (((x_11 + (-1.0 * _x_x_23)) == -16.0) || (((x_10 + (-1.0 * _x_x_23)) == -2.0) || (((x_9 + (-1.0 * _x_x_23)) == -7.0) || (((x_4 + (-1.0 * _x_x_23)) == -1.0) || (((x_3 + (-1.0 * _x_x_23)) == -15.0) || (((x_0 + (-1.0 * _x_x_23)) == -16.0) || ((x_1 + (-1.0 * _x_x_23)) == -10.0)))))))))))))))))) && ((((x_31 + (-1.0 * _x_x_24)) <= -11.0) && (((x_30 + (-1.0 * _x_x_24)) <= -9.0) && (((x_28 + (-1.0 * _x_x_24)) <= -15.0) && (((x_27 + (-1.0 * _x_x_24)) <= -15.0) && (((x_23 + (-1.0 * _x_x_24)) <= -7.0) && (((x_18 + (-1.0 * _x_x_24)) <= -14.0) && (((x_15 + (-1.0 * _x_x_24)) <= -13.0) && (((x_14 + (-1.0 * _x_x_24)) <= -20.0) && (((x_13 + (-1.0 * _x_x_24)) <= -1.0) && (((x_12 + (-1.0 * _x_x_24)) <= -17.0) && (((x_11 + (-1.0 * _x_x_24)) <= -13.0) && (((x_9 + (-1.0 * _x_x_24)) <= -10.0) && (((x_7 + (-1.0 * _x_x_24)) <= -9.0) && (((x_5 + (-1.0 * _x_x_24)) <= -9.0) && (((x_1 + (-1.0 * _x_x_24)) <= -12.0) && ((x_2 + (-1.0 * _x_x_24)) <= -19.0)))))))))))))))) && (((x_31 + (-1.0 * _x_x_24)) == -11.0) || (((x_30 + (-1.0 * _x_x_24)) == -9.0) || (((x_28 + (-1.0 * _x_x_24)) == -15.0) || (((x_27 + (-1.0 * _x_x_24)) == -15.0) || (((x_23 + (-1.0 * _x_x_24)) == -7.0) || (((x_18 + (-1.0 * _x_x_24)) == -14.0) || (((x_15 + (-1.0 * _x_x_24)) == -13.0) || (((x_14 + (-1.0 * _x_x_24)) == -20.0) || (((x_13 + (-1.0 * _x_x_24)) == -1.0) || (((x_12 + (-1.0 * _x_x_24)) == -17.0) || (((x_11 + (-1.0 * _x_x_24)) == -13.0) || (((x_9 + (-1.0 * _x_x_24)) == -10.0) || (((x_7 + (-1.0 * _x_x_24)) == -9.0) || (((x_5 + (-1.0 * _x_x_24)) == -9.0) || (((x_1 + (-1.0 * _x_x_24)) == -12.0) || ((x_2 + (-1.0 * _x_x_24)) == -19.0)))))))))))))))))) && ((((x_31 + (-1.0 * _x_x_25)) <= -14.0) && (((x_30 + (-1.0 * _x_x_25)) <= -19.0) && (((x_27 + (-1.0 * _x_x_25)) <= -7.0) && (((x_26 + (-1.0 * _x_x_25)) <= -11.0) && (((x_23 + (-1.0 * _x_x_25)) <= -12.0) && (((x_22 + (-1.0 * _x_x_25)) <= -18.0) && (((x_19 + (-1.0 * _x_x_25)) <= -14.0) && (((x_16 + (-1.0 * _x_x_25)) <= -7.0) && (((x_15 + (-1.0 * _x_x_25)) <= -13.0) && (((x_14 + (-1.0 * _x_x_25)) <= -10.0) && (((x_11 + (-1.0 * _x_x_25)) <= -16.0) && (((x_10 + (-1.0 * _x_x_25)) <= -11.0) && (((x_9 + (-1.0 * _x_x_25)) <= -9.0) && (((x_7 + (-1.0 * _x_x_25)) <= -5.0) && (((x_0 + (-1.0 * _x_x_25)) <= -13.0) && ((x_4 + (-1.0 * _x_x_25)) <= -19.0)))))))))))))))) && (((x_31 + (-1.0 * _x_x_25)) == -14.0) || (((x_30 + (-1.0 * _x_x_25)) == -19.0) || (((x_27 + (-1.0 * _x_x_25)) == -7.0) || (((x_26 + (-1.0 * _x_x_25)) == -11.0) || (((x_23 + (-1.0 * _x_x_25)) == -12.0) || (((x_22 + (-1.0 * _x_x_25)) == -18.0) || (((x_19 + (-1.0 * _x_x_25)) == -14.0) || (((x_16 + (-1.0 * _x_x_25)) == -7.0) || (((x_15 + (-1.0 * _x_x_25)) == -13.0) || (((x_14 + (-1.0 * _x_x_25)) == -10.0) || (((x_11 + (-1.0 * _x_x_25)) == -16.0) || (((x_10 + (-1.0 * _x_x_25)) == -11.0) || (((x_9 + (-1.0 * _x_x_25)) == -9.0) || (((x_7 + (-1.0 * _x_x_25)) == -5.0) || (((x_0 + (-1.0 * _x_x_25)) == -13.0) || ((x_4 + (-1.0 * _x_x_25)) == -19.0)))))))))))))))))) && ((((x_30 + (-1.0 * _x_x_26)) <= -10.0) && (((x_29 + (-1.0 * _x_x_26)) <= -9.0) && (((x_27 + (-1.0 * _x_x_26)) <= -13.0) && (((x_26 + (-1.0 * _x_x_26)) <= -20.0) && (((x_25 + (-1.0 * _x_x_26)) <= -9.0) && (((x_24 + (-1.0 * _x_x_26)) <= -5.0) && (((x_23 + (-1.0 * _x_x_26)) <= -20.0) && (((x_22 + (-1.0 * _x_x_26)) <= -3.0) && (((x_20 + (-1.0 * _x_x_26)) <= -12.0) && (((x_18 + (-1.0 * _x_x_26)) <= -3.0) && (((x_13 + (-1.0 * _x_x_26)) <= -16.0) && (((x_12 + (-1.0 * _x_x_26)) <= -17.0) && (((x_10 + (-1.0 * _x_x_26)) <= -4.0) && (((x_8 + (-1.0 * _x_x_26)) <= -20.0) && (((x_0 + (-1.0 * _x_x_26)) <= -9.0) && ((x_3 + (-1.0 * _x_x_26)) <= -2.0)))))))))))))))) && (((x_30 + (-1.0 * _x_x_26)) == -10.0) || (((x_29 + (-1.0 * _x_x_26)) == -9.0) || (((x_27 + (-1.0 * _x_x_26)) == -13.0) || (((x_26 + (-1.0 * _x_x_26)) == -20.0) || (((x_25 + (-1.0 * _x_x_26)) == -9.0) || (((x_24 + (-1.0 * _x_x_26)) == -5.0) || (((x_23 + (-1.0 * _x_x_26)) == -20.0) || (((x_22 + (-1.0 * _x_x_26)) == -3.0) || (((x_20 + (-1.0 * _x_x_26)) == -12.0) || (((x_18 + (-1.0 * _x_x_26)) == -3.0) || (((x_13 + (-1.0 * _x_x_26)) == -16.0) || (((x_12 + (-1.0 * _x_x_26)) == -17.0) || (((x_10 + (-1.0 * _x_x_26)) == -4.0) || (((x_8 + (-1.0 * _x_x_26)) == -20.0) || (((x_0 + (-1.0 * _x_x_26)) == -9.0) || ((x_3 + (-1.0 * _x_x_26)) == -2.0)))))))))))))))))) && ((((x_31 + (-1.0 * _x_x_27)) <= -1.0) && (((x_30 + (-1.0 * _x_x_27)) <= -18.0) && (((x_29 + (-1.0 * _x_x_27)) <= -7.0) && (((x_27 + (-1.0 * _x_x_27)) <= -8.0) && (((x_20 + (-1.0 * _x_x_27)) <= -1.0) && (((x_19 + (-1.0 * _x_x_27)) <= -19.0) && (((x_18 + (-1.0 * _x_x_27)) <= -13.0) && (((x_17 + (-1.0 * _x_x_27)) <= -15.0) && (((x_15 + (-1.0 * _x_x_27)) <= -13.0) && (((x_14 + (-1.0 * _x_x_27)) <= -12.0) && (((x_12 + (-1.0 * _x_x_27)) <= -14.0) && (((x_11 + (-1.0 * _x_x_27)) <= -12.0) && (((x_10 + (-1.0 * _x_x_27)) <= -11.0) && (((x_5 + (-1.0 * _x_x_27)) <= -13.0) && (((x_1 + (-1.0 * _x_x_27)) <= -17.0) && ((x_2 + (-1.0 * _x_x_27)) <= -10.0)))))))))))))))) && (((x_31 + (-1.0 * _x_x_27)) == -1.0) || (((x_30 + (-1.0 * _x_x_27)) == -18.0) || (((x_29 + (-1.0 * _x_x_27)) == -7.0) || (((x_27 + (-1.0 * _x_x_27)) == -8.0) || (((x_20 + (-1.0 * _x_x_27)) == -1.0) || (((x_19 + (-1.0 * _x_x_27)) == -19.0) || (((x_18 + (-1.0 * _x_x_27)) == -13.0) || (((x_17 + (-1.0 * _x_x_27)) == -15.0) || (((x_15 + (-1.0 * _x_x_27)) == -13.0) || (((x_14 + (-1.0 * _x_x_27)) == -12.0) || (((x_12 + (-1.0 * _x_x_27)) == -14.0) || (((x_11 + (-1.0 * _x_x_27)) == -12.0) || (((x_10 + (-1.0 * _x_x_27)) == -11.0) || (((x_5 + (-1.0 * _x_x_27)) == -13.0) || (((x_1 + (-1.0 * _x_x_27)) == -17.0) || ((x_2 + (-1.0 * _x_x_27)) == -10.0)))))))))))))))))) && ((((x_29 + (-1.0 * _x_x_28)) <= -17.0) && (((x_28 + (-1.0 * _x_x_28)) <= -1.0) && (((x_25 + (-1.0 * _x_x_28)) <= -15.0) && (((x_24 + (-1.0 * _x_x_28)) <= -20.0) && (((x_23 + (-1.0 * _x_x_28)) <= -14.0) && (((x_22 + (-1.0 * _x_x_28)) <= -10.0) && (((x_21 + (-1.0 * _x_x_28)) <= -19.0) && (((x_19 + (-1.0 * _x_x_28)) <= -13.0) && (((x_17 + (-1.0 * _x_x_28)) <= -11.0) && (((x_16 + (-1.0 * _x_x_28)) <= -16.0) && (((x_14 + (-1.0 * _x_x_28)) <= -12.0) && (((x_8 + (-1.0 * _x_x_28)) <= -14.0) && (((x_4 + (-1.0 * _x_x_28)) <= -19.0) && (((x_3 + (-1.0 * _x_x_28)) <= -10.0) && (((x_0 + (-1.0 * _x_x_28)) <= -20.0) && ((x_1 + (-1.0 * _x_x_28)) <= -10.0)))))))))))))))) && (((x_29 + (-1.0 * _x_x_28)) == -17.0) || (((x_28 + (-1.0 * _x_x_28)) == -1.0) || (((x_25 + (-1.0 * _x_x_28)) == -15.0) || (((x_24 + (-1.0 * _x_x_28)) == -20.0) || (((x_23 + (-1.0 * _x_x_28)) == -14.0) || (((x_22 + (-1.0 * _x_x_28)) == -10.0) || (((x_21 + (-1.0 * _x_x_28)) == -19.0) || (((x_19 + (-1.0 * _x_x_28)) == -13.0) || (((x_17 + (-1.0 * _x_x_28)) == -11.0) || (((x_16 + (-1.0 * _x_x_28)) == -16.0) || (((x_14 + (-1.0 * _x_x_28)) == -12.0) || (((x_8 + (-1.0 * _x_x_28)) == -14.0) || (((x_4 + (-1.0 * _x_x_28)) == -19.0) || (((x_3 + (-1.0 * _x_x_28)) == -10.0) || (((x_0 + (-1.0 * _x_x_28)) == -20.0) || ((x_1 + (-1.0 * _x_x_28)) == -10.0)))))))))))))))))) && ((((x_30 + (-1.0 * _x_x_29)) <= -17.0) && (((x_29 + (-1.0 * _x_x_29)) <= -5.0) && (((x_27 + (-1.0 * _x_x_29)) <= -14.0) && (((x_26 + (-1.0 * _x_x_29)) <= -8.0) && (((x_23 + (-1.0 * _x_x_29)) <= -16.0) && (((x_22 + (-1.0 * _x_x_29)) <= -20.0) && (((x_18 + (-1.0 * _x_x_29)) <= -13.0) && (((x_15 + (-1.0 * _x_x_29)) <= -12.0) && (((x_14 + (-1.0 * _x_x_29)) <= -5.0) && (((x_12 + (-1.0 * _x_x_29)) <= -14.0) && (((x_11 + (-1.0 * _x_x_29)) <= -2.0) && (((x_10 + (-1.0 * _x_x_29)) <= -8.0) && (((x_9 + (-1.0 * _x_x_29)) <= -19.0) && (((x_7 + (-1.0 * _x_x_29)) <= -13.0) && (((x_5 + (-1.0 * _x_x_29)) <= -3.0) && ((x_6 + (-1.0 * _x_x_29)) <= -3.0)))))))))))))))) && (((x_30 + (-1.0 * _x_x_29)) == -17.0) || (((x_29 + (-1.0 * _x_x_29)) == -5.0) || (((x_27 + (-1.0 * _x_x_29)) == -14.0) || (((x_26 + (-1.0 * _x_x_29)) == -8.0) || (((x_23 + (-1.0 * _x_x_29)) == -16.0) || (((x_22 + (-1.0 * _x_x_29)) == -20.0) || (((x_18 + (-1.0 * _x_x_29)) == -13.0) || (((x_15 + (-1.0 * _x_x_29)) == -12.0) || (((x_14 + (-1.0 * _x_x_29)) == -5.0) || (((x_12 + (-1.0 * _x_x_29)) == -14.0) || (((x_11 + (-1.0 * _x_x_29)) == -2.0) || (((x_10 + (-1.0 * _x_x_29)) == -8.0) || (((x_9 + (-1.0 * _x_x_29)) == -19.0) || (((x_7 + (-1.0 * _x_x_29)) == -13.0) || (((x_5 + (-1.0 * _x_x_29)) == -3.0) || ((x_6 + (-1.0 * _x_x_29)) == -3.0)))))))))))))))))) && ((((x_31 + (-1.0 * _x_x_30)) <= -2.0) && (((x_30 + (-1.0 * _x_x_30)) <= -14.0) && (((x_29 + (-1.0 * _x_x_30)) <= -11.0) && (((x_27 + (-1.0 * _x_x_30)) <= -12.0) && (((x_25 + (-1.0 * _x_x_30)) <= -2.0) && (((x_19 + (-1.0 * _x_x_30)) <= -8.0) && (((x_18 + (-1.0 * _x_x_30)) <= -4.0) && (((x_16 + (-1.0 * _x_x_30)) <= -15.0) && (((x_15 + (-1.0 * _x_x_30)) <= -3.0) && (((x_12 + (-1.0 * _x_x_30)) <= -17.0) && (((x_9 + (-1.0 * _x_x_30)) <= -16.0) && (((x_8 + (-1.0 * _x_x_30)) <= -7.0) && (((x_6 + (-1.0 * _x_x_30)) <= -2.0) && (((x_3 + (-1.0 * _x_x_30)) <= -9.0) && (((x_0 + (-1.0 * _x_x_30)) <= -20.0) && ((x_2 + (-1.0 * _x_x_30)) <= -18.0)))))))))))))))) && (((x_31 + (-1.0 * _x_x_30)) == -2.0) || (((x_30 + (-1.0 * _x_x_30)) == -14.0) || (((x_29 + (-1.0 * _x_x_30)) == -11.0) || (((x_27 + (-1.0 * _x_x_30)) == -12.0) || (((x_25 + (-1.0 * _x_x_30)) == -2.0) || (((x_19 + (-1.0 * _x_x_30)) == -8.0) || (((x_18 + (-1.0 * _x_x_30)) == -4.0) || (((x_16 + (-1.0 * _x_x_30)) == -15.0) || (((x_15 + (-1.0 * _x_x_30)) == -3.0) || (((x_12 + (-1.0 * _x_x_30)) == -17.0) || (((x_9 + (-1.0 * _x_x_30)) == -16.0) || (((x_8 + (-1.0 * _x_x_30)) == -7.0) || (((x_6 + (-1.0 * _x_x_30)) == -2.0) || (((x_3 + (-1.0 * _x_x_30)) == -9.0) || (((x_0 + (-1.0 * _x_x_30)) == -20.0) || ((x_2 + (-1.0 * _x_x_30)) == -18.0)))))))))))))))))) && ((((x_31 + (-1.0 * _x_x_31)) <= -8.0) && (((x_29 + (-1.0 * _x_x_31)) <= -18.0) && (((x_28 + (-1.0 * _x_x_31)) <= -15.0) && (((x_26 + (-1.0 * _x_x_31)) <= -5.0) && (((x_25 + (-1.0 * _x_x_31)) <= -3.0) && (((x_24 + (-1.0 * _x_x_31)) <= -5.0) && (((x_20 + (-1.0 * _x_x_31)) <= -13.0) && (((x_17 + (-1.0 * _x_x_31)) <= -6.0) && (((x_16 + (-1.0 * _x_x_31)) <= -18.0) && (((x_14 + (-1.0 * _x_x_31)) <= -11.0) && (((x_13 + (-1.0 * _x_x_31)) <= -12.0) && (((x_6 + (-1.0 * _x_x_31)) <= -19.0) && (((x_5 + (-1.0 * _x_x_31)) <= -15.0) && (((x_4 + (-1.0 * _x_x_31)) <= -15.0) && (((x_0 + (-1.0 * _x_x_31)) <= -19.0) && ((x_1 + (-1.0 * _x_x_31)) <= -3.0)))))))))))))))) && (((x_31 + (-1.0 * _x_x_31)) == -8.0) || (((x_29 + (-1.0 * _x_x_31)) == -18.0) || (((x_28 + (-1.0 * _x_x_31)) == -15.0) || (((x_26 + (-1.0 * _x_x_31)) == -5.0) || (((x_25 + (-1.0 * _x_x_31)) == -3.0) || (((x_24 + (-1.0 * _x_x_31)) == -5.0) || (((x_20 + (-1.0 * _x_x_31)) == -13.0) || (((x_17 + (-1.0 * _x_x_31)) == -6.0) || (((x_16 + (-1.0 * _x_x_31)) == -18.0) || (((x_14 + (-1.0 * _x_x_31)) == -11.0) || (((x_13 + (-1.0 * _x_x_31)) == -12.0) || (((x_6 + (-1.0 * _x_x_31)) == -19.0) || (((x_5 + (-1.0 * _x_x_31)) == -15.0) || (((x_4 + (-1.0 * _x_x_31)) == -15.0) || (((x_0 + (-1.0 * _x_x_31)) == -19.0) || ((x_1 + (-1.0 * _x_x_31)) == -3.0)))))))))))))))))) && ((_EL_U_3072 == (_x__EL_U_3072 || (( !_x__EL_X_3065) || ( !_x__EL_X_3067)))) && ((_EL_X_3067 == ((_x_x_6 + (-1.0 * _x_x_23)) <= 3.0)) && (_EL_X_3065 == ((_x_x_2 + (-1.0 * _x_x_21)) <= 11.0))))); x_11 = _x_x_11; _EL_X_3065 = _x__EL_X_3065; _EL_X_3067 = _x__EL_X_3067; x_2 = _x_x_2; _EL_U_3072 = _x__EL_U_3072; x_3 = _x_x_3; x_22 = _x_x_22; x_1 = _x_x_1; x_23 = _x_x_23; x_0 = _x_x_0; x_8 = _x_x_8; x_4 = _x_x_4; x_9 = _x_x_9; x_5 = _x_x_5; x_6 = _x_x_6; x_12 = _x_x_12; x_13 = _x_x_13; x_15 = _x_x_15; x_14 = _x_x_14; x_18 = _x_x_18; x_16 = _x_x_16; x_19 = _x_x_19; x_17 = _x_x_17; x_27 = _x_x_27; x_20 = _x_x_20; x_30 = _x_x_30; x_24 = _x_x_24; x_25 = _x_x_25; x_26 = _x_x_26; x_28 = _x_x_28; x_29 = _x_x_29; x_31 = _x_x_31; x_21 = _x_x_21; x_7 = _x_x_7; x_10 = _x_x_10; } }
the_stack_data/44089.c
#include<stdio.h> int main() { int n; scanf("%d",&n); for(int i = n;i>=1;i--) { int count = n; int j = n; for(;count>=1;count--) { if(count>i) { printf("%d%c",j,32); j--; } else { printf("%d%c",j,32); } } for(int k =i;count<n-1;count++) { if(count>=i-1) { k++; printf("%d%c",k,32); } else{ printf("%d%c",k,32); } } printf("\n"); } for(int i =1;i<=n-1;i++) { int count = n; for(int j = n;count>=1;count--) { if(j>i+1) { printf("%d%c",j,32); j--; } else { printf("%d%c",j,32); } } for(int j =i+1;count<n-1;count++) { if(count>=i-1) { printf("%d%c",j,32); j++; } else { printf("%d%c",j,32); } } printf("\n"); } }
the_stack_data/50136769.c
/*Exercise 4 - Functions Implement the three functions minimum(), maximum() and multiply() below the main() function. Do not change the code given in the main() function when you are implementing your solution.*/ #include <stdio.h> int minimum(int a,int b); int maximum(int a,int b); int multiply(int a,int b); int main() { int no1, no2; printf("Enter a value for no 1 : "); scanf("%d", &no1); printf("Enter a value for no 2 : "); scanf("%d", &no2); printf("%d ", minimum(no1, no2)); printf("%d ", maximum(no1, no2)); printf("%d ", multiply(no1, no2)); return 0; } int minimum(int a,int b) { if(a>b){ return b; } else{ return a; } } int maximum(int a,int b) { if(a>b){ return a; } else{ return b; } } int multiply(int a,int b) { int ans; ans=a*b; return ans; }
the_stack_data/951619.c
// RUN: %clang_cc1 -fsyntax-only -verify %s typedef int Arr[10]; typedef int trungl_int; void f(int a[10], Arr arr) { // expected-note 4 {{declared here}} /* Should warn. */ (void)sizeof(a); // \ // expected-warning{{sizeof on array function parameter will return size of 'int *' instead of 'int[10]'}} (void)sizeof((((a)))); // \ // expected-warning{{sizeof on array function parameter will return size of 'int *' instead of 'int[10]'}} (void)sizeof a; // \ // expected-warning{{sizeof on array function parameter will return size of 'int *' instead of 'int[10]'}} (void)sizeof arr; // \ // expected-warning{{sizeof on array function parameter will return size of 'int *' instead of 'Arr' (aka 'int[10]')}} /* Shouldn't warn. */ int b[10]; (void)sizeof b; Arr brr; (void)sizeof brr; (void)sizeof(Arr); (void)sizeof(int); }
the_stack_data/45301.c
//{{BLOCK(Trex) //====================================================================== // // Trex, 32x192@8, // + palette 256 entries, not compressed // + 96 tiles not compressed // Total size: 512 + 6144 = 6656 // // Time-stamp: 2021-12-27, 12:27:09 // Exported by Cearn's GBA Image Transmogrifier, v0.8.6 // ( http://www.coranac.com/projects/#grit ) // //====================================================================== const unsigned short TrexTiles[3072] __attribute__((aligned(4)))= { 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0600,0x0000,0x0000,0x0000,0x0800, 0x0000,0x0000,0x0000,0x0800,0x0000,0x0000,0x0000,0x0800, 0x0000,0x0000,0x0000,0x0D00,0x0000,0x0000,0x0000,0x0D00, 0x0000,0x0000,0x0000,0x0000,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0000,0x0000,0x0000,0x0000,0x0808,0x0808,0x0808,0x0000, 0x0808,0x0808,0x0808,0x0000,0x0808,0x0808,0x0808,0x0000, 0x0808,0x0808,0x0808,0x0000,0x0808,0x0808,0x0808,0x0000, 0x0808,0x0808,0x0808,0x0000,0x0808,0x0808,0x0808,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0808,0x0000,0x0000, 0x0000,0x0808,0x0009,0x0000,0x0000,0x0808,0x0008,0x0000, 0x0000,0x0808,0x0808,0x0000,0x0000,0x0808,0x0808,0x0008, 0x0000,0x0000,0x0000,0x0D00,0x0000,0x0000,0x0000,0x0D00, 0x0000,0x0000,0x0000,0x0A00,0x0000,0x0000,0x0900,0x0808, 0x0000,0x0000,0x0408,0x0808,0x0000,0x0800,0x0808,0x0808, 0x0900,0x0808,0x0808,0x0808,0x0800,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0008, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0000,0x0808,0x0808,0x0808,0x0909, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0009,0x0000,0x0000,0x0000,0x0000, 0x0808,0x0608,0x0000,0x0000,0x0808,0x0008,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0908,0x0000,0x0000,0x0000,0x0008,0x0000,0x0000,0x0000, 0x0000,0x0808,0x0808,0x0908,0x0000,0x0808,0x0808,0x0808, 0x0000,0x0808,0x0808,0x0808,0x0000,0x0808,0x0808,0x0808, 0x0000,0x0808,0x0808,0x0808,0x0000,0x0800,0x080A,0x0808, 0x0000,0x0000,0x0809,0x0808,0x0000,0x0000,0x0000,0x0808, 0x0809,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0A00, 0x0808,0x0808,0x0808,0x0000,0x0808,0x0808,0x0808,0x0000, 0x0808,0x0808,0x0808,0x0000,0x0808,0x0808,0x0004,0x0000, 0x0808,0x0808,0x000A,0x0000,0x0808,0x0008,0x0000,0x0000, 0x0007,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0800,0x0000,0x0000,0x0000,0x0300, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0808,0x0808,0x0808,0x0808,0x0804,0x0808,0x0808,0x0808, 0x080D,0x0808,0x0808,0x0804,0x0809,0x0808,0x0000,0x0900, 0x0809,0x0008,0x0000,0x0900,0x0809,0x0808,0x0000,0x0900, 0x0800,0x0808,0x0000,0x0800,0x0000,0x0000,0x0000,0x0000, 0x0808,0x0009,0x0000,0x0000,0x0808,0x0009,0x0000,0x0000, 0x0808,0x0000,0x0000,0x0000,0x0808,0x0000,0x0000,0x0000, 0x0808,0x0008,0x0000,0x0000,0x0808,0x0908,0x0000,0x0000, 0x0808,0x0908,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0800,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0000,0x0000,0x0000,0x0000,0x0808,0x0808,0x0008,0x0000, 0x0808,0x0808,0x0808,0x0000,0x0808,0x0808,0x0808,0x0000, 0x0808,0x0808,0x0808,0x0000,0x0808,0x0808,0x0808,0x0000, 0x0808,0x0808,0x0808,0x0000,0x0808,0x0808,0x0808,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0804,0x0000,0x0000, 0x0000,0x0808,0x0000,0x0000,0x0000,0x0808,0x0000,0x0000, 0x0000,0x0808,0x0808,0x0000,0x0000,0x0808,0x0808,0x0008, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0808, 0x0000,0x0000,0x0600,0x0808,0x0000,0x0000,0x0808,0x0808, 0x0000,0x0808,0x0808,0x0808,0x0800,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0008, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0000,0x0808,0x0808,0x0808,0x0000, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0808,0x0008,0x0000,0x0000,0x0808,0x0008,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0008,0x0000,0x0000,0x0000,0x0008,0x0000,0x0000,0x0000, 0x0000,0x0808,0x0808,0x0008,0x0000,0x0808,0x0808,0x0808, 0x0000,0x0808,0x0808,0x0808,0x0000,0x0808,0x0808,0x0808, 0x0000,0x0800,0x0808,0x0808,0x0000,0x0800,0x080E,0x0808, 0x0000,0x0000,0x0800,0x0808,0x0000,0x0000,0x0000,0x0808, 0x0806,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0000, 0x0808,0x0808,0x0808,0x0000,0x0808,0x0808,0x0808,0x0000, 0x0808,0x0808,0x0808,0x0000,0x0808,0x0808,0x000A,0x0000, 0x0808,0x0808,0x0009,0x0000,0x0808,0x0008,0x0000,0x0000, 0x0008,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0400,0x0000,0x0000,0x0000,0x0A00, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0808,0x0808,0x0808,0x0808,0x0804,0x0808,0x0808,0x0808, 0x0800,0x0808,0x0808,0x0000,0x0800,0x0808,0x0000,0x0000, 0x0800,0x0008,0x0000,0x0000,0x0800,0x0808,0x0000,0x0000, 0x0800,0x0808,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0808,0x0000,0x0000,0x0000,0x0808,0x0808,0x0000,0x0000, 0x0808,0x0808,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0600,0x0000,0x0000,0x0000,0x0600, 0x0000,0x0000,0x0000,0x0000,0x0800,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0000,0x0000,0x0000,0x0000,0x0808,0x0808,0x0008,0x0000, 0x0808,0x0808,0x0808,0x0000,0x0808,0x0808,0x0808,0x0000, 0x0808,0x0808,0x0808,0x0000,0x0808,0x0808,0x0808,0x0000, 0x0808,0x0808,0x0808,0x0000,0x0808,0x0808,0x0808,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0404,0x0000,0x0000, 0x0000,0x0808,0x0000,0x0000,0x0000,0x0808,0x0000,0x0000, 0x0000,0x0808,0x0808,0x0000,0x0000,0x0808,0x0808,0x0008, 0x0000,0x0000,0x0000,0x0600,0x0000,0x0000,0x0000,0x0600, 0x0000,0x0000,0x0000,0x0600,0x0000,0x0000,0x0000,0x0808, 0x0000,0x0000,0x0606,0x0804,0x0000,0x0000,0x0808,0x0808, 0x0000,0x0808,0x0808,0x0808,0x0800,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0608, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0000,0x0808,0x0808,0x0808,0x0000, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0808,0x0008,0x0000,0x0000,0x0808,0x0008,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0008,0x0000,0x0000,0x0000,0x0008,0x0000,0x0000,0x0000, 0x0000,0x0808,0x0808,0x0608,0x0000,0x0808,0x0808,0x0808, 0x0000,0x0808,0x0808,0x0808,0x0000,0x0808,0x0808,0x0808, 0x0000,0x0800,0x0808,0x0808,0x0000,0x0800,0x0809,0x0808, 0x0000,0x0000,0x0800,0x0808,0x0000,0x0000,0x0000,0x0808, 0x0806,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0600, 0x0808,0x0808,0x0808,0x0000,0x0808,0x0808,0x0808,0x0000, 0x0808,0x0808,0x0808,0x0000,0x0808,0x0808,0x000C,0x0000, 0x0808,0x0808,0x0009,0x0000,0x0808,0x0008,0x0000,0x0000, 0x0008,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0400,0x0000,0x0000,0x0000,0x0800, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0808,0x0808,0x0808,0x0808,0x0804,0x0808,0x0808,0x0808, 0x0400,0x0808,0x0808,0x0808,0x0000,0x0808,0x0808,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0808,0x0000,0x0000,0x0000,0x0808,0x0000,0x0000,0x0000, 0x0808,0x0000,0x0000,0x0000,0x0808,0x0000,0x0000,0x0000, 0x0808,0x0000,0x0000,0x0000,0x0808,0x0008,0x0000,0x0000, 0x0808,0x0008,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0600,0x0008,0x0000,0x0000, 0x0600,0x0808,0x0008,0x0000,0x0000,0x0808,0x0808,0x0808, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0800,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x080A,0x0408, 0x0808,0x0000,0x080E,0x0808,0x0808,0x0408,0x0808,0x0808, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0404,0x0804,0x0008,0x0000, 0x0808,0x0808,0x0608,0x0000,0x0808,0x0808,0x0808,0x0006, 0x0000,0x0808,0x0808,0x0808,0x0000,0x0800,0x0808,0x0808, 0x0000,0x0400,0x0808,0x0808,0x0000,0x0600,0x0808,0x0808, 0x0000,0x0000,0x0806,0x0808,0x0000,0x0000,0x0B00,0x0808, 0x0000,0x0000,0x0000,0x0804,0x0000,0x0000,0x0000,0x0800, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x080A,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0408,0x0804,0x0808,0x0808,0x0008,0x080E,0x0808, 0x0808,0x0808,0x0808,0x0006,0x0808,0x0808,0x0808,0x0006, 0x0808,0x0808,0x0808,0x0006,0x0808,0x0808,0x0808,0x0006, 0x0808,0x0808,0x0808,0x0006,0x0508,0x0C05,0x0F0B,0x0000, 0x0408,0x0408,0x0006,0x0000,0x0808,0x0808,0x0006,0x0000, 0x0000,0x0000,0x0000,0x0600,0x0000,0x0000,0x0000,0x0800, 0x0000,0x0000,0x0000,0x0800,0x0000,0x0000,0x0000,0x0800, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0808,0x0808,0x0808,0x0404,0x0304,0x0808,0x0808,0x0003, 0x0408,0x0808,0x0408,0x0000,0x0408,0x0808,0x0004,0x0000, 0x0606,0x0808,0x0006,0x0000,0x0000,0x0808,0x0008,0x0000, 0x0000,0x0808,0x0008,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0808,0x0004,0x0600,0x0606,0x080A,0x0009,0x0000,0x0000, 0x0804,0x0008,0x0000,0x0000,0x0808,0x0008,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0606,0x0606,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0006,0x0000,0x0000,0x0000,0x0608,0x0000,0x0000, 0x0000,0x0808,0x0608,0x0000,0x0600,0x0808,0x0408,0x0408, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0600,0x0000,0x0000,0x0000, 0x0800,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0807,0x0808, 0x0808,0x0000,0x080A,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0808,0x0808,0x0008,0x0000, 0x0808,0x0808,0x0608,0x0000,0x0808,0x0808,0x0808,0x0006, 0x0600,0x0808,0x0808,0x0808,0x0000,0x0806,0x0808,0x0808, 0x0000,0x0400,0x0808,0x0808,0x0000,0x0600,0x0808,0x0808, 0x0000,0x0000,0x0806,0x0808,0x0000,0x0000,0x0200,0x0808, 0x0000,0x0000,0x0600,0x0804,0x0000,0x0000,0x0000,0x0806, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0801,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0408,0x0804,0x0808,0x0808,0x0008,0x080E,0x0808, 0x0808,0x0808,0x0808,0x0006,0x0808,0x0808,0x0808,0x0006, 0x0808,0x0808,0x0808,0x0006,0x0808,0x0808,0x0808,0x0006, 0x0808,0x0808,0x0808,0x0006,0x0C08,0x0E09,0x0509,0x0000, 0x0408,0x0808,0x0000,0x0000,0x0808,0x0808,0x0006,0x0000, 0x0000,0x0000,0x0000,0x0600,0x0000,0x0000,0x0000,0x0800, 0x0000,0x0000,0x0000,0x0800,0x0000,0x0000,0x0000,0x0800, 0x0000,0x0000,0x0000,0x0800,0x0000,0x0000,0x0000,0x0800, 0x0000,0x0000,0x0000,0x0800,0x0000,0x0000,0x0000,0x0000, 0x0808,0x0808,0x0808,0x0404,0x0808,0x0A08,0x0808,0x0A08, 0x0808,0x000A,0x040A,0x0A04,0x0408,0x0000,0x0000,0x0000, 0x0604,0x0000,0x0000,0x0000,0x0408,0x0000,0x0000,0x0000, 0x0408,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0808,0x0004,0x0600,0x0606,0x0804,0x000C,0x0000,0x0000, 0x0804,0x0008,0x0000,0x0000,0x040E,0x0008,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0606,0x0006,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0800,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0000,0x0000,0x0000,0x0000,0x0808,0x0808,0x0008,0x0000, 0x0808,0x0808,0x0808,0x0000,0x0808,0x0808,0x0808,0x0000, 0x0808,0x0808,0x0808,0x0000,0x0808,0x0808,0x0808,0x0000, 0x0808,0x0808,0x0808,0x0000,0x0808,0x0808,0x0808,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0804,0x0000,0x0000, 0x0000,0x0808,0x0000,0x0000,0x0000,0x0808,0x0000,0x0000, 0x0000,0x0808,0x0808,0x0000,0x0000,0x0808,0x0808,0x0008, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0600,0x0000,0x0000,0x0000,0x0808, 0x0000,0x0000,0x0600,0x0808,0x0000,0x0000,0x0808,0x0808, 0x0000,0x0808,0x0808,0x0808,0x0800,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0804, 0x0808,0x0808,0x0808,0x0000,0x0808,0x0808,0x0808,0x0000, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0000,0x0808,0x0808,0x0808,0x0000, 0x0808,0x0808,0x0708,0x0000,0x0808,0x0008,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0008,0x0000,0x0000,0x0000,0x0008,0x0000,0x0000,0x0000, 0x0000,0x0808,0x0808,0x0008,0x0000,0x0808,0x0808,0x0808, 0x0000,0x0808,0x0808,0x0808,0x0000,0x0808,0x0808,0x0808, 0x0000,0x0800,0x0808,0x0808,0x0000,0x0800,0x080E,0x0808, 0x0000,0x0000,0x0800,0x0808,0x0000,0x0000,0x0000,0x0808, 0x0806,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808, 0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0808,0x0600, 0x0808,0x0808,0x0808,0x0000,0x0808,0x0808,0x0808,0x0000, 0x0808,0x0808,0x0808,0x0000,0x0808,0x0808,0x000A,0x0000, 0x0808,0x0808,0x0009,0x0000,0x0808,0x0008,0x0000,0x0000, 0x0008,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0800,0x0000,0x0000,0x0000,0x0A00, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0808,0x0808,0x0808,0x0808,0x0804,0x0808,0x0808,0x0808, 0x0800,0x0808,0x0408,0x0804,0x0800,0x0808,0x0000,0x0600, 0x0800,0x0008,0x0000,0x0600,0x0800,0x0808,0x0000,0x0600, 0x0800,0x0808,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0808,0x0000,0x0000,0x0000,0x0808,0x0000,0x0000,0x0000, 0x0808,0x0000,0x0000,0x0000,0x0808,0x0000,0x0000,0x0000, 0x0808,0x0000,0x0000,0x0000,0x0808,0x0008,0x0000,0x0000, 0x0808,0x0008,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, }; const unsigned short TrexPal[256] __attribute__((aligned(4)))= { 0x0000,0x18C6,0x56B5,0x35AD,0x2D6B,0x4631,0x7FFF,0x2529, 0x294A,0x4210,0x318C,0x4E73,0x4A52,0x2108,0x39CE,0x5294, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, }; //}}BLOCK(Trex)
the_stack_data/104827780.c
int main() { unsigned char arg = 0xAA; unsigned char out = 0; __asm__("rolb $1, %%al;" : "=a"(out) : "a"(arg)); return (out == 0x55); }
the_stack_data/62447.c
//Day6a.c // //The sixth challenge is to decode a corrupted message that is sent using a //repetition code. This is the same message sent over and over with different //corruption every time. // //Our input is a series of lines, each of which contains one attempt to send the //message -- a string of 8 letters. The actual message is made up of the most //common letters that appear in each position of the message across the entire //input. // //Question 1: What is the message? // //To solve this, we need to keep track of character counts, similar to what we //did on Day 4. This day is easy! #include <stdio.h> #include <stdlib.h> #include <string.h> #include <errno.h> //We all know there are 26 letters, but it's still bad practice to put random //constants in your code. #define NUM_LETTERS 26 #define MESSAGE_LEN 8 int main(int argc, char **argv) { //The message length buffer needs to hold both the newline and the null //terminator in addition to the message. If we wanted to, we could FILE *inFile; int counts[MESSAGE_LEN][NUM_LETTERS]; char line[MESSAGE_LEN + 2]; char message[MESSAGE_LEN+1]; int c, l, maxCount; //Clear all the arrays memset(counts, 0, MESSAGE_LEN * NUM_LETTERS * sizeof(int)); memset(line, '\0', MESSAGE_LEN + 2); memset(message, '\0', MESSAGE_LEN + 1); //The usual command line argument check and input file opening if (argc != 2) { fprintf(stderr, "Usage:\n\tDay6 <input filename>\n\n"); return EXIT_FAILURE; } inFile = fopen(argv[1], "r"); if (inFile == NULL) { fprintf(stderr, "Error opening file: %s\n\n", strerror(errno)); return EXIT_FAILURE; } //Read the lines one at a time and count the letters while (fgets(line, MESSAGE_LEN+1, inFile) != NULL) { for (c = 0; c < MESSAGE_LEN; c++) { //The counts are stored in a 2D array. The first dimension is the //position within the message. The second dimension is the letter. //To get the letter offset, we can subtract the ASCII value of 'a' //from the line character. counts[c][line[c] - 'a']++; } } //Close the file as soon as we're done with it fclose(inFile); //Find the most common letters by iterating over the count array, looking //for the maximum counts. for (c = 0; c < MESSAGE_LEN; c++) { maxCount = 0; for (l = 0; l < NUM_LETTERS; l++) { if (counts[c][l] > maxCount) { maxCount = counts[c][l]; //The last character we write will be the correct one message[c] = 'a' + l; } } } //Print the message printf("%s\n", message); return EXIT_SUCCESS; }
the_stack_data/107953178.c
int sub1(int x) { return x - 1; } int main(int argc, char **argv) { return sub1(argc); }
the_stack_data/997791.c
#include<stdio.h> int is_zhishu(int n) { int mark=0; if(n==2) mark=1; else { int i=2; for(; i<n; i++) { if(n%i==0) { mark=1; break; } } } return mark; } int main() { int n; scanf("%d",&n); int k=n+1; while(is_zhishu(k)==1) k++; printf("%d",k); return 0; }
the_stack_data/83289.c
#include "stdio.h" #include "stdlib.h" #include "string.h" #include "unistd.h" //PROTYPES void instructions(); int morph(char *number); //main int main(int argc, char* argv[]) { //check if user input filename is not null if (argv[1] != NULL) { FILE * file; //define file file = fopen(argv[1], "r"); //check if file exists and can be opened if (file) { //confirmation output printf("%s\n", "File exists."); //var for int from file unsigned int num; //read from binary file and check if successful if (fread(&num, sizeof(int), 1, file) != 1) { printf("%s\n", "failed to read from binary file."); } else { printf("%s\n", "read binary file success"); //char array to hold number as string char buffer[30]; //store value of num in buffer sprintf(buffer,"%d\n", num); printf("%s\n", "sending to morph"); //send filename to moprh method morph(buffer); } } else { //error message printf("%s, %s, %s \n", "Error: file ", argv[1], " does not exist."); } //if file is null show program usage } else { instructions(); } return 0; } //displays usage of program void instructions() { printf("%s\n", "Usage: singlePrime [filename]"); } //morph function to morph data from current file to target program int morph(char *number) { //target name for next program char *name = "./isPrime"; //method target and param char *params[3] = {"isPrime", number}; //execute program within process id, pass program name and params int r = execvp(name, params); //printf("%d\n",r); return 1; }
the_stack_data/232954894.c
// vi:nu:et:sts=4 ts=4 sw=4 // // From: https://gist.github.com/jvranish/4441299 // // Since someone asked: // I put this code in the public domain. As such you can use // it without restrictions, but I provide no warranty as to // its usefulness or fitness for any purpose. /* compile with: on linux: gcc -g stack_traces.c on OS X: gcc -g -fno-pie stack_traces.c on windows: gcc -g stack_traces.c -limagehlp */ #include <signal.h> #include <stdio.h> #include <assert.h> #include <stdlib.h> #include <stdbool.h> #include <stdint.h> #include <stdbool.h> #include <errno.h> #ifdef _WIN32 #include <windows.h> #include <imagehlp.h> #else #include <err.h> #include <execinfo.h> #endif // void almost_c99_signal_handler(int sig) // { // switch(sig) // { // case SIGABRT: // fputs("Caught SIGABRT: usually caused by an abort() or assert()\n", stderr); // break; // case SIGFPE: // fputs("Caught SIGFPE: arithmetic exception, such as divide by zero\n", stderr); // break; // case SIGILL: // fputs("Caught SIGILL: illegal instruction\n", stderr); // break; // case SIGINT: // fputs("Caught SIGINT: interactive attention signal, probably a ctrl+c\n", stderr); // break; // case SIGSEGV: // fputs("Caught SIGSEGV: segfault\n", stderr); // break; // case SIGTERM: // default: // fputs("Caught SIGTERM: a termination request was sent to the program\n", stderr); // break; // } // _Exit(1); // } // void set_signal_handler() // { // signal(SIGABRT, almost_c99_signal_handler); // signal(SIGFPE, almost_c99_signal_handler); // signal(SIGILL, almost_c99_signal_handler); // signal(SIGINT, almost_c99_signal_handler); // signal(SIGSEGV, almost_c99_signal_handler); // signal(SIGTERM, almost_c99_signal_handler); // } static char const * icky_global_program_name; /* Resolve symbol name and source location given the path to the executable and an address */ int addr2line(char const * const program_name, void const * const addr) { char addr2line_cmd[512] = {0}; /* have addr2line map the address to the relent line in the code */ #ifdef __APPLE__ /* apple does things differently... */ sprintf(addr2line_cmd,"atos -o %.256s %p", program_name, addr); #else sprintf(addr2line_cmd,"addr2line -f -p -e %.256s %p", program_name, addr); #endif return system(addr2line_cmd); } #ifdef _WIN32 void windows_print_stacktrace(CONTEXT* context) { SymInitialize(GetCurrentProcess(), 0, true); STACKFRAME frame = { 0 }; /* setup initial stack frame */ frame.AddrPC.Offset = context->Eip; frame.AddrPC.Mode = AddrModeFlat; frame.AddrStack.Offset = context->Esp; frame.AddrStack.Mode = AddrModeFlat; frame.AddrFrame.Offset = context->Ebp; frame.AddrFrame.Mode = AddrModeFlat; while (StackWalk(IMAGE_FILE_MACHINE_I386 , GetCurrentProcess(), GetCurrentThread(), &frame, context, 0, SymFunctionTableAccess, SymGetModuleBase, 0 ) ) { addr2line(icky_global_program_name, (void*)frame.AddrPC.Offset); } SymCleanup( GetCurrentProcess() ); } LONG WINAPI windows_exception_handler(EXCEPTION_POINTERS * ExceptionInfo) { switch(ExceptionInfo->ExceptionRecord->ExceptionCode) { case EXCEPTION_ACCESS_VIOLATION: fputs("Error: EXCEPTION_ACCESS_VIOLATION\n", stderr); break; case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: fputs("Error: EXCEPTION_ARRAY_BOUNDS_EXCEEDED\n", stderr); break; case EXCEPTION_BREAKPOINT: fputs("Error: EXCEPTION_BREAKPOINT\n", stderr); break; case EXCEPTION_DATATYPE_MISALIGNMENT: fputs("Error: EXCEPTION_DATATYPE_MISALIGNMENT\n", stderr); break; case EXCEPTION_FLT_DENORMAL_OPERAND: fputs("Error: EXCEPTION_FLT_DENORMAL_OPERAND\n", stderr); break; case EXCEPTION_FLT_DIVIDE_BY_ZERO: fputs("Error: EXCEPTION_FLT_DIVIDE_BY_ZERO\n", stderr); break; case EXCEPTION_FLT_INEXACT_RESULT: fputs("Error: EXCEPTION_FLT_INEXACT_RESULT\n", stderr); break; case EXCEPTION_FLT_INVALID_OPERATION: fputs("Error: EXCEPTION_FLT_INVALID_OPERATION\n", stderr); break; case EXCEPTION_FLT_OVERFLOW: fputs("Error: EXCEPTION_FLT_OVERFLOW\n", stderr); break; case EXCEPTION_FLT_STACK_CHECK: fputs("Error: EXCEPTION_FLT_STACK_CHECK\n", stderr); break; case EXCEPTION_FLT_UNDERFLOW: fputs("Error: EXCEPTION_FLT_UNDERFLOW\n", stderr); break; case EXCEPTION_ILLEGAL_INSTRUCTION: fputs("Error: EXCEPTION_ILLEGAL_INSTRUCTION\n", stderr); break; case EXCEPTION_IN_PAGE_ERROR: fputs("Error: EXCEPTION_IN_PAGE_ERROR\n", stderr); break; case EXCEPTION_INT_DIVIDE_BY_ZERO: fputs("Error: EXCEPTION_INT_DIVIDE_BY_ZERO\n", stderr); break; case EXCEPTION_INT_OVERFLOW: fputs("Error: EXCEPTION_INT_OVERFLOW\n", stderr); break; case EXCEPTION_INVALID_DISPOSITION: fputs("Error: EXCEPTION_INVALID_DISPOSITION\n", stderr); break; case EXCEPTION_NONCONTINUABLE_EXCEPTION: fputs("Error: EXCEPTION_NONCONTINUABLE_EXCEPTION\n", stderr); break; case EXCEPTION_PRIV_INSTRUCTION: fputs("Error: EXCEPTION_PRIV_INSTRUCTION\n", stderr); break; case EXCEPTION_SINGLE_STEP: fputs("Error: EXCEPTION_SINGLE_STEP\n", stderr); break; case EXCEPTION_STACK_OVERFLOW: fputs("Error: EXCEPTION_STACK_OVERFLOW\n", stderr); break; default: fputs("Error: Unrecognized Exception\n", stderr); break; } fflush(stderr); /* If this is a stack overflow then we can't walk the stack, so just show where the error happened */ if (EXCEPTION_STACK_OVERFLOW != ExceptionInfo->ExceptionRecord->ExceptionCode) { windows_print_stacktrace(ExceptionInfo->ContextRecord); } else { addr2line(icky_global_program_name, (void*)ExceptionInfo->ContextRecord->Eip); } return EXCEPTION_EXECUTE_HANDLER; } void set_signal_handler() { SetUnhandledExceptionFilter(windows_exception_handler); } #else #define MAX_STACK_FRAMES 64 static void *stack_traces[MAX_STACK_FRAMES]; void posix_print_stack_trace(void) { int i, trace_size = 0; char **messages = (char **)NULL; trace_size = backtrace(stack_traces, MAX_STACK_FRAMES); messages = backtrace_symbols(stack_traces, trace_size); /* skip the first couple stack frames (as they are this function and our handler) and also skip the last frame as it's (always?) junk. */ // for (i = 3; i < (trace_size - 1); ++i) for (i = 0; i < trace_size; ++i) // we'll use this for now so you can see what's going on { if (addr2line(icky_global_program_name, stack_traces[i]) != 0) { printf(" error determining line # for: %s\n", messages[i]); } } if (messages) { free(messages); } } void posix_signal_handler(int sig, siginfo_t *siginfo, void *context) { (void)context; switch(sig) { case SIGSEGV: fputs("Caught SIGSEGV: Segmentation Fault\n", stderr); break; case SIGINT: fputs("Caught SIGINT: Interactive attention signal, (usually ctrl+c)\n", stderr); break; case SIGFPE: switch(siginfo->si_code) { case FPE_INTDIV: fputs("Caught SIGFPE: (integer divide by zero)\n", stderr); break; case FPE_INTOVF: fputs("Caught SIGFPE: (integer overflow)\n", stderr); break; case FPE_FLTDIV: fputs("Caught SIGFPE: (floating-point divide by zero)\n", stderr); break; case FPE_FLTOVF: fputs("Caught SIGFPE: (floating-point overflow)\n", stderr); break; case FPE_FLTUND: fputs("Caught SIGFPE: (floating-point underflow)\n", stderr); break; case FPE_FLTRES: fputs("Caught SIGFPE: (floating-point inexact result)\n", stderr); break; case FPE_FLTINV: fputs("Caught SIGFPE: (floating-point invalid operation)\n", stderr); break; case FPE_FLTSUB: fputs("Caught SIGFPE: (subscript out of range)\n", stderr); break; default: fputs("Caught SIGFPE: Arithmetic Exception\n", stderr); break; } case SIGILL: switch(siginfo->si_code) { case ILL_ILLOPC: fputs("Caught SIGILL: (illegal opcode)\n", stderr); break; case ILL_ILLOPN: fputs("Caught SIGILL: (illegal operand)\n", stderr); break; case ILL_ILLADR: fputs("Caught SIGILL: (illegal addressing mode)\n", stderr); break; case ILL_ILLTRP: fputs("Caught SIGILL: (illegal trap)\n", stderr); break; case ILL_PRVOPC: fputs("Caught SIGILL: (privileged opcode)\n", stderr); break; case ILL_PRVREG: fputs("Caught SIGILL: (privileged register)\n", stderr); break; case ILL_COPROC: fputs("Caught SIGILL: (coprocessor error)\n", stderr); break; case ILL_BADSTK: fputs("Caught SIGILL: (internal stack error)\n", stderr); break; default: fputs("Caught SIGILL: Illegal Instruction\n", stderr); break; } break; case SIGTERM: fputs("Caught SIGTERM: a termination request was sent to the program\n", stderr); break; case SIGABRT: fputs("Caught SIGABRT: usually caused by an abort() or assert()\n", stderr); break; default: break; } posix_print_stack_trace(); _Exit(1); } static uint8_t alternate_stack[SIGSTKSZ]; void set_signal_handler(void) { /* setup alternate stack */ { stack_t ss = {}; /* malloc is usually used here, I'm not 100% sure my static allocation is valid but it seems to work just fine. */ ss.ss_sp = (void*)alternate_stack; ss.ss_size = SIGSTKSZ; ss.ss_flags = 0; if (sigaltstack(&ss, NULL) != 0) { err(1, "sigaltstack"); } } /* register our signal handlers */ { struct sigaction sig_action = {}; sig_action.sa_sigaction = posix_signal_handler; sigemptyset(&sig_action.sa_mask); #ifdef __APPLE__ /* for some reason we backtrace() doesn't work on osx when we use an alternate stack */ sig_action.sa_flags = SA_SIGINFO; #else sig_action.sa_flags = SA_SIGINFO | SA_ONSTACK; #endif if (sigaction(SIGSEGV, &sig_action, NULL) != 0) { err(1, "sigaction"); } if (sigaction(SIGFPE, &sig_action, NULL) != 0) { err(1, "sigaction"); } if (sigaction(SIGINT, &sig_action, NULL) != 0) { err(1, "sigaction"); } if (sigaction(SIGILL, &sig_action, NULL) != 0) { err(1, "sigaction"); } if (sigaction(SIGTERM, &sig_action, NULL) != 0) { err(1, "sigaction"); } if (sigaction(SIGABRT, &sig_action, NULL) != 0) { err(1, "sigaction"); } } } #endif #ifdef TEST_PROG int divide_by_zero( ); void cause_segfault( ); void stack_overflow( ); void infinite_loop( ); void illegal_instruction(); void cause_calamity(); static char const * icky_global_program_name; int main(int argc, char * argv[]) { (void)argc; /* store off program path so we can use it later */ icky_global_program_name = argv[0]; set_signal_handler(); cause_calamity(); puts("OMG! Nothing bad happend!"); return 0; } void cause_calamity() { /* uncomment one of the following error conditions to cause a calamity of your choosing! */ // (void)divide_by_zero(); cause_segfault(); // assert(false); // infinite_loop(); // illegal_instruction(); // stack_overflow(); } int divide_by_zero() { int a = 1; int b = 0; return a / b; } void cause_segfault() { int * p = (int*)0x12345678; *p = 0; } void stack_overflow(); void stack_overflow() { int foo[1000]; (void)foo; stack_overflow(); } /* break out with ctrl+c to test SIGINT handling */ void infinite_loop() { while(1) {}; } void illegal_instruction() { /* I couldn't find an easy way to cause this one, so I'm cheating */ raise(SIGILL); } #endif
the_stack_data/48573967.c
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <unistd.h> #include <sys/types.h> #include <sys/wait.h> #include <readline/readline.h> #include <readline/history.h> FILE *fp; void split(char *line, char **argv) { if(*line == '\0') { argv[0] = "\0"; return; } while (*line != '\0') { while (*line == ' ' || *line == '\t') *line++ = '\0'; *argv++ = line; while(*line != '\0' && *line != ' ' && *line != '\t') line++; } *argv = '\0'; } void execute(char **argv) { pid_t pid = fork(); int status; char ch; if(!strcmp(argv[0],"cd")) chdir("/home/inro"); if(!pid) { if(!strcmp(argv[0],"exit")) exit(0); else if(execvp(argv[0], argv) < 0 && strcmp(argv[0],"hist")!=0 && strcmp(argv[0],"cd")!=0) { printf("command not found!!!\n"); exit(1); } } else if(pid>0) { if(!strcmp(argv[0],"hist")) { fp = fopen("history.txt","r"); ch = fgetc(fp); while(ch != EOF) { printf("%c",ch); ch = fgetc(fp); } } while(wait(&status) != pid); } else printf("fork is not working!!!\n"); } int main() { char *buff; fp = fopen("history.txt","w"); fclose(fp); while(1) { char cwd[100]; char *argv[100]; char shell[1000]; char *s; getcwd(cwd, sizeof(cwd)); strcpy(shell,"ubuntu@sobhan:"); strcat(shell,cwd); strcat(shell,"$ "); buff = readline(shell); //read a line from terminal fp = fopen("history.txt","a"); fprintf(fp, "%s\n", buff); fclose(fp); if(strlen(buff)>0) add_history(buff); split(buff,argv); if(!strcmp(argv[0],"exit")) exit(0); else if(!strcmp(argv[0],"\0")) continue; else execute(argv); } return 0; }
the_stack_data/193892441.c
/* Make the necessary includes and set up the variables. */ #include <sys/types.h> #include <sys/socket.h> #include <stdio.h> #include <sys/un.h> #include <unistd.h> #include <stdlib.h> int main() { int sockfd; int len; struct sockaddr_un address; int result; char ch = 'A'; /* Create a socket for the client. */ sockfd = socket(AF_UNIX, SOCK_STREAM, 0); /* Name the socket, as agreed with the server. */ address.sun_family = AF_UNIX; strcpy(address.sun_path, "server_socket"); len = sizeof(address); /* Now connect our socket to the server's socket. */ result = connect(sockfd, (struct sockaddr *)&address, len); if(result == -1) { perror("oops: client1"); exit(1); } /* We can now read/write via sockfd. */ write(sockfd, &ch, 1); read(sockfd, &ch, 1); printf("char from server = %c\n", ch); close(sockfd); exit(0); }
the_stack_data/29824597.c
#include <stdio.h> #include <string.h> #include <stdlib.h> struct mystk { unsigned int * ptr; int pos; }; unsigned int top(struct mystk * stk) { unsigned int ret = 0; if (0 <= stk->pos) { ret = stk->ptr[stk->pos]; } return ret; } void push(struct mystk * stk, unsigned int elem) { int p = stk->pos; stk->ptr[++ p] = elem; stk->pos = p; } unsigned int pop(struct mystk * stk) { unsigned int ret = 0; int p = stk->pos; if (0 <= p) { ret = stk->ptr[p]; stk->ptr[p--] = 0; stk->pos = p; } return ret; } int main() { // FILE* fstream = fopen("input.txt", "r"); unsigned int n; scanf("%u", &n); // fscanf(fstream, "%u", &n); struct mystk * as = malloc(sizeof(struct mystk)); // array A as->ptr = malloc(n * sizeof(unsigned int)); memset(as->ptr, 0, n * sizeof(unsigned int)); as->pos = -1; unsigned int max = 0; for (unsigned int i = 0; i < n; i++) { unsigned int a; scanf("%u", &a); // fscanf(fstream, "%u", &a); unsigned int left = pop(as); unsigned int lleft = top(as); if (0 == left) { push(as, a); } else if (0 == lleft) { push(as, left); push(as, a); unsigned int tmp = left ^ a; if (max < tmp) { max = tmp; } // printf("1: max is %u\n", max); } else { unsigned int tmp = left ^ a; if (max < tmp) { max = tmp; } if (a > left) { push(as, left); push(as, a); } else { // a <= left while(left = pop(as)) { tmp = left ^ a; if (max < tmp) { max = tmp; } if (left <= a) { push(as, left); break; } } push(as, a); } } } printf("%u\n", max); free(as->ptr); free(as); return 0; }
the_stack_data/54825715.c
#include<stdio.h> int main (){ float v1,v2, tot; printf("Informe a nota V1:" ); scanf("%f",&v1); printf("Informe a nota V2:" ); scanf("%f",&v2); tot = (v1+v2)/2; if (tot>=6){ printf("Parabens APROVADO: %.2f\n",tot ); } else if (tot>=3 && tot<6) { printf("Estude Ainda Pode Passar, EXAME: %.2f\n",tot ); } if (tot<3){ printf("Infelizmente vc foi Reprovado:%.2f\n",tot); } return 0; }
the_stack_data/153474.c
#include <stdio.h> int main() { int x, y, s; scanf("%d%d",&x,&y); s = x+y; printf("%d", s); return 0; }
the_stack_data/57950265.c
#include "stdlib.h" #include "time.h" #define MAX 5e7 int main() { srand(0); int i,j; float *x = malloc(MAX*sizeof(float)); for(j=0;j<MAX;j++) { for(i=0;i<4;i++) { x[j] += rand(); } } return 0; }
the_stack_data/70450762.c
#include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX_BASE 33 int main (int argc, char** argv) { int ch; char name[256]; FILE* sfp; FILE* dfp; sfp = fopen(argv[1], "r"); if (sfp == NULL) { perror("fopen"); exit(EXIT_FAILURE); } strcat(name, argv[2]); strcat(name, ".mhc"); strcat(argv[2], "\n"); dfp = fopen(name, "w"); fputs(argv[2], dfp); for (int i = 0; i < MAX_BASE; i++) { for (int j = 0; j <= MAX_BASE; j++) { switch (ch = fgetc(sfp)) { case '+': if ( j < (MAX_BASE - 1) ) fputs("4, ", dfp); else fputs("4\n", dfp); break; case '-': for (int k = 0; k < 2; k++) if (ch = fgetc(sfp) != '-') exit(EXIT_FAILURE); if ( j < (MAX_BASE - 1) ) fputs("3, ", dfp); else fputs("3\n", dfp); break; case '|': if ( j < (MAX_BASE - 1) ) fputs("2, ", dfp); else fputs("2\n", dfp); break; case ' ': if (j % 2 == 1) { for (int k = 0; k < 2; k++) if (ch = fgetc(sfp) != ' ') exit(EXIT_FAILURE); } if ( j < (MAX_BASE - 1) ) fputs("0, ", dfp); else fputs("0\n", dfp); break; } printf("i = %d j = %d ch = %c\n", i, j, (char)ch); } } fclose(sfp); fclose(dfp); exit(EXIT_SUCCESS); }
the_stack_data/194674.c
#if 0 mini_fstat mini_buf 128 globals_on_stack mini_start shrinkelf INCLUDESRC LDSCRIPT default OPTFLAG -Os return #endif int main(){ volatile int ret=42; volatile int a1=0; volatile struct stat* a2=0; fstat(a1,a2); return(ret); }
the_stack_data/95450226.c
// RUN: %check %s main() { static int i; __builtin_constant_p( // CHECK: /warning: unused expression/ __builtin_constant_p( __builtin_types_compatible_p(int, __typeof(i)))); __builtin_trap(); }
the_stack_data/1027840.c
// // Created by 张俊伟 on 2020/7/17. // #include <stdio.h> #include <stdlib.h> #include <stdbool.h> #define EMPTY 0 #define EQUAL 1 #define BIGGER 2 #define SMALLER 3 #define DATA int typedef struct node { DATA key; struct node *left; struct node *right; } Node; /* 树的建立与初始化 */ Node *root = NULL; size_t node_size = 0; //比较;目标值,节点值 int keyCompare(DATA k1, DATA k2); //搜索与key相等的结点;root作为搜索开始 Node *treeFind(DATA key); //销毁 void destotyTree(); //插入 Node *treeInsert(DATA key); //删除 key 所在的结点 成功删除return 1 否则 0 int *treeDelete(DATA key); //找到右子树部分中的最小值 Node *treeDeleteMin(Node **p); //中序遍历 void treeView(Node *p); int keyCompare(DATA k1, DATA k2) { if (k1 == k2) return EQUAL; else if (k1 < k2) return SMALLER; else if (k1 > k2) return BIGGER; } Node *treeFind(DATA key) { Node *p = root; int comp; while (p != NULL) { comp = keyCompare(key, p->key); switch (comp) { case SMALLER: p = p->left; continue; case BIGGER: p = p->right; continue; case EQUAL: return p; } } return NULL; } Node *treeInsert(DATA key) { Node **p = &root; Node *newNode; int flag; while (*p != NULL) { flag = keyCompare(key, (*p)->key); if (flag == SMALLER) { *p = (*p)->left; } else if (flag == BIGGER) { *p = (*p)->right; } else if (flag == EQUAL) return NULL; } if ((newNode = (Node *) malloc(sizeof(Node))) == NULL) { printf("no memory\n"); exit(0); } newNode->key = key; newNode->left = newNode = NULL; *p = newNode; node_size++; return newNode; } int *treeDelete(DATA key) { Node **p = &root, *x; int flag; while ((*p) != NULL) { x = *p; flag = keyCompare(key, (*p)->key); if (flag == SMALLER) { p = &(*p)->left; } else if (flag == BIGGER) { p = &(*p)->right; } else if (flag == EQUAL) { //没左右孩子 if (x->left == NULL && x->right == NULL) { *p = NULL; } //只有一个孩子 else if (x->right == NULL) {//只有左孩子 *p = x->left; } else if (x->left == NULL) { *p = x->right; } else {//有两个孩子 Node *successor = treeDeleteMin(&x->left); (*p)->key = successor->key; x = successor; } free(x); node_size--; return 1; } } return 0; } // p指向当前结点的父结点 *p指向当前结点 (孩子双亲表示) Node *treeDeleteMin(Node **p) { Node *x; while ((*p)->left != NULL) { p = &(*p)->left; } x = *p; p = &x->right; return x; } //中序遍历 void treeView(Node *p) { if (p == NULL)return; treeView(p->left); printf(" %d", p->key); treeView(p->right); } void _destotyTree(Node *p) { if (p == NULL)return; _destotyTree(p->left); _destotyTree(p->right); p->left = p->right = NULL; free(p); } //销毁 void destotyTree() { _destotyTree(root); }
the_stack_data/32951455.c
#include <stdio.h> #include <string.h> int main(void) { typedef struct player { char name[15]; float score; } p; p aPlayer = {0, 0}; // create instance of structure p *ptrPlayer; // create pointer of structure type ptrPlayer = &aPlayer; // assign adress to pointer of structure type strcpy(ptrPlayer->name, "Pinball Wizard"); // acess through indirection ptrPlayer->score = 1000000.00; printf("\nPlayer: %s\n", ptrPlayer->name); printf("Score: %.0f\n", ptrPlayer->score); return 0; } // end main
the_stack_data/247019520.c
/* { dg-do run } */ /* { dg-skip-if "" { *-*-* } { "*" } { "-O2" } } */ /* { dg-options "-fsanitize=undefined" } */ struct T { int c; char d[]; }; struct T t = { 1, "a" }; int baz (int i) { return t.d[i]; } int main (void) { baz (2); return 0; } /* { dg-output "load of address \[^\n\r]* with insufficient space for an object of type 'char'\[^\n\r]*(\n|\r\n|\r)" } */ /* { dg-output "\[^\n\r]*note: pointer points here\[^\n\r]*(\n|\r\n|\r)" } */ /* { dg-output "\[^\n\r]*\[^\n\r]*(\n|\r\n|\r)" } */ /* { dg-output "\[^\n\r]*\\^" } */
the_stack_data/30417.c
// RUN: clang -fsyntax-only -Xclang -verify %s // expected-no-diagnostics #define TAINTED __attribute__((type_annotate("tainted"))) int main() { TAINTED int x = 2; TAINTED float y = (float)x; TAINTED int z; z = x + 5; return 0; }
the_stack_data/17351.c
/* FAudio - XAudio Reimplementation for FNA * * Copyright (c) 2011-2018 Ethan Lee, Luigi Auriemma, and the MonoGame Team * Copyright (c) 2020 Andrew Eikum for CodeWeavers, Inc * * This software is provided 'as-is', without any express or implied warranty. * In no event will the authors be held liable for any damages arising from * the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software in a * product, an acknowledgment in the product documentation would be * appreciated but is not required. * * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * * 3. This notice may not be removed or altered from any source distribution. * * Ethan "flibitijibibo" Lee <[email protected]> * */ #ifdef HAVE_GSTREAMER #include "FAudio_internal.h" #include <gst/gst.h> #include <gst/audio/audio.h> #include <gst/app/gstappsink.h> typedef struct FAudioGSTREAMER { GstPad *srcpad; GstElement *pipeline; GstElement *dst; GstElement *resampler; GstSegment segment; uint8_t *convertCache, *prevConvertCache; size_t convertCacheLen, prevConvertCacheLen; uint32_t curBlock, prevBlock; size_t *blockSizes; } FAudioGSTREAMER; #define SIZE_FROM_DST(sample) \ ((sample) * voice->src.format->nChannels * sizeof(float)) #define SIZE_FROM_SRC(sample) \ ((sample) * voice->src.format->nChannels * (voice->src.format->wBitsPerSample / 8)) #define SIZE_FROM_DST(sample) \ ((sample) * voice->src.format->nChannels * sizeof(float)) #define SAMPLES_FROM_SRC(len) \ ((len) / voice->src.format->nChannels / (voice->src.format->wBitsPerSample / 8)) #define SAMPLES_FROM_DST(len) \ ((len) / voice->src.format->nChannels / sizeof(float)) #define SIZE_SRC_TO_DST(len) \ ((len) * (sizeof(float) / (voice->src.format->wBitsPerSample / 8))) #define SIZE_DST_TO_SRC(len) \ ((len) / (sizeof(float) / (voice->src.format->wBitsPerSample / 8))) static int FAudio_GSTREAMER_RestartDecoder(FAudioGSTREAMER *gstreamer) { GstEvent *event; event = gst_event_new_flush_start(); gst_pad_push_event(gstreamer->srcpad, event); event = gst_event_new_flush_stop(TRUE); gst_pad_push_event(gstreamer->srcpad, event); event = gst_event_new_segment(&gstreamer->segment); gst_pad_push_event(gstreamer->srcpad, event); gstreamer->curBlock = ~0u; gstreamer->prevBlock = ~0u; if (gst_element_set_state(gstreamer->pipeline, GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) { return 0; } return 1; } static int FAudio_GSTREAMER_CheckForBusErrors(FAudioVoice *voice) { GstBus *bus; GstMessage *msg; GError *err = NULL; gchar *debug_info = NULL; int ret = 0; bus = gst_pipeline_get_bus(GST_PIPELINE(voice->src.gstreamer->pipeline)); while((msg = gst_bus_pop_filtered(bus, GST_MESSAGE_ERROR))) { switch(GST_MESSAGE_TYPE(msg)) { case GST_MESSAGE_ERROR: gst_message_parse_error(msg, &err, &debug_info); LOG_ERROR( voice->audio, "Got gstreamer bus error from %s: %s (%s)", GST_OBJECT_NAME(msg->src), err->message, debug_info ? debug_info : "none" ) g_clear_error(&err); g_free(debug_info); gst_message_unref(msg); ret = 1; break; default: gst_message_unref(msg); break; } } gst_object_unref(bus); return ret; } static size_t FAudio_GSTREAMER_FillConvertCache( FAudioVoice *voice, FAudioBuffer *buffer, size_t maxBytes ) { GstBuffer *src, *dst; GstSample *sample; GstMapInfo info; size_t pulled, clipStartBytes, clipEndBytes, toCopyBytes; GstAudioClippingMeta *cmeta; GstFlowReturn push_ret; LOG_FUNC_ENTER(voice->audio) /* Write current block to input buffer, push to pipeline */ src = gst_buffer_new_allocate( NULL, voice->src.format->nBlockAlign, NULL ); if ( gst_buffer_fill( src, 0, buffer->pAudioData + ( voice->src.format->nBlockAlign * voice->src.gstreamer->curBlock ), voice->src.format->nBlockAlign ) != voice->src.format->nBlockAlign ) { LOG_ERROR( voice->audio, "for voice %p, failed to copy whole chunk into buffer", voice ); gst_buffer_unref(src); return (size_t) -1; } push_ret = gst_pad_push(voice->src.gstreamer->srcpad, src); if( push_ret != GST_FLOW_OK && push_ret != GST_FLOW_EOS ) { LOG_ERROR( voice->audio, "for voice %p, pushing buffer failed: 0x%x", voice, push_ret ); return (size_t) -1; } pulled = 0; while (1) { /* Pull frames one into cache */ sample = gst_app_sink_try_pull_sample( GST_APP_SINK(voice->src.gstreamer->dst), 0 ); if (!sample) { /* done decoding */ break; } dst = gst_sample_get_buffer(sample); gst_buffer_map(dst, &info, GST_MAP_READ); cmeta = gst_buffer_get_audio_clipping_meta(dst); if (cmeta) { FAudio_assert(cmeta->format == GST_FORMAT_DEFAULT /* == samples */); clipStartBytes = SIZE_FROM_DST(cmeta->start); clipEndBytes = SIZE_FROM_DST(cmeta->end); } else { clipStartBytes = 0; clipEndBytes = 0; } toCopyBytes = FAudio_min(info.size - (clipStartBytes + clipEndBytes), maxBytes - pulled); if (voice->src.gstreamer->convertCacheLen < pulled + toCopyBytes) { voice->src.gstreamer->convertCacheLen = pulled + toCopyBytes; voice->src.gstreamer->convertCache = (uint8_t*) voice->audio->pRealloc( voice->src.gstreamer->convertCache, pulled + toCopyBytes ); } FAudio_memcpy(voice->src.gstreamer->convertCache + pulled, info.data + clipStartBytes, toCopyBytes ); gst_buffer_unmap(dst, &info); gst_sample_unref(sample); pulled += toCopyBytes; } LOG_FUNC_EXIT(voice->audio) return pulled; } static int FAudio_GSTREAMER_DecodeBlock(FAudioVoice *voice, FAudioBuffer *buffer, uint32_t block, size_t maxBytes) { FAudioGSTREAMER *gstreamer = voice->src.gstreamer; uint8_t *tmpBuf; size_t tmpLen; if (gstreamer->curBlock != ~0u && block != gstreamer->curBlock + 1) { /* XAudio2 allows looping back to start of XMA buffers, but nothing else */ if (block != 0) { LOG_ERROR( voice->audio, "for voice %p, out of sequence block: %u (cur: %d)\n", voice, block, gstreamer->curBlock ); } FAudio_assert(block == 0); if (!FAudio_GSTREAMER_RestartDecoder(gstreamer)) { LOG_WARNING( voice->audio, "%s", "Restarting decoder failed!" ) } } /* store previous block to allow for minor rewinds (FAudio quirk) */ tmpBuf = gstreamer->prevConvertCache; tmpLen = gstreamer->prevConvertCacheLen; gstreamer->prevConvertCache = gstreamer->convertCache; gstreamer->prevConvertCacheLen = gstreamer->convertCacheLen; gstreamer->convertCache = tmpBuf; gstreamer->convertCacheLen = tmpLen; gstreamer->prevBlock = gstreamer->curBlock; gstreamer->curBlock = block; gstreamer->blockSizes[block] = FAudio_GSTREAMER_FillConvertCache( voice, buffer, maxBytes ); return gstreamer->blockSizes[block] != (size_t) -1; } static void FAudio_INTERNAL_DecodeGSTREAMER( FAudioVoice *voice, FAudioBuffer *buffer, float *decodeCache, uint32_t samples ) { size_t byteOffset, siz, totalSize, maxBytes; uint32_t curBlock, curBufferOffset; uint32_t i; uint8_t *convertCache; int error = 0; FAudioGSTREAMER *gstreamer = voice->src.gstreamer; LOG_FUNC_ENTER(voice->audio) if (!gstreamer->blockSizes) { size_t sz = voice->src.bufferList->bufferWMA.PacketCount * sizeof(*gstreamer->blockSizes); gstreamer->blockSizes = (size_t *) voice->audio->pMalloc(sz); memset(gstreamer->blockSizes, 0xff, sz); } curBufferOffset = voice->src.curBufferOffset; decode: byteOffset = SIZE_FROM_DST(curBufferOffset); /* the last block size can truncate the length of the buffer */ maxBytes = SIZE_SRC_TO_DST(voice->src.bufferList->bufferWMA.pDecodedPacketCumulativeBytes[voice->src.bufferList->bufferWMA.PacketCount - 1]); for (curBlock = 0; curBlock < voice->src.bufferList->bufferWMA.PacketCount; curBlock += 1) { /* decode to get real size */ if (gstreamer->blockSizes[curBlock] == (size_t)-1) { if (!FAudio_GSTREAMER_DecodeBlock(voice, buffer, curBlock, maxBytes)) { error = 1; goto done; } } if (gstreamer->blockSizes[curBlock] > byteOffset) { /* ensure curBlock is decoded in either slot */ if (gstreamer->curBlock != curBlock && gstreamer->prevBlock != curBlock) { if (!FAudio_GSTREAMER_DecodeBlock(voice, buffer, curBlock, maxBytes)) { error = 1; goto done; } } break; } byteOffset -= gstreamer->blockSizes[curBlock]; maxBytes -= gstreamer->blockSizes[curBlock]; if(maxBytes == 0) break; } if (curBlock >= voice->src.bufferList->bufferWMA.PacketCount || maxBytes == 0) { goto done; } /* If we're in a different block from last time, decode! */ if (curBlock == gstreamer->curBlock) { convertCache = gstreamer->convertCache; } else if (curBlock == gstreamer->prevBlock) { convertCache = gstreamer->prevConvertCache; } else { FAudio_assert(0 && "Somehow got an undecoded curBlock!"); } /* Copy to decodeCache, finally. */ siz = FAudio_min(SIZE_FROM_DST(samples), gstreamer->blockSizes[curBlock] - byteOffset); if (convertCache) { FAudio_memcpy( decodeCache, convertCache + byteOffset, siz ); } else { FAudio_memset( decodeCache, 0, siz ); } /* Increment pointer, decrement remaining sample count */ decodeCache += siz / sizeof(float); samples -= SAMPLES_FROM_DST(siz); curBufferOffset += SAMPLES_FROM_DST(siz); done: if (FAudio_GSTREAMER_CheckForBusErrors(voice)) { LOG_ERROR( voice->audio, "%s", "Got a bus error after decoding!" ) error = 1; } /* If the cache isn't filled yet, keep decoding! */ if (samples > 0) { if ( !error && curBlock < voice->src.bufferList->bufferWMA.PacketCount - 1 ) { goto decode; } /* out of stuff to decode, write blank and exit */ FAudio_memset(decodeCache, 0, SIZE_FROM_DST(samples)); } LOG_FUNC_EXIT(voice->audio) } void FAudio_GSTREAMER_end_buffer(FAudioSourceVoice *pSourceVoice) { FAudioGSTREAMER *gstreamer = pSourceVoice->src.gstreamer; LOG_FUNC_ENTER(pSourceVoice->audio) pSourceVoice->audio->pFree(gstreamer->blockSizes); gstreamer->blockSizes = NULL; LOG_FUNC_EXIT(pSourceVoice->audio) } static void FAudio_GSTREAMER_NewDecodebinPad(GstElement *decodebin, GstPad *pad, gpointer user) { FAudioGSTREAMER *gstreamer = user; GstPad *ac_sink; ac_sink = gst_element_get_static_pad(gstreamer->resampler, "sink"); if (GST_PAD_IS_LINKED(ac_sink)) { gst_object_unref(ac_sink); return; } gst_pad_link(pad, ac_sink); gst_object_unref(ac_sink); } uint32_t FAudio_GSTREAMER_init(FAudioSourceVoice *pSourceVoice, uint32_t type) { FAudioGSTREAMER *result; GstElement *decoder = NULL, *converter = NULL; GstCaps *caps; int version; GstBuffer *codec_data; size_t codec_data_size; uint8_t *extradata; uint8_t fakeextradata[16]; GstPad *decoder_sink; GstEvent *event; LOG_FUNC_ENTER(pSourceVoice->audio) /* Init GStreamer statically. The docs tell us not to exit, so I guess * we're supposed to just leak! */ if (!gst_is_initialized()) { /* Apparently they ask for this to leak... */ gst_init(NULL, NULL); } /* Match the format with the codec */ switch (type) { #define GSTTYPE(fmt, ver) \ case FAUDIO_FORMAT_##fmt: version = ver; break; GSTTYPE(WMAUDIO2, 2) GSTTYPE(WMAUDIO3, 3) GSTTYPE(WMAUDIO_LOSSLESS, 4) /* FIXME: XMA2 */ #undef GSTTYPE default: LOG_ERROR( pSourceVoice->audio, "%X codec not supported!", type ) LOG_FUNC_EXIT(pSourceVoice->audio) return FAUDIO_E_UNSUPPORTED_FORMAT; } /* Set up the GStreamer pipeline. * Note that we're not assigning names, since many pipelines will exist * at the same time (one per source voice). */ result = (FAudioGSTREAMER*) pSourceVoice->audio->pMalloc(sizeof(FAudioGSTREAMER)); FAudio_zero(result, sizeof(FAudioGSTREAMER)); result->pipeline = gst_pipeline_new(NULL); decoder = gst_element_factory_make("decodebin", NULL); if (!decoder) { LOG_ERROR( pSourceVoice->audio, "Unable to create gstreamer decodebin; is %u-bit gst-plugins-base installed?", sizeof(void *) * 8 ) goto free_without_bin; } g_signal_connect(decoder, "pad-added", G_CALLBACK(FAudio_GSTREAMER_NewDecodebinPad), result); result->srcpad = gst_pad_new(NULL, GST_PAD_SRC); result->resampler = gst_element_factory_make("audioresample", NULL); if (!result->resampler) { LOG_ERROR( pSourceVoice->audio, "Unable to create gstreamer audioresample; is %u-bit gst-plugins-base installed?", sizeof(void *) * 8 ) goto free_without_bin; } converter = gst_element_factory_make("audioconvert", NULL); if (!converter) { LOG_ERROR( pSourceVoice->audio, "Unable to create gstreamer audioconvert; is %u-bit gst-plugins-base installed?", sizeof(void *) * 8 ) goto free_without_bin; } result->dst = gst_element_factory_make("appsink", NULL); if (!result->dst) { LOG_ERROR( pSourceVoice->audio, "Unable to create gstreamer appsink; is %u-bit gst-plugins-base installed?", sizeof(void *) * 8 ) goto free_without_bin; } /* turn off sync so we can pull data without waiting for it to "play" in realtime */ g_object_set(G_OBJECT(result->dst), "sync", FALSE, "async", TRUE, NULL); /* Compile the pipeline, finally. */ if (!gst_pad_set_active(result->srcpad, TRUE)) { LOG_ERROR( pSourceVoice->audio, "%s", "Unable to activate srcpad" ) goto free_without_bin; } gst_bin_add_many( GST_BIN(result->pipeline), decoder, result->resampler, converter, result->dst, NULL ); decoder_sink = gst_element_get_static_pad(decoder, "sink"); if (gst_pad_link(result->srcpad, decoder_sink) != GST_PAD_LINK_OK) { LOG_ERROR( pSourceVoice->audio, "%s", "Unable to get link our src pad to decoder sink pad" ) gst_object_unref(decoder_sink); goto free_with_bin; } gst_object_unref(decoder_sink); if (!gst_element_link_many( result->resampler, converter, result->dst, NULL)) { LOG_ERROR( pSourceVoice->audio, "%s", "Unable to get link pipeline" ) goto free_with_bin; } /* send stream-start */ event = gst_event_new_stream_start("faudio/gstreamer"); gst_pad_push_event(result->srcpad, event); /* Prepare the input format */ if (type == FAUDIO_FORMAT_WMAUDIO3) { const FAudioWaveFormatExtensible *wfx = (FAudioWaveFormatExtensible*) pSourceVoice->src.format; extradata = (uint8_t*) &wfx->Samples; codec_data_size = pSourceVoice->src.format->cbSize; } else if (type == FAUDIO_FORMAT_WMAUDIO2) { FAudio_zero(fakeextradata, sizeof(fakeextradata)); fakeextradata[4] = 31; extradata = fakeextradata; codec_data_size = sizeof(fakeextradata); } else { FAudio_assert(0 && "Unrecognized WMA format!"); } codec_data = gst_buffer_new_and_alloc(codec_data_size); gst_buffer_fill(codec_data, 0, extradata, codec_data_size); caps = gst_caps_new_simple( "audio/x-wma", "wmaversion", G_TYPE_INT, version, "bitrate", G_TYPE_INT, pSourceVoice->src.format->nAvgBytesPerSec * 8, "channels", G_TYPE_INT, pSourceVoice->src.format->nChannels, "rate", G_TYPE_INT, pSourceVoice->src.format->nSamplesPerSec, "block_align", G_TYPE_INT, pSourceVoice->src.format->nBlockAlign, "depth", G_TYPE_INT, pSourceVoice->src.format->wBitsPerSample, "codec_data", GST_TYPE_BUFFER, codec_data, NULL ); event = gst_event_new_caps(caps); gst_pad_push_event(result->srcpad, event); gst_caps_unref(caps); gst_buffer_unref(codec_data); /* Prepare the output format */ caps = gst_caps_new_simple( "audio/x-raw", "format", G_TYPE_STRING, gst_audio_format_to_string(GST_AUDIO_FORMAT_F32), "layout", G_TYPE_STRING, "interleaved", "channels", G_TYPE_INT, pSourceVoice->src.format->nChannels, "rate", G_TYPE_INT, pSourceVoice->src.format->nSamplesPerSec, NULL ); gst_app_sink_set_caps(GST_APP_SINK(result->dst), caps); gst_caps_unref(caps); gst_segment_init(&result->segment, GST_FORMAT_TIME); if (!FAudio_GSTREAMER_RestartDecoder(result)) { LOG_ERROR( pSourceVoice->audio, "%s", "Starting decoder failed!" ) goto free_with_bin; } pSourceVoice->src.gstreamer = result; pSourceVoice->src.decode = FAudio_INTERNAL_DecodeGSTREAMER; if (FAudio_GSTREAMER_CheckForBusErrors(pSourceVoice)) { LOG_ERROR( pSourceVoice->audio, "%s", "Got a bus error after creation!" ) pSourceVoice->src.gstreamer = NULL; pSourceVoice->src.decode = NULL; goto free_with_bin; } LOG_FUNC_EXIT(pSourceVoice->audio) return 0; free_without_bin: if (result->dst) { gst_object_unref(result->dst); } if (converter) { gst_object_unref(converter); } if (result->resampler) { gst_object_unref(result->resampler); } if (result->srcpad) { gst_object_unref(result->srcpad); } if (decoder) { gst_object_unref(decoder); } if (result->pipeline) { gst_object_unref(result->pipeline); } pSourceVoice->audio->pFree(result); LOG_FUNC_EXIT(pSourceVoice->audio) return FAUDIO_E_UNSUPPORTED_FORMAT; free_with_bin: gst_object_unref(result->srcpad); gst_object_unref(result->pipeline); pSourceVoice->audio->pFree(result); LOG_FUNC_EXIT(pSourceVoice->audio) return FAUDIO_E_UNSUPPORTED_FORMAT; } void FAudio_GSTREAMER_free(FAudioSourceVoice *voice) { LOG_FUNC_ENTER(voice->audio) gst_element_set_state(voice->src.gstreamer->pipeline, GST_STATE_NULL); gst_object_unref(voice->src.gstreamer->pipeline); gst_object_unref(voice->src.gstreamer->srcpad); voice->audio->pFree(voice->src.gstreamer->convertCache); voice->audio->pFree(voice->src.gstreamer->prevConvertCache); voice->audio->pFree(voice->src.gstreamer->blockSizes); voice->audio->pFree(voice->src.gstreamer); voice->src.gstreamer = NULL; LOG_FUNC_EXIT(voice->audio) } #else extern int this_tu_is_empty; #endif /* HAVE_GSTREAMER */ /* vim: set noexpandtab shiftwidth=8 tabstop=8: */