#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, double *, double **, double **);
int /*<<< orphan*/ kernel_trmm(int, int, 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 m = 1000;
  int n = 1200;
  double alpha;
  double(*A)[1000 + 0][1000 + 0];
  A = (double(*)[1000 + 0][1000 + 0])
      polybench_alloc_data((1000 + 0) * (1000 + 0), sizeof(double));
  ;
  double(*B)[1000 + 0][1200 + 0];
  B = (double(*)[1000 + 0][1200 + 0])
      polybench_alloc_data((1000 + 0) * (1200 + 0), sizeof(double));
  ;
  init_array(m, n, &alpha, *A, *B);
  ;
  kernel_trmm(m, n, alpha, *A, *B);
  ;
  ;
  if (argc > 42 && !strcmp(argv[0], ""))
    print_array(m, n, *B);
  free((void *)A);
  ;
  free((void *)B);
  ;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x3e8,-0x14(%rbp)
movl   $0x4b0,-0x18(%rbp)
mov    $0xf4240,%edi
mov    $0x8,%esi
call   1070 <polybench_alloc_data@plt>
mov    %rax,-0x28(%rbp)
mov    $0x124f80,%edi
mov    $0x8,%esi
call   1070 <polybench_alloc_data@plt>
mov    %rax,-0x30(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
lea    -0x20(%rbp),%rdx
call   1050 <init_array@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
movsd  -0x20(%rbp),%xmm0
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
call   1080 <kernel_trmm@plt>
cmpl   $0x2a,-0x8(%rbp)
jle    120e <main+0xae>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe0f(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    120e <main+0xae>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x30(%rbp),%rdx
call   1040 <print_array@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %edi,%ebp
mov    $0xf4240,%edi
mov    $0x8,%esi
call   1060 <polybench_alloc_data@plt>
mov    %rax,%r14
mov    $0x124f80,%edi
mov    $0x8,%esi
call   1060 <polybench_alloc_data@plt>
mov    %rax,%rbx
mov    %rsp,%rdx
mov    $0x3e8,%edi
mov    $0x4b0,%esi
mov    %r14,%rcx
mov    %rax,%r8
call   1050 <init_array@plt>
movsd  (%rsp),%xmm0
mov    $0x3e8,%edi
mov    $0x4b0,%esi
mov    %r14,%rdx
mov    %rbx,%rcx
call   1070 <kernel_trmm@plt>
cmp    $0x2b,%ebp
jl     11d1 <main+0x81>
mov    (%r15),%rax
cmpb   $0x0,(%rax)
jne    11d1 <main+0x81>
mov    $0x3e8,%edi
mov    $0x4b0,%esi
mov    %rbx,%rdx
call   1040 <print_array@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
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 double
%9 = alloca [1000 x [1000 x double]]*
%10 = alloca [1000 x [1200 x double]]*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1000, i32* %6
store i32 1200, i32* %7
%11 = call i64 @polybench_alloc_data(i32 1000000, i32 8)
%12 = inttoptr i64 %11 to [1000 x [1000 x double]]*
store [1000 x [1000 x double]]* %12, [1000 x [1000 x double]]** %9
%13 = call i64 @polybench_alloc_data(i32 1200000, i32 8)
%14 = inttoptr i64 %13 to [1000 x [1200 x double]]*
store [1000 x [1200 x double]]* %14, [1000 x [1200 x double]]** %10
%15 = load i32, i32* %6
%16 = load i32, i32* %7
%17 = load [1000 x [1000 x double]]*, [1000 x [1000 x double]]** %9
%18 = getelementptr inbounds [1000 x [1000 x double]], [1000 x [1000 x double]]* %17, i64 0, i64 0
%19 = bitcast [1000 x double]* %18 to double**
%20 = load [1000 x [1200 x double]]*, [1000 x [1200 x double]]** %10
%21 = getelementptr inbounds [1000 x [1200 x double]], [1000 x [1200 x double]]* %20, i64 0, i64 0
%22 = bitcast [1200 x double]* %21 to double**
%23 = call i32 @init_array(i32 %15, i32 %16, double* %8, double** %19, double** %22)
%24 = load i32, i32* %6
%25 = load i32, i32* %7
%26 = load double, double* %8
%27 = load [1000 x [1000 x double]]*, [1000 x [1000 x double]]** %9
%28 = getelementptr inbounds [1000 x [1000 x double]], [1000 x [1000 x double]]* %27, i64 0, i64 0
%29 = bitcast [1000 x double]* %28 to double**
%30 = load [1000 x [1200 x double]]*, [1000 x [1200 x double]]** %10
%31 = getelementptr inbounds [1000 x [1200 x double]], [1000 x [1200 x double]]* %30, i64 0, i64 0
%32 = bitcast [1200 x double]* %31 to double**
%33 = call i32 @kernel_trmm(i32 %24, i32 %25, double %26, double** %29, double** %32)
%34 = load i32, i32* %4
%35 = icmp sgt i32 %34, 42
br i1 %35, label %36, label %49
36: ; preds = %2
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 0
%39 = load i8*, i8** %38
%40 = call i32 @strcmp(i8* %39, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%41 = icmp ne i32 %40, 0
br i1 %41, label %49, label %42
42: ; preds = %36
%43 = load i32, i32* %6
%44 = load i32, i32* %7
%45 = load [1000 x [1200 x double]]*, [1000 x [1200 x double]]** %10
%46 = getelementptr inbounds [1000 x [1200 x double]], [1000 x [1200 x double]]* %45, i64 0, i64 0
%47 = bitcast [1200 x double]* %46 to double**
%48 = call i32 @print_array(i32 %43, i32 %44, double** %47)
br label %49
49: ; preds = %42, %36, %2
%50 = load [1000 x [1000 x double]]*, [1000 x [1000 x double]]** %9
%51 = bitcast [1000 x [1000 x double]]* %50 to i8*
%52 = call i32 @free(i8* %51)
%53 = load [1000 x [1200 x double]]*, [1000 x [1200 x double]]** %10
%54 = bitcast [1000 x [1200 x double]]* %53 to i8*
%55 = call i32 @free(i8* %54)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca double
%4 = bitcast double* %3 to i8*
%5 = tail call i64 @polybench_alloc_data(i32 1000000, i32 8)
%6 = tail call i64 @polybench_alloc_data(i32 1200000, i32 8)
%7 = inttoptr i64 %5 to double**
%8 = inttoptr i64 %6 to double**
%9 = call i32 @init_array(i32 1000, i32 1200, double* %3, double** %7, double** %8)
%10 = load double, double* %3
%11 = call i32 @kernel_trmm(i32 1000, i32 1200, double %10, double** %7, double** %8)
%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 = call i32 @print_array(i32 1000, i32 1200, double** %8)
br label %19
19: ; preds = %17, %13, %2
%20 = inttoptr i64 %5 to i8*
%21 = call i32 @free(i8* %20)
%22 = inttoptr i64 %6 to i8*
%23 = call i32 @free(i8* %22)
ret i32 0
}