#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, int, float *, float *, float **,
                              float **, float **, float **);
int /*<<< orphan*/ kernel_2mm(int, int, int, int, float, float, float **,
                              float **, float **, float **, float **);
scalar_t__ polybench_alloc_data(int, int);
int /*<<< orphan*/ polybench_timer_print();
int /*<<< orphan*/ polybench_timer_start();
int /*<<< orphan*/ polybench_timer_stop();
int /*<<< orphan*/ print_array(int, int, float **);
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char **argv) {
  int ni = 1024;
  int nj = 1024;
  int nk = 1024;
  int nl = 1024;
  float alpha;
  float beta;
  float(*tmp)[1024 + 0][1024 + 0];
  tmp = (float(*)[1024 + 0][1024 + 0])
      polybench_alloc_data((1024 + 0) * (1024 + 0), sizeof(float));
  ;
  float(*A)[1024 + 0][1024 + 0];
  A = (float(*)[1024 + 0][1024 + 0])
      polybench_alloc_data((1024 + 0) * (1024 + 0), sizeof(float));
  ;
  float(*B)[1024 + 0][1024 + 0];
  B = (float(*)[1024 + 0][1024 + 0])
      polybench_alloc_data((1024 + 0) * (1024 + 0), sizeof(float));
  ;
  float(*C)[1024 + 0][1024 + 0];
  C = (float(*)[1024 + 0][1024 + 0])
      polybench_alloc_data((1024 + 0) * (1024 + 0), sizeof(float));
  ;
  float(*D)[1024 + 0][1024 + 0];
  D = (float(*)[1024 + 0][1024 + 0])
      polybench_alloc_data((1024 + 0) * (1024 + 0), sizeof(float));
  ;
  init_array(ni, nj, nk, nl, &alpha, &beta, *A, *B, *C, *D);
  polybench_timer_start();
  ;
  kernel_2mm(ni, nj, nk, nl, alpha, beta, *tmp, *A, *B, *C, *D);
  polybench_timer_stop();
  ;
  polybench_timer_print();
  ;
  if (argc > 42 && !strcmp(argv[0], ""))
    print_array(ni, nl, *D);
  free((void *)tmp);
  ;
  free((void *)A);
  ;
  free((void *)B);
  ;
  free((void *)C);
  ;
  free((void *)D);
  ;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x78,%rsp
movl   $0x0,-0xc(%rbp)
mov    %edi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x400,-0x1c(%rbp)
movl   $0x400,-0x20(%rbp)
movl   $0x400,-0x24(%rbp)
movl   $0x400,-0x28(%rbp)
mov    $0x100000,%edi
mov    $0x4,%esi
call   1090 <polybench_alloc_data@plt>
mov    %rax,-0x38(%rbp)
mov    $0x100000,%edi
mov    $0x4,%esi
call   1090 <polybench_alloc_data@plt>
mov    %rax,-0x40(%rbp)
mov    $0x100000,%edi
mov    $0x4,%esi
call   1090 <polybench_alloc_data@plt>
mov    %rax,-0x48(%rbp)
mov    $0x100000,%edi
mov    $0x4,%esi
call   1090 <polybench_alloc_data@plt>
mov    %rax,-0x50(%rbp)
mov    $0x100000,%edi
mov    $0x4,%esi
call   1090 <polybench_alloc_data@plt>
mov    %rax,-0x58(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x28(%rbp),%ecx
mov    -0x40(%rbp),%rbx
mov    -0x48(%rbp),%r11
mov    -0x50(%rbp),%r10
mov    -0x58(%rbp),%rax
lea    -0x2c(%rbp),%r8
lea    -0x30(%rbp),%r9
mov    %rbx,(%rsp)
mov    %r11,0x8(%rsp)
mov    %r10,0x10(%rsp)
mov    %rax,0x18(%rsp)
call   1050 <init_array@plt>
mov    $0x0,%al
call   10a0 <polybench_timer_start@plt>
mov    -0x1c(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x28(%rbp),%ecx
movss  -0x2c(%rbp),%xmm0
movss  -0x30(%rbp),%xmm1
mov    -0x38(%rbp),%r8
mov    -0x40(%rbp),%r9
mov    -0x48(%rbp),%r11
mov    -0x50(%rbp),%r10
mov    -0x58(%rbp),%rax
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   10b0 <kernel_2mm@plt>
mov    $0x0,%al
call   1060 <polybench_timer_stop@plt>
mov    $0x0,%al
call   1080 <polybench_timer_print@plt>
cmpl   $0x2a,-0x10(%rbp)
jle    12e5 <main+0x155>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
lea    0xd38(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    12e5 <main+0x155>
mov    -0x1c(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    -0x58(%rbp),%rdx
call   1040 <print_array@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,0x10(%rsp)
mov    %edi,%ebp
mov    $0x100000,%edi
mov    $0x4,%esi
call   1080 <polybench_alloc_data@plt>
mov    %rax,%r14
mov    $0x100000,%edi
mov    $0x4,%esi
call   1080 <polybench_alloc_data@plt>
mov    %rax,%r12
mov    $0x100000,%edi
mov    $0x4,%esi
call   1080 <polybench_alloc_data@plt>
mov    %rax,%r13
mov    $0x100000,%edi
mov    $0x4,%esi
call   1080 <polybench_alloc_data@plt>
mov    %rax,%rbx
mov    $0x100000,%edi
mov    $0x4,%esi
call   1080 <polybench_alloc_data@plt>
mov    %rax,%r15
lea    0xc(%rsp),%r8
lea    0x8(%rsp),%r9
mov    $0x400,%edi
mov    $0x400,%esi
mov    $0x400,%edx
mov    $0x400,%ecx
push   %rax
push   %rbx
push   %r13
push   %r12
call   1050 <init_array@plt>
add    $0x20,%rsp
xor    %eax,%eax
call   1090 <polybench_timer_start@plt>
movss  0xc(%rsp),%xmm0
movss  0x8(%rsp),%xmm1
sub    $0x8,%rsp
mov    $0x400,%edi
mov    $0x400,%esi
mov    $0x400,%edx
mov    $0x400,%ecx
mov    %r14,%r8
mov    %r12,%r9
push   %r15
push   %rbx
push   %r13
call   10a0 <kernel_2mm@plt>
add    $0x20,%rsp
xor    %eax,%eax
call   1060 <polybench_timer_stop@plt>
xor    %eax,%eax
call   1070 <polybench_timer_print@plt>
cmp    $0x2b,%ebp
jl     128d <main+0x10d>
mov    0x10(%rsp),%rax
mov    (%rax),%rax
cmpb   $0x0,(%rax)
jne    128d <main+0x10d>
mov    $0x400,%edi
mov    $0x400,%esi
mov    %r15,%rdx
call   1040 <print_array@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    %r13,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x18,%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 i32
%9 = alloca i32
%10 = alloca float
%11 = alloca float
%12 = alloca [1024 x [1024 x float]]*
%13 = alloca [1024 x [1024 x float]]*
%14 = alloca [1024 x [1024 x float]]*
%15 = alloca [1024 x [1024 x float]]*
%16 = alloca [1024 x [1024 x float]]*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1024, i32* %6
store i32 1024, i32* %7
store i32 1024, i32* %8
store i32 1024, i32* %9
%17 = call i64 @polybench_alloc_data(i32 1048576, i32 4)
%18 = inttoptr i64 %17 to [1024 x [1024 x float]]*
store [1024 x [1024 x float]]* %18, [1024 x [1024 x float]]** %12
%19 = call i64 @polybench_alloc_data(i32 1048576, i32 4)
%20 = inttoptr i64 %19 to [1024 x [1024 x float]]*
store [1024 x [1024 x float]]* %20, [1024 x [1024 x float]]** %13
%21 = call i64 @polybench_alloc_data(i32 1048576, i32 4)
%22 = inttoptr i64 %21 to [1024 x [1024 x float]]*
store [1024 x [1024 x float]]* %22, [1024 x [1024 x float]]** %14
%23 = call i64 @polybench_alloc_data(i32 1048576, i32 4)
%24 = inttoptr i64 %23 to [1024 x [1024 x float]]*
store [1024 x [1024 x float]]* %24, [1024 x [1024 x float]]** %15
%25 = call i64 @polybench_alloc_data(i32 1048576, i32 4)
%26 = inttoptr i64 %25 to [1024 x [1024 x float]]*
store [1024 x [1024 x float]]* %26, [1024 x [1024 x float]]** %16
%27 = load i32, i32* %6
%28 = load i32, i32* %7
%29 = load i32, i32* %8
%30 = load i32, i32* %9
%31 = load [1024 x [1024 x float]]*, [1024 x [1024 x float]]** %13
%32 = getelementptr inbounds [1024 x [1024 x float]], [1024 x [1024 x float]]* %31, i64 0, i64 0
%33 = bitcast [1024 x float]* %32 to float**
%34 = load [1024 x [1024 x float]]*, [1024 x [1024 x float]]** %14
%35 = getelementptr inbounds [1024 x [1024 x float]], [1024 x [1024 x float]]* %34, i64 0, i64 0
%36 = bitcast [1024 x float]* %35 to float**
%37 = load [1024 x [1024 x float]]*, [1024 x [1024 x float]]** %15
%38 = getelementptr inbounds [1024 x [1024 x float]], [1024 x [1024 x float]]* %37, i64 0, i64 0
%39 = bitcast [1024 x float]* %38 to float**
%40 = load [1024 x [1024 x float]]*, [1024 x [1024 x float]]** %16
%41 = getelementptr inbounds [1024 x [1024 x float]], [1024 x [1024 x float]]* %40, i64 0, i64 0
%42 = bitcast [1024 x float]* %41 to float**
%43 = call i32 @init_array(i32 %27, i32 %28, i32 %29, i32 %30, float* %10, float* %11, float** %33, float** %36, float** %39, float** %42)
%44 = call i32 (...) @polybench_timer_start()
%45 = load i32, i32* %6
%46 = load i32, i32* %7
%47 = load i32, i32* %8
%48 = load i32, i32* %9
%49 = load float, float* %10
%50 = load float, float* %11
%51 = load [1024 x [1024 x float]]*, [1024 x [1024 x float]]** %12
%52 = getelementptr inbounds [1024 x [1024 x float]], [1024 x [1024 x float]]* %51, i64 0, i64 0
%53 = bitcast [1024 x float]* %52 to float**
%54 = load [1024 x [1024 x float]]*, [1024 x [1024 x float]]** %13
%55 = getelementptr inbounds [1024 x [1024 x float]], [1024 x [1024 x float]]* %54, i64 0, i64 0
%56 = bitcast [1024 x float]* %55 to float**
%57 = load [1024 x [1024 x float]]*, [1024 x [1024 x float]]** %14
%58 = getelementptr inbounds [1024 x [1024 x float]], [1024 x [1024 x float]]* %57, i64 0, i64 0
%59 = bitcast [1024 x float]* %58 to float**
%60 = load [1024 x [1024 x float]]*, [1024 x [1024 x float]]** %15
%61 = getelementptr inbounds [1024 x [1024 x float]], [1024 x [1024 x float]]* %60, i64 0, i64 0
%62 = bitcast [1024 x float]* %61 to float**
%63 = load [1024 x [1024 x float]]*, [1024 x [1024 x float]]** %16
%64 = getelementptr inbounds [1024 x [1024 x float]], [1024 x [1024 x float]]* %63, i64 0, i64 0
%65 = bitcast [1024 x float]* %64 to float**
%66 = call i32 @kernel_2mm(i32 %45, i32 %46, i32 %47, i32 %48, float %49, float %50, float** %53, float** %56, float** %59, float** %62, float** %65)
%67 = call i32 (...) @polybench_timer_stop()
%68 = call i32 (...) @polybench_timer_print()
%69 = load i32, i32* %4
%70 = icmp sgt i32 %69, 42
br i1 %70, label %71, label %84
71: ; preds = %2
%72 = load i8**, i8*** %5
%73 = getelementptr inbounds i8*, i8** %72, i64 0
%74 = load i8*, i8** %73
%75 = call i32 @strcmp(i8* %74, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%76 = icmp ne i32 %75, 0
br i1 %76, label %84, label %77
77: ; preds = %71
%78 = load i32, i32* %6
%79 = load i32, i32* %9
%80 = load [1024 x [1024 x float]]*, [1024 x [1024 x float]]** %16
%81 = getelementptr inbounds [1024 x [1024 x float]], [1024 x [1024 x float]]* %80, i64 0, i64 0
%82 = bitcast [1024 x float]* %81 to float**
%83 = call i32 @print_array(i32 %78, i32 %79, float** %82)
br label %84
84: ; preds = %77, %71, %2
%85 = load [1024 x [1024 x float]]*, [1024 x [1024 x float]]** %12
%86 = bitcast [1024 x [1024 x float]]* %85 to i8*
%87 = call i32 @free(i8* %86)
%88 = load [1024 x [1024 x float]]*, [1024 x [1024 x float]]** %13
%89 = bitcast [1024 x [1024 x float]]* %88 to i8*
%90 = call i32 @free(i8* %89)
%91 = load [1024 x [1024 x float]]*, [1024 x [1024 x float]]** %14
%92 = bitcast [1024 x [1024 x float]]* %91 to i8*
%93 = call i32 @free(i8* %92)
%94 = load [1024 x [1024 x float]]*, [1024 x [1024 x float]]** %15
%95 = bitcast [1024 x [1024 x float]]* %94 to i8*
%96 = call i32 @free(i8* %95)
%97 = load [1024 x [1024 x float]]*, [1024 x [1024 x float]]** %16
%98 = bitcast [1024 x [1024 x float]]* %97 to i8*
%99 = call i32 @free(i8* %98)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca float
%4 = alloca float
%5 = bitcast float* %3 to i8*
%6 = bitcast float* %4 to i8*
%7 = tail call i64 @polybench_alloc_data(i32 1048576, i32 4)
%8 = tail call i64 @polybench_alloc_data(i32 1048576, i32 4)
%9 = tail call i64 @polybench_alloc_data(i32 1048576, i32 4)
%10 = tail call i64 @polybench_alloc_data(i32 1048576, i32 4)
%11 = tail call i64 @polybench_alloc_data(i32 1048576, i32 4)
%12 = inttoptr i64 %8 to float**
%13 = inttoptr i64 %9 to float**
%14 = inttoptr i64 %10 to float**
%15 = inttoptr i64 %11 to float**
%16 = call i32 @init_array(i32 1024, i32 1024, i32 1024, i32 1024, float* %3, float* %4, float** %12, float** %13, float** %14, float** %15)
%17 = call i32 (...) @polybench_timer_start()
%18 = load float, float* %3
%19 = load float, float* %4
%20 = inttoptr i64 %7 to float**
%21 = call i32 @kernel_2mm(i32 1024, i32 1024, i32 1024, i32 1024, float %18, float %19, float** %20, float** %12, float** %13, float** %14, float** %15)
%22 = call i32 (...) @polybench_timer_stop()
%23 = call i32 (...) @polybench_timer_print()
%24 = icmp sgt i32 %0, 42
br i1 %24, label %25, label %31
25: ; preds = %2
%26 = load i8*, i8** %1
%27 = load i8, i8* %26
%28 = icmp eq i8 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %25
%30 = call i32 @print_array(i32 1024, i32 1024, float** %15)
br label %31
31: ; preds = %29, %25, %2
%32 = inttoptr i64 %7 to i8*
%33 = call i32 @free(i8* %32)
%34 = inttoptr i64 %8 to i8*
%35 = call i32 @free(i8* %34)
%36 = inttoptr i64 %9 to i8*
%37 = call i32 @free(i8* %36)
%38 = inttoptr i64 %10 to i8*
%39 = call i32 @free(i8* %38)
%40 = inttoptr i64 %11 to i8*
%41 = call i32 @free(i8* %40)
ret i32 0
}