file
stringlengths
18
26
data
stringlengths
2
1.05M
the_stack_data/25136507.c
// RUN: %clang_cc1 -w -emit-llvm -o /dev/null %s // PR2264. unsigned foo = 8L; unsigned bar = 0L; volatile unsigned char baz = 6L; int test() { char qux = 1L; for (; baz >= -29; baz--) bork(bar && foo, qux); }
the_stack_data/184517410.c
// // Maximum_Subarray.c // MyLeetCode // // Created by poco on 2019/2/11. // Copyright © 2019 zyy. All rights reserved. // int maxSubArray(int* nums, int numsSize) { int i = 0, currSum = 0; int maxSum = nums[0]; for(i = 0;i < numsSize;i++) { //如果是负数,变小,就看看加上负数的和是不是比下一个数还小,还小就干脆才下一个数重新开始 //除非currSum是负数才从下一个开始, currSum = (nums[i] > currSum + nums[i] ? nums[i] : currSum + nums[i]); maxSum = (maxSum > currSum) ? maxSum : currSum; } return maxSum; }
the_stack_data/31387767.c
#include <stdio.h> #include <stdlib.h> void vassume(int b){} void vtrace1(int A, int B, int q, int r, int d, int p){} void vtrace2(int A, int B, int q, int r, int d, int p){} void vtrace3(int A, int B, int q, int r, int d){} int mainQ(int A, int B){ vassume(B >= 1); int r,d,p,q; r=A; d=B; p=1; q=0; while(1){ //%%%traces: int A, int B, int q, int r, int d, int p vtrace1(A, B, q, r, d, p); if (!(r >= d)) break; //assert(A >= 0 && B > 0 && q == 0 && r == A && d == B*p); d = 2 * d; p = 2 * p; } while(1){ // assert(A == q*B+r && d==B*p); vtrace2(A, B, q, r, d, p); if (!(p!=1)) break; d = d / 2; p = p / 2; if(r >= d){ r = r - d; q = q + p; } } vtrace3(A, B, q, r, d); return q; } void main(int argc, char **argv){ mainQ(atoi(argv[1]), atoi(argv[2])); }
the_stack_data/23574353.c
/* * timsort.c * * Created on: 14 de mar de 2020 * Author: Guilherme Victor Borges Pereira */ #include <stdio.h> #include <stdlib.h> #include <time.h> void printArray(const int arr[], const char str[], int idx); void ts(int arr[], int n); void insertionSort(int arr[], int left, int right); void merge(int arr[], int l, int m, int r); int min(int a, int b); static int RUN = 10; void insertionSort(int arr[], int left, int right) { for (int i = left + 1; i <= right; i++) { int temp = arr[i]; int j = i - 1; while (arr[j] > temp && j >= left) { arr[j + 1] = arr[j]; j--; } arr[j + 1] = temp; } } void merge(int arr[], int l, int m, int r) { int len1 = m - l + 1, len2 = r - m; int left[len1]; int right[len2]; for (int x = 0; x < len1; x++) { left[x] = arr[l + x]; } for (int x = 0; x < len2; x++) { right[x] = arr[m + 1 + x]; } int i = 0; int j = 0; int k = l; while (i < len1 && j < len2) { if (left[i] <= right[j]) { arr[k] = left[i]; i++; } else { arr[k] = right[j]; j++; } k++; } while (i < len1) { arr[k] = left[i]; k++; i++; } while (j < len2) { arr[k] = right[j]; k++; j++; } } int min(int a, int b) { if (a < b) return a; return b; } void ts(int arr[], int n) { for (int i = 0; i < n; i += RUN) { insertionSort(arr, i, min((i + 31), (n - 1))); } for (int size = RUN; size < n; size = 2 * size) { for (int left = 0; left < n; left += 2 * size) { int mid = left + size - 1; int right = min((left + 2 * size - 1), (n - 1)); merge(arr, left, mid, right); } } } void timsort(int arr[], int idx) { int n = idx; char str[] = "TimSort"; clock_t start_t, end_t; float total_t; start_t = clock(); ts(arr, n); end_t = clock() - start_t; printArray(arr, str, idx); printf("\n"); total_t = ((float)end_t) / CLOCKS_PER_SEC; printf("Time: %f seconds.\n", total_t); printf("Exiting of the program...\n"); }
the_stack_data/40762791.c
/* Copyright (C) 1991,92,96,97,98,99,2000,2001 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #ifdef BSD #include </usr/include/stdio.h> #else #include <stdio.h> #endif #include <math.h> #include <stdlib.h> #include <string.h> int main (int argc, char **argv) { char buf[BUFSIZ]; FILE *in = stdin, *out = stdout; int x; int result = 0; if (sscanf ("0", "%d", &x) != 1) { fputs ("test failed!\n", stdout); result = 1; } if (sscanf ("08905x", "%9[0-9]", buf) != 1 || strcmp (buf, "08905") != 0) { fputs ("test failed!\n", stdout); result = 1; } if (sscanf ("", "%10[a-z]", buf) != EOF) { fputs ("test failed!\n", stdout); result = 1; } sscanf ("conversion] Zero flag Ze]ro#\n", "%*[^]] %[^#]\n", buf); if (strcmp (buf, "] Zero flag Ze]ro") != 0) { fputs ("test failed!\n", stdout); result = 1; } if (argc == 2 && !strcmp (argv[1], "-opipe")) { out = popen ("/bin/cat", "w"); if (out == NULL) { perror ("popen: /bin/cat"); result = 1; } } else if (argc == 3 && !strcmp (argv[1], "-ipipe")) { sprintf (buf, "/bin/cat %s", argv[2]); in = popen (buf, "r"); if (in == NULL) { perror ("popen: /bin/cat"); result = 1; } } { char name[50]; fprintf (out, "sscanf (\"thompson\", \"%%s\", name) == %d, name == \"%s\"\n", sscanf ("thompson", "%s", name), name); if (strcmp (name, "thompson") != 0) { fputs ("test failed!\n", stdout); result = 1; } } fputs ("Testing scanf (vfscanf)\n", out); fputs ("Test 1:\n", out); { int n, i; float x; char name[50]; n = fscanf (in, "%d%f%s", &i, &x, name); fprintf (out, "n = %d, i = %d, x = %f, name = \"%.50s\"\n", n, i, x, name); if (n != 3 || i != 25 || x != 5.432F || strcmp (name, "thompson")) { fputs ("test failed!\n", stdout); result = 1; } } fprintf (out, "Residual: \"%s\"\n", fgets (buf, sizeof (buf), in)); if (strcmp (buf, "\n")) { fputs ("test failed!\n", stdout); result = 1; } fputs ("Test 2:\n", out); { int i; float x; char name[50]; (void) fscanf (in, "%2d%f%*d %[0123456789]", &i, &x, name); fprintf (out, "i = %d, x = %f, name = \"%.50s\"\n", i, x, name); if (i != 56 || x != 789.0F || strcmp (name, "56")) { fputs ("test failed!\n", stdout); result = 1; } } fprintf (out, "Residual: \"%s\"\n", fgets (buf, sizeof (buf), in)); if (strcmp (buf, "a72\n")) { fputs ("test failed!\n", stdout); result = 1; } fputs ("Test 3:\n", out); { static struct { int count; float quant; const char *units; const char *item; } ok[] = { { 3, 2.0F, "quarts", "oil" }, { 2, -12.8F, "degrees", "" }, { 0, 0.0F, "", "" }, { 3, 10.0F, "LBS", "fertilizer" }, { 3, 100.0F, "rgs", "energy" }, { -1, 0.0F, "", "" }}; size_t rounds = 0; float quant; char units[21], item[21]; while (!feof (in) && !ferror (in)) { int count; if (rounds++ >= sizeof (ok) / sizeof (ok[0])) { fputs ("test failed!\n", stdout); result = 1; } quant = 0.0; units[0] = item[0] = '\0'; count = fscanf (in, "%f%20s of %20s", &quant, units, item); (void) fscanf (in, "%*[^\n]"); fprintf (out, "count = %d, quant = %f, item = %.21s, units = %.21s\n", count, quant, item, units); if (count != ok[rounds-1].count || quant != ok[rounds-1].quant || strcmp (item, ok[rounds-1].item) || strcmp (units, ok[rounds-1].units)) { fputs ("test failed!\n", stdout); result = 1; } } } buf[0] = '\0'; fprintf (out, "Residual: \"%s\"\n", fgets (buf, sizeof (buf), in)); if (strcmp (buf, "")) { fputs ("test failed!\n", stdout); result = 1; } if (out != stdout) pclose (out); fputs ("Test 4:\n", out); { int res, val, n; res = sscanf ("-242", "%3o%n", &val, &n); printf ("res = %d, val = %d, n = %d\n", res, val, n); if (res != 1 || val != -20 || n != 3) { fputs ("test failed!\n", stdout); result = 1; } } fputs ("Test 5:\n", out); { double a = 0, b = 0; int res, n; res = sscanf ("1234567", "%3lg%3lg%n", &a, &b, &n); printf ("res = %d, a = %g, b = %g, n = %d\n", res, a, b, n); if (res != 2 || a != 123 || b != 456 || n != 6) { fputs ("test failed!\n", stdout); result = 1; } res = sscanf ("0", "%lg", &a); printf ("res = %d, a = %g\n", res, a); if (res != 1 || a != 0) { fputs ("test failed!\n", stdout); result = 1; } res = sscanf ("1e3", "%lg%n", &a, &n); printf ("res = %d, a = %g, n = %d\n", res, a, n); if (res != 1 || a != 1000 || n != 3) { fputs ("test failed!\n", stdout); result = 1; } } fputs ("Test 6:\n", stdout); { char *p = (char *) -1; int res; sprintf (buf, "%p", NULL); res = sscanf (buf, "%p", &p); printf ("sscanf (\"%s\", \"%%p\", &p) = %d, p == %p\n", buf, res, p); if (res != 1 || p != NULL) { fputs ("test failed!\n", stdout); result = 1; } } fputs ("Test 7:\n", stdout); { short a[2] = { -1, -1 }; int res; res = sscanf ("32767 1234", "%hd %hd", &a[0], &a[1]); printf ("res = %d, a[0] = %d, a[1] = %d\n", res, a[0], a[1]); if (res != 2 || a[0] != 32767 || a[1] != 1234) { fputs ("test failed!\n", stdout); result = 1; } } fputs ("Test 8:\n", stdout); { double d = 123456.789; int res; res = sscanf ("0x1234", "%lf", &d); printf ("res = %d, d = %f\n", res, d); if (res != 0 || d != 123456.789) { fputs ("test failed!\n", stdout); result = 1; } } fputs ("Test 9:\n", stdout); { /* From PR libc/1313 reported by Ben Caradoc-Davies <[email protected]>. */ float value; int res; res = sscanf ("0123", "%2f", &value); if (res != 1 || value != 1.0) { fputs ("test failed!\n", stdout); result = 1; } } fputs ("Test 10:\n", stdout); { float value; int res; res = sscanf ("--", "%f", &value); if (res != 0) { fputs ("test failed!\n", stdout); result = 1; } } fputs ("Test 11:\n", stdout); { char uart[50]; int res; res = sscanf ("uart:16550A tx:0", "uart:%31s tx:%*u", uart); if (res != 1) { fputs ("test failed!\n", stdout); result = 1; } } fputs ("Test 12:\n", stdout); { char uart[50]; int res; res = sscanf ("uart:16550A", "uart:%31s tx:%*u", uart); if (res != 1) { fputs ("test failed!\n", stdout); result = 1; } } fputs ("Test 13:\n", stdout); { float value; int res; res = sscanf ("-InF", "%f", &value); if (res != 1 || isinf (value) != -1) { fputs ("test failed!\n", stdout); result = 1; } res = sscanf ("+InfiNiTY", "%f", &value); if (res != 1 || isinf (value) != 1) { fputs ("test failed!\n", stdout); result = 1; } } return result; }
the_stack_data/38759.c
#include <stdio.h> int main(void) { int i = 10; while(i--){ printf("%d\n",i); } return 0; }
the_stack_data/170452976.c
/*** * This code is a part of EvoApproxLib library (ehw.fit.vutbr.cz/approxlib) distributed under The MIT License. * When used, please cite the following article(s): V. Mrazek, R. Hrbacek, Z. Vasicek and L. Sekanina, "EvoApprox8b: Library of approximate adders and multipliers for circuit design and benchmarking of approximation methods". Design, Automation & Test in Europe Conference & Exhibition (DATE), 2017, Lausanne, 2017, pp. 258-261. doi: 10.23919/DATE.2017.7926993 * This file contains a circuit from evoapprox8b dataset. Note that a new version of library was already published. ***/ #include <stdint.h> #include <stdlib.h> /// Approximate function add8_223 /// Library = EvoApprox8b /// Circuit = add8_223 /// Area (180) = 784 /// Delay (180) = 1.580 /// Power (180) = 211.80 /// Area (45) = 59 /// Delay (45) = 0.560 /// Power (45) = 20.87 /// Nodes = 11 /// HD = 141696 /// MAE = 1.75000 /// MSE = 6.32812 /// MRE = 0.92 % /// WCE = 8 /// WCRE = 100 % /// EP = 71.7 % uint16_t add8_223(uint8_t a, uint8_t b) { uint16_t c = 0; uint8_t n2 = (a >> 1) & 0x1; uint8_t n4 = (a >> 2) & 0x1; uint8_t n6 = (a >> 3) & 0x1; uint8_t n8 = (a >> 4) & 0x1; uint8_t n10 = (a >> 5) & 0x1; uint8_t n12 = (a >> 6) & 0x1; uint8_t n14 = (a >> 7) & 0x1; uint8_t n18 = (b >> 1) & 0x1; uint8_t n20 = (b >> 2) & 0x1; uint8_t n22 = (b >> 3) & 0x1; uint8_t n24 = (b >> 4) & 0x1; uint8_t n26 = (b >> 5) & 0x1; uint8_t n28 = (b >> 6) & 0x1; uint8_t n30 = (b >> 7) & 0x1; uint8_t n33; uint8_t n35; uint8_t n41; uint8_t n43; uint8_t n82; uint8_t n132; uint8_t n182; uint8_t n183; uint8_t n232; uint8_t n233; uint8_t n282; uint8_t n283; uint8_t n332; uint8_t n333; uint8_t n382; uint8_t n383; n33 = ~(n6 & n4 & n18); n35 = ~(n33 | n8); n41 = ~(n35 & n2 & n20); n43 = ~(n41 | n24); n82 = n2 | n18; n132 = n4 | n20; n182 = (n6 ^ n22) ^ n43; n183 = (n6 & n22) | (n22 & n43) | (n6 & n43); n232 = (n8 ^ n24) ^ n183; n233 = (n8 & n24) | (n24 & n183) | (n8 & n183); n282 = (n10 ^ n26) ^ n233; n283 = (n10 & n26) | (n26 & n233) | (n10 & n233); n332 = (n12 ^ n28) ^ n283; n333 = (n12 & n28) | (n28 & n283) | (n12 & n283); n382 = (n14 ^ n30) ^ n333; n383 = (n14 & n30) | (n30 & n333) | (n14 & n333); c |= (n41 & 0x1) << 0; c |= (n82 & 0x1) << 1; c |= (n132 & 0x1) << 2; c |= (n182 & 0x1) << 3; c |= (n232 & 0x1) << 4; c |= (n282 & 0x1) << 5; c |= (n332 & 0x1) << 6; c |= (n382 & 0x1) << 7; c |= (n383 & 0x1) << 8; return c; }
the_stack_data/154827901.c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* strrchr.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: jgigault <[email protected]> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2015/06/08 16:56:08 by jgigault #+# #+# */ /* Updated: 2015/06/08 16:56:22 by jgigault ### ########.fr */ /* */ /* ************************************************************************** */ #include <string.h> #include <stdlib.h> #include <stdio.h> int main(int argc, char **argv) { int i; char *str; if (argc == 4) { i = atoi(argv[1]); if (i == 0) { str = strrchr(argv[2], atoi(argv[3])); if (str) printf("%s", str); else printf("(null)"); } } return (0); }
the_stack_data/150143273.c
/* Tests that Valgrind coredump support for SSE registers works correctly by producing a core dump analyzable by mdb. Basic register set is tested in coredump_single_thread. */ #include <stdio.h> #include <sys/types.h> __attribute__((noinline)) static void inner(void) { /* Set XMM registers to apriori known values. Unfortunately there is no instruction to load an immediate value directly into xmm register. */ __asm__ __volatile__("\n" "pushl $0x12345678\n" "pushl $0x9abcdef0\n" "pushl $0xfedbca98\n" "pushl $0x76543210\n" "movups (%%esp), %%xmm0\n" "pushl $0x23456789\n" "pushl $0x09876543\n" "pushl $0x21fedcba\n" "pushl $0x9467feca\n" "movups (%%esp), %%xmm1\n" "pushl $0xabcdabcd\n" "pushl $0xcedecede\n" "pushl $0xfabafaba\n" "pushl $0x50656754\n" "movups (%%esp), %%xmm2\n" "pushl $0x03050608\n" "pushl $0x1d1b4b15\n" "pushl $0x25272120\n" "pushl $0x373a3d35\n" "movups (%%esp), %%xmm3\n" "pushl $0x9abcdef0\n" "pushl $0x76543210\n" "pushl $0x12345678\n" "pushl $0xfedbca98\n" "movups (%%esp), %%xmm4\n" "pushl $0x9467feca\n" "pushl $0x23456789\n" "pushl $0x21fedcba\n" "pushl $0x09876543\n" "movups (%%esp), %%xmm5\n" "pushl $0x50656754\n" "pushl $0xcedecede\n" "pushl $0xabcdabcd\n" "pushl $0xfabafaba\n" "movups (%%esp), %%xmm6\n" "pushl $0x373a3d35\n" "pushl $0x1d1b4b15\n" "pushl $0x03050608\n" "pushl $0x25272120\n" "movups (%%esp), %%xmm7\n" "movl $0x1, %%eax\n" "movl $0x1234, (%%eax)\n" // should cause SEGV here : // no output registers : // no input registers : "memory", "%xmm0", "%xmm1", "%xmm2", "%xmm3", "%xmm4", "%xmm5", "%xmm6", "%xmm7"); } __attribute__((noinline)) static void outer(void) { inner(); } int main(int argc, const char *argv[]) { outer(); return 0; }
the_stack_data/40763419.c
/*** * This code is a part of EvoApproxLib library (ehw.fit.vutbr.cz/approxlib) distributed under The MIT License. * When used, please cite the following article(s): V. Mrazek, R. Hrbacek, Z. Vasicek and L. Sekanina, "EvoApprox8b: Library of approximate adders and multipliers for circuit design and benchmarking of approximation methods". Design, Automation & Test in Europe Conference & Exhibition (DATE), 2017, Lausanne, 2017, pp. 258-261. doi: 10.23919/DATE.2017.7926993 * This file contains a circuit from evoapprox8b dataset. Note that a new version of library was already published. ***/ #include <stdint.h> #include <stdlib.h> /// Approximate function add8_128 /// Library = EvoApprox8b /// Circuit = add8_128 /// Area (180) = 768 /// Delay (180) = 1.390 /// Power (180) = 240.50 /// Area (45) = 58 /// Delay (45) = 0.530 /// Power (45) = 23.11 /// Nodes = 11 /// HD = 134528 /// MAE = 1.37500 /// MSE = 3.25000 /// MRE = 0.75 % /// WCE = 5 /// WCRE = 200 % /// EP = 76.6 % uint16_t add8_128(uint8_t a, uint8_t b) { uint16_t c = 0; uint8_t n2 = (a >> 1) & 0x1; uint8_t n4 = (a >> 2) & 0x1; uint8_t n6 = (a >> 3) & 0x1; uint8_t n8 = (a >> 4) & 0x1; uint8_t n10 = (a >> 5) & 0x1; uint8_t n12 = (a >> 6) & 0x1; uint8_t n14 = (a >> 7) & 0x1; uint8_t n18 = (b >> 1) & 0x1; uint8_t n20 = (b >> 2) & 0x1; uint8_t n22 = (b >> 3) & 0x1; uint8_t n24 = (b >> 4) & 0x1; uint8_t n26 = (b >> 5) & 0x1; uint8_t n28 = (b >> 6) & 0x1; uint8_t n30 = (b >> 7) & 0x1; uint8_t n35; uint8_t n41; uint8_t n46; uint8_t n117; uint8_t n132; uint8_t n182; uint8_t n183; uint8_t n221; uint8_t n232; uint8_t n233; uint8_t n282; uint8_t n283; uint8_t n332; uint8_t n333; uint8_t n382; uint8_t n383; n35 = ~(n4 & n18 & n20); n41 = ~(n20 & n18 & n4); n46 = ~n41; n117 = n46; n132 = n4 | n20; n182 = (n6 ^ n22) ^ n117; n183 = (n6 & n22) | (n22 & n117) | (n6 & n117); n221 = n183; n232 = (n8 ^ n24) ^ n221; n233 = (n8 & n24) | (n24 & n221) | (n8 & n221); n282 = (n10 ^ n26) ^ n233; n283 = (n10 & n26) | (n26 & n233) | (n10 & n233); n332 = (n12 ^ n28) ^ n283; n333 = (n12 & n28) | (n28 & n283) | (n12 & n283); n382 = (n14 ^ n30) ^ n333; n383 = (n14 & n30) | (n30 & n333) | (n14 & n333); c |= (n2 & 0x1) << 0; c |= (n35 & 0x1) << 1; c |= (n132 & 0x1) << 2; c |= (n182 & 0x1) << 3; c |= (n232 & 0x1) << 4; c |= (n282 & 0x1) << 5; c |= (n332 & 0x1) << 6; c |= (n382 & 0x1) << 7; c |= (n383 & 0x1) << 8; return c; }
the_stack_data/212643274.c
#include <stdlib.h> #include <string.h> #include <stdint.h> char *shttp_url_decode_buffer(char *buffer, uint8_t len) { // allocate output buffer and exit if not enough memory char *output = malloc(len + 1); if (output == NULL) { return NULL; } // copy bytes over to output buffer uint8_t j = 0; for (uint8_t i = 0; i < len; i++) { if (buffer[i] == '%') { // decode %xx where xx is a hex number output[j++] = (char)strtol(buffer + i, NULL, 16); i += 2; } else if (buffer[i] == '+') { // plus will get decoded to space output[j++] = ' '; } else { // all other characters will stay as is (yes that's possibly // naive and too simple) output[j++] = buffer[i]; } } // zero terminate buffer output[j++] = '\0'; // shrink buffer to conserve memory return realloc(output, j); } char *shttp_url_decode(char *value) { // slow but size efficient method reuse return shttp_url_decode_buffer(value, strlen(value)); }
the_stack_data/131160.c
#include <stdio.h> int main(void){ int n; char ch; scanf("%d\n",&n); while(n--){ int sum=0,num=0; while((ch=getchar())!='\n'){ if(ch=='O'){ ++num;sum+=num; } if(ch=='X')num=0; } printf("%d\n",sum); } return 0; }
the_stack_data/116626.c
#include <stdio.h> int main() { int z; while(scanf("%d",&z)!=EOF) { int ara[z][z]; int a,aa,b,c,d,e,f,g,x,y; for(a=0; a<z; a++) { for(b=0; b<z; b++) ara[a][b]=0; } for(a=0; a<z; a++) ara[a][a]=2; d=z-1; for(a=0,b=d; a<z;a++,b--) ara[a][b]=3; c=z/3; e=z-c-c; for(f=c,x=1; x<=e; f++,x++) { for(g=c,y=1; y<=e; g++,y++) ara[f][g]=1; } if(z%2==1) aa=z/2; else aa=(z/2)-1; ara[aa][aa]=4; for(a=0; a<z; a++) { for(b=0; b<z; b++) printf("%d",ara[a][b]); printf("\n"); } printf("\n"); } return 0; }
the_stack_data/220455469.c
/* strnlen( const char *, size_t len ) This file is part of the Public Domain C Library (PDCLib). Permission is granted to use, modify, and / or redistribute at will. */ #include <string.h> #include <stdint.h> #ifndef REGTEST size_t strnlen( const char * s, size_t maxlen ) { for( size_t len = 0; len != maxlen; len++ ) { if(s[len] == '\0') return len; } return maxlen; } #endif #ifdef TEST #include "_PDCLIB_test.h" int main( void ) { #ifndef REGTEST TESTCASE( strnlen( abcde, 5 ) == 5 ); TESTCASE( strnlen( abcde, 3 ) == 3 ) TESTCASE( strnlen( "", SIZE_MAX ) == 0 ); #endif return TEST_RESULTS; } #endif
the_stack_data/74486.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/95248.c
/*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * * %sccs.include.redist.c% */ #ifndef lint static char sccsid[] = "@(#)getsubopt.c 8.1 (Berkeley) 06/04/93"; #endif /* not lint */ #include <unistd.h> #include <stdlib.h> /* * The SVID interface to getsubopt provides no way of figuring out which * part of the suboptions list wasn't matched. This makes error messages * tricky... The extern variable suboptarg is a pointer to the token * which didn't match. */ char *suboptarg; getsubopt(optionp, tokens, valuep) register char **optionp, **valuep; register char * const *tokens; { register int cnt; register char *p; suboptarg = *valuep = NULL; if (!optionp || !*optionp) return(-1); /* skip leading white-space, commas */ for (p = *optionp; *p && (*p == ',' || *p == ' ' || *p == '\t'); ++p); if (!*p) { *optionp = p; return(-1); } /* save the start of the token, and skip the rest of the token. */ for (suboptarg = p; *++p && *p != ',' && *p != '=' && *p != ' ' && *p != '\t';); if (*p) { /* * If there's an equals sign, set the value pointer, and * skip over the value part of the token. Terminate the * token. */ if (*p == '=') { *p = '\0'; for (*valuep = ++p; *p && *p != ',' && *p != ' ' && *p != '\t'; ++p); if (*p) *p++ = '\0'; } else *p++ = '\0'; /* Skip any whitespace or commas after this token. */ for (; *p && (*p == ',' || *p == ' ' || *p == '\t'); ++p); } /* set optionp for next round. */ *optionp = p; for (cnt = 0; *tokens; ++tokens, ++cnt) if (!strcmp(suboptarg, *tokens)) return(cnt); return(-1); }
the_stack_data/414328.c
/* Exercise 1 - Calculations Write a C program to input marks of two subjects. Calculate and print the average of the two marks. */ #include <stdio.h> int main() { int mark1,mark2; float avg; printf("enter mark 1 :"); scanf("%d",&mark1); printf("enter mark 2 :"); scanf("%d",&mark2); avg=(mark1+mark2)/2.0; printf("average is %.2f",avg); return 0; }
the_stack_data/1124628.c
#include <stdio.h> void parse() { }
the_stack_data/156392042.c
#include <sys/time.h> // work around module map issue with iOS sdk, <rdar://problem/35159346> #include <sys/select.h> #include <stdio.h> #include <pthread.h> #include <unistd.h> void * select_thread (void *in) { pthread_setname_np ("select thread"); fd_set fdset; FD_SET (STDIN_FILENO, &fdset); while (1) select (2, &fdset, NULL, NULL, NULL); return NULL; } void stopper () { while (1) sleep(1); // break here } int main () { pthread_setname_np ("main thread"); pthread_t other_thread; pthread_create (&other_thread, NULL, select_thread, NULL); sleep (1); stopper(); }
the_stack_data/132952882.c
// // Created by moe on 27.11.19. // #ifdef SGX_DECRYPTO_TEST #include <assert.h> #include <sgx_tcrypto.h> #include "UtilsStructs.h" #include "cryptoMemset.h" #include "sgx_error.h" #ifdef PRINT_CHECKS #define fprintf(stream, msg...) printf(msg) #define fflush(...) #else #define fprintf(stream, msg...) #define fflush(...) #endif static globalConfig_t *globConfPtr; static char *plainText; static char *cipherText; static const char encrypKey[SGX_AESGCM_KEY_SIZE] = "THISISASHAREDKEY"; _Static_assert(sizeof(encrypKey) == sizeof(sgx_aes_gcm_128bit_key_t), "KEY SIZE INVALID"); static const uint8_t initVector[SGX_AESGCM_IV_SIZE] = {0}; _Static_assert(sizeof(initVector) == SGX_AESGCM_IV_SIZE, "initialization vector SIZE INVALID"); static void private_encrypt() { const uint8_t *p_src = plainText; uint32_t src_len = globConfPtr->CRYPTO_BUFLEN; uint32_t cipherTextSizeWithMac = src_len + SGX_AESGCM_MAC_SIZE; // the size of the encrypted plain text with the mac appeneded at its end cipherText = (uint8_t *) malloc(cipherTextSizeWithMac); // destination buffer bigger than the encrypted original packet to append the MAC at the end of the KEY sgx_status_t status = sgx_rijndael128GCM_encrypt( (sgx_aes_gcm_128bit_key_t*)&encrypKey, p_src, src_len, cipherText, &initVector, SGX_AESGCM_IV_SIZE, NULL, 0, cipherText + src_len // Where to append the generated GCM MAC ); if (status != SGX_SUCCESS) { fprintf(stderr, "encypting the plain text privately went wrong!\n"); return; } } void pre_sgx_decrypto_test(globalConfig_t *globalConfig) { globConfPtr = globalConfig; size_t plainBufferSize = globConfPtr->CRYPTO_BUFLEN * sizeof(char); plainText = (char *) malloc(plainBufferSize + 1); if(plainText == NULL) { fprintf(stderr, "Malloc failed!"); } for(int i = 0; i < globConfPtr->CRYPTO_BUFLEN; i++) { plainText[i] = 'a'; } plainText[plainBufferSize] = '\0'; private_encrypt(); } void post_sgx_decrypto_test() { free(plainText); free(cipherText); } int sgx_decrypto_test() { uint32_t src_len = globConfPtr->CRYPTO_BUFLEN; uint8_t *p_dst = (uint8_t *) malloc(src_len); sgx_status_t status = sgx_rijndael128GCM_decrypt( (sgx_aes_gcm_128bit_key_t*)&encrypKey, cipherText, src_len, p_dst, &initVector, SGX_AESGCM_IV_SIZE, NULL, 0, cipherText + src_len ); if (status != SGX_SUCCESS) { return 1; } if (memcmp(p_dst, plainText, src_len) != 0) { return 1; } free(p_dst); return 0; } #endif
the_stack_data/43887761.c
#include <stdio.h> int SumOfNaturalNumbers(int n) { static int sum = 0; if(n > 0) { // First method // sum = n + SumOfNaturalNumbers(n - 1); // Second method sum += n; SumOfNaturalNumbers(n - 1); //printf("\n%d\t%d", sum, n); return sum; } return 0; } int main() { int n = 5; int sum = (n*(n+1))/2; // Formula printf("\nSum of %d natural numbers", n); printf("\n--------------------------"); printf("\nRecursion: %d\nFormula: %d",SumOfNaturalNumbers(n), sum); return 0; }
the_stack_data/161081582.c
// Binary to octal conversion #include <stdio.h> int main(void) { int base = 1, remainder = 0; long int binary = 0, octal = 0; printf("\nEnter binary number: "); scanf("%ld", &binary); while(binary != 0) { remainder = binary % 10; octal += remainder * base; base *= 2; binary /= 10; } printf("Octal number is: %lo\n\n", octal); return 0; }
the_stack_data/52048.c
/* Taxonomy Classification: 0000030000000000000100 */ /* * WRITE/READ 0 write * WHICH BOUND 0 upper * DATA TYPE 0 char * MEMORY LOCATION 0 stack * SCOPE 0 same * CONTAINER 3 union * 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 1 1 byte * 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. */ typedef union { int intval; char buf[10]; } my_union; int main(int argc, char *argv[]) { my_union u; /* BAD */ u.buf[10] = 'A'; return 0; }
the_stack_data/178264963.c
/* Assignement Name: brackets */ #include <unistd.h> char brackets[4][3] = {"()", "[]", "{}", "\0"}; void ft_putstr(char *str) { while (*str) write(1, str++, 1); } int find_matching_bracket(char *s, unsigned int *index, char matching_bracket) { unsigned int j; while (s[*index]) { if (s[*index] == matching_bracket) return (1); j = 0; while (brackets[j][0]) { if (s[*index] == brackets[j][0]) { (*index)++; if (!find_matching_bracket(s, index, brackets[j][1])) return (0); else break ; } if (s[*index] == brackets[j][1]) return (0); j++; } (*index)++; } return (0); } int correctly_bracketed(char *s) { unsigned int i; unsigned int j; i = 0; while (s[i]) { j = 0; while (brackets[j][0]) { if (s[i] == brackets[j][0]) { i++; if (!find_matching_bracket(s, &i, brackets[j][1])) return (0); else break ; } if (s[i] == brackets[j][1]) return (0); j++; } i++; } return (1); } int main(int ac, char *av[]) { int i; if (ac < 2) { ft_putstr("\n"); return (0); } i = 1; while (i < ac) { if (correctly_bracketed(av[i])) ft_putstr("OK\n"); else ft_putstr("Error\n"); i++; } return (0); }
the_stack_data/225144383.c
#include <stdio.h> #include <stdlib.h> int main(int argc, char const *argv[]) { int row, column; scanf("%d%d", &row, &column); int matrix[row][column]; int gone[row][column]; for (int i = 0; i < row; i++) { for (int j = 0; j < column; j++) { scanf("%d", &matrix[i][j]); gone[i][j] = 0; } } int rowCounter = 0; int columnCounter = 0; while (1) { if(gone[rowCounter][columnCounter] == 1) return 0; while (1) { //to right printf("%d ", matrix[rowCounter][columnCounter]); gone[rowCounter][columnCounter] = 1; if(gone[rowCounter][columnCounter + 1] == 0 && columnCounter + 1 < column) { columnCounter++; }else { break; } } rowCounter++; if(gone[rowCounter][columnCounter] == 1) return 0; while (1) { //to down printf("%d ", matrix[rowCounter][columnCounter]); gone[rowCounter][columnCounter] = 1; if(gone[rowCounter + 1][columnCounter] == 0 && rowCounter + 1 < row) { rowCounter++; }else { break; } } columnCounter--; if(gone[rowCounter][columnCounter] == 1) return 0; while (1) { //to left printf("%d ", matrix[rowCounter][columnCounter]); gone[rowCounter][columnCounter] = 1; if(gone[rowCounter][columnCounter - 1] == 0 && columnCounter - 1 >= 0) { columnCounter--; }else { break; } } rowCounter--; if(gone[rowCounter][columnCounter] == 1) return 0; while (1) { //to up printf("%d ", matrix[rowCounter][columnCounter]); gone[rowCounter][columnCounter] = 1; if(gone[rowCounter - 1][columnCounter] == 0 && rowCounter - 1 >= 0) { rowCounter--; }else { break; } } columnCounter++; } return 0; }
the_stack_data/117328258.c
#include <stdio.h> #include <stdlib.h> #include <string.h> #define ERROR_VALOR -1 typedef struct nodo { int informacion; char sCaracter [20]; struct nodo *siguiente; } tipoNodo; typedef tipoNodo *pNodo; int cola_vacia(pNodo inicio){ if(!inicio){ return 1; }else return 0; } int cola_llena(){ if ( (pNodo)malloc(sizeof(tipoNodo))== NULL ) return 1; else return 0; } void ver_cabecera(pNodo cabecera){ if(cola_vacia(cabecera)){ fprintf(stderr, "La cola est%c vac%ca\n", 160, 161); } else printf("El inicio de la cola es: %d\n", cabecera->informacion ); } void ver_cola(pNodo inicio,int eNumero, char sCaracter[20]){ pNodo aux; if(cola_vacia(inicio)){ fprintf(stderr, "La cola est%c vac%ca\n", 160, 161); }else { aux = inicio; printf("\nCola: "); while (aux != NULL){ // int c = (int)aux->informacion;//'aux->informacion'; // aux->informacion;// los enteros los da en ASCII printf("%i \n", aux->informacion); printf ("%s \n", aux ->sCaracter); aux = aux->siguiente; } printf("\n"); } } void enCola(pNodo *inicio, pNodo *final, int informacion , char sCaracter [20]) { pNodo nuevo; //pNodo nuevo2 ; //char cadena[20]; if(cola_llena()){ fprintf(stderr, "Memoria llena.\n"); }else { nuevo = (pNodo)malloc(sizeof(tipoNodo)); nuevo->informacion = informacion; strcpy (nuevo->sCaracter,sCaracter ); nuevo->siguiente = NULL; if(cola_vacia(*inicio)){ *inicio = *final= nuevo; }else { (*final)->siguiente = nuevo; *final = nuevo; } } } int deCola(pNodo *inicio){ pNodo aux; int x; if(cola_vacia(*inicio)){ fprintf(stderr, "La cola est%c vac%ca\n", 160, 161); return ERROR_VALOR; } aux = *inicio; x = (*inicio)->informacion; *inicio = (*inicio)->siguiente; return x; } /******************/ int main(){ pNodo inicio = NULL, final = NULL; int eOpcion = 0, eNumero; char sCaracter[20]; do{ fflush(stdin); //system("cls"); printf("\t*******\n\t Colas\n\t*******\n"); printf("1. Agregar\n2. Eliminar\n3. Ver Frente\n4. Ver Cola\n5. Salir\n"); printf("Selecione una opci%cn: ", 162); scanf("%d", &eOpcion); switch(eOpcion){ case 1: printf("Ingrese el nuevo elemento int : \n"); scanf("%d", &eNumero); fflush(stdin); printf("Ingrese el nuevo elemento char: \n"); scanf("%s", &sCaracter); enCola(&inicio, &final, eNumero, sCaracter); break; case 2: eNumero = deCola(&inicio); if (eNumero!= ERROR_VALOR) printf("Se elimin%c el elemento %d de la cola\n", 162, eNumero); break; case 3: ver_cabecera(inicio); getch(); break; case 4: ver_cola(inicio,eNumero, sCaracter); getch(); break; case 5: break; default: printf("Error en la selecci%cn. \n", 162); break; } // switch } while(eOpcion != 5); getch(); return 0; }
the_stack_data/67325351.c
/* Regular expression tests. Copyright (C) 2002-2017 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek <[email protected]>, 2002. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #include <sys/types.h> #include <mcheck.h> #include <regex.h> #include <stdio.h> #include <stdlib.h> /* Tests supposed to not match. */ struct { const char *pattern; const char *string; int flags, nmatch; } tests[] = { { "^<\\([^~]*\\)\\([^~]\\)[^~]*~\\1\\(.\\).*|=.*\\3.*\\2", "<,.8~2,~so-|=-~.0,123456789<><", REG_NOSUB, 0 }, /* In ERE, all carets must be treated as anchors. */ { "a^b", "a^b", REG_EXTENDED, 0 } }; int main (void) { regex_t re; regmatch_t rm[4]; size_t i; int n, ret = 0; mtrace (); for (i = 0; i < sizeof (tests) / sizeof (tests[0]); ++i) { n = regcomp (&re, tests[i].pattern, tests[i].flags); if (n != 0) { char buf[500]; regerror (n, &re, buf, sizeof (buf)); printf ("regcomp %zd failed: %s\n", i, buf); ret = 1; continue; } if (! regexec (&re, tests[i].string, tests[i].nmatch, tests[i].nmatch ? rm : NULL, 0)) { printf ("regexec %zd incorrectly matched\n", i); ret = 1; } regfree (&re); } return ret; }
the_stack_data/1033499.c
#pragma merger("0","/tmp/cil-FsgsI9pJ.i","") # 1 "./stencils/fdtd-2d/fdtd-2d.c" # 1 "<built-in>" # 1 "<command-line>" # 1 "/usr/include/stdc-predef.h" 1 3 4 # 1 "<command-line>" 2 # 1 "./stencils/fdtd-2d/fdtd-2d.c" # 1 "/usr/include/stdio.h" 1 3 4 # 27 "/usr/include/stdio.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/libc-header-start.h" 1 3 4 # 33 "/usr/include/x86_64-linux-gnu/bits/libc-header-start.h" 3 4 # 1 "/usr/include/features.h" 1 3 4 # 461 "/usr/include/features.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 1 3 4 # 452 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 # 453 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/long-double.h" 1 3 4 # 454 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4 # 462 "/usr/include/features.h" 2 3 4 # 485 "/usr/include/features.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 1 3 4 # 10 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/gnu/stubs-64.h" 1 3 4 # 11 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 2 3 4 # 486 "/usr/include/features.h" 2 3 4 # 34 "/usr/include/x86_64-linux-gnu/bits/libc-header-start.h" 2 3 4 # 28 "/usr/include/stdio.h" 2 3 4 # 1 "/usr/lib/gcc/x86_64-linux-gnu/9/include/stddef.h" 1 3 4 # 209 "/usr/lib/gcc/x86_64-linux-gnu/9/include/stddef.h" 3 4 # 209 "/usr/lib/gcc/x86_64-linux-gnu/9/include/stddef.h" 3 4 typedef long unsigned int size_t; # 34 "/usr/include/stdio.h" 2 3 4 # 1 "/usr/lib/gcc/x86_64-linux-gnu/9/include/stdarg.h" 1 3 4 # 40 "/usr/lib/gcc/x86_64-linux-gnu/9/include/stdarg.h" 3 4 typedef __builtin_va_list __gnuc_va_list; # 37 "/usr/include/stdio.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/types.h" 1 3 4 # 27 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 # 28 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/timesize.h" 1 3 4 # 29 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 typedef unsigned char __u_char; typedef unsigned short int __u_short; typedef unsigned int __u_int; typedef unsigned long int __u_long; typedef signed char __int8_t; typedef unsigned char __uint8_t; typedef signed short int __int16_t; typedef unsigned short int __uint16_t; typedef signed int __int32_t; typedef unsigned int __uint32_t; typedef signed long int __int64_t; typedef unsigned long int __uint64_t; typedef __int8_t __int_least8_t; typedef __uint8_t __uint_least8_t; typedef __int16_t __int_least16_t; typedef __uint16_t __uint_least16_t; typedef __int32_t __int_least32_t; typedef __uint32_t __uint_least32_t; typedef __int64_t __int_least64_t; typedef __uint64_t __uint_least64_t; typedef long int __quad_t; typedef unsigned long int __u_quad_t; typedef long int __intmax_t; typedef unsigned long int __uintmax_t; # 141 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/typesizes.h" 1 3 4 # 142 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/time64.h" 1 3 4 # 143 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 typedef unsigned long int __dev_t; typedef unsigned int __uid_t; typedef unsigned int __gid_t; typedef unsigned long int __ino_t; typedef unsigned long int __ino64_t; typedef unsigned int __mode_t; typedef unsigned long int __nlink_t; typedef long int __off_t; typedef long int __off64_t; typedef int __pid_t; typedef struct { int __val[2]; } __fsid_t; typedef long int __clock_t; typedef unsigned long int __rlim_t; typedef unsigned long int __rlim64_t; typedef unsigned int __id_t; typedef long int __time_t; typedef unsigned int __useconds_t; typedef long int __suseconds_t; typedef int __daddr_t; typedef int __key_t; typedef int __clockid_t; typedef void * __timer_t; typedef long int __blksize_t; typedef long int __blkcnt_t; typedef long int __blkcnt64_t; typedef unsigned long int __fsblkcnt_t; typedef unsigned long int __fsblkcnt64_t; typedef unsigned long int __fsfilcnt_t; typedef unsigned long int __fsfilcnt64_t; typedef long int __fsword_t; typedef long int __ssize_t; typedef long int __syscall_slong_t; typedef unsigned long int __syscall_ulong_t; typedef __off64_t __loff_t; typedef char *__caddr_t; typedef long int __intptr_t; typedef unsigned int __socklen_t; typedef int __sig_atomic_t; # 39 "/usr/include/stdio.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/types/__fpos_t.h" 1 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/types/__mbstate_t.h" 1 3 4 # 13 "/usr/include/x86_64-linux-gnu/bits/types/__mbstate_t.h" 3 4 typedef struct { int __count; union { unsigned int __wch; char __wchb[4]; } __value; } __mbstate_t; # 6 "/usr/include/x86_64-linux-gnu/bits/types/__fpos_t.h" 2 3 4 typedef struct _G_fpos_t { __off_t __pos; __mbstate_t __state; } __fpos_t; # 40 "/usr/include/stdio.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/types/__fpos64_t.h" 1 3 4 # 10 "/usr/include/x86_64-linux-gnu/bits/types/__fpos64_t.h" 3 4 typedef struct _G_fpos64_t { __off64_t __pos; __mbstate_t __state; } __fpos64_t; # 41 "/usr/include/stdio.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/types/__FILE.h" 1 3 4 struct _IO_FILE; typedef struct _IO_FILE __FILE; # 42 "/usr/include/stdio.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/types/FILE.h" 1 3 4 struct _IO_FILE; typedef struct _IO_FILE FILE; # 43 "/usr/include/stdio.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h" 1 3 4 # 35 "/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h" 3 4 struct _IO_FILE; struct _IO_marker; struct _IO_codecvt; struct _IO_wide_data; typedef void _IO_lock_t; struct _IO_FILE { int _flags; char *_IO_read_ptr; char *_IO_read_end; char *_IO_read_base; char *_IO_write_base; char *_IO_write_ptr; char *_IO_write_end; char *_IO_buf_base; char *_IO_buf_end; char *_IO_save_base; char *_IO_backup_base; char *_IO_save_end; struct _IO_marker *_markers; struct _IO_FILE *_chain; int _fileno; int _flags2; __off_t _old_offset; unsigned short _cur_column; signed char _vtable_offset; char _shortbuf[1]; _IO_lock_t *_lock; __off64_t _offset; struct _IO_codecvt *_codecvt; struct _IO_wide_data *_wide_data; struct _IO_FILE *_freeres_list; void *_freeres_buf; size_t __pad5; int _mode; char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)]; }; # 44 "/usr/include/stdio.h" 2 3 4 # 52 "/usr/include/stdio.h" 3 4 typedef __gnuc_va_list va_list; # 63 "/usr/include/stdio.h" 3 4 typedef __off_t off_t; # 77 "/usr/include/stdio.h" 3 4 typedef __ssize_t ssize_t; typedef __fpos_t fpos_t; # 133 "/usr/include/stdio.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/stdio_lim.h" 1 3 4 # 134 "/usr/include/stdio.h" 2 3 4 extern FILE *stdin; extern FILE *stdout; extern FILE *stderr; extern int remove (const char *__filename) __attribute__ ((__nothrow__ , __leaf__)); extern int rename (const char *__old, const char *__new) __attribute__ ((__nothrow__ , __leaf__)); extern int renameat (int __oldfd, const char *__old, int __newfd, const char *__new) __attribute__ ((__nothrow__ , __leaf__)); # 173 "/usr/include/stdio.h" 3 4 extern FILE *tmpfile (void) ; # 187 "/usr/include/stdio.h" 3 4 extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; # 204 "/usr/include/stdio.h" 3 4 extern char *tempnam (const char *__dir, const char *__pfx) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; extern int fclose (FILE *__stream); extern int fflush (FILE *__stream); # 227 "/usr/include/stdio.h" 3 4 extern int fflush_unlocked (FILE *__stream); # 246 "/usr/include/stdio.h" 3 4 extern FILE *fopen (const char *__restrict __filename, const char *__restrict __modes) ; extern FILE *freopen (const char *__restrict __filename, const char *__restrict __modes, FILE *__restrict __stream) ; # 279 "/usr/include/stdio.h" 3 4 extern FILE *fdopen (int __fd, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ; # 292 "/usr/include/stdio.h" 3 4 extern FILE *fmemopen (void *__s, size_t __len, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ; extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) ; extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf, int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf, size_t __size) __attribute__ ((__nothrow__ , __leaf__)); extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); extern int fprintf (FILE *__restrict __stream, const char *__restrict __format, ...); extern int printf (const char *__restrict __format, ...); extern int sprintf (char *__restrict __s, const char *__restrict __format, ...) __attribute__ ((__nothrow__)); extern int vfprintf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg); extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg); extern int vsprintf (char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __attribute__ ((__nothrow__)); extern int snprintf (char *__restrict __s, size_t __maxlen, const char *__restrict __format, ...) __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4))); extern int vsnprintf (char *__restrict __s, size_t __maxlen, const char *__restrict __format, __gnuc_va_list __arg) __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0))); # 379 "/usr/include/stdio.h" 3 4 extern int vdprintf (int __fd, const char *__restrict __fmt, __gnuc_va_list __arg) __attribute__ ((__format__ (__printf__, 2, 0))); extern int dprintf (int __fd, const char *__restrict __fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))); extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) ; extern int scanf (const char *__restrict __format, ...) ; extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__)); extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __asm__ ("" "__isoc99_fscanf") ; extern int scanf (const char *__restrict __format, ...) __asm__ ("" "__isoc99_scanf") ; extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __asm__ ("" "__isoc99_sscanf") __attribute__ ((__nothrow__ , __leaf__)) ; # 432 "/usr/include/stdio.h" 3 4 extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __attribute__ ((__format__ (__scanf__, 2, 0))) ; extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) __attribute__ ((__format__ (__scanf__, 1, 0))) ; extern int vsscanf (const char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0))); extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vfscanf") __attribute__ ((__format__ (__scanf__, 2, 0))) ; extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vscanf") __attribute__ ((__format__ (__scanf__, 1, 0))) ; extern int vsscanf (const char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vsscanf") __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0))); # 485 "/usr/include/stdio.h" 3 4 extern int fgetc (FILE *__stream); extern int getc (FILE *__stream); extern int getchar (void); extern int getc_unlocked (FILE *__stream); extern int getchar_unlocked (void); # 510 "/usr/include/stdio.h" 3 4 extern int fgetc_unlocked (FILE *__stream); # 521 "/usr/include/stdio.h" 3 4 extern int fputc (int __c, FILE *__stream); extern int putc (int __c, FILE *__stream); extern int putchar (int __c); # 537 "/usr/include/stdio.h" 3 4 extern int fputc_unlocked (int __c, FILE *__stream); extern int putc_unlocked (int __c, FILE *__stream); extern int putchar_unlocked (int __c); extern int getw (FILE *__stream); extern int putw (int __w, FILE *__stream); extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) ; # 603 "/usr/include/stdio.h" 3 4 extern __ssize_t __getdelim (char **__restrict __lineptr, size_t *__restrict __n, int __delimiter, FILE *__restrict __stream) ; extern __ssize_t getdelim (char **__restrict __lineptr, size_t *__restrict __n, int __delimiter, FILE *__restrict __stream) ; extern __ssize_t getline (char **__restrict __lineptr, size_t *__restrict __n, FILE *__restrict __stream) ; extern int fputs (const char *__restrict __s, FILE *__restrict __stream); extern int puts (const char *__s); extern int ungetc (int __c, FILE *__stream); extern size_t fread (void *__restrict __ptr, size_t __size, size_t __n, FILE *__restrict __stream) ; extern size_t fwrite (const void *__restrict __ptr, size_t __size, size_t __n, FILE *__restrict __s); # 673 "/usr/include/stdio.h" 3 4 extern size_t fread_unlocked (void *__restrict __ptr, size_t __size, size_t __n, FILE *__restrict __stream) ; extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size, size_t __n, FILE *__restrict __stream); extern int fseek (FILE *__stream, long int __off, int __whence); extern long int ftell (FILE *__stream) ; extern void rewind (FILE *__stream); # 707 "/usr/include/stdio.h" 3 4 extern int fseeko (FILE *__stream, __off_t __off, int __whence); extern __off_t ftello (FILE *__stream) ; # 731 "/usr/include/stdio.h" 3 4 extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos); extern int fsetpos (FILE *__stream, const fpos_t *__pos); # 757 "/usr/include/stdio.h" 3 4 extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; extern void perror (const char *__s); # 1 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 1 3 4 # 26 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 3 4 extern int sys_nerr; extern const char *const sys_errlist[]; # 782 "/usr/include/stdio.h" 2 3 4 extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; # 800 "/usr/include/stdio.h" 3 4 extern FILE *popen (const char *__command, const char *__modes) ; extern int pclose (FILE *__stream); extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__)); # 840 "/usr/include/stdio.h" 3 4 extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); # 858 "/usr/include/stdio.h" 3 4 extern int __uflow (FILE *); extern int __overflow (FILE *, int); # 873 "/usr/include/stdio.h" 3 4 # 9 "./stencils/fdtd-2d/fdtd-2d.c" 2 # 1 "/usr/include/unistd.h" 1 3 4 # 27 "/usr/include/unistd.h" 3 4 # 202 "/usr/include/unistd.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/posix_opt.h" 1 3 4 # 203 "/usr/include/unistd.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/environments.h" 1 3 4 # 22 "/usr/include/x86_64-linux-gnu/bits/environments.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 # 23 "/usr/include/x86_64-linux-gnu/bits/environments.h" 2 3 4 # 207 "/usr/include/unistd.h" 2 3 4 # 226 "/usr/include/unistd.h" 3 4 # 1 "/usr/lib/gcc/x86_64-linux-gnu/9/include/stddef.h" 1 3 4 # 227 "/usr/include/unistd.h" 2 3 4 typedef __gid_t gid_t; typedef __uid_t uid_t; # 255 "/usr/include/unistd.h" 3 4 typedef __useconds_t useconds_t; typedef __pid_t pid_t; typedef __intptr_t intptr_t; typedef __socklen_t socklen_t; # 287 "/usr/include/unistd.h" 3 4 extern int access (const char *__name, int __type) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); # 304 "/usr/include/unistd.h" 3 4 extern int faccessat (int __fd, const char *__file, int __type, int __flag) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; # 334 "/usr/include/unistd.h" 3 4 extern __off_t lseek (int __fd, __off_t __offset, int __whence) __attribute__ ((__nothrow__ , __leaf__)); # 353 "/usr/include/unistd.h" 3 4 extern int close (int __fd); extern ssize_t read (int __fd, void *__buf, size_t __nbytes) ; extern ssize_t write (int __fd, const void *__buf, size_t __n) ; # 376 "/usr/include/unistd.h" 3 4 extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, __off_t __offset) ; extern ssize_t pwrite (int __fd, const void *__buf, size_t __n, __off_t __offset) ; # 417 "/usr/include/unistd.h" 3 4 extern int pipe (int __pipedes[2]) __attribute__ ((__nothrow__ , __leaf__)) ; # 432 "/usr/include/unistd.h" 3 4 extern unsigned int alarm (unsigned int __seconds) __attribute__ ((__nothrow__ , __leaf__)); # 444 "/usr/include/unistd.h" 3 4 extern unsigned int sleep (unsigned int __seconds); extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval) __attribute__ ((__nothrow__ , __leaf__)); extern int usleep (__useconds_t __useconds); # 469 "/usr/include/unistd.h" 3 4 extern int pause (void); extern int chown (const char *__file, __uid_t __owner, __gid_t __group) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __attribute__ ((__nothrow__ , __leaf__)) ; extern int lchown (const char *__file, __uid_t __owner, __gid_t __group) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; extern int fchownat (int __fd, const char *__file, __uid_t __owner, __gid_t __group, int __flag) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; extern int chdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; extern int fchdir (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; # 511 "/usr/include/unistd.h" 3 4 extern char *getcwd (char *__buf, size_t __size) __attribute__ ((__nothrow__ , __leaf__)) ; # 525 "/usr/include/unistd.h" 3 4 extern char *getwd (char *__buf) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__)) ; extern int dup (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; extern int dup2 (int __fd, int __fd2) __attribute__ ((__nothrow__ , __leaf__)); # 543 "/usr/include/unistd.h" 3 4 extern char **__environ; extern int execve (const char *__path, char *const __argv[], char *const __envp[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern int fexecve (int __fd, char *const __argv[], char *const __envp[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); extern int execv (const char *__path, char *const __argv[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern int execle (const char *__path, const char *__arg, ...) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern int execl (const char *__path, const char *__arg, ...) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern int execvp (const char *__file, char *const __argv[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern int execlp (const char *__file, const char *__arg, ...) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); # 598 "/usr/include/unistd.h" 3 4 extern int nice (int __inc) __attribute__ ((__nothrow__ , __leaf__)) ; extern void _exit (int __status) __attribute__ ((__noreturn__)); # 1 "/usr/include/x86_64-linux-gnu/bits/confname.h" 1 3 4 # 24 "/usr/include/x86_64-linux-gnu/bits/confname.h" 3 4 enum { _PC_LINK_MAX, _PC_MAX_CANON, _PC_MAX_INPUT, _PC_NAME_MAX, _PC_PATH_MAX, _PC_PIPE_BUF, _PC_CHOWN_RESTRICTED, _PC_NO_TRUNC, _PC_VDISABLE, _PC_SYNC_IO, _PC_ASYNC_IO, _PC_PRIO_IO, _PC_SOCK_MAXBUF, _PC_FILESIZEBITS, _PC_REC_INCR_XFER_SIZE, _PC_REC_MAX_XFER_SIZE, _PC_REC_MIN_XFER_SIZE, _PC_REC_XFER_ALIGN, _PC_ALLOC_SIZE_MIN, _PC_SYMLINK_MAX, _PC_2_SYMLINKS }; enum { _SC_ARG_MAX, _SC_CHILD_MAX, _SC_CLK_TCK, _SC_NGROUPS_MAX, _SC_OPEN_MAX, _SC_STREAM_MAX, _SC_TZNAME_MAX, _SC_JOB_CONTROL, _SC_SAVED_IDS, _SC_REALTIME_SIGNALS, _SC_PRIORITY_SCHEDULING, _SC_TIMERS, _SC_ASYNCHRONOUS_IO, _SC_PRIORITIZED_IO, _SC_SYNCHRONIZED_IO, _SC_FSYNC, _SC_MAPPED_FILES, _SC_MEMLOCK, _SC_MEMLOCK_RANGE, _SC_MEMORY_PROTECTION, _SC_MESSAGE_PASSING, _SC_SEMAPHORES, _SC_SHARED_MEMORY_OBJECTS, _SC_AIO_LISTIO_MAX, _SC_AIO_MAX, _SC_AIO_PRIO_DELTA_MAX, _SC_DELAYTIMER_MAX, _SC_MQ_OPEN_MAX, _SC_MQ_PRIO_MAX, _SC_VERSION, _SC_PAGESIZE, _SC_RTSIG_MAX, _SC_SEM_NSEMS_MAX, _SC_SEM_VALUE_MAX, _SC_SIGQUEUE_MAX, _SC_TIMER_MAX, _SC_BC_BASE_MAX, _SC_BC_DIM_MAX, _SC_BC_SCALE_MAX, _SC_BC_STRING_MAX, _SC_COLL_WEIGHTS_MAX, _SC_EQUIV_CLASS_MAX, _SC_EXPR_NEST_MAX, _SC_LINE_MAX, _SC_RE_DUP_MAX, _SC_CHARCLASS_NAME_MAX, _SC_2_VERSION, _SC_2_C_BIND, _SC_2_C_DEV, _SC_2_FORT_DEV, _SC_2_FORT_RUN, _SC_2_SW_DEV, _SC_2_LOCALEDEF, _SC_PII, _SC_PII_XTI, _SC_PII_SOCKET, _SC_PII_INTERNET, _SC_PII_OSI, _SC_POLL, _SC_SELECT, _SC_UIO_MAXIOV, _SC_IOV_MAX = _SC_UIO_MAXIOV, _SC_PII_INTERNET_STREAM, _SC_PII_INTERNET_DGRAM, _SC_PII_OSI_COTS, _SC_PII_OSI_CLTS, _SC_PII_OSI_M, _SC_T_IOV_MAX, _SC_THREADS, _SC_THREAD_SAFE_FUNCTIONS, _SC_GETGR_R_SIZE_MAX, _SC_GETPW_R_SIZE_MAX, _SC_LOGIN_NAME_MAX, _SC_TTY_NAME_MAX, _SC_THREAD_DESTRUCTOR_ITERATIONS, _SC_THREAD_KEYS_MAX, _SC_THREAD_STACK_MIN, _SC_THREAD_THREADS_MAX, _SC_THREAD_ATTR_STACKADDR, _SC_THREAD_ATTR_STACKSIZE, _SC_THREAD_PRIORITY_SCHEDULING, _SC_THREAD_PRIO_INHERIT, _SC_THREAD_PRIO_PROTECT, _SC_THREAD_PROCESS_SHARED, _SC_NPROCESSORS_CONF, _SC_NPROCESSORS_ONLN, _SC_PHYS_PAGES, _SC_AVPHYS_PAGES, _SC_ATEXIT_MAX, _SC_PASS_MAX, _SC_XOPEN_VERSION, _SC_XOPEN_XCU_VERSION, _SC_XOPEN_UNIX, _SC_XOPEN_CRYPT, _SC_XOPEN_ENH_I18N, _SC_XOPEN_SHM, _SC_2_CHAR_TERM, _SC_2_C_VERSION, _SC_2_UPE, _SC_XOPEN_XPG2, _SC_XOPEN_XPG3, _SC_XOPEN_XPG4, _SC_CHAR_BIT, _SC_CHAR_MAX, _SC_CHAR_MIN, _SC_INT_MAX, _SC_INT_MIN, _SC_LONG_BIT, _SC_WORD_BIT, _SC_MB_LEN_MAX, _SC_NZERO, _SC_SSIZE_MAX, _SC_SCHAR_MAX, _SC_SCHAR_MIN, _SC_SHRT_MAX, _SC_SHRT_MIN, _SC_UCHAR_MAX, _SC_UINT_MAX, _SC_ULONG_MAX, _SC_USHRT_MAX, _SC_NL_ARGMAX, _SC_NL_LANGMAX, _SC_NL_MSGMAX, _SC_NL_NMAX, _SC_NL_SETMAX, _SC_NL_TEXTMAX, _SC_XBS5_ILP32_OFF32, _SC_XBS5_ILP32_OFFBIG, _SC_XBS5_LP64_OFF64, _SC_XBS5_LPBIG_OFFBIG, _SC_XOPEN_LEGACY, _SC_XOPEN_REALTIME, _SC_XOPEN_REALTIME_THREADS, _SC_ADVISORY_INFO, _SC_BARRIERS, _SC_BASE, _SC_C_LANG_SUPPORT, _SC_C_LANG_SUPPORT_R, _SC_CLOCK_SELECTION, _SC_CPUTIME, _SC_THREAD_CPUTIME, _SC_DEVICE_IO, _SC_DEVICE_SPECIFIC, _SC_DEVICE_SPECIFIC_R, _SC_FD_MGMT, _SC_FIFO, _SC_PIPE, _SC_FILE_ATTRIBUTES, _SC_FILE_LOCKING, _SC_FILE_SYSTEM, _SC_MONOTONIC_CLOCK, _SC_MULTI_PROCESS, _SC_SINGLE_PROCESS, _SC_NETWORKING, _SC_READER_WRITER_LOCKS, _SC_SPIN_LOCKS, _SC_REGEXP, _SC_REGEX_VERSION, _SC_SHELL, _SC_SIGNALS, _SC_SPAWN, _SC_SPORADIC_SERVER, _SC_THREAD_SPORADIC_SERVER, _SC_SYSTEM_DATABASE, _SC_SYSTEM_DATABASE_R, _SC_TIMEOUTS, _SC_TYPED_MEMORY_OBJECTS, _SC_USER_GROUPS, _SC_USER_GROUPS_R, _SC_2_PBS, _SC_2_PBS_ACCOUNTING, _SC_2_PBS_LOCATE, _SC_2_PBS_MESSAGE, _SC_2_PBS_TRACK, _SC_SYMLOOP_MAX, _SC_STREAMS, _SC_2_PBS_CHECKPOINT, _SC_V6_ILP32_OFF32, _SC_V6_ILP32_OFFBIG, _SC_V6_LP64_OFF64, _SC_V6_LPBIG_OFFBIG, _SC_HOST_NAME_MAX, _SC_TRACE, _SC_TRACE_EVENT_FILTER, _SC_TRACE_INHERIT, _SC_TRACE_LOG, _SC_LEVEL1_ICACHE_SIZE, _SC_LEVEL1_ICACHE_ASSOC, _SC_LEVEL1_ICACHE_LINESIZE, _SC_LEVEL1_DCACHE_SIZE, _SC_LEVEL1_DCACHE_ASSOC, _SC_LEVEL1_DCACHE_LINESIZE, _SC_LEVEL2_CACHE_SIZE, _SC_LEVEL2_CACHE_ASSOC, _SC_LEVEL2_CACHE_LINESIZE, _SC_LEVEL3_CACHE_SIZE, _SC_LEVEL3_CACHE_ASSOC, _SC_LEVEL3_CACHE_LINESIZE, _SC_LEVEL4_CACHE_SIZE, _SC_LEVEL4_CACHE_ASSOC, _SC_LEVEL4_CACHE_LINESIZE, _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50, _SC_RAW_SOCKETS, _SC_V7_ILP32_OFF32, _SC_V7_ILP32_OFFBIG, _SC_V7_LP64_OFF64, _SC_V7_LPBIG_OFFBIG, _SC_SS_REPL_MAX, _SC_TRACE_EVENT_NAME_MAX, _SC_TRACE_NAME_MAX, _SC_TRACE_SYS_MAX, _SC_TRACE_USER_EVENT_MAX, _SC_XOPEN_STREAMS, _SC_THREAD_ROBUST_PRIO_INHERIT, _SC_THREAD_ROBUST_PRIO_PROTECT }; enum { _CS_PATH, _CS_V6_WIDTH_RESTRICTED_ENVS, _CS_GNU_LIBC_VERSION, _CS_GNU_LIBPTHREAD_VERSION, _CS_V5_WIDTH_RESTRICTED_ENVS, _CS_V7_WIDTH_RESTRICTED_ENVS, _CS_LFS_CFLAGS = 1000, _CS_LFS_LDFLAGS, _CS_LFS_LIBS, _CS_LFS_LINTFLAGS, _CS_LFS64_CFLAGS, _CS_LFS64_LDFLAGS, _CS_LFS64_LIBS, _CS_LFS64_LINTFLAGS, _CS_XBS5_ILP32_OFF32_CFLAGS = 1100, _CS_XBS5_ILP32_OFF32_LDFLAGS, _CS_XBS5_ILP32_OFF32_LIBS, _CS_XBS5_ILP32_OFF32_LINTFLAGS, _CS_XBS5_ILP32_OFFBIG_CFLAGS, _CS_XBS5_ILP32_OFFBIG_LDFLAGS, _CS_XBS5_ILP32_OFFBIG_LIBS, _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, _CS_XBS5_LP64_OFF64_CFLAGS, _CS_XBS5_LP64_OFF64_LDFLAGS, _CS_XBS5_LP64_OFF64_LIBS, _CS_XBS5_LP64_OFF64_LINTFLAGS, _CS_XBS5_LPBIG_OFFBIG_CFLAGS, _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, _CS_XBS5_LPBIG_OFFBIG_LIBS, _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, _CS_POSIX_V6_ILP32_OFF32_CFLAGS, _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, _CS_POSIX_V6_ILP32_OFF32_LIBS, _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, _CS_POSIX_V6_ILP32_OFFBIG_LIBS, _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, _CS_POSIX_V6_LP64_OFF64_CFLAGS, _CS_POSIX_V6_LP64_OFF64_LDFLAGS, _CS_POSIX_V6_LP64_OFF64_LIBS, _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, _CS_POSIX_V7_ILP32_OFF32_CFLAGS, _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, _CS_POSIX_V7_ILP32_OFF32_LIBS, _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, _CS_POSIX_V7_ILP32_OFFBIG_LIBS, _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, _CS_POSIX_V7_LP64_OFF64_CFLAGS, _CS_POSIX_V7_LP64_OFF64_LDFLAGS, _CS_POSIX_V7_LP64_OFF64_LIBS, _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, _CS_V6_ENV, _CS_V7_ENV }; # 610 "/usr/include/unistd.h" 2 3 4 extern long int pathconf (const char *__path, int __name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); extern long int fpathconf (int __fd, int __name) __attribute__ ((__nothrow__ , __leaf__)); extern long int sysconf (int __name) __attribute__ ((__nothrow__ , __leaf__)); extern size_t confstr (int __name, char *__buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)); extern __pid_t getpid (void) __attribute__ ((__nothrow__ , __leaf__)); extern __pid_t getppid (void) __attribute__ ((__nothrow__ , __leaf__)); extern __pid_t getpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); extern __pid_t __getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); extern __pid_t getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); extern int setpgid (__pid_t __pid, __pid_t __pgid) __attribute__ ((__nothrow__ , __leaf__)); # 660 "/usr/include/unistd.h" 3 4 extern int setpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); extern __pid_t setsid (void) __attribute__ ((__nothrow__ , __leaf__)); extern __pid_t getsid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); extern __uid_t getuid (void) __attribute__ ((__nothrow__ , __leaf__)); extern __uid_t geteuid (void) __attribute__ ((__nothrow__ , __leaf__)); extern __gid_t getgid (void) __attribute__ ((__nothrow__ , __leaf__)); extern __gid_t getegid (void) __attribute__ ((__nothrow__ , __leaf__)); extern int getgroups (int __size, __gid_t __list[]) __attribute__ ((__nothrow__ , __leaf__)) ; # 700 "/usr/include/unistd.h" 3 4 extern int setuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; extern int setreuid (__uid_t __ruid, __uid_t __euid) __attribute__ ((__nothrow__ , __leaf__)) ; extern int seteuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; extern int setgid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; extern int setregid (__gid_t __rgid, __gid_t __egid) __attribute__ ((__nothrow__ , __leaf__)) ; extern int setegid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; # 756 "/usr/include/unistd.h" 3 4 extern __pid_t fork (void) __attribute__ ((__nothrow__)); extern __pid_t vfork (void) __attribute__ ((__nothrow__ , __leaf__)); extern char *ttyname (int __fd) __attribute__ ((__nothrow__ , __leaf__)); extern int ttyname_r (int __fd, char *__buf, size_t __buflen) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; extern int isatty (int __fd) __attribute__ ((__nothrow__ , __leaf__)); extern int ttyslot (void) __attribute__ ((__nothrow__ , __leaf__)); extern int link (const char *__from, const char *__to) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; extern int linkat (int __fromfd, const char *__from, int __tofd, const char *__to, int __flags) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))) ; extern int symlink (const char *__from, const char *__to) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; extern ssize_t readlink (const char *__restrict __path, char *__restrict __buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; extern int symlinkat (const char *__from, int __tofd, const char *__to) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))) ; extern ssize_t readlinkat (int __fd, const char *__restrict __path, char *__restrict __buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))) ; extern int unlink (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); extern int unlinkat (int __fd, const char *__name, int __flag) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); extern int rmdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); extern __pid_t tcgetpgrp (int __fd) __attribute__ ((__nothrow__ , __leaf__)); extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __attribute__ ((__nothrow__ , __leaf__)); extern char *getlogin (void); extern int getlogin_r (char *__name, size_t __name_len) __attribute__ ((__nonnull__ (1))); extern int setlogin (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); # 1 "/usr/include/x86_64-linux-gnu/bits/getopt_posix.h" 1 3 4 # 27 "/usr/include/x86_64-linux-gnu/bits/getopt_posix.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/getopt_core.h" 1 3 4 # 28 "/usr/include/x86_64-linux-gnu/bits/getopt_core.h" 3 4 extern char *optarg; # 50 "/usr/include/x86_64-linux-gnu/bits/getopt_core.h" 3 4 extern int optind; extern int opterr; extern int optopt; # 91 "/usr/include/x86_64-linux-gnu/bits/getopt_core.h" 3 4 extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); # 28 "/usr/include/x86_64-linux-gnu/bits/getopt_posix.h" 2 3 4 # 49 "/usr/include/x86_64-linux-gnu/bits/getopt_posix.h" 3 4 # 870 "/usr/include/unistd.h" 2 3 4 extern int gethostname (char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); extern int sethostname (const char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; extern int sethostid (long int __id) __attribute__ ((__nothrow__ , __leaf__)) ; extern int getdomainname (char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; extern int setdomainname (const char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; extern int vhangup (void) __attribute__ ((__nothrow__ , __leaf__)); extern int revoke (const char *__file) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; extern int profil (unsigned short int *__sample_buffer, size_t __size, size_t __offset, unsigned int __scale) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); extern int acct (const char *__name) __attribute__ ((__nothrow__ , __leaf__)); extern char *getusershell (void) __attribute__ ((__nothrow__ , __leaf__)); extern void endusershell (void) __attribute__ ((__nothrow__ , __leaf__)); extern void setusershell (void) __attribute__ ((__nothrow__ , __leaf__)); extern int daemon (int __nochdir, int __noclose) __attribute__ ((__nothrow__ , __leaf__)) ; extern int chroot (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; extern char *getpass (const char *__prompt) __attribute__ ((__nonnull__ (1))); extern int fsync (int __fd); # 967 "/usr/include/unistd.h" 3 4 extern long int gethostid (void); extern void sync (void) __attribute__ ((__nothrow__ , __leaf__)); extern int getpagesize (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern int getdtablesize (void) __attribute__ ((__nothrow__ , __leaf__)); # 991 "/usr/include/unistd.h" 3 4 extern int truncate (const char *__file, __off_t __length) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; # 1014 "/usr/include/unistd.h" 3 4 extern int ftruncate (int __fd, __off_t __length) __attribute__ ((__nothrow__ , __leaf__)) ; # 1035 "/usr/include/unistd.h" 3 4 extern int brk (void *__addr) __attribute__ ((__nothrow__ , __leaf__)) ; extern void *sbrk (intptr_t __delta) __attribute__ ((__nothrow__ , __leaf__)); # 1056 "/usr/include/unistd.h" 3 4 extern long int syscall (long int __sysno, ...) __attribute__ ((__nothrow__ , __leaf__)); # 1079 "/usr/include/unistd.h" 3 4 extern int lockf (int __fd, int __cmd, __off_t __len) ; # 1115 "/usr/include/unistd.h" 3 4 extern int fdatasync (int __fildes); # 1124 "/usr/include/unistd.h" 3 4 extern char *crypt (const char *__key, const char *__salt) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); # 1161 "/usr/include/unistd.h" 3 4 int getentropy (void *__buffer, size_t __length) ; # 1170 "/usr/include/unistd.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/unistd_ext.h" 1 3 4 # 1171 "/usr/include/unistd.h" 2 3 4 # 10 "./stencils/fdtd-2d/fdtd-2d.c" 2 # 1 "/usr/include/string.h" 1 3 4 # 26 "/usr/include/string.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/libc-header-start.h" 1 3 4 # 27 "/usr/include/string.h" 2 3 4 # 1 "/usr/lib/gcc/x86_64-linux-gnu/9/include/stddef.h" 1 3 4 # 34 "/usr/include/string.h" 2 3 4 # 43 "/usr/include/string.h" 3 4 extern void *memcpy (void *__restrict __dest, const void *__restrict __src, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern void *memmove (void *__dest, const void *__src, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern void *memccpy (void *__restrict __dest, const void *__restrict __src, int __c, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern void *memset (void *__s, int __c, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); extern int memcmp (const void *__s1, const void *__s2, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); # 91 "/usr/include/string.h" 3 4 extern void *memchr (const void *__s, int __c, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); # 122 "/usr/include/string.h" 3 4 extern char *strcpy (char *__restrict __dest, const char *__restrict __src) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern char *strncpy (char *__restrict __dest, const char *__restrict __src, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern char *strcat (char *__restrict __dest, const char *__restrict __src) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern char *strncat (char *__restrict __dest, const char *__restrict __src, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern int strcmp (const char *__s1, const char *__s2) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); extern int strncmp (const char *__s1, const char *__s2, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); extern int strcoll (const char *__s1, const char *__s2) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); extern size_t strxfrm (char *__restrict __dest, const char *__restrict __src, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); # 1 "/usr/include/x86_64-linux-gnu/bits/types/locale_t.h" 1 3 4 # 22 "/usr/include/x86_64-linux-gnu/bits/types/locale_t.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/types/__locale_t.h" 1 3 4 # 28 "/usr/include/x86_64-linux-gnu/bits/types/__locale_t.h" 3 4 struct __locale_struct { struct __locale_data *__locales[13]; const unsigned short int *__ctype_b; const int *__ctype_tolower; const int *__ctype_toupper; const char *__names[13]; }; typedef struct __locale_struct *__locale_t; # 23 "/usr/include/x86_64-linux-gnu/bits/types/locale_t.h" 2 3 4 typedef __locale_t locale_t; # 154 "/usr/include/string.h" 2 3 4 extern int strcoll_l (const char *__s1, const char *__s2, locale_t __l) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 3))); extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n, locale_t __l) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); extern char *strdup (const char *__s) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); extern char *strndup (const char *__string, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); # 226 "/usr/include/string.h" 3 4 extern char *strchr (const char *__s, int __c) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); # 253 "/usr/include/string.h" 3 4 extern char *strrchr (const char *__s, int __c) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); # 273 "/usr/include/string.h" 3 4 extern size_t strcspn (const char *__s, const char *__reject) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); extern size_t strspn (const char *__s, const char *__accept) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); # 303 "/usr/include/string.h" 3 4 extern char *strpbrk (const char *__s, const char *__accept) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); # 330 "/usr/include/string.h" 3 4 extern char *strstr (const char *__haystack, const char *__needle) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); extern char *strtok (char *__restrict __s, const char *__restrict __delim) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); extern char *__strtok_r (char *__restrict __s, const char *__restrict __delim, char **__restrict __save_ptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); extern char *strtok_r (char *__restrict __s, const char *__restrict __delim, char **__restrict __save_ptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); # 385 "/usr/include/string.h" 3 4 extern size_t strlen (const char *__s) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); extern size_t strnlen (const char *__string, size_t __maxlen) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); extern char *strerror (int __errnum) __attribute__ ((__nothrow__ , __leaf__)); # 410 "/usr/include/string.h" 3 4 extern int strerror_r (int __errnum, char *__buf, size_t __buflen) __asm__ ("" "__xpg_strerror_r") __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); # 428 "/usr/include/string.h" 3 4 extern char *strerror_l (int __errnum, locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); # 1 "/usr/include/strings.h" 1 3 4 # 23 "/usr/include/strings.h" 3 4 # 1 "/usr/lib/gcc/x86_64-linux-gnu/9/include/stddef.h" 1 3 4 # 24 "/usr/include/strings.h" 2 3 4 extern int bcmp (const void *__s1, const void *__s2, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); extern void bcopy (const void *__src, void *__dest, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern void bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); # 68 "/usr/include/strings.h" 3 4 extern char *index (const char *__s, int __c) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); # 96 "/usr/include/strings.h" 3 4 extern char *rindex (const char *__s, int __c) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); extern int ffs (int __i) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern int ffsl (long int __l) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); __extension__ extern int ffsll (long long int __ll) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern int strcasecmp (const char *__s1, const char *__s2) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); extern int strncasecmp (const char *__s1, const char *__s2, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); extern int strcasecmp_l (const char *__s1, const char *__s2, locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 3))); extern int strncasecmp_l (const char *__s1, const char *__s2, size_t __n, locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 4))); # 433 "/usr/include/string.h" 2 3 4 extern void explicit_bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); extern char *strsep (char **__restrict __stringp, const char *__restrict __delim) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern char *strsignal (int __sig) __attribute__ ((__nothrow__ , __leaf__)); extern char *__stpcpy (char *__restrict __dest, const char *__restrict __src) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern char *stpcpy (char *__restrict __dest, const char *__restrict __src) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern char *__stpncpy (char *__restrict __dest, const char *__restrict __src, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern char *stpncpy (char *__restrict __dest, const char *__restrict __src, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); # 499 "/usr/include/string.h" 3 4 # 11 "./stencils/fdtd-2d/fdtd-2d.c" 2 # 1 "/usr/include/math.h" 1 3 4 # 27 "/usr/include/math.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/libc-header-start.h" 1 3 4 # 28 "/usr/include/math.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/math-vector.h" 1 3 4 # 25 "/usr/include/x86_64-linux-gnu/bits/math-vector.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h" 1 3 4 # 26 "/usr/include/x86_64-linux-gnu/bits/math-vector.h" 2 3 4 # 41 "/usr/include/math.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/floatn.h" 1 3 4 # 120 "/usr/include/x86_64-linux-gnu/bits/floatn.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/floatn-common.h" 1 3 4 # 24 "/usr/include/x86_64-linux-gnu/bits/floatn-common.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/long-double.h" 1 3 4 # 25 "/usr/include/x86_64-linux-gnu/bits/floatn-common.h" 2 3 4 # 121 "/usr/include/x86_64-linux-gnu/bits/floatn.h" 2 3 4 # 44 "/usr/include/math.h" 2 3 4 # 138 "/usr/include/math.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/flt-eval-method.h" 1 3 4 # 139 "/usr/include/math.h" 2 3 4 # 149 "/usr/include/math.h" 3 4 typedef float float_t; typedef double double_t; # 190 "/usr/include/math.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/fp-logb.h" 1 3 4 # 191 "/usr/include/math.h" 2 3 4 # 233 "/usr/include/math.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/fp-fast.h" 1 3 4 # 234 "/usr/include/math.h" 2 3 4 # 289 "/usr/include/math.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/mathcalls-helper-functions.h" 1 3 4 # 21 "/usr/include/x86_64-linux-gnu/bits/mathcalls-helper-functions.h" 3 4 extern int __fpclassify (double __value) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern int __signbit (double __value) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern int __isinf (double __value) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern int __finite (double __value) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern int __isnan (double __value) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern int __iseqsig (double __x, double __y) __attribute__ ((__nothrow__ , __leaf__)); extern int __issignaling (double __value) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); # 290 "/usr/include/math.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/mathcalls.h" 1 3 4 # 53 "/usr/include/x86_64-linux-gnu/bits/mathcalls.h" 3 4 extern double acos (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double __acos (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double asin (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double __asin (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double atan (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double __atan (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double atan2 (double __y, double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double __atan2 (double __y, double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double cos (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double __cos (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double sin (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double __sin (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double tan (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double __tan (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double cosh (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double __cosh (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double sinh (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double __sinh (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double tanh (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double __tanh (double __x) __attribute__ ((__nothrow__ , __leaf__)); # 85 "/usr/include/x86_64-linux-gnu/bits/mathcalls.h" 3 4 extern double acosh (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double __acosh (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double asinh (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double __asinh (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double atanh (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double __atanh (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double exp (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double __exp (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double frexp (double __x, int *__exponent) __attribute__ ((__nothrow__ , __leaf__)); extern double __frexp (double __x, int *__exponent) __attribute__ ((__nothrow__ , __leaf__)); extern double ldexp (double __x, int __exponent) __attribute__ ((__nothrow__ , __leaf__)); extern double __ldexp (double __x, int __exponent) __attribute__ ((__nothrow__ , __leaf__)); extern double log (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double __log (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double log10 (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double __log10 (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double modf (double __x, double *__iptr) __attribute__ ((__nothrow__ , __leaf__)); extern double __modf (double __x, double *__iptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); # 119 "/usr/include/x86_64-linux-gnu/bits/mathcalls.h" 3 4 extern double expm1 (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double __expm1 (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double log1p (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double __log1p (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double logb (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double __logb (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double exp2 (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double __exp2 (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double log2 (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double __log2 (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double pow (double __x, double __y) __attribute__ ((__nothrow__ , __leaf__)); extern double __pow (double __x, double __y) __attribute__ ((__nothrow__ , __leaf__)); extern double sqrt (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double __sqrt (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double hypot (double __x, double __y) __attribute__ ((__nothrow__ , __leaf__)); extern double __hypot (double __x, double __y) __attribute__ ((__nothrow__ , __leaf__)); extern double cbrt (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double __cbrt (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double ceil (double __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern double __ceil (double __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern double fabs (double __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern double __fabs (double __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern double floor (double __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern double __floor (double __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern double fmod (double __x, double __y) __attribute__ ((__nothrow__ , __leaf__)); extern double __fmod (double __x, double __y) __attribute__ ((__nothrow__ , __leaf__)); # 177 "/usr/include/x86_64-linux-gnu/bits/mathcalls.h" 3 4 extern int isinf (double __value) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern int finite (double __value) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern double drem (double __x, double __y) __attribute__ ((__nothrow__ , __leaf__)); extern double __drem (double __x, double __y) __attribute__ ((__nothrow__ , __leaf__)); extern double significand (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double __significand (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double copysign (double __x, double __y) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern double __copysign (double __x, double __y) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern double nan (const char *__tagb) __attribute__ ((__nothrow__ , __leaf__)); extern double __nan (const char *__tagb) __attribute__ ((__nothrow__ , __leaf__)); # 211 "/usr/include/x86_64-linux-gnu/bits/mathcalls.h" 3 4 extern int isnan (double __value) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern double j0 (double) __attribute__ ((__nothrow__ , __leaf__)); extern double __j0 (double) __attribute__ ((__nothrow__ , __leaf__)); extern double j1 (double) __attribute__ ((__nothrow__ , __leaf__)); extern double __j1 (double) __attribute__ ((__nothrow__ , __leaf__)); extern double jn (int, double) __attribute__ ((__nothrow__ , __leaf__)); extern double __jn (int, double) __attribute__ ((__nothrow__ , __leaf__)); extern double y0 (double) __attribute__ ((__nothrow__ , __leaf__)); extern double __y0 (double) __attribute__ ((__nothrow__ , __leaf__)); extern double y1 (double) __attribute__ ((__nothrow__ , __leaf__)); extern double __y1 (double) __attribute__ ((__nothrow__ , __leaf__)); extern double yn (int, double) __attribute__ ((__nothrow__ , __leaf__)); extern double __yn (int, double) __attribute__ ((__nothrow__ , __leaf__)); extern double erf (double) __attribute__ ((__nothrow__ , __leaf__)); extern double __erf (double) __attribute__ ((__nothrow__ , __leaf__)); extern double erfc (double) __attribute__ ((__nothrow__ , __leaf__)); extern double __erfc (double) __attribute__ ((__nothrow__ , __leaf__)); extern double lgamma (double) __attribute__ ((__nothrow__ , __leaf__)); extern double __lgamma (double) __attribute__ ((__nothrow__ , __leaf__)); extern double tgamma (double) __attribute__ ((__nothrow__ , __leaf__)); extern double __tgamma (double) __attribute__ ((__nothrow__ , __leaf__)); extern double gamma (double) __attribute__ ((__nothrow__ , __leaf__)); extern double __gamma (double) __attribute__ ((__nothrow__ , __leaf__)); extern double lgamma_r (double, int *__signgamp) __attribute__ ((__nothrow__ , __leaf__)); extern double __lgamma_r (double, int *__signgamp) __attribute__ ((__nothrow__ , __leaf__)); extern double rint (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double __rint (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double nextafter (double __x, double __y) __attribute__ ((__nothrow__ , __leaf__)); extern double __nextafter (double __x, double __y) __attribute__ ((__nothrow__ , __leaf__)); extern double nexttoward (double __x, long double __y) __attribute__ ((__nothrow__ , __leaf__)); extern double __nexttoward (double __x, long double __y) __attribute__ ((__nothrow__ , __leaf__)); # 272 "/usr/include/x86_64-linux-gnu/bits/mathcalls.h" 3 4 extern double remainder (double __x, double __y) __attribute__ ((__nothrow__ , __leaf__)); extern double __remainder (double __x, double __y) __attribute__ ((__nothrow__ , __leaf__)); extern double scalbn (double __x, int __n) __attribute__ ((__nothrow__ , __leaf__)); extern double __scalbn (double __x, int __n) __attribute__ ((__nothrow__ , __leaf__)); extern int ilogb (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern int __ilogb (double __x) __attribute__ ((__nothrow__ , __leaf__)); # 290 "/usr/include/x86_64-linux-gnu/bits/mathcalls.h" 3 4 extern double scalbln (double __x, long int __n) __attribute__ ((__nothrow__ , __leaf__)); extern double __scalbln (double __x, long int __n) __attribute__ ((__nothrow__ , __leaf__)); extern double nearbyint (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double __nearbyint (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double round (double __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern double __round (double __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern double trunc (double __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern double __trunc (double __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern double remquo (double __x, double __y, int *__quo) __attribute__ ((__nothrow__ , __leaf__)); extern double __remquo (double __x, double __y, int *__quo) __attribute__ ((__nothrow__ , __leaf__)); extern long int lrint (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long int __lrint (double __x) __attribute__ ((__nothrow__ , __leaf__)); __extension__ extern long long int llrint (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long long int __llrint (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long int lround (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long int __lround (double __x) __attribute__ ((__nothrow__ , __leaf__)); __extension__ extern long long int llround (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long long int __llround (double __x) __attribute__ ((__nothrow__ , __leaf__)); extern double fdim (double __x, double __y) __attribute__ ((__nothrow__ , __leaf__)); extern double __fdim (double __x, double __y) __attribute__ ((__nothrow__ , __leaf__)); extern double fmax (double __x, double __y) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern double __fmax (double __x, double __y) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern double fmin (double __x, double __y) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern double __fmin (double __x, double __y) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern double fma (double __x, double __y, double __z) __attribute__ ((__nothrow__ , __leaf__)); extern double __fma (double __x, double __y, double __z) __attribute__ ((__nothrow__ , __leaf__)); # 400 "/usr/include/x86_64-linux-gnu/bits/mathcalls.h" 3 4 extern double scalb (double __x, double __n) __attribute__ ((__nothrow__ , __leaf__)); extern double __scalb (double __x, double __n) __attribute__ ((__nothrow__ , __leaf__)); # 291 "/usr/include/math.h" 2 3 4 # 306 "/usr/include/math.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/mathcalls-helper-functions.h" 1 3 4 # 21 "/usr/include/x86_64-linux-gnu/bits/mathcalls-helper-functions.h" 3 4 extern int __fpclassifyf (float __value) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern int __signbitf (float __value) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern int __isinff (float __value) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern int __finitef (float __value) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern int __isnanf (float __value) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern int __iseqsigf (float __x, float __y) __attribute__ ((__nothrow__ , __leaf__)); extern int __issignalingf (float __value) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); # 307 "/usr/include/math.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/mathcalls.h" 1 3 4 # 53 "/usr/include/x86_64-linux-gnu/bits/mathcalls.h" 3 4 extern float acosf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float __acosf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float asinf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float __asinf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float atanf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float __atanf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float atan2f (float __y, float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float __atan2f (float __y, float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float cosf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float __cosf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float sinf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float __sinf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float tanf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float __tanf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float coshf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float __coshf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float sinhf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float __sinhf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float tanhf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float __tanhf (float __x) __attribute__ ((__nothrow__ , __leaf__)); # 85 "/usr/include/x86_64-linux-gnu/bits/mathcalls.h" 3 4 extern float acoshf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float __acoshf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float asinhf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float __asinhf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float atanhf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float __atanhf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float expf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float __expf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float frexpf (float __x, int *__exponent) __attribute__ ((__nothrow__ , __leaf__)); extern float __frexpf (float __x, int *__exponent) __attribute__ ((__nothrow__ , __leaf__)); extern float ldexpf (float __x, int __exponent) __attribute__ ((__nothrow__ , __leaf__)); extern float __ldexpf (float __x, int __exponent) __attribute__ ((__nothrow__ , __leaf__)); extern float logf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float __logf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float log10f (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float __log10f (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float modff (float __x, float *__iptr) __attribute__ ((__nothrow__ , __leaf__)); extern float __modff (float __x, float *__iptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); # 119 "/usr/include/x86_64-linux-gnu/bits/mathcalls.h" 3 4 extern float expm1f (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float __expm1f (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float log1pf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float __log1pf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float logbf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float __logbf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float exp2f (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float __exp2f (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float log2f (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float __log2f (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float powf (float __x, float __y) __attribute__ ((__nothrow__ , __leaf__)); extern float __powf (float __x, float __y) __attribute__ ((__nothrow__ , __leaf__)); extern float sqrtf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float __sqrtf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float hypotf (float __x, float __y) __attribute__ ((__nothrow__ , __leaf__)); extern float __hypotf (float __x, float __y) __attribute__ ((__nothrow__ , __leaf__)); extern float cbrtf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float __cbrtf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float ceilf (float __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern float __ceilf (float __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern float fabsf (float __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern float __fabsf (float __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern float floorf (float __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern float __floorf (float __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern float fmodf (float __x, float __y) __attribute__ ((__nothrow__ , __leaf__)); extern float __fmodf (float __x, float __y) __attribute__ ((__nothrow__ , __leaf__)); # 177 "/usr/include/x86_64-linux-gnu/bits/mathcalls.h" 3 4 extern int isinff (float __value) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern int finitef (float __value) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern float dremf (float __x, float __y) __attribute__ ((__nothrow__ , __leaf__)); extern float __dremf (float __x, float __y) __attribute__ ((__nothrow__ , __leaf__)); extern float significandf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float __significandf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float copysignf (float __x, float __y) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern float __copysignf (float __x, float __y) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern float nanf (const char *__tagb) __attribute__ ((__nothrow__ , __leaf__)); extern float __nanf (const char *__tagb) __attribute__ ((__nothrow__ , __leaf__)); # 211 "/usr/include/x86_64-linux-gnu/bits/mathcalls.h" 3 4 extern int isnanf (float __value) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern float j0f (float) __attribute__ ((__nothrow__ , __leaf__)); extern float __j0f (float) __attribute__ ((__nothrow__ , __leaf__)); extern float j1f (float) __attribute__ ((__nothrow__ , __leaf__)); extern float __j1f (float) __attribute__ ((__nothrow__ , __leaf__)); extern float jnf (int, float) __attribute__ ((__nothrow__ , __leaf__)); extern float __jnf (int, float) __attribute__ ((__nothrow__ , __leaf__)); extern float y0f (float) __attribute__ ((__nothrow__ , __leaf__)); extern float __y0f (float) __attribute__ ((__nothrow__ , __leaf__)); extern float y1f (float) __attribute__ ((__nothrow__ , __leaf__)); extern float __y1f (float) __attribute__ ((__nothrow__ , __leaf__)); extern float ynf (int, float) __attribute__ ((__nothrow__ , __leaf__)); extern float __ynf (int, float) __attribute__ ((__nothrow__ , __leaf__)); extern float erff (float) __attribute__ ((__nothrow__ , __leaf__)); extern float __erff (float) __attribute__ ((__nothrow__ , __leaf__)); extern float erfcf (float) __attribute__ ((__nothrow__ , __leaf__)); extern float __erfcf (float) __attribute__ ((__nothrow__ , __leaf__)); extern float lgammaf (float) __attribute__ ((__nothrow__ , __leaf__)); extern float __lgammaf (float) __attribute__ ((__nothrow__ , __leaf__)); extern float tgammaf (float) __attribute__ ((__nothrow__ , __leaf__)); extern float __tgammaf (float) __attribute__ ((__nothrow__ , __leaf__)); extern float gammaf (float) __attribute__ ((__nothrow__ , __leaf__)); extern float __gammaf (float) __attribute__ ((__nothrow__ , __leaf__)); extern float lgammaf_r (float, int *__signgamp) __attribute__ ((__nothrow__ , __leaf__)); extern float __lgammaf_r (float, int *__signgamp) __attribute__ ((__nothrow__ , __leaf__)); extern float rintf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float __rintf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float nextafterf (float __x, float __y) __attribute__ ((__nothrow__ , __leaf__)); extern float __nextafterf (float __x, float __y) __attribute__ ((__nothrow__ , __leaf__)); extern float nexttowardf (float __x, long double __y) __attribute__ ((__nothrow__ , __leaf__)); extern float __nexttowardf (float __x, long double __y) __attribute__ ((__nothrow__ , __leaf__)); # 272 "/usr/include/x86_64-linux-gnu/bits/mathcalls.h" 3 4 extern float remainderf (float __x, float __y) __attribute__ ((__nothrow__ , __leaf__)); extern float __remainderf (float __x, float __y) __attribute__ ((__nothrow__ , __leaf__)); extern float scalbnf (float __x, int __n) __attribute__ ((__nothrow__ , __leaf__)); extern float __scalbnf (float __x, int __n) __attribute__ ((__nothrow__ , __leaf__)); extern int ilogbf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern int __ilogbf (float __x) __attribute__ ((__nothrow__ , __leaf__)); # 290 "/usr/include/x86_64-linux-gnu/bits/mathcalls.h" 3 4 extern float scalblnf (float __x, long int __n) __attribute__ ((__nothrow__ , __leaf__)); extern float __scalblnf (float __x, long int __n) __attribute__ ((__nothrow__ , __leaf__)); extern float nearbyintf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float __nearbyintf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float roundf (float __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern float __roundf (float __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern float truncf (float __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern float __truncf (float __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern float remquof (float __x, float __y, int *__quo) __attribute__ ((__nothrow__ , __leaf__)); extern float __remquof (float __x, float __y, int *__quo) __attribute__ ((__nothrow__ , __leaf__)); extern long int lrintf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern long int __lrintf (float __x) __attribute__ ((__nothrow__ , __leaf__)); __extension__ extern long long int llrintf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern long long int __llrintf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern long int lroundf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern long int __lroundf (float __x) __attribute__ ((__nothrow__ , __leaf__)); __extension__ extern long long int llroundf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern long long int __llroundf (float __x) __attribute__ ((__nothrow__ , __leaf__)); extern float fdimf (float __x, float __y) __attribute__ ((__nothrow__ , __leaf__)); extern float __fdimf (float __x, float __y) __attribute__ ((__nothrow__ , __leaf__)); extern float fmaxf (float __x, float __y) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern float __fmaxf (float __x, float __y) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern float fminf (float __x, float __y) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern float __fminf (float __x, float __y) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern float fmaf (float __x, float __y, float __z) __attribute__ ((__nothrow__ , __leaf__)); extern float __fmaf (float __x, float __y, float __z) __attribute__ ((__nothrow__ , __leaf__)); # 400 "/usr/include/x86_64-linux-gnu/bits/mathcalls.h" 3 4 extern float scalbf (float __x, float __n) __attribute__ ((__nothrow__ , __leaf__)); extern float __scalbf (float __x, float __n) __attribute__ ((__nothrow__ , __leaf__)); # 308 "/usr/include/math.h" 2 3 4 # 349 "/usr/include/math.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/mathcalls-helper-functions.h" 1 3 4 # 21 "/usr/include/x86_64-linux-gnu/bits/mathcalls-helper-functions.h" 3 4 extern int __fpclassifyl (long double __value) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern int __signbitl (long double __value) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern int __isinfl (long double __value) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern int __finitel (long double __value) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern int __isnanl (long double __value) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern int __iseqsigl (long double __x, long double __y) __attribute__ ((__nothrow__ , __leaf__)); extern int __issignalingl (long double __value) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); # 350 "/usr/include/math.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/mathcalls.h" 1 3 4 # 53 "/usr/include/x86_64-linux-gnu/bits/mathcalls.h" 3 4 extern long double acosl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double __acosl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double asinl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double __asinl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double atanl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double __atanl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double atan2l (long double __y, long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double __atan2l (long double __y, long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double cosl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double __cosl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double sinl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double __sinl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double tanl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double __tanl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double coshl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double __coshl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double sinhl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double __sinhl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double tanhl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double __tanhl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); # 85 "/usr/include/x86_64-linux-gnu/bits/mathcalls.h" 3 4 extern long double acoshl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double __acoshl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double asinhl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double __asinhl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double atanhl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double __atanhl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double expl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double __expl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double frexpl (long double __x, int *__exponent) __attribute__ ((__nothrow__ , __leaf__)); extern long double __frexpl (long double __x, int *__exponent) __attribute__ ((__nothrow__ , __leaf__)); extern long double ldexpl (long double __x, int __exponent) __attribute__ ((__nothrow__ , __leaf__)); extern long double __ldexpl (long double __x, int __exponent) __attribute__ ((__nothrow__ , __leaf__)); extern long double logl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double __logl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double log10l (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double __log10l (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double modfl (long double __x, long double *__iptr) __attribute__ ((__nothrow__ , __leaf__)); extern long double __modfl (long double __x, long double *__iptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); # 119 "/usr/include/x86_64-linux-gnu/bits/mathcalls.h" 3 4 extern long double expm1l (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double __expm1l (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double log1pl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double __log1pl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double logbl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double __logbl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double exp2l (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double __exp2l (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double log2l (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double __log2l (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double powl (long double __x, long double __y) __attribute__ ((__nothrow__ , __leaf__)); extern long double __powl (long double __x, long double __y) __attribute__ ((__nothrow__ , __leaf__)); extern long double sqrtl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double __sqrtl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double hypotl (long double __x, long double __y) __attribute__ ((__nothrow__ , __leaf__)); extern long double __hypotl (long double __x, long double __y) __attribute__ ((__nothrow__ , __leaf__)); extern long double cbrtl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double __cbrtl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double ceill (long double __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern long double __ceill (long double __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern long double fabsl (long double __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern long double __fabsl (long double __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern long double floorl (long double __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern long double __floorl (long double __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern long double fmodl (long double __x, long double __y) __attribute__ ((__nothrow__ , __leaf__)); extern long double __fmodl (long double __x, long double __y) __attribute__ ((__nothrow__ , __leaf__)); # 177 "/usr/include/x86_64-linux-gnu/bits/mathcalls.h" 3 4 extern int isinfl (long double __value) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern int finitel (long double __value) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern long double dreml (long double __x, long double __y) __attribute__ ((__nothrow__ , __leaf__)); extern long double __dreml (long double __x, long double __y) __attribute__ ((__nothrow__ , __leaf__)); extern long double significandl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double __significandl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double copysignl (long double __x, long double __y) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern long double __copysignl (long double __x, long double __y) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern long double nanl (const char *__tagb) __attribute__ ((__nothrow__ , __leaf__)); extern long double __nanl (const char *__tagb) __attribute__ ((__nothrow__ , __leaf__)); # 211 "/usr/include/x86_64-linux-gnu/bits/mathcalls.h" 3 4 extern int isnanl (long double __value) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern long double j0l (long double) __attribute__ ((__nothrow__ , __leaf__)); extern long double __j0l (long double) __attribute__ ((__nothrow__ , __leaf__)); extern long double j1l (long double) __attribute__ ((__nothrow__ , __leaf__)); extern long double __j1l (long double) __attribute__ ((__nothrow__ , __leaf__)); extern long double jnl (int, long double) __attribute__ ((__nothrow__ , __leaf__)); extern long double __jnl (int, long double) __attribute__ ((__nothrow__ , __leaf__)); extern long double y0l (long double) __attribute__ ((__nothrow__ , __leaf__)); extern long double __y0l (long double) __attribute__ ((__nothrow__ , __leaf__)); extern long double y1l (long double) __attribute__ ((__nothrow__ , __leaf__)); extern long double __y1l (long double) __attribute__ ((__nothrow__ , __leaf__)); extern long double ynl (int, long double) __attribute__ ((__nothrow__ , __leaf__)); extern long double __ynl (int, long double) __attribute__ ((__nothrow__ , __leaf__)); extern long double erfl (long double) __attribute__ ((__nothrow__ , __leaf__)); extern long double __erfl (long double) __attribute__ ((__nothrow__ , __leaf__)); extern long double erfcl (long double) __attribute__ ((__nothrow__ , __leaf__)); extern long double __erfcl (long double) __attribute__ ((__nothrow__ , __leaf__)); extern long double lgammal (long double) __attribute__ ((__nothrow__ , __leaf__)); extern long double __lgammal (long double) __attribute__ ((__nothrow__ , __leaf__)); extern long double tgammal (long double) __attribute__ ((__nothrow__ , __leaf__)); extern long double __tgammal (long double) __attribute__ ((__nothrow__ , __leaf__)); extern long double gammal (long double) __attribute__ ((__nothrow__ , __leaf__)); extern long double __gammal (long double) __attribute__ ((__nothrow__ , __leaf__)); extern long double lgammal_r (long double, int *__signgamp) __attribute__ ((__nothrow__ , __leaf__)); extern long double __lgammal_r (long double, int *__signgamp) __attribute__ ((__nothrow__ , __leaf__)); extern long double rintl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double __rintl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double nextafterl (long double __x, long double __y) __attribute__ ((__nothrow__ , __leaf__)); extern long double __nextafterl (long double __x, long double __y) __attribute__ ((__nothrow__ , __leaf__)); extern long double nexttowardl (long double __x, long double __y) __attribute__ ((__nothrow__ , __leaf__)); extern long double __nexttowardl (long double __x, long double __y) __attribute__ ((__nothrow__ , __leaf__)); # 272 "/usr/include/x86_64-linux-gnu/bits/mathcalls.h" 3 4 extern long double remainderl (long double __x, long double __y) __attribute__ ((__nothrow__ , __leaf__)); extern long double __remainderl (long double __x, long double __y) __attribute__ ((__nothrow__ , __leaf__)); extern long double scalbnl (long double __x, int __n) __attribute__ ((__nothrow__ , __leaf__)); extern long double __scalbnl (long double __x, int __n) __attribute__ ((__nothrow__ , __leaf__)); extern int ilogbl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern int __ilogbl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); # 290 "/usr/include/x86_64-linux-gnu/bits/mathcalls.h" 3 4 extern long double scalblnl (long double __x, long int __n) __attribute__ ((__nothrow__ , __leaf__)); extern long double __scalblnl (long double __x, long int __n) __attribute__ ((__nothrow__ , __leaf__)); extern long double nearbyintl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double __nearbyintl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double roundl (long double __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern long double __roundl (long double __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern long double truncl (long double __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern long double __truncl (long double __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern long double remquol (long double __x, long double __y, int *__quo) __attribute__ ((__nothrow__ , __leaf__)); extern long double __remquol (long double __x, long double __y, int *__quo) __attribute__ ((__nothrow__ , __leaf__)); extern long int lrintl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long int __lrintl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); __extension__ extern long long int llrintl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long long int __llrintl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long int lroundl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long int __lroundl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); __extension__ extern long long int llroundl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long long int __llroundl (long double __x) __attribute__ ((__nothrow__ , __leaf__)); extern long double fdiml (long double __x, long double __y) __attribute__ ((__nothrow__ , __leaf__)); extern long double __fdiml (long double __x, long double __y) __attribute__ ((__nothrow__ , __leaf__)); extern long double fmaxl (long double __x, long double __y) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern long double __fmaxl (long double __x, long double __y) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern long double fminl (long double __x, long double __y) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern long double __fminl (long double __x, long double __y) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern long double fmal (long double __x, long double __y, long double __z) __attribute__ ((__nothrow__ , __leaf__)); extern long double __fmal (long double __x, long double __y, long double __z) __attribute__ ((__nothrow__ , __leaf__)); # 400 "/usr/include/x86_64-linux-gnu/bits/mathcalls.h" 3 4 extern long double scalbl (long double __x, long double __n) __attribute__ ((__nothrow__ , __leaf__)); extern long double __scalbl (long double __x, long double __n) __attribute__ ((__nothrow__ , __leaf__)); # 351 "/usr/include/math.h" 2 3 4 # 420 "/usr/include/math.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/mathcalls-helper-functions.h" 1 3 4 # 21 "/usr/include/x86_64-linux-gnu/bits/mathcalls-helper-functions.h" 3 4 extern int __fpclassifyf128 ( # 21 "/usr/include/x86_64-linux-gnu/bits/mathcalls-helper-functions.h" float # 21 "/usr/include/x86_64-linux-gnu/bits/mathcalls-helper-functions.h" 3 4 __value) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern int __signbitf128 ( # 25 "/usr/include/x86_64-linux-gnu/bits/mathcalls-helper-functions.h" float # 25 "/usr/include/x86_64-linux-gnu/bits/mathcalls-helper-functions.h" 3 4 __value) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern int __isinff128 ( # 30 "/usr/include/x86_64-linux-gnu/bits/mathcalls-helper-functions.h" float # 30 "/usr/include/x86_64-linux-gnu/bits/mathcalls-helper-functions.h" 3 4 __value) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern int __finitef128 ( # 33 "/usr/include/x86_64-linux-gnu/bits/mathcalls-helper-functions.h" float # 33 "/usr/include/x86_64-linux-gnu/bits/mathcalls-helper-functions.h" 3 4 __value) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern int __isnanf128 ( # 36 "/usr/include/x86_64-linux-gnu/bits/mathcalls-helper-functions.h" float # 36 "/usr/include/x86_64-linux-gnu/bits/mathcalls-helper-functions.h" 3 4 __value) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern int __iseqsigf128 ( # 39 "/usr/include/x86_64-linux-gnu/bits/mathcalls-helper-functions.h" float # 39 "/usr/include/x86_64-linux-gnu/bits/mathcalls-helper-functions.h" 3 4 __x, # 39 "/usr/include/x86_64-linux-gnu/bits/mathcalls-helper-functions.h" float # 39 "/usr/include/x86_64-linux-gnu/bits/mathcalls-helper-functions.h" 3 4 __y) __attribute__ ((__nothrow__ , __leaf__)); extern int __issignalingf128 ( # 42 "/usr/include/x86_64-linux-gnu/bits/mathcalls-helper-functions.h" float # 42 "/usr/include/x86_64-linux-gnu/bits/mathcalls-helper-functions.h" 3 4 __value) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); # 421 "/usr/include/math.h" 2 3 4 # 773 "/usr/include/math.h" 3 4 extern int signgam; # 853 "/usr/include/math.h" 3 4 enum { FP_NAN = 0, FP_INFINITE = 1, FP_ZERO = 2, FP_SUBNORMAL = 3, FP_NORMAL = 4 }; # 1338 "/usr/include/math.h" 3 4 # 12 "./stencils/fdtd-2d/fdtd-2d.c" 2 # 1 "utilities/polybench.h" 1 # 188 "utilities/polybench.h" # 188 "utilities/polybench.h" extern void* polybench_alloc_data(int n, int elt_size); # 15 "./stencils/fdtd-2d/fdtd-2d.c" 2 # 1 "./stencils/fdtd-2d/fdtd-2d.h" 1 # 19 "./stencils/fdtd-2d/fdtd-2d.c" 2 static void init_array (int nx, int ny, double ex[1000 + 0][1000 + 0], double ey[1000 + 0][1000 + 0], double hz[1000 + 0][1000 + 0], double _fict_[1000 + 0]) { int i, j; for (i = 0; i < ny; i++) _fict_[i] = (double) i; for (i = 0; i < nx; i++) for (j = 0; j < ny; j++) { ex[i][j] = ((double) i*(j+1)) / nx; ey[i][j] = ((double) i*(j+2)) / ny; hz[i][j] = ((double) i*(j+3)) / nx; } } static void print_array(int nx, int ny, double ex[1000 + 0][1000 + 0], double ey[1000 + 0][1000 + 0], double hz[1000 + 0][1000 + 0]) { int i, j; for (i = 0; i < nx; i++) for (j = 0; j < ny; j++) { fprintf( # 57 "./stencils/fdtd-2d/fdtd-2d.c" 3 4 stderr # 57 "./stencils/fdtd-2d/fdtd-2d.c" , "%0.2lf ", ex[i][j]); fprintf( # 58 "./stencils/fdtd-2d/fdtd-2d.c" 3 4 stderr # 58 "./stencils/fdtd-2d/fdtd-2d.c" , "%0.2lf ", ey[i][j]); fprintf( # 59 "./stencils/fdtd-2d/fdtd-2d.c" 3 4 stderr # 59 "./stencils/fdtd-2d/fdtd-2d.c" , "%0.2lf ", hz[i][j]); if ((i * nx + j) % 20 == 0) fprintf( # 60 "./stencils/fdtd-2d/fdtd-2d.c" 3 4 stderr # 60 "./stencils/fdtd-2d/fdtd-2d.c" , "\n"); } fprintf( # 62 "./stencils/fdtd-2d/fdtd-2d.c" 3 4 stderr # 62 "./stencils/fdtd-2d/fdtd-2d.c" , "\n"); } static void kernel_fdtd_2d(int tmax, int nx, int ny, double ex[1000 + 0][1000 + 0], double ey[1000 + 0][1000 + 0], double hz[1000 + 0][1000 + 0], double _fict_[1000 + 0]) { int t, i, j; #pragma scop for(t = 0; t < tmax; t++) { for (j = 0; j < ny; j++) ey[0][j] = _fict_[t]; for (i = 1; i < nx; i++) for (j = 0; j < ny; j++) ey[i][j] = ey[i][j] - 0.5*(hz[i][j]-hz[i-1][j]); for (i = 0; i < nx; i++) for (j = 1; j < ny; j++) ex[i][j] = ex[i][j] - 0.5*(hz[i][j]-hz[i][j-1]); for (i = 0; i < nx - 1; i++) for (j = 0; j < ny - 1; j++) hz[i][j] = hz[i][j] - 0.7* (ex[i][j+1] - ex[i][j] + ey[i+1][j] - ey[i][j]); } #pragma endscop } int main(int argc, char** argv) { int tmax = 50; int nx = 1000; int ny = 1000; double (*ex)[1000 + 0][1000 + 0]; ex = (double(*)[1000 + 0][1000 + 0])polybench_alloc_data ((1000 + 0) * (1000 + 0), sizeof(double));; double (*ey)[1000 + 0][1000 + 0]; ey = (double(*)[1000 + 0][1000 + 0])polybench_alloc_data ((1000 + 0) * (1000 + 0), sizeof(double));; double (*hz)[1000 + 0][1000 + 0]; hz = (double(*)[1000 + 0][1000 + 0])polybench_alloc_data ((1000 + 0) * (1000 + 0), sizeof(double));; double (*_fict_)[1000 + 0]; _fict_ = (double(*)[1000 + 0])polybench_alloc_data (1000 + 0, sizeof(double));; init_array (nx, ny, *ex, *ey, *hz, *_fict_); ; kernel_fdtd_2d (tmax, nx, ny, *ex, *ey, *hz, *_fict_); ; ; if (argc > 42 && ! strcmp(argv[0], "")) print_array(nx, ny, *ex, *ey, *hz) ; free((void*)ex);; free((void*)ey);; free((void*)hz);; free((void*)_fict_);; return 0; }
the_stack_data/215769240.c
#include <math.h> #include <stdlib.h> #include <string.h> #include <stdio.h> #include <complex.h> #ifdef complex #undef complex #endif #ifdef I #undef I #endif #if defined(_WIN64) typedef long long BLASLONG; typedef unsigned long long BLASULONG; #else typedef long BLASLONG; typedef unsigned long BLASULONG; #endif #ifdef LAPACK_ILP64 typedef BLASLONG blasint; #if defined(_WIN64) #define blasabs(x) llabs(x) #else #define blasabs(x) labs(x) #endif #else typedef int blasint; #define blasabs(x) abs(x) #endif typedef blasint integer; typedef unsigned int uinteger; typedef char *address; typedef short int shortint; typedef float real; typedef double doublereal; typedef struct { real r, i; } complex; typedef struct { doublereal r, i; } doublecomplex; #ifdef _MSC_VER static inline _Fcomplex Cf(complex *z) {_Fcomplex zz={z->r , z->i}; return zz;} static inline _Dcomplex Cd(doublecomplex *z) {_Dcomplex zz={z->r , z->i};return zz;} static inline _Fcomplex * _pCf(complex *z) {return (_Fcomplex*)z;} static inline _Dcomplex * _pCd(doublecomplex *z) {return (_Dcomplex*)z;} #else static inline _Complex float Cf(complex *z) {return z->r + z->i*_Complex_I;} static inline _Complex double Cd(doublecomplex *z) {return z->r + z->i*_Complex_I;} static inline _Complex float * _pCf(complex *z) {return (_Complex float*)z;} static inline _Complex double * _pCd(doublecomplex *z) {return (_Complex double*)z;} #endif #define pCf(z) (*_pCf(z)) #define pCd(z) (*_pCd(z)) typedef int logical; typedef short int shortlogical; typedef char logical1; typedef char integer1; #define TRUE_ (1) #define FALSE_ (0) /* Extern is for use with -E */ #ifndef Extern #define Extern extern #endif /* I/O stuff */ typedef int flag; typedef int ftnlen; typedef int ftnint; /*external read, write*/ typedef struct { flag cierr; ftnint ciunit; flag ciend; char *cifmt; ftnint cirec; } cilist; /*internal read, write*/ typedef struct { flag icierr; char *iciunit; flag iciend; char *icifmt; ftnint icirlen; ftnint icirnum; } icilist; /*open*/ typedef struct { flag oerr; ftnint ounit; char *ofnm; ftnlen ofnmlen; char *osta; char *oacc; char *ofm; ftnint orl; char *oblnk; } olist; /*close*/ typedef struct { flag cerr; ftnint cunit; char *csta; } cllist; /*rewind, backspace, endfile*/ typedef struct { flag aerr; ftnint aunit; } alist; /* inquire */ typedef struct { flag inerr; ftnint inunit; char *infile; ftnlen infilen; ftnint *inex; /*parameters in standard's order*/ ftnint *inopen; ftnint *innum; ftnint *innamed; char *inname; ftnlen innamlen; char *inacc; ftnlen inacclen; char *inseq; ftnlen inseqlen; char *indir; ftnlen indirlen; char *infmt; ftnlen infmtlen; char *inform; ftnint informlen; char *inunf; ftnlen inunflen; ftnint *inrecl; ftnint *innrec; char *inblank; ftnlen inblanklen; } inlist; #define VOID void union Multitype { /* for multiple entry points */ integer1 g; shortint h; integer i; /* longint j; */ real r; doublereal d; complex c; doublecomplex z; }; typedef union Multitype Multitype; struct Vardesc { /* for Namelist */ char *name; char *addr; ftnlen *dims; int type; }; typedef struct Vardesc Vardesc; struct Namelist { char *name; Vardesc **vars; int nvars; }; typedef struct Namelist Namelist; #define abs(x) ((x) >= 0 ? (x) : -(x)) #define dabs(x) (fabs(x)) #define f2cmin(a,b) ((a) <= (b) ? (a) : (b)) #define f2cmax(a,b) ((a) >= (b) ? (a) : (b)) #define dmin(a,b) (f2cmin(a,b)) #define dmax(a,b) (f2cmax(a,b)) #define bit_test(a,b) ((a) >> (b) & 1) #define bit_clear(a,b) ((a) & ~((uinteger)1 << (b))) #define bit_set(a,b) ((a) | ((uinteger)1 << (b))) #define abort_() { sig_die("Fortran abort routine called", 1); } #define c_abs(z) (cabsf(Cf(z))) #define c_cos(R,Z) { pCf(R)=ccos(Cf(Z)); } #ifdef _MSC_VER #define c_div(c, a, b) {Cf(c)._Val[0] = (Cf(a)._Val[0]/Cf(b)._Val[0]); Cf(c)._Val[1]=(Cf(a)._Val[1]/Cf(b)._Val[1]);} #define z_div(c, a, b) {Cd(c)._Val[0] = (Cd(a)._Val[0]/Cd(b)._Val[0]); Cd(c)._Val[1]=(Cd(a)._Val[1]/df(b)._Val[1]);} #else #define c_div(c, a, b) {pCf(c) = Cf(a)/Cf(b);} #define z_div(c, a, b) {pCd(c) = Cd(a)/Cd(b);} #endif #define c_exp(R, Z) {pCf(R) = cexpf(Cf(Z));} #define c_log(R, Z) {pCf(R) = clogf(Cf(Z));} #define c_sin(R, Z) {pCf(R) = csinf(Cf(Z));} //#define c_sqrt(R, Z) {*(R) = csqrtf(Cf(Z));} #define c_sqrt(R, Z) {pCf(R) = csqrtf(Cf(Z));} #define d_abs(x) (fabs(*(x))) #define d_acos(x) (acos(*(x))) #define d_asin(x) (asin(*(x))) #define d_atan(x) (atan(*(x))) #define d_atn2(x, y) (atan2(*(x),*(y))) #define d_cnjg(R, Z) { pCd(R) = conj(Cd(Z)); } #define r_cnjg(R, Z) { pCf(R) = conjf(Cf(Z)); } #define d_cos(x) (cos(*(x))) #define d_cosh(x) (cosh(*(x))) #define d_dim(__a, __b) ( *(__a) > *(__b) ? *(__a) - *(__b) : 0.0 ) #define d_exp(x) (exp(*(x))) #define d_imag(z) (cimag(Cd(z))) #define r_imag(z) (cimagf(Cf(z))) #define d_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x))) #define r_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x))) #define d_lg10(x) ( 0.43429448190325182765 * log(*(x)) ) #define r_lg10(x) ( 0.43429448190325182765 * log(*(x)) ) #define d_log(x) (log(*(x))) #define d_mod(x, y) (fmod(*(x), *(y))) #define u_nint(__x) ((__x)>=0 ? floor((__x) + .5) : -floor(.5 - (__x))) #define d_nint(x) u_nint(*(x)) #define u_sign(__a,__b) ((__b) >= 0 ? ((__a) >= 0 ? (__a) : -(__a)) : -((__a) >= 0 ? (__a) : -(__a))) #define d_sign(a,b) u_sign(*(a),*(b)) #define r_sign(a,b) u_sign(*(a),*(b)) #define d_sin(x) (sin(*(x))) #define d_sinh(x) (sinh(*(x))) #define d_sqrt(x) (sqrt(*(x))) #define d_tan(x) (tan(*(x))) #define d_tanh(x) (tanh(*(x))) #define i_abs(x) abs(*(x)) #define i_dnnt(x) ((integer)u_nint(*(x))) #define i_len(s, n) (n) #define i_nint(x) ((integer)u_nint(*(x))) #define i_sign(a,b) ((integer)u_sign((integer)*(a),(integer)*(b))) #define pow_dd(ap, bp) ( pow(*(ap), *(bp))) #define pow_si(B,E) spow_ui(*(B),*(E)) #define pow_ri(B,E) spow_ui(*(B),*(E)) #define pow_di(B,E) dpow_ui(*(B),*(E)) #define pow_zi(p, a, b) {pCd(p) = zpow_ui(Cd(a), *(b));} #define pow_ci(p, a, b) {pCf(p) = cpow_ui(Cf(a), *(b));} #define pow_zz(R,A,B) {pCd(R) = cpow(Cd(A),*(B));} #define s_cat(lpp, rpp, rnp, np, llp) { ftnlen i, nc, ll; char *f__rp, *lp; ll = (llp); lp = (lpp); for(i=0; i < (int)*(np); ++i) { nc = ll; if((rnp)[i] < nc) nc = (rnp)[i]; ll -= nc; f__rp = (rpp)[i]; while(--nc >= 0) *lp++ = *(f__rp)++; } while(--ll >= 0) *lp++ = ' '; } #define s_cmp(a,b,c,d) ((integer)strncmp((a),(b),f2cmin((c),(d)))) #define s_copy(A,B,C,D) { int __i,__m; for (__i=0, __m=f2cmin((C),(D)); __i<__m && (B)[__i] != 0; ++__i) (A)[__i] = (B)[__i]; } #define sig_die(s, kill) { exit(1); } #define s_stop(s, n) {exit(0);} static char junk[] = "\n@(#)LIBF77 VERSION 19990503\n"; #define z_abs(z) (cabs(Cd(z))) #define z_exp(R, Z) {pCd(R) = cexp(Cd(Z));} #define z_sqrt(R, Z) {pCd(R) = csqrt(Cd(Z));} #define myexit_() break; #define mycycle() continue; #define myceiling(w) {ceil(w)} #define myhuge(w) {HUGE_VAL} //#define mymaxloc_(w,s,e,n) {if (sizeof(*(w)) == sizeof(double)) dmaxloc_((w),*(s),*(e),n); else dmaxloc_((w),*(s),*(e),n);} #define mymaxloc(w,s,e,n) {dmaxloc_(w,*(s),*(e),n)} /* procedure parameter types for -A and -C++ */ #define F2C_proc_par_types 1 #ifdef __cplusplus typedef logical (*L_fp)(...); #else typedef logical (*L_fp)(); #endif static float spow_ui(float x, integer n) { float pow=1.0; unsigned long int u; if(n != 0) { if(n < 0) n = -n, x = 1/x; for(u = n; ; ) { if(u & 01) pow *= x; if(u >>= 1) x *= x; else break; } } return pow; } static double dpow_ui(double x, integer n) { double pow=1.0; unsigned long int u; if(n != 0) { if(n < 0) n = -n, x = 1/x; for(u = n; ; ) { if(u & 01) pow *= x; if(u >>= 1) x *= x; else break; } } return pow; } #ifdef _MSC_VER static _Fcomplex cpow_ui(complex x, integer n) { complex pow={1.0,0.0}; unsigned long int u; if(n != 0) { if(n < 0) n = -n, x.r = 1/x.r, x.i=1/x.i; for(u = n; ; ) { if(u & 01) pow.r *= x.r, pow.i *= x.i; if(u >>= 1) x.r *= x.r, x.i *= x.i; else break; } } _Fcomplex p={pow.r, pow.i}; return p; } #else static _Complex float cpow_ui(_Complex float x, integer n) { _Complex float pow=1.0; unsigned long int u; if(n != 0) { if(n < 0) n = -n, x = 1/x; for(u = n; ; ) { if(u & 01) pow *= x; if(u >>= 1) x *= x; else break; } } return pow; } #endif #ifdef _MSC_VER static _Dcomplex zpow_ui(_Dcomplex x, integer n) { _Dcomplex pow={1.0,0.0}; unsigned long int u; if(n != 0) { if(n < 0) n = -n, x._Val[0] = 1/x._Val[0], x._Val[1] =1/x._Val[1]; for(u = n; ; ) { if(u & 01) pow._Val[0] *= x._Val[0], pow._Val[1] *= x._Val[1]; if(u >>= 1) x._Val[0] *= x._Val[0], x._Val[1] *= x._Val[1]; else break; } } _Dcomplex p = {pow._Val[0], pow._Val[1]}; return p; } #else static _Complex double zpow_ui(_Complex double x, integer n) { _Complex double pow=1.0; unsigned long int u; if(n != 0) { if(n < 0) n = -n, x = 1/x; for(u = n; ; ) { if(u & 01) pow *= x; if(u >>= 1) x *= x; else break; } } return pow; } #endif static integer pow_ii(integer x, integer n) { integer pow; unsigned long int u; if (n <= 0) { if (n == 0 || x == 1) pow = 1; else if (x != -1) pow = x == 0 ? 1/x : 0; else n = -n; } if ((n > 0) || !(n == 0 || x == 1 || x != -1)) { u = n; for(pow = 1; ; ) { if(u & 01) pow *= x; if(u >>= 1) x *= x; else break; } } return pow; } static integer dmaxloc_(double *w, integer s, integer e, integer *n) { double m; integer i, mi; for(m=w[s-1], mi=s, i=s+1; i<=e; i++) if (w[i-1]>m) mi=i ,m=w[i-1]; return mi-s+1; } static integer smaxloc_(float *w, integer s, integer e, integer *n) { float m; integer i, mi; for(m=w[s-1], mi=s, i=s+1; i<=e; i++) if (w[i-1]>m) mi=i ,m=w[i-1]; return mi-s+1; } static inline void cdotc_(complex *z, integer *n_, complex *x, integer *incx_, complex *y, integer *incy_) { integer n = *n_, incx = *incx_, incy = *incy_, i; #ifdef _MSC_VER _Fcomplex zdotc = {0.0, 0.0}; if (incx == 1 && incy == 1) { for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */ zdotc._Val[0] += conjf(Cf(&x[i]))._Val[0] * Cf(&y[i])._Val[0]; zdotc._Val[1] += conjf(Cf(&x[i]))._Val[1] * Cf(&y[i])._Val[1]; } } else { for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */ zdotc._Val[0] += conjf(Cf(&x[i*incx]))._Val[0] * Cf(&y[i*incy])._Val[0]; zdotc._Val[1] += conjf(Cf(&x[i*incx]))._Val[1] * Cf(&y[i*incy])._Val[1]; } } pCf(z) = zdotc; } #else _Complex float zdotc = 0.0; if (incx == 1 && incy == 1) { for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */ zdotc += conjf(Cf(&x[i])) * Cf(&y[i]); } } else { for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */ zdotc += conjf(Cf(&x[i*incx])) * Cf(&y[i*incy]); } } pCf(z) = zdotc; } #endif static inline void zdotc_(doublecomplex *z, integer *n_, doublecomplex *x, integer *incx_, doublecomplex *y, integer *incy_) { integer n = *n_, incx = *incx_, incy = *incy_, i; #ifdef _MSC_VER _Dcomplex zdotc = {0.0, 0.0}; if (incx == 1 && incy == 1) { for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */ zdotc._Val[0] += conj(Cd(&x[i]))._Val[0] * Cd(&y[i])._Val[0]; zdotc._Val[1] += conj(Cd(&x[i]))._Val[1] * Cd(&y[i])._Val[1]; } } else { for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */ zdotc._Val[0] += conj(Cd(&x[i*incx]))._Val[0] * Cd(&y[i*incy])._Val[0]; zdotc._Val[1] += conj(Cd(&x[i*incx]))._Val[1] * Cd(&y[i*incy])._Val[1]; } } pCd(z) = zdotc; } #else _Complex double zdotc = 0.0; if (incx == 1 && incy == 1) { for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */ zdotc += conj(Cd(&x[i])) * Cd(&y[i]); } } else { for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */ zdotc += conj(Cd(&x[i*incx])) * Cd(&y[i*incy]); } } pCd(z) = zdotc; } #endif static inline void cdotu_(complex *z, integer *n_, complex *x, integer *incx_, complex *y, integer *incy_) { integer n = *n_, incx = *incx_, incy = *incy_, i; #ifdef _MSC_VER _Fcomplex zdotc = {0.0, 0.0}; if (incx == 1 && incy == 1) { for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */ zdotc._Val[0] += Cf(&x[i])._Val[0] * Cf(&y[i])._Val[0]; zdotc._Val[1] += Cf(&x[i])._Val[1] * Cf(&y[i])._Val[1]; } } else { for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */ zdotc._Val[0] += Cf(&x[i*incx])._Val[0] * Cf(&y[i*incy])._Val[0]; zdotc._Val[1] += Cf(&x[i*incx])._Val[1] * Cf(&y[i*incy])._Val[1]; } } pCf(z) = zdotc; } #else _Complex float zdotc = 0.0; if (incx == 1 && incy == 1) { for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */ zdotc += Cf(&x[i]) * Cf(&y[i]); } } else { for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */ zdotc += Cf(&x[i*incx]) * Cf(&y[i*incy]); } } pCf(z) = zdotc; } #endif static inline void zdotu_(doublecomplex *z, integer *n_, doublecomplex *x, integer *incx_, doublecomplex *y, integer *incy_) { integer n = *n_, incx = *incx_, incy = *incy_, i; #ifdef _MSC_VER _Dcomplex zdotc = {0.0, 0.0}; if (incx == 1 && incy == 1) { for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */ zdotc._Val[0] += Cd(&x[i])._Val[0] * Cd(&y[i])._Val[0]; zdotc._Val[1] += Cd(&x[i])._Val[1] * Cd(&y[i])._Val[1]; } } else { for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */ zdotc._Val[0] += Cd(&x[i*incx])._Val[0] * Cd(&y[i*incy])._Val[0]; zdotc._Val[1] += Cd(&x[i*incx])._Val[1] * Cd(&y[i*incy])._Val[1]; } } pCd(z) = zdotc; } #else _Complex double zdotc = 0.0; if (incx == 1 && incy == 1) { for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */ zdotc += Cd(&x[i]) * Cd(&y[i]); } } else { for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */ zdotc += Cd(&x[i*incx]) * Cd(&y[i*incy]); } } pCd(z) = zdotc; } #endif /* -- translated by f2c (version 20000121). You must link the resulting object file with the libraries: -lf2c -lm (in that order) */ /* > \brief \b STFTTR copies a triangular matrix from the rectangular full packed format (TF) to the standard full format (TR). */ /* =========== DOCUMENTATION =========== */ /* Online html documentation available at */ /* http://www.netlib.org/lapack/explore-html/ */ /* > \htmlonly */ /* > Download STFTTR + dependencies */ /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/stfttr. f"> */ /* > [TGZ]</a> */ /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/stfttr. f"> */ /* > [ZIP]</a> */ /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/stfttr. f"> */ /* > [TXT]</a> */ /* > \endhtmlonly */ /* Definition: */ /* =========== */ /* SUBROUTINE STFTTR( TRANSR, UPLO, N, ARF, A, LDA, INFO ) */ /* CHARACTER TRANSR, UPLO */ /* INTEGER INFO, N, LDA */ /* REAL A( 0: LDA-1, 0: * ), ARF( 0: * ) */ /* > \par Purpose: */ /* ============= */ /* > */ /* > \verbatim */ /* > */ /* > STFTTR copies a triangular matrix A from rectangular full packed */ /* > format (TF) to standard full format (TR). */ /* > \endverbatim */ /* Arguments: */ /* ========== */ /* > \param[in] TRANSR */ /* > \verbatim */ /* > TRANSR is CHARACTER*1 */ /* > = 'N': ARF is in Normal format; */ /* > = 'T': ARF is in Transpose format. */ /* > \endverbatim */ /* > */ /* > \param[in] UPLO */ /* > \verbatim */ /* > UPLO is CHARACTER*1 */ /* > = 'U': A is upper triangular; */ /* > = 'L': A is lower triangular. */ /* > \endverbatim */ /* > */ /* > \param[in] N */ /* > \verbatim */ /* > N is INTEGER */ /* > The order of the matrices ARF and A. N >= 0. */ /* > \endverbatim */ /* > */ /* > \param[in] ARF */ /* > \verbatim */ /* > ARF is REAL array, dimension (N*(N+1)/2). */ /* > On entry, the upper (if UPLO = 'U') or lower (if UPLO = 'L') */ /* > matrix A in RFP format. See the "Notes" below for more */ /* > details. */ /* > \endverbatim */ /* > */ /* > \param[out] A */ /* > \verbatim */ /* > A is REAL array, dimension (LDA,N) */ /* > On exit, the triangular matrix A. If UPLO = 'U', the */ /* > leading N-by-N upper triangular part of the array A contains */ /* > the upper triangular matrix, and the strictly lower */ /* > triangular part of A is not referenced. If UPLO = 'L', the */ /* > leading N-by-N lower triangular part of the array A contains */ /* > the lower triangular matrix, and the strictly upper */ /* > triangular part of A is not referenced. */ /* > \endverbatim */ /* > */ /* > \param[in] LDA */ /* > \verbatim */ /* > LDA is INTEGER */ /* > The leading dimension of the array A. LDA >= f2cmax(1,N). */ /* > \endverbatim */ /* > */ /* > \param[out] INFO */ /* > \verbatim */ /* > INFO is INTEGER */ /* > = 0: successful exit */ /* > < 0: if INFO = -i, the i-th argument had an illegal value */ /* > \endverbatim */ /* Authors: */ /* ======== */ /* > \author Univ. of Tennessee */ /* > \author Univ. of California Berkeley */ /* > \author Univ. of Colorado Denver */ /* > \author NAG Ltd. */ /* > \date December 2016 */ /* > \ingroup realOTHERcomputational */ /* > \par Further Details: */ /* ===================== */ /* > */ /* > \verbatim */ /* > */ /* > We first consider Rectangular Full Packed (RFP) Format when N is */ /* > even. We give an example where N = 6. */ /* > */ /* > AP is Upper AP is Lower */ /* > */ /* > 00 01 02 03 04 05 00 */ /* > 11 12 13 14 15 10 11 */ /* > 22 23 24 25 20 21 22 */ /* > 33 34 35 30 31 32 33 */ /* > 44 45 40 41 42 43 44 */ /* > 55 50 51 52 53 54 55 */ /* > */ /* > */ /* > Let TRANSR = 'N'. RFP holds AP as follows: */ /* > For UPLO = 'U' the upper trapezoid A(0:5,0:2) consists of the last */ /* > three columns of AP upper. The lower triangle A(4:6,0:2) consists of */ /* > the transpose of the first three columns of AP upper. */ /* > For UPLO = 'L' the lower trapezoid A(1:6,0:2) consists of the first */ /* > three columns of AP lower. The upper triangle A(0:2,0:2) consists of */ /* > the transpose of the last three columns of AP lower. */ /* > This covers the case N even and TRANSR = 'N'. */ /* > */ /* > RFP A RFP A */ /* > */ /* > 03 04 05 33 43 53 */ /* > 13 14 15 00 44 54 */ /* > 23 24 25 10 11 55 */ /* > 33 34 35 20 21 22 */ /* > 00 44 45 30 31 32 */ /* > 01 11 55 40 41 42 */ /* > 02 12 22 50 51 52 */ /* > */ /* > Now let TRANSR = 'T'. RFP A in both UPLO cases is just the */ /* > transpose of RFP A above. One therefore gets: */ /* > */ /* > */ /* > RFP A RFP A */ /* > */ /* > 03 13 23 33 00 01 02 33 00 10 20 30 40 50 */ /* > 04 14 24 34 44 11 12 43 44 11 21 31 41 51 */ /* > 05 15 25 35 45 55 22 53 54 55 22 32 42 52 */ /* > */ /* > */ /* > We then consider Rectangular Full Packed (RFP) Format when N is */ /* > odd. We give an example where N = 5. */ /* > */ /* > AP is Upper AP is Lower */ /* > */ /* > 00 01 02 03 04 00 */ /* > 11 12 13 14 10 11 */ /* > 22 23 24 20 21 22 */ /* > 33 34 30 31 32 33 */ /* > 44 40 41 42 43 44 */ /* > */ /* > */ /* > Let TRANSR = 'N'. RFP holds AP as follows: */ /* > For UPLO = 'U' the upper trapezoid A(0:4,0:2) consists of the last */ /* > three columns of AP upper. The lower triangle A(3:4,0:1) consists of */ /* > the transpose of the first two columns of AP upper. */ /* > For UPLO = 'L' the lower trapezoid A(0:4,0:2) consists of the first */ /* > three columns of AP lower. The upper triangle A(0:1,1:2) consists of */ /* > the transpose of the last two columns of AP lower. */ /* > This covers the case N odd and TRANSR = 'N'. */ /* > */ /* > RFP A RFP A */ /* > */ /* > 02 03 04 00 33 43 */ /* > 12 13 14 10 11 44 */ /* > 22 23 24 20 21 22 */ /* > 00 33 34 30 31 32 */ /* > 01 11 44 40 41 42 */ /* > */ /* > Now let TRANSR = 'T'. RFP A in both UPLO cases is just the */ /* > transpose of RFP A above. One therefore gets: */ /* > */ /* > RFP A RFP A */ /* > */ /* > 02 12 22 00 01 00 10 20 30 40 50 */ /* > 03 13 23 33 11 33 11 21 31 41 51 */ /* > 04 14 24 34 44 43 44 22 32 42 52 */ /* > \endverbatim */ /* ===================================================================== */ /* Subroutine */ int stfttr_(char *transr, char *uplo, integer *n, real *arf, real *a, integer *lda, integer *info) { /* System generated locals */ integer a_dim1, a_offset, i__1, i__2; /* Local variables */ integer np1x2, i__, j, k, l; logical normaltransr; extern logical lsame_(char *, char *); logical lower; integer n1, n2, ij, nt; extern /* Subroutine */ int xerbla_(char *, integer *, ftnlen); logical nisodd; integer nx2; /* -- LAPACK computational routine (version 3.7.0) -- */ /* -- LAPACK is a software package provided by Univ. of Tennessee, -- */ /* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- */ /* December 2016 */ /* ===================================================================== */ /* Test the input parameters. */ /* Parameter adjustments */ a_dim1 = *lda - 1 - 0 + 1; a_offset = 0 + a_dim1 * 0; a -= a_offset; /* Function Body */ *info = 0; normaltransr = lsame_(transr, "N"); lower = lsame_(uplo, "L"); if (! normaltransr && ! lsame_(transr, "T")) { *info = -1; } else if (! lower && ! lsame_(uplo, "U")) { *info = -2; } else if (*n < 0) { *info = -3; } else if (*lda < f2cmax(1,*n)) { *info = -6; } if (*info != 0) { i__1 = -(*info); xerbla_("STFTTR", &i__1, (ftnlen)6); return 0; } /* Quick return if possible */ if (*n <= 1) { if (*n == 1) { a[0] = arf[0]; } return 0; } /* Size of array ARF(0:nt-1) */ nt = *n * (*n + 1) / 2; /* set N1 and N2 depending on LOWER: for N even N1=N2=K */ if (lower) { n2 = *n / 2; n1 = *n - n2; } else { n1 = *n / 2; n2 = *n - n1; } /* If N is odd, set NISODD = .TRUE., LDA=N+1 and A is (N+1)--by--K2. */ /* If N is even, set K = N/2 and NISODD = .FALSE., LDA=N and A is */ /* N--by--(N+1)/2. */ if (*n % 2 == 0) { k = *n / 2; nisodd = FALSE_; if (! lower) { np1x2 = *n + *n + 2; } } else { nisodd = TRUE_; if (! lower) { nx2 = *n + *n; } } if (nisodd) { /* N is odd */ if (normaltransr) { /* N is odd and TRANSR = 'N' */ if (lower) { /* N is odd, TRANSR = 'N', and UPLO = 'L' */ ij = 0; i__1 = n2; for (j = 0; j <= i__1; ++j) { i__2 = n2 + j; for (i__ = n1; i__ <= i__2; ++i__) { a[n2 + j + i__ * a_dim1] = arf[ij]; ++ij; } i__2 = *n - 1; for (i__ = j; i__ <= i__2; ++i__) { a[i__ + j * a_dim1] = arf[ij]; ++ij; } } } else { /* N is odd, TRANSR = 'N', and UPLO = 'U' */ ij = nt - *n; i__1 = n1; for (j = *n - 1; j >= i__1; --j) { i__2 = j; for (i__ = 0; i__ <= i__2; ++i__) { a[i__ + j * a_dim1] = arf[ij]; ++ij; } i__2 = n1 - 1; for (l = j - n1; l <= i__2; ++l) { a[j - n1 + l * a_dim1] = arf[ij]; ++ij; } ij -= nx2; } } } else { /* N is odd and TRANSR = 'T' */ if (lower) { /* N is odd, TRANSR = 'T', and UPLO = 'L' */ ij = 0; i__1 = n2 - 1; for (j = 0; j <= i__1; ++j) { i__2 = j; for (i__ = 0; i__ <= i__2; ++i__) { a[j + i__ * a_dim1] = arf[ij]; ++ij; } i__2 = *n - 1; for (i__ = n1 + j; i__ <= i__2; ++i__) { a[i__ + (n1 + j) * a_dim1] = arf[ij]; ++ij; } } i__1 = *n - 1; for (j = n2; j <= i__1; ++j) { i__2 = n1 - 1; for (i__ = 0; i__ <= i__2; ++i__) { a[j + i__ * a_dim1] = arf[ij]; ++ij; } } } else { /* N is odd, TRANSR = 'T', and UPLO = 'U' */ ij = 0; i__1 = n1; for (j = 0; j <= i__1; ++j) { i__2 = *n - 1; for (i__ = n1; i__ <= i__2; ++i__) { a[j + i__ * a_dim1] = arf[ij]; ++ij; } } i__1 = n1 - 1; for (j = 0; j <= i__1; ++j) { i__2 = j; for (i__ = 0; i__ <= i__2; ++i__) { a[i__ + j * a_dim1] = arf[ij]; ++ij; } i__2 = *n - 1; for (l = n2 + j; l <= i__2; ++l) { a[n2 + j + l * a_dim1] = arf[ij]; ++ij; } } } } } else { /* N is even */ if (normaltransr) { /* N is even and TRANSR = 'N' */ if (lower) { /* N is even, TRANSR = 'N', and UPLO = 'L' */ ij = 0; i__1 = k - 1; for (j = 0; j <= i__1; ++j) { i__2 = k + j; for (i__ = k; i__ <= i__2; ++i__) { a[k + j + i__ * a_dim1] = arf[ij]; ++ij; } i__2 = *n - 1; for (i__ = j; i__ <= i__2; ++i__) { a[i__ + j * a_dim1] = arf[ij]; ++ij; } } } else { /* N is even, TRANSR = 'N', and UPLO = 'U' */ ij = nt - *n - 1; i__1 = k; for (j = *n - 1; j >= i__1; --j) { i__2 = j; for (i__ = 0; i__ <= i__2; ++i__) { a[i__ + j * a_dim1] = arf[ij]; ++ij; } i__2 = k - 1; for (l = j - k; l <= i__2; ++l) { a[j - k + l * a_dim1] = arf[ij]; ++ij; } ij -= np1x2; } } } else { /* N is even and TRANSR = 'T' */ if (lower) { /* N is even, TRANSR = 'T', and UPLO = 'L' */ ij = 0; j = k; i__1 = *n - 1; for (i__ = k; i__ <= i__1; ++i__) { a[i__ + j * a_dim1] = arf[ij]; ++ij; } i__1 = k - 2; for (j = 0; j <= i__1; ++j) { i__2 = j; for (i__ = 0; i__ <= i__2; ++i__) { a[j + i__ * a_dim1] = arf[ij]; ++ij; } i__2 = *n - 1; for (i__ = k + 1 + j; i__ <= i__2; ++i__) { a[i__ + (k + 1 + j) * a_dim1] = arf[ij]; ++ij; } } i__1 = *n - 1; for (j = k - 1; j <= i__1; ++j) { i__2 = k - 1; for (i__ = 0; i__ <= i__2; ++i__) { a[j + i__ * a_dim1] = arf[ij]; ++ij; } } } else { /* N is even, TRANSR = 'T', and UPLO = 'U' */ ij = 0; i__1 = k; for (j = 0; j <= i__1; ++j) { i__2 = *n - 1; for (i__ = k; i__ <= i__2; ++i__) { a[j + i__ * a_dim1] = arf[ij]; ++ij; } } i__1 = k - 2; for (j = 0; j <= i__1; ++j) { i__2 = j; for (i__ = 0; i__ <= i__2; ++i__) { a[i__ + j * a_dim1] = arf[ij]; ++ij; } i__2 = *n - 1; for (l = k + 1 + j; l <= i__2; ++l) { a[k + 1 + j + l * a_dim1] = arf[ij]; ++ij; } } /* Note that here, on exit of the loop, J = K-1 */ i__1 = j; for (i__ = 0; i__ <= i__1; ++i__) { a[i__ + j * a_dim1] = arf[ij]; ++ij; } } } } return 0; /* End of STFTTR */ } /* stfttr_ */
the_stack_data/18887070.c
/* Author : Shubham Jante Github : https://github.com/shubhamjante LinkedIn : https://www.linkedin.com/in/shubhamjante/ Blog: : https://cpythonian.wordpress.com/ */ #include<stdio.h> void main() { // printf() displays the string inside quotation printf("Hello, World!"); //return 0; }
the_stack_data/270963.c
// INFO: trying to register non-static key in ida_destroy // https://syzkaller.appspot.com/bug?id=81d64408e8ffdbe2e7685561e34fe5de33877acb // status:open // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include <endian.h> #include <errno.h> #include <fcntl.h> #include <stdarg.h> #include <stdbool.h> #include <stddef.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/mount.h> #include <sys/stat.h> #include <sys/syscall.h> #include <sys/types.h> #include <unistd.h> #include <linux/usb/ch9.h> unsigned long long procid; static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } #define USB_DEBUG 0 #define USB_MAX_EP_NUM 32 struct usb_device_index { struct usb_device_descriptor* dev; struct usb_config_descriptor* config; unsigned config_length; struct usb_interface_descriptor* iface; struct usb_endpoint_descriptor* eps[USB_MAX_EP_NUM]; unsigned eps_num; }; static bool parse_usb_descriptor(char* buffer, size_t length, struct usb_device_index* index) { if (length < sizeof(*index->dev) + sizeof(*index->config) + sizeof(*index->iface)) return false; index->dev = (struct usb_device_descriptor*)buffer; index->config = (struct usb_config_descriptor*)(buffer + sizeof(*index->dev)); index->config_length = length - sizeof(*index->dev); index->iface = (struct usb_interface_descriptor*)(buffer + sizeof(*index->dev) + sizeof(*index->config)); index->eps_num = 0; size_t offset = 0; while (true) { if (offset + 1 >= length) break; uint8_t desc_length = buffer[offset]; uint8_t desc_type = buffer[offset + 1]; if (desc_length <= 2) break; if (offset + desc_length > length) break; if (desc_type == USB_DT_ENDPOINT) { index->eps[index->eps_num] = (struct usb_endpoint_descriptor*)(buffer + offset); index->eps_num++; } if (index->eps_num == USB_MAX_EP_NUM) break; offset += desc_length; } return true; } enum usb_fuzzer_event_type { USB_FUZZER_EVENT_INVALID, USB_FUZZER_EVENT_CONNECT, USB_FUZZER_EVENT_DISCONNECT, USB_FUZZER_EVENT_SUSPEND, USB_FUZZER_EVENT_RESUME, USB_FUZZER_EVENT_CONTROL, }; struct usb_fuzzer_event { uint32_t type; uint32_t length; char data[0]; }; struct usb_fuzzer_init { uint64_t speed; const char* driver_name; const char* device_name; }; struct usb_fuzzer_ep_io { uint16_t ep; uint16_t flags; uint32_t length; char data[0]; }; #define USB_FUZZER_IOCTL_INIT _IOW('U', 0, struct usb_fuzzer_init) #define USB_FUZZER_IOCTL_RUN _IO('U', 1) #define USB_FUZZER_IOCTL_EVENT_FETCH _IOR('U', 2, struct usb_fuzzer_event) #define USB_FUZZER_IOCTL_EP0_WRITE _IOW('U', 3, struct usb_fuzzer_ep_io) #define USB_FUZZER_IOCTL_EP0_READ _IOWR('U', 4, struct usb_fuzzer_ep_io) #define USB_FUZZER_IOCTL_EP_ENABLE _IOW('U', 5, struct usb_endpoint_descriptor) #define USB_FUZZER_IOCTL_EP_WRITE _IOW('U', 7, struct usb_fuzzer_ep_io) #define USB_FUZZER_IOCTL_EP_READ _IOWR('U', 8, struct usb_fuzzer_ep_io) #define USB_FUZZER_IOCTL_CONFIGURE _IO('U', 9) #define USB_FUZZER_IOCTL_VBUS_DRAW _IOW('U', 10, uint32_t) int usb_fuzzer_open() { return open("/sys/kernel/debug/usb-fuzzer", O_RDWR); } int usb_fuzzer_init(int fd, uint32_t speed, const char* driver, const char* device) { struct usb_fuzzer_init arg; arg.speed = speed; arg.driver_name = driver; arg.device_name = device; return ioctl(fd, USB_FUZZER_IOCTL_INIT, &arg); } int usb_fuzzer_run(int fd) { return ioctl(fd, USB_FUZZER_IOCTL_RUN, 0); } int usb_fuzzer_event_fetch(int fd, struct usb_fuzzer_event* event) { return ioctl(fd, USB_FUZZER_IOCTL_EVENT_FETCH, event); } int usb_fuzzer_ep0_write(int fd, struct usb_fuzzer_ep_io* io) { return ioctl(fd, USB_FUZZER_IOCTL_EP0_WRITE, io); } int usb_fuzzer_ep0_read(int fd, struct usb_fuzzer_ep_io* io) { return ioctl(fd, USB_FUZZER_IOCTL_EP0_READ, io); } int usb_fuzzer_ep_write(int fd, struct usb_fuzzer_ep_io* io) { return ioctl(fd, USB_FUZZER_IOCTL_EP_WRITE, io); } int usb_fuzzer_ep_read(int fd, struct usb_fuzzer_ep_io* io) { return ioctl(fd, USB_FUZZER_IOCTL_EP_READ, io); } int usb_fuzzer_ep_enable(int fd, struct usb_endpoint_descriptor* desc) { return ioctl(fd, USB_FUZZER_IOCTL_EP_ENABLE, desc); } int usb_fuzzer_configure(int fd) { return ioctl(fd, USB_FUZZER_IOCTL_CONFIGURE, 0); } int usb_fuzzer_vbus_draw(int fd, uint32_t power) { return ioctl(fd, USB_FUZZER_IOCTL_VBUS_DRAW, power); } #define USB_MAX_PACKET_SIZE 1024 struct usb_fuzzer_control_event { struct usb_fuzzer_event inner; struct usb_ctrlrequest ctrl; char data[USB_MAX_PACKET_SIZE]; }; struct usb_fuzzer_ep_io_data { struct usb_fuzzer_ep_io inner; char data[USB_MAX_PACKET_SIZE]; }; struct vusb_connect_string_descriptor { uint32_t len; char* str; } __attribute__((packed)); struct vusb_connect_descriptors { uint32_t qual_len; char* qual; uint32_t bos_len; char* bos; uint32_t strs_len; struct vusb_connect_string_descriptor strs[0]; } __attribute__((packed)); static const char* default_string = "syzkaller"; static bool lookup_connect_response(struct vusb_connect_descriptors* descs, struct usb_device_index* index, struct usb_ctrlrequest* ctrl, char** response_data, uint32_t* response_length) { uint8_t str_idx; switch (ctrl->bRequestType & USB_TYPE_MASK) { case USB_TYPE_STANDARD: switch (ctrl->bRequest) { case USB_REQ_GET_DESCRIPTOR: switch (ctrl->wValue >> 8) { case USB_DT_DEVICE: *response_data = (char*)index->dev; *response_length = sizeof(*index->dev); return true; case USB_DT_CONFIG: *response_data = (char*)index->config; *response_length = index->config_length; return true; case USB_DT_STRING: str_idx = (uint8_t)ctrl->wValue; if (str_idx >= descs->strs_len) { *response_data = (char*)default_string; *response_length = strlen(default_string); } else { *response_data = descs->strs[str_idx].str; *response_length = descs->strs[str_idx].len; } return true; case USB_DT_BOS: *response_data = descs->bos; *response_length = descs->bos_len; return true; case USB_DT_DEVICE_QUALIFIER: *response_data = descs->qual; *response_length = descs->qual_len; return true; default: exit(1); return false; } break; default: exit(1); return false; } break; default: exit(1); return false; } return false; } static volatile long syz_usb_connect(volatile long a0, volatile long a1, volatile long a2, volatile long a3) { uint64_t speed = a0; uint64_t dev_len = a1; char* dev = (char*)a2; struct vusb_connect_descriptors* descs = (struct vusb_connect_descriptors*)a3; if (!dev) { return -1; } struct usb_device_index index; memset(&index, 0, sizeof(index)); int rv = 0; rv = parse_usb_descriptor(dev, dev_len, &index); if (!rv) { return rv; } int fd = usb_fuzzer_open(); if (fd < 0) { return fd; } char device[32]; sprintf(&device[0], "dummy_udc.%llu", procid); rv = usb_fuzzer_init(fd, speed, "dummy_udc", &device[0]); if (rv < 0) { return rv; } rv = usb_fuzzer_run(fd); if (rv < 0) { return rv; } bool done = false; while (!done) { struct usb_fuzzer_control_event event; event.inner.type = 0; event.inner.length = sizeof(event.ctrl); rv = usb_fuzzer_event_fetch(fd, (struct usb_fuzzer_event*)&event); if (rv < 0) { return rv; } if (event.inner.type != USB_FUZZER_EVENT_CONTROL) continue; bool response_found = false; char* response_data = NULL; uint32_t response_length = 0; if (event.ctrl.bRequestType & USB_DIR_IN) { response_found = lookup_connect_response( descs, &index, &event.ctrl, &response_data, &response_length); if (!response_found) { return -1; } } else { if ((event.ctrl.bRequestType & USB_TYPE_MASK) != USB_TYPE_STANDARD || event.ctrl.bRequest != USB_REQ_SET_CONFIGURATION) { exit(1); return -1; } done = true; } if (done) { rv = usb_fuzzer_vbus_draw(fd, index.config->bMaxPower); if (rv < 0) { return rv; } rv = usb_fuzzer_configure(fd); if (rv < 0) { return rv; } unsigned ep; for (ep = 0; ep < index.eps_num; ep++) { rv = usb_fuzzer_ep_enable(fd, index.eps[ep]); if (rv < 0) { } else { } } } struct usb_fuzzer_ep_io_data response; response.inner.ep = 0; response.inner.flags = 0; if (response_length > sizeof(response.data)) response_length = 0; if (event.ctrl.wLength < response_length) response_length = event.ctrl.wLength; response.inner.length = response_length; if (response_data) memcpy(&response.data[0], response_data, response_length); else memset(&response.data[0], 0, response_length); if (event.ctrl.bRequestType & USB_DIR_IN) rv = usb_fuzzer_ep0_write(fd, (struct usb_fuzzer_ep_io*)&response); else rv = usb_fuzzer_ep0_read(fd, (struct usb_fuzzer_ep_io*)&response); if (rv < 0) { return rv; } } sleep_ms(200); return fd; } int main(void) { syscall(__NR_mmap, 0x20000000, 0x1000000, 3, 0x32, -1, 0); *(uint8_t*)0x20000000 = 0x12; *(uint8_t*)0x20000001 = 1; *(uint16_t*)0x20000002 = 0; *(uint8_t*)0x20000004 = 0x2c; *(uint8_t*)0x20000005 = 0x26; *(uint8_t*)0x20000006 = 0x75; *(uint8_t*)0x20000007 = 8; *(uint16_t*)0x20000008 = 0x972f; *(uint16_t*)0x2000000a = 0x41a3; *(uint16_t*)0x2000000c = 0xd998; *(uint8_t*)0x2000000e = 0; *(uint8_t*)0x2000000f = 0; *(uint8_t*)0x20000010 = 0; *(uint8_t*)0x20000011 = 1; *(uint8_t*)0x20000012 = 9; *(uint8_t*)0x20000013 = 2; *(uint16_t*)0x20000014 = 0x28; *(uint8_t*)0x20000016 = 1; *(uint8_t*)0x20000017 = 0; *(uint8_t*)0x20000018 = 0; *(uint8_t*)0x20000019 = 0; *(uint8_t*)0x2000001a = 0; *(uint8_t*)0x2000001b = 9; *(uint8_t*)0x2000001c = 4; *(uint8_t*)0x2000001d = 0xc5; *(uint8_t*)0x2000001e = 0; *(uint8_t*)0x2000001f = 2; *(uint8_t*)0x20000020 = 0xe; *(uint8_t*)0x20000021 = 1; *(uint8_t*)0x20000022 = 1; *(uint8_t*)0x20000023 = 0; *(uint8_t*)0x20000024 = 4; *(uint8_t*)0x20000025 = 0x24; *(uint8_t*)0x20000026 = 2; *(uint8_t*)0x20000027 = 0; *(uint8_t*)0x20000028 = 9; *(uint8_t*)0x20000029 = 5; *(uint8_t*)0x2000002a = 8; *(uint8_t*)0x2000002b = 0; *(uint16_t*)0x2000002c = 0; *(uint8_t*)0x2000002e = 0; *(uint8_t*)0x2000002f = 0; *(uint8_t*)0x20000030 = 0; *(uint8_t*)0x20000031 = 9; *(uint8_t*)0x20000032 = 5; *(uint8_t*)0x20000033 = 0xa; *(uint8_t*)0x20000034 = 2; *(uint16_t*)0x20000035 = 0; *(uint8_t*)0x20000037 = 0; *(uint8_t*)0x20000038 = 0; *(uint8_t*)0x20000039 = 0; syz_usb_connect(3, 0x3a, 0x20000000, 0); return 0; }
the_stack_data/34511906.c
/**************************************************************************** * Copyright (c) 2002 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * * "Software"), to deal in the Software without restriction, including * * without limitation the rights to use, copy, modify, merge, publish, * * distribute, distribute with modifications, sublicense, and/or sell * * copies of the Software, and to permit persons to whom the Software is * * furnished to do so, subject to the following conditions: * * * * The above copyright notice and this permission notice shall be included * * in all copies or substantial portions of the Software. * * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * * IN NO EVENT SHALL THE ABOVE 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. * * * * Except as contained in this notice, the name(s) of the above copyright * * holders shall not be used in advertising or otherwise to promote the * * sale, use or other dealings in this Software without prior written * * authorization. * ****************************************************************************/ #include <curses.h> #include <stdlib.h> #include <time.h> /* rain 1980-11-03 EPS/CITHEP */ static int next_j(int j) { if (j == 0) j = 4; else --j; if (has_colors()) { int z = rand() % 3; chtype color = COLOR_PAIR(z); if (z) color |= A_BOLD; attrset(color); } return j; } #define INTENTIONALLY_UNUSED_PARAMETER( param) (void)(param) int main(int argc, char *argv[]) { time_t seed; int x, y, j, r, c; static int xpos[5], ypos[5]; #ifdef XCURSES Xinitscr(argc, argv); #else INTENTIONALLY_UNUSED_PARAMETER( argv); INTENTIONALLY_UNUSED_PARAMETER( argc); initscr(); #endif seed = time((time_t *)0); srand( (unsigned)seed); if (has_colors()) { short bg = COLOR_BLACK; start_color(); #if defined(NCURSES_VERSION) || (defined(PDC_BUILD) && PDC_BUILD > 3000) if (use_default_colors() == OK) bg = -1; #endif init_pair(1, COLOR_BLUE, bg); init_pair(2, COLOR_CYAN, bg); } nl(); noecho(); curs_set(0); timeout(0); keypad(stdscr, TRUE); r = LINES - 4; c = COLS - 4; for (j = 5; --j >= 0;) { xpos[j] = rand() % c + 2; ypos[j] = rand() % r + 2; } for (j = 0;;) { x = rand() % c + 2; y = rand() % r + 2; mvaddch(y, x, '.'); mvaddch(ypos[j], xpos[j], 'o'); j = next_j(j); mvaddch(ypos[j], xpos[j], 'O'); j = next_j(j); mvaddch(ypos[j] - 1, xpos[j], '-'); mvaddstr(ypos[j], xpos[j] - 1, "|.|"); mvaddch(ypos[j] + 1, xpos[j], '-'); j = next_j(j); mvaddch(ypos[j] - 2, xpos[j], '-'); mvaddstr(ypos[j] - 1, xpos[j] - 1, "/ \\"); mvaddstr(ypos[j], xpos[j] - 2, "| O |"); mvaddstr(ypos[j] + 1, xpos[j] - 1, "\\ /"); mvaddch(ypos[j] + 2, xpos[j], '-'); j = next_j(j); mvaddch(ypos[j] - 2, xpos[j], ' '); mvaddstr(ypos[j] - 1, xpos[j] - 1, " "); mvaddstr(ypos[j], xpos[j] - 2, " "); mvaddstr(ypos[j] + 1, xpos[j] - 1, " "); mvaddch(ypos[j] + 2, xpos[j], ' '); xpos[j] = x; ypos[j] = y; switch (getch()) { case 'q': case 'Q': curs_set(1); endwin(); return EXIT_SUCCESS; case 's': nodelay(stdscr, FALSE); break; case ' ': nodelay(stdscr, TRUE); #ifdef KEY_RESIZE break; case KEY_RESIZE: # ifdef PDCURSES resize_term(0, 0); # endif r = LINES - 4; c = COLS - 4; #endif } napms(50); } }
the_stack_data/151106.c
/* * _SHIFTAMT_C_ * * HMCSIM GUPS TEST * * FUNCTIONS TO GET THE APPROPRIATE ADDRESS SHIFT AMOUNT * */ #include <stdio.h> #include <stdlib.h> #include <stdint.h> /* --------------------------------------------- GETSHIFTAMOUNT */ /* * GETSHIFTAMOUNT * */ extern int getshiftamount( uint32_t num_links, uint32_t capacity, uint32_t bsize, uint32_t *shiftamt ) { if( num_links == 4 ){ /* * 4 link devices * */ if( capacity == 2 ){ /* * 2GB capacity * */ switch( bsize ) { case 32 : *shiftamt = 5; break; case 64 : *shiftamt = 6; break; case 128: *shiftamt = 7; break; default: return -1; break; } }else if( capacity == 4 ){ /* * 4GB capacity * */ switch( bsize ) { case 32 : *shiftamt = 5; break; case 64 : *shiftamt = 6; break; case 128: *shiftamt = 7; break; default: return -1; break; } }else{ return -1; } }else if( num_links == 8 ){ /* * 8 link devices * */ if( capacity == 4 ){ /* * 4GB capacity * */ switch( bsize ) { case 32 : *shiftamt = 5; break; case 64 : *shiftamt = 6; break; case 128: *shiftamt = 7; break; default: return -1; break; } }else if( capacity == 8 ){ /* * 8GB capacity * */ switch( bsize ) { case 32 : *shiftamt = 5; break; case 64 : *shiftamt = 6; break; case 128: *shiftamt = 7; break; default: return -1; break; } }else{ return -1; } }else{ return -1; } return 0; } /* EOF */
the_stack_data/76700203.c
#include <stdio.h> int main() { printf("Hello, World!\n"); return 0; }
the_stack_data/1088968.c
/* call libraries */ #include "stdlib.h" /* standar library */ #include "stdio.h" /* Print and recover info */ #include "string.h" /* work with strings */ /* create user_data_type */ struct client { char Name[50]; /* array 50 characters */ char Id[10]; float Credit; char Address[100]; }; int main(int argc, char const *argv[]) { struct client client1 = {0}; /* start values 0(zero) */ strcpy(client1.Name , "Camilo Valencia"); strcpy(client1.Id , "000000001"); client1.Credit = 1000000; strcpy(client1.Address , "Calle 1, Carrera 1, ciudad bolivar"); printf("The Client Name is: %s \n", client1.Name); /* %s print characters */ printf("The Client Id is: %s \n", client1.Id); printf("The Client Credit is: %f \n", client1.Credit); /* %d print numbers float */ printf("The Client Address is: %s \n", client1.Address); /* \n line break */ return 0; }
the_stack_data/60135.c
/* ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ float ff1(float par) { return par; } float ff2(float par1, float par2, float par3, float par4) { return (par1 + par2) * (par3 + par4); }
the_stack_data/187642354.c
#include<stdio.h> #include<string.h> char stone[1000][30],chest[100][30]; char link[100][9][30]; int num[100],n,m,che; int flag1[100]={0},flag2[100]={0}; int dfs(int p); int main() { int i,j,k,p,q,c; char str[300]; scanf("%d%d",&n,&m); while (n!=0 || m!=0) { gets(str); for (i=0;i<n;i++) gets(stone[i]); for (j=0;j<m;j++) { gets(str); for (k=0,p=0,q=0;str[k]!=':';k++) { if (str[k]==',') { link[j][p][q]='\0'; p++; q=0; k++; } else link[j][p][q++]=str[k]; } link[j][p][q]='\0'; num[j]=p+1; for (q=0,k+=2;str[k]!='\0';k++) chest[j][q++]=str[k]; chest[j][q]='\0'; if (strcmp(chest[j],"Sorcerer's Stone")==0) c=j; } che=1; flag1[c]=1; flag2[c]=1; printf("%d\n",dfs(c)); memset(flag1,0,sizeof(flag1)); memset(flag2,0,sizeof(flag2)); scanf("%d%d",&n,&m); } return 0; } int dfs(int p) { int i,j; for (i=0;i<num[p];i++) { for (j=0;j<n;j++) if (!strcmp(link[p][i],stone[j])) break; if (j==n) { for (j=0;j<m;j++) { if (flag1[j]==0 && strcmp(link[p][i],chest[j])==0) { flag1[j]=1; if (dfs(j)==-1) return -1; else { if (flag2[j]==0) che++; flag2[j]=1; flag1[j]=0; break; } } } if (j==m) return -1; } } return che; }
the_stack_data/126702296.c
// memory leak in v9fs_cache_session_get_cookie (2) // https://syzkaller.appspot.com/bug?id=5bf0825efb25810e62083e5765869ffdbf4405ab // status:open // 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.h> #include <net/if_arp.h> #include <netinet/in.h> #include <pthread.h> #include <sched.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/wait.h> #include <time.h> #include <unistd.h> #include <linux/capability.h> #include <linux/futex.h> #include <linux/if_addr.h> #include <linux/if_ether.h> #include <linux/if_link.h> #include <linux/if_tun.h> #include <linux/in6.h> #include <linux/ip.h> #include <linux/neighbour.h> #include <linux/net.h> #include <linux/netlink.h> #include <linux/rtnetlink.h> #include <linux/tcp.h> #include <linux/veth.h> unsigned long long procid; static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i; for (i = 0; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); syscall(SYS_futex, &ev->state, FUTEX_WAKE | FUTEX_PRIVATE_FLAG, 1000000); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) syscall(SYS_futex, &ev->state, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, 0, 0); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout) { uint64_t start = current_time_ms(); uint64_t now = start; for (;;) { uint64_t remain = timeout - (now - start); struct timespec ts; ts.tv_sec = remain / 1000; ts.tv_nsec = (remain % 1000) * 1000 * 1000; syscall(SYS_futex, &ev->state, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, 0, &ts); if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED)) return 1; now = current_time_ms(); if (now - start > timeout) return 0; } } static bool write_file(const char* file, const char* what, ...) { char buf[1024]; va_list args; va_start(args, what); vsnprintf(buf, sizeof(buf), what, args); va_end(args); buf[sizeof(buf) - 1] = 0; int len = strlen(buf); int fd = open(file, O_WRONLY | O_CLOEXEC); if (fd == -1) return false; if (write(fd, buf, len) != len) { int err = errno; close(fd); errno = err; return false; } close(fd); return true; } struct nlmsg { char* pos; int nesting; struct nlattr* nested[8]; char buf[1024]; }; static struct nlmsg nlmsg; static void netlink_init(struct nlmsg* nlmsg, int typ, int flags, const void* data, int size) { memset(nlmsg, 0, sizeof(*nlmsg)); struct nlmsghdr* hdr = (struct nlmsghdr*)nlmsg->buf; hdr->nlmsg_type = typ; hdr->nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK | flags; memcpy(hdr + 1, data, size); nlmsg->pos = (char*)(hdr + 1) + NLMSG_ALIGN(size); } static void netlink_attr(struct nlmsg* nlmsg, int typ, const void* data, int size) { struct nlattr* attr = (struct nlattr*)nlmsg->pos; attr->nla_len = sizeof(*attr) + size; attr->nla_type = typ; memcpy(attr + 1, data, size); nlmsg->pos += NLMSG_ALIGN(attr->nla_len); } static int netlink_send_ext(struct nlmsg* nlmsg, int sock, uint16_t reply_type, int* reply_len) { if (nlmsg->pos > nlmsg->buf + sizeof(nlmsg->buf) || nlmsg->nesting) exit(1); struct nlmsghdr* hdr = (struct nlmsghdr*)nlmsg->buf; hdr->nlmsg_len = nlmsg->pos - nlmsg->buf; struct sockaddr_nl addr; memset(&addr, 0, sizeof(addr)); addr.nl_family = AF_NETLINK; unsigned n = sendto(sock, nlmsg->buf, hdr->nlmsg_len, 0, (struct sockaddr*)&addr, sizeof(addr)); if (n != hdr->nlmsg_len) exit(1); n = recv(sock, nlmsg->buf, sizeof(nlmsg->buf), 0); if (hdr->nlmsg_type == NLMSG_DONE) { *reply_len = 0; return 0; } if (n < sizeof(struct nlmsghdr)) exit(1); if (reply_len && hdr->nlmsg_type == reply_type) { *reply_len = n; return 0; } if (n < sizeof(struct nlmsghdr) + sizeof(struct nlmsgerr)) exit(1); if (hdr->nlmsg_type != NLMSG_ERROR) exit(1); return -((struct nlmsgerr*)(hdr + 1))->error; } static int netlink_send(struct nlmsg* nlmsg, int sock) { return netlink_send_ext(nlmsg, sock, 0, NULL); } static void netlink_device_change(struct nlmsg* nlmsg, int sock, const char* name, bool up, const char* master, const void* mac, int macsize, const char* new_name) { struct ifinfomsg hdr; memset(&hdr, 0, sizeof(hdr)); if (up) hdr.ifi_flags = hdr.ifi_change = IFF_UP; hdr.ifi_index = if_nametoindex(name); netlink_init(nlmsg, RTM_NEWLINK, 0, &hdr, sizeof(hdr)); if (new_name) netlink_attr(nlmsg, IFLA_IFNAME, new_name, strlen(new_name)); if (master) { int ifindex = if_nametoindex(master); netlink_attr(nlmsg, IFLA_MASTER, &ifindex, sizeof(ifindex)); } if (macsize) netlink_attr(nlmsg, IFLA_ADDRESS, mac, macsize); int err = netlink_send(nlmsg, sock); (void)err; } static int netlink_add_addr(struct nlmsg* nlmsg, int sock, const char* dev, const void* addr, int addrsize) { struct ifaddrmsg hdr; memset(&hdr, 0, sizeof(hdr)); hdr.ifa_family = addrsize == 4 ? AF_INET : AF_INET6; hdr.ifa_prefixlen = addrsize == 4 ? 24 : 120; hdr.ifa_scope = RT_SCOPE_UNIVERSE; hdr.ifa_index = if_nametoindex(dev); netlink_init(nlmsg, RTM_NEWADDR, NLM_F_CREATE | NLM_F_REPLACE, &hdr, sizeof(hdr)); netlink_attr(nlmsg, IFA_LOCAL, addr, addrsize); netlink_attr(nlmsg, IFA_ADDRESS, addr, addrsize); return netlink_send(nlmsg, sock); } static void netlink_add_addr4(struct nlmsg* nlmsg, int sock, const char* dev, const char* addr) { struct in_addr in_addr; inet_pton(AF_INET, addr, &in_addr); int err = netlink_add_addr(nlmsg, sock, dev, &in_addr, sizeof(in_addr)); (void)err; } static void netlink_add_addr6(struct nlmsg* nlmsg, int sock, const char* dev, const char* addr) { struct in6_addr in6_addr; inet_pton(AF_INET6, addr, &in6_addr); int err = netlink_add_addr(nlmsg, sock, dev, &in6_addr, sizeof(in6_addr)); (void)err; } static void netlink_add_neigh(struct nlmsg* nlmsg, int sock, const char* name, const void* addr, int addrsize, const void* mac, int macsize) { struct ndmsg hdr; memset(&hdr, 0, sizeof(hdr)); hdr.ndm_family = addrsize == 4 ? AF_INET : AF_INET6; hdr.ndm_ifindex = if_nametoindex(name); hdr.ndm_state = NUD_PERMANENT; netlink_init(nlmsg, RTM_NEWNEIGH, NLM_F_EXCL | NLM_F_CREATE, &hdr, sizeof(hdr)); netlink_attr(nlmsg, NDA_DST, addr, addrsize); netlink_attr(nlmsg, NDA_LLADDR, mac, macsize); int err = netlink_send(nlmsg, sock); (void)err; } static int tunfd = -1; static int tun_frags_enabled; #define TUN_IFACE "syz_tun" #define LOCAL_MAC 0xaaaaaaaaaaaa #define REMOTE_MAC 0xaaaaaaaaaabb #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; char sysctl[64]; sprintf(sysctl, "/proc/sys/net/ipv6/conf/%s/accept_dad", TUN_IFACE); write_file(sysctl, "0"); sprintf(sysctl, "/proc/sys/net/ipv6/conf/%s/router_solicitations", TUN_IFACE); write_file(sysctl, "0"); int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE); if (sock == -1) exit(1); netlink_add_addr4(&nlmsg, sock, TUN_IFACE, LOCAL_IPV4); netlink_add_addr6(&nlmsg, sock, TUN_IFACE, LOCAL_IPV6); uint64_t macaddr = REMOTE_MAC; struct in_addr in_addr; inet_pton(AF_INET, REMOTE_IPV4, &in_addr); netlink_add_neigh(&nlmsg, sock, TUN_IFACE, &in_addr, sizeof(in_addr), &macaddr, ETH_ALEN); struct in6_addr in6_addr; inet_pton(AF_INET6, REMOTE_IPV6, &in6_addr); netlink_add_neigh(&nlmsg, sock, TUN_IFACE, &in6_addr, sizeof(in6_addr), &macaddr, ETH_ALEN); macaddr = LOCAL_MAC; netlink_device_change(&nlmsg, sock, TUN_IFACE, true, 0, &macaddr, ETH_ALEN, NULL); close(sock); } 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[1000]; while (read_tun(&data[0], sizeof(data)) != -1) { } } #define MAX_FDS 30 static long syz_open_dev(volatile long a0, volatile long a1, volatile long a2) { if (a0 == 0xc || a0 == 0xb) { char buf[128]; sprintf(buf, "/dev/%s/%d:%d", a0 == 0xc ? "char" : "block", (uint8_t)a1, (uint8_t)a2); return open(buf, O_RDWR, 0); } else { char buf[1024]; char* hash; strncpy(buf, (char*)a0, sizeof(buf) - 1); buf[sizeof(buf) - 1] = 0; while ((hash = strchr(buf, '#'))) { *hash = '0' + (char)(a1 % 10); a1 /= 10; } return open(buf, a2, 0); } } static void setup_common() { if (mount(0, "/sys/fs/fuse/connections", "fusectl", 0, 0)) { } } static void loop(); static void sandbox_common() { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); setpgrp(); setsid(); struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = (200 << 20); setrlimit(RLIMIT_AS, &rlim); rlim.rlim_cur = rlim.rlim_max = 32 << 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)) { } typedef struct { const char* name; const char* value; } sysctl_t; static const sysctl_t sysctls[] = { {"/proc/sys/kernel/shmmax", "16777216"}, {"/proc/sys/kernel/shmall", "536870912"}, {"/proc/sys/kernel/shmmni", "1024"}, {"/proc/sys/kernel/msgmax", "8192"}, {"/proc/sys/kernel/msgmni", "1024"}, {"/proc/sys/kernel/msgmnb", "1024"}, {"/proc/sys/kernel/sem", "1024 1048576 500 1024"}, }; unsigned i; for (i = 0; i < sizeof(sysctls) / sizeof(sysctls[0]); i++) write_file(sysctls[i].name, sysctls[i].value); } int wait_for_loop(int pid) { if (pid < 0) exit(1); int status = 0; while (waitpid(-1, &status, __WALL) != pid) { } return WEXITSTATUS(status); } static void drop_caps(void) { struct __user_cap_header_struct cap_hdr = {}; struct __user_cap_data_struct cap_data[2] = {}; cap_hdr.version = _LINUX_CAPABILITY_VERSION_3; cap_hdr.pid = getpid(); if (syscall(SYS_capget, &cap_hdr, &cap_data)) exit(1); const int drop = (1 << CAP_SYS_PTRACE) | (1 << CAP_SYS_NICE); cap_data[0].effective &= ~drop; cap_data[0].permitted &= ~drop; cap_data[0].inheritable &= ~drop; if (syscall(SYS_capset, &cap_hdr, &cap_data)) exit(1); } 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(); drop_caps(); if (unshare(CLONE_NEWNET)) { } initialize_tun(); loop(); exit(1); } static void kill_and_wait(int pid, int* status) { kill(-pid, SIGKILL); kill(pid, SIGKILL); int i; for (i = 0; i < 100; i++) { if (waitpid(-1, status, WNOHANG | __WALL) == pid) return; usleep(1000); } DIR* dir = opendir("/sys/fs/fuse/connections"); if (dir) { for (;;) { struct dirent* ent = readdir(dir); if (!ent) break; if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) continue; char abort[300]; snprintf(abort, sizeof(abort), "/sys/fs/fuse/connections/%s/abort", ent->d_name); int fd = open(abort, O_WRONLY); if (fd == -1) { continue; } if (write(fd, abort, 1) < 0) { } close(fd); } closedir(dir); } else { } while (waitpid(-1, status, __WALL) != pid) { } } static void setup_test() { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); setpgrp(); write_file("/proc/self/oom_score_adj", "1000"); flush_tun(); } static void close_fds() { int fd; for (fd = 3; fd < MAX_FDS; fd++) close(fd); } #define KMEMLEAK_FILE "/sys/kernel/debug/kmemleak" static void setup_leak() { if (!write_file(KMEMLEAK_FILE, "scan")) exit(1); sleep(5); if (!write_file(KMEMLEAK_FILE, "scan")) exit(1); if (!write_file(KMEMLEAK_FILE, "clear")) exit(1); } static void check_leaks(void) { int fd = open(KMEMLEAK_FILE, O_RDWR); if (fd == -1) exit(1); uint64_t start = current_time_ms(); if (write(fd, "scan", 4) != 4) exit(1); sleep(1); while (current_time_ms() - start < 4 * 1000) sleep(1); if (write(fd, "scan", 4) != 4) exit(1); static char buf[128 << 10]; ssize_t n = read(fd, buf, sizeof(buf) - 1); if (n < 0) exit(1); int nleaks = 0; if (n != 0) { sleep(1); if (write(fd, "scan", 4) != 4) exit(1); if (lseek(fd, 0, SEEK_SET) < 0) exit(1); n = read(fd, buf, sizeof(buf) - 1); if (n < 0) exit(1); buf[n] = 0; char* pos = buf; char* end = buf + n; while (pos < end) { char* next = strstr(pos + 1, "unreferenced object"); if (!next) next = end; char prev = *next; *next = 0; fprintf(stderr, "BUG: memory leak\n%s\n", pos); *next = prev; pos = next; nleaks++; } } if (write(fd, "clear", 5) != 5) exit(1); close(fd); if (nleaks) exit(1); } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; for (call = 0; call < 7; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); event_timedwait(&th->done, 45); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); close_fds(); } static void execute_one(void); #define WAIT_FLAGS __WALL static void loop(void) { int iter; for (iter = 0;; iter++) { int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { setup_test(); execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5 * 1000) continue; kill_and_wait(pid, &status); break; } check_leaks(); } } uint64_t r[4] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff}; void execute_call(int call) { intptr_t res; switch (call) { case 0: res = syscall(__NR_pipe2, 0x20000240ul, 0ul); if (res != -1) { r[0] = *(uint32_t*)0x20000240; r[1] = *(uint32_t*)0x20000244; } break; case 1: memcpy((void*)0x20000080, "./file0\000", 8); syscall(__NR_mkdir, 0x20000080ul, 0ul); break; case 2: memcpy((void*)0x20000680, "\x15\x00\x00\x00\x65\xff\xff\x01\x80\x00\x00\x08\x00\x39\x50\x32" "\x30\x30\x30\x2e\x75\xd9\x08\xc9\x20\x5e\xd3\xb7\x1e\xa1\x39\x52" "\xfe\x4c\xbe\x6f\xe9\x48\x15\xd4\x29\x6f\x6e\x66\xde\x94\xf4\x2c" "\xfa\x66\x86\x25\x35\x18\x8b\xc7\x31\x14\xcc\x5b\x7e\x45\xad\xbc" "\x96\xad\xa2\xc9\x6f\xcd\xf5\x6a\xc7\xd8\xc5\xdf\x0d\x62\x17\xf0" "\x49\x41\x34\x54\xc4\x71\xde\x84\x0c\xdf\x46\x2e\x7b\x21\xaf\x76" "\xc2\xdd\x85\xcf\xd2\xaf\x27\x51\x32\xf7\x8a\x7a\x2a\x40\x78\x4f" "\x2c\x84\x8c\xfe\x3e\x12\x0e\xa0\x12\x4e\xe0\x7f\xab\xe1\xab\x30" "\x35\x5d\x1d\xa3\x79\x2e\xd0\x37\x34\xc9\xd2\x31\x1b\x8c\x49\x21" "\x41\xe4\x9b\xbd\x12\x98\x84\x25\xf3\xe6\x41\x6d\x98\x39\x7d\x0c" "\x77\x2f\x66\x62\x5b\x09\x84\xa4\x11\x11\xe8\x65\x5d\xe4\xc8\x7c" "\x3f\xfc\x5a\x61\x20\x04\xb1\x91\x58\x17\x4c\x2f\x52\x68\x0b\x3b" "\xf2\xe4\x18\xbc\x4e\x9b\x4a\x0b\x87\x3e\x7f\x69\x26\x10\x2d\x5c" "\xc7\xe6\xee\xbb\x2a\x84\x07\xb6\x84\x60\x7e\x44\x1c\xa5\x2e\xab" "\xfe\xca\x04\x02\x54\xd8\x7b\x62\x7d\xe2\x5f\x8e\x68\x99\xde\x16" "\x1d\x19\x94\x68", 244); syscall(__NR_write, r[1], 0x20000680ul, 0x15ul); break; case 3: res = syscall(__NR_dup, r[1]); if (res != -1) r[2] = res; break; case 4: *(uint32_t*)0x20000000 = 0x18; *(uint32_t*)0x20000004 = 0; *(uint64_t*)0x20000008 = 0; *(uint64_t*)0x20000010 = 0; syscall(__NR_write, r[2], 0x20000000ul, 0x18ul); break; case 5: memcpy((void*)0x20000040, "/dev/vcs#\000", 10); res = syz_open_dev(0x20000040, 0xc4, 1); if (res != -1) r[3] = res; break; case 6: memcpy((void*)0x20000140, "./file0\000", 8); memcpy((void*)0x20000100, "9p\000", 3); memcpy((void*)0x20000280, "trans=fd,", 9); memcpy((void*)0x20000289, "rfdno", 5); *(uint8_t*)0x2000028e = 0x3d; sprintf((char*)0x2000028f, "0x%016llx", (long long)r[0]); *(uint8_t*)0x200002a1 = 0x2c; memcpy((void*)0x200002a2, "wfdno", 5); *(uint8_t*)0x200002a7 = 0x3d; sprintf((char*)0x200002a8, "0x%016llx", (long long)r[3]); *(uint8_t*)0x200002ba = 0x2c; memcpy((void*)0x200002bb, "access=user", 11); *(uint8_t*)0x200002c6 = 0x2c; memcpy((void*)0x200002c7, "noextend", 8); *(uint8_t*)0x200002cf = 0x2c; *(uint8_t*)0x200002d0 = 0; syscall(__NR_mount, 0ul, 0x20000140ul, 0x20000100ul, 0ul, 0x20000280ul); break; } } int main(void) { syscall(__NR_mmap, 0x20000000ul, 0x1000000ul, 3ul, 0x32ul, -1, 0); setup_leak(); for (procid = 0; procid < 8; procid++) { if (fork() == 0) { do_sandbox_none(); } } sleep(1000000); return 0; }
the_stack_data/47673.c
// Thank you, @Roddy: http://stackoverflow.com/questions/7602919/how-do-i-generate-random-numbers-without-rand-function unsigned short lfsr = 0xACE1u; unsigned bit; unsigned myrand() { bit = ((lfsr >> 0) ^ (lfsr >> 2) ^ (lfsr >> 3) ^ (lfsr >> 5) ) & 1; return lfsr = (lfsr >> 1) | (bit << 15); }
the_stack_data/686541.c
#include<stdlib.h> #include<stdio.h> #include<time.h> void getInputData(char* text, int* result, int n) { FILE* fp; char ch; int i = 0; fp = fopen(text, "r"); do { ch = fgetc(fp); if (ch == '0' || ch == '1') { result[i] = ch - '0'; i++; } } while (i < n && ch != EOF); fclose(fp); return ; } void makeRandomWorld(int *a, int n) { int i; srand(time(NULL)); for (i = 0; i < n; i++){ if (!(rand() % 4)) a[i] = 1; else a[i] = 0; } return ; } int find_new_a(int x, int neighbors) { if (x) { //x==1 if (neighbors == 2 || neighbors == 3) return 1; else return 0; } else { //x==0 if (neighbors == 3) return 1; else return 0; } } void checkInside(int* a, int* b, int n) { int i, j, neighbor; for (i = 1; i < n - 1; i++) { for (j = 1; j < n - 1; j++) { neighbor = a[(i - 1)*n + (j - 1)] + a[(i - 1)*n + j] + a[(i - 1)*n + (j + 1)] + a[(i + 1)*n + (j - 1)] + a[(i + 1)*n + j] + a[(i + 1)*n + (j + 1)] + a[i*n + (j - 1)] + a[i*n + (j + 1)]; b[i*n +j] = find_new_a(a[i*n + j], neighbor); } } return ; } void checkPerimeter(int* a, int n, int ul, int ur, int dl, int dr, int* u, int* d, int* l, int* r, int* b) { int i,neighbor; //for a[0] neighbor = ul + u[0] + u[1] + l[0] + l[1] + a[1] + a[n] + a[n + 1]; b[0] = find_new_a(a[0],neighbor); //for a[n - 1] neighbor = ur + u[n - 1] + u[n - 2] + r[0] + r[1] + a[n - 2] + a[2*n - 1] + a[2*n - 2]; b[n - 1] = find_new_a(a[n - 1],neighbor); //for a[n*(n - 1)] neighbor = dl + l[n - 2] + l[n - 1] + d[0] + d[1] + a[n*(n - 1) + 1] + a[n*(n - 2)] + a[n*(n - 2) + 1]; b[n*(n - 1)] = find_new_a(a[n*(n - 1)],neighbor); //for a[n*n - 1] neighbor = dr + d[n - 1] + d[n - 2] + r[n - 1] + r[n - 2] + a[n*n - 2] + a[n*(n - 1) - 1] + a[n*(n - 1) - 2]; b[n*n - 1] = find_new_a(a[n*n - 1],neighbor); //for up for (i = 1; i < n - 1; i++) { neighbor = u[i - 1] + u[i] + u[i + 1] + a[i - 1] + a[i + 1] + a[i - 1 + n] + a[i + n] + a[i + 1 + n]; b[i] = find_new_a(a[i],neighbor); } //for down for (i = 1; i < n - 1; i++) { neighbor = d[i - 1] + d[i] + d[i + 1] + a[n*(n - 1) + i - 1] + a[n*(n - 1) + i + 1] + a[n*(n - 2) + i] + a[n*(n - 2) + i - 1] + a[n*(n - 2) + i + 1]; b[n*(n - 1) + i] = find_new_a(a[n*(n - 1) + i], neighbor); } //for left for (i = 1; i < n - 1; i++) { neighbor = l[i - 1] + l[i] + l[i + 1] + a[(i - 1)*n] + a[(i - 1)*n + 1] + a[i*n + 1] + a[(i + 1)*n] + a[(i + 1)*n + 1]; b[n*i] = find_new_a(a[n*i],neighbor); } //for right for (i = 1;i < n - 1; i++){ neighbor = r[i - 1] + r[i] + r[i + 1] + a[i*n - 1] + a[(i + 2)*n - 1] + a[i*n - 2] + a[(i + 2)*n - 2] + a[(i + 1)*n - 2]; b[(i + 1)*n - 1] = find_new_a(a[(i + 1)*n - 1], neighbor); } return; } void computeNewWorld(int *w,int *nw,int n){ int z; int *up=NULL,*down=NULL,*right=NULL,*left=NULL; up = malloc(n*sizeof(int)); down = malloc(n*sizeof(int)); right = malloc(n*sizeof(int)); left = malloc(n*sizeof(int)); checkInside(w,nw,n);//using the mpi functs to compute for(z=0;z<n;z++){ right[z]=w[z*n]; left[z]=w[z*n + (n-1)]; up[z]=w[n*n-n + z]; down[z]=w[z]; } //up-left -> down-right = w[n*n-1] //up-right -> down-left = w[n*(n-1)] //down-left -> up-right = w[n-1] //down-right -> up-left = w[0] //checkPerimeter(w,n,w[n*n-1],w[n*n-n],w[n-1],w[0],up,down,right,left,nw); checkPerimeter(w,n,w[n*n-1],w[n*n-n],w[n-1],w[0],down,up,left,right,nw); free(up); free(down); free(right); free(left); return ; } void swapArrays(int** a, int** b) { int *temp = *a; *a = *b; *b = temp; return; } int world_changed(int *world,int *newWorld,int N){ int i; for(i=0;i<N;i++) if(world[i] != newWorld[i]) return 1; return 0; } void printWorld(int *world,int n){ int i,j; for(i=0;i<n;i++){ for(j=0;j<n;j++) printf("|%d",world[i*n+j]); printf("|\n"); } return ; }
the_stack_data/154830269.c
//===-- powitf2_test.cpp - Test __powitf2 ---------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file tests __powitf2 for the compiler_rt library. // //===----------------------------------------------------------------------===// #include <stdio.h> #if _ARCH_PPC #include "int_lib.h" #include <math.h> // Returns: a ^ b COMPILER_RT_ABI long double __powitf2(long double a, si_int b); int test__powitf2(long double a, si_int b, long double expected) { long double x = __powitf2(a, b); int correct = (x == expected) && (signbit(x) == signbit(expected)); if (!correct) printf("error in __powitf2(%Lf, %d) = %Lf, expected %Lf\n", a, b, x, expected); return !correct; } #endif int main() { #if _ARCH_PPC if (test__powitf2(0, 0, 1)) return 1; if (test__powitf2(1, 0, 1)) return 1; if (test__powitf2(1.5, 0, 1)) return 1; if (test__powitf2(2, 0, 1)) return 1; if (test__powitf2(INFINITY, 0, 1)) return 1; if (test__powitf2(-0., 0, 1)) return 1; if (test__powitf2(-1, 0, 1)) return 1; if (test__powitf2(-1.5, 0, 1)) return 1; if (test__powitf2(-2, 0, 1)) return 1; if (test__powitf2(-INFINITY, 0, 1)) return 1; if (test__powitf2(0, 1, 0)) return 1; if (test__powitf2(0, 2, 0)) return 1; if (test__powitf2(0, 3, 0)) return 1; if (test__powitf2(0, 4, 0)) return 1; if (test__powitf2(0, 0x7FFFFFFE, 0)) return 1; if (test__powitf2(0, 0x7FFFFFFF, 0)) return 1; if (test__powitf2(-0., 1, -0.)) return 1; if (test__powitf2(-0., 2, 0)) return 1; if (test__powitf2(-0., 3, -0.)) return 1; if (test__powitf2(-0., 4, 0)) return 1; if (test__powitf2(-0., 0x7FFFFFFE, 0)) return 1; if (test__powitf2(-0., 0x7FFFFFFF, -0.)) return 1; if (test__powitf2(1, 1, 1)) return 1; if (test__powitf2(1, 2, 1)) return 1; if (test__powitf2(1, 3, 1)) return 1; if (test__powitf2(1, 4, 1)) return 1; if (test__powitf2(1, 0x7FFFFFFE, 1)) return 1; if (test__powitf2(1, 0x7FFFFFFF, 1)) return 1; if (test__powitf2(INFINITY, 1, INFINITY)) return 1; if (test__powitf2(INFINITY, 2, INFINITY)) return 1; if (test__powitf2(INFINITY, 3, INFINITY)) return 1; if (test__powitf2(INFINITY, 4, INFINITY)) return 1; if (test__powitf2(INFINITY, 0x7FFFFFFE, INFINITY)) return 1; if (test__powitf2(INFINITY, 0x7FFFFFFF, INFINITY)) return 1; if (test__powitf2(-INFINITY, 1, -INFINITY)) return 1; if (test__powitf2(-INFINITY, 2, INFINITY)) return 1; if (test__powitf2(-INFINITY, 3, -INFINITY)) return 1; if (test__powitf2(-INFINITY, 4, INFINITY)) return 1; if (test__powitf2(-INFINITY, 0x7FFFFFFE, INFINITY)) return 1; if (test__powitf2(-INFINITY, 0x7FFFFFFF, -INFINITY)) return 1; if (test__powitf2(0, -1, INFINITY)) return 1; if (test__powitf2(0, -2, INFINITY)) return 1; if (test__powitf2(0, -3, INFINITY)) return 1; if (test__powitf2(0, -4, INFINITY)) return 1; if (test__powitf2(0, 0x80000002, INFINITY)) return 1; if (test__powitf2(0, 0x80000001, INFINITY)) return 1; if (test__powitf2(0, 0x80000000, INFINITY)) return 1; if (test__powitf2(-0., -1, -INFINITY)) return 1; if (test__powitf2(-0., -2, INFINITY)) return 1; if (test__powitf2(-0., -3, -INFINITY)) return 1; if (test__powitf2(-0., -4, INFINITY)) return 1; if (test__powitf2(-0., 0x80000002, INFINITY)) return 1; if (test__powitf2(-0., 0x80000001, -INFINITY)) return 1; if (test__powitf2(-0., 0x80000000, INFINITY)) return 1; if (test__powitf2(1, -1, 1)) return 1; if (test__powitf2(1, -2, 1)) return 1; if (test__powitf2(1, -3, 1)) return 1; if (test__powitf2(1, -4, 1)) return 1; if (test__powitf2(1, 0x80000002, 1)) return 1; if (test__powitf2(1, 0x80000001, 1)) return 1; if (test__powitf2(1, 0x80000000, 1)) return 1; if (test__powitf2(INFINITY, -1, 0)) return 1; if (test__powitf2(INFINITY, -2, 0)) return 1; if (test__powitf2(INFINITY, -3, 0)) return 1; if (test__powitf2(INFINITY, -4, 0)) return 1; if (test__powitf2(INFINITY, 0x80000002, 0)) return 1; if (test__powitf2(INFINITY, 0x80000001, 0)) return 1; if (test__powitf2(INFINITY, 0x80000000, 0)) return 1; if (test__powitf2(-INFINITY, -1, -0.)) return 1; if (test__powitf2(-INFINITY, -2, 0)) return 1; if (test__powitf2(-INFINITY, -3, -0.)) return 1; if (test__powitf2(-INFINITY, -4, 0)) return 1; if (test__powitf2(-INFINITY, 0x80000002, 0)) return 1; if (test__powitf2(-INFINITY, 0x80000001, -0.)) return 1; if (test__powitf2(-INFINITY, 0x80000000, 0)) return 1; if (test__powitf2(2, 10, 1024.)) return 1; if (test__powitf2(-2, 10, 1024.)) return 1; if (test__powitf2(2, -10, 1/1024.)) return 1; if (test__powitf2(-2, -10, 1/1024.)) return 1; if (test__powitf2(2, 19, 524288.)) return 1; if (test__powitf2(-2, 19, -524288.)) return 1; if (test__powitf2(2, -19, 1/524288.)) return 1; if (test__powitf2(-2, -19, -1/524288.)) return 1; if (test__powitf2(2, 31, 2147483648.)) return 1; if (test__powitf2(-2, 31, -2147483648.)) return 1; if (test__powitf2(2, -31, 1/2147483648.)) return 1; if (test__powitf2(-2, -31, -1/2147483648.)) return 1; #else printf("skipped\n"); #endif return 0; }
the_stack_data/162641980.c
void clrscr() { unsigned char *vidmem = (unsigned char *) 0xB8000; const long size = 80 * 25; long loop; // Clear visible video memory for (loop=0; loop<size; loop++) { *vidmem++ = 0; *vidmem++ = 0x0F; } // Set cursor position to 0,0 out(0x3D4, 14); out(0x3D5, 0); out(0x3D4, 15); out(0x3D5, 0); } void print(const char *_message) { unsigned short offset; unsigned long i; unsigned char *vidmem = (unsigned char *)0xB8000; // Read cursor position out(0x3D4, 14); offset = in(0x3D5) << 8; out(0x3D4, 15); offset |= in(0x3D5); // Start at writing at cursor position vidmem += offset*2; // Continue until we reach null character i = 0; while (_message[i] != 0) { *vidmem = _message[i++]; vidmem += 2; } // Set new cursor position offset += i; out(0x3D5, (unsigned char)(offset)); out(0x3D4, 14); out(0x3D5, (unsigned char)(offset >> 8)); }
the_stack_data/80473.c
//a program in c to find LCM of two nos using GCD //testcase1,2,3: input:5 7 input:5 15 // output:35 output:15 int printf(const char * format,...); int scanf(const char * format,...); int main() { long long int n1, n2, i, gcd, lcm; printf("Enter two positive integers: "); scanf("%lld %lld", &n1, &n2); for (i = 1; i <= n1 && i <= n2; ++i) { if (n1 % i == 0 && n2 % i == 0) gcd = i; } lcm = (n1 * n2) / gcd; printf("The LCM is: %lld.", lcm); return 0; }
the_stack_data/127980.c
// general protection fault in rb_erase // https://syzkaller.appspot.com/bug?id=c7fd949e1dcb317375d8c795cbb5965420e0c12d // status:fixed // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include <endian.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/syscall.h> #include <sys/types.h> #include <unistd.h> uint64_t r[1] = {0xffffffffffffffff}; int main(void) { syscall(__NR_mmap, 0x20000000, 0x1000000, 3, 0x32, -1, 0); long res = 0; memcpy((void*)0x20000700, "./bus", 6); syscall(__NR_creat, 0x20000700, 0); memcpy((void*)0x20000780, "./bus", 6); res = syscall(__NR_open, 0x20000780, 0x14103e, 0); if (res != -1) r[0] = res; syscall(__NR_ioctl, r[0], 0x6611); return 0; }
the_stack_data/666007.c
unsigned char key[100]; main() { register i; if ((int)key[i]) key[i] = 0; }
the_stack_data/122014471.c
#include <stdio.h> int numToRepeatMax(int *arr1, int n, int k) { int mx = arr1[0], result = 0; for (int i = 0; i < n; i++) arr1[arr1[i] % k] += k; for (int i = 1; i < n; i++) { if (arr1[i] > mx) { mx = arr1[i]; result = i; } } return result; } int main() { int n; printf("enter number of elements "); scanf("%d", &n); int arr[n]; printf("enter elements: "); for (int i = 0; i < n; i++) { scanf("%d", &arr[i]); } // 4 5 3 3 4 int maxElement=0, count; int maxC = 0; for (int i = 0; i < n; i++) { count = 1; // 5 6 5 2 3 for (int j = i + 1; j < n; j++) { if (arr[j] == arr[i]) { count++; if (count > maxC) { maxElement = arr[j]; } } } } printf("number appears most in that array= %d\n", maxElement); }
the_stack_data/1038066.c
#include <stdio.h> int main() { int c,last,mid,first,n,x,a[100],i; printf("enter no of elements\n"); scanf("%d",&n); printf("enter the integers\n"); for(i=0;i<n;i++) scanf("%d",&a[i]); printf("enter the value to find\n"); scanf("%d",&x); first = 0; last = n-1; mid = (first + last)/2; while(first<=last) { if(a[mid]==x) { printf("found\n"); break; } else if(a[mid]<x) first = mid + 1; else { last = mid + 1; mid = (first+last)/2; } } if(first>last) printf("not found\n"); return(0); }
the_stack_data/211081325.c
#include <err.h> #include <stddef.h> #include <stdio.h> #include <stdlib.h> #define N 8 int main(int argc, char *argv[] __attribute__((unused))) { const int old_val = 15; const int new_val = 42; int i, b, a[N]; ptrdiff_t shift = &b - &(a[0]); b = old_val; if (argc > 1) { printf("b: %p\n", &b); printf("a[0]: %p\n", &(a[0])); if (&b < &(a[0])) { printf("b <- a[0]: %td\n", &(a[0]) - &b); } else { printf("a[N-1] -> b: %td\n", &b - &(a[N-1])); } if (&i == &(a[N])) { printf("overlap\n"); } else { printf("no overlap\n"); } } printf("b = %d\n", b); for (i = 0; i < N; i++) a[i] = i; a[shift] = new_val; printf("setting a[%td] = %d\n", shift, new_val); printf("a[%td] = %d\n", shift, a[shift]); printf("b = %d\n", b); return EXIT_SUCCESS; }
the_stack_data/1212525.c
enum {A = 1} x; unsigned x; enum {B = -1} y; int y;
the_stack_data/90763245.c
void foo(int *A) { double T[2][2]; for (int I = 0; I < 100; ++I) { T[0][0] = I; T[0][1] = I + 1; T[1][0] = I; T[1][1] = I - 1; for (int J = 0; J < 2; ++J) A[I] = T[0][J] * T[1][J]; A[I] = A[I] + A[I+1]; } } //CHECK: Printing analysis 'Dependency Analysis (Metadata)' for function 'foo': //CHECK: loop at depth 1 private_array_7.c:3:3 //CHECK: private: //CHECK: <J:8[8:5], 4> | <T:2, 32> //CHECK: anti: //CHECK: <*A:1, ?>:[1,1] //CHECK: induction: //CHECK: <I:3[3:3], 4>:[Int,0,100,1] //CHECK: read only: //CHECK: <A:1, 8> //CHECK: lock: //CHECK: <I:3[3:3], 4> //CHECK: header access: //CHECK: <I:3[3:3], 4> //CHECK: explicit access: //CHECK: <A:1, 8> | <I:3[3:3], 4> | <J:8[8:5], 4> //CHECK: explicit access (separate): //CHECK: <A:1, 8> <I:3[3:3], 4> <J:8[8:5], 4> //CHECK: lock (separate): //CHECK: <I:3[3:3], 4> //CHECK: direct access (separate): //CHECK: <*A:1, ?> <A:1, 8> <I:3[3:3], 4> <J:8[8:5], 4> <T:2, 32> //CHECK: loop at depth 2 private_array_7.c:8:5 //CHECK: first private: //CHECK: <*A:1, ?> //CHECK: second to last private: //CHECK: <*A:1, ?> //CHECK: induction: //CHECK: <J:8[8:5], 4>:[Int,0,2,1] //CHECK: read only: //CHECK: <A:1, 8> | <I:3[3:3], 4> | <T:2, 32> //CHECK: lock: //CHECK: <J:8[8:5], 4> //CHECK: header access: //CHECK: <J:8[8:5], 4> //CHECK: explicit access: //CHECK: <A:1, 8> | <I:3[3:3], 4> | <J:8[8:5], 4> //CHECK: explicit access (separate): //CHECK: <A:1, 8> <I:3[3:3], 4> <J:8[8:5], 4> //CHECK: lock (separate): //CHECK: <J:8[8:5], 4> //CHECK: direct access (separate): //CHECK: <*A:1, ?> <A:1, 8> <I:3[3:3], 4> <J:8[8:5], 4> <T:2, 32> //SAFE: Printing analysis 'Dependency Analysis (Metadata)' for function 'foo': //SAFE: loop at depth 1 private_array_7.c:3:3 //SAFE: private: //SAFE: <J:8[8:5], 4> //SAFE: output: //SAFE: <T:2:10, 32> //SAFE: anti: //SAFE: <*A:1, ?>:[1:1] | <T:2:10, 32> //SAFE: flow: //SAFE: <T:2:10, 32> //SAFE: induction: //SAFE: <I:3[3:3], 4>:[Int,0,100,1] //SAFE: read only: //SAFE: <A:1, 8> //SAFE: lock: //SAFE: <I:3[3:3], 4> //SAFE: header access: //SAFE: <I:3[3:3], 4> //SAFE: explicit access: //SAFE: <A:1, 8> | <I:3[3:3], 4> | <J:8[8:5], 4> //SAFE: explicit access (separate): //SAFE: <A:1, 8> <I:3[3:3], 4> <J:8[8:5], 4> //SAFE: lock (separate): //SAFE: <I:3[3:3], 4> //SAFE: direct access (separate): //SAFE: <*A:1, ?> <A:1, 8> <I:3[3:3], 4> <J:8[8:5], 4> <T:2:10, 32> //SAFE: loop at depth 2 private_array_7.c:8:5 //SAFE: first private: //SAFE: <*A:1, ?> //SAFE: second to last private: //SAFE: <*A:1, ?> //SAFE: induction: //SAFE: <J:8[8:5], 4>:[Int,0,2,1] //SAFE: read only: //SAFE: <A:1, 8> | <I:3[3:3], 4> | <T:2:10, 32> //SAFE: lock: //SAFE: <J:8[8:5], 4> //SAFE: header access: //SAFE: <J:8[8:5], 4> //SAFE: explicit access: //SAFE: <A:1, 8> | <I:3[3:3], 4> | <J:8[8:5], 4> //SAFE: explicit access (separate): //SAFE: <A:1, 8> <I:3[3:3], 4> <J:8[8:5], 4> //SAFE: lock (separate): //SAFE: <J:8[8:5], 4> //SAFE: direct access (separate): //SAFE: <*A:1, ?> <A:1, 8> <I:3[3:3], 4> <J:8[8:5], 4> <T:2:10, 32>
the_stack_data/107953959.c
/** * @file * * @date Mar 29, 2013 * @author: Anton Bondarev */ #include <errno.h> /* #include <cmd/shell.h> #include <stdlib.h> int system(const char *command) { const struct shell *sh = shell_any(); if (!sh) { return -ENOENT; } return shell_exec(sh, command); } */
the_stack_data/64199126.c
#include <stdio.h> int COM (int n, int k); int main () { int n = 0, k = 0; printf("Type two int numbers: "); scanf("%d %d", &n, &k); int result = COM (n, k); printf("COMB of %d and %d is: %d \n", n, k, result); return 0; } int COM (int n, int k) { if (k > n) { return 0; } else if (k == 1) { return n; } else { return (COM (n - 1, k) + COM (n - 1, k - 1)); } }
the_stack_data/82920.c
#include <stdio.h> int main() { long long x; while( scanf("%lld", &x)==1 ) printf("%lld\n", (x*x*(x+1)*(x+1))/4); return 0; }
the_stack_data/102395.c
typedef enum {false, true} bool; extern int __VERIFIER_nondet_int(void); int main() { int i, j; int c; c = 0; i = 0; while (i < 100) { c = c + 1; i = i + 1; } j = 5; while (j < 21) { c = c + 1; j = j + 3; } return 0; }
the_stack_data/92326739.c
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdbool.h> #include <ctype.h> bool test_extension(const char *file_name, const char *extension); void get_extension(const char *file_name, char *extension); void strtolower(char *s); int main(int argc, char *argv[]) { if (argc != 3) { fprintf(stderr, "Usage: ex17 [file_name] [extension].\n"); exit(EXIT_FAILURE); } bool match = test_extension(argv[1], argv[2]); printf("It is %sa match.\n", match ? "" : "not "); } bool test_extension(const char *file_name, const char *extension) { char file_ext[20], *file_ext_ptr = file_ext; get_extension(file_name, file_ext); for (;toupper(*file_ext_ptr) == toupper(*extension); file_ext_ptr++, extension++) { if (*file_ext_ptr == '\0') { return true; } } return false; } // This accounts for more than one '.' by going back from the end. void get_extension(const char *file_name, char *extension) { const char *p = file_name + (strlen(file_name) - 1); for (;p >= file_name; p--) { if (*p == '.') { strcpy(extension, ++p); return; } } strcpy(extension, ""); }
the_stack_data/51700067.c
#include <stdio.h> float fToC(float f); int main() { int lower, upper, step; lower = 0; upper = 300; step = 20; while (lower <= upper) { printf("%3d %6.1f\n", lower, fToC(lower)); lower = lower + 20; } return 0; } float fToC(float f) { return (5.0/9.0) * (f - 32.0); }
the_stack_data/192331737.c
#include <stdio.h> double average(double, double); int main(void) { double a, b; scanf("%lf %lf", &a, &b); double c = average(a, b); printf("%lf\n", c); return 0; } double average(double a, double b) { double c = 1 / a; double d = 1 / b; return 1 / ((c + d) / 2); }
the_stack_data/34513455.c
void mm(float **A, float **B, float **C, int ambn, int an, int bm) { int i, j, n; for(i = 0; i < an; i++) { for(j = 0; j < bm; j++) { for(n = 0; n < ambn; n++) { C[i][j] += A[i][n] * B[n][j]; } } } }
the_stack_data/89200523.c
foo (double a, double b) { // Example of nested function, not handled by EDG (but it should work if I can turn on the correct options). // After some hunting in the EDG manual: // The following GNU extensions are not currently supported in any GNU mode: // * The forward declaration of function parameters (so they can participate in variable-length array parameters). // * GNU-style complex integral types (complex floating-point types are supported) // * Nested functions // * Local structs with variable-length array fields. Such fields are treated (with a warning) as zero-length arrays in // GNU C mode, which is a useful approximation in some circumstances, but not generally equivalent to the GNU // feature. double square (double z) { return z * z; } return square (a) + square (b); }
the_stack_data/15768.c
/* For Enter 3. *### **## ***# **** ***# **## *### */ #include<stdio.h> int main() { int n,i,j; scanf("%d",&n); for(i=0; i<=n; i++) { for(j=0; j<=i; j++) { printf("*"); } printf("\n"); } for(i=n; i>=1; i--) { for(j=1; j<=i; j++) { printf("*"); } printf("\n"); } return 0; }
the_stack_data/75138039.c
/* Copyright (c) 2014 Quanta Research Cambridge, Inc * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ #include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <string.h> #include <stdint.h> #include <sys/types.h> #include <unistd.h> typedef struct { uint8_t c_magic[6]; uint8_t c_ino[8]; uint8_t c_mode[8]; uint8_t c_uid[8]; uint8_t c_gid[8]; uint8_t c_nlink[8]; uint8_t c_mtime[8]; uint8_t c_filesize[8]; uint8_t c_maj[8]; uint8_t c_min[8]; uint8_t c_rmaj[8]; uint8_t c_rmin[8]; uint8_t c_namesize[8]; uint8_t c_chksum[8]; } Cpio_header; #define MAX_FILENAME 1000 #define MAX_FILECOUNT 500 #define MAX_SEGMENT 1000 #define ALIGN32(A) (((A) + 3) & ~3L) static uint32_t ino_map[MAX_FILECOUNT]; static int ino_map_index = 0; static uint8_t canon_time[8] = "5361C6C0"; // 2014 May 1 static uint32_t get_int32(uint8_t *data) { uint8_t temp[9]; memcpy(temp, data, 8); temp[8] = 0; return strtol(temp, NULL, 16); } int main(int argc, const char **argv) { Cpio_header header; uint32_t ino, nlen, newi; uint8_t data[MAX_SEGMENT], temp[MAX_FILENAME]; int fd = 0; //open("xx.old", O_RDONLY); int verbose = 0; if (argc > 1 && strcmp(argv[1], "--verbose") == 0) verbose = 1; do { read(fd, &header, sizeof(header)); memcpy(temp, header.c_magic, sizeof(header.c_magic)); temp[sizeof(header.c_magic)] = 0; if (strcmp(temp, "070701")) { fprintf(stderr, "Invalid magic number in cpio archive %s\n", temp); exit(-1); } ino = get_int32(header.c_ino); nlen = get_int32(header.c_namesize); /* read filename */ read(fd, temp, nlen); temp[nlen] = 0; /* remap inode numbers into 1..MAX range */ for (newi = 0; newi < MAX_FILECOUNT; newi++) { if (newi == ino_map_index) ino_map[ino_map_index++] = ino; if (ino_map[newi] == ino) break; } int len = ALIGN32(sizeof(header) + nlen) + ALIGN32(get_int32(header.c_filesize)) - sizeof(header) - nlen; if (verbose) fprintf(stderr, "name %s\t\t\t %x new %x mtime %x\n", temp, ino, newi+1, get_int32(header.c_mtime)); sprintf(data, "%08X", newi+1); if (ino) memcpy(header.c_ino, data, sizeof(header.c_ino)); /* Set file modification time to a constant */ memcpy(header.c_mtime, canon_time, sizeof(header.c_mtime)); write(1, &header, sizeof(header)); write(1, temp, nlen); /* read remainder of file */ if (!strcmp(temp, "TRAILER!!!")) len = 9999999; /* HACK */ /* read alignment filler and data bytes */ while (len > 0) { int plen = len; if (plen > sizeof(data)) plen = sizeof(data); int rc = read(fd, data, plen); if (rc == 0) break; write(1, data, rc); len -= rc; } } while (strcmp(temp, "TRAILER!!!")); return 0; }
the_stack_data/36076584.c
/** ****************************************************************************** * File Name : DAC.c * Date : 18/01/2015 10:00:30 * Description : This file provides code for the configuration * of the DAC instances. ****************************************************************************** * * COPYRIGHT(c) 2015 STMicroelectronics * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. Neither the name of STMicroelectronics nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************** */ /* Includes ------------------------------------------------------------------*/ #ifdef USE_GEN #include "dac.h" #include "gpio.h" #include "tim.h" /* USER CODE BEGIN 0 */ /* USER CODE END 0 */ DAC_HandleTypeDef hdac; DMA_HandleTypeDef hdma_dac1; DMA_HandleTypeDef hdma_dac2; uint32_t outputBuffEn=DAC_OUTPUTBUFFER_ENABLE; /* DAC init function */ void MX_DAC_Init(void) { DAC_ChannelConfTypeDef sConfig; /**DAC Initialization */ hdac.Instance = DAC; HAL_DAC_Init(&hdac); /**DAC channel OUT1 config */ sConfig.DAC_Trigger = DAC_TRIGGER_T6_TRGO; sConfig.DAC_OutputBuffer = outputBuffEn; HAL_DAC_ConfigChannel(&hdac, &sConfig, DAC_CHANNEL_1); /**DAC channel OUT2 config */ sConfig.DAC_Trigger = DAC_TRIGGER_T7_TRGO; sConfig.DAC_OutputBuffer = outputBuffEn; HAL_DAC_ConfigChannel(&hdac, &sConfig, DAC_CHANNEL_2); } void HAL_DAC_MspInit(DAC_HandleTypeDef* hdac) { GPIO_InitTypeDef GPIO_InitStruct; if(hdac->Instance==DAC) { /* USER CODE BEGIN DAC_MspInit 0 */ /* USER CODE END DAC_MspInit 0 */ /* Peripheral clock enable */ __DAC_CLK_ENABLE(); /**DAC GPIO Configuration PA4 ------> DAC_OUT1 PA5 ------> DAC_OUT2 */ GPIO_InitStruct.Pin = GPIO_PIN_4|GPIO_PIN_5; GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; GPIO_InitStruct.Pull = GPIO_NOPULL; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); /* USER CODE BEGIN DAC_MspInit 1 */ /* Set the parameters to be configured for Channel1*/ hdma_dac1.Instance = DMA1_Stream5; hdma_dac1.Init.Channel = DMA_CHANNEL_7; hdma_dac1.Init.Direction = DMA_MEMORY_TO_PERIPH; hdma_dac1.Init.PeriphInc = DMA_PINC_DISABLE; hdma_dac1.Init.MemInc = DMA_MINC_ENABLE; hdma_dac1.Init.PeriphDataAlignment = DMA_PDATAALIGN_HALFWORD; hdma_dac1.Init.MemDataAlignment = DMA_PDATAALIGN_HALFWORD; hdma_dac1.Init.Mode = DMA_CIRCULAR; hdma_dac1.Init.Priority = DMA_PRIORITY_HIGH; hdma_dac1.Init.FIFOMode = DMA_FIFOMODE_DISABLE; hdma_dac1.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_HALFFULL; hdma_dac1.Init.MemBurst = DMA_MBURST_SINGLE; hdma_dac1.Init.PeriphBurst = DMA_PBURST_SINGLE; HAL_DMA_Init(&hdma_dac1); /* Associate the initialized DMA handle to the the DAC handle */ __HAL_LINKDMA(hdac, DMA_Handle1, hdma_dac1); /* Set the parameters to be configured for Channel2*/ hdma_dac2.Instance = DMA1_Stream6; hdma_dac2.Init.Channel = DMA_CHANNEL_7; hdma_dac2.Init.Direction = DMA_MEMORY_TO_PERIPH; hdma_dac2.Init.PeriphInc = DMA_PINC_DISABLE; hdma_dac2.Init.MemInc = DMA_MINC_ENABLE; hdma_dac2.Init.PeriphDataAlignment = DMA_PDATAALIGN_HALFWORD; hdma_dac2.Init.MemDataAlignment = DMA_PDATAALIGN_HALFWORD; hdma_dac2.Init.Mode = DMA_CIRCULAR; hdma_dac2.Init.Priority = DMA_PRIORITY_HIGH; hdma_dac2.Init.FIFOMode = DMA_FIFOMODE_DISABLE; hdma_dac2.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_HALFFULL; hdma_dac2.Init.MemBurst = DMA_MBURST_SINGLE; hdma_dac2.Init.PeriphBurst = DMA_PBURST_SINGLE; HAL_DMA_Init(&hdma_dac2); /* Associate the initialized DMA handle to the the DAC handle */ __HAL_LINKDMA(hdac, DMA_Handle2, hdma_dac2); /* USER CODE END DAC_MspInit 1 */ } } void HAL_DAC_MspDeInit(DAC_HandleTypeDef* hdac) { if(hdac->Instance==DAC) { /* USER CODE BEGIN DAC_MspDeInit 0 */ /* USER CODE END DAC_MspDeInit 0 */ /* Peripheral clock disable */ __DAC_CLK_DISABLE(); /**DAC GPIO Configuration PA4 ------> DAC_OUT1 PA5 ------> DAC_OUT2 */ HAL_GPIO_DeInit(GPIOA, GPIO_PIN_4|GPIO_PIN_5); /* USER CODE BEGIN DAC_MspDeInit 1 */ /* USER CODE END DAC_MspDeInit 1 */ } } /* USER CODE BEGIN 1 */ void DAC_DMA_Reconfig(uint8_t chan, uint32_t *buff, uint32_t len){ uint32_t dacChannel=0; switch(chan){ case 0: dacChannel=DAC_CHANNEL_1; break; case 1: dacChannel=DAC_CHANNEL_2; break; } HAL_DAC_Stop_DMA(&hdac,dacChannel); HAL_DAC_Start_DMA(&hdac, dacChannel, buff, len, DAC_ALIGN_12B_R); } void DACDisableOutput(void){ GPIO_InitTypeDef GPIO_InitStruct; GPIO_InitStruct.Pin = GPIO_PIN_4|GPIO_PIN_5; GPIO_InitStruct.Mode = GPIO_MODE_INPUT; GPIO_InitStruct.Pull = GPIO_PULLDOWN; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); } void DACEnableOutput(void){ GPIO_InitTypeDef GPIO_InitStruct; GPIO_InitStruct.Pin = GPIO_PIN_4|GPIO_PIN_5; GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; GPIO_InitStruct.Pull = GPIO_NOPULL; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); } void DACSetOutputBuffer(void){ outputBuffEn=DAC_OUTPUTBUFFER_ENABLE; } void DACUnsetOutputBuffer(void){ outputBuffEn=DAC_OUTPUTBUFFER_DISABLE; } /** * @brief Enable sampling * @param None * @retval None */ void GeneratingEnable (void){ MX_DAC_Init(); DACEnableOutput(); TIMGenEnable(); } /** * @brief Disable sampling * @param None * @retval None */ void GeneratingDisable (void){ DACDisableOutput(); TIMGenDisable(); } /* USER CODE END 1 */ /** * @} */ /** * @} */ #endif //USE_GEN /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
the_stack_data/820555.c
#include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct aluno_ { char nome[101]; char curso[101]; int idade; }dados; int main() { dados aluno; puts("Digite o nome do aluno"); fflush(stdin); gets(aluno.nome); puts("Digite o curso:"); fflush(stdin); gets(aluno.curso); printf("Digite a idade:"); scanf("%d", &aluno.idade); printf("Nome:"); puts(aluno.nome); printf("Curso:"); puts(aluno.curso); printf("Idade:%d", aluno.idade); return 0; }
the_stack_data/135589.c
/* Filename : pspawn5.c * Description : test POSIX_SPAWN_SETSIGMASK * Notes : * 1st Release : sunyzero */ #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <fcntl.h> #include <spawn.h> #include <sys/wait.h> int main() { int ret_err = 0, i=0, i_child = 0; pid_t pid_child[16]; char buf_err[64]; char *argv_child_x[] = { "pspawn5_child_x", NULL }; char *argv_child_y[] = { "pspawn5_child_y", NULL }; printf("Parent[%d]: Start\n", getpid()); sigset_t sigset_block; sigemptyset(&sigset_block); sigaddset(&sigset_block, SIGUSR1); sigaddset(&sigset_block, SIGUSR2); sigaddset(&sigset_block, SIGTERM); sigprocmask(SIG_SETMASK, &sigset_block, NULL); posix_spawnattr_t posix_attr; if ((ret_err = posix_spawnattr_init(&posix_attr)) != 0) { strerror_r(ret_err, buf_err, sizeof(buf_err)); fprintf(stderr, "Fail: attr_init: %s\n", buf_err); exit(EXIT_FAILURE); } short posix_flags = POSIX_SPAWN_SETSIGDEF | POSIX_SPAWN_SETSIGMASK; if ((ret_err = posix_spawnattr_setflags(&posix_attr, posix_flags)) != 0) { strerror_r(ret_err, buf_err, sizeof(buf_err)); fprintf(stderr, "Fail: attr_setflags: %s\n", buf_err); exit(EXIT_FAILURE); } sigset_t sigset_mask; /* 1st group */ sigemptyset(&sigset_mask); sigaddset(&sigset_mask, SIGUSR2); // block SIGUSR2 if ((ret_err = posix_spawnattr_setsigmask(&posix_attr, &sigset_mask)) != 0) { strerror_r(ret_err, buf_err, sizeof(buf_err)); fprintf(stderr, "Fail: attr_setsigmask: %s\n", buf_err); exit(EXIT_FAILURE); } for (i=2; i--; ) { ret_err = posix_spawn( &pid_child[i_child++], argv_child_x[0], NULL, &posix_attr, /* attribute */ argv_child_x, NULL); } /* 2nd group */ sigemptyset(&sigset_mask); sigaddset(&sigset_mask, SIGUSR1); // block SIGUSR1 if ((ret_err = posix_spawnattr_setsigmask(&posix_attr, &sigset_mask)) != 0) { strerror_r(ret_err, buf_err, sizeof(buf_err)); fprintf(stderr, "Fail: attr_setsigmask: %s\n", buf_err); exit(EXIT_FAILURE); } for (i=2; i--; ) { ret_err = posix_spawn( &pid_child[i_child++], argv_child_y[0], NULL, &posix_attr, /* attribute */ argv_child_y, NULL); } sleep(1); /* wait stdio buffering */ printf("Parent[%d]: # of Child processes [%d]\n", getpid(), i_child); for (i=0; i<i_child; i++) { printf("\t* Child[%d] : %d\n", i, pid_child[i]); } kill(-getpgid(0), SIGUSR1); /* equivalent to killpg(getpgid(0), SIGUSR1) */ kill(-getpgid(0), SIGUSR2); sleep(1); kill(-getpgid(0), SIGTERM); /* destroy spawnattr structure in order to free memory */ if ((ret_err = posix_spawnattr_destroy(&posix_attr)) != 0) { strerror_r(ret_err, buf_err, sizeof(buf_err)); fprintf(stderr, "Fail: attr_destroy: %s\n", buf_err); exit(EXIT_FAILURE); } printf("Parent[%d]: Wait for child\n", getpid()); for (i=0; i<i_child; i++) (void)waitpid(-1, NULL, WNOHANG); /* wait for child */ printf("Parent[%d]: Exit\n", getpid()); sleep(1); /* wait for flushing child's stdio buf */ return 0; }
the_stack_data/715639.c
#include <stdio.h> #include <stdlib.h> #include <time.h> const int LINESIZE = 48; const int FIRST = 5; const int SECOND = 36; const char OFFSET = 'A'; const int TIME = 61; const int DONE = -1; const int PROGRESS = -2; const int IDLE = -1; #define ALPHABET 26 #define WORKERS 5 // Will hold the number of dependencies left for the given step to be run static int counts[ALPHABET]; // Will hold STEP -> Steps to do before static int dependencies[ALPHABET][ALPHABET]; static int seen[ALPHABET]; // Will hold which task each worker is doing static int workers[WORKERS]; // Will hold time left for each task static int timeleft[WORKERS]; char* parseline(char* s, char* l1, char* l2) { *l1 = *(s + FIRST); *l2 = *(s + SECOND); return s + LINESIZE; } int run(char* s) { int i, j, k, nb; nb = i = j = k = 0; // Init arrays for (i = 0; j < ALPHABET; i++) for (j = 0; j < ALPHABET; j++) dependencies[i][j] = DONE; for (i = 0; i < WORKERS; ++i) workers[i] = IDLE; char first, second; for (;; s++) { s = parseline(s, &first, &second); nb += seen[first - OFFSET] == 0 ? 1 : 0; nb += seen[second - OFFSET] == 0 ? 1 : 0; seen[first - OFFSET] = 1; seen[second - OFFSET] = 1; counts[second - OFFSET]++; dependencies[first - OFFSET][second - OFFSET] = 1; if (*s == '\0') break; } int pos = 0; int smallest, w; int timestamp = 0; while (pos != nb) { for (i = 0; i < nb && pos != nb;) { // i should be done if (counts[i] == 0) { // Find a worker for this task for (k = 0; k < WORKERS; k++) { if (workers[k] == IDLE) { counts[i] = PROGRESS; workers[k] = i; timeleft[k] = TIME + i; break; } // No workers were found just skip this task for the moment } } i++; } w = -1; smallest = TIME + ALPHABET + 1; // Advance time by taking the smallest working time for (k = 0; k < WORKERS; k++) { if (workers[k] != IDLE && timeleft[k] < smallest) { smallest = timeleft[k]; w = k; } } for (j = 0; j < nb; j++) { if (dependencies[workers[w]][j] > 0) { dependencies[workers[w]][j] = DONE; counts[j]--; } } for (k = 0; k < WORKERS; k++) { timeleft[k] -= smallest; if (k == w) { timestamp += smallest; pos++; i = 0; workers[k] = IDLE; } } } return timestamp; } int main(int argc, char** argv) { if (argc < 2) { printf("Missing one argument\n"); exit(1); } clock_t start = clock(); int answer = run(argv[1]); printf("_duration:%f\n%d\n", (float)(clock() - start) * 1000.0 / CLOCKS_PER_SEC, answer); return 0; }
the_stack_data/132954138.c
// Configuration bits: selected in the GUI // FDEVOPT #pragma config SOSCHP = OFF //Secondary Oscillator High Power Enable bit->SOSC oprerates in normal power mode. #pragma config ALTI2C = OFF //Alternate I2C1 Pins Location Enable bit->Primary I2C1 pins are used #pragma config FUSBIDIO = OFF //USBID pin control->USBID pin is controlled by the USB module #pragma config FVBUSIO = OFF //VBUS Pin Control->VBUS pin is controlled by the USB module // FICD #pragma config JTAGEN = OFF //JTAG Enable bit->JTAG is disabled #pragma config ICS = PGx2 //ICE/ICD Communication Channel Selection bits->Communicate on PGEC2/PGED2 // FPOR #pragma config BOREN = BOR3 //Brown-out Reset Enable bits->Brown-out Reset enabled in hardware; SBOREN bit disabled #pragma config RETVR = OFF //Retention Voltage Regulator Enable bit->Retention regulator is disabled #pragma config LPBOREN = ON //Downside Voltage Protection Enable bit->Low power BOR is enabled, when main BOR is disabled // FWDT #pragma config SWDTPS = PS1048576 //Sleep Mode Watchdog Timer Postscale Selection bits->1:1048576 #pragma config FWDTWINSZ = PS25_0 //Watchdog Timer Window Size bits->Watchdog timer window size is 25% #pragma config WINDIS = OFF //Windowed Watchdog Timer Disable bit->Watchdog timer is in non-window mode #pragma config RWDTPS = PS1048576 //Run Mode Watchdog Timer Postscale Selection bits->1:1048576 #pragma config RCLKSEL = LPRC //Run Mode Watchdog Timer Clock Source Selection bits->Clock source is LPRC (same as for sleep mode) #pragma config FWDTEN = OFF //Watchdog Timer Enable bit->WDT is disabled // FOSCSEL #pragma config FNOSC = FRCDIV //Oscillator Selection bits->FRCDIV #pragma config PLLSRC = FRC //System PLL Input Clock Selection bit->FRC oscillator is selected as PLL reference input on device reset #pragma config SOSCEN = OFF //Secondary Oscillator Enable bit->Secondary oscillator is disabled #pragma config IESO = OFF //Two Speed Startup Enable bit->Two speed startup is disabled #pragma config POSCMOD = OFF //Primary Oscillator Selection bit->Primary oscillator is disabled #pragma config OSCIOFNC = OFF //System Clock on CLKO Pin Enable bit->OSCO pin operates as a normal I/O #pragma config SOSCSEL = ON //Secondary Oscillator External Clock Enable bit->SCLKI pin configured for Digital mode #pragma config FCKSM = CSECMD //Clock Switching and Fail-Safe Clock Monitor Enable bits->Clock switching is enabled; Fail-safe clock monitor is disabled // FSEC #pragma config CP = OFF //Code Protection Enable bit->Code protection is disabled
the_stack_data/113147.c
#include <stdio.h> int rep() { return 0; } int main() { int n, i; char **P; scanf("%d\n",&n); P=malloc(n*sizeof(char*)); for (i=0; i<n; i++) { P[i]=malloc(50*sizeof(char)); gets(P[i]); } for (i=0; i<n; i++) free(P[i]); free(P); return 0; } /* bba acabaab babccaab abccaabac aabacacab bbabccaabacacabaab bba (ba)bccaab (abccaab)ac (aabac)acab (acab)aab */
the_stack_data/134601.c
void foo() { #pragma scop const int a = 3; #pragma endscop }
the_stack_data/1252837.c
#include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <errno.h> #include <string.h> #include <sys/types.h> int main(void) { int listenfd = 0; int connfd = 0; int bytesReceived = 0; char recvBuff[256]; struct sockaddr_in serv_addr; listenfd = socket(AF_INET, SOCK_STREAM, 0); printf("Socket retrieve success\n"); memset(&serv_addr, '0', sizeof(serv_addr)); memset(recvBuff, '0', sizeof(recvBuff)); serv_addr.sin_family = AF_INET; serv_addr.sin_addr.s_addr = htonl(INADDR_ANY); serv_addr.sin_port = htons(5000); bind(listenfd, (struct sockaddr*)&serv_addr,sizeof(serv_addr)); if(listen(listenfd, 10) == -1) { printf("Failed to listen\n"); return -1; } while(1) { connfd = accept(listenfd, (struct sockaddr*)NULL ,NULL); /* Create file where data will be stored */ FILE *fp; fp = fopen("log-w-date.txt", "ab"); if(NULL == fp) { printf("Error opening file"); return 1; } /* Receive data in chunks of 256 bytes */ while((bytesReceived = read(connfd, recvBuff, 256)) > 0) { printf("Bytes received %d\n",bytesReceived); // recvBuff[n] = 0; fwrite(recvBuff, 1,bytesReceived,fp); // printf("%s \n", recvBuff); } if(bytesReceived < 0) { printf("\n Read Error \n"); } fclose(fp); close(connfd); sleep(1); } return 0; }
the_stack_data/181393678.c
#include <stdio.h> #include <wchar.h> #include <locale.h> int main() { setlocale(LC_CTYPE, ""); wchar_t star = 0x2605; wprintf(L"%lc\n", star); }
the_stack_data/22174.c
/* * Write a program that requests the user to enter a Fahrenheit temperature. The * program should read the temperature as a type double number and pass it as an * argument to a user-supplied function called Temperatures(). This function * should calculate the Celsius equivalent and the Kelvin equivalent and display * all three temperatures with a precision of two places to the right of the * decimal. It should identify each value with the temperature scale it * represents. Here is the formula for converting Fahrenheit to Celsius: * * Celsius = 5.0 / 9.0 * (Fahrenheit - 32.0) * * The Kelvin scale, commonly used in science, is a scale in which 0 represents * absolute zero, the lower limit to possible temperatures. Here is the formula * for converting Celsius to * * Kelvin: Kelvin = Celsius + 273.16 * * The Temperatures() function should use const to create symbolic * representations of the three constants that appear in the conversions. The * main() function should use a loop to allow the user to enter temperatures * repeatedly, stopping when a q or other nonnumeric value is entered. Use the * fact that scanf() returns the number of items read, so it will return 1 if it * reads a number, but it won’t return 1 if the user enters q. The == operator * tests for equality, so you can use it to compare the return value of scanf() * with 1. */ #include <stdio.h> void print_temperatures(const double temp_f) { const double c1 = 5.0/9.0; const double c2 = 32; const double c3 = 273.16; double temp_c, temp_k; temp_c = c1 * (temp_f - c2); temp_k = temp_c + c3; printf("Temperature (F): %.3f\n", temp_f); printf("Temperature (C): %.3f\n", temp_c); printf("Temperature (K): %.3f\n", temp_k); return; } int main (void) { double temp_f; printf("Enter a temperature in Fahrenheit: "); while (scanf("%lf", &temp_f) == 1) { print_temperatures(temp_f); printf("Enter a temperature in Fahrenheit: "); } return 0; }
the_stack_data/22011876.c
/*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Chris Torek. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if defined(LIBC_SCCS) && !defined(lint) static char rcsid[] = "$OpenBSD: clrerr.c,v 1.2 1996/08/19 08:32:17 tholo Exp $"; #endif /* LIBC_SCCS and not lint */ #include <stdio.h> #undef clearerr void clearerr(fp) FILE *fp; { __sclearerr(fp); }
the_stack_data/182952748.c
#include<stdio.h> /* $Id: hunni.c,v 1.5 1996/11/17 20:58:04 schweikh Exp schweikh $ */ /* usage: hunni [n_op [start [increment [goal]]]] */ /* Up to 20! = 2432902008176640000 */ /* < 9223372036854775807 = 2^63-1 */ /* n! fits in signed long long ints, */ /* with 19 operators there are 4^19 = 274,877,906,944 combinations, */ /* up to 12! = 479001600 */ /* < 2147483647 = 2^31-1 */ /* n! fits in signed long ints, */ /* with 11 operators there are 4^11 = 4,194,304 combinations. */ /*@-loopswitchbreak@*/ /*@-protoparamprefix p_@*/ /*@-pointerarith@*/ /*@+ignorequals@*/ #define FMT "%ld" /* printf and scanf format for this type */ #define LONGEST long /* longest type of this implementation */ typedef struct { LONGEST num, den; } fraction; typedef unsigned LONGEST bitvec; static fraction init[20], work[20], param[4] = { { 9, 1 } , { 1, 1 } , { 1, 1 } , { 6 * 7, 1 } }; static int J; static void out (fraction f) { if (f.den - 1) { J = printf (FMT "/" FMT, f.num, f.den); } else { J = printf (FMT, f.num); } } static void normalize (fraction *p_f) { LONGEST a = (*p_f).num, b = (*p_f).den; if (b) { while (a) { LONGEST i = b % a; b = a; a = i; } b = b < 0 ? - b : b ; (*p_f).num /= b; (*p_f).den /= b; } } int main (int argc, char *argv[]) { bitvec m, mask; int i, cursor; for (i = 1; i < 5; i = i + 1) { if (argc > i) { J = sscanf (argv[i], FMT "/" FMT, &param[i-1].num, &param[i-1].den); } normalize (param + i - 1); } init[0] = param[1]; for (i = 0; i < param[0].num; i = i + 1) { init[i+1].num = init[i].num * param[2].den + param[2].num * init[i].den; init[i+1].den = init[i].den * param[2].den; normalize (init + i + 1); } for (mask = ~(~0 << param[0].num*2); ~(bitvec)0 - mask; mask = mask - 1) { /* Pass one computes mult and div. */ /* For add and sub the right operand is copied. */ work[cursor = 0] = init[0]; for (m = mask, i = 1; ! (i > param[0].num); i = i + 1, m = m / 4) { if ((m & 3) < 2) { if (m & 1) { work[cursor].num *= init[i].den; if ((work[cursor].den *= init[i].num) < 0) { work[cursor].num *= -1; work[cursor].den *= -1; } } else { work[cursor].num *= init[i].num; work[cursor].den *= init[i].den; } } else { work[cursor = cursor + 1] = init[i]; } } /* Pass two computes the remaining adds and subs. */ for (m = mask, i = cursor = 0; i < param[0].num; i = i + 1, m = m / 4) { if ((m & 3) > 1) { work[0].num = work[0].num * work[cursor+1].den + ((m & 1) ? -1 : +1) * work[cursor+1].num * work[0].den; work[0].den = work[0].den * work[cursor = cursor + 1].den; } } normalize (work); /* output result */ if (!param[3].den || (!(param[3].num - work[0].num) && !(param[3].den - work[0].den))) { for (m = mask, i = 0; i < param[0].num; i = i + 1, m = m / 4) { out (init[i]); J = printf (" %c ", "*/+-"[m & 3]); } out (init[i]); J = printf (" = "); out (work[0]); J = printf ("%c", 10); /* newline */ } } return J - 1; }
the_stack_data/198581533.c
#include <stdio.h> #include <string.h> int fwrite_ok(const char* p_str, FILE *p_file) { size_t bytes_written; size_t bytes_to_write; bytes_to_write = strlen(p_str); bytes_written = fwrite(p_str, sizeof(char), bytes_to_write, p_file); if (bytes_to_write != bytes_written) { return 0; } else { return 1; } }
the_stack_data/128996.c
/* { dg-do compile } */ /* { dg-options "-O2 -fdump-tree-profile_estimate" } */ extern int global; int bar(int); void foo (int bound) { int i, ret = 0; for (i = 0; i < bound; i++) { if (i > bound) global += bar (i); if (i >= bound + 2) global += bar (i); if (i > bound - 2) global += bar (i); if (i + 2 > bound) global += bar (i); if (i == 10) global += bar (i); } } /* { dg-final { scan-tree-dump-times "guess loop iv compare heuristics of edge\[^:\]*: 2.0%" 4 "profile_estimate"} } */
the_stack_data/326548.c
/*利用函数和结构体 当时间达到午夜时 切换到下一天 */ #include <stdio.h> #include <stdbool.h> bool isMidnight = false; struct date { int month; int day; int year; }; struct time { int hour; int minutes; int seconds; }; struct dateAndTime { struct date sdate; struct time stime; }; //此函数计算明天的日期 struct date dateUpdate(struct date today) { struct date tomorrow; int numberOfDays(struct date d); if(today.day != numberOfDays(today)){ tomorrow.day = today.day + 1; tomorrow.month = today.month; tomorrow.year = today.year; } else if(today.month == 12){ //年末 tomorrow.day = 1; tomorrow.month = 1; tomorrow.year = today.year + 1; } else{ //月末 tomorrow.day = 1; tomorrow.month = today.month + 1; tomorrow.year = today.year; } return tomorrow; } //此函数计算一个月份中的天数 int numberOfDays(struct date d) { int days; bool isLeapYear(struct date d); const int daysPerMonth[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; if(isLeapYear(d) == true && d.month == 2) days = 29; else days = daysPerMonth[d.month - 1]; return days; } //此函数判断是否为闰年 bool isLeapYear(struct date d) { bool leapYearFlag; if((d.year % 4 == 0 && d.year % 100 != 0) || d.year % 400 == 0) leapYearFlag = true; //是闰年 else leapYearFlag = false; //不是闰年 return leapYearFlag; } //此函数每秒更新一次时间 struct time timeUpdate(struct time now) { ++now.seconds; if(now.seconds == 60){ //下一分钟 now.seconds = 0; ++now.minutes; if(now.minutes == 60){ //下一小时 now.minutes = 0; ++now.hour; if(now.hour == 24) //午夜 now.hour = 0; isMidnight = true; } } return now; } struct dateAndTime clockKeeper(struct dateAndTime dateTime) { struct time timeUpdate(struct time now); struct date dateUpdate(struct date today); dateTime.stime = timeUpdate(dateTime.stime); if(isMidnight) dateTime.sdate = dateUpdate(dateTime.sdate); return dateTime; } int main(void) { struct dateAndTime event = {{2, 1, 2015}, {23, 59, 59}}; printf("Date is %i/%i/%i and time is %.2i:%.2i:%.2i.\n", event.sdate.month, event.sdate.day, event.sdate.year, event.stime.hour, event.stime.minutes, event.stime.seconds); event = clockKeeper(event); printf("One second later...\n"); printf("Date is %i/%i/%i and time is %.2i:%.2i:%.2i.\n", event.sdate.month, event.sdate.day, event.sdate.year, event.stime.hour, event.stime.minutes, event.stime.seconds); return 0; }
the_stack_data/507570.c
/* { dg-do compile } */ struct { long a : 17; } b; int c, d; void e() { b.a = d + c + ~(long)(302806U >> 0); }
the_stack_data/182951993.c
#include <stdio.h> int main() { // Escreva um algoritmo que armazene o valor 10 em uma variável A e o valor 20 em uma variável B. // A seguir (utilizando apenas atribuições entre variáveis) troque os seus conteúdos fazendo com que o // valor que está em A passe para B e vice-versa. Ao final, escrever os valores que ficaram armazenados // nas variáveis. int a = 10; int b = 20; int temp; temp = a; a = b; b = temp; printf("valor de a é: %d. Valor de b é: %d.", a, b); //resultado após compilar: "valor de a é: 20. Valor de b é: 10." }
the_stack_data/48665.c
#include <stdio.h> int main() { int ara[5] = {10, 20, 30, 40, 50}; printf("First element: %d\n", ara[0]); printf("Third element: %d\n", ara[2]); return 0; }
the_stack_data/668399.c
#include <stdio.h> int main() { int x[10], i; for (i = 0; i < 10; i++) { scanf("%d", &x[i]); if (x[i] <= 0) { x[i] = 1; } } for (i = 0; i < 10; i++) { printf("X[%d] = %d\n", i, x[i]); } return 0; }
the_stack_data/855308.c
#include "stdio.h" _Bool var = 1; _Bool v = 0; int main() { printf("%d\n", v); printf("%d\n", var); var; return 0; }
the_stack_data/893280.c
#include <stdio.h> #include <math.h> #include <assert.h> /* Approximates the root of a positive number until it is below a specifix threshold (tau). */ double sqrtNew(double x, double tau) { assert(x > 0); assert(tau > 0); // initialize first and second elements of the sequence double x_current = (1 + x) / 2; double x_next = (x_current + x/x_current) / 2; // calculate next element of the sequence until below threshold while ((fabs(x_current - x_next) / fabs(x_current) > tau) && fabs(x_current) > tau) { x_current = x_next; x_next = (x_current + x/x_current) / 2; } return x_current; } int main() { double x = 0; double tau = 0; double result = 0; double reference = 0; // get input printf("x: "); scanf("%lf", &x); printf("tau: "); scanf("%lf", &tau); // get root approximation and reference result = sqrtNew(x, tau); reference = sqrt(x); // outputs printf("Approx.: %lf\n", result); printf("Reference: %lf\n", reference); printf("Error: %lf\n", fabs(result - reference)); }
the_stack_data/22013525.c
// // #include <stdio.h> int main (void) { float a, b, c, d, grade; printf("Enter thresholds for A, B, C, D\n"); printf("in that order, decreasing percentages > "); scanf("%f%f%f%f", &a, &b, &c, &d); printf("Thank you. Now enter student score (percent) >"); scanf("%f", &grade); if (grade>=a) printf("Student has an A grade\n"); else if (grade>=b) printf("Student has an B grade\n"); else if (grade>=c) printf("Student has an C grade\n"); else if (grade>=d) printf("Student has an D grade\n"); else printf("Student has an F grade\n"); return(0); }
the_stack_data/780522.c
/* { dg-options { -nostartfiles below100.o -Tbelow100.ld -O2 } } */ /* { dg-final { scan-assembler "bp 32533,#0" } } */ typedef struct { unsigned short b0:1; unsigned short b1:1; unsigned short b2:1; unsigned short b3:1; unsigned short b4:1; unsigned short b5:1; unsigned short b6:1; unsigned short b7:1; unsigned short b8:1; unsigned short b9:1; unsigned short b10:1; unsigned short b11:1; unsigned short b12:1; unsigned short b13:1; unsigned short b14:1; unsigned short b15:1; } BitField; #define SFRA (*((volatile BitField*)0x7f14)) unsigned short *pA = (unsigned short *) 0x7f14; #define SFRB (*((volatile BitField*)0x7f10)) unsigned short *pB = (unsigned short *) 0x7f10; char * Do (void) { if (!SFRA.b8) { if (!SFRB.b8) return "Fail"; else return "Success"; } else return "Fail"; } int main (void) { *pA = 0x1234; *pB = 0xedcb; return Do ()[0] == 'F'; }
the_stack_data/100139298.c
/** @file patest_hang.c @ingroup test_src @brief Play a sine then hang audio callback to test watchdog. @author Ross Bencina <[email protected]> @author Phil Burk <[email protected]> */ /* * $Id: patest_hang.c 1368 2008-03-01 00:38:27Z rossb $ * * This program uses the PortAudio Portable Audio Library. * For more information see: http://www.portaudio.com * Copyright (c) 1999-2000 Ross Bencina and Phil Burk * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files * (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, * publish, distribute, sublicense, and/or sell copies of the Software, * and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that * they can be incorporated into the canonical version. It is also * requested that these non-binding requests be included along with the * license above. */ #include <stdio.h> #include <math.h> #include "portaudio.h" #define SAMPLE_RATE (44100) #define FRAMES_PER_BUFFER (1024) #ifndef M_PI #define M_PI (3.14159265) #endif #define TWOPI (M_PI * 2.0) typedef struct paTestData { int sleepFor; double phase; } paTestData; /* This routine will be called by the PortAudio engine when audio is needed. ** It may called at interrupt level on some machines so don't do anything ** that could mess up the system like calling malloc() or free(). */ static int patestCallback( const void *inputBuffer, void *outputBuffer, unsigned long framesPerBuffer, const PaStreamCallbackTimeInfo* timeInfo, PaStreamCallbackFlags statusFlags, void *userData ) { paTestData *data = (paTestData*)userData; float *out = (float*)outputBuffer; unsigned long i; int finished = 0; double phaseInc = 0.02; double phase = data->phase; (void) inputBuffer; /* Prevent unused argument warning. */ for( i=0; i<framesPerBuffer; i++ ) { phase += phaseInc; if( phase > TWOPI ) phase -= TWOPI; /* This is not a very efficient way to calc sines. */ *out++ = (float) sin( phase ); /* mono */ } if( data->sleepFor > 0 ) { Pa_Sleep( data->sleepFor ); } data->phase = phase; return finished; } /*******************************************************************/ int main(void); int main(void) { PaStream* stream; PaStreamParameters outputParameters; PaError err; int i; paTestData data = {0}; printf("PortAudio Test: output sine wave. SR = %d, BufSize = %d\n", SAMPLE_RATE, FRAMES_PER_BUFFER ); err = Pa_Initialize(); if( err != paNoError ) goto error; outputParameters.device = Pa_GetDefaultOutputDevice(); /* Default output device. */ if (outputParameters.device == paNoDevice) { fprintf(stderr,"Error: No default output device.\n"); goto error; } outputParameters.channelCount = 1; /* Mono output. */ outputParameters.sampleFormat = paFloat32; /* 32 bit floating point. */ outputParameters.hostApiSpecificStreamInfo = NULL; outputParameters.suggestedLatency = Pa_GetDeviceInfo(outputParameters.device) ->defaultLowOutputLatency; err = Pa_OpenStream(&stream, NULL, /* No input. */ &outputParameters, SAMPLE_RATE, FRAMES_PER_BUFFER, paClipOff, /* No out of range samples. */ patestCallback, &data); if (err != paNoError) goto error; err = Pa_StartStream( stream ); if( err != paNoError ) goto error; /* Gradually increase sleep time. */ /* Was: for( i=0; i<10000; i+= 1000 ) */ for(i=0; i <= 1000; i += 100) { printf("Sleep for %d milliseconds in audio callback.\n", i ); data.sleepFor = i; Pa_Sleep( ((i<1000) ? 1000 : i) ); } printf("Suffer for 10 seconds.\n"); Pa_Sleep( 10000 ); err = Pa_StopStream( stream ); if( err != paNoError ) goto error; err = Pa_CloseStream( stream ); if( err != paNoError ) goto error; Pa_Terminate(); printf("Test finished.\n"); return err; error: Pa_Terminate(); fprintf( stderr, "An error occured while using the portaudio stream\n" ); fprintf( stderr, "Error number: %d\n", err ); fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) ); return err; }
the_stack_data/90529.c
#include <assert.h> #include <stdlib.h> #include <time.h> #include <stdbool.h> /** * Bubble Sort algorithm recursion. * @param arr the array. * @param length the length of array. */ void bubbleSort(int *arr, int length) { if (length == 1) { return; } bool swapped = false; for (int i = 0; i < length - 1; ++i) { if (arr[i] > arr[i + 1]) { int temp = arr[i]; arr[i] = arr[i + 1]; arr[i + 1] = temp; swapped = true; } } if (!swapped) { return; } bubbleSort(arr, length - 1); } void test() { const int size = 10; int *arr = (int *) calloc(size, sizeof(int)); /* generate size random numbers from 0 to 100 */ for (int i = 0; i < size; i++) { arr[i] = rand() % 100; } bubbleSort(arr, size); for (int i = 0; i < size - 1; ++i) { assert(arr[i] <= arr[i + 1]); } free(arr); } int main() { /* initial random number generator */ srand(time(NULL)); test(); return 0; }
the_stack_data/984031.c
/* { dg-do compile } */ /* { dg-skip-if "No __builtin_cbrt" { powerpc*-*-darwin* } } */ /* { dg-options "-O2 -ffast-math -fno-inline -fno-unroll-loops -lm -mpowerpc-gpopt -fno-ident" } */ #include <math.h> extern void abort (void); #define NVALS 6 static double convert_it (double x) { return pow (x, 1.0 / 3.0); } int main (int argc, char *argv[]) { double values[NVALS] = { 3.0, 1.95, 2.227, 729.0, 64.0, .0008797 }; unsigned i; for (i = 0; i < NVALS; i++) if (convert_it (values[i]) != cbrt (values[i])) abort (); return 0; } /* { dg-final { scan-assembler-times "cbrt" 2 { target powerpc*-*-* } } } */ /* { dg-final { scan-assembler-not "bl\[\\. \]+pow" { target powerpc*-*-* } } } */
the_stack_data/20449115.c
/********************************************************************* * Filename: SelectionSort_Int.Array.c * Author: Javier Montenegro (https://javiermontenegro.github.io/) * Copyright: * Details: This code is the implementation of the selectionsort algorithm. *********************************************************************/ #include <stdio.h> #include <time.h> #define NARRAY 10 void selection_sort(int a[], int size); void print(int arr[]); void selection_sort(int a[], int size) { int i = 0; int j = 0; int large = 0; int index = 0; for(i = size - 1; i > 0; i--) { large = a[0]; index = 0; for(j = 1; j <= i; j++) if(a[j] > large) { large = a[j]; index = j; }//End if a[index] = a[i]; a[i] = large; }//End for }//End selection_sort void print(int arr[]) { int i; for(i = 0; i < NARRAY; ++i) { printf("%d ", arr[i]); } printf("\n"); }//End print int main() { int array[NARRAY] = {29,25,-1,49,9,37,21,43}; printf("Initial array\n"); print(array); printf("------------\n"); clock_t start = clock(); selection_sort(array, NARRAY); clock_t end = clock(); double time_spent = (double)(end - start) / CLOCKS_PER_SEC; printf("Sorted array\n"); print(array); printf("Time spent sorting: %f\n", time_spent); return 0; }//End main
the_stack_data/23573961.c
extern const unsigned char Pods_UrbanCrawlVersionString[]; extern const double Pods_UrbanCrawlVersionNumber; const unsigned char Pods_UrbanCrawlVersionString[] __attribute__ ((used)) = "@(#)PROGRAM:Pods_UrbanCrawl PROJECT:Pods-1" "\n"; const double Pods_UrbanCrawlVersionNumber __attribute__ ((used)) = (double)1.;
the_stack_data/119.c
/* { dg-options "-Wformat" } */ int main (int argc, char **argv) { char buf[10]; char c[] = "%i"; unsigned char uc[] = "%i"; const char cc[] = "%i"; const unsigned char cuc[] = "%i"; __builtin_sprintf(buf, (char *)c, 1); __builtin_sprintf(buf, (char *)uc, 1); __builtin_sprintf(buf, (char *)cc, 1); __builtin_sprintf(buf, (char *)cuc, 1); /* { dg-warning "format string is not an array of type 'char'" } */ __builtin_sprintf(buf, (const char *)L"foo"); /* { dg-warning "format is a wide character string" } */ return 0; }
the_stack_data/943231.c
#include "stdio.h" int main() { int a, b, c, d; scanf("%d%d%d%d", &a, &b, &c, &d); printf("%s", (a > b || a > c || a > d) ? "N" : "S"); return 0; }
the_stack_data/57729.c
#include<stdio.h> #include<stdlib.h> int main(){ printf("the min valu of is %f\n",2.3 ); }
the_stack_data/18888066.c
#include <stdio.h> int vet[100010]; int main(){ int ncasos; scanf("%d", &ncasos); for(int i = 0; i < ncasos; i++){ int tam, grito; scanf("%d %d", &tam, &grito); for(int j = 1; j <= tam; j++){ scanf("%d", &vet[j]); } for(int k = 1; k <= tam; k++){ if(vet[k] == grito){ vet[k+1]*=-1; vet[k-1]*=-1; } } for(int l = 1; l <= tam; l++){ if(l < tam){ printf("%d ", vet[l]); } else printf("%d", vet[l]); } if(i < ncasos-1){ printf("\n"); } } return 0; }
the_stack_data/98576130.c
a, b, c; *d(e) { int *f; long *g; h(g[a]); f = d(); i(b, f[0] & 5); j(c); }
the_stack_data/200143415.c
#include <stdio.h> /* #define _USE_MATH_DEFINES */ #include <math.h> int main() { float x, y; int step, min, sec; printf(" x\tstepeni\tminuti\tsekundi\n"); for (x = 0.02; x <= 0.8; x += 0.01) { y = 180/M_PI * atan(x / sqrt(1 - x*x)); step = y; min = (y - step) * 60; sec = ((y - step) * 60 - min) * 60 + 0.5; printf("%5.2f\t%3d\t %2d\t %2d\n", x, step, min, sec); } return 0; }
the_stack_data/1065020.c
//7.Find the output of the following program #include<stdio.h> int main() { int a[5]={5,1,15,20,25}; int i,j,m; i= ++a[1]; j= a[1]++; m= a[i++]; printf("%d,%d,%d",i,j,m); return 0; } //O/P //3,2,15
the_stack_data/132954073.c
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <pthread.h> void fcn_5() { printf("thread is is exiting\n"); fflush(stdout); pthread_exit(NULL); } void fcn_4() { fcn_5(); } void fcn_3() { fcn_4(); } void fcn_2() { fcn_3(); } void *fcn_1(void *ptr) { fcn_2(); } int main() { pthread_t thread; pthread_create(&thread, NULL, fcn_1, NULL); pthread_join(thread, NULL); return 0; }
the_stack_data/112384.c
// kernel panic: Machine halted. (2) // https://syzkaller.appspot.com/bug?id=7d57b0d2571f9a24c32882272f8dd6361e046ddf // status:invalid // autogenerated by syzkaller (http://github.com/google/syzkaller) #define _GNU_SOURCE #include <endian.h> #include <errno.h> #include <errno.h> #include <linux/futex.h> #include <pthread.h> #include <sched.h> #include <signal.h> #include <signal.h> #include <stdarg.h> #include <stdarg.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <sys/prctl.h> #include <sys/prctl.h> #include <sys/resource.h> #include <sys/syscall.h> #include <sys/time.h> #include <sys/time.h> #include <sys/wait.h> #include <sys/wait.h> #include <time.h> #include <unistd.h> __attribute__((noreturn)) static void doexit(int status) { volatile unsigned i; syscall(__NR_exit_group, status); for (i = 0;; i++) { } } #include <errno.h> #include <stdarg.h> #include <stdint.h> #include <stdio.h> #include <string.h> const int kFailStatus = 67; const int kRetryStatus = 69; static void fail(const char* msg, ...) { int e = errno; va_list args; va_start(args, msg); vfprintf(stderr, msg, args); va_end(args); fprintf(stderr, " (errno %d)\n", e); doexit((e == ENOMEM || e == EAGAIN) ? kRetryStatus : kFailStatus); } static uint64_t current_time_ms() { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) fail("clock_gettime failed"); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } 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); 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) fail("sandbox fork failed"); 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); sandbox_common(); if (unshare(CLONE_NEWNET)) { } loop(); doexit(1); } static void execute_one(); extern unsigned long long procid; static void loop() { int iter; for (iter = 0;; iter++) { int pid = fork(); if (pid < 0) fail("clone failed"); if (pid == 0) { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); setpgrp(); execute_one(); int fd; for (fd = 3; fd < 30; fd++) close(fd); doexit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { int res = waitpid(-1, &status, __WALL | WNOHANG); if (res == pid) { break; } usleep(1000); if (current_time_ms() - start < 5 * 1000) continue; kill(-pid, SIGKILL); kill(pid, SIGKILL); while (waitpid(-1, &status, __WALL) != pid) { } break; } } } struct thread_t { int created, running, call; pthread_t th; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static int collide; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { while (!__atomic_load_n(&th->running, __ATOMIC_ACQUIRE)) syscall(SYS_futex, &th->running, FUTEX_WAIT, 0, 0); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); __atomic_store_n(&th->running, 0, __ATOMIC_RELEASE); syscall(SYS_futex, &th->running, FUTEX_WAKE); } return 0; } static void execute(int num_calls) { int call, thread; running = 0; for (call = 0; call < num_calls; call++) { for (thread = 0; thread < sizeof(threads) / sizeof(threads[0]); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); pthread_create(&th->th, &attr, thr, th); } if (!__atomic_load_n(&th->running, __ATOMIC_ACQUIRE)) { th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); __atomic_store_n(&th->running, 1, __ATOMIC_RELEASE); syscall(SYS_futex, &th->running, FUTEX_WAKE); if (collide && call % 2) break; struct timespec ts; ts.tv_sec = 0; ts.tv_nsec = 20 * 1000 * 1000; syscall(SYS_futex, &th->running, FUTEX_WAIT, 1, &ts); if (__atomic_load_n(&running, __ATOMIC_RELAXED)) usleep((call == num_calls - 1) ? 10000 : 1000); break; } } } } #ifndef __NR_bpf #define __NR_bpf 321 #endif uint64_t r[1] = {0xffffffffffffffff}; void execute_call(int call) { long res; switch (call) { case 0: syscall(__NR_socketpair, 0, 0, 0, 0x20000140); break; case 1: syscall(__NR_socket, 0xa, 1, 0); break; case 2: *(uint32_t*)0x20000280 = 0x12; *(uint32_t*)0x20000284 = 0; *(uint32_t*)0x20000288 = 4; *(uint32_t*)0x2000028c = 7; *(uint32_t*)0x20000290 = 0; *(uint32_t*)0x20000294 = 1; *(uint32_t*)0x20000298 = 0; *(uint8_t*)0x2000029c = 0; *(uint8_t*)0x2000029d = 0; *(uint8_t*)0x2000029e = 0; *(uint8_t*)0x2000029f = 0; *(uint8_t*)0x200002a0 = 0; *(uint8_t*)0x200002a1 = 0; *(uint8_t*)0x200002a2 = 0; *(uint8_t*)0x200002a3 = 0; *(uint8_t*)0x200002a4 = 0; *(uint8_t*)0x200002a5 = 0; *(uint8_t*)0x200002a6 = 0; *(uint8_t*)0x200002a7 = 0; *(uint8_t*)0x200002a8 = 0; *(uint8_t*)0x200002a9 = 0; *(uint8_t*)0x200002aa = 0; *(uint8_t*)0x200002ab = 0; res = syscall(__NR_bpf, 0, 0x20000280, 0x2c); if (res != -1) r[0] = res; break; case 3: *(uint32_t*)0x20000180 = r[0]; *(uint64_t*)0x20000188 = 0x20000000; *(uint64_t*)0x20000190 = 0x20000140; *(uint64_t*)0x20000198 = 0; syscall(__NR_bpf, 2, 0x20000180, 0x20); break; case 4: *(uint32_t*)0x20000000 = r[0]; *(uint64_t*)0x20000008 = 0x20000080; *(uint64_t*)0x20000010 = 0x20000140; *(uint64_t*)0x20000018 = 1; syscall(__NR_bpf, 2, 0x20000000, 0x20); break; } } void execute_one() { execute(5); collide = 1; execute(5); } int main() { syscall(__NR_mmap, 0x20000000, 0x1000000, 3, 0x32, -1, 0); for (;;) { do_sandbox_none(); } }
the_stack_data/92931.c
/* { dg-do run { target { *-*-linux* } } } */ /* { dg-options "-static-libasan" } */ #include <time.h> static int weak_gettime (clockid_t clk_id, struct timespec *tp) __attribute__((__weakref__("clock_gettime"))); int main() { if (!clock_gettime) return 0; struct timespec ts; return weak_gettime(CLOCK_MONOTONIC, &ts); }
the_stack_data/75138172.c
/*Exercise 3 - Repetition Write a C program to calculate the sum of the numbers from 1 to n. Where n is a keyboard input. e.g. n -> 100 sum = 1+2+3+....+ 99+100 = 5050 n -> 1- sum = 1+2+3+...+10 = 55 */ #include <stdio.h> int main() { //variable declaration int n, i, sum = 0; //get input printf("Enter a number : "); scanf("%d" , &n) ; //for loop for ( i = 0 ; i <= n ; i++) { sum += i ; } //output display printf("Sum : %d" , sum) ; return 0; }