#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*/ kernel_gemm(int, int, int, double, double, double **,
                               double **, double **);
scalar_t__ polybench_alloc_data(int, int);
int main(int argc, char **argv) {
  int ni = 1024;
  int nj = 1024;
  int nk = 1024;
  double alpha;
  double beta;
  double(*C)[1024][1024];
  C = (double(*)[1024][1024])polybench_alloc_data((1024) * (1024),
                                                  sizeof(double));
  double(*A)[1024][1024];
  A = (double(*)[1024][1024])polybench_alloc_data((1024) * (1024),
                                                  sizeof(double));
  double(*B)[1024][1024];
  kernel_gemm(ni, nj, nk, alpha, beta, *C, *A, *B);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x400,-0x14(%rbp)
movl   $0x400,-0x18(%rbp)
movl   $0x400,-0x1c(%rbp)
mov    $0x100000,%edi
mov    $0x8,%esi
call   1040 <polybench_alloc_data@plt>
mov    %rax,-0x38(%rbp)
mov    $0x100000,%edi
mov    $0x8,%esi
call   1040 <polybench_alloc_data@plt>
mov    %rax,-0x40(%rbp)
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   1030 <kernel_gemm@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x100000,%edi
mov    $0x8,%esi
call   1040 <polybench_alloc_data@plt>
mov    %rax,%rbx
mov    $0x100000,%edi
mov    $0x8,%esi
call   1040 <polybench_alloc_data@plt>
mov    $0x400,%edi
mov    $0x400,%esi
mov    $0x400,%edx
mov    %rbx,%rcx
mov    %rax,%r8
call   1030 <kernel_gemm@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca double
%9 = alloca double
%10 = alloca [1024 x [1024 x double]]*
%11 = alloca [1024 x [1024 x double]]*
%12 = alloca [1024 x [1024 x double]]*
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 1024, i32* %5
store i32 1024, i32* %6
store i32 1024, i32* %7
%13 = call i64 @polybench_alloc_data(i32 1048576, i32 8)
%14 = inttoptr i64 %13 to [1024 x [1024 x double]]*
store [1024 x [1024 x double]]* %14, [1024 x [1024 x double]]** %10
%15 = call i64 @polybench_alloc_data(i32 1048576, i32 8)
%16 = inttoptr i64 %15 to [1024 x [1024 x double]]*
store [1024 x [1024 x double]]* %16, [1024 x [1024 x double]]** %11
%17 = load i32, i32* %5
%18 = load i32, i32* %6
%19 = load i32, i32* %7
%20 = load double, double* %8
%21 = load double, double* %9
%22 = load [1024 x [1024 x double]]*, [1024 x [1024 x double]]** %10
%23 = getelementptr inbounds [1024 x [1024 x double]], [1024 x [1024 x double]]* %22, i64 0, i64 0
%24 = bitcast [1024 x double]* %23 to double**
%25 = load [1024 x [1024 x double]]*, [1024 x [1024 x double]]** %11
%26 = getelementptr inbounds [1024 x [1024 x double]], [1024 x [1024 x double]]* %25, i64 0, i64 0
%27 = bitcast [1024 x double]* %26 to double**
%28 = load [1024 x [1024 x double]]*, [1024 x [1024 x double]]** %12
%29 = getelementptr inbounds [1024 x [1024 x double]], [1024 x [1024 x double]]* %28, i64 0, i64 0
%30 = bitcast [1024 x double]* %29 to double**
%31 = call i32 @kernel_gemm(i32 %17, i32 %18, i32 %19, double %20, double %21, double** %24, double** %27, double** %30)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 @polybench_alloc_data(i32 1048576, i32 8)
%4 = tail call i64 @polybench_alloc_data(i32 1048576, i32 8)
%5 = inttoptr i64 %3 to double**
%6 = inttoptr i64 %4 to double**
%7 = tail call i32 @kernel_gemm(i32 1024, i32 1024, i32 1024, double undef, double undef, double** %5, double** %6, double** poison)
ret i32 0
}