#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 */
typedef double uint64_t;
struct timespec {
  long tv_sec;
  double tv_nsec;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_MONOTONIC;
int atoi(char *);
scalar_t__ calloc(int, int);
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
int /*<<< orphan*/ dgemm0(double *, double *, double *, int);
int /*<<< orphan*/ dgemm1(double *, double *, double *, int);
int /*<<< orphan*/ dgemm2(double *, double *, double *, int);
int /*<<< orphan*/ dgemm3(double *, double *, double *, int);
int /*<<< orphan*/ printf(char *, double);
double rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
double verification(double *, double *, double *, double *, int);
int main(int argc, char *argv[]) {
  int n = atoi(argv[1]);
  uint64_t t0;
  float t;
  struct timespec begin, end;
  double *a, *b;
  double *c0, *c1, *c2, *c3;
  double diff;
  int i;
  srand(time(NULL));
  a = (double *)calloc(sizeof(double), n * n);
  for (i = 0; i < n * n; i++) {
    a[i] = rand() / 1000000.0;
  }
  b = (double *)calloc(sizeof(double), n * n);
  for (i = 0; i < n * n; i++) {
    b[i] = rand() / 1000000.0;
  }
  c0 = (double *)calloc(sizeof(double), n * n);
  c1 = (double *)calloc(sizeof(double), n * n);
  c2 = (double *)calloc(sizeof(double), n * n);
  c3 = (double *)calloc(sizeof(double), n * n);
  clock_gettime(CLOCK_MONOTONIC, &begin);
  dgemm0(a, b, c0, n);
  clock_gettime(CLOCK_MONOTONIC, &end);
  t0 = 1000000000L * (end.tv_sec - begin.tv_sec) + end.tv_nsec - begin.tv_nsec;
  t = t0 / 1000000000.0;
  printf("%f\t", t);
  clock_gettime(CLOCK_MONOTONIC, &begin);
  dgemm1(a, b, c1, n);
  clock_gettime(CLOCK_MONOTONIC, &end);
  t0 = 1000000000L * (end.tv_sec - begin.tv_sec) + end.tv_nsec - begin.tv_nsec;
  t = t0 / 1000000000.0;
  printf("%f\t", t);
  clock_gettime(CLOCK_MONOTONIC, &begin);
  dgemm2(a, b, c2, n);
  clock_gettime(CLOCK_MONOTONIC, &end);
  t0 = 1000000000L * (end.tv_sec - begin.tv_sec) + end.tv_nsec - begin.tv_nsec;
  t = t0 / 1000000000.0;
  printf("%f\t", t);
  clock_gettime(CLOCK_MONOTONIC, &begin);
  dgemm3(a, b, c3, n);
  clock_gettime(CLOCK_MONOTONIC, &end);
  t0 = 1000000000L * (end.tv_sec - begin.tv_sec) + end.tv_nsec - begin.tv_nsec;
  t = t0 / 1000000000.0;
  printf("%f\t", t);
  diff = verification(a, b, c0, c1, n);
  printf("%f\t", diff);
  diff = verification(a, b, c0, c2, n);
  printf("%f\t", diff);
  diff = verification(a, b, c0, c3, n);
  printf("%f\n", diff);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10d0 <atoi@plt>
mov    %eax,-0x14(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1090 <time@plt>
mov    %eax,%edi
call   1070 <srand@plt>
mov    -0x14(%rbp),%esi
imul   -0x14(%rbp),%esi
mov    $0x8,%edi
call   1080 <calloc@plt>
mov    %rax,-0x50(%rbp)
movl   $0x0,-0x84(%rbp)
mov    -0x84(%rbp),%eax
mov    -0x14(%rbp),%ecx
imul   -0x14(%rbp),%ecx
cmp    %ecx,%eax
jge    1264 <main+0xa4>
mov    $0x0,%al
call   10e0 <rand@plt>
movsd  0xdcc(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x50(%rbp),%rax
movslq -0x84(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    1218 <main+0x58>
mov    -0x14(%rbp),%esi
imul   -0x14(%rbp),%esi
mov    $0x8,%edi
call   1080 <calloc@plt>
mov    %rax,-0x58(%rbp)
movl   $0x0,-0x84(%rbp)
mov    -0x84(%rbp),%eax
mov    -0x14(%rbp),%ecx
imul   -0x14(%rbp),%ecx
cmp    %ecx,%eax
jge    12cf <main+0x10f>
mov    $0x0,%al
call   10e0 <rand@plt>
movsd  0xd61(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x58(%rbp),%rax
movslq -0x84(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    1283 <main+0xc3>
mov    -0x14(%rbp),%esi
imul   -0x14(%rbp),%esi
mov    $0x8,%edi
call   1080 <calloc@plt>
mov    %rax,-0x60(%rbp)
mov    -0x14(%rbp),%esi
imul   -0x14(%rbp),%esi
mov    $0x8,%edi
call   1080 <calloc@plt>
mov    %rax,-0x68(%rbp)
mov    -0x14(%rbp),%esi
imul   -0x14(%rbp),%esi
mov    $0x8,%edi
call   1080 <calloc@plt>
mov    %rax,-0x70(%rbp)
mov    -0x14(%rbp),%esi
imul   -0x14(%rbp),%esi
mov    $0x8,%edi
call   1080 <calloc@plt>
mov    %rax,-0x78(%rbp)
mov    0x2cbe(%rip),%rax
mov    (%rax),%edi
lea    -0x38(%rbp),%rsi
call   1040 <clock_gettime@plt>
mov    -0x50(%rbp),%rdi
mov    -0x58(%rbp),%rsi
mov    -0x60(%rbp),%rdx
mov    -0x14(%rbp),%ecx
call   10c0 <dgemm0@plt>
mov    0x2c98(%rip),%rax
mov    (%rax),%edi
lea    -0x48(%rbp),%rsi
call   1040 <clock_gettime@plt>
mov    -0x48(%rbp),%rax
sub    -0x38(%rbp),%rax
imul   $0x3b9aca00,%rax,%rax
cvtsi2sd %rax,%xmm0
addsd  -0x40(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xc75(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xc68(%rip),%rdi
call   1060 <printf@plt>
mov    0x2c34(%rip),%rax
mov    (%rax),%edi
lea    -0x38(%rbp),%rsi
call   1040 <clock_gettime@plt>
mov    -0x50(%rbp),%rdi
mov    -0x58(%rbp),%rsi
mov    -0x68(%rbp),%rdx
mov    -0x14(%rbp),%ecx
call   1050 <dgemm1@plt>
mov    0x2c0e(%rip),%rax
mov    (%rax),%edi
lea    -0x48(%rbp),%rsi
call   1040 <clock_gettime@plt>
mov    -0x48(%rbp),%rax
sub    -0x38(%rbp),%rax
imul   $0x3b9aca00,%rax,%rax
cvtsi2sd %rax,%xmm0
addsd  -0x40(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xbeb(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xbde(%rip),%rdi
call   1060 <printf@plt>
mov    0x2baa(%rip),%rax
mov    (%rax),%edi
lea    -0x38(%rbp),%rsi
call   1040 <clock_gettime@plt>
mov    -0x50(%rbp),%rdi
mov    -0x58(%rbp),%rsi
mov    -0x70(%rbp),%rdx
mov    -0x14(%rbp),%ecx
call   10b0 <dgemm2@plt>
mov    0x2b84(%rip),%rax
mov    (%rax),%edi
lea    -0x48(%rbp),%rsi
call   1040 <clock_gettime@plt>
mov    -0x48(%rbp),%rax
sub    -0x38(%rbp),%rax
imul   $0x3b9aca00,%rax,%rax
cvtsi2sd %rax,%xmm0
addsd  -0x40(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xb61(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xb54(%rip),%rdi
call   1060 <printf@plt>
mov    0x2b20(%rip),%rax
mov    (%rax),%edi
lea    -0x38(%rbp),%rsi
call   1040 <clock_gettime@plt>
mov    -0x50(%rbp),%rdi
mov    -0x58(%rbp),%rsi
mov    -0x78(%rbp),%rdx
mov    -0x14(%rbp),%ecx
call   1030 <dgemm3@plt>
mov    0x2afa(%rip),%rax
mov    (%rax),%edi
lea    -0x48(%rbp),%rsi
call   1040 <clock_gettime@plt>
mov    -0x48(%rbp),%rax
sub    -0x38(%rbp),%rax
imul   $0x3b9aca00,%rax,%rax
cvtsi2sd %rax,%xmm0
addsd  -0x40(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xad7(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xaca(%rip),%rdi
call   1060 <printf@plt>
mov    -0x50(%rbp),%rdi
mov    -0x58(%rbp),%rsi
mov    -0x60(%rbp),%rdx
mov    -0x68(%rbp),%rcx
mov    -0x14(%rbp),%r8d
call   10a0 <verification@plt>
movsd  %xmm0,-0x80(%rbp)
movsd  -0x80(%rbp),%xmm0
lea    0xa9b(%rip),%rdi
call   1060 <printf@plt>
mov    -0x50(%rbp),%rdi
mov    -0x58(%rbp),%rsi
mov    -0x60(%rbp),%rdx
mov    -0x70(%rbp),%rcx
mov    -0x14(%rbp),%r8d
call   10a0 <verification@plt>
movsd  %xmm0,-0x80(%rbp)
movsd  -0x80(%rbp),%xmm0
lea    0xa6c(%rip),%rdi
call   1060 <printf@plt>
mov    -0x50(%rbp),%rdi
mov    -0x58(%rbp),%rsi
mov    -0x60(%rbp),%rdx
mov    -0x78(%rbp),%rcx
mov    -0x14(%rbp),%r8d
call   10a0 <verification@plt>
movsd  %xmm0,-0x80(%rbp)
movsd  -0x80(%rbp),%xmm0
lea    0xa41(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    0x8(%rsi),%rdi
call   10d0 <atoi@plt>
mov    %eax,%r14d
xor    %edi,%edi
call   1090 <time@plt>
mov    %eax,%edi
call   1070 <srand@plt>
mov    %r14d,%r13d
imul   %r14d,%r13d
mov    $0x8,%edi
mov    %r13d,%esi
call   1080 <calloc@plt>
mov    %rax,%r15
test   %r13d,%r13d
je     1270 <main+0xb0>
mov    %r13d,%ebp
xor    %ebx,%ebx
nopl   0x0(%rax)
xor    %eax,%eax
call   10e0 <rand@plt>
divsd  0xde1(%rip),%xmm0
movsd  %xmm0,(%r15,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1210 <main+0x50>
mov    $0x8,%edi
mov    %r13d,%esi
call   1080 <calloc@plt>
mov    %rax,%r12
test   %r13d,%r13d
je     1280 <main+0xc0>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   10e0 <rand@plt>
divsd  0xda1(%rip),%xmm0
movsd  %xmm0,(%r12,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1250 <main+0x90>
jmp    1280 <main+0xc0>
mov    $0x8,%edi
mov    %r13d,%esi
call   1080 <calloc@plt>
mov    %rax,%r12
mov    $0x8,%edi
mov    %r13d,%esi
call   1080 <calloc@plt>
mov    %rax,%rbx
mov    %rax,0x40(%rsp)
mov    $0x8,%edi
mov    %r13d,%esi
call   1080 <calloc@plt>
mov    %rax,0x28(%rsp)
mov    $0x8,%edi
mov    %r13d,%esi
call   1080 <calloc@plt>
mov    %rax,0x30(%rsp)
mov    $0x8,%edi
mov    %r13d,%esi
call   1080 <calloc@plt>
mov    %rax,0x38(%rsp)
mov    0x2d16(%rip),%rbp
mov    0x0(%rbp),%edi
lea    0x18(%rsp),%r13
mov    %r13,%rsi
call   1040 <clock_gettime@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
mov    %r14d,%ecx
call   10c0 <dgemm0@plt>
mov    0x0(%rbp),%edi
lea    0x8(%rsp),%rsi
call   1040 <clock_gettime@plt>
mov    0x8(%rsp),%rax
sub    0x18(%rsp),%rax
imul   $0x3b9aca00,%rax,%rax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  0x10(%rsp),%xmm0
subsd  0x20(%rsp),%xmm0
divsd  0xcdb(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xcd4(%rip),%rbx
mov    %rbx,%rdi
call   1060 <printf@plt>
mov    0x0(%rbp),%edi
mov    %r13,%rsi
call   1040 <clock_gettime@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    0x28(%rsp),%rdx
mov    %r14d,%ecx
call   1050 <dgemm1@plt>
mov    0x0(%rbp),%edi
lea    0x8(%rsp),%rsi
call   1040 <clock_gettime@plt>
mov    0x8(%rsp),%rax
sub    0x18(%rsp),%rax
imul   $0x3b9aca00,%rax,%rax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  0x10(%rsp),%xmm0
subsd  0x20(%rsp),%xmm0
divsd  0xc6c(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
call   1060 <printf@plt>
mov    0x0(%rbp),%edi
mov    %r13,%rsi
call   1040 <clock_gettime@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    0x30(%rsp),%rdx
mov    %r14d,%ecx
call   10b0 <dgemm2@plt>
mov    0x0(%rbp),%edi
lea    0x8(%rsp),%rsi
call   1040 <clock_gettime@plt>
mov    0x8(%rsp),%rax
sub    0x18(%rsp),%rax
imul   $0x3b9aca00,%rax,%rax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  0x10(%rsp),%xmm0
subsd  0x20(%rsp),%xmm0
divsd  0xc04(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
call   1060 <printf@plt>
mov    0x0(%rbp),%edi
mov    %r13,%rsi
call   1040 <clock_gettime@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    0x38(%rsp),%r13
mov    %r13,%rdx
mov    %r14d,%ecx
call   1030 <dgemm3@plt>
mov    0x0(%rbp),%edi
lea    0x8(%rsp),%rsi
call   1040 <clock_gettime@plt>
mov    0x8(%rsp),%rax
sub    0x18(%rsp),%rax
imul   $0x3b9aca00,%rax,%rax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  0x10(%rsp),%xmm0
subsd  0x20(%rsp),%xmm0
divsd  0xb99(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    0x40(%rsp),%rbp
mov    %rbp,%rdx
mov    0x28(%rsp),%rcx
mov    %r14d,%r8d
call   10a0 <verification@plt>
mov    %rbx,%rdi
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbp,%rdx
mov    0x30(%rsp),%rcx
mov    %r14d,%r8d
call   10a0 <verification@plt>
mov    %rbx,%rdi
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbp,%rdx
mov    %r13,%rcx
mov    %r14d,%r8d
call   10a0 <verification@plt>
lea    0xb39(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.timespec = type { i64, double }
@CLOCK_MONOTONIC = global i32 0
@.str = [4 x i8] c"%f\09\00"
@.str.1 = [4 x i8] c"%f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca double
%8 = alloca float
%9 = alloca %struct.timespec
%10 = alloca %struct.timespec
%11 = alloca double*
%12 = alloca double*
%13 = alloca double*
%14 = alloca double*
%15 = alloca double*
%16 = alloca double*
%17 = alloca double
%18 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call i32 @atoi(i8* %21)
store i32 %22, i32* %6
%23 = call i32 @time(i32* null)
%24 = call i32 @srand(i32 %23)
%25 = load i32, i32* %6
%26 = load i32, i32* %6
%27 = mul nsw i32 %25, %26
%28 = call i64 @calloc(i32 8, i32 %27)
%29 = inttoptr i64 %28 to double*
store double* %29, double** %11
store i32 0, i32* %18
br label %30
30: ; preds = %43, %2
%31 = load i32, i32* %18
%32 = load i32, i32* %6
%33 = load i32, i32* %6
%34 = mul nsw i32 %32, %33
%35 = icmp slt i32 %31, %34
br i1 %35, label %36, label %46
36: ; preds = %30
%37 = call double (...) @rand()
%38 = fdiv double %37, 1.000000e+06
%39 = load double*, double** %11
%40 = load i32, i32* %18
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds double, double* %39, i64 %41
store double %38, double* %42
br label %43
43: ; preds = %36
%44 = load i32, i32* %18
%45 = add nsw i32 %44, 1
store i32 %45, i32* %18
br label %30
46: ; preds = %30
%47 = load i32, i32* %6
%48 = load i32, i32* %6
%49 = mul nsw i32 %47, %48
%50 = call i64 @calloc(i32 8, i32 %49)
%51 = inttoptr i64 %50 to double*
store double* %51, double** %12
store i32 0, i32* %18
br label %52
52: ; preds = %65, %46
%53 = load i32, i32* %18
%54 = load i32, i32* %6
%55 = load i32, i32* %6
%56 = mul nsw i32 %54, %55
%57 = icmp slt i32 %53, %56
br i1 %57, label %58, label %68
58: ; preds = %52
%59 = call double (...) @rand()
%60 = fdiv double %59, 1.000000e+06
%61 = load double*, double** %12
%62 = load i32, i32* %18
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds double, double* %61, i64 %63
store double %60, double* %64
br label %65
65: ; preds = %58
%66 = load i32, i32* %18
%67 = add nsw i32 %66, 1
store i32 %67, i32* %18
br label %52
68: ; preds = %52
%69 = load i32, i32* %6
%70 = load i32, i32* %6
%71 = mul nsw i32 %69, %70
%72 = call i64 @calloc(i32 8, i32 %71)
%73 = inttoptr i64 %72 to double*
store double* %73, double** %13
%74 = load i32, i32* %6
%75 = load i32, i32* %6
%76 = mul nsw i32 %74, %75
%77 = call i64 @calloc(i32 8, i32 %76)
%78 = inttoptr i64 %77 to double*
store double* %78, double** %14
%79 = load i32, i32* %6
%80 = load i32, i32* %6
%81 = mul nsw i32 %79, %80
%82 = call i64 @calloc(i32 8, i32 %81)
%83 = inttoptr i64 %82 to double*
store double* %83, double** %15
%84 = load i32, i32* %6
%85 = load i32, i32* %6
%86 = mul nsw i32 %84, %85
%87 = call i64 @calloc(i32 8, i32 %86)
%88 = inttoptr i64 %87 to double*
store double* %88, double** %16
%89 = load i32, i32* @CLOCK_MONOTONIC
%90 = call i32 @clock_gettime(i32 %89, %struct.timespec* %9)
%91 = load double*, double** %11
%92 = load double*, double** %12
%93 = load double*, double** %13
%94 = load i32, i32* %6
%95 = call i32 @dgemm0(double* %91, double* %92, double* %93, i32 %94)
%96 = load i32, i32* @CLOCK_MONOTONIC
%97 = call i32 @clock_gettime(i32 %96, %struct.timespec* %10)
%98 = getelementptr inbounds %struct.timespec, %struct.timespec* %10, i32 0, i32 0
%99 = load i64, i64* %98
%100 = getelementptr inbounds %struct.timespec, %struct.timespec* %9, i32 0, i32 0
%101 = load i64, i64* %100
%102 = sub nsw i64 %99, %101
%103 = mul nsw i64 1000000000, %102
%104 = sitofp i64 %103 to double
%105 = getelementptr inbounds %struct.timespec, %struct.timespec* %10, i32 0, i32 1
%106 = load double, double* %105
%107 = fadd double %104, %106
%108 = getelementptr inbounds %struct.timespec, %struct.timespec* %9, i32 0, i32 1
%109 = load double, double* %108
%110 = fsub double %107, %109
store double %110, double* %7
%111 = load double, double* %7
%112 = fdiv double %111, 1.000000e+09
%113 = fptrunc double %112 to float
store float %113, float* %8
%114 = load float, float* %8
%115 = fpext float %114 to double
%116 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %115)
%117 = load i32, i32* @CLOCK_MONOTONIC
%118 = call i32 @clock_gettime(i32 %117, %struct.timespec* %9)
%119 = load double*, double** %11
%120 = load double*, double** %12
%121 = load double*, double** %14
%122 = load i32, i32* %6
%123 = call i32 @dgemm1(double* %119, double* %120, double* %121, i32 %122)
%124 = load i32, i32* @CLOCK_MONOTONIC
%125 = call i32 @clock_gettime(i32 %124, %struct.timespec* %10)
%126 = getelementptr inbounds %struct.timespec, %struct.timespec* %10, i32 0, i32 0
%127 = load i64, i64* %126
%128 = getelementptr inbounds %struct.timespec, %struct.timespec* %9, i32 0, i32 0
%129 = load i64, i64* %128
%130 = sub nsw i64 %127, %129
%131 = mul nsw i64 1000000000, %130
%132 = sitofp i64 %131 to double
%133 = getelementptr inbounds %struct.timespec, %struct.timespec* %10, i32 0, i32 1
%134 = load double, double* %133
%135 = fadd double %132, %134
%136 = getelementptr inbounds %struct.timespec, %struct.timespec* %9, i32 0, i32 1
%137 = load double, double* %136
%138 = fsub double %135, %137
store double %138, double* %7
%139 = load double, double* %7
%140 = fdiv double %139, 1.000000e+09
%141 = fptrunc double %140 to float
store float %141, float* %8
%142 = load float, float* %8
%143 = fpext float %142 to double
%144 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %143)
%145 = load i32, i32* @CLOCK_MONOTONIC
%146 = call i32 @clock_gettime(i32 %145, %struct.timespec* %9)
%147 = load double*, double** %11
%148 = load double*, double** %12
%149 = load double*, double** %15
%150 = load i32, i32* %6
%151 = call i32 @dgemm2(double* %147, double* %148, double* %149, i32 %150)
%152 = load i32, i32* @CLOCK_MONOTONIC
%153 = call i32 @clock_gettime(i32 %152, %struct.timespec* %10)
%154 = getelementptr inbounds %struct.timespec, %struct.timespec* %10, i32 0, i32 0
%155 = load i64, i64* %154
%156 = getelementptr inbounds %struct.timespec, %struct.timespec* %9, i32 0, i32 0
%157 = load i64, i64* %156
%158 = sub nsw i64 %155, %157
%159 = mul nsw i64 1000000000, %158
%160 = sitofp i64 %159 to double
%161 = getelementptr inbounds %struct.timespec, %struct.timespec* %10, i32 0, i32 1
%162 = load double, double* %161
%163 = fadd double %160, %162
%164 = getelementptr inbounds %struct.timespec, %struct.timespec* %9, i32 0, i32 1
%165 = load double, double* %164
%166 = fsub double %163, %165
store double %166, double* %7
%167 = load double, double* %7
%168 = fdiv double %167, 1.000000e+09
%169 = fptrunc double %168 to float
store float %169, float* %8
%170 = load float, float* %8
%171 = fpext float %170 to double
%172 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %171)
%173 = load i32, i32* @CLOCK_MONOTONIC
%174 = call i32 @clock_gettime(i32 %173, %struct.timespec* %9)
%175 = load double*, double** %11
%176 = load double*, double** %12
%177 = load double*, double** %16
%178 = load i32, i32* %6
%179 = call i32 @dgemm3(double* %175, double* %176, double* %177, i32 %178)
%180 = load i32, i32* @CLOCK_MONOTONIC
%181 = call i32 @clock_gettime(i32 %180, %struct.timespec* %10)
%182 = getelementptr inbounds %struct.timespec, %struct.timespec* %10, i32 0, i32 0
%183 = load i64, i64* %182
%184 = getelementptr inbounds %struct.timespec, %struct.timespec* %9, i32 0, i32 0
%185 = load i64, i64* %184
%186 = sub nsw i64 %183, %185
%187 = mul nsw i64 1000000000, %186
%188 = sitofp i64 %187 to double
%189 = getelementptr inbounds %struct.timespec, %struct.timespec* %10, i32 0, i32 1
%190 = load double, double* %189
%191 = fadd double %188, %190
%192 = getelementptr inbounds %struct.timespec, %struct.timespec* %9, i32 0, i32 1
%193 = load double, double* %192
%194 = fsub double %191, %193
store double %194, double* %7
%195 = load double, double* %7
%196 = fdiv double %195, 1.000000e+09
%197 = fptrunc double %196 to float
store float %197, float* %8
%198 = load float, float* %8
%199 = fpext float %198 to double
%200 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %199)
%201 = load double*, double** %11
%202 = load double*, double** %12
%203 = load double*, double** %13
%204 = load double*, double** %14
%205 = load i32, i32* %6
%206 = call double @verification(double* %201, double* %202, double* %203, double* %204, i32 %205)
store double %206, double* %17
%207 = load double, double* %17
%208 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %207)
%209 = load double*, double** %11
%210 = load double*, double** %12
%211 = load double*, double** %13
%212 = load double*, double** %15
%213 = load i32, i32* %6
%214 = call double @verification(double* %209, double* %210, double* %211, double* %212, i32 %213)
store double %214, double* %17
%215 = load double, double* %17
%216 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %215)
%217 = load double*, double** %11
%218 = load double*, double** %12
%219 = load double*, double** %13
%220 = load double*, double** %16
%221 = load i32, i32* %6
%222 = call double @verification(double* %217, double* %218, double* %219, double* %220, i32 %221)
store double %222, double* %17
%223 = load double, double* %17
%224 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %223)
ret i32 0
}

LLVM IR (-O2):
%struct.timespec = type { i64, double }
@CLOCK_MONOTONIC = global i32 0
@.str = [4 x i8] c"%f\09\00"
@.str.1 = [4 x i8] c"%f\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.timespec
%4 = alloca %struct.timespec
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @atoi(i8* %6)
%8 = bitcast %struct.timespec* %3 to i8*
%9 = bitcast %struct.timespec* %4 to i8*
%10 = tail call i32 @time(i32* null)
%11 = tail call i32 @srand(i32 %10)
%12 = mul nsw i32 %7, %7
%13 = tail call i64 @calloc(i32 8, i32 %12)
%14 = inttoptr i64 %13 to double*
%15 = icmp eq i32 %12, 0
br i1 %15, label %16, label %19
16: ; preds = %2
%17 = tail call i64 @calloc(i32 8, i32 %12)
%18 = inttoptr i64 %17 to double*
br label %40
19: ; preds = %2
%20 = zext i32 %12 to i64
br label %21
21: ; preds = %19, %21
%22 = phi i64 [ 0, %19 ], [ %26, %21 ]
%23 = tail call double (...) @rand()
%24 = fdiv double %23, 1.000000e+06
%25 = getelementptr inbounds double, double* %14, i64 %22
store double %24, double* %25
%26 = add nuw nsw i64 %22, 1
%27 = icmp eq i64 %26, %20
br i1 %27, label %28, label %21
28: ; preds = %21
%29 = tail call i64 @calloc(i32 8, i32 %12)
%30 = inttoptr i64 %29 to double*
br i1 %15, label %40, label %31
31: ; preds = %28
%32 = zext i32 %12 to i64
br label %33
33: ; preds = %31, %33
%34 = phi i64 [ 0, %31 ], [ %38, %33 ]
%35 = tail call double (...) @rand()
%36 = fdiv double %35, 1.000000e+06
%37 = getelementptr inbounds double, double* %30, i64 %34
store double %36, double* %37
%38 = add nuw nsw i64 %34, 1
%39 = icmp eq i64 %38, %32
br i1 %39, label %40, label %33
40: ; preds = %33, %16, %28
%41 = phi double* [ %18, %16 ], [ %30, %28 ], [ %30, %33 ]
%42 = tail call i64 @calloc(i32 8, i32 %12)
%43 = inttoptr i64 %42 to double*
%44 = tail call i64 @calloc(i32 8, i32 %12)
%45 = inttoptr i64 %44 to double*
%46 = tail call i64 @calloc(i32 8, i32 %12)
%47 = inttoptr i64 %46 to double*
%48 = tail call i64 @calloc(i32 8, i32 %12)
%49 = inttoptr i64 %48 to double*
%50 = load i32, i32* @CLOCK_MONOTONIC
%51 = call i32 @clock_gettime(i32 %50, %struct.timespec* %3)
%52 = call i32 @dgemm0(double* %14, double* %41, double* %43, i32 %7)
%53 = load i32, i32* @CLOCK_MONOTONIC
%54 = call i32 @clock_gettime(i32 %53, %struct.timespec* %4)
%55 = getelementptr inbounds %struct.timespec, %struct.timespec* %4, i64 0, i32 0
%56 = load i64, i64* %55
%57 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i64 0, i32 0
%58 = load i64, i64* %57
%59 = sub nsw i64 %56, %58
%60 = mul nsw i64 %59, 1000000000
%61 = sitofp i64 %60 to double
%62 = getelementptr inbounds %struct.timespec, %struct.timespec* %4, i64 0, i32 1
%63 = load double, double* %62
%64 = fadd double %63, %61
%65 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i64 0, i32 1
%66 = load double, double* %65
%67 = fsub double %64, %66
%68 = fdiv double %67, 1.000000e+09
%69 = fptrunc double %68 to float
%70 = fpext float %69 to double
%71 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %70)
%72 = load i32, i32* @CLOCK_MONOTONIC
%73 = call i32 @clock_gettime(i32 %72, %struct.timespec* %3)
%74 = call i32 @dgemm1(double* %14, double* %41, double* %45, i32 %7)
%75 = load i32, i32* @CLOCK_MONOTONIC
%76 = call i32 @clock_gettime(i32 %75, %struct.timespec* %4)
%77 = load i64, i64* %55
%78 = load i64, i64* %57
%79 = sub nsw i64 %77, %78
%80 = mul nsw i64 %79, 1000000000
%81 = sitofp i64 %80 to double
%82 = load double, double* %62
%83 = fadd double %82, %81
%84 = load double, double* %65
%85 = fsub double %83, %84
%86 = fdiv double %85, 1.000000e+09
%87 = fptrunc double %86 to float
%88 = fpext float %87 to double
%89 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %88)
%90 = load i32, i32* @CLOCK_MONOTONIC
%91 = call i32 @clock_gettime(i32 %90, %struct.timespec* %3)
%92 = call i32 @dgemm2(double* %14, double* %41, double* %47, i32 %7)
%93 = load i32, i32* @CLOCK_MONOTONIC
%94 = call i32 @clock_gettime(i32 %93, %struct.timespec* %4)
%95 = load i64, i64* %55
%96 = load i64, i64* %57
%97 = sub nsw i64 %95, %96
%98 = mul nsw i64 %97, 1000000000
%99 = sitofp i64 %98 to double
%100 = load double, double* %62
%101 = fadd double %100, %99
%102 = load double, double* %65
%103 = fsub double %101, %102
%104 = fdiv double %103, 1.000000e+09
%105 = fptrunc double %104 to float
%106 = fpext float %105 to double
%107 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %106)
%108 = load i32, i32* @CLOCK_MONOTONIC
%109 = call i32 @clock_gettime(i32 %108, %struct.timespec* %3)
%110 = call i32 @dgemm3(double* %14, double* %41, double* %49, i32 %7)
%111 = load i32, i32* @CLOCK_MONOTONIC
%112 = call i32 @clock_gettime(i32 %111, %struct.timespec* %4)
%113 = load i64, i64* %55
%114 = load i64, i64* %57
%115 = sub nsw i64 %113, %114
%116 = mul nsw i64 %115, 1000000000
%117 = sitofp i64 %116 to double
%118 = load double, double* %62
%119 = fadd double %118, %117
%120 = load double, double* %65
%121 = fsub double %119, %120
%122 = fdiv double %121, 1.000000e+09
%123 = fptrunc double %122 to float
%124 = fpext float %123 to double
%125 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %124)
%126 = call double @verification(double* %14, double* %41, double* %43, double* %45, i32 %7)
%127 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %126)
%128 = call double @verification(double* %14, double* %41, double* %43, double* %47, i32 %7)
%129 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %128)
%130 = call double @verification(double* %14, double* %41, double* %43, double* %49, i32 %7)
%131 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %130)
ret i32 0
}