file
stringlengths 18
26
| data
stringlengths 2
1.05M
|
---|---|
the_stack_data/194790.c | #include <stdio.h>
int main()
{
int num, prod = 1;
while (scanf("%d", &num) != EOF)
{
prod *= num;
}
printf("Prod = %d\n", prod);
return(0);
}
|
the_stack_data/57951009.c | //--Make sure we can run DSA on it!
//RUN: clang %s -c -emit-llvm -o - | \
//RUN: dsaopt -dsa-bu -dsa-td -disable-output
#include <stdlib.h>
int* test(int **a2, int **b2) {
int *temp;
temp = *a2;
a2 = b2;
*b2 = temp;
return *a2;
}
void func() {
int* mem1 = (int *)malloc(sizeof(int));
int* mem2 = (int *)malloc(sizeof(int));
int *a1 = test(&mem1, &mem2);
int *b1 = test(&mem2, &mem1);
}
|
the_stack_data/29824473.c | /*********************************************
bankers.c
Matthew Frey
**********************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
struct systemData {
int numProcesses;
int numResources;
int* allocationMatrix;
int* maxMatrix;
int* availableMatrix;
int* needsMatrix;
int* safeMatrix;
int* orderMatrix;
int* workMatrix;
};
struct systemData getSystemData(char* filePath);
int getBankersMetrics(FILE* filePath, char* metricType);
int getBankersMatrix(FILE * fp, int* matrix, char* matrixType, int matrixHeight, int matrixWidth);
int* getNeedsMatrix(struct systemData sysData);
int* initProcessMatrix(int matrixSize);
int* initWorkMatrix(int* availableMatrix, int matrixSize);
void getOrderMatrix(struct systemData sysData);
void printResults(struct systemData sysData);
void freeMatrices(struct systemData sysData, int isError);
void freeMatrix(int* matrix, int isError);
int main(int argc, char *argv[]) {
if(argc != 2) {
fprintf(stderr, "usage: %s <filename>\n", argv[0]);
exit(-1);
}
char* filePath = argv[1];
struct systemData sysData = getSystemData(filePath);
sysData.needsMatrix = getNeedsMatrix(sysData);
sysData.safeMatrix = initProcessMatrix(sysData.numProcesses);
sysData.orderMatrix = initProcessMatrix(sysData.numProcesses);
sysData.workMatrix = initWorkMatrix(sysData.availableMatrix, sysData.numResources);
getOrderMatrix(sysData);
printResults(sysData);
freeMatrices(sysData, 0);
return 0;
}
struct systemData getSystemData(char* filePath) {
struct systemData sysData;
char* numProcessesTag = "numProcesses";
char* numResourcesTag = "numResources";
char* allocationTag = "Allocation";
char* maxTag = "Max";
char* availableTag = "Available";
FILE * fp;
fp = fopen(filePath, "r");
if(!fp) {
fprintf(stderr, "Failed to open file location %s.\n", filePath);
exit(-1);
}
sysData.numProcesses = getBankersMetrics(fp, numProcessesTag);
sysData.numResources = getBankersMetrics(fp, numResourcesTag);
int matrixSize = sysData.numProcesses * sysData.numResources;
sysData.allocationMatrix = (int*)calloc(matrixSize, sizeof(int));
if(getBankersMatrix(fp, sysData.allocationMatrix, allocationTag, sysData.numProcesses, sysData.numResources) == -1) {
fclose(fp);
freeMatrix(sysData.allocationMatrix, 1);
exit(-1);
}
sysData.maxMatrix = (int*)calloc(matrixSize, sizeof(int));
if(getBankersMatrix(fp, sysData.maxMatrix, maxTag, sysData.numProcesses, sysData.numResources) == -1) {
fclose(fp);
freeMatrix(sysData.allocationMatrix, 1);
freeMatrix(sysData.maxMatrix, 1);
exit(-1);
}
sysData.availableMatrix = (int*)calloc(sysData.numResources, sizeof(int));
if(getBankersMatrix(fp, sysData.availableMatrix, availableTag, 1, sysData.numResources) == -1) {
fclose(fp);
freeMatrix(sysData.allocationMatrix, 1);
freeMatrix(sysData.maxMatrix, 1);
freeMatrix(sysData.availableMatrix, 1);
exit(-1);
}
fclose(fp);
return sysData;
}
int getBankersMetrics(FILE * fp, char* metricType) {
char lines[150];
int metric = -1;
int typeFound = 0;
while(!feof(fp)) {
fgets(lines, 150, fp);
if(strstr(lines, metricType)) {
typeFound = 1;
char* num = strtok(lines, "=");
while(num != NULL) {
metric = atoi(num);
num = strtok(NULL, "=");
}
break;
}
}
if (typeFound == 0) {
fprintf(stderr, "%s not found in input file.\n", metricType);
exit(-1);
}
return metric;
}
int getBankersMatrix(FILE * fp, int* matrix, char* matrixType, int matrixHeight, int matrixWidth) {
char lines[150];
int matrixIdentifier = 0;
int i;
int j;
int k = 0;
while(!feof(fp)) {
fgets(lines, 150, fp);
if(strstr(lines, matrixType)) {
matrixIdentifier = 1;
break;
}
}
if(matrixIdentifier == 0) {
fprintf(stderr, "%s matrix not found in input file.\n", matrixType);
return(-1);
}
for(i = 0; i < matrixHeight; i++) {
fgets(lines, 150, fp);
if(strstr(lines, "]")) {
break;
}
char* num = strtok(lines, " ");
for(j = 0; j < matrixWidth; j++) {
matrix[k] = atoi(num);
num = strtok(NULL, " ");
k++;
}
}
return 0;
}
int* getNeedsMatrix(struct systemData sysData) {
int matrixSize = sysData.numProcesses * sysData.numResources;
sysData.needsMatrix = (int*)calloc(matrixSize, sizeof(int));
int i;
for(i=0; i<matrixSize; i++) {
sysData.needsMatrix[i] = sysData.maxMatrix[i] - sysData.allocationMatrix[i];
if(sysData.needsMatrix[i] < 0) {
fprintf(stderr, "Allocation Matrix cannot contain value for a resource greater than Max Matrix.\n");
freeMatrix(sysData.allocationMatrix, 1);
exit(-1);
}
}
return sysData.needsMatrix;
}
int* initProcessMatrix(int matrixSize) {
int* processMatrix = (int*)calloc(matrixSize, sizeof(int));
return processMatrix;
}
int* initWorkMatrix(int* allocationMatrix, int matrixSize) {
int* workMatrix = (int*)calloc(matrixSize, sizeof(int));
int i;
for(i=0;i<matrixSize;i++) {
workMatrix[i] = allocationMatrix[i];
}
return workMatrix;
}
void getOrderMatrix(struct systemData sysData) {
int i;
int j;
int k;
int meetsNeeds;
int processesCompleted = 0;
int lastCompleted = -1;
while(1) {
if(processesCompleted == sysData.numProcesses) {
printf("%s", "System is in safe state.\n");
printf("%s", "Safe process order: ");
break;
}
if(processesCompleted == lastCompleted) {
printf("%s", "System is in unsafe state.\nNumber of processes completed: ");
printf("%d\n", processesCompleted);
printf("%s", "Partial process order: ");
break;
}
lastCompleted = processesCompleted;
for(i=0;i<sysData.numProcesses;i++) {
if(!sysData.safeMatrix[i]) {
meetsNeeds = 1;
for(j=0;j<sysData.numResources;j++) {
k = i*sysData.numResources + j;
if(sysData.needsMatrix[k] > sysData.workMatrix[j]) {
meetsNeeds = 0;
}
}
if(meetsNeeds) {
sysData.safeMatrix[i] = 1;
sysData.orderMatrix[processesCompleted] = i;
processesCompleted++;
for(j=0;j<sysData.numResources;j++) {
k = i*sysData.numResources + j;
sysData.workMatrix[j] += sysData.allocationMatrix[k];
}
}
}
}
}
return;
}
void printResults(struct systemData sysData) {
int i;
for(i=0;i<sysData.numProcesses;i++) {
if(sysData.safeMatrix[i] == 1) {
printf("P(%d) ", sysData.orderMatrix[i]);
}
}
printf("\n");
}
void freeMatrices (struct systemData sysData, int isError) {
if(sysData.allocationMatrix) {free(sysData.allocationMatrix);}
if(sysData.maxMatrix) {free(sysData.maxMatrix);}
if(sysData.availableMatrix) {free(sysData.availableMatrix);}
if(sysData.needsMatrix) {free(sysData.needsMatrix);}
if(sysData.safeMatrix) {free(sysData.safeMatrix);}
if(sysData.orderMatrix) {free(sysData.orderMatrix);}
if(sysData.workMatrix) {free(sysData.workMatrix);}
if(isError) {
exit(-1);
}
}
void freeMatrix (int* matrix, int isError) {
free(matrix);
}
|
the_stack_data/3126.c | // Simple sed.
// Only supports s and d command.
// Not checked regexp
// (example)
// * sed 1,5d
// -> delete line 1 to 5
// * sed 2s/abc/pqr/g
// -> substitute pqr for abc in line 2
// * sed 3iabc
// -> insert abc before line 3
// * sed 3apqr
// -> insert pqr after line 3
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
char buf[1024];
char *extractline(char *option, int *start, int *end);
void sed_delete(int fd, int start, int end);
void sed_substitute(int fd, int start, int end, char *option);
void sed_insert(int fd, int start, int end, char *txt);
void sed_append(int fd, int start, int end, char *txt);
void sed(char *option, int fd){
int start, end;
option = extractline(option, &start, &end);
switch(*option){
case 'd':
sed_delete(fd, start, end);
return;
case 's':
option++;
sed_substitute(fd, start, end, option);
return;
case 'a':
option++;
sed_append(fd, start, end, option);
return;
case 'i':
option++;
sed_insert(fd, start, end, option);
return;
default:
printf("sed: wrong command\n");
return;
}
}
int main(int argc, char *argv[]){
int fd, i;
char *option;
if(argc <= 1){
fprintf(stderr, "usage: sed [OPTION] [input]\n");
fprintf(stderr, "OPTION: [line][command]\n");
fprintf(stderr, "command: d(delete), s(substitute), a(append), i(insert)\n");
exit(1);
}
option = argv[1];
if(argc <= 2){
sed(option, 0);
exit(0);
}
for(i = 2; i < argc; i++){
if((fd = open(argv[i], 0)) < 0){
fprintf(stderr, "sed: cannot open %s\n", argv[i]);
exit(1);
}
sed(option, fd);
close(fd);
}
exit(0);
}
// extract line option
char *extractline(char *option, int *start, int *end){
*start = 0;
*end = -1;
// line optioned
while(*option >= '0' && *option <= '9'){
*start += (*start)*10 + ((*option) - '0');
option++;
}
if(*option != ','){
if(*start == 0){
*start = 1;
return option;
}
*end = *start;
return option;
}
option++;
*end = 0;
while(*option >= '0' && *option <= '9'){
*end += (*end)*10 + ((*option) - '0');
option++;
}
return option;
}
// line is in range
int isrange(int start, int end, int line){
return start <= line && (line <= end || end == -1);
}
// delete line
void sed_delete(int fd, int start, int end){
int n, m, l;
char *p, *q;
m = 0;
l = 0;
while((n = read(fd, buf+m, sizeof(buf)-m-1)) >0 ){
buf[m+n]=0;
m += n;
p = buf;
while((q = strchr(p, '\n')) != 0){
l++;
*q = 0;
if(!isrange(start, end, l)){
*q = '\n';
write(1, p, q+1-p);
}
p = q+1;
}
if(p == buf)
m=0;
if(m > 0){
m -= p - buf;
memmove(buf, p, m);
memset(buf+m, '\0', sizeof(buf)-m);
}
}
}
int parse_regexp_sub(char *re, char *from, char *to, int *g){
char *p, *q;
if(*re != '/') return -1;
re++;
p = re;
if((q = strchr(p, '/')) == 0)
return -1;
strcpy(from, p);
from[q-p] = '\0';
p = q+1;
if((q = strchr(p, '/')) == 0)
return -1;
strcpy(to, p);
to[q-p] = '\0';
if(*q != '/')
return -1;
if(*(q+1) == 'g')
*g = 1;
else
*g = 0;
return 0;
}
void outputreplace(char *text, char *s, char *e, char *to){
int i, j;
for(i=0; *(to+i) != '\0'; ++i)
;
for(j=0; *(e+j) != '\n'; ++j)
;
write(1, text, s-text);
write(1, to, i);
write(1, e, j+1);
}
char *replacebegin(char *re, char *text);
char *replacestar(int c, char *re, char *text);
int replace(char *from, char *to, char *text){
char *bak,*s,*e;
bak = text;
if(from[0] == '^'){
s = text;
e = replacebegin(from+1, text);
outputreplace(bak, s, e, to);
return 1;
}
do{ // must look at empty string
s = text;
if((e = replacebegin(from, text)) != 0){
outputreplace(bak, s, e, to);
return 1;
}
}while(*text++ != '\0');
return 0;
}
// replacebegin: search for re at beginning of text
char *replacebegin(char *re, char *text){
if(re[0] == '\0'){
return text;
}
if(re[1] == '*'){
return replacestar(re[0], re+2, text);
}
if(re[0] == '$' && re[1] == '\0'){
if(*text == '\0')
return text;
else
return 0;
}
if(*text!='\0' && (re[0]=='.' || re[0]==*text)){
return replacebegin(re+1, text+1);
}
return 0;
}
// replacestar: search for c*re at beginning of text
char *replacestar(int c, char *re, char *text){
char *tmp;
do{ // a * replacees zero or more instances
if(tmp = replacebegin(re, text))
return tmp;
}while(*text!='\0' && (*text++==c || c=='.'));
return 0;
}
// substitute line
void sed_substitute(int fd, int start, int end, char *re){
int n, m, l, g;
char *p, *q;
char from[128], to[128];
if(parse_regexp_sub(re, from, to, &g) < 0){
fprintf(stderr, "sed: unknown regexp\n");
exit(1);
}
m = 0;
l = 0;
while((n = read(fd, buf+m, sizeof(buf)-m-1)) >0 ){
buf[m+n]=0;
m += n;
p = buf;
while((q = strchr(p, '\n')) != 0){
l++;
*q = 0;
if(!isrange(start, end, l)){
*q = '\n';
write(1, p, q+1-p);
}else{
*q = '\n';
if(replace(from, to, p)){
// write in replace
}else{
write(1, p, q+1-p);
}
}
p = q+1;
}
if(p == buf)
m=0;
if(m > 0){
m -= p - buf;
memmove(buf, p, m);
memset(buf+m, '\0', sizeof(buf)-m);
}
}
}
// append, insert
void sed_insert_append(int flg, int fd, int start, int end, char *txt);
void sed_insert(int fd, int start, int end, char *txt){
sed_insert_append(0, fd, start, end, txt);
}
void sed_append(int fd, int start, int end, char *txt){
sed_insert_append(1, fd, start, end, txt);
}
// flg
// 0 -> insert
// 1 -> append
void sed_insert_append(int flg, int fd, int start, int end, char *txt){
int i, n, m, l, g;
char *p, *q;
for(i=0; *(txt+i) != '\0'; ++i)
;
*(txt+i) = '\n';
i++;
m = 0;
l = 0;
while((n = read(fd, buf+m, sizeof(buf)-m-1)) >0 ){
buf[m+n]=0;
m += n;
p = buf;
while((q = strchr(p, '\n')) != 0){
l++;
*q = 0;
if(!isrange(start, end, l)){
*q = '\n';
write(1, p, q+1-p);
}else{
*q = '\n';
if(flg == 0)
write(1, txt, i);
write(1, p, q+1-p);
if(flg == 1)
write(1, txt, i);
}
p = q+1;
}
if(p == buf)
m=0;
if(m > 0){
m -= p - buf;
memmove(buf, p, m);
memset(buf+m, '\0', sizeof(buf)-m);
}
}
}
|
the_stack_data/12638499.c | /*Escribir un programa C que procese el archivo “numeros.txt” sobre sí mismo (sin crear
archivos intermedios y sin subir el archivo a memoria). El procesamiento consiste en leer
grupos de 4 caracteres hexadecimales y reemplazarlos por los correspondientes dígitos
decimales (que representen el mismo número leído pero en decimal). */
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
// Supongo que la cantidad total es multiplo de 4.
bool leerNumeros(char* string, unsigned int *puntero, FILE* archivo) {
fseek(archivo,*puntero,SEEK_SET);
void *r = fgets(string,4+1,archivo);
*puntero = ftell(archivo);
return ( r!=NULL );
}
void cargar_numeros(char* string, unsigned int* puntero, FILE* archivo) {
fseek(archivo, *puntero, SEEK_SET);
fputs(string, archivo);
*puntero = ftell(archivo);
}
void generar_decimal(char* hexa, char* decimal) {
char *end;
long int intAux = strtol(hexa,&end,16);
char aux[6] = {0};
sprintf(aux,"%ld",intAux);
strcpy(decimal,"");
for (size_t i = 0; i < (5 - strlen(aux)); i++) {
strcat(decimal,"0");
}
strcat(decimal, aux);
}
int main(int argc, char* argv[]) {
int puntero_lec = 0;
int puntero_esc = 0;
FILE* archivo = fopen("numeritos.txt","r+");
if(archivo == NULL) return -1;
char decibuff[6];
char hexabuff[5];
char* end;
fseek(archivo, 0, SEEK_END);
unsigned int originalFileSize = ftell(archivo);
int newSize = (originalFileSize/4)*5; //Pasamos de representar con 4 a representar con 5.
ftruncate(fileno(archivo),newSize); // Agrando el archivo
//tengo que escribir de atras para adelante asi no sobrescribo nada util.
puntero_esc = newSize - 5; // voy a ir escribiendo de a 5.
puntero_lec = originalFileSize-4; //Voy a ir leyendo de a 4
while (puntero_lec >=0) {
fseek(archivo,puntero_lec,SEEK_SET);
leerNumeros(hexabuff, &puntero_lec, archivo);
puntero_lec-=8;
generar_decimal(hexabuff, decibuff);
fseek(archivo,puntero_esc,SEEK_SET);
cargar_numeros(decibuff, &puntero_esc, archivo);
puntero_esc-=10;
}
fclose(archivo);
return 0;
} |
the_stack_data/153590.c | //---- LGPL --------------------------------------------------------------------
//
// Copyright (C) Stichting Deltares, 2011-2016.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation version 2.1.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// contact: [email protected]
// Stichting Deltares
// P.O. Box 177
// 2600 MH Delft, The Netherlands
//
// All indications and logos of, and references to, "Delft3D" and "Deltares"
// are registered trademarks of Stichting Deltares, and remain the property of
// Stichting Deltares. All rights reserved.
//
//------------------------------------------------------------------------------
// $Id: main.c 5717 2016-01-12 11:35:24Z mourits $
// $HeadURL: https://svn.oss.deltares.nl/repos/delft3d/tags/6686/src/utils_lgpl/deltares_common/tests/06_inifiles_test/main.c $
/*
* Wrapper for FORTRAN main program: MDVER
*
* [email protected]
* [email protected]
* 07 may 2004
*/
#if HAVE_CONFIG_H
# include "config.h"
# define STDCALL /* nothing */
# define TEST FC_FUNC(test,TEST)
#else
/* WIN32 */
# define STDCALL /* nothing */
# define TEST TEST
#endif
#if defined (__cplusplus)
extern "C" {
#endif
extern void STDCALL TEST ( void );
#if defined (__cplusplus)
}
#endif
int
main (
int argc,
char * argv[],
char * envp[]
) {
TEST ();
}
|
the_stack_data/204573.c | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <CL/cl.h>
unsigned char *read_buffer(char *file_name, size_t *size_ptr)
{
FILE *f;
unsigned char *buf;
size_t size;
/* Open file */
f = fopen(file_name, "rb");
if (!f)
return NULL;
/* Obtain file size */
fseek(f, 0, SEEK_END);
size = ftell(f);
fseek(f, 0, SEEK_SET);
/* Allocate and read buffer */
buf = malloc(size + 1);
fread(buf, 1, size, f);
buf[size] = '\0';
/* Return size of buffer */
if (size_ptr)
*size_ptr = size;
/* Return buffer */
return buf;
}
void write_buffer(char *file_name, const char *buffer, size_t buffer_size)
{
FILE *f;
/* Open file */
f = fopen(file_name, "w+");
/* Write buffer */
if(buffer)
fwrite(buffer, 1, buffer_size, f);
/* Close file */
fclose(f);
}
int main(int argc, char const *argv[])
{
/* Get platform */
cl_platform_id platform;
cl_uint num_platforms;
cl_int ret = clGetPlatformIDs(1, &platform, &num_platforms);
if (ret != CL_SUCCESS)
{
printf("error: call to 'clGetPlatformIDs' failed\n");
exit(1);
}
printf("Number of platforms: %d\n", num_platforms);
printf("platform=%p\n", platform);
/* Get platform name */
char platform_name[100];
ret = clGetPlatformInfo(platform, CL_PLATFORM_NAME, sizeof(platform_name), platform_name, NULL);
if (ret != CL_SUCCESS)
{
printf("error: call to 'clGetPlatformInfo' failed\n");
exit(1);
}
printf("platform.name='%s'\n\n", platform_name);
/* Get device */
cl_device_id device;
cl_uint num_devices;
ret = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 1, &device, &num_devices);
if (ret != CL_SUCCESS)
{
printf("error: call to 'clGetDeviceIDs' failed\n");
exit(1);
}
printf("Number of devices: %d\n", num_devices);
printf("device=%p\n", device);
/* Get device name */
char device_name[100];
ret = clGetDeviceInfo(device, CL_DEVICE_NAME, sizeof(device_name),
device_name, NULL);
if (ret != CL_SUCCESS)
{
printf("error: call to 'clGetDeviceInfo' failed\n");
exit(1);
}
printf("device.name='%s'\n", device_name);
printf("\n");
/* Create a Context Object */
cl_context context;
context = clCreateContext(NULL, 1, &device, NULL, NULL, &ret);
if (ret != CL_SUCCESS)
{
printf("error: call to 'clCreateContext' failed\n");
exit(1);
}
printf("context=%p\n", context);
/* Create a Command Queue Object*/
cl_command_queue command_queue;
command_queue = clCreateCommandQueue(context, device, 0, &ret);
if (ret != CL_SUCCESS)
{
printf("error: call to 'clCreateCommandQueue' failed\n");
exit(1);
}
printf("command_queue=%p\n", command_queue);
printf("\n");
/* Program source */
unsigned char *source_code;
size_t source_length;
/* Read program from 'tgamma_float2.cl' */
source_code = read_buffer("tgamma_float2.cl", &source_length);
/* Create a program */
cl_program program;
program = clCreateProgramWithSource(context, 1, (const char **)&source_code, &source_length, &ret);
if (ret != CL_SUCCESS)
{
printf("error: call to 'clCreateProgramWithSource' failed\n");
exit(1);
}
printf("program=%p\n", program);
/* Build program */
ret = clBuildProgram(program, 1, &device, NULL, NULL, NULL);
if (ret != CL_SUCCESS )
{
size_t size;
char *log;
/* Get log size */
clGetProgramBuildInfo(program, device, CL_PROGRAM_BUILD_LOG,0, NULL, &size);
/* Allocate log and print */
log = malloc(size);
clGetProgramBuildInfo(program, device, CL_PROGRAM_BUILD_LOG,size, log, NULL);
printf("error: call to 'clBuildProgram' failed:\n%s\n", log);
/* Free log and exit */
free(log);
exit(1);
}
printf("program built\n");
printf("\n");
/* Create a Kernel Object */
cl_kernel kernel;
kernel = clCreateKernel(program, "tgamma_float2", &ret);
if (ret != CL_SUCCESS)
{
printf("error: call to 'clCreateKernel' failed\n");
exit(1);
}
/* Create and allocate host buffers */
size_t num_elem = 10;
/* Create and init host side src buffer 0 */
cl_float2 *src_0_host_buffer;
src_0_host_buffer = malloc(num_elem * sizeof(cl_float2));
for (int i = 0; i < num_elem; i++)
src_0_host_buffer[i] = (cl_float2){{2.0, 2.0}};
/* Create and init device side src buffer 0 */
cl_mem src_0_device_buffer;
src_0_device_buffer = clCreateBuffer(context, CL_MEM_READ_ONLY, num_elem * sizeof(cl_float2), NULL, &ret);
if (ret != CL_SUCCESS)
{
printf("error: could not create source buffer\n");
exit(1);
}
ret = clEnqueueWriteBuffer(command_queue, src_0_device_buffer, CL_TRUE, 0, num_elem * sizeof(cl_float2), src_0_host_buffer, 0, NULL, NULL);
if (ret != CL_SUCCESS)
{
printf("error: call to 'clEnqueueWriteBuffer' failed\n");
exit(1);
}
/* Create host dst buffer */
cl_float2 *dst_host_buffer;
dst_host_buffer = malloc(num_elem * sizeof(cl_float2));
memset((void *)dst_host_buffer, 1, num_elem * sizeof(cl_float2));
/* Create device dst buffer */
cl_mem dst_device_buffer;
dst_device_buffer = clCreateBuffer(context, CL_MEM_WRITE_ONLY, num_elem *sizeof(cl_float2), NULL, &ret);
if (ret != CL_SUCCESS)
{
printf("error: could not create dst buffer\n");
exit(1);
}
/* Set kernel arguments */
ret = CL_SUCCESS;
ret |= clSetKernelArg(kernel, 0, sizeof(cl_mem), &src_0_device_buffer);
ret |= clSetKernelArg(kernel, 1, sizeof(cl_mem), &dst_device_buffer);
if (ret != CL_SUCCESS)
{
printf("error: call to 'clSetKernelArg' failed\n");
exit(1);
}
/* Launch the kernel */
size_t global_work_size = num_elem;
size_t local_work_size = num_elem;
ret = clEnqueueNDRangeKernel(command_queue, kernel, 1, NULL, &global_work_size, &local_work_size, 0, NULL, NULL);
if (ret != CL_SUCCESS)
{
printf("error: call to 'clEnqueueNDRangeKernel' failed\n");
exit(1);
}
/* Wait for it to finish */
clFinish(command_queue);
/* Read results from GPU */
ret = clEnqueueReadBuffer(command_queue, dst_device_buffer, CL_TRUE,0, num_elem * sizeof(cl_float2), dst_host_buffer, 0, NULL, NULL);
if (ret != CL_SUCCESS)
{
printf("error: call to 'clEnqueueReadBuffer' failed\n");
exit(1);
}
/* Dump dst buffer to file */
char dump_file[100];
sprintf((char *)&dump_file, "%s.result", argv[0]);
write_buffer(dump_file, (const char *)dst_host_buffer, num_elem * sizeof(cl_float2));
printf("Result dumped to %s\n", dump_file);
/* Free host dst buffer */
free(dst_host_buffer);
/* Free device dst buffer */
ret = clReleaseMemObject(dst_device_buffer);
if (ret != CL_SUCCESS)
{
printf("error: call to 'clReleaseMemObject' failed\n");
exit(1);
}
/* Free host side src buffer 0 */
free(src_0_host_buffer);
/* Free device side src buffer 0 */
ret = clReleaseMemObject(src_0_device_buffer);
if (ret != CL_SUCCESS)
{
printf("error: call to 'clReleaseMemObject' failed\n");
exit(1);
}
/* Release kernel */
ret = clReleaseKernel(kernel);
if (ret != CL_SUCCESS)
{
printf("error: call to 'clReleaseKernel' failed\n");
exit(1);
}
/* Release program */
ret = clReleaseProgram(program);
if (ret != CL_SUCCESS)
{
printf("error: call to 'clReleaseProgram' failed\n");
exit(1);
}
/* Release command queue */
ret = clReleaseCommandQueue(command_queue);
if (ret != CL_SUCCESS)
{
printf("error: call to 'clReleaseCommandQueue' failed\n");
exit(1);
}
/* Release context */
ret = clReleaseContext(context);
if (ret != CL_SUCCESS)
{
printf("error: call to 'clReleaseContext' failed\n");
exit(1);
}
return 0;
} |
the_stack_data/104827664.c | #include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <sys/syscall.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <stdint.h>
#include <pthread.h>
#include <time.h>
#include <poll.h>
#include <sys/eventfd.h>
#include <linux/userfaultfd.h>
typedef unsigned int bool;
#define BIT(nr) (1ULL << (nr))
#define UFFD_BUFFER_PAGES (1024)
enum test_name {
TEST_MISSING = 0,
TEST_WP,
};
static size_t page_size;
static enum test_name test_name;
static void *uffd_buffer;
static size_t uffd_buffer_size;
static int uffd_handle;
static pthread_t uffd_thread;
static int uffd_quit = -1;
static int uffd_shmem;
static void uffd_test_usage(const char *name)
{
puts("");
printf("usage: %s <missing|wp> [shmem]\n", name);
puts("");
puts(" missing:\tdo page miss test");
puts(" wp: \tdo page write-protect test");
puts(" shmem: \tuse shmem");
puts("");
exit(0);
}
static int uffd_handle_init(void)
{
struct uffdio_api api_struct = { 0 };
uint64_t ioctl_mask = BIT(_UFFDIO_REGISTER) | BIT(_UFFDIO_UNREGISTER);
int ufd = syscall(__NR_userfaultfd, O_CLOEXEC | O_NONBLOCK);
if (ufd == -1) {
printf("%s: UFFD not supported", __func__);
return -1;
}
api_struct.api = UFFD_API;
/*
* For MISSING tests, we don't need any feature bit since it's on
* by default.
*/
if (test_name == TEST_WP) {
api_struct.features = UFFD_FEATURE_PAGEFAULT_FLAG_WP;
}
if (ioctl(ufd, UFFDIO_API, &api_struct)) {
printf("%s: UFFDIO_API failed\n", __func__);
return -1;
}
if ((api_struct.ioctls & ioctl_mask) != ioctl_mask) {
printf("%s: Missing userfault feature\n", __func__);
return -1;
}
uffd_handle = ufd;
return 0;
}
static void *uffd_bounce_thread(void *data)
{
int uffd = (int) (uint64_t) data;
int served_pages = 0;
struct pollfd fds[2] = {
{ .fd = uffd, .events = POLLIN | POLLERR | POLLHUP },
{ .fd = uffd_quit, .events = POLLIN | POLLERR | POLLHUP },
};
printf("%s: thread created\n", __func__);
while (1) {
struct uffd_msg msg;
ssize_t len;
int ret;
ret = poll(fds, 2, -1);
if (ret < 0) {
printf("%s: poll() got error: %d\n", ret);
break;
}
if (fds[1].revents) {
printf("Thread detected quit signal\n");
break;
}
len = read(uffd, &msg, sizeof(msg));
if (len == 0) {
/* Main thread tells us to quit */
break;
}
if (len < 0) {
printf("%s: read() failed on uffd: %d\n", __func__, -errno);
break;
}
if (msg.event != UFFD_EVENT_PAGEFAULT) {
printf("%s: unknown message: %d\n", __func__, msg.event);
continue;
}
if (test_name == TEST_WP) {
struct uffdio_writeprotect wp = { 0 };
if (!(msg.arg.pagefault.flags & UFFD_PAGEFAULT_FLAG_WP)) {
printf("%s: WP flag not detected in PF flags"
"for address 0x%llx\n", __func__,
msg.arg.pagefault.address);
continue;
}
wp.range.start = msg.arg.pagefault.address;
wp.range.len = page_size;
/* Undo write-protect, do wakeup after that */
wp.mode = 0;
if (ioctl(uffd, UFFDIO_WRITEPROTECT, &wp)) {
printf("%s: Unset WP failed for address 0x%llx\n",
__func__, msg.arg.pagefault.address);
continue;
}
printf("%s: Detected WP for page 0x%llx, recovered\n",
__func__, msg.arg.pagefault.address);
} else if (test_name == TEST_MISSING) {
struct uffdio_zeropage zero = { 0 };
zero.range.start = msg.arg.pagefault.address;
zero.range.len = page_size;
if (ioctl(uffd, UFFDIO_ZEROPAGE, &zero)) {
printf("%s: zero page failed for address 0x%llx\n",
__func__, msg.arg.pagefault.address);
continue;
}
printf("%s: Detected missing page 0x%llx, recovered\n",
__func__, msg.arg.pagefault.address);
}
served_pages++;
}
printf("%s: thread quitted\n", __func__);
return NULL;
}
static int uffd_do_register(void)
{
int uffd = uffd_handle;
struct uffdio_register reg = { 0 };
reg.range.start = (uint64_t) uffd_buffer;
reg.range.len = (uint64_t) uffd_buffer_size;
if (test_name == TEST_WP) {
reg.mode = UFFDIO_REGISTER_MODE_WP;
} else if (test_name == TEST_MISSING) {
reg.mode = UFFDIO_REGISTER_MODE_MISSING;
}
if (ioctl(uffd, UFFDIO_REGISTER, ®)) {
printf("%s: UFFDIO_REGISTER failed: %d\n", __func__, -errno);
return -1;
}
if (test_name == TEST_WP && !(reg.ioctls & BIT(_UFFDIO_WRITEPROTECT))) {
printf("%s: wr-protect feature missing\n", __func__);
return -1;
}
printf("uffd register completed\n");
return 0;
}
static int uffd_test_init(void)
{
int flags = MAP_ANONYMOUS;
uffd_quit = eventfd(0, 0);
assert(uffd_buffer == NULL);
page_size = getpagesize();
uffd_buffer_size = page_size * UFFD_BUFFER_PAGES;
if (uffd_shmem) {
flags |= MAP_SHARED;
} else {
flags |= MAP_PRIVATE;
}
uffd_buffer = mmap(NULL, uffd_buffer_size, PROT_READ | PROT_WRITE,
flags, -1, 0);
if (uffd_buffer == MAP_FAILED) {
printf("map() failed: %s\n", strerror(errno));
return -1;
}
if ((uint64_t)uffd_buffer & (page_size - 1)) {
printf("mmap() returned unaligned address\n");
return -1;
}
if (uffd_handle_init()) {
return -1;
}
if (uffd_do_register()) {
return -1;
}
if (pthread_create(&uffd_thread, NULL,
uffd_bounce_thread, (void *)(uint64_t)uffd_handle)) {
printf("pthread_create() failed: %s\n", strerror(errno));
return -1;
}
printf("uffd buffer pages: %u\n", UFFD_BUFFER_PAGES);
printf("uffd buffer size: %zu\n", uffd_buffer_size);
printf("uffd buffer address: %p\n", uffd_buffer);
return 0;
}
enum {
WP_PREFAULT_NONE = 0,
WP_PREFAULT_READ,
WP_PREFAULT_WRITE,
WP_PREFAULT_MAX,
};
char *wp_prefault_str[WP_PREFAULT_MAX] = {
"no-prefault", "read-prefault", "write-prefault"
};
int uffd_do_write_protect(void)
{
struct uffdio_writeprotect wp;
int i;
char buf, *ptr;
/*
* Pre-fault the region randomly. For each page, we choose one of
* the three options:
*
* (1) do nothing; this will keep the PTE empty
* (2) read once; this will trigger on-demand paging to fill in
* the zero page PFN into PTE
* (3) write once; this will trigger the on-demand paging to fill
* in a real page PFN into PTE
*/
for (i = 0; i < UFFD_BUFFER_PAGES; i++) {
int x = random() % 3;
printf("prefaulting the page %d by %s\n", i, wp_prefault_str[x]);
ptr = uffd_buffer + i * page_size;
switch (x) {
case WP_PREFAULT_READ:
buf = *ptr;
break;
case WP_PREFAULT_WRITE:
*ptr = 1;
break;
default:
/* Do nothing */
break;
}
}
wp.range.start = (uint64_t) uffd_buffer;
wp.range.len = (uint64_t) uffd_buffer_size;
wp.mode = UFFDIO_WRITEPROTECT_MODE_WP;
if (ioctl(uffd_handle, UFFDIO_WRITEPROTECT, &wp)) {
printf("%s: Failed to do write protect\n", __func__);
return -1;
}
printf("uffd marking write protect completed\n");
return 0;
}
void uffd_test_stop(void)
{
void *retval;
uint64_t val = 1;
/* Tell the thread to go */
printf("Telling the thread to quit\n");
write(uffd_quit, &val, 8);
pthread_join(uffd_thread, &retval);
close(uffd_handle);
uffd_handle = 0;
munmap(uffd_buffer, uffd_buffer_size);
uffd_buffer = NULL;
close(uffd_quit);
uffd_quit = -1;
}
void uffd_test_loop(void)
{
int i;
unsigned int *ptr;
for (i = 0; i < UFFD_BUFFER_PAGES; i++) {
printf("writting to page %d\n", i);
ptr = uffd_buffer + i * page_size;
*ptr = i;
}
}
int uffd_test_wp(void)
{
if (uffd_do_write_protect()) {
return -1;
}
uffd_test_loop();
return 0;
}
int uffd_test_missing(void)
{
uffd_test_loop();
return 0;
}
int uffd_type_parse(const char *type)
{
if (!type) {
return 0;
}
if (!strcmp(type, "shmem")) {
uffd_shmem = 1;
printf("Using shmem\n");
} else {
printf("Unknown type: %s\n", type);
return -1;
}
return 0;
}
int main(int argc, char *argv[])
{
int ret = 0;
const char *cmd, *type = NULL;
srand(time(NULL));
if (argc < 2) {
uffd_test_usage(argv[0]);
}
cmd = argv[1];
if (argc > 2) {
type = argv[2];
}
if (!strcmp(cmd, "missing")) {
test_name = TEST_MISSING;
} else if (!strcmp(cmd, "wp")) {
test_name = TEST_WP;
} else {
uffd_test_usage(argv[0]);
}
if (uffd_type_parse(type)) {
return -1;
}
if (uffd_test_init()) {
return -1;
}
switch (test_name) {
case TEST_MISSING:
ret = uffd_test_missing();
break;
case TEST_WP:
ret = uffd_test_wp();
break;
}
uffd_test_stop();
return ret;
}
|
the_stack_data/232954970.c | #include <pthread.h>
// xij : flow from ti to tj
int x12;
int x13;
int x21;
int x23;
int x31;
int x32;
int y;
int z;
void assert(int);
void t1() {
assert(z == 0); // pass
x12 = 1;
x13 = 1;
x21 = 0;
x31 = 0;
assert(x21 == 0); // fail
assert(x31 == 0); // fail
}
void t2() {
assert(z == 0); // pass
x21 = 1;
x23 = 1;
x12 = 0;
x32 = 0;
assert(x12 == 0); // fail
assert(x32 == 0); // fail
}
void t3() {
assert(z == 0); // pass
x31 = 1;
x32 = 1;
x13 = 0;
x23 = 0;
assert(x13 == 0); // fail
assert(x23 == 0); // fail
}
void bar() {
pthread_t t;
pthread_create(&t, NULL, t2, NULL);
z = 0;
}
void foo() {
pthread_t t;
pthread_create(&t, NULL, t1, NULL);
bar();
}
void main() {
pthread_t t;
z = 0;
foo();
pthread_create(&t, NULL, t3, NULL);
}
|
the_stack_data/50137505.c | #include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
// Size of vectors
int n = 50000;
// Size, in bytes, of each vector
size_t bytes = n*sizeof(float);
// Allocate memory for input vectors
float *a = (float*)malloc(bytes);
float *b = (float*)malloc(bytes);
// Allocate memory for result vector
float *c = (float*)malloc(bytes);
// Initialize input vectors
int i;
for(i=0; i<n; i++) {
a[i] = 1;
b[i] = 3;
}
// Do the addition
for(i=0; i<n; i++){
c[i] = a[i] + b[i];
}
// Sum up result vector and print result divided by n, this should equal 4
float sum = 0;
for(i=0; i<n; i++) {
sum += c[i];
}
sum = sum / n;
printf("final result: %f\n", sum);
// Release memory
free(a);
free(b);
free(c);
return 0;
} |
the_stack_data/107952314.c | #include<stdio.h>
#define N 7
int main()
{
int t1[10]={0},t2[10]={0},x[10]={0},num[10]={0};
int i=0,j=0,k=0,max=0,flag=0;
for(i=0;i<N;i++)
scanf("%d %d",&t1[i],&t2[i]);
for(i=0;i<N;i++)
{
if(t1[i]+t2[i]>=10)
{
num[j]=i;
j++;
flag=1;
}
}
if(flag==1)
{
max=0;
for(k=0;k<j;k++)
{
if(x[max]<x[k])
max=k;
}
printf("%d\n",num[max]+1);
}
if(flag==0)
printf("0\n");
return 0;
}
|
the_stack_data/90762808.c | #ifdef DEBUG
/*
* plugin_dump.c
*/
#include "private.h"
#include "lub/dump.h"
#include "lub/list.h"
#include "clish/plugin.h"
/*--------------------------------------------------------- */
void clish_sym_dump(const clish_sym_t *this)
{
char *type = NULL;
lub_dump_printf("sym(%p)\n", this);
lub_dump_indent();
lub_dump_printf("name : %s\n", LUB_DUMP_STR(this->name));
lub_dump_printf("func : %p\n", LUB_DUMP_STR(this->func));
switch (this->type) {
case CLISH_SYM_TYPE_NONE:
type = "none";
break;
case CLISH_SYM_TYPE_ACTION:
type = "action";
break;
case CLISH_SYM_TYPE_ACCESS:
type = "access";
break;
case CLISH_SYM_TYPE_CONFIG:
type = "config";
break;
case CLISH_SYM_TYPE_LOG:
type = "log";
break;
default:
type = "unknown";
break;
}
lub_dump_printf("type : %s\n", type);
lub_dump_printf("permanent : %s\n", LUB_DUMP_BOOL(this->permanent));
lub_dump_printf("expand : %s\n", LUB_DUMP_TRI(this->expand));
lub_dump_printf("plugin : %p\n", this->plugin);
lub_dump_undent();
}
/*--------------------------------------------------------- */
void clish_plugin_dump(const clish_plugin_t *this)
{
lub_list_node_t *iter;
clish_sym_t *sym;
lub_dump_printf("plugin(%p)\n", this);
lub_dump_indent();
lub_dump_printf("name : %s\n", LUB_DUMP_STR(this->name));
lub_dump_printf("alias : %s\n", LUB_DUMP_STR(this->alias));
lub_dump_printf("conf : %s\n", LUB_DUMP_STR(this->conf));
lub_dump_printf("dlhan : %p\n", this->dlhan);
lub_dump_printf("init : %p\n", this->init);
lub_dump_printf("fini : %p\n", this->fini);
lub_dump_printf("rtld_global : %s\n", LUB_DUMP_BOOL(this->rtld_global));
lub_dump_indent();
/* Iterate child elements */
for(iter = lub_list__get_head(this->syms);
iter; iter = lub_list_node__get_next(iter)) {
sym = (clish_sym_t *)lub_list_node__get_data(iter);
clish_sym_dump(sym);
}
lub_dump_undent();
lub_dump_undent();
}
/*--------------------------------------------------------- */
#endif /* DEBUG */
|
the_stack_data/37638876.c | // vim:noexpandtab:ts=4:sts=4:
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <time.h>
#include <errno.h>
#include <string.h>
#define ONEMEG 1048576
void _gigs_log(char * message) {
time_t rawtime;
struct tm *timeinfo;
char timebuf[256];
time(&rawtime);
timeinfo = localtime(&rawtime);
strftime(timebuf, 256, "%Y-%m-%dT%H:%M:%S%z", timeinfo);
printf("time=\"%s\" pid=%d msg=\"%s\"\n", timebuf, getpid(), message);
}
int main(int argc, char *argv[]) {
double amt;
double n = 1.0;
unsigned long i;
char msgbuf[32];
char *membuf;
if (argc > 1) {
n = atof((const char *)argv[1]);
}
sprintf(msgbuf, "allocating %.2fGB", n);
_gigs_log(msgbuf);
if (NULL == (membuf = malloc((int)(sizeof(char) * (ONEMEG * 1024 * n))))) {
int err = errno;
_gigs_log("malloc failed");
return 1;
}
_gigs_log("filling buffer");
for (i = 0; i < (ONEMEG * 1024 * n); i++) {
membuf[i] = 'z';
}
_gigs_log("exiting");
return 0;
}
|
the_stack_data/950475.c | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* dictionary.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: angmarti <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/08/21 14:03:37 by angmarti #+# #+# */
/* Updated: 2021/08/22 14:39:44 by angmarti ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
// #include <sys/types.h>
// #include <sys/stat.h>
typedef struct s_entry
{
unsigned long num;
char *str;
} t_entry;
typedef struct s_dict
{
char *path;
int buff;
int size;
t_entry *entries;
} t_dict;
// Returns the size (bytes) of the archive whose name is passed as parameter
int calc_dict_buff(char *str)
{
int fd;
int ret;
char buf[6910000 + 1];
fd = open(str, O_RDONLY);
if (fd == -1)
return (-1);
ret = read(fd, buf, 6910000);
if (close(fd) == -1)
return (-1);
return (ret);
}
// TODO: Reserves the memory space needed for the array t_dict.entries.
//
// Before doing this, it will be necessary to count the number of entries and
// reserve space using maloc:
//
// a) n * sizeof(t_entry) +1 bytes
// The +1 is in order to place \0 inside the last position
// I'm not sure about this.
//
// b) n * sizeof(t_entry) bytes
//
//
//
// It is needed to be able to detect the lines of the file and check if they
// have or not a entry. This could be easely done with an atoi funtion:
// if it dectects a number, it means the line is valid entry.
//
// Also, the function has to store the number of entries (n) into t_dict.size
t_entry *entries_malloc(t_dict dict)
{
}
// TODO: same as atoi but it has to get the string value of the number
t_entry a_to_entry(t_dict dict)
{
}
// TODO: Using a_to_entry gives values to the dict.entries array
// Preferably descendant order
void create_entries(t_dict dict)
{
}
int main(void)
{
t_dict dict;
dict.path = "numbers.dict";
dict.buff = calc_dict_buff(dict.path);
create_entries(dict);
return (0);
}
|
the_stack_data/342802.c | /* strtod_l is considered a GNU extension.
* It will fail if the correct prototype does not exist. */
#define _GNU_SOURCE 1
#include <stdlib.h>
#if (defined(_MSC_VER) && _MSC_VER >= 1400)
#include <locale.h>
_locale_t getCLocale()
{
static int init = 0;
static _locale_t loc;
if (!init) {
loc = _create_locale(LC_NUMERIC, "C");
init = 1;
}
return loc;
}
double om_strtod(const char *nptr, char **endptr)
{
return _strtod_l(nptr, endptr, getCLocale());
}
#elif (defined(__GLIBC__) && defined(__GLIBC_MINOR__) && ((__GLIBC__ << 16) + __GLIBC_MINOR__ >= (2 << 16) + 3)) || defined(__APPLE_CC__)
#if defined(__GLIBC__)
#include <locale.h>
#elif defined(__APPLE_CC__)
#include <xlocale.h>
#include <locale.h>
#endif
locale_t getCLocale()
{
static int init = 0;
static locale_t loc;
if (!init) {
loc = newlocale(LC_NUMERIC, "C", NULL);
init = 1;
}
return loc;
}
double om_strtod(const char *nptr, char **endptr)
{
return strtod_l(nptr, endptr, getCLocale());
}
#else
double om_strtod(const char *nptr, char **endptr)
{
/* Default to just assuming we have the correct locale */
return strtod(nptr, endptr);
}
#endif
|
the_stack_data/1076664.c | /*
*
* A test for the patch "Allow compaction of unevictable pages".
* With this patch we should be able to allocate at least 1/4
* of RAM in huge pages. Without the patch much less is
* allocated.
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/resource.h>
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
#include <string.h>
#define MAP_SIZE 1048576
struct map_list {
void *map;
struct map_list *next;
};
int read_memory_info(unsigned long *memfree, unsigned long *hugepagesize)
{
char buffer[256] = {0};
char *cmd = "cat /proc/meminfo | grep -i memfree | grep -o '[0-9]*'";
FILE *cmdfile = popen(cmd, "r");
if (!(fgets(buffer, sizeof(buffer), cmdfile))) {
perror("Failed to read meminfo\n");
return -1;
}
pclose(cmdfile);
*memfree = atoll(buffer);
cmd = "cat /proc/meminfo | grep -i hugepagesize | grep -o '[0-9]*'";
cmdfile = popen(cmd, "r");
if (!(fgets(buffer, sizeof(buffer), cmdfile))) {
perror("Failed to read meminfo\n");
return -1;
}
pclose(cmdfile);
*hugepagesize = atoll(buffer);
return 0;
}
int prereq(void)
{
char allowed;
int fd;
fd = open("/proc/sys/vm/compact_unevictable_allowed",
O_RDONLY | O_NONBLOCK);
if (fd < 0) {
perror("Failed to open\n"
"/proc/sys/vm/compact_unevictable_allowed\n");
return -1;
}
if (read(fd, &allowed, sizeof(char)) != sizeof(char)) {
perror("Failed to read from\n"
"/proc/sys/vm/compact_unevictable_allowed\n");
close(fd);
return -1;
}
close(fd);
if (allowed == '1')
return 0;
return -1;
}
int check_compaction(unsigned long mem_free, unsigned int hugepage_size)
{
int fd;
int compaction_index = 0;
char initial_nr_hugepages[10] = {0};
char nr_hugepages[10] = {0};
/* We want to test with 80% of available memory. Else, OOM killer comes
in to play */
mem_free = mem_free * 0.8;
fd = open("/proc/sys/vm/nr_hugepages", O_RDWR | O_NONBLOCK);
if (fd < 0) {
perror("Failed to open /proc/sys/vm/nr_hugepages");
return -1;
}
if (read(fd, initial_nr_hugepages, sizeof(initial_nr_hugepages)) <= 0) {
perror("Failed to read from /proc/sys/vm/nr_hugepages");
goto close_fd;
}
/* Start with the initial condition of 0 huge pages*/
if (write(fd, "0", sizeof(char)) != sizeof(char)) {
perror("Failed to write 0 to /proc/sys/vm/nr_hugepages\n");
goto close_fd;
}
lseek(fd, 0, SEEK_SET);
/* Request a large number of huge pages. The Kernel will allocate
as much as it can */
if (write(fd, "100000", (6*sizeof(char))) != (6*sizeof(char))) {
perror("Failed to write 100000 to /proc/sys/vm/nr_hugepages\n");
goto close_fd;
}
lseek(fd, 0, SEEK_SET);
if (read(fd, nr_hugepages, sizeof(nr_hugepages)) <= 0) {
perror("Failed to re-read from /proc/sys/vm/nr_hugepages\n");
goto close_fd;
}
/* We should have been able to request at least 1/3 rd of the memory in
huge pages */
compaction_index = mem_free/(atoi(nr_hugepages) * hugepage_size);
if (compaction_index > 3) {
printf("No of huge pages allocated = %d\n",
(atoi(nr_hugepages)));
fprintf(stderr, "ERROR: Less that 1/%d of memory is available\n"
"as huge pages\n", compaction_index);
goto close_fd;
}
printf("No of huge pages allocated = %d\n",
(atoi(nr_hugepages)));
if (write(fd, initial_nr_hugepages, strlen(initial_nr_hugepages))
!= strlen(initial_nr_hugepages)) {
perror("Failed to write value to /proc/sys/vm/nr_hugepages\n");
goto close_fd;
}
close(fd);
return 0;
close_fd:
close(fd);
printf("Not OK. Compaction test failed.");
return -1;
}
int main(int argc, char **argv)
{
struct rlimit lim;
struct map_list *list, *entry;
size_t page_size, i;
void *map = NULL;
unsigned long mem_free = 0;
unsigned long hugepage_size = 0;
unsigned long mem_fragmentable = 0;
if (prereq() != 0) {
printf("Either the sysctl compact_unevictable_allowed is not\n"
"set to 1 or couldn't read the proc file.\n"
"Skipping the test\n");
return 0;
}
lim.rlim_cur = RLIM_INFINITY;
lim.rlim_max = RLIM_INFINITY;
if (setrlimit(RLIMIT_MEMLOCK, &lim)) {
perror("Failed to set rlimit:\n");
return -1;
}
page_size = getpagesize();
list = NULL;
if (read_memory_info(&mem_free, &hugepage_size) != 0) {
printf("ERROR: Cannot read meminfo\n");
return -1;
}
mem_fragmentable = mem_free * 0.8 / 1024;
while (mem_fragmentable > 0) {
map = mmap(NULL, MAP_SIZE, PROT_READ | PROT_WRITE,
MAP_ANONYMOUS | MAP_PRIVATE | MAP_LOCKED, -1, 0);
if (map == MAP_FAILED)
break;
entry = malloc(sizeof(struct map_list));
if (!entry) {
munmap(map, MAP_SIZE);
break;
}
entry->map = map;
entry->next = list;
list = entry;
/* Write something (in this case the address of the map) to
* ensure that KSM can't merge the mapped pages
*/
for (i = 0; i < MAP_SIZE; i += page_size)
*(unsigned long *)(map + i) = (unsigned long)map + i;
mem_fragmentable--;
}
for (entry = list; entry != NULL; entry = entry->next) {
munmap(entry->map, MAP_SIZE);
if (!entry->next)
break;
entry = entry->next;
}
if (check_compaction(mem_free, hugepage_size) == 0)
return 0;
return -1;
}
|
the_stack_data/187643852.c | int checkprime(int num){
if(num<=1) return 0;
for(int i=2;i<=num>>1;i++){
if(num%i==0) return 0;
}
return 1;
} |
the_stack_data/126703990.c | // RUN: %crabllvm -O0 --crab-dom=zones --crab-check=assert --crab-sanity-checks "%s" 2>&1 | OutputCheck %s
// CHECK: ^1 Number of total safe checks$
// CHECK: ^0 Number of total error checks$
// CHECK: ^0 Number of total warning checks$
extern void __CRAB_assert(int);
extern void __SEAHORN_error(int);
int main (){
int x,y,i;
x=0;
y=0;
for (i=0;i< 10;i++) {
x++;
y++;
}
__CRAB_assert(x==y);
return x+y;
}
|
the_stack_data/100140286.c | /**
* 7. 本章计算UPC校验位的方法最后几步是:
* 把总的结果减去1,相减后的结果除以10取余数,用9减去余数。
*
* 换成下面的步骤也可以:
* 总的结果除以10取余数,用10减去余数。
*
* 这样做为什么可行?
*/
#include <stdio.h>
int main(void)
{
int d, i1, i2, i3, i4, i5, j1, j2, j3, j4, j5, first_sum, second_sum, total;
printf("Enter the first (single) digit: ");
scanf("%1d", &d);
printf("Enter first group of five digits: ");
scanf("%1d%1d%1d%1d%1d", &i1, &i2, &i3, &i4, &i5);
printf("Enter second group of five digits: ");
scanf("%1d%1d%1d%1d%1d", &j1, &j2, &j3, &j4, &j5);
first_sum = d + i2 + i4 + j1 + j3 + j5;
second_sum = i1 + i3 + i5 + j2 + j4;
total = 3 * first_sum + second_sum;
// printf("Check digit: %d\n", 9 - ((total - 1) % 10));
printf("Check digit: %d\n", 10 - (total % 10));
return 0;
}
/**
* 证明:
*
* 9-((x-1)%10)
* = 9-{(x-1)-floor((x-1)/10)*10}
* = 9-(x-1)+floor((x-1)/10)*10
* = 9-x+1+floor((x-1)/10)*10
* = 10-x+floor((x-1)/10)*10
* = 10-x+floor(x/10-1/10)*10 [1] 式
*
* 10-(x%10)
* = 10-[x-floor(x/10)*10]
* = 10-x+floor(x/10)*10 [2] 式
*
* 心里很没底地说:
* floor(x/10-1/10)
* 与
* floor(x/10)
* 相等.
*/
|
the_stack_data/100648.c |
void fs_csr(int n, int* rowPtr, int* colIdx, double* val, double *b, double *x)
{
int i,j,tmp;
for(i=0;i<n;i++) {
tmp = b[i];
for (j=rowPtr[i]; j<rowPtr[i+1]-1;j++) {
tmp -= val[j]*x[colIdx[j]];
}
x[i] = tmp / val[rowPtr[i+1]-1];
}
}
|
the_stack_data/211080823.c | /* Copyright (c) Piotr Durlej
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE 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.
*/
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
static void pdiag(pid_t pid, char *s)
{
if (pid >= 0)
printf("%s() = %i\n", s, pid);
else
perror(s);
}
int main(void)
{
pdiag(getpgrp(), "getpgrp");
pdiag(setsid(), "setsid");
pdiag(getpgrp(), "getpgrp");
return 0;
}
|
the_stack_data/145453023.c | #include <stdio.h>
#include <stdlib.h>
#include <omp.h>
#include <unistd.h>
#define N 1000
int main()
{
int n_threads, i;
/*
Schedule allows you to create the scheme with which
the threads distribute the work of an iteration of a cycle.
"guided": It has a scheduling policy very similar to dynamic mode,
except that the chunk size changes during program execution.
*/
#pragma omp parallel for private(i) schedule(guided) num_threads(4)
for(i=0; i<N; i++)
{
//wait i second
sleep(i);
printf("The thread %d has completed the iteration %d\n", omp_get_thread_num(), i);
}
printf("All threads have ended!!\n");
return 0;
}
|
the_stack_data/148578651.c | /*
* Copyright (C) 2019-2020 Alibaba Group Holding Limited
*/
#ifndef CONFIG_SEC_CRYPTO_SHA_SW
#ifdef CONFIG_CSI_V2
#include "sec_mcu.h"
#include "sec_crypto_common.h"
/**
\brief Initialize SHA Interface. Initializes the resources needed for the SHA interface
*/
uint32_t sc_sha_init(sc_sha_t *sha, uint32_t idx)
{
csi_error_t ret;
CHECK_PARAM(sha, SC_PARAM_INV);
ret = csi_sha_init(&sha->csi_sha, idx);
if (ret) {
return SC_DRV_FAILED;
}
return SC_OK;
}
/**
\brief De-initialize SHA Interface. stops operation and releases the software resources used by the interface
*/
void sc_sha_uninit(sc_sha_t *sha)
{
if (sha) {
csi_sha_uninit(&sha->csi_sha);
memset(sha, 0, sizeof(sc_sha_t));
}
}
/**
\brief attach the callback handler to SHA
*/
uint32_t sc_sha_attach_callback(sc_sha_t *sha, void *callback, void *arg)
{
return SC_NOT_SUPPORT;
}
/**
\brief detach the callback handler
*/
void sc_sha_detach_callback(sc_sha_t *sha)
{
return;
}
/**
\brief start the engine
*/
uint32_t sc_sha_start(sc_sha_t *sha, sc_sha_context_t *context, sc_sha_mode_t mode)
{
uint32_t ret;
CHECK_PARAM(context, SC_PARAM_INV);
CHECK_PARAM(sha, SC_PARAM_INV);
ret = csi_sha_start(&sha->csi_sha, &context->ctx, mode);
if (ret) {
return SC_CRYPT_FAIL;
}
return SC_OK;
}
/**
\brief update the engine
*/
uint32_t sc_sha_update(sc_sha_t *sha, sc_sha_context_t *context, const void *input, uint32_t size)
{
uint32_t ret;
CHECK_PARAM(sha, SC_PARAM_INV);
CHECK_PARAM(context, SC_PARAM_INV);
CHECK_PARAM(input, SC_PARAM_INV);
ret = csi_sha_update(&sha->csi_sha, &context->ctx, input, size);
if (ret) {
return SC_CRYPT_FAIL;
}
return SC_OK;
}
/**
\brief accumulate the engine (async mode)
*/
uint32_t sc_sha_update_async(sc_sha_t *sha, sc_sha_context_t *context, const void *input,
uint32_t size)
{
return SC_NOT_SUPPORT;
}
/**
\brief finish the engine
*/
uint32_t sc_sha_finish(sc_sha_t *sha, sc_sha_context_t *context, void *output, uint32_t *out_size)
{
uint32_t ret;
CHECK_PARAM(sha, SC_PARAM_INV);
CHECK_PARAM(context, SC_PARAM_INV);
CHECK_PARAM(output, SC_PARAM_INV);
ret = csi_sha_finish(&sha->csi_sha, &context->ctx, output, out_size);
if (ret) {
return SC_CRYPT_FAIL;
}
return SC_OK;
}
#endif
#endif |
the_stack_data/232956568.c | #include<stdio.h>
#include<time.h>
#define MAX 2000
char array[MAX+1];
int main() {
clock_t start, end;
double time;
start = clock();
int i = 2, j;
for (; i <= MAX; i++) {
array[i] = 1;
}
for (i = 2; i <= MAX; i++) {
if (array[i]) {
for ( j = i; j * i <= MAX; j++) {
array[j * i] = 0;
}
}
}
end = clock();
for (i = 2; i <= MAX; i++) {
if (array[i]) {
printf("%d\n", i);
}
}
time = (double)(end - start) / CLOCKS_PER_SEC;
printf("%lfs", time);
return 0;
}
|
the_stack_data/90761798.c | #include <stdio.h>
#include <fenv.h>
#include <math.h>
#include <float.h>
#define _show_exc(x) printf(#x "=%s;", fetestexcept(x) ? "ON" : "OFF")
#pragma STDC FENV_ACCESS ON
void show_exc(void)
{
_show_exc(FE_DIVBYZERO);
_show_exc(FE_INEXACT);
_show_exc(FE_INVALID);
_show_exc(FE_OVERFLOW);
_show_exc(FE_UNDERFLOW);
puts("");
}
void show_round(void)
{
int r = fegetround();
char * rs;
switch (r) {
case FE_TONEAREST:
rs = "FE_TONEAREST";
break;
case FE_UPWARD:
rs = "FE_UPWARD";
break;
case FE_DOWNWARD:
rs = "FE_DOWNWARD";
break;
case FE_TOWARDZERO:
rs = "FE_TOWARDZERO";
break;
default:
rs = "unknown";
}
printf("Rounding=%s\n\n", rs);
}
//compile: gcc fenv_environment.c -lm
int main(void)
{
//exposes statuses of the current floating-point exceptions and rounding settings
show_exc();
show_round();
//save the environment state
fenv_t env;
fegetenv(& env);
//change the rounding setting and provoke some exceptions to raise
fesetround(FE_TOWARDZERO);
float x = 1.f, y = 0.f;
printf("%f\n", x / y);
printf("%f\n", sqrtf(-x));
//print the current state
show_exc();
show_round();
//update the environment (raised exceptions remain unchanged)
feupdateenv( & env);
show_exc();
show_round();
//restore the whole previous environment
fesetenv(&env);
show_exc();
show_round();
return 0;
} |
the_stack_data/126286.c | #include <stdio.h>
#include <stdbool.h>
int main(void) {
int p, i, primes[50], primeIndex = 2;
bool isPrime;
primes[0] = 2;
primes[1] = 3;
for ( p = 5; p <= 100; p = p + 2 ) {
isPrime = true;
for ( i = 1; isPrime && p / primes[i] >= primes[i]; ++i ) {
if ( p % primes[i] == 0 )
isPrime = false;
}
if ( isPrime == true ) {
primes[primeIndex] = p;
++primeIndex;
}
}
for ( i = 0; i < primeIndex; ++i )
printf ( "%i ", primes[i]);
printf ( "\n" );
return 0;
}
|
the_stack_data/190768552.c | /*Exercise 3 - Repetition
Write a C program to calculate the sum of the numbers from 1 to n.
Where n is a keyboard input.
e.g.
n -> 100
sum = 1+2+3+....+ 99+100 = 5050
n -> 1-
sum = 1+2+3+...+10 = 55 */
#include <stdio.h>
int main() {
int n,x;
int sum = 0;
printf("input a number - ");
scanf ("%d",&n);
for(x=0 ; x<=n ; x++)
{
sum = sum + x;
}
printf("%d",sum);
return 0;
}
|
the_stack_data/151988.c | /*
Buatlah program perhitungan uang kursus.
Biaya Pokok Kursus :
1. Bahasa Inggris = 1 Juta
2. Bahasa Prancis = 2 Juta
3. Bahasa Jepang = 3 Juta
4. Bahasa Arab = 4 Juta
5. Bahasa Cina 5 Juta
Biaya modul pelatihan sebesar 25% dari biaya pokok kursus.
Biaya administrasi sebesar 15% dari biaya pokok kursus.
Biaya kotor = Pokok + Modul + Administrasi.
Pajak 2,5% dari total biaya kotor.
Hitung uang kursus bersih yang harus dibayarkan.
Uang bersih = Pajak + Kotor
Input Nama, No Anggota, Kursus, dan dihitung.
*/
#include <stdio.h>
void main (){
// Deklarasi Variabel
char nama[15], no_anggota[8], ulang;
int kursus;
float harga_kursus, modul, admin, kotor, pajak, bersih;
// Mulai Programnya
mulai: // Label untuk menandakan dimulainya program
/*
Membuat perulangan do while
supaya bisa mengulang programnya jika sudah selesai
*/
do {
// Input Blocks
system("cls"); // Bersihkan layar
puts("==========Progam Kursus==========");
printf("\nJenis kursus yang tersedia :");
printf("\n1. Bahasa Inggris");
printf("\n2. Bahasa Prancis");
printf("\n3. Bahasa Jepang");
printf("\n4. Bahasa Arab");
printf("\n5. Bahasa Cina\n");
fflush(stdin); // Bersihkan stdin
printf("\nMasukkan Nama : "); gets(nama);
printf("Masukkan No Anggota : "); gets(no_anggota);
printf("Jenis Kursus yang diinginkan (1-5) : "); scanf("%i", &kursus);
fflush(stdin); // Bersihkan stdin
// Output Blocks
system("cls"); // Bersihkan layar
puts("===========Data Kursus==========");
printf("\nNama : %s", nama);
printf("\nNo Anggota : %s", no_anggota);
printf("\n");
/*
Memasukkan harga dan nama tiap kursusnya
berdasarkan nomor kursus yang diinput
*/
switch(kursus){
case 1 :
harga_kursus = 1000000;
printf("\nNama Kursus : Bahasa Inggris");
break;
case 2 :
harga_kursus = 2000000;
printf("\nNama Kursus : Bahasa Prancis");
break;
case 3 :
harga_kursus = 3000000;
printf("\nNama Kursus : Bahasa Jepang");
break;
case 4 :
harga_kursus = 4000000;
printf("\nNama Kursus : Bahasa Arab");
break;
case 5 :
harga_kursus = 5000000;
printf("\nNama Kursus : Bahasa Cina");
break;
default :
system("cls"); // Bersihkan layar
puts("===========Progam Kursus==========");
printf("\nKursus tidak ditemukan!");
printf("\nIngin mengulangi lagi (y/n)? ");scanf("%c", &ulang);
// Jika ulang = Y atau ulang = Y
if (ulang == 'Y' || ulang == 'y'){
system("cls"); // Bersihkan layar
goto mulai;
// Jika ulang = selain Y atau y
}else{
exit(main); // Exit dari fungsi main
}
}
/*
Menghitung biaya-biaya
2,5% = 0.025
15% = 0.15
25% = 0.25
*/
modul = 0.25 * harga_kursus;
admin = 0.15 * harga_kursus;
kotor = harga_kursus + modul + admin;
pajak = 0.025 * kotor;
bersih = pajak + kotor;
// Menampilkan hasil perhitungan
printf("\nBiaya Kursus : Rp. %2.f", harga_kursus);
printf("\nBiaya Modul : Rp. %2.f", modul);
printf("\nBiaya Administrasi : Rp. %2.f", admin);
printf("\n");
printf("\nSub Total : Rp. %2.f", kotor);
printf("\nPajak : Rp. %2.f", pajak);
printf("\n");
printf("\nYang harus dibayarkan : Rp. %2.f", bersih);
printf("\n");
printf("\nApakah kamu ingin mengulangi program (y/n)? ");scanf("%c", &ulang);
}
// Jika ulang = Y atau ulang = Y
while (ulang == 'y' || ulang == 'Y');
}
|
the_stack_data/138042.c | #include <stdlib.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
int set_zero(int x) {
int r = x & 0xFF;
printf("0x%x\n", r);
return r;
}
int set_reverse(int x) {
int r = x ^ ~0xFF;
printf("0x%x\n", r);
return r;
}
int set_last_byte(int x) {
int r = x | 0xFF;
printf("0x%x\n", r);
return r;
}
int equal(int x, int y) {
return !(x ^ y);
}
int main(int argc, char** argv) {
// int w, x;
// while (scanf("%x", &x) != EOF) {
// set_zero(x);
// set_reverse(x);
// set_last_byte(x);
// }
int x = 0x66, y = 0x66;
int res = equal(x, y);
if (res) {
printf("x is equal to y\n");
} else {
printf("x is not equal to y\n");
}
printf("x & y = 0x%x\n", x & y);
printf("x | y = 0x%x\n", x | y);
printf("~x | ~y = 0x%x\n", ~x | ~y);
printf("x & !y = 0x%x\n", x & !y);
printf("x && y = 0x%x\n", x && y);
printf("x || y = 0x%x\n", x || y);
printf("!x || !y = 0x%x\n", !x || !y);
printf("x && ~y = 0x%x\n", x && ~y);
return 0;
}
|
the_stack_data/215768946.c | /*
Programacao de Computadores e Algoritmos
Trabalho1
questão 3.9
Equipe: Evandro Fernandes
Fernando Antonio
Jailson Pereira
Jessica Kelly
Jhon Lucas
Juliany Raiol
Wilson Neto
Raí Santos
*/
#include <stdio.h>
int main(int argc, const char *argv[])
{
int i;
for(i=1;i<=50;i++)
{
if( (i%2) ) printf("%d\n",i);
}
return 0;
}
|
the_stack_data/32950639.c | #include <stdio.h>
/*
To build and execute this program, perform the following Linux commands.
$ gcc helloworld.c
$ ./a.out
*/
int main() {
printf("Hello World!\n");
return 0;
}
|
the_stack_data/82949105.c | #include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
#include <signal.h>
int main(void)
{
struct sigaction action;
action.sa_handler = SIG_IGN;
action.sa_flags = 0;
sigemptyset(&action.sa_mask);
sigaction(SIGCHLD, &action, NULL);
pid_t pid;
int i, n, status;
for (i=1; i<=3; i++) {
pid=fork();
if (pid == 0){
printf("CHILD no. %d (PID=%d) working ... \n",i,getpid());
sleep(i*7); // child working ...
printf("CHILD no. %d (PID=%d) exiting ... \n",i,getpid());
exit(0);
}
}
for (i=1 ;i<=4; i++ ) {
printf("PARENT: working hard (task no. %d) ...\n",i);
n=20; while((n=sleep(n))!=0);
printf("PARENT: end of task no. %d\n",i);
printf("PARENT: waiting for child no. %d ...\n",i);
}
exit(0);
} |
the_stack_data/219827.c | /*
* Copyright 2020 u-blox Ltd
*
* 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.
*/
/* Only #includes of u_* and the C standard library are allowed here,
* no platform stuff and no OS stuff. Anything required from
* the platform/OS must be brought in through u_port* to maintain
* portability.
*/
/** @file
* @brief Tests for the GNSS info API: these should pass on all
* platforms that have a GNSS module connected to them. They
* are only compiled if U_CFG_TEST_GNSS_MODULE_TYPE is defined.
* IMPORTANT: see notes in u_cfg_test_platform_specific.h for the
* naming rules that must be followed when using the U_PORT_TEST_FUNCTION()
* macro.
*/
#ifdef U_CFG_TEST_GNSS_MODULE_TYPE
# ifdef U_CFG_OVERRIDE
# include "u_cfg_override.h" // For a customer's configuration override
# endif
#include "stdlib.h" // malloc()/free()
#include "stddef.h" // NULL, size_t etc.
#include "stdint.h" // int32_t etc.
#include "stdbool.h"
#include "string.h" // memset()
#include "u_cfg_sw.h"
#include "u_cfg_os_platform_specific.h"
#include "u_cfg_app_platform_specific.h"
#include "u_cfg_test_platform_specific.h"
#include "u_error_common.h"
#include "u_port.h"
#include "u_port_debug.h"
#include "u_port_os.h" // Required by u_gnss_private.h
#include "u_port_uart.h"
#include "u_gnss_module_type.h"
#include "u_gnss_type.h"
#include "u_gnss.h"
#include "u_gnss_info.h"
#include "u_gnss_private.h"
#include "u_gnss_test_private.h"
/* ----------------------------------------------------------------
* COMPILE-TIME MACROS
* -------------------------------------------------------------- */
#ifndef U_GNSS_INFO_TEST_VERSION_SIZE_MAX_BYTES
/** The maximum size of a version string we test.
*/
# define U_GNSS_INFO_TEST_VERSION_SIZE_MAX_BYTES 1024
#endif
#ifndef U_GNSS_TEST_MIN_UTC_TIME
/** A minimum value for UTC time to test against (21 July 2021 13:40:36).
*/
# define U_GNSS_TEST_MIN_UTC_TIME 1626874836
#endif
#ifndef U_GNSS_TIME_TEST_TIMEOUT_SECONDS
/** The timeout on establishing UTC time.
*/
#define U_GNSS_TIME_TEST_TIMEOUT_SECONDS 180
#endif
/* ----------------------------------------------------------------
* TYPES
* -------------------------------------------------------------- */
/* ----------------------------------------------------------------
* VARIABLES
* -------------------------------------------------------------- */
/** Handles.
*/
static uGnssTestPrivate_t gHandles = U_GNSS_TEST_PRIVATE_DEFAULTS;
/* ----------------------------------------------------------------
* STATIC FUNCTIONS
* -------------------------------------------------------------- */
/* ----------------------------------------------------------------
* PUBLIC FUNCTIONS
* -------------------------------------------------------------- */
/** Pull static info from a GNSS chip.
*/
U_PORT_TEST_FUNCTION("[gnssInfo]", "gnssInfoStatic")
{
int32_t gnssHandle;
int32_t heapUsed;
char *pBuffer;
int32_t y;
size_t z;
char *pTmp;
size_t iterations;
uGnssTransportType_t transportTypes[U_GNSS_TRANSPORT_MAX_NUM];
// In case a previous test failed
uGnssTestPrivateCleanup(&gHandles);
// Obtain the initial heap size
heapUsed = uPortGetHeapFree();
// Repeat for all transport types
iterations = uGnssTestPrivateTransportTypesSet(transportTypes, U_CFG_APP_GNSS_UART);
for (size_t w = 0; w < iterations; w++) {
// Do the standard preamble
uPortLog("U_GNSS_INFO_TEST: testing on transport %s...\n",
pGnssTestPrivateTransportTypeName(transportTypes[w]));
U_PORT_TEST_ASSERT(uGnssTestPrivatePreamble(U_CFG_TEST_GNSS_MODULE_TYPE,
transportTypes[w], &gHandles, true,
U_CFG_APP_CELL_PIN_GNSS_POWER,
U_CFG_APP_CELL_PIN_GNSS_DATA_READY) == 0);
gnssHandle = gHandles.gnssHandle;
// So that we can see what we're doing
uGnssSetUbxMessagePrint(gnssHandle, true);
pBuffer = (char *) malloc(U_GNSS_INFO_TEST_VERSION_SIZE_MAX_BYTES);
U_PORT_TEST_ASSERT(pBuffer != NULL);
// Ask for firmware version string with insufficient storage
memset(pBuffer, 0x66, U_GNSS_INFO_TEST_VERSION_SIZE_MAX_BYTES);
y = uGnssInfoGetFirmwareVersionStr(gnssHandle, pBuffer, 0);
U_PORT_TEST_ASSERT(y == 0);
for (size_t x = 0; x < U_GNSS_INFO_TEST_VERSION_SIZE_MAX_BYTES; x++) {
U_PORT_TEST_ASSERT(*(pBuffer + x) == 0x66);
}
y = uGnssInfoGetFirmwareVersionStr(gnssHandle, pBuffer, 1);
U_PORT_TEST_ASSERT(y == 0);
U_PORT_TEST_ASSERT(*pBuffer == 0);
for (size_t x = 1; x < U_GNSS_INFO_TEST_VERSION_SIZE_MAX_BYTES; x++) {
U_PORT_TEST_ASSERT(*(pBuffer + x) == 0x66);
}
// Now with hopefully sufficient storage
y = uGnssInfoGetFirmwareVersionStr(gnssHandle, pBuffer,
U_GNSS_INFO_TEST_VERSION_SIZE_MAX_BYTES);
U_PORT_TEST_ASSERT(y > 0);
U_PORT_TEST_ASSERT(y < U_GNSS_INFO_TEST_VERSION_SIZE_MAX_BYTES);
for (size_t x = y + 1; x < U_GNSS_INFO_TEST_VERSION_SIZE_MAX_BYTES; x++) {
U_PORT_TEST_ASSERT(*(pBuffer + x) == 0x66);
}
// The string returned contains multiple lines separated by more than one
// null terminator; try to print it nicely here.
uPortLog("U_GNSS_INFO_TEST: GNSS chip version string is:\n");
pTmp = pBuffer;
while (pTmp < pBuffer + y) {
z = strlen(pTmp);
if (z > 0) {
uPortLog("U_GNSS_INFO_TEST: \"%s\".\n", pTmp);
pTmp += z;
} else {
pTmp++;
}
}
// Ask for the chip ID string with insufficient storage
memset(pBuffer, 0x66, U_GNSS_INFO_TEST_VERSION_SIZE_MAX_BYTES);
y = uGnssInfoGetIdStr(gnssHandle, pBuffer, 0);
U_PORT_TEST_ASSERT(y == 0);
for (size_t x = 0; x < U_GNSS_INFO_TEST_VERSION_SIZE_MAX_BYTES; x++) {
U_PORT_TEST_ASSERT(*(pBuffer + x) == 0x66);
}
y = uGnssInfoGetIdStr(gnssHandle, pBuffer, 1);
U_PORT_TEST_ASSERT(y == 0);
U_PORT_TEST_ASSERT(*pBuffer == 0);
for (size_t x = 1; x < U_GNSS_INFO_TEST_VERSION_SIZE_MAX_BYTES; x++) {
U_PORT_TEST_ASSERT(*(pBuffer + x) == 0x66);
}
// Now with hopefully sufficient storage
y = uGnssInfoGetIdStr(gnssHandle, pBuffer, U_GNSS_INFO_TEST_VERSION_SIZE_MAX_BYTES);
U_PORT_TEST_ASSERT(y > 0);
U_PORT_TEST_ASSERT(y < U_GNSS_INFO_TEST_VERSION_SIZE_MAX_BYTES);
uPortLog("U_GNSS_INFO_TEST: GNSS chip ID string is 0x");
for (size_t x = 0; x < y; x++) {
uPortLog("%02x", *(pBuffer + x));
}
uPortLog(".\n");
for (size_t x = y + 1; x < U_GNSS_INFO_TEST_VERSION_SIZE_MAX_BYTES; x++) {
U_PORT_TEST_ASSERT(*(pBuffer + x) == 0x66);
}
// Free memory
free(pBuffer);
// Do the standard postamble, leaving the module on for the next
// test to speed things up
uGnssTestPrivatePostamble(&gHandles, false);
}
// Check for memory leaks
heapUsed -= uPortGetHeapFree();
uPortLog("U_GNSS_INFO_TEST: we have leaked %d byte(s).\n", heapUsed);
// heapUsed < 0 for the Zephyr case where the heap can look
// like it increases (negative leak)
U_PORT_TEST_ASSERT(heapUsed <= 0);
}
/** Read time from GNSS.
*/
U_PORT_TEST_FUNCTION("[gnssInfo]", "gnssInfoTime")
{
int32_t gnssHandle;
int32_t heapUsed;
int64_t y = -1;
int64_t startTimeMs;
size_t iterations;
uGnssTransportType_t transportTypes[U_GNSS_TRANSPORT_MAX_NUM];
// In case a previous test failed
uGnssTestPrivateCleanup(&gHandles);
// Obtain the initial heap size
heapUsed = uPortGetHeapFree();
// Repeat for all transport types
iterations = uGnssTestPrivateTransportTypesSet(transportTypes, U_CFG_APP_GNSS_UART);
for (size_t w = 0; w < iterations; w++) {
// Do the standard preamble
uPortLog("U_GNSS_INFO_TEST: testing on transport %s...\n",
pGnssTestPrivateTransportTypeName(transportTypes[w]));
U_PORT_TEST_ASSERT(uGnssTestPrivatePreamble(U_CFG_TEST_GNSS_MODULE_TYPE,
transportTypes[w], &gHandles, true,
U_CFG_APP_CELL_PIN_GNSS_POWER,
U_CFG_APP_CELL_PIN_GNSS_DATA_READY) == 0);
gnssHandle = gHandles.gnssHandle;
// So that we can see what we're doing
uGnssSetUbxMessagePrint(gnssHandle, true);
// Ask for time, allowing a few tries in case the GNSS receiver
// has not yet found time
uPortLog("U_GNSS_INFO_TEST: waiting up to %d second(s) to establish UTC time...\n",
U_GNSS_TIME_TEST_TIMEOUT_SECONDS);
startTimeMs = uPortGetTickTimeMs();
while ((y < 0) &&
(uPortGetTickTimeMs() < startTimeMs + (U_GNSS_TIME_TEST_TIMEOUT_SECONDS * 1000))) {
y = uGnssInfoGetTimeUtc(gnssHandle);
}
if (y > 0) {
uPortLog("U_GNSS_INFO_TEST: UTC time according to GNSS is %d"
" (took %d second(s) to establish).\n", (int32_t) y,
(int32_t) (uPortGetTickTimeMs() - startTimeMs) / 1000);
} else {
uPortLog("U_GNSS_INFO_TEST: could not get UTC time from GNSS"
" after %d second(s) (%d).\n",
(int32_t) (uPortGetTickTimeMs() - startTimeMs) / 1000,
(int32_t) y);
}
U_PORT_TEST_ASSERT(y > U_GNSS_TEST_MIN_UTC_TIME);
// Do the standard postamble, leaving the module on for the next
// test to speed things up
uGnssTestPrivatePostamble(&gHandles, false);
}
// Check for memory leaks
heapUsed -= uPortGetHeapFree();
uPortLog("U_GNSS_INFO_TEST: we have leaked %d byte(s).\n", heapUsed);
// heapUsed < 0 for the Zephyr case where the heap can look
// like it increases (negative leak)
U_PORT_TEST_ASSERT(heapUsed <= 0);
}
#endif // #ifdef U_CFG_TEST_GNSS_MODULE_TYPE
// End of file
|
the_stack_data/57951142.c | // general protection fault in perf_iterate_sb
// https://syzkaller.appspot.com/bug?id=634af935e3b85784d3e413726bb782279a967699
// status:open
// autogenerated by syzkaller (https://github.com/google/syzkaller)
#define _GNU_SOURCE
#include <dirent.h>
#include <endian.h>
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
#include <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>
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;
}
#define BITMASK_LEN(type, bf_len) (type)((1ull << (bf_len)) - 1)
#define BITMASK_LEN_OFF(type, bf_off, bf_len) \
(type)(BITMASK_LEN(type, (bf_len)) << (bf_off))
#define STORE_BY_BITMASK(type, addr, val, bf_off, bf_len) \
if ((bf_off) == 0 && (bf_len) == 0) { \
*(type*)(addr) = (type)(val); \
} else { \
type new_val = *(type*)(addr); \
new_val &= ~BITMASK_LEN_OFF(type, (bf_off), (bf_len)); \
new_val |= ((type)(val)&BITMASK_LEN(type, (bf_len))) << (bf_off); \
*(type*)(addr) = new_val; \
}
static void kill_and_wait(int pid, int* status)
{
kill(-pid, SIGKILL);
kill(pid, SIGKILL);
int i;
for (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) {
}
}
#define SYZ_HAVE_SETUP_TEST 1
static void setup_test()
{
prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0);
setpgrp();
}
#define SYZ_HAVE_RESET_TEST 1
static void reset_test()
{
int fd;
for (fd = 3; fd < 30; fd++)
close(fd);
}
static void execute_one(void);
#define WAIT_FLAGS __WALL
static void loop(void)
{
int iter;
for (iter = 0;; iter++) {
int pid = fork();
if (pid < 0)
exit(1);
if (pid == 0) {
setup_test();
execute_one();
reset_test();
exit(0);
}
int status = 0;
uint64_t start = current_time_ms();
for (;;) {
if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid)
break;
sleep_ms(1);
if (current_time_ms() - start < 5 * 1000)
continue;
kill_and_wait(pid, &status);
break;
}
}
}
uint64_t r[1] = {0xffffffffffffffff};
void execute_one(void)
{
long res = 0;
*(uint32_t*)0x20000200 = 1;
*(uint32_t*)0x20000204 = 0x70;
*(uint8_t*)0x20000208 = 0;
*(uint8_t*)0x20000209 = 0;
*(uint8_t*)0x2000020a = 0;
*(uint8_t*)0x2000020b = 0;
*(uint32_t*)0x2000020c = 0;
*(uint64_t*)0x20000210 = 0;
*(uint64_t*)0x20000218 = 0;
*(uint64_t*)0x20000220 = 0;
STORE_BY_BITMASK(uint64_t, 0x20000228, 0, 0, 1);
STORE_BY_BITMASK(uint64_t, 0x20000228, 0, 1, 1);
STORE_BY_BITMASK(uint64_t, 0x20000228, 0, 2, 1);
STORE_BY_BITMASK(uint64_t, 0x20000228, 0, 3, 1);
STORE_BY_BITMASK(uint64_t, 0x20000228, 0, 4, 1);
STORE_BY_BITMASK(uint64_t, 0x20000228, 0, 5, 1);
STORE_BY_BITMASK(uint64_t, 0x20000228, 0, 6, 1);
STORE_BY_BITMASK(uint64_t, 0x20000228, 0, 7, 1);
STORE_BY_BITMASK(uint64_t, 0x20000228, 0, 8, 1);
STORE_BY_BITMASK(uint64_t, 0x20000228, 0, 9, 1);
STORE_BY_BITMASK(uint64_t, 0x20000228, 0, 10, 1);
STORE_BY_BITMASK(uint64_t, 0x20000228, 0, 11, 1);
STORE_BY_BITMASK(uint64_t, 0x20000228, 0, 12, 1);
STORE_BY_BITMASK(uint64_t, 0x20000228, 0, 13, 1);
STORE_BY_BITMASK(uint64_t, 0x20000228, 0, 14, 1);
STORE_BY_BITMASK(uint64_t, 0x20000228, 0, 15, 2);
STORE_BY_BITMASK(uint64_t, 0x20000228, 3, 17, 1);
STORE_BY_BITMASK(uint64_t, 0x20000228, 0, 18, 1);
STORE_BY_BITMASK(uint64_t, 0x20000228, 0, 19, 1);
STORE_BY_BITMASK(uint64_t, 0x20000228, 0, 20, 1);
STORE_BY_BITMASK(uint64_t, 0x20000228, 0, 21, 1);
STORE_BY_BITMASK(uint64_t, 0x20000228, 0, 22, 1);
STORE_BY_BITMASK(uint64_t, 0x20000228, 0, 23, 1);
STORE_BY_BITMASK(uint64_t, 0x20000228, 0, 24, 1);
STORE_BY_BITMASK(uint64_t, 0x20000228, 0, 25, 1);
STORE_BY_BITMASK(uint64_t, 0x20000228, 0, 26, 1);
STORE_BY_BITMASK(uint64_t, 0x20000228, 0, 27, 1);
STORE_BY_BITMASK(uint64_t, 0x20000228, 0, 28, 1);
STORE_BY_BITMASK(uint64_t, 0x20000228, 0, 29, 35);
*(uint32_t*)0x20000230 = 0;
*(uint32_t*)0x20000234 = 0;
*(uint64_t*)0x20000238 = 0;
*(uint64_t*)0x20000240 = 0;
*(uint64_t*)0x20000248 = 0;
*(uint64_t*)0x20000250 = 0;
*(uint32_t*)0x20000258 = 0;
*(uint32_t*)0x2000025c = 0;
*(uint64_t*)0x20000260 = 0;
*(uint32_t*)0x20000268 = 0;
*(uint16_t*)0x2000026c = 0;
*(uint16_t*)0x2000026e = 0;
res = syscall(__NR_perf_event_open, 0x20000200, -1, 0, -1, 0);
if (res != -1)
r[0] = res;
*(uint32_t*)0x20000000 = 5;
*(uint32_t*)0x20000004 = 0x70;
*(uint8_t*)0x20000008 = 0;
*(uint8_t*)0x20000009 = 0;
*(uint8_t*)0x2000000a = 0;
*(uint8_t*)0x2000000b = 0;
*(uint32_t*)0x2000000c = 0;
*(uint64_t*)0x20000010 = 0;
*(uint64_t*)0x20000018 = 0;
*(uint64_t*)0x20000020 = 0;
STORE_BY_BITMASK(uint64_t, 0x20000028, 0, 0, 1);
STORE_BY_BITMASK(uint64_t, 0x20000028, 0, 1, 1);
STORE_BY_BITMASK(uint64_t, 0x20000028, 0, 2, 1);
STORE_BY_BITMASK(uint64_t, 0x20000028, 0, 3, 1);
STORE_BY_BITMASK(uint64_t, 0x20000028, 0, 4, 1);
STORE_BY_BITMASK(uint64_t, 0x20000028, 0, 5, 1);
STORE_BY_BITMASK(uint64_t, 0x20000028, 0, 6, 1);
STORE_BY_BITMASK(uint64_t, 0x20000028, 0, 7, 1);
STORE_BY_BITMASK(uint64_t, 0x20000028, 0, 8, 1);
STORE_BY_BITMASK(uint64_t, 0x20000028, 0, 9, 1);
STORE_BY_BITMASK(uint64_t, 0x20000028, 0, 10, 1);
STORE_BY_BITMASK(uint64_t, 0x20000028, 0, 11, 1);
STORE_BY_BITMASK(uint64_t, 0x20000028, 0, 12, 1);
STORE_BY_BITMASK(uint64_t, 0x20000028, 0, 13, 1);
STORE_BY_BITMASK(uint64_t, 0x20000028, 0, 14, 1);
STORE_BY_BITMASK(uint64_t, 0x20000028, 0, 15, 2);
STORE_BY_BITMASK(uint64_t, 0x20000028, 0, 17, 1);
STORE_BY_BITMASK(uint64_t, 0x20000028, 0, 18, 1);
STORE_BY_BITMASK(uint64_t, 0x20000028, 0, 19, 1);
STORE_BY_BITMASK(uint64_t, 0x20000028, 0, 20, 1);
STORE_BY_BITMASK(uint64_t, 0x20000028, 0, 21, 1);
STORE_BY_BITMASK(uint64_t, 0x20000028, 0, 22, 1);
STORE_BY_BITMASK(uint64_t, 0x20000028, 0, 23, 1);
STORE_BY_BITMASK(uint64_t, 0x20000028, 0, 24, 1);
STORE_BY_BITMASK(uint64_t, 0x20000028, 0, 25, 1);
STORE_BY_BITMASK(uint64_t, 0x20000028, 0, 26, 1);
STORE_BY_BITMASK(uint64_t, 0x20000028, 0, 27, 1);
STORE_BY_BITMASK(uint64_t, 0x20000028, 0, 28, 1);
STORE_BY_BITMASK(uint64_t, 0x20000028, 0, 29, 35);
*(uint32_t*)0x20000030 = 0;
*(uint32_t*)0x20000034 = 2;
*(uint64_t*)0x20000038 = 0;
*(uint64_t*)0x20000040 = 1;
*(uint64_t*)0x20000048 = 0;
*(uint64_t*)0x20000050 = 0;
*(uint32_t*)0x20000058 = 0;
*(uint32_t*)0x2000005c = 0;
*(uint64_t*)0x20000060 = 0;
*(uint32_t*)0x20000068 = 0;
*(uint16_t*)0x2000006c = 0;
*(uint16_t*)0x2000006e = 0;
syscall(__NR_perf_event_open, 0x20000000, -1, 0, r[0], 0);
}
int main(void)
{
syscall(__NR_mmap, 0x20000000, 0x1000000, 3, 0x32, -1, 0);
for (procid = 0; procid < 6; procid++) {
if (fork() == 0) {
loop();
}
}
sleep(1000000);
return 0;
}
|
the_stack_data/29824538.c | #include <stdio.h>
long gcd(long, long);
int main() {
long x, y, hcf, lcm;
printf("Enter two integers\n");
scanf("%ld%ld", &x, &y);
hcf = gcd(x, y);
lcm = (x*y)/hcf;
printf("Greatest common divisor of %ld and %ld = %ld\n", x, y, hcf);
printf("Least common multiple of %ld and %ld = %ld\n", x, y, lcm);
return 0;
}
long gcd(long a, long b) {
if (b == 0) {
return a;
}
else {
return gcd(b, a % b);
}
} |
the_stack_data/152753.c | #include<stdio.h>
int n,s[50];
int main()
{
int i,j,k,t=0;
while (scanf("%d",&n),n!=-0)
{
for (i=0,j=0;i<n;i++)
{
scanf("%d",&s[i]);
j+=s[i];
}
j/=n;
for (i=0,k=0;i<n;i++)
{
if (s[i]>j)
k+=s[i]-j;
}
printf("Set #%d\n",++t);
printf("The minimum number of moves is %d.\n\n",k);
}
return 0;
}
|
the_stack_data/54824432.c | #ifdef COMMENT
Proprietary Rand Corporation, 1981.
Further distribution of this software
subject to the terms of the Rand
license agreement.
#endif
#include <stdio.h>
#include <strings.h>
extern FILE *popen ();
char *
pwd()
{
register FILE *pp;
static char curpath[128];
if((pp = popen("pwd", "r")) == NULL ||
fgets(curpath, sizeof curpath, pp) == NULL ||
pclose(pp) != 0) {
fprintf(stderr, "Can't find current directory!\n");
done(1);
}
*rindex(curpath, '\n') = 0; /* Zap the lf */
return curpath;
}
|
the_stack_data/193893766.c | #include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
struct Person
{
char *name;
int age;
int height;
int weight;
};
struct Person *person_create(char *name, int age, int height, int weight)
{
struct Person *newPerson = malloc(sizeof(struct Person));
assert(NULL != newPerson);
newPerson->name = strdup(name);
newPerson->age = age;
newPerson->height = height;
newPerson->weight = weight;
return newPerson;
}
void person_destroy(struct Person *personToDestroy)
{
assert(NULL != personToDestroy);
free(personToDestroy->name);
free(personToDestroy);
}
void person_print(struct Person *personToPrint)
{
printf("Name: %s\n", personToPrint->name);
printf("Age: %d\n", personToPrint->age);
printf("Height: %d\n", personToPrint->height);
printf("Weight: %d\n", personToPrint->weight);
}
int main(int argc, char *argv[])
{
// Create two persons.
struct Person *joe = person_create("Joe Alex",32, 64, 140);
struct Person *frank = person_create("Frank Blank", 20, 72, 180);
// Print the memory location of the person Joe.
printf("%s is at memory location %p\n", joe->name, joe);
// Print the memory location of the person Frank.
printf("%s is at memory location %p\n", frank->name, frank);
// Print data about Joe.
person_print(joe);
// Increase the age of Joe.
joe->age += 20;
// Print data about Joe again.
person_print(joe);
// Destroy the two previously created persons.
person_destroy(joe);
person_destroy(frank);
return EXIT_SUCCESS;
}
|
the_stack_data/90762943.c | #include <stdio.h>
int main()
{
printf("\nHello, world.\n");
int option, vote, vote_two;
int vote_joao, vote_maria, vote_ze, vote_gomes, vote_zureta;
vote_joao = vote_maria = vote_ze = vote_gomes = vote_zureta = 0;
do
{
printf("\n\n---------- Voting ----------\n\n");
printf("\n1 - To vote\n2 - Counting of votes\n3 - Exit\n");
printf("\nOption: ");
scanf("%i", &option);
printf("\n\n----------------------------\n\n");
switch (option)
{
case 1:
printf("\nTo city councilor.\n");
printf("\n111 - Joao do Frete\n222 - Maria da Pamonha\n333 - Ze da Farmacia\n444 - Para anular\n");
printf("\nVote: ");
scanf("%i", &vote);
switch (vote)
{
case 111:
vote_joao++;
break;
case 222:
vote_maria++;
break;
case 333:
vote_ze++;
break;
case 444:
printf("\nVote void.\n");
break;
default:
printf("\nInvalid vote.\n");
break;
}
printf("\nTo Mayor.\n");
printf("\n11 - Dr. Zureta\n22 - Mr. Gomes\n44 - Para anular\n");
printf("\nVote: ");
scanf("%i", &vote_two);
if ( vote_two == 11 )
{
vote_zureta++;
break;
}
if ( vote_two == 22 )
{
vote_gomes++;
break;
}
if ( vote_two == 44 )
{
printf("\nVote void.\n");
break;
}
else
{
printf("\nInvalid vote.\n");
break;
}
case 2:
printf("\n\n---------- Resulte ----------\n\n");
printf("To city councilor.\n");
printf("\nJoao do Frete: %i\nMaria da Pamonha: %i\nZe da Farmacia: %i\n", vote_joao, vote_maria, vote_ze);
printf("\n-----------------------------\n");
printf("\nTo Mayor.\n");
printf("\nDr. Zureta: %i\nMr. Gomes: %i\n", vote_zureta, vote_gomes);
break;
case 3:
printf("\nExiting...\n");
break;
default:
printf("\nInvalid Option");
break;
}
}
while ( option != 3 );
return 0;
} |
the_stack_data/63760.c | /*
* perror.c - print an error message on the standard error output
*/
/* $Id$ */
#include <errno.h>
#include <stdio.h>
#include <string.h>
void perror(const char* s)
{
if (s && *s)
{
(void)fputs(s, stderr);
(void)fputs(": ", stderr);
}
(void)fputs(strerror(errno), stderr);
(void)fputs("\n", stderr);
}
|
the_stack_data/44026.c | int write(int fd, const void *, int);
void exit(int);
void printf04d(int v) {
char s[4];
for (int i = 0; i < 4; i++) {
s[3 - i] = v % 10 + '0';
v /= 10;
}
write(1, s, 4);
}
int nume[52514];
int i;
int n;
int carry;
int digit;
int base;
int denom;
int first;
int main(int argc, char **argv) {
base = 10000;
for (n = 52500; n > 0; n -= 14) {
carry %= base;
digit = carry;
for (i = n - 1; i > 0; --i) {
denom = 2 * i - 1;
carry = carry * i + base * (first ? nume[i] : (base / 5));
nume[i] = carry % denom;
carry /= denom;
}
printf04d(digit + carry / base);
first = 1;
}
write(1, "\n", 1);
exit(0);
return 0;
}
|
the_stack_data/83226.c | /*
* Copyright 2016-2019 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
#include <openssl/e_os2.h>
#include <string.h>
#include <assert.h>
size_t SHA3_absorb(uint64_t A[5][5], const unsigned char *inp, size_t len,
size_t r);
void SHA3_squeeze(uint64_t A[5][5], unsigned char *out, size_t len, size_t r);
#if !defined(KECCAK1600_ASM) || !defined(SELFTEST)
/*
* Choose some sensible defaults
*/
#if !defined(KECCAK_REF) && !defined(KECCAK_1X) && !defined(KECCAK_1X_ALT) && \
!defined(KECCAK_2X) && !defined(KECCAK_INPLACE)
# define KECCAK_2X /* default to KECCAK_2X variant */
#endif
#if defined(__i386) || defined(__i386__) || defined(_M_IX86)
# define KECCAK_COMPLEMENTING_TRANSFORM
#endif
#if defined(__x86_64__) || defined(__aarch64__) || \
defined(__mips64) || defined(__ia64) || \
(defined(__VMS) && !defined(__vax))
/*
* These are available even in ILP32 flavours, but even then they are
* capable of performing 64-bit operations as efficiently as in *P64.
* Since it's not given that we can use sizeof(void *), just shunt it.
*/
# define BIT_INTERLEAVE (0)
#else
# define BIT_INTERLEAVE (sizeof(void *) < 8)
#endif
#define ROL32(a, offset) (((a) << (offset)) | ((a) >> ((32 - (offset)) & 31)))
static uint64_t ROL64(uint64_t val, int offset)
{
if (offset == 0) {
return val;
} else if (!BIT_INTERLEAVE) {
return (val << offset) | (val >> (64-offset));
} else {
uint32_t hi = (uint32_t)(val >> 32), lo = (uint32_t)val;
if (offset & 1) {
uint32_t tmp = hi;
offset >>= 1;
hi = ROL32(lo, offset);
lo = ROL32(tmp, offset + 1);
} else {
offset >>= 1;
lo = ROL32(lo, offset);
hi = ROL32(hi, offset);
}
return ((uint64_t)hi << 32) | lo;
}
}
static const unsigned char rhotates[5][5] = {
{ 0, 1, 62, 28, 27 },
{ 36, 44, 6, 55, 20 },
{ 3, 10, 43, 25, 39 },
{ 41, 45, 15, 21, 8 },
{ 18, 2, 61, 56, 14 }
};
static const uint64_t iotas[] = {
BIT_INTERLEAVE ? 0x0000000000000001ULL : 0x0000000000000001ULL,
BIT_INTERLEAVE ? 0x0000008900000000ULL : 0x0000000000008082ULL,
BIT_INTERLEAVE ? 0x8000008b00000000ULL : 0x800000000000808aULL,
BIT_INTERLEAVE ? 0x8000808000000000ULL : 0x8000000080008000ULL,
BIT_INTERLEAVE ? 0x0000008b00000001ULL : 0x000000000000808bULL,
BIT_INTERLEAVE ? 0x0000800000000001ULL : 0x0000000080000001ULL,
BIT_INTERLEAVE ? 0x8000808800000001ULL : 0x8000000080008081ULL,
BIT_INTERLEAVE ? 0x8000008200000001ULL : 0x8000000000008009ULL,
BIT_INTERLEAVE ? 0x0000000b00000000ULL : 0x000000000000008aULL,
BIT_INTERLEAVE ? 0x0000000a00000000ULL : 0x0000000000000088ULL,
BIT_INTERLEAVE ? 0x0000808200000001ULL : 0x0000000080008009ULL,
BIT_INTERLEAVE ? 0x0000800300000000ULL : 0x000000008000000aULL,
BIT_INTERLEAVE ? 0x0000808b00000001ULL : 0x000000008000808bULL,
BIT_INTERLEAVE ? 0x8000000b00000001ULL : 0x800000000000008bULL,
BIT_INTERLEAVE ? 0x8000008a00000001ULL : 0x8000000000008089ULL,
BIT_INTERLEAVE ? 0x8000008100000001ULL : 0x8000000000008003ULL,
BIT_INTERLEAVE ? 0x8000008100000000ULL : 0x8000000000008002ULL,
BIT_INTERLEAVE ? 0x8000000800000000ULL : 0x8000000000000080ULL,
BIT_INTERLEAVE ? 0x0000008300000000ULL : 0x000000000000800aULL,
BIT_INTERLEAVE ? 0x8000800300000000ULL : 0x800000008000000aULL,
BIT_INTERLEAVE ? 0x8000808800000001ULL : 0x8000000080008081ULL,
BIT_INTERLEAVE ? 0x8000008800000000ULL : 0x8000000000008080ULL,
BIT_INTERLEAVE ? 0x0000800000000001ULL : 0x0000000080000001ULL,
BIT_INTERLEAVE ? 0x8000808200000000ULL : 0x8000000080008008ULL
};
#if defined(KECCAK_REF)
/*
* This is straightforward or "maximum clarity" implementation aiming
* to resemble section 3.2 of the FIPS PUB 202 "SHA-3 Standard:
* Permutation-Based Hash and Extendible-Output Functions" as much as
* possible. With one caveat. Because of the way C stores matrices,
* references to A[x,y] in the specification are presented as A[y][x].
* Implementation unrolls inner x-loops so that modulo 5 operations are
* explicitly pre-computed.
*/
static void Theta(uint64_t A[5][5])
{
uint64_t C[5], D[5];
size_t y;
C[0] = A[0][0];
C[1] = A[0][1];
C[2] = A[0][2];
C[3] = A[0][3];
C[4] = A[0][4];
for (y = 1; y < 5; y++) {
C[0] ^= A[y][0];
C[1] ^= A[y][1];
C[2] ^= A[y][2];
C[3] ^= A[y][3];
C[4] ^= A[y][4];
}
D[0] = ROL64(C[1], 1) ^ C[4];
D[1] = ROL64(C[2], 1) ^ C[0];
D[2] = ROL64(C[3], 1) ^ C[1];
D[3] = ROL64(C[4], 1) ^ C[2];
D[4] = ROL64(C[0], 1) ^ C[3];
for (y = 0; y < 5; y++) {
A[y][0] ^= D[0];
A[y][1] ^= D[1];
A[y][2] ^= D[2];
A[y][3] ^= D[3];
A[y][4] ^= D[4];
}
}
static void Rho(uint64_t A[5][5])
{
size_t y;
for (y = 0; y < 5; y++) {
A[y][0] = ROL64(A[y][0], rhotates[y][0]);
A[y][1] = ROL64(A[y][1], rhotates[y][1]);
A[y][2] = ROL64(A[y][2], rhotates[y][2]);
A[y][3] = ROL64(A[y][3], rhotates[y][3]);
A[y][4] = ROL64(A[y][4], rhotates[y][4]);
}
}
static void Pi(uint64_t A[5][5])
{
uint64_t T[5][5];
/*
* T = A
* A[y][x] = T[x][(3*y+x)%5]
*/
memcpy(T, A, sizeof(T));
A[0][0] = T[0][0];
A[0][1] = T[1][1];
A[0][2] = T[2][2];
A[0][3] = T[3][3];
A[0][4] = T[4][4];
A[1][0] = T[0][3];
A[1][1] = T[1][4];
A[1][2] = T[2][0];
A[1][3] = T[3][1];
A[1][4] = T[4][2];
A[2][0] = T[0][1];
A[2][1] = T[1][2];
A[2][2] = T[2][3];
A[2][3] = T[3][4];
A[2][4] = T[4][0];
A[3][0] = T[0][4];
A[3][1] = T[1][0];
A[3][2] = T[2][1];
A[3][3] = T[3][2];
A[3][4] = T[4][3];
A[4][0] = T[0][2];
A[4][1] = T[1][3];
A[4][2] = T[2][4];
A[4][3] = T[3][0];
A[4][4] = T[4][1];
}
static void Chi(uint64_t A[5][5])
{
uint64_t C[5];
size_t y;
for (y = 0; y < 5; y++) {
C[0] = A[y][0] ^ (~A[y][1] & A[y][2]);
C[1] = A[y][1] ^ (~A[y][2] & A[y][3]);
C[2] = A[y][2] ^ (~A[y][3] & A[y][4]);
C[3] = A[y][3] ^ (~A[y][4] & A[y][0]);
C[4] = A[y][4] ^ (~A[y][0] & A[y][1]);
A[y][0] = C[0];
A[y][1] = C[1];
A[y][2] = C[2];
A[y][3] = C[3];
A[y][4] = C[4];
}
}
static void Iota(uint64_t A[5][5], size_t i)
{
assert(i < (sizeof(iotas) / sizeof(iotas[0])));
A[0][0] ^= iotas[i];
}
static void KeccakF1600(uint64_t A[5][5])
{
size_t i;
for (i = 0; i < 24; i++) {
Theta(A);
Rho(A);
Pi(A);
Chi(A);
Iota(A, i);
}
}
#elif defined(KECCAK_1X)
/*
* This implementation is optimization of above code featuring unroll
* of even y-loops, their fusion and code motion. It also minimizes
* temporary storage. Compiler would normally do all these things for
* you, purpose of manual optimization is to provide "unobscured"
* reference for assembly implementation [in case this approach is
* chosen for implementation on some platform]. In the nutshell it's
* equivalent of "plane-per-plane processing" approach discussed in
* section 2.4 of "Keccak implementation overview".
*/
static void Round(uint64_t A[5][5], size_t i)
{
uint64_t C[5], E[2]; /* registers */
uint64_t D[5], T[2][5]; /* memory */
assert(i < (sizeof(iotas) / sizeof(iotas[0])));
C[0] = A[0][0] ^ A[1][0] ^ A[2][0] ^ A[3][0] ^ A[4][0];
C[1] = A[0][1] ^ A[1][1] ^ A[2][1] ^ A[3][1] ^ A[4][1];
C[2] = A[0][2] ^ A[1][2] ^ A[2][2] ^ A[3][2] ^ A[4][2];
C[3] = A[0][3] ^ A[1][3] ^ A[2][3] ^ A[3][3] ^ A[4][3];
C[4] = A[0][4] ^ A[1][4] ^ A[2][4] ^ A[3][4] ^ A[4][4];
#if defined(__arm__)
D[1] = E[0] = ROL64(C[2], 1) ^ C[0];
D[4] = E[1] = ROL64(C[0], 1) ^ C[3];
D[0] = C[0] = ROL64(C[1], 1) ^ C[4];
D[2] = C[1] = ROL64(C[3], 1) ^ C[1];
D[3] = C[2] = ROL64(C[4], 1) ^ C[2];
T[0][0] = A[3][0] ^ C[0]; /* borrow T[0][0] */
T[0][1] = A[0][1] ^ E[0]; /* D[1] */
T[0][2] = A[0][2] ^ C[1]; /* D[2] */
T[0][3] = A[0][3] ^ C[2]; /* D[3] */
T[0][4] = A[0][4] ^ E[1]; /* D[4] */
C[3] = ROL64(A[3][3] ^ C[2], rhotates[3][3]); /* D[3] */
C[4] = ROL64(A[4][4] ^ E[1], rhotates[4][4]); /* D[4] */
C[0] = A[0][0] ^ C[0]; /* rotate by 0 */ /* D[0] */
C[2] = ROL64(A[2][2] ^ C[1], rhotates[2][2]); /* D[2] */
C[1] = ROL64(A[1][1] ^ E[0], rhotates[1][1]); /* D[1] */
#else
D[0] = ROL64(C[1], 1) ^ C[4];
D[1] = ROL64(C[2], 1) ^ C[0];
D[2] = ROL64(C[3], 1) ^ C[1];
D[3] = ROL64(C[4], 1) ^ C[2];
D[4] = ROL64(C[0], 1) ^ C[3];
T[0][0] = A[3][0] ^ D[0]; /* borrow T[0][0] */
T[0][1] = A[0][1] ^ D[1];
T[0][2] = A[0][2] ^ D[2];
T[0][3] = A[0][3] ^ D[3];
T[0][4] = A[0][4] ^ D[4];
C[0] = A[0][0] ^ D[0]; /* rotate by 0 */
C[1] = ROL64(A[1][1] ^ D[1], rhotates[1][1]);
C[2] = ROL64(A[2][2] ^ D[2], rhotates[2][2]);
C[3] = ROL64(A[3][3] ^ D[3], rhotates[3][3]);
C[4] = ROL64(A[4][4] ^ D[4], rhotates[4][4]);
#endif
A[0][0] = C[0] ^ (~C[1] & C[2]) ^ iotas[i];
A[0][1] = C[1] ^ (~C[2] & C[3]);
A[0][2] = C[2] ^ (~C[3] & C[4]);
A[0][3] = C[3] ^ (~C[4] & C[0]);
A[0][4] = C[4] ^ (~C[0] & C[1]);
T[1][0] = A[1][0] ^ (C[3] = D[0]);
T[1][1] = A[2][1] ^ (C[4] = D[1]); /* borrow T[1][1] */
T[1][2] = A[1][2] ^ (E[0] = D[2]);
T[1][3] = A[1][3] ^ (E[1] = D[3]);
T[1][4] = A[2][4] ^ (C[2] = D[4]); /* borrow T[1][4] */
C[0] = ROL64(T[0][3], rhotates[0][3]);
C[1] = ROL64(A[1][4] ^ C[2], rhotates[1][4]); /* D[4] */
C[2] = ROL64(A[2][0] ^ C[3], rhotates[2][0]); /* D[0] */
C[3] = ROL64(A[3][1] ^ C[4], rhotates[3][1]); /* D[1] */
C[4] = ROL64(A[4][2] ^ E[0], rhotates[4][2]); /* D[2] */
A[1][0] = C[0] ^ (~C[1] & C[2]);
A[1][1] = C[1] ^ (~C[2] & C[3]);
A[1][2] = C[2] ^ (~C[3] & C[4]);
A[1][3] = C[3] ^ (~C[4] & C[0]);
A[1][4] = C[4] ^ (~C[0] & C[1]);
C[0] = ROL64(T[0][1], rhotates[0][1]);
C[1] = ROL64(T[1][2], rhotates[1][2]);
C[2] = ROL64(A[2][3] ^ D[3], rhotates[2][3]);
C[3] = ROL64(A[3][4] ^ D[4], rhotates[3][4]);
C[4] = ROL64(A[4][0] ^ D[0], rhotates[4][0]);
A[2][0] = C[0] ^ (~C[1] & C[2]);
A[2][1] = C[1] ^ (~C[2] & C[3]);
A[2][2] = C[2] ^ (~C[3] & C[4]);
A[2][3] = C[3] ^ (~C[4] & C[0]);
A[2][4] = C[4] ^ (~C[0] & C[1]);
C[0] = ROL64(T[0][4], rhotates[0][4]);
C[1] = ROL64(T[1][0], rhotates[1][0]);
C[2] = ROL64(T[1][1], rhotates[2][1]); /* originally A[2][1] */
C[3] = ROL64(A[3][2] ^ D[2], rhotates[3][2]);
C[4] = ROL64(A[4][3] ^ D[3], rhotates[4][3]);
A[3][0] = C[0] ^ (~C[1] & C[2]);
A[3][1] = C[1] ^ (~C[2] & C[3]);
A[3][2] = C[2] ^ (~C[3] & C[4]);
A[3][3] = C[3] ^ (~C[4] & C[0]);
A[3][4] = C[4] ^ (~C[0] & C[1]);
C[0] = ROL64(T[0][2], rhotates[0][2]);
C[1] = ROL64(T[1][3], rhotates[1][3]);
C[2] = ROL64(T[1][4], rhotates[2][4]); /* originally A[2][4] */
C[3] = ROL64(T[0][0], rhotates[3][0]); /* originally A[3][0] */
C[4] = ROL64(A[4][1] ^ D[1], rhotates[4][1]);
A[4][0] = C[0] ^ (~C[1] & C[2]);
A[4][1] = C[1] ^ (~C[2] & C[3]);
A[4][2] = C[2] ^ (~C[3] & C[4]);
A[4][3] = C[3] ^ (~C[4] & C[0]);
A[4][4] = C[4] ^ (~C[0] & C[1]);
}
static void KeccakF1600(uint64_t A[5][5])
{
size_t i;
for (i = 0; i < 24; i++) {
Round(A, i);
}
}
#elif defined(KECCAK_1X_ALT)
/*
* This is variant of above KECCAK_1X that reduces requirement for
* temporary storage even further, but at cost of more updates to A[][].
* It's less suitable if A[][] is memory bound, but better if it's
* register bound.
*/
static void Round(uint64_t A[5][5], size_t i)
{
uint64_t C[5], D[5];
assert(i < (sizeof(iotas) / sizeof(iotas[0])));
C[0] = A[0][0] ^ A[1][0] ^ A[2][0] ^ A[3][0] ^ A[4][0];
C[1] = A[0][1] ^ A[1][1] ^ A[2][1] ^ A[3][1] ^ A[4][1];
C[2] = A[0][2] ^ A[1][2] ^ A[2][2] ^ A[3][2] ^ A[4][2];
C[3] = A[0][3] ^ A[1][3] ^ A[2][3] ^ A[3][3] ^ A[4][3];
C[4] = A[0][4] ^ A[1][4] ^ A[2][4] ^ A[3][4] ^ A[4][4];
D[1] = C[0] ^ ROL64(C[2], 1);
D[2] = C[1] ^ ROL64(C[3], 1);
D[3] = C[2] ^= ROL64(C[4], 1);
D[4] = C[3] ^= ROL64(C[0], 1);
D[0] = C[4] ^= ROL64(C[1], 1);
A[0][1] ^= D[1];
A[1][1] ^= D[1];
A[2][1] ^= D[1];
A[3][1] ^= D[1];
A[4][1] ^= D[1];
A[0][2] ^= D[2];
A[1][2] ^= D[2];
A[2][2] ^= D[2];
A[3][2] ^= D[2];
A[4][2] ^= D[2];
A[0][3] ^= C[2];
A[1][3] ^= C[2];
A[2][3] ^= C[2];
A[3][3] ^= C[2];
A[4][3] ^= C[2];
A[0][4] ^= C[3];
A[1][4] ^= C[3];
A[2][4] ^= C[3];
A[3][4] ^= C[3];
A[4][4] ^= C[3];
A[0][0] ^= C[4];
A[1][0] ^= C[4];
A[2][0] ^= C[4];
A[3][0] ^= C[4];
A[4][0] ^= C[4];
C[1] = A[0][1];
C[2] = A[0][2];
C[3] = A[0][3];
C[4] = A[0][4];
A[0][1] = ROL64(A[1][1], rhotates[1][1]);
A[0][2] = ROL64(A[2][2], rhotates[2][2]);
A[0][3] = ROL64(A[3][3], rhotates[3][3]);
A[0][4] = ROL64(A[4][4], rhotates[4][4]);
A[1][1] = ROL64(A[1][4], rhotates[1][4]);
A[2][2] = ROL64(A[2][3], rhotates[2][3]);
A[3][3] = ROL64(A[3][2], rhotates[3][2]);
A[4][4] = ROL64(A[4][1], rhotates[4][1]);
A[1][4] = ROL64(A[4][2], rhotates[4][2]);
A[2][3] = ROL64(A[3][4], rhotates[3][4]);
A[3][2] = ROL64(A[2][1], rhotates[2][1]);
A[4][1] = ROL64(A[1][3], rhotates[1][3]);
A[4][2] = ROL64(A[2][4], rhotates[2][4]);
A[3][4] = ROL64(A[4][3], rhotates[4][3]);
A[2][1] = ROL64(A[1][2], rhotates[1][2]);
A[1][3] = ROL64(A[3][1], rhotates[3][1]);
A[2][4] = ROL64(A[4][0], rhotates[4][0]);
A[4][3] = ROL64(A[3][0], rhotates[3][0]);
A[1][2] = ROL64(A[2][0], rhotates[2][0]);
A[3][1] = ROL64(A[1][0], rhotates[1][0]);
A[1][0] = ROL64(C[3], rhotates[0][3]);
A[2][0] = ROL64(C[1], rhotates[0][1]);
A[3][0] = ROL64(C[4], rhotates[0][4]);
A[4][0] = ROL64(C[2], rhotates[0][2]);
C[0] = A[0][0];
C[1] = A[1][0];
D[0] = A[0][1];
D[1] = A[1][1];
A[0][0] ^= (~A[0][1] & A[0][2]);
A[1][0] ^= (~A[1][1] & A[1][2]);
A[0][1] ^= (~A[0][2] & A[0][3]);
A[1][1] ^= (~A[1][2] & A[1][3]);
A[0][2] ^= (~A[0][3] & A[0][4]);
A[1][2] ^= (~A[1][3] & A[1][4]);
A[0][3] ^= (~A[0][4] & C[0]);
A[1][3] ^= (~A[1][4] & C[1]);
A[0][4] ^= (~C[0] & D[0]);
A[1][4] ^= (~C[1] & D[1]);
C[2] = A[2][0];
C[3] = A[3][0];
D[2] = A[2][1];
D[3] = A[3][1];
A[2][0] ^= (~A[2][1] & A[2][2]);
A[3][0] ^= (~A[3][1] & A[3][2]);
A[2][1] ^= (~A[2][2] & A[2][3]);
A[3][1] ^= (~A[3][2] & A[3][3]);
A[2][2] ^= (~A[2][3] & A[2][4]);
A[3][2] ^= (~A[3][3] & A[3][4]);
A[2][3] ^= (~A[2][4] & C[2]);
A[3][3] ^= (~A[3][4] & C[3]);
A[2][4] ^= (~C[2] & D[2]);
A[3][4] ^= (~C[3] & D[3]);
C[4] = A[4][0];
D[4] = A[4][1];
A[4][0] ^= (~A[4][1] & A[4][2]);
A[4][1] ^= (~A[4][2] & A[4][3]);
A[4][2] ^= (~A[4][3] & A[4][4]);
A[4][3] ^= (~A[4][4] & C[4]);
A[4][4] ^= (~C[4] & D[4]);
A[0][0] ^= iotas[i];
}
static void KeccakF1600(uint64_t A[5][5])
{
size_t i;
for (i = 0; i < 24; i++) {
Round(A, i);
}
}
#elif defined(KECCAK_2X)
/*
* This implementation is variant of KECCAK_1X above with outer-most
* round loop unrolled twice. This allows to take temporary storage
* out of round procedure and simplify references to it by alternating
* it with actual data (see round loop below). Originally it was meant
* rather as reference for an assembly implementation, but it seems to
* play best with compilers [as well as provide best instruction per
* processed byte ratio at minimal round unroll factor]...
*/
static void Round(uint64_t R[5][5], uint64_t A[5][5], size_t i)
{
uint64_t C[5], D[5];
assert(i < (sizeof(iotas) / sizeof(iotas[0])));
C[0] = A[0][0] ^ A[1][0] ^ A[2][0] ^ A[3][0] ^ A[4][0];
C[1] = A[0][1] ^ A[1][1] ^ A[2][1] ^ A[3][1] ^ A[4][1];
C[2] = A[0][2] ^ A[1][2] ^ A[2][2] ^ A[3][2] ^ A[4][2];
C[3] = A[0][3] ^ A[1][3] ^ A[2][3] ^ A[3][3] ^ A[4][3];
C[4] = A[0][4] ^ A[1][4] ^ A[2][4] ^ A[3][4] ^ A[4][4];
D[0] = ROL64(C[1], 1) ^ C[4];
D[1] = ROL64(C[2], 1) ^ C[0];
D[2] = ROL64(C[3], 1) ^ C[1];
D[3] = ROL64(C[4], 1) ^ C[2];
D[4] = ROL64(C[0], 1) ^ C[3];
C[0] = A[0][0] ^ D[0]; /* rotate by 0 */
C[1] = ROL64(A[1][1] ^ D[1], rhotates[1][1]);
C[2] = ROL64(A[2][2] ^ D[2], rhotates[2][2]);
C[3] = ROL64(A[3][3] ^ D[3], rhotates[3][3]);
C[4] = ROL64(A[4][4] ^ D[4], rhotates[4][4]);
#ifdef KECCAK_COMPLEMENTING_TRANSFORM
R[0][0] = C[0] ^ ( C[1] | C[2]) ^ iotas[i];
R[0][1] = C[1] ^ (~C[2] | C[3]);
R[0][2] = C[2] ^ ( C[3] & C[4]);
R[0][3] = C[3] ^ ( C[4] | C[0]);
R[0][4] = C[4] ^ ( C[0] & C[1]);
#else
R[0][0] = C[0] ^ (~C[1] & C[2]) ^ iotas[i];
R[0][1] = C[1] ^ (~C[2] & C[3]);
R[0][2] = C[2] ^ (~C[3] & C[4]);
R[0][3] = C[3] ^ (~C[4] & C[0]);
R[0][4] = C[4] ^ (~C[0] & C[1]);
#endif
C[0] = ROL64(A[0][3] ^ D[3], rhotates[0][3]);
C[1] = ROL64(A[1][4] ^ D[4], rhotates[1][4]);
C[2] = ROL64(A[2][0] ^ D[0], rhotates[2][0]);
C[3] = ROL64(A[3][1] ^ D[1], rhotates[3][1]);
C[4] = ROL64(A[4][2] ^ D[2], rhotates[4][2]);
#ifdef KECCAK_COMPLEMENTING_TRANSFORM
R[1][0] = C[0] ^ (C[1] | C[2]);
R[1][1] = C[1] ^ (C[2] & C[3]);
R[1][2] = C[2] ^ (C[3] | ~C[4]);
R[1][3] = C[3] ^ (C[4] | C[0]);
R[1][4] = C[4] ^ (C[0] & C[1]);
#else
R[1][0] = C[0] ^ (~C[1] & C[2]);
R[1][1] = C[1] ^ (~C[2] & C[3]);
R[1][2] = C[2] ^ (~C[3] & C[4]);
R[1][3] = C[3] ^ (~C[4] & C[0]);
R[1][4] = C[4] ^ (~C[0] & C[1]);
#endif
C[0] = ROL64(A[0][1] ^ D[1], rhotates[0][1]);
C[1] = ROL64(A[1][2] ^ D[2], rhotates[1][2]);
C[2] = ROL64(A[2][3] ^ D[3], rhotates[2][3]);
C[3] = ROL64(A[3][4] ^ D[4], rhotates[3][4]);
C[4] = ROL64(A[4][0] ^ D[0], rhotates[4][0]);
#ifdef KECCAK_COMPLEMENTING_TRANSFORM
R[2][0] = C[0] ^ ( C[1] | C[2]);
R[2][1] = C[1] ^ ( C[2] & C[3]);
R[2][2] = C[2] ^ (~C[3] & C[4]);
R[2][3] = ~C[3] ^ ( C[4] | C[0]);
R[2][4] = C[4] ^ ( C[0] & C[1]);
#else
R[2][0] = C[0] ^ (~C[1] & C[2]);
R[2][1] = C[1] ^ (~C[2] & C[3]);
R[2][2] = C[2] ^ (~C[3] & C[4]);
R[2][3] = C[3] ^ (~C[4] & C[0]);
R[2][4] = C[4] ^ (~C[0] & C[1]);
#endif
C[0] = ROL64(A[0][4] ^ D[4], rhotates[0][4]);
C[1] = ROL64(A[1][0] ^ D[0], rhotates[1][0]);
C[2] = ROL64(A[2][1] ^ D[1], rhotates[2][1]);
C[3] = ROL64(A[3][2] ^ D[2], rhotates[3][2]);
C[4] = ROL64(A[4][3] ^ D[3], rhotates[4][3]);
#ifdef KECCAK_COMPLEMENTING_TRANSFORM
R[3][0] = C[0] ^ ( C[1] & C[2]);
R[3][1] = C[1] ^ ( C[2] | C[3]);
R[3][2] = C[2] ^ (~C[3] | C[4]);
R[3][3] = ~C[3] ^ ( C[4] & C[0]);
R[3][4] = C[4] ^ ( C[0] | C[1]);
#else
R[3][0] = C[0] ^ (~C[1] & C[2]);
R[3][1] = C[1] ^ (~C[2] & C[3]);
R[3][2] = C[2] ^ (~C[3] & C[4]);
R[3][3] = C[3] ^ (~C[4] & C[0]);
R[3][4] = C[4] ^ (~C[0] & C[1]);
#endif
C[0] = ROL64(A[0][2] ^ D[2], rhotates[0][2]);
C[1] = ROL64(A[1][3] ^ D[3], rhotates[1][3]);
C[2] = ROL64(A[2][4] ^ D[4], rhotates[2][4]);
C[3] = ROL64(A[3][0] ^ D[0], rhotates[3][0]);
C[4] = ROL64(A[4][1] ^ D[1], rhotates[4][1]);
#ifdef KECCAK_COMPLEMENTING_TRANSFORM
R[4][0] = C[0] ^ (~C[1] & C[2]);
R[4][1] = ~C[1] ^ ( C[2] | C[3]);
R[4][2] = C[2] ^ ( C[3] & C[4]);
R[4][3] = C[3] ^ ( C[4] | C[0]);
R[4][4] = C[4] ^ ( C[0] & C[1]);
#else
R[4][0] = C[0] ^ (~C[1] & C[2]);
R[4][1] = C[1] ^ (~C[2] & C[3]);
R[4][2] = C[2] ^ (~C[3] & C[4]);
R[4][3] = C[3] ^ (~C[4] & C[0]);
R[4][4] = C[4] ^ (~C[0] & C[1]);
#endif
}
static void KeccakF1600(uint64_t A[5][5])
{
uint64_t T[5][5];
size_t i;
#ifdef KECCAK_COMPLEMENTING_TRANSFORM
A[0][1] = ~A[0][1];
A[0][2] = ~A[0][2];
A[1][3] = ~A[1][3];
A[2][2] = ~A[2][2];
A[3][2] = ~A[3][2];
A[4][0] = ~A[4][0];
#endif
for (i = 0; i < 24; i += 2) {
Round(T, A, i);
Round(A, T, i + 1);
}
#ifdef KECCAK_COMPLEMENTING_TRANSFORM
A[0][1] = ~A[0][1];
A[0][2] = ~A[0][2];
A[1][3] = ~A[1][3];
A[2][2] = ~A[2][2];
A[3][2] = ~A[3][2];
A[4][0] = ~A[4][0];
#endif
}
#else /* define KECCAK_INPLACE to compile this code path */
/*
* This implementation is KECCAK_1X from above combined 4 times with
* a twist that allows to omit temporary storage and perform in-place
* processing. It's discussed in section 2.5 of "Keccak implementation
* overview". It's likely to be best suited for processors with large
* register bank... On the other hand processor with large register
* bank can as well use KECCAK_1X_ALT, it would be as fast but much
* more compact...
*/
static void FourRounds(uint64_t A[5][5], size_t i)
{
uint64_t B[5], C[5], D[5];
assert(i <= (sizeof(iotas) / sizeof(iotas[0]) - 4));
/* Round 4*n */
C[0] = A[0][0] ^ A[1][0] ^ A[2][0] ^ A[3][0] ^ A[4][0];
C[1] = A[0][1] ^ A[1][1] ^ A[2][1] ^ A[3][1] ^ A[4][1];
C[2] = A[0][2] ^ A[1][2] ^ A[2][2] ^ A[3][2] ^ A[4][2];
C[3] = A[0][3] ^ A[1][3] ^ A[2][3] ^ A[3][3] ^ A[4][3];
C[4] = A[0][4] ^ A[1][4] ^ A[2][4] ^ A[3][4] ^ A[4][4];
D[0] = ROL64(C[1], 1) ^ C[4];
D[1] = ROL64(C[2], 1) ^ C[0];
D[2] = ROL64(C[3], 1) ^ C[1];
D[3] = ROL64(C[4], 1) ^ C[2];
D[4] = ROL64(C[0], 1) ^ C[3];
B[0] = A[0][0] ^ D[0]; /* rotate by 0 */
B[1] = ROL64(A[1][1] ^ D[1], rhotates[1][1]);
B[2] = ROL64(A[2][2] ^ D[2], rhotates[2][2]);
B[3] = ROL64(A[3][3] ^ D[3], rhotates[3][3]);
B[4] = ROL64(A[4][4] ^ D[4], rhotates[4][4]);
C[0] = A[0][0] = B[0] ^ (~B[1] & B[2]) ^ iotas[i];
C[1] = A[1][1] = B[1] ^ (~B[2] & B[3]);
C[2] = A[2][2] = B[2] ^ (~B[3] & B[4]);
C[3] = A[3][3] = B[3] ^ (~B[4] & B[0]);
C[4] = A[4][4] = B[4] ^ (~B[0] & B[1]);
B[0] = ROL64(A[0][3] ^ D[3], rhotates[0][3]);
B[1] = ROL64(A[1][4] ^ D[4], rhotates[1][4]);
B[2] = ROL64(A[2][0] ^ D[0], rhotates[2][0]);
B[3] = ROL64(A[3][1] ^ D[1], rhotates[3][1]);
B[4] = ROL64(A[4][2] ^ D[2], rhotates[4][2]);
C[0] ^= A[2][0] = B[0] ^ (~B[1] & B[2]);
C[1] ^= A[3][1] = B[1] ^ (~B[2] & B[3]);
C[2] ^= A[4][2] = B[2] ^ (~B[3] & B[4]);
C[3] ^= A[0][3] = B[3] ^ (~B[4] & B[0]);
C[4] ^= A[1][4] = B[4] ^ (~B[0] & B[1]);
B[0] = ROL64(A[0][1] ^ D[1], rhotates[0][1]);
B[1] = ROL64(A[1][2] ^ D[2], rhotates[1][2]);
B[2] = ROL64(A[2][3] ^ D[3], rhotates[2][3]);
B[3] = ROL64(A[3][4] ^ D[4], rhotates[3][4]);
B[4] = ROL64(A[4][0] ^ D[0], rhotates[4][0]);
C[0] ^= A[4][0] = B[0] ^ (~B[1] & B[2]);
C[1] ^= A[0][1] = B[1] ^ (~B[2] & B[3]);
C[2] ^= A[1][2] = B[2] ^ (~B[3] & B[4]);
C[3] ^= A[2][3] = B[3] ^ (~B[4] & B[0]);
C[4] ^= A[3][4] = B[4] ^ (~B[0] & B[1]);
B[0] = ROL64(A[0][4] ^ D[4], rhotates[0][4]);
B[1] = ROL64(A[1][0] ^ D[0], rhotates[1][0]);
B[2] = ROL64(A[2][1] ^ D[1], rhotates[2][1]);
B[3] = ROL64(A[3][2] ^ D[2], rhotates[3][2]);
B[4] = ROL64(A[4][3] ^ D[3], rhotates[4][3]);
C[0] ^= A[1][0] = B[0] ^ (~B[1] & B[2]);
C[1] ^= A[2][1] = B[1] ^ (~B[2] & B[3]);
C[2] ^= A[3][2] = B[2] ^ (~B[3] & B[4]);
C[3] ^= A[4][3] = B[3] ^ (~B[4] & B[0]);
C[4] ^= A[0][4] = B[4] ^ (~B[0] & B[1]);
B[0] = ROL64(A[0][2] ^ D[2], rhotates[0][2]);
B[1] = ROL64(A[1][3] ^ D[3], rhotates[1][3]);
B[2] = ROL64(A[2][4] ^ D[4], rhotates[2][4]);
B[3] = ROL64(A[3][0] ^ D[0], rhotates[3][0]);
B[4] = ROL64(A[4][1] ^ D[1], rhotates[4][1]);
C[0] ^= A[3][0] = B[0] ^ (~B[1] & B[2]);
C[1] ^= A[4][1] = B[1] ^ (~B[2] & B[3]);
C[2] ^= A[0][2] = B[2] ^ (~B[3] & B[4]);
C[3] ^= A[1][3] = B[3] ^ (~B[4] & B[0]);
C[4] ^= A[2][4] = B[4] ^ (~B[0] & B[1]);
/* Round 4*n+1 */
D[0] = ROL64(C[1], 1) ^ C[4];
D[1] = ROL64(C[2], 1) ^ C[0];
D[2] = ROL64(C[3], 1) ^ C[1];
D[3] = ROL64(C[4], 1) ^ C[2];
D[4] = ROL64(C[0], 1) ^ C[3];
B[0] = A[0][0] ^ D[0]; /* rotate by 0 */
B[1] = ROL64(A[3][1] ^ D[1], rhotates[1][1]);
B[2] = ROL64(A[1][2] ^ D[2], rhotates[2][2]);
B[3] = ROL64(A[4][3] ^ D[3], rhotates[3][3]);
B[4] = ROL64(A[2][4] ^ D[4], rhotates[4][4]);
C[0] = A[0][0] = B[0] ^ (~B[1] & B[2]) ^ iotas[i + 1];
C[1] = A[3][1] = B[1] ^ (~B[2] & B[3]);
C[2] = A[1][2] = B[2] ^ (~B[3] & B[4]);
C[3] = A[4][3] = B[3] ^ (~B[4] & B[0]);
C[4] = A[2][4] = B[4] ^ (~B[0] & B[1]);
B[0] = ROL64(A[3][3] ^ D[3], rhotates[0][3]);
B[1] = ROL64(A[1][4] ^ D[4], rhotates[1][4]);
B[2] = ROL64(A[4][0] ^ D[0], rhotates[2][0]);
B[3] = ROL64(A[2][1] ^ D[1], rhotates[3][1]);
B[4] = ROL64(A[0][2] ^ D[2], rhotates[4][2]);
C[0] ^= A[4][0] = B[0] ^ (~B[1] & B[2]);
C[1] ^= A[2][1] = B[1] ^ (~B[2] & B[3]);
C[2] ^= A[0][2] = B[2] ^ (~B[3] & B[4]);
C[3] ^= A[3][3] = B[3] ^ (~B[4] & B[0]);
C[4] ^= A[1][4] = B[4] ^ (~B[0] & B[1]);
B[0] = ROL64(A[1][1] ^ D[1], rhotates[0][1]);
B[1] = ROL64(A[4][2] ^ D[2], rhotates[1][2]);
B[2] = ROL64(A[2][3] ^ D[3], rhotates[2][3]);
B[3] = ROL64(A[0][4] ^ D[4], rhotates[3][4]);
B[4] = ROL64(A[3][0] ^ D[0], rhotates[4][0]);
C[0] ^= A[3][0] = B[0] ^ (~B[1] & B[2]);
C[1] ^= A[1][1] = B[1] ^ (~B[2] & B[3]);
C[2] ^= A[4][2] = B[2] ^ (~B[3] & B[4]);
C[3] ^= A[2][3] = B[3] ^ (~B[4] & B[0]);
C[4] ^= A[0][4] = B[4] ^ (~B[0] & B[1]);
B[0] = ROL64(A[4][4] ^ D[4], rhotates[0][4]);
B[1] = ROL64(A[2][0] ^ D[0], rhotates[1][0]);
B[2] = ROL64(A[0][1] ^ D[1], rhotates[2][1]);
B[3] = ROL64(A[3][2] ^ D[2], rhotates[3][2]);
B[4] = ROL64(A[1][3] ^ D[3], rhotates[4][3]);
C[0] ^= A[2][0] = B[0] ^ (~B[1] & B[2]);
C[1] ^= A[0][1] = B[1] ^ (~B[2] & B[3]);
C[2] ^= A[3][2] = B[2] ^ (~B[3] & B[4]);
C[3] ^= A[1][3] = B[3] ^ (~B[4] & B[0]);
C[4] ^= A[4][4] = B[4] ^ (~B[0] & B[1]);
B[0] = ROL64(A[2][2] ^ D[2], rhotates[0][2]);
B[1] = ROL64(A[0][3] ^ D[3], rhotates[1][3]);
B[2] = ROL64(A[3][4] ^ D[4], rhotates[2][4]);
B[3] = ROL64(A[1][0] ^ D[0], rhotates[3][0]);
B[4] = ROL64(A[4][1] ^ D[1], rhotates[4][1]);
C[0] ^= A[1][0] = B[0] ^ (~B[1] & B[2]);
C[1] ^= A[4][1] = B[1] ^ (~B[2] & B[3]);
C[2] ^= A[2][2] = B[2] ^ (~B[3] & B[4]);
C[3] ^= A[0][3] = B[3] ^ (~B[4] & B[0]);
C[4] ^= A[3][4] = B[4] ^ (~B[0] & B[1]);
/* Round 4*n+2 */
D[0] = ROL64(C[1], 1) ^ C[4];
D[1] = ROL64(C[2], 1) ^ C[0];
D[2] = ROL64(C[3], 1) ^ C[1];
D[3] = ROL64(C[4], 1) ^ C[2];
D[4] = ROL64(C[0], 1) ^ C[3];
B[0] = A[0][0] ^ D[0]; /* rotate by 0 */
B[1] = ROL64(A[2][1] ^ D[1], rhotates[1][1]);
B[2] = ROL64(A[4][2] ^ D[2], rhotates[2][2]);
B[3] = ROL64(A[1][3] ^ D[3], rhotates[3][3]);
B[4] = ROL64(A[3][4] ^ D[4], rhotates[4][4]);
C[0] = A[0][0] = B[0] ^ (~B[1] & B[2]) ^ iotas[i + 2];
C[1] = A[2][1] = B[1] ^ (~B[2] & B[3]);
C[2] = A[4][2] = B[2] ^ (~B[3] & B[4]);
C[3] = A[1][3] = B[3] ^ (~B[4] & B[0]);
C[4] = A[3][4] = B[4] ^ (~B[0] & B[1]);
B[0] = ROL64(A[4][3] ^ D[3], rhotates[0][3]);
B[1] = ROL64(A[1][4] ^ D[4], rhotates[1][4]);
B[2] = ROL64(A[3][0] ^ D[0], rhotates[2][0]);
B[3] = ROL64(A[0][1] ^ D[1], rhotates[3][1]);
B[4] = ROL64(A[2][2] ^ D[2], rhotates[4][2]);
C[0] ^= A[3][0] = B[0] ^ (~B[1] & B[2]);
C[1] ^= A[0][1] = B[1] ^ (~B[2] & B[3]);
C[2] ^= A[2][2] = B[2] ^ (~B[3] & B[4]);
C[3] ^= A[4][3] = B[3] ^ (~B[4] & B[0]);
C[4] ^= A[1][4] = B[4] ^ (~B[0] & B[1]);
B[0] = ROL64(A[3][1] ^ D[1], rhotates[0][1]);
B[1] = ROL64(A[0][2] ^ D[2], rhotates[1][2]);
B[2] = ROL64(A[2][3] ^ D[3], rhotates[2][3]);
B[3] = ROL64(A[4][4] ^ D[4], rhotates[3][4]);
B[4] = ROL64(A[1][0] ^ D[0], rhotates[4][0]);
C[0] ^= A[1][0] = B[0] ^ (~B[1] & B[2]);
C[1] ^= A[3][1] = B[1] ^ (~B[2] & B[3]);
C[2] ^= A[0][2] = B[2] ^ (~B[3] & B[4]);
C[3] ^= A[2][3] = B[3] ^ (~B[4] & B[0]);
C[4] ^= A[4][4] = B[4] ^ (~B[0] & B[1]);
B[0] = ROL64(A[2][4] ^ D[4], rhotates[0][4]);
B[1] = ROL64(A[4][0] ^ D[0], rhotates[1][0]);
B[2] = ROL64(A[1][1] ^ D[1], rhotates[2][1]);
B[3] = ROL64(A[3][2] ^ D[2], rhotates[3][2]);
B[4] = ROL64(A[0][3] ^ D[3], rhotates[4][3]);
C[0] ^= A[4][0] = B[0] ^ (~B[1] & B[2]);
C[1] ^= A[1][1] = B[1] ^ (~B[2] & B[3]);
C[2] ^= A[3][2] = B[2] ^ (~B[3] & B[4]);
C[3] ^= A[0][3] = B[3] ^ (~B[4] & B[0]);
C[4] ^= A[2][4] = B[4] ^ (~B[0] & B[1]);
B[0] = ROL64(A[1][2] ^ D[2], rhotates[0][2]);
B[1] = ROL64(A[3][3] ^ D[3], rhotates[1][3]);
B[2] = ROL64(A[0][4] ^ D[4], rhotates[2][4]);
B[3] = ROL64(A[2][0] ^ D[0], rhotates[3][0]);
B[4] = ROL64(A[4][1] ^ D[1], rhotates[4][1]);
C[0] ^= A[2][0] = B[0] ^ (~B[1] & B[2]);
C[1] ^= A[4][1] = B[1] ^ (~B[2] & B[3]);
C[2] ^= A[1][2] = B[2] ^ (~B[3] & B[4]);
C[3] ^= A[3][3] = B[3] ^ (~B[4] & B[0]);
C[4] ^= A[0][4] = B[4] ^ (~B[0] & B[1]);
/* Round 4*n+3 */
D[0] = ROL64(C[1], 1) ^ C[4];
D[1] = ROL64(C[2], 1) ^ C[0];
D[2] = ROL64(C[3], 1) ^ C[1];
D[3] = ROL64(C[4], 1) ^ C[2];
D[4] = ROL64(C[0], 1) ^ C[3];
B[0] = A[0][0] ^ D[0]; /* rotate by 0 */
B[1] = ROL64(A[0][1] ^ D[1], rhotates[1][1]);
B[2] = ROL64(A[0][2] ^ D[2], rhotates[2][2]);
B[3] = ROL64(A[0][3] ^ D[3], rhotates[3][3]);
B[4] = ROL64(A[0][4] ^ D[4], rhotates[4][4]);
/* C[0] = */ A[0][0] = B[0] ^ (~B[1] & B[2]) ^ iotas[i + 3];
/* C[1] = */ A[0][1] = B[1] ^ (~B[2] & B[3]);
/* C[2] = */ A[0][2] = B[2] ^ (~B[3] & B[4]);
/* C[3] = */ A[0][3] = B[3] ^ (~B[4] & B[0]);
/* C[4] = */ A[0][4] = B[4] ^ (~B[0] & B[1]);
B[0] = ROL64(A[1][3] ^ D[3], rhotates[0][3]);
B[1] = ROL64(A[1][4] ^ D[4], rhotates[1][4]);
B[2] = ROL64(A[1][0] ^ D[0], rhotates[2][0]);
B[3] = ROL64(A[1][1] ^ D[1], rhotates[3][1]);
B[4] = ROL64(A[1][2] ^ D[2], rhotates[4][2]);
/* C[0] ^= */ A[1][0] = B[0] ^ (~B[1] & B[2]);
/* C[1] ^= */ A[1][1] = B[1] ^ (~B[2] & B[3]);
/* C[2] ^= */ A[1][2] = B[2] ^ (~B[3] & B[4]);
/* C[3] ^= */ A[1][3] = B[3] ^ (~B[4] & B[0]);
/* C[4] ^= */ A[1][4] = B[4] ^ (~B[0] & B[1]);
B[0] = ROL64(A[2][1] ^ D[1], rhotates[0][1]);
B[1] = ROL64(A[2][2] ^ D[2], rhotates[1][2]);
B[2] = ROL64(A[2][3] ^ D[3], rhotates[2][3]);
B[3] = ROL64(A[2][4] ^ D[4], rhotates[3][4]);
B[4] = ROL64(A[2][0] ^ D[0], rhotates[4][0]);
/* C[0] ^= */ A[2][0] = B[0] ^ (~B[1] & B[2]);
/* C[1] ^= */ A[2][1] = B[1] ^ (~B[2] & B[3]);
/* C[2] ^= */ A[2][2] = B[2] ^ (~B[3] & B[4]);
/* C[3] ^= */ A[2][3] = B[3] ^ (~B[4] & B[0]);
/* C[4] ^= */ A[2][4] = B[4] ^ (~B[0] & B[1]);
B[0] = ROL64(A[3][4] ^ D[4], rhotates[0][4]);
B[1] = ROL64(A[3][0] ^ D[0], rhotates[1][0]);
B[2] = ROL64(A[3][1] ^ D[1], rhotates[2][1]);
B[3] = ROL64(A[3][2] ^ D[2], rhotates[3][2]);
B[4] = ROL64(A[3][3] ^ D[3], rhotates[4][3]);
/* C[0] ^= */ A[3][0] = B[0] ^ (~B[1] & B[2]);
/* C[1] ^= */ A[3][1] = B[1] ^ (~B[2] & B[3]);
/* C[2] ^= */ A[3][2] = B[2] ^ (~B[3] & B[4]);
/* C[3] ^= */ A[3][3] = B[3] ^ (~B[4] & B[0]);
/* C[4] ^= */ A[3][4] = B[4] ^ (~B[0] & B[1]);
B[0] = ROL64(A[4][2] ^ D[2], rhotates[0][2]);
B[1] = ROL64(A[4][3] ^ D[3], rhotates[1][3]);
B[2] = ROL64(A[4][4] ^ D[4], rhotates[2][4]);
B[3] = ROL64(A[4][0] ^ D[0], rhotates[3][0]);
B[4] = ROL64(A[4][1] ^ D[1], rhotates[4][1]);
/* C[0] ^= */ A[4][0] = B[0] ^ (~B[1] & B[2]);
/* C[1] ^= */ A[4][1] = B[1] ^ (~B[2] & B[3]);
/* C[2] ^= */ A[4][2] = B[2] ^ (~B[3] & B[4]);
/* C[3] ^= */ A[4][3] = B[3] ^ (~B[4] & B[0]);
/* C[4] ^= */ A[4][4] = B[4] ^ (~B[0] & B[1]);
}
static void KeccakF1600(uint64_t A[5][5])
{
size_t i;
for (i = 0; i < 24; i += 4) {
FourRounds(A, i);
}
}
#endif
static uint64_t BitInterleave(uint64_t Ai)
{
if (BIT_INTERLEAVE) {
uint32_t hi = (uint32_t)(Ai >> 32), lo = (uint32_t)Ai;
uint32_t t0, t1;
t0 = lo & 0x55555555;
t0 |= t0 >> 1; t0 &= 0x33333333;
t0 |= t0 >> 2; t0 &= 0x0f0f0f0f;
t0 |= t0 >> 4; t0 &= 0x00ff00ff;
t0 |= t0 >> 8; t0 &= 0x0000ffff;
t1 = hi & 0x55555555;
t1 |= t1 >> 1; t1 &= 0x33333333;
t1 |= t1 >> 2; t1 &= 0x0f0f0f0f;
t1 |= t1 >> 4; t1 &= 0x00ff00ff;
t1 |= t1 >> 8; t1 <<= 16;
lo &= 0xaaaaaaaa;
lo |= lo << 1; lo &= 0xcccccccc;
lo |= lo << 2; lo &= 0xf0f0f0f0;
lo |= lo << 4; lo &= 0xff00ff00;
lo |= lo << 8; lo >>= 16;
hi &= 0xaaaaaaaa;
hi |= hi << 1; hi &= 0xcccccccc;
hi |= hi << 2; hi &= 0xf0f0f0f0;
hi |= hi << 4; hi &= 0xff00ff00;
hi |= hi << 8; hi &= 0xffff0000;
Ai = ((uint64_t)(hi | lo) << 32) | (t1 | t0);
}
return Ai;
}
static uint64_t BitDeinterleave(uint64_t Ai)
{
if (BIT_INTERLEAVE) {
uint32_t hi = (uint32_t)(Ai >> 32), lo = (uint32_t)Ai;
uint32_t t0, t1;
t0 = lo & 0x0000ffff;
t0 |= t0 << 8; t0 &= 0x00ff00ff;
t0 |= t0 << 4; t0 &= 0x0f0f0f0f;
t0 |= t0 << 2; t0 &= 0x33333333;
t0 |= t0 << 1; t0 &= 0x55555555;
t1 = hi << 16;
t1 |= t1 >> 8; t1 &= 0xff00ff00;
t1 |= t1 >> 4; t1 &= 0xf0f0f0f0;
t1 |= t1 >> 2; t1 &= 0xcccccccc;
t1 |= t1 >> 1; t1 &= 0xaaaaaaaa;
lo >>= 16;
lo |= lo << 8; lo &= 0x00ff00ff;
lo |= lo << 4; lo &= 0x0f0f0f0f;
lo |= lo << 2; lo &= 0x33333333;
lo |= lo << 1; lo &= 0x55555555;
hi &= 0xffff0000;
hi |= hi >> 8; hi &= 0xff00ff00;
hi |= hi >> 4; hi &= 0xf0f0f0f0;
hi |= hi >> 2; hi &= 0xcccccccc;
hi |= hi >> 1; hi &= 0xaaaaaaaa;
Ai = ((uint64_t)(hi | lo) << 32) | (t1 | t0);
}
return Ai;
}
/*
* SHA3_absorb can be called multiple times, but at each invocation
* largest multiple of |r| out of |len| bytes are processed. Then
* remaining amount of bytes is returned. This is done to spare caller
* trouble of calculating the largest multiple of |r|. |r| can be viewed
* as blocksize. It is commonly (1600 - 256*n)/8, e.g. 168, 136, 104,
* 72, but can also be (1600 - 448)/8 = 144. All this means that message
* padding and intermediate sub-block buffering, byte- or bitwise, is
* caller's responsibility.
*/
size_t SHA3_absorb(uint64_t A[5][5], const unsigned char *inp, size_t len,
size_t r)
{
uint64_t *A_flat = (uint64_t *)A;
size_t i, w = r / 8;
assert(r < (25 * sizeof(A[0][0])) && (r % 8) == 0);
while (len >= r) {
for (i = 0; i < w; i++) {
uint64_t Ai = (uint64_t)inp[0] | (uint64_t)inp[1] << 8 |
(uint64_t)inp[2] << 16 | (uint64_t)inp[3] << 24 |
(uint64_t)inp[4] << 32 | (uint64_t)inp[5] << 40 |
(uint64_t)inp[6] << 48 | (uint64_t)inp[7] << 56;
inp += 8;
A_flat[i] ^= BitInterleave(Ai);
}
KeccakF1600(A);
len -= r;
}
return len;
}
/*
* SHA3_squeeze is called once at the end to generate |out| hash value
* of |len| bytes.
*/
void SHA3_squeeze(uint64_t A[5][5], unsigned char *out, size_t len, size_t r)
{
uint64_t *A_flat = (uint64_t *)A;
size_t i, w = r / 8;
assert(r < (25 * sizeof(A[0][0])) && (r % 8) == 0);
while (len != 0) {
for (i = 0; i < w && len != 0; i++) {
uint64_t Ai = BitDeinterleave(A_flat[i]);
if (len < 8) {
for (i = 0; i < len; i++) {
*out++ = (unsigned char)Ai;
Ai >>= 8;
}
return;
}
out[0] = (unsigned char)(Ai);
out[1] = (unsigned char)(Ai >> 8);
out[2] = (unsigned char)(Ai >> 16);
out[3] = (unsigned char)(Ai >> 24);
out[4] = (unsigned char)(Ai >> 32);
out[5] = (unsigned char)(Ai >> 40);
out[6] = (unsigned char)(Ai >> 48);
out[7] = (unsigned char)(Ai >> 56);
out += 8;
len -= 8;
}
if (len)
KeccakF1600(A);
}
}
#endif
#ifdef SELFTEST
/*
* Post-padding one-shot implementations would look as following:
*
* SHA3_224 SHA3_sponge(inp, len, out, 224/8, (1600-448)/8);
* SHA3_256 SHA3_sponge(inp, len, out, 256/8, (1600-512)/8);
* SHA3_384 SHA3_sponge(inp, len, out, 384/8, (1600-768)/8);
* SHA3_512 SHA3_sponge(inp, len, out, 512/8, (1600-1024)/8);
* SHAKE_128 SHA3_sponge(inp, len, out, d, (1600-256)/8);
* SHAKE_256 SHA3_sponge(inp, len, out, d, (1600-512)/8);
*/
void SHA3_sponge(const unsigned char *inp, size_t len,
unsigned char *out, size_t d, size_t r)
{
uint64_t A[5][5];
memset(A, 0, sizeof(A));
SHA3_absorb(A, inp, len, r);
SHA3_squeeze(A, out, d, r);
}
# include <stdio.h>
int main()
{
/*
* This is 5-bit SHAKE128 test from http://csrc.nist.gov/groups/ST/toolkit/examples.html#aHashing
*/
unsigned char test[168] = { '\xf3', '\x3' };
unsigned char out[512];
size_t i;
static const unsigned char result[512] = {
0x2E, 0x0A, 0xBF, 0xBA, 0x83, 0xE6, 0x72, 0x0B,
0xFB, 0xC2, 0x25, 0xFF, 0x6B, 0x7A, 0xB9, 0xFF,
0xCE, 0x58, 0xBA, 0x02, 0x7E, 0xE3, 0xD8, 0x98,
0x76, 0x4F, 0xEF, 0x28, 0x7D, 0xDE, 0xCC, 0xCA,
0x3E, 0x6E, 0x59, 0x98, 0x41, 0x1E, 0x7D, 0xDB,
0x32, 0xF6, 0x75, 0x38, 0xF5, 0x00, 0xB1, 0x8C,
0x8C, 0x97, 0xC4, 0x52, 0xC3, 0x70, 0xEA, 0x2C,
0xF0, 0xAF, 0xCA, 0x3E, 0x05, 0xDE, 0x7E, 0x4D,
0xE2, 0x7F, 0xA4, 0x41, 0xA9, 0xCB, 0x34, 0xFD,
0x17, 0xC9, 0x78, 0xB4, 0x2D, 0x5B, 0x7E, 0x7F,
0x9A, 0xB1, 0x8F, 0xFE, 0xFF, 0xC3, 0xC5, 0xAC,
0x2F, 0x3A, 0x45, 0x5E, 0xEB, 0xFD, 0xC7, 0x6C,
0xEA, 0xEB, 0x0A, 0x2C, 0xCA, 0x22, 0xEE, 0xF6,
0xE6, 0x37, 0xF4, 0xCA, 0xBE, 0x5C, 0x51, 0xDE,
0xD2, 0xE3, 0xFA, 0xD8, 0xB9, 0x52, 0x70, 0xA3,
0x21, 0x84, 0x56, 0x64, 0xF1, 0x07, 0xD1, 0x64,
0x96, 0xBB, 0x7A, 0xBF, 0xBE, 0x75, 0x04, 0xB6,
0xED, 0xE2, 0xE8, 0x9E, 0x4B, 0x99, 0x6F, 0xB5,
0x8E, 0xFD, 0xC4, 0x18, 0x1F, 0x91, 0x63, 0x38,
0x1C, 0xBE, 0x7B, 0xC0, 0x06, 0xA7, 0xA2, 0x05,
0x98, 0x9C, 0x52, 0x6C, 0xD1, 0xBD, 0x68, 0x98,
0x36, 0x93, 0xB4, 0xBD, 0xC5, 0x37, 0x28, 0xB2,
0x41, 0xC1, 0xCF, 0xF4, 0x2B, 0xB6, 0x11, 0x50,
0x2C, 0x35, 0x20, 0x5C, 0xAB, 0xB2, 0x88, 0x75,
0x56, 0x55, 0xD6, 0x20, 0xC6, 0x79, 0x94, 0xF0,
0x64, 0x51, 0x18, 0x7F, 0x6F, 0xD1, 0x7E, 0x04,
0x66, 0x82, 0xBA, 0x12, 0x86, 0x06, 0x3F, 0xF8,
0x8F, 0xE2, 0x50, 0x8D, 0x1F, 0xCA, 0xF9, 0x03,
0x5A, 0x12, 0x31, 0xAD, 0x41, 0x50, 0xA9, 0xC9,
0xB2, 0x4C, 0x9B, 0x2D, 0x66, 0xB2, 0xAD, 0x1B,
0xDE, 0x0B, 0xD0, 0xBB, 0xCB, 0x8B, 0xE0, 0x5B,
0x83, 0x52, 0x29, 0xEF, 0x79, 0x19, 0x73, 0x73,
0x23, 0x42, 0x44, 0x01, 0xE1, 0xD8, 0x37, 0xB6,
0x6E, 0xB4, 0xE6, 0x30, 0xFF, 0x1D, 0xE7, 0x0C,
0xB3, 0x17, 0xC2, 0xBA, 0xCB, 0x08, 0x00, 0x1D,
0x34, 0x77, 0xB7, 0xA7, 0x0A, 0x57, 0x6D, 0x20,
0x86, 0x90, 0x33, 0x58, 0x9D, 0x85, 0xA0, 0x1D,
0xDB, 0x2B, 0x66, 0x46, 0xC0, 0x43, 0xB5, 0x9F,
0xC0, 0x11, 0x31, 0x1D, 0xA6, 0x66, 0xFA, 0x5A,
0xD1, 0xD6, 0x38, 0x7F, 0xA9, 0xBC, 0x40, 0x15,
0xA3, 0x8A, 0x51, 0xD1, 0xDA, 0x1E, 0xA6, 0x1D,
0x64, 0x8D, 0xC8, 0xE3, 0x9A, 0x88, 0xB9, 0xD6,
0x22, 0xBD, 0xE2, 0x07, 0xFD, 0xAB, 0xC6, 0xF2,
0x82, 0x7A, 0x88, 0x0C, 0x33, 0x0B, 0xBF, 0x6D,
0xF7, 0x33, 0x77, 0x4B, 0x65, 0x3E, 0x57, 0x30,
0x5D, 0x78, 0xDC, 0xE1, 0x12, 0xF1, 0x0A, 0x2C,
0x71, 0xF4, 0xCD, 0xAD, 0x92, 0xED, 0x11, 0x3E,
0x1C, 0xEA, 0x63, 0xB9, 0x19, 0x25, 0xED, 0x28,
0x19, 0x1E, 0x6D, 0xBB, 0xB5, 0xAA, 0x5A, 0x2A,
0xFD, 0xA5, 0x1F, 0xC0, 0x5A, 0x3A, 0xF5, 0x25,
0x8B, 0x87, 0x66, 0x52, 0x43, 0x55, 0x0F, 0x28,
0x94, 0x8A, 0xE2, 0xB8, 0xBE, 0xB6, 0xBC, 0x9C,
0x77, 0x0B, 0x35, 0xF0, 0x67, 0xEA, 0xA6, 0x41,
0xEF, 0xE6, 0x5B, 0x1A, 0x44, 0x90, 0x9D, 0x1B,
0x14, 0x9F, 0x97, 0xEE, 0xA6, 0x01, 0x39, 0x1C,
0x60, 0x9E, 0xC8, 0x1D, 0x19, 0x30, 0xF5, 0x7C,
0x18, 0xA4, 0xE0, 0xFA, 0xB4, 0x91, 0xD1, 0xCA,
0xDF, 0xD5, 0x04, 0x83, 0x44, 0x9E, 0xDC, 0x0F,
0x07, 0xFF, 0xB2, 0x4D, 0x2C, 0x6F, 0x9A, 0x9A,
0x3B, 0xFF, 0x39, 0xAE, 0x3D, 0x57, 0xF5, 0x60,
0x65, 0x4D, 0x7D, 0x75, 0xC9, 0x08, 0xAB, 0xE6,
0x25, 0x64, 0x75, 0x3E, 0xAC, 0x39, 0xD7, 0x50,
0x3D, 0xA6, 0xD3, 0x7C, 0x2E, 0x32, 0xE1, 0xAF,
0x3B, 0x8A, 0xEC, 0x8A, 0xE3, 0x06, 0x9C, 0xD9
};
test[167] = '\x80';
SHA3_sponge(test, sizeof(test), out, sizeof(out), sizeof(test));
/*
* Rationale behind keeping output [formatted as below] is that
* one should be able to redirect it to a file, then copy-n-paste
* final "output val" from official example to another file, and
* compare the two with diff(1).
*/
for (i = 0; i < sizeof(out);) {
printf("%02X", out[i]);
printf(++i % 16 && i != sizeof(out) ? " " : "\n");
}
if (memcmp(out,result,sizeof(out))) {
fprintf(stderr,"failure\n");
return 1;
} else {
fprintf(stderr,"success\n");
return 0;
}
}
#endif
|
the_stack_data/103893.c | int while_continue()
{
int sum1 = 0;
int sum2 = 0;
while (sum1 < 30)
{
sum1++;
if (sum1 > 15)
{
continue;
}
sum2++;
}
return sum1 + sum2;
} |
the_stack_data/1132646.c | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
int fd;
printf("Content-type: text/html\n\n");
fd = open("/dev/leds", 0);
if (fd < 0)
{
perror("open device /dev/leds");
exit(1);
}
ioctl(fd, 1, 1);
ioctl(fd, 2, 1);
ioctl(fd, 3, 1);
close(fd);
printf("receive order");
fflush(stdout);
return 0;
}
|
the_stack_data/115764606.c | #include <stdio.h>
void print_put(void) { printf("To C, or not to C: that is the question.\n"); }
int main() {
print_put();
return 0;
} |
the_stack_data/142609.c | #include <ctype.h>
#include <stdbool.h>
#include <stdlib.h>
long atol(const char* str)
{
long val = 0;
bool neg = false;
while(isspace(*str))
{
str++;
}
switch(*str)
{
case '-':
neg = true;
// intentional fallthrough
case '+':
str++;
}
while(isdigit(*str))
{
val = (10 * val) + (*str++ - '0');
}
return neg ? -val : val;
}
|
the_stack_data/104828739.c | short
inner_product (short *a, short *b)
{
int i;
short sum = 0;
for (i = 9; i >= 0; i--)
sum += (*a++) * (*b++);
return sum;
}
|
the_stack_data/870193.c | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_LENGTH 1000 //Число взято произвольно
#define SET_BIT(i) (1 << (i))
#define GET_BIT(arr, index) (1 & ((arr) >> (index)))
//#define DEBUG
#ifdef DEBUG
#define out printf
#define newline putchar('\n');
#define SHOW_RECURSION_DEPTH(i) {int k; for(k = 0; k < i; ++k) printf(" |");}
#else
#define out
#define newline
#define SHOW_RECURSION_DEPTH(i)
#endif
//char *place type **arr уже должны быть объявлены
#define MATRIX_MALLOC(place, arr, M, N, type) { \
int i; \
int col_size = (M)*sizeof(type *); \
int str_size = (N)*sizeof(type); \
place = (char *)malloc(col_size + (M)*str_size); \
arr = (type **)(place); \
for(i = 0; i < (M); ++i){ \
arr[i] = (type *)((place) + col_size + i*str_size); \
}\
}
int pref_func1(char *str1);
int pref_func2(char *str2, char *str1);
void init_matrix(int n);
void permut(short arr, int nel);
short init_arr(int m);
short erase_q_arr(short arr, int q);
int *add_q_cort(int *cort, int q, int i);
void show_cort(int *cort, int nel);
char **container; //Хранилище строк
int **matrix; //матрица смежности
int pref[MAX_LENGTH*2+1];
int *pi;
int main(void)
{
int n, i;
scanf("%d ", &n);
// Выделение памяти под строки и считывание
char *place1;
MATRIX_MALLOC(place1, container, n, MAX_LENGTH, char);
for (i = 0; i < n; ++i){
scanf("%s", container[i]);
// out("%s, ", container[i]);
}
char *place2;
MATRIX_MALLOC(place2, matrix, n, n, int);
init_matrix(n);
permut(init_arr(n), n);
// Освобождение выделенной ранее памяти
free(place1);
free(place2);
return 0;
}
/*---------Построение префиксных функций и вычисление длины первой строки-----------
---------------за вычетом длины пересечения со сторой строкой----------------------*/
//Строим префиксную функцию для строки S, полученной конкатенацией
//двух строк. Наибольшая грань S = str1+str2 есть наибольшая
// длина пересечения строк str2#str1
// Сначала строим обыкновенную префиксную функцию для второй строки пересечения (str1)
// (она же первая подстрока строки S) в pref_func1, потом достраиваем pi для всей S.
// Так как нужно вычислять каждое пересечение str_x#str1, то имеет смысл заполнять матрицу
// построчно, сначала вычислив один раз префиксную функцию для str1, а потом достраивая
// для каждой другой строки.
// Длину строки, являющуюся последним вычисленным индексом i по завершении внешнего цикла
// также удобно хранить первым элементом массива, чтобы не тратить время на ее последующее
// вычисление (поэтому оставляем дополнительную ячейку в массиве
// pref = {длина второй строки пересечения, собственно массив pi)
int pref_func1(char *str1)
{
out("PREF_FUNC_1 %s\n", str1);
pi = pref + 1;
int i, t;
pi[0] = t = 0;
for (i = 1; str1[i]; ++i){
while (t && str1[t] != str1[i]){
t = pi[t-1];
}
if (str1[t] == str1[i]){
++t;
}
pi[i] = t;
}
return pref[0] = i;
}
//Возвращает букву с текущим индексом из первого массива, если индекс меньше его длины
// и соответствующую букву из второго массива, если мы вышли за границу первого
#define STR1_t ((t < len1) ? str1[t] : str2[t - len1])
// Возвращает длину второй строки (которая при взятии пересечения идет первой),
// уменьшенную на длину пересечения
int pref_func2(char *str2, char *str1)
{
// pref_func1(str1);
out("PREF_FUNC str2 = %s, str1 = %s\n", str2, str1);
//Достраиваем префиксную функцию, используя вторую строку
//как продолжение первой
int len1 = pref[0]; //Длина первого слова
int i, t = pi[len1];
for (i = len1; str2[i-len1]; ++i){
while (t && STR1_t != str2[i-len1]){
t = pi[t-1];
}
if (STR1_t == str2[i-len1]){
++t;
}
pi[i] = t;
}
int len2 = i - len1;
//Если при наложении строк друг на друга мы получили отрицательный сдвиг,
//переходим к следующей по длине грани и т.д.
while(t > len2){
out("pi[%d] = %d, ", t-1, pi[t-1]);
t = pi[t-1];
}
out("str2 = %s str1 = %s\nSUM_LENGTH = %d, last pi = %d\n", str2, str1, i, pi[i-1]);
out("LEN_OF_SECOND = %d, LEN_WITOUT_CROSS = %d\n\n", i - len1, len2 - pi[i-1]);
return len2-t;
}
/*--------------Заполнение матрицы смежности ----------*/
//Построчно, чтобы не вычислять n раз префиксную функцию для одной и той же строки
void init_matrix(int n)
{
int i, j;
for(j = 0; j < n; ++j){
pref_func1(container[j]);
for(i = 0; i < n; ++i){
if(i != j){
matrix[i][j] = pref_func2(container[i], container[j]);
}
}
}
}
/*------------Вычисление перестановок и длины кратчайшей суперстроки---------*/
int shortest; //Длина текущей кратчайшей суперстроки
//Подсчет длины суперстроки, получающейся из текущей перестановки строк
void count_least(int *cort, int nel)
{
int i, current;
for(i = current = 0; i < nel-1; ++i){
current += matrix[cort[i]][cort[i+1]];
}
current += strlen(container[cort[i]]);
out("CURRENT_LEN = %d", current);
if(current < shortest){
shortest = current;
}
}
//Размещения без повторений из m элементов по nel-элементому множеству
void permut_rec(short arr, int nel, int counter, int *cort)
{
if(counter == nel){
// show_cort(cort, counter);
count_least(cort, nel);
newline;
} else {
int i;
for(i = 0; i < nel; ++i){
if(GET_BIT(arr, i)){
permut_rec(erase_q_arr(arr, i), nel, counter + 1, add_q_cort(cort, i, counter));
}
}
}
}
void permut(short arr, int nel)
{
int *cort = (int *)calloc(nel, sizeof(int));
shortest = 10*MAX_LENGTH;
permut_rec(arr, nel, 0, cort);
free(cort);
out("SHORTEST = ");
printf("%d\n", shortest);
}
//-------------Функции обработки множества, хранящегося в цeлом числе и кортежа, хрян. в массиве----------
//Отметить все элементы, как принадлежащие множеству
short init_arr(int m)
{
return SET_BIT(m)-1;
}
//Возвращает массив с удаленным элементом q
short erase_q_arr(short arr, int q)
{
return GET_BIT(arr, q) ? (arr ^ SET_BIT(q)) : arr;
}
int *add_q_cort(int *cort, int q, int i)
{
cort[i] = q;
return cort;
}
void show_cort(int *cort, int nel)
{
int i;
for(i = 0; i < nel; ++i){
printf("[%d]%s ", cort[i], container[cort[i]]);
}
newline;
} |
the_stack_data/763631.c | /* Sequencer Firmware Srecord */
char sequencer_srec[] = {\
"\
S010000073657175656E6365722E72756EA1\
S31500000000FCBF00000D0100003D0100003D010000A5\
S3150000001049010000490100004901000049010000B2\
S3150000002049010000490100004901000049010000A2\
S315000000304901000049010000490100004901000092\
S315000001000022014B1A707047B46D0000012080F385\
S3150000011010880C4885460020011C021C031C041C88\
S31500000120051C061C071C804681468246834684467B\
S31500000130002000F00BF804F037FD05E0069804F007\
S31500000140C1FC01E0FCBF0000FEE7C046064B074AC3\
S31500000150934208D80321D21A8A43002104329A18FE\
S3150000016002C39342FCD17047406A0000247000002D\
S31500000170F0B557464546DE464E46E0B5AB4B87B032\
S315000001809A461B68050001910293834200D17DE1E6\
S315000001902E006B894C3601336B81A54B00271B78EB\
S315000001A00393013BDBB29B461DE08A8971888C462E\
S315000001B09988884661465118414540DB6146444668\
S315000001C0091B521892B2198901374A43B18852184D\
S315000001D0F1881036016019885B881B040B439A1856\
S315000001E08260092F2FD03A01AA1848325388118805\
S315000001F01B040B4327D03289E88801325100891845\
S31500000200AA88000410433288C90080185A46591833\
S31500000210012ACAD98A89019C94467288C98990465E\
S315000002209A88614391466246424452184A4508DB21\
S3150000023042464C46121B6244521892B2C3E78AB237\
S31500000240C1E792B2BFE76A8B2B8B12041A4300D127\
S31500000250AAE0E988A888090401430398AB8B013812\
S315000002605918C3B2012B00D8C7E0138A968898465E\
S31500000270B446538A019EEC8B734344441B199C4538\
S3150000028000DDC2E064461B1B9BB2148963432C8CC1\
S315000002901B196C8C0C601488528812042243D318E4\
S315000002A08B60EA8CAB8C12041A4300D17CE0E9889F\
S315000002B0AC882B8D090421435918C3B2012B00D8F1\
S315000002C0A5E0138A96889846B446538A019E6C8D9B\
S315000002D0734344441B199C4500DDA0E064461B1B88\
S315000002E09BB214896343AC8D1B19EC8D0C6014888A\
S315000002F0528812042243D3188B606B8E2A8E1B04FD\
S31500000300134351D0EC88A988AA8E24040C431419EF\
S31500000310C2B2012A00D891E0198AEA8E9E889146D7\
S315000003208C46B0465A8A019ECC44724394444A4451\
S315000003308A18E04500DD77E04146521A92B21989E3\
S315000003404A43298F5218698F216019885B881B04DC\
S315000003500B439A18A260EB8FAA8F1B04134323D07A\
S31500000360EC88AA88240414434022AA5AC0B2A418CE\
S315000003701A8A9446012800D96BE0280099884030F3\
S315000003808846614642888918414500DB74E08AB296\
S3150000039019894A4381885218C188216019885B8867\
S315000003A01B040B439A18A260EB88AA881B0413430C\
S315000003B00199AA8A8E18B6B29E60029B9D4200D110\
S315000003C06FE0EB88AA881B0413436A8A298A120401\
S315000003D00A431A606B882A881B0413430BD0154AFC\
S315000003E001202B890133136007B03CBC9046994627\
S315000003F0A246AB46F0BD104AF2E7138A94889C46A3\
S31500000400EB8B63449C4200DC1B1B9BB23DE7138ACB\
S3150000041094889C466B8D63449C4200DC1B1B9BB2FC\
S315000004205FE76646891B521892B288E7406A000069\
S31500000430B46D00004C200040182000409E881A8AA7\
S31500000440B446E98E56186645EBDA69468E818A8986\
S3150000045075E72800403041889E888846B1465A8A0A\
S31500000460019EE04472439044C8450BDB4E46921B06\
S3150000047062448A1892B28BE761464646891B521837\
S3150000048092B285E762448A1892B281E753469B8806\
S315000004900422190091430FD001339BB25246938038\
S315000004A076E6EB88AA881B041343524651894A0014\
S315000004B0521892001A608DE75346DB880020002B05\
S315000004C000D191E704F0E5FE0590059B002B00D1D5\
S315000004D072B653461B89184A5B009A5A534692B223\
S315000004E05A811B89FE2B1FDD53461B89FF3B9BB29E\
S315000004F051460B81CB88013B9BB2CB80059B002BE1\
S3150000050000D162B653469B890C4958004252FE2BD5\
S315000005100FDDFF3B9BB252469381D3890133D381D2\
S31500000520136802930123B9E753461B8901339BB233\
S31500000530DEE701339BB2EEE724700000B06B0000EB\
S3150000054030B583B004000D0004F0A3FE0190019BBA\
S31500000550002B00D172B6002D23D017480388002B3C\
S3150000056020D080239B051968144A4A8002220A80FB\
S315000005705A6823781370002B1BD0551C531CFF356B\
S31500000580A21A02E00133AB4203D09C5C1C70002C23\
S31500000590F8D100221A700A4B02801960094B4032CA\
S315000005A01A60FEE70388002BDBD10388002BF9D005\
S315000005B0D7E71300EDE7C046306A000009100000D7\
S315000005C0081000400C1000403D4B1A6901321A61B8\
S315000005D05A69002A02D0198B002925D0394A118878\
S315000005E000291AD0802189050968374848800220E9\
S315000005F0088018698880000CC880588B0881002004\
S31500000600108032480160402031490860D9690029CC\
S3150000061002D01B69994230D0704711880029E1D178\
S3150000062011880029F9D0DDE7013A5A61002AD5D1AF\
S3150000063028491F320A6028490A6028490A60284961\
S315000006400A6028490A6028490A6028490A60284938\
S315000006500A6028490A6028490A6028490A60284928\
S315000006600A60184A1188002922D080218905096864\
S315000006702448488002200880C1E71388002B10D048\
S3150000068080239B051B68204959800221198000217F\
S3150000069011800E490B6040210D4B196002239370A7\
S315000006A0BAE71388002BEBD11388002BF9D0E7E7C4\
S315000006B011880029D9D111880029F9D0D5E7C0467B\
S315000006C0406A0000306A0000021000000810004076\
S315000006D00C10004004250240043502400445024047\
S315000006E00455024004650240047502400485024038\
S315000006F004950240042504400435044004450440A2\
S31500000700045504400410000001100000F0B5DE4658\
S3150000071057464E464546E0B54389C28A5B1A87B0BE\
S315000007204381002A06D0838ACB189BB283829A42E1\
S3150000073000D88CE2B84B1A68904200D18EE2B74AD4\
S31500000740048B1278002A00D0EEE2428B1204224378\
S315000007502ED0D489958924042C43A04201D100F0DF\
S31500000760A7FDC28C848C1204224321D0D48995899A\
S3150000077024042C43A04201D100F0DCFD428E048EFD\
S315000007801204224314D0D489958924042C43A04210\
S3150000079001D100F0F0FDC28F848F1204224307D0EE\
S315000007A0D489958924042C43A04201D100F0A5FDEB\
S315000007B04822845A0232825A1204224300D13FE26E\
S315000007C054249388075B9C467E00F519ED00551965\
S315000007D0EC8CAD8C4C43A4B22B19634501DB00F0C5\
S315000007E0AFFC6D462B802B8898464346F519ED00E5\
S315000007F05519AB842B8D9C466444A4B22C85958AEE\
S31500000800A54204D20225844B5C8B2C435C83D4899D\
S31500000810958924042C4304D080245589A4012C43B3\
S315000008205481F419E40012198024558D64012C4377\
S3150000083054855822845A0232825A1204224300D125\
S31500000840FEE164249388075B9C467E00F519ED0063\
S315000008505519EC8CAD8C4C43A4B22B19634501DBC6\
S3150000086000F07FFC6D462B802B8898464346F51991\
S31500000870ED005519AB842B8D9C466444A4B22C859F\
S31500000880958AA54204D20225634B5C8B2C435C837C\
S31500000890D489958924042C4304D080245589A40145\
S315000008A02C435481F419E40012198024558D6401F7\
S315000008B02C4354856822845A0232825A12042243F7\
S315000008C000D1BDE174249388075B9C467E00F51930\
S315000008D0ED005519EC8CAD8C4C43A4B22B19634535\
S315000008E001DB00F046FC6D462B802B88984643467C\
S315000008F0F519ED005519AB842B8D9C466444A4B2C2\
S315000009002C85958AA54204D20225434B5C8B2C4349\
S315000009105C83D489958924042C4304D0802455898A\
S31500000920A4012C435481F419E40012198024558D36\
S3150000093064012C4354857822845A0232825A120466\
S31500000940224300D17CE184249388075B9C467E0089\
S31500000950F519ED005519EC8CAD8C4C43A4B22B194E\
S31500000960634501DB00F00DFC6D462B802B88984615\
S315000009704346F519ED005519AB842B8D9C4664440E\
S31500000980A4B22C85958AA54204D20225224B5C8B03\
S315000009902C435C83D489958924042C4304D0802479\
S315000009A05589A4012C435481F419E40012198024BA\
S315000009B0558D64012C4354858822845A0232825A0A\
S315000009C01204224300D13BE194249388075B9C46A2\
S315000009D07E00F519ED005519EC8CAD8C4C43A4B294\
S315000009E02B19634501DB00F0D4FB6D462B802B8869\
S315000009F098464346F519ED005519AB842B8D9C4658\
S31500000A006444A4B22C85958AA54209D20225024BDC\
S31500000A105C8B2C435C8303E0406A0000B46D0000ED\
S31500000A20D489958924042C4304D080245589A401B3\
S31500000A302C435481F419E40012198024558D640165\
S31500000A402C4354859822845A0232825A1204224335\
S31500000A5000D1F5E0A4249388075B9C467E00F51937\
S31500000A60ED005519EC8CAD8C4C43A4B22B196345A3\
S31500000A7001DB00F096FB6D462B802B88984643469B\
S31500000A80F519ED005519AB842B8D9C466444A4B230\
S31500000A902C85958AA54204D20225A04B5C8B2C435B\
S31500000AA05C83D489958924042C4304D080245589F9\
S31500000AB0A4012C435481F419E40012198024558DA5\
S31500000AC064012C435485A822845A0232825A1204A5\
S31500000AD0224300D1B4E0B4249388075B9C467E0091\
S31500000AE0F519ED005519EC8CAD8C4C43A4B22B19BD\
S31500000AF0634501DB00F05DFB6D462B802B88984635\
S31500000B004346F519ED005519AB842B8D9C4664447C\
S31500000B10A4B22C85958AA54204D202257F4B5C8B14\
S31500000B202C435C83D489958924042C4304D08024E7\
S31500000B305589A4012C435481F419E4001219802428\
S31500000B40558D64012C435485B822845A0232825A48\
S31500000B501204224300D173E0C4249388075B9C46A9\
S31500000B607E00F519ED005519EC8CAD8C4C43A4B202\
S31500000B702B19634501DB00F05DFB6D462B802B884E\
S31500000B8098464346F519ED005519AB842B8D9C46C6\
S31500000B906444A4B22C85958AA54204D202255F4BF3\
S31500000BA05C8B2C435C83D489958924042C4304D024\
S31500000BB080245589A4012C435481F419E4001219A8\
S31500000BC08024558D64012C435485CA24C822045BB5\
S31500000BD0825A2404144333D0D422865AA788750037\
S31500000BE0A819C0002018C28C808C4A4392B2811882\
S31500000BF0B94200DA26E3D11B411889B2A819C00010\
S31500000C0020188184018D521892B20285A18A9142E0\
S31500000C1004D20221414B5A8B0A435A83E389A289A3\
S31500000C201B04134304D0802362899B011343638111\
S31500000C30AA19D200A4188022618D52010A43628546\
S31500000C4007B03CBC90469946A246AB46F0BD012390\
S31500000C508381324B1A68904200D070E5002901D199\
S31500000C6000F0CCFB1C8C5A6A1F8DDB8988469C469B\
S31500000C702B4B0E0003931D7800239A460193029393\
S31500000C80009304336146A14684469B465046002D98\
S31500000C9000D0C3E225005B469D4319D1214B7A0063\
S31500000CA0D25AFE2F00DC00E3FF3FBFB2500080188F\
S31500000CB080006044428B048B0023120422430120EF\
S31500000CC0002401399946013389B2019302930093B6\
S31500000CD0D58993892D041D4300D1B9E2558A108A1E\
S31500000CE093884019984200DBC01AC0231082908A6C\
S31500000CF09B012D185089013E18430134B6B29582E6\
S31500000D005081A4B2002E01D100F05CFB25005B46A9\
S31500000D100120A1469D43DBD1C0E7C046406A0000E2\
S31500000D20B46D0000B06B0000428B1204224300D168\
S31500000D3064E0D489958924042C4300D1F5E1548AD2\
S31500000D40158A4C439788A4B22E19BE4200DBD0E226\
S31500000D50B5B21582958A64199482C28C848C120469\
S31500000D6022434BD0D489958924042C4300D1DCE15D\
S31500000D70548A158A4C439788A4B22E19BE4200DACB\
S31500000D801CE3E71BED19ADB21582958A64199482AE\
S31500000D90428E048E1204224330D0D48995892404CD\
S31500000DA02C4300D1C1E1548A158A4C439788A4B2DA\
S31500000DB02E19BE4200DA03E3E71BED19ADB2158228\
S31500000DC0958A64199482C28F848F1204224315D0A7\
S31500000DD0D489958924042C4300D1A6E1548A158A26\
S31500000DE04C439688A4B22F19B74200DA04E3A61B37\
S31500000DF0AD19ADB21582958A641994824A244822A7\
S31500000E00065B825A3604164300D119E75422875AE4\
S31500000E107A00D519ED007519AB8CEC8C9C46B3881D\
S31500000E204C4398466346A4B21D19A84500DC93E1DD\
S31500000E30ADB2D219D200B2189584158D6419A4B238\
S31500000E401485B28AA24204D20224C14B5A8B224391\
S31500000E505A835A245822065B825A3604164300D116\
S31500000E60EEE66422875A7A00D519ED007519AB8C27\
S31500000E70EC8C9C46B3884C4398466346A4B21D1935\
S31500000E80454500DAE0E14346E51A6544ADB2D219BC\
S31500000E90D200B2189584158D6419A4B21485B28A4D\
S31500000EA0A24204D20224AA4B5A8B22435A836A24B2\
S31500000EB06822065B825A3604164300D1C0E67422C5\
S31500000EC0875A7A00D519ED007519AB8CEC8C9C46C7\
S31500000ED0B3884C4398466346A4B21D19454500DACB\
S31500000EE0B4E14346E51A6544ADB2D219D200B21850\
S31500000EF09584158D6419A4B21485B28AA24204D2CF\
S31500000F000224934B5A8B22435A837A247822065B17\
S31500000F10825A3604164300D192E68422875A7A0012\
S31500000F20D519ED007519AB8CEC8C9C46B3884C43F7\
S31500000F3098466346A4B21D19454500DAA7E1434623\
S31500000F40E51A6544ADB2D219D200B2189584158D52\
S31500000F506419A4B21485B28AA24204D202247C4B3C\
S31500000F605A8B22435A838A248822065B825A360485\
S31500000F70164300D164E69422875A7A00D519ED000B\
S31500000F807519AB8CEC8C9C46B3884C4398466346EB\
S31500000F90A4B21D19454500DA7BE14346E51A6544CE\
S31500000FA0ADB2D219D200B2189584158D6419A4B2C7\
S31500000FB01485B28AA24204D20224654B5A8B22437C\
S31500000FC05A839A249822065B825A3604164300D125\
S31500000FD036E6A422875A7A00D519ED007519AB8C2E\
S31500000FE0EC8C9C46B3884C4398466346A4B21D19C4\
S31500000FF0454500DA4FE14346E51A6544ADB2D219DC\
S31500001000D200B2189584158D6419A4B21485B28ADB\
S31500001010A24204D202244E4B5A8B22435A83AA245C\
S31500001020A822065B825A3604164300D108E6B4228B\
S31500001030875A7A00D519ED007519AB8CEC8C9C4655\
S31500001040B3884C4398466346A4B21D19454500DA59\
S3150000105023E14346E51A6544ADB2D219D200B2186F\
S315000010609584158D6419A4B21485B28AA24204D25D\
S315000010700224374B5A8B22435A83BA24B822065B82\
S31500001080825A3604164300D1DAE5C422875A7A001A\
S31500001090D519ED007519AB8CEC8C9C46B3884C4386\
S315000010A098466346A4B21D19454500DAF7E0434663\
S315000010B0E51A6544ADB2D219D200B2189584158DE1\
S315000010C06419A4B21485B28AA24204D20224204B27\
S315000010D05A8B22435A83CA24C822045B825A2404A8\
S315000010E0144300D1ACE5D422855A6A005019C000D9\
S315000010F02018C68C808C7143A68889B20F18BE4210\
S3150000110000DCCEE0B8B25219D200A2189084108D3D\
S31500001110091889B21185A28A8A4200D390E5022174\
S315000011200B4B5A8B0A435A838AE504F0B2F80590B2\
S31500001130059B002B00D172B601210648FFF700FA85\
S315000011406346E31A9C466544ABB29846FFF74DFBEF\
S31500001150406A00009C6700004346E51A6544ADB24C\
S3150000116067E66346E31A9C466544ABB29846FFF7CA\
S315000011707DFB6346E31A9C466544ABB29846FFF78F\
S31500001180B6FB6346E31A9C466544ABB29846FFF746\
S31500001190EFFB6346E31A9C466544ABB29846FFF7FD\
S315000011A028FC6346E31A9C466544ABB29846FFF7B3\
S315000011B066FC6346E31A9C466544ABB29846FFF765\
S315000011C09FFC0137BFB25000801880006044428BFC\
S315000011D0048B00231204224301200024013999467E\
S315000011E0013389B2019302930093D58993892D0423\
S315000011F01D432DD0558A108A93884019984200DBEA\
S31500001200C01A1082908A013E2D180134B6B295821A\
S31500001210A4B2002E00D1D5E00120A14625005B46F0\
S315000012209D43E2D17A4B7A00D25AFE2FC9DDFF3FA9\
S31500001230BFB2C8E76346E31A9C466544ABB298461C\
S31500001240FFF79FFC89B2D9E4ADB220E6ADB24CE619\
S31500001250009B82468C46002B00D0D5E0029B002BDB\
S3150000126001D06C4B1F85019B002B02D06346694A57\
S31500001270D3815346002B02D04B46664A138404F0B2\
S3150000128008F80490049B002B00D055E753E7ADB255\
S3150000129059E6ADB285E6ADB2B1E6ADB2DDE6ADB2C8\
S315000012A009E78E1B801980B22DE70137BFB2FDE436\
S315000012B05689F30401D5FFF754FA002800D134E724\
S315000012C0548A158A4C439788A4B22B19BB420CDB6F\
S315000012D0E71BED19ADB21582958A64199482C02474\
S315000012E0A40134435481FFF73CFA6D462B802D88C8\
S315000012F0F1E7E71BED19ADB22BE55789FB0401D5E4\
S31500001300FFF756FA002800D10FE7548A168A4C4395\
S315000013109388A4B235199D424EDBE51A7519ADB214\
S315000013201582958A64199482C024A4013C43548191\
S31500001330FFF73EFA5689F30401D5FFF71FFA002896\
S3150000134000D1F2E6548A158A4C439788A4B22B1929\
S31500001350BB420CDBE71BED19ADB21582958A641909\
S315000013609482C024A40134435481FFF707FA6D46E2\
S315000013702B802D88F1E75689F30401D5FFF70BFA88\
S31500001380002800D1D1E6548A158A4C439788A4B226\
S315000013902B19BB420CDBE71BED19ADB21582958A02\
S315000013A064199482C024A40134435481FFF7F3F9ED\
S315000013B06D462B802D88F1E7ADB2B1E7B5B2E3E417\
S315000013C0B5B2FCE4009B60468C464146002B18D122\
S315000013D0029B002B01D00F4B1F85019B002B02D0D7\
S315000013E063460C4AD3810B4B1C84039B1A78002A54\
S315000013F001D1FFF7DDF901E5BDB2FBE4064B03932E\
S31500001400F4E7044B5A62E3E7024B5A6226E7C0460A\
S31500001410B06B0000406A0000B46D0000F0B54546B0\
S31500001420DE4657464E46E0B5AC4B83B09B8804007B\
S315000014300D009846002B00D18BE0438B028B1B04DA\
S3150000144013433AD05B891B051B0D1A1CFF2B00D9D1\
S31500001450FF2292B2954200D3A6E0E38CA18C1B0436\
S315000014600B432AD05B891B051B0D191C934200D91F\
S31500001470111C8AB2954200D396E0638E218E1B041E\
S315000014800B431AD05B891B051B0D191C934200D90F\
S31500001490111C8AB2954200D386E0E38FA18F1B040C\
S315000014A00B430AD05B891B051B0D191C934200D9FF\
S315000014B0111C89B2A94200D876E020000026FF2739\
S315000014C054303201A2184832538811881B040B434A\
S315000014D000D1EFE001884A1C944652006244D200D3\
S315000014E09A18002A00D1E5E04A005218D2009B184B\
S315000014F0198C5B8D1B051B0D984601295ED9002BA7\
S3150000150054D08B4250D3002201E0994202D80132D6\
S315000015105B1AFAD1131C92B2BA4251D89FB2BD429D\
S3150000152042D201361030092ECBD17F1BBBB2994671\
S31500001530E38A002B12D04A46A18A8A1852199A4287\
S315000015400CDDD21A91452FDD5B1B5B1A9BB29946C7\
S3150000155004E04389002B29D1013399460023604FCB\
S315000015609846BA46BB464B46002B1FD0E388A28856\
S315000015701B0413435B689B0518D4668823883604CE\
S315000015801E43012E3DD0002E1CD0022E4CD0032E21\
S315000015902CD003F07EFE0190019B002B00D172B689\
S315000015A001215048FEF7CCFF00239846404603B081\
S315000015B03CBC90469946A246AB46F0BDBB42ADD96F\
S315000015C03B1CABE729002000FEF7D2FD002813D014\
S315000015D05246D16A012223899A400A4351465B004A\
S315000015E0CA6253441A8E013292B21A8643460133B6\
S315000015F09BB298460135ADB24B46013B9BB299462C\
S31500001600B1E729002000FEF7B3FD0028F4D02389B6\
S3150000161044219E403A6C5B0016433E64FB185A5ABE\
S31500001620013292B25A52E1E72389012B3FD0002BB7\
S315000016300CD0072B37D903F02CFE0190019B002B11\
S3150000164000D172B601212848FEF77AFF4C216A00C4\
S315000016505A44535A01339BB25352244B1B681E42C1\
S3150000166031D15A466C237021D35A5A005A445552E6\
S315000016700E2B25DC01339BB26C2259468B5201217D\
S315000016800800A8401A4A138A013313825369034398\
S315000016905361238996699940314391616289024376\
S315000016A06281144A1560144A013313609EE7638110\
S315000016B00123F8E700239946BD4200D338E734E713\
S315000016C00F3B9BB2D8E703F0E4FD0190019B002B92\
S315000016D000D172B601210948FEF732FF306A0000D8\
S315000016E0406A0000BC670000406800001800024025\
S315000016F0C06A00000800024078200040AC67000085\
S3150000170030B583B0002918D1C38882881B041343DF\
S31500001710C022D2009446012263441A60C18883889D\
S315000017200904194361440A681B4B012403E0013B89\
S315000017300A68002B25D01442F9D1DA22D823825A1E\
S31500001740C35A12041A431AD0DC23C45A002C16D0EA\
S315000017501300013CA4B2E4000833E418C38881886E\
S315000017601B040B4351881588090429435B18D1884B\
S3150000177095880904294308321960A242EED103B0C4\
S3150000178030BD03F086FD0190019B002B00D172B69F\
S3150000179001210248FEF7D4FEFFFF0F00D8670000C4\
S315000017A08388F0B50100060080259C461C000022B7\
S315000017B02A31EA36ED01013253009B18DB001F5A2D\
S315000017C0C3185B881B043B4312D00F882F420CD1F1\
S315000017D09B89002B09D13B0567461B0DFB1A9BB263\
S315000017E0A34202D2002B14D01C001831B142E2D120\
S315000017F043891B0B1B03002C0ED02405240D1C4310\
S31500001800C38982891B0444811343DA890132DA8150\
S31500001810F0BD43891B0B1B034381F9E7F0B54B88E9\
S315000018200A881B0413439A89002A02D14C8A65044C\
S3150000183000D5F0BD5D881E882D0435430026012D98\
S315000018400BD88D882D015D192E0050352D884E360A\
S315000018503688002D01D00136B6B2CD88002D1ED1B6\
S31500001860828A0D8A521B92B28088904204D2012746\
S31500001870104D688B38436883888A1205120D904292\
S3150000188000D28A821700240B240322434A820A8943\
S315000018909619BE42CDDCDA890132DA81C9E7878A38\
S315000018A0BC4600276545EED26246521B0D8A521B86\
S315000018B092B2D9E7406A0000F0B54546DE46574683\
S315000018C04E46E0B5038983B004000D00072B00D90E\
S315000018D00AE3834A9B00D3589F460021814E4181EB\
S315000018E0B062438A028A1B0413438181C181DA896B\
S315000018F0988912040243944201D100F0BFFB03B061\
S315000019003CBC90469946A246AB46F0BD0021754EBA\
S315000019104181F062438A028A1B0413438181C1819B\
S31500001920DA899889120402439442E8D18020B26988\
S315000019300243B261002D01D100F0A8FB9A881982FA\
S315000019401205120D99825A81D9E7002343818381BA\
S31500001950C381002900D125E354339846624B804465\
S3150000196099464C2300269A4600271CE043465A888F\
S315000019705B465B005B44DB00ED18EA80321D92009B\
S31500001980115BA21853881B040B4305D09A881F824B\
S315000019901205120D9F825A8108239C460136E044A7\
S315000019A0102E00D1F2E2524673004B449F52330090\
S315000019B00A33DB001A5BE3185D882D04154300D15A\
S315000019C0E4E243461A8853009B18DB00EB189F8419\
S315000019D01F855F85EB89A9891B0401320B4393465A\
S315000019E0C4D12B826B815B465900AA885944C90031\
S315000019F0AA8269182800FFF711FFB7E70022394BC2\
S31500001A0042818281C2811863038A408AA18A0004C6\
S31500001A1018434B005B18DB00C3189A841A855A8555\
S31500001A20002D00D19D85C38982891B0413430AD1E9\
S31500001A300131038243814B0082885918C900828292\
S31500001A404118FFF7EBFE0022608B238BA18B00046D\
S31500001A5018434B005B18DB00C3189A841A855A8515\
S31500001A60002D00D19D85C38982891B0413430AD1A9\
S31500001A700131038243814B0082885918C900828252\
S31500001A804118FFF7CBFE0022608C238CA18C00044A\
S31500001A9018434B005B18DB00C3189A841A855A85D5\
S31500001AA0002D00D19D85C38982891B0413430AD169\
S31500001AB00131038243814B0082885918C900828212\
S31500001AC04118FFF7ABFE638D228D1B0413430022E2\
S31500001AD01A829A829A881205120D5A810FE7C04619\
S31500001AE0C8660000C06A0000406A000000216D4B15\
S31500001AF041818181C181628A5863008A120402434E\
S31500001B0005D01182918291880905090D5181628C57\
S31500001B10218C12040A4306D00021118291829188F9\
S31500001B200905090D5181628E218E12040A4306D0E1\
S31500001B3000211182918291880905090D5181E28A5D\
S31500001B40A18A12040A4306D000211182918291884B\
S31500001B500905090D5181E28CA18C12040A4306D0B5\
S31500001B6000211182918291880905090D5181E28E29\
S31500001B70A18E12040A4306D0002111829182918817\
S31500001B800905090D5181628B218B12040A4306D087\
S31500001B9000211182918291880905090D5181628D7A\
S31500001BA0218D12040A4306D0002111829182918868\
S31500001BB00905090D5181628F218F12040A4306D04F\
S31500001BC000211182918291880905090D5181E28BCC\
S31500001BD0A18B12040A4306D00021118291829188BA\
S31500001BE00905090D5181E28DA18D12040A4306D023\
S31500001BF000211182918291880905090D5181E28F98\
S31500001C00A18F12040A4306D0002111829182918885\
S31500001C100905090D518104219A690A439A616EE604\
S31500001C200022204B428198638281C281618A008AA8\
S31500001C300904014388880A820005000D8A824881CA\
S31500001C40E08AA58A00042843858802822D052D0D89\
S31500001C5082824581608B258B000428438588028219\
S31500001C602D052D0D82824581E08BA58B000428432E\
S31500001C70848802822405240D828244810A480078E1\
S31500001C80032800D1EEE1094A914608219A690A43E0\
S31500001C909A6100229A874B461A819A81DA801A85C0\
S31500001CA0DA812CE6C06A0000B46D0000406A0000CC\
S31500001CB00022B34B4281D8618281C281198C002DEA\
S31500001CC000D11CE1028A408A000410431FD0C28959\
S31500001CD0858912042A43944219D180229D695202B1\
S31500001CE02A439A61828A8588521A92B28282AA42CD\
S31500001CF009D9A44EB146768BB046012647463743EE\
S31500001D003E004F467E83AA1A1205120D4281E08AD2\
S31500001D10A28A000410431FD0C289858912042A436F\
S31500001D20944219D180229D6992022A439A61828A3D\
S31500001D308588521A92B28282AA4209D9914EB14638\
S31500001D40768BB0460126474637433E004F467E8394\
S31500001D50AA1A1205120D4281608B228B00041043D1\
S31500001D601FD0C289858912042A43944219D1802240\
S31500001D709D69D2022A439A61828A8588521A92B252\
S31500001D808282AA4209D97F4EB146768BB046012699\
S31500001D90474637433E004F467E83AA1A1205120D68\
S31500001DA04281E08BA28B0004104300D1A7E5C289D3\
S31500001DB0858912042A43944200D0A0E580229C69BA\
S31500001DC0120322439A61838A591A838889B28182CF\
S31500001DD0994204D901256B4C628B2A4362835B1AB4\
S31500001DE01B051B0D43818AE50022654B4281586223\
S31500001DF08281C281198C002D00D180E0628A008A1E\
S31500001E00120410431FD0C289858912042A439442C2\
S31500001E1019D180229D6952022A439A61828A858855\
S31500001E20521A92B28282AA4209D9564EB146768B8E\
S31500001E30B0460126474637433E004F467E83AA1AE0\
S31500001E401205120D4281E28AA08A120410431FD0A5\
S31500001E50C289858912042A43944219D180229D6938\
S31500001E6092022A439A61828A8588521A92B28282A3\
S31500001E70AA4209D9434EB146768BB046012647465B\
S31500001E8037433E004F467E83AA1A1205120D428141\
S31500001E90628B208B120410431FD0C28985891204DD\
S31500001EA02A43944219D180229D69D2022A439A611B\
S31500001EB0828A8588521A92B28282AA4209D9314E02\
S31500001EC0B146768BB0460126474637433E004F461D\
S31500001ED07E83AA1A1205120D4281E28BA08B120490\
S31500001EE0104300D063E70AE503F0D3F90190019BA4\
S31500001EF0002B00D172B601212348FEF721FB628A2E\
S31500001F00218A12040A4306D0D18990890904014323\
S31500001F108C4200D1DCE0E28AA18A12040A4306D090\
S31500001F20D1899089090401438C4200D1C3E0628BB8\
S31500001F30218B12040A4306D0D189908909040143F2\
S31500001F408C4200D1AAE0E28BA18B12040A4300D195\
S31500001F50D5E4D1899089090401438C4201D0FFF769\
S31500001F60CEFC8021986909030143996100231382FD\
S31500001F70938293881B051B0D5381FFF7C0FCC04657\
S31500001F80C06A0000406A0000F067000000236C226F\
S31500001F9049468B52544AD3871382544A544B1A608B\
S31500001FA0FFF7ADFC54239846524B804499464C2388\
S31500001FB000279A4600261BE043465A885B465B008C\
S31500001FC05B44DB00ED18EA803A1D9200115BA21813\
S31500001FD053881B040B4305D09A881E821205120DE6\
S31500001FE09E825A8108239C460137E044102F2AD04E\
S31500001FF052467B004B449E523B000A33DB001A5B81\
S31500002000E3185D882D0415431DD043461A885300F6\
S315000020109B18DB00EB189E841E855E859E85EB89EA\
S31500002020A9891B0401320B439346C5D12B826B81D0\
S315000020305B465900AA885944C900AA826918280033\
S31500002040FFF7ECFBB8E700236C2249468B52264A81\
S31500002050D3871382254A264B1A60274A274B1A60D4\
S31500002060FFF74DFC23488146088B498B0904014341\
S315000020704846016022498A80CA8006E64020B26945\
S315000020800243B261002D01D0FFF758FC9A881D82E9\
S315000020901205120D9D825A81FFF731FC8021986945\
S315000020A0C902014399610021118291829188090533\
S315000020B0090D518147E78021986989020143996199\
S315000020C000211182918291880905090D51812EE71F\
S315000020D08021986949020143996191881582090511\
S315000020E0090D9582518116E7C06A0000FC070000C1\
S315000020F018000240406A0000FFFFFF3F0C0002404C\
S31500002100306A0000F0B54546DE4657464E46E0B515\
S31500002110BF4D8BB02B6C0400002B01D000221A702F\
S31500002120BC4B44219B4600235A461386538693860E\
S31500002130D386138753879387D3875352443253806A\
S315000021409380D3805A46AB611360D36213645422E2\
S315000021506B616B52AB525A4653835622AB520232D4\
S31500002160EB616B62AB62EB62AB636B632B63AB647D\
S31500002170EB642B65AB5280239B051F6AEF655B6A98\
S315000021802B66002C00D093E0642300210022EC5241\
S31500002190A14B9C801C809C815C809C82DC809C8303\
S315000021A01C819C845C819C85DC811C825C82DC8237\
S315000021B01C835C83DC831C845C84DC841C855C85DA\
S315000021C0DC851C865C869C86DC861C875C879C87F7\
S315000021D0DC879248924B861F9C801C809C815C8089\
S315000021E09C82DC801C815C81DC811C825C82DC82BE\
S315000021F01C835C839C83DC83CB00F2520131F31891\
S315000022005A809A80028008301829F5D1C8237A6846\
S31500002210AB66538A118A1B040B4300D0ACE1814B99\
S3150000222081499846814B82489C46824B824E009358\
S31500002230824B9946938A9A465746D38A1B043B4358\
S3150000224004D04B4641466046009EAB66538B178BC7\
S315000022501B043B4301D00100AE66D38B908B1B045D\
S31500002260034300D0A96600236C216B525946012016\
S315000022700B61CB6172492B67088058464361742015\
S315000022802B520120887078216B52290078314B80BF\
S315000022908B80CB8059462B840B83108904F038F948\
S315000022A00723684A1360684A13600F22674B1A6057\
S315000022B002F0EFFF0790079B002B00D172B6644B2C\
S315000022C0634A1B6853609368D3600023136093606E\
S315000022D0079B002B00D162B65B461B8B002B1BD0E5\
S315000022E000235A4613835B4B5B4A13605B4A1360B9\
S315000022F05B4A13605B4A13605B4A13605B4A136078\
S315000023005B4A13605B4A13605B4A13605B4A136067\
S315000023105B4A13605B4A1360EB6D002B31D002F011\
S3150000232091FC002C00D0CAE2EF6D3E68002E28D04A\
S3150000233064239946544BBA469846738832881B04E0\
S315000023401343022B00D19FE200D223E1032B1FD0BF\
S3150000235002F09FFF0990099B002B00D172B6012164\
S315000023604A48FEF7EDF801239C46E2445346042B07\
S3150000237030D1CA4604239C46E24453461D68002DCC\
S315000023801AD10BB03CBC90469946A246AB46F0BD6E\
S31500002390002C01D100F06AFC04239C46E24453461B\
S315000023A01E68002EC9D1EB6D1A68002AE9D02C00F0\
S315000023B09A461500783401946B882A881B041343C7\
S315000023C0022BD7D12B89043B012BD3D80023D1462E\
S315000023D09A460395039A5346944604339B009D5AA6\
S315000023E063445B881B041D43BDD0EB89AA891B048B\
S315000023F01343039A9A42BCD1DC23984653462E00D7\
S31500002400A8445B001C3600930027404645E0C046C2\
S31500002410C06A0000406A0000006F00006A6F00009A\
S31500002420406F0000C8000A00C8000800C8000E007F\
S31500002430C8000C00C8000600C8000400C80002005E\
S31500002440306A0000042000403820004094200040FC\
S31500002450406B00001F001F000025024000350240AF\
S3150000246000450240005502400065024000750240EA\
S3150000247000850240009502400025044000350440D6\
S3150000248000450440005504400C400040F067000041\
S3150000249018360137B04200D165E77A00D219D2006A\
S315000024A0AA18538B118B1B040B4300D15BE70199D0\
S315000024B0009B5B5A3381538B118B1B040B439A8908\
S315000024C0002AE5D18024F189E40102912142DFD17D\
S315000024D01C88A0465C882404A446444661460C43F6\
S315000024E000210491012C11D8318809018C464E2116\
S315000024F09C44614409880C0050218846C4446146C6\
S315000025000988002901D000F0E3FB049471888C4609\
S31500002510002901D100F0A4FB0024A98AA0468C451D\
S315000025201AD262468A1AB189521A91B2AC888C4282\
S315000025300BD25C460122648B1443221C6C46E28259\
S31500002540E28A94465A4664465483348A0A05120D32\
S31500002550944200D2328290460299090B0903114334\
S31500002560F1810499B2888C466244904500DA8FE77F\
S31500002570DA890132DA818BE7AF4BB049AB66B04BF3\
S31500002580B0489846B04BB14E9C46B14B0093B14B08\
S3150000259099464FE600224A2148237281B281F28190\
S315000025A0B282705AF35A0004184300D1E5E054236E\
S315000025B0F15A4B005B18DB00C3189A841A855A85BA\
S315000025C0002C00D194E1C38982891B04134300D1F6\
S315000025D095E15A225823B05AF35A0004184300D101\
S315000025E0CBE04B460021F25A53009B18DB00C31880\
S315000025F0998419855985002C00D18CE1C38981897C\
S315000026001B040B4300D18DE16A226823B05AF35AAA\
S315000026100004184300D1B0E074230021F25A53009D\
S315000026209B18DB00C318998419855985002C00D1A5\
S3150000263084E1C38981891B040B4300D185E17A2299\
S315000026407823B05AF35A0004184300D195E0842346\
S315000026500021F25A53009B18DB00C3189984198590\
S315000026605985002C00D17CE1C38981891B040B4369\
S3150000267000D17DE18A228823B05AF35A0004184318\
S3150000268000D17AE094230021F25A53009B18DB0014\
S31500002690C318998419855985002C00D174E1C38922\
S315000026A081891B040B4300D11CE39A229823B05A5C\
S315000026B0F35A0004184360D0A4230021F25A5300B1\
S315000026C09B18DB00C318998419855985002C00D105\
S315000026D05CE1C38981891B040B4300D10EE3AA2266\
S315000026E0A823B05AF35A0004184346D0B423002155\
S315000026F0F25A53009B18DB00C31899841985598533\
S31500002700002C00D144E1C38981891B040B4300D10D\
S3150000271000E3BA22B823B05AF35A000418432CD067\
S31500002720C4230021F25A53009B18DB00C318998476\
S3150000273019855985002C00D12CE1C38981891B0498\
S315000027400B4300D1F2E2CA22C823B05AF35A00045E\
S31500002750184312D0D4230021F25A53009B18DB00F1\
S31500002760C318998419855985002C00D114E1C389B1\
S3150000277081891B040B4300D1E4E2738B328B1B046B\
S31500002780134327D0002299881A820905090D9A82D7\
S315000027905981F38CB18C1B040B431BD099881A8288\
S315000027A00905090D9A825981738E318E1B040B43DC\
S315000027B010D099881A820905090D9A825981F38FDA\
S315000027C0B18F1B040B4305D01A829A829A88120590\
S315000027D0120D5A81002C00D0DEE5F388B2881B0466\
S315000027E01343C022D2009446012263441A60F38840\
S315000027F0B1881B04194363460127C8180268164BA3\
S31500002800BC4604E0013B0268002B00D1CBE26746E0\
S315000028101742F7D1DA22D823B25AF35A12041A43CE\
S3150000282039D0DC23F35A002B35D0013B98B2130084\
S31500002830C0000833C01815E0C8000100C800090030\
S31500002840C8000B00C8000D00C8000F00C800050036\
S31500002850C8000700C8000300FFFF0F00F388B18817\
S315000028601B04194313889C46674653881B043B4345\
S315000028705B1891888C466746D1880832090439432B\
S3150000288019608242EAD106E021003000FFF714F811\
S31500002890002C00D080E5738832881B041343022B7A\
S315000028A004D13389043B012B00D857E2300003F0F2\
S315000028B079FD4B464A46EB5A0133AB526CE5802311\
S315000028C09B055869002869D180239B05D969002991\
S315000028D000D130E12A6E9B699446EA6DC448904661\
S315000028E000225F89082F00D9AFE1BF00C759BF4654\
S315000028F09C85C38982891B04134300D069E6013194\
S31500002900038243814B0082885918C900828241188C\
S31500002910FEF784FF5DE69C85C38981891B040B4312\
S3150000292000D071E681880132818251008918C90080\
S31500002930038243814118FEF771FF65E69C85C389D2\
S3150000294081891B040B4300D079E68188013281829C\
S3150000295051008918C900038243814118FEF75EFFC2\
S315000029606DE69C85C38981891B040B4300D081E6F3\
S3150000297081880132818251008918C900038243810E\
S315000029804118FEF74BFF75E69C8588E69C85A0E618\
S315000029909C85B8E69C85D0E69C85E8E62A6E954F30\
S315000029A09046EA6D1B6994460022009459890829CD\
S315000029B000D9DAE1890079588F46198889464C464C\
S315000029C0598809042143444689000959DC88894607\
S315000029D099888A4649005144C90049440C84013209\
S315000029E092B20C339042E1D8802300229B05009CD2\
S315000029F05A6169E7198889464C4659880904214372\
S31500002A00444689000959DC888C80E8E7198889469C\
S31500002A104C46598809042143644689000959894668\
S31500002A2099880A31C900DC884944CC80D7E71988DF\
S31500002A3089464C4659880904214364468900095948\
S31500002A409C882401A146DC88494450310C80C6E7A5\
S31500002A50198889464C4659880904214364468900E9\
S31500002A600959DC88CC82BAE7198889464C465988C8\
S31500002A70090421436446890009599C882401A1461A\
S31500002A80DC8849444E310C80A9E7D98889464E46F0\
S31500002A90198909040E431988B1468A4656464C469A\
S31500002AA05988090431439E888C5198E719888946CC\
S31500002AB04E465988090431439E888E64D9888946D2\
S31500002AC04E46198909040E431988B1468A46564668\
S31500002AD05988090431434E46CE6480E719888946F1\
S31500002AE04C465988090421434446890009598946B8\
S31500002AF0998801318A464900514493E75F881E88C8\
S31500002B003F0437436646BF00BE599F88B1467E1CC8\
S31500002B10B24677005744FF004F44FE88DE80360CED\
S31500002B201E81013292B20C33914200D9D9E680233C\
S31500002B3000229B05DA6180239B05DA68EF6D9446D7\
S31500002B409868002A01D1FFF7F0FB002361460022B6\
S31500002B509846A4460091284B5100994649440B8A51\
S31500002B605E00B14681444E46B6880133B2465446AD\
S31500002B7006889BB2BC5344880B829C4201D84346CC\
S31500002B800B820132009B92B214309342E3D8644622\
S31500002B90FFF7CBFB5F881E883F0437436646BF00BE\
S31500002BA0BE59B1469E88B24677005744FF004F444F\
S31500002BB03E8CB3E75F881E883F0437436646BF00F6\
S31500002BC0BF59BE88AAE75F881E883F04374346463A\
S31500002BD0BF00BE599F88B1460A379CE75F881E88AA\
S31500002BE03F0437434646BF00BF59FE8A96E7C046B4\
S31500002BF0E86600000C670000406B00005F881E88D6\
S31500002C003F0437434646BF00BF599E883601B1464A\
S31500002C104F444E373E8881E75F881E883F0437431E\
S31500002C209E88BF59DF803F0C1F817AE75F881E8828\
S31500002C303F0437439E88BE645F881E883F0437433F\
S31500002C40FF6CDF803F0C1F816BE702F022FB0990CF\
S31500002C50099B002B00D172B601215648FDF770FC86\
S31500002C60B189AA8A521A91B2FFF760FCF388B2883A\
S31500002C701B041343B28A1A64308AF3888446674673\
S31500002C80B2884D481B041343718A327A07604B4859\
S31500002C900132834200D91204494B1A60494B42461D\
S31500002CA019600123E82113601268474B490304E0C9\
S31500002CB04246013B1268002B6AD00A42F8D0C02374\
S31500002CC05B031A4259D1802342465B021360EDE54D\
S31500002CD001218C466444211C6C462182218A049180\
S31500002CE0FFF714FC81880132818251008918C900DE\
S31500002CF0038243814118FEF791FDD6E481880132B3\
S31500002D00818251008918C900038243814118FEF768\
S31500002D1085FDE4E481880132818251008918C90069\
S31500002D20038243814118FEF779FDF2E4818801327E\
S31500002D30818251008918C900038243814118FEF738\
S31500002D406DFD00E581880132818251008918C90034\
S31500002D50038243814118FEF761FD0EE5EB6D5B686A\
S31500002D60B34201D0FFF718FBA0E502F092FA0890F3\
S31500002D70089B002B00D06FE76DE702F08AFA0990F6\
S31500002D80099B002B00D172B601211048FDF7D8FB34\
S31500002D9002F07FFA0990099B002B00D172B601213F\
S31500002DA00B48FDF7CDFB02F074FA0890089B002B48\
S31500002DB0F4D0F4E70468000000400040FF1F044020\
S31500002DC00440004008400040FFFF0F001468000068\
S31500002DD0D8670000562370B52D4C82B0E35A002BFD\
S31500002DE01CD058252B4E635B002B17D102F006F83A\
S31500002DF0431C32D00028F6D102F042F8A369F16AEA\
S31500002E00326C5B189B185A425A4192B26253002B9D\
S31500002E10E9D001F021FF635B002BE7D05825635B07\
S31500002E20002B01D102B070BDFDF7CEFB635B002B1A\
S31500002E30F8D05623E35A184A002B02D1138C002BE4\
S31500002E40F0D07423E35A99005218516E134A116058\
S31500002E50002B05D0013B9BB203E001236353DDE762\
S31500002E6001237422A3520E4B9C7802F012FA0190B1\
S31500002E70019B002B00D172B6022C07D02000FFF771\
S31500002E8041F9019B002BCDD162B6CBE7FEE7C046E8\
S31500002E90C06A0000406A0000406B0000000002406B\
S31500002EA0306A0000F0B54546DE4657464E466C236E\
S31500002EB0E0B5A74D0400EB5A93B00800002B00D1F3\
S31500002EC00AE16688238836041E43012E00D128E1D4\
S31500002ED0002E00D108E1022E00D11AE1032E00D106\
S31500002EE0F3E002F0D6F91190119B002B00D172B6D7\
S31500002EF001219848FDF724FB638A228A1B041343A9\
S31500002F0041D0A78A7A00D119C90059189146CA8CAE\
S31500002F10898C42438C46998892B2884661468918C4\
S31500002F20414501DA00F08DFC4146511A614489B2EF\
S31500002F308C4649466646C919C90059188E840E8DB5\
S31500002F40B446624492B20A85998A914204D2022614\
S31500002F5081494A8B32434A83804A1278002A12D129\
S31500002F60DA89998912040A4304D080225989920188\
S31500002F700A435A813E0080224E44F6009B19598D21\
S31500002F8052010A435A85638B228B1B04134341D09B\
S31500002F90A78B7A00D119C90059189146CA8C898C19\
S31500002FA042438C46998892B28846614689184145C3\
S31500002FB001DA00F042FC4146511A614489B28C465E\
S31500002FC049466646C919C90059188E840E8DB446FD\
S31500002FD0624492B20A85998A914204D202265E49D7\
S31500002FE04A8B32434A835D4A1278002A12D1DA8923\
S31500002FF0998912040A4304D08022598992010A430E\
S315000030005A813E0080224E44F6009B19598D52018A\
S315000030100A435A85638C228C1B04134341D0A78C28\
S315000030207A00D119C90059189146CA8C898C424335\
S315000030308C46998892B2884661468918414501DADC\
S3150000304000F0F7FB4146511A614489B28C46494665\
S315000030506646C919C90059188E840E8DB446624455\
S3150000306092B20A85998A914204D202263A494A8B3B\
S3150000307032434A83394A1278002A12D1DA89998969\
S3150000308012040A4304D08022598992010A435A81C4\
S315000030903E0080224E44F6009B19598D52010A4388\
S315000030A05A855421EB6C6A5AC318101A00226281A1\
S315000030B02B4A80B2EB6468521B01934205D9022267\
S315000030C0AB699343AB610123A38113B03CBC90462B\
S315000030D09946A246AB46F0BD02F0DBF81190119B73\
S315000030E0002BF2D172B6F0E723891B4D5B00EB187B\
S315000030F01A8E2000521A92B21A86FDF707FBA38990\
S31500003100002BE2D001222189EB6A8A409343EB62CD\
S31500003110DBE72189072900D9D4E2124E8B00F35848\
S315000031209F46442123890C4D5B00EB185A5A121A0C\
S3150000313092B25A5201002000FDF7E8FAA389002B4B\
S31500003140C3D022892B6C9640B3432B64BDE7C0469F\
S31500003150C06A000050680000406A0000B46D0000BC\
S31500003160CF02000030670000111D89000E5B641855\
S3150000317063881B0433435E89310501D100F088FB67\
S3150000318056216C5A9F89A1B28846D98909043943C8\
S3150000319001D100F075FB598A9F884143188A89B28C\
S315000031A04418BC4200DA3FE3CF1BC01980B29F8AA5\
S315000031B01882C9195D4F89B23F789982002F00D0D5\
S315000031C0FCE24446002C03D1C024A40126435E81C0\
S315000031D02B8C8B4200D8F4E24423E95275E7AB6CA2\
S315000031E01B18AB6400236381638A218A1B040B438B\
S315000031F001D100F0C1FB5F89390500D165E3D989AA\
S315000032009E890904314300D14FE31E8A598AB44688\
S315000032109E884143B046664689B27618464500DA2E\
S3150000322024E346468E1B6644B6B21E829E8A8919E0\
S315000032303E4E89B236789982002E03D1C026B60159\
S3150000324037435F81E38AA68A1B04334328D05E890D\
S31500003250B446360501D100F07FFBDE899F8936042E\
S315000032603E4300D163E31F8A5E8AB8469F88464381\
S31500003270B9464746B6B2BF194F4500DA39E34F465D\
S31500003280F71B4744BFB21F829F8AF6199E82274EBC\
S315000032903678002E04D1C0266746B6013E435E81CD\
S315000032A0638B268B1B04334301D100F08AFB5F89B5\
S315000032B03C0500D173E3DC899E892404344300D1A4\
S315000032C05DE31E8A5C8AB4469E884443B0466646E1\
S315000032D0A4B23619464500DA31E34646A61B6644D3\
S315000032E0B6B21E829E8AA4199C82104C2478002CA9\
S315000032F003D1C026B60137435F812B8C8B420AD897\
S315000033000826AB69B343AB61AB69AE6E1E4202D110\
S3150000331001265623EE524423E952032C00D0D4E66C\
S31500003320110001F0CFFDFFF755FDCEE6B46D0000AC\
S315000033306C21924A92481368415A13601A0E561A23\
S31500003340B2468A4202D2FF210E40B2466C21425258\
S315000033508C4A134200D0D7E22B8A00229C46EB8F80\
S31500003360D1469B46884BA2461B7800932B8C07932D\
S31500003370838C0493438C0592624606935846002339\
S31500003380002A00D1A6E04A46002A00D1A2E07F4AE0\
S3150000339043009046702243449B5A98460E2800DC10\
S315000033A08DE10F3880B26346013B9BB29C46434693\
S315000033B05222DC0050235444A25AE35A12041A4300\
S315000033C04346191D53468900CE5A51444B88012164\
S315000033D01B0433434646B14001916C494C278B464A\
S315000033E076005E44F15B013989B2F153002904D1BC\
S315000033F05746019E7989B1437981D9899E89090405\
S31500003400314300D19BE15E8A198A9F888919B942A6\
S3150000341000DA92E1C91B89B21982998A7618009955\
S315000034209E82002904D1C0215E89890131435981D8\
S31500003430518816880904314302915421615A4C007F\
S315000034406618F6009619B78CA346F48C96883F1931\
S315000034500396B74200DA6EE1BF1BBFB25E4676182E\
S31500003460F6009619B784378DE419A4B23485029E06\
S31500003470012E00D131E1968AA64205D20226434C9E\
S31500003480648B3443414E7483009C002C0ED1D48946\
S3150000349096892404344300D05FE15C468027641893\
S315000034A0E4001419668D7F013E4366855C881E889C\
S315000034B024043443012C00D173E1009B022B00D17C\
S315000034C062E101235B4298466246C1440233002A08\
S315000034D000D058E7002B00D080E22B4B1B78022B44\
S315000034E000D0F2E5059B5C1EA4B2002B00D1ECE5F2\
S315000034F04426274FAB5B013C01339BB2A4B2AB53CE\
S3150000350001F0AAFBFFF766FCBC42F3D1DDE5638A56\
S31500003510228A1B0413435E89320500D1BFE156227D\
S31500003520AC5ADA899F891204A4B23A4300D19FE1CA\
S315000035305A8A1F8A4243988892B28446B8186045D0\
S3150000354000DA39E16046101A381880B21882988A73\
S3150000355012180D4892B200789A82002800D04DE1E8\
S31500003560002C03D1C024A40126435E812B8C9342F8\
S3150000357000D846E14423EA52A7E5C04618000240B7\
S31500003580406B0000FC070000B46D0000406A0000BC\
S31500003590FFFF00002B6D92001B182B650023638133\
S315000035A0A418638A228A1B04134300D1E2E15A89D4\
S315000035B0110500D195E1D9899E890904314300D1CD\
S315000035C07BE19E88598AB44641431F8A89B27E1898\
S315000035D0664500DA48E166468E1BBE19B6B21E8203\
S315000035E09E8A8919C44E89B236789982002E03D1F3\
S315000035F0C026B60132435A81638C228C1B041343C6\
S3150000360025D05F893A0500D19BE1DA899E891204AB\
S31500003610324300D183E11A8A5E8A94469A884643E9\
S3150000362090466246B6B29219424500DA5FE14246DA\
S31500003630B21A624492B21A829A8AB618AE4A9E8228\
S315000036401278002A03D1C022920117435F81628E4D\
S31500003650238E12041A4321D05489230500D1AAE1EE\
S31500003660D38996891B04334300D190E1538A168A85\
S315000036705843978880B23318BB4200DA78E1C31BFF\
S31500003680F3189BB21382938AC0189B4B90821B78C7\
S31500003690002B03D1C0239B011C4354812B8C8B42EE\
S315000036A000D912E50422AB699343AB61AB69AA6EFC\
S315000036B01A4200D009E501225623EA5205E50130F7\
S315000036C080B270E601F0E5FD1190119B002B00D150\
S315000036D072B601218948FCF733FF009E002E00D107\
S315000036E0B3E0039EA64200D0E0E680245689E401BA\
S315000036F034435481039E079CB44200D16AE15C883E\
S315000037001E8824043443012C00D15DE180235944F2\
S31500003710C9005218518DDB010B4353856B69019A21\
S3150000372093436B616B69002B00D0C6E60122AB693F\
S315000037309343AB61C1E6BFB290E689B26CE66346DD\
S31500003740E8872B8201F0A5FD0990099B002B00D18B\
S3150000375072B601216A48FCF7F3FE80245689A4015B\
S31500003760344354815C4680276418E4001419668D3E\
S315000037707F013E436685029C012C00D096E6182404\
S315000037804C431419248DACE7049B984500D098E669\
S31500003790069B002B00D094E6059B01339BB2059354\
S315000037A08FE69E889C8AA64200D086E680245E89A3\
S315000037B0E40134435C81A9E780B2C7E62B8C8B42D7\
S315000037C010D878245300EB181853802040029040FC\
S315000037D0AB69AA6E8343AB61AB691A4202D101227F\
S315000037E05623EA524423E952012F01D0FFF76DFC1C\
S315000037F001F032FAFFF7EEFAFFF767FC2B8C9342E3\
S315000038000BD8012426008E40AB69A96EB343AB6189\
S31500003810AB69194201D15623EC524423EA520428DB\
S3150000382001D0FFF752FCE3E7201C6C46208020887D\
S31500003830BDE489B28C46FFF70AFC89B28C46FFF7D5\
S31500003840BFFB89B28C46FFF774FBD48996892404A2\
S31500003850344300D081E7182480274C431419668D21\
S315000038607F013E4366858AE7B6B2B8E6B6B2DCE4C7\
S3150000387001F00FFD1190119B002B00D069E767E75F\
S3150000388001F007FD1090109B002B00D061E75FE769\
S3150000389001271C4C618B39436183FFF771FC0127BB\
S315000038A0184C628B3A43628339E601F0F2FC0D90C4\
S315000038B00D9B002B00D04CE74AE701F0EAFC0A908A\
S315000038C00A9B002B00D044E742E70E498946498B04\
S315000038D08846012146460E4331004E467183FFF766\
S315000038E08EFC0127074E718B3943718363E692B2D2\
S315000038F0A1E6BFB2C7E4C046B46D00003068000060\
S315000039009C670000406A000001F0C3FC1190119B07\
S31500003910002B00D172B601213248FCF711FE01F0EE\
S31500003920B8FC0B900B9B002B00D012E710E701F0C0\
S31500003930B0FC0E900E9B002B00D00AE708E7B6B24B\
S31500003940CFE4294A9146528B9046012246461643B9\
S3150000395032004E46728358E6234EB246768BB14607\
S3150000396001264F4637433E0057467E83FFF775FCD8\
S315000039709BB287E600213FE60021FFF763FC01F0DA\
S3150000398088FC0F900F9B002B00D0E2E6E0E601F0EA\
S3150000399080FC0C900C9B002B00D0DAE6D8E6124C8B\
S315000039A0A146648BA04601244646264334004E4673\
S315000039B07483FFF780FC01270B4E738B3B437383A5\
S315000039C04EE60A4B1C7898E49E8A9C88A64200D153\
S315000039D0ECE69BE6562401262E5390E66346E887DE\
S315000039E02B827AE520680000406A0000B46D000072\
S315000039F070B544880388240482B005001C43012C5A\
S31500003A0037D0002C23D0022C04D0032C14D1012053\
S31500003A1002B070BD0389012B3DD0002B42D0072B8D\
S31500003A203BD901F036FC0190019B002B00D172B608\
S31500003A3001213A48FCF784FD01F02BFC0190019B23\
S31500003A40002B00D172B601213548FCF779FDFCF751\
S31500003A508FFB0028DCD001222989324B8A40DC6AA0\
S31500003A6049002243DA625B181A8E013292B21A8634\
S31500003A70CEE7FCF77DFB0028CAD02A89294B944063\
S31500003A80196C52000C4344211C649B185A5A01328B\
S31500003A9092B25A52BCE743810123234A0133136091\
S31500003AA00120B5E74C261F484A008218935B013374\
S31500003AB09BB293531D4B1B681C4220D16C23702470\
S31500003AC0C35A5A00821811530E2B23DC01339BB2C2\
S31500003AD06C228352012004008C40154A138A01335C\
S31500003AE013825369234353612B8996699840304367\
S31500003AF090616A8922436A810E4A1160CDE701F01E\
S31500003B00C8FB0190019B002B00D172B601210A4827\
S31500003B10FCF716FD0F3B9BB2DAE7C0464068000093\
S31500003B20BC670000406A0000782000401800024090\
S31500003B30C06A000008000240AC670000F0B54E46BF\
S31500003B40DE4657464546E0B5038987B00600012B99\
S31500003B5000D19BE0002B16D0072B09D80123009338\
S31500003B60009807B03CBC90469946A246AB46F0BDCD\
S31500003B7001F08FFB0590059B002B00D172B6012149\
S31500003B80BD48FCF7DDFC01230093BC4B0500002774\
S31500003B909B4654353A000A32D200BBB2915BB2184A\
S31500003BA0994653881B040B43DAD029884A005218D9\
S31500003BB0D2009A18518D480462D46C88988A84423F\
S31500003BC05ED858881C8800042043012800D105E1EE\
S31500003BD00905090D3B1D9B009A5BF3185B881B04C6\
S31500003BE013435B891B051B0D1A1C8B4200D9B1E0E0\
S31500003BF079008A46594693B24C225144885A9842D3\
S31500003C003CD28A5A9B1A9E4A9BB2118A0F2935D8F2\
S31500003C101022521A111C92B29A4200D918E18BB2A4\
S31500003C200193002B2AD0974BDB88002B01D101335F\
S31500003C3001930123BB4002931BB2039300239846D2\
S31500003C402B00454698467488338824041C43012C6F\
S31500003C5000D1C8E0002C00D1DBE0022C00D17BE0D3\
S31500003C60032C00D1B2E001F014FB0590059B002B5C\
S31500003C7000D172B601218448FCF762FC0023009350\
S31500003C8001370835102F00D084E769E75423002256\
S31500003C907B490092CB5A002B00D061E7438A028A07\
S31500003CA01B04134312D0848A621C50008018C00083\
S31500003CB0181800280AD062001219D2009B185A8DD3\
S31500003CC01B8C1205120D9A4200DA49E7738B328B70\
S31500003CD01B04134314D0B48B621C50008018C00020\
S31500003CE0181800280CD0002062001219D2009B1868\
S31500003CF05A8D1B8C1205120D00909A4200DA2FE79E\
S31500003D00738C328C1B04134314D0B48C621C500089\
S31500003D108018C000181800280CD000206200121964\
S31500003D20D2009B185A8D1B8C1205120D00909A42D8\
S31500003D3000DA15E754228B5A300001339BB28B52BE\
S31500003D408B69523A13438B610021FFF751FE012321\
S31500003D50009305E70A1C4BE73389012B00D179E074\
S31500003D60002B6BD159464C2251448B5A01339BB2DE\
S31500003D708B52464B1B681C426FD15A466C237021EE\
S31500003D804846D35A5A005A4450520E2B70DC01331F\
S31500003D909BB26C2259468B52394B394A1B8A0133E6\
S31500003DA013825369029A1343354A5361916901227A\
S31500003DB033899A400A4332498A61728903990A43D0\
S31500003DC07281334A1760334A013313600135019B10\
S31500003DD0ADB29D4200D036E7454651E79988138D2E\
S31500003DE0C91A89B2F6E649463000FCF7C1F900283F\
S31500003DF0ECD033895A469C40126C442114435A46EF\
S31500003E00146444225B005B449A5A013292B25A52BD\
S31500003E10DCE749463000FCF7ABF90028D6D05A4615\
S31500003E20D16A012233899A400A4359465B00CA6225\
S31500003E305B441A8E013292B21A86C7E7072BC2D9A3\
S31500003E4001F027FA0490049B002B00D097E695E634\
S31500003E50191CE4E673810123B5E701F01AFA05900F\
S31500003E60059B002B00D172B601210B48FCF768FBBD\
S31500003E700F3B9BB28DE7C04640680000406A0000D9\
S31500003E80C06A0000306A0000BC67000018000240EB\
S31500003E900800024078200040AC670000F0B5DE461E\
S31500003EA057464E464546E0B5438885B09BB204006A\
S31500003EB00F2B00D97CE1B54A9B00D3589F4601F0F1\
S31500003EC0E8F90190019B002B00D172B6B04A536805\
S31500003ED0A3801B0CE380D36823811B0C6381019BA9\
S31500003EE0002B00D162B6042323808022A94B520204\
S31500003EF01A6005B03CBC90469946A246AB46F0BD5A\
S31500003F000323038000230093C38882881B04134382\
S31500003F10009A9A42E7D2009A01320092009A9A4297\
S31500003F20F9D3E0E7047901F0B4F90290029B002B83\
S31500003F3000D172B6022C07D02000FEF7E3F8029BF0\
S31500003F40002BD2D162B6D0E7FEE7934E8388C188B4\
S31500003F50338403898E4A1B040B4353668389418944\
S31500003F601B040B439366038AC1891B040B438B49CD\
S31500003F70CB616C23F35A002BB7D17433F35A9900F3\
S31500003F805218516E864A1160002B00D165E1013B43\
S31500003F909BB27422B3526C23733AF252A5E7802285\
S31500003FA07C4B52021A6001F074F90390039B002BBC\
S31500003FB000D172B6FEE7C389012B00D14FE1002B79\
S31500003FC000D090E7C38882881B04134302899A6451\
S31500003FD0C38882881B041343DB6C43811B0C8381DB\
S31500003FE081E764216C4A8388515A994200D8EDE0F2\
S31500003FF0D26D9B009858438802881B041343012BFB\
S3150000400006D9022B0CD10289023A052A00D8DAE039\
S31500004010C289002A00D168E78289002A00D064E7B5\
S31500004020012B00D1E2E0002B00D1D6E0022B00D11B\
S31500004030C9E0032B00D158E701F02BF90390039B4D\
S31500004040002B00D172B601215648FCF779FA524A84\
S31500004050136F0133136748E701F01BF90390039BC5\
S31500004060002B00D172B64A4B1A685A609A68DA6019\
S3150000407000221A609A60039B002B00D162E734E7A6\
S31500004080C3888188454A1B040B435361012313836C\
S315000040902BE73F4AA388063092461384002B00D1B3\
S315000040A023E71700002322379A00B91882181488CC\
S315000040B001330C8052889BB24A805246128C9A4237\
S315000040C0F2D8002A00D110E753466422324E5B8CA8\
S315000040D0B25A9A424ED9002291464832002593465A\
S315000040E0F26D9B009C5862882388110419430229AB\
S315000040F000D185E000D2C1E0032921D001F0C9F842\
S315000041000390039B002B00D172B601212648FCF7D1\
S3150000411017FAC389012B00D18DE0002B00D0E4E60D\
S31500004120C38882881B04134302899A64828943895F\
S3150000413012041A43C38881881B040B43DA64D4E64D\
S31500004140E389002B03D0A389002B00D180E04346EE\
S31500004150012B00D17CE04B4601339BB29946534676\
S315000041601B8C04374B4500D8BFE664223B88B25A05\
S315000041709A42B5D801F08DF80290029B002B00D12F\
S3150000418072B601210948FCF7DBF9C046506700000A\
S31500004190406B000004100040C06A0000406A000046\
S315000041A00000024084680000F067000070680000AC\
S315000041B001F06FF80390039B002B00D172B601212A\
S315000041C02C48FCF7BDF9FFF7B9FC8EE601F061F863\
S315000041D00390039B002BD4D1D2E70289264B5200D1\
S315000041E09B18198E89B2FDF719F97EE60289224BD2\
S315000041F052009B184422995A89B2FDF70FF974E6CA\
S3150000420001212000FDF758FB638822881B04134315\
S31500004210012B05D9022B93D12389023B052B15D9F6\
S31500004220E3899846002B96D0A3899846002B0FD099\
S31500004230002398468FE78289438912041A43C3886C\
S3150000424081881B040B4301895A504EE60123984688\
S3150000425079882000FFF7CCFB7DE7012399E6C38828\
S3150000426082881B04134302899B5843811B0C83815C\
S3150000427039E6C046A4680000406A00004A20594654\
S315000042806581A581E581A582205A615A000408430B\
S3150000429000D11FE15423E25A531C5900C918530098\
S315000042A09B18DB00C3189D841D855D85C3898289A3\
S315000042B0C9001B044118134305D1828803828282F8\
S315000042C04381FDF7ABFA5A225823A05AE35A000459\
S315000042D0184300D1FCE06423E25A531C5900C91864\
S315000042E053009B18DB00C3189D841D855D85C3891B\
S315000042F08289C9001B044118134305D182880382B1\
S3150000430082824381FDF78AFA6A226823A05AE35A19\
S315000043100004184300D1DBE07423E25A531C590011\
S31500004320C91853009B18DB00C3189D841D855D8545\
S31500004330C3898289C9001B044118134305D18288A9\
S31500004340038282824381FDF769FA7A227823A05A92\
S31500004350E35A0004184300D1BAE08423E25A531CFE\
S315000043605900C91853009B18DB00C3189D841D858E\
S315000043705D85C3898289C9001B044118134305D191\
S315000043808288038282824381FDF748FA8A22882343\
S31500004390A05AE35A0004184300D199E09423E25A44\
S315000043A0531C5900C91853009B18DB00C3189D8481\
S315000043B01D855D85C3898289C9001B044118134385\
S315000043C005D18288038282824381FDF727FA9A22E9\
S315000043D09823A05AE35A0004184300D178E0A42396\
S315000043E0E25A531C5900C91853009B18DB00C31826\
S315000043F09D841D855D85C3898289C9001B0441187A\
S31500004400134305D18288038282824381FDF706FA2F\
S31500004410AA22A823A05AE35A0004184358D0B4236A\
S31500004420E25A531C5900C91853009B18DB00C318E5\
S315000044309D841D855D85C3898289C9001B04411839\
S31500004440134305D18288038282824381FDF7E6F910\
S31500004450BA22B823A05AE35A0004184338D0C4231A\
S31500004460E25A531C5900C91853009B18DB00C318A5\
S315000044709D841D855D85C3898289C9001B044118F9\
S31500004480134305D18288038282824381FDF7C6F9F0\
S31500004490CA22C823A05AE35A0004184318D0D423CA\
S315000044A0E25A531C5900C91853009B18DB00C31865\
S315000044B09D841D855D85C3898289C9001B044118B9\
S315000044C0134305D18288038282824381FDF7A6F9D0\
S315000044D023886288618B208B0904014326D0888853\
S315000044E00D820005000D8D824881E18CA08C0904A7\
S315000044F001431BD088880D820005000D8D824881FE\
S31500004500618E208E0904014310D088880D82000533\
S31500004510000D8D824881E18FA08F0904014305D0EB\
S3150000452088880D820005000D8D8248811204134390\
S315000045306EE6C046F0B5DE4657464E46454658231B\
S31500004540E0B5974A89B0D35A002B06D009B03CBCD7\
S3150000455090469946A246AB46F0BD136E9A461E6833\
S3150000456000239B46002E50D080235B019846D146FF\
S315000045705F46424673899B46134204D0894A012707\
S3150000458013409B467381DC239C468023B444DB01A5\
S315000045903100029363461C3100220097019310E01C\
S315000045A04446C889204208D09C89002C02D1029D2D\
S315000045B028425ED07B4B1840C881019B18318B4244\
S315000045C00ED0013250008018C000845B301843883A\
S315000045D01B04234304D000980028E1D0C889E3E7F0\
S315000045E05B46009F9B0409D580245B46E401234279\
S315000045F000D195E05A466C4B1A40728104239C46C2\
S31500004600E1444B461E68002EB3D1684E3288002A1C\
S3150000461000D1D3E000239946654B0024654D9A46A8\
S31500004620984604E00134A4B2944200D3C6E0A30045\
S31500004630EF58FB89002BF5D0BB89002BF2D17B8884\
S3150000464039881B040B43012B00D118E1002B00D144\
S315000046500CE1022B00D100E1032BE3D000F019FEA0\
S315000046600790079B002B00D172B601215248FBF739\
S3150000467067FF1D882F005D882D04AC463D00674608\
S315000046803D43AC46002503956546012D0FD80D88A0\
S315000046904E272D01AC469C4465466744039550352C\
S315000046A03F882D88BC46002D00D0CCE003974D886E\
S315000046B0002D00D16FE0B78AAC4605970027049518\
S315000046C0059DBA462F00AC451BD265467C1B8D89DD\
S315000046D0641BA7B2B588BD420BD20124344D6D8B45\
S315000046E025432C1C6D462C822C8AA4466546304CEC\
S315000046F065830D8A3C05240DA54201D2C8890C822A\
S31500004700A246039D000BAC46000320438C88C8815B\
S315000047106444544500DD4DE7DC890134DC8149E71A\
S31500004720B388300035009C469A4600212A30EA3587\
S3150000473001314B005B18DB009A5BF3185B881B04A6\
S315000047401A4313D0038823420DD19289002A0AD135\
S3150000475062461B051B0DD31A9BB2534503D2002B91\
S3150000476000D198E09A4618308542E1D1F0235A46A6\
S315000047701B021A4053469346002B00D13AE71B050D\
S315000047801B0D1A43F3899346B2891B041343DA8936\
S315000047900132DA812EE7B48A8D89641BA7B299E7C4\
S315000047A0C06A0000FFEFFFFFFFDFFFFF606F000042\
S315000047B0406A00002472000084680000394A3A4BBF\
S315000047C058249B69D16A126C5B189B185A42534154\
S315000047D0354A9BB21353135B002B00D1B6E6FBF7A9\
S315000047E0F3FE314B1B5B002B00D1AFE656232E4A5E\
S315000047F0D35A2E4A002B03D1138C002B00D1A5E6E9\
S3150000480074232949CB5A99005218516E284A1160CF\
S31500004810002B3ED0013B9BB2742223498B52254B81\
S315000048209C7800F036FD0790079B002B00D172B6EE\
S31500004830022C11D02000FDF765FC079B002B00D051\
S3150000484084E662B682E60125AA46D44465466F46EA\
S31500004850BD81BD8903952AE7FEE73800FFF76EF9AB\
S31500004860002801D04B46FB813288DBE63B893800C5\
S315000048705B004344198E89B2FCF7D0FDF0E7442271\
S315000048803B8938005B005344995A89B2FCF7C6FD50\
S31500004890E6E70123C0E7F0235A461B021A40934677\
S315000048A0A8E6C046406A0000C06A0000406B0000EF\
S315000048B000000240306A000000B5438802881B04ED\
S315000048C083B01343012B1FD0002B14D0022B04D02E\
S315000048D0032B05D1002003B000BDFFF72FF9FAE73F\
S315000048E000F0D7FC0190019B002B00D172B601218C\
S315000048F00A48FBF725FE0289094B52009B18198EC0\
S3150000490089B2FCF78BFDE6E70289054B52009B183E\
S315000049104422995A89B2FCF781FDDCE784680000DD\
S31500004920406A00008288C38801201B0413435B6829\
S315000049305B0A98437047C046044B00201B8A0F2B26\
S3150000494002D81020C01A80B27047C046C06A000064\
S31500004950F0B557464E46DE464546E0B50668099F21\
S31500004960002E58D0002A24D004229446033A9146B9\
S31500004970524A802590466D01002F00D17DE03A0015\
S315000049800024AF4202D278E0AA4202D30134521B7D\
S31500004990FAD12A006243BF1A4A46002A52D0002B97\
S315000049A050D1002C4ED1012D00D171E0012291464B\
S315000049B059E0424C0532A0463024A1469446043ABA\
S315000049C092463F4A002F65D03C000025974202D20E\
S315000049D063E0944202D30135A41AFAD114006C4361\
S315000049E03F1B5446002C1CD0002B1AD1002D18D189\
S315000049F0012A54D0092A5ED900240A3A0134092A28\
S31500004A00FBD8220001246442A346DC446446002C01\
S31500004A10D8D1002333703CBC90469946A246AB469B\
S31500004A20F0BD303535700468661C00240660A24669\
S31500004A300029DFD0B142DDD84446046000241F4E71\
S31500004A40A246D7E7092C20D95734E4B2347002685D\
S31500004A50561C002206609146002904D08E4202D3DD\
S31500004A604246164E0260012252429246D4446246A3\
S31500004A702D09002A00D07FE7CBE74A463024002ADA\
S31500004A80E4D0002B00D18EE700243034E4B2DDE719\
S31500004A903024DBE700240025A2E70024A0E74C46EB\
S31500004AA034700468661C0660002901D0B142C3D97F\
S31500004AB000229246A6E70022A4E7C04600F0FF1FA8\
S31500004AC010270000F0B58BB0040000F0E2FB009068\
S31500004AD0009B002B00D172B64D2302AD28002B702F\
S31500004AE0244B1A78013002700133002AF9D10123D0\
S31500004AF08022042701269C465201002C30D0230038\
S31500004B000021944202D231E0934202D301319B1A32\
S31500004B10FAD113004B43E41A002E14D0002912D107\
S31500004B20012A1FD06646013F1209002FE5D1077002\
S31500004B3000F0AFFB0190019B002B00D172B6012162\
S31500004B402800FBF7FDFCCEB209290CD95736F6B280\
S31500004B5006700AAB0130984200D307480026E2E708\
S31500004B60002EDDD100263036F6B2F1E7002EFAD05F\
S31500004B70D9E7C046BD68000000F0FF1F30B583B01E\
S31500004B801C00150000F085FB0190019B002B00D155\
S31500004B9072B6002C01D103B030BDE14389B2C90B16\
S31500004BA02800FBF7CDFCC04610B5002082B0FDF70B\
S31500004BB0A9FA1D4A1388002B2FD0802380219B053C\
S31500004BC01B68490159800221198000211180174A6A\
S31500004BD013604022164B1A6062B6164C00F0EAFECD\
S31500004BE000F057FB0190019B002B00D172B62368A1\
S31500004BF0013323602368002B02D1A3680133A3602D\
S31500004C00019B002BEAD162B600F0D4FE00F041FB16\
S31500004C100190019B002BEAD1E8E71388002BCCD149\
S31500004C201388002BF9D0C8E7306A0000081000404E\
S31500004C300C100040406B00000022014B1A707047B8\
S31500004C40B46D0000002210B5024B5A809A80FBF723\
S31500004C5057FA10BDB46D0000F0B55746DE464E4615\
S31500004C604546E0B55F4F83B07888002834D05E4B68\
S31500004C7000245E4D984603E00134A4B284422BD250\
S31500004C804146660033199B00C9182A8889889142D3\
S31500004C90F2D84246D35899465B89002B00D08FE064\
S31500004CA04B469B89002B12D13619B60046443389F0\
S31500004CB0013B9BB23381002B09D1F3883381738981\
S31500004CC0002B00D082E000214846FEF791FE013419\
S31500004CD07888A4B28442D3D3454B1B681B68984698\
S31500004CE05B89002B00D076E0B888002861D0414B64\
S31500004CF000243E4D404E9A46844605E0BB889C46BD\
S31500004D000134A4B2644554D2E10072182B8850884D\
S31500004D109842F5D8D388013B9BB2D380002BEDD1C6\
S31500004D209388D380735ADA00994650234244D15A65\
S31500004D300233D35A1B040B4339D05421515A9A8A51\
S31500004D4048004018C0001818008D121A4846400046\
S31500004D50844692B2019250466246105A4A1C9346C5\
S31500004D6051005944C9005B18DB88019AC018824279\
S31500004D70C4DD52466146895A019A4046D21A4B46CC\
S31500004D8004339B00185A43445B8889B21B040343CF\
S31500004D905B8992B25B04B1D48A42AFD0FFF7CCFDF7\
S31500004DA00028ABD049464046FEF722FEA6E71B8AFE\
S31500004DB0FFDE03B03CBC90469946A246AB46F0BD2A\
S31500004DC0002201214846FEF76DF869E701214846B1\
S31500004DD0FCF796FC77E7002201214046FEF762F8D1\
S31500004DE082E7C046B46D00003C6E0000046B000014\
S31500004DF01C6B00008C6A0000BC6D00001D4B70B57A\
S31500004E005C88002C23D080251B4AED001168CB88D6\
S31500004E1088881B0403435868284220D1C026B60060\
S31500004E2030401BD1013CA3B25C00E418A400141965\
S31500004E300BE0D168CB8888881B0403435868284256\
S31500004E400DD130400C32002808D1A242F1D10B4BD3\
S31500004E501B681C686389002B04D1002070BD0120EB\
S31500004E604042FBE7200000220121FEF71BF8608983\
S31500004E70F4E7C046B46D00003C6E00001C6B0000F9\
S31500004E8070B50E4E7288002A16D000240C4D03E031\
S31500004E900134A4B294420FD263001B199B00E85858\
S31500004EA04389002BF4D000220121FDF7FBFF0134DA\
S31500004EB07288A4B29442EFD370BDC046B46D0000B0\
S31500004EC03C6E0000F0B55746DE464E464546E0B518\
S31500004ED0800083B287B0009301931D00002399469A\
S31500004EE0AC4BAD4A9A46CB009C4662441700CB4673\
S31500004EF005935346DC68A94B20899C46C000604454\
S31500004F008388002B00D0E5E0009B002B1AD10023FC\
S31500004F10009353461C68A14B20899C46C000604400\
S31500004F208388002B00D0CFE0019B002B27D1002DDA\
S31500004F3000D0E8E00025009B2B4300D1B0E0002321\
S31500004F400193D6E753461B8A5B45E2D85346524641\
S31500004F509B8A013B9BB29382002BDAD10226538AAD\
S31500004F6093822000FFF7DEFC002800D0F1E0009BD2\
S31500004F70002BCCD0013EB6B2002ECAD0F1E7534684\
S31500004F809B885B4519D8534652461B89013B9BB209\
S31500004F901381002B11D1D38802261381804B9846AA\
S31500004FA02000FFF7BFFC002800D0E2E0019B002BA9\
S31500004FB0BDD0013EB6B2002EF2D1002D99D0794B6C\
S31500004FC01B681B6803935B89002B00D0BCE04B4633\
S31500004FD0002B5DD0BB1C0026984605E00136B6B214\
S31500004FE0002D55D0B14553D043461B885B45F5D8B7\
S31500004FF0FC88013CA4B2FC80002CEFD1BB88059A4A\
S31500005000FB80654B03989B5A8446DA000293502333\
S315000050106244D15A0233D35A1B040B4352D0542153\
S31500005020505A9A8A41000918C9005918098D013049\
S31500005030521A029992B249008C46049262465A4923\
S31500005040525A41000918C9005B18D9885318049AA6\
S315000050509A4217DD13006046534A805A5A1A02993B\
S3150000506093B204930B1D03999B008C465A5A6344D2\
S315000050705B8880B21B0413435B895B0402D4049BE8\
S3150000508098424DD12D1B0136ADB2B6B2002DA9D135\
S31500005090019B002B00D02CE7009B2B4300D04EE752\
S315000050A0424B1B68002B06D0414B424A1B88128894\
S315000050B09A4200D180E007B03CBC90469946A24691\
S315000050C0AB46F0BD1B8AFFDE01F0DCFA484483B232\
S315000050D0994629E78388668B9BB29846238B3604CC\
S315000050E01E4301F0CFFA584483B29B46338A984553\
S315000050F002D9B2889B189BB242469B1A3382B38A66\
S315000051009B1AB38200E7274B1B681B6803935B89D6\
S315000051100193002B0ED14B46002B00D05AE70AE72D\
S31500005120FFF70AFC0028ADD002990398FEF760FC51\
S315000051300400A7E7039B188901F068FA002D00D147\
S31500005140F9E600230193E6E7039B188901F05EFA6E\
S315000051503DE72389124A5B00995A200089B2FEF77F\
S3150000516047FC002800D102E7009B013B9BB200935D\
S31500005170FDE64246238920005B00995A89B2FEF774\
S3150000518037FC002800D111E7019B013B9BB201933C\
S315000051900CE7C0463C6E0000BC6D0000006F0000CE\
S315000051A0706A00001C6B00008C6A0000F86A000040\
S315000051B0046B0000E06A00005346164CDD68236865\
S315000051C0002B09D0144B28899C46C000604401F08E\
S315000051D059FA2368002BF5D153461D682368002B26\
S315000051E009D00D4B28899C46C000604401F04AFA5C\
S315000051F02368002BF5D1094B094C1B681D682368F1\
S31500005200002B00D157E7288901F000FA2368002B0C\
S31500005210F9D150E76C6A0000006F00001C6B0000BB\
S31500005220D86A0000F0B50B4D0B4E6C8836688000CE\
S3150000523087596000094E00191204114380001B04AF\
S31500005240120C87511A43801901346C8041608260C8\
S31500005250F0BDC046B46D00001C6B00003C6E000043\
S3150000526070B5074D074EAB8809040843DC001104EE\
S31500005270A4190A430133AB802060626070BDC0464A\
S31500005280B46D0000BC6D000068467047EFF3058002\
S315000052907047EFF310807047EFF3148070470000FB\
S315000052A07047C046F0B54546DE464E465746144B57\
S315000052B0134A1B68E0B501331360124B89B01968B5\
S315000052C0114B1868114B1C68114B1E68114B1B685B\
S315000052D00593114B1B689C46104B1B689B465D460D\
S315000052E0E3460F4B1B6898460E4B1B7807930E4BF5\
S315000052F01B68069343460294039504931CE1C0463B\
S31500005300FC6E000098670000DC6A00001C6B000061\
S31500005310E46A0000E86A0000EC6A0000F46A000033\
S31500005320F86A0000B46D0000F06A0000002E04D098\
S31500005330029C6568AE4200D182E1059D002D10D029\
S315000053405D030ED5BC4D6C46A946AD8EAC46012517\
S31500005350AA46D4446546E580ADB2AC464D4667469E\
S31500005360AF865D46002D10D01D030ED5B24D6C469E\
S31500005370A946AD8FAC460125AA46D4446546E580CC\
S31500005380ADB2AC464D466746AF87039C002C56D05F\
S315000053905D0712D5A84D6C46AA466425A946554612\
S315000053A04F46ED5BAC460125A846C4446546E580FC\
S315000053B0ADB2AC4655466446EC531D0713D59E4C1C\
S315000053C0A2466C24A14654464D46645B6D46A446EF\
S315000053D00124A046C4446446EC80EC884D46A446AD\
S315000053E0544667466753DD0613D5934CA24674248C\
S315000053F0A14654464D46645B6D46A4460124A0462C\
S31500005400C4446446EC80EC884D46A4465446674640\
S3150000541067539D0613D5884CA2467C24A146544664\
S315000054204D46645B6D46A4460124A046C4446446CA\
S31500005430EC80EC884D46A446544667466753049D67\
S31500005440002D57D0F025AD002B4253D0079C032CDE\
S3150000545000D14FE15C0611D54424A1464D46764C59\
S31500005460645B6D46A4460124A046C4446446EC80B1\
S31500005470EC884D46A44667466F4C67531C0611D50B\
S315000054804C24A1464D466C4C645B6D46A4460124F3\
S31500005490A046C4446446EC80EC884D46A446674664\
S315000054A0654C6753DC0511D55424A1464D46624C24\
S315000054B0645B6D46A4460124A046C4446446EC8061\
S315000054C0EC884D46A44667465B4C67539C0511D550\
S315000054D05C24A1464D46584C645B6D46A4460124A7\
S315000054E0A046C4446446EC80EC884D46A446674614\
S315000054F0514C6753069D002D07D09B0705D54E4B93\
S315000055004D4C9B8901339BB2A381D30711D54B4CDC\
S315000055100B69A4468B600B62013BDB0063441D896B\
S315000055206C46AC460125A946CC446546E580ADB23D\
S315000055301D81930700D599E10A68002A00D18EE102\
S315000055405307E2D58425AC468C4465464B6F0B6702\
S315000055502B60DD070ED5384D6C46A946AD88AC46A6\
S315000055600125AA46D4446546E580ADB2AC464D4613\
S315000055706746AF80002800D1D8E6029C6568A8423D\
S3150000558000D0D3E65C0513D52B4CA2468424A14655\
S3150000559054464D46645B6D46A4460124A046C44469\
S315000055A06446EC80EC884D46A446544667466753ED\
S315000055B01C0513D5204CA2468C24A14654464D46C4\
S315000055C0645B6D46A4460124A046C4446446EC8050\
S315000055D0EC884D46A446544667466753DC0413D50B\
S315000055E0154CA2469424A14654464D46645B6D462E\
S315000055F0A4460124A046C4446446EC80EC884D468B\
S31500005600A4465446674667539C0400D48EE60A4C6B\
S31500005610A2469C24A14654464D46645B6D46A4466C\
S315000056200124A046C4446446EC80EC884D46A4465A\
S3150000563054466746675379E6646F0000FC6E0000C7\
S315000056405C0413D59E4CA246A424A14654464D465E\
S31500005650645B6D46A4460124A046C4446446EC80BF\
S31500005660EC884D46A4465446674667531C0413D53A\
S31500005670934CA246AC24A14654464D46645B6D4607\
S31500005680A4460124A046C4446446EC80EC884D46FA\
S31500005690A446544667466753DC0313D5884CA24696\
S315000056A0B424A14654464D46645B6D46A446012487\
S315000056B0A046C4446446EC80EC884D46A446544655\
S315000056C0674667539C0300D437E67D4CA246BC244C\
S315000056D0A14654464D46645B6D46A4460124A04649\
S315000056E0C4446446EC80EC884D46A446544667465E\
S315000056F0675322E65C062AD5724C0027A446248806\
S315000057006400A1464D46704C2F5364462488FE2CF7\
S3150000571000DDCEE064462488A1460124A046C144AB\
S315000057204C466D46EC80EC88A14664464D46258085\
S31500005730664C6D46A1462488A4460124A046C4446E\
S315000057406446EC80EC88A4464C46654625801C06DB\
S315000057502AD55C4C0127A44624886400A1464D4600\
S31500005760594C2F5364462488FE2C00DD9BE064468A\
S315000057702488A1460124A046C1444C466D46EC80CF\
S31500005780EC88A14664464D462580504C6D46A146A0\
S315000057902488A4460124A046C4446446EC80EC88D0\
S315000057A0A4464C4665462580DC052AD5454C02278D\
S315000057B0A44624886400A1464D46434C2F536446B4\
S315000057C02488FE2C00DD68E064462488A146012476\
S315000057D0A046C1444C466D46EC80EC88A146644622\
S315000057E04D462580394C6D46A1462488A4460124A1\
S315000057F0A046C4446446EC80EC88A4464C46654604\
S3150000580025809C0500D475E62E4C24886400A446A9\
S315000058100324A14665464F462B4C2F53294C24881A\
S31500005820FE2C34DC274C2488A4460124A046C4441C\
S3150000583064466D46EC80EC88A4466546214C25807E\
S31500005840224C6D462488A4460124A046C4446446DE\
S31500005850EC80EC88A44665461C4C25804AE609B0D7\
S315000058603CBC90469946A246AB46F0BD049B184AFE\
S3150000587098464B6C4432CB634B65013BDB00D31837\
S315000058809A88029C013292B2039D9A8032E50D4CB1\
S315000058902488A446FF246442C8E764462488A146B7\
S315000058A0FF24644294E764462488A146FF246442A8\
S315000058B061E764462488A146FF2464422EE7C04679\
S315000058C0646F0000FC6A000024700000466A000055\
S315000058D0FC6E00008022034B52021B689C331A6048\
S315000058E07047C04698670000054B10B51B685A689C\
S315000058F0D20303D518695969FEF7D0FA10BDC04620\
S315000059009467000000B583B0FFF7C3FC0190019BCC\
S31500005910002B00D172B60222054B1B685A60054B5C\
S31500005920013A1A80019B002B00D162B603B000BD7C\
S3150000593094670000306A0000A52110B5044B890069\
S315000059401A6804481A600123034AFFF717F910BDC5\
S31500005950180002407469000060690000002300B569\
S3150000596083B00193FFF792FCA22110380190012326\
S31500005970034A89000348FFF701F903B000BDC0469A\
S315000059808869000074690000002300B583B00193A4\
S31500005990FFF77CFC103801900123034A03490448B1\
S315000059A0FFF7ECF803B000BD98690000A5020000FF\
S315000059B074690000F0B5DE4657464E464546E0B5EA\
S315000059C0A34B97B01B78052B00D9D1E2A14A9B00C7\
S315000059D0D3589F46A04B9C8E9846A4B2002C20D04C\
S315000059E01B6B00251B89023B9BB2032B01D800F0E1\
S315000059F0CAFCFFF74EFC0D900D9B002B00D172B632\
S31500005A00434642469B8E1B1B9BB293860D9B002BE7\
S31500005A1001D100F0A0FC43462A002100186BFDF7D7\
S31500005A2041FA43469C8FA4B2002C00D189E29B6BBD\
S31500005A3000251B89023B9BB2032B01D800F035FCE5\
S31500005A40FFF727FC0E900E9B002B01D100F02AFCDD\
S31500005A50434642469B8F1B1B9BB293870E9B002B94\
S31500005A6000D162B643462100986B2A00FDF71AFA68\
S31500005A70002467E2784B984664234246D45AA4B27F\
S31500005A80002C21D0136E00251B89033B9BB2022BF1\
S31500005A9001D800F071FCFFF7FCFB0F900F9B002B69\
S31500005AA000D172B66422434641469B5A1B1B9BB2E9\
S31500005AB08B520F9B002B01D100F027FC43462A0096\
S31500005AC02100186EFDF7EEF96C234246D45AA4B2B3\
S31500005AD0002C21D0936E00251B89023B9BB2032B21\
S31500005AE001D800F00BFCFFF7D4FB1090109B002BA5\
S31500005AF000D172B66C22434641469B5A1B1B9BB291\
S31500005B008B52109B002B01D100F0F5FB43462A0077\
S31500005B102100986EFDF7C6F974234246D45AA4B202\
S31500005B20002C21D0136F00251B89023B9BB2032B4F\
S31500005B3001D800F0D6FBFFF7ACFB1190119B002BB0\
S31500005B4000D172B67422434641469B5A1B1B9BB238\
S31500005B508B52119B002B01D100F0CAFB43462A0051\
S31500005B602100186FFDF79EF97C234246D45AA4B251\
S31500005B70002C00D1E5E1936F00251B89023B9BB207\
S31500005B80032B01D800F087FBFFF783FB1290129BD3\
S31500005B90002B00D17DE37C22434641469B5A1B1BCA\
S31500005BA09BB28B52129B002B00D162B6434621005A\
S31500005BB0986F2A00FDF776F90024C3E1264B0024EE\
S31500005BC098460023A146254E9A4644462AE0042BD1\
S31500005BD000D1C4E1052B00D0BCE133000C3B9BB2E5\
S31500005BE09B46FFF756FB1390139B002B00D172B612\
S31500005BF04744BB885B1B9BB2BB80139B002B00D129\
S31500005C0062B65A4629002068FDF74CF94D44ABB2FE\
S31500005C10994601239C460136B6B2E2440834102E5A\
S31500005C2000D1ADE15346DF004346DB199D88ADB296\
S31500005C30002DEBD023681B89032B00D18DE1C6D83C\
S31500005C40022B00D086E1331F9BB29B46C9E7C046B4\
S31500005C50B46D0000D0680000646F0000F8FF00001B\
S31500005C60C14B984684234246D45AA4B2002C21D074\
S31500005C70043BD35800251B89023B9BB2032B00D85B\
S31500005C8075E3FFF706FB0490049B002B00D172B668\
S31500005C908422434641469B5A1B1B9BB28B52049B54\
S31500005CA0002B00D161E3424680232100D0582A0010\
S31500005CB0FDF7F8F88C234246D45AA4B2002C21D022\
S31500005CC0043BD35800251B89023B9BB2032B00D80B\
S31500005CD046E3FFF7DEFA0590059B002B00D172B66E\
S31500005CE08C22434641469B5A1B1B9BB28B52059BFB\
S31500005CF0002B00D12DE3424688232100D0582A00EC\
S31500005D00FDF7D0F894234246D45AA4B2002C21D0F1\
S31500005D10043BD35800251B89023B9BB2032B00D8BA\
S31500005D2012E3FFF7B6FA0690069B002B00D172B677\
S31500005D309422434641469B5A1B1B9BB28B52069BA1\
S31500005D40002B00D1FEE2424690232100D0582A00C3\
S31500005D50FDF7A8F89C234246D45AA4B2002C21D0C1\
S31500005D60043BD35800251B89023B9BB2032B00D86A\
S31500005D70E3E2FFF78EFA0790079B002B00D172B67D\
S31500005D809C22434641469B5A1B1B9BB28B52079B48\
S31500005D90002B00D1CFE2424698232100D0582A009A\
S31500005DA0FDF780F8A4234246D45AA4B2002C21D091\
S31500005DB0043BD35800251B89023B9BB2022B00D81B\
S31500005DC0B4E2FFF766FA0890089B002B00D172B682\
S31500005DD0A422434641469B5A1B1B9BB28B52089BEF\
S31500005DE0002B00D1A0E24246A0232100D0582A0071\
S31500005DF0FDF758F8AC234246D45AA4B2002C21D061\
S31500005E00043BD35800251B89023B9BB2032B00D8C9\
S31500005E1085E2FFF73EFA0990099B002B00D172B686\
S31500005E20AC22434641469B5A1B1B9BB28B52099B95\
S31500005E30002B00D171E24246A8232100D0582A0047\
S31500005E40FDF730F8B4234246D45AA4B2002C21D030\
S31500005E50043BD35800251B89023B9BB2032B00D879\
S31500005E6056E2FFF716FA0A900A9B002B00D172B68B\
S31500005E70B422434641469B5A1B1B9BB28B520A9B3C\
S31500005E80002B00D16AE24246B0232100D0582A00F6\
S31500005E90FDF708F8BC234246D45AA4B2002C50D0D1\
S31500005EA0B8234246D35800251B89023B9BB2032BDD\
S31500005EB000D8E9E1FFF7EDF90B900B9B002B00D121\
S31500005EC0E0E1BC22434641469B5A1B1B9BB28B52C8\
S31500005ED00B9B002B00D162B6B82342462100D05856\
S31500005EE02A00FCF7DFFF00242CE01F4B9C88984615\
S31500005EF0A4B2002C25D01B6800251B89023B9BB24F\
S31500005F00032B00D8DAE1FFF7C4F90C900C9B002BA9\
S31500005F1000D1D1E1434642469B881B1B9BB293802E\
S31500005F200C9B002B00D162B64346210018682A005C\
S31500005F30FCF7B8FF002405E00C4B1B88002B00D0B3\
S31500005F40C2E10024200017B03CBC90469946A24608\
S31500005F50AB46F0BD00239B4643E6B34641E633001D\
S31500005F60083B9BB29B463CE6646F0000466A000015\
S31500005F70A4210123B54AFF31B548FEF7FFFDE0E74E\
S31500005F80B44D4C462B899BB29A46002B66D12B8A80\
S31500005F909BB29846002B00D05EE12F8BBFB2002F3C\
S31500005FA000D03DE12E8CB6B2002E00D023E12B8D21\
S31500005FB09BB29946002B00D007E12B8E9BB2029331\
S31500005FC0002B00D0EBE02B8F9BB20193002B00D06F\
S31500005FD0CFE04023EB5A9BB20393002B00D0B2E0F4\
S31500005FE02B0044339B889BB29B4653465B444344F9\
S31500005FF09BB298465B46002B00D08CE02B004433C6\
S315000060009B899BB29B4643465B44FF185B46BFB2E7\
S31500006010002B68D12B0044339B8A9BB29A46574487\
S31500006020F619B6B2002B46D12B0044339F8B029B48\
S31500006030BFB29C46BE19019B4E4466449C46039BD8\
S3150000604066449C466644B6B2002F1DD1A419A4B27C\
S31500006050002C00D176E7FEF76DFA73E7FFF719F922\
S315000060601490149B002B00D172B652462B899B1AB2\
S315000060709BB22B81149B002B00D162B600225146A5\
S315000060806868FCF70FFF82E7FFF703F91590159B89\
S31500006090002B00D172B62A004432938BDB1B9BB2D5\
S315000060A09383159B002B00D162B6E86D0022390060\
S315000060B0FCF7F8FECAE7FFF7ECF81590159B002BE6\
S315000060C000D172B62A0051464432938A5B1A9BB2BB\
S315000060D09382159B002B00D162B600225146686D53\
S315000060E0FCF7E0FEA0E7FFF7D4F81590159B002B10\
S315000060F000D172B62A005946443293895B1A9BB284\
S315000061009381159B002B00D162B600225946E86C9C\
S31500006110FCF7C8FE7EE7FFF7BCF81590159B002B31\
S3150000612000D172B62A005946443293885B1A9BB254\
S315000061309380159B002B00D162B600225946686CED\
S31500006140FCF7B0FE5AE7FFF7A4F81490149B002B57\
S3150000615000D172B640220399AB5A5B1A9BB2AB527E\
S31500006160149B002B00D162B60022E86BFCF79AFE66\
S3150000617036E7FFF78EF81490149B002B00D172B609\
S315000061802B8F019A9B1A9BB22B87149B002B00D155\
S3150000619062B600220199686BFCF784FE19E7FFF7E7\
S315000061A078F81490149B002B00D172B62B8E029AAD\
S315000061B09B1A9BB22B86149B002B00D162B6002241\
S315000061C00299E86AFCF76EFEFDE6FFF762F81490A6\
S315000061D0149B002B00D172B64A462B8D9B1A9BB29C\
S315000061E02B85149B002B00D162B600224946686AB3\
S315000061F0FCF758FEE1E6FFF74CF81490149B002BD1\
S3150000620000D172B62B8C9B1B9BB22B84149B002B4C\
S3150000621000D162B600223100E869FCF743FEC6E60B\
S31500006220FFF737F81490149B002B00D172B62B8B16\
S31500006230DB1B9BB22B83149B002B00D162B6002282\
S3150000624039006869FCF72EFEACE6C046AC69000072\
S3150000625074690000FC6E0000FFF71BF81490149B95\
S31500006260002B00D172B642462B8A9B1A9BB22B8218\
S31500006270149B002B00D162B600224146E868FCF769\
S3150000628011FE8AE672B61CE6424A5B00D3181D8FE1\
S3150000629010E672B67FE43F4A5B00D31870229D5A1F\
S315000062A0FFF772FC72B6FFF7D3FB3A4A5B00D318CE\
S315000062B050229D5AFFF7C4FB72B62BE6354A5B00A7\
S315000062C0D31840229D5A1EE6334B344A1B880121BF\
S315000062D05B009A5A324B92B21868FCF7E3FD002431\
S315000062E030E62C4A5B00D31868229D5AFFF723FC40\
S315000062F062B6FFF733FC62B6FFF708FC254A5B007F\
S31500006300D31860229D5AFFF7EEFB62B6FFF7D6FB65\
S31500006310204A5B00D3181D8EA3E562B68BE51D4AA5\
S315000063205B00D3181D8D74E562B65CE5194A5B0007\
S31500006330D3181D8C45E562B62DE5164A5B00D318C9\
S315000063401D8B16E562B6FEE4124A5B00D3181D8A61\
S31500006350E7E462B6CFE462B6FFF75DFB62B692E5AC\
S315000063600C4A5B00D3181D89B3E462B69BE4094A64\
S315000063705B009D5AFFF785FC064A5B00D31858223E\
S315000063809D5AFFF788FB034A5B00D31848229D5AA3\
S31500006390FFF72FFBE8680000486A00002470000041\
S315000063A0F86A0000F8B56426514D0400AA5B132A6A\
S315000063B00CD8438801881B040B43012B4ED0002BBD\
S315000063C014D0022B2FD0032B08D1F8BDD2210123E4\
S315000063D0484AFF314848FEF7D1FBF6E789210123F9\
S315000063E0464A89004448FEF7C9FBEEE74449078957\
S315000063F00978FF0000290BD1EB195B68002B07D049\
S31500006400E221404A0123FF313B48FEF7B7FBAA5B76\
S315000064100021EF197C6039816423511CE9523A4B03\
S315000064209200D450D1E70389032B4ED036D9042BE2\
S315000064302ED0052B42D1A021344B58500021A42048\
S31500006440195204301C500430195204301C500430C8\
S31500006450195204301C5004301952DDE7284B0789C5\
S315000064601B78FF00002B0BD1EB195B6C002B07D0C0\
S31500006470F021244A0123FF311F48FEF77FFBAA5B68\
S31500006480EB195C642B004433DF190023BB80C3E7A0\
S3150000649080211E4B585000218420D1E7022B0DD1BC\
S315000064A01A4B0021186698666C20995319520830C9\
S315000064B0195208301C679C671952ADE71349DB0077\
S315000064C05C50CB1800219980A6E70D4B1B78032B57\
S315000064D0A2D00E4B002118644420195208301952DC\
S315000064E00830195208309C641C659C65195293E764\
S315000064F0FC6E0000BC69000074690000046A0000BC\
S31500006500B46D0000D469000024720000646F0000BE\
S3150000651000226421314B30B51A605A524023304A6A\
S3150000652004C3C02BFCD140202E4B2F4A03604423CA\
S315000065301A602E4A01245A604C222D4B0225136004\
S315000065405360936058232B4A1A602B4A5A602B4A91\
S315000065509A602B4A1368234313602A4B1968214318\
S31500006560196014682C43146019682943196014686B\
S3150000657002352C43146019682943196014680435E0\
S315000065802C431460196829431960146808352C4394\
S315000065901460196829431960146810352C43146077\
S315000065A0802419682943196011680143116019682C\
S315000065B0014319601068204310601968214319606F\
S315000065C0802110684900084310601A6811437E2232\
S315000065D019600D4BFF321B68DA6130BDFC6E00009E\
S315000065E0895900005D590000A1520000E9580000D9\
S315000065F0A552000005590000D55800003959000081\
S3150000660080E200E000E100E094670000F0B51C4F76\
S31500006610C600BB199C8883B0A4B2002C1FD0BB59FE\
S315000066201B89032B21D023D9042B1BD0052B24D166\
S31500006630143885B2FEF72DFE0190019B002B00D188\
S3150000664072B6BA1993881B1B9BB29380019B002BD1\
S3150000665000D162B6B8592A002100FCF723FC2000BD\
S3150000666003B0F0BD103885B2E4E7083885B2E1E73B\
S31500006670022B02D10C3885B2DCE70025DAE7C046EA\
S31500006680646F000030B5848883B0A4B20500002C86\
S3150000669002D1200003B030BDFEF7FBFD0190019B47\
S315000066A0002B00D172B6AB881B1B9BB2AB80019B43\
S315000066B0002B00D162B668882B880004184300229C\
S30D000066C02100FCF7EFFBE4E703\
S315000066C84A190000FC190000EC1A0000201C000002\
S315000066D8B01C0000E81D0000DA1800000C190000C4\
S315000066E82C2C0000182C0000FC2B0000DC2B0000D2\
S315000066F84A2C0000C62B0000B42B0000942B000087\
S31500006708FC2A0000AC2A00008A2A0000682A000039\
S31500006718502A00002E2A00000C2A0000F429000046\
S31500006728BA290000DC2A000030330000F82E0000E9\
S3150000673894350000DE310000683100006831000041\
S315000067480E3500000E350000EA3E0000243F00002A\
S315000067584A3F00009E3F000092400000E23F0000D2\
S3150000676812410000B63F000080400000EA3E0000EB\
S31500006778EA3E0000EA3E0000003F0000BE3E000080\
S31500006788584000004E400000004000400010004005\
S31500006798002000404E6F2077726974652068657224\
S315000067A86500000046444D41207175657565206693\
S315000067B8756C6C00737461727444657628293A2086\
S315000067C8756E6B6E6F776E2064657669636500001B\
S315000067D84C6F6F70207761746368646F67206578A3\
S315000067E87069726564000000556E6B6F776E206580\
S315000067F86E67696E6520747970650000556E6B6EFC\
S315000068086F776E20747970650000000049444D4129\
S31500006818206572726F720A0046617374444D412096\
S315000068286572726F7200000070726F6365737345EC\
S3150000683876656E7428293A20756E6B6E6F776E20B2\
S31500006848696E64657800000070726F6365737345DE\
S3150000685876656E7428293A20756E6B6E6F776E2092\
S315000068686465766963650000496C6C6567616C20D0\
S315000068786E6F6465206E756D626572006368656328\
S315000068886B537461727444657628293A20756E6B69\
S315000068986E6F776E2064657669636500556E6B6EFC\
S315000068A86F776E206D65737361676520747970659F\
S315000068B8000000004D302B20657863657074696FA1\
S315000068C86E20403078000000BC5B0000605C000071\
S315000068D8EA5E0000385F0000D4590000745A0000D0\
S315000068E8040008000000FCFF050009000100FDFF88\
S315000068F806000A000200FEFF07000B000300FFFF68\
S3150000690808000C000400000009000D000500010045\
S315000069180A000E00060002000B000F000700030025\
S31500006928F4FFF8FFF0FFECFFFAFFFEFFF6FFF2FFB9\
S31500006938FBFFFFFFF7FFF3FF0400FCFFF8FF000073\
S3150000694801000500FDFFF9FF02000600FEFFFAFF41\
S3150000695803000700FFFFFBFF5345515F46646D6167\
S31500006968457272486E646C28290000002E2E2F731B\
S3150000697872632F7365715F696E742E630000000081\
S315000069885345515F457272486E646C2829000000B1\
S31500006998556E7573656420696E7465727275707468\
S315000069A800000000556E6B6E6F776E206D6F646524\
S315000069B800000000496E744465762D617272617933\
S315000069C820746F20736D616C6C000000495055206F\
S315000069D86D756C746920757365206F6E6C7920739C\
S315000069E87570706F72746564207769746820737443\
S315000069F861746963207365712E0000005345515F09\
S31500006A0845766E74526567496E7444657628293AE8\
S31500006A1820756E6B6E6F776E2064657669636500A8\
S30D00006A30010001000100010054\
S7050000010CED\
"\
};
|
the_stack_data/465912.c | #include <stdio.h>
#include <stdlib.h>
#include <assert.h>
int main(){
fprintf(stderr, "This technique only works with buffers not going into tcache, either because the tcache-option for "
"glibc was disabled, or because the buffers are bigger than 0x408 bytes. See build_glibc.sh for build "
"instructions.\n");
fprintf(stderr, "This file demonstrates unsorted bin attack by write a large unsigned long value into stack\n");
fprintf(stderr, "In practice, unsorted bin attack is generally prepared for further attacks, such as rewriting the "
"global variable global_max_fast in libc for further fastbin attack\n\n");
volatile unsigned long stack_var=0;
fprintf(stderr, "Let's first look at the target we want to rewrite on stack:\n");
fprintf(stderr, "%p: %ld\n\n", &stack_var, stack_var);
unsigned long *p=malloc(0x410);
fprintf(stderr, "Now, we allocate first normal chunk on the heap at: %p\n",p);
fprintf(stderr, "And allocate another normal chunk in order to avoid consolidating the top chunk with"
"the first one during the free()\n\n");
malloc(500);
free(p);
fprintf(stderr, "We free the first chunk now and it will be inserted in the unsorted bin with its bk pointer "
"point to %p\n",(void*)p[1]);
//------------VULNERABILITY-----------
p[1]=(unsigned long)(&stack_var-2);
fprintf(stderr, "Now emulating a vulnerability that can overwrite the victim->bk pointer\n");
fprintf(stderr, "And we write it with the target address-16 (in 32-bits machine, it should be target address-8):%p\n\n",(void*)p[1]);
//------------------------------------
malloc(0x410);
fprintf(stderr, "Let's malloc again to get the chunk we just free. During this time, the target should have already been "
"rewritten:\n");
fprintf(stderr, "%p: %p\n", &stack_var, (void*)stack_var);
assert(stack_var != 0);
}
|
the_stack_data/143581.c | /* Generated by CIL v. 1.7.0 */
/* print_CIL_Input is false */
struct _IO_FILE;
struct timeval;
extern void signal(int sig , void *func ) ;
extern float strtof(char const *str , char const *endptr ) ;
typedef struct _IO_FILE FILE;
extern int atoi(char const *s ) ;
extern double strtod(char const *str , char const *endptr ) ;
extern int fclose(void *stream ) ;
extern void *fopen(char const *filename , char const *mode ) ;
extern void abort() ;
extern void exit(int status ) ;
extern int raise(int sig ) ;
extern int fprintf(struct _IO_FILE *stream , char const *format , ...) ;
extern int strcmp(char const *a , char const *b ) ;
extern int rand() ;
extern unsigned long strtoul(char const *str , char const *endptr , int base ) ;
void RandomFunc(unsigned char input[1] , unsigned char output[1] ) ;
extern int strncmp(char const *s1 , char const *s2 , unsigned long maxlen ) ;
extern int gettimeofday(struct timeval *tv , void *tz , ...) ;
extern int printf(char const *format , ...) ;
int main(int argc , char *argv[] ) ;
void megaInit(void) ;
extern unsigned long strlen(char const *s ) ;
extern long strtol(char const *str , char const *endptr , int base ) ;
extern unsigned long strnlen(char const *s , unsigned long maxlen ) ;
extern void *memcpy(void *s1 , void const *s2 , unsigned long size ) ;
struct timeval {
long tv_sec ;
long tv_usec ;
};
extern void *malloc(unsigned long size ) ;
extern int scanf(char const *format , ...) ;
int main(int argc , char *argv[] )
{
unsigned char input[1] ;
unsigned char output[1] ;
int randomFuns_i5 ;
unsigned char randomFuns_value6 ;
int randomFuns_main_i7 ;
{
megaInit();
if (argc != 2) {
printf("Call this program with %i arguments\n", 1);
exit(-1);
} else {
}
randomFuns_i5 = 0;
while (randomFuns_i5 < 1) {
randomFuns_value6 = (unsigned char )strtoul(argv[randomFuns_i5 + 1], 0, 10);
input[randomFuns_i5] = randomFuns_value6;
randomFuns_i5 ++;
}
RandomFunc(input, output);
if (output[0] == 84) {
printf("You win!\n");
} else {
}
randomFuns_main_i7 = 0;
while (randomFuns_main_i7 < 1) {
printf("%u\n", output[randomFuns_main_i7]);
randomFuns_main_i7 ++;
}
}
}
void megaInit(void)
{
{
}
}
void RandomFunc(unsigned char input[1] , unsigned char output[1] )
{
unsigned char state[1] ;
{
state[0UL] = (input[0UL] + 51238316UL) + (unsigned char)234;
if ((state[0UL] >> (unsigned char)4) & (unsigned char)1) {
if ((state[0UL] >> (unsigned char)3) & (unsigned char)1) {
state[0UL] += state[0UL];
} else {
state[0UL] += state[0UL];
}
} else {
state[0UL] += state[0UL];
}
output[0UL] = (state[0UL] - 838946365UL) + (unsigned char)243;
}
}
|
the_stack_data/161079334.c | #include <stdio.h>
void disparray(char *array[]);
int main(void)
{
char *x[] = {
"Hello world!",
"This is a C program.",
"I love C!",
"I love Godson!",
"I love linux!"
};
disparray(x);
return 0;
}
void disparray(char *array[])
{
int i, j;
i = 0;
while (*array[i])
{
printf("%s \n", array[i]);
j = 0;
while (array[i][j])
{
printf("%c* ", array[i][j]);
j++;
}
putchar('\n');
i++;
}
}
|
the_stack_data/50138458.c | double squarepulse(double t,
double t0,
double t1) {
return t >= t0 && t < t1;
}
|
the_stack_data/15763752.c | /* Copyright 2019 Rose-Hulman */
#include <stdio.h>
#include <pthread.h>
#include <semaphore.h>
#include <unistd.h>
// number of carpenters
#define NUM_CARP 3
// number of painters
#define NUM_PAIN 3
// number of decorators
#define NUM_DECO 3
/**
Imagine there is a shared memory space called house.
There are 3 different kinds of operations on house: carpenters, painters, and
decorators. For any particular kind of operation, there can be an unlimited
number of threads doing the same operation at once (e.g. unlimited carpenter
threads etc.). However, only one kind of operation can be done at a time (so
even a single carpenter should block all painters and vice versa).
Use mutex locks and condition variables to enforce this constraint. You don't
have to worry about starvation (e.g. that constantly arriving decorators might
prevent carpenters from ever running) - though maybe it would be fun to
consider how you would solve in that case.
This is similar to the readers/writers problem BTW.
**/
pthread_cond_t house;
pthread_mutex_t lock;
enum jobs
{
idle = -1,
carpentry = 0,
painting = 1,
decoration = 2
};
int current_job = idle;
int num_carps = 0;
int num_paints = 0;
int num_decs = 0;
void *carpenter(void *ignored)
{
pthread_mutex_lock(&lock);
if (current_job == idle)
{
current_job = carpentry;
}
while (current_job != carpentry)
{
pthread_cond_wait(&house, &lock);
if (current_job == idle)
{
current_job = carpentry;
}
}
current_job = carpentry;
num_carps++;
pthread_mutex_unlock(&lock);
printf("starting carpentry\n");
sleep(1);
printf("finished carpentry\n");
pthread_mutex_lock(&lock);
num_carps--;
if (num_carps <= 0)
{
current_job = idle;
pthread_cond_broadcast(&house);
}
pthread_mutex_unlock(&lock);
return NULL;
}
void *painter(void *ignored)
{
pthread_mutex_lock(&lock);
if (current_job == idle)
{
current_job = painting;
}
while (current_job != painting)
{
pthread_cond_wait(&house, &lock);
if (current_job == idle)
{
current_job = painting;
}
}
current_job = painting;
num_paints++;
pthread_mutex_unlock(&lock);
printf("starting painting\n");
sleep(1);
printf("finished painting\n");
pthread_mutex_lock(&lock);
num_paints--;
if (num_paints <= 0)
{
current_job = idle;
pthread_cond_broadcast(&house);
}
pthread_mutex_unlock(&lock);
return NULL;
}
void *decorator(void *ignored)
{
pthread_mutex_lock(&lock);
if (current_job == idle)
{
current_job = decoration;
}
while (current_job != decoration)
{
pthread_cond_wait(&house, &lock);
if (current_job == idle)
{
current_job = decoration;
}
}
current_job = decoration;
num_decs++;
pthread_mutex_unlock(&lock);
printf("starting decorating\n");
sleep(1);
printf("finished decorating\n");
pthread_mutex_lock(&lock);
num_decs--;
if (num_decs <= 0)
{
current_job = idle;
pthread_cond_broadcast(&house);
}
pthread_mutex_unlock(&lock);
return NULL;
}
int main(int argc, char **argv)
{
pthread_t jobs[NUM_CARP + NUM_PAIN + NUM_DECO];
for (int i = 0; i < NUM_CARP + NUM_PAIN + NUM_DECO; i++)
{
void *(*func)(void *) = NULL;
if (i < NUM_CARP)
func = carpenter;
if (i >= NUM_CARP && i < NUM_CARP + NUM_PAIN)
func = painter;
if (i >= NUM_CARP + NUM_PAIN)
{
func = decorator;
}
pthread_create(&jobs[i], NULL, func, NULL);
}
for (int i = 0; i < NUM_CARP + NUM_PAIN + NUM_DECO; i++)
{
pthread_join(jobs[i], NULL);
}
printf("Everything finished.\n");
}
|
the_stack_data/156394176.c | /* $OpenBSD: base64.c,v 1.3 1997/11/08 20:46:55 deraadt Exp $ */
/*
* Copyright (c) 1996 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
/*
* Portions Copyright (c) 1995 by International Business Machines, Inc.
*
* International Business Machines, Inc. (hereinafter called IBM) grants
* permission under its copyrights to use, copy, modify, and distribute this
* Software with or without fee, provided that the above copyright notice and
* all paragraphs of this notice appear in all copies, and that the name of IBM
* not be used in connection with the marketing of any product incorporating
* the Software or modifications thereof, without specific, written prior
* permission.
*
* To the extent it has a right to do so, IBM grants an immunity from suit
* under its patents, if any, for the use, sale or manufacture of products to
* the extent that such products are used for performing Domain Name System
* dynamic updates in TCP/IP networks by means of the Software. No immunity is
* granted for any product per se or for any other function of any product.
*
* THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL,
* DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN
* IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
#include <sys/types.h>
#include <sys/param.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <arpa/nameser.h>
#include <ctype.h>
#include <resolv.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define Assert(Cond) if (!(Cond)) abort()
static const char Base64[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
static const char Pad64 = '=';
/* (From RFC1521 and draft-ietf-dnssec-secext-03.txt)
The following encoding technique is taken from RFC 1521 by Borenstein
and Freed. It is reproduced here in a slightly edited form for
convenience.
A 65-character subset of US-ASCII is used, enabling 6 bits to be
represented per printable character. (The extra 65th character, "=",
is used to signify a special processing function.)
The encoding process represents 24-bit groups of input bits as output
strings of 4 encoded characters. Proceeding from left to right, a
24-bit input group is formed by concatenating 3 8-bit input groups.
These 24 bits are then treated as 4 concatenated 6-bit groups, each
of which is translated into a single digit in the base64 alphabet.
Each 6-bit group is used as an index into an array of 64 printable
characters. The character referenced by the index is placed in the
output string.
Table 1: The Base64 Alphabet
Value Encoding Value Encoding Value Encoding Value Encoding
0 A 17 R 34 i 51 z
1 B 18 S 35 j 52 0
2 C 19 T 36 k 53 1
3 D 20 U 37 l 54 2
4 E 21 V 38 m 55 3
5 F 22 W 39 n 56 4
6 G 23 X 40 o 57 5
7 H 24 Y 41 p 58 6
8 I 25 Z 42 q 59 7
9 J 26 a 43 r 60 8
10 K 27 b 44 s 61 9
11 L 28 c 45 t 62 +
12 M 29 d 46 u 63 /
13 N 30 e 47 v
14 O 31 f 48 w (pad) =
15 P 32 g 49 x
16 Q 33 h 50 y
Special processing is performed if fewer than 24 bits are available
at the end of the data being encoded. A full encoding quantum is
always completed at the end of a quantity. When fewer than 24 input
bits are available in an input group, zero bits are added (on the
right) to form an integral number of 6-bit groups. Padding at the
end of the data is performed using the '=' character.
Since all base64 input is an integral number of octets, only the
-------------------------------------------------
following cases can arise:
(1) the final quantum of encoding input is an integral
multiple of 24 bits; here, the final unit of encoded
output will be an integral multiple of 4 characters
with no "=" padding,
(2) the final quantum of encoding input is exactly 8 bits;
here, the final unit of encoded output will be two
characters followed by two "=" padding characters, or
(3) the final quantum of encoding input is exactly 16 bits;
here, the final unit of encoded output will be three
characters followed by one "=" padding character.
*/
int
b64_ntop(src, srclength, target, targsize)
u_char const *src;
size_t srclength;
char *target;
size_t targsize;
{
size_t datalength = 0;
u_char input[3];
u_char output[4];
int i;
while (2 < srclength) {
input[0] = *src++;
input[1] = *src++;
input[2] = *src++;
srclength -= 3;
output[0] = input[0] >> 2;
output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
output[3] = input[2] & 0x3f;
Assert(output[0] < 64);
Assert(output[1] < 64);
Assert(output[2] < 64);
Assert(output[3] < 64);
if (datalength + 4 > targsize)
return (-1);
target[datalength++] = Base64[output[0]];
target[datalength++] = Base64[output[1]];
target[datalength++] = Base64[output[2]];
target[datalength++] = Base64[output[3]];
}
/* Now we worry about padding. */
if (0 != srclength) {
/* Get what's left. */
input[0] = input[1] = input[2] = '\0';
for (i = 0; i < srclength; i++)
input[i] = *src++;
output[0] = input[0] >> 2;
output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
Assert(output[0] < 64);
Assert(output[1] < 64);
Assert(output[2] < 64);
if (datalength + 4 > targsize)
return (-1);
target[datalength++] = Base64[output[0]];
target[datalength++] = Base64[output[1]];
if (srclength == 1)
target[datalength++] = Pad64;
else
target[datalength++] = Base64[output[2]];
target[datalength++] = Pad64;
}
if (datalength >= targsize)
return (-1);
target[datalength] = '\0'; /* Returned value doesn't count \0. */
return (datalength);
}
/* skips all whitespace anywhere.
converts characters, four at a time, starting at (or after)
src from base - 64 numbers into three 8 bit bytes in the target area.
it returns the number of data bytes stored at the target, or -1 on error.
*/
int
b64_pton(src, target, targsize)
char const *src;
u_char *target;
size_t targsize;
{
int tarindex, state, ch;
char *pos;
state = 0;
tarindex = 0;
while ((ch = *src++) != '\0') {
if (isspace(ch)) /* Skip whitespace anywhere. */
continue;
if (ch == Pad64)
break;
pos = strchr(Base64, ch);
if (pos == 0) /* A non-base64 character. */
return (-1);
switch (state) {
case 0:
if (target) {
if (tarindex >= targsize)
return (-1);
target[tarindex] = (pos - Base64) << 2;
}
state = 1;
break;
case 1:
if (target) {
if (tarindex + 1 >= targsize)
return (-1);
target[tarindex] |= (pos - Base64) >> 4;
target[tarindex+1] = ((pos - Base64) & 0x0f)
<< 4 ;
}
tarindex++;
state = 2;
break;
case 2:
if (target) {
if (tarindex + 1 >= targsize)
return (-1);
target[tarindex] |= (pos - Base64) >> 2;
target[tarindex+1] = ((pos - Base64) & 0x03)
<< 6;
}
tarindex++;
state = 3;
break;
case 3:
if (target) {
if (tarindex >= targsize)
return (-1);
target[tarindex] |= (pos - Base64);
}
tarindex++;
state = 0;
break;
}
}
/*
* We are done decoding Base-64 chars. Let's see if we ended
* on a byte boundary, and/or with erroneous trailing characters.
*/
if (ch == Pad64) { /* We got a pad char. */
ch = *src++; /* Skip it, get next. */
switch (state) {
case 0: /* Invalid = in first position */
case 1: /* Invalid = in second position */
return (-1);
case 2: /* Valid, means one byte of info */
/* Skip any number of spaces. */
for (; ch != '\0'; ch = *src++)
if (!isspace(ch))
break;
/* Make sure there is another trailing = sign. */
if (ch != Pad64)
return (-1);
ch = *src++; /* Skip the = */
/* Fall through to "single trailing =" case. */
/* FALLTHROUGH */
case 3: /* Valid, means two bytes of info */
/*
* We know this char is an =. Is there anything but
* whitespace after it?
*/
for (; ch != '\0'; ch = *src++)
if (!isspace(ch))
return (-1);
/*
* Now make sure for cases 2 and 3 that the "extra"
* bits that slopped past the last full byte were
* zeros. If we don't check them, they become a
* subliminal channel.
*/
if (target && target[tarindex] != 0)
return (-1);
}
} else {
/*
* We ended by seeing the end of the string. Make sure we
* have no partial bytes lying around.
*/
if (state != 0)
return (-1);
}
return (tarindex);
}
|
the_stack_data/413194.c | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <assert.h>
#include <sys/wait.h>
int
main(int argc, char *argv[])
{
int rc = fork();
if (rc < 0) {
// fork failed; exit
fprintf(stderr, "fork failed\n");
exit(1);
} else if (rc == 0) {
// char *childargs[2];
// childargs[0] = strdup("/usr/bin/ls");
// childargs[1] = NULL;
char *executable = "/usr/bin/ls";
execl(executable, ".");
} else {
wait(NULL);
}
// A lot of variants of the exec system call exists to serve really as small combinations of wrapper options
// l vs v really just specifies using the pointers to null terminated strings passed into the system call vs an array of pointers to null terminated strings
// e specifies an optional environ for the calling process
// p is appended if the system call is to the look on the path for arg[0]
return 0;
}
|
the_stack_data/176704502.c | #include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#define MAX_SIZE 100
/* Kadane:
s(k) = max(s(k-1), s(k-1) + a(k))
maximum = max(maximum, s(k))
*/
int submatrix_max(int m[][MAX_SIZE+1], int n) {
/* column partial sums */
for (int i=1; i<=n; ++i)
for (int j=1; j<=n; ++j)
m[i][j] += m[i-1][j];
int max = INT_MIN;
for (int i1=0; i1<n; ++i1)
for (int i2=i1+1; i2<=n; ++i2) {
/* 1 dimensional Kadane */
int s = 0;
for (int j=1; j<=n; ++j) {
if (s > 0)
s += m[i2][j] - m[i1][j];
else
s = m[i2][j] - m[i1][j];
if (s > max)
max = s;
}
}
return max;
}
int main() {
int n = 0;
int m[MAX_SIZE+1][MAX_SIZE+1] = {0};
while(EOF != scanf("%d", &n)) {
/* read in matrix */
for (int i=1; i<=n; ++i)
for (int j=1; j<=n; ++j)
scanf("%d", &m[i][j]);
printf("%d\n", submatrix_max(m,n));
}
return EXIT_SUCCESS;
}
|
the_stack_data/849411.c | /*
* dremf() wrapper for remainderf().
*
* Written by J.T. Conklin, <[email protected]>
* Placed into the Public Domain, 1994.
*/
#include "math.h"
float
dremf(float x, float y)
{
return remainderf(x, y);
}
|
the_stack_data/26699822.c | /* $OpenBSD: base64.c,v 1.9 2021/10/11 14:32:26 deraadt Exp $ */
/*
* Copyright (c) 1996 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
/*
* Portions Copyright (c) 1995 by International Business Machines, Inc.
*
* International Business Machines, Inc. (hereinafter called IBM) grants
* permission under its copyrights to use, copy, modify, and distribute this
* Software with or without fee, provided that the above copyright notice and
* all paragraphs of this notice appear in all copies, and that the name of IBM
* not be used in connection with the marketing of any product incorporating
* the Software or modifications thereof, without specific, written prior
* permission.
*
* To the extent it has a right to do so, IBM grants an immunity from suit
* under its patents, if any, for the use, sale or manufacture of products to
* the extent that such products are used for performing Domain Name System
* dynamic updates in TCP/IP networks by means of the Software. No immunity is
* granted for any product per se or for any other function of any product.
*
* THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL,
* DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN
* IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <ctype.h>
#include <resolv.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static const char Base64[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
static const char Pad64 = '=';
/* (From RFC1521 and draft-ietf-dnssec-secext-03.txt)
The following encoding technique is taken from RFC 1521 by Borenstein
and Freed. It is reproduced here in a slightly edited form for
convenience.
A 65-character subset of US-ASCII is used, enabling 6 bits to be
represented per printable character. (The extra 65th character, "=",
is used to signify a special processing function.)
The encoding process represents 24-bit groups of input bits as output
strings of 4 encoded characters. Proceeding from left to right, a
24-bit input group is formed by concatenating 3 8-bit input groups.
These 24 bits are then treated as 4 concatenated 6-bit groups, each
of which is translated into a single digit in the base64 alphabet.
Each 6-bit group is used as an index into an array of 64 printable
characters. The character referenced by the index is placed in the
output string.
Table 1: The Base64 Alphabet
Value Encoding Value Encoding Value Encoding Value Encoding
0 A 17 R 34 i 51 z
1 B 18 S 35 j 52 0
2 C 19 T 36 k 53 1
3 D 20 U 37 l 54 2
4 E 21 V 38 m 55 3
5 F 22 W 39 n 56 4
6 G 23 X 40 o 57 5
7 H 24 Y 41 p 58 6
8 I 25 Z 42 q 59 7
9 J 26 a 43 r 60 8
10 K 27 b 44 s 61 9
11 L 28 c 45 t 62 +
12 M 29 d 46 u 63 /
13 N 30 e 47 v
14 O 31 f 48 w (pad) =
15 P 32 g 49 x
16 Q 33 h 50 y
Special processing is performed if fewer than 24 bits are available
at the end of the data being encoded. A full encoding quantum is
always completed at the end of a quantity. When fewer than 24 input
bits are available in an input group, zero bits are added (on the
right) to form an integral number of 6-bit groups. Padding at the
end of the data is performed using the '=' character.
Since all base64 input is an integral number of octets, only the
-------------------------------------------------
following cases can arise:
(1) the final quantum of encoding input is an integral
multiple of 24 bits; here, the final unit of encoded
output will be an integral multiple of 4 characters
with no "=" padding,
(2) the final quantum of encoding input is exactly 8 bits;
here, the final unit of encoded output will be two
characters followed by two "=" padding characters, or
(3) the final quantum of encoding input is exactly 16 bits;
here, the final unit of encoded output will be three
characters followed by one "=" padding character.
*/
int
b64_ntop(src, srclength, target, targsize)
u_char const *src;
size_t srclength;
char *target;
size_t targsize;
{
size_t datalength = 0;
u_char input[3];
u_char output[4];
int i;
while (2 < srclength) {
input[0] = *src++;
input[1] = *src++;
input[2] = *src++;
srclength -= 3;
output[0] = input[0] >> 2;
output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
output[3] = input[2] & 0x3f;
if (datalength + 4 > targsize)
return (-1);
target[datalength++] = Base64[output[0]];
target[datalength++] = Base64[output[1]];
target[datalength++] = Base64[output[2]];
target[datalength++] = Base64[output[3]];
}
/* Now we worry about padding. */
if (0 != srclength) {
/* Get what's left. */
input[0] = input[1] = input[2] = '\0';
for (i = 0; i < srclength; i++)
input[i] = *src++;
output[0] = input[0] >> 2;
output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
if (datalength + 4 > targsize)
return (-1);
target[datalength++] = Base64[output[0]];
target[datalength++] = Base64[output[1]];
if (srclength == 1)
target[datalength++] = Pad64;
else
target[datalength++] = Base64[output[2]];
target[datalength++] = Pad64;
}
if (datalength >= targsize)
return (-1);
target[datalength] = '\0'; /* Returned value doesn't count \0. */
return (datalength);
}
/* skips all whitespace anywhere.
converts characters, four at a time, starting at (or after)
src from base - 64 numbers into three 8 bit bytes in the target area.
it returns the number of data bytes stored at the target, or -1 on error.
*/
int
b64_pton(src, target, targsize)
char const *src;
u_char *target;
size_t targsize;
{
int tarindex, state, ch;
u_char nextbyte;
char *pos;
state = 0;
tarindex = 0;
while ((ch = (unsigned char)*src++) != '\0') {
if (isspace(ch)) /* Skip whitespace anywhere. */
continue;
if (ch == Pad64)
break;
pos = strchr(Base64, ch);
if (pos == 0) /* A non-base64 character. */
return (-1);
switch (state) {
case 0:
if (target) {
if (tarindex >= targsize)
return (-1);
target[tarindex] = (pos - Base64) << 2;
}
state = 1;
break;
case 1:
if (target) {
if (tarindex >= targsize)
return (-1);
target[tarindex] |= (pos - Base64) >> 4;
nextbyte = ((pos - Base64) & 0x0f) << 4;
if (tarindex + 1 < targsize)
target[tarindex+1] = nextbyte;
else if (nextbyte)
return (-1);
}
tarindex++;
state = 2;
break;
case 2:
if (target) {
if (tarindex >= targsize)
return (-1);
target[tarindex] |= (pos - Base64) >> 2;
nextbyte = ((pos - Base64) & 0x03) << 6;
if (tarindex + 1 < targsize)
target[tarindex+1] = nextbyte;
else if (nextbyte)
return (-1);
}
tarindex++;
state = 3;
break;
case 3:
if (target) {
if (tarindex >= targsize)
return (-1);
target[tarindex] |= (pos - Base64);
}
tarindex++;
state = 0;
break;
}
}
/*
* We are done decoding Base-64 chars. Let's see if we ended
* on a byte boundary, and/or with erroneous trailing characters.
*/
if (ch == Pad64) { /* We got a pad char. */
ch = (unsigned char)*src++; /* Skip it, get next. */
switch (state) {
case 0: /* Invalid = in first position */
case 1: /* Invalid = in second position */
return (-1);
case 2: /* Valid, means one byte of info */
/* Skip any number of spaces. */
for (; ch != '\0'; ch = (unsigned char)*src++)
if (!isspace(ch))
break;
/* Make sure there is another trailing = sign. */
if (ch != Pad64)
return (-1);
ch = (unsigned char)*src++; /* Skip the = */
/* Fall through to "single trailing =" case. */
/* FALLTHROUGH */
case 3: /* Valid, means two bytes of info */
/*
* We know this char is an =. Is there anything but
* whitespace after it?
*/
for (; ch != '\0'; ch = (unsigned char)*src++)
if (!isspace(ch))
return (-1);
/*
* Now make sure for cases 2 and 3 that the "extra"
* bits that slopped past the last full byte were
* zeros. If we don't check them, they become a
* subliminal channel.
*/
if (target && tarindex < targsize &&
target[tarindex] != 0)
return (-1);
}
} else {
/*
* We ended by seeing the end of the string. Make sure we
* have no partial bytes lying around.
*/
if (state != 0)
return (-1);
}
return (tarindex);
}
|
the_stack_data/28262591.c | // code: 1
typedef int INT; typedef INT i;
i main() { return 1; }
|
the_stack_data/14201645.c | /* This testcase is part of GDB, the GNU debugger.
Copyright 2002-2016 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
This file is copied from schedlock.c. */
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <pthread.h>
void *thread_function (void *arg); /* Function executed by each thread. */
#define NUM 5
unsigned int args[NUM+1];
int
main ()
{
int res;
pthread_t threads[NUM];
void *thread_result;
long i;
/* To keep the test determinative, initialize args first,
then start all the threads. Otherwise, the way watchthreads.exp
is written, we have to worry about things like threads[0] getting
to 29 hits of args[0] before args[1] gets changed. */
for (i = 0; i < NUM; i++)
{
/* The call to usleep is so that when the watchpoint triggers,
the pc is still on the same line. */
args[i] = 1; usleep (1); /* Init value. */
}
for (i = 0; i < NUM; i++)
{
res = pthread_create (&threads[i],
NULL,
thread_function,
(void *) i);
}
args[i] = 1;
thread_function ((void *) i);
exit (EXIT_SUCCESS);
}
void *
thread_function (void *arg)
{
int my_number = (long) arg;
int *myp = (int *) &args[my_number];
/* Don't run forever. Run just short of it :) */
while (*myp > 0)
{
(*myp) ++; usleep (1); /* Loop increment. */
}
pthread_exit (NULL);
}
|
the_stack_data/997.c | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: exam <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/08/03 18:08:46 by exam #+# #+# */
/* Updated: 2018/08/03 18:19:20 by exam ### ########.fr */
/* */
/* ************************************************************************** */
int ft_strlen(char *a)
{
int i;
i = 0;
while (a[i] != '\0')
{
i++;
}
return (i);
}
char *ft_strcpy(char *s1, char *s2)
{
int i;
if (ft_strlen(s2) > ft_strlen(s1))
return (0);
i = 0;
while (s2[i] != '\0')
{
s1[i] = s2[i];
i++;
}
s1[i] = '\0';
return (s1);
}
|
the_stack_data/248579454.c | /**
* @page install mtoc++ installation instructions
*
* Make sure you have the latest version of mtoc++, see @ref download. Next step after installation is @ref tools
*
* @section inst_req Software requirements and recommendations
* The following programs need to be available on your machine in order to use mtoc++:
* - \c doxygen (>=1.8.1): mtoc++ is a filter for doxygen. If not yet available, get it at http://www.doxygen.org
*
* The following programs will highly improve your documentation creation experience if available:
* - \c dot: A Graphviz tool that allows doxygen to create nice graphics for inheritance trees and collaboration diagrams.
* - \c latex: Required to use LaTeX processing capabilities of doxygen (e.g. http://www.latex-project.org/ftp.html).
* mtoc++ comes with some markups for better latex inclusion into the text flow.
* Also, easy inclusion of external latex sources and styles is included in mtoc++'s tools.
* - \c ghostscript: If using formulas with doxygen and you are not using pdflatex or are on a windows machine, this
* is a prerequisite (see http://www.stack.nl/~dimitri/doxygen/install.html#install_bin_windows)
*
* If you want to build mtoc++ from source, you will also need:
* - Ragel: A finite-state machine compiler. Get at http://www.complang.org/ragel
* - CMake: Cross-platform make. Get at http://www.cmake.org
* - dirent.h (We included a Visual Studio API implementation by Tony Ronkko for Windows)
*
* @section inst_binaries Using precompiled binaries
* @subsection inst_binaries_win Windows users
*
* If you are a windows user you can directly download the binaries at @ref download.
* Then simply place the binaries in a folder of your choice and add the folder to the PATH environment variable.
* If you intend to use the MatlabDocMaker, you can also copy the mtoc++ binaries into the "documentation configuration files" folder
* for your/each project, this path will be added to PATH by MatLab locally.
*
* @note Depending on your system setup, you might need to install the Microsoft Visual C++ 2010 redistributables,
* which can be found <a href="http://www.microsoft.com/download/en/confirmation.aspx?id=8328" target="_blank">here</a>.
*
* @attention mtoc++ as well as doxygen expect all required programs (see \ref inst_req) to be available via the PATH environment variable, e.g. \c latex.exe or \c gswin32c.exe
* must be present in order for doxygen to work with LaTeX output. Make sure that you have all requirements available, otherwise doxygen or the MatlabDocMaker will complain soon enough.
* You can check/change your Windows PATH environment variable via the sequence
* @code Computer \ Properties \ Advanced system settings \ Environment Variables \ Edit Path @endcode
*
* We are trying to always compile current Windows binaries for \c mtocpp and \c mtocpp_post and include them for direct download.
*
* @subsection inst_binaries_unix Unix binaries
* For unix users we recommend to compile the sources following @ref inst_comp.
*
* However, we also plan to provide some precompiled linux binaries/packages soon.
* If you find a matching choice you can use it and all you have to do is to ensure that the binaries can be found on the environment PATH.
*
* @section inst_comp Compiling mtoc++ from source
* Please check the @ref inst_req when you intend to build mtoc++ yourself.
*
* mtoc++ is built using the cmake (cross-platform make) tool. This tool is available for both unix and Windows,
* however, we only tested compiling our sources on linux and MS Visual Studio 2010.
*
* @subsection inst_comp_win Windows platforms
* For Windows compilation, you need a Windows C++ compiler (e.g. MinGW or Visual Studio). Then running
* the CMake GUI allows you to choose a compiler, specify any CMake configuration settings and create the
* makefiles/Visual Studio projects needed for compilation.
*
* Furthermore, we're using the \c dirent.h library for file access. As this is a linux library we've included a file
* \c dirent_msvc.h in our source, which implements the dirent api for Microsoft Visual Studio and was written by Tony Ronkko.
* More information and downloads can be found at http://www.softagalleria.net/dirent.php.
*
* @note On Windows, you can build both 32bit and 64bit versions. If you build with Visual Studio, in recent CMake versions you need to specify the target architecture
* already when choosing the generator ("Visual Studio 10 / Visual Studio 10 Win64"). This sets up the VS2010 project with the correct platforms.
* In general, you can of course also use 64bit binaries from ragel and doxygen, but this is not required for successful 64bit-compilation of mtoc++ .
*
* @subsection inst_comp_unix Unix platforms
*
* The following procedure is an example of how to compile mtoc++ on a linux machine:
* @code tar -xcvf mtocpp.tar.gz
* cd mtocpp
*
* # Create build folder (optional, but more clean)
* mkdir build
* cd build
*
* # Run cmake
* cmake ..
* make install
* @endcode
*
* @attention Please be aware that, depending on your installation location, you might need different access/write permissions.
* For most cases, a @code sudo make install@endcode will do the job if the above snippet fails.
*
* @subsection inst_comp_apple Apple hints
* For installation under recent Apple OS like 10.8.2, the <a href="http://www.macports.org/">MacPorts</a> project is a very useful tool
* to obtain prerequisites for mtoc++ compilation. Once installed, get \c ragel and \c doxygen via
* @code
* sudo port
* > install ragel
* > install doxygen
* @endcode
*
* @subsection inst_cust CMake options: Installation folders and customization
*
* @note These options are explained for the linux case, for windows the CMake GUI allows to set the relevant options.
*
* The default value for the install prefix is \c /usr/local, so the mtocpp binaries \c mtocpp and \c mtocpp_post go to \c /usr/local/bin
* and the documentation is created inside \c /usr/local/share/doc/mtocpp.
*
* If you want the "make install" command to copy the binaries and documentation to different locations, you can choose them by setting the following variables:
* - CMAKE_INSTALL_PREFIX: Set this to whatever location you want mtoc++ to be installed. Note that the binaries are effectively copied into "CMAKE_INSTALL_PREFIX/bin" in order to comply with linux standards.
* - CUSTOM_DOC_DIR: This value is "CMAKE_INSTALL_PREFIX/share/doc/mtocpp" per default.
*
* So typing
* @code cmake -DCMAKE_INSTALL_PREFIX="/my/root/dir" -DCUSTOM_DOC_DIR="/my/docs" @endcode
* will copy the binaries to \c /my/root/dir/bin and the documentation to \c /my/docs.
*
* If you left the \c CUSTOM_DOC_DIR flag empty the documentation would have gone to \c /my/root/dir/share/doc/mtocpp
*
* @section inst_test Testing
* mtoc++ comes with some unit tests to check for e.g. successful compilation.
* Run the tests by typing
* @code make test @endcode
* in the same folder where you called \c cmake.
*
* On Windows, dedendent on your compiler, you will either have makefiles for the test cases or a separate Visual Studio project to run the tests.
*
* Have fun!
*/
|
the_stack_data/1041078.c | /*
** EPITECH PROJECT, 2017
** CPool_Day06_2017
** File description:
** task14
*/
int my_str_isprintable(char const *str)
{
int i = 0;
if (str[i] == '\0')
return (1);
while (str[i] != '\0') {
if (str[i] >= 32 && str[i] <= 126)
i++;
else
return (0);
}
return (1);
}
|
the_stack_data/36074059.c | extern int foo (int, int, int (*) (int, int, int, int, int, int, int));
int z;
int
main (void)
{
#ifndef NO_TRAMPOLINES
int sum = 0;
int i;
int nested (int a, int b, int c, int d, int e, int f, int g)
{
z = c + d + e + f + g;
if (a > 2 * b)
return a - b;
else
return b - a;
}
for (i = 0; i < 10; ++i)
{
int j;
for (j = 0; j < 10; ++j)
{
int k;
for (k = 0; k < 10; ++k)
sum += foo (i, j > k ? j - k : k - j, nested);
}
}
if (sum != 2300)
abort ();
if (z != 0x1b)
abort ();
#endif
exit (0);
}
int
foo (int a, int b, int (* fp) (int, int, int, int, int, int, int))
{
return fp (a, b, a, b, a, b, a);
}
|
the_stack_data/28263619.c | /* PR rtl-optimization/23241 */
/* Origin: Josh Conner <[email protected]> */
/* { dg-do run } */
/* { dg-options "-O2" } */
extern void abort(void);
struct fbs {
unsigned char uc;
} fbs1 = {255};
void fn(struct fbs *fbs_ptr)
{
if ((fbs_ptr->uc != 255) && (fbs_ptr->uc != 0))
abort();
}
int main(void)
{
fn(&fbs1);
return 0;
}
|
the_stack_data/176706851.c | #include <stdio.h>
#include <time.h>
void dump_time_struct_bytes(struct tm *time_ptr, int size) {
int i;
unsigned char *raw_ptr;
printf("bytes of struct located at 0x%08x\n", time_ptr);
raw_ptr = (unsigned char *) time_ptr;
for(i=0; i < size; i++)
{
printf("%02x ", raw_ptr[i]);
if(i%16 == 15) // print a newline every 16 bytes
printf("\n");
}
printf("\n");
}
int main() {
long int seconds_since_epoch;
struct tm current_time, *time_ptr;
int hour, minute, second, i, *int_ptr;
seconds_since_epoch = time(0); // pass time a null pointer as argument
printf("time() - seconds since epoch: %ld\n", seconds_since_epoch);
time_ptr = ¤t_time; // set time_ptr to the address of
// the current_time struct
localtime_r(&seconds_since_epoch, time_ptr);
// three different ways to access struct elements
hour = current_time.tm_hour; // direct access
minute = time_ptr->tm_min; // access via pointer
second = *((int *) time_ptr); // hacky pointer access
printf("Current time is: %02d:%02d:%02d\n", hour, minute, second);
dump_time_struct_bytes(time_ptr, sizeof(struct tm));
minute = hour = 0; // clear out minute and hour
int_ptr = (int *) time_ptr;
for(i=0; i < 3; i++) {
printf("int_ptr @ 0x%08x : %d\n", int_ptr, *int_ptr);
int_ptr++; // adding 1 to int_ptr adds 4 to the address,
} // since an int is 4 bytes in size
}
|
the_stack_data/110712.c | /*
* Copyright (c) 1983, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. 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 REGENTS 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 REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#if defined(LIBC_SCCS) && !defined(lint)
static char rcsid[] = "$OpenBSD: inet_netof.c,v 1.3 1997/04/05 21:13:13 millert Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
#include <netinet/in.h>
#include <arpa/inet.h>
/*
* Return the network number from an internet
* address; handles class a/b/c network #'s.
*/
in_addr_t
inet_netof(in)
struct in_addr in;
{
register in_addr_t i = ntohl(in.s_addr);
if (IN_CLASSA(i))
return (((i)&IN_CLASSA_NET) >> IN_CLASSA_NSHIFT);
else if (IN_CLASSB(i))
return (((i)&IN_CLASSB_NET) >> IN_CLASSB_NSHIFT);
else
return (((i)&IN_CLASSC_NET) >> IN_CLASSC_NSHIFT);
}
|
the_stack_data/215767950.c | #include <stdio.h>
#include <stdlib.h>
#include <locale.h> //Para incluir a biblioteca com os acentos
/* Tabela ASCII e acentuacao
1 byte (8 bits) ==> -128 até 127
unsigned 1 byte ==> 0 até 255
9 é o caractere de tabulacao \t
10 é caracatere de nova linha \n
65 é a letra A maiuscula
66 é a letra B maiuscula
90 é a letra Z maiuscula
*/
int main(int argc, char const *argv[])
{
setlocale(LC_ALL, "Portuguese");
/* setlocale( LC_ALL, NULL); ==> padrao da linguagem C , nao tem muita utilidade para acentos
setlocale(LC_ALL, ""); ==> padaro do sistema operacional , se o OS estiver em outro idioma em outro computador, irá gerar um problema
setlocale(LC_ALL, "Portuguese"); portugues Brasileiro , melhor possibilidade para utilizar acentos
*/
printf("Coração\n"); // A impressao de coração nao saira correta, este problema acontece somente no WINDOWS
char letra = 'f';
print("%d", letra); //A saida será 102
print("%c", 102); // A saida será f
print("%c", 103); //A saida será g
//Para corrigir o problema da acentuacao, devemos incluir a biblioteca <locale.h> no inicio do programa e a funcao setlocale() no inicio do main
printf("coração");
//Para verificar se houve a alteracao de idioma na lingugem C podemos utilizar o printf abaixo
printf("%s\n",setlocale(LC_ALL, "Portuguese")); // saida ==> Portuguese_Brazil.1252
return 0;
}
|
the_stack_data/137054.c | /*@
requires \valid(p);
ensures \result == *p;
*/
int foo(int* p) {
return *p;
}
|
the_stack_data/103264776.c | long nondet_long(void);
int main(void) {
long l = 0;
int c = 0;
long t = nondet_long();
long s = nondet_long();
long *b = &s;
l = (t + *b) & (0xffffffffL);
c += (l < t);
}
|
the_stack_data/521930.c | #include <stdlib.h>
int is_in_charset(char c, char *charset)
{
while (*charset)
{
if (c == *charset)
return (1);
++charset;
}
return (0);
}
long long get_word_cnt(char *str, char *charset)
{
long long cnt;
cnt = 0;
while (*str)
{
if (!is_in_charset(*str, charset))
{
++cnt;
while (*str && !is_in_charset(*str, charset))
++str;
}
++str;
}
return (cnt);
}
void ft_strcpy(char *dst, char *from, char *until)
{
while (from < until)
*(dst++) = *(from++);
*dst = 0;
}
char **ft_split(char *str, char *charset)
{
char **ret;
long long idx;
char *from;
ret = (char **)malloc(sizeof(char *) * get_word_cnt(str, charset) + 1);
idx = 0;
while (*str)
{
if (!is_in_charset(*str, charset))
{
from = str;
while (*str && !is_in_charset(*str, charset))
++str;
ret[idx] = (char *)malloc(str - from + 1);
ft_strcpy(ret[idx++], from, str);
}
++str;
}
ret[idx] = 0;
return (ret);
}
|
the_stack_data/234519147.c |
#include <stdio.h>
void scilab_rt_contour_i2d2i2d0d0d0s0i2i2_(int in00, int in01, int matrixin0[in00][in01],
int in10, int in11, double matrixin1[in10][in11],
int in20, int in21, int matrixin2[in20][in21],
double scalarin0,
double scalarin1,
double scalarin2,
char* scalarin3,
int in30, int in31, int matrixin3[in30][in31],
int in40, int in41, int matrixin4[in40][in41])
{
int i;
int j;
int val0 = 0;
double val1 = 0;
int val2 = 0;
int val3 = 0;
int val4 = 0;
for (i = 0; i < in00; ++i) {
for (j = 0; j < in01; ++j) {
val0 += matrixin0[i][j];
}
}
printf("%d", val0);
for (i = 0; i < in10; ++i) {
for (j = 0; j < in11; ++j) {
val1 += matrixin1[i][j];
}
}
printf("%f", val1);
for (i = 0; i < in20; ++i) {
for (j = 0; j < in21; ++j) {
val2 += matrixin2[i][j];
}
}
printf("%d", val2);
printf("%f", scalarin0);
printf("%f", scalarin1);
printf("%f", scalarin2);
printf("%s", scalarin3);
for (i = 0; i < in30; ++i) {
for (j = 0; j < in31; ++j) {
val3 += matrixin3[i][j];
}
}
printf("%d", val3);
for (i = 0; i < in40; ++i) {
for (j = 0; j < in41; ++j) {
val4 += matrixin4[i][j];
}
}
printf("%d", val4);
}
|
the_stack_data/190767544.c | #include<stdio.h>
#include<stdlib.h>
int main(void){
unsigned int m,n,j,k,g;
scanf("%d\n",&m);
for (j = 0; j < m; j++){
scanf("%u %u\n",&n,&k);
g = (k >> 1)^k;
printf("%d\n",g);
}
return 0;
}
|
the_stack_data/129290.c | /*
* pr_08.c
*
* Created on: Jun 11, 2013
* Author: delmadord
*/
#include <stdio.h>
#include <ctype.h>
#define WORD_LEN 20
int compute_scrabble_value(const char *word);
// Scrabble
int main(void) {
char word[WORD_LEN];
printf("Enter a word: ");
scanf("%s", word);
printf("Scrabble value: %d\n", compute_scrabble_value(word));
return 0;
}
int compute_scrabble_value(const char *word) {
int sum = 0;
while (*word)
switch (toupper(*word++)) {
case 'D': case 'G':
sum += 2; break;
case 'B': case 'C': case 'M': case 'P':
sum += 3; break;
case 'F': case 'H': case 'V': case 'W': case 'Y':
sum += 4; break;
case 'K':
sum += 5; break;
case 'J': case 'X':
sum += 8; break;
case 'Q': case 'Z':
sum += 10; break;
default:
sum++; break;
}
return sum;
}
|
the_stack_data/21721.c | #include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
printf("Pid of C_P is %d\n", getpid());
printf("Parent Pid of C_P is %d\n\n", getppid());
return 0;
} |
the_stack_data/148577647.c | #include <stdio.h>
#include <stdlib.h>
struct node
{
int vertex;
struct node* next;
};
struct node* createNode(int v);
struct Graph
{
int numVertices;
int* visited;
struct node** adjLists;
};
struct Graph* createGraph(int);
void addEdge(struct Graph*, int, int);
void printGraph(struct Graph*);
void DFS(struct Graph*, int);
int main()
{
int n, x, y, i, v;
printf("Enter number of edges: ");
scanf("%d", &n);
struct Graph* graph = createGraph(n);
printf("Enter two pairs of %d adjacent edges to add: \n", n);
for(i = 0; i < n; i++){
scanf("%d %d", &x, &y);
addEdge(graph, x, y);
}
printf("Enter the starting vertex: ");
scanf("%d", &v);
DFS(graph, v);
return 0;
}
void DFS(struct Graph* graph, int vertex)
{
struct node* adjList = graph->adjLists[vertex];
struct node* temp = adjList;
graph->visited[vertex] = 1;
printf("Visited %d \n", vertex);
while(temp!=NULL) {
int connectedVertex = temp->vertex;
if(graph->visited[connectedVertex] == 0) {
DFS(graph, connectedVertex);
}
temp = temp->next;
}
}
struct node* createNode(int v)
{
struct node* newNode = malloc(sizeof(struct node));
newNode->vertex = v;
newNode->next = NULL;
return newNode;
}
struct Graph* createGraph(int vertices)
{
struct Graph* graph = malloc(sizeof(struct Graph));
graph->numVertices = vertices;
graph->adjLists = malloc(vertices * sizeof(struct node*));
graph->visited = malloc(vertices * sizeof(int));
int i;
for (i = 0; i < vertices; i++) {
graph->adjLists[i] = NULL;
graph->visited[i] = 0;
}
return graph;
}
void addEdge(struct Graph* graph, int src, int dest)
{
struct node* newNode = createNode(dest);
newNode->next = graph->adjLists[src];
graph->adjLists[src] = newNode;
newNode = createNode(src);
newNode->next = graph->adjLists[dest];
graph->adjLists[dest] = newNode;
}
void printGraph(struct Graph* graph)
{
int v;
for (v = 0; v < graph->numVertices; v++)
{
struct node* temp = graph->adjLists[v];
printf("Adjacency list of vertex %d\n ", v);
while (temp)
{
printf("%d -> ", temp->vertex);
temp = temp->next;
}
printf("\n");
}
} |
the_stack_data/549372.c | // RUN: %clang -### -fsycl -c %s 2>&1 | FileCheck %s --check-prefix=ENABLED
// RUN: %clang -### -fsycl %s 2>&1 | FileCheck %s --check-prefix=ENABLED
// RUN: %clang -### -fsycl -sycl-std=1.2.1 %s 2>&1 | FileCheck %s --check-prefix=ENABLED
// RUN: %clang -### -fsycl -sycl-std=121 %s 2>&1 | FileCheck %s --check-prefix=ENABLED
// RUN: %clang -### -fsycl -sycl-std=2017 %s 2>&1 | FileCheck %s --check-prefix=ENABLED
// RUN: %clang -### -fsycl -sycl-std=sycl-1.2.1 %s 2>&1 | FileCheck %s --check-prefix=ENABLED
// RUN: %clang -### -fno-sycl -fsycl %s 2>&1 | FileCheck %s --check-prefix=ENABLED
// RUN: %clang -### -sycl-std=2017 %s 2>&1 | FileCheck %s --check-prefix=NOT_ENABLED
// RUN: %clangxx -### -fsycl %s 2>&1 | FileCheck %s --check-prefix=ENABLED
// RUN: %clangxx -### -fno-sycl %s 2>&1 | FileCheck %s --check-prefix=DISABLED
// RUN: %clangxx -### -fsycl -fno-sycl %s 2>&1 | FileCheck %s --check-prefix=DISABLED
// RUN: %clangxx -### %s 2>&1 | FileCheck %s --check-prefix=NOT_ENABLED
// RUN: %clangxx -### -sycl-std=some-std %s 2>&1 | FileCheck %s --check-prefix=NOT_ENABLED
// RUN: %clang_cl -### -fsycl -sycl-std=2017 -- %s 2>&1 | FileCheck %s --check-prefix=ENABLED
// RUN: %clang_cl -### -fsycl -- %s 2>&1 | FileCheck %s --check-prefix=ENABLED
// RUN: %clang_cl -### -- %s 2>&1 | FileCheck %s --check-prefix=NOT_ENABLED
// RUN: %clang_cl -### -sycl-std=some-std -- %s 2>&1 | FileCheck %s --check-prefix=NOT_ENABLED
// ENABLED: "-cc1"{{.*}} "-fsycl-is-device"
// ENABLED-SAME: "-sycl-std={{[-.sycl0-9]+}}"
// ENABLED-SAME: "-internal-isystem" "{{.*}}bin{{[/\\]+}}..{{[/\\]+}}include{{[/\\]+}}sycl"
// NOT_ENABLED-NOT: "-fsycl-is-device"
// NOT_ENABLED-NOT: "-fsycl-std-layout-kernel-params"
// DISABLED-NOT: "-fsycl-is-device"
// DISABLED-NOT: "-sycl-std={{.*}}"
// DISABLED-NOT: "-fsycl-std-layout-kernel-params"
// RUN: %clang -### -fsycl-device-only -c %s 2>&1 | FileCheck %s --check-prefix=DEFAULT
// RUN: %clang -### -fsycl-device-only %s 2>&1 | FileCheck %s --check-prefix=DEFAULT
// RUN: %clang -### -fsycl-device-only -S %s 2>&1 | FileCheck %s --check-prefix=TEXTUAL
// RUN: %clang -### -fsycl-device-only -fsycl %s 2>&1 | FileCheck %s --check-prefix=DEFAULT
// RUN: %clang -### -fsycl-device-only -fno-sycl-use-bitcode -c %s 2>&1 | FileCheck %s --check-prefix=NO-BITCODE
// RUN: %clang -### -target spir64-unknown-linux-sycldevice -c -emit-llvm %s 2>&1 | FileCheck %s --check-prefix=TARGET
// RUN: %clang -### -fsycl-device-only -c -emit-llvm %s 2>&1 | FileCheck %s --check-prefix=COMBINED
// RUN: %clangxx -### -fsycl-device-only %s 2>&1 | FileCheck %s --check-prefix=DEFAULT
// RUN: %clang_cl -### -fsycl-device-only %s 2>&1 | FileCheck %s --check-prefix=DEFAULT
// RUN: %clangxx -### -fsycl-device-only -fsycl-unnamed-lambda %s 2>&1 | FileCheck %s --check-prefix=CHECK-LAMBDA
// RUN: %clang_cl -### -fsycl-device-only -fsycl-unnamed-lambda %s 2>&1 | FileCheck %s --check-prefix=CHECK-LAMBDA
// DEFAULT: "-triple" "spir64-unknown-{{.*}}-sycldevice{{.*}}" "-fsycl-is-device"{{.*}} "-sycl-std=2020"{{.*}} "-emit-llvm-bc"
// DEFAULT: "-internal-isystem" "{{.*}}bin{{[/\\]+}}..{{[/\\]+}}include{{[/\\]+}}sycl"
// DEFAULT: "-internal-isystem" "{{.*lib.*clang.*include}}"
// DEFAULT: "-std=c++17"
// DEFAULT-NOT: "{{.*}}llvm-spirv"{{.*}} "-spirv-max-version=1.1"{{.*}} "-spirv-ext=+all,-SPV_INTEL_usm_storage_classes"
// DEFAULT-NOT: "-std=c++11"
// DEFAULT-NOT: "-std=c++14"
// NO-BITCODE: "-triple" "spir64-unknown-{{.*}}-sycldevice"{{.*}} "-fsycl-is-device"{{.*}} "-emit-llvm-bc"
// NO-BITCODE: "{{.*}}llvm-spirv"{{.*}} "-spirv-max-version=1.1"{{.*}} "-spirv-ext=+all,-SPV_INTEL_usm_storage_classes"
// TARGET: "-triple" "spir64-unknown-linux-sycldevice"{{.*}} "-fsycl-is-device"{{.*}} "-emit-llvm-bc"
// COMBINED: "-triple" "spir64-unknown-{{.*}}-sycldevice"{{.*}} "-fsycl-is-device"{{.*}} "-emit-llvm-bc"
// TEXTUAL: "-triple" "spir64-unknown-{{.*}}-sycldevice{{.*}}" "-fsycl-is-device"{{.*}} "-emit-llvm"
// CHECK-LAMBDA: "-fsycl-unnamed-lambda"
/// -fsycl-device-only triple checks
// RUN: %clang -fsycl-device-only -target x86_64-unknown-linux-gnu -### %s 2>&1 \
// RUN: | FileCheck --check-prefix=DEVICE-64 %s
// RUN: %clang_cl -fsycl-device-only --target=x86_64-unknown-linux-gnu -### %s 2>&1 \
// RUN: | FileCheck --check-prefix=DEVICE-64 %s
// DEVICE-64: clang{{.*}} "-triple" "spir64-unknown-unknown-sycldevice" {{.*}} "-aux-triple" "x86_64-unknown-linux-gnu"
// RUN: %clang -fsycl-device-only -target i386-unknown-linux-gnu -### %s 2>&1 \
// RUN: | FileCheck --check-prefix=DEVICE-32 %s
// RUN: %clang_cl -fsycl-device-only --target=i386-unknown-linux-gnu -### %s 2>&1 \
// RUN: | FileCheck --check-prefix=DEVICE-32 %s
// DEVICE-32: clang{{.*}} "-triple" "spir-unknown-unknown-sycldevice" {{.*}} "-aux-triple" "i386-unknown-linux-gnu"
/// Verify that the sycl header directory is before /usr/include
// RUN: %clangxx -### -fsycl-device-only %s 2>&1 | FileCheck %s --check-prefix=HEADER_ORDER
// RUN: %clangxx -### -fsycl %s 2>&1 | FileCheck %s --check-prefix=HEADER_ORDER
// HEADER_ORDER-NOT: clang{{.*}} "/usr/include"{{.*}} "-internal-isystem" "{{.*}}bin{{[/\\]+}}..{{[/\\]+}}include{{[/\\]+}}
/// Verify -fsycl-device-only phases
// RUN: %clang -### -ccc-print-phases -fsycl-device-only %s 2>&1 | FileCheck %s --check-prefix=DEFAULT-PHASES
// DEFAULT-PHASES: 0: input, "{{.*}}", c++, (device-sycl)
// DEFAULT-PHASES: 1: preprocessor, {0}, c++-cpp-output, (device-sycl)
// DEFAULT-PHASES: 2: compiler, {1}, ir, (device-sycl)
// DEFAULT-PHASES: 3: offload, "device-sycl (spir64-unknown-unknown-sycldevice)" {2}, ir
// DEFAULT-PHASES-NOT: linker
// -fsycl-help tests
// RUN: mkdir -p %t-sycl-dir
// RUN: touch %t-sycl-dir/aoc
// RUN: chmod +x %t-sycl-dir/aoc
// Test with a bad argument is expected to fail
// RUN: not %clang -fsycl-help=foo %s 2>&1 | FileCheck %s --check-prefix=SYCL-HELP-BADARG
// RUN: %clang -### -fsycl-help=gen %s 2>&1 | FileCheck %s --check-prefix=SYCL-HELP-GEN
// RUN: env PATH=%t-sycl-dir %clang -### -fsycl-help=fpga %s 2>&1 | FileCheck %s --check-prefixes=SYCL-HELP-FPGA,SYCL-HELP-FPGA-OUT -DDIR=%t-sycl-dir
// RUN: %clang -### -fsycl-help=x86_64 %s 2>&1 | FileCheck %s --check-prefix=SYCL-HELP-CPU
// RUN: %clang -### -fsycl-help %s 2>&1 | FileCheck %s --check-prefixes=SYCL-HELP-GEN,SYCL-HELP-FPGA,SYCL-HELP-CPU
// SYCL-HELP-BADARG: unsupported argument 'foo' to option 'fsycl-help='
// SYCL-HELP-GEN: Emitting help information for ocloc
// SYCL-HELP-GEN: Use triple of 'spir64_gen-unknown-unknown-sycldevice' to enable ahead of time compilation
// SYCL-HELP-FPGA-OUT: "[[DIR]]{{[/\\]+}}aoc" "-help" "-sycl"
// SYCL-HELP-FPGA: Emitting help information for aoc
// SYCL-HELP-FPGA: Use triple of 'spir64_fpga-unknown-unknown-sycldevice' to enable ahead of time compilation
// SYCL-HELP-CPU: Emitting help information for opencl-aot
// SYCL-HELP-CPU: Use triple of 'spir64_x86_64-unknown-unknown-sycldevice' to enable ahead of time compilation
// -fsycl-id-queries-fit-in-int
// RUN: %clang -### -fsycl -fsycl-id-queries-fit-in-int %s 2>&1 | FileCheck %s --check-prefix=ID_QUERIES
// RUN: %clang_cl -### -fsycl -fsycl-id-queries-fit-in-int %s 2>&1 | FileCheck %s --check-prefix=ID_QUERIES
// RUN: %clang -### -fsycl-device-only -fsycl-id-queries-fit-in-int %s 2>&1 | FileCheck %s --check-prefix=ID_QUERIES
// RUN: %clang_cl -### -fsycl-device-only -fsycl-id-queries-fit-in-int %s 2>&1 | FileCheck %s --check-prefix=ID_QUERIES
// RUN: %clang -### -fsycl -fno-sycl-id-queries-fit-in-int %s 2>&1 | FileCheck %s --check-prefix=NO_ID_QUERIES
// RUN: %clang_cl -### -fsycl -fno-sycl-id-queries-fit-in-int %s 2>&1 | FileCheck %s --check-prefix=NO_ID_QUERIES
// RUN: %clang -### -fsycl-device-only -fno-sycl-id-queries-fit-in-int %s 2>&1 | FileCheck %s --check-prefix=NO_ID_QUERIES
// RUN: %clang_cl -### -fsycl-device-only -fno-sycl-id-queries-fit-in-int %s 2>&1 | FileCheck %s --check-prefix=NO_ID_QUERIES
// ID_QUERIES: "-fsycl-id-queries-fit-in-int"
// NO_ID_QUERIES: "-fno-sycl-id-queries-fit-in-int"
|
the_stack_data/151704766.c |
//{{BLOCK(spriteShared)
//======================================================================
//
// spriteShared, 16x16@8,
// + palette 108 entries, not compressed
// Total size: 216 = 216
//
// Time-stamp: 2020-12-27, 11:12:23
// Exported by Cearn's GBA Image Transmogrifier, v0.8.16
// ( http://www.coranac.com/projects/#grit )
//
//======================================================================
const unsigned short spriteSharedPal[108] __attribute__((aligned(4))) __attribute__((visibility("hidden")))=
{
0x42C0,0x0C86,0x3DD3,0x2D4D,0x4E96,0x1D0C,0x45F8,0x56FA,
0x3593,0x1CD0,0x4635,0x3575,0x18C9,0x2D34,0x3DB6,0x4E58,
0x4655,0x294D,0x0C6B,0x4656,0x5B1B,0x3DF4,0x2D71,0x20F2,
0x35B5,0x56D9,0x18AD,0x4A58,0x35D2,0x4EB8,0x2D91,0x4235,
0x56B7,0x4696,0x4EB9,0x3E14,0x2D52,0x3E13,0x2531,0x5AF9,
0x39B6,0x4ED8,0x3190,0x254E,0x4A76,0x5297,0x633B,0x4A55,
0x39D2,0x52B8,0x41F6,0x5AFA,0x31B1,0x4A36,0x4213,0x3E15,
0x3172,0x20ED,0x5F1C,0x41F3,0x3171,0x2971,0x3175,0x41F4,
0x56DA,0x4E7A,0x52D7,0x4ED9,0x3192,0x4A97,0x52B7,0x4636,
0x39D3,0x5AD9,0x5F1A,0x4A75,0x5F1B,0x2D92,0x4697,0x39B5,
0x39F2,0x56D7,0x1086,0x296D,0x1CD1,0x52D8,0x4233,0x18CA,
0x24F2,0x2932,0x106B,0x294E,0x2D54,0x39F3,0x3173,0x3DF5,
0x52B9,0x527A,0x2D72,0x35B3,0x4E97,0x52D9,0x2532,0x18CD,
0x31B0,0x3193,0x52BA,0x4EBA,
};
//}}BLOCK(spriteShared)
|
the_stack_data/128118.c | // RUN: %clang_cc1 -triple powerpc-unknown-aix -emit-llvm %s -o - | FileCheck %s
// RUN: %clang_cc1 -triple powerpc-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefixes=CHECK,PPC32
static unsigned char dwarf_reg_size_table[1024];
int test() {
__builtin_init_dwarf_reg_size_table(dwarf_reg_size_table);
return __builtin_dwarf_sp_column();
}
// CHECK-LABEL: define i32 @test()
// CHECK: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 0), align 1
// CHECK-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 1), align 1
// CHECK-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 2), align 1
// CHECK-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 3), align 1
// CHECK-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 4), align 1
// CHECK-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 5), align 1
// CHECK-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 6), align 1
// CHECK-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 7), align 1
// CHECK-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 8), align 1
// CHECK-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 9), align 1
// CHECK-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 10), align 1
// CHECK-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 11), align 1
// CHECK-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 12), align 1
// CHECK-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 13), align 1
// CHECK-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 14), align 1
// CHECK-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 15), align 1
// CHECK-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 16), align 1
// CHECK-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 17), align 1
// CHECK-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 18), align 1
// CHECK-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 19), align 1
// CHECK-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 20), align 1
// CHECK-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 21), align 1
// CHECK-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 22), align 1
// CHECK-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 23), align 1
// CHECK-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 24), align 1
// CHECK-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 25), align 1
// CHECK-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 26), align 1
// CHECK-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 27), align 1
// CHECK-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 28), align 1
// CHECK-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 29), align 1
// CHECK-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 30), align 1
// CHECK-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 31), align 1
// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 32), align 1
// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 33), align 1
// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 34), align 1
// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 35), align 1
// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 36), align 1
// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 37), align 1
// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 38), align 1
// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 39), align 1
// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 40), align 1
// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 41), align 1
// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 42), align 1
// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 43), align 1
// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 44), align 1
// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 45), align 1
// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 46), align 1
// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 47), align 1
// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 48), align 1
// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 49), align 1
// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 50), align 1
// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 51), align 1
// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 52), align 1
// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 53), align 1
// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 54), align 1
// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 55), align 1
// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 56), align 1
// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 57), align 1
// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 58), align 1
// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 59), align 1
// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 60), align 1
// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 61), align 1
// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 62), align 1
// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 63), align 1
// CHECK-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 64), align 1
// CHECK-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 65), align 1
// CHECK-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 66), align 1
// CHECK-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 67), align 1
// CHECK-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 68), align 1
// CHECK-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 69), align 1
// CHECK-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 70), align 1
// CHECK-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 71), align 1
// CHECK-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 72), align 1
// CHECK-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 73), align 1
// CHECK-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 74), align 1
// CHECK-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 75), align 1
// CHECK-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 76), align 1
// CHECK-NEXT: store i8 16, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 77), align 1
// CHECK-NEXT: store i8 16, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 78), align 1
// CHECK-NEXT: store i8 16, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 79), align 1
// CHECK-NEXT: store i8 16, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 80), align 1
// CHECK-NEXT: store i8 16, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 81), align 1
// CHECK-NEXT: store i8 16, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 82), align 1
// CHECK-NEXT: store i8 16, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 83), align 1
// CHECK-NEXT: store i8 16, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 84), align 1
// CHECK-NEXT: store i8 16, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 85), align 1
// CHECK-NEXT: store i8 16, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 86), align 1
// CHECK-NEXT: store i8 16, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 87), align 1
// CHECK-NEXT: store i8 16, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 88), align 1
// CHECK-NEXT: store i8 16, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 89), align 1
// CHECK-NEXT: store i8 16, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 90), align 1
// CHECK-NEXT: store i8 16, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 91), align 1
// CHECK-NEXT: store i8 16, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 92), align 1
// CHECK-NEXT: store i8 16, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 93), align 1
// CHECK-NEXT: store i8 16, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 94), align 1
// CHECK-NEXT: store i8 16, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 95), align 1
// CHECK-NEXT: store i8 16, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 96), align 1
// CHECK-NEXT: store i8 16, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 97), align 1
// CHECK-NEXT: store i8 16, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 98), align 1
// CHECK-NEXT: store i8 16, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 99), align 1
// CHECK-NEXT: store i8 16, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 100), align 1
// CHECK-NEXT: store i8 16, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 101), align 1
// CHECK-NEXT: store i8 16, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 102), align 1
// CHECK-NEXT: store i8 16, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 103), align 1
// CHECK-NEXT: store i8 16, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 104), align 1
// CHECK-NEXT: store i8 16, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 105), align 1
// CHECK-NEXT: store i8 16, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 106), align 1
// CHECK-NEXT: store i8 16, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 107), align 1
// CHECK-NEXT: store i8 16, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 108), align 1
// CHECK-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 109), align 1
// CHECK-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 110), align 1
// PPC32-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 111), align 1
// PPC32-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 112), align 1
// PPC32-NEXT: store i8 4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @dwarf_reg_size_table, i32 0, i32 113), align 1
// PPC32-NEXT: ret i32 1
|
the_stack_data/467441.c | /*
To test that initialization are
properly converted to statements
*/
int main()
{
int x;
int y=0;
x = 0;
while (x < 10) {
int z = x + 2;
x++;
}
return 0;
}
|
the_stack_data/7951054.c |
#include <stdio.h>
void add(int *p, int n) {
for (int i = 1; i < n; i++) {
p[0] += p[i];
}
return ;
}
int main() {
int arr[10] = {1, 2, 3};
add(arr, 3);
printf("%d\n", arr[0]);
return 0;
} |
the_stack_data/440307.c | /**
* \file
* Binary protocol of internal activity, to aid debugging.
*
* Copyright 2001-2003 Ximian, Inc
* Copyright 2003-2010 Novell, Inc.
* Copyright (C) 2012 Xamarin Inc
*
* Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/
#ifdef HAVE_SGEN_GC
#include "config.h"
#include "sgen-conf.h"
#include "sgen-gc.h"
#include "sgen-protocol.h"
#include "sgen-memory-governor.h"
#include "sgen-workers.h"
#include "sgen-client.h"
#include "mono/utils/mono-membar.h"
#include "mono/utils/mono-proclib.h"
#include <errno.h>
#include <string.h>
#if defined(HOST_WIN32)
#include <windows.h>
#elif defined(HAVE_UNISTD_H)
#include <unistd.h>
#include <fcntl.h>
#endif
#ifndef DISABLE_SGEN_BINARY_PROTOCOL
#if defined(HOST_WIN32)
static const HANDLE invalid_file_value = INVALID_HANDLE_VALUE;
/* If valid, dump binary protocol to this file */
static HANDLE binary_protocol_file = INVALID_HANDLE_VALUE;
#else
static const int invalid_file_value = -1;
static int binary_protocol_file = -1;
#endif
/* We set this to -1 to indicate an exclusive lock */
static volatile int binary_protocol_use_count = 0;
#define BINARY_PROTOCOL_BUFFER_SIZE (65536 - 2 * 8)
typedef struct _BinaryProtocolBuffer BinaryProtocolBuffer;
struct _BinaryProtocolBuffer {
BinaryProtocolBuffer * volatile next;
volatile int index;
unsigned char buffer [BINARY_PROTOCOL_BUFFER_SIZE];
};
static BinaryProtocolBuffer * volatile binary_protocol_buffers = NULL;
static char* filename_or_prefix = NULL;
static int current_file_index = 0;
static long long current_file_size = 0;
static long long file_size_limit;
static char*
filename_for_index (int index)
{
char *filename;
SGEN_ASSERT (0, file_size_limit > 0, "Indexed binary protocol filename must only be used with file size limit");
filename = (char *)sgen_alloc_internal_dynamic (strlen (filename_or_prefix) + 32, INTERNAL_MEM_BINARY_PROTOCOL, TRUE);
sprintf (filename, "%s.%d", filename_or_prefix, index);
return filename;
}
static void
free_filename (char *filename)
{
SGEN_ASSERT (0, file_size_limit > 0, "Indexed binary protocol filename must only be used with file size limit");
sgen_free_internal_dynamic (filename, strlen (filename_or_prefix) + 32, INTERNAL_MEM_BINARY_PROTOCOL);
}
static void
binary_protocol_open_file (gboolean assert_on_failure)
{
char *filename;
#ifdef F_SETLK
struct flock lock;
lock.l_type = F_WRLCK;
lock.l_whence = SEEK_SET;
lock.l_start = 0;
lock.l_len = 0;
#endif
if (file_size_limit > 0)
filename = filename_for_index (current_file_index);
else
filename = filename_or_prefix;
#if defined(HOST_WIN32)
binary_protocol_file = CreateFileA (filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
#elif defined(HAVE_UNISTD_H)
do {
binary_protocol_file = open (filename, O_CREAT | O_WRONLY, 0644);
if (binary_protocol_file == -1) {
if (errno != EINTR)
break; /* Failed */
#ifdef F_SETLK
} else if (fcntl (binary_protocol_file, F_SETLK, &lock) == -1) {
/* The lock for the file is already taken. Fail */
close (binary_protocol_file);
binary_protocol_file = -1;
break;
#endif
} else {
/* We have acquired the lock. Truncate the file */
int ret;
while ((ret = ftruncate (binary_protocol_file, 0)) < 0 && errno == EINTR);
if (ret < 0) {
binary_protocol_file = -1;
break;
}
}
} while (binary_protocol_file == -1);
#else
g_error ("sgen binary protocol: not supported");
#endif
if (binary_protocol_file == invalid_file_value && assert_on_failure)
g_error ("sgen binary protocol: failed to open file");
if (file_size_limit > 0)
free_filename (filename);
}
void
sgen_binary_protocol_init (const char *filename, long long limit)
{
file_size_limit = limit;
/* Original name length + . + pid length in hex + null terminator */
filename_or_prefix = g_strdup_printf ("%s", filename);
binary_protocol_open_file (FALSE);
if (binary_protocol_file == invalid_file_value) {
/* Another process owns the file, try adding the pid suffix to the filename */
gint32 pid = mono_process_current_pid ();
g_free (filename_or_prefix);
filename_or_prefix = g_strdup_printf ("%s.%x", filename, pid);
binary_protocol_open_file (TRUE);
}
/* If we have a file size limit, we might need to open additional files */
if (file_size_limit == 0)
g_free (filename_or_prefix);
sgen_binary_protocol_header (PROTOCOL_HEADER_CHECK, PROTOCOL_HEADER_VERSION, SIZEOF_VOID_P, G_BYTE_ORDER == G_LITTLE_ENDIAN);
}
gboolean
sgen_binary_protocol_is_enabled (void)
{
return binary_protocol_file != invalid_file_value;
}
static void
close_binary_protocol_file (void)
{
#if defined(HOST_WIN32)
CloseHandle (binary_protocol_file);
#elif defined(HAVE_UNISTD_H)
while (close (binary_protocol_file) == -1 && errno == EINTR)
;
#endif
binary_protocol_file = invalid_file_value;
}
static gboolean
try_lock_exclusive (void)
{
do {
if (binary_protocol_use_count)
return FALSE;
} while (mono_atomic_cas_i32 (&binary_protocol_use_count, -1, 0) != 0);
mono_memory_barrier ();
return TRUE;
}
static void
unlock_exclusive (void)
{
mono_memory_barrier ();
SGEN_ASSERT (0, binary_protocol_use_count == -1, "Exclusively locked count must be -1");
if (mono_atomic_cas_i32 (&binary_protocol_use_count, 0, -1) != -1)
SGEN_ASSERT (0, FALSE, "Somebody messed with the exclusive lock");
}
static void
lock_recursive (void)
{
int old_count;
do {
retry:
old_count = binary_protocol_use_count;
if (old_count < 0) {
/* Exclusively locked - retry */
/* FIXME: short back-off */
goto retry;
}
} while (mono_atomic_cas_i32 (&binary_protocol_use_count, old_count + 1, old_count) != old_count);
mono_memory_barrier ();
}
static void
unlock_recursive (void)
{
int old_count;
mono_memory_barrier ();
do {
old_count = binary_protocol_use_count;
SGEN_ASSERT (0, old_count > 0, "Locked use count must be at least 1");
} while (mono_atomic_cas_i32 (&binary_protocol_use_count, old_count - 1, old_count) != old_count);
}
static void
binary_protocol_flush_buffer (BinaryProtocolBuffer *buffer)
{
size_t to_write = buffer->index;
size_t written = 0;
g_assert (buffer->index > 0);
while (binary_protocol_file != invalid_file_value && written < to_write) {
#if defined(HOST_WIN32)
DWORD tmp_written;
if (WriteFile (binary_protocol_file, buffer->buffer + written, (DWORD)(to_write - written), &tmp_written, NULL))
written += tmp_written;
#elif defined(HAVE_UNISTD_H)
ssize_t ret = write (binary_protocol_file, buffer->buffer + written, to_write - written);
if (ret >= 0)
written += ret;
else if (errno == EINTR)
continue;
#endif
else
close_binary_protocol_file ();
}
current_file_size += buffer->index;
sgen_free_os_memory (buffer, sizeof (BinaryProtocolBuffer), SGEN_ALLOC_INTERNAL, MONO_MEM_ACCOUNT_SGEN_BINARY_PROTOCOL);
}
static void
binary_protocol_check_file_overflow (void)
{
if (file_size_limit <= 0 || current_file_size < file_size_limit)
return;
close_binary_protocol_file ();
if (current_file_index > 0) {
char *filename = filename_for_index (current_file_index - 1);
unlink (filename);
free_filename (filename);
}
++current_file_index;
current_file_size = 0;
binary_protocol_open_file (TRUE);
}
/*
* Flushing buffers takes an exclusive lock, so it must only be done when the world is
* stopped, otherwise we might end up with a deadlock because a stopped thread owns the
* lock.
*
* The protocol entries that do flush have `FLUSH()` in their definition.
*/
gboolean
sgen_binary_protocol_flush_buffers (gboolean force)
{
int num_buffers = 0, i;
BinaryProtocolBuffer *header;
BinaryProtocolBuffer *buf;
BinaryProtocolBuffer **bufs;
if (binary_protocol_file == invalid_file_value)
return FALSE;
if (!force && !try_lock_exclusive ())
return FALSE;
header = binary_protocol_buffers;
for (buf = header; buf != NULL; buf = buf->next)
++num_buffers;
bufs = (BinaryProtocolBuffer **)sgen_alloc_internal_dynamic (num_buffers * sizeof (BinaryProtocolBuffer*), INTERNAL_MEM_BINARY_PROTOCOL, TRUE);
for (buf = header, i = 0; buf != NULL; buf = buf->next, i++)
bufs [i] = buf;
SGEN_ASSERT (0, i == num_buffers, "Binary protocol buffer count error");
/*
* This might be incorrect when forcing, but all bets are off in that case, anyway,
* because we're trying to figure out a bug in the debugger.
*/
binary_protocol_buffers = NULL;
for (i = num_buffers - 1; i >= 0; --i) {
binary_protocol_flush_buffer (bufs [i]);
binary_protocol_check_file_overflow ();
}
sgen_free_internal_dynamic (buf, num_buffers * sizeof (BinaryProtocolBuffer*), INTERNAL_MEM_BINARY_PROTOCOL);
if (!force)
unlock_exclusive ();
return TRUE;
}
static BinaryProtocolBuffer*
binary_protocol_get_buffer (int length)
{
BinaryProtocolBuffer *buffer, *new_buffer;
retry:
buffer = binary_protocol_buffers;
if (buffer && buffer->index + length <= BINARY_PROTOCOL_BUFFER_SIZE)
return buffer;
new_buffer = (BinaryProtocolBuffer *)sgen_alloc_os_memory (sizeof (BinaryProtocolBuffer), (SgenAllocFlags)(SGEN_ALLOC_INTERNAL | SGEN_ALLOC_ACTIVATE), "debugging memory", MONO_MEM_ACCOUNT_SGEN_BINARY_PROTOCOL);
new_buffer->next = buffer;
new_buffer->index = 0;
if (mono_atomic_cas_ptr ((void**)&binary_protocol_buffers, new_buffer, buffer) != buffer) {
sgen_free_os_memory (new_buffer, sizeof (BinaryProtocolBuffer), SGEN_ALLOC_INTERNAL, MONO_MEM_ACCOUNT_SGEN_BINARY_PROTOCOL);
goto retry;
}
return new_buffer;
}
static void
protocol_entry (unsigned char type, gpointer data, int size)
{
int index;
gboolean include_worker_index = type != PROTOCOL_ID (binary_protocol_header);
int entry_size = size + 1 + (include_worker_index ? 1 : 0); // type + worker_index + size
BinaryProtocolBuffer *buffer;
if (binary_protocol_file == invalid_file_value)
return;
lock_recursive ();
retry:
buffer = binary_protocol_get_buffer (size + 1);
retry_same_buffer:
index = buffer->index;
if (index + entry_size > BINARY_PROTOCOL_BUFFER_SIZE)
goto retry;
if (mono_atomic_cas_i32 (&buffer->index, index + entry_size, index) != index)
goto retry_same_buffer;
/* FIXME: if we're interrupted at this point, we have a buffer
entry that contains random data. */
buffer->buffer [index++] = type;
/* We should never change the header format */
if (include_worker_index) {
int worker_index;
MonoNativeThreadId tid = mono_native_thread_id_get ();
/*
* If the thread is not a worker thread we insert 0, which is interpreted
* as gc thread. Worker indexes are 1 based.
*/
worker_index = sgen_thread_pool_is_thread_pool_thread (tid);
/* FIXME Consider using different index bases for different thread pools */
buffer->buffer [index++] = (unsigned char) worker_index;
}
memcpy (buffer->buffer + index, data, size);
index += size;
g_assert (index <= BINARY_PROTOCOL_BUFFER_SIZE);
unlock_recursive ();
}
#define TYPE_INT int
#define TYPE_LONGLONG long long
#define TYPE_SIZE size_t
#define TYPE_POINTER gpointer
#define TYPE_BOOL gboolean
#define BEGIN_PROTOCOL_ENTRY0(method) \
void sgen_ ## method (void) { \
int __type = PROTOCOL_ID(method); \
gpointer __data = NULL; \
int __size = 0; \
CLIENT_PROTOCOL_NAME (method) ();
#define BEGIN_PROTOCOL_ENTRY1(method,t1,f1) \
void sgen_ ## method (t1 f1) { \
PROTOCOL_STRUCT(method) __entry = { f1 }; \
int __type = PROTOCOL_ID(method); \
gpointer __data = &__entry; \
int __size = sizeof (PROTOCOL_STRUCT(method)); \
CLIENT_PROTOCOL_NAME (method) (f1);
#define BEGIN_PROTOCOL_ENTRY2(method,t1,f1,t2,f2) \
void sgen_ ## method (t1 f1, t2 f2) { \
PROTOCOL_STRUCT(method) __entry = { f1, f2 }; \
int __type = PROTOCOL_ID(method); \
gpointer __data = &__entry; \
int __size = sizeof (PROTOCOL_STRUCT(method)); \
CLIENT_PROTOCOL_NAME (method) (f1, f2);
#define BEGIN_PROTOCOL_ENTRY3(method,t1,f1,t2,f2,t3,f3) \
void sgen_ ## method (t1 f1, t2 f2, t3 f3) { \
PROTOCOL_STRUCT(method) __entry = { f1, f2, f3 }; \
int __type = PROTOCOL_ID(method); \
gpointer __data = &__entry; \
int __size = sizeof (PROTOCOL_STRUCT(method)); \
CLIENT_PROTOCOL_NAME (method) (f1, f2, f3);
#define BEGIN_PROTOCOL_ENTRY4(method,t1,f1,t2,f2,t3,f3,t4,f4) \
void sgen_ ## method (t1 f1, t2 f2, t3 f3, t4 f4) { \
PROTOCOL_STRUCT(method) __entry = { f1, f2, f3, f4 }; \
int __type = PROTOCOL_ID(method); \
gpointer __data = &__entry; \
int __size = sizeof (PROTOCOL_STRUCT(method)); \
CLIENT_PROTOCOL_NAME (method) (f1, f2, f3, f4);
#define BEGIN_PROTOCOL_ENTRY5(method,t1,f1,t2,f2,t3,f3,t4,f4,t5,f5) \
void sgen_ ## method (t1 f1, t2 f2, t3 f3, t4 f4, t5 f5) { \
PROTOCOL_STRUCT(method) __entry = { f1, f2, f3, f4, f5 }; \
int __type = PROTOCOL_ID(method); \
gpointer __data = &__entry; \
int __size = sizeof (PROTOCOL_STRUCT(method)); \
CLIENT_PROTOCOL_NAME (method) (f1, f2, f3, f4, f5);
#define BEGIN_PROTOCOL_ENTRY6(method,t1,f1,t2,f2,t3,f3,t4,f4,t5,f5,t6,f6) \
void sgen_ ## method (t1 f1, t2 f2, t3 f3, t4 f4, t5 f5, t6 f6) { \
PROTOCOL_STRUCT(method) __entry = { f1, f2, f3, f4, f5, f6 }; \
int __type = PROTOCOL_ID(method); \
gpointer __data = &__entry; \
int __size = sizeof (PROTOCOL_STRUCT(method)); \
CLIENT_PROTOCOL_NAME (method) (f1, f2, f3, f4, f5, f6);
#define DEFAULT_PRINT()
#define CUSTOM_PRINT(_)
#define IS_ALWAYS_MATCH(_)
#define MATCH_INDEX(_)
#define IS_VTABLE_MATCH(_)
#define END_PROTOCOL_ENTRY \
protocol_entry (__type, __data, __size); \
}
#define END_PROTOCOL_ENTRY_FLUSH \
protocol_entry (__type, __data, __size); \
sgen_binary_protocol_flush_buffers (FALSE); \
}
#ifdef SGEN_HEAVY_BINARY_PROTOCOL
#define BEGIN_PROTOCOL_ENTRY_HEAVY0(method) \
BEGIN_PROTOCOL_ENTRY0 (method)
#define BEGIN_PROTOCOL_ENTRY_HEAVY1(method,t1,f1) \
BEGIN_PROTOCOL_ENTRY1 (method,t1,f1)
#define BEGIN_PROTOCOL_ENTRY_HEAVY2(method,t1,f1,t2,f2) \
BEGIN_PROTOCOL_ENTRY2 (method,t1,f1,t2,f2)
#define BEGIN_PROTOCOL_ENTRY_HEAVY3(method,t1,f1,t2,f2,t3,f3) \
BEGIN_PROTOCOL_ENTRY3 (method,t1,f1,t2,f2,t3,f3)
#define BEGIN_PROTOCOL_ENTRY_HEAVY4(method,t1,f1,t2,f2,t3,f3,t4,f4) \
BEGIN_PROTOCOL_ENTRY4 (method,t1,f1,t2,f2,t3,f3,t4,f4)
#define BEGIN_PROTOCOL_ENTRY_HEAVY5(method,t1,f1,t2,f2,t3,f3,t4,f4,t5,f5) \
BEGIN_PROTOCOL_ENTRY5 (method,t1,f1,t2,f2,t3,f3,t4,f4,t5,f5)
#define BEGIN_PROTOCOL_ENTRY_HEAVY6(method,t1,f1,t2,f2,t3,f3,t4,f4,t5,f5,t6,f6) \
BEGIN_PROTOCOL_ENTRY6 (method,t1,f1,t2,f2,t3,f3,t4,f4,t5,f5,t6,f6)
#define END_PROTOCOL_ENTRY_HEAVY \
END_PROTOCOL_ENTRY
#else
#define BEGIN_PROTOCOL_ENTRY_HEAVY0(method)
#define BEGIN_PROTOCOL_ENTRY_HEAVY1(method,t1,f1)
#define BEGIN_PROTOCOL_ENTRY_HEAVY2(method,t1,f1,t2,f2)
#define BEGIN_PROTOCOL_ENTRY_HEAVY3(method,t1,f1,t2,f2,t3,f3)
#define BEGIN_PROTOCOL_ENTRY_HEAVY4(method,t1,f1,t2,f2,t3,f3,t4,f4)
#define BEGIN_PROTOCOL_ENTRY_HEAVY5(method,t1,f1,t2,f2,t3,f3,t4,f4,t5,f5)
#define BEGIN_PROTOCOL_ENTRY_HEAVY6(method,t1,f1,t2,f2,t3,f3,t4,f4,t5,f5,t6,f6)
#define END_PROTOCOL_ENTRY_HEAVY
#endif
#include "sgen-protocol-def.h"
#undef TYPE_INT
#undef TYPE_LONGLONG
#undef TYPE_SIZE
#undef TYPE_POINTER
#undef TYPE_BOOL
#endif
#endif /* HAVE_SGEN_GC */
|
the_stack_data/701719.c | /* SPDX-License-Identifier: BSD-3-Clause AND MIT */
/*
* Copyright (C) 2014, Cloudius Systems, Ltd.
* Copyright (c) 2019, University Politehnica of Bucharest.
* 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 author nor the names of any co-contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/* For the parts taken from musl (marked as such below), the MIT licence
* applies instead:
* ----------------------------------------------------------------------
* Copyright (c) 2005-2014 Rich Felker, et al.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* ----------------------------------------------------------------------
*/
#include <stdio.h>
#include <sys/socket.h>
#include <netdb.h>
#include <arpa/inet.h>
int getnameinfo(const struct sockaddr *restrict sa, socklen_t sl,
char *restrict node, socklen_t nodelen,
char *restrict serv, socklen_t servlen,
int flags)
{
char buf[256];
/*unsigned char reply[512]; TODO used in DNS reply */
int af = sa->sa_family;
#if CONFIG_LIBNEWLIBC /* because of fopen() */
char line[512];
FILE *f;
#endif
unsigned char *a;
switch (af) {
case AF_INET:
a = (void *) &((struct sockaddr_in *) sa)->sin_addr;
if (sl != sizeof(struct sockaddr_in))
return EAI_FAMILY;
break;
#if CONFIG_LWIP_IPV6
case AF_INET6:
a = (void *) &((struct sockaddr_in6 *) sa)->sin6_addr;
if (sl != sizeof(struct sockaddr_in6))
return EAI_FAMILY;
break;
#endif
default:
return EAI_FAMILY;
}
#if CONFIG_LIBNEWLIBC /* because of fopen() */
/* Try to find ip within /etc/hosts */
if ((node && nodelen) && (af == AF_INET)) {
const char *ipstr;
size_t l;
ipstr = inet_ntoa(((struct sockaddr_in *)sa)->sin_addr);
l = strlen(ipstr);
f = fopen("/etc/hosts", "r");
if (f)
while (fgets(line, sizeof(line), f)) {
char *domain;
if (strncmp(line, ipstr, l) != 0)
continue;
domain = strtok(line, " ");
if (!domain)
continue;
domain = strtok(NULL, " ");
if (!domain)
continue;
if (strlen(domain) >= nodelen)
return EAI_OVERFLOW;
strcpy(node, domain);
fclose(f);
return 0;
}
if (f)
fclose(f);
}
#endif
if (node && nodelen) {
if ((flags & NI_NUMERICHOST)
#if 0
/* TODO we currently don't support name requests */
|| __dns_query(reply, a, af, 1) <= 0
|| __dns_get_rr(buf, 0, 256, 1, reply, RR_PTR, 1) <= 0) {
#else
|| 1) {
#endif
if (flags & NI_NAMEREQD)
return EAI_NONAME;
inet_ntop(af, a, buf, sizeof(buf));
}
if (strlen(buf) >= nodelen)
return EAI_OVERFLOW;
strcpy(node, buf);
}
if (serv && servlen) {
if (snprintf(buf, sizeof(buf), "%d",
ntohs(((struct sockaddr_in *) sa)->sin_port)) >= (int) servlen)
return EAI_OVERFLOW;
strcpy(serv, buf);
}
return 0;
}
|
the_stack_data/269506.c | /* Generic atexit()
Copyright (C) 1996 Free Software Foundation, Inc.
This file is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
In addition to the permissions in the GNU General Public License, the
Free Software Foundation gives you unlimited permission to link the
compiled version of this file into combinations with other programs,
and to distribute those combinations without any restriction coming
from the use of this file. (The General Public License restrictions
do apply in other respects; for example, they cover modification of
the file, and distribution when not linked into a combine
executable.)
This file is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* Rather than come up with some ugly hack to make mcrt1 work, it is
better to just go ahead and provide atexit(). */
#include <stdlib.h>
void exit(int) __attribute__((noreturn));
void _exit(int) __attribute__((noreturn));
void _cleanup(void);
#define FNS_PER_BLOCK 32
struct atexit_fn_block
{
struct atexit_fn_block *next;
void (*fns[FNS_PER_BLOCK])(void);
short used;
};
/* statically allocate the first block */
static struct atexit_fn_block atexit_fns;
static struct atexit_fn_block *current_block = &atexit_fns;
int atexit(void (*fn)(void))
{
if (current_block->used >= FNS_PER_BLOCK)
{
struct atexit_fn_block *new_block =
(struct atexit_fn_block *)malloc(sizeof(struct atexit_fn_block));
if (new_block == NULL)
return -1;
new_block->used = 0;
new_block->next = current_block;
current_block = new_block;
}
current_block->fns[current_block->used++] = fn;
return 0;
}
void exit(int status)
{
struct atexit_fn_block *block = current_block, *old_block;
short i;
while (1)
{
for (i = block->used; --i >= 0 ;)
(*block->fns[i])();
if (block == &atexit_fns)
break;
/* I know what you are thinking -- we are about to exit, why free?
Because it is friendly to memory leak detectors, that's why. */
old_block = block;
block = block->next;
free(old_block);
}
_exit(status);
}
|
the_stack_data/680868.c | /***********************************************************
shelsort.c -- Shellソート
***********************************************************/
typedef int keytype; /* 整列キーの型 */
void shellsort(int n, keytype a[]) /* a[0..n-1] を昇順に */
{
int h, i, j;
keytype x;
h = 13;
while (h < n) h = 3 * h + 1;
h /= 9;
while (h > 0) {
for (i = h; i < n; i++) {
x = a[i];
for (j = i - h; j >= 0 && a[j] > x; j -= h)
a[j + h] = a[j];
a[j + h] = x;
}
h /= 3;
}
}
#include <stdio.h>
#include <stdlib.h>
#define N 20
int a[N];
int main(void)
{
int i;
printf("Before:");
for (i = 0; i < N; i++) {
a[i] = rand() / (RAND_MAX / 100 + 1);
printf(" %2d", a[i]);
}
printf("\n");
shellsort(N, a);
printf("After: ");
for (i = 0; i < N; i++) printf(" %2d", a[i]);
printf("\n");
return 0;
}
|
the_stack_data/120721.c | #include <stdio.h>
int main() {
int rows, space, i, j;
printf("Enter the number of rows: ");
scanf("%d", &rows);
printf("\n");
for (i = rows-1; i>=0; i--) {
for (space = 1; space <= rows - i; space++)
printf(" ");
for (j = 0; j <= i; j++) {
printf("%4c",'*');
}
printf("\n");
}
for (i = 0; i < rows; i++) {
for (space = 1; space <= rows - i; space++)
printf(" ");
for (j = 0; j <= i; j++) {
printf("%4c",'*');
}
printf("\n");
}
return 0;
}
|
the_stack_data/95449729.c | #include <stdio.h>
#include <stdlib.h>
int main(){
printf("hello 9m.\n ");
} |
the_stack_data/107067.c | #include <stdio.h>
int main() {
int i, j, n;
scanf("%d", &n);
for (i = 0; i < n; i++) {
for (j = 0; j < i + 1; j++) {
printf("*");
}
printf("\n");
}
return 0;
} |
the_stack_data/28290.c | /* Generated by CIL v. 1.7.0 */
/* print_CIL_Input is false */
struct _IO_FILE;
struct timeval;
extern void signal(int sig , void *func ) ;
extern float strtof(char const *str , char const *endptr ) ;
typedef struct _IO_FILE FILE;
extern int atoi(char const *s ) ;
extern double strtod(char const *str , char const *endptr ) ;
extern int fclose(void *stream ) ;
extern void *fopen(char const *filename , char const *mode ) ;
extern void abort() ;
extern void exit(int status ) ;
extern int raise(int sig ) ;
extern int fprintf(struct _IO_FILE *stream , char const *format , ...) ;
extern int strcmp(char const *a , char const *b ) ;
extern int rand() ;
extern unsigned long strtoul(char const *str , char const *endptr , int base ) ;
void RandomFunc(unsigned short input[1] , unsigned short output[1] ) ;
extern int strncmp(char const *s1 , char const *s2 , unsigned long maxlen ) ;
extern int gettimeofday(struct timeval *tv , void *tz , ...) ;
extern int printf(char const *format , ...) ;
int main(int argc , char *argv[] ) ;
void megaInit(void) ;
extern unsigned long strlen(char const *s ) ;
extern long strtol(char const *str , char const *endptr , int base ) ;
extern unsigned long strnlen(char const *s , unsigned long maxlen ) ;
extern void *memcpy(void *s1 , void const *s2 , unsigned long size ) ;
struct timeval {
long tv_sec ;
long tv_usec ;
};
extern void *malloc(unsigned long size ) ;
extern int scanf(char const *format , ...) ;
int main(int argc , char *argv[] )
{
unsigned short input[1] ;
unsigned short output[1] ;
int randomFuns_i5 ;
unsigned short randomFuns_value6 ;
int randomFuns_main_i7 ;
{
megaInit();
if (argc != 2) {
printf("Call this program with %i arguments\n", 1);
exit(-1);
} else {
}
randomFuns_i5 = 0;
while (randomFuns_i5 < 1) {
randomFuns_value6 = (unsigned short )strtoul(argv[randomFuns_i5 + 1], 0, 10);
input[randomFuns_i5] = randomFuns_value6;
randomFuns_i5 ++;
}
RandomFunc(input, output);
if (output[0] == (unsigned short)31026) {
printf("You win!\n");
} else {
}
randomFuns_main_i7 = 0;
while (randomFuns_main_i7 < 1) {
printf("%u\n", output[randomFuns_main_i7]);
randomFuns_main_i7 ++;
}
}
}
void RandomFunc(unsigned short input[1] , unsigned short output[1] )
{
unsigned short state[1] ;
char copy11 ;
char copy13 ;
{
state[0UL] = (input[0UL] + 914778474UL) * (unsigned short)64278;
if (state[0UL] & (unsigned short)1) {
copy11 = *((char *)(& state[0UL]) + 0);
*((char *)(& state[0UL]) + 0) = *((char *)(& state[0UL]) + 1);
*((char *)(& state[0UL]) + 1) = copy11;
copy11 = *((char *)(& state[0UL]) + 1);
*((char *)(& state[0UL]) + 1) = *((char *)(& state[0UL]) + 0);
*((char *)(& state[0UL]) + 0) = copy11;
state[0UL] *= state[0UL];
} else {
copy13 = *((char *)(& state[0UL]) + 0);
*((char *)(& state[0UL]) + 0) = *((char *)(& state[0UL]) + 1);
*((char *)(& state[0UL]) + 1) = copy13;
}
output[0UL] = state[0UL] + (unsigned short)10715;
}
}
void megaInit(void)
{
{
}
}
|
the_stack_data/153267310.c | /*
Copyright 2005-2012 Intel Corporation. All Rights Reserved.
The source code contained or described herein and all documents related
to the source code ("Material") are owned by Intel Corporation or its
suppliers or licensors. Title to the Material remains with Intel
Corporation or its suppliers and licensors. The Material is protected
by worldwide copyright laws and treaty provisions. No part of the
Material may be used, copied, reproduced, modified, published, uploaded,
posted, transmitted, distributed, or disclosed in any way without
Intel's prior express written permission.
No license under any patent, copyright, trade secret or other
intellectual property right is granted to or conferred upon you by
disclosure or delivery of the Materials, either expressly, by
implication, inducement, estoppel or otherwise. Any license under such
intellectual property rights must be express and approved by Intel in
writing.
*/
void Cplusplus();
int main() {
Cplusplus();
return 0;
}
|
the_stack_data/226802.c | #if defined(ORANGE_PI) || defined(NANO_PI)
/**
* @file esp8266.c
*
*/
/* Copyright (C) 2018 by Arjan van Vught mailto:[email protected]
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <stdint.h>
#include <stdbool.h>
#include "arm/synchronize.h"
#include "h3.h"
#include "h3_gpio.h"
#include "h3_hs_timer.h"
#include "h3_board.h"
/*
* Orange Pi Zero ESP8266
*
* 11 PA1 -- -> GPIO5
* 13 PA0 <- -- GPIO4
*
* 15 PA3 <- DATA -> GPI012 CFG0
* 16 PA19 <- DATA -> GPI013 CFG2
* 18 PA18 <- DATA -> GPI014 CFG2
* 22 PA2 <- DATA -> GPI015 CFG0
*/
/*
* NanoPi NEO ESP8266
*
* 11 PA0 -- -> GPIO5
* 13 PA2 <- -- GPIO4
*
* 15 PA3 <- DATA -> GPI012 CFG0
* 16 PG8 <- DATA -> GPI013 CFG1
* 18 PG9 <- DATA -> GPI014 CFG1
* 22 PA1 <- DATA -> GPI015 CFG0
*/
#define COUT H3_GPIO_TO_NUMBER(GPIO_EXT_11)
#define CIN H3_GPIO_TO_NUMBER(GPIO_EXT_13)
#if (H3_GPIO_TO_PORT(GPIO_EXT_13) == H3_GPIO_PORTA)
#define PORT_CIN H3_PIO_PORTA
#else
#error PORT_CIN not defined
#endif
#define D0 H3_GPIO_TO_NUMBER(GPIO_EXT_15)
#define D1 H3_GPIO_TO_NUMBER(GPIO_EXT_16)
#define D2 H3_GPIO_TO_NUMBER(GPIO_EXT_18)
#define D3 H3_GPIO_TO_NUMBER(GPIO_EXT_22)
typedef union pcast32 {
uint32_t u32;
uint8_t u8[4];
} esp8266_pcast32;
static void data_gpio_fsel_output(void) {
isb();
uint32_t value = H3_PIO_PORTA->CFG0;
#if defined(NANO_PI)
value &= (uint32_t) ~(GPIO_SELECT_MASK << PA1_SELECT_CFG0_SHIFT);
value |= (GPIO_FSEL_OUTPUT << PA1_SELECT_CFG0_SHIFT);
#endif
#if defined(ORANGE_PI)
value &= (uint32_t) ~(GPIO_SELECT_MASK << PA2_SELECT_CFG0_SHIFT);
value |= (GPIO_FSEL_OUTPUT << PA2_SELECT_CFG0_SHIFT);
#endif
value &= (uint32_t) ~(GPIO_SELECT_MASK << PA3_SELECT_CFG0_SHIFT);
value |= (GPIO_FSEL_OUTPUT << PA3_SELECT_CFG0_SHIFT);
H3_PIO_PORTA->CFG0 = value;
#if defined(ORANGE_PI)
value = H3_PIO_PORTA->CFG2;
value &= (uint32_t) ~(GPIO_SELECT_MASK << PA18_SELECT_CFG2_SHIFT);
value |= (GPIO_FSEL_OUTPUT << PA18_SELECT_CFG2_SHIFT);
value &= (uint32_t) ~(GPIO_SELECT_MASK << PA19_SELECT_CFG2_SHIFT);
value |= (GPIO_FSEL_OUTPUT << PA19_SELECT_CFG2_SHIFT);
H3_PIO_PORTA->CFG2 = value;
#endif
#if defined(NANO_PI)
value = H3_PIO_PORTG->CFG1;
value &= (uint32_t) ~(GPIO_SELECT_MASK << PG8_SELECT_CFG1_SHIFT);
value |= (GPIO_FSEL_OUTPUT << PG8_SELECT_CFG1_SHIFT);
value &= (uint32_t) ~(GPIO_SELECT_MASK << PG9_SELECT_CFG1_SHIFT);
value |= (GPIO_FSEL_OUTPUT << PG9_SELECT_CFG1_SHIFT);
H3_PIO_PORTG->CFG1 = value;
#endif
dmb();
}
static void data_gpio_fsel_input(void) {
isb();
uint32_t value = H3_PIO_PORTA->CFG0;
#if defined(NANO_PI)
value &= (uint32_t) ~(GPIO_SELECT_MASK << PA1_SELECT_CFG0_SHIFT);
value |= (GPIO_FSEL_INPUT << PA1_SELECT_CFG0_SHIFT);
#endif
#if defined(ORANGE_PI)
value &= (uint32_t) ~(GPIO_SELECT_MASK << PA2_SELECT_CFG0_SHIFT);
value |= (GPIO_FSEL_INPUT << PA2_SELECT_CFG0_SHIFT);
#endif
value &= (uint32_t) ~(GPIO_SELECT_MASK << PA3_SELECT_CFG0_SHIFT);
value |= (GPIO_FSEL_INPUT << PA3_SELECT_CFG0_SHIFT);
H3_PIO_PORTA->CFG0 = value;
#if defined(ORANGE_PI)
value = H3_PIO_PORTA->CFG2;
value &= (uint32_t) ~(GPIO_SELECT_MASK << PA18_SELECT_CFG2_SHIFT);
value |= (GPIO_FSEL_INPUT << PA18_SELECT_CFG2_SHIFT);
value &= (uint32_t) ~(GPIO_SELECT_MASK << PA19_SELECT_CFG2_SHIFT);
value |= (GPIO_FSEL_INPUT << PA19_SELECT_CFG2_SHIFT);
H3_PIO_PORTA->CFG2 = value;
#endif
#if defined(NANO_PI)
value = H3_PIO_PORTG->CFG1;
value &= (uint32_t) ~(GPIO_SELECT_MASK << PG8_SELECT_CFG1_SHIFT);
value |= (GPIO_FSEL_INPUT << PG8_SELECT_CFG1_SHIFT);
value &= (uint32_t) ~(GPIO_SELECT_MASK << PG9_SELECT_CFG1_SHIFT);
value |= (GPIO_FSEL_INPUT << PG9_SELECT_CFG1_SHIFT);
H3_PIO_PORTG->CFG1 = value;
#endif
dmb();
}
void __attribute__((cold)) esp8266_init(void) {
h3_gpio_fsel(GPIO_EXT_13, GPIO_FSEL_INPUT);
h3_gpio_fsel(GPIO_EXT_11, GPIO_FSEL_OUTPUT);
h3_gpio_clr(GPIO_EXT_11);
udelay(1000);
while (PORT_CIN->DAT & (1 << CIN));
}
void esp8266_write_4bits(const uint8_t data) {
data_gpio_fsel_output();
// Put the data on the bus.
#if defined(ORANGE_PI)
uint32_t out_gpio = H3_PIO_PORTA->DAT & (uint32_t)~( (1 << D0) | (1 << D1) | (1 << D2) | (1 << D3) );
out_gpio |= (data & 1) ? (1 << D0) : 0;
out_gpio |= (data & 2) ? (1 << D1) : 0;
out_gpio |= (data & 4) ? (1 << D2) : 0;
out_gpio |= (data & 8) ? (1 << D3) : 0;
H3_PIO_PORTA->DAT = out_gpio;
#elif defined(NANO_PI)
uint32_t out_gpio = H3_PIO_PORTA->DAT & (uint32_t)~( (1 << D0) | (1 << D3) );
out_gpio |= (data & 1) ? (1 << D0) : 0;
out_gpio |= (data & 8) ? (1 << D3) : 0;
H3_PIO_PORTA->DAT = out_gpio;
out_gpio = H3_PIO_PORTG->DAT & ~( (1 << D1) | (1 << D2) );
out_gpio |= (data & 2) ? (1 << D1) : 0;
out_gpio |= (data & 4) ? (1 << D2) : 0;
H3_PIO_PORTG->DAT = out_gpio;
#endif
// tell that we have data available for read
h3_gpio_set(GPIO_EXT_11);
// wait for ack, wait for 0 -> 1
while (!(H3_PIO_PORTA->DAT & (1 << CIN)));
// we have 1. now wait for 0
h3_gpio_clr(GPIO_EXT_11); // we acknowledge, and wait for zero
while (H3_PIO_PORTA->DAT & (1 << CIN));
dmb();
}
inline static void _write_byte(const uint8_t data) {
// Put the data on the bus.
#if defined(ORANGE_PI)
uint32_t out_gpio = H3_PIO_PORTA->DAT & (uint32_t)~( (1 << D0) | (1 << D1) | (1 << D2) | (1 << D3) );
out_gpio |= (data & 1) ? (1 << D0) : 0;
out_gpio |= (data & 2) ? (1 << D1) : 0;
out_gpio |= (data & 4) ? (1 << D2) : 0;
out_gpio |= (data & 8) ? (1 << D3) : 0;
H3_PIO_PORTA->DAT = out_gpio;
#elif defined(NANO_PI)
uint32_t out_gpio = H3_PIO_PORTA->DAT & ~( (1 << D0) | (1 << D3) );
out_gpio |= (data & 1) ? (1 << D0) : 0;
out_gpio |= (data & 8) ? (1 << D3) : 0;
H3_PIO_PORTA->DAT = out_gpio;
out_gpio = H3_PIO_PORTG->DAT & ~( (1 << D1) | (1 << D2) );
out_gpio |= (data & 2) ? (1 << D1) : 0;
out_gpio |= (data & 4) ? (1 << D2) : 0;
H3_PIO_PORTG->DAT = out_gpio;
#endif
// tell that we have data available for read
h3_gpio_set(GPIO_EXT_11);
// wait for ack, wait for 0 -> 1
while (!(PORT_CIN->DAT & (1 << CIN)));
// we have 1. now wait for 0
h3_gpio_clr(GPIO_EXT_11); // we acknowledge, and wait for zero
while (PORT_CIN->DAT & (1 << CIN));
// Put the data on the bus.
#if defined(ORANGE_PI)
out_gpio = H3_PIO_PORTA->DAT & (uint32_t)~( (1 << D0) | (1 << D1) | (1 << D2) | (1 << D3) );
out_gpio |= (data & 16) ? (1 << D0) : 0;
out_gpio |= (data & 32) ? (1 << D1) : 0;
out_gpio |= (data & 64) ? (1 << D2) : 0;
out_gpio |= (data & 128) ? (1 << D3) : 0;
H3_PIO_PORTA->DAT = out_gpio;
#elif defined(NANO_PI)
out_gpio = H3_PIO_PORTA->DAT & ~( (1 << D0) | (1 << D3) );
out_gpio |= (data & 16) ? (1 << D0) : 0;
out_gpio |= (data & 128) ? (1 << D3) : 0;
H3_PIO_PORTA->DAT = out_gpio;
out_gpio = H3_PIO_PORTG->DAT & ~( (1 << D1) | (1 << D2) );
out_gpio |= (data & 32) ? (1 << D1) : 0;
out_gpio |= (data & 64) ? (1 << D2) : 0;
H3_PIO_PORTG->DAT = out_gpio;
#endif
// tell that we have data available for read
h3_gpio_set(GPIO_EXT_11);
// wait for ack, wait for 0 -> 1
while (!(PORT_CIN->DAT & (1 << CIN)));
// we have 1. now wait for 0
h3_gpio_clr(GPIO_EXT_11); // we acknowledge, and wait for zero
while (PORT_CIN->DAT & (1 << CIN));
}
void esp8266_write_byte(const uint8_t byte) {
data_gpio_fsel_output();
_write_byte(byte);
dmb();
}
void esp8266_write_halfword(const uint16_t half_word) {
data_gpio_fsel_output();
_write_byte((uint8_t)(half_word & (uint16_t)0xFF));
_write_byte((uint8_t)((half_word >> 8) & (uint16_t)0xFF));
dmb();
}
void esp8266_write_word(const uint32_t word) {
esp8266_pcast32 u32 __attribute__((aligned(4)));
data_gpio_fsel_output();
u32.u32 = word;
_write_byte(u32.u8[0]);
_write_byte(u32.u8[1]);
_write_byte(u32.u8[2]);
_write_byte(u32.u8[3]);
dmb();
}
void esp8266_write_bytes(const uint8_t *data, const uint16_t len) {
uint8_t *p = (uint8_t *)data;
uint8_t d;
uint16_t i;
data_gpio_fsel_output();
for (i = 0; i < len; i++) {
d = *p;
_write_byte(d);
p++;
}
dmb();
}
void esp8266_write_str(const char *data) {
uint8_t *p = (uint8_t *)data;
uint8_t d;
data_gpio_fsel_output();
while (*p != (char)0) {
d = *p;
_write_byte(d);
p++;
}
_write_byte(0);
dmb();
}
inline static uint8_t _read_byte(void) {
uint8_t data;
h3_gpio_set(GPIO_EXT_11);
while (!(PORT_CIN->DAT & (1 << CIN)));
// Read the data from the data port.
#if defined(ORANGE_PI)
uint32_t in_gpio = H3_PIO_PORTA->DAT;
uint8_t data_msb = in_gpio & (1 << D0) ? 1 : 0;
data_msb |= in_gpio & (1 << D1) ? 2 : 0;
data_msb |= in_gpio & (1 << D2) ? 4 : 0;
data_msb |= in_gpio & (1 << D3) ? 8 : 0;
#elif defined(NANO_PI)
uint32_t in_gpio = H3_PIO_PORTA->DAT;
uint8_t data_msb = in_gpio & (1 << D0) ? 1 : 0;
data_msb |= in_gpio & (1 << D3) ? 8 : 0;
in_gpio = H3_PIO_PORTG->DAT;
data_msb |= in_gpio & (1 << D1) ? 2 : 0;
data_msb |= in_gpio & (1 << D2) ? 4 : 0;
#endif
h3_gpio_clr(GPIO_EXT_11);
while (PORT_CIN->DAT & (1 << CIN));
h3_gpio_set(GPIO_EXT_11);
while (!(PORT_CIN->DAT & (1 << CIN)));
#if defined(ORANGE_PI)
in_gpio = H3_PIO_PORTA->DAT;
uint8_t data_lsb = in_gpio & (1 << D0) ? 1 : 0;
data_lsb |= in_gpio & (1 << D1) ? 2 : 0;
data_lsb |= in_gpio & (1 << D2) ? 4 : 0;
data_lsb |= in_gpio & (1 << D3) ? 8 : 0;
#elif defined(NANO_PI)
in_gpio = H3_PIO_PORTA->DAT;
uint8_t data_lsb = in_gpio & (1 << D0) ? 1 : 0;
data_lsb |= in_gpio & (1 << D3) ? 8 : 0;
in_gpio = H3_PIO_PORTG->DAT;
data_lsb |= in_gpio & (1 << D1) ? 2 : 0;
data_lsb |= in_gpio & (1 << D2) ? 4 : 0;
#endif
data = data_msb | ((uint8_t)(data_lsb & 0x0F) << 4);
h3_gpio_clr(GPIO_EXT_11);
while (PORT_CIN->DAT & (1 << CIN));
return data;
}
uint8_t esp8266_read_byte(void) {
uint8_t data;
data_gpio_fsel_input();
data = _read_byte();
dmb();
return data;
}
void esp8266_read_bytes(const uint8_t *data, const uint16_t len){
uint8_t *p = (uint8_t *)data;
uint16_t i;
data_gpio_fsel_input();
for (i = 0 ; i < len; i++) {
*p = _read_byte();
p++;
}
dmb();
}
uint16_t esp8266_read_halfword(void) {
uint16_t data;
data_gpio_fsel_input();
data = _read_byte();
data |= (_read_byte() << 8);
dmb();
return data;
}
uint32_t esp8266_read_word(void) {
esp8266_pcast32 u32 __attribute__((aligned(4)));
data_gpio_fsel_input();
u32.u8[0] = _read_byte();
u32.u8[1] = _read_byte();
u32.u8[2] = _read_byte();
u32.u8[3] = _read_byte();
dmb();
return u32.u32;
}
void esp8266_read_str(char *s, uint16_t *len) {
const char *p = s;
uint8_t ch;
uint16_t n = *len;
data_gpio_fsel_input();
while ((ch = _read_byte()) != (uint8_t) 0) {
if (n > (uint16_t) 0) {
*s++ = (char) ch;
n--;
}
}
*len = (uint16_t) (s - p);
while (n > 0) {
*s++ = '\0';
--n;
}
dmb();
}
bool esp8266_detect(void) {
esp8266_init();
data_gpio_fsel_output();
// send a CMD_NOP
#if defined(ORANGE_PI)
const uint32_t out_gpio = H3_PIO_PORTA->DAT & (uint32_t)~( (1 << D0) | (1 << D1) | (1 << D2) | (1 << D3) );
H3_PIO_PORTA->DAT = out_gpio;
#elif defined(NANO_PI)
uint32_t out_gpio = H3_PIO_PORTA->DAT & ~( (1 << D0) | (1 << D3) );
H3_PIO_PORTA->DAT = out_gpio;
out_gpio = H3_PIO_PORTG->DAT & ~( (1 << D1) | (1 << D2) );
H3_PIO_PORTG->DAT = out_gpio;
#endif
h3_gpio_set(GPIO_EXT_11);// Tell that we have data available. Wait for ack, wait for 0 -> 1
uint32_t micros_now = h3_hs_timer_lo_us();
// wait 0.5 second for the ESP8266 to respond
while ((!(PORT_CIN->DAT & (1 << CIN))) && (h3_hs_timer_lo_us() - micros_now < (uint32_t) 500000))
;
if (!(PORT_CIN->DAT & (1 << CIN))) {
h3_gpio_clr(GPIO_EXT_11);
return false;
}
h3_gpio_clr(GPIO_EXT_11); // we acknowledge, and wait for zero
while (PORT_CIN->DAT & (1 << CIN));
dmb();
return true;
}
#endif
|
the_stack_data/111076815.c | /************************************************************************/
/* */
/* Access Dallas 1-Wire Device with ATMEL AVRs */
/* */
/* Author: Peter Dannegger */
/* [email protected] */
/* */
/* modified by Martin Thomas <[email protected]> 9/2004 */
/************************************************************************/
/*
* crc8.c
*
*/
/* please read copyright-notice at EOF */
#include <inttypes.h>
#define CRC8INIT 0x00
#define CRC8POLY 0x18 //0X18 = X^8+X^5+X^4+X^0
uint8_t crc8 ( uint8_t *data_in, uint16_t number_of_bytes_to_read )
{
uint8_t crc;
uint16_t loop_count;
uint8_t bit_counter;
uint8_t data;
uint8_t feedback_bit;
crc = CRC8INIT;
for (loop_count = 0; loop_count != number_of_bytes_to_read; loop_count++)
{
data = data_in[loop_count];
bit_counter = 8;
do {
feedback_bit = (crc ^ data) & 0x01;
if ( feedback_bit == 0x01 ) {
crc = crc ^ CRC8POLY;
}
crc = (crc >> 1) & 0x7F;
if ( feedback_bit == 0x01 ) {
crc = crc | 0x80;
}
data = data >> 1;
bit_counter--;
} while (bit_counter > 0);
}
return crc;
}
|
the_stack_data/29118.c | /* Simple S/MIME signing example */
#include <openssl/pem.h>
#include <openssl/pkcs7.h>
#include <openssl/err.h>
int main(int argc, char **argv)
{
BIO *in = NULL, *out = NULL, *tbio = NULL;
X509 *rcert = NULL;
EVP_PKEY *rkey = NULL;
PKCS7 *p7 = NULL;
int ret = 1;
OpenSSL_add_all_algorithms();
ERR_load_crypto_strings();
/* Read in recipient certificate and private key */
tbio = BIO_new_file("signer.pem", "r");
if (!tbio)
goto err;
rcert = PEM_read_bio_X509(tbio, NULL, 0, NULL);
BIO_reset(tbio);
rkey = PEM_read_bio_PrivateKey(tbio, NULL, 0, NULL);
if (!rcert || !rkey)
goto err;
/* Open content being signed */
in = BIO_new_file("smencr.txt", "r");
if (!in)
goto err;
/* Sign content */
p7 = SMIME_read_PKCS7(in, NULL);
if (!p7)
goto err;
out = BIO_new_file("encrout.txt", "w");
if (!out)
goto err;
/* Decrypt S/MIME message */
if (!PKCS7_decrypt(p7, rkey, rcert, out, 0))
goto err;
ret = 0;
err:
if (ret)
{
fprintf(stderr, "Error Signing Data\n");
ERR_print_errors_fp(stderr);
}
if (p7)
PKCS7_free(p7);
if (rcert)
X509_free(rcert);
if (rkey)
EVP_PKEY_free(rkey);
if (in)
BIO_free(in);
if (out)
BIO_free(out);
if (tbio)
BIO_free(tbio);
return ret;
}
|
the_stack_data/184518095.c | /* dynload_dladdr.c - Prints function addresses from a dynamically loaded shared library.
*
* The `dladdr(3)` function is a GNU extension that, given a function address,
* is capable of returning a `Dl_info` struct containing information about
* the file where the function is defined.
*
* This program extends the `shlibs/dynload.c` listing from the chapter 43
* of the Linux Programming Interface book, adding `dladdr` calls to inspect
* its result
*
* Usage
*
* $ LD_LIBRARY_PATH=. ./dynload_dladdr libx1.so libx1_f1
*
* Changes on the original `dynload.c` by: Renato Mascarenhas Costa
*/
#define _GNU_SOURCE /* dladdr(3) definition */
#include <stdio.h>
#include <stdlib.h>
#include <dlfcn.h>
static void helpAndExit(int status, const char *progname);
static void fatal(const char *message);
static void pexit(const char *fname);
int
main(int argc, char *argv[]) {
void *libHandle;
void (*funcp)(void);
Dl_info funcInfo;
const char *err;
if (argc != 3)
helpAndExit(EXIT_FAILURE, argv[0]);
/* load the shared library and get a handle for later use */
libHandle = dlopen(argv[1], RTLD_LAZY);
if (libHandle == NULL)
fatal(dlerror());
/* search library for symbol named in argv[2] */
(void) dlerror(); /* clear dlerror */
*(void **) (&funcp) = dlsym(libHandle, argv[2]);
err = dlerror();
if (err != NULL)
fatal(err);
printf("Calling function %s\n", argv[2]);
if (funcp == NULL)
printf("%s is NULL\n", argv[2]);
else
(*funcp)();
/* extract information about retrieved symbol */
printf("\nGetting address information for %s:%s\n", argv[1], argv[2]);
if (dladdr(funcp, &funcInfo) == 0)
pexit("dladdr");
printf("%20s %10s\n", "Pathname of shared object:", funcInfo.dli_fname);
printf("%20s %10p\n", "Address where shared object is loaded:", funcInfo.dli_fbase);
printf("%20s %10s\n", "Name of symbol overlapping address:", funcInfo.dli_sname == NULL ? "NULL" : funcInfo.dli_sname);
printf("%20s %10p\n", "Exact address of symbol above:", funcInfo.dli_saddr);
exit(EXIT_SUCCESS);
}
void
fatal(const char *message) {
fprintf(stderr, message);
exit(EXIT_FAILURE);
}
void
pexit(const char *fname) {
perror(fname);
exit(EXIT_FAILURE);
}
void
helpAndExit(int status, const char *progname) {
FILE *stream = stderr;
if (status == EXIT_SUCCESS)
stream = stdout;
fprintf(stream, "Usage: %s [lib-path] [func-name]\n", progname);
exit(status);
}
|
the_stack_data/25139182.c | /* Test for ftw function searching in current directory.
Copyright (C) 2001-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <[email protected]>, 2001.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#include <ftw.h>
#include <mcheck.h>
#include <stdio.h>
#include <string.h>
int cnt;
int result;
int sawown;
int sawcur;
static int
callback (const char *fname, const struct stat *st, int flag)
{
printf ("%d: \"%s\" -> ", ++cnt, fname);
if (strcmp (fname, ".") == 0 && sawcur)
{
puts ("current directory reported twice");
result = 1;
}
else if (strcmp (fname, "./bug-ftw2.c") == 0 && sawown)
{
puts ("source file reported twice");
result = 1;
}
else if (fname[0] != '.')
{
puts ("missing '.' as first character");
result = 1;
}
else if (fname[1] != '\0' && fname[1] != '/')
{
puts ("no '/' in second position");
result = 1;
}
else
{
puts ("OK");
sawcur |= strcmp (fname, ".") == 0;
sawown |= strcmp (fname, "./bug-ftw2.c") == 0;
}
return 0;
}
int
main (void)
{
mtrace ();
ftw (".", callback, 10);
if (! sawcur)
{
puts ("current directory wasn't reported");
result = 1;
}
if (! sawown)
{
puts ("source file wasn't reported");
result = 1;
}
return result;
}
|
the_stack_data/159516377.c | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int run_wrapper(char *cmd) { system(cmd); }
void show_logs(char *cmd, char *logfile) {
char buffer[100];
snprintf(buffer, sizeof(buffer), "%s -f /var/log/%s", cmd, logfile);
run_wrapper(buffer);
}
int main(int argc, char **argv) {
printf("Display the log file\n");
if (argc < 2) {
printf("Usage: %s <log-file>\n\n", argv[0]);
exit(1);
}
show_logs("/usr/bin/tail", argv[1]);
} |
the_stack_data/297284.c | /* The binomial coefficients nCk can be arranged in triangular form, Pascal's
* triangle, like this:
* It can be seen that the first eight rows of Pascal's triangle contain twelve
* distinct numbers: 1, 2, 3, 4, 5, 6, 7, 10, 15, 20, 21 and 35.
* A positive integer n is called squarefree if no square of a prime divides n. Of
* the twelve distinct numbers in the first eight rows of Pascal's triangle, all
* except 4 and 20 are squarefree. The sum of the distinct squarefree numbers in
* the first eight rows is 105.
* Find the sum of the distinct squarefree numbers in the first 51 rows of
* Pascal's triangle.
*
* #203; */
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <math.h>
#include <inttypes.h>
struct _arr {
void* contents;
uint32_t capacity;
uint32_t len;
};
typedef struct _arr* List;
#define NMAX 51
#define LIST_CAPACITY 64
uint64_t sum_squarefree_combinations(uint32_t nmax);
uint64_t binomial_coeff(uint64_t n, uint64_t k);
int squarefree(uint64_t n, List sqprimes);
void list_add(List list, uint64_t n);
List generate_sqprimes(uint64_t max);
void purge_list_assets(List list);
int inlist(List list, uint64_t n);
int main(int argc, char** argv);
uint64_t sum_list(List list);
List init_list(void);
int is_prime(uint64_t s);
int main(int argc, char** argv)
{
(void) argc;
(void) argv;
printf("%"PRIu64"\n", sum_squarefree_combinations(NMAX));
return 0;
}
uint64_t sum_squarefree_combinations(uint32_t nmax)
{
/* The maximum value of this is approximately n / 2. Since over that
* will only generate collisions, there is no point in checking */
uint64_t n_items = binomial_coeff(nmax, nmax/2 + 1);
List list = init_list();
List primes = generate_sqprimes(n_items);
for(uint32_t n = 1; n < nmax; n++){
uint32_t limit = (n & 0x1) ? n / 2 + 1 : n / 2;
for(uint32_t r = 1; r <= limit; r++){
uint64_t k = binomial_coeff(n, r);
if(!inlist(list, k) && squarefree(k, primes)){
list_add(list, k);
}
}
}
uint64_t sum = sum_list(list);
purge_list_assets(primes);
purge_list_assets(list);
return sum;
}
/* Iterates over our generated list of square primes and tests iteratively if
* any of those will divide the number `n` */
int squarefree(uint64_t n, List sqprimes)
{
uint64_t* contents = sqprimes->contents;
for(uint32_t i = 0; i < sqprimes->len; i++){
if(n % contents[i] == 0){
return 0;
}
}
return 1;
}
/* Generate the square of primes up to the max. The max is the largest possible
* number that we could have to test. Note, we only have to search up to the
* square of that to see if it is a factor, and only up to the square of that
* number to test whether that number is the *square* of the prime. Taking the
* fourth root *significantly reduces our search space */
List generate_sqprimes(uint64_t max)
{
max = (uint64_t) round((double) sqrt(sqrt(max)));
List primes = init_list();
list_add(primes, 4);
for(uint64_t i = 3; i < max; i += 2){
if(is_prime(i)){
list_add(primes, i * i);
}
}
return primes;
}
int is_prime(uint64_t s)
{
if (s <= 2 || s % 2 == 0)
return (s == 2);
uint64_t top = (uint64_t) round((double) sqrt(s));
for(uint64_t i = 3; i <= top; i+=2){
if (s % i == 0)
return 0;
}
return 1;
}
uint64_t sum_list(List list)
{
uint64_t sum = 0;
uint64_t* arr = list->contents;
for(uint64_t i = 0; i < list->len; sum += arr[i++])
;
return sum;
}
/* Calculates the binomial coefficient by cancelling the numerator and
* denominator as it goes so that the result is *less* likely to overflow a
* 64 bit integer */
uint64_t binomial_coeff(uint64_t n, uint64_t k)
{
uint64_t res = 1;
if (k > n - k){
k = n - k;
}
for (uint32_t i = 0; i < k; ++i){
res *= (n - i);
res /= (i + 1);
}
return res;
}
void list_add(List list, uint64_t n)
{
if(list->len < list->capacity){
((uint64_t*)(list->contents))[list->len++] = n;
return;
}
list->capacity *= 2;
list->contents = realloc(list->contents, list->capacity *
sizeof(uint64_t));
((uint64_t*)(list->contents))[list->len++] = n;
return;
}
List init_list(void)
{
List l = calloc(1, sizeof(struct _arr));
l->len = 0;
l->capacity = LIST_CAPACITY;
l->contents = calloc(l->capacity, sizeof(uint64_t));
return l;
}
/* Remove all of the associated resources from the List objects */
void purge_list_assets(List list)
{
free(list->contents);
free(list);
}
/* We *could* have inserted in order, but that ends up using up more time than
* actually just searching what is a tiny search space */
int inlist(List list, uint64_t n)
{
uint64_t* contents = list->contents;
for(uint64_t i = 0; i < list->len; i++){
if(contents[i] == n){
return 1;
}
}
return 0;
}
|
the_stack_data/579341.c | /*
<TAGS>signal_processing time</TAGS>
DESCRIPTION:
- split start-stop pairs into smaller sub-windows of fixed size
USES:
DEPENDENCY TREE:
No dependencies
ARGUMENTS:
long *start : pointer to original start array
long *stop : pointer to original stop array
long nssp : number of elements in start[] & stop[]
long winsize : size of sub-windows (samples)
long **start : unallocated pointer for results start array passed by calling function as &start2
long **stop : unallocated pointer for results stop array passed by calling function as &start2
char *message : pre-allocated array to hold error message
RETURN VALUE:
success:
- new size of start[] and stop[] arrays
- start[] and stop[] arrays will be modified
error:
-1
message array will hold error message
SAMPLE CALL:
nn = xf_sspplit1_l(&start,&stop,nssp,25,&start2,&stop2,message);
if(nn<0) { fprintf(stderr,"\n\t--- %s/%s\n\n",thisprog,message); exit(1); }
*/
#include <stdio.h>
#include <stdlib.h>
long xf_sspsplit1_l(long *start1, long *stop1, long nssp, long winsize, long **start2, long **stop2, char *message) {
char *thisfunc="xf_sspplit1_l\0";
int sizeoflong=sizeof(long);
long ii,jj,kk,nn;
long *tempstart=NULL,*tempstop=NULL;
/* CHECK VALIDITY OF ARGUMENTS */
if(start1==NULL) { sprintf(message,"%s [ERROR]: input start-array is NULL",thisfunc); return(-1); }
if(stop1==NULL) { sprintf(message,"%s [ERROR]: input stop-array is NULL",thisfunc); return(-1); }
if(nssp==0) { sprintf(message,"%s [ERROR]: invalid size of input (%ld)",thisfunc,nssp); return(-1); }
if(winsize<1) { sprintf(message,"%s [ERROR]: invalid size of windows (%ld)",thisfunc,winsize); return(-1); }
// TEST: for(ii=0;ii<10;ii++) printf("func: window %ld/%ld= %ld-%ld\n",ii,nssp,start1[ii],stop1[ii]);
/* BUILD NEW START/STOP ARRAY */
/* each window must be completely contained within existing start-stop pairs */
for(ii=nn=0;ii<nssp;ii++) {
kk= stop1[ii]-winsize;
for(jj=start1[ii];jj<kk;jj+=winsize) {
tempstart= realloc(tempstart,((nn+1)*sizeoflong));
tempstop= realloc(tempstop,((nn+1)*sizeoflong));
if(tempstart==NULL||tempstop==NULL) {sprintf(message,"%s [ERROR]: insufficient memory",thisfunc);return(-1);}
tempstart[nn]= jj;
tempstop[nn]= jj+winsize;
nn++;
}}
/* SET POINTERS TO THE MEMORY ALLOCATED BY THIS FUNCTION - TEMPSTART & TEMPSTOP */
(*start2)= tempstart;
(*stop2) = tempstop;
/* RETURN THE NEW NUMBER OF START-STOP PAIRS */
return (nn);
}
|
the_stack_data/97012091.c | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlcat.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dateixei <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/08/18 01:04:42 by dateixei #+# #+# */
/* Updated: 2021/08/24 19:27:09 by dateixei ### ########.fr */
/* */
/* ************************************************************************** */
unsigned int ft_str_length_fast(char *dest)
{
unsigned int count;
count = 0;
while (dest[count] != '\0')
count++;
return (count);
}
unsigned int ft_strlcat(char *dest, char *src, unsigned int size)
{
char *dst;
char *src_start;
unsigned int dst_length;
unsigned int remaing;
dst = dest;
src_start = src;
remaing = size;
while (remaing-- != 0 && *dst != '\0')
dst++;
dst_length = dst - dest;
remaing = size - dst_length;
if (remaing == 0)
return (dst_length + ft_str_length_fast(src));
while (*src != '\0')
{
if (remaing > 1)
{
*dst++ = *src;
remaing--;
}
src++;
}
*dst = '\0';
return (dst_length + (src - src_start));
}
#include <stdio.h>
#include <string.h>
int main()
{
char dest[50] = "Hello ";
char src[50] = "World2222222";
char dest1[50] = "Hello ";
char src1[50] = "World2222222";
printf("%u\n", ft_strlcat(dest, src, 13));
printf("%s\n", dest);
printf("%u\n", strlcat(dest1, src1, 5));
printf("%s\n", dest1);
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.