#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ asy1(double *, double *, unsigned long);
unsigned long atoi(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, double);
int /*<<< orphan*/ free(double *);
scalar_t__ malloc(unsigned long);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  unsigned long int n = atoi(argv[1]);
  int s = n % 2;
  unsigned long int n3, n4;
  int k, iter;
  double x, w, t, dt, C, theta, sint, f, fp, S, dS, dn = (double)n, p2, fn, fn5,
                                                    nk, n5k;
  double *nodes = (double *)malloc(n * sizeof(double));
  double *weights = (double *)malloc(n * sizeof(double));
  FILE *fid, *fid2;
  asy1(nodes, weights, n);
  if (argc < 3) {
    printf("x = \n");
    for (k = 0; k < n; k++) {
      printf("%16.16f\n", nodes[k]);
    }
    printf("w = \n");
    for (k = 0; k < n; k++) {
      printf("%16.16f\n", weights[k]);
    }
  }
  if (argc > 2) {
    fid = fopen(argv[2], "w");
    for (k = 0; k < n; k++) {
      fprintf(fid, "%16.16f\n", nodes[k]);
    }
    fclose(fid);
  }
  if (argc > 3) {
    fid2 = fopen(argv[3], "w");
    for (k = 0; k < n; k++) {
      fprintf(fid2, "%16.16f\n", weights[k]);
    }
    fclose(fid2);
  }
  free(nodes);
  nodes = NULL;
  free(weights);
  weights = NULL;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1090 <atoi@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
