#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*/ EXIT_FAILURE;
int atoi(char *);
int /*<<< orphan*/ dgemv_(char *, int *, int *, double *, double *, int *,
                          double *, int *, double *, double *, int *);
int /*<<< orphan*/ dgesv_(int *, int *, double *, int *, int *, double *, int *,
                          int *);
double **dmatrix(int, int);
double *dvector(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int *ivector(int);
int /*<<< orphan*/ print_timing(char *, double *, int, double, int);
int /*<<< orphan*/ printf(char *, ...);
double randf();
double sqrt(double);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
double stoptime();
int main(int argc, char **argv) {
  int n;
  int lda;
  int ldb;
  int nrhs = 1;
  double **A;
  double *b;
  double *x;
  int *ipiv;
  int info;
  char trans = 'N';
  double alpha = 1.0;
  double beta = 0.0;
  int incx = 1, incy = 1;
  int i, j;
  double norm = 0.0;
  double t[5];
  int csvout;
  t[4] = stoptime();
  if (argc < 2) {
    printf("usage: %s <order of matrix> [csvout]\n", argv[0]);
    exit(EXIT_FAILURE);
  }
  if (argc == 2) {
    csvout = 0;
  } else {
    csvout = 1;
  }
  n = atoi(argv[1]);
  if (n <= 0)
    n = 1;
  lda = n;
  ldb = n;
  t[0] = stoptime();
  A = dmatrix(n, n);
  b = dvector(n);
  x = dvector(n);
  ipiv = ivector(n);
  t[0] = stoptime() - t[0];
  t[1] = stoptime();
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      A[j][i] = randf();
    }
    x[i] = randf();
  }
  t[1] = stoptime() - t[1];
  t[2] = stoptime();
  dgemv_(&trans, &n, &n, &alpha, &A[0][0], &lda, &x[0], &incx, &beta, &b[0],
         &incy);
  t[2] = stoptime() - t[2];
  if (!csvout) {
    printf("solving ... ");
    fflush(stdout);
  }
  t[3] = stoptime();
  dgesv_(&n, &nrhs, &A[0][0], &lda, &ipiv[0], &b[0], &ldb, &info);
  t[3] = stoptime() - t[3];
  if (!csvout) {
    printf("finished\n");
    fflush(stdout);
  }
  if (info == 0) {
    norm = 0.0;
    for (i = 0; i < n; i++) {
      norm += (x[i] - b[i]) * (x[i] - b[i]);
    }
    norm = sqrt(norm);
    if (!csvout) {
      printf("The norm of the error is %e\n", norm);
    }
  } else {
    fprintf(stderr, "dgesv returned error %i\n", info);
  }
  t[4] = stoptime() - t[4];
  print_timing(argv[0], t, n, norm, csvout);
  return info;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0xd0,%rsp
