file
stringlengths 18
26
| data
stringlengths 3
1.04M
|
---|---|
the_stack_data/61418.c | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putnbr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: esupatae <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/04/02 00:23:31 by esupatae #+# #+# */
/* Updated: 2019/04/02 21:03:12 by esupatae ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdio.h>
#include <unistd.h>
void ft_putchar(char c);
void ft_putnbr(int nb)
{
if (nb < 0)
{
if (nb == -2147483648)
{
ft_putchar('-');
ft_putchar('2');
nb = 147483648;
}
else
{
nb = -nb;
ft_putchar('-');
}
}
if (nb > 9)
{
ft_putnbr(nb / 10);
ft_putnbr(nb % 10);
}
else
ft_putchar(nb + '0');
}
|
the_stack_data/187643679.c | /* { dg-do compile } */
/* { dg-options "-fdump-tree-gimple" } */
double test1 (double x)
{
return __real __builtin_cexpi (x);
}
double test2 (double x)
{
return __imag __builtin_cexpi (x);
}
/* { dg-final { scan-tree-dump "cos" "gimple" } } */
/* { dg-final { scan-tree-dump "sin" "gimple" } } */
|
the_stack_data/100863.c | /* Copyright (C) 2012-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C 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.
The GNU C 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 the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
extern void foo (void);
int
main (void)
{
foo ();
return 0;
}
|
the_stack_data/211081580.c | #include <stdio.h>
//Compiler version gcc 6.3.0
int main() {
char s[6]; //TestCase#2 has a string with 5 characters
int i;
scanf("%s", s);
if(s[0] == 'a' || s[0] == 'e' || s[0] == 'i' || s[0] == 'o' || s[0] == 'u')
printf("%sway", s);
else {
for(i = 1; i < 6; i++) {
if(s[i] == 0)
break;
printf("%c", s[i]);
}
printf("%cay", s[0]);
}
return 0;
} |
the_stack_data/154831744.c | /*
Author : Amar Prakash Pandey
contact : http://amarpandey.me
*/
#include <string.h>
#include <stdio.h>
#include <math.h>
#define pi 3.14159
#define mod 1000000007
char a[20][20];
int main() {
int r, c, i, j, ans;
int cnt=0, flag=0;
scanf("%d%d",&r,&c);
for(i=0;i<r;i++) {
for(j=0;j<c;j++) {
scanf(" %c",&a[i][j]);
}
}
for(i=0;i<r;i++) {
for(j=0;j<c;j++) {
if(a[i][j] == 'S') {flag=0;break;}
else if(a[i][j] == '.') {
flag++;
}
}
if(flag!=0) {
for(j=0;j<c;j++) {
a[i][j] = 'q';
}
}
cnt += flag;
flag=0;
}
for(i=0;i<c;i++) {
for(j=0;j<r;j++) {
if(a[j][i] == 'S') {flag=0;break;}
else if(a[j][i] == '.') {
flag++;
a[j][i] = 'q';
}
}
cnt += flag;
flag=0;
}
printf("%d\n",cnt);
return 0;
}
|
the_stack_data/168894518.c | /*
* Generated with test/generate_buildtest.pl, to check that such a simple
* program builds.
*/
#include <openssl/opensslconf.h>
#ifndef OPENSSL_NO_STDIO
# include <stdio.h>
#endif
#ifndef OPENSSL_NO_EVP
# include <openssl/evp.h>
#endif
int main(void)
{
return 0;
}
|
the_stack_data/1117278.c | #include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
int main() {
int i;
int off;
FILE *f;
f = fopen("bitfield.struct.inc", "w");
for (off = 0; off < 8; off++) {
for (i=1; i<=64; i++) {
int nbits;
/*
Packed bit-fields of type char were not properly bit-packed on many targets prior to GCC 4.4
*/
// if (i <= 8) nbits = 8;
if (i <= 16) nbits = 16;
else if (i <= 32) nbits = 32;
else nbits = 64;
fprintf(f, "struct off%di%d { long : %d; int%d_t data : %d; } __attribute__ ((packed));\n", off, i, off, nbits, i);
fprintf(f, "struct off%du%d { long : %d; uint%d_t data : %d; } __attribute__ ((packed));\n", off, i, off, nbits, i);
}
}
fclose(f);
int is_signed;
f = fopen("bitfield.function.get.inc", "w");
for (i=1; i<=64; i++) {
for (off = 0; off < 8; off++) {
for (is_signed = 0; is_signed < 2; is_signed++) {
fprintf(f, "case %d: return ((struct off%d%c%d *) data)->data;\n", i * 16 + off * 2 + is_signed, off, is_signed ? 'i' : 'u', i);
}
}
}
f = fopen("bitfield.function.set.inc", "w");
for (i=1; i<=64; i++) {
for (off = 0; off < 8; off++) {
for (is_signed = 0; is_signed < 2; is_signed++) {
fprintf(f, "case %d: { int64_t ov = ((struct off%d%c%d *) data)->data; ((struct off%d%c%d *) data)->data = value; return ov; }\n", i * 16 + off * 2 + is_signed, off, is_signed ? 'i' : 'u', i, off, is_signed ? 'i' : 'u', i);
}
}
}
fclose(f);
}
|
the_stack_data/126702433.c | /*
Name - Nikhil Ranjan Nayak
Regd no - 1641012040
Desc - Display chemical emissions
*/
#include "stdio.h"
void determine_message(int, double, int);
void main()
{
int pollutant, odometer_reading;
double grams_emitted;
printf("\n(1) Carbon monoxide");
printf("\n(2) Hydrocarbons");
printf("\n(3) Nitrogen oxides");
printf("\n(4) Nonmethane hydrocarbons");
printf("\nEnter pollutant number>>");
scanf("%d", &pollutant);
if((pollutant < 1) || (pollutant > 4))
printf("\nWrong Selection");
else
{
printf("\nEnter number of grams emitted per mile>>");
scanf("%lf", &grams_emitted);
printf("\nEnter odometer reading>>");
scanf("%d", &odometer_reading);
determine_message(pollutant, grams_emitted, odometer_reading);
}
}
void determine_message(int pollutant, double grams_emitted, int odometer_reading)
{
if(pollutant == 1)
{
if(odometer_reading <= 50000)
{
if(grams_emitted > 3.4)
printf("\nEmissions exceed permitted level of 3.4 grams/mile.\n");
else
printf("\nEmissions do not the exceed permitted level.\n");
}
else if(odometer_reading > 50000)
{
if(grams_emitted > 4.2)
printf("\nEmissions exceed permitted level of 4.2 grams/mile.\n");
else
printf("\nEmissions do not the exceed permitted level.\n");
}
}
else if(pollutant == 2)
{
if(odometer_reading <= 50000)
{
if(grams_emitted > 0.31)
printf("\nEmissions exceed permitted level of 0.31 grams/mile.\n");
else
printf("\nEmissions do not the exceed permitted level.\n");
}
else if(odometer_reading > 50000)
{
if(grams_emitted > 0.39)
printf("\nEmissions exceed permitted level of 0.39 grams/mile.\n");
else
printf("\nEmissions do not the exceed permitted level.\n");
}
}
else if(pollutant == 3)
{
if(odometer_reading <= 50000)
{
if(grams_emitted > 0.4)
printf("\nEmissions exceed permitted level of 0.4 grams/mile.\n");
else
printf("\nEmissions do not the exceed permitted level.\n");
}
else if(odometer_reading > 50000)
{
if(grams_emitted > 0.5)
printf("\nEmissions exceed permitted level of 0.5 grams/mile.\n");
else
printf("\nEmissions do not the exceed permitted level.\n");
}
}
else if(pollutant == 4)
{
if(odometer_reading <= 50000)
{
if(grams_emitted > 0.25)
printf("\nEmissions exceed permitted level of 0.25 grams/mile.\n");
else
printf("\nEmissions do not the exceed permitted level.\n");
}
else if(odometer_reading > 50000)
{
if(grams_emitted > 0.31)
printf("\nEmissions exceed permitted level of 0.31 grams/mile.\n");
else
printf("\nEmissions do not the exceed permitted level.\n");
}
}
} |
the_stack_data/60790.c | #include <stdio.h>
int main()
{
int i, j, rows;
/* Input number of rows from user */
printf("Enter rows: ");
scanf("%d", &rows);
for(i=1; i<=rows; i++)
{
for(j=1; j<=rows - i; j++)
{
printf(" ");
}
for(j=1; j<=rows; j++)
{
printf("*");
}
printf("\n");
}
return 0;
} |
the_stack_data/93887798.c | #include <stdio.h>
#include <stdlib.h>
int main (void) {
int ch;
while ((ch = getchar()) != EOF) {
if (ch >= 65 && ch <= 90) {
ch = ch + 32;
}
putchar(ch);
}
EXIT_SUCCESS;
}
|
the_stack_data/211080608.c | // RUN: rm -rf %t && mkdir %t
// RUN: not %clang_cc1 %s -triple blah-unknown-unknown -serialize-diagnostic-file %t/diag -o /dev/null 2>&1 | FileCheck %s
// CHECK: error: unknown target triple 'blah-unknown-unknown', please use -triple or -arch
|
the_stack_data/140571.c | #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;
#ifdef _MSC_VER
static inline _Fcomplex Cf(complex *z) {_Fcomplex zz={z->r , z->i}; return zz;}
static inline _Dcomplex Cd(doublecomplex *z) {_Dcomplex zz={z->r , z->i};return zz;}
static inline _Fcomplex * _pCf(complex *z) {return (_Fcomplex*)z;}
static inline _Dcomplex * _pCd(doublecomplex *z) {return (_Dcomplex*)z;}
#else
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;}
#endif
#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)); }
#ifdef _MSC_VER
#define c_div(c, a, b) {Cf(c)._Val[0] = (Cf(a)._Val[0]/Cf(b)._Val[0]); Cf(c)._Val[1]=(Cf(a)._Val[1]/Cf(b)._Val[1]);}
#define z_div(c, a, b) {Cd(c)._Val[0] = (Cd(a)._Val[0]/Cd(b)._Val[0]); Cd(c)._Val[1]=(Cd(a)._Val[1]/df(b)._Val[1]);}
#else
#define c_div(c, a, b) {pCf(c) = Cf(a)/Cf(b);}
#define z_div(c, a, b) {pCd(c) = Cd(a)/Cd(b);}
#endif
#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) = conjf(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) (cimagf(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;
}
#ifdef _MSC_VER
static _Fcomplex cpow_ui(complex x, integer n) {
complex pow={1.0,0.0}; unsigned long int u;
if(n != 0) {
if(n < 0) n = -n, x.r = 1/x.r, x.i=1/x.i;
for(u = n; ; ) {
if(u & 01) pow.r *= x.r, pow.i *= x.i;
if(u >>= 1) x.r *= x.r, x.i *= x.i;
else break;
}
}
_Fcomplex p={pow.r, pow.i};
return p;
}
#else
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;
}
#endif
#ifdef _MSC_VER
static _Dcomplex zpow_ui(_Dcomplex x, integer n) {
_Dcomplex pow={1.0,0.0}; unsigned long int u;
if(n != 0) {
if(n < 0) n = -n, x._Val[0] = 1/x._Val[0], x._Val[1] =1/x._Val[1];
for(u = n; ; ) {
if(u & 01) pow._Val[0] *= x._Val[0], pow._Val[1] *= x._Val[1];
if(u >>= 1) x._Val[0] *= x._Val[0], x._Val[1] *= x._Val[1];
else break;
}
}
_Dcomplex p = {pow._Val[0], pow._Val[1]};
return p;
}
#else
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;
}
#endif
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;
#ifdef _MSC_VER
_Fcomplex zdotc = {0.0, 0.0};
if (incx == 1 && incy == 1) {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc._Val[0] += conjf(Cf(&x[i]))._Val[0] * Cf(&y[i])._Val[0];
zdotc._Val[1] += conjf(Cf(&x[i]))._Val[1] * Cf(&y[i])._Val[1];
}
} else {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc._Val[0] += conjf(Cf(&x[i*incx]))._Val[0] * Cf(&y[i*incy])._Val[0];
zdotc._Val[1] += conjf(Cf(&x[i*incx]))._Val[1] * Cf(&y[i*incy])._Val[1];
}
}
pCf(z) = zdotc;
}
#else
_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;
}
#endif
static inline void zdotc_(doublecomplex *z, integer *n_, doublecomplex *x, integer *incx_, doublecomplex *y, integer *incy_) {
integer n = *n_, incx = *incx_, incy = *incy_, i;
#ifdef _MSC_VER
_Dcomplex zdotc = {0.0, 0.0};
if (incx == 1 && incy == 1) {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc._Val[0] += conj(Cd(&x[i]))._Val[0] * Cd(&y[i])._Val[0];
zdotc._Val[1] += conj(Cd(&x[i]))._Val[1] * Cd(&y[i])._Val[1];
}
} else {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc._Val[0] += conj(Cd(&x[i*incx]))._Val[0] * Cd(&y[i*incy])._Val[0];
zdotc._Val[1] += conj(Cd(&x[i*incx]))._Val[1] * Cd(&y[i*incy])._Val[1];
}
}
pCd(z) = zdotc;
}
#else
_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;
}
#endif
static inline void cdotu_(complex *z, integer *n_, complex *x, integer *incx_, complex *y, integer *incy_) {
integer n = *n_, incx = *incx_, incy = *incy_, i;
#ifdef _MSC_VER
_Fcomplex zdotc = {0.0, 0.0};
if (incx == 1 && incy == 1) {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc._Val[0] += Cf(&x[i])._Val[0] * Cf(&y[i])._Val[0];
zdotc._Val[1] += Cf(&x[i])._Val[1] * Cf(&y[i])._Val[1];
}
} else {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc._Val[0] += Cf(&x[i*incx])._Val[0] * Cf(&y[i*incy])._Val[0];
zdotc._Val[1] += Cf(&x[i*incx])._Val[1] * Cf(&y[i*incy])._Val[1];
}
}
pCf(z) = zdotc;
}
#else
_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;
}
#endif
static inline void zdotu_(doublecomplex *z, integer *n_, doublecomplex *x, integer *incx_, doublecomplex *y, integer *incy_) {
integer n = *n_, incx = *incx_, incy = *incy_, i;
#ifdef _MSC_VER
_Dcomplex zdotc = {0.0, 0.0};
if (incx == 1 && incy == 1) {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc._Val[0] += Cd(&x[i])._Val[0] * Cd(&y[i])._Val[0];
zdotc._Val[1] += Cd(&x[i])._Val[1] * Cd(&y[i])._Val[1];
}
} else {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc._Val[0] += Cd(&x[i*incx])._Val[0] * Cd(&y[i*incy])._Val[0];
zdotc._Val[1] += Cd(&x[i*incx])._Val[1] * Cd(&y[i*incy])._Val[1];
}
}
pCd(z) = zdotc;
}
#else
_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 DLA_GERPVGRW */
/* =========== DOCUMENTATION =========== */
/* Online html documentation available at */
/* http://www.netlib.org/lapack/explore-html/ */
/* > \htmlonly */
/* > Download DLA_GERPVGRW + dependencies */
/* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dla_ger
pvgrw.f"> */
/* > [TGZ]</a> */
/* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dla_ger
pvgrw.f"> */
/* > [ZIP]</a> */
/* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dla_ger
pvgrw.f"> */
/* > [TXT]</a> */
/* > \endhtmlonly */
/* Definition: */
/* =========== */
/* DOUBLE PRECISION FUNCTION DLA_GERPVGRW( N, NCOLS, A, LDA, AF, */
/* LDAF ) */
/* INTEGER N, NCOLS, LDA, LDAF */
/* DOUBLE PRECISION A( LDA, * ), AF( LDAF, * ) */
/* > \par Purpose: */
/* ============= */
/* > */
/* > \verbatim */
/* > */
/* > */
/* > DLA_GERPVGRW computes the reciprocal pivot growth factor */
/* > norm(A)/norm(U). The "f2cmax absolute element" norm is used. If this is */
/* > much less than 1, the stability of the LU factorization of the */
/* > (equilibrated) matrix A could be poor. This also means that the */
/* > solution X, estimated condition numbers, and error bounds could be */
/* > unreliable. */
/* > \endverbatim */
/* Arguments: */
/* ========== */
/* > \param[in] N */
/* > \verbatim */
/* > N is INTEGER */
/* > The number of linear equations, i.e., the order of the */
/* > matrix A. N >= 0. */
/* > \endverbatim */
/* > */
/* > \param[in] NCOLS */
/* > \verbatim */
/* > NCOLS is INTEGER */
/* > The number of columns of the matrix A. NCOLS >= 0. */
/* > \endverbatim */
/* > */
/* > \param[in] A */
/* > \verbatim */
/* > A is DOUBLE PRECISION array, dimension (LDA,N) */
/* > On entry, the N-by-N matrix A. */
/* > \endverbatim */
/* > */
/* > \param[in] LDA */
/* > \verbatim */
/* > LDA is INTEGER */
/* > The leading dimension of the array A. LDA >= f2cmax(1,N). */
/* > \endverbatim */
/* > */
/* > \param[in] AF */
/* > \verbatim */
/* > AF is DOUBLE PRECISION array, dimension (LDAF,N) */
/* > The factors L and U from the factorization */
/* > A = P*L*U as computed by DGETRF. */
/* > \endverbatim */
/* > */
/* > \param[in] LDAF */
/* > \verbatim */
/* > LDAF is INTEGER */
/* > The leading dimension of the array AF. LDAF >= f2cmax(1,N). */
/* > \endverbatim */
/* Authors: */
/* ======== */
/* > \author Univ. of Tennessee */
/* > \author Univ. of California Berkeley */
/* > \author Univ. of Colorado Denver */
/* > \author NAG Ltd. */
/* > \date December 2016 */
/* > \ingroup doubleGEcomputational */
/* ===================================================================== */
doublereal dla_gerpvgrw_(integer *n, integer *ncols, doublereal *a, integer *
lda, doublereal *af, integer *ldaf)
{
/* System generated locals */
integer a_dim1, a_offset, af_dim1, af_offset, i__1, i__2;
doublereal ret_val, d__1, d__2;
/* Local variables */
doublereal amax, umax;
integer i__, j;
doublereal rpvgrw;
/* -- 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 */
/* ===================================================================== */
/* Parameter adjustments */
a_dim1 = *lda;
a_offset = 1 + a_dim1 * 1;
a -= a_offset;
af_dim1 = *ldaf;
af_offset = 1 + af_dim1 * 1;
af -= af_offset;
/* Function Body */
rpvgrw = 1.;
i__1 = *ncols;
for (j = 1; j <= i__1; ++j) {
amax = 0.;
umax = 0.;
i__2 = *n;
for (i__ = 1; i__ <= i__2; ++i__) {
/* Computing MAX */
d__2 = (d__1 = a[i__ + j * a_dim1], abs(d__1));
amax = f2cmax(d__2,amax);
}
i__2 = j;
for (i__ = 1; i__ <= i__2; ++i__) {
/* Computing MAX */
d__2 = (d__1 = af[i__ + j * af_dim1], abs(d__1));
umax = f2cmax(d__2,umax);
}
if (umax != 0.) {
/* Computing MIN */
d__1 = amax / umax;
rpvgrw = f2cmin(d__1,rpvgrw);
}
}
ret_val = rpvgrw;
return ret_val;
} /* dla_gerpvgrw__ */
|
the_stack_data/22013380.c | #include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#define GETMASK(index, size) (((1 << (size)) - 1) << (index))
#define READFROM(data, index, size) (((data)&GETMASK((index), (size))) >> (index))
//struct decodeResults{
// int32_t selA,selB,selD,dataImm,
//};
struct aluResults
{
int32_t aluOut;
bool memWrite, branch;
};
struct instDecodeResults
{
uint32_t selA, selB, selD, funct7, funct3, aluop;
int32_t dataIMM;
bool branch, aluImm, jumpReg, memWren, memToReg, regDwe;
};
int aluDecode(int32_t opcode, int32_t funct3, int32_t funct7)
{
int aluOpcode;
switch (opcode)
{
case 51:
switch (funct7)
{
case 0:
switch (funct3)
{
case 0:
aluOpcode = 0;
break;
case 7:
aluOpcode = 2;
break;
case 6:
aluOpcode = 3;
break;
case 4:
aluOpcode = 4;
break;
case 2:
aluOpcode = 5;
break;
case 3:
aluOpcode = 6;
break;
case 5:
aluOpcode = 9;
break;
case 1:
aluOpcode = 11;
break;
default:
aluOpcode = 31;
break;
}
break;
case 32:
switch (funct3)
{
case 0:
aluOpcode = 1;
break;
case 5:
aluOpcode = 7;
break;
default:
aluOpcode = 31;
break;
}
break;
case 1:
aluOpcode = 13;
break;
default:
aluOpcode = 31;
break;
}
break;
case 19:
switch (funct3)
{
case 0:
aluOpcode = 0;
break;
case 7:
aluOpcode = 2;
break;
case 6:
aluOpcode = 3;
break;
case 4:
aluOpcode = 4;
break;
case 2:
aluOpcode = 5;
break;
case 3:
aluOpcode = 6;
break;
case 1:
aluOpcode = 12;
break;
case 5:
switch (funct7)
{
case 32:
aluOpcode = 8;
break;
case 0:
aluOpcode = 10;
break;
default:
aluOpcode = 31;
break;
}
break;
default:
aluOpcode = 31;
break;
}
break;
case 55:
aluOpcode = 14;
break;
case 23:
aluOpcode = 15;
break;
case 3:
aluOpcode = 16;
break;
case 35:
aluOpcode = 17;
break;
case 111:
aluOpcode = 18;
break;
case 103:
aluOpcode = 19;
break;
case 99:
switch (funct3)
{
case 0:
aluOpcode = 20;
break;
case 1:
aluOpcode = 21;
break;
case 4:
aluOpcode = 23;
break;
case 5:
aluOpcode = 24;
break;
case 6:
aluOpcode = 25;
break;
case 7:
aluOpcode = 26;
break;
default:
aluOpcode = 31;
break;
}
break;
default:
aluOpcode = 31;
break;
}
return aluOpcode;
}
struct instDecodeResults instDecode(int32_t dataInst)
{
struct instDecodeResults results;
results.selA = READFROM(dataInst, 15, 5);
results.selB = READFROM(dataInst, 20, 5);
results.selD = READFROM(dataInst, 7, 5);
results.funct7 = READFROM(dataInst, 25, 7);
results.funct3 = READFROM(dataInst, 12, 3);
results.aluop = READFROM(dataInst, 0, 7);
switch (results.aluop)
{
case 99:
if (READFROM(dataInst, 31, 1) == -1)
{
results.dataIMM = (0xFFFFF000 | (READFROM(dataInst, 7, 1) << 12) | (READFROM(dataInst, 25, 6) << 5) | (READFROM(dataInst, 8, 4) << 1) | 0);
}
else
{
results.dataIMM = ((READFROM(dataInst, 31, 1) << 31) | (READFROM(dataInst, 7, 1) << 12) | (READFROM(dataInst, 25, 6) << 5) | (READFROM(dataInst, 8, 4) << 1) | 0);
}
break;
case 111:
if (READFROM(dataInst, 31, 1) == -1)
{
results.dataIMM = (0xFFF00000 | (READFROM(dataInst, 12, 8) << 12) | (READFROM(dataInst, 20, 1) << 11) | (READFROM(dataInst, 25, 6) << 5) | (READFROM(dataInst, 21, 4) << 1) | 0);
}
else
{
results.dataIMM = ((READFROM(dataInst, 31, 1) << 31) | (READFROM(dataInst, 12, 8) << 12) | (READFROM(dataInst, 20, 1) << 11) | (READFROM(dataInst, 25, 6) << 5) | (READFROM(dataInst, 21, 4) << 1) | 0);
}
break;
case 35:
if (READFROM(dataInst, 31, 1) == -1)
{
results.dataIMM = (0xFFFFF800 | (READFROM(dataInst, 25, 6) << 6) | (READFROM(dataInst, 8, 4) << 1) | READFROM(dataInst, 7, 1));
}
else
{
results.dataIMM = ((READFROM(dataInst, 31, 1) << 31) | (READFROM(dataInst, 25, 6) << 6) | (READFROM(dataInst, 8, 4) << 1) | READFROM(dataInst, 7, 1));
}
break;
case 55:
case 23:
results.dataIMM = (READFROM(dataInst, 12, 20) << 12);
break;
default:
if (READFROM(dataInst, 31, 1) == -1)
{
results.dataIMM = (0xFFFFF800 | READFROM(dataInst, 20, 11));
}
else
{
results.dataIMM = (0x00000000 | READFROM(dataInst, 20, 11));
}
break;
}
switch (results.aluop)
{
case 99:
case 111:
results.branch = true;
results.jumpReg = false;
break;
case 103:
results.branch = false;
results.jumpReg = true;
break;
default:
results.branch = false;
results.jumpReg = false;
break;
}
switch (results.aluop)
{
case 19:
case 55:
case 23:
case 3:
case 35:
results.aluImm = true;
break;
default:
results.aluImm = false;
break;
}
switch (results.aluop)
{
case 35:
results.memWren = true;
results.memToReg = false;
break;
case 3:
results.memWren = false;
results.memToReg = true;
break;
default:
results.memWren = false;
results.memToReg = false;
break;
}
switch (results.aluop)
{
case 99:
case 35:
results.regDwe = false;
break;
default:
results.regDwe = true;
break;
}
return results;
}
//Binary to Decimal converter
/*int BTD(int binary_val){
int decimal_val = 0, base = 1, rem;
while (num > 0)
{
rem = num % 10;
decimal_val = decimal_val + rem * base;
num = num / 10 ;
base = base * 2;
}
return decimal_val;
}*/
struct aluResults alu(int32_t A, int32_t B, int OP, int imm, int32_t pc)
{
struct aluResults results;
int temp;
switch (OP)
{
case 0:
results.aluOut = A + B;
results.branch = false;
results.memWrite = false;
break;
case 1:
results.aluOut = A - B;
results.branch = false;
results.memWrite = false;
break;
case 2:
results.aluOut = A & B;
results.branch = false;
results.memWrite = false;
break;
case 3:
results.aluOut = A | B;
results.branch = false;
results.memWrite = false;
break;
case 4:
results.aluOut = A ^ B;
results.branch = false;
results.memWrite = false;
break;
case 5:
if (A < B)
{
results.aluOut = 1;
}
else
results.aluOut = 0;
results.branch = false;
results.memWrite = false;
break;
case 6:
if ((uint32_t)A < (uint32_t)B)
{
results.aluOut = 1;
}
else
results.aluOut = 0;
results.branch = false;
results.memWrite = false;
break;
case 7:
temp = READFROM(B, 0, 5);
results.aluOut = A >> B;
results.branch = false;
results.memWrite = false;
break;
case 8:
results.aluOut = A >> (uint32_t)imm;
results.branch = false;
results.memWrite = false;
break;
case 9:
temp = READFROM(B, 0, 5);
results.aluOut = (uint32_t)A >> B;
results.branch = false;
results.memWrite = false;
break;
case 10:
results.aluOut = (uint32_t)A >> (uint32_t)imm;
results.branch = false;
results.memWrite = false;
break;
case 11:
temp = READFROM(B, 0, 5);
results.aluOut = (uint32_t)A << B;
results.branch = false;
results.memWrite = false;
break;
case 12:
results.aluOut = (uint32_t)A << (uint32_t)imm;
results.branch = false;
results.memWrite = false;
break;
case 13:
results.aluOut = A * B;
results.branch = false;
results.memWrite = false;
break;
case 14:
results.aluOut = B;
results.branch = false;
results.memWrite = false;
break;
case 15:
results.aluOut = pc + B;
results.branch = false;
results.memWrite = false;
break;
case 16:
case 17:
results.aluOut = A + B;
results.branch = false;
results.memWrite = true;
break;
case 18:
case 19:
results.aluOut = pc + 4;
results.branch = true;
results.memWrite = false;
break;
case 20:
results.memWrite = false;
if (A == B)
results.branch = true;
else
results.branch = false;
results.aluOut = 0;
break;
case 21:
results.memWrite = false;
if (A != B)
results.branch = true;
else
results.branch = false;
results.aluOut = 0;
break;
case 23:
results.memWrite = false;
if (A < B)
results.branch = true;
else
results.branch = false;
results.aluOut = 0;
break;
case 24:
results.memWrite = false;
if (A >= B)
results.branch = true;
else
results.branch = false;
results.aluOut = 0;
break;
case 25:
results.memWrite = false;
if ((uint32_t)A < (uint32_t)B)
results.branch = true;
else
results.branch = false;
results.aluOut = 0;
break;
case 26:
results.memWrite = false;
if ((uint32_t)A >= (uint32_t)B)
results.branch = true;
else
results.branch = false;
results.aluOut = 0;
break;
default:
results.aluOut = 0;
results.branch = false;
results.memWrite = false;
break;
}
return results;
}
int32_t addressCalculator(int32_t dataImm, bool branchAlu, bool branchControl, bool jumpReg, int32_t dataA, int32_t pc)
{
int32_t newPc;
if (branchAlu == true)
{
if (branchControl == true)
{
newPc = pc + dataImm;
}
else if (jumpReg == true)
{
newPc = ((dataA + dataImm) & 0xfffffffe);
}
else
{
newPc = pc + 4;
}
}
else
{
newPc = pc + 4;
}
return newPc;
}
int main()
{
int32_t registers[32] = {0};
int32_t instMemory[1024] = {[0] = 0x20000113, [4] = 0x00400513, [8] = 0x008000ef, [12] = 0x0400006f, [16] = 0xff810113, [20] = 0x00112223, [24] = 0x00a12023, [28] = 0x00100293,
[32] = 0x00555463, [36] = 0x0180006f, [40] = 0xfff50513, [44] = 0xfe5ff0ef, [48] = 0x00012583, [52] = 0x02b50533, [56] = 0x0080006f, [60] = 0x00100513, [64] = 0x00412083, [68] = 0x00810113,
[72] = 0x00008067, [76] = 0x00a00b33};
int32_t memory[8192];
int32_t currInst = 0;
int32_t nextInst = 0;
int aluOpcode;
struct aluResults aluResult;
struct instDecodeResults instDecodeResult;
int32_t aluA, aluB;
while (instMemory[currInst] != 0 && currInst < 1024)
{
registers[0] = 0;
currInst = nextInst;
instDecodeResult = instDecode(instMemory[currInst]);
aluOpcode = aluDecode(instDecodeResult.aluop, instDecodeResult.funct3, instDecodeResult.funct7);
aluA = registers[instDecodeResult.selA];
if (instDecodeResult.aluImm == true)
{
aluB = instDecodeResult.dataIMM;
}
else
{
aluB = registers[instDecodeResult.selB];
}
aluResult = alu(aluA, aluB, aluOpcode, instDecodeResult.selB, currInst);
if (aluResult.memWrite == true && instDecodeResult.memWren == true )
{
memory[aluResult.aluOut] = registers[instDecodeResult.selB];
}
if (instDecodeResult.memToReg == true)
{
registers[instDecodeResult.selD] = memory[aluResult.aluOut];
}
else if(instDecodeResult.regDwe == true)
{
registers[instDecodeResult.selD] = aluResult.aluOut;
}
nextInst = addressCalculator(instDecodeResult.dataIMM, aluResult.branch, instDecodeResult.branch, instDecodeResult.jumpReg, aluA, currInst);
}
printf("%d\n", registers[22]);
}
|
the_stack_data/11076145.c | /* origin: FreeBSD /usr/src/lib/msun/src/s_fmaf.c */
/*-
* Copyright (c) 2005-2011 David Schultz <[email protected]>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <fenv.h>
#include <math.h>
#include <stdint.h>
/*
* Fused multiply-add: Compute x * y + z with a single rounding error.
*
* A double has more than twice as much precision than a float, so
* direct double-precision arithmetic suffices, except where double
* rounding occurs.
*/
float fmaf(float x, float y, float z)
{
double xy, result;
union
{
double f;
uint64_t i;
} u;
int e;
xy = (double)x * y;
result = xy + z;
u.f = result;
e = u.i >> 52 & 0x7ff;
/* Common case: The double precision result is fine. */
if ((u.i & 0x1fffffff) != 0x10000000 || /* not a halfway case */
e == 0x7ff || /* NaN */
result - xy == z || /* exact */
fegetround() != FE_TONEAREST) /* not round-to-nearest */
{
/*
underflow may not be raised correctly, example:
fmaf(0x1p-120f, 0x1p-120f, 0x1p-149f)
*/
#if defined(FE_INEXACT) && defined(FE_UNDERFLOW)
if (e < 0x3ff - 126 && e >= 0x3ff - 149 && fetestexcept(FE_INEXACT))
{
feclearexcept(FE_INEXACT);
/* TODO: gcc and clang bug workaround */
volatile float vz = z;
result = xy + vz;
if (fetestexcept(FE_INEXACT))
feraiseexcept(FE_UNDERFLOW);
else
feraiseexcept(FE_INEXACT);
}
#endif
z = result;
return z;
}
/*
* If result is inexact, and exactly halfway between two float values,
* we need to adjust the low-order bit in the direction of the error.
*/
#ifdef FE_TOWARDZERO
fesetround(FE_TOWARDZERO);
#endif
volatile double vxy = xy; /* XXX work around gcc CSE bug */
double adjusted_result = vxy + z;
fesetround(FE_TONEAREST);
if (result == adjusted_result)
{
u.f = adjusted_result;
u.i++;
adjusted_result = u.f;
}
z = adjusted_result;
return z;
}
|
the_stack_data/49348.c | #include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int j,n;
char * str=0;
if(argc == 1 ) return 1;
l0:for(j=0;j<1;j++)
{
n=atoi(argv[1]);
if( (str=malloc(n*sizeof(char))) )
{
int i;
for(i=0;i<(n-1);i++)
str[i]=('a'+(char)i);
str[n-1]=0;
}
}
if(str)
printf("%s\n",str);
return 0;
}
|
the_stack_data/854625.c | #include <sys/types.h>
#include <regex.h>
#include <string.h>
#include <stdlib.h>
void C_regalloc(regex_t **preg_return) {
*preg_return = malloc(sizeof(**preg_return));
}
/* pattern must be NUL terminated. */
void C_regcomp(regex_t *preg, const char *pattern,
const char *flags, int *status_return) {
int i, cflags=0;
for (i=0;flags[i];i++) {
switch (flags[i]) {
case 'i': cflags |= REG_ICASE; break;
case 'm': cflags |= REG_NEWLINE; break;
case 'x': cflags |= REG_EXTENDED; break;
case 'n': cflags |= REG_NOSUB; break;
case ' ': break;
default: *status_return=-2; return;
}
}
*status_return = regcomp(preg,pattern,cflags);
}
void C_regexec(const regex_t *preg, const char *string, int nmatch,
int matches[nmatch][2], const char *flags,
int *status_return) {
int i, eflags=0;
regmatch_t *pmatch;
for (i=0;flags[i];i++) {
switch (flags[i]) {
case 'b': eflags |= REG_NOTBOL; break;
case 'e': eflags |= REG_NOTEOL; break;
case ' ': break;
default: *status_return=-2; return;
}
}
if (nmatch>0 && sizeof(pmatch->rm_so)!=sizeof(matches[0][0])) {
pmatch = malloc(sizeof(regmatch_t)*nmatch);
*status_return = regexec(preg,string,nmatch,pmatch,eflags);
for (i=0;i<nmatch;i++) {
matches[i][0]=pmatch[i].rm_so;
matches[i][1]=pmatch[i].rm_eo;
}
free(pmatch);
} else {
*status_return = regexec(preg,string,nmatch,(regmatch_t*)&(matches[0][0]),eflags);
}
}
|
the_stack_data/22012008.c | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
/*#include <cilk/cilk.h>*/
/*#include <cilk/cilk_api.h>*/
#define LOOP_SIZE 1000000
#define TIME
#define N 100
double timespec_to_ms(struct timespec *ts)
{
return ts->tv_sec*1000.0 + ts->tv_nsec/1000000.0;
}
int saxpy (int n, int a, int x[], int y[]) {
for (int i = 0; i < n; i++) {
y[i] = a * x[i] + y[i];
}
return 1;
}
int main (int argc, char *argv[]) {
int n = N;
int a = 5;
int x[N];
int y[N];
for (int i=0;i<N;i++){
x[i] = rand() % 10;
y[i] = rand() % 10;
}
// If we've got a parameter, assume it's the number of workers to be used
if (argc > 1)
{
// Values less than 1, or parameters that aren't numbers aren't allowed
if (atoi(argv[1]) < 1)
{
printf("Usage: fib [workers]\n");
return 1;
}
// Set the number of workers to be used
#ifdef TIME
/*__cilkrts_set_param("nworkers", argv[1]);*/
#endif
}
// Time how long it takes to calculate the nth Fibonacci number
#ifdef TIME
struct timespec start_time, end_time;
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &start_time);
#endif
for (int i=0;i<LOOP_SIZE;i++) {
saxpy(n, a, x, y);
}
#ifdef TIME
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &end_time);
double time_ms = timespec_to_ms(&end_time) - timespec_to_ms(&start_time);
float time_ns = time_ms / LOOP_SIZE * 1000000;
/*printf("Calculated in %.3f ns using %d workers.\n",*/
/*time_ns, __cilkrts_get_nworkers());*/
#endif
// for (int i=0;i<n;i++) {
// printf("%d\n", y[i]);
// }
return 0;
}
|
the_stack_data/520493.c | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_isalnum.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: roaraujo <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/06 10:53:59 by roaraujo #+# #+# */
/* Updated: 2021/10/06 10:54:01 by roaraujo ### ########.fr */
/* */
/* ************************************************************************** */
int ft_isalnum(int c)
{
if (c >= '0' && c <= '9')
return (4);
else if ((c >= 'A' && c <= 'Z'))
return (1);
else if ((c >= 'a' && c <= 'z'))
return (2);
else
return (0);
}
|
the_stack_data/247017971.c | // RUN: %clang_cc1 -fno-experimental-new-pass-manager -emit-llvm -o - -triple x86_64-apple-darwin10 %s | FileCheck %s
// RUN: %clang_cc1 -fno-experimental-new-pass-manager -O2 -fno-inline -emit-llvm -o - -triple x86_64-apple-darwin10 %s | FileCheck %s
// RUN: %clang_cc1 -fno-experimental-new-pass-manager -flto -O2 -fno-inline -emit-llvm -o - -triple x86_64-apple-darwin10 %s | FileCheck %s -check-prefix=LTO
// RUN: %clang_cc1 -fexperimental-new-pass-manager -emit-llvm -o - -triple x86_64-apple-darwin10 %s | FileCheck %s
// RUN: %clang_cc1 -fexperimental-new-pass-manager -O2 -fno-inline -emit-llvm -o - -triple x86_64-apple-darwin10 %s | FileCheck %s
// RUN: %clang_cc1 -fexperimental-new-pass-manager -flto -O2 -fno-inline -emit-llvm -o - -triple x86_64-apple-darwin10 %s | FileCheck %s -check-prefix=LTO
// Ensure that we don't emit available_externally functions at -O0.
// Also should not emit them at -O2, unless -flto is present in which case
// we should preserve them for link-time inlining decisions.
int x;
inline void f0(int y) { x = y; }
// CHECK-LABEL: define{{.*}} void @test()
// CHECK: declare void @f0(i32)
// LTO-LABEL: define{{.*}} void @test()
// LTO: define available_externally void @f0
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
// LTO: @test1
int test1(int x) {
// CHECK-NOT: call {{.*}} @f1
// CHECK: ret i32
// LTO-NOT: call {{.*}} @f1
// LTO: ret i32
return f1(x);
}
|
the_stack_data/91004.c | /* Public domain. */
#include <sys/types.h>
#include <time.h>
#include <sys/time.h>
#include <sys/select.h> /* SVR4 silliness */
void foo()
{
;
}
|
the_stack_data/519111.c | /*
** EPITECH PROJECT, 2020
** my_print_comb.c
** File description:
** [email protected]
*/
#include <unistd.h>
void my_putchar(char c)
{
write(1, &c, 1);
}
void print_comb(int i)
{
if (i < 100)
my_putchar('0');
else
my_putchar('0' + (i / 100));
if (i < 10)
my_putchar('0');
else
my_putchar('0' + (i / 10 % 10));
my_putchar('0' + (i % 10));
if (i < 789)
write(1, ", ", 2);
}
int is_valid_comb(int i)
{
if ((i % 10) > (i / 10 % 10) && (i / 10 % 10) > (i / 100))
return 1;
return 0;
}
int my_print_comb(void)
{
for (int i = 0; i <= 999; i++) {
if (is_valid_comb(i))
print_comb(i);
}
return 0;
} |
the_stack_data/206393242.c |
/* text version of maze 'mazefiles/binary/map-y5-4.maz'
generated by mazetool (c) Peter Harrison 2018
o---o---o---o---o---o---o---o---o---o---o---o---o---o---o---o---o
| | |
o---o---o---o---o---o---o o---o---o---o o---o---o---o o---o
| | | | | |
o o---o---o o---o---o o---o---o---o o---o---o o---o o
| | | | | | | |
o o---o---o---o o---o---o---o---o o o o---o o o o
| | | | | | | | | |
o o o---o o---o---o---o---o---o o---o o---o o o o
| | | | | | | | |
o o o o o o---o o---o o---o o o---o o---o o
| | | | | | | | | | | | | |
o o o o o o o o o o o---o o---o---o---o o
| | | | | | | | | | | | | |
o o---o---o o o o o---o---o---o---o o o o o o
| | | | | | | | | | |
o---o---o---o o o o---o o o---o---o o o o o o
| | | | | | | | | | | | |
o o o o o o---o o---o---o---o---o o o o---o o
| | | | | | | |
o o o o o o---o o---o---o---o---o o o o o o
| | | | | | | | | | | | | |
o o o---o o o---o---o---o o---o---o o o o o o
| | | | | | |
o o---o---o---o---o---o---o---o---o---o---o---o---o---o o o
| | | | | |
o o---o---o o o---o---o---o o---o---o---o o---o o o
| | | | | | | | | | |
o o---o o o o---o---o---o o---o---o---o o o o o
| | | | | | | | | | |
o o o o---o---o---o---o o o---o---o---o---o---o o o
| | | | | |
o---o---o---o---o---o---o---o---o---o---o---o---o---o---o---o---o
*/
int map_y5_4_maz[] ={
0x0E, 0x0A, 0x08, 0x0A, 0x0A, 0x0A, 0x0A, 0x09, 0x0C, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x09, 0x0D,
0x0E, 0x0B, 0x05, 0x0D, 0x0C, 0x0A, 0x0A, 0x03, 0x05, 0x0E, 0x0A, 0x0A, 0x09, 0x0D, 0x05, 0x05,
0x0C, 0x0A, 0x03, 0x05, 0x05, 0x0E, 0x0A, 0x0B, 0x05, 0x0E, 0x0A, 0x0B, 0x05, 0x07, 0x05, 0x05,
0x05, 0x0E, 0x0A, 0x03, 0x06, 0x0A, 0x0A, 0x0A, 0x02, 0x0A, 0x0A, 0x0A, 0x03, 0x0E, 0x01, 0x07,
0x05, 0x0C, 0x0A, 0x09, 0x0C, 0x0A, 0x08, 0x0A, 0x0A, 0x0A, 0x0A, 0x09, 0x0C, 0x09, 0x05, 0x0D,
0x05, 0x05, 0x0D, 0x05, 0x05, 0x0F, 0x05, 0x0E, 0x0A, 0x0A, 0x0B, 0x05, 0x05, 0x05, 0x05, 0x05,
0x05, 0x05, 0x05, 0x05, 0x05, 0x0E, 0x00, 0x09, 0x0E, 0x0A, 0x0A, 0x01, 0x05, 0x04, 0x02, 0x01,
0x06, 0x03, 0x07, 0x05, 0x05, 0x0D, 0x05, 0x04, 0x09, 0x0E, 0x0B, 0x05, 0x05, 0x05, 0x0D, 0x05,
0x0C, 0x0A, 0x0A, 0x01, 0x04, 0x01, 0x05, 0x06, 0x03, 0x0E, 0x0A, 0x01, 0x05, 0x05, 0x05, 0x05,
0x05, 0x0D, 0x0D, 0x05, 0x05, 0x05, 0x05, 0x0D, 0x0D, 0x0C, 0x0B, 0x04, 0x02, 0x03, 0x07, 0x05,
0x05, 0x05, 0x05, 0x05, 0x05, 0x07, 0x05, 0x07, 0x05, 0x07, 0x0E, 0x01, 0x0E, 0x08, 0x0A, 0x01,
0x05, 0x05, 0x07, 0x05, 0x06, 0x0A, 0x02, 0x0A, 0x02, 0x08, 0x0A, 0x00, 0x0A, 0x01, 0x0D, 0x05,
0x05, 0x06, 0x0A, 0x03, 0x0C, 0x0A, 0x0A, 0x0A, 0x0A, 0x01, 0x0D, 0x07, 0x0F, 0x05, 0x07, 0x05,
0x05, 0x0E, 0x0B, 0x0D, 0x06, 0x0A, 0x08, 0x0A, 0x0A, 0x03, 0x04, 0x0A, 0x0A, 0x02, 0x09, 0x05,
0x06, 0x0A, 0x0A, 0x02, 0x0A, 0x0A, 0x01, 0x0E, 0x0A, 0x0B, 0x05, 0x0E, 0x0A, 0x0B, 0x04, 0x01,
0x0E, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x02, 0x0A, 0x0A, 0x0A, 0x02, 0x0A, 0x0A, 0x0A, 0x03, 0x07,
};
/* end of mazefile */
|
the_stack_data/759343.c | /*
Card game that counts cards based on their values.
Nina Tchirkova
*/
#include <stdio.h>
#include <stdlib.h>
/* Gets name of card based on user input.
Returns char of card name.
*/
char get_card_name() {
char card[3];
puts("Enter the card name: ");
scanf("%2s", card);
return card[0];
}
/* Identifies value of card based on its name.
card_name: char of card name.
Returns card name value as int.
*/
int card_to_value(char card_name) {
int val = 0;
switch(card_name) {
case 'K':
case 'Q':
case 'J':
val = 10;
break;
case 'A':
val = 11;
break;
case 'X':
break;
default:
val = card_name - '0';
if ((val < 1) || (val > 10)) {
puts("I don't understand that value!");
}
}
return val;
}
/* Updates count in the card game.
count: int of count from last state.
val: card value as int.
Returns updated count.
*/
int count_cards(int count, int val) {
if ((val > 2) && (val <7)) {
count++;
} else if (val == 10) {
count--;
}
return count;
}
int main () {
char card_name;
int count = 0;
do {
card_name = get_card_name();
count = count_cards(count, card_to_value(card_name));
printf("Current count: %i\n", count);
} while (card_name != 'X');
return 0;
}
|
the_stack_data/110939.c | /*
*******************************************************************************
* Copyright (c) 2020-2021, STMicroelectronics
* All rights reserved.
*
* This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause
*
*******************************************************************************
*/
#if defined(ARDUINO_GENERIC_L071C8TX) || defined(ARDUINO_GENERIC_L071C8UX) ||\
defined(ARDUINO_GENERIC_L071CBTX) || defined(ARDUINO_GENERIC_L071CBUX) ||\
defined(ARDUINO_GENERIC_L071CZTX) || defined(ARDUINO_GENERIC_L071CZUX) ||\
defined(ARDUINO_GENERIC_L081CBTX) || defined(ARDUINO_GENERIC_L081CZTX) ||\
defined(ARDUINO_GENERIC_L081CZUX)
#include "pins_arduino.h"
/**
* @brief System Clock Configuration
* @param None
* @retval None
*/
WEAK void SystemClock_Config(void)
{
/* SystemClock_Config can be generated by STM32CubeMX */
#warning "SystemClock_Config() is empty. Default clock at reset is used."
}
#endif /* ARDUINO_GENERIC_* */
|
the_stack_data/697136.c | /**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Benchmark `tan`.
*/
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <sys/time.h>
#define ITERATIONS 1000000
#define REPEATS 3
/**
* Prints the TAP version.
*/
void print_version() {
printf( "TAP version 13\n" );
}
/**
* Prints the TAP summary.
*
* @param total total number of tests
* @param passing total number of passing tests
*/
void print_summary( int total, int passing ) {
printf( "#\n" );
printf( "1..%d\n", total ); // TAP plan
printf( "# total %d\n", total );
printf( "# pass %d\n", passing );
printf( "#\n" );
printf( "# ok\n" );
}
/**
* Prints benchmarks results.
*
* @param elapsed elapsed time in seconds
*/
void print_results( double elapsed ) {
double rate = (double)ITERATIONS / elapsed;
printf( " ---\n" );
printf( " iterations: %d\n", ITERATIONS );
printf( " elapsed: %0.9f\n", elapsed );
printf( " rate: %0.9f\n", rate );
printf( " ...\n" );
}
/**
* Returns a clock time.
*
* @return clock time
*/
double tic() {
struct timeval now;
gettimeofday( &now, NULL );
return (double)now.tv_sec + (double)now.tv_usec/1.0e6;
}
/**
* Generates a random double on the interval [0,1].
*
* @return random double
*/
double rand_double() {
int r = rand();
return (double)r / ( (double)RAND_MAX + 1.0 );
}
/**
* Runs a benchmark.
*
* @return elapsed time in seconds
*/
double benchmark() {
double elapsed;
double x;
double y;
double t;
int i;
t = tic();
for ( i = 0; i < ITERATIONS; i++ ) {
x = ( rand_double()*10.0 ) - 5.0;
y = tan( x );
if ( y != y ) {
printf( "should not return NaN\n" );
break;
}
}
elapsed = tic() - t;
if ( y != y ) {
printf( "should not return NaN\n" );
}
return elapsed;
}
/**
* Main execution sequence.
*/
int main( void ) {
double elapsed;
int i;
// Use the current time to seed the random number generator:
srand( time( NULL ) );
print_version();
for ( i = 0; i < REPEATS; i++ ) {
printf( "# c::%s\n", "tan" );
elapsed = benchmark();
print_results( elapsed );
printf( "ok %d benchmark finished\n", i+1 );
}
print_summary( REPEATS, REPEATS );
}
|
the_stack_data/56204.c | /* A gettimeofday routine to give access to the wall
clock timer on most UNIX-like systems.
This version defines two entry points -- with
and without appended underscores, so it *should*
automagically link with FORTRAN */
#include <sys/time.h>
double mysecond()
{
/* struct timeval { long tv_sec;
long tv_usec; };
struct timezone { int tz_minuteswest;
int tz_dsttime; }; */
struct timeval tp;
struct timezone tzp;
int i;
i = gettimeofday(&tp,&tzp);
return ( (double) tp.tv_sec + (double) tp.tv_usec * 1.e-6 );
}
double mysecond_() {return mysecond();}
|
the_stack_data/71542.c | #include <stdio.h>
#include <stdlib.h>
int main()
{
int *x = malloc(10 * sizeof(int));
free(x);
}
|
the_stack_data/1066915.c | /**
* 顺序表( 动态分配方式 )
*/
#include <stdio.h>
#include <stdlib.h>
typedef struct {
int * dataPtr;
int curSize;
int length;
} SqList;
#define defaultSize 5
#define defaultLen 0
SqList * InitList(SqList * list) {
// 无论如何看见野指针赶紧置 NULL
list->dataPtr = NULL;
int * tmp = (int *)malloc(defaultSize * sizeof(int));
if (tmp == NULL) {
return NULL;
}
list->dataPtr = tmp;
list->curSize = defaultSize;
list->length = defaultLen;
for (int i = 0; i < defaultSize; i ++) {
list->dataPtr[i] = 0;
}
return list;
}
typedef enum { false = 0, true } bool;
// 按位序插入新结点
bool InsertList(SqList * list, int idx, int elem) {
if (list->length == list->curSize) {
return false;
}
if (idx < 1 || idx > list->length + 1) {
return false;
}
for (int i = list->length; i >= idx; i --) { // 这里 i 指位序
list->dataPtr[i] = list->dataPtr[i - 1];
}
list->dataPtr[idx - 1] = elem;
(list->length)++;
return true;
}
void PrintList(SqList list) {
if (list.length == 0) {
return;
}
for (int i = 0; i < list.length; i ++) { // 这里 i 指数组下标
printf("%d\n", list.dataPtr[i]);
}
}
bool IncreaseSize(SqList * list, int growth) {
int newSize = list->curSize + growth;
int * tmp = (int *)malloc(sizeof(int) * (newSize));
if (tmp == NULL) {
return false;
}
int * oldData = list->dataPtr;
list->dataPtr = tmp;
list->curSize = newSize;
for (int i = 0; i < list->curSize; i ++) {
list->dataPtr[i] = 0;
}
for (int i = 0; i < list->length; i ++) {
list->dataPtr[i] = oldData[i];
}
free(oldData);
return true;
}
int main() {
SqList list;
InitList(&list);
// 插入 5 个新结点,每个结点存储的数据为( 位序 + 100 )
for (int i = 1; i < 6; i ++) {
InsertList(&list, i, i + 100);
}
PrintList(list);
// 新结点将要存储的数据元素,和将要插入的位序
int newElem = 999, idx = 3;
if (InsertList(&list, idx, newElem)) {
PrintList(list);
} else {
printf("插入 %d 失败,因顺序表满,正尝试扩容并插入...\n", newElem);
// 尝试将容量增至自身当前容量的 2 倍
if (IncreaseSize(&list, list.curSize)) {
// 扩容成功,再尝试插入新结点,插入成功则打印输出
if (InsertList(&list, idx, newElem)) {
printf("成功将 %d 插入到位序 %d\n", newElem, idx);
PrintList(list);
} else {
printf("扩容成功,但 %d 插入位序 %d 失败...\n", newElem, idx);
}
} else {
printf("扩容失败...\n");
}
}
return 0;
}
|
the_stack_data/98575805.c |
/* "makeproto" Copyright 1989, 1990, 1991, 1992, 1993 Free Software Foundation */
/* Program to scan old-style source files and make prototypes */
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <time.h>
#ifdef M_XENIX
# define BSD 0
#endif
#ifdef FILE /* a #define in BSD, a typedef in SYSV (hp-ux, at least) */
# ifndef BSD
# define BSD 1
# endif
#endif
#ifdef BSD
# if !BSD
# undef BSD
# endif
#endif
#ifdef BSD
# include <strings.h>
#else
# include <string.h>
#endif
#define isidchar(x) (isalnum(x) || (x) == '_')
#define dprintf if (!debug) ; else printf
#define MAXARGS 16
int verbose, debug, incomment;
struct warnstruct {
char *bad, *good;
} warntypes[] = {
{ "char", "int" },
{ "signed char", "int" },
{ "unsigned char", "int" },
{ "short", "int" },
{ "signed short", "int" },
{ "unsigned short", "int" },
{ "boolean", "int" },
{ "Boolean", "int" },
{ "float", "double" },
{ NULL, NULL }
} ;
int readline(buf, inf)
char *buf;
FILE *inf;
{
char *cp, *cp2;
int spflag;
for (;;) {
if (fgets(buf, 1000, inf)) {
cp = buf;
cp2 = buf;
spflag = 0;
while (*cp) {
if (incomment) {
if (cp[0] == '*' && cp[1] == '/') {
incomment = 0;
cp += 2;
} else
cp++;
spflag = 1;
} else {
if (cp[0] == '/' && cp[1] == '*') {
incomment = 1;
cp += 2;
} else if (isspace(*cp)) {
spflag = 1;
cp++;
} else {
if (spflag)
*cp2++ = ' ';
*cp2++ = *cp++;
spflag = 0;
}
}
}
*cp2 = 0;
if (!*buf)
continue;
if (verbose)
printf("\217%s\210\n", buf);
return 1;
} else
strcpy(buf, "\001");
return 0;
}
}
int strbeginsword(s1, s2)
register char *s1, *s2;
{
while (*s2 && *s1 == *s2)
s1++, s2++;
return (!*s2 && !isidchar(*s1));
}
void usage()
{
fprintf(stderr, "usage: makeproto [options] [infile ...] [-o outfile]]\n");
fprintf(stderr, " -tnnn Tab to nnn after type name [default 15]\n");
fprintf(stderr, " -annn Tab to nnn before arguments [default 30]\n");
fprintf(stderr, " -s0 Omit functions declared static\n");
fprintf(stderr, " -s1 Omit functions not declared static\n");
fprintf(stderr, " -x Add \"extern\" keyword (-X => \"Extern\")\n");
fprintf(stderr, " -n Include argument names in prototypes\n");
fprintf(stderr, " -m Use PP/PV macro notation\n");
exit(1);
}
#define bounce(msg) do { if (verbose) printf("Bounced: %s\n", msg); if (stupid) goto Lbounce; } while (0)
int main(argc, argv)
int argc;
char **argv;
{
FILE *inf, *outf;
char outfname[256];
char buf[1000], ifdefname[256];
char ftype[256], fname[80], dtype[256], decl[256], dname[80], temp[256];
char argdecls[MAXARGS][256], argnames[MAXARGS][80];
char *cp, *cp2, *cp3;
int i, j, pos, len, thistab, numstars, whichf, nargs, incomment, errors = 0;
long li;
int typetab = 15, argtab = 30, width = 80, usenames = 0, usemacros = 0;
int useextern = 0, staticness = -1, hasheader = 0, useifdefs = 0;
int stupid = 1, firstdecl;
errors = 0;
verbose = 0;
debug = 0;
*outfname = 0;
while (argc > 1 && argv[1][0] == '-') {
if (argv[1][1] == 't') {
typetab = atoi(argv[1] + 2);
} else if (argv[1][1] == 'a') {
argtab = atoi(argv[1] + 2);
} else if (argv[1][1] == 'w') {
width = atoi(argv[1] + 2);
} else if (argv[1][1] == 's') {
staticness = atoi(argv[1] + 2);
} else if (argv[1][1] == 'v') {
verbose = 1;
} else if (argv[1][1] == 'D') {
debug = 1;
} else if (argv[1][1] == 'x') {
useextern = 1;
} else if (argv[1][1] == 'X') {
useextern = 2;
} else if (argv[1][1] == 'n') {
usenames = 1;
} else if (argv[1][1] == 'm') {
usemacros = 1;
} else if (argv[1][1] == 'h') {
hasheader = 1;
} else if (argv[1][1] == 'i') {
useifdefs = 1;
} else if (argv[1][1] == 'o' && argc > 2) {
strcpy(outfname, argv[2]);
argc--, argv++;
} else {
usage();
}
argc--, argv++;
}
if (argc > 2 && !strcmp(argv[argc-2], "-o")) {
strcpy(outfname, argv[argc-1]);
argc -= 2;
}
if (*outfname) {
outf = fopen(outfname, "w");
if (!outf) {
perror(outfname);
exit(1);
}
} else
outf = stdout;
if (hasheader) {
time(&li);
cp = ctime(&li);
cp[24] = 0;
fprintf(outf, "\n/* Declarations created by \"makeproto\" on %s */\n", cp);
fprintf(outf, "\n\n");
}
incomment = 0;
for (whichf = 1; whichf < argc + (argc < 2); whichf++) {
if (whichf >= argc || !strcmp(argv[whichf], "-")) {
inf = stdin;
} else {
inf = fopen(argv[whichf], "r");
if (!inf) {
perror(argv[whichf]);
fprintf(outf, "\n/* Unable to open file %s */\n", argv[whichf]);
errors++;
continue;
}
}
firstdecl = 1;
while (readline(buf, inf)) {
if (!isidchar(*buf))
continue;
cp = buf;
cp2 = ftype;
numstars = 0;
while (isspace(*cp) || isidchar(*cp))
*cp2++ = *cp++;
if (*cp == '*') {
while (*cp == '*' || isspace(*cp)) {
if (*cp == '*')
numstars++;
cp++;
}
} else {
while (cp > buf && isspace(cp[-1])) cp--, cp2--;
while (cp > buf && isidchar(cp[-1])) cp--, cp2--;
}
while (cp2 > ftype && isspace(cp2[-1])) cp2--;
*cp2 = 0;
if (!*ftype)
strcpy(ftype, "int");
dprintf("numstars is %d\n", numstars); /***/
dprintf("ftype is %s\n", ftype); /***/
dprintf("cp after ftype is %s\n", cp); /***/
if (strbeginsword(ftype, "static") || strbeginsword(ftype, "Static")) {
if (staticness == 0)
bounce("Function is static");
} else {
if (staticness == 1)
bounce("Function is not static");
if (useextern &&
!strbeginsword(ftype, "extern") && !strbeginsword(ftype, "Extern")) {
sprintf(temp, useextern == 2 ? "Extern %s" : "extern %s", ftype);
strcpy(ftype, temp);
}
}
while (isspace(*cp)) cp++;
if (!*cp) {
readline(buf, inf);
cp = buf;
}
dprintf("cp before fname is %s\n", cp); /***/
if (!isidchar(*cp))
bounce("No function name");
cp2 = fname;
while (isidchar(*cp))
*cp2++= *cp++;
*cp2 = 0;
dprintf("fname is %s\n", fname); /***/
dprintf("cp after fname is %s\n", cp); /***/
while (isspace(*cp)) cp++;
if (*cp++ != '(')
bounce("No function '('");
nargs = 0;
if (!*cp) {
readline(buf, inf);
cp = buf;
}
while (isspace(*cp)) cp++;
while (*cp != ')') {
if (!isidchar(*cp))
bounce("Missing argument name");
if (nargs >= MAXARGS)
bounce("Too many arguments");
cp2 = argnames[nargs];
argdecls[nargs][0] = 0;
nargs++;
while (isidchar(*cp))
*cp2++ = *cp++;
*cp2 = 0;
dprintf("Argument %d is named %s\n", nargs-1, argnames[nargs-1]); /***/
while (isspace(*cp)) cp++;
if (*cp == ',') {
cp++;
if (!*cp) {
readline(buf, inf);
cp = buf;
}
while (isspace(*cp)) cp++;
} else if (*cp != ')')
bounce("Missing function ')'");
}
if (cp[1])
bounce("Characters after function ')'");
readline(buf, inf);
cp = buf;
for (;;) {
while (isspace(*cp)) cp++;
if (isidchar(*cp)) {
cp2 = dtype;
if (strbeginsword(cp, "register")) {
cp += 8;
while (isspace(*cp)) cp++;
}
while (isspace(*cp) || isidchar(*cp))
*cp2++ = *cp++;
if (*cp == ',' || *cp == ';' || *cp == '[') {
while (cp2 > dtype && isspace(cp2[-1])) cp--, cp2--;
while (cp2 > dtype && isidchar(cp2[-1])) cp--, cp2--;
} else if (*cp != '(' && *cp != '*')
bounce("Strange character in arg decl");
while (cp2 > dtype && isspace(cp2[-1])) cp2--;
*cp2 = 0;
if (!*dtype)
bounce("Empty argument type");
for (;;) {
cp2 = decl;
cp3 = dname;
while (*cp == '*' || *cp == '(' || isspace(*cp))
*cp2++ = *cp++;
if (!isidchar(*cp))
bounce("Missing arg decl name");
while (isidchar(*cp)) {
if (usenames)
*cp2++ = *cp;
*cp3++ = *cp++;
}
if (!usenames) {
while (cp2 > decl && isspace(cp2[-1])) cp2--;
while (isspace(*cp)) cp++;
}
i = 0;
while (*cp && *cp != ';' && (*cp != ',' || i > 0)) {
if (*cp == '(' || *cp == '[') i++;
if (*cp == ')' || *cp == ']') i--;
*cp2++ = *cp++;
}
*cp2 = 0;
*cp3 = 0;
dprintf("Argument %s is %s\n", dname, decl); /***/
if (i > 0)
bounce("Unbalanced parens in arg decl");
if (!*cp)
bounce("Missing ';' or ',' in arg decl");
for (i = 0; i < nargs && strcmp(argnames[i], dname); i++) ;
if (i >= nargs)
bounce("Arg decl name not in argument list");
if (*decl)
sprintf(argdecls[i], "%s %s", dtype, decl);
else
strcpy(argdecls[i], dtype);
if (*cp == ',') {
cp++;
if (!*cp) {
readline(buf, inf);
cp = buf;
}
while (isspace(*cp)) cp++;
} else
break;
}
cp++;
if (!*cp) {
readline(buf, inf);
cp = buf;
}
} else
break;
}
if (*cp != '{')
bounce("Missing function '{'");
if (firstdecl) {
firstdecl = 0;
if (argc > 2)
fprintf(outf, "\n/* Declarations from %s */\n", argv[whichf]);
if (useifdefs && inf != stdin) {
strcpy(ifdefname, argv[whichf]);
cp = ifdefname;
for (cp2 = ifdefname; *cp2; ) {
if (*cp2++ == '/')
cp = cp2;
}
for (cp2 = ifdefname; *cp; cp++, cp2++) {
if (islower(*cp))
*cp2 = toupper(*cp);
else if (isalnum(*cp))
*cp2 = *cp;
else
*cp2 = '_';
}
fprintf(outf, "#ifdef PROTO_%s\n", ifdefname);
}
}
for (i = 0; i < nargs; i++) {
if (!argdecls[i][0])
sprintf(argdecls[i], "int %s", argnames[i]);
for (j = 0; warntypes[j].bad &&
!strbeginsword(argdecls[i], warntypes[j].bad); j++) ;
if (warntypes[j].bad) {
cp = argdecls[i];
while (isspace(*cp) || isidchar(*cp)) cp++;
if (!*cp) { /* not, e.g., "char *" */
sprintf(temp, "%s%s", warntypes[j].good,
argdecls[i] + strlen(warntypes[j].bad));
strcpy(argdecls[i], temp);
fprintf(stderr, "Warning: Argument %s of %s has type %s\n",
argnames[i], fname, warntypes[j].bad);
}
}
}
if (verbose && outf != stdout)
printf("Found declaration for %s\n", fname);
fprintf(outf, "%s", ftype);
pos = strlen(ftype) + numstars;
do {
putc(' ', outf);
pos++;
} while (pos < typetab);
for (i = 1; i <= numstars; i++)
putc('*', outf);
fprintf(outf, "%s", fname);
pos += strlen(fname);
do {
putc(' ', outf);
pos++;
} while (pos < argtab);
if (nargs == 0) {
if (usemacros)
fprintf(outf, "PV();");
else
fprintf(outf, "(void);");
} else {
if (usemacros)
fprintf(outf, "PP( ("), pos += 5;
else
fprintf(outf, "("), pos++;
thistab = pos;
for (i = 0; i < nargs; i++) {
len = strlen(argdecls[i]);
if (i > 0) {
putc(',', outf);
pos++;
if (pos > thistab && pos + len >= width) {
putc('\n', outf);
for (j = 1; j <= thistab; j++)
putc(' ', outf);
pos = thistab;
} else {
putc(' ', outf);
pos++;
}
}
fprintf(outf, "%s", argdecls[i]);
pos += len;
}
if (usemacros)
fprintf(outf, ") );");
else
fprintf(outf, ");");
}
putc('\n', outf);
Lbounce: ;
}
if (inf != stdin) {
if (useifdefs && !firstdecl)
fprintf(outf, "#endif /*PROTO_%s*/\n", ifdefname);
fclose(inf);
}
}
if (hasheader) {
fprintf(outf, "\n\n/* End. */\n\n");
}
if (outf != stdout)
fclose(outf);
if (errors)
exit(1);
else
exit(0);
}
/* End. */
|
the_stack_data/28263832.c | int main(){
int m,n,i,min,max_m;
float nota,max_n;
max_n = 0;
max_m = 0;
min = 0;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d %f", &m, ¬a);
if(nota>max_n){
max_m = m;
max_n = nota;
if(nota>=8){
min = 1;
}
}
}
if(min){
printf("%d\n",max_m);
}else{
printf("Minimum note not reached\n");
}
return 0;
}
|
the_stack_data/12636867.c | #if _WIN32
#define VC_EXTRALEAN
#include <windows.h>
#ifndef __cplusplus
typedef BOOL bool;
#endif
#include "..\include\jemalloc\jemalloc.h"
int malloc_init_hard_needed(void);
int malloc_init_hard(void);
JEMALLOC_EXPORT size_t __stdcall MemTotalReserved() {
size_t stats_total_reserved();
return stats_total_reserved();
}
JEMALLOC_EXPORT size_t __stdcall MemTotalCommitted() {
size_t stats_total_commited();
return stats_total_commited();
}
JEMALLOC_EXPORT size_t __stdcall MemFlushCache(size_t size) {
/* TODO: purge arenas */return 0;
}
JEMALLOC_EXPORT void __stdcall MemFlushCacheAll() {
/*No cleanup seems to be needed for JEMalloc*/
}
JEMALLOC_EXPORT size_t __stdcall MemSize(void *mem) {
return je_malloc_usable_size(mem);
}
JEMALLOC_EXPORT void *__stdcall MemAlloc(size_t size) {
return je_malloc(size);
}
JEMALLOC_EXPORT void __stdcall MemFree(void *mem) {
je_free(mem);
}
JEMALLOC_EXPORT size_t __stdcall MemSizeA(void *mem, size_t aligment) {
return je_malloc_usable_size(mem);
}
JEMALLOC_EXPORT void * __stdcall MemAllocA(size_t size, size_t aligment) {
return je_aligned_alloc(aligment, size);
}
JEMALLOC_EXPORT void __stdcall MemFreeA(void *mem) {
je_free(mem);
}
BOOL WINAPI DllMain( HINSTANCE hInst, DWORD callReason, LPVOID c)
{
if (callReason==DLL_PROCESS_ATTACH)
{
if (malloc_init_hard_needed())
malloc_init_hard();
}
else if (callReason==DLL_THREAD_DETACH)
{
//mallocThreadShutdownNotification(NULL);
}
else if (callReason==DLL_PROCESS_DETACH)
{
//mallocProcessShutdownNotification();
}
return TRUE;
}
#endif
|
the_stack_data/45449343.c | /* timespec_get -- C11 interface to sample a clock. Generic POSIX.1 version.
Copyright (C) 2013-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C 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.
The GNU C 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 the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#include <time.h>
/* Set TS to calendar time based in time base BASE. */
int
timespec_get (struct timespec *ts, int base)
{
switch (base)
{
case TIME_UTC:
if (__clock_gettime (CLOCK_REALTIME, ts) < 0)
return 0;
break;
default:
return 0;
}
return base;
}
|
the_stack_data/36076321.c | /*
gcc -std=c17 -lc -lm -pthread -o ../_build/c/string_wide_iswcntrl.exe ./c/string_wide_iswcntrl.c && (cd ../_build/c/;./string_wide_iswcntrl.exe)
https://en.cppreference.com/w/c/string/wide/iswcntrl
*/
#include <stdio.h>
#include <wchar.h>
#include <wctype.h>
#include <locale.h>
int main(void)
{
wchar_t c = L'\u2028'; // the Unicode character "line separator"
printf("in the default locale, iswcntrl(%#x) = %d\n", c, !!iswcntrl(c));
setlocale(LC_ALL, "en_US.utf8");
printf("in Unicode locale, iswcntrl(%#x) = %d\n", c, !!iswcntrl(c));
}
|
the_stack_data/200142073.c | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct list{
void * type;
struct list * next;
}Stack;
Stack * base, * _TOS = NULL;
/*
* Provides basic datatypes stack like int, float, char, double.
*/
void getCharStack(){
base = (Stack *)malloc(sizeof(Stack));
base->next = NULL;
// (char *)base->type;
base->type = (char *)malloc(sizeof(char));
*(char *)base->type = '-';
}
/* old push(char)
* assumes that getCharStack() is called and base is already initialized.
*/
void push(char c){
Stack * t = (Stack *)malloc(sizeof(Stack));
if(base == NULL){
t->next = base;
base = t;
}else{
t->next = _TOS;
}
_TOS = t;
// (char *)t->type;
t->type = (char *)malloc(sizeof(char));
*(char *)t->type = c;
}
bool isStackEmpty(){
if(base == NULL){
return true;
}else{
return false;
}
}
char pop(){
if(base == NULL){
return('-');
}
char c;
Stack * t = _TOS;
if(_TOS != base){
_TOS = _TOS->next;
}else{
_TOS = NULL;
base = NULL;
}
c = *(char *)t->type;
free(t);
return(c);
}
/*
* checkParen ... function pushes the '(', '[', '{' [left parentheses] onto the stack and pops it on an encounter of * corresponding ')', ']', '}' [right parentheses], if there is no element in the stack on ')', ']', '}' paren or the * parentheses poped does not match, then the string of parentheses is not balanced.
* Matching is done by the fact that '(', ')', '[', ']', '{', '}' have ASCII value of 40, 41, 90, 91, 93, 123, 125 - so * the difference between the braces is 1 or 2, and between different parens it is much greater than 2.
*/
bool checkParen(const char * paren, int n){
int i;
char c;
const int TWO = 2;
// getCharStack();
i = 0;
while(i < n){
if(paren[i] == '(' || paren[i] == '[' || paren[i] == '{'){
push(paren[i]);
}else if(paren[i] == ')' | paren[i] == ']' | paren[i] == '}'){
if(isStackEmpty()){
return false;
}
c = pop();
if(paren[i] - c > TWO){
return false;
}
}
++i;
}
if(isStackEmpty()){
return true;
}else{
return false;
}
}
int main(){
int n, cs, i;
char * paren;
printf("Enter any non-zero positive number for parentheses checking code segment to run:");
scanf("%d", &n);
if(n){
printf("Enter the size of sequence of parentheses:\n");
scanf("%d", &cs);
getc(stdin);
if(cs%2 == 1){
printf("You cannot have balanced parentheses with odd number of parentheses!\n");
}else{
paren = (char *)calloc(cs + 1, sizeof(char));
i = 0;
while(i <= cs){
scanf("%c", &paren[i]);
++i;
}
if(checkParen(paren, cs)){
printf("The sequence is a balanced parentheses sequence.\n");
}else{
printf("The sequence is not a balanced parentheses sequence.\n");
}
}
}
}
|
the_stack_data/1085288.c | #include <stdio.h>
void main(void)
{
printf("Hi Aananth, welcome to QNX <==> Linux, rutime development!\n");
printf("%s\n", "This program is built by RBS (Runtime Build System)");
} |
the_stack_data/28261561.c | /*
A simple source code.
Copyright (C) 2018, Guillaume Gonnet
This project is under the MIT License
*/
#include <stdio.h>
#include <stdlib.h>
#define debugger asm volatile ("int3;")
// A node in the binary tree
struct node {
int value;
struct node *left;
struct node *right;
};
// A simple binary tree.
struct tree {
struct node *root;
};
// Insert a new element in the binary tree.
void insert(struct tree *tree, int value)
{
struct node **curs = &tree->root;
while (*curs)
curs = (value <= (*curs)->value) ? &(*curs)->left : &(*curs)->right;
*curs = malloc(sizeof(struct node *));
**curs = (struct node) { value };
}
int main()
{
struct tree tree = {0};
insert(&tree, 12);
insert(&tree, 5);
insert(&tree, 20);
insert(&tree, 2);
debugger;
insert(&tree, 10);
insert(&tree, 14);
debugger;
}
|
the_stack_data/733452.c | #ifdef STM32F0xx
#include "stm32f0xx_hal.c"
#endif
#ifdef STM32F1xx
#include "stm32f1xx_hal.c"
#endif
#ifdef STM32F2xx
#include "stm32f2xx_hal.c"
#endif
#ifdef STM32F3xx
#include "stm32f3xx_hal.c"
#endif
#ifdef STM32F4xx
#include "stm32f4xx_hal.c"
#endif
#ifdef STM32F7xx
#include "stm32f7xx_hal.c"
#endif
#ifdef STM32G0xx
#include "stm32g0xx_hal.c"
#endif
#ifdef STM32H7xx
#include "stm32h7xx_hal.c"
#endif
#ifdef STM32L0xx
#include "stm32l0xx_hal.c"
#endif
#ifdef STM32L1xx
#include "stm32l1xx_hal.c"
#endif
#ifdef STM32L4xx
#include "stm32l4xx_hal.c"
#endif
#ifdef STM32WBxx
#include "stm32wbxx_hal.c"
#endif
|
the_stack_data/26699609.c | #include <unistd.h>
int main(int ac, char **av)
{
int i;
int c;
if (ac !=2)
write(1, "\n", 1);
else
{
i = 0;
while (av[1][i])
{
if (av[1][i] >= 65 && av[1][i] <= 90)
{
c = av[1][i] - 65 + 1;
while (c > 0)
{
write(1, &av[1][i], 1);
c--;
}
}
else if (av[1][i] >= 97 && av[1][i] <= 122)
{
c = av[1][i] - 97 + 1;
while (c > 0)
{
write(1, &av[1][i], 1);
c--;
}
}
else
write(1, &av[1][i], 1);
i++;
}
write(1, "\n", 1);
}
return (0);
}
|
the_stack_data/352638.c | // This is a simpler version of test2012_134.c
// This is the essential bug in ROSE from the module.c file of the zsh C application.
// This is the same as the issue with params.c from zsh also.
typedef int (*Hookfn) (int);
struct LinkNode
{
void *dat;
};
void
runhookdef()
{
struct LinkNode* p;
int r;
// The calls to the function might need the cast to Hookfn.
// Unparses to: r = (p -> dat)(42);
r = ((Hookfn)((p)->dat))(42);
}
|
the_stack_data/73811.c | /*
* Copyright (c) 2016 Cadence Design Systems, Inc.
* SPDX-License-Identifier: Apache-2.0
*/
|
the_stack_data/929385.c | #include <stdio.h>
int main() {
printf("Hello, two!\n");
return 0;
}
|
the_stack_data/198581396.c | // there is no action to merge nonterm MemberDeclaration
// originally found in package tcl8.4
// ERR-MATCH: merge nonterm MemberDeclaration
typedef void (*func) ();
struct S {
func (*proc);
};
|
the_stack_data/92328202.c | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char **argv) {
char aux;
char *nome = "Algoritmos";
char *p3;
p3 = &nome[0];
aux = *p3;
printf("%c", aux);
p3 = &nome[4];
aux = *p3;
printf("%c", aux);
p3 = nome;
printf("%c", *p3);
return 0;
}
|
the_stack_data/181392355.c | /*
* Function to apply operator to linked list of integers
*/
#include <stdio.h> /* scanf, printf */
#include <stdlib.h> /* abort */
#include <assert.h> /* assert */
typedef struct node
{
int value;
struct node* next;
} node;
/* terminal node at the end of the list */
node SENTINEL = {0, 0};
/* utility functions to create and free lists */
node * make_node(int v, node * q)
{
node* p = (node*) malloc(sizeof(node));
p->value = v;
p->next = q;
return p;
}
void free_node(node* p)
{
if(p == &SENTINEL)
return;
else
{
free_node(p->next);
free(p);
}
}
/* declare function prototype to give as
* input to the 'apply' function
*/
typedef int (* Operator) (int arg1, int arg2);
int apply(node* p, Operator op )
{
int r; /* result */
/* pre-condition */
assert (p != &SENTINEL);
/* post-condition */
r = p->value;
p = p->next;
for(; p != &SENTINEL; p = p->next)
r = op(r, p->value);
return r;
}
/* some functions that conform the the Operator
* prototype declaration
*/
int plus(int a, int b)
{
return a + b;
}
int mult(int a, int b)
{
return a * b;
}
int main(void)
{
int sum; /* value of sum 1 to n */
int prod; /* value of product 1 to n */
node* list = make_node(4,
make_node(6,
make_node(1,
make_node(51,
make_node(-2,
&SENTINEL
)
)
)
)
);
sum = apply(list, plus);
prod = apply(list, mult);
printf("%d\n", sum);
printf("%d\n", prod);
free_node(list);
return 0;
} |
the_stack_data/37636488.c | #include <stdint.h>
const int16_t cg_FC1weit[1620] = { // Co,H,W,Ci: (180, 9)
// Out channel 0
-1007, 1372, -13, 44, -2301, 1019, -534, -314, 1236,
// Out channel 1
-1363, 195, -2031, 2505, 920, 1653, -2425, -25, 70,
// Out channel 2
77, 1311, 102, 2584, -513, -1516, 812, 54, 144,
// Out channel 3
-205, -679, -141, 3512, 13, -233, 451, -114, -201,
// Out channel 4
-1596, -1195, -1196, 1773, 2128, 1199, -2740, -211, 475,
// Out channel 5
24, -126, -758, -501, -1571, 2393, -1768, -481, -741,
// Out channel 6
-836, 594, 1669, -1980, -1648, -434, 855, 397, -641,
// Out channel 7
-1695, 417, 2002, -1552, -1405, -1709, 3649, 371, -200,
// Out channel 8
433, -1290, -385, -870, -1528, 2594, 35, -222, -686,
// Out channel 9
-823, -344, 729, 2563, 455, -1307, 1788, 67, 341,
// Out channel 10
10, -3087, 255, -277, 1177, 1993, 95, 172, 143,
// Out channel 11
-1429, -676, 251, -880, -1412, 1940, 2127, 233, 248,
// Out channel 12
825, 937, 2082, -1869, -2574, -2207, 1780, -41, -894,
// Out channel 13
-281, 731, 395, -1450, -709, -195, -1423, 309, 1243,
// Out channel 14
726, -237, 323, 1846, -2314, 357, 1309, 224, -922,
// Out channel 15
758, 743, 1069, -2374, 848, -2275, 1725, 197, 174,
// Out channel 16
667, 709, 2044, -1502, -1323, -2449, 3120, 485, -311,
// Out channel 17
1009, -102, 682, -2576, -2330, 1395, 307, -56, -243,
// Out channel 18
452, 1374, 1156, 958, -1430, -1802, 666, 51, 761,
// Out channel 19
-688, -1638, 874, -2172, 431, 775, 2041, 357, -2420,
// Out channel 20
-173, -1268, -697, 770, 692, 538, -947, 1005, -971,
// Out channel 21
-522, 10, 860, -238, -2933, 967, -1195, -1091, -1610,
// Out channel 22
1085, -1528, 570, -3794, 231, 1684, 753, -112, -60,
// Out channel 23
522, -2643, -894, 1087, 1549, 2689, -1665, -222, 536,
// Out channel 24
-572, 133, 937, -205, -672, -1256, 979, 356, 240,
// Out channel 25
349, -345, -795, 1305, 3567, -1088, -1115, -239, -447,
// Out channel 26
-433, 14, 141, -499, -917, 634, 922, -322, 183,
// Out channel 27
1502, -143, 954, -2753, -2639, 721, 207, 7, -69,
// Out channel 28
-1321, -1224, -453, -2410, 390, 1548, -1614, 115, -156,
// Out channel 29
-2455, 874, 736, 1396, 1291, -2117, -335, 309, -52,
// Out channel 30
652, -412, 1676, -2929, 83, -1378, 696, 2, -40,
// Out channel 31
849, 42, 1051, -1703, -3480, 707, 2170, -463, 110,
// Out channel 32
-865, -1648, -968, 4934, -921, 2545, -1851, 350, 340,
// Out channel 33
-864, -1667, 212, 1082, 535, -565, -241, 650, -449,
// Out channel 34
-989, 274, -1515, 1827, 943, 2180, -440, -267, -608,
// Out channel 35
-338, 1205, 1562, -1245, -3047, -1792, 2647, 271, -359,
// Out channel 36
2080, -2374, -356, -2210, -233, 2820, 1286, -339, -198,
// Out channel 37
138, -878, -1799, 1304, 1720, 2095, -103, 190, 1065,
// Out channel 38
-1125, -898, -891, 810, 267, 2474, -1367, -543, 133,
// Out channel 39
-506, 1078, 409, 2129, 1235, -2399, -698, 84, 355,
// Out channel 40
-927, 1991, 975, -5, 192, -2745, 294, 92, -26,
// Out channel 41
142, 1759, -511, 1255, -1501, 1176, 1915, 188, 49,
// Out channel 42
1434, 81, -115, -4664, 976, -500, 166, -194, 18,
// Out channel 43
-530, -673, -202, 2529, -1610, 2788, 1590, 41, -462,
// Out channel 44
72, 1804, 424, -125, 1965, -3549, -725, 210, 830,
// Out channel 45
-374, 1155, 554, 293, -351, -119, 2656, -910, 188,
// Out channel 46
131, -555, -1435, 3397, -25, 1299, 196, 129, 306,
// Out channel 47
909, 2420, 662, -401, -1171, -2425, 1208, 42, -298,
// Out channel 48
859, 883, -597, 2029, 898, -1158, 405, 391, 75,
// Out channel 49
-677, -296, 1168, -3489, -1309, 969, -1054, -241, 43,
// Out channel 50
-496, 969, -1341, 2099, 1345, -1091, 713, -213, 337,
// Out channel 51
-1800, 602, 801, 2000, -1707, 401, 2557, -875, -786,
// Out channel 52
-2315, -754, -973, 2708, 2482, -74, -2932, 127, 540,
// Out channel 53
767, -663, 433, -1544, -1830, 1940, 257, -380, -464,
// Out channel 54
-655, 306, -1247, 4598, -2190, 1302, -95, -152, -153,
// Out channel 55
-828, 815, -649, 1235, -196, -1283, 567, -662, -2262,
// Out channel 56
-1073, -465, 532, -1072, -556, -56, -1803, -655, 1239,
// Out channel 57
-638, 286, -23, -556, -415, -242, -2455, -235, 1439,
// Out channel 58
545, 1785, 1391, -1836, -2027, -1887, 2022, 383, -467,
// Out channel 59
1079, -328, -1013, 2325, -1280, 2421, 1720, -188, -203,
// Out channel 60
-1228, -260, 1392, -3854, 314, -736, 890, 35, 85,
// Out channel 61
-557, -1496, -950, 1797, -578, 2925, -667, -24, 136,
// Out channel 62
-278, -906, 62, -1247, -1547, 1766, -328, -238, -1388,
// Out channel 63
-78, 782, -722, 389, 403, 128, -2450, -750, 2891,
// Out channel 64
-1906, -1179, -642, 4005, -1609, 3049, -48, 220, 71,
// Out channel 65
-888, -1964, -229, -877, -267, 2248, 121, 69, -322,
// Out channel 66
-1093, -791, -23, 8, 307, 1687, -871, -861, 503,
// Out channel 67
-1284, 400, -552, 869, 3086, -2354, -2215, -47, 121,
// Out channel 68
1077, 1333, -350, 1896, -906, 41, -653, -643, -443,
// Out channel 69
-1124, -751, -41, -685, -259, 1771, 122, 241, 252,
// Out channel 70
641, 2078, -634, -1795, -266, -92, -2393, -733, 770,
// Out channel 71
740, 2249, 760, -2934, -1373, -889, 918, -276, -578,
// Out channel 72
850, 224, -995, 511, 1404, -333, 55, 447, 2615,
// Out channel 73
331, 550, 261, -2156, -2199, 621, -777, -506, 353,
// Out channel 74
-425, 1889, 11, 1821, -461, -844, 956, 224, 638,
// Out channel 75
-478, 1310, -1195, 5148, 222, -1178, -1974, 137, 274,
// Out channel 76
1496, -93, 585, -3035, -1967, 1387, 253, -154, -114,
// Out channel 77
-633, 2758, 390, -1095, -1312, -2832, 1710, 279, -283,
// Out channel 78
844, 1728, 1245, -2063, -1166, -2164, 1572, -82, -650,
// Out channel 79
-404, -857, -1416, 2806, 3050, -692, -2489, 716, 549,
// Out channel 80
-415, -16, 247, -1938, -772, 1308, -2046, 143, 859,
// Out channel 81
164, 693, 163, -3435, 338, -890, 113, -243, 106,
// Out channel 82
-1477, -613, 217, 1974, 2823, -2576, -626, -16, 67,
// Out channel 83
-1230, -128, -470, 636, 2523, 315, 957, 611, -741,
// Out channel 84
-1022, 584, 844, -2365, -1923, 935, -736, 409, -1105,
// Out channel 85
798, 1064, -282, -188, 2381, -2063, -2659, 270, 1597,
// Out channel 86
-198, -512, 1155, -3940, 854, -716, -730, 418, 232,
// Out channel 87
-48, 472, 1533, -2400, -2344, 1602, 1767, 199, -106,
// Out channel 88
525, -65, -1665, -268, 3124, -1195, 768, 899, 1479,
// Out channel 89
566, 970, -1426, 1971, 517, 86, 1487, 251, 985,
// Out channel 90
492, -530, -53, 154, -1194, 1905, -2192, -334, -350,
// Out channel 91
-909, -1326, 574, -457, -252, 390, 1869, -287, -1409,
// Out channel 92
319, 682, -920, 3216, 194, -1010, 295, -744, -252,
// Out channel 93
-1407, -794, -1009, -1900, -281, 2659, 427, -219, -407,
// Out channel 94
891, -1496, -1091, 1210, 2522, 1480, -2145, -289, 421,
// Out channel 95
262, -460, 1750, -2805, -1198, 356, -73, 58, 376,
// Out channel 96
909, 35, -1193, 2561, -373, 1774, -102, -178, 113,
// Out channel 97
-124, 524, 295, -1262, -3461, 2192, 1841, -174, -582,
// Out channel 98
-394, -1140, -1453, 808, 849, 1900, -1931, -495, -186,
// Out channel 99
1368, -817, -124, -2345, -2590, 3404, 2429, -324, -709,
// Out channel 100
625, 345, 912, -903, 677, -2041, 2251, 674, 1100,
// Out channel 101
435, 1042, -861, 3024, -148, 83, -701, -305, 78,
// Out channel 102
1589, 565, -1495, 1498, 2262, 88, -1780, -527, 104,
// Out channel 103
-617, 2147, 1113, 1642, -1252, -2304, 668, 59, 29,
// Out channel 104
-800, -1511, -1429, 2678, 699, 2342, -1484, 4, 528,
// Out channel 105
1493, -1127, -1249, 1142, 2255, 1178, -326, 29, 32,
// Out channel 106
391, 206, -20, -2498, -235, 1236, -2457, -42, 83,
// Out channel 107
732, 73, 2136, -2279, -2626, -150, 1925, -348, -504,
// Out channel 108
20, -112, 1601, -2581, -1761, 1050, 1713, -205, -454,
// Out channel 109
-2065, 1258, 737, 109, 1202, -2603, -692, 147, -332,
// Out channel 110
-232, 1148, 914, -26, -1222, -663, 3903, -818, 172,
// Out channel 111
-770, -173, 911, 854, -1349, 473, 490, 273, -1898,
// Out channel 112
-859, 1576, 1216, -625, -197, -2612, 1416, 236, -228,
// Out channel 113
-2187, 1226, -127, 716, 904, -386, -2118, -211, 1073,
// Out channel 114
1072, -104, -1620, 1165, 1675, -275, 552, 594, 126,
// Out channel 115
261, 486, -1346, 3336, -250, 614, 556, -13, 122,
// Out channel 116
-1235, -548, -341, 3522, -2478, 2906, 941, 232, -33,
// Out channel 117
730, -3032, 519, -461, -1325, 3241, 2887, 31, -828,
// Out channel 118
218, 1585, -1237, 4104, 265, -2391, -957, -122, -29,
// Out channel 119
1926, 1164, -964, 1625, 539, -284, -1098, 218, 1815,
// Out channel 120
2618, -386, 173, -1543, 635, -665, -135, 1386, 837,
// Out channel 121
-231, 250, 1349, -415, -2890, -161, 1531, -112, -171,
// Out channel 122
1055, -2165, 1745, -6296, 514, 1632, 1727, -252, -365,
// Out channel 123
-252, -1842, 130, -2297, 360, 1963, -442, -78, -567,
// Out channel 124
-132, 287, 2076, -69, -2688, -812, 2980, 582, -273,
// Out channel 125
1411, 496, -209, 3174, 1377, -1894, -1062, -105, 494,
// Out channel 126
1527, 428, 194, -1190, -1352, 296, -1684, 932, 540,
// Out channel 127
-278, 666, 385, -2225, -2057, 1372, -433, 302, 562,
// Out channel 128
104, 2391, 288, -304, -1776, 157, 1475, 170, -145,
// Out channel 129
767, -331, 1022, -2690, -1359, 633, -1474, -41, 525,
// Out channel 130
1313, 665, 1014, 1965, -630, -1258, 15, 70, 368,
// Out channel 131
-889, 86, 976, 1531, 741, -1590, 1408, -10, -1319,
// Out channel 132
789, 1502, 625, 1606, -493, -2065, 967, -23, 290,
// Out channel 133
461, -1884, -275, -628, -696, 3639, -9, -129, -141,
// Out channel 134
-827, -1377, 566, -831, -714, 1411, 744, 58, -315,
// Out channel 135
-745, -1501, 201, 961, 814, 506, 1550, -369, -961,
// Out channel 136
2280, 2249, 358, -4120, 1520, -2673, 158, -334, -177,
// Out channel 137
-460, -1156, -1634, 1782, 2618, 1037, -3615, -286, 762,
// Out channel 138
-9, 2012, 795, -2055, 525, -2729, 1005, -36, -176,
// Out channel 139
577, -367, -1338, 2646, 1378, 789, 474, -13, 1381,
// Out channel 140
1094, -808, 629, -2372, -2092, 1878, 174, 26, 112,
// Out channel 141
-331, -494, 1796, -5149, 2060, -1545, 192, 40, -84,
// Out channel 142
1240, -2191, 755, -3714, -779, 2494, 2209, -186, -230,
// Out channel 143
318, 132, -349, 1917, 651, -710, 1407, 484, -1216,
// Out channel 144
1479, 29, -1140, -318, 1594, -325, -1900, 522, 1190,
// Out channel 145
-1505, 1463, 1839, -1326, -1503, -1691, 4028, 254, -443,
// Out channel 146
-2088, -746, -795, 2044, 1810, 257, -1791, 178, 124,
// Out channel 147
726, 1471, 585, 1794, -1054, -1574, 1702, 98, 247,
// Out channel 148
-502, -1233, 1143, -4579, 487, 275, 585, 427, -16,
// Out channel 149
428, 1250, 1228, -2449, 74, -2433, 2029, 252, -60,
// Out channel 150
-61, -646, -1776, 2657, 3395, -518, -2968, 387, 1156,
// Out channel 151
-816, 791, -581, 3170, -1467, 1609, 1295, 121, -155,
// Out channel 152
-273, 248, -76, 2622, 1003, -995, -152, -604, -763,
// Out channel 153
1201, 1431, -13, 473, 1215, -1389, 1423, 438, 1123,
// Out channel 154
-596, -21, -1892, 1404, 2251, 284, 66, 490, -149,
// Out channel 155
600, 200, -172, -2309, -1258, 1870, -1239, -80, 317,
// Out channel 156
-1473, 1214, -738, 2833, -2605, 1304, 2081, -149, -393,
// Out channel 157
-889, -1190, -1225, 2085, 2914, 676, -584, -39, -403,
// Out channel 158
251, -334, -565, 1234, 533, -442, 108, -618, -1458,
// Out channel 159
-552, -1117, 308, 1132, 754, 701, -1710, -792, -778,
// Out channel 160
1082, -393, -98, 1669, -319, -23, -750, 694, -330,
// Out channel 161
-890, -1738, -193, -2635, -100, 2556, -269, 446, 556,
// Out channel 162
-1689, -383, -315, -810, 542, -146, 1162, -676, 71,
// Out channel 163
-257, 2697, 898, -907, -58, -3191, 927, 120, -254,
// Out channel 164
-172, -1088, -1674, 2403, 2331, 1539, -1024, -10, 640,
// Out channel 165
-1336, 1561, -1010, 3272, 598, -1311, -2938, -111, 253,
// Out channel 166
493, -1084, -1780, 115, 2505, 1604, -2828, -434, 484,
// Out channel 167
956, 205, -542, 2422, 2489, -2097, -1573, -331, -53,
// Out channel 168
793, -583, -589, -2889, 1825, 652, -1863, 283, 974,
// Out channel 169
1012, 792, -156, 1068, 1002, -1451, -1107, -224, 48,
// Out channel 170
-1771, -197, -566, 3404, 1185, -198, -204, -27, -157,
// Out channel 171
516, -1133, -1947, 912, 2046, 1489, -2928, -586, 556,
// Out channel 172
-1736, -301, -628, 1377, 2756, -642, -1351, 417, -306,
// Out channel 173
343, -168, 947, -2603, -558, -1317, -377, -188, 233,
// Out channel 174
1038, 893, -541, 1725, 17, -1135, 445, -250, 1058,
// Out channel 175
-296, -654, 1262, -1787, -1759, 652, -100, -299, -349,
// Out channel 176
419, 1204, 1435, -2695, -2147, -1772, 2934, 405, -856,
// Out channel 177
1357, -1160, -1141, -630, 3258, 173, -3611, -110, 567,
// Out channel 178
200, -634, 1463, 348, -3590, 636, 2589, 124, 570,
// Out channel 179
-854, -233, -1667, 2837, 2101, 105, -1279, 404, 245,
};
const int16_t cg_FC1bias[180] = { // Co,H,W,Ci: (180,)
1103, 2039, 2418, 494, 401, -153, -1798, -1702, -1382, -614, -1380, 897, -1595, -2421, -334, -577, -1088, 161, 1015, -2610, // 20
-1944, -1152, -968, 1111, 796, -139, -2467, -399, -1870, -140, -2336, -217, 695, -2405, 3251, -2029, 403, 2608, 346, 834, // 40
107, 4107, -1342, 3240, -247, 2644, 1823, 732, 2257, -1334, 1740, 422, -772, 368, 788, -3020, -1386, -1386, -479, 3470, // 60
-2054, 1108, -1524, 1588, 2488, -1744, 1126, -2191, 2374, -1065, 1030, -35, 2127, -1684, 2651, 692, 293, -1365, -737, 251, // 80
-946, -1927, -1956, 1947, -1219, 316, -2567, 549, 1460, 2757, -286, -1573, 1437, -1399, 417, -2103, 3370, 1385, -37, 1489, // 100
-178, 2362, 2002, 1024, 1344, 1867, -1283, -908, -1257, -2002, 1422, -262, -819, 1107, 2404, 2278, 2704, 620, -266, 2355, // 120
554, -752, -960, -1490, 358, 776, 582, -1399, 2508, -938, 2464, 376, 2171, 1217, -1244, -1651, -322, 311, -467, 2366, // 140
-1462, -2238, 246, 2036, 832, 267, -731, 1649, -2326, -1251, 94, 3696, 1411, 2412, 1897, 1300, 1726, 523, 2253, 333, // 160
2183, -902, -1990, -205, 2199, -364, 466, -208, 576, 2918, 572, -92, -617, -3475, 2352, -1966, -2088, 253, -111, 1330, // 180
};
const int16_t cg_FC2weit[18000] = { // Co,H,W,Ci: (100, 180)
// Out channel 0
-77, 64, -169, -4, -111, 414, 0, -226, 237, -497, -145, -119, 102, 52, 146, -61, -240, 648, 16, 58, // 20
-20, 152, 91, -115, -64, -220, -74, 389, 109, -350, -61, 134, -18, 10, -102, 166, 239, -129, -5, -87, // 40
-394, -253, 288, -162, -37, -237, 5, 87, 32, 122, -399, -249, -241, 424, -162, 4, 41, -32, -10, 89, // 60
-51, -78, 41, 104, -26, -71, 107, -116, 200, -97, 123, -144, 11, 286, 69, -41, 450, -48, 214, 51, // 80
252, -23, -364, -15, 223, 56, -14, 116, 108, -144, 261, -100, -65, 138, 28, -111, 269, 131, 59, 281, // 100
-44, 45, 49, -156, 128, 20, 283, 93, -52, -212, -179, 129, -160, -10, 88, 16, -85, -40, 68, -150, // 120
236, -56, 34, -105, -262, -167, 333, 106, -22, 244, -3, -231, -178, 432, -146, -231, 177, 34, 141, -268, // 140
220, -122, 49, -34, 307, -329, -116, -136, -180, -31, -96, 13, -191, -301, -21, 270, -226, -147, 24, -12, // 160
168, 20, -219, -186, 131, -20, 10, -57, 393, -2, -215, 284, -6, 136, -92, 101, 4, 304, -32, -51, // 180
// Out channel 1
-258, 99, -20, 47, 203, -100, -195, -269, -360, 159, 198, -295, -497, -31, -44, 38, -263, -404, -305, 13, // 200
163, -186, 10, 342, -175, 600, 138, -475, -2, -33, -35, -693, -90, 80, 154, -448, 1, 495, -230, 29, // 220
121, 42, 110, -60, 259, 30, 100, -31, 353, -376, 496, -7, 230, -415, -52, 34, -238, -261, -260, 99, // 240
4, -217, -213, 12, -174, 109, -234, 187, 21, -103, -8, 18, 53, -619, 174, 105, -349, -276, -318, 460, // 260
-244, 89, 48, 351, -109, 231, -109, -162, 530, 587, -32, -291, 42, 105, 514, -186, 225, -39, 144, -117, // 280
161, -51, 445, -189, 141, 572, -198, -389, -348, -9, 28, -293, -33, 35, 279, 133, -141, -77, 170, 79, // 300
63, -287, -96, 146, -262, 228, -156, -108, 108, -145, 44, -105, -54, -73, -143, 42, 260, 545, 201, 320, // 320
-265, -17, -165, 21, 215, -249, 202, -86, -24, -20, 448, 6, -22, 318, 514, -462, -187, 525, -125, -180, // 340
-64, -95, 116, -29, 102, 73, 421, -58, 105, 168, 184, 305, 325, -407, 97, -389, -386, 219, -512, 293, // 360
// Out channel 2
-105, 159, 30, -381, 276, -516, 186, 687, -340, 177, 356, 224, -243, -108, -433, 1173, 110, 19, -39, 65, // 380
-256, -169, 984, -83, 203, 190, -36, -153, 150, 249, 539, -146, -1171, -57, -77, -37, 57, 50, -41, -423, // 400
326, -145, 794, -485, 430, 296, -423, -359, -63, 212, 89, 128, 54, -37, -1025, -10, -1, -347, -201, -1114, // 420
1685, -202, 36, -46, -663, 152, 88, 256, -426, -34, -119, 242, -62, -107, -165, -1977, -298, 482, 62, -75, // 440
-152, 692, 345, 265, -71, 133, 905, 13, 653, -99, -531, 510, -183, 95, -159, -81, -1124, 28, 51, -146, // 460
128, -1410, -252, -188, -308, -36, -190, -186, 281, 342, 252, -54, 253, -50, 94, -756, -629, 69, -590, -239, // 480
174, -166, 1337, 308, -242, -476, -40, -78, 109, -187, 29, 29, -94, -335, -30, -51, 430, 18, 534, -41, // 500
-429, 2173, 678, 202, -132, 817, 226, 125, 2302, 1077, 72, -655, 30, -1, 267, -166, -557, 24, 68, -139, // 520
185, 498, 51, 618, -261, -738, -88, -77, 98, 162, 199, -330, 187, 235, 138, -347, 386, -139, -155, 245, // 540
// Out channel 3
-24, -36, 97, 88, -44, -143, -111, -108, 16, -32, -23, -80, 37, -266, 65, 44, -61, 136, 27, 8, // 560
-37, -65, -106, 81, -25, -127, 46, -81, 48, 31, 143, -4, -74, -41, 63, 61, -159, 97, 75, -21, // 580
110, 16, -143, 191, -135, 169, 52, 43, -6, -215, -38, 67, 23, 54, 117, -12, -202, -175, -18, 105, // 600
-93, -23, 28, -56, 242, 80, -95, 58, 124, 89, 91, -4, -15, -107, -6, 126, -29, -174, 51, 114, // 620
-205, 7, -103, 3, -67, -72, -195, -122, -23, 49, -84, 152, 156, 34, 104, -136, 75, -35, -129, -97, // 640
-37, 72, 75, -66, 53, -84, -123, -28, -26, -67, 7, -16, -13, -86, 151, -9, 33, 180, -32, -117, // 660
-63, 73, -50, 259, 5, 101, -69, -52, -116, -130, 24, -63, -105, 85, -142, 15, -141, 112, 10, -57, // 680
-117, -94, -171, 252, -133, -171, -167, 97, -45, 42, 10, -50, 44, -158, 34, 63, -24, 86, 113, -33, // 700
-23, -24, -43, -109, -12, 96, -68, -77, -84, 34, 200, 87, -93, -57, -71, -39, -57, -79, 29, -88, // 720
// Out channel 4
-10, -255, -114, -93, 140, -353, -154, 192, -389, -64, -193, -98, 127, 4, -243, 232, 262, -51, -91, -147, // 740
-25, -6, -26, -772, 79, 160, -33, -173, 37, 452, 144, -90, -497, -4, -303, 173, -507, -299, -171, 139, // 760
568, -330, 344, -858, 770, -220, -669, 124, -28, 38, 124, -103, 329, -308, -297, -7, 235, 327, 304, -1412, // 780
263, -928, -195, 6, -797, -87, 12, 518, -185, 41, 230, 90, 78, 92, -159, -78, 19, 885, 324, 43, // 800
-156, 409, 283, -67, -30, 493, 188, -72, 44, -225, 9, -63, 35, -9, -126, 257, -511, -356, -18, -593, // 820
37, -309, 13, 168, -415, -209, 197, -17, 31, 560, 4, -77, 609, 307, -99, -396, -1194, -502, -23, -28, // 840
-64, -33, 93, 28, -160, 163, -49, -59, -288, 123, -87, -83, 51, -1111, 35, -65, 882, -27, 622, 65, // 860
-148, 497, -321, -135, 93, 88, -91, -82, 95, 303, 19, -846, -182, -61, -75, -37, -575, -249, -74, 84, // 880
-39, 77, 42, 1219, -152, 184, -131, 130, 140, -1, -90, 17, 36, 272, 24, 110, 290, 240, -138, -64, // 900
// Out channel 5
-68, 3, 58, 133, -69, 128, 6, -10, 83, 67, 49, -121, 71, 9, -75, 1, -99, 32, 109, 96, // 920
66, 56, -62, -262, -125, 85, 87, -78, 150, -20, 88, 78, 80, 30, -18, 33, -16, -22, -7, -50, // 940
137, -126, 65, 55, 23, -12, -178, 91, 91, 64, -146, 63, -4, 5, 58, 158, 67, -79, 30, 19, // 960
-6, -89, -3, -156, -35, -30, -45, 60, 22, 16, 29, -59, -38, -69, 41, -17, -71, 54, -61, 120, // 980
53, -35, 41, -67, -64, -163, -75, -66, -213, -142, -66, 21, -5, -94, -69, -14, 145, -63, -16, 8, // 1000
-66, -5, 143, 156, -183, -28, -88, -24, -71, 152, -156, -5, -44, -79, 127, -90, 30, 19, 101, -53, // 1020
63, -64, -60, 31, -51, 52, -11, -42, 54, 30, 14, 158, 12, 38, 94, -111, 28, 17, -153, -171, // 1040
142, -140, 39, 26, -29, -2, 137, -94, 47, -58, 72, -21, 160, -40, -61, 131, 49, 120, 75, 36, // 1060
-121, -98, -26, 117, 26, 3, -158, 103, -84, -70, 127, 76, -8, -137, -146, 1, 9, -3, -129, 14, // 1080
// Out channel 6
216, 214, 147, -59, 2, -322, 552, 716, -394, 212, -101, 423, -164, -39, -331, 292, 471, -224, -22, -11, // 1100
-204, -71, -25, -1055, 90, -111, -31, -102, -82, 630, -129, 85, -394, -169, 176, 186, -753, 100, -92, 79, // 1120
711, 413, -167, -85, 217, 598, -146, 388, 13, -90, 220, 615, 29, -307, -68, -138, 124, 64, 307, -372, // 1140
508, -173, -117, 192, 84, 117, 53, 35, -13, 76, 130, 432, 103, -105, 562, -190, -213, 1732, 42, -474, // 1160
-37, 413, 149, 57, -1, 139, -17, 31, -5, 260, -422, 133, 125, 124, -308, -254, -461, 179, -293, -130, // 1180
88, -203, -111, 95, -200, -141, -451, 67, 234, 430, 258, -10, 872, 416, -311, -88, -34, -268, -112, -170, // 1200
-152, 198, -62, -36, 206, -250, -117, 63, 613, -213, 26, 87, -14, -512, -183, 21, -36, -190, 419, -125, // 1220
-326, 240, -268, 57, -316, 1759, 75, 88, 296, 627, -71, 307, 306, 100, -21, -13, 380, -5, 147, 48, // 1240
123, 91, 190, 1198, -407, 105, -370, -341, -322, 170, 195, -572, 43, 74, 151, -78, 621, -659, 154, 11, // 1260
// Out channel 7
186, 128, -249, -59, 315, -11, -24, -83, 187, -185, 352, 52, -444, 22, -100, -78, -279, -21, -357, 99, // 1280
71, -115, 156, 639, -129, 105, -9, -40, 251, -95, -202, 119, -11, -61, 371, -362, 387, 164, 205, -103, // 1300
-231, 11, 77, -30, -122, -85, 49, -505, -56, -193, -73, -82, 85, 161, -31, -70, 53, 95, -406, 141, // 1320
70, 454, 134, -30, 125, 197, 103, 286, 30, 98, -133, -125, -18, 183, -89, -215, -26, -653, -529, 129, // 1340
56, -7, 168, 133, -79, -179, -166, -109, -152, 89, 131, 148, -87, 287, 304, -42, 164, -112, 251, 314, // 1360
-19, -36, 44, -608, 234, 368, 256, -179, -52, 41, -63, 6, -266, 3, 99, -153, 48, 239, -297, -85, // 1380
-20, -213, 160, 254, -381, -29, 0, -55, -49, 75, -156, -79, -310, 704, 28, 29, -82, 213, -123, 139, // 1400
-17, 63, 373, -17, -13, -186, 4, -195, 17, -13, 29, -117, 101, 15, 183, 221, -242, 173, 9, 50, // 1420
-14, 160, 164, -710, 183, -160, 250, -34, 65, -41, 43, 324, 57, -25, 0, 122, -393, -26, -16, 80, // 1440
// Out channel 8
-39, -113, -26, -213, 195, 32, 141, 198, -620, 52, -325, -136, 127, 83, -165, 116, -1, -144, -59, 42, // 1460
81, -56, -57, -923, 52, 135, -58, -102, 62, 273, 187, -83, -277, 13, -97, 267, -473, -234, -250, 337, // 1480
681, -285, 382, -812, 821, -69, -318, 287, -126, 129, 18, -48, 204, -365, -192, 241, 280, 30, 156, -1314, // 1500
61, -799, -67, 182, -581, -158, -271, 589, -4, 26, 52, 240, -244, -66, -146, -46, -290, 974, 218, 29, // 1520
132, 631, 474, -94, -34, 279, 423, -137, -89, -384, -21, 37, -112, -195, 29, 54, -320, -250, -51, -606, // 1540
28, -218, -24, 347, -140, -391, 191, -228, 114, 672, -42, -172, 358, 85, -6, -433, -919, -728, 79, -175, // 1560
57, 29, -243, -3, -153, 162, -143, 6, -314, 58, -96, 32, 127, -1208, -97, 74, 726, -159, 631, -158, // 1580
-139, 290, -534, 129, 26, 217, 30, -123, 131, 236, 52, -691, -141, -75, -50, -266, -393, 46, -52, 75, // 1600
42, -160, 54, 1151, -76, 207, -36, 183, 296, -122, 26, 23, 65, 330, -174, -45, 254, 6, -118, -2, // 1620
// Out channel 9
374, 283, 694, -171, -44, -400, 348, 244, -892, 286, -1271, -304, 104, 51, 100, -235, -3, -449, 264, -270, // 1640
-96, -14, -2591, -1800, 23, -318, 56, -189, -414, 366, -177, 4, -125, 118, -219, 639, -2301, -79, -373, 1383, // 1660
1412, 4, -405, -429, 1634, -112, -313, 1002, 446, -506, 345, -143, 487, -353, 119, 80, -109, 101, 693, -1340, // 1680
31, -630, -114, -2, 131, -770, -428, 330, 137, -188, 309, 192, 131, -220, 449, 2532, -462, 2061, 446, 248, // 1700
34, 357, 240, 105, 108, 605, 89, -181, 318, 51, -89, -402, 417, -347, -626, -336, -323, -350, -511, -2323, // 1720
-13, 411, -20, 1635, -116, -511, -159, -224, -391, 601, -71, -116, 843, 387, 251, 206, -354, -1298, 1619, 131, // 1740
83, -147, -3574, -1216, 323, 590, 185, 89, 270, -260, 1, -122, 635, -3353, -386, -255, 124, -141, 648, 66, // 1760
-1097, -350, -3489, 225, 147, 294, 107, 589, -1150, 88, 415, -186, 73, -51, 234, -234, 370, -156, 0, 84, // 1780
103, -977, -23, 2349, -230, 961, -564, 657, -292, 17, 313, 61, 60, 132, 279, -309, 159, -163, 41, 262, // 1800
// Out channel 10
1, 22, -78, -7, -250, 53, -113, -149, 30, -223, -214, 54, 48, 5, 180, 65, 43, 31, -31, 31, // 1820
30, -34, 3, -77, -10, 44, -37, 49, 104, -381, -78, -57, 60, -138, 252, -90, 150, 35, -60, -91, // 1840
-56, 299, 114, 98, -52, 40, 110, 183, 87, 6, 63, -130, -142, 158, 67, 10, -76, -49, 88, 361, // 1860
-198, -23, 38, -47, -111, 39, -231, -136, 202, 146, 107, 28, 74, -76, 34, 24, 183, -42, -11, 46, // 1880
-9, 43, -239, 3, 12, -168, 56, 15, 54, 178, 96, -104, 214, 78, 84, 5, 157, 61, 65, 194, // 1900
-1, 73, 156, 8, -98, 153, -23, 143, -47, -168, 2, -74, -39, -105, 92, 14, 52, 98, 2, 110, // 1920
24, 69, 35, 139, -40, 33, 79, -20, 201, 40, 37, 7, -63, 106, 3, -49, 211, -99, 60, 86, // 1940
-12, 11, 34, 93, -14, -189, -243, 86, -179, 2, -216, 40, -12, 92, 105, 86, -106, -45, 13, -135, // 1960
-165, -100, -131, 106, -37, -58, 73, 101, 117, 82, -45, 198, -135, -65, -79, 27, -135, 154, 215, 20, // 1980
// Out channel 11
294, -412, 306, 120, -680, -183, 150, 243, 62, 421, -291, 16, 502, 121, 206, 115, 543, 218, 417, -384, // 2000
-242, -130, -31, -266, 149, -690, 134, 533, -476, -253, 95, 661, 107, -212, -371, 802, 15, 5, -317, 38, // 2020
-51, 366, -128, 278, -121, 270, 58, 348, 69, -68, -217, 75, -473, -105, 96, -443, 6, 87, 439, 156, // 2040
-30, 54, -156, 295, 22, -116, -107, -541, -20, 32, 89, -19, 221, -18, 387, 176, 263, 73, 70, -251, // 2060
116, 49, -397, -206, -94, -55, -117, 130, -24, 290, -148, -146, -101, -193, -669, 172, 20, 213, -443, 149, // 2080
359, 2, -315, 467, -97, 8, -404, 583, 55, -271, 232, -179, 60, -84, -155, 136, 250, 125, 89, 226, // 2100
288, 364, -12, -142, 686, 131, -41, 54, 85, 56, 99, -196, 215, -16, 100, 57, -240, -462, -119, 348, // 2120
221, -118, -36, -233, -134, 195, -539, 493, -205, -77, -538, 19, -61, 234, -507, 155, 93, -609, -14, -269, // 2140
96, -41, 1, 122, -141, -82, -584, -109, -262, -197, -255, -719, -340, 93, 361, 218, 324, -62, 1052, -352, // 2160
// Out channel 12
20, -1, -81, 238, 171, -244, -402, -391, -159, 16, 374, -107, -348, -162, -160, -105, -285, -2, -193, -52, // 2180
134, -85, 31, 1182, -155, 130, 5, -163, 63, 80, -116, 156, 282, 17, -225, -374, 72, 47, 56, 345, // 2200
-289, -694, 134, -529, 319, -401, 250, -414, 252, -368, -55, -226, 321, 12, 48, -65, 96, 24, -468, -328, // 2220
-264, 40, -51, -48, -92, 17, -233, 12, -97, -111, -126, -823, 67, -125, -393, 348, -202, -1083, -94, 1058, // 2240
-20, 55, 338, 40, -287, 27, 82, -337, 42, -302, 157, 86, 182, -105, 48, -229, -171, -678, 229, -620, // 2260
156, -125, 42, -148, 362, 19, -49, -302, -569, 81, -207, -107, -390, -12, 339, -244, -592, -48, 164, -167, // 2280
76, -148, -154, 21, -181, 302, 84, -272, -1131, -138, -101, 92, 0, -117, -14, 160, -139, 386, -348, 23, // 2300
-231, 11, -101, -56, 158, -651, -157, -130, 7, -173, 921, -239, 263, -65, 17, -105, -304, 8, -60, 205, // 2320
172, -113, -37, -736, 374, 146, 306, 418, 91, -42, 69, 420, 116, 127, 6, -30, -599, 692, 111, 315, // 2340
// Out channel 13
6, 68, -342, -26, 152, 230, -286, -339, 13, -45, 472, 168, -316, 176, 40, -295, -104, 100, -272, 66, // 2360
285, -10, 246, 786, -182, -18, 101, 146, 323, -241, 20, 34, 385, 35, 262, -416, 315, 204, 116, -88, // 2380
-438, -106, -14, 337, -298, -28, 284, -408, -126, 18, -316, -97, 301, -16, 157, 11, 13, 133, -382, 361, // 2400
4, 424, 226, -104, 141, 189, 61, -176, 82, 234, -132, -240, 23, 18, -167, -212, 156, -899, -518, 134, // 2420
-25, -70, -135, -96, -111, 48, -7, -14, -264, 107, 337, -9, -93, 193, 329, -155, 230, -65, 359, 386, // 2440
-112, 11, 58, -566, 248, 506, 106, -78, 98, -147, -57, 184, -446, 52, -269, 36, 112, 142, -21, 34, // 2460
4, 24, 141, 173, -49, -46, 81, 90, -231, 148, -242, -96, -216, 518, 81, 96, -242, 311, -235, 106, // 2480
269, -158, 272, 20, -142, -146, 6, -490, 194, -287, 8, 107, -371, -15, -142, 27, 12, 118, -101, 8, // 2500
-153, 83, 43, -1029, 168, -101, 240, -44, 16, -206, -44, 236, -249, -299, -239, 248, -243, 15, 51, 150, // 2520
// Out channel 14
243, 313, -135, 24, 432, 213, 32, -197, 185, 37, 284, 104, -272, 4, -251, -191, -382, 54, 113, 80, // 2540
-103, 55, 2, 499, 20, -34, -12, -97, 183, 32, -306, 34, 144, -2, 460, -279, -2, 88, 485, -109, // 2560
-111, -165, -33, 65, -181, 141, 14, -345, 69, 172, -141, 94, 388, -108, 104, -27, 120, 52, -445, 113, // 2580
-23, 435, 68, 68, 309, 188, 202, 208, 159, 104, 131, -161, 46, 67, -107, 23, -123, -735, -233, -84, // 2600
61, -13, -164, -78, 167, -75, -93, 27, -47, -342, 361, -92, 73, 268, 146, -63, 128, -88, 350, 235, // 2620
-175, -168, -39, -207, 52, 99, 159, -84, 200, 120, -97, -123, -396, 152, -157, 91, 483, 257, -220, -104, // 2640
-216, 65, 81, 155, -330, -200, -212, 31, -392, -2, 92, -43, -319, 597, -218, 81, -509, 356, -87, -311, // 2660
22, -38, 134, 0, -112, -70, -77, -90, -84, -173, -44, 102, 193, -216, -38, 104, 144, -79, -101, -2, // 2680
-65, 318, 17, -743, 290, 70, 593, 12, -1, 187, 108, 296, 126, -32, -164, -70, -294, -122, 42, -12, // 2700
// Out channel 15
163, -14, -48, 37, 16, -102, -90, 110, 497, 120, 467, 323, -39, -12, -117, -116, -57, 83, 0, 28, // 2720
58, -289, 323, 544, 116, -183, 48, 132, -35, -51, -60, 89, 237, -112, 89, -124, 700, 381, 119, -212, // 2740
-513, 112, 49, 442, -585, -40, 478, -302, 39, -40, 74, 104, -25, 176, 50, -291, 34, 225, 103, 860, // 2760
12, 741, -110, 22, 675, 177, 145, -439, -207, 47, -174, -268, 215, 137, 150, -104, 280, -866, -369, 12, // 2780
75, -256, -431, 4, -37, -76, -257, 56, 197, 247, -133, 66, -70, 180, -57, -77, 175, 322, 38, 587, // 2800
31, -87, -219, -231, 218, 260, -147, 115, -74, -399, 8, -74, -358, 64, -8, 217, 814, 528, -252, -10, // 2820
-13, 105, 13, 3, 44, -58, -2, 110, 194, -11, -74, -152, -112, 1032, 261, 22, -579, -134, -679, 10, // 2840
-40, -246, 511, -25, 217, 132, 22, 152, 11, -239, -70, 398, -148, 73, -63, 19, 17, 45, -17, 2, // 2860
74, 156, 70, -1030, -64, -256, 28, -45, -58, -40, -139, -122, -54, -80, -42, -174, 46, -193, 224, -71, // 2880
// Out channel 16
-206, -2, 67, 96, 57, -114, -39, -81, 30, 77, -108, -37, -33, 198, 64, -77, -17, 34, -18, 64, // 2900
141, 109, 31, 22, -107, 154, 254, -15, 7, -110, 4, -96, 99, 157, 21, -94, 146, 36, 39, 4, // 2920
-150, -128, 20, 80, -116, -188, 23, 65, 8, 102, -140, 107, 64, 120, 34, 176, 50, 96, 74, 75, // 2940
13, 39, 77, 27, -7, 158, -39, 91, -158, 70, -75, -15, -145, 169, -179, -39, -12, -180, 108, 0, // 2960
93, 163, -58, 0, 12, -124, -89, -91, -119, 8, -66, -55, -91, 126, 89, -25, 54, -116, 97, -39, // 2980
-87, -185, 70, -7, -54, 189, 77, 80, 65, -24, -83, -150, 55, -108, -138, 7, -134, -21, 124, -204, // 3000
15, 64, 24, 21, -104, 181, 75, -25, -65, 77, 38, -15, 62, -10, 167, 90, -94, 4, -144, -216, // 3020
-45, -87, -6, -175, -40, -121, 72, -116, -93, 76, 1, -23, -171, -63, 8, 60, -48, 9, -61, -13, // 3040
-107, -86, 58, 54, 113, 83, 115, 28, 34, -255, -94, 40, -10, 8, -150, 80, 59, -18, 5, -72, // 3060
// Out channel 17
-149, -609, 53, 68, -499, -317, -156, -25, -406, 237, -24, -167, 326, 133, 105, 244, 262, 27, 191, -242, // 3080
99, -116, -17, 180, -6, 121, 293, 86, -111, -50, 331, 93, -199, 106, -814, 76, -92, -122, -660, 247, // 3100
577, -286, 249, -440, 552, -15, -108, 241, -41, -48, -80, -172, -155, 205, -260, -211, 152, 173, 280, -137, // 3120
-258, -810, -338, 104, -521, -183, -197, -26, -15, -68, 108, -193, 104, 136, -99, 91, -106, -152, 67, 267, // 3140
-38, 93, 52, -320, -424, 480, 8, -67, -18, 25, 94, -387, -47, -502, 41, 144, -76, -292, -298, -347, // 3160
253, 23, 175, 370, -444, -53, -45, 108, -260, -43, -72, -118, -38, 141, -87, -199, -517, -317, 258, 413, // 3180
356, 103, 16, -118, 203, 369, 51, -30, -310, 105, 216, -60, 296, -557, 27, -132, 440, 85, 82, 247, // 3200
131, 171, 71, -109, 216, -116, -385, 99, -66, 104, 148, -395, -125, 190, -411, -200, -359, -298, -146, -119, // 3220
-21, -351, 98, 400, -84, 94, -87, 380, 208, -110, -192, -109, -183, 283, 151, 330, 243, 229, -24, -339, // 3240
// Out channel 18
-179, 105, -40, 62, 209, -149, -214, -315, -307, -115, -252, -247, 68, 3, 241, 7, -73, -132, -63, -18, // 3260
243, -9, -274, -115, -65, 342, -93, 25, 10, -136, -278, -197, -207, 139, 10, -59, -75, -106, -37, 24, // 3280
71, 284, 47, -87, 356, -219, 76, 191, 378, -264, 47, -191, 201, -163, 96, 283, -227, -121, -140, 210, // 3300
-125, -272, 53, -302, -345, -280, 0, 281, 158, -156, 121, 223, -203, -119, -105, 414, -68, 368, 23, 251, // 3320
-105, -7, 189, 109, -72, 247, -243, -292, 155, 183, 65, 15, 275, 62, 7, -373, 190, -72, 23, -115, // 3340
-133, 309, 445, 69, -94, 28, 81, -260, -425, 210, 94, 182, 79, -341, 221, 352, -260, -145, 307, 13, // 3360
88, -226, -547, 65, -188, -10, 158, -18, 62, -213, -87, 186, -129, -439, -169, -271, 406, 153, 48, 27, // 3380
-254, -320, -385, 78, 62, -195, 26, -42, -346, -61, 372, 83, -5, -7, 168, -40, 146, 231, -131, 58, // 3400
55, -271, -20, 350, 166, 133, 137, 185, -20, 40, 84, 283, 59, -112, 115, -237, -65, 56, -187, 423, // 3420
// Out channel 19
-26, -41, -1, 169, 62, 130, -167, -55, 64, 7, 16, -82, -99, 117, 1, -3, -60, -127, 82, 148, // 3440
322, 111, -13, 97, -156, 40, 317, -27, 90, -4, -115, -119, 166, 69, 12, 7, -53, 106, -98, -66, // 3460
20, -72, -91, 1, -3, -104, -61, 113, -88, 23, -110, 55, 187, -18, -29, 130, 195, -91, -21, -92, // 3480
7, 12, 67, -186, -26, -6, -46, 191, -110, -70, -174, -50, -32, 68, -79, 76, -16, -36, 73, 200, // 3500
-75, 20, -26, 108, -13, 15, -48, -95, -47, 13, -65, -79, -13, -79, 23, 69, 154, -237, 35, -157, // 3520
28, -43, 213, 22, 96, 127, 22, -42, -70, 124, -191, -52, 4, 53, -84, -88, 182, 4, 72, 154, // 3540
-9, 7, -64, -186, -27, 316, -15, 80, -146, -59, 36, -42, -167, 3, 203, 105, -26, -32, -8, -127, // 3560
38, 57, 20, -101, 5, -272, 27, -106, -69, -90, 34, 132, -215, -110, -72, -13, -67, -14, -235, -176, // 3580
-267, -117, 74, 50, 53, 11, 176, 60, -101, -198, 24, 92, -34, -181, -143, 155, -146, -40, -2, 205, // 3600
// Out channel 20
531, -485, 65, 271, -635, -174, 178, 318, 192, 463, -108, 283, 398, -17, 117, -73, 566, 304, 501, -619, // 3620
-158, -24, 19, 49, 201, -1135, -31, 404, -436, -64, -18, 911, 414, -185, -218, 772, -6, 66, -155, 95, // 3640
29, 362, -271, 459, -324, 329, 413, -11, -133, 15, -128, 265, -347, 157, 378, -493, 96, 232, 311, 375, // 3660
79, 503, -88, 138, 483, -16, 27, -925, -58, 69, -68, -235, 257, 53, 337, -72, 113, -35, -65, -342, // 3680
77, -235, -514, -458, 30, -92, -130, 21, -160, 205, -86, -63, -162, -248, -576, 186, 310, 373, -495, 243, // 3700
338, 130, -234, 560, 141, -344, -260, 903, 92, -554, 179, -120, -84, -63, -317, 76, 773, 235, -4, 341, // 3720
-74, 546, 81, -234, 1190, 275, 9, 135, 186, 221, 53, -367, 277, 99, 119, 100, -738, -1021, -398, 153, // 3740
289, -317, 201, -220, -310, 307, -708, 486, -188, -148, -829, 401, 43, 98, -804, 167, 343, -698, 38, -138, // 3760
103, 29, -44, -340, -86, 15, -718, -139, -321, 50, 151, -707, -542, 187, 289, 248, 229, -394, 1403, -550, // 3780
// Out channel 21
-182, -394, -130, 187, -168, -327, -150, 25, -128, 301, 113, 66, -80, -62, -11, 71, 311, -425, 131, 8, // 3800
92, -235, -54, 65, -193, 125, 356, -485, -44, 125, 139, -44, -30, 59, 58, -103, 18, 236, -227, 34, // 3820
135, 260, -141, 222, 145, 273, 89, 59, 118, -306, 434, 287, 91, -197, 37, 84, -206, 8, 5, 44, // 3840
148, -117, -130, -192, -24, 70, -246, 71, -149, 80, -188, -70, 113, -359, 235, 62, -345, 43, -244, -33, // 3860
-391, -45, 242, -64, -415, -133, -84, 21, 192, 409, -82, -138, 74, -131, 44, -148, -4, -21, -23, -113, // 3880
403, -48, 170, -36, -46, 340, -486, 91, 10, 283, 260, -150, 138, -7, 10, 202, 240, -14, 12, 122, // 3900
-210, -11, -45, 26, 193, 226, -325, -157, -69, -333, -132, 165, -76, -430, 150, 209, 64, 1, 51, 376, // 3920
-175, 8, -79, -14, -260, 103, 42, 248, -98, 108, -50, -149, 65, 235, -126, -284, 74, 143, -55, -263, // 3940
-192, -55, 267, 248, 35, 133, -5, 200, -447, -185, 89, -107, -34, 22, -119, -96, 103, -181, 72, -21, // 3960
// Out channel 22
171, -93, -84, -217, 33, 38, -23, 90, -16, 73, 108, -54, -4, 308, -84, 34, -95, 82, -49, -114, // 3980
-84, -26, -6, 94, 20, -169, -18, 40, 127, -21, 259, 103, -95, -58, -254, -42, -119, -35, 112, -51, // 4000
29, -431, 110, -192, 174, -215, -323, -100, -240, 108, -73, -103, 3, -121, -164, -51, 175, 240, -50, -347, // 4020
64, -170, -291, 87, 27, 42, 92, 15, 72, 98, 149, -62, -52, 224, -129, -136, -14, -149, 216, -172, // 4040
60, 127, 83, -105, 6, 174, 72, -151, -93, -168, 9, -169, -181, 10, -41, 177, -41, -150, 106, -70, // 4060
-49, -59, -99, -62, -170, -136, 229, 76, 44, 76, -30, -55, -8, -113, -244, -212, -76, -72, -153, -71, // 4080
-5, 32, 122, -113, -57, -48, 122, 82, -139, 311, 20, -84, -30, 16, -187, 67, 112, -3, -67, -90, // 4100
-46, 47, 19, -188, 14, 94, -59, 19, 137, 70, 25, -302, 57, -34, -29, -56, -253, -14, -82, 120, // 4120
-155, 99, 61, 37, -110, 94, 89, -207, 88, -30, -57, 4, -40, 172, -102, 152, 62, 25, 164, -162, // 4140
// Out channel 23
-62, 52, -49, -23, -58, -123, 11, 45, -136, 23, -30, 85, 117, -97, -107, -88, -156, -13, -15, 34, // 4160
-149, -131, 113, 109, 11, -71, 39, -115, 86, 75, -20, -57, -141, 43, -36, 42, 166, -43, 75, -3, // 4180
-194, -39, 1, -147, 38, -56, -182, -62, 36, 58, -130, -235, 21, -206, -17, 39, -109, -60, 37, -142, // 4200
-91, -23, -144, 71, -141, -28, 229, -30, 34, 23, 12, -121, 97, 104, 21, -201, 23, -5, -45, -57, // 4220
64, 191, 58, -9, 16, 68, -130, 76, -92, -90, 3, -143, -280, -128, 4, 205, 128, 27, 33, 43, // 4240
16, -228, -110, -23, 13, -32, 109, -2, 54, -89, 35, -93, 31, 44, -75, -16, -181, -48, -59, 82, // 4260
-22, 29, 151, -21, 28, 76, 56, 34, 17, 32, -7, -97, 82, -116, -85, 27, 119, -80, 251, -66, // 4280
114, 10, 9, -101, -66, 54, -77, -34, 127, -48, -127, -100, -25, 121, -51, 70, -98, -110, -131, 3, // 4300
103, 3, -164, 210, 119, -124, 21, 140, 79, 12, -155, -92, 150, -10, 78, 89, 181, -24, -35, -17, // 4320
// Out channel 24
-329, 29, -12, 183, -64, -146, -189, -95, -259, 86, 92, -82, -227, 16, 105, 202, 117, -277, 9, -42, // 4340
135, -370, 30, 240, -285, 359, 38, -147, -86, -257, 179, -495, -158, -50, -57, -205, 303, 411, -62, -29, // 4360
26, 142, 148, -131, 128, -45, -7, -54, 230, -314, 340, -84, 18, -131, -143, 48, -318, -280, -31, 31, // 4380
-22, -147, -149, -191, -137, 127, -245, 258, -27, 21, -228, 26, 257, -496, 90, -17, -212, -245, -142, 178, // 4400
-437, 22, -54, 201, -294, 210, 27, -51, 555, 543, -141, -43, 67, -120, 355, -107, 46, -227, 19, -59, // 4420
254, 16, 384, -309, -35, 600, -248, -310, -334, -283, -23, -288, -101, -174, 275, 223, -253, 76, 130, 300, // 4440
178, -348, 119, 68, -64, 302, 38, -22, 43, -150, -63, 122, 41, -192, 30, 158, 309, 353, 56, 460, // 4460
-165, 49, -81, -3, 82, -45, 49, 2, -137, 197, 372, -102, -7, 320, 347, -155, -60, 329, -37, -199, // 4480
45, -99, 46, 10, 112, 112, 120, 93, -60, 51, 30, 274, 158, -153, 145, -475, -282, 244, -167, 252, // 4500
// Out channel 25
3, -108, -132, -251, 148, -147, 138, 88, -227, 173, -42, -155, -54, -25, -350, 283, 92, -36, 33, -167, // 4520
-56, -64, 191, 178, 95, -46, 83, -16, -49, 143, 276, 31, -277, -90, -94, 2, 58, 70, -98, -13, // 4540
4, -135, 241, -448, 313, -53, -99, -74, -5, 8, -77, -158, -24, -98, -440, 7, 123, 139, 22, -549, // 4560
52, -15, -29, 162, -297, 77, -11, 22, -3, -52, 196, 6, 351, 110, -81, -102, 143, -122, 19, 36, // 4580
76, 152, -10, 95, -148, 353, 85, -75, 96, -10, -261, -59, -38, -113, -138, 35, -138, -332, 50, -123, // 4600
114, -210, 45, -72, -201, 178, 54, -2, -153, 18, 53, -263, 56, 303, 157, -178, -427, 1, -76, 132, // 4620
143, -38, 26, -17, -19, 58, 65, 25, -38, 38, -58, -156, -18, -74, -287, -63, 195, -39, 179, 101, // 4640
114, 294, 37, -260, 88, -36, -10, 8, 188, 216, 251, -474, 54, 66, -3, 166, -430, -42, 194, -43, // 4660
82, 154, 127, -162, -73, -13, 53, 77, 470, -42, -197, -29, 62, 318, -104, -97, 198, 202, -148, -39, // 4680
// Out channel 26
-38, -80, -115, 129, 165, 14, 16, -8, 134, -12, 269, -116, 39, 211, -28, 140, -59, -78, -115, 72, // 4700
222, 45, 75, 68, -164, -51, 437, 2, 152, -69, 45, -80, 62, -6, -68, 48, 160, 28, 49, -160, // 4720
-114, -40, 136, -156, -109, -149, -204, -172, -259, 246, -253, -93, 47, 8, -133, 134, 75, 101, -117, -260, // 4740
7, 79, -3, -43, -101, 44, -57, 140, -240, 108, -3, -52, -61, 92, -155, -10, 142, -99, -113, -94, // 4760
-47, 181, 133, -29, 58, -58, 114, -1, -37, -148, 156, -17, -52, 47, 135, 61, -253, -107, 150, 30, // 4780
126, -202, 150, -137, -17, -46, 96, 47, 88, -3, -65, -10, 9, -143, -282, -13, -253, 66, 132, -10, // 4800
93, -24, -92, 107, -25, 25, -1, 149, -254, 79, -218, -30, -208, -145, 222, -11, 5, -20, -28, 75, // 4820
178, 98, 20, -290, -90, -66, 1, -305, 65, 162, -102, -189, -266, -19, -148, -194, -157, -49, -196, -172, // 4840
-347, -41, 175, -217, -96, -183, 64, -68, 5, -368, -74, 89, -38, 104, -375, 134, 128, -73, 15, -167, // 4860
// Out channel 27
-83, -194, 163, 110, -30, -157, -58, 86, 22, 209, 76, 85, -108, -48, 190, 154, 287, -246, -17, 0, // 4880
144, -161, -38, -79, -60, 2, 186, -163, -94, -61, 86, -165, 7, 118, 52, -64, 66, 220, -182, -3, // 4900
-26, 175, -200, 95, -17, -45, 287, 27, 177, -330, 324, 160, -47, -264, -12, -19, -310, -246, 78, 145, // 4920
-78, -67, -85, -347, 27, 120, -427, 91, 48, 128, -251, -37, 3, -342, 151, 104, -352, -98, -178, 140, // 4940
-366, -39, 141, 56, -130, -56, 27, 256, 146, 594, -241, -77, 63, -82, -157, -117, 96, 91, -146, 29, // 4960
271, 46, 82, 34, -97, 286, -587, -101, -93, -119, 155, -44, 122, -234, 252, 415, -55, 110, -54, 48, // 4980
239, -88, -79, 19, 156, 264, -301, -129, 237, -210, -77, 174, 6, -246, 101, 225, -6, -197, 42, 336, // 5000
-114, -72, -95, 29, -33, 82, -83, 211, -176, 185, -67, 37, -118, 188, 146, -387, 98, 181, -80, -270, // 5020
-28, -80, 79, 91, -26, -53, -271, -19, -369, -203, 107, -234, 62, -194, 49, -78, -27, -78, 28, 181, // 5040
// Out channel 28
221, -161, 122, 149, -341, -56, -10, 55, 228, 36, 6, 57, 257, 39, 305, -23, 122, 163, 75, -89, // 5060
-136, 229, -120, 61, 125, -407, 101, 327, -305, -225, 79, 352, 63, 19, 70, 241, -2, 37, 74, -41, // 5080
-172, 190, -332, 372, -368, 124, 63, 106, 111, 97, -80, 192, -647, 92, 169, -28, 29, -143, 179, 632, // 5100
-234, 258, 72, -130, 261, -23, 164, -673, 271, -152, 51, -138, -26, 101, 120, -67, 322, -135, 19, -445, // 5120
-125, -281, -468, -11, -16, -336, -202, 198, -272, 146, 113, 65, 87, -21, -90, -49, 267, 273, -50, 374, // 5140
-16, 100, -209, 204, 44, -83, -319, 726, 152, -362, 124, 173, -50, -152, -306, 138, 437, 191, -128, 95, // 5160
-241, 510, 243, -94, 398, -11, -32, -155, -11, -103, 240, -114, 183, 185, -79, 84, -274, -540, -215, -4, // 5180
73, -316, 84, 24, -284, 195, -320, 350, -215, -141, -590, 449, 286, 33, -501, -3, 484, -244, 26, 142, // 5200
-23, -28, 30, -239, -30, -19, -363, 16, -585, 198, 104, -349, -340, -33, 25, 31, 58, -175, 574, -588, // 5220
// Out channel 29
401, 81, 1191, 382, -164, -471, 36, 438, -488, 850, -524, 236, -80, -192, 163, 270, 426, 5, 478, -246, // 5240
-158, -357, -444, -233, 265, -140, 25, -63, -1000, 567, -198, 172, 93, -85, 124, 296, -362, 22, -167, 231, // 5260
8, 413, -821, 186, 8, 324, 342, 287, 218, -348, 244, 633, -60, -78, 505, 182, 98, 21, -3, 733, // 5280
53, 19, -364, 186, 558, -366, 72, -216, -99, -391, -116, -210, -4, -186, 712, 546, -389, 768, -28, -41, // 5300
-293, -316, -62, -55, -98, -340, -494, -305, 237, 392, -372, 174, 672, -350, -41, -277, 119, 266, -275, 73, // 5320
126, 435, -179, 600, 128, -180, -588, -58, 142, 137, 427, -227, 311, 199, 127, 776, 620, 14, 545, 129, // 5340
-298, 80, -1395, -921, 384, 200, -89, -260, 226, -444, 93, 54, 616, -577, -244, -42, -489, -298, -85, 268, // 5360
-390, -794, -497, 211, -187, 496, 84, 957, -623, 440, -76, 968, 178, -57, 156, -306, 1005, -85, 154, 60, // 5380
48, -409, 122, 352, -49, -34, -448, 10, -659, 193, 580, -385, -23, 26, 213, -193, 126, -897, -32, 228, // 5400
// Out channel 30
106, 103, -70, -177, -22, -75, -40, 9, -133, -151, -84, -18, -15, 220, -141, 134, -17, -53, -217, -80, // 5420
-42, -188, 46, -110, -43, 135, 153, -27, 107, -106, 143, 11, -80, -160, -10, 32, -125, 116, -81, 119, // 5440
161, 390, 102, -208, 155, 161, -10, 85, -101, 82, -27, 45, -67, 110, -215, 40, -10, 230, 105, -166, // 5460
-33, -166, -181, 125, -290, -56, 23, -88, 28, 30, 203, 45, -17, -63, -30, -163, 128, 25, 52, -174, // 5480
54, 183, -84, 87, -95, 107, 116, 270, -53, 114, 61, -173, -271, 39, -32, -19, 43, 306, 167, 176, // 5500
75, -22, 21, -21, -106, -59, 107, 55, 10, -57, -26, -22, -57, 131, -138, -162, -174, -81, -59, 66, // 5520
83, 96, 102, 100, -243, -54, -18, 152, 343, -4, -142, -105, 19, -110, -46, -72, 458, 71, 269, -6, // 5540
183, 150, -91, -275, 132, 167, 180, -136, 2, -152, -58, -88, 36, 221, 42, 164, -82, 44, -47, -14, // 5560
-279, 23, 27, 388, -6, 37, 121, -25, 190, 31, -116, -58, -51, 87, -56, 53, 4, -47, -106, -7, // 5580
// Out channel 31
232, 208, -67, -83, 166, 374, 132, -219, 84, -321, -60, 141, 61, 119, -144, -248, -241, 520, -102, -10, // 5600
18, 189, 99, 3, -54, -150, -75, 216, 51, -62, -28, 369, 275, -171, 38, 127, 182, -153, 134, 57, // 5620
-93, -67, 246, -34, -189, -86, 66, -245, -133, 161, -256, -177, 33, 376, -68, -65, 313, 219, -98, 75, // 5640
-18, 339, 180, 186, 128, -23, 408, -233, 122, 39, 286, -31, -27, 165, 13, -94, 382, 6, -48, 31, // 5660
565, -78, -324, -119, 340, -25, 142, -45, -145, -296, 206, 99, -69, 237, 8, 132, -16, 305, 294, 40, // 5680
-264, -41, -240, -93, 148, -310, 619, 91, 227, -201, -216, 50, -242, 78, -98, -37, 13, 25, 135, -127, // 5700
-99, 9, 2, -83, -202, -209, 190, 118, 96, 263, 78, -245, -55, 448, 76, -124, -78, 249, -161, -114, // 5720
240, -96, 117, -100, 79, -198, -90, -145, 38, -314, 100, -38, 69, -321, -114, 335, 127, 8, 100, 171, // 5740
189, 307, -41, -362, 99, -231, 254, -35, 331, 101, -191, 244, 33, 36, 88, 83, 41, 1, -58, -136, // 5760
// Out channel 32
-251, -264, -107, 299, -31, -266, -251, 237, 395, 546, 2477, 500, -521, 59, 40, 44, 81, 116, -323, 69, // 5780
-123, -609, 1128, 2459, 27, -71, 104, 152, -20, -171, 65, 85, 846, 170, -247, -879, 1509, 1110, -101, -349, // 5800
-1425, 6, -506, 956, -713, 48, 858, -2205, 177, 98, -440, 237, -118, 66, -192, -561, 61, -18, -810, 1146, // 5820
-141, 1112, -124, 126, 881, 1099, 242, -550, -733, 212, -714, -907, 525, -14, 156, -1057, 80, -2852, -1192, 81, // 5840
128, -280, -98, 99, -420, -311, 27, 124, 48, 86, -213, 137, -220, 367, 328, 83, 403, 1, -109, 836, // 5860
458, -295, -133, -2009, 654, 765, -254, 211, -19, -346, 69, 143, -587, -75, -33, 417, 1176, 1482, -812, -18, // 5880
171, 19, 1653, 438, 320, -153, -6, -49, -131, -92, -50, 166, -377, 2212, 523, 401, -1261, 341, -1180, 191, // 5900
232, -71, 2058, -52, -82, 56, -44, -220, 848, -11, -157, 195, -127, -16, -74, 106, -28, 158, 54, -147, // 5920
-9, 935, 50, -2946, 217, -1054, 176, 22, 130, -138, 103, -188, -122, -251, 73, -164, -193, 52, 334, -125, // 5940
// Out channel 33
174, 133, -122, -425, 258, 216, 191, -148, -527, -376, -1190, -702, 159, -100, -31, 135, -208, 38, -55, 231, // 5960
-8, 572, -1024, -1478, -136, -104, -6, -41, 229, 361, -61, -129, -1045, -84, 78, 36, -2054, -388, -161, 872, // 5980
1490, -104, 597, -1226, 1503, -28, -704, 800, 62, 164, 134, 28, 170, -293, -214, 393, -232, -39, 254, -1478, // 6000
393, -1092, 211, -98, -1191, -519, -282, 381, 450, -40, 437, 698, -622, 16, -293, 956, -255, 1873, 296, 55, // 6020
75, 674, 451, 195, 386, -33, 422, -176, -150, -155, 143, -118, 333, 267, 59, 5, -967, -257, -197, -1605, // 6040
-100, 332, 279, 555, -402, -442, 190, 101, -104, 811, -94, 441, 844, 137, -170, -502, -992, -1569, 667, -230, // 6060
-74, -120, -1176, -286, -294, -61, -113, 71, -4, -205, -25, 8, 77, -2556, -359, -122, 926, 144, 1605, -257, // 6080
-480, 849, -1977, -34, 107, 242, 271, 0, -54, 357, 67, -189, 187, 71, 138, -158, -20, 110, 3, 30, // 6100
-31, -623, -19, 2431, -225, 1146, 37, 406, -65, 48, 74, 43, 218, 166, -106, 85, 361, 115, -127, 133, // 6120
// Out channel 34
891, -18, 82, -234, 329, 218, 16, -87, -434, -91, -475, 101, -32, -74, -182, -30, -102, 38, 219, -1236, // 6140
-94, -186, -494, 92, -143, -603, 177, -188, 59, 280, -95, 103, 361, -504, 128, -35, -818, 10, 123, 16, // 6160
324, 152, -262, -278, 167, -5, -174, -184, 41, 146, -85, -60, 272, 61, 78, -498, 744, 1564, -159, -495, // 6180
-10, 204, -408, 635, 329, -92, 247, -23, 29, 10, 758, -306, 404, 574, 281, 261, -168, 148, -93, 313, // 6200
673, 11, -12, -620, 2, 579, 84, 25, -27, 93, 183, -398, -215, -72, -165, 348, -43, -275, -113, -543, // 6220
-4, 65, -44, 209, 147, -447, 477, 52, -205, 144, -152, -135, -32, 863, -142, -91, 326, -1028, -7, 318, // 6240
50, 136, -467, 139, 64, 208, 116, 265, -75, 425, 29, -826, -85, -261, -227, -365, -356, 104, -211, -49, // 6260
-46, -75, -636, -295, 83, -151, 220, -112, -55, -278, 179, -156, 14, -90, -420, 462, -9, -443, -67, -39, // 6280
14, 163, -122, 0, -170, 353, -194, 44, -35, 187, 228, 18, -112, -57, 374, 394, -400, 284, 225, -152, // 6300
// Out channel 35
-182, 13, -708, -191, 166, -100, 492, 206, 60, -135, 628, -306, 78, -21, -265, 291, 96, 269, -100, 374, // 6320
-141, 302, 923, 62, 365, -82, -119, 123, 379, 30, 509, 235, -363, 223, -348, 116, 336, -529, -65, -112, // 6340
272, -1241, 775, -765, -155, -92, -490, -523, -203, 605, -507, -274, 48, 285, -752, 45, 248, 247, 23, -1176, // 6360
764, -54, 264, 34, -561, 317, 123, 277, -165, -269, -2, -74, -70, 264, -673, -1904, 301, -50, -36, -142, // 6380
291, 399, 435, -81, 490, -54, 1119, -15, -319, -999, -141, 511, -324, 141, 135, 296, -894, -293, -130, 217, // 6400
-81, -918, -342, -373, -157, -383, 277, 89, 404, 208, -294, 179, 136, -17, -214, -1322, -813, 267, -946, -523, // 6420
119, 135, 2814, 630, -100, -638, 161, -15, -498, 247, 184, 208, -388, 216, 2, -26, 168, 12, 169, -661, // 6440
410, 1296, 1440, -19, 83, 119, 72, -308, 1887, 209, -77, -1466, 33, -287, -274, 22, -841, -106, 61, -72, // 6460
46, 857, -385, -198, -106, -359, 56, -50, 549, 183, -212, 135, -56, 792, 20, 1, 46, 241, -1, -133, // 6480
// Out channel 36
-135, -98, 4, -15, -325, 123, -246, -206, 101, -121, -40, -107, 199, -121, -16, 114, 3, 346, 104, 40, // 6500
54, 51, 63, 215, 74, -95, 22, 267, -83, -491, -45, 119, -109, -146, -20, 102, 223, 35, -139, -212, // 6520
-111, 5, 195, -30, -59, -43, 90, 217, 161, -276, 74, -167, -368, 83, -53, -35, -66, -150, 79, 296, // 6540
-147, 106, 144, -141, -124, -103, -145, -206, 21, -90, -39, 126, -3, -120, -108, 2, 118, -140, 242, -83, // 6560
-160, 82, -73, -27, -113, 5, 115, 90, -102, 251, -39, 34, 1, -159, 174, -122, 95, -110, -180, 353, // 6580
25, -18, -112, -48, 33, 204, 71, 140, -91, -338, -63, -81, -217, -301, 240, 234, -24, 19, 59, 107, // 6600
226, -182, 155, -7, -1, 51, 62, 40, 85, 5, -12, 16, 14, 77, -113, -84, 281, -38, 30, -8, // 6620
255, -191, 246, 84, 248, -199, -211, 178, -9, -38, -79, -128, -26, 34, 98, -6, -132, -12, -49, -133, // 6640
-26, 48, -253, -94, 246, -173, 91, 8, 240, 60, -284, 80, -68, -68, -60, -64, 0, 160, -25, -250, // 6660
// Out channel 37
85, 153, -135, 25, 319, 3, 238, 256, -162, 154, 131, 322, -152, 60, -81, -157, 53, -226, -143, -5, // 6680
4, -82, -138, -177, 103, -83, 40, -246, 186, 452, 60, -82, 185, 23, 184, 155, -349, -10, 58, 75, // 6700
205, 14, -300, 122, -29, 179, -45, -427, -161, 181, -43, 147, 332, 38, 92, 41, 230, 136, -199, -309, // 6720
42, 282, -136, 96, 337, 97, 178, 275, -101, 167, -124, -130, 37, -78, -113, 63, -262, 106, -513, -21, // 6740
157, -19, 296, 77, 275, -43, 40, -10, -272, -191, 152, -36, -88, 122, -68, -33, -292, -193, 120, -335, // 6760
24, -130, -206, 3, 303, -163, 28, -123, -48, 351, -31, -71, 330, 284, -154, -216, 92, 7, -108, -177, // 6780
-127, 22, -223, 128, 26, -253, -61, 239, -88, 118, -33, 24, -212, -40, 56, 36, -551, 47, 43, 209, // 6800
-194, 13, -287, -149, -271, 308, 347, -235, 144, 50, -7, 105, 89, -324, 6, -48, 46, 19, -38, 101, // 6820
-84, 60, 197, 22, 110, 94, -324, -129, 46, 65, 288, -46, 165, 88, -111, 57, 15, -55, 16, 188, // 6840
// Out channel 38
-11, 4, -177, 46, -25, 314, -641, -877, 532, -208, 7, -213, -50, -19, 80, -319, -474, 260, -138, 8, // 6860
11, 178, 430, 883, -187, 130, 159, 145, 48, -401, -326, 13, 75, -29, 249, -422, 447, 69, 237, -202, // 6880
-460, -11, 328, 373, -377, -42, 263, -154, -16, -85, 7, -53, -247, 266, 73, -89, -34, -36, -325, 840, // 6900
-352, 308, -85, 30, -38, 104, 66, -168, 305, -182, 151, -3, 16, -128, -465, -26, 194, -1496, -13, 83, // 6920
-90, -13, -205, -18, -279, -40, -180, -5, -106, -98, 309, -114, 107, -106, 544, 12, 740, -1, 182, 653, // 6940
-275, 123, 464, -256, 297, 325, 73, 20, -275, -516, -26, -44, -898, -280, 67, 135, 28, 180, -155, 140, // 6960
98, -99, -44, 21, -384, 152, -60, -74, -286, 163, 68, 19, -205, 700, 40, -51, 245, 212, -355, -12, // 6980
69, -234, 383, 24, 27, -901, -184, -18, -25, -429, 110, -111, 101, 154, 34, 124, -52, -132, -18, 70, // 7000
156, -72, -98, -776, 155, -185, 577, 237, 89, 89, -236, 637, -132, -97, 45, -16, -621, 345, -100, -36, // 7020
// Out channel 39
-252, -73, -280, -601, -23, -895, -47, 422, -302, -5, 655, 251, -207, -193, -588, 1162, 274, -121, -268, 74, // 7040
-259, -68, 1849, 102, 147, 253, -119, 17, -2, 473, 260, -42, -1524, -184, 158, -67, 727, 252, -512, -324, // 7060
292, 147, 1339, -518, 472, 599, -378, -327, -62, 184, 173, -50, -20, -262, -1568, -26, 79, -172, -41, -662, // 7080
1344, -111, -155, 2, -1199, 184, 212, 129, -453, -230, -142, 352, 151, -20, -223, -2750, 39, -62, -23, -336, // 7100
-228, 960, 314, 241, 16, 168, 790, 2, 730, -66, -696, 375, -177, 359, 83, 37, -933, -212, -41, 302, // 7120
335, -1166, -67, -837, -328, -129, -302, 234, 197, 258, 372, -106, 423, 7, 192, -533, -1516, -73, -888, -95, // 7140
92, -297, 1982, 606, -199, -781, -328, -165, -31, -334, -109, 13, -357, 54, -37, -86, 959, -22, 963, -68, // 7160
-233, 2303, 1544, 43, 49, 568, 41, 27, 2381, 824, -195, -766, 73, -12, 15, -92, -653, 209, 172, -40, // 7180
181, 728, 303, 526, -145, -779, 86, -2, 476, 167, 48, -247, 131, 227, 66, -183, 318, -15, -350, 22, // 7200
// Out channel 40
-30, -216, 175, 127, -254, -67, 210, 256, -68, -25, -370, -15, 276, -39, 91, 112, 327, -93, 106, 113, // 7220
-6, -118, -125, -582, 197, 60, -165, 108, -342, 2, 192, 195, -150, -39, -64, 445, -161, -153, -203, -25, // 7240
48, 12, -24, -68, 62, 68, -213, 435, 10, -91, -128, 48, -173, 63, 78, 96, -103, -189, 322, 24, // 7260
-28, -231, 21, -85, -70, -8, 26, -88, -8, -116, -84, 11, -46, -66, 34, 187, -32, 295, 193, -47, // 7280
-68, 82, -47, -50, -102, -89, 61, 134, 5, -45, -141, 139, 70, -219, -336, 129, -165, -64, -181, -218, // 7300
266, 37, 37, 274, -123, -237, -255, 140, 129, -12, -3, 157, 296, -214, -48, -54, 43, -1, 83, 80, // 7320
22, 13, -47, -107, 110, 68, 52, 17, 1, -77, 224, 193, 71, -348, -28, -135, 32, -300, 51, -13, // 7340
83, -4, -60, 5, -13, 176, -48, 318, -15, 114, -301, -164, -93, 139, -96, -15, -4, -151, 26, -170, // 7360
88, -141, -130, 701, -299, -79, -300, -15, -324, 75, -53, -330, -27, 121, -95, -206, 330, -112, -6, -242, // 7380
// Out channel 41
-40, -820, -57, 43, -490, -310, 161, 176, 77, 139, 72, -103, 436, -122, 193, 172, 807, 348, 87, 263, // 7400
1, -95, -81, -287, -150, -7, 76, 290, -170, -193, 251, 114, -141, 215, -329, 284, 307, -3, -349, 159, // 7420
-53, 79, -11, 191, -92, 31, 2, 485, -94, 39, 30, 33, -525, 207, -10, -39, -76, -132, 484, 310, // 7440
-96, 25, 85, -331, -35, -56, -229, -216, -33, 152, -143, 182, 89, -107, -72, -91, 471, 271, 167, -221, // 7460
-134, -100, -171, -57, -22, -59, 6, 170, -89, 25, -34, -143, -207, -124, -45, 304, 194, -31, -319, 218, // 7480
73, 15, 22, 201, -289, 37, -249, 241, 91, -252, 48, 78, 284, -244, 87, 50, -68, 177, 105, -40, // 7500
115, 118, 293, -189, 601, 104, 233, -61, 194, 62, 69, 57, 120, -16, 196, 146, 379, -756, -46, -76, // 7520
141, -37, 424, -75, -39, 106, -220, 149, 20, 176, -437, 128, -113, 3, -14, -44, 53, -87, 76, -24, // 7540
-123, -298, -7, 444, -162, -202, -232, -135, -57, -135, -439, -278, 112, 45, -100, 122, 535, -132, -62, -308, // 7560
// Out channel 42
-366, -241, 3, 106, -13, -275, 120, 208, 281, 106, 849, 177, 158, 91, 16, -13, 104, 49, -9, 479, // 7580
23, -249, 323, 140, -91, 174, -5, 57, -236, -69, 16, 48, -34, 105, -22, 87, 687, -65, -54, -26, // 7600
-391, -66, 77, 18, -184, -96, 37, -132, -55, -132, 27, 58, -132, 48, -68, -17, -199, -527, 150, 104, // 7620
8, 25, 90, -294, -40, 251, -48, -35, -264, -19, -677, -42, 2, -219, -199, -294, 174, -217, -43, -93, // 7640
-397, 65, 79, 51, -38, -280, -77, 18, 128, 135, -87, 40, -180, 158, 11, -41, -7, -16, -122, 341, // 7660
236, -83, -34, -146, 170, 206, -293, 43, 108, -239, 25, 29, -67, -431, 135, -19, -81, 892, -300, -207, // 7680
225, -35, 412, -48, 66, -140, -108, -145, -202, -358, -48, 308, 0, 242, 367, 409, -28, 16, 62, -195, // 7700
-7, 87, 624, 168, -6, -17, -80, -92, 272, 215, -46, -152, 35, 146, 126, -394, -284, 119, -1, -137, // 7720
-42, -148, -58, -328, 282, -303, 6, -75, 80, -169, 11, 86, 11, 173, -6, -38, 218, 98, -29, -26, // 7740
// Out channel 43
119, 8, 73, -101, -189, 197, 56, -48, -40, -180, -169, 26, -65, 97, 42, 130, 164, 97, -91, 103, // 7760
11, -132, -83, -369, 7, -26, -98, 29, -99, -44, 120, 7, -94, -13, 59, 103, -163, 171, -131, -157, // 7780
-50, 227, -82, 168, -86, -11, -35, 72, -97, 126, 20, 28, -147, 109, 19, 9, -114, -155, 368, -24, // 7800
117, -68, 90, -6, -10, -165, 21, -209, 30, 250, -198, 103, -124, 6, 24, -115, 3, 536, 86, -60, // 7820
-62, 197, -135, 159, 91, -156, 89, 367, -44, 133, 71, 102, -69, 117, -221, 1, 48, 372, -118, 70, // 7840
-216, 45, -49, 70, 17, -132, 84, 51, -65, 178, 49, 219, 5, 11, -176, -33, 279, -30, -127, -43, // 7860
-56, 26, 83, -14, 156, -117, 159, 223, 322, 132, 90, -40, -124, 41, -116, -43, 104, -185, 150, -81, // 7880
183, -82, 12, 77, 80, 107, -26, -1, 15, 85, -327, 189, -40, -98, 60, 166, 99, -7, -72, -104, // 7900
153, 44, -177, 225, -60, 1, -176, -390, -22, -145, -49, -394, 60, 70, 65, 12, 37, -86, -1, -127, // 7920
// Out channel 44
249, -302, 37, -70, -321, 391, 320, 83, 107, -11, -84, 228, 361, 112, 169, -186, 209, 513, 254, 40, // 7940
-2, 131, 122, -33, 145, -149, 63, 220, 27, -249, 59, 262, -41, -233, -67, 218, 68, -123, -34, -133, // 7960
-144, -100, 66, 107, -272, -3, -66, 200, -295, 195, -320, 23, -513, 149, 56, -86, 81, 146, 140, 178, // 7980
-24, 122, 212, -250, 73, -12, -18, -311, 74, -107, 9, -23, -159, 238, -101, -229, 426, -75, 184, -289, // 8000
26, 78, -412, -135, 216, -153, 10, 157, -305, -162, 249, -97, -179, -8, -298, 409, 56, 324, 77, 257, // 8020
4, 93, -301, 96, -8, -151, 42, 517, 459, -88, -65, 34, -120, 125, -219, 28, 191, 244, -37, -195, // 8040
72, 47, 236, -149, 324, -104, 102, 107, -33, 294, -210, -93, 126, 281, 161, 107, 15, -385, -168, -119, // 8060
320, -76, 353, -53, -14, 48, -257, -88, 81, -188, -544, 46, -6, -162, -464, 133, 92, -178, -188, -178, // 8080
-42, 56, -59, -263, -338, -179, -43, -144, 14, -202, -335, -119, -164, 202, -84, 217, 437, -36, 348, -466, // 8100
// Out channel 45
72, 677, -39, 123, 595, -110, -538, -224, -107, 198, 89, 35, -721, -165, -140, -52, -599, -370, -77, -51, // 8120
-102, -72, -120, 537, 66, 276, -66, -288, -49, 259, -401, -208, 164, -11, 316, -271, -256, 260, 166, 70, // 8140
69, -15, -323, -42, 174, 5, 445, -218, 193, -261, 399, 48, 487, -454, 183, 130, 38, 73, -436, -281, // 8160
-46, 69, -23, 238, 220, -31, 137, 318, 101, -28, 216, -214, 87, -8, 144, 115, -247, -370, -212, 540, // 8180
-92, 149, 400, -125, -88, 136, -64, -247, 202, -8, -93, -182, 35, -88, 258, -417, 41, -282, 337, -137, // 8200
-228, 24, 243, -22, 366, 105, 129, -478, -244, 176, 29, -148, -192, 253, 78, 237, -60, -143, 96, 122, // 8220
-270, 50, -410, 148, -353, 36, -215, -178, -297, -209, 21, 65, -70, -117, -138, 93, -313, 801, -258, 169, // 8240
-606, -237, -330, -27, 132, -246, -6, -76, -139, -323, 941, -187, 293, 13, 224, -73, -101, 269, 195, 61, // 8260
108, -13, -39, -172, 241, 203, 497, 482, -44, 129, 628, 262, -99, -137, 14, -283, -740, 95, -106, 574, // 8280
// Out channel 46
-11, -317, 27, 104, -405, 73, 299, 151, 221, -10, 244, 137, 313, 156, 71, -123, 360, 466, 377, 202, // 8300
-6, 92, 226, -151, 37, -178, -23, 475, 119, -76, 161, 175, -32, -12, -128, 216, 135, 6, -5, -108, // 8320
-203, -201, 239, 19, -215, 118, -369, 4, -166, 328, -410, 236, -486, 287, -96, -50, 48, 34, 473, 123, // 8340
-116, 110, 113, -85, -42, 78, -58, -487, 244, -136, 10, 226, -41, 273, -155, -155, 323, 100, 247, -471, // 8360
73, 37, -561, -22, 110, -220, 100, 236, -116, -143, 56, -98, -34, 102, -311, 558, -34, 531, -9, 245, // 8380
-23, -42, -36, 54, -216, 23, -33, 671, 314, -297, 16, 64, 0, -166, -263, -108, -40, 212, -149, -184, // 8400
-66, 150, 412, 65, 403, -238, -53, 76, 125, 169, -132, -143, -96, 278, 143, 53, 116, -560, 24, -96, // 8420
608, -171, 413, -49, -189, 88, -307, -34, 43, 20, -851, 99, -15, -66, -265, 130, 25, -211, -106, 93, // 8440
-234, -55, -30, 150, -294, -125, -108, -267, 100, -217, -376, -345, -254, -2, -19, 249, 481, -3, 257, -609, // 8460
// Out channel 47
-153, -58, -195, -219, -286, 172, -61, -526, 157, -284, -114, -296, 173, -58, 49, 183, -84, 473, -72, -147, // 8480
-10, 114, 111, 56, -143, 36, -30, 326, 159, -429, -70, 53, -114, 42, -55, -81, 316, -174, -104, -157, // 8500
-78, -316, 422, -363, 2, -272, -115, 259, -56, 41, -256, -476, -363, 243, -189, -145, -97, 52, 222, 189, // 8520
-122, -325, 105, 145, -316, -26, -54, -75, 17, -200, 167, 160, -107, 56, 8, -128, 513, 56, 327, 96, // 8540
92, 120, -459, -62, -45, 257, 85, -24, 63, -391, 141, -158, 104, 97, 156, -12, 201, -92, -15, -87, // 8560
3, 1, 204, -135, 69, 108, 250, 75, -181, -427, -275, -44, -261, -46, 61, -16, -540, -10, 38, 156, // 8580
308, -40, 152, 124, -60, 196, 258, -59, -51, 88, 79, -234, -41, 161, -187, -285, 600, -11, 290, -215, // 8600
147, -29, 73, -197, 135, -437, -333, -38, -67, -102, 98, -392, -54, -35, -75, 365, -585, -147, 17, 0, // 8620
4, -79, 13, 73, 18, -117, 61, 0, 338, 119, -376, 238, 7, 223, -322, 8, 35, 220, -78, -81, // 8640
// Out channel 48
7, -431, -89, -141, -290, 92, 23, -18, 32, -92, -133, 50, 235, 131, 36, 10, 87, 164, 159, -86, // 8660
141, 163, 160, -31, 27, -178, 21, 284, -97, -106, 262, 223, -382, 123, -282, 202, 60, -126, 274, 213, // 8680
-82, -60, 126, -220, 82, -36, -259, 155, -35, -55, -3, -142, -94, 250, -145, -110, 138, 67, 261, -168, // 8700
-88, -92, 179, -68, -71, -3, 93, -241, -61, 112, 154, 193, -58, 306, 50, -110, 427, -38, 119, -61, // 8720
149, 174, -289, -95, 97, -53, 53, 114, -270, -186, 42, -103, -261, 140, -172, 314, -46, -43, -112, 34, // 8740
-143, -82, -97, 42, -34, -169, 150, 610, 22, -175, 17, -83, 142, 101, -268, -174, 14, 70, -111, 59, // 8760
16, -40, 155, -88, 58, -80, 170, 117, -41, 492, 60, -156, 34, 220, 179, 70, 95, -126, 176, -71, // 8780
463, 184, 155, -108, -144, -73, -276, -111, -4, -61, -194, -31, -53, -83, -313, 8, -137, -155, -74, 97, // 8800
-121, 190, -145, 34, -95, -61, -151, -44, -31, -85, -249, -99, -150, 92, -39, 134, 102, 135, 21, -697, // 8820
// Out channel 49
-27, 120, -111, -29, 79, -237, -132, -30, -208, -179, -43, -201, -124, 25, -36, 241, 139, -320, -229, 138, // 8840
65, -164, -126, -126, -76, 420, 3, -273, 176, 91, 186, -624, -81, 176, -106, -202, -118, -8, -177, 2, // 8860
184, -112, 102, -379, 320, -252, 35, -128, 137, -125, 381, -434, 132, -324, -226, 48, -145, -6, 81, -233, // 8880
123, -426, -32, -81, -358, -8, -248, 468, -30, 35, 64, 77, 100, -294, -35, 61, -243, 335, 77, 183, // 8900
-60, -32, 587, 262, -45, 359, 242, -181, 260, 9, 29, -113, 120, 31, 146, -39, -113, -293, -26, -338, // 8920
328, -78, 182, -210, -155, 249, 30, -730, -338, 389, -40, -100, 152, 21, 250, -21, -422, -311, 11, 53, // 8940
263, -295, -231, -79, -340, 65, 97, 144, 110, -66, -87, 90, -10, -381, -136, -162, 367, 293, 271, -69, // 8960
-232, 199, -258, 185, 219, -2, 185, 38, -28, 214, 663, -33, -63, 98, 531, -100, -388, 152, -137, -229, // 8980
-64, 19, -42, 585, 46, 73, 228, 151, 138, -96, -118, 187, 333, -65, -94, -300, -184, 208, -620, 729, // 9000
// Out channel 50
-332, -206, -425, -410, -74, -359, 257, -104, 54, -178, 817, -288, -36, -134, -85, 743, 153, 290, -85, 187, // 9020
60, -83, 1765, 202, 123, 200, -9, 145, 78, -457, 840, -75, -935, 276, -288, 109, 1013, 12, -204, -338, // 9040
-68, -779, 1144, -727, 138, -396, -758, -280, -23, 396, -473, -497, -351, 245, -1297, -62, -24, -67, -91, -503, // 9060
485, -275, -100, -116, -1146, 92, -30, 142, -266, -189, -203, 132, -68, 133, -369, -2106, 426, -392, 270, -144, // 9080
152, 298, 149, -45, 299, 125, 1329, 148, 169, -480, -113, 302, -432, -183, 221, 89, -792, -542, -94, 630, // 9100
110, -800, 176, -403, -364, 66, -45, 307, 324, -137, -263, -3, -109, -216, -30, -1100, -1175, 538, -787, -199, // 9120
559, -205, 3599, 656, -39, -31, 172, -176, -496, 419, 61, 77, -238, 288, -145, -21, 963, -78, 353, -423, // 9140
309, 1426, 2247, 106, 422, -161, -115, -204, 1245, 409, 24, -1472, -81, -146, -26, -171, -1326, 149, -19, 30, // 9160
154, 425, -194, -236, -308, -887, 305, 70, 365, 3, -487, 89, 98, 425, -31, 76, 347, 542, -130, -231, // 9180
// Out channel 51
-366, 78, -224, 22, 624, -100, -521, -341, 88, -328, 629, 70, -1333, 6, -273, 88, -252, -351, -493, 13, // 9200
61, -349, 214, 1405, -320, 765, 2, -616, 24, -475, -126, -713, -156, -300, 677, -1539, 588, 910, 45, -93, // 9220
-682, 351, 421, -49, -113, 52, 103, -455, 7, -395, 544, -115, 97, -271, -187, -12, -295, -193, -1102, 447, // 9240
83, 483, -30, 50, -399, 250, 91, 45, -179, 23, -16, -64, 263, -648, -151, -180, -181, -1069, -797, 260, // 9260
-210, 298, -103, 417, -393, 279, -127, -100, 513, 501, -109, -38, 136, 251, 1158, -174, 292, -184, 435, 206, // 9280
-50, -334, 677, -783, 612, 1208, -43, -596, -458, -65, 44, -412, -589, -1, 348, 213, -354, 110, -92, 69, // 9300
-37, -765, -33, 213, -584, 28, -41, -306, -12, -147, -254, 63, -280, 209, -28, 51, 276, 740, -179, 368, // 9320
-19, 69, 204, -25, 27, -323, 199, -162, 47, 105, 435, -73, -24, 245, 593, -73, -267, 834, 62, 21, // 9340
-77, 214, 74, -988, 429, -189, 1099, 104, 109, -83, -144, 621, 170, -464, -5, -337, -419, 248, -171, 278, // 9360
// Out channel 52
161, 537, -215, 35, 748, 49, -330, -329, -217, -381, 184, 32, -526, -153, -324, -76, -711, -224, -224, -197, // 9380
-47, -103, -50, 539, -102, 170, -98, -343, -22, 56, -330, -147, 215, 89, 200, -209, -320, 28, 202, -51, // 9400
-79, -299, -425, -2, 55, -140, 292, -250, -38, -267, 255, -221, 759, -139, 172, -137, 107, 80, -371, -310, // 9420
46, 349, -74, 132, 343, 78, 198, 139, 20, -79, 193, -281, 131, -171, 123, 334, -265, -344, -291, 702, // 9440
120, -42, 205, 60, -65, 167, 49, -261, 95, 94, -33, -55, 93, 91, 244, -442, -22, -364, 380, -384, // 9460
-112, -125, 195, -34, 664, 119, 100, -574, -499, 97, -152, 41, -295, 206, 35, 85, -27, -234, 117, -40, // 9480
-102, -83, -480, -67, -393, 193, 117, -105, -501, -146, 40, -138, -46, -81, -101, -106, -348, 881, -153, -40, // 9500
-496, -41, -293, -119, 217, -274, 238, -125, -237, -348, 947, -42, 81, 104, 69, -109, -170, 166, 83, 193, // 9520
128, -154, -29, -247, 368, 275, 184, 222, 216, 289, 275, 384, 144, 31, 29, -400, -822, 356, -122, 551, // 9540
// Out channel 53
-140, 37, 406, 329, -45, -179, -352, -84, -95, 132, -66, 33, 232, 205, -42, -114, 102, -363, 130, 7, // 9560
-154, -230, -361, 74, 136, 199, 73, 146, -285, 102, -176, -179, 176, 10, -44, 44, -157, -105, 73, 122, // 9580
111, 196, -394, 164, 107, 74, 482, 213, 49, -321, 260, -37, 114, -222, 193, 205, -85, -118, 167, 495, // 9600
-339, 28, -124, 13, 41, -218, -75, -34, 15, -20, -216, -6, -52, -240, 114, 263, -91, 124, 10, 105, // 9620
-564, -291, 150, 32, -354, 71, -409, -324, 110, 308, 23, 18, 482, -5, 20, -167, 428, -164, -6, -226, // 9640
42, 377, 269, -7, 120, 224, -16, -219, -114, -144, 104, -204, -148, -206, 165, 397, 360, 15, 655, 70, // 9660
77, -7, -447, -368, -120, 92, -92, 110, -35, -56, -79, -10, 186, -311, -172, 25, 60, 31, 97, -1, // 9680
-56, -567, -280, 126, 123, -126, 30, 107, -199, -13, 416, 397, 94, 280, -86, -238, 400, 157, -144, 160, // 9700
39, -301, 56, 185, 123, -184, 29, 229, -289, -76, -120, 175, 43, 168, 55, -113, -68, -8, 61, 27, // 9720
// Out channel 54
-8, 588, -129, -97, 856, 214, 56, 118, 44, 37, -94, 87, -520, -25, -229, -80, -395, -204, -138, 6, // 9740
-95, -37, 31, 235, 43, 154, -79, -212, 98, 227, -155, -318, 87, -45, 21, -318, -151, 97, 42, -71, // 9760
40, -5, 42, -127, 21, -107, 186, -288, -49, 65, -81, -6, 804, -264, -190, -66, 113, 306, -709, -187, // 9780
-1, 178, -110, 14, 325, 57, 222, 479, -170, -43, 39, -305, 10, -63, -30, -110, -266, -360, -216, 166, // 9800
155, -10, 330, 54, 215, 444, 60, 14, 228, -190, 22, 27, -155, 212, 105, -182, -109, -162, 313, -194, // 9820
-89, -190, -207, -166, 112, -114, 175, -607, -48, 127, 3, -56, 81, 165, 28, -163, -88, 18, -64, -111, // 9840
12, -263, -202, 249, -406, -249, 2, -10, -98, -194, -46, -50, -329, 159, -62, -3, -192, 615, -473, 128, // 9860
-99, 43, -113, -270, 51, -123, 515, -368, 246, -189, 436, -199, -5, -122, 234, 382, -68, 83, -10, 141, // 9880
111, 323, 76, -307, 240, 200, 308, -53, 383, -17, 284, 377, 125, 29, -38, 201, -609, 82, -209, 603, // 9900
// Out channel 55
-196, -72, -107, -41, 141, 42, 137, 35, 249, -90, -6, -56, 33, 217, 129, 9, 34, -55, -80, 138, // 9920
213, 26, 23, 166, -22, 13, 321, 6, 154, -198, -9, 57, 34, 53, -17, -103, 47, 12, 142, -140, // 9940
-99, -173, 65, -67, -4, -281, -186, -193, -171, 266, -286, -105, 193, -71, -128, 163, -42, -115, 3, -18, // 9960
192, -68, 175, -211, 89, 58, -208, 53, -100, 202, -167, -68, -120, -149, -31, 15, 20, -93, -197, 62, // 9980
55, 169, 25, -121, 4, -106, 43, -130, 16, -111, 9, 52, 28, 85, 15, 181, -83, 30, 112, -36, // 10000
-63, -200, 30, -257, 12, 71, 41, 154, -46, 73, -29, 20, -177, -152, -267, -74, -127, 201, -72, -37, // 10020
70, -28, -88, 243, -183, 33, -105, 120, -86, 70, -317, -1, -213, -2, 142, 195, 38, 42, -134, 42, // 10040
229, 41, 155, -180, -69, -54, 101, -207, 240, 64, -210, -165, -218, -67, -179, 9, -90, 78, -276, -86, // 10060
-257, -75, -7, -63, -64, -148, 315, -80, -59, -254, -97, 25, 106, 34, -441, 135, -7, 0, -62, -148, // 10080
// Out channel 56
386, 85, -41, -99, -8, 174, 50, -39, 417, 40, 59, 416, 163, 111, -144, -158, -57, 323, 155, -24, // 10100
-338, 200, 132, 156, 198, -496, 133, 565, -50, 63, -4, 1108, 164, -505, 21, 166, 47, -241, 60, -86, // 10120
-18, 49, -156, 74, -337, 371, -66, 148, -290, 266, -482, 233, -77, 227, 85, 85, 446, 331, -73, 197, // 10140
-120, 133, -66, 197, 278, -74, 496, -249, 30, 115, 558, 18, -97, 579, -122, -124, 287, -75, 161, -425, // 10160
297, -63, -244, -590, 346, -198, -250, 123, -541, -283, 135, 35, 53, -1, -26, 91, -88, 431, 131, 135, // 10180
-227, 44, -263, 131, 30, -527, 346, 675, 376, -307, 6, -71, -12, 89, -288, -93, 310, -7, -1, -56, // 10200
-168, 305, 89, 90, 123, -163, -8, 46, 30, 104, 118, -146, -55, 502, 99, 84, -248, -376, -334, -59, // 10220
336, -94, 184, -187, -294, 10, -299, -100, 86, -245, -527, 76, 28, -134, -622, 575, 308, -500, -83, 118, // 10240
-18, -45, 12, -362, -159, -50, 89, 108, 137, -137, -59, -10, -520, 316, -232, 316, -45, -272, 524, -485, // 10260
// Out channel 57
80, 116, 137, -132, 18, -91, -230, -273, -326, 110, -195, -28, -136, 206, -321, -90, -136, -15, -89, -264, // 10280
14, -254, -84, 22, -155, 16, 48, -86, 10, -99, -150, 30, -17, -304, 40, -234, 74, 203, -30, 41, // 10300
169, 489, 91, 116, 200, 156, 105, 71, 140, 38, 448, -58, -21, -188, 64, 111, -35, 70, -80, 215, // 10320
-40, 25, -352, 193, -87, 92, 132, -49, 93, -25, 298, 138, 192, -10, 381, 31, -4, 59, -103, 19, // 10340
73, 140, -183, -66, -41, 330, -80, 4, -9, 524, -14, -321, 75, -2, 216, -106, 181, 141, 238, 239, // 10360
58, 71, 323, -115, 152, 10, 146, -76, 91, -1, 201, -301, -144, 297, 39, 234, 17, -356, -1, 270, // 10380
-19, -110, 20, -238, 73, -87, -58, 222, 281, 62, 113, -262, 15, -255, 112, -41, 338, 143, -34, 384, // 10400
-24, -178, -158, -343, 45, -80, 128, -53, -114, -18, -29, 312, -55, 442, -57, 43, 126, -79, -182, -271, // 10420
-49, -39, 9, 185, -58, 63, 328, -155, 87, 2, 52, 55, -101, -183, 189, 70, -11, 16, -27, -64, // 10440
// Out channel 58
187, -193, -240, -163, -106, 194, 201, 99, 398, -188, 328, 247, 16, 100, 203, 61, -41, 316, -15, 31, // 10460
-118, 112, 587, 346, 3, -312, 68, 344, 272, -338, -68, 146, -70, -82, 15, -77, 580, 110, -1, -458, // 10480
-169, 246, 365, 278, -588, 129, -75, -252, -210, 335, -128, -54, -221, 338, -158, -233, 188, 57, -13, 115, // 10500
102, 231, 75, -1, 201, 279, 30, -379, -153, 8, -206, 124, 48, 105, 34, -539, 286, -487, -134, -133, // 10520
325, 54, -226, 95, 115, -132, 397, 281, -49, -170, -30, 165, -305, 97, 43, 111, 18, 150, 21, 334, // 10540
-46, -57, -225, -191, 10, 39, 273, 291, 32, -342, 14, 28, -345, -203, 8, -101, 121, 391, -827, 37, // 10560
2, 40, 422, 127, 28, -324, 110, 213, 21, 304, -226, -178, -159, 893, 120, -49, -45, -97, -213, 119, // 10580
5, 423, 771, -102, -35, -65, 51, -177, 293, -56, -247, 33, -115, -81, -62, 242, -199, 11, -24, -5, // 10600
-155, 413, -23, -631, -120, -398, 36, -311, 140, -1, -132, -11, 27, 124, -62, 94, -159, 30, 37, -229, // 10620
// Out channel 59
79, 27, -15, -143, 27, 8, -31, 78, -231, -72, -2, -123, 19, 131, -237, 99, -40, 91, -16, -263, // 10640
-49, -165, 158, 311, 55, 112, -89, -29, -100, -27, 285, 10, -267, 32, -111, 23, 94, 306, -156, 53, // 10660
8, -143, 486, -481, 359, -341, -228, -22, 85, 119, -56, -392, 92, -120, -440, -287, 184, 135, 32, -679, // 10680
13, 0, -151, -15, -350, 38, 145, 5, -39, -14, 228, 32, 404, -40, -134, -126, 79, -246, 37, 86, // 10700
235, 271, -71, -43, -11, 604, 413, -119, 331, -26, -55, -81, -189, -33, 144, -15, -125, -240, -16, -27, // 10720
114, -189, -143, -147, -167, 23, 189, -62, -200, -34, -136, -208, -162, 278, -50, -388, -858, -252, -145, 335, // 10740
433, -175, 158, -84, -183, 54, 134, 13, -117, 76, 134, -153, 58, -166, -237, -158, 324, -78, 25, -60, // 10760
30, 249, -21, 73, 289, -69, 114, -120, 216, 197, 25, -548, 9, -54, -55, 271, -686, -56, -7, 24, // 10780
49, 84, -105, 0, 54, -231, 205, 68, 663, 275, -2, -40, -16, 216, 111, -50, 17, 254, -85, -30, // 10800
// Out channel 60
266, -5, 37, 81, -49, 223, -204, -280, 117, -41, -623, 88, -25, -57, 38, -110, -9, 59, 98, -465, // 10820
-146, -53, -158, 62, -218, -18, 114, 98, -123, 51, -200, 102, 39, -450, 173, -129, -156, 217, 40, -166, // 10840
-50, 451, 68, 195, -126, 270, 116, 275, 88, -38, 127, 187, -278, 52, 159, -38, -13, 67, -27, 478, // 10860
-296, 139, -176, 171, 38, -213, 91, -156, 455, 30, 404, 315, 39, 157, 175, 422, -19, 87, -61, -177, // 10880
106, -120, -456, -209, -5, 28, -213, -87, -112, 298, 36, -104, 23, -146, 51, -127, 397, 393, 115, 322, // 10900
-239, 353, 239, 241, 69, 14, 91, 112, 7, -271, 62, -57, -135, -13, 74, 342, 220, -280, 223, 446, // 10920
-225, -23, -415, -66, -27, 229, -40, 142, 369, -44, 32, -25, 100, 114, -352, -239, 156, -148, 60, 211, // 10940
-38, -538, -127, 55, 21, -143, -168, 225, -643, -162, -72, 497, 285, 37, 149, 295, 284, -103, 28, -110, // 10960
26, -128, -127, 110, -18, 219, -56, -17, -33, 237, -31, 59, -365, -266, 69, 54, -14, -48, 73, -132, // 10980
// Out channel 61
-153, -402, 11, 95, -930, -107, 94, 161, -274, 96, -252, -2, 381, 109, 175, 323, 404, -42, -79, -46, // 11000
308, 94, 126, -738, -18, -19, -14, -44, -105, 71, 213, 76, -123, 173, -423, 281, 54, -6, -493, -45, // 11020
25, -85, 78, -39, 195, -111, 54, 477, 127, -101, -75, -173, -363, 72, -180, -97, 0, -53, 809, -45, // 11040
-17, -316, -49, -17, -222, -59, -50, -112, -194, 75, 24, -56, 103, -111, 112, -76, -38, 432, 306, -63, // 11060
-166, 20, -74, 83, 30, 103, 165, -136, 197, 61, 13, -77, 63, -359, -196, 244, 24, -231, -548, -149, // 11080
-8, 59, 91, 366, -328, 14, -70, 213, 59, -69, -5, 108, 54, -33, -14, -66, -85, 73, 191, 78, // 11100
291, 69, 73, -66, 328, 166, 104, 107, 140, 51, 205, 152, 122, -547, -195, 20, 246, -504, -21, 100, // 11120
126, 61, 40, 57, 69, 80, -225, 143, -65, 122, -194, -255, 48, 53, -40, -135, -106, -48, -132, -11, // 11140
56, -400, 71, 787, -236, -108, -510, -69, -119, 170, -151, -373, -183, 37, 178, 2, 318, 48, -25, -289, // 11160
// Out channel 62
30, -153, 325, -150, -138, 110, 498, -142, -287, 54, -2316, -448, 1078, -80, 172, -148, 4, 82, 620, -9, // 11180
-27, 240, -594, -2103, 167, -328, 25, 16, -68, 187, -132, 100, -301, -30, -207, 1308, -830, -875, -47, 307, // 11200
1457, 25, 174, -740, 416, -80, -289, 1771, 57, 148, -145, -112, -115, 23, 12, 228, 199, 324, 1171, -546, // 11220
135, -577, 35, 13, -438, -647, -173, 580, 529, -361, 1027, 605, -61, 765, 70, 483, -199, 2564, 1216, 32, // 11240
158, 249, 157, -467, 321, 288, 182, -112, -227, -412, -102, 7, -8, -381, -904, 160, -467, -25, -639, -405, // 11260
-106, 320, -117, 1505, -681, -1354, 213, 97, 39, 102, 11, 27, 952, 234, -166, -176, -432, -878, 212, 147, // 11280
-204, 412, -699, -426, -151, 3, 118, 72, 363, -44, 360, 85, 482, -1227, -276, -476, 585, -351, 732, -237, // 11300
13, 44, -1013, -133, 185, 118, -89, 27, -266, 30, -164, -178, 162, 22, -76, 304, 127, -746, 15, 125, // 11320
104, -212, -175, 1706, -444, 556, -348, 12, -18, 147, 129, -111, -323, 536, 255, 72, 483, -89, -100, -27, // 11340
// Out channel 63
116, -127, -369, -209, 293, 88, -98, 45, 305, -49, 773, 80, -689, 32, -137, -128, -221, -65, -257, 74, // 11360
52, 46, 188, 725, -112, 59, -77, -191, 386, 39, 194, -100, -38, -50, 199, -425, 429, 294, 183, -154, // 11380
-349, 111, 194, 344, -270, 38, 43, -1033, -187, 87, 113, -35, 254, 119, 141, 73, -65, -29, -305, 307, // 11400
82, 273, 83, -57, -87, 276, 61, -160, -62, 245, 23, -81, -118, 49, -169, -346, -36, -621, -501, 63, // 11420
-17, -67, -47, 194, 36, 1, 122, 42, 35, 51, 77, -47, -164, 347, 383, 4, -19, 141, 313, 269, // 11440
-132, -82, -13, -937, 216, 351, 240, -88, 23, -80, -175, 138, -284, 64, -135, -80, 91, 427, -373, 14, // 11460
-156, -155, 497, 625, -147, -318, 5, 28, 275, -88, -254, -225, -471, 856, -4, 73, -62, 362, -89, -63, // 11480
20, 164, 388, -38, -11, -232, 284, -565, 261, -201, 68, 12, -170, 95, 192, 9, -33, 284, -107, 95, // 11500
-232, 415, 130, -712, 252, -123, 475, -109, 210, -13, -129, 231, 253, -83, -134, 159, -186, 114, -222, -62, // 11520
// Out channel 64
-165, -110, 80, 38, 75, 109, -338, -212, -110, -38, 51, -147, 85, -13, 107, -74, -24, 169, 136, 82, // 11540
-138, 138, -62, 183, -40, 124, -65, 17, -99, -157, 113, -159, 353, -105, -26, -197, 119, -34, -92, 126, // 11560
-224, -163, -58, 49, 13, -157, 125, 226, 541, -285, -201, -235, -78, -85, 246, 141, -265, -37, -26, 251, // 11580
-302, 104, 57, -68, 35, -106, -71, 138, 130, -347, 0, -263, -16, 7, -209, 279, 191, -274, -35, 351, // 11600
-165, -130, 26, 149, -42, 106, -265, -181, 122, 12, 81, -1, 317, -98, 57, -112, -30, -453, 49, -78, // 11620
-120, 117, 405, 28, 8, 111, 78, -51, -544, -71, -130, 272, -130, -53, 18, 98, -264, -41, 170, -16, // 11640
228, -228, -170, -71, -119, 276, 271, -151, -416, 64, 316, 185, -67, -210, -156, 89, -86, 75, -321, -178, // 11660
8, -307, -65, 2, 185, -501, 1, 108, -199, -52, 106, 57, 155, -180, 64, 140, -3, -43, 0, 234, // 11680
244, -128, -245, -126, 263, -32, 164, 244, -55, 66, -109, 333, 236, 178, 205, -150, -322, 66, -33, 226, // 11700
// Out channel 65
-78, -137, -80, 65, 256, -134, -446, -307, 56, 76, 226, -274, -284, -344, -29, -194, -455, -13, -70, 168, // 11720
-53, 141, -92, 651, 12, 317, -232, 152, -191, 20, -109, -114, 201, 138, -67, -165, 1, -72, 0, 253, // 11740
-206, -768, 74, -256, 124, -187, 250, -300, 158, -362, -63, -65, 315, -78, 2, 87, -16, -38, -362, -87, // 11760
-168, -90, -6, 58, -5, -148, 56, 151, 203, -282, -46, -602, 109, 50, -95, 277, -133, -941, -94, 950, // 11780
-238, -241, 399, -125, -266, -1, -67, -540, 28, -154, -64, 220, 285, -92, 200, -15, -28, -794, 68, -439, // 11800
-139, 142, 90, -214, 465, 22, -96, -226, -536, -27, -301, -138, -394, -147, 302, 112, -228, 161, 196, 42, // 11820
-10, -23, -317, -77, -249, 441, -58, -587, -1013, -106, 81, 76, -55, -1, -183, 53, -30, 630, -220, 74, // 11840
-471, -78, 87, 194, 292, -684, 123, 14, -148, -243, 848, -369, 495, -443, 17, -88, -398, 49, 339, 357, // 11860
233, -244, -213, -592, 423, 164, 213, 952, 173, 358, 69, 456, 111, 53, 298, -391, -573, 367, -93, 212, // 11880
// Out channel 66
-46, 153, -173, -40, 242, 351, 186, -192, 69, -305, 183, 6, -152, 93, -60, -280, -302, 302, -204, 210, // 11900
167, 203, 125, 173, -179, -7, 38, 35, 374, -118, 27, -147, 12, 37, -2, -52, 82, -16, 97, -151, // 11920
-135, -321, 103, -32, -129, -407, -71, -197, -151, 186, -278, -176, 154, 155, 15, 99, -78, -16, -177, -154, // 11940
29, 234, 188, 190, 90, -4, 67, -108, 87, -53, 56, 50, -101, 196, -303, 3, 186, -347, 109, 31, // 11960
263, 35, 54, 210, 180, -56, 188, 14, -70, -380, 345, -66, -54, 21, -50, 223, -97, 64, 204, 110, // 11980
-238, -115, -61, -205, 128, 42, 286, -55, 241, -188, -331, 35, -52, -56, -35, -227, 97, 91, -136, -258, // 12000
84, -104, -42, 75, -234, -97, 171, 197, -15, 316, -79, -96, -202, 387, 141, -124, -20, 220, -94, -263, // 12020
186, -88, 96, 47, 154, -254, 89, -371, 43, -87, -123, -126, -11, -337, 27, 12, -24, -57, -142, 139, // 12040
56, 132, -45, -477, 157, 35, 203, -136, 179, 47, -132, 207, 117, 81, -90, 75, -127, 88, -129, 6, // 12060
// Out channel 67
43, 9, -153, -228, 54, 70, -46, -162, 125, -59, -63, -21, 1, 440, -109, 63, 25, -7, 126, -88, // 12080
28, -149, -20, -219, -89, 118, -36, -129, -10, -5, 58, -38, -65, -60, -7, -227, 18, -91, -16, 134, // 12100
53, 53, 54, -118, 73, 62, -264, -59, -47, 15, 21, 74, 18, 136, -162, -48, -19, 118, -84, -56, // 12120
130, -244, -153, 99, -161, -37, 38, 43, 3, 36, 130, 213, -16, 72, 39, -223, 16, 88, 116, 24, // 12140
71, 251, -117, -136, -99, 110, 62, 145, -74, 21, 114, -215, -127, 69, -3, 113, -79, 103, 109, 168, // 12160
66, -130, 108, 89, -164, 141, 121, -69, 170, 112, 27, -98, 37, 102, 5, -46, 91, -234, -172, 148, // 12180
-10, -166, 84, -12, -135, 148, 87, 256, 260, 105, -146, -118, 55, -141, 5, -74, 228, 137, 98, 110, // 12200
43, 150, 53, -263, 117, 141, 99, -27, 136, 101, -117, 52, -239, 279, -110, -23, 1, -5, -265, -167, // 12220
-61, -20, -21, 293, -78, -92, 77, -14, 112, 83, -74, 160, 38, -128, 46, 180, 126, 33, -53, 42, // 12240
// Out channel 68
-17, -359, 10, -89, -26, -57, 46, -13, 93, -155, 19, 14, 246, 231, -241, 184, 88, 130, 165, -88, // 12260
-40, -44, 233, 24, -74, -9, 90, 160, 133, -138, 428, -12, -274, -147, -465, 168, 79, -105, -210, 76, // 12280
68, -480, 460, -556, 430, -93, -685, 76, -77, -24, -180, -119, -198, 151, -342, -223, 252, 238, 11, -474, // 12300
-34, -469, -27, 73, -437, -19, -94, 205, -142, -102, 110, -157, 113, 185, -230, -195, 162, -109, 192, 36, // 12320
-18, 489, -12, -182, -122, 34, 178, -115, -101, -287, 104, -172, -77, -139, 159, 248, -145, -228, -41, -47, // 12340
95, -9, 116, -24, -191, 34, 262, 218, 127, 28, -40, -142, 24, 109, -151, -163, -294, -261, -29, -39, // 12360
0, 163, 44, -214, -73, 126, -18, 15, -436, 399, -61, -12, 87, -92, -84, 83, 778, -17, 69, -7, // 12380
139, 186, 26, -334, 161, -242, -258, -92, 172, 38, 6, -388, -10, -58, -421, -33, -259, -194, -71, 126, // 12400
-87, -161, 55, 84, -156, 97, 89, 251, 324, 56, -220, 17, -240, 286, 148, 116, -67, 234, 6, -271, // 12420
// Out channel 69
-49, 104, 71, 104, -4, -122, -177, 27, -7, 171, 200, -51, 83, 40, 197, -57, -39, 100, -4, 149, // 12440
5, 81, -50, -68, 100, -148, 113, 75, -165, -56, -123, -14, 96, 190, -32, 27, 89, -41, -32, 13, // 12460
-114, -271, 50, -100, 15, -256, 148, 76, 43, -49, -103, 55, 63, 87, 133, -71, -50, -80, 59, -79, // 12480
63, 41, 128, -61, 119, 170, -42, -30, -130, 30, -37, -129, -34, -63, 12, 108, -121, -147, 92, 218, // 12500
-204, -191, 41, 21, -104, -81, -15, -128, 68, -51, -83, 162, 159, 17, 22, -79, -86, -62, -81, -8, // 12520
-12, -8, -105, -66, 81, -70, -175, -59, -255, 129, 50, 188, -149, -161, -90, -34, -36, 12, 42, -187, // 12540
62, 92, -100, 66, 3, 134, 99, -87, -215, -16, 77, 95, 24, -193, -143, 246, -262, -95, -35, -127, // 12560
112, 46, -41, 129, -91, 7, 73, -62, -56, 2, 52, -66, -42, 1, -93, -253, -64, -194, -183, -76, // 12580
5, -88, -71, -69, 45, -53, -114, 7, -327, 85, -16, -78, 6, 110, -28, 45, -38, -2, -1, 156, // 12600
// Out channel 70
164, 34, 3, -127, 62, -62, -77, 163, -167, -193, 173, 23, -83, -143, -75, -69, 21, -152, 87, -72, // 12620
-214, -105, -39, 142, 25, 81, -305, -133, -152, -105, 27, 6, -90, -2, 103, 16, 19, 29, 63, 82, // 12640
29, 161, 87, 54, -4, 117, -33, -248, 11, -51, 214, 81, 57, 28, -126, -247, -10, -10, -4, 148, // 12660
156, 65, 15, 130, 5, -24, 20, -9, 62, -24, 86, 51, 215, 77, 35, -81, -131, 236, 37, 1, // 12680
27, 176, -97, 18, 55, 102, 94, -62, 95, 7, 56, 96, 20, 196, 70, 8, 8, 60, 26, 64, // 12700
-7, 25, -166, -148, 24, -82, -224, 2, 118, 40, 17, 90, -48, 109, 49, 10, 59, 52, -101, -103, // 12720
-26, -110, -92, 122, -1, -8, 66, -74, 10, -104, -10, 36, 10, -4, -31, -170, -129, 64, -40, 24, // 12740
-223, 71, -9, 141, 137, 100, -15, 187, 159, 59, 49, 160, 172, 117, 241, 95, 11, -29, 170, 50, // 12760
156, 53, 24, 138, -14, -106, 22, -76, 75, 320, -163, 133, 66, 145, 200, -205, -96, -43, -32, 71, // 12780
// Out channel 71
190, 37, -10, 99, 248, -203, -511, -379, -107, 73, 313, 232, -676, -29, -106, -162, -186, -40, -119, -247, // 12800
-185, -64, -24, 1314, -61, -87, -47, 28, -223, -400, -244, 151, 196, -128, 215, -563, 305, 740, 23, -194, // 12820
-456, 326, -156, 353, -117, 58, 343, -454, 41, -300, 16, -64, 75, -13, 26, -334, 55, 5, -572, 578, // 12840
-121, 661, -345, 172, 347, 82, 7, -325, 86, -6, 81, -301, 364, -235, 294, -15, 140, -1395, -551, 91, // 12860
-60, -6, -160, 1, -292, -48, -186, -113, 339, 539, -119, -196, 90, 102, 403, -91, 274, 120, 169, 173, // 12880
57, 110, 173, -310, 453, 544, 41, -91, -116, -616, 124, -319, -695, 53, 136, 278, 437, 59, 60, 232, // 12900
-41, -70, -43, 134, -72, 228, 43, 78, -127, -23, 8, -176, -17, 531, -152, 58, -355, 244, -605, 520, // 12920
-140, -20, -36, 34, 113, -395, -97, 177, -146, -256, 171, 205, -117, 91, 73, 203, -25, 139, 8, -155, // 12940
43, 142, -8, -1297, 415, -45, 393, 20, 95, 118, 80, 282, -148, -285, 83, -325, -465, 77, 171, 261, // 12960
// Out channel 72
103, 86, -63, 23, -21, 93, -76, 171, -227, -113, -143, -128, 38, 168, 55, 180, 16, -43, 39, -205, // 12980
38, 47, -49, -120, -63, 50, 118, -266, -58, 113, -34, 60, -289, -160, -4, -218, -20, 131, -40, -95, // 13000
254, 227, 168, 127, 232, 294, -34, 58, -122, -18, 80, 159, 35, -77, 19, 19, 100, 47, 42, 33, // 13020
6, 3, -158, 158, -309, -5, 72, 138, 58, 56, 74, 206, -45, -24, 290, 57, 9, 157, 60, -162, // 13040
-134, 60, 167, -111, -107, 179, 13, -88, -42, 251, -28, -225, 59, 67, -57, 39, 95, -75, -24, 98, // 13060
105, 61, 81, 5, -47, 109, 58, -6, 76, 46, 5, -90, -32, 264, 49, 99, -227, -76, 50, 98, // 13080
-148, -84, -46, 11, -65, 69, -240, 11, 71, 52, -173, 93, -61, -43, -98, 157, 347, 46, 142, 79, // 13100
-327, -113, -139, -87, -26, 153, -54, 24, 78, 160, 19, 100, -194, 252, 104, 49, 13, -75, 3, -81, // 13120
-184, 111, 21, 409, -61, 36, 0, -27, 115, -124, 77, 20, -80, -220, -141, 67, 212, 44, 39, -25, // 13140
// Out channel 73
39, 90, 61, 65, 85, -176, -112, 46, -89, -3, -158, -6, 4, -9, -44, 53, 88, 39, 51, -37, // 13160
-24, -99, -29, 320, -6, -7, -22, -93, -99, -114, 34, -201, 5, 86, 33, -150, 8, 123, -28, 38, // 13180
-265, -120, 29, -258, 20, 66, 20, -146, 123, -73, -73, -8, 276, 65, 37, -149, -14, -47, -161, 20, // 13200
-104, -209, -106, -75, -220, 39, -51, 165, -6, -145, -185, -278, -59, -8, -10, 52, -58, 30, -122, 246, // 13220
-76, 2, 272, -78, -98, 60, -65, -88, 189, -32, -234, 106, 5, 36, 107, -43, -117, -257, 101, -156, // 13240
-90, -94, 46, 42, 68, 0, -16, -49, 6, 27, -132, 23, -150, -110, 125, -31, -109, -3, 150, 222, // 13260
23, -171, -58, 109, -85, 236, 69, -164, 43, -103, -94, 3, -13, -70, -42, 28, 119, 243, -1, -116, // 13280
15, -66, 33, 41, 41, -19, 86, 173, -154, 48, 253, -219, 200, -3, 234, -84, -10, 30, -84, 92, // 13300
27, 0, -81, -102, 247, -17, 125, 178, 70, -47, 25, 124, -67, -51, 59, -95, -34, -27, -100, 74, // 13320
// Out channel 74
166, 116, 63, -103, -51, 101, 16, 39, 99, -48, -27, -28, -152, 50, 50, 3, -40, -30, 118, -55, // 13340
-94, -41, 66, 206, -1, -42, -126, -154, -31, -95, 3, -73, 32, 110, 84, -32, 13, 8, 62, -203, // 13360
13, -40, -19, 126, -76, -93, 163, -45, 4, -37, 42, -136, -8, 133, 114, 114, 18, 59, 7, 171, // 13380
-61, 60, -98, 89, 105, -144, 134, -168, 73, 140, 129, -122, 60, -65, 81, -22, 212, 14, 5, -87, // 13400
17, -145, -84, -46, -5, 46, -64, -71, 44, -224, -14, -111, 118, -79, -82, -170, 76, 146, -7, 94, // 13420
-53, 69, 51, 132, -57, 126, -85, -137, 27, -33, -3, 17, 66, -23, 60, 141, 168, -49, -112, 95, // 13440
138, 103, 62, -37, 97, 35, 140, 24, 67, 53, 179, -70, 85, 289, -86, -73, 12, -5, -218, 42, // 13460
46, 96, 97, 27, 63, -141, 31, 18, 55, -77, 244, 129, 97, 54, 52, -11, 134, -21, -46, 44, // 13480
41, 26, -172, -131, -80, 14, -7, 17, -117, 163, 154, -4, 31, -44, 40, -88, -191, 49, 48, 151, // 13500
// Out channel 75
-61, -240, 135, 81, -61, -775, 261, 475, -296, 384, 52, 50, 137, -131, -435, 776, 383, -70, 36, -5, // 13520
-101, -360, -21, -424, 34, -6, -8, 1, -94, 161, 282, -33, -673, -121, -41, 58, -132, -11, -415, 214, // 13540
291, 190, 107, 36, 212, 273, -289, 340, 15, -67, 60, 124, -182, -276, -266, -7, -147, 16, 76, -422, // 13560
132, -459, -200, -4, -473, -104, -64, -56, -128, -73, -162, 283, 46, -162, 194, -169, -252, 841, 79, -307, // 13580
-190, 121, 169, 112, -222, 150, -45, -54, 102, 222, -402, -55, -39, -26, -81, -139, -358, 110, -244, -108, // 13600
525, -127, -84, 164, -386, 13, -107, 257, 103, 258, 370, -246, 647, 3, 79, -119, -373, -241, -63, -69, // 13620
-156, 1, 92, -71, 257, 145, -167, -148, 356, -263, 39, 181, 113, -590, -81, -67, 236, -115, 476, 146, // 13640
-250, 381, -71, -53, 1, 691, -8, 197, 241, 797, -87, -27, 148, 314, -119, -201, -4, 58, 116, -232, // 13660
-100, -144, 171, 662, -77, -115, -350, -53, -150, -32, 77, -343, 149, 42, 84, -9, 380, -426, -37, -138, // 13680
// Out channel 76
16, -472, -88, -359, 362, -589, -95, 470, -216, -53, 1917, 629, -630, 22, -937, 737, 87, -347, -363, -198, // 13700
-192, -956, 2258, 2119, 193, 376, -18, -140, 84, -141, 914, 155, -429, 26, -676, -573, 1509, 400, -260, -616, // 13720
-803, -200, 611, -313, -20, 83, -300, -1821, -204, 10, -359, -274, 193, -233, -1596, -796, 642, 320, -964, -297, // 13740
984, 48, -512, 374, -39, 816, 425, 96, -1180, 123, -165, -454, 1160, -304, -197, -2079, 113, -2285, -609, -144, // 13760
174, 245, 357, -17, -323, 391, 711, 382, 827, 227, -284, -127, -740, 127, 382, 590, -302, -505, -177, 335, // 13780
389, -1598, -371, -1707, 168, 416, 295, 179, 16, -83, 103, -670, -530, 676, -200, -448, -537, 589, -1514, 311, // 13800
359, -223, 2311, 914, 356, -338, 115, -24, -461, 83, -281, -133, -708, 1243, 428, -17, -159, 125, -578, 375, // 13820
365, 1754, 2156, -272, 150, -74, 181, -435, 1875, 396, 78, -1023, -173, 441, -225, 406, -1056, 206, -17, -179, // 13840
51, 1965, -8, -1633, 474, -1125, 453, -59, 835, 184, -235, -307, 0, 272, -76, 86, -211, 193, -16, -24, // 13860
// Out channel 77
13, 0, 288, 54, -46, -197, 94, 140, -325, 194, -458, -103, 306, -198, 30, 235, 153, -249, 269, -6, // 13880
-218, -76, -340, -743, 116, 27, -44, -45, -347, 161, -69, 40, -179, 21, -39, 423, -421, -246, -246, 105, // 13900
183, -26, -65, -201, 292, 66, -113, 508, 198, -26, 239, 43, -116, -177, -127, 84, 19, 41, 457, -281, // 13920
18, -344, -63, 78, -37, -372, -57, 172, 12, -412, -65, 113, 95, -145, 262, 166, -70, 737, 320, -182, // 13940
-272, 78, -65, -54, -37, 112, 38, -123, -28, 23, -162, 89, 206, -368, -360, -53, -212, -93, -285, -423, // 13960
67, -23, -152, 488, -201, -133, -167, 60, -106, 303, 118, 11, 532, -10, -5, 30, -43, -211, 5, 44, // 13980
-96, -72, -43, -203, 86, -33, -56, -219, 152, 17, 258, 361, 468, -721, -104, -175, 141, -400, 207, -75, // 14000
-339, 115, -396, 77, -19, 396, -62, 618, -69, 287, 130, -208, 183, -12, 12, -309, 40, -178, 148, 61, // 14020
207, -119, -171, 904, -39, 25, -386, 190, -168, 268, 21, -410, 32, -58, -65, -22, 255, 4, 58, -110, // 14040
// Out channel 78
-98, -92, -266, -553, -4, -193, 275, 87, 260, -106, 1169, -101, -48, -229, -57, 317, 118, 390, -87, 63, // 14060
-64, -30, 3073, 408, 30, 117, -133, -45, -30, -329, 467, 7, -483, 120, -73, -188, 1543, 146, 55, -649, // 14080
-665, -167, 1016, 106, -637, 180, -427, -407, -273, 320, -338, -26, -557, 362, -1150, -30, 40, -59, 60, 16, // 14100
530, -22, 97, 3, -449, 133, 107, -370, -240, -111, -114, 277, -38, 88, -274, -3233, 531, -767, 76, -339, // 14120
189, 295, -52, -131, -60, -380, 581, 176, 191, -270, -221, 235, -371, 193, 212, 300, 62, 60, -87, 1562, // 14140
-8, -1045, -138, -658, 57, 158, 42, 351, 421, -353, 78, 16, -433, -356, -254, -443, -412, 1032, -1626, -177, // 14160
214, -131, 4123, 544, -65, -354, -56, -200, -15, 209, 66, 83, -135, 1615, 70, -31, 355, -53, 10, -64, // 14180
492, 1150, 3092, -92, 76, 279, -233, -40, 1945, 362, -387, -714, -61, -91, -184, -150, -705, 39, 172, 20, // 14200
84, 476, -117, -578, -183, -1262, 212, -155, 121, -3, -190, -55, -161, 154, -65, 70, 10, 141, 58, -257, // 14220
// Out channel 79
182, -172, -281, -232, 126, 29, 94, 150, 372, -40, 918, 377, 62, 146, 41, -92, 27, 351, 35, -144, // 14240
2, 54, 890, 665, -83, -451, -37, 165, 175, -455, 172, 210, 20, 124, -202, -30, 687, -48, 111, -451, // 14260
-563, -95, 248, 194, -470, -134, -221, -554, -242, 318, -126, 115, -229, 341, -374, -463, -43, 84, -31, -288, // 14280
-56, 224, 158, 48, 308, 418, 28, -449, -217, 248, 53, -16, 167, 106, -232, -634, 108, -610, -63, -233, // 14300
407, 212, -348, -149, -19, -94, 505, 195, -217, -137, 42, -61, -600, 3, 160, 351, -2, 241, -41, 653, // 14320
-31, -541, 160, -172, -19, -71, 164, 98, 225, -410, -131, 64, -269, -70, -73, -453, 145, 327, -708, -194, // 14340
237, -36, 1095, 323, 27, -234, 189, 155, -245, 295, -43, -308, -196, 989, 415, -8, -207, 102, -300, -119, // 14360
109, 343, 1088, -52, -7, -12, -161, 75, 477, -231, -213, -308, -62, -191, -188, 412, -488, 40, -57, -3, // 14380
54, 583, -173, -619, -59, -622, 12, -44, 223, -87, -102, -71, 129, 154, -211, 142, 92, 208, -33, -257, // 14400
// Out channel 80
494, -3, 535, 72, -463, 384, -134, 152, 311, 89, -1013, -22, 100, 43, 521, -69, 83, 436, 588, -862, // 14420
73, 45, -1351, -113, 38, -997, 78, 542, -509, -516, -288, 497, 1148, 147, -16, 315, -600, 205, -79, 577, // 14440
312, 354, -1289, 810, -167, -258, 552, 367, 156, -100, -336, -64, -191, 265, 812, -504, 334, 76, 154, 686, // 14460
-586, 515, 32, 272, 1017, -26, -346, -896, 207, 166, -104, -386, 283, 302, 954, 1082, 216, -131, -155, 91, // 14480
187, -801, -723, -466, -114, 22, -258, 181, -248, 339, 194, -632, -121, -883, -481, 127, 562, 452, -183, 133, // 14500
-66, 319, -42, 875, 157, -115, -42, 336, -210, -655, -47, -46, -263, 240, -342, 391, 854, -294, 352, 644, // 14520
431, 472, -1597, -781, 432, 633, 507, 192, 298, 409, 319, -154, 537, 55, 223, -287, -1082, -374, -636, 178, // 14540
47, -1175, -961, 104, -24, -68, -374, 290, -1269, -788, -352, 504, -24, -185, -282, 448, 513, -600, -146, -36, // 14560
59, -222, -367, -88, 129, 474, -237, -247, -70, 147, 151, -252, -375, -424, 185, 174, -98, 169, 420, -2, // 14580
// Out channel 81
109, -225, 83, -8, -283, -264, 278, 211, -241, 65, -502, 103, 290, -16, 164, 316, 214, -180, 105, -115, // 14600
-44, -202, -214, -1190, 247, -128, -87, -46, -187, 115, 166, 54, -142, 115, -199, 424, -559, -154, -252, 107, // 14620
347, 102, 17, -104, 434, -105, -194, 482, 135, -14, 109, -160, -79, -235, -195, -15, -36, 124, 617, -383, // 14640
117, -571, 87, 105, -110, -98, 95, 141, 110, 21, -1, 147, 10, 186, 159, 172, -22, 1075, 536, -22, // 14660
-18, 97, 227, -16, 80, 26, 79, 78, -10, -92, -203, 278, -194, -157, -384, 42, -580, 91, -335, -350, // 14680
124, -129, 49, 583, -160, -520, -113, 70, 44, 300, -33, -12, 678, 181, -159, 5, -189, -180, 121, -168, // 14700
256, 40, -23, -223, 252, -15, 142, -7, 99, -94, 97, 242, 271, -865, -1, -137, 177, -273, 394, -78, // 14720
-387, -2, -452, 17, -85, 344, 91, 427, -47, 261, -30, -104, 36, 87, 32, -339, -83, -104, -151, -128, // 14740
178, -188, 34, 929, -126, -15, -514, 14, -71, 201, -142, -382, 187, 239, 53, -139, 366, -147, -62, -62, // 14760
// Out channel 82
163, 334, 752, 193, -139, 378, 242, -155, -40, 5, -1690, -1, 138, 67, 87, -360, -301, 140, 912, -367, // 14780
33, 205, -1310, -751, 72, -588, -37, 31, -436, -19, -506, 54, 837, 181, 45, 748, -761, 72, -138, 446, // 14800
674, 173, -870, 364, 292, -102, 228, 1190, -57, -2, -181, -16, 325, 51, 838, -35, -76, 179, 646, -12, // 14820
-413, 431, 182, 229, 904, -313, 180, -260, 189, 94, 4, -313, 82, 131, 450, 1372, -165, 1285, 180, 358, // 14840
198, -428, -251, -231, 15, 262, -298, 170, -112, 101, 224, -227, 157, -560, -727, -23, 594, 54, -283, -333, // 14860
-206, 532, -269, 2715, 333, -306, 113, -130, -221, -174, -10, -7, 8, 313, -58, 237, 628, -813, 797, 303, // 14880
297, 281, -1899, -1266, 509, 494, 282, 233, 375, 225, 318, -196, 922, -942, -104, -550, -838, -44, -503, 221, // 14900
-18, -1318, -1254, 7, 249, 47, 218, 406, -961, -173, 102, 519, 91, -46, 56, -6, 294, -184, -34, -116, // 14920
152, -541, -92, 580, 33, 402, -849, -15, -367, -54, 222, -311, 236, -385, 387, 23, -281, -237, 196, 5, // 14940
// Out channel 83
-229, -163, -239, -557, -29, -376, -203, -54, -562, 109, 244, -253, -62, -51, -528, 825, 187, 145, -31, 36, // 14960
-128, -270, 640, 249, 117, 309, -67, -26, 230, -3, 364, -104, -1105, 30, -213, 122, 248, 92, -249, -130, // 14980
-6, -690, 1362, -1119, 1039, -142, -408, -72, 33, 86, -65, -570, 72, -263, -1406, -99, 292, 268, -31, -1614, // 15000
594, -478, -410, 362, -1008, 66, 123, 145, -416, -1, 221, -107, 350, 114, -176, -509, 202, -28, 21, 360, // 15020
155, 710, 196, -4, -91, 680, 950, -117, 498, 40, -288, -56, -115, -63, 78, 79, -791, -483, -98, -713, // 15040
336, -918, -49, -189, -164, -18, 110, 21, -162, 147, -44, -210, 112, 95, 10, -703, -1814, -417, -155, 36, // 15060
406, -130, 924, 169, -278, 63, 158, -98, -400, 173, 100, 66, -110, -641, -206, -82, 876, -15, 184, 53, // 15080
-108, 1628, 205, -68, 440, -103, -110, 90, 1179, 459, 167, -1739, -17, -7, -94, 143, -1679, -8, 56, -75, // 15100
-37, 217, 10, 337, -19, -197, 280, 365, 936, 183, -185, 32, 24, 287, 256, -151, 69, 438, -67, -69, // 15120
// Out channel 84
-98, -109, -50, -339, -129, -86, 26, 96, -283, -109, -59, 20, -30, 421, -169, 321, 349, 102, -85, -49, // 15140
100, -237, 287, -162, -236, 140, 71, -54, 90, -88, 95, -173, -386, -83, -12, -72, 58, 190, 63, 15, // 15160
-97, 423, 390, -38, 93, -13, -361, 100, -158, 184, 73, -301, -126, -116, -214, 26, -112, 85, 61, -168, // 15180
186, -147, -284, -113, -347, 3, -214, 6, -258, 210, 29, 308, 115, 63, -18, -34, 57, 43, -48, -185, // 15200
11, 330, -291, -49, 29, 133, 118, 358, 155, 320, 78, -593, -565, -8, 85, 193, 9, 135, 50, 122, // 15220
324, -5, 188, -37, -127, 129, 108, -145, 36, -183, 192, -164, -63, 131, 103, -147, -103, -308, -195, 136, // 15240
192, -108, 245, 58, 102, -23, 153, 629, 514, 249, -142, -61, 59, -28, 44, 17, 372, 62, -54, 353, // 15260
182, 269, 113, -432, 74, 86, -162, -166, 15, 244, 5, 2, -555, 520, 78, 130, -83, -47, -477, -674, // 15280
-466, -20, 112, 317, -108, -71, 166, -257, 230, -255, -162, -31, 44, -138, -73, 240, 45, 93, -152, -8, // 15300
// Out channel 85
241, 60, 63, -73, -91, 209, -19, -160, 81, -79, -266, -36, -203, -6, 143, -98, -203, 98, 52, -40, // 15320
45, -18, 5, 173, -26, -205, -144, -67, 54, 19, -76, -238, 169, -74, -99, -75, -126, 37, 96, -18, // 15340
-51, 303, -30, 259, -269, -6, 129, -93, 6, 210, 149, -119, 33, 372, 72, 22, 77, 94, 39, 139, // 15360
-117, 320, -113, 134, 144, -10, 6, -51, 135, 52, 149, 15, -29, 110, 144, -101, 223, -122, -271, 104, // 15380
240, -57, -344, -120, 40, 85, -103, 2, -135, 130, 147, -39, -102, -30, -36, 119, 214, 127, 101, 214, // 15400
-18, -14, 24, -47, -20, -36, 197, 103, -16, -194, -223, 8, -120, 267, -201, -33, 197, -118, -51, 173, // 15420
111, -43, 38, 44, -108, -97, -28, 84, 293, 26, 125, -16, 83, 239, -50, -153, -67, 51, 6, 28, // 15440
156, -73, 50, -3, 39, -69, 40, -97, -135, -154, 7, 218, -69, 72, -123, 147, 124, -82, 40, 139, // 15460
176, 30, -87, -124, -133, 14, 187, -64, 102, 196, -90, 68, -81, -314, 108, 70, -167, 44, -82, 5, // 15480
// Out channel 86
44, 653, -71, 99, 450, 334, 121, 22, 77, -108, -3, 355, -35, 173, -247, -448, -448, -76, -70, 71, // 15500
19, 21, -192, -111, 61, -171, -57, -232, 202, 263, -480, 94, 318, 50, 516, -101, -110, -86, 532, -194, // 15520
-89, 496, -242, 428, -333, 170, 284, -195, -68, 62, 79, 73, 484, -52, 287, 83, 22, -4, -127, 124, // 15540
56, 550, 250, 42, 767, 66, 102, -43, 10, 55, -22, 163, -36, -24, 302, 187, -337, 16, -13, -86, // 15560
190, -66, -140, 102, 261, -385, -48, 38, -133, 133, 75, -51, 36, 247, -112, -199, 298, 215, 90, -76, // 15580
-357, 39, -82, 103, 508, -169, 24, -302, 32, 208, -97, 173, 87, 235, -7, 168, 501, -17, -92, -260, // 15600
-273, 31, -123, 255, -77, -298, 91, 66, 229, -114, 92, 20, -283, 357, 0, 40, -802, 145, -240, -125, // 15620
-163, -89, -70, 140, -61, 143, 166, -117, 106, -262, 40, 540, 150, -181, 207, 3, 511, 18, 31, 99, // 15640
138, 300, -52, -192, 198, 207, 101, -226, -212, -13, 254, 45, 151, -290, 28, -352, -248, -105, 32, 301, // 15660
// Out channel 87
67, 113, -95, 29, 237, -144, 29, 28, -18, 200, 239, -43, 3, 40, -103, 197, -73, -139, -35, 108, // 15680
-12, -80, -24, 63, 93, -33, -64, -182, 109, 365, -121, 78, 119, -49, 9, -60, -90, 8, 83, -47, // 15700
93, -90, -80, 14, 65, 150, -148, -131, -181, 67, 45, 274, 318, -121, -71, 126, 78, 161, -14, -424, // 15720
70, -79, -5, 63, -187, 123, 255, 53, -207, 263, 48, 73, 20, 45, 91, -15, -114, 190, -194, 0, // 15740
151, 178, 214, 164, 9, 15, 15, -132, 48, -113, -90, -83, -65, 107, 27, 137, -150, -7, 115, -53, // 15760
-100, 11, -139, -26, -82, -192, -70, -184, 127, 231, 119, -48, 215, 154, -60, -103, 5, -67, 55, -80, // 15780
-328, -77, -81, -5, -128, -54, -260, 23, -56, -43, -91, -104, -158, -171, 45, -2, 51, 46, 69, 7, // 15800
-41, 40, 6, -66, -73, 106, 159, -46, -7, 57, 0, 20, 105, -108, -47, -149, 64, -25, -21, 41, // 15820
-175, -72, 323, 151, 3, 4, 134, 57, -184, -1, 112, -6, 88, -22, -21, -33, -11, -128, -69, 124, // 15840
// Out channel 88
-258, -50, 84, 448, 326, -28, -433, -191, 570, 377, 264, -257, -111, -802, 209, -366, -238, -378, -22, 14, // 15860
47, 7, 65, 837, 177, 79, -222, -41, -207, -166, -47, 57, 528, 224, -153, -241, 335, -85, 60, 211, // 15880
-330, -794, -180, 142, -224, -237, 731, -195, 245, -551, -219, -162, 75, 52, 13, -133, 19, 27, -381, 440, // 15900
-310, 437, 49, -60, 98, -60, 308, 11, 157, -311, 79, -888, 76, -141, -452, 400, -77, -1222, -131, 782, // 15920
-96, -577, 340, -36, -214, 85, -124, -617, -170, -355, 208, 438, 783, 28, 348, -69, 175, -698, 14, -216, // 15940
-367, 212, -63, 12, 281, 196, -106, -76, -382, -245, -326, 50, -751, -342, 389, -36, -85, 480, 306, -118, // 15960
89, -121, -328, -99, -131, 172, 45, -866, -1293, -115, 117, -77, 50, 437, -121, -20, -420, 288, -577, 78, // 15980
-201, -400, 123, 461, 222, -475, -52, -94, -343, -449, 555, -403, 592, -494, 73, -14, -256, -17, 606, 611, // 16000
296, -207, -203, -1230, 357, -71, 156, 730, 82, 206, 112, 277, 30, 222, 155, -274, -430, 497, 85, 310, // 16020
// Out channel 89
92, 96, -3, -144, -43, 99, 31, 13, 106, 28, 16, 234, 73, 41, -23, -18, 2, 184, 92, -169, // 16040
-64, 112, -18, 197, 136, -1, 21, 112, 94, -26, -4, -67, -114, -2, -65, -66, -94, 170, 23, -132, // 16060
56, 119, 88, 66, 159, 31, 205, 32, -15, -40, -138, -37, -70, 144, -114, -36, 84, -53, -51, 175, // 16080
35, 58, -44, 103, 89, -121, -101, -193, 77, 142, 34, -112, 12, -3, -110, 6, -14, -192, 69, -70, // 16100
-58, 19, -252, 60, 10, -210, 75, -54, -54, -22, -27, 5, 83, 60, -6, 110, 18, 55, -98, 43, // 16120
-15, 35, -26, -42, 39, 32, 7, 128, 25, -108, -14, -191, 11, -61, -89, -56, 234, 33, -90, 107, // 16140
28, 6, 34, -25, 90, -24, 25, 25, 127, 124, 36, -158, 100, 165, 36, -29, 113, 9, 35, 179, // 16160
-183, -120, -33, -4, 61, 152, 24, 60, 41, 59, -16, 97, -122, 47, -124, 68, -72, 12, 2, -173, // 16180
-108, 160, -10, -82, -23, -19, -67, 63, 54, -13, 111, 19, -34, -7, 11, -38, -137, 90, 102, -96, // 16200
// Out channel 90
-253, -139, 35, -182, -23, -500, -137, 54, -219, 99, 62, -122, 267, -154, 118, 141, 354, -238, -73, 79, // 16220
14, -124, -168, 34, 56, 220, 95, -185, 13, 162, 112, -136, -102, -7, -14, -166, -42, 127, -168, 160, // 16240
-42, -163, 133, -60, 424, 147, -69, -87, 183, -42, 237, 148, -90, -331, -151, 17, -104, -118, 143, 3, // 16260
13, -299, -97, -158, -149, -77, -219, 243, -72, -89, -58, 124, -2, -43, -20, 232, -350, 204, -20, -17, // 16280
-304, 154, 297, 28, -139, -29, 87, 70, 218, 117, -25, -42, 39, 29, 50, -135, 1, -304, -177, -219, // 16300
6, 37, 201, 113, -13, 263, -200, -136, 86, 251, -3, 43, 73, -73, 285, -52, -388, -29, 10, 271, // 16320
81, -126, -78, 54, 21, 163, 0, -211, -27, -62, -148, 143, 34, -555, 10, 66, 199, 128, 289, 46, // 16340
-299, 172, -205, 126, 77, -47, 93, 86, 95, 118, 94, -49, -77, 229, 96, -331, -103, 216, -77, -84, // 16360
-145, -79, -5, 411, 100, 38, -3, 170, -76, 123, 225, -60, -104, 74, -46, -177, 2, 0, 10, 175, // 16380
// Out channel 91
13, -17, 58, -33, -5, 189, 26, 80, 83, -133, -56, 134, -150, 38, 5, -42, -152, 106, 72, 11, // 16400
-52, 96, 124, 92, 9, -36, -85, -61, -41, -40, 33, 81, -126, -18, 158, -95, -93, 140, 123, -99, // 16420
-53, 45, 38, 22, 17, -52, -75, -20, -52, 27, 18, -155, -26, 168, -28, -54, 97, 86, 0, -136, // 16440
24, 51, -81, 125, 132, 178, 106, 161, 36, 183, -25, -52, 94, -38, -12, -121, -82, -105, -31, 45, // 16460
162, 218, -11, -105, -42, 21, 129, 171, 29, 205, 80, -116, -97, 99, 14, 177, -31, 38, -3, 30, // 16480
134, -67, -6, 91, 166, -120, 27, -146, -24, 95, -20, -98, -138, 335, -16, -197, 190, -118, -66, 91, // 16500
50, 76, 154, 28, -28, -146, 12, 34, -8, -65, 59, -128, -90, 200, -6, -12, -112, 19, -22, -73, // 16520
-63, 300, 33, -32, 124, -129, 195, -23, 137, -152, 3, -63, -78, -68, 2, -104, -41, -38, -54, -67, // 16540
-31, 192, -77, -68, 159, 37, 93, -178, 89, -117, 24, -1, -44, -25, -107, -97, -56, -97, 22, 27, // 16560
// Out channel 92
193, -59, 25, 103, -215, 248, 91, 11, 455, 95, -29, 11, 222, 53, 106, -86, -63, 391, 76, -68, // 16580
-158, 127, 67, 7, 45, -331, -150, 297, -132, 83, -101, 305, 193, -99, -107, 122, 142, -89, 30, -68, // 16600
-57, 149, -148, 300, -263, 248, 67, 30, -145, 55, -191, 341, -257, 249, 21, 55, 209, 141, -60, 242, // 16620
57, 259, 22, 66, 107, 36, 223, -386, 129, 24, 130, -6, -73, 271, -35, -49, 100, -128, 158, -339, // 16640
5, -209, -237, -278, 111, -186, -115, 17, -299, -285, 234, -29, -23, 44, -44, 238, 92, 292, 99, 268, // 16660
-83, -14, -203, -83, -15, -372, 129, 384, 200, -180, 98, 8, -41, 40, -360, -79, 257, 221, -114, -185, // 16680
-131, 158, 131, 14, -13, -238, 70, -21, 14, 104, -144, 44, 33, 372, 177, 52, -141, -169, -210, 0, // 16700
174, -7, 174, -138, -261, 102, -39, 133, -24, -87, -421, 126, -55, -164, -365, 173, 203, -95, -27, 19, // 16720
0, 59, 163, -462, -65, -18, -205, -138, -128, -58, 96, -63, -389, 181, -35, 271, 120, -159, 375, -358, // 16740
// Out channel 93
154, -44, -106, -136, 281, -22, 24, 38, 241, 40, 899, 160, -231, 97, -157, 252, -139, -140, -214, 108, // 16760
-211, -220, 222, 453, -78, -4, -7, -91, 119, -161, 13, -156, 51, 66, 61, -315, 435, 109, 150, -137, // 16780
-328, -18, 11, 201, -206, -97, -82, -934, -282, 222, -62, 52, 105, 105, 6, -133, -20, -51, -398, 50, // 16800
32, 151, 85, 34, 210, 336, 79, 99, -253, 224, -118, 74, 13, -411, -84, -427, -16, -754, -412, -15, // 16820
-179, 8, -13, 240, -82, -91, 155, -59, -31, -50, -52, 178, -332, 544, 210, 62, 116, -20, 122, 70, // 16840
-173, -37, 60, -512, 40, 362, 135, -3, 115, -84, 14, 8, -372, 78, 121, -304, -38, 300, -424, -133, // 16860
53, -183, 359, 462, -243, -225, 35, -195, -48, 79, -165, 37, -466, 653, 119, 151, 8, 340, -246, -80, // 16880
-15, 159, 355, -112, -109, -64, 293, -301, 252, -97, -10, 237, 9, -9, 33, 70, -100, 391, -79, 151, // 16900
35, 337, 34, -578, 53, -138, 466, -237, 154, -256, -22, -49, 259, -148, -206, 53, -144, -58, -3, -58, // 16920
// Out channel 94
48, -65, -100, -77, 111, 201, -215, -244, 236, -194, 432, 166, -547, 116, -50, -225, -195, 110, -133, -126, // 16940
290, -79, 307, 1113, -100, 10, 92, 172, 349, -239, -14, -14, 148, 57, 22, -168, 441, 594, 72, -201, // 16960
-525, 134, 130, 426, -335, -92, 121, -567, -39, 41, -189, -71, 87, 124, 164, -250, 4, -3, -372, 452, // 16980
26, 537, 96, 3, 148, 307, 17, -177, -150, 182, 50, -146, 30, 22, -154, -176, 134, -614, -379, -61, // 17000
217, 52, -335, 43, -99, -42, -70, 41, 114, 263, 268, -190, -233, 241, 246, 179, 285, 235, 180, 416, // 17020
124, 58, 64, -374, 303, 258, 181, -79, 17, -365, 21, -34, -678, 30, -68, -101, 234, 105, -199, 46, // 17040
235, 36, 272, 183, -43, -57, 112, 210, -67, 250, -126, -257, -348, 898, 238, -104, -219, 216, -419, 256, // 17060
313, -178, 190, -194, 46, -226, -98, -561, 183, -237, 0, 103, -381, -32, -54, 192, 71, -4, -303, -80, // 17080
-65, 299, -24, -1349, 188, -153, 475, -240, 230, -295, -67, 173, -129, -232, 86, 38, -390, -50, 16, 91, // 17100
// Out channel 95
56, 115, 145, -118, -108, -87, 51, -128, -33, -63, -424, 25, 9, -95, -76, 12, -197, 51, 155, 45, // 17120
-159, 206, -48, -230, 108, 133, -55, 61, -96, 15, -104, -89, -7, -84, 198, -1, -108, 170, 35, -25, // 17140
-39, 19, 16, -52, 109, 152, 6, 205, 205, -248, 226, -102, -1, -8, 67, 68, 9, 62, 3, -8, // 17160
-5, -207, -47, -12, 66, -202, 69, -22, 106, -250, 203, -48, 124, 7, 113, 262, 18, 199, -37, 37, // 17180
-111, 19, -90, 5, -39, -27, -66, -32, -57, 205, -27, 5, 63, -195, -32, -224, -21, 49, 63, 85, // 17200
54, 77, 110, 216, 47, 77, -3, 115, -112, 50, 53, 19, 70, 16, 39, 79, 10, -207, 154, 58, // 17220
42, -50, -124, -209, 47, -23, -54, 2, 113, -65, 57, 106, 19, -51, -285, -18, 31, -130, 133, 131, // 17240
-232, -197, -3, 68, -38, -16, -70, 118, 27, 131, 115, -6, 248, -47, 77, -6, 31, 14, 117, 10, // 17260
114, -52, -40, 288, -9, 138, -24, 85, 171, -3, 7, -96, -159, 90, 41, -155, -11, 155, 1, 61, // 17280
// Out channel 96
-8, -62, 3, -237, -246, 9, 155, 145, -132, -337, -173, -13, 80, 455, -172, 280, 322, -3, -10, -52, // 17300
80, -238, 20, -278, -13, -63, 275, -171, 75, 52, -11, -89, -344, -88, -10, -67, -93, 142, -25, -13, // 17320
183, 554, 265, -80, 24, -68, -452, 132, -252, 262, -127, 11, -85, -125, -233, 99, 54, 3, 14, -95, // 17340
65, -179, -136, 21, -142, -112, -199, 17, -180, 196, 47, 490, 138, 202, 89, -131, -5, 264, -33, -197, // 17360
102, 279, -100, -39, 10, 32, 82, 396, 55, 355, -10, -443, -358, -1, 198, 98, -73, 165, 121, 217, // 17380
189, -20, 150, 42, -79, -60, 127, -81, 58, -23, 207, -98, 5, 188, -306, 42, 47, -269, -133, 119, // 17400
96, 72, 308, -18, 20, -112, 115, 727, 675, 246, -114, -27, 91, -279, 120, 14, 179, -124, 130, 39, // 17420
292, 132, -45, -293, -70, 93, 162, -110, 100, 238, -321, -40, -464, 380, -46, -98, 3, 71, -369, -721, // 17440
-362, 85, 100, 548, -209, 63, 126, -466, 224, -211, -147, -67, -108, 54, -51, 85, 195, -51, -158, -157, // 17460
// Out channel 97
-98, -79, 625, 586, -46, -2, -61, -102, -169, 360, -67, 219, 226, 42, 201, -86, 153, -47, 6, -42, // 17480
131, -283, -742, 14, -29, 86, 52, 71, -538, 26, -133, -147, 476, 102, -64, 17, 544, 175, -64, -62, // 17500
-636, 445, -1024, 795, -182, -212, 522, -41, 44, -681, 102, 72, -42, 222, 651, -287, -488, -484, 109, 1396, // 17520
-581, 96, 39, -225, 661, 158, -364, -474, -71, -36, -591, -245, 34, -367, 417, 648, 159, -132, -62, 47, // 17540
-391, -651, -158, 221, -346, 137, -699, 231, 191, 615, 240, -86, 108, -215, 146, -213, 790, -48, -54, 321, // 17560
266, 795, 211, 66, 339, 372, -660, -178, -297, -498, -50, 46, -351, -304, 217, 1259, 780, 391, 262, 15, // 17580
202, -205, -794, -366, 159, 340, 195, 80, 288, -163, 16, 160, 183, 56, 124, 95, -578, -214, -604, 264, // 17600
-103, -958, -525, 428, -31, -285, 80, 239, -863, -144, 9, 1009, -159, 79, 179, -282, 455, 140, -93, -365, // 17620
37, -84, -232, -278, 185, -285, -48, -171, -509, -80, 4, -148, 281, -530, 1, -220, -3, -204, -6, 409, // 17640
// Out channel 98
-163, -313, -2, 55, -239, -62, -142, -125, 44, -132, -110, 55, 57, 63, 75, 77, -61, 246, 27, 98, // 17660
73, 21, 17, 120, 114, 135, -33, 158, -140, -266, 13, 150, -119, 121, 10, 8, 246, 34, -183, -70, // 17680
-109, 128, 160, -164, 112, 32, 242, 290, -29, -57, -50, -156, -376, 55, -111, -34, -118, -180, -44, 333, // 17700
-74, -298, -21, -78, -75, -165, -193, -179, -55, 31, 10, 15, -106, 54, -20, -27, 188, -47, 181, -58, // 17720
1, -40, -108, 27, -111, 148, 7, -48, 153, 122, 33, -86, 28, -171, 228, -49, 169, -94, -60, 114, // 17740
68, -23, 105, -202, -15, 295, 63, 180, -118, -365, -73, -8, -98, -219, 113, 37, -278, 15, 110, 129, // 17760
240, -76, 118, 36, 103, 64, 67, 67, -80, -63, -30, -109, 13, 19, -117, -21, 488, -109, 95, 174, // 17780
31, 95, 104, 93, 112, -218, -256, 62, -67, -38, 33, -112, -110, 220, -74, 66, -286, -59, 8, -17, // 17800
23, -37, -136, 49, -58, -30, -126, 70, 230, -66, -212, 154, -262, -33, 49, 60, 41, 271, 70, -154, // 17820
// Out channel 99
-97, -336, 22, 121, -306, -175, -20, -81, -135, -332, -227, -71, 197, 90, -56, 183, 203, 224, -78, -76, // 17840
28, -164, 128, -418, 108, 41, 31, 232, 146, -218, 342, -46, -273, 64, -120, 76, -14, 109, -478, 149, // 17860
-68, -251, 386, -516, 237, -118, -207, 329, 80, 74, -116, -198, -302, 7, -325, 48, -132, -76, 288, -71, // 17880
13, -409, -30, -67, -455, -164, -129, 5, 87, -5, 5, 169, 13, 96, -129, -19, 408, 125, 305, 159, // 17900
34, 243, -128, -81, -7, 217, -39, -56, 27, -87, -80, -95, 11, -248, 100, -22, -58, 19, -109, 124, // 17920
65, 28, 23, 17, -163, 216, 72, 36, -9, -144, 1, -20, 52, -104, 64, 93, -596, -25, 43, 208, // 17940
254, -165, 303, -165, -91, 106, 54, -89, -65, 13, -79, -72, 135, -115, -8, -10, 661, -19, 291, -14, // 17960
137, 63, 97, -72, 243, -29, -181, -65, -136, 285, 5, -345, 28, -22, -7, 103, -462, -95, 5, 88, // 17980
64, -176, -122, 477, -188, -106, 147, 91, 226, -55, -297, -17, 6, 55, -12, 50, 237, 243, -152, -96, // 18000
};
const int16_t cg_FC2bias[100] = { // Co,H,W,Ci: (100,)
2042, -478, 4682, 2880, -1630, -2730, 1006, -1069, -1736, -3543, 1974, -270, 3152, -856, 1, 3204, -4122, -2591, -2136, -5530, // 20
-2449, -803, -1133, -3608, -593, 1018, -2866, -42, -1860, -1181, -2247, 410, 4772, -5507, -1894, 5877, 1428, 550, -2668, 7012, // 40
199, -1144, -451, -344, -1075, 2206, -2141, 2678, -2175, 1687, 2604, 1702, 2317, -2910, 2146, -3193, 142, -1565, 1353, 1073, // 60
147, -2822, -2366, -391, -1809, 3388, 607, -2735, -2104, 1774, 3571, 1675, 3670, 65, 1910, -594, 7374, 1234, 1812, 1260, // 80
-3089, 1927, -543, 3617, -3312, -2741, 2417, -2061, 3124, 3058, -199, 955, 511, -2018, -1613, 2122, -2749, -4612, 1362, -1281, // 100
};
const int16_t cg_FC3weit[4000] = { // Co,H,W,Ci: (40, 100)
// Out channel 0
198, -731, -570, 837, 58, 1, 413, -115, 32, 361, -106, -1251, -115, 460, -850, -524, 749, 444, 218, 707, -464, -576, 246, -175, 200, 15, 1546, -729, -326, -325, -287, 821, // 32
389, 444, -17, -976, 8, 12, -389, 96, -44, -136, 560, 208, 340, -926, 775, -479, -196, 485, -271, -728, -1484, 17, 834, 2070, 514, -116, -1053, -200, -604, 493, -64, 1663, // 64
332, -1219, 361, 761, 1279, -169, -1903, -378, -39, 483, -1011, 65, -773, -793, -1001, -1324, -487, -690, -199, -357, 201, -689, 235, 891, -734, -538, 990, -135, 481, 763, 946, -1406, // 96
342, 489, -13, 187,
// Out channel 1
40, -987, 225, -879, -531, 744, -137, 403, -38, -561, 418, -584, -1002, 713, -54, -861, 2223, 814, 424, 1488, 15, 231, -585, 575, 276, -426, 1203, -763, 461, -12, 875, -675, // 132
393, 681, 608, -884, -506, 161, -261, 466, -847, -649, 499, 128, 39, -138, 692, -447, 634, -50, -910, -402, -138, 581, -323, 1532, 1236, -588, -109, -744, -1463, 665, 758, 521, // 164
509, -1283, 467, 597, -236, -203, -955, 1002, -762, 607, -859, 335, -519, -537, -555, -848, 36, -768, -476, -933, 560, -223, 246, 685, -1192, -944, 1051, -520, -410, -342, 466, -624, // 196
272, 751, -443, 640,
// Out channel 2
367, 196, 221, 96, 211, 606, -713, 352, -243, -379, 95, 443, 138, 233, 382, 202, 1497, 1782, 106, 827, 12, 315, 558, 1182, 192, -459, 1076, 79, 690, 155, 116, 298, // 232
493, 50, -135, -44, -722, -18, 593, 438, 327, 508, 885, -786, 602, -334, 25, -842, 603, 116, -156, 316, -264, 1413, -154, 1282, 490, -204, -733, -263, -702, 313, 182, 115, // 264
549, -291, -19, 409, 1001, -379, -1602, 413, -1083, -20, -637, -54, -560, -1230, -442, -406, -48, -623, -712, -413, 674, 1023, -1167, 1022, 512, -964, 144, 243, 395, 588, 890, -826, // 296
244, -640, -56, -216,
// Out channel 3
-1018, -616, 241, 777, 103, 681, 85, 1185, 396, -148, -1187, 635, -285, -69, 583, -880, 1267, 183, 1466, 1702, 0, -363, 919, 1766, -58, -1931, 1291, 598, 4, -470, 583, -421, // 332
1067, 296, 847, 26, -467, -78, 235, -156, 544, -652, 690, -239, 662, -1039, 698, 56, 693, -635, -945, 298, -755, 395, 477, 1784, 766, 239, -309, -631, -99, 18, 86, 681, // 364
1553, -1450, -257, 1248, 502, -1079, -525, -891, -1358, -537, -1472, -227, -287, 132, 197, -802, -1132, -547, -47, -98, 1031, 1070, 135, 76, 44, 63, -740, 208, -997, 444, 472, -1372, // 396
211, -492, -682, 1133,
// Out channel 4
-618, 1156, 951, -441, 569, 663, 188, 125, 1099, 104, 185, -655, 62, -158, 201, -2011, 389, -171, 537, 530, -991, 253, 650, 238, 858, 270, 669, -553, -903, -654, -65, 257, // 432
-641, 863, -773, 127, -630, -708, 566, 451, -646, -641, 770, -275, -87, 132, -10, -444, 218, 368, 86, 1103, -116, 145, 616, 607, -623, -959, -183, 364, -1237, -408, -544, 771, // 464
145, 259, 285, 228, 399, 49, -645, 458, -637, -133, -753, 23, 428, -353, 322, 126, -902, -551, -251, 511, 77, 200, -445, 312, -98, -2042, 994, -414, -565, -295, -736, 901, // 496
420, -96, -293, 813,
// Out channel 5
7, -885, 578, -664, 549, 1033, -510, 1561, 551, 266, -1242, -1405, -779, 1218, 650, -951, 1029, -920, 89, 784, -527, 90, 437, 1311, -994, -549, 1668, 37, 573, 1219, 335, -244, // 532
-112, 114, 343, -851, -351, 674, 714, 504, -1292, 786, 504, 508, 319, -1104, 1053, -296, 343, -691, -876, 47, -1764, 525, 681, 1230, -75, -316, 641, 208, -1232, -176, -311, 281, // 564
1018, -244, 475, 201, 603, -341, -1402, -1220, -240, 361, -54, 496, 266, -1583, -857, -639, -648, -207, 99, 15, 753, 834, -538, 169, 6, -1500, 35, -705, 390, 702, 273, -756, // 596
276, 491, -527, 11,
// Out channel 6
-773, -204, 427, -2020, 988, 2064, -706, 124, -318, -1252, -1167, 183, -878, -278, 165, -902, 825, 244, 1097, 1065, 30, 1432, 478, 917, 187, -640, 893, -140, -241, 586, 1440, -449, // 632
-628, 542, -382, -867, -1977, 164, 520, -21, 165, -164, 364, -826, 301, -682, -120, -513, -259, -158, -782, -730, -91, 1541, 317, 827, 139, 1520, -760, -911, -162, 7, 600, -175, // 664
1497, -667, -458, 1032, 505, -1370, -923, -485, -1536, -62, -490, 26, -208, -80, 125, -453, -498, -293, 3, 69, 883, 929, 266, 1084, -148, -1186, 50, -1662, -549, 184, -46, -842, // 696
577, 905, -1389, 226,
// Out channel 7
-1548, -913, -674, -1259, 421, 1039, -1316, -501, 77, 193, -674, -838, -683, -2, 530, -719, 1982, -691, 871, 1209, 1216, 370, 402, 1433, 150, -1065, 1562, -140, -249, -827, -279, -903, // 732
-650, -129, -431, -482, -44, 475, 86, -162, 549, -234, 101, -903, -596, -380, 91, -639, 786, 13, -1063, 100, -12, 1271, 654, 1155, -221, 379, -2598, -1157, -277, -42, 240, 624, // 764
605, -305, 303, 1922, 996, -613, -1513, -946, -454, -12, -2096, 158, -839, -505, -632, -1263, 305, -567, -166, 824, 126, 1111, -437, 1382, -610, -1049, -30, -986, -994, 663, -132, 442, // 796
687, 796, -1030, 9,
// Out channel 8
-1050, 922, -174, -1734, -505, 2096, 314, 955, -741, 323, -364, -517, -792, 230, 89, 99, 413, 438, 104, 1177, 438, 287, 483, 2247, 131, -531, 954, 122, -130, 72, 1471, -1007, // 832
-243, 1010, 417, -252, -894, -75, 489, -257, -522, -182, 184, -782, 125, 577, 87, -1472, -237, -1072, 32, 201, -129, 1510, 231, 801, -248, 173, -1379, -1282, 370, -620, -168, 6, // 864
773, 115, 148, 729, 822, -614, -1019, 1497, -1011, 516, -1331, 182, -405, -480, 173, 54, -868, -883, -126, -870, 1242, 507, 136, 713, 0, -978, 553, -1405, 1160, 1486, 543, 12, // 896
460, 1046, -911, 507,
// Out channel 9
-675, 484, -591, -567, 54, 500, -887, -175, -143, -209, 347, -315, -377, 355, 150, 82, 841, 501, -155, 696, 289, 1316, 317, 225, -481, -380, 601, -176, -160, -102, 564, -145, // 932
-137, -298, -349, -734, -597, -414, 1520, -394, -22, 364, 77, -160, 369, -66, -290, -218, 33, 155, -777, 566, -431, 209, -203, 484, -85, 229, -611, -374, 409, -141, 401, 391, // 964
208, -551, -397, 249, 10, -354, -453, -207, -487, -121, -371, -173, -380, 43, -649, -759, 176, 476, 380, -1220, 740, 276, -1051, 648, -102, 18, 416, -779, -91, -315, 45, -402, // 996
778, 512, -179, 667,
// Out channel 10
-699, 52, -558, -583, 592, 1380, -892, 412, 316, 534, -765, -71, 245, 927, -606, -324, 2022, 403, 953, 1902, 215, -930, 544, 1265, 0, -734, 867, -3, 179, 356, 636, -175, // 1032
169, 1391, 24, -133, -198, -327, 146, -606, 25, -346, 1600, 105, 238, 221, -919, 467, -698, -167, -569, -603, -53, 75, -504, 2207, -36, 308, -1553, -1301, 174, -312, 37, -334, // 1064
61, 154, 744, 536, 593, -1034, -633, -434, -1236, 1628, -723, 247, -1024, -423, -517, -923, 525, -80, 744, 477, 1534, 1396, -383, 309, -686, -908, -142, -1859, -585, 692, 674, -158, // 1096
934, 732, -1912, 710,
// Out channel 11
-1743, -898, -320, -989, 1182, 694, 122, 795, -456, -574, -1352, -20, -1877, 731, 77, -1169, 1319, 515, -29, 1735, 718, 1763, -373, 1014, 353, -1005, 1958, 847, 376, -1312, 1371, -2924, // 1132
1155, 198, 279, 394, -360, -274, -407, -67, 131, 141, 144, -318, 370, 75, 258, -392, 641, -624, -411, 388, -861, -183, -733, 2508, 811, 865, -1383, -649, -352, 127, 408, -93, // 1164
-465, -489, -1507, 1219, 163, 29, -575, -720, -659, 576, -2344, 527, 188, -156, -756, -795, -1595, 10, -1625, 27, 1765, -290, -987, 2711, -902, -1460, 2071, -1999, 399, 224, -1023, -831, // 1196
1246, 13, -182, 790,
// Out channel 12
-207, -570, -415, 89, -61, 812, 461, 154, 182, 632, -96, -1424, -442, 478, -166, -704, 1217, -64, 173, 1037, -906, -264, -8, 500, -556, -485, 374, -404, -1017, 693, -641, 719, // 1232
229, -85, 337, -975, -420, 372, 713, -484, -596, 628, 91, -438, 429, -1572, 884, -111, 266, -380, 443, -257, -1017, 620, 256, 1454, -333, -241, -1381, 407, -751, 78, -612, 755, // 1264
308, -1420, 123, 133, 741, 452, -1025, 28, 100, 291, -1081, 617, 79, -728, -826, -584, -151, -862, -528, -613, 998, -434, 172, 195, -834, -645, 292, -813, 114, 94, 829, -652, // 1296
-260, 528, -29, -401,
// Out channel 13
-644, -18, -265, -835, 351, 651, -656, -102, -162, -38, -1347, -29, 62, -271, 471, -1208, 1499, -475, 206, 1190, 119, -335, 985, 1405, -238, -727, 871, 3, 505, 521, 476, -543, // 1332
72, 205, 127, -670, -827, 10, 793, 36, -9, -428, 607, -338, -387, -574, 222, -1066, -61, -106, -883, 114, -838, 1184, -408, 1138, 342, 297, -55, -424, 251, 906, 569, -2, // 1364
400, -846, -80, 336, 291, 415, -1285, -165, -1204, 482, -600, 51, -2, 12, -360, -1089, -599, 184, 312, -413, 527, 822, -397, 1181, -12, -806, -429, -521, -24, 46, 271, 91, // 1396
549, -86, -786, -548,
// Out channel 14
-478, -232, 110, -399, 307, 630, -829, 314, 1093, 567, 253, -732, -105, 551, 392, -821, 1254, 164, 490, 1903, 20, 387, 440, -455, 319, -543, 1732, -230, 533, 100, -233, 263, // 1432
353, 352, -580, -521, 500, 422, -9, 258, 66, 85, -35, -26, 271, 58, 915, -965, 484, -472, -810, 75, -786, 793, 154, 1074, -349, -106, -501, 639, -701, 789, 577, 774, // 1464
701, -793, 725, 336, 704, -495, -1238, 165, -973, -113, -439, 10, -47, -671, -850, -513, -188, -187, 35, -597, 312, 144, -299, -242, -756, -94, -34, -1328, 332, -52, 317, 216, // 1496
175, 31, -701, 255,
// Out channel 15
-674, -364, 74, -602, -580, 1079, -513, 960, 179, -16, -519, -419, -62, 77, 290, -1139, 420, -397, 5, 987, 180, 89, -97, 1561, -188, -99, 1089, -61, 121, 129, 523, -275, // 1532
-287, 731, 442, -595, 253, 165, 500, 68, 323, -48, -223, 7, 163, -145, 502, -102, 346, 452, -5, -90, -198, 916, 228, 1297, -167, 895, -558, -205, -530, 741, 73, -173, // 1564
472, -212, -371, 306, 60, -947, -534, 284, -1224, 456, -1357, 386, 90, -438, 235, 4, -25, -195, -427, 498, 1156, 867, 183, 714, -218, -1274, 308, -172, -81, 314, -152, 352, // 1596
1069, 373, -1739, -825,
// Out channel 16
-389, -590, 80, -405, 629, 58, -168, -51, -99, 345, -778, 693, -404, -170, -100, -258, 117, 192, 208, 16, 745, 1138, -674, 771, 1180, 478, 70, 1455, 581, 204, 208, -1617, // 1632
45, -456, -135, 158, 23, -475, -661, -528, 78, 886, 515, 664, 570, -1721, 1096, 28, 1029, 181, 1597, -230, -1035, 569, -349, 226, -1089, -244, -731, -102, -1670, 144, 576, 375, // 1664
212, 230, -925, 202, 412, 147, -259, -752, 54, 567, -304, 990, -326, -321, 397, -49, -1112, -285, -187, 535, 953, -530, -767, 665, -35, -275, 1118, -938, -517, 79, 576, -538, // 1696
8, 1224, 436, 707,
// Out channel 17
-1141, -647, 1, -1128, 961, 1221, -657, 653, 420, -28, -379, 393, 123, 227, 131, -791, 924, 320, 151, 832, 1085, 205, -497, 1425, 17, -744, 591, 290, 131, -749, -82, -661, // 1732
-446, 844, -65, -558, -1142, 115, 859, -526, -717, 310, 88, 231, -565, -320, -121, -1003, 909, -663, -388, 661, 167, 421, 449, 1249, 110, 482, -801, -780, -476, 313, -8, 262, // 1764
930, -318, 802, 621, 467, 38, -1369, 257, -562, 54, -1500, 328, -520, 125, -180, -1555, -1176, -630, 614, 344, 496, 1352, -297, 820, 331, -1881, -481, -387, 896, 494, -321, -621, // 1796
-388, 861, -774, -22,
// Out channel 18
-356, 313, 26, -652, -18, 885, -245, 329, -211, -351, -1371, 814, 320, -100, 373, -1893, 1368, -436, -204, 1593, 137, 162, 27, 623, -704, -1111, 662, 341, 424, 398, 630, -795, // 1832
253, 198, 442, -394, -668, -593, 695, -190, 100, -47, 580, 446, -202, -1047, 899, -107, -890, -219, 234, -163, 24, 599, -80, 1393, 15, -8, -815, -472, 148, -232, 388, 258, // 1864
951, -530, -109, 920, 233, -361, -1643, -321, -220, 624, -729, 129, 304, -178, -958, -500, -310, -216, -645, -61, 796, 1042, 246, 195, -602, -1177, -51, -55, -821, 486, -189, -859, // 1896
259, 247, -1279, -96,
// Out channel 19
-148, 331, 356, 82, -385, 17, -127, 440, -543, -624, 10, -191, 106, 318, 420, 235, -32, -271, 214, 245, -252, 30, -55, 6, 223, 29, 138, -8, -370, -184, -199, 116, // 1932
405, -493, -343, 219, -140, -186, 590, 369, -530, -462, 436, -297, 123, 63, 171, 136, 176, 173, 101, 586, -50, -100, 167, -102, -287, -407, 293, 355, -584, -350, -462, 562, // 1964
443, 172, 182, 81, -83, 211, 116, 424, -228, 234, -131, -226, 567, -456, 646, 353, -413, -377, -586, 163, -20, 111, 418, -8, 159, -183, 63, 164, -270, 358, 65, 369, // 1996
87, 113, -60, -4,
// Out channel 20
-1229, -481, -2298, -185, 827, 452, -100, 839, 545, 115, 44, -923, -1022, 252, 410, -378, 915, -2, 859, 541, -422, 662, -27, 880, 563, 25, 792, 10, -867, 685, 1581, -111, // 2032
-219, 147, 1356, -4265, -836, 475, 514, -1468, -1037, -115, -621, -150, 16, -163, 107, -805, 45, -97, -2671, 64, -184, 1291, 424, 788, -25, 2815, -321, -571, 2295, 65, -537, 604, // 2064
270, -584, -300, 1191, 859, -2130, -1078, -354, -1212, -24, -236, 13, -117, -195, -1490, -1477, 1374, -316, 267, -1662, 1293, 2410, -407, 1840, -287, -736, -175, 640, -11, 467, 430, -305, // 2096
211, 1561, -576, 317,
// Out channel 21
-600, 454, -98, -692, 337, 2125, -247, 388, 542, 814, -1105, 69, 107, 446, 862, -912, 867, 275, 776, 461, 509, -308, -5, 994, -327, -1363, 1677, 1169, 603, -339, 1296, -113, // 2132
-139, 47, 683, 641, -70, 368, 101, 24, -473, -998, 423, 44, 225, -13, -552, -702, 525, 19, -228, -101, 70, 768, -317, 1575, 508, -48, -908, -44, 179, 1330, 376, 1407, // 2164
-223, 150, -435, 924, -274, -1412, -257, 34, -1242, -47, -695, 307, -835, -1375, -10, -469, -814, -495, 93, -821, 6, 907, -586, 1511, -327, -891, -225, -193, 24, 398, -579, -970, // 2196
-35, 296, -320, 67,
// Out channel 22
-380, -157, -61, -673, 603, 1368, -598, 509, 210, 868, -517, -50, -476, 983, -25, 134, 1454, -553, 597, 1839, 211, 316, -31, 1471, -248, -990, 1546, 232, 1013, -12, 429, 45, // 2232
367, 959, 483, 465, -189, -415, 421, -701, -34, -462, 773, -567, 399, 172, 125, -85, 534, -23, -298, -126, -310, 782, 87, 417, 278, 344, -413, -579, 628, 402, 65, 89, // 2264
397, -386, 450, 197, 417, -294, -1658, -339, -2147, 690, -1307, 151, -94, -91, -94, -1394, -169, -482, 248, -85, 1122, 555, -205, 412, -177, -1474, 400, -1179, 291, 360, -109, -382, // 2296
718, 544, -425, 7,
// Out channel 23
-915, 840, 1298, -694, -1169, 461, 1131, 720, -1092, -745, -780, 370, -223, 440, 850, 1080, 746, 12, 402, 323, 149, 1523, 237, 687, -26, -466, 109, 724, 58, 1034, 41, -986, // 2332
-177, 140, -347, -897, -1045, 1322, 239, 705, -735, -42, 242, -56, 87, -196, -168, -1554, 323, -43, -1179, 430, -58, 1751, 81, 456, -134, 823, -242, -999, -805, -340, 105, 916, // 2364
226, -111, -1935, 11, -6, -46, -688, 656, -317, -738, 97, 531, 237, 101, 692, 111, -503, -1567, -389, -279, 354, 94, 203, 1536, -152, -1008, 76, -463, -337, 1031, 62, 128, // 2396
418, 1908, -2042, -970,
// Out channel 24
-860, -444, -640, -904, 748, 2018, -284, 85, -368, -194, -793, -458, -1172, 335, 201, -659, 2184, -236, 1056, 2097, 692, -73, -206, 606, -168, -1070, 1060, -615, 943, 531, 376, -1045, // 2432
115, 1116, 322, -426, -986, -604, 557, -85, -95, -335, 314, -762, 538, 636, -112, -427, 460, 39, -37, -203, -249, 299, 644, 1083, 622, 569, -1035, -940, -472, 871, 267, -277, // 2464
603, -342, -67, 753, -4, -501, -1682, -315, -1820, 438, -1546, -505, 169, -1150, 175, -550, -299, 263, 282, -78, 612, 1346, -327, 772, -262, -1244, 1018, -789, -150, 206, 1, -1041, // 2496
767, 208, -1228, 567,
// Out channel 25
1, -507, -310, 30, -1267, 414, 242, 111, -792, -870, 116, 535, -1394, 27, 51, 536, 374, -675, -547, 320, 562, -19, -385, 105, 43, -1384, 436, 231, 222, 215, -273, -290, // 2532
263, -1196, -15, 311, -185, 131, 715, -501, -79, 390, 2, 934, 779, -498, 604, -449, 369, -754, 277, 5, -531, -435, -363, 443, 419, -620, 481, -1162, -191, 249, 95, 105, // 2564
-352, -597, 477, -42, -699, 349, -553, -917, -612, -552, -456, -679, -275, 130, 602, 163, -210, 77, 100, -1421, -52, 585, 686, 162, 103, -603, -156, -752, 445, 150, -369, -372, // 2596
-19, -109, -257, -240,
// Out channel 26
-873, 364, 316, -433, -43, 45, 332, 31, 243, 840, -1506, -210, -191, -121, 245, -283, -52, 285, -1032, -208, -517, 562, -309, 117, 394, 195, 47, 460, -509, 426, 452, -350, // 2632
-96, 390, 356, -193, -421, 986, -492, 143, 320, -56, -98, 55, -258, 171, -265, -1307, -405, 328, -611, -87, 155, -103, 545, 449, 34, 283, -133, 347, -146, -15, 329, -416, // 2664
-1560, -163, 145, 83, -264, -225, 7, 503, 390, -164, -109, 141, 161, 170, -847, 78, 291, 79, 730, 581, -121, -360, 353, 846, 97, -92, 379, 465, -44, -137, 218, -223, // 2696
135, -164, -471, -795,
// Out channel 27
139, -1615, -299, -452, 716, 974, 727, 1188, 839, 624, -683, -1635, -1148, 1604, 335, 95, 1560, -526, 954, 1748, -1288, -737, 873, 757, -1191, 61, 3807, -1595, -1259, 119, 713, 1053, // 2732
367, 298, 44, -634, -1128, 1047, -365, -498, -1935, 1080, 509, 460, 1526, -1622, 1421, 296, 1228, -153, -884, -210, -2147, 1416, 1401, 3422, 1239, 491, -1218, -113, -2238, -400, -981, 2183, // 2764
535, -2271, 1840, 770, 1186, -224, -2152, -525, -646, -617, -851, 1097, -1011, -1964, -584, -1161, -858, -1007, -1034, -406, 792, -726, 61, 1531, -1267, -850, -548, -657, 757, 1452, 1724, -2041, // 2796
831, 835, -349, 439,
// Out channel 28
-460, 32, 72, -179, 481, 1003, -598, 601, -200, 230, -552, -405, 600, -291, -281, -1020, 1079, -579, 802, 1408, 388, 260, 446, 887, -63, -988, 1143, 667, 262, 231, 316, -777, // 2832
360, 223, 940, -690, -560, 337, 532, 502, -216, -21, 67, -142, -679, -226, 23, -1037, 981, -52, -769, -23, -1035, -29, 203, 1922, 53, 1125, 199, -882, -571, 332, 354, 1158, // 2864
1264, -707, 475, 425, 427, -33, -1960, -203, -947, -366, -1117, -718, -974, 382, -754, -992, -545, -218, -62, -748, 505, 785, -644, 392, -174, -830, 311, -413, -759, 405, 891, -696, // 2896
630, 377, -1653, 189,
// Out channel 29
-74, -779, 399, -713, 91, 1516, 313, 24, -902, 620, -982, -1027, -210, 0, 3, -14, 1323, -290, 271, 875, 168, -407, 17, 715, -1033, -155, 1125, -244, 131, -719, 73, -559, // 2932
346, -323, 1, -296, -557, -354, 656, -95, -887, 267, -168, -672, 296, -580, -358, -212, 931, 365, 287, 188, -183, 874, 245, 806, -366, -452, -41, -195, -246, 683, 130, 304, // 2964
223, -275, -87, 470, 728, -133, -1060, -462, -1101, 179, -1254, 372, -425, -629, -213, -776, -32, -192, -711, 37, 1310, 562, 400, -195, -366, -977, 150, 139, 101, 1071, 57, -547, // 2996
363, -275, -47, 890,
// Out channel 30
-485, -12, 197, -799, 477, 1038, -309, 564, -252, 126, -1126, -61, -247, 1118, -93, -1469, 1055, -510, 120, 1137, -1007, 1040, -237, 1748, -222, -1345, 1075, -160, 183, 482, 4, -194, // 3032
-167, 405, 752, 24, -878, 955, 510, -117, -140, -380, 198, 8, 182, -546, 77, -75, 248, 159, -228, 276, 102, 812, 373, 850, 509, 355, -545, -277, 209, 584, 77, 82, // 3064
171, -630, -191, 397, 796, -540, -1278, -82, -841, -528, -471, -289, -223, -19, 286, -705, 543, -381, -440, 293, -34, 818, 115, 738, -538, -996, 57, 171, -305, 249, 499, -344, // 3096
332, -592, -980, -514,
// Out channel 31
83, 9, 359, -307, 13, -61, 246, -11, 2, 114, 132, 269, -184, 99, -141, -125, -15, 231, -301, -100, 391, -189, 230, 346, -135, 270, -73, -176, 222, 203, 304, 137, // 3132
123, 209, 269, 225, 188, -150, -159, 419, 17, 277, -46, 476, 271, -384, 286, 97, 283, -411, 451, -39, -303, -246, -341, 42, 213, 48, 166, 126, 108, 343, -41, -37, // 3164
-256, -310, -132, 327, 222, -392, -38, -81, 267, -301, -35, 326, -136, -117, 454, 458, 200, 0, 133, 197, 317, 148, -337, -34, -389, 56, -246, 391, 209, -52, 281, -25, // 3196
305, -282, 346, 281,
// Out channel 32
-1583, -786, -250, -742, -214, 619, -360, 664, 82, 106, -959, 627, -240, 222, 91, -654, 400, -345, 497, 947, 61, 324, 718, 750, -451, -711, 217, 636, 744, -170, 1013, -621, // 3232
-474, 462, 121, -138, -478, 206, 424, 310, 217, -482, 33, 34, -275, -672, -264, -879, 885, -74, -359, -291, -361, 378, 271, 942, 272, 383, -29, -171, 24, 405, 979, -494, // 3264
543, -350, -498, 420, -177, -1335, -648, -529, -1017, -16, -1523, 319, -185, 19, -240, -686, -707, -344, -226, 471, 880, 292, -630, 1553, -164, -1313, 435, -177, -731, 58, 152, -53, // 3296
812, 382, -1000, 69,
// Out channel 33
-672, 95, -463, -16, 1192, 984, -657, 98, 621, 1066, -2273, 691, -225, 596, 507, -1586, 1214, -207, 558, 585, 126, 806, 108, 807, -317, -707, 1079, 472, -402, 615, 677, 92, // 3332
100, 235, 139, -103, -450, 1397, -371, 407, 0, 161, -143, -90, -479, -120, -383, -780, 265, 554, -384, 17, -617, 1731, -189, 1229, -15, 285, -1020, -1330, -939, 190, 630, 397, // 3364
1327, -343, -1049, 1090, -285, -677, -1308, -581, -592, -86, -1571, -60, -560, -668, -343, -564, -336, 649, 291, 46, 963, 292, -17, 437, 460, -1384, 300, 198, 72, 1090, -381, -450, // 3396
-144, 752, -511, 561,
// Out channel 34
-824, -106, -822, -712, -77, 1428, 6, 4, -55, -75, -757, 134, -433, 570, -61, -846, 903, 592, 461, 1185, 212, 323, 324, 358, -548, -897, 1194, -157, 370, -193, 745, -430, // 3432
-333, 471, -118, -413, -296, 280, 1083, 459, -252, -663, -703, -197, 186, -237, -95, -262, -89, -744, -736, 228, 88, 148, 369, 854, 110, -132, -1347, -937, 355, 1076, -197, -430, // 3464
457, -1120, -475, 255, 86, 270, -1465, -944, -1133, 583, -1362, -239, 600, -412, -718, 49, 28, 114, 173, 1000, 757, 878, 309, 1146, -704, -562, 689, -592, -390, 1034, 17, -178, // 3496
462, 418, -1243, 711,
// Out channel 35
-492, -485, -1218, 211, -1912, 1358, -686, 131, -1518, -1315, -281, 551, -1457, -215, 390, 521, 602, -1303, -352, 795, 356, 561, -712, -308, 49, -1991, 788, 577, 77, -553, -487, -778, // 3532
-254, -1744, 470, 114, -815, 378, 627, -920, 174, 338, 116, 672, 743, -278, 306, -675, -78, -818, -494, 56, -670, 164, -444, 803, 55, -785, 0, -1501, -201, -627, -133, 53, // 3564
-768, -438, 1212, -662, -1292, 239, -853, -1023, -1211, -266, -1184, -1447, -554, 212, 27, -291, -454, 291, 69, -2455, -866, 288, 1265, 741, 985, -912, 316, -1422, 226, 258, -649, -635, // 3596
-746, -246, -376, -399,
// Out channel 36
-442, -298, -411, -427, 742, 1370, -427, 887, 526, 1087, -60, -671, -52, -85, -1114, -86, 1818, 199, 145, 2013, 231, 382, 615, 509, 141, -1509, 1549, -977, 293, 402, -100, -649, // 3632
111, 977, 415, -978, -345, -344, 551, -553, -361, 207, 582, -371, 60, -987, 995, -108, 322, -1011, -288, -339, -905, 993, -92, 1747, 369, 909, -602, -1010, 436, -312, -86, 624, // 3664
853, -514, 244, 280, 908, -103, -1686, -350, -1598, 868, -721, 344, -323, -880, -697, -642, -295, -1110, -416, -347, 947, 151, 399, 1296, -369, -2252, -294, 163, -809, 695, 733, -1054, // 3696
906, 542, 18, -272,
// Out channel 37
-738, 14, -1017, -274, -361, 37, 29, 1080, -786, -358, 286, -846, 38, 775, 403, 307, 285, -318, 926, 355, -681, 475, 28, 127, 197, 130, 342, -102, -1102, 550, 766, 189, // 3732
735, -705, 855, -2640, -470, -357, 468, -1092, -1015, -792, -360, -531, -77, -63, 43, -429, 190, 71, -1431, 670, -125, 1046, 561, 108, -211, 1367, -435, 265, 1259, -549, -959, 795, // 3764
420, 9, -179, 356, 359, -1200, -423, 74, -87, 219, -127, -234, 381, -741, -424, -357, 1093, -508, -145, -1218, 327, 2127, -12, 993, -128, 215, -221, 871, -137, 512, 374, 286, // 3796
-48, 995, -250, 142,
// Out channel 38
-155, -833, -544, -855, -349, 554, -254, 408, 728, 178, 538, -311, -5, 1060, -453, 228, 1317, 410, 1152, 1593, 470, 692, -86, 1053, -761, -1053, 1575, -1121, 39, 268, 977, -1175, // 3832
-454, 1105, 133, -226, -386, -34, -97, 812, -598, -674, -28, -223, 217, -85, 332, -485, 62, -767, -701, -626, -1777, 364, -211, 1399, 852, -389, 113, -1273, 68, 137, -248, 84, // 3864
199, -427, 650, 76, 662, 260, -766, 280, -1408, 1506, -601, 653, -80, -138, -659, -433, -275, -1560, -40, -643, 965, 292, 230, 12, -10, -1104, 644, -802, -1316, 691, 280, -676, // 3896
1104, 189, -179, -461,
// Out channel 39
-336, -677, -441, -1125, -231, 1349, -255, 417, 848, 764, -1085, 47, -282, -1, -44, -906, 1692, 630, 699, 2705, -527, -179, -730, 477, -60, -1016, 1594, -144, 129, 810, 478, -399, // 3932
150, -402, 150, -448, -181, -529, -156, -495, -772, 427, -524, 626, -155, -1105, -48, -461, -714, -220, -645, -760, -1145, 975, 817, 1494, 309, 30, -1012, -1379, 156, -330, 232, 504, // 3964
591, -604, 614, 73, 1024, -1034, -1717, -885, -1921, 711, -1206, -234, -425, -1152, -851, -648, 167, -245, -541, 536, 1334, 187, -111, 171, 513, -998, 210, 182, -598, -349, 883, -320, // 3996
764, 68, -95, 145,
};
const int16_t cg_FC3bias[40] = { // Co,H,W,Ci: (40,)
-938, -1221, -2107, -816, -4234, -732, -373, -530, -2066, -1532, -817, -404, -1102, -1111, -1444, -1132, -5089, -1073, -1239, 1758, -3635, -786, 146, -4543, 366, -2551, 25, -1148, -1062, -899, -1194, 2050, // 32
-1123, -1223, -933, -6201, -292, -2524, -1197, -902,
};
const int16_t cg_FC4weit[40] = { // Co,H,W,Ci: (1, 40)
// Out channel 0
-340, 1047, -611, 1525, -183, 1672, 22, -416, 314, 182, -352, 880, -294, -491, 95, -1234, 462, 265, -213, 1258, // 20
624, -697, 17, -799, -68, 1083, 611, -6830, -6, -1254, -358, -1443, 890, -436, -254, -1135, -81, -1011, -256, -261, // 40
};
const int16_t cg_FC4bias[1] = { // Co,H,W,Ci: (1,)
5998,
};
|
the_stack_data/23459.c | /*
* Copyright (C) 2015-2018 Alibaba Group Holding Limited
*/
#ifdef AWSS_SUPPORT_SMARTCONFIG_WPS
#include <stdio.h>
#include <stdint.h>
#include <stddef.h>
#include "os.h"
#include "awss.h"
#include "passwd.h"
#include "awss_log.h"
#include "awss_wps.h"
#include "awss_main.h"
#include "awss_event.h"
#include "awss_crypt.h"
#include "awss_aplist.h"
#include "awss_statis.h"
#include "zconfig_ieee80211.h"
#include "zconfig_protocol.h"
#if defined(__cplusplus) /* If this is a C++ compiler, use C linkage */
extern "C" {
#endif
int is_ascii_string(uint8_t *str)
{
int i = 0;
while (str[i] != '\0') {
if (str[i] < 128) {
i ++;
} else {
return 0;
}
}
return 1;
}
/**
* extract device name attribute from wps ie struct
*
* @wps_ie: [IN] wps ie struct
* @len: [OUT] len of dev name attr if exist
*
* Return:
* %NULL if dev name attr could not be found, otherwise return a
* pointer to dev name attr
*/
static uint8_t *get_device_name_attr_from_wps(uint8_t *wps_ie, uint8_t *len)
{
/* 6 = 1(Element ID) + 1(Length) + 4(WPS OUI) */
uint8_t *attr_ptr = wps_ie + 6; /* goto first attr */
uint8_t wps_ielen = wps_ie[1];
#define device_name_id (0x1011)
while (attr_ptr - wps_ie < wps_ielen) {
/* 4 = 2(Attribute ID) + 2(Length) */
uint16_t attr_id = os_get_unaligned_be16(attr_ptr);
uint16_t attr_data_len = os_get_unaligned_be16(attr_ptr + 2);
uint16_t attr_len = attr_data_len + 4;
if (attr_id == device_name_id) {
*len = attr_len;
return attr_ptr;
} else {
attr_ptr += attr_len; /* goto next */
}
}
return NULL;
}
/*
* passwd_check_utf8()
*
* @Note: see andriod smartconfig with p2p
* if the byte in passwd is zero, jave will change 0x00 with 0xc080
* the function will restore 0xc080 to 0x00
*/
void passwd_check_utf8(uint8_t *passwd, int *passwd_len)
{
int i, len;
if (!passwd || !passwd_len) {
return;
}
len = *passwd_len;
for (i = 0; i < len; i ++) {
if (passwd[i] < 0x80) { /* [0x01 ~ 0x7F] */
continue;
}
passwd[i] = 0; /* resetore to 0x00 */
if (i + 2 < len) { /* move the rest to overwrite useless content. */
memmove(passwd + i + 1, passwd + i + 2, len - i - 2);
}
len --;
}
*passwd_len = len;
}
/*
* get_ssid_passwd_from_wps()
*
* @Note: see andriod zconfig protocol
* android sdk limit sizeof(passwd) <= 23
*
* @Return: _GOT_RESULT_
*
* use src mac to do ssid completion
*/
static int get_ssid_passwd_from_w(uint8_t *in, int total_len, uint8_t *src, uint8_t *bssid)
{
uint8_t tmp_ssid[ZC_MAX_SSID_LEN + 1] = {0}, tmp_passwd[ZC_MAX_PASSWD_LEN + 1] = {0};
int ssid_len, passwd_len, ssid_truncated = 0;
uint16_t crc, cal_crc;
char encrypt = 0;
/* used by prepare frame */
char *magic_p_w_d = "zl&ws";/* FIXME: Maybe it will be dangerous when opening source. */
static uint32_t start_time = 0;
#define W_LEN (32) /* total_len */
#define EXTRA_LEN (3) /* ssid_len(1B) + checksum(2B) */
if (!in || total_len <= 4 + EXTRA_LEN) {
return GOT_NOTHING;
}
/* attr_id(2) + attr_len(2) = 4 */
in += 4;
total_len -= 4;
if (total_len > W_LEN) {
awss_warn("ssid len > 32\r\n");
}
/* total_len: ssid_len(1B), ssid, passwd, crc(2B) */
ssid_len = in[0];
if (ssid_len & P2P_ENCRYPT_BIT_MASK) {
encrypt = (ssid_len & P2P_ENCRYPT_BIT_MASK) >> P2P_ENCODE_TYPE_OFFSET;
ssid_len &= P2P_SSID_LEN_MASK;
}
if (encrypt > P2P_ENCODE_TYPE_ENCRYPT) {
return GOT_NOTHING;
}
passwd_len = total_len - ssid_len - EXTRA_LEN; /* ssid_len(1B), crc(2B) */
if (ssid_len > W_LEN - EXTRA_LEN || passwd_len < 0) {
return GOT_NOTHING;
}
AWSS_UPDATE_STATIS(AWSS_STATIS_WPS_IDX, AWSS_STATIS_TYPE_TIME_START);
/* ssid_len(1B), ssid, passwd, crc(2B) */
crc = os_get_unaligned_be16(in + 1 + ssid_len + passwd_len);
/* restore 0xc080 to 0x00 */
passwd_check_utf8(in + 1 + ssid_len, &passwd_len);
cal_crc = zconfig_checksum_v3(in, 1 + ssid_len + passwd_len);
if (crc != cal_crc) {
memset(zc_android_src, 0, sizeof(zconfig_data->android_src));
memset(zc_pre_ssid, 0, sizeof(zconfig_data->android_pre_ssid));
memset(zc_android_ssid, 0, sizeof(zconfig_data->android_ssid));
memset(zc_android_bssid, 0, sizeof(zconfig_data->android_bssid));
awss_debug("rx illegal p2p (0x%x != 0x%x)\r\n", crc, cal_crc);
awss_event_post(AWSS_CS_ERR);
AWSS_UPDATE_STATIS(AWSS_STATIS_WPS_IDX, AWSS_STATIS_TYPE_CRC_ERR);
/*
* use zconfig_checksum_v3() because
* java modified UTF-8, U+C080 equal U+00,
* ssid len & ssid & crc is not be 0,
* the content of passwd encrypted may be 0
*/
return GOT_NOTHING;
}
if (start_time == 0) {
start_time = os_get_time_ms();
}
#define MAC_LOCAL_ADMINISTERED_BIT (0x02)
memcpy(zc_android_src, src, ETH_ALEN);
if (zc_android_src[0] & MAC_LOCAL_ADMINISTERED_BIT) {
zc_android_src[0] &= ~MAC_LOCAL_ADMINISTERED_BIT;
/* awss_debug("android src: %02x%02x%02x\r\n", zc_android_src[0], src[1], src[2]); */
}
in += 1;/* eating ssid_len(1B) */
memset(tmp_ssid, 0, ZC_MAX_SSID_LEN);
memset(tmp_passwd, 0, ZC_MAX_PASSWD_LEN);
memcpy(tmp_ssid, in, ssid_len);
in += ssid_len;
if (passwd_len) {
memcpy(tmp_passwd, in, passwd_len);
}
awss_dict_crypt(SSID_DECODE_TABLE, tmp_ssid, ssid_len);
switch (encrypt) {
case P2P_ENCODE_TYPE_ENCRYPT: {
/* decypt passwd using aes128-cfb */
uint8_t passwd_cipher_len = 0;
uint8_t *passwd_cipher = awss_zalloc(128);
if (passwd_cipher == NULL) {
return GOT_NOTHING;
}
decode_chinese(tmp_passwd, passwd_len, passwd_cipher, &passwd_cipher_len, 7);
passwd_len = passwd_cipher_len;
memset(tmp_passwd, 0, ZC_MAX_PASSWD_LEN);
aes_decrypt_string((char *)passwd_cipher, (char *)tmp_passwd, passwd_len,
1, os_get_encrypt_type(), 0, NULL);
awss_free(passwd_cipher);
if (is_utf8((const char *)tmp_passwd, passwd_len) == 0) {
/* memset(zconfig_data, 0, sizeof(*zconfig_data)); */
memset(zc_android_src, 0, sizeof(zconfig_data->android_src));
memset(zc_pre_ssid, 0, sizeof(zconfig_data->android_pre_ssid));
memset(zc_android_ssid, 0, sizeof(zconfig_data->android_ssid));
memset(zc_android_bssid, 0, sizeof(zconfig_data->android_bssid));
awss_warn("p2p decrypt passwd content err\r\n");
awss_event_post(AWSS_PASSWD_ERR);
AWSS_UPDATE_STATIS(AWSS_STATIS_WPS_IDX, AWSS_STATIS_TYPE_PASSWD_ERR);
return GOT_NOTHING;
}
break;
}
default:
awss_warn("p2p encypt:%d not support\r\n", encrypt);
memset(zconfig_data, 0, sizeof(*zconfig_data));
return GOT_NOTHING;
}
awss_debug("ssid:%s, tlen:%d\r\n", tmp_ssid, total_len);
if (passwd_len && !memcmp(tmp_passwd, magic_p_w_d, passwd_len)) {
/* Note: when v2 rollback to v1, zc_preapre_ssid will useless */
strncpy((char *)zc_pre_ssid, (char const *)tmp_ssid, ZC_MAX_SSID_LEN - 1);
return GOT_CHN_LOCK;
}
/* for ascii ssid, max length is 29(32 - 1 - 2). */
/* for utf-8 ssid, max length is 29 - 2 or 29 - 3 */
/* gbk ssid also encoded as utf-8 */
/* SAMSUNG S4 max name length = 22 */
if (!is_ascii_string((uint8_t *)tmp_ssid)) { /* chinese ssid */
ssid_truncated = 1; /* in case of gbk chinese */
} else if (total_len >= W_LEN - EXTRA_LEN) {
ssid_truncated = 1;
}
if (ssid_truncated) {
uint8_t *best_ssid;
int cur_ssid_len = strlen((const char *)tmp_ssid); /* current_ssid */
int pre_ssid_len = strlen((const char *)zc_pre_ssid); /* prepare_ssid */
if (pre_ssid_len && pre_ssid_len < cur_ssid_len) {
/* should not happen */
awss_warn("pre:%s < cur:%s\r\n", zc_pre_ssid, tmp_ssid);
best_ssid = tmp_ssid; /* current ssid */
} else if (pre_ssid_len) {
best_ssid = zc_pre_ssid; /* prepare ssid */
} else {
best_ssid = tmp_ssid; /* default use current ssid */
}
/* awss_debug("ssid truncated, best ssid: %s\r\n", best_ssid); */
do {
#ifdef AWSS_SUPPORT_APLIST
struct ap_info *ap_info;
ap_info = zconfig_get_apinfo_by_ssid_suffix(best_ssid);
if (ap_info) {
awss_debug("ssid truncated, got ssid from aplist:%s\r\n", best_ssid);
strncpy((char *)zc_ssid, (const char *)ap_info->ssid, ZC_MAX_SSID_LEN - 1);
memcpy(zc_bssid, ap_info->mac, ETH_ALEN);
} else
#endif
{
if (memcmp(bssid, zero_mac, ETH_ALEN) && memcmp(bssid, br_mac, ETH_ALEN)) {
memcpy(zc_android_bssid, bssid, ETH_ALEN);
}
#ifdef AWSS_SUPPORT_APLIST
ap_info = zconfig_get_apinfo(zc_android_bssid);
if (ap_info) {
if (ap_info->ssid[0] == '\0') { /* hide ssid, MUST not truncate */
strncpy((char *)zc_android_ssid, (const char *)best_ssid, ZC_MAX_SSID_LEN - 1);
} else { /* not hide ssid, amend ssid according to ap list */
strncpy((char *)zc_android_ssid, (const char *)ap_info->ssid, ZC_MAX_SSID_LEN - 1);
}
} else
#endif
if (time_elapsed_ms_since(start_time) > os_awss_get_channelscan_interval_ms() * (13 + 3) * 2) {
start_time = 0;
strncpy((char *)zc_android_ssid, (const char *)best_ssid, ZC_MAX_SSID_LEN - 1);
}
if (zc_android_ssid[0] == '\0') {
return GOT_NOTHING;
}
strncpy((char *)zc_ssid, (const char *)zc_android_ssid, ZC_MAX_SSID_LEN - 1);
memcpy(zc_bssid, zc_android_bssid, ETH_ALEN);
}
} while (0);
} else {
strncpy((char *)zc_ssid, (char const *)tmp_ssid, ZC_MAX_SSID_LEN - 1);
if (memcmp(bssid, zero_mac, ETH_ALEN) && memcmp(bssid, br_mac, ETH_ALEN)) {
memcpy(zc_bssid, bssid, ETH_ALEN);
}
}
strncpy((char *)zc_passwd, (char const *)tmp_passwd, ZC_MAX_PASSWD_LEN - 1);
start_time = 0;
return GOT_SSID_PASSWD;
}
int awss_recv_callback_wps(struct parser_res *res)
{
uint8_t *data = res->u.wps.data;
uint16_t len = res->u.wps.data_len;
uint8_t tods = res->tods;
uint8_t channel = res->channel;
int ret = get_ssid_passwd_from_w(data, len, res->src, res->bssid);
if (ret == GOT_CHN_LOCK) {
awss_debug("cb for v2:%02x%02x%02x\r\n",
res->src[0], res->src[1], res->src[2]);
goto chn_locked;
} else if (ret == GOT_SSID_PASSWD) {
goto rcv_done;
} else if (ret == GOT_NOTHING) {
return PKG_INVALID;
} else {
return PKG_INVALID;
}
chn_locked:
zconfig_set_state(STATE_CHN_LOCKED_BY_P2P, tods, channel);
return PKG_START_FRAME;
rcv_done:
AWSS_UPDATE_STATIS(AWSS_STATIS_WPS_IDX, AWSS_STATIS_TYPE_TIME_SUC);
zconfig_set_state(STATE_RCV_DONE, tods, channel);
return PKG_END;
}
int awss_ieee80211_wps_process(uint8_t *mgmt_header, int len, int link_type, struct parser_res *res, signed char rssi)
{
const uint8_t *wps_ie = NULL;
struct ieee80211_hdr *hdr;
uint8_t attr_len = 0;
uint16_t ieoffset;
int fc;
/*
* when device try to connect current router (include adha and aha)
* skip the wps packet.
*/
if (mgmt_header == NULL || zconfig_finished) {
return ALINK_INVALID;
}
/*
* we don't process wps until user press configure button
*/
if (awss_get_config_press() == 0) {
return ALINK_INVALID;
}
hdr = (struct ieee80211_hdr *)mgmt_header;
fc = hdr->frame_control;
if (!ieee80211_is_probe_req(fc)) {
return ALINK_INVALID;
}
ieoffset = offsetof(struct ieee80211_mgmt, u.probe_req.variable);
if (ieoffset > len) {
return ALINK_INVALID;
}
/* get wps ie */
wps_ie = (const uint8_t *)cfg80211_find_vendor_ie(WLAN_OUI_WPS, WLAN_OUI_TYPE_WPS,
mgmt_header + ieoffset, len - ieoffset);
if (wps_ie == NULL) {
return ALINK_INVALID;
}
/* get wps name in wps ie */
wps_ie = (const uint8_t *)get_device_name_attr_from_wps((uint8_t *)wps_ie, &attr_len);
if (wps_ie == NULL) {
return ALINK_INVALID;
}
res->u.wps.data_len = attr_len;
res->u.wps.data = (uint8_t *)wps_ie;
return ALINK_WPS;
}
#if defined(__cplusplus) /* If this is a C++ compiler, use C linkage */
}
#endif
#endif
|
the_stack_data/142822.c | /*
URI Online Judge | 1064
Positives and Average
Adapted by Neilor Tonin, URI Brazil
https://www.urionlinejudge.com.br/judge/en/problems/view/1064
Timelimit: 1
Read 6 values that can be floating point numbers. After, print how many of them were positive. In the next line, print the average of all positive values typed, with one digit after the decimal point.
Input
The input consist in 6 numbers that can be integer or floating point values. At least one number will be positive.
Output
The first output value is the amount of positive numbers. The next line should show the average of the positive values typed.
@author Marcos Lima
@profile https://www.urionlinejudge.com.br/judge/pt/profile/242402
@status Accepted
@language C (gcc 4.8.5, -O2 -lm) [+0s]
@time 0.000s
@size 317 Bytes
@submission 12/7/19, 1:52:18 PM
*/
#include <stdio.h>
int main()
{
double n, sum = 0;
unsigned char c = 0,i;
for (i = 0; i < 6; i++) {
scanf("%lf", &n);
if (n > 0) {
c++;
sum += n;
}
}
printf("%d valores positivos\n", c);
printf("%.1lf\n", sum/c);
return 0;
} |
the_stack_data/104828912.c | // This file is part of the SV-Benchmarks collection of verification tasks:
// https://github.com/sosy-lab/sv-benchmarks
//
// SPDX-FileCopyrightText: 2011-2020 The SV-Benchmarks community
// SPDX-FileCopyrightText: 2020 The ESBMC project
//
// SPDX-License-Identifier: Apache-2.0
extern void abort(void);
#include <assert.h>
void reach_error() { assert(0); }
#include <pthread.h>
#include <assert.h>
pthread_mutex_t mutex;
int data = 0;
void *thread1(void *arg)
{
pthread_mutex_lock(&mutex);
data++;
pthread_mutex_unlock(&mutex);
return 0;
}
void *thread2(void *arg)
{
pthread_mutex_lock(&mutex);
data+=2;
pthread_mutex_unlock(&mutex);
return 0;
}
void *thread3(void *arg)
{
pthread_mutex_lock(&mutex);
if (data >= 3){
ERROR: {reach_error();abort();}
;
}
pthread_mutex_unlock(&mutex);
return 0;
}
int main()
{
pthread_mutex_init(&mutex, 0);
pthread_t t1, t2, t3;
pthread_create(&t1, 0, thread1, 0);
pthread_create(&t2, 0, thread2, 0);
pthread_create(&t3, 0, thread3, 0);
pthread_join(t1, 0);
pthread_join(t2, 0);
pthread_join(t3, 0);
return 0;
}
|
the_stack_data/182953265.c | #include<stdio.h>
#include<malloc.h>
/*
1) the Program i written is naive one.
2) traverse the complete linkedlist and find the length
3) minus the given k length and update the count
4) traverse from HEAD to (count) times the node
5) display data
just total length - given length and then traverse from head
*/
struct node{
int data;
struct node *next;
}*HEAD=NULL;
struct node *createNode(int data){
struct node *newNode;
newNode = (struct node *)malloc(sizeof(struct node));
newNode->data = data;
newNode->next = NULL;
return newNode;
}
void insertNode(int data){
struct node *newNode = createNode(data);
struct node *temp = HEAD;
if(HEAD==NULL){
HEAD = newNode;
}
else
{
while(temp->next!=NULL)
temp = temp->next;
temp->next = newNode;
}
}
void print(){
struct node *temp = HEAD;
while(temp!=NULL){
printf("=>%d",temp->data);
temp = temp->next;
}
}
void kLastElement(int k){
/*this is naive method */
int count = 0,i=0;
struct node *temp = HEAD;
struct node *temp2 = HEAD;
while(temp!=NULL){
count++;
temp = temp->next;
}
k = count - k;
while(k--)
temp2 = temp2->next;
printf("\n%d\n",temp2->data);
}
int main(){
insertNode(1);
insertNode(2);
insertNode(3);
insertNode(4);
insertNode(5);
insertNode(6);
insertNode(7);
insertNode(8);
print();
kLastElement(2);
kLastElement(5);
kLastElement(1);
kLastElement(6);
kLastElement(7);
} |
the_stack_data/15763979.c | // Working of relational operators
#include <stdio.h>
int main()
{
int a = 5, b = 5, c = 10;
printf("%d == %d is %d \n", a, b, a == b);
printf("%d == %d is %d \n", a, c, a == c);
printf("%d > %d is %d \n", a, b, a > b);
printf("%d > %d is %d \n", a, c, a > c);
printf("%d < %d is %d \n", a, b, a < b);
printf("%d < %d is %d \n", a, c, a < c);
printf("%d != %d is %d \n", a, b, a != b);
printf("%d != %d is %d \n", a, c, a != c);
printf("%d >= %d is %d \n", a, b, a >= b);
printf("%d >= %d is %d \n", a, c, a >= c);
printf("%d <= %d is %d \n", a, b, a <= b);
printf("%d <= %d is %d \n", a, c, a <= c);
return 0;
} |
the_stack_data/37637700.c | /// \addtogroup module_scif_osal
//@{
#ifdef SCIF_INCLUDE_OSAL_C_FILE
#include <ti/devices/DeviceFamily.h>
#include DeviceFamily_constructPath(inc/hw_nvic.h)
#include DeviceFamily_constructPath(driverlib/cpu.h)
#include "scif_osal_tirtos.h"
#include <ti/sysbios/knl/Semaphore.h>
#include <ti/sysbios/knl/Clock.h>
#include <ti/sysbios/family/arm/m3/Hwi.h>
/// MCU wakeup source to be used with the Sensor Controller control READY event, must not conflict with OS
#define OSAL_CTRL_READY_MCUWUSEL_WU_EV_INDEX 6
/// MCU wakeup source to be used with the Sensor Controller task ALERT event, must not conflict with OS
#define OSAL_TASK_ALERT_MCUWUSEL_WU_EV_INDEX 7
/// The READY interrupt is implemented using INT_AON_AUX_SWEV0
#define INT_SCIF_CTRL_READY INT_AON_AUX_SWEV0
/// The ALERT interrupt is implemented using INT_AON_AUX_SWEV1
#define INT_SCIF_TASK_ALERT INT_AON_AUX_SWEV1
/// Calculates the NVIC register offset for the specified interrupt
#define NVIC_OFFSET(i) (((i) - 16) / 32)
/// Calculates the bit-vector to be written or compared against for the specified interrupt
#define NVIC_BV(i) (1 << ((i - 16) % 32))
// Function prototypes
static void osalCtrlReadyIsr(UArg arg);
static void osalTaskAlertIsr(UArg arg);
/// HWI object for the control READY interrupt
static Hwi_Struct hwiCtrlReady;
/// HWI object for the task ALERT interrupt
static Hwi_Struct hwiTaskAlert;
/// Semaphore for control READY waiting
static Semaphore_Struct semCtrlReady;
/// Has the \ref scifOsalInit() function been called?
static volatile bool osalInitDone = false;
/** \brief Registers the control READY interrupt
*
* This registers the \ref osalCtrlReadyIsr() function with the \ref INT_SCIF_CTRL_READY interrupt
* vector.
*
* The interrupt occurs at initial startup, and then after each control request has been serviced by the
* Sensor Controller. The interrupt is pending (including source event flag) and disabled while the task
* control interface is idle.
*/
static void osalRegisterCtrlReadyInt(void) {
Hwi_Params hwiParams;
Hwi_Params_init(&hwiParams);
// Do not enable interrupt yet
hwiParams.enableInt = false;
// Create the HWI object for the control READY interrupt
Hwi_construct(&hwiCtrlReady, INT_SCIF_CTRL_READY, osalCtrlReadyIsr, &hwiParams, NULL);
} // osalRegisterCtrlReadyInt
/** \brief Unregisters the control READY interrupt
*
* This detaches the \ref osalCtrlReadyIsr() function from the \ref INT_SCIF_CTRL_READY interrupt
* vector.
*/
static void osalUnregisterCtrlReadyInt(void) {
// Destroy the HWI object
Hwi_destruct(&hwiCtrlReady);
} // osalUnregisterCtrlReadyInt
/** \brief Enables the control READY interrupt
*
* This function is called when sending a control REQ event to the Sensor Controller to enable the READY
* interrupt. This is done after clearing the event source and then the READY interrupt, using
* \ref osalClearCtrlReadyInt().
*/
static void osalEnableCtrlReadyInt(void) {
Hwi_enableInterrupt(INT_SCIF_CTRL_READY);
} // osalEnableCtrlReadyInt
/** \brief Disables the control READY interrupt
*
* This function is called when by the control READY ISR, \ref osalCtrlReadyIsr(), so that the interrupt
* is disabled but still pending (including source event flag) while the task control interface is
* idle/ready.
*/
static void osalDisableCtrlReadyInt(void) {
Hwi_disableInterrupt(INT_SCIF_CTRL_READY);
} // osalDisableCtrlReadyInt
/** \brief Clears the task control READY interrupt
*
* This is done when sending a control request, after clearing the READY source event.
*/
static void osalClearCtrlReadyInt(void) {
Hwi_clearInterrupt(INT_SCIF_CTRL_READY);
} // osalClearCtrlReadyInt
/** \brief Registers the task ALERT interrupt
*
* This registers the \ref osalTaskAlertIsr() function with the \ref INT_SCIF_TASK_ALERT interrupt
* vector.
*
* The interrupt occurs whenever a sensor controller task alerts the driver, to request data exchange,
* indicate an error condition or that the task has stopped spontaneously.
*/
static void osalRegisterTaskAlertInt(void) {
Hwi_Params hwiParams;
Hwi_Params_init(&hwiParams);
// Do not enable interrupt yet
hwiParams.enableInt = false;
// Create HWI object for the task ALERT interrupt
Hwi_construct(&hwiTaskAlert, INT_SCIF_TASK_ALERT, osalTaskAlertIsr, &hwiParams, NULL);
} // osalRegisterTaskAlertInt
/** \brief Unregisters the task ALERT interrupt
*
* This detaches the \ref osalTaskAlertIsr() function from the \ref INT_SCIF_TASK_ALERT interrupt
* vector.
*/
static void osalUnregisterTaskAlertInt(void) {
// Destroy the HWI object
Hwi_destruct(&hwiTaskAlert);
} // osalUnregisterTaskAlertInt
/** \brief Enables the task ALERT interrupt
*
* The interrupt is enabled at startup. It is disabled upon reception of a task ALERT interrupt and re-
* enabled when the task ALERT is acknowledged.
*/
void scifOsalEnableTaskAlertInt(void) {
Hwi_enableInterrupt(INT_SCIF_TASK_ALERT);
} // scifOsalEnableTaskAlertInt
/** \brief Disables the task ALERT interrupt
*
* The interrupt is enabled at startup. It is disabled upon reception of a task ALERT interrupt and re-
* enabled when the task ALERT is acknowledged.
*
* Note that there can be increased current consumption in System CPU standby mode if the ALERT
* interrupt is disabled, but wake-up is enabled (see \ref scifSetWakeOnAlertInt()). This is because the
* wake-up signal will remain asserted until \ref scifAckAlertEvents() has been called for all pending
* ALERT events.
*/
void scifOsalDisableTaskAlertInt(void) {
Hwi_disableInterrupt(INT_SCIF_TASK_ALERT);
} // scifOsalDisableTaskAlertInt
/** \brief Clears the task ALERT interrupt
*
* This is done when acknowledging the alert, after clearing the ALERT source event.
*/
static void osalClearTaskAlertInt(void) {
Hwi_clearInterrupt(INT_SCIF_TASK_ALERT);
} // osalClearTaskAlertInt
/** \brief Enters a critical section by disabling hardware interrupts
*
* \return
* Whether interrupts were enabled at the time this function was called
*/
uint32_t scifOsalEnterCriticalSection(void) {
return Hwi_disable();
} // scifOsalEnterCriticalSection
/** \brief Leaves a critical section by reenabling hardware interrupts if previously enabled
*
* \param[in] key
* The value returned by the previous corresponding call to \ref scifOsalEnterCriticalSection()
*/
void scifOsalLeaveCriticalSection(uint32_t key) {
Hwi_restore(key);
} // scifOsalLeaveCriticalSection
/// Stores whether task control non-blocking functions have been locked
static volatile bool osalCtrlTaskNblLocked = false;
/** \brief Locks use of task control non-blocking functions
*
* This function is used by the non-blocking task control to allow safe operation from multiple threads.
*
* The function shall attempt to set the \ref osalCtrlTaskNblLocked flag in a critical section.
* Implementing a timeout is optional (the task control's non-blocking behavior is not associated with
* this critical section, but rather with completion of the task control request).
*
* \return
* Whether the critical section could be entered (true if entered, false otherwise)
*/
static bool osalLockCtrlTaskNbl(void) {
uint32_t key = Hwi_disable();
if (osalCtrlTaskNblLocked) {
Hwi_restore(key);
return false;
} else {
osalCtrlTaskNblLocked = true;
Hwi_restore(key);
return true;
}
} // osalLockCtrlTaskNbl
/** \brief Unlocks use of task control non-blocking functions
*
* This function will be called once after a successful \ref osalLockCtrlTaskNbl().
*/
static void osalUnlockCtrlTaskNbl(void) {
osalCtrlTaskNblLocked = false;
} // osalUnlockCtrlTaskNbl
/// Stores whether \ref semCtrlReady is being pended on in osalWaitOnCtrlReady()
static volatile bool osalWaitOnNblLocked = false;
/** \brief Waits until the task control interface is ready/idle
*
* This indicates that the task control interface is ready for the first request or that the last
* request has been completed.
*
* \param[in] timeoutUs
* Minimum timeout, in microseconds
*
* \return
* \ref SCIF_SUCCESS if the last call has completed, otherwise \ref SCIF_NOT_READY (the timeout
* expired) or \ref SCIF_ILLEGAL_OPERATION (the OSAL does not allow this function to be called with
* non-zero \a timeoutUs from multiple threads of execution).
*/
static SCIF_RESULT_T osalWaitOnCtrlReady(uint32_t timeoutUs) {
SCIF_RESULT_T result;
// If ready now ...
uint32_t key = Hwi_disable();
if (HWREG(AUX_EVCTL_BASE + AUX_EVCTL_O_EVTOAONFLAGS) & AUX_EVCTL_EVTOAONFLAGS_SWEV0_M) {
// Immediate success
Hwi_restore(key);
result = SCIF_SUCCESS;
// If no timeout has been specified ...
} else if (timeoutUs == 0) {
// Immediate failure
Hwi_restore(key);
result = SCIF_NOT_READY;
// If another osalWaitOnCtrlReady() call is in progress ...
} else if (osalWaitOnNblLocked) {
// This call to osalWaitOnCtrlReady() has interrupted another call to osalWaitOnCtrlReady()
Hwi_restore(key);
result = SCIF_ILLEGAL_OPERATION;
// Otherwise ...
} else {
// The control READY interrupt has not yet occurred, so it is safe to reset the semaphore and
// pend on it because we know the interrupt will happen.
Semaphore_reset(Semaphore_handle(&semCtrlReady), 0);
osalWaitOnNblLocked = true;
Hwi_restore(key);
// Enable wake-up on READY interrupt
scifSetMcuwusel(OSAL_CTRL_READY_MCUWUSEL_WU_EV_INDEX, AON_EVENT_MCUWUSEL_WU0_EV_AUX_SWEV0);
// Return whether the semaphore was released within the timeout
if (Semaphore_pend(Semaphore_handle(&semCtrlReady), timeoutUs / Clock_tickPeriod)) {
osalWaitOnNblLocked = false;
result = SCIF_SUCCESS;
} else {
osalWaitOnNblLocked = false;
result = SCIF_NOT_READY;
}
// Disable wake-up on READY interrupt
scifSetMcuwusel(OSAL_CTRL_READY_MCUWUSEL_WU_EV_INDEX, AON_EVENT_MCUWUSEL_WU0_EV_NONE);
}
return result;
} // osalWaitOnCtrlReady
/// OSAL "TI-RTOS": Application-registered callback function for the task control READY interrupt
static SCIF_VFPTR osalIndicateCtrlReadyCallback = NULL;
/// OSAL "TI-RTOS": Application-registered callback function for the task ALERT interrupt
static SCIF_VFPTR osalIndicateTaskAlertCallback = NULL;
/** \brief Called by \ref osalCtrlReadyIsr() to notify the application
*
* This shall trigger a callback, generate a message/event etc.
*/
static void osalIndicateCtrlReady(void) {
// If the OSAL has been initialized, release the sempahore
if (osalInitDone) {
Semaphore_post(Semaphore_handle(&semCtrlReady));
}
// Call callback function
if (osalIndicateCtrlReadyCallback) {
osalIndicateCtrlReadyCallback();
}
} // osalIndicateCtrlReady
/** \brief Called by \ref osalTaskAlertIsr() to notify the application
*
* This shall trigger a callback, generate a message/event etc.
*/
static void osalIndicateTaskAlert(void) {
if (osalIndicateTaskAlertCallback) {
osalIndicateTaskAlertCallback();
}
} // osalIndicateTaskAlert
/** \brief Sensor Controller READY interrupt service routine
*
* The ISR simply disables the interrupt and notifies the application.
*
* The interrupt flag is cleared and reenabled when sending the next task control request (by calling
* \ref scifExecuteTasksOnceNbl(), \ref scifStartTasksNbl() or \ref scifStopTasksNbl()).
*
* \param[in] arg
* Unused
*/
static void osalCtrlReadyIsr(UArg arg) {
osalDisableCtrlReadyInt();
osalIndicateCtrlReady();
} // osalCtrlReadyIsr
/** \brief Sensor Controller ALERT interrupt service routine
*
* The ISR disables further interrupt generation and notifies the application. To clear the interrupt
* source, the application must call \ref scifClearAlertIntSource. The CPU interrupt flag is cleared and
* the interrupt is reenabled when calling \ref scifAckAlertEvents() to generate ACK.
*
* \param[in] arg
* Unused
*/
static void osalTaskAlertIsr(UArg arg) {
scifOsalDisableTaskAlertInt();
osalIndicateTaskAlert();
} // osalTaskAlertIsr
/** \brief OSAL "TI-RTOS": Registers the task control READY interrupt callback
*
* Using this callback is normally optional. See \ref osalIndicateCtrlReady() for details.
*
* \param[in] callback
* Callback function pointer "void func(void)"
*/
void scifOsalRegisterCtrlReadyCallback(SCIF_VFPTR callback) {
osalIndicateCtrlReadyCallback = callback;
} // scifOsalRegisterCtrlReadyCallback
/** \brief OSAL "TI-RTOS": Registers the task ALERT interrupt callback
*
* Using this callback is normally required. See \ref osalIndicateTaskAlert() for details.
*
* \param[in] callback
* Callback function pointer "void func(void)"
*/
void scifOsalRegisterTaskAlertCallback(SCIF_VFPTR callback) {
osalIndicateTaskAlertCallback = callback;
} // scifOsalRegisterTaskAlertCallback
/** \brief OSAL "TI-RTOS": Initializes the OSAL
*
* This creates a binary semaphore used to wait on the task control interface.
*
* This function must be called once at startup before using the task control functions:
* - \ref scifStartTasksNbl()
* - \ref scifStopTasksNbl()
* - \ref scifWaitOnNbl()
*/
void scifOsalInit(void) {
// If the OSAL has not yet been initialized ...
if (!osalInitDone) {
osalInitDone = true;
// Create a binary semaphore, initially blocked.
Semaphore_Params semParams;
Semaphore_Params_init(&semParams);
semParams.mode = Semaphore_Mode_BINARY;
Semaphore_construct(&semCtrlReady, 0, &semParams);
}
} // scifOsalInit
#endif
//@}
// Generated by DESKTOP-MMLJVDE at 2022-02-03 20:45:31.239
|
the_stack_data/159516141.c | #include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
int getDegrees(int initial, int first, int second, int third)
{
int sum = 0;
sum += 360 * 2;
if (initial == first)
{
sum += 360;
} else
{
sum += ((initial - first + 40) % 40) * 9;
}
sum += 360;
if (first == second)
{
sum += 360;
} else
{
sum += ((second - first + 40) % 40) * 9;
}
if (second == third)
{
sum += 360;
} else
{
sum += ((second - third + 40) % 40) * 9;
}
return sum;
}
int main()
{
int initial, first, second, third, result;
bool reachedEnd = false;
scanf("%d %d %d %d", &initial, &first, &second, &third);
result = getDegrees(initial, first, second, third);
printf("%d", result);
reachedEnd = (initial == 0 && first == 0 && second == 0 && third == 0);
while (!reachedEnd)
{
scanf("%d %d %d %d", &initial, &first, &second, &third);
result = getDegrees(initial, first, second, third);
printf("\n%d", result);
reachedEnd = (initial == 0 && first == 0 && second == 0 && third == 0);
}
return 0;
}
|
the_stack_data/6927.c | #include <stdio.h>
#include <string.h>
/* Функция для вычисления пересечений строк */
int cut(char *a, char *b) {
int i, j, len=strlen(a), n=0;
for (i=0; i<len; i++) {
if (a[i]==b[0]) {
for (j=0; j+i<len; j++) {
if (a[j+i]!=b[j]) {
n=0;
break;
}
n++;
}
}
if (n!=0) break;
}
return n;
}
/*Функция считает сумму всех пересечений строк */
int summat(int mat[10][10], int n, int *numb) {
int i, sumt=0;
for (i=0; i<n-1; i++) sumt = sumt + mat[numb[i]][numb[i+1]];
return sumt;
}
/* Алгоритм Нарайаны: */
int NextPerm (int *a, int n) {
int i, k, t, tmp;
for (k = n - 2; (a[k] > a[k + 1]) && (k >= 0); k--);
if (k == -1)
return 0;
for (t = n - 1; (a[k] > a[t]) && (t >= k + 1); t--);
tmp = a[k], a[k] = a[t], a[t] = tmp;
for (i = k + 1; i <= (n + k)/2; i++) {
t = n + k - i;
tmp = a[i], a[i] = a[t], a[t] = tmp;
}
return i;
}
int main()
{
int n, i, j, len, sum=0, numb[10]={0,1,2,3,4,5,6,7,8,9}, min, k, t, l=0;
char str[11][20];
int mat[10][10]={{0}};
scanf("%d\n", &n);
for (i=0; i<n; i++) gets(str[i]);
/* Матрица пересечений */
for (i=0; i<n; i++) {
for (j=0; j<n; j++) mat[i][j]=cut(str[i], str[j]);
}
for (i=0; i<n; i++) sum=sum+strlen(str[i]);
min = sum - summat(mat, n, numb);
/* Работаем с перестановками */
do {
len = sum - summat(mat, n, numb);
if (len<min) min=len;
} while (NextPerm (numb, n));
printf("%d\n", min);
return 0;
} |
the_stack_data/331885.c | // Copyright (c) 2020-present, HexHacking Team. All rights reserved.
// Copyright (c) 2019, iQIYI, Inc. 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.
//
// Created on 2019-03-07.
typedef int make_iso_compilers_happy;
#ifdef __arm__
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
#include "xcc_errno.h"
#include "xcd_arm_exidx.h"
#include "xcd_regs.h"
#include "xcd_memory.h"
#include "xcd_util.h"
#include "xcd_log.h"
#define XCD_ARM_EXIDX_REGS_SP 13
#define XCD_ARM_EXIDX_REGS_PC 15
#define XCD_ARM_EXIDX_OP_FINISH 0xb0
typedef struct
{
xcd_regs_t *regs;
xcd_memory_t *memory;
pid_t pid;
uintptr_t vsp;
uintptr_t pc;
int pc_set;
size_t exidx_offset;
size_t exidx_size;
size_t entry_offset;
uint8_t entry[32]; //same as libunwind
size_t entry_size;
size_t entry_idx;
int no_unwind;
int finished;
} xcd_arm_exidx_t;
static void xcd_arm_exidx_init(xcd_arm_exidx_t *self, xcd_regs_t *regs, xcd_memory_t *memory,
pid_t pid, size_t exidx_offset, size_t exidx_size, uintptr_t pc)
{
self->regs = regs;
self->memory = memory;
self->pid = pid;
self->vsp = xcd_regs_get_sp(regs);
self->pc = pc;
self->pc_set = 0;
self->exidx_offset = exidx_offset;
self->exidx_size = exidx_size;
self->entry_offset = 0;
self->entry_size = 0;
self->entry_idx = 0;
self->no_unwind = 0;
self->finished = 0;
}
static int xcd_arm_exidx_prel31_addr(xcd_memory_t *memory, uint32_t offset, uint32_t* addr)
{
uint32_t data;
if(0 != xcd_memory_read_fully(memory, offset, &data, sizeof(data))) return XCC_ERRNO_MEM;
//sign extend the value if necessary
int32_t value = ((int32_t)(data) << 1) >> 1;
*addr = (uint32_t)((int32_t)offset + value);
return 0;
}
static int xcd_arm_exidx_entry_push(xcd_arm_exidx_t *self, uint8_t byte)
{
if(self->entry_size >= 32) return XCC_ERRNO_NOSPACE;
self->entry[self->entry_size] = byte;
self->entry_size++;
return 0;
}
static int xcd_arm_exidx_entry_pop(xcd_arm_exidx_t *self, uint8_t *byte)
{
if(self->entry_idx >= self->entry_size) return XCC_ERRNO_NOTFND;
*byte = self->entry[self->entry_idx];
self->entry_idx++;
return 0;
}
static int xcd_arm_exidx_get_entry_offset(xcd_arm_exidx_t *self)
{
if(0 == self->exidx_offset || 0 == self->exidx_size) return XCC_ERRNO_NOTFND;
size_t first = 0;
size_t last = self->exidx_size / 8;
size_t current;
uint32_t addr;
int r;
while (first < last)
{
current = (first + last) / 2;
if(0 != (r = xcd_arm_exidx_prel31_addr(self->memory, self->exidx_offset + current * 8, &addr))) return r;
if(self->pc == addr)
{
self->entry_offset = self->exidx_offset + current * 8;
return 0; //found
}
else if(self->pc < addr)
{
last = current;
}
else
{
first = current + 1;
}
}
if(last > 0)
{
self->entry_offset = self->exidx_offset + (last - 1) * 8;
return 0; //found
}
return XCC_ERRNO_NOTFND;
}
static int xcd_arm_exidx_get_entry(xcd_arm_exidx_t *self)
{
int r;
if(self->entry_offset & 1) return XCC_ERRNO_FORMAT;
//read entry value
uint32_t data;
if(0 != xcd_memory_read_fully(self->memory, self->entry_offset + 4, &data, sizeof(data))) return XCC_ERRNO_MEM;
if(1 == data)
{
//cantunwind
self->no_unwind = 1;
return XCC_ERRNO_FORMAT;
}
else if(data & (1UL << 31))
{
//a table entry itself (compact model: Su16)
if((data >> 24) & 0xf) return XCC_ERRNO_FORMAT;
if(0 != (r = xcd_arm_exidx_entry_push(self, (data >> 16) & 0xff))) return r;
if(0 != (r = xcd_arm_exidx_entry_push(self, (data >> 8) & 0xff))) return r;
if(0 != (r = xcd_arm_exidx_entry_push(self, data & 0xff))) return r;
if((data & 0xff) != XCD_ARM_EXIDX_OP_FINISH)
if(0 != (r = xcd_arm_exidx_entry_push(self, XCD_ARM_EXIDX_OP_FINISH))) return r;
return 0; //finished
}
else
{
//a prel31 offset of the start of the table entry
//get the address of the table entry
int32_t signed_data = (int32_t)(data << 1) >> 1;
uint32_t addr = (uint32_t)((int32_t)(self->entry_offset + 4) + signed_data);
//get the table entry
if(0 != xcd_memory_read_fully(self->memory, addr, &data, sizeof(data))) return XCC_ERRNO_MEM;
size_t num_table_words = 0;
if (data & (1UL << 31))
{
//compact model
switch((data >> 24) & 0xf)
{
case 0:
//Su16
if(0 != (r = xcd_arm_exidx_entry_push(self, (data >> 16) & 0xff))) return r;
if(0 != (r = xcd_arm_exidx_entry_push(self, (data >> 8) & 0xff))) return r;
if(0 != (r = xcd_arm_exidx_entry_push(self, data & 0xff))) return r;
if((data & 0xff) != XCD_ARM_EXIDX_OP_FINISH)
if(0 != (r = xcd_arm_exidx_entry_push(self, XCD_ARM_EXIDX_OP_FINISH))) return r;
return 0; //finished
case 1:
//Lu16
case 2:
//Lu32
num_table_words = (data >> 16) & 0xff;
if(0 != (r = xcd_arm_exidx_entry_push(self, (data >> 8) & 0xff))) return r;
if(0 != (r = xcd_arm_exidx_entry_push(self, data & 0xff))) return r;
addr += 4;
break;
default:
return XCC_ERRNO_FORMAT;
}
}
else
{
//generic model
addr += 4; //skip the personality routine data (prs_fnc_offset)
if(0 != xcd_memory_read_fully(self->memory, addr, &data, sizeof(data))) return XCC_ERRNO_MEM;
num_table_words = (data >> 24) & 0xff;
if(0 != (r = xcd_arm_exidx_entry_push(self, (data >> 16) & 0xff))) return r;
if(0 != (r = xcd_arm_exidx_entry_push(self, (data >> 8) & 0xff))) return r;
if(0 != (r = xcd_arm_exidx_entry_push(self, data & 0xff))) return r;
addr += 4;
}
if(num_table_words > 5) return XCC_ERRNO_FORMAT;
//get additional insn
size_t j;
for(j = 0; j < num_table_words; j++)
{
if(0 != xcd_memory_read_fully(self->memory, addr, &data, sizeof(data))) return XCC_ERRNO_MEM;
if(0 != (r = xcd_arm_exidx_entry_push(self, (data >> 24) & 0xff))) return r;
if(0 != (r = xcd_arm_exidx_entry_push(self, (data >> 16) & 0xff))) return r;
if(0 != (r = xcd_arm_exidx_entry_push(self, (data >> 8) & 0xff))) return r;
if(0 != (r = xcd_arm_exidx_entry_push(self, data & 0xff))) return r;
addr += 4;
}
if(0 == self->entry_size) return XCC_ERRNO_MISSING;
if(XCD_ARM_EXIDX_OP_FINISH != self->entry[self->entry_size - 1])
if(0 != (r = xcd_arm_exidx_entry_push(self, XCD_ARM_EXIDX_OP_FINISH))) return r;
return 0; //finished
}
}
static int xcd_arm_exidx_decode_entry_10_00(xcd_arm_exidx_t *self, uint8_t byte)
{
int r;
uint16_t bytes = (uint16_t)((byte & 0xf) << 8);
if(0 != (r = xcd_arm_exidx_entry_pop(self, &byte))) return r;
bytes |= byte;
if(0 == bytes)
{
// 10000000 00000000: Refuse to unwind
self->no_unwind = 1;
return XCC_ERRNO_FORMAT;
}
else
{
// 1000iiii iiiiiiii: Pop up to 12 integer registers under masks {r15-r12}, {r11-r4}
bytes <<= 4;
size_t reg;
for(reg = 4; reg < 16; reg++)
{
if(bytes & (1 << reg))
{
#if XCD_ARM_EXIDX_DEBUG
XCD_LOG_DEBUG("ARM_EXIDE: 1000, ptrace, reg=%zu, vsp=%x", reg, self->vsp);
#endif
if(0 != xcd_util_ptrace_read_fully(self->pid, self->vsp, &(self->regs->r[reg]), sizeof(uint32_t))) return XCC_ERRNO_MEM;
self->vsp += 4;
}
}
if(bytes & (1 << XCD_ARM_EXIDX_REGS_SP))
self->vsp = xcd_regs_get_sp(self->regs);
if(bytes & (1 << XCD_ARM_EXIDX_REGS_PC))
self->pc_set = 1;
return 0;
}
}
static int xcd_arm_exidx_decode_entry_10_01(xcd_arm_exidx_t *self, uint8_t byte)
{
uint8_t bits = byte & 0xf;
switch(bits)
{
case 13:
// 10011101: Reserved as prefix for ARM register to register moves
return XCC_ERRNO_FORMAT;
case 15:
// 10011111: Reserved as prefix for Intel Wireless MMX register to register moves
return XCC_ERRNO_FORMAT;
default:
// 1001nnnn: Set vsp = r[nnnn]
self->vsp = self->regs->r[bits];
return 0;
}
}
static int xcd_arm_exidx_decode_entry_10_10(xcd_arm_exidx_t *self, uint8_t byte)
{
// 10100nnn: Pop r4-r[4+nnn]
// 10101nnn: Pop r4-r[4+nnn], r14
size_t i;
for(i = 4; i <= (size_t)(4 + (byte & 0x7)); i++)
{
#if XCD_ARM_EXIDX_DEBUG
XCD_LOG_DEBUG("ARM_EXIDE: 1010, ptrace, reg=%zu, vsp=%x", i, self->vsp);
#endif
if(0 != xcd_util_ptrace_read_fully(self->pid, self->vsp, &(self->regs->r[i]), sizeof(uint32_t))) return XCC_ERRNO_MEM;
self->vsp += 4;
}
if(byte & 0x8)
{
#if XCD_ARM_EXIDX_DEBUG
XCD_LOG_DEBUG("ARM_EXIDE: 1010, ptrace, reg=%zu, vsp=%x", 14, self->vsp);
#endif
if(0 != xcd_util_ptrace_read_fully(self->pid, self->vsp, &(self->regs->r[14]), sizeof(uint32_t))) return XCC_ERRNO_MEM;
self->vsp += 4;
}
return 0;
}
static int xcd_arm_exidx_decode_entry_10_11_0000(xcd_arm_exidx_t *self)
{
// 10110000: Finish
self->finished = 1;
return XCC_ERRNO_RANGE;
}
static int xcd_arm_exidx_decode_entry_10_11_0001(xcd_arm_exidx_t *self)
{
int r;
uint8_t byte;
if(0 != (r = xcd_arm_exidx_entry_pop(self, &byte))) return r;
if(0 == byte)
{
// 10110001 00000000: Spare
return XCC_ERRNO_FORMAT;
}
else if(byte >> 4)
{
// 10110001 xxxxyyyy: Spare (xxxx != 0000)
return XCC_ERRNO_FORMAT;
}
else
{
// 10110001 0000iiii: Pop integer registers under mask {r3, r2, r1, r0}
size_t reg;
for(reg = 0; reg < 4; reg++)
{
if(byte & (1 << reg))
{
#if XCD_ARM_EXIDX_DEBUG
XCD_LOG_DEBUG("ARM_EXIDE: 10110001, ptrace, reg=%zu, vsp=%x", reg, self->vsp);
#endif
if(0 != xcd_util_ptrace_read_fully(self->pid, self->vsp, &(self->regs->r[reg]), sizeof(uint32_t))) return XCC_ERRNO_MEM;
self->vsp += 4;
}
}
}
return 0;
}
static int xcd_arm_exidx_decode_entry_10_11_0010(xcd_arm_exidx_t *self)
{
// 10110010 uleb128: vsp = vsp + 0x204 + (uleb128 << 2)
uint32_t result = 0;
uint32_t shift = 0;
uint8_t byte;
int r;
do
{
if(0 != (r = xcd_arm_exidx_entry_pop(self, &byte))) return r;
result |= (uint32_t)((byte & 0x7f) << shift);
shift += 7;
} while (byte & 0x80);
self->vsp += 0x204 + (result << 2);
return 0;
}
static int xcd_arm_exidx_decode_entry_10_11_0011(xcd_arm_exidx_t *self)
{
// 10110011 sssscccc: Pop VFP double precision registers D[ssss]-D[ssss+cccc] by FSTMFDX
uint8_t byte;
int r;
if(0 != (r = xcd_arm_exidx_entry_pop(self, &byte))) return r;
self->vsp += ((byte & 0xf) + 1) * 8 + 4;
return 0;
}
static int xcd_arm_exidx_decode_entry_10_11_1nnn(xcd_arm_exidx_t *self, uint8_t byte)
{
// 10111nnn: Pop VFP double-precision registers D[8]-D[8+nnn] by FSTMFDX
self->vsp += ((byte & 0x7) + 1) * 8 + 4;
return 0;
}
static int xcd_arm_exidx_decode_entry_10_11_01nn(xcd_arm_exidx_t *self)
{
(void)self;
// 101101nn: Spare
return XCC_ERRNO_FORMAT;
}
static int xcd_arm_exidx_decode_entry_10(xcd_arm_exidx_t *self, uint8_t byte)
{
switch((byte >> 4) & 0x3)
{
case 0:
return xcd_arm_exidx_decode_entry_10_00(self, byte);
case 1:
return xcd_arm_exidx_decode_entry_10_01(self, byte);
case 2:
return xcd_arm_exidx_decode_entry_10_10(self, byte);
default:
switch (byte & 0xf)
{
case 0:
return xcd_arm_exidx_decode_entry_10_11_0000(self);
case 1:
return xcd_arm_exidx_decode_entry_10_11_0001(self);
case 2:
return xcd_arm_exidx_decode_entry_10_11_0010(self);
case 3:
return xcd_arm_exidx_decode_entry_10_11_0011(self);
default:
if(byte & 0x8)
{
return xcd_arm_exidx_decode_entry_10_11_1nnn(self, byte);
}
else
{
return xcd_arm_exidx_decode_entry_10_11_01nn(self);
}
}
}
}
static int xcd_arm_exidx_decode_entry_11_000(xcd_arm_exidx_t *self, uint8_t byte)
{
int r;
uint8_t bits = byte & 0x7;
if(6 == bits)
{
if(0 != (r = xcd_arm_exidx_entry_pop(self, &byte))) return r;
// 11000110 sssscccc: Intel Wireless MMX pop wR[ssss]-wR[ssss+cccc]
self->vsp += ((byte & 0xf) + 1) * 8;
return 0;
}
else if(7 == bits)
{
if(0 != (r = xcd_arm_exidx_entry_pop(self, &byte))) return r;
if(0 == byte)
{
// 11000111 00000000: Spare
return XCC_ERRNO_FORMAT;
}
else if(0 == (byte >> 4))
{
// 11000111 0000iiii: Intel Wireless MMX pop wCGR registers {wCGR0,1,2,3}
self->vsp += (uintptr_t)(__builtin_popcount(byte) * 4);
return 0;
}
else
{
// 11000111 xxxxyyyy: Spare (xxxx != 0000)
return XCC_ERRNO_FORMAT;
}
}
else
{
// 11000nnn: Intel Wireless MMX pop wR[10]-wR[10+nnn] (nnn != 6, 7)
self->vsp += ((byte & 0x7) + 1) * 8;
return 0;
}
}
static int xcd_arm_exidx_decode_entry_11_001(xcd_arm_exidx_t *self, uint8_t byte)
{
int r;
uint8_t bits = byte & 0x7;
if(0 == bits)
{
if(0 != (r = xcd_arm_exidx_entry_pop(self, &byte))) return r;
// 11001000 sssscccc: Pop VFP double precision registers D[16+ssss]-D[16+ssss+cccc] by VPUSH
self->vsp += ((byte & 0xf) + 1) * 8;
return 0;
}
else if(1 == bits)
{
if(0 != (r = xcd_arm_exidx_entry_pop(self, &byte))) return r;
// 11001001 sssscccc: Pop VFP double precision registers D[ssss]-D[ssss+cccc] by VPUSH
self->vsp += ((byte & 0xf) + 1) * 8;
return 0;
}
else
{
// 11001yyy: Spare (yyy != 000, 001)
return XCC_ERRNO_FORMAT;
}
}
static int xcd_arm_exidx_decode_entry_11_010(xcd_arm_exidx_t *self, uint8_t byte)
{
// 11010nnn: Pop VFP double precision registers D[8]-D[8+nnn] by VPUSH
self->vsp += ((byte & 0x7) + 1) * 8;
return 0;
}
static int xcd_arm_exidx_decode_entry_11(xcd_arm_exidx_t *self, uint8_t byte)
{
switch ((byte >> 3) & 0x7)
{
case 0:
return xcd_arm_exidx_decode_entry_11_000(self, byte);
case 1:
return xcd_arm_exidx_decode_entry_11_001(self, byte);
case 2:
return xcd_arm_exidx_decode_entry_11_010(self, byte);
default:
// 11xxxyyy: Spare (xxx != 000, 001, 010)
return XCC_ERRNO_FORMAT;
}
}
static int xcd_arm_exidx_decode_entry(xcd_arm_exidx_t *self)
{
int r = 0;
uint8_t byte;
if(0 != (r = xcd_arm_exidx_entry_pop(self, &byte))) return r;
switch(byte >> 6)
{
case 0:
//00xxxxxx: vsp = vsp + (xxxxxx << 2) + 4
self->vsp += (uintptr_t)(((byte & 0x3f) << 2) + 4);
return 0;
case 1:
//01xxxxxx: vsp = vsp - (xxxxxx << 2) - 4
self->vsp -= (uintptr_t)(((byte & 0x3f) << 2) + 4);
return 0;
case 2:
return xcd_arm_exidx_decode_entry_10(self, byte);
default:
return xcd_arm_exidx_decode_entry_11(self, byte);
}
}
int xcd_arm_exidx_step(xcd_regs_t *regs, xcd_memory_t *memory, pid_t pid,
size_t exidx_offset, size_t exidx_size, uintptr_t load_bias,
uintptr_t pc, int *finished)
{
xcd_arm_exidx_t self;
int r;
if(pc < load_bias) return XCC_ERRNO_NOTFND;
pc -= load_bias;
xcd_arm_exidx_init(&self, regs, memory, pid, exidx_offset, exidx_size, pc);
//get entry offset
if(0 != (r = xcd_arm_exidx_get_entry_offset(&self))) return r;
//get entry
if(0 != (r = xcd_arm_exidx_get_entry(&self)))
{
if(self.no_unwind)
{
*finished = 1;
return 0;
}
return r;
}
#if XCD_ARM_EXIDX_DEBUG
size_t i;
for(i = 0; i < self.entry_size; i++)
XCD_LOG_DEBUG("ARM_EXIDX: entry[%zu]=%x", i, self.entry[i]);
#endif
//decode entry
while(0 == xcd_arm_exidx_decode_entry(&self));
if(self.no_unwind)
{
*finished = 1;
return 0;
}
//step the sp and pc
if(self.finished)
{
if(0 == self.pc_set)
{
xcd_regs_set_pc_from_lr(self.regs, self.pid);
}
xcd_regs_set_sp(self.regs, self.vsp);
//if the pc was set to zero, consider this the final frame
*finished = (0 == xcd_regs_get_pc(self.regs) ? 1 : 0);
return 0;
}
else
{
return XCC_ERRNO_UNKNOWN;
}
}
#endif
|
the_stack_data/140765060.c | #include <stdio.h>
int main(int argc, char** argv)
{
char** str = { "22222", "AAAA" };
printf("%c", (**++str));
}
|
the_stack_data/72011873.c | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct node {
int value;
struct node *next;
struct node *prev;
} node;
typedef struct list {
struct node *head;
struct node *tail;
} list;
// инициализация пустого списка
void init(list *l)
{
l->tail = NULL;
l->head = NULL;
}
bool is_empty(list *l)
{
if (l == NULL) {
return true;
}
return l->head == NULL;
}
void clean(list *l)
{
if (l == NULL) {
return;
}
if (!is_empty(l)) {
node *pNextNode = l->head;
node *pNode;
while (pNextNode != NULL) {
pNode = pNextNode;
pNextNode = pNode->next;
free(pNode);
}
}
init(l);
}
node* find(list *l, int value, bool revert)
{
if (l == NULL) {
return NULL;
}
if (is_empty(l)) {
return NULL;
}
node *pNode = revert ? l->tail : l->head;
while (pNode) {
if (pNode->value == value) {
return pNode;
}
pNode = revert ? pNode->prev : pNode->next;
}
return NULL;
}
int push_front(list *l, int value)
{
//Лист не проинициализирован
if (l == NULL) {
return 1;
}
//Создаем ноду
node *pNode = (node*)malloc(sizeof(node));
//Задаем новой ноде значение
pNode->value = value;
//Задаем новой ноде следующий элемент - нода в начале листа
pNode->next = l->head;
//Предыдущего значения нет
pNode->prev = NULL;
//Если head задан
if (l->head != NULL) {
//Задаем предыдущий элемент ноде в начале листа - новую ноду
l->head->prev = pNode;
} else {
//Ставим новую нову конечной нодой листа
l->tail = pNode;
}
//Ставим новую нову начальной нодой листа
l->head = pNode;
return 0;
}
// вставка значения в конец списка, вернуть 0 если успешно
int push_back(list *l, int value)
{
//Лист не проинициализирован
if (l == NULL) {
return 1;
}
//Создаем ноду
node *pNode = (node*)malloc(sizeof(node));
//Задаем новой ноде значение
pNode->value = value;
//Задаем новой ноде предыдущий элемент - нода в конце листа
pNode->prev = l->tail;
//Следующего значения нет
pNode->next = NULL;
//Если tail задан
if (l->tail != NULL)
{
//Задаем следующий элемент ноде в конце листа - новую ноду
l->tail->next = pNode;
} else {
//Ставим новую нову начальной нодой листа
l->head = pNode;
}
//Ставим новую нову конечной нодой листа
l->tail = pNode;
return 0;
}
int insert_after(list *l, node *n, int value)
{
//Лист не проинициализирован
if (l == NULL) {
return 1;
}
//Создаем ноду
node *pNode = (node*)malloc(sizeof(node));
//Задаем новой ноде значение
pNode->value = value;
//Задаем новой ноде следующий элемент - следующая нашей ноды
pNode->next = n->next;
//Задаем предыдущей элемент новой ноды - наша нода
pNode->prev = n;
//Если следующая нода существует
if (n->next != NULL) {
//Задаем предыдущей элемент следующей ноде нашей ноды - новую ноду
n->next->prev = pNode;
} else {
l->tail = pNode;
}
//Задаем нашей ноде следующий элемент
n->next = pNode;
return 0;
}
int insert_before(list *l, node *n, int value)
{
//Лист не проинициализирован
if (l == NULL) {
return 1;
}
//Создаем ноду
node *pNode = (node*)malloc(sizeof(node));
//Задаем новой ноде значение
pNode->value = value;
//Задаем новой ноде следующий элемент - наша ноды
pNode->next = n;
//Задаем предыдущей элемент новой ноды - предыдущая нода нашей ноды
pNode->prev = n->prev;
//Если предыдущая нода существует
if (n->prev != NULL) {
//Задаем следующий элемент предыдущей ноде нашей ноды - новая нода
n->prev->next = pNode;
} else {
l->head = pNode;
}
//Задаем предыдущей элемент нашей ноды - новую ноду
n->prev = pNode;
return 0;
}
int remove_first(list *l, int value, bool revert)
{
//Лист не проинициализирован
if (l == NULL) {
return 1;
}
//Лист пустой
if (is_empty(l)) {
return 2;
}
//Ищем ноду с указанным значением
node *pNode = find(l, value, revert);
//Нода не проинициализирована
if (pNode == NULL) {
return 3;
}
//Нода первая в листе
if (pNode->prev == NULL) {
//Смещаем head листа к следующей ноде
l->head = pNode->next;
} else if (pNode->next == NULL) { //Нода последняя в листе
//Смещаем tail листа к предыдущей ноде
l->tail = pNode->prev;
//Убираем у предыдущей ноды связь с найденной
pNode->prev->next = NULL;
} else { //Нода в середине листа
//Задаем следующую ноду у предыдущий ноды - следующая нашей ноды
pNode->prev->next = pNode->next;
//Если следующая нода существует
if (pNode->next != NULL) {
//Задаем предыдущую ноду у следующей ноды - предыдущая нода нашей ноды
pNode->next->prev = pNode->prev;
}
}
//Очищаем память, выделенную для ноды
free(pNode);
return 0;
}
void print(list *l)
{
//Лист не проинициализирован
if (l == NULL) {
return;
}
//Лист пустой
if (is_empty(l)) {
return;
}
//Начинаем с начала
node *pNode = l->head;
while (pNode != NULL)
{
//Выводим значения через пробел
printf("%d ", pNode->value);
//До конца
pNode = pNode->next;
}
//Переходим на новую строку
printf("\n");
}
void print_invers(list *l)
{
//Лист не проинициализирован
if (l == NULL) {
return;
}
//Лист пустой
if (is_empty(l)) {
return;
}
//Начинаем с конца
node *pNode = l->tail;
while (pNode != NULL)
{
//Выводим значения через пробел
printf("%d ", pNode->value);
//До начала
pNode = pNode->prev;
}
//Переходим на новую строку
printf("\n");
}
node* get(list* l, unsigned int index)
{
//Лист не проинициализирован
if (l == NULL) {
return NULL;
}
//Лист пустой
if (is_empty(l)) {
return NULL;
}
//Начинаем с начала
node* pNode = l->head;
unsigned int i = 1;
while (pNode != NULL)
{
//До нужного индекса
if (i == index) {
return pNode;
}
pNode = pNode->next;
++i;
}
//Если индекс вышел за рамки размера листа
return NULL;
}
int main()
{
unsigned int n;
int args = scanf("%u", &n);
if (args != 1) {
return 1;
}
if (n == 0) {
return 2;
}
list *linkedList = (list*)malloc(sizeof(list));
init(linkedList);
int a;
for (unsigned int i = 0; i < n; ++i) {
args = scanf("%d", &a);
if (args != 1) {
return 3;
}
push_back(linkedList, a);
}
print(linkedList);
int k[3];
for (unsigned int i = 0; i < 3; ++i)
{
args = scanf("%d", &k[i]);
if (args != 1) {
return 4;
}
}
for (unsigned int i = 0; i < 3; ++i) {
printf("%d ", find(linkedList, k[i], false) != NULL);
}
printf("\n");
int m;
args = scanf("%d", &m);
if (args != 1) {
return 5;
}
push_back(linkedList, m);
print_invers(linkedList);
int t;
args = scanf("%d", &t);
if (args != 1) {
return 6;
}
push_front(linkedList, t);
print(linkedList);
unsigned int j;
args = scanf("%u", &j);
if (args != 1) {
return 7;
}
if (j == 0) {
return 8;
}
int x;
args = scanf("%d", &x);
if (args != 1) {
return 9;
}
node* pNode = get(linkedList, j);
if (pNode == NULL) {
return 10;
}
insert_after(linkedList, pNode, x);
print_invers(linkedList);
unsigned int u;
args = scanf("%u", &u);
if (args != 1) {
return 11;
}
if (u == 0) {
return 12;
}
int y;
args = scanf("%d", &y);
if (args != 1) {
return 13;
}
pNode = get(linkedList, u);
if (pNode == NULL) {
return 14;
}
insert_before(linkedList, pNode, y);
print(linkedList);
int z;
args = scanf("%d", &z);
if (args != 1) {
return 15;
}
remove_first(linkedList, z, false);
print_invers(linkedList);
int r;
args = scanf("%d", &r);
if (args != 1) {
return 16;
}
remove_first(linkedList, r, true);
print(linkedList);
clean(linkedList);
free(linkedList);
return 0;
}
|
the_stack_data/658912.c | /* Exercise 1 - Calculations
Write a C program to input marks of two subjects. Calculate and print the average of the two marks. */
#include <stdio.h>
int main() {
// declare variable
float sub1,sub2 , total, average;
//get user input
printf("Enter the marks of Subject 1 = ");
scanf("%f",&sub1);
printf("Enter the marks of Subject 2 = ");
scanf("%f",&sub2);
//calculation
total = sub1 +sub2;
average = total /2;
//output
printf("The average is %.2f",average);
return 0;
}
|
the_stack_data/242331643.c | /*
* This file is part of the libohiboard project.
*
* Copyright (C) 2019 A. C. Open Hardware Ideas Lab
*
* Authors:
* Marco Giammarini <[email protected]>
*
* 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.
*/
/**
* @file libohiboard/source/STM32L0/uart_STM32L0.c
* @author Marco Giammarini <[email protected]>
* @brief UART implementations for STM32L0 Series.
*/
#ifdef LIBOHIBOARD_UART
#ifdef __cplusplus
extern "C" {
#endif
#include "uart.h"
#include "interrupt.h"
#include "clock.h"
#include "utility.h"
#include "gpio.h"
#include "system.h"
#if defined (LIBOHIBOARD_STM32L0)
#define UART_DEVICE_ENABLE(REGMAP) (REGMAP->CR1 |= USART_CR1_UE)
#define UART_DEVICE_DISABLE(REGMAP) (REGMAP->CR1 &= ~USART_CR1_UE)
#define UART_MAX_PINS 8
#define UART_LP_BRR_MIN 0x00000300U
#define UART_LP_BRR_MAX 0x000FFFFFU
#define UART_BRR_MIN 0x10U
#define UART_BRR_MAX 0x0000FFFFU
#define UART_CLOCK_ENABLE(REG,MASK) do { \
UTILITY_SET_REGISTER_BIT(REG,MASK); \
asm("nop"); \
(void) UTILITY_READ_REGISTER_BIT(REG,MASK); \
} while (0)
#define UART_CLOCK_DISABLE(REG,MASK) do { \
UTILITY_CLEAR_REGISTER_BIT(REG,MASK); \
asm("nop"); \
(void) UTILITY_READ_REGISTER_BIT(REG,MASK); \
} while (0)
/**
* @brief Check that number of stop bits is valid for UART.
* @param STOPBITS Number of stop bits.
* @retval TRUE if is valid, FALSE otherwise
*
* @hideinitializer
*/
#define UART_VALID_STOPBITS(STOPBITS) (((STOPBITS) == UART_STOPBITS_HALF) || \
((STOPBITS) == UART_STOPBITS_ONE) || \
((STOPBITS) == UART_STOPBITS_ONE_AND_HALF) || \
((STOPBITS) == UART_STOPBITS_TWO))
/**
* @brief Check that number of stop bits is valid for LPUART.
* @param STOPBITS Number of stop bits.
* @retval TRUE if is valid, FALSE otherwise
*/
#define UART_VALID_STOPBITS_LP(STOPBITS) (((STOPBITS) == UART_STOPBITS_ONE) || \
((STOPBITS) == UART_STOPBITS_TWO))
/**
* @brief Check that UART parity is valid.
* @param PARITY UART parity type.
* @retval TRUE if is valid, FALSE otherwise
*/
#define UART_VALID_PARITY(PARITY) (((PARITY) == UART_PARITY_NONE) || \
((PARITY) == UART_PARITY_EVEN) || \
((PARITY) == UART_PARITY_ODD))
#define UART_VALID_DATABITS(DATABITS) (((DATABITS) == UART_DATABITS_SEVEN) || \
((DATABITS) == UART_DATABITS_EIGHT) || \
((DATABITS) == UART_DATABITS_NINE))
#define UART_VALID_FLOWCONTROL(FLOWCONTROL) (((FLOWCONTROL) == UART_FLOWCONTROL_NONE) || \
((FLOWCONTROL) == UART_FLOWCONTROL_CTS) || \
((FLOWCONTROL) == UART_FLOWCONTROL_RTS) || \
((FLOWCONTROL) == UART_FLOWCONTROL_CTS_RTS))
#define UART_VALID_MODE(MODE) (((MODE) == UART_MODE_TRANSMIT) || \
((MODE) == UART_MODE_RECEIVE) || \
((MODE) == UART_MODE_BOTH))
#define UART_IS_DEVICE(DEVICE) (((DEVICE) == OB_UART1) || \
((DEVICE) == OB_UART2) || \
((DEVICE) == OB_UART4) || \
((DEVICE) == OB_UART5))
#define UART_IS_LOWPOWER_DEVICE(DEVICE) ((DEVICE) == OB_LPUART1)
#define UART_IS_DUAL_CLOCK_DOMAIN(DEVICE) (((DEVICE) == OB_UART1) || \
((DEVICE) == OB_UART2) || \
((DEVICE) == OB_LPUART1))
#define UART_IS_VALID_CLOCK_SOURCE(CLOCKSOURCE) (((CLOCKSOURCE) == UART_CLOCKSOURCE_PCLK) || \
((CLOCKSOURCE) == UART_CLOCKSOURCE_LSE) || \
((CLOCKSOURCE) == UART_CLOCKSOURCE_HSI) || \
((CLOCKSOURCE) == UART_CLOCKSOURCE_SYSCLK))
/**
* @brief Check the baudrate value
*/
#define UART_VALID_BAUDRATE(BAUDRATE) ((BAUDRATE) <= UART_MAX_BAUDRATE)
#define UART_VALID_OVERSAMPLING(OVERSAMPLING) (((OVERSAMPLING) == 8) || \
((OVERSAMPLING) == 16))
typedef struct _Uart_Device
{
USART_TypeDef* regmap; /**< Device memory pointer */
volatile uint32_t* rccRegisterPtr; /**< Register for clock enabling. */
uint32_t rccRegisterEnable; /**< Register mask for current device. */
volatile uint32_t* rccTypeRegisterPtr; /**< Register for clock enabling. */
uint32_t rccTypeRegisterMask; /**< Register mask for user selection. */
uint32_t rccTypeRegisterPos; /**< Mask position for user selection. */
Uart_RxPins rxPins[UART_MAX_PINS];
Uart_TxPins txPins[UART_MAX_PINS];
Gpio_Pins rxPinsGpio[UART_MAX_PINS];
Gpio_Pins txPinsGpio[UART_MAX_PINS];
Gpio_Alternate rxPinsMux[UART_MAX_PINS];
Gpio_Alternate txPinsMux[UART_MAX_PINS];
Uart_Config config;
uint16_t mask; /**< Computed mask to use with received data. */
/** The function pointer for user Rx callback. */
void (*callbackRx)(struct _Uart_Device* dev);
/** The function pointer for user Tx callback. */
void (*callbackTx)(struct _Uart_Device* dev);
Interrupt_Vector isrNumber; /**< ISR vector number. */
Uart_DeviceState state;
} Uart_Device;
static Uart_Device uart1 = {
.regmap = USART1,
.rccRegisterPtr = &RCC->APB2ENR,
.rccRegisterEnable = RCC_APB2ENR_USART1EN,
.rccTypeRegisterPtr = &RCC->CCIPR,
.rccTypeRegisterMask = RCC_CCIPR_USART1SEL,
.rccTypeRegisterPos = RCC_CCIPR_USART1SEL_Pos,
.rxPins =
{
UART_PINS_PA10,
UART_PINS_PB7,
},
.rxPinsGpio =
{
GPIO_PINS_PA10,
GPIO_PINS_PB7,
},
.rxPinsMux =
{
GPIO_ALTERNATE_4,
GPIO_ALTERNATE_0,
},
.txPins =
{
UART_PINS_PA9,
UART_PINS_PB6,
},
.txPinsGpio =
{
GPIO_PINS_PA9,
GPIO_PINS_PB6,
},
.txPinsMux =
{
GPIO_ALTERNATE_4,
GPIO_ALTERNATE_0,
},
.isrNumber = INTERRUPT_USART1,
.state = UART_DEVICESTATE_RESET,
};
Uart_DeviceHandle OB_UART1 = &uart1;
static Uart_Device uart2 = {
.regmap = USART2,
.rccRegisterPtr = &RCC->APB1ENR,
.rccRegisterEnable = RCC_APB1ENR_USART2EN,
.rccTypeRegisterPtr = &RCC->CCIPR,
.rccTypeRegisterMask = RCC_CCIPR_USART2SEL,
.rccTypeRegisterPos = RCC_CCIPR_USART2SEL_Pos,
.rxPins =
{
UART_PINS_PA3,
UART_PINS_PA15,
#if defined (LIBOHIBOARD_STM32L073VxT) || \
defined (LIBOHIBOARD_STM32L073VxI)
UART_PINS_PD6,
#endif
},
.rxPinsGpio =
{
GPIO_PINS_PA3,
GPIO_PINS_PA15,
#if defined (LIBOHIBOARD_STM32L073VxT) || \
defined (LIBOHIBOARD_STM32L073VxI)
GPIO_PINS_PD6,
#endif
},
.rxPinsMux =
{
GPIO_ALTERNATE_4,
GPIO_ALTERNATE_4,
#if defined (LIBOHIBOARD_STM32L073VxT) || \
defined (LIBOHIBOARD_STM32L073VxI)
GPIO_ALTERNATE_0,
#endif
},
.txPins =
{
UART_PINS_PA2,
UART_PINS_PA14,
#if defined (LIBOHIBOARD_STM32L073VxT) || \
defined (LIBOHIBOARD_STM32L073VxI)
UART_PINS_PD5,
#endif
},
.txPinsGpio =
{
GPIO_PINS_PA2,
GPIO_PINS_PA14,
#if defined (LIBOHIBOARD_STM32L073VxT) || \
defined (LIBOHIBOARD_STM32L073VxI)
GPIO_PINS_PD5,
#endif
},
.txPinsMux =
{
GPIO_ALTERNATE_4,
GPIO_ALTERNATE_4,
#if defined (LIBOHIBOARD_STM32L073VxT) || \
defined (LIBOHIBOARD_STM32L073VxI)
GPIO_ALTERNATE_0,
#endif
},
.isrNumber = INTERRUPT_USART2,
.state = UART_DEVICESTATE_RESET,
};
Uart_DeviceHandle OB_UART2 = &uart2;
static Uart_Device uart4 = {
.regmap = USART4,
.rccRegisterPtr = &RCC->APB1ENR,
.rccRegisterEnable = RCC_APB1ENR_USART4EN,
.rccTypeRegisterPtr = 0,
.rccTypeRegisterMask = 0,
.rccTypeRegisterPos = 0,
.rxPins =
{
UART_PINS_PA1,
#if defined (LIBOHIBOARD_STM32L073RxT) || \
defined (LIBOHIBOARD_STM32L073RxI) || \
defined (LIBOHIBOARD_STM32L073VxT) || \
defined (LIBOHIBOARD_STM32L073VxI)
UART_PINS_PC11,
#endif
#if defined (LIBOHIBOARD_STM32L073VxT) || \
defined (LIBOHIBOARD_STM32L073VxI)
UART_PINS_PE9,
#endif
},
.rxPinsGpio =
{
GPIO_PINS_PA1,
#if defined (LIBOHIBOARD_STM32L073RxT) || \
defined (LIBOHIBOARD_STM32L073RxI) || \
defined (LIBOHIBOARD_STM32L073VxT) || \
defined (LIBOHIBOARD_STM32L073VxI)
GPIO_PINS_PC11,
#endif
#if defined (LIBOHIBOARD_STM32L073VxT) || \
defined (LIBOHIBOARD_STM32L073VxI)
GPIO_PINS_PE9,
#endif
},
.rxPinsMux =
{
GPIO_ALTERNATE_6,
#if defined (LIBOHIBOARD_STM32L073RxT) || \
defined (LIBOHIBOARD_STM32L073RxI) || \
defined (LIBOHIBOARD_STM32L073VxT) || \
defined (LIBOHIBOARD_STM32L073VxI)
GPIO_ALTERNATE_6,
#endif
#if defined (LIBOHIBOARD_STM32L073VxT) || \
defined (LIBOHIBOARD_STM32L073VxI)
GPIO_ALTERNATE_6,
#endif
},
.txPins =
{
UART_PINS_PA0,
#if defined (LIBOHIBOARD_STM32L073RxT) || \
defined (LIBOHIBOARD_STM32L073RxI) || \
defined (LIBOHIBOARD_STM32L073VxT) || \
defined (LIBOHIBOARD_STM32L073VxI)
UART_PINS_PC10,
#endif
#if defined (LIBOHIBOARD_STM32L073VxT) || \
defined (LIBOHIBOARD_STM32L073VxI)
UART_PINS_PE8,
#endif
},
.txPinsGpio =
{
GPIO_PINS_PA0,
#if defined (LIBOHIBOARD_STM32L073RxT) || \
defined (LIBOHIBOARD_STM32L073RxI) || \
defined (LIBOHIBOARD_STM32L073VxT) || \
defined (LIBOHIBOARD_STM32L073VxI)
GPIO_PINS_PC10,
#endif
#if defined (LIBOHIBOARD_STM32L073VxT) || \
defined (LIBOHIBOARD_STM32L073VxI)
GPIO_PINS_PE8,
#endif
},
.txPinsMux =
{
GPIO_ALTERNATE_6,
#if defined (LIBOHIBOARD_STM32L073RxT) || \
defined (LIBOHIBOARD_STM32L073RxI) || \
defined (LIBOHIBOARD_STM32L073VxT) || \
defined (LIBOHIBOARD_STM32L073VxI)
GPIO_ALTERNATE_6,
#endif
#if defined (LIBOHIBOARD_STM32L073VxT) || \
defined (LIBOHIBOARD_STM32L073VxI)
GPIO_ALTERNATE_6,
#endif
},
.isrNumber = INTERRUPT_USART4_5,
.state = UART_DEVICESTATE_RESET,
};
Uart_DeviceHandle OB_UART4 = &uart4;
static Uart_Device uart5 = {
.regmap = USART5,
.rccRegisterPtr = &RCC->APB1ENR,
.rccRegisterEnable = RCC_APB1ENR_USART5EN,
.rccTypeRegisterPtr = 0,
.rccTypeRegisterMask = 0,
.rccTypeRegisterPos = 0,
.rxPins =
{
UART_PINS_PB4,
#if defined (LIBOHIBOARD_STM32L073RxT) || \
defined (LIBOHIBOARD_STM32L073RxI) || \
defined (LIBOHIBOARD_STM32L073VxT) || \
defined (LIBOHIBOARD_STM32L073VxI)
UART_PINS_PD2,
#endif
#if defined (LIBOHIBOARD_STM32L073VxT) || \
defined (LIBOHIBOARD_STM32L073VxI)
UART_PINS_PE11,
#endif
},
.rxPinsGpio =
{
GPIO_PINS_PB4,
#if defined (LIBOHIBOARD_STM32L073RxT) || \
defined (LIBOHIBOARD_STM32L073RxI) || \
defined (LIBOHIBOARD_STM32L073VxT) || \
defined (LIBOHIBOARD_STM32L073VxI)
GPIO_PINS_PD2,
#endif
#if defined (LIBOHIBOARD_STM32L073VxT) || \
defined (LIBOHIBOARD_STM32L073VxI)
GPIO_PINS_PE11,
#endif
},
.rxPinsMux =
{
GPIO_ALTERNATE_6,
#if defined (LIBOHIBOARD_STM32L073RxT) || \
defined (LIBOHIBOARD_STM32L073RxI) || \
defined (LIBOHIBOARD_STM32L073VxT) || \
defined (LIBOHIBOARD_STM32L073VxI)
GPIO_ALTERNATE_6,
#endif
#if defined (LIBOHIBOARD_STM32L073VxT) || \
defined (LIBOHIBOARD_STM32L073VxI)
GPIO_ALTERNATE_6,
#endif
},
.txPins =
{
UART_PINS_PB3,
#if defined (LIBOHIBOARD_STM32L073RxT) || \
defined (LIBOHIBOARD_STM32L073RxI) || \
defined (LIBOHIBOARD_STM32L073VxT) || \
defined (LIBOHIBOARD_STM32L073VxI)
UART_PINS_PC12,
#endif
#if defined (LIBOHIBOARD_STM32L073VxT) || \
defined (LIBOHIBOARD_STM32L073VxI)
UART_PINS_PE10,
#endif
},
.txPinsGpio =
{
GPIO_PINS_PB3,
#if defined (LIBOHIBOARD_STM32L073RxT) || \
defined (LIBOHIBOARD_STM32L073RxI) || \
defined (LIBOHIBOARD_STM32L073VxT) || \
defined (LIBOHIBOARD_STM32L073VxI)
GPIO_PINS_PC12,
#endif
#if defined (LIBOHIBOARD_STM32L073VxT) || \
defined (LIBOHIBOARD_STM32L073VxI)
GPIO_PINS_PE10,
#endif
},
.txPinsMux =
{
GPIO_ALTERNATE_6,
#if defined (LIBOHIBOARD_STM32L073RxT) || \
defined (LIBOHIBOARD_STM32L073RxI) || \
defined (LIBOHIBOARD_STM32L073VxT) || \
defined (LIBOHIBOARD_STM32L073VxI)
GPIO_ALTERNATE_2,
#endif
#if defined (LIBOHIBOARD_STM32L073VxT) || \
defined (LIBOHIBOARD_STM32L073VxI)
GPIO_ALTERNATE_6,
#endif
},
.isrNumber = INTERRUPT_USART4_5,
.state = UART_DEVICESTATE_RESET,
};
Uart_DeviceHandle OB_UART5 = &uart5;
static Uart_Device lpuart1 = {
.regmap = LPUART1,
.rccRegisterPtr = &RCC->APB1ENR,
.rccRegisterEnable = RCC_APB1ENR_LPUART1EN,
.rccTypeRegisterPtr = &RCC->CCIPR,
.rccTypeRegisterMask = RCC_CCIPR_LPUART1SEL,
.rccTypeRegisterPos = RCC_CCIPR_LPUART1SEL_Pos,
.rxPins =
{
UART_PINS_PA3,
UART_PINS_PA13,
UART_PINS_PB10_RX,
UART_PINS_PB11_RX,
#if defined (LIBOHIBOARD_STM32L073RxT) || \
defined (LIBOHIBOARD_STM32L073RxI) || \
defined (LIBOHIBOARD_STM32L073VxT) || \
defined (LIBOHIBOARD_STM32L073VxI)
UART_PINS_PC0,
UART_PINS_PC5,
UART_PINS_PC11,
#endif
#if defined (LIBOHIBOARD_STM32L073VxT) || \
defined (LIBOHIBOARD_STM32L073VxI)
UART_PINS_PD9,
#endif
},
.rxPinsGpio =
{
GPIO_PINS_PA3,
GPIO_PINS_PA13,
GPIO_PINS_PB10,
GPIO_PINS_PB11,
#if defined (LIBOHIBOARD_STM32L073RxT) || \
defined (LIBOHIBOARD_STM32L073RxI) || \
defined (LIBOHIBOARD_STM32L073VxT) || \
defined (LIBOHIBOARD_STM32L073VxI)
GPIO_PINS_PC0,
GPIO_PINS_PC5,
GPIO_PINS_PC11,
#endif
#if defined (LIBOHIBOARD_STM32L073VxT) || \
defined (LIBOHIBOARD_STM32L073VxI)
GPIO_PINS_PD9,
#endif
},
.rxPinsMux =
{
GPIO_ALTERNATE_6,
GPIO_ALTERNATE_6,
GPIO_ALTERNATE_7,
GPIO_ALTERNATE_4,
#if defined (LIBOHIBOARD_STM32L073RxT) || \
defined (LIBOHIBOARD_STM32L073RxI) || \
defined (LIBOHIBOARD_STM32L073VxT) || \
defined (LIBOHIBOARD_STM32L073VxI)
GPIO_ALTERNATE_6,
GPIO_ALTERNATE_2,
GPIO_ALTERNATE_0,
#endif
#if defined (LIBOHIBOARD_STM32L073VxT) || \
defined (LIBOHIBOARD_STM32L073VxI)
GPIO_ALTERNATE_0,
#endif
},
.txPins =
{
UART_PINS_PA2,
UART_PINS_PA14,
UART_PINS_PB10_TX,
UART_PINS_PB11_TX,
#if defined (LIBOHIBOARD_STM32L073RxT) || \
defined (LIBOHIBOARD_STM32L073RxI) || \
defined (LIBOHIBOARD_STM32L073VxT) || \
defined (LIBOHIBOARD_STM32L073VxI)
UART_PINS_PC1,
UART_PINS_PC4,
UART_PINS_PC10,
#endif
#if defined (LIBOHIBOARD_STM32L073VxT) || \
defined (LIBOHIBOARD_STM32L073VxI)
UART_PINS_PD8,
#endif
},
.txPinsGpio =
{
GPIO_PINS_PA2,
GPIO_PINS_PA14,
GPIO_PINS_PB10,
GPIO_PINS_PB11,
#if defined (LIBOHIBOARD_STM32L073RxT) || \
defined (LIBOHIBOARD_STM32L073RxI) || \
defined (LIBOHIBOARD_STM32L073VxT) || \
defined (LIBOHIBOARD_STM32L073VxI)
GPIO_PINS_PC1,
GPIO_PINS_PC4,
GPIO_PINS_PC10,
#endif
#if defined (LIBOHIBOARD_STM32L073VxT) || \
defined (LIBOHIBOARD_STM32L073VxI)
GPIO_PINS_PD8,
#endif
},
.txPinsMux =
{
GPIO_ALTERNATE_6,
GPIO_ALTERNATE_6,
GPIO_ALTERNATE_4,
GPIO_ALTERNATE_7,
#if defined (LIBOHIBOARD_STM32L073RxT) || \
defined (LIBOHIBOARD_STM32L073RxI) || \
defined (LIBOHIBOARD_STM32L073VxT) || \
defined (LIBOHIBOARD_STM32L073VxI)
GPIO_ALTERNATE_6,
GPIO_ALTERNATE_2,
GPIO_ALTERNATE_0,
#endif
#if defined (LIBOHIBOARD_STM32L073VxT) || \
defined (LIBOHIBOARD_STM32L073VxI)
GPIO_ALTERNATE_0,
#endif
},
.isrNumber = INTERRUPT_LPUART1,
.state = UART_DEVICESTATE_RESET,
};
Uart_DeviceHandle OB_LPUART1 = &lpuart1;
static inline __attribute__((always_inline)) void Uart_computeRxMask (Uart_DeviceHandle dev)
{
switch (dev->config.dataBits)
{
case UART_DATABITS_SEVEN:
if (dev->config.parity == UART_PARITY_NONE)
dev->mask = 0x007Fu;
else
dev->mask = 0x003Fu;
break;
case UART_DATABITS_EIGHT:
if (dev->config.parity == UART_PARITY_NONE)
dev->mask = 0x00FFu;
else
dev->mask = 0x007Fu;
break;
case UART_DATABITS_NINE:
if (dev->config.parity == UART_PARITY_NONE)
dev->mask = 0x01FFu;
else
dev->mask = 0x00FFu;
break;
}
}
static System_Errors Uart_config (Uart_DeviceHandle dev, Uart_Config * config)
{
System_Errors err = ERRORS_NO_ERROR;
// Check all parameters with asserts
// The OR is to detect an error: it is not important where is, the important is that there is!
err = ohiassert(UART_VALID_DATABITS(config->dataBits));
err |= ohiassert(UART_VALID_BAUDRATE(config->baudrate));
err |= ohiassert(UART_VALID_OVERSAMPLING(config->oversampling));
if (UART_IS_LOWPOWER_DEVICE(dev))
{
err |= ohiassert(UART_VALID_STOPBITS_LP(config->stop));
}
else
{
err |= ohiassert(UART_VALID_STOPBITS(config->stop));
}
err |= ohiassert(UART_VALID_PARITY(config->parity));
err |= ohiassert(UART_VALID_FLOWCONTROL(config->flowControl));
err |= ohiassert(UART_VALID_MODE(config->mode));
if (err != ERRORS_NO_ERROR)
return ERRORS_UART_WRONG_PARAM;
// Save configurations
dev->config = *config;
// Disable the peripheral
UART_DEVICE_DISABLE(dev->regmap);
// Config peripheral
// Configure data bits with the M bits
dev->regmap->CR1 = dev->regmap->CR1 & (~(USART_CR1_M));
switch (dev->config.dataBits)
{
case UART_DATABITS_SEVEN:
dev->regmap->CR1 |= USART_CR1_M1;
break;
case UART_DATABITS_EIGHT:
dev->regmap->CR1 |= 0x00U;
break;
case UART_DATABITS_NINE:
dev->regmap->CR1 |= USART_CR1_M0;
break;
}
// Configure parity type with PCE and PS bit
dev->regmap->CR1 = dev->regmap->CR1 & (~(USART_CR1_PCE | USART_CR1_PS));
switch (dev->config.parity)
{
case UART_PARITY_NONE:
dev->regmap->CR1 |= 0x00U;
break;
case UART_PARITY_ODD:
dev->regmap->CR1 |= USART_CR1_PCE | USART_CR1_PS;
break;
case UART_PARITY_EVEN:
dev->regmap->CR1 |= USART_CR1_PCE;
break;
}
// Configure peripheral mode with TE and RE bits into CR1
dev->regmap->CR1 = dev->regmap->CR1 & (~(USART_CR1_TE | USART_CR1_RE));
switch (dev->config.mode)
{
case UART_MODE_TRANSMIT:
dev->regmap->CR1 |= USART_CR1_TE;
break;
case UART_MODE_RECEIVE:
dev->regmap->CR1 |= USART_CR1_RE;
break;
case UART_MODE_BOTH:
dev->regmap->CR1 |= USART_CR1_TE | USART_CR1_RE;
break;
}
// Set oversampling: if value differ from 8, use default value.
dev->regmap->CR1 = dev->regmap->CR1 & (~(USART_CR1_OVER8));
if (dev->config.oversampling == 8)
{
dev->regmap->CR1 |= USART_CR1_OVER8;
}
// Configure stop bits with STOP[13:12] bits into CR2
dev->regmap->CR2 = dev->regmap->CR2 & (~(USART_CR2_STOP));
switch (dev->config.stop)
{
case UART_STOPBITS_HALF:
dev->regmap->CR2 |= (USART_CR2_STOP & (0x01ul << USART_CR2_STOP_Pos));
break;
case UART_STOPBITS_ONE:
dev->regmap->CR2 |= (USART_CR2_STOP & (0x00ul << USART_CR2_STOP_Pos));
break;
case UART_STOPBITS_ONE_AND_HALF:
dev->regmap->CR2 |= (USART_CR2_STOP & (0x03ul << USART_CR2_STOP_Pos));
break;
case UART_STOPBITS_TWO:
dev->regmap->CR2 |= (USART_CR2_STOP & (0x02ul << USART_CR2_STOP_Pos));
break;
}
// Configure hardware flow control with CTS and RTS bits into CR3
dev->regmap->CR3 = dev->regmap->CR3 & (~(USART_CR3_CTSE | USART_CR3_RTSE));
switch (dev->config.flowControl)
{
case UART_FLOWCONTROL_NONE:
dev->regmap->CR3 |= 0x0U;
break;
case UART_FLOWCONTROL_CTS:
dev->regmap->CR3 |= USART_CR3_CTSE;
break;
case UART_FLOWCONTROL_RTS:
dev->regmap->CR3 |= USART_CR3_RTSE;
break;
case UART_FLOWCONTROL_CTS_RTS:
dev->regmap->CR3 |= USART_CR3_CTSE | USART_CR3_RTSE;
break;
}
// Compute RX mask
Uart_computeRxMask(dev);
// TODO: ONEBIT One sample bit method enable
// Configure Baudrate
err = Uart_setBaudrate(dev,dev->config.baudrate);
if (err != ERRORS_NO_ERROR)
return ERRORS_UART_WRONG_PARAM;
// In asynchronous mode, the following bits must be kept cleared:
// LINEN and CLKEN bits into CR2
// SCEN, HDSEL and IREN bits into CR3
// TODO: in other configuration, these bit must be change!
UTILITY_CLEAR_REGISTER_BIT(dev->regmap->CR2, (USART_CR2_LINEN | USART_CR2_CLKEN));
UTILITY_CLEAR_REGISTER_BIT(dev->regmap->CR3, (USART_CR3_SCEN | USART_CR3_HDSEL | USART_CR3_IREN));
// Enable the peripheral
UART_DEVICE_ENABLE(dev->regmap);
return ERRORS_NO_ERROR;
}
System_Errors Uart_setBaudrate (Uart_DeviceHandle dev, uint32_t baudrate)
{
uint32_t frequency = 0;
// TODO: This clock check into a define divided for microcontroller type?
if (UART_IS_DUAL_CLOCK_DOMAIN(dev))
{
// Get current parent clock
switch (dev->config.clockSource)
{
case UART_CLOCKSOURCE_HSI:
frequency = (uint32_t)CLOCK_FREQ_HSI;
break;
case UART_CLOCKSOURCE_LSE:
frequency = (uint32_t)CLOCK_FREQ_LSE;
break;
case UART_CLOCKSOURCE_SYSCLK:
frequency = Clock_getOutputValue(CLOCK_OUTPUT_SYSCLK);
break;
case UART_CLOCKSOURCE_PCLK:
if (dev == OB_UART1)
frequency = Clock_getOutputValue(CLOCK_OUTPUT_PCLK2);
else
frequency = Clock_getOutputValue(CLOCK_OUTPUT_PCLK1);
break;
default:
ohiassert(0);
return ERRORS_UART_NO_CLOCKSOURCE;
}
}
else
{
frequency = Clock_getOutputValue(CLOCK_OUTPUT_PCLK1);
}
// Current clock is different from 0
if (frequency != 0u)
{
if (UART_IS_LOWPOWER_DEVICE(dev))
{
// Check the range of current clock
// The range is [3 * baudrate, 4096 * baudrate]
if (((frequency < ( 3u * baudrate))) && (frequency > ( 4096u * baudrate)))
{
return ERRORS_UART_WRONG_BAUDRATE;
}
else
{
uint32_t uartdiv = (uint32_t)(((uint64_t)frequency * 256u) / baudrate);
if ((uartdiv >= UART_LP_BRR_MIN) && (uartdiv <= UART_LP_BRR_MAX))
{
dev->regmap->BRR = uartdiv;
}
else
{
return ERRORS_UART_WRONG_BAUDRATE;
}
}
}
else if (dev->config.oversampling == 8)
{
uint32_t uartdiv = (frequency * 2u) / baudrate;
if ((uartdiv >= UART_BRR_MIN) && (uartdiv <= UART_BRR_MAX))
{
// Fix BRR value
// see page 771 of RM0367 (Rev6)
uint32_t brr = uartdiv & 0xFFF0u;
brr |= (uint16_t)((uartdiv & (uint16_t)0x000Fu) >> 1u);
brr &= 0xFFF7; // Clear BRR3
dev->regmap->BRR = brr;
}
else
{
return ERRORS_UART_WRONG_BAUDRATE;
}
}
else
{
uint32_t uartdiv = frequency / baudrate;
if ((uartdiv >= UART_BRR_MIN) && (uartdiv <= UART_BRR_MAX))
{
dev->regmap->BRR = uartdiv;
}
else
{
return ERRORS_UART_WRONG_BAUDRATE;
}
}
}
else
{
return ERRORS_UART_CLOCKSOURCE_FREQUENCY_TOO_LOW;
}
return ERRORS_NO_ERROR;
}
System_Errors Uart_open (Uart_DeviceHandle dev, Uart_Config *config)
{
return ohiassert(0);
}
System_Errors Uart_init (Uart_DeviceHandle dev, Uart_Config *config)
{
System_Errors err = ERRORS_NO_ERROR;
// Check the UART device
if (dev == NULL)
{
return ERRORS_UART_NO_DEVICE;
}
// Check the UART instance
err = ohiassert((UART_IS_DEVICE(dev)) || (UART_IS_LOWPOWER_DEVICE(dev)));
if (err != ERRORS_NO_ERROR)
{
return ERRORS_UART_WRONG_DEVICE;
}
// Check clock source selections
err = ohiassert(UART_IS_VALID_CLOCK_SOURCE(config->clockSource));
if (err != ERRORS_NO_ERROR)
{
return ERRORS_UART_WRONG_PARAM;
}
// Enable peripheral clock if needed
if (dev->state == UART_DEVICESTATE_RESET)
{
// Select clock source (Only for some peripheral)
if (UART_IS_DUAL_CLOCK_DOMAIN(dev))
UTILITY_MODIFY_REGISTER(*dev->rccTypeRegisterPtr,dev->rccTypeRegisterMask,(config->clockSource << dev->rccTypeRegisterPos));
// Enable peripheral clock
UART_CLOCK_ENABLE(*dev->rccRegisterPtr,dev->rccRegisterEnable);
// Enable pins
if (config->rxPin != UART_PINS_RXNONE)
Uart_setRxPin(dev, config->rxPin);
if (config->txPin != UART_PINS_TXNONE)
Uart_setTxPin(dev, config->txPin);
}
dev->state = UART_DEVICESTATE_BUSY;
// Configure the peripheral
err = Uart_config(dev,config);
if (err != ERRORS_NO_ERROR)
{
return err;
}
// Configure interrupt
if (config->callbackRx)
{
dev->callbackRx = config->callbackRx;
// Enable NVIC interrupt
Interrupt_enable(dev->isrNumber);
// Enable the UART Error Interrupt
UTILITY_SET_REGISTER_BIT(dev->regmap->CR3, USART_CR3_EIE);
//FIXME: Enable UART Parity Error interrupt and Data Register Not Empty interrupt
UTILITY_SET_REGISTER_BIT(dev->regmap->CR1, USART_CR1_PEIE | USART_CR1_RXNEIE);
}
if (config->callbackTx)
{
dev->callbackTx = config->callbackTx;
// Enable NVIC interrupt
Interrupt_enable(dev->isrNumber);
UTILITY_SET_REGISTER_BIT(dev->regmap->CR1,USART_CR1_TXEIE);
}
dev->state = UART_DEVICESTATE_READY;
return ERRORS_NO_ERROR;
}
System_Errors Uart_close (Uart_DeviceHandle dev)
{
return ohiassert(0);
}
System_Errors Uart_deInit (Uart_DeviceHandle dev)
{
System_Errors err = ERRORS_NO_ERROR;
// Check the UART device
if (dev == NULL)
{
return ERRORS_UART_NO_DEVICE;
}
// Check the UART instance
err = ohiassert((UART_IS_DEVICE(dev)) || (UART_IS_LOWPOWER_DEVICE(dev)));
if (err != ERRORS_NO_ERROR)
{
return ERRORS_UART_WRONG_DEVICE;
}
// The device is busy...
dev->state = UART_DEVICESTATE_BUSY;
// Disable the peripheral
UART_DEVICE_DISABLE(dev->regmap);
// Clear all registers
dev->regmap->CR1 = 0x0u;
dev->regmap->CR2 = 0x0u;
dev->regmap->CR3 = 0x0u;
// Delete interrrupt callback
dev->callbackRx = NULL;
dev->callbackTx = NULL;
// Disable peripheral clock
UART_CLOCK_DISABLE(*dev->rccRegisterPtr,dev->rccRegisterEnable);
// Set reset state
dev->state = UART_DEVICESTATE_RESET;
return err;
}
System_Errors Uart_setRxPin (Uart_DeviceHandle dev, Uart_RxPins rxPin)
{
uint8_t devPinIndex;
for (devPinIndex = 0; devPinIndex < UART_MAX_PINS; ++devPinIndex)
{
if (dev->rxPins[devPinIndex] == rxPin)
{
Gpio_configAlternate(dev->rxPinsGpio[devPinIndex],
dev->rxPinsMux[devPinIndex],
0);
return ERRORS_NO_ERROR;
}
}
return ERRORS_UART_NO_PIN_FOUND;
}
System_Errors Uart_setTxPin (Uart_DeviceHandle dev, Uart_TxPins txPin)
{
uint8_t devPinIndex;
for (devPinIndex = 0; devPinIndex < UART_MAX_PINS; ++devPinIndex)
{
if (dev->txPins[devPinIndex] == txPin)
{
Gpio_configAlternate(dev->txPinsGpio[devPinIndex],
dev->txPinsMux[devPinIndex],
0);
return ERRORS_NO_ERROR;
}
}
return ERRORS_UART_NO_PIN_FOUND;
}
System_Errors Uart_getChar (Uart_DeviceHandle dev, char *out)
{
// deprecated
return ohiassert(0);
}
void Uart_putChar (Uart_DeviceHandle dev, char c)
{
// deprecated
ohiassert(0);
}
uint8_t Uart_isCharPresent (Uart_DeviceHandle dev)
{
// deprecated
ohiassert(0);
return 0;
}
uint8_t Uart_isTransmissionComplete (Uart_DeviceHandle dev)
{
// deprecated
ohiassert(0);
return 0;
}
System_Errors Uart_read (Uart_DeviceHandle dev, uint8_t* data, uint32_t timeout)
{
uint16_t* temp;
uint32_t timeoutEnd = System_currentTick() + timeout;
if (dev->state == UART_DEVICESTATE_READY)
{
dev->state = UART_DEVICESTATE_BUSY;
while (UTILITY_READ_REGISTER_BIT(dev->regmap->ISR,USART_ISR_RXNE) == 0)
{
if (System_currentTick() > timeoutEnd)
{
return ERRORS_UART_TIMEOUT_RX;
}
}
// In case of 9B and parity NONE, the message is split into two byte and aligned!
if ((dev->config.dataBits == UART_DATABITS_NINE) &&
(dev->config.parity == UART_PARITY_NONE))
{
// Cast the pointer
temp = (uint16_t *) data;
*temp = (uint16_t) (dev->regmap->RDR & dev->mask);
}
else
{
*data = (uint8_t)(dev->regmap->RDR & (uint8_t)dev->mask);
}
}
else
{
return ERRORS_UART_DEVICE_BUSY;
}
dev->state = UART_DEVICESTATE_READY;
return ERRORS_NO_ERROR;
}
System_Errors Uart_write (Uart_DeviceHandle dev, const uint8_t* data, uint32_t timeout)
{
uint16_t* temp = 0;
uint32_t timeoutEnd = System_currentTick() + timeout;
if (dev->state == UART_DEVICESTATE_READY)
{
// Wait until the buffer is empty
while (UTILITY_READ_REGISTER_BIT(dev->regmap->ISR,USART_ISR_TXE) == 0)
{
if (System_currentTick() > timeoutEnd)
{
return ERRORS_UART_TIMEOUT_TX;
}
}
// In case of 9B and parity NONE, the message is split into two byte
if ((dev->config.dataBits == UART_DATABITS_NINE) &&
(dev->config.parity == UART_PARITY_NONE))
{
// Cast the pointer
temp = (uint16_t *) data;
dev->regmap->TDR = (*temp & 0x01FFu);
}
else
{
dev->regmap->TDR = (*data & 0x00FFu);
}
// Start-up new timeout
timeoutEnd = System_currentTick() + timeout;
// Wait until the transmission is complete
while (UTILITY_READ_REGISTER_BIT(dev->regmap->ISR,USART_ISR_TC) == 0)
{
if (System_currentTick() > timeoutEnd)
{
return ERRORS_UART_TIMEOUT_TX;
}
}
}
else
{
return ERRORS_UART_DEVICE_BUSY;
}
dev->state = UART_DEVICESTATE_READY;
return ERRORS_NO_ERROR;
}
bool Uart_isPresent (Uart_DeviceHandle dev)
{
return (UTILITY_READ_REGISTER_BIT(dev->regmap->ISR,USART_ISR_RXNE) == 0) ? FALSE : TRUE;
}
static inline void __attribute__((always_inline)) Uart_callbackInterrupt (Uart_DeviceHandle dev)
{
uint32_t isrreg = dev->regmap->ISR;
uint32_t cr1reg = dev->regmap->CR1;
// Check errors:
// - Parity Error
// - Framing Error
// - START bit Noise detection
// - Overrun Error
uint32_t errorFlag = isrreg & (USART_ISR_PE | USART_ISR_FE | USART_ISR_ORE | USART_ISR_NE);
// No Errors...
if (errorFlag == 0)
{
// Check if the interrupt is in reception
if (((isrreg & USART_ISR_RXNE) != 0) && ((cr1reg & USART_CR1_RXNEIE) > 0))
{
if (dev->callbackRx != NULL)
dev->callbackRx(dev);
return;
}
}
else
{
// TODO: managing errors
}
// Check if the interrupt is in transmission
if (((isrreg & USART_ISR_TXE) != 0) && ((cr1reg & USART_CR1_TXEIE) > 0))
{
if (dev->callbackTx != NULL)
dev->callbackTx(dev);
}
}
_weak void LPUART1_IRQHandler(void)
{
Uart_callbackInterrupt(OB_LPUART1);
}
_weak void USART1_IRQHandler(void)
{
Uart_callbackInterrupt(OB_UART1);
}
_weak void USART2_IRQHandler(void)
{
Uart_callbackInterrupt(OB_UART2);
}
_weak void USART4_5_IRQHandler(void)
{
Uart_callbackInterrupt(OB_UART4);
Uart_callbackInterrupt(OB_UART5);
}
#endif // LIBOHIBOARD_STM32L0
#ifdef __cplusplus
}
#endif
#endif // LIBOHIBOARD_UART
|
the_stack_data/11524.c | /* Check that floating point casts of integer operations don't ICE. */
/* The first of these routines caused problems for a patch, that wasn't
otherwise caught by a full bootstrap, the regression test suite or
SPEC CPU2000. */
double
andop (unsigned int x)
{
return x & 1;
}
double
orop (unsigned int x)
{
return x | 1;
}
double
notop (unsigned int x)
{
return ~x;
}
|
the_stack_data/36262.c | #include <stdio.h>
struct time {
int hora;
int min;
int seg;
};
void seg_tempo(int qtd_seg) {
struct time tempo;
int aux;
aux = qtd_seg;
tempo.seg = aux % 60;
aux /= 60;
tempo.min = aux % 60;
tempo.hora = aux / 60;
printf("%d segundos equivalem a %d:%.2:%.2d horas\n", qtd_seg, tempo.hora, tempo.min, tempo.seg);
}
int tempo_seg() {
int qtd=0;
struct time tempo;
printf("Informe a hora (hh:mm:ss): ");
scanf("%d:%d:%d", &tempo.hora, &tempo.min, &tempo.seg);
qtd = ((tempo.hora * 60) + tempo.min) * 60 + tempo.seg;
return qtd;
}
int main() {
struct time tempo;
int num_seg;
printf("Informe a quantidade de segundos: ");
scanf("%d", &num_seg);
seg_tempo(num_seg);
printf("Quantidade de segundos: %d\n", tempo_seg());
return 0;
}
|
the_stack_data/119095.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 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] == 322156791U) {
printf("You win!\n");
} else {
}
randomFuns_main_i7 = 0;
while (randomFuns_main_i7 < 1) {
printf("%u\n", output[randomFuns_main_i7]);
randomFuns_main_i7 ++;
}
}
}
void RandomFunc(unsigned int input[1] , unsigned int output[1] )
{
unsigned int state[1] ;
unsigned short copy11 ;
{
state[0UL] = (input[0UL] | 51238316UL) >> 3U;
if ((state[0UL] >> 3U) & 1U) {
if ((state[0UL] >> 4U) & 1U) {
if (state[0UL] & 1U) {
state[0UL] >>= (state[0UL] & 7U) | 1UL;
} else {
state[0UL] <<= (state[0UL] & 7U) | 1UL;
}
} else
if ((state[0UL] >> 4U) & 1U) {
copy11 = *((unsigned short *)(& state[0UL]) + 1);
*((unsigned short *)(& state[0UL]) + 1) = *((unsigned short *)(& state[0UL]) + 0);
*((unsigned short *)(& state[0UL]) + 0) = copy11;
} else {
state[0UL] >>= ((state[0UL] >> 1U) & 7U) | 1UL;
}
}
output[0UL] = state[0UL] ^ 324142656UL;
}
}
|
the_stack_data/107251.c | #include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <fcntl.h>
#define IN
#define OUT
typedef unsigned char BYTE;
typedef long LONG;
typedef unsigned long ULONG;
void print(LONG l);
//
// len <= 32
//
ULONG GetBits(BYTE *inArray, int start, int len)
{
ULONG ul = 0UL;
const char SZ = 8;
const char SEVEN = 7;
int startBit = start % SZ;
int startByte = start / SZ;
BYTE *pb = &inArray[startByte];
int i;
int pos;
pos = startBit;
for(i = 0; i < len; i++) {
ul <<= 1;
ul |= (*pb >> (SEVEN - pos++)) & 1;
if (pos >= SZ) {
pos = 0;
pb++;
}
}
return ul;
}
//
// len <= 32
//
LONG SignedGetBits(IN BYTE *inArray, IN int start, IN int len)
{
LONG l = 0L;
const char SZ = 8;
const char SEVEN = 7;
int startBit = start % SZ;
int startByte = start / SZ;
BYTE *pb = &inArray[startByte];
int i;
int pos;
pos = startBit;
for(i = 0; i < len; i++) {
l <<= 1;
l |= (*pb >> (SEVEN - pos++)) & 1;
if (pos >= SZ) {
pos = 0;
pb++;
}
}
if (l & (1 << (len - 1))) { /* MSB? */
for(i = len; i < sizeof(long) * 4; i++) {
//printf("%d(%ld): 0x%08lX\n", i, sizeof(long) * 4, l);
l |= (1 << i);
//printf("%d(%ld): 0x%08lX\n", i, sizeof(long) * 4, l);
}
}
return l;
}
static int count = 0;
void print(LONG l)
{
printf("%d: %08lX=%ld\n", count++, l, l);
}
int main(int ac, char **av)
{
BYTE testArray[11] = {
/* 0 1 2 3 4 5 6 7 8 9 10 */
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A
};
LONG result;
int i;
int start = 3;
int length = 6;
for(i = 0; i < 10; i++) {
result = GetBits(testArray, start, length);
printf("%d: start=%d length=%d ", i, start, length); print(result);
start += 7;
length += 1;
}
return 0;
}
|
the_stack_data/120517.c | int* gradingStudents(int grades_count, int* grades, int* result_count) {
int i,temp,mul_fiv;
static int arr[60];
*result_count = grades_count;
for(i = 0; i< grades_count ;i++)
{
if(grades[i] >= 38)
{
temp = grades[i];
while( temp % 5 != 0)
temp++;
mul_fiv = temp;
if(mul_fiv - grades[i] < 3)
grades[i] = mul_fiv;
}
arr[i] = grades[i];
}
return arr;
}
|
the_stack_data/360745.c | #include <signal.h>
#include <stdio.h>
#include <stdlib.h>
/* Based on the libc manual*/
/* This flag controls termination of the main loop. */
volatile sig_atomic_t keep_going = 1;
/* The signal handler just clears the flag and re-enables itself. */
void catch_alarm (int sig)
{
keep_going = 0;
signal (sig, catch_alarm);
}
void do_nothing (void)
{
int i=0;
for (i=0;i<1000;i+=1);
}
int main (void)
{
/* Establish a handler for SIGALRM signals. */
signal (SIGALRM, catch_alarm);
/* Set an alarm to go off in a little while. */
alarm (1);
/* Check the flag once in a while to see when to quit. */
while (keep_going)
do_nothing();
printf("Hello World!\n");
return EXIT_SUCCESS;
}
|
the_stack_data/153267126.c | #include<stdio.h>
double function( double x){
return x*x;
}
int main(){
double lowerlimit,upperlimit,stepsize,integral,upper,lower,partitions;
double s1,s2,s3,s4;
printf("Partitions : ");
scanf("%lf",&partitions);
printf("Lower limit : ");
scanf("%lf",&lowerlimit);
printf("Upper limit : ");
scanf("%lf",&upperlimit);
stepsize = (upperlimit-lowerlimit)/(int)partitions;
upper=lowerlimit;
lower=lowerlimit;
integral=0;
for(int i=0;i<partitions;i++){
upper+=stepsize;
s1 = function(lower);
s2 = 3*function((2*lower+upper)/3);
s3 = 3*function((lower+2*upper)/3);
s4 = function(upper);
integral += stepsize*(s1+s2+s3+s4)/8;
lower+=stepsize;
}
printf("Value : %.10f\n",integral);
}
|
the_stack_data/82951450.c | //SERVER
/*Componenti gruppo di lavoro:
- Vantaggiato Giulia 130117
- Damiano Dalila 131946
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <pthread.h> //link con -lpthread
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <signal.h>
#ifndef STAMPA_MSG
#define STAMPA_MSG 1
#endif
#define DIM 30
#define BUFF_SIZE 256
#define K 10
#define DELIM " /-"
#define MAXCONNESSIONI 3
typedef struct{
int giorno_i;
int mese_i;
int giorno_f;
int mese_f;
} data;
typedef struct {
int num; //numero ombrellone
int disp; //disponibilità: 0 = occupato, 1 = disponibile, 2 = temporaneamente occupato
data scadenza; //data di scadenza
int fila; //a 1 a 3. 10 ombrelloni per fila
} ombrellone;
ombrellone prenotazioni[DIM]; //array di strutture
int pronto = 1; //se == 1, libera. se == 0 manda NOK
int fd; //variabile file descriptor
int msd; //master socket descriptor
int conteggio = 0; //conta numero connessioni
//definizione dei mutex
pthread_mutex_t M_ombr;
pthread_mutex_t M_file;
pthread_mutex_t M_cont;
pthread_t master; //master thread descriptor globale per poterlo fermare con handler segnali
//PROTOTIPI
void* client_thread (void *csocket_desk); //funzione chiamata da ogni thread_worker
void* master_thread(void);
int send_msg(int socket_descriptor, char* msg);
int receive_msg(int socket_descriptor, char* msg);
void riempiArray (ombrellone *prenotazioni);
void aggiornaFile(ombrellone *prenotazioni);
int estraiNum(char *buffer);
int* estraiDate(char *buffer, int *a);
void sighand(int sig);
//############################# MAIN ###########################################
int main (void) {
struct sockaddr_in serv_addr;
//mutex_init
pthread_mutex_init (&M_ombr, NULL);
pthread_mutex_init (&M_file, NULL);
pthread_mutex_init (&M_cont, NULL);
signal(SIGINT, sighand);
signal(SIGTERM, sighand);
signal(SIGQUIT, sighand);
//creazione del master socket
msd = socket(AF_INET, SOCK_STREAM, 0);
if ( msd == -1 ) {
puts ("Creazione socket FALLITA");
exit(-1);
}
puts ("Socket creato");
//"pulire" la sockaddr_in structure
bzero((char *) &serv_addr, sizeof(struct sockaddr_in));
//preparazione della sockaddr_in structure
serv_addr.sin_family = AF_INET;
serv_addr.sin_addr.s_addr = INADDR_ANY;
serv_addr.sin_port = htons(12687);
//bind, legare la socket con l'indirizzo
if (bind(msd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0){
//stampo messaggio di errore
perror("Bind fallita, ERRORE");
return 1;
}
puts("Bind eseguita");
//Riempimento array di strutture con dati da file
riempiArray(prenotazioni);
//avvio master thread
pthread_create(&master,NULL,(void*)master_thread(),NULL);
pthread_join(master,NULL);
printf("ERROREEEEE\n");
}
//############################# CLIENT ###########################################
void* client_thread (void *csocket_desk){
//prendere il socket descriptor
int sock = *(int *)csocket_desk;
int retval;
char client_message[BUFF_SIZE]; //buffer comunicazione client/server
retval = 1;
while ( (retval = receive_msg(sock, client_message)) > 0) {
//ALTRI CASI
if (strcmp(client_message, "AVAILABLE") == 0) {
//CONTROLLA LA DISPONIBILITÀ DEGLI OMBRELLONI
//printf("Ricevuto AVAILABLE\n");
int conta_disp = 0;
for ( int j = 0; j < DIM; j++){
if ( prenotazioni[j].disp == 1 ){
conta_disp++;
}
}
if ( conta_disp > 0 ){
//manda AVAILABLE e numero ombrelloni disponibili
sprintf(client_message, "AVAILABLE %d", conta_disp);
retval = send_msg(sock, client_message);
}else{ //manda NAVAILABLE
strcpy(client_message, "NAVAILABLE");
retval = send_msg(sock, client_message);
}
}
else if(strcmp (client_message, "AVAILABLE 1") == 0) {
//controlla gli ombrelloni disponibili nella prima fila
//printf("Ricevuto AVAILABLE 1\n");
int conta_disp_fila = 0;
for ( int j = 0; j < DIM; j++){
if (prenotazioni[j].disp == 1 && prenotazioni[j].fila == 1){
conta_disp_fila++;
}
}
//invio disponibilità ombrelloni prima fila
sprintf(client_message, "AVAILABLE %d", conta_disp_fila);
retval = send_msg(sock, client_message);
}
if (strcmp(client_message, "BOOK") == 0){
//può ricevere: BOOK
if (pronto){ //BOOK
//manda OK
//printf("Ricevuto BOOK\n");
strcpy(client_message, "OK");
//Manda il messaggio indietro al cliente
retval = send_msg(sock, client_message);
//riceve OGGI/DOMANI
retval = receive_msg(sock, client_message);
if ( strcmp (client_message, "OGGI") == 0){ //riceve OGGI
//mando PROSEGUI
strcpy(client_message, "PROSEGUI");
retval = send_msg(sock, client_message);
//ricevo BOOK OMBRELLONE
retval = receive_msg(sock, client_message);
//printf("retval = %d\n",retval);
int m = estraiNum(client_message);
//se l'ombrellone è disponibile
if ( m > 0 && m <= DIM && prenotazioni[m-1].disp == 1 ){
pthread_mutex_lock(&M_ombr);
prenotazioni[m-1].disp = 2; //2 = temporanemanete prenotato
pthread_mutex_unlock(&M_ombr);
//aggiorna file
pthread_mutex_lock(&M_file);
aggiornaFile(prenotazioni);
pthread_mutex_unlock(&M_file);
//manda AVAILABLE al cliente
strcpy(client_message, "AVAILABLE");
retval = send_msg(sock, client_message);
//riceve CANCEL/BOOK OMBRELLONE DATE
retval = receive_msg(sock, client_message);
int cancel;
cancel = strcmp (client_message, "CANCEL");
if(cancel == 0){
//tolgo il temporaneamente prenotato
pthread_mutex_lock(&M_ombr);
prenotazioni[m-1].disp = 1;
pthread_mutex_unlock(&M_ombr);
pthread_mutex_lock(&M_file);
aggiornaFile(prenotazioni);
pthread_mutex_unlock(&M_file);
}
else{ //se è BOOK OMBRELLONE DATE
int omb;
int giorno;
int mese;
int a[K];
//estrae i valori
estraiDate(client_message, a);
omb = a[1];
giorno = a[2];
mese = a[3];
//modifico la disponibilità
pthread_mutex_lock(&M_ombr);
prenotazioni[omb-1].disp = 0;
prenotazioni[omb-1].scadenza.giorno_i = giorno;
prenotazioni[omb-1].scadenza.mese_i = mese;
prenotazioni[omb-1].scadenza.giorno_f = giorno;
prenotazioni[omb-1].scadenza.mese_f = mese;
pthread_mutex_unlock(&M_ombr);
//AGGIORNA FILE
pthread_mutex_lock(&M_file);
aggiornaFile(prenotazioni);
pthread_mutex_unlock(&M_file);
//MANDA PRENOTAZIONE EFFETTUATA
strcpy(client_message, "PRENOTAZIONE EFFETTUATA");
retval = send_msg (sock, client_message);
}
}
else{ //se l'ombrellone non è disponibile
//manda messaggio NAVAILABLE
strcpy(client_message, "NAVAILABLE");
retval = send_msg (sock, client_message);
puts("Fine comunicazione: ombrellone non disponibile");
}
}
if (strcmp (client_message, "FUTURO") == 0){ //riceve FUTURO
//mando PROSEGUI
strcpy(client_message, "PROSEGUI");
retval = send_msg(sock, client_message);
//riceve BOOK OMBRELLONE (per bloccare l'ombrellone)
retval = receive_msg(sock, client_message);
int omb = estraiNum(client_message);
if ( omb > 0 && omb <= DIM && prenotazioni[omb-1].disp == 1 ){
pthread_mutex_lock(&M_ombr);
prenotazioni[omb-1].disp = 2; //2 = temporanemanete prenotato
pthread_mutex_unlock(&M_ombr);
//aggiorna file
pthread_mutex_lock(&M_file);
aggiornaFile(prenotazioni);
pthread_mutex_unlock(&M_file);
//manda AVAILABLE al cliente
strcpy(client_message, "AVAILABLE");
retval = send_msg(sock, client_message);
}
else {
strcpy(client_message, "NAVAILABLE");
retval = send_msg(sock, client_message);
}
//riceve BOOK OMBRELLONE DATESTART DATEEND
retval = receive_msg(sock, client_message);
//int omb;
int giorno_i, mese_i;
int giorno_f, mese_f;
int a[K];
//estrae i valori
estraiDate(client_message, a);
omb = a[1];
giorno_i = a[2];
mese_i = a[3];
giorno_f = a[4];
mese_f = a[5];
//controllo ombrelloni liberi
//controllo mese
if (omb > 0 && omb <= DIM) { //se numero di ombrellone valido
if (prenotazioni[omb-1].scadenza.mese_f < mese_i){
//prenoto ombrellone
pthread_mutex_lock(&M_ombr);
prenotazioni[omb-1].disp = 0; //occupato
prenotazioni[omb-1].scadenza.giorno_i = giorno_i;
prenotazioni[omb-1].scadenza.mese_i = mese_i;
prenotazioni[omb-1].scadenza.giorno_f = giorno_f;
prenotazioni[omb-1].scadenza.mese_f = mese_f;
pthread_mutex_unlock(&M_ombr);
puts ("Ombrellone prenotato");
//aggiorno il file
pthread_mutex_lock(&M_file);
aggiornaFile(prenotazioni);
pthread_mutex_unlock(&M_file);
//mando conferma al cliente
strcpy(client_message, "AVAILABLE");
retval = send_msg(sock, client_message);
}
else { //controllo mese e giorno
if (prenotazioni[omb-1].scadenza.mese_f == mese_i){
//controllo giorno
if (prenotazioni[omb-1].scadenza.giorno_f < giorno_i ){
//prenoto ombrellone
pthread_mutex_lock(&M_ombr);
prenotazioni[omb-1].disp = 0;
prenotazioni[omb-1].scadenza.giorno_i = giorno_i;
prenotazioni[omb-1].scadenza.mese_i = mese_i;
prenotazioni[omb-1].scadenza.giorno_f = giorno_f;
prenotazioni[omb-1].scadenza.mese_f = mese_f;
pthread_mutex_unlock(&M_ombr);
puts ( "Ombrellone prenotato");
//mando conferma al cliente
strcpy(client_message, "AVAILABLE");
retval = send_msg(sock, client_message);
//aggiorno il file
pthread_mutex_lock(&M_file);
aggiornaFile(prenotazioni);
pthread_mutex_unlock(&M_file);
}
else{
puts("Ombrellone non disponibile");
//comunico l'indisponibilità al cliente
strcpy(client_message, "NAVAILABLE");
retval = send_msg (sock, client_message);
}
}else{
puts("Ombrellone non disponibile");
//comunico l'indisponibilità al cliente
strcpy(client_message, "NAVAILABLE");
retval = send_msg (sock, client_message);
}
}
}
else{ //ombrellone non esistente = non disponibile ;)
puts("Ombrellone non disponibile");
//comunico l'indisponibilità al cliente
strcpy(client_message, "NAVAILABLE");
retval = send_msg (sock, client_message);
}
}
//fine BOOK
}
else{ //se il server è occupato (a salvare su file) manda NOK
strcpy(client_message, "NOK");
send_msg(sock, client_message);
puts("Server occupato");
}
}
else {
int k = estraiNum(client_message); //va messo qui! o la strcmp sotto non funziona!
if (strcmp(client_message, "CANCEL") == 0) {
//printf("Ricevuto CANCEL\n");
if (pronto){ //CANCEL OMBRELLONE
//manda OK
strcpy(client_message, "OK");
//Manda il messaggio indietro al cliente
retval = send_msg(sock, client_message);
//printf("\tCANCEL k = %d\n",k);
if (k > 0 && k <= DIM) {
//aggiorno array struttura cancellando la prenotazione
pthread_mutex_lock(&M_ombr);
prenotazioni[k-1].disp = 1;
prenotazioni[k-1].scadenza.giorno_i = 0;
prenotazioni[k-1].scadenza.mese_i = 0;
prenotazioni[k-1].scadenza.giorno_f = 0;
prenotazioni[k-1].scadenza.mese_f = 0;
pthread_mutex_unlock(&M_ombr);
//aggiorno il file
pthread_mutex_lock(&M_file);
aggiornaFile(prenotazioni);
pthread_mutex_unlock(&M_file);
//riceve ESITO
receive_msg(sock, client_message);
//mando conferma di cancellazione al cliente
strcpy(client_message, "CANCEL OK");
send_msg(sock, client_message);
}else{
//riceve ESITO
receive_msg(sock, client_message);
//mando conferma di cancellazione al cliente
strcpy(client_message, "Ombrellone non esistente!");
send_msg(sock, client_message);
}
}
else{ //se il server è occupato (a salvare su file) NOK
strcpy(client_message, "NOK");
send_msg(sock, client_message);
puts("Server occupato");
}
}
}
}
if (retval == 0){
puts ("Cliente disconnesso");
close(sock);
pthread_mutex_lock(&M_cont);
conteggio --;
if (conteggio < MAXCONNESSIONI) pronto = 1;
pthread_mutex_unlock(&M_cont);
fflush(stdout);
}
else if (retval == -1){
perror("recv fallita.");
}
pthread_exit(NULL);
}//fine funzione
//############################# MASTER THREAD ###########################################
void* master_thread(void) {
int csd; //client socket descriptor
struct sockaddr_in;
pthread_t tid; //thread_id
while (1){
//listen per attendere le connessioni
listen (msd, 5); //5 dim. max coda associata alla socket per deposito rischieste connessione
//accetta ed inizia la connessione
puts("Aspettando richieste di connessione...");
//serve le richieste di connessione...
csd = accept(msd,NULL,0); //se la coda è vuota, sospensione del server
if (csd < 0){
//perror("accept FALLITA");
exit(1);
}
//creazione del canale virtuale avvenuta, risveglio del processo client in attesa sulla connect
puts ("Connessione accettata");
int ret = pthread_create( &tid, NULL, client_thread, (void*)&csd);
if ( ret < 0 ){
perror("Non può creare il thread");
exit(1);
}else{
pthread_mutex_lock(&M_cont);
conteggio ++;
if (conteggio > MAXCONNESSIONI) pronto = 0;
pthread_mutex_unlock(&M_cont);
}
}
pthread_exit(NULL);
}
//############################### FUNZIONI UTILI#################################
//funzione per inviare i messaggi
int send_msg(int socket_descriptor, char* msg){
int retval;
retval = send(socket_descriptor, msg, BUFF_SIZE, 0);
if (retval < 0){
perror("Errore invio messaggio.");
exit(EXIT_FAILURE);
}else{
if (STAMPA_MSG){
printf("(%d) > Messaggio inviato: %s\n", socket_descriptor, msg);
}
}
return retval;
}
//funzione per ricevere i messaggi
int receive_msg(int socket_descriptor, char* msg){
int retval;
bzero(msg, BUFF_SIZE);
retval = recv(socket_descriptor, msg, BUFF_SIZE, 0);
if (retval < 0){
perror("Errore invio messaggio.");
exit(EXIT_FAILURE);
}else{
if (STAMPA_MSG){
printf("(%d) > Messaggio ricevuto: %s\n", socket_descriptor, msg);
}
}
return retval;
}
//funzione per rimepire l'array di strutture
void riempiArray (ombrellone *prenotazioni){
FILE *f;
f = fopen ( "file.txt", "r");
if (f == NULL){
puts ("File could not be opened");
exit(-1);
}else{
int i = 0;
while (!feof(f)) {
fscanf(f,"%d\t%d\t%d/%d\t%d/%d\t%d\n", &prenotazioni[i].num, &prenotazioni[i].disp, &prenotazioni[i].scadenza.giorno_i, &prenotazioni[i].scadenza.mese_i, &prenotazioni[i].scadenza.giorno_f, &prenotazioni[i].scadenza.mese_f, &prenotazioni[i].fila);
i++;
}
}
fclose(f);
}
//funzione per aggiornare il file
void aggiornaFile(ombrellone *prenotazioni){
pthread_mutex_lock(&M_cont);
pronto = 0;
pthread_mutex_unlock(&M_cont);
sleep(3);
FILE *f;
f = fopen ( "file.txt", "w");
if (f == NULL){
puts ("File could not be opened");
exit(-1);
}else{
int i;
printf("Salvataggio file...\n");
for (i = 0; i < DIM; i++){
if (prenotazioni[i].disp == 2) //se una prenotazione è temporanea, non salvarla
fprintf(f, "%d\t1\t0/0\t0/0\t%d\n", prenotazioni[i].num, prenotazioni[i].fila);
else
fprintf(f, "%d\t%d\t%d/%d\t%d/%d\t%d\n", prenotazioni[i].num, prenotazioni[i].disp, prenotazioni[i].scadenza.giorno_i, prenotazioni[i].scadenza.mese_i, prenotazioni[i].scadenza.giorno_f, prenotazioni[i].scadenza.mese_f, prenotazioni[i].fila);
}
fclose(f);
}
pthread_mutex_lock(&M_cont);
pronto = 1;
pthread_mutex_unlock(&M_cont);
}
//funzione per estrarre numero ombrellone
int estraiNum(char *buffer){
char *token;
int i;
for (token = strtok(buffer, DELIM); token!= NULL; token = strtok(NULL, DELIM)){
i = atoi (token);
}
return i;
}
//funzione per estrarre le date
int* estraiDate(char *buffer, int *a){
char *token;
int j = 0;
for (token = strtok(buffer, DELIM); token!= NULL; token = strtok(NULL, DELIM)){
a[j] = atoi (token);
j++;
}
return a;
}
//funzione per la gestione dei segnali
void sighand (int sig){
if (sig == SIGINT ) printf("\nRicevuto signale SIGINT\n");
if (sig == SIGTERM) printf("\nRicevuto signale SIGTERM\n");
if (sig == SIGQUIT) printf("\nRicevuto signale SIGQUIT\n");
pthread_mutex_lock(&M_cont);
pronto = 0;
pthread_mutex_unlock(&M_cont);
printf("Chiusura del msd\n");
pthread_cancel(master);
close(msd); //impedisco la creazione di nuovi thread worker (il server si sta chiudendo, bisogna evitare di avere ulteriori richieste e sbrigare quelle già arrivate)
sleep(2); //la uso per simulare una prova di richiesta di un client che dovrà essere rifiutata
pthread_mutex_lock(&M_file);
aggiornaFile(prenotazioni);
pronto = 0;//perchè aggiornaFile rimette pronto=1 e "dato che la sfiga ci vede benissimo"...
//si potrebbe avere un client che finisce la prenotazione dopo che hai aggiornato il file ma
//prima che il server termini, ed andrebbe persa.
pthread_mutex_unlock(&M_file);
}
|
the_stack_data/1179180.c | /* usbreset -- send a USB port reset to a USB device */
// http://askubuntu.com/questions/645/how-do-you-reset-a-usb-device-from-the-command-line
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/ioctl.h>
#include <linux/usbdevice_fs.h>
int main(int argc, char **argv)
{
const char *filename;
int fd;
int rc;
if (argc != 2) {
fprintf(stderr, "Usage: usbreset device-filename\n");
return 1;
}
filename = argv[1];
fd = open(filename, O_WRONLY);
if (fd < 0) {
perror("Error opening output file");
return 1;
}
printf("Resetting USB device %s\n", filename);
rc = ioctl(fd, USBDEVFS_RESET, 0);
if (rc < 0) {
perror("Error in ioctl");
return 1;
}
printf("Reset successful\n");
close(fd);
return 0;
}
|
the_stack_data/48576082.c | // REQUIRES: powerpc-registered-target
// Verify ABI selection by the front end
// RUN: %clang_cc1 -triple powerpc64-unknown-linux-gnu -emit-llvm -o - %s \
// RUN: | FileCheck %s --check-prefix=CHECK-ELFv1
// RUN: %clang_cc1 -triple powerpc64-unknown-linux-gnu -emit-llvm -o - %s \
// RUN: -target-abi elfv1 | FileCheck %s --check-prefix=CHECK-ELFv1
// RUN: %clang_cc1 -triple powerpc64-unknown-linux-gnu -emit-llvm -o - %s \
// RUN: -target-abi elfv1-qpx | FileCheck %s --check-prefix=CHECK-ELFv1
// RUN: %clang_cc1 -triple powerpc64-unknown-linux-gnu -emit-llvm -o - %s \
// RUN: -target-abi elfv2 | FileCheck %s --check-prefix=CHECK-ELFv2
// RUN: %clang_cc1 -triple powerpc64le-unknown-linux-gnu -emit-llvm -o - %s \
// RUN: | FileCheck %s --check-prefix=CHECK-ELFv2
// RUN: %clang_cc1 -triple powerpc64le-unknown-linux-gnu -emit-llvm -o - %s \
// RUN: -target-abi elfv1 | FileCheck %s --check-prefix=CHECK-ELFv1
// RUN: %clang_cc1 -triple powerpc64le-unknown-linux-gnu -emit-llvm -o - %s \
// RUN: -target-abi elfv2 | FileCheck %s --check-prefix=CHECK-ELFv2
// CHECK-ELFv1: define void @func_fab(%struct.fab* noalias sret %agg.result, i64 %x.coerce)
// CHECK-ELFv2: define [2 x float] @func_fab([2 x float] %x.coerce)
struct fab { float a; float b; };
struct fab func_fab(struct fab x) { return x; }
|
the_stack_data/90766381.c | #include <stdio.h>
int main()
{
int i, j, rows;
printf("Enter number of rows: ");
scanf("%d", &rows);
for (i = rows; i >= 1; --i)
{
for (j = 1; j <= i; ++j)
{
printf("%d ", j);
}
printf("\n");
}
return 0;
} |
the_stack_data/70449110.c | #ifdef STM32F0xx
#include "stm32f0xx_hal_smartcard.c"
#endif
#ifdef STM32F1xx
#include "stm32f1xx_hal_smartcard.c"
#endif
#ifdef STM32F2xx
#include "stm32f2xx_hal_smartcard.c"
#endif
#ifdef STM32F3xx
#include "stm32f3xx_hal_smartcard.c"
#endif
#ifdef STM32F4xx
#include "stm32f4xx_hal_smartcard.c"
#endif
#ifdef STM32F7xx
#include "stm32f7xx_hal_smartcard.c"
#endif
#ifdef STM32G0xx
#include "stm32g0xx_hal_smartcard.c"
#endif
#ifdef STM32G4xx
#include "stm32g4xx_hal_smartcard.c"
#endif
#ifdef STM32H7xx
#include "stm32h7xx_hal_smartcard.c"
#endif
#ifdef STM32L0xx
#include "stm32l0xx_hal_smartcard.c"
#endif
#ifdef STM32L1xx
#include "stm32l1xx_hal_smartcard.c"
#endif
#ifdef STM32L4xx
#include "stm32l4xx_hal_smartcard.c"
#endif
#ifdef STM32WBxx
#include "stm32wbxx_hal_smartcard.c"
#endif
|
the_stack_data/73573964.c | /* Taxonomy Classification: 0000000000000032000300 */
/*
* WRITE/READ 0 write
* WHICH BOUND 0 upper
* DATA TYPE 0 char
* MEMORY LOCATION 0 stack
* SCOPE 0 same
* CONTAINER 0 no
* POINTER 0 no
* INDEX COMPLEXITY 0 constant
* ADDRESS COMPLEXITY 0 constant
* LENGTH COMPLEXITY 0 N/A
* ADDRESS ALIAS 0 none
* INDEX ALIAS 0 none
* LOCAL CONTROL FLOW 0 none
* SECONDARY CONTROL FLOW 0 none
* LOOP STRUCTURE 3 while
* LOOP COMPLEXITY 2 one
* ASYNCHRONY 0 no
* TAINT 0 no
* RUNTIME ENV. DEPENDENCE 0 no
* MAGNITUDE 3 4096 bytes
* CONTINUOUS/DISCRETE 0 discrete
* SIGNEDNESS 0 no
*/
/*
Copyright 2005 Massachusetts Institute of Technology
All rights reserved.
Redistribution and use of software in source and binary forms, with or without
modification, are permitted provided that the following conditions are met.
- Redistributions of source code must retain the above copyright notice,
this set of conditions and the disclaimer below.
- Redistributions in binary form must reproduce the copyright notice, this
set of conditions, and the disclaimer below in the documentation and/or
other materials provided with the distribution.
- Neither the name of the Massachusetts Institute of Technology nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS".
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
int main(int argc, char *argv[])
{
int init_value;
int loop_counter;
char buf[10];
init_value = 0;
loop_counter = init_value;
while(loop_counter <= 4105)
{
/* BAD */
buf[4105] = 'A';
loop_counter++;
}
return 0;
}
|
the_stack_data/644685.c | #ifdef CS333_P3P4
#include "user.h"
int
main(){
int pid = fork();
if(pid < 0){
printf(1,"Fork Error\n");
exit();
}
if(pid == 0){
printf(1, "child exits\n");
exit();
}
printf(1,"Parent Sleeping for 10 seconds\n");
sleep(10000);
printf(1,"Parent calling wait\n");
wait();
printf(1,"Parent sleeping for 10 seconds\n");
sleep(10000);
printf(1,"Parent exiting\n");
exit();
}
#endif
|
the_stack_data/64379.c | /*
* Copyright 2013 Albert ARIBAUD <[email protected]>
*
* SPDX-License-Identifier: GPL-2.0+
*/
/**
* These two symbols are declared in a C file so that the linker
* uses R_ARM_RELATIVE relocation, rather than the R_ARM_ABS32 one
* it would use if the symbols were defined in the linker file.
* Using only R_ARM_RELATIVE relocation ensures that references to
* the symbols are correct after as well as before relocation.
*
* We need a 0-byte-size type for these symbols, and the compiler
* does not allow defining objects of C type 'void'. Using an empty
* struct is allowed by the compiler, but causes gcc versions 4.4 and
* below to complain about aliasing. Therefore we use the next best
* thing: zero-sized arrays, which are both 0-byte-size and exempt from
* aliasing warnings.
*/
char __bss_start[0] __attribute__((section(".__bss_start")));
char __bss_end[0] __attribute__((section(".__bss_end")));
char __image_copy_start[0] __attribute__((section(".__image_copy_start")));
char __image_copy_end[0] __attribute__((section(".__image_copy_end")));
char __rel_dyn_start[0] __attribute__((section(".__rel_dyn_start")));
char __rel_dyn_end[0] __attribute__((section(".__rel_dyn_end")));
char __secure_start[0] __attribute__((section(".__secure_start")));
char __secure_end[0] __attribute__((section(".__secure_end")));
char __secure_stack_start[0] __attribute__((section(".__secure_stack_start")));
char __secure_stack_end[0] __attribute__((section(".__secure_stack_end")));
char __efi_runtime_start[0] __attribute__((section(".__efi_runtime_start")));
char __efi_runtime_stop[0] __attribute__((section(".__efi_runtime_stop")));
char __efi_runtime_rel_start[0] __attribute__((section(".__efi_runtime_rel_start")));
char __efi_runtime_rel_stop[0] __attribute__((section(".__efi_runtime_rel_stop")));
char _end[0] __attribute__((section(".__end")));
|
the_stack_data/122844.c | #include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <unistd.h>
#define PORT 4950
#define MAXBUFF 512
int main(){
/* Declaramos las variables */
struct sockaddr_in dirServer, dirCliente;
int descSocket, nuevoDescSocket;
socklen_t longitudDirCliente;
char buffer[MAXBUFF];
/* Asignamos valores */
memset(&dirServer, 0, sizeof(dirServer));
dirServer.sin_port = htons(PORT);
dirServer.sin_addr.s_addr = INADDR_ANY;
dirServer.sin_family = AF_INET;
/* Creamos el socket */
if((descSocket = socket(AF_INET, SOCK_STREAM, 0)) < 0){
perror("No se ha podido abrir el socket");
exit(-1);
}
/* Hacemos bind para vincular el puerto */
if(bind(descSocket, (struct sockaddr *) &dirServer,
sizeof(dirServer)) < 0 ){
perror("Error al hacer bind!");
close(descSocket);
exit(-1);
}
/* Ponemos el socket en modo pasivo */
if(listen(descSocket, 10) < 0){
perror("listen");
close(descSocket);
exit(-1);
}
/* ITERAMOS */
while(1){
printf("Esperando conexion...\n");
/* Hacemos accept para obtener el nuevo descriptor que nos
comunique con el cliente */
if((nuevoDescSocket = accept(descSocket, (struct sockaddr *) &dirCliente,
&longitudDirCliente)) < 0){
perror("listen");
close(descSocket);
exit(-1);
}
/* Hemos aceptado ya la nueva conexion. Nos comunicaremos a traves de
nuevoDescSocket */
/* Leemos por primera vez la longitud */
uint32_t longitudBE;
int longitud, leidos;
if((leidos = recv(nuevoDescSocket, &longitudBE, sizeof(longitudBE), 0)) < 0){
perror("Recv");
exit(-1);
}
while(leidos > 0 && strcmp(buffer,"fin") != 0){
/* Pasamos la longitud a formato local */
printf("Longitud recibida: %d\n", leidos);
longitud = ntohl(longitudBE);
if((leidos = recv(nuevoDescSocket, buffer, longitud, 0)) != longitud){
perror("Error al recibir mensaje");
close(nuevoDescSocket);
close(descSocket);
exit(-1);
}
buffer[leidos] = '\0';
printf("Mensaje recibido:\n %s\n", buffer);
/* Procedemos a enviar de vuelta la longitud */
if((send(nuevoDescSocket, &longitudBE, sizeof(longitudBE), 0)) < 0){
perror("Error al enviar la longitud");
close(nuevoDescSocket);
close(descSocket);
exit(-1);
}
/* Y enviamos de vuelta el mensaje */
if((send(nuevoDescSocket, buffer, longitud, 0)) != longitud){
perror("Error al enviar mensaje");
close(nuevoDescSocket);
close(descSocket);
exit(-1);
}
/* Por ultimo volvermos a leer */
if((leidos = recv(nuevoDescSocket, &longitudBE, sizeof(longitudBE), 0)) < 0){
perror("Error al recibir mensaje");
close(nuevoDescSocket);
close(descSocket);
exit(-1);
}
}
close(nuevoDescSocket);
}
close(descSocket);
return 0;
}
|
the_stack_data/57949417.c | /* ECGR 6090 Heterogeneous Computing Homework0
Problem 2- 1D stencil using CPU
Written by Bhavin Thakar - 801151488
*/
// To execute this program type: ./1dstencil R N (R = radius and N = Number of Elements in array)
// (N=1 for 1K ;10 for 10K; 100 for 100K; 1000 for 1M; 10000 for 10M)
// For example: ./1dstencil 2 10
#include<stdio.h>
#include<sys/time.h>
#include<math.h>
#include<stdlib.h>
struct timeval start, stop, start1, stop1;
// Kernel Function
void stencil(int *c, int *d, int r, int n){
int offset, k;
int index=0;
for (k=0;k<n+r;k++){ // Looping through values to find the index and adding the neighbouring elements
for(offset=-r;offset<=r;offset++){
c[k-r]=c[k-r]+d[index+offset+r];
}
}
}
int main(int argc, char *argv[]){
if(argc<2){ // Checking for the valid number of arguments
printf("Please enter the value of N(number of elements)\n");
}
else{
int R = atoi(argv[1]); // Convert the string argument into integer
int N = atoi(argv[2]);
N=N*1024;
int i,j, *a,*b;
// Allocating memory to integer array
a=(int *)malloc(N * sizeof(int));
b=(int *)malloc(N * sizeof(int));
// Storing the random value into input integer array
for(i=0;i<N;i++){
a[i]=rand()%1000;
}
for (j = 0; j<N;j++)
{
b[j] = 0;
}
gettimeofday(&start, NULL);
stencil(b,a,R,N); // Calling the Kernel Function
gettimeofday(&stop, NULL);
printf("Execution time of kernel: %lu us\n", (stop.tv_sec - start.tv_sec) * 1000000 + stop.tv_usec - start.tv_usec);
}
return 0;
} |
the_stack_data/117326763.c | /**~value~
* Observation [Abstract Class]
*
* Description
*
* Observation specifies a value determined by observing an event or events that occur relative to other model Elements.
*
* Diagrams
*
* Time
*
* Generalizations
*
* PackageableElement
*
* Specializations
*
* DurationObservation, TimeObservation
**/ |
the_stack_data/165766254.c | /*
* copyprivate-clause.c
*
* Created on: 09/04/2014
* Author: Carlos de la Torre
*/
#include <stdio.h>
#include <omp.h>
int main() {
int n = 9, i, b[n];
for (i = 0; i < n; i++)
b[i] = -1;
#pragma omp parallel
{
int a;
#pragma omp single copyprivate(a)
{
printf("\nIntroduce valor de inicialización a: ");
scanf("%d", &a );
printf("\nSingle ejecutada por el thread %d\n",omp_get_thread_num());
}
#pragma omp for
for (i = 0; i < n; i++)
b[i] = a;
}
printf("Depués de la región parallel:\n");
for (i = 0; i < n; i++)
printf("b[%d] = %d\t", i, b[i]);
printf("\n");
return 0;
}
|
the_stack_data/899352.c | /* This testcase is to make sure we have i in referenced vars and that we
properly compute aliasing for the loads and stores. */
extern void abort (void);
static int i;
static int *p = &i;
int __attribute__((noinline))
foo(int *q)
{
*p = 1;
*q = 2;
return *p;
}
int __attribute__((noinline))
bar(int *q)
{
*q = 2;
*p = 1;
return *q;
}
int main()
{
int j = 0;
if (foo(&i) != 2)
abort ();
if (bar(&i) != 1)
abort ();
if (foo(&j) != 1)
abort ();
if (j != 2)
abort ();
if (bar(&j) != 2)
abort ();
if (j != 2)
abort ();
return 0;
}
|
the_stack_data/6386924.c | /* program: test-union.c */
typedef unsigned char byte;
typedef union color_union
{
unsigned int value;
byte components[4];
} color;
int main()
{
color red;
red.components[0] = 255; // r
red.components[1] = 0; // g
red.components[2] = 0; // b
red.components[3] = 255; // a
// Warning: Unsafe use, assumes knowledge of underlying layout
// of the integer that will not work on all CPUs.
printf("%x\n", red.value);
return 0;
} |
the_stack_data/4474.c | // PARAM: --sets solver td3 --enable ana.int.def_exc --enable exp.partition-arrays.enabled --set ana.activated "['base','threadid','threadflag','expRelation','mallocWrapper']"
int main(void) {
// Minimal and maximal in def_exc were broken. They are not directly used, but used in the MayBeLess and MayBeEqual queries, that
// are in turn used by the partitioning arrays. This is why we run the arrays in combination with def_exc.
t1();
t2();
}
void t1() {
int arr[10];
int i = 0;
arr[0] = 5;
arr[1] = 5;
arr[2] = 5;
for(i=0; i < 9;i++) { }
int j = arr[i];
assert(j == 5); //UNKNOWN
}
void t2() {
int arr[512];
int i = 0;
{
arr[0] = 5;
arr[1] = 5;
arr[2] = 5;
arr[3] = 5;
arr[4] = 5;
arr[5] = 5;
arr[6] = 5;
arr[7] = 5;
arr[8] = 5;
arr[9] = 5;
arr[10] = 5;
arr[11] = 5;
arr[12] = 5;
arr[13] = 5;
arr[14] = 5;
arr[15] = 5;
arr[16] = 5;
arr[17] = 5;
arr[18] = 5;
arr[19] = 5;
arr[20] = 5;
arr[21] = 5;
arr[22] = 5;
arr[23] = 5;
arr[24] = 5;
arr[25] = 5;
arr[26] = 5;
arr[27] = 5;
arr[28] = 5;
arr[29] = 5;
arr[30] = 5;
arr[31] = 5;
arr[32] = 5;
arr[33] = 5;
arr[34] = 5;
arr[35] = 5;
arr[36] = 5;
arr[37] = 5;
arr[38] = 5;
arr[39] = 5;
arr[40] = 5;
arr[41] = 5;
arr[42] = 5;
arr[43] = 5;
arr[44] = 5;
arr[45] = 5;
arr[46] = 5;
arr[47] = 5;
arr[48] = 5;
arr[49] = 5;
arr[50] = 5;
arr[51] = 5;
arr[52] = 5;
arr[53] = 5;
arr[54] = 5;
arr[55] = 5;
arr[56] = 5;
arr[57] = 5;
arr[58] = 5;
arr[59] = 5;
arr[60] = 5;
arr[61] = 5;
arr[62] = 5;
arr[63] = 5;
arr[64] = 5;
arr[65] = 5;
arr[66] = 5;
arr[67] = 5;
arr[68] = 5;
arr[69] = 5;
arr[70] = 5;
arr[71] = 5;
arr[72] = 5;
arr[73] = 5;
arr[74] = 5;
arr[75] = 5;
arr[76] = 5;
arr[77] = 5;
arr[78] = 5;
arr[79] = 5;
arr[80] = 5;
arr[81] = 5;
arr[82] = 5;
arr[83] = 5;
arr[84] = 5;
arr[85] = 5;
arr[86] = 5;
arr[87] = 5;
arr[88] = 5;
arr[89] = 5;
arr[90] = 5;
arr[91] = 5;
arr[92] = 5;
arr[93] = 5;
arr[94] = 5;
arr[95] = 5;
arr[96] = 5;
arr[97] = 5;
arr[98] = 5;
arr[99] = 5;
arr[100] = 5;
arr[101] = 5;
arr[102] = 5;
arr[103] = 5;
arr[104] = 5;
arr[105] = 5;
arr[106] = 5;
arr[107] = 5;
arr[108] = 5;
arr[109] = 5;
arr[110] = 5;
arr[111] = 5;
arr[112] = 5;
arr[113] = 5;
arr[114] = 5;
arr[115] = 5;
arr[116] = 5;
arr[117] = 5;
arr[118] = 5;
arr[119] = 5;
arr[120] = 5;
arr[121] = 5;
arr[122] = 5;
arr[123] = 5;
arr[124] = 5;
arr[125] = 5;
arr[126] = 5;
arr[127] = 5;
arr[128] = 5;
arr[129] = 5;
arr[130] = 5;
arr[131] = 5;
arr[132] = 5;
arr[133] = 5;
arr[134] = 5;
arr[135] = 5;
arr[136] = 5;
arr[137] = 5;
arr[138] = 5;
arr[139] = 5;
arr[140] = 5;
arr[141] = 5;
arr[142] = 5;
arr[143] = 5;
arr[144] = 5;
arr[145] = 5;
arr[146] = 5;
arr[147] = 5;
arr[148] = 5;
arr[149] = 5;
arr[150] = 5;
arr[151] = 5;
arr[152] = 5;
arr[153] = 5;
arr[154] = 5;
arr[155] = 5;
arr[156] = 5;
arr[157] = 5;
arr[158] = 5;
arr[159] = 5;
arr[160] = 5;
arr[161] = 5;
arr[162] = 5;
arr[163] = 5;
arr[164] = 5;
arr[165] = 5;
arr[166] = 5;
arr[167] = 5;
arr[168] = 5;
arr[169] = 5;
arr[170] = 5;
arr[171] = 5;
arr[172] = 5;
arr[173] = 5;
arr[174] = 5;
arr[175] = 5;
arr[176] = 5;
arr[177] = 5;
arr[178] = 5;
arr[179] = 5;
arr[180] = 5;
arr[181] = 5;
arr[182] = 5;
arr[183] = 5;
arr[184] = 5;
arr[185] = 5;
arr[186] = 5;
arr[187] = 5;
arr[188] = 5;
arr[189] = 5;
arr[190] = 5;
arr[191] = 5;
arr[192] = 5;
arr[193] = 5;
arr[194] = 5;
arr[195] = 5;
arr[196] = 5;
arr[197] = 5;
arr[198] = 5;
arr[199] = 5;
arr[200] = 5;
arr[201] = 5;
arr[202] = 5;
arr[203] = 5;
arr[204] = 5;
arr[205] = 5;
arr[206] = 5;
arr[207] = 5;
arr[208] = 5;
arr[209] = 5;
arr[210] = 5;
arr[211] = 5;
arr[212] = 5;
arr[213] = 5;
arr[214] = 5;
arr[215] = 5;
arr[216] = 5;
arr[217] = 5;
arr[218] = 5;
arr[219] = 5;
arr[220] = 5;
arr[221] = 5;
arr[222] = 5;
arr[223] = 5;
arr[224] = 5;
arr[225] = 5;
arr[226] = 5;
arr[227] = 5;
arr[228] = 5;
arr[229] = 5;
arr[230] = 5;
arr[231] = 5;
arr[232] = 5;
arr[233] = 5;
arr[234] = 5;
arr[235] = 5;
arr[236] = 5;
arr[237] = 5;
arr[238] = 5;
arr[239] = 5;
arr[240] = 5;
arr[241] = 5;
arr[242] = 5;
arr[243] = 5;
arr[244] = 5;
arr[245] = 5;
arr[246] = 5;
arr[247] = 5;
arr[248] = 5;
arr[249] = 5;
arr[250] = 5;
arr[251] = 5;
arr[252] = 5;
arr[253] = 5;
arr[254] = 5;
arr[255] = 5;
}
for(i=0; i < 511; i++) { }
int j = arr[i];
assert(j==5); //UNKNOWN
}
|
the_stack_data/13877.c | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#ifndef M_PI
#define M_PI (3.141592654)
#endif
enum {ARG_NAME, ARG_OUTFILE, ARG_DUR, ARG_HZ,
ARG_SR, ARG_AMP, ARG_TYPE, ARG_NARGS};
enum samptype {RAWSAMP_SHORT, RAWSAMP_FLOAT};
/* Credit to the SNDAN programmers for this endianness identifier */
int byte_order(){
int one = 1;
char* endptr = (char *) &one;
return (*endptr);
}
const char* endianness[2] = {"big_endian", "little_endian"};
int main(int argc, char** argv){
unsigned int i, nsamps;
unsigned int maxframe = 0;
unsigned int samptype, endian, bitreverse;
double samp, dur, freq, srate, amp, step;
double start, end, fac, maxsamp;
double twopi = 2.0 * M_PI;
double angleincr;
FILE* fp = NULL;
float fsamp;
short ssamp;
if (argc != ARG_NARGS){
printf("Usage: tforkraw outfile.raw dur"
"freq srate amp isfloat\n");
return 1;
}
dur = atof(argv[ARG_DUR]);
if (dur <= 0.0) {
printf("Duration must be > 0\n");
return 1;
}
freq = atof(argv[ARG_HZ]);
if (freq < 20.0 || freq > 20000.0){
printf("Frequency is outside of audible range."
"Choose a value between 20.0 and 20000.0\n");
return 1;
}
srate = atof(argv[ARG_SR]);
if (srate < 0.0 || srate > 192000.0){
printf("Choose a sample rate between 0.0"
"and 192000.0\n");
return 1;
}
amp = atof(argv[ARG_AMP]);
if (amp <= 0.0 || amp > 1.0){
printf("Choose an amperage between 0.0 and 1.0.\n");
return 1;
}
samptype = atoi(argv[ARG_TYPE]);
if (samptype < 0 || samptype > 1){
printf("error: sampletype can only be 0 or 1\n");
return 1;
}
/* create binary file */
fp = fopen(argv[ARG_OUTFILE], "wb");
if (fp == NULL){
printf("error: unable to open file %s\n", argv[ARG_OUTFILE]);
return 1;
}
nsamps = (int) (dur * srate);
angleincr = twopi * freq / nsamps;
step = dur / nsamps;
/* normalized range */
start = 1.0;
end = 1.0e-4;
maxsamp = 0.0;
fac = pow(end / start, 1.0/nsamps);
endian = byte_order();
printf("Writing %d %s samples\n", nsamps, endianness[endian]);
if (samptype == RAWSAMP_SHORT){
for (i = 0; i < nsamps; i++){
samp = amp * sin(angleincr * i);
samp *= start;
start *= fac;
/* use 32767 to avoid overflow problems */
ssamp = (short) (samp * 32767.0);
if (fwrite(&ssamp, sizeof(short), 1, fp) != 1){
printf("Error writing data to file\n");
return 1;
}
if (fabs(samp) > maxsamp){
maxsamp = fabs(samp);
maxframe = i;
}
}
}
else {
for (i = 0; i < nsamps; i++){
samp = amp * sin(angleincr * i);
samp *= start;
start *= fac;
fsamp = (float) samp;
if (fwrite(&fsamp, sizeof(float), 1, fp) != 1){
printf("Error writing data to file\n");
return 1;
}
if (fabs(samp) > maxsamp){
maxsamp = fabs(samp);
maxframe = i;
}
}
}
fclose(fp);
printf("Done. Maximum sample value = %.8lf at frame %d\n", maxsamp, maxframe);
return 0;
} |
the_stack_data/72013520.c | // PARAM: --sets ana.activated[+] deadlock
#include <pthread.h>
#include <stdio.h>
typedef struct {
int balance;
pthread_mutex_t mutex;
} bank_account;
bank_account A, B;
void deposit(bank_account *f, bank_account *t, int ammount) {
pthread_mutex_lock(&f->mutex);
pthread_mutex_lock(&t->mutex); // NODEADLOCK
t->balance += ammount;
f->balance -= ammount;
pthread_mutex_unlock(&t->mutex);
pthread_mutex_unlock(&f->mutex);
}
void *t1(void *arg) {
deposit(&A, &B, rand() % 100);
return NULL;
}
void *t2(void *arg) {
deposit(&A, &B, -(rand() % 100));
return NULL;
}
int main(void) {
pthread_t id1, id2;
pthread_mutex_init(&A.mutex, NULL);
pthread_mutex_init(&B.mutex, NULL);
int i;
for (i = 0; i < 100000; i++) {
pthread_create(&id1, NULL, t1, NULL);
pthread_create(&id2, NULL, t2, NULL);
pthread_join (id1, NULL);
pthread_join (id2, NULL);
printf("%d: A = %d, B = %d.\n", i, A.balance, B.balance);
}
return 0;
}
|
the_stack_data/1004420.c | #include<stdio.h>
#include<stdlib.h>
#include<sys/wait.h>
#include<sys/types.h>
#include<unistd.h>
#include<math.h>
int main(int argc, char **argv)
{
int min=atoi(argv[1]), max=atoi(argv[2]);
pid_t p1 = fork();
if(p1==0)
{
int sum =0, i;
for(i=min;i<=max;i++)
{
if(i%2==0)
{
printf("\n %d is even. ",i);
sum+=i;
}
else printf("\n %d is odd. ",i);
}
printf("\nI am a child process with id %d. I was checking for odd and even. My parent is %d \n\n\n\n",getpid(),getppid());
exit(sum);
}
int esum;
wait(&esum);
pid_t p2=fork();
if(p2==0)
{
int sum=0;
int i,j;
for(i=min;i<=max;i++)
{
int n=i/2;
int f=0;
for(j=2;j<=n;j++)
{
if(i%j==0)
{
f=1;
break;
}
}
if(f) printf("\n %d is not prime.",i);
else
{
printf("\n %d is prime . ",i);
sum+=i;
}
}
printf("\n I am a child process checking for prime and non prime. My process id is %d.My parent is %d.\n\n\n\n\n",getpid(),getppid());
exit(sum);
}
int psum;
wait(&psum);
printf("\n Hello I am parent process with process id %d. My parent is %d. My children are %d and %d. \nI am printing sum of even and primes. Sum of even numbers is %d.Sum of prime numbers is %d\n. ",getpid(),getppid(),p1,p2,WEXITSTATUS(esum),WEXITSTATUS(psum));
return 0;
}
|
the_stack_data/161081327.c | //
// Created by AI Shaymin on 2021/6/5.
//
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#define BUF_SIZE 1024
void error_handling(char *message);
int main(int argc, char *argv[]) {
int serv_sock;
int clnt_sock;
char message[BUF_SIZE];
int str_len;
struct sockaddr_in serv_addr;
struct sockaddr_in clnt_addr;
socklen_t clnt_addr_size;
if (argc != 2) {
printf("Usage : %s <port>\n",argv[0]);
exit(1);
}
serv_sock = socket(PF_INET, SOCK_STREAM, 0);
if(serv_sock == -1) {
error_handling("socket() error");
}
memset(&serv_addr, 0, sizeof(serv_addr));
serv_addr.sin_family = AF_INET;
serv_addr.sin_addr.s_addr = htonl(INADDR_ANY);
serv_addr.sin_port = htons(atoi(argv[1]));
if (bind(serv_sock,(struct sockaddr *) &serv_addr, sizeof(serv_addr)) == -1) {
error_handling("bind() error");
}
if (listen(serv_sock, 5) == -1) {
error_handling("listen() error");
}
clnt_addr_size = sizeof(clnt_addr);
for (int i = 0; i < 5; ++i) {
clnt_sock = accept(serv_sock, (struct sockaddr *) &clnt_addr, &clnt_addr_size);
if (clnt_sock == -1) {
error_handling("accept() error");
}
else {
printf("Connected client %d\n",i + 1);
}
while ((str_len = read(clnt_sock, message, BUF_SIZE)) != 0) {
write(clnt_sock, message, str_len);
printf("client %d: message %s",i + 1, message);
}
close(serv_sock);
return 0;
}
}
void error_handling(char *message) {
fputs(message, stderr);
fputs("\n",stderr);
exit(1);
}
|
the_stack_data/94765.c | /*
* $QNXLicenseC:
* Copyright 2011-2012, QNX Software Systems.
* Copyright 2011-2012, Mike Gorchak.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not reproduce, modify or distribute this software except in
* compliance with the License. You may obtain a copy of the License
* at: http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OF ANY KIND, either express or implied.
*
* This file may contain contributions from others, either as
* contributors under the License or as licensors under other terms.
* Please review this entire file for other proprietary rights or license
* notices, as well as the QNX Development Suite License Guide at
* http://licensing.qnx.com/license-guide/ for other information.
* $
*/
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <inttypes.h>
#pragma pack(1)
typedef struct
{
uint8_t identsize; // size of ID field that follows 18 uint8_t header (0 usually)
uint8_t colourmaptype; // type of colour map 0=none, 1=has palette
uint8_t imagetype; // type of image 0=none,1=indexed,2=rgb,3=grey,+8=rle packed
uint16_t colourmapstart; // first colour map entry in palette
uint16_t colourmaplength; // number of colours in palette
uint8_t colourmapbits; // number of bits per palette entry 15,16,24,32
uint16_t xstart; // image x origin
uint16_t ystart; // image y origin
uint16_t width; // image width in pixels
uint16_t height; // image height in pixels
uint8_t bits; // image bits per pixel 8,16,24,32
uint8_t descriptor; // image descriptor bits (vh flip bits)
// pixel data follows header
} TGA_HEADER;
#pragma pack(0)
uint8_t buffer[16384];
int main(int argc, char* argv[])
{
int fd;
TGA_HEADER hdr;
int it, jt;
if (argc!=2)
{
fprintf(stderr, "Usage: tga2c filename.tga\n");
return -1;
}
fd=open(argv[1], O_RDONLY);
if (fd==-1)
{
fprintf(stderr, "Can't open %s file\n", argv[1]);
return -1;
}
if (read(fd, &hdr, 18)!=18)
{
close(fd);
fprintf(stderr, "Can't read %s file, too short\n", argv[1]);
return -1;
}
fprintf(stderr, "Image width %d pixels\n", hdr.width);
fprintf(stderr, "Image height %d pixels\n", hdr.height);
fprintf(stderr, "Image color bits %d\n", hdr.bits);
if ((hdr.imagetype & 0x03)!=2)
{
fprintf(stderr, "Non-RGB images are not supported!\n");
return -1;
}
if (hdr.imagetype & 0x08)
{
fprintf(stderr, "RLE packed images are not supported\n");
return -1;
}
fprintf(stdout, "unsigned char image[%d][%d*%d]=\n", hdr.height, hdr.width, hdr.bits/8);
fprintf(stdout, "{\n");
for (jt=0; jt<hdr.height; jt++)
{
fprintf(stdout, " {");
if (read(fd, buffer, hdr.width*hdr.bits/8)!=hdr.width*hdr.bits/8)
{
close(fd);
fprintf(stderr, "Can't read %s file, too short\n", argv[1]);
return -1;
}
for (it=0; it<hdr.width*hdr.bits/8; it++)
{
if ((it%12==0)&&(it!=0))
{
fprintf(stdout, "\n");
fprintf(stdout, " ");
}
if (it==hdr.width*hdr.bits/8-1)
{
fprintf(stdout, "0x%02X", buffer[it]);
}
else
{
if ((it+1)%12==0)
{
fprintf(stdout, "0x%02X,", buffer[it]);
}
else
{
fprintf(stdout, "0x%02X, ", buffer[it]);
}
}
}
fprintf(stdout, "},\n");
}
fprintf(stdout, "};\n");
close(fd);
return 0;
}
|
the_stack_data/150141985.c | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <pthread.h>
#include <wchar.h>
typedef struct _str {
unsigned long long count[128], total;
} data;
void *find(void *_file)
{
char *__file = (char *)_file;
FILE *file = fopen(__file, "r");
if(file == NULL)
{
return NULL;
}
wint_t ch;
data *dat = (data*)malloc(sizeof(data));
for(int p = 0; p < 128; ++p)
{
dat->count[p] = 0;
}
dat->total = 0;
while((ch = fgetwc(file)) != EOF)
{
dat->count[ch]++;
dat->total++;
}
fclose(file);
return dat;
}
int main(int argc, char *argv[])
{
unsigned long long count[128] = {}, total = 0;
int tot_files = argc - 1;
if(tot_files == 0)
{
printf("Usage: %s <file 1> <file 2> <file 3> .... <file n>\n", argv[0]);
return 0;
}
time_t start, end;
double diff_time;
time(&start);
/**/
pthread_t thread[tot_files];
for(int i = 0; i < tot_files; ++i)
{
pthread_create(&thread[i], NULL, find, argv[i + 1]);
}
for(int i = 0; i < tot_files; ++i)
{
void *ret;
pthread_join(thread[i], &ret);
if(ret != NULL)
{
for(int p = 0; p < 128; ++p)
{
count[p] += ((data *)ret)->count[p];
}
total += ((data *)ret)->total;
}
free(ret);
}
/*
data *dat[tot_files];
for(int i = 0; i < tot_files; ++i)
{
dat[i] = (data *)find(argv[i + 1]);
for(int p = 0; p < 128; ++p)
{
count[p] += dat[i]->count[p];
}
total += dat[i]->total;
}
for(int i = 0; i < tot_files; ++i)
{
free(dat[i]);
}
/**/
time(&end);
diff_time = difftime(end, start);
for(int i = 0; i < 128; ++i)
{
printf("%d = %llu\n", i, count[i]);
}
printf("Total: %llu\tTime: %.3f\n", total, diff_time);
return 0;
}
|
the_stack_data/68889261.c | #include <stdio.h>
int main(void) {
int number;
printf("Enter a number between 0 and 32767: ");
scanf("%d", &number);
printf("In octal, your number is %d%d%d%d%d\n",
(number / 4096) % 8, (number / 512) % 8, (number / 64 ) % 8, (number / 8) % 8, number % 8);
return 0;
} |
the_stack_data/212641982.c | // INTERVAL TREE PROBLEM
#define maxN 200005
struct diem{int x,y;};
int Tmax[maxN],Tmin[maxN],Parent[maxN],i,n,m,maxT=1,kmax,kmin,add,sonut,tmp;
struct diem d[maxN];
int min(int a,int b) {return a>b?b:a;}
int max(int a,int b) {return a>b?a:b;}
Init() {
scanf("%d%d",&n,&m);
while (maxT<=n*2) maxT*=2;
--maxT; add=maxT-n;
for (i=add+1;i<=maxT;i++) {scanf("%d",&Tmin[i]); Tmax[i]=Tmin[i];}
for (i=1;i<=m;i++) scanf("%d%d",&d[i].x,&d[i].y);
}
Get (int L,int R) {
while (L!=1) {
i=L;
do {
if (i>=R) break;
tmp=i/2;
Parent[i]=tmp;
Parent[i+1]=tmp;
Tmin[tmp]=min(Tmin[i],Tmin[i+1]);
Tmax[tmp]=max(Tmax[i],Tmax[i+1]);
i+=2;
} while (1);
R=L; L/=2;
}
}
Cal (int L,int R) {
if ((Parent[L]==Parent[R]) && (L!=R)) { L=Parent[L]; R=Parent[R]; }
if (L==R) {
kmax=max(kmax,Tmax[L]);
kmin=min(kmin,Tmin[L]);
return;
} else {
if (L%2!=0) {
kmax=max(kmax,Tmax[L]);
kmin=min(kmin,Tmin[L]);
++L;
}
if (R%2==0) {
kmax=max(kmax,Tmax[R]);
kmin=min(kmin,Tmin[R]);
--R;
}
sonut=R-L+1;
if (sonut>=2) {
if (Parent[L]!=Parent[R]) {
L=Parent[L];
R=Parent[R];
}
Cal(L,R);
}
}
}
Process() {
for (i=1;i<=m;i++) {
kmax=0;
kmin=maxN*100;
Cal(d[i].x+add,d[i].y+add);
printf("%d\n",kmax-kmin);
}
}
int main() {
Init();
Get (maxT/2+1,maxT);
Process();
return 0;
} |
the_stack_data/692657.c | /*
** EPITECH PROJECT, 2019
** my_print_alpha.c
** File description:
** print the alphabet in ascending order
*/
int my_add(int a, int b)
{
return (a + b);
}
int my_sub(int a, int b)
{
return (a - b);
}
int my_mul(int a, int b)
{
return (a * b);
}
int my_div(int a, int b)
{
return (a / b);
}
int my_mod(int a, int b)
{
return (a % b);
}
|
the_stack_data/74223.c | /*
* This file contains device specific hooks.
* Always enclose hooks to #if MR_DEVICE_HOOKS >= ver
* with corresponding hook version!
*/
#include <stdio.h>
#include <unistd.h>
#include <dirent.h>
#include <ctype.h>
#include <string.h>
#include <sys/stat.h>
#if MR_DEVICE_HOOKS >= 1
int mrom_hook_after_android_mounts(const char *busybox_path, const char *base_path, int type)
{
// On m8, this fstab file is used to remount system to RO,
// but with MultiROM, it remounts everything as RO, even /data and /cache
if(access("/remount.qcom", F_OK) >= 0)
remove("/remount.qcom");
// remove mounting from .rc files
int res = -1;
int add_dummy = 0;
char *l;
char line[1024];
char path_in[128];
char path_out[128];
FILE *in, *out;
DIR *d;
struct dirent *dp;
d = opendir("/");
if(!d)
return -1;
while((dp = readdir(d)))
{
if(dp->d_type != DT_REG || !strstr(dp->d_name, ".rc"))
continue;
snprintf(path_out, sizeof(path_out), "/%s", dp->d_name);
snprintf(path_in, sizeof(path_in), "/%s.new", dp->d_name);
if(rename(path_out, path_in) < 0)
goto exit;
in = fopen(path_in, "r");
if(!in)
goto exit;
out = fopen(path_out, "w");
if(!out)
{
fclose(in);
goto exit;
}
while((fgets(line, sizeof(line), in)))
{
for(l = line; isspace(*l); ++l);
if (strncmp(l, "on ", 3) == 0)
add_dummy = 1;
else if (strstr(l, "mount ") &&
(strstr(l, "/data") || strstr(l, "/system") || strstr(l, "/cache")))
{
if(add_dummy == 1)
{
add_dummy = 0;
fputs(" export DUMMY_LINE_INGORE_IT 1\n", out);
}
fputc((int)'#', out);
}
fputs(line, out);
}
fclose(out);
fclose(in);
remove(path_in);
chmod(path_out, 0750);
}
res = 0;
exit:
closedir(d);
return res;
}
#endif /* MR_DEVICE_HOOKS >= 1 */
#if MR_DEVICE_HOOKS >= 2
void mrom_hook_before_fb_close(void) { }
#endif
#if MR_DEVICE_HOOKS >= 3
void tramp_hook_before_device_init(void) { }
#endif
#if MR_DEVICE_HOOKS >= 4
int mrom_hook_allow_incomplete_fstab(void)
{
return 1;
}
#endif
|
the_stack_data/179830366.c | #include <stdio.h>
int startrow, startcol, row, col, finalrow, finalcol;
void display(char arr[50][50]);
void move(char arr[50][50]);
int main()
{
char maze[50][50], a, kdb;
int b, c;
int i, j;
for(i=0;i<50;i++)
for(j=0;j<50;j++)
maze [i] [j] = ' ';
scanf("%d %d",&row,&col);
for(i=0; i<row; i++){
for(j=0; j<col; j++){
if(j == 0 || j == (col-1)){
maze[i][j]='*';
}
else if(i == 0 || (i == (row-1))){
maze[i][j]='*';
}
else{ maze[i][j] = ' ';}
}
}
while(1){
scanf(" %c",&a);
switch (a){
case 's':
scanf("%d %d",&b,&c);
maze[b][c]='O';
startrow=b, startcol=c;
break;
case 'f':
scanf("%d %d",&b,&c);
maze[b][c]='f';
finalrow=b, finalcol=c;
break;
case '$':
scanf("%d %d",&b,&c);
maze[b][c]='$';
break;
case 'b':
scanf("%d %d",&b,&c);
maze[b][c]='*';
break;
case 'X':
scanf("%d %d",&b,&c);
maze[b][c]='X';
break;
}
if(a == 'e'){
scanf("%c %c",&kdb, &kdb);
break;
}
}
display(maze);
move(maze);
return 0;
}
void display(char arr[50][50]){
int i, j;
for(i=0; i<row; i++){
for(j=0; j<col; j++){
if(arr[i][j] == 'f'){
arr[i][j]=' ';
}
printf("%c",arr[i][j]);
}
printf("\n");
}
printf("\n");
}
void move(char arr[50][50]){
char tea;
int sum=0, i=startrow, j=startcol;
while(scanf(" %c",&tea) != EOF){
switch (tea){
case 'd':
if(arr[i+1][j] == '*'){
printf("INVALID MOVE. TRY ANOTHER DIRECTION!\n");
}
else if(arr[i+1][j] == '$'){
sum++;
printf("YOU GOT 1 $.\n");
arr[i+1][j]='O';
arr[i][j]=' ';
i++;
}
else if((i+1 == finalrow) && (j == finalcol)){
printf("CONGRATS! YOU GOT %d BONUS:)\n",sum);
arr[i+1][j]='O';
arr[i][j]=' ';
i++;
display(arr);
return;
}
else if(arr[i+1][j] == 'X'){
printf("YOU MET WITH THE ENEMY AND LOST THE GAME :(\nGAME IS OVER!\n");
display(arr);
return;
}
else{
arr[i+1][j]='O';
arr[i][j]=' ';
i++;
}
break;
case 'r':
if(arr[i][j+1] == '*'){
printf("INVALID MOVE. TRY ANOTHER DIRECTION!\n");
}
else if(arr[i][j+1] == '$'){
sum++;
printf("YOU GOT 1 $.\n");
arr[i][j+1]='O';
arr[i][j]=' ';
j++;
}
else if((i == finalrow) && (j+1 == finalcol)){
printf("CONGRATS! YOU GOT %d BONUS:)\n",sum);
arr[i][j+1]='O';
arr[i][j]=' ';
j++;
display(arr);
return;
}
else if(arr[i][j+1] == 'X'){
printf("YOU MET WITH THE ENEMY AND LOST THE GAME :(\nGAME IS OVER!\n");
display(arr);
return;
}
else{
arr[i][j+1]='O';
arr[i][j]=' ';
j++;
}
break;
case 'l':
if(arr[i][j-1] == '*'){
printf("INVALID MOVE. TRY ANOTHER DIRECTION!\n");
}
else if(arr[i][j-1] == '$'){
sum++;
printf("YOU GOT %d $.\n",sum);
arr[i][j-1]='O';
arr[i][j]=' ';
j--;
}
else if((i == finalrow) && (j-1 == finalcol)){
printf("CONGRATS! YOU GOT 1 BONUS:)\n");
arr[i][j-1]='O';
arr[i][j]=' ';
j--;
display(arr);
return;
}
else if(arr[i][j-1] == 'X'){
printf("YOU MET WITH THE ENEMY AND LOST THE GAME :(\nGAME IS OVER!\n");
display(arr);
return;
}
else{
arr[i][j-1]='O';
arr[i][j]=' ';
j--;
}
break;
case 'u':
if(arr[i-1][j] == '*'){
printf("INVALID MOVE. TRY ANOTHER DIRECTION!\n");
}
else if(arr[i-1][j] == '$'){
sum++;
printf("YOU GOT 1 $.\n");
arr[i-1][j]='O';
arr[i][j]=' ';
i--;
}
else if((i-1 == finalrow) && (j == finalcol)){
printf("CONGRATS! YOU GOT %d BONUS:)\n",sum);
arr[i-1][j]='O';
arr[i][j]=' ';
i--;
display(arr);
return;
}
else if(arr[i-1][j] == 'X'){
printf("YOU MET WITH THE ENEMY AND LOST THE GAME :(\nGAME IS OVER!\n");
display(arr);
return;
}
else{
arr[i-1][j]='O';
arr[i][j]=' ';
i--;
}
break;
case 'q':
printf("YOU COULD NOT REACH THE FINAL POSITION :(\nGAME IS OVER!\n");
display(arr);
return;
}
display(arr);
}
printf("YOU COULD NOT REACH THE FINAL POSITION :(\nGAME IS OVER!\n");
for(i=0; i<row; i++){
for(j=0; j<col; j++){
if(arr[i][j] == 'f'){
arr[i][j]=' ';
}
printf("%c",arr[i][j]);
}
printf("\n");
}
return;
}
|
the_stack_data/53565.c | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define N 25
#define M 250
void printArray(int arr[], int n);
void swap(int *a, int *b);
void shakerSort(int arr[], int n){
int swapped = 1;
int start = 0;
int end = n-1;
while(swapped){
swapped = 0;
for(int a = start; a < end; a++){
if(arr[a] > arr[a+1]){
swap(&arr[a], &arr[a+1]);
swapped = 1;
}
}
if(!swapped){
break;
}
swapped = 0;
end--;
for(int a = end; a > start; a--){
if(arr[a] < arr[a-1]){
swap(&arr[a], &arr[a-1]);
swapped = 1;
}
}
start++;
printArray(arr, n);
}
}
int main(){
srand(time(NULL));
int arr[N] = {0};
for(int a = 0; a < N; a++){
arr[a] = rand()%M;
}
printArray(arr, N);
shakerSort(arr, N);
return 0;
}
void printArray(int arr[], int n){
for(int a = 0; a < n; a++){
printf("%d ", arr[a]);
}
printf("\n");
}
void swap(int *a, int *b){
int t = *a;
*a = *b;
*b = t;
}
|
the_stack_data/145210.c | /*
Copyright (c) 2003-2013 uim Project https://github.com/uim/uim
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. Neither the name of authors nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
#define _POSIX_C_SOURCE 200809L
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <iconv.h>
#define MBCHAR_LEN_MAX 6 /* assumes CESU-8 */
char *
iconv_code_conv(iconv_t cd, const char *instr)
{
size_t ins;
const char *in;
size_t outbufsiz, outs;
char *outbuf = NULL, *out;
size_t ret = 0;
size_t nconv = 0;
size_t idx = 0;
char *str = NULL;
if (!instr)
goto err;
ins = strlen(instr);
in = instr;
outbufsiz = (ins + sizeof("")) * MBCHAR_LEN_MAX;
out = outbuf = malloc(outbufsiz);
while (ins > 0) {
out = outbuf;
outs = outbufsiz;
ret = iconv(cd, (char **)&in, &ins, &out, &outs);
nconv = outbufsiz - outs;
if (ret == (size_t)-1) {
switch (errno) {
case EINVAL:
goto err;
case E2BIG:
outbufsiz *= 2;
out = realloc(outbuf, outbufsiz);
outbuf = out;
break;
default:
goto err;
}
} else {
/* XXX: irreversible characters */
}
if (nconv > 0) {
if (str == NULL)
str = malloc(nconv + 1);
else
str = realloc(str, idx + nconv + 1);
memcpy(&str[idx], outbuf, nconv);
idx += nconv;
}
}
do {
out = outbuf;
outs = outbufsiz;
ret = iconv(cd, NULL, NULL, &out, &outs);
nconv = outbufsiz - outs;
if (ret == (size_t)-1) {
outbufsiz *= 2;
out = realloc(outbuf, outbufsiz);
outbuf = out;
} else {
/* XXX: irreversible characters */
}
if (nconv > 0) {
if (str == NULL)
str = malloc(nconv + 1);
else
str = realloc(str, idx + nconv + 1);
memcpy(&str[idx], outbuf, nconv);
idx += nconv;
}
} while (ret == (size_t)-1);
if (str == NULL)
str = strdup("");
else
str[idx] = '\0';
free(outbuf);
return str;
err:
free(str);
free(outbuf);
return strdup("");
}
|
the_stack_data/225144526.c |
/* text version of maze 'mazefiles/binary/sd2p02.maz'
generated by mazetool (c) Peter Harrison 2018
o---o---o---o---o---o---o---o---o---o---o---o---o---o---o---o---o
| | | | | |
o o o o---o o o o o---o---o---o---o---o---o o o
| | | | | | | | | | |
o o o o---o o o o o---o o---o---o---o o o o
| | | | | | | |
o o o o o---o---o---o---o o o o o o o o o
| | | | | | | | | | |
o o o---o---o---o o o o o o o o o o o o
| | | | | | | | | |
o o o---o o---o o o o---o o o o o o o o
| | | | | | | | | | | | | | |
o o o o o o o o---o o o o o o o o o
| | | | | | | | | | | | |
o o o o o---o o o---o---o---o---o o---o o o o
| | | | | | | |
o o---o---o---o---o---o---o o o o---o---o---o o o o
| | | | | |
o o o o o---o o o---o---o---o---o o---o o o o
| | | | | | | | | | | | |
o o o o o o o o---o o o o o o o o o
| | | | | | | | | | | | | | |
o o o---o o---o o o o---o o o o o o o o
| | | | | | | | | |
o o o---o---o---o---o o o o o o o o o o o
| | | | | | | | | | |
o o o o o---o---o---o---o o o o o o o o o
| | | | | | | |
o o o o---o o o o o---o o---o---o---o o o o
| | | | | | | | | | |
o o o o---o o o o o---o---o---o---o---o---o o o
| | | | | |
o---o---o---o---o---o---o---o---o---o---o---o---o---o---o---o---o
*/
int sd2p02_maz[] ={
0x0E, 0x0A, 0x0A, 0x0A, 0x08, 0x0A, 0x0A, 0x08, 0x08, 0x0A, 0x0A, 0x08, 0x0A, 0x0A, 0x0A, 0x0B,
0x0C, 0x0A, 0x0A, 0x08, 0x00, 0x0A, 0x0A, 0x01, 0x04, 0x0A, 0x0A, 0x00, 0x08, 0x0A, 0x0A, 0x09,
0x04, 0x0A, 0x08, 0x03, 0x05, 0x0E, 0x0A, 0x03, 0x06, 0x0A, 0x0B, 0x05, 0x06, 0x08, 0x0A, 0x01,
0x05, 0x0F, 0x04, 0x09, 0x04, 0x0A, 0x0A, 0x09, 0x0C, 0x0A, 0x0A, 0x01, 0x0C, 0x01, 0x0F, 0x05,
0x06, 0x0A, 0x01, 0x05, 0x05, 0x0E, 0x0B, 0x05, 0x05, 0x0E, 0x0B, 0x05, 0x05, 0x04, 0x0A, 0x03,
0x0C, 0x0A, 0x03, 0x05, 0x06, 0x0A, 0x0A, 0x01, 0x06, 0x0A, 0x0A, 0x02, 0x01, 0x06, 0x0A, 0x09,
0x06, 0x0A, 0x09, 0x04, 0x0A, 0x0A, 0x08, 0x03, 0x0E, 0x08, 0x0A, 0x0A, 0x01, 0x0C, 0x0A, 0x03,
0x0C, 0x08, 0x01, 0x06, 0x08, 0x09, 0x05, 0x0C, 0x09, 0x05, 0x0C, 0x08, 0x03, 0x04, 0x08, 0x09,
0x05, 0x05, 0x06, 0x0A, 0x01, 0x06, 0x01, 0x04, 0x03, 0x04, 0x03, 0x04, 0x0A, 0x03, 0x05, 0x05,
0x05, 0x04, 0x08, 0x0A, 0x02, 0x0A, 0x03, 0x04, 0x09, 0x06, 0x0A, 0x02, 0x0A, 0x08, 0x01, 0x05,
0x05, 0x05, 0x04, 0x0A, 0x0A, 0x0A, 0x0B, 0x05, 0x05, 0x0E, 0x0A, 0x0A, 0x0A, 0x01, 0x05, 0x05,
0x05, 0x05, 0x04, 0x0A, 0x0A, 0x0A, 0x08, 0x01, 0x04, 0x08, 0x0A, 0x0A, 0x0A, 0x01, 0x05, 0x05,
0x05, 0x05, 0x04, 0x0A, 0x0A, 0x0A, 0x03, 0x05, 0x05, 0x06, 0x0A, 0x0A, 0x0A, 0x01, 0x05, 0x05,
0x07, 0x06, 0x02, 0x08, 0x0A, 0x0A, 0x0A, 0x02, 0x02, 0x0A, 0x0A, 0x0A, 0x08, 0x02, 0x03, 0x07,
0x0C, 0x0A, 0x0A, 0x02, 0x0A, 0x08, 0x0A, 0x0A, 0x0A, 0x0A, 0x08, 0x0A, 0x02, 0x0A, 0x0A, 0x09,
0x06, 0x0A, 0x0A, 0x0A, 0x0A, 0x02, 0x0A, 0x0A, 0x0A, 0x0A, 0x02, 0x0A, 0x0A, 0x0A, 0x0A, 0x03,
};
/* end of mazefile */
|
the_stack_data/26700206.c | // https://leetcode.com/problems/first-missing-positive/description/
// 先排序然后求解
// 要求时间复杂度O(n)
// 正整数可以使用bucket sort实现时间复杂度为O(n)的排序
int firstMissingPositive(int *nums, int numsSize) {
for (int i = 0; i < numsSize; i++) {
if (nums[i] > 0 && nums[i] <= numsSize && nums[nums[i] - 1] != nums[i]) {
int t = nums[nums[i] - 1];
nums[nums[i] - 1] = nums[i];
nums[i] = t;
i--;
}
}
for (int i = 0; i < numsSize; i++) {
if (nums[i] != i + 1) {
return i + 1;
}
}
return numsSize + 1;
}
|
the_stack_data/144198.c | #include <malloc.h>
#include <stdlib.h>
#include <string.h>
void * test_malloc(int num);
void * test_malloc2(int num)
{
if (num <= 0) {
return (void *) malloc(8);
} else {
return test_malloc( num - 1 );
}
}
void * test_malloc(int num)
{
return test_malloc2(num);
}
void consume_tdata(void *arg)
{
(void) arg;
}
void memset_wrap( void *trg, int ch, size_t n)
{
memset( trg, ch, n);
}
void memcpy_wrap( void *trg, void *src, size_t n)
{
memcpy( trg, src, n);
}
|
the_stack_data/958131.c | /*
* motorola-bin.c
*
* Copyright (C) 2005-2006 Mike Baker,
* Imre Kaloz <[email protected]>
* D. Hugh Redelmeier
* OpenWrt.org
*
* $Id: motorola-bin.c 9434 2007-10-24 18:06:24Z nbd $
*
* 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.
*
*/
/*
* Motorola's firmware flashing code requires an extra header.
* The header is eight bytes (see struct motorola below).
* This program will take a firmware file and create a new one
* with this header:
* motorola-bin --wr850g WR850G_V403.stripped.trx WR850G_V403.trx
*
* Note: Motorola's firmware is distributed with this header.
* If you need to flash Motorola firmware on a router running OpenWRT,
* you will to remove this header. Use the --strip flag:
* motorola-bin --strip WR850G_V403.trx WR850G_V403.stripped.trx
*/
/*
* February 1, 2006
*
* Add support for for creating WA840G and WE800G images
*/
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <string.h>
#include <netinet/in.h>
#include <inttypes.h>
#define BPB 8 /* bits/byte */
static uint32_t crc32[1<<BPB];
static void init_crc32()
{
const uint32_t poly = ntohl(0x2083b8ed);
int n;
for (n = 0; n < 1<<BPB; n++) {
uint32_t crc = n;
int bit;
for (bit = 0; bit < BPB; bit++)
crc = (crc & 1) ? (poly ^ (crc >> 1)) : (crc >> 1);
crc32[n] = crc;
}
}
static uint32_t crc32buf(unsigned char *buf, size_t len)
{
uint32_t crc = 0xFFFFFFFF;
for (; len; len--, buf++)
crc = crc32[(uint8_t)crc ^ *buf] ^ (crc >> BPB);
return crc;
}
struct motorola {
uint32_t crc; // crc32 of the remainder
uint32_t flags; // unknown, 105770*
};
static const struct model {
char digit; /* a digit signifying model (historical) */
const char *name;
uint32_t flags;
} models[] = {
{ '1', "WR850G", 0x10577050LU },
{ '2', "WA840G", 0x10577040LU },
{ '3', "WE800G", 0x10577000LU },
{ '\0', NULL, 0 }
};
static void usage(const char *) __attribute__ (( __noreturn__ ));
static void usage(const char *mess)
{
const struct model *m;
fprintf(stderr, "Error: %s\n", mess);
fprintf(stderr, "Usage: motorola-bin -device|--strip infile outfile\n");
fprintf(stderr, "Known devices: ");
for (m = models; m->digit != '\0'; m++)
fprintf(stderr, " %c - %s", m->digit, m->name);
fprintf(stderr, "\n");
exit(1);
}
int main(int argc, char **argv)
{
off_t len; // of original firmware
int fd;
void *trx; // pointer to original firmware (mmmapped)
struct motorola *firmware; // pionter to prefix + copy of original firmware
uint32_t flags;
// verify parameters
if (argc != 4)
usage("wrong number of arguments");
// mmap trx file
if ((fd = open(argv[2], O_RDONLY)) < 0
|| (len = lseek(fd, 0, SEEK_END)) < 0
|| (trx = mmap(0, len, PROT_READ, MAP_SHARED, fd, 0)) == (void *) (-1)
|| close(fd) < 0)
{
fprintf(stderr, "Error loading file %s: %s\n", argv[2], strerror(errno));
exit(1);
}
init_crc32();
if (strcmp(argv[1], "--strip") == 0)
{
const char *ugh = NULL;
if (len < sizeof(struct motorola)) {
ugh = "input file too short";
} else {
const struct model *m;
firmware = trx;
if (htonl(crc32buf(trx + offsetof(struct motorola, flags), len - offsetof(struct motorola, flags))) != firmware->crc)
ugh = "Invalid CRC";
for (m = models; ; m++) {
if (m->digit == '\0') {
if (ugh == NULL)
ugh = "unrecognized flags field";
break;
}
if (firmware->flags == htonl(m->flags)) {
fprintf(stderr, "Firmware for Motorola %s\n", m->name);
break;
}
}
}
if (ugh != NULL) {
fprintf(stderr, "%s\n", ugh);
exit(3);
} else {
// all is well, write the file without the prefix
if ((fd = open(argv[3], O_CREAT|O_WRONLY,0644)) < 0
|| write(fd, trx + sizeof(struct motorola), len - sizeof(struct motorola)) != len - sizeof(struct motorola)
|| close(fd) < 0)
{
fprintf(stderr, "Error storing file %s: %s\n", argv[3], strerror(errno));
exit(2);
}
}
} else {
// setup the firmware flags magic number
const struct model *m;
const char *df = argv[1];
if (*df != '-')
usage("first argument must start with -");
if (*++df == '-')
++df; /* allow but don't require second - */
for (m = models; ; m++) {
if (m->digit == '\0')
usage("unrecognized device specified");
if ((df[0] == m->digit && df[1] == '\0') || strcasecmp(df, m->name) == 0) {
flags = m->flags;
break;
}
}
// create a firmware image in memory
// and copy the trx to it
firmware = malloc(sizeof(struct motorola) + len);
memcpy(&firmware[1], trx, len);
// setup the motorola headers
firmware->flags = htonl(flags);
// CRC of flags + firmware
firmware->crc = htonl(crc32buf((unsigned char *)&firmware->flags, sizeof(firmware->flags) + len));
// write the firmware
if ((fd = open(argv[3], O_CREAT|O_WRONLY,0644)) < 0
|| write(fd, firmware, sizeof(struct motorola) + len) != sizeof(struct motorola) + len
|| close(fd) < 0)
{
fprintf(stderr, "Error storing file %s: %s\n", argv[3], strerror(errno));
exit(2);
}
free(firmware);
}
munmap(trx,len);
return 0;
}
|
the_stack_data/165769242.c | #include <stdio.h>
#include <stdbool.h>
#include <math.h>
int main()
{
bool valid = true; /* Until we know otherwise */
double c;
double l;
printf("Input Capacitance (microfarads): ");
scanf("%lf", &c);
printf("Input Inductance (millihenrys): ");
scanf("%lf", &l);
/* Test to see if the user entered an invalid capacitance. */
if(c < 0) {
printf("You moron, you entered a negative capacitance!\n");
valid = false;
}
else if(c == 0) {
printf("You are really dumb, you entered a zero capacitance!\n");
valid = false;
}
else {
printf("Okay, I guess that's a reasonable capacitance.\n");
}
/* Test to see if the user entered an invalid inductance. */
if(l < 0) {
printf("You moron, you entered a negative inductance!\n");
valid = false;
}
else if(l == 0) {
printf("You are really dumb, you entered a zero inductance!\n");
valid = false;
}
else {
printf("Okay, I guess that's a reasonable inductance.\n");
}
if (valid) {
double omega = 1.0 / (sqrt((c / 1e6L) * (l / 1e3L)));
double f = omega / 2.0 / M_PI;
printf("Resonant Frequency is %7.3f\n", f);
if (f >= 20 && f <=20000) {
printf("This frequency is one I can hear!\n");
}
}
}
|
the_stack_data/175143839.c | #include <string.h>
char tolower(char c) {
if (c>('A'-1)&&c<('Z'+1))
return c+('a'-'A');
return c;
} |
the_stack_data/153268130.c | // RUN: %clang-o3 -march=native -mllvm -filter=kernel %s -o %t && %t
__attribute__((noinline))
void kernel(int n, float *RET, float *restrict aFOO) {
for (int programIndex = 0; programIndex < n; programIndex++) {
float a = aFOO[programIndex];
int i, j;
float r = 0;
for (i = 0; i < a; ++i) {
if (i != 0) {
if (a != 2)
continue;
r = 10;
}
++r;
}
RET[programIndex] = r;
}
}
int main() {
int n = 1030;
float a[n], ret[n];
for (int i = 0; i < n; i++)
a[i] = i+1;
kernel(n, ret, a);
for (int i = 0; i < n; i++) {
float expected = 1;
if (i == 1)
expected = 11;
if (ret[i] != expected)
return 1;
}
return 0;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.