#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 */
struct timeval {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
scalar_t__ RAND_MAX;
int /*<<< orphan*/ dgemm_(char *, char *, int *, int *, int *, double *,
                          double *, int *, double *, int *, double *, double *,
                          int *);
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
void *malloc(size_t);
int /*<<< orphan*/ printf(char *, int, int, int, double, double, double);
scalar_t__ rand();
int main(int argc, char *argv[]) {
  struct timeval tv;
  double start, end, timec;
  int lda, ldb;
  int m = 4096;
  int n = 4096;
  int k = 4096;
  char transa = 'N';
  char transb = 'T';
  if (transa == 'N')
    lda = m;
  else
    lda = k;
  if (transb == 'N')
    ldb = k;
  else
    ldb = n;
  int ldc = m;
  unsigned long i, j;
  double alpha = 2.0;
  double beta = 2.0;
  void *a1, *b1, *c1, *c2;
  double *a, *b, *cg, *cc;
  a1 = malloc((size_t)32768 * 8192 * 4);
  b1 = malloc((size_t)32768 * 8192 * 4);
  c1 = malloc((size_t)32768 * 32768 * 4);
  c2 = malloc((size_t)32768 * 32768 * 4);
  a = (double *)a1;
  b = (double *)b1;
  cg = (double *)c1;
  cc = (double *)c2;
  for (i = 0; i < m; i++) {
    for (j = 0; j < k; j++) {
      *a = (((double)rand() / (double)RAND_MAX) - 0.5) * 1e-1;
      a++;
    }
  }
  for (i = 0; i < k; i++) {
    for (j = 0; j < n; j++) {
      *b = (((double)rand() / (double)RAND_MAX) - 0.5) * 1e-1;
      b++;
    }
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      *cc = (double)0.0;
      *cg = (double)0.0;
      cc++;
      cg++;
    }
  }
  a = (double *)a1;
  b = (double *)b1;
  cg = (double *)c1;
  cc = (double *)c2;
  gettimeofday(&tv, NULL);
  start = (double)tv.tv_sec + (double)tv.tv_usec * 1.e-6;
  dgemm_(&transa, &transb, &m, &n, &k, &alpha, a, &lda, b, &ldb, &beta, cc,
         &ldc);
  gettimeofday(&tv, NULL);
  end = (double)tv.tv_sec + (double)tv.tv_usec * 1.e-6;
  timec = end - start;
  double fp = (2.0 * (double)m * n * k) * (double)1.0e-9;
  double gflops = fp / timec;
  printf("GPU: %dx%dx%d size\t%10.8f sec\t%10.6f GFlop\t%10.8f GFlops\n", m, n,
         k, timec, fp, gflops);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x100,%rsp
movl   $0x0,-0x24(%rbp)
mov    %edi,-0x28(%rbp)
mov    %rsi,-0x30(%rbp)
movl   $0x1000,-0x64(%rbp)
movl   $0x1000,-0x68(%rbp)
movl   $0x1000,-0x6c(%rbp)
movb   $0x4e,-0x6d(%rbp)
movb   $0x54,-0x6e(%rbp)
movsbl -0x6d(%rbp),%eax
cmp    $0x4e,%eax
jne    11a5 <main+0x55>
mov    -0x64(%rbp),%eax
mov    %eax,-0x5c(%rbp)
jmp    11ab <main+0x5b>
mov    -0x6c(%rbp),%eax
mov    %eax,-0x5c(%rbp)
movsbl -0x6e(%rbp),%eax
cmp    $0x4e,%eax
jne    11c3 <main+0x73>
mov    -0x6c(%rbp),%eax
mov    %eax,-0x60(%rbp)
jmp    11c9 <main+0x79>
mov    -0x68(%rbp),%eax
mov    %eax,-0x60(%rbp)
mov    -0x64(%rbp),%eax
mov    %eax,-0x74(%rbp)
movsd  0xe29(%rip),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  0xe19(%rip),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
mov    $0x40000000,%edi
call   1060 <malloc@plt>
mov    %rax,-0xa0(%rbp)
mov    $0x40000000,%edi
call   1060 <malloc@plt>
mov    %rax,-0xa8(%rbp)
movabs $0x100000000,%rdi
call   1060 <malloc@plt>
mov    %rax,-0xb0(%rbp)
movabs $0x100000000,%rdi
call   1060 <malloc@plt>
mov    %rax,-0xb8(%rbp)
mov    -0xa0(%rbp),%rax
mov    %rax,-0xc0(%rbp)
mov    -0xa8(%rbp),%rax
mov    %rax,-0xc8(%rbp)
mov    -0xb0(%rbp),%rax
mov    %rax,-0xd0(%rbp)
mov    -0xb8(%rbp),%rax
mov    %rax,-0xd8(%rbp)
movq   $0x0,-0x80(%rbp)
mov    -0x80(%rbp),%rax
movslq -0x64(%rbp),%rcx
cmp    %rcx,%rax
jae    132b <main+0x1db>
movq   $0x0,-0x88(%rbp)
mov    -0x88(%rbp),%rax
movslq -0x6c(%rbp),%rcx
cmp    %rcx,%rax
jae    1315 <main+0x1c5>
mov    $0x0,%al
call   1070 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    0x2d28(%rip),%rax
cvtsi2sdq (%rax),%xmm1
divsd  %xmm1,%xmm0
movsd  0xd4f(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xd3b(%rip),%xmm1
mulsd  %xmm1,%xmm0
mov    -0xc0(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0xc0(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0xc0(%rbp)
mov    -0x88(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x88(%rbp)
jmp    1299 <main+0x149>
jmp    131a <main+0x1ca>
mov    -0x80(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x80(%rbp)
jmp    127d <main+0x12d>
movq   $0x0,-0x80(%rbp)
mov    -0x80(%rbp),%rax
movslq -0x6c(%rbp),%rcx
cmp    %rcx,%rax
jae    13e1 <main+0x291>
movq   $0x0,-0x88(%rbp)
mov    -0x88(%rbp),%rax
movslq -0x68(%rbp),%rcx
cmp    %rcx,%rax
jae    13cb <main+0x27b>
mov    $0x0,%al
call   1070 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    0x2c72(%rip),%rax
cvtsi2sdq (%rax),%xmm1
divsd  %xmm1,%xmm0
movsd  0xc99(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xc85(%rip),%xmm1
mulsd  %xmm1,%xmm0
mov    -0xc8(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0xc8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0xc8(%rbp)
mov    -0x88(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x88(%rbp)
jmp    134f <main+0x1ff>
jmp    13d0 <main+0x280>
mov    -0x80(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x80(%rbp)
jmp    1333 <main+0x1e3>
movq   $0x0,-0x80(%rbp)
mov    -0x80(%rbp),%rax
movslq -0x68(%rbp),%rcx
cmp    %rcx,%rax
jae    1486 <main+0x336>
movq   $0x0,-0x88(%rbp)
mov    -0x88(%rbp),%rax
movslq -0x64(%rbp),%rcx
cmp    %rcx,%rax
jae    1470 <main+0x320>
mov    -0xd8(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    -0xd0(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    -0xd8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0xd8(%rbp)
mov    -0xd0(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0xd0(%rbp)
mov    -0x88(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x88(%rbp)
jmp    1405 <main+0x2b5>
jmp    1475 <main+0x325>
mov    -0x80(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x80(%rbp)
jmp    13e9 <main+0x299>
mov    -0xa0(%rbp),%rax
mov    %rax,-0xc0(%rbp)
mov    -0xa8(%rbp),%rax
mov    %rax,-0xc8(%rbp)
mov    -0xb0(%rbp),%rax
mov    %rax,-0xd0(%rbp)
mov    -0xb8(%rbp),%rax
mov    %rax,-0xd8(%rbp)
lea    -0x40(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
cvtsi2sdq -0x38(%rbp),%xmm1
cvtsi2sdq -0x40(%rbp),%xmm0
movsd  0xb31(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0xc0(%rbp),%r12
mov    -0xc8(%rbp),%r14
mov    -0xd8(%rbp),%r10
lea    -0x6d(%rbp),%rdi
lea    -0x6e(%rbp),%rsi
lea    -0x64(%rbp),%rdx
lea    -0x68(%rbp),%rcx
lea    -0x6c(%rbp),%r8
lea    -0x90(%rbp),%r9
lea    -0x5c(%rbp),%r15
lea    -0x60(%rbp),%rbx
lea    -0x98(%rbp),%r11
lea    -0x74(%rbp),%rax
mov    %r12,(%rsp)
mov    %r15,0x8(%rsp)
mov    %r14,0x10(%rsp)
mov    %rbx,0x18(%rsp)
mov    %r11,0x20(%rsp)
mov    %r10,0x28(%rsp)
mov    %rax,0x30(%rsp)
call   1030 <dgemm_@plt>
lea    -0x40(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
cvtsi2sdq -0x38(%rbp),%xmm1
cvtsi2sdq -0x40(%rbp),%xmm0
movsd  0xa99(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
subsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
cvtsi2sdl -0x64(%rbp),%xmm1
movsd  0xa60(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x68(%rbp),%xmm1
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x6c(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xa4a(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xe0(%rbp)
ff
movsd  -0xe0(%rbp),%xmm0
ff
divsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0xe8(%rbp)
ff
mov    -0x64(%rbp),%esi
mov    -0x68(%rbp),%edx
mov    -0x6c(%rbp),%ecx
movsd  -0x58(%rbp),%xmm0
movsd  -0xe0(%rbp),%xmm1
ff
movsd  -0xe8(%rbp),%xmm2
ff
lea    0xa24(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
movl   $0x1000,0x10(%rsp)
movl   $0x1000,0xc(%rsp)
movl   $0x1000,0x8(%rsp)
movb   $0x4e,0x7(%rsp)
movb   $0x54,0x6(%rsp)
movl   $0x1000,0x1c(%rsp)
movl   $0x1000,0x18(%rsp)
movl   $0x1000,0x14(%rsp)
movabs $0x4000000000000000,%rax
mov    %rax,0x50(%rsp)
mov    %rax,0x48(%rsp)
mov    $0x40000000,%edi
call   1070 <malloc@plt>
mov    %rax,%r14
mov    $0x40000000,%edi
call   1070 <malloc@plt>
mov    %rax,%rbx
movabs $0x100000000,%r12
mov    %r12,%rdi
call   1070 <malloc@plt>
mov    %rax,%r13
mov    %r12,%rdi
call   1070 <malloc@plt>
mov    %rax,0x38(%rsp)
mov    0x2de9(%rip),%r12
xor    %ebp,%ebp
mov    %r14,0x40(%rsp)
cs nopw 0x0(%rax,%rax,1)
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1080 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdq (%r12),%xmm1
divsd  %xmm1,%xmm0
movsd  0xdbc(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xdb8(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,(%r14,%r15,1)
add    $0x8,%r15
cmp    $0x8000,%r15
jne    1220 <main+0xc0>
add    $0x1,%rbp
add    %r15,%r14
cmp    $0x1000,%rbp
jne    1210 <main+0xb0>
xor    %r14d,%r14d
mov    %rbx,%r15
mov    %rbx,%rbp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1080 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdq (%r12),%xmm1
divsd  %xmm1,%xmm0
addsd  0xd4c(%rip),%xmm0
mulsd  0xd4c(%rip),%xmm0
movsd  %xmm0,0x0(%rbp,%rbx,1)
add    $0x8,%rbx
cmp    $0x8000,%rbx
jne    1290 <main+0x130>
add    $0x1,%r14
add    %rbx,%rbp
cmp    $0x1000,%r14
jne    1280 <main+0x120>
xor    %ebp,%ebp
mov    0x38(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
lea    (%r12,%rbp,1),%rdi
mov    %r13,%rbx
add    %rbp,%rbx
mov    $0x8000,%edx
xor    %esi,%esi
call   1060 <memset@plt>
mov    $0x8000,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1060 <memset@plt>
lea    (%r12,%rbp,1),%rdi
add    $0x8000,%rdi
mov    $0x8000,%edx
xor    %esi,%esi
call   1060 <memset@plt>
lea    0x8000(,%rbp,1),%rdi
add    %r13,%rdi
mov    $0x8000,%edx
xor    %esi,%esi
call   1060 <memset@plt>
lea    (%r12,%rbp,1),%rdi
add    $0x10000,%rdi
mov    $0x8000,%edx
xor    %esi,%esi
call   1060 <memset@plt>
lea    0x10000(,%rbp,1),%rdi
add    %r13,%rdi
mov    $0x8000,%edx
xor    %esi,%esi
call   1060 <memset@plt>
lea    (%r12,%rbp,1),%rdi
add    $0x18000,%rdi
mov    $0x8000,%edx
xor    %esi,%esi
call   1060 <memset@plt>
lea    0x18000(,%rbp,1),%rdi
add    %r13,%rdi
mov    $0x8000,%edx
xor    %esi,%esi
call   1060 <memset@plt>
lea    (%r12,%rbp,1),%rdi
add    $0x20000,%rdi
mov    $0x8000,%edx
xor    %esi,%esi
call   1060 <memset@plt>
lea    0x20000(,%rbp,1),%rdi
add    %r13,%rdi
mov    $0x8000,%edx
xor    %esi,%esi
call   1060 <memset@plt>
lea    (%r12,%rbp,1),%rdi
add    $0x28000,%rdi
mov    $0x8000,%edx
xor    %esi,%esi
call   1060 <memset@plt>
lea    0x28000(,%rbp,1),%rdi
add    %r13,%rdi
mov    $0x8000,%edx
xor    %esi,%esi
call   1060 <memset@plt>
lea    (%r12,%rbp,1),%rdi
add    $0x30000,%rdi
mov    $0x8000,%edx
xor    %esi,%esi
call   1060 <memset@plt>
lea    0x30000(,%rbp,1),%rdi
add    %r13,%rdi
mov    $0x8000,%edx
xor    %esi,%esi
call   1060 <memset@plt>
lea    (%r12,%rbp,1),%rdi
add    $0x38000,%rdi
mov    $0x8000,%edx
xor    %esi,%esi
call   1060 <memset@plt>
lea    0x38000(,%rbp,1),%rdi
add    %r13,%rdi
mov    $0x8000,%edx
xor    %esi,%esi
call   1060 <memset@plt>
add    $0x40000,%rbp
cmp    $0x8000000,%rbp
jne    12f0 <main+0x190>
lea    0x20(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
call   1050 <gettimeofday@plt>
cvtsi2sdq 0x28(%rsp),%xmm0
cvtsi2sdq 0x20(%rsp),%xmm1
mulsd  0xb80(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x30(%rsp)
sub    $0x8,%rsp
lea    0x1c(%rsp),%rax
lea    0x50(%rsp),%rbp
lea    0x20(%rsp),%rbx
lea    0x24(%rsp),%r10
lea    0xf(%rsp),%rdi
lea    0xe(%rsp),%rsi
lea    0x18(%rsp),%rdx
lea    0x14(%rsp),%rcx
lea    0x10(%rsp),%r8
lea    0x58(%rsp),%r9
push   %rax
push   %r12
push   %rbp
push   %rbx
push   %r15
push   %r10
push   0x78(%rsp)
call   1030 <dgemm_@plt>
add    $0x40,%rsp
mov    %r14,%rdi
xor    %esi,%esi
call   1050 <gettimeofday@plt>
xorps  %xmm1,%xmm1
cvtsi2sdq 0x28(%rsp),%xmm1
xorps  %xmm0,%xmm0
cvtsi2sdq 0x20(%rsp),%xmm0
mulsd  0xb04(%rip),%xmm0
addsd  %xmm1,%xmm0
subsd  0x30(%rsp),%xmm0
mov    0x10(%rsp),%esi
xorps  %xmm1,%xmm1
cvtsi2sd %esi,%xmm1
addsd  %xmm1,%xmm1
mov    0xc(%rsp),%edx
cvtsi2sd %edx,%xmm2
mulsd  %xmm1,%xmm2
mov    0x8(%rsp),%ecx
xorps  %xmm1,%xmm1
cvtsi2sd %ecx,%xmm1
mulsd  %xmm2,%xmm1
mulsd  0xad0(%rip),%xmm1
movapd %xmm1,%xmm2
divsd  %xmm0,%xmm2
lea    0xac9(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
@RAND_MAX = global i64 0
@.str = [58 x i8] c"GPU: %dx%dx%d size\09%10.8f sec\09%10.6f GFlop\09%10.8f GFlops\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.timeval
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i8
%16 = alloca i8
%17 = alloca i32
%18 = alloca i64
%19 = alloca i64
%20 = alloca double
%21 = alloca double
%22 = alloca i8*
%23 = alloca i8*
%24 = alloca i8*
%25 = alloca i8*
%26 = alloca double*
%27 = alloca double*
%28 = alloca double*
%29 = alloca double*
%30 = alloca double
%31 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 4096, i32* %12
store i32 4096, i32* %13
store i32 4096, i32* %14
store i8 78, i8* %15
store i8 84, i8* %16
%32 = load i8, i8* %15
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %33, 78
br i1 %34, label %35, label %37
35: ; preds = %2
%36 = load i32, i32* %12
store i32 %36, i32* %10
br label %39
37: ; preds = %2
%38 = load i32, i32* %14
store i32 %38, i32* %10
br label %39
39: ; preds = %37, %35
%40 = load i8, i8* %16
%41 = sext i8 %40 to i32
%42 = icmp eq i32 %41, 78
br i1 %42, label %43, label %45
43: ; preds = %39
%44 = load i32, i32* %14
store i32 %44, i32* %11
br label %47
45: ; preds = %39
%46 = load i32, i32* %13
store i32 %46, i32* %11
br label %47
47: ; preds = %45, %43
%48 = load i32, i32* %12
store i32 %48, i32* %17
store double 2.000000e+00, double* %20
store double 2.000000e+00, double* %21
%49 = call i8* @malloc(i64 1073741824)
store i8* %49, i8** %22
%50 = call i8* @malloc(i64 1073741824)
store i8* %50, i8** %23
%51 = call i8* @malloc(i64 4294967296)
store i8* %51, i8** %24
%52 = call i8* @malloc(i64 4294967296)
store i8* %52, i8** %25
%53 = load i8*, i8** %22
%54 = bitcast i8* %53 to double*
store double* %54, double** %26
%55 = load i8*, i8** %23
%56 = bitcast i8* %55 to double*
store double* %56, double** %27
%57 = load i8*, i8** %24
%58 = bitcast i8* %57 to double*
store double* %58, double** %28
%59 = load i8*, i8** %25
%60 = bitcast i8* %59 to double*
store double* %60, double** %29
store i64 0, i64* %18
br label %61
61: ; preds = %87, %47
%62 = load i64, i64* %18
%63 = load i32, i32* %12
%64 = sext i32 %63 to i64
%65 = icmp ult i64 %62, %64
br i1 %65, label %66, label %90
66: ; preds = %61
store i64 0, i64* %19
br label %67
67: ; preds = %83, %66
%68 = load i64, i64* %19
%69 = load i32, i32* %14
%70 = sext i32 %69 to i64
%71 = icmp ult i64 %68, %70
br i1 %71, label %72, label %86
72: ; preds = %67
%73 = call i64 (...) @rand()
%74 = sitofp i64 %73 to double
%75 = load i64, i64* @RAND_MAX
%76 = sitofp i64 %75 to double
%77 = fdiv double %74, %76
%78 = fsub double %77, 5.000000e-01
%79 = fmul double %78, 1.000000e-01
%80 = load double*, double** %26
store double %79, double* %80
%81 = load double*, double** %26
%82 = getelementptr inbounds double, double* %81, i32 1
store double* %82, double** %26
br label %83
83: ; preds = %72
%84 = load i64, i64* %19
%85 = add i64 %84, 1
store i64 %85, i64* %19
br label %67
86: ; preds = %67
br label %87
87: ; preds = %86
%88 = load i64, i64* %18
%89 = add i64 %88, 1
store i64 %89, i64* %18
br label %61
90: ; preds = %61
store i64 0, i64* %18
br label %91
91: ; preds = %117, %90
%92 = load i64, i64* %18
%93 = load i32, i32* %14
%94 = sext i32 %93 to i64
%95 = icmp ult i64 %92, %94
br i1 %95, label %96, label %120
96: ; preds = %91
store i64 0, i64* %19
br label %97
97: ; preds = %113, %96
%98 = load i64, i64* %19
%99 = load i32, i32* %13
%100 = sext i32 %99 to i64
%101 = icmp ult i64 %98, %100
br i1 %101, label %102, label %116
102: ; preds = %97
%103 = call i64 (...) @rand()
%104 = sitofp i64 %103 to double
%105 = load i64, i64* @RAND_MAX
%106 = sitofp i64 %105 to double
%107 = fdiv double %104, %106
%108 = fsub double %107, 5.000000e-01
%109 = fmul double %108, 1.000000e-01
%110 = load double*, double** %27
store double %109, double* %110
%111 = load double*, double** %27
%112 = getelementptr inbounds double, double* %111, i32 1
store double* %112, double** %27
br label %113
113: ; preds = %102
%114 = load i64, i64* %19
%115 = add i64 %114, 1
store i64 %115, i64* %19
br label %97
116: ; preds = %97
br label %117
117: ; preds = %116
%118 = load i64, i64* %18
%119 = add i64 %118, 1
store i64 %119, i64* %18
br label %91
120: ; preds = %91
store i64 0, i64* %18
br label %121
121: ; preds = %143, %120
%122 = load i64, i64* %18
%123 = load i32, i32* %13
%124 = sext i32 %123 to i64
%125 = icmp ult i64 %122, %124
br i1 %125, label %126, label %146
126: ; preds = %121
store i64 0, i64* %19
br label %127
127: ; preds = %139, %126
%128 = load i64, i64* %19
%129 = load i32, i32* %12
%130 = sext i32 %129 to i64
%131 = icmp ult i64 %128, %130
br i1 %131, label %132, label %142
132: ; preds = %127
%133 = load double*, double** %29
store double 0.000000e+00, double* %133
%134 = load double*, double** %28
store double 0.000000e+00, double* %134
%135 = load double*, double** %29
%136 = getelementptr inbounds double, double* %135, i32 1
store double* %136, double** %29
%137 = load double*, double** %28
%138 = getelementptr inbounds double, double* %137, i32 1
store double* %138, double** %28
br label %139
139: ; preds = %132
%140 = load i64, i64* %19
%141 = add i64 %140, 1
store i64 %141, i64* %19
br label %127
142: ; preds = %127
br label %143
143: ; preds = %142
%144 = load i64, i64* %18
%145 = add i64 %144, 1
store i64 %145, i64* %18
br label %121
146: ; preds = %121
%147 = load i8*, i8** %22
%148 = bitcast i8* %147 to double*
store double* %148, double** %26
%149 = load i8*, i8** %23
%150 = bitcast i8* %149 to double*
store double* %150, double** %27
%151 = load i8*, i8** %24
%152 = bitcast i8* %151 to double*
store double* %152, double** %28
%153 = load i8*, i8** %25
%154 = bitcast i8* %153 to double*
store double* %154, double** %29
%155 = call i32 @gettimeofday(%struct.timeval* %6, i32* null)
%156 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 1
%157 = load i64, i64* %156
%158 = sitofp i64 %157 to double
%159 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 0
%160 = load i64, i64* %159
%161 = sitofp i64 %160 to double
%162 = call double @llvm.fmuladd.f64(double %161, double 0x3EB0C6F7A0B5ED8D, double %158)
store double %162, double* %7
%163 = load double*, double** %26
%164 = load double*, double** %27
%165 = load double*, double** %29
%166 = call i32 @dgemm_(i8* %15, i8* %16, i32* %12, i32* %13, i32* %14, double* %20, double* %163, i32* %10, double* %164, i32* %11, double* %21, double* %165, i32* %17)
%167 = call i32 @gettimeofday(%struct.timeval* %6, i32* null)
%168 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 1
%169 = load i64, i64* %168
%170 = sitofp i64 %169 to double
%171 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 0
%172 = load i64, i64* %171
%173 = sitofp i64 %172 to double
%174 = call double @llvm.fmuladd.f64(double %173, double 0x3EB0C6F7A0B5ED8D, double %170)
store double %174, double* %8
%175 = load double, double* %8
%176 = load double, double* %7
%177 = fsub double %175, %176
store double %177, double* %9
%178 = load i32, i32* %12
%179 = sitofp i32 %178 to double
%180 = fmul double 2.000000e+00, %179
%181 = load i32, i32* %13
%182 = sitofp i32 %181 to double
%183 = fmul double %180, %182
%184 = load i32, i32* %14
%185 = sitofp i32 %184 to double
%186 = fmul double %183, %185
%187 = fmul double %186, 1.000000e-09
store double %187, double* %30
%188 = load double, double* %30
%189 = load double, double* %9
%190 = fdiv double %188, %189
store double %190, double* %31
%191 = load i32, i32* %12
%192 = load i32, i32* %13
%193 = load i32, i32* %14
%194 = load double, double* %9
%195 = load double, double* %30
%196 = load double, double* %31
%197 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i32 %191, i32 %192, i32 %193, double %194, double %195, double %196)
ret i32 0
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
@RAND_MAX = global i64 0
@.str = [58 x i8] c"GPU: %dx%dx%d size\09%10.8f sec\09%10.6f GFlop\09%10.8f GFlops\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.timeval
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8
%10 = alloca i8
%11 = alloca i32
%12 = alloca double
%13 = alloca double
%14 = bitcast %struct.timeval* %3 to i8*
%15 = bitcast i32* %4 to i8*
%16 = bitcast i32* %5 to i8*
%17 = bitcast i32* %6 to i8*
store i32 4096, i32* %6
%18 = bitcast i32* %7 to i8*
store i32 4096, i32* %7
%19 = bitcast i32* %8 to i8*
store i32 4096, i32* %8
store i8 78, i8* %9
store i8 84, i8* %10
store i32 4096, i32* %4
store i32 4096, i32* %5
%20 = bitcast i32* %11 to i8*
store i32 4096, i32* %11
%21 = bitcast double* %12 to i8*
store double 2.000000e+00, double* %12
%22 = bitcast double* %13 to i8*
store double 2.000000e+00, double* %13
%23 = tail call dereferenceable_or_null(1073741824) i8* @malloc(i64 1073741824)
%24 = tail call dereferenceable_or_null(1073741824) i8* @malloc(i64 1073741824)
%25 = tail call dereferenceable_or_null(4294967296) i8* @malloc(i64 4294967296)
%26 = tail call dereferenceable_or_null(4294967296) i8* @malloc(i64 4294967296)
%27 = bitcast i8* %23 to double*
%28 = bitcast i8* %24 to double*
%29 = bitcast i8* %25 to double*
%30 = bitcast i8* %26 to double*
br label %31
31: ; preds = %47, %2
%32 = phi i64 [ 0, %2 ], [ %48, %47 ]
%33 = phi double* [ %27, %2 ], [ %44, %47 ]
br label %34
34: ; preds = %31, %34
%35 = phi double* [ %44, %34 ], [ %33, %31 ]
%36 = phi i64 [ %45, %34 ], [ 0, %31 ]
%37 = tail call i64 (...) @rand()
%38 = sitofp i64 %37 to double
%39 = load i64, i64* @RAND_MAX
%40 = sitofp i64 %39 to double
%41 = fdiv double %38, %40
%42 = fadd double %41, -5.000000e-01
%43 = fmul double %42, 1.000000e-01
store double %43, double* %35
%44 = getelementptr inbounds double, double* %35, i64 1
%45 = add nuw i64 %36, 1
%46 = icmp eq i64 %45, 4096
br i1 %46, label %47, label %34
47: ; preds = %34
%48 = add nuw i64 %32, 1
%49 = icmp eq i64 %48, 4096
br i1 %49, label %50, label %31
50: ; preds = %47, %66
%51 = phi i64 [ %67, %66 ], [ 0, %47 ]
%52 = phi double* [ %63, %66 ], [ %28, %47 ]
br label %53
53: ; preds = %50, %53
%54 = phi double* [ %63, %53 ], [ %52, %50 ]
%55 = phi i64 [ %64, %53 ], [ 0, %50 ]
%56 = tail call i64 (...) @rand()
%57 = sitofp i64 %56 to double
%58 = load i64, i64* @RAND_MAX
%59 = sitofp i64 %58 to double
%60 = fdiv double %57, %59
%61 = fadd double %60, -5.000000e-01
%62 = fmul double %61, 1.000000e-01
store double %62, double* %54
%63 = getelementptr inbounds double, double* %54, i64 1
%64 = add nuw i64 %55, 1
%65 = icmp eq i64 %64, 4096
br i1 %65, label %66, label %53
66: ; preds = %53
%67 = add nuw i64 %51, 1
%68 = icmp eq i64 %67, 4096
br i1 %68, label %69, label %50
69: ; preds = %66, %69
%70 = phi i64 [ %105, %69 ], [ 0, %66 ]
%71 = phi double* [ %103, %69 ], [ %30, %66 ]
%72 = phi double* [ %104, %69 ], [ %29, %66 ]
%73 = bitcast double* %71 to i8*
%74 = bitcast double* %72 to i8*
%75 = getelementptr double, double* %71, i64 4096
%76 = getelementptr double, double* %72, i64 4096
%77 = bitcast double* %75 to i8*
%78 = bitcast double* %76 to i8*
%79 = getelementptr double, double* %71, i64 8192
%80 = getelementptr double, double* %72, i64 8192
%81 = bitcast double* %79 to i8*
%82 = bitcast double* %80 to i8*
%83 = getelementptr double, double* %71, i64 12288
%84 = getelementptr double, double* %72, i64 12288
%85 = bitcast double* %83 to i8*
%86 = bitcast double* %84 to i8*
%87 = getelementptr double, double* %71, i64 16384
%88 = getelementptr double, double* %72, i64 16384
%89 = bitcast double* %87 to i8*
%90 = bitcast double* %88 to i8*
%91 = getelementptr double, double* %71, i64 20480
%92 = getelementptr double, double* %72, i64 20480
%93 = bitcast double* %91 to i8*
%94 = bitcast double* %92 to i8*
%95 = getelementptr double, double* %71, i64 24576
%96 = getelementptr double, double* %72, i64 24576
%97 = bitcast double* %95 to i8*
%98 = bitcast double* %96 to i8*
%99 = getelementptr double, double* %71, i64 28672
%100 = getelementptr double, double* %72, i64 28672
%101 = bitcast double* %99 to i8*
%102 = bitcast double* %100 to i8*
%103 = getelementptr double, double* %71, i64 32768
%104 = getelementptr double, double* %72, i64 32768
%105 = add nuw nsw i64 %70, 8
%106 = icmp eq i64 %105, 4096
br i1 %106, label %107, label %69
107: ; preds = %69
%108 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
%109 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 1
%110 = load i64, i64* %109
%111 = sitofp i64 %110 to double
%112 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 0
%113 = load i64, i64* %112
%114 = sitofp i64 %113 to double
%115 = tail call double @llvm.fmuladd.f64(double %114, double 0x3EB0C6F7A0B5ED8D, double %111)
%116 = call i32 @dgemm_(i8* %9, i8* %10, i32* %6, i32* %7, i32* %8, double* %12, double* %27, i32* %4, double* %28, i32* %5, double* %13, double* %30, i32* %11)
%117 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
%118 = load i64, i64* %109
%119 = sitofp i64 %118 to double
%120 = load i64, i64* %112
%121 = sitofp i64 %120 to double
%122 = call double @llvm.fmuladd.f64(double %121, double 0x3EB0C6F7A0B5ED8D, double %119)
%123 = fsub double %122, %115
%124 = load i32, i32* %6
%125 = sitofp i32 %124 to double
%126 = fmul double %125, 2.000000e+00
%127 = load i32, i32* %7
%128 = sitofp i32 %127 to double
%129 = fmul double %126, %128
%130 = load i32, i32* %8
%131 = sitofp i32 %130 to double
%132 = fmul double %129, %131
%133 = fmul double %132, 1.000000e-09
%134 = fdiv double %133, %123
%135 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i32 %124, i32 %127, i32 %130, double %123, double %133, double %134)
ret i32 0
}