int BEST_GAUSSIAN_construct_new_ES(double *old_ES, int *npts_old_ES,
                                   double *new_ES, int *npts_new_ES) {
  int amplitudeloc(double *array, int len, int *max_amp_loc, double *amplitude,
                   int flag);
  int output_array1();
  int npts_peak;
  double max_peak;
  amplitudeloc(old_ES, *npts_old_ES, &npts_peak, &max_peak, 0);
  int npts_ES = 2 * npts_peak;
  double ES_tmp[npts_ES];
  int icount;
  for (icount = 0; icount < npts_peak; icount++) {
    ES_tmp[icount] = old_ES[icount];
  }
  for (icount = npts_peak; icount < npts_ES; icount++) {
    ES_tmp[icount] = old_ES[2 * (npts_peak - 1) - icount];
  }
  output_array1("ES_tmp_out", ES_tmp, npts_ES);
  *npts_new_ES = 0;
  double cut_level = 0.1;
  for (icount = 0; icount < npts_ES; icount++) {
    if (ES_tmp[icount] > cut_level * 1) {
      new_ES[*npts_new_ES] = ES_tmp[icount];
      *npts_new_ES = *npts_new_ES + 1;
    }
  }
  for (icount = 0; icount < *npts_new_ES; icount++) {
    new_ES[icount] = (new_ES[icount] - cut_level) / (1 - cut_level);
  }
  return 0;
}


