#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*/ choldc(float **, int, float *);
int /*<<< orphan*/ input_matrix(float **, int, int, int, int);
float **make_ans(float **, int, int, int, int, float *);
float **matrix(int, int, int, int);
int /*<<< orphan*/ output_matrix(float **, int, int, int, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
float *vector(int, int);
int main(void) {
  int n;
  printf("Please input matrix's size:");
  scanf("%d", &n);
  float **m = matrix(1, n, 1, n);
  float *p = vector(1, n);
  input_matrix(m, 1, n, 1, n);
  choldc(m, n, p);
  float **ans = make_ans(m, 1, n, 1, n, p);
  printf("Cholesky factorization answer is: \n");
  output_matrix(ans, 1, n, 1, n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe6a(%rip),%rdi
call   1060 <printf@plt>
lea    0xe7a(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   10a0 <scanf@plt>
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%ecx
mov    $0x1,%edx
mov    %edx,%edi
call   1070 <matrix@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%esi
mov    $0x1,%edi
call   1080 <vector@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%edx
mov    -0x8(%rbp),%r8d
mov    $0x1,%ecx
mov    %ecx,%esi
call   1090 <input_matrix@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1030 <choldc@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%edx
mov    -0x8(%rbp),%r8d
mov    -0x18(%rbp),%r9
mov    $0x1,%ecx
mov    %ecx,%esi
call   1040 <make_ans@plt>
mov    %rax,-0x20(%rbp)
lea    0xe00(%rip),%rdi
call   1060 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%edx
mov    -0x8(%rbp),%r8d
mov    $0x1,%ecx
mov    %ecx,%esi
call   1050 <output_matrix@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xe65(%rip),%rdi
call   1070 <printf@plt>
lea    0xe75(%rip),%rdi
lea    0x4(%rsp),%rsi
call   10b0 <scanf@plt>
mov    0x4(%rsp),%ecx
mov    $0x1,%edi
mov    %ecx,%esi
mov    $0x1,%edx
call   1080 <matrix@plt>
mov    %rax,%rbx
mov    0x4(%rsp),%esi
mov    $0x1,%edi
call   1090 <vector@plt>
mov    %rax,%r14
mov    0x4(%rsp),%edx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1,%ecx
mov    %edx,%r8d
call   10a0 <input_matrix@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
mov    %r14,%rdx
call   1030 <choldc@plt>
mov    0x4(%rsp),%edx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1,%ecx
mov    %edx,%r8d
mov    %r14,%r9
call   1050 <make_ans@plt>
mov    %rax,%rbx
lea    0xdf7(%rip),%rdi
call   1040 <puts@plt>
mov    0x4(%rsp),%edx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1,%ecx
mov    %edx,%r8d
call   1060 <output_matrix@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [28 x i8] c"Please input matrix's size:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [36 x i8] c"Cholesky factorization answer is: \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float**
%4 = alloca float*
%5 = alloca float**
store i32 0, i32* %1
%6 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%8 = load i32, i32* %2
%9 = load i32, i32* %2
%10 = call float** @matrix(i32 1, i32 %8, i32 1, i32 %9)
store float** %10, float*** %3
%11 = load i32, i32* %2
%12 = call float* @vector(i32 1, i32 %11)
store float* %12, float** %4
%13 = load float**, float*** %3
%14 = load i32, i32* %2
%15 = load i32, i32* %2
%16 = call i32 @input_matrix(float** %13, i32 1, i32 %14, i32 1, i32 %15)
%17 = load float**, float*** %3
%18 = load i32, i32* %2
%19 = load float*, float** %4
%20 = call i32 @choldc(float** %17, i32 %18, float* %19)
%21 = load float**, float*** %3
%22 = load i32, i32* %2
%23 = load i32, i32* %2
%24 = load float*, float** %4
%25 = call float** @make_ans(float** %21, i32 1, i32 %22, i32 1, i32 %23, float* %24)
store float** %25, float*** %5
%26 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0))
%27 = load float**, float*** %5
%28 = load i32, i32* %2
%29 = load i32, i32* %2
%30 = call i32 @output_matrix(float** %27, i32 1, i32 %28, i32 1, i32 %29)
ret i32 0
}

LLVM IR (-O2):
@.str = [28 x i8] c"Please input matrix's size:\00"
@.str.1 = [3 x i8] c"%d\00"
@str = [35 x i8] c"Cholesky factorization answer is: \00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call float** @matrix(i32 1, i32 %5, i32 1, i32 %5)
%7 = load i32, i32* %1
%8 = call float* @vector(i32 1, i32 %7)
%9 = load i32, i32* %1
%10 = call i32 @input_matrix(float** %6, i32 1, i32 %9, i32 1, i32 %9)
%11 = load i32, i32* %1
%12 = call i32 @choldc(float** %6, i32 %11, float* %8)
%13 = load i32, i32* %1
%14 = call float** @make_ans(float** %6, i32 1, i32 %13, i32 1, i32 %13, float* %8)
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
%16 = load i32, i32* %1
%17 = call i32 @output_matrix(float** %14, i32 1, i32 %16, i32 1, i32 %16)
ret i32 0
}