#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_gramschmidt(int, int, double **, double **,
                                      double **);
scalar_t__ polybench_alloc_data(int, int);
int /*<<< orphan*/ print_array(int, int, double **, double **, double **);
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char **argv) {
  int m = 1000;
  int n = 1200;
  double(*A)[1000 + 0][1200 + 0];
  A = (double(*)[1000 + 0][1200 + 0])
      polybench_alloc_data((1000 + 0) * (1200 + 0), sizeof(double));
  ;
  double(*R)[1200 + 0][1200 + 0];
  R = (double(*)[1200 + 0][1200 + 0])
      polybench_alloc_data((1200 + 0) * (1200 + 0), sizeof(double));
  ;
  double(*Q)[1000 + 0][1200 + 0];
  Q = (double(*)[1000 + 0][1200 + 0])
      polybench_alloc_data((1000 + 0) * (1200 + 0), sizeof(double));
  ;
  init_array(m, n, *A, *R, *Q);
  ;
  kernel_gramschmidt(m, n, *A, *R, *Q);
  ;
  ;
  if (argc > 42 && !strcmp(argv[0], ""))
    print_array(m, n, *A, *R, *Q);
  free((void *)A);
  ;
  free((void *)R);
  ;
  free((void *)Q);
  ;
  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    $0x124f80,%edi
mov    $0x8,%esi
call   1070 <polybench_alloc_data@plt>
mov    %rax,-0x20(%rbp)
mov    $0x15f900,%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    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
call   1050 <init_array@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
call   1080 <kernel_gramschmidt@plt>
cmpl   $0x2a,-0x8(%rbp)
jle    1228 <main+0xc8>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xdfd(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    1228 <main+0xc8>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
call   1040 <print_array@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@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   %r12
push   %rbx
mov    %rsi,%r12
mov    %edi,%ebp
mov    $0x124f80,%edi
mov    $0x8,%esi
call   1060 <polybench_alloc_data@plt>
mov    %rax,%r14
mov    $0x15f900,%edi
mov    $0x8,%esi
call   1060 <polybench_alloc_data@plt>
mov    %rax,%r15
mov    $0x124f80,%edi
mov    $0x8,%esi
call   1060 <polybench_alloc_data@plt>
mov    %rax,%rbx
mov    $0x3e8,%edi
mov    $0x4b0,%esi
mov    %r14,%rdx
mov    %r15,%rcx
mov    %rax,%r8
call   1050 <init_array@plt>
mov    $0x3e8,%edi
mov    $0x4b0,%esi
mov    %r14,%rdx
mov    %r15,%rcx
mov    %rbx,%r8
call   1070 <kernel_gramschmidt@plt>
cmp    $0x2b,%ebp
jl     11e9 <main+0x99>
mov    (%r12),%rax
cmpb   $0x0,(%rax)
jne    11e9 <main+0x99>
mov    $0x3e8,%edi
mov    $0x4b0,%esi
mov    %r14,%rdx
mov    %r15,%rcx
mov    %rbx,%r8
call   1040 <print_array@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
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 [1000 x [1200 x double]]*
%9 = alloca [1200 x [1200 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 1200000, i32 8)
%12 = inttoptr i64 %11 to [1000 x [1200 x double]]*
store [1000 x [1200 x double]]* %12, [1000 x [1200 x double]]** %8
%13 = call i64 @polybench_alloc_data(i32 1440000, i32 8)
%14 = inttoptr i64 %13 to [1200 x [1200 x double]]*
store [1200 x [1200 x double]]* %14, [1200 x [1200 x double]]** %9
%15 = call i64 @polybench_alloc_data(i32 1200000, i32 8)
%16 = inttoptr i64 %15 to [1000 x [1200 x double]]*
store [1000 x [1200 x double]]* %16, [1000 x [1200 x double]]** %10
%17 = load i32, i32* %6
%18 = load i32, i32* %7
%19 = load [1000 x [1200 x double]]*, [1000 x [1200 x double]]** %8
%20 = getelementptr inbounds [1000 x [1200 x double]], [1000 x [1200 x double]]* %19, i64 0, i64 0
%21 = bitcast [1200 x double]* %20 to double**
%22 = load [1200 x [1200 x double]]*, [1200 x [1200 x double]]** %9
%23 = getelementptr inbounds [1200 x [1200 x double]], [1200 x [1200 x double]]* %22, i64 0, i64 0
%24 = bitcast [1200 x double]* %23 to double**
%25 = load [1000 x [1200 x double]]*, [1000 x [1200 x double]]** %10
%26 = getelementptr inbounds [1000 x [1200 x double]], [1000 x [1200 x double]]* %25, i64 0, i64 0
%27 = bitcast [1200 x double]* %26 to double**
%28 = call i32 @init_array(i32 %17, i32 %18, double** %21, double** %24, double** %27)
%29 = load i32, i32* %6
%30 = load i32, i32* %7
%31 = load [1000 x [1200 x double]]*, [1000 x [1200 x double]]** %8
%32 = getelementptr inbounds [1000 x [1200 x double]], [1000 x [1200 x double]]* %31, i64 0, i64 0
%33 = bitcast [1200 x double]* %32 to double**
%34 = load [1200 x [1200 x double]]*, [1200 x [1200 x double]]** %9
%35 = getelementptr inbounds [1200 x [1200 x double]], [1200 x [1200 x double]]* %34, i64 0, i64 0
%36 = bitcast [1200 x double]* %35 to double**
%37 = load [1000 x [1200 x double]]*, [1000 x [1200 x double]]** %10
%38 = getelementptr inbounds [1000 x [1200 x double]], [1000 x [1200 x double]]* %37, i64 0, i64 0
%39 = bitcast [1200 x double]* %38 to double**
%40 = call i32 @kernel_gramschmidt(i32 %29, i32 %30, double** %33, double** %36, double** %39)
%41 = load i32, i32* %4
%42 = icmp sgt i32 %41, 42
br i1 %42, label %43, label %62
43: ; preds = %2
%44 = load i8**, i8*** %5
%45 = getelementptr inbounds i8*, i8** %44, i64 0
%46 = load i8*, i8** %45
%47 = call i32 @strcmp(i8* %46, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%48 = icmp ne i32 %47, 0
br i1 %48, label %62, label %49
49: ; preds = %43
%50 = load i32, i32* %6
%51 = load i32, i32* %7
%52 = load [1000 x [1200 x double]]*, [1000 x [1200 x double]]** %8
%53 = getelementptr inbounds [1000 x [1200 x double]], [1000 x [1200 x double]]* %52, i64 0, i64 0
%54 = bitcast [1200 x double]* %53 to double**
%55 = load [1200 x [1200 x double]]*, [1200 x [1200 x double]]** %9
%56 = getelementptr inbounds [1200 x [1200 x double]], [1200 x [1200 x double]]* %55, i64 0, i64 0
%57 = bitcast [1200 x double]* %56 to double**
%58 = load [1000 x [1200 x double]]*, [1000 x [1200 x double]]** %10
%59 = getelementptr inbounds [1000 x [1200 x double]], [1000 x [1200 x double]]* %58, i64 0, i64 0
%60 = bitcast [1200 x double]* %59 to double**
%61 = call i32 @print_array(i32 %50, i32 %51, double** %54, double** %57, double** %60)
br label %62
62: ; preds = %49, %43, %2
%63 = load [1000 x [1200 x double]]*, [1000 x [1200 x double]]** %8
%64 = bitcast [1000 x [1200 x double]]* %63 to i8*
%65 = call i32 @free(i8* %64)
%66 = load [1200 x [1200 x double]]*, [1200 x [1200 x double]]** %9
%67 = bitcast [1200 x [1200 x double]]* %66 to i8*
%68 = call i32 @free(i8* %67)
%69 = load [1000 x [1200 x double]]*, [1000 x [1200 x double]]** %10
%70 = bitcast [1000 x [1200 x double]]* %69 to i8*
%71 = call i32 @free(i8* %70)
ret i32 0
}

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