int main() {
  static int n, i, j;
  static double **a, Emin;
  n = 2000;
  a = (double **)malloc(sizeof(double *) * (n + 1));
  for (i = 0; i < (n + 1); i++) {
    a[i] = (double *)malloc(sizeof(double) * (n + 1));
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) {
      a[i][j] = rnd(1.0);
      a[j][i] = a[i][j];
    }
  }
  Emin = find_Emin(n, a);
  printf("Emin=%18.15f\n", Emin);
  for (i = 0; i < (n + 1); i++) {
    free(a[i]);
  }
  free(a);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x7d0,0x2ee7(%rip)
mov    0x2ee1(%rip),%eax
add    $0x1,%eax
movslq %eax,%rdi
shl    $0x3,%rdi
call   1060 <malloc@plt>
mov    %rax,0x2edb(%rip)
movl   $0x0,0x2ec5(%rip)
mov    0x2ebf(%rip),%eax
mov    0x2eb5(%rip),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    11e4 <main+0x94>
mov    0x2ea4(%rip),%eax
add    $0x1,%eax
movslq %eax,%rdi
shl    $0x3,%rdi
call   1060 <malloc@plt>
mov    %rax,%rdx
mov    0x2e9b(%rip),%rax
movslq 0x2e88(%rip),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    0x2e7e(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2e75(%rip)
jmp    118f <main+0x3f>
movl   $0x1,0x2e66(%rip)
mov    0x2e60(%rip),%eax
cmp    0x2e56(%rip),%eax
jg     12b6 <main+0x166>
movl   $0x1,0x2e4e(%rip)
mov    0x2e48(%rip),%eax
cmp    0x2e3a(%rip),%eax
jg     129d <main+0x14d>
movsd  0xddc(%rip),%xmm0
mov    $0x1,%al
call   1050 <rnd@plt>
cvtsi2sd %eax,%xmm0
mov    0x2e2a(%rip),%rax
movslq 0x2e17(%rip),%rcx
mov    (%rax,%rcx,8),%rax
movslq 0x2e10(%rip),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    0x2e0c(%rip),%rax
movslq 0x2df9(%rip),%rcx
mov    (%rax,%rcx,8),%rax
movslq 0x2df2(%rip),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x2dee(%rip),%rax
movslq 0x2ddf(%rip),%rcx
mov    (%rax,%rcx,8),%rax
movslq 0x2dd0(%rip),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    0x2dc9(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2dc0(%rip)
jmp    120a <main+0xba>
jmp    12a2 <main+0x152>
mov    0x2dac(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2da3(%rip)
jmp    11ee <main+0x9e>
mov    0x2d94(%rip),%edi
mov    0x2d9d(%rip),%rsi
mov    $0x0,%al
call   1070 <find_Emin@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x2d92(%rip)
movsd  0x2d8a(%rip),%xmm0
lea    0xd23(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movl   $0x0,0x2d5e(%rip)
mov    0x2d58(%rip),%eax
mov    0x2d4e(%rip),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    1338 <main+0x1e8>
mov    0x2d4c(%rip),%rax
movslq 0x2d39(%rip),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    0x2d2a(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2d21(%rip)
jmp    12f6 <main+0x1a6>
mov    0x2d21(%rip),%rdi
call   1030 <free@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
movb   $0x1,0x2ef5(%rip)
mov    $0x3e88,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    %rax,0x2ef1(%rip)
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x3e88,%edi
call   1060 <malloc@plt>
mov    %rax,(%rbx,%rbp,8)
add    $0x1,%rbp
cmp    $0x7d1,%rbp
jne    1180 <main+0x30>
movl   $0x1,0x2eaf(%rip)
mov    $0x1,%eax
mov    $0x1,%cl
mov    $0x7d0,%ebp
jmp    11d7 <main+0x87>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0x1(%rax),%edx
mov    %edx,0x2e8b(%rip)
xor    %ecx,%ecx
xor    %edi,%edi
cmp    %edi,%eax
mov    %edx,%eax
jge    1263 <main+0x113>
movl   $0x1,0x2e77(%rip)
test   $0x1,%cl
je     11c0 <main+0x70>
cs nopw 0x0(%rax,%rax,1)
movsd  0xe08(%rip),%xmm0
mov    $0x1,%al
call   1050 <rnd@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mov    0x2e53(%rip),%rbx
movslq 0x2e40(%rip),%rax
mov    (%rbx,%rax,8),%rcx
movslq 0x2e39(%rip),%rdx
movsd  %xmm0,(%rcx,%rdx,8)
mov    (%rbx,%rdx,8),%rcx
movsd  %xmm0,(%rcx,%rax,8)
lea    0x1(%rdx),%ecx
mov    %ecx,0x2e22(%rip)
movzbl 0x2e13(%rip),%ecx
test   %cl,%cl
mov    $0x0,%esi
cmovne %ebp,%esi
cmp    %esi,%edx
jl     11f0 <main+0xa0>
lea    0x1(%rax),%edx
mov    %edx,0x2e00(%rip)
test   %cl,%cl
mov    $0x0,%edi
cmovne %ebp,%edi
jmp    11cd <main+0x7d>
xor    %ebp,%ebp
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <find_Emin@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
lea    0xd8b(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
cmpb   $0x0,0x2dc5(%rip)
mov    $0x7d1,%eax
mov    $0x1,%ebx
cmovne %eax,%ebx
mov    0x2dc1(%rip),%r14
nop
mov    (%r14,%rbp,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    12a0 <main+0x150>
mov    %ebx,0x2d9c(%rip)
mov    %r14,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@main.n = internal global i32 0
@main.i = internal global i32 0
@main.j = internal global i32 0
@main.a = internal global double** null
@main.Emin = internal global double 0.000000e+00
@.str = [14 x i8] c"Emin=%18.15f\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
store i32 2000, i32* @main.n
%2 = load i32, i32* @main.n
%3 = add nsw i32 %2, 1
%4 = sext i32 %3 to i64
%5 = mul i64 8, %4
%6 = call i8* @malloc(i64 %5)
%7 = bitcast i8* %6 to double**
store double** %7, double*** @main.a
store i32 0, i32* @main.i
br label %8
8: ; preds = %24, %0
%9 = load i32, i32* @main.i
%10 = load i32, i32* @main.n
%11 = add nsw i32 %10, 1
%12 = icmp slt i32 %9, %11
br i1 %12, label %13, label %27
13: ; preds = %8
%14 = load i32, i32* @main.n
%15 = add nsw i32 %14, 1
%16 = sext i32 %15 to i64
%17 = mul i64 8, %16
%18 = call i8* @malloc(i64 %17)
%19 = bitcast i8* %18 to double*
%20 = load double**, double*** @main.a
%21 = load i32, i32* @main.i
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds double*, double** %20, i64 %22
store double* %19, double** %23
br label %24
24: ; preds = %13
%25 = load i32, i32* @main.i
%26 = add nsw i32 %25, 1
store i32 %26, i32* @main.i
br label %8
27: ; preds = %8
store i32 1, i32* @main.i
br label %28
28: ; preds = %69, %27
%29 = load i32, i32* @main.i
%30 = load i32, i32* @main.n
%31 = icmp sle i32 %29, %30
br i1 %31, label %32, label %72
32: ; preds = %28
store i32 1, i32* @main.j
br label %33
33: ; preds = %65, %32
%34 = load i32, i32* @main.j
%35 = load i32, i32* @main.n
%36 = icmp sle i32 %34, %35
br i1 %36, label %37, label %68
37: ; preds = %33
%38 = call i32 (double, ...) bitcast (i32 (...)* @rnd to i32 (double, ...)*)(double 1.000000e+00)
%39 = sitofp i32 %38 to double
%40 = load double**, double*** @main.a
%41 = load i32, i32* @main.i
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds double*, double** %40, i64 %42
%44 = load double*, double** %43
%45 = load i32, i32* @main.j
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds double, double* %44, i64 %46
store double %39, double* %47
%48 = load double**, double*** @main.a
%49 = load i32, i32* @main.i
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds double*, double** %48, i64 %50
%52 = load double*, double** %51
%53 = load i32, i32* @main.j
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds double, double* %52, i64 %54
%56 = load double, double* %55
%57 = load double**, double*** @main.a
%58 = load i32, i32* @main.j
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds double*, double** %57, i64 %59
%61 = load double*, double** %60
%62 = load i32, i32* @main.i
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds double, double* %61, i64 %63
store double %56, double* %64
br label %65
65: ; preds = %37
%66 = load i32, i32* @main.j
%67 = add nsw i32 %66, 1
store i32 %67, i32* @main.j
br label %33
68: ; preds = %33
br label %69
69: ; preds = %68
%70 = load i32, i32* @main.i
%71 = add nsw i32 %70, 1
store i32 %71, i32* @main.i
br label %28
72: ; preds = %28
%73 = load i32, i32* @main.n
%74 = load double**, double*** @main.a
%75 = call i32 (i32, double**, ...) bitcast (i32 (...)* @find_Emin to i32 (i32, double**, ...)*)(i32 %73, double** %74)
%76 = sitofp i32 %75 to double
store double %76, double* @main.Emin
%77 = load double, double* @main.Emin
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), double %77)
store i32 0, i32* @main.i
br label %79
79: ; preds = %91, %72
%80 = load i32, i32* @main.i
%81 = load i32, i32* @main.n
%82 = add nsw i32 %81, 1
%83 = icmp slt i32 %80, %82
br i1 %83, label %84, label %94
84: ; preds = %79
%85 = load double**, double*** @main.a
%86 = load i32, i32* @main.i
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds double*, double** %85, i64 %87
%89 = load double*, double** %88
%90 = bitcast double* %89 to i8*
br label %91
91: ; preds = %84
%92 = load i32, i32* @main.i
%93 = add nsw i32 %92, 1
store i32 %93, i32* @main.i
br label %79
94: ; preds = %79
%95 = load double**, double*** @main.a
%96 = bitcast double** %95 to i8*
%97 = load i32, i32* %1
ret i32 %97
}

LLVM IR (-O2):
@main.n = internal unnamed_addr global i1 false
@main.i = internal unnamed_addr global i32 0
@main.j = internal unnamed_addr global i32 0
@main.a = internal unnamed_addr global double** null
@.str = [14 x i8] c"Emin=%18.15f\0A\00"
define i32 @main() {
store i1 true, i1* @main.n
%1 = tail call dereferenceable_or_null(16008) i8* @malloc(i64 16008)
store i8* %1, i8** bitcast (double*** @main.a to i8**)
%2 = bitcast i8* %1 to double**
br label %4
3: ; preds = %4
store i32 1, i32* @main.i
br label %11
4: ; preds = %0, %4
%5 = phi i64 [ 0, %0 ], [ %9, %4 ]
%6 = tail call dereferenceable_or_null(16008) i8* @malloc(i64 16008)
%7 = getelementptr inbounds double*, double** %2, i64 %5
%8 = bitcast double** %7 to i8**
store i8* %6, i8** %8
%9 = add nuw nsw i64 %5, 1
%10 = icmp eq i64 %9, 2001
br i1 %10, label %3, label %4
11: ; preds = %3, %38
%12 = phi double** [ %2, %3 ], [ %42, %38 ]
%13 = phi i1 [ true, %3 ], [ %41, %38 ]
%14 = phi i32 [ 1, %3 ], [ %39, %38 ]
store i32 1, i32* @main.j
br i1 %13, label %17, label %15
15: ; preds = %11
%16 = add nsw i32 %14, 1
store i32 %16, i32* @main.i
br label %38
17: ; preds = %11, %17
%18 = tail call i32 (double, ...) bitcast (i32 (...)* @rnd to i32 (double, ...)*)(double 1.000000e+00)
%19 = sitofp i32 %18 to double
%20 = load double**, double*** @main.a
%21 = load i32, i32* @main.i
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds double*, double** %20, i64 %22
%24 = load double*, double** %23
%25 = load i32, i32* @main.j
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds double, double* %24, i64 %26
store double %19, double* %27
%28 = getelementptr inbounds double*, double** %20, i64 %26
%29 = load double*, double** %28
%30 = getelementptr inbounds double, double* %29, i64 %22
store double %19, double* %30
%31 = add nsw i32 %25, 1
store i32 %31, i32* @main.j
%32 = load i1, i1* @main.n
%33 = select i1 %32, i32 2000, i32 0
%34 = icmp slt i32 %25, %33
br i1 %34, label %17, label %35
35: ; preds = %17
%36 = add nsw i32 %21, 1
store i32 %36, i32* @main.i
%37 = select i1 %32, i32 2000, i32 0
br label %38
38: ; preds = %35, %15
%39 = phi i32 [ %16, %15 ], [ %36, %35 ]
%40 = phi i32 [ %14, %15 ], [ %21, %35 ]
%41 = phi i1 [ false, %15 ], [ %32, %35 ]
%42 = phi double** [ %12, %15 ], [ %20, %35 ]
%43 = phi i32 [ 0, %15 ], [ %37, %35 ]
%44 = icmp slt i32 %40, %43
br i1 %44, label %11, label %45
45: ; preds = %38
%46 = tail call i32 (i32, double**, ...) bitcast (i32 (...)* @find_Emin to i32 (i32, double**, ...)*)(i32 %43, double** %42)
%47 = sitofp i32 %46 to double
%48 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), double %47)
%49 = load i1, i1* @main.n
%50 = select i1 %49, i32 2001, i32 1
%51 = load double**, double*** @main.a
%52 = zext i32 %50 to i64
br label %53
53: ; preds = %45, %53
%54 = phi i64 [ 0, %45 ], [ %58, %53 ]
%55 = getelementptr inbounds double*, double** %51, i64 %54
%56 = bitcast double** %55 to i8**
%57 = load i8*, i8** %56
tail call void @free(i8* %57)
%58 = add nuw nsw i64 %54, 1
%59 = icmp eq i64 %58, %52
br i1 %59, label %60, label %53
60: ; preds = %53
%61 = bitcast double** %51 to i8*
store i32 %50, i32* @main.i
tail call void @free(i8* %61)
ret i32 0
}