#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 /*<<< orphan*/ free(void *);
int /*<<< orphan*/ init_array(int, int, double *, double **);
int /*<<< orphan*/ kernel_correlation(int, int, double, double **, double **,
                                      double *, double *);
scalar_t__ polybench_alloc_data(int, int);
int /*<<< orphan*/ print_array(int, double **);
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char **argv) {
  int n = 1400;
  int m = 1200;
  double float_n;
  double(*data)[1400 + 0][1200 + 0];
  data = (double(*)[1400 + 0][1200 + 0])
      polybench_alloc_data((1400 + 0) * (1200 + 0), sizeof(double));
  ;
  double(*corr)[1200 + 0][1200 + 0];
  corr = (double(*)[1200 + 0][1200 + 0])
      polybench_alloc_data((1200 + 0) * (1200 + 0), sizeof(double));
  ;
  double(*mean)[1200 + 0];
  mean = (double(*)[1200 + 0]) polybench_alloc_data(1200 + 0, sizeof(double));
  ;
  double(*stddev)[1200 + 0];
  stddev = (double(*)[1200 + 0]) polybench_alloc_data(1200 + 0, sizeof(double));
  ;
  init_array(m, n, &float_n, *data);
  ;
  kernel_correlation(m, n, float_n, *data, *corr, *mean, *stddev);
  ;
  ;
  if (argc > 42 && !strcmp(argv[0], ""))
    print_array(m, *corr);
  free((void *)data);
  ;
  free((void *)corr);
  ;
  free((void *)mean);
  ;
  free((void *)stddev);
  ;
  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)
