#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 */
double get_time();
int /*<<< orphan*/ init_data(int, int, float **);
scalar_t__ malloc(int);
int /*<<< orphan*/ pencil_sgemm_ttt(int, int, int, int, int /*<<< orphan*/,
                                    float **, int /*<<< orphan*/, float **, int,
                                    int /*<<< orphan*/, float **);
int main() {
  double start_time, end_time;
  float(*A)[1024][1024] =
      (float(*)[1024][1024])malloc(1024 * 1024 * sizeof(float));
  float(*B)[1024][1024] =
      (float(*)[1024][1024])malloc(1024 * 1024 * sizeof(float));
  float(*C)[1024][1024] =
      (float(*)[1024][1024])malloc(1024 * 1024 * sizeof(float));
  init_data(1024, 1024, *A);
  init_data(1024, 1024, *B);
  init_data(1024, 1024, *C);
  start_time = get_time();
  pencil_sgemm_ttt(1024, 1024, 1024, 10, 0, *A, 0, *B, 10, 0, *C);
  end_time = get_time();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x400000,%edi
call   1060 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    $0x400000,%edi
call   1060 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    $0x400000,%edi
call   1060 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rdx
mov    $0x400,%esi
mov    %esi,%edi
call   1030 <init_data@plt>
mov    -0x28(%rbp),%rdx
mov    $0x400,%esi
mov    %esi,%edi
call   1030 <init_data@plt>
mov    -0x30(%rbp),%rdx
mov    $0x400,%esi
mov    %esi,%edi
call   1030 <init_data@plt>
mov    $0x0,%al
call   1050 <get_time@plt>
movsd  %xmm0,-0x10(%rbp)
mov    -0x20(%rbp),%r9
mov    -0x28(%rbp),%r10
mov    -0x30(%rbp),%rax
mov    $0x400,%edx
mov    $0xa,%ecx
xor    %r8d,%r8d
mov    %edx,%edi
mov    %edx,%esi
movl   $0x0,(%rsp)
mov    %r10,0x8(%rsp)
movl   $0xa,0x10(%rsp)
movl   $0x0,0x18(%rsp)
mov    %rax,0x20(%rsp)
call   1040 <pencil_sgemm_ttt@plt>
mov    $0x0,%al
call   1050 <get_time@plt>
movsd  %xmm0,-0x18(%rbp)
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    $0x400000,%edi
call   1060 <malloc@plt>
mov    %rax,%r15
mov    $0x400000,%edi
call   1060 <malloc@plt>
mov    %rax,%r14
mov    $0x400000,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    $0x400,%edi
mov    $0x400,%esi
mov    %r15,%rdx
call   1030 <init_data@plt>
mov    $0x400,%edi
mov    $0x400,%esi
mov    %r14,%rdx
call   1030 <init_data@plt>
mov    $0x400,%edi
mov    $0x400,%esi
mov    %rbx,%rdx
call   1030 <init_data@plt>
xor    %eax,%eax
call   1050 <get_time@plt>
sub    $0x8,%rsp
mov    $0x400,%edi
mov    $0x400,%esi
mov    $0x400,%edx
mov    $0xa,%ecx
xor    %r8d,%r8d
mov    %r15,%r9
push   %rbx
push   $0x0
push   $0xa
push   %r14
push   $0x0
call   1040 <pencil_sgemm_ttt@plt>
add    $0x30,%rsp
xor    %eax,%eax
call   1050 <get_time@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca [1024 x [1024 x float]]*
%5 = alloca [1024 x [1024 x float]]*
%6 = alloca [1024 x [1024 x float]]*
store i32 0, i32* %1
%7 = call i64 @malloc(i32 4194304)
%8 = inttoptr i64 %7 to [1024 x [1024 x float]]*
store [1024 x [1024 x float]]* %8, [1024 x [1024 x float]]** %4
%9 = call i64 @malloc(i32 4194304)
%10 = inttoptr i64 %9 to [1024 x [1024 x float]]*
store [1024 x [1024 x float]]* %10, [1024 x [1024 x float]]** %5
%11 = call i64 @malloc(i32 4194304)
%12 = inttoptr i64 %11 to [1024 x [1024 x float]]*
store [1024 x [1024 x float]]* %12, [1024 x [1024 x float]]** %6
%13 = load [1024 x [1024 x float]]*, [1024 x [1024 x float]]** %4
%14 = getelementptr inbounds [1024 x [1024 x float]], [1024 x [1024 x float]]* %13, i64 0, i64 0
%15 = bitcast [1024 x float]* %14 to float**
%16 = call i32 @init_data(i32 1024, i32 1024, float** %15)
%17 = load [1024 x [1024 x float]]*, [1024 x [1024 x float]]** %5
%18 = getelementptr inbounds [1024 x [1024 x float]], [1024 x [1024 x float]]* %17, i64 0, i64 0
%19 = bitcast [1024 x float]* %18 to float**
%20 = call i32 @init_data(i32 1024, i32 1024, float** %19)
%21 = load [1024 x [1024 x float]]*, [1024 x [1024 x float]]** %6
%22 = getelementptr inbounds [1024 x [1024 x float]], [1024 x [1024 x float]]* %21, i64 0, i64 0
%23 = bitcast [1024 x float]* %22 to float**
%24 = call i32 @init_data(i32 1024, i32 1024, float** %23)
%25 = call double (...) @get_time()
store double %25, double* %2
%26 = load [1024 x [1024 x float]]*, [1024 x [1024 x float]]** %4
%27 = getelementptr inbounds [1024 x [1024 x float]], [1024 x [1024 x float]]* %26, i64 0, i64 0
%28 = bitcast [1024 x float]* %27 to float**
%29 = load [1024 x [1024 x float]]*, [1024 x [1024 x float]]** %5
%30 = getelementptr inbounds [1024 x [1024 x float]], [1024 x [1024 x float]]* %29, i64 0, i64 0
%31 = bitcast [1024 x float]* %30 to float**
%32 = load [1024 x [1024 x float]]*, [1024 x [1024 x float]]** %6
%33 = getelementptr inbounds [1024 x [1024 x float]], [1024 x [1024 x float]]* %32, i64 0, i64 0
%34 = bitcast [1024 x float]* %33 to float**
%35 = call i32 @pencil_sgemm_ttt(i32 1024, i32 1024, i32 1024, i32 10, i32 0, float** %28, i32 0, float** %31, i32 10, i32 0, float** %34)
%36 = call double (...) @get_time()
store double %36, double* %3
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 @malloc(i32 4194304)
%2 = tail call i64 @malloc(i32 4194304)
%3 = tail call i64 @malloc(i32 4194304)
%4 = inttoptr i64 %1 to float**
%5 = tail call i32 @init_data(i32 1024, i32 1024, float** %4)
%6 = inttoptr i64 %2 to float**
%7 = tail call i32 @init_data(i32 1024, i32 1024, float** %6)
%8 = inttoptr i64 %3 to float**
%9 = tail call i32 @init_data(i32 1024, i32 1024, float** %8)
%10 = tail call double (...) @get_time()
%11 = tail call i32 @pencil_sgemm_ttt(i32 1024, i32 1024, i32 1024, i32 10, i32 0, float** %4, i32 0, float** %6, i32 10, i32 0, float** %8)
%12 = tail call double (...) @get_time()
ret i32 0
}