#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);
int /*<<< orphan*/ dgemm3(double *, double *, double *, int);
int /*<<< orphan*/ printf(char *, ...);
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 BLOCK_SIZE = atoi(argv[1]);
  int n = atoi(argv[2]);
  uint64_t t0;
  float t;
  struct timespec begin, end;
  double *a, *b;
  double *c0, *c1, *c2;
  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;
    a[i] = 1;
  }
  b = (double *)calloc(sizeof(double), n * n);
  for (i = 0; i < n * n; i++) {
    b[i] = rand() / 1000000.0;
    b[i] = 1;
  }
  c0 = (double *)calloc(sizeof(double), n * n);
  c1 = (double *)calloc(sizeof(double), n * n);
  c2 = (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, BLOCK_SIZE);
  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, 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);
  diff = verification(a, b, c0, c2, n);
  printf("%f\n", diff);
  int j;
  for (i = 0; i < n; i++)
    for (j = 0; j < n; j++)
      printf("%f ", c0[i * n + j]);
  printf("\n");
  for (i = 0; i < n; i++)
    for (j = 0; j < n; j++)
      printf("%f ", c2[i * n + j]);
  printf("\n");
  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)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10c0 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10c0 <atoi@plt>
mov    %eax,-0x18(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1090 <time@plt>
mov    %eax,%edi
call   1070 <srand@plt>
mov    -0x18(%rbp),%esi
imul   -0x18(%rbp),%esi
mov    $0x8,%edi
call   1080 <calloc@plt>
mov    %rax,-0x50(%rbp)
movl   $0x0,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
mov    -0x18(%rbp),%ecx
imul   -0x18(%rbp),%ecx
cmp    %ecx,%eax
jge    126a <main+0xba>
mov    $0x0,%al
call   10d0 <rand@plt>
movsd  0xdda(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x50(%rbp),%rax
movslq -0x7c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x50(%rbp),%rax
movslq -0x7c(%rbp),%rcx
movsd  0xdb1(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    1215 <main+0x65>
mov    -0x18(%rbp),%esi
imul   -0x18(%rbp),%esi
mov    $0x8,%edi
call   1080 <calloc@plt>
mov    %rax,-0x58(%rbp)
movl   $0x0,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
mov    -0x18(%rbp),%ecx
imul   -0x18(%rbp),%ecx
cmp    %ecx,%eax
jge    12db <main+0x12b>
mov    $0x0,%al
call   10d0 <rand@plt>
movsd  0xd69(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x58(%rbp),%rax
movslq -0x7c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x58(%rbp),%rax
movslq -0x7c(%rbp),%rcx
movsd  0xd40(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    1286 <main+0xd6>
mov    -0x18(%rbp),%esi
imul   -0x18(%rbp),%esi
mov    $0x8,%edi
call   1080 <calloc@plt>
mov    %rax,-0x60(%rbp)
mov    -0x18(%rbp),%esi
imul   -0x18(%rbp),%esi
mov    $0x8,%edi
call   1080 <calloc@plt>
mov    %rax,-0x68(%rbp)
mov    -0x18(%rbp),%esi
imul   -0x18(%rbp),%esi
mov    $0x8,%edi
call   1080 <calloc@plt>
mov    %rax,-0x70(%rbp)
mov    0x2cc7(%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    -0x18(%rbp),%ecx
call   10b0 <dgemm0@plt>
mov    0x2ca1(%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  0xc7e(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xc79(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    0x2c3b(%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    -0x18(%rbp),%ecx
mov    -0x14(%rbp),%r8d
call   1050 <dgemm1@plt>
mov    0x2c11(%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  0xbee(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xbe9(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    0x2bab(%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    -0x18(%rbp),%ecx
call   1030 <dgemm3@plt>
mov    0x2b85(%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  0xb62(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xb5d(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    -0x50(%rbp),%rdi
mov    -0x58(%rbp),%rsi
mov    -0x60(%rbp),%rdx
mov    -0x70(%rbp),%rcx
mov    -0x18(%rbp),%r8d
call   10a0 <verification@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x78(%rbp),%xmm0
lea    0xb30(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movl   $0x0,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    155e <main+0x3ae>
movl   $0x0,-0x80(%rbp)
mov    -0x80(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    154b <main+0x39b>
mov    -0x60(%rbp),%rax
mov    -0x7c(%rbp),%ecx
imul   -0x18(%rbp),%ecx
add    -0x80(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xaea(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    -0x80(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x80(%rbp)
jmp    150d <main+0x35d>
jmp    1550 <main+0x3a0>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    14fa <main+0x34a>
lea    0xab9(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    15d7 <main+0x427>
movl   $0x0,-0x80(%rbp)
mov    -0x80(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    15c4 <main+0x414>
mov    -0x70(%rbp),%rax
mov    -0x7c(%rbp),%ecx
imul   -0x18(%rbp),%ecx
add    -0x80(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xa71(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    -0x80(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x80(%rbp)
jmp    1586 <main+0x3d6>
jmp    15c9 <main+0x419>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    1573 <main+0x3c3>
lea    0xa40(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   10d0 <atoi@plt>
mov    %eax,%r14d
mov    0x10(%rbx),%rdi
call   10d0 <atoi@plt>
mov    %eax,%ebp
xor    %edi,%edi
call   10a0 <time@plt>
mov    %eax,%edi
call   1080 <srand@plt>
mov    %ebp,%r12d
imul   %ebp,%r12d
mov    $0x8,%edi
mov    %r12d,%esi
call   1090 <calloc@plt>
mov    %rax,%r15
test   %r12d,%r12d
mov    %ebp,0x4(%rsp)
mov    %r14d,0x28(%rsp)
je     127b <main+0xbb>
mov    %r12d,%ebp
movabs $0x3ff0000000000000,%r14
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   10e0 <rand@plt>
mov    %r14,(%r15,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1230 <main+0x70>
mov    $0x8,%edi
mov    %r12d,%esi
call   1090 <calloc@plt>
mov    %rax,%r13
test   %r12d,%r12d
je     1275 <main+0xb5>
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   10e0 <rand@plt>
mov    %r14,0x0(%r13,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1260 <main+0xa0>
mov    0x4(%rsp),%ebp
jmp    128b <main+0xcb>
mov    $0x8,%edi
mov    %r12d,%esi
call   1090 <calloc@plt>
mov    %rax,%r13
mov    $0x8,%edi
mov    %r12d,%esi
call   1090 <calloc@plt>
mov    %rax,%r14
mov    $0x8,%edi
mov    %r12d,%esi
call   1090 <calloc@plt>
mov    %rax,0x30(%rsp)
mov    $0x8,%edi
mov    %r12d,%esi
call   1090 <calloc@plt>
mov    %rax,%r12
mov    0x2d24(%rip),%rbx
mov    (%rbx),%edi
lea    0x18(%rsp),%rsi
call   1050 <clock_gettime@plt>
mov    %r15,%rdi
mov    %r13,%rsi
mov    %r14,%rdx
mov    %ebp,%ecx
call   10c0 <dgemm0@plt>
mov    (%rbx),%edi
lea    0x8(%rsp),%rsi
call   1050 <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  0xce7(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xce0(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
mov    (%rbx),%edi
lea    0x18(%rsp),%rsi
call   1050 <clock_gettime@plt>
mov    %r15,%rdi
mov    %r13,%rsi
mov    0x30(%rsp),%rdx
mov    %ebp,%ecx
mov    0x28(%rsp),%r8d
call   1060 <dgemm1@plt>
mov    (%rbx),%edi
lea    0x8(%rsp),%rsi
call   1050 <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  0xc75(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xc6e(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
mov    (%rbx),%edi
lea    0x18(%rsp),%rsi
call   1050 <clock_gettime@plt>
mov    %r15,%rdi
mov    %r13,%rsi
mov    %r12,%rdx
mov    %ebp,%ecx
call   1040 <dgemm3@plt>
mov    (%rbx),%edi
lea    0x8(%rsp),%rsi
call   1050 <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  0xc0a(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xc03(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
mov    %r15,%rdi
mov    %r13,%rsi
mov    %r14,%rdx
mov    %r12,%rcx
mov    %ebp,%r8d
call   10b0 <verification@plt>
lea    0xbe5(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
test   %ebp,%ebp
jle    14e7 <main+0x327>
mov    %ebp,%ebp
lea    0x0(,%rbp,8),%rax
mov    %rax,0x28(%rsp)
xor    %r13d,%r13d
lea    0xbc1(%rip),%rbx
nop
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  (%r14,%r15,8),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1070 <printf@plt>
add    $0x1,%r15
cmp    %r15,%rbp
jne    1460 <main+0x2a0>
add    $0x1,%r13
add    0x28(%rsp),%r14
cmp    %rbp,%r13
jne    1450 <main+0x290>
mov    $0xa,%edi
call   1030 <putchar@plt>
cmpl   $0x0,0x4(%rsp)
jle    14f1 <main+0x331>
lea    0x0(,%rbp,8),%r14
xor    %r15d,%r15d
lea    0xb66(%rip),%r13
nopw   0x0(%rax,%rax,1)
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  (%r12,%rbx,8),%xmm0
mov    %r13,%rdi
mov    $0x1,%al
call   1070 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    14c0 <main+0x300>
add    $0x1,%r15
add    %r14,%r12
cmp    %rbp,%r15
jne    14b0 <main+0x2f0>
jmp    14f1 <main+0x331>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x38,%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"
@.str.2 = [4 x i8] c"%f \00"
@.str.3 = [2 x i8] c"\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 double
%9 = alloca float
%10 = alloca %struct.timespec
%11 = alloca %struct.timespec
%12 = alloca double*
%13 = alloca double*
%14 = alloca double*
%15 = alloca double*
%16 = alloca double*
%17 = alloca double
%18 = alloca i32
%19 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = call i32 @atoi(i8* %22)
store i32 %23, i32* %6
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 2
%26 = load i8*, i8** %25
%27 = call i32 @atoi(i8* %26)
store i32 %27, i32* %7
%28 = call i32 @time(i32* null)
%29 = call i32 @srand(i32 %28)
%30 = load i32, i32* %7
%31 = load i32, i32* %7
%32 = mul nsw i32 %30, %31
%33 = call i64 @calloc(i32 8, i32 %32)
%34 = inttoptr i64 %33 to double*
store double* %34, double** %12
store i32 0, i32* %18
br label %35
35: ; preds = %52, %2
%36 = load i32, i32* %18
%37 = load i32, i32* %7
%38 = load i32, i32* %7
%39 = mul nsw i32 %37, %38
%40 = icmp slt i32 %36, %39
br i1 %40, label %41, label %55
41: ; preds = %35
%42 = call double (...) @rand()
%43 = fdiv double %42, 1.000000e+06
%44 = load double*, double** %12
%45 = load i32, i32* %18
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds double, double* %44, i64 %46
store double %43, double* %47
%48 = load double*, double** %12
%49 = load i32, i32* %18
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds double, double* %48, i64 %50
store double 1.000000e+00, double* %51
br label %52
52: ; preds = %41
%53 = load i32, i32* %18
%54 = add nsw i32 %53, 1
store i32 %54, i32* %18
br label %35
55: ; preds = %35
%56 = load i32, i32* %7
%57 = load i32, i32* %7
%58 = mul nsw i32 %56, %57
%59 = call i64 @calloc(i32 8, i32 %58)
%60 = inttoptr i64 %59 to double*
store double* %60, double** %13
store i32 0, i32* %18
br label %61
61: ; preds = %78, %55
%62 = load i32, i32* %18
%63 = load i32, i32* %7
%64 = load i32, i32* %7
%65 = mul nsw i32 %63, %64
%66 = icmp slt i32 %62, %65
br i1 %66, label %67, label %81
67: ; preds = %61
%68 = call double (...) @rand()
%69 = fdiv double %68, 1.000000e+06
%70 = load double*, double** %13
%71 = load i32, i32* %18
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds double, double* %70, i64 %72
store double %69, double* %73
%74 = load double*, double** %13
%75 = load i32, i32* %18
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds double, double* %74, i64 %76
store double 1.000000e+00, double* %77
br label %78
78: ; preds = %67
%79 = load i32, i32* %18
%80 = add nsw i32 %79, 1
store i32 %80, i32* %18
br label %61
81: ; preds = %61
%82 = load i32, i32* %7
%83 = load i32, i32* %7
%84 = mul nsw i32 %82, %83
%85 = call i64 @calloc(i32 8, i32 %84)
%86 = inttoptr i64 %85 to double*
store double* %86, double** %14
%87 = load i32, i32* %7
%88 = load i32, i32* %7
%89 = mul nsw i32 %87, %88
%90 = call i64 @calloc(i32 8, i32 %89)
%91 = inttoptr i64 %90 to double*
store double* %91, double** %15
%92 = load i32, i32* %7
%93 = load i32, i32* %7
%94 = mul nsw i32 %92, %93
%95 = call i64 @calloc(i32 8, i32 %94)
%96 = inttoptr i64 %95 to double*
store double* %96, double** %16
%97 = load i32, i32* @CLOCK_MONOTONIC
%98 = call i32 @clock_gettime(i32 %97, %struct.timespec* %10)
%99 = load double*, double** %12
%100 = load double*, double** %13
%101 = load double*, double** %14
%102 = load i32, i32* %7
%103 = call i32 @dgemm0(double* %99, double* %100, double* %101, i32 %102)
%104 = load i32, i32* @CLOCK_MONOTONIC
%105 = call i32 @clock_gettime(i32 %104, %struct.timespec* %11)
%106 = getelementptr inbounds %struct.timespec, %struct.timespec* %11, i32 0, i32 0
%107 = load i64, i64* %106
%108 = getelementptr inbounds %struct.timespec, %struct.timespec* %10, i32 0, i32 0
%109 = load i64, i64* %108
%110 = sub nsw i64 %107, %109
%111 = mul nsw i64 1000000000, %110
%112 = sitofp i64 %111 to double
%113 = getelementptr inbounds %struct.timespec, %struct.timespec* %11, i32 0, i32 1
%114 = load double, double* %113
%115 = fadd double %112, %114
%116 = getelementptr inbounds %struct.timespec, %struct.timespec* %10, i32 0, i32 1
%117 = load double, double* %116
%118 = fsub double %115, %117
store double %118, double* %8
%119 = load double, double* %8
%120 = fdiv double %119, 1.000000e+09
%121 = fptrunc double %120 to float
store float %121, float* %9
%122 = load float, float* %9
%123 = fpext float %122 to double
%124 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %123)
%125 = load i32, i32* @CLOCK_MONOTONIC
%126 = call i32 @clock_gettime(i32 %125, %struct.timespec* %10)
%127 = load double*, double** %12
%128 = load double*, double** %13
%129 = load double*, double** %15
%130 = load i32, i32* %7
%131 = load i32, i32* %6
%132 = call i32 @dgemm1(double* %127, double* %128, double* %129, i32 %130, i32 %131)
%133 = load i32, i32* @CLOCK_MONOTONIC
%134 = call i32 @clock_gettime(i32 %133, %struct.timespec* %11)
%135 = getelementptr inbounds %struct.timespec, %struct.timespec* %11, i32 0, i32 0
%136 = load i64, i64* %135
%137 = getelementptr inbounds %struct.timespec, %struct.timespec* %10, i32 0, i32 0
%138 = load i64, i64* %137
%139 = sub nsw i64 %136, %138
%140 = mul nsw i64 1000000000, %139
%141 = sitofp i64 %140 to double
%142 = getelementptr inbounds %struct.timespec, %struct.timespec* %11, i32 0, i32 1
%143 = load double, double* %142
%144 = fadd double %141, %143
%145 = getelementptr inbounds %struct.timespec, %struct.timespec* %10, i32 0, i32 1
%146 = load double, double* %145
%147 = fsub double %144, %146
store double %147, double* %8
%148 = load double, double* %8
%149 = fdiv double %148, 1.000000e+09
%150 = fptrunc double %149 to float
store float %150, float* %9
%151 = load float, float* %9
%152 = fpext float %151 to double
%153 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %152)
%154 = load i32, i32* @CLOCK_MONOTONIC
%155 = call i32 @clock_gettime(i32 %154, %struct.timespec* %10)
%156 = load double*, double** %12
%157 = load double*, double** %13
%158 = load double*, double** %16
%159 = load i32, i32* %7
%160 = call i32 @dgemm3(double* %156, double* %157, double* %158, i32 %159)
%161 = load i32, i32* @CLOCK_MONOTONIC
%162 = call i32 @clock_gettime(i32 %161, %struct.timespec* %11)
%163 = getelementptr inbounds %struct.timespec, %struct.timespec* %11, i32 0, i32 0
%164 = load i64, i64* %163
%165 = getelementptr inbounds %struct.timespec, %struct.timespec* %10, i32 0, i32 0
%166 = load i64, i64* %165
%167 = sub nsw i64 %164, %166
%168 = mul nsw i64 1000000000, %167
%169 = sitofp i64 %168 to double
%170 = getelementptr inbounds %struct.timespec, %struct.timespec* %11, i32 0, i32 1
%171 = load double, double* %170
%172 = fadd double %169, %171
%173 = getelementptr inbounds %struct.timespec, %struct.timespec* %10, i32 0, i32 1
%174 = load double, double* %173
%175 = fsub double %172, %174
store double %175, double* %8
%176 = load double, double* %8
%177 = fdiv double %176, 1.000000e+09
%178 = fptrunc double %177 to float
store float %178, float* %9
%179 = load float, float* %9
%180 = fpext float %179 to double
%181 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %180)
%182 = load double*, double** %12
%183 = load double*, double** %13
%184 = load double*, double** %14
%185 = load double*, double** %16
%186 = load i32, i32* %7
%187 = call double @verification(double* %182, double* %183, double* %184, double* %185, i32 %186)
store double %187, double* %17
%188 = load double, double* %17
%189 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %188)
store i32 0, i32* %18
br label %190
190: ; preds = %214, %81
%191 = load i32, i32* %18
%192 = load i32, i32* %7
%193 = icmp slt i32 %191, %192
br i1 %193, label %194, label %217
194: ; preds = %190
store i32 0, i32* %19
br label %195
195: ; preds = %210, %194
%196 = load i32, i32* %19
%197 = load i32, i32* %7
%198 = icmp slt i32 %196, %197
br i1 %198, label %199, label %213
199: ; preds = %195
%200 = load double*, double** %14
%201 = load i32, i32* %18
%202 = load i32, i32* %7
%203 = mul nsw i32 %201, %202
%204 = load i32, i32* %19
%205 = add nsw i32 %203, %204
%206 = sext i32 %205 to i64
%207 = getelementptr inbounds double, double* %200, i64 %206
%208 = load double, double* %207
%209 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double %208)
br label %210
210: ; preds = %199
%211 = load i32, i32* %19
%212 = add nsw i32 %211, 1
store i32 %212, i32* %19
br label %195
213: ; preds = %195
br label %214
214: ; preds = %213
%215 = load i32, i32* %18
%216 = add nsw i32 %215, 1
store i32 %216, i32* %18
br label %190
217: ; preds = %190
%218 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %18
br label %219
219: ; preds = %243, %217
%220 = load i32, i32* %18
%221 = load i32, i32* %7
%222 = icmp slt i32 %220, %221
br i1 %222, label %223, label %246
223: ; preds = %219
store i32 0, i32* %19
br label %224
224: ; preds = %239, %223
%225 = load i32, i32* %19
%226 = load i32, i32* %7
%227 = icmp slt i32 %225, %226
br i1 %227, label %228, label %242
228: ; preds = %224
%229 = load double*, double** %16
%230 = load i32, i32* %18
%231 = load i32, i32* %7
%232 = mul nsw i32 %230, %231
%233 = load i32, i32* %19
%234 = add nsw i32 %232, %233
%235 = sext i32 %234 to i64
%236 = getelementptr inbounds double, double* %229, i64 %235
%237 = load double, double* %236
%238 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double %237)
br label %239
239: ; preds = %228
%240 = load i32, i32* %19
%241 = add nsw i32 %240, 1
store i32 %241, i32* %19
br label %224
242: ; preds = %224
br label %243
243: ; preds = %242
%244 = load i32, i32* %18
%245 = add nsw i32 %244, 1
store i32 %245, i32* %18
br label %219
246: ; preds = %219
%247 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
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"
@.str.2 = [4 x i8] c"%f \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 = getelementptr inbounds i8*, i8** %1, i64 2
%9 = load i8*, i8** %8
%10 = tail call i32 @atoi(i8* %9)
%11 = bitcast %struct.timespec* %3 to i8*
%12 = bitcast %struct.timespec* %4 to i8*
%13 = tail call i32 @time(i32* null)
%14 = tail call i32 @srand(i32 %13)
%15 = mul nsw i32 %10, %10
%16 = tail call i64 @calloc(i32 8, i32 %15)
%17 = inttoptr i64 %16 to double*
%18 = icmp eq i32 %15, 0
br i1 %18, label %19, label %22
19: ; preds = %2
%20 = tail call i64 @calloc(i32 8, i32 %15)
%21 = inttoptr i64 %20 to double*
br label %41
22: ; preds = %2
%23 = zext i32 %15 to i64
br label %24
24: ; preds = %22, %24
%25 = phi i64 [ 0, %22 ], [ %28, %24 ]
%26 = tail call double (...) @rand()
%27 = getelementptr inbounds double, double* %17, i64 %25
store double 1.000000e+00, double* %27
%28 = add nuw nsw i64 %25, 1
%29 = icmp eq i64 %28, %23
br i1 %29, label %30, label %24
30: ; preds = %24
%31 = tail call i64 @calloc(i32 8, i32 %15)
%32 = inttoptr i64 %31 to double*
br i1 %18, label %41, label %33
33: ; preds = %30
%34 = zext i32 %15 to i64
br label %35
35: ; preds = %33, %35
%36 = phi i64 [ 0, %33 ], [ %39, %35 ]
%37 = tail call double (...) @rand()
%38 = getelementptr inbounds double, double* %32, i64 %36
store double 1.000000e+00, double* %38
%39 = add nuw nsw i64 %36, 1
%40 = icmp eq i64 %39, %34
br i1 %40, label %41, label %35
41: ; preds = %35, %19, %30
%42 = phi double* [ %21, %19 ], [ %32, %30 ], [ %32, %35 ]
%43 = tail call i64 @calloc(i32 8, i32 %15)
%44 = inttoptr i64 %43 to double*
%45 = tail call i64 @calloc(i32 8, i32 %15)
%46 = inttoptr i64 %45 to double*
%47 = tail call i64 @calloc(i32 8, i32 %15)
%48 = inttoptr i64 %47 to double*
%49 = load i32, i32* @CLOCK_MONOTONIC
%50 = call i32 @clock_gettime(i32 %49, %struct.timespec* %3)
%51 = call i32 @dgemm0(double* %17, double* %42, double* %44, i32 %10)
%52 = load i32, i32* @CLOCK_MONOTONIC
%53 = call i32 @clock_gettime(i32 %52, %struct.timespec* %4)
%54 = getelementptr inbounds %struct.timespec, %struct.timespec* %4, i64 0, i32 0
%55 = load i64, i64* %54
%56 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i64 0, i32 0
%57 = load i64, i64* %56
%58 = sub nsw i64 %55, %57
%59 = mul nsw i64 %58, 1000000000
%60 = sitofp i64 %59 to double
%61 = getelementptr inbounds %struct.timespec, %struct.timespec* %4, i64 0, i32 1
%62 = load double, double* %61
%63 = fadd double %62, %60
%64 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i64 0, i32 1
%65 = load double, double* %64
%66 = fsub double %63, %65
%67 = fdiv double %66, 1.000000e+09
%68 = fptrunc double %67 to float
%69 = fpext float %68 to double
%70 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %69)
%71 = load i32, i32* @CLOCK_MONOTONIC
%72 = call i32 @clock_gettime(i32 %71, %struct.timespec* %3)
%73 = call i32 @dgemm1(double* %17, double* %42, double* %46, i32 %10, i32 %7)
%74 = load i32, i32* @CLOCK_MONOTONIC
%75 = call i32 @clock_gettime(i32 %74, %struct.timespec* %4)
%76 = load i64, i64* %54
%77 = load i64, i64* %56
%78 = sub nsw i64 %76, %77
%79 = mul nsw i64 %78, 1000000000
%80 = sitofp i64 %79 to double
%81 = load double, double* %61
%82 = fadd double %81, %80
%83 = load double, double* %64
%84 = fsub double %82, %83
%85 = fdiv double %84, 1.000000e+09
%86 = fptrunc double %85 to float
%87 = fpext float %86 to double
%88 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %87)
%89 = load i32, i32* @CLOCK_MONOTONIC
%90 = call i32 @clock_gettime(i32 %89, %struct.timespec* %3)
%91 = call i32 @dgemm3(double* %17, double* %42, double* %48, i32 %10)
%92 = load i32, i32* @CLOCK_MONOTONIC
%93 = call i32 @clock_gettime(i32 %92, %struct.timespec* %4)
%94 = load i64, i64* %54
%95 = load i64, i64* %56
%96 = sub nsw i64 %94, %95
%97 = mul nsw i64 %96, 1000000000
%98 = sitofp i64 %97 to double
%99 = load double, double* %61
%100 = fadd double %99, %98
%101 = load double, double* %64
%102 = fsub double %100, %101
%103 = fdiv double %102, 1.000000e+09
%104 = fptrunc double %103 to float
%105 = fpext float %104 to double
%106 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %105)
%107 = call double @verification(double* %17, double* %42, double* %44, double* %48, i32 %10)
%108 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %107)
%109 = icmp sgt i32 %10, 0
br i1 %109, label %112, label %110
110: ; preds = %41
%111 = call i32 @putchar(i32 10)
br label %148
112: ; preds = %41
%113 = zext i32 %10 to i64
%114 = zext i32 %10 to i64
br label %115
115: ; preds = %126, %112
%116 = phi i64 [ 0, %112 ], [ %127, %126 ]
%117 = mul nsw i64 %116, %113
br label %118
118: ; preds = %115, %118
%119 = phi i64 [ 0, %115 ], [ %124, %118 ]
%120 = add nuw nsw i64 %119, %117
%121 = getelementptr inbounds double, double* %44, i64 %120
%122 = load double, double* %121
%123 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double %122)
%124 = add nuw nsw i64 %119, 1
%125 = icmp eq i64 %124, %114
br i1 %125, label %126, label %118
126: ; preds = %118
%127 = add nuw nsw i64 %116, 1
%128 = icmp eq i64 %127, %114
br i1 %128, label %129, label %115
129: ; preds = %126
%130 = call i32 @putchar(i32 10)
br i1 %109, label %131, label %148
131: ; preds = %129
%132 = zext i32 %10 to i64
%133 = zext i32 %10 to i64
br label %134
134: ; preds = %145, %131
%135 = phi i64 [ 0, %131 ], [ %146, %145 ]
%136 = mul nsw i64 %135, %132
br label %137
137: ; preds = %134, %137
%138 = phi i64 [ 0, %134 ], [ %143, %137 ]
%139 = add nuw nsw i64 %138, %136
%140 = getelementptr inbounds double, double* %48, i64 %139
%141 = load double, double* %140
%142 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double %141)
%143 = add nuw nsw i64 %138, 1
%144 = icmp eq i64 %143, %133
br i1 %144, label %145, label %137
145: ; preds = %137
%146 = add nuw nsw i64 %135, 1
%147 = icmp eq i64 %146, %133
br i1 %147, label %148, label %134
148: ; preds = %145, %110, %129
%149 = call i32 @putchar(i32 10)
ret i32 0
}