#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, double **, double *, double *, double *);
int /*<<< orphan*/ kernel_ludcmp(int, double **, double *, double *, double *);
scalar_t__ polybench_alloc_data(int, int);
int /*<<< orphan*/ print_array(int, double *);
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char **argv) {
  int n = 2000;
  double(*A)[2000 + 0][2000 + 0];
  A = (double(*)[2000 + 0][2000 + 0])
      polybench_alloc_data((2000 + 0) * (2000 + 0), sizeof(double));
  ;
  double(*b)[2000 + 0];
  b = (double(*)[2000 + 0]) polybench_alloc_data(2000 + 0, sizeof(double));
  ;
  double(*x)[2000 + 0];
  x = (double(*)[2000 + 0]) polybench_alloc_data(2000 + 0, sizeof(double));
  ;
  double(*y)[2000 + 0];
  y = (double(*)[2000 + 0]) polybench_alloc_data(2000 + 0, sizeof(double));
  ;
  init_array(n, *A, *b, *x, *y);
  ;
  kernel_ludcmp(n, *A, *b, *x, *y);
  ;
  ;
  if (argc > 42 && !strcmp(argv[0], ""))
    print_array(n, *x);
  free((void *)A);
  ;
  free((void *)b);
  ;
  free((void *)x);
  ;
  free((void *)y);
  ;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x7d0,-0x14(%rbp)
mov    $0x3d0900,%edi
mov    $0x8,%esi
call   1080 <polybench_alloc_data@plt>
mov    %rax,-0x20(%rbp)
mov    $0x7d0,%edi
mov    $0x8,%esi
call   1080 <polybench_alloc_data@plt>
mov    %rax,-0x28(%rbp)
mov    $0x7d0,%edi
mov    $0x8,%esi
call   1080 <polybench_alloc_data@plt>
mov    %rax,-0x30(%rbp)
mov    $0x7d0,%edi
mov    $0x8,%esi
call   1080 <polybench_alloc_data@plt>
mov    %rax,-0x38(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    -0x38(%rbp),%r8
call   1050 <init_array@plt>
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    -0x38(%rbp),%r8
call   1060 <kernel_ludcmp@plt>
cmpl   $0x2a,-0x8(%rbp)
jle    122b <main+0xcb>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xdef(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    122b <main+0xcb>
mov    -0x14(%rbp),%edi
mov    -0x30(%rbp),%rsi
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>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %edi,%r13d
mov    $0x3d0900,%edi
mov    $0x8,%esi
call   1070 <polybench_alloc_data@plt>
mov    %rax,%r14
mov    $0x7d0,%edi
mov    $0x8,%esi
call   1070 <polybench_alloc_data@plt>
mov    %rax,%r12
mov    $0x7d0,%edi
mov    $0x8,%esi
call   1070 <polybench_alloc_data@plt>
mov    %rax,%rbx
mov    $0x7d0,%edi
mov    $0x8,%esi
call   1070 <polybench_alloc_data@plt>
mov    %rax,%rbp
mov    $0x7d0,%edi
mov    %r14,%rsi
mov    %r12,%rdx
mov    %rbx,%rcx
mov    %rax,%r8
call   1050 <init_array@plt>
mov    $0x7d0,%edi
mov    %r14,%rsi
mov    %r12,%rdx
mov    %rbx,%rcx
mov    %rbp,%r8
call   1060 <kernel_ludcmp@plt>
cmp    $0x2b,%r13d
jl     11f0 <main+0xa0>
mov    (%r15),%rax
cmpb   $0x0,(%rax)
jne    11f0 <main+0xa0>
mov    $0x7d0,%edi
mov    %rbx,%rsi
call   1040 <print_array@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
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 [2000 x [2000 x double]]*
%8 = alloca [2000 x double]*
%9 = alloca [2000 x double]*
%10 = alloca [2000 x double]*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 2000, i32* %6
%11 = call i64 @polybench_alloc_data(i32 4000000, i32 8)
%12 = inttoptr i64 %11 to [2000 x [2000 x double]]*
store [2000 x [2000 x double]]* %12, [2000 x [2000 x double]]** %7
%13 = call i64 @polybench_alloc_data(i32 2000, i32 8)
%14 = inttoptr i64 %13 to [2000 x double]*
store [2000 x double]* %14, [2000 x double]** %8
%15 = call i64 @polybench_alloc_data(i32 2000, i32 8)
%16 = inttoptr i64 %15 to [2000 x double]*
store [2000 x double]* %16, [2000 x double]** %9
%17 = call i64 @polybench_alloc_data(i32 2000, i32 8)
%18 = inttoptr i64 %17 to [2000 x double]*
store [2000 x double]* %18, [2000 x double]** %10
%19 = load i32, i32* %6
%20 = load [2000 x [2000 x double]]*, [2000 x [2000 x double]]** %7
%21 = getelementptr inbounds [2000 x [2000 x double]], [2000 x [2000 x double]]* %20, i64 0, i64 0
%22 = bitcast [2000 x double]* %21 to double**
%23 = load [2000 x double]*, [2000 x double]** %8
%24 = getelementptr inbounds [2000 x double], [2000 x double]* %23, i64 0, i64 0
%25 = load [2000 x double]*, [2000 x double]** %9
%26 = getelementptr inbounds [2000 x double], [2000 x double]* %25, i64 0, i64 0
%27 = load [2000 x double]*, [2000 x double]** %10
%28 = getelementptr inbounds [2000 x double], [2000 x double]* %27, i64 0, i64 0
%29 = call i32 @init_array(i32 %19, double** %22, double* %24, double* %26, double* %28)
%30 = load i32, i32* %6
%31 = load [2000 x [2000 x double]]*, [2000 x [2000 x double]]** %7
%32 = getelementptr inbounds [2000 x [2000 x double]], [2000 x [2000 x double]]* %31, i64 0, i64 0
%33 = bitcast [2000 x double]* %32 to double**
%34 = load [2000 x double]*, [2000 x double]** %8
%35 = getelementptr inbounds [2000 x double], [2000 x double]* %34, i64 0, i64 0
%36 = load [2000 x double]*, [2000 x double]** %9
%37 = getelementptr inbounds [2000 x double], [2000 x double]* %36, i64 0, i64 0
%38 = load [2000 x double]*, [2000 x double]** %10
%39 = getelementptr inbounds [2000 x double], [2000 x double]* %38, i64 0, i64 0
%40 = call i32 @kernel_ludcmp(i32 %30, double** %33, double* %35, double* %37, double* %39)
%41 = load i32, i32* %4
%42 = icmp sgt i32 %41, 42
br i1 %42, label %43, label %54
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 %54, label %49
49: ; preds = %43
%50 = load i32, i32* %6
%51 = load [2000 x double]*, [2000 x double]** %9
%52 = getelementptr inbounds [2000 x double], [2000 x double]* %51, i64 0, i64 0
%53 = call i32 @print_array(i32 %50, double* %52)
br label %54
54: ; preds = %49, %43, %2
%55 = load [2000 x [2000 x double]]*, [2000 x [2000 x double]]** %7
%56 = bitcast [2000 x [2000 x double]]* %55 to i8*
%57 = call i32 @free(i8* %56)
%58 = load [2000 x double]*, [2000 x double]** %8
%59 = bitcast [2000 x double]* %58 to i8*
%60 = call i32 @free(i8* %59)
%61 = load [2000 x double]*, [2000 x double]** %9
%62 = bitcast [2000 x double]* %61 to i8*
%63 = call i32 @free(i8* %62)
%64 = load [2000 x double]*, [2000 x double]** %10
%65 = bitcast [2000 x double]* %64 to i8*
%66 = call i32 @free(i8* %65)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i64 @polybench_alloc_data(i32 4000000, i32 8)
%4 = tail call i64 @polybench_alloc_data(i32 2000, i32 8)
%5 = inttoptr i64 %4 to [2000 x double]*
%6 = tail call i64 @polybench_alloc_data(i32 2000, i32 8)
%7 = inttoptr i64 %6 to [2000 x double]*
%8 = tail call i64 @polybench_alloc_data(i32 2000, i32 8)
%9 = inttoptr i64 %8 to [2000 x double]*
%10 = inttoptr i64 %3 to double**
%11 = getelementptr inbounds [2000 x double], [2000 x double]* %5, i64 0, i64 0
%12 = getelementptr inbounds [2000 x double], [2000 x double]* %7, i64 0, i64 0
%13 = getelementptr inbounds [2000 x double], [2000 x double]* %9, i64 0, i64 0
%14 = tail call i32 @init_array(i32 2000, double** %10, double* %11, double* %12, double* %13)
%15 = tail call i32 @kernel_ludcmp(i32 2000, double** %10, double* %11, double* %12, double* %13)
%16 = icmp sgt i32 %0, 42
br i1 %16, label %17, label %23
17: ; preds = %2
%18 = load i8*, i8** %1
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %17
%22 = tail call i32 @print_array(i32 2000, double* %12)
br label %23
23: ; preds = %21, %17, %2
%24 = inttoptr i64 %3 to i8*
%25 = tail call i32 @free(i8* %24)
%26 = inttoptr i64 %4 to i8*
%27 = tail call i32 @free(i8* %26)
%28 = inttoptr i64 %6 to i8*
%29 = tail call i32 @free(i8* %28)
%30 = inttoptr i64 %8 to i8*
%31 = tail call i32 @free(i8* %30)
ret i32 0
}