#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, float *, float **, float **);
int /*<<< orphan*/ kernel_deriche(int, int, float, float **, float **, float **,
                                  float **);
scalar_t__ polybench_alloc_data(int, int);
int /*<<< orphan*/ print_array(int, int, float **);
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char **argv) {
  int w = 4096;
  int h = 2160;
  float alpha;
  float(*imgIn)[4096 + 0][2160 + 0];
  imgIn = (float(*)[4096 + 0][2160 + 0])
      polybench_alloc_data((4096 + 0) * (2160 + 0), sizeof(float));
  ;
  float(*imgOut)[4096 + 0][2160 + 0];
  imgOut = (float(*)[4096 + 0][2160 + 0])
      polybench_alloc_data((4096 + 0) * (2160 + 0), sizeof(float));
  ;
  float(*y1)[4096 + 0][2160 + 0];
  y1 = (float(*)[4096 + 0][2160 + 0])
      polybench_alloc_data((4096 + 0) * (2160 + 0), sizeof(float));
  ;
  float(*y2)[4096 + 0][2160 + 0];
  y2 = (float(*)[4096 + 0][2160 + 0])
      polybench_alloc_data((4096 + 0) * (2160 + 0), sizeof(float));
  ;
  init_array(w, h, &alpha, *imgIn, *imgOut);
  ;
  kernel_deriche(w, h, alpha, *imgIn, *imgOut, *y1, *y2);
  ;
  ;
  if (argc > 42 && !strcmp(argv[0], ""))
    print_array(w, h, *imgOut);
  free((void *)imgIn);
  ;
  free((void *)imgOut);
  ;
  free((void *)y1);
  ;
  free((void *)y2);
  ;
  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   $0x1000,-0x14(%rbp)
movl   $0x870,-0x18(%rbp)
mov    $0x870000,%edi
mov    $0x4,%esi
call   1070 <polybench_alloc_data@plt>
mov    %rax,-0x28(%rbp)
mov    $0x870000,%edi
mov    $0x4,%esi
call   1070 <polybench_alloc_data@plt>
mov    %rax,-0x30(%rbp)
mov    $0x870000,%edi
mov    $0x4,%esi
call   1070 <polybench_alloc_data@plt>
mov    %rax,-0x38(%rbp)
mov    $0x870000,%edi
mov    $0x4,%esi
call   1070 <polybench_alloc_data@plt>
mov    %rax,-0x40(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
lea    -0x1c(%rbp),%rdx
call   1050 <init_array@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
movss  -0x1c(%rbp),%xmm0
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    -0x38(%rbp),%r8
mov    -0x40(%rbp),%r9
call   1080 <kernel_deriche@plt>
cmpl   $0x2a,-0x8(%rbp)
jle    123c <main+0xdc>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xde1(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    123c <main+0xdc>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x30(%rbp),%rdx
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,%r12
mov    %edi,%ebp
mov    $0x870000,%edi
mov    $0x4,%esi
call   1060 <polybench_alloc_data@plt>
mov    %rax,%r14
mov    $0x870000,%edi
mov    $0x4,%esi
call   1060 <polybench_alloc_data@plt>
mov    %rax,%rbx
mov    $0x870000,%edi
mov    $0x4,%esi
call   1060 <polybench_alloc_data@plt>
mov    %rax,%r15
mov    $0x870000,%edi
mov    $0x4,%esi
call   1060 <polybench_alloc_data@plt>
mov    %rax,%r13
lea    0x4(%rsp),%rdx
mov    $0x1000,%edi
mov    $0x870,%esi
mov    %r14,%rcx
mov    %rbx,%r8
call   1050 <init_array@plt>
movss  0x4(%rsp),%xmm0
mov    $0x1000,%edi
mov    $0x870,%esi
mov    %r14,%rdx
mov    %rbx,%rcx
mov    %r15,%r8
mov    %r13,%r9
call   1070 <kernel_deriche@plt>
cmp    $0x2b,%ebp
jl     1203 <main+0xb3>
mov    (%r12),%rax
cmpb   $0x0,(%rax)
jne    1203 <main+0xb3>
mov    $0x1000,%edi
mov    $0x870,%esi
mov    %rbx,%rdx
call   1040 <print_array@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r13,%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 float
%9 = alloca [4096 x [2160 x float]]*
%10 = alloca [4096 x [2160 x float]]*
%11 = alloca [4096 x [2160 x float]]*
%12 = alloca [4096 x [2160 x float]]*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 4096, i32* %6
store i32 2160, i32* %7
%13 = call i64 @polybench_alloc_data(i32 8847360, i32 4)
%14 = inttoptr i64 %13 to [4096 x [2160 x float]]*
store [4096 x [2160 x float]]* %14, [4096 x [2160 x float]]** %9
%15 = call i64 @polybench_alloc_data(i32 8847360, i32 4)
%16 = inttoptr i64 %15 to [4096 x [2160 x float]]*
store [4096 x [2160 x float]]* %16, [4096 x [2160 x float]]** %10
%17 = call i64 @polybench_alloc_data(i32 8847360, i32 4)
%18 = inttoptr i64 %17 to [4096 x [2160 x float]]*
store [4096 x [2160 x float]]* %18, [4096 x [2160 x float]]** %11
%19 = call i64 @polybench_alloc_data(i32 8847360, i32 4)
%20 = inttoptr i64 %19 to [4096 x [2160 x float]]*
store [4096 x [2160 x float]]* %20, [4096 x [2160 x float]]** %12
%21 = load i32, i32* %6
%22 = load i32, i32* %7
%23 = load [4096 x [2160 x float]]*, [4096 x [2160 x float]]** %9
%24 = getelementptr inbounds [4096 x [2160 x float]], [4096 x [2160 x float]]* %23, i64 0, i64 0
%25 = bitcast [2160 x float]* %24 to float**
%26 = load [4096 x [2160 x float]]*, [4096 x [2160 x float]]** %10
%27 = getelementptr inbounds [4096 x [2160 x float]], [4096 x [2160 x float]]* %26, i64 0, i64 0
%28 = bitcast [2160 x float]* %27 to float**
%29 = call i32 @init_array(i32 %21, i32 %22, float* %8, float** %25, float** %28)
%30 = load i32, i32* %6
%31 = load i32, i32* %7
%32 = load float, float* %8
%33 = load [4096 x [2160 x float]]*, [4096 x [2160 x float]]** %9
%34 = getelementptr inbounds [4096 x [2160 x float]], [4096 x [2160 x float]]* %33, i64 0, i64 0
%35 = bitcast [2160 x float]* %34 to float**
%36 = load [4096 x [2160 x float]]*, [4096 x [2160 x float]]** %10
%37 = getelementptr inbounds [4096 x [2160 x float]], [4096 x [2160 x float]]* %36, i64 0, i64 0
%38 = bitcast [2160 x float]* %37 to float**
%39 = load [4096 x [2160 x float]]*, [4096 x [2160 x float]]** %11
%40 = getelementptr inbounds [4096 x [2160 x float]], [4096 x [2160 x float]]* %39, i64 0, i64 0
%41 = bitcast [2160 x float]* %40 to float**
%42 = load [4096 x [2160 x float]]*, [4096 x [2160 x float]]** %12
%43 = getelementptr inbounds [4096 x [2160 x float]], [4096 x [2160 x float]]* %42, i64 0, i64 0
%44 = bitcast [2160 x float]* %43 to float**
%45 = call i32 @kernel_deriche(i32 %30, i32 %31, float %32, float** %35, float** %38, float** %41, float** %44)
%46 = load i32, i32* %4
%47 = icmp sgt i32 %46, 42
br i1 %47, label %48, label %61
48: ; preds = %2
%49 = load i8**, i8*** %5
%50 = getelementptr inbounds i8*, i8** %49, i64 0
%51 = load i8*, i8** %50
%52 = call i32 @strcmp(i8* %51, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%53 = icmp ne i32 %52, 0
br i1 %53, label %61, label %54
54: ; preds = %48
%55 = load i32, i32* %6
%56 = load i32, i32* %7
%57 = load [4096 x [2160 x float]]*, [4096 x [2160 x float]]** %10
%58 = getelementptr inbounds [4096 x [2160 x float]], [4096 x [2160 x float]]* %57, i64 0, i64 0
%59 = bitcast [2160 x float]* %58 to float**
%60 = call i32 @print_array(i32 %55, i32 %56, float** %59)
br label %61
61: ; preds = %54, %48, %2
%62 = load [4096 x [2160 x float]]*, [4096 x [2160 x float]]** %9
%63 = bitcast [4096 x [2160 x float]]* %62 to i8*
%64 = call i32 @free(i8* %63)
%65 = load [4096 x [2160 x float]]*, [4096 x [2160 x float]]** %10
%66 = bitcast [4096 x [2160 x float]]* %65 to i8*
%67 = call i32 @free(i8* %66)
%68 = load [4096 x [2160 x float]]*, [4096 x [2160 x float]]** %11
%69 = bitcast [4096 x [2160 x float]]* %68 to i8*
%70 = call i32 @free(i8* %69)
%71 = load [4096 x [2160 x float]]*, [4096 x [2160 x float]]** %12
%72 = bitcast [4096 x [2160 x float]]* %71 to i8*
%73 = call i32 @free(i8* %72)
ret i32 0
}

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