#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 */
scalar_t__ atoi(char *);
int /*<<< orphan*/ cholesky(double *, int, double *);
int /*<<< orphan*/ free(double *);
scalar_t__ malloc(int);
int /*<<< orphan*/ read_data_double(char *, int, int, double *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ write_data_double(char *, int, int, double *);
int main(int argc, char *argv[]) {
  char input_file[512];
  char output_file1[512];
  int N;
  double *data;
  double *chol;
  strcpy(input_file, argv[1]);
  N = (int)atoi(argv[2]);
  strcpy(output_file1, argv[3]);
  data = (double *)malloc(N * N * sizeof(double));
  chol = (double *)malloc(N * N * sizeof(double));
  read_data_double(input_file, N, N, data);
  cholesky(data, N, chol);
  write_data_double(output_file1, N, N, chol);
  free(data);
  free(chol);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x210(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1040 <strcpy@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x414(%rbp)
lea    -0x410(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
call   1040 <strcpy@plt>
mov    -0x414(%rbp),%eax
imul   -0x414(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x420(%rbp)
mov    -0x414(%rbp),%eax
imul   -0x414(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x428(%rbp)
lea    -0x210(%rbp),%rdi
mov    -0x414(%rbp),%esi
mov    -0x414(%rbp),%edx
mov    -0x420(%rbp),%rcx
call   1050 <read_data_double@plt>
mov    -0x420(%rbp),%rdi
mov    -0x414(%rbp),%esi
mov    -0x428(%rbp),%rdx
call   1060 <cholesky@plt>
lea    -0x410(%rbp),%rdi
mov    -0x414(%rbp),%esi
mov    -0x414(%rbp),%edx
mov    -0x428(%rbp),%rcx
call   1080 <write_data_double@plt>
mov    -0x420(%rbp),%rdi
call   1030 <free@plt>
mov    -0x428(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x400,%rsp
mov    %rsi,%r15
mov    0x8(%rsi),%rsi
lea    0x200(%rsp),%r14
mov    %r14,%rdi
call   1040 <strcpy@plt>
mov    0x10(%r15),%rdi
call   1090 <atoi@plt>
mov    %rax,%rbx
mov    0x18(%r15),%rsi
mov    %rsp,%r15
mov    %r15,%rdi
call   1040 <strcpy@plt>
mov    %ebx,%ebp
imul   %ebx,%ebp
shl    $0x3,%ebp
mov    %ebp,%edi
call   1070 <malloc@plt>
mov    %rax,%r12
mov    %ebp,%edi
call   1070 <malloc@plt>
mov    %rax,%rbp
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebx,%edx
mov    %r12,%rcx
call   1050 <read_data_double@plt>
mov    %r12,%rdi
mov    %ebx,%esi
mov    %rbp,%rdx
call   1060 <cholesky@plt>
mov    %r15,%rdi
mov    %ebx,%esi
mov    %ebx,%edx
mov    %rbp,%rcx
call   1080 <write_data_double@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [512 x i8]
%7 = alloca [512 x i8]
%8 = alloca i32
%9 = alloca double*
%10 = alloca double*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @strcpy(i8* %11, i8* %14)
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 2
%18 = load i8*, i8** %17
%19 = call i64 @atoi(i8* %18)
%20 = trunc i64 %19 to i32
store i32 %20, i32* %8
%21 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 3
%24 = load i8*, i8** %23
%25 = call i32 @strcpy(i8* %21, i8* %24)
%26 = load i32, i32* %8
%27 = load i32, i32* %8
%28 = mul nsw i32 %26, %27
%29 = sext i32 %28 to i64
%30 = mul i64 %29, 8
%31 = trunc i64 %30 to i32
%32 = call i64 @malloc(i32 %31)
%33 = inttoptr i64 %32 to double*
store double* %33, double** %9
%34 = load i32, i32* %8
%35 = load i32, i32* %8
%36 = mul nsw i32 %34, %35
%37 = sext i32 %36 to i64
%38 = mul i64 %37, 8
%39 = trunc i64 %38 to i32
%40 = call i64 @malloc(i32 %39)
%41 = inttoptr i64 %40 to double*
store double* %41, double** %10
%42 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%43 = load i32, i32* %8
%44 = load i32, i32* %8
%45 = load double*, double** %9
%46 = call i32 @read_data_double(i8* %42, i32 %43, i32 %44, double* %45)
%47 = load double*, double** %9
%48 = load i32, i32* %8
%49 = load double*, double** %10
%50 = call i32 @cholesky(double* %47, i32 %48, double* %49)
%51 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%52 = load i32, i32* %8
%53 = load i32, i32* %8
%54 = load double*, double** %10
%55 = call i32 @write_data_double(i8* %51, i32 %52, i32 %53, double* %54)
%56 = load double*, double** %9
%57 = call i32 @free(double* %56)
%58 = load double*, double** %10
%59 = call i32 @free(double* %58)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [512 x i8]
%4 = alloca [512 x i8]
%5 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = call i32 @strcpy(i8* %5, i8* %8)
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = load i8*, i8** %10
%12 = call i64 @atoi(i8* %11)
%13 = trunc i64 %12 to i32
%14 = getelementptr inbounds i8*, i8** %1, i64 3
%15 = load i8*, i8** %14
%16 = call i32 @strcpy(i8* %6, i8* %15)
%17 = mul i64 %12, %12
%18 = trunc i64 %17 to i32
%19 = shl i32 %18, 3
%20 = call i64 @malloc(i32 %19)
%21 = inttoptr i64 %20 to double*
%22 = call i64 @malloc(i32 %19)
%23 = inttoptr i64 %22 to double*
%24 = call i32 @read_data_double(i8* %5, i32 %13, i32 %13, double* %21)
%25 = call i32 @cholesky(double* %21, i32 %13, double* %23)
%26 = call i32 @write_data_double(i8* %6, i32 %13, i32 %13, double* %23)
%27 = call i32 @free(double* %21)
%28 = call i32 @free(double* %23)
ret i32 0
}