#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 */
double *allocateVector(int);
int /*<<< orphan*/ free(double *);
int /*<<< orphan*/ gaussianFilter(double *, double *, double, int);
double *malloc(int);
int /*<<< orphan*/ printf(char *, double);
int main(int argc, char *argv[]) {
  double *d2 = allocateVector(60000);
  double mu_x = 1.0;
  double mu_y = 2.0;
  double sigma = 1.3;
  double *res = malloc(60000 * sizeof(double));
  for (int it = 0; it < 2395; it++) {
    gaussianFilter(res, d2, sigma, 60000);
  }
  printf("%f\n", res[0]);
  free(d2);
  free(res);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0xea60,%edi
call   1070 <allocateVector@plt>
mov    %rax,-0x18(%rbp)
movsd  0xe94(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe7f(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe6a(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    $0x75300,%edi
call   1050 <malloc@plt>
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
cmpl   $0x95b,-0x3c(%rbp)
jge    11e2 <main+0x92>
mov    -0x38(%rbp),%rdi
mov    -0x18(%rbp),%rsi
movsd  -0x30(%rbp),%xmm0
mov    $0xea60,%edx
call   1060 <gaussianFilter@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    11b0 <main+0x60>
mov    -0x38(%rbp),%rax
movsd  (%rax),%xmm0
lea    0xe27(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    $0xea60,%edi
call   1070 <allocateVector@plt>
mov    %rax,%r14
mov    $0x75300,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    $0x95b,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%rdi
mov    %r14,%rsi
movsd  0xe72(%rip),%xmm0
mov    $0xea60,%edx
call   1060 <gaussianFilter@plt>
add    $0xffffffff,%ebp
jne    1180 <main+0x30>
movsd  (%rbx),%xmm0
lea    0xe60(%rip),%rdi
call   1040 <printf@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double*
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double*
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = call double* @allocateVector(i32 60000)
store double* %12, double** %6
store double 1.000000e+00, double* %7
store double 2.000000e+00, double* %8
store double 1.300000e+00, double* %9
%13 = call double* @malloc(i32 480000)
store double* %13, double** %10
store i32 0, i32* %11
br label %14
14: ; preds = %22, %2
%15 = load i32, i32* %11
%16 = icmp slt i32 %15, 2395
br i1 %16, label %17, label %25
17: ; preds = %14
%18 = load double*, double** %10
%19 = load double*, double** %6
%20 = load double, double* %9
%21 = call i32 @gaussianFilter(double* %18, double* %19, double %20, i32 60000)
br label %22
22: ; preds = %17
%23 = load i32, i32* %11
%24 = add nsw i32 %23, 1
store i32 %24, i32* %11
br label %14
25: ; preds = %14
%26 = load double*, double** %10
%27 = getelementptr inbounds double, double* %26, i64 0
%28 = load double, double* %27
%29 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %28)
%30 = load double*, double** %6
%31 = call i32 @free(double* %30)
%32 = load double*, double** %10
%33 = call i32 @free(double* %32)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%f\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call double* @allocateVector(i32 60000)
%4 = tail call double* @malloc(i32 480000)
br label %10
5: ; preds = %10
%6 = load double, double* %4
%7 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %6)
%8 = tail call i32 @free(double* %3)
%9 = tail call i32 @free(double* %4)
ret i32 0
10: ; preds = %2, %10
%11 = phi i32 [ 0, %2 ], [ %13, %10 ]
%12 = tail call i32 @gaussianFilter(double* %4, double* %3, double 1.300000e+00, i32 60000)
%13 = add nuw nsw i32 %11, 1
%14 = icmp eq i32 %13, 2395
br i1 %14, label %5, label %10
}