file
stringlengths
18
26
data
stringlengths
3
1.04M
the_stack_data/184518985.c
/* * putw - write an word on a stream */ /* $Id$ */ #include <stdio.h> int putw(int w, register FILE* stream) { register int cnt = sizeof(int); register char* p = (char*)&w; while (cnt--) { putc(*p++, stream); } if (ferror(stream)) return EOF; return w; }
the_stack_data/29808.c
/*@ requires \valid(a) && \valid(b); assigns *a, *b; ensures (*a) == \old(*b); ensures (*b) == \old(*a); */ void foo(int* a, int* b) { int tmp = *a; *a = *b; *b = tmp; }
the_stack_data/165764421.c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_fibonacci.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: xzeng <[email protected]> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/08/12 17:37:01 by xzeng #+# #+# */ /* Updated: 2017/08/12 17:37:04 by xzeng ### ########.fr */ /* */ /* ************************************************************************** */ int ft_fibonacci(int index) { if (index == 0) { return (0); } if (index == 1) { return (1); } if (index < 0) { return (-1); } if (index >= 47) { return (0); } return (ft_fibonacci(index - 1) + ft_fibonacci(index - 2)); }
the_stack_data/153266988.c
#include <stdio.h> #include <string.h> //void move(char *s, int from, int howmuch) //{ // int i; // for (i=from; s[i]!=0; i++) s[i] = s[i+howmuch]; //} int fac(int n) { int i, sum=1; for (i=2; i<=n; i++) sum=sum*i; return sum; } void cut(int n, char **s) { int i, j, step, maxstep=0, k, flag=0; for (i=0; i<n; i++) if (strlen(s[k])>maxstep) maxstep=strlen(s[k]); for (step=maxstep-1; step>0; step--) { for (k=0; k<n; k++) { for (i=0; i<step; i++) { if (step<strlen(s[k]) && s[k][strlen(s[k])-step+i]==s[k+1][i]) flag=1; else { flag=0; break; } } if (flag==1) { for (j=0; j<step; j++) s[k][strlen(s[k])-step+j]=0; flag=0; } } } } //void cut(char *s[n]) //{ // int i, j, step, len, flag=0; // len = strlen(s); // for (step=len/2; step>0; step--) { // for (i=0; i<len; i=i+step) { // for (j=0; j<step; j++) { // if (s[i+j]==s[i+j+step] && s[i+j]!=0) flag=1; // else { // flag=0; // break; // } // } // if (flag=1) move(s, i, step); // flag=0; // } // } //} void unite(char *sup, int n, char **s) { int i, k, j; for (i=0, k=0, j=0; i<256 && k<n; i++, j++) { if (j>=strlen(s[k])) { j=0; k++; } sup[i] = s[k][j]; } } void swap(char *a, char *b) { char temp[20], i; for (i=0; i<20; i++) { temp[i]=a[i]; a[i]=b[i]; b[i]=temp[i]; } } int main() { int n, i, j, min=0; scanf("%d", &n); char s[11][20]={{0}}, sup[256]={0}; for (i=0; i<n; i++) gets(s[i]); cut(n, s); unite(sup, n, s); min=strlen(sup); memset(sup, 0, 256); for (j=1, i=0; j<fac(n); j++, i++) { if (i>=n) i=0; if (i=n-1) swap(s[i], s[0]); else swap(s[i], s[i+1]); cut(n, s); unite(sup, n, s); if (strlen(sup)<min) min=strlen(sup); memset(sup, 0, 256); } printf("%d\n", min); return 0; }
the_stack_data/107977.c
/* Convert wide-character string to maximal unsigned integer. Copyright (C) 1997-2020 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <[email protected]>, 1997. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <https://www.gnu.org/licenses/>. */ #include <inttypes.h> #include <wchar.h> uintmax_t wcstoumax (const wchar_t *__restrict nptr, wchar_t **__restrict endptr, int base) { return __wcstoul_internal (nptr, endptr, base, 0); }
the_stack_data/972014.c
#include <stdio.h> #include <stdlib.h> int main(int argc, char **argv){ /* char *list[] = {"joao", "maria", "boiolage"}; int i = 0; printf("[ "); while ( i < 3){ printf(" \"%s\",", list[i]); } printf("\b ]"); // variável de tamanho dinâmico long long *p = NULL; p = malloc(sizeof (long long)); *p = 0x111111111111111; printf("%lli\n", *p); free(p); */ /* int j[3][3]; int laux = 0; for (int l = 0; l < 3; l++){ laux = l + l*2; for (int c = 0; c < 3; c++){ j[l][c] = laux+c; // *( *(j + l) +c ) = l + c; printf("%i ", j[l][c]); // printf("%i ", *( *(j + l) +c )); } printf("\n"); } */ char * str; // aqui temos um ponteiro vazio. str = malloc (6); // aqui nós alocamos 6 bytes na memória. // guardando dados... str[0] = 'c'; str[1] = 'o'; str[2] = 'i'; str[3] = 's'; str[4] = 'a'; str[5] = '\0'; printf( str ); putchar('\n'); str = realloc (str, 12); // aqui nós realocamos o espaço de 6 bytes para 12 bytes // guardando dados... str[0] = 'o'; str[1] = 'u'; str[2] = 't'; str[3] = 'r'; str[4] = 'a'; str[5] = ' '; str[6] = 'c'; str[7] = 'o'; str[8] = 'i'; str[9] = 's'; str[10] = 'a'; str[11] = '\0'; printf( str ); putchar('\n'); free( str ); /* essa linha vai no fim do programa e serve para liberar a memória que nó alocamos. */ return 0; }
the_stack_data/956989.c
/* * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #include <stdio.h> #include <openssl/x509.h> #include <openssl/x509v3.h> #include <openssl/pem.h> #include <openssl/err.h> int main(int ac, char **av) { X509 *x = NULL; BIO *b = NULL; long pathlen; int ret = 1; if (ac != 2) { fprintf(stderr, "Usage error\n"); goto end; } b = BIO_new_file(av[1], "r"); if (b == NULL) goto end; x = PEM_read_bio_X509(b, NULL, NULL, NULL); if (x == NULL) goto end; pathlen = X509_get_pathlen(x); if (pathlen == 6) ret = 0; end: ERR_print_errors_fp(stderr); BIO_free(b); X509_free(x); return ret; }
the_stack_data/105424.c
#ifdef ICACHE_CONFIG #include <stdlib.h> #include <string.h> #include "icache.h" bool init_icache(riscv_icache *icache) { for (int set = 0; set < CACHE_SET_CNT; set++) { riscv_icache_entry *prev = NULL; for (int i = 0; i < CACHE_WAY_CNT; i++) { riscv_icache_entry *entry = malloc(sizeof(riscv_icache_entry)); if (entry == NULL) return false; entry->valid = false; if (i == 0) icache->set[set].head = entry; else prev->next = entry; prev = entry; } prev->next = NULL; } return true; } riscv_instr *read_icache(riscv_icache *icache, uint64_t addr) { // since the address is a least 2 bytes, 1 bit is for offset uint64_t index = (addr >> 1) & (CACHE_SET_CNT - 1); uint64_t tag = (addr >> (1 + CACHE_INDEX_BIT)); riscv_icache_entry *entry = icache->set[index].head; riscv_icache_entry *prev = NULL; for (int i = 0; i < CACHE_WAY_CNT; i++) { if (entry->valid == true && entry->tag == tag) { // pending the recently used entry to head if (prev != NULL) { prev->next = entry->next; entry->next = icache->set[index].head; icache->set[index].head = entry; } return &entry->instr; } prev = entry; entry = entry->next; } return NULL; } void write_icache(riscv_icache *icache, uint64_t addr, riscv_instr instr) { /* According to our policy, the last node in linked list should be the least * recently used, so it is the candidate to be replaced. The 'tail' pointer * can help us to access it faster */ uint64_t index = (addr >> 1) & (CACHE_SET_CNT - 1); uint64_t tag = (addr >> (1 + CACHE_INDEX_BIT)); riscv_icache_entry *entry = icache->set[index].head; riscv_icache_entry *prev = NULL; for (int i = 0; i < CACHE_WAY_CNT; i++) { if (entry->valid == true && entry->tag == tag) { if (prev != NULL) goto update_cache; else return; } // avoid update in last iteration if (i == CACHE_WAY_CNT - 1) { prev = entry; entry = entry->next; } } // if tag doesn't match any tag in cache, the candidate wiil be the last // entry entry->valid = true; entry->tag = tag; memcpy(&entry->instr, &instr, sizeof(riscv_instr)); update_cache: // after replacement, pending the entry to head prev->next = entry->next; entry->next = icache->set[index].head; icache->set[index].head = entry; } void invalid_icache(riscv_icache *icache) { for (int set = 0; set < CACHE_SET_CNT; set++) { riscv_icache_entry *entry = icache->set[set].head; for (int i = 0; i < CACHE_WAY_CNT; i++) { entry->valid = false; entry = entry->next; } } } void invalid_icache_by_vaddr(riscv_icache *icache, uint64_t vaddr) { uint64_t vpn = vaddr >> 12; for (int set = 0; set < CACHE_SET_CNT; set++) { riscv_icache_entry *entry = icache->set[set].head; for (int i = 0; i < CACHE_WAY_CNT; i++) { // reconstruct the vaadr by index and tag uint64_t cur_vaddr = (entry->tag << (1 + CACHE_INDEX_BIT)) | (set << 1); if (cur_vaddr >> 12 == vpn) entry->valid = false; entry = entry->next; } } } void free_icache(riscv_icache *icache) { for (int set = 0; set < CACHE_SET_CNT; set++) { riscv_icache_entry *entry = icache->set[set].head; for (int i = 0; i < CACHE_WAY_CNT; i++) { riscv_icache_entry *next = entry->next; free(entry); entry = next; } } } #endif
the_stack_data/162644362.c
/* * tsh - A tiny shell program with job control * * <Put your name and login ID here> */ #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <ctype.h> #include <signal.h> #include <sys/types.h> #include <sys/wait.h> #include <errno.h> /* Misc manifest constants */ #define MAXLINE 1024 /* max line size */ #define MAXARGS 128 /* max args on a command line */ #define MAXJOBS 16 /* max jobs at any point in time */ #define MAXJID 1<<16 /* max job ID */ /* Job states */ #define UNDEF 0 /* undefined */ #define FG 1 /* running in foreground */ #define BG 2 /* running in background */ #define ST 3 /* stopped */ /* * Jobs states: FG (foreground), BG (background), ST (stopped) * Job state transitions and enabling actions: * FG -> ST : ctrl-z * ST -> FG : fg command * ST -> BG : bg command * BG -> FG : fg command * At most 1 job can be in the FG state. */ /* Global variables */ extern char **environ; /* defined in libc */ char prompt[] = "tsh> "; /* command line prompt (DO NOT CHANGE) */ int verbose = 0; /* if true, print additional output */ int nextjid = 1; /* next job ID to allocate */ char sbuf[MAXLINE]; /* for composing sprintf messages */ struct job_t { /* The job struct */ pid_t pid; /* job PID */ int jid; /* job ID [1, 2, ...] */ int state; /* UNDEF, BG, FG, or ST */ char cmdline[MAXLINE]; /* command line */ }; struct job_t jobs[MAXJOBS]; /* The job list */ /* End global variables */ /* Function prototypes */ /* Here are the functions that you will implement */ void eval(char *cmdline); int builtin_cmd(char **argv); void do_bgfg(char **argv); void waitfg(pid_t pid); void sigchld_handler(int sig); void sigtstp_handler(int sig); void sigint_handler(int sig); /* Here are helper routines that we've provided for you */ int parseline(const char *cmdline, char **argv); void sigquit_handler(int sig); void clearjob(struct job_t *job); void initjobs(struct job_t *jobs); int maxjid(struct job_t *jobs); int addjob(struct job_t *jobs, pid_t pid, int state, char *cmdline); int deletejob(struct job_t *jobs, pid_t pid); pid_t fgpid(struct job_t *jobs); struct job_t *getjobpid(struct job_t *jobs, pid_t pid); struct job_t *getjobjid(struct job_t *jobs, int jid); int pid2jid(pid_t pid); void listjobs(struct job_t *jobs); void usage(void); void unix_error(char *msg); void app_error(char *msg); typedef void handler_t(int); handler_t *Signal(int signum, handler_t *handler); /* * main - The shell's main routine */ int main(int argc, char **argv) { char c; char cmdline[MAXLINE]; int emit_prompt = 1; /* emit prompt (default) */ /* Redirect stderr to stdout (so that driver will get all output * on the pipe connected to stdout) */ dup2(1, 2); /* Parse the command line */ while ((c = getopt(argc, argv, "hvp")) != EOF) { switch (c) { case 'h': /* print help message */ usage(); break; case 'v': /* emit additional diagnostic info */ verbose = 1; break; case 'p': /* don't print a prompt */ emit_prompt = 0; /* handy for automatic testing */ break; default: usage(); } } /* Install the signal handlers */ /* These are the ones you will need to implement */ Signal(SIGINT, sigint_handler); /* ctrl-c */ Signal(SIGTSTP, sigtstp_handler); /* ctrl-z */ Signal(SIGCHLD, sigchld_handler); /* Terminated or stopped child */ /* This one provides a clean way to kill the shell */ Signal(SIGQUIT, sigquit_handler); /* Initialize the job list */ initjobs(jobs); /* Execute the shell's read/eval loop */ while (1) { /* Read command line */ if (emit_prompt) { printf("%s", prompt); fflush(stdout); } if ((fgets(cmdline, MAXLINE, stdin) == NULL) && ferror(stdin)) app_error("fgets error"); if (feof(stdin)) { /* End of file (ctrl-d) */ fflush(stdout); exit(0); } /* Evaluate the command line */ eval(cmdline); fflush(stdout); fflush(stdout); } exit(0); /* control never reaches here */ } /* * eval - Evaluate the command line that the user has just typed in * * If the user has requested a built-in command (quit, jobs, bg or fg) * then execute it immediately. Otherwise, fork a child process and * run the job in the context of the child. If the job is running in * the foreground, wait for it to terminate and then return. Note: * each child process must have a unique process group ID so that our * background children don't receive SIGINT (SIGTSTP) from the kernel * when we type ctrl-c (ctrl-z) at the keyboard. */ void eval(char *cmdline) { char *argv[MAXARGS]; char buf[MAXLINE]; int bg; pid_t pid; sigset_t sigmask; // Copy cmdline so we can mutate it in fork. strcpy(buf, cmdline); bg = parseline(buf, argv); if (argv[0] == NULL) { return; } else if (!builtin_cmd(argv)) { // Create mask for job creation to avoid race conditions. if (sigemptyset(&sigmask)) { printf("Error calling sigemptyset\n"); exit(1); } else if (sigaddset(&sigmask, SIGCHLD) || sigaddset(&sigmask, SIGINT) || sigaddset(&sigmask, SIGTSTP)) { printf("Error calling sigaddset\n"); exit(1); } else if (sigprocmask(SIG_BLOCK, &sigmask, NULL)) { printf("Error calling sigprocmask\n"); exit(1); } // Fork and set mask if ((pid = fork()) == 0) { if (sigprocmask(SIG_UNBLOCK, &sigmask, NULL)) { printf("Error calling sigprocmask\n"); exit(1); } else if (setpgid(0, 0)) { printf("Error calling setpgid\n"); exit(1); } else if (execve(argv[0], argv, environ) < 0) { printf("%s: Command not found\n", argv[0]); exit(0); } } // Add job to list int state; state = bg ? BG : FG; if (!addjob(jobs, pid, state, cmdline)) { printf("Error on addjob\n"); exit(1); } else if (sigprocmask(SIG_UNBLOCK, &sigmask, NULL)) { printf("Error on sigprocmask\n"); exit(1); } // Wait if necessary. Otherwise print job. if (!bg) { waitfg(pid); } else { printf("[%i] (%d) %s", pid2jid(pid), pid, cmdline); } } return; } /* * parseline - Parse the command line and build the argv array. * * Characters enclosed in single quotes are treated as a single * argument. Return true if the user has requested a BG job, false if * the user has requested a FG job. */ int parseline(const char *cmdline, char **argv) { static char array[MAXLINE]; /* holds local copy of command line */ char *buf = array; /* ptr that traverses command line */ char *delim; /* points to first space delimiter */ int argc; /* number of args */ int bg; /* background job? */ strcpy(buf, cmdline); buf[strlen(buf)-1] = ' '; /* replace trailing '\n' with space */ while (*buf && (*buf == ' ')) /* ignore leading spaces */ buf++; /* Build the argv list */ argc = 0; if (*buf == '\'') { buf++; delim = strchr(buf, '\''); } else { delim = strchr(buf, ' '); } while (delim) { argv[argc++] = buf; *delim = '\0'; buf = delim + 1; while (*buf && (*buf == ' ')) /* ignore spaces */ buf++; if (*buf == '\'') { buf++; delim = strchr(buf, '\''); } else { delim = strchr(buf, ' '); } } argv[argc] = NULL; if (argc == 0) /* ignore blank line */ return 1; /* should the job run in the background? */ if ((bg = (*argv[argc-1] == '&')) != 0) { argv[--argc] = NULL; } return bg; } /* * builtin_cmd - If the user has typed a built-in command then execute * it immediately. */ int builtin_cmd(char **argv) { int argc = 0; int i = 0; // Count amount of arguments while (argv[i++] != NULL) { ++argc; } // Test global internal commands if (!strcmp(argv[0], "quit")) { exit(0); } else if (!strcmp(argv[0], "jobs")) { listjobs(jobs); return 1; } // This is either a background or foreground job. if (!strcmp(argv[0], "fg") || !strcmp(argv[0], "bg")) { // Test correct input. if (argc == 1) { printf("%s command requires PID or %%jobid argument\n", argv[0]); return 1; } // Test to make sure correct pid is supplied char *pos = argv[1]-1; while (*++pos) { if (*pos == '%') { continue; } else if (!isdigit(*pos)) { printf("%s: argument must be a PID or %%jobid\n", argv[0]); return 1; } } // Run this in background. do_bgfg(argv); return 1; } return 0; } /* * do_bgfg - Execute the builtin bg and fg commands */ void do_bgfg(char **argv) { pid_t pid; struct job_t *job; int length = strlen(argv[1]); char jid[length-1]; // Check to see if this is a jobid if ((argv[1])[0] == '%') { memcpy(jid, &((argv[1])[1]), length-1); jid[length-1] = '\0'; // Return error if jobid doesn't exist if ((job = getjobjid(jobs, atoi(jid))) == NULL) { printf("%s: No such job\n", argv[1]); return; } } else { // Must be a pid or soemthing else. if ((job = getjobpid(jobs, atoi(argv[1]))) == NULL) { printf("(%s): No such process\n", argv[1]); return; } } // Get pid from job pid = job->pid; int state; state = strcmp(argv[0], "fg") == 0 ? FG : BG; job->state = state; // Kill that son of a mark. kill(pid * -1, SIGCONT); // If it's a foreground process than wait normally. if (state == FG) { waitfg(pid); } else { printf("[%i] (%i) %s", job->jid, job->pid, job->cmdline); } return; } /* * waitfg - Block until process pid is no longer the foreground process */ void waitfg(pid_t pid) { // Wait for the foreground to not become foreground. while (fgpid(jobs) == pid) { sleep(1); } return; } /***************** * Signal handlers *****************/ /* * sigchld_handler - The kernel sends a SIGCHLD to the shell whenever * a child job terminates (becomes a zombie), or stops because it * received a SIGSTOP or SIGTSTP signal. The handler reaps all * available zombie children, but doesn't wait for any other * currently running children to terminate. */ void sigchld_handler(int sig) { pid_t pid; int status; // Terminate the appropriate child. while ((pid = waitpid(-1, &status, WNOHANG | WUNTRACED)) > 0) { if (WIFSIGNALED(status)) { printf("Job [%d] (%d) terminated by signal %d\n", pid2jid(pid), pid, WTERMSIG(status)); deletejob(jobs, pid); } else if (WIFSTOPPED(status)) { printf("Job [%d] (%d) stopped by signal %d\n", pid2jid(pid), pid, WSTOPSIG(status)); getjobpid(jobs, pid)->state = ST; } else { deletejob(jobs, pid); } } return; } /* * sigint_handler - The kernel sends a SIGINT to the shell whenver the * user types ctrl-c at the keyboard. Catch it and send it along * to the foreground job. */ void sigint_handler(int sig) { pid_t pid; // Send signal to foreground if it exists. if (pid = fgpid(jobs)) { kill(pid * -1, sig); } return; } /* * sigtstp_handler - The kernel sends a SIGTSTP to the shell whenever * the user types ctrl-z at the keyboard. Catch it and suspend the * foreground job by sending it a SIGTSTP. */ void sigtstp_handler(int sig) { pid_t pid; // Send signal to foreground if it exists. if (pid = fgpid(jobs)) { kill(pid * -1, sig); } return; } /********************* * End signal handlers *********************/ /*********************************************** * Helper routines that manipulate the job list **********************************************/ /* clearjob - Clear the entries in a job struct */ void clearjob(struct job_t *job) { job->pid = 0; job->jid = 0; job->state = UNDEF; job->cmdline[0] = '\0'; } /* initjobs - Initialize the job list */ void initjobs(struct job_t *jobs) { int i; for (i = 0; i < MAXJOBS; i++) clearjob(&jobs[i]); } /* maxjid - Returns largest allocated job ID */ int maxjid(struct job_t *jobs) { int i, max=0; for (i = 0; i < MAXJOBS; i++) if (jobs[i].jid > max) max = jobs[i].jid; return max; } /* addjob - Add a job to the job list */ int addjob(struct job_t *jobs, pid_t pid, int state, char *cmdline) { int i; if (pid < 1) return 0; for (i = 0; i < MAXJOBS; i++) { if (jobs[i].pid == 0) { jobs[i].pid = pid; jobs[i].state = state; jobs[i].jid = nextjid++; if (nextjid > MAXJOBS) nextjid = 1; strcpy(jobs[i].cmdline, cmdline); if(verbose){ printf("Added job [%d] %d %s\n", jobs[i].jid, jobs[i].pid, jobs[i].cmdline); } return 1; } } printf("Tried to create too many jobs\n"); return 0; } /* deletejob - Delete a job whose PID=pid from the job list */ int deletejob(struct job_t *jobs, pid_t pid) { int i; if (pid < 1) return 0; for (i = 0; i < MAXJOBS; i++) { if (jobs[i].pid == pid) { clearjob(&jobs[i]); nextjid = maxjid(jobs)+1; return 1; } } return 0; } /* fgpid - Return PID of current foreground job, 0 if no such job */ pid_t fgpid(struct job_t *jobs) { int i; for (i = 0; i < MAXJOBS; i++) if (jobs[i].state == FG) return jobs[i].pid; return 0; } /* getjobpid - Find a job (by PID) on the job list */ struct job_t *getjobpid(struct job_t *jobs, pid_t pid) { int i; if (pid < 1) return NULL; for (i = 0; i < MAXJOBS; i++) if (jobs[i].pid == pid) return &jobs[i]; return NULL; } /* getjobjid - Find a job (by JID) on the job list */ struct job_t *getjobjid(struct job_t *jobs, int jid) { int i; if (jid < 1) return NULL; for (i = 0; i < MAXJOBS; i++) if (jobs[i].jid == jid) return &jobs[i]; return NULL; } /* pid2jid - Map process ID to job ID */ int pid2jid(pid_t pid) { int i; if (pid < 1) return 0; for (i = 0; i < MAXJOBS; i++) if (jobs[i].pid == pid) { return jobs[i].jid; } return 0; } /* listjobs - Print the job list */ void listjobs(struct job_t *jobs) { int i; for (i = 0; i < MAXJOBS; i++) { if (jobs[i].pid != 0) { printf("[%d] (%d) ", jobs[i].jid, jobs[i].pid); switch (jobs[i].state) { case BG: printf("Running "); break; case FG: printf("Foreground "); break; case ST: printf("Stopped "); break; default: printf("listjobs: Internal error: job[%d].state=%d ", i, jobs[i].state); } printf("%s", jobs[i].cmdline); } } } /****************************** * end job list helper routines ******************************/ /*********************** * Other helper routines ***********************/ /* * usage - print a help message */ void usage(void) { printf("Usage: shell [-hvp]\n"); printf(" -h print this message\n"); printf(" -v print additional diagnostic information\n"); printf(" -p do not emit a command prompt\n"); exit(1); } /* * unix_error - unix-style error routine */ void unix_error(char *msg) { fprintf(stdout, "%s: %s\n", msg, strerror(errno)); exit(1); } /* * app_error - application-style error routine */ void app_error(char *msg) { fprintf(stdout, "%s\n", msg); exit(1); } /* * Signal - wrapper for the sigaction function */ handler_t *Signal(int signum, handler_t *handler) { struct sigaction action, old_action; action.sa_handler = handler; sigemptyset(&action.sa_mask); /* block sigs of type being handled */ action.sa_flags = SA_RESTART; /* restart syscalls if possible */ if (sigaction(signum, &action, &old_action) < 0) unix_error("Signal error"); return (old_action.sa_handler); } /* * sigquit_handler - The driver program can gracefully terminate the * child shell by sending it a SIGQUIT signal. */ void sigquit_handler(int sig) { printf("Terminating after receipt of SIGQUIT signal\n"); exit(1); }
the_stack_data/122362.c
/* This example is taken from the TRACER benchmarks * https://doi.org/10.1145/3276505 */ // Adapted for the tool PSChecker #include <pthread.h> #define N 10 int x; void *thread1(void *arg) { int i; for (i=0; i<N; i++) rlx_write_ps(x,1); return NULL; } void *thread2(void *arg) { int i; for (i=0; i<N; i++) rlx_write_ps(x,2); return NULL; } void *thread3(void *arg) { int _x; rlx_read_ps(x, _x); assert(_x != 3); return NULL; } int main(int argc, char **argv) { pthread_t t1, t2, t3; x = 0; pthread_create(&t1, NULL, thread1, NULL); pthread_create(&t2, NULL, thread2, NULL); pthread_create(&t3, NULL, thread3, NULL); return 0; }
the_stack_data/165766972.c
/* ************************************************************************** */ /* */ /* :::::::: */ /* ft_isprint.c :+: :+: */ /* +:+ */ /* By: mvan-eng <[email protected]> +#+ */ /* +#+ */ /* Created: 2019/01/14 19:29:21 by mvan-eng #+# #+# */ /* Updated: 2019/01/30 20:09:01 by mvan-eng ######## odam.nl */ /* */ /* ************************************************************************** */ int ft_isprint(int c) { if (c > 31 && c < 127) return (1); else return (0); }
the_stack_data/231392634.c
// // main.c // lab4_2 // // Created by Кирилл Горбачёнок on 17.03.2018. // Copyright © 2018 Кирилл Горбачёнок. All rights reserved. // #include <stdio.h> /* В текстовом файле находится произвольный текст. Разработать программу проверки правильности расстановки скобок (круглых, квадратных, фигурных). Критерий проверки: если встречается одна из закрывающих скобок, то последняя открывающая должна быть такого же типа; количество скобок каждого типа должно совпадать. Между скобками допустима запись любых символов. */ int main(int argc, const char * argv[]) { FILE *fp; char name[] = "textFor4lab.txt"; if (fopen(name, "r") != NULL) { fp = fopen(name, "r"); printf("congrats друг\n\n"); char string[256] = ""; while (!feof(fp)) { fgets(string, 256, fp); printf("%s", string); } printf(" "); char check[50] = ""; int forC = 0; int forK = 0; int forF = 0; for (int i = 0, j = 0; string[i] != '\0'; i++) { if (string[i] == '[' || string[i] == '(' || string[i] == '{' || string[i] == ']' || string[i] == ')' || string[i] == '}') { check[j] = string[i]; j++; } } for (int i = 0; check[i] != '\0'; i++) { if (check[i] == '[' || check[i] == ']') { forK++; } if (check[i] == '(' || check[i] == ')') { forC++; } if (check[i] == '{' || check[i] == '}') { forF++; } } int cnt = 0; for (int i = 0; check[i] != '\0'; i++) { if (check[i] == '[') { int j = i; while(check[j] != '\0') { if (check[j] == ']') { break; } if (check[j] == '}' || check[j] == ')') { cnt++; printf("\nBRAKES ARE NOT PUT RIGHT\n"); break; } j++; } } else if (check[i] == '(') { int j = i; while(check[j] != '\0') { if (check[j] == ')') { break; } if (check[j] == '}' || check[j] == ']') { cnt++; printf("\nBRAKES ARE PUT NOT RIGHT\n"); break; } j++; } } else if (check[i] == '{') { int j = i; while(check[j] != '\0') { if (check[j] == '}') { break; } if (check[j] == ']' || check[j] == ')') { cnt++; printf("\nBRAKES ARE PUT NOT RIGHT\n"); break; } j++; } } } if (!cnt) { if (forF != forK && forF != forC) { printf("\nBRAKES ARE PUT NOT RIGHT\n"); } else { printf("\nBRAKES ARE PUT RIGHT\n"); } } } else { printf("how could u друг?\n"); } int ifClose = fclose(fp); if (!ifClose) { printf("\nfile r closed\n"); } else { printf("file r not closed\n"); } return 0; }
the_stack_data/543108.c
#include <stdio.h> #include <stdlib.h> #include <string.h> int checkWord(char* word); char* maxSubString(char* word); int main() { int nString, i, tam = 0; char** pWord; char *numStrings, *actWord, *finalWord; numStrings = (char*)malloc(5 * sizeof (char)); scanf("%s", numStrings); while (checkWord(numStrings) == 1) scanf("%s", numStrings); nString = atoi(numStrings); free(numStrings); pWord = (char**)malloc(nString * sizeof (char*)); finalWord = (char*)malloc(51 * sizeof (char)); actWord = (char*)malloc(51 * sizeof (char)); for (i = 0;i < nString;i++) pWord[i] = (char*)malloc(51 * sizeof (char)); for (i = 0;i < nString;i++){ scanf("%s", actWord); if (checkWord(actWord) == 0) { strcpy(pWord[i], actWord); }else{ i--; } } for (i = 0;i < nString;i++){ strcpy(actWord, pWord[i]); actWord = maxSubString(actWord); if (tam < strlen(actWord)) { strcpy(finalWord, actWord); tam = strlen(finalWord); } } printf("%s\n", finalWord); for (i = 0;i < nString;i++) free(pWord[i]); free(actWord); free(pWord); free(finalWord); return 0; } char* maxSubString(char* word) { int i, j; int tam = 0, idxI = 0, tamAux = 0, idxAux = 0; if (strlen(word) > 1) { for (i = 1;i < strlen(word);i++){ tamAux++; for (j = idxAux;j < i;j++){ if (word[i] == word[j]) { if (tam < tamAux) { tam = tamAux; idxI = idxAux; } tamAux = 1; idxAux = j + 1; i = j + 2; j = i; }else if ((i + 1) == strlen(word) && (j + 1) == i) { tamAux++; if (tam < tamAux) { tam = tamAux; idxI = idxAux; } } } } for (i = 0;i < tam;i++) word[i] = word[i + idxI]; word[tam] = 0; } return word; } int checkWord(char* word) { int i, z = 0; for (i = 0;i < strlen(word) && z == 0;i++){ if (word[i] < '0' || word[i] > '9') { z = 1; } } return z; }
the_stack_data/13351.c
/* { dg-do compile } */ /* { dg-additional-options "-fpic -std=c99" } */ typedef unsigned int size_t; typedef struct { unsigned long __val[(1024 / (8 * sizeof (unsigned long)))]; } __sigset_t; struct __jmp_buf_tag { __sigset_t __saved_mask; }; typedef struct __jmp_buf_tag sigjmp_buf[1]; struct stat { long long st_dev; unsigned short int __pad1; int tm_isdst; long int tm_gmtoff; char *tm_zone; }; typedef size_t STRLEN; typedef struct op OP; typedef struct cop COP; typedef struct interpreter PerlInterpreter; typedef struct sv SV; typedef struct av AV; typedef struct cv CV; typedef struct gp GP; typedef struct gv GV; typedef struct xpv XPV; typedef struct xpvio XPVIO; typedef union any ANY; typedef unsigned char U8; typedef long I32; typedef unsigned long U32; typedef U32 line_t; typedef struct _PerlIO PerlIOl; typedef PerlIOl *PerlIO; struct sv { void *sv_any; U32 sv_flags; union { char *svu_pv; } sv_u; }; struct gv { U32 sv_flags; union { GP *svu_gp; } sv_u; }; struct io { XPVIO *sv_any; }; struct xpv { STRLEN xpv_cur; }; struct xpvio { PerlIO *xio_ofp; }; struct gp { SV *gp_sv; struct io *gp_io; }; struct jmpenv { struct jmpenv *je_prev; sigjmp_buf je_buf; int je_ret; }; typedef struct jmpenv JMPENV; struct cop { line_t cop_line; struct refcounted_he *cop_hints_hash; }; struct interpreter { SV **Istack_sp; OP *Iop; SV **Icurpad; SV **Istack_base; SV **Istack_max; I32 *Iscopestack; I32 Iscopestack_ix; I32 Iscopestack_max; ANY *Isavestack; I32 Isavestack_ix; I32 Isavestack_max; SV **Itmps_stack; I32 Itmps_ix; I32 Itmps_floor; I32 Itmps_max; I32 Imodcount; I32 *Imarkstack; I32 *Imarkstack_ptr; I32 *Imarkstack_max; SV *ISv; XPV *IXpv; STRLEN Ina; struct stat Istatbuf; struct stat Istatcache; OP *Irestartop; COP *volatile Icurcop; JMPENV *Itop_env; U8 Iexit_flags; I32 Istatusvalue; I32 Istatusvalue_posix; GV *Istderrgv; GV *Ierrgv; AV *Ibeginav; AV *Iunitcheckav; COP Icompiling; char Isavebegin; volatile U32 Idebug; AV *Ibeginav_save; AV *Icheckav_save; AV *Iunitcheckav_save; }; void S_my_exit_jump (PerlInterpreter *my_perl __attribute__((unused))) __attribute__((noreturn)); int Perl_av_len (PerlInterpreter*, AV*); void Perl_av_create_and_push (PerlInterpreter*, AV**, SV*); int __sigsetjmp (sigjmp_buf env, int savemask); void Perl_sv_2pv_flags (PerlInterpreter*, SV*, STRLEN*, int); void Perl_deb (PerlInterpreter*, const char*, const char*, int, const char*, int); void Perl_croak (PerlInterpreter*, const char*, void*); void foo (void); void Perl_call_list (PerlInterpreter *my_perl __attribute__((unused)), I32 oldscope, AV *paramList) { SV *atsv; CV *cv; STRLEN len; int ret; JMPENV cur_env; GV *shplep; volatile line_t oldline; oldline = (my_perl->Icurcop) ? my_perl->Icurcop->cop_line : 0; while (Perl_av_len (my_perl, paramList) >= 0) { if (my_perl->Isavebegin) { if (paramList == my_perl->Ibeginav) { Perl_av_create_and_push (my_perl, &my_perl->Ibeginav_save, (SV*) cv); Perl_av_create_and_push(my_perl, &my_perl->Icheckav_save, (SV*) cv); } else if (paramList == my_perl->Iunitcheckav) Perl_av_create_and_push(my_perl, &my_perl->Iunitcheckav_save, (SV*) cv); } cur_env.je_ret = __sigsetjmp (cur_env.je_buf, 0); switch (ret) { case 0: shplep = (GV *) my_perl->Ierrgv; *my_perl->Imarkstack_ptr = my_perl->Istack_sp - my_perl->Istack_base; atsv = shplep->sv_u.svu_gp->gp_sv; if (atsv->sv_flags & 0x00000400 == 0x00000400) len = ((XPV*) ((SV *) atsv)->sv_any)->xpv_cur; else Perl_sv_2pv_flags (my_perl, atsv, &len, 2|32); if (len) { my_perl->Icurcop = &my_perl->Icompiling; while (my_perl->Iscopestack_ix > oldscope) { if (my_perl->Idebug & 0x00000004) Perl_deb (my_perl, "scope", "LEAVE", my_perl->Iscopestack_ix, "perl.c", 5166); (my_perl->Itop_env) = cur_env.je_prev; } Perl_croak (my_perl, "%""-p""", (void*) atsv); } case 1: my_perl->Istatusvalue = 1; my_perl->Istatusvalue_posix = 1; case 2: while (my_perl->Iscopestack_ix > oldscope) if (my_perl->Idebug & 0x00000004) foo (); my_perl->Icurcop = &my_perl->Icompiling; my_perl->Icurcop->cop_line = oldline; if (my_perl->Idebug & 0x00000004) foo (); S_my_exit_jump (my_perl); case 3: if (my_perl->Irestartop) foo (); } } }
the_stack_data/34417.c
/* Semmle test case for StrncpyFlippedArgs.ql Associated with CWE-131 http://cwe.mitre.org/data/definitions/131.html Each query is expected to find exactly the lines marked BAD in the section corresponding to it. */ ///// Library functions ////// extern char *strncpy(char *dest, const char *src, unsigned int sz); extern unsigned int strlen(const char *s); //// Test code ///// void good0(char *arg) { char buf[80]; // GOOD: Checks size of destination strncpy(buf, arg, sizeof(buf)); } void bad0(char *arg) { char buf[80]; // BAD: Checks size of source strncpy(buf, arg, strlen(arg)); } void good1(const char *buf, char *arg) { // GOOD: Checks size of destination strncpy(buf, arg, sizeof(buf)); } void bad1(const char *buf, char *arg) { // BAD: Checks size of source strncpy(buf, arg, strlen(arg)); }
the_stack_data/774854.c
/* ex04_08.c What does this program print? */ #include <stdio.h> /* function main begins program execution */ int main( void ) { int x; int y; int i; int j; /* prompt user for input */ printf( "Enter two integers in the range 1-20: " ); scanf( "%d%d", &x, &y ); /* read values for x and y */ for ( i = 1; i <= y; i++ ) { /* count from 1 to y */ for ( j = 1; j <= x; j++ ) { /* count from 1 to x */ printf( "@" ); /* output @ */ } /* end inner for */ printf( "\n" ); /* begin new line */ } /* end outer for */ return 0; /* indicate program ended successfully */ } /* end function main */ /************************************************************************** * (C) Copyright 1992-2010 by Deitel & Associates, Inc. and * * Pearson Education, Inc. All Rights Reserved. * * * * DISCLAIMER: The authors and publisher of this book have used their * * best efforts in preparing the book. These efforts include the * * development, research, and testing of the theories and programs * * to determine their effectiveness. The authors and publisher make * * no warranty of any kind, expressed or implied, with regard to these * * programs or to the documentation contained in these books. The authors * * and publisher shall not be liable in any event for incidental or * * consequential damages in connection with, or arising out of, the * * furnishing, performance, or use of these programs. * *************************************************************************/
the_stack_data/68886951.c
#include <stdio.h> #include <math.h> int main() { int n,m,i,j; double d; while (scanf("%d",&n)!=EOF) { d=(sqrt(8.0*n+1)-1)/2.0; m=(int)d; if (d!=(double)m) m++; j=n-m*(m-1)/2; if (m%2==0) { i=j; j=m+1-i; } else i=m+1-j; printf("TERM %d IS %d/%d\n",n,i,j); } return 0; }
the_stack_data/921287.c
#include <stdio.h> /* 파일 복사 프로그램 */ int main(int argc, char *argv[]) { char c; FILE *fp1, *fp2; if (argc !=3) { fprintf(stderr, "사용법: %s 파일1 파일2\n", argv[0]); return 1; } fp1 = fopen(argv[1], "r"); if (fp1 == NULL) { fprintf(stderr, "파일 %s 열기 오류\n", argv[1]); return 2; } fp2 = fopen(argv[2], "w"); while ((c = fgetc(fp1)) != EOF) fputc(c, fp2); fclose(fp1); fclose(fp2); return 0; }
the_stack_data/87639072.c
#include<stdio.h> #include<stdlib.h> struct HTable{ int *table; int size; int *used_space; char hash_type; // hash table type a for quadratic // b for double hashing // c1 , c2 for quadratic probing int c1; int c2; // R for double hashing int R; }; int is_prime(int n){ if(n==1 || n==0) return 0; if(n<=3) return 1; if(n%2==0) return 0; if(n%3==0) return 0; for(int i=5;i*i<=n;i+=6){ if((n%i==0) || (n%(i+2)==0)){ return 0; } } return 1; } int find_near_prime(int m){ for(int i=m-1;i>=2;i--){ if(is_prime(i)==1){ return i; } } return 1; } struct HTable HashTable(int m){ struct HTable H_table_q; // initialising quadratic prob table // seting up the table , allocating space H_table_q.size=m; H_table_q.table=(int *)malloc(m*sizeof(int)); H_table_q.used_space=(int *)malloc(m*sizeof(int)); for(int i=0;i<m;i++){ H_table_q.table[i]=-1; H_table_q.used_space[i]=-1; } H_table_q.R=find_near_prime(m); return H_table_q; } void INSERT(struct HTable *HT,int k){ if(HT->hash_type=='a'){ int hash_value = k % (HT->size); int hash_q_val; for(int i=0;i<HT->size;i++){ hash_q_val = (hash_value + (HT->c1)*i + (HT->c2)*i*i)%(HT->size); if( HT->used_space[hash_q_val]==-1 ){ HT->table[hash_q_val]=k; HT->used_space[hash_q_val]=1; return; } } } else if(HT->hash_type=='b'){ int hash_value1 = k % (HT->size); int hash_value2 = HT->R - ( HT->size % HT->R); int hash_q_val; for(int i=0;i<HT->size;i++){ hash_q_val = (hash_value1 + i*hash_value2)%(HT->size); if( HT->used_space[hash_q_val]==-1 ){ HT->table[hash_q_val]=k; HT->used_space[hash_q_val]=1; return; } } } } int SEARCH(struct HTable *HT,int k){ if(HT->hash_type=='a'){ int hash_value = k % (HT->size); int hash_q_val; for(int i=0;i<HT->size;i++){ hash_q_val = (hash_value + (HT->c1)*i + (HT->c2)*i*i)%(HT->size); if( HT->table[hash_q_val]==k ){ return 1; } } } else if(HT->hash_type=='b'){ int hash_value1 = k % (HT->size); int hash_value2 = HT->R - ( HT->size % HT->R); int hash_q_val; for(int i=0;i<HT->size;i++){ hash_q_val = (hash_value1 + i*hash_value2)%(HT->size); if( HT->table[hash_q_val]==k ){ return 1; } } } return -1; } void DELETE(struct HTable *HT,int k){ if(HT->hash_type=='a'){ int hash_value = k % (HT->size); int hash_q_val; for(int i=0;i<HT->size;i++){ hash_q_val = (hash_value + (HT->c1)*i + (HT->c2)*i*i)%(HT->size); if( HT->table[hash_q_val]==k ){ HT->table[hash_q_val]=-1; HT->used_space[hash_q_val]=-1; return; } } } else if(HT->hash_type=='b'){ int hash_value1 = k % (HT->size); int hash_value2 = HT->R - ( HT->size % HT->R); int hash_q_val; for(int i=0;i<HT->size;i++){ hash_q_val = (hash_value1 + i*hash_value2)%(HT->size); if( HT->table[hash_q_val]==k ){ HT->table[hash_q_val]=-1; HT->used_space[hash_q_val]=-1; return; } } } } void PRINT(struct HTable *HT ){ for(int i=0;i<HT->size;i++){ if(HT->table[i]!=-1){ printf("%d (%d)\n",i,HT->table[i]); } else{ printf("%d ()\n",i); } } } int main(){ struct HTable HT; char hash_type,ch; int m; int c1,c2; scanf("%c",&hash_type); // read size of hash table scanf("%d",&m); // create a hashtable HT=HashTable(m); HT.hash_type=hash_type; if(hash_type=='a'){ scanf("%d",&c1); scanf("%d",&c2); //setting coef for quad prob HT.c1=c1; HT.c2=c2; } // variables for table values int val; int search_result; do{ scanf("%c",&ch); switch(ch){ case 'i': scanf("%d",&val); INSERT(&HT,val); break; case 's': scanf("%d",&val); search_result=SEARCH(&HT,val); printf("%d\n",search_result); break; case 'd': scanf("%d",&val); DELETE(&HT,val); break; case 'p': PRINT(&HT); break; } }while(ch!='t'); return 0; }
the_stack_data/159514734.c
#include <stdio.h> #include <stdlib.h> int main() { int integer_1, integer_2; printf("Enter two integer numbers separated by enter: "); scanf("%d%d", &integer_1, &integer_2); if (integer_1 > integer_2) { printf("%d is greater than %d", integer_1, integer_2); } else { printf("%d is greater than %d", integer_2, integer_1); } return 0; }
the_stack_data/132238.c
/* * Program from Fig.1 of * 2010SAS - Harris, Lal, Nori, Rajamani - AlternationforTermination * * Date: 12.12.2013 * Author: [email protected] * */ extern int __VERIFIER_nondet_int(void); void f(int d) { int x = __VERIFIER_nondet_int(); int y = __VERIFIER_nondet_int(); int k = __VERIFIER_nondet_int(); int z = 1; if (k > 1073741823) { return; } // ... L1: while (z < k) { z = 2 * z; } L2: while (x > 0 && y > 0) { // ... if (__VERIFIER_nondet_int()) { P1: x = x - d; y = __VERIFIER_nondet_int(); z = z - 1; } else { y = y - d; } } } int main() { if (__VERIFIER_nondet_int()) { f(1); } else { f(2); } }
the_stack_data/74905.c
//@ ltl invariant negative: (AP(x_8 - x_20 >= -6) || (AP(x_5 - x_23 > -10) && AP(x_22 - x_17 >= -18))); float x_0; float x_1; float x_2; float x_3; float x_4; float x_5; float x_6; float x_7; float x_8; float x_9; float x_10; float x_11; float x_12; float x_13; float x_14; float x_15; float x_16; float x_17; float x_18; float x_19; float x_20; float x_21; float x_22; float x_23; float x_24; float x_25; float x_26; float x_27; float x_28; float x_29; float x_30; float x_31; int main() { float x_0_; float x_1_; float x_2_; float x_3_; float x_4_; float x_5_; float x_6_; float x_7_; float x_8_; float x_9_; float x_10_; float x_11_; float x_12_; float x_13_; float x_14_; float x_15_; float x_16_; float x_17_; float x_18_; float x_19_; float x_20_; float x_21_; float x_22_; float x_23_; float x_24_; float x_25_; float x_26_; float x_27_; float x_28_; float x_29_; float x_30_; float x_31_; while(1) { x_0_ = (((((18.0 + x_0) > (12.0 + x_2)? (18.0 + x_0) : (12.0 + x_2)) > ((20.0 + x_4) > (3.0 + x_5)? (20.0 + x_4) : (3.0 + x_5))? ((18.0 + x_0) > (12.0 + x_2)? (18.0 + x_0) : (12.0 + x_2)) : ((20.0 + x_4) > (3.0 + x_5)? (20.0 + x_4) : (3.0 + x_5))) > (((1.0 + x_8) > (1.0 + x_9)? (1.0 + x_8) : (1.0 + x_9)) > ((3.0 + x_12) > (4.0 + x_14)? (3.0 + x_12) : (4.0 + x_14))? ((1.0 + x_8) > (1.0 + x_9)? (1.0 + x_8) : (1.0 + x_9)) : ((3.0 + x_12) > (4.0 + x_14)? (3.0 + x_12) : (4.0 + x_14)))? (((18.0 + x_0) > (12.0 + x_2)? (18.0 + x_0) : (12.0 + x_2)) > ((20.0 + x_4) > (3.0 + x_5)? (20.0 + x_4) : (3.0 + x_5))? ((18.0 + x_0) > (12.0 + x_2)? (18.0 + x_0) : (12.0 + x_2)) : ((20.0 + x_4) > (3.0 + x_5)? (20.0 + x_4) : (3.0 + x_5))) : (((1.0 + x_8) > (1.0 + x_9)? (1.0 + x_8) : (1.0 + x_9)) > ((3.0 + x_12) > (4.0 + x_14)? (3.0 + x_12) : (4.0 + x_14))? ((1.0 + x_8) > (1.0 + x_9)? (1.0 + x_8) : (1.0 + x_9)) : ((3.0 + x_12) > (4.0 + x_14)? (3.0 + x_12) : (4.0 + x_14)))) > ((((1.0 + x_16) > (3.0 + x_18)? (1.0 + x_16) : (3.0 + x_18)) > ((2.0 + x_19) > (6.0 + x_25)? (2.0 + x_19) : (6.0 + x_25))? ((1.0 + x_16) > (3.0 + x_18)? (1.0 + x_16) : (3.0 + x_18)) : ((2.0 + x_19) > (6.0 + x_25)? (2.0 + x_19) : (6.0 + x_25))) > (((17.0 + x_27) > (10.0 + x_28)? (17.0 + x_27) : (10.0 + x_28)) > ((14.0 + x_29) > (19.0 + x_31)? (14.0 + x_29) : (19.0 + x_31))? ((17.0 + x_27) > (10.0 + x_28)? (17.0 + x_27) : (10.0 + x_28)) : ((14.0 + x_29) > (19.0 + x_31)? (14.0 + x_29) : (19.0 + x_31)))? (((1.0 + x_16) > (3.0 + x_18)? (1.0 + x_16) : (3.0 + x_18)) > ((2.0 + x_19) > (6.0 + x_25)? (2.0 + x_19) : (6.0 + x_25))? ((1.0 + x_16) > (3.0 + x_18)? (1.0 + x_16) : (3.0 + x_18)) : ((2.0 + x_19) > (6.0 + x_25)? (2.0 + x_19) : (6.0 + x_25))) : (((17.0 + x_27) > (10.0 + x_28)? (17.0 + x_27) : (10.0 + x_28)) > ((14.0 + x_29) > (19.0 + x_31)? (14.0 + x_29) : (19.0 + x_31))? ((17.0 + x_27) > (10.0 + x_28)? (17.0 + x_27) : (10.0 + x_28)) : ((14.0 + x_29) > (19.0 + x_31)? (14.0 + x_29) : (19.0 + x_31))))? ((((18.0 + x_0) > (12.0 + x_2)? (18.0 + x_0) : (12.0 + x_2)) > ((20.0 + x_4) > (3.0 + x_5)? (20.0 + x_4) : (3.0 + x_5))? ((18.0 + x_0) > (12.0 + x_2)? (18.0 + x_0) : (12.0 + x_2)) : ((20.0 + x_4) > (3.0 + x_5)? (20.0 + x_4) : (3.0 + x_5))) > (((1.0 + x_8) > (1.0 + x_9)? (1.0 + x_8) : (1.0 + x_9)) > ((3.0 + x_12) > (4.0 + x_14)? (3.0 + x_12) : (4.0 + x_14))? ((1.0 + x_8) > (1.0 + x_9)? (1.0 + x_8) : (1.0 + x_9)) : ((3.0 + x_12) > (4.0 + x_14)? (3.0 + x_12) : (4.0 + x_14)))? (((18.0 + x_0) > (12.0 + x_2)? (18.0 + x_0) : (12.0 + x_2)) > ((20.0 + x_4) > (3.0 + x_5)? (20.0 + x_4) : (3.0 + x_5))? ((18.0 + x_0) > (12.0 + x_2)? (18.0 + x_0) : (12.0 + x_2)) : ((20.0 + x_4) > (3.0 + x_5)? (20.0 + x_4) : (3.0 + x_5))) : (((1.0 + x_8) > (1.0 + x_9)? (1.0 + x_8) : (1.0 + x_9)) > ((3.0 + x_12) > (4.0 + x_14)? (3.0 + x_12) : (4.0 + x_14))? ((1.0 + x_8) > (1.0 + x_9)? (1.0 + x_8) : (1.0 + x_9)) : ((3.0 + x_12) > (4.0 + x_14)? (3.0 + x_12) : (4.0 + x_14)))) : ((((1.0 + x_16) > (3.0 + x_18)? (1.0 + x_16) : (3.0 + x_18)) > ((2.0 + x_19) > (6.0 + x_25)? (2.0 + x_19) : (6.0 + x_25))? ((1.0 + x_16) > (3.0 + x_18)? (1.0 + x_16) : (3.0 + x_18)) : ((2.0 + x_19) > (6.0 + x_25)? (2.0 + x_19) : (6.0 + x_25))) > (((17.0 + x_27) > (10.0 + x_28)? (17.0 + x_27) : (10.0 + x_28)) > ((14.0 + x_29) > (19.0 + x_31)? (14.0 + x_29) : (19.0 + x_31))? ((17.0 + x_27) > (10.0 + x_28)? (17.0 + x_27) : (10.0 + x_28)) : ((14.0 + x_29) > (19.0 + x_31)? (14.0 + x_29) : (19.0 + x_31)))? (((1.0 + x_16) > (3.0 + x_18)? (1.0 + x_16) : (3.0 + x_18)) > ((2.0 + x_19) > (6.0 + x_25)? (2.0 + x_19) : (6.0 + x_25))? ((1.0 + x_16) > (3.0 + x_18)? (1.0 + x_16) : (3.0 + x_18)) : ((2.0 + x_19) > (6.0 + x_25)? (2.0 + x_19) : (6.0 + x_25))) : (((17.0 + x_27) > (10.0 + x_28)? (17.0 + x_27) : (10.0 + x_28)) > ((14.0 + x_29) > (19.0 + x_31)? (14.0 + x_29) : (19.0 + x_31))? ((17.0 + x_27) > (10.0 + x_28)? (17.0 + x_27) : (10.0 + x_28)) : ((14.0 + x_29) > (19.0 + x_31)? (14.0 + x_29) : (19.0 + x_31))))); x_1_ = (((((8.0 + x_0) > (8.0 + x_2)? (8.0 + x_0) : (8.0 + x_2)) > ((10.0 + x_3) > (5.0 + x_5)? (10.0 + x_3) : (5.0 + x_5))? ((8.0 + x_0) > (8.0 + x_2)? (8.0 + x_0) : (8.0 + x_2)) : ((10.0 + x_3) > (5.0 + x_5)? (10.0 + x_3) : (5.0 + x_5))) > (((13.0 + x_8) > (19.0 + x_10)? (13.0 + x_8) : (19.0 + x_10)) > ((9.0 + x_12) > (8.0 + x_16)? (9.0 + x_12) : (8.0 + x_16))? ((13.0 + x_8) > (19.0 + x_10)? (13.0 + x_8) : (19.0 + x_10)) : ((9.0 + x_12) > (8.0 + x_16)? (9.0 + x_12) : (8.0 + x_16)))? (((8.0 + x_0) > (8.0 + x_2)? (8.0 + x_0) : (8.0 + x_2)) > ((10.0 + x_3) > (5.0 + x_5)? (10.0 + x_3) : (5.0 + x_5))? ((8.0 + x_0) > (8.0 + x_2)? (8.0 + x_0) : (8.0 + x_2)) : ((10.0 + x_3) > (5.0 + x_5)? (10.0 + x_3) : (5.0 + x_5))) : (((13.0 + x_8) > (19.0 + x_10)? (13.0 + x_8) : (19.0 + x_10)) > ((9.0 + x_12) > (8.0 + x_16)? (9.0 + x_12) : (8.0 + x_16))? ((13.0 + x_8) > (19.0 + x_10)? (13.0 + x_8) : (19.0 + x_10)) : ((9.0 + x_12) > (8.0 + x_16)? (9.0 + x_12) : (8.0 + x_16)))) > ((((11.0 + x_18) > (14.0 + x_19)? (11.0 + x_18) : (14.0 + x_19)) > ((16.0 + x_20) > (13.0 + x_21)? (16.0 + x_20) : (13.0 + x_21))? ((11.0 + x_18) > (14.0 + x_19)? (11.0 + x_18) : (14.0 + x_19)) : ((16.0 + x_20) > (13.0 + x_21)? (16.0 + x_20) : (13.0 + x_21))) > (((3.0 + x_25) > (14.0 + x_27)? (3.0 + x_25) : (14.0 + x_27)) > ((15.0 + x_30) > (1.0 + x_31)? (15.0 + x_30) : (1.0 + x_31))? ((3.0 + x_25) > (14.0 + x_27)? (3.0 + x_25) : (14.0 + x_27)) : ((15.0 + x_30) > (1.0 + x_31)? (15.0 + x_30) : (1.0 + x_31)))? (((11.0 + x_18) > (14.0 + x_19)? (11.0 + x_18) : (14.0 + x_19)) > ((16.0 + x_20) > (13.0 + x_21)? (16.0 + x_20) : (13.0 + x_21))? ((11.0 + x_18) > (14.0 + x_19)? (11.0 + x_18) : (14.0 + x_19)) : ((16.0 + x_20) > (13.0 + x_21)? (16.0 + x_20) : (13.0 + x_21))) : (((3.0 + x_25) > (14.0 + x_27)? (3.0 + x_25) : (14.0 + x_27)) > ((15.0 + x_30) > (1.0 + x_31)? (15.0 + x_30) : (1.0 + x_31))? ((3.0 + x_25) > (14.0 + x_27)? (3.0 + x_25) : (14.0 + x_27)) : ((15.0 + x_30) > (1.0 + x_31)? (15.0 + x_30) : (1.0 + x_31))))? ((((8.0 + x_0) > (8.0 + x_2)? (8.0 + x_0) : (8.0 + x_2)) > ((10.0 + x_3) > (5.0 + x_5)? (10.0 + x_3) : (5.0 + x_5))? ((8.0 + x_0) > (8.0 + x_2)? (8.0 + x_0) : (8.0 + x_2)) : ((10.0 + x_3) > (5.0 + x_5)? (10.0 + x_3) : (5.0 + x_5))) > (((13.0 + x_8) > (19.0 + x_10)? (13.0 + x_8) : (19.0 + x_10)) > ((9.0 + x_12) > (8.0 + x_16)? (9.0 + x_12) : (8.0 + x_16))? ((13.0 + x_8) > (19.0 + x_10)? (13.0 + x_8) : (19.0 + x_10)) : ((9.0 + x_12) > (8.0 + x_16)? (9.0 + x_12) : (8.0 + x_16)))? (((8.0 + x_0) > (8.0 + x_2)? (8.0 + x_0) : (8.0 + x_2)) > ((10.0 + x_3) > (5.0 + x_5)? (10.0 + x_3) : (5.0 + x_5))? ((8.0 + x_0) > (8.0 + x_2)? (8.0 + x_0) : (8.0 + x_2)) : ((10.0 + x_3) > (5.0 + x_5)? (10.0 + x_3) : (5.0 + x_5))) : (((13.0 + x_8) > (19.0 + x_10)? (13.0 + x_8) : (19.0 + x_10)) > ((9.0 + x_12) > (8.0 + x_16)? (9.0 + x_12) : (8.0 + x_16))? ((13.0 + x_8) > (19.0 + x_10)? (13.0 + x_8) : (19.0 + x_10)) : ((9.0 + x_12) > (8.0 + x_16)? (9.0 + x_12) : (8.0 + x_16)))) : ((((11.0 + x_18) > (14.0 + x_19)? (11.0 + x_18) : (14.0 + x_19)) > ((16.0 + x_20) > (13.0 + x_21)? (16.0 + x_20) : (13.0 + x_21))? ((11.0 + x_18) > (14.0 + x_19)? (11.0 + x_18) : (14.0 + x_19)) : ((16.0 + x_20) > (13.0 + x_21)? (16.0 + x_20) : (13.0 + x_21))) > (((3.0 + x_25) > (14.0 + x_27)? (3.0 + x_25) : (14.0 + x_27)) > ((15.0 + x_30) > (1.0 + x_31)? (15.0 + x_30) : (1.0 + x_31))? ((3.0 + x_25) > (14.0 + x_27)? (3.0 + x_25) : (14.0 + x_27)) : ((15.0 + x_30) > (1.0 + x_31)? (15.0 + x_30) : (1.0 + x_31)))? (((11.0 + x_18) > (14.0 + x_19)? (11.0 + x_18) : (14.0 + x_19)) > ((16.0 + x_20) > (13.0 + x_21)? (16.0 + x_20) : (13.0 + x_21))? ((11.0 + x_18) > (14.0 + x_19)? (11.0 + x_18) : (14.0 + x_19)) : ((16.0 + x_20) > (13.0 + x_21)? (16.0 + x_20) : (13.0 + x_21))) : (((3.0 + x_25) > (14.0 + x_27)? (3.0 + x_25) : (14.0 + x_27)) > ((15.0 + x_30) > (1.0 + x_31)? (15.0 + x_30) : (1.0 + x_31))? ((3.0 + x_25) > (14.0 + x_27)? (3.0 + x_25) : (14.0 + x_27)) : ((15.0 + x_30) > (1.0 + x_31)? (15.0 + x_30) : (1.0 + x_31))))); x_2_ = (((((5.0 + x_0) > (16.0 + x_1)? (5.0 + x_0) : (16.0 + x_1)) > ((15.0 + x_2) > (4.0 + x_3)? (15.0 + x_2) : (4.0 + x_3))? ((5.0 + x_0) > (16.0 + x_1)? (5.0 + x_0) : (16.0 + x_1)) : ((15.0 + x_2) > (4.0 + x_3)? (15.0 + x_2) : (4.0 + x_3))) > (((9.0 + x_11) > (4.0 + x_12)? (9.0 + x_11) : (4.0 + x_12)) > ((4.0 + x_13) > (1.0 + x_14)? (4.0 + x_13) : (1.0 + x_14))? ((9.0 + x_11) > (4.0 + x_12)? (9.0 + x_11) : (4.0 + x_12)) : ((4.0 + x_13) > (1.0 + x_14)? (4.0 + x_13) : (1.0 + x_14)))? (((5.0 + x_0) > (16.0 + x_1)? (5.0 + x_0) : (16.0 + x_1)) > ((15.0 + x_2) > (4.0 + x_3)? (15.0 + x_2) : (4.0 + x_3))? ((5.0 + x_0) > (16.0 + x_1)? (5.0 + x_0) : (16.0 + x_1)) : ((15.0 + x_2) > (4.0 + x_3)? (15.0 + x_2) : (4.0 + x_3))) : (((9.0 + x_11) > (4.0 + x_12)? (9.0 + x_11) : (4.0 + x_12)) > ((4.0 + x_13) > (1.0 + x_14)? (4.0 + x_13) : (1.0 + x_14))? ((9.0 + x_11) > (4.0 + x_12)? (9.0 + x_11) : (4.0 + x_12)) : ((4.0 + x_13) > (1.0 + x_14)? (4.0 + x_13) : (1.0 + x_14)))) > ((((20.0 + x_15) > (16.0 + x_16)? (20.0 + x_15) : (16.0 + x_16)) > ((14.0 + x_17) > (15.0 + x_18)? (14.0 + x_17) : (15.0 + x_18))? ((20.0 + x_15) > (16.0 + x_16)? (20.0 + x_15) : (16.0 + x_16)) : ((14.0 + x_17) > (15.0 + x_18)? (14.0 + x_17) : (15.0 + x_18))) > (((13.0 + x_24) > (17.0 + x_28)? (13.0 + x_24) : (17.0 + x_28)) > ((13.0 + x_29) > (19.0 + x_31)? (13.0 + x_29) : (19.0 + x_31))? ((13.0 + x_24) > (17.0 + x_28)? (13.0 + x_24) : (17.0 + x_28)) : ((13.0 + x_29) > (19.0 + x_31)? (13.0 + x_29) : (19.0 + x_31)))? (((20.0 + x_15) > (16.0 + x_16)? (20.0 + x_15) : (16.0 + x_16)) > ((14.0 + x_17) > (15.0 + x_18)? (14.0 + x_17) : (15.0 + x_18))? ((20.0 + x_15) > (16.0 + x_16)? (20.0 + x_15) : (16.0 + x_16)) : ((14.0 + x_17) > (15.0 + x_18)? (14.0 + x_17) : (15.0 + x_18))) : (((13.0 + x_24) > (17.0 + x_28)? (13.0 + x_24) : (17.0 + x_28)) > ((13.0 + x_29) > (19.0 + x_31)? (13.0 + x_29) : (19.0 + x_31))? ((13.0 + x_24) > (17.0 + x_28)? (13.0 + x_24) : (17.0 + x_28)) : ((13.0 + x_29) > (19.0 + x_31)? (13.0 + x_29) : (19.0 + x_31))))? ((((5.0 + x_0) > (16.0 + x_1)? (5.0 + x_0) : (16.0 + x_1)) > ((15.0 + x_2) > (4.0 + x_3)? (15.0 + x_2) : (4.0 + x_3))? ((5.0 + x_0) > (16.0 + x_1)? (5.0 + x_0) : (16.0 + x_1)) : ((15.0 + x_2) > (4.0 + x_3)? (15.0 + x_2) : (4.0 + x_3))) > (((9.0 + x_11) > (4.0 + x_12)? (9.0 + x_11) : (4.0 + x_12)) > ((4.0 + x_13) > (1.0 + x_14)? (4.0 + x_13) : (1.0 + x_14))? ((9.0 + x_11) > (4.0 + x_12)? (9.0 + x_11) : (4.0 + x_12)) : ((4.0 + x_13) > (1.0 + x_14)? (4.0 + x_13) : (1.0 + x_14)))? (((5.0 + x_0) > (16.0 + x_1)? (5.0 + x_0) : (16.0 + x_1)) > ((15.0 + x_2) > (4.0 + x_3)? (15.0 + x_2) : (4.0 + x_3))? ((5.0 + x_0) > (16.0 + x_1)? (5.0 + x_0) : (16.0 + x_1)) : ((15.0 + x_2) > (4.0 + x_3)? (15.0 + x_2) : (4.0 + x_3))) : (((9.0 + x_11) > (4.0 + x_12)? (9.0 + x_11) : (4.0 + x_12)) > ((4.0 + x_13) > (1.0 + x_14)? (4.0 + x_13) : (1.0 + x_14))? ((9.0 + x_11) > (4.0 + x_12)? (9.0 + x_11) : (4.0 + x_12)) : ((4.0 + x_13) > (1.0 + x_14)? (4.0 + x_13) : (1.0 + x_14)))) : ((((20.0 + x_15) > (16.0 + x_16)? (20.0 + x_15) : (16.0 + x_16)) > ((14.0 + x_17) > (15.0 + x_18)? (14.0 + x_17) : (15.0 + x_18))? ((20.0 + x_15) > (16.0 + x_16)? (20.0 + x_15) : (16.0 + x_16)) : ((14.0 + x_17) > (15.0 + x_18)? (14.0 + x_17) : (15.0 + x_18))) > (((13.0 + x_24) > (17.0 + x_28)? (13.0 + x_24) : (17.0 + x_28)) > ((13.0 + x_29) > (19.0 + x_31)? (13.0 + x_29) : (19.0 + x_31))? ((13.0 + x_24) > (17.0 + x_28)? (13.0 + x_24) : (17.0 + x_28)) : ((13.0 + x_29) > (19.0 + x_31)? (13.0 + x_29) : (19.0 + x_31)))? (((20.0 + x_15) > (16.0 + x_16)? (20.0 + x_15) : (16.0 + x_16)) > ((14.0 + x_17) > (15.0 + x_18)? (14.0 + x_17) : (15.0 + x_18))? ((20.0 + x_15) > (16.0 + x_16)? (20.0 + x_15) : (16.0 + x_16)) : ((14.0 + x_17) > (15.0 + x_18)? (14.0 + x_17) : (15.0 + x_18))) : (((13.0 + x_24) > (17.0 + x_28)? (13.0 + x_24) : (17.0 + x_28)) > ((13.0 + x_29) > (19.0 + x_31)? (13.0 + x_29) : (19.0 + x_31))? ((13.0 + x_24) > (17.0 + x_28)? (13.0 + x_24) : (17.0 + x_28)) : ((13.0 + x_29) > (19.0 + x_31)? (13.0 + x_29) : (19.0 + x_31))))); x_3_ = (((((2.0 + x_0) > (3.0 + x_1)? (2.0 + x_0) : (3.0 + x_1)) > ((2.0 + x_3) > (1.0 + x_4)? (2.0 + x_3) : (1.0 + x_4))? ((2.0 + x_0) > (3.0 + x_1)? (2.0 + x_0) : (3.0 + x_1)) : ((2.0 + x_3) > (1.0 + x_4)? (2.0 + x_3) : (1.0 + x_4))) > (((20.0 + x_5) > (20.0 + x_12)? (20.0 + x_5) : (20.0 + x_12)) > ((19.0 + x_13) > (12.0 + x_16)? (19.0 + x_13) : (12.0 + x_16))? ((20.0 + x_5) > (20.0 + x_12)? (20.0 + x_5) : (20.0 + x_12)) : ((19.0 + x_13) > (12.0 + x_16)? (19.0 + x_13) : (12.0 + x_16)))? (((2.0 + x_0) > (3.0 + x_1)? (2.0 + x_0) : (3.0 + x_1)) > ((2.0 + x_3) > (1.0 + x_4)? (2.0 + x_3) : (1.0 + x_4))? ((2.0 + x_0) > (3.0 + x_1)? (2.0 + x_0) : (3.0 + x_1)) : ((2.0 + x_3) > (1.0 + x_4)? (2.0 + x_3) : (1.0 + x_4))) : (((20.0 + x_5) > (20.0 + x_12)? (20.0 + x_5) : (20.0 + x_12)) > ((19.0 + x_13) > (12.0 + x_16)? (19.0 + x_13) : (12.0 + x_16))? ((20.0 + x_5) > (20.0 + x_12)? (20.0 + x_5) : (20.0 + x_12)) : ((19.0 + x_13) > (12.0 + x_16)? (19.0 + x_13) : (12.0 + x_16)))) > ((((6.0 + x_18) > (15.0 + x_21)? (6.0 + x_18) : (15.0 + x_21)) > ((5.0 + x_22) > (15.0 + x_25)? (5.0 + x_22) : (15.0 + x_25))? ((6.0 + x_18) > (15.0 + x_21)? (6.0 + x_18) : (15.0 + x_21)) : ((5.0 + x_22) > (15.0 + x_25)? (5.0 + x_22) : (15.0 + x_25))) > (((5.0 + x_27) > (6.0 + x_28)? (5.0 + x_27) : (6.0 + x_28)) > ((5.0 + x_29) > (3.0 + x_30)? (5.0 + x_29) : (3.0 + x_30))? ((5.0 + x_27) > (6.0 + x_28)? (5.0 + x_27) : (6.0 + x_28)) : ((5.0 + x_29) > (3.0 + x_30)? (5.0 + x_29) : (3.0 + x_30)))? (((6.0 + x_18) > (15.0 + x_21)? (6.0 + x_18) : (15.0 + x_21)) > ((5.0 + x_22) > (15.0 + x_25)? (5.0 + x_22) : (15.0 + x_25))? ((6.0 + x_18) > (15.0 + x_21)? (6.0 + x_18) : (15.0 + x_21)) : ((5.0 + x_22) > (15.0 + x_25)? (5.0 + x_22) : (15.0 + x_25))) : (((5.0 + x_27) > (6.0 + x_28)? (5.0 + x_27) : (6.0 + x_28)) > ((5.0 + x_29) > (3.0 + x_30)? (5.0 + x_29) : (3.0 + x_30))? ((5.0 + x_27) > (6.0 + x_28)? (5.0 + x_27) : (6.0 + x_28)) : ((5.0 + x_29) > (3.0 + x_30)? (5.0 + x_29) : (3.0 + x_30))))? ((((2.0 + x_0) > (3.0 + x_1)? (2.0 + x_0) : (3.0 + x_1)) > ((2.0 + x_3) > (1.0 + x_4)? (2.0 + x_3) : (1.0 + x_4))? ((2.0 + x_0) > (3.0 + x_1)? (2.0 + x_0) : (3.0 + x_1)) : ((2.0 + x_3) > (1.0 + x_4)? (2.0 + x_3) : (1.0 + x_4))) > (((20.0 + x_5) > (20.0 + x_12)? (20.0 + x_5) : (20.0 + x_12)) > ((19.0 + x_13) > (12.0 + x_16)? (19.0 + x_13) : (12.0 + x_16))? ((20.0 + x_5) > (20.0 + x_12)? (20.0 + x_5) : (20.0 + x_12)) : ((19.0 + x_13) > (12.0 + x_16)? (19.0 + x_13) : (12.0 + x_16)))? (((2.0 + x_0) > (3.0 + x_1)? (2.0 + x_0) : (3.0 + x_1)) > ((2.0 + x_3) > (1.0 + x_4)? (2.0 + x_3) : (1.0 + x_4))? ((2.0 + x_0) > (3.0 + x_1)? (2.0 + x_0) : (3.0 + x_1)) : ((2.0 + x_3) > (1.0 + x_4)? (2.0 + x_3) : (1.0 + x_4))) : (((20.0 + x_5) > (20.0 + x_12)? (20.0 + x_5) : (20.0 + x_12)) > ((19.0 + x_13) > (12.0 + x_16)? (19.0 + x_13) : (12.0 + x_16))? ((20.0 + x_5) > (20.0 + x_12)? (20.0 + x_5) : (20.0 + x_12)) : ((19.0 + x_13) > (12.0 + x_16)? (19.0 + x_13) : (12.0 + x_16)))) : ((((6.0 + x_18) > (15.0 + x_21)? (6.0 + x_18) : (15.0 + x_21)) > ((5.0 + x_22) > (15.0 + x_25)? (5.0 + x_22) : (15.0 + x_25))? ((6.0 + x_18) > (15.0 + x_21)? (6.0 + x_18) : (15.0 + x_21)) : ((5.0 + x_22) > (15.0 + x_25)? (5.0 + x_22) : (15.0 + x_25))) > (((5.0 + x_27) > (6.0 + x_28)? (5.0 + x_27) : (6.0 + x_28)) > ((5.0 + x_29) > (3.0 + x_30)? (5.0 + x_29) : (3.0 + x_30))? ((5.0 + x_27) > (6.0 + x_28)? (5.0 + x_27) : (6.0 + x_28)) : ((5.0 + x_29) > (3.0 + x_30)? (5.0 + x_29) : (3.0 + x_30)))? (((6.0 + x_18) > (15.0 + x_21)? (6.0 + x_18) : (15.0 + x_21)) > ((5.0 + x_22) > (15.0 + x_25)? (5.0 + x_22) : (15.0 + x_25))? ((6.0 + x_18) > (15.0 + x_21)? (6.0 + x_18) : (15.0 + x_21)) : ((5.0 + x_22) > (15.0 + x_25)? (5.0 + x_22) : (15.0 + x_25))) : (((5.0 + x_27) > (6.0 + x_28)? (5.0 + x_27) : (6.0 + x_28)) > ((5.0 + x_29) > (3.0 + x_30)? (5.0 + x_29) : (3.0 + x_30))? ((5.0 + x_27) > (6.0 + x_28)? (5.0 + x_27) : (6.0 + x_28)) : ((5.0 + x_29) > (3.0 + x_30)? (5.0 + x_29) : (3.0 + x_30))))); x_4_ = (((((4.0 + x_0) > (2.0 + x_1)? (4.0 + x_0) : (2.0 + x_1)) > ((17.0 + x_4) > (3.0 + x_5)? (17.0 + x_4) : (3.0 + x_5))? ((4.0 + x_0) > (2.0 + x_1)? (4.0 + x_0) : (2.0 + x_1)) : ((17.0 + x_4) > (3.0 + x_5)? (17.0 + x_4) : (3.0 + x_5))) > (((15.0 + x_8) > (4.0 + x_13)? (15.0 + x_8) : (4.0 + x_13)) > ((8.0 + x_14) > (4.0 + x_15)? (8.0 + x_14) : (4.0 + x_15))? ((15.0 + x_8) > (4.0 + x_13)? (15.0 + x_8) : (4.0 + x_13)) : ((8.0 + x_14) > (4.0 + x_15)? (8.0 + x_14) : (4.0 + x_15)))? (((4.0 + x_0) > (2.0 + x_1)? (4.0 + x_0) : (2.0 + x_1)) > ((17.0 + x_4) > (3.0 + x_5)? (17.0 + x_4) : (3.0 + x_5))? ((4.0 + x_0) > (2.0 + x_1)? (4.0 + x_0) : (2.0 + x_1)) : ((17.0 + x_4) > (3.0 + x_5)? (17.0 + x_4) : (3.0 + x_5))) : (((15.0 + x_8) > (4.0 + x_13)? (15.0 + x_8) : (4.0 + x_13)) > ((8.0 + x_14) > (4.0 + x_15)? (8.0 + x_14) : (4.0 + x_15))? ((15.0 + x_8) > (4.0 + x_13)? (15.0 + x_8) : (4.0 + x_13)) : ((8.0 + x_14) > (4.0 + x_15)? (8.0 + x_14) : (4.0 + x_15)))) > ((((17.0 + x_16) > (17.0 + x_18)? (17.0 + x_16) : (17.0 + x_18)) > ((8.0 + x_19) > (7.0 + x_23)? (8.0 + x_19) : (7.0 + x_23))? ((17.0 + x_16) > (17.0 + x_18)? (17.0 + x_16) : (17.0 + x_18)) : ((8.0 + x_19) > (7.0 + x_23)? (8.0 + x_19) : (7.0 + x_23))) > (((17.0 + x_25) > (3.0 + x_26)? (17.0 + x_25) : (3.0 + x_26)) > ((14.0 + x_27) > (8.0 + x_31)? (14.0 + x_27) : (8.0 + x_31))? ((17.0 + x_25) > (3.0 + x_26)? (17.0 + x_25) : (3.0 + x_26)) : ((14.0 + x_27) > (8.0 + x_31)? (14.0 + x_27) : (8.0 + x_31)))? (((17.0 + x_16) > (17.0 + x_18)? (17.0 + x_16) : (17.0 + x_18)) > ((8.0 + x_19) > (7.0 + x_23)? (8.0 + x_19) : (7.0 + x_23))? ((17.0 + x_16) > (17.0 + x_18)? (17.0 + x_16) : (17.0 + x_18)) : ((8.0 + x_19) > (7.0 + x_23)? (8.0 + x_19) : (7.0 + x_23))) : (((17.0 + x_25) > (3.0 + x_26)? (17.0 + x_25) : (3.0 + x_26)) > ((14.0 + x_27) > (8.0 + x_31)? (14.0 + x_27) : (8.0 + x_31))? ((17.0 + x_25) > (3.0 + x_26)? (17.0 + x_25) : (3.0 + x_26)) : ((14.0 + x_27) > (8.0 + x_31)? (14.0 + x_27) : (8.0 + x_31))))? ((((4.0 + x_0) > (2.0 + x_1)? (4.0 + x_0) : (2.0 + x_1)) > ((17.0 + x_4) > (3.0 + x_5)? (17.0 + x_4) : (3.0 + x_5))? ((4.0 + x_0) > (2.0 + x_1)? (4.0 + x_0) : (2.0 + x_1)) : ((17.0 + x_4) > (3.0 + x_5)? (17.0 + x_4) : (3.0 + x_5))) > (((15.0 + x_8) > (4.0 + x_13)? (15.0 + x_8) : (4.0 + x_13)) > ((8.0 + x_14) > (4.0 + x_15)? (8.0 + x_14) : (4.0 + x_15))? ((15.0 + x_8) > (4.0 + x_13)? (15.0 + x_8) : (4.0 + x_13)) : ((8.0 + x_14) > (4.0 + x_15)? (8.0 + x_14) : (4.0 + x_15)))? (((4.0 + x_0) > (2.0 + x_1)? (4.0 + x_0) : (2.0 + x_1)) > ((17.0 + x_4) > (3.0 + x_5)? (17.0 + x_4) : (3.0 + x_5))? ((4.0 + x_0) > (2.0 + x_1)? (4.0 + x_0) : (2.0 + x_1)) : ((17.0 + x_4) > (3.0 + x_5)? (17.0 + x_4) : (3.0 + x_5))) : (((15.0 + x_8) > (4.0 + x_13)? (15.0 + x_8) : (4.0 + x_13)) > ((8.0 + x_14) > (4.0 + x_15)? (8.0 + x_14) : (4.0 + x_15))? ((15.0 + x_8) > (4.0 + x_13)? (15.0 + x_8) : (4.0 + x_13)) : ((8.0 + x_14) > (4.0 + x_15)? (8.0 + x_14) : (4.0 + x_15)))) : ((((17.0 + x_16) > (17.0 + x_18)? (17.0 + x_16) : (17.0 + x_18)) > ((8.0 + x_19) > (7.0 + x_23)? (8.0 + x_19) : (7.0 + x_23))? ((17.0 + x_16) > (17.0 + x_18)? (17.0 + x_16) : (17.0 + x_18)) : ((8.0 + x_19) > (7.0 + x_23)? (8.0 + x_19) : (7.0 + x_23))) > (((17.0 + x_25) > (3.0 + x_26)? (17.0 + x_25) : (3.0 + x_26)) > ((14.0 + x_27) > (8.0 + x_31)? (14.0 + x_27) : (8.0 + x_31))? ((17.0 + x_25) > (3.0 + x_26)? (17.0 + x_25) : (3.0 + x_26)) : ((14.0 + x_27) > (8.0 + x_31)? (14.0 + x_27) : (8.0 + x_31)))? (((17.0 + x_16) > (17.0 + x_18)? (17.0 + x_16) : (17.0 + x_18)) > ((8.0 + x_19) > (7.0 + x_23)? (8.0 + x_19) : (7.0 + x_23))? ((17.0 + x_16) > (17.0 + x_18)? (17.0 + x_16) : (17.0 + x_18)) : ((8.0 + x_19) > (7.0 + x_23)? (8.0 + x_19) : (7.0 + x_23))) : (((17.0 + x_25) > (3.0 + x_26)? (17.0 + x_25) : (3.0 + x_26)) > ((14.0 + x_27) > (8.0 + x_31)? (14.0 + x_27) : (8.0 + x_31))? ((17.0 + x_25) > (3.0 + x_26)? (17.0 + x_25) : (3.0 + x_26)) : ((14.0 + x_27) > (8.0 + x_31)? (14.0 + x_27) : (8.0 + x_31))))); x_5_ = (((((19.0 + x_3) > (15.0 + x_4)? (19.0 + x_3) : (15.0 + x_4)) > ((1.0 + x_5) > (3.0 + x_6)? (1.0 + x_5) : (3.0 + x_6))? ((19.0 + x_3) > (15.0 + x_4)? (19.0 + x_3) : (15.0 + x_4)) : ((1.0 + x_5) > (3.0 + x_6)? (1.0 + x_5) : (3.0 + x_6))) > (((20.0 + x_7) > (16.0 + x_11)? (20.0 + x_7) : (16.0 + x_11)) > ((4.0 + x_12) > (2.0 + x_13)? (4.0 + x_12) : (2.0 + x_13))? ((20.0 + x_7) > (16.0 + x_11)? (20.0 + x_7) : (16.0 + x_11)) : ((4.0 + x_12) > (2.0 + x_13)? (4.0 + x_12) : (2.0 + x_13)))? (((19.0 + x_3) > (15.0 + x_4)? (19.0 + x_3) : (15.0 + x_4)) > ((1.0 + x_5) > (3.0 + x_6)? (1.0 + x_5) : (3.0 + x_6))? ((19.0 + x_3) > (15.0 + x_4)? (19.0 + x_3) : (15.0 + x_4)) : ((1.0 + x_5) > (3.0 + x_6)? (1.0 + x_5) : (3.0 + x_6))) : (((20.0 + x_7) > (16.0 + x_11)? (20.0 + x_7) : (16.0 + x_11)) > ((4.0 + x_12) > (2.0 + x_13)? (4.0 + x_12) : (2.0 + x_13))? ((20.0 + x_7) > (16.0 + x_11)? (20.0 + x_7) : (16.0 + x_11)) : ((4.0 + x_12) > (2.0 + x_13)? (4.0 + x_12) : (2.0 + x_13)))) > ((((9.0 + x_14) > (12.0 + x_15)? (9.0 + x_14) : (12.0 + x_15)) > ((13.0 + x_17) > (19.0 + x_23)? (13.0 + x_17) : (19.0 + x_23))? ((9.0 + x_14) > (12.0 + x_15)? (9.0 + x_14) : (12.0 + x_15)) : ((13.0 + x_17) > (19.0 + x_23)? (13.0 + x_17) : (19.0 + x_23))) > (((2.0 + x_24) > (8.0 + x_27)? (2.0 + x_24) : (8.0 + x_27)) > ((20.0 + x_28) > (10.0 + x_29)? (20.0 + x_28) : (10.0 + x_29))? ((2.0 + x_24) > (8.0 + x_27)? (2.0 + x_24) : (8.0 + x_27)) : ((20.0 + x_28) > (10.0 + x_29)? (20.0 + x_28) : (10.0 + x_29)))? (((9.0 + x_14) > (12.0 + x_15)? (9.0 + x_14) : (12.0 + x_15)) > ((13.0 + x_17) > (19.0 + x_23)? (13.0 + x_17) : (19.0 + x_23))? ((9.0 + x_14) > (12.0 + x_15)? (9.0 + x_14) : (12.0 + x_15)) : ((13.0 + x_17) > (19.0 + x_23)? (13.0 + x_17) : (19.0 + x_23))) : (((2.0 + x_24) > (8.0 + x_27)? (2.0 + x_24) : (8.0 + x_27)) > ((20.0 + x_28) > (10.0 + x_29)? (20.0 + x_28) : (10.0 + x_29))? ((2.0 + x_24) > (8.0 + x_27)? (2.0 + x_24) : (8.0 + x_27)) : ((20.0 + x_28) > (10.0 + x_29)? (20.0 + x_28) : (10.0 + x_29))))? ((((19.0 + x_3) > (15.0 + x_4)? (19.0 + x_3) : (15.0 + x_4)) > ((1.0 + x_5) > (3.0 + x_6)? (1.0 + x_5) : (3.0 + x_6))? ((19.0 + x_3) > (15.0 + x_4)? (19.0 + x_3) : (15.0 + x_4)) : ((1.0 + x_5) > (3.0 + x_6)? (1.0 + x_5) : (3.0 + x_6))) > (((20.0 + x_7) > (16.0 + x_11)? (20.0 + x_7) : (16.0 + x_11)) > ((4.0 + x_12) > (2.0 + x_13)? (4.0 + x_12) : (2.0 + x_13))? ((20.0 + x_7) > (16.0 + x_11)? (20.0 + x_7) : (16.0 + x_11)) : ((4.0 + x_12) > (2.0 + x_13)? (4.0 + x_12) : (2.0 + x_13)))? (((19.0 + x_3) > (15.0 + x_4)? (19.0 + x_3) : (15.0 + x_4)) > ((1.0 + x_5) > (3.0 + x_6)? (1.0 + x_5) : (3.0 + x_6))? ((19.0 + x_3) > (15.0 + x_4)? (19.0 + x_3) : (15.0 + x_4)) : ((1.0 + x_5) > (3.0 + x_6)? (1.0 + x_5) : (3.0 + x_6))) : (((20.0 + x_7) > (16.0 + x_11)? (20.0 + x_7) : (16.0 + x_11)) > ((4.0 + x_12) > (2.0 + x_13)? (4.0 + x_12) : (2.0 + x_13))? ((20.0 + x_7) > (16.0 + x_11)? (20.0 + x_7) : (16.0 + x_11)) : ((4.0 + x_12) > (2.0 + x_13)? (4.0 + x_12) : (2.0 + x_13)))) : ((((9.0 + x_14) > (12.0 + x_15)? (9.0 + x_14) : (12.0 + x_15)) > ((13.0 + x_17) > (19.0 + x_23)? (13.0 + x_17) : (19.0 + x_23))? ((9.0 + x_14) > (12.0 + x_15)? (9.0 + x_14) : (12.0 + x_15)) : ((13.0 + x_17) > (19.0 + x_23)? (13.0 + x_17) : (19.0 + x_23))) > (((2.0 + x_24) > (8.0 + x_27)? (2.0 + x_24) : (8.0 + x_27)) > ((20.0 + x_28) > (10.0 + x_29)? (20.0 + x_28) : (10.0 + x_29))? ((2.0 + x_24) > (8.0 + x_27)? (2.0 + x_24) : (8.0 + x_27)) : ((20.0 + x_28) > (10.0 + x_29)? (20.0 + x_28) : (10.0 + x_29)))? (((9.0 + x_14) > (12.0 + x_15)? (9.0 + x_14) : (12.0 + x_15)) > ((13.0 + x_17) > (19.0 + x_23)? (13.0 + x_17) : (19.0 + x_23))? ((9.0 + x_14) > (12.0 + x_15)? (9.0 + x_14) : (12.0 + x_15)) : ((13.0 + x_17) > (19.0 + x_23)? (13.0 + x_17) : (19.0 + x_23))) : (((2.0 + x_24) > (8.0 + x_27)? (2.0 + x_24) : (8.0 + x_27)) > ((20.0 + x_28) > (10.0 + x_29)? (20.0 + x_28) : (10.0 + x_29))? ((2.0 + x_24) > (8.0 + x_27)? (2.0 + x_24) : (8.0 + x_27)) : ((20.0 + x_28) > (10.0 + x_29)? (20.0 + x_28) : (10.0 + x_29))))); x_6_ = (((((5.0 + x_1) > (15.0 + x_3)? (5.0 + x_1) : (15.0 + x_3)) > ((12.0 + x_6) > (14.0 + x_7)? (12.0 + x_6) : (14.0 + x_7))? ((5.0 + x_1) > (15.0 + x_3)? (5.0 + x_1) : (15.0 + x_3)) : ((12.0 + x_6) > (14.0 + x_7)? (12.0 + x_6) : (14.0 + x_7))) > (((8.0 + x_8) > (1.0 + x_14)? (8.0 + x_8) : (1.0 + x_14)) > ((8.0 + x_15) > (15.0 + x_16)? (8.0 + x_15) : (15.0 + x_16))? ((8.0 + x_8) > (1.0 + x_14)? (8.0 + x_8) : (1.0 + x_14)) : ((8.0 + x_15) > (15.0 + x_16)? (8.0 + x_15) : (15.0 + x_16)))? (((5.0 + x_1) > (15.0 + x_3)? (5.0 + x_1) : (15.0 + x_3)) > ((12.0 + x_6) > (14.0 + x_7)? (12.0 + x_6) : (14.0 + x_7))? ((5.0 + x_1) > (15.0 + x_3)? (5.0 + x_1) : (15.0 + x_3)) : ((12.0 + x_6) > (14.0 + x_7)? (12.0 + x_6) : (14.0 + x_7))) : (((8.0 + x_8) > (1.0 + x_14)? (8.0 + x_8) : (1.0 + x_14)) > ((8.0 + x_15) > (15.0 + x_16)? (8.0 + x_15) : (15.0 + x_16))? ((8.0 + x_8) > (1.0 + x_14)? (8.0 + x_8) : (1.0 + x_14)) : ((8.0 + x_15) > (15.0 + x_16)? (8.0 + x_15) : (15.0 + x_16)))) > ((((15.0 + x_21) > (18.0 + x_23)? (15.0 + x_21) : (18.0 + x_23)) > ((20.0 + x_24) > (17.0 + x_25)? (20.0 + x_24) : (17.0 + x_25))? ((15.0 + x_21) > (18.0 + x_23)? (15.0 + x_21) : (18.0 + x_23)) : ((20.0 + x_24) > (17.0 + x_25)? (20.0 + x_24) : (17.0 + x_25))) > (((18.0 + x_27) > (12.0 + x_28)? (18.0 + x_27) : (12.0 + x_28)) > ((20.0 + x_29) > (11.0 + x_30)? (20.0 + x_29) : (11.0 + x_30))? ((18.0 + x_27) > (12.0 + x_28)? (18.0 + x_27) : (12.0 + x_28)) : ((20.0 + x_29) > (11.0 + x_30)? (20.0 + x_29) : (11.0 + x_30)))? (((15.0 + x_21) > (18.0 + x_23)? (15.0 + x_21) : (18.0 + x_23)) > ((20.0 + x_24) > (17.0 + x_25)? (20.0 + x_24) : (17.0 + x_25))? ((15.0 + x_21) > (18.0 + x_23)? (15.0 + x_21) : (18.0 + x_23)) : ((20.0 + x_24) > (17.0 + x_25)? (20.0 + x_24) : (17.0 + x_25))) : (((18.0 + x_27) > (12.0 + x_28)? (18.0 + x_27) : (12.0 + x_28)) > ((20.0 + x_29) > (11.0 + x_30)? (20.0 + x_29) : (11.0 + x_30))? ((18.0 + x_27) > (12.0 + x_28)? (18.0 + x_27) : (12.0 + x_28)) : ((20.0 + x_29) > (11.0 + x_30)? (20.0 + x_29) : (11.0 + x_30))))? ((((5.0 + x_1) > (15.0 + x_3)? (5.0 + x_1) : (15.0 + x_3)) > ((12.0 + x_6) > (14.0 + x_7)? (12.0 + x_6) : (14.0 + x_7))? ((5.0 + x_1) > (15.0 + x_3)? (5.0 + x_1) : (15.0 + x_3)) : ((12.0 + x_6) > (14.0 + x_7)? (12.0 + x_6) : (14.0 + x_7))) > (((8.0 + x_8) > (1.0 + x_14)? (8.0 + x_8) : (1.0 + x_14)) > ((8.0 + x_15) > (15.0 + x_16)? (8.0 + x_15) : (15.0 + x_16))? ((8.0 + x_8) > (1.0 + x_14)? (8.0 + x_8) : (1.0 + x_14)) : ((8.0 + x_15) > (15.0 + x_16)? (8.0 + x_15) : (15.0 + x_16)))? (((5.0 + x_1) > (15.0 + x_3)? (5.0 + x_1) : (15.0 + x_3)) > ((12.0 + x_6) > (14.0 + x_7)? (12.0 + x_6) : (14.0 + x_7))? ((5.0 + x_1) > (15.0 + x_3)? (5.0 + x_1) : (15.0 + x_3)) : ((12.0 + x_6) > (14.0 + x_7)? (12.0 + x_6) : (14.0 + x_7))) : (((8.0 + x_8) > (1.0 + x_14)? (8.0 + x_8) : (1.0 + x_14)) > ((8.0 + x_15) > (15.0 + x_16)? (8.0 + x_15) : (15.0 + x_16))? ((8.0 + x_8) > (1.0 + x_14)? (8.0 + x_8) : (1.0 + x_14)) : ((8.0 + x_15) > (15.0 + x_16)? (8.0 + x_15) : (15.0 + x_16)))) : ((((15.0 + x_21) > (18.0 + x_23)? (15.0 + x_21) : (18.0 + x_23)) > ((20.0 + x_24) > (17.0 + x_25)? (20.0 + x_24) : (17.0 + x_25))? ((15.0 + x_21) > (18.0 + x_23)? (15.0 + x_21) : (18.0 + x_23)) : ((20.0 + x_24) > (17.0 + x_25)? (20.0 + x_24) : (17.0 + x_25))) > (((18.0 + x_27) > (12.0 + x_28)? (18.0 + x_27) : (12.0 + x_28)) > ((20.0 + x_29) > (11.0 + x_30)? (20.0 + x_29) : (11.0 + x_30))? ((18.0 + x_27) > (12.0 + x_28)? (18.0 + x_27) : (12.0 + x_28)) : ((20.0 + x_29) > (11.0 + x_30)? (20.0 + x_29) : (11.0 + x_30)))? (((15.0 + x_21) > (18.0 + x_23)? (15.0 + x_21) : (18.0 + x_23)) > ((20.0 + x_24) > (17.0 + x_25)? (20.0 + x_24) : (17.0 + x_25))? ((15.0 + x_21) > (18.0 + x_23)? (15.0 + x_21) : (18.0 + x_23)) : ((20.0 + x_24) > (17.0 + x_25)? (20.0 + x_24) : (17.0 + x_25))) : (((18.0 + x_27) > (12.0 + x_28)? (18.0 + x_27) : (12.0 + x_28)) > ((20.0 + x_29) > (11.0 + x_30)? (20.0 + x_29) : (11.0 + x_30))? ((18.0 + x_27) > (12.0 + x_28)? (18.0 + x_27) : (12.0 + x_28)) : ((20.0 + x_29) > (11.0 + x_30)? (20.0 + x_29) : (11.0 + x_30))))); x_7_ = (((((19.0 + x_0) > (20.0 + x_5)? (19.0 + x_0) : (20.0 + x_5)) > ((17.0 + x_7) > (8.0 + x_8)? (17.0 + x_7) : (8.0 + x_8))? ((19.0 + x_0) > (20.0 + x_5)? (19.0 + x_0) : (20.0 + x_5)) : ((17.0 + x_7) > (8.0 + x_8)? (17.0 + x_7) : (8.0 + x_8))) > (((5.0 + x_11) > (12.0 + x_12)? (5.0 + x_11) : (12.0 + x_12)) > ((19.0 + x_13) > (7.0 + x_17)? (19.0 + x_13) : (7.0 + x_17))? ((5.0 + x_11) > (12.0 + x_12)? (5.0 + x_11) : (12.0 + x_12)) : ((19.0 + x_13) > (7.0 + x_17)? (19.0 + x_13) : (7.0 + x_17)))? (((19.0 + x_0) > (20.0 + x_5)? (19.0 + x_0) : (20.0 + x_5)) > ((17.0 + x_7) > (8.0 + x_8)? (17.0 + x_7) : (8.0 + x_8))? ((19.0 + x_0) > (20.0 + x_5)? (19.0 + x_0) : (20.0 + x_5)) : ((17.0 + x_7) > (8.0 + x_8)? (17.0 + x_7) : (8.0 + x_8))) : (((5.0 + x_11) > (12.0 + x_12)? (5.0 + x_11) : (12.0 + x_12)) > ((19.0 + x_13) > (7.0 + x_17)? (19.0 + x_13) : (7.0 + x_17))? ((5.0 + x_11) > (12.0 + x_12)? (5.0 + x_11) : (12.0 + x_12)) : ((19.0 + x_13) > (7.0 + x_17)? (19.0 + x_13) : (7.0 + x_17)))) > ((((5.0 + x_19) > (6.0 + x_21)? (5.0 + x_19) : (6.0 + x_21)) > ((12.0 + x_22) > (10.0 + x_23)? (12.0 + x_22) : (10.0 + x_23))? ((5.0 + x_19) > (6.0 + x_21)? (5.0 + x_19) : (6.0 + x_21)) : ((12.0 + x_22) > (10.0 + x_23)? (12.0 + x_22) : (10.0 + x_23))) > (((17.0 + x_24) > (12.0 + x_26)? (17.0 + x_24) : (12.0 + x_26)) > ((11.0 + x_27) > (14.0 + x_28)? (11.0 + x_27) : (14.0 + x_28))? ((17.0 + x_24) > (12.0 + x_26)? (17.0 + x_24) : (12.0 + x_26)) : ((11.0 + x_27) > (14.0 + x_28)? (11.0 + x_27) : (14.0 + x_28)))? (((5.0 + x_19) > (6.0 + x_21)? (5.0 + x_19) : (6.0 + x_21)) > ((12.0 + x_22) > (10.0 + x_23)? (12.0 + x_22) : (10.0 + x_23))? ((5.0 + x_19) > (6.0 + x_21)? (5.0 + x_19) : (6.0 + x_21)) : ((12.0 + x_22) > (10.0 + x_23)? (12.0 + x_22) : (10.0 + x_23))) : (((17.0 + x_24) > (12.0 + x_26)? (17.0 + x_24) : (12.0 + x_26)) > ((11.0 + x_27) > (14.0 + x_28)? (11.0 + x_27) : (14.0 + x_28))? ((17.0 + x_24) > (12.0 + x_26)? (17.0 + x_24) : (12.0 + x_26)) : ((11.0 + x_27) > (14.0 + x_28)? (11.0 + x_27) : (14.0 + x_28))))? ((((19.0 + x_0) > (20.0 + x_5)? (19.0 + x_0) : (20.0 + x_5)) > ((17.0 + x_7) > (8.0 + x_8)? (17.0 + x_7) : (8.0 + x_8))? ((19.0 + x_0) > (20.0 + x_5)? (19.0 + x_0) : (20.0 + x_5)) : ((17.0 + x_7) > (8.0 + x_8)? (17.0 + x_7) : (8.0 + x_8))) > (((5.0 + x_11) > (12.0 + x_12)? (5.0 + x_11) : (12.0 + x_12)) > ((19.0 + x_13) > (7.0 + x_17)? (19.0 + x_13) : (7.0 + x_17))? ((5.0 + x_11) > (12.0 + x_12)? (5.0 + x_11) : (12.0 + x_12)) : ((19.0 + x_13) > (7.0 + x_17)? (19.0 + x_13) : (7.0 + x_17)))? (((19.0 + x_0) > (20.0 + x_5)? (19.0 + x_0) : (20.0 + x_5)) > ((17.0 + x_7) > (8.0 + x_8)? (17.0 + x_7) : (8.0 + x_8))? ((19.0 + x_0) > (20.0 + x_5)? (19.0 + x_0) : (20.0 + x_5)) : ((17.0 + x_7) > (8.0 + x_8)? (17.0 + x_7) : (8.0 + x_8))) : (((5.0 + x_11) > (12.0 + x_12)? (5.0 + x_11) : (12.0 + x_12)) > ((19.0 + x_13) > (7.0 + x_17)? (19.0 + x_13) : (7.0 + x_17))? ((5.0 + x_11) > (12.0 + x_12)? (5.0 + x_11) : (12.0 + x_12)) : ((19.0 + x_13) > (7.0 + x_17)? (19.0 + x_13) : (7.0 + x_17)))) : ((((5.0 + x_19) > (6.0 + x_21)? (5.0 + x_19) : (6.0 + x_21)) > ((12.0 + x_22) > (10.0 + x_23)? (12.0 + x_22) : (10.0 + x_23))? ((5.0 + x_19) > (6.0 + x_21)? (5.0 + x_19) : (6.0 + x_21)) : ((12.0 + x_22) > (10.0 + x_23)? (12.0 + x_22) : (10.0 + x_23))) > (((17.0 + x_24) > (12.0 + x_26)? (17.0 + x_24) : (12.0 + x_26)) > ((11.0 + x_27) > (14.0 + x_28)? (11.0 + x_27) : (14.0 + x_28))? ((17.0 + x_24) > (12.0 + x_26)? (17.0 + x_24) : (12.0 + x_26)) : ((11.0 + x_27) > (14.0 + x_28)? (11.0 + x_27) : (14.0 + x_28)))? (((5.0 + x_19) > (6.0 + x_21)? (5.0 + x_19) : (6.0 + x_21)) > ((12.0 + x_22) > (10.0 + x_23)? (12.0 + x_22) : (10.0 + x_23))? ((5.0 + x_19) > (6.0 + x_21)? (5.0 + x_19) : (6.0 + x_21)) : ((12.0 + x_22) > (10.0 + x_23)? (12.0 + x_22) : (10.0 + x_23))) : (((17.0 + x_24) > (12.0 + x_26)? (17.0 + x_24) : (12.0 + x_26)) > ((11.0 + x_27) > (14.0 + x_28)? (11.0 + x_27) : (14.0 + x_28))? ((17.0 + x_24) > (12.0 + x_26)? (17.0 + x_24) : (12.0 + x_26)) : ((11.0 + x_27) > (14.0 + x_28)? (11.0 + x_27) : (14.0 + x_28))))); x_8_ = (((((2.0 + x_0) > (8.0 + x_1)? (2.0 + x_0) : (8.0 + x_1)) > ((9.0 + x_2) > (17.0 + x_3)? (9.0 + x_2) : (17.0 + x_3))? ((2.0 + x_0) > (8.0 + x_1)? (2.0 + x_0) : (8.0 + x_1)) : ((9.0 + x_2) > (17.0 + x_3)? (9.0 + x_2) : (17.0 + x_3))) > (((12.0 + x_6) > (18.0 + x_8)? (12.0 + x_6) : (18.0 + x_8)) > ((19.0 + x_10) > (8.0 + x_11)? (19.0 + x_10) : (8.0 + x_11))? ((12.0 + x_6) > (18.0 + x_8)? (12.0 + x_6) : (18.0 + x_8)) : ((19.0 + x_10) > (8.0 + x_11)? (19.0 + x_10) : (8.0 + x_11)))? (((2.0 + x_0) > (8.0 + x_1)? (2.0 + x_0) : (8.0 + x_1)) > ((9.0 + x_2) > (17.0 + x_3)? (9.0 + x_2) : (17.0 + x_3))? ((2.0 + x_0) > (8.0 + x_1)? (2.0 + x_0) : (8.0 + x_1)) : ((9.0 + x_2) > (17.0 + x_3)? (9.0 + x_2) : (17.0 + x_3))) : (((12.0 + x_6) > (18.0 + x_8)? (12.0 + x_6) : (18.0 + x_8)) > ((19.0 + x_10) > (8.0 + x_11)? (19.0 + x_10) : (8.0 + x_11))? ((12.0 + x_6) > (18.0 + x_8)? (12.0 + x_6) : (18.0 + x_8)) : ((19.0 + x_10) > (8.0 + x_11)? (19.0 + x_10) : (8.0 + x_11)))) > ((((1.0 + x_13) > (13.0 + x_14)? (1.0 + x_13) : (13.0 + x_14)) > ((13.0 + x_17) > (12.0 + x_22)? (13.0 + x_17) : (12.0 + x_22))? ((1.0 + x_13) > (13.0 + x_14)? (1.0 + x_13) : (13.0 + x_14)) : ((13.0 + x_17) > (12.0 + x_22)? (13.0 + x_17) : (12.0 + x_22))) > (((17.0 + x_23) > (13.0 + x_29)? (17.0 + x_23) : (13.0 + x_29)) > ((1.0 + x_30) > (10.0 + x_31)? (1.0 + x_30) : (10.0 + x_31))? ((17.0 + x_23) > (13.0 + x_29)? (17.0 + x_23) : (13.0 + x_29)) : ((1.0 + x_30) > (10.0 + x_31)? (1.0 + x_30) : (10.0 + x_31)))? (((1.0 + x_13) > (13.0 + x_14)? (1.0 + x_13) : (13.0 + x_14)) > ((13.0 + x_17) > (12.0 + x_22)? (13.0 + x_17) : (12.0 + x_22))? ((1.0 + x_13) > (13.0 + x_14)? (1.0 + x_13) : (13.0 + x_14)) : ((13.0 + x_17) > (12.0 + x_22)? (13.0 + x_17) : (12.0 + x_22))) : (((17.0 + x_23) > (13.0 + x_29)? (17.0 + x_23) : (13.0 + x_29)) > ((1.0 + x_30) > (10.0 + x_31)? (1.0 + x_30) : (10.0 + x_31))? ((17.0 + x_23) > (13.0 + x_29)? (17.0 + x_23) : (13.0 + x_29)) : ((1.0 + x_30) > (10.0 + x_31)? (1.0 + x_30) : (10.0 + x_31))))? ((((2.0 + x_0) > (8.0 + x_1)? (2.0 + x_0) : (8.0 + x_1)) > ((9.0 + x_2) > (17.0 + x_3)? (9.0 + x_2) : (17.0 + x_3))? ((2.0 + x_0) > (8.0 + x_1)? (2.0 + x_0) : (8.0 + x_1)) : ((9.0 + x_2) > (17.0 + x_3)? (9.0 + x_2) : (17.0 + x_3))) > (((12.0 + x_6) > (18.0 + x_8)? (12.0 + x_6) : (18.0 + x_8)) > ((19.0 + x_10) > (8.0 + x_11)? (19.0 + x_10) : (8.0 + x_11))? ((12.0 + x_6) > (18.0 + x_8)? (12.0 + x_6) : (18.0 + x_8)) : ((19.0 + x_10) > (8.0 + x_11)? (19.0 + x_10) : (8.0 + x_11)))? (((2.0 + x_0) > (8.0 + x_1)? (2.0 + x_0) : (8.0 + x_1)) > ((9.0 + x_2) > (17.0 + x_3)? (9.0 + x_2) : (17.0 + x_3))? ((2.0 + x_0) > (8.0 + x_1)? (2.0 + x_0) : (8.0 + x_1)) : ((9.0 + x_2) > (17.0 + x_3)? (9.0 + x_2) : (17.0 + x_3))) : (((12.0 + x_6) > (18.0 + x_8)? (12.0 + x_6) : (18.0 + x_8)) > ((19.0 + x_10) > (8.0 + x_11)? (19.0 + x_10) : (8.0 + x_11))? ((12.0 + x_6) > (18.0 + x_8)? (12.0 + x_6) : (18.0 + x_8)) : ((19.0 + x_10) > (8.0 + x_11)? (19.0 + x_10) : (8.0 + x_11)))) : ((((1.0 + x_13) > (13.0 + x_14)? (1.0 + x_13) : (13.0 + x_14)) > ((13.0 + x_17) > (12.0 + x_22)? (13.0 + x_17) : (12.0 + x_22))? ((1.0 + x_13) > (13.0 + x_14)? (1.0 + x_13) : (13.0 + x_14)) : ((13.0 + x_17) > (12.0 + x_22)? (13.0 + x_17) : (12.0 + x_22))) > (((17.0 + x_23) > (13.0 + x_29)? (17.0 + x_23) : (13.0 + x_29)) > ((1.0 + x_30) > (10.0 + x_31)? (1.0 + x_30) : (10.0 + x_31))? ((17.0 + x_23) > (13.0 + x_29)? (17.0 + x_23) : (13.0 + x_29)) : ((1.0 + x_30) > (10.0 + x_31)? (1.0 + x_30) : (10.0 + x_31)))? (((1.0 + x_13) > (13.0 + x_14)? (1.0 + x_13) : (13.0 + x_14)) > ((13.0 + x_17) > (12.0 + x_22)? (13.0 + x_17) : (12.0 + x_22))? ((1.0 + x_13) > (13.0 + x_14)? (1.0 + x_13) : (13.0 + x_14)) : ((13.0 + x_17) > (12.0 + x_22)? (13.0 + x_17) : (12.0 + x_22))) : (((17.0 + x_23) > (13.0 + x_29)? (17.0 + x_23) : (13.0 + x_29)) > ((1.0 + x_30) > (10.0 + x_31)? (1.0 + x_30) : (10.0 + x_31))? ((17.0 + x_23) > (13.0 + x_29)? (17.0 + x_23) : (13.0 + x_29)) : ((1.0 + x_30) > (10.0 + x_31)? (1.0 + x_30) : (10.0 + x_31))))); x_9_ = (((((19.0 + x_1) > (17.0 + x_3)? (19.0 + x_1) : (17.0 + x_3)) > ((2.0 + x_4) > (4.0 + x_6)? (2.0 + x_4) : (4.0 + x_6))? ((19.0 + x_1) > (17.0 + x_3)? (19.0 + x_1) : (17.0 + x_3)) : ((2.0 + x_4) > (4.0 + x_6)? (2.0 + x_4) : (4.0 + x_6))) > (((9.0 + x_7) > (5.0 + x_8)? (9.0 + x_7) : (5.0 + x_8)) > ((8.0 + x_10) > (5.0 + x_12)? (8.0 + x_10) : (5.0 + x_12))? ((9.0 + x_7) > (5.0 + x_8)? (9.0 + x_7) : (5.0 + x_8)) : ((8.0 + x_10) > (5.0 + x_12)? (8.0 + x_10) : (5.0 + x_12)))? (((19.0 + x_1) > (17.0 + x_3)? (19.0 + x_1) : (17.0 + x_3)) > ((2.0 + x_4) > (4.0 + x_6)? (2.0 + x_4) : (4.0 + x_6))? ((19.0 + x_1) > (17.0 + x_3)? (19.0 + x_1) : (17.0 + x_3)) : ((2.0 + x_4) > (4.0 + x_6)? (2.0 + x_4) : (4.0 + x_6))) : (((9.0 + x_7) > (5.0 + x_8)? (9.0 + x_7) : (5.0 + x_8)) > ((8.0 + x_10) > (5.0 + x_12)? (8.0 + x_10) : (5.0 + x_12))? ((9.0 + x_7) > (5.0 + x_8)? (9.0 + x_7) : (5.0 + x_8)) : ((8.0 + x_10) > (5.0 + x_12)? (8.0 + x_10) : (5.0 + x_12)))) > ((((9.0 + x_13) > (11.0 + x_14)? (9.0 + x_13) : (11.0 + x_14)) > ((18.0 + x_15) > (18.0 + x_17)? (18.0 + x_15) : (18.0 + x_17))? ((9.0 + x_13) > (11.0 + x_14)? (9.0 + x_13) : (11.0 + x_14)) : ((18.0 + x_15) > (18.0 + x_17)? (18.0 + x_15) : (18.0 + x_17))) > (((1.0 + x_20) > (15.0 + x_22)? (1.0 + x_20) : (15.0 + x_22)) > ((16.0 + x_25) > (2.0 + x_29)? (16.0 + x_25) : (2.0 + x_29))? ((1.0 + x_20) > (15.0 + x_22)? (1.0 + x_20) : (15.0 + x_22)) : ((16.0 + x_25) > (2.0 + x_29)? (16.0 + x_25) : (2.0 + x_29)))? (((9.0 + x_13) > (11.0 + x_14)? (9.0 + x_13) : (11.0 + x_14)) > ((18.0 + x_15) > (18.0 + x_17)? (18.0 + x_15) : (18.0 + x_17))? ((9.0 + x_13) > (11.0 + x_14)? (9.0 + x_13) : (11.0 + x_14)) : ((18.0 + x_15) > (18.0 + x_17)? (18.0 + x_15) : (18.0 + x_17))) : (((1.0 + x_20) > (15.0 + x_22)? (1.0 + x_20) : (15.0 + x_22)) > ((16.0 + x_25) > (2.0 + x_29)? (16.0 + x_25) : (2.0 + x_29))? ((1.0 + x_20) > (15.0 + x_22)? (1.0 + x_20) : (15.0 + x_22)) : ((16.0 + x_25) > (2.0 + x_29)? (16.0 + x_25) : (2.0 + x_29))))? ((((19.0 + x_1) > (17.0 + x_3)? (19.0 + x_1) : (17.0 + x_3)) > ((2.0 + x_4) > (4.0 + x_6)? (2.0 + x_4) : (4.0 + x_6))? ((19.0 + x_1) > (17.0 + x_3)? (19.0 + x_1) : (17.0 + x_3)) : ((2.0 + x_4) > (4.0 + x_6)? (2.0 + x_4) : (4.0 + x_6))) > (((9.0 + x_7) > (5.0 + x_8)? (9.0 + x_7) : (5.0 + x_8)) > ((8.0 + x_10) > (5.0 + x_12)? (8.0 + x_10) : (5.0 + x_12))? ((9.0 + x_7) > (5.0 + x_8)? (9.0 + x_7) : (5.0 + x_8)) : ((8.0 + x_10) > (5.0 + x_12)? (8.0 + x_10) : (5.0 + x_12)))? (((19.0 + x_1) > (17.0 + x_3)? (19.0 + x_1) : (17.0 + x_3)) > ((2.0 + x_4) > (4.0 + x_6)? (2.0 + x_4) : (4.0 + x_6))? ((19.0 + x_1) > (17.0 + x_3)? (19.0 + x_1) : (17.0 + x_3)) : ((2.0 + x_4) > (4.0 + x_6)? (2.0 + x_4) : (4.0 + x_6))) : (((9.0 + x_7) > (5.0 + x_8)? (9.0 + x_7) : (5.0 + x_8)) > ((8.0 + x_10) > (5.0 + x_12)? (8.0 + x_10) : (5.0 + x_12))? ((9.0 + x_7) > (5.0 + x_8)? (9.0 + x_7) : (5.0 + x_8)) : ((8.0 + x_10) > (5.0 + x_12)? (8.0 + x_10) : (5.0 + x_12)))) : ((((9.0 + x_13) > (11.0 + x_14)? (9.0 + x_13) : (11.0 + x_14)) > ((18.0 + x_15) > (18.0 + x_17)? (18.0 + x_15) : (18.0 + x_17))? ((9.0 + x_13) > (11.0 + x_14)? (9.0 + x_13) : (11.0 + x_14)) : ((18.0 + x_15) > (18.0 + x_17)? (18.0 + x_15) : (18.0 + x_17))) > (((1.0 + x_20) > (15.0 + x_22)? (1.0 + x_20) : (15.0 + x_22)) > ((16.0 + x_25) > (2.0 + x_29)? (16.0 + x_25) : (2.0 + x_29))? ((1.0 + x_20) > (15.0 + x_22)? (1.0 + x_20) : (15.0 + x_22)) : ((16.0 + x_25) > (2.0 + x_29)? (16.0 + x_25) : (2.0 + x_29)))? (((9.0 + x_13) > (11.0 + x_14)? (9.0 + x_13) : (11.0 + x_14)) > ((18.0 + x_15) > (18.0 + x_17)? (18.0 + x_15) : (18.0 + x_17))? ((9.0 + x_13) > (11.0 + x_14)? (9.0 + x_13) : (11.0 + x_14)) : ((18.0 + x_15) > (18.0 + x_17)? (18.0 + x_15) : (18.0 + x_17))) : (((1.0 + x_20) > (15.0 + x_22)? (1.0 + x_20) : (15.0 + x_22)) > ((16.0 + x_25) > (2.0 + x_29)? (16.0 + x_25) : (2.0 + x_29))? ((1.0 + x_20) > (15.0 + x_22)? (1.0 + x_20) : (15.0 + x_22)) : ((16.0 + x_25) > (2.0 + x_29)? (16.0 + x_25) : (2.0 + x_29))))); x_10_ = (((((8.0 + x_0) > (2.0 + x_8)? (8.0 + x_0) : (2.0 + x_8)) > ((20.0 + x_9) > (5.0 + x_10)? (20.0 + x_9) : (5.0 + x_10))? ((8.0 + x_0) > (2.0 + x_8)? (8.0 + x_0) : (2.0 + x_8)) : ((20.0 + x_9) > (5.0 + x_10)? (20.0 + x_9) : (5.0 + x_10))) > (((12.0 + x_13) > (5.0 + x_14)? (12.0 + x_13) : (5.0 + x_14)) > ((3.0 + x_15) > (9.0 + x_17)? (3.0 + x_15) : (9.0 + x_17))? ((12.0 + x_13) > (5.0 + x_14)? (12.0 + x_13) : (5.0 + x_14)) : ((3.0 + x_15) > (9.0 + x_17)? (3.0 + x_15) : (9.0 + x_17)))? (((8.0 + x_0) > (2.0 + x_8)? (8.0 + x_0) : (2.0 + x_8)) > ((20.0 + x_9) > (5.0 + x_10)? (20.0 + x_9) : (5.0 + x_10))? ((8.0 + x_0) > (2.0 + x_8)? (8.0 + x_0) : (2.0 + x_8)) : ((20.0 + x_9) > (5.0 + x_10)? (20.0 + x_9) : (5.0 + x_10))) : (((12.0 + x_13) > (5.0 + x_14)? (12.0 + x_13) : (5.0 + x_14)) > ((3.0 + x_15) > (9.0 + x_17)? (3.0 + x_15) : (9.0 + x_17))? ((12.0 + x_13) > (5.0 + x_14)? (12.0 + x_13) : (5.0 + x_14)) : ((3.0 + x_15) > (9.0 + x_17)? (3.0 + x_15) : (9.0 + x_17)))) > ((((1.0 + x_18) > (17.0 + x_20)? (1.0 + x_18) : (17.0 + x_20)) > ((20.0 + x_21) > (12.0 + x_23)? (20.0 + x_21) : (12.0 + x_23))? ((1.0 + x_18) > (17.0 + x_20)? (1.0 + x_18) : (17.0 + x_20)) : ((20.0 + x_21) > (12.0 + x_23)? (20.0 + x_21) : (12.0 + x_23))) > (((16.0 + x_24) > (11.0 + x_25)? (16.0 + x_24) : (11.0 + x_25)) > ((7.0 + x_29) > (3.0 + x_30)? (7.0 + x_29) : (3.0 + x_30))? ((16.0 + x_24) > (11.0 + x_25)? (16.0 + x_24) : (11.0 + x_25)) : ((7.0 + x_29) > (3.0 + x_30)? (7.0 + x_29) : (3.0 + x_30)))? (((1.0 + x_18) > (17.0 + x_20)? (1.0 + x_18) : (17.0 + x_20)) > ((20.0 + x_21) > (12.0 + x_23)? (20.0 + x_21) : (12.0 + x_23))? ((1.0 + x_18) > (17.0 + x_20)? (1.0 + x_18) : (17.0 + x_20)) : ((20.0 + x_21) > (12.0 + x_23)? (20.0 + x_21) : (12.0 + x_23))) : (((16.0 + x_24) > (11.0 + x_25)? (16.0 + x_24) : (11.0 + x_25)) > ((7.0 + x_29) > (3.0 + x_30)? (7.0 + x_29) : (3.0 + x_30))? ((16.0 + x_24) > (11.0 + x_25)? (16.0 + x_24) : (11.0 + x_25)) : ((7.0 + x_29) > (3.0 + x_30)? (7.0 + x_29) : (3.0 + x_30))))? ((((8.0 + x_0) > (2.0 + x_8)? (8.0 + x_0) : (2.0 + x_8)) > ((20.0 + x_9) > (5.0 + x_10)? (20.0 + x_9) : (5.0 + x_10))? ((8.0 + x_0) > (2.0 + x_8)? (8.0 + x_0) : (2.0 + x_8)) : ((20.0 + x_9) > (5.0 + x_10)? (20.0 + x_9) : (5.0 + x_10))) > (((12.0 + x_13) > (5.0 + x_14)? (12.0 + x_13) : (5.0 + x_14)) > ((3.0 + x_15) > (9.0 + x_17)? (3.0 + x_15) : (9.0 + x_17))? ((12.0 + x_13) > (5.0 + x_14)? (12.0 + x_13) : (5.0 + x_14)) : ((3.0 + x_15) > (9.0 + x_17)? (3.0 + x_15) : (9.0 + x_17)))? (((8.0 + x_0) > (2.0 + x_8)? (8.0 + x_0) : (2.0 + x_8)) > ((20.0 + x_9) > (5.0 + x_10)? (20.0 + x_9) : (5.0 + x_10))? ((8.0 + x_0) > (2.0 + x_8)? (8.0 + x_0) : (2.0 + x_8)) : ((20.0 + x_9) > (5.0 + x_10)? (20.0 + x_9) : (5.0 + x_10))) : (((12.0 + x_13) > (5.0 + x_14)? (12.0 + x_13) : (5.0 + x_14)) > ((3.0 + x_15) > (9.0 + x_17)? (3.0 + x_15) : (9.0 + x_17))? ((12.0 + x_13) > (5.0 + x_14)? (12.0 + x_13) : (5.0 + x_14)) : ((3.0 + x_15) > (9.0 + x_17)? (3.0 + x_15) : (9.0 + x_17)))) : ((((1.0 + x_18) > (17.0 + x_20)? (1.0 + x_18) : (17.0 + x_20)) > ((20.0 + x_21) > (12.0 + x_23)? (20.0 + x_21) : (12.0 + x_23))? ((1.0 + x_18) > (17.0 + x_20)? (1.0 + x_18) : (17.0 + x_20)) : ((20.0 + x_21) > (12.0 + x_23)? (20.0 + x_21) : (12.0 + x_23))) > (((16.0 + x_24) > (11.0 + x_25)? (16.0 + x_24) : (11.0 + x_25)) > ((7.0 + x_29) > (3.0 + x_30)? (7.0 + x_29) : (3.0 + x_30))? ((16.0 + x_24) > (11.0 + x_25)? (16.0 + x_24) : (11.0 + x_25)) : ((7.0 + x_29) > (3.0 + x_30)? (7.0 + x_29) : (3.0 + x_30)))? (((1.0 + x_18) > (17.0 + x_20)? (1.0 + x_18) : (17.0 + x_20)) > ((20.0 + x_21) > (12.0 + x_23)? (20.0 + x_21) : (12.0 + x_23))? ((1.0 + x_18) > (17.0 + x_20)? (1.0 + x_18) : (17.0 + x_20)) : ((20.0 + x_21) > (12.0 + x_23)? (20.0 + x_21) : (12.0 + x_23))) : (((16.0 + x_24) > (11.0 + x_25)? (16.0 + x_24) : (11.0 + x_25)) > ((7.0 + x_29) > (3.0 + x_30)? (7.0 + x_29) : (3.0 + x_30))? ((16.0 + x_24) > (11.0 + x_25)? (16.0 + x_24) : (11.0 + x_25)) : ((7.0 + x_29) > (3.0 + x_30)? (7.0 + x_29) : (3.0 + x_30))))); x_11_ = (((((19.0 + x_0) > (14.0 + x_7)? (19.0 + x_0) : (14.0 + x_7)) > ((2.0 + x_9) > (15.0 + x_11)? (2.0 + x_9) : (15.0 + x_11))? ((19.0 + x_0) > (14.0 + x_7)? (19.0 + x_0) : (14.0 + x_7)) : ((2.0 + x_9) > (15.0 + x_11)? (2.0 + x_9) : (15.0 + x_11))) > (((11.0 + x_12) > (20.0 + x_16)? (11.0 + x_12) : (20.0 + x_16)) > ((11.0 + x_18) > (15.0 + x_19)? (11.0 + x_18) : (15.0 + x_19))? ((11.0 + x_12) > (20.0 + x_16)? (11.0 + x_12) : (20.0 + x_16)) : ((11.0 + x_18) > (15.0 + x_19)? (11.0 + x_18) : (15.0 + x_19)))? (((19.0 + x_0) > (14.0 + x_7)? (19.0 + x_0) : (14.0 + x_7)) > ((2.0 + x_9) > (15.0 + x_11)? (2.0 + x_9) : (15.0 + x_11))? ((19.0 + x_0) > (14.0 + x_7)? (19.0 + x_0) : (14.0 + x_7)) : ((2.0 + x_9) > (15.0 + x_11)? (2.0 + x_9) : (15.0 + x_11))) : (((11.0 + x_12) > (20.0 + x_16)? (11.0 + x_12) : (20.0 + x_16)) > ((11.0 + x_18) > (15.0 + x_19)? (11.0 + x_18) : (15.0 + x_19))? ((11.0 + x_12) > (20.0 + x_16)? (11.0 + x_12) : (20.0 + x_16)) : ((11.0 + x_18) > (15.0 + x_19)? (11.0 + x_18) : (15.0 + x_19)))) > ((((1.0 + x_20) > (6.0 + x_22)? (1.0 + x_20) : (6.0 + x_22)) > ((4.0 + x_23) > (8.0 + x_24)? (4.0 + x_23) : (8.0 + x_24))? ((1.0 + x_20) > (6.0 + x_22)? (1.0 + x_20) : (6.0 + x_22)) : ((4.0 + x_23) > (8.0 + x_24)? (4.0 + x_23) : (8.0 + x_24))) > (((9.0 + x_26) > (19.0 + x_29)? (9.0 + x_26) : (19.0 + x_29)) > ((6.0 + x_30) > (10.0 + x_31)? (6.0 + x_30) : (10.0 + x_31))? ((9.0 + x_26) > (19.0 + x_29)? (9.0 + x_26) : (19.0 + x_29)) : ((6.0 + x_30) > (10.0 + x_31)? (6.0 + x_30) : (10.0 + x_31)))? (((1.0 + x_20) > (6.0 + x_22)? (1.0 + x_20) : (6.0 + x_22)) > ((4.0 + x_23) > (8.0 + x_24)? (4.0 + x_23) : (8.0 + x_24))? ((1.0 + x_20) > (6.0 + x_22)? (1.0 + x_20) : (6.0 + x_22)) : ((4.0 + x_23) > (8.0 + x_24)? (4.0 + x_23) : (8.0 + x_24))) : (((9.0 + x_26) > (19.0 + x_29)? (9.0 + x_26) : (19.0 + x_29)) > ((6.0 + x_30) > (10.0 + x_31)? (6.0 + x_30) : (10.0 + x_31))? ((9.0 + x_26) > (19.0 + x_29)? (9.0 + x_26) : (19.0 + x_29)) : ((6.0 + x_30) > (10.0 + x_31)? (6.0 + x_30) : (10.0 + x_31))))? ((((19.0 + x_0) > (14.0 + x_7)? (19.0 + x_0) : (14.0 + x_7)) > ((2.0 + x_9) > (15.0 + x_11)? (2.0 + x_9) : (15.0 + x_11))? ((19.0 + x_0) > (14.0 + x_7)? (19.0 + x_0) : (14.0 + x_7)) : ((2.0 + x_9) > (15.0 + x_11)? (2.0 + x_9) : (15.0 + x_11))) > (((11.0 + x_12) > (20.0 + x_16)? (11.0 + x_12) : (20.0 + x_16)) > ((11.0 + x_18) > (15.0 + x_19)? (11.0 + x_18) : (15.0 + x_19))? ((11.0 + x_12) > (20.0 + x_16)? (11.0 + x_12) : (20.0 + x_16)) : ((11.0 + x_18) > (15.0 + x_19)? (11.0 + x_18) : (15.0 + x_19)))? (((19.0 + x_0) > (14.0 + x_7)? (19.0 + x_0) : (14.0 + x_7)) > ((2.0 + x_9) > (15.0 + x_11)? (2.0 + x_9) : (15.0 + x_11))? ((19.0 + x_0) > (14.0 + x_7)? (19.0 + x_0) : (14.0 + x_7)) : ((2.0 + x_9) > (15.0 + x_11)? (2.0 + x_9) : (15.0 + x_11))) : (((11.0 + x_12) > (20.0 + x_16)? (11.0 + x_12) : (20.0 + x_16)) > ((11.0 + x_18) > (15.0 + x_19)? (11.0 + x_18) : (15.0 + x_19))? ((11.0 + x_12) > (20.0 + x_16)? (11.0 + x_12) : (20.0 + x_16)) : ((11.0 + x_18) > (15.0 + x_19)? (11.0 + x_18) : (15.0 + x_19)))) : ((((1.0 + x_20) > (6.0 + x_22)? (1.0 + x_20) : (6.0 + x_22)) > ((4.0 + x_23) > (8.0 + x_24)? (4.0 + x_23) : (8.0 + x_24))? ((1.0 + x_20) > (6.0 + x_22)? (1.0 + x_20) : (6.0 + x_22)) : ((4.0 + x_23) > (8.0 + x_24)? (4.0 + x_23) : (8.0 + x_24))) > (((9.0 + x_26) > (19.0 + x_29)? (9.0 + x_26) : (19.0 + x_29)) > ((6.0 + x_30) > (10.0 + x_31)? (6.0 + x_30) : (10.0 + x_31))? ((9.0 + x_26) > (19.0 + x_29)? (9.0 + x_26) : (19.0 + x_29)) : ((6.0 + x_30) > (10.0 + x_31)? (6.0 + x_30) : (10.0 + x_31)))? (((1.0 + x_20) > (6.0 + x_22)? (1.0 + x_20) : (6.0 + x_22)) > ((4.0 + x_23) > (8.0 + x_24)? (4.0 + x_23) : (8.0 + x_24))? ((1.0 + x_20) > (6.0 + x_22)? (1.0 + x_20) : (6.0 + x_22)) : ((4.0 + x_23) > (8.0 + x_24)? (4.0 + x_23) : (8.0 + x_24))) : (((9.0 + x_26) > (19.0 + x_29)? (9.0 + x_26) : (19.0 + x_29)) > ((6.0 + x_30) > (10.0 + x_31)? (6.0 + x_30) : (10.0 + x_31))? ((9.0 + x_26) > (19.0 + x_29)? (9.0 + x_26) : (19.0 + x_29)) : ((6.0 + x_30) > (10.0 + x_31)? (6.0 + x_30) : (10.0 + x_31))))); x_12_ = (((((19.0 + x_0) > (9.0 + x_2)? (19.0 + x_0) : (9.0 + x_2)) > ((5.0 + x_4) > (12.0 + x_6)? (5.0 + x_4) : (12.0 + x_6))? ((19.0 + x_0) > (9.0 + x_2)? (19.0 + x_0) : (9.0 + x_2)) : ((5.0 + x_4) > (12.0 + x_6)? (5.0 + x_4) : (12.0 + x_6))) > (((8.0 + x_7) > (8.0 + x_8)? (8.0 + x_7) : (8.0 + x_8)) > ((6.0 + x_15) > (14.0 + x_17)? (6.0 + x_15) : (14.0 + x_17))? ((8.0 + x_7) > (8.0 + x_8)? (8.0 + x_7) : (8.0 + x_8)) : ((6.0 + x_15) > (14.0 + x_17)? (6.0 + x_15) : (14.0 + x_17)))? (((19.0 + x_0) > (9.0 + x_2)? (19.0 + x_0) : (9.0 + x_2)) > ((5.0 + x_4) > (12.0 + x_6)? (5.0 + x_4) : (12.0 + x_6))? ((19.0 + x_0) > (9.0 + x_2)? (19.0 + x_0) : (9.0 + x_2)) : ((5.0 + x_4) > (12.0 + x_6)? (5.0 + x_4) : (12.0 + x_6))) : (((8.0 + x_7) > (8.0 + x_8)? (8.0 + x_7) : (8.0 + x_8)) > ((6.0 + x_15) > (14.0 + x_17)? (6.0 + x_15) : (14.0 + x_17))? ((8.0 + x_7) > (8.0 + x_8)? (8.0 + x_7) : (8.0 + x_8)) : ((6.0 + x_15) > (14.0 + x_17)? (6.0 + x_15) : (14.0 + x_17)))) > ((((4.0 + x_18) > (16.0 + x_20)? (4.0 + x_18) : (16.0 + x_20)) > ((17.0 + x_22) > (7.0 + x_27)? (17.0 + x_22) : (7.0 + x_27))? ((4.0 + x_18) > (16.0 + x_20)? (4.0 + x_18) : (16.0 + x_20)) : ((17.0 + x_22) > (7.0 + x_27)? (17.0 + x_22) : (7.0 + x_27))) > (((19.0 + x_28) > (9.0 + x_29)? (19.0 + x_28) : (9.0 + x_29)) > ((20.0 + x_30) > (6.0 + x_31)? (20.0 + x_30) : (6.0 + x_31))? ((19.0 + x_28) > (9.0 + x_29)? (19.0 + x_28) : (9.0 + x_29)) : ((20.0 + x_30) > (6.0 + x_31)? (20.0 + x_30) : (6.0 + x_31)))? (((4.0 + x_18) > (16.0 + x_20)? (4.0 + x_18) : (16.0 + x_20)) > ((17.0 + x_22) > (7.0 + x_27)? (17.0 + x_22) : (7.0 + x_27))? ((4.0 + x_18) > (16.0 + x_20)? (4.0 + x_18) : (16.0 + x_20)) : ((17.0 + x_22) > (7.0 + x_27)? (17.0 + x_22) : (7.0 + x_27))) : (((19.0 + x_28) > (9.0 + x_29)? (19.0 + x_28) : (9.0 + x_29)) > ((20.0 + x_30) > (6.0 + x_31)? (20.0 + x_30) : (6.0 + x_31))? ((19.0 + x_28) > (9.0 + x_29)? (19.0 + x_28) : (9.0 + x_29)) : ((20.0 + x_30) > (6.0 + x_31)? (20.0 + x_30) : (6.0 + x_31))))? ((((19.0 + x_0) > (9.0 + x_2)? (19.0 + x_0) : (9.0 + x_2)) > ((5.0 + x_4) > (12.0 + x_6)? (5.0 + x_4) : (12.0 + x_6))? ((19.0 + x_0) > (9.0 + x_2)? (19.0 + x_0) : (9.0 + x_2)) : ((5.0 + x_4) > (12.0 + x_6)? (5.0 + x_4) : (12.0 + x_6))) > (((8.0 + x_7) > (8.0 + x_8)? (8.0 + x_7) : (8.0 + x_8)) > ((6.0 + x_15) > (14.0 + x_17)? (6.0 + x_15) : (14.0 + x_17))? ((8.0 + x_7) > (8.0 + x_8)? (8.0 + x_7) : (8.0 + x_8)) : ((6.0 + x_15) > (14.0 + x_17)? (6.0 + x_15) : (14.0 + x_17)))? (((19.0 + x_0) > (9.0 + x_2)? (19.0 + x_0) : (9.0 + x_2)) > ((5.0 + x_4) > (12.0 + x_6)? (5.0 + x_4) : (12.0 + x_6))? ((19.0 + x_0) > (9.0 + x_2)? (19.0 + x_0) : (9.0 + x_2)) : ((5.0 + x_4) > (12.0 + x_6)? (5.0 + x_4) : (12.0 + x_6))) : (((8.0 + x_7) > (8.0 + x_8)? (8.0 + x_7) : (8.0 + x_8)) > ((6.0 + x_15) > (14.0 + x_17)? (6.0 + x_15) : (14.0 + x_17))? ((8.0 + x_7) > (8.0 + x_8)? (8.0 + x_7) : (8.0 + x_8)) : ((6.0 + x_15) > (14.0 + x_17)? (6.0 + x_15) : (14.0 + x_17)))) : ((((4.0 + x_18) > (16.0 + x_20)? (4.0 + x_18) : (16.0 + x_20)) > ((17.0 + x_22) > (7.0 + x_27)? (17.0 + x_22) : (7.0 + x_27))? ((4.0 + x_18) > (16.0 + x_20)? (4.0 + x_18) : (16.0 + x_20)) : ((17.0 + x_22) > (7.0 + x_27)? (17.0 + x_22) : (7.0 + x_27))) > (((19.0 + x_28) > (9.0 + x_29)? (19.0 + x_28) : (9.0 + x_29)) > ((20.0 + x_30) > (6.0 + x_31)? (20.0 + x_30) : (6.0 + x_31))? ((19.0 + x_28) > (9.0 + x_29)? (19.0 + x_28) : (9.0 + x_29)) : ((20.0 + x_30) > (6.0 + x_31)? (20.0 + x_30) : (6.0 + x_31)))? (((4.0 + x_18) > (16.0 + x_20)? (4.0 + x_18) : (16.0 + x_20)) > ((17.0 + x_22) > (7.0 + x_27)? (17.0 + x_22) : (7.0 + x_27))? ((4.0 + x_18) > (16.0 + x_20)? (4.0 + x_18) : (16.0 + x_20)) : ((17.0 + x_22) > (7.0 + x_27)? (17.0 + x_22) : (7.0 + x_27))) : (((19.0 + x_28) > (9.0 + x_29)? (19.0 + x_28) : (9.0 + x_29)) > ((20.0 + x_30) > (6.0 + x_31)? (20.0 + x_30) : (6.0 + x_31))? ((19.0 + x_28) > (9.0 + x_29)? (19.0 + x_28) : (9.0 + x_29)) : ((20.0 + x_30) > (6.0 + x_31)? (20.0 + x_30) : (6.0 + x_31))))); x_13_ = (((((11.0 + x_0) > (1.0 + x_2)? (11.0 + x_0) : (1.0 + x_2)) > ((15.0 + x_4) > (1.0 + x_6)? (15.0 + x_4) : (1.0 + x_6))? ((11.0 + x_0) > (1.0 + x_2)? (11.0 + x_0) : (1.0 + x_2)) : ((15.0 + x_4) > (1.0 + x_6)? (15.0 + x_4) : (1.0 + x_6))) > (((13.0 + x_7) > (15.0 + x_9)? (13.0 + x_7) : (15.0 + x_9)) > ((13.0 + x_12) > (7.0 + x_13)? (13.0 + x_12) : (7.0 + x_13))? ((13.0 + x_7) > (15.0 + x_9)? (13.0 + x_7) : (15.0 + x_9)) : ((13.0 + x_12) > (7.0 + x_13)? (13.0 + x_12) : (7.0 + x_13)))? (((11.0 + x_0) > (1.0 + x_2)? (11.0 + x_0) : (1.0 + x_2)) > ((15.0 + x_4) > (1.0 + x_6)? (15.0 + x_4) : (1.0 + x_6))? ((11.0 + x_0) > (1.0 + x_2)? (11.0 + x_0) : (1.0 + x_2)) : ((15.0 + x_4) > (1.0 + x_6)? (15.0 + x_4) : (1.0 + x_6))) : (((13.0 + x_7) > (15.0 + x_9)? (13.0 + x_7) : (15.0 + x_9)) > ((13.0 + x_12) > (7.0 + x_13)? (13.0 + x_12) : (7.0 + x_13))? ((13.0 + x_7) > (15.0 + x_9)? (13.0 + x_7) : (15.0 + x_9)) : ((13.0 + x_12) > (7.0 + x_13)? (13.0 + x_12) : (7.0 + x_13)))) > ((((14.0 + x_18) > (1.0 + x_19)? (14.0 + x_18) : (1.0 + x_19)) > ((17.0 + x_22) > (3.0 + x_23)? (17.0 + x_22) : (3.0 + x_23))? ((14.0 + x_18) > (1.0 + x_19)? (14.0 + x_18) : (1.0 + x_19)) : ((17.0 + x_22) > (3.0 + x_23)? (17.0 + x_22) : (3.0 + x_23))) > (((1.0 + x_24) > (20.0 + x_27)? (1.0 + x_24) : (20.0 + x_27)) > ((15.0 + x_28) > (16.0 + x_30)? (15.0 + x_28) : (16.0 + x_30))? ((1.0 + x_24) > (20.0 + x_27)? (1.0 + x_24) : (20.0 + x_27)) : ((15.0 + x_28) > (16.0 + x_30)? (15.0 + x_28) : (16.0 + x_30)))? (((14.0 + x_18) > (1.0 + x_19)? (14.0 + x_18) : (1.0 + x_19)) > ((17.0 + x_22) > (3.0 + x_23)? (17.0 + x_22) : (3.0 + x_23))? ((14.0 + x_18) > (1.0 + x_19)? (14.0 + x_18) : (1.0 + x_19)) : ((17.0 + x_22) > (3.0 + x_23)? (17.0 + x_22) : (3.0 + x_23))) : (((1.0 + x_24) > (20.0 + x_27)? (1.0 + x_24) : (20.0 + x_27)) > ((15.0 + x_28) > (16.0 + x_30)? (15.0 + x_28) : (16.0 + x_30))? ((1.0 + x_24) > (20.0 + x_27)? (1.0 + x_24) : (20.0 + x_27)) : ((15.0 + x_28) > (16.0 + x_30)? (15.0 + x_28) : (16.0 + x_30))))? ((((11.0 + x_0) > (1.0 + x_2)? (11.0 + x_0) : (1.0 + x_2)) > ((15.0 + x_4) > (1.0 + x_6)? (15.0 + x_4) : (1.0 + x_6))? ((11.0 + x_0) > (1.0 + x_2)? (11.0 + x_0) : (1.0 + x_2)) : ((15.0 + x_4) > (1.0 + x_6)? (15.0 + x_4) : (1.0 + x_6))) > (((13.0 + x_7) > (15.0 + x_9)? (13.0 + x_7) : (15.0 + x_9)) > ((13.0 + x_12) > (7.0 + x_13)? (13.0 + x_12) : (7.0 + x_13))? ((13.0 + x_7) > (15.0 + x_9)? (13.0 + x_7) : (15.0 + x_9)) : ((13.0 + x_12) > (7.0 + x_13)? (13.0 + x_12) : (7.0 + x_13)))? (((11.0 + x_0) > (1.0 + x_2)? (11.0 + x_0) : (1.0 + x_2)) > ((15.0 + x_4) > (1.0 + x_6)? (15.0 + x_4) : (1.0 + x_6))? ((11.0 + x_0) > (1.0 + x_2)? (11.0 + x_0) : (1.0 + x_2)) : ((15.0 + x_4) > (1.0 + x_6)? (15.0 + x_4) : (1.0 + x_6))) : (((13.0 + x_7) > (15.0 + x_9)? (13.0 + x_7) : (15.0 + x_9)) > ((13.0 + x_12) > (7.0 + x_13)? (13.0 + x_12) : (7.0 + x_13))? ((13.0 + x_7) > (15.0 + x_9)? (13.0 + x_7) : (15.0 + x_9)) : ((13.0 + x_12) > (7.0 + x_13)? (13.0 + x_12) : (7.0 + x_13)))) : ((((14.0 + x_18) > (1.0 + x_19)? (14.0 + x_18) : (1.0 + x_19)) > ((17.0 + x_22) > (3.0 + x_23)? (17.0 + x_22) : (3.0 + x_23))? ((14.0 + x_18) > (1.0 + x_19)? (14.0 + x_18) : (1.0 + x_19)) : ((17.0 + x_22) > (3.0 + x_23)? (17.0 + x_22) : (3.0 + x_23))) > (((1.0 + x_24) > (20.0 + x_27)? (1.0 + x_24) : (20.0 + x_27)) > ((15.0 + x_28) > (16.0 + x_30)? (15.0 + x_28) : (16.0 + x_30))? ((1.0 + x_24) > (20.0 + x_27)? (1.0 + x_24) : (20.0 + x_27)) : ((15.0 + x_28) > (16.0 + x_30)? (15.0 + x_28) : (16.0 + x_30)))? (((14.0 + x_18) > (1.0 + x_19)? (14.0 + x_18) : (1.0 + x_19)) > ((17.0 + x_22) > (3.0 + x_23)? (17.0 + x_22) : (3.0 + x_23))? ((14.0 + x_18) > (1.0 + x_19)? (14.0 + x_18) : (1.0 + x_19)) : ((17.0 + x_22) > (3.0 + x_23)? (17.0 + x_22) : (3.0 + x_23))) : (((1.0 + x_24) > (20.0 + x_27)? (1.0 + x_24) : (20.0 + x_27)) > ((15.0 + x_28) > (16.0 + x_30)? (15.0 + x_28) : (16.0 + x_30))? ((1.0 + x_24) > (20.0 + x_27)? (1.0 + x_24) : (20.0 + x_27)) : ((15.0 + x_28) > (16.0 + x_30)? (15.0 + x_28) : (16.0 + x_30))))); x_14_ = (((((4.0 + x_1) > (4.0 + x_2)? (4.0 + x_1) : (4.0 + x_2)) > ((8.0 + x_3) > (6.0 + x_4)? (8.0 + x_3) : (6.0 + x_4))? ((4.0 + x_1) > (4.0 + x_2)? (4.0 + x_1) : (4.0 + x_2)) : ((8.0 + x_3) > (6.0 + x_4)? (8.0 + x_3) : (6.0 + x_4))) > (((12.0 + x_5) > (10.0 + x_9)? (12.0 + x_5) : (10.0 + x_9)) > ((16.0 + x_11) > (18.0 + x_13)? (16.0 + x_11) : (18.0 + x_13))? ((12.0 + x_5) > (10.0 + x_9)? (12.0 + x_5) : (10.0 + x_9)) : ((16.0 + x_11) > (18.0 + x_13)? (16.0 + x_11) : (18.0 + x_13)))? (((4.0 + x_1) > (4.0 + x_2)? (4.0 + x_1) : (4.0 + x_2)) > ((8.0 + x_3) > (6.0 + x_4)? (8.0 + x_3) : (6.0 + x_4))? ((4.0 + x_1) > (4.0 + x_2)? (4.0 + x_1) : (4.0 + x_2)) : ((8.0 + x_3) > (6.0 + x_4)? (8.0 + x_3) : (6.0 + x_4))) : (((12.0 + x_5) > (10.0 + x_9)? (12.0 + x_5) : (10.0 + x_9)) > ((16.0 + x_11) > (18.0 + x_13)? (16.0 + x_11) : (18.0 + x_13))? ((12.0 + x_5) > (10.0 + x_9)? (12.0 + x_5) : (10.0 + x_9)) : ((16.0 + x_11) > (18.0 + x_13)? (16.0 + x_11) : (18.0 + x_13)))) > ((((14.0 + x_14) > (10.0 + x_16)? (14.0 + x_14) : (10.0 + x_16)) > ((1.0 + x_18) > (20.0 + x_22)? (1.0 + x_18) : (20.0 + x_22))? ((14.0 + x_14) > (10.0 + x_16)? (14.0 + x_14) : (10.0 + x_16)) : ((1.0 + x_18) > (20.0 + x_22)? (1.0 + x_18) : (20.0 + x_22))) > (((14.0 + x_26) > (16.0 + x_29)? (14.0 + x_26) : (16.0 + x_29)) > ((12.0 + x_30) > (17.0 + x_31)? (12.0 + x_30) : (17.0 + x_31))? ((14.0 + x_26) > (16.0 + x_29)? (14.0 + x_26) : (16.0 + x_29)) : ((12.0 + x_30) > (17.0 + x_31)? (12.0 + x_30) : (17.0 + x_31)))? (((14.0 + x_14) > (10.0 + x_16)? (14.0 + x_14) : (10.0 + x_16)) > ((1.0 + x_18) > (20.0 + x_22)? (1.0 + x_18) : (20.0 + x_22))? ((14.0 + x_14) > (10.0 + x_16)? (14.0 + x_14) : (10.0 + x_16)) : ((1.0 + x_18) > (20.0 + x_22)? (1.0 + x_18) : (20.0 + x_22))) : (((14.0 + x_26) > (16.0 + x_29)? (14.0 + x_26) : (16.0 + x_29)) > ((12.0 + x_30) > (17.0 + x_31)? (12.0 + x_30) : (17.0 + x_31))? ((14.0 + x_26) > (16.0 + x_29)? (14.0 + x_26) : (16.0 + x_29)) : ((12.0 + x_30) > (17.0 + x_31)? (12.0 + x_30) : (17.0 + x_31))))? ((((4.0 + x_1) > (4.0 + x_2)? (4.0 + x_1) : (4.0 + x_2)) > ((8.0 + x_3) > (6.0 + x_4)? (8.0 + x_3) : (6.0 + x_4))? ((4.0 + x_1) > (4.0 + x_2)? (4.0 + x_1) : (4.0 + x_2)) : ((8.0 + x_3) > (6.0 + x_4)? (8.0 + x_3) : (6.0 + x_4))) > (((12.0 + x_5) > (10.0 + x_9)? (12.0 + x_5) : (10.0 + x_9)) > ((16.0 + x_11) > (18.0 + x_13)? (16.0 + x_11) : (18.0 + x_13))? ((12.0 + x_5) > (10.0 + x_9)? (12.0 + x_5) : (10.0 + x_9)) : ((16.0 + x_11) > (18.0 + x_13)? (16.0 + x_11) : (18.0 + x_13)))? (((4.0 + x_1) > (4.0 + x_2)? (4.0 + x_1) : (4.0 + x_2)) > ((8.0 + x_3) > (6.0 + x_4)? (8.0 + x_3) : (6.0 + x_4))? ((4.0 + x_1) > (4.0 + x_2)? (4.0 + x_1) : (4.0 + x_2)) : ((8.0 + x_3) > (6.0 + x_4)? (8.0 + x_3) : (6.0 + x_4))) : (((12.0 + x_5) > (10.0 + x_9)? (12.0 + x_5) : (10.0 + x_9)) > ((16.0 + x_11) > (18.0 + x_13)? (16.0 + x_11) : (18.0 + x_13))? ((12.0 + x_5) > (10.0 + x_9)? (12.0 + x_5) : (10.0 + x_9)) : ((16.0 + x_11) > (18.0 + x_13)? (16.0 + x_11) : (18.0 + x_13)))) : ((((14.0 + x_14) > (10.0 + x_16)? (14.0 + x_14) : (10.0 + x_16)) > ((1.0 + x_18) > (20.0 + x_22)? (1.0 + x_18) : (20.0 + x_22))? ((14.0 + x_14) > (10.0 + x_16)? (14.0 + x_14) : (10.0 + x_16)) : ((1.0 + x_18) > (20.0 + x_22)? (1.0 + x_18) : (20.0 + x_22))) > (((14.0 + x_26) > (16.0 + x_29)? (14.0 + x_26) : (16.0 + x_29)) > ((12.0 + x_30) > (17.0 + x_31)? (12.0 + x_30) : (17.0 + x_31))? ((14.0 + x_26) > (16.0 + x_29)? (14.0 + x_26) : (16.0 + x_29)) : ((12.0 + x_30) > (17.0 + x_31)? (12.0 + x_30) : (17.0 + x_31)))? (((14.0 + x_14) > (10.0 + x_16)? (14.0 + x_14) : (10.0 + x_16)) > ((1.0 + x_18) > (20.0 + x_22)? (1.0 + x_18) : (20.0 + x_22))? ((14.0 + x_14) > (10.0 + x_16)? (14.0 + x_14) : (10.0 + x_16)) : ((1.0 + x_18) > (20.0 + x_22)? (1.0 + x_18) : (20.0 + x_22))) : (((14.0 + x_26) > (16.0 + x_29)? (14.0 + x_26) : (16.0 + x_29)) > ((12.0 + x_30) > (17.0 + x_31)? (12.0 + x_30) : (17.0 + x_31))? ((14.0 + x_26) > (16.0 + x_29)? (14.0 + x_26) : (16.0 + x_29)) : ((12.0 + x_30) > (17.0 + x_31)? (12.0 + x_30) : (17.0 + x_31))))); x_15_ = (((((17.0 + x_1) > (14.0 + x_3)? (17.0 + x_1) : (14.0 + x_3)) > ((7.0 + x_5) > (12.0 + x_6)? (7.0 + x_5) : (12.0 + x_6))? ((17.0 + x_1) > (14.0 + x_3)? (17.0 + x_1) : (14.0 + x_3)) : ((7.0 + x_5) > (12.0 + x_6)? (7.0 + x_5) : (12.0 + x_6))) > (((3.0 + x_7) > (1.0 + x_8)? (3.0 + x_7) : (1.0 + x_8)) > ((8.0 + x_10) > (11.0 + x_11)? (8.0 + x_10) : (11.0 + x_11))? ((3.0 + x_7) > (1.0 + x_8)? (3.0 + x_7) : (1.0 + x_8)) : ((8.0 + x_10) > (11.0 + x_11)? (8.0 + x_10) : (11.0 + x_11)))? (((17.0 + x_1) > (14.0 + x_3)? (17.0 + x_1) : (14.0 + x_3)) > ((7.0 + x_5) > (12.0 + x_6)? (7.0 + x_5) : (12.0 + x_6))? ((17.0 + x_1) > (14.0 + x_3)? (17.0 + x_1) : (14.0 + x_3)) : ((7.0 + x_5) > (12.0 + x_6)? (7.0 + x_5) : (12.0 + x_6))) : (((3.0 + x_7) > (1.0 + x_8)? (3.0 + x_7) : (1.0 + x_8)) > ((8.0 + x_10) > (11.0 + x_11)? (8.0 + x_10) : (11.0 + x_11))? ((3.0 + x_7) > (1.0 + x_8)? (3.0 + x_7) : (1.0 + x_8)) : ((8.0 + x_10) > (11.0 + x_11)? (8.0 + x_10) : (11.0 + x_11)))) > ((((3.0 + x_16) > (7.0 + x_19)? (3.0 + x_16) : (7.0 + x_19)) > ((17.0 + x_20) > (20.0 + x_24)? (17.0 + x_20) : (20.0 + x_24))? ((3.0 + x_16) > (7.0 + x_19)? (3.0 + x_16) : (7.0 + x_19)) : ((17.0 + x_20) > (20.0 + x_24)? (17.0 + x_20) : (20.0 + x_24))) > (((19.0 + x_27) > (13.0 + x_28)? (19.0 + x_27) : (13.0 + x_28)) > ((12.0 + x_29) > (13.0 + x_30)? (12.0 + x_29) : (13.0 + x_30))? ((19.0 + x_27) > (13.0 + x_28)? (19.0 + x_27) : (13.0 + x_28)) : ((12.0 + x_29) > (13.0 + x_30)? (12.0 + x_29) : (13.0 + x_30)))? (((3.0 + x_16) > (7.0 + x_19)? (3.0 + x_16) : (7.0 + x_19)) > ((17.0 + x_20) > (20.0 + x_24)? (17.0 + x_20) : (20.0 + x_24))? ((3.0 + x_16) > (7.0 + x_19)? (3.0 + x_16) : (7.0 + x_19)) : ((17.0 + x_20) > (20.0 + x_24)? (17.0 + x_20) : (20.0 + x_24))) : (((19.0 + x_27) > (13.0 + x_28)? (19.0 + x_27) : (13.0 + x_28)) > ((12.0 + x_29) > (13.0 + x_30)? (12.0 + x_29) : (13.0 + x_30))? ((19.0 + x_27) > (13.0 + x_28)? (19.0 + x_27) : (13.0 + x_28)) : ((12.0 + x_29) > (13.0 + x_30)? (12.0 + x_29) : (13.0 + x_30))))? ((((17.0 + x_1) > (14.0 + x_3)? (17.0 + x_1) : (14.0 + x_3)) > ((7.0 + x_5) > (12.0 + x_6)? (7.0 + x_5) : (12.0 + x_6))? ((17.0 + x_1) > (14.0 + x_3)? (17.0 + x_1) : (14.0 + x_3)) : ((7.0 + x_5) > (12.0 + x_6)? (7.0 + x_5) : (12.0 + x_6))) > (((3.0 + x_7) > (1.0 + x_8)? (3.0 + x_7) : (1.0 + x_8)) > ((8.0 + x_10) > (11.0 + x_11)? (8.0 + x_10) : (11.0 + x_11))? ((3.0 + x_7) > (1.0 + x_8)? (3.0 + x_7) : (1.0 + x_8)) : ((8.0 + x_10) > (11.0 + x_11)? (8.0 + x_10) : (11.0 + x_11)))? (((17.0 + x_1) > (14.0 + x_3)? (17.0 + x_1) : (14.0 + x_3)) > ((7.0 + x_5) > (12.0 + x_6)? (7.0 + x_5) : (12.0 + x_6))? ((17.0 + x_1) > (14.0 + x_3)? (17.0 + x_1) : (14.0 + x_3)) : ((7.0 + x_5) > (12.0 + x_6)? (7.0 + x_5) : (12.0 + x_6))) : (((3.0 + x_7) > (1.0 + x_8)? (3.0 + x_7) : (1.0 + x_8)) > ((8.0 + x_10) > (11.0 + x_11)? (8.0 + x_10) : (11.0 + x_11))? ((3.0 + x_7) > (1.0 + x_8)? (3.0 + x_7) : (1.0 + x_8)) : ((8.0 + x_10) > (11.0 + x_11)? (8.0 + x_10) : (11.0 + x_11)))) : ((((3.0 + x_16) > (7.0 + x_19)? (3.0 + x_16) : (7.0 + x_19)) > ((17.0 + x_20) > (20.0 + x_24)? (17.0 + x_20) : (20.0 + x_24))? ((3.0 + x_16) > (7.0 + x_19)? (3.0 + x_16) : (7.0 + x_19)) : ((17.0 + x_20) > (20.0 + x_24)? (17.0 + x_20) : (20.0 + x_24))) > (((19.0 + x_27) > (13.0 + x_28)? (19.0 + x_27) : (13.0 + x_28)) > ((12.0 + x_29) > (13.0 + x_30)? (12.0 + x_29) : (13.0 + x_30))? ((19.0 + x_27) > (13.0 + x_28)? (19.0 + x_27) : (13.0 + x_28)) : ((12.0 + x_29) > (13.0 + x_30)? (12.0 + x_29) : (13.0 + x_30)))? (((3.0 + x_16) > (7.0 + x_19)? (3.0 + x_16) : (7.0 + x_19)) > ((17.0 + x_20) > (20.0 + x_24)? (17.0 + x_20) : (20.0 + x_24))? ((3.0 + x_16) > (7.0 + x_19)? (3.0 + x_16) : (7.0 + x_19)) : ((17.0 + x_20) > (20.0 + x_24)? (17.0 + x_20) : (20.0 + x_24))) : (((19.0 + x_27) > (13.0 + x_28)? (19.0 + x_27) : (13.0 + x_28)) > ((12.0 + x_29) > (13.0 + x_30)? (12.0 + x_29) : (13.0 + x_30))? ((19.0 + x_27) > (13.0 + x_28)? (19.0 + x_27) : (13.0 + x_28)) : ((12.0 + x_29) > (13.0 + x_30)? (12.0 + x_29) : (13.0 + x_30))))); x_16_ = (((((2.0 + x_0) > (12.0 + x_1)? (2.0 + x_0) : (12.0 + x_1)) > ((14.0 + x_2) > (9.0 + x_3)? (14.0 + x_2) : (9.0 + x_3))? ((2.0 + x_0) > (12.0 + x_1)? (2.0 + x_0) : (12.0 + x_1)) : ((14.0 + x_2) > (9.0 + x_3)? (14.0 + x_2) : (9.0 + x_3))) > (((15.0 + x_4) > (15.0 + x_8)? (15.0 + x_4) : (15.0 + x_8)) > ((2.0 + x_9) > (15.0 + x_13)? (2.0 + x_9) : (15.0 + x_13))? ((15.0 + x_4) > (15.0 + x_8)? (15.0 + x_4) : (15.0 + x_8)) : ((2.0 + x_9) > (15.0 + x_13)? (2.0 + x_9) : (15.0 + x_13)))? (((2.0 + x_0) > (12.0 + x_1)? (2.0 + x_0) : (12.0 + x_1)) > ((14.0 + x_2) > (9.0 + x_3)? (14.0 + x_2) : (9.0 + x_3))? ((2.0 + x_0) > (12.0 + x_1)? (2.0 + x_0) : (12.0 + x_1)) : ((14.0 + x_2) > (9.0 + x_3)? (14.0 + x_2) : (9.0 + x_3))) : (((15.0 + x_4) > (15.0 + x_8)? (15.0 + x_4) : (15.0 + x_8)) > ((2.0 + x_9) > (15.0 + x_13)? (2.0 + x_9) : (15.0 + x_13))? ((15.0 + x_4) > (15.0 + x_8)? (15.0 + x_4) : (15.0 + x_8)) : ((2.0 + x_9) > (15.0 + x_13)? (2.0 + x_9) : (15.0 + x_13)))) > ((((15.0 + x_14) > (19.0 + x_17)? (15.0 + x_14) : (19.0 + x_17)) > ((10.0 + x_22) > (1.0 + x_24)? (10.0 + x_22) : (1.0 + x_24))? ((15.0 + x_14) > (19.0 + x_17)? (15.0 + x_14) : (19.0 + x_17)) : ((10.0 + x_22) > (1.0 + x_24)? (10.0 + x_22) : (1.0 + x_24))) > (((1.0 + x_25) > (14.0 + x_27)? (1.0 + x_25) : (14.0 + x_27)) > ((9.0 + x_28) > (5.0 + x_29)? (9.0 + x_28) : (5.0 + x_29))? ((1.0 + x_25) > (14.0 + x_27)? (1.0 + x_25) : (14.0 + x_27)) : ((9.0 + x_28) > (5.0 + x_29)? (9.0 + x_28) : (5.0 + x_29)))? (((15.0 + x_14) > (19.0 + x_17)? (15.0 + x_14) : (19.0 + x_17)) > ((10.0 + x_22) > (1.0 + x_24)? (10.0 + x_22) : (1.0 + x_24))? ((15.0 + x_14) > (19.0 + x_17)? (15.0 + x_14) : (19.0 + x_17)) : ((10.0 + x_22) > (1.0 + x_24)? (10.0 + x_22) : (1.0 + x_24))) : (((1.0 + x_25) > (14.0 + x_27)? (1.0 + x_25) : (14.0 + x_27)) > ((9.0 + x_28) > (5.0 + x_29)? (9.0 + x_28) : (5.0 + x_29))? ((1.0 + x_25) > (14.0 + x_27)? (1.0 + x_25) : (14.0 + x_27)) : ((9.0 + x_28) > (5.0 + x_29)? (9.0 + x_28) : (5.0 + x_29))))? ((((2.0 + x_0) > (12.0 + x_1)? (2.0 + x_0) : (12.0 + x_1)) > ((14.0 + x_2) > (9.0 + x_3)? (14.0 + x_2) : (9.0 + x_3))? ((2.0 + x_0) > (12.0 + x_1)? (2.0 + x_0) : (12.0 + x_1)) : ((14.0 + x_2) > (9.0 + x_3)? (14.0 + x_2) : (9.0 + x_3))) > (((15.0 + x_4) > (15.0 + x_8)? (15.0 + x_4) : (15.0 + x_8)) > ((2.0 + x_9) > (15.0 + x_13)? (2.0 + x_9) : (15.0 + x_13))? ((15.0 + x_4) > (15.0 + x_8)? (15.0 + x_4) : (15.0 + x_8)) : ((2.0 + x_9) > (15.0 + x_13)? (2.0 + x_9) : (15.0 + x_13)))? (((2.0 + x_0) > (12.0 + x_1)? (2.0 + x_0) : (12.0 + x_1)) > ((14.0 + x_2) > (9.0 + x_3)? (14.0 + x_2) : (9.0 + x_3))? ((2.0 + x_0) > (12.0 + x_1)? (2.0 + x_0) : (12.0 + x_1)) : ((14.0 + x_2) > (9.0 + x_3)? (14.0 + x_2) : (9.0 + x_3))) : (((15.0 + x_4) > (15.0 + x_8)? (15.0 + x_4) : (15.0 + x_8)) > ((2.0 + x_9) > (15.0 + x_13)? (2.0 + x_9) : (15.0 + x_13))? ((15.0 + x_4) > (15.0 + x_8)? (15.0 + x_4) : (15.0 + x_8)) : ((2.0 + x_9) > (15.0 + x_13)? (2.0 + x_9) : (15.0 + x_13)))) : ((((15.0 + x_14) > (19.0 + x_17)? (15.0 + x_14) : (19.0 + x_17)) > ((10.0 + x_22) > (1.0 + x_24)? (10.0 + x_22) : (1.0 + x_24))? ((15.0 + x_14) > (19.0 + x_17)? (15.0 + x_14) : (19.0 + x_17)) : ((10.0 + x_22) > (1.0 + x_24)? (10.0 + x_22) : (1.0 + x_24))) > (((1.0 + x_25) > (14.0 + x_27)? (1.0 + x_25) : (14.0 + x_27)) > ((9.0 + x_28) > (5.0 + x_29)? (9.0 + x_28) : (5.0 + x_29))? ((1.0 + x_25) > (14.0 + x_27)? (1.0 + x_25) : (14.0 + x_27)) : ((9.0 + x_28) > (5.0 + x_29)? (9.0 + x_28) : (5.0 + x_29)))? (((15.0 + x_14) > (19.0 + x_17)? (15.0 + x_14) : (19.0 + x_17)) > ((10.0 + x_22) > (1.0 + x_24)? (10.0 + x_22) : (1.0 + x_24))? ((15.0 + x_14) > (19.0 + x_17)? (15.0 + x_14) : (19.0 + x_17)) : ((10.0 + x_22) > (1.0 + x_24)? (10.0 + x_22) : (1.0 + x_24))) : (((1.0 + x_25) > (14.0 + x_27)? (1.0 + x_25) : (14.0 + x_27)) > ((9.0 + x_28) > (5.0 + x_29)? (9.0 + x_28) : (5.0 + x_29))? ((1.0 + x_25) > (14.0 + x_27)? (1.0 + x_25) : (14.0 + x_27)) : ((9.0 + x_28) > (5.0 + x_29)? (9.0 + x_28) : (5.0 + x_29))))); x_17_ = (((((10.0 + x_3) > (2.0 + x_5)? (10.0 + x_3) : (2.0 + x_5)) > ((16.0 + x_6) > (3.0 + x_7)? (16.0 + x_6) : (3.0 + x_7))? ((10.0 + x_3) > (2.0 + x_5)? (10.0 + x_3) : (2.0 + x_5)) : ((16.0 + x_6) > (3.0 + x_7)? (16.0 + x_6) : (3.0 + x_7))) > (((20.0 + x_9) > (15.0 + x_12)? (20.0 + x_9) : (15.0 + x_12)) > ((6.0 + x_13) > (12.0 + x_14)? (6.0 + x_13) : (12.0 + x_14))? ((20.0 + x_9) > (15.0 + x_12)? (20.0 + x_9) : (15.0 + x_12)) : ((6.0 + x_13) > (12.0 + x_14)? (6.0 + x_13) : (12.0 + x_14)))? (((10.0 + x_3) > (2.0 + x_5)? (10.0 + x_3) : (2.0 + x_5)) > ((16.0 + x_6) > (3.0 + x_7)? (16.0 + x_6) : (3.0 + x_7))? ((10.0 + x_3) > (2.0 + x_5)? (10.0 + x_3) : (2.0 + x_5)) : ((16.0 + x_6) > (3.0 + x_7)? (16.0 + x_6) : (3.0 + x_7))) : (((20.0 + x_9) > (15.0 + x_12)? (20.0 + x_9) : (15.0 + x_12)) > ((6.0 + x_13) > (12.0 + x_14)? (6.0 + x_13) : (12.0 + x_14))? ((20.0 + x_9) > (15.0 + x_12)? (20.0 + x_9) : (15.0 + x_12)) : ((6.0 + x_13) > (12.0 + x_14)? (6.0 + x_13) : (12.0 + x_14)))) > ((((8.0 + x_15) > (10.0 + x_18)? (8.0 + x_15) : (10.0 + x_18)) > ((18.0 + x_20) > (4.0 + x_21)? (18.0 + x_20) : (4.0 + x_21))? ((8.0 + x_15) > (10.0 + x_18)? (8.0 + x_15) : (10.0 + x_18)) : ((18.0 + x_20) > (4.0 + x_21)? (18.0 + x_20) : (4.0 + x_21))) > (((17.0 + x_22) > (17.0 + x_24)? (17.0 + x_22) : (17.0 + x_24)) > ((3.0 + x_25) > (8.0 + x_26)? (3.0 + x_25) : (8.0 + x_26))? ((17.0 + x_22) > (17.0 + x_24)? (17.0 + x_22) : (17.0 + x_24)) : ((3.0 + x_25) > (8.0 + x_26)? (3.0 + x_25) : (8.0 + x_26)))? (((8.0 + x_15) > (10.0 + x_18)? (8.0 + x_15) : (10.0 + x_18)) > ((18.0 + x_20) > (4.0 + x_21)? (18.0 + x_20) : (4.0 + x_21))? ((8.0 + x_15) > (10.0 + x_18)? (8.0 + x_15) : (10.0 + x_18)) : ((18.0 + x_20) > (4.0 + x_21)? (18.0 + x_20) : (4.0 + x_21))) : (((17.0 + x_22) > (17.0 + x_24)? (17.0 + x_22) : (17.0 + x_24)) > ((3.0 + x_25) > (8.0 + x_26)? (3.0 + x_25) : (8.0 + x_26))? ((17.0 + x_22) > (17.0 + x_24)? (17.0 + x_22) : (17.0 + x_24)) : ((3.0 + x_25) > (8.0 + x_26)? (3.0 + x_25) : (8.0 + x_26))))? ((((10.0 + x_3) > (2.0 + x_5)? (10.0 + x_3) : (2.0 + x_5)) > ((16.0 + x_6) > (3.0 + x_7)? (16.0 + x_6) : (3.0 + x_7))? ((10.0 + x_3) > (2.0 + x_5)? (10.0 + x_3) : (2.0 + x_5)) : ((16.0 + x_6) > (3.0 + x_7)? (16.0 + x_6) : (3.0 + x_7))) > (((20.0 + x_9) > (15.0 + x_12)? (20.0 + x_9) : (15.0 + x_12)) > ((6.0 + x_13) > (12.0 + x_14)? (6.0 + x_13) : (12.0 + x_14))? ((20.0 + x_9) > (15.0 + x_12)? (20.0 + x_9) : (15.0 + x_12)) : ((6.0 + x_13) > (12.0 + x_14)? (6.0 + x_13) : (12.0 + x_14)))? (((10.0 + x_3) > (2.0 + x_5)? (10.0 + x_3) : (2.0 + x_5)) > ((16.0 + x_6) > (3.0 + x_7)? (16.0 + x_6) : (3.0 + x_7))? ((10.0 + x_3) > (2.0 + x_5)? (10.0 + x_3) : (2.0 + x_5)) : ((16.0 + x_6) > (3.0 + x_7)? (16.0 + x_6) : (3.0 + x_7))) : (((20.0 + x_9) > (15.0 + x_12)? (20.0 + x_9) : (15.0 + x_12)) > ((6.0 + x_13) > (12.0 + x_14)? (6.0 + x_13) : (12.0 + x_14))? ((20.0 + x_9) > (15.0 + x_12)? (20.0 + x_9) : (15.0 + x_12)) : ((6.0 + x_13) > (12.0 + x_14)? (6.0 + x_13) : (12.0 + x_14)))) : ((((8.0 + x_15) > (10.0 + x_18)? (8.0 + x_15) : (10.0 + x_18)) > ((18.0 + x_20) > (4.0 + x_21)? (18.0 + x_20) : (4.0 + x_21))? ((8.0 + x_15) > (10.0 + x_18)? (8.0 + x_15) : (10.0 + x_18)) : ((18.0 + x_20) > (4.0 + x_21)? (18.0 + x_20) : (4.0 + x_21))) > (((17.0 + x_22) > (17.0 + x_24)? (17.0 + x_22) : (17.0 + x_24)) > ((3.0 + x_25) > (8.0 + x_26)? (3.0 + x_25) : (8.0 + x_26))? ((17.0 + x_22) > (17.0 + x_24)? (17.0 + x_22) : (17.0 + x_24)) : ((3.0 + x_25) > (8.0 + x_26)? (3.0 + x_25) : (8.0 + x_26)))? (((8.0 + x_15) > (10.0 + x_18)? (8.0 + x_15) : (10.0 + x_18)) > ((18.0 + x_20) > (4.0 + x_21)? (18.0 + x_20) : (4.0 + x_21))? ((8.0 + x_15) > (10.0 + x_18)? (8.0 + x_15) : (10.0 + x_18)) : ((18.0 + x_20) > (4.0 + x_21)? (18.0 + x_20) : (4.0 + x_21))) : (((17.0 + x_22) > (17.0 + x_24)? (17.0 + x_22) : (17.0 + x_24)) > ((3.0 + x_25) > (8.0 + x_26)? (3.0 + x_25) : (8.0 + x_26))? ((17.0 + x_22) > (17.0 + x_24)? (17.0 + x_22) : (17.0 + x_24)) : ((3.0 + x_25) > (8.0 + x_26)? (3.0 + x_25) : (8.0 + x_26))))); x_18_ = (((((10.0 + x_0) > (18.0 + x_3)? (10.0 + x_0) : (18.0 + x_3)) > ((9.0 + x_6) > (11.0 + x_9)? (9.0 + x_6) : (11.0 + x_9))? ((10.0 + x_0) > (18.0 + x_3)? (10.0 + x_0) : (18.0 + x_3)) : ((9.0 + x_6) > (11.0 + x_9)? (9.0 + x_6) : (11.0 + x_9))) > (((5.0 + x_11) > (15.0 + x_12)? (5.0 + x_11) : (15.0 + x_12)) > ((8.0 + x_13) > (19.0 + x_14)? (8.0 + x_13) : (19.0 + x_14))? ((5.0 + x_11) > (15.0 + x_12)? (5.0 + x_11) : (15.0 + x_12)) : ((8.0 + x_13) > (19.0 + x_14)? (8.0 + x_13) : (19.0 + x_14)))? (((10.0 + x_0) > (18.0 + x_3)? (10.0 + x_0) : (18.0 + x_3)) > ((9.0 + x_6) > (11.0 + x_9)? (9.0 + x_6) : (11.0 + x_9))? ((10.0 + x_0) > (18.0 + x_3)? (10.0 + x_0) : (18.0 + x_3)) : ((9.0 + x_6) > (11.0 + x_9)? (9.0 + x_6) : (11.0 + x_9))) : (((5.0 + x_11) > (15.0 + x_12)? (5.0 + x_11) : (15.0 + x_12)) > ((8.0 + x_13) > (19.0 + x_14)? (8.0 + x_13) : (19.0 + x_14))? ((5.0 + x_11) > (15.0 + x_12)? (5.0 + x_11) : (15.0 + x_12)) : ((8.0 + x_13) > (19.0 + x_14)? (8.0 + x_13) : (19.0 + x_14)))) > ((((5.0 + x_19) > (19.0 + x_20)? (5.0 + x_19) : (19.0 + x_20)) > ((2.0 + x_21) > (4.0 + x_23)? (2.0 + x_21) : (4.0 + x_23))? ((5.0 + x_19) > (19.0 + x_20)? (5.0 + x_19) : (19.0 + x_20)) : ((2.0 + x_21) > (4.0 + x_23)? (2.0 + x_21) : (4.0 + x_23))) > (((18.0 + x_26) > (10.0 + x_28)? (18.0 + x_26) : (10.0 + x_28)) > ((15.0 + x_29) > (11.0 + x_30)? (15.0 + x_29) : (11.0 + x_30))? ((18.0 + x_26) > (10.0 + x_28)? (18.0 + x_26) : (10.0 + x_28)) : ((15.0 + x_29) > (11.0 + x_30)? (15.0 + x_29) : (11.0 + x_30)))? (((5.0 + x_19) > (19.0 + x_20)? (5.0 + x_19) : (19.0 + x_20)) > ((2.0 + x_21) > (4.0 + x_23)? (2.0 + x_21) : (4.0 + x_23))? ((5.0 + x_19) > (19.0 + x_20)? (5.0 + x_19) : (19.0 + x_20)) : ((2.0 + x_21) > (4.0 + x_23)? (2.0 + x_21) : (4.0 + x_23))) : (((18.0 + x_26) > (10.0 + x_28)? (18.0 + x_26) : (10.0 + x_28)) > ((15.0 + x_29) > (11.0 + x_30)? (15.0 + x_29) : (11.0 + x_30))? ((18.0 + x_26) > (10.0 + x_28)? (18.0 + x_26) : (10.0 + x_28)) : ((15.0 + x_29) > (11.0 + x_30)? (15.0 + x_29) : (11.0 + x_30))))? ((((10.0 + x_0) > (18.0 + x_3)? (10.0 + x_0) : (18.0 + x_3)) > ((9.0 + x_6) > (11.0 + x_9)? (9.0 + x_6) : (11.0 + x_9))? ((10.0 + x_0) > (18.0 + x_3)? (10.0 + x_0) : (18.0 + x_3)) : ((9.0 + x_6) > (11.0 + x_9)? (9.0 + x_6) : (11.0 + x_9))) > (((5.0 + x_11) > (15.0 + x_12)? (5.0 + x_11) : (15.0 + x_12)) > ((8.0 + x_13) > (19.0 + x_14)? (8.0 + x_13) : (19.0 + x_14))? ((5.0 + x_11) > (15.0 + x_12)? (5.0 + x_11) : (15.0 + x_12)) : ((8.0 + x_13) > (19.0 + x_14)? (8.0 + x_13) : (19.0 + x_14)))? (((10.0 + x_0) > (18.0 + x_3)? (10.0 + x_0) : (18.0 + x_3)) > ((9.0 + x_6) > (11.0 + x_9)? (9.0 + x_6) : (11.0 + x_9))? ((10.0 + x_0) > (18.0 + x_3)? (10.0 + x_0) : (18.0 + x_3)) : ((9.0 + x_6) > (11.0 + x_9)? (9.0 + x_6) : (11.0 + x_9))) : (((5.0 + x_11) > (15.0 + x_12)? (5.0 + x_11) : (15.0 + x_12)) > ((8.0 + x_13) > (19.0 + x_14)? (8.0 + x_13) : (19.0 + x_14))? ((5.0 + x_11) > (15.0 + x_12)? (5.0 + x_11) : (15.0 + x_12)) : ((8.0 + x_13) > (19.0 + x_14)? (8.0 + x_13) : (19.0 + x_14)))) : ((((5.0 + x_19) > (19.0 + x_20)? (5.0 + x_19) : (19.0 + x_20)) > ((2.0 + x_21) > (4.0 + x_23)? (2.0 + x_21) : (4.0 + x_23))? ((5.0 + x_19) > (19.0 + x_20)? (5.0 + x_19) : (19.0 + x_20)) : ((2.0 + x_21) > (4.0 + x_23)? (2.0 + x_21) : (4.0 + x_23))) > (((18.0 + x_26) > (10.0 + x_28)? (18.0 + x_26) : (10.0 + x_28)) > ((15.0 + x_29) > (11.0 + x_30)? (15.0 + x_29) : (11.0 + x_30))? ((18.0 + x_26) > (10.0 + x_28)? (18.0 + x_26) : (10.0 + x_28)) : ((15.0 + x_29) > (11.0 + x_30)? (15.0 + x_29) : (11.0 + x_30)))? (((5.0 + x_19) > (19.0 + x_20)? (5.0 + x_19) : (19.0 + x_20)) > ((2.0 + x_21) > (4.0 + x_23)? (2.0 + x_21) : (4.0 + x_23))? ((5.0 + x_19) > (19.0 + x_20)? (5.0 + x_19) : (19.0 + x_20)) : ((2.0 + x_21) > (4.0 + x_23)? (2.0 + x_21) : (4.0 + x_23))) : (((18.0 + x_26) > (10.0 + x_28)? (18.0 + x_26) : (10.0 + x_28)) > ((15.0 + x_29) > (11.0 + x_30)? (15.0 + x_29) : (11.0 + x_30))? ((18.0 + x_26) > (10.0 + x_28)? (18.0 + x_26) : (10.0 + x_28)) : ((15.0 + x_29) > (11.0 + x_30)? (15.0 + x_29) : (11.0 + x_30))))); x_19_ = (((((10.0 + x_1) > (1.0 + x_2)? (10.0 + x_1) : (1.0 + x_2)) > ((10.0 + x_4) > (16.0 + x_7)? (10.0 + x_4) : (16.0 + x_7))? ((10.0 + x_1) > (1.0 + x_2)? (10.0 + x_1) : (1.0 + x_2)) : ((10.0 + x_4) > (16.0 + x_7)? (10.0 + x_4) : (16.0 + x_7))) > (((14.0 + x_9) > (9.0 + x_10)? (14.0 + x_9) : (9.0 + x_10)) > ((7.0 + x_11) > (5.0 + x_12)? (7.0 + x_11) : (5.0 + x_12))? ((14.0 + x_9) > (9.0 + x_10)? (14.0 + x_9) : (9.0 + x_10)) : ((7.0 + x_11) > (5.0 + x_12)? (7.0 + x_11) : (5.0 + x_12)))? (((10.0 + x_1) > (1.0 + x_2)? (10.0 + x_1) : (1.0 + x_2)) > ((10.0 + x_4) > (16.0 + x_7)? (10.0 + x_4) : (16.0 + x_7))? ((10.0 + x_1) > (1.0 + x_2)? (10.0 + x_1) : (1.0 + x_2)) : ((10.0 + x_4) > (16.0 + x_7)? (10.0 + x_4) : (16.0 + x_7))) : (((14.0 + x_9) > (9.0 + x_10)? (14.0 + x_9) : (9.0 + x_10)) > ((7.0 + x_11) > (5.0 + x_12)? (7.0 + x_11) : (5.0 + x_12))? ((14.0 + x_9) > (9.0 + x_10)? (14.0 + x_9) : (9.0 + x_10)) : ((7.0 + x_11) > (5.0 + x_12)? (7.0 + x_11) : (5.0 + x_12)))) > ((((8.0 + x_15) > (8.0 + x_16)? (8.0 + x_15) : (8.0 + x_16)) > ((11.0 + x_21) > (20.0 + x_25)? (11.0 + x_21) : (20.0 + x_25))? ((8.0 + x_15) > (8.0 + x_16)? (8.0 + x_15) : (8.0 + x_16)) : ((11.0 + x_21) > (20.0 + x_25)? (11.0 + x_21) : (20.0 + x_25))) > (((19.0 + x_26) > (20.0 + x_27)? (19.0 + x_26) : (20.0 + x_27)) > ((5.0 + x_29) > (6.0 + x_30)? (5.0 + x_29) : (6.0 + x_30))? ((19.0 + x_26) > (20.0 + x_27)? (19.0 + x_26) : (20.0 + x_27)) : ((5.0 + x_29) > (6.0 + x_30)? (5.0 + x_29) : (6.0 + x_30)))? (((8.0 + x_15) > (8.0 + x_16)? (8.0 + x_15) : (8.0 + x_16)) > ((11.0 + x_21) > (20.0 + x_25)? (11.0 + x_21) : (20.0 + x_25))? ((8.0 + x_15) > (8.0 + x_16)? (8.0 + x_15) : (8.0 + x_16)) : ((11.0 + x_21) > (20.0 + x_25)? (11.0 + x_21) : (20.0 + x_25))) : (((19.0 + x_26) > (20.0 + x_27)? (19.0 + x_26) : (20.0 + x_27)) > ((5.0 + x_29) > (6.0 + x_30)? (5.0 + x_29) : (6.0 + x_30))? ((19.0 + x_26) > (20.0 + x_27)? (19.0 + x_26) : (20.0 + x_27)) : ((5.0 + x_29) > (6.0 + x_30)? (5.0 + x_29) : (6.0 + x_30))))? ((((10.0 + x_1) > (1.0 + x_2)? (10.0 + x_1) : (1.0 + x_2)) > ((10.0 + x_4) > (16.0 + x_7)? (10.0 + x_4) : (16.0 + x_7))? ((10.0 + x_1) > (1.0 + x_2)? (10.0 + x_1) : (1.0 + x_2)) : ((10.0 + x_4) > (16.0 + x_7)? (10.0 + x_4) : (16.0 + x_7))) > (((14.0 + x_9) > (9.0 + x_10)? (14.0 + x_9) : (9.0 + x_10)) > ((7.0 + x_11) > (5.0 + x_12)? (7.0 + x_11) : (5.0 + x_12))? ((14.0 + x_9) > (9.0 + x_10)? (14.0 + x_9) : (9.0 + x_10)) : ((7.0 + x_11) > (5.0 + x_12)? (7.0 + x_11) : (5.0 + x_12)))? (((10.0 + x_1) > (1.0 + x_2)? (10.0 + x_1) : (1.0 + x_2)) > ((10.0 + x_4) > (16.0 + x_7)? (10.0 + x_4) : (16.0 + x_7))? ((10.0 + x_1) > (1.0 + x_2)? (10.0 + x_1) : (1.0 + x_2)) : ((10.0 + x_4) > (16.0 + x_7)? (10.0 + x_4) : (16.0 + x_7))) : (((14.0 + x_9) > (9.0 + x_10)? (14.0 + x_9) : (9.0 + x_10)) > ((7.0 + x_11) > (5.0 + x_12)? (7.0 + x_11) : (5.0 + x_12))? ((14.0 + x_9) > (9.0 + x_10)? (14.0 + x_9) : (9.0 + x_10)) : ((7.0 + x_11) > (5.0 + x_12)? (7.0 + x_11) : (5.0 + x_12)))) : ((((8.0 + x_15) > (8.0 + x_16)? (8.0 + x_15) : (8.0 + x_16)) > ((11.0 + x_21) > (20.0 + x_25)? (11.0 + x_21) : (20.0 + x_25))? ((8.0 + x_15) > (8.0 + x_16)? (8.0 + x_15) : (8.0 + x_16)) : ((11.0 + x_21) > (20.0 + x_25)? (11.0 + x_21) : (20.0 + x_25))) > (((19.0 + x_26) > (20.0 + x_27)? (19.0 + x_26) : (20.0 + x_27)) > ((5.0 + x_29) > (6.0 + x_30)? (5.0 + x_29) : (6.0 + x_30))? ((19.0 + x_26) > (20.0 + x_27)? (19.0 + x_26) : (20.0 + x_27)) : ((5.0 + x_29) > (6.0 + x_30)? (5.0 + x_29) : (6.0 + x_30)))? (((8.0 + x_15) > (8.0 + x_16)? (8.0 + x_15) : (8.0 + x_16)) > ((11.0 + x_21) > (20.0 + x_25)? (11.0 + x_21) : (20.0 + x_25))? ((8.0 + x_15) > (8.0 + x_16)? (8.0 + x_15) : (8.0 + x_16)) : ((11.0 + x_21) > (20.0 + x_25)? (11.0 + x_21) : (20.0 + x_25))) : (((19.0 + x_26) > (20.0 + x_27)? (19.0 + x_26) : (20.0 + x_27)) > ((5.0 + x_29) > (6.0 + x_30)? (5.0 + x_29) : (6.0 + x_30))? ((19.0 + x_26) > (20.0 + x_27)? (19.0 + x_26) : (20.0 + x_27)) : ((5.0 + x_29) > (6.0 + x_30)? (5.0 + x_29) : (6.0 + x_30))))); x_20_ = (((((14.0 + x_1) > (14.0 + x_3)? (14.0 + x_1) : (14.0 + x_3)) > ((19.0 + x_5) > (14.0 + x_6)? (19.0 + x_5) : (14.0 + x_6))? ((14.0 + x_1) > (14.0 + x_3)? (14.0 + x_1) : (14.0 + x_3)) : ((19.0 + x_5) > (14.0 + x_6)? (19.0 + x_5) : (14.0 + x_6))) > (((10.0 + x_9) > (16.0 + x_11)? (10.0 + x_9) : (16.0 + x_11)) > ((8.0 + x_13) > (5.0 + x_15)? (8.0 + x_13) : (5.0 + x_15))? ((10.0 + x_9) > (16.0 + x_11)? (10.0 + x_9) : (16.0 + x_11)) : ((8.0 + x_13) > (5.0 + x_15)? (8.0 + x_13) : (5.0 + x_15)))? (((14.0 + x_1) > (14.0 + x_3)? (14.0 + x_1) : (14.0 + x_3)) > ((19.0 + x_5) > (14.0 + x_6)? (19.0 + x_5) : (14.0 + x_6))? ((14.0 + x_1) > (14.0 + x_3)? (14.0 + x_1) : (14.0 + x_3)) : ((19.0 + x_5) > (14.0 + x_6)? (19.0 + x_5) : (14.0 + x_6))) : (((10.0 + x_9) > (16.0 + x_11)? (10.0 + x_9) : (16.0 + x_11)) > ((8.0 + x_13) > (5.0 + x_15)? (8.0 + x_13) : (5.0 + x_15))? ((10.0 + x_9) > (16.0 + x_11)? (10.0 + x_9) : (16.0 + x_11)) : ((8.0 + x_13) > (5.0 + x_15)? (8.0 + x_13) : (5.0 + x_15)))) > ((((4.0 + x_16) > (11.0 + x_18)? (4.0 + x_16) : (11.0 + x_18)) > ((1.0 + x_20) > (2.0 + x_24)? (1.0 + x_20) : (2.0 + x_24))? ((4.0 + x_16) > (11.0 + x_18)? (4.0 + x_16) : (11.0 + x_18)) : ((1.0 + x_20) > (2.0 + x_24)? (1.0 + x_20) : (2.0 + x_24))) > (((1.0 + x_25) > (7.0 + x_26)? (1.0 + x_25) : (7.0 + x_26)) > ((15.0 + x_27) > (16.0 + x_28)? (15.0 + x_27) : (16.0 + x_28))? ((1.0 + x_25) > (7.0 + x_26)? (1.0 + x_25) : (7.0 + x_26)) : ((15.0 + x_27) > (16.0 + x_28)? (15.0 + x_27) : (16.0 + x_28)))? (((4.0 + x_16) > (11.0 + x_18)? (4.0 + x_16) : (11.0 + x_18)) > ((1.0 + x_20) > (2.0 + x_24)? (1.0 + x_20) : (2.0 + x_24))? ((4.0 + x_16) > (11.0 + x_18)? (4.0 + x_16) : (11.0 + x_18)) : ((1.0 + x_20) > (2.0 + x_24)? (1.0 + x_20) : (2.0 + x_24))) : (((1.0 + x_25) > (7.0 + x_26)? (1.0 + x_25) : (7.0 + x_26)) > ((15.0 + x_27) > (16.0 + x_28)? (15.0 + x_27) : (16.0 + x_28))? ((1.0 + x_25) > (7.0 + x_26)? (1.0 + x_25) : (7.0 + x_26)) : ((15.0 + x_27) > (16.0 + x_28)? (15.0 + x_27) : (16.0 + x_28))))? ((((14.0 + x_1) > (14.0 + x_3)? (14.0 + x_1) : (14.0 + x_3)) > ((19.0 + x_5) > (14.0 + x_6)? (19.0 + x_5) : (14.0 + x_6))? ((14.0 + x_1) > (14.0 + x_3)? (14.0 + x_1) : (14.0 + x_3)) : ((19.0 + x_5) > (14.0 + x_6)? (19.0 + x_5) : (14.0 + x_6))) > (((10.0 + x_9) > (16.0 + x_11)? (10.0 + x_9) : (16.0 + x_11)) > ((8.0 + x_13) > (5.0 + x_15)? (8.0 + x_13) : (5.0 + x_15))? ((10.0 + x_9) > (16.0 + x_11)? (10.0 + x_9) : (16.0 + x_11)) : ((8.0 + x_13) > (5.0 + x_15)? (8.0 + x_13) : (5.0 + x_15)))? (((14.0 + x_1) > (14.0 + x_3)? (14.0 + x_1) : (14.0 + x_3)) > ((19.0 + x_5) > (14.0 + x_6)? (19.0 + x_5) : (14.0 + x_6))? ((14.0 + x_1) > (14.0 + x_3)? (14.0 + x_1) : (14.0 + x_3)) : ((19.0 + x_5) > (14.0 + x_6)? (19.0 + x_5) : (14.0 + x_6))) : (((10.0 + x_9) > (16.0 + x_11)? (10.0 + x_9) : (16.0 + x_11)) > ((8.0 + x_13) > (5.0 + x_15)? (8.0 + x_13) : (5.0 + x_15))? ((10.0 + x_9) > (16.0 + x_11)? (10.0 + x_9) : (16.0 + x_11)) : ((8.0 + x_13) > (5.0 + x_15)? (8.0 + x_13) : (5.0 + x_15)))) : ((((4.0 + x_16) > (11.0 + x_18)? (4.0 + x_16) : (11.0 + x_18)) > ((1.0 + x_20) > (2.0 + x_24)? (1.0 + x_20) : (2.0 + x_24))? ((4.0 + x_16) > (11.0 + x_18)? (4.0 + x_16) : (11.0 + x_18)) : ((1.0 + x_20) > (2.0 + x_24)? (1.0 + x_20) : (2.0 + x_24))) > (((1.0 + x_25) > (7.0 + x_26)? (1.0 + x_25) : (7.0 + x_26)) > ((15.0 + x_27) > (16.0 + x_28)? (15.0 + x_27) : (16.0 + x_28))? ((1.0 + x_25) > (7.0 + x_26)? (1.0 + x_25) : (7.0 + x_26)) : ((15.0 + x_27) > (16.0 + x_28)? (15.0 + x_27) : (16.0 + x_28)))? (((4.0 + x_16) > (11.0 + x_18)? (4.0 + x_16) : (11.0 + x_18)) > ((1.0 + x_20) > (2.0 + x_24)? (1.0 + x_20) : (2.0 + x_24))? ((4.0 + x_16) > (11.0 + x_18)? (4.0 + x_16) : (11.0 + x_18)) : ((1.0 + x_20) > (2.0 + x_24)? (1.0 + x_20) : (2.0 + x_24))) : (((1.0 + x_25) > (7.0 + x_26)? (1.0 + x_25) : (7.0 + x_26)) > ((15.0 + x_27) > (16.0 + x_28)? (15.0 + x_27) : (16.0 + x_28))? ((1.0 + x_25) > (7.0 + x_26)? (1.0 + x_25) : (7.0 + x_26)) : ((15.0 + x_27) > (16.0 + x_28)? (15.0 + x_27) : (16.0 + x_28))))); x_21_ = (((((8.0 + x_7) > (19.0 + x_8)? (8.0 + x_7) : (19.0 + x_8)) > ((4.0 + x_9) > (19.0 + x_11)? (4.0 + x_9) : (19.0 + x_11))? ((8.0 + x_7) > (19.0 + x_8)? (8.0 + x_7) : (19.0 + x_8)) : ((4.0 + x_9) > (19.0 + x_11)? (4.0 + x_9) : (19.0 + x_11))) > (((4.0 + x_12) > (19.0 + x_13)? (4.0 + x_12) : (19.0 + x_13)) > ((18.0 + x_15) > (16.0 + x_16)? (18.0 + x_15) : (16.0 + x_16))? ((4.0 + x_12) > (19.0 + x_13)? (4.0 + x_12) : (19.0 + x_13)) : ((18.0 + x_15) > (16.0 + x_16)? (18.0 + x_15) : (16.0 + x_16)))? (((8.0 + x_7) > (19.0 + x_8)? (8.0 + x_7) : (19.0 + x_8)) > ((4.0 + x_9) > (19.0 + x_11)? (4.0 + x_9) : (19.0 + x_11))? ((8.0 + x_7) > (19.0 + x_8)? (8.0 + x_7) : (19.0 + x_8)) : ((4.0 + x_9) > (19.0 + x_11)? (4.0 + x_9) : (19.0 + x_11))) : (((4.0 + x_12) > (19.0 + x_13)? (4.0 + x_12) : (19.0 + x_13)) > ((18.0 + x_15) > (16.0 + x_16)? (18.0 + x_15) : (16.0 + x_16))? ((4.0 + x_12) > (19.0 + x_13)? (4.0 + x_12) : (19.0 + x_13)) : ((18.0 + x_15) > (16.0 + x_16)? (18.0 + x_15) : (16.0 + x_16)))) > ((((17.0 + x_17) > (3.0 + x_19)? (17.0 + x_17) : (3.0 + x_19)) > ((4.0 + x_20) > (19.0 + x_21)? (4.0 + x_20) : (19.0 + x_21))? ((17.0 + x_17) > (3.0 + x_19)? (17.0 + x_17) : (3.0 + x_19)) : ((4.0 + x_20) > (19.0 + x_21)? (4.0 + x_20) : (19.0 + x_21))) > (((10.0 + x_24) > (16.0 + x_25)? (10.0 + x_24) : (16.0 + x_25)) > ((14.0 + x_27) > (12.0 + x_29)? (14.0 + x_27) : (12.0 + x_29))? ((10.0 + x_24) > (16.0 + x_25)? (10.0 + x_24) : (16.0 + x_25)) : ((14.0 + x_27) > (12.0 + x_29)? (14.0 + x_27) : (12.0 + x_29)))? (((17.0 + x_17) > (3.0 + x_19)? (17.0 + x_17) : (3.0 + x_19)) > ((4.0 + x_20) > (19.0 + x_21)? (4.0 + x_20) : (19.0 + x_21))? ((17.0 + x_17) > (3.0 + x_19)? (17.0 + x_17) : (3.0 + x_19)) : ((4.0 + x_20) > (19.0 + x_21)? (4.0 + x_20) : (19.0 + x_21))) : (((10.0 + x_24) > (16.0 + x_25)? (10.0 + x_24) : (16.0 + x_25)) > ((14.0 + x_27) > (12.0 + x_29)? (14.0 + x_27) : (12.0 + x_29))? ((10.0 + x_24) > (16.0 + x_25)? (10.0 + x_24) : (16.0 + x_25)) : ((14.0 + x_27) > (12.0 + x_29)? (14.0 + x_27) : (12.0 + x_29))))? ((((8.0 + x_7) > (19.0 + x_8)? (8.0 + x_7) : (19.0 + x_8)) > ((4.0 + x_9) > (19.0 + x_11)? (4.0 + x_9) : (19.0 + x_11))? ((8.0 + x_7) > (19.0 + x_8)? (8.0 + x_7) : (19.0 + x_8)) : ((4.0 + x_9) > (19.0 + x_11)? (4.0 + x_9) : (19.0 + x_11))) > (((4.0 + x_12) > (19.0 + x_13)? (4.0 + x_12) : (19.0 + x_13)) > ((18.0 + x_15) > (16.0 + x_16)? (18.0 + x_15) : (16.0 + x_16))? ((4.0 + x_12) > (19.0 + x_13)? (4.0 + x_12) : (19.0 + x_13)) : ((18.0 + x_15) > (16.0 + x_16)? (18.0 + x_15) : (16.0 + x_16)))? (((8.0 + x_7) > (19.0 + x_8)? (8.0 + x_7) : (19.0 + x_8)) > ((4.0 + x_9) > (19.0 + x_11)? (4.0 + x_9) : (19.0 + x_11))? ((8.0 + x_7) > (19.0 + x_8)? (8.0 + x_7) : (19.0 + x_8)) : ((4.0 + x_9) > (19.0 + x_11)? (4.0 + x_9) : (19.0 + x_11))) : (((4.0 + x_12) > (19.0 + x_13)? (4.0 + x_12) : (19.0 + x_13)) > ((18.0 + x_15) > (16.0 + x_16)? (18.0 + x_15) : (16.0 + x_16))? ((4.0 + x_12) > (19.0 + x_13)? (4.0 + x_12) : (19.0 + x_13)) : ((18.0 + x_15) > (16.0 + x_16)? (18.0 + x_15) : (16.0 + x_16)))) : ((((17.0 + x_17) > (3.0 + x_19)? (17.0 + x_17) : (3.0 + x_19)) > ((4.0 + x_20) > (19.0 + x_21)? (4.0 + x_20) : (19.0 + x_21))? ((17.0 + x_17) > (3.0 + x_19)? (17.0 + x_17) : (3.0 + x_19)) : ((4.0 + x_20) > (19.0 + x_21)? (4.0 + x_20) : (19.0 + x_21))) > (((10.0 + x_24) > (16.0 + x_25)? (10.0 + x_24) : (16.0 + x_25)) > ((14.0 + x_27) > (12.0 + x_29)? (14.0 + x_27) : (12.0 + x_29))? ((10.0 + x_24) > (16.0 + x_25)? (10.0 + x_24) : (16.0 + x_25)) : ((14.0 + x_27) > (12.0 + x_29)? (14.0 + x_27) : (12.0 + x_29)))? (((17.0 + x_17) > (3.0 + x_19)? (17.0 + x_17) : (3.0 + x_19)) > ((4.0 + x_20) > (19.0 + x_21)? (4.0 + x_20) : (19.0 + x_21))? ((17.0 + x_17) > (3.0 + x_19)? (17.0 + x_17) : (3.0 + x_19)) : ((4.0 + x_20) > (19.0 + x_21)? (4.0 + x_20) : (19.0 + x_21))) : (((10.0 + x_24) > (16.0 + x_25)? (10.0 + x_24) : (16.0 + x_25)) > ((14.0 + x_27) > (12.0 + x_29)? (14.0 + x_27) : (12.0 + x_29))? ((10.0 + x_24) > (16.0 + x_25)? (10.0 + x_24) : (16.0 + x_25)) : ((14.0 + x_27) > (12.0 + x_29)? (14.0 + x_27) : (12.0 + x_29))))); x_22_ = (((((18.0 + x_0) > (9.0 + x_2)? (18.0 + x_0) : (9.0 + x_2)) > ((9.0 + x_3) > (16.0 + x_4)? (9.0 + x_3) : (16.0 + x_4))? ((18.0 + x_0) > (9.0 + x_2)? (18.0 + x_0) : (9.0 + x_2)) : ((9.0 + x_3) > (16.0 + x_4)? (9.0 + x_3) : (16.0 + x_4))) > (((11.0 + x_5) > (16.0 + x_7)? (11.0 + x_5) : (16.0 + x_7)) > ((17.0 + x_9) > (2.0 + x_11)? (17.0 + x_9) : (2.0 + x_11))? ((11.0 + x_5) > (16.0 + x_7)? (11.0 + x_5) : (16.0 + x_7)) : ((17.0 + x_9) > (2.0 + x_11)? (17.0 + x_9) : (2.0 + x_11)))? (((18.0 + x_0) > (9.0 + x_2)? (18.0 + x_0) : (9.0 + x_2)) > ((9.0 + x_3) > (16.0 + x_4)? (9.0 + x_3) : (16.0 + x_4))? ((18.0 + x_0) > (9.0 + x_2)? (18.0 + x_0) : (9.0 + x_2)) : ((9.0 + x_3) > (16.0 + x_4)? (9.0 + x_3) : (16.0 + x_4))) : (((11.0 + x_5) > (16.0 + x_7)? (11.0 + x_5) : (16.0 + x_7)) > ((17.0 + x_9) > (2.0 + x_11)? (17.0 + x_9) : (2.0 + x_11))? ((11.0 + x_5) > (16.0 + x_7)? (11.0 + x_5) : (16.0 + x_7)) : ((17.0 + x_9) > (2.0 + x_11)? (17.0 + x_9) : (2.0 + x_11)))) > ((((16.0 + x_18) > (10.0 + x_21)? (16.0 + x_18) : (10.0 + x_21)) > ((5.0 + x_22) > (6.0 + x_26)? (5.0 + x_22) : (6.0 + x_26))? ((16.0 + x_18) > (10.0 + x_21)? (16.0 + x_18) : (10.0 + x_21)) : ((5.0 + x_22) > (6.0 + x_26)? (5.0 + x_22) : (6.0 + x_26))) > (((7.0 + x_27) > (15.0 + x_29)? (7.0 + x_27) : (15.0 + x_29)) > ((16.0 + x_30) > (5.0 + x_31)? (16.0 + x_30) : (5.0 + x_31))? ((7.0 + x_27) > (15.0 + x_29)? (7.0 + x_27) : (15.0 + x_29)) : ((16.0 + x_30) > (5.0 + x_31)? (16.0 + x_30) : (5.0 + x_31)))? (((16.0 + x_18) > (10.0 + x_21)? (16.0 + x_18) : (10.0 + x_21)) > ((5.0 + x_22) > (6.0 + x_26)? (5.0 + x_22) : (6.0 + x_26))? ((16.0 + x_18) > (10.0 + x_21)? (16.0 + x_18) : (10.0 + x_21)) : ((5.0 + x_22) > (6.0 + x_26)? (5.0 + x_22) : (6.0 + x_26))) : (((7.0 + x_27) > (15.0 + x_29)? (7.0 + x_27) : (15.0 + x_29)) > ((16.0 + x_30) > (5.0 + x_31)? (16.0 + x_30) : (5.0 + x_31))? ((7.0 + x_27) > (15.0 + x_29)? (7.0 + x_27) : (15.0 + x_29)) : ((16.0 + x_30) > (5.0 + x_31)? (16.0 + x_30) : (5.0 + x_31))))? ((((18.0 + x_0) > (9.0 + x_2)? (18.0 + x_0) : (9.0 + x_2)) > ((9.0 + x_3) > (16.0 + x_4)? (9.0 + x_3) : (16.0 + x_4))? ((18.0 + x_0) > (9.0 + x_2)? (18.0 + x_0) : (9.0 + x_2)) : ((9.0 + x_3) > (16.0 + x_4)? (9.0 + x_3) : (16.0 + x_4))) > (((11.0 + x_5) > (16.0 + x_7)? (11.0 + x_5) : (16.0 + x_7)) > ((17.0 + x_9) > (2.0 + x_11)? (17.0 + x_9) : (2.0 + x_11))? ((11.0 + x_5) > (16.0 + x_7)? (11.0 + x_5) : (16.0 + x_7)) : ((17.0 + x_9) > (2.0 + x_11)? (17.0 + x_9) : (2.0 + x_11)))? (((18.0 + x_0) > (9.0 + x_2)? (18.0 + x_0) : (9.0 + x_2)) > ((9.0 + x_3) > (16.0 + x_4)? (9.0 + x_3) : (16.0 + x_4))? ((18.0 + x_0) > (9.0 + x_2)? (18.0 + x_0) : (9.0 + x_2)) : ((9.0 + x_3) > (16.0 + x_4)? (9.0 + x_3) : (16.0 + x_4))) : (((11.0 + x_5) > (16.0 + x_7)? (11.0 + x_5) : (16.0 + x_7)) > ((17.0 + x_9) > (2.0 + x_11)? (17.0 + x_9) : (2.0 + x_11))? ((11.0 + x_5) > (16.0 + x_7)? (11.0 + x_5) : (16.0 + x_7)) : ((17.0 + x_9) > (2.0 + x_11)? (17.0 + x_9) : (2.0 + x_11)))) : ((((16.0 + x_18) > (10.0 + x_21)? (16.0 + x_18) : (10.0 + x_21)) > ((5.0 + x_22) > (6.0 + x_26)? (5.0 + x_22) : (6.0 + x_26))? ((16.0 + x_18) > (10.0 + x_21)? (16.0 + x_18) : (10.0 + x_21)) : ((5.0 + x_22) > (6.0 + x_26)? (5.0 + x_22) : (6.0 + x_26))) > (((7.0 + x_27) > (15.0 + x_29)? (7.0 + x_27) : (15.0 + x_29)) > ((16.0 + x_30) > (5.0 + x_31)? (16.0 + x_30) : (5.0 + x_31))? ((7.0 + x_27) > (15.0 + x_29)? (7.0 + x_27) : (15.0 + x_29)) : ((16.0 + x_30) > (5.0 + x_31)? (16.0 + x_30) : (5.0 + x_31)))? (((16.0 + x_18) > (10.0 + x_21)? (16.0 + x_18) : (10.0 + x_21)) > ((5.0 + x_22) > (6.0 + x_26)? (5.0 + x_22) : (6.0 + x_26))? ((16.0 + x_18) > (10.0 + x_21)? (16.0 + x_18) : (10.0 + x_21)) : ((5.0 + x_22) > (6.0 + x_26)? (5.0 + x_22) : (6.0 + x_26))) : (((7.0 + x_27) > (15.0 + x_29)? (7.0 + x_27) : (15.0 + x_29)) > ((16.0 + x_30) > (5.0 + x_31)? (16.0 + x_30) : (5.0 + x_31))? ((7.0 + x_27) > (15.0 + x_29)? (7.0 + x_27) : (15.0 + x_29)) : ((16.0 + x_30) > (5.0 + x_31)? (16.0 + x_30) : (5.0 + x_31))))); x_23_ = (((((3.0 + x_1) > (15.0 + x_2)? (3.0 + x_1) : (15.0 + x_2)) > ((10.0 + x_4) > (16.0 + x_5)? (10.0 + x_4) : (16.0 + x_5))? ((3.0 + x_1) > (15.0 + x_2)? (3.0 + x_1) : (15.0 + x_2)) : ((10.0 + x_4) > (16.0 + x_5)? (10.0 + x_4) : (16.0 + x_5))) > (((13.0 + x_6) > (13.0 + x_9)? (13.0 + x_6) : (13.0 + x_9)) > ((18.0 + x_14) > (17.0 + x_18)? (18.0 + x_14) : (17.0 + x_18))? ((13.0 + x_6) > (13.0 + x_9)? (13.0 + x_6) : (13.0 + x_9)) : ((18.0 + x_14) > (17.0 + x_18)? (18.0 + x_14) : (17.0 + x_18)))? (((3.0 + x_1) > (15.0 + x_2)? (3.0 + x_1) : (15.0 + x_2)) > ((10.0 + x_4) > (16.0 + x_5)? (10.0 + x_4) : (16.0 + x_5))? ((3.0 + x_1) > (15.0 + x_2)? (3.0 + x_1) : (15.0 + x_2)) : ((10.0 + x_4) > (16.0 + x_5)? (10.0 + x_4) : (16.0 + x_5))) : (((13.0 + x_6) > (13.0 + x_9)? (13.0 + x_6) : (13.0 + x_9)) > ((18.0 + x_14) > (17.0 + x_18)? (18.0 + x_14) : (17.0 + x_18))? ((13.0 + x_6) > (13.0 + x_9)? (13.0 + x_6) : (13.0 + x_9)) : ((18.0 + x_14) > (17.0 + x_18)? (18.0 + x_14) : (17.0 + x_18)))) > ((((11.0 + x_19) > (5.0 + x_21)? (11.0 + x_19) : (5.0 + x_21)) > ((8.0 + x_22) > (2.0 + x_25)? (8.0 + x_22) : (2.0 + x_25))? ((11.0 + x_19) > (5.0 + x_21)? (11.0 + x_19) : (5.0 + x_21)) : ((8.0 + x_22) > (2.0 + x_25)? (8.0 + x_22) : (2.0 + x_25))) > (((12.0 + x_26) > (18.0 + x_27)? (12.0 + x_26) : (18.0 + x_27)) > ((17.0 + x_28) > (4.0 + x_31)? (17.0 + x_28) : (4.0 + x_31))? ((12.0 + x_26) > (18.0 + x_27)? (12.0 + x_26) : (18.0 + x_27)) : ((17.0 + x_28) > (4.0 + x_31)? (17.0 + x_28) : (4.0 + x_31)))? (((11.0 + x_19) > (5.0 + x_21)? (11.0 + x_19) : (5.0 + x_21)) > ((8.0 + x_22) > (2.0 + x_25)? (8.0 + x_22) : (2.0 + x_25))? ((11.0 + x_19) > (5.0 + x_21)? (11.0 + x_19) : (5.0 + x_21)) : ((8.0 + x_22) > (2.0 + x_25)? (8.0 + x_22) : (2.0 + x_25))) : (((12.0 + x_26) > (18.0 + x_27)? (12.0 + x_26) : (18.0 + x_27)) > ((17.0 + x_28) > (4.0 + x_31)? (17.0 + x_28) : (4.0 + x_31))? ((12.0 + x_26) > (18.0 + x_27)? (12.0 + x_26) : (18.0 + x_27)) : ((17.0 + x_28) > (4.0 + x_31)? (17.0 + x_28) : (4.0 + x_31))))? ((((3.0 + x_1) > (15.0 + x_2)? (3.0 + x_1) : (15.0 + x_2)) > ((10.0 + x_4) > (16.0 + x_5)? (10.0 + x_4) : (16.0 + x_5))? ((3.0 + x_1) > (15.0 + x_2)? (3.0 + x_1) : (15.0 + x_2)) : ((10.0 + x_4) > (16.0 + x_5)? (10.0 + x_4) : (16.0 + x_5))) > (((13.0 + x_6) > (13.0 + x_9)? (13.0 + x_6) : (13.0 + x_9)) > ((18.0 + x_14) > (17.0 + x_18)? (18.0 + x_14) : (17.0 + x_18))? ((13.0 + x_6) > (13.0 + x_9)? (13.0 + x_6) : (13.0 + x_9)) : ((18.0 + x_14) > (17.0 + x_18)? (18.0 + x_14) : (17.0 + x_18)))? (((3.0 + x_1) > (15.0 + x_2)? (3.0 + x_1) : (15.0 + x_2)) > ((10.0 + x_4) > (16.0 + x_5)? (10.0 + x_4) : (16.0 + x_5))? ((3.0 + x_1) > (15.0 + x_2)? (3.0 + x_1) : (15.0 + x_2)) : ((10.0 + x_4) > (16.0 + x_5)? (10.0 + x_4) : (16.0 + x_5))) : (((13.0 + x_6) > (13.0 + x_9)? (13.0 + x_6) : (13.0 + x_9)) > ((18.0 + x_14) > (17.0 + x_18)? (18.0 + x_14) : (17.0 + x_18))? ((13.0 + x_6) > (13.0 + x_9)? (13.0 + x_6) : (13.0 + x_9)) : ((18.0 + x_14) > (17.0 + x_18)? (18.0 + x_14) : (17.0 + x_18)))) : ((((11.0 + x_19) > (5.0 + x_21)? (11.0 + x_19) : (5.0 + x_21)) > ((8.0 + x_22) > (2.0 + x_25)? (8.0 + x_22) : (2.0 + x_25))? ((11.0 + x_19) > (5.0 + x_21)? (11.0 + x_19) : (5.0 + x_21)) : ((8.0 + x_22) > (2.0 + x_25)? (8.0 + x_22) : (2.0 + x_25))) > (((12.0 + x_26) > (18.0 + x_27)? (12.0 + x_26) : (18.0 + x_27)) > ((17.0 + x_28) > (4.0 + x_31)? (17.0 + x_28) : (4.0 + x_31))? ((12.0 + x_26) > (18.0 + x_27)? (12.0 + x_26) : (18.0 + x_27)) : ((17.0 + x_28) > (4.0 + x_31)? (17.0 + x_28) : (4.0 + x_31)))? (((11.0 + x_19) > (5.0 + x_21)? (11.0 + x_19) : (5.0 + x_21)) > ((8.0 + x_22) > (2.0 + x_25)? (8.0 + x_22) : (2.0 + x_25))? ((11.0 + x_19) > (5.0 + x_21)? (11.0 + x_19) : (5.0 + x_21)) : ((8.0 + x_22) > (2.0 + x_25)? (8.0 + x_22) : (2.0 + x_25))) : (((12.0 + x_26) > (18.0 + x_27)? (12.0 + x_26) : (18.0 + x_27)) > ((17.0 + x_28) > (4.0 + x_31)? (17.0 + x_28) : (4.0 + x_31))? ((12.0 + x_26) > (18.0 + x_27)? (12.0 + x_26) : (18.0 + x_27)) : ((17.0 + x_28) > (4.0 + x_31)? (17.0 + x_28) : (4.0 + x_31))))); x_24_ = (((((11.0 + x_1) > (14.0 + x_2)? (11.0 + x_1) : (14.0 + x_2)) > ((19.0 + x_3) > (11.0 + x_4)? (19.0 + x_3) : (11.0 + x_4))? ((11.0 + x_1) > (14.0 + x_2)? (11.0 + x_1) : (14.0 + x_2)) : ((19.0 + x_3) > (11.0 + x_4)? (19.0 + x_3) : (11.0 + x_4))) > (((8.0 + x_10) > (12.0 + x_12)? (8.0 + x_10) : (12.0 + x_12)) > ((11.0 + x_14) > (6.0 + x_15)? (11.0 + x_14) : (6.0 + x_15))? ((8.0 + x_10) > (12.0 + x_12)? (8.0 + x_10) : (12.0 + x_12)) : ((11.0 + x_14) > (6.0 + x_15)? (11.0 + x_14) : (6.0 + x_15)))? (((11.0 + x_1) > (14.0 + x_2)? (11.0 + x_1) : (14.0 + x_2)) > ((19.0 + x_3) > (11.0 + x_4)? (19.0 + x_3) : (11.0 + x_4))? ((11.0 + x_1) > (14.0 + x_2)? (11.0 + x_1) : (14.0 + x_2)) : ((19.0 + x_3) > (11.0 + x_4)? (19.0 + x_3) : (11.0 + x_4))) : (((8.0 + x_10) > (12.0 + x_12)? (8.0 + x_10) : (12.0 + x_12)) > ((11.0 + x_14) > (6.0 + x_15)? (11.0 + x_14) : (6.0 + x_15))? ((8.0 + x_10) > (12.0 + x_12)? (8.0 + x_10) : (12.0 + x_12)) : ((11.0 + x_14) > (6.0 + x_15)? (11.0 + x_14) : (6.0 + x_15)))) > ((((20.0 + x_17) > (2.0 + x_20)? (20.0 + x_17) : (2.0 + x_20)) > ((11.0 + x_21) > (7.0 + x_22)? (11.0 + x_21) : (7.0 + x_22))? ((20.0 + x_17) > (2.0 + x_20)? (20.0 + x_17) : (2.0 + x_20)) : ((11.0 + x_21) > (7.0 + x_22)? (11.0 + x_21) : (7.0 + x_22))) > (((2.0 + x_25) > (11.0 + x_28)? (2.0 + x_25) : (11.0 + x_28)) > ((16.0 + x_29) > (1.0 + x_30)? (16.0 + x_29) : (1.0 + x_30))? ((2.0 + x_25) > (11.0 + x_28)? (2.0 + x_25) : (11.0 + x_28)) : ((16.0 + x_29) > (1.0 + x_30)? (16.0 + x_29) : (1.0 + x_30)))? (((20.0 + x_17) > (2.0 + x_20)? (20.0 + x_17) : (2.0 + x_20)) > ((11.0 + x_21) > (7.0 + x_22)? (11.0 + x_21) : (7.0 + x_22))? ((20.0 + x_17) > (2.0 + x_20)? (20.0 + x_17) : (2.0 + x_20)) : ((11.0 + x_21) > (7.0 + x_22)? (11.0 + x_21) : (7.0 + x_22))) : (((2.0 + x_25) > (11.0 + x_28)? (2.0 + x_25) : (11.0 + x_28)) > ((16.0 + x_29) > (1.0 + x_30)? (16.0 + x_29) : (1.0 + x_30))? ((2.0 + x_25) > (11.0 + x_28)? (2.0 + x_25) : (11.0 + x_28)) : ((16.0 + x_29) > (1.0 + x_30)? (16.0 + x_29) : (1.0 + x_30))))? ((((11.0 + x_1) > (14.0 + x_2)? (11.0 + x_1) : (14.0 + x_2)) > ((19.0 + x_3) > (11.0 + x_4)? (19.0 + x_3) : (11.0 + x_4))? ((11.0 + x_1) > (14.0 + x_2)? (11.0 + x_1) : (14.0 + x_2)) : ((19.0 + x_3) > (11.0 + x_4)? (19.0 + x_3) : (11.0 + x_4))) > (((8.0 + x_10) > (12.0 + x_12)? (8.0 + x_10) : (12.0 + x_12)) > ((11.0 + x_14) > (6.0 + x_15)? (11.0 + x_14) : (6.0 + x_15))? ((8.0 + x_10) > (12.0 + x_12)? (8.0 + x_10) : (12.0 + x_12)) : ((11.0 + x_14) > (6.0 + x_15)? (11.0 + x_14) : (6.0 + x_15)))? (((11.0 + x_1) > (14.0 + x_2)? (11.0 + x_1) : (14.0 + x_2)) > ((19.0 + x_3) > (11.0 + x_4)? (19.0 + x_3) : (11.0 + x_4))? ((11.0 + x_1) > (14.0 + x_2)? (11.0 + x_1) : (14.0 + x_2)) : ((19.0 + x_3) > (11.0 + x_4)? (19.0 + x_3) : (11.0 + x_4))) : (((8.0 + x_10) > (12.0 + x_12)? (8.0 + x_10) : (12.0 + x_12)) > ((11.0 + x_14) > (6.0 + x_15)? (11.0 + x_14) : (6.0 + x_15))? ((8.0 + x_10) > (12.0 + x_12)? (8.0 + x_10) : (12.0 + x_12)) : ((11.0 + x_14) > (6.0 + x_15)? (11.0 + x_14) : (6.0 + x_15)))) : ((((20.0 + x_17) > (2.0 + x_20)? (20.0 + x_17) : (2.0 + x_20)) > ((11.0 + x_21) > (7.0 + x_22)? (11.0 + x_21) : (7.0 + x_22))? ((20.0 + x_17) > (2.0 + x_20)? (20.0 + x_17) : (2.0 + x_20)) : ((11.0 + x_21) > (7.0 + x_22)? (11.0 + x_21) : (7.0 + x_22))) > (((2.0 + x_25) > (11.0 + x_28)? (2.0 + x_25) : (11.0 + x_28)) > ((16.0 + x_29) > (1.0 + x_30)? (16.0 + x_29) : (1.0 + x_30))? ((2.0 + x_25) > (11.0 + x_28)? (2.0 + x_25) : (11.0 + x_28)) : ((16.0 + x_29) > (1.0 + x_30)? (16.0 + x_29) : (1.0 + x_30)))? (((20.0 + x_17) > (2.0 + x_20)? (20.0 + x_17) : (2.0 + x_20)) > ((11.0 + x_21) > (7.0 + x_22)? (11.0 + x_21) : (7.0 + x_22))? ((20.0 + x_17) > (2.0 + x_20)? (20.0 + x_17) : (2.0 + x_20)) : ((11.0 + x_21) > (7.0 + x_22)? (11.0 + x_21) : (7.0 + x_22))) : (((2.0 + x_25) > (11.0 + x_28)? (2.0 + x_25) : (11.0 + x_28)) > ((16.0 + x_29) > (1.0 + x_30)? (16.0 + x_29) : (1.0 + x_30))? ((2.0 + x_25) > (11.0 + x_28)? (2.0 + x_25) : (11.0 + x_28)) : ((16.0 + x_29) > (1.0 + x_30)? (16.0 + x_29) : (1.0 + x_30))))); x_25_ = (((((1.0 + x_0) > (18.0 + x_2)? (1.0 + x_0) : (18.0 + x_2)) > ((2.0 + x_9) > (3.0 + x_10)? (2.0 + x_9) : (3.0 + x_10))? ((1.0 + x_0) > (18.0 + x_2)? (1.0 + x_0) : (18.0 + x_2)) : ((2.0 + x_9) > (3.0 + x_10)? (2.0 + x_9) : (3.0 + x_10))) > (((17.0 + x_11) > (5.0 + x_12)? (17.0 + x_11) : (5.0 + x_12)) > ((8.0 + x_13) > (3.0 + x_14)? (8.0 + x_13) : (3.0 + x_14))? ((17.0 + x_11) > (5.0 + x_12)? (17.0 + x_11) : (5.0 + x_12)) : ((8.0 + x_13) > (3.0 + x_14)? (8.0 + x_13) : (3.0 + x_14)))? (((1.0 + x_0) > (18.0 + x_2)? (1.0 + x_0) : (18.0 + x_2)) > ((2.0 + x_9) > (3.0 + x_10)? (2.0 + x_9) : (3.0 + x_10))? ((1.0 + x_0) > (18.0 + x_2)? (1.0 + x_0) : (18.0 + x_2)) : ((2.0 + x_9) > (3.0 + x_10)? (2.0 + x_9) : (3.0 + x_10))) : (((17.0 + x_11) > (5.0 + x_12)? (17.0 + x_11) : (5.0 + x_12)) > ((8.0 + x_13) > (3.0 + x_14)? (8.0 + x_13) : (3.0 + x_14))? ((17.0 + x_11) > (5.0 + x_12)? (17.0 + x_11) : (5.0 + x_12)) : ((8.0 + x_13) > (3.0 + x_14)? (8.0 + x_13) : (3.0 + x_14)))) > ((((13.0 + x_18) > (9.0 + x_19)? (13.0 + x_18) : (9.0 + x_19)) > ((15.0 + x_20) > (18.0 + x_22)? (15.0 + x_20) : (18.0 + x_22))? ((13.0 + x_18) > (9.0 + x_19)? (13.0 + x_18) : (9.0 + x_19)) : ((15.0 + x_20) > (18.0 + x_22)? (15.0 + x_20) : (18.0 + x_22))) > (((13.0 + x_23) > (19.0 + x_25)? (13.0 + x_23) : (19.0 + x_25)) > ((11.0 + x_29) > (7.0 + x_30)? (11.0 + x_29) : (7.0 + x_30))? ((13.0 + x_23) > (19.0 + x_25)? (13.0 + x_23) : (19.0 + x_25)) : ((11.0 + x_29) > (7.0 + x_30)? (11.0 + x_29) : (7.0 + x_30)))? (((13.0 + x_18) > (9.0 + x_19)? (13.0 + x_18) : (9.0 + x_19)) > ((15.0 + x_20) > (18.0 + x_22)? (15.0 + x_20) : (18.0 + x_22))? ((13.0 + x_18) > (9.0 + x_19)? (13.0 + x_18) : (9.0 + x_19)) : ((15.0 + x_20) > (18.0 + x_22)? (15.0 + x_20) : (18.0 + x_22))) : (((13.0 + x_23) > (19.0 + x_25)? (13.0 + x_23) : (19.0 + x_25)) > ((11.0 + x_29) > (7.0 + x_30)? (11.0 + x_29) : (7.0 + x_30))? ((13.0 + x_23) > (19.0 + x_25)? (13.0 + x_23) : (19.0 + x_25)) : ((11.0 + x_29) > (7.0 + x_30)? (11.0 + x_29) : (7.0 + x_30))))? ((((1.0 + x_0) > (18.0 + x_2)? (1.0 + x_0) : (18.0 + x_2)) > ((2.0 + x_9) > (3.0 + x_10)? (2.0 + x_9) : (3.0 + x_10))? ((1.0 + x_0) > (18.0 + x_2)? (1.0 + x_0) : (18.0 + x_2)) : ((2.0 + x_9) > (3.0 + x_10)? (2.0 + x_9) : (3.0 + x_10))) > (((17.0 + x_11) > (5.0 + x_12)? (17.0 + x_11) : (5.0 + x_12)) > ((8.0 + x_13) > (3.0 + x_14)? (8.0 + x_13) : (3.0 + x_14))? ((17.0 + x_11) > (5.0 + x_12)? (17.0 + x_11) : (5.0 + x_12)) : ((8.0 + x_13) > (3.0 + x_14)? (8.0 + x_13) : (3.0 + x_14)))? (((1.0 + x_0) > (18.0 + x_2)? (1.0 + x_0) : (18.0 + x_2)) > ((2.0 + x_9) > (3.0 + x_10)? (2.0 + x_9) : (3.0 + x_10))? ((1.0 + x_0) > (18.0 + x_2)? (1.0 + x_0) : (18.0 + x_2)) : ((2.0 + x_9) > (3.0 + x_10)? (2.0 + x_9) : (3.0 + x_10))) : (((17.0 + x_11) > (5.0 + x_12)? (17.0 + x_11) : (5.0 + x_12)) > ((8.0 + x_13) > (3.0 + x_14)? (8.0 + x_13) : (3.0 + x_14))? ((17.0 + x_11) > (5.0 + x_12)? (17.0 + x_11) : (5.0 + x_12)) : ((8.0 + x_13) > (3.0 + x_14)? (8.0 + x_13) : (3.0 + x_14)))) : ((((13.0 + x_18) > (9.0 + x_19)? (13.0 + x_18) : (9.0 + x_19)) > ((15.0 + x_20) > (18.0 + x_22)? (15.0 + x_20) : (18.0 + x_22))? ((13.0 + x_18) > (9.0 + x_19)? (13.0 + x_18) : (9.0 + x_19)) : ((15.0 + x_20) > (18.0 + x_22)? (15.0 + x_20) : (18.0 + x_22))) > (((13.0 + x_23) > (19.0 + x_25)? (13.0 + x_23) : (19.0 + x_25)) > ((11.0 + x_29) > (7.0 + x_30)? (11.0 + x_29) : (7.0 + x_30))? ((13.0 + x_23) > (19.0 + x_25)? (13.0 + x_23) : (19.0 + x_25)) : ((11.0 + x_29) > (7.0 + x_30)? (11.0 + x_29) : (7.0 + x_30)))? (((13.0 + x_18) > (9.0 + x_19)? (13.0 + x_18) : (9.0 + x_19)) > ((15.0 + x_20) > (18.0 + x_22)? (15.0 + x_20) : (18.0 + x_22))? ((13.0 + x_18) > (9.0 + x_19)? (13.0 + x_18) : (9.0 + x_19)) : ((15.0 + x_20) > (18.0 + x_22)? (15.0 + x_20) : (18.0 + x_22))) : (((13.0 + x_23) > (19.0 + x_25)? (13.0 + x_23) : (19.0 + x_25)) > ((11.0 + x_29) > (7.0 + x_30)? (11.0 + x_29) : (7.0 + x_30))? ((13.0 + x_23) > (19.0 + x_25)? (13.0 + x_23) : (19.0 + x_25)) : ((11.0 + x_29) > (7.0 + x_30)? (11.0 + x_29) : (7.0 + x_30))))); x_26_ = (((((6.0 + x_0) > (15.0 + x_2)? (6.0 + x_0) : (15.0 + x_2)) > ((1.0 + x_4) > (17.0 + x_6)? (1.0 + x_4) : (17.0 + x_6))? ((6.0 + x_0) > (15.0 + x_2)? (6.0 + x_0) : (15.0 + x_2)) : ((1.0 + x_4) > (17.0 + x_6)? (1.0 + x_4) : (17.0 + x_6))) > (((16.0 + x_7) > (1.0 + x_8)? (16.0 + x_7) : (1.0 + x_8)) > ((20.0 + x_9) > (20.0 + x_11)? (20.0 + x_9) : (20.0 + x_11))? ((16.0 + x_7) > (1.0 + x_8)? (16.0 + x_7) : (1.0 + x_8)) : ((20.0 + x_9) > (20.0 + x_11)? (20.0 + x_9) : (20.0 + x_11)))? (((6.0 + x_0) > (15.0 + x_2)? (6.0 + x_0) : (15.0 + x_2)) > ((1.0 + x_4) > (17.0 + x_6)? (1.0 + x_4) : (17.0 + x_6))? ((6.0 + x_0) > (15.0 + x_2)? (6.0 + x_0) : (15.0 + x_2)) : ((1.0 + x_4) > (17.0 + x_6)? (1.0 + x_4) : (17.0 + x_6))) : (((16.0 + x_7) > (1.0 + x_8)? (16.0 + x_7) : (1.0 + x_8)) > ((20.0 + x_9) > (20.0 + x_11)? (20.0 + x_9) : (20.0 + x_11))? ((16.0 + x_7) > (1.0 + x_8)? (16.0 + x_7) : (1.0 + x_8)) : ((20.0 + x_9) > (20.0 + x_11)? (20.0 + x_9) : (20.0 + x_11)))) > ((((12.0 + x_13) > (4.0 + x_17)? (12.0 + x_13) : (4.0 + x_17)) > ((14.0 + x_18) > (15.0 + x_21)? (14.0 + x_18) : (15.0 + x_21))? ((12.0 + x_13) > (4.0 + x_17)? (12.0 + x_13) : (4.0 + x_17)) : ((14.0 + x_18) > (15.0 + x_21)? (14.0 + x_18) : (15.0 + x_21))) > (((11.0 + x_24) > (16.0 + x_26)? (11.0 + x_24) : (16.0 + x_26)) > ((15.0 + x_28) > (14.0 + x_29)? (15.0 + x_28) : (14.0 + x_29))? ((11.0 + x_24) > (16.0 + x_26)? (11.0 + x_24) : (16.0 + x_26)) : ((15.0 + x_28) > (14.0 + x_29)? (15.0 + x_28) : (14.0 + x_29)))? (((12.0 + x_13) > (4.0 + x_17)? (12.0 + x_13) : (4.0 + x_17)) > ((14.0 + x_18) > (15.0 + x_21)? (14.0 + x_18) : (15.0 + x_21))? ((12.0 + x_13) > (4.0 + x_17)? (12.0 + x_13) : (4.0 + x_17)) : ((14.0 + x_18) > (15.0 + x_21)? (14.0 + x_18) : (15.0 + x_21))) : (((11.0 + x_24) > (16.0 + x_26)? (11.0 + x_24) : (16.0 + x_26)) > ((15.0 + x_28) > (14.0 + x_29)? (15.0 + x_28) : (14.0 + x_29))? ((11.0 + x_24) > (16.0 + x_26)? (11.0 + x_24) : (16.0 + x_26)) : ((15.0 + x_28) > (14.0 + x_29)? (15.0 + x_28) : (14.0 + x_29))))? ((((6.0 + x_0) > (15.0 + x_2)? (6.0 + x_0) : (15.0 + x_2)) > ((1.0 + x_4) > (17.0 + x_6)? (1.0 + x_4) : (17.0 + x_6))? ((6.0 + x_0) > (15.0 + x_2)? (6.0 + x_0) : (15.0 + x_2)) : ((1.0 + x_4) > (17.0 + x_6)? (1.0 + x_4) : (17.0 + x_6))) > (((16.0 + x_7) > (1.0 + x_8)? (16.0 + x_7) : (1.0 + x_8)) > ((20.0 + x_9) > (20.0 + x_11)? (20.0 + x_9) : (20.0 + x_11))? ((16.0 + x_7) > (1.0 + x_8)? (16.0 + x_7) : (1.0 + x_8)) : ((20.0 + x_9) > (20.0 + x_11)? (20.0 + x_9) : (20.0 + x_11)))? (((6.0 + x_0) > (15.0 + x_2)? (6.0 + x_0) : (15.0 + x_2)) > ((1.0 + x_4) > (17.0 + x_6)? (1.0 + x_4) : (17.0 + x_6))? ((6.0 + x_0) > (15.0 + x_2)? (6.0 + x_0) : (15.0 + x_2)) : ((1.0 + x_4) > (17.0 + x_6)? (1.0 + x_4) : (17.0 + x_6))) : (((16.0 + x_7) > (1.0 + x_8)? (16.0 + x_7) : (1.0 + x_8)) > ((20.0 + x_9) > (20.0 + x_11)? (20.0 + x_9) : (20.0 + x_11))? ((16.0 + x_7) > (1.0 + x_8)? (16.0 + x_7) : (1.0 + x_8)) : ((20.0 + x_9) > (20.0 + x_11)? (20.0 + x_9) : (20.0 + x_11)))) : ((((12.0 + x_13) > (4.0 + x_17)? (12.0 + x_13) : (4.0 + x_17)) > ((14.0 + x_18) > (15.0 + x_21)? (14.0 + x_18) : (15.0 + x_21))? ((12.0 + x_13) > (4.0 + x_17)? (12.0 + x_13) : (4.0 + x_17)) : ((14.0 + x_18) > (15.0 + x_21)? (14.0 + x_18) : (15.0 + x_21))) > (((11.0 + x_24) > (16.0 + x_26)? (11.0 + x_24) : (16.0 + x_26)) > ((15.0 + x_28) > (14.0 + x_29)? (15.0 + x_28) : (14.0 + x_29))? ((11.0 + x_24) > (16.0 + x_26)? (11.0 + x_24) : (16.0 + x_26)) : ((15.0 + x_28) > (14.0 + x_29)? (15.0 + x_28) : (14.0 + x_29)))? (((12.0 + x_13) > (4.0 + x_17)? (12.0 + x_13) : (4.0 + x_17)) > ((14.0 + x_18) > (15.0 + x_21)? (14.0 + x_18) : (15.0 + x_21))? ((12.0 + x_13) > (4.0 + x_17)? (12.0 + x_13) : (4.0 + x_17)) : ((14.0 + x_18) > (15.0 + x_21)? (14.0 + x_18) : (15.0 + x_21))) : (((11.0 + x_24) > (16.0 + x_26)? (11.0 + x_24) : (16.0 + x_26)) > ((15.0 + x_28) > (14.0 + x_29)? (15.0 + x_28) : (14.0 + x_29))? ((11.0 + x_24) > (16.0 + x_26)? (11.0 + x_24) : (16.0 + x_26)) : ((15.0 + x_28) > (14.0 + x_29)? (15.0 + x_28) : (14.0 + x_29))))); x_27_ = (((((12.0 + x_0) > (18.0 + x_2)? (12.0 + x_0) : (18.0 + x_2)) > ((14.0 + x_5) > (12.0 + x_6)? (14.0 + x_5) : (12.0 + x_6))? ((12.0 + x_0) > (18.0 + x_2)? (12.0 + x_0) : (18.0 + x_2)) : ((14.0 + x_5) > (12.0 + x_6)? (14.0 + x_5) : (12.0 + x_6))) > (((19.0 + x_8) > (18.0 + x_10)? (19.0 + x_8) : (18.0 + x_10)) > ((19.0 + x_12) > (15.0 + x_14)? (19.0 + x_12) : (15.0 + x_14))? ((19.0 + x_8) > (18.0 + x_10)? (19.0 + x_8) : (18.0 + x_10)) : ((19.0 + x_12) > (15.0 + x_14)? (19.0 + x_12) : (15.0 + x_14)))? (((12.0 + x_0) > (18.0 + x_2)? (12.0 + x_0) : (18.0 + x_2)) > ((14.0 + x_5) > (12.0 + x_6)? (14.0 + x_5) : (12.0 + x_6))? ((12.0 + x_0) > (18.0 + x_2)? (12.0 + x_0) : (18.0 + x_2)) : ((14.0 + x_5) > (12.0 + x_6)? (14.0 + x_5) : (12.0 + x_6))) : (((19.0 + x_8) > (18.0 + x_10)? (19.0 + x_8) : (18.0 + x_10)) > ((19.0 + x_12) > (15.0 + x_14)? (19.0 + x_12) : (15.0 + x_14))? ((19.0 + x_8) > (18.0 + x_10)? (19.0 + x_8) : (18.0 + x_10)) : ((19.0 + x_12) > (15.0 + x_14)? (19.0 + x_12) : (15.0 + x_14)))) > ((((3.0 + x_15) > (7.0 + x_20)? (3.0 + x_15) : (7.0 + x_20)) > ((1.0 + x_24) > (12.0 + x_26)? (1.0 + x_24) : (12.0 + x_26))? ((3.0 + x_15) > (7.0 + x_20)? (3.0 + x_15) : (7.0 + x_20)) : ((1.0 + x_24) > (12.0 + x_26)? (1.0 + x_24) : (12.0 + x_26))) > (((17.0 + x_27) > (17.0 + x_28)? (17.0 + x_27) : (17.0 + x_28)) > ((14.0 + x_29) > (6.0 + x_30)? (14.0 + x_29) : (6.0 + x_30))? ((17.0 + x_27) > (17.0 + x_28)? (17.0 + x_27) : (17.0 + x_28)) : ((14.0 + x_29) > (6.0 + x_30)? (14.0 + x_29) : (6.0 + x_30)))? (((3.0 + x_15) > (7.0 + x_20)? (3.0 + x_15) : (7.0 + x_20)) > ((1.0 + x_24) > (12.0 + x_26)? (1.0 + x_24) : (12.0 + x_26))? ((3.0 + x_15) > (7.0 + x_20)? (3.0 + x_15) : (7.0 + x_20)) : ((1.0 + x_24) > (12.0 + x_26)? (1.0 + x_24) : (12.0 + x_26))) : (((17.0 + x_27) > (17.0 + x_28)? (17.0 + x_27) : (17.0 + x_28)) > ((14.0 + x_29) > (6.0 + x_30)? (14.0 + x_29) : (6.0 + x_30))? ((17.0 + x_27) > (17.0 + x_28)? (17.0 + x_27) : (17.0 + x_28)) : ((14.0 + x_29) > (6.0 + x_30)? (14.0 + x_29) : (6.0 + x_30))))? ((((12.0 + x_0) > (18.0 + x_2)? (12.0 + x_0) : (18.0 + x_2)) > ((14.0 + x_5) > (12.0 + x_6)? (14.0 + x_5) : (12.0 + x_6))? ((12.0 + x_0) > (18.0 + x_2)? (12.0 + x_0) : (18.0 + x_2)) : ((14.0 + x_5) > (12.0 + x_6)? (14.0 + x_5) : (12.0 + x_6))) > (((19.0 + x_8) > (18.0 + x_10)? (19.0 + x_8) : (18.0 + x_10)) > ((19.0 + x_12) > (15.0 + x_14)? (19.0 + x_12) : (15.0 + x_14))? ((19.0 + x_8) > (18.0 + x_10)? (19.0 + x_8) : (18.0 + x_10)) : ((19.0 + x_12) > (15.0 + x_14)? (19.0 + x_12) : (15.0 + x_14)))? (((12.0 + x_0) > (18.0 + x_2)? (12.0 + x_0) : (18.0 + x_2)) > ((14.0 + x_5) > (12.0 + x_6)? (14.0 + x_5) : (12.0 + x_6))? ((12.0 + x_0) > (18.0 + x_2)? (12.0 + x_0) : (18.0 + x_2)) : ((14.0 + x_5) > (12.0 + x_6)? (14.0 + x_5) : (12.0 + x_6))) : (((19.0 + x_8) > (18.0 + x_10)? (19.0 + x_8) : (18.0 + x_10)) > ((19.0 + x_12) > (15.0 + x_14)? (19.0 + x_12) : (15.0 + x_14))? ((19.0 + x_8) > (18.0 + x_10)? (19.0 + x_8) : (18.0 + x_10)) : ((19.0 + x_12) > (15.0 + x_14)? (19.0 + x_12) : (15.0 + x_14)))) : ((((3.0 + x_15) > (7.0 + x_20)? (3.0 + x_15) : (7.0 + x_20)) > ((1.0 + x_24) > (12.0 + x_26)? (1.0 + x_24) : (12.0 + x_26))? ((3.0 + x_15) > (7.0 + x_20)? (3.0 + x_15) : (7.0 + x_20)) : ((1.0 + x_24) > (12.0 + x_26)? (1.0 + x_24) : (12.0 + x_26))) > (((17.0 + x_27) > (17.0 + x_28)? (17.0 + x_27) : (17.0 + x_28)) > ((14.0 + x_29) > (6.0 + x_30)? (14.0 + x_29) : (6.0 + x_30))? ((17.0 + x_27) > (17.0 + x_28)? (17.0 + x_27) : (17.0 + x_28)) : ((14.0 + x_29) > (6.0 + x_30)? (14.0 + x_29) : (6.0 + x_30)))? (((3.0 + x_15) > (7.0 + x_20)? (3.0 + x_15) : (7.0 + x_20)) > ((1.0 + x_24) > (12.0 + x_26)? (1.0 + x_24) : (12.0 + x_26))? ((3.0 + x_15) > (7.0 + x_20)? (3.0 + x_15) : (7.0 + x_20)) : ((1.0 + x_24) > (12.0 + x_26)? (1.0 + x_24) : (12.0 + x_26))) : (((17.0 + x_27) > (17.0 + x_28)? (17.0 + x_27) : (17.0 + x_28)) > ((14.0 + x_29) > (6.0 + x_30)? (14.0 + x_29) : (6.0 + x_30))? ((17.0 + x_27) > (17.0 + x_28)? (17.0 + x_27) : (17.0 + x_28)) : ((14.0 + x_29) > (6.0 + x_30)? (14.0 + x_29) : (6.0 + x_30))))); x_28_ = (((((16.0 + x_2) > (5.0 + x_3)? (16.0 + x_2) : (5.0 + x_3)) > ((17.0 + x_4) > (4.0 + x_6)? (17.0 + x_4) : (4.0 + x_6))? ((16.0 + x_2) > (5.0 + x_3)? (16.0 + x_2) : (5.0 + x_3)) : ((17.0 + x_4) > (4.0 + x_6)? (17.0 + x_4) : (4.0 + x_6))) > (((1.0 + x_8) > (11.0 + x_9)? (1.0 + x_8) : (11.0 + x_9)) > ((7.0 + x_13) > (8.0 + x_17)? (7.0 + x_13) : (8.0 + x_17))? ((1.0 + x_8) > (11.0 + x_9)? (1.0 + x_8) : (11.0 + x_9)) : ((7.0 + x_13) > (8.0 + x_17)? (7.0 + x_13) : (8.0 + x_17)))? (((16.0 + x_2) > (5.0 + x_3)? (16.0 + x_2) : (5.0 + x_3)) > ((17.0 + x_4) > (4.0 + x_6)? (17.0 + x_4) : (4.0 + x_6))? ((16.0 + x_2) > (5.0 + x_3)? (16.0 + x_2) : (5.0 + x_3)) : ((17.0 + x_4) > (4.0 + x_6)? (17.0 + x_4) : (4.0 + x_6))) : (((1.0 + x_8) > (11.0 + x_9)? (1.0 + x_8) : (11.0 + x_9)) > ((7.0 + x_13) > (8.0 + x_17)? (7.0 + x_13) : (8.0 + x_17))? ((1.0 + x_8) > (11.0 + x_9)? (1.0 + x_8) : (11.0 + x_9)) : ((7.0 + x_13) > (8.0 + x_17)? (7.0 + x_13) : (8.0 + x_17)))) > ((((14.0 + x_18) > (10.0 + x_20)? (14.0 + x_18) : (10.0 + x_20)) > ((12.0 + x_21) > (19.0 + x_23)? (12.0 + x_21) : (19.0 + x_23))? ((14.0 + x_18) > (10.0 + x_20)? (14.0 + x_18) : (10.0 + x_20)) : ((12.0 + x_21) > (19.0 + x_23)? (12.0 + x_21) : (19.0 + x_23))) > (((5.0 + x_25) > (16.0 + x_27)? (5.0 + x_25) : (16.0 + x_27)) > ((4.0 + x_29) > (5.0 + x_31)? (4.0 + x_29) : (5.0 + x_31))? ((5.0 + x_25) > (16.0 + x_27)? (5.0 + x_25) : (16.0 + x_27)) : ((4.0 + x_29) > (5.0 + x_31)? (4.0 + x_29) : (5.0 + x_31)))? (((14.0 + x_18) > (10.0 + x_20)? (14.0 + x_18) : (10.0 + x_20)) > ((12.0 + x_21) > (19.0 + x_23)? (12.0 + x_21) : (19.0 + x_23))? ((14.0 + x_18) > (10.0 + x_20)? (14.0 + x_18) : (10.0 + x_20)) : ((12.0 + x_21) > (19.0 + x_23)? (12.0 + x_21) : (19.0 + x_23))) : (((5.0 + x_25) > (16.0 + x_27)? (5.0 + x_25) : (16.0 + x_27)) > ((4.0 + x_29) > (5.0 + x_31)? (4.0 + x_29) : (5.0 + x_31))? ((5.0 + x_25) > (16.0 + x_27)? (5.0 + x_25) : (16.0 + x_27)) : ((4.0 + x_29) > (5.0 + x_31)? (4.0 + x_29) : (5.0 + x_31))))? ((((16.0 + x_2) > (5.0 + x_3)? (16.0 + x_2) : (5.0 + x_3)) > ((17.0 + x_4) > (4.0 + x_6)? (17.0 + x_4) : (4.0 + x_6))? ((16.0 + x_2) > (5.0 + x_3)? (16.0 + x_2) : (5.0 + x_3)) : ((17.0 + x_4) > (4.0 + x_6)? (17.0 + x_4) : (4.0 + x_6))) > (((1.0 + x_8) > (11.0 + x_9)? (1.0 + x_8) : (11.0 + x_9)) > ((7.0 + x_13) > (8.0 + x_17)? (7.0 + x_13) : (8.0 + x_17))? ((1.0 + x_8) > (11.0 + x_9)? (1.0 + x_8) : (11.0 + x_9)) : ((7.0 + x_13) > (8.0 + x_17)? (7.0 + x_13) : (8.0 + x_17)))? (((16.0 + x_2) > (5.0 + x_3)? (16.0 + x_2) : (5.0 + x_3)) > ((17.0 + x_4) > (4.0 + x_6)? (17.0 + x_4) : (4.0 + x_6))? ((16.0 + x_2) > (5.0 + x_3)? (16.0 + x_2) : (5.0 + x_3)) : ((17.0 + x_4) > (4.0 + x_6)? (17.0 + x_4) : (4.0 + x_6))) : (((1.0 + x_8) > (11.0 + x_9)? (1.0 + x_8) : (11.0 + x_9)) > ((7.0 + x_13) > (8.0 + x_17)? (7.0 + x_13) : (8.0 + x_17))? ((1.0 + x_8) > (11.0 + x_9)? (1.0 + x_8) : (11.0 + x_9)) : ((7.0 + x_13) > (8.0 + x_17)? (7.0 + x_13) : (8.0 + x_17)))) : ((((14.0 + x_18) > (10.0 + x_20)? (14.0 + x_18) : (10.0 + x_20)) > ((12.0 + x_21) > (19.0 + x_23)? (12.0 + x_21) : (19.0 + x_23))? ((14.0 + x_18) > (10.0 + x_20)? (14.0 + x_18) : (10.0 + x_20)) : ((12.0 + x_21) > (19.0 + x_23)? (12.0 + x_21) : (19.0 + x_23))) > (((5.0 + x_25) > (16.0 + x_27)? (5.0 + x_25) : (16.0 + x_27)) > ((4.0 + x_29) > (5.0 + x_31)? (4.0 + x_29) : (5.0 + x_31))? ((5.0 + x_25) > (16.0 + x_27)? (5.0 + x_25) : (16.0 + x_27)) : ((4.0 + x_29) > (5.0 + x_31)? (4.0 + x_29) : (5.0 + x_31)))? (((14.0 + x_18) > (10.0 + x_20)? (14.0 + x_18) : (10.0 + x_20)) > ((12.0 + x_21) > (19.0 + x_23)? (12.0 + x_21) : (19.0 + x_23))? ((14.0 + x_18) > (10.0 + x_20)? (14.0 + x_18) : (10.0 + x_20)) : ((12.0 + x_21) > (19.0 + x_23)? (12.0 + x_21) : (19.0 + x_23))) : (((5.0 + x_25) > (16.0 + x_27)? (5.0 + x_25) : (16.0 + x_27)) > ((4.0 + x_29) > (5.0 + x_31)? (4.0 + x_29) : (5.0 + x_31))? ((5.0 + x_25) > (16.0 + x_27)? (5.0 + x_25) : (16.0 + x_27)) : ((4.0 + x_29) > (5.0 + x_31)? (4.0 + x_29) : (5.0 + x_31))))); x_29_ = (((((5.0 + x_0) > (12.0 + x_1)? (5.0 + x_0) : (12.0 + x_1)) > ((17.0 + x_4) > (10.0 + x_7)? (17.0 + x_4) : (10.0 + x_7))? ((5.0 + x_0) > (12.0 + x_1)? (5.0 + x_0) : (12.0 + x_1)) : ((17.0 + x_4) > (10.0 + x_7)? (17.0 + x_4) : (10.0 + x_7))) > (((19.0 + x_8) > (15.0 + x_9)? (19.0 + x_8) : (15.0 + x_9)) > ((1.0 + x_11) > (18.0 + x_17)? (1.0 + x_11) : (18.0 + x_17))? ((19.0 + x_8) > (15.0 + x_9)? (19.0 + x_8) : (15.0 + x_9)) : ((1.0 + x_11) > (18.0 + x_17)? (1.0 + x_11) : (18.0 + x_17)))? (((5.0 + x_0) > (12.0 + x_1)? (5.0 + x_0) : (12.0 + x_1)) > ((17.0 + x_4) > (10.0 + x_7)? (17.0 + x_4) : (10.0 + x_7))? ((5.0 + x_0) > (12.0 + x_1)? (5.0 + x_0) : (12.0 + x_1)) : ((17.0 + x_4) > (10.0 + x_7)? (17.0 + x_4) : (10.0 + x_7))) : (((19.0 + x_8) > (15.0 + x_9)? (19.0 + x_8) : (15.0 + x_9)) > ((1.0 + x_11) > (18.0 + x_17)? (1.0 + x_11) : (18.0 + x_17))? ((19.0 + x_8) > (15.0 + x_9)? (19.0 + x_8) : (15.0 + x_9)) : ((1.0 + x_11) > (18.0 + x_17)? (1.0 + x_11) : (18.0 + x_17)))) > ((((2.0 + x_20) > (5.0 + x_21)? (2.0 + x_20) : (5.0 + x_21)) > ((7.0 + x_22) > (14.0 + x_23)? (7.0 + x_22) : (14.0 + x_23))? ((2.0 + x_20) > (5.0 + x_21)? (2.0 + x_20) : (5.0 + x_21)) : ((7.0 + x_22) > (14.0 + x_23)? (7.0 + x_22) : (14.0 + x_23))) > (((9.0 + x_24) > (18.0 + x_26)? (9.0 + x_24) : (18.0 + x_26)) > ((1.0 + x_29) > (6.0 + x_31)? (1.0 + x_29) : (6.0 + x_31))? ((9.0 + x_24) > (18.0 + x_26)? (9.0 + x_24) : (18.0 + x_26)) : ((1.0 + x_29) > (6.0 + x_31)? (1.0 + x_29) : (6.0 + x_31)))? (((2.0 + x_20) > (5.0 + x_21)? (2.0 + x_20) : (5.0 + x_21)) > ((7.0 + x_22) > (14.0 + x_23)? (7.0 + x_22) : (14.0 + x_23))? ((2.0 + x_20) > (5.0 + x_21)? (2.0 + x_20) : (5.0 + x_21)) : ((7.0 + x_22) > (14.0 + x_23)? (7.0 + x_22) : (14.0 + x_23))) : (((9.0 + x_24) > (18.0 + x_26)? (9.0 + x_24) : (18.0 + x_26)) > ((1.0 + x_29) > (6.0 + x_31)? (1.0 + x_29) : (6.0 + x_31))? ((9.0 + x_24) > (18.0 + x_26)? (9.0 + x_24) : (18.0 + x_26)) : ((1.0 + x_29) > (6.0 + x_31)? (1.0 + x_29) : (6.0 + x_31))))? ((((5.0 + x_0) > (12.0 + x_1)? (5.0 + x_0) : (12.0 + x_1)) > ((17.0 + x_4) > (10.0 + x_7)? (17.0 + x_4) : (10.0 + x_7))? ((5.0 + x_0) > (12.0 + x_1)? (5.0 + x_0) : (12.0 + x_1)) : ((17.0 + x_4) > (10.0 + x_7)? (17.0 + x_4) : (10.0 + x_7))) > (((19.0 + x_8) > (15.0 + x_9)? (19.0 + x_8) : (15.0 + x_9)) > ((1.0 + x_11) > (18.0 + x_17)? (1.0 + x_11) : (18.0 + x_17))? ((19.0 + x_8) > (15.0 + x_9)? (19.0 + x_8) : (15.0 + x_9)) : ((1.0 + x_11) > (18.0 + x_17)? (1.0 + x_11) : (18.0 + x_17)))? (((5.0 + x_0) > (12.0 + x_1)? (5.0 + x_0) : (12.0 + x_1)) > ((17.0 + x_4) > (10.0 + x_7)? (17.0 + x_4) : (10.0 + x_7))? ((5.0 + x_0) > (12.0 + x_1)? (5.0 + x_0) : (12.0 + x_1)) : ((17.0 + x_4) > (10.0 + x_7)? (17.0 + x_4) : (10.0 + x_7))) : (((19.0 + x_8) > (15.0 + x_9)? (19.0 + x_8) : (15.0 + x_9)) > ((1.0 + x_11) > (18.0 + x_17)? (1.0 + x_11) : (18.0 + x_17))? ((19.0 + x_8) > (15.0 + x_9)? (19.0 + x_8) : (15.0 + x_9)) : ((1.0 + x_11) > (18.0 + x_17)? (1.0 + x_11) : (18.0 + x_17)))) : ((((2.0 + x_20) > (5.0 + x_21)? (2.0 + x_20) : (5.0 + x_21)) > ((7.0 + x_22) > (14.0 + x_23)? (7.0 + x_22) : (14.0 + x_23))? ((2.0 + x_20) > (5.0 + x_21)? (2.0 + x_20) : (5.0 + x_21)) : ((7.0 + x_22) > (14.0 + x_23)? (7.0 + x_22) : (14.0 + x_23))) > (((9.0 + x_24) > (18.0 + x_26)? (9.0 + x_24) : (18.0 + x_26)) > ((1.0 + x_29) > (6.0 + x_31)? (1.0 + x_29) : (6.0 + x_31))? ((9.0 + x_24) > (18.0 + x_26)? (9.0 + x_24) : (18.0 + x_26)) : ((1.0 + x_29) > (6.0 + x_31)? (1.0 + x_29) : (6.0 + x_31)))? (((2.0 + x_20) > (5.0 + x_21)? (2.0 + x_20) : (5.0 + x_21)) > ((7.0 + x_22) > (14.0 + x_23)? (7.0 + x_22) : (14.0 + x_23))? ((2.0 + x_20) > (5.0 + x_21)? (2.0 + x_20) : (5.0 + x_21)) : ((7.0 + x_22) > (14.0 + x_23)? (7.0 + x_22) : (14.0 + x_23))) : (((9.0 + x_24) > (18.0 + x_26)? (9.0 + x_24) : (18.0 + x_26)) > ((1.0 + x_29) > (6.0 + x_31)? (1.0 + x_29) : (6.0 + x_31))? ((9.0 + x_24) > (18.0 + x_26)? (9.0 + x_24) : (18.0 + x_26)) : ((1.0 + x_29) > (6.0 + x_31)? (1.0 + x_29) : (6.0 + x_31))))); x_30_ = (((((18.0 + x_0) > (9.0 + x_2)? (18.0 + x_0) : (9.0 + x_2)) > ((20.0 + x_5) > (16.0 + x_6)? (20.0 + x_5) : (16.0 + x_6))? ((18.0 + x_0) > (9.0 + x_2)? (18.0 + x_0) : (9.0 + x_2)) : ((20.0 + x_5) > (16.0 + x_6)? (20.0 + x_5) : (16.0 + x_6))) > (((12.0 + x_7) > (16.0 + x_11)? (12.0 + x_7) : (16.0 + x_11)) > ((13.0 + x_14) > (13.0 + x_17)? (13.0 + x_14) : (13.0 + x_17))? ((12.0 + x_7) > (16.0 + x_11)? (12.0 + x_7) : (16.0 + x_11)) : ((13.0 + x_14) > (13.0 + x_17)? (13.0 + x_14) : (13.0 + x_17)))? (((18.0 + x_0) > (9.0 + x_2)? (18.0 + x_0) : (9.0 + x_2)) > ((20.0 + x_5) > (16.0 + x_6)? (20.0 + x_5) : (16.0 + x_6))? ((18.0 + x_0) > (9.0 + x_2)? (18.0 + x_0) : (9.0 + x_2)) : ((20.0 + x_5) > (16.0 + x_6)? (20.0 + x_5) : (16.0 + x_6))) : (((12.0 + x_7) > (16.0 + x_11)? (12.0 + x_7) : (16.0 + x_11)) > ((13.0 + x_14) > (13.0 + x_17)? (13.0 + x_14) : (13.0 + x_17))? ((12.0 + x_7) > (16.0 + x_11)? (12.0 + x_7) : (16.0 + x_11)) : ((13.0 + x_14) > (13.0 + x_17)? (13.0 + x_14) : (13.0 + x_17)))) > ((((20.0 + x_20) > (2.0 + x_22)? (20.0 + x_20) : (2.0 + x_22)) > ((15.0 + x_24) > (9.0 + x_25)? (15.0 + x_24) : (9.0 + x_25))? ((20.0 + x_20) > (2.0 + x_22)? (20.0 + x_20) : (2.0 + x_22)) : ((15.0 + x_24) > (9.0 + x_25)? (15.0 + x_24) : (9.0 + x_25))) > (((12.0 + x_27) > (20.0 + x_29)? (12.0 + x_27) : (20.0 + x_29)) > ((11.0 + x_30) > (10.0 + x_31)? (11.0 + x_30) : (10.0 + x_31))? ((12.0 + x_27) > (20.0 + x_29)? (12.0 + x_27) : (20.0 + x_29)) : ((11.0 + x_30) > (10.0 + x_31)? (11.0 + x_30) : (10.0 + x_31)))? (((20.0 + x_20) > (2.0 + x_22)? (20.0 + x_20) : (2.0 + x_22)) > ((15.0 + x_24) > (9.0 + x_25)? (15.0 + x_24) : (9.0 + x_25))? ((20.0 + x_20) > (2.0 + x_22)? (20.0 + x_20) : (2.0 + x_22)) : ((15.0 + x_24) > (9.0 + x_25)? (15.0 + x_24) : (9.0 + x_25))) : (((12.0 + x_27) > (20.0 + x_29)? (12.0 + x_27) : (20.0 + x_29)) > ((11.0 + x_30) > (10.0 + x_31)? (11.0 + x_30) : (10.0 + x_31))? ((12.0 + x_27) > (20.0 + x_29)? (12.0 + x_27) : (20.0 + x_29)) : ((11.0 + x_30) > (10.0 + x_31)? (11.0 + x_30) : (10.0 + x_31))))? ((((18.0 + x_0) > (9.0 + x_2)? (18.0 + x_0) : (9.0 + x_2)) > ((20.0 + x_5) > (16.0 + x_6)? (20.0 + x_5) : (16.0 + x_6))? ((18.0 + x_0) > (9.0 + x_2)? (18.0 + x_0) : (9.0 + x_2)) : ((20.0 + x_5) > (16.0 + x_6)? (20.0 + x_5) : (16.0 + x_6))) > (((12.0 + x_7) > (16.0 + x_11)? (12.0 + x_7) : (16.0 + x_11)) > ((13.0 + x_14) > (13.0 + x_17)? (13.0 + x_14) : (13.0 + x_17))? ((12.0 + x_7) > (16.0 + x_11)? (12.0 + x_7) : (16.0 + x_11)) : ((13.0 + x_14) > (13.0 + x_17)? (13.0 + x_14) : (13.0 + x_17)))? (((18.0 + x_0) > (9.0 + x_2)? (18.0 + x_0) : (9.0 + x_2)) > ((20.0 + x_5) > (16.0 + x_6)? (20.0 + x_5) : (16.0 + x_6))? ((18.0 + x_0) > (9.0 + x_2)? (18.0 + x_0) : (9.0 + x_2)) : ((20.0 + x_5) > (16.0 + x_6)? (20.0 + x_5) : (16.0 + x_6))) : (((12.0 + x_7) > (16.0 + x_11)? (12.0 + x_7) : (16.0 + x_11)) > ((13.0 + x_14) > (13.0 + x_17)? (13.0 + x_14) : (13.0 + x_17))? ((12.0 + x_7) > (16.0 + x_11)? (12.0 + x_7) : (16.0 + x_11)) : ((13.0 + x_14) > (13.0 + x_17)? (13.0 + x_14) : (13.0 + x_17)))) : ((((20.0 + x_20) > (2.0 + x_22)? (20.0 + x_20) : (2.0 + x_22)) > ((15.0 + x_24) > (9.0 + x_25)? (15.0 + x_24) : (9.0 + x_25))? ((20.0 + x_20) > (2.0 + x_22)? (20.0 + x_20) : (2.0 + x_22)) : ((15.0 + x_24) > (9.0 + x_25)? (15.0 + x_24) : (9.0 + x_25))) > (((12.0 + x_27) > (20.0 + x_29)? (12.0 + x_27) : (20.0 + x_29)) > ((11.0 + x_30) > (10.0 + x_31)? (11.0 + x_30) : (10.0 + x_31))? ((12.0 + x_27) > (20.0 + x_29)? (12.0 + x_27) : (20.0 + x_29)) : ((11.0 + x_30) > (10.0 + x_31)? (11.0 + x_30) : (10.0 + x_31)))? (((20.0 + x_20) > (2.0 + x_22)? (20.0 + x_20) : (2.0 + x_22)) > ((15.0 + x_24) > (9.0 + x_25)? (15.0 + x_24) : (9.0 + x_25))? ((20.0 + x_20) > (2.0 + x_22)? (20.0 + x_20) : (2.0 + x_22)) : ((15.0 + x_24) > (9.0 + x_25)? (15.0 + x_24) : (9.0 + x_25))) : (((12.0 + x_27) > (20.0 + x_29)? (12.0 + x_27) : (20.0 + x_29)) > ((11.0 + x_30) > (10.0 + x_31)? (11.0 + x_30) : (10.0 + x_31))? ((12.0 + x_27) > (20.0 + x_29)? (12.0 + x_27) : (20.0 + x_29)) : ((11.0 + x_30) > (10.0 + x_31)? (11.0 + x_30) : (10.0 + x_31))))); x_31_ = (((((14.0 + x_4) > (14.0 + x_6)? (14.0 + x_4) : (14.0 + x_6)) > ((6.0 + x_8) > (15.0 + x_9)? (6.0 + x_8) : (15.0 + x_9))? ((14.0 + x_4) > (14.0 + x_6)? (14.0 + x_4) : (14.0 + x_6)) : ((6.0 + x_8) > (15.0 + x_9)? (6.0 + x_8) : (15.0 + x_9))) > (((15.0 + x_10) > (13.0 + x_16)? (15.0 + x_10) : (13.0 + x_16)) > ((15.0 + x_17) > (16.0 + x_18)? (15.0 + x_17) : (16.0 + x_18))? ((15.0 + x_10) > (13.0 + x_16)? (15.0 + x_10) : (13.0 + x_16)) : ((15.0 + x_17) > (16.0 + x_18)? (15.0 + x_17) : (16.0 + x_18)))? (((14.0 + x_4) > (14.0 + x_6)? (14.0 + x_4) : (14.0 + x_6)) > ((6.0 + x_8) > (15.0 + x_9)? (6.0 + x_8) : (15.0 + x_9))? ((14.0 + x_4) > (14.0 + x_6)? (14.0 + x_4) : (14.0 + x_6)) : ((6.0 + x_8) > (15.0 + x_9)? (6.0 + x_8) : (15.0 + x_9))) : (((15.0 + x_10) > (13.0 + x_16)? (15.0 + x_10) : (13.0 + x_16)) > ((15.0 + x_17) > (16.0 + x_18)? (15.0 + x_17) : (16.0 + x_18))? ((15.0 + x_10) > (13.0 + x_16)? (15.0 + x_10) : (13.0 + x_16)) : ((15.0 + x_17) > (16.0 + x_18)? (15.0 + x_17) : (16.0 + x_18)))) > ((((11.0 + x_21) > (14.0 + x_22)? (11.0 + x_21) : (14.0 + x_22)) > ((3.0 + x_23) > (19.0 + x_25)? (3.0 + x_23) : (19.0 + x_25))? ((11.0 + x_21) > (14.0 + x_22)? (11.0 + x_21) : (14.0 + x_22)) : ((3.0 + x_23) > (19.0 + x_25)? (3.0 + x_23) : (19.0 + x_25))) > (((6.0 + x_26) > (15.0 + x_27)? (6.0 + x_26) : (15.0 + x_27)) > ((17.0 + x_30) > (9.0 + x_31)? (17.0 + x_30) : (9.0 + x_31))? ((6.0 + x_26) > (15.0 + x_27)? (6.0 + x_26) : (15.0 + x_27)) : ((17.0 + x_30) > (9.0 + x_31)? (17.0 + x_30) : (9.0 + x_31)))? (((11.0 + x_21) > (14.0 + x_22)? (11.0 + x_21) : (14.0 + x_22)) > ((3.0 + x_23) > (19.0 + x_25)? (3.0 + x_23) : (19.0 + x_25))? ((11.0 + x_21) > (14.0 + x_22)? (11.0 + x_21) : (14.0 + x_22)) : ((3.0 + x_23) > (19.0 + x_25)? (3.0 + x_23) : (19.0 + x_25))) : (((6.0 + x_26) > (15.0 + x_27)? (6.0 + x_26) : (15.0 + x_27)) > ((17.0 + x_30) > (9.0 + x_31)? (17.0 + x_30) : (9.0 + x_31))? ((6.0 + x_26) > (15.0 + x_27)? (6.0 + x_26) : (15.0 + x_27)) : ((17.0 + x_30) > (9.0 + x_31)? (17.0 + x_30) : (9.0 + x_31))))? ((((14.0 + x_4) > (14.0 + x_6)? (14.0 + x_4) : (14.0 + x_6)) > ((6.0 + x_8) > (15.0 + x_9)? (6.0 + x_8) : (15.0 + x_9))? ((14.0 + x_4) > (14.0 + x_6)? (14.0 + x_4) : (14.0 + x_6)) : ((6.0 + x_8) > (15.0 + x_9)? (6.0 + x_8) : (15.0 + x_9))) > (((15.0 + x_10) > (13.0 + x_16)? (15.0 + x_10) : (13.0 + x_16)) > ((15.0 + x_17) > (16.0 + x_18)? (15.0 + x_17) : (16.0 + x_18))? ((15.0 + x_10) > (13.0 + x_16)? (15.0 + x_10) : (13.0 + x_16)) : ((15.0 + x_17) > (16.0 + x_18)? (15.0 + x_17) : (16.0 + x_18)))? (((14.0 + x_4) > (14.0 + x_6)? (14.0 + x_4) : (14.0 + x_6)) > ((6.0 + x_8) > (15.0 + x_9)? (6.0 + x_8) : (15.0 + x_9))? ((14.0 + x_4) > (14.0 + x_6)? (14.0 + x_4) : (14.0 + x_6)) : ((6.0 + x_8) > (15.0 + x_9)? (6.0 + x_8) : (15.0 + x_9))) : (((15.0 + x_10) > (13.0 + x_16)? (15.0 + x_10) : (13.0 + x_16)) > ((15.0 + x_17) > (16.0 + x_18)? (15.0 + x_17) : (16.0 + x_18))? ((15.0 + x_10) > (13.0 + x_16)? (15.0 + x_10) : (13.0 + x_16)) : ((15.0 + x_17) > (16.0 + x_18)? (15.0 + x_17) : (16.0 + x_18)))) : ((((11.0 + x_21) > (14.0 + x_22)? (11.0 + x_21) : (14.0 + x_22)) > ((3.0 + x_23) > (19.0 + x_25)? (3.0 + x_23) : (19.0 + x_25))? ((11.0 + x_21) > (14.0 + x_22)? (11.0 + x_21) : (14.0 + x_22)) : ((3.0 + x_23) > (19.0 + x_25)? (3.0 + x_23) : (19.0 + x_25))) > (((6.0 + x_26) > (15.0 + x_27)? (6.0 + x_26) : (15.0 + x_27)) > ((17.0 + x_30) > (9.0 + x_31)? (17.0 + x_30) : (9.0 + x_31))? ((6.0 + x_26) > (15.0 + x_27)? (6.0 + x_26) : (15.0 + x_27)) : ((17.0 + x_30) > (9.0 + x_31)? (17.0 + x_30) : (9.0 + x_31)))? (((11.0 + x_21) > (14.0 + x_22)? (11.0 + x_21) : (14.0 + x_22)) > ((3.0 + x_23) > (19.0 + x_25)? (3.0 + x_23) : (19.0 + x_25))? ((11.0 + x_21) > (14.0 + x_22)? (11.0 + x_21) : (14.0 + x_22)) : ((3.0 + x_23) > (19.0 + x_25)? (3.0 + x_23) : (19.0 + x_25))) : (((6.0 + x_26) > (15.0 + x_27)? (6.0 + x_26) : (15.0 + x_27)) > ((17.0 + x_30) > (9.0 + x_31)? (17.0 + x_30) : (9.0 + x_31))? ((6.0 + x_26) > (15.0 + x_27)? (6.0 + x_26) : (15.0 + x_27)) : ((17.0 + x_30) > (9.0 + x_31)? (17.0 + x_30) : (9.0 + x_31))))); x_0 = x_0_; x_1 = x_1_; x_2 = x_2_; x_3 = x_3_; x_4 = x_4_; x_5 = x_5_; x_6 = x_6_; x_7 = x_7_; x_8 = x_8_; x_9 = x_9_; x_10 = x_10_; x_11 = x_11_; x_12 = x_12_; x_13 = x_13_; x_14 = x_14_; x_15 = x_15_; x_16 = x_16_; x_17 = x_17_; x_18 = x_18_; x_19 = x_19_; x_20 = x_20_; x_21 = x_21_; x_22 = x_22_; x_23 = x_23_; x_24 = x_24_; x_25 = x_25_; x_26 = x_26_; x_27 = x_27_; x_28 = x_28_; x_29 = x_29_; x_30 = x_30_; x_31 = x_31_; } return 0; }
the_stack_data/179830840.c
#include <stdio.h> #include <stddef.h> static struct sss{ char * f; size_t snd; } sss; #define _offsetof(st,f) ((char *)&((st *) 16)->f - (char *) 16) int main (void) { printf ("+++Struct pointer-size_t:\n"); printf ("size=%d,align=%d,offset-pointer=%d,offset-size_t=%d,\nalign-pointer=%d,align-size_t=%d\n", sizeof (sss), __alignof__ (sss), _offsetof (struct sss, f), _offsetof (struct sss, snd), __alignof__ (sss.f), __alignof__ (sss.snd)); return 0; }
the_stack_data/64201462.c
/* Fig. 6.18: fig06_18.c Linear search of an array */ #include <stdio.h> #define SIZE 100 /* function prototype */ int linearSearch( const int array[], int key, int size ); /* function main begins program execution */ int main( void ) { int a[ SIZE ]; /* create array a */ int x; /* counter for initializing elements 0-99 of array a */ int searchKey; /* value to locate in array a */ int element; /* variable to hold location of searchKey or -1 */ /* create data */ for ( x = 0; x < SIZE; x++ ) { a[ x ] = 2 * x; } /* end for */ printf( "Enter integer search key:\n" ); scanf( "%d", &searchKey ); /* attempt to locate searchKey in array a */ element = linearSearch( a, searchKey, SIZE ); /* display results */ if ( element != -1 ) { printf( "Found value in element %d\n", element ); } /* end if */ else { printf( "Value not found\n" ); } /* end else */ return 0; /* indicates successful termination */ } /* end main */ /* compare key to every element of array until the location is found or until the end of array is reached; return subscript of element if key or -1 if key is not found */ int linearSearch( const int array[], int key, int size ) { int n; /* counter */ /* loop through array */ for ( n = 0; n < size; ++n ) { if ( array[ n ] == key ) { return n; /* return location of key */ } /* end if */ } /* end for */ return -1; /* key not found */ } /* end function linearSearch */ /************************************************************************** * (C) Copyright 1992-2010 by Deitel & Associates, Inc. and * * Pearson Education, Inc. All Rights Reserved. * * * * DISCLAIMER: The authors and publisher of this book have used their * * best efforts in preparing the book. These efforts include the * * development, research, and testing of the theories and programs * * to determine their effectiveness. The authors and publisher make * * no warranty of any kind, expressed or implied, with regard to these * * programs or to the documentation contained in these books. The authors * * and publisher shall not be liable in any event for incidental or * * consequential damages in connection with, or arising out of, the * * furnishing, performance, or use of these programs. * *************************************************************************/
the_stack_data/132952501.c
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> /*The basic implementation of the hash table*/ #define MAX_SIZE 31 typedef struct Node{ int key; struct Node *next; }Node; typedef struct List{ struct Node *first; }List; void init_list(List *l){ l->first = NULL; } void init_table (List table[]){ for(int i = 0; i < MAX_SIZE; i++) init_list(&table[i]); } int hash(int key){ return key % MAX_SIZE; } void display_list(List *l){ printf("["); for(Node *i = l->first; i != NULL; i = i-> next){ printf("%d%s", i->key, ((i->next == NULL)? "" : ", ")); } printf("]\n"); } void display(List table[]){ int i; printf("Your table\n["); for(int i = 0; i < MAX_SIZE; i++){ printf("\t%d - ", i); display_list(&table[i]); } printf("]"); } Node *new_node(int element){ Node *n = (Node*)malloc(sizeof(Node)); n->key = element; n->next = NULL; return n; } void insert_list(List *l, int element){ Node *n = new_node(element); n->next = l->first; l->first = n; } void insert(List table[], int element){ int pos = hash(element); insert_list(&table[pos], element); } bool search_list(List *l, int key){ bool result = false; Node* i = l->first; while(i != NULL && i-> key != key){ if(i->key == key){ result = true; i = NULL; } else i = i->next; } return result; } bool search(List table[], int key){ int pos = hash(key); return search_list(&table[pos], key); } void insertion_menu(List table[]){ printf("Please insert a value:"); int value; scanf(" %d", &value); insert(table,value); } void search_menu(List table[]){ printf("Please inser a value to search: "); int key; scanf(" %d", &key); if(search(table,key) == true) printf("The element %d exists on yout table\n", key); else printf("The element %d does not exist your your table\n", key); } int main(){ int option; List table[MAX_SIZE]; init_table(table); do{ printf("(0)Quit\n(1)Insert\n(2)Search\n(3)Display\n"); scanf(" %d", &option); switch (option) { case 0: printf("Thanks for using the hash table app\n"); break; case 1: insertion_menu(table); break; case 2: search_menu(table); break; case 3: display(table); break; default: break; } }while(option != 0); return 0; }
the_stack_data/198579688.c
#include <stdio.h> #include <stdlib.h> #include <getopt.h> #include <ctype.h> /* ****************************************************************** ALTERNATING BIT AND GO-BACK-N NETWORK EMULATOR: VERSION 1.1 J.F.Kurose This code should be used for PA2, unidirectional data transfer protocols (from A to B). Network properties: - one way network delay averages five time units (longer if there are other messages in the channel for GBN), but can be larger - packets can be corrupted (either the header or the data portion) or lost, according to user-defined probabilities - packets will be delivered in the order in which they were sent (although some can be lost). **********************************************************************/ #define BIDIRECTIONAL 0 /* a "msg" is the data unit passed from layer 5 (teachers code) to layer */ /* 4 (students' code). It contains the data (characters) to be delivered */ /* to layer 5 via the students transport level protocol entities. */ struct msg { char data[20]; }; /* a packet is the data unit passed from layer 4 (students code) to layer */ /* 3 (teachers code). Note the pre-defined packet structure, which all */ /* students must follow. */ struct pkt { int seqnum; int acknum; int checksum; char payload[20]; }; /********* STUDENTS WRITE THE NEXT SEVEN ROUTINES *********/ /* Statistics * Do NOT change the name/declaration of these variables * You need to set the value of these variables appropriately within your code. * */ int A_application = 0; int A_transport = 0; int B_application = 0; int B_transport = 0; /* Globals * Do NOT change the name/declaration of these variables * They are set to zero here. You will need to set them (except WINSIZE) to some proper values. * */ float TIMEOUT = 0.0; int WINSIZE; //This is supplied as cmd-line parameter; You will need to read this value but do NOT modify it; int SND_BUFSIZE = 0; //Sender's Buffer size int RCV_BUFSIZE = 0; //Receiver's Buffer size /* called from layer 5, passed the data to be sent to other side */ void A_output(message) struct msg message; { } void B_output(message) /* need be completed only for extra credit */ struct msg message; { } /* called from layer 3, when a packet arrives for layer 4 */ void A_input(packet) struct pkt packet; { } /* called when A's timer goes off */ void A_timerinterrupt() { } /* the following routine will be called once (only) before any other */ /* entity A routines are called. You can use it to do any initialization */ void A_init() { } /* Note that with simplex transfer from a-to-B, there is no B_output() */ /* called from layer 3, when a packet arrives for layer 4 at B*/ void B_input(packet) struct pkt packet; { } /* called when B's timer goes off */ void B_timerinterrupt() { } /* the following rouytine will be called once (only) before any other */ /* entity B routines are called. You can use it to do any initialization */ void B_init() { } /***************************************************************** ***************** NETWORK EMULATION CODE STARTS BELOW *********** The code below emulates the layer 3 and below network environment: - emulates the tranmission and delivery (possibly with bit-level corruption and packet loss) of packets across the layer 3/4 interface - handles the starting/stopping of a timer, and generates timer interrupts (resulting in calling students timer handler). - generates message to be sent (passed from later 5 to 4) THERE IS NOT REASON THAT ANY STUDENT SHOULD HAVE TO READ OR UNDERSTAND THE CODE BELOW. YOU SHOLD NOT TOUCH, OR REFERENCE (in your code) ANY OF THE DATA STRUCTURES BELOW. If you're interested in how I designed the emulator, you're welcome to look at the code - but again, you should have to, and you defeinitely should not have to modify ******************************************************************/ struct event { float evtime; /* event time */ int evtype; /* event type code */ int eventity; /* entity where event occurs */ struct pkt *pktptr; /* ptr to packet (if any) assoc w/ this event */ struct event *prev; struct event *next; }; struct event *evlist = NULL; /* the event list */ //forward declarations void init(); void generate_next_arrival(); void insertevent(struct event*); /* possible events: */ #define TIMER_INTERRUPT 0 #define FROM_LAYER5 1 #define FROM_LAYER3 2 #define OFF 0 #define ON 1 #define A 0 #define B 1 int TRACE = 1; /* for my debugging */ int nsim = 0; /* number of messages from 5 to 4 so far */ int nsimmax = 0; /* number of msgs to generate, then stop */ float time = 0.000; float lossprob = 0.0; /* probability that a packet is dropped */ float corruptprob = 0.0; /* probability that one bit is packet is flipped */ float lambda = 0.0; /* arrival rate of messages from layer 5 */ int ntolayer3 = 0; /* number sent into layer 3 */ int nlost = 0; /* number lost in media */ int ncorrupt = 0; /* number corrupted by media*/ /** * Checks if the array pointed to by input holds a valid number. * * @param input char* to the array holding the value. * @return TRUE or FALSE */ int isNumber(char *input) { while (*input){ if (!isdigit(*input)) return 0; else input += 1; } return 1; } int main(int argc, char **argv) { struct event *eventptr; struct msg msg2give; struct pkt pkt2give; int i,j; char c; int opt; int seed; //Check for number of arguments if(argc != 5){ fprintf(stderr, "Missing arguments\n"); printf("Usage: %s -s SEED -w WINDOWSIZE\n", argv[0]); return -1; } /* * Parse the arguments * http://www.gnu.org/software/libc/manual/html_node/Example-of-Getopt.html */ while((opt = getopt(argc, argv,"s:w:")) != -1){ switch (opt){ case 's': if(!isNumber(optarg)){ fprintf(stderr, "Invalid value for -s\n"); return -1; } seed = atoi(optarg); break; case 'w': if(!isNumber(optarg)){ fprintf(stderr, "Invalid value for -w\n"); return -1; } WINSIZE = atoi(optarg); break; case '?': break; default: printf("Usage: %s -s SEED -w WINDOWSIZE\n", argv[0]); return -1; } } init(seed); A_init(); B_init(); while (1) { eventptr = evlist; /* get next event to simulate */ if (eventptr==NULL) goto terminate; evlist = evlist->next; /* remove this event from event list */ if (evlist!=NULL) evlist->prev=NULL; if (TRACE>=2) { printf("\nEVENT time: %f,",eventptr->evtime); printf(" type: %d",eventptr->evtype); if (eventptr->evtype==0) printf(", timerinterrupt "); else if (eventptr->evtype==1) printf(", fromlayer5 "); else printf(", fromlayer3 "); printf(" entity: %d\n",eventptr->eventity); } time = eventptr->evtime; /* update time to next event time */ if (nsim==nsimmax) break; /* all done with simulation */ if (eventptr->evtype == FROM_LAYER5 ) { generate_next_arrival(); /* set up future arrival */ /* fill in msg to give with string of same letter */ j = nsim % 26; for (i=0; i<20; i++) msg2give.data[i] = 97 + j; if (TRACE>2) { printf(" MAINLOOP: data given to student: "); for (i=0; i<20; i++) printf("%c", msg2give.data[i]); printf("\n"); } nsim++; if (eventptr->eventity == A) A_output(msg2give); else B_output(msg2give); } else if (eventptr->evtype == FROM_LAYER3) { pkt2give.seqnum = eventptr->pktptr->seqnum; pkt2give.acknum = eventptr->pktptr->acknum; pkt2give.checksum = eventptr->pktptr->checksum; for (i=0; i<20; i++) pkt2give.payload[i] = eventptr->pktptr->payload[i]; if (eventptr->eventity ==A) /* deliver packet by calling */ A_input(pkt2give); /* appropriate entity */ else B_input(pkt2give); free(eventptr->pktptr); /* free the memory for packet */ } else if (eventptr->evtype == TIMER_INTERRUPT) { if (eventptr->eventity == A) A_timerinterrupt(); else B_timerinterrupt(); } else { printf("INTERNAL PANIC: unknown event type \n"); } free(eventptr); } terminate: //Do NOT change any of the following printfs printf(" Simulator terminated at time %f\n after sending %d msgs from layer5\n",time,nsim); printf("\n"); printf("Protocol: SR\n"); printf("[PA2]%d packets sent from the Application Layer of Sender A[/PA2]\n", A_application); printf("[PA2]%d packets sent from the Transport Layer of Sender A[/PA2]\n", A_transport); printf("[PA2]%d packets received at the Transport layer of Receiver B[/PA2]\n", B_transport); printf("[PA2]%d packets received at the Application layer of Receiver B[/PA2]\n", B_application); printf("[PA2]Total time: %f time units[/PA2]\n", time); printf("[PA2]Throughput: %f packets/time units[/PA2]\n", B_application/time); return 0; } void init(int seed) /* initialize the simulator */ { int i; float sum, avg; float jimsrand(); printf("----- Stop and Wait Network Simulator Version 1.1 -------- \n\n"); printf("Enter the number of messages to simulate: "); scanf("%d",&nsimmax); printf("Enter packet loss probability [enter 0.0 for no loss]:"); scanf("%f",&lossprob); printf("Enter packet corruption probability [0.0 for no corruption]:"); scanf("%f",&corruptprob); printf("Enter average time between messages from sender's layer5 [ > 0.0]:"); scanf("%f",&lambda); printf("Enter TRACE:"); scanf("%d",&TRACE); srand(seed); /* init random number generator */ sum = 0.0; /* test random number generator for students */ for (i=0; i<1000; i++) sum=sum+jimsrand(); /* jimsrand() should be uniform in [0,1] */ avg = sum/1000.0; if (avg < 0.25 || avg > 0.75) { printf("It is likely that random number generation on your machine\n" ); printf("is different from what this emulator expects. Please take\n"); printf("a look at the routine jimsrand() in the emulator code. Sorry. \n"); exit(0); } ntolayer3 = 0; nlost = 0; ncorrupt = 0; time=0.0; /* initialize time to 0.0 */ generate_next_arrival(); /* initialize event list */ } /****************************************************************************/ /* jimsrand(): return a float in range [0,1]. The routine below is used to */ /* isolate all random number generation in one location. We assume that the*/ /* system-supplied rand() function return an int in therange [0,mmm] */ /****************************************************************************/ float jimsrand() { double mmm = 2147483647; /* largest int - MACHINE DEPENDENT!!!!!!!! */ float x; /* individual students may need to change mmm */ x = rand()/mmm; /* x should be uniform in [0,1] */ return(x); } /********************* EVENT HANDLINE ROUTINES *******/ /* The next set of routines handle the event list */ /*****************************************************/ void generate_next_arrival() { double x,log(),ceil(); struct event *evptr; //char *malloc(); float ttime; int tempint; if (TRACE>2) printf(" GENERATE NEXT ARRIVAL: creating new arrival\n"); x = lambda*jimsrand()*2; /* x is uniform on [0,2*lambda] */ /* having mean of lambda */ evptr = (struct event *)malloc(sizeof(struct event)); evptr->evtime = time + x; evptr->evtype = FROM_LAYER5; if (BIDIRECTIONAL && (jimsrand()>0.5) ) evptr->eventity = B; else evptr->eventity = A; insertevent(evptr); } void insertevent(p) struct event *p; { struct event *q,*qold; if (TRACE>2) { printf(" INSERTEVENT: time is %lf\n",time); printf(" INSERTEVENT: future time will be %lf\n",p->evtime); } q = evlist; /* q points to header of list in which p struct inserted */ if (q==NULL) { /* list is empty */ evlist=p; p->next=NULL; p->prev=NULL; } else { for (qold = q; q !=NULL && p->evtime > q->evtime; q=q->next) qold=q; if (q==NULL) { /* end of list */ qold->next = p; p->prev = qold; p->next = NULL; } else if (q==evlist) { /* front of list */ p->next=evlist; p->prev=NULL; p->next->prev=p; evlist = p; } else { /* middle of list */ p->next=q; p->prev=q->prev; q->prev->next=p; q->prev=p; } } } void printevlist() { struct event *q; int i; printf("--------------\nEvent List Follows:\n"); for(q = evlist; q!=NULL; q=q->next) { printf("Event time: %f, type: %d entity: %d\n",q->evtime,q->evtype,q->eventity); } printf("--------------\n"); } /********************** Student-callable ROUTINES ***********************/ /* called by students routine to cancel a previously-started timer */ void stoptimer(AorB) int AorB; /* A or B is trying to stop timer */ { struct event *q,*qold; if (TRACE>2) printf(" STOP TIMER: stopping timer at %f\n",time); /* for (q=evlist; q!=NULL && q->next!=NULL; q = q->next) */ for (q=evlist; q!=NULL ; q = q->next) if ( (q->evtype==TIMER_INTERRUPT && q->eventity==AorB) ) { /* remove this event */ if (q->next==NULL && q->prev==NULL) evlist=NULL; /* remove first and only event on list */ else if (q->next==NULL) /* end of list - there is one in front */ q->prev->next = NULL; else if (q==evlist) { /* front of list - there must be event after */ q->next->prev=NULL; evlist = q->next; } else { /* middle of list */ q->next->prev = q->prev; q->prev->next = q->next; } free(q); return; } printf("Warning: unable to cancel your timer. It wasn't running.\n"); } void starttimer(AorB,increment) int AorB; /* A or B is trying to stop timer */ float increment; { struct event *q; struct event *evptr; //char *malloc(); if (TRACE>2) printf(" START TIMER: starting timer at %f\n",time); /* be nice: check to see if timer is already started, if so, then warn */ /* for (q=evlist; q!=NULL && q->next!=NULL; q = q->next) */ for (q=evlist; q!=NULL ; q = q->next) if ( (q->evtype==TIMER_INTERRUPT && q->eventity==AorB) ) { printf("Warning: attempt to start a timer that is already started\n"); return; } /* create future event for when timer goes off */ evptr = (struct event *)malloc(sizeof(struct event)); evptr->evtime = time + increment; evptr->evtype = TIMER_INTERRUPT; evptr->eventity = AorB; insertevent(evptr); } /************************** TOLAYER3 ***************/ void tolayer3(AorB,packet) int AorB; /* A or B is trying to stop timer */ struct pkt packet; { struct pkt *mypktptr; struct event *evptr,*q; //char *malloc(); float lastime, x, jimsrand(); int i; ntolayer3++; /* simulate losses: */ if (jimsrand() < lossprob) { nlost++; if (TRACE>0) printf(" TOLAYER3: packet being lost\n"); return; } /* make a copy of the packet student just gave me since he/she may decide */ /* to do something with the packet after we return back to him/her */ mypktptr = (struct pkt *)malloc(sizeof(struct pkt)); mypktptr->seqnum = packet.seqnum; mypktptr->acknum = packet.acknum; mypktptr->checksum = packet.checksum; for (i=0; i<20; i++) mypktptr->payload[i] = packet.payload[i]; if (TRACE>2) { printf(" TOLAYER3: seq: %d, ack %d, check: %d ", mypktptr->seqnum, mypktptr->acknum, mypktptr->checksum); for (i=0; i<20; i++) printf("%c",mypktptr->payload[i]); printf("\n"); } /* create future event for arrival of packet at the other side */ evptr = (struct event *)malloc(sizeof(struct event)); evptr->evtype = FROM_LAYER3; /* packet will pop out from layer3 */ evptr->eventity = (AorB+1) % 2; /* event occurs at other entity */ evptr->pktptr = mypktptr; /* save ptr to my copy of packet */ /* finally, compute the arrival time of packet at the other end. medium can not reorder, so make sure packet arrives between 1 and 10 time units after the latest arrival time of packets currently in the medium on their way to the destination */ lastime = time; /* for (q=evlist; q!=NULL && q->next!=NULL; q = q->next) */ for (q=evlist; q!=NULL ; q = q->next) if ( (q->evtype==FROM_LAYER3 && q->eventity==evptr->eventity) ) lastime = q->evtime; evptr->evtime = lastime + 1 + 9*jimsrand(); /* simulate corruption: */ if (jimsrand() < corruptprob) { ncorrupt++; if ( (x = jimsrand()) < .75) mypktptr->payload[0]='Z'; /* corrupt payload */ else if (x < .875) mypktptr->seqnum = 999999; else mypktptr->acknum = 999999; if (TRACE>0) printf(" TOLAYER3: packet being corrupted\n"); } if (TRACE>2) printf(" TOLAYER3: scheduling arrival on other side\n"); insertevent(evptr); } void tolayer5(AorB,datasent) int AorB; char datasent[20]; { int i; if (TRACE>2) { printf(" TOLAYER5: data received: "); for (i=0; i<20; i++) printf("%c",datasent[i]); printf("\n"); } }
the_stack_data/23576383.c
#include <stdio.h> #define MAXN 10 int Sum(int List[], int N); int main() { int List[MAXN], N, i; scanf("%d", &N); for (i = 0; i < N; i++) scanf("%d", &List[i]); printf("%d\n", Sum(List, N)); return 0; } int Sum(int List[], int N) { int i, sum = 0; for (i = 0; i < N; i++) sum += List[i]; return sum; }
the_stack_data/161081801.c
#include <stdlib.h> typedef struct mytype mytype; int main(){ mytype *a = NULL; return (int)a; }
the_stack_data/59513660.c
#include<stdio.h> int main() { int array[20]={12,35,3,4,56,14,34,89.40,60,52,54,50,78,20,19,23,20,253,1}; int max = 12; int min = 35; for(int i=0; i<19; i++) { if(array[i] < min) min = array[i]; if(array[i] > max) max = array[i]; } printf("min_maxmum_value %d %d", min, max); }
the_stack_data/132953689.c
/* * Copyright (C) 2008 The Android Open Source Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 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 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include <string.h> #include <stdint.h> void* memset(void* dst, int c, size_t n) { char* q = dst; char* end = q + n; for (;;) { if (q >= end) break; *q++ = (char) c; if (q >= end) break; *q++ = (char) c; if (q >= end) break; *q++ = (char) c; if (q >= end) break; *q++ = (char) c; } return dst; }
the_stack_data/26700920.c
#include "stdio.h" struct st{ int a; long long c; } st1; struct st a[5]; int main() { st1.a = 212; a[2] = st1; printf("%d\n", a[2].a); return 0; }
the_stack_data/178265768.c
#include<stdio.h> #include<stdlib.h> struct node{ int data; struct node *left,*right; }; struct node *root=NULL; struct node *insert(struct node *root,int item) { struct node *temp,*current,*prev; temp=(struct node*)malloc(sizeof(struct node)); temp->data=item; temp->left=temp->right=NULL; if(root==NULL) root=temp; else { prev=current=root; while(current!=NULL) { prev=current; if(item<=current->data) current=current->left; else current=current->right; } if(item<=prev->data) prev->left=temp; else prev->right=temp; return root; } } void preorder(struct node *root) { if(root!=NULL) { printf("%d",root->data); preorder(root->left); preorder(root->right); } } void inorder(struct node *root) { if(root!=NULL) { inorder(root->left); printf("%d",root->data); inorder(root->right); } } void postorder(struct node *root) { if(root!=NULL) { postorder(root->left); postorder(root->right); printf("%d",root->data); } } void main() { struct node *root=NULL; int item,ch; while(1) { printf("\n1.insert\n2.inorder\n3.preorder\n4.postorder\n5.exit"); printf("\nenter your choice"); scanf("%d",&ch); switch(ch) { case 1:printf("enter the item:"); scanf("%d",&item); root=insert(root,item); break; case 2:inorder(root); break; case 3:preorder(root); break; case 4:postorder(root); break; case 5:exit(0); } } }
the_stack_data/182954371.c
#include<stdio.h> int main() { float f[10][10],x[10],y[10],a,u,h,s,p=1.0; int n,i,j; printf("Enter the value of n\n"); scanf("%d",&n); printf("Enter x values\n"); for(i=0;i<=n;i++) scanf("%f",&x[i]); printf("Enter y values\n"); for(i=0;i<=n;i++) scanf("%f",&y[i]); printf("Enter interpolating point\n"); scanf("%f",&a); h=x[1]-x[0]; u=(a-x[n])/h; s=y[n]; for(j=0;j<=n;j++) f[0][j]=y[j]; for(i=1;i<=n;i++) for(j=i;j<=n;j++) f[i][j]=f[i-1][j]-f[i-1][j-1]; for(i=1;i<=n;i++) { p=p*(u+i-1)/i; s=s+p*f[i][n]; } printf("%6.5f\n",s ); }
the_stack_data/145936.c
#include<stdlib.h> #include<stdio.h> int main() { int alfabeto[26]; int i=0; printf("O alfabeto eh: "); for (i=0; i<26; i++) { alfabeto[i] = i+65; // http://www.asciitable.com/ printf("%c ", (char) alfabeto[i]); } printf("."); printf("\n\n"); system("PAUSE"); return 0; } // Por que na linha 11 somou 65?
the_stack_data/917713.c
/* This function is an iterative approach * to finding prime numbers. It checks the * modulus of each number up to the square * of the integer you want to test */ #include <math.h> #include <stdint.h> /* Detects whether int is prime */ int is_prime(int32_t s) { int32_t res = !(s <= 2 || (s & 0x1) != 1); int32_t top = (int32_t) round(sqrt((float) s)); for(int32_t i = 3; res && i <= top; i += ((res = !(s % i == 0)), 2)) ; return (res || s == 2); }
the_stack_data/45450093.c
/*Write a Program accept records of different states using array of structures. The structure should contain char state and number of int engineering colleges, int medical colleges, int management colleges, and int universities. Calculate the total colleges and display the state, which is having highest number of colleges. */ #include<stdio.h> struct names{ char state[10]; int engineering, medical, management, university, total; }; int main() { int n, i, max=0; printf("Enter the number of states to accept: "); scanf("%d", &n); struct names arr[n]; for(i=0; i<n; i++) { printf("Enter the name of the state number %d: ", i+1); scanf("%s", &arr[i].state); printf("Enter the number of Engineering Colleges: "); scanf("%d", &arr[i].engineering); printf("Enter the number of Medical Colleges: "); scanf("%d", &arr[i].medical); printf("Enter the number of Management Colleges: "); scanf("%d", &arr[i].management); printf("Enter the number of Universities: "); scanf("%d", &arr[i].university); arr[i].total = arr[i].engineering + arr[i].medical + arr[i].management + arr[i].university; if(arr[i].total > arr[max].total) max = i; } printf("SI.No.\tState\tEngineering\tMedical\tManagement\tUniversities\n"); for(i=0; i<n; i++) { printf("%d\t%s\t%d\t%d\t%d\t%d\n", i+1, arr[i].state, arr[i].engineering, arr[i].medical, arr[i].management, arr[i].university); } printf("The state with maximum number of colleges is %s \n", arr[max].state); }
the_stack_data/86075916.c
#include<stdio.h> void main() { int marks[7]; int total=0; float avg=0; for(int i=0; i<7; i++) { do { printf(" Enter Marks #%d :- ", (i+1)); scanf("%d",&marks[i]); } while(marks[i]<0 || marks[i]>100); total+=marks[i]; } avg=total/7.0; printf(" Your Total Marks Are :- %d \n",total); printf(" Your Average Marks Are :- %f \n",avg); if(avg>=0 && avg<=100) { if(avg>80) { printf("* Grade A *"); } else if(avg>50) { printf("* Grade B *"); } else if(avg>35) { printf("* Grade C *"); } else { printf("* FAIL *"); } } else { printf("* INVALID CHOICE *"); } }
the_stack_data/237642090.c
#line 3 "lex.yy.c" #define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 6 #define YY_FLEX_SUBMINOR_VERSION 4 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ #include <stdio.h> #include <string.h> #include <errno.h> #include <stdlib.h> /* end standard C headers. */ /* flex integer type definitions */ #ifndef FLEXINT_H #define FLEXINT_H /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, * if you want the limit (max/min) macros for int types. */ #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS 1 #endif #include <inttypes.h> typedef int8_t flex_int8_t; typedef uint8_t flex_uint8_t; typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; /* Limits of integral types. */ #ifndef INT8_MIN #define INT8_MIN (-128) #endif #ifndef INT16_MIN #define INT16_MIN (-32767-1) #endif #ifndef INT32_MIN #define INT32_MIN (-2147483647-1) #endif #ifndef INT8_MAX #define INT8_MAX (127) #endif #ifndef INT16_MAX #define INT16_MAX (32767) #endif #ifndef INT32_MAX #define INT32_MAX (2147483647) #endif #ifndef UINT8_MAX #define UINT8_MAX (255U) #endif #ifndef UINT16_MAX #define UINT16_MAX (65535U) #endif #ifndef UINT32_MAX #define UINT32_MAX (4294967295U) #endif #ifndef SIZE_MAX #define SIZE_MAX (~(size_t)0) #endif #endif /* ! C99 */ #endif /* ! FLEXINT_H */ /* begin standard C++ headers. */ /* TODO: this is always defined, so inline it */ #define yyconst const #if defined(__GNUC__) && __GNUC__ >= 3 #define yynoreturn __attribute__((__noreturn__)) #else #define yynoreturn #endif /* Returned upon end-of-file. */ #define YY_NULL 0 /* Promotes a possibly negative, possibly signed char to an * integer in range [0..255] for use as an array index. */ #define YY_SC_TO_UI(c) ((YY_CHAR) (c)) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN (yy_start) = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ #define YY_NEW_FILE yyrestart( yyin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #ifndef YY_BUF_SIZE #ifdef __ia64__ /* On IA-64, the buffer size is 16k, not 8k. * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. * Ditto for the __ia64__ case accordingly. */ #define YY_BUF_SIZE 32768 #else #define YY_BUF_SIZE 16384 #endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. */ #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) #ifndef YY_TYPEDEF_YY_BUFFER_STATE #define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T typedef size_t yy_size_t; #endif extern int yyleng; extern FILE *yyin, *yyout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires * access to the local variable yy_act. Since yyless() is a macro, it would break * existing scanners that call yyless() from OUTSIDE yylex. * One obvious solution it to make yy_act a global. I tried that, and saw * a 5% performance hit in a non-yylineno scanner, because yy_act is * normally declared as a register variable-- so it is not worth it. */ #define YY_LESS_LINENO(n) \ do { \ int yyl;\ for ( yyl = n; yyl < yyleng; ++yyl )\ if ( yytext[yyl] == '\n' )\ --yylineno;\ }while(0) #define YY_LINENO_REWIND_TO(dst) \ do {\ const char *p;\ for ( p = yy_cp-1; p >= (dst); --p)\ if ( *p == '\n' )\ --yylineno;\ }while(0) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) #define unput(c) yyunput( c, (yytext_ptr) ) #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state { FILE *yy_input_file; char *yy_ch_buf; /* input buffer */ char *yy_buf_pos; /* current position in input buffer */ /* Size of input buffer in bytes, not including room for EOB * characters. */ int yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to * delete it. */ int yy_is_our_buffer; /* Whether this is an "interactive" input source; if so, and * if we're using stdio for input, then we want to use getc() * instead of fread(), to make sure we stop fetching input after * each newline. */ int yy_is_interactive; /* Whether we're considered to be at the beginning of a line. * If so, '^' rules will be active on the next match, otherwise * not. */ int yy_at_bol; int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process * then we mark the buffer as YY_EOF_PENDING, to indicate that we * shouldn't try reading from the input source any more. We might * still have a bunch of tokens to match, though, because of * possible backing-up. * * When we actually see the EOF, we change the status to "new" * (via yyrestart()), so that the user can continue scanning by * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ /* Stack of input buffers. */ static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". * * Returns the top of the stack, or NULL. */ #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ : NULL) /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ int yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = NULL; static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ /* Flag which is used to allow yywrap()'s to do buffer switches * instead of setting up a fresh yyin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; void yyrestart ( FILE *input_file ); void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer ); YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size ); void yy_delete_buffer ( YY_BUFFER_STATE b ); void yy_flush_buffer ( YY_BUFFER_STATE b ); void yypush_buffer_state ( YY_BUFFER_STATE new_buffer ); void yypop_buffer_state ( void ); static void yyensure_buffer_stack ( void ); static void yy_load_buffer_state ( void ); static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file ); #define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER ) YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size ); YY_BUFFER_STATE yy_scan_string ( const char *yy_str ); YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len ); void *yyalloc ( yy_size_t ); void *yyrealloc ( void *, yy_size_t ); void yyfree ( void * ); #define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ yy_create_buffer( yyin, YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ yy_create_buffer( yyin, YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ typedef flex_uint8_t YY_CHAR; FILE *yyin = NULL, *yyout = NULL; typedef int yy_state_type; #define YY_FLEX_LEX_COMPAT extern int yylineno; int yylineno = 1; extern char yytext[]; static yy_state_type yy_get_previous_state ( void ); static yy_state_type yy_try_NUL_trans ( yy_state_type current_state ); static int yy_get_next_buffer ( void ); static void yynoreturn yy_fatal_error ( const char* msg ); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ yyleng = (int) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ if ( yyleng >= YYLMAX ) \ YY_FATAL_ERROR( "token too large, exceeds YYLMAX" ); \ yy_flex_strncpy( yytext, (yytext_ptr), yyleng + 1 ); \ (yy_c_buf_p) = yy_cp; #define YY_NUM_RULES 5 #define YY_END_OF_BUFFER 6 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info { flex_int32_t yy_verify; flex_int32_t yy_nxt; }; static const flex_int16_t yy_accept[17] = { 0, 0, 0, 6, 4, 5, 3, 3, 3, 3, 3, 3, 3, 2, 3, 1, 0 } ; static const YY_CHAR yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 4, 5, 4, 6, 7, 4, 8, 4, 9, 4, 4, 4, 4, 10, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, 4, 1, 4, 5, 4, 6, 7, 4, 8, 4, 9, 4, 4, 4, 4, 10, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; static const YY_CHAR yy_meta[11] = { 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2 } ; static const flex_int16_t yy_base[18] = { 0, 0, 0, 18, 19, 19, 0, 10, 6, 0, 7, 8, 4, 0, 2, 0, 19, 9 } ; static const flex_int16_t yy_def[18] = { 0, 16, 1, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 16 } ; static const flex_int16_t yy_nxt[30] = { 0, 4, 5, 4, 6, 7, 6, 8, 6, 6, 6, 9, 15, 14, 13, 12, 11, 10, 16, 3, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 } ; static const flex_int16_t yy_chk[30] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 17, 14, 12, 11, 10, 8, 7, 3, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 } ; /* Table of booleans, true if rule could match eol. */ static const flex_int32_t yy_rule_can_match_eol[6] = { 0, 0, 0, 0, 0, 0, }; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; extern int yy_flex_debug; int yy_flex_debug = 0; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ #define REJECT reject_used_but_not_detected #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET #ifndef YYLMAX #define YYLMAX 8192 #endif char yytext[YYLMAX]; char *yytext_ptr; #line 1 "scan.l" #line 2 "scan.l" #include <stdio.h> int yywrap(void); int yylex(void); #line 481 "lex.yy.c" #line 482 "lex.yy.c" #define INITIAL 0 #ifndef YY_NO_UNISTD_H /* Special case for "unistd.h", since it is non-ANSI. We include it way * down here because we want the user's section 1 to have been scanned first. * The user has a chance to override it with an option. */ #include <unistd.h> #endif #ifndef YY_EXTRA_TYPE #define YY_EXTRA_TYPE void * #endif static int yy_init_globals ( void ); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ int yylex_destroy ( void ); int yyget_debug ( void ); void yyset_debug ( int debug_flag ); YY_EXTRA_TYPE yyget_extra ( void ); void yyset_extra ( YY_EXTRA_TYPE user_defined ); FILE *yyget_in ( void ); void yyset_in ( FILE * _in_str ); FILE *yyget_out ( void ); void yyset_out ( FILE * _out_str ); int yyget_leng ( void ); char *yyget_text ( void ); int yyget_lineno ( void ); void yyset_lineno ( int _line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus extern "C" int yywrap ( void ); #else extern int yywrap ( void ); #endif #endif #ifndef YY_NO_UNPUT static void yyunput ( int c, char *buf_ptr ); #endif #ifndef yytext_ptr static void yy_flex_strncpy ( char *, const char *, int ); #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen ( const char * ); #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput ( void ); #else static int input ( void ); #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE #ifdef __ia64__ /* On IA-64, the buffer size is 16k, not 8k */ #define YY_READ_BUF_SIZE 16384 #else #define YY_READ_BUF_SIZE 8192 #endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ #define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ int n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ if ( c == EOF && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \ { \ if( errno != EINTR) \ { \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ break; \ } \ errno=0; \ clearerr(yyin); \ } \ }\ \ #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */ #ifndef yyterminate #define yyterminate() return YY_NULL #endif /* Number of entries by which start-condition stack grows. */ #ifndef YY_START_STACK_INCR #define YY_START_STACK_INCR 25 #endif /* Report a fatal error. */ #ifndef YY_FATAL_ERROR #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif /* end tables serialization structures and prototypes */ /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL #define YY_DECL_IS_OURS 1 extern int yylex (void); #define YY_DECL int yylex (void) #endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. */ #ifndef YY_USER_ACTION #define YY_USER_ACTION #endif /* Code executed at the end of each rule. */ #ifndef YY_BREAK #define YY_BREAK /*LINTED*/break; #endif #define YY_RULE_SETUP \ YY_USER_ACTION /** The main scanner function which does all the work. */ YY_DECL { yy_state_type yy_current_state; char *yy_cp, *yy_bp; int yy_act; if ( !(yy_init) ) { (yy_init) = 1; #ifdef YY_USER_INIT YY_USER_INIT; #endif if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ if ( ! yyin ) yyin = stdin; if ( ! yyout ) yyout = stdout; if ( ! YY_CURRENT_BUFFER ) { yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = yy_create_buffer( yyin, YY_BUF_SIZE ); } yy_load_buffer_state( ); } { #line 6 "scan.l" #line 701 "lex.yy.c" while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); /* Support of yytext. */ *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; yy_current_state = (yy_start); yy_match: do { YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 17 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; ++yy_cp; } while ( yy_base[yy_current_state] != 19 ); yy_find_action: yy_act = yy_accept[yy_current_state]; if ( yy_act == 0 ) { /* have to back up */ yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); yy_act = yy_accept[yy_current_state]; } YY_DO_BEFORE_ACTION; if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) { int yyl; for ( yyl = 0; yyl < yyleng; ++yyl ) if ( yytext[yyl] == '\n' ) yylineno++; ; } do_action: /* This label is used only to access EOF actions. */ switch ( yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = (yy_hold_char); yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); goto yy_find_action; case 1: YY_RULE_SETUP #line 7 "scan.l" { printf("KWD"); } YY_BREAK case 2: YY_RULE_SETUP #line 8 "scan.l" { printf("KWD"); } YY_BREAK case 3: YY_RULE_SETUP #line 9 "scan.l" { printf("ID"); } YY_BREAK case 4: YY_RULE_SETUP #line 10 "scan.l" { putchar(*yytext); } YY_BREAK case 5: YY_RULE_SETUP #line 11 "scan.l" ECHO; YY_BREAK #line 793 "lex.yy.c" case YY_STATE_EOF(INITIAL): yyterminate(); case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ *yy_cp = (yy_hold_char); YY_RESTORE_YY_MORE_OFFSET if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed yyin at a new source and called * yylex(). If so, then we have to assure * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position * of the first EOB in the buffer, since yy_c_buf_p will * already have been incremented past the NUL character * (since all states make transitions on EOB to the * end-of-buffer state). Contrast this with the test * in input(). */ if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) { /* This was really a NUL. */ yy_state_type yy_next_state; (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); /* Okay, we're now positioned to make the NUL * transition. We couldn't have * yy_get_previous_state() go ahead and do it * for us because it doesn't know how to deal * with the possibility of jamming (and we don't * want to build jamming into it because then it * will run more slowly). */ yy_next_state = yy_try_NUL_trans( yy_current_state ); yy_bp = (yytext_ptr) + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ yy_cp = ++(yy_c_buf_p); yy_current_state = yy_next_state; goto yy_match; } else { yy_cp = (yy_c_buf_p); goto yy_find_action; } } else switch ( yy_get_next_buffer( ) ) { case EOB_ACT_END_OF_FILE: { (yy_did_buffer_switch_on_eof) = 0; if ( yywrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * yytext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; } else { if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: (yy_c_buf_p) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_find_action; } break; } default: YY_FATAL_ERROR( "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ } /* end of user's declarations */ } /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer (void) { char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; char *source = (yytext_ptr); int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; } else { /* We matched some text prior to the EOB, first * process it. */ return EOB_ACT_LAST_MATCH; } } /* Try to read more data. */ /* First move last chars to start of buffer. */ number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1); for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; else { int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; int yy_c_buf_p_offset = (int) ((yy_c_buf_p) - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; else b->yy_buf_size *= 2; b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ yyrealloc( (void *) b->yy_ch_buf, (yy_size_t) (b->yy_buf_size + 2) ); } else /* Can't grow it, we don't own it. */ b->yy_ch_buf = NULL; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), (yy_n_chars), num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } if ( (yy_n_chars) == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; yyrestart( yyin ); } else { ret_val = EOB_ACT_LAST_MATCH; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); /* "- 2" to take care of EOB's */ YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); } (yy_n_chars) += number_to_move; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state (void) { yy_state_type yy_current_state; char *yy_cp; yy_current_state = (yy_start); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 17 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; } return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { int yy_is_jam; char *yy_cp = (yy_c_buf_p); YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 17 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; yy_is_jam = (yy_current_state == 16); return yy_is_jam ? 0 : yy_current_state; } #ifndef YY_NO_UNPUT static void yyunput (int c, char * yy_bp ) { char *yy_cp; yy_cp = (yy_c_buf_p); /* undo effects of setting up yytext */ *yy_cp = (yy_hold_char); if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ int number_to_move = (yy_n_chars) + 2; char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; char *source = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) *--dest = *--source; yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); } *--yy_cp = (char) c; if ( c == '\n' ){ --yylineno; } (yytext_ptr) = yy_bp; (yy_hold_char) = *yy_cp; (yy_c_buf_p) = yy_cp; } #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) #else static int input (void) #endif { int c; *(yy_c_buf_p) = (yy_hold_char); if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) /* This was really a NUL. */ *(yy_c_buf_p) = '\0'; else { /* need more input */ int offset = (int) ((yy_c_buf_p) - (yytext_ptr)); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() * sees that we've accumulated a * token and flags that we need to * try matching the token before * proceeding. But for input(), * there's no matching to consider. * So convert the EOB_ACT_LAST_MATCH * to EOB_ACT_END_OF_FILE. */ /* Reset buffer status. */ yyrestart( yyin ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { if ( yywrap( ) ) return 0; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); #else return input(); #endif } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + offset; break; } } } c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ *(yy_c_buf_p) = '\0'; /* preserve yytext */ (yy_hold_char) = *++(yy_c_buf_p); if ( c == '\n' ) yylineno++; ; return c; } #endif /* ifndef YY_NO_INPUT */ /** Immediately switch to a different input stream. * @param input_file A readable stream. * * @note This function does not reset the start condition to @c INITIAL . */ void yyrestart (FILE * input_file ) { if ( ! YY_CURRENT_BUFFER ){ yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = yy_create_buffer( yyin, YY_BUF_SIZE ); } yy_init_buffer( YY_CURRENT_BUFFER, input_file ); yy_load_buffer_state( ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * */ void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) { /* TODO. We should be able to replace this entire function body * with * yypop_buffer_state(); * yypush_buffer_state(new_buffer); */ yyensure_buffer_stack (); if ( YY_CURRENT_BUFFER == new_buffer ) return; if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } YY_CURRENT_BUFFER_LVALUE = new_buffer; yy_load_buffer_state( ); /* We don't actually know whether we did this switch during * EOF (yywrap()) processing, but the only time this flag * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ (yy_did_buffer_switch_on_eof) = 1; } static void yy_load_buffer_state (void) { (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; (yy_hold_char) = *(yy_c_buf_p); } /** Allocate and initialize an input buffer state. * @param file A readable stream. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. * * @return the allocated buffer state. */ YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; yy_init_buffer( b, file ); return b; } /** Destroy the buffer. * @param b a buffer created with yy_create_buffer() * */ void yy_delete_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) yyfree( (void *) b->yy_ch_buf ); yyfree( (void *) b ); } /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a yyrestart() or at EOF. */ static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) { int oerrno = errno; yy_flush_buffer( b ); b->yy_input_file = file; b->yy_fill_buffer = 1; /* If b is the current buffer, then yy_init_buffer was _probably_ * called from yyrestart() or through yy_get_next_buffer. * In that case, we don't want to reset the lineno or column. */ if (b != YY_CURRENT_BUFFER){ b->yy_bs_lineno = 1; b->yy_bs_column = 0; } b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; errno = oerrno; } /** Discard all buffered characters. On the next scan, YY_INPUT will be called. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * */ void yy_flush_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; b->yy_n_chars = 0; /* We always need two end-of-buffer characters. The first causes * a transition to the end-of-buffer state. The second causes * a jam in that state. */ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; b->yy_buf_pos = &b->yy_ch_buf[0]; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) yy_load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes * the current state. This function will allocate the stack * if necessary. * @param new_buffer The new state. * */ void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) { if (new_buffer == NULL) return; yyensure_buffer_stack(); /* This block is copied from yy_switch_to_buffer. */ if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } /* Only push if top exists. Otherwise, replace top. */ if (YY_CURRENT_BUFFER) (yy_buffer_stack_top)++; YY_CURRENT_BUFFER_LVALUE = new_buffer; /* copied from yy_switch_to_buffer. */ yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } /** Removes and deletes the top of the stack, if present. * The next element becomes the new top. * */ void yypop_buffer_state (void) { if (!YY_CURRENT_BUFFER) return; yy_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; if ((yy_buffer_stack_top) > 0) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } } /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ static void yyensure_buffer_stack (void) { yy_size_t num_to_alloc; if (!(yy_buffer_stack)) { /* First allocation is just for 2 elements, since we don't know if this * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; (yy_buffer_stack_top) = 0; return; } if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ /* Increase the buffer to prepare for a possible push. */ yy_size_t grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); /* zero only the new slots.*/ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; } } /** Setup the input buffer state to scan directly from a user-specified character buffer. * @param base the character buffer * @param size the size in bytes of the character buffer * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) { YY_BUFFER_STATE b; if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return NULL; b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; b->yy_input_file = NULL; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; yy_switch_to_buffer( b ); return b; } /** Setup the input buffer state to scan a string. The next call to yylex() will * scan from a @e copy of @a str. * @param yystr a NUL-terminated string to scan * * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use * yy_scan_bytes() instead. */ YY_BUFFER_STATE yy_scan_string (const char * yystr ) { return yy_scan_bytes( yystr, (int) strlen(yystr) ); } /** Setup the input buffer state to scan the given bytes. The next call to yylex() will * scan from a @e copy of @a bytes. * @param yybytes the byte buffer to scan * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len ) { YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; /* Get memory for full buffer, including space for trailing EOB's. */ n = (yy_size_t) (_yybytes_len + 2); buf = (char *) yyalloc( n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); for ( i = 0; i < _yybytes_len; ++i ) buf[i] = yybytes[i]; buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; b = yy_scan_buffer( buf, n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. */ b->yy_is_our_buffer = 1; return b; } #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif static void yynoreturn yy_fatal_error (const char* msg ) { fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ yytext[yyleng] = (yy_hold_char); \ (yy_c_buf_p) = yytext + yyless_macro_arg; \ (yy_hold_char) = *(yy_c_buf_p); \ *(yy_c_buf_p) = '\0'; \ yyleng = yyless_macro_arg; \ } \ while ( 0 ) /* Accessor methods (get/set functions) to struct members. */ /** Get the current line number. * */ int yyget_lineno (void) { return yylineno; } /** Get the input stream. * */ FILE *yyget_in (void) { return yyin; } /** Get the output stream. * */ FILE *yyget_out (void) { return yyout; } /** Get the length of the current token. * */ int yyget_leng (void) { return yyleng; } /** Get the current token. * */ char *yyget_text (void) { return yytext; } /** Set the current line number. * @param _line_number line number * */ void yyset_lineno (int _line_number ) { yylineno = _line_number; } /** Set the input stream. This does not discard the current * input buffer. * @param _in_str A readable stream. * * @see yy_switch_to_buffer */ void yyset_in (FILE * _in_str ) { yyin = _in_str ; } void yyset_out (FILE * _out_str ) { yyout = _out_str ; } int yyget_debug (void) { return yy_flex_debug; } void yyset_debug (int _bdebug ) { yy_flex_debug = _bdebug ; } static int yy_init_globals (void) { /* Initialization is the same as for the non-reentrant scanner. * This function is called from yylex_destroy(), so don't allocate here. */ /* We do not touch yylineno unless the option is enabled. */ yylineno = 1; (yy_buffer_stack) = NULL; (yy_buffer_stack_top) = 0; (yy_buffer_stack_max) = 0; (yy_c_buf_p) = NULL; (yy_init) = 0; (yy_start) = 0; /* Defined in main.c */ #ifdef YY_STDINIT yyin = stdin; yyout = stdout; #else yyin = NULL; yyout = NULL; #endif /* For future reference: Set errno on error, since we are called by * yylex_init() */ return 0; } /* yylex_destroy is for both reentrant and non-reentrant scanners. */ int yylex_destroy (void) { /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ yy_delete_buffer( YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; yypop_buffer_state(); } /* Destroy the stack itself. */ yyfree((yy_buffer_stack) ); (yy_buffer_stack) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time * yylex() is called, initialization will occur. */ yy_init_globals( ); return 0; } /* * Internal utility routines. */ #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, const char * s2, int n ) { int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (const char * s ) { int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif void *yyalloc (yy_size_t size ) { return malloc(size); } void *yyrealloc (void * ptr, yy_size_t size ) { /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter * because both ANSI C and C++ allow castless assignment from * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ return realloc(ptr, size); } void yyfree (void * ptr ) { free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" #line 11 "scan.l" int yywrap(void) { return 1; } int main(void) { return yylex(); }
the_stack_data/175142097.c
#include <stdio.h> #include <stdlib.h> #define PAYRATE 12.00 #define TAXRATE_300 .15 #define TAXRATE_150 .20 #define TAXRATE_REST .25 #define OVERTIME 40 int main() { // declare variables int hours = 0; double grossPay = 0.0; double taxes = 0.0; double netPay = 0.0; printf("Please enter the number of hours worked this week: "); // get the input scanf("%d", &hours); // calculate the gross pay if (hours <= 40) grossPay = hours * PAYRATE; else { grossPay = 40 * PAYRATE; double overTimePay = (hours - 40) * (PAYRATE * 1.5); grossPay += overTimePay; } // calculate taxes if (grossPay <= 300) { taxes = grossPay * TAXRATE_300; } else if(grossPay > 300 && grossPay <= 450) { taxes = 300 * TAXRATE_300; taxes += (grossPay - 300) * TAXRATE_150; } else if (grossPay > 450) { taxes = 300 * TAXRATE_300; taxes += 150 * TAXRATE_150; taxes += (grossPay - 450) * TAXRATE_REST; } // calculate the netpay netPay = grossPay - taxes; // display output printf("Your gross pay this week is: %.2f\n", grossPay); printf("Your taxes this week is: %.2f\n", taxes); printf("Your net pay this week is: %.2f\n", netPay); return 0; }
the_stack_data/67326009.c
/* * main.c * * Created on: 25 de mar de 2021 * Author: igor */ /* * https://www.cescaper.com/ é um site que ajuda a por escape em strings */ #include <stdio.h> int main(){ printf("\n\n"); // ------------------------------------------------------------------------------------------- //printf("TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT\rXXXXXXXXXX"); //printf("\rOOOOOOOOOOOOOOOOOOOOO"); /* Terminal: * >> OOOOOOOOOOOOOOOOOOOOOTTTTTTTTTTT * * Info: * \r (carriage return) faz o cursor retornar para o início da linha, sem saltar uma linha. */ // ------------------------------------------------------------------------------------------- // printf("David says , \" Programming is fun !\"\nGood day !"); /* Terminal: * >> David says , " Programming is fun !" * >> Good day ! * * Info: * \" é a sequence escape para printar " */ // ------------------------------------------------------------------------------------------- // printf("David says , \" Programming is fun !\"\n"); // printf("**Conditions apply, \"Offers valid until tomorrow\"\n"); // printf("C:\\My computer\\My folder\n"); // printf("D:/My documents/My file\n"); // printf("\\\\\\\\Today is holiday\\\\\\\\\n"); // printf("This is a triple quoted string \"\"\" This month has 30 days \"\"\""); /* Terminal: * David says , " Programming is fun !" * **Conditions apply, "Offers valid until tomorrow" * C:\My computer\My folder * D:/My documents/My file * \\\\Today is holiday\\\\ * This is a triple quoted string """ This month has 30 days """ */ printf("\n\n"); }
the_stack_data/180665.c
enum { M = 64 }; main(argc,argv) int argc; char *argv[]; { int l, m, a; for(m=0;m<M;l++) a= 0; }
the_stack_data/61075392.c
int main(void) { char a[5] = {1, 2, 3, 4, 5}; return a[5]; }
the_stack_data/108961.c
extern int __fpclassifyd (double x); double fdim (double x, double y) { int c = __fpclassifyd (x); if (c == 0) return (x); if (__fpclassifyd (y) == 0) return (y); if (c == 1) return (__builtin_huge_val ()); return x > y ? x - y : 0.0; }
the_stack_data/237643318.c
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| |* This code was written by | |* BluedocTeam | |* BlueDoc Text Editor was made | |* for use in note taking, | |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ // _italics_ **bold** * list //```code``` >quotes // Stuff I prolly need included? #define _DEFAULT_SOURCE #define _BSD_SOURCE #define _GNU_SOURCE #include <ctype.h> #include <errno.h> #include <fcntl.h> #include <stdio.h> #include <stdarg.h> #include <stdlib.h> #include <sys/ioctl.h> #include <sys/types.h> #include <termios.h> #include <time.h> #include <unistd.h> //defines #define BLUE_VERSION "0.0.2" #define BLUE_TAB_STOP 8 #define BLUE_QUIT_TIMES 2 #define CTRL_KEY(k) ((k) & 0x1f) enum editorKey { BACKSPACE = 127, ARROW_LEFT = 1000, ARROW_RIGHT, ARROW_UP, ARROW_DOWN, DEL_KEY, HOME_KEY, END_KEY, PAGE_UP, PAGE_DOWN }; enum editorHighlight { HL_NORMAL = 0, HL_COMMENT, HL_MLCOMMENT, HL_KEYWORD1, HL_KEYWORD2, HL_STRING, HL_NUMBER, HL_MATCH, }; #define HL_HIGHLIGHT_NUMBERS (1<<0) #define HL_HIGHLIGHT_STRINGS (1<<1) //could kill everyone here if needed (data) struct editorSyntax { char *filetype; char **filematch; char **keywords; char *singleline_comment_start; char *multiline_comment_start; char *multiline_comment_end; int flags; }; typedef struct erow { int idx; int size; int rsize; char *chars; char *render; unsigned char *hl; int hl_open_comment; } erow; struct editorConfig { int cx, cy; int rx; int rowoff; int coloff; int screenrows; int screencols; int numrows; erow *row; int dirty; char *filename; char statusmsg[80]; time_t statusmsg_time; struct editorSyntax *syntax; struct termios orig_termios; }; struct editorConfig E; //filetypes char *C_HL_extensions[] = { ".notes", ".html", ".txt", ".note", NULL }; char *C_HL_keywords[] = { "date", "?", "problem", "TODO", "note", "who", "where", "what", "year", "solve", "i", "Why", "Who", "Where", "What", "%", ">>|", "Gabe|", "Gabriel|", "gabe|", "gabriel|", "error|", "+|", "-|", "/|", "*|", "test|", NULL }; struct editorSyntax HLDB[] = { { "c", C_HL_extensions, C_HL_keywords, ">>", "```", "```", HL_HIGHLIGHT_NUMBERS | HL_HIGHLIGHT_STRINGS }, }; #define HLDB_ENTRIES (sizeof(HLDB) / sizeof(HLDB[0])) //prototype void editorSetStatusMessage(const char *fmt, ...); void editorRefreshScreen(); char *editorPrompt(char *prompt, void (*callback)(char *, int)); // Windows user worst fear (terminal) void die(const char *s) { write(STDOUT_FILENO, "\x1b[2J", 4); write(STDOUT_FILENO, "\x1b[H", 3); perror(s); exit(1); } void disableRawMode() { if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &E.orig_termios) == -1) die("tcsetattr"); } void enableRawMode() { if (tcgetattr(STDIN_FILENO, &E.orig_termios) == -1) die("tcgetattr"); atexit(disableRawMode); struct termios raw = E.orig_termios; raw.c_iflag &= ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON); raw.c_oflag &= ~(OPOST); raw.c_cflag |= (CS8); raw.c_lflag &= ~(ECHO | ICANON | IEXTEN | ISIG); raw.c_cc[VMIN] = 0; raw.c_cc[VTIME] = 1; if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &raw) == -1) die("tcsetattr"); } int editorReadKey() { int nread; char c; while ((nread = read(STDIN_FILENO, &c, 1)) != 1) { if (nread == -1 && errno != EAGAIN) die("read"); } if (c == '\x1b') { char seq[3]; if (read(STDIN_FILENO, &seq[0], 1) != 1) return '\x1b'; if (read(STDIN_FILENO, &seq[1], 1) != 1) return '\x1b'; if (seq[0] == '[') { if (seq[1] >= '0' && seq[1] <= '9') { if (read(STDIN_FILENO, &seq[2], 1) != 1) return '\x1b'; if (seq[2] == '~') { switch (seq[1]) { case '1': return HOME_KEY; case '3': return DEL_KEY; case '4': return END_KEY; case '5': return PAGE_UP; case '6': return PAGE_DOWN; case '7': return HOME_KEY; case '8': return END_KEY; } } } else { switch (seq[1]) { case 'A': return ARROW_UP; case 'B': return ARROW_DOWN; case 'C': return ARROW_RIGHT; case 'D': return ARROW_LEFT; case 'H': return HOME_KEY; case 'F': return END_KEY; } } } else if (seq[0] == 'O') { switch (seq[1]) { case 'H': return HOME_KEY; case 'F': return END_KEY; } } return '\x1b'; } else { return c; } } int getCursorPosition(int *rows, int *cols) { char buf[32]; unsigned int i = 0; if (write(STDOUT_FILENO, "\x1b[6n", 4) != 4) return -1; while (i < sizeof(buf) - 1) { if (read(STDIN_FILENO, &buf[i], 1) != 1) break; if (buf[i] == 'R') break; i++; } buf[i] = '\0'; if (buf[0] != '\x1b' || buf[1] != '[') return -1; if (sscanf(&buf[2], "%d;%d", rows, cols) != 2) return -1; return 0; } int getWindowSize(int *rows, int *cols) { struct winsize ws; if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws) == -1 || ws.ws_col == 0) { if (write(STDOUT_FILENO, "\x1b[999C\x1b[999B", 12) != 12) return -1; return getCursorPosition(rows, cols); return -1; } else { *cols = ws.ws_col; *rows = ws.ws_row; return 0; } } //syntax highlighting int is_separator(int c) { return isspace(c) || c == '\0' || strchr(",.()+-/*=~%<>[];", c) != NULL; } void editorUpdateSyntax(erow *row) { row->hl = realloc(row->hl, row->rsize); memset(row->hl, HL_NORMAL, row->rsize); if (E.syntax == NULL) return; char **keywords = E.syntax->keywords; char *scs = E.syntax->singleline_comment_start; char *mcs = E.syntax->multiline_comment_start; char *mce = E.syntax->multiline_comment_end; int scs_len = scs ? strlen(scs) : 0; int mcs_len = mcs ? strlen(mcs) : 0; int mce_len = mce ? strlen(mce) : 0; int prev_sep = 1; int in_string = 0; int in_comment = (row->idx > 0 && E.row[row->idx - 1].hl_open_comment); int i = 0; while (i < row->rsize) { char c = row->render[i]; unsigned char prev_hl = (i > 0) ? row->hl[i - 1] : HL_NORMAL; if (scs_len && !in_string && !in_comment) { if (!strncmp(&row->render[i], scs, scs_len)) { memset(&row->hl[i], HL_COMMENT, row->rsize - i); break; } } if (mcs_len && mce_len && !in_string) { if (in_comment) { row->hl[i] = HL_MLCOMMENT; if (!strncmp(&row->render[i], mce, mce_len)) { memset(&row->hl[i], HL_MLCOMMENT, mce_len); i += mce_len; in_comment = 0; prev_sep = 1; continue; } else { i++; continue; } } else if (!strncmp(&row->render[i], mcs, mcs_len)) { memset(&row->hl[i], HL_MLCOMMENT, mcs_len); i += mcs_len; in_comment = 1; continue; } } if (E.syntax->flags & HL_HIGHLIGHT_STRINGS) { if (in_string) { row->hl[i] = HL_STRING; if (c == '\\' && i + 1 < row->rsize) { row->hl[i + 1] = HL_STRING; i += 2; continue; } if (c == in_string) in_string = 0; i++; prev_sep = 1; continue; } else { if (c == '"' || c == '\'') { in_string = c; row->hl[i] = HL_STRING; i++; continue; } } } if (E.syntax->flags & HL_HIGHLIGHT_NUMBERS) { if ((isdigit(c) && (prev_sep || prev_hl == HL_NUMBER)) || (c == '.' && prev_hl == HL_NUMBER)) { row->hl[i] = HL_NUMBER; i++; prev_sep = 0; continue; } } if (prev_sep) { int j; for (j = 0; keywords[j]; j++) { int klen = strlen(keywords[j]); int kw2 = keywords[j][klen - 1] == '|'; if (kw2) klen--; if (!strncmp(&row->render[i], keywords[j], klen) && is_separator(row->render[i + klen])) { memset(&row->hl[i], kw2 ? HL_KEYWORD2 : HL_KEYWORD1, klen); i += klen; break; } } if (keywords[j] != NULL) { prev_sep = 0; continue; } } prev_sep = is_separator(c); i++; } int changed = (row->hl_open_comment != in_comment); row->hl_open_comment = in_comment; if (changed && row->idx + 1 < E.numrows) editorUpdateSyntax(&E.row[row->idx + 1]); } int editorSyntaxToColor(int hl) { switch (hl) { case HL_COMMENT: case HL_MLCOMMENT: return 36; case HL_KEYWORD1: return 33; case HL_KEYWORD2: return 32; case HL_STRING: return 35; case HL_NUMBER: return 31; case HL_MATCH: return 34; default: return 37; } } void editorSelectSyntaxHighlight() { E.syntax = NULL; if (E.filename == NULL) return; char *ext = strrchr(E.filename, '.'); for (unsigned int j = 0; j < HLDB_ENTRIES; j++) { struct editorSyntax *s = &HLDB[j]; unsigned int i = 0; while (s->filematch[i]) { int is_ext = (s->filematch[i][0] == '.'); if ((is_ext && ext && !strcmp(ext, s->filematch[i])) || (!is_ext && strstr(E.filename, s->filematch[i]))) { E.syntax = s; int filerow; for (filerow = 0; filerow < E.numrows; filerow++) { editorUpdateSyntax(&E.row[filerow]); } return; } i++; } } } // row operations int editorRowCxToRx(erow *row, int cx) { int rx = 0; int j; for (j = 0; j < cx; j++) { if (row->chars[j] == '\t') rx += (BLUE_TAB_STOP - 1) - (rx % BLUE_TAB_STOP); rx++; } return rx; } //tumadreeraunhombre int editorRowRxToCx(erow *row, int rx) { int cur_rx = 0; int cx; for (cx = 0; cx < row->size; cx++) { if (row->chars[cx] == '\t') cur_rx += (BLUE_TAB_STOP - 1) - (cur_rx % BLUE_TAB_STOP); cur_rx++; if (cur_rx > rx) return cx; } return cx; } void editorUpdateRow(erow *row) { int tabs = 0; int j; for (j = 0; j < row->size; j++) if (row->chars[j] == '\t') tabs++; free(row->render); row->render = malloc(row->size + tabs*(BLUE_TAB_STOP - 1) + 1); int idx = 0; for (j = 0; j < row->size; j++) { if (row->chars[j] == '\t') { row->render[idx++] = ' '; while (idx % BLUE_TAB_STOP != 0) row->render[idx++] = ' '; } else { row->render[idx++] = row->chars[j]; } } row->render[idx] = '\0'; row->rsize = idx; editorUpdateSyntax(row); } void editorInsertRow(int at, char *s, size_t len) { if (at < 0 || at > E.numrows) return; E.row = realloc(E.row, sizeof(erow) * (E.numrows + 1)); memmove(&E.row[at + 1], &E.row[at], sizeof(erow) * (E.numrows - at)); for (int j = at + 1; j <= E.numrows; j++) E.row[j].idx++; E.row[at].idx = at; E.row[at].size = len; E.row[at].chars = malloc(len + 1); memcpy(E.row[at].chars, s, len); E.row[at].chars[len] = '\0'; E.row[at].rsize = 0; E.row[at].render = NULL; E.row[at].hl = NULL; E.row[at].hl_open_comment = 0; editorUpdateRow(&E.row[at]); E.numrows++; E.dirty++; } void editorFreeRow(erow *row) { free(row->render); free(row->chars); free(row->hl); } void editorDelRow(int at) { if (at < 0 || at >= E.numrows) return; editorFreeRow(&E.row[at]); memmove(&E.row[at], &E.row[at + 1], sizeof(erow) * (E.numrows - at - 1)); for (int j = at; j < E.numrows - 1; j++) E.row[j].idx--; E.numrows--; E.dirty++; } void editorRowInsertChar(erow *row, int at, int c) { if (at < 0 || at > row->size) at = row->size; row->chars = realloc(row->chars, row->size + 2); memmove(&row->chars[at + 1], &row->chars[at], row->size - at + 1); row->size++; row->chars[at] = c; editorUpdateRow(row); E.dirty++; } void editorRowAppendString(erow *row, char *s, size_t len) { row->chars = realloc(row->chars, row->size + len + 1); memcpy(&row->chars[row->size], s, len); row->size += len; row->chars[row->size] = '\0'; editorUpdateRow(row); E.dirty++; } void editorRowDelChar(erow *row, int at) { if (at < 0 || at >= row->size) return; memmove(&row->chars[at], &row->chars[at + 1], row->size - at); row->size--; editorUpdateRow(row); E.dirty++; } //editor operations void editorInsertChar(int c) { if (E.cy == E.numrows) { editorInsertRow(E.numrows, "", 0); } editorRowInsertChar(&E.row[E.cy], E.cx, c); E.cx++; } void editorInsertNewline() { if (E.cx == 0) { editorInsertRow(E.cy, "", 0); } else { erow *row = &E.row[E.cy]; editorInsertRow(E.cy + 1, &row->chars[E.cx], row->size - E.cx); row = &E.row[E.cy]; row->size = E.cx; row->chars[row->size] = '\0'; editorUpdateRow(row); } E.cy++; E.cx = 0; } void editorDelChar() { if (E.cy == E.numrows) return; if (E.cx == 0 && E.cy == 0) return; erow *row = &E.row[E.cy]; if (E.cx > 0) { editorRowDelChar(row, E.cx - 1); E.cx--; } else { E.cx = E.row[E.cy - 1].size; editorRowAppendString(&E.row[E.cy - 1], row->chars, row->size); editorDelRow(E.cy); E.cy--; } } // file i/o char *editorRowsToString(int *buflen) { int totlen = 0; int j; for (j = 0; j < E.numrows; j++) totlen += E.row[j].size + 1; *buflen = totlen; char *buf = malloc(totlen); char *p = buf; for (j = 0; j < E.numrows; j++) { memcpy(p, E.row[j].chars, E.row[j].size); p += E.row[j].size; *p = '\n'; p++; } return buf; } void editorOpen(char *filename) { free(E.filename); E.filename = strdup(filename); editorSelectSyntaxHighlight(); FILE *fp = fopen(filename, "r"); if (!fp) die("fopen"); char *line = NULL; size_t linecap = 0; ssize_t linelen; while ((linelen = getline(&line, &linecap, fp)) != -1) { while (linelen > 0 && (line[linelen - 1] == '\n' || line[linelen - 1] == '\r')) linelen--; editorInsertRow(E.numrows, line, linelen); } free(line); fclose(fp); E.dirty = 0; } void editorSave() { if (E.filename == NULL) { E.filename = editorPrompt("Save under: %s (.html .note .notes .txt feature highlight support)", NULL); if (E.filename == NULL) { editorSetStatusMessage("Cancled save"); return; } editorSelectSyntaxHighlight(); } int len; char *buf = editorRowsToString(&len); int fd = open(E.filename, O_RDWR | O_CREAT, 0644); if (fd != -1) { if (ftruncate(fd, len) != -1) { if (write(fd, buf, len) == len) { close(fd); free(buf); E.dirty = 0; editorSetStatusMessage("%d bytes saved", len); return; } } close(fd); } free(buf); editorSetStatusMessage("Can't save! I/O error: %s", strerror(errno)); // this line was inserted by Andy } //find void editorFindCallback(char *query, int key) { static int last_match = -1; static int direction = 1; static int saved_hl_line; static char *saved_hl = NULL; if (saved_hl) { memcpy(E.row[saved_hl_line].hl, saved_hl, E.row[saved_hl_line].rsize); free(saved_hl); saved_hl = NULL; } if (key == '\r' || key == '\x1b') { last_match = -1; direction = 1; return; } else if (key == ARROW_RIGHT || key == ARROW_DOWN) { direction = 1; } else if (key == ARROW_LEFT || key == ARROW_UP) { direction = -1; } else { last_match = -1; direction = 1; } if (last_match == -1) direction = 1; int current = last_match; int i; for (i = 0; i < E.numrows; i++) { current += direction; if (current == -1) current = E.numrows - 1; else if (current == E.numrows) current = 0; erow *row = &E.row[current]; char *match = strstr(row->render, query); if (match) { last_match = current; E.cy = current; E.cx = editorRowRxToCx(row, match - row->render); E.rowoff = E.numrows; saved_hl_line = current; saved_hl = malloc(row->rsize); memcpy(saved_hl, row->hl, row->rsize); memset(&row->hl[match - row->render], HL_MATCH, strlen(query)); break; } } } void editorFind() { int saved_cx = E.cx; int saved_cy = E.cy; int saved_coloff = E.coloff; int saved_rowoff = E.rowoff; char *query = editorPrompt("Search: %s (Use ESC/Arrows/Enter)", editorFindCallback); if (query) { free(query); } else { E.cx = saved_cx; E.cy = saved_cy; E.coloff = saved_coloff; E.rowoff = saved_rowoff; } } //append buffer thanks RRon for telling me I need this struct abuf { char *b; int len; }; #define ABUF_INIT {NULL, 0} void abAppend(struct abuf *ab, const char *s, int len) {//the next 9 lines were stollen from a ubuntu help page char *new = realloc(ab->b, ab->len + len); if (new == NULL) return; memcpy(&new[ab->len], s, len); ab->b = new; ab->len += len; } void abFree(struct abuf *ab) { free(ab->b); } //output void editorScroll() { E.rx = 0; if (E.cy < E.numrows) { E.rx = editorRowCxToRx(&E.row[E.cy], E.cx); } if (E.cy < E.rowoff) { E.rowoff = E.cy; } if (E.cy >= E.rowoff + E.screenrows) { E.rowoff = E.cy - E.screenrows + 1; } if (E.rx < E.coloff) { E.coloff = E.rx; } if (E.rx >= E.coloff + E.screencols) { E.coloff = E.rx - E.screencols + 1; } } void editorDrawRows(struct abuf *ab) { int y; for (y = 0; y < E.screenrows; y++) { int filerow = y + E.rowoff; if (filerow >= E.numrows) { if (E.numrows == 0 && y == E.screenrows / 3) { char welcome[80]; int welcomelen = snprintf(welcome, sizeof(welcome), "BlueDoc editor -- version %s", BLUE_VERSION); if (welcomelen > E.screencols) welcomelen = E.screencols; int padding = (E.screencols - welcomelen) / 2; if (padding) { abAppend(ab, "~", 1); padding--; } while (padding--) abAppend(ab, " ", 1); abAppend(ab, welcome, welcomelen); } else { abAppend(ab, "~", 1); } } else { int len = E.row[filerow].rsize - E.coloff; if (len < 0) len = 0; if (len > E.screencols) len = E.screencols; char *c = &E.row[filerow].render[E.coloff]; unsigned char *hl = &E.row[filerow].hl[E.coloff]; int current_color = -1; int j; for (j = 0; j < len; j++) { if (iscntrl(c[j])) { char sym = (c[j] <= 26) ? '@' + c[j] : '?'; abAppend(ab, "\x1b[7m", 4); abAppend(ab, &sym, 1); abAppend(ab, "\x1b[m", 3); if (current_color != -1) { char buf[16]; int clen = snprintf(buf, sizeof(buf), "\x1b[%dm", current_color); abAppend(ab, buf, clen); } } else if (hl[j] == HL_NORMAL) { if (current_color != -1) { abAppend(ab, "\x1b[39m", 5); current_color = -1; } abAppend(ab, &c[j], 1); } else { int color = editorSyntaxToColor(hl[j]); if (color != current_color) { current_color = color; char buf[16]; int clen = snprintf(buf, sizeof(buf), "\x1b[%dm", color); abAppend(ab, buf, clen); } abAppend(ab, &c[j], 1); } } abAppend(ab, "\x1b[39m", 5); } abAppend(ab, "\x1b[K", 3); abAppend(ab, "\r\n", 2); } } void editorDrawStatusBar(struct abuf *ab) { abAppend(ab, "\x1b[7m", 4); char status[80], rstatus[80]; int len = snprintf(status, sizeof(status), "%.20s - %d lines %s", E.filename ? E.filename : "[No Name]", E.numrows, E.dirty ? "(modified)" : ""); int rlen = snprintf(rstatus, sizeof(rstatus), "%s | %d/%d", E.syntax ? E.syntax->filetype : "no ft", E.cy + 1, E.numrows); if (len > E.screencols) len = E.screencols; abAppend(ab, status, len); while (len < E.screencols) { if (E.screencols - len == rlen) { abAppend(ab, rstatus, rlen); break; } else { abAppend(ab, " ", 1); len++; } } abAppend(ab, "\x1b[m", 3); abAppend(ab, "\r\n", 2); } void editorDrawMessageBar(struct abuf *ab) { abAppend(ab, "\x1b[K", 3); int msglen = strlen(E.statusmsg); if (msglen > E.screencols) msglen = E.screencols; if (msglen && time(NULL) - E.statusmsg_time < 5) abAppend(ab, E.statusmsg, msglen); } void editorRefreshScreen() { editorScroll(); struct abuf ab = ABUF_INIT; abAppend(&ab, "\x1b[?25l", 6); abAppend(&ab, "\x1b[H", 3); editorDrawRows(&ab); editorDrawStatusBar(&ab); editorDrawMessageBar(&ab); char buf[32]; snprintf(buf, sizeof(buf), "\x1b[%d;%dH", (E.cy - E.rowoff) + 1, (E.rx - E.coloff) + 1); abAppend(&ab, buf, strlen(buf)); abAppend(&ab, "\x1b[?25h", 6); write(STDOUT_FILENO, ab.b, ab.len); abFree(&ab); } void editorSetStatusMessage(const char *fmt, ...) { va_list ap; va_start(ap, fmt); vsnprintf(E.statusmsg, sizeof(E.statusmsg), fmt, ap); va_end(ap); E.statusmsg_time = time(NULL); } //input char *editorPrompt(char *prompt, void (*callback)(char *, int)) { size_t bufsize = 128; char *buf = malloc(bufsize); size_t buflen = 0; buf[0] = '\0'; while (1) { editorSetStatusMessage(prompt, buf); editorRefreshScreen(); int c = editorReadKey(); if (c == DEL_KEY || c == CTRL_KEY('h') || c == BACKSPACE) { if (buflen != 0) buf[--buflen] = '\0'; } else if (c == '\x1b') { editorSetStatusMessage(""); if (callback) callback(buf, c); free(buf); return NULL; } else if (c == '\r') { if (buflen != 0) { editorSetStatusMessage(""); if (callback) callback(buf, c); return buf; } } else if (!iscntrl(c) && c < 128) { if (buflen == bufsize - 1) { bufsize *= 2; buf = realloc(buf, bufsize); } buf[buflen++] = c; buf[buflen] = '\0'; } if (callback) callback(buf, c); } } void editorMoveCursor(int key) { erow *row = (E.cy >= E.numrows) ? NULL : &E.row[E.cy]; switch (key) { case ARROW_LEFT: if (E.cx != 0) { E.cx--; } else if (E.cy > 0) { E.cy--; E.cx = E.row[E.cy].size; } break; case ARROW_RIGHT: if (row && E.cx < row->size) { E.cx++; } else if (row && E.cx == row->size) { E.cy++; E.cx = 0; } break; case ARROW_UP: if (E.cy != 0) { E.cy--; } break; case ARROW_DOWN: if (E.cy < E.numrows) { E.cy++; } break; } row = (E.cy >= E.numrows) ? NULL : &E.row[E.cy]; int rowlen = row ? row->size : 0; if (E.cx > rowlen) { E.cx = rowlen; } } void editorProcessKeypress() { static int quit_times = BLUE_QUIT_TIMES; int c = editorReadKey(); switch (c) { case '\r': editorInsertNewline(); break; case CTRL_KEY('q'): if (E.dirty && quit_times > 0) { editorSetStatusMessage("There are unsaved changes" "Press ctrl q %d more times to quit.", quit_times); quit_times--; return; } write(STDOUT_FILENO, "\x1b[2J", 4); write(STDOUT_FILENO, "\x1b[H", 3); exit(0); break; case CTRL_KEY('s'): editorSave(); break; case CTRL_KEY('c'): editorSetStatusMessage("Use ctrl shift c"); break; case CTRL_KEY('v'): editorSetStatusMessage("Use ctrl shift v"); break; case CTRL_KEY('x'): editorSetStatusMessage("Use cntrl q to exit"); break; case CTRL_KEY('t'): editorSetStatusMessage("date ? problem TODO note who where what year solve i Why Who Where What %"); break; case HOME_KEY: E.cx = 0; break; case END_KEY: if (E.cy < E.numrows) E.cx = E.row[E.cy].size; break; case CTRL_KEY('f'): editorFind(); break; case BACKSPACE: //the backspace key, cntrlH and del all do the same function... case CTRL_KEY('h'): case DEL_KEY: if (c == DEL_KEY) editorMoveCursor(ARROW_RIGHT); editorDelChar(); break; case PAGE_UP: case PAGE_DOWN: { if (c == PAGE_UP) { E.cy = E.rowoff; } else if (c == PAGE_DOWN) { E.cy = E.rowoff + E.screenrows - 1; if (E.cy > E.numrows) E.cy = E.numrows; } int times = E.screenrows; while (times--) editorMoveCursor(c == PAGE_UP ? ARROW_UP : ARROW_DOWN); } break; case ARROW_UP: case ARROW_DOWN: case ARROW_LEFT: case ARROW_RIGHT: editorMoveCursor(c); break; case CTRL_KEY('l'): case '\x1b': break; default: editorInsertChar(c); break; //weryuipadgjkzbn case CTRL_KEY('w'): case CTRL_KEY('e'): case CTRL_KEY('r'): case CTRL_KEY('y'): case CTRL_KEY('u'): case CTRL_KEY('i'): case CTRL_KEY('p'): case CTRL_KEY('a'): case CTRL_KEY('d'): case CTRL_KEY('g'): case CTRL_KEY('j'): case CTRL_KEY('k'): case CTRL_KEY('z'): case CTRL_KEY('b'): case CTRL_KEY('n'): editorSetStatusMessage("This shortcut is not supported in your current version of Bluedoc"); break; } quit_times = BLUE_QUIT_TIMES; } //init TODO change thi word, I hate it void initEditor() { E.cx = 0; E.cy = 0; E.rx = 0; E.rowoff = 0; E.coloff = 0; E.numrows = 0; E.row = NULL; E.dirty = 0; E.filename = NULL; E.statusmsg[0] = '\0'; E.statusmsg_time = 0; E.syntax = NULL; if (getWindowSize(&E.screenrows, &E.screencols) == -1) die("getWindowSize"); E.screenrows -= 2; } int main(int argc, char *argv[]) { enableRawMode(); initEditor(); if (argc >= 2) { editorOpen(argv[1]); } editorSetStatusMessage( "Ctrl-S = save | Ctrl-Q = quit | Ctrl-F = find"); while (1) { editorRefreshScreen(); editorProcessKeypress(); } return 0; } // You really read all this garbage?
the_stack_data/20450460.c
#include <stdio.h> #define PI 3.14159 int main() { float r, a, c; do{ printf("Enter radius (in mm):\n"); scanf("%f", &r); if(r>0){ a = PI * (r/25.4) * (r/25.4); c = PI * 2 * (r/25.4); printf("Circle's area is %3.2f (sq in).\n", a); printf("Its circumference is %3.2f (in).\n", c); } } while(r>0); printf("Exit\n"); }
the_stack_data/111079113.c
/*-----------------------------------------------------------------------*/ /* Program: STREAM */ /* Revision: $Id: stream.c,v 5.10 2013/01/17 16:01:06 mccalpin Exp mccalpin $ */ /* Original code developed by John D. McCalpin */ /* Programmers: John D. McCalpin */ /* Joe R. Zagar */ /* */ /* This program measures memory transfer rates in MB/s for simple */ /* computational kernels coded in C. */ /*-----------------------------------------------------------------------*/ /* Copyright 1991-2013: John D. McCalpin */ /*-----------------------------------------------------------------------*/ /* License: */ /* 1. You are free to use this program and/or to redistribute */ /* this program. */ /* 2. You are free to modify this program for your own use, */ /* including commercial use, subject to the publication */ /* restrictions in item 3. */ /* 3. You are free to publish results obtained from running this */ /* program, or from works that you derive from this program, */ /* with the following limitations: */ /* 3a. In order to be referred to as "STREAM benchmark results", */ /* published results must be in conformance to the STREAM */ /* Run Rules, (briefly reviewed below) published at */ /* http://www.cs.virginia.edu/stream/ref.html */ /* and incorporated herein by reference. */ /* As the copyright holder, John McCalpin retains the */ /* right to determine conformity with the Run Rules. */ /* 3b. Results based on modified source code or on runs not in */ /* accordance with the STREAM Run Rules must be clearly */ /* labelled whenever they are published. Examples of */ /* proper labelling include: */ /* "tuned STREAM benchmark results" */ /* "based on a variant of the STREAM benchmark code" */ /* Other comparable, clear, and reasonable labelling is */ /* acceptable. */ /* 3c. Submission of results to the STREAM benchmark web site */ /* is encouraged, but not required. */ /* 4. Use of this program or creation of derived works based on this */ /* program constitutes acceptance of these licensing restrictions. */ /* 5. Absolutely no warranty is expressed or implied. */ /*-----------------------------------------------------------------------*/ #include <stdio.h> #include <stdlib.h> #include <stddef.h> #include <math.h> #include <float.h> #include <limits.h> #ifndef WIN32 #include <unistd.h> #include <sys/time.h> #else #include <Windows.h> #endif /*----------------------------------------------------------------------- * INSTRUCTIONS: * * 1) STREAM requires different amounts of memory to run on different * systems, depending on both the system cache size(s) and the * granularity of the system timer. * You should adjust the value of 'STREAM_ARRAY_SIZE' (below) * to meet *both* of the following criteria: * (a) Each array must be at least 4 times the size of the * available cache memory. I don't worry about the difference * between 10^6 and 2^20, so in practice the minimum array size * is about 3.8 times the cache size. * Example 1: One Xeon E3 with 8 MB L3 cache * STREAM_ARRAY_SIZE should be >= 4 million, giving * an array size of 30.5 MB and a total memory requirement * of 91.5 MB. * Example 2: Two Xeon E5's with 20 MB L3 cache each (using OpenMP) * STREAM_ARRAY_SIZE should be >= 20 million, giving * an array size of 153 MB and a total memory requirement * of 458 MB. * (b) The size should be large enough so that the 'timing calibration' * output by the program is at least 20 clock-ticks. * Example: most versions of Windows have a 10 millisecond timer * granularity. 20 "ticks" at 10 ms/tic is 200 milliseconds. * If the chip is capable of 10 GB/s, it moves 2 GB in 200 msec. * This means the each array must be at least 1 GB, or 128M elements. * * Version 5.10 increases the default array size from 2 million * elements to 10 million elements in response to the increasing * size of L3 caches. The new default size is large enough for caches * up to 20 MB. * Version 5.10 changes the loop index variables from "register int" * to "ssize_t", which allows array indices >2^32 (4 billion) * on properly configured 64-bit systems. Additional compiler options * (such as "-mcmodel=medium") may be required for large memory runs. * * Array size can be set at compile time without modifying the source * code for the (many) compilers that support preprocessor definitions * on the compile line. E.g., * gcc -O -DSTREAM_ARRAY_SIZE=100000000 stream.c -o stream.100M * will override the default size of 10M with a new size of 100M elements * per array. */ #ifndef STREAM_ARRAY_SIZE # define STREAM_ARRAY_SIZE 10000000 #endif /* 2) STREAM runs each kernel "NTIMES" times and reports the *best* result * for any iteration after the first, therefore the minimum value * for NTIMES is 2. * There are no rules on maximum allowable values for NTIMES, but * values larger than the default are unlikely to noticeably * increase the reported performance. * NTIMES can also be set on the compile line without changing the source * code using, for example, "-DNTIMES=7". */ #ifdef NTIMES #if NTIMES<=1 # define NTIMES 10 #endif #endif #ifndef NTIMES # define NTIMES 10 #endif /* Users are allowed to modify the "OFFSET" variable, which *may* change the * relative alignment of the arrays (though compilers may change the * effective offset by making the arrays non-contiguous on some systems). * Use of non-zero values for OFFSET can be especially helpful if the * STREAM_ARRAY_SIZE is set to a value close to a large power of 2. * OFFSET can also be set on the compile line without changing the source * code using, for example, "-DOFFSET=56". */ #ifndef OFFSET # define OFFSET 0 #endif /* * 3) Compile the code with optimization. Many compilers generate * unreasonably bad code before the optimizer tightens things up. * If the results are unreasonably good, on the other hand, the * optimizer might be too smart for me! * * For a simple single-core version, try compiling with: * cc -O stream.c -o stream * This is known to work on many, many systems.... * * To use multiple cores, you need to tell the compiler to obey the OpenMP * directives in the code. This varies by compiler, but a common example is * gcc -O -fopenmp stream.c -o stream_omp * The environment variable OMP_NUM_THREADS allows runtime control of the * number of threads/cores used when the resulting "stream_omp" program * is executed. * * To run with single-precision variables and arithmetic, simply add * -DSTREAM_TYPE=float * to the compile line. * Note that this changes the minimum array sizes required --- see (1) above. * * The preprocessor directive "TUNED" does not do much -- it simply causes the * code to call separate functions to execute each kernel. Trivial versions * of these functions are provided, but they are *not* tuned -- they just * provide predefined interfaces to be replaced with tuned code. * * * 4) Optional: Mail the results to [email protected] * Be sure to include info that will help me understand: * a) the computer hardware configuration (e.g., processor model, memory type) * b) the compiler name/version and compilation flags * c) any run-time information (such as OMP_NUM_THREADS) * d) all of the output from the test case. * * Thanks! * *-----------------------------------------------------------------------*/ # define HLINE "-------------------------------------------------------------\n" # ifndef MIN # define MIN(x,y) ((x)<(y)?(x):(y)) # endif # ifndef MAX # define MAX(x,y) ((x)>(y)?(x):(y)) # endif #ifndef STREAM_TYPE #define STREAM_TYPE double #endif // it turns out that massive static arrays make Emscripten blow up, as it // encodes their initializers naively. A ten million entry array gets a // ten million entry initializer. //static STREAM_TYPE a[STREAM_ARRAY_SIZE+OFFSET], // b[STREAM_ARRAY_SIZE+OFFSET], // c[STREAM_ARRAY_SIZE+OFFSET]; static STREAM_TYPE* a, *b, *c; static double avgtime[4] = {0}, maxtime[4] = {0}, mintime[4] = {FLT_MAX,FLT_MAX,FLT_MAX,FLT_MAX}; static char *label[4] = {"Copy: ", "Scale: ", "Add: ", "Triad: "}; static double bytes[4] = { 2 * sizeof(STREAM_TYPE) * STREAM_ARRAY_SIZE, 2 * sizeof(STREAM_TYPE) * STREAM_ARRAY_SIZE, 3 * sizeof(STREAM_TYPE) * STREAM_ARRAY_SIZE, 3 * sizeof(STREAM_TYPE) * STREAM_ARRAY_SIZE }; extern double mysecond(); extern void checkSTREAMresults(); #ifdef TUNED extern void tuned_STREAM_Copy(); extern void tuned_STREAM_Scale(STREAM_TYPE scalar); extern void tuned_STREAM_Add(); extern void tuned_STREAM_Triad(STREAM_TYPE scalar); #endif #ifdef _OPENMP extern int omp_get_num_threads(); #endif int main() { int quantum, checktick(); int BytesPerWord; int k; intptr_t j; STREAM_TYPE scalar; double t, times[4][NTIMES]; a = calloc(STREAM_ARRAY_SIZE + OFFSET, sizeof(STREAM_TYPE)); b = calloc(STREAM_ARRAY_SIZE + OFFSET, sizeof(STREAM_TYPE)); c = calloc(STREAM_ARRAY_SIZE + OFFSET, sizeof(STREAM_TYPE)); if(!a || !b || !c) { printf("Memory allocation failed.\n"); return -1; } /* --- SETUP --- determine precision and check timing --- */ printf(HLINE); printf("STREAM version $Revision: 5.10 $\n"); printf(HLINE); BytesPerWord = sizeof(STREAM_TYPE); printf("This system uses %d bytes per array element.\n", BytesPerWord); printf(HLINE); #ifdef N printf("***** WARNING: ******\n"); printf(" It appears that you set the preprocessor variable N when compiling this code.\n"); printf(" This version of the code uses the preprocesor variable STREAM_ARRAY_SIZE to control the array size\n"); printf(" Reverting to default value of STREAM_ARRAY_SIZE=%llu\n",(unsigned long long) STREAM_ARRAY_SIZE); printf("***** WARNING: ******\n"); #endif printf("Array size = %llu (elements), Offset = %d (elements)\n" , (unsigned long long) STREAM_ARRAY_SIZE, OFFSET); printf("Memory per array = %.1f MiB (= %.1f GiB).\n", BytesPerWord * ( (double) STREAM_ARRAY_SIZE / 1024.0/1024.0), BytesPerWord * ( (double) STREAM_ARRAY_SIZE / 1024.0/1024.0/1024.0)); printf("Total memory required = %.1f MiB (= %.1f GiB).\n", (3.0 * BytesPerWord) * ( (double) STREAM_ARRAY_SIZE / 1024.0/1024.), (3.0 * BytesPerWord) * ( (double) STREAM_ARRAY_SIZE / 1024.0/1024./1024.)); printf("Each kernel will be executed %d times.\n", NTIMES); printf(" The *best* time for each kernel (excluding the first iteration)\n"); printf(" will be used to compute the reported bandwidth.\n"); #ifdef _OPENMP printf(HLINE); #pragma omp parallel { #pragma omp master { k = omp_get_num_threads(); printf ("Number of Threads requested = %i\n",k); } } #endif #ifdef _OPENMP k = 0; #pragma omp parallel #pragma omp atomic k++; printf ("Number of Threads counted = %i\n",k); #endif /* Get initial value for system clock. */ #pragma omp parallel for for (j=0; j<STREAM_ARRAY_SIZE; j++) { a[j] = 1.0; b[j] = 2.0; c[j] = 0.0; } printf(HLINE); if ( (quantum = checktick()) >= 1) printf("Your clock granularity/precision appears to be " "%d microseconds.\n", quantum); else { printf("Your clock granularity appears to be " "less than one microsecond.\n"); quantum = 1; } t = mysecond(); #pragma omp parallel for for (j = 0; j < STREAM_ARRAY_SIZE; j++) a[j] = 2.0E0 * a[j]; t = 1.0E6 * (mysecond() - t); printf("Each test below will take on the order" " of %d microseconds.\n", (int) t ); printf(" (= %d clock ticks)\n", (int) (t/quantum) ); printf("Increase the size of the arrays if this shows that\n"); printf("you are not getting at least 20 clock ticks per test.\n"); printf(HLINE); printf("WARNING -- The above is only a rough guideline.\n"); printf("For best results, please be sure you know the\n"); printf("precision of your system timer.\n"); printf(HLINE); /* --- MAIN LOOP --- repeat test cases NTIMES times --- */ scalar = 3.0; for (k=0; k<NTIMES; k++) { times[0][k] = mysecond(); #ifdef TUNED tuned_STREAM_Copy(); #else #pragma omp parallel for for (j=0; j<STREAM_ARRAY_SIZE; j++) c[j] = a[j]; #endif times[0][k] = mysecond() - times[0][k]; times[1][k] = mysecond(); #ifdef TUNED tuned_STREAM_Scale(scalar); #else #pragma omp parallel for for (j=0; j<STREAM_ARRAY_SIZE; j++) b[j] = scalar*c[j]; #endif times[1][k] = mysecond() - times[1][k]; times[2][k] = mysecond(); #ifdef TUNED tuned_STREAM_Add(); #else #pragma omp parallel for for (j=0; j<STREAM_ARRAY_SIZE; j++) c[j] = a[j]+b[j]; #endif times[2][k] = mysecond() - times[2][k]; times[3][k] = mysecond(); #ifdef TUNED tuned_STREAM_Triad(scalar); #else #pragma omp parallel for for (j=0; j<STREAM_ARRAY_SIZE; j++) a[j] = b[j]+scalar*c[j]; #endif times[3][k] = mysecond() - times[3][k]; } /* --- SUMMARY --- */ for (k=1; k<NTIMES; k++) /* note -- skip first iteration */ { for (j=0; j<4; j++) { avgtime[j] = avgtime[j] + times[j][k]; mintime[j] = MIN(mintime[j], times[j][k]); maxtime[j] = MAX(maxtime[j], times[j][k]); } } printf("Function Best Rate MB/s Avg time Min time Max time\n"); for (j=0; j<4; j++) { avgtime[j] = avgtime[j]/(double)(NTIMES-1); printf("%s%12.1f %11.6f %11.6f %11.6f\n", label[j], 1.0E-06 * bytes[j]/mintime[j], avgtime[j], mintime[j], maxtime[j]); } printf(HLINE); /* --- Check Results --- */ checkSTREAMresults(); printf(HLINE); free(a); free(b); free(c); return 0; } # define M 20 int checktick() { int i, minDelta, Delta; double t1, t2, timesfound[M]; /* Collect a sequence of M unique time values from the system. */ for (i = 0; i < M; i++) { t1 = mysecond(); while( ((t2=mysecond()) - t1) < 1.0E-6 ) ; timesfound[i] = t1 = t2; } /* * Determine the minimum difference between these M values. * This result will be our estimate (in microseconds) for the * clock granularity. */ minDelta = 1000000; for (i = 1; i < M; i++) { Delta = (int)( 1.0E6 * (timesfound[i]-timesfound[i-1])); minDelta = MIN(minDelta, MAX(Delta,0)); } return(minDelta); } /* A gettimeofday routine to give access to the wall clock timer on most UNIX-like systems. */ #ifndef WIN32 #include <sys/time.h> double mysecond() { struct timeval tp; struct timezone tzp; int i; i = gettimeofday(&tp,&tzp); return ( (double) tp.tv_sec + (double) tp.tv_usec * 1.e-6 ); } #else #include <Windows.h> double mysecond() { static LARGE_INTEGER freq = {0}; LARGE_INTEGER count = {0}; if(freq.QuadPart == 0LL) { QueryPerformanceFrequency(&freq); } QueryPerformanceCounter(&count); return (double)count.QuadPart / (double)freq.QuadPart; } #endif #ifndef abs #define abs(a) ((a) >= 0 ? (a) : -(a)) #endif void checkSTREAMresults () { STREAM_TYPE aj,bj,cj,scalar; STREAM_TYPE aSumErr,bSumErr,cSumErr; STREAM_TYPE aAvgErr,bAvgErr,cAvgErr; double epsilon; size_t j; int k,ierr,err; /* reproduce initialization */ aj = 1.0; bj = 2.0; cj = 0.0; /* a[] is modified during timing check */ aj = 2.0E0 * aj; /* now execute timing loop */ scalar = 3.0; for (k=0; k<NTIMES; k++) { cj = aj; bj = scalar*cj; cj = aj+bj; aj = bj+scalar*cj; } /* accumulate deltas between observed and expected results */ aSumErr = 0.0; bSumErr = 0.0; cSumErr = 0.0; for (j=0; j<STREAM_ARRAY_SIZE; j++) { aSumErr += abs(a[j] - aj); bSumErr += abs(b[j] - bj); cSumErr += abs(c[j] - cj); // if (j == 417) printf("Index 417: c[j]: %f, cj: %f\n",c[j],cj); // MCCALPIN } aAvgErr = aSumErr / (STREAM_TYPE) STREAM_ARRAY_SIZE; bAvgErr = bSumErr / (STREAM_TYPE) STREAM_ARRAY_SIZE; cAvgErr = cSumErr / (STREAM_TYPE) STREAM_ARRAY_SIZE; if (sizeof(STREAM_TYPE) == 4) { epsilon = 1.e-6; } else if (sizeof(STREAM_TYPE) == 8) { epsilon = 1.e-13; } else { printf("WEIRD: sizeof(STREAM_TYPE) = %lu\n",sizeof(STREAM_TYPE)); epsilon = 1.e-6; } err = 0; if (abs(aAvgErr/aj) > epsilon) { err++; printf ("Failed Validation on array a[], AvgRelAbsErr > epsilon (%e)\n",epsilon); printf (" Expected Value: %e, AvgAbsErr: %e, AvgRelAbsErr: %e\n",aj,aAvgErr,abs(aAvgErr)/aj); ierr = 0; for (j=0; j<STREAM_ARRAY_SIZE; j++) { if (abs(a[j]/aj-1.0) > epsilon) { ierr++; #ifdef VERBOSE if (ierr < 10) { printf(" array a: index: %ld, expected: %e, observed: %e, relative error: %e\n", j,aj,a[j],abs((aj-a[j])/aAvgErr)); } #endif } } printf(" For array a[], %d errors were found.\n",ierr); } if (abs(bAvgErr/bj) > epsilon) { err++; printf ("Failed Validation on array b[], AvgRelAbsErr > epsilon (%e)\n",epsilon); printf (" Expected Value: %e, AvgAbsErr: %e, AvgRelAbsErr: %e\n",bj,bAvgErr,abs(bAvgErr)/bj); printf (" AvgRelAbsErr > Epsilon (%e)\n",epsilon); ierr = 0; for (j=0; j<STREAM_ARRAY_SIZE; j++) { if (abs(b[j]/bj-1.0) > epsilon) { ierr++; #ifdef VERBOSE if (ierr < 10) { printf(" array b: index: %ld, expected: %e, observed: %e, relative error: %e\n", j,bj,b[j],abs((bj-b[j])/bAvgErr)); } #endif } } printf(" For array b[], %d errors were found.\n",ierr); } if (abs(cAvgErr/cj) > epsilon) { err++; printf ("Failed Validation on array c[], AvgRelAbsErr > epsilon (%e)\n",epsilon); printf (" Expected Value: %e, AvgAbsErr: %e, AvgRelAbsErr: %e\n",cj,cAvgErr,abs(cAvgErr)/cj); printf (" AvgRelAbsErr > Epsilon (%e)\n",epsilon); ierr = 0; for (j=0; j<STREAM_ARRAY_SIZE; j++) { if (abs(c[j]/cj-1.0) > epsilon) { ierr++; #ifdef VERBOSE if (ierr < 10) { printf(" array c: index: %ld, expected: %e, observed: %e, relative error: %e\n", j,cj,c[j],abs((cj-c[j])/cAvgErr)); } #endif } } printf(" For array c[], %d errors were found.\n",ierr); } if (err == 0) { printf ("Solution Validates: avg error less than %e on all three arrays\n",epsilon); } #ifdef VERBOSE printf ("Results Validation Verbose Results: \n"); printf (" Expected a(1), b(1), c(1): %f %f %f \n",aj,bj,cj); printf (" Observed a(1), b(1), c(1): %f %f %f \n",a[1],b[1],c[1]); printf (" Rel Errors on a, b, c: %e %e %e \n",abs(aAvgErr/aj),abs(bAvgErr/bj),abs(cAvgErr/cj)); #endif } #ifdef TUNED /* stubs for "tuned" versions of the kernels */ void tuned_STREAM_Copy() { ssize_t j; #pragma omp parallel for for (j=0; j<STREAM_ARRAY_SIZE; j++) c[j] = a[j]; } void tuned_STREAM_Scale(STREAM_TYPE scalar) { ssize_t j; #pragma omp parallel for for (j=0; j<STREAM_ARRAY_SIZE; j++) b[j] = scalar*c[j]; } void tuned_STREAM_Add() { ssize_t j; #pragma omp parallel for for (j=0; j<STREAM_ARRAY_SIZE; j++) c[j] = a[j]+b[j]; } void tuned_STREAM_Triad(STREAM_TYPE scalar) { ssize_t j; #pragma omp parallel for for (j=0; j<STREAM_ARRAY_SIZE; j++) a[j] = b[j]+scalar*c[j]; } /* end of stubs for the "tuned" versions of the kernels */ #endif
the_stack_data/184517993.c
#include <string.h> void memzero(void *s, size_t n) { memset(s, 0, n); }
the_stack_data/25136884.c
#include <stdio.h> #include <stdlib.h> #include <math.h> double f(double t) { return pow(M_PI_4 * t, M_PI_4) * exp(- M_PI_4 * t); } double ftrans(double y) { double x = M_PI*sinh(y); double t; if (x >= 0) { t = x + log1p(exp(- x)); } else { t = log1p(exp(x)); } return pow(M_PI_4 * t, M_PI_4) / pow(1 + exp(x), M_PI_4); } double sinc(double x) { double val = 1.0; if (x != 0) { val = sin(M_PI * x) / (M_PI * x); } return val; } double S(int k, double h, double x) { return sinc((x/h) - k); } double sinc_approx(int N, double d, double mu, double t) { int k; double h = log(2 * d * N / mu) / N; double x = asinh(M_1_PI * log(expm1(t))); double val = 0; for (k = N; k > 0; k--) { val += ftrans( k*h) * S( k,h,x); val += ftrans(-k*h) * S(-k,h,x); } val += ftrans( 0*h) * S( 0,h,x); return val; } double err_bound(int N, double K, double d, double mu) { double val = 4.0 / (M_PI * (1 - exp(- M_PI * mu * M_E))); val /= (pow(cos(M_PI_2 * sin(d)),2*mu) * pow(cos(d),1+mu)); val += mu * exp(M_PI_2*mu + 1) * pow(2, 1-mu); val *= K / (pow(M_PI,1-mu)*d*mu); return val * exp(- M_PI*d*N/log(2*d*N/mu)); } int main() { int i, N; double K = pow(M_PI_4, M_PI_4); double d = 1.5; double mu = M_PI_4; double s, t; double err, maxerr; for (N = 2; N <= 50; N += 5) { s = 1; t = 1; maxerr = fabs(f(t) - sinc_approx(N, d, mu, t)); for (i = 1; i <= 100; i++) { s *= M_SQRT1_2; t *= M_SQRT2; err = fabs(f( s) - sinc_approx(N, d, mu, s)); if (maxerr < err) maxerr = err; err = fabs(f( t) - sinc_approx(N, d, mu, t)); if (maxerr < err) maxerr = err; } printf("%d\t%e\t%e\n", N, maxerr, err_bound(N, K, d, mu)); } return EXIT_SUCCESS; }
the_stack_data/147465.c
#include <stdlib.h> #include <assert.h> #include <stdio.h> struct obj_t { struct tmp_obj_t * test; }; struct tmp_obj_t { const char * hello; void * test2; }; static struct obj_t * obj; static struct tmp_obj_t * tmp_obj = NULL; int main(void) { obj = malloc(sizeof(*obj)); assert(obj != NULL); tmp_obj = malloc(sizeof(*tmp_obj)); assert(tmp_obj != NULL); tmp_obj->hello = "world"; obj->test = tmp_obj; obj->test->test2 = obj; printf("{ "); printf("test: { "); printf("hello: \"%s\"", obj->test->hello); printf(", "); printf("test2: [object Object]"); printf(" }"); printf(" }\n"); free(obj); free(tmp_obj); return 0; }
the_stack_data/68692.c
#include <stdio.h> int main() { int n, n_mem, i = 0; int b0 = 0, b1 = 0, b2 = 0, b3 = 0, b4 = 0, b5 = 0, b6 = 0, b7 = 0; // Die Benutzereingabe wird solange verlangt, bis der vorgegebene // Wertebereich eingehalten wird. do { printf("Bitte eine Dezimalzahl (0 .. 255) eingeben: "); scanf_s("%i", &n); } while (n < 0 || n > 255); n_mem = n; // n wird gespeichert, da es im Folgenden veraendert wird. /* In dieser Loesung muss jede Stelle der Binaerzahl gespeichert werden, da die Ziffern der Binaerzahl vom LSB bis zum MSB berechnet werden und spaeter in umgekehrter Reihenfolge ausgegeben werden sollen. Mit dem gegenwaertigen Wissen muessen dafuer 8 Variablen angelegt werden. Dieses Vorgehen ist selbstverstaendlich umstaendlich und C bietet fuer solche Probleme andere und effizientere Moeglichkeiten, die in den folgenden Terminen besprochen werden. */ while(n>0){ i++; switch (i) { case 1: b0 = n % 2; n /= 2; break; case 2: b1 = n % 2; n /= 2; break; case 3: b2 = n % 2; n /= 2; break; case 4: b3 = n % 2; n /= 2; break; case 5: b4 = n % 2; n /= 2; break; case 6: b5 = n % 2; n /= 2; break; case 7: b6 = n % 2; n /= 2; break; case 8: b7 = n % 2; n /= 2; break; } } //Ausgabe printf("%i_(dez) = %i%i%i%i%i%i%i%i_(bin).\n", n_mem, b7, b6, b5, b4, b3, b2, b1, b0); // Hier wird der Vorteil der Implementierung mit einer while-Schleife // gegenueber einer for-Schleife dokumentiert. Bei verwendung einer // for-Schleife werden immer 8 Durchlaeufe benoetigt, wohingegen // die Anzahl der Durchlaeufe mit einer while-Schleife von der // Eingabe abhaengen. printf("\nDie Berechnung erfolgte in %i Durchlaeufen.\n", i); }
the_stack_data/76456.c
#include <stdio.h> #include <stdlib.h> // types and socket stuff #include <sys/types.h> #include <sys/socket.h> #include <signal.h> #include <unistd.h> #include <string.h> #include <strings.h> // stuff to do because I can // IP and protcol stuff #include <arpa/inet.h> #include <netinet/in.h> #include <netdb.h> /* * Sami Alameddine, 2020 * * This is another web server implementation by me * * * <executioncommand><binaryname> <portno> <file> * */ // defines #define SA struct sockaddr #define MAXLINE 4096 // configuration defines #define ALS_DEBUG_TARGET // Debug boilerplate static FILE *FN; void handler(int handlerNum); #ifdef ALS_DEBUG_TARGET char *bin2hex(const unsigned char *input, size_t len){ char *db_res; char *hexits="0123456789ABCDEF"; if(input==NULL||len<=0){ return NULL; } int res_db_len=(len+3)+1; db_res=malloc(res_db_len); bzero(db_res,res_db_len); for(int db_i=0;db_i<len;db_i++){ db_res[db_i*3] =hexits[input[db_i]>>4]; db_res[(db_i*3)+1] =hexits[input[db_i]&0x0F]; db_res[(db_i*3)+2] =' '; } return db_res; } #endif int main(int argc, char** argv) { signal(SIGINT, handler); int PORT_NO=6967; //int PORT_NO=argv[1]; //char filenm=argv[2]; char filenm[]="index.html"; // declare stuff int listenfd,connfd,n; struct sockaddr_in servaddr; uint8_t buff[MAXLINE+1]; uint8_t recvline[MAXLINE+1]; // allocates resources for an internet socket (a TCP socket) if((listenfd=socket(AF_INET,SOCK_STREAM,0))<0){ fprintf(stderr,"Error While trying too create socket"); exit(1); } bzero(&servaddr,sizeof(servaddr)); servaddr.sin_family= AF_INET; // just says that it would responds to anything servaddr.sin_addr.s_addr= htonl(INADDR_ANY); servaddr.sin_port= htons(PORT_NO); // listen and bind if((bind(listenfd,(SA *)&servaddr,sizeof(servaddr)))<0){ fprintf(stderr,"Error on bind"); exit(1); } if((listen(listenfd,10))<0){ fprintf(stderr, "Error on listen"); exit(1); } FN=fopen("log","w+"); FILE *FILEN; FILEN=fopen(filenm, "r"); fseek(FILEN,0,SEEK_END); long fsize=ftell(FILEN); fseek(FILEN,0,SEEK_SET); //char *webpage=malloc(fsize+1); char *webpage[fsize+1]; fread(webpage,1,fsize,FILEN); // sprintfs the thing //char webpage[]="HTTP/1.1 200 OK\r\n\r\nHello"; fclose(FILEN); // infinite loop for handling requests for(;;){ struct sockaddr_in addr; socklen_t addr_len; // accept blocks until an incomming connection arrives // it returns a "file descriptor" to the connection fprintf(stdout,"Waiting for a connection on port %d\n", PORT_NO); fflush(stdout); connfd=accept(listenfd, (SA *) NULL, NULL); // bzero out the recive buffer to make sure it ends up null terminated memset(recvline,0,MAXLINE); // read the client's message n=read(connfd,recvline,MAXLINE-1); fprintf(stdout, "\n%s\n\n%s", bin2hex(recvline,n), recvline); fprintf(FN, "\n%s\n\n%s", bin2hex(recvline,n), recvline); // detects the end of a message if(n<0){fprintf(stderr,"cannot read what the client said! did the client send anything?");} snprintf((char*)buff, sizeof(buff),"HTTP/1.1 200 OK\r\n\r\n%s\r\n",webpage); //write(connfd,(char*)buff, strlen((char*)buff)); write(connfd,(char*)buff,(strlen(webpage)+(21-1))); close(connfd); } fclose(FN); } void handler(int handlerNum) { fclose(FN); exit(2); }
the_stack_data/1168874.c
/* Aula 07 - Controle de Fluxo de Execucao arquivo: a07e05.c objetivo: multiplicacao por somas sucessivas para relacionar lacos de repeticao com assembly anexo do arquivo a07e05.asm gcc a07e05.c -o a07e05c.x */ #include <stdio.h> int main(){ int multiplicando = 5; int multiplicador = 13; int resultado = 0; for(int i = multiplicador; i>0; i--){ resultado += multiplicando; } printf("%d * %d = %d\n", multiplicando, multiplicador, resultado); return 0; }
the_stack_data/51310.c
// SPDX-License-Identifier: GPL-2.0-only /* * Copyright 2014 Sony Mobile Communications Inc. * * Selftest for runtime system size * * Prints the amount of RAM that the currently running system is using. * * This program tries to be as small as possible itself, to * avoid perturbing the system memory utilization with its * own execution. It also attempts to have as few dependencies * on kernel features as possible. * * It should be statically linked, with startup libs avoided. * It uses no library calls, and only the following 3 syscalls: * sysinfo(), write(), and _exit() * * For output, it avoids printf (which in some C libraries * has large external dependencies) by implementing it's own * number output and print routines, and using __builtin_strlen() */ #include <sys/sysinfo.h> #include <unistd.h> #define STDOUT_FILENO 1 static int print(const char *s) { return write(STDOUT_FILENO, s, __builtin_strlen(s)); } static inline char *num_to_str(unsigned long num, char *buf, int len) { unsigned int digit; /* put digits in buffer from back to front */ buf += len - 1; *buf = 0; do { digit = num % 10; *(--buf) = digit + '0'; num /= 10; } while (num > 0); return buf; } static int print_num(unsigned long num) { char num_buf[30]; return print(num_to_str(num, num_buf, sizeof(num_buf))); } static int print_k_value(const char *s, unsigned long num, unsigned long units) { unsigned long long temp; int ccode; print(s); temp = num; temp = (temp * units)/1024; num = temp; ccode = print_num(num); print("\n"); return ccode; } /* this program has no main(), as startup libraries are not used */ void _start(void) { int ccode; struct sysinfo info; unsigned long used; static const char *test_name = " get runtime memory use\n"; print("TAP version 13\n"); print("# Testing system size.\n"); ccode = sysinfo(&info); if (ccode < 0) { print("not ok 1"); print(test_name); print(" ---\n reason: \"could not get sysinfo\"\n ...\n"); _exit(ccode); } print("ok 1"); print(test_name); /* ignore cache complexities for now */ used = info.totalram - info.freeram - info.bufferram; print("# System runtime memory report (units in Kilobytes):\n"); print(" ---\n"); print_k_value(" Total: ", info.totalram, info.mem_unit); print_k_value(" Free: ", info.freeram, info.mem_unit); print_k_value(" Buffer: ", info.bufferram, info.mem_unit); print_k_value(" In use: ", used, info.mem_unit); print(" ...\n"); print("1..1\n"); _exit(0); }
the_stack_data/9217.c
void merge_sort( int array[], int helper[], int left, int right){ if( left >= right ) return; // divide and conquer: array will be divided into left part and right part // both parts will be sorted by the calling merge_sort int mid = right - (right - left) / 2; merge_sort( array, helper, left, mid ); merge_sort( array, helper, mid + 1, right); // now we merge two parts into one int helperLeft = left; int helperRight = mid + 1; int curr = left; for(int i = left; i <= right; i++) helper[i] = array[i]; while( helperLeft <= mid && helperRight <= right ){ if( helper[helperLeft] <= helper[helperRight] ) array[curr++] = helper[helperLeft++]; else array[curr++] = helper[helperRight++]; } // left part has some large elements remaining. Put them into the right side while( helperLeft <= mid ) array[curr++] = helper[helperLeft++]; }
the_stack_data/97298.c
#include <stdio.h> #include <stdlib.h> #include <time.h> #include <string.h> void code(int v, char* msg) { if (v == 0) strcpy(msg, "val0"); else if (v == 1) strcpy(msg, "val1"); else if (v == 2) strcpy(msg, "val2"); } int main() { srand(time(0)); int val = rand() % 3; char m[16]; code(val, m); printf("%s\n", m); return 0; }
the_stack_data/167331007.c
#include <stdio.h> #include <stdlib.h> struct node{ int a; struct node* next; }*top; int isempty(){ if(top==NULL) return 1; else return 0; } int isoneelement(){ if(top->next==NULL) return 1; else return 0; } void display(){ if(isempty()) printf("empty stack\n"); else{ struct node*curr; curr=top; do{ printf("%d\n",curr->a); curr=curr->next; }while(curr!=NULL); //printf("%d\n",tail->a); } } void push(int ele){ struct node *new=(struct node*)malloc(sizeof(struct node)); new->a=ele; new->next=NULL; if(isempty()){ top=new; //printf("%d\n",tail->a); } else{ if(isoneelement()){ struct node *curr=top; if(curr->a < ele){ new->next=curr; top=new; } else{ curr->next=new; } display(); } else{ if(top->a <ele){ new->next=top; top=new; display(); } else{ struct node *curr=top,*temp=top->next; do{ if(temp->a < ele){ curr->next=new; new->next=temp; display(); break; } else{ curr=curr->next; temp=temp->next; if(temp==NULL){ curr->next=new; display(); break; } } }while(temp!=NULL); } }//printf("%d\n",head->a); } } void pop(){ if(isempty()){ printf("stack is empty\n"); } else if(isoneelement()){ printf("deleted element is %d",top->a); top=NULL; } else{ printf("deleted element is %d",top->a); top=top->next; } } int menu(){ int choice; printf("select the correct choice\n1)push\n2)pop\n3)disply\nenter choice : "); scanf("%d",&choice); return choice; } int main(){ top=NULL; int choice; char ch; do{ choice=menu(); switch(choice){ case 1: printf("enter the element you want to enter :"); int ele; scanf("%d",&ele); push(ele); break; case 2: pop(); break; case 3: display(); break; } printf("\ndo you want to continue(y/n):"); scanf("%s",&ch); }while(ch=='y'); return 0; }
the_stack_data/206394356.c
#include <stdio.h> #define IN 0 /* in a string of spaces */ #define OUT 1 /* outside a string of spaces */ /* Exercise 1-9: Write a program to copy its input to its output, replacing each * string of one or more blanks by a single blank. p20 */ int main() { int c, state; state = OUT; while ((c = getchar()) != EOF) if (c != ' ') { putchar(c); state = OUT; } else if (state == OUT) { putchar(c); state = IN; } }
the_stack_data/154827482.c
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <CL/cl.h> unsigned char *read_buffer(char *file_name, size_t *size_ptr) { FILE *f; unsigned char *buf; size_t size; /* Open file */ f = fopen(file_name, "rb"); if (!f) return NULL; /* Obtain file size */ fseek(f, 0, SEEK_END); size = ftell(f); fseek(f, 0, SEEK_SET); /* Allocate and read buffer */ buf = malloc(size + 1); fread(buf, 1, size, f); buf[size] = '\0'; /* Return size of buffer */ if (size_ptr) *size_ptr = size; /* Return buffer */ return buf; } void write_buffer(char *file_name, const char *buffer, size_t buffer_size) { FILE *f; /* Open file */ f = fopen(file_name, "w+"); /* Write buffer */ if(buffer) fwrite(buffer, 1, buffer_size, f); /* Close file */ fclose(f); } int main(int argc, char const *argv[]) { /* Get platform */ cl_platform_id platform; cl_uint num_platforms; cl_int ret = clGetPlatformIDs(1, &platform, &num_platforms); if (ret != CL_SUCCESS) { printf("error: call to 'clGetPlatformIDs' failed\n"); exit(1); } printf("Number of platforms: %d\n", num_platforms); printf("platform=%p\n", platform); /* Get platform name */ char platform_name[100]; ret = clGetPlatformInfo(platform, CL_PLATFORM_NAME, sizeof(platform_name), platform_name, NULL); if (ret != CL_SUCCESS) { printf("error: call to 'clGetPlatformInfo' failed\n"); exit(1); } printf("platform.name='%s'\n\n", platform_name); /* Get device */ cl_device_id device; cl_uint num_devices; ret = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 1, &device, &num_devices); if (ret != CL_SUCCESS) { printf("error: call to 'clGetDeviceIDs' failed\n"); exit(1); } printf("Number of devices: %d\n", num_devices); printf("device=%p\n", device); /* Get device name */ char device_name[100]; ret = clGetDeviceInfo(device, CL_DEVICE_NAME, sizeof(device_name), device_name, NULL); if (ret != CL_SUCCESS) { printf("error: call to 'clGetDeviceInfo' failed\n"); exit(1); } printf("device.name='%s'\n", device_name); printf("\n"); /* Create a Context Object */ cl_context context; context = clCreateContext(NULL, 1, &device, NULL, NULL, &ret); if (ret != CL_SUCCESS) { printf("error: call to 'clCreateContext' failed\n"); exit(1); } printf("context=%p\n", context); /* Create a Command Queue Object*/ cl_command_queue command_queue; command_queue = clCreateCommandQueue(context, device, 0, &ret); if (ret != CL_SUCCESS) { printf("error: call to 'clCreateCommandQueue' failed\n"); exit(1); } printf("command_queue=%p\n", command_queue); printf("\n"); /* Program source */ unsigned char *source_code; size_t source_length; /* Read program from 'post_increment_uint4.cl' */ source_code = read_buffer("post_increment_uint4.cl", &source_length); /* Create a program */ cl_program program; program = clCreateProgramWithSource(context, 1, (const char **)&source_code, &source_length, &ret); if (ret != CL_SUCCESS) { printf("error: call to 'clCreateProgramWithSource' failed\n"); exit(1); } printf("program=%p\n", program); /* Build program */ ret = clBuildProgram(program, 1, &device, NULL, NULL, NULL); if (ret != CL_SUCCESS ) { size_t size; char *log; /* Get log size */ clGetProgramBuildInfo(program, device, CL_PROGRAM_BUILD_LOG,0, NULL, &size); /* Allocate log and print */ log = malloc(size); clGetProgramBuildInfo(program, device, CL_PROGRAM_BUILD_LOG,size, log, NULL); printf("error: call to 'clBuildProgram' failed:\n%s\n", log); /* Free log and exit */ free(log); exit(1); } printf("program built\n"); printf("\n"); /* Create a Kernel Object */ cl_kernel kernel; kernel = clCreateKernel(program, "post_increment_uint4", &ret); if (ret != CL_SUCCESS) { printf("error: call to 'clCreateKernel' failed\n"); exit(1); } /* Create and allocate host buffers */ size_t num_elem = 10; /* Create and init host side src buffer 0 */ cl_uint4 *src_0_host_buffer; src_0_host_buffer = malloc(num_elem * sizeof(cl_uint4)); for (int i = 0; i < num_elem; i++) src_0_host_buffer[i] = (cl_uint4){{2, 2, 2, 2}}; /* Create and init device side src buffer 0 */ cl_mem src_0_device_buffer; src_0_device_buffer = clCreateBuffer(context, CL_MEM_READ_ONLY, num_elem * sizeof(cl_uint4), NULL, &ret); if (ret != CL_SUCCESS) { printf("error: could not create source buffer\n"); exit(1); } ret = clEnqueueWriteBuffer(command_queue, src_0_device_buffer, CL_TRUE, 0, num_elem * sizeof(cl_uint4), src_0_host_buffer, 0, NULL, NULL); if (ret != CL_SUCCESS) { printf("error: call to 'clEnqueueWriteBuffer' failed\n"); exit(1); } /* Create host dst buffer */ cl_uint4 *dst_host_buffer; dst_host_buffer = malloc(num_elem * sizeof(cl_uint4)); memset((void *)dst_host_buffer, 1, num_elem * sizeof(cl_uint4)); /* Create device dst buffer */ cl_mem dst_device_buffer; dst_device_buffer = clCreateBuffer(context, CL_MEM_WRITE_ONLY, num_elem *sizeof(cl_uint4), NULL, &ret); if (ret != CL_SUCCESS) { printf("error: could not create dst buffer\n"); exit(1); } /* Set kernel arguments */ ret = CL_SUCCESS; ret |= clSetKernelArg(kernel, 0, sizeof(cl_mem), &src_0_device_buffer); ret |= clSetKernelArg(kernel, 1, sizeof(cl_mem), &dst_device_buffer); if (ret != CL_SUCCESS) { printf("error: call to 'clSetKernelArg' failed\n"); exit(1); } /* Launch the kernel */ size_t global_work_size = num_elem; size_t local_work_size = num_elem; ret = clEnqueueNDRangeKernel(command_queue, kernel, 1, NULL, &global_work_size, &local_work_size, 0, NULL, NULL); if (ret != CL_SUCCESS) { printf("error: call to 'clEnqueueNDRangeKernel' failed\n"); exit(1); } /* Wait for it to finish */ clFinish(command_queue); /* Read results from GPU */ ret = clEnqueueReadBuffer(command_queue, dst_device_buffer, CL_TRUE,0, num_elem * sizeof(cl_uint4), dst_host_buffer, 0, NULL, NULL); if (ret != CL_SUCCESS) { printf("error: call to 'clEnqueueReadBuffer' failed\n"); exit(1); } /* Dump dst buffer to file */ char dump_file[100]; sprintf((char *)&dump_file, "%s.result", argv[0]); write_buffer(dump_file, (const char *)dst_host_buffer, num_elem * sizeof(cl_uint4)); printf("Result dumped to %s\n", dump_file); /* Free host dst buffer */ free(dst_host_buffer); /* Free device dst buffer */ ret = clReleaseMemObject(dst_device_buffer); if (ret != CL_SUCCESS) { printf("error: call to 'clReleaseMemObject' failed\n"); exit(1); } /* Free host side src buffer 0 */ free(src_0_host_buffer); /* Free device side src buffer 0 */ ret = clReleaseMemObject(src_0_device_buffer); if (ret != CL_SUCCESS) { printf("error: call to 'clReleaseMemObject' failed\n"); exit(1); } /* Release kernel */ ret = clReleaseKernel(kernel); if (ret != CL_SUCCESS) { printf("error: call to 'clReleaseKernel' failed\n"); exit(1); } /* Release program */ ret = clReleaseProgram(program); if (ret != CL_SUCCESS) { printf("error: call to 'clReleaseProgram' failed\n"); exit(1); } /* Release command queue */ ret = clReleaseCommandQueue(command_queue); if (ret != CL_SUCCESS) { printf("error: call to 'clReleaseCommandQueue' failed\n"); exit(1); } /* Release context */ ret = clReleaseContext(context); if (ret != CL_SUCCESS) { printf("error: call to 'clReleaseContext' failed\n"); exit(1); } return 0; }
the_stack_data/96110.c
/* This testcase is part of GDB, the GNU debugger. Copyright 2014-2021 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ static void f1 (void) {} static void f2 (void) {} void commonfun (void) {} int main (void) { f1 (); f2 (); return 0; }
the_stack_data/39952.c
/* This File is Part of LibFalcon. * Copyright (c) 2018, Syed Nasim All rights reserved. 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. * Neither the name of LibFalcon 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(__cplusplus) extern "C" { #endif #include <ctype.h> #include <stdint.h> int32_t add(const int32_t a, const int32_t b) { return a + b; } #if defined(__cplusplus) } #endif
the_stack_data/1127570.c
#include <stdio.h> int main(int argc, char *argv[]) { unsigned long long int num = 0; while (scanf("%llu", &num) != EOF && !num) { if (!(num * 10 % 9)) printf("%llu ", num * 10 / 9 - 1); printf("%llu\n", num * 10 / 9); } return 0; }
the_stack_data/50098.c
#include <stdio.h> int main() { unsigned long int n; int m_n, d_n; scanf("%d" , &n); if (n > 0) { m_n = n % 5; d_n = n / 5; if ((m_n < 5) && (m_n != 0) && (d_n != 0)) printf("%d\n", d_n + 1); else if((d_n == 0)) printf("%d\n", m_n); else printf("%d\n", d_n); } return 0; }
the_stack_data/220456731.c
#include <stdio.h> #include <ctype.h> //forward declarations int can_print_it(char ch); void print_letters(char arg[]); void print_arguments(int argc, char *argv[]){ int i = 0; for(i = 0; i < argc; i++){ print_letters(argv[i]); } } void print_letters(char arg[]){ int i = 0; for(i = 0; arg[i] != '\0'; i++){ char ch = arg[i]; if(can_print_it(ch)){ printf("'%c' == %d ", ch, ch); } } printf("\n"); } int can_print_it(char ch){ return isalpha(ch) || isblank(ch); } int main(int argc, char *argv[]){ print_arguments(argc, argv); return 0; }
the_stack_data/801761.c
#include <stdio.h> int main(void) { int d1, d2, m1, m2, y1, y2; printf("Enter first date (mm/dd/yy): "); scanf("%d /%d /%d", &m1, &d1, &y1); printf("Enter second date (mm/dd/yy): "); scanf("%d /%d /%d", &m2, &d2, &y2); int day1 = y1 * 365 + m1 * 30 + d1; int day2 = y2 * 365 + m2 * 30 + d2; if (day1 > day2) printf("%d/%d/%.2d is earlier than %d/%d/%.2d\n", m2, d2, y2, m1, d1, y1); else if (day1 < day2) printf("%d/%d/%.2d is earlier than %d/%d/%.2d\n", m1, d1, y1, m2, d2, y2); else if (day1 == day2) printf("%d/%d/%.2d is equal to %d/%d/%.2d\n", m1, d1, y1, m2, d2, y2); return 0; } // Enter first date (mm/dd/yy): 2/11/2011 // Enter second date (mm/dd/yy): 3/23/2011
the_stack_data/889865.c
#include <stdio.h> #ifdef DEBUG #define abort() printf ("error, line %d\n", __LINE__) #endif int count; void a1() { ++count; } void b (unsigned long data) { if (data & 0x80000000) a1(); data <<= 1; if (data & 0x80000000) a1(); data <<= 1; if (data & 0x80000000) a1(); } main () { count = 0; b (0); if (count != 0) abort (); count = 0; b (0x80000000); if (count != 1) abort (); count = 0; b (0x40000000); if (count != 1) abort (); count = 0; b (0x20000000); if (count != 1) abort (); count = 0; b (0xc0000000); if (count != 2) abort (); count = 0; b (0xa0000000); if (count != 2) abort (); count = 0; b (0x60000000); if (count != 2) abort (); count = 0; b (0xe0000000); if (count != 3) abort (); #ifdef DEBUG printf ("Done.\n"); #endif exit (0); }
the_stack_data/40761582.c
/* $Id$ Part of SWI-Prolog Author: Jan Wielemaker E-mail: [email protected] WWW: http://www.swi-prolog.org Copyright (C): 1985-2002, University of Amsterdam This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifdef __MINGW32__ #define __WINDOWS__ 1 #endif #ifdef __WINDOWS__ #define WINVER 0x0501 #if (_MSC_VER >= 1300) || __MINGW32__ #include <winsock2.h> /* Needed on VC8 */ #include <windows.h> #else #include <windows.h> /* Needed for MSVC 5&6 */ #include <winsock2.h> #endif #ifdef __MINGW32__ #ifndef _WIN32_IE #define _WIN32_IE 0x0400 #endif /* FIXME: these are copied from SWI-Prolog.h. */ #define PL_MSG_EXCEPTION_RAISED -1 #define PL_MSG_IGNORED 0 #define PL_MSG_HANDLED 1 #endif #include "pl-incl.h" #ifdef __YAP_PROLOG__ #include "pl-utf8.h" #else #include "os/pl-utf8.h" #endif #include <process.h> #ifdef __YAP_PROLOG__ #include "pl-ctype.h" #else #include "os/pl-ctype.h" #endif #include <stdio.h> #include <stdarg.h> #ifdef __YAP_PROLOG__ #include "SWI-Stream.h" #else #include "os/SWI-Stream.h" #endif #include <process.h> #include <winbase.h> #ifdef HAVE_CRTDBG_H #include <crtdbg.h> #endif /******************************* * CONSOLE * *******************************/ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - There is no way to tell which subsystem an app belongs too, except for peeking in its executable-header. This is a bit too much ... - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ int hasConsole(void) { HANDLE h; if ( GD->os.gui_app == FALSE ) /* has been set explicitly */ succeed; /* I found a console */ if ( (h = GetStdHandle(STD_OUTPUT_HANDLE)) != INVALID_HANDLE_VALUE ) { DWORD mode; if ( GetConsoleMode(h, &mode) ) succeed; } /* assume we are GUI */ fail; } int PL_wait_for_console_input(void *handle) { BOOL rc; HANDLE hConsole = handle; for(;;) { rc = MsgWaitForMultipleObjects(1, &hConsole, FALSE, /* wait for either event */ INFINITE, QS_ALLINPUT); if ( rc == WAIT_OBJECT_0+1 ) { MSG msg; while( PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) ) { TranslateMessage(&msg); DispatchMessage(&msg); } } else if ( rc == WAIT_OBJECT_0 ) { return TRUE; } else { Sdprintf("MsgWaitForMultipleObjects(): 0x%x\n", rc); } } } /******************************* * MESSAGE BOX * *******************************/ void PlMessage(const char *fm, ...) { va_list(args); va_start(args, fm); if ( hasConsole() ) { Sfprintf(Serror, "SWI-Prolog: "); Svfprintf(Serror, fm, args); Sfprintf(Serror, "\n"); } else { char buf[1024]; vsprintf(buf, fm, args); MessageBox(NULL, buf, "SWI-Prolog", MB_OK|MB_TASKMODAL); } va_end(args); } /******************************* * WinAPI ERROR CODES * *******************************/ const char * WinError(void) { int id = GetLastError(); char *msg; static WORD lang; static int lang_initialised = 0; if ( !lang_initialised ) lang = MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_UK); again: if ( FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER| FORMAT_MESSAGE_IGNORE_INSERTS| FORMAT_MESSAGE_FROM_SYSTEM, NULL, /* source */ id, /* identifier */ lang, (LPTSTR) &msg, 0, /* size */ NULL) ) /* arguments */ { atom_t a = PL_new_atom(msg); LocalFree(msg); lang_initialised = 1; return stringAtom(a); } else { if ( lang_initialised == 0 ) { lang = MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT); lang_initialised = 1; goto again; } return "Unknown Windows error"; } } /******************************* * SLEEP/1 SUPPORT * *******************************/ int Pause(double t) { HANDLE h; if ( (h = CreateWaitableTimer(NULL, TRUE, NULL)) ) { LARGE_INTEGER ft; ft.QuadPart = -(LONGLONG)(t * 10000000.0); /* 100 nanosecs per tick */ SetWaitableTimer(h, &ft, 0, NULL, NULL, FALSE); for(;;) { int rc = MsgWaitForMultipleObjects(1, &h, FALSE, INFINITE, QS_ALLINPUT); if ( rc == WAIT_OBJECT_0+1 ) { MSG msg; while( PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) ) { TranslateMessage(&msg); DispatchMessage(&msg); } if ( PL_handle_signals() < 0 ) { CloseHandle(h); return FALSE; } } else break; } CloseHandle(h); return TRUE; } else /* Pre NT implementation */ { DWORD msecs = (DWORD)(t * 1000.0); while( msecs >= 100 ) { Sleep(100); if ( PL_handle_signals() < 0 ) return FALSE; msecs -= 100; } if ( msecs > 0 ) Sleep(msecs); return TRUE; } } /******************************* * SET FILE SIZE * *******************************/ #ifndef HAVE_FTRUNCATE int ftruncate(int fileno, int64_t length) { errno_t e; if ( (e=_chsize_s(fileno, length)) == 0 ) return 0; errno = e; return -1; } #endif /******************************* * QUERY CPU TIME * *******************************/ #define nano * 0.0000001 #define ntick 1.0 /* manual says 100.0 ??? */ double CpuTime(cputime_kind which) { double t; HANDLE proc = GetCurrentProcess(); FILETIME created, exited, kerneltime, usertime; if ( GetProcessTimes(proc, &created, &exited, &kerneltime, &usertime) ) { FILETIME *p; switch ( which ) { case CPU_USER: p = &usertime; break; case CPU_SYSTEM: p = &kerneltime; break; default: assert(0); return 0.0; } t = (double)p->dwHighDateTime * (4294967296.0 * ntick nano); t += (double)p->dwLowDateTime * (ntick nano); } else /* '95, Windows 3.1/win32s */ { t = 0.0; } return t; } static int CpuCount(void) { SYSTEM_INFO si; GetSystemInfo(&si); return si.dwNumberOfProcessors; } void setOSPrologFlags(void) { PL_set_prolog_flag("cpu_count", PL_INTEGER, CpuCount()); } char * findExecutable(const char *module, char *exe) { int n; wchar_t wbuf[MAXPATHLEN]; HMODULE hmod; if ( module ) { if ( !(hmod = GetModuleHandle(module)) ) { hmod = GetModuleHandle("libswipl.dll"); DEBUG(0, Sdprintf("Warning: could not find module from \"%s\"\n" "Warning: Trying %s to find home\n", module, hmod ? "\"LIBPL.DLL\"" : "executable")); } } else hmod = NULL; if ( (n = GetModuleFileNameW(hmod, wbuf, MAXPATHLEN)) > 0 ) { wbuf[n] = EOS; return _xos_long_file_name_toA(wbuf, exe, MAXPATHLEN); } else if ( module ) { char buf[MAXPATHLEN]; PrologPath(module, buf, sizeof(buf)); strcpy(exe, buf); } else *exe = EOS; return exe; } /******************************* * SUPPORT FOR SHELL/2 * *******************************/ typedef struct { const char *name; UINT id; } showtype; static int get_showCmd(term_t show, UINT *cmd) { char *s; showtype *st; static showtype types[] = { { "hide", SW_HIDE }, { "maximize", SW_MAXIMIZE }, { "minimize", SW_MINIMIZE }, { "restore", SW_RESTORE }, { "show", SW_SHOW }, { "showdefault", SW_SHOWDEFAULT }, { "showmaximized", SW_SHOWMAXIMIZED }, { "showminimized", SW_SHOWMINIMIZED }, { "showminnoactive", SW_SHOWMINNOACTIVE }, { "showna", SW_SHOWNA }, { "shownoactive", SW_SHOWNOACTIVATE }, { "shownormal", SW_SHOWNORMAL }, /* compatibility */ { "normal", SW_SHOWNORMAL }, { "iconic", SW_MINIMIZE }, { NULL, 0 }, }; if ( show == 0 ) { *cmd = SW_SHOWNORMAL; succeed; } if ( !PL_get_chars(show, &s, CVT_ATOM|CVT_EXCEPTION) ) fail; for(st=types; st->name; st++) { if ( streq(st->name, s) ) { *cmd = st->id; succeed; } } return PL_error(NULL, 0, NULL, ERR_DOMAIN, PL_new_atom("win_show"), show); } static int win_exec(size_t len, const wchar_t *cmd, UINT show) { GET_LD STARTUPINFOW startup; PROCESS_INFORMATION info; int rval; wchar_t *wcmd; memset(&startup, 0, sizeof(startup)); startup.cb = sizeof(startup); startup.wShowWindow = show; /* ensure 0-terminated */ wcmd = PL_malloc((len+1)*sizeof(wchar_t)); memcpy(wcmd, cmd, len*sizeof(wchar_t)); wcmd[len] = 0; rval = CreateProcessW(NULL, /* app */ wcmd, NULL, NULL, /* security */ FALSE, /* inherit handles */ 0, /* flags */ NULL, /* environment */ NULL, /* Directory */ &startup, &info); /* process info */ PL_free(wcmd); if ( rval ) { CloseHandle(info.hProcess); CloseHandle(info.hThread); succeed; } else { term_t tmp = PL_new_term_ref(); return ( PL_unify_wchars(tmp, PL_ATOM, len, cmd) && PL_error(NULL, 0, WinError(), ERR_SHELL_FAILED, tmp) ); } } static void utf8towcs(wchar_t *o, const char *src) { for( ; *src; ) { int wc; src = utf8_get_char(src, &wc); *o++ = wc; } *o = 0; } int System(char *command) /* command is a UTF-8 string */ { STARTUPINFOW sinfo; PROCESS_INFORMATION pinfo; int shell_rval; size_t len; wchar_t *wcmd; memset(&sinfo, 0, sizeof(sinfo)); sinfo.cb = sizeof(sinfo); len = utf8_strlen(command, strlen(command)); wcmd = PL_malloc((len+1)*sizeof(wchar_t)); utf8towcs(wcmd, command); if ( CreateProcessW(NULL, /* module */ wcmd, /* command line */ NULL, /* Security stuff */ NULL, /* Thread security stuff */ FALSE, /* Inherit handles */ CREATE_NO_WINDOW, /* flags */ NULL, /* environment */ NULL, /* CWD */ &sinfo, /* startup info */ &pinfo) ) /* process into */ { BOOL rval; DWORD code; CloseHandle(pinfo.hThread); /* don't need this */ PL_free(wcmd); do { MSG msg; if ( PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) ) { TranslateMessage(&msg); DispatchMessage(&msg); } else Sleep(50); rval = GetExitCodeProcess(pinfo.hProcess, &code); } while(rval == TRUE && code == STILL_ACTIVE); shell_rval = (rval == TRUE ? code : -1); CloseHandle(pinfo.hProcess); } else { PL_free(wcmd); return shell_rval = -1; } return shell_rval; } word pl_win_exec(term_t cmd, term_t how) { wchar_t *s; size_t len; UINT h; if ( PL_get_wchars(cmd, &len, &s, CVT_ALL|CVT_EXCEPTION) && get_showCmd(how, &h) ) { return win_exec(len, s, h); } else fail; } typedef struct { int eno; const char *message; } shell_error; static const shell_error se_errors[] = { { 0 , "Out of memory or resources" }, { ERROR_FILE_NOT_FOUND, "File not found" }, { ERROR_PATH_NOT_FOUND, "path not found" }, { ERROR_BAD_FORMAT, "Invalid .EXE" }, { SE_ERR_ACCESSDENIED, "Access denied" }, { SE_ERR_ASSOCINCOMPLETE, "Incomplete association" }, { SE_ERR_DDEBUSY, "DDE server busy" }, { SE_ERR_DDEFAIL, "DDE transaction failed" }, { SE_ERR_DDETIMEOUT, "DDE request timed out" }, { SE_ERR_DLLNOTFOUND, "DLL not found" }, { SE_ERR_FNF, "File not found (FNF)" }, { SE_ERR_NOASSOC, "No association" }, { SE_ERR_OOM, "Not enough memory" }, { SE_ERR_PNF, "Path not found (PNF)" }, { SE_ERR_SHARE, "Sharing violation" }, { 0, NULL } }; static int win_shell(term_t op, term_t file, term_t how) { size_t lo, lf; wchar_t *o, *f; UINT h; HINSTANCE instance; if ( !PL_get_wchars(op, &lo, &o, CVT_ALL|CVT_EXCEPTION|BUF_RING) || !PL_get_wchars(file, &lf, &f, CVT_ALL|CVT_EXCEPTION|BUF_RING) || !get_showCmd(how, &h) ) fail; instance = ShellExecuteW(NULL, o, f, NULL, NULL, h); if ( (intptr_t)instance <= 32 ) { const shell_error *se; for(se = se_errors; se->message; se++) { if ( se->eno == (int)(intptr_t)instance ) return PL_error(NULL, 0, se->message, ERR_SHELL_FAILED, file); } PL_error(NULL, 0, NULL, ERR_SHELL_FAILED, file); } succeed; } static PRED_IMPL("win_shell", 2, win_shell2, 0) { return win_shell(A1, A2, 0); } static PRED_IMPL("win_shell", 3, win_shell3, 0) { return win_shell(A1, A2, A3); } foreign_t pl_win_module_file(term_t module, term_t file) { char buf[MAXPATHLEN]; char *m; char *f; if ( !PL_get_chars(module, &m, CVT_ALL|CVT_EXCEPTION) ) fail; if ( (f = findExecutable(m, buf)) ) return PL_unify_atom_chars(file, f); fail; } /******************************* * WINDOWS MESSAGES * *******************************/ LRESULT PL_win_message_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { #ifdef O_PLMT if ( hwnd == NULL && message == WM_SIGNALLED && wParam == 0 && /* or another constant? */ lParam == 0 ) { if ( PL_handle_signals() < 0 ) return PL_MSG_EXCEPTION_RAISED; return PL_MSG_HANDLED; } #endif return PL_MSG_IGNORED; } /******************************* * DLOPEN AND FRIENDS * *******************************/ #ifdef EMULATE_DLOPEN /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - These functions emulate the bits from the ELF shared object interface we need. They are used by pl-load.c, which defines the actual Prolog interface. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #ifdef HAVE_LIBLOADERAPI_H #include <LibLoaderAPI.h> #else #ifndef LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR #define LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR 0x00000100 #endif #ifndef LOAD_LIBRARY_SEARCH_DEFAULT_DIRS #define LOAD_LIBRARY_SEARCH_DEFAULT_DIRS 0x00001000 #endif typedef void * DLL_DIRECTORY_COOKIE; #endif static const char *dlmsg; static DLL_DIRECTORY_COOKIE WINAPI (*f_AddDllDirectoryW)(wchar_t* dir); static BOOL WINAPI (*f_RemoveDllDirectory)(DLL_DIRECTORY_COOKIE); static DWORD load_library_search_flags(void) { static int done = FALSE; static DWORD flags = 0; if ( !done ) { HMODULE kernel = GetModuleHandle(TEXT("kernel32.dll")); if ( (f_AddDllDirectoryW = (void*)GetProcAddress(kernel, "AddDllDirectory")) && (f_RemoveDllDirectory = (void*)GetProcAddress(kernel, "RemoveDllDirectory")) ) { flags = ( LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR| LOAD_LIBRARY_SEARCH_DEFAULT_DIRS ); } done = TRUE; } return flags; } static PRED_IMPL("win_add_dll_directory", 2, win_add_dll_directory, 0) { PRED_LD char *dirs; if ( PL_get_file_name(A1, &dirs, REP_UTF8) ) { size_t len = utf8_strlen(dirs, strlen(dirs)); wchar_t *dirw = alloca((len+10)*sizeof(wchar_t)); DLL_DIRECTORY_COOKIE cookie; if ( _xos_os_filenameW(dirs, dirw, len+10) == NULL ) return PL_representation_error("file_name"); if ( load_library_search_flags() ) { if ( (cookie = (*f_AddDllDirectoryW)(dirw)) ) return PL_unify_int64(A2, (int64_t)cookie); return PL_error(NULL, 0, WinError(), ERR_SYSCALL, "AddDllDirectory()"); } else return FALSE; } else return FALSE; } static PRED_IMPL("win_remove_dll_directory", 1, win_remove_dll_directory, 0) { int64_t icookie; if ( PL_get_int64_ex(A1, &icookie) ) { if ( f_RemoveDllDirectory ) { if ( (*f_RemoveDllDirectory)((DLL_DIRECTORY_COOKIE)icookie) ) return TRUE; return PL_error(NULL, 0, WinError(), ERR_SYSCALL, "RemoveDllDirectory()"); } else return FALSE; } else return FALSE; } static int is_windows_abs_path(const wchar_t *path) { if ( path[1] == ':' && path[0] < 0x80 && iswalpha(path[0]) ) return TRUE; /* drive */ if ( path[0] == '\\' && path[1] == '\\' ) return TRUE; /* UNC */ return FALSE; } void * dlopen(const char *file, int flags) /* file is in UTF-8, POSIX path */ { HINSTANCE h; DWORD llflags = 0; size_t len = utf8_strlen(file, strlen(file)); wchar_t *wfile = alloca((len+10)*sizeof(wchar_t)); if ( !wfile ) { dlmsg = "No memory"; return NULL; } if ( _xos_os_filenameW(file, wfile, len+10) == NULL ) { dlmsg = "Name too long"; return NULL; } if ( is_windows_abs_path(wfile) ) llflags |= load_library_search_flags(); if ( (h = LoadLibraryExW(wfile, NULL, llflags)) ) { dlmsg = "No Error"; return (void *)h; } dlmsg = WinError(); return NULL; } const char * dlerror(void) { return dlmsg; } void * dlsym(void *handle, char *symbol) { void *addr = GetProcAddress(handle, symbol); if ( addr ) { dlmsg = "No Error"; return addr; } dlmsg = WinError(); return NULL; } int dlclose(void *handle) { FreeLibrary(handle); return 0; } #endif /*EMULATE_DLOPEN*/ /******************************* * SNPRINTF MADNESS * *******************************/ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - MS-Windows _snprintf() may look like C99 snprintf(), but is is not quite the same: on overflow, the buffer is *not* 0-terminated and the return is negative (unspecified how negative). The code below works around this, returning count on overflow. This is still not the same as the C99 version that returns the number of characters that would have been written, but it seems to be enough for our purposes. See http://www.di-mgt.com.au/cprog.html#snprintf The above came from the provided link, but it is even worse (copied from VS2005 docs): - If len < count, then len characters are stored in buffer, a null-terminator is appended, and len is returned. - If len = count, then len characters are stored in buffer, no null-terminator is appended, and len is returned. - If len > count, then count characters are stored in buffer, no null-terminator is appended, and a negative value is returned. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ int ms_snprintf(char *buffer, size_t count, const char *fmt, ...) { va_list ap; int ret; va_start(ap, fmt); ret = _vsnprintf(buffer, count-1, fmt, ap); va_end(ap); if ( ret < 0 || ret == count ) { ret = (int)count; buffer[count-1] = '\0'; } return ret; } /******************************* * FOLDERS * *******************************/ #ifdef HAVE_SHLOBJ_H #include <shlobj.h> #endif typedef struct folderid { int csidl; const char *name; } folderid; static const folderid folderids[] = { { CSIDL_COMMON_ALTSTARTUP, "common_altstartup" }, { CSIDL_ALTSTARTUP, "altstartup" }, { CSIDL_APPDATA, "appdata" }, { CSIDL_CONTROLS, "controls" }, { CSIDL_COOKIES, "cookies" }, { CSIDL_DESKTOP, "desktop" }, { CSIDL_COMMON_DESKTOPDIRECTORY, "common_desktopdirectory" }, { CSIDL_DESKTOPDIRECTORY, "desktopdirectory" }, { CSIDL_COMMON_FAVORITES, "common_favorites" }, { CSIDL_FAVORITES, "favorites" }, { CSIDL_FONTS, "fonts" }, { CSIDL_HISTORY, "history" }, { CSIDL_INTERNET_CACHE, "internet_cache" }, { CSIDL_INTERNET, "internet" }, { CSIDL_DRIVES, "drives" }, { CSIDL_PERSONAL, "personal" }, { CSIDL_NETWORK, "network" }, { CSIDL_NETHOOD, "nethood" }, { CSIDL_PERSONAL, "personal" }, { CSIDL_PRINTERS, "printers" }, { CSIDL_PRINTHOOD, "printhood" }, { CSIDL_COMMON_PROGRAMS, "common_programs" }, { CSIDL_PROGRAMS, "programs" }, { CSIDL_RECENT, "recent" }, { CSIDL_BITBUCKET, "bitbucket" }, { CSIDL_SENDTO, "sendto" }, { CSIDL_COMMON_STARTMENU, "common_startmenu" }, { CSIDL_STARTMENU, "startmenu" }, { CSIDL_COMMON_STARTUP, "common_startup" }, { CSIDL_STARTUP, "startup" }, { CSIDL_TEMPLATES, "templates" }, { 0, NULL } }; static int unify_csidl_path(term_t t, int csidl) { wchar_t buf[MAX_PATH]; if ( SHGetSpecialFolderPathW(0, buf, csidl, FALSE) ) { wchar_t *p; for(p=buf; *p; p++) { if ( *p == '\\' ) *p = '/'; } return PL_unify_wchars(t, PL_ATOM, -1, buf); } else return PL_error(NULL, 0, WinError(), ERR_SYSCALL, "SHGetSpecialFolderPath"); } static PRED_IMPL("win_folder", 2, win_folder, PL_FA_NONDETERMINISTIC) { GET_LD int n; switch( CTX_CNTRL ) { case FRG_FIRST_CALL: if ( PL_is_variable(A1) ) { n = 0; goto generate; } else { char *s; if ( PL_get_chars(A1, &s, CVT_ATOM|CVT_EXCEPTION) ) { const folderid *fid; for(fid = folderids; fid->name; fid++) { if ( streq(s, fid->name) ) return unify_csidl_path(A2, fid->csidl); } { atom_t dom = PL_new_atom("win_folder"); PL_error(NULL, 0, NULL, ERR_DOMAIN, dom, A1); PL_unregister_atom(dom); return FALSE; } } else return FALSE; } case FRG_REDO: { fid_t fid; n = (int)CTX_INT+1; generate: fid = PL_open_foreign_frame(); for(; folderids[n].name; n++) { if ( unify_csidl_path(A2, folderids[n].csidl) && PL_unify_atom_chars(A1, folderids[n].name) ) { PL_close_foreign_frame(fid); ForeignRedoInt(n); } PL_rewind_foreign_frame(fid); } PL_close_foreign_frame(fid); return FALSE; } default: succeed; } } /******************************* * REGISTRY * *******************************/ #define wstreq(s,q) (wcscmp((s), (q)) == 0) static HKEY reg_open_key(const wchar_t *which, int create) { HKEY key = HKEY_CURRENT_USER; DWORD disp; LONG rval; while(*which) { wchar_t buf[256]; wchar_t *s; HKEY tmp; for(s=buf; *which && !(*which == '/' || *which == '\\'); ) *s++ = *which++; *s = '\0'; if ( *which ) which++; if ( wstreq(buf, L"HKEY_CLASSES_ROOT") ) { key = HKEY_CLASSES_ROOT; continue; } else if ( wstreq(buf, L"HKEY_CURRENT_USER") ) { key = HKEY_CURRENT_USER; continue; } else if ( wstreq(buf, L"HKEY_LOCAL_MACHINE") ) { key = HKEY_LOCAL_MACHINE; continue; } else if ( wstreq(buf, L"HKEY_USERS") ) { key = HKEY_USERS; continue; } DEBUG(2, Sdprintf("Trying %s\n", buf)); if ( RegOpenKeyExW(key, buf, 0L, KEY_READ, &tmp) == ERROR_SUCCESS ) { RegCloseKey(key); key = tmp; continue; } if ( !create ) return NULL; rval = RegCreateKeyExW(key, buf, 0, L"", 0, KEY_ALL_ACCESS, NULL, &tmp, &disp); RegCloseKey(key); if ( rval == ERROR_SUCCESS ) key = tmp; else return NULL; } return key; } #define MAXREGSTRLEN 1024 static PRED_IMPL("win_registry_get_value", 3, win_registry_get_value, 0) { GET_LD DWORD type; BYTE data[MAXREGSTRLEN]; DWORD len = sizeof(data); size_t klen, namlen; wchar_t *k, *name; HKEY key; term_t Key = A1; term_t Name = A2; term_t Value = A3; if ( !PL_get_wchars(Key, &klen, &k, CVT_ATOM|CVT_EXCEPTION) || !PL_get_wchars(Name, &namlen, &name, CVT_ATOM|CVT_ATOM) ) return FALSE; if ( !(key=reg_open_key(k, FALSE)) ) return PL_error(NULL, 0, NULL, ERR_EXISTENCE, PL_new_atom("key"), Key); DEBUG(9, Sdprintf("key = %p, name = %s\n", key, name)); if ( RegQueryValueExW(key, name, NULL, &type, data, &len) == ERROR_SUCCESS ) { RegCloseKey(key); DWORD *datap; switch(type) { case REG_SZ: return PL_unify_wchars(Value, PL_ATOM, len/sizeof(wchar_t)-1, (wchar_t*)data); case REG_DWORD: { datap = (DWORD *)data; return PL_unify_integer(Value, datap[0]); } default: warning("get_registry_value/2: Unknown registry-type: %d", type); fail; } } return FALSE; } /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Get the local, global, trail and argument-stack defaults from the registry. They can be on the HKEY_CURRENT_USER as well as the HKEY_LOCAL_MACHINE registries to allow for both user-only and system-wide settings. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static struct regdef { const char *name; int *address; } const regdefs[] = { { "localSize", &GD->defaults.local }, { "globalSize", &GD->defaults.global }, { "trailSize", &GD->defaults.trail }, { NULL, NULL } }; static void setStacksFromKey(HKEY key) { DWORD type; BYTE data[128]; DWORD len = sizeof(data); const struct regdef *rd; for(rd = regdefs; rd->name; rd++) { if ( RegQueryValueEx(key, rd->name, NULL, &type, data, &len) == ERROR_SUCCESS && type == REG_DWORD ) { DWORD v, *datap = (DWORD *)data; v = datap[0]; *rd->address = (int)v; } } } void getDefaultsFromRegistry(void) { HKEY key; if ( (key = reg_open_key(L"HKEY_LOCAL_MACHINE/Software/SWI/Prolog", FALSE)) ) { setStacksFromKey(key); RegCloseKey(key); } if ( (key = reg_open_key(L"HKEY_CURRENT_USER/Software/SWI/Prolog", FALSE)) ) { setStacksFromKey(key); RegCloseKey(key); } } /******************************* * PUBLISH PREDICATES * *******************************/ BeginPredDefs(win) PRED_DEF("win_shell", 2, win_shell2, 0) PRED_DEF("win_shell", 3, win_shell3, 0) PRED_DEF("win_registry_get_value", 3, win_registry_get_value, 0) PRED_DEF("win_folder", 2, win_folder, PL_FA_NONDETERMINISTIC) #ifdef EMULATE_DLOPEN PRED_DEF("win_add_dll_directory", 2, win_add_dll_directory, 0) PRED_DEF("win_remove_dll_directory", 1, win_remove_dll_directory, 0) #endif EndPredDefs #endif /*__WINDOWS__*/
the_stack_data/1125968.c
#include <elf.h> #include <link.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <sys/mman.h> #include <fcntl.h> #include <stdlib.h> #include <stdio.h> #include <assert.h> #include <string.h> int main (int argc, char *argv[]) { const char *filename = argv[1]; int fd = open (filename, O_RDONLY); struct stat buf; fstat (fd, &buf); unsigned long file = (unsigned long)mmap (0, buf.st_size, PROT_READ, MAP_PRIVATE, fd, 0); if (file == (unsigned long)MAP_FAILED) { exit (1); } ElfW(Ehdr) *header = (ElfW(Ehdr) *)file; ElfW(Shdr) *sh = (ElfW(Shdr)*)(file + header->e_shoff); ElfW(Sym) *symtab = 0; unsigned long n_symtab = 0; ElfW(Half) *versym = 0; ElfW(Verdef) *verdef = 0; char *strtab = 0; int i; for (i = 0; i < header->e_shnum; i++) { if (sh[i].sh_type == SHT_DYNSYM) { symtab = (ElfW(Sym)*)(file + sh[i].sh_offset); n_symtab = sh[i].sh_size / sh[i].sh_entsize; } else if (sh[i].sh_type == SHT_STRTAB && strtab == 0) { // XXX: should check the section name. strtab = (char*)(file+sh[i].sh_offset); } else if (sh[i].sh_type == SHT_GNU_versym) { versym = (ElfW(Half)*)(file+sh[i].sh_offset); } else if (sh[i].sh_type == SHT_GNU_verdef) { verdef = (ElfW(Verdef)*)(file+sh[i].sh_offset); } } if (strtab == 0 || verdef == 0 || symtab == 0 || n_symtab == 0 || versym == 0) { exit (3); } ElfW(Verdef) *cur, *prev; int local_passthru_printed = 0; for (prev = 0, cur = verdef; cur != prev; prev = cur, cur = (ElfW(Verdef)*)(((unsigned long)cur)+cur->vd_next)) { assert (cur->vd_version == 1); assert (cur->vd_cnt == 2 || cur->vd_cnt == 1); ElfW(Verdaux) *first = (ElfW(Verdaux)*)(((unsigned long)cur)+cur->vd_aux); if (cur->vd_flags & VER_FLG_BASE) { continue; } printf ("%s {\n", strtab + first->vda_name); int has_one_symbol = 0; for (i = 0; i < n_symtab; i++) { if (symtab[i].st_name == 0 || symtab[i].st_value == 0) { continue; } ElfW(Half) ver = versym[i]; if (cur->vd_ndx == ver) { if (!has_one_symbol) { has_one_symbol = 1; printf ("global:\n"); } printf ("\t%s;\n", strtab + symtab[i].st_name); } } if (cur->vd_cnt == 1) { if (!local_passthru_printed) { local_passthru_printed = 1; printf ("local:*;\n};\n"); } else { printf ("};\n"); } } else { ElfW(Verdaux) *parent = (ElfW(Verdaux)*)(((unsigned long)first)+first->vda_next); printf ("} %s;\n", strtab + parent->vda_name); } } return 0; }
the_stack_data/980810.c
/* Nama : Zidan Rafindra Utomo NIM : 24060121130051 tgl pengerjaan: 14 maret 2022 */ #include <stdio.h> int main(){ // kamus int bulan; // Algoritma //input printf("%s", "Masukan nomor bulan"); scanf("%d", &bulan); //proses & output switch (bulan){ case 1: printf("%s", "Januari"); break; case 2: printf("%s", "Februari"); break; case 3: printf("%s", "Maret"); break; case 4: printf("%s", "April"); break; case 5: printf("%s", "Mei"); break; case 6: printf("%s", "Juni"); break; case 7: printf("%s", "Juli"); break; case 8: printf("%s", "Agustus"); break; case 9: printf("%s", "September"); break; case 10: printf("%s", "Oktober"); break; case 11: printf("%s", "November"); break; case 12: printf("%s", "Desember"); break; default: printf("%s", "masukan nomor bulan tidak tepat"); break; } return 0; }
the_stack_data/64201529.c
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <CL/cl.h> unsigned char *read_buffer(char *file_name, size_t *size_ptr) { FILE *f; unsigned char *buf; size_t size; /* Open file */ f = fopen(file_name, "rb"); if (!f) return NULL; /* Obtain file size */ fseek(f, 0, SEEK_END); size = ftell(f); fseek(f, 0, SEEK_SET); /* Allocate and read buffer */ buf = malloc(size + 1); fread(buf, 1, size, f); buf[size] = '\0'; /* Return size of buffer */ if (size_ptr) *size_ptr = size; /* Return buffer */ return buf; } void write_buffer(char *file_name, const char *buffer, size_t buffer_size) { FILE *f; /* Open file */ f = fopen(file_name, "w+"); /* Write buffer */ if(buffer) fwrite(buffer, 1, buffer_size, f); /* Close file */ fclose(f); } int main(int argc, char const *argv[]) { /* Get platform */ cl_platform_id platform; cl_uint num_platforms; cl_int ret = clGetPlatformIDs(1, &platform, &num_platforms); if (ret != CL_SUCCESS) { printf("error: call to 'clGetPlatformIDs' failed\n"); exit(1); } printf("Number of platforms: %d\n", num_platforms); printf("platform=%p\n", platform); /* Get platform name */ char platform_name[100]; ret = clGetPlatformInfo(platform, CL_PLATFORM_NAME, sizeof(platform_name), platform_name, NULL); if (ret != CL_SUCCESS) { printf("error: call to 'clGetPlatformInfo' failed\n"); exit(1); } printf("platform.name='%s'\n\n", platform_name); /* Get device */ cl_device_id device; cl_uint num_devices; ret = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 1, &device, &num_devices); if (ret != CL_SUCCESS) { printf("error: call to 'clGetDeviceIDs' failed\n"); exit(1); } printf("Number of devices: %d\n", num_devices); printf("device=%p\n", device); /* Get device name */ char device_name[100]; ret = clGetDeviceInfo(device, CL_DEVICE_NAME, sizeof(device_name), device_name, NULL); if (ret != CL_SUCCESS) { printf("error: call to 'clGetDeviceInfo' failed\n"); exit(1); } printf("device.name='%s'\n", device_name); printf("\n"); /* Create a Context Object */ cl_context context; context = clCreateContext(NULL, 1, &device, NULL, NULL, &ret); if (ret != CL_SUCCESS) { printf("error: call to 'clCreateContext' failed\n"); exit(1); } printf("context=%p\n", context); /* Create a Command Queue Object*/ cl_command_queue command_queue; command_queue = clCreateCommandQueue(context, device, 0, &ret); if (ret != CL_SUCCESS) { printf("error: call to 'clCreateCommandQueue' failed\n"); exit(1); } printf("command_queue=%p\n", command_queue); printf("\n"); /* Program source */ unsigned char *source_code; size_t source_length; /* Read program from 'native_exp10_float16.cl' */ source_code = read_buffer("native_exp10_float16.cl", &source_length); /* Create a program */ cl_program program; program = clCreateProgramWithSource(context, 1, (const char **)&source_code, &source_length, &ret); if (ret != CL_SUCCESS) { printf("error: call to 'clCreateProgramWithSource' failed\n"); exit(1); } printf("program=%p\n", program); /* Build program */ ret = clBuildProgram(program, 1, &device, NULL, NULL, NULL); if (ret != CL_SUCCESS ) { size_t size; char *log; /* Get log size */ clGetProgramBuildInfo(program, device, CL_PROGRAM_BUILD_LOG,0, NULL, &size); /* Allocate log and print */ log = malloc(size); clGetProgramBuildInfo(program, device, CL_PROGRAM_BUILD_LOG,size, log, NULL); printf("error: call to 'clBuildProgram' failed:\n%s\n", log); /* Free log and exit */ free(log); exit(1); } printf("program built\n"); printf("\n"); /* Create a Kernel Object */ cl_kernel kernel; kernel = clCreateKernel(program, "native_exp10_float16", &ret); if (ret != CL_SUCCESS) { printf("error: call to 'clCreateKernel' failed\n"); exit(1); } /* Create and allocate host buffers */ size_t num_elem = 10; /* Create and init host side src buffer 0 */ cl_float16 *src_0_host_buffer; src_0_host_buffer = malloc(num_elem * sizeof(cl_float16)); for (int i = 0; i < num_elem; i++) src_0_host_buffer[i] = (cl_float16){{2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0}}; /* Create and init device side src buffer 0 */ cl_mem src_0_device_buffer; src_0_device_buffer = clCreateBuffer(context, CL_MEM_READ_ONLY, num_elem * sizeof(cl_float16), NULL, &ret); if (ret != CL_SUCCESS) { printf("error: could not create source buffer\n"); exit(1); } ret = clEnqueueWriteBuffer(command_queue, src_0_device_buffer, CL_TRUE, 0, num_elem * sizeof(cl_float16), src_0_host_buffer, 0, NULL, NULL); if (ret != CL_SUCCESS) { printf("error: call to 'clEnqueueWriteBuffer' failed\n"); exit(1); } /* Create host dst buffer */ cl_float16 *dst_host_buffer; dst_host_buffer = malloc(num_elem * sizeof(cl_float16)); memset((void *)dst_host_buffer, 1, num_elem * sizeof(cl_float16)); /* Create device dst buffer */ cl_mem dst_device_buffer; dst_device_buffer = clCreateBuffer(context, CL_MEM_WRITE_ONLY, num_elem *sizeof(cl_float16), NULL, &ret); if (ret != CL_SUCCESS) { printf("error: could not create dst buffer\n"); exit(1); } /* Set kernel arguments */ ret = CL_SUCCESS; ret |= clSetKernelArg(kernel, 0, sizeof(cl_mem), &src_0_device_buffer); ret |= clSetKernelArg(kernel, 1, sizeof(cl_mem), &dst_device_buffer); if (ret != CL_SUCCESS) { printf("error: call to 'clSetKernelArg' failed\n"); exit(1); } /* Launch the kernel */ size_t global_work_size = num_elem; size_t local_work_size = num_elem; ret = clEnqueueNDRangeKernel(command_queue, kernel, 1, NULL, &global_work_size, &local_work_size, 0, NULL, NULL); if (ret != CL_SUCCESS) { printf("error: call to 'clEnqueueNDRangeKernel' failed\n"); exit(1); } /* Wait for it to finish */ clFinish(command_queue); /* Read results from GPU */ ret = clEnqueueReadBuffer(command_queue, dst_device_buffer, CL_TRUE,0, num_elem * sizeof(cl_float16), dst_host_buffer, 0, NULL, NULL); if (ret != CL_SUCCESS) { printf("error: call to 'clEnqueueReadBuffer' failed\n"); exit(1); } /* Dump dst buffer to file */ char dump_file[100]; sprintf((char *)&dump_file, "%s.result", argv[0]); write_buffer(dump_file, (const char *)dst_host_buffer, num_elem * sizeof(cl_float16)); printf("Result dumped to %s\n", dump_file); /* Free host dst buffer */ free(dst_host_buffer); /* Free device dst buffer */ ret = clReleaseMemObject(dst_device_buffer); if (ret != CL_SUCCESS) { printf("error: call to 'clReleaseMemObject' failed\n"); exit(1); } /* Free host side src buffer 0 */ free(src_0_host_buffer); /* Free device side src buffer 0 */ ret = clReleaseMemObject(src_0_device_buffer); if (ret != CL_SUCCESS) { printf("error: call to 'clReleaseMemObject' failed\n"); exit(1); } /* Release kernel */ ret = clReleaseKernel(kernel); if (ret != CL_SUCCESS) { printf("error: call to 'clReleaseKernel' failed\n"); exit(1); } /* Release program */ ret = clReleaseProgram(program); if (ret != CL_SUCCESS) { printf("error: call to 'clReleaseProgram' failed\n"); exit(1); } /* Release command queue */ ret = clReleaseCommandQueue(command_queue); if (ret != CL_SUCCESS) { printf("error: call to 'clReleaseCommandQueue' failed\n"); exit(1); } /* Release context */ ret = clReleaseContext(context); if (ret != CL_SUCCESS) { printf("error: call to 'clReleaseContext' failed\n"); exit(1); } return 0; }
the_stack_data/150140060.c
/* * Copyright 2019 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) 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. * * Author: AMD */ #ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT #include <drm/drm_dsc.h> #include "dc_hw_types.h" #include "dsc.h" #include <drm/drm_dp_helper.h> #include "dc.h" #include "rc_calc.h" /* This module's internal functions */ /* default DSC policy target bitrate limit is 16bpp */ static uint32_t dsc_policy_max_target_bpp_limit = 16; /* default DSC policy enables DSC only when needed */ static bool dsc_policy_enable_dsc_when_not_needed; static bool dsc_policy_disable_dsc_stream_overhead; static bool dsc_buff_block_size_from_dpcd(int dpcd_buff_block_size, int *buff_block_size) { switch (dpcd_buff_block_size) { case DP_DSC_RC_BUF_BLK_SIZE_1: *buff_block_size = 1024; break; case DP_DSC_RC_BUF_BLK_SIZE_4: *buff_block_size = 4 * 1024; break; case DP_DSC_RC_BUF_BLK_SIZE_16: *buff_block_size = 16 * 1024; break; case DP_DSC_RC_BUF_BLK_SIZE_64: *buff_block_size = 64 * 1024; break; default: { dm_error("%s: DPCD DSC buffer size not recognized.\n", __func__); return false; } } return true; } static bool dsc_line_buff_depth_from_dpcd(int dpcd_line_buff_bit_depth, int *line_buff_bit_depth) { if (0 <= dpcd_line_buff_bit_depth && dpcd_line_buff_bit_depth <= 7) *line_buff_bit_depth = dpcd_line_buff_bit_depth + 9; else if (dpcd_line_buff_bit_depth == 8) *line_buff_bit_depth = 8; else { dm_error("%s: DPCD DSC buffer depth not recognized.\n", __func__); return false; } return true; } static bool dsc_throughput_from_dpcd(int dpcd_throughput, int *throughput) { switch (dpcd_throughput) { case DP_DSC_THROUGHPUT_MODE_0_UNSUPPORTED: *throughput = 0; break; case DP_DSC_THROUGHPUT_MODE_0_170: *throughput = 170; break; case DP_DSC_THROUGHPUT_MODE_0_340: *throughput = 340; break; case DP_DSC_THROUGHPUT_MODE_0_400: *throughput = 400; break; case DP_DSC_THROUGHPUT_MODE_0_450: *throughput = 450; break; case DP_DSC_THROUGHPUT_MODE_0_500: *throughput = 500; break; case DP_DSC_THROUGHPUT_MODE_0_550: *throughput = 550; break; case DP_DSC_THROUGHPUT_MODE_0_600: *throughput = 600; break; case DP_DSC_THROUGHPUT_MODE_0_650: *throughput = 650; break; case DP_DSC_THROUGHPUT_MODE_0_700: *throughput = 700; break; case DP_DSC_THROUGHPUT_MODE_0_750: *throughput = 750; break; case DP_DSC_THROUGHPUT_MODE_0_800: *throughput = 800; break; case DP_DSC_THROUGHPUT_MODE_0_850: *throughput = 850; break; case DP_DSC_THROUGHPUT_MODE_0_900: *throughput = 900; break; case DP_DSC_THROUGHPUT_MODE_0_950: *throughput = 950; break; case DP_DSC_THROUGHPUT_MODE_0_1000: *throughput = 1000; break; default: { dm_error("%s: DPCD DSC throughput mode not recognized.\n", __func__); return false; } } return true; } static bool dsc_bpp_increment_div_from_dpcd(uint8_t bpp_increment_dpcd, uint32_t *bpp_increment_div) { // Mask bpp increment dpcd field to avoid reading other fields bpp_increment_dpcd &= 0x7; switch (bpp_increment_dpcd) { case 0: *bpp_increment_div = 16; break; case 1: *bpp_increment_div = 8; break; case 2: *bpp_increment_div = 4; break; case 3: *bpp_increment_div = 2; break; case 4: *bpp_increment_div = 1; break; default: { dm_error("%s: DPCD DSC bits-per-pixel increment not recognized.\n", __func__); return false; } } return true; } static void get_dsc_enc_caps( const struct display_stream_compressor *dsc, struct dsc_enc_caps *dsc_enc_caps, int pixel_clock_100Hz) { // This is a static HW query, so we can use any DSC memset(dsc_enc_caps, 0, sizeof(struct dsc_enc_caps)); if (dsc) { if (!dsc->ctx->dc->debug.disable_dsc) dsc->funcs->dsc_get_enc_caps(dsc_enc_caps, pixel_clock_100Hz); if (dsc->ctx->dc->debug.native422_support) dsc_enc_caps->color_formats.bits.YCBCR_NATIVE_422 = 1; } } /* Returns 'false' if no intersection was found for at least one capablity. * It also implicitly validates some sink caps against invalid value of zero. */ static bool intersect_dsc_caps( const struct dsc_dec_dpcd_caps *dsc_sink_caps, const struct dsc_enc_caps *dsc_enc_caps, enum dc_pixel_encoding pixel_encoding, struct dsc_enc_caps *dsc_common_caps) { int32_t max_slices; int32_t total_sink_throughput; memset(dsc_common_caps, 0, sizeof(struct dsc_enc_caps)); dsc_common_caps->dsc_version = min(dsc_sink_caps->dsc_version, dsc_enc_caps->dsc_version); if (!dsc_common_caps->dsc_version) return false; dsc_common_caps->slice_caps.bits.NUM_SLICES_1 = dsc_sink_caps->slice_caps1.bits.NUM_SLICES_1 && dsc_enc_caps->slice_caps.bits.NUM_SLICES_1; dsc_common_caps->slice_caps.bits.NUM_SLICES_2 = dsc_sink_caps->slice_caps1.bits.NUM_SLICES_2 && dsc_enc_caps->slice_caps.bits.NUM_SLICES_2; dsc_common_caps->slice_caps.bits.NUM_SLICES_4 = dsc_sink_caps->slice_caps1.bits.NUM_SLICES_4 && dsc_enc_caps->slice_caps.bits.NUM_SLICES_4; dsc_common_caps->slice_caps.bits.NUM_SLICES_8 = dsc_sink_caps->slice_caps1.bits.NUM_SLICES_8 && dsc_enc_caps->slice_caps.bits.NUM_SLICES_8; if (!dsc_common_caps->slice_caps.raw) return false; dsc_common_caps->lb_bit_depth = min(dsc_sink_caps->lb_bit_depth, dsc_enc_caps->lb_bit_depth); if (!dsc_common_caps->lb_bit_depth) return false; dsc_common_caps->is_block_pred_supported = dsc_sink_caps->is_block_pred_supported && dsc_enc_caps->is_block_pred_supported; dsc_common_caps->color_formats.raw = dsc_sink_caps->color_formats.raw & dsc_enc_caps->color_formats.raw; if (!dsc_common_caps->color_formats.raw) return false; dsc_common_caps->color_depth.raw = dsc_sink_caps->color_depth.raw & dsc_enc_caps->color_depth.raw; if (!dsc_common_caps->color_depth.raw) return false; max_slices = 0; if (dsc_common_caps->slice_caps.bits.NUM_SLICES_1) max_slices = 1; if (dsc_common_caps->slice_caps.bits.NUM_SLICES_2) max_slices = 2; if (dsc_common_caps->slice_caps.bits.NUM_SLICES_4) max_slices = 4; total_sink_throughput = max_slices * dsc_sink_caps->throughput_mode_0_mps; if (pixel_encoding == PIXEL_ENCODING_YCBCR422 || pixel_encoding == PIXEL_ENCODING_YCBCR420) total_sink_throughput = max_slices * dsc_sink_caps->throughput_mode_1_mps; dsc_common_caps->max_total_throughput_mps = min(total_sink_throughput, dsc_enc_caps->max_total_throughput_mps); dsc_common_caps->max_slice_width = min(dsc_sink_caps->max_slice_width, dsc_enc_caps->max_slice_width); if (!dsc_common_caps->max_slice_width) return false; dsc_common_caps->bpp_increment_div = min(dsc_sink_caps->bpp_increment_div, dsc_enc_caps->bpp_increment_div); // TODO DSC: Remove this workaround for N422 and 420 once it's fixed, or move it to get_dsc_encoder_caps() if (pixel_encoding == PIXEL_ENCODING_YCBCR422 || pixel_encoding == PIXEL_ENCODING_YCBCR420) dsc_common_caps->bpp_increment_div = min(dsc_common_caps->bpp_increment_div, (uint32_t)8); dsc_common_caps->is_dp = dsc_sink_caps->is_dp; return true; } static inline uint32_t dsc_div_by_10_round_up(uint32_t value) { return (value + 9) / 10; } static struct fixed31_32 compute_dsc_max_bandwidth_overhead( const struct dc_crtc_timing *timing, const int num_slices_h, const bool is_dp) { struct fixed31_32 max_dsc_overhead; struct fixed31_32 refresh_rate; if (dsc_policy_disable_dsc_stream_overhead || !is_dp) return dc_fixpt_from_int(0); /* use target bpp that can take entire target bandwidth */ refresh_rate = dc_fixpt_from_int(timing->pix_clk_100hz); refresh_rate = dc_fixpt_div_int(refresh_rate, timing->h_total); refresh_rate = dc_fixpt_div_int(refresh_rate, timing->v_total); refresh_rate = dc_fixpt_mul_int(refresh_rate, 100); max_dsc_overhead = dc_fixpt_from_int(num_slices_h); max_dsc_overhead = dc_fixpt_mul_int(max_dsc_overhead, timing->v_total); max_dsc_overhead = dc_fixpt_mul_int(max_dsc_overhead, 256); max_dsc_overhead = dc_fixpt_div_int(max_dsc_overhead, 1000); max_dsc_overhead = dc_fixpt_mul(max_dsc_overhead, refresh_rate); return max_dsc_overhead; } static uint32_t compute_bpp_x16_from_target_bandwidth( const uint32_t bandwidth_in_kbps, const struct dc_crtc_timing *timing, const uint32_t num_slices_h, const uint32_t bpp_increment_div, const bool is_dp) { struct fixed31_32 overhead_in_kbps; struct fixed31_32 effective_bandwidth_in_kbps; struct fixed31_32 bpp_x16; overhead_in_kbps = compute_dsc_max_bandwidth_overhead( timing, num_slices_h, is_dp); effective_bandwidth_in_kbps = dc_fixpt_from_int(bandwidth_in_kbps); effective_bandwidth_in_kbps = dc_fixpt_sub(effective_bandwidth_in_kbps, overhead_in_kbps); bpp_x16 = dc_fixpt_mul_int(effective_bandwidth_in_kbps, 10); bpp_x16 = dc_fixpt_div_int(bpp_x16, timing->pix_clk_100hz); bpp_x16 = dc_fixpt_from_int(dc_fixpt_floor(dc_fixpt_mul_int(bpp_x16, bpp_increment_div))); bpp_x16 = dc_fixpt_div_int(bpp_x16, bpp_increment_div); bpp_x16 = dc_fixpt_mul_int(bpp_x16, 16); return dc_fixpt_floor(bpp_x16); } /* Get DSC bandwidth range based on [min_bpp, max_bpp] target bitrate range, and timing's pixel clock * and uncompressed bandwidth. */ static void get_dsc_bandwidth_range( const uint32_t min_bpp_x16, const uint32_t max_bpp_x16, const uint32_t num_slices_h, const struct dsc_enc_caps *dsc_caps, const struct dc_crtc_timing *timing, struct dc_dsc_bw_range *range) { /* native stream bandwidth */ range->stream_kbps = dc_bandwidth_in_kbps_from_timing(timing); /* max dsc target bpp */ range->max_kbps = dc_dsc_stream_bandwidth_in_kbps(timing, max_bpp_x16, num_slices_h, dsc_caps->is_dp); range->max_target_bpp_x16 = max_bpp_x16; if (range->max_kbps > range->stream_kbps) { /* max dsc target bpp is capped to native bandwidth */ range->max_kbps = range->stream_kbps; range->max_target_bpp_x16 = compute_bpp_x16_from_target_bandwidth( range->max_kbps, timing, num_slices_h, dsc_caps->bpp_increment_div, dsc_caps->is_dp); } /* min dsc target bpp */ range->min_kbps = dc_dsc_stream_bandwidth_in_kbps(timing, min_bpp_x16, num_slices_h, dsc_caps->is_dp); range->min_target_bpp_x16 = min_bpp_x16; if (range->min_kbps > range->max_kbps) { /* min dsc target bpp is capped to max dsc bandwidth*/ range->min_kbps = range->max_kbps; range->min_target_bpp_x16 = range->max_target_bpp_x16; } } /* Decides if DSC should be used and calculates target bpp if it should, applying DSC policy. * * Returns: * - 'true' if DSC was required by policy and was successfully applied * - 'false' if DSC was not necessary (e.g. if uncompressed stream fits 'target_bandwidth_kbps'), * or if it couldn't be applied based on DSC policy. */ static bool decide_dsc_target_bpp_x16( const struct dc_dsc_policy *policy, const struct dsc_enc_caps *dsc_common_caps, const int target_bandwidth_kbps, const struct dc_crtc_timing *timing, const int num_slices_h, int *target_bpp_x16) { bool should_use_dsc = false; struct dc_dsc_bw_range range; memset(&range, 0, sizeof(range)); get_dsc_bandwidth_range(policy->min_target_bpp * 16, policy->max_target_bpp * 16, num_slices_h, dsc_common_caps, timing, &range); if (!policy->enable_dsc_when_not_needed && target_bandwidth_kbps >= range.stream_kbps) { /* enough bandwidth without dsc */ *target_bpp_x16 = 0; should_use_dsc = false; } else if (policy->preferred_bpp_x16 > 0 && policy->preferred_bpp_x16 <= range.max_target_bpp_x16 && policy->preferred_bpp_x16 >= range.min_target_bpp_x16) { *target_bpp_x16 = policy->preferred_bpp_x16; should_use_dsc = true; } else if (target_bandwidth_kbps >= range.max_kbps) { /* use max target bpp allowed */ *target_bpp_x16 = range.max_target_bpp_x16; should_use_dsc = true; } else if (target_bandwidth_kbps >= range.min_kbps) { /* use target bpp that can take entire target bandwidth */ *target_bpp_x16 = compute_bpp_x16_from_target_bandwidth( target_bandwidth_kbps, timing, num_slices_h, dsc_common_caps->bpp_increment_div, dsc_common_caps->is_dp); should_use_dsc = true; } else { /* not enough bandwidth to fulfill minimum requirement */ *target_bpp_x16 = 0; should_use_dsc = false; } return should_use_dsc; } #define MIN_AVAILABLE_SLICES_SIZE 4 static int get_available_dsc_slices(union dsc_enc_slice_caps slice_caps, int *available_slices) { int idx = 0; memset(available_slices, -1, MIN_AVAILABLE_SLICES_SIZE); if (slice_caps.bits.NUM_SLICES_1) available_slices[idx++] = 1; if (slice_caps.bits.NUM_SLICES_2) available_slices[idx++] = 2; if (slice_caps.bits.NUM_SLICES_4) available_slices[idx++] = 4; if (slice_caps.bits.NUM_SLICES_8) available_slices[idx++] = 8; return idx; } static int get_max_dsc_slices(union dsc_enc_slice_caps slice_caps) { int max_slices = 0; int available_slices[MIN_AVAILABLE_SLICES_SIZE]; int end_idx = get_available_dsc_slices(slice_caps, &available_slices[0]); if (end_idx > 0) max_slices = available_slices[end_idx - 1]; return max_slices; } // Increment sice number in available sice numbers stops if possible, or just increment if not static int inc_num_slices(union dsc_enc_slice_caps slice_caps, int num_slices) { // Get next bigger num slices available in common caps int available_slices[MIN_AVAILABLE_SLICES_SIZE]; int end_idx; int i; int new_num_slices = num_slices; end_idx = get_available_dsc_slices(slice_caps, &available_slices[0]); if (end_idx == 0) { // No available slices found new_num_slices++; return new_num_slices; } // Numbers of slices found - get the next bigger number for (i = 0; i < end_idx; i++) { if (new_num_slices < available_slices[i]) { new_num_slices = available_slices[i]; break; } } if (new_num_slices == num_slices) // No biger number of slices found new_num_slices++; return new_num_slices; } // Decrement sice number in available sice numbers stops if possible, or just decrement if not. Stop at zero. static int dec_num_slices(union dsc_enc_slice_caps slice_caps, int num_slices) { // Get next bigger num slices available in common caps int available_slices[MIN_AVAILABLE_SLICES_SIZE]; int end_idx; int i; int new_num_slices = num_slices; end_idx = get_available_dsc_slices(slice_caps, &available_slices[0]); if (end_idx == 0 && new_num_slices > 0) { // No numbers of slices found new_num_slices++; return new_num_slices; } // Numbers of slices found - get the next smaller number for (i = end_idx - 1; i >= 0; i--) { if (new_num_slices > available_slices[i]) { new_num_slices = available_slices[i]; break; } } if (new_num_slices == num_slices) { // No smaller number of slices found new_num_slices--; if (new_num_slices < 0) new_num_slices = 0; } return new_num_slices; } // Choose next bigger number of slices if the requested number of slices is not available static int fit_num_slices_up(union dsc_enc_slice_caps slice_caps, int num_slices) { // Get next bigger num slices available in common caps int available_slices[MIN_AVAILABLE_SLICES_SIZE]; int end_idx; int i; int new_num_slices = num_slices; end_idx = get_available_dsc_slices(slice_caps, &available_slices[0]); if (end_idx == 0) { // No available slices found new_num_slices++; return new_num_slices; } // Numbers of slices found - get the equal or next bigger number for (i = 0; i < end_idx; i++) { if (new_num_slices <= available_slices[i]) { new_num_slices = available_slices[i]; break; } } return new_num_slices; } /* Attempts to set DSC configuration for the stream, applying DSC policy. * Returns 'true' if successful or 'false' if not. * * Parameters: * * dsc_sink_caps - DSC sink decoder capabilities (from DPCD) * * dsc_enc_caps - DSC encoder capabilities * * target_bandwidth_kbps - Target bandwidth to fit the stream into. * If 0, do not calculate target bpp. * * timing - The stream timing to fit into 'target_bandwidth_kbps' or apply * maximum compression to, if 'target_badwidth == 0' * * dsc_cfg - DSC configuration to use if it was possible to come up with * one for the given inputs. * The target bitrate after DSC can be calculated by multiplying * dsc_cfg.bits_per_pixel (in U6.4 format) by pixel rate, e.g. * * dsc_stream_bitrate_kbps = (int)ceil(timing->pix_clk_khz * dsc_cfg.bits_per_pixel / 16.0); */ static bool setup_dsc_config( const struct dsc_dec_dpcd_caps *dsc_sink_caps, const struct dsc_enc_caps *dsc_enc_caps, int target_bandwidth_kbps, const struct dc_crtc_timing *timing, int min_slice_height_override, int max_dsc_target_bpp_limit_override_x16, struct dc_dsc_config *dsc_cfg) { struct dsc_enc_caps dsc_common_caps; int max_slices_h; int min_slices_h; int num_slices_h; int pic_width; int slice_width; int target_bpp; int sink_per_slice_throughput_mps; int branch_max_throughput_mps = 0; bool is_dsc_possible = false; int pic_height; int slice_height; struct dc_dsc_policy policy; memset(dsc_cfg, 0, sizeof(struct dc_dsc_config)); dc_dsc_get_policy_for_timing(timing, max_dsc_target_bpp_limit_override_x16, &policy); pic_width = timing->h_addressable + timing->h_border_left + timing->h_border_right; pic_height = timing->v_addressable + timing->v_border_top + timing->v_border_bottom; if (!dsc_sink_caps->is_dsc_supported) goto done; if (dsc_sink_caps->branch_max_line_width && dsc_sink_caps->branch_max_line_width < pic_width) goto done; // Intersect decoder with encoder DSC caps and validate DSC settings is_dsc_possible = intersect_dsc_caps(dsc_sink_caps, dsc_enc_caps, timing->pixel_encoding, &dsc_common_caps); if (!is_dsc_possible) goto done; sink_per_slice_throughput_mps = 0; // Validate available DSC settings against the mode timing // Validate color format (and pick up the throughput values) dsc_cfg->ycbcr422_simple = false; switch (timing->pixel_encoding) { case PIXEL_ENCODING_RGB: is_dsc_possible = (bool)dsc_common_caps.color_formats.bits.RGB; sink_per_slice_throughput_mps = dsc_sink_caps->throughput_mode_0_mps; branch_max_throughput_mps = dsc_sink_caps->branch_overall_throughput_0_mps; break; case PIXEL_ENCODING_YCBCR444: is_dsc_possible = (bool)dsc_common_caps.color_formats.bits.YCBCR_444; sink_per_slice_throughput_mps = dsc_sink_caps->throughput_mode_0_mps; branch_max_throughput_mps = dsc_sink_caps->branch_overall_throughput_0_mps; break; case PIXEL_ENCODING_YCBCR422: is_dsc_possible = (bool)dsc_common_caps.color_formats.bits.YCBCR_NATIVE_422; sink_per_slice_throughput_mps = dsc_sink_caps->throughput_mode_1_mps; branch_max_throughput_mps = dsc_sink_caps->branch_overall_throughput_1_mps; if (!is_dsc_possible) { is_dsc_possible = (bool)dsc_common_caps.color_formats.bits.YCBCR_SIMPLE_422; dsc_cfg->ycbcr422_simple = is_dsc_possible; sink_per_slice_throughput_mps = dsc_sink_caps->throughput_mode_0_mps; } break; case PIXEL_ENCODING_YCBCR420: is_dsc_possible = (bool)dsc_common_caps.color_formats.bits.YCBCR_NATIVE_420; sink_per_slice_throughput_mps = dsc_sink_caps->throughput_mode_1_mps; branch_max_throughput_mps = dsc_sink_caps->branch_overall_throughput_1_mps; break; default: is_dsc_possible = false; } // Validate branch's maximum throughput if (branch_max_throughput_mps && dsc_div_by_10_round_up(timing->pix_clk_100hz) > branch_max_throughput_mps * 1000) is_dsc_possible = false; if (!is_dsc_possible) goto done; // Color depth switch (timing->display_color_depth) { case COLOR_DEPTH_888: is_dsc_possible = (bool)dsc_common_caps.color_depth.bits.COLOR_DEPTH_8_BPC; break; case COLOR_DEPTH_101010: is_dsc_possible = (bool)dsc_common_caps.color_depth.bits.COLOR_DEPTH_10_BPC; break; case COLOR_DEPTH_121212: is_dsc_possible = (bool)dsc_common_caps.color_depth.bits.COLOR_DEPTH_12_BPC; break; default: is_dsc_possible = false; } if (!is_dsc_possible) goto done; // Slice width (i.e. number of slices per line) max_slices_h = get_max_dsc_slices(dsc_common_caps.slice_caps); while (max_slices_h > 0) { if (pic_width % max_slices_h == 0) break; max_slices_h = dec_num_slices(dsc_common_caps.slice_caps, max_slices_h); } is_dsc_possible = (dsc_common_caps.max_slice_width > 0); if (!is_dsc_possible) goto done; min_slices_h = pic_width / dsc_common_caps.max_slice_width; if (pic_width % dsc_common_caps.max_slice_width) min_slices_h++; min_slices_h = fit_num_slices_up(dsc_common_caps.slice_caps, min_slices_h); while (min_slices_h <= max_slices_h) { int pix_clk_per_slice_khz = dsc_div_by_10_round_up(timing->pix_clk_100hz) / min_slices_h; if (pix_clk_per_slice_khz <= sink_per_slice_throughput_mps * 1000) break; min_slices_h = inc_num_slices(dsc_common_caps.slice_caps, min_slices_h); } if (pic_width % min_slices_h != 0) min_slices_h = 0; // DSC TODO: Maybe try increasing the number of slices first? is_dsc_possible = (min_slices_h <= max_slices_h); if (!is_dsc_possible) goto done; if (policy.use_min_slices_h) { if (min_slices_h > 0) num_slices_h = min_slices_h; else if (max_slices_h > 0) { // Fall back to max slices if min slices is not working out if (policy.max_slices_h) num_slices_h = min(policy.max_slices_h, max_slices_h); else num_slices_h = max_slices_h; } else is_dsc_possible = false; } else { if (max_slices_h > 0) { if (policy.max_slices_h) num_slices_h = min(policy.max_slices_h, max_slices_h); else num_slices_h = max_slices_h; } else if (min_slices_h > 0) // Fall back to min slices if max slices is not possible num_slices_h = min_slices_h; else is_dsc_possible = false; } if (!is_dsc_possible) goto done; dsc_cfg->num_slices_h = num_slices_h; slice_width = pic_width / num_slices_h; is_dsc_possible = slice_width <= dsc_common_caps.max_slice_width; if (!is_dsc_possible) goto done; // Slice height (i.e. number of slices per column): start with policy and pick the first one that height is divisible by. // For 4:2:0 make sure the slice height is divisible by 2 as well. if (min_slice_height_override == 0) slice_height = min(policy.min_slice_height, pic_height); else slice_height = min(min_slice_height_override, pic_height); while (slice_height < pic_height && (pic_height % slice_height != 0 || (timing->pixel_encoding == PIXEL_ENCODING_YCBCR420 && slice_height % 2 != 0))) slice_height++; if (timing->pixel_encoding == PIXEL_ENCODING_YCBCR420) // For the case when pic_height < dsc_policy.min_sice_height is_dsc_possible = (slice_height % 2 == 0); if (!is_dsc_possible) goto done; dsc_cfg->num_slices_v = pic_height/slice_height; if (target_bandwidth_kbps > 0) { is_dsc_possible = decide_dsc_target_bpp_x16( &policy, &dsc_common_caps, target_bandwidth_kbps, timing, num_slices_h, &target_bpp); dsc_cfg->bits_per_pixel = target_bpp; } if (!is_dsc_possible) goto done; // Final decission: can we do DSC or not? if (is_dsc_possible) { // Fill out the rest of DSC settings dsc_cfg->block_pred_enable = dsc_common_caps.is_block_pred_supported; dsc_cfg->linebuf_depth = dsc_common_caps.lb_bit_depth; dsc_cfg->version_minor = (dsc_common_caps.dsc_version & 0xf0) >> 4; dsc_cfg->is_dp = dsc_sink_caps->is_dp; } done: if (!is_dsc_possible) memset(dsc_cfg, 0, sizeof(struct dc_dsc_config)); return is_dsc_possible; } bool dc_dsc_parse_dsc_dpcd(const struct dc *dc, const uint8_t *dpcd_dsc_basic_data, const uint8_t *dpcd_dsc_branch_decoder_caps, struct dsc_dec_dpcd_caps *dsc_sink_caps) { if (!dpcd_dsc_basic_data) return false; dsc_sink_caps->is_dsc_supported = (dpcd_dsc_basic_data[DP_DSC_SUPPORT - DP_DSC_SUPPORT] & DP_DSC_DECOMPRESSION_IS_SUPPORTED) != 0; if (!dsc_sink_caps->is_dsc_supported) return false; dsc_sink_caps->dsc_version = dpcd_dsc_basic_data[DP_DSC_REV - DP_DSC_SUPPORT]; { int buff_block_size; int buff_size; if (!dsc_buff_block_size_from_dpcd(dpcd_dsc_basic_data[DP_DSC_RC_BUF_BLK_SIZE - DP_DSC_SUPPORT], &buff_block_size)) return false; buff_size = dpcd_dsc_basic_data[DP_DSC_RC_BUF_SIZE - DP_DSC_SUPPORT] + 1; dsc_sink_caps->rc_buffer_size = buff_size * buff_block_size; } dsc_sink_caps->slice_caps1.raw = dpcd_dsc_basic_data[DP_DSC_SLICE_CAP_1 - DP_DSC_SUPPORT]; if (!dsc_line_buff_depth_from_dpcd(dpcd_dsc_basic_data[DP_DSC_LINE_BUF_BIT_DEPTH - DP_DSC_SUPPORT], &dsc_sink_caps->lb_bit_depth)) return false; dsc_sink_caps->is_block_pred_supported = (dpcd_dsc_basic_data[DP_DSC_BLK_PREDICTION_SUPPORT - DP_DSC_SUPPORT] & DP_DSC_BLK_PREDICTION_IS_SUPPORTED) != 0; dsc_sink_caps->edp_max_bits_per_pixel = dpcd_dsc_basic_data[DP_DSC_MAX_BITS_PER_PIXEL_LOW - DP_DSC_SUPPORT] | dpcd_dsc_basic_data[DP_DSC_MAX_BITS_PER_PIXEL_HI - DP_DSC_SUPPORT] << 8; dsc_sink_caps->color_formats.raw = dpcd_dsc_basic_data[DP_DSC_DEC_COLOR_FORMAT_CAP - DP_DSC_SUPPORT]; dsc_sink_caps->color_depth.raw = dpcd_dsc_basic_data[DP_DSC_DEC_COLOR_DEPTH_CAP - DP_DSC_SUPPORT]; { int dpcd_throughput = dpcd_dsc_basic_data[DP_DSC_PEAK_THROUGHPUT - DP_DSC_SUPPORT]; if (!dsc_throughput_from_dpcd(dpcd_throughput & DP_DSC_THROUGHPUT_MODE_0_MASK, &dsc_sink_caps->throughput_mode_0_mps)) return false; dpcd_throughput = (dpcd_throughput & DP_DSC_THROUGHPUT_MODE_1_MASK) >> DP_DSC_THROUGHPUT_MODE_1_SHIFT; if (!dsc_throughput_from_dpcd(dpcd_throughput, &dsc_sink_caps->throughput_mode_1_mps)) return false; } dsc_sink_caps->max_slice_width = dpcd_dsc_basic_data[DP_DSC_MAX_SLICE_WIDTH - DP_DSC_SUPPORT] * 320; dsc_sink_caps->slice_caps2.raw = dpcd_dsc_basic_data[DP_DSC_SLICE_CAP_2 - DP_DSC_SUPPORT]; if (!dsc_bpp_increment_div_from_dpcd(dpcd_dsc_basic_data[DP_DSC_BITS_PER_PIXEL_INC - DP_DSC_SUPPORT], &dsc_sink_caps->bpp_increment_div)) return false; if (dc->debug.dsc_bpp_increment_div) { /* dsc_bpp_increment_div should onl be 1, 2, 4, 8 or 16, but rather than rejecting invalid values, * we'll accept all and get it into range. This also makes the above check against 0 redundant, * but that one stresses out the override will be only used if it's not 0. */ if (dc->debug.dsc_bpp_increment_div >= 1) dsc_sink_caps->bpp_increment_div = 1; if (dc->debug.dsc_bpp_increment_div >= 2) dsc_sink_caps->bpp_increment_div = 2; if (dc->debug.dsc_bpp_increment_div >= 4) dsc_sink_caps->bpp_increment_div = 4; if (dc->debug.dsc_bpp_increment_div >= 8) dsc_sink_caps->bpp_increment_div = 8; if (dc->debug.dsc_bpp_increment_div >= 16) dsc_sink_caps->bpp_increment_div = 16; } /* Extended caps */ if (dpcd_dsc_branch_decoder_caps == NULL) { // branch decoder DPCD DSC data can be null for non branch device dsc_sink_caps->branch_overall_throughput_0_mps = 0; dsc_sink_caps->branch_overall_throughput_1_mps = 0; dsc_sink_caps->branch_max_line_width = 0; return true; } dsc_sink_caps->branch_overall_throughput_0_mps = dpcd_dsc_branch_decoder_caps[DP_DSC_BRANCH_OVERALL_THROUGHPUT_0 - DP_DSC_BRANCH_OVERALL_THROUGHPUT_0]; if (dsc_sink_caps->branch_overall_throughput_0_mps == 0) dsc_sink_caps->branch_overall_throughput_0_mps = 0; else if (dsc_sink_caps->branch_overall_throughput_0_mps == 1) dsc_sink_caps->branch_overall_throughput_0_mps = 680; else { dsc_sink_caps->branch_overall_throughput_0_mps *= 50; dsc_sink_caps->branch_overall_throughput_0_mps += 600; } dsc_sink_caps->branch_overall_throughput_1_mps = dpcd_dsc_branch_decoder_caps[DP_DSC_BRANCH_OVERALL_THROUGHPUT_1 - DP_DSC_BRANCH_OVERALL_THROUGHPUT_0]; if (dsc_sink_caps->branch_overall_throughput_1_mps == 0) dsc_sink_caps->branch_overall_throughput_1_mps = 0; else if (dsc_sink_caps->branch_overall_throughput_1_mps == 1) dsc_sink_caps->branch_overall_throughput_1_mps = 680; else { dsc_sink_caps->branch_overall_throughput_1_mps *= 50; dsc_sink_caps->branch_overall_throughput_1_mps += 600; } dsc_sink_caps->branch_max_line_width = dpcd_dsc_branch_decoder_caps[DP_DSC_BRANCH_MAX_LINE_WIDTH - DP_DSC_BRANCH_OVERALL_THROUGHPUT_0] * 320; ASSERT(dsc_sink_caps->branch_max_line_width == 0 || dsc_sink_caps->branch_max_line_width >= 5120); dsc_sink_caps->is_dp = true; return true; } /* If DSC is possbile, get DSC bandwidth range based on [min_bpp, max_bpp] target bitrate range and * timing's pixel clock and uncompressed bandwidth. * If DSC is not possible, leave '*range' untouched. */ bool dc_dsc_compute_bandwidth_range( const struct display_stream_compressor *dsc, uint32_t dsc_min_slice_height_override, uint32_t min_bpp_x16, uint32_t max_bpp_x16, const struct dsc_dec_dpcd_caps *dsc_sink_caps, const struct dc_crtc_timing *timing, struct dc_dsc_bw_range *range) { bool is_dsc_possible = false; struct dsc_enc_caps dsc_enc_caps; struct dsc_enc_caps dsc_common_caps; struct dc_dsc_config config; get_dsc_enc_caps(dsc, &dsc_enc_caps, timing->pix_clk_100hz); is_dsc_possible = intersect_dsc_caps(dsc_sink_caps, &dsc_enc_caps, timing->pixel_encoding, &dsc_common_caps); if (is_dsc_possible) is_dsc_possible = setup_dsc_config(dsc_sink_caps, &dsc_enc_caps, 0, timing, dsc_min_slice_height_override, max_bpp_x16, &config); if (is_dsc_possible) get_dsc_bandwidth_range(min_bpp_x16, max_bpp_x16, config.num_slices_h, &dsc_common_caps, timing, range); return is_dsc_possible; } bool dc_dsc_compute_config( const struct display_stream_compressor *dsc, const struct dsc_dec_dpcd_caps *dsc_sink_caps, uint32_t dsc_min_slice_height_override, uint32_t max_target_bpp_limit_override, uint32_t target_bandwidth_kbps, const struct dc_crtc_timing *timing, struct dc_dsc_config *dsc_cfg) { bool is_dsc_possible = false; struct dsc_enc_caps dsc_enc_caps; get_dsc_enc_caps(dsc, &dsc_enc_caps, timing->pix_clk_100hz); is_dsc_possible = setup_dsc_config(dsc_sink_caps, &dsc_enc_caps, target_bandwidth_kbps, timing, dsc_min_slice_height_override, max_target_bpp_limit_override * 16, dsc_cfg); return is_dsc_possible; } uint32_t dc_dsc_stream_bandwidth_in_kbps(const struct dc_crtc_timing *timing, uint32_t bpp_x16, uint32_t num_slices_h, bool is_dp) { struct fixed31_32 overhead_in_kbps; struct fixed31_32 bpp; struct fixed31_32 actual_bandwidth_in_kbps; overhead_in_kbps = compute_dsc_max_bandwidth_overhead( timing, num_slices_h, is_dp); bpp = dc_fixpt_from_fraction(bpp_x16, 16); actual_bandwidth_in_kbps = dc_fixpt_from_fraction(timing->pix_clk_100hz, 10); actual_bandwidth_in_kbps = dc_fixpt_mul(actual_bandwidth_in_kbps, bpp); actual_bandwidth_in_kbps = dc_fixpt_add(actual_bandwidth_in_kbps, overhead_in_kbps); return dc_fixpt_ceil(actual_bandwidth_in_kbps); } void dc_dsc_get_policy_for_timing(const struct dc_crtc_timing *timing, uint32_t max_target_bpp_limit_override_x16, struct dc_dsc_policy *policy) { uint32_t bpc = 0; policy->min_target_bpp = 0; policy->max_target_bpp = 0; /* DSC Policy: Use minimum number of slices that fits the pixel clock */ policy->use_min_slices_h = true; /* DSC Policy: Use max available slices * (in our case 4 for or 8, depending on the mode) */ policy->max_slices_h = 0; /* DSC Policy: Use slice height recommended * by VESA DSC Spreadsheet user guide */ policy->min_slice_height = 108; /* DSC Policy: follow DP specs with an internal upper limit to 16 bpp * for better interoperability */ switch (timing->display_color_depth) { case COLOR_DEPTH_888: bpc = 8; break; case COLOR_DEPTH_101010: bpc = 10; break; case COLOR_DEPTH_121212: bpc = 12; break; default: return; } switch (timing->pixel_encoding) { case PIXEL_ENCODING_RGB: case PIXEL_ENCODING_YCBCR444: case PIXEL_ENCODING_YCBCR422: /* assume no YCbCr422 native support */ /* DP specs limits to 8 */ policy->min_target_bpp = 8; /* DP specs limits to 3 x bpc */ policy->max_target_bpp = 3 * bpc; break; case PIXEL_ENCODING_YCBCR420: /* DP specs limits to 6 */ policy->min_target_bpp = 6; /* DP specs limits to 1.5 x bpc assume bpc is an even number */ policy->max_target_bpp = bpc * 3 / 2; break; default: return; } policy->preferred_bpp_x16 = timing->dsc_fixed_bits_per_pixel_x16; /* internal upper limit, default 16 bpp */ if (policy->max_target_bpp > dsc_policy_max_target_bpp_limit) policy->max_target_bpp = dsc_policy_max_target_bpp_limit; /* apply override */ if (max_target_bpp_limit_override_x16 && policy->max_target_bpp > max_target_bpp_limit_override_x16 / 16) policy->max_target_bpp = max_target_bpp_limit_override_x16 / 16; /* enable DSC when not needed, default false */ if (dsc_policy_enable_dsc_when_not_needed) policy->enable_dsc_when_not_needed = dsc_policy_enable_dsc_when_not_needed; else policy->enable_dsc_when_not_needed = false; } void dc_dsc_policy_set_max_target_bpp_limit(uint32_t limit) { dsc_policy_max_target_bpp_limit = limit; } void dc_dsc_policy_set_enable_dsc_when_not_needed(bool enable) { dsc_policy_enable_dsc_when_not_needed = enable; } void dc_dsc_policy_set_disable_dsc_stream_overhead(bool disable) { dsc_policy_disable_dsc_stream_overhead = disable; } #endif /* CONFIG_DRM_AMD_DC_DSC_SUPPORT */
the_stack_data/115435.c
/* * Generated by util/mkerr.pl DO NOT EDIT * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #include <openssl/bioerr.h> #include <openssl/err.h> #ifndef OPENSSL_NO_ERR static const ERR_STRING_DATA BIO_str_functs[] = { {ERR_PACK(ERR_LIB_BIO, BIO_F_ACPT_STATE, 0), "acpt_state"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_ADDRINFO_WRAP, 0), "addrinfo_wrap"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_ADDR_STRINGS, 0), "addr_strings"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_ACCEPT, 0), "BIO_accept"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_ACCEPT_EX, 0), "BIO_accept_ex"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_ACCEPT_NEW, 0), "BIO_ACCEPT_new"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_ADDR_NEW, 0), "BIO_ADDR_new"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_BIND, 0), "BIO_bind"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_CALLBACK_CTRL, 0), "BIO_callback_ctrl"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_CONNECT, 0), "BIO_connect"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_CONNECT_NEW, 0), "BIO_CONNECT_new"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_CTRL, 0), "BIO_ctrl"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_GETS, 0), "BIO_gets"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_GET_HOST_IP, 0), "BIO_get_host_ip"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_GET_NEW_INDEX, 0), "BIO_get_new_index"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_GET_PORT, 0), "BIO_get_port"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_LISTEN, 0), "BIO_listen"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_LOOKUP, 0), "BIO_lookup"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_LOOKUP_EX, 0), "BIO_lookup_ex"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_MAKE_PAIR, 0), "bio_make_pair"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_METH_NEW, 0), "BIO_meth_new"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_NEW, 0), "BIO_new"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_NEW_DGRAM_SCTP, 0), "BIO_new_dgram_sctp"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_NEW_FILE, 0), "BIO_new_file"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_NEW_MEM_BUF, 0), "BIO_new_mem_buf"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_NREAD, 0), "BIO_nread"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_NREAD0, 0), "BIO_nread0"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_NWRITE, 0), "BIO_nwrite"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_NWRITE0, 0), "BIO_nwrite0"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_PARSE_HOSTSERV, 0), "BIO_parse_hostserv"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_PUTS, 0), "BIO_puts"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_READ, 0), "BIO_read"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_READ_EX, 0), "BIO_read_ex"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_READ_INTERN, 0), "bio_read_intern"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_SOCKET, 0), "BIO_socket"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_SOCKET_NBIO, 0), "BIO_socket_nbio"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_SOCK_INFO, 0), "BIO_sock_info"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_SOCK_INIT, 0), "BIO_sock_init"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_WRITE, 0), "BIO_write"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_WRITE_EX, 0), "BIO_write_ex"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_WRITE_INTERN, 0), "bio_write_intern"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BUFFER_CTRL, 0), "buffer_ctrl"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_CONN_CTRL, 0), "conn_ctrl"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_CONN_STATE, 0), "conn_state"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_DGRAM_SCTP_NEW, 0), "dgram_sctp_new"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_DGRAM_SCTP_READ, 0), "dgram_sctp_read"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_DGRAM_SCTP_WRITE, 0), "dgram_sctp_write"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_DOAPR_OUTCH, 0), "doapr_outch"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_FILE_CTRL, 0), "file_ctrl"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_FILE_READ, 0), "file_read"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_LINEBUFFER_CTRL, 0), "linebuffer_ctrl"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_LINEBUFFER_NEW, 0), "linebuffer_new"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_MEM_WRITE, 0), "mem_write"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_NBIOF_NEW, 0), "nbiof_new"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_SLG_WRITE, 0), "slg_write"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_SSL_NEW, 0), "SSL_new"}, {0, NULL}}; static const ERR_STRING_DATA BIO_str_reasons[] = { {ERR_PACK(ERR_LIB_BIO, 0, BIO_R_ACCEPT_ERROR), "accept error"}, {ERR_PACK(ERR_LIB_BIO, 0, BIO_R_ADDRINFO_ADDR_IS_NOT_AF_INET), "addrinfo addr is not af inet"}, {ERR_PACK(ERR_LIB_BIO, 0, BIO_R_AMBIGUOUS_HOST_OR_SERVICE), "ambiguous host or service"}, {ERR_PACK(ERR_LIB_BIO, 0, BIO_R_BAD_FOPEN_MODE), "bad fopen mode"}, {ERR_PACK(ERR_LIB_BIO, 0, BIO_R_BROKEN_PIPE), "broken pipe"}, {ERR_PACK(ERR_LIB_BIO, 0, BIO_R_CONNECT_ERROR), "connect error"}, {ERR_PACK(ERR_LIB_BIO, 0, BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET), "gethostbyname addr is not af inet"}, {ERR_PACK(ERR_LIB_BIO, 0, BIO_R_GETSOCKNAME_ERROR), "getsockname error"}, {ERR_PACK(ERR_LIB_BIO, 0, BIO_R_GETSOCKNAME_TRUNCATED_ADDRESS), "getsockname truncated address"}, {ERR_PACK(ERR_LIB_BIO, 0, BIO_R_GETTING_SOCKTYPE), "getting socktype"}, {ERR_PACK(ERR_LIB_BIO, 0, BIO_R_INVALID_ARGUMENT), "invalid argument"}, {ERR_PACK(ERR_LIB_BIO, 0, BIO_R_INVALID_SOCKET), "invalid socket"}, {ERR_PACK(ERR_LIB_BIO, 0, BIO_R_IN_USE), "in use"}, {ERR_PACK(ERR_LIB_BIO, 0, BIO_R_LENGTH_TOO_LONG), "length too long"}, {ERR_PACK(ERR_LIB_BIO, 0, BIO_R_LISTEN_V6_ONLY), "listen v6 only"}, {ERR_PACK(ERR_LIB_BIO, 0, BIO_R_LOOKUP_RETURNED_NOTHING), "lookup returned nothing"}, {ERR_PACK(ERR_LIB_BIO, 0, BIO_R_MALFORMED_HOST_OR_SERVICE), "malformed host or service"}, {ERR_PACK(ERR_LIB_BIO, 0, BIO_R_NBIO_CONNECT_ERROR), "nbio connect error"}, {ERR_PACK(ERR_LIB_BIO, 0, BIO_R_NO_ACCEPT_ADDR_OR_SERVICE_SPECIFIED), "no accept addr or service specified"}, {ERR_PACK(ERR_LIB_BIO, 0, BIO_R_NO_HOSTNAME_OR_SERVICE_SPECIFIED), "no hostname or service specified"}, {ERR_PACK(ERR_LIB_BIO, 0, BIO_R_NO_PORT_DEFINED), "no port defined"}, {ERR_PACK(ERR_LIB_BIO, 0, BIO_R_NO_SUCH_FILE), "no such file"}, {ERR_PACK(ERR_LIB_BIO, 0, BIO_R_NULL_PARAMETER), "null parameter"}, {ERR_PACK(ERR_LIB_BIO, 0, BIO_R_UNABLE_TO_BIND_SOCKET), "unable to bind socket"}, {ERR_PACK(ERR_LIB_BIO, 0, BIO_R_UNABLE_TO_CREATE_SOCKET), "unable to create socket"}, {ERR_PACK(ERR_LIB_BIO, 0, BIO_R_UNABLE_TO_KEEPALIVE), "unable to keepalive"}, {ERR_PACK(ERR_LIB_BIO, 0, BIO_R_UNABLE_TO_LISTEN_SOCKET), "unable to listen socket"}, {ERR_PACK(ERR_LIB_BIO, 0, BIO_R_UNABLE_TO_NODELAY), "unable to nodelay"}, {ERR_PACK(ERR_LIB_BIO, 0, BIO_R_UNABLE_TO_REUSEADDR), "unable to reuseaddr"}, {ERR_PACK(ERR_LIB_BIO, 0, BIO_R_UNAVAILABLE_IP_FAMILY), "unavailable ip family"}, {ERR_PACK(ERR_LIB_BIO, 0, BIO_R_UNINITIALIZED), "uninitialized"}, {ERR_PACK(ERR_LIB_BIO, 0, BIO_R_UNKNOWN_INFO_TYPE), "unknown info type"}, {ERR_PACK(ERR_LIB_BIO, 0, BIO_R_UNSUPPORTED_IP_FAMILY), "unsupported ip family"}, {ERR_PACK(ERR_LIB_BIO, 0, BIO_R_UNSUPPORTED_METHOD), "unsupported method"}, {ERR_PACK(ERR_LIB_BIO, 0, BIO_R_UNSUPPORTED_PROTOCOL_FAMILY), "unsupported protocol family"}, {ERR_PACK(ERR_LIB_BIO, 0, BIO_R_WRITE_TO_READ_ONLY_BIO), "write to read only BIO"}, {ERR_PACK(ERR_LIB_BIO, 0, BIO_R_WSASTARTUP), "WSAStartup"}, {0, NULL}}; #endif int ERR_load_BIO_strings(void) { #ifndef OPENSSL_NO_ERR if (ERR_func_error_string(BIO_str_functs[0].error) == NULL) { ERR_load_strings_const(BIO_str_functs); ERR_load_strings_const(BIO_str_reasons); } #endif return 1; }
the_stack_data/132373.c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* utils.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: reezeddi <[email protected]> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/09/18 06:50:53 by reezeddi #+# #+# */ /* Updated: 2020/09/18 06:51:08 by reezeddi ### ########.fr */ /* */ /* ************************************************************************** */ int ft_strcmp(char *s1, char *s2) { unsigned int i; i = 0; while (s1[i] == s2[i] && s1[i] && s2[i]) i++; return (s1[i] - s2[i]); } int ft_atoi(char *str) { int sign; int result; int i; sign = 1; result = 0; i = 0; while ((str[i] >= '\a' && str[i] <= '\r') || str[i] == ' ') i++; if ((str[i] == '+' || str[i] == '-') && (str[i + 1] >= '0' && str[i + 1] <= '9')) if (str[i++] == '-') sign = -1; while (str[i] != '\0' && (str[i] >= '0' && str[i] <= '9')) result = (result * 10) + (str[i++] - '0'); return (sign * result); }
the_stack_data/43886821.c
#include <stdio.h> void main() { int a,b,c; printf("ENTER THREE NUMBERS\n"); scanf("%d%d%d",&a,&b,&c); if(a>b && a>c) { printf("%d IS GREATER",a); } else if(b>a&& b>c) { printf("%d IS GREATER",c=b); } else { printf("%d IS GREATER OF THE THREE\n",c); } }
the_stack_data/24406.c
// justsyms_lib.cc -- test --just-symbols for gold // Copyright (C) 2011-2021 Free Software Foundation, Inc. // Written by Cary Coutant <[email protected]>. // This file is part of gold. // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, // MA 02110-1301, USA. // This test goes with justsyms_exec.cc. We compile this file, then // link it into an executable image with -Ttext and -Tdata to set // the starting addresses for each segment. int exported_func(void); int exported_data = 0x1000; int exported_func(void) { return 1; }
the_stack_data/45451250.c
#include <stdio.h> #include<string.h> void strlenNew(char *s) { int i=0; while(s[i]!='\0') { i++; } printf("Length of string :%d",i); } int main() { char str[1000]; printf("Enter a string: "); scanf("%[^\n]s",str); strlenNew(str); return 0; }
the_stack_data/181394082.c
/* Test of intraprocedural points-to * * How much of the points-to graph is assumed broken by the function call? */ #include <stdio.h> void call26(int ***ppp) { *ppp = NULL; return; } int main() { int i; int * p = &i; int ** pp = &p; int *** ppp = &pp; call26(ppp); return 0; }
the_stack_data/462766.c
// 编写函数计算下面多项式的值: // 3*x^5+2*x^4-5*x^3-x^2+7*x-6 // 编写程序要求用户输入x的值,调用该函数计算多项式的值并显示函数返回的值。 #include <stdio.h> int duoxiangshi(int x); int yh_pow(int x, int n); int main() { int x; printf("请输入x的值: "); scanf("%d", &x); printf("%d\n", duoxiangshi(x)); return 0; } int yh_pow(int x, int n) { int result = 1; for (int i = 0; i != n; ++i) { result *= x; } return result; } int duoxiangshi(int x) { return 3 * yh_pow(x, 5) + 2 * yh_pow(x, 4) - 5 * yh_pow(x, 3) - yh_pow(x, 2) + 7 * yh_pow(x, 1) - 6; }
the_stack_data/178265623.c
/* * Copyright (c) 2011, 2012, 2015 Jonas 'Sortie' Termansen. * * 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. * * stdio/perror.c * Prints a error messages to the terminal. */ #include <stdio.h> void perror(const char* s) { if ( s && s[0] ) fprintf(stderr, "%s: %m\n", s); else fprintf(stderr, "%m\n"); }
the_stack_data/111079058.c
/* Program to check children sum property */ #include <stdio.h> #include <stdlib.h> /* A binary tree node has data, left child and right child */ struct node { int data; struct node* left; struct node* right; }; /* returns 1 if children sum property holds for the given node and both of its children*/ int isSumProperty(struct node* node) { //left_data is left child data and right_data is for right child data int left_data = 0, right_data = 0; // If node is NULL or it's a leaf node then return true if(node == NULL || (node->left == NULL && node->right == NULL)) return 1; else { // If left child is not present then 0 is used as data of left child if(node->left != NULL) left_data = node->left->data; // If right child is not present then 0 is used as data of right child if(node->right != NULL) right_data = node->right->data; // if the node and both of its children satisfy the property return 1 else 0 if((node->data == left_data + right_data)&& isSumProperty(node->left) && isSumProperty(node->right)) return 1; else return 0; } } int isSumProperty1(struct node* node) //wrong solution { if(node == NULL) return 1; if(node->left != NULL && node->right != NULL && node->data == node->right->data + node->left->data) return 1; else return 0; if(node->left == NULL && node->right != NULL && node->data == node->right->data) return 1; else return 0; if(node->left != NULL && node->right == NULL && node->data == node->left->data) return 1; else return 0; isSumProperty1(node->left); isSumProperty1(node->right); } /* Helper function that allocates a new node with the given data and NULL left and right pointers. */ struct node* newNode(int data) { struct node* node = (struct node*)malloc(sizeof(struct node)); node->data = data; node->left = NULL; node->right = NULL; return(node); } /* Driver program to test above function */ int main() { struct node *root = newNode(10); root->left = newNode(8); root->right = newNode(2); root->left->left = newNode(3); root->left->right = newNode(5); root->right->right = newNode(1);//2 if(isSumProperty(root)) printf("isSumProperty: The given tree satisfies the children sum property "); else printf("isSumProperty: The given tree does not satisfy the children sum property "); printf("\n"); if(isSumProperty1(root)) printf("isSumProperty1: The given tree satisfies the children sum property "); else printf("isSumProperty1: The given tree does not satisfy the children sum property "); printf("\n"); getchar(); return 0; }
the_stack_data/61074151.c
/** Chat Service Project * * Author: John Roussos * License: MIT * */ #include <stdio.h> #include <string.h> #include <stdlib.h> #include <sys/socket.h> #include <arpa/inet.h> #include <unistd.h> #include <pthread.h> #include <semaphore.h> //color codes #define NRM "\x1B[0m" #define RED "\x1B[31m" #define GRN "\x1B[32m" #define YEL "\x1B[33m" #define BLU "\x1B[34m" #define MAG "\x1B[35m" #define CYN "\x1B[36m" #define WHT "\x1B[37m" #define RESET "\033[0m" #define PORT 8080 #define lineSize 40 sem_t semaphore; int usersListSize = 1, onlineUserListSize = 0, userChatingListSize = 0, groupListSize = 0, sizeOfUsersInGroup = 10; typedef struct userBluePrint{ char username[20]; char password[10]; }user; typedef struct onlineUsersList{ char username[20]; int socket; }onlineUser; typedef struct chatingUsers{ char username[20]; char chatingWithUser[20]; char chatingWithGroup[20]; }userChatsWith; typedef struct groupBlueprint{ char groupName[10]; char creator[20]; char listOfUsers[10][20]; }group; user *usersList; onlineUser *onlineUserList; userChatsWith *chatingList; group *groupList; FILE *fp, *fp_temp; struct sockaddr_in server , client; void sendToallOnlineUsers(int sock, char receivedMessage[]); void *connection_handler(void *); void *server_info(); int singIn(user potentialUser); int logIn(user PotentialUser); void printDB(); void printOnline(); void printChat(); void printGroups(); void sendContactsList(int socket, char username[]); void sendGroupsList(int socket, char username[]); void createGroup(char groupName[], char username[]); void createNewGroup(char username[], char groupName[]); void manageGroup(int socket, char username[]); void deleteGroup(int socket, char username[]); int chatWithContact(int socket, char contact[], char username[]); int chatWithGroup(int socket[], char group[], char username[]); void addContact(char whatToAdd[], int socket, char userToAdd[], char username[]); void checkingIfThereIsASavedMessage(int socketArray[], int socket, char clientName[], char chatee[]); int main(int argc , char *argv[]){ sem_init(&semaphore, 0, 1); usersList = malloc(usersListSize*sizeof(user));///might not needed will have to recheck it!! chatingList = malloc(sizeof(userChatsWith)); groupList = malloc(sizeof(group)); int socket_desc , client_sock , c; if(usersList == NULL){ perror("ERROR: create dynamic list\n"); exit(EXIT_FAILURE); } if((fp = fopen("users.list", "a+")) == NULL ){ perror("ERROR: Cannot read users from file\n"); exit(EXIT_FAILURE); } char *line, bufferedLine[lineSize]; int i=0, k=0; //read list of users from file and inserting them to an array while (fgets(bufferedLine, sizeof(bufferedLine), fp) != NULL){ bufferedLine[strlen(bufferedLine) - 1] = '\0'; //get rid of the \n that fgets pushes line = strtok(bufferedLine, "|"); usersListSize++; if ( (usersList = realloc(usersList, usersListSize*sizeof(user))) == NULL ){ printf("error"); exit(EXIT_FAILURE); } strcpy(usersList[i].username, line); // printf("username: %s ", line); line = strtok(NULL, "|"); strcpy(usersList[i].password, line); // printf("password: %s\n", line); i++; } fclose(fp); //read list of groups from file and inserting them to an array if((fp = fopen("groups.list", "a+")) == NULL ){ perror("ERROR: Cannot read groups from file\n"); exit(EXIT_FAILURE); } while(fgets(bufferedLine, sizeof(bufferedLine), fp)){ bufferedLine[strlen(bufferedLine) - 1] = '\0'; groupListSize++; groupList = realloc(groupList, groupListSize*sizeof(group)); line = strtok(bufferedLine, ":"); strcpy(groupList[groupListSize-1].groupName, line); line = strtok(NULL, ":"); strcpy(groupList[groupListSize-1].creator, line); line = strtok(NULL, "|"); for(int k=0; k<10; k++){ if(line == NULL) break; strcpy(groupList[groupListSize-1].listOfUsers[k], line); line = strtok(NULL, "|"); } } fclose(fp); socket_desc = socket(AF_INET , SOCK_STREAM , 0); if (socket_desc == -1){ printf("Could not create socket"); } puts("Socket created"); server.sin_family = AF_INET; server.sin_addr.s_addr = INADDR_ANY; server.sin_port = htons( PORT ); if( bind(socket_desc,(struct sockaddr *)&server , sizeof(server)) < 0){ perror("ERROR: bind failed"); return 1; } puts("Bind done"); listen(socket_desc , 3); puts("Waiting for incoming connections..."); c = sizeof(struct sockaddr_in); pthread_t traffic_thread, server_thread; printf(CYN"\nYou can type 'info' to see the status of database or 'help' to see the full list of commands and 'exit' to terminate server\n" RESET); if( pthread_create( &server_thread , NULL , server_info , NULL) < 0){ perror("could not create thread"); return 1; } //for every new connection creates an new thread to handle it while( (client_sock = accept(socket_desc, (struct sockaddr *)&client, (socklen_t*)&c)) ){ puts(GRN "Connection accepted" RESET); if( pthread_create( &traffic_thread , NULL , connection_handler , (void*) &client_sock) < 0){ perror("Could not create thread"); return 1; } //pthread_join( thread_id , NULL); puts("Handler assigned"); } if (client_sock < 0){ perror("accept failed"); return 1; } sem_destroy(&semaphore); return 0; } void *server_info(){//thread that handles the commands typed to server char command[10]; while(1){ scanf("%s", command); if(strcmp(command, "db") == 0) printDB(); else if(strcmp(command, "online") == 0) printOnline(); else if(strcmp(command, "exit") == 0) exit(EXIT_SUCCESS); else if(strcmp(command, "chat") == 0){ printChat(); }else if(strcmp(command, "groups") == 0){ printGroups(); }else if(strcmp(command, "info") == 0){ printDB(); printOnline(); printChat(); printGroups(); }else if(strcmp(command, "help") == 0){ printf("\n\n'info'\t\tprints the full status of the database\n'db'\t\tprints all the users registered in the app\n'online'\tprints the list of online users\n'chat'\t\tprints which user is chating with which\n'groups'\tprints a list with every group\n"); } } pthread_exit(NULL); } void *connection_handler(void *socket_desc){//thread that handles all the traffic int isThisTheFirstTime = 1; int sock = *(int*)socket_desc; int read_size; int respond; int sockToChat; int socketArrayForGroupChat[sizeOfUsersInGroup]; char *message , client_message[2000], sendable_message[2024]; user temp; char *p, *action, *command; //varification of the username and password given from the client // authorize user (1. success - 2. failure) while(respond != 1){ printf(MAG "NEW CONNECTION: %s:%d " RESET , inet_ntoa(client.sin_addr), ntohs(client.sin_port)); puts(RESET); read_size = recv(sock , client_message , 2000 , 0); if(read_size == 0){ printf(RED "Client disconnected\n" RESET); fflush(stdout); pthread_exit(NULL); } else if(read_size == -1){ perror("recv failed"); pthread_exit(NULL); } //end of string marker client_message[read_size] = '\0'; p = strtok (client_message, "|"); action = p; if( strcmp(action, "sig") == 0){ //search in the user list for existing user with the same name and if not exists then continue strcpy(temp.username, strtok (NULL, "|")); strcpy(temp.password, strtok (NULL, "|")); respond = singIn(temp); }else if( strcmp(action, "log") == 0){ //search in the user list for the user and the password and if match then continue strcpy(temp.username, strtok (NULL, "|")); strcpy(temp.password, strtok (NULL, "|")); respond = logIn(temp); } write(sock , &respond , sizeof(int)); memset(client_message, 0, 2000); }//end of the verification process //dynamically resize the user list and adding another user onlineUserListSize++; if( (onlineUserList = realloc(onlineUserList, onlineUserListSize*sizeof(onlineUser))) == NULL){ perror("ERROR: dynamic list"); exit(0); } onlineUserList[onlineUserListSize-1].socket = sock; strcpy(onlineUserList[onlineUserListSize-1].username, temp.username); //Receive a message from client while( (read_size = recv(sock , client_message , 2000 , 0)) > 0 ){ client_message[read_size] = '\0';//end of string marker char clientName[20], name[20]; //recognising that the client has sent a command instead of a message if(client_message[0] == '$'){ command = strtok(client_message, ":"); if(strcmp(command, "$contacts") == 0){ sendContactsList(sock, temp.username); }else if(strcmp(command, "$groups") == 0){ sendGroupsList(sock, temp.username); }else if(strcmp(command, "$setGroup") == 0){ command = strtok(NULL, ""); createNewGroup(temp.username, command); }else if(strcmp(command, "$manageGroup") == 0){ deleteGroup(sock, temp.username); }else if(strcmp(command, "$contactChat") == 0){ command = strtok(NULL, ""); strcpy(clientName, command); sockToChat = chatWithContact(sock, command, temp.username); }else if(strcmp(command, "$contactGroup") == 0){ command = strtok(NULL, ""); strcpy(clientName, command); sockToChat = chatWithGroup(socketArrayForGroupChat, command, temp.username); }else if(strcmp(command, "$addFriend") == 0){ command = strtok(NULL, ""); addContact("friend", sock, command, temp.username); }else if(strcmp(command, "$addGroup") == 0){ command = strtok(NULL, ""); addContact("group", sock, command, temp.username); } }else{ for(int i=0; i<onlineUserListSize; i++){ if(strcmp(onlineUserList[i].username, clientName) == 0){ for(int l=0; l<userChatingListSize; l++){ if(strcmp(chatingList[l].username, clientName) == 0){ if(strcmp(chatingList[l].chatingWithUser, temp.username) == 0){ sockToChat = onlineUserList[i].socket; } } } } } for(int i=0; i<groupListSize; i++){ if(strcmp(groupList[i].groupName, clientName) == 0){ for(int k=0; k<sizeOfUsersInGroup; k++){ for(int l=0; l<onlineUserListSize; l++){ if(strcmp(onlineUserList[l].username, groupList[i].listOfUsers[k]) == 0){ for(int p=0; p<userChatingListSize; p++){ if(strcmp(chatingList[p].username, groupList[i].listOfUsers[k]) == 0){ if(strcmp(chatingList[p].chatingWithGroup, groupList[i].groupName) == 0){ socketArrayForGroupChat[k] = onlineUserList[l].socket; printf("%d\n", socketArrayForGroupChat[k]); } } } } } } } } printf("sockToChat: %d\n",sockToChat); if(sockToChat > 3){//chating with user printf("received: %s -> fd: %d\n", client_message, sockToChat); for(int i=0; i<userChatingListSize; i++){ if(strcmp(chatingList[i].username, clientName) == 0){ strcpy(name, chatingList[i].chatingWithUser); } } printf("name: %s\n", name); checkingIfThereIsASavedMessage(NULL, sock, temp.username, name); strcat(sendable_message, MAG"("); strcat(sendable_message, name); strcat(sendable_message, "): "RESET); strcat(sendable_message, client_message); send(sockToChat, sendable_message, strlen(sendable_message), 0); }else if(sockToChat == -2){//chating with group printf("received: %s -> group: %s\n", client_message, clientName); if(isThisTheFirstTime){ checkingIfThereIsASavedMessage(socketArrayForGroupChat, 0, clientName, "$group"); isThisTheFirstTime = 0; } strcat(sendable_message, MAG"("); strcat(sendable_message, temp.username); strcat(sendable_message, "): "RESET); strcat(sendable_message, client_message); sem_wait(&semaphore); if((fp = fopen("savedMessages.list", "a+")) == NULL ){ perror("ERROR: Cannot read users from file\n"); exit(EXIT_FAILURE); } int isOnline; for(int i=0; i<sizeOfUsersInGroup; i++){ if(socketArrayForGroupChat[i] == sock) continue; send(socketArrayForGroupChat[i], sendable_message, strlen(sendable_message), 0); for(int k=0; k<onlineUserListSize; k++){ if(socketArrayForGroupChat[i] == onlineUserList[k].socket) isOnline = 1; else isOnline = 0; } } if(isOnline == 0) fprintf(fp, "%s|%s:%s\n", clientName, temp.username, client_message); fclose(fp); sem_post(&semaphore); }else if(sockToChat == -1){ checkingIfThereIsASavedMessage(NULL, sock, temp.username, clientName); printf("received: %s -> fd: %d\n", client_message, sockToChat); sem_wait(&semaphore); if((fp = fopen("savedMessages.list", "a+")) == NULL ){ perror("ERROR: Cannot read users from file\n"); exit(EXIT_FAILURE); } fprintf(fp, "%s|%s:%s\n", clientName, temp.username, client_message); fclose(fp); sem_post(&semaphore); printf("client not online. Message is saved\n"); } } //send message to all clients //sendToallOnlineUsers(sock, client_message); //clear the message buffer memset(client_message, 0, 2000); memset(sendable_message, 0, 2024); } if(read_size == 0){ printf(RED "Client disconnected\n" RESET); fflush(stdout); for(int i=0; i<onlineUserListSize; i++){ if(strcmp(onlineUserList[i].username, temp.username) == 0){ strcpy(onlineUserList[i].username, onlineUserList[onlineUserListSize-1].username); onlineUserList[i].socket = onlineUserList[onlineUserListSize-1].socket; onlineUserListSize--; } } for(int i=0; i<userChatingListSize; i++){ if(strcmp(chatingList[i].username, temp.username) == 0){ strcpy(chatingList[i].username, chatingList[userChatingListSize-1].username); strcpy(chatingList[i].chatingWithUser, chatingList[userChatingListSize-1].chatingWithUser); strcpy(chatingList[i].chatingWithGroup, chatingList[userChatingListSize-1].chatingWithGroup); userChatingListSize--; } } close(sock); } else if(read_size == -1){ perror("recv failed"); } pthread_exit(NULL); } int singIn(user potentialUser){ //searching for(int i=0; i<usersListSize; i++){ if(strcmp(usersList[i].username, "") != 0){ //cell is not empty if(strcmp(usersList[i].username, potentialUser.username) == 0){ printf("user already exists\n"); return 0; //error user already exists } }else{ //cell is empty usersListSize++; if ( (usersList = realloc(usersList, usersListSize*sizeof(user))) == NULL ){ perror("ERROR: dynamic list"); exit(0); } strcpy(usersList[i].username, potentialUser.username); strcpy(usersList[i].password, potentialUser.password); printf("%s|%s\n", potentialUser.username, potentialUser.password); sem_wait(&semaphore); if((fp = fopen("users.list", "a+")) == NULL ){ perror("ERROR: Cannot read file\n"); exit(EXIT_FAILURE); } fprintf(fp, "%s|%s\n", potentialUser.username, potentialUser.password); fclose(fp); if((fp = fopen("contacts.list", "a+")) == NULL ){ perror("ERROR: Cannot read groups from file\n"); exit(EXIT_FAILURE); } fprintf(fp, "%s:\n", potentialUser.username); fclose(fp); sem_post(&semaphore); break; } } return 1; //success } int logIn(user potentialUser){ for(int i=0; i<usersListSize; i++){ for(int l=0; l<onlineUserListSize; l++){ if(strcmp(onlineUserList[l].username, potentialUser.username) == 0){ return 2; //already logged in } } if(strcmp(usersList[i].username, potentialUser.username) == 0 && strcmp(usersList[i].password, potentialUser.password) == 0){ return 1; //success } } return 0; //error username or password dont match } void sendToallOnlineUsers(int sock, char receivedMessage[]){ for(int i=0; i<onlineUserListSize; i++){ if(onlineUserList[i].socket == sock) continue; send(onlineUserList[i].socket, receivedMessage, strlen(receivedMessage),0); } } void printDB(){ /** print the user list */ printf("\n\nDatabase\n"); printf("----------------------------\n"); for(int i=0; i<usersListSize-1; i++){ printf("Entry %2d - user: %s pass: %s\n", i+1, usersList[i].username, usersList[i].password); } printf("----------------------------\n\n"); } void printOnline(){ /** print online users list */ printf("\n\nOnline\n"); printf("----------------------------\n"); for(int i=0; i<onlineUserListSize; i++){ printf("Online %2d - user: %s fd: %d\n", i+1, onlineUserList[i].username, onlineUserList[i].socket); } printf("----------------------------\n\n"); } void printChat(){ /** print which user is chating with which */ printf("\n\nChat\n"); printf("----------------------------\n"); for(int i=0; i<userChatingListSize; i++){ printf("Entry %2d - user: %s\tchatingWithUser: %s\tchatingWithGroup: %s\n", i+1, chatingList[i].username, chatingList[i].chatingWithUser, chatingList[i].chatingWithGroup); } printf("----------------------------\n\n"); } void printGroups(){ /** print the groups */ printf("\n\nGroups\n"); printf("----------------------------\n"); for(int i=0; i<groupListSize; i++){ printf("Entry %2d - group name: %s creator: %s user list: ", i+1, groupList[i].groupName, groupList[i].creator); for(int k=0; k<10; k++){ // fputs(groupList[i].listOfUsers[k], stdout); printf("%s ", groupList[i].listOfUsers[k]); } printf("\n"); } printf("----------------------------\n\n"); } void sendContactsList(int socket, char username[]){ char *line, *rest, bufferedLine[60], sendableLine[60]; sem_wait(&semaphore); if((fp = fopen("contacts.list", "a+")) == NULL ){ perror("ERROR: Cannot read contacts from file\n"); exit(EXIT_FAILURE); } while(fgets(bufferedLine, sizeof(bufferedLine), fp) != NULL){ bufferedLine[strlen(bufferedLine) - 1] = '\0'; rest = strchr(bufferedLine, ':'); line = strtok(bufferedLine, ":"); strcpy(sendableLine, rest+1); // printf("size: %ld\n", strlen(sendableLine)); if(strcmp(line, username) == 0){ if(strlen(sendableLine) <= 1) send(socket, "noContacts", 11,0); else send(socket, sendableLine, strlen(sendableLine), 0); } } fclose(fp); sem_post(&semaphore); } void sendGroupsList(int socket, char username[]){ char *line, *rest, bufferedLine[60], sendableLine[60]; memset(sendableLine, 0, 60); for(int i=0; i<groupListSize; i++){ for(int k=0; k<sizeOfUsersInGroup; k++){ if(strcmp(groupList[i].listOfUsers[k], username) == 0){ strcat(sendableLine, groupList[i].groupName); strcat(sendableLine, "|"); } } } // printf("line: %s - size: %ld\n", sendableLine, strlen(sendableLine)); if(strlen(sendableLine) <= 1) send(socket, "noGroups", 9,0); else send(socket, sendableLine, strlen(sendableLine)-1, 0); } void createGroup(char username[], char groupName[]){ char line[55], *prefix; printf("Create Group: %s\n", groupName); sem_wait(&semaphore); if((fp = fopen("groups.list", "a+")) == NULL ){ perror("ERROR: Cannot read groups from file\n"); exit(EXIT_FAILURE); } if((fp_temp = fopen("temp", "a+")) == NULL ){ perror("ERROR: Cannot read groups from file\n"); exit(EXIT_FAILURE); } while(fscanf(fp, "%s\n", line) != EOF){ prefix = strtok(line, ":"); if(strcmp(prefix, username) == 0){ prefix = strtok(NULL, ""); if(prefix == NULL){ fprintf(fp_temp, "%s:%s\n", username, groupName); }else{ fprintf(fp_temp, "%s:%s|%s\n", username, prefix, groupName); } continue; } fprintf(fp_temp, "%s:\n", line); } fclose(fp); fclose(fp_temp); remove("groups.list"); rename("temp", "groups.list"); sem_post(&semaphore); } void createNewGroup(char username[], char groupName[]){ printf("Create Group: %s\n", groupName); groupListSize++; groupList = realloc(groupList, groupListSize*sizeof(group)); strcpy(groupList[groupListSize-1].groupName, groupName); strcpy(groupList[groupListSize-1].creator, username); strcpy(groupList[groupListSize-1].listOfUsers[0], username); sem_wait(&semaphore); if((fp = fopen("groups.list", "w")) == NULL ){ perror("ERROR: Cannot read groups from file\n"); exit(EXIT_FAILURE); } for(int i=0; i<groupListSize; i++){ fprintf(fp, "%s:%s:", groupList[i].groupName, groupList[i].creator); for(int k=0; k<10; k++){ if(groupList[i].listOfUsers[k][0] != '\0'){ if(k != 0){ fprintf(fp, "|%s", groupList[i].listOfUsers[k]); } fprintf(fp, "%s", groupList[i].listOfUsers[k]); } } fprintf(fp, "\n"); } fclose(fp); sem_post(&semaphore); } void deleteGroup(int socket, char username[]){ char line[60], groupToDelete[10]; memset(line, 0, 60); memset(groupToDelete, 0, 10); for(int i=0; i<groupListSize; i++){ if(strcmp(groupList[i].creator, username) == 0){ strcat(line, groupList[i].groupName); strcat(line, "|"); } } // printf("%s") if(line[0] == '\0'){ printf("No Groups\n"); send(socket, "nogroups", 9, 0); }else{ printf("Yes Groups\n"); send(socket, line, strlen(line), 0); recv(socket, groupToDelete, 10, 0); sem_wait(&semaphore); if((fp = fopen("groups.list", "w")) == NULL ){ perror("ERROR: Cannot read groups from file\n"); exit(EXIT_FAILURE); } for(int i=0; i<groupListSize; i++){ printf("groupName -> %s\n",groupList[i].groupName); if((strcmp(groupList[i].creator, username) == 0) && (strcmp(groupList[i].groupName, groupToDelete) == 0)){ groupList[i] = groupList[groupListSize-1]; groupListSize--; if(groupListSize > 0){ for(int i=0; i<groupListSize; i++){ fprintf(fp, "%s:%s:", groupList[groupListSize].groupName, groupList[groupListSize].creator); for(int k=0; k<10; k++){ fprintf(fp, "%s|", groupList[groupListSize].listOfUsers[k]); } } } } } fclose(fp); sem_post(&semaphore); } } int chatWithContact(int socket, char contact[], char username[]){ int socket_fd = 0; //dynamically resize the chating list //this is a list that contains the online users and with whom their chating //it ensures that if a user tries to send a message to a user that is already chating with another one, that message will not be send during their session userChatingListSize++; if( (chatingList = realloc(chatingList, userChatingListSize*sizeof(userChatsWith))) == NULL){ printf("error"); exit(EXIT_FAILURE); } strcpy(chatingList[userChatingListSize-1].username, username); strcpy(chatingList[userChatingListSize-1].chatingWithUser, contact); for(int i=0; i<onlineUserListSize; i++){ if(strcmp(onlineUserList[i].username, contact) == 0){ for(int l=0; l<userChatingListSize; l++){ if(strcmp(chatingList[l].username, contact) == 0){ if(strcmp(chatingList[l].chatingWithUser, username) == 0){ socket_fd = onlineUserList[i].socket; } } } // printf("%d\n", socket_fd); } } if(socket_fd == 0){ socket_fd = -1; } return socket_fd; } int chatWithGroup(int socket[], char group[], char username[]){ int socket_fd = 0; userChatingListSize++; if( (chatingList = realloc(chatingList, userChatingListSize*sizeof(userChatsWith))) == NULL){ printf("error"); exit(EXIT_FAILURE); } strcpy(chatingList[userChatingListSize-1].username, username); strcpy(chatingList[userChatingListSize-1].chatingWithGroup, group); for(int i=0; i<groupListSize; i++){ if(strcmp(groupList[i].groupName, group) == 0){ for(int k=0; k<sizeOfUsersInGroup; k++){ for(int l=0; l<onlineUserListSize; l++){ if(strcmp(onlineUserList[l].username, groupList[i].listOfUsers[k]) == 0){ for(int p=0; p<userChatingListSize; p++){ if(strcmp(chatingList[p].username, groupList[i].listOfUsers[k]) == 0){ if(strcmp(chatingList[p].chatingWithGroup, groupList[i].groupName) == 0){ socket[k] = onlineUserList[l].socket; //return an array with the sockets of the users in the group chat socket_fd = -2; } } } } } } } } if (socket_fd == 0){ socket_fd = -1; } return socket_fd; } void addContact(char whatToAdd[], int socket, char userToAdd[], char username[]){ int success = 0; char line[60], keepLine[60], *prefix; if(strcmp(whatToAdd, "friend") == 0){//add friend sem_wait(&semaphore); if((fp = fopen("contacts.list", "a+")) == NULL ){ perror("ERROR: Cannot read groups from file\n"); exit(EXIT_FAILURE); } if((fp_temp = fopen("temp", "a+")) == NULL ){ perror("ERROR: Cannot read groups from file\n"); exit(EXIT_FAILURE); } for(int i=0; i<usersListSize; i++){ if(strcmp(userToAdd, usersList[i].username) == 0){//if user exist success = 1; while(fscanf(fp, "%s\n", line) != EOF){//reading from file strcpy(keepLine, line); //printf("keepLine -> %s\n", keepLine); prefix = strtok(line, ":"); //printf("prefix -> %s\n", prefix); if(strcmp(prefix, username) == 0){ prefix = strtok(NULL, ""); //printf("prefix_2 -> %s\n", prefix); if(prefix == NULL){ fprintf(fp_temp, "%s:%s\n", username, userToAdd); }else{ fprintf(fp_temp, "%s:%s|%s\n", username, prefix, userToAdd); } continue; }else{ fprintf(fp_temp, "%s\n", keepLine); } } fclose(fp); fclose(fp_temp); remove("contacts.list"); rename("temp", "contacts.list"); sem_post(&semaphore); break; } } if(success) send(socket, "ok", 3, 0); else send(socket, "notok", 6, 0); }else{//add group for(int i=0; i<groupListSize; i++){ if(strcmp(groupList[i].groupName, userToAdd) == 0){ for(int k=0; k<sizeOfUsersInGroup; k++){ if(groupList[i].listOfUsers[k][0] == '\0'){ strcpy(groupList[i].listOfUsers[k], username); success = 1; break; } } } } sem_wait(&semaphore); if((fp = fopen("groups.list", "w")) == NULL ){ perror("ERROR: Cannot read groups from file\n"); exit(EXIT_FAILURE); } if(success){ send(socket, "ok", 3, 0); for(int i=0; i<groupListSize; i++){ // rewind(fp); fprintf(fp, "%s:%s:", groupList[i].groupName, groupList[i].creator); for(int k=0; k<10; k++){ if(groupList[i].listOfUsers[k][0] != '\0'){ if(k != 0) fprintf(fp, "|%s", groupList[i].listOfUsers[k]); else fprintf(fp, "%s", groupList[i].listOfUsers[k]); } } fprintf(fp, "\n"); } }else send(socket, "notok", 6, 0); fclose(fp); sem_post(&semaphore); } } void checkingIfThereIsASavedMessage(int socketArray[], int socket, char clientName[], char chatee[]){ char line[60], *name, clientMessage[2024], keepline[60]; memset(clientMessage, 0, 2024); printf("Checking..\n"); printf("chatee: %s\n", chatee); sem_wait(&semaphore); if((fp = fopen("savedMessages.list", "a+")) == NULL ){ perror("ERROR: Cannot read groups from file\n"); exit(EXIT_FAILURE); } if((fp_temp = fopen("tempFile", "a+")) == NULL ){ perror("ERROR: Cannot read groups from file\n"); exit(EXIT_FAILURE); } while(fgets(line, sizeof(line), fp)){ line[strlen(line)-1] = '\0'; printf("line -> %s\n", line); strcpy(keepline, line); name = strtok(line, "|"); if(name == NULL) break; if(strcmp(name, clientName) == 0){ name = strtok(NULL, ":"); printf("name -> %s\n", name); strcat(clientMessage, MAG"("); strcat(clientMessage, name); strcat(clientMessage, "): "RESET); if((strcmp(name, chatee) == 0) || (strcmp(chatee, "$group") == 0)){ name = strtok(NULL, ""); printf("message -> %s\n", name); if(name != NULL){ strcat(clientMessage, name); printf("final -> %s\n", clientMessage); if(socketArray == NULL){ send(socket, clientMessage, 2024, 0); }else{ for(int i=0; i<10; i++){ send(socketArray[i], clientMessage, 2024, 0); } } } }else{ fprintf(fp_temp, "%s\n", keepline); } }else{ fprintf(fp_temp, "%s\n", keepline); } memset(clientMessage, 0, 2024); } fclose(fp); fclose(fp_temp); remove("savedMessages.list"); rename("tempFile", "savedMessages.list"); sem_post(&semaphore); }
the_stack_data/26955.c
#include <stdio.h> int main(){ int pos,fnum,result; _Bool turn = 0; int numList[10] = {0,1,2,3,4,5,6,7,8,9}; pos = 10/2; printf("input: "); scanf("%d",&fnum); while( (pos>=0)&&(numList[pos] != '\0') ){ if(numList[pos] == fnum){ turn = 1; result = pos; break; } else if(numList[pos] > fnum){ pos--; } else if(numList[pos] < fnum){ pos++; } } if(turn){ printf("%d",result); } else{ printf("无次数"); } return 0; }
the_stack_data/89117.c
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> #include <dirent.h> // for MAXNAMLEN #include <unistd.h> // for access(); /* terrapos2ybin.c This program reads the ascii output (IPAS format) of the TerraPOS program and converts the time, date, lat,lon, pdop, svs, flag, veast, vnorth, vup, and altitude to binary for reading into yorick. */ #define MAXSTR 1024 char *changename( char *ostr, char *nstr, char *txt ) { char *pstr; strncpy(nstr, ostr, MAXNAMLEN-1); // make a copy // if the file doesn't have an extension, we can still pick up // (an incorrect) period from the start of the path when using // 'find'. pstr = strrchr( nstr, '.'); // find the period if ( !pstr || pstr == nstr ) { // no period, pstr = nstr; while ( *(++pstr) != '\0'); // find the end of the string } strcpy(pstr, txt); // append the text return(nstr); } int main( int argc, char *argv[] ) { FILE *idf, *odf; float sod; int good=0, badcnt=0, line=0; float gpsTime, lat, lon, alt; int q; float sdN, sdE, sdH; float vnorth, veast, vup; float sdVN, sdVE, sdVUp; int sv; float pdop; float rms=0; //Default value, not present in TerraPOS output int flag=1; //Default value, not present in TerraPOS output char str[MAXSTR*2], scp[ MAXSTR+2 ]; if ( (idf=fopen( argv[1], "r" ) ) == NULL ) { perror(""); exit(1); } if ( argc == 2 ) { // generate and open the output file char *pfname, nfname[MAXNAMLEN]; changename(argv[1], nfname, ".ybin"); fprintf(stderr, "creating output file: %s\n", nfname); if ( access(nfname, F_OK) == 0 ) { fprintf(stderr, "file %s exists, please remove it first\n", nfname); exit(-1); } else { if ( ( odf=fopen(nfname, "w+")) == NULL ) { perror(""); exit(1); } } } else { // open the file given on the cmdline if ( ( odf=fopen(argv[2], "w+")) == NULL ) { perror(""); exit(1); } } // write placeholder for the number of records. We'll reposition to // this after we know how many elements there are. fwrite( &good, sizeof(int), 1, odf); while ( !feof(idf) ) { // get the string from the file fgets( str, MAXSTR-4, idf ); if(str[0] == ';') { //skip comments continue; } line++; good++; sscanf(str,"%f %f %f %f %d %f %f %f %f %f %f %f %f %f %d %f", &gpsTime, &lat, &lon, &alt, &q, &sdN, &sdE, &sdH, &vnorth, &veast, &vup, &sdVN, &sdVE, &sdVUp, &sv, &pdop); sod = fmod(gpsTime, 24*60*60); { static struct { short svs; short flag; float sod; float pdop; float alt; float rms; float veast; float vnorth; float vup; double lat; double lon; } pnav; /* printf("%d %4.1f %8.1f %12.8f %12.8f %6.3f %5.3f %7.3f %7.3f %7.3f\n", line, pdop, sod, lat, lon, alt, rms, veast, vnorth, vup); */ pnav.sod = sod; pnav.svs = sv; pnav.pdop = pdop; pnav.lat = lat; pnav.lon = lon; pnav.alt = alt; pnav.rms = rms; pnav.flag= flag; pnav.veast=veast; pnav.vnorth = vnorth; pnav.vup = vup; fwrite( &pnav, sizeof(pnav), 1, odf); } } fseek( odf, 0, SEEK_SET); fwrite( &good, sizeof(int), 1, odf); // install count printf("\n%d total points, %d good points, %d bad points\n", line, good, badcnt); }
the_stack_data/160268.c
#include <string.h> int main(void) { char buf[3] = "a"; return( ! (2 == strlcat(buf, "b", sizeof(buf)) && 'a' == buf[0] && 'b' == buf[1] && '\0' == buf[2])); }
the_stack_data/240985.c
/* * main_4th.c * * Created on: 11 de abr de 2020 * Author: guilherme */ void towerOfHanoi(int n, char from, char to, char aux) { if (n == 1) { printf("\n Movendo o disco 1 da coluna %c para a coluna %c", from, to); return; } towerOfHanoi(n-1, from, aux, to); printf("\n Movendo o disco %d da coluna %c para a coluna %c", n, from, to); towerOfHanoi(n-1, aux, to, from); } void main_4th() { printf("4th.\n"); printf("Resolver o problema da Torre de Hanoi que esta no material.\n"); int r, n = 4; towerOfHanoi( n, 'A', 'C', 'B' ); }
the_stack_data/175143254.c
#include<stdio.h> int main(){ int m, y; scanf("%d %d", &y, &m); printf("%d", 2 * m - y); return 0; }
the_stack_data/237643253.c
/* Programa que simula a classificacao em uma olimpiada AUTOR: GABRIEL HENRIQUE CAMPOS SCALICI NUMERO: 9292970 DATA:18-06-2015 */ #include<stdio.h> #include<stdlib.h> //Fazndo uma strutct typedef struct cadastro_paises{ char *nome; int ouro; int prata; int bronze; }PAIS; //Funcao para pegar o nome corretamente char *lerstring() { char valor = '@'; char *palavra = NULL; int aux =1; //Enquanto for diferente de enter while(valor!= ' '){ //Pegando o que o usuario digito scanf("%c", &valor); //realocando e colocando no vetor palavra = (char*)realloc(palavra, sizeof(char)*aux); palavra[aux-1] = valor; aux++; } palavra = (char*)realloc(palavra, sizeof(char)*aux); palavra[aux-1] = '\0'; return palavra; } //FUncao para cadastrar o pais PAIS * cadastra_pais(PAIS * paises, int *n){ char * nome; int i, ouro, prata, bronze; PAIS pa; //sETANDO NULL para nao interfirir nas outras vezes que a funcao for usada pa.nome = NULL; pa.ouro = 0; pa.prata = 0; pa.bronze = 0; //Armazenando o buffer do teclado char buffer; for(i=0; i<*(n); i++){ //Colocando no ponteiro de structs, um novo cadastro de pais nome = lerstring(); scanf("%d %d %d", &ouro, &prata, &bronze); buffer = getchar(); //Atribuindo os valores no cadastro do pais pa.nome = nome; pa.ouro = ouro; pa.prata = prata; pa.bronze = bronze; //Colocando os valores digitados no cadastro dos paises paises[i] = pa; } return paises; } //Funcao para ordenar a tabela de acordo com as medalhas void ordenar_mostrar(PAIS * paises, int * n ){ int i, index_aux, atual, anterior; PAIS str_aux; for(i=1; i<= *(n); i++){ //Anotando os valores das medalhas de ouro inicialmente atual = paises[i].ouro; anterior = paises[i-1].ouro; //Analisando qual eh menor if(atual <= anterior){ //CAso entre na condicao e seja igual, usar outro criterio (medalha de prata) para ordenacao if(atual == anterior){ //PEgando as medalhas de prata atual = paises[i].prata; anterior = paises[i-1].prata; //Analisando qual tem a maior quantidade de medalhas de prata if(atual <= anterior){ //Caso seja igual, mudar para analisar as medalhas de bronze if(atual == anterior){ //PEgando as medalhas de bronze atual = paises[i].bronze; anterior = paises[i-1].bronze; //Analisando qual eh maior que qual, se for igual agora nao havera criterio de desempoate if(atual <= anterior){ //Realizar a troca //Copiando a struct atual para a auxiliar e realizando a troca str_aux = paises[i-1]; paises[i-1] = paises[i]; paises[i] = str_aux; } }else{ //Realizando a troca caso a medalha de prata ja seja suficiente str_aux = paises[i-1]; paises[i-1] = paises[i]; paises[i] = str_aux; } } } //Realizando as trocas caso a medalha de ouro ja seja suficiente str_aux = paises[i-1]; paises[i-1] = paises[i]; paises[i] = str_aux; } } //Mostrando para o usuario como ficou a nova tabela for(i=0; i< *(n); i++){ //Mostrando a struct printf("%s %d %d %d", paises[i].nome, paises[i].ouro, paises[i].prata, paises[i].bronze); } } int main(){ int n, i; PAIS * paises = NULL; //Pedindo a quantidade de paises scanf("%d", &n); //Alocando o vetor de structs com base na quantidade de paises paises = (PAIS*)malloc(sizeof(PAIS)*n); //CHhamando a funcoa para cadastrar os n paises paises = cadastra_pais(paises, &n); //Chamando funcao para ordenar ordenar_mostrar(paises, &n); return 0; }
the_stack_data/69451.c
#include <stdio.h> unsigned char foo (unsigned short n) { printf("%d\n", n); return -30; } int main (void) { int x = foo(-123456); printf("%d\n", x); return 0; }
the_stack_data/31386827.c
/* $NetBSD: tmpfile.c,v 1.12 2012/03/15 18:22:30 christos Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Chris Torek. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include <sys/cdefs.h> #include <sys/types.h> #include <unistd.h> #include <signal.h> #include <errno.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <paths.h> FILE *tmpfile(void) { sigset_t set, oset; FILE *fp; int fd, sverrno; #define TRAILER "tmp.XXXXXXXXXX" char buf[sizeof(_PATH_TMP) + sizeof(TRAILER)]; (void)memcpy(buf, _PATH_TMP, sizeof(_PATH_TMP) - 1); (void)memcpy(buf + sizeof(_PATH_TMP) - 1, TRAILER, sizeof(TRAILER)); sigfillset(&set); (void)sigprocmask(SIG_BLOCK, &set, &oset); fd = mkstemp(buf); if (fd != -1) (void)unlink(buf); (void)sigprocmask(SIG_SETMASK, &oset, NULL); if (fd == -1) return NULL; if ((fp = fdopen(fd, "w+")) == NULL) { sverrno = errno; (void)close(fd); errno = sverrno; return NULL; } return fp; }
the_stack_data/914883.c
// ltttview - Analyses LTTT (Landscape Texture Translation Table?) files from Warrior Kings // (C) 2017 AdrienTD // Licensed under the MIT license (see license.txt for more information) #include <stdio.h> #include <assert.h> typedef unsigned char uchar; typedef unsigned short ushort; typedef unsigned int uint; typedef struct { char *srcname; int srcpos; char *dstname; int dstpos; } tte; FILE *file; char **srcname, **dstname; uint nsrc, ndst; tte *table; uint ne; char read8() {char a; fread(&a, 1, 1, file); return a;} short read16() {short a; fread(&a, 2, 1, file); return a;} int read32() {int a; fread(&a, 4, 1, file); return a;} void main() { int i; char *p; file = fopen("input.lttt", "rb"); assert(file); assert(read32() == 'TTTL'); assert(read32() == 1); ndst = (ushort)read16(); dstname = malloc(sizeof(char*) * ndst); for(i = 0; i < ndst; i++) { p = dstname[i] = malloc(256); while(*(p++) = read8()); } nsrc = (ushort)read16(); srcname = malloc(sizeof(char*) * nsrc); for(i = 0; i < nsrc; i++) { p = srcname[i] = malloc(256); while(*(p++) = read8()); } ne = read32(); table = malloc(sizeof(tte) * ne); for(i = 0; i < ne; i++) { table[i].srcname = srcname[read16()]; table[i].srcpos = read8(); table[i].dstname = dstname[read16()]; table[i].dstpos = read8(); } fclose(file); printf("%u entries:\n", ne); for(i = 0; i < ne; i++) { printf("%s (%i,%i) -> %s (%i, %i)\n", table[i].srcname, table[i].srcpos & 3, table[i].srcpos >> 2, table[i].dstname, table[i].dstpos & 3, table[i].dstpos >> 2); } }
the_stack_data/67326142.c
#include <stdio.h> #define TRUE 1 #define FALSE 0 int main() { printf("TRUE 的值:%d\n", TRUE); printf("FALSE 的值:%d\n", FALSE); return 0; }
the_stack_data/39819.c
//to find minimum cost spanning tree using Kruskal's method of a given connected, undirected and weighted graph #include <stdio.h> #include <stdlib.h> #include <string.h> // a structure to represent a weighted edge in graph struct Edge { int src, dest, weight; }; // a structure to represent a connected, undirected and weighted graph struct Graph { // V-> Number of vertices, E-> Number of edges int V, E; // graph is represented as an array of edges. Since the graph is // undirected, the edge from src to dest is also edge from dest // to src. Both are counted as 1 edge here. struct Edge* edge; }; // Creates a graph with V vertices and E edges struct Graph* createGraph(int V, int E) { struct Graph* graph = (struct Graph*) malloc( sizeof(struct Graph) ); graph->V = V; graph->E = E; graph->edge = (struct Edge*) malloc( graph->E * sizeof( struct Edge ) ); return graph; } // A structure to represent a subset for union-find struct subset { int parent; int rank; }; // A utility function to find set of an element i // (uses path compression technique) int find(struct subset subsets[], int i) { // find root and make root as parent of i (path compression) if (subsets[i].parent != i) subsets[i].parent = find(subsets, subsets[i].parent); return subsets[i].parent; } // A function that does union of two sets of x and y // (uses union by rank) void Union(struct subset subsets[], int x, int y) { int xroot = find(subsets, x); int yroot = find(subsets, y); // Attach smaller rank tree under root of high rank tree // (Union by Rank) if (subsets[xroot].rank < subsets[yroot].rank) subsets[xroot].parent = yroot; else if (subsets[xroot].rank > subsets[yroot].rank) subsets[yroot].parent = xroot; // If ranks are same, then make one as root and increment // its rank by one else { subsets[yroot].parent = xroot; subsets[xroot].rank++; } } // Compare two edges according to their weights. // Used in qsort() for sorting an array of edges int myComp(const void* a, const void* b) { struct Edge* a1 = (struct Edge*)a; struct Edge* b1 = (struct Edge*)b; return a1->weight > b1->weight; } // The main function to construct MST using Kruskal's algorithm void KruskalMST(struct Graph* graph) { int V = graph->V; struct Edge result[V]; // Tnis will store the resultant MST int e = 0; // An index variable, used for result[] int i = 0; // An index variable, used for sorted edges // Step 1: Sort all the edges in non-decreasing order of their weight // If we are not allowed to change the given graph, we can create a copy of // array of edges qsort(graph->edge, graph->E, sizeof(graph->edge[0]), myComp); // Allocate memory for creating V ssubsets struct subset *subsets = (struct subset*) malloc( V * sizeof(struct subset) ); // Create V subsets with single elements for (int v = 0; v < V; ++v) { subsets[v].parent = v; subsets[v].rank = 0; } // Number of edges to be taken is equal to V-1 while (e < V - 1) { // Step 2: Pick the smallest edge. And increment the index // for next iteration struct Edge next_edge = graph->edge[i++]; int x = find(subsets, next_edge.src); int y = find(subsets, next_edge.dest); // If including this edge does't cause cycle, include it // in result and increment the index of result for next edge if (x != y) { result[e++] = next_edge; Union(subsets, x, y); } // Else discard the next_edge } // print the contents of result[] to display the built MST printf("Following are the edges in the constructed MST\n"); for (i = 0; i < e; ++i) printf("%d -- %d == %d\n", result[i].src, result[i].dest, result[i].weight); return; } // Driver program to test above functions int main() { /* Let us create following weighted graph 10 0--------1 | \ | 6| 5\ |15 | \ | 2--------3 4 */ int V = 4; // Number of vertices in graph int E = 5; // Number of edges in graph struct Graph* graph = createGraph(V, E); // add edge 0-1 graph->edge[0].src = 0; graph->edge[0].dest = 1; graph->edge[0].weight = 10; // add edge 0-2 graph->edge[1].src = 0; graph->edge[1].dest = 2; graph->edge[1].weight = 6; // add edge 0-3 graph->edge[2].src = 0; graph->edge[2].dest = 3; graph->edge[2].weight = 5; // add edge 1-3 graph->edge[3].src = 1; graph->edge[3].dest = 3; graph->edge[3].weight = 15; // add edge 2-3 graph->edge[4].src = 2; graph->edge[4].dest = 3; graph->edge[4].weight = 4; KruskalMST(graph); return 0; }
the_stack_data/170453636.c
/* Taxonomy Classification: 0000000100000000000300 */ /* * 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 1 variable * ADDRESS COMPLEXITY 0 constant * LENGTH COMPLEXITY 0 N/A * ADDRESS ALIAS 0 none * INDEX ALIAS 0 none * LOCAL CONTROL FLOW 0 none * SECONDARY CONTROL FLOW 0 none * LOOP STRUCTURE 0 no * LOOP COMPLEXITY 0 N/A * ASYNCHRONY 0 no * TAINT 0 no * RUNTIME ENV. DEPENDENCE 0 no * MAGNITUDE 3 4096 bytes * CONTINUOUS/DISCRETE 0 discrete * SIGNEDNESS 0 no */ /* Copyright 2004 M.I.T. Permission is hereby granted, without written agreement or royalty fee, to use, copy, modify, and distribute this software and its documentation for any purpose, provided that the above copyright notice and the following three paragraphs appear in all copies of this software. IN NO EVENT SHALL M.I.T. BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF M.I.T. HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMANGE. M.I.T. SPECIFICALLY DISCLAIMS ANY WARRANTIES INCLUDING, BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THE SOFTWARE IS PROVIDED ON AN "AS-IS" BASIS AND M.I.T. HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ int main(int argc, char *argv[]) { int i; char buf[10]; i = 4105; /* BAD */ buf[i] = 'A'; return 0; }
the_stack_data/77695.c
#include <string.h> int strcmp(const char* s1, const char* s2) { size_t i; int diff; int c1; int c2; i = 0; for (;;) { c1 = (unsigned char)(s1[i]); c2 = (unsigned char)(s2[i]); diff = c1 - c2; if (diff) return diff; if (c1 == 0) return 0; i++; } }
the_stack_data/62636520.c
/* * Copyright 2008-2017, Marvell International Ltd. * All Rights Reserved. * * Derived from: * http://www.kernel.org/pub/linux/libs/klibc/ */ /* * mrand48.c */ #include <stdlib.h> #include <stdint.h> /* Common with lrand48.c, srand48.c */ extern unsigned short __rand48_seed[3]; extern long jrand48(unsigned short *); long mrand48(void) { return jrand48(__rand48_seed); }
the_stack_data/117966.c
#include <stdio.h> #include <netdb.h> #include <netinet/in.h> #include <stdlib.h> #include <string.h> #include <sys/socket.h> #include <sys/types.h> #define MAX 80 #define PORT 8080 #define SA struct sockaddr // Function designed for chat between client and server. void func(int sockfd) { char buff[MAX]; int n; // infinite loop for chat for (;;) { bzero(buff, MAX); // read the message from client and copy it in buffer read(sockfd, buff, sizeof(buff)); // print buffer which contains the client contents printf("From client: %s\t To client : ", buff); bzero(buff, MAX); n = 0; // copy server message in the buffer while ((buff[n++] = getchar()) != '\n') ; // and send that buffer to client write(sockfd, buff, sizeof(buff)); // if msg contains "Exit" then server exit and chat ended. if (strncmp("exit", buff, 4) == 0) { printf("Server Exit...\n"); break; } } } // Driver function int main() { int sockfd, connfd, len; struct sockaddr_in servaddr, cli; // socket create and verification sockfd = socket(AF_INET, SOCK_STREAM, 0); if (sockfd == -1) { printf("socket creation failed...\n"); exit(0); } else printf("Socket successfully created..\n"); bzero(&servaddr, sizeof(servaddr)); // assign IP, PORT servaddr.sin_family = AF_INET; servaddr.sin_addr.s_addr = htonl(INADDR_ANY); servaddr.sin_port = htons(PORT); // Binding newly created socket to given IP and verification if ((bind(sockfd, (SA*)&servaddr, sizeof(servaddr))) != 0) { printf("socket bind failed...\n"); exit(0); } else printf("Socket successfully binded..\n"); // Now server is ready to listen and verification if ((listen(sockfd, 5)) != 0) { printf("Listen failed...\n"); exit(0); } else printf("Server listening..\n"); len = sizeof(cli); // Accept the data packet from client and verification connfd = accept(sockfd, (SA*)&cli, &len); if (connfd < 0) { printf("server acccept failed...\n"); exit(0); } else printf("server acccept the client...\n"); // Function for chatting between client and server func(connfd); // After chatting close the socket close(sockfd); }
the_stack_data/118970.c
/* Escreva um programa que faça as formas com asteriscos */ #include<stdio.h> int main(){ int tempoSegundos; printf("*********\n* *\n* *\n* *\n* *\n* *\n* *\n* *\n*********\n"); printf("\n"); printf(" *** \n * * \n* *\n* *\n* *\n* *\n* *\n * * \n *** \n"); printf("\n"); printf(" * \n *** \n ***** \n * \n * \n * \n * \n * \n * \n"); printf("\n"); printf(" * \n * * \n * * \n * * \n* *\n * * \n * * \n * * \n * "); }
the_stack_data/864066.c
/** * @file * * @brief This module configures the MAC Beacon Security * * Copyright (c) 2013-2015 Atmel Corporation. All rights reserved. * * \asf_license_start * * \page License * * 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. The name of Atmel may not be used to endorse or promote products derived * from this software without specific prior written permission. * * 4. This software may only be redistributed and used in connection with an * Atmel microcontroller product. * * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. * * \asf_license_stop * */ /* * Copyright (c) 2014-2015 Atmel Corporation. All rights reserved. * * Licensed under Atmel's Limited License Agreement --> EULA.txt */ /* === INCLUDES ============================================================ */ #ifdef MAC_SECURITY_ZIP #include <string.h> #include <inttypes.h> #include <stdio.h> #include "conf_board.h" #include "avr2025_mac.h" #include "delay.h" #include "common_sw_timer.h" #include "sio2host.h" #include "tal.h" #include "mac_msg_types.h" #include <asf.h> #include "beacon_app.h" #include "stb_generic.h" #include "mac_security.h" /* === MACROS ============================================================== */ /* === GLOBALS ============================================================= */ /** Coordinator IEEE Address */ uint8_t const COORD_IEEE_ADDRESS[] = {0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x00}; /** This array stores all device related information. */ extern associated_device_t device_list[MAX_NUMBER_OF_DEVICES]; /** Stores the number of associated devices. */ extern uint16_t no_of_assoc_devices; /** Current Channel */ extern uint8_t current_channel; /** This array stores the current beacon payload. */ extern uint8_t beacon_payload[BEACON_PAYLOAD_LEN]; /** This variable stores the current state of the node. */ extern coord_state_t coord_state; extern uint8_t current_channel_page; /* * This is implemented as an array of bytes, but actually this is a * 128-bit variable. This is the reason why the array needs to be filled * in in reverse order than expected. */ static const uint8_t default_key[4][16] = { { 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF }, { 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xD0 }, { 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xD1 }, { 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF } }; /* Recently associated device number */ extern uint16_t recent_assoc_dev_no; /* Default key source for MAC Security */ uint8_t default_key_source[8] = {0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; /* Parameter to check the which mlme set confirm callback will currently using **/ static uint8_t mlme_set_conf_run_time; /* === PROTOTYPES ========================================================== */ /* Initialize the security PIB and setting the Security PIB for use by mac * security */ static void init_secuity_pib(uint8_t PIBAttribute, uint8_t PIBAttributeIndex); /* mlme set confirm callback will be used after starting the network */ static void usr_mlme_set_conf_run_time(uint8_t status, uint8_t PIBAttribute, uint8_t PIBAttributeIndex); /* === IMPLEMENTATION ====================================================== */ /** @brief Callback function usr_mlme_set_conf * * @param status Result of requested PIB attribute set operation * @param PIBAttribute Updated PIB attribute * */ void usr_mlme_set_conf(uint8_t status, uint8_t PIBAttribute, uint8_t PIBAttributeIndex) { if (status != MAC_SUCCESS) { /* something went wrong with mlme set request; restart */ wpan_mlme_reset_req(true); } else { if (mlme_set_conf_run_time) { /* post initialization security pib callback */ usr_mlme_set_conf_run_time(status, PIBAttribute, PIBAttributeIndex); } else { /* Initialize the mac security PIB before starting the * network */ init_secuity_pib(PIBAttribute, PIBAttributeIndex); } } /* Keep compiler happy. */ PIBAttributeIndex = PIBAttributeIndex; } /** @brief Initialize the security PIB and set the security parameters * * @param PIBAttribute MAC PIB Attribute type * @param PIBAttributeIndex MAC PIB Attribute Index * */ static void init_secuity_pib(uint8_t PIBAttribute, uint8_t PIBAttributeIndex) { switch (PIBAttribute) { case macDefaultKeySource: { /* Set the no.of security level table entries */ uint8_t mac_sec_level_table_entries = DEFAULT_MAC_SEC_LVL_TABLE_ENTRIES; wpan_mlme_set_req(macSecurityLevelTableEntries, NO_PIB_INDEX, &mac_sec_level_table_entries); } break; case macSecurityLevelTableEntries: { /* set type of frames will be encrypted and decrypted */ uint8_t mac_sec_level_table[4] = { FRAME_TYPE_BEACON, /* * * * *FrameType: * Beacon **/ CMD_FRAME_ID_NA, /* * * * *CommandFrameIdentifier: * N/A */ SECURITY_05_LEVEL, DEV_OVERRIDE_SEC_MIN /* * * * *DeviceOverrideSecurityMinimum: * True **/ }; wpan_mlme_set_req(macSecurityLevelTable, INDEX_1, /* Index: 1 */ &mac_sec_level_table); } break; case macSecurityLevelTable: { if (INDEX_1 == PIBAttributeIndex) { /* set type of frames will be encrypted and decrypted */ uint8_t mac_sec_level_table[4] = { FRAME_TYPE_DATA, /* FrameType: * Beacon */ CMD_FRAME_ID_NA, /* * * * *CommandFrameIdentifier: * N/A */ SECURITY_05_LEVEL, DEV_OVERRIDE_SEC_MIN /* * * * *DeviceOverrideSecurityMinimum: * True */ }; wpan_mlme_set_req(macSecurityLevelTable, INDEX_0, /* Index: 0 */ &mac_sec_level_table); } else if (INDEX_0 == PIBAttributeIndex) { /* set the maximum no.of mac key table entries */ uint8_t mac_key_table_entries = DEFAULT_MAC_KEY_TABLE_ENTRIES; wpan_mlme_set_req(macKeyTableEntries, NO_PIB_INDEX, &mac_key_table_entries); } } break; case macKeyTableEntries: { /* set the maximum no.of device table entries */ uint16_t coord_key_index = DEFAULT_MAC_DEV_TABLE_ENTRIES; wpan_mlme_set_req(macDeviceTableEntries, NO_PIB_INDEX, &coord_key_index); } break; case macDeviceTableEntries: { /* set the default mac key table values */ uint8_t mac_key_table[43] = { default_key_source[0], /* LookupData[0] */ default_key_source[1], /* LookupData[1] */ default_key_source[2], /* LookupData[2] */ default_key_source[3], /* LookupData[3] */ default_key_source[4], /* LookupData[4] */ default_key_source[5], /* LookupData[5] */ default_key_source[6], /* LookupData[6] */ default_key_source[7], /* LookupData[7] */ KEY_INDEX_0, /* LookupData[8] */ LOOKUP_DATA_SIZE_1, /* LookupDataSize: 0x01 : Size 9 * octets */ MAC_ZIP_MAX_KEY_ID_LOOKUP_LIST_ENTRIES, /* * * * *KeyIdLookupListEntries * = 1 */ /* KeyDeviceList[1] */ DEV_DESC_HANDLE_IDX_0, /* DeviceDescriptorHandle **/ true, /* UniqueDevice */ false, /* Blacklisted */ DEV_DESC_HANDLE_IDX_0, /* DeviceDescriptorHandle **/ true, /* UniqueDevice */ false, /* Blacklisted */ DEV_DESC_HANDLE_IDX_0, /* DeviceDescriptorHandle **/ true, /* UniqueDevice */ false, /* Blacklisted */ DEV_DESC_HANDLE_IDX_0, /* * * * *DeviceDescriptorHandle **/ true, /* UniqueDevice */ false, /* Blacklisted */ MAC_ZIP_MAX_KEY_DEV_LIST_ENTRIES, /* * * * *KeyDeviceListEntries **/ /* KeyUsageList */ FRAME_TYPE_BEACON, /* FrameType - Beacon frames */ CMD_FRAME_ID_NA, /* CommandFrameIdentifier not used in * ZIP */ MAC_ZIP_MAX_KEY_USAGE_LIST_ENTRIES, /* * * * *KeyUsageListEntries **/ /* Key */ default_key[3][0], default_key[3][1], default_key[3][2], default_key[3][3], default_key[3][4], default_key[3][5], default_key[3][6], default_key[3][7], default_key[3][8], default_key[3][9], default_key[3][10], default_key[3][11], default_key[3][12], default_key[3][13], default_key[3][14], default_key[3][15], }; wpan_mlme_set_req(macKeyTable, INDEX_3, /* Index: 3 */ &mac_key_table); } break; case macKeyTable: { /* set the default mac key table values */ switch (PIBAttributeIndex) { case INDEX_3: { uint8_t mac_key_table1[43] = { /* KeyIdLookupList[1].LookupData : * macDefaultKeySource || g_Sec_KeyIndex_1 */ default_key_source[0], /* * * * *LookupData[0] **/ default_key_source[1], /* * * * *LookupData[1] **/ default_key_source[2], /* * * * *LookupData[2] **/ default_key_source[3], /* * * * *LookupData[3] **/ default_key_source[4], /* * * * *LookupData[4] **/ default_key_source[5], /* * * * *LookupData[5] **/ default_key_source[6], /* * * * *LookupData[6] **/ default_key_source[7], /* * * * *LookupData[7] **/ KEY_INDEX_1, /* * * * *LookupData[8] **/ LOOKUP_DATA_SIZE_1, /* * * * *LookupDataSize: * * * *0x01 * : * * * *Size * 9 * * * *octets **/ MAC_ZIP_MAX_KEY_ID_LOOKUP_LIST_ENTRIES, /* * * * *KeyIdLookupListEntries * *= * * * *1 **/ /* KeyDeviceList[1] */ EMPTY_DEV_HANDLE, /* * * * *DeviceDescriptorHandle **/ false, /* * * * *UniqueDevice **/ false, /* * * * *Blacklisted **/ EMPTY_DEV_HANDLE, /* * * * *DeviceDescriptorHandle **/ false, /* * * * *UniqueDevice **/ false, /* * * * *Blacklisted **/ EMPTY_DEV_HANDLE, /* * * * *DeviceDescriptorHandle **/ false, /* * * * *UniqueDevice **/ false, /* * * * *Blacklisted **/ EMPTY_DEV_HANDLE, /* * * * *DeviceDescriptorHandle **/ false, /* * * * *UniqueDevice **/ false, /* * * * *Blacklisted **/ MAC_ZIP_MAX_KEY_DEV_LIST_ENTRIES, /* * * * *KeyDeviceListEntries **/ /* KeyUsageList */ FRAME_TYPE_DATA, /* * * * *FrameType * - * * * *Data * * * *frames **/ CMD_FRAME_ID_NA, /* * * * *CommandFrameIdentifier * * * *not * * * *used * * * *in * * * *ZIP **/ MAC_ZIP_MAX_KEY_USAGE_LIST_ENTRIES, /* * * * *KeyUsageListEntries **/ /* Key */ default_key[0][0], default_key[0][1], default_key[0][2], default_key[0][3], default_key[0][4], default_key[0][5], default_key[0][6], default_key[0][7], default_key[0][8], default_key[0][9], default_key[0][10], default_key[0][11], default_key[0][12], default_key[0][13], default_key[0][14], default_key[0][15], }; wpan_mlme_set_req(macKeyTable, INDEX_0, /* Index: 0 */ &mac_key_table1); } break; case INDEX_0: { uint8_t mac_key_table2[43] = { /* KeyIdLookupList[1].LookupData : * macDefaultKeySource || g_Sec_KeyIndex_1 */ default_key_source[0], /* * * * *LookupData[0] **/ default_key_source[1], /* * * * *LookupData[1] **/ default_key_source[2], /* * * * *LookupData[2] **/ default_key_source[3], /* * * * *LookupData[3] **/ default_key_source[4], /* * * * *LookupData[4] **/ default_key_source[5], /* * * * *LookupData[5] **/ default_key_source[6], /* * * * *LookupData[6] **/ default_key_source[7], /* * * * *LookupData[7] **/ KEY_INDEX_2, /* * * * *LookupData[8] **/ LOOKUP_DATA_SIZE_1, /* * * * *LookupDataSize: * * * *0x01 * : * * * *Size * 9 * * * *octets **/ MAC_ZIP_MAX_KEY_ID_LOOKUP_LIST_ENTRIES, /* * * * *KeyIdLookupListEntries * *= * * * *1 **/ /* KeyDeviceList[1] */ EMPTY_DEV_HANDLE, /* * * * *DeviceDescriptorHandle **/ false, /* * * * *UniqueDevice **/ false, /* * * * *Blacklisted **/ EMPTY_DEV_HANDLE, /* * * * *DeviceDescriptorHandle **/ false, /* * * * *UniqueDevice **/ false, /* * * * *Blacklisted **/ EMPTY_DEV_HANDLE, /* * * * *DeviceDescriptorHandle **/ false, /* * * * *UniqueDevice **/ false, /* * * * *Blacklisted **/ EMPTY_DEV_HANDLE, /* * * * *DeviceDescriptorHandle **/ false, /* * * * *UniqueDevice **/ false, /* * * * *Blacklisted **/ MAC_ZIP_MAX_KEY_DEV_LIST_ENTRIES, /* * * * *KeyDeviceListEntries **/ /* KeyUsageList */ FRAME_TYPE_DATA, /* * * * *FrameType * - * * * *Data * * * *frames **/ CMD_FRAME_ID_NA, /* * * * *CommandFrameIdentifier * * * *not * * * *used * * * *in * * * *ZIP **/ MAC_ZIP_MAX_KEY_USAGE_LIST_ENTRIES, /* * * * *KeyUsageListEntries **/ /* Key */ default_key[1][0], default_key[1][1], default_key[1][2], default_key[1][3], default_key[1][4], default_key[1][5], default_key[1][6], default_key[1][7], default_key[1][8], default_key[1][9], default_key[1][10], default_key[1][11], default_key[1][12], default_key[1][13], default_key[1][14], default_key[1][15], }; wpan_mlme_set_req(macKeyTable, INDEX_1, /* Index: 1 */ &mac_key_table2); } break; case INDEX_1: { uint8_t mac_key_table3[43] = { /* KeyIdLookupList[1].LookupData : * macDefaultKeySource || g_Sec_KeyIndex_1 */ default_key_source[0], /* * * * *LookupData[0] **/ default_key_source[1], /* * * * *LookupData[1] **/ default_key_source[2], /* * * * *LookupData[2] **/ default_key_source[3], /* * * * *LookupData[3] **/ default_key_source[4], /* * * * *LookupData[4] **/ default_key_source[5], /* * * * *LookupData[5] **/ default_key_source[6], /* * * * *LookupData[6] **/ default_key_source[7], /* * * * *LookupData[7] **/ KEY_INDEX_3, /* * * * *LookupData[8] **/ LOOKUP_DATA_SIZE_1, /* * * * *LookupDataSize: * 0x01 : * Size 9 * octets */ MAC_ZIP_MAX_KEY_ID_LOOKUP_LIST_ENTRIES, /* * * * *KeyIdLookupListEntries * *= * * * *1 **/ /* KeyDeviceList[1] */ EMPTY_DEV_HANDLE, /* * * * *DeviceDescriptorHandle **/ false, /* * * * *UniqueDevice **/ false, /* * * * *Blacklisted **/ EMPTY_DEV_HANDLE, /* * * * *DeviceDescriptorHandle **/ false, /* * * * *UniqueDevice **/ false, /* * * * *Blacklisted **/ EMPTY_DEV_HANDLE, /* * * * *DeviceDescriptorHandle **/ false, /* * * * *UniqueDevice **/ false, /* * * * *Blacklisted **/ EMPTY_DEV_HANDLE, /* * * * *DeviceDescriptorHandle **/ false, /* * * * *UniqueDevice **/ false, /* * * * *Blacklisted **/ MAC_ZIP_MAX_KEY_DEV_LIST_ENTRIES, /* * * * *KeyDeviceListEntries **/ /* KeyUsageList */ FRAME_TYPE_DATA, /* FrameType * - Data * frames */ CMD_FRAME_ID_NA, /* * * * *CommandFrameIdentifier * not used * in ZIP */ MAC_ZIP_MAX_KEY_USAGE_LIST_ENTRIES, /* * * * *KeyUsageListEntries **/ /* Key */ default_key[2][0], default_key[2][1], default_key[2][2], default_key[2][3], default_key[2][4], default_key[2][5], default_key[2][6], default_key[2][7], default_key[2][8], default_key[2][9], default_key[2][10], default_key[2][11], default_key[2][12], default_key[2][13], default_key[2][14], default_key[2][15], }; wpan_mlme_set_req(macKeyTable, INDEX_2, /* * * * *Index: * 2 **/ &mac_key_table3); } break; case INDEX_2: { /** set the coordinator IEEE Address and default PAN ID * into the MAC Device table */ uint8_t coord_dev_index = 3; uint8_t mac_dev_table[17]; mac_dev_table[0] = (uint8_t)DEFAULT_PAN_ID; mac_dev_table[1] = (uint8_t)(DEFAULT_PAN_ID >> 8); mac_dev_table[2] = (uint8_t)COORD_SHORT_ADDR; mac_dev_table[3] = (uint8_t)(COORD_SHORT_ADDR >> 8); mac_dev_table[4] = COORD_IEEE_ADDRESS[7]; mac_dev_table[5] = COORD_IEEE_ADDRESS[6]; mac_dev_table[6] = COORD_IEEE_ADDRESS[5]; mac_dev_table[7] = COORD_IEEE_ADDRESS[4]; mac_dev_table[8] = COORD_IEEE_ADDRESS[3]; mac_dev_table[9] = COORD_IEEE_ADDRESS[2]; mac_dev_table[10] = COORD_IEEE_ADDRESS[1]; mac_dev_table[11] = COORD_IEEE_ADDRESS[0]; mac_dev_table[12] = 0; /* Frame counter **/ mac_dev_table[13] = 0; mac_dev_table[14] = 0; mac_dev_table[15] = 0; mac_dev_table[16] = 0; /* Exempt */ wpan_mlme_set_req(macDeviceTable, coord_dev_index, /* * * * *Index **/ &mac_dev_table); } break; default: break; } } break; case macDeviceTable: { /* Set the PAN Coordinator Extended Address */ uint8_t pan_coord_add[8]; pan_coord_add[0] = COORD_IEEE_ADDRESS[7]; pan_coord_add[1] = COORD_IEEE_ADDRESS[6]; pan_coord_add[2] = COORD_IEEE_ADDRESS[5]; pan_coord_add[3] = COORD_IEEE_ADDRESS[4]; pan_coord_add[4] = COORD_IEEE_ADDRESS[3]; pan_coord_add[5] = COORD_IEEE_ADDRESS[2]; pan_coord_add[6] = COORD_IEEE_ADDRESS[1]; pan_coord_add[7] = COORD_IEEE_ADDRESS[0]; wpan_mlme_set_req(macPANCoordExtendedAddress, NO_PIB_INDEX, /* * * * *Index **/ pan_coord_add); } break; case macPANCoordExtendedAddress: { /* Set the PAN Coordinator IEEE Address */ uint8_t pan_coord_add[8]; pan_coord_add[0] = COORD_IEEE_ADDRESS[7]; pan_coord_add[1] = COORD_IEEE_ADDRESS[6]; pan_coord_add[2] = COORD_IEEE_ADDRESS[5]; pan_coord_add[3] = COORD_IEEE_ADDRESS[4]; pan_coord_add[4] = COORD_IEEE_ADDRESS[3]; pan_coord_add[5] = COORD_IEEE_ADDRESS[2]; pan_coord_add[6] = COORD_IEEE_ADDRESS[1]; pan_coord_add[7] = COORD_IEEE_ADDRESS[0]; wpan_mlme_set_req(macIeeeAddress, NO_PIB_INDEX, /* Index */ pan_coord_add); } break; case macIeeeAddress: { /* Set the PAN Coordinator Short Address */ uint16_t short_add = COORD_SHORT_ADDR; wpan_mlme_set_req(macPANCoordShortAddress, NO_PIB_INDEX, /* * * * *Index **/ &short_add); } break; case macPANCoordShortAddress: { /* Set the PAN Coordinator Short Address */ uint8_t short_addr[2]; short_addr[0] = (uint8_t)COORD_SHORT_ADDR; /* low byte **/ short_addr[1] = (uint8_t)(COORD_SHORT_ADDR >> 8); /* * * * *high * * * *byte **/ wpan_mlme_set_req(macShortAddress, NO_PIB_INDEX, short_addr); mlme_set_conf_run_time = true; } break; default: break; } } /* * @brief Callback function usr_mlme_set_conf will be used after starting the * network * * @param status Result of requested PIB attribute set operation * @param PIBAttribute Updated PIB attribute * */ static void usr_mlme_set_conf_run_time(uint8_t status, uint8_t PIBAttribute, uint8_t PIBAttributeIndex) { if (status != MAC_SUCCESS) { /* something went wrong at mlme set request; restart */ wpan_mlme_reset_req(true); } else { switch (PIBAttribute) { case macShortAddress: { /* set the mac association permission */ uint8_t association_permit = true; wpan_mlme_set_req(macAssociationPermit, NO_PIB_INDEX, &association_permit); } break; case macAssociationPermit: { /* Set the MAC Rx on when Idle */ bool rx_on_when_idle = true; wpan_mlme_set_req(macRxOnWhenIdle, NO_PIB_INDEX, &rx_on_when_idle); } break; case macRxOnWhenIdle: { /* Set the beacon payload length. */ uint8_t beacon_payload_len = BEACON_PAYLOAD_LEN; wpan_mlme_set_req(macBeaconPayloadLength, NO_PIB_INDEX, &beacon_payload_len); } break; case macBeaconPayloadLength: { /* * Once the length of the beacon payload has been * defined, * set the actual beacon payload. */ wpan_mlme_set_req(macBeaconPayload, NO_PIB_INDEX, &beacon_payload); } break; case macBeaconPayload: { if (COORD_STARTING == coord_state) { /* * Initiate an active scan over all channels to * determine * which channel to use. * Use: bool wpan_mlme_scan_req(uint8_t * ScanType, * uint32_t * ScanChannels, * uint8_t * ScanDuration, * uint8_t * ChannelPage); * * This request leads to a scan confirm message *-> * usr_mlme_scan_conf * Scan for about 50 ms on each channel -> * ScanDuration *= 1 * Scan for about 1/2 second on each channel -> * ScanDuration = 5 * Scan for about 1 second on each channel -> * ScanDuration = 6 */ wpan_mlme_scan_req(MLME_SCAN_TYPE_ACTIVE, SCAN_CHANNEL(current_channel), SCAN_DURATION_COORDINATOR, current_channel_page); } } break; case macDefaultKeySource: { /* set the maximum no.of mac security level table * entries */ uint8_t mac_sec_level_table_entries = DEFAULT_MAC_SEC_LVL_TABLE_ENTRIES; wpan_mlme_set_req(macSecurityLevelTableEntries, NO_PIB_INDEX, &mac_sec_level_table_entries); } break; case macSecurityLevelTableEntries: { /* set the mac security level table for the MAC Data * Security */ uint8_t mac_sec_level_table[4] = {FRAME_TYPE_DATA, /* * * * *FrameType: * * * *Data **/ CMD_FRAME_ID_NA, /* * * * *CommandFrameIdentifier: * * * *N/A **/ /* ZIP_SEC_MIN, * // * SecurityMinimum: 5 **/ 0X05, DEV_OVERRIDE_SEC_MIN /* * * * *DeviceOverrideSecurityMinimum: * * * *True **/ }; wpan_mlme_set_req(macSecurityLevelTable, INDEX_0, /* Index: 0 */ &mac_sec_level_table); } break; case macSecurityLevelTable: { /* set the maximum no.of key table entries */ uint8_t mac_key_table_entries = DEFAULT_MAC_KEY_TABLE_ENTRIES; wpan_mlme_set_req(macKeyTableEntries, NO_PIB_INDEX, &mac_key_table_entries); } break; case macKeyTableEntries: { /* MAC Beacon Frame type default mac key table values */ uint8_t mac_key_table[43] = { default_key_source[0], /* * * * *LookupData[0] **/ default_key_source[1], /* * * * *LookupData[1] **/ default_key_source[2], /* * * * *LookupData[2] **/ default_key_source[3], /* * * * *LookupData[3] **/ default_key_source[4], /* * * * *LookupData[4] **/ default_key_source[5], /* * * * *LookupData[5] **/ default_key_source[6], /* * * * *LookupData[6] **/ default_key_source[7], /* * * * *LookupData[7] **/ KEY_INDEX_0, /* * * * *LookupData[8] **/ LOOKUP_DATA_SIZE_1, /* * * * *LookupDataSize: * 0x01 : * Size 9 * octets */ MAC_ZIP_MAX_KEY_ID_LOOKUP_LIST_ENTRIES, /* * * * *KeyIdLookupListEntries * *= * * * *1 **/ /* KeyDeviceList[1] */ DEV_DESC_HANDLE_IDX_0, /* * * * *DeviceDescriptorHandle **/ true, /* * * * *UniqueDevice **/ false, /* * * * *Blacklisted **/ DEV_DESC_HANDLE_IDX_0, /* * * * *DeviceDescriptorHandle **/ true, /* * * * *UniqueDevice **/ false, /* * * * *Blacklisted **/ DEV_DESC_HANDLE_IDX_0, /* * * * *DeviceDescriptorHandle **/ true, /* * * * *UniqueDevice **/ false, /* * * * *Blacklisted **/ DEV_DESC_HANDLE_IDX_0, /* * * * *DeviceDescriptorHandle **/ true, /* * * * *UniqueDevice **/ false, /* * * * *Blacklisted **/ MAC_ZIP_MAX_KEY_DEV_LIST_ENTRIES, /* * * * *KeyDeviceListEntries **/ /* KeyUsageList */ FRAME_TYPE_BEACON, /* * * * *FrameType * - * Beacon * frames **/ CMD_FRAME_ID_NA, /* * * * *CommandFrameIdentifier * not used * in ZIP */ MAC_ZIP_MAX_KEY_USAGE_LIST_ENTRIES, /* * * * *KeyUsageListEntries **/ /* Key */ default_key[3][0], default_key[3][1], default_key[3][2], default_key[3][3], default_key[3][4], default_key[3][5], default_key[3][6], default_key[3][7], default_key[3][8], default_key[3][9], default_key[3][10], default_key[3][11], default_key[3][12], default_key[3][13], default_key[3][14], default_key[3][15], }; wpan_mlme_set_req(macKeyTable, INDEX_3, /* Index: 3 */ &mac_key_table); } break; case macKeyTable: /* * Setting of PIB attributes will continue once a device * has associated successful. */ break; case macDeviceTableEntries: { /* MAC Device Table entries for the recently associated * device */ static uint8_t Temp = 0; uint8_t mac_dev_table[17]; /* Temp is used to not update the already device table * again */ for (uint16_t i = Temp; i < no_of_assoc_devices; i++) { mac_dev_table[0] = (uint8_t)(DEFAULT_PAN_ID & 0x00FF); mac_dev_table[1] = (uint8_t)(DEFAULT_PAN_ID >> 8); mac_dev_table[2] = (uint8_t)device_list[i].short_addr; mac_dev_table[3] = (uint8_t)(device_list[i].short_addr >> 8); mac_dev_table[4] = (uint8_t)device_list[i].ieee_addr; mac_dev_table[5] = (uint8_t)(device_list[i].ieee_addr >> 8); mac_dev_table[6] = (uint8_t)(device_list[i].ieee_addr >> 16); mac_dev_table[7] = (uint8_t)(device_list[i].ieee_addr >> 24); mac_dev_table[8] = (uint8_t)(device_list[i].ieee_addr >> 32); mac_dev_table[9] = (uint8_t)(device_list[i].ieee_addr >> 40); mac_dev_table[10] = (uint8_t)(device_list[i].ieee_addr >> 48); mac_dev_table[11] = (uint8_t)(device_list[i].ieee_addr >> 56); mac_dev_table[12] = 0; /* Initial Frame * counter value */ mac_dev_table[13] = 0; mac_dev_table[14] = 0; mac_dev_table[15] = 0; mac_dev_table[16] = 0; /* Exempt */ wpan_mlme_set_req(macDeviceTable, i, /* Index */ &mac_dev_table); } Temp++; } break; case macDeviceTable: { /* Use DSN start value as in ZIP test spec. */ uint8_t new_dsn = 0x0; wpan_mlme_set_req(macDSN, NO_PIB_INDEX, &new_dsn); } break; case macDSN: { /* Use DSN start value as in ZIP test spec. */ uint32_t frame_counter = 1; wpan_mlme_set_req(macFrameCounter, NO_PIB_INDEX, &frame_counter); } break; case macFrameCounter: break; default: /* undesired PIB attribute set request; restart */ wpan_mlme_reset_req(true); break; } } /* Keep compiler happy. */ PIBAttributeIndex = PIBAttributeIndex; } #endif
the_stack_data/154829657.c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* main.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: fsoares- <[email protected]> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2021/12/20 20:06:11 by fsoares- #+# #+# */ /* Updated: 2021/12/21 07:19:06 by fsoares- ### ########.fr */ /* */ /* ************************************************************************** */ #include <stdio.h> #include <limits.h> int ft_atoi_base(char *nbr, char *base); int main(void) { int res; int expected; printf("42:%d\n", ft_atoi_base("2a", "0123456789abcdef")); printf("-42:%d\n", ft_atoi_base(" --------+-2a", "0123456789abcdef")); printf("42:%d\n", ft_atoi_base(" -+-2a", "0123456789abcdef")); printf("0:%d\n", ft_atoi_base(" --------+- 2a", "0123456789abcdef")); printf("0:%d\n", ft_atoi_base(" --------+-g", "0123456789abcdef")); printf("0:%d\n", ft_atoi_base(" --------+-2a", "")); printf("0:%d\n", ft_atoi_base(" --------+-2a", "0")); printf("0:%d\n", ft_atoi_base(" --------+-2a", "+-0")); printf("0:%d\n", ft_atoi_base(" --------+-2a", "\t01")); res = ft_atoi_base(" \v7fffffff", "0123456789abcdef"); printf("%d : %d (equals: %i)\n", INT_MAX, res, INT_MAX == res); res = ft_atoi_base(" \f-80000000", "0123456789abcdef"); printf("%d : %d (equals: %i)\n", INT_MIN, res, INT_MIN == res); res = ft_atoi_base("ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZXEFnoY$", "ZYXWVUTSRQPONMLKJIHGFEDCBAzyxwvutsrqponmlkjihgfedcba9876543210"); printf("%d : %d (equals: %i)\n", INT_MAX, res, INT_MAX == res); res = ft_atoi_base("-~~~~~~~~'~~~~~~'~'~~~'''''''~~'$", "'~"); expected = -2143247366; printf("%d : %d (equals: %i)\n", expected, res, expected == res); }
the_stack_data/243892779.c
/* SSE_Tutorial This tutorial was written for supercomputingblog.com This tutorial may be freely redistributed provided this header remains intact http://supercomputingblog.com/optimization/getting-started-with-sse-programming/ */ #include <stdio.h> #include <stdlib.h> #include <time.h> #include <math.h> // Needed for sqrt in CPU-only version #include <x86intrin.h> //#define TIME_SSE // Define this if you want to run with SSE //#define USE_DIVISION_METHOD //#define USE_FAST_METHOD int main(int argc, char* argv[]) { printf("Starting calculation...\n"); unsigned i, stress; const int length = 64000; // We will be calculating Y = Sin(x) / x, for x = 1->64000 // If you do not properly align your data for SSE instructions, you may take a huge performance hit. float *pResult = (float*) _mm_malloc(length * sizeof(float), 16); // align to 16-byte for SSE __m128 x; __m128 xDelta = _mm_set1_ps(4.0f); // Set the xDelta to (4,4,4,4) __m128 *pResultSSE = (__m128*) pResult; const unsigned SSELength = length / 4; double start=0.0, stop=0.0, msecs; struct timeval before, after; gettimeofday(&before, NULL); for (stress = 0; stress < 100000; stress++) // lots of stress loops so we can easily use a stopwatch { #ifdef TIME_SSE x = _mm_set_ps(4.0f, 3.0f, 2.0f, 1.0f); // Set the initial values of x to (4,3,2,1) for (i=0; i < SSELength; i++) { __m128 xSqrt = _mm_sqrt_ps(x); // Note! Division is slow. It's actually faster to take the reciprocal of a number and multiply // Also note that Division is more accurate than taking the reciprocal and multiplying #ifdef USE_FAST_METHOD __m128 xRecip = _mm_rcp_ps(x); pResultSSE[i] = _mm_mul_ps(xRecip, xSqrt); #endif //USE_FAST_METHOD #ifdef USE_DIVISION_METHOD pResultSSE[i] = _mm_div_ps(xSqrt, x); #endif // USE_DIVISION_METHOD // NOTE! Sometimes, the order in which things are done in SSE may seem reversed. // When the command above executes, the four floating elements are actually flipped around // We have already compensated for that flipping by setting the initial x vector to (4,3,2,1) instead of (1,2,3,4) x = _mm_add_ps(x, xDelta); // Advance x to the next set of numbers } #endif // TIME_SSE #ifndef TIME_SSE float xFloat = 1.0f; for (i=0 ; i < length; i++) { pResult[i] = sqrt(xFloat) / xFloat; // Even though division is slow, there are no intrinsic functions like there are in SSE xFloat += 1.0f; } #endif // !TIME_SSE } gettimeofday(&after, NULL); msecs = (after.tv_sec - before.tv_sec)*1000.0 + (after.tv_usec - before.tv_usec)/1000.0; printf("Execution time = %2.3lf ms\n", msecs); // To prove that the program actually worked for (i=0; i < 20; i++) { printf("Result[%d] = %f\n", i, pResult[i]); } // Results for my particular system // 23.75 seconds for SSE with reciprocal/multiplication method // 38.5 seconds for SSE with division method // 301.5 seconds for CPU return 0; }
the_stack_data/140764985.c
/* * Copyright (c) 2008 Voltaire, Inc. All rights reserved. * Copyright (c) 2007 The Regents of the University of California. * * 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 * OpenIB.org 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. * */ #if HAVE_CONFIG_H # include <config.h> #endif /* HAVE_CONFIG_H */ #ifdef ENABLE_OSM_PERF_MGR #include <stdlib.h> #include <errno.h> #include <limits.h> #include <dlfcn.h> #include <sys/stat.h> #include <opensm/osm_perfmgr_db.h> #include <opensm/osm_perfmgr.h> #include <opensm/osm_opensm.h> /** ========================================================================= */ perfmgr_db_t *perfmgr_db_construct(osm_perfmgr_t *perfmgr) { perfmgr_db_t *db = malloc(sizeof(*db)); if (!db) return (NULL); cl_qmap_init(&(db->pc_data)); cl_plock_construct(&(db->lock)); cl_plock_init(&(db->lock)); db->perfmgr = perfmgr; return ((void *)db); } /** ========================================================================= */ void perfmgr_db_destroy(perfmgr_db_t * db) { if (db) { cl_plock_destroy(&(db->lock)); free(db); } } /********************************************************************** * Internal call db->lock should be held when calling **********************************************************************/ static inline _db_node_t *_get(perfmgr_db_t * db, uint64_t guid) { cl_map_item_t *rc = cl_qmap_get(&(db->pc_data), guid); const cl_map_item_t *end = cl_qmap_end(&(db->pc_data)); if (rc == end) return (NULL); return ((_db_node_t *) rc); } static inline perfmgr_db_err_t bad_node_port(_db_node_t * node, uint8_t port) { if (!node) return (PERFMGR_EVENT_DB_GUIDNOTFOUND); if (port == 0 || port >= node->num_ports) return (PERFMGR_EVENT_DB_PORTNOTFOUND); return (PERFMGR_EVENT_DB_SUCCESS); } /** ========================================================================= */ static _db_node_t *__malloc_node(uint64_t guid, uint8_t num_ports, char *name) { int i = 0; time_t cur_time = 0; _db_node_t *rc = malloc(sizeof(*rc)); if (!rc) return (NULL); rc->ports = calloc(num_ports, sizeof(_db_port_t)); if (!rc->ports) goto free_rc; rc->num_ports = num_ports; rc->node_guid = guid; cur_time = time(NULL); for (i = 0; i < num_ports; i++) { rc->ports[i].last_reset = cur_time; rc->ports[i].err_previous.time = cur_time; rc->ports[i].dc_previous.time = cur_time; } snprintf(rc->node_name, NODE_NAME_SIZE, "%s", name); return (rc); free_rc: free(rc); return (NULL); } /** ========================================================================= */ static void __free_node(_db_node_t * node) { if (!node) return; if (node->ports) free(node->ports); free(node); } /* insert nodes to the database */ static perfmgr_db_err_t __insert(perfmgr_db_t * db, _db_node_t * node) { cl_map_item_t *rc = cl_qmap_insert(&(db->pc_data), node->node_guid, (cl_map_item_t *) node); if ((void *)rc != (void *)node) return (PERFMGR_EVENT_DB_FAIL); return (PERFMGR_EVENT_DB_SUCCESS); } /********************************************************************** **********************************************************************/ perfmgr_db_err_t perfmgr_db_create_entry(perfmgr_db_t * db, uint64_t guid, uint8_t num_ports, char *name) { perfmgr_db_err_t rc = PERFMGR_EVENT_DB_SUCCESS; cl_plock_excl_acquire(&(db->lock)); if (!_get(db, guid)) { _db_node_t *pc_node = __malloc_node(guid, num_ports, name); if (!pc_node) { rc = PERFMGR_EVENT_DB_NOMEM; goto Exit; } if (__insert(db, pc_node)) { __free_node(pc_node); rc = PERFMGR_EVENT_DB_FAIL; goto Exit; } } Exit: cl_plock_release(&(db->lock)); return (rc); } /********************************************************************** * Dump a reading vs the previous reading to stdout **********************************************************************/ static inline void debug_dump_err_reading(perfmgr_db_t * db, uint64_t guid, uint8_t port_num, _db_port_t * port, perfmgr_db_err_reading_t * cur) { osm_log_t *log = db->perfmgr->log; if (!osm_log_is_active(log, OSM_LOG_DEBUG)) return; /* optimize this a bit */ osm_log(log, OSM_LOG_DEBUG, "GUID 0x%" PRIx64 " Port %u:\n", guid, port_num); osm_log(log, OSM_LOG_DEBUG, "sym %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n", cur->symbol_err_cnt, port->err_previous.symbol_err_cnt, port->err_total.symbol_err_cnt); osm_log(log, OSM_LOG_DEBUG, "ler %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n", cur->link_err_recover, port->err_previous.link_err_recover, port->err_total.link_err_recover); osm_log(log, OSM_LOG_DEBUG, "ld %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n", cur->link_downed, port->err_previous.link_downed, port->err_total.link_downed); osm_log(log, OSM_LOG_DEBUG, "re %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n", cur->rcv_err, port->err_previous.rcv_err, port->err_total.rcv_err); osm_log(log, OSM_LOG_DEBUG, "rrp %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n", cur->rcv_rem_phys_err, port->err_previous.rcv_rem_phys_err, port->err_total.rcv_rem_phys_err); osm_log(log, OSM_LOG_DEBUG, "rsr %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n", cur->rcv_switch_relay_err, port->err_previous.rcv_switch_relay_err, port->err_total.rcv_switch_relay_err); osm_log(log, OSM_LOG_DEBUG, "xd %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n", cur->xmit_discards, port->err_previous.xmit_discards, port->err_total.xmit_discards); osm_log(log, OSM_LOG_DEBUG, "xce %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n", cur->xmit_constraint_err, port->err_previous.xmit_constraint_err, port->err_total.xmit_constraint_err); osm_log(log, OSM_LOG_DEBUG, "rce %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n", cur->rcv_constraint_err, port->err_previous.rcv_constraint_err, port->err_total.rcv_constraint_err); osm_log(log, OSM_LOG_DEBUG, "li %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n", cur->link_integrity, port->err_previous.link_integrity, port->err_total.link_integrity); osm_log(log, OSM_LOG_DEBUG, "bo %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n", cur->buffer_overrun, port->err_previous.buffer_overrun, port->err_total.buffer_overrun); osm_log(log, OSM_LOG_DEBUG, "vld %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n", cur->vl15_dropped, port->err_previous.vl15_dropped, port->err_total.vl15_dropped); } /********************************************************************** * perfmgr_db_err_reading_t functions **********************************************************************/ perfmgr_db_err_t perfmgr_db_add_err_reading(perfmgr_db_t * db, uint64_t guid, uint8_t port, perfmgr_db_err_reading_t * reading) { _db_port_t *p_port = NULL; _db_node_t *node = NULL; perfmgr_db_err_reading_t *previous = NULL; perfmgr_db_err_t rc = PERFMGR_EVENT_DB_SUCCESS; osm_epi_pe_event_t epi_pe_data; cl_plock_excl_acquire(&(db->lock)); node = _get(db, guid); if ((rc = bad_node_port(node, port)) != PERFMGR_EVENT_DB_SUCCESS) goto Exit; p_port = &(node->ports[port]); previous = &(node->ports[port].err_previous); debug_dump_err_reading(db, guid, port, p_port, reading); epi_pe_data.time_diff_s = (reading->time - previous->time); osm_epi_create_port_id(&(epi_pe_data.port_id), guid, port, node->node_name); /* calculate changes from previous reading */ epi_pe_data.symbol_err_cnt = (reading->symbol_err_cnt - previous->symbol_err_cnt); p_port->err_total.symbol_err_cnt += epi_pe_data.symbol_err_cnt; epi_pe_data.link_err_recover = (reading->link_err_recover - previous->link_err_recover); p_port->err_total.link_err_recover += epi_pe_data.link_err_recover; epi_pe_data.link_downed = (reading->link_downed - previous->link_downed); p_port->err_total.link_downed += epi_pe_data.link_downed; epi_pe_data.rcv_err = (reading->rcv_err - previous->rcv_err); p_port->err_total.rcv_err += epi_pe_data.rcv_err; epi_pe_data.rcv_rem_phys_err = (reading->rcv_rem_phys_err - previous->rcv_rem_phys_err); p_port->err_total.rcv_rem_phys_err += epi_pe_data.rcv_rem_phys_err; epi_pe_data.rcv_switch_relay_err = (reading->rcv_switch_relay_err - previous->rcv_switch_relay_err); p_port->err_total.rcv_switch_relay_err += epi_pe_data.rcv_switch_relay_err; epi_pe_data.xmit_discards = (reading->xmit_discards - previous->xmit_discards); p_port->err_total.xmit_discards += epi_pe_data.xmit_discards; epi_pe_data.xmit_constraint_err = (reading->xmit_constraint_err - previous->xmit_constraint_err); p_port->err_total.xmit_constraint_err += epi_pe_data.xmit_constraint_err; epi_pe_data.rcv_constraint_err = (reading->rcv_constraint_err - previous->rcv_constraint_err); p_port->err_total.rcv_constraint_err += epi_pe_data.rcv_constraint_err; epi_pe_data.link_integrity = (reading->link_integrity - previous->link_integrity); p_port->err_total.link_integrity += epi_pe_data.link_integrity; epi_pe_data.buffer_overrun = (reading->buffer_overrun - previous->buffer_overrun); p_port->err_total.buffer_overrun += epi_pe_data.buffer_overrun; epi_pe_data.vl15_dropped = (reading->vl15_dropped - previous->vl15_dropped); p_port->err_total.vl15_dropped += epi_pe_data.vl15_dropped; p_port->err_previous = *reading; osm_opensm_report_event(db->perfmgr->osm, OSM_EVENT_ID_PORT_ERRORS, &epi_pe_data); Exit: cl_plock_release(&(db->lock)); return (rc); } perfmgr_db_err_t perfmgr_db_get_prev_err(perfmgr_db_t * db, uint64_t guid, uint8_t port, perfmgr_db_err_reading_t * reading) { _db_node_t *node = NULL; perfmgr_db_err_t rc = PERFMGR_EVENT_DB_SUCCESS; cl_plock_acquire(&(db->lock)); node = _get(db, guid); if ((rc = bad_node_port(node, port)) != PERFMGR_EVENT_DB_SUCCESS) goto Exit; *reading = node->ports[port].err_previous; Exit: cl_plock_release(&(db->lock)); return (rc); } perfmgr_db_err_t perfmgr_db_clear_prev_err(perfmgr_db_t * db, uint64_t guid, uint8_t port) { _db_node_t *node = NULL; perfmgr_db_err_reading_t *previous = NULL; perfmgr_db_err_t rc = PERFMGR_EVENT_DB_SUCCESS; cl_plock_excl_acquire(&(db->lock)); node = _get(db, guid); if ((rc = bad_node_port(node, port)) != PERFMGR_EVENT_DB_SUCCESS) goto Exit; previous = &(node->ports[port].err_previous); memset(previous, 0, sizeof(*previous)); node->ports[port].err_previous.time = time(NULL); Exit: cl_plock_release(&(db->lock)); return (rc); } static inline void debug_dump_dc_reading(perfmgr_db_t * db, uint64_t guid, uint8_t port_num, _db_port_t * port, perfmgr_db_data_cnt_reading_t * cur) { osm_log_t *log = db->perfmgr->log; if (!osm_log_is_active(log, OSM_LOG_DEBUG)) return; /* optimize this a big */ osm_log(log, OSM_LOG_DEBUG, "xd %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n", cur->xmit_data, port->dc_previous.xmit_data, port->dc_total.xmit_data); osm_log(log, OSM_LOG_DEBUG, "rd %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n", cur->rcv_data, port->dc_previous.rcv_data, port->dc_total.rcv_data); osm_log(log, OSM_LOG_DEBUG, "xp %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n", cur->xmit_pkts, port->dc_previous.xmit_pkts, port->dc_total.xmit_pkts); osm_log(log, OSM_LOG_DEBUG, "rp %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n", cur->rcv_pkts, port->dc_previous.rcv_pkts, port->dc_total.rcv_pkts); } /********************************************************************** * perfmgr_db_data_cnt_reading_t functions **********************************************************************/ perfmgr_db_err_t perfmgr_db_add_dc_reading(perfmgr_db_t * db, uint64_t guid, uint8_t port, perfmgr_db_data_cnt_reading_t * reading) { _db_port_t *p_port = NULL; _db_node_t *node = NULL; perfmgr_db_data_cnt_reading_t *previous = NULL; perfmgr_db_err_t rc = PERFMGR_EVENT_DB_SUCCESS; osm_epi_dc_event_t epi_dc_data; cl_plock_excl_acquire(&(db->lock)); node = _get(db, guid); if ((rc = bad_node_port(node, port)) != PERFMGR_EVENT_DB_SUCCESS) goto Exit; p_port = &(node->ports[port]); previous = &(node->ports[port].dc_previous); debug_dump_dc_reading(db, guid, port, p_port, reading); epi_dc_data.time_diff_s = (reading->time - previous->time); osm_epi_create_port_id(&(epi_dc_data.port_id), guid, port, node->node_name); /* calculate changes from previous reading */ epi_dc_data.xmit_data = (reading->xmit_data - previous->xmit_data); p_port->dc_total.xmit_data += epi_dc_data.xmit_data; epi_dc_data.rcv_data = (reading->rcv_data - previous->rcv_data); p_port->dc_total.rcv_data += epi_dc_data.rcv_data; epi_dc_data.xmit_pkts = (reading->xmit_pkts - previous->xmit_pkts); p_port->dc_total.xmit_pkts += epi_dc_data.xmit_pkts; epi_dc_data.rcv_pkts = (reading->rcv_pkts - previous->rcv_pkts); p_port->dc_total.rcv_pkts += epi_dc_data.rcv_pkts; epi_dc_data.unicast_xmit_pkts = (reading->unicast_xmit_pkts - previous->unicast_xmit_pkts); p_port->dc_total.unicast_xmit_pkts += epi_dc_data.unicast_xmit_pkts; epi_dc_data.unicast_rcv_pkts = (reading->unicast_rcv_pkts - previous->unicast_rcv_pkts); p_port->dc_total.unicast_rcv_pkts += epi_dc_data.unicast_rcv_pkts; epi_dc_data.multicast_xmit_pkts = (reading->multicast_xmit_pkts - previous->multicast_xmit_pkts); p_port->dc_total.multicast_xmit_pkts += epi_dc_data.multicast_xmit_pkts; epi_dc_data.multicast_rcv_pkts = (reading->multicast_rcv_pkts - previous->multicast_rcv_pkts); p_port->dc_total.multicast_rcv_pkts += epi_dc_data.multicast_rcv_pkts; p_port->dc_previous = *reading; osm_opensm_report_event(db->perfmgr->osm, OSM_EVENT_ID_PORT_DATA_COUNTERS, &epi_dc_data); Exit: cl_plock_release(&(db->lock)); return (rc); } perfmgr_db_err_t perfmgr_db_get_prev_dc(perfmgr_db_t * db, uint64_t guid, uint8_t port, perfmgr_db_data_cnt_reading_t * reading) { _db_node_t *node = NULL; perfmgr_db_err_t rc = PERFMGR_EVENT_DB_SUCCESS; cl_plock_acquire(&(db->lock)); node = _get(db, guid); if ((rc = bad_node_port(node, port)) != PERFMGR_EVENT_DB_SUCCESS) goto Exit; *reading = node->ports[port].dc_previous; Exit: cl_plock_release(&(db->lock)); return (rc); } perfmgr_db_err_t perfmgr_db_clear_prev_dc(perfmgr_db_t * db, uint64_t guid, uint8_t port) { _db_node_t *node = NULL; perfmgr_db_data_cnt_reading_t *previous = NULL; perfmgr_db_err_t rc = PERFMGR_EVENT_DB_SUCCESS; cl_plock_excl_acquire(&(db->lock)); node = _get(db, guid); if ((rc = bad_node_port(node, port)) != PERFMGR_EVENT_DB_SUCCESS) goto Exit; previous = &(node->ports[port].dc_previous); memset(previous, 0, sizeof(*previous)); node->ports[port].dc_previous.time = time(NULL); Exit: cl_plock_release(&(db->lock)); return (rc); } static void __clear_counters(cl_map_item_t * const p_map_item, void *context) { _db_node_t *node = (_db_node_t *) p_map_item; int i = 0; time_t ts = time(NULL); for (i = 0; i < node->num_ports; i++) { node->ports[i].err_total.symbol_err_cnt = 0; node->ports[i].err_total.link_err_recover = 0; node->ports[i].err_total.link_downed = 0; node->ports[i].err_total.rcv_err = 0; node->ports[i].err_total.rcv_rem_phys_err = 0; node->ports[i].err_total.rcv_switch_relay_err = 0; node->ports[i].err_total.xmit_discards = 0; node->ports[i].err_total.xmit_constraint_err = 0; node->ports[i].err_total.rcv_constraint_err = 0; node->ports[i].err_total.link_integrity = 0; node->ports[i].err_total.buffer_overrun = 0; node->ports[i].err_total.vl15_dropped = 0; node->ports[i].err_total.time = ts; node->ports[i].dc_total.xmit_data = 0; node->ports[i].dc_total.rcv_data = 0; node->ports[i].dc_total.xmit_pkts = 0; node->ports[i].dc_total.rcv_pkts = 0; node->ports[i].dc_total.unicast_xmit_pkts = 0; node->ports[i].dc_total.unicast_rcv_pkts = 0; node->ports[i].dc_total.multicast_xmit_pkts = 0; node->ports[i].dc_total.multicast_rcv_pkts = 0; node->ports[i].dc_total.time = ts; node->ports[i].last_reset = ts; } } /********************************************************************** * Clear all the counters from the db **********************************************************************/ void perfmgr_db_clear_counters(perfmgr_db_t * db) { cl_plock_excl_acquire(&(db->lock)); cl_qmap_apply_func(&(db->pc_data), __clear_counters, (void *)db); cl_plock_release(&(db->lock)); #if 0 if (db->db_impl->clear_counters) db->db_impl->clear_counters(db->db_data); #endif } /********************************************************************** * Output a tab delimited output of the port counters **********************************************************************/ static void __dump_node_mr(_db_node_t * node, FILE * fp) { int i = 0; fprintf(fp, "\nName\tGUID\tPort\tLast Reset\t" "%s\t%s\t" "%s\t%s\t%s\t%s\t%s\t%s\t%s\t" "%s\t%s\t%s\t%s\t%s\t%s\t%s\t" "%s\t%s\t%s\t%s\n", "symbol_err_cnt", "link_err_recover", "link_downed", "rcv_err", "rcv_rem_phys_err", "rcv_switch_relay_err", "xmit_discards", "xmit_constraint_err", "rcv_constraint_err", "link_int_err", "buf_overrun_err", "vl15_dropped", "xmit_data", "rcv_data", "xmit_pkts", "rcv_pkts", "unicast_xmit_pkts", "unicast_rcv_pkts", "multicast_xmit_pkts", "multicast_rcv_pkts"); for (i = 1; i < node->num_ports; i++) { char *since = ctime(&(node->ports[i].last_reset)); since[strlen(since) - 1] = '\0'; /* remove \n */ fprintf(fp, "%s\t0x%" PRIx64 "\t%d\t%s\t%" PRIu64 "\t%" PRIu64 "\t" "%" PRIu64 "\t%" PRIu64 "\t%" PRIu64 "\t%" PRIu64 "\t" "%" PRIu64 "\t%" PRIu64 "\t%" PRIu64 "\t" "%" PRIu64 "\t%" PRIu64 "\t%" PRIu64 "\t" "%" PRIu64 "\t%" PRIu64 "\t%" PRIu64 "\t%" PRIu64 "\t" "%" PRIu64 "\t%" PRIu64 "\t%" PRIu64 "\t%" PRIu64 "\n", node->node_name, node->node_guid, i, since, node->ports[i].err_total.symbol_err_cnt, node->ports[i].err_total.link_err_recover, node->ports[i].err_total.link_downed, node->ports[i].err_total.rcv_err, node->ports[i].err_total.rcv_rem_phys_err, node->ports[i].err_total.rcv_switch_relay_err, node->ports[i].err_total.xmit_discards, node->ports[i].err_total.xmit_constraint_err, node->ports[i].err_total.rcv_constraint_err, node->ports[i].err_total.link_integrity, node->ports[i].err_total.buffer_overrun, node->ports[i].err_total.vl15_dropped, node->ports[i].dc_total.xmit_data, node->ports[i].dc_total.rcv_data, node->ports[i].dc_total.xmit_pkts, node->ports[i].dc_total.rcv_pkts, node->ports[i].dc_total.unicast_xmit_pkts, node->ports[i].dc_total.unicast_rcv_pkts, node->ports[i].dc_total.multicast_xmit_pkts, node->ports[i].dc_total.multicast_rcv_pkts); } } /********************************************************************** * Output a human readable output of the port counters **********************************************************************/ static void __dump_node_hr(_db_node_t * node, FILE * fp) { int i = 0; fprintf(fp, "\n"); for (i = 1; i < node->num_ports; i++) { char *since = ctime(&(node->ports[i].last_reset)); since[strlen(since) - 1] = '\0'; /* remove \n */ fprintf(fp, "\"%s\" 0x%" PRIx64 " port %d (Since %s)\n" " symbol_err_cnt : %" PRIu64 "\n" " link_err_recover : %" PRIu64 "\n" " link_downed : %" PRIu64 "\n" " rcv_err : %" PRIu64 "\n" " rcv_rem_phys_err : %" PRIu64 "\n" " rcv_switch_relay_err : %" PRIu64 "\n" " xmit_discards : %" PRIu64 "\n" " xmit_constraint_err : %" PRIu64 "\n" " rcv_constraint_err : %" PRIu64 "\n" " link_integrity_err : %" PRIu64 "\n" " buf_overrun_err : %" PRIu64 "\n" " vl15_dropped : %" PRIu64 "\n" " xmit_data : %" PRIu64 "\n" " rcv_data : %" PRIu64 "\n" " xmit_pkts : %" PRIu64 "\n" " rcv_pkts : %" PRIu64 "\n" " unicast_xmit_pkts : %" PRIu64 "\n" " unicast_rcv_pkts : %" PRIu64 "\n" " multicast_xmit_pkts : %" PRIu64 "\n" " multicast_rcv_pkts : %" PRIu64 "\n", node->node_name, node->node_guid, i, since, node->ports[i].err_total.symbol_err_cnt, node->ports[i].err_total.link_err_recover, node->ports[i].err_total.link_downed, node->ports[i].err_total.rcv_err, node->ports[i].err_total.rcv_rem_phys_err, node->ports[i].err_total.rcv_switch_relay_err, node->ports[i].err_total.xmit_discards, node->ports[i].err_total.xmit_constraint_err, node->ports[i].err_total.rcv_constraint_err, node->ports[i].err_total.link_integrity, node->ports[i].err_total.buffer_overrun, node->ports[i].err_total.vl15_dropped, node->ports[i].dc_total.xmit_data, node->ports[i].dc_total.rcv_data, node->ports[i].dc_total.xmit_pkts, node->ports[i].dc_total.rcv_pkts, node->ports[i].dc_total.unicast_xmit_pkts, node->ports[i].dc_total.unicast_rcv_pkts, node->ports[i].dc_total.multicast_xmit_pkts, node->ports[i].dc_total.multicast_rcv_pkts); } } /* Define a context for the __db_dump callback */ typedef struct { FILE *fp; perfmgr_db_dump_t dump_type; } dump_context_t; /********************************************************************** **********************************************************************/ static void __db_dump(cl_map_item_t * const p_map_item, void *context) { _db_node_t *node = (_db_node_t *) p_map_item; dump_context_t *c = (dump_context_t *) context; FILE *fp = c->fp; switch (c->dump_type) { case PERFMGR_EVENT_DB_DUMP_MR: __dump_node_mr(node, fp); break; case PERFMGR_EVENT_DB_DUMP_HR: default: __dump_node_hr(node, fp); break; } } /********************************************************************** * print node data to fp **********************************************************************/ void perfmgr_db_print_by_name(perfmgr_db_t * db, char *nodename, FILE *fp) { cl_map_item_t *item = NULL; _db_node_t *node = NULL; cl_plock_acquire(&(db->lock)); /* find the node */ item = cl_qmap_head(&(db->pc_data)); while (item != cl_qmap_end(&(db->pc_data))) { node = (_db_node_t *)item; if (strcmp(node->node_name, nodename) == 0) { __dump_node_hr(node, fp); goto done; } item = cl_qmap_next(item); } fprintf(fp, "Node %s not found...\n", nodename); done: cl_plock_release(&(db->lock)); } /********************************************************************** * print node data to fp **********************************************************************/ void perfmgr_db_print_by_guid(perfmgr_db_t * db, uint64_t nodeguid, FILE *fp) { cl_map_item_t *node = NULL; cl_plock_acquire(&(db->lock)); node = cl_qmap_get(&(db->pc_data), nodeguid); if (node != cl_qmap_end(&(db->pc_data))) __dump_node_hr((_db_node_t *)node, fp); else fprintf(fp, "Node %"PRIx64" not found...\n", nodeguid); cl_plock_release(&(db->lock)); } /********************************************************************** * dump the data to the file "file" **********************************************************************/ perfmgr_db_err_t perfmgr_db_dump(perfmgr_db_t * db, char *file, perfmgr_db_dump_t dump_type) { dump_context_t context; context.fp = fopen(file, "w+"); if (!context.fp) return (PERFMGR_EVENT_DB_FAIL); context.dump_type = dump_type; cl_plock_acquire(&(db->lock)); cl_qmap_apply_func(&(db->pc_data), __db_dump, (void *)&context); cl_plock_release(&(db->lock)); fclose(context.fp); return (PERFMGR_EVENT_DB_SUCCESS); } /********************************************************************** * Fill in the various DB objects from their wire counter parts **********************************************************************/ void perfmgr_db_fill_err_read(ib_port_counters_t * wire_read, perfmgr_db_err_reading_t * reading) { reading->symbol_err_cnt = cl_ntoh16(wire_read->symbol_err_cnt); reading->link_err_recover = cl_ntoh16(wire_read->link_err_recover); reading->link_downed = wire_read->link_downed; reading->rcv_err = wire_read->rcv_err; reading->rcv_rem_phys_err = cl_ntoh16(wire_read->rcv_rem_phys_err); reading->rcv_switch_relay_err = cl_ntoh16(wire_read->rcv_switch_relay_err); reading->xmit_discards = cl_ntoh16(wire_read->xmit_discards); reading->xmit_constraint_err = cl_ntoh16(wire_read->xmit_constraint_err); reading->rcv_constraint_err = wire_read->rcv_constraint_err; reading->link_integrity = PC_LINK_INT(wire_read->link_int_buffer_overrun); reading->buffer_overrun = PC_BUF_OVERRUN(wire_read->link_int_buffer_overrun); reading->vl15_dropped = cl_ntoh16(wire_read->vl15_dropped); reading->time = time(NULL); } void perfmgr_db_fill_data_cnt_read_pc(ib_port_counters_t * wire_read, perfmgr_db_data_cnt_reading_t * reading) { reading->xmit_data = cl_ntoh32(wire_read->xmit_data); reading->rcv_data = cl_ntoh32(wire_read->rcv_data); reading->xmit_pkts = cl_ntoh32(wire_read->xmit_pkts); reading->rcv_pkts = cl_ntoh32(wire_read->rcv_pkts); reading->unicast_xmit_pkts = 0; reading->unicast_rcv_pkts = 0; reading->multicast_xmit_pkts = 0; reading->multicast_rcv_pkts = 0; reading->time = time(NULL); } void perfmgr_db_fill_data_cnt_read_epc(ib_port_counters_ext_t * wire_read, perfmgr_db_data_cnt_reading_t * reading) { reading->xmit_data = cl_ntoh64(wire_read->xmit_data); reading->rcv_data = cl_ntoh64(wire_read->rcv_data); reading->xmit_pkts = cl_ntoh64(wire_read->xmit_pkts); reading->rcv_pkts = cl_ntoh64(wire_read->rcv_pkts); reading->unicast_xmit_pkts = cl_ntoh64(wire_read->unicast_xmit_pkts); reading->unicast_rcv_pkts = cl_ntoh64(wire_read->unicast_rcv_pkts); reading->multicast_xmit_pkts = cl_ntoh64(wire_read->multicast_xmit_pkts); reading->multicast_rcv_pkts = cl_ntoh64(wire_read->multicast_rcv_pkts); reading->time = time(NULL); } #endif /* ENABLE_OSM_PERF_MGR */