movl   $0x578,-0x14(%rbp)
movl   $0x4b0,-0x18(%rbp)
mov    $0x19a280,%edi
mov    $0x8,%esi
call   1070 <polybench_alloc_data@plt>
mov    %rax,-0x28(%rbp)
mov    $0x15f900,%edi
mov    $0x8,%esi
call   1070 <polybench_alloc_data@plt>
mov    %rax,-0x30(%rbp)
mov    $0x4b0,%edi
mov    $0x8,%esi
call   1070 <polybench_alloc_data@plt>
mov    %rax,-0x38(%rbp)
mov    $0x4b0,%edi
mov    $0x8,%esi
call   1070 <polybench_alloc_data@plt>
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    -0x28(%rbp),%rcx
lea    -0x20(%rbp),%rdx
call   1050 <init_array@plt>
mov    -0x18(%rbp),%edi
mov    -0x14(%rbp),%esi
movsd  -0x20(%rbp),%xmm0
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    -0x38(%rbp),%r8
mov    -0x40(%rbp),%r9
call   1080 <kernel_correlation@plt>
cmpl   $0x2a,-0x8(%rbp)
jle    1235 <main+0xd5>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xde5(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    1235 <main+0xd5>
mov    -0x18(%rbp),%edi
mov    -0x30(%rbp),%rsi
call   1040 <print_array@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %edi,%r13d
mov    $0x19a280,%edi
mov    $0x8,%esi
call   1060 <polybench_alloc_data@plt>
mov    %rax,%rbx
mov    $0x15f900,%edi
mov    $0x8,%esi
call   1060 <polybench_alloc_data@plt>
mov    %rax,%r14
mov    $0x4b0,%edi
mov    $0x8,%esi
call   1060 <polybench_alloc_data@plt>
mov    %rax,%r12
mov    $0x4b0,%edi
mov    $0x8,%esi
call   1060 <polybench_alloc_data@plt>
mov    %rax,%rbp
mov    %rsp,%rdx
mov    $0x4b0,%edi
mov    $0x578,%esi
mov    %rbx,%rcx
call   1050 <init_array@plt>
movsd  (%rsp),%xmm0
mov    $0x4b0,%edi
mov    $0x578,%esi
mov    %rbx,%rdx
mov    %r14,%rcx
mov    %r12,%r8
mov    %rbp,%r9
call   1070 <kernel_correlation@plt>
cmp    $0x2b,%r13d
jl     11f9 <main+0xa9>
mov    (%r15),%rax
cmpb   $0x0,(%rax)
jne    11f9 <main+0xa9>
mov    $0x4b0,%edi
mov    %r14,%rsi
call   1040 <print_array@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca double
%9 = alloca [1400 x [1200 x double]]*
%10 = alloca [1200 x [1200 x double]]*
%11 = alloca [1200 x double]*
%12 = alloca [1200 x double]*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1400, i32* %6
store i32 1200, i32* %7
%13 = call i64 @polybench_alloc_data(i32 1680000, i32 8)
%14 = inttoptr i64 %13 to [1400 x [1200 x double]]*
store [1400 x [1200 x double]]* %14, [1400 x [1200 x double]]** %9
%15 = call i64 @polybench_alloc_data(i32 1440000, i32 8)
%16 = inttoptr i64 %15 to [1200 x [1200 x double]]*
store [1200 x [1200 x double]]* %16, [1200 x [1200 x double]]** %10
%17 = call i64 @polybench_alloc_data(i32 1200, i32 8)
%18 = inttoptr i64 %17 to [1200 x double]*
store [1200 x double]* %18, [1200 x double]** %11
%19 = call i64 @polybench_alloc_data(i32 1200, i32 8)
%20 = inttoptr i64 %19 to [1200 x double]*
store [1200 x double]* %20, [1200 x double]** %12
%21 = load i32, i32* %7
%22 = load i32, i32* %6
%23 = load [1400 x [1200 x double]]*, [1400 x [1200 x double]]** %9
%24 = getelementptr inbounds [1400 x [1200 x double]], [1400 x [1200 x double]]* %23, i64 0, i64 0
%25 = bitcast [1200 x double]* %24 to double**
%26 = call i32 @init_array(i32 %21, i32 %22, double* %8, double** %25)
%27 = load i32, i32* %7
%28 = load i32, i32* %6
%29 = load double, double* %8
%30 = load [1400 x [1200 x double]]*, [1400 x [1200 x double]]** %9
%31 = getelementptr inbounds [1400 x [1200 x double]], [1400 x [1200 x double]]* %30, i64 0, i64 0
%32 = bitcast [1200 x double]* %31 to double**
%33 = load [1200 x [1200 x double]]*, [1200 x [1200 x double]]** %10
%34 = getelementptr inbounds [1200 x [1200 x double]], [1200 x [1200 x double]]* %33, i64 0, i64 0
%35 = bitcast [1200 x double]* %34 to double**
%36 = load [1200 x double]*, [1200 x double]** %11
%37 = getelementptr inbounds [1200 x double], [1200 x double]* %36, i64 0, i64 0
%38 = load [1200 x double]*, [1200 x double]** %12
%39 = getelementptr inbounds [1200 x double], [1200 x double]* %38, i64 0, i64 0
%40 = call i32 @kernel_correlation(i32 %27, i32 %28, double %29, double** %32, double** %35, double* %37, double* %39)
%41 = load i32, i32* %4
%42 = icmp sgt i32 %41, 42
br i1 %42, label %43, label %55
43: ; preds = %2
%44 = load i8**, i8*** %5
%45 = getelementptr inbounds i8*, i8** %44, i64 0
%46 = load i8*, i8** %45
%47 = call i32 @strcmp(i8* %46, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%48 = icmp ne i32 %47, 0
br i1 %48, label %55, label %49
49: ; preds = %43
%50 = load i32, i32* %7
%51 = load [1200 x [1200 x double]]*, [1200 x [1200 x double]]** %10
%52 = getelementptr inbounds [1200 x [1200 x double]], [1200 x [1200 x double]]* %51, i64 0, i64 0
%53 = bitcast [1200 x double]* %52 to double**
%54 = call i32 @print_array(i32 %50, double** %53)
br label %55
55: ; preds = %49, %43, %2
%56 = load [1400 x [1200 x double]]*, [1400 x [1200 x double]]** %9
%57 = bitcast [1400 x [1200 x double]]* %56 to i8*
%58 = call i32 @free(i8* %57)
%59 = load [1200 x [1200 x double]]*, [1200 x [1200 x double]]** %10
%60 = bitcast [1200 x [1200 x double]]* %59 to i8*
%61 = call i32 @free(i8* %60)
%62 = load [1200 x double]*, [1200 x double]** %11
%63 = bitcast [1200 x double]* %62 to i8*
%64 = call i32 @free(i8* %63)
%65 = load [1200 x double]*, [1200 x double]** %12
%66 = bitcast [1200 x double]* %65 to i8*
%67 = call i32 @free(i8* %66)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca double
%4 = bitcast double* %3 to i8*
%5 = tail call i64 @polybench_alloc_data(i32 1680000, i32 8)
%6 = tail call i64 @polybench_alloc_data(i32 1440000, i32 8)
%7 = tail call i64 @polybench_alloc_data(i32 1200, i32 8)
%8 = inttoptr i64 %7 to [1200 x double]*
%9 = tail call i64 @polybench_alloc_data(i32 1200, i32 8)
%10 = inttoptr i64 %9 to [1200 x double]*
%11 = inttoptr i64 %5 to double**
%12 = call i32 @init_array(i32 1200, i32 1400, double* %3, double** %11)
%13 = load double, double* %3
%14 = inttoptr i64 %6 to double**
%15 = getelementptr inbounds [1200 x double], [1200 x double]* %8, i64 0, i64 0
%16 = getelementptr inbounds [1200 x double], [1200 x double]* %10, i64 0, i64 0
%17 = call i32 @kernel_correlation(i32 1200, i32 1400, double %13, double** %11, double** %14, double* %15, double* %16)
%18 = icmp sgt i32 %0, 42
br i1 %18, label %19, label %25
19: ; preds = %2
%20 = load i8*, i8** %1
%21 = load i8, i8* %20
%22 = icmp eq i8 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %19
%24 = call i32 @print_array(i32 1200, double** %14)
br label %25
25: ; preds = %23, %19, %2
%26 = inttoptr i64 %5 to i8*
%27 = call i32 @free(i8* %26)
%28 = inttoptr i64 %6 to i8*
%29 = call i32 @free(i8* %28)
%30 = inttoptr i64 %7 to i8*
%31 = call i32 @free(i8* %30)
%32 = inttoptr i64 %9 to i8*
%33 = call i32 @free(i8* %32)
ret i32 0
}