x86 assembly (clang, -O0):
<BEST_GAUSSIAN_construct_new_ES>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    -0x24(%rbp),%rdx
lea    -0x30(%rbp),%rcx
xor    %r8d,%r8d
call   1040 <amplitudeloc@plt>
mov    -0x24(%rbp),%eax
add    %eax,%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x40(%rbp)
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x60(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x48(%rbp)
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    11bc <BEST_GAUSSIAN_construct_new_ES+0x9c>
mov    -0x60(%rbp),%rax
mov    -0x8(%rbp),%rcx
movslq -0x4c(%rbp),%rdx
movsd  (%rcx,%rdx,8),%xmm0
movslq -0x4c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1188 <BEST_GAUSSIAN_construct_new_ES+0x68>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    1201 <BEST_GAUSSIAN_construct_new_ES+0xe1>
mov    -0x60(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    -0x24(%rbp),%edx
sub    $0x1,%edx
shl    $0x1,%edx
sub    -0x4c(%rbp),%edx
movslq %edx,%rdx
movsd  (%rcx,%rdx,8),%xmm0
movslq -0x4c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    11c2 <BEST_GAUSSIAN_construct_new_ES+0xa2>
mov    -0x60(%rbp),%rsi
mov    -0x34(%rbp),%edx
lea    0xe01(%rip),%rdi
mov    $0x0,%al
call   1030 <output_array1@plt>
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
movsd  0xdd8(%rip),%xmm0
movsd  %xmm0,-0x58(%rbp)
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    12a3 <BEST_GAUSSIAN_construct_new_ES+0x183>
mov    -0x60(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  0xdb3(%rip),%xmm1
mulsd  -0x58(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jbe    1290 <BEST_GAUSSIAN_construct_new_ES+0x170>
mov    -0x60(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
movslq (%rcx),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
jmp    1295 <BEST_GAUSSIAN_construct_new_ES+0x175>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1234 <BEST_GAUSSIAN_construct_new_ES+0x114>
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
mov    -0x20(%rbp),%rcx
cmp    (%rcx),%eax
jge    12f7 <BEST_GAUSSIAN_construct_new_ES+0x1d7>
mov    -0x18(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  -0x58(%rbp),%xmm0
movsd  0xd35(%rip),%xmm1
subsd  -0x58(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    12aa <BEST_GAUSSIAN_construct_new_ES+0x18a>
mov    -0x40(%rbp),%rax
mov    %rax,%rsp
xor    %eax,%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BEST_GAUSSIAN_construct_new_ES>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rdi,%rbx
mov    (%rsi),%esi
lea    -0x2c(%rbp),%rdx
lea    -0x60(%rbp),%rcx
xor    %r8d,%r8d
call   1050 <amplitudeloc@plt>
mov    %rsp,-0x58(%rbp)
mov    -0x2c(%rbp),%eax
mov    %rax,-0x50(%rbp)
lea    (%rax,%rax,1),%r11d
mov    %rsp,%r13
lea    0x0(,%r11,8),%rax
sub    %rax,%r13
mov    %r13,%rsp
movslq -0x2c(%rbp),%r12
mov    %r12d,%ecx
test   %r12,%r12
jle    11b1 <BEST_GAUSSIAN_construct_new_ES+0x81>
lea    0x0(,%rcx,8),%rdx
mov    %r13,%rdi
mov    %rbx,%rsi
mov    %r14,-0x38(%rbp)
mov    %r11,-0x48(%rbp)
mov    %rcx,%r14
call   1040 <memcpy@plt>
mov    %r14,%rcx
mov    -0x48(%rbp),%r11
mov    -0x38(%rbp),%r14
cmp    %r11d,%r12d
jge    13b5 <BEST_GAUSSIAN_construct_new_ES+0x285>
mov    %r11,%r8
movslq %r11d,%r9
mov    %r9,%r11
sub    %r12,%r11
cmp    $0x4,%r11
jae    12a3 <BEST_GAUSSIAN_construct_new_ES+0x173>
mov    %r8,%r11
lea    (%rcx,%rcx,1),%r8d
mov    %r11d,%ecx
sub    %r12d,%ecx
mov    %r12,%rax
not    %rax
add    %r9,%rax
and    $0x3,%rcx
je     121c <BEST_GAUSSIAN_construct_new_ES+0xec>
mov    %r8d,%edx
sub    %r12d,%edx
add    $0xfffffffe,%edx
cs nopw 0x0(%rax,%rax,1)
nop
movslq %edx,%rdx
movsd  (%rbx,%rdx,8),%xmm0
movsd  %xmm0,0x0(%r13,%r12,8)
add    $0x1,%r12
add    $0xffffffff,%edx
add    $0xffffffffffffffff,%rcx
jne    1200 <BEST_GAUSSIAN_construct_new_ES+0xd0>
cmp    $0x3,%rax
jb     13b5 <BEST_GAUSSIAN_construct_new_ES+0x285>
mov    %r12,%r10
sub    %r9,%r10
lea    0x18(,%r12,8),%rax
add    %r13,%rax
sub    %r12d,%r8d
lea    -0x5(%r8),%r9d
lea    -0x4(%r8),%edi
lea    -0x2(%r8),%ecx
add    $0xfffffffd,%r8d
xor    %edx,%edx
nopl   0x0(%rax)
lea    (%rcx,%rdx,1),%esi
movslq %esi,%rsi
movsd  (%rbx,%rsi,8),%xmm0
movsd  %xmm0,-0x18(%rax)
lea    (%r8,%rdx,1),%esi
movslq %esi,%rsi
movsd  (%rbx,%rsi,8),%xmm0
movsd  %xmm0,-0x10(%rax)
lea    (%rdi,%rdx,1),%esi
movslq %esi,%rsi
movsd  (%rbx,%rsi,8),%xmm0
movsd  %xmm0,-0x8(%rax)
lea    (%r9,%rdx,1),%esi
movslq %esi,%rsi
movsd  (%rbx,%rsi,8),%xmm0
movsd  %xmm0,(%rax)
add    $0xfffffffffffffffc,%rdx
add    $0x20,%rax
cmp    %rdx,%r10
jne    1250 <BEST_GAUSSIAN_construct_new_ES+0x120>
jmp    13b5 <BEST_GAUSSIAN_construct_new_ES+0x285>
mov    %r12,%rax
not    %rax
add    %r9,%rax
lea    -0x2(%r12),%edx
mov    %edx,%esi
sub    %eax,%esi
cmp    %edx,%esi
jg     11d0 <BEST_GAUSSIAN_construct_new_ES+0xa0>
shr    $0x20,%rax
jne    11d0 <BEST_GAUSSIAN_construct_new_ES+0xa0>
mov    %r11,%rax
and    $0xfffffffffffffffc,%rax
mov    %rax,-0x38(%rbp)
add    $0xfffffffffffffffc,%rax
mov    %rax,%r10
shr    $0x2,%r10
add    $0x1,%r10
test   %rax,%rax
mov    %rcx,-0x40(%rbp)
je     1573 <BEST_GAUSSIAN_construct_new_ES+0x443>
mov    %r10,%rsi
and    $0xfffffffffffffffe,%rsi
lea    0x30(,%r12,8),%rax
add    %r13,%rax
mov    %ecx,%edx
add    $0xfffffffa,%edx
xor    %edi,%edi
nopw   0x0(%rax,%rax,1)
lea    0x4(%rdx),%ecx
movslq %ecx,%rcx
movups -0x18(%rbx,%rcx,8),%xmm0
movups -0x8(%rbx,%rcx,8),%xmm1
shufps $0x4e,%xmm1,%xmm1
shufps $0x4e,%xmm0,%xmm0
movups %xmm1,-0x30(%rax,%rdi,8)
movups %xmm0,-0x20(%rax,%rdi,8)
movslq %edx,%rdx
movupd -0x18(%rbx,%rdx,8),%xmm0
movupd -0x8(%rbx,%rdx,8),%xmm1
shufpd $0x1,%xmm1,%xmm1
shufpd $0x1,%xmm0,%xmm0
movupd %xmm1,-0x10(%rax,%rdi,8)
movupd %xmm0,(%rax,%rdi,8)
add    $0x8,%rdi
add    $0xfffffff8,%edx
add    $0xfffffffffffffffe,%rsi
jne    1310 <BEST_GAUSSIAN_construct_new_ES+0x1e0>
test   $0x1,%r10b
je     13a1 <BEST_GAUSSIAN_construct_new_ES+0x271>
mov    -0x40(%rbp),%rax
add    %eax,%eax
add    $0xfffffffe,%eax
lea    (%rdi,%r12,1),%rcx
add    %r12d,%edi
sub    %edi,%eax
cltq
movupd -0x18(%rbx,%rax,8),%xmm0
movupd -0x8(%rbx,%rax,8),%xmm1
shufpd $0x1,%xmm1,%xmm1
shufpd $0x1,%xmm0,%xmm0
movupd %xmm1,0x0(%r13,%rcx,8)
movupd %xmm0,0x10(%r13,%rcx,8)
mov    -0x38(%rbp),%rax
cmp    %rax,%r11
mov    %r8,%r11
mov    -0x40(%rbp),%rcx
jne    156b <BEST_GAUSSIAN_construct_new_ES+0x43b>
lea    0xc84(%rip),%rdi
xor    %ebx,%ebx
mov    %r13,%rsi
mov    %r11d,%edx
xor    %eax,%eax
mov    %r11,%r12
call   1030 <output_array1@plt>
movl   $0x0,(%r14)
cmpl   $0x0,-0x50(%rbp)
jle    154d <BEST_GAUSSIAN_construct_new_ES+0x41d>
mov    $0x1,%eax
cmp    $0x2,%r12d
cmovge %r12d,%eax
jge    142a <BEST_GAUSSIAN_construct_new_ES+0x2fa>
xor    %ecx,%ecx
test   $0x1,%al
je     1414 <BEST_GAUSSIAN_construct_new_ES+0x2e4>
movsd  0x0(%r13,%rcx,8),%xmm0
ucomisd 0xbfd(%rip),%xmm0
jbe    1414 <BEST_GAUSSIAN_construct_new_ES+0x2e4>
movslq %ebx,%rbx
movsd  %xmm0,(%r15,%rbx,8)
add    $0x1,%ebx
mov    %ebx,(%r14)
test   %ebx,%ebx
jle    154d <BEST_GAUSSIAN_construct_new_ES+0x41d>
mov    %ebx,%eax
cmp    $0x1,%ebx
jne    1483 <BEST_GAUSSIAN_construct_new_ES+0x353>
xor    %ecx,%ecx
jmp    151a <BEST_GAUSSIAN_construct_new_ES+0x3ea>
mov    %eax,%edx
and    $0x7ffffffe,%edx
xor    %ebx,%ebx
movsd  0xbc4(%rip),%xmm0
xor    %ecx,%ecx
jmp    1449 <BEST_GAUSSIAN_construct_new_ES+0x319>
add    $0x2,%rcx
cmp    %rcx,%rdx
je     13f0 <BEST_GAUSSIAN_construct_new_ES+0x2c0>
movsd  0x0(%r13,%rcx,8),%xmm1
ucomisd %xmm0,%xmm1
jbe    1465 <BEST_GAUSSIAN_construct_new_ES+0x335>
movslq %ebx,%rbx
movsd  %xmm1,(%r15,%rbx,8)
add    $0x1,%ebx
mov    %ebx,(%r14)
movsd  0x8(%r13,%rcx,8),%xmm1
ucomisd %xmm0,%xmm1
jbe    1440 <BEST_GAUSSIAN_construct_new_ES+0x310>
movslq %ebx,%rbx
movsd  %xmm1,(%r15,%rbx,8)
add    $0x1,%ebx
mov    %ebx,(%r14)
jmp    1440 <BEST_GAUSSIAN_construct_new_ES+0x310>
mov    %eax,%ecx
and    $0xfffffffe,%ecx
lea    -0x2(%rcx),%rsi
mov    %rsi,%rdx
shr    %rdx
add    $0x1,%rdx
test   %rsi,%rsi
je     1562 <BEST_GAUSSIAN_construct_new_ES+0x432>
mov    %rdx,%rdi
and    $0xfffffffffffffffe,%rdi
xor    %esi,%esi
movapd 0xb70(%rip),%xmm0
movapd 0xb78(%rip),%xmm1
nopl   0x0(%rax,%rax,1)
movupd (%r15,%rsi,8),%xmm2
movupd 0x10(%r15,%rsi,8),%xmm3
addpd  %xmm0,%xmm2
divpd  %xmm1,%xmm2
movupd %xmm2,(%r15,%rsi,8)
addpd  %xmm0,%xmm3
divpd  %xmm1,%xmm3
movupd %xmm3,0x10(%r15,%rsi,8)
add    $0x4,%rsi
add    $0xfffffffffffffffe,%rdi
jne    14c0 <BEST_GAUSSIAN_construct_new_ES+0x390>
test   $0x1,%dl
je     1515 <BEST_GAUSSIAN_construct_new_ES+0x3e5>
movupd (%r15,%rsi,8),%xmm0
addpd  0xb19(%rip),%xmm0
divpd  0xb21(%rip),%xmm0
movupd %xmm0,(%r15,%rsi,8)
cmp    %rax,%rcx
je     154d <BEST_GAUSSIAN_construct_new_ES+0x41d>
movsd  0xae6(%rip),%xmm0
movsd  0xae6(%rip),%xmm1
nopw   0x0(%rax,%rax,1)
movsd  (%r15,%rcx,8),%xmm2
addsd  %xmm0,%xmm2
divsd  %xmm1,%xmm2
movsd  %xmm2,(%r15,%rcx,8)
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1530 <BEST_GAUSSIAN_construct_new_ES+0x400>
mov    -0x58(%rbp),%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %esi,%esi
test   $0x1,%dl
jne    14f9 <BEST_GAUSSIAN_construct_new_ES+0x3c9>
jmp    1515 <BEST_GAUSSIAN_construct_new_ES+0x3e5>
add    %rax,%r12
jmp    11d3 <BEST_GAUSSIAN_construct_new_ES+0xa3>
xor    %edi,%edi
test   $0x1,%r10b
jne    1369 <BEST_GAUSSIAN_construct_new_ES+0x239>
jmp    13a1 <BEST_GAUSSIAN_construct_new_ES+0x271>

LLVM IR (-O0):
@.str = [11 x i8] c"ES_tmp_out\00"
define i32 @BEST_GAUSSIAN_construct_new_ES(double* %0, i32* %1, double* %2, i32* %3) {
%5 = alloca double*
%6 = alloca i32*
%7 = alloca double*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca double
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i64
%14 = alloca i32
%15 = alloca double
store double* %0, double** %5
store i32* %1, i32** %6
store double* %2, double** %7
store i32* %3, i32** %8
%16 = load double*, double** %5
%17 = load i32*, i32** %6
%18 = load i32, i32* %17
%19 = call i32 @amplitudeloc(double* %16, i32 %18, i32* %9, double* %10, i32 0)
%20 = load i32, i32* %9
%21 = mul nsw i32 2, %20
store i32 %21, i32* %11
%22 = load i32, i32* %11
%23 = zext i32 %22 to i64
%24 = call i8* @llvm.stacksave()
store i8* %24, i8** %12
%25 = alloca double, i64 %23
store i64 %23, i64* %13
store i32 0, i32* %14
br label %26
26: ; preds = %39, %4
%27 = load i32, i32* %14
%28 = load i32, i32* %9
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %42
30: ; preds = %26
%31 = load double*, double** %5
%32 = load i32, i32* %14
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds double, double* %31, i64 %33
%35 = load double, double* %34
%36 = load i32, i32* %14
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds double, double* %25, i64 %37
store double %35, double* %38
br label %39
39: ; preds = %30
%40 = load i32, i32* %14
%41 = add nsw i32 %40, 1
store i32 %41, i32* %14
br label %26
42: ; preds = %26
%43 = load i32, i32* %9
store i32 %43, i32* %14
br label %44
44: ; preds = %61, %42
%45 = load i32, i32* %14
%46 = load i32, i32* %11
%47 = icmp slt i32 %45, %46
br i1 %47, label %48, label %64
48: ; preds = %44
%49 = load double*, double** %5
%50 = load i32, i32* %9
%51 = sub nsw i32 %50, 1
%52 = mul nsw i32 2, %51
%53 = load i32, i32* %14
%54 = sub nsw i32 %52, %53
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds double, double* %49, i64 %55
%57 = load double, double* %56
%58 = load i32, i32* %14
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds double, double* %25, i64 %59
store double %57, double* %60
br label %61
61: ; preds = %48
%62 = load i32, i32* %14
%63 = add nsw i32 %62, 1
store i32 %63, i32* %14
br label %44
64: ; preds = %44
%65 = load i32, i32* %11
%66 = call i32 (i8*, double*, i32, ...) bitcast (i32 (...)* @output_array1 to i32 (i8*, double*, i32, ...)*)(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), double* %25, i32 %65)
%67 = load i32*, i32** %8
store i32 0, i32* %67
store double 1.000000e-01, double* %15
store i32 0, i32* %14
br label %68
68: ; preds = %95, %64
%69 = load i32, i32* %14
%70 = load i32, i32* %11
%71 = icmp slt i32 %69, %70
br i1 %71, label %72, label %98
72: ; preds = %68
%73 = load i32, i32* %14
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds double, double* %25, i64 %74
%76 = load double, double* %75
%77 = load double, double* %15
%78 = fmul double %77, 1.000000e+00
%79 = fcmp ogt double %76, %78
br i1 %79, label %80, label %94
80: ; preds = %72
%81 = load i32, i32* %14
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds double, double* %25, i64 %82
%84 = load double, double* %83
%85 = load double*, double** %7
%86 = load i32*, i32** %8
%87 = load i32, i32* %86
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds double, double* %85, i64 %88
store double %84, double* %89
%90 = load i32*, i32** %8
%91 = load i32, i32* %90
%92 = add nsw i32 %91, 1
%93 = load i32*, i32** %8
store i32 %92, i32* %93
br label %94
94: ; preds = %80, %72
br label %95
95: ; preds = %94
%96 = load i32, i32* %14
%97 = add nsw i32 %96, 1
store i32 %97, i32* %14
br label %68
98: ; preds = %68
store i32 0, i32* %14
br label %99
99: ; preds = %119, %98
%100 = load i32, i32* %14
%101 = load i32*, i32** %8
%102 = load i32, i32* %101
%103 = icmp slt i32 %100, %102
br i1 %103, label %104, label %122
104: ; preds = %99
%105 = load double*, double** %7
%106 = load i32, i32* %14
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds double, double* %105, i64 %107
%109 = load double, double* %108
%110 = load double, double* %15
%111 = fsub double %109, %110
%112 = load double, double* %15
%113 = fsub double 1.000000e+00, %112
%114 = fdiv double %111, %113
%115 = load double*, double** %7
%116 = load i32, i32* %14
%117 = sext i32 %116 to i64
%118 = getelementptr inbounds double, double* %115, i64 %117
store double %114, double* %118
br label %119
119: ; preds = %104
%120 = load i32, i32* %14
%121 = add nsw i32 %120, 1
store i32 %121, i32* %14
br label %99
122: ; preds = %99
%123 = load i8*, i8** %12
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"ES_tmp_out\00"
define i32 @BEST_GAUSSIAN_construct_new_ES(double* %0, i32* nocapture %1, double* nocapture %2, i32* nocapture %3) {
%5 = alloca i32
%6 = alloca double
%7 = bitcast i32* %5 to i8*
%8 = bitcast double* %6 to i8*
%9 = load i32, i32* %1
%10 = call i32 @amplitudeloc(double* %0, i32 %9, i32* %5, double* %6, i32 0)
%11 = load i32, i32* %5
%12 = shl i32 %11, 1
%13 = zext i32 %12 to i64
%14 = call i8* @llvm.stacksave()
%15 = alloca double, i64 %13
%16 = load i32, i32* %5
%17 = icmp sgt i32 %16, 0
br i1 %17, label %18, label %23
18: ; preds = %4
%19 = bitcast double* %15 to i8*
%20 = bitcast double* %0 to i8*
%21 = zext i32 %16 to i64
%22 = shl nuw nsw i64 %21, 3
br label %23
23: ; preds = %18, %4
%24 = icmp slt i32 %16, %12
br i1 %24, label %25, label %174
25: ; preds = %23
%26 = shl i32 %16, 1
%27 = add i32 %26, -2
%28 = sext i32 %16 to i64
%29 = sext i32 %12 to i64
%30 = sub nsw i64 %29, %28
%31 = icmp ult i64 %30, 4
br i1 %31, label %121, label %32
32: ; preds = %25
%33 = xor i64 %28, -1
%34 = add nsw i64 %33, %29
%35 = add i32 %16, -2
%36 = trunc i64 %34 to i32
%37 = sub i32 %35, %36
%38 = icmp sgt i32 %37, %35
%39 = icmp ugt i64 %34, 4294967295
%40 = or i1 %38, %39
br i1 %40, label %121, label %41
41: ; preds = %32
%42 = and i64 %30, -4
%43 = add nsw i64 %42, %28
%44 = add nsw i64 %42, -4
%45 = lshr exact i64 %44, 2
%46 = add nuw nsw i64 %45, 1
%47 = and i64 %46, 1
%48 = icmp eq i64 %44, 0
br i1 %48, label %96, label %49
49: ; preds = %41
%50 = and i64 %46, 9223372036854775806
br label %51
51: ; preds = %51, %49
%52 = phi i64 [ 0, %49 ], [ %93, %51 ]
%53 = phi i64 [ 0, %49 ], [ %94, %51 ]
%54 = add i64 %52, %28
%55 = trunc i64 %52 to i32
%56 = add i32 %16, %55
%57 = sub i32 %27, %56
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds double, double* %0, i64 %58
%60 = getelementptr inbounds double, double* %59, i64 -1
%61 = bitcast double* %60 to <2 x double>*
%62 = load <2 x double>, <2 x double>* %61
%63 = shufflevector <2 x double> %62, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%64 = getelementptr inbounds double, double* %59, i64 -2
%65 = getelementptr inbounds double, double* %64, i64 -1
%66 = bitcast double* %65 to <2 x double>*
%67 = load <2 x double>, <2 x double>* %66
%68 = shufflevector <2 x double> %67, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%69 = getelementptr inbounds double, double* %15, i64 %54
%70 = bitcast double* %69 to <2 x double>*
store <2 x double> %63, <2 x double>* %70
%71 = getelementptr inbounds double, double* %69, i64 2
%72 = bitcast double* %71 to <2 x double>*
store <2 x double> %68, <2 x double>* %72
%73 = or i64 %52, 4
%74 = add i64 %73, %28
%75 = trunc i64 %73 to i32
%76 = add i32 %16, %75
%77 = sub i32 %27, %76
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds double, double* %0, i64 %78
%80 = getelementptr inbounds double, double* %79, i64 -1
%81 = bitcast double* %80 to <2 x double>*
%82 = load <2 x double>, <2 x double>* %81
%83 = shufflevector <2 x double> %82, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%84 = getelementptr inbounds double, double* %79, i64 -2
%85 = getelementptr inbounds double, double* %84, i64 -1
%86 = bitcast double* %85 to <2 x double>*
%87 = load <2 x double>, <2 x double>* %86
%88 = shufflevector <2 x double> %87, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%89 = getelementptr inbounds double, double* %15, i64 %74
%90 = bitcast double* %89 to <2 x double>*
store <2 x double> %83, <2 x double>* %90
%91 = getelementptr inbounds double, double* %89, i64 2
%92 = bitcast double* %91 to <2 x double>*
store <2 x double> %88, <2 x double>* %92
%93 = add nuw i64 %52, 8
%94 = add i64 %53, 2
%95 = icmp eq i64 %94, %50
br i1 %95, label %96, label %51
96: ; preds = %51, %41
%97 = phi i64 [ 0, %41 ], [ %93, %51 ]
%98 = icmp eq i64 %47, 0
br i1 %98, label %119, label %99
99: ; preds = %96
%100 = add i64 %97, %28
%101 = trunc i64 %97 to i32
%102 = add i32 %16, %101
%103 = sub i32 %27, %102
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds double, double* %0, i64 %104
%106 = getelementptr inbounds double, double* %105, i64 -1
%107 = bitcast double* %106 to <2 x double>*
%108 = load <2 x double>, <2 x double>* %107
%109 = shufflevector <2 x double> %108, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%110 = getelementptr inbounds double, double* %105, i64 -2
%111 = getelementptr inbounds double, double* %110, i64 -1
%112 = bitcast double* %111 to <2 x double>*
%113 = load <2 x double>, <2 x double>* %112
%114 = shufflevector <2 x double> %113, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%115 = getelementptr inbounds double, double* %15, i64 %100
%116 = bitcast double* %115 to <2 x double>*
store <2 x double> %109, <2 x double>* %116
%117 = getelementptr inbounds double, double* %115, i64 2
%118 = bitcast double* %117 to <2 x double>*
store <2 x double> %114, <2 x double>* %118
br label %119
119: ; preds = %96, %99
%120 = icmp eq i64 %30, %42
br i1 %120, label %174, label %121
121: ; preds = %32, %25, %119
%122 = phi i64 [ %28, %32 ], [ %28, %25 ], [ %43, %119 ]
%123 = sub nsw i64 %29, %122
%124 = xor i64 %122, -1
%125 = add nsw i64 %124, %29
%126 = and i64 %123, 3
%127 = icmp eq i64 %126, 0
br i1 %127, label %140, label %128
128: ; preds = %121, %128
%129 = phi i64 [ %137, %128 ], [ %122, %121 ]
%130 = phi i64 [ %138, %128 ], [ 0, %121 ]
%131 = trunc i64 %129 to i32
%132 = sub i32 %27, %131
%133 = sext i32 %132 to i64
%134 = getelementptr inbounds double, double* %0, i64 %133
%135 = load double, double* %134
%136 = getelementptr inbounds double, double* %15, i64 %129
store double %135, double* %136
%137 = add nsw i64 %129, 1
%138 = add i64 %130, 1
%139 = icmp eq i64 %138, %126
br i1 %139, label %140, label %128
140: ; preds = %128, %121
%141 = phi i64 [ %122, %121 ], [ %137, %128 ]
%142 = icmp ult i64 %125, 3
br i1 %142, label %174, label %143
143: ; preds = %140, %143
%144 = phi i64 [ %172, %143 ], [ %141, %140 ]
%145 = trunc i64 %144 to i32
%146 = sub i32 %27, %145
%147 = sext i32 %146 to i64
%148 = getelementptr inbounds double, double* %0, i64 %147
%149 = load double, double* %148
%150 = getelementptr inbounds double, double* %15, i64 %144
store double %149, double* %150
%151 = add nsw i64 %144, 1
%152 = trunc i64 %151 to i32
%153 = sub i32 %27, %152
%154 = sext i32 %153 to i64
%155 = getelementptr inbounds double, double* %0, i64 %154
%156 = load double, double* %155
%157 = getelementptr inbounds double, double* %15, i64 %151
store double %156, double* %157
%158 = add nsw i64 %144, 2
%159 = trunc i64 %158 to i32
%160 = sub i32 %27, %159
%161 = sext i32 %160 to i64
%162 = getelementptr inbounds double, double* %0, i64 %161
%163 = load double, double* %162
%164 = getelementptr inbounds double, double* %15, i64 %158
store double %163, double* %164
%165 = add nsw i64 %144, 3
%166 = trunc i64 %165 to i32
%167 = sub i32 %27, %166
%168 = sext i32 %167 to i64
%169 = getelementptr inbounds double, double* %0, i64 %168
%170 = load double, double* %169
%171 = getelementptr inbounds double, double* %15, i64 %165
store double %170, double* %171
%172 = add nsw i64 %144, 4
%173 = icmp eq i64 %172, %29
br i1 %173, label %174, label %143
174: ; preds = %140, %143, %119, %23
%175 = call i32 (i8*, double*, i32, ...) bitcast (i32 (...)* @output_array1 to i32 (i8*, double*, i32, ...)*)(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), double* %15, i32 %12)
store i32 0, i32* %3
%176 = icmp sgt i32 %11, 0
br i1 %176, label %177, label %279
177: ; preds = %174
%178 = call i32 @llvm.smax.i32(i32 %12, i32 1)
%179 = zext i32 %178 to i64
%180 = and i64 %179, 1
%181 = icmp slt i32 %12, 2
br i1 %181, label %184, label %182
182: ; preds = %177
%183 = and i64 %179, 2147483646
br label %245
184: ; preds = %266, %177
%185 = phi i32 [ undef, %177 ], [ %267, %266 ]
%186 = phi i32 [ 0, %177 ], [ %267, %266 ]
%187 = phi i64 [ 0, %177 ], [ %268, %266 ]
%188 = icmp eq i64 %180, 0
br i1 %188, label %197, label %189
189: ; preds = %184
%190 = getelementptr inbounds double, double* %15, i64 %187
%191 = load double, double* %190
%192 = fcmp ogt double %191, 1.000000e-01
br i1 %192, label %193, label %197
193: ; preds = %189
%194 = sext i32 %186 to i64
%195 = getelementptr inbounds double, double* %2, i64 %194
store double %191, double* %195
%196 = add nsw i32 %186, 1
store i32 %196, i32* %3
br label %197
197: ; preds = %189, %193, %184
%198 = phi i32 [ %185, %184 ], [ %186, %189 ], [ %196, %193 ]
%199 = icmp sgt i32 %198, 0
br i1 %199, label %200, label %279
200: ; preds = %197
%201 = zext i32 %198 to i64
%202 = icmp eq i32 %198, 1
br i1 %202, label %243, label %203
203: ; preds = %200
%204 = and i64 %201, 4294967294
%205 = add nsw i64 %204, -2
%206 = lshr exact i64 %205, 1
%207 = add nuw i64 %206, 1
%208 = and i64 %207, 1
%209 = icmp eq i64 %205, 0
br i1 %209, label %231, label %210
210: ; preds = %203
%211 = and i64 %207, -2
br label %212
212: ; preds = %212, %210
%213 = phi i64 [ 0, %210 ], [ %228, %212 ]
%214 = phi i64 [ 0, %210 ], [ %229, %212 ]
%215 = getelementptr inbounds double, double* %2, i64 %213
%216 = bitcast double* %215 to <2 x double>*
%217 = load <2 x double>, <2 x double>* %216
%218 = fadd <2 x double> %217, <double -1.000000e-01, double -1.000000e-01>
%219 = fdiv <2 x double> %218, <double 9.000000e-01, double 9.000000e-01>
%220 = bitcast double* %215 to <2 x double>*
store <2 x double> %219, <2 x double>* %220
%221 = or i64 %213, 2
%222 = getelementptr inbounds double, double* %2, i64 %221
%223 = bitcast double* %222 to <2 x double>*
%224 = load <2 x double>, <2 x double>* %223
%225 = fadd <2 x double> %224, <double -1.000000e-01, double -1.000000e-01>
%226 = fdiv <2 x double> %225, <double 9.000000e-01, double 9.000000e-01>
%227 = bitcast double* %222 to <2 x double>*
store <2 x double> %226, <2 x double>* %227
%228 = add nuw i64 %213, 4
%229 = add nuw i64 %214, 2
%230 = icmp eq i64 %229, %211
br i1 %230, label %231, label %212
231: ; preds = %212, %203
%232 = phi i64 [ 0, %203 ], [ %228, %212 ]
%233 = icmp eq i64 %208, 0
br i1 %233, label %241, label %234
234: ; preds = %231
%235 = getelementptr inbounds double, double* %2, i64 %232
%236 = bitcast double* %235 to <2 x double>*
%237 = load <2 x double>, <2 x double>* %236
%238 = fadd <2 x double> %237, <double -1.000000e-01, double -1.000000e-01>
%239 = fdiv <2 x double> %238, <double 9.000000e-01, double 9.000000e-01>
%240 = bitcast double* %235 to <2 x double>*
store <2 x double> %239, <2 x double>* %240
br label %241
241: ; preds = %231, %234
%242 = icmp eq i64 %204, %201
br i1 %242, label %279, label %243
243: ; preds = %200, %241
%244 = phi i64 [ 0, %200 ], [ %204, %241 ]
br label %271
245: ; preds = %266, %182
%246 = phi i32 [ 0, %182 ], [ %267, %266 ]
%247 = phi i64 [ 0, %182 ], [ %268, %266 ]
%248 = phi i64 [ 0, %182 ], [ %269, %266 ]
%249 = getelementptr inbounds double, double* %15, i64 %247
%250 = load double, double* %249
%251 = fcmp ogt double %250, 1.000000e-01
br i1 %251, label %252, label %256
252: ; preds = %245
%253 = sext i32 %246 to i64
%254 = getelementptr inbounds double, double* %2, i64 %253
store double %250, double* %254
%255 = add nsw i32 %246, 1
store i32 %255, i32* %3
br label %256
256: ; preds = %245, %252
%257 = phi i32 [ %246, %245 ], [ %255, %252 ]
%258 = or i64 %247, 1
%259 = getelementptr inbounds double, double* %15, i64 %258
%260 = load double, double* %259
%261 = fcmp ogt double %260, 1.000000e-01
br i1 %261, label %262, label %266
262: ; preds = %256
%263 = sext i32 %257 to i64
%264 = getelementptr inbounds double, double* %2, i64 %263
store double %260, double* %264
%265 = add nsw i32 %257, 1
store i32 %265, i32* %3
br label %266
266: ; preds = %262, %256
%267 = phi i32 [ %257, %256 ], [ %265, %262 ]
%268 = add nuw nsw i64 %247, 2
%269 = add i64 %248, 2
%270 = icmp eq i64 %269, %183
br i1 %270, label %184, label %245
271: ; preds = %243, %271
%272 = phi i64 [ %277, %271 ], [ %244, %243 ]
%273 = getelementptr inbounds double, double* %2, i64 %272
%274 = load double, double* %273
%275 = fadd double %274, -1.000000e-01
%276 = fdiv double %275, 9.000000e-01
store double %276, double* %273
%277 = add nuw nsw i64 %272, 1
%278 = icmp eq i64 %277, %201
br i1 %278, label %279, label %271
279: ; preds = %271, %241, %174, %197
ret i32 0
}