file
stringlengths 18
26
| data
stringlengths 3
1.04M
|
---|---|
the_stack_data/45449165.c | /*
** mouse:~ppr/src/subst_tool.c
** Copyright 1995--2006, Trinity College Computing Center.
** Written by David Chappell.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are met:
**
** * Redistributions of source code must retain the above copyright notice,
** this list of conditions and the following disclaimer.
**
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
** POSSIBILITY OF SUCH DAMAGE.
**
** Last modified 7 April 2006.
*/
/*
* This program is a filter which inserts the values of environment variables at marked
* locations. It is designed to emulate autoconf. The patterns are:
*
* @NAME@
* Inserts the value of NAME, if defined, otherwise program aborts.
* #undef NAME
* Is replaced with
* #define NAME VALUE
* if NAME is defined, otherwise is left unchanged.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[])
{
int linenum = 0;
char line[256];
char *p;
while(fgets(line, sizeof(line), stdin))
{
linenum++;
/* If the line begins with:
* #undef SYMBOL
* and SYMBOL is a defined environment variable, replace
* it with:
* #define SYMBOL value
*/
if(strncmp(line, "#undef ", 7) == 0)
{
char *p2, *value;
p = line + 7;
if((p2 = strchr(p, '\n')))
{
*p2 = '\0';
if((value = getenv(p)) && *value)
{
if(strspn(value, "-.0123456789") == strlen(value)) /* if numberic */
printf("#define %s %s\n", p, value);
else
printf("#define %s \"%s\"\n", p, value);
continue;
}
else
{
*p2 = '\n';
/* fall thru */
}
}
}
/*
* Print the line while replacing @SYMBOL@ where SYMBOL is a name
* consisting exclusively of upper-case letters, digits, and
* underscore with the value of the environment variable of that name.
* If the environment variable is not defined, abort.
*/
for(p=line; *p; p++)
{
if(*p == '@')
{
char *end;
const char *value;
if((end = strchr(p+1, '@'))) /* if there is another @ sign, */
{
*end = '\0';
if(strspn(p+1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_") == strlen(p+1))
{
if(!(value = getenv(p+1)))
{
fprintf(stderr, "%s: no %s in environment\n", argv[0], p+1);
fprintf(stderr, "This may mean that your Makefile.conf is out-of-date and you\n"
"should run ./Configure to regenerate it.\n");
return 1;
}
fputs(value, stdout);
p = end;
continue;
}
else
{
*end = '@';
}
}
}
fputc(*p, stdout);
}
}
return 0;
}
/* end of file */
|
the_stack_data/218892823.c | #include <assert.h>
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <utime.h>
#include <sys/stat.h>
#include <sys/types.h>
void create_file(const char *path, const char *buffer, int mode) {
int fd = open(path, O_WRONLY | O_CREAT | O_EXCL, mode);
assert(fd >= 0);
int err = write(fd, buffer, sizeof(char) * strlen(buffer));
assert(err == (sizeof(char) * strlen(buffer)));
close(fd);
}
void setup() {
create_file("file", "abcdef", 0777);
symlink("file", "file-link");
// some platforms use 777, some use 755 by default for symlinks
// make sure we're using 777 for the test
lchmod("file-link", 0777);
mkdir("folder", 0777);
}
void cleanup() {
unlink("file-link");
unlink("file");
rmdir("folder");
}
void test() {
int err;
int lastctime;
struct stat s;
//
// chmod a file
//
// get the current ctime for the file
memset(&s, 0, sizeof s);
stat("file", &s);
lastctime = s.st_ctime;
sleep(1);
// do the actual chmod
err = chmod("file", 0200);
assert(!err);
memset(&s, 0, sizeof s);
stat("file", &s);
assert(s.st_mode == (0200 | S_IFREG));
assert(s.st_ctime != lastctime);
//
// fchmod a file
//
lastctime = s.st_ctime;
sleep(1);
err = fchmod(open("file", O_WRONLY), 0100);
assert(!err);
memset(&s, 0, sizeof s);
stat("file", &s);
assert(s.st_mode == (0100 | S_IFREG));
assert(s.st_ctime != lastctime);
//
// chmod a folder
//
// get the current ctime for the folder
memset(&s, 0, sizeof s);
stat("folder", &s);
lastctime = s.st_ctime;
sleep(1);
// do the actual chmod
err = chmod("folder", 0300);
assert(!err);
memset(&s, 0, sizeof s);
stat("folder", &s);
assert(s.st_mode == (0300 | S_IFDIR));
assert(s.st_ctime != lastctime);
//
// chmod a symlink's target
//
err = chmod("file-link", 0400);
assert(!err);
// make sure the file it references changed
stat("file-link", &s);
assert(s.st_mode == (0400 | S_IFREG));
// but the link didn't
lstat("file-link", &s);
assert(s.st_mode == (0777 | S_IFLNK));
//
// chmod the actual symlink
//
err = lchmod("file-link", 0500);
assert(!err);
// make sure the file it references didn't change
stat("file-link", &s);
assert(s.st_mode == (0400 | S_IFREG));
// but the link did
lstat("file-link", &s);
assert(s.st_mode == (0500 | S_IFLNK));
puts("success");
}
int main() {
atexit(cleanup);
signal(SIGABRT, cleanup);
setup();
test();
return EXIT_SUCCESS;
}
|
the_stack_data/103266628.c | #include <stdio.h>
/* several way to define a matrix. */
void printMatrix(int matrix[][3], int row, int column);
void main(){
int mat1[4][3];
int mat2[4][3] = {{1, 2, 3}, {5, 6, 7}, {9, 10, 11}, {4, 8, 12}};
int mat3[4][3] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
static int mat4[4][3];
puts("init as mat[4][3]");
printMatrix(mat1, 4, 3);
puts("init as mat[4][3] = {{.3.}, {.3.}, {.3.}, {.3.}}");
printMatrix(mat2, 4, 3);
puts("init as mat[4][3] = {.12.}");
printMatrix(mat3, 4, 3);
puts("init as static mat[4][3]");
printMatrix(mat4, 4, 3);
}
void printMatrix(int matrix[][3], int row, int column){
for (int i=0; i<row; i++){
for (int j=0; j<column; j++){
printf("%d\t", matrix[i][j]);
}
putchar('\n');
}
}
/* Test Note:
only the first dimension can miss.
and we can pass a matrix to a function as define.
*/
|
the_stack_data/134282.c | #include <stdbool.h> /* C99 only */
#include <stdio.h>
#include <stdlib.h>
#define NUM_CARDS 5
#define RANK 0
#define SUIT 1
/* external variables */
int hand[NUM_CARDS][2];
/* 0 1
____ ____
0 |____|____|
1 |____|____|
2 |____|____|
3 |____|____|
4 |____|____|
rank suit
*/
bool straight, flush, four, three;
int pairs; /* can be 0, 1, or 2 */
/* prototypes */
void read_cards(void);
void analyze_hand(void);
void print_result(void);
/**********************************************************
* main: Calls read_cards, analyze_hand, and print_result *
* repeatedly. *
**********************************************************/
int main(void)
{
for (;;) {
read_cards();
analyze_hand();
print_result();
}
}
/**********************************************************
* read_cards: Reads the cards into the external variable *
* hand; checks for bad cards and duplicate *
* cards. *
**********************************************************/
void read_cards(void)
{
char ch, rank_ch, suit_ch;
int i, rank, suit;
bool bad_card, duplicate_card;
int cards_read = 0;
while (cards_read < NUM_CARDS) {
bad_card = false;
printf("Enter a card: ");
rank_ch = getchar();
switch (rank_ch) {
case '0': exit(EXIT_SUCCESS);
case '2': rank = 0; break;
case '3': rank = 1; break;
case '4': rank = 2; break;
case '5': rank = 3; break;
case '6': rank = 4; break;
case '7': rank = 5; break;
case '8': rank = 6; break;
case '9': rank = 7; break;
case 't': case 'T': rank = 8; break;
case 'j': case 'J': rank = 9; break;
case 'q': case 'Q': rank = 10; break;
case 'k': case 'K': rank = 11; break;
case 'a': case 'A': rank = 12; break;
default: bad_card = true;
}
suit_ch = getchar();
switch (suit_ch) {
case 'c': case 'C': suit = 0; break;
case 'd': case 'D': suit = 1; break;
case 'h': case 'H': suit = 2; break;
case 's': case 'S': suit = 3; break;
default: bad_card = true;
}
while ((ch = getchar()) != '\n')
if (ch != ' ') bad_card = true;
if (bad_card) {
printf("Bad card; ignored.\n");
continue;
}
duplicate_card = false;
for (i = 0; i < cards_read; i++)
if (hand[i][RANK] == rank && hand[i][SUIT] == suit) {
printf("Duplicate card; ignored.\n");
duplicate_card = true;
break;
}
if (!duplicate_card) {
hand[cards_read][RANK] = rank;
hand[cards_read][SUIT] = suit;
cards_read++;
}
}
}
/**********************************************************
* analyze_hand: Determines whether the hand contains a *
* straight, a flush, four-of-a-kind, *
* and/or three-of-a-kind; determines the *
* number of pairs; stores the results into *
* the external variables straight, flush, *
* four, three, and pairs. *
**********************************************************/
void analyze_hand(void)
{
int rank, suit, card, pass, run;
straight = true;
flush = true;
four = false;
three = false;
pairs = 0;
/* sort cards by rank */
for (pass = 1; pass < NUM_CARDS; pass++)
for (card = 0; card < NUM_CARDS - pass; card++) {
rank = hand[card][RANK];
suit = hand[card][SUIT];
if (hand[card+1][RANK] < rank) {
hand[card][RANK] = hand[card+1][RANK];
hand[card][SUIT] = hand[card+1][SUIT];
hand[card+1][RANK] = rank;
hand[card+1][SUIT] = suit;
}
}
/* check for flush */
suit = hand[0][SUIT];
for (card = 1; card < NUM_CARDS; card++)
if (hand[card][SUIT] != suit)
flush = false;
/* check for straight */
for (card = 0; card < NUM_CARDS - 1; card++)
if (hand[card][RANK] + 1 != hand[card+1][RANK])
straight = false;
/* check for 4-of-a-kind, 3-of-a-kind, and pairs by
looking for "runs" of cards with identical ranks */
card = 0;
while (card < NUM_CARDS) {
rank = hand[card][RANK];
run = 0;
do {
run++;
card++;
} while (card < NUM_CARDS && hand[card][RANK] == rank);
switch (run) {
case 2: pairs++; break;
case 3: three = true; break;
case 4: four = true; break;
}
}
}
/**********************************************************
* print_result: Prints the classification of the hand, *
* based on the values of the external *
* variables straight, flush, four, three, *
* and pairs. *
**********************************************************/
void print_result(void)
{
if (straight && flush) printf("Straight flush");
else if (four) printf("Four of a kind");
else if (three &&
pairs == 1) printf("Full house");
else if (flush) printf("Flush");
else if (straight) printf("Straight");
else if (three) printf("Three of a kind");
else if (pairs == 2) printf("Two pairs");
else if (pairs == 1) printf("Pair");
else printf("High card");
printf("\n\n");
}
|
the_stack_data/71764.c | // #define _POSIX_C_SOURCE 200809L
#include <assert.h>
#include <ctype.h>
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <grp.h>
#include <locale.h>
#include <pwd.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <time.h>
#include <unistd.h>
#include <utime.h>
#define UNUSED(x) ((void) x)
/** @struct meta_struct
* @brief Strukture for metadata
* All ints are in base 8
* All empty space is filled with null
*/
typedef struct meta_struct
{
char filename[100]; /**< File/Folder name (0-100) */
char mode[8]; /**< Access rights (100-108) */
char owner_id[8]; /**< owner_ID (108-116) */
char group_id[8]; /**< group_ID (116-124) */
char size[12]; /**< File size (124-136) */
char mtime[12]; /**< Last modification date (136-148)*/
char checksum[8]; /**< Sum of metahead size for controll (148-156) */
char sign_type[1]; /**< Item type (156-157) */
char linked_file_name[100]; /**< Name of linked file(157-257) */
char magic_number[6]; /**< Magic number (257-263) */
char version[2]; /**< Version (263-265) */
char owner_name[32]; /**< String owner name (265-297) */
char group_name[32]; /**< String group name (297-329) */
char major[8]; /**< Major order number (329-337) */
char minor[8]; /**< Minor order number (337-345) */
char prefix[155]; /**< Prefix of file/folder name (345-600) */
} meta_struct;
int get_k_bits(int number, int k)
{
return (((1 << k) - 1) & (number));
}
void print_head(meta_struct *head)
{
assert(head);
printf("\n----------\n");
printf(" filename: '%s'\n", head->filename);
printf(" Mod: '%s'\n", head->mode);
printf(" Uid: '%s'\n", head->owner_id);
printf(" Gid: '%s'\n", head->group_id);
printf(" Size: '%s'\n", head->size);
printf(" Last_m: '%s'\n", head->mtime);
printf(" Sum: '%s'\n", head->checksum);
printf(" Type: '%c'\n", head->sign_type[0]);
printf(" Link_name '%s'\n", head->linked_file_name);
printf(" Magic: '%s'\n", head->magic_number);
printf(" Version: '%c%c'\n", head->version[0], head->version[1]);
printf(" O_name: '%s'\n", head->owner_name);
printf(" G_name: '%s'\n", head->group_name);
printf(" Major: '%s'\n", head->major);
printf(" Minor: '%s'\n", head->minor);
printf(" Prefix: '%s'\n", head->prefix);
printf("----------\n\n");
}
void free_and_err(char *error, meta_struct *x, FILE *f)
{
if (x != NULL) {
free(x);
x = NULL;
}
if (f != NULL) {
fclose(f);
f = NULL;
}
if (error != NULL) {
fprintf(stderr, "%s", error);
}
}
int sum_struct(meta_struct *meta)
{
int sum = 256;
char *met = (char *) meta;
size_t length = sizeof(*meta);
for (size_t i = 0; i < length; i++) {
if (i >= 148 && i <= 155) {
continue;
}
sum += met[i];
}
return sum;
}
void generate_prefix(char *prefix, meta_struct *x, char *name)
{
bool skip_first = false;
if (*name == '.') {
skip_first = true;
}
char *str = strdup(name);
char *token = strtok(str, "/");
int curr_length = 1;
while ((token != NULL)) {
curr_length += strlen(token) + 1;
if (!skip_first) {
strcat(prefix, "/");
}
skip_first = false;
strcat(prefix, token);
if ((strlen(name) - curr_length) <= 99) {
char *rest = strtok(NULL, "");
sprintf(x->filename, "%s", rest);
break;
}
token = strtok(NULL, "/");
}
free(str);
}
meta_struct *init_metadata(struct stat *stat, char *name, bool log)
{
char prefix[155] = { '\0' };
meta_struct *x = NULL;
int y = posix_memalign((void **) &x, 512, 512);
if (y != 0) {
free_and_err("Memory alloc failed", NULL, NULL);
return NULL;
}
memset(x, '\0', 512);
if (strlen(name) < 99) {
sprintf(x->filename, "%s", name);
} else {
generate_prefix(prefix, x, name);
sprintf(x->prefix, "%s", prefix);
}
sprintf(x->mode, "%07o", get_k_bits(stat->st_mode, 9));
sprintf(x->owner_id, "%07o", stat->st_uid); //if not uid not checked
sprintf(x->group_id, "%07o", stat->st_gid);
sprintf(x->size, "%011lo", (S_ISREG(stat->st_mode) ? stat->st_size : 0));
sprintf(x->mtime, "%011lo", stat->st_mtim.tv_sec);
sprintf(x->sign_type, "%c", (S_ISREG(stat->st_mode) ? '0' : '5'));
sprintf(x->magic_number, "%s", "ustar");
sprintf(x->version, "%c%c", '0', '0');
struct passwd *pw = getpwuid(stat->st_uid);
struct group *gr = getgrgid(stat->st_gid);
sprintf(x->owner_name, "%s", (pw != NULL) ? pw->pw_name : "");
sprintf(x->group_name, "%s", (gr != NULL) ? gr->gr_name : "");
sprintf(x->major, "%07d", 0);
sprintf(x->minor, "%07d", 0);
sprintf(x->checksum, "%06o", sum_struct(x));
x->checksum[7] = ' ';
if (log) {
print_head(x);
}
return x;
}
void append_footer(char *output)
{
FILE *target = fopen(output, "ab");
if (target == NULL) {
exit(EXIT_FAILURE);
}
for (size_t i = 0; i < 1024; i++) {
fputc('\0', target);
}
fclose(target);
}
void append_head(meta_struct *f, int target)
{
char *met = (char *) f;
write(target, met, 512);
}
bool append_file(meta_struct *f, char *output, char *path, bool only_head)
{
int source, target;
target = open(output, O_APPEND | O_CREAT | O_RDWR, 0666); //práva
if (target == -1) {
return false;
}
append_head(f, target);
if (only_head) {
close(target);
return true;
}
source = open(path, O_RDONLY);
if (source == -1) {
close(target);
return false;
}
int numr = 1;
char buffer[512];
int sum = 0;
while (1) {
numr = read(source, buffer, sizeof(buffer));
if (numr <= 0) {
break;
}
write(target, buffer, numr);
sum += numr;
}
while (sum % 512 != 0) {
write(target, "\0", 1);
sum++;
}
close(source);
close(target);
return true;
}
typedef enum node_type
{
data_file,
data_folder,
data_skip
} node_type;
node_type check_path_and_data(char *path, char *output_path, int *end_value, bool log)
{
struct stat st;
if (stat(path, &st) != 0) { //if link will check the file link points to
fprintf(stderr, "Filedoesnotexist: %s", path);
*end_value = 1;
return data_skip;
}
if (S_ISDIR(st.st_mode)) {
if (*(path + strlen(path) - 1) != '/') {
strcat(path, "/");
}
}
meta_struct *x = NULL;
x = init_metadata(&st, path, log);
if (S_ISREG(st.st_mode)) {
if (!append_file(x, output_path, path, false)) {
*end_value = 1;
}
free(x);
return data_file;
}
if (S_ISDIR(st.st_mode)) {
if (!append_file(x, output_path, NULL, true)) {
*end_value = 1;
}
free(x);
return data_folder;
}
free(x);
return data_skip;
}
void recursion(char *base_path, char *output_path, bool has_v, int *end_value, bool log)
{
if (strlen(base_path) > 248) {
fprintf(stderr, "Path is too long");
*end_value = 1;
return;
}
struct dirent **namelist;
int n = 0;
n = scandir(base_path, &namelist, NULL, alphasort);
if (n == -1) {
fprintf(stderr, "Failed scandir %s\n", base_path);
*end_value = 1;
return;
}
for (int i = 0; i < n; i++) {
char path[1000] = { '\0' };
if (strcmp(namelist[i]->d_name, ".") != 0 && strcmp(namelist[i]->d_name, "..") != 0) {
strcpy(path, base_path);
if (*(base_path + strlen(base_path) - 1) != '/') {
strcat(path, "/");
}
strcat(path, namelist[i]->d_name);
if (has_v) {
fprintf(stderr, "%s\n", path);
}
switch (check_path_and_data(path, output_path, end_value, log)) {
case data_folder:
recursion(path, output_path, has_v, end_value, log);
break;
case data_skip:
continue;
break;
case data_file:
break;
}
}
free(namelist[i]);
}
free(namelist);
}
static int cmpstringp(const void *p1, const void *p2)
{
return strcmp(*(char *const *) p1, *(char *const *) p2);
}
bool file_exists(char *filename)
{
struct stat buffer;
return (stat(filename, &buffer) == 0);
}
bool file_empty(char *filename)
{
struct stat buffer;
if (stat(filename, &buffer) != 0) {
fprintf(stderr, "File_Empty: Stat failed\n");
return false;
}
return (buffer.st_size <= 1);
}
bool file_only_null(char *file_path)
{
FILE *f = fopen(file_path, "rb");
if (f == NULL) {
fprintf(stderr, "File opening failed\n");
return false;
}
char c;
while ((c = fgetc(f)) != EOF) {
if (c != '\0') {
fclose(f);
return false;
}
}
fclose(f);
return true;
}
meta_struct *load_to_struct(char *str)
{
meta_struct *x = NULL;
int y = posix_memalign((void **) &x, 512, 512);
if (y != 0) {
free_and_err("Memory alloc failed", NULL, NULL);
return NULL;
}
char *met = (char *) x;
for (size_t i = 0; i < 512; i++) {
met[i] = str[i];
}
return x;
}
int make_whole_path(char *file_path, mode_t mode)
{
for (char *occurence = strchr(file_path + 1, '/'); occurence != NULL; occurence = strchr(occurence + 1, '/')) {
*occurence = '\0';
if (mkdir(file_path, mode) == -1) {
if (errno != EEXIST) {
*occurence = '/';
return -1;
}
}
*occurence = '/';
}
return 0;
}
bool check_string_only_null(char *str, int size)
{
for (int i = 0; i < size; i++) {
if (str[i] != '\0') {
return false;
}
}
return true;
}
bool file_unpacking(char *fullpath, char *buffer, struct utimbuf *new_times, meta_struct *x, FILE *f, mode_t mod_in_dec)
{
if (file_exists(fullpath)) {
fprintf(stderr, "Fileexists:");
return false;
}
FILE *curr = fopen(fullpath, "wb");
if (curr == NULL) {
if (errno == EEXIST) {
errno = 0;
return 1;
}
if (errno == 2) {
make_whole_path(fullpath, 511);
curr = fopen(fullpath, "wb");
if (curr == NULL) {
return 1;
}
}
}
chmod(fullpath, mod_in_dec);
int size_of_file = 0;
size_of_file = strtol(x->size, NULL, 8);
if (size_of_file != 0) {
while (1) {
if (512 != fread(buffer, sizeof(unsigned char), 512, f)) {
fclose(curr);
return false;
}
size_of_file -= 512;
if (size_of_file <= 0) {
break;
}
for (int i = 0; i < 512; i++) {
fputc(buffer[i], curr);
}
}
for (int i = 0; i < (512 + size_of_file); i++) {
fputc(buffer[i], curr);
}
}
fclose(curr);
utime(fullpath, new_times);
return true;
}
int unpack(char *tounpack, bool has_v, bool log)
{
bool wasmade = false;
FILE *f = fopen(tounpack, "rb");
meta_struct *x = NULL;
char buffer[512] = { '\0' };
while (fread(buffer, sizeof(char), 512, f) == 512) {
if (check_string_only_null(buffer, 512)) {
continue;
}
if (wasmade) {
free_and_err(NULL, x, NULL);
}
x = load_to_struct(buffer);
if (x == NULL) {
free_and_err("Failed to load struct\n", NULL, f);
return 1;
}
wasmade = true;
char fullpath[255] = { '\0' };
strcpy(fullpath, x->prefix);
strcat(fullpath, x->filename);
int checksum_int = strtol(x->checksum, NULL, 8);
if (sum_struct(x) != checksum_int) {
free_and_err("Checksum was not matching\n", x, f);
return 1;
}
if (log) {
print_head(x);
}
if (has_v) {
fprintf(stderr, "%s\n", fullpath);
}
int mod_in_dec = 0;
struct utimbuf new_times = { .actime = 0, .modtime = 0 };
if ((mod_in_dec = strtol(x->mode, NULL, 8)) == 0 || (new_times.modtime = strtol(x->mtime, NULL, 8)) == 0) {
free_and_err("Failed cnv str to int\n", x, f);
return 1;
}
if (x->sign_type[0] == '5') { //adresář
if (mkdir(fullpath, mod_in_dec) == -1) {
if (errno == EEXIST) {
errno = 0;
continue;
}
if (errno == 2) {
make_whole_path(fullpath, 511);
chmod(fullpath, mod_in_dec);
errno = 0;
continue;
}
free_and_err("Mkdir failed on directory\n", x, f);
return 1;
}
utime(fullpath, &new_times);
} else if (x->sign_type[0] == '0') { //soubor
if (!file_unpacking(fullpath, buffer, &new_times, x, f, mod_in_dec)) {
free_and_err("File unpacking failed\n", x, f);
return 1;
}
} else {
continue;
}
}
free_and_err(NULL, x, f);
return 0;
}
int main(int argc, char **argv)
{
if (argc < 3) {
fprintf(stderr, "Not enough arguments. Options are 'x','c','v' and 'l'\n");
return 1;
}
int end_value = 0;
bool has_c = strchr(argv[1], 'c') != NULL;
bool has_x = strchr(argv[1], 'x') != NULL;
bool has_v = (strchr(argv[1], 'v') != NULL);
bool log = (strchr(argv[1], 'l') != NULL);
if ((has_c && has_x) || (!has_c && !has_x)) {
fprintf(stderr, "Wrong arguments/argument combination\n");
return 1;
}
if (has_c) {
if (argc < 4) {
fprintf(stderr, "Not a single file for packing\n");
return 1;
}
char *output_path = argv[2];
if (file_exists(output_path)) {
fprintf(stderr, "Output file already exists\n");
return 1;
}
qsort(&argv[3], argc - 3, sizeof(char *), cmpstringp);
for (int i = 3; i < argc; i++) {
if (has_v) {
fprintf(stderr, "%s\n", argv[i]);
}
switch (check_path_and_data(argv[i], output_path, &end_value, log)) {
case data_folder:
recursion(argv[i], output_path, has_v, &end_value, false);
break;
case data_skip:
continue;
break;
case data_file:
break;
}
}
append_footer(output_path);
if (file_empty(argv[2]) || file_only_null(argv[2])) {
remove(argv[2]);
fprintf(stderr, "Created empty file\n");
end_value = 1;
}
// } else {
// convert_output(argv[2]);
// }
} else {
if (!file_exists(argv[2])) {
free_and_err("File does not exist\n", NULL, NULL);
return 1;
}
if (unpack(argv[2], has_v, log) != 0) {
return 1;
}
}
return end_value;
} |
the_stack_data/651298.c | #ifdef COMPILE_FOR_TEST
#include <assert.h>
#define assume(cond) assert(cond)
#endif
void main(int argc, char* argv[]) {
int x_0_0;//sh_buf.outcnt
int x_0_1;//sh_buf.outcnt
int x_0_2;//sh_buf.outcnt
int x_0_3;//sh_buf.outcnt
int x_0_4;//sh_buf.outcnt
int x_0_5;//sh_buf.outcnt
int x_1_0;//sh_buf.outbuf[0]
int x_1_1;//sh_buf.outbuf[0]
int x_2_0;//sh_buf.outbuf[1]
int x_2_1;//sh_buf.outbuf[1]
int x_3_0;//sh_buf.outbuf[2]
int x_3_1;//sh_buf.outbuf[2]
int x_4_0;//sh_buf.outbuf[3]
int x_4_1;//sh_buf.outbuf[3]
int x_5_0;//sh_buf.outbuf[4]
int x_5_1;//sh_buf.outbuf[4]
int x_6_0;//sh_buf.outbuf[5]
int x_7_0;//sh_buf.outbuf[6]
int x_8_0;//sh_buf.outbuf[7]
int x_9_0;//sh_buf.outbuf[8]
int x_10_0;//sh_buf.outbuf[9]
int x_11_0;//LOG_BUFSIZE
int x_11_1;//LOG_BUFSIZE
int x_12_0;//CREST_scheduler::lock_0
int x_12_1;//CREST_scheduler::lock_0
int x_12_2;//CREST_scheduler::lock_0
int x_12_3;//CREST_scheduler::lock_0
int x_12_4;//CREST_scheduler::lock_0
int x_13_0;//t3 T0
int x_14_0;//t2 T0
int x_15_0;//arg T0
int x_16_0;//functioncall::param T0
int x_16_1;//functioncall::param T0
int x_17_0;//buffered T0
int x_18_0;//functioncall::param T0
int x_18_1;//functioncall::param T0
int x_19_0;//functioncall::param T0
int x_19_1;//functioncall::param T0
int x_20_0;//functioncall::param T0
int x_20_1;//functioncall::param T0
int x_20_2;//functioncall::param T0
int x_20_3;//functioncall::param T0
int x_21_0;//functioncall::param T0
int x_21_1;//functioncall::param T0
int x_22_0;//direction T0
int x_23_0;//functioncall::param T0
int x_23_1;//functioncall::param T0
int x_24_0;//functioncall::param T0
int x_24_1;//functioncall::param T0
int x_25_0;//functioncall::param T0
int x_25_1;//functioncall::param T0
int x_26_0;//functioncall::param T0
int x_26_1;//functioncall::param T0
int x_27_0;//functioncall::param T0
int x_27_1;//functioncall::param T0
int x_28_0;//functioncall::param T0
int x_28_1;//functioncall::param T0
int x_29_0;//functioncall::param T0
int x_29_1;//functioncall::param T0
int x_30_0;//functioncall::param T0
int x_30_1;//functioncall::param T0
int x_31_0;//functioncall::param T0
int x_31_1;//functioncall::param T0
int x_32_0;//functioncall::param T0
int x_32_1;//functioncall::param T0
int x_33_0;//functioncall::param T0
int x_33_1;//functioncall::param T0
int x_34_0;//functioncall::param T0
int x_34_1;//functioncall::param T0
int x_35_0;//functioncall::param T1
int x_35_1;//functioncall::param T1
int x_36_0;//functioncall::param T1
int x_36_1;//functioncall::param T1
int x_37_0;//i T1
int x_37_1;//i T1
int x_37_2;//i T1
int x_38_0;//rv T1
int x_39_0;//rv T1
int x_40_0;//blocksize T1
int x_40_1;//blocksize T1
int x_41_0;//functioncall::param T1
int x_41_1;//functioncall::param T1
int x_41_2;//functioncall::param T1
int x_42_0;//apr_thread_mutex_lock::rv T1
int x_42_1;//apr_thread_mutex_lock::rv T1
int x_43_0;//functioncall::param T1
int x_43_1;//functioncall::param T1
int x_44_0;//status T1
int x_44_1;//status T1
int x_45_0;//functioncall::param T1
int x_45_1;//functioncall::param T1
int x_46_0;//functioncall::param T1
int x_46_1;//functioncall::param T1
int x_47_0;//functioncall::param T1
int x_47_1;//functioncall::param T1
int x_48_0;//functioncall::param T1
int x_48_1;//functioncall::param T1
int x_49_0;//functioncall::param T1
int x_49_1;//functioncall::param T1
int x_50_0;//functioncall::param T1
int x_50_1;//functioncall::param T1
int x_51_0;//functioncall::param T2
int x_51_1;//functioncall::param T2
int x_52_0;//functioncall::param T2
int x_52_1;//functioncall::param T2
int x_53_0;//i T2
int x_53_1;//i T2
int x_53_2;//i T2
int x_53_3;//i T2
int x_54_0;//rv T2
int x_55_0;//rv T2
int x_56_0;//blocksize T2
int x_56_1;//blocksize T2
int x_57_0;//functioncall::param T2
int x_57_1;//functioncall::param T2
int x_57_2;//functioncall::param T2
int x_58_0;//apr_thread_mutex_lock::rv T2
int x_58_1;//apr_thread_mutex_lock::rv T2
int x_59_0;//functioncall::param T2
int x_59_1;//functioncall::param T2
int x_60_0;//status T2
int x_60_1;//status T2
int x_61_0;//functioncall::param T2
int x_61_1;//functioncall::param T2
int x_62_0;//functioncall::param T2
int x_62_1;//functioncall::param T2
int x_63_0;//functioncall::param T2
int x_63_1;//functioncall::param T2
int x_64_0;//functioncall::param T2
int x_64_1;//functioncall::param T2
int x_65_0;//functioncall::param T2
int x_65_1;//functioncall::param T2
int x_65_2;//functioncall::param T2
int x_66_0;//functioncall::param T2
int x_66_1;//functioncall::param T2
int x_67_0;//functioncall::param T2
int x_67_1;//functioncall::param T2
int x_68_0;//functioncall::param T2
int x_68_1;//functioncall::param T2
T_0_0_0: x_0_0 = 0;
T_0_1_0: x_1_0 = 0;
T_0_2_0: x_2_0 = 0;
T_0_3_0: x_3_0 = 0;
T_0_4_0: x_4_0 = 0;
T_0_5_0: x_5_0 = 0;
T_0_6_0: x_6_0 = 0;
T_0_7_0: x_7_0 = 0;
T_0_8_0: x_8_0 = 0;
T_0_9_0: x_9_0 = 0;
T_0_10_0: x_10_0 = 0;
T_0_11_0: x_11_0 = 0;
T_0_12_0: x_13_0 = 316931840;
T_0_13_0: x_14_0 = 3710411360;
T_0_14_0: x_15_0 = 0;
T_0_15_0: x_16_0 = 406950260;
T_0_16_0: x_16_1 = -1;
T_0_17_0: x_17_0 = 0;
T_0_18_0: x_18_0 = 276775493;
T_0_19_0: x_18_1 = x_17_0;
T_0_20_0: x_19_0 = 1068776963;
T_0_21_0: x_19_1 = 97;
T_0_22_0: x_20_0 = 407769461;
T_0_23_0: x_20_1 = 0;
T_0_24_0: x_21_0 = 2114285640;
T_0_25_0: x_21_1 = 0;
T_0_26_0: x_22_0 = -584560576;
T_0_27_0: x_23_0 = 1082757166;
T_0_28_0: x_23_1 = x_22_0;
T_0_29_0: x_24_0 = 398522216;
T_0_30_0: x_24_1 = 0;
T_0_31_0: x_12_0 = -1;
T_0_32_0: x_0_1 = 5;
T_0_33_0: x_1_1 = 72;
T_0_34_0: x_2_1 = 69;
T_0_35_0: x_3_1 = 76;
T_0_36_0: x_4_1 = 76;
T_0_37_0: x_5_1 = 79;
T_0_38_0: x_25_0 = 577627825;
T_0_39_0: x_25_1 = 83;
T_0_40_0: x_26_0 = 1808340629;
T_0_41_0: x_26_1 = 1;
T_0_42_0: x_27_0 = 49453229;
T_0_43_0: x_27_1 = 1;
T_0_44_0: x_28_0 = 1881953124;
T_0_45_0: x_28_1 = 1;
T_0_46_0: x_29_0 = 1117098258;
T_0_47_0: x_29_1 = 82;
T_0_48_0: x_30_0 = 861156940;
T_0_49_0: x_30_1 = 90;
T_0_50_0: x_31_0 = 316718603;
T_0_51_0: x_31_1 = 1;
T_0_52_0: x_32_0 = 1159281935;
T_0_53_0: x_32_1 = 1;
T_0_54_0: x_33_0 = 1098796570;
T_0_55_0: x_33_1 = 2;
T_0_56_0: x_34_0 = 842227845;
T_0_57_0: x_34_1 = 2;
T_0_58_0: x_11_1 = 5;
T_2_59_2: x_51_0 = 1191986583;
T_2_60_2: x_51_1 = x_33_1;
T_2_61_2: x_52_0 = 1747359562;
T_2_62_2: x_52_1 = x_34_1;
T_2_63_2: x_53_0 = 0;
T_2_64_2: x_54_0 = 533897729;
T_1_65_1: x_35_0 = 1919710240;
T_1_66_1: x_35_1 = x_27_1;
T_1_67_1: x_36_0 = 2060092136;
T_1_68_1: x_36_1 = x_28_1;
T_1_69_1: x_37_0 = 0;
T_1_70_1: x_38_0 = 535998977;
T_2_71_2: if (x_0_1 + x_52_1 > x_11_1 && x_0_1 != 0) x_55_0 = -577493072;
T_2_72_2: if (x_0_1 + x_52_1 > x_11_1 && x_0_1 != 0 && x_18_1 != 0) x_56_0 = 11009;
T_2_73_2: if (x_0_1 + x_52_1 > x_11_1 && x_0_1 != 0 && x_18_1 != 0) x_57_0 = 2131982989;
T_2_74_2: if (x_0_1 + x_52_1 > x_11_1 && x_0_1 != 0 && x_18_1 != 0) x_57_1 = x_0_1;
T_2_75_2: if (x_0_1 + x_52_1 > x_11_1 && x_0_1 != 0 && x_18_1 != 0 && x_0_1 == x_57_1) x_58_0 = 0;
T_1_76_1: if (x_0_1 + x_36_1 > x_11_1 && x_0_1 != 0) x_39_0 = -577493072;
T_1_77_1: if (x_0_1 + x_36_1 > x_11_1 && x_0_1 != 0 && x_18_1 != 0) x_40_0 = 11009;
T_1_78_1: if (x_0_1 + x_52_1 > x_11_1 && x_0_1 != 0 && x_18_1 != 0 && x_0_1 == x_57_1 && 0 == x_12_0 + 1) x_12_1 = 2;
T_1_79_1: if (x_0_1 + x_52_1 > x_11_1 && x_0_1 != 0 && x_18_1 != 0 && x_0_1 == x_57_1 && 2 == x_12_1) x_58_1 = 0;
T_2_80_2: if (x_0_1 + x_52_1 > x_11_1 && x_0_1 != 0 && x_18_1 != 0 && 2 == x_12_1) x_59_0 = 1990578210;
T_2_81_2: if (x_0_1 + x_52_1 > x_11_1 && x_0_1 != 0 && x_18_1 != 0 && 2 == x_12_1) x_59_1 = 0;
T_2_82_2: if (x_0_1 + x_52_1 > x_11_1 && x_0_1 != 0 && x_18_1 != 0 && 0 == x_59_1 && 2 == x_12_1) x_56_1 = x_57_1;
T_2_83_2: if (x_0_1 + x_52_1 > x_11_1 && x_0_1 != 0 && x_18_1 != 0 && 0 == x_59_1 && 2 == x_12_1) x_20_2 = x_20_1 + x_56_1;
T_2_84_2: if (x_0_1 + x_52_1 > x_11_1 && x_0_1 != 0 && x_18_1 != 0 && 0 == x_59_1 && 2 == x_12_1) x_57_2 = -1*x_56_1 + x_57_1;
T_2_85_2: if (x_0_1 + x_52_1 > x_11_1 && x_0_1 != 0 && x_18_1 != 0 && x_57_2 <= 0 && 2 == x_12_1) x_60_0 = 0;
T_2_86_2: if (x_0_1 + x_52_1 > x_11_1 && x_0_1 != 0 && x_18_1 != 0 && x_57_2 <= 0 && 2 == x_12_1) x_12_2 = -1;
T_2_87_2: if (x_0_1 + x_36_1 > x_11_1 && x_0_1 != 0 && x_18_1 != 0) x_41_0 = 283621551;
T_2_88_2: if (x_0_1 + x_36_1 > x_11_1 && x_0_1 != 0 && x_18_1 != 0) x_41_1 = x_0_1;
T_2_89_2: if (x_0_1 + x_36_1 > x_11_1 && x_0_1 != 0 && x_18_1 != 0 && x_0_1 == x_41_1) x_42_0 = 0;
T_2_90_2: if (x_0_1 + x_36_1 > x_11_1 && x_0_1 != 0 && x_18_1 != 0 && x_0_1 == x_41_1 && 0 == x_12_2 + 1) x_12_3 = 1;
T_1_91_1: if (x_0_1 + x_36_1 > x_11_1 && x_0_1 != 0 && x_18_1 != 0 && x_0_1 == x_41_1 && 1 == x_12_3) x_42_1 = 0;
T_1_92_1: if (x_0_1 + x_36_1 > x_11_1 && x_0_1 != 0 && x_18_1 != 0 && 1 == x_12_3) x_43_0 = 1241365651;
T_1_93_1: if (x_0_1 + x_36_1 > x_11_1 && x_0_1 != 0 && x_18_1 != 0 && 1 == x_12_3) x_43_1 = 0;
T_1_94_1: if (x_0_1 + x_36_1 > x_11_1 && x_0_1 != 0 && x_18_1 != 0 && 0 == x_43_1 && 1 == x_12_3) x_40_1 = x_41_1;
T_1_95_1: if (x_0_1 + x_36_1 > x_11_1 && x_0_1 != 0 && x_18_1 != 0 && 0 == x_43_1 && 1 == x_12_3) x_20_3 = x_20_2 + x_40_1;
T_1_96_1: if (x_0_1 + x_36_1 > x_11_1 && x_0_1 != 0 && x_18_1 != 0 && 0 == x_43_1 && 1 == x_12_3) x_41_2 = -1*x_40_1 + x_41_1;
T_1_97_1: if (x_0_1 + x_36_1 > x_11_1 && x_0_1 != 0 && x_18_1 != 0 && x_41_2 <= 0 && 1 == x_12_3) x_44_0 = 0;
T_1_98_1: if (x_0_1 + x_36_1 > x_11_1 && x_0_1 != 0 && x_18_1 != 0 && x_41_2 <= 0 && 1 == x_12_3) x_12_4 = -1;
T_1_99_1: if (x_0_1 + x_36_1 > x_11_1 && x_0_1 != 0 && x_18_1 != 0 && x_41_2 <= 0) x_44_1 = 0;
T_1_100_1: if (x_0_1 + x_36_1 > x_11_1 && x_0_1 != 0) x_45_0 = 847630866;
T_1_101_1: if (x_0_1 + x_36_1 > x_11_1 && x_0_1 != 0) x_45_1 = x_43_1;
T_1_102_1: if (x_0_1 + x_36_1 > x_11_1 && x_0_1 != 0) x_46_0 = 521538327;
T_1_103_1: if (x_0_1 + x_36_1 > x_11_1 && x_0_1 != 0) x_46_1 = x_45_1;
T_1_104_1: if (x_0_1 + x_36_1 > x_11_1 && x_0_1 != 0) x_0_2 = 0;
T_1_105_1: if (x_36_1 < x_11_1) x_47_0 = 1859357355;
T_1_106_1: if (x_36_1 < x_11_1) x_47_1 = 47287053932288;
T_1_107_1: if (x_36_1 < x_11_1) x_48_0 = 26403182;
T_1_108_1: if (x_36_1 < x_11_1) x_48_1 = x_0_2 + x_36_1;
T_1_109_1: if (x_36_1 < x_11_1) x_37_1 = 0;
T_1_110_1: if (x_36_1 < x_11_1 && x_37_1 < x_35_1) x_49_0 = 161766701;
T_1_111_1: if (x_36_1 < x_11_1 && x_37_1 < x_35_1) x_49_1 = 47287053932288;
T_1_112_1: if (x_36_1 < x_11_1) x_37_2 = 1 + x_37_1;
T_1_113_1: if (x_36_1 < x_11_1) x_50_0 = 1151155200;
T_1_114_1: if (x_36_1 < x_11_1) x_50_1 = 47287053932288;
T_1_115_1: if (x_0_1 + x_52_1 > x_11_1 && x_0_1 != 0 && x_18_1 != 0 && x_57_2 <= 0) x_60_1 = 0;
T_1_116_1: if (x_0_1 + x_52_1 > x_11_1 && x_0_1 != 0) x_61_0 = 433353442;
T_1_117_1: if (x_0_1 + x_52_1 > x_11_1 && x_0_1 != 0) x_61_1 = x_59_1;
T_1_118_1: if (x_0_1 + x_52_1 > x_11_1 && x_0_1 != 0) x_62_0 = 438542194;
T_1_119_1: if (x_0_1 + x_52_1 > x_11_1 && x_0_1 != 0) x_62_1 = x_61_1;
T_1_120_1: if (x_0_1 + x_52_1 > x_11_1 && x_0_1 != 0) x_0_3 = 0;
T_2_121_2: if (x_52_1 < x_11_1) x_63_0 = 72448515;
T_2_122_2: if (x_52_1 < x_11_1) x_63_1 = 47287056033536;
T_2_123_2: if (x_36_1 < x_11_1) x_0_4 = x_0_2 + x_36_1;
T_2_124_2: if (x_52_1 < x_11_1) x_64_0 = 841122903;
T_2_125_2: if (x_52_1 < x_11_1) x_64_1 = x_0_3 + x_52_1;
T_2_126_2: if (x_52_1 < x_11_1) x_53_1 = 0;
T_2_127_2: if (x_52_1 < x_11_1 && x_53_1 < x_51_1) x_65_0 = 405344187;
T_1_128_1: if (x_52_1 < x_11_1 && x_53_1 < x_51_1) x_65_1 = 47287056033536;
T_2_129_2: if (x_52_1 < x_11_1) x_53_2 = 1 + x_53_1;
T_2_130_2: if (x_52_1 < x_11_1 && x_53_2 < x_51_1) x_65_2 = 47287056033536;
T_2_131_2: if (x_52_1 < x_11_1) x_53_3 = 1 + x_53_2;
T_2_132_2: if (x_52_1 < x_11_1) x_66_0 = 1155205682;
T_2_133_2: if (x_52_1 < x_11_1) x_66_1 = 47287056033536;
T_2_134_2: if (x_52_1 < x_11_1) x_0_5 = x_0_4 + x_52_1;
T_2_135_2: if (x_52_1 < x_11_1) x_67_0 = 1239645119;
T_2_136_2: if (x_52_1 < x_11_1) x_67_1 = 47287056033536;
T_2_137_2: if (x_52_1 < x_11_1) x_68_0 = 982972012;
T_2_138_2: if (x_52_1 < x_11_1) x_68_1 = 47287056033536;
T_2_139_2: if (x_52_1 < x_11_1) assert(x_0_5 == x_64_1);
}
|
the_stack_data/56022.c |
/* preprocessor test #5 */
#define t(x,y,z) x ## y ## z
int j[] = { t(1,2,3), t(,4,5), t(6,,7), t(8,9,),
t(10,,), t(,11,), t(,,12), t(,,) };
int e[] = { 123, 45, 67, 89, 10, 11, 12, };
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
unsigned char i;
int main(void)
{
for (i = 0; i < 7; ++i) {
printf("j: %d expect: %d\n", j[i], e[i]);
if (j[i] != e[i]) return EXIT_FAILURE;
}
printf("all fine\n");
return EXIT_SUCCESS;
}
|
the_stack_data/20449596.c | #include <stdio.h>
#include <string.h>
char x[1000], y[1000];
int c[1010][1010];
int max(int a, int b) { return a > b ? a : b; }
int main() {
int i, j, m, n;
while (~scanf("%s%s", x, y)) {
m = strlen(x);
n = strlen(y);
for (i = 0; i <= m; c[i++][0] = 0)
;
for (i = 1; i <= n; c[0][i++] = 0)
;
for (i = 1; i <= m; i++)
for (j = 1; j <= n; j++) {
if (x[i - 1] == y[j - 1])
c[i][j] = c[i - 1][j - 1] + 1;
else
c[i][j] = max(c[i - 1][j], c[i][j - 1]);
}
printf("%d\n", c[m][n]);
}
return 0;
} |
the_stack_data/1226961.c | /*
* COPYRIGHT
*
* fft - Takes the FFT of a data (time domain) file, and outputs to file
* the complex FFT data.
*
* Copyright (C) 2003, 2004, 2005 Exstrom Laboratories LLC
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* A copy of the GNU General Public License is available on the internet at:
*
* http://www.gnu.org/copyleft/gpl.html
*
* or you can write to:
*
* The Free Software Foundation, Inc.
* 675 Mass Ave
* Cambridge, MA 02139, USA
*
* You can contact Exstrom Laboratories LLC via Email at:
*
* info(AT)exstrom.com
*
* or you can write to:
*
* Exstrom Laboratories LLC
* P.O. Box 7651
* Longmont, CO 80501, USA
*
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#define MAXLINESIZE 128
void FFT( double *c, int N, int isign );
int main( int argc, char *argv[] )
{
FILE *fp;
char linebuff[MAXLINESIZE];
char *pchar;
int i, sp, np;
double *c;
if( argc < 5 )
{
printf("\n fft takes the FFT of a data (time domain) file, and outputs\n");
printf(" to file a three line header, followed by the complex fft data.\n");
printf(" All lines at top of input file starting with # are ignored.\n");
printf("\n Usage: fft sp np infile outfile\n");
printf(" sp = starting point (0 based)\n");
printf(" np = number of points to fft\n");
printf(" infile = input file name\n");
printf(" outfile = output file name\n");
return(-1);
}
fp = fopen(argv[3], "r");
if( fp == 0 )
{
perror( "Unable to open data file" );
return(-1);
}
sp = atoi( argv[1] );
np = atoi( argv[2] );
printf( "Reading data file: %s\n\n", argv[3] );
/* skip header */
for( i = 0; i < np; ++i )
{
fgets( linebuff, MAXLINESIZE, fp );
if( linebuff[0] != '#' ) break;
printf( "%s", linebuff );
}
/* skip sp lines of data (one line has already been read) */
for( i = 0; i < sp; ++i )
fgets( linebuff, MAXLINESIZE, fp );
c = (double *)malloc( 2 * np * sizeof(double) );
/* get the first number that's already in linebuff */
sscanf( linebuff, "%lf", &(c[0]) );
c[1] = 0.0;
for( i = 1; i < np; ++i )
{
fscanf( fp, "%lf", &(c[2*i]) );
c[2*i+1] = 0.0;
}
fclose( fp );
FFT( c, np, 1 );
printf( "Output file = %s\n", argv[4] );
fp = fopen(argv[4], "w");
if( fp == 0 )
{
perror( "Unable to open output file" );
return(-1);
}
fprintf( fp, "# %s :data file name\n", argv[3] );
fprintf( fp, "# %d :sp, starting pt in data file (zero based)\n", sp );
fprintf( fp, "# %d :np, number of points\n", np );
for( i = 0; i < np; ++i )
{
fprintf( fp, "%lf %lf\n", c[2*i], c[2*i+1] );
}
fclose( fp );
free( c );
}
/**********************************************************************
FFT - calculates the discrete fourier transform of an array of double
precision complex numbers using the FFT algorithm.
c = pointer to an array of size 2*N that contains the real and
imaginary parts of the complex numbers. The even numbered indices contain
the real parts and the odd numbered indices contain the imaginary parts.
c[2*k] = real part of kth data point.
c[2*k+1] = imaginary part of kth data point.
N = number of data points. The array, c, should contain 2*N elements
isign = 1 for forward FFT, -1 for inverse FFT.
*/
void FFT( double *c, int N, int isign )
{
int n, n2, nb, j, k, i0, i1;
double wr, wi, wrk, wik;
double d, dr, di, d0r, d0i, d1r, d1i;
double *cp;
j = 0;
n2 = N / 2;
for( k = 0; k < N; ++k )
{
if( k < j )
{
i0 = k << 1;
i1 = j << 1;
dr = c[i0];
di = c[i0+1];
c[i0] = c[i1];
c[i0+1] = c[i1+1];
c[i1] = dr;
c[i1+1] = di;
}
n = N >> 1;
while( (n >= 2) && (j >= n) )
{
j -= n;
n = n >> 1;
}
j += n;
}
for( n = 2; n <= N; n = n << 1 )
{
wr = cos( 2.0 * M_PI / n );
wi = sin( 2.0 * M_PI / n );
if( isign == 1 ) wi = -wi;
cp = c;
nb = N / n;
n2 = n >> 1;
for( j = 0; j < nb; ++j )
{
wrk = 1.0;
wik = 0.0;
for( k = 0; k < n2; ++k )
{
i0 = k << 1;
i1 = i0 + n;
d0r = cp[i0];
d0i = cp[i0+1];
d1r = cp[i1];
d1i = cp[i1+1];
dr = wrk * d1r - wik * d1i;
di = wrk * d1i + wik * d1r;
cp[i0] = d0r + dr;
cp[i0+1] = d0i + di;
cp[i1] = d0r - dr;
cp[i1+1] = d0i - di;
d = wrk;
wrk = wr * wrk - wi * wik;
wik = wr * wik + wi * d;
}
cp += n << 1;
}
}
}
|
the_stack_data/248579859.c | // RUN: %clang_cc1 -emit-pch -o %t1.pch %s
// RUN: %clang_cc1 -emit-pch -o %t2.pch %s
// RUN: %clang_cc1 %s -include-pch %t1.pch -include-pch %t2.pch -verify
#ifndef HEADER
#define HEADER
extern int x;
#else
#warning parsed this
// expected-warning@-1 {{parsed this}}
int foo() {
return x;
}
#endif
|
the_stack_data/91222.c | #include <stdio.h>
#include <stdbool.h>
struct Element {
double atomic_weight; // 8 byte
int atomic_number; // 4 byte
char name[2]; // char = 1byte -> 2byte
bool metallic; // 1 byte
};
int main() {
struct Element gold;
gold.name[0] = 'A';
gold.name[1] = 'u';
gold.atomic_number = 79;
gold.atomic_weight = 196.966569;
gold.metallic = true;
printf("Element struct is %d bytes\n", sizeof(struct Element));
printf("gold is at \t%p\n\n", &gold);
printf("name: \t\t%p; \nnumber: \t%p; \nweight: \t%p; \nmetallic: \t%p\n",
&gold.name, &gold.atomic_number, &gold.atomic_weight, &gold.metallic);
// What does gold look like in memory?
// How do each of the lines above know where their corresponding values are?
} |
the_stack_data/111897.c | #include<stdio.h>
#include<stdlib.h>
#include<time.h>
//Min heap is used in order to print array in decreasing order
void heapify(int a[],int n,int i)
{ int s,left,right,t;
s=i;
left=2*i+1;
right=2*i+2;
if(left<n && a[left]<a[s])
{ s=left;
}
if(right<n && a[right]<a[s])
{ s=right;
}
if(s!=i)
{ t=a[i];
a[i]=a[s];
a[s]=t;
heapify(a,n,s);
}
}
void heap_sort_decreasing(int a[],int n)
{ int i,t;
for(i=(n/2)-1;i>=0;--i)
{ heapify(a,n,i);
}
for(i=n-1;i>-0;--i)
{ t=a[0];
a[0]=a[i];
a[i]=t;
heapify(a,i,0);
}
}
int main()
{ int n,i;
clock_t t;
t=clock();
printf("enter the size of array\n");
scanf("%d",&n);
int a[n];
printf("enter the elements\n");
for(i=0;i<n;++i)
{ scanf("%d",&a[i]);
}
heap_sort_decreasing(a,n);
printf("\nSorted array is as follows....\n");
for(i=0;i<n;++i)
{ printf("%d\t",a[i]);
}
t=clock()-t;
double time_taken=((double)t)/CLOCKS_PER_SEC;
printf("\nTIME TAKEN: %f\n",time_taken);
return 0;
}
|
the_stack_data/650110.c | /*
* Copyright (c) 2019 Bose Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifdef CONFIG_BT_VCS
#include "bluetooth/audio/vcs.h"
#include "common.h"
extern enum bst_result_t bst_result;
#if defined(CONFIG_BT_VOCS)
#define VOCS_DESC_SIZE CONFIG_BT_VOCS_MAX_OUTPUT_DESCRIPTION_SIZE
#else
#define VOCS_DESC_SIZE 0
#endif /* CONFIG_BT_VOCS */
#if defined(CONFIG_BT_AICS)
#define AICS_DESC_SIZE CONFIG_BT_AICS_MAX_INPUT_DESCRIPTION_SIZE
#else
#define AICS_DESC_SIZE 0
#endif /* CONFIG_BT_AICS */
static struct bt_vcs *vcs;
static struct bt_vcs_included vcs_included;
static volatile uint8_t g_volume;
static volatile uint8_t g_mute;
static volatile uint8_t g_flags;
static volatile int16_t g_vocs_offset;
static volatile uint8_t g_vocs_location;
static char g_vocs_desc[VOCS_DESC_SIZE];
static volatile int8_t g_aics_gain;
static volatile uint8_t g_aics_input_mute;
static volatile uint8_t g_aics_mode;
static volatile uint8_t g_aics_input_type;
static volatile uint8_t g_aics_units;
static volatile uint8_t g_aics_gain_max;
static volatile uint8_t g_aics_gain_min;
static volatile bool g_aics_active = 1;
static char g_aics_desc[AICS_DESC_SIZE];
static volatile bool g_cb;
static struct bt_conn *g_conn;
static bool g_is_connected;
static void vcs_state_cb(struct bt_vcs *vcs, int err, uint8_t volume,
uint8_t mute)
{
if (err) {
FAIL("VCS state cb err (%d)", err);
return;
}
g_volume = volume;
g_mute = mute;
g_cb = true;
}
static void vcs_flags_cb(struct bt_vcs *vcs, int err, uint8_t flags)
{
if (err) {
FAIL("VCS flags cb err (%d)", err);
return;
}
g_flags = flags;
g_cb = true;
}
static void vocs_state_cb(struct bt_vocs *inst, int err, int16_t offset)
{
if (err) {
FAIL("VOCS state cb err (%d)", err);
return;
}
g_vocs_offset = offset;
g_cb = true;
}
static void vocs_location_cb(struct bt_vocs *inst, int err, uint32_t location)
{
if (err) {
FAIL("VOCS location cb err (%d)", err);
return;
}
g_vocs_location = location;
g_cb = true;
}
static void vocs_description_cb(struct bt_vocs *inst, int err,
char *description)
{
if (err) {
FAIL("VOCS description cb err (%d)", err);
return;
}
strncpy(g_vocs_desc, description, sizeof(g_vocs_desc) - 1);
g_vocs_desc[sizeof(g_vocs_desc) - 1] = '\0';
g_cb = true;
}
static void aics_state_cb(struct bt_aics *inst, int err, int8_t gain,
uint8_t mute, uint8_t mode)
{
if (err) {
FAIL("AICS state cb err (%d)", err);
return;
}
g_aics_gain = gain;
g_aics_input_mute = mute;
g_aics_mode = mode;
g_cb = true;
}
static void aics_gain_setting_cb(struct bt_aics *inst, int err, uint8_t units,
int8_t minimum, int8_t maximum)
{
if (err) {
FAIL("AICS gain setting cb err (%d)", err);
return;
}
g_aics_units = units;
g_aics_gain_min = minimum;
g_aics_gain_max = maximum;
g_cb = true;
}
static void aics_input_type_cb(struct bt_aics *inst, int err,
uint8_t input_type)
{
if (err) {
FAIL("AICS input type cb err (%d)", err);
return;
}
g_aics_input_type = input_type;
g_cb = true;
}
static void aics_status_cb(struct bt_aics *inst, int err, bool active)
{
if (err) {
FAIL("AICS status cb err (%d)", err);
return;
}
g_aics_active = active;
g_cb = true;
}
static void aics_description_cb(struct bt_aics *inst, int err,
char *description)
{
if (err) {
FAIL("AICS description cb err (%d)", err);
return;
}
strncpy(g_aics_desc, description, sizeof(g_aics_desc) - 1);
g_aics_desc[sizeof(g_aics_desc) - 1] = '\0';
g_cb = true;
}
static struct bt_vcs_cb vcs_cb = {
.state = vcs_state_cb,
.flags = vcs_flags_cb,
};
static struct bt_vocs_cb vocs_cb = {
.state = vocs_state_cb,
.location = vocs_location_cb,
.description = vocs_description_cb
};
static struct bt_aics_cb aics_cb = {
.state = aics_state_cb,
.gain_setting = aics_gain_setting_cb,
.type = aics_input_type_cb,
.status = aics_status_cb,
.description = aics_description_cb
};
static void connected(struct bt_conn *conn, uint8_t err)
{
char addr[BT_ADDR_LE_STR_LEN];
bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));
if (err) {
FAIL("Failed to connect to %s (%u)\n", addr, err);
return;
}
printk("Connected to %s\n", addr);
g_conn = conn;
g_is_connected = true;
}
static struct bt_conn_cb conn_callbacks = {
.connected = connected,
.disconnected = disconnected,
};
static int test_aics_standalone(void)
{
int err;
int8_t expected_gain;
uint8_t expected_input_mute;
uint8_t expected_mode;
uint8_t expected_input_type;
bool expected_aics_active;
char expected_aics_desc[AICS_DESC_SIZE];
printk("Deactivating AICS\n");
expected_aics_active = false;
err = bt_vcs_aics_deactivate(vcs, vcs_included.aics[0]);
if (err) {
FAIL("Could not deactivate AICS (err %d)\n", err);
return err;
}
WAIT_FOR(expected_aics_active == g_aics_active);
printk("AICS deactivated\n");
printk("Activating AICS\n");
expected_aics_active = true;
err = bt_vcs_aics_activate(vcs, vcs_included.aics[0]);
if (err) {
FAIL("Could not activate AICS (err %d)\n", err);
return err;
}
WAIT_FOR(expected_aics_active == g_aics_active);
printk("AICS activated\n");
printk("Getting AICS state\n");
g_cb = false;
err = bt_vcs_aics_state_get(vcs, vcs_included.aics[0]);
if (err) {
FAIL("Could not get AICS state (err %d)\n", err);
return err;
}
WAIT_FOR(g_cb);
printk("AICS state get\n");
printk("Getting AICS gain setting\n");
g_cb = false;
err = bt_vcs_aics_gain_setting_get(vcs, vcs_included.aics[0]);
if (err) {
FAIL("Could not get AICS gain setting (err %d)\n", err);
return err;
}
WAIT_FOR(g_cb);
printk("AICS gain setting get\n");
printk("Getting AICS input type\n");
expected_input_type = BT_AICS_INPUT_TYPE_DIGITAL;
err = bt_vcs_aics_type_get(vcs, vcs_included.aics[0]);
if (err) {
FAIL("Could not get AICS input type (err %d)\n", err);
return err;
}
/* Expect and wait for input_type from init */
WAIT_FOR(expected_input_type == g_aics_input_type);
printk("AICS input type get\n");
printk("Getting AICS status\n");
g_cb = false;
err = bt_vcs_aics_status_get(vcs, vcs_included.aics[0]);
if (err) {
FAIL("Could not get AICS status (err %d)\n", err);
return err;
}
WAIT_FOR(g_cb);
printk("AICS status get\n");
printk("Getting AICS description\n");
g_cb = false;
err = bt_vcs_aics_description_get(vcs, vcs_included.aics[0]);
if (err) {
FAIL("Could not get AICS description (err %d)\n", err);
return err;
}
WAIT_FOR(g_cb);
printk("AICS description get\n");
printk("Setting AICS mute\n");
expected_input_mute = BT_AICS_STATE_MUTED;
err = bt_vcs_aics_mute(vcs, vcs_included.aics[0]);
if (err) {
FAIL("Could not set AICS mute (err %d)\n", err);
return err;
}
WAIT_FOR(expected_input_mute == g_aics_input_mute);
printk("AICS mute set\n");
printk("Setting AICS unmute\n");
expected_input_mute = BT_AICS_STATE_UNMUTED;
err = bt_vcs_aics_unmute(vcs, vcs_included.aics[0]);
if (err) {
FAIL("Could not set AICS unmute (err %d)\n", err);
return err;
}
WAIT_FOR(expected_input_mute == g_aics_input_mute);
printk("AICS unmute set\n");
printk("Setting AICS auto mode\n");
expected_mode = BT_AICS_MODE_AUTO;
err = bt_vcs_aics_automatic_gain_set(vcs, vcs_included.aics[0]);
if (err) {
FAIL("Could not set AICS auto mode (err %d)\n", err);
return err;
}
WAIT_FOR(expected_mode == g_aics_mode);
printk("AICS auto mode set\n");
printk("Setting AICS manual mode\n");
expected_mode = BT_AICS_MODE_MANUAL;
err = bt_vcs_aics_manual_gain_set(vcs, vcs_included.aics[0]);
if (err) {
FAIL("Could not set AICS manual mode (err %d)\n", err);
return err;
}
WAIT_FOR(expected_mode == g_aics_mode);
printk("AICS manual mode set\n");
printk("Setting AICS gain\n");
expected_gain = g_aics_gain_max - 1;
err = bt_vcs_aics_gain_set(vcs, vcs_included.aics[0], expected_gain);
if (err) {
FAIL("Could not set AICS gain (err %d)\n", err);
return err;
}
WAIT_FOR(expected_gain == g_aics_gain);
printk("AICS gain set\n");
printk("Setting AICS Description\n");
strncpy(expected_aics_desc, "New Input Description",
sizeof(expected_aics_desc));
expected_aics_desc[sizeof(expected_aics_desc) - 1] = '\0';
g_cb = false;
err = bt_vcs_aics_description_set(vcs, vcs_included.aics[0],
expected_aics_desc);
if (err) {
FAIL("Could not set AICS Description (err %d)\n", err);
return err;
}
WAIT_FOR(g_cb && !strncmp(expected_aics_desc, g_aics_desc,
sizeof(expected_aics_desc)));
printk("AICS Description set\n");
return 0;
}
static int test_vocs_standalone(void)
{
int err;
uint8_t expected_location;
int16_t expected_offset;
char expected_description[VOCS_DESC_SIZE];
printk("Getting VOCS state\n");
g_cb = false;
err = bt_vcs_vocs_state_get(vcs, vcs_included.vocs[0]);
if (err) {
FAIL("Could not get VOCS state (err %d)\n", err);
return err;
}
WAIT_FOR(g_cb);
printk("VOCS state get\n");
printk("Getting VOCS location\n");
g_cb = false;
err = bt_vcs_vocs_location_get(vcs, vcs_included.vocs[0]);
if (err) {
FAIL("Could not get VOCS location (err %d)\n", err);
return err;
}
WAIT_FOR(g_cb);
printk("VOCS location get\n");
printk("Getting VOCS description\n");
g_cb = false;
err = bt_vcs_vocs_description_get(vcs, vcs_included.vocs[0]);
if (err) {
FAIL("Could not get VOCS description (err %d)\n", err);
return err;
}
WAIT_FOR(g_cb);
printk("VOCS description get\n");
printk("Setting VOCS location\n");
expected_location = g_vocs_location + 1;
err = bt_vcs_vocs_location_set(vcs, vcs_included.vocs[0],
expected_location);
if (err) {
FAIL("Could not set VOCS location (err %d)\n", err);
return err;
}
WAIT_FOR(expected_location == g_vocs_location);
printk("VOCS location set\n");
printk("Setting VOCS state\n");
expected_offset = g_vocs_offset + 1;
err = bt_vcs_vocs_state_set(vcs, vcs_included.vocs[0], expected_offset);
if (err) {
FAIL("Could not set VOCS state (err %d)\n", err);
return err;
}
WAIT_FOR(expected_offset == g_vocs_offset);
printk("VOCS state set\n");
printk("Setting VOCS description\n");
strncpy(expected_description, "New Output Description",
sizeof(expected_description) - 1);
expected_description[sizeof(expected_description) - 1] = '\0';
g_cb = false;
err = bt_vcs_vocs_description_set(vcs, vcs_included.vocs[0],
expected_description);
if (err) {
FAIL("Could not set VOCS description (err %d)\n", err);
return err;
}
WAIT_FOR(g_cb && !strncmp(expected_description, g_vocs_desc,
sizeof(expected_description)));
printk("VOCS description set\n");
return err;
}
static void test_standalone(void)
{
int err;
struct bt_vcs_register_param vcs_param;
char input_desc[CONFIG_BT_VCS_AICS_INSTANCE_COUNT][16];
char output_desc[CONFIG_BT_VCS_VOCS_INSTANCE_COUNT][16];
const uint8_t volume_step = 5;
uint8_t expected_volume;
uint8_t expected_mute;
err = bt_enable(NULL);
if (err) {
FAIL("Bluetooth init failed (err %d)\n", err);
return;
}
printk("Bluetooth initialized\n");
memset(&vcs_param, 0, sizeof(vcs_param));
for (int i = 0; i < ARRAY_SIZE(vcs_param.vocs_param); i++) {
vcs_param.vocs_param[i].location_writable = true;
vcs_param.vocs_param[i].desc_writable = true;
snprintf(output_desc[i], sizeof(output_desc[i]),
"Output %d", i + 1);
vcs_param.vocs_param[i].output_desc = output_desc[i];
vcs_param.vocs_param[i].cb = &vocs_cb;
}
for (int i = 0; i < ARRAY_SIZE(vcs_param.aics_param); i++) {
vcs_param.aics_param[i].desc_writable = true;
snprintf(input_desc[i], sizeof(input_desc[i]),
"Input %d", i + 1);
vcs_param.aics_param[i].description = input_desc[i];
vcs_param.aics_param[i].type = BT_AICS_INPUT_TYPE_DIGITAL;
vcs_param.aics_param[i].status = g_aics_active;
vcs_param.aics_param[i].gain_mode = BT_AICS_MODE_MANUAL;
vcs_param.aics_param[i].units = 1;
vcs_param.aics_param[i].min_gain = 0;
vcs_param.aics_param[i].max_gain = 100;
vcs_param.aics_param[i].cb = &aics_cb;
}
vcs_param.cb = &vcs_cb;
err = bt_vcs_register(&vcs_param, &vcs);
if (err) {
FAIL("VCS register failed (err %d)\n", err);
return;
}
err = bt_vcs_included_get(vcs, &vcs_included);
if (err) {
FAIL("VCS included get failed (err %d)\n", err);
return;
}
printk("VCS initialized\n");
printk("Setting VCS step\n");
err = bt_vcs_vol_step_set(volume_step);
if (err) {
FAIL("VCS step set failed (err %d)\n", err);
return;
}
printk("VCS step set\n");
printk("Getting VCS volume state\n");
g_cb = false;
err = bt_vcs_vol_get(vcs);
if (err) {
FAIL("Could not get VCS volume (err %d)\n", err);
return;
}
WAIT_FOR(g_cb);
printk("VCS volume get\n");
printk("Getting VCS flags\n");
g_cb = false;
err = bt_vcs_flags_get(vcs);
if (err) {
FAIL("Could not get VCS flags (err %d)\n", err);
return;
}
WAIT_FOR(g_cb);
printk("VCS flags get\n");
printk("Downing VCS volume\n");
expected_volume = g_volume - volume_step;
err = bt_vcs_vol_down(vcs);
if (err) {
FAIL("Could not get down VCS volume (err %d)\n", err);
return;
}
WAIT_FOR(expected_volume == g_volume || g_volume == 0);
printk("VCS volume downed\n");
printk("Upping VCS volume\n");
expected_volume = g_volume + volume_step;
err = bt_vcs_vol_up(vcs);
if (err) {
FAIL("Could not up VCS volume (err %d)\n", err);
return;
}
WAIT_FOR(expected_volume == g_volume || g_volume == UINT8_MAX);
printk("VCS volume upped\n");
printk("Muting VCS\n");
expected_mute = 1;
err = bt_vcs_mute(vcs);
if (err) {
FAIL("Could not mute VCS (err %d)\n", err);
return;
}
WAIT_FOR(expected_mute == g_mute);
printk("VCS muted\n");
printk("Downing and unmuting VCS\n");
expected_volume = g_volume - volume_step;
expected_mute = 0;
err = bt_vcs_unmute_vol_down(vcs);
if (err) {
FAIL("Could not down and unmute VCS (err %d)\n", err);
return;
}
WAIT_FOR((expected_volume == g_volume || g_volume == 0) &&
expected_mute == g_mute);
printk("VCS volume downed and unmuted\n");
printk("Muting VCS\n");
expected_mute = 1;
err = bt_vcs_mute(vcs);
if (err) {
FAIL("Could not mute VCS (err %d)\n", err);
return;
}
WAIT_FOR(expected_mute == g_mute);
printk("VCS muted\n");
printk("Upping and unmuting VCS\n");
expected_volume = g_volume + volume_step;
expected_mute = 0;
err = bt_vcs_unmute_vol_up(vcs);
if (err) {
FAIL("Could not up and unmute VCS (err %d)\n", err);
return;
}
WAIT_FOR((expected_volume == g_volume || g_volume == UINT8_MAX) &&
expected_mute == g_mute);
printk("VCS volume upped and unmuted\n");
printk("Muting VCS\n");
expected_mute = 1;
err = bt_vcs_mute(vcs);
if (err) {
FAIL("Could not mute VCS (err %d)\n", err);
return;
}
WAIT_FOR(expected_mute == g_mute);
printk("VCS volume upped\n");
printk("Unmuting VCS\n");
expected_mute = 0;
err = bt_vcs_unmute(vcs);
if (err) {
FAIL("Could not unmute VCS (err %d)\n", err);
return;
}
WAIT_FOR(expected_mute == g_mute);
printk("VCS volume unmuted\n");
expected_volume = g_volume - 5;
err = bt_vcs_vol_set(vcs, expected_volume);
if (err) {
FAIL("Could not set VCS volume (err %d)\n", err);
return;
}
WAIT_FOR(expected_volume == g_volume);
printk("VCS volume set\n");
if (CONFIG_BT_VCS_VOCS_INSTANCE_COUNT > 0) {
if (test_vocs_standalone()) {
return;
}
}
if (CONFIG_BT_VCS_AICS_INSTANCE_COUNT > 0) {
if (test_aics_standalone()) {
return;
}
}
PASS("VCS passed\n");
}
static void test_main(void)
{
int err;
struct bt_vcs_register_param vcs_param;
char input_desc[CONFIG_BT_VCS_AICS_INSTANCE_COUNT][16];
char output_desc[CONFIG_BT_VCS_VOCS_INSTANCE_COUNT][16];
err = bt_enable(NULL);
if (err) {
FAIL("Bluetooth init failed (err %d)\n", err);
return;
}
printk("Bluetooth initialized\n");
memset(&vcs_param, 0, sizeof(vcs_param));
for (int i = 0; i < ARRAY_SIZE(vcs_param.vocs_param); i++) {
vcs_param.vocs_param[i].location_writable = true;
vcs_param.vocs_param[i].desc_writable = true;
snprintf(output_desc[i], sizeof(output_desc[i]),
"Output %d", i + 1);
vcs_param.vocs_param[i].output_desc = output_desc[i];
vcs_param.vocs_param[i].cb = &vocs_cb;
}
for (int i = 0; i < ARRAY_SIZE(vcs_param.aics_param); i++) {
vcs_param.aics_param[i].desc_writable = true;
snprintf(input_desc[i], sizeof(input_desc[i]),
"Input %d", i + 1);
vcs_param.aics_param[i].description = input_desc[i];
vcs_param.aics_param[i].type = BT_AICS_INPUT_TYPE_DIGITAL;
vcs_param.aics_param[i].status = g_aics_active;
vcs_param.aics_param[i].gain_mode = BT_AICS_MODE_MANUAL;
vcs_param.aics_param[i].units = 1;
vcs_param.aics_param[i].min_gain = 0;
vcs_param.aics_param[i].max_gain = 100;
vcs_param.aics_param[i].cb = &aics_cb;
}
vcs_param.cb = &vcs_cb;
err = bt_vcs_register(&vcs_param, &vcs);
if (err) {
FAIL("VCS register failed (err %d)\n", err);
return;
}
bt_conn_cb_register(&conn_callbacks);
err = bt_vcs_included_get(vcs, &vcs_included);
if (err) {
FAIL("VCS included get failed (err %d)\n", err);
return;
}
printk("VCS initialized\n");
err = bt_le_adv_start(BT_LE_ADV_CONN_NAME, ad, AD_SIZE, NULL, 0);
if (err) {
FAIL("Advertising failed to start (err %d)\n", err);
return;
}
printk("Advertising successfully started\n");
WAIT_FOR(g_is_connected);
PASS("VCS passed\n");
}
static const struct bst_test_instance test_vcs[] = {
{
.test_id = "vcs_standalone",
.test_post_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_standalone
},
{
.test_id = "vcs",
.test_post_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_main
},
BSTEST_END_MARKER
};
struct bst_test_list *test_vcs_install(struct bst_test_list *tests)
{
return bst_add_tests(tests, test_vcs);
}
#else
struct bst_test_list *test_vcs_install(struct bst_test_list *tests)
{
return tests;
}
#endif /* CONFIG_BT_VCS */
|
the_stack_data/206393064.c | /* Generated by bin2c, do not edit manually */
/* Contents of file attention.raw */
const long int attention_raw_size = 9536;
const unsigned char attention_raw[9536] = {
0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00,
0xFF, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00,
0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF,
0xFF, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00,
0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0x00,
0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00,
0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0x00,
0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00,
0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00,
0xFF, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0x00, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00,
0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0xFF,
0x00, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF,
0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0xFF,
0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0xFF,
0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF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00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFE, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 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 0xFC, 0xFF,
0x02, 0x03, 0x03, 0x04, 0x06, 0x07, 0x08, 0x08, 0x08, 0x08, 0x09, 0x09, 0x08, 0x08, 0x07, 0x06,
0x06, 0x04, 0x04, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x03, 0x04, 0x04, 0x04,
0x05, 0x05, 0x05, 0x06, 0x07, 0x08, 0x09, 0x09, 0x09, 0x0A, 0x0A, 0x0A, 0x09, 0x09, 0x08, 0x08,
0x07, 0x05, 0x04, 0x02, 0x01, 0x00, 0xFE, 0xFC, 0xFA, 0xF8, 0xF6, 0xF4, 0xF1, 0xEE, 0xEC, 0xEA,
0xE9, 0xE8, 0xE7, 0xE6, 0xE7, 0xE8, 0xEA, 0xED, 0xF0, 0xF2, 0xF5, 0xF9, 0xFB, 0xFE, 0xFF, 0x01,
0x04, 0x06, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0C, 0x0C, 0x0C, 0x0B, 0x0B, 0x0A, 0x09, 0x08, 0x07,
0x06, 0x05, 0x05, 0x04, 0x04, 0x03, 0x03, 0x03, 0x02, 0x02, 0x03, 0x03, 0x03, 0x04, 0x04, 0x05,
0x06, 0x07, 0x07, 0x08, 0x08, 0x09, 0x09, 0x09, 0x09, 0x09, 0x08, 0x08, 0x07, 0x06, 0x04, 0x03,
0x01, 0x00, 0xFE, 0xFB, 0xF9, 0xF7, 0xF4, 0xF1, 0xEF, 0xEC, 0xEA, 0xE8, 0xE6, 0xE5, 0xE4, 0xE3,
0xE4, 0xE5, 0xE8, 0xEA, 0xED, 0xF0, 0xF4, 0xF8, 0xFC, 0xFF, 0x03, 0x06, 0x09, 0x0C, 0x0E, 0x10,
0x10, 0x11, 0x11, 0x11, 0x10, 0x0F, 0x0E, 0x0D, 0x0B, 0x09, 0x08, 0x06, 0x05, 0x04, 0x03, 0x02,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0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01, 0x02, 0x03, 0x03, 0x04, 0x04, 0x05, 0x06, 0x07, 0x07, 0x07, 0x08, 0x08, 0x08,
0x08, 0x07, 0x06, 0x06, 0x05, 0x03, 0x02, 0x00, 0xFF, 0xFD, 0xFB, 0xF9, 0xF7, 0xF5, 0xF3, 0xF1,
0xEF, 0xEE, 0xEC, 0xEC, 0xEB, 0xEB, 0xEB, 0xEB, 0xEC, 0xED, 0xEF, 0xF1, 0xF3, 0xF6, 0xF8, 0xFB,
0xFE, 0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0B, 0x0B, 0x0C, 0x0C, 0x0C, 0x0C, 0x0B, 0x0A, 0x09,
0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x03, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
0x02, 0x03, 0x03, 0x04, 0x04, 0x05, 0x05, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x06, 0x06,
0x05, 0x04, 0x03, 0x02, 0x00, 0xFF, 0xFD, 0xFC, 0xFA, 0xF8, 0xF7, 0xF5, 0xF3, 0xF1, 0xF0, 0xEE,
0xED, 0xED, 0xED, 0xED, 0xED, 0xEE, 0xEF, 0xF0, 0xF1, 0xF3, 0xF5, 0xF8, 0xFA, 0xFC, 0xFF, 0x01,
0x02, 0x04, 0x06, 0x07, 0x09, 0x0A, 0x0A, 0x0A, 0x0A, 0x0B, 0x0A, 0x0A, 0x09, 0x08, 0x08, 0x07,
0x06, 0x05, 0x05, 0x04, 0x04, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03,
0x03, 0x04, 0x04, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x05, 0x04, 0x03,
0x02, 0x01, 0x00, 0xFE, 0xFD, 0xFB, 0xFA, 0xF8, 0xF6, 0xF5, 0xF3, 0xF2, 0xF1, 0xEF, 0xEF, 0xEE,
0xEE, 0xEE, 0xEE, 0xEF, 0xF0, 0xF1, 0xF3, 0xF4, 0xF6, 0xF8, 0xFA, 0xFC, 0xFE, 0x00, 0x02, 0x03,
0x05, 0x06, 0x07, 0x08, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x08, 0x08, 0x07, 0x07, 0x06, 0x05,
0x05, 0x04, 0x04, 0x03, 0x03, 0x03, 0x03, 0x02, 0x02, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04,
0x04, 0x05, 0x05, 0x05, 0x05, 0x06, 0x06, 0x05, 0x05, 0x05, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00,
0xFF, 0xFE, 0xFC, 0xFB, 0xF9, 0xF8, 0xF6, 0xF5, 0xF3, 0xF2, 0xF1, 0xF1, 0xF0, 0xF0, 0xF0, 0xF0,
0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF6, 0xF8, 0xF9, 0xFB, 0xFD, 0xFF, 0x00, 0x02, 0x03, 0x04, 0x06,
0x06, 0x07, 0x07, 0x08, 0x08, 0x08, 0x08, 0x07, 0x07, 0x07, 0x06, 0x06, 0x05, 0x04, 0x04, 0x04,
0x03, 0x03, 0x03, 0x02, 0x02, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x05, 0x05,
0x05, 0x06, 0x06, 0x06, 0x06, 0x05, 0x05, 0x05, 0x04, 0x04, 0x03, 0x02, 0x01, 0x00, 0xFE, 0xFD,
0xFC, 0xFB, 0xF9, 0xF8, 0xF6, 0xF5, 0xF4, 0xF3, 0xF2, 0xF2, 0xF1, 0xF1, 0xF2, 0xF2, 0xF2, 0xF3,
0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xFA, 0xFB, 0xFD, 0xFE, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
0x06, 0x06, 0x06, 0x06, 0x07, 0x06, 0x06, 0x06, 0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x03, 0x03,
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x05, 0x05, 0x05, 0x05,
0x05, 0x05, 0x05, 0x05, 0x04, 0x04, 0x03, 0x03, 0x02, 0x01, 0x00, 0xFF, 0xFE, 0xFD, 0xFC, 0xFB,
0xFA, 0xF8, 0xF7, 0xF7, 0xF6, 0xF5, 0xF4, 0xF3, 0xF4, 0xF4, 0xF4, 0xF4, 0xF4, 0xF5, 0xF6, 0xF6,
0xF7, 0xF8, 0xF9, 0xFA, 0xFC, 0xFD, 0xFD, 0xFE, 0x00, 0x01, 0x02, 0x03, 0x03, 0x03, 0x04, 0x05,
0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x05, 0x05, 0x05, 0x04, 0x04,
0x04, 0x04, 0x03, 0x03, 0x02, 0x02, 0x01, 0x00, 0x00, 0xFF, 0xFE, 0xFD, 0xFC, 0xFB, 0xFA, 0xF9,
0xF8, 0xF8, 0xF7, 0xF6, 0xF6, 0xF6, 0xF6, 0xF6, 0xF6, 0xF6, 0xF6, 0xF7, 0xF7, 0xF8, 0xF9, 0xF9,
0xFA, 0xFB, 0xFC, 0xFC, 0xFD, 0xFE, 0xFF, 0xFF, 0x00, 0x01, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03,
0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x05, 0x04, 0x04, 0x04, 0x05, 0x05,
0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x02, 0x02,
0x01, 0x01, 0x00, 0x00, 0xFF, 0xFF, 0xFE, 0xFD, 0xFD, 0xFC, 0xFB, 0xFB, 0xFA, 0xFA, 0xF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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF,
0xFF, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF,
0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00,
0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00,
0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0x00,
0x00, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF,
0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00,
0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF,
0xFF, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0x00, 0xFF, 0x00,
0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00,
0xFF, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00,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, 0xFF, 0x00, 0xFF, 0x00,
0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF,
0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00,
0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00,
0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF,
0x00, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0xFF,
0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00,
0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF,
0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00
};
|
the_stack_data/11076363.c | /* Repro for NetBSD bug which makes all future mq_open()s fail with EMFILE even if none are open */
#include <mqueue.h>
#include <errno.h>
#include <stdio.h>
int main(void) {
mqd_t mq;
if (mq_unlink("/emfile") == -1) {
if (errno != ENOENT) {
perror("unlink");
return 1;
}
}
if ((mq = mq_open("/emfile", O_RDWR | O_CREAT, 0600, NULL)) == -1) {
perror("first open");
return 1;
}
if (mq_close(mq) == -1) {
perror("first close");
return 1;
}
if ((mq = mq_open("/emfile", O_RDWR | O_CREAT, 0600, NULL)) == -1) {
perror("second open");
return 1;
}
if (mq_close(mq) == -1) {
perror("second close");
return 1;
}
/* This fails with EMFILE */
if ((mq = mq_open("/emfile", O_RDWR | O_CREAT, 0600, NULL)) == -1) {
perror("third open");
return 1;
}
if (mq_close(mq) == -1) {
perror("third close");
return 1;
}
return 0;
}
|
the_stack_data/389989.c | int main(int argc, char *argv[]) {
return argc;
} |
the_stack_data/190767949.c | #include <stdio.h>
#include <string.h>
struct Books
{
char title[50];
char author[50];
char subject[100];
int book_id;
};
int main()
{
struct Books Book_1; /* 声明Book1,类型为Books */
struct Books Book_2; /* 声明Book2,类型为Books */
/* Book1 详述 */
strcpy(Book_1.title, "C Programming");
strcpy(Book_1.author, "Nuda Ali");
strcpy(Book_1.subject, "C Programming Tutorial");
Book_1.book_id = 6496548;
/* Book2 详述 */
strcpy(Book_2.title, "Telecom Billing");
strcpy(Book_2.author, "Zara Ali");
strcpy(Book_2.subject, "Telecom Billing Tutorial");
Book_2.book_id = 6488412;
/* 输出Book1 信息 */
printf("Book_1 title is %s\n", Book_1.title);
printf("Book_1 author is %s\n", Book_1.author);
printf("Book_1 subject is %s\n", Book_1.subject);
printf("Book_1 book_id is %d\n", Book_1.book_id);
/* 输出Book2 信息 */
printf("Book_2 title is %s\n", Book_2.title);
printf("Book_2 author is %s\n", Book_2.author);
printf("Book_2 subject is %s\n", Book_2.subject);
printf("Book_2 book_id is %d\n", Book_2.book_id);
return 0;
} |
the_stack_data/140757.c | int d = 72;
void MAIN()
{
float r;
d |= 70;
print("d 78");
printid(d);
}
|
the_stack_data/126702615.c | #include <stdio.h>
/*
* when const it doesn't crash
*/
static unsigned inputs[10][2][1] = {0};
/* static const unsigned inputs[10][2][1] = {0}; */
/*
* it falls through to a second safe()
* call and overflows the stack.
*/
static inline void broken(void) {
/* void broken(void) { */
for (int i = 0; i < 2; ++i) {
printf("broken: %d\n", i);
if (inputs[0][0][i])
return;
}
}
static inline void safe (void) {
/* void safe(void) { */
for (int i = 0; i < 2; ++i) {
if (inputs[0][0][i])
return;
printf("safe: %d\n", i);
}
}
/*
* gcc -O2 UB overealous optimizations
*
* "wtf where did ret go???"
*/
int main(void) {
safe();
broken();
return 0;
}
|
the_stack_data/629980.c | #include <math.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <complex.h>
#ifdef complex
#undef complex
#endif
#ifdef I
#undef I
#endif
#if defined(_WIN64)
typedef long long BLASLONG;
typedef unsigned long long BLASULONG;
#else
typedef long BLASLONG;
typedef unsigned long BLASULONG;
#endif
#ifdef LAPACK_ILP64
typedef BLASLONG blasint;
#if defined(_WIN64)
#define blasabs(x) llabs(x)
#else
#define blasabs(x) labs(x)
#endif
#else
typedef int blasint;
#define blasabs(x) abs(x)
#endif
typedef blasint integer;
typedef unsigned int uinteger;
typedef char *address;
typedef short int shortint;
typedef float real;
typedef double doublereal;
typedef struct { real r, i; } complex;
typedef struct { doublereal r, i; } doublecomplex;
#ifdef _MSC_VER
static inline _Fcomplex Cf(complex *z) {_Fcomplex zz={z->r , z->i}; return zz;}
static inline _Dcomplex Cd(doublecomplex *z) {_Dcomplex zz={z->r , z->i};return zz;}
static inline _Fcomplex * _pCf(complex *z) {return (_Fcomplex*)z;}
static inline _Dcomplex * _pCd(doublecomplex *z) {return (_Dcomplex*)z;}
#else
static inline _Complex float Cf(complex *z) {return z->r + z->i*_Complex_I;}
static inline _Complex double Cd(doublecomplex *z) {return z->r + z->i*_Complex_I;}
static inline _Complex float * _pCf(complex *z) {return (_Complex float*)z;}
static inline _Complex double * _pCd(doublecomplex *z) {return (_Complex double*)z;}
#endif
#define pCf(z) (*_pCf(z))
#define pCd(z) (*_pCd(z))
typedef int logical;
typedef short int shortlogical;
typedef char logical1;
typedef char integer1;
#define TRUE_ (1)
#define FALSE_ (0)
/* Extern is for use with -E */
#ifndef Extern
#define Extern extern
#endif
/* I/O stuff */
typedef int flag;
typedef int ftnlen;
typedef int ftnint;
/*external read, write*/
typedef struct
{ flag cierr;
ftnint ciunit;
flag ciend;
char *cifmt;
ftnint cirec;
} cilist;
/*internal read, write*/
typedef struct
{ flag icierr;
char *iciunit;
flag iciend;
char *icifmt;
ftnint icirlen;
ftnint icirnum;
} icilist;
/*open*/
typedef struct
{ flag oerr;
ftnint ounit;
char *ofnm;
ftnlen ofnmlen;
char *osta;
char *oacc;
char *ofm;
ftnint orl;
char *oblnk;
} olist;
/*close*/
typedef struct
{ flag cerr;
ftnint cunit;
char *csta;
} cllist;
/*rewind, backspace, endfile*/
typedef struct
{ flag aerr;
ftnint aunit;
} alist;
/* inquire */
typedef struct
{ flag inerr;
ftnint inunit;
char *infile;
ftnlen infilen;
ftnint *inex; /*parameters in standard's order*/
ftnint *inopen;
ftnint *innum;
ftnint *innamed;
char *inname;
ftnlen innamlen;
char *inacc;
ftnlen inacclen;
char *inseq;
ftnlen inseqlen;
char *indir;
ftnlen indirlen;
char *infmt;
ftnlen infmtlen;
char *inform;
ftnint informlen;
char *inunf;
ftnlen inunflen;
ftnint *inrecl;
ftnint *innrec;
char *inblank;
ftnlen inblanklen;
} inlist;
#define VOID void
union Multitype { /* for multiple entry points */
integer1 g;
shortint h;
integer i;
/* longint j; */
real r;
doublereal d;
complex c;
doublecomplex z;
};
typedef union Multitype Multitype;
struct Vardesc { /* for Namelist */
char *name;
char *addr;
ftnlen *dims;
int type;
};
typedef struct Vardesc Vardesc;
struct Namelist {
char *name;
Vardesc **vars;
int nvars;
};
typedef struct Namelist Namelist;
#define abs(x) ((x) >= 0 ? (x) : -(x))
#define dabs(x) (fabs(x))
#define f2cmin(a,b) ((a) <= (b) ? (a) : (b))
#define f2cmax(a,b) ((a) >= (b) ? (a) : (b))
#define dmin(a,b) (f2cmin(a,b))
#define dmax(a,b) (f2cmax(a,b))
#define bit_test(a,b) ((a) >> (b) & 1)
#define bit_clear(a,b) ((a) & ~((uinteger)1 << (b)))
#define bit_set(a,b) ((a) | ((uinteger)1 << (b)))
#define abort_() { sig_die("Fortran abort routine called", 1); }
#define c_abs(z) (cabsf(Cf(z)))
#define c_cos(R,Z) { pCf(R)=ccos(Cf(Z)); }
#ifdef _MSC_VER
#define c_div(c, a, b) {Cf(c)._Val[0] = (Cf(a)._Val[0]/Cf(b)._Val[0]); Cf(c)._Val[1]=(Cf(a)._Val[1]/Cf(b)._Val[1]);}
#define z_div(c, a, b) {Cd(c)._Val[0] = (Cd(a)._Val[0]/Cd(b)._Val[0]); Cd(c)._Val[1]=(Cd(a)._Val[1]/df(b)._Val[1]);}
#else
#define c_div(c, a, b) {pCf(c) = Cf(a)/Cf(b);}
#define z_div(c, a, b) {pCd(c) = Cd(a)/Cd(b);}
#endif
#define c_exp(R, Z) {pCf(R) = cexpf(Cf(Z));}
#define c_log(R, Z) {pCf(R) = clogf(Cf(Z));}
#define c_sin(R, Z) {pCf(R) = csinf(Cf(Z));}
//#define c_sqrt(R, Z) {*(R) = csqrtf(Cf(Z));}
#define c_sqrt(R, Z) {pCf(R) = csqrtf(Cf(Z));}
#define d_abs(x) (fabs(*(x)))
#define d_acos(x) (acos(*(x)))
#define d_asin(x) (asin(*(x)))
#define d_atan(x) (atan(*(x)))
#define d_atn2(x, y) (atan2(*(x),*(y)))
#define d_cnjg(R, Z) { pCd(R) = conj(Cd(Z)); }
#define r_cnjg(R, Z) { pCf(R) = conjf(Cf(Z)); }
#define d_cos(x) (cos(*(x)))
#define d_cosh(x) (cosh(*(x)))
#define d_dim(__a, __b) ( *(__a) > *(__b) ? *(__a) - *(__b) : 0.0 )
#define d_exp(x) (exp(*(x)))
#define d_imag(z) (cimag(Cd(z)))
#define r_imag(z) (cimagf(Cf(z)))
#define d_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x)))
#define r_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x)))
#define d_lg10(x) ( 0.43429448190325182765 * log(*(x)) )
#define r_lg10(x) ( 0.43429448190325182765 * log(*(x)) )
#define d_log(x) (log(*(x)))
#define d_mod(x, y) (fmod(*(x), *(y)))
#define u_nint(__x) ((__x)>=0 ? floor((__x) + .5) : -floor(.5 - (__x)))
#define d_nint(x) u_nint(*(x))
#define u_sign(__a,__b) ((__b) >= 0 ? ((__a) >= 0 ? (__a) : -(__a)) : -((__a) >= 0 ? (__a) : -(__a)))
#define d_sign(a,b) u_sign(*(a),*(b))
#define r_sign(a,b) u_sign(*(a),*(b))
#define d_sin(x) (sin(*(x)))
#define d_sinh(x) (sinh(*(x)))
#define d_sqrt(x) (sqrt(*(x)))
#define d_tan(x) (tan(*(x)))
#define d_tanh(x) (tanh(*(x)))
#define i_abs(x) abs(*(x))
#define i_dnnt(x) ((integer)u_nint(*(x)))
#define i_len(s, n) (n)
#define i_nint(x) ((integer)u_nint(*(x)))
#define i_sign(a,b) ((integer)u_sign((integer)*(a),(integer)*(b)))
#define pow_dd(ap, bp) ( pow(*(ap), *(bp)))
#define pow_si(B,E) spow_ui(*(B),*(E))
#define pow_ri(B,E) spow_ui(*(B),*(E))
#define pow_di(B,E) dpow_ui(*(B),*(E))
#define pow_zi(p, a, b) {pCd(p) = zpow_ui(Cd(a), *(b));}
#define pow_ci(p, a, b) {pCf(p) = cpow_ui(Cf(a), *(b));}
#define pow_zz(R,A,B) {pCd(R) = cpow(Cd(A),*(B));}
#define s_cat(lpp, rpp, rnp, np, llp) { ftnlen i, nc, ll; char *f__rp, *lp; ll = (llp); lp = (lpp); for(i=0; i < (int)*(np); ++i) { nc = ll; if((rnp)[i] < nc) nc = (rnp)[i]; ll -= nc; f__rp = (rpp)[i]; while(--nc >= 0) *lp++ = *(f__rp)++; } while(--ll >= 0) *lp++ = ' '; }
#define s_cmp(a,b,c,d) ((integer)strncmp((a),(b),f2cmin((c),(d))))
#define s_copy(A,B,C,D) { int __i,__m; for (__i=0, __m=f2cmin((C),(D)); __i<__m && (B)[__i] != 0; ++__i) (A)[__i] = (B)[__i]; }
#define sig_die(s, kill) { exit(1); }
#define s_stop(s, n) {exit(0);}
static char junk[] = "\n@(#)LIBF77 VERSION 19990503\n";
#define z_abs(z) (cabs(Cd(z)))
#define z_exp(R, Z) {pCd(R) = cexp(Cd(Z));}
#define z_sqrt(R, Z) {pCd(R) = csqrt(Cd(Z));}
#define myexit_() break;
#define mycycle() continue;
#define myceiling(w) {ceil(w)}
#define myhuge(w) {HUGE_VAL}
//#define mymaxloc_(w,s,e,n) {if (sizeof(*(w)) == sizeof(double)) dmaxloc_((w),*(s),*(e),n); else dmaxloc_((w),*(s),*(e),n);}
#define mymaxloc(w,s,e,n) {dmaxloc_(w,*(s),*(e),n)}
/* procedure parameter types for -A and -C++ */
#define F2C_proc_par_types 1
#ifdef __cplusplus
typedef logical (*L_fp)(...);
#else
typedef logical (*L_fp)();
#endif
static float spow_ui(float x, integer n) {
float pow=1.0; unsigned long int u;
if(n != 0) {
if(n < 0) n = -n, x = 1/x;
for(u = n; ; ) {
if(u & 01) pow *= x;
if(u >>= 1) x *= x;
else break;
}
}
return pow;
}
static double dpow_ui(double x, integer n) {
double pow=1.0; unsigned long int u;
if(n != 0) {
if(n < 0) n = -n, x = 1/x;
for(u = n; ; ) {
if(u & 01) pow *= x;
if(u >>= 1) x *= x;
else break;
}
}
return pow;
}
#ifdef _MSC_VER
static _Fcomplex cpow_ui(complex x, integer n) {
complex pow={1.0,0.0}; unsigned long int u;
if(n != 0) {
if(n < 0) n = -n, x.r = 1/x.r, x.i=1/x.i;
for(u = n; ; ) {
if(u & 01) pow.r *= x.r, pow.i *= x.i;
if(u >>= 1) x.r *= x.r, x.i *= x.i;
else break;
}
}
_Fcomplex p={pow.r, pow.i};
return p;
}
#else
static _Complex float cpow_ui(_Complex float x, integer n) {
_Complex float pow=1.0; unsigned long int u;
if(n != 0) {
if(n < 0) n = -n, x = 1/x;
for(u = n; ; ) {
if(u & 01) pow *= x;
if(u >>= 1) x *= x;
else break;
}
}
return pow;
}
#endif
#ifdef _MSC_VER
static _Dcomplex zpow_ui(_Dcomplex x, integer n) {
_Dcomplex pow={1.0,0.0}; unsigned long int u;
if(n != 0) {
if(n < 0) n = -n, x._Val[0] = 1/x._Val[0], x._Val[1] =1/x._Val[1];
for(u = n; ; ) {
if(u & 01) pow._Val[0] *= x._Val[0], pow._Val[1] *= x._Val[1];
if(u >>= 1) x._Val[0] *= x._Val[0], x._Val[1] *= x._Val[1];
else break;
}
}
_Dcomplex p = {pow._Val[0], pow._Val[1]};
return p;
}
#else
static _Complex double zpow_ui(_Complex double x, integer n) {
_Complex double pow=1.0; unsigned long int u;
if(n != 0) {
if(n < 0) n = -n, x = 1/x;
for(u = n; ; ) {
if(u & 01) pow *= x;
if(u >>= 1) x *= x;
else break;
}
}
return pow;
}
#endif
static integer pow_ii(integer x, integer n) {
integer pow; unsigned long int u;
if (n <= 0) {
if (n == 0 || x == 1) pow = 1;
else if (x != -1) pow = x == 0 ? 1/x : 0;
else n = -n;
}
if ((n > 0) || !(n == 0 || x == 1 || x != -1)) {
u = n;
for(pow = 1; ; ) {
if(u & 01) pow *= x;
if(u >>= 1) x *= x;
else break;
}
}
return pow;
}
static integer dmaxloc_(double *w, integer s, integer e, integer *n)
{
double m; integer i, mi;
for(m=w[s-1], mi=s, i=s+1; i<=e; i++)
if (w[i-1]>m) mi=i ,m=w[i-1];
return mi-s+1;
}
static integer smaxloc_(float *w, integer s, integer e, integer *n)
{
float m; integer i, mi;
for(m=w[s-1], mi=s, i=s+1; i<=e; i++)
if (w[i-1]>m) mi=i ,m=w[i-1];
return mi-s+1;
}
static inline void cdotc_(complex *z, integer *n_, complex *x, integer *incx_, complex *y, integer *incy_) {
integer n = *n_, incx = *incx_, incy = *incy_, i;
#ifdef _MSC_VER
_Fcomplex zdotc = {0.0, 0.0};
if (incx == 1 && incy == 1) {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc._Val[0] += conjf(Cf(&x[i]))._Val[0] * Cf(&y[i])._Val[0];
zdotc._Val[1] += conjf(Cf(&x[i]))._Val[1] * Cf(&y[i])._Val[1];
}
} else {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc._Val[0] += conjf(Cf(&x[i*incx]))._Val[0] * Cf(&y[i*incy])._Val[0];
zdotc._Val[1] += conjf(Cf(&x[i*incx]))._Val[1] * Cf(&y[i*incy])._Val[1];
}
}
pCf(z) = zdotc;
}
#else
_Complex float zdotc = 0.0;
if (incx == 1 && incy == 1) {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += conjf(Cf(&x[i])) * Cf(&y[i]);
}
} else {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += conjf(Cf(&x[i*incx])) * Cf(&y[i*incy]);
}
}
pCf(z) = zdotc;
}
#endif
static inline void zdotc_(doublecomplex *z, integer *n_, doublecomplex *x, integer *incx_, doublecomplex *y, integer *incy_) {
integer n = *n_, incx = *incx_, incy = *incy_, i;
#ifdef _MSC_VER
_Dcomplex zdotc = {0.0, 0.0};
if (incx == 1 && incy == 1) {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc._Val[0] += conj(Cd(&x[i]))._Val[0] * Cd(&y[i])._Val[0];
zdotc._Val[1] += conj(Cd(&x[i]))._Val[1] * Cd(&y[i])._Val[1];
}
} else {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc._Val[0] += conj(Cd(&x[i*incx]))._Val[0] * Cd(&y[i*incy])._Val[0];
zdotc._Val[1] += conj(Cd(&x[i*incx]))._Val[1] * Cd(&y[i*incy])._Val[1];
}
}
pCd(z) = zdotc;
}
#else
_Complex double zdotc = 0.0;
if (incx == 1 && incy == 1) {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += conj(Cd(&x[i])) * Cd(&y[i]);
}
} else {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += conj(Cd(&x[i*incx])) * Cd(&y[i*incy]);
}
}
pCd(z) = zdotc;
}
#endif
static inline void cdotu_(complex *z, integer *n_, complex *x, integer *incx_, complex *y, integer *incy_) {
integer n = *n_, incx = *incx_, incy = *incy_, i;
#ifdef _MSC_VER
_Fcomplex zdotc = {0.0, 0.0};
if (incx == 1 && incy == 1) {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc._Val[0] += Cf(&x[i])._Val[0] * Cf(&y[i])._Val[0];
zdotc._Val[1] += Cf(&x[i])._Val[1] * Cf(&y[i])._Val[1];
}
} else {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc._Val[0] += Cf(&x[i*incx])._Val[0] * Cf(&y[i*incy])._Val[0];
zdotc._Val[1] += Cf(&x[i*incx])._Val[1] * Cf(&y[i*incy])._Val[1];
}
}
pCf(z) = zdotc;
}
#else
_Complex float zdotc = 0.0;
if (incx == 1 && incy == 1) {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += Cf(&x[i]) * Cf(&y[i]);
}
} else {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += Cf(&x[i*incx]) * Cf(&y[i*incy]);
}
}
pCf(z) = zdotc;
}
#endif
static inline void zdotu_(doublecomplex *z, integer *n_, doublecomplex *x, integer *incx_, doublecomplex *y, integer *incy_) {
integer n = *n_, incx = *incx_, incy = *incy_, i;
#ifdef _MSC_VER
_Dcomplex zdotc = {0.0, 0.0};
if (incx == 1 && incy == 1) {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc._Val[0] += Cd(&x[i])._Val[0] * Cd(&y[i])._Val[0];
zdotc._Val[1] += Cd(&x[i])._Val[1] * Cd(&y[i])._Val[1];
}
} else {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc._Val[0] += Cd(&x[i*incx])._Val[0] * Cd(&y[i*incy])._Val[0];
zdotc._Val[1] += Cd(&x[i*incx])._Val[1] * Cd(&y[i*incy])._Val[1];
}
}
pCd(z) = zdotc;
}
#else
_Complex double zdotc = 0.0;
if (incx == 1 && incy == 1) {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += Cd(&x[i]) * Cd(&y[i]);
}
} else {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += Cd(&x[i*incx]) * Cd(&y[i*incy]);
}
}
pCd(z) = zdotc;
}
#endif
/* -- translated by f2c (version 20000121).
You must link the resulting object file with the libraries:
-lf2c -lm (in that order)
*/
/* Table of constant values */
static integer c__1 = 1;
/* > \brief \b DTRCON */
/* =========== DOCUMENTATION =========== */
/* Online html documentation available at */
/* http://www.netlib.org/lapack/explore-html/ */
/* > \htmlonly */
/* > Download DTRCON + dependencies */
/* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dtrcon.
f"> */
/* > [TGZ]</a> */
/* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dtrcon.
f"> */
/* > [ZIP]</a> */
/* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dtrcon.
f"> */
/* > [TXT]</a> */
/* > \endhtmlonly */
/* Definition: */
/* =========== */
/* SUBROUTINE DTRCON( NORM, UPLO, DIAG, N, A, LDA, RCOND, WORK, */
/* IWORK, INFO ) */
/* CHARACTER DIAG, NORM, UPLO */
/* INTEGER INFO, LDA, N */
/* DOUBLE PRECISION RCOND */
/* INTEGER IWORK( * ) */
/* DOUBLE PRECISION A( LDA, * ), WORK( * ) */
/* > \par Purpose: */
/* ============= */
/* > */
/* > \verbatim */
/* > */
/* > DTRCON estimates the reciprocal of the condition number of a */
/* > triangular matrix A, in either the 1-norm or the infinity-norm. */
/* > */
/* > The norm of A is computed and an estimate is obtained for */
/* > norm(inv(A)), then the reciprocal of the condition number is */
/* > computed as */
/* > RCOND = 1 / ( norm(A) * norm(inv(A)) ). */
/* > \endverbatim */
/* Arguments: */
/* ========== */
/* > \param[in] NORM */
/* > \verbatim */
/* > NORM is CHARACTER*1 */
/* > Specifies whether the 1-norm condition number or the */
/* > infinity-norm condition number is required: */
/* > = '1' or 'O': 1-norm; */
/* > = 'I': Infinity-norm. */
/* > \endverbatim */
/* > */
/* > \param[in] UPLO */
/* > \verbatim */
/* > UPLO is CHARACTER*1 */
/* > = 'U': A is upper triangular; */
/* > = 'L': A is lower triangular. */
/* > \endverbatim */
/* > */
/* > \param[in] DIAG */
/* > \verbatim */
/* > DIAG is CHARACTER*1 */
/* > = 'N': A is non-unit triangular; */
/* > = 'U': A is unit triangular. */
/* > \endverbatim */
/* > */
/* > \param[in] N */
/* > \verbatim */
/* > N is INTEGER */
/* > The order of the matrix A. N >= 0. */
/* > \endverbatim */
/* > */
/* > \param[in] A */
/* > \verbatim */
/* > A is DOUBLE PRECISION array, dimension (LDA,N) */
/* > The triangular matrix A. If UPLO = 'U', the leading N-by-N */
/* > upper triangular part of the array A contains the upper */
/* > triangular matrix, and the strictly lower triangular part of */
/* > A is not referenced. If UPLO = 'L', the leading N-by-N lower */
/* > triangular part of the array A contains the lower triangular */
/* > matrix, and the strictly upper triangular part of A is not */
/* > referenced. If DIAG = 'U', the diagonal elements of A are */
/* > also not referenced and are assumed to be 1. */
/* > \endverbatim */
/* > */
/* > \param[in] LDA */
/* > \verbatim */
/* > LDA is INTEGER */
/* > The leading dimension of the array A. LDA >= f2cmax(1,N). */
/* > \endverbatim */
/* > */
/* > \param[out] RCOND */
/* > \verbatim */
/* > RCOND is DOUBLE PRECISION */
/* > The reciprocal of the condition number of the matrix A, */
/* > computed as RCOND = 1/(norm(A) * norm(inv(A))). */
/* > \endverbatim */
/* > */
/* > \param[out] WORK */
/* > \verbatim */
/* > WORK is DOUBLE PRECISION array, dimension (3*N) */
/* > \endverbatim */
/* > */
/* > \param[out] IWORK */
/* > \verbatim */
/* > IWORK is INTEGER array, dimension (N) */
/* > \endverbatim */
/* > */
/* > \param[out] INFO */
/* > \verbatim */
/* > INFO is INTEGER */
/* > = 0: successful exit */
/* > < 0: if INFO = -i, the i-th argument had an illegal value */
/* > \endverbatim */
/* Authors: */
/* ======== */
/* > \author Univ. of Tennessee */
/* > \author Univ. of California Berkeley */
/* > \author Univ. of Colorado Denver */
/* > \author NAG Ltd. */
/* > \date December 2016 */
/* > \ingroup doubleOTHERcomputational */
/* ===================================================================== */
/* Subroutine */ int dtrcon_(char *norm, char *uplo, char *diag, integer *n,
doublereal *a, integer *lda, doublereal *rcond, doublereal *work,
integer *iwork, integer *info)
{
/* System generated locals */
integer a_dim1, a_offset, i__1;
doublereal d__1;
/* Local variables */
integer kase, kase1;
doublereal scale;
extern logical lsame_(char *, char *);
integer isave[3];
extern /* Subroutine */ int drscl_(integer *, doublereal *, doublereal *,
integer *);
doublereal anorm;
logical upper;
doublereal xnorm;
extern /* Subroutine */ int dlacn2_(integer *, doublereal *, doublereal *,
integer *, doublereal *, integer *, integer *);
extern doublereal dlamch_(char *);
integer ix;
extern integer idamax_(integer *, doublereal *, integer *);
extern /* Subroutine */ int xerbla_(char *, integer *, ftnlen);
extern doublereal dlantr_(char *, char *, char *, integer *, integer *,
doublereal *, integer *, doublereal *);
doublereal ainvnm;
extern /* Subroutine */ int dlatrs_(char *, char *, char *, char *,
integer *, doublereal *, integer *, doublereal *, doublereal *,
doublereal *, integer *);
logical onenrm;
char normin[1];
doublereal smlnum;
logical nounit;
/* -- LAPACK computational routine (version 3.7.0) -- */
/* -- LAPACK is a software package provided by Univ. of Tennessee, -- */
/* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- */
/* December 2016 */
/* ===================================================================== */
/* Test the input parameters. */
/* Parameter adjustments */
a_dim1 = *lda;
a_offset = 1 + a_dim1 * 1;
a -= a_offset;
--work;
--iwork;
/* Function Body */
*info = 0;
upper = lsame_(uplo, "U");
onenrm = *(unsigned char *)norm == '1' || lsame_(norm, "O");
nounit = lsame_(diag, "N");
if (! onenrm && ! lsame_(norm, "I")) {
*info = -1;
} else if (! upper && ! lsame_(uplo, "L")) {
*info = -2;
} else if (! nounit && ! lsame_(diag, "U")) {
*info = -3;
} else if (*n < 0) {
*info = -4;
} else if (*lda < f2cmax(1,*n)) {
*info = -6;
}
if (*info != 0) {
i__1 = -(*info);
xerbla_("DTRCON", &i__1, (ftnlen)6);
return 0;
}
/* Quick return if possible */
if (*n == 0) {
*rcond = 1.;
return 0;
}
*rcond = 0.;
smlnum = dlamch_("Safe minimum") * (doublereal) f2cmax(1,*n);
/* Compute the norm of the triangular matrix A. */
anorm = dlantr_(norm, uplo, diag, n, n, &a[a_offset], lda, &work[1]);
/* Continue only if ANORM > 0. */
if (anorm > 0.) {
/* Estimate the norm of the inverse of A. */
ainvnm = 0.;
*(unsigned char *)normin = 'N';
if (onenrm) {
kase1 = 1;
} else {
kase1 = 2;
}
kase = 0;
L10:
dlacn2_(n, &work[*n + 1], &work[1], &iwork[1], &ainvnm, &kase, isave);
if (kase != 0) {
if (kase == kase1) {
/* Multiply by inv(A). */
dlatrs_(uplo, "No transpose", diag, normin, n, &a[a_offset],
lda, &work[1], &scale, &work[(*n << 1) + 1], info);
} else {
/* Multiply by inv(A**T). */
dlatrs_(uplo, "Transpose", diag, normin, n, &a[a_offset], lda,
&work[1], &scale, &work[(*n << 1) + 1], info);
}
*(unsigned char *)normin = 'Y';
/* Multiply by 1/SCALE if doing so will not cause overflow. */
if (scale != 1.) {
ix = idamax_(n, &work[1], &c__1);
xnorm = (d__1 = work[ix], abs(d__1));
if (scale < xnorm * smlnum || scale == 0.) {
goto L20;
}
drscl_(n, &scale, &work[1], &c__1);
}
goto L10;
}
/* Compute the estimate of the reciprocal condition number. */
if (ainvnm != 0.) {
*rcond = 1. / anorm / ainvnm;
}
}
L20:
return 0;
/* End of DTRCON */
} /* dtrcon_ */
|
the_stack_data/232956965.c | /* Taxonomy Classification: 0000000000000142000300 */
/*
* WRITE/READ 0 write
* WHICH BOUND 0 upper
* DATA TYPE 0 char
* MEMORY LOCATION 0 stack
* SCOPE 0 same
* CONTAINER 0 no
* POINTER 0 no
* INDEX COMPLEXITY 0 constant
* ADDRESS COMPLEXITY 0 constant
* LENGTH COMPLEXITY 0 N/A
* ADDRESS ALIAS 0 none
* INDEX ALIAS 0 none
* LOCAL CONTROL FLOW 0 none
* SECONDARY CONTROL FLOW 1 if
* LOOP STRUCTURE 4 non-standard for
* LOOP COMPLEXITY 2 one
* ASYNCHRONY 0 no
* TAINT 0 no
* RUNTIME ENV. DEPENDENCE 0 no
* MAGNITUDE 3 4096 bytes
* CONTINUOUS/DISCRETE 0 discrete
* SIGNEDNESS 0 no
*/
/*
Copyright 2005 Massachusetts Institute of Technology
All rights reserved.
Redistribution and use of software in source and binary forms, with or without
modification, are permitted provided that the following conditions are met.
- Redistributions of source code must retain the above copyright notice,
this set of conditions and the disclaimer below.
- Redistributions in binary form must reproduce the copyright notice, this
set of conditions, and the disclaimer below in the documentation and/or
other materials provided with the distribution.
- Neither the name of the Massachusetts Institute of Technology nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS".
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
int main(int argc, char *argv[])
{
int init_value;
int loop_counter;
char buf[10];
init_value = 0;
loop_counter = init_value;
for( ; ; )
{
if (loop_counter > 4105) break;
/* BAD */
buf[4105] = 'A';
loop_counter++;
}
return 0;
}
|
the_stack_data/81378.c | #include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
char *P;
int A = 0;
int Qi = 0, Qx;
void gen(char *s) {
puts(s);
}
void gen2(char *s, int a) {
printf(s, a);
putchar('\n');
}
void synth(int i) {
int g;
g = isupper(Qx);
if (!Qi) gen("pop X");
switch (i) {
case '+': if (!Qi)
gen("addr X,A");
else if (g)
gen2("addg _%c,A", Qx);
else
gen2("addl _%c,A", Qx);
break;
case '*': if (!Qi)
gen("mulr X,A");
else if (g)
gen2("mulg _%c,A", Qx);
else
gen2("mull _%c,A", Qx);
break;
case '-': if (!Qi) {
gen("swap A,X");
gen("subr X,A");
}
else if (g)
gen2("subg _%c,A", Qx);
else
gen2("subl _%c,A", Qx);
break;
case '/': if (!Qi) {
gen("swap A,X");
gen("divr X,A");
}
else if (g)
gen2("divg _%c,A", Qx);
else
gen2("divl _%c,A", Qx);
break;
}
Qi = 0;
}
void load(void) {
if (A) gen("push A");
switch (Qi) {
case 'l': gen2("ll _%c,A", Qx);
break;
case 'g': gen2("lg _%c,A", Qx);
break;
}
Qi = 0;
A = 1;
}
void queue(int i, int x) {
if (Qi) load();
Qi = i;
Qx = x;
}
void emit(int i, int x) {
switch (i) {
case 'l':
case 'g': queue(i, x);
break;
case '_': load();
gen("neg A");
break;
default: synth(i);
break;
}
}
void skip(void) {
while (isspace(*P)) P++;
}
void factor(void) {
skip();
if ('-' == *P) {
P++;
factor();
emit('_', 0);
}
else if (isupper(*P))
emit('g', *P++);
else
emit('l', *P++);
}
void term(void) {
skip();
factor();
for (;;) {
skip();
switch (*P) {
case '*': P++;
factor();
emit('*', 0);
break;
case '/': P++;
factor();
emit('/', 0);
break;
default: return;
}
}
}
void sum(void) {
skip();
term();
for (;;) {
skip();
switch (*P) {
case '+': P++;
term();
emit('+', 0);
break;
case '-': P++;
term();
emit('-', 0);
break;
default: return;
}
}
}
void expr(char *s) {
P = s;
sum();
}
main(int argc, char **argv) {
expr(argc>1? argv[1]: "");
return EXIT_SUCCESS;
}
|
the_stack_data/115766758.c | #include<stdio.h>
#include<stdint.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<unistd.h>
#include<fcntl.h>
#include<stdlib.h>
#include<errno.h>
#define FU_TYPE 0x1f
void parse_nalu(uint8_t *all, int size, int *offset)
{
int i = 0;
int lastoffset = 0;
int curoffset = 0;
int curnalu_len = 0;
while(*offset < size)
{
if ( *(all + *offset) == 0x00 && *(all + *offset + 1) == 0x00 && *(all + *offset + 2) == 0x01)
{
curnalu_len = *offset - lastoffset;
printf("this is start code 2 offset = %d len = %d\n", *offset, curnalu_len);
(*offset)+=3;
lastoffset = *offset;
}
else if ( *(all + *offset) == 0x00 && *(all + *offset + 1) == 0x00 && *(all + *offset + 2) == 0x00 && *(all + *offset + 3) == 0x01)
{
curnalu_len = *offset - lastoffset;
curoffset = (*offset);
printf("this is start code 3 offset = %d len = %d\n", *offset, curnalu_len);
(*offset)+=4;
lastoffset = *offset;
}
else
{
(*offset)++;
}
// printf("offset = %d\n", *offset);
}
}
int main(int argc, char **argv)
{
struct stat attr;
stat(argv[1], &attr) ;
int fd = open(argv[1], O_RDONLY);
if (fd < 0)
{
printf("open failed\n");
return 0;
}
fstat(fd, &attr) ;
uint8_t *ptr = calloc(attr.st_size, 1);
int offset = 0;
int read_size= 0;
read_size = read(fd, ptr, attr.st_size);
printf("%d\n", read_size);
parse_nalu(ptr, attr.st_size, &offset);
}
|
the_stack_data/46178.c | // general protection fault in get_work_pool
// https://syzkaller.appspot.com/bug?id=18cfd49c158d37dd54481bd376cec513444cd571
// 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 <sched.h>
#include <signal.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mount.h>
#include <sys/prctl.h>
#include <sys/resource.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/time.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;
}
static void setup_common()
{
if (mount(0, "/sys/fs/fuse/connections", "fusectl", 0, 0)) {
}
}
static void loop();
static void sandbox_common()
{
prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0);
setpgrp();
setsid();
struct rlimit rlim;
rlim.rlim_cur = rlim.rlim_max = 160 << 20;
setrlimit(RLIMIT_AS, &rlim);
rlim.rlim_cur = rlim.rlim_max = 8 << 20;
setrlimit(RLIMIT_MEMLOCK, &rlim);
rlim.rlim_cur = rlim.rlim_max = 136 << 20;
setrlimit(RLIMIT_FSIZE, &rlim);
rlim.rlim_cur = rlim.rlim_max = 1 << 20;
setrlimit(RLIMIT_STACK, &rlim);
rlim.rlim_cur = rlim.rlim_max = 0;
setrlimit(RLIMIT_CORE, &rlim);
rlim.rlim_cur = rlim.rlim_max = 256;
setrlimit(RLIMIT_NOFILE, &rlim);
if (unshare(CLONE_NEWNS)) {
}
if (unshare(CLONE_NEWIPC)) {
}
if (unshare(0x02000000)) {
}
if (unshare(CLONE_NEWUTS)) {
}
if (unshare(CLONE_SYSVSEM)) {
}
}
int wait_for_loop(int pid)
{
if (pid < 0)
exit(1);
int status = 0;
while (waitpid(-1, &status, __WALL) != pid) {
}
return WEXITSTATUS(status);
}
static int do_sandbox_none(void)
{
if (unshare(CLONE_NEWPID)) {
}
int pid = fork();
if (pid != 0)
return wait_for_loop(pid);
setup_common();
sandbox_common();
if (unshare(CLONE_NEWNET)) {
}
loop();
exit(1);
}
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[2] = {0xffffffffffffffff, 0x0};
void execute_one(void)
{
long res = 0;
res = syscall(__NR_socket, 0x10, 3, 6);
if (res != -1)
r[0] = res;
*(uint64_t*)0x20000300 = 0x20000000;
*(uint16_t*)0x20000000 = 0x10;
*(uint16_t*)0x20000002 = 0;
*(uint32_t*)0x20000004 = 0;
*(uint32_t*)0x20000008 = 0;
*(uint32_t*)0x20000308 = 0xc;
*(uint64_t*)0x20000310 = 0x200002c0;
*(uint64_t*)0x200002c0 = 0x20000100;
*(uint64_t*)0x200002c8 = 1;
*(uint64_t*)0x20000318 = 1;
*(uint64_t*)0x20000320 = 0;
*(uint64_t*)0x20000328 = 0;
*(uint32_t*)0x20000330 = 0;
syscall(__NR_sendmsg, r[0], 0x20000300, 0);
*(uint32_t*)0x20000180 = 0x80;
res = syscall(__NR_getsockname, r[0], 0x20000540, 0x20000180);
if (res != -1)
r[1] = *(uint32_t*)0x20000544;
*(uint64_t*)0x20000500 = 0x200000c0;
*(uint16_t*)0x200000c0 = 0x10;
*(uint16_t*)0x200000c2 = 0;
*(uint32_t*)0x200000c4 = 0;
*(uint32_t*)0x200000c8 = 0x20000000;
*(uint32_t*)0x20000508 = 0xc;
*(uint64_t*)0x20000510 = 0x20000280;
*(uint64_t*)0x20000280 = 0x20000340;
*(uint32_t*)0x20000340 = 0x150;
*(uint16_t*)0x20000344 = 0x19;
*(uint16_t*)0x20000346 = 0x309;
*(uint32_t*)0x20000348 = 0x70bd26;
*(uint32_t*)0x2000034c = 0x25dfdbfe;
*(uint8_t*)0x20000350 = 0;
*(uint8_t*)0x20000351 = 0;
*(uint8_t*)0x20000352 = 0;
*(uint8_t*)0x20000353 = 0;
*(uint8_t*)0x20000354 = 0;
*(uint8_t*)0x20000355 = 0;
*(uint8_t*)0x20000356 = 0;
*(uint8_t*)0x20000357 = 0;
*(uint8_t*)0x20000358 = 0;
*(uint8_t*)0x20000359 = 0;
*(uint8_t*)0x2000035a = -1;
*(uint8_t*)0x2000035b = -1;
*(uint32_t*)0x2000035c = htobe32(0xe0000001);
*(uint64_t*)0x20000360 = htobe64(0);
*(uint64_t*)0x20000368 = htobe64(1);
*(uint16_t*)0x20000370 = htobe16(0x4e23);
*(uint16_t*)0x20000372 = htobe16(0xf11);
*(uint16_t*)0x20000374 = htobe16(0x4e20);
*(uint16_t*)0x20000376 = htobe16(0x1ff);
*(uint16_t*)0x20000378 = 0xa;
*(uint8_t*)0x2000037a = 0x20;
*(uint8_t*)0x2000037b = 0x80;
*(uint8_t*)0x2000037c = 0x2b;
*(uint32_t*)0x20000380 = r[1];
*(uint32_t*)0x20000384 = 0;
*(uint64_t*)0x20000388 = 0x6a;
*(uint64_t*)0x20000390 = 0xfffffffffffffff8;
*(uint64_t*)0x20000398 = 4;
*(uint64_t*)0x200003a0 = 8;
*(uint64_t*)0x200003a8 = 0x200000;
*(uint64_t*)0x200003b0 = 1;
*(uint64_t*)0x200003b8 = 0x17c;
*(uint64_t*)0x200003c0 = -1;
*(uint64_t*)0x200003c8 = 9;
*(uint64_t*)0x200003d0 = 0xc3ef;
*(uint64_t*)0x200003d8 = 4;
*(uint64_t*)0x200003e0 = 0x400;
*(uint32_t*)0x200003e8 = 0;
*(uint32_t*)0x200003ec = 0x6e6bb6;
*(uint8_t*)0x200003f0 = 2;
*(uint8_t*)0x200003f1 = 1;
*(uint8_t*)0x200003f2 = 0;
*(uint8_t*)0x200003f3 = 0;
*(uint16_t*)0x200003f8 = 0x48;
*(uint16_t*)0x200003fa = 3;
memcpy((void*)0x200003fc,
"\x64\x65\x66\x6c\x61\x74\x65\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
64);
*(uint32_t*)0x2000043c = 0;
*(uint16_t*)0x20000440 = 0x48;
*(uint16_t*)0x20000442 = 3;
memcpy((void*)0x20000444,
"\x6c\x7a\x6a\x68\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
64);
*(uint32_t*)0x20000484 = 0;
*(uint16_t*)0x20000488 = 8;
*(uint16_t*)0x2000048a = 0x16;
*(uint32_t*)0x2000048c = 8;
*(uint64_t*)0x20000288 = 0x150;
*(uint64_t*)0x20000518 = 1;
*(uint64_t*)0x20000520 = 0;
*(uint64_t*)0x20000528 = 0;
*(uint32_t*)0x20000530 = 0x880;
syscall(__NR_sendmsg, r[0], 0x20000500, 0xc800);
}
int main(void)
{
syscall(__NR_mmap, 0x20000000, 0x1000000, 3, 0x32, -1, 0);
for (procid = 0; procid < 8; procid++) {
if (fork() == 0) {
do_sandbox_none();
}
}
sleep(1000000);
return 0;
}
|
the_stack_data/666484.c | #include <stdio.h>
int main(int argc, char *argv[])
{
for (int i=0; i<argc; i++) {
printf("%d: %s\n", i, argv[i]);
}
return 0;
} |
the_stack_data/93886636.c | #include <stdlib.h>
struct tiny
{
char c;
char d;
};
void f (int n, struct tiny x, struct tiny y, struct tiny z, long l)
{
if (x.c != 10)
abort();
if (x.d != 20)
abort();
if (y.c != 11)
abort();
if (y.d != 21)
abort();
if (z.c != 12)
abort();
if (z.d != 22)
abort();
if (l != 123)
abort ();
}
int main ()
{
struct tiny x[3];
x[0].c = 10;
x[1].c = 11;
x[2].c = 12;
x[0].d = 20;
x[1].d = 21;
x[2].d = 22;
f (3, x[0], x[1], x[2], (long) 123);
exit(0);
}
|
the_stack_data/154831562.c | #include <math.h>
#include <time.h>
#include <stdlib.h>
#include <stdint.h>
#if defined(OS_WINDOWS) || defined(_WIN32) || defined(_WIN64)
#include <windows.h>
int read_random(void* ptr, int bytes)
{
HCRYPTPROV provider;
if (!CryptAcquireContext(&provider, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT))
return 0;
CryptGenRandom(provider, bytes, (PBYTE)ptr);
CryptReleaseContext(provider, 0);
return bytes;
}
#elif defined(OS_LINUX) || defined(OS_MAC)
#include <stdio.h>
static int read_random_file(const char *file, void* ptr, int bytes)
{
int n;
FILE* fp;
fp = fopen(file, "rb");
if (NULL == fp)
return -1;
n = fread(ptr, bytes, 1, fp);
fclose(fp);
return n;
}
int read_random(void* ptr, int bytes)
{
int r;
r = read_random_file("/dev/urandom", ptr, bytes);
if (-1 == r)
r = read_random_file("/dev/random", ptr, bytes);
return r;
}
#else
int read_random(void* ptr, int bytes)
{
int i, v;
for(i = 0; i < bytes / sizeof(int); i++)
{
v = rand();
memcpy((char*)ptr + i * sizeof(int), &v, sizeof(int));
}
if(0 != bytes % sizeof(int))
{
v = rand();
memcpy((char*)ptr + i * sizeof(int), &v, bytes % sizeof(int));
}
return bytes;
}
#endif
|
the_stack_data/76701508.c | #include <stdio.h>
/***********************************************************************
* Name(s) Justin Chen *
* Box(s): 3293 *
* Assignment name: Problem 2: Credit Card Comparison *
* (25% off if name/number does not match assignment) *
* Assignment for <8/05/18> *
***********************************************************************/
/* *********************************************************************
* Academic honesty certification: *
* Help obtained *
* Shelby *
* My/our signature(s) below confirms that the above list of sources *
* is complete AND that I/we have not talked to anyone else *
* (e.g., CSC 161 students) about the solution to this problem *
* *
* Signature: *
***********************************************************************/
// Caulate the new balance
double calc_balance(double old_balance, double interest, double payment){
double new_balance = 0.0;
new_balance = old_balance - payment + (interest *(old_balance - payment));
return new_balance;
}
int main(){
double total_budget = 0.0;
double min_pay = 0.0;
double interest1 = 0;
double annual_fee1 = 0.0;
double interest_percent1 = 0.0;
double interest2 = 0;
double annual_fee2 = 0.0;
double interest_percent2 = 0.0;
int month = 1;
double balance1 = 0.0;
double balance2 = 0.0;
double new_balance1 = 0.0;
double new_balance2 = 0.0;
double total_pay1 = 0.0;
double total_pay2 = 0.0;
// Ask user to input the budget of the trip
printf("What is the budget amount for your trip: ");
scanf("%lf", &total_budget);
// Ask the user to input the minimun pay
printf("What is the minimun monthly payment: ");
scanf("%lf", &min_pay);
// Ask for the annual fee for card#1 if none ask user to input 0.00
printf("Enter annual fee for card#1 (enter 0.00 if there is none): ");
scanf("%lf", &annual_fee1);
balance1 = balance1 + annual_fee1;
// Ask user to enter the annual inerest rate for card#1 and ask user to input interger
printf("Enter the annual interest rate for card#1 (please enter a interger): ");
scanf("%lf", &interest1);
// Caulate the percent of the interest
interest_percent1 = interest1 / 100.0;
interest_percent1 = interest_percent1 / 12.0;
// Ask for the annual fee for card#2 if none ask user to input 0.00
printf("Enter annual fee for card#2 (enter 0.00 if there is none): ");
scanf("%lf", &annual_fee2);
balance2 = balance2 + annual_fee2;
// Ask user to enter the annual inerest rate for card#2 and ask user to input interger
printf("Enter the annual inerest rate for card#2 (please enter a interger): ");
scanf("%lf", &interest2);
// Caulate the percent of the interest
interest_percent2 = interest2 / 100;
interest_percent2 = interest_percent2 / 12.0;
balance1 = total_budget + annual_fee1;
balance2 = total_budget + annual_fee2;
printf("Starting balances \n");
printf("Card 1: %.2lf , Card2: %.2lf \n", balance1, balance2);
printf("Month card#1 card#2 \n");
total_pay1 = total_pay1 + min_pay;
total_pay2 = total_pay2 + min_pay;
int zero = 0;
if (min_pay == 0){
printf("%4d %9.2lf %9.2lf \n", month, zero, zero);
}else{
// Print the comparison table out
while((balance1 > 0.00)||(balance2 > 0.00)){
// annual fee at the end of the year
if((month%12) == 0){
balance1 = balance1 + annual_fee1;
balance2 = balance2 + annual_fee2;
total_pay1 = total_pay1 + annual_fee1;
total_pay2 = total_pay2 + annual_fee2;
}
new_balance1 = calc_balance(balance1,interest_percent1, min_pay);
new_balance2 = calc_balance(balance2,interest_percent2, min_pay);
balance1 = new_balance1;
balance2 = new_balance2;
//keep tracking of total pay
if(balance1 > 0){
total_pay1 = total_pay1 + min_pay;
}
if(balance2 > 0){
total_pay2 = total_pay2 + min_pay;
}
// if balance is less than zero set the balances to zero
if(balance1 < 0){
total_pay1 = total_pay1 + new_balance1;
new_balance1 = new_balance1 - new_balance1;
}
if(balance2 < 0){
total_pay2 = total_pay2 + new_balance2;
new_balance2 = new_balance2 - new_balance2;
}
printf("%4d %9.2lf %9.2lf \n", month, new_balance1, new_balance2);
month++;
}
printf("Cost comparison summary \n");
printf("Card 1 total of payments: %.2lf \n", total_pay1);
printf("Card 2 total of payments: %.2lf \n", total_pay2);
// Comparing card#1 and card#2
if (total_pay1 < total_pay2){
printf("Card 1 is the better deal. Annual fee: %.2lf and the annual interest rate: %.2lf \n", annual_fee1, interest1);
} else{
printf("Card 2 is the better deal. Annual fee: %.2lf and the annual interest rate: %.2lf \n", annual_fee2, interest2);
}
}
}
|
the_stack_data/1133.c | // Copyright 2013 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Prints out the distance between input vector and output vectors for a given word.
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
const long long max_size = 2000; // max length of strings
const long long N = 40; // number of closest words that will be shown
const long long max_w = 50; // max length of vocabulary entries
int main(int argc, char **argv) {
FILE *f;
char st1[max_size];
char *bestw[N];
char file_name[max_size], st[100][max_size];
float dist, len, bestd[N], vec[max_size];
// size is the size of the hidden layer
long long words, size, a, b, c, d, cn, bi[100];
char ch;
float *M;
float *Mneg;
char *vocab;
if (argc < 2) {
printf("Usage: ./distance-io <FILE>\nwhere FILE contains word projections in the BINARY FORMAT\n");
return 0;
}
strcpy(file_name, argv[1]);
f = fopen(file_name, "rb");
if (f == NULL) {
printf("Input file not found\n");
return -1;
}
fscanf(f, "%lld", &words);
fscanf(f, "%lld", &size);
vocab = (char *)malloc((long long)words * max_w * sizeof(char));
for (a = 0; a < N; a++) bestw[a] = (char *)malloc(max_size * sizeof(char));
M = (float *)malloc((long long)words * (long long)size * sizeof(float));
if (M == NULL) {
printf("M: Cannot allocate memory: %lld MB %lld %lld\n", (long long)words * size * sizeof(float) / 1048576, words, size);
return -1;
}
Mneg = (float *)malloc((long long)words * (long long)size * sizeof(float));
if (Mneg == NULL) {
printf("Mneg: Cannot allocate memory: %lld MB %lld %lld\n", (long long)words * size * sizeof(float) / 1048576, words, size);
return -1;
}
// Read input vectors.
for (b = 0; b < words; b++) {
a = 0;
while (1) {
vocab[b * max_w + a] = fgetc(f);
if (feof(f) || (vocab[b * max_w + a] == ' ')) break;
if ((a < max_w) && (vocab[b * max_w + a] != '\n')) a++;
}
vocab[b * max_w + a] = 0;
for (a = 0; a < size; a++) fread(&M[a + b * size], sizeof(float), 1, f);
// Normalize to L2 norm = 1
len = 0;
for (a = 0; a < size; a++) len += M[a + b * size] * M[a + b * size];
len = sqrt(len);
for (a = 0; a < size; a++) M[a + b * size] /= len;
}
// Read output vectors.
for (b = 0; b < words; b++) {
a = 0;
while (1) {
vocab[b * max_w + a] = fgetc(f);
if (feof(f) || (vocab[b * max_w + a] == ' ')) break;
if ((a < max_w) && (vocab[b * max_w + a] != '\n')) a++;
}
vocab[b * max_w + a] = 0;
for (a = 0; a < size; a++) fread(&Mneg[a + b * size], sizeof(float), 1, f);
// Normalize to L2 norm = 1
len = 0;
for (a = 0; a < size; a++) len += Mneg[a + b * size] * Mneg[a + b * size];
len = sqrt(len);
for (a = 0; a < size; a++) Mneg[a + b * size] /= len;
}
fclose(f);
while (1) {
for (a = 0; a < N; a++) bestd[a] = 0;
for (a = 0; a < N; a++) bestw[a][0] = 0;
printf("Enter word (EXIT to break): ");
a = 0;
while (1) {
st1[a] = fgetc(stdin);
if ((st1[a] == '\n') || (a >= max_size - 1)) {
st1[a] = 0;
break;
}
a++;
}
if (!strcmp(st1, "EXIT")) break;
cn = 0;
b = 0;
c = 0;
while (1) {
st[cn][b] = st1[c];
b++;
c++;
st[cn][b] = 0;
if (st1[c] == 0) break;
if (st1[c] == ' ') {
cn++;
b = 0;
c++;
}
}
cn++;
for (a = 0; a < cn; a++) {
for (b = 0; b < words; b++) if (!strcmp(&vocab[b * max_w], st[a])) break;
if (b == words) b = -1;
bi[a] = b;
printf("\nWord: %s Position in vocabulary: %lld\n", st[a], bi[a]);
if (b == -1) {
printf("Out of dictionary word!\n");
break;
}
// will only look at bi[0], which is the first token
printf("Only look at the first token\n");
break;
}
if (b == -1) continue;
long long wid = bi[0];
float len1 = 0;
float len2 = 0;
float product = 0;
float distance = 0;
for (a = 0; a < size; ++a) {
float e1 = M[wid * size + a];
float e2 = Mneg[wid * size + a];
len1 += e1 * e1;
len2 += e2 * e2;
product += e1 * e2;
distance += (e1 - e2) * (e1 - e2);
}
len1 = sqrt(len1);
len2 = sqrt(len2);
distance = sqrt(distance);
printf("length of input vector: %f\n", len1);
printf("length of output vector: %f\n", len2);
printf("inner product: %f\n", product);
printf("L2 distance: %f\n", distance);
}
return 0;
}
|
the_stack_data/125140264.c | /* 139. Program to read multiline string using scanf. */
#include<stdio.h>
int main(void) {
char str[100];
// reading multline string with '.' as a delimiter
scanf("%[^.]",str);
printf("%s",str);
return 0;
} |
the_stack_data/59034.c | #include<stdio.h>
struct data{
int dia;
int mes;
int ano;
};
void datas_iguais(struct data *pdata1, struct data *pdata2){
int auxiliar_iguais = 0;
if(pdata1->ano == pdata2->ano){
auxiliar_iguais++;
}
if(pdata1->dia == pdata2->dia){
auxiliar_iguais++;
}
if(pdata1->mes == pdata2->mes){
auxiliar_iguais++;
}
auxiliar_iguais ==3 ? printf("1\n") : printf("0\n") ;
}
int main(void){
struct data data1,*pData1, data2,*pData2;
printf("DATA 1:(dia mes ano)\n");
scanf("%d%d%d", &data1.dia , &data1.mes , &data1.ano);
pData1 = &data1;
printf("DATA 2: (dia mes ano)\n");
scanf("%d%d%d", &data2.dia , &data2.mes , &data2.ano);
pData2 = &data2;
datas_iguais(pData1,pData2);
return 0;
} |
the_stack_data/151585.c | #include <stdio.h>
int main() {
// printf("%f",5.0/2);
printf("%f", 5/2);
// printf(5/2);
return 0;
} |
the_stack_data/76700680.c |
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
/* Plugin declarations */
const char * variables = "library module author description url";
const char * functions =
"boot halt grow_seq grow_rnd hit_seq hit_rnd miss_seq miss_rnd delete_seq delete_rnd replace_seq replace_rnd kbench";
/* Plugin definitions */
const char * library = "emilib";
const char * module = "emilib::HashMap";
const char * author = "Emil Ernerfeldt ([email protected])";
const char * description = "Loose collection of misc C++ libs";
const char * url = "http://github.com/emilk/emilib";
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
|
the_stack_data/29826466.c |
//{{BLOCK(Level_1_Main_1_MainFront_5)
//======================================================================
//
// Level_1_Main_1_MainFront_5, 512x32@2,
// + regular map (flat), not compressed, 64x4
// External tile file: (null).
// Total size: 512 = 512
//
// Exported by Cearn's GBA Image Transmogrifier, v0.8.6
// ( http://www.coranac.com/projects/#grit )
//
//======================================================================
const unsigned short Level_1_Main_1_MainFront_5Map[256] __attribute__((aligned(4)))=
{
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x2002,0x0001,0x2001,0x0001,0x2001,0x0001,
0x2001,0x0001,0x2001,0x0002,0x0000,0x0000,0x0000,0x0000,
0x2002,0x0001,0x2001,0x0001,0x2001,0x0001,0x2001,0x0001,
0x2001,0x0002,0x0000,0x0000,0x0000,0x0000,0x2002,0x0001,
0x2001,0x0001,0x2001,0x0001,0x2001,0x0001,0x2001,0x0002,
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x0000,0x0003,0x2003,0x0003,0x2003,0x0003,
0x2003,0x0003,0x2003,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0000,0x0003,0x2003,0x0003,0x2003,0x0003,0x2003,0x0003,
0x2003,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0003,
0x2003,0x0003,0x2003,0x0003,0x2003,0x0003,0x2003,0x0000,
0x2002,0x0001,0x2001,0x0001,0x2001,0x0001,0x2001,0x0001,
0x2001,0x0001,0x2001,0x0001,0x2001,0x0001,0x2001,0x0001,
0x2001,0x0001,0x2001,0x0001,0x2001,0x0002,0x0000,0x0000,
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0000,0x0003,0x2003,0x0003,0x2003,0x0003,0x2003,0x0003,
0x2003,0x0003,0x2003,0x0003,0x2003,0x0003,0x2003,0x0003,
0x2003,0x0003,0x2003,0x0003,0x2003,0x0000,0x0000,0x0000,
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
};
//}}BLOCK(Level_1_Main_1_MainFront_5)
|
the_stack_data/75136724.c | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
typedef struct _Point {
double x;
double y;
int xi; // Index when sorted by X
int yi; // Index when sorted by Y
} Point;
typedef struct _DistInfo {
double value;
int a, b;
} DistInfo;
// Raw array, sorted by X, sorted by Y
Point *p, **px, **py;
int n;
void sort_p(int l, int r, int x_y) {
if (l + 1 >= r)
return;
int i = l, j = r - 1, flag = 0;
Point *t;
while (i < j) {
if (x_y == 0) { // Sort by X
if (px[i]->x > px[j]->x) {
t = px[i];
px[i] = px[j];
px[j] = t;
flag = !flag;
}
} else { // Sort by Y
if (py[i]->y > py[j]->y) {
t = py[i];
py[i] = py[j];
py[j] = t;
flag = !flag;
}
}
flag ? i++ : j--;
}
sort_p(l, i, x_y);
sort_p(i + 1, r, x_y);
}
double distance(Point *a, Point *b) {
return sqrt(pow(a->x - b->x, 2) + pow(a->y - b->y, 2));
}
void find(DistInfo* result, int l, int r) {
if (l + 1 >= r) {
result->value = INFINITY;
return;
}
if (l + 2 == r) {
result->value = distance(px[l], px[l + 1]);
result->a = px[l] - p;
result->b = px[l + 1] - p;
}
DistInfo lresult, rresult;
int mid = (l + r) / 2;
find(&lresult, l, mid);
find(&rresult, mid, r);
if (lresult.value < rresult.value) {
result->value = lresult.value;
result->a = lresult.a;
result->b = lresult.b;
} else {
result->value = rresult.value;
result->a = rresult.a;
result->b = rresult.b;
}
double delta = result->value;
// Find the cross-region minimum distance
// Enumerate every point where (mid.x-d <= p.x <= mid.x)
for (int i = mid - 1; i >= l; i--) {
if (px[i]->x < px[mid]->x - result->value)
// This one's done
break;
int c, j;
// Search both up and down for up to 4 points each
for (c = 4, j = px[i]->yi; c > 0; j++) {
if (j >= n || py[j]->y > px[i]->y + delta) // Gone too far
break;
if (py[j]->xi < mid || py[j]->xi >= r) // Index out of range
continue;
if (py[j]->x > px[mid]->x + delta) // Not in the area we want
continue;
c--;
double d = distance(px[i], py[j]);
if (d < result->value) {
result->value = d;
result->a = i;
result->b = py[j]->xi;
}
}
for (c = 4, j = px[i]->yi; c > 0; j--) {
if (j < 0 || py[j]->y < px[i]->y - delta) // Gone too far
break;
if (py[j]->xi < mid || py[j]->xi >= r) // Index out of range
continue;
if (py[j]->x > px[mid]->x + delta) // Not in the area we want
continue;
c--;
double d = distance(px[i], py[j]);
if (d < result->value) {
result->value = d;
result->a = i;
result->b = py[j]->xi;
}
}
}
}
int main() {
scanf("%d", &n);
p = malloc(n * sizeof *p);
px = malloc(2 * n * sizeof *px);
py = px + n;
for (int i = 0; i < n; i++) {
scanf("%lf%lf", &p[i].x, &p[i].y);
px[i] = py[i] = p + i;
}
// Sort by X and Y
sort_p(0, n, 0);
sort_p(0, n, 1);
for (int i = 0; i < n; i++)
px[i]->xi = py[i]->yi = i;
DistInfo result;
find(&result, 0, n);
printf("%lf\n", result.value);
printf("(%lf, %lf) <=> (%lf, %lf)\n",
px[result.a]->x, px[result.a]->y,
px[result.b]->x, px[result.b]->y);
free(p);
free(px);
return 0;
}
|
the_stack_data/14063.c | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int check_authentication(char *password) {
char password_buffer[16];
int auth_flag = 0;
strcpy(password_buffer, password);
if(strcmp(password_buffer, "brillig") == 0)
auth_flag = 1;
if(strcmp(password_buffer, "outgrabe") == 0)
auth_flag = 1;
return auth_flag;
}
int main(int argc, char *argv[]) {
if(argc < 2) {
printf("Usage: %s <password>\n", argv[0]);
exit(0);
}
if(check_authentication(argv[1])) {
printf("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n");
printf(" Access Granted\n");
printf("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n");
} else {
printf("Access Denied.\n");
}
}
|
the_stack_data/33725.c | #include <stdio.h>
#include <stdlib.h>
typedef struct node {
int value;
struct node * next;
} Node;
void display(Node *head);
void concat(Node *a, Node *b);
Node* front(Node *head, int value);
void end(Node *head, int value);
void after(Node *a, int value);
void delete(Node *prev_node);
int main(void) {
Node * head, *prev, *p;
int n, i;
printf("number of elements: ");
scanf("%d", &n);
head = NULL;
for (i = 0; i < n; i++) {
p = (Node *)malloc(sizeof(Node));
scanf("%d", &p->value);
p->next = NULL;
if (head == NULL) {
head = p;
}
else
prev->next = p;
prev = p;
}
display(head);
return 0;
}
/* display the list begin with the head */
void display(Node *head) {
Node *tmp = head;
while (tmp != NULL) {
printf("%d ", tmp->value);
tmp = tmp->next;
}
printf("\n");
}
/* concat the list */
void concat(Node *a, Node *b) {
if (a != NULL && b != NULL) {
if (a->next == NULL) {
a->next = b;
} else {
concat(a->next, b);
}
} else {
printf("a | b is NULL\n");
}
}
/* insertion in the front */
Node* front(Node *head, int value) {
Node *p = (Node*) malloc(sizeof(Node));
p->value = value;
p->next = head;
return p;
}
/* insertion at the end of list */
void end(Node *head, int value) {
Node *p, *tmp;
p = (Node*)malloc(sizeof(Node));
p->value = value;
p->next = NULL;
tmp = head;
while (tmp->next != NULL) {
tmp = tmp->next;
}
tmp->next = p;
}
/* insertion after the node */
void after(Node *a, int value) {
if (a->next != NULL) {
Node *p = (Node*) malloc(sizeof(Node));
Node *tmp = a;
p->value = value;
p->next = a->next;
a->next = p;
} else {
printf("use end function to insertion\n");
}
}
/* delete the node */
void delete(Node *prev_node) {
Node* tmp = (Node*)malloc(sizeof(Node));
tmp = prev_node->next;
prev_node->next = tmp->next;
free(tmp);
}
|
the_stack_data/89201228.c | #include<stdio.h>
int main()
{int i,zhong,ge,k,shu[100000]={0};
scanf("%d",&ge);
for(i=1;i<=ge;i++){
scanf("%d",&zhong);
shu[zhong]++;}
scanf("%d",&k);
for(i=99999;;i--){
if(shu[i]!=0)
k--;
if(0==k){
printf("%d %d",i,shu[i]);
break;
}
}
return 0;
} |
the_stack_data/29824935.c | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_alphabet.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mghazari <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/08 06:53:37 by mghazari #+# #+# */
/* Updated: 2016/12/05 12:35:04 by mghazari ### ########.fr */
/* */
/* ************************************************************************** */
int ft_putchar(char c);
void ft_print_alphabet(void)
{
char c;
c = 'a';
while (c <= 'z')
ft_putchar(c++);
}
|
the_stack_data/635617.c | /*
Programa que verifica se um numero é palindromo
AUTOR: GABRIEL HENRIQUE CAMPOS SCALICI
NUMERO: 9292970
DATA:
*/
#include<stdio.h>
int main(){
//CRiando as variaveis
int n,aux ;
int metadeoposta =0;
//PEgando o valor digitado pelo usuario
scanf("%d", &n);
//Adicionando o mesmo valor digitado para pegar a metade oposta
aux = n;
//LOgica para verificar se o numero é um palindromo por meio de divisões, multiplicações e módulo
while (aux != 0) {
//Vai pegando os ultimos digitos de n e transformando em um novo numero com metade do tamanho do inicial
metadeoposta = metadeoposta*10 + aux%10;
aux = aux / 10;
}
if (metadeoposta != n){
//Se a metade de tras for diferente da metade da frente, entao nao eh
printf("NAO");
}else{
//Se a metade de tras for igual a metade da frente entao eh
printf("SIM");
}
return 0;
}
|
the_stack_data/92327032.c | #include <stdio.h>
#include <string.h>
#include <stdbool.h>
#define MAX 1010
#define MOD 1000000007
#define clr(ar) memset(ar, 0, sizeof(ar))
#define read() freopen("lol.txt", "r", stdin)
int S[MAX][MAX];
void Generate(){ /// hash = 173404
int i, j;
S[0][0] = 1;
for (i = 1; i < MAX; i++){
S[i][0] = 0;
for (j = 1; j <= i; j++){
S[i][j] = ( ((long long)S[i - 1][j] * j) + S[i - 1][j - 1]) % MOD;
}
}
}
long long faulhaber(long long n, int k){ /// hash = 766729
if (!k) return (n % MOD);
int i, j, l;
long long z, res = 0;
for (j = 0; j <= k; j++){
z = 1;
for (l = j + 1, i = 0; (i - 1) < j; i++){
if ((l > 1) && !((n - i + 1) % l)){
z = (z * (((n - i + 1) / l) % MOD) ) % MOD;
l = 1;
}
else z = (z * ((n - i + 1) % MOD) ) % MOD;
}
res = (res + (z * S[k][j])) % MOD;
}
return res;
}
int main(){
Generate();
int t, k;
long long n;
scanf("%d", &t);
while (t--){
scanf("%lld %d", &n, &k);
printf("%lld\n", faulhaber(n, k));
}
return 0;
}
|
the_stack_data/232954436.c | #include <stdio.h>
main() {
printf("hello world\n");
}
|
the_stack_data/50137843.c | /* Verify that alignment flags are set when attribute __optimize is used. */
/* { dg-do compile } */
/* { dg-options "-O2" } */
extern void non_existent(int);
__attribute__ ((__optimize__ ("O2")))
static void hooray ()
{
non_existent (1);
}
__attribute__ ((__optimize__ ("O2")))
static void hiphip (void (*f)())
{
non_existent (2);
f ();
}
__attribute__ ((__optimize__ ("O2")))
int test (void)
{
hiphip (hooray);
return 0;
}
/* { dg-final { scan-assembler "p2align" } } */
|
the_stack_data/115765983.c | #include <stdio.h>
#include <math.h>
long long newAvg(double *arr, long szArray, double navg) {
if (arr[szArray-1] <= 0)
return -1;
double sum = 0;
for (long i = 0 ; i < szArray ; ++i)
sum += arr[i];
double result = ceil(navg * (double)(szArray+1) - sum);
return (result < 0) ? -1 : result;
}
int main() {
double arr1[7] = {14.0, 30.0, 5.0, 7.0, 9.0, 11.0, 16.0};
printf("%lld\n", newAvg(arr1, 7, 90));
double arr2[8] = {10000.0, 10000.0, 10000.0, 1000.0, 500.0, 60.0, 4.0, 3.0};
printf("%lld\n", newAvg(arr2, 8, 10000));
return 0;
}
|
the_stack_data/365202.c | // Ex2
#include <stdio.h>
main(){
int matriz[5][5];
for(int i = 0; i < 5; i++){
for(int j = 0; j < 5; j++){
scanf("%d", &matriz[i][j]);
}
}
for(int i = 0; i < 5; i++){
for(int j = 0; j < 5; j++){
if(i + j != 4){
printf("%d ", matriz[i][i]);
}
}
}
printf("\n");
}
|
the_stack_data/73574170.c | /*
Convert base10(decimal) values to base2(binary)
@Date: 1 - Jan - 2021
*/
#include <stdio.h>
void convert_bin(int power, int num)
{
int first = 0;
while (power > 0) {
if (num >= power) {
first = 1;
printf("1");
num %= power;
} else if (first == 1) printf("0");
power /= 2;
}
printf("\n");
}
int main(int argc, char *argv[])
{
int num = 0;
int power = 1;
printf("Please enter a number: ");
scanf("%d", &num);
printf("Hex %x \n", num);
printf("Bin: ");
while (power < num) {
power *=2;
}
if (num == 0) printf("0\n");
else convert_bin(power, num);
return 0;
} |
the_stack_data/102716.c | #include <stdio.h>
#include <ctype.h>
#define MAX 50
void push(int stack[],int *top,int n){
stack[++(*top)]=n;
}
int pop(int stack[],int *top){
return stack[(*top)--];
}
int main(){
char exp[MAX];
printf("Enter a postfix expression: ");
scanf("%s",&exp);
int stack[MAX];
int n1,n2,n3;
int n;
int top=-1;
char* e=exp;
while(*e!='\0'){
if (isdigit(*e)){
n=(*e)-48;
push(stack,&top,n);
}
else{
n1=pop(stack,&top);
n2=pop(stack,&top);
switch(*e){
case '+':n3=n1+n2;
push(stack,&top,n3);
break;
case '-': n3=n1-n2;
push(stack,&top,n3);
break;
case '*': n3=n1*n2;
push(stack,&top,n3);
break;
case '/':n1=n1/n2;
break;
}
}
e++;
}
printf("Result : %d\n",stack[top]);
} |
the_stack_data/162643050.c | /*******************************************************************************
*
* Program: Recursive Reverse Print String
*
* Description: Example of using recursion to print a string in reverse in C.
*
* YouTube Lesson: https://www.youtube.com/watch?v=iWQ5rGWmkXw
*
* Author: Kevin Browne @ https://portfoliocourses.com
*
*******************************************************************************/
#include <stdio.h>
void print_reverse(char *s);
int main()
{
// test the function out
char s[] = "This is the way.";
print_reverse(s);
printf("\n");
return 0;
}
// prints string s in reverse
void print_reverse(char *s)
{
// stop recursive function calls once we reach null terminator (end of string)
if (*s != '\0')
{
// before printing the current character, call the function recursively
// with a pointer to the next character... because we always call the
// function pointing to the next character BEFORE we print the character,
// we'll end up printing the last character first, then the 2nd last, and
// on and one as we "unroll" the stack of recursive function calls...
print_reverse(s + 1);
printf("%c", *s);
}
}
|
the_stack_data/37638530.c | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
struct stack {
int values[100];
int top;
};
typedef struct stack st;
int count = 0;
/*
* Initialise empty stack
*/
void createEmptyStack(st *s) {
s->top = -1;
}
/*
* Check the size of the stack
*/
int checkSize(st *s) {
if (s -> top == 99) {
return 1;
} else {
return 0;
}
}
/*
* Append element to stack
*/
void addToStack(st *s, int value) {
// Check if the stack is already full
if (checkSize(s)) {
printf("Stack is full! \n");
} else {
s -> top++;
s -> values[s -> top] = value;
}
count += 1;
}
/*
* Print all elements in a stack
*/
void show(st *s) {
printf("Stack is: ");
for (int i = 0 ; i < count ; i++ ) {
printf("%d ", s -> values[i]);
}
printf("\n");
}
/*
* Pop from the stack
*/
void removeTop(st *s) {
s -> top--;
count--;
}
/*
* Remove duplicates from stack using brute force
*/
void removeDuplicates(st *s) {
for (int i = 0 ; i < count ; i++ ){
for (int j = i + 1 ; j < count ; j++) {
if (s -> values[i] == s -> values[j]) {
int c = j;
while (c < count ) {
s -> values[c] = s -> values[c + 1];
c = c + 1;
}
removeTop(s);
}
}
}
}
/*
* Main function
*/
int main(void) {
st *s = (st *)malloc(sizeof(st));
createEmptyStack(s);
addToStack(s, 1);
addToStack(s, 2);
addToStack(s, 3);
addToStack(s, 1);
addToStack(s, 2);
addToStack(s, 4);
removeDuplicates(s);
show(s);
return 0;
} |
the_stack_data/125050.c | /* PR tree-optimization/22117
VRP used think that &p[q] is nonzero even though p and q are both
known to be zero after entering the first two "if" statements. */
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-vrp1" } */
/* LLVM LOCAL test not applicable */
/* { dg-require-fdump "" } */
void
foo (int *p, int q)
{
if (p == 0)
{
if (q == 0)
{
int *r = &p[q];
if (r != 0)
link_error ();
}
}
}
/* { dg-final { scan-tree-dump-times "Folding predicate r_.* != 0B to 0" 1 "vrp1" } } */
/* { dg-final { cleanup-tree-dump "vrp1" } } */
|
the_stack_data/154831429.c | #include <stdio.h>
#include <stdbool.h>
#include <string.h>
int divisors(long n) {
int cnt = 0;
for (int i = 1; i*i <= n; i++) {
if (n % i == 0) {
// If divisors are equal,
// count only one
if (n / i == i) {
cnt++;
}
else { // Otherwise count both
cnt = cnt + 2;
}
}
}
return cnt;
}
int main() {
int n = 1;
while (true) {
long triangle_num = (n * (n + 1)) / 2;
int f = divisors(triangle_num);
if(f > 500) {
printf("%ld\n", triangle_num);
break;
}
++n;
}
return 0;
} |
the_stack_data/61775.c | #include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
void folklore()
{
int queue = 15, stack = 25, map = 25, tree = 30,x,k;
x = ((stack <= map) && (tree > queue));
k = ((map == queue) || (stack > tree));
//child process because return value zero
if (fork() == 0)
{
printf("xProcess = %d \n", x);
}
// parent process because return value non-zero
else
{
printf("kProcess = %d \n", ++k);
}
}
int main()
{
folklore();
return 0;
}
|
the_stack_data/187643514.c | #include <stdio.h>
/* copy input to output replacing tabs, backspaces and
newlines with escape characters */
int main()
{
int c;
while ((c = getchar()) != EOF)
if (c == '\t') printf("\\t");
else if (c == '\n') printf("\\n");
else if (c == '\b') printf("\b");
else putchar(c);
return(0);
}
|
the_stack_data/46033.c | #include <stdio.h>
#include <stdarg.h>
#include <wchar.h>
int wscanf(const wchar_t *restrict fmt, ...)
{
int ret;
va_list ap;
va_start(ap, fmt);
ret = vwscanf(fmt, ap);
va_end(ap);
return ret;
}
weak_alias(wscanf,__isoc99_wscanf);
|
the_stack_data/122015231.c | extern int printf(char *, ...);
extern int scanf(char *, ...);
int i;
main () {
int k;
i = -2;
scanf("%d",&i);
k = i * i;
printf("The square is %d .\n", k);
}
|
the_stack_data/211080565.c | /* $OpenBSD: timingsafe_bcmp.c,v 1.3 2015/08/31 02:53:57 guenther Exp $ */
/*
* Copyright (c) 2010 Damien Miller. All rights reserved.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <string.h>
int
timingsafe_bcmp(const void *b1, const void *b2, size_t n)
{
const unsigned char *p1 = b1, *p2 = b2;
int ret = 0;
for (; n > 0; n--)
ret |= *p1++ ^ *p2++;
return (ret != 0);
}
DEF_WEAK(timingsafe_bcmp);
|
the_stack_data/115766613.c | /*
* Copyright (c) 2015-2016 Intel Corporation, Inc. All rights reserved.
*
* This software is available to you under a choice of one of two
* licenses. You may choose to be licensed under the terms of the GNU
* General Public License (GPL) Version 2, available from the file
* COPYING in the main directory of this source tree, or the
* BSD license below:
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
*
* - Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
*
* - Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 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.
*/
#ifdef _WIN32
#include "netdir.h"
#include "netdir_ov.h"
#include "netdir_err.h"
#include "netdir_iface.h"
#include "rdma/fabric.h"
#include "ofi_util.h"
static int ofi_nd_cntr_close(struct fid *fid);
static uint64_t ofi_nd_cntr_read(struct fid_cntr *cntr);
static uint64_t ofi_nd_cntr_readerr(struct fid_cntr *cntr);
static int ofi_nd_cntr_add(struct fid_cntr *cntr, uint64_t value);
static int ofi_nd_cntr_set(struct fid_cntr *cntr, uint64_t value);
static int ofi_nd_cntr_wait(struct fid_cntr *cntr,
uint64_t threshold, int timeout);
static struct fi_ops ofi_nd_fi_ops = {
.size = sizeof(ofi_nd_fi_ops),
.close = ofi_nd_cntr_close,
.bind = fi_no_bind,
.control = fi_no_control,
.ops_open = fi_no_ops_open,
};
static struct fid ofi_nd_fid = {
.fclass = FI_CLASS_CNTR,
.context = NULL,
.ops = &ofi_nd_fi_ops
};
static struct fi_ops_cntr ofi_nd_cntr_ops = {
.size = sizeof(ofi_nd_cntr_ops),
.read = ofi_nd_cntr_read,
.readerr = ofi_nd_cntr_readerr,
.add = ofi_nd_cntr_add,
.set = ofi_nd_cntr_set,
.wait = ofi_nd_cntr_wait
};
static int ofi_nd_cntr_close(struct fid *fid)
{
assert(fid->fclass == FI_CLASS_CNTR);
if (fid->fclass != FI_CLASS_CQ)
return -FI_EINVAL;
struct nd_cntr *cntr = container_of(fid, struct nd_cntr, fid.fid);
free(cntr);
return FI_SUCCESS;
}
int ofi_nd_cntr_open(struct fid_domain *pdomain, struct fi_cntr_attr *attr,
struct fid_cntr **pcntr, void *context)
{
OFI_UNUSED(context);
assert(pdomain);
assert(pdomain->fid.fclass == FI_CLASS_DOMAIN);
if (attr) {
if (attr->wait_obj != FI_WAIT_NONE &&
attr->wait_obj != FI_WAIT_UNSPEC)
return -FI_EBADFLAGS;
}
struct nd_cntr *cntr = (struct nd_cntr*)calloc(1, sizeof(*cntr));
if (!cntr)
return -FI_ENOMEM;
struct nd_cntr def = {
.fid = {
.fid = ofi_nd_fid,
.ops = &ofi_nd_cntr_ops
},
};
*cntr = def;
*pcntr = &cntr->fid;
return FI_SUCCESS;
}
static uint64_t ofi_nd_cntr_read(struct fid_cntr *pcntr)
{
assert(pcntr);
assert(pcntr->fid.fclass == FI_CLASS_CNTR);
struct nd_cntr *cntr = container_of(pcntr, struct nd_cntr, fid);
return cntr->counter;
}
static uint64_t ofi_nd_cntr_readerr(struct fid_cntr *pcntr)
{
assert(pcntr);
assert(pcntr->fid.fclass == FI_CLASS_CNTR);
struct nd_cntr *cntr = container_of(pcntr, struct nd_cntr, fid);
return cntr->err;
}
static int ofi_nd_cntr_add(struct fid_cntr *pcntr, uint64_t value)
{
assert(pcntr);
assert(pcntr->fid.fclass == FI_CLASS_CNTR);
if (pcntr->fid.fclass != FI_CLASS_CNTR)
return -FI_EINVAL;
struct nd_cntr *cntr = container_of(pcntr, struct nd_cntr, fid);
cntr->counter += value;
WakeByAddressAll((void*)&cntr->counter);
return FI_SUCCESS;
}
static int ofi_nd_cntr_set(struct fid_cntr *pcntr, uint64_t value)
{
assert(pcntr);
assert(pcntr->fid.fclass == FI_CLASS_CNTR);
if (pcntr->fid.fclass != FI_CLASS_CNTR)
return -FI_EINVAL;
struct nd_cntr *cntr = container_of(pcntr, struct nd_cntr, fid);
cntr->counter = value;
WakeByAddressAll((void*)&cntr->counter);
return FI_SUCCESS;
}
static int ofi_nd_cntr_wait(struct fid_cntr *pcntr,
uint64_t threshold, int timeout)
{
assert(pcntr);
assert(pcntr->fid.fclass == FI_CLASS_CNTR);
if (pcntr->fid.fclass != FI_CLASS_CNTR)
return -FI_EINVAL;
struct nd_cntr *cntr = container_of(pcntr, struct nd_cntr, fid);
/* process corner timeouts separately to optimize */
if (!timeout) { /* no wait */
return (cntr->counter >= (LONGLONG)threshold) ?
FI_SUCCESS : -FI_ETIMEDOUT;
}
else if (timeout < 0) { /* infinite wait */
while (cntr->counter < (LONG64)threshold) {
LONG64 val = cntr->counter;
WaitOnAddress(&cntr->counter, &val,
sizeof(val), INFINITE);
}
return FI_SUCCESS;
}
else { /* timeout wait */
OFI_ND_TIMEOUT_INIT(timeout);
do {
if (cntr->counter >= (LONG64)threshold)
return FI_SUCCESS;
LONG64 val = cntr->counter;
WaitOnAddress(&cntr->counter, &val,
sizeof(val), timeout);
} while (!OFI_ND_TIMEDOUT());
}
return FI_SUCCESS;
}
#endif /* _WIN32 */
|
the_stack_data/101886.c | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <signal.h>
#define PORT 1683
#define CHUNKSIZE 1024
char buffer[CHUNKSIZE];
void sig_handler(int sig) {
pid_t p;
while ((p = waitpid(-1, NULL, WNOHANG)) <= 0);
printf("\nExiting process pid = %d\n", p);
}
int main()
{
int pid;
int sockfd_main,sockfd_new;
struct sockaddr_in addr_main;
struct sigaction sa;
memset(&sa, 0, sizeof(sa));
sa.sa_handler = sig_handler;
sigaction(SIGCHLD, &sa, NULL);
if ( (sockfd_main = socket(AF_INET,SOCK_STREAM,IPPROTO_TCP)) < 0)
{
printf("Error resolving socket\n");
return 1;
}
int val = 1;
if ( (setsockopt(sockfd_main,SOL_SOCKET,SO_REUSEADDR,&val, sizeof(val))) < 0)
{
printf("Error on setting\n");
return 1;
}
addr_main.sin_family = AF_INET;
addr_main.sin_addr.s_addr = INADDR_ANY;
addr_main.sin_port = htons(PORT);
if ( bind(sockfd_main,(struct sockaddr*)&addr_main,sizeof(addr_main)) < 0)
{
printf("Error on binding\n");
return 1;
}
if (listen(sockfd_main,5) == -1)
{
printf("Error on listen\n");
return 1;
}
while (1)
{
sockfd_new = accept(sockfd_main,NULL,NULL);
if ( (pid = fork()) == 0)
{
printf("Child process created %d \n",getpid());
recv(sockfd_new,buffer,CHUNKSIZE,0);
printf("Child process %i received: %s\n",getpid(),buffer);
close(sockfd_new);
exit(0);
}
close(sockfd_new);
}
close(sockfd_main);
return 0;
}
|
the_stack_data/81233.c | /*
* SPI testing utility (using spidev driver)
*
* Copyright (c) 2007 MontaVista Software, Inc.
* Copyright (c) 2007 Anton Vorontsov <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License.
*
* Cross-compile with cross-gcc -I/path/to/cross-kernel/include
*/
#include <stdint.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <getopt.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/types.h>
#include <linux/spi/spidev.h>
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
static void pabort(const char *s)
{
perror(s);
abort();
}
static const char *device = "/dev/spidev0.0";
static uint8_t mode;
static uint8_t bits = 8;
static uint32_t speed = 500000;
static uint16_t delay;
static void transfer(int fd)
{
int ret;
uint8_t tx[] = {
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0x40, 0x00, 0x00, 0x00, 0x00, 0x95,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xDE, 0xAD, 0xBE, 0xEF, 0xBA, 0xAD,
0xF0, 0x0D,
};
uint8_t rx[ARRAY_SIZE(tx)] = {0, };
struct spi_ioc_transfer tr = {
.tx_buf = (unsigned long)tx,
.rx_buf = (unsigned long)rx,
.len = ARRAY_SIZE(tx),
.delay_usecs = delay,
.speed_hz = speed,
.bits_per_word = bits,
};
ret = ioctl(fd, SPI_IOC_MESSAGE(1), &tr);
if (ret < 1)
pabort("can't send spi message");
for (ret = 0; ret < ARRAY_SIZE(tx); ret++) {
if (!(ret % 6))
puts("");
printf("%.2X ", rx[ret]);
}
puts("");
}
static void print_usage(const char *prog)
{
printf("Usage: %s [-DsbdlHOLC3]\n", prog);
puts(" -D --device device to use (default /dev/spidev1.1)\n"
" -s --speed max speed (Hz)\n"
" -d --delay delay (usec)\n"
" -b --bpw bits per word \n"
" -l --loop loopback\n"
" -H --cpha clock phase\n"
" -O --cpol clock polarity\n"
" -L --lsb least significant bit first\n"
" -C --cs-high chip select active high\n"
" -3 --3wire SI/SO signals shared\n");
exit(1);
}
static void parse_opts(int argc, char *argv[])
{
while (1) {
static const struct option lopts[] = {
{ "device", 1, 0, 'D' },
{ "speed", 1, 0, 's' },
{ "delay", 1, 0, 'd' },
{ "bpw", 1, 0, 'b' },
{ "loop", 0, 0, 'l' },
{ "cpha", 0, 0, 'H' },
{ "cpol", 0, 0, 'O' },
{ "lsb", 0, 0, 'L' },
{ "cs-high", 0, 0, 'C' },
{ "3wire", 0, 0, '3' },
{ "no-cs", 0, 0, 'N' },
{ "ready", 0, 0, 'R' },
{ NULL, 0, 0, 0 },
};
int c;
c = getopt_long(argc, argv, "D:s:d:b:lHOLC3NR", lopts, NULL);
if (c == -1)
break;
switch (c) {
case 'D':
device = optarg;
break;
case 's':
speed = atoi(optarg);
break;
case 'd':
delay = atoi(optarg);
break;
case 'b':
bits = atoi(optarg);
break;
case 'l':
mode |= SPI_LOOP;
break;
case 'H':
mode |= SPI_CPHA;
break;
case 'O':
mode |= SPI_CPOL;
break;
case 'L':
mode |= SPI_LSB_FIRST;
break;
case 'C':
mode |= SPI_CS_HIGH;
break;
case '3':
mode |= SPI_3WIRE;
break;
case 'N':
mode |= SPI_NO_CS;
break;
case 'R':
mode |= SPI_READY;
break;
default:
print_usage(argv[0]);
break;
}
}
}
int main(int argc, char *argv[])
{
int ret = 0;
int fd;
parse_opts(argc, argv);
fd = open(device, O_RDWR);
if (fd < 0)
pabort("can't open device");
/*
* spi mode
*/
ret = ioctl(fd, SPI_IOC_WR_MODE, &mode);
if (ret == -1)
pabort("can't set spi mode");
ret = ioctl(fd, SPI_IOC_RD_MODE, &mode);
if (ret == -1)
pabort("can't get spi mode");
/*
* bits per word
*/
ret = ioctl(fd, SPI_IOC_WR_BITS_PER_WORD, &bits);
if (ret == -1)
pabort("can't set bits per word");
ret = ioctl(fd, SPI_IOC_RD_BITS_PER_WORD, &bits);
if (ret == -1)
pabort("can't get bits per word");
/*
* max speed hz
*/
ret = ioctl(fd, SPI_IOC_WR_MAX_SPEED_HZ, &speed);
if (ret == -1)
pabort("can't set max speed hz");
ret = ioctl(fd, SPI_IOC_RD_MAX_SPEED_HZ, &speed);
if (ret == -1)
pabort("can't get max speed hz");
printf("spi mode: %d\n", mode);
printf("bits per word: %d\n", bits);
printf("max speed: %d Hz (%d KHz)\n", speed, speed/1000);
transfer(fd);
close(fd);
return ret;
}
|
the_stack_data/190768814.c | /*******************************************************************************
* File Name: cymetadata.c
*
* PSoC Creator 4.1 Update 1
*
* Description:
* This file defines all extra memory spaces that need to be included.
* This file is automatically generated by PSoC Creator.
*
********************************************************************************
* Copyright (c) 2007-2017 Cypress Semiconductor. All rights reserved.
* You may use this file only in accordance with the license, terms, conditions,
* disclaimers, and limitations in the end user license agreement accompanying
* the software package with which this file was provided.
********************************************************************************/
#include "stdint.h"
#if defined(__GNUC__) || defined(__ARMCC_VERSION)
#ifndef CY_CONFIG_ECC_SECTION
#define CY_CONFIG_ECC_SECTION __attribute__ ((__section__(".cyconfigecc"), used))
#endif
CY_CONFIG_ECC_SECTION
#elif defined(__ICCARM__)
#pragma location=".cyconfigecc"
#else
#error "Unsupported toolchain"
#endif
const uint8_t cy_meta_configecc[] = {
0x01u, 0x45u, 0x00u, 0x40u, 0x03u, 0x4Fu, 0x00u, 0x40u,
0x04u, 0x52u, 0x00u, 0x40u, 0x01u, 0x64u, 0x00u, 0x40u,
0x08u, 0x65u, 0x00u, 0x40u, 0x01u, 0x01u, 0x01u, 0x40u,
0x07u, 0x03u, 0x01u, 0x40u, 0x04u, 0x05u, 0x01u, 0x40u,
0x51u, 0x06u, 0x01u, 0x40u, 0x2Eu, 0x07u, 0x01u, 0x40u,
0x01u, 0x0Bu, 0x01u, 0x40u, 0x02u, 0x0Du, 0x01u, 0x40u,
0x01u, 0x0Fu, 0x01u, 0x40u, 0x55u, 0x14u, 0x01u, 0x40u,
0x3Au, 0x15u, 0x01u, 0x40u, 0x54u, 0x16u, 0x01u, 0x40u,
0x37u, 0x17u, 0x01u, 0x40u, 0x02u, 0x19u, 0x01u, 0x40u,
0x43u, 0x1Au, 0x01u, 0x40u, 0x23u, 0x1Bu, 0x01u, 0x40u,
0x07u, 0x40u, 0x01u, 0x40u, 0x05u, 0x41u, 0x01u, 0x40u,
0x01u, 0x42u, 0x01u, 0x40u, 0x09u, 0x43u, 0x01u, 0x40u,
0x04u, 0x44u, 0x01u, 0x40u, 0x05u, 0x45u, 0x01u, 0x40u,
0x04u, 0x46u, 0x01u, 0x40u, 0x06u, 0x47u, 0x01u, 0x40u,
0x0Bu, 0x48u, 0x01u, 0x40u, 0x06u, 0x49u, 0x01u, 0x40u,
0x02u, 0x4Cu, 0x01u, 0x40u, 0x07u, 0x4Du, 0x01u, 0x40u,
0x05u, 0x50u, 0x01u, 0x40u, 0x02u, 0x51u, 0x01u, 0x40u,
0x7Eu, 0x02u, 0x0Au, 0xD2u, 0x0Du, 0x10u, 0x16u, 0x1Bu,
0x2Eu, 0x7Fu, 0x60u, 0x10u, 0x61u, 0x30u, 0x7Cu, 0x40u,
0x87u, 0x67u, 0x06u, 0xFFu, 0x07u, 0xFFu, 0x16u, 0xFFu,
0x17u, 0xFFu, 0x26u, 0xFFu, 0x27u, 0xFFu, 0x84u, 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00u, 0x0Au,
0x08u, 0x00u, 0x00u, 0x00u, 0x10u, 0x00u, 0x00u, 0x00u
};
#if defined(__GNUC__) || defined(__ARMCC_VERSION)
#ifndef CY_CUST_NVL_SECTION
#define CY_CUST_NVL_SECTION __attribute__ ((__section__(".cycustnvl"), used))
#endif
CY_CUST_NVL_SECTION
#elif defined(__ICCARM__)
#pragma location=".cycustnvl"
#else
#error "Unsupported toolchain"
#endif
const uint8_t cy_meta_custnvl[] = {
0x00u, 0x00u, 0x40u, 0x05u
};
#if defined(__GNUC__) || defined(__ARMCC_VERSION)
#ifndef CY_WO_NVL_SECTION
#define CY_WO_NVL_SECTION __attribute__ ((__section__(".cywolatch"), used))
#endif
CY_WO_NVL_SECTION
#elif defined(__ICCARM__)
#pragma location=".cywolatch"
#else
#error "Unsupported toolchain"
#endif
const uint8_t cy_meta_wonvl[] = {
0xBCu, 0x90u, 0xACu, 0xAFu
};
#if defined(__GNUC__) || defined(__ARMCC_VERSION)
#ifndef CY_FLASH_PROT_SECTION
#define CY_FLASH_PROT_SECTION __attribute__ ((__section__(".cyflashprotect"), used))
#endif
CY_FLASH_PROT_SECTION
#elif defined(__ICCARM__)
#pragma location=".cyflashprotect"
#else
#error "Unsupported toolchain"
#endif
const uint8_t cy_meta_flashprotect[] = {
0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u
};
#if defined(__GNUC__) || defined(__ARMCC_VERSION)
#ifndef CY_META_SECTION
#define CY_META_SECTION __attribute__ ((__section__(".cymeta"), used))
#endif
CY_META_SECTION
#elif defined(__ICCARM__)
#pragma location=".cymeta"
#else
#error "Unsupported toolchain"
#endif
const uint8_t cy_metadata[] = {
0x00u, 0x01u, 0x2Eu, 0x12u, 0x30u, 0x69u, 0x00u, 0x01u,
0x00u, 0x00u, 0x00u, 0x00u
};
|
the_stack_data/18886630.c | #include <stdio.h>
int Answer;
int main(void)
{
int T, test_case;
// freopen("input.txt", "r", stdin);
setbuf(stdout, NULL);
scanf("%d", &T);
for(test_case = 0; test_case < T; test_case++)
{
/////////////////////////////////////////////////////////////////////////////////////////////
/*
Implement your algorithm here.
The answer to the case will be stored in variable Answer.
*/
/////////////////////////////////////////////////////////////////////////////////////////////
int N = 0;
int result = 0;
scanf("%d", &N);
//XOR연산 두번 적용시 0 -> 입력받은 전체수를 계속 XOR 연산 해주면 답 도출가능
for(int i = 0; i < N; i++)
{
int input = 0;
scanf("%d", &input);
result = result ^ input;
}
// Print the answer to standard output(screen).
printf("Case #%d\n", test_case+1);
printf("%d\n", result); //전역변수 Answer를 이용하면 오답
}
return 0;//Your program should return 0 on normal termination.
}
|
the_stack_data/215768400.c | #include <stdio.h>
#include <omp.h>
int main(int argc, char **argv)
{
const long N = 1000000;
int i, a[N];
#pragma omp parallel for
for (i = 0; i < N; i++)
a[i] = 2 * a[i];
return 0;
}
|
the_stack_data/1078.c | #include <unistd.h>
#include <stdlib.h>
int main ()
{
void *p;
p = malloc (555);
sleep (3);
p = malloc (666);
return 0;
}
|
the_stack_data/54826427.c | /*
* =========================================================
* Filename: replace_space.c
* Description: Write a method to replace all spaces in a string with ‘%20’.
* =========================================================
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define BUF 100
char* replace(char s[]);
void replace_v1(char s[]);
int main(){
char s[BUF] = "my name is lambda.";//without BUF "abort info"
replace_v1(s);
// printf("original str :%s\nreplace str :%s\n",s," ");
printf("repalce str:%s\n",s);
return 0;
}
//将替换后的串存到新的空间
char* replace(char s[]){
char *p = s;
int space = 0;
while(*p){
if(*p == ' ')
space++;
p++;
}
char* t = malloc(sizeof(char)*(strlen(s) + 2*space + 1));
char* p_t = t;
while(*s){
if(*s == ' '){
*p_t = '%';
*(p_t+1) = '2';
*(p_t+2) = '0';
p_t += 3;
}
else{
*p_t = *s;
p_t += 1;
}
++s;
}
*p_t = '\0';
return t;
}
// s 空间足够大,替换结果保存在原来空间
void replace_v1(char s[]){
char *p = s;
int space = 0;
while(*p){
if(*p == ' ')
space++;
p++;
}
int tail = strlen(s) + 2*space ;
s[tail--] = '\0';
for(int i = strlen(s) - 1;i >= 0;i--){//倒着来替换
if(s[i] == ' '){
s[tail] = '0';
s[tail-1] = '2';
s[tail-2] = '%';
tail -= 3;
}
else{
s[tail] = s[i];
tail--;
}
}
}
|
the_stack_data/219561.c | /*Exercise 2 - Selection
Write a program to calculate the amount to be paid for a rented vehicle.
• Input the distance the van has travelled
• The first 30 km is at a rate of 50/= per km.
• The remaining distance is calculated at the rate of 40/= per km.
e.g.
Distance -> 20
Amount = 20 x 50 = 1000
Distance -> 50
Amount = 30 x 50 + (50-30) x 40 = 2300*/
#include <stdio.h>
int main() {
int distance,amount;
printf("enter the travelled distance :");
scanf("%d",&distance);
if (distance < 30)
{
amount = distance * 50;
}
else
{
amount = (30 * 50) + (distance - 30) * 40;
}
printf("amount is : %d",amount);
return 0;
}
|
the_stack_data/76701443.c | #include <stdlib.h>
#include <stdint.h>
#include <limits.h>
char chartab[256] = {
/* 0*/ -12, -12, -12, -12, -2, -12, -12, -12,
/* 8*/ -12, -18, -2, -12, -12, -18, -12, -12,
/* 16*/ -12, -12, -12, -12, -12, -12, -12, -12,
/* 24*/ -12, -12, -12, -12, -12, -12, -12, -12,
/* 32*/ -18, -16, -14, -12, -16, -16, -16, -10,
/* 40*/ -16, -16, -16, -16, -16, -16, 46, -6,
/* 48*/ 48, 49, 50, 51, 52, 53, 54, 55,
/* 56*/ 56, 57, -16, -2, 0, -16, -12, -12,
/* 64*/ -12, 65, 66, 67, 68, 69, 70, 71,
/* 72*/ 72, 73, 74, 75, 76, 77, 78, 79,
/* 80*/ 80, 81, 82, 83, 84, 85, 86, 87,
/* 88*/ 88, 89, 90, -16, -20, -16, -16, 95,
/* 96*/ -12, 97, 98, 99, 100, 101, 102, 103,
/*104*/ 104, 105, 106, 107, 108, 109, 110, 111,
/*112*/ 112, 113, 114, 115, 116, 117, 118, 119,
/*120*/ 120, 121, 122, -12, -22, -12, 126, -12
};
/* reversed chartab:
-22 (fixor) : |
-20 (escp) : \
-18 : 9'\t', 13'\r', 32' '
-16 (retread): !$%&()*+,-:=[]^
-14 (dquote) : "
-12 (garb) : 0-3, 5-8, 11-12, 14-31, #>?@`{}, 127
-10 (squote) : '
-6 (skip) : /
-2 (retread): 4(EOT), 10'\n', 59';'
0 (string) : <
(ASCII) : .0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ
_abcdefghijklmnopqrstuvwxyz~
*/
char atmp1[PATH_MAX] = "/tmp/atm1_XXXXXX";
char atmp2[PATH_MAX] = "/tmp/atm2_XXXXXX";
char atmp3[PATH_MAX] = "/tmp/atm3_XXXXXX";
char *aout = "a.out";
/* atmp2 */
char fbfil;
/* input */
char fin, inbuf[512];
int inbfi, inbfcnt;
/* .text, .data, .bss */
int savdot[3], datbase, bssbase;
int hshsiz = 1553;
char *hshtab[1553];
int nargs;
char **curarg;
char fileflg, ch;
int line, errflg, ifflg, numval;
intptr_t savop;
int outmod = 0777;
int header[8];
int *txtmagic = &header[0];
int *txtsiz = &header[1];
int *datsiz = &header[2];
int *bsssiz = &header[3];
int *symsiz = &header[4];
int *stksiz = &header[5];
int *exorig = &header[6];
int tseeks[3], rseeks[3], symseek;
int *txtseek = &tseeks[0];
int *datseek = &tseeks[1];
int *trelseek = &rseeks[0];
int *drelseek = &rseeks[1];
int brlen = 1024, brtabi, brdelt;
char brtab[128]; /* bitmap: brlen / 8 */
intptr_t adrbuf[6];
int abufi;
int defund, ibufi, ibufc, passno;
char argb[22], faout;
char *usymtab, *symend, *endtable, *memend;
struct Buf { short *next, *max; int addr; short data[256]; };
struct Buf txtp, relp;
struct Sym { char type, num; int value; };
struct Sym *xsymbol;
/* 0: .. 9: */
struct Sym curfbr[10], *curfb[10], *nxtfb[10], *fbbufp;
|
the_stack_data/150746.c | #include <stdio.h>
int main(){
printf("Hello, World!");
}
|
the_stack_data/337252.c | #include <stdio.h>
int max(int a, int b) {
return a > b ? a : b;
}
int main(int argc, char const *argv[])
{
int n, i = 1, cur, prev, maxCount = 0, count = 1;
scanf("%d", &n);
scanf("%d", &prev);
while (i < n) {
scanf("%d", &cur);
if (cur < prev) {
maxCount = max(count, maxCount);
count = 1;
} else {
count++;
}
prev = cur;
i++;
}
maxCount = max(count, maxCount);
printf("%d\n", maxCount);
return 0;
} |
the_stack_data/452248.c | #include <stdio.h>
#include <stdlib.h>
#include <glob.h>
#include <assert.h>
#define UNUSED(x) (void)(x)
int main(int argc, char *argv[])
{
UNUSED(argc);
UNUSED(argv);
int rc = 0;
glob_t paths;
paths.gl_pathc = 0;
paths.gl_pathv = NULL;
paths.gl_offs = 0;
// was genau ist dann die sortierreihenfolge??
int glob_rc = glob("./tests/*_test.*", GLOB_NOSORT, NULL, &paths);
if (glob_rc != 0) {
rc = -1;
printf("glob() fail - error %d\n", glob_rc);
goto cleanup;
}
if (paths.gl_pathc > 0) {
printf("found results => %lu\n", paths.gl_pathc);
for (size_t i = 0; i < paths.gl_pathc; i++) {
printf("RUN test \"%s\"\n", paths.gl_pathv[i]);
printf("----\n");
int test_program_rc = system(paths.gl_pathv[i]);
printf("----\n");
if (test_program_rc == -1 ) {
printf("SYSTEM ERROR Failed to run test\n");
} else if (test_program_rc == 0) {
printf("PASS\n");
} else {
printf("FAIL return code\"%d\"\n", test_program_rc);
}
}
} else {
printf("NO tests found");
}
cleanup:
globfree(&paths);
return rc;
}
|
the_stack_data/12638894.c | #include <sys/socket.h>
#include <arpa/inet.h>
#include <ctype.h>
#include <errno.h>
#include <string.h>
#if __GNUC__ < 4
#define restrict
#endif
static int hexval(unsigned c)
{
if (c-'0'<10) return c-'0';
c |= 32;
if (c-'a'<6) return c-'a'+10;
return -1;
}
int inet_pton(int af, const char *restrict s, void *restrict a0)
{
uint16_t ip[8];
unsigned char *a = a0;
int i, j, v, d, brk=-1, need_v4=0;
if (af==AF_INET) {
for (i=0; i<4; i++) {
for (v=j=0; j<3 && isdigit(s[j]); j++)
v = 10*v + s[j]-'0';
if (j==0 || (j>1 && s[0]=='0') || v>255) return 0;
a[i] = v;
if (s[j]==0 && i==3) return 1;
if (s[j]!='.') return 0;
s += j+1;
}
return 0;
} else if (af!=AF_INET6) {
errno = EAFNOSUPPORT;
return -1;
}
if (*s==':' && *++s!=':') return 0;
for (i=0; ; i++) {
if (s[0]==':' && brk<0) {
brk=i;
ip[i&7]=0;
if (!*++s) break;
if (i==7) return 0;
continue;
}
for (v=j=0; j<4 && (d=hexval(s[j]))>=0; j++)
v=16*v+d;
if (j==0) return 0;
ip[i&7] = v;
if (!s[j] && (brk>=0 || i==7)) break;
if (i==7) return 0;
if (s[j]!=':') {
if (s[j]!='.' || (i<6 && brk<0)) return 0;
need_v4=1;
i++;
break;
}
s += j+1;
}
if (brk>=0) {
memmove(ip+brk+7-i, ip+brk, 2*(i+1-brk));
for (j=0; j<7-i; j++) ip[brk+j] = 0;
}
for (j=0; j<8; j++) {
*a++ = ip[j]>>8;
*a++ = ip[j];
}
if (need_v4 && inet_pton(AF_INET, (void *)s, a-4) <= 0) return 0;
return 1;
}
|
the_stack_data/1162748.c | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <assert.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
enum {
MaxLigne = 1024, // longueur max d'une ligne de commandes
MaxMot = MaxLigne / 2, // nbre max de mot dans la ligne
MaxDirs = 100, // nbre max de repertoire dans PATH
MaxPathLength = 512, // longueur max d'un nom de fichier
MaxCommandes = 100,
};
struct task
{
int pid;
char *cmd;
int state;
int finished;
};
typedef struct task task;
task **task_list;
int decouper(char *, char *, char **, int);
int clean_redir(char *, char *, char *);
void remove_task(int pid, int state);
void clear_task();
int add_task(int pid, char *cmd);
void print_task();
# define PROMPT "mishell &"
#define MAX_TASK 30
int current_fg = -1;
void chld_handler(int sig)
{
signal(SIGCHLD, chld_handler);
int state;
int pid = waitpid(-1, &state, WNOHANG);
if (pid > 0)
{
remove_task(pid, state);
//error("error handler ");
return ;
}
}
void int_handler(int sig)
{
//printf("curr %d\n", current_fg);
if(current_fg > 0)
{
if(kill(current_fg, SIGINT) < 0)
perror("kill");
}
else
printf(" No fg task found. Type exit to leave.");
signal(SIGINT, int_handler);
printf("\n"PROMPT);
fflush(stdout);
}
void stop_handler(int sig)
{
printf("test\n");
if(current_fg > 0)
{
if(kill(current_fg, SIGTSTP) < 0)
perror("kill");
}
else
printf("\nNo fg task found.\n");
signal(SIGTSTP, stop_handler);
printf("\n"PROMPT);
fflush(stdout);
}
void remove_task(int pid, int state)
{
int i;
for(i = 0; i < MAX_TASK; i++)
{
task *t = *(task_list + i);
if(t && t->pid == pid)
{
t->finished = 1;
t->state = state;
}
}
}
void clear_task()
{
int i;
for(i = 0; i < MAX_TASK; i++)
{
task *t = *(task_list + i);
if(t && t->finished)
{
printf("~~| Finished task %d with state %d.\n~~| PID : %d - CMD : %s.\n", i, t->state, t->pid, t->cmd);
free(t->cmd);
free(*(task_list + i));
*(task_list + i) = NULL;
}
}
}
int add_task(int pid, char *cmd)
{
task *t = NULL;
t = malloc(sizeof(task));
if(!t)
{
printf("add_task : error\n");
return -1;
}
t->pid = pid;
t->cmd = strdup(cmd);
t->finished = 0;
int i;
for(i = 0; i < MAX_TASK; i++)
{
if(*(task_list + i) == NULL)
{
*(task_list + i) = t;
printf("~~| New task %d\n~~| PID : %d. CMD : %s\n", i, t->pid, t->cmd);
break;
}
}
if(i == MAX_TASK)
return -1;
return i;
}
void print_task()
{
int i;
for(i = 0; i < MAX_TASK; i++)
{
task *t = *(task_list + i);
if(t != NULL)
printf("[%d] - %s (pid %d, state %d)\n", i, t->cmd, t->pid, t->state);
}
}
int main(int argc, char * argv[])
{
//printf("group : %d. pid : %d\n", getpgid(getpid()), getpid());
task_list = malloc(sizeof(task*) * MAX_TASK);
{
int i;
for(i = 0; i < MAX_TASK; i++)
{
*(task_list + i) = NULL;
}
}
char ligne[MaxLigne];
char *ligne_copy;
char pathname[MaxPathLength];
char * mot[MaxMot];
char * dirs[MaxDirs];
char *commandes[MaxCommandes];
int i_cmd, i_dir, pid, nb_cmds;
clock_t current_time;
/* Decouper UNE COPIE de PATH en repertoires */
decouper(strdup(getenv("PATH")), ":", dirs, MaxDirs);
/* Lire et traiter chaque ligne de commande */
int i;
int fg;
char *task_cmd;
signal(SIGCHLD, chld_handler);
signal(SIGINT, int_handler);
signal(SIGTSTP, stop_handler);
int before_pipe = -1;
while(1)
{
clear_task();
printf(PROMPT);
fflush(stdout);
if(!fgets(ligne, sizeof ligne, stdin))
break;
nb_cmds = decouper(ligne, ";&|", commandes, MaxCommandes);
for(i = 0; i < nb_cmds; i++)
{
current_fg = -1;
task_cmd = strdup(commandes[i]);
if(*(task_cmd + strlen(task_cmd) - 1) == '\n')
{
*(task_cmd + strlen(task_cmd) - 1) = '\0';
}
//printf("test : %s\n", task_cmd);
//printf("apres manip\n");
// Determiner si le processus doit etre lance en fond de tache
int separator = ';';
if(ligne[commandes[i] - commandes[0] + strlen(commandes[i])] == '&')
separator = '&';
else if(ligne[commandes[i] - commandes[0] + strlen(commandes[i])] == '|')
separator = '|';
// Nothing ? Separator is ';'
if(separator == '|' && !commandes[i + 1])
separator = ';';
char *clean_cmd = malloc(sizeof(char) * (strlen(commandes[i]) + 1));
char *clean_file= malloc(sizeof(char) * (strlen(commandes[i]) + 1));
int redir = clean_redir(commandes[i], clean_cmd, clean_file);
//printf("redir : %d - cmd : %s - file :%s\n", redir, clean_cmd, clean_file);
// now don't use commandes[i], use clean_cmd
// if there is a redirection (0, 1 or 2) use clean_file
int nbmots = decouper(clean_cmd, " \t\n", mot, MaxMot);
//printf("test\n");
if(!nbmots)
{
}
else if(!strcmp(mot[0], "cd"))
{
char *path;
if(nbmots < 2)
path = strdup(getenv("HOME"));
else
path = strdup(mot[1]);
if(chdir(path) < 0)
perror("chdir");
}
else if(!strcmp(mot[0], "jobs"))
print_task();
else if(!strcmp(mot[0], "exit"))
exit(1);
else if(!strcmp(mot[0], "jkillall"))
{
int j;
for(j = 0; j < MAX_TASK; j++)
{
task *t = *(task_list + j);
if(t)
{
if(kill(t->pid, SIGINT) < 0)
perror("kill");
}
}
}
else
{
current_fg = -1;
int pfd[2];
if(separator == '|')
{
// the pipe needs to be created before fork
if(pipe(pfd) == -1)
{
perror("pipe");
continue;
}
before_pipe = pfd[0];
}
pid = fork();
if(pid > 0)
{
if(separator == ';')
{
current_fg = pid;
int statee;
if(waitpid(pid, &statee, 0 | WUNTRACED) < 0)
{
perror("waitpid");
}
//printf("Leave pid %d with state %d\n", pid, statee);
current_fg = -1;
//while(wait(NULL) != pid);
//remove_task(pid, state);
}
else if(separator == '&')
{
add_task(pid, strdup(task_cmd));
}
}
else if(pid == 0)
{
setpgid(getpid(), getpid());
signal(SIGINT, SIG_DFL);
signal(SIGCHLD, SIG_DFL);
signal(SIGTSTP, SIG_DFL);
if(before_pipe != -1)
{
//close(0);
dup2(before_pipe, 0);
}
// redirections en fonction de redir
if(redir == 1)
{
//redirection stdout
int out = open(clean_file, O_CREAT | O_WRONLY | O_TRUNC);
if(out < 0)
{
perror("open");
return -1;
}
dup2(out, 1);
}
else if(redir == 2)
{
int out = open(clean_file, O_WRONLY|O_CREAT|O_APPEND);
if(out < 0)
{
perror("open");
return -1;
}
dup2(out, 1);
}
else if(redir == 0)
{
int in = open(clean_file, O_RDONLY);
if(in < 0)
{
perror("open");
return -1;
}
dup2(in, 0);
}
if(separator == '&')
{
// redirect stdin to null
int devnull = open("/dev/null", O_RDONLY);
if (devnull < 0)
{
perror("open");
}
else
{
dup2(devnull, 0);
}
}
else if(separator == '|')
{
// supprimer la lecture
//close(pfd[0]);
dup2(pfd[1], 1);
}
for(i_dir = 0; dirs[i_dir] != NULL; i_dir++)
{
snprintf(pathname, sizeof pathname, "%s/%s", dirs[i_dir], mot[0]);
//printf("%s %s\n", pathname, mot);
execv(pathname, mot);
}
fprintf(stderr, "%s: not found\n", mot[0]);
exit(1);
}
else
{
perror("fork");
}
}
}
}
printf("Bye\n");
return 0;
}
|
the_stack_data/192330177.c | /*
Copyright (c) 2016, Alexey Frunze
2-clause BSD license.
*/
#ifdef __SMALLER_C_32__
#ifdef UNUSED
float modff(float value, float* iptr)
{
union
{
float f;
unsigned u;
} u;
unsigned tmp;
u.f = value;
tmp = u.u & 0x7FFFFFFF;
*iptr = u.f;
if (tmp == 0x7F800000)
{
// Return +INF/-INF as-is with fractional part of +0.0/-0.0
u.u &= 0x80000000;
}
// Return +0.0/-0.0 and NaN as-is in both integral and fractional parts
else if (tmp != 0 && tmp < 0x7F800000)
{
if (tmp >= ((127/*bias*/ + 23) << 23))
{
// Purely integral
u.u &= 0x80000000;
}
else if (tmp < (127/*bias*/ << 23))
{
// Purely fractional
u.u &= 0x80000000;
*iptr = u.f;
u.f = value;
}
else
{
int cnt = 127/*bias*/ + 23 - (tmp >> 23); // number of fract bits, 1 to 23
u.u &= -(1u << cnt);
*iptr = u.f;
u.f = value;
tmp = u.u & ((1u << cnt) - 1);
if (tmp)
{
// Normalize
int e = 0;
while (tmp < 0x00800000/*implicit 1*/)
tmp <<= 1, e++;
u.u = ((u.u & 0xFF800000) | (tmp & 0x007FFFFF)) - (e << 23);
}
else
{
// Integral
u.u &= 0x80000000;
}
}
}
return u.f;
}
#else
#ifdef __HUGE__
#define xbp "bp"
#define xsp "sp"
#define xbx "bx"
#else
#define xbp "ebp"
#define xsp "esp"
#define xbx "ebx"
#endif
float modff(float value, float* iptr)
{
asm
(
"mov eax, ["xbp"+8]\n"
"mov ebx, ["xbp"+12]\n"
#ifdef __HUGE__
"ror ebx, 4\n"
"mov ds, bx\n"
"shr ebx, 28\n"
#endif
"mov ["xbx"], eax\n" // preset *iptr=value for +/-0.0, +/-INF, NAN
"mov ecx, eax\n"
"shl ecx, 1\n" // shift the sign out
"jz .done\n" // done if +/-0.0
"cmp ecx, 0xFF000000\n"
"jb .finite\n"
"ja .done\n" // done if NAN
"and eax, 0x80000000\n" // return +0.0 for +INF, -0.0 for -INF
"jmp .done\n"
".finite:\n"
"sub "xsp", 4\n"
"fnstcw ["xbp"-2]\n" // save rounding
"mov ax, ["xbp"-2]\n"
"mov ah, 0x0c\n" // rounding towards 0 (AKA truncate)
"mov ["xbp"-4], ax\n"
"fld dword ["xbp"+8]\n"
"fld st0\n"
"fldcw ["xbp"-4]\n"
"frndint\n" // trunc(value)
"fst dword ["xbx"]\n" // *iptr = trunc(value)
"fldcw ["xbp"-2]\n" // restore rounding
"add "xsp", 4\n"
"fsubp\n" // value - trunc(value)
"fstp dword ["xbp"+8]\n"
"mov eax, ["xbp"+8]\n" // eax = value - trunc(value)
// almost done, copy the sign of *iptr into the returned value...
"mov ebx, dword ["xbx"]\n" // ebx = trunc(value)
"shl eax, 1\n"
"rcl ebx, 1\n"
"rcr eax, 1\n"
".done:"
);
}
#endif
double modf(double value, double* iptr)
{
return modff(value, iptr);
}
#endif
|
the_stack_data/34512215.c | // Tester code for assignment 5 part 1
// File: aesdsocket.c
// Author: Mukta Darekar
// Reference: https://docs.oracle.com/cd/E19620-01/805-4041/sockets-47146/index.html
// https://github.com/stockrt/queue.h/blob/master/sample.c
// https://github.com/cu-ecen-aeld/aesd-lectures/blob/master/lecture9/timer_thread.c
// Pre-processor directives
#include <stdlib.h>
#include <stdint.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <netinet/in.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <ctype.h>
#include <syslog.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <signal.h>
#include <sys/queue.h>
#include <pthread.h>
#include <sys/time.h>
// macro definition
#define TOTAL_MSG 3
#define ERROR 1
#define SUCCESS 0
#define MYPORT 9000
#define BUFFER_LEN 200
#define USE_AESD_CHAR_DEVICE 1
#ifdef USE_AESD_CHAR_DEVICE
#define DEF_FILEPATH "/dev/aesdchar"
#else
#define DEF_FILEPATH "/var/tmp/aesdsocketdata"
#endif
typedef struct
{
pthread_t thread;
int fd;
int acceptedfd;
struct in_addr sin_addr;
bool thread_complete_success;
bool complete_status_flag;
}thread_data;
typedef struct slist_data_s slist_data_t;
struct slist_data_s
{
thread_data params;
SLIST_ENTRY(slist_data_s) entries;
};
int sockfd;
int exit_on_signal=0;
pthread_mutex_t rwmutex = PTHREAD_MUTEX_INITIALIZER;
typedef struct
{
int fd;
bool timer_thread_success;
}timer_thread_data;
#ifndef USE_AESD_CHAR_DEVICE
// A thread which runs every 10sec of interval
// Assumes timer_create has configured for sigval.sival_ptr to point to the
// thread data used for the timer
static void timer_thread(union sigval sigval)
{
timer_thread_data* td = (timer_thread_data*) sigval.sival_ptr;
td->timer_thread_success = true;
char tmrbuffer[BUFFER_LEN];
time_t rtime;
time(&rtime);
struct tm *timestamp = localtime(&rtime);
size_t nbytes;
if((nbytes = strftime(tmrbuffer, BUFFER_LEN, "timestamp:%a, %d %b %Y %T %z\n", timestamp)) == 0)
{
syslog(LOG_ERR,"timestamp to string failed");
td->timer_thread_success = false;
}
if(pthread_mutex_lock(&rwmutex) != 0)
{
syslog(LOG_ERR, "pthread_mutex_lock failed");
td->timer_thread_success = false;
}
if(write(td->fd, tmrbuffer, nbytes) == -1)
{
syslog(LOG_ERR,"timestamp write failed");
td->timer_thread_success = false;
}
if(pthread_mutex_unlock(&rwmutex) != 0)
{
syslog(LOG_ERR, "pthread_mutex_unlock failed");
td->timer_thread_success = false;
}
//pthread_exit(NULL);
}
#endif
//Function: static void signal_handler(int signo)
//Inputs: signo - Signal number
static void signal_handler(int signo)
{
syslog(LOG_DEBUG, "in handler\n");
if(signo == SIGINT || signo==SIGTERM)
{
if(signo == SIGINT)
syslog(LOG_DEBUG, "Caught signal SIGINT, exiting\n");
else
syslog(LOG_DEBUG, "Caught signal SIGTERM, exiting\n");
shutdown(sockfd, SHUT_RDWR);
exit_on_signal = true;
}
}
void* packetRWthread(void* thread_param)
{
thread_data *thread_func_args = (thread_data*)thread_param;
bool status = true;
int req_size=0;
int size = BUFFER_LEN;
char *rebuffer = NULL;
char *buffer = (char*)malloc(sizeof(char)*BUFFER_LEN);
int nbytes = 0;
ssize_t nr = 0;
//int fd = 0;
sigset_t mask;
//Create signal set
if (sigemptyset(&mask) == -1)
{
syslog(LOG_ERR, "creating empty signal set failed");
status = false;
}
//Add signal SIGINT into created empty set
if (sigaddset(&mask, SIGINT) == -1)
{
syslog(LOG_ERR, "Adding SIGINT failed");
status = false;
}
//Add signal SIGTERM into created empty set
if (sigaddset(&mask, SIGTERM) == -1)
{
syslog(LOG_ERR, "Adding SIGTERM failed");
status = false;
}
//create or open file to store received packets
thread_func_args->fd = open(DEF_FILEPATH, O_CREAT | O_RDWR | O_TRUNC, 0666);
if (thread_func_args->fd == -1)
{//if error
syslog(LOG_ERR, "can't open or create file '%s'\n", DEF_FILEPATH);
status = false;
}
while(1)
{
nbytes = recv(thread_func_args->acceptedfd, buffer+req_size, BUFFER_LEN, 0);
if(nbytes == -1)
{
syslog(LOG_ERR,"receive failed");
status = false;
break;
}
if (nbytes ==0)
break;
req_size = req_size + nbytes;
if(size < (req_size+1))
{
size += BUFFER_LEN;
rebuffer = realloc(buffer,sizeof(char)*size);
if(rebuffer == NULL)
{
syslog(LOG_ERR,"realloc failed");
status = false;
break;
}
buffer = rebuffer;
}
if(strchr(buffer,'\n') != NULL)
break;
}
if(pthread_mutex_lock(&rwmutex) != 0)
{
syslog(LOG_ERR, "pthread_mutex_lock failed");
status = false;
}
// Block Signals
if (sigprocmask(SIG_BLOCK,&mask,NULL) == -1)
{
syslog(LOG_ERR,"sigprocmask failed");
status = false;
}
nr = write(thread_func_args->fd, buffer, req_size);
if (nr == -1)
{//if error
syslog(LOG_ERR, "can't write received string in file '%s'", DEF_FILEPATH);
status = false;
}
// Unblock signals
if (sigprocmask(SIG_UNBLOCK,&mask,NULL) == -1)
{
syslog(LOG_ERR,"sigprocmask failed");
status = false;
}
if(pthread_mutex_unlock(&rwmutex) != 0)
{
syslog(LOG_ERR, "pthread_mutex_unlock failed");
status = false;
}
#ifndef USE_AESD_CHAR_DEVICE
lseek(thread_func_args->fd, 0, SEEK_SET);
#endif
req_size = 0;
int ptr=0;
while(1)
{
if(pthread_mutex_lock(&rwmutex) != 0)
{
syslog(LOG_ERR, "pthread_mutex_lock failed");
status = false;
}
if (sigprocmask(SIG_BLOCK,&mask,NULL) == -1)
{
syslog(LOG_ERR,"sigprocmask failed");
status = false;
}
nr = read(thread_func_args->fd, &buffer[ptr], 1);
if (sigprocmask(SIG_UNBLOCK,&mask,NULL) == -1)
{
syslog(LOG_ERR,"sigprocmask failed");
status = false;
}
if(pthread_mutex_unlock(&rwmutex) != 0)
{
syslog(LOG_ERR, "pthread_mutex_unlock failed");
status = false;
}
if (nr == 1)
{
if(buffer[ptr] == '\n')
{
req_size = (ptr+1);
nbytes = send(thread_func_args->acceptedfd, buffer, req_size, 0);
if(nbytes != req_size)
{
syslog(LOG_ERR, "send failed");
break;
}
ptr=0;
memset(buffer, 0, req_size);
}
else
{
ptr++;
if(size < (ptr+1))
{
size += BUFFER_LEN;
rebuffer = realloc(buffer,sizeof(char)*size);
if(rebuffer == NULL)
{
syslog(LOG_ERR,"realloc failed");
status = false;
break;
}
buffer = rebuffer;
}
}
}
else if (nr == 0)
{
syslog(LOG_DEBUG, "read done");
break;
}
else
{
syslog(LOG_ERR, "read failed");
status = false;
break;
}
}
if (status == true)
{
syslog(LOG_DEBUG, "Successful");
}
syslog(LOG_DEBUG, "Closing connection from '%s'\n", inet_ntoa((struct in_addr)thread_func_args->sin_addr));
close(thread_func_args->acceptedfd);
close(thread_func_args->fd);
//status true
thread_func_args->thread_complete_success = status;
thread_func_args->complete_status_flag = true;
free(buffer);
free(rebuffer);
//pthread_exit(NULL);
return NULL;
}
int main(int argc, char* argv[])
{
openlog(NULL, LOG_CONS, LOG_USER);
struct sockaddr_in saddr;
bool exit_on_error = false;
int opt=1;
int acceptedfd;
//int fd;
socklen_t len;
int ret = 0;
slist_data_t *datap = NULL;
SLIST_HEAD(slisthead,slist_data_s) head;
SLIST_INIT(&head);
syslog(LOG_INFO, "aesdsocket code started\n");
// check if deamon needs to be started
if ((argc == 2) && (strcmp("-d", argv[1])==0))
{
// start deamon
pid_t pid = fork();
if (pid == -1)
{
syslog(LOG_ERR, "failed to fork");
exit(EXIT_FAILURE);
}
else if (pid > 0)
{
exit(EXIT_SUCCESS);
}
syslog(LOG_INFO, "fork successful\n");
pid_t sid = setsid();
if (sid == -1)
{
syslog(LOG_ERR, "failed to setsid");
exit(EXIT_FAILURE);
}
umask(0);
syslog(LOG_INFO, "SID: %d\n", sid);
if (chdir("/") == -1)
{
syslog(LOG_ERR, "failed to change dir");
exit(EXIT_FAILURE);
}
syslog(LOG_INFO, "chdir successful\n");
close(STDIN_FILENO);
close(STDOUT_FILENO);
close(STDERR_FILENO);
syslog(LOG_INFO, "daemon created\n");
}
// Set signal handler for SIGINT
if(signal(SIGINT, signal_handler) == SIG_ERR)
{
syslog(LOG_ERR, "Cannot handle SIGINT!\n");
exit_on_error = true;
goto EXITING;
}
// Set signal handler for SIGTERM
if(signal(SIGTERM, signal_handler) == SIG_ERR)
{
syslog(LOG_ERR, "Cannot handle SIGTERM!\n");
exit_on_error = true;
goto EXITING;
}
//create socket
sockfd = socket(PF_INET, SOCK_STREAM, 0);
if (sockfd == -1)
{
syslog(LOG_ERR, "socket creation failed\n");
exit_on_error = true;
goto EXITING;
}
syslog(LOG_INFO, "socket created\n");
//reuse socket
if(setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(int)) == -1)
{
syslog(LOG_ERR, "setsocketopt failed\n");
exit_on_error = true;
goto EXITING;
}
syslog(LOG_INFO, "socket created\n");
saddr.sin_family = PF_INET;
saddr.sin_addr.s_addr = htonl(INADDR_ANY);
saddr.sin_port = htons(MYPORT);
//bind socket at port number 9000
ret = bind(sockfd, (struct sockaddr *) &saddr, sizeof(struct sockaddr_in));
if (ret == -1)
{
syslog(LOG_ERR, "socket binding failed\n");
exit_on_error = true;
goto EXITING;
}
syslog(LOG_INFO, "bind successful\n");
//start listening at port 9000
ret = listen(sockfd, 10);
if (ret == -1)
{
syslog(LOG_ERR, "socket listening failed\n");
exit_on_error = true;
goto EXITING;
}
syslog(LOG_INFO, "listening\n");
/*
//create or open file to store received packets
fd = open(DEF_FILEPATH, O_CREAT | O_RDWR | O_APPEND | O_TRUNC, 0666);
if (fd == -1)
{//if error
syslog(LOG_ERR, "can't open or create file '%s'\n", DEF_FILEPATH);
exit_on_error = true;
goto EXITING;
}
*/
#ifndef USE_AESD_CHAR_DEVICE
timer_t timerid;
struct sigevent *sev = malloc(sizeof(struct sigevent));
timer_thread_data td;
int clock_id = CLOCK_MONOTONIC;
memset(sev,0,sizeof(struct sigevent));
memset(&td,0,sizeof(timer_thread_data));
td.fd = fd;
td.timer_thread_success = true;
//Setup a call to timer_thread passing in the td structure as the sigev_value argument
sev->sigev_notify = SIGEV_THREAD;
sev->sigev_value.sival_ptr = &td;
sev->sigev_notify_function = timer_thread;
if (timer_create(clock_id, sev, &timerid) != 0 )
{
syslog(LOG_ERR, "can't create timer_thread");
exit_on_error = true;
goto EXITING;
}
else
{
struct timespec timer_val;
ret = clock_gettime(clock_id, &timer_val);
if(ret == -1)
{
syslog(LOG_ERR, "clock_gettime failed");
exit_on_error = true;
goto EXITING;
}
struct itimerspec interval;
interval.it_interval.tv_sec = 10;
interval.it_interval.tv_nsec = 0;
interval.it_value.tv_sec = timer_val.tv_sec + interval.it_interval.tv_sec;
interval.it_value.tv_nsec = timer_val.tv_nsec + interval.it_interval.tv_nsec;
if( interval.it_value.tv_nsec > 1000000000L )
{
interval.it_value.tv_nsec -= 1000000000L;
interval.it_value.tv_sec += 1;
}
if(timer_settime(timerid, TIMER_ABSTIME, &interval, NULL ) != 0 )
{
syslog(LOG_ERR, "timer_settime failed");
exit_on_error = true;
goto EXITING;
}
}
#endif
while(exit_on_signal==0)
{
len = sizeof(struct sockaddr);
//accept connection
acceptedfd = accept(sockfd, (struct sockaddr *) &saddr, &len);
if(exit_on_signal || exit_on_error)
break;
if (acceptedfd == -1)
{
syslog(LOG_ERR, "socket accepting failed\n");
exit_on_error = true;
goto EXITING;
}
if(exit_on_signal || exit_on_error)
break;
syslog(LOG_DEBUG, "Accepted connection from '%s'\n", inet_ntoa((struct in_addr)saddr.sin_addr));
datap = malloc(sizeof(slist_data_t));
if (datap == NULL)
{
syslog(LOG_ERR, "malloc failed\n");
exit_on_error = true;
goto EXITING;
}
SLIST_INSERT_HEAD(&head,datap,entries);
datap->params.acceptedfd = acceptedfd;
datap->params.complete_status_flag = false;
datap->params.thread_complete_success = false;
datap->params.sin_addr = saddr.sin_addr;
//datap->params.fd=fd;
pthread_create(&(datap->params.thread), NULL, &packetRWthread, (void*)&(datap->params));
SLIST_FOREACH(datap,&head,entries)
{
if (datap->params.complete_status_flag == true)
pthread_join(datap->params.thread,NULL);
else
continue;
}
}
EXITING:
if (exit_on_error && exit_on_signal==false)
syslog(LOG_DEBUG, "exiting on failure\n");
else
syslog(LOG_DEBUG, "exiting on signal\n");
//if(acceptedfd)
// close(acceptedfd);
if(sockfd)
close(sockfd);
#ifndef USE_AESD_CHAR_DEVICE
if(fd)
{
close(fd);
remove(DEF_FILEPATH);
}
#endif
SLIST_FOREACH(datap,&head,entries)
{
if (datap->params.complete_status_flag == false)
pthread_cancel(datap->params.thread);
}
while (!SLIST_EMPTY(&head))
{
datap = SLIST_FIRST(&head);
SLIST_REMOVE_HEAD(&head, entries);
free(datap);
datap = NULL;
}
#ifndef USE_AESD_CHAR_DEVICE
if(td.timer_thread_success == true)
{
syslog(LOG_DEBUG,"deleting timerid");
if (timer_delete(timerid) != 0)
{
syslog(LOG_ERR,"Error in deleting timerid");
exit_on_error = true;
}
}
free(sev);
#endif
pthread_mutex_destroy(&rwmutex);
closelog();
if (exit_on_error && exit_on_signal==false)
return 1;
else
return 0;
}
|
the_stack_data/89201363.c | #include <stdio.h>
#include <stdlib.h>
int main()
{
int a,b,i,sum=0;
printf("Enter two different numbers.\n");
printf("Enter the smaller/lower number: ");
scanf("%d",&a);
printf("Enter the bigger/higher number: ");
scanf("%d",&b);
for (i=a;i<=b;i++)
sum+=i;
printf("\nThe sum from lower to higher number is %d.\n",sum);
return 0;
}
|
the_stack_data/14128.c | /*
* Copyright (C) 2009-2011 Nick Johnson <nickbjohnson4224 at gmail.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
/****************************************************************************
* strtof
*
* Convert a string to a floating point number.
*/
float strtof(const char *nptr, char **endptr) {
return strtold(nptr, endptr);
}
|
the_stack_data/54824974.c | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
size_t block_size = 2;
char c;
char* str = malloc(block_size);
int starting_address = str, counter = 0;
int current_size = 0;
while ((c = getc(stdin)) != '\n') {
if (current_size == block_size) {
block_size *= 2;
int current_address = str;
str = starting_address;
realloc(str, block_size);
str = current_address;
}
*str = c;
str++;
current_size++;
}
*str = '\0';
str = starting_address;
printf("%s", str);
}
|
the_stack_data/187641847.c | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
typedef void (*sighandler_t)(int);
sighandler_t
trap_signal(int sig, sighandler_t handler)
{
struct sigaction act, old;
act.sa_handler = handler;
sigemptyset(&act.sa_mask);
act.sa_flags = SA_RESTART;
if (sigaction(sig, &act, &old) < 0)
return NULL;
return old.sa_handler;
}
void
msg_sleep(int sig)
{
puts("got SIGINT, sleep...");
sleep(3);
}
int
main(int argc, char *argv[])
{
trap_signal(SIGINT, msg_sleep);
pause();
exit(0);
}
|
the_stack_data/126701985.c | /* ------------------------------------------------------------------------ *
* file: base64_stringencode.c v1.0 *
* purpose: tests encoding/decoding strings with base64 *
* author: 02/23/2009 Frank4DD *
* *
* source: http://base64.sourceforge.net/b64.c for encoding *
* http://en.literateprograms.org/Base64_(C) for decoding *
* ------------------------------------------------------------------------ */
#include <stdio.h>
#include <string.h>
/* ---- Base64 Encoding/Decoding Table --- */
char b64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
/* decodeblock - decode 4 '6-bit' characters into 3 8-bit binary bytes */
void decodeblock(unsigned char in[], char *clrstr) {
unsigned char out[4];
out[0] = in[0] << 2 | in[1] >> 4;
out[1] = in[1] << 4 | in[2] >> 2;
out[2] = in[2] << 6 | in[3] >> 0;
out[3] = '\0';
strncat(clrstr, out, sizeof(out));
}
void b64_decode(char *b64src, char *clrdst) {
int c, phase, i;
unsigned char in[4];
char *p;
clrdst[0] = '\0';
phase = 0; i=0;
while(b64src[i]) {
c = (int) b64src[i];
if(c == '=') {
decodeblock(in, clrdst);
break;
}
p = strchr(b64, c);
if(p) {
in[phase] = p - b64;
phase = (phase + 1) % 4;
if(phase == 0) {
decodeblock(in, clrdst);
in[0]=in[1]=in[2]=in[3]=0;
}
}
i++;
}
}
/* encodeblock - encode 3 8-bit binary bytes as 4 '6-bit' characters */
void encodeblock( unsigned char in[], char b64str[], int len ) {
unsigned char out[5];
out[0] = b64[ in[0] >> 2 ];
out[1] = b64[ ((in[0] & 0x03) << 4) | ((in[1] & 0xf0) >> 4) ];
out[2] = (unsigned char) (len > 1 ? b64[ ((in[1] & 0x0f) << 2) |
((in[2] & 0xc0) >> 6) ] : '=');
out[3] = (unsigned char) (len > 2 ? b64[ in[2] & 0x3f ] : '=');
out[4] = '\0';
strncat(b64str, out, sizeof(out));
}
/* encode - base64 encode a stream, adding padding if needed */
void b64_encode(char *clrstr, char *b64dst) {
unsigned char in[3];
int i, len = 0;
int j = 0;
b64dst[0] = '\0';
while(clrstr[j]) {
len = 0;
for(i=0; i<3; i++) {
in[i] = (unsigned char) clrstr[j];
if(clrstr[j]) {
len++; j++;
}
else in[i] = 0;
}
if( len ) {
encodeblock( in, b64dst, len );
}
}
}
int main() {
//char mysrc[] = "My bonnie is over the ocean...";
char mysrc[] = "My bonnie is over the ";
char myb64[1024] = "";
char mydst[1024] = "";
b64_encode(mysrc, myb64);
printf("The string\n[%s]\nencodes into base64 as:\n[%s]\n", mysrc, myb64);
printf("\n");
b64_decode(myb64, mydst);
printf("The string\n[%s]\ndecodes from base64 as:\n[%s]\n", myb64, mydst);
return 0;
} |
the_stack_data/90762405.c | /*
$Id$
*/
#include <stdlib.h>
#include <stdio.h>
/******************************
******************************/
double* paw_alloc_1d_array(int n)
{
double* array;
int i;
array = (double*) malloc(n*sizeof(double));
if (array==0)
{
printf("memory allocation problem in alloc_1d_array\n");
abort();
}
for (i=0;i<n;i++)
array[i]=0;
return array;
}
/******************************
******************************/
void paw_dealloc_1d_array(double* array)
{
free(array);
}
/******************************
******************************/
double** paw_alloc_2d_array(int n1,int n2)
{
double** array;
int i;
int j;
array = (double**) malloc(n1*sizeof(double*));
if (array==0)
{
printf("memory allocation problem in alloc_2d_array\n");
abort();
}
for (i=0;i<n1;i++)
{
array[i] = (double*) malloc(n2*sizeof(double));
if (array==0)
{
printf("memory allocation problem in alloc_1d_array\n");
abort();
}
}
for (i=0;i<n1;i++)
{
for (j=0;j<n2;j++)
array[i][j] = 0.0;
}
return array;
}
/******************************
******************************/
void paw_dealloc_2d_array(int n1,int n2,double** array)
{
int i;
for (i=0;i<n1;i++)
free(array[i]);
free(array);
}
|
the_stack_data/1053137.c | #include<stdio.h>
int main (void){
int cont1, cont2;
scanf("%d",&cont1);
printf("texto qualquer\n");
cont1 = cont2;
if( cont1 > cont2 ){
cont2 = cont1 ;
}
else
printf("qualquer coisa\n");
exit(0);
}
|
the_stack_data/50137908.c | extern int __VERIFIER_nondet_int(void);
/* Generated by CIL v. 1.3.7 */
/* print_CIL_Input is true */
#line 2 "libacc.c"
struct JoinPoint {
void **(*fp)(struct JoinPoint * ) ;
void **args ;
int argsCount ;
char const **argsType ;
void *(*arg)(int , struct JoinPoint * ) ;
char const *(*argType)(int , struct JoinPoint * ) ;
void **retValue ;
char const *retType ;
char const *funcName ;
char const *targetName ;
char const *fileName ;
char const *kind ;
void *excep_return ;
};
#line 18 "libacc.c"
struct __UTAC__CFLOW_FUNC {
int (*func)(int , int ) ;
int val ;
struct __UTAC__CFLOW_FUNC *next ;
};
#line 18 "libacc.c"
struct __UTAC__EXCEPTION {
void *jumpbuf ;
unsigned long long prtValue ;
int pops ;
struct __UTAC__CFLOW_FUNC *cflowfuncs ;
};
#line 211 "/usr/lib/gcc/x86_64-linux-gnu/4.4.5/include/stddef.h"
typedef unsigned long size_t;
#line 76 "libacc.c"
struct __ACC__ERR {
void *v ;
struct __ACC__ERR *next ;
};
#line 1 "Test.o"
#pragma merger(0,"Test.i","")
#line 359 "/usr/include/stdio.h"
extern int printf(char const * __restrict __format , ...) ;
#line 688
extern int puts(char const *__s ) ;
#line 35 "ClientLib.h"
void setClientPrivateKey(int handle , int value ) ;
#line 39
int createClientKeyringEntry(int handle ) ;
#line 41
int getClientKeyringUser(int handle , int index ) ;
#line 43
void setClientKeyringUser(int handle , int index , int value ) ;
#line 45
int getClientKeyringPublicKey(int handle , int index ) ;
#line 47
void setClientKeyringPublicKey(int handle , int index , int value ) ;
#line 51
void setClientForwardReceiver(int handle , int value ) ;
#line 55
void setClientId(int handle , int value ) ;
#line 8 "featureselect.h"
int __SELECTED_FEATURE_Base ;
#line 11 "featureselect.h"
int __SELECTED_FEATURE_Keys ;
#line 14 "featureselect.h"
int __SELECTED_FEATURE_Encrypt ;
#line 17 "featureselect.h"
int __SELECTED_FEATURE_AutoResponder ;
#line 20 "featureselect.h"
int __SELECTED_FEATURE_AddressBook ;
#line 23 "featureselect.h"
int __SELECTED_FEATURE_Sign ;
#line 26 "featureselect.h"
int __SELECTED_FEATURE_Forward ;
#line 29 "featureselect.h"
int __SELECTED_FEATURE_Verify ;
#line 32 "featureselect.h"
int __SELECTED_FEATURE_Decrypt ;
#line 35 "featureselect.h"
int __GUIDSL_ROOT_PRODUCTION ;
#line 37 "featureselect.h"
int __GUIDSL_NON_TERMINAL_main ;
#line 43
void select_features(void) ;
#line 45
void select_helpers(void) ;
#line 47
int valid_product(void) ;
#line 17 "Client.h"
int is_queue_empty(void) ;
#line 19
int get_queued_client(void) ;
#line 21
int get_queued_email(void) ;
#line 26
void outgoing(int client , int msg ) ;
#line 35
void sendEmail(int sender , int receiver ) ;
#line 44
void generateKeyPair(int client , int seed ) ;
#line 2 "Test.h"
int bob ;
#line 5 "Test.h"
int rjh ;
#line 8 "Test.h"
int chuck ;
#line 11
void setup_bob(int bob___0 ) ;
#line 14
void setup_rjh(int rjh___0 ) ;
#line 17
void setup_chuck(int chuck___0 ) ;
#line 23
void bobToRjh(void) ;
#line 26
void rjhToBob(void) ;
#line 29
void test(void) ;
#line 32
void setup(void) ;
#line 35
int main(void) ;
#line 36
void bobKeyAdd(void) ;
#line 39
void bobKeyAddChuck(void) ;
#line 42
void rjhKeyAdd(void) ;
#line 45
void rjhKeyAddChuck(void) ;
#line 48
void chuckKeyAdd(void) ;
#line 51
void bobKeyChange(void) ;
#line 54
void rjhKeyChange(void) ;
#line 57
void rjhDeletePrivateKey(void) ;
#line 60
void chuckKeyAddRjh(void) ;
#line 61
void rjhEnableForwarding(void) ;
#line 18 "Test.c"
void setup_bob__wrappee__Base(int bob___0 )
{
{
{
#line 19
setClientId(bob___0, bob___0);
}
#line 1330 "Test.c"
return;
}
}
#line 23 "Test.c"
void setup_bob(int bob___0 )
{
{
{
#line 24
setup_bob__wrappee__Base(bob___0);
#line 25
setClientPrivateKey(bob___0, 123);
}
#line 1352 "Test.c"
return;
}
}
#line 33 "Test.c"
void setup_rjh__wrappee__Base(int rjh___0 )
{
{
{
#line 34
setClientId(rjh___0, rjh___0);
}
#line 1372 "Test.c"
return;
}
}
#line 40 "Test.c"
void setup_rjh(int rjh___0 )
{
{
{
#line 42
setup_rjh__wrappee__Base(rjh___0);
#line 43
setClientPrivateKey(rjh___0, 456);
}
#line 1394 "Test.c"
return;
}
}
#line 50 "Test.c"
void setup_chuck__wrappee__Base(int chuck___0 )
{
{
{
#line 51
setClientId(chuck___0, chuck___0);
}
#line 1414 "Test.c"
return;
}
}
#line 57 "Test.c"
void setup_chuck(int chuck___0 )
{
{
{
#line 58
setup_chuck__wrappee__Base(chuck___0);
#line 59
setClientPrivateKey(chuck___0, 789);
}
#line 1436 "Test.c"
return;
}
}
#line 69 "Test.c"
void bobToRjh(void)
{ int tmp ;
int tmp___0 ;
int tmp___1 ;
{
{
#line 71
puts("Please enter a subject and a message body.\n");
#line 72
sendEmail(bob, rjh);
#line 73
tmp___1 = is_queue_empty();
}
#line 73
if (tmp___1) {
} else {
{
#line 74
tmp = get_queued_email();
#line 74
tmp___0 = get_queued_client();
#line 74
outgoing(tmp___0, tmp);
}
}
#line 1463 "Test.c"
return;
}
}
#line 81 "Test.c"
void rjhToBob(void)
{
{
{
#line 83
puts("Please enter a subject and a message body.\n");
#line 84
sendEmail(rjh, bob);
}
#line 1485 "Test.c"
return;
}
}
#line 88 "Test.c"
#line 95 "Test.c"
void setup(void)
{ char const * __restrict __cil_tmp1 ;
char const * __restrict __cil_tmp2 ;
char const * __restrict __cil_tmp3 ;
{
{
#line 96
bob = 1;
#line 97
setup_bob(bob);
#line 98
__cil_tmp1 = (char const * __restrict )"bob: %d\n";
#line 98
printf(__cil_tmp1, bob);
#line 100
rjh = 2;
#line 101
setup_rjh(rjh);
#line 102
__cil_tmp2 = (char const * __restrict )"rjh: %d\n";
#line 102
printf(__cil_tmp2, rjh);
#line 104
chuck = 3;
#line 105
setup_chuck(chuck);
#line 106
__cil_tmp3 = (char const * __restrict )"chuck: %d\n";
#line 106
printf(__cil_tmp3, chuck);
}
#line 1556 "Test.c"
return;
}
}
#line 112 "Test.c"
int main(void)
{ int retValue_acc ;
int tmp ;
{
{
#line 113
select_helpers();
#line 114
select_features();
#line 115
tmp = valid_product();
}
#line 115
if (tmp) {
{
#line 116
setup();
#line 117
test();
}
} else {
}
#line 1587 "Test.c"
return (retValue_acc);
}
}
#line 125 "Test.c"
void bobKeyAdd(void)
{ int tmp ;
int tmp___0 ;
char const * __restrict __cil_tmp3 ;
char const * __restrict __cil_tmp4 ;
{
{
#line 126
createClientKeyringEntry(bob);
#line 127
setClientKeyringUser(bob, 0, 2);
#line 128
setClientKeyringPublicKey(bob, 0, 456);
#line 129
puts("bob added rjhs key");
#line 130
tmp = getClientKeyringUser(bob, 0);
#line 130
__cil_tmp3 = (char const * __restrict )"%d\n";
#line 130
printf(__cil_tmp3, tmp);
#line 131
tmp___0 = getClientKeyringPublicKey(bob, 0);
#line 131
__cil_tmp4 = (char const * __restrict )"%d\n";
#line 131
printf(__cil_tmp4, tmp___0);
}
#line 1621 "Test.c"
return;
}
}
#line 137 "Test.c"
void rjhKeyAdd(void)
{
{
{
#line 138
createClientKeyringEntry(rjh);
#line 139
setClientKeyringUser(rjh, 0, 1);
#line 140
setClientKeyringPublicKey(rjh, 0, 123);
}
#line 1645 "Test.c"
return;
}
}
#line 146 "Test.c"
void rjhKeyAddChuck(void)
{
{
{
#line 147
createClientKeyringEntry(rjh);
#line 148
setClientKeyringUser(rjh, 0, 3);
#line 149
setClientKeyringPublicKey(rjh, 0, 789);
}
#line 1669 "Test.c"
return;
}
}
#line 156 "Test.c"
void bobKeyAddChuck(void)
{
{
{
#line 157
createClientKeyringEntry(bob);
#line 158
setClientKeyringUser(bob, 1, 3);
#line 159
setClientKeyringPublicKey(bob, 1, 789);
}
#line 1693 "Test.c"
return;
}
}
#line 165 "Test.c"
void chuckKeyAdd(void)
{
{
{
#line 166
createClientKeyringEntry(chuck);
#line 167
setClientKeyringUser(chuck, 0, 1);
#line 168
setClientKeyringPublicKey(chuck, 0, 123);
}
#line 1717 "Test.c"
return;
}
}
#line 174 "Test.c"
void chuckKeyAddRjh(void)
{
{
{
#line 175
createClientKeyringEntry(chuck);
#line 176
setClientKeyringUser(chuck, 0, 2);
#line 177
setClientKeyringPublicKey(chuck, 0, 456);
}
#line 1741 "Test.c"
return;
}
}
#line 183 "Test.c"
void rjhDeletePrivateKey(void)
{
{
{
#line 184
setClientPrivateKey(rjh, 0);
}
#line 1761 "Test.c"
return;
}
}
#line 190 "Test.c"
void bobKeyChange(void)
{
{
{
#line 191
generateKeyPair(bob, 777);
}
#line 1781 "Test.c"
return;
}
}
#line 197 "Test.c"
void rjhKeyChange(void)
{
{
{
#line 198
generateKeyPair(rjh, 666);
}
#line 1801 "Test.c"
return;
}
}
#line 204 "Test.c"
void rjhEnableForwarding(void)
{
{
{
#line 205
setClientForwardReceiver(rjh, chuck);
}
#line 1821 "Test.c"
return;
}
}
#line 1 "featureselect.o"
#pragma merger(0,"featureselect.i","")
#line 41 "featureselect.h"
int select_one(void) ;
#line 8 "featureselect.c"
int select_one(void)
{ int retValue_acc ;
int choice = __VERIFIER_nondet_int();
{
#line 84 "featureselect.c"
retValue_acc = choice;
#line 86
return (retValue_acc);
#line 93
return (retValue_acc);
}
}
#line 14 "featureselect.c"
void select_features(void)
{
{
#line 115 "featureselect.c"
return;
}
}
#line 20 "featureselect.c"
void select_helpers(void)
{
{
#line 133 "featureselect.c"
return;
}
}
#line 25 "featureselect.c"
int valid_product(void)
{ int retValue_acc ;
{
#line 151 "featureselect.c"
retValue_acc = 1;
#line 153
return (retValue_acc);
#line 160
return (retValue_acc);
}
}
#line 1 "EmailLib.o"
#pragma merger(0,"EmailLib.i","")
#line 4 "EmailLib.h"
int initEmail(void) ;
#line 6
int getEmailId(int handle ) ;
#line 8
void setEmailId(int handle , int value ) ;
#line 10
int getEmailFrom(int handle ) ;
#line 12
void setEmailFrom(int handle , int value ) ;
#line 14
int getEmailTo(int handle ) ;
#line 16
void setEmailTo(int handle , int value ) ;
#line 18
char *getEmailSubject(int handle ) ;
#line 20
void setEmailSubject(int handle , char *value ) ;
#line 22
char *getEmailBody(int handle ) ;
#line 24
void setEmailBody(int handle , char *value ) ;
#line 26
int isEncrypted(int handle ) ;
#line 28
void setEmailIsEncrypted(int handle , int value ) ;
#line 30
int getEmailEncryptionKey(int handle ) ;
#line 32
void setEmailEncryptionKey(int handle , int value ) ;
#line 34
int isSigned(int handle ) ;
#line 36
void setEmailIsSigned(int handle , int value ) ;
#line 38
int getEmailSignKey(int handle ) ;
#line 40
void setEmailSignKey(int handle , int value ) ;
#line 42
int isVerified(int handle ) ;
#line 44
void setEmailIsSignatureVerified(int handle , int value ) ;
#line 5 "EmailLib.c"
int __ste_Email_counter = 0;
#line 7 "EmailLib.c"
int initEmail(void)
{ int retValue_acc ;
{
#line 12 "EmailLib.c"
if (__ste_Email_counter < 2) {
#line 670
__ste_Email_counter = __ste_Email_counter + 1;
#line 670
retValue_acc = __ste_Email_counter;
#line 672
return (retValue_acc);
} else {
#line 678 "EmailLib.c"
retValue_acc = -1;
#line 680
return (retValue_acc);
}
#line 687 "EmailLib.c"
return (retValue_acc);
}
}
#line 15 "EmailLib.c"
int __ste_email_id0 = 0;
#line 17 "EmailLib.c"
int __ste_email_id1 = 0;
#line 19 "EmailLib.c"
int getEmailId(int handle )
{ int retValue_acc ;
{
#line 26 "EmailLib.c"
if (handle == 1) {
#line 716
retValue_acc = __ste_email_id0;
#line 718
return (retValue_acc);
} else {
#line 720
if (handle == 2) {
#line 725
retValue_acc = __ste_email_id1;
#line 727
return (retValue_acc);
} else {
#line 733 "EmailLib.c"
retValue_acc = 0;
#line 735
return (retValue_acc);
}
}
#line 742 "EmailLib.c"
return (retValue_acc);
}
}
#line 29 "EmailLib.c"
void setEmailId(int handle , int value )
{
{
#line 35
if (handle == 1) {
#line 31
__ste_email_id0 = value;
} else {
#line 32
if (handle == 2) {
#line 33
__ste_email_id1 = value;
} else {
}
}
#line 773 "EmailLib.c"
return;
}
}
#line 37 "EmailLib.c"
int __ste_email_from0 = 0;
#line 39 "EmailLib.c"
int __ste_email_from1 = 0;
#line 41 "EmailLib.c"
int getEmailFrom(int handle )
{ int retValue_acc ;
{
#line 48 "EmailLib.c"
if (handle == 1) {
#line 798
retValue_acc = __ste_email_from0;
#line 800
return (retValue_acc);
} else {
#line 802
if (handle == 2) {
#line 807
retValue_acc = __ste_email_from1;
#line 809
return (retValue_acc);
} else {
#line 815 "EmailLib.c"
retValue_acc = 0;
#line 817
return (retValue_acc);
}
}
#line 824 "EmailLib.c"
return (retValue_acc);
}
}
#line 51 "EmailLib.c"
void setEmailFrom(int handle , int value )
{
{
#line 57
if (handle == 1) {
#line 53
__ste_email_from0 = value;
} else {
#line 54
if (handle == 2) {
#line 55
__ste_email_from1 = value;
} else {
}
}
#line 855 "EmailLib.c"
return;
}
}
#line 59 "EmailLib.c"
int __ste_email_to0 = 0;
#line 61 "EmailLib.c"
int __ste_email_to1 = 0;
#line 63 "EmailLib.c"
int getEmailTo(int handle )
{ int retValue_acc ;
{
#line 70 "EmailLib.c"
if (handle == 1) {
#line 880
retValue_acc = __ste_email_to0;
#line 882
return (retValue_acc);
} else {
#line 884
if (handle == 2) {
#line 889
retValue_acc = __ste_email_to1;
#line 891
return (retValue_acc);
} else {
#line 897 "EmailLib.c"
retValue_acc = 0;
#line 899
return (retValue_acc);
}
}
#line 906 "EmailLib.c"
return (retValue_acc);
}
}
#line 73 "EmailLib.c"
void setEmailTo(int handle , int value )
{
{
#line 79
if (handle == 1) {
#line 75
__ste_email_to0 = value;
} else {
#line 76
if (handle == 2) {
#line 77
__ste_email_to1 = value;
} else {
}
}
#line 937 "EmailLib.c"
return;
}
}
#line 81 "EmailLib.c"
char *__ste_email_subject0 ;
#line 83 "EmailLib.c"
char *__ste_email_subject1 ;
#line 85 "EmailLib.c"
char *getEmailSubject(int handle )
{ char *retValue_acc ;
void *__cil_tmp3 ;
{
#line 92 "EmailLib.c"
if (handle == 1) {
#line 962
retValue_acc = __ste_email_subject0;
#line 964
return (retValue_acc);
} else {
#line 966
if (handle == 2) {
#line 971
retValue_acc = __ste_email_subject1;
#line 973
return (retValue_acc);
} else {
#line 979 "EmailLib.c"
__cil_tmp3 = (void *)0;
#line 979
retValue_acc = (char *)__cil_tmp3;
#line 981
return (retValue_acc);
}
}
#line 988 "EmailLib.c"
return (retValue_acc);
}
}
#line 95 "EmailLib.c"
void setEmailSubject(int handle , char *value )
{
{
#line 101
if (handle == 1) {
#line 97
__ste_email_subject0 = value;
} else {
#line 98
if (handle == 2) {
#line 99
__ste_email_subject1 = value;
} else {
}
}
#line 1019 "EmailLib.c"
return;
}
}
#line 103 "EmailLib.c"
char *__ste_email_body0 = (char *)0;
#line 105 "EmailLib.c"
char *__ste_email_body1 = (char *)0;
#line 107 "EmailLib.c"
char *getEmailBody(int handle )
{ char *retValue_acc ;
void *__cil_tmp3 ;
{
#line 114 "EmailLib.c"
if (handle == 1) {
#line 1044
retValue_acc = __ste_email_body0;
#line 1046
return (retValue_acc);
} else {
#line 1048
if (handle == 2) {
#line 1053
retValue_acc = __ste_email_body1;
#line 1055
return (retValue_acc);
} else {
#line 1061 "EmailLib.c"
__cil_tmp3 = (void *)0;
#line 1061
retValue_acc = (char *)__cil_tmp3;
#line 1063
return (retValue_acc);
}
}
#line 1070 "EmailLib.c"
return (retValue_acc);
}
}
#line 117 "EmailLib.c"
void setEmailBody(int handle , char *value )
{
{
#line 123
if (handle == 1) {
#line 119
__ste_email_body0 = value;
} else {
#line 120
if (handle == 2) {
#line 121
__ste_email_body1 = value;
} else {
}
}
#line 1101 "EmailLib.c"
return;
}
}
#line 125 "EmailLib.c"
int __ste_email_isEncrypted0 = 0;
#line 127 "EmailLib.c"
int __ste_email_isEncrypted1 = 0;
#line 129 "EmailLib.c"
int isEncrypted(int handle )
{ int retValue_acc ;
{
#line 136 "EmailLib.c"
if (handle == 1) {
#line 1126
retValue_acc = __ste_email_isEncrypted0;
#line 1128
return (retValue_acc);
} else {
#line 1130
if (handle == 2) {
#line 1135
retValue_acc = __ste_email_isEncrypted1;
#line 1137
return (retValue_acc);
} else {
#line 1143 "EmailLib.c"
retValue_acc = 0;
#line 1145
return (retValue_acc);
}
}
#line 1152 "EmailLib.c"
return (retValue_acc);
}
}
#line 139 "EmailLib.c"
void setEmailIsEncrypted(int handle , int value )
{
{
#line 145
if (handle == 1) {
#line 141
__ste_email_isEncrypted0 = value;
} else {
#line 142
if (handle == 2) {
#line 143
__ste_email_isEncrypted1 = value;
} else {
}
}
#line 1183 "EmailLib.c"
return;
}
}
#line 147 "EmailLib.c"
int __ste_email_encryptionKey0 = 0;
#line 149 "EmailLib.c"
int __ste_email_encryptionKey1 = 0;
#line 151 "EmailLib.c"
int getEmailEncryptionKey(int handle )
{ int retValue_acc ;
{
#line 158 "EmailLib.c"
if (handle == 1) {
#line 1208
retValue_acc = __ste_email_encryptionKey0;
#line 1210
return (retValue_acc);
} else {
#line 1212
if (handle == 2) {
#line 1217
retValue_acc = __ste_email_encryptionKey1;
#line 1219
return (retValue_acc);
} else {
#line 1225 "EmailLib.c"
retValue_acc = 0;
#line 1227
return (retValue_acc);
}
}
#line 1234 "EmailLib.c"
return (retValue_acc);
}
}
#line 161 "EmailLib.c"
void setEmailEncryptionKey(int handle , int value )
{
{
#line 167
if (handle == 1) {
#line 163
__ste_email_encryptionKey0 = value;
} else {
#line 164
if (handle == 2) {
#line 165
__ste_email_encryptionKey1 = value;
} else {
}
}
#line 1265 "EmailLib.c"
return;
}
}
#line 169 "EmailLib.c"
int __ste_email_isSigned0 = 0;
#line 171 "EmailLib.c"
int __ste_email_isSigned1 = 0;
#line 173 "EmailLib.c"
int isSigned(int handle )
{ int retValue_acc ;
{
#line 180 "EmailLib.c"
if (handle == 1) {
#line 1290
retValue_acc = __ste_email_isSigned0;
#line 1292
return (retValue_acc);
} else {
#line 1294
if (handle == 2) {
#line 1299
retValue_acc = __ste_email_isSigned1;
#line 1301
return (retValue_acc);
} else {
#line 1307 "EmailLib.c"
retValue_acc = 0;
#line 1309
return (retValue_acc);
}
}
#line 1316 "EmailLib.c"
return (retValue_acc);
}
}
#line 183 "EmailLib.c"
void setEmailIsSigned(int handle , int value )
{
{
#line 189
if (handle == 1) {
#line 185
__ste_email_isSigned0 = value;
} else {
#line 186
if (handle == 2) {
#line 187
__ste_email_isSigned1 = value;
} else {
}
}
#line 1347 "EmailLib.c"
return;
}
}
#line 191 "EmailLib.c"
int __ste_email_signKey0 = 0;
#line 193 "EmailLib.c"
int __ste_email_signKey1 = 0;
#line 195 "EmailLib.c"
int getEmailSignKey(int handle )
{ int retValue_acc ;
{
#line 202 "EmailLib.c"
if (handle == 1) {
#line 1372
retValue_acc = __ste_email_signKey0;
#line 1374
return (retValue_acc);
} else {
#line 1376
if (handle == 2) {
#line 1381
retValue_acc = __ste_email_signKey1;
#line 1383
return (retValue_acc);
} else {
#line 1389 "EmailLib.c"
retValue_acc = 0;
#line 1391
return (retValue_acc);
}
}
#line 1398 "EmailLib.c"
return (retValue_acc);
}
}
#line 205 "EmailLib.c"
void setEmailSignKey(int handle , int value )
{
{
#line 211
if (handle == 1) {
#line 207
__ste_email_signKey0 = value;
} else {
#line 208
if (handle == 2) {
#line 209
__ste_email_signKey1 = value;
} else {
}
}
#line 1429 "EmailLib.c"
return;
}
}
#line 213 "EmailLib.c"
int __ste_email_isSignatureVerified0 ;
#line 215 "EmailLib.c"
int __ste_email_isSignatureVerified1 ;
#line 217 "EmailLib.c"
int isVerified(int handle )
{ int retValue_acc ;
{
#line 224 "EmailLib.c"
if (handle == 1) {
#line 1454
retValue_acc = __ste_email_isSignatureVerified0;
#line 1456
return (retValue_acc);
} else {
#line 1458
if (handle == 2) {
#line 1463
retValue_acc = __ste_email_isSignatureVerified1;
#line 1465
return (retValue_acc);
} else {
#line 1471 "EmailLib.c"
retValue_acc = 0;
#line 1473
return (retValue_acc);
}
}
#line 1480 "EmailLib.c"
return (retValue_acc);
}
}
#line 227 "EmailLib.c"
void setEmailIsSignatureVerified(int handle , int value )
{
{
#line 233
if (handle == 1) {
#line 229
__ste_email_isSignatureVerified0 = value;
} else {
#line 230
if (handle == 2) {
#line 231
__ste_email_isSignatureVerified1 = value;
} else {
}
}
#line 1511 "EmailLib.c"
return;
}
}
#line 1 "ClientLib.o"
#pragma merger(0,"ClientLib.i","")
#line 4 "ClientLib.h"
int initClient(void) ;
#line 6
char *getClientName(int handle ) ;
#line 8
void setClientName(int handle , char *value ) ;
#line 10
int getClientOutbuffer(int handle ) ;
#line 12
void setClientOutbuffer(int handle , int value ) ;
#line 14
int getClientAddressBookSize(int handle ) ;
#line 16
void setClientAddressBookSize(int handle , int value ) ;
#line 18
int createClientAddressBookEntry(int handle ) ;
#line 20
int getClientAddressBookAlias(int handle , int index ) ;
#line 22
void setClientAddressBookAlias(int handle , int index , int value ) ;
#line 24
int getClientAddressBookAddress(int handle , int index ) ;
#line 26
void setClientAddressBookAddress(int handle , int index , int value ) ;
#line 29
int getClientAutoResponse(int handle ) ;
#line 31
void setClientAutoResponse(int handle , int value ) ;
#line 33
int getClientPrivateKey(int handle ) ;
#line 37
int getClientKeyringSize(int handle ) ;
#line 49
int getClientForwardReceiver(int handle ) ;
#line 53
int getClientId(int handle ) ;
#line 57
int findPublicKey(int handle , int userid ) ;
#line 59
int findClientAddressBookAlias(int handle , int userid ) ;
#line 5 "ClientLib.c"
int __ste_Client_counter = 0;
#line 7 "ClientLib.c"
int initClient(void)
{ int retValue_acc ;
{
#line 12 "ClientLib.c"
if (__ste_Client_counter < 3) {
#line 684
__ste_Client_counter = __ste_Client_counter + 1;
#line 684
retValue_acc = __ste_Client_counter;
#line 686
return (retValue_acc);
} else {
#line 692 "ClientLib.c"
retValue_acc = -1;
#line 694
return (retValue_acc);
}
#line 701 "ClientLib.c"
return (retValue_acc);
}
}
#line 15 "ClientLib.c"
char *__ste_client_name0 = (char *)0;
#line 17 "ClientLib.c"
char *__ste_client_name1 = (char *)0;
#line 19 "ClientLib.c"
char *__ste_client_name2 = (char *)0;
#line 22 "ClientLib.c"
char *getClientName(int handle )
{ char *retValue_acc ;
void *__cil_tmp3 ;
{
#line 31 "ClientLib.c"
if (handle == 1) {
#line 732
retValue_acc = __ste_client_name0;
#line 734
return (retValue_acc);
} else {
#line 736
if (handle == 2) {
#line 741
retValue_acc = __ste_client_name1;
#line 743
return (retValue_acc);
} else {
#line 745
if (handle == 3) {
#line 750
retValue_acc = __ste_client_name2;
#line 752
return (retValue_acc);
} else {
#line 758 "ClientLib.c"
__cil_tmp3 = (void *)0;
#line 758
retValue_acc = (char *)__cil_tmp3;
#line 760
return (retValue_acc);
}
}
}
#line 767 "ClientLib.c"
return (retValue_acc);
}
}
#line 34 "ClientLib.c"
void setClientName(int handle , char *value )
{
{
#line 42
if (handle == 1) {
#line 36
__ste_client_name0 = value;
} else {
#line 37
if (handle == 2) {
#line 38
__ste_client_name1 = value;
} else {
#line 39
if (handle == 3) {
#line 40
__ste_client_name2 = value;
} else {
}
}
}
#line 802 "ClientLib.c"
return;
}
}
#line 44 "ClientLib.c"
int __ste_client_outbuffer0 = 0;
#line 46 "ClientLib.c"
int __ste_client_outbuffer1 = 0;
#line 48 "ClientLib.c"
int __ste_client_outbuffer2 = 0;
#line 50 "ClientLib.c"
int __ste_client_outbuffer3 = 0;
#line 53 "ClientLib.c"
int getClientOutbuffer(int handle )
{ int retValue_acc ;
{
#line 62 "ClientLib.c"
if (handle == 1) {
#line 831
retValue_acc = __ste_client_outbuffer0;
#line 833
return (retValue_acc);
} else {
#line 835
if (handle == 2) {
#line 840
retValue_acc = __ste_client_outbuffer1;
#line 842
return (retValue_acc);
} else {
#line 844
if (handle == 3) {
#line 849
retValue_acc = __ste_client_outbuffer2;
#line 851
return (retValue_acc);
} else {
#line 857 "ClientLib.c"
retValue_acc = 0;
#line 859
return (retValue_acc);
}
}
}
#line 866 "ClientLib.c"
return (retValue_acc);
}
}
#line 65 "ClientLib.c"
void setClientOutbuffer(int handle , int value )
{
{
#line 73
if (handle == 1) {
#line 67
__ste_client_outbuffer0 = value;
} else {
#line 68
if (handle == 2) {
#line 69
__ste_client_outbuffer1 = value;
} else {
#line 70
if (handle == 3) {
#line 71
__ste_client_outbuffer2 = value;
} else {
}
}
}
#line 901 "ClientLib.c"
return;
}
}
#line 77 "ClientLib.c"
int __ste_ClientAddressBook_size0 = 0;
#line 79 "ClientLib.c"
int __ste_ClientAddressBook_size1 = 0;
#line 81 "ClientLib.c"
int __ste_ClientAddressBook_size2 = 0;
#line 84 "ClientLib.c"
int getClientAddressBookSize(int handle )
{ int retValue_acc ;
{
#line 93 "ClientLib.c"
if (handle == 1) {
#line 928
retValue_acc = __ste_ClientAddressBook_size0;
#line 930
return (retValue_acc);
} else {
#line 932
if (handle == 2) {
#line 937
retValue_acc = __ste_ClientAddressBook_size1;
#line 939
return (retValue_acc);
} else {
#line 941
if (handle == 3) {
#line 946
retValue_acc = __ste_ClientAddressBook_size2;
#line 948
return (retValue_acc);
} else {
#line 954 "ClientLib.c"
retValue_acc = 0;
#line 956
return (retValue_acc);
}
}
}
#line 963 "ClientLib.c"
return (retValue_acc);
}
}
#line 96 "ClientLib.c"
void setClientAddressBookSize(int handle , int value )
{
{
#line 104
if (handle == 1) {
#line 98
__ste_ClientAddressBook_size0 = value;
} else {
#line 99
if (handle == 2) {
#line 100
__ste_ClientAddressBook_size1 = value;
} else {
#line 101
if (handle == 3) {
#line 102
__ste_ClientAddressBook_size2 = value;
} else {
}
}
}
#line 998 "ClientLib.c"
return;
}
}
#line 106 "ClientLib.c"
int createClientAddressBookEntry(int handle )
{ int retValue_acc ;
int size ;
int tmp ;
int __cil_tmp5 ;
{
{
#line 107
tmp = getClientAddressBookSize(handle);
#line 107
size = tmp;
}
#line 108 "ClientLib.c"
if (size < 3) {
{
#line 109 "ClientLib.c"
__cil_tmp5 = size + 1;
#line 109
setClientAddressBookSize(handle, __cil_tmp5);
#line 1025 "ClientLib.c"
retValue_acc = size + 1;
}
#line 1027
return (retValue_acc);
} else {
#line 1031 "ClientLib.c"
retValue_acc = -1;
#line 1033
return (retValue_acc);
}
#line 1040 "ClientLib.c"
return (retValue_acc);
}
}
#line 115 "ClientLib.c"
int __ste_Client_AddressBook0_Alias0 = 0;
#line 117 "ClientLib.c"
int __ste_Client_AddressBook0_Alias1 = 0;
#line 119 "ClientLib.c"
int __ste_Client_AddressBook0_Alias2 = 0;
#line 121 "ClientLib.c"
int __ste_Client_AddressBook1_Alias0 = 0;
#line 123 "ClientLib.c"
int __ste_Client_AddressBook1_Alias1 = 0;
#line 125 "ClientLib.c"
int __ste_Client_AddressBook1_Alias2 = 0;
#line 127 "ClientLib.c"
int __ste_Client_AddressBook2_Alias0 = 0;
#line 129 "ClientLib.c"
int __ste_Client_AddressBook2_Alias1 = 0;
#line 131 "ClientLib.c"
int __ste_Client_AddressBook2_Alias2 = 0;
#line 134 "ClientLib.c"
int getClientAddressBookAlias(int handle , int index )
{ int retValue_acc ;
{
#line 167
if (handle == 1) {
#line 144 "ClientLib.c"
if (index == 0) {
#line 1086
retValue_acc = __ste_Client_AddressBook0_Alias0;
#line 1088
return (retValue_acc);
} else {
#line 1090
if (index == 1) {
#line 1095
retValue_acc = __ste_Client_AddressBook0_Alias1;
#line 1097
return (retValue_acc);
} else {
#line 1099
if (index == 2) {
#line 1104
retValue_acc = __ste_Client_AddressBook0_Alias2;
#line 1106
return (retValue_acc);
} else {
#line 1112
retValue_acc = 0;
#line 1114
return (retValue_acc);
}
}
}
} else {
#line 1116 "ClientLib.c"
if (handle == 2) {
#line 154 "ClientLib.c"
if (index == 0) {
#line 1124
retValue_acc = __ste_Client_AddressBook1_Alias0;
#line 1126
return (retValue_acc);
} else {
#line 1128
if (index == 1) {
#line 1133
retValue_acc = __ste_Client_AddressBook1_Alias1;
#line 1135
return (retValue_acc);
} else {
#line 1137
if (index == 2) {
#line 1142
retValue_acc = __ste_Client_AddressBook1_Alias2;
#line 1144
return (retValue_acc);
} else {
#line 1150
retValue_acc = 0;
#line 1152
return (retValue_acc);
}
}
}
} else {
#line 1154 "ClientLib.c"
if (handle == 3) {
#line 164 "ClientLib.c"
if (index == 0) {
#line 1162
retValue_acc = __ste_Client_AddressBook2_Alias0;
#line 1164
return (retValue_acc);
} else {
#line 1166
if (index == 1) {
#line 1171
retValue_acc = __ste_Client_AddressBook2_Alias1;
#line 1173
return (retValue_acc);
} else {
#line 1175
if (index == 2) {
#line 1180
retValue_acc = __ste_Client_AddressBook2_Alias2;
#line 1182
return (retValue_acc);
} else {
#line 1188
retValue_acc = 0;
#line 1190
return (retValue_acc);
}
}
}
} else {
#line 1196 "ClientLib.c"
retValue_acc = 0;
#line 1198
return (retValue_acc);
}
}
}
#line 1205 "ClientLib.c"
return (retValue_acc);
}
}
#line 171 "ClientLib.c"
int findClientAddressBookAlias(int handle , int userid )
{ int retValue_acc ;
{
#line 204
if (handle == 1) {
#line 181 "ClientLib.c"
if (userid == __ste_Client_AddressBook0_Alias0) {
#line 1233
retValue_acc = 0;
#line 1235
return (retValue_acc);
} else {
#line 1237
if (userid == __ste_Client_AddressBook0_Alias1) {
#line 1242
retValue_acc = 1;
#line 1244
return (retValue_acc);
} else {
#line 1246
if (userid == __ste_Client_AddressBook0_Alias2) {
#line 1251
retValue_acc = 2;
#line 1253
return (retValue_acc);
} else {
#line 1259
retValue_acc = -1;
#line 1261
return (retValue_acc);
}
}
}
} else {
#line 1263 "ClientLib.c"
if (handle == 2) {
#line 191 "ClientLib.c"
if (userid == __ste_Client_AddressBook1_Alias0) {
#line 1271
retValue_acc = 0;
#line 1273
return (retValue_acc);
} else {
#line 1275
if (userid == __ste_Client_AddressBook1_Alias1) {
#line 1280
retValue_acc = 1;
#line 1282
return (retValue_acc);
} else {
#line 1284
if (userid == __ste_Client_AddressBook1_Alias2) {
#line 1289
retValue_acc = 2;
#line 1291
return (retValue_acc);
} else {
#line 1297
retValue_acc = -1;
#line 1299
return (retValue_acc);
}
}
}
} else {
#line 1301 "ClientLib.c"
if (handle == 3) {
#line 201 "ClientLib.c"
if (userid == __ste_Client_AddressBook2_Alias0) {
#line 1309
retValue_acc = 0;
#line 1311
return (retValue_acc);
} else {
#line 1313
if (userid == __ste_Client_AddressBook2_Alias1) {
#line 1318
retValue_acc = 1;
#line 1320
return (retValue_acc);
} else {
#line 1322
if (userid == __ste_Client_AddressBook2_Alias2) {
#line 1327
retValue_acc = 2;
#line 1329
return (retValue_acc);
} else {
#line 1335
retValue_acc = -1;
#line 1337
return (retValue_acc);
}
}
}
} else {
#line 1343 "ClientLib.c"
retValue_acc = -1;
#line 1345
return (retValue_acc);
}
}
}
#line 1352 "ClientLib.c"
return (retValue_acc);
}
}
#line 208 "ClientLib.c"
void setClientAddressBookAlias(int handle , int index , int value )
{
{
#line 234
if (handle == 1) {
#line 217
if (index == 0) {
#line 211
__ste_Client_AddressBook0_Alias0 = value;
} else {
#line 212
if (index == 1) {
#line 213
__ste_Client_AddressBook0_Alias1 = value;
} else {
#line 214
if (index == 2) {
#line 215
__ste_Client_AddressBook0_Alias2 = value;
} else {
}
}
}
} else {
#line 216
if (handle == 2) {
#line 225
if (index == 0) {
#line 219
__ste_Client_AddressBook1_Alias0 = value;
} else {
#line 220
if (index == 1) {
#line 221
__ste_Client_AddressBook1_Alias1 = value;
} else {
#line 222
if (index == 2) {
#line 223
__ste_Client_AddressBook1_Alias2 = value;
} else {
}
}
}
} else {
#line 224
if (handle == 3) {
#line 233
if (index == 0) {
#line 227
__ste_Client_AddressBook2_Alias0 = value;
} else {
#line 228
if (index == 1) {
#line 229
__ste_Client_AddressBook2_Alias1 = value;
} else {
#line 230
if (index == 2) {
#line 231
__ste_Client_AddressBook2_Alias2 = value;
} else {
}
}
}
} else {
}
}
}
#line 1420 "ClientLib.c"
return;
}
}
#line 236 "ClientLib.c"
int __ste_Client_AddressBook0_Address0 = 0;
#line 238 "ClientLib.c"
int __ste_Client_AddressBook0_Address1 = 0;
#line 240 "ClientLib.c"
int __ste_Client_AddressBook0_Address2 = 0;
#line 242 "ClientLib.c"
int __ste_Client_AddressBook1_Address0 = 0;
#line 244 "ClientLib.c"
int __ste_Client_AddressBook1_Address1 = 0;
#line 246 "ClientLib.c"
int __ste_Client_AddressBook1_Address2 = 0;
#line 248 "ClientLib.c"
int __ste_Client_AddressBook2_Address0 = 0;
#line 250 "ClientLib.c"
int __ste_Client_AddressBook2_Address1 = 0;
#line 252 "ClientLib.c"
int __ste_Client_AddressBook2_Address2 = 0;
#line 255 "ClientLib.c"
int getClientAddressBookAddress(int handle , int index )
{ int retValue_acc ;
{
#line 288
if (handle == 1) {
#line 265 "ClientLib.c"
if (index == 0) {
#line 1462
retValue_acc = __ste_Client_AddressBook0_Address0;
#line 1464
return (retValue_acc);
} else {
#line 1466
if (index == 1) {
#line 1471
retValue_acc = __ste_Client_AddressBook0_Address1;
#line 1473
return (retValue_acc);
} else {
#line 1475
if (index == 2) {
#line 1480
retValue_acc = __ste_Client_AddressBook0_Address2;
#line 1482
return (retValue_acc);
} else {
#line 1488
retValue_acc = 0;
#line 1490
return (retValue_acc);
}
}
}
} else {
#line 1492 "ClientLib.c"
if (handle == 2) {
#line 275 "ClientLib.c"
if (index == 0) {
#line 1500
retValue_acc = __ste_Client_AddressBook1_Address0;
#line 1502
return (retValue_acc);
} else {
#line 1504
if (index == 1) {
#line 1509
retValue_acc = __ste_Client_AddressBook1_Address1;
#line 1511
return (retValue_acc);
} else {
#line 1513
if (index == 2) {
#line 1518
retValue_acc = __ste_Client_AddressBook1_Address2;
#line 1520
return (retValue_acc);
} else {
#line 1526
retValue_acc = 0;
#line 1528
return (retValue_acc);
}
}
}
} else {
#line 1530 "ClientLib.c"
if (handle == 3) {
#line 285 "ClientLib.c"
if (index == 0) {
#line 1538
retValue_acc = __ste_Client_AddressBook2_Address0;
#line 1540
return (retValue_acc);
} else {
#line 1542
if (index == 1) {
#line 1547
retValue_acc = __ste_Client_AddressBook2_Address1;
#line 1549
return (retValue_acc);
} else {
#line 1551
if (index == 2) {
#line 1556
retValue_acc = __ste_Client_AddressBook2_Address2;
#line 1558
return (retValue_acc);
} else {
#line 1564
retValue_acc = 0;
#line 1566
return (retValue_acc);
}
}
}
} else {
#line 1572 "ClientLib.c"
retValue_acc = 0;
#line 1574
return (retValue_acc);
}
}
}
#line 1581 "ClientLib.c"
return (retValue_acc);
}
}
#line 291 "ClientLib.c"
void setClientAddressBookAddress(int handle , int index , int value )
{
{
#line 317
if (handle == 1) {
#line 300
if (index == 0) {
#line 294
__ste_Client_AddressBook0_Address0 = value;
} else {
#line 295
if (index == 1) {
#line 296
__ste_Client_AddressBook0_Address1 = value;
} else {
#line 297
if (index == 2) {
#line 298
__ste_Client_AddressBook0_Address2 = value;
} else {
}
}
}
} else {
#line 299
if (handle == 2) {
#line 308
if (index == 0) {
#line 302
__ste_Client_AddressBook1_Address0 = value;
} else {
#line 303
if (index == 1) {
#line 304
__ste_Client_AddressBook1_Address1 = value;
} else {
#line 305
if (index == 2) {
#line 306
__ste_Client_AddressBook1_Address2 = value;
} else {
}
}
}
} else {
#line 307
if (handle == 3) {
#line 316
if (index == 0) {
#line 310
__ste_Client_AddressBook2_Address0 = value;
} else {
#line 311
if (index == 1) {
#line 312
__ste_Client_AddressBook2_Address1 = value;
} else {
#line 313
if (index == 2) {
#line 314
__ste_Client_AddressBook2_Address2 = value;
} else {
}
}
}
} else {
}
}
}
#line 1649 "ClientLib.c"
return;
}
}
#line 319 "ClientLib.c"
int __ste_client_autoResponse0 = 0;
#line 321 "ClientLib.c"
int __ste_client_autoResponse1 = 0;
#line 323 "ClientLib.c"
int __ste_client_autoResponse2 = 0;
#line 326 "ClientLib.c"
int getClientAutoResponse(int handle )
{ int retValue_acc ;
{
#line 335 "ClientLib.c"
if (handle == 1) {
#line 1676
retValue_acc = __ste_client_autoResponse0;
#line 1678
return (retValue_acc);
} else {
#line 1680
if (handle == 2) {
#line 1685
retValue_acc = __ste_client_autoResponse1;
#line 1687
return (retValue_acc);
} else {
#line 1689
if (handle == 3) {
#line 1694
retValue_acc = __ste_client_autoResponse2;
#line 1696
return (retValue_acc);
} else {
#line 1702 "ClientLib.c"
retValue_acc = -1;
#line 1704
return (retValue_acc);
}
}
}
#line 1711 "ClientLib.c"
return (retValue_acc);
}
}
#line 338 "ClientLib.c"
void setClientAutoResponse(int handle , int value )
{
{
#line 346
if (handle == 1) {
#line 340
__ste_client_autoResponse0 = value;
} else {
#line 341
if (handle == 2) {
#line 342
__ste_client_autoResponse1 = value;
} else {
#line 343
if (handle == 3) {
#line 344
__ste_client_autoResponse2 = value;
} else {
}
}
}
#line 1746 "ClientLib.c"
return;
}
}
#line 348 "ClientLib.c"
int __ste_client_privateKey0 = 0;
#line 350 "ClientLib.c"
int __ste_client_privateKey1 = 0;
#line 352 "ClientLib.c"
int __ste_client_privateKey2 = 0;
#line 355 "ClientLib.c"
int getClientPrivateKey(int handle )
{ int retValue_acc ;
{
#line 364 "ClientLib.c"
if (handle == 1) {
#line 1773
retValue_acc = __ste_client_privateKey0;
#line 1775
return (retValue_acc);
} else {
#line 1777
if (handle == 2) {
#line 1782
retValue_acc = __ste_client_privateKey1;
#line 1784
return (retValue_acc);
} else {
#line 1786
if (handle == 3) {
#line 1791
retValue_acc = __ste_client_privateKey2;
#line 1793
return (retValue_acc);
} else {
#line 1799 "ClientLib.c"
retValue_acc = 0;
#line 1801
return (retValue_acc);
}
}
}
#line 1808 "ClientLib.c"
return (retValue_acc);
}
}
#line 367 "ClientLib.c"
void setClientPrivateKey(int handle , int value )
{
{
#line 375
if (handle == 1) {
#line 369
__ste_client_privateKey0 = value;
} else {
#line 370
if (handle == 2) {
#line 371
__ste_client_privateKey1 = value;
} else {
#line 372
if (handle == 3) {
#line 373
__ste_client_privateKey2 = value;
} else {
}
}
}
#line 1843 "ClientLib.c"
return;
}
}
#line 377 "ClientLib.c"
int __ste_ClientKeyring_size0 = 0;
#line 379 "ClientLib.c"
int __ste_ClientKeyring_size1 = 0;
#line 381 "ClientLib.c"
int __ste_ClientKeyring_size2 = 0;
#line 384 "ClientLib.c"
int getClientKeyringSize(int handle )
{ int retValue_acc ;
{
#line 393 "ClientLib.c"
if (handle == 1) {
#line 1870
retValue_acc = __ste_ClientKeyring_size0;
#line 1872
return (retValue_acc);
} else {
#line 1874
if (handle == 2) {
#line 1879
retValue_acc = __ste_ClientKeyring_size1;
#line 1881
return (retValue_acc);
} else {
#line 1883
if (handle == 3) {
#line 1888
retValue_acc = __ste_ClientKeyring_size2;
#line 1890
return (retValue_acc);
} else {
#line 1896 "ClientLib.c"
retValue_acc = 0;
#line 1898
return (retValue_acc);
}
}
}
#line 1905 "ClientLib.c"
return (retValue_acc);
}
}
#line 396 "ClientLib.c"
void setClientKeyringSize(int handle , int value )
{
{
#line 404
if (handle == 1) {
#line 398
__ste_ClientKeyring_size0 = value;
} else {
#line 399
if (handle == 2) {
#line 400
__ste_ClientKeyring_size1 = value;
} else {
#line 401
if (handle == 3) {
#line 402
__ste_ClientKeyring_size2 = value;
} else {
}
}
}
#line 1940 "ClientLib.c"
return;
}
}
#line 406 "ClientLib.c"
int createClientKeyringEntry(int handle )
{ int retValue_acc ;
int size ;
int tmp ;
int __cil_tmp5 ;
{
{
#line 407
tmp = getClientKeyringSize(handle);
#line 407
size = tmp;
}
#line 408 "ClientLib.c"
if (size < 2) {
{
#line 409 "ClientLib.c"
__cil_tmp5 = size + 1;
#line 409
setClientKeyringSize(handle, __cil_tmp5);
#line 1967 "ClientLib.c"
retValue_acc = size + 1;
}
#line 1969
return (retValue_acc);
} else {
#line 1973 "ClientLib.c"
retValue_acc = -1;
#line 1975
return (retValue_acc);
}
#line 1982 "ClientLib.c"
return (retValue_acc);
}
}
#line 414 "ClientLib.c"
int __ste_Client_Keyring0_User0 = 0;
#line 416 "ClientLib.c"
int __ste_Client_Keyring0_User1 = 0;
#line 418 "ClientLib.c"
int __ste_Client_Keyring0_User2 = 0;
#line 420 "ClientLib.c"
int __ste_Client_Keyring1_User0 = 0;
#line 422 "ClientLib.c"
int __ste_Client_Keyring1_User1 = 0;
#line 424 "ClientLib.c"
int __ste_Client_Keyring1_User2 = 0;
#line 426 "ClientLib.c"
int __ste_Client_Keyring2_User0 = 0;
#line 428 "ClientLib.c"
int __ste_Client_Keyring2_User1 = 0;
#line 430 "ClientLib.c"
int __ste_Client_Keyring2_User2 = 0;
#line 433 "ClientLib.c"
int getClientKeyringUser(int handle , int index )
{ int retValue_acc ;
{
#line 466
if (handle == 1) {
#line 443 "ClientLib.c"
if (index == 0) {
#line 2028
retValue_acc = __ste_Client_Keyring0_User0;
#line 2030
return (retValue_acc);
} else {
#line 2032
if (index == 1) {
#line 2037
retValue_acc = __ste_Client_Keyring0_User1;
#line 2039
return (retValue_acc);
} else {
#line 2045
retValue_acc = 0;
#line 2047
return (retValue_acc);
}
}
} else {
#line 2049 "ClientLib.c"
if (handle == 2) {
#line 453 "ClientLib.c"
if (index == 0) {
#line 2057
retValue_acc = __ste_Client_Keyring1_User0;
#line 2059
return (retValue_acc);
} else {
#line 2061
if (index == 1) {
#line 2066
retValue_acc = __ste_Client_Keyring1_User1;
#line 2068
return (retValue_acc);
} else {
#line 2074
retValue_acc = 0;
#line 2076
return (retValue_acc);
}
}
} else {
#line 2078 "ClientLib.c"
if (handle == 3) {
#line 463 "ClientLib.c"
if (index == 0) {
#line 2086
retValue_acc = __ste_Client_Keyring2_User0;
#line 2088
return (retValue_acc);
} else {
#line 2090
if (index == 1) {
#line 2095
retValue_acc = __ste_Client_Keyring2_User1;
#line 2097
return (retValue_acc);
} else {
#line 2103
retValue_acc = 0;
#line 2105
return (retValue_acc);
}
}
} else {
#line 2111 "ClientLib.c"
retValue_acc = 0;
#line 2113
return (retValue_acc);
}
}
}
#line 2120 "ClientLib.c"
return (retValue_acc);
}
}
#line 473 "ClientLib.c"
void setClientKeyringUser(int handle , int index , int value )
{
{
#line 499
if (handle == 1) {
#line 482
if (index == 0) {
#line 476
__ste_Client_Keyring0_User0 = value;
} else {
#line 477
if (index == 1) {
#line 478
__ste_Client_Keyring0_User1 = value;
} else {
}
}
} else {
#line 479
if (handle == 2) {
#line 490
if (index == 0) {
#line 484
__ste_Client_Keyring1_User0 = value;
} else {
#line 485
if (index == 1) {
#line 486
__ste_Client_Keyring1_User1 = value;
} else {
}
}
} else {
#line 487
if (handle == 3) {
#line 498
if (index == 0) {
#line 492
__ste_Client_Keyring2_User0 = value;
} else {
#line 493
if (index == 1) {
#line 494
__ste_Client_Keyring2_User1 = value;
} else {
}
}
} else {
}
}
}
#line 2176 "ClientLib.c"
return;
}
}
#line 501 "ClientLib.c"
int __ste_Client_Keyring0_PublicKey0 = 0;
#line 503 "ClientLib.c"
int __ste_Client_Keyring0_PublicKey1 = 0;
#line 505 "ClientLib.c"
int __ste_Client_Keyring0_PublicKey2 = 0;
#line 507 "ClientLib.c"
int __ste_Client_Keyring1_PublicKey0 = 0;
#line 509 "ClientLib.c"
int __ste_Client_Keyring1_PublicKey1 = 0;
#line 511 "ClientLib.c"
int __ste_Client_Keyring1_PublicKey2 = 0;
#line 513 "ClientLib.c"
int __ste_Client_Keyring2_PublicKey0 = 0;
#line 515 "ClientLib.c"
int __ste_Client_Keyring2_PublicKey1 = 0;
#line 517 "ClientLib.c"
int __ste_Client_Keyring2_PublicKey2 = 0;
#line 520 "ClientLib.c"
int getClientKeyringPublicKey(int handle , int index )
{ int retValue_acc ;
{
#line 553
if (handle == 1) {
#line 530 "ClientLib.c"
if (index == 0) {
#line 2218
retValue_acc = __ste_Client_Keyring0_PublicKey0;
#line 2220
return (retValue_acc);
} else {
#line 2222
if (index == 1) {
#line 2227
retValue_acc = __ste_Client_Keyring0_PublicKey1;
#line 2229
return (retValue_acc);
} else {
#line 2235
retValue_acc = 0;
#line 2237
return (retValue_acc);
}
}
} else {
#line 2239 "ClientLib.c"
if (handle == 2) {
#line 540 "ClientLib.c"
if (index == 0) {
#line 2247
retValue_acc = __ste_Client_Keyring1_PublicKey0;
#line 2249
return (retValue_acc);
} else {
#line 2251
if (index == 1) {
#line 2256
retValue_acc = __ste_Client_Keyring1_PublicKey1;
#line 2258
return (retValue_acc);
} else {
#line 2264
retValue_acc = 0;
#line 2266
return (retValue_acc);
}
}
} else {
#line 2268 "ClientLib.c"
if (handle == 3) {
#line 550 "ClientLib.c"
if (index == 0) {
#line 2276
retValue_acc = __ste_Client_Keyring2_PublicKey0;
#line 2278
return (retValue_acc);
} else {
#line 2280
if (index == 1) {
#line 2285
retValue_acc = __ste_Client_Keyring2_PublicKey1;
#line 2287
return (retValue_acc);
} else {
#line 2293
retValue_acc = 0;
#line 2295
return (retValue_acc);
}
}
} else {
#line 2301 "ClientLib.c"
retValue_acc = 0;
#line 2303
return (retValue_acc);
}
}
}
#line 2310 "ClientLib.c"
return (retValue_acc);
}
}
#line 557 "ClientLib.c"
int findPublicKey(int handle , int userid )
{ int retValue_acc ;
{
#line 591
if (handle == 1) {
#line 568 "ClientLib.c"
if (userid == __ste_Client_Keyring0_User0) {
#line 2338
retValue_acc = __ste_Client_Keyring0_PublicKey0;
#line 2340
return (retValue_acc);
} else {
#line 2342
if (userid == __ste_Client_Keyring0_User1) {
#line 2347
retValue_acc = __ste_Client_Keyring0_PublicKey1;
#line 2349
return (retValue_acc);
} else {
#line 2355
retValue_acc = 0;
#line 2357
return (retValue_acc);
}
}
} else {
#line 2359 "ClientLib.c"
if (handle == 2) {
#line 578 "ClientLib.c"
if (userid == __ste_Client_Keyring1_User0) {
#line 2367
retValue_acc = __ste_Client_Keyring1_PublicKey0;
#line 2369
return (retValue_acc);
} else {
#line 2371
if (userid == __ste_Client_Keyring1_User1) {
#line 2376
retValue_acc = __ste_Client_Keyring1_PublicKey1;
#line 2378
return (retValue_acc);
} else {
#line 2384
retValue_acc = 0;
#line 2386
return (retValue_acc);
}
}
} else {
#line 2388 "ClientLib.c"
if (handle == 3) {
#line 588 "ClientLib.c"
if (userid == __ste_Client_Keyring2_User0) {
#line 2396
retValue_acc = __ste_Client_Keyring2_PublicKey0;
#line 2398
return (retValue_acc);
} else {
#line 2400
if (userid == __ste_Client_Keyring2_User1) {
#line 2405
retValue_acc = __ste_Client_Keyring2_PublicKey1;
#line 2407
return (retValue_acc);
} else {
#line 2413
retValue_acc = 0;
#line 2415
return (retValue_acc);
}
}
} else {
#line 2421 "ClientLib.c"
retValue_acc = 0;
#line 2423
return (retValue_acc);
}
}
}
#line 2430 "ClientLib.c"
return (retValue_acc);
}
}
#line 595 "ClientLib.c"
void setClientKeyringPublicKey(int handle , int index , int value )
{
{
#line 621
if (handle == 1) {
#line 604
if (index == 0) {
#line 598
__ste_Client_Keyring0_PublicKey0 = value;
} else {
#line 599
if (index == 1) {
#line 600
__ste_Client_Keyring0_PublicKey1 = value;
} else {
}
}
} else {
#line 601
if (handle == 2) {
#line 612
if (index == 0) {
#line 606
__ste_Client_Keyring1_PublicKey0 = value;
} else {
#line 607
if (index == 1) {
#line 608
__ste_Client_Keyring1_PublicKey1 = value;
} else {
}
}
} else {
#line 609
if (handle == 3) {
#line 620
if (index == 0) {
#line 614
__ste_Client_Keyring2_PublicKey0 = value;
} else {
#line 615
if (index == 1) {
#line 616
__ste_Client_Keyring2_PublicKey1 = value;
} else {
}
}
} else {
}
}
}
#line 2486 "ClientLib.c"
return;
}
}
#line 623 "ClientLib.c"
int __ste_client_forwardReceiver0 = 0;
#line 625 "ClientLib.c"
int __ste_client_forwardReceiver1 = 0;
#line 627 "ClientLib.c"
int __ste_client_forwardReceiver2 = 0;
#line 629 "ClientLib.c"
int __ste_client_forwardReceiver3 = 0;
#line 631 "ClientLib.c"
int getClientForwardReceiver(int handle )
{ int retValue_acc ;
{
#line 640 "ClientLib.c"
if (handle == 1) {
#line 2515
retValue_acc = __ste_client_forwardReceiver0;
#line 2517
return (retValue_acc);
} else {
#line 2519
if (handle == 2) {
#line 2524
retValue_acc = __ste_client_forwardReceiver1;
#line 2526
return (retValue_acc);
} else {
#line 2528
if (handle == 3) {
#line 2533
retValue_acc = __ste_client_forwardReceiver2;
#line 2535
return (retValue_acc);
} else {
#line 2541 "ClientLib.c"
retValue_acc = 0;
#line 2543
return (retValue_acc);
}
}
}
#line 2550 "ClientLib.c"
return (retValue_acc);
}
}
#line 643 "ClientLib.c"
void setClientForwardReceiver(int handle , int value )
{
{
#line 651
if (handle == 1) {
#line 645
__ste_client_forwardReceiver0 = value;
} else {
#line 646
if (handle == 2) {
#line 647
__ste_client_forwardReceiver1 = value;
} else {
#line 648
if (handle == 3) {
#line 649
__ste_client_forwardReceiver2 = value;
} else {
}
}
}
#line 2585 "ClientLib.c"
return;
}
}
#line 653 "ClientLib.c"
int __ste_client_idCounter0 = 0;
#line 655 "ClientLib.c"
int __ste_client_idCounter1 = 0;
#line 657 "ClientLib.c"
int __ste_client_idCounter2 = 0;
#line 660 "ClientLib.c"
int getClientId(int handle )
{ int retValue_acc ;
{
#line 669 "ClientLib.c"
if (handle == 1) {
#line 2612
retValue_acc = __ste_client_idCounter0;
#line 2614
return (retValue_acc);
} else {
#line 2616
if (handle == 2) {
#line 2621
retValue_acc = __ste_client_idCounter1;
#line 2623
return (retValue_acc);
} else {
#line 2625
if (handle == 3) {
#line 2630
retValue_acc = __ste_client_idCounter2;
#line 2632
return (retValue_acc);
} else {
#line 2638 "ClientLib.c"
retValue_acc = 0;
#line 2640
return (retValue_acc);
}
}
}
#line 2647 "ClientLib.c"
return (retValue_acc);
}
}
#line 672 "ClientLib.c"
void setClientId(int handle , int value )
{
{
#line 680
if (handle == 1) {
#line 674
__ste_client_idCounter0 = value;
} else {
#line 675
if (handle == 2) {
#line 676
__ste_client_idCounter1 = value;
} else {
#line 677
if (handle == 3) {
#line 678
__ste_client_idCounter2 = value;
} else {
}
}
}
#line 2682 "ClientLib.c"
return;
}
}
#line 1 "scenario.o"
#pragma merger(0,"scenario.i","")
#line 1 "scenario.c"
void test(void)
{ int op1 ;
int op2 ;
int op3 ;
int op4 ;
int op5 ;
int op6 ;
int op7 ;
int op8 ;
int op9 ;
int op10 ;
int op11 ;
int splverifierCounter ;
int tmp ;
int tmp___0 ;
int tmp___1 ;
int tmp___2 ;
int tmp___3 ;
int tmp___4 ;
int tmp___5 ;
int tmp___6 ;
int tmp___7 ;
int tmp___8 ;
int tmp___9 ;
{
#line 2
op1 = 0;
#line 3
op2 = 0;
#line 4
op3 = 0;
#line 5
op4 = 0;
#line 6
op5 = 0;
#line 7
op6 = 0;
#line 8
op7 = 0;
#line 9
op8 = 0;
#line 10
op9 = 0;
#line 11
op10 = 0;
#line 12
op11 = 0;
#line 13
splverifierCounter = 0;
{
#line 14
while (1) {
while_0_continue: /* CIL Label */ ;
#line 14
if (splverifierCounter < 4) {
} else {
goto while_0_break;
}
#line 15
splverifierCounter = splverifierCounter + 1;
#line 16
if (! op1) {
{
#line 16
tmp___9 = __VERIFIER_nondet_int();
}
#line 16
if (tmp___9) {
{
#line 17
bobKeyAdd();
#line 18
op1 = 1;
}
} else {
goto _L___8;
}
} else {
_L___8: /* CIL Label */
#line 19
if (! op2) {
{
#line 19
tmp___8 = __VERIFIER_nondet_int();
}
#line 19
if (tmp___8) {
#line 21
op2 = 1;
} else {
goto _L___7;
}
} else {
_L___7: /* CIL Label */
#line 22
if (! op3) {
{
#line 22
tmp___7 = __VERIFIER_nondet_int();
}
#line 22
if (tmp___7) {
{
#line 24
rjhDeletePrivateKey();
#line 25
op3 = 1;
}
} else {
goto _L___6;
}
} else {
_L___6: /* CIL Label */
#line 26
if (! op4) {
{
#line 26
tmp___6 = __VERIFIER_nondet_int();
}
#line 26
if (tmp___6) {
{
#line 28
rjhKeyAdd();
#line 29
op4 = 1;
}
} else {
goto _L___5;
}
} else {
_L___5: /* CIL Label */
#line 30
if (! op5) {
{
#line 30
tmp___5 = __VERIFIER_nondet_int();
}
#line 30
if (tmp___5) {
{
#line 32
chuckKeyAddRjh();
#line 33
op5 = 1;
}
} else {
goto _L___4;
}
} else {
_L___4: /* CIL Label */
#line 34
if (! op6) {
{
#line 34
tmp___4 = __VERIFIER_nondet_int();
}
#line 34
if (tmp___4) {
{
#line 36
rjhEnableForwarding();
#line 37
op6 = 1;
}
} else {
goto _L___3;
}
} else {
_L___3: /* CIL Label */
#line 38
if (! op7) {
{
#line 38
tmp___3 = __VERIFIER_nondet_int();
}
#line 38
if (tmp___3) {
{
#line 40
rjhKeyChange();
#line 41
op7 = 1;
}
} else {
goto _L___2;
}
} else {
_L___2: /* CIL Label */
#line 42
if (! op8) {
{
#line 42
tmp___2 = __VERIFIER_nondet_int();
}
#line 42
if (tmp___2) {
#line 44
op8 = 1;
} else {
goto _L___1;
}
} else {
_L___1: /* CIL Label */
#line 45
if (! op9) {
{
#line 45
tmp___1 = __VERIFIER_nondet_int();
}
#line 45
if (tmp___1) {
{
#line 47
chuckKeyAdd();
#line 48
op9 = 1;
}
} else {
goto _L___0;
}
} else {
_L___0: /* CIL Label */
#line 49
if (! op10) {
{
#line 49
tmp___0 = __VERIFIER_nondet_int();
}
#line 49
if (tmp___0) {
{
#line 51
bobKeyChange();
#line 52
op10 = 1;
}
} else {
goto _L;
}
} else {
_L: /* CIL Label */
#line 53
if (! op11) {
{
#line 53
tmp = __VERIFIER_nondet_int();
}
#line 53
if (tmp) {
{
#line 55
chuckKeyAdd();
#line 56
op11 = 1;
}
} else {
goto while_0_break;
}
} else {
goto while_0_break;
}
}
}
}
}
}
}
}
}
}
}
}
while_0_break: /* CIL Label */ ;
}
{
#line 60
bobToRjh();
}
#line 167 "scenario.c"
return;
}
}
#line 1 "VerifyForward_spec.o"
#pragma merger(0,"VerifyForward_spec.i","")
#line 4 "wsllib.h"
void __automaton_fail(void) ;
#line 12 "VerifyForward_spec.c"
__inline void __utac_acc__VerifyForward_spec__1(int client , int msg )
{ int pubkey ;
int tmp ;
int tmp___0 ;
int tmp___1 ;
{
{
#line 15
puts("before deliver\n");
#line 17
tmp___1 = isVerified(msg);
}
#line 17
if (tmp___1) {
{
#line 18
tmp = getEmailFrom(msg);
#line 18
tmp___0 = findPublicKey(client, tmp);
#line 18
pubkey = tmp___0;
}
#line 19
if (pubkey == 0) {
{
#line 20
__automaton_fail();
}
} else {
}
} else {
}
#line 20
return;
}
}
#line 1 "libacc.o"
#pragma merger(0,"libacc.i","")
#line 73 "/usr/include/assert.h"
extern __attribute__((__nothrow__, __noreturn__)) void __assert_fail(char const *__assertion ,
char const *__file ,
unsigned int __line ,
char const *__function ) ;
#line 471 "/usr/include/stdlib.h"
extern __attribute__((__nothrow__)) void *malloc(size_t __size ) __attribute__((__malloc__)) ;
#line 488
extern __attribute__((__nothrow__)) void free(void *__ptr ) ;
#line 32 "libacc.c"
void __utac__exception__cf_handler_set(void *exception , int (*cflow_func)(int ,
int ) ,
int val )
{ struct __UTAC__EXCEPTION *excep ;
struct __UTAC__CFLOW_FUNC *cf ;
void *tmp ;
unsigned long __cil_tmp7 ;
unsigned long __cil_tmp8 ;
unsigned long __cil_tmp9 ;
unsigned long __cil_tmp10 ;
unsigned long __cil_tmp11 ;
unsigned long __cil_tmp12 ;
unsigned long __cil_tmp13 ;
unsigned long __cil_tmp14 ;
int (**mem_15)(int , int ) ;
int *mem_16 ;
struct __UTAC__CFLOW_FUNC **mem_17 ;
struct __UTAC__CFLOW_FUNC **mem_18 ;
struct __UTAC__CFLOW_FUNC **mem_19 ;
{
{
#line 33
excep = (struct __UTAC__EXCEPTION *)exception;
#line 34
tmp = malloc(24UL);
#line 34
cf = (struct __UTAC__CFLOW_FUNC *)tmp;
#line 36
mem_15 = (int (**)(int , int ))cf;
#line 36
*mem_15 = cflow_func;
#line 37
__cil_tmp7 = (unsigned long )cf;
#line 37
__cil_tmp8 = __cil_tmp7 + 8;
#line 37
mem_16 = (int *)__cil_tmp8;
#line 37
*mem_16 = val;
#line 38
__cil_tmp9 = (unsigned long )cf;
#line 38
__cil_tmp10 = __cil_tmp9 + 16;
#line 38
__cil_tmp11 = (unsigned long )excep;
#line 38
__cil_tmp12 = __cil_tmp11 + 24;
#line 38
mem_17 = (struct __UTAC__CFLOW_FUNC **)__cil_tmp10;
#line 38
mem_18 = (struct __UTAC__CFLOW_FUNC **)__cil_tmp12;
#line 38
*mem_17 = *mem_18;
#line 39
__cil_tmp13 = (unsigned long )excep;
#line 39
__cil_tmp14 = __cil_tmp13 + 24;
#line 39
mem_19 = (struct __UTAC__CFLOW_FUNC **)__cil_tmp14;
#line 39
*mem_19 = cf;
}
#line 654 "libacc.c"
return;
}
}
#line 44 "libacc.c"
void __utac__exception__cf_handler_free(void *exception )
{ struct __UTAC__EXCEPTION *excep ;
struct __UTAC__CFLOW_FUNC *cf ;
struct __UTAC__CFLOW_FUNC *tmp ;
unsigned long __cil_tmp5 ;
unsigned long __cil_tmp6 ;
struct __UTAC__CFLOW_FUNC *__cil_tmp7 ;
unsigned long __cil_tmp8 ;
unsigned long __cil_tmp9 ;
unsigned long __cil_tmp10 ;
unsigned long __cil_tmp11 ;
void *__cil_tmp12 ;
unsigned long __cil_tmp13 ;
unsigned long __cil_tmp14 ;
struct __UTAC__CFLOW_FUNC **mem_15 ;
struct __UTAC__CFLOW_FUNC **mem_16 ;
struct __UTAC__CFLOW_FUNC **mem_17 ;
{
#line 45
excep = (struct __UTAC__EXCEPTION *)exception;
#line 46
__cil_tmp5 = (unsigned long )excep;
#line 46
__cil_tmp6 = __cil_tmp5 + 24;
#line 46
mem_15 = (struct __UTAC__CFLOW_FUNC **)__cil_tmp6;
#line 46
cf = *mem_15;
{
#line 49
while (1) {
while_1_continue: /* CIL Label */ ;
{
#line 49
__cil_tmp7 = (struct __UTAC__CFLOW_FUNC *)0;
#line 49
__cil_tmp8 = (unsigned long )__cil_tmp7;
#line 49
__cil_tmp9 = (unsigned long )cf;
#line 49
if (__cil_tmp9 != __cil_tmp8) {
} else {
goto while_1_break;
}
}
{
#line 50
tmp = cf;
#line 51
__cil_tmp10 = (unsigned long )cf;
#line 51
__cil_tmp11 = __cil_tmp10 + 16;
#line 51
mem_16 = (struct __UTAC__CFLOW_FUNC **)__cil_tmp11;
#line 51
cf = *mem_16;
#line 52
__cil_tmp12 = (void *)tmp;
#line 52
free(__cil_tmp12);
}
}
while_1_break: /* CIL Label */ ;
}
#line 55
__cil_tmp13 = (unsigned long )excep;
#line 55
__cil_tmp14 = __cil_tmp13 + 24;
#line 55
mem_17 = (struct __UTAC__CFLOW_FUNC **)__cil_tmp14;
#line 55
*mem_17 = (struct __UTAC__CFLOW_FUNC *)0;
#line 694 "libacc.c"
return;
}
}
#line 59 "libacc.c"
void __utac__exception__cf_handler_reset(void *exception )
{ struct __UTAC__EXCEPTION *excep ;
struct __UTAC__CFLOW_FUNC *cf ;
unsigned long __cil_tmp5 ;
unsigned long __cil_tmp6 ;
struct __UTAC__CFLOW_FUNC *__cil_tmp7 ;
unsigned long __cil_tmp8 ;
unsigned long __cil_tmp9 ;
int (*__cil_tmp10)(int , int ) ;
unsigned long __cil_tmp11 ;
unsigned long __cil_tmp12 ;
int __cil_tmp13 ;
unsigned long __cil_tmp14 ;
unsigned long __cil_tmp15 ;
struct __UTAC__CFLOW_FUNC **mem_16 ;
int (**mem_17)(int , int ) ;
int *mem_18 ;
struct __UTAC__CFLOW_FUNC **mem_19 ;
{
#line 60
excep = (struct __UTAC__EXCEPTION *)exception;
#line 61
__cil_tmp5 = (unsigned long )excep;
#line 61
__cil_tmp6 = __cil_tmp5 + 24;
#line 61
mem_16 = (struct __UTAC__CFLOW_FUNC **)__cil_tmp6;
#line 61
cf = *mem_16;
{
#line 64
while (1) {
while_2_continue: /* CIL Label */ ;
{
#line 64
__cil_tmp7 = (struct __UTAC__CFLOW_FUNC *)0;
#line 64
__cil_tmp8 = (unsigned long )__cil_tmp7;
#line 64
__cil_tmp9 = (unsigned long )cf;
#line 64
if (__cil_tmp9 != __cil_tmp8) {
} else {
goto while_2_break;
}
}
{
#line 65
mem_17 = (int (**)(int , int ))cf;
#line 65
__cil_tmp10 = *mem_17;
#line 65
__cil_tmp11 = (unsigned long )cf;
#line 65
__cil_tmp12 = __cil_tmp11 + 8;
#line 65
mem_18 = (int *)__cil_tmp12;
#line 65
__cil_tmp13 = *mem_18;
#line 65
(*__cil_tmp10)(4, __cil_tmp13);
#line 66
__cil_tmp14 = (unsigned long )cf;
#line 66
__cil_tmp15 = __cil_tmp14 + 16;
#line 66
mem_19 = (struct __UTAC__CFLOW_FUNC **)__cil_tmp15;
#line 66
cf = *mem_19;
}
}
while_2_break: /* CIL Label */ ;
}
{
#line 69
__utac__exception__cf_handler_free(exception);
}
#line 732 "libacc.c"
return;
}
}
#line 80 "libacc.c"
void *__utac__error_stack_mgt(void *env , int mode , int count ) ;
#line 80 "libacc.c"
static struct __ACC__ERR *head = (struct __ACC__ERR *)0;
#line 79 "libacc.c"
void *__utac__error_stack_mgt(void *env , int mode , int count )
{ void *retValue_acc ;
struct __ACC__ERR *new ;
void *tmp ;
struct __ACC__ERR *temp ;
struct __ACC__ERR *next ;
void *excep ;
unsigned long __cil_tmp10 ;
unsigned long __cil_tmp11 ;
unsigned long __cil_tmp12 ;
unsigned long __cil_tmp13 ;
void *__cil_tmp14 ;
unsigned long __cil_tmp15 ;
unsigned long __cil_tmp16 ;
void *__cil_tmp17 ;
void **mem_18 ;
struct __ACC__ERR **mem_19 ;
struct __ACC__ERR **mem_20 ;
void **mem_21 ;
struct __ACC__ERR **mem_22 ;
void **mem_23 ;
void **mem_24 ;
{
#line 82 "libacc.c"
if (count == 0) {
#line 758 "libacc.c"
return (retValue_acc);
} else {
}
#line 86 "libacc.c"
if (mode == 0) {
{
#line 87
tmp = malloc(16UL);
#line 87
new = (struct __ACC__ERR *)tmp;
#line 88
mem_18 = (void **)new;
#line 88
*mem_18 = env;
#line 89
__cil_tmp10 = (unsigned long )new;
#line 89
__cil_tmp11 = __cil_tmp10 + 8;
#line 89
mem_19 = (struct __ACC__ERR **)__cil_tmp11;
#line 89
*mem_19 = head;
#line 90
head = new;
#line 776 "libacc.c"
retValue_acc = (void *)new;
}
#line 778
return (retValue_acc);
} else {
}
#line 94 "libacc.c"
if (mode == 1) {
#line 95
temp = head;
{
#line 98
while (1) {
while_3_continue: /* CIL Label */ ;
#line 98
if (count > 1) {
} else {
goto while_3_break;
}
{
#line 99
__cil_tmp12 = (unsigned long )temp;
#line 99
__cil_tmp13 = __cil_tmp12 + 8;
#line 99
mem_20 = (struct __ACC__ERR **)__cil_tmp13;
#line 99
next = *mem_20;
#line 100
mem_21 = (void **)temp;
#line 100
excep = *mem_21;
#line 101
__cil_tmp14 = (void *)temp;
#line 101
free(__cil_tmp14);
#line 102
__utac__exception__cf_handler_reset(excep);
#line 103
temp = next;
#line 104
count = count - 1;
}
}
while_3_break: /* CIL Label */ ;
}
{
#line 107
__cil_tmp15 = (unsigned long )temp;
#line 107
__cil_tmp16 = __cil_tmp15 + 8;
#line 107
mem_22 = (struct __ACC__ERR **)__cil_tmp16;
#line 107
head = *mem_22;
#line 108
mem_23 = (void **)temp;
#line 108
excep = *mem_23;
#line 109
__cil_tmp17 = (void *)temp;
#line 109
free(__cil_tmp17);
#line 110
__utac__exception__cf_handler_reset(excep);
#line 820 "libacc.c"
retValue_acc = excep;
}
#line 822
return (retValue_acc);
} else {
}
#line 114
if (mode == 2) {
#line 118 "libacc.c"
if (head) {
#line 831
mem_24 = (void **)head;
#line 831
retValue_acc = *mem_24;
#line 833
return (retValue_acc);
} else {
#line 837 "libacc.c"
retValue_acc = (void *)0;
#line 839
return (retValue_acc);
}
} else {
}
#line 846 "libacc.c"
return (retValue_acc);
}
}
#line 122 "libacc.c"
void *__utac__get_this_arg(int i , struct JoinPoint *this )
{ void *retValue_acc ;
unsigned long __cil_tmp4 ;
unsigned long __cil_tmp5 ;
int __cil_tmp6 ;
int __cil_tmp7 ;
unsigned long __cil_tmp8 ;
unsigned long __cil_tmp9 ;
void **__cil_tmp10 ;
void **__cil_tmp11 ;
int *mem_12 ;
void ***mem_13 ;
{
#line 123
if (i > 0) {
{
#line 123
__cil_tmp4 = (unsigned long )this;
#line 123
__cil_tmp5 = __cil_tmp4 + 16;
#line 123
mem_12 = (int *)__cil_tmp5;
#line 123
__cil_tmp6 = *mem_12;
#line 123
if (i <= __cil_tmp6) {
} else {
{
#line 123
__assert_fail("i > 0 && i <= this->argsCount", "libacc.c",
123U, "__utac__get_this_arg");
}
}
}
} else {
{
#line 123
__assert_fail("i > 0 && i <= this->argsCount", "libacc.c",
123U, "__utac__get_this_arg");
}
}
#line 870 "libacc.c"
__cil_tmp7 = i - 1;
#line 870
__cil_tmp8 = (unsigned long )this;
#line 870
__cil_tmp9 = __cil_tmp8 + 8;
#line 870
mem_13 = (void ***)__cil_tmp9;
#line 870
__cil_tmp10 = *mem_13;
#line 870
__cil_tmp11 = __cil_tmp10 + __cil_tmp7;
#line 870
retValue_acc = *__cil_tmp11;
#line 872
return (retValue_acc);
#line 879
return (retValue_acc);
}
}
#line 129 "libacc.c"
char const *__utac__get_this_argtype(int i , struct JoinPoint *this )
{ char const *retValue_acc ;
unsigned long __cil_tmp4 ;
unsigned long __cil_tmp5 ;
int __cil_tmp6 ;
int __cil_tmp7 ;
unsigned long __cil_tmp8 ;
unsigned long __cil_tmp9 ;
char const **__cil_tmp10 ;
char const **__cil_tmp11 ;
int *mem_12 ;
char const ***mem_13 ;
{
#line 131
if (i > 0) {
{
#line 131
__cil_tmp4 = (unsigned long )this;
#line 131
__cil_tmp5 = __cil_tmp4 + 16;
#line 131
mem_12 = (int *)__cil_tmp5;
#line 131
__cil_tmp6 = *mem_12;
#line 131
if (i <= __cil_tmp6) {
} else {
{
#line 131
__assert_fail("i > 0 && i <= this->argsCount", "libacc.c",
131U, "__utac__get_this_argtype");
}
}
}
} else {
{
#line 131
__assert_fail("i > 0 && i <= this->argsCount", "libacc.c",
131U, "__utac__get_this_argtype");
}
}
#line 903 "libacc.c"
__cil_tmp7 = i - 1;
#line 903
__cil_tmp8 = (unsigned long )this;
#line 903
__cil_tmp9 = __cil_tmp8 + 24;
#line 903
mem_13 = (char const ***)__cil_tmp9;
#line 903
__cil_tmp10 = *mem_13;
#line 903
__cil_tmp11 = __cil_tmp10 + __cil_tmp7;
#line 903
retValue_acc = *__cil_tmp11;
#line 905
return (retValue_acc);
#line 912
return (retValue_acc);
}
}
#line 1 "Util.o"
#pragma merger(0,"Util.i","")
#line 1 "Util.h"
int prompt(char *msg ) ;
#line 9 "Util.c"
int prompt(char *msg )
{ int retValue_acc ;
int retval ;
char const * __restrict __cil_tmp4 ;
{
{
#line 10
__cil_tmp4 = (char const * __restrict )"%s\n";
#line 10
printf(__cil_tmp4, msg);
#line 518 "Util.c"
retValue_acc = retval;
}
#line 520
return (retValue_acc);
#line 527
return (retValue_acc);
}
}
#line 1 "Client.o"
#pragma merger(0,"Client.i","")
#line 6 "Email.h"
void printMail(int msg ) ;
#line 9
int isReadable(int msg ) ;
#line 12
int createEmail(int from , int to ) ;
#line 14 "Client.h"
void queue(int client , int msg ) ;
#line 24
void mail(int client , int msg ) ;
#line 28
void deliver(int client , int msg ) ;
#line 30
void incoming(int client , int msg ) ;
#line 32
int createClient(char *name ) ;
#line 40
int isKeyPairValid(int publicKey , int privateKey ) ;
#line 46
void sign(int client , int msg ) ;
#line 48
void forward(int client , int msg ) ;
#line 50
void verify(int client , int msg ) ;
#line 6 "Client.c"
int queue_empty = 1;
#line 9 "Client.c"
int queued_message ;
#line 12 "Client.c"
int queued_client ;
#line 18 "Client.c"
void mail(int client , int msg )
{ int tmp ;
{
{
#line 19
puts("mail sent");
#line 20
tmp = getEmailTo(msg);
#line 20
incoming(tmp, msg);
}
#line 735 "Client.c"
return;
}
}
#line 27 "Client.c"
void outgoing__wrappee__Keys(int client , int msg )
{ int tmp ;
{
{
#line 28
tmp = getClientId(client);
#line 28
setEmailFrom(msg, tmp);
#line 29
mail(client, msg);
}
#line 757 "Client.c"
return;
}
}
#line 33 "Client.c"
void outgoing__wrappee__Encrypt(int client , int msg )
{ int receiver ;
int tmp ;
int pubkey ;
int tmp___0 ;
{
{
#line 36
tmp = getEmailTo(msg);
#line 36
receiver = tmp;
#line 37
tmp___0 = findPublicKey(client, receiver);
#line 37
pubkey = tmp___0;
}
#line 38
if (pubkey) {
{
#line 39
setEmailEncryptionKey(msg, pubkey);
#line 40
setEmailIsEncrypted(msg, 1);
}
} else {
}
{
#line 45
outgoing__wrappee__Keys(client, msg);
}
#line 792 "Client.c"
return;
}
}
#line 51 "Client.c"
void outgoing(int client , int msg )
{
{
{
#line 52
sign(client, msg);
#line 53
outgoing__wrappee__Encrypt(client, msg);
}
#line 814 "Client.c"
return;
}
}
#line 60 "Client.c"
void deliver(int client , int msg )
{ int __utac__ad__arg1 ;
int __utac__ad__arg2 ;
{
{
#line 827 "Client.c"
__utac__ad__arg1 = client;
#line 828
__utac__ad__arg2 = msg;
#line 829
__utac_acc__VerifyForward_spec__1(__utac__ad__arg1, __utac__ad__arg2);
#line 61 "Client.c"
puts("mail delivered\n");
}
#line 844 "Client.c"
return;
}
}
#line 68 "Client.c"
void incoming__wrappee__Sign(int client , int msg )
{
{
{
#line 69
deliver(client, msg);
}
#line 864 "Client.c"
return;
}
}
#line 75 "Client.c"
void incoming__wrappee__Forward(int client , int msg )
{ int fwreceiver ;
int tmp ;
{
{
#line 76
incoming__wrappee__Sign(client, msg);
#line 77
tmp = getClientForwardReceiver(client);
#line 77
fwreceiver = tmp;
}
#line 78
if (fwreceiver) {
{
#line 80
setEmailTo(msg, fwreceiver);
#line 81
forward(client, msg);
}
} else {
}
#line 895 "Client.c"
return;
}
}
#line 89 "Client.c"
void incoming__wrappee__Verify(int client , int msg )
{
{
{
#line 90
verify(client, msg);
#line 91
incoming__wrappee__Forward(client, msg);
}
#line 917 "Client.c"
return;
}
}
#line 96 "Client.c"
void incoming(int client , int msg )
{ int privkey ;
int tmp ;
int tmp___0 ;
int tmp___1 ;
int tmp___2 ;
{
{
#line 99
tmp = getClientPrivateKey(client);
#line 99
privkey = tmp;
}
#line 100
if (privkey) {
{
#line 108
tmp___0 = isEncrypted(msg);
}
#line 108
if (tmp___0) {
{
#line 108
tmp___1 = getEmailEncryptionKey(msg);
#line 108
tmp___2 = isKeyPairValid(tmp___1, privkey);
}
#line 108
if (tmp___2) {
{
#line 105
setEmailIsEncrypted(msg, 0);
#line 106
setEmailEncryptionKey(msg, 0);
}
} else {
}
} else {
}
} else {
}
{
#line 111
incoming__wrappee__Verify(client, msg);
}
#line 951 "Client.c"
return;
}
}
#line 115 "Client.c"
int createClient(char *name )
{ int retValue_acc ;
int client ;
int tmp ;
{
{
#line 116
tmp = initClient();
#line 116
client = tmp;
#line 973 "Client.c"
retValue_acc = client;
}
#line 975
return (retValue_acc);
#line 982
return (retValue_acc);
}
}
#line 123 "Client.c"
void sendEmail(int sender , int receiver )
{ int email ;
int tmp ;
{
{
#line 124
tmp = createEmail(0, receiver);
#line 124
email = tmp;
#line 125
outgoing(sender, email);
}
#line 1010 "Client.c"
return;
}
}
#line 133 "Client.c"
void queue(int client , int msg )
{
{
#line 134
queue_empty = 0;
#line 135
queued_message = msg;
#line 136
queued_client = client;
#line 1034 "Client.c"
return;
}
}
#line 142 "Client.c"
int is_queue_empty(void)
{ int retValue_acc ;
{
#line 1052 "Client.c"
retValue_acc = queue_empty;
#line 1054
return (retValue_acc);
#line 1061
return (retValue_acc);
}
}
#line 149 "Client.c"
int get_queued_client(void)
{ int retValue_acc ;
{
#line 1083 "Client.c"
retValue_acc = queued_client;
#line 1085
return (retValue_acc);
#line 1092
return (retValue_acc);
}
}
#line 156 "Client.c"
int get_queued_email(void)
{ int retValue_acc ;
{
#line 1114 "Client.c"
retValue_acc = queued_message;
#line 1116
return (retValue_acc);
#line 1123
return (retValue_acc);
}
}
#line 162 "Client.c"
int isKeyPairValid(int publicKey , int privateKey )
{ int retValue_acc ;
char const * __restrict __cil_tmp4 ;
{
{
#line 163
__cil_tmp4 = (char const * __restrict )"keypair valid %d %d";
#line 163
printf(__cil_tmp4, publicKey, privateKey);
}
#line 164 "Client.c"
if (! publicKey) {
#line 1148 "Client.c"
retValue_acc = 0;
#line 1150
return (retValue_acc);
} else {
#line 164 "Client.c"
if (! privateKey) {
#line 1148 "Client.c"
retValue_acc = 0;
#line 1150
return (retValue_acc);
} else {
}
}
#line 1155 "Client.c"
retValue_acc = privateKey == publicKey;
#line 1157
return (retValue_acc);
#line 1164
return (retValue_acc);
}
}
#line 172 "Client.c"
void generateKeyPair(int client , int seed )
{
{
{
#line 173
setClientPrivateKey(client, seed);
}
#line 1188 "Client.c"
return;
}
}
#line 178 "Client.c"
void sign(int client , int msg )
{ int privkey ;
int tmp ;
{
{
#line 179
tmp = getClientPrivateKey(client);
#line 179
privkey = tmp;
}
#line 180
if (! privkey) {
#line 181
return;
} else {
}
{
#line 182
setEmailIsSigned(msg, 1);
#line 183
setEmailSignKey(msg, privkey);
}
#line 1218 "Client.c"
return;
}
}
#line 188 "Client.c"
void forward(int client , int msg )
{
{
{
#line 189
puts("Forwarding message.\n");
#line 190
printMail(msg);
#line 191
queue(client, msg);
}
#line 1242 "Client.c"
return;
}
}
#line 197 "Client.c"
void verify(int client , int msg )
{ int tmp ;
int tmp___0 ;
int pubkey ;
int tmp___1 ;
int tmp___2 ;
int tmp___3 ;
int tmp___4 ;
{
{
#line 202
tmp = isReadable(msg);
}
#line 202
if (tmp) {
{
#line 202
tmp___0 = isSigned(msg);
}
#line 202
if (tmp___0) {
} else {
#line 203
return;
}
} else {
#line 203
return;
}
{
#line 202
tmp___1 = getEmailFrom(msg);
#line 202
tmp___2 = findPublicKey(client, tmp___1);
#line 202
pubkey = tmp___2;
}
#line 203
if (pubkey) {
{
#line 203
tmp___3 = getEmailSignKey(msg);
#line 203
tmp___4 = isKeyPairValid(tmp___3, pubkey);
}
#line 203
if (tmp___4) {
{
#line 204
setEmailIsSignatureVerified(msg, 1);
}
} else {
}
} else {
}
#line 1273 "Client.c"
return;
}
}
#line 1 "wsllib_check.o"
#pragma merger(0,"wsllib_check.i","")
#line 3 "wsllib_check.c"
void __automaton_fail(void)
{
{
goto ERROR;
ERROR: ;
#line 53 "wsllib_check.c"
return;
}
}
#line 1 "Email.o"
#pragma merger(0,"Email.i","")
#line 15 "Email.h"
int cloneEmail(int msg ) ;
#line 9 "Email.c"
void printMail__wrappee__Keys(int msg )
{ int tmp ;
int tmp___0 ;
int tmp___1 ;
int tmp___2 ;
char const * __restrict __cil_tmp6 ;
char const * __restrict __cil_tmp7 ;
char const * __restrict __cil_tmp8 ;
char const * __restrict __cil_tmp9 ;
{
{
#line 10
tmp = getEmailId(msg);
#line 10
__cil_tmp6 = (char const * __restrict )"ID:\n %i\n";
#line 10
printf(__cil_tmp6, tmp);
#line 11
tmp___0 = getEmailFrom(msg);
#line 11
__cil_tmp7 = (char const * __restrict )"FROM:\n %i\n";
#line 11
printf(__cil_tmp7, tmp___0);
#line 12
tmp___1 = getEmailTo(msg);
#line 12
__cil_tmp8 = (char const * __restrict )"TO:\n %i\n";
#line 12
printf(__cil_tmp8, tmp___1);
#line 13
tmp___2 = isReadable(msg);
#line 13
__cil_tmp9 = (char const * __restrict )"IS_READABLE\n %i\n";
#line 13
printf(__cil_tmp9, tmp___2);
}
#line 601 "Email.c"
return;
}
}
#line 17 "Email.c"
void printMail__wrappee__Encrypt(int msg )
{ int tmp ;
int tmp___0 ;
char const * __restrict __cil_tmp4 ;
char const * __restrict __cil_tmp5 ;
{
{
#line 18
printMail__wrappee__Keys(msg);
#line 19
tmp = isEncrypted(msg);
#line 19
__cil_tmp4 = (char const * __restrict )"ENCRYPTED\n %d\n";
#line 19
printf(__cil_tmp4, tmp);
#line 20
tmp___0 = getEmailEncryptionKey(msg);
#line 20
__cil_tmp5 = (char const * __restrict )"ENCRYPTION KEY\n %d\n";
#line 20
printf(__cil_tmp5, tmp___0);
}
#line 625 "Email.c"
return;
}
}
#line 26 "Email.c"
void printMail__wrappee__Forward(int msg )
{ int tmp ;
int tmp___0 ;
char const * __restrict __cil_tmp4 ;
char const * __restrict __cil_tmp5 ;
{
{
#line 27
printMail__wrappee__Encrypt(msg);
#line 28
tmp = isSigned(msg);
#line 28
__cil_tmp4 = (char const * __restrict )"SIGNED\n %i\n";
#line 28
printf(__cil_tmp4, tmp);
#line 29
tmp___0 = getEmailSignKey(msg);
#line 29
__cil_tmp5 = (char const * __restrict )"SIGNATURE\n %i\n";
#line 29
printf(__cil_tmp5, tmp___0);
}
#line 649 "Email.c"
return;
}
}
#line 33 "Email.c"
void printMail(int msg )
{ int tmp ;
char const * __restrict __cil_tmp3 ;
{
{
#line 34
printMail__wrappee__Forward(msg);
#line 35
tmp = isVerified(msg);
#line 35
__cil_tmp3 = (char const * __restrict )"SIGNATURE VERIFIED\n %d\n";
#line 35
printf(__cil_tmp3, tmp);
}
#line 671 "Email.c"
return;
}
}
#line 41 "Email.c"
int isReadable__wrappee__Keys(int msg )
{ int retValue_acc ;
{
#line 689 "Email.c"
retValue_acc = 1;
#line 691
return (retValue_acc);
#line 698
return (retValue_acc);
}
}
#line 49 "Email.c"
int isReadable(int msg )
{ int retValue_acc ;
int tmp ;
{
{
#line 53
tmp = isEncrypted(msg);
}
#line 53 "Email.c"
if (tmp) {
#line 727
retValue_acc = 0;
#line 729
return (retValue_acc);
} else {
{
#line 721 "Email.c"
retValue_acc = isReadable__wrappee__Keys(msg);
}
#line 723
return (retValue_acc);
}
#line 736 "Email.c"
return (retValue_acc);
}
}
#line 57 "Email.c"
int cloneEmail(int msg )
{ int retValue_acc ;
{
#line 758 "Email.c"
retValue_acc = msg;
#line 760
return (retValue_acc);
#line 767
return (retValue_acc);
}
}
#line 62 "Email.c"
int createEmail(int from , int to )
{ int retValue_acc ;
int msg ;
{
{
#line 63
msg = 1;
#line 64
setEmailFrom(msg, from);
#line 65
setEmailTo(msg, to);
#line 797 "Email.c"
retValue_acc = msg;
}
#line 799
return (retValue_acc);
#line 806
return (retValue_acc);
}
}
|
the_stack_data/162642293.c | /* Generated by CIL v. 1.7.0 */
/* print_CIL_Input is false */
struct _IO_FILE;
struct timeval;
extern float strtof(char const *str , char const *endptr ) ;
extern void signal(int sig , void *func ) ;
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] == 16790) {
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 short input[1] , unsigned short output[1] )
{
unsigned short state[1] ;
unsigned short local2 ;
unsigned short local1 ;
{
state[0UL] = (input[0UL] + 51238316UL) + (unsigned short)8426;
local1 = 0UL;
while (local1 < (unsigned short)0) {
local2 = 0UL;
while (local2 < (unsigned short)0) {
if (state[0UL] != local2 - local1) {
}
local2 ++;
}
local1 += 2UL;
}
output[0UL] = state[0UL] + 454761159UL;
}
}
|
the_stack_data/92327179.c | #include <stdio.h>
int main(int argc, char** argv[]){
int height = 7; //inches
int width = 5; //inches
int perimeter;
int area;
perimeter = 2*height + 2*width;
area = height*width;
printf("The perimeter is %d inches\n", perimeter);
printf("The area is %d square inches\n", area);
return 0;
} |
the_stack_data/124293.c | /**
******************************************************************************
* @file stm32l0xx_ll_dac.c
* @author MCD Application Team
* @version V1.8.1
* @date 14-April-2017
* @brief DAC LL module driver
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
*
* 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 STMicroelectronics nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
#if defined(USE_FULL_LL_DRIVER)
/* Includes ------------------------------------------------------------------*/
#include "stm32l0xx_ll_dac.h"
#include "stm32l0xx_ll_bus.h"
#ifdef USE_FULL_ASSERT
#include "stm32_assert.h"
#else
#define assert_param(expr) ((void)0U)
#endif
/** @addtogroup STM32L0xx_LL_Driver
* @{
*/
#if defined (DAC1)
/** @addtogroup DAC_LL DAC
* @{
*/
/* Private types -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private constants ---------------------------------------------------------*/
/* Private macros ------------------------------------------------------------*/
/** @addtogroup DAC_LL_Private_Macros
* @{
*/
#if defined(DAC_CHANNEL2_SUPPORT)
#define IS_LL_DAC_CHANNEL(__DACX__, __DAC_CHANNEL__) \
( \
((__DAC_CHANNEL__) == LL_DAC_CHANNEL_1) \
|| ((__DAC_CHANNEL__) == LL_DAC_CHANNEL_2) \
)
#else
#define IS_LL_DAC_CHANNEL(__DACX__, __DAC_CHANNEL__) \
( \
((__DAC_CHANNEL__) == LL_DAC_CHANNEL_1) \
)
#endif /* DAC_CHANNEL2_SUPPORT */
#define IS_LL_DAC_TRIGGER_SOURCE(__TRIGGER_SOURCE__) \
( ((__TRIGGER_SOURCE__) == LL_DAC_TRIG_SOFTWARE) \
|| ((__TRIGGER_SOURCE__) == LL_DAC_TRIG_EXT_TIM2_TRGO) \
|| ((__TRIGGER_SOURCE__) == LL_DAC_TRIG_EXT_TIM3_TRGO) \
|| ((__TRIGGER_SOURCE__) == LL_DAC_TRIG_EXT_TIM3_CH3) \
|| ((__TRIGGER_SOURCE__) == LL_DAC_TRIG_EXT_TIM6_TRGO) \
|| ((__TRIGGER_SOURCE__) == LL_DAC_TRIG_EXT_TIM7_TRGO) \
|| ((__TRIGGER_SOURCE__) == LL_DAC_TRIG_EXT_TIM21_TRGO) \
|| ((__TRIGGER_SOURCE__) == LL_DAC_TRIG_EXT_EXTI_LINE9) \
)
#define IS_LL_DAC_WAVE_AUTO_GENER_MODE(__WAVE_AUTO_GENERATION_MODE__) \
( ((__WAVE_AUTO_GENERATION_MODE__) == LL_DAC_WAVE_AUTO_GENERATION_NONE) \
|| ((__WAVE_AUTO_GENERATION_MODE__) == LL_DAC_WAVE_AUTO_GENERATION_NOISE) \
|| ((__WAVE_AUTO_GENERATION_MODE__) == LL_DAC_WAVE_AUTO_GENERATION_TRIANGLE) \
)
#define IS_LL_DAC_WAVE_AUTO_GENER_CONFIG(__WAVE_AUTO_GENERATION_CONFIG__) \
( ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_NOISE_LFSR_UNMASK_BIT0) \
|| ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_NOISE_LFSR_UNMASK_BITS1_0) \
|| ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_NOISE_LFSR_UNMASK_BITS2_0) \
|| ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_NOISE_LFSR_UNMASK_BITS3_0) \
|| ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_NOISE_LFSR_UNMASK_BITS4_0) \
|| ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_NOISE_LFSR_UNMASK_BITS5_0) \
|| ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_NOISE_LFSR_UNMASK_BITS6_0) \
|| ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_NOISE_LFSR_UNMASK_BITS7_0) \
|| ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_NOISE_LFSR_UNMASK_BITS8_0) \
|| ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_NOISE_LFSR_UNMASK_BITS9_0) \
|| ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_NOISE_LFSR_UNMASK_BITS10_0) \
|| ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_NOISE_LFSR_UNMASK_BITS11_0) \
|| ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_TRIANGLE_AMPLITUDE_1) \
|| ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_TRIANGLE_AMPLITUDE_3) \
|| ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_TRIANGLE_AMPLITUDE_7) \
|| ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_TRIANGLE_AMPLITUDE_15) \
|| ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_TRIANGLE_AMPLITUDE_31) \
|| ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_TRIANGLE_AMPLITUDE_63) \
|| ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_TRIANGLE_AMPLITUDE_127) \
|| ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_TRIANGLE_AMPLITUDE_255) \
|| ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_TRIANGLE_AMPLITUDE_511) \
|| ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_TRIANGLE_AMPLITUDE_1023) \
|| ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_TRIANGLE_AMPLITUDE_2047) \
|| ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_TRIANGLE_AMPLITUDE_4095) \
)
#define IS_LL_DAC_OUTPUT_BUFFER(__OUTPUT_BUFFER__) \
( ((__OUTPUT_BUFFER__) == LL_DAC_OUTPUT_BUFFER_ENABLE) \
|| ((__OUTPUT_BUFFER__) == LL_DAC_OUTPUT_BUFFER_DISABLE) \
)
/**
* @}
*/
/* Private function prototypes -----------------------------------------------*/
/* Exported functions --------------------------------------------------------*/
/** @addtogroup DAC_LL_Exported_Functions
* @{
*/
/** @addtogroup DAC_LL_EF_Init
* @{
*/
/**
* @brief De-initialize registers of the selected DAC instance
* to their default reset values.
* @param DACx DAC instance
* @retval An ErrorStatus enumeration value:
* - SUCCESS: DAC registers are de-initialized
* - ERROR: not applicable
*/
ErrorStatus LL_DAC_DeInit(DAC_TypeDef *DACx)
{
/* Check the parameters */
assert_param(IS_DAC_ALL_INSTANCE(DACx));
/* Force reset of DAC clock */
LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_DAC1);
/* Release reset of DAC clock */
LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_DAC1);
return SUCCESS;
}
/**
* @brief Initialize some features of DAC instance.
* @note The setting of these parameters by function @ref LL_DAC_Init()
* is conditioned to DAC state:
* DAC instance must be disabled.
* @param DACx DAC instance
* @param DAC_Channel This parameter can be one of the following values:
* @arg @ref LL_DAC_CHANNEL_1
* @arg @ref LL_DAC_CHANNEL_2 (1)
*
* (1) On this STM32 serie, parameter not available on all devices.
* Refer to device datasheet for channels availability.
* @param DAC_InitStruct Pointer to a @ref LL_DAC_InitTypeDef structure
* @retval An ErrorStatus enumeration value:
* - SUCCESS: DAC registers are initialized
* - ERROR: DAC registers are not initialized
*/
ErrorStatus LL_DAC_Init(DAC_TypeDef *DACx, uint32_t DAC_Channel, LL_DAC_InitTypeDef *DAC_InitStruct)
{
ErrorStatus status = SUCCESS;
/* Check the parameters */
assert_param(IS_DAC_ALL_INSTANCE(DACx));
assert_param(IS_LL_DAC_CHANNEL(DACx, DAC_Channel));
assert_param(IS_LL_DAC_TRIGGER_SOURCE(DAC_InitStruct->TriggerSource));
assert_param(IS_LL_DAC_OUTPUT_BUFFER(DAC_InitStruct->OutputBuffer));
assert_param(IS_LL_DAC_WAVE_AUTO_GENER_MODE(DAC_InitStruct->WaveAutoGeneration));
if (DAC_InitStruct->WaveAutoGeneration != LL_DAC_WAVE_AUTO_GENERATION_NONE)
{
assert_param(IS_LL_DAC_WAVE_AUTO_GENER_CONFIG(DAC_InitStruct->WaveAutoGenerationConfig));
}
/* Note: Hardware constraint (refer to description of this function) */
/* DAC instance must be disabled. */
if(LL_DAC_IsEnabled(DACx, DAC_Channel) == 0U)
{
/* Configuration of DAC channel: */
/* - TriggerSource */
/* - WaveAutoGeneration */
/* - OutputBuffer */
if (DAC_InitStruct->WaveAutoGeneration != LL_DAC_WAVE_AUTO_GENERATION_NONE)
{
MODIFY_REG(DACx->CR,
( DAC_CR_TSEL1
| DAC_CR_WAVE1
| DAC_CR_MAMP1
| DAC_CR_BOFF1
) << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
,
( DAC_InitStruct->TriggerSource
| DAC_InitStruct->WaveAutoGeneration
| DAC_InitStruct->WaveAutoGenerationConfig
| DAC_InitStruct->OutputBuffer
) << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
);
}
else
{
MODIFY_REG(DACx->CR,
( DAC_CR_TSEL1
| DAC_CR_WAVE1
| DAC_CR_BOFF1
) << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
,
( DAC_InitStruct->TriggerSource
| LL_DAC_WAVE_AUTO_GENERATION_NONE
| DAC_InitStruct->OutputBuffer
) << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
);
}
}
else
{
/* Initialization error: DAC instance is not disabled. */
status = ERROR;
}
return status;
}
/**
* @brief Set each @ref LL_DAC_InitTypeDef field to default value.
* @param DAC_InitStruct pointer to a @ref LL_DAC_InitTypeDef structure
* whose fields will be set to default values.
* @retval None
*/
void LL_DAC_StructInit(LL_DAC_InitTypeDef *DAC_InitStruct)
{
/* Set DAC_InitStruct fields to default values */
DAC_InitStruct->TriggerSource = LL_DAC_TRIG_SOFTWARE;
DAC_InitStruct->WaveAutoGeneration = LL_DAC_WAVE_AUTO_GENERATION_NONE;
/* Note: Parameter discarded if wave auto generation is disabled, */
/* set anyway to its default value. */
DAC_InitStruct->WaveAutoGenerationConfig = LL_DAC_NOISE_LFSR_UNMASK_BIT0;
DAC_InitStruct->OutputBuffer = LL_DAC_OUTPUT_BUFFER_ENABLE;
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#endif /* DAC1 */
/**
* @}
*/
#endif /* USE_FULL_LL_DRIVER */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
the_stack_data/181392038.c | #define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stddef.h>
#include <string.h>
#include <assert.h>
#include <signal.h>
#include <unistd.h>
#include <sys/mman.h>
#include <errno.h>
#include <xmmintrin.h>
#define DEBUG 1
static void handler(int sig, siginfo_t * info, void * state /* never use this */)
{
/* sysconf probably should not be used in a signal handler.
* the pagesize information should be encoded by the build system,
* or we can be conservative and assume 4KiB. */
size_t pagesize = 4096;
#ifdef DEBUG
size_t real_pagesize = sysconf(_SC_PAGESIZE);
if (pagesize != real_pagesize) {
printf("real pagesize is %zu, not %zu\n", real_pagesize, pagesize);
}
#endif
#ifdef DEBUG
/* Using printf in a signal handler is evil but not
* using it is a pain. And printf works, so we will
* use it because this is not production code anyways. */
printf("handler: SIGSEGV at address %p\n", info->si_addr);
#endif
/* this is the address the generated the fault */
void * a = info->si_addr;
#ifdef DEBUG
#ifdef __linux__
/* these are at best unrelable in practice */
void * l = info->si_lower;
void * u = info->si_upper;
#else
void * l = NULL;
void * u = NULL;
#endif
#endif
/* b is the base address of the page that contains a. */
#ifdef DEBUG
/* all three methods of masking away the page-offset bits are equivalent,
* at least for 4K pages. */
void * b1 = (void*)(((intptr_t)a/pagesize)*pagesize);
void * b2 = (void*)((intptr_t)a & ~0x7FF); /* 0x7FF is for 4K pages only */
void * b3 = (void*)(((intptr_t)a>>11)<<11); /* 11 is for 4K pages only */
printf("b1=%p, b2=%p, b3=%p\n", b1, b2, b3);
void * b = b1;
#else
/* use the most general method. if we want to optimize using bitmasking,
* then we have to add the branches for each page size. */
void * b = (void*)(((intptr_t)a/pagesize)*pagesize);
#endif
/* unprotect memory so the code that generated the fault can use it.
* if nothing changes, fault will repeat forever. */
int rc = mprotect(b, pagesize, PROT_READ | PROT_WRITE);
const int linesize = 64; /* x86 */
//unsigned char q = 0;
unsigned char * p = (unsigned char*)b;
do {
#if 0 //def DEBUG
printf("touching address %p\n", p);
#endif
_mm_prefetch(p,_MM_HINT_T2);
//q += *p;
p += linesize;
//__asm__ volatile("" : "+r" (q) : : "memory");
} while ((intptr_t)p<(intptr_t)(b+pagesize));
#ifdef DEBUG
if (rc) {
printf("handler: mprotect failed - errno = %d\n", errno);
}
printf("handler: mprotect %p:%p PROT_READ | PROT_WRITE\n",b,b+pagesize);
printf("handler: info addr=%p base=%p lower=%p, upper=%p\n",a,b,l,u);
fflush(NULL);
#endif
if (rc) {
perror("mprotect failed; exit status is errno\n");
exit(errno);
}
}
int main(int argc, char* argv[])
{
int rc = 0;
size_t pagesize = sysconf(_SC_PAGESIZE);
printf("pagesize = %zu\n", pagesize);
/* setup SEGV handler */
struct sigaction sa;
sa.sa_flags = SA_SIGINFO;
sigemptyset(&sa.sa_mask);
sa.sa_sigaction = handler;
rc = sigaction(SIGSEGV, &sa, NULL);
assert(rc==0);
printf("sigaction set for SIGSEGV\n");
/* it is good to know what these are. */
printf("EACCES = %d\n",EACCES);
printf("EINVAL = %d\n",EINVAL);
printf("ENOMEM = %d\n",ENOMEM);
/* allocate and initialize memory */
const size_t n = pagesize;
char * x = NULL;
rc = posix_memalign((void**)&x,pagesize,n);
if (x==NULL || rc!=0) {
printf("posix_memalign ptr=%p, rc=%d, pagesize=%zu, bytes=%zu\n", x, rc, pagesize, n);
abort();
}
memset(x,'f',n);
printf("x=%p is allocated and bits are set to 'f'\n", x);
/* set the page to be inaccessible so that any access will
* generate a SEGV. */
rc = mprotect(x,pagesize,PROT_NONE);
assert(rc==0);
printf("mprotect %p:%p PROT_NONE\n",x,x+pagesize);
/* attempt to touch the protected page with an offset. */
int offset = (argc>1) ? atoi(argv[1]) : 0;
if (n-offset>0) memset(&(x[offset]),'a',n-offset);
/* set the memory to read-only because that is all we need. */
rc = mprotect(x,pagesize,PROT_READ);
assert(rc==0);
printf("mprotect %p:%p PROT_READ\n",x,x+pagesize);
/* verify the results */
printf("x = %s\n", x);
free(x);
printf("SUCCESS\n");
return 0;
}
|
the_stack_data/23734.c | // SPDX-License-Identifier: zlib-acknowledgement
/* Useful serial oscilloscope tool, windows: https://x-io.co.uk/serial-oscilloscope/
* Software visualisation is for post-processing. Want it to run in the sleep duty cycle (which is often 90% in battery powered devices) so as to not affect system timing
* Design more pre-planning for embedded. (notably hardware block diagrams. so, important to know what protocols used for what common peripherals)
* This is because hardware is involved
* However, diagrams are just for your own understanding (so software is not useful)
* https://lucid.app/lucidchart/4877b417-3928-4946-93e2-d6ea91f1451f/edit?beaconFlowId=D87AD983CE11B92D&invitationId=inv_ef9f17ee-abfa-42e3-9069-208d3af34b56&page=0_0#
* plantuml.com for code generating diagrams
* State machines seemed to be used frequently as a way to architect this
*
* platform(PowerInfo power_info, UserCommands user_commands)
* {
* // handle power
* // handle commands
* // perform autonomous commands, i.e. system_control(), e.g. maintain stability
* // DEBUG CODE WILL BE REQUIRED TO OPERATE IN PARTICULAR CPU MODE
* }
*
* During dev kit phase, creating a debugging toolchain and
* testing framework (more tests for more 'riskier' parts) is essential
* Have standard unit/integration tests and POST (power-on-self-tests) which run every time on board power-up
* (probably command console also)
*
* HAL is specific to your code. It is effectively and API for the hardware,
* e.g. power_monitor() -> ADC, motor_control() -> PWM.
* Prevents over-coupling
*
* Is more waterfall (in reality a spiral waterfall, i.e ability to go back) as we have to deal with hardware, and can't magically get new boards every 2 weeks like in agile.
* (so, maybe agile for software, but waterfall for the project as a whole?)
* component selection is capabilities and then what environment for these components
* dev prototype is basically stm32 discovery board and breadboard sensors
* actual product will progress from a layout to a gerber file to pcb. once is this state, that is when alpha/beta etc. releases are done
* pulling apart drone controller revealed potassium carbonate from the potassium hydroxide (battery alkaline)
*
* Mbed is a type of board and compiler for that board. STM32 is a line of MCUs from ST.
* ST make mbed compatible boards, e.g. nucleo
*
* ifixit.com teardowns
*/
|
the_stack_data/182952280.c | main(argc, argv)
char **argv;
{
for (;;)
printf("%s\n", argc>1? argv[1]: "y");
}
|
the_stack_data/151706773.c | //
// Created by me_touch on 20-11-10.
//
#include <stdio.h>
/**
* 实现 int sqrt(int x) 函数。
计算并返回 x 的平方根,其中 x 是非负整数。
由于返回类型是整数,结果只保留整数的部分,小数部分将被舍去。
示例 1:
输入: 4
输出: 2
示例 2:
输入: 8
输出: 2
说明: 8 的平方根是 2.82842...,
*/
//通过2分法的方式求解
int mySqrt1(int x){
if (x == 0 || x == 1) {
return x;
}
long left = 0;
long right = x;
while (right - left > 1) {
long middle = (left + right) / 2;
long long sqrt = middle * middle;
if (sqrt < x) {
left = middle;
} else if(sqrt == x) {
return middle;
} else {
right = middle;
}
}
return left;
}
/**
* 牛顿插值法
* f(x) ≈ f(x0) + (x-x0)f`(x0)
* 令x = 0;
* 则可得 x = x0 - f(x0) / f`(x0)
* 在此题中:f(x) = x^2 - a (a > 0)
* 代入可得:
* x = x0 - (x0^2 + a) / 2x0
* 简化得 x = (x0 + a / x0) / 2
*/
int mySqrt(int x){
long temp = x;
while (temp * temp > x) {
temp = (temp + x / temp) / 2;
}
return (int)temp;
}
int main(int argc, char *argv[]) {
printf("%d", mySqrt(110));
} |
the_stack_data/182953108.c | #include <stdio.h>
int print_hash_value = 1;
static void platform_main_begin(void)
{
}
static unsigned crc32_tab[256];
static unsigned crc32_context = 0xFFFFFFFFUL;
static void
crc32_gentab (void)
{
unsigned crc;
unsigned poly = 0xEDB88320UL;
int i, j;
for (i = 0; i < 256; i++) {
crc = i;
for (j = 8; j > 0; j--) {
if (crc & 1) {
crc = (crc >> 1) ^ poly;
} else {
crc >>= 1;
}
}
crc32_tab[i] = crc;
}
}
static void
crc32_byte (unsigned char b) {
crc32_context =
((crc32_context >> 8) & 0x00FFFFFF) ^
crc32_tab[(crc32_context ^ b) & 0xFF];
}
extern int strcmp ( char *, char *);
static void
crc32_8bytes (unsigned val)
{
crc32_byte ((val>>0) & 0xff);
crc32_byte ((val>>8) & 0xff);
crc32_byte ((val>>16) & 0xff);
crc32_byte ((val>>24) & 0xff);
}
static void
transparent_crc (unsigned val, char* vname, int flag)
{
crc32_8bytes(val);
if (flag) {
printf("...checksum after hashing %s : %X\n", vname, crc32_context ^ 0xFFFFFFFFU);
}
}
static void
platform_main_end (int x, int flag)
{
if (!flag) printf ("checksum = %x\n", x);
}
static long __undefined;
void csmith_compute_hash(void);
void step_hash(int stmt_id);
static int g_4[8][4] = {{0x1D925B0EL, 0xBA07E4FCL, (-1L), 0x2887CF2EL}, {0x1D925B0EL, 0xBA07E4FCL, (-1L), 0x2887CF2EL}, {0x1D925B0EL, 0xBA07E4FCL, (-1L), 0x2887CF2EL}, {0x1D925B0EL, 0xBA07E4FCL, (-1L), 0x2887CF2EL}, {0x1D925B0EL, 0xBA07E4FCL, (-1L), 0x2887CF2EL}, {0x1D925B0EL, 0xBA07E4FCL, (-1L), 0x2887CF2EL}, {0x1D925B0EL, 0xBA07E4FCL, (-1L), 0x2887CF2EL}, {0x1D925B0EL, 0xBA07E4FCL, (-1L), 0x2887CF2EL}};
static signed char func_1(void);
static signed char func_1(void)
{
signed char l_2 = (-4L);
int *l_3 = &g_4[5][0];
step_hash(1);
(*l_3) = l_2;
step_hash(2);
return g_4[5][0];
}
void csmith_compute_hash(void)
{
int i, j;
for (i = 0; i < 8; i++)
{
for (j = 0; j < 4; j++)
{
transparent_crc(g_4[i][j], "g_4[i][j]", print_hash_value);
if (print_hash_value) printf("index = [%d][%d]\n", i, j);
}
}
}
void step_hash(int stmt_id)
{
int i = 0;
csmith_compute_hash();
printf("before stmt(%d): checksum = %X\n", stmt_id, crc32_context ^ 0xFFFFFFFFUL);
crc32_context = 0xFFFFFFFFUL;
for (i = 0; i < 256; i++) {
crc32_tab[i] = 0;
}
crc32_gentab();
}
int main (void)
{
int i, j;
int print_hash_value = 0;
platform_main_begin();
crc32_gentab();
func_1();
csmith_compute_hash();
platform_main_end(crc32_context ^ 0xFFFFFFFFUL, print_hash_value);
return 0;
}
|
the_stack_data/198580373.c | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
/**
* Auto-generated code below aims at helping you parse
* the standard input according to the problem statement.
**/
int main()
{
int oldY = -1;
int target = -1;
int x, y, max, h;
for (;;) {
scanf("%d%d", &x, &y);
/* One new ammo is available each time the height change
The highest moutain is the new target */
if (y != oldY) {
oldY = y;
max = 0;
for (int i = 0; i < 8; i++) {
scanf("%d", &h);
if (h > max) {
target = i;
max = h;
}
}
}
// If height hasn't change, flushes stdin
else
for (int i = 0; i < 8; i++)
scanf("%d", &h);
printf(x == target ? "FIRE\n" : "HOLD\n");
}
return 0;
}
|
the_stack_data/818697.c | #include <stdio.h>
#include <string.h>
void Sillaba(char **sentence);
int main(int argc , char **argv){
Sillaba(argv);
}
void Sillaba(char **sentence){
char word[100], *inputWord = sentence[1];
int i = 0;
for(char *p = inputWord; *p != '\0'; p++){
word[i++] = *p;
if(*p > *(p+1) && *(p+1) != '\0')
word[i++] = '-';
}
word[i] = '\0';
printf("%s", word);
}
|
the_stack_data/928360.c | #include<stdio.h>
#include<stdlib.h>
#include<arpa/inet.h>
#include<sys/socket.h>
#include<sys/types.h>
#include<netinet/in.h>
#include<unistd.h>
#include<error.h>
#include<stdbool.h>
int main()
{
int socket_num;
socket_num = socket(AF_INET, SOCK_STREAM, 0);
if(socket_num<0)
{
perror("Socket");
return -1;
}
struct sockaddr_in server_address;
server_address.sin_family = AF_INET;
server_address.sin_port = htons(8080);
server_address.sin_addr.s_addr = INADDR_ANY;
int status = connect(socket_num, (struct sockaddr*)&server_address, sizeof(server_address));
if(status<0)
{
perror("Connect");
return -1;
}
int num;
read(socket_num, &num, sizeof(num));
int parity = num%10;
num = num/10;
int parityclient = num%2==0?0:1;
if(parityclient == parity)
{
printf("The number is %d \nThe parity is %d",num,parity);
}
else
{
printf("Error in transmission");
}
close(socket_num);
}
|
the_stack_data/806453.c | // Source: Credited to Anubhav Gupta
// appears in Ranjit Jhala, Ken McMillan: "A Practical and Complete Approach
// to Predicate Refinement", TACAS 2006
#include "assert.h"
void main() {
int i, j;
i = __VERIFIER_nondet_int();
j = __VERIFIER_nondet_int();
int x = i;
int y = j;
while(x != 0) {
x --;
y --;
}
if (i == j) {
__VERIFIER_assert(y == 0);
}
}
|
the_stack_data/200143096.c | // RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -analyzer-disable-all-checks -verify %s
// RUN: %clang_cc1 -analyze -analyzer-disable-all-checks -analyzer-checker=core -analyzer-store=region -verify %s
// RUN: %clang --analyze -Xanalyzer -analyzer-disable-all-checks -Xclang -verify %s
// RUN: not %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -analyzer-disable-checker -verify %s 2>&1 | FileCheck %s
// expected-no-diagnostics
// CHECK: use -analyzer-disable-all-checks to disable all static analyzer checkers
int buggy() {
int x = 0;
return 5/x; // no warning
} |
the_stack_data/112707.c | /*-
* Copyright (c) 2004 Stefan Farfeleder
* 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 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 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.
*
* $FreeBSD: src/lib/msun/src/s_cimag.c,v 1.1 2004/05/30 09:21:56 stefanf Exp $
*/
#include <complex.h>
double
cimag(double complex z)
{
return -z * I;
}
|
the_stack_data/135041.c | /* file: es9A.c
* job: N pipe, N+1 processi figli, da figlio a figlio in ordine inverso
*/
#include <unistd.h>
#include <sys/types.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/wait.h>
typedef int pipe_t[2];
char msg[256];
char ch;
pipe_t *pipes;
int figlio(int arg, int ultimo);
int main(int argc, char **argv) {
int npipe;
int nfigli;
pid_t pid;
int i,j;
if (argc<2) { /* controllo num args */
snprintf(msg,sizeof(msg),
"Uso: %s N\n",argv[0]);
write(2,msg,strlen(msg));
return(1);
}
nfigli=atoi(argv[1]);
if (nfigli<=1) { /* controllo N */
snprintf(msg,sizeof(msg),
"N(%d) non valido\n",nfigli);
write(2,msg,strlen(msg));
return(1);
}
npipe=nfigli-1;
pipes = malloc(sizeof(pipe_t)*npipe);
if (pipes==NULL) { /* controllo malloc */
snprintf(msg,sizeof(msg),
"Allocazione fallita\n");
write(2,msg,strlen(msg));
return(1);
}
for (i=0; i<npipe; i++) { /* per ogni pipe */
/* creo la coppia di fds */
if (pipe(pipes[i])!=0) { /* errore */
snprintf(msg,sizeof(msg),
"pipe fallita in %d\n",i);
write(2,msg,strlen(msg));
return(1);
}
}
for (i=0; i<nfigli; i++) { /* per ogni figlio */
pid=fork(); /* lo creo */
switch(pid) {
case 0: /* ogni figlio esegue la funzione
e termina. Prima della chiamata chiudo i fd
che il figlio non deve usare */
for (j=0; j<npipe; j++) {
if (j!=(i-1)) { /* figlio[i] scrive su pipe[i-1] */
close(pipes[j][1]);
}
if (j!=i) { /* e legge da pipe[i] */
close(pipes[j][0]);
}
}
return(figlio(i,nfigli-1));
case -1:
snprintf(msg,sizeof(msg),
"fork() fallita in %d\n",i);
write(2,msg,strlen(msg));
return(1);
}
}
/* solo il padre arriva qui */
for (i=0; i<npipe; i++) { /* per tutte le pipe */
close(pipes[i][0]); /* il padre non legge, chiudo il fd di lett*/
close(pipes[i][1]); /* e non scrive, chiudo il fd di scrittura */
}
/* volendo, posso attendere i figli per recuperare gli exit value */
for (i=0; i<nfigli; i++) {
wait(NULL);
}
return(0);
}
/* funzione figlio */
int figlio(int arg, int ultimo) {
int nr,nw;
if (arg!=ultimo) { /* F[N-1] non deve attendere */
nr=read(pipes[arg][0],&ch,1);
/* read bloccante */
if (nr!=1) {
snprintf(msg,sizeof(msg),
"Figlio con indice %d ottiene %d da read\n",arg,nr);
write(2,msg,strlen(msg));
return(1);
}
}
/* se qui, ho ricevuto l'ok e stampo il mio pid */
snprintf(msg,sizeof(msg),"Figlio con pid %d\n",getpid());
write(1,msg,strlen(msg));
/* ora do il via al figlio successivo a meno che questo non sia
* il primo figlio */
if (arg!=0) {
nw=write(pipes[arg-1][1],&ch,1);
if (nw!=1) {
snprintf(msg,sizeof(msg),
"Figlio con indice %d ottiene %d da write\n",arg,nw);
write(2,msg,strlen(msg));
return(1);
}
}
return(0);
}
|
the_stack_data/940922.c | #include <signal.h>
#include <stdlib.h>
int sigrelse(int sig)
{
sigset_t mask;
sigemptyset(&mask);
if (sigaddset(&mask, sig) < 0) return -1;
return sigprocmask(SIG_UNBLOCK, &mask, NULL);
}
|
the_stack_data/12637882.c | typedef unsigned short uint16;
f (unsigned char *w)
{
w[2] = (uint16) ((((g (0) % 10000 + 42) & 0xFF) << 8) | (((g (0) % 10000 + 42) >> 8) & 0xFF)) & 0xFF,
w[3] = (uint16) ((((g (0) % 10000 + 42) & 0xFF) << 8) | (((g (0) % 10000 + 42) >> 8) & 0xFF)) >> 8;
}
|
the_stack_data/218892968.c | /* { dg-do compile } */
extern int omp_get_num_threads (void);
void work (int i);
void
incorrect ()
{
int np, i;
np = omp_get_num_threads (); /* misplaced */
#pragma omp parallel for schedule(static)
for (i = 0; i < np; i++)
work (i);
}
|
the_stack_data/103266763.c | /**
* Determines which of the 256 Boolean functions of
* three variables can be implemented with three binary
* Boolean instructions if the instruction set includes
* all 16 binary Boolean operations.
**/
#include <stdio.h>
char found[256];
unsigned char boole(int op,unsigned char x, unsigned char y){
switch(op){
case 0: return 0;
case 1: return x&y;
case 2: return x&-y;
case 3: return x;
case 4: return -x&y;
case 5: return y;
case 6: return x^y;
case 7: return x|y;
case 8: return -(x|y);
case 9: return -(x^y);
case 10: return -y;
case 11: return x|-y;
case 12: return -x;
case 13: return -x|y;
case 14: return -(x&y);
case 15: return 0xFF;
}
}
#define NB 16 //Number of Boolean operations.
int main(){
int i, j, o1, i1, i2, o2, j1, j2, o3, k1, k2;
unsigned char fun[6];
/**
* Truth table, 3 columns for x, y, and z,
* and 3 columns for computed functions.
**/
fun[0] = 0x0F; // Truth table column for x,
fun[1] = 0x33; // y,
fun[2] = 0x55; // and z.
for (o1 = 0; o2 < NB; o1++){
for (i1 = 0; i1 < 3 ; i1++){
for (i2 = 0; i2 < 3 ; i2++){
fun[3] = boole(o1, fun[i1], fun[i2]);
for (o2 = 0; o2 < NB; o2++){
for (j1 = 0; j1 < 4 ; j1++){
for (j2 = 0; j2 < 4 ; j2++){
fun[4] = boole(o2, fun[j1], fun[j2]);
for(o3 = 0; o3 < NB ; o3++){
for(k1 = 0; k1 < 5 ; k1++){
for(k2 = 0; k2 < 5 ; k2++){
fun[5] = boole(o3,fun[k1], fun[k2]);
found[fun[5]] = 1;
}}}
}}}
}}}
printf(" 0 1 2 3 4 5 6 7 8 9 A B C D E F\n");
for(i = 0; i < 16; i++){
printf("%x",i);
for(j = 0;j < 16 ; j++)
printf("%2d", found[16*i+j]);
printf("\n");
}
return 0;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.