int main() {
  int size;
  int **matrix;
  puts("");
  puts("[-]Calcul of determinant :");
  printf("Enter the size of the matrix: ");
  scanf("%5d", &size);
  matrix = malloc_mat(size, size);
  for (int i = 0; i < size; i++) {
    for (int j = 0; j < size; j++) {
      printf("a(%d,%d)=", i + 1, j + 1);
      scanf("%5d", &matrix[i][j]);
    }
  }
  puts("");
  print_mat(matrix, size);
  puts("");
  puts("    (It can take a while)");
  puts("");
  printf("\tA=%d\n\n", det(matrix, size));
  for (int i; i < size; i++)
    free(matrix[i]);
  free(matrix);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xee3(%rip),%rdi
mov    $0x0,%al
call   1040 <puts@plt>
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1040 <puts@plt>
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xe8a(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1080 <scanf@plt>
mov    -0x8(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    $0x0,%al
call   1050 <malloc_mat@plt>
cltq
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1254 <main+0xe4>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1241 <main+0xd1>
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x18(%rbp),%edx
add    $0x1,%edx
lea    0xe37(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
movslq -0x18(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1080 <scanf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11e8 <main+0x78>
jmp    1246 <main+0xd6>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11d5 <main+0x65>
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1040 <puts@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%esi
mov    $0x0,%al
call   1070 <print_mat@plt>
lea    0xdf2(%rip),%rdi
mov    $0x0,%al
call   1040 <puts@plt>
lea    0xdc3(%rip),%rdi
mov    $0x0,%al
call   1040 <puts@plt>
lea    0xdd6(%rip),%rdi
mov    $0x0,%al
call   1040 <puts@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%esi
mov    $0x0,%al
call   1090 <det@plt>
mov    %eax,%esi
lea    0xdb1(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12e3 <main+0x173>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    12b8 <main+0x148>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xee4(%rip),%rdi
xor    %eax,%eax
call   1040 <puts@plt>
lea    0xe6d(%rip),%rdi
xor    %eax,%eax
call   1040 <puts@plt>
lea    0xe7a(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe8b(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1080 <scanf@plt>
mov    0xc(%rsp),%edi
mov    %edi,%esi
xor    %eax,%eax
call   1050 <malloc_mat@plt>
movslq %eax,%rbx
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    124d <main+0xdd>
lea    0xe64(%rip),%r15
lea    0xe59(%rip),%r12
xor    %r13d,%r13d
mov    %rbx,0x10(%rsp)
jmp    11fb <main+0x8b>
nopl   0x0(%rax,%rax,1)
movslq %eax,%rcx
mov    %rbp,%r13
cmp    %rcx,%rbp
jge    124d <main+0xdd>
lea    0x1(%r13),%rbp
test   %eax,%eax
jle    11f0 <main+0x80>
xor    %r14d,%r14d
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
mov    %r15,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x10(%rsp),%rax
mov    (%rax,%r13,8),%rsi
add    %r14,%rsi
mov    %r12,%rdi
xor    %eax,%eax
call   1080 <scanf@plt>
movslq 0xc(%rsp),%rax
add    $0x4,%r14
cmp    %rax,%rbx
jl     1210 <main+0xa0>
mov    0x10(%rsp),%rbx
jmp    11f0 <main+0x80>
lea    0xe15(%rip),%rbp
mov    %rbp,%rdi
xor    %eax,%eax
call   1040 <puts@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <print_mat@plt>
mov    %rbp,%rdi
xor    %eax,%eax
call   1040 <puts@plt>
lea    0xdcb(%rip),%rdi
xor    %eax,%eax
call   1040 <puts@plt>
mov    %rbp,%rdi
xor    %eax,%eax
call   1040 <puts@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1090 <det@plt>
lea    0xdbf(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [27 x i8] c"[-]Calcul of determinant :\00"
@.str.2 = [31 x i8] c"Enter the size of the matrix: \00"
@.str.3 = [4 x i8] c"%5d\00"
@.str.4 = [10 x i8] c"a(%d,%d)=\00"
@.str.5 = [26 x i8] c" (It can take a while)\00"
@.str.6 = [8 x i8] c"\09A=%d\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32**
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%11 = load i32, i32* %2
%12 = load i32, i32* %2
%13 = call i32 (i32, i32, ...) bitcast (i32 (...)* @malloc_mat to i32 (i32, i32, ...)*)(i32 %11, i32 %12)
%14 = sext i32 %13 to i64
%15 = inttoptr i64 %14 to i32**
store i32** %15, i32*** %3
store i32 0, i32* %4
br label %16
16: ; preds = %44, %0
%17 = load i32, i32* %4
%18 = load i32, i32* %2
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %47
20: ; preds = %16
store i32 0, i32* %5
br label %21
21: ; preds = %40, %20
%22 = load i32, i32* %5
%23 = load i32, i32* %2
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %43
25: ; preds = %21
%26 = load i32, i32* %4
%27 = add nsw i32 %26, 1
%28 = load i32, i32* %5
%29 = add nsw i32 %28, 1
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 %27, i32 %29)
%31 = load i32**, i32*** %3
%32 = load i32, i32* %4
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i32*, i32** %31, i64 %33
%35 = load i32*, i32** %34
%36 = load i32, i32* %5
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i32, i32* %35, i64 %37
%39 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32* %38)
br label %40
40: ; preds = %25
%41 = load i32, i32* %5
%42 = add nsw i32 %41, 1
store i32 %42, i32* %5
br label %21
43: ; preds = %21
br label %44
44: ; preds = %43
%45 = load i32, i32* %4
%46 = add nsw i32 %45, 1
store i32 %46, i32* %4
br label %16
47: ; preds = %16
%48 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%49 = load i32**, i32*** %3
%50 = load i32, i32* %2
%51 = call i32 (i32**, i32, ...) bitcast (i32 (...)* @print_mat to i32 (i32**, i32, ...)*)(i32** %49, i32 %50)
%52 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%53 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0))
%54 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%55 = load i32**, i32*** %3
%56 = load i32, i32* %2
%57 = call i32 (i32**, i32, ...) bitcast (i32 (...)* @det to i32 (i32**, i32, ...)*)(i32** %55, i32 %56)
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i32 %57)
br label %59
59: ; preds = %70, %47
%60 = load i32, i32* %6
%61 = load i32, i32* %2
%62 = icmp slt i32 %60, %61
br i1 %62, label %63, label %73
63: ; preds = %59
%64 = load i32**, i32*** %3
%65 = load i32, i32* %6
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds i32*, i32** %64, i64 %66
%68 = load i32*, i32** %67
%69 = bitcast i32* %68 to i8*
br label %70
70: ; preds = %63
%71 = load i32, i32* %6
%72 = add nsw i32 %71, 1
store i32 %72, i32* %6
br label %59
73: ; preds = %59
%74 = load i32**, i32*** %3
%75 = bitcast i32** %74 to i8*
ret i32 0
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [27 x i8] c"[-]Calcul of determinant :\00"
@.str.2 = [31 x i8] c"Enter the size of the matrix: \00"
@.str.3 = [4 x i8] c"%5d\00"
@.str.4 = [10 x i8] c"a(%d,%d)=\00"
@.str.5 = [26 x i8] c" (It can take a while)\00"
@.str.6 = [8 x i8] c"\09A=%d\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
%8 = call i32 (i32, i32, ...) bitcast (i32 (...)* @malloc_mat to i32 (i32, i32, ...)*)(i32 %7, i32 %7)
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i32**
%11 = load i32, i32* %1
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %21
13: ; preds = %0, %32
%14 = phi i32 [ %33, %32 ], [ %11, %0 ]
%15 = phi i64 [ %17, %32 ], [ 0, %0 ]
%16 = icmp sgt i32 %14, 0
%17 = add nuw nsw i64 %15, 1
br i1 %16, label %18, label %32
18: ; preds = %13
%19 = getelementptr inbounds i32*, i32** %10, i64 %15
%20 = trunc i64 %17 to i32
br label %36
21: ; preds = %32, %0
%22 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%23 = load i32, i32* %1
%24 = call i32 (i32**, i32, ...) bitcast (i32 (...)* @print_mat to i32 (i32**, i32, ...)*)(i32** %10, i32 %23)
%25 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%26 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0))
%27 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%28 = load i32, i32* %1
%29 = call i32 (i32**, i32, ...) bitcast (i32 (...)* @det to i32 (i32**, i32, ...)*)(i32** %10, i32 %28)
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i32 %29)
%31 = inttoptr i64 %9 to i8*
ret i32 0
32: ; preds = %36, %13
%33 = phi i32 [ %14, %13 ], [ %44, %36 ]
%34 = sext i32 %33 to i64
%35 = icmp slt i64 %17, %34
br i1 %35, label %13, label %21
36: ; preds = %18, %36
%37 = phi i64 [ 0, %18 ], [ %38, %36 ]
%38 = add nuw nsw i64 %37, 1
%39 = trunc i64 %38 to i32
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 %20, i32 %39)
%41 = load i32*, i32** %19
%42 = getelementptr inbounds i32, i32* %41, i64 %37
%43 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32* %42)
%44 = load i32, i32* %1
%45 = sext i32 %44 to i64
%46 = icmp slt i64 %38, %45
br i1 %46, label %36, label %32
}