#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, int, double ***, double **);
int /*<<< orphan*/ kernel_doitgen(int, int, int, double ***, double **,
                                  double *);
scalar_t__ polybench_alloc_data(int, int);
int /*<<< orphan*/ print_array(int, int, int, double ***);
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char **argv) {
  int nr = 150;
  int nq = 140;
  int np = 160;
  double(*A)[150 + 0][140 + 0][160 + 0];
  A = (double(*)[150 + 0][140 + 0][160 + 0])
      polybench_alloc_data((150 + 0) * (140 + 0) * (160 + 0), sizeof(double));
  ;
  double(*sum)[160 + 0];
  sum = (double(*)[160 + 0]) polybench_alloc_data(160 + 0, sizeof(double));
  ;
  double(*C4)[160 + 0][160 + 0];
  C4 = (double(*)[160 + 0][160 + 0])
      polybench_alloc_data((160 + 0) * (160 + 0), sizeof(double));
  ;
  init_array(nr, nq, np, *A, *C4);
  ;
  kernel_doitgen(nr, nq, np, *A, *C4, *sum);
  ;
  ;
  if (argc > 42 && !strcmp(argv[0], ""))
    print_array(nr, nq, np, *A);
  free((void *)A);
  ;
  free((void *)sum);
  ;
  free((void *)C4);
  ;
  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   $0x96,-0x14(%rbp)
movl   $0x8c,-0x18(%rbp)
movl   $0xa0,-0x1c(%rbp)
mov    $0x334500,%edi
mov    $0x8,%esi
call   1070 <polybench_alloc_data@plt>
mov    %rax,-0x28(%rbp)
mov    $0xa0,%edi
mov    $0x8,%esi
call   1070 <polybench_alloc_data@plt>
mov    %rax,-0x30(%rbp)
mov    $0x6400,%edi
mov    $0x8,%esi
call   1070 <polybench_alloc_data@plt>
mov    %rax,-0x38(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x28(%rbp),%rcx
mov    -0x38(%rbp),%r8
call   1050 <init_array@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x28(%rbp),%rcx
mov    -0x38(%rbp),%r8
mov    -0x30(%rbp),%r9
call   1080 <kernel_doitgen@plt>
cmpl   $0x2a,-0x8(%rbp)
jle    122c <main+0xcc>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xdf4(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    122c <main+0xcc>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x28(%rbp),%rcx
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>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r12
mov    %edi,%ebp
mov    $0x334500,%edi
mov    $0x8,%esi
call   1060 <polybench_alloc_data@plt>
mov    %rax,%r15
mov    $0xa0,%edi
mov    $0x8,%esi
call   1060 <polybench_alloc_data@plt>
mov    %rax,%r14
mov    $0x6400,%edi
mov    $0x8,%esi
call   1060 <polybench_alloc_data@plt>
mov    %rax,%rbx
mov    $0x96,%edi
mov    $0x8c,%esi
mov    $0xa0,%edx
mov    %r15,%rcx
mov    %rax,%r8
call   1050 <init_array@plt>
mov    $0x96,%edi
mov    $0x8c,%esi
mov    $0xa0,%edx
mov    %r15,%rcx
mov    %rbx,%r8
mov    %r14,%r9
call   1070 <kernel_doitgen@plt>
cmp    $0x2b,%ebp
jl     11ef <main+0x9f>
mov    (%r12),%rax
cmpb   $0x0,(%rax)
jne    11ef <main+0x9f>
mov    $0x96,%edi
mov    $0x8c,%esi
mov    $0xa0,%edx
mov    %r15,%rcx
call   1040 <print_array@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
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 i32
%9 = alloca [150 x [140 x [160 x double]]]*
%10 = alloca [160 x double]*
%11 = alloca [160 x [160 x double]]*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 150, i32* %6
store i32 140, i32* %7
store i32 160, i32* %8
%12 = call i64 @polybench_alloc_data(i32 3360000, i32 8)
%13 = inttoptr i64 %12 to [150 x [140 x [160 x double]]]*
store [150 x [140 x [160 x double]]]* %13, [150 x [140 x [160 x double]]]** %9
%14 = call i64 @polybench_alloc_data(i32 160, i32 8)
%15 = inttoptr i64 %14 to [160 x double]*
store [160 x double]* %15, [160 x double]** %10
%16 = call i64 @polybench_alloc_data(i32 25600, i32 8)
%17 = inttoptr i64 %16 to [160 x [160 x double]]*
store [160 x [160 x double]]* %17, [160 x [160 x double]]** %11
%18 = load i32, i32* %6
%19 = load i32, i32* %7
%20 = load i32, i32* %8
%21 = load [150 x [140 x [160 x double]]]*, [150 x [140 x [160 x double]]]** %9
%22 = getelementptr inbounds [150 x [140 x [160 x double]]], [150 x [140 x [160 x double]]]* %21, i64 0, i64 0
%23 = bitcast [140 x [160 x double]]* %22 to double***
%24 = load [160 x [160 x double]]*, [160 x [160 x double]]** %11
%25 = getelementptr inbounds [160 x [160 x double]], [160 x [160 x double]]* %24, i64 0, i64 0
%26 = bitcast [160 x double]* %25 to double**
%27 = call i32 @init_array(i32 %18, i32 %19, i32 %20, double*** %23, double** %26)
%28 = load i32, i32* %6
%29 = load i32, i32* %7
%30 = load i32, i32* %8
%31 = load [150 x [140 x [160 x double]]]*, [150 x [140 x [160 x double]]]** %9
%32 = getelementptr inbounds [150 x [140 x [160 x double]]], [150 x [140 x [160 x double]]]* %31, i64 0, i64 0
%33 = bitcast [140 x [160 x double]]* %32 to double***
%34 = load [160 x [160 x double]]*, [160 x [160 x double]]** %11
%35 = getelementptr inbounds [160 x [160 x double]], [160 x [160 x double]]* %34, i64 0, i64 0
%36 = bitcast [160 x double]* %35 to double**
%37 = load [160 x double]*, [160 x double]** %10
%38 = getelementptr inbounds [160 x double], [160 x double]* %37, i64 0, i64 0
%39 = call i32 @kernel_doitgen(i32 %28, i32 %29, i32 %30, double*** %33, double** %36, double* %38)
%40 = load i32, i32* %4
%41 = icmp sgt i32 %40, 42
br i1 %41, label %42, label %56
42: ; preds = %2
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i64 0
%45 = load i8*, i8** %44
%46 = call i32 @strcmp(i8* %45, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%47 = icmp ne i32 %46, 0
br i1 %47, label %56, label %48
48: ; preds = %42
%49 = load i32, i32* %6
%50 = load i32, i32* %7
%51 = load i32, i32* %8
%52 = load [150 x [140 x [160 x double]]]*, [150 x [140 x [160 x double]]]** %9
%53 = getelementptr inbounds [150 x [140 x [160 x double]]], [150 x [140 x [160 x double]]]* %52, i64 0, i64 0
%54 = bitcast [140 x [160 x double]]* %53 to double***
%55 = call i32 @print_array(i32 %49, i32 %50, i32 %51, double*** %54)
br label %56
56: ; preds = %48, %42, %2
%57 = load [150 x [140 x [160 x double]]]*, [150 x [140 x [160 x double]]]** %9
%58 = bitcast [150 x [140 x [160 x double]]]* %57 to i8*
%59 = call i32 @free(i8* %58)
%60 = load [160 x double]*, [160 x double]** %10
%61 = bitcast [160 x double]* %60 to i8*
%62 = call i32 @free(i8* %61)
%63 = load [160 x [160 x double]]*, [160 x [160 x double]]** %11
%64 = bitcast [160 x [160 x double]]* %63 to i8*
%65 = call i32 @free(i8* %64)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i64 @polybench_alloc_data(i32 3360000, i32 8)
%4 = tail call i64 @polybench_alloc_data(i32 160, i32 8)
%5 = inttoptr i64 %4 to [160 x double]*
%6 = tail call i64 @polybench_alloc_data(i32 25600, i32 8)
%7 = inttoptr i64 %3 to double***
%8 = inttoptr i64 %6 to double**
%9 = tail call i32 @init_array(i32 150, i32 140, i32 160, double*** %7, double** %8)
%10 = getelementptr inbounds [160 x double], [160 x double]* %5, i64 0, i64 0
%11 = tail call i32 @kernel_doitgen(i32 150, i32 140, i32 160, double*** %7, double** %8, double* %10)
%12 = icmp sgt i32 %0, 42
br i1 %12, label %13, label %19
13: ; preds = %2
%14 = load i8*, i8** %1
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %13
%18 = tail call i32 @print_array(i32 150, i32 140, i32 160, double*** %7)
br label %19
19: ; preds = %17, %13, %2
%20 = inttoptr i64 %3 to i8*
%21 = tail call i32 @free(i8* %20)
%22 = inttoptr i64 %4 to i8*
%23 = tail call i32 @free(i8* %22)
%24 = inttoptr i64 %6 to i8*
%25 = tail call i32 @free(i8* %24)
ret i32 0
}