#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 *, double **,
                              double **, double **);
int /*<<< orphan*/ kernel_gemm(int, int, int, double, double, double **,
                               double **, double **);
scalar_t__ polybench_alloc_data(int, int);
int /*<<< orphan*/ print_array(int, int, double **);
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char **argv) {
  int ni = 1000;
  int nj = 1100;
  int nk = 1200;
  double alpha;
  double beta;
  double(*C)[1000 + 0][1100 + 0];
  C = (double(*)[1000 + 0][1100 + 0])
      polybench_alloc_data((1000 + 0) * (1100 + 0), sizeof(double));
  ;
  double(*A)[1000 + 0][1200 + 0];
  A = (double(*)[1000 + 0][1200 + 0])
      polybench_alloc_data((1000 + 0) * (1200 + 0), sizeof(double));
  ;
  double(*B)[1200 + 0][1100 + 0];
  B = (double(*)[1200 + 0][1100 + 0])
      polybench_alloc_data((1200 + 0) * (1100 + 0), sizeof(double));
  ;
  init_array(ni, nj, nk, &alpha, &beta, *C, *A, *B);
  ;
  kernel_gemm(ni, nj, nk, alpha, beta, *C, *A, *B);
  ;
  ;
  if (argc > 42 && !strcmp(argv[0], ""))
    print_array(ni, nj, *C);
  free((void *)C);
  ;
  free((void *)A);
  ;
  free((void *)B);
  ;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x3e8,-0x14(%rbp)
movl   $0x44c,-0x18(%rbp)
movl   $0x4b0,-0x1c(%rbp)
mov    $0x10c8e0,%edi
mov    $0x8,%esi
call   1080 <polybench_alloc_data@plt>
mov    %rax,-0x38(%rbp)
mov    $0x124f80,%edi
mov    $0x8,%esi
call   1080 <polybench_alloc_data@plt>
mov    %rax,-0x40(%rbp)
mov    $0x142440,%edi
mov    $0x8,%esi
call   1080 <polybench_alloc_data@plt>
mov    %rax,-0x48(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x38(%rbp),%r9
mov    -0x40(%rbp),%r10
mov    -0x48(%rbp),%rax
lea    -0x28(%rbp),%rcx
lea    -0x30(%rbp),%r8
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1050 <init_array@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
movsd  -0x28(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
mov    -0x38(%rbp),%rcx
mov    -0x40(%rbp),%r8
mov    -0x48(%rbp),%r9
call   1070 <kernel_gemm@plt>
cmpl   $0x2a,-0x8(%rbp)
jle    1248 <main+0xe8>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xdd5(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    1248 <main+0xe8>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x38(%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>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r15
mov    %edi,%ebp
mov    $0x10c8e0,%edi
mov    $0x8,%esi
call   1070 <polybench_alloc_data@plt>
mov    %rax,%r12
mov    $0x124f80,%edi
mov    $0x8,%esi
call   1070 <polybench_alloc_data@plt>
mov    %rax,%r14
mov    $0x142440,%edi
mov    $0x8,%esi
call   1070 <polybench_alloc_data@plt>
mov    %rax,%rbx
lea    0x8(%rsp),%rcx
mov    %rsp,%r8
mov    $0x3e8,%edi
mov    $0x44c,%esi
mov    $0x4b0,%edx
mov    %r12,%r9
push   %rax
push   %r14
call   1050 <init_array@plt>
add    $0x10,%rsp
movsd  0x8(%rsp),%xmm0
movsd  (%rsp),%xmm1
mov    $0x3e8,%edi
mov    $0x44c,%esi
mov    $0x4b0,%edx
mov    %r12,%rcx
mov    %r14,%r8
mov    %rbx,%r9
call   1060 <kernel_gemm@plt>
cmp    $0x2b,%ebp
jl     1204 <main+0xb4>
mov    (%r15),%rax
cmpb   $0x0,(%rax)
jne    1204 <main+0xb4>
mov    $0x3e8,%edi
mov    $0x44c,%esi
mov    %r12,%rdx
call   1040 <print_array@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
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 double
%10 = alloca double
%11 = alloca [1000 x [1100 x double]]*
%12 = alloca [1000 x [1200 x double]]*
%13 = alloca [1200 x [1100 x double]]*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1000, i32* %6
store i32 1100, i32* %7
store i32 1200, i32* %8
%14 = call i64 @polybench_alloc_data(i32 1100000, i32 8)
%15 = inttoptr i64 %14 to [1000 x [1100 x double]]*
store [1000 x [1100 x double]]* %15, [1000 x [1100 x double]]** %11
%16 = call i64 @polybench_alloc_data(i32 1200000, i32 8)
%17 = inttoptr i64 %16 to [1000 x [1200 x double]]*
store [1000 x [1200 x double]]* %17, [1000 x [1200 x double]]** %12
%18 = call i64 @polybench_alloc_data(i32 1320000, i32 8)
%19 = inttoptr i64 %18 to [1200 x [1100 x double]]*
store [1200 x [1100 x double]]* %19, [1200 x [1100 x double]]** %13
%20 = load i32, i32* %6
%21 = load i32, i32* %7
%22 = load i32, i32* %8
%23 = load [1000 x [1100 x double]]*, [1000 x [1100 x double]]** %11
%24 = getelementptr inbounds [1000 x [1100 x double]], [1000 x [1100 x double]]* %23, i64 0, i64 0
%25 = bitcast [1100 x double]* %24 to double**
%26 = load [1000 x [1200 x double]]*, [1000 x [1200 x double]]** %12
%27 = getelementptr inbounds [1000 x [1200 x double]], [1000 x [1200 x double]]* %26, i64 0, i64 0
%28 = bitcast [1200 x double]* %27 to double**
%29 = load [1200 x [1100 x double]]*, [1200 x [1100 x double]]** %13
%30 = getelementptr inbounds [1200 x [1100 x double]], [1200 x [1100 x double]]* %29, i64 0, i64 0
%31 = bitcast [1100 x double]* %30 to double**
%32 = call i32 @init_array(i32 %20, i32 %21, i32 %22, double* %9, double* %10, double** %25, double** %28, double** %31)
%33 = load i32, i32* %6
%34 = load i32, i32* %7
%35 = load i32, i32* %8
%36 = load double, double* %9
%37 = load double, double* %10
%38 = load [1000 x [1100 x double]]*, [1000 x [1100 x double]]** %11
%39 = getelementptr inbounds [1000 x [1100 x double]], [1000 x [1100 x double]]* %38, i64 0, i64 0
%40 = bitcast [1100 x double]* %39 to double**
%41 = load [1000 x [1200 x double]]*, [1000 x [1200 x double]]** %12
%42 = getelementptr inbounds [1000 x [1200 x double]], [1000 x [1200 x double]]* %41, i64 0, i64 0
%43 = bitcast [1200 x double]* %42 to double**
%44 = load [1200 x [1100 x double]]*, [1200 x [1100 x double]]** %13
%45 = getelementptr inbounds [1200 x [1100 x double]], [1200 x [1100 x double]]* %44, i64 0, i64 0
%46 = bitcast [1100 x double]* %45 to double**
%47 = call i32 @kernel_gemm(i32 %33, i32 %34, i32 %35, double %36, double %37, double** %40, double** %43, double** %46)
%48 = load i32, i32* %4
%49 = icmp sgt i32 %48, 42
br i1 %49, label %50, label %63
50: ; preds = %2
%51 = load i8**, i8*** %5
%52 = getelementptr inbounds i8*, i8** %51, i64 0
%53 = load i8*, i8** %52
%54 = call i32 @strcmp(i8* %53, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%55 = icmp ne i32 %54, 0
br i1 %55, label %63, label %56
56: ; preds = %50
%57 = load i32, i32* %6
%58 = load i32, i32* %7
%59 = load [1000 x [1100 x double]]*, [1000 x [1100 x double]]** %11
%60 = getelementptr inbounds [1000 x [1100 x double]], [1000 x [1100 x double]]* %59, i64 0, i64 0
%61 = bitcast [1100 x double]* %60 to double**
%62 = call i32 @print_array(i32 %57, i32 %58, double** %61)
br label %63
63: ; preds = %56, %50, %2
%64 = load [1000 x [1100 x double]]*, [1000 x [1100 x double]]** %11
%65 = bitcast [1000 x [1100 x double]]* %64 to i8*
%66 = call i32 @free(i8* %65)
%67 = load [1000 x [1200 x double]]*, [1000 x [1200 x double]]** %12
%68 = bitcast [1000 x [1200 x double]]* %67 to i8*
%69 = call i32 @free(i8* %68)
%70 = load [1200 x [1100 x double]]*, [1200 x [1100 x double]]** %13
%71 = bitcast [1200 x [1100 x double]]* %70 to i8*
%72 = call i32 @free(i8* %71)
ret i32 0
}

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