movl   $0x0,-0x14(%rbp)
mov    %edi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
movl   $0x1,-0x30(%rbp)
movb   $0x4e,-0x55(%rbp)
movsd  0xdf1(%rip),%xmm0
movsd  %xmm0,-0x60(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x68(%rbp)
movl   $0x1,-0x6c(%rbp)
movl   $0x1,-0x70(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    $0x0,%al
call   10c0 <stoptime@plt>
movsd  %xmm0,-0x90(%rbp)
ff
cmpl   $0x2,-0x18(%rbp)
jge    126e <main+0x8e>
mov    -0x20(%rbp),%rax
mov    (%rax),%rsi
lea    0xdaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2d71(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>
cmpl   $0x2,-0x18(%rbp)
jne    1287 <main+0xa7>
movl   $0x0,-0xb4(%rbp)
jmp    1291 <main+0xb1>
movl   $0x1,-0xb4(%rbp)
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rdi
call   10d0 <atoi@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jg     12b2 <main+0xd2>
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    $0x0,%al
call   10c0 <stoptime@plt>
movsd  %xmm0,-0xb0(%rbp)
ff
mov    -0x24(%rbp),%edi
mov    -0x24(%rbp),%esi
call   1040 <dmatrix@plt>
mov    %rax,-0x38(%rbp)
mov    -0x24(%rbp),%edi
call   1080 <dvector@plt>
mov    %rax,-0x40(%rbp)
mov    -0x24(%rbp),%edi
call   1080 <dvector@plt>
mov    %rax,-0x48(%rbp)
mov    -0x24(%rbp),%edi
call   10a0 <ivector@plt>
mov    %rax,-0x50(%rbp)
mov    $0x0,%al
call   10c0 <stoptime@plt>
subsd  -0xb0(%rbp),%xmm0
ff
movsd  %xmm0,-0xb0(%rbp)
ff
mov    $0x0,%al
call   10c0 <stoptime@plt>
movsd  %xmm0,-0xa8(%rbp)
ff
movl   $0x0,-0x74(%rbp)
mov    -0x74(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1398 <main+0x1b8>
movl   $0x0,-0x78(%rbp)
mov    -0x78(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1376 <main+0x196>
mov    $0x0,%al
call   10b0 <randf@plt>
mov    -0x38(%rbp),%rax
movslq -0x78(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x74(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    1340 <main+0x160>
mov    $0x0,%al
call   10b0 <randf@plt>
mov    -0x48(%rbp),%rax
movslq -0x74(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    132d <main+0x14d>
mov    $0x0,%al
call   10c0 <stoptime@plt>
subsd  -0xa8(%rbp),%xmm0
ff
movsd  %xmm0,-0xa8(%rbp)
ff
mov    $0x0,%al
call   10c0 <stoptime@plt>
movsd  %xmm0,-0xa0(%rbp)
ff
mov    -0x38(%rbp),%rax
mov    (%rax),%r8
mov    -0x48(%rbp),%r14
mov    -0x40(%rbp),%r10
lea    -0x55(%rbp),%rdi
lea    -0x24(%rbp),%rdx
lea    -0x60(%rbp),%rcx
lea    -0x28(%rbp),%r9
lea    -0x6c(%rbp),%rbx
lea    -0x68(%rbp),%r11
lea    -0x70(%rbp),%rax
mov    %rdx,%rsi
mov    %r14,(%rsp)
mov    %rbx,0x8(%rsp)
mov    %r11,0x10(%rsp)
mov    %r10,0x18(%rsp)
mov    %rax,0x20(%rsp)
call   1090 <dgemv_@plt>
mov    $0x0,%al
call   10c0 <stoptime@plt>
subsd  -0xa0(%rbp),%xmm0
ff
movsd  %xmm0,-0xa0(%rbp)
ff
cmpl   $0x0,-0xb4(%rbp)
jne    1449 <main+0x269>
lea    0xbfa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2b8e(%rip),%rax
mov    (%rax),%edi
call   1070 <fflush@plt>
mov    $0x0,%al
call   10c0 <stoptime@plt>
movsd  %xmm0,-0x98(%rbp)
ff
mov    -0x38(%rbp),%rax
mov    (%rax),%rdx
mov    -0x50(%rbp),%r8
mov    -0x40(%rbp),%r9
lea    -0x24(%rbp),%rdi
lea    -0x30(%rbp),%rsi
lea    -0x28(%rbp),%rcx
lea    -0x2c(%rbp),%r10
lea    -0x54(%rbp),%rax
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1060 <dgesv_@plt>
mov    $0x0,%al
call   10c0 <stoptime@plt>
subsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0x98(%rbp)
ff
cmpl   $0x0,-0xb4(%rbp)
jne    14c9 <main+0x2e9>
lea    0xb87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2b0e(%rip),%rax
mov    (%rax),%edi
call   1070 <fflush@plt>
cmpl   $0x0,-0x54(%rbp)
jne    1576 <main+0x396>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x80(%rbp)
movl   $0x0,-0x74(%rbp)
mov    -0x74(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1542 <main+0x362>
mov    -0x48(%rbp),%rax
movslq -0x74(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x40(%rbp),%rax
movslq -0x74(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
mov    -0x48(%rbp),%rax
movslq -0x74(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x40(%rbp),%rax
movslq -0x74(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm2
movsd  -0x80(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    14e2 <main+0x302>
movsd  -0x80(%rbp),%xmm0
call   10e0 <sqrt@plt>
movsd  %xmm0,-0x80(%rbp)
cmpl   $0x0,-0xb4(%rbp)
jne    1571 <main+0x391>
movsd  -0x80(%rbp),%xmm0
lea    0xadb(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    158e <main+0x3ae>
mov    0x2a63(%rip),%rax
mov    (%rax),%edi
mov    -0x54(%rbp),%edx
lea    0xad9(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x0,%al
call   10c0 <stoptime@plt>
subsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x90(%rbp)
ff
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
lea    -0xb0(%rbp),%rsi
mov    -0x24(%rbp),%edx
movsd  -0x80(%rbp),%xmm0
mov    -0xb4(%rbp),%ecx
call   1100 <print_timing@plt>
mov    -0x54(%rbp),%eax
add    $0xd0,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
movl   $0x1,0x24(%rsp)
movb   $0x4e,0x3(%rsp)
movabs $0x3ff0000000000000,%rax
mov    %rax,0x70(%rsp)
movq   $0x0,0x68(%rsp)
movl   $0x1,0x34(%rsp)
movl   $0x1,0x30(%rsp)
xor    %eax,%eax
call   10d0 <stoptime@plt>
movsd  %xmm0,0x60(%rsp)
mov    %ebp,0x2c(%rsp)
cmp    $0x1,%ebp
jle    15fe <main+0x40e>
mov    %rbx,0x18(%rsp)
mov    0x8(%rbx),%rdi
call   10e0 <atoi@plt>
test   %eax,%eax
mov    $0x1,%r14d
cmovg  %eax,%r14d
mov    %r14d,0x4(%rsp)
mov    %r14d,0x14(%rsp)
mov    %r14d,0x28(%rsp)
xor    %eax,%eax
call   10d0 <stoptime@plt>
movsd  %xmm0,0x8(%rsp)
mov    %r14d,%edi
mov    %r14d,%esi
call   1050 <dmatrix@plt>
mov    %rax,%rbx
mov    %r14d,%edi
call   1090 <dvector@plt>
mov    %rax,%r13
mov    %r14d,%edi
call   1090 <dvector@plt>
mov    %rax,%rbp
mov    %r14d,%edi
call   10b0 <ivector@plt>
mov    %rax,0x38(%rsp)
xor    %eax,%eax
call   10d0 <stoptime@plt>
subsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x40(%rsp)
xor    %eax,%eax
call   10d0 <stoptime@plt>
movsd  %xmm0,0x48(%rsp)
xor    %r15d,%r15d
nopl   0x0(%rax)
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   10c0 <randf@plt>
mov    (%rbx,%r12,8),%rax
movsd  %xmm0,(%rax,%r15,8)
add    $0x1,%r12
cmp    %r12,%r14
jne    12f0 <main+0x100>
xor    %eax,%eax
call   10c0 <randf@plt>
movsd  %xmm0,0x0(%rbp,%r15,8)
add    $0x1,%r15
cmp    %r14,%r15
jne    12e0 <main+0xf0>
movsd  0x48(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   10d0 <stoptime@plt>
subsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x48(%rsp)
xor    %eax,%eax
call   10d0 <stoptime@plt>
movsd  %xmm0,0x8(%rsp)
mov    (%rbx),%r8
sub    $0x8,%rsp
lea    0x38(%rsp),%rax
lea    0x70(%rsp),%r10
lea    0x3c(%rsp),%r11
lea    0xb(%rsp),%rdi
lea    0xc(%rsp),%rdx
lea    0x78(%rsp),%rcx
lea    0x1c(%rsp),%r9
mov    %rdx,%rsi
push   %rax
push   %r13
push   %r10
push   %r11
push   %rbp
call   10a0 <dgemv_@plt>
add    $0x30,%rsp
xor    %eax,%eax
call   10d0 <stoptime@plt>
subsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x50(%rsp)
mov    0x2c(%rsp),%r15d
cmp    $0x2,%r15d
jne    142f <main+0x23f>
lea    0xc72(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2c0e(%rip),%r14
mov    (%r14),%edi
call   1080 <fflush@plt>
xor    %eax,%eax
call   10d0 <stoptime@plt>
movsd  %xmm0,0x8(%rsp)
mov    (%rbx),%rdx
lea    0x10(%rsp),%rax
lea    0x28(%rsp),%rbx
lea    0x4(%rsp),%rdi
lea    0x24(%rsp),%rsi
lea    0x14(%rsp),%rcx
mov    0x38(%rsp),%r8
mov    %r13,%r9
push   %rax
push   %rbx
call   1070 <dgesv_@plt>
add    $0x10,%rsp
xor    %eax,%eax
call   10d0 <stoptime@plt>
subsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x58(%rsp)
lea    0xc49(%rip),%rdi
call   1030 <puts@plt>
mov    (%r14),%edi
call   1080 <fflush@plt>
jmp    147e <main+0x28e>
xor    %eax,%eax
call   10d0 <stoptime@plt>
movsd  %xmm0,0x8(%rsp)
mov    (%rbx),%rdx
lea    0x10(%rsp),%rax
lea    0x28(%rsp),%rbx
lea    0x4(%rsp),%rdi
lea    0x24(%rsp),%rsi
lea    0x14(%rsp),%rcx
mov    0x38(%rsp),%r8
mov    %r13,%r9
push   %rax
push   %rbx
call   1070 <dgesv_@plt>
add    $0x10,%rsp
xor    %eax,%eax
call   10d0 <stoptime@plt>
subsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x58(%rsp)
mov    0x18(%rsp),%r14
mov    0x10(%rsp),%edx
test   %edx,%edx
je     14af <main+0x2bf>
mov    0x2b4e(%rip),%rax
mov    (%rax),%edi
lea    0xbb5(%rip),%rsi
call   1060 <fprintf@plt>
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x18(%rsp)
jmp    15b6 <main+0x3c6>
mov    0x4(%rsp),%ecx
xorpd  %xmm1,%xmm1
xorpd  %xmm0,%xmm0
test   %ecx,%ecx
jle    158b <main+0x39b>
lea    -0x1(%rcx),%rdx
mov    %ecx,%eax
and    $0x3,%eax
cmp    $0x3,%rdx
jae    14da <main+0x2ea>
xorpd  %xmm0,%xmm0
xor    %edx,%edx
jmp    154d <main+0x35d>
and    $0xfffffffc,%ecx
xorpd  %xmm0,%xmm0
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  0x0(%rbp,%rdx,8),%xmm2
movsd  0x8(%rbp,%rdx,8),%xmm3
subsd  0x0(%r13,%rdx,8),%xmm2
mulsd  %xmm2,%xmm2
addsd  %xmm0,%xmm2
subsd  0x8(%r13,%rdx,8),%xmm3
mulsd  %xmm3,%xmm3
addsd  %xmm2,%xmm3
movsd  0x10(%rbp,%rdx,8),%xmm2
subsd  0x10(%r13,%rdx,8),%xmm2
mulsd  %xmm2,%xmm2
addsd  %xmm3,%xmm2
movsd  0x18(%rbp,%rdx,8),%xmm0
subsd  0x18(%r13,%rdx,8),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm2,%xmm0
add    $0x4,%rdx
cmp    %rdx,%rcx
jne    14f0 <main+0x300>
test   %rax,%rax
je     158b <main+0x39b>
lea    0x0(,%rdx,8),%rcx
add    %r13,%rcx
lea    0x0(,%rdx,8),%rdx
add    %rbp,%rdx
xor    %esi,%esi
nopw   0x0(%rax,%rax,1)
movsd  (%rdx,%rsi,8),%xmm2
subsd  (%rcx,%rsi,8),%xmm2
mulsd  %xmm2,%xmm2
addsd  %xmm2,%xmm0
add    $0x1,%rsi
cmp    %rsi,%rax
jne    1570 <main+0x380>
ucomisd %xmm1,%xmm0
jb     1597 <main+0x3a7>
sqrtsd %xmm0,%xmm0
jmp    159c <main+0x3ac>
call   10f0 <sqrt@plt>
cmp    $0x2,%r15d
movsd  %xmm0,0x18(%rsp)
jne    15b6 <main+0x3c6>
lea    0xa84(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %ebx,%ebx
cmp    $0x2,%r15d
setne  %bl
xor    %eax,%eax
call   10d0 <stoptime@plt>
subsd  0x60(%rsp),%xmm0
movsd  %xmm0,0x60(%rsp)
mov    (%r14),%rdi
mov    0x4(%rsp),%edx
lea    0x40(%rsp),%rsi
movsd  0x18(%rsp),%xmm0
mov    %ebx,%ecx
call   1110 <print_timing@plt>
mov    0x10(%rsp),%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    (%rbx),%rsi
lea    0x9f8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x29c2(%rip),%rax
mov    (%rax),%edi
call   1100 <exit@plt>

LLVM IR (-O0):
@.str = [38 x i8] c"usage: %s <order of matrix> [csvout]\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [13 x i8] c"solving ... \00"
@stdout = global i32 0
@.str.2 = [10 x i8] c"finished\0A\00"
@.str.3 = [29 x i8] c"The norm of the error is %e\0A\00"
@stderr = global i32 0
@.str.4 = [25 x i8] c"dgesv returned error %i\0A\00"
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 double*
%13 = alloca i32*
%14 = alloca i32
%15 = alloca i8
%16 = alloca double
%17 = alloca double
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca double
%23 = alloca [5 x double]
%24 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %9
store i8 78, i8* %15
store double 1.000000e+00, double* %16
store double 0.000000e+00, double* %17
store i32 1, i32* %18
store i32 1, i32* %19
store double 0.000000e+00, double* %22
%25 = call double (...) @stoptime()
%26 = getelementptr inbounds [5 x double], [5 x double]* %23, i64 0, i64 4
store double %25, double* %26
%27 = load i32, i32* %4
%28 = icmp slt i32 %27, 2
br i1 %28, label %29, label %36
29: ; preds = %2
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 0
%32 = load i8*, i8** %31
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %32)
%34 = load i32, i32* @EXIT_FAILURE
%35 = call i32 @exit(i32 %34)
unreachable
36: ; preds = %2
%37 = load i32, i32* %4
%38 = icmp eq i32 %37, 2
br i1 %38, label %39, label %40
39: ; preds = %36
store i32 0, i32* %24
br label %41
40: ; preds = %36
store i32 1, i32* %24
br label %41
41: ; preds = %40, %39
%42 = load i8**, i8*** %5
%43 = getelementptr inbounds i8*, i8** %42, i64 1
%44 = load i8*, i8** %43
%45 = call i32 @atoi(i8* %44)
store i32 %45, i32* %6
%46 = load i32, i32* %6
%47 = icmp sle i32 %46, 0
br i1 %47, label %48, label %49
48: ; preds = %41
store i32 1, i32* %6
br label %49
49: ; preds = %48, %41
%50 = load i32, i32* %6
store i32 %50, i32* %7
%51 = load i32, i32* %6
store i32 %51, i32* %8
%52 = call double (...) @stoptime()
%53 = getelementptr inbounds [5 x double], [5 x double]* %23, i64 0, i64 0
store double %52, double* %53
%54 = load i32, i32* %6
%55 = load i32, i32* %6
%56 = call double** @dmatrix(i32 %54, i32 %55)
store double** %56, double*** %10
%57 = load i32, i32* %6
%58 = call double* @dvector(i32 %57)
store double* %58, double** %11
%59 = load i32, i32* %6
%60 = call double* @dvector(i32 %59)
store double* %60, double** %12
%61 = load i32, i32* %6
%62 = call i32* @ivector(i32 %61)
store i32* %62, i32** %13
%63 = call double (...) @stoptime()
%64 = getelementptr inbounds [5 x double], [5 x double]* %23, i64 0, i64 0
%65 = load double, double* %64
%66 = fsub double %63, %65
%67 = getelementptr inbounds [5 x double], [5 x double]* %23, i64 0, i64 0
store double %66, double* %67
%68 = call double (...) @stoptime()
%69 = getelementptr inbounds [5 x double], [5 x double]* %23, i64 0, i64 1
store double %68, double* %69
store i32 0, i32* %20
br label %70
70: ; preds = %98, %49
%71 = load i32, i32* %20
%72 = load i32, i32* %6
%73 = icmp slt i32 %71, %72
br i1 %73, label %74, label %101
74: ; preds = %70
store i32 0, i32* %21
br label %75
75: ; preds = %89, %74
%76 = load i32, i32* %21
%77 = load i32, i32* %6
%78 = icmp slt i32 %76, %77
br i1 %78, label %79, label %92
79: ; preds = %75
%80 = call double (...) @randf()
%81 = load double**, double*** %10
%82 = load i32, i32* %21
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds double*, double** %81, i64 %83
%85 = load double*, double** %84
%86 = load i32, i32* %20
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds double, double* %85, i64 %87
store double %80, double* %88
br label %89
89: ; preds = %79
%90 = load i32, i32* %21
%91 = add nsw i32 %90, 1
store i32 %91, i32* %21
br label %75
92: ; preds = %75
%93 = call double (...) @randf()
%94 = load double*, double** %12
%95 = load i32, i32* %20
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds double, double* %94, i64 %96
store double %93, double* %97
br label %98
98: ; preds = %92
%99 = load i32, i32* %20
%100 = add nsw i32 %99, 1
store i32 %100, i32* %20
br label %70
101: ; preds = %70
%102 = call double (...) @stoptime()
%103 = getelementptr inbounds [5 x double], [5 x double]* %23, i64 0, i64 1
%104 = load double, double* %103
%105 = fsub double %102, %104
%106 = getelementptr inbounds [5 x double], [5 x double]* %23, i64 0, i64 1
store double %105, double* %106
%107 = call double (...) @stoptime()
%108 = getelementptr inbounds [5 x double], [5 x double]* %23, i64 0, i64 2
store double %107, double* %108
%109 = load double**, double*** %10
%110 = getelementptr inbounds double*, double** %109, i64 0
%111 = load double*, double** %110
%112 = getelementptr inbounds double, double* %111, i64 0
%113 = load double*, double** %12
%114 = getelementptr inbounds double, double* %113, i64 0
%115 = load double*, double** %11
%116 = getelementptr inbounds double, double* %115, i64 0
%117 = call i32 @dgemv_(i8* %15, i32* %6, i32* %6, double* %16, double* %112, i32* %7, double* %114, i32* %18, double* %17, double* %116, i32* %19)
%118 = call double (...) @stoptime()
%119 = getelementptr inbounds [5 x double], [5 x double]* %23, i64 0, i64 2
%120 = load double, double* %119
%121 = fsub double %118, %120
%122 = getelementptr inbounds [5 x double], [5 x double]* %23, i64 0, i64 2
store double %121, double* %122
%123 = load i32, i32* %24
%124 = icmp ne i32 %123, 0
br i1 %124, label %129, label %125
125: ; preds = %101
%126 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%127 = load i32, i32* @stdout
%128 = call i32 @fflush(i32 %127)
br label %129
129: ; preds = %125, %101
%130 = call double (...) @stoptime()
%131 = getelementptr inbounds [5 x double], [5 x double]* %23, i64 0, i64 3
store double %130, double* %131
%132 = load double**, double*** %10
%133 = getelementptr inbounds double*, double** %132, i64 0
%134 = load double*, double** %133
%135 = getelementptr inbounds double, double* %134, i64 0
%136 = load i32*, i32** %13
%137 = getelementptr inbounds i32, i32* %136, i64 0
%138 = load double*, double** %11
%139 = getelementptr inbounds double, double* %138, i64 0
%140 = call i32 @dgesv_(i32* %6, i32* %9, double* %135, i32* %7, i32* %137, double* %139, i32* %8, i32* %14)
%141 = call double (...) @stoptime()
%142 = getelementptr inbounds [5 x double], [5 x double]* %23, i64 0, i64 3
%143 = load double, double* %142
%144 = fsub double %141, %143
%145 = getelementptr inbounds [5 x double], [5 x double]* %23, i64 0, i64 3
store double %144, double* %145
%146 = load i32, i32* %24
%147 = icmp ne i32 %146, 0
br i1 %147, label %152, label %148
148: ; preds = %129
%149 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%150 = load i32, i32* @stdout
%151 = call i32 @fflush(i32 %150)
br label %152
152: ; preds = %148, %129
%153 = load i32, i32* %14
%154 = icmp eq i32 %153, 0
br i1 %154, label %155, label %197
155: ; preds = %152
store double 0.000000e+00, double* %22
store i32 0, i32* %20
br label %156
156: ; preds = %185, %155
%157 = load i32, i32* %20
%158 = load i32, i32* %6
%159 = icmp slt i32 %157, %158
br i1 %159, label %160, label %188
160: ; preds = %156
%161 = load double*, double** %12
%162 = load i32, i32* %20
%163 = sext i32 %162 to i64
%164 = getelementptr inbounds double, double* %161, i64 %163
%165 = load double, double* %164
%166 = load double*, double** %11
%167 = load i32, i32* %20
%168 = sext i32 %167 to i64
%169 = getelementptr inbounds double, double* %166, i64 %168
%170 = load double, double* %169
%171 = fsub double %165, %170
%172 = load double*, double** %12
%173 = load i32, i32* %20
%174 = sext i32 %173 to i64
%175 = getelementptr inbounds double, double* %172, i64 %174
%176 = load double, double* %175
%177 = load double*, double** %11
%178 = load i32, i32* %20
%179 = sext i32 %178 to i64
%180 = getelementptr inbounds double, double* %177, i64 %179
%181 = load double, double* %180
%182 = fsub double %176, %181
%183 = load double, double* %22
%184 = call double @llvm.fmuladd.f64(double %171, double %182, double %183)
store double %184, double* %22
br label %185
185: ; preds = %160
%186 = load i32, i32* %20
%187 = add nsw i32 %186, 1
store i32 %187, i32* %20
br label %156
188: ; preds = %156
%189 = load double, double* %22
%190 = call double @sqrt(double %189)
store double %190, double* %22
%191 = load i32, i32* %24
%192 = icmp ne i32 %191, 0
br i1 %192, label %196, label %193
193: ; preds = %188
%194 = load double, double* %22
%195 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), double %194)
br label %196
196: ; preds = %193, %188
br label %201
197: ; preds = %152
%198 = load i32, i32* @stderr
%199 = load i32, i32* %14
%200 = call i32 @fprintf(i32 %198, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %199)
br label %201
201: ; preds = %197, %196
%202 = call double (...) @stoptime()
%203 = getelementptr inbounds [5 x double], [5 x double]* %23, i64 0, i64 4
%204 = load double, double* %203
%205 = fsub double %202, %204
%206 = getelementptr inbounds [5 x double], [5 x double]* %23, i64 0, i64 4
store double %205, double* %206
%207 = load i8**, i8*** %5
%208 = getelementptr inbounds i8*, i8** %207, i64 0
%209 = load i8*, i8** %208
%210 = getelementptr inbounds [5 x double], [5 x double]* %23, i64 0, i64 0
%211 = load i32, i32* %6
%212 = load double, double* %22
%213 = load i32, i32* %24
%214 = call i32 @print_timing(i8* %209, double* %210, i32 %211, double %212, i32 %213)
%215 = load i32, i32* %14
ret i32 %215
}

LLVM IR (-O2):
@.str = [38 x i8] c"usage: %s <order of matrix> [csvout]\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [13 x i8] c"solving ... \00"
@stdout = global i32 0
@.str.3 = [29 x i8] c"The norm of the error is %e\0A\00"
@stderr = global i32 0
@.str.4 = [25 x i8] c"dgesv returned error %i\0A\00"
@str = [9 x i8] c"finished\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8
%9 = alloca double
%10 = alloca double
%11 = alloca i32
%12 = alloca i32
%13 = alloca [5 x double]
%14 = bitcast i32* %3 to i8*
%15 = bitcast i32* %4 to i8*
%16 = bitcast i32* %5 to i8*
%17 = bitcast i32* %6 to i8*
store i32 1, i32* %6
%18 = bitcast i32* %7 to i8*
store i8 78, i8* %8
%19 = bitcast double* %9 to i8*
store double 1.000000e+00, double* %9
%20 = bitcast double* %10 to i8*
store double 0.000000e+00, double* %10
%21 = bitcast i32* %11 to i8*
store i32 1, i32* %11
%22 = bitcast i32* %12 to i8*
store i32 1, i32* %12
%23 = bitcast [5 x double]* %13 to i8*
%24 = tail call double (...) @stoptime()
%25 = getelementptr inbounds [5 x double], [5 x double]* %13, i64 0, i64 4
store double %24, double* %25
%26 = icmp slt i32 %0, 2
br i1 %26, label %27, label %32
27: ; preds = %2
%28 = load i8*, i8** %1
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %28)
%30 = load i32, i32* @EXIT_FAILURE
%31 = tail call i32 @exit(i32 %30)
unreachable
32: ; preds = %2
%33 = icmp eq i32 %0, 2
%34 = getelementptr inbounds i8*, i8** %1, i64 1
%35 = load i8*, i8** %34
%36 = tail call i32 @atoi(i8* %35)
%37 = icmp sgt i32 %36, 1
%38 = select i1 %37, i32 %36, i32 1
store i32 %38, i32* %3
store i32 %38, i32* %4
store i32 %38, i32* %5
%39 = tail call double (...) @stoptime()
%40 = getelementptr inbounds [5 x double], [5 x double]* %13, i64 0, i64 0
%41 = tail call double** @dmatrix(i32 %38, i32 %38)
%42 = tail call double* @dvector(i32 %38)
%43 = tail call double* @dvector(i32 %38)
%44 = tail call i32* @ivector(i32 %38)
%45 = tail call double (...) @stoptime()
%46 = fsub double %45, %39
store double %46, double* %40
%47 = tail call double (...) @stoptime()
%48 = getelementptr inbounds [5 x double], [5 x double]* %13, i64 0, i64 1
store double %47, double* %48
%49 = zext i32 %38 to i64
br label %50
50: ; preds = %60, %32
%51 = phi i64 [ 0, %32 ], [ %63, %60 ]
br label %52
52: ; preds = %50, %52
%53 = phi i64 [ 0, %50 ], [ %58, %52 ]
%54 = tail call double (...) @randf()
%55 = getelementptr inbounds double*, double** %41, i64 %53
%56 = load double*, double** %55
%57 = getelementptr inbounds double, double* %56, i64 %51
store double %54, double* %57
%58 = add nuw nsw i64 %53, 1
%59 = icmp eq i64 %58, %49
br i1 %59, label %60, label %52
60: ; preds = %52
%61 = tail call double (...) @randf()
%62 = getelementptr inbounds double, double* %43, i64 %51
store double %61, double* %62
%63 = add nuw nsw i64 %51, 1
%64 = icmp eq i64 %63, %49
br i1 %64, label %65, label %50
65: ; preds = %60
%66 = load double, double* %48
%67 = tail call double (...) @stoptime()
%68 = fsub double %67, %66
store double %68, double* %48
%69 = tail call double (...) @stoptime()
%70 = getelementptr inbounds [5 x double], [5 x double]* %13, i64 0, i64 2
%71 = load double*, double** %41
%72 = call i32 @dgemv_(i8* %8, i32* %3, i32* %3, double* %9, double* %71, i32* %4, double* %43, i32* %11, double* %10, double* %42, i32* %12)
%73 = call double (...) @stoptime()
%74 = fsub double %73, %69
store double %74, double* %70
br i1 %33, label %75, label %88
75: ; preds = %65
%76 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%77 = load i32, i32* @stdout
%78 = call i32 @fflush(i32 %77)
%79 = call double (...) @stoptime()
%80 = getelementptr inbounds [5 x double], [5 x double]* %13, i64 0, i64 3
%81 = load double*, double** %41
%82 = call i32 @dgesv_(i32* %3, i32* %6, double* %81, i32* %4, i32* %44, double* %42, i32* %5, i32* %7)
%83 = call double (...) @stoptime()
%84 = fsub double %83, %79
store double %84, double* %80
%85 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%86 = load i32, i32* @stdout
%87 = call i32 @fflush(i32 %86)
br label %95
88: ; preds = %65
%89 = call double (...) @stoptime()
%90 = getelementptr inbounds [5 x double], [5 x double]* %13, i64 0, i64 3
%91 = load double*, double** %41
%92 = call i32 @dgesv_(i32* %3, i32* %6, double* %91, i32* %4, i32* %44, double* %42, i32* %5, i32* %7)
%93 = call double (...) @stoptime()
%94 = fsub double %93, %89
store double %94, double* %90
br label %95
95: ; preds = %88, %75
%96 = load i32, i32* %7
%97 = icmp eq i32 %96, 0
br i1 %97, label %98, label %165
98: ; preds = %95
%99 = load i32, i32* %3
%100 = icmp sgt i32 %99, 0
br i1 %100, label %101, label %160
101: ; preds = %98
%102 = zext i32 %99 to i64
%103 = add nsw i64 %102, -1
%104 = and i64 %102, 3
%105 = icmp ult i64 %103, 3
br i1 %105, label %142, label %106
106: ; preds = %101
%107 = and i64 %102, 4294967292
br label %108
108: ; preds = %108, %106
%109 = phi i64 [ 0, %106 ], [ %139, %108 ]
%110 = phi double [ 0.000000e+00, %106 ], [ %138, %108 ]
%111 = phi i64 [ 0, %106 ], [ %140, %108 ]
%112 = getelementptr inbounds double, double* %43, i64 %109
%113 = load double, double* %112
%114 = getelementptr inbounds double, double* %42, i64 %109
%115 = load double, double* %114
%116 = fsub double %113, %115
%117 = call double @llvm.fmuladd.f64(double %116, double %116, double %110)
%118 = or i64 %109, 1
%119 = getelementptr inbounds double, double* %43, i64 %118
%120 = load double, double* %119
%121 = getelementptr inbounds double, double* %42, i64 %118
%122 = load double, double* %121
%123 = fsub double %120, %122
%124 = call double @llvm.fmuladd.f64(double %123, double %123, double %117)
%125 = or i64 %109, 2
%126 = getelementptr inbounds double, double* %43, i64 %125
%127 = load double, double* %126
%128 = getelementptr inbounds double, double* %42, i64 %125
%129 = load double, double* %128
%130 = fsub double %127, %129
%131 = call double @llvm.fmuladd.f64(double %130, double %130, double %124)
%132 = or i64 %109, 3
%133 = getelementptr inbounds double, double* %43, i64 %132
%134 = load double, double* %133
%135 = getelementptr inbounds double, double* %42, i64 %132
%136 = load double, double* %135
%137 = fsub double %134, %136
%138 = call double @llvm.fmuladd.f64(double %137, double %137, double %131)
%139 = add nuw nsw i64 %109, 4
%140 = add i64 %111, 4
%141 = icmp eq i64 %140, %107
br i1 %141, label %142, label %108
142: ; preds = %108, %101
%143 = phi double [ undef, %101 ], [ %138, %108 ]
%144 = phi i64 [ 0, %101 ], [ %139, %108 ]
%145 = phi double [ 0.000000e+00, %101 ], [ %138, %108 ]
%146 = icmp eq i64 %104, 0
br i1 %146, label %160, label %147
147: ; preds = %142, %147
%148 = phi i64 [ %157, %147 ], [ %144, %142 ]
%149 = phi double [ %156, %147 ], [ %145, %142 ]
%150 = phi i64 [ %158, %147 ], [ 0, %142 ]
%151 = getelementptr inbounds double, double* %43, i64 %148
%152 = load double, double* %151
%153 = getelementptr inbounds double, double* %42, i64 %148
%154 = load double, double* %153
%155 = fsub double %152, %154
%156 = call double @llvm.fmuladd.f64(double %155, double %155, double %149)
%157 = add nuw nsw i64 %148, 1
%158 = add i64 %150, 1
%159 = icmp eq i64 %158, %104
br i1 %159, label %160, label %147
160: ; preds = %142, %147, %98
%161 = phi double [ 0.000000e+00, %98 ], [ %143, %142 ], [ %156, %147 ]
%162 = call double @sqrt(double %161)
br i1 %33, label %163, label %168
163: ; preds = %160
%164 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), double %162)
br label %168
165: ; preds = %95
%166 = load i32, i32* @stderr
%167 = call i32 @fprintf(i32 %166, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %96)
br label %168
168: ; preds = %160, %163, %165
%169 = phi double [ %162, %160 ], [ %162, %163 ], [ 0.000000e+00, %165 ]
%170 = xor i1 %33, true
%171 = zext i1 %170 to i32
%172 = call double (...) @stoptime()
%173 = load double, double* %25
%174 = fsub double %172, %173
store double %174, double* %25
%175 = load i8*, i8** %1
%176 = load i32, i32* %3
%177 = call i32 @print_timing(i8* %175, double* %40, i32 %176, double %169, i32 %171)
%178 = load i32, i32* %7
ret i32 %178
}