#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*/ chold(double *, int);
int /*<<< orphan*/ free(double *);
scalar_t__ malloc(int);
int /*<<< orphan*/ mdisplay(double *, int, int);
int main(int argc, char **argv) {
  int N, i, M, success;
  double *B, *C;
  N = 3;
  B = (double *)malloc(sizeof(double) * N * N);
  C = (double *)malloc(sizeof(double) * N * N);
  double A[9] = {10, 20, 30, 20, 45, 80, 30, 80, 171};
  mdisplay(A, N, N);
  chold(A, N);
  mdisplay(A, N, N);
  free(B);
  free(C);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x3,-0x14(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
movslq -0x14(%rbp),%rcx
imul   %rcx,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x28(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
movslq -0x14(%rbp),%rcx
imul   %rcx,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x30(%rbp)
lea    -0x80(%rbp),%rdi
lea    0xe4f(%rip),%rsi
mov    $0x48,%edx
call   1060 <memcpy@plt>
lea    -0x80(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1040 <mdisplay@plt>
lea    -0x80(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1050 <chold@plt>
lea    -0x80(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1040 <mdisplay@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x50,%rsp
mov    $0x48,%edi
call   1060 <malloc@plt>
mov    %rax,%r14
mov    $0x48,%edi
call   1060 <malloc@plt>
mov    %rax,%r15
mov    0xed6(%rip),%rax
mov    %rax,0x40(%rsp)
movaps 0xeba(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xe9e(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xe82(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe66(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x3,%edx
call   1040 <mdisplay@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1050 <chold@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x3,%edx
call   1040 <mdisplay@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.A = [9 x double] [double 1.000000e+01, double 2.000000e+01, double 3.000000e+01, double 2.000000e+01, double 4.500000e+01, double 8.000000e+01, double 3.000000e+01, double 8.000000e+01, double 1.710000e+02]
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca double*
%11 = alloca double*
%12 = alloca [9 x double]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 3, i32* %6
%13 = load i32, i32* %6
%14 = sext i32 %13 to i64
%15 = mul i64 8, %14
%16 = load i32, i32* %6
%17 = sext i32 %16 to i64
%18 = mul i64 %15, %17
%19 = trunc i64 %18 to i32
%20 = call i64 @malloc(i32 %19)
%21 = inttoptr i64 %20 to double*
store double* %21, double** %10
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = mul i64 8, %23
%25 = load i32, i32* %6
%26 = sext i32 %25 to i64
%27 = mul i64 %24, %26
%28 = trunc i64 %27 to i32
%29 = call i64 @malloc(i32 %28)
%30 = inttoptr i64 %29 to double*
store double* %30, double** %11
%31 = bitcast [9 x double]* %12 to i8*
%32 = getelementptr inbounds [9 x double], [9 x double]* %12, i64 0, i64 0
%33 = load i32, i32* %6
%34 = load i32, i32* %6
%35 = call i32 @mdisplay(double* %32, i32 %33, i32 %34)
%36 = getelementptr inbounds [9 x double], [9 x double]* %12, i64 0, i64 0
%37 = load i32, i32* %6
%38 = call i32 @chold(double* %36, i32 %37)
%39 = getelementptr inbounds [9 x double], [9 x double]* %12, i64 0, i64 0
%40 = load i32, i32* %6
%41 = load i32, i32* %6
%42 = call i32 @mdisplay(double* %39, i32 %40, i32 %41)
%43 = load double*, double** %10
%44 = call i32 @free(double* %43)
%45 = load double*, double** %11
%46 = call i32 @free(double* %45)
ret i32 0
}

LLVM IR (-O2):
@__const.main.A = [9 x double] [double 1.000000e+01, double 2.000000e+01, double 3.000000e+01, double 2.000000e+01, double 4.500000e+01, double 8.000000e+01, double 3.000000e+01, double 8.000000e+01, double 1.710000e+02]
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [9 x double]
%4 = tail call i64 @malloc(i32 72)
%5 = inttoptr i64 %4 to double*
%6 = tail call i64 @malloc(i32 72)
%7 = inttoptr i64 %6 to double*
%8 = bitcast [9 x double]* %3 to i8*
%9 = getelementptr inbounds [9 x double], [9 x double]* %3, i64 0, i64 0
%10 = call i32 @mdisplay(double* %9, i32 3, i32 3)
%11 = call i32 @chold(double* %9, i32 3)
%12 = call i32 @mdisplay(double* %9, i32 3, i32 3)
%13 = call i32 @free(double* %5)
%14 = call i32 @free(double* %7)
ret i32 0
}