#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 */

/* Variables and functions */
int atan(int);
double exp(double);
int /*<<< orphan*/ printf(char *, double, double);
double shift(double *, double *, double, int, int, double, double, double);
int main(void) {
  double s = .3;
  int i;
  double a, b;
  int N, Ni;
  double xi, dx;
  double xx, ff;
  int j;
  double result;
  const double Pi = 4. * atan(1.);
  Ni = 6;
  a = -Pi;
  b = Pi;
  N = 100;
  dx = (b - a) / N;
  double x[N + 1], f[N + 1], fn[N + 1];
  for (i = 0; i <= N; i++) {
    xi = a + (dx * i);
    x[i] = xi;
    f[i] = exp(-xi * xi);
  }
  for (i = 0; i <= N; i++) {
    xi = a + (dx * i);
    fn[i] = shift(x, f, xi, Ni, N, a, b, s);
  }
  for (i = 0; i <= N; i++) {
    xi = a + (dx * i);
  }
  for (i = 0; i <= N; i++) {
    f[i] = fn[i];
  }
  for (i = 0; i <= N; i++) {
    xi = a + (dx * i);
    printf("%g %g \n", xi, f[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
movabs $0x3fd3333333333333,%rax
33 d3 3f
mov    %rax,-0x10(%rbp)
mov    $0x1,%edi
call   1040 <atan@plt>
cvtsi2sd %eax,%xmm0
movsd  0xe8a(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movl   $0x6,-0x30(%rbp)
movaps 0xe83(%rip),%xmm1
movsd  -0x68(%rbp),%xmm0
pxor   %xmm1,%xmm0
movlpd %xmm0,-0x20(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movl   $0x64,-0x2c(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
subsd  %xmm1,%xmm0
cvtsi2sdl -0x2c(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %rsp,%rcx
mov    %rcx,-0x70(%rbp)
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xa0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x78(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x98(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x80(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x90(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x88(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jg     12cc <main+0x18c>
mov    -0xa0(%rbp),%rax
movsd  -0x20(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm0
cvtsi2sdl -0x14(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movslq -0x14(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x38(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x38(%rbp),%xmm0
call   1050 <exp@plt>
mov    -0x98(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    124b <main+0x10b>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jg     1346 <main+0x206>
mov    -0x98(%rbp),%rsi
mov    -0xa0(%rbp),%rdi
movsd  -0x20(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm0
cvtsi2sdl -0x14(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
mov    -0x30(%rbp),%edx
mov    -0x2c(%rbp),%ecx
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm3
call   1060 <shift@plt>
mov    -0x90(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    12d3 <main+0x193>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jg     1383 <main+0x243>
movsd  -0x20(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm0
cvtsi2sdl -0x14(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    134d <main+0x20d>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jg     13c4 <main+0x284>
mov    -0x98(%rbp),%rax
mov    -0x90(%rbp),%rcx
movslq -0x14(%rbp),%rdx
movsd  (%rcx,%rdx,8),%xmm0
movslq -0x14(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    138a <main+0x24a>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jg     1422 <main+0x2e2>
mov    -0x98(%rbp),%rax
movsd  -0x20(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm0
cvtsi2sdl -0x14(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
lea    0xc11(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    13cb <main+0x28b>
movl   $0x0,-0x4(%rbp)
mov    -0x70(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x9c0,%rsp
mov    $0x1,%edi
call   1050 <atan@plt>
cvtsi2sd %eax,%xmm3
mulsd  0xe8e(%rip),%xmm3
movapd 0xea6(%rip),%xmm2
xorpd  %xmm3,%xmm2
movapd %xmm3,0x20(%rsp)
addsd  %xmm3,%xmm3
divsd  0xe78(%rip),%xmm3
xor    %ebx,%ebx
movapd %xmm2,0x10(%rsp)
movapd %xmm3,(%rsp)
nopl   (%rax)
xorps  %xmm1,%xmm1
cvtsi2sd %ebx,%xmm1
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
movsd  %xmm1,0x690(%rsp,%rbx,8)
movapd %xmm1,%xmm0
xorpd  0xe5c(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1060 <exp@plt>
movapd (%rsp),%xmm3
movapd 0x10(%rsp),%xmm2
movsd  %xmm0,0x30(%rsp,%rbx,8)
add    $0x1,%rbx
cmp    $0x65,%rbx
jne    11a0 <main+0x50>
xor    %ebx,%ebx
lea    0x690(%rsp),%r14
lea    0x30(%rsp),%r15
nopw   0x0(%rax,%rax,1)
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
mulsd  (%rsp),%xmm0
movapd 0x10(%rsp),%xmm1
addsd  %xmm1,%xmm0
mov    %r14,%rdi
mov    %r15,%rsi
mov    $0x6,%edx
mov    $0x64,%ecx
movapd 0x20(%rsp),%xmm2
movsd  0xddc(%rip),%xmm3
call   1070 <shift@plt>
movsd  %xmm0,0x360(%rsp,%rbx,8)
add    $0x1,%rbx
cmp    $0x65,%rbx
jne    1200 <main+0xb0>
lea    0x30(%rsp),%rdi
lea    0x360(%rsp),%rsi
mov    $0x328,%edx
call   1040 <memcpy@plt>
xor    %ebx,%ebx
lea    0xdc4(%rip),%r14
nopl   0x0(%rax)
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
mulsd  (%rsp),%xmm0
addsd  0x10(%rsp),%xmm0
movsd  0x30(%rsp,%rbx,8),%xmm1
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    $0x65,%rbx
jne    1270 <main+0x120>
xor    %eax,%eax
add    $0x9c0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [8 x i8] c"%g %g \0A\00"
define i32 @main() {
%1 = tail call i32 @atan(i32 1)
%2 = sitofp i32 %1 to double
%3 = fmul double %2, 4.000000e+00
%4 = fneg double %3
%5 = fadd double %3, %3
%6 = fdiv double %5, 1.000000e+02
%7 = alloca [101 x double]
%8 = alloca [101 x double]
%9 = bitcast [101 x double]* %8 to i8*
%10 = alloca [101 x double]
%11 = bitcast [101 x double]* %10 to i8*
%12 = getelementptr inbounds [101 x double], [101 x double]* %8, i64 0, i64 0
br label %13
13: ; preds = %0, %13
%14 = phi i64 [ 0, %0 ], [ %23, %13 ]
%15 = trunc i64 %14 to i32
%16 = sitofp i32 %15 to double
%17 = tail call double @llvm.fmuladd.f64(double %6, double %16, double %4)
%18 = getelementptr inbounds [101 x double], [101 x double]* %7, i64 0, i64 %14
store double %17, double* %18
%19 = fneg double %17
%20 = fmul double %17, %19
%21 = tail call double @exp(double %20)
%22 = getelementptr inbounds [101 x double], [101 x double]* %8, i64 0, i64 %14
store double %21, double* %22
%23 = add nuw nsw i64 %14, 1
%24 = icmp eq i64 %23, 101
br i1 %24, label %25, label %13
25: ; preds = %13
%26 = getelementptr inbounds [101 x double], [101 x double]* %7, i64 0, i64 0
br label %27
27: ; preds = %25, %27
%28 = phi i64 [ 0, %25 ], [ %34, %27 ]
%29 = trunc i64 %28 to i32
%30 = sitofp i32 %29 to double
%31 = call double @llvm.fmuladd.f64(double %6, double %30, double %4)
%32 = call double @shift(double* %26, double* %12, double %31, i32 6, i32 100, double %4, double %3, double 3.000000e-01)
%33 = getelementptr inbounds [101 x double], [101 x double]* %10, i64 0, i64 %28
store double %32, double* %33
%34 = add nuw nsw i64 %28, 1
%35 = icmp eq i64 %34, 101
br i1 %35, label %36, label %27
36: ; preds = %27
br label %37
37: ; preds = %36, %37
%38 = phi i64 [ 0, %36 ], [ %45, %37 ]
%39 = trunc i64 %38 to i32
%40 = sitofp i32 %39 to double
%41 = call double @llvm.fmuladd.f64(double %6, double %40, double %4)
%42 = getelementptr inbounds [101 x double], [101 x double]* %8, i64 0, i64 %38
%43 = load double, double* %42
%44 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), double %41, double %43)
%45 = add nuw nsw i64 %38, 1
%46 = icmp eq i64 %45, 101
br i1 %46, label %47, label %37
47: ; preds = %37
ret i32 0
}