and    $0x1,%eax
mov    %eax,-0x1c(%rbp)
movaps 0xe46(%rip),%xmm1
movq   -0x18(%rbp),%xmm0
punpckldq %xmm1,%xmm0
movapd 0xe45(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
mov    -0x18(%rbp),%rdi
shl    $0x3,%rdi
call   1070 <malloc@plt>
mov    %rax,-0xc8(%rbp)
mov    -0x18(%rbp),%rdi
shl    $0x3,%rdi
call   1070 <malloc@plt>
mov    %rax,-0xd0(%rbp)
mov    -0xc8(%rbp),%rdi
mov    -0xd0(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   10a0 <asy1@plt>
cmpl   $0x3,-0x8(%rbp)
jge    12ce <main+0x14e>
lea    0xdee(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x34(%rbp)
movslq -0x34(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    127a <main+0xfa>
mov    -0xc8(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xdc1(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1240 <main+0xc0>
lea    0xdae(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x34(%rbp)
movslq -0x34(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    12c9 <main+0x149>
mov    -0xd0(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xd72(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    128f <main+0x10f>
jmp    12ce <main+0x14e>
cmpl   $0x2,-0x8(%rbp)
jle    1345 <main+0x1c5>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xd4e(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0xd8(%rbp)
movl   $0x0,-0x34(%rbp)
movslq -0x34(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1339 <main+0x1b9>
mov    -0xd8(%rbp),%rdi
mov    -0xc8(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xd00(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    12fa <main+0x17a>
mov    -0xd8(%rbp),%rdi
call   1040 <fclose@plt>
cmpl   $0x3,-0x8(%rbp)
jle    13bc <main+0x23c>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xcd7(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0xe0(%rbp)
movl   $0x0,-0x34(%rbp)
movslq -0x34(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    13b0 <main+0x230>
mov    -0xe0(%rbp),%rdi
mov    -0xd0(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xc89(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1371 <main+0x1f1>
mov    -0xe0(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0xc8(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0xc8(%rbp)
mov    -0xd0(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0xd0(%rbp)
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r13
mov    %edi,%r12d
mov    0x8(%rsi),%rdi
call   10a0 <atoi@plt>
mov    %rax,%rbx
lea    0x0(,%rax,8),%rbp
mov    %rbp,%rdi
call   1080 <malloc@plt>
mov    %rax,%r15
mov    %rbp,%rdi
call   1080 <malloc@plt>
mov    %rax,%r14
mov    %r15,%rdi
mov    %rax,%rsi
mov    %rbx,%rdx
call   10b0 <asy1@plt>
cmp    $0x2,%r12d
mov    %r12d,0xc(%rsp)
jg     1278 <main+0xe8>
lea    0xe19(%rip),%rdi
call   1040 <puts@plt>
test   %rbx,%rbx
je     1314 <main+0x184>
xor    %ebp,%ebp
lea    0xdf7(%rip),%r12
nopl   0x0(%rax)
movsd  (%r15,%rbp,8),%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1210 <main+0x80>
lea    0xde0(%rip),%rdi
call   1040 <puts@plt>
test   %rbx,%rbx
je     1269 <main+0xd9>
xor    %ebp,%ebp
lea    0xdbd(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  (%r14,%rbp,8),%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1250 <main+0xc0>
mov    0xc(%rsp),%r12d
cmp    $0x3,%r12d
jl     1320 <main+0x190>
mov    %r13,0x10(%rsp)
mov    0x10(%r13),%rdi
lea    0xd81(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%rbp
test   %rbx,%rbx
je     12ba <main+0x12a>
xor    %r13d,%r13d
lea    0xd61(%rip),%r12
nop
movsd  (%r15,%r13,8),%xmm0
mov    %rbp,%rdi
mov    %r12,%rsi
call   1070 <fprintf@plt>
add    $0x1,%r13
cmp    %r13,%rbx
jne    12a0 <main+0x110>
mov    %rbp,%rdi
call   1050 <fclose@plt>
cmpl   $0x4,0xc(%rsp)
mov    0x10(%rsp),%rax
jl     1320 <main+0x190>
mov    0x18(%rax),%rdi
lea    0xd30(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%r13
test   %rbx,%rbx
je     130a <main+0x17a>
xor    %ebp,%ebp
lea    0xd11(%rip),%r12
nop
movsd  (%r14,%rbp,8),%xmm0
mov    %r13,%rdi
mov    %r12,%rsi
call   1070 <fprintf@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    12f0 <main+0x160>
mov    %r13,%rdi
call   1050 <fclose@plt>
jmp    1320 <main+0x190>
lea    0xcf5(%rip),%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"x = \0A\00"
@.str.1 = [9 x i8] c"%16.16f\0A\00"
@.str.2 = [6 x i8] c"w = \0A\00"
@.str.3 = [2 x i8] c"w\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i32
%8 = alloca i64
%9 = alloca i64
%10 = alloca i32
%11 = alloca i32
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = alloca double
%26 = alloca double
%27 = alloca double
%28 = alloca double
%29 = alloca double*
%30 = alloca double*
%31 = alloca i32*
%32 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 1
%35 = load i8*, i8** %34
%36 = call i64 @atoi(i8* %35)
store i64 %36, i64* %6
%37 = load i64, i64* %6
%38 = urem i64 %37, 2
%39 = trunc i64 %38 to i32
store i32 %39, i32* %7
%40 = load i64, i64* %6
%41 = uitofp i64 %40 to double
store double %41, double* %23
%42 = load i64, i64* %6
%43 = mul i64 %42, 8
%44 = call i64 @malloc(i64 %43)
%45 = inttoptr i64 %44 to double*
store double* %45, double** %29
%46 = load i64, i64* %6
%47 = mul i64 %46, 8
%48 = call i64 @malloc(i64 %47)
%49 = inttoptr i64 %48 to double*
store double* %49, double** %30
%50 = load double*, double** %29
%51 = load double*, double** %30
%52 = load i64, i64* %6
%53 = call i32 @asy1(double* %50, double* %51, i64 %52)
%54 = load i32, i32* %4
%55 = icmp slt i32 %54, 3
br i1 %55, label %56, label %91
56: ; preds = %2
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %10
br label %58
58: ; preds = %70, %56
%59 = load i32, i32* %10
%60 = sext i32 %59 to i64
%61 = load i64, i64* %6
%62 = icmp ult i64 %60, %61
br i1 %62, label %63, label %73
63: ; preds = %58
%64 = load double*, double** %29
%65 = load i32, i32* %10
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds double, double* %64, i64 %66
%68 = load double, double* %67
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), double %68)
br label %70
70: ; preds = %63
%71 = load i32, i32* %10
%72 = add nsw i32 %71, 1
store i32 %72, i32* %10
br label %58
73: ; preds = %58
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %10
br label %75
75: ; preds = %87, %73
%76 = load i32, i32* %10
%77 = sext i32 %76 to i64
%78 = load i64, i64* %6
%79 = icmp ult i64 %77, %78
br i1 %79, label %80, label %90
80: ; preds = %75
%81 = load double*, double** %30
%82 = load i32, i32* %10
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds double, double* %81, i64 %83
%85 = load double, double* %84
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), double %85)
br label %87
87: ; preds = %80
%88 = load i32, i32* %10
%89 = add nsw i32 %88, 1
store i32 %89, i32* %10
br label %75
90: ; preds = %75
br label %91
91: ; preds = %90, %2
%92 = load i32, i32* %4
%93 = icmp sgt i32 %92, 2
br i1 %93, label %94, label %118
94: ; preds = %91
%95 = load i8**, i8*** %5
%96 = getelementptr inbounds i8*, i8** %95, i64 2
%97 = load i8*, i8** %96
%98 = call i32* @fopen(i8* %97, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %98, i32** %31
store i32 0, i32* %10
br label %99
99: ; preds = %112, %94
%100 = load i32, i32* %10
%101 = sext i32 %100 to i64
%102 = load i64, i64* %6
%103 = icmp ult i64 %101, %102
br i1 %103, label %104, label %115
104: ; preds = %99
%105 = load i32*, i32** %31
%106 = load double*, double** %29
%107 = load i32, i32* %10
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds double, double* %106, i64 %108
%110 = load double, double* %109
%111 = call i32 @fprintf(i32* %105, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), double %110)
br label %112
112: ; preds = %104
%113 = load i32, i32* %10
%114 = add nsw i32 %113, 1
store i32 %114, i32* %10
br label %99
115: ; preds = %99
%116 = load i32*, i32** %31
%117 = call i32 @fclose(i32* %116)
br label %118
118: ; preds = %115, %91
%119 = load i32, i32* %4
%120 = icmp sgt i32 %119, 3
br i1 %120, label %121, label %145
121: ; preds = %118
%122 = load i8**, i8*** %5
%123 = getelementptr inbounds i8*, i8** %122, i64 3
%124 = load i8*, i8** %123
%125 = call i32* @fopen(i8* %124, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %125, i32** %32
store i32 0, i32* %10
br label %126
126: ; preds = %139, %121
%127 = load i32, i32* %10
%128 = sext i32 %127 to i64
%129 = load i64, i64* %6
%130 = icmp ult i64 %128, %129
br i1 %130, label %131, label %142
131: ; preds = %126
%132 = load i32*, i32** %32
%133 = load double*, double** %30
%134 = load i32, i32* %10
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds double, double* %133, i64 %135
%137 = load double, double* %136
%138 = call i32 @fprintf(i32* %132, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), double %137)
br label %139
139: ; preds = %131
%140 = load i32, i32* %10
%141 = add nsw i32 %140, 1
store i32 %141, i32* %10
br label %126
142: ; preds = %126
%143 = load i32*, i32** %32
%144 = call i32 @fclose(i32* %143)
br label %145
145: ; preds = %142, %118
%146 = load double*, double** %29
%147 = call i32 @free(double* %146)
store double* null, double** %29
%148 = load double*, double** %30
%149 = call i32 @free(double* %148)
store double* null, double** %30
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [9 x i8] c"%16.16f\0A\00"
@.str.3 = [2 x i8] c"w\00"
@str = [5 x i8] c"x = \00"
@str.4 = [5 x i8] c"w = \00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i64 @atoi(i8* %4)
%6 = shl i64 %5, 3
%7 = tail call i64 @malloc(i64 %6)
%8 = inttoptr i64 %7 to double*
%9 = tail call i64 @malloc(i64 %6)
%10 = inttoptr i64 %9 to double*
%11 = tail call i32 @asy1(double* %8, double* %10, i64 %5)
%12 = icmp slt i32 %0, 3
br i1 %12, label %13, label %36
13: ; preds = %2
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
%15 = icmp eq i64 %5, 0
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.4, i64 0, i64 0))
br label %64
18: ; preds = %13, %18
%19 = phi i64 [ %23, %18 ], [ 0, %13 ]
%20 = getelementptr inbounds double, double* %8, i64 %19
%21 = load double, double* %20
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), double %21)
%23 = add nuw i64 %19, 1
%24 = icmp eq i64 %23, %5
br i1 %24, label %25, label %18
25: ; preds = %18
%26 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.4, i64 0, i64 0))
br i1 %15, label %34, label %27
27: ; preds = %25, %27
%28 = phi i64 [ %32, %27 ], [ 0, %25 ]
%29 = getelementptr inbounds double, double* %10, i64 %28
%30 = load double, double* %29
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), double %30)
%32 = add nuw i64 %28, 1
%33 = icmp eq i64 %32, %5
br i1 %33, label %34, label %27
34: ; preds = %27, %25
%35 = icmp sgt i32 %0, 2
br i1 %35, label %36, label %64
36: ; preds = %2, %34
%37 = getelementptr inbounds i8*, i8** %1, i64 2
%38 = load i8*, i8** %37
%39 = tail call i32* @fopen(i8* %38, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%40 = icmp eq i64 %5, 0
br i1 %40, label %48, label %41
41: ; preds = %36, %41
%42 = phi i64 [ %46, %41 ], [ 0, %36 ]
%43 = getelementptr inbounds double, double* %8, i64 %42
%44 = load double, double* %43
%45 = tail call i32 @fprintf(i32* %39, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), double %44)
%46 = add nuw i64 %42, 1
%47 = icmp eq i64 %46, %5
br i1 %47, label %48, label %41
48: ; preds = %41, %36
%49 = tail call i32 @fclose(i32* %39)
%50 = icmp sgt i32 %0, 3
br i1 %50, label %51, label %64
51: ; preds = %48
%52 = getelementptr inbounds i8*, i8** %1, i64 3
%53 = load i8*, i8** %52
%54 = tail call i32* @fopen(i8* %53, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br i1 %40, label %62, label %55
55: ; preds = %51, %55
%56 = phi i64 [ %60, %55 ], [ 0, %51 ]
%57 = getelementptr inbounds double, double* %10, i64 %56
%58 = load double, double* %57
%59 = tail call i32 @fprintf(i32* %54, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), double %58)
%60 = add nuw i64 %56, 1
%61 = icmp eq i64 %60, %5
br i1 %61, label %62, label %55
62: ; preds = %55, %51
%63 = tail call i32 @fclose(i32* %54)
br label %64
64: ; preds = %16, %34, %62, %48
%65 = tail call i32 @free(double* %8)
%66 = tail call i32 @free(double* %10)
ret i32 0
}