#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*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
void *malloc(size_t);
int /*<<< orphan*/ printf(char *, int, int, int, double, double, double);
scalar_t__ rand();
int /*<<< orphan*/ sgemm_(char *, char *, int *, int *, int *, float *, float *,
                          int *, float *, int *, float *, float *, int *);
int main(int argc, char *argv[]) {
  struct timeval tv;
  double start, end, timec;
  int lda, ldb;
  int m = 1024;
  int n = 1024;
  int k = 1024;
  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;
  float alpha = 2.0;
  float beta = 2.0;
  void *a1, *b1, *c1, *c2;
  float *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 = (float *)a1;
  b = (float *)b1;
  cg = (float *)c1;
  cc = (float *)c2;
  for (i = 0; i < m; i++) {
    for (j = 0; j < k; j++) {
      *a = (((float)rand() / (float)RAND_MAX) - 0.5) * 1e-1;
      a++;
    }
  }
  for (i = 0; i < k; i++) {
    for (j = 0; j < n; j++) {
      *b = (((float)rand() / (float)RAND_MAX) - 0.5) * 1e-1;
      b++;
    }
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      *cc = (float)0.0;
      *cg = (float)0.0;
      cc++;
      cg++;
    }
  }
  a = (float *)a1;
  b = (float *)b1;
  cg = (float *)c1;
  cc = (float *)c2;
  gettimeofday(&tv, NULL);
  start = (double)tv.tv_sec + (double)tv.tv_usec * 1.e-6;
  sgemm_(&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   $0x400,-0x64(%rbp)
movl   $0x400,-0x68(%rbp)
movl   $0x400,-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)
movss  0xe29(%rip),%xmm0
movss  %xmm0,-0x8c(%rbp)
ff
movss  0xe19(%rip),%xmm0
movss  %xmm0,-0x90(%rbp)
ff
mov    $0x40000000,%edi
call   1050 <malloc@plt>
mov    %rax,-0x98(%rbp)
mov    $0x40000000,%edi
call   1050 <malloc@plt>
mov    %rax,-0xa0(%rbp)
movabs $0x100000000,%rdi
call   1050 <malloc@plt>
mov    %rax,-0xa8(%rbp)
movabs $0x100000000,%rdi
call   1050 <malloc@plt>
mov    %rax,-0xb0(%rbp)
mov    -0x98(%rbp),%rax
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)
movq   $0x0,-0x80(%rbp)
mov    -0x80(%rbp),%rax
movslq -0x64(%rbp),%rcx
cmp    %rcx,%rax
jae    1333 <main+0x1e3>
movq   $0x0,-0x88(%rbp)
mov    -0x88(%rbp),%rax
movslq -0x6c(%rbp),%rcx
cmp    %rcx,%rax
jae    131d <main+0x1cd>
mov    $0x0,%al
call   1070 <rand@plt>
cvtsi2ss %rax,%xmm0
mov    0x2d28(%rip),%rax
cvtsi2ssq (%rax),%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd53(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xd3f(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0xb8(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0xb8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0xb8(%rbp)
mov    -0x88(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x88(%rbp)
jmp    1299 <main+0x149>
jmp    1322 <main+0x1d2>
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    13f1 <main+0x2a1>
movq   $0x0,-0x88(%rbp)
mov    -0x88(%rbp),%rax
movslq -0x68(%rbp),%rcx
cmp    %rcx,%rax
jae    13db <main+0x28b>
mov    $0x0,%al
call   1070 <rand@plt>
cvtsi2ss %rax,%xmm0
mov    0x2c6a(%rip),%rax
cvtsi2ssq (%rax),%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xc95(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xc81(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0xc0(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0xc0(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0xc0(%rbp)
mov    -0x88(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x88(%rbp)
jmp    1357 <main+0x207>
jmp    13e0 <main+0x290>
mov    -0x80(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x80(%rbp)
jmp    133b <main+0x1eb>
movq   $0x0,-0x80(%rbp)
mov    -0x80(%rbp),%rax
movslq -0x68(%rbp),%rcx
cmp    %rcx,%rax
jae    1496 <main+0x346>
movq   $0x0,-0x88(%rbp)
mov    -0x88(%rbp),%rax
movslq -0x64(%rbp),%rcx
cmp    %rcx,%rax
jae    1480 <main+0x330>
mov    -0xd0(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax)
mov    -0xc8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax)
mov    -0xd0(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0xd0(%rbp)
mov    -0xc8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0xc8(%rbp)
mov    -0x88(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x88(%rbp)
jmp    1415 <main+0x2c5>
jmp    1485 <main+0x335>
mov    -0x80(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x80(%rbp)
jmp    13f9 <main+0x2a9>
mov    -0x98(%rbp),%rax
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)
lea    -0x40(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <gettimeofday@plt>
cvtsi2sdq -0x38(%rbp),%xmm1
cvtsi2sdq -0x40(%rbp),%xmm0
movsd  0xb29(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0xb8(%rbp),%r12
mov    -0xc0(%rbp),%r14
mov    -0xd0(%rbp),%r10
lea    -0x6d(%rbp),%rdi
lea    -0x6e(%rbp),%rsi
lea    -0x64(%rbp),%rdx
lea    -0x68(%rbp),%rcx
lea    -0x6c(%rbp),%r8
lea    -0x8c(%rbp),%r9
lea    -0x5c(%rbp),%r15
lea    -0x60(%rbp),%rbx
lea    -0x90(%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   1060 <sgemm_@plt>
lea    -0x40(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <gettimeofday@plt>
cvtsi2sdq -0x38(%rbp),%xmm1
cvtsi2sdq -0x40(%rbp),%xmm0
movsd  0xa91(%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  0xa3a(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  -0xd8(%rbp),%xmm0
ff
divsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0xe0(%rbp)
ff
mov    -0x64(%rbp),%esi
mov    -0x68(%rbp),%edx
mov    -0x6c(%rbp),%ecx
movsd  -0x58(%rbp),%xmm0
movsd  -0xd8(%rbp),%xmm1
ff
movsd  -0xe0(%rbp),%xmm2
ff
lea    0xa1c(%rip),%rdi
call   1030 <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   $0x400,0x18(%rsp)
movl   $0x400,0x14(%rsp)
movl   $0x400,0x10(%rsp)
movb   $0x4e,0xf(%rsp)
movb   $0x54,0xe(%rsp)
movl   $0x400,0x2c(%rsp)
movl   $0x400,0x28(%rsp)
movl   $0x400,0x24(%rsp)
movl   $0x40000000,0x20(%rsp)
40
movl   $0x40000000,0x1c(%rsp)
40
mov    $0x40000000,%edi
call   1060 <malloc@plt>
mov    %rax,%r14
mov    $0x40000000,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
movabs $0x100000000,%r12
mov    %r12,%rdi
call   1060 <malloc@plt>
mov    %rax,%r13
mov    %r12,%rdi
call   1060 <malloc@plt>
mov    %rax,0x48(%rsp)
mov    0x2ded(%rip),%r12
xor    %ebp,%ebp
mov    %r14,0x50(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1080 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
xorps  %xmm1,%xmm1
cvtsi2ssq (%r12),%xmm1
divss  %xmm1,%xmm0
movsd  0xdbc(%rip),%xmm1
cvtss2sd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0xdb4(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,(%r14,%r15,1)
add    $0x4,%r15
cmp    $0x1000,%r15
jne    1220 <main+0xc0>
add    $0x1,%rbp
add    %r15,%r14
cmp    $0x400,%rbp
jne    1210 <main+0xb0>
xor    %r14d,%r14d
mov    %rbx,%r15
mov    %rbx,%rbp
nopl   0x0(%rax,%rax,1)
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1080 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
xorps  %xmm1,%xmm1
cvtsi2ssq (%r12),%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
addsd  0xd38(%rip),%xmm0
mulsd  0xd38(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x0(%rbp,%rbx,1)
add    $0x4,%rbx
cmp    $0x1000,%rbx
jne    12a0 <main+0x140>
add    $0x1,%r14
add    %rbx,%rbp
cmp    $0x400,%r14
jne    1290 <main+0x130>
xor    %ebp,%ebp
mov    0x48(%rsp),%r12
xchg   %ax,%ax
lea    (%r12,%rbp,1),%rdi
mov    %r13,%rbx
add    %rbp,%rbx
mov    $0x1000,%edx
xor    %esi,%esi
call   1050 <memset@plt>
mov    $0x1000,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1050 <memset@plt>
lea    (%r12,%rbp,1),%rdi
add    $0x1000,%rdi
mov    $0x1000,%edx
xor    %esi,%esi
call   1050 <memset@plt>
lea    0x1000(,%rbp,1),%rdi
add    %r13,%rdi
mov    $0x1000,%edx
xor    %esi,%esi
call   1050 <memset@plt>
lea    (%r12,%rbp,1),%rdi
add    $0x2000,%rdi
mov    $0x1000,%edx
xor    %esi,%esi
call   1050 <memset@plt>
lea    0x2000(,%rbp,1),%rdi
add    %r13,%rdi
mov    $0x1000,%edx
xor    %esi,%esi
call   1050 <memset@plt>
lea    (%r12,%rbp,1),%rdi
add    $0x3000,%rdi
mov    $0x1000,%edx
xor    %esi,%esi
call   1050 <memset@plt>
lea    0x3000(,%rbp,1),%rdi
add    %r13,%rdi
mov    $0x1000,%edx
xor    %esi,%esi
call   1050 <memset@plt>
lea    (%r12,%rbp,1),%rdi
add    $0x4000,%rdi
mov    $0x1000,%edx
xor    %esi,%esi
call   1050 <memset@plt>
lea    0x4000(,%rbp,1),%rdi
add    %r13,%rdi
mov    $0x1000,%edx
xor    %esi,%esi
call   1050 <memset@plt>
lea    (%r12,%rbp,1),%rdi
add    $0x5000,%rdi
mov    $0x1000,%edx
xor    %esi,%esi
call   1050 <memset@plt>
lea    0x5000(,%rbp,1),%rdi
add    %r13,%rdi
mov    $0x1000,%edx
xor    %esi,%esi
call   1050 <memset@plt>
lea    (%r12,%rbp,1),%rdi
add    $0x6000,%rdi
mov    $0x1000,%edx
xor    %esi,%esi
call   1050 <memset@plt>
lea    0x6000(,%rbp,1),%rdi
add    %r13,%rdi
mov    $0x1000,%edx
xor    %esi,%esi
call   1050 <memset@plt>
lea    (%r12,%rbp,1),%rdi
add    $0x7000,%rdi
mov    $0x1000,%edx
xor    %esi,%esi
call   1050 <memset@plt>
lea    0x7000(,%rbp,1),%rdi
add    %r13,%rdi
mov    $0x1000,%edx
xor    %esi,%esi
call   1050 <memset@plt>
add    $0x8000,%rbp
cmp    $0x400000,%rbp
jne    1300 <main+0x1a0>
lea    0x30(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
call   1040 <gettimeofday@plt>
cvtsi2sdq 0x38(%rsp),%xmm0
cvtsi2sdq 0x30(%rsp),%xmm1
mulsd  0xb70(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x40(%rsp)
sub    $0x8,%rsp
lea    0x2c(%rsp),%rax
lea    0x24(%rsp),%rbp
lea    0x30(%rsp),%rbx
lea    0x34(%rsp),%r10
lea    0x17(%rsp),%rdi
lea    0x16(%rsp),%rsi
lea    0x20(%rsp),%rdx
lea    0x1c(%rsp),%rcx
lea    0x18(%rsp),%r8
lea    0x28(%rsp),%r9
push   %rax
push   %r12
push   %rbp
push   %rbx
push   %r15
push   %r10
push   0x88(%rsp)
call   1070 <sgemm_@plt>
add    $0x40,%rsp
mov    %r14,%rdi
xor    %esi,%esi
call   1040 <gettimeofday@plt>
xorps  %xmm1,%xmm1
cvtsi2sdq 0x38(%rsp),%xmm1
xorps  %xmm0,%xmm0
cvtsi2sdq 0x30(%rsp),%xmm0
mulsd  0xaf1(%rip),%xmm0
addsd  %xmm1,%xmm0
subsd  0x40(%rsp),%xmm0
mov    0x18(%rsp),%esi
xorps  %xmm1,%xmm1
cvtsi2sd %esi,%xmm1
addsd  %xmm1,%xmm1
mov    0x14(%rsp),%edx
cvtsi2sd %edx,%xmm2
mulsd  %xmm1,%xmm2
mov    0x10(%rsp),%ecx
xorps  %xmm1,%xmm1
cvtsi2sd %ecx,%xmm1
mulsd  %xmm2,%xmm1
mulsd  0xabd(%rip),%xmm1
movapd %xmm1,%xmm2
divsd  %xmm0,%xmm2
lea    0xab6(%rip),%rdi
call   1030 <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 float
%21 = alloca float
%22 = alloca i8*
%23 = alloca i8*
%24 = alloca i8*
%25 = alloca i8*
%26 = alloca float*
%27 = alloca float*
%28 = alloca float*
%29 = alloca float*
%30 = alloca double
%31 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1024, i32* %12
store i32 1024, i32* %13
store i32 1024, 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 float 2.000000e+00, float* %20
store float 2.000000e+00, float* %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 float*
store float* %54, float** %26
%55 = load i8*, i8** %23
%56 = bitcast i8* %55 to float*
store float* %56, float** %27
%57 = load i8*, i8** %24
%58 = bitcast i8* %57 to float*
store float* %58, float** %28
%59 = load i8*, i8** %25
%60 = bitcast i8* %59 to float*
store float* %60, float** %29
store i64 0, i64* %18
br label %61
61: ; preds = %89, %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 %92
66: ; preds = %61
store i64 0, i64* %19
br label %67
67: ; preds = %85, %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 %88
72: ; preds = %67
%73 = call i64 (...) @rand()
%74 = sitofp i64 %73 to float
%75 = load i64, i64* @RAND_MAX
%76 = sitofp i64 %75 to float
%77 = fdiv float %74, %76
%78 = fpext float %77 to double
%79 = fsub double %78, 5.000000e-01
%80 = fmul double %79, 1.000000e-01
%81 = fptrunc double %80 to float
%82 = load float*, float** %26
store float %81, float* %82
%83 = load float*, float** %26
%84 = getelementptr inbounds float, float* %83, i32 1
store float* %84, float** %26
br label %85
85: ; preds = %72
%86 = load i64, i64* %19
%87 = add i64 %86, 1
store i64 %87, i64* %19
br label %67
88: ; preds = %67
br label %89
89: ; preds = %88
%90 = load i64, i64* %18
%91 = add i64 %90, 1
store i64 %91, i64* %18
br label %61
92: ; preds = %61
store i64 0, i64* %18
br label %93
93: ; preds = %121, %92
%94 = load i64, i64* %18
%95 = load i32, i32* %14
%96 = sext i32 %95 to i64
%97 = icmp ult i64 %94, %96
br i1 %97, label %98, label %124
98: ; preds = %93
store i64 0, i64* %19
br label %99
99: ; preds = %117, %98
%100 = load i64, i64* %19
%101 = load i32, i32* %13
%102 = sext i32 %101 to i64
%103 = icmp ult i64 %100, %102
br i1 %103, label %104, label %120
104: ; preds = %99
%105 = call i64 (...) @rand()
%106 = sitofp i64 %105 to float
%107 = load i64, i64* @RAND_MAX
%108 = sitofp i64 %107 to float
%109 = fdiv float %106, %108
%110 = fpext float %109 to double
%111 = fsub double %110, 5.000000e-01
%112 = fmul double %111, 1.000000e-01
%113 = fptrunc double %112 to float
%114 = load float*, float** %27
store float %113, float* %114
%115 = load float*, float** %27
%116 = getelementptr inbounds float, float* %115, i32 1
store float* %116, float** %27
br label %117
117: ; preds = %104
%118 = load i64, i64* %19
%119 = add i64 %118, 1
store i64 %119, i64* %19
br label %99
120: ; preds = %99
br label %121
121: ; preds = %120
%122 = load i64, i64* %18
%123 = add i64 %122, 1
store i64 %123, i64* %18
br label %93
124: ; preds = %93
store i64 0, i64* %18
br label %125
125: ; preds = %147, %124
%126 = load i64, i64* %18
%127 = load i32, i32* %13
%128 = sext i32 %127 to i64
%129 = icmp ult i64 %126, %128
br i1 %129, label %130, label %150
130: ; preds = %125
store i64 0, i64* %19
br label %131
131: ; preds = %143, %130
%132 = load i64, i64* %19
%133 = load i32, i32* %12
%134 = sext i32 %133 to i64
%135 = icmp ult i64 %132, %134
br i1 %135, label %136, label %146
136: ; preds = %131
%137 = load float*, float** %29
store float 0.000000e+00, float* %137
%138 = load float*, float** %28
store float 0.000000e+00, float* %138
%139 = load float*, float** %29
%140 = getelementptr inbounds float, float* %139, i32 1
store float* %140, float** %29
%141 = load float*, float** %28
%142 = getelementptr inbounds float, float* %141, i32 1
store float* %142, float** %28
br label %143
143: ; preds = %136
%144 = load i64, i64* %19
%145 = add i64 %144, 1
store i64 %145, i64* %19
br label %131
146: ; preds = %131
br label %147
147: ; preds = %146
%148 = load i64, i64* %18
%149 = add i64 %148, 1
store i64 %149, i64* %18
br label %125
150: ; preds = %125
%151 = load i8*, i8** %22
%152 = bitcast i8* %151 to float*
store float* %152, float** %26
%153 = load i8*, i8** %23
%154 = bitcast i8* %153 to float*
store float* %154, float** %27
%155 = load i8*, i8** %24
%156 = bitcast i8* %155 to float*
store float* %156, float** %28
%157 = load i8*, i8** %25
%158 = bitcast i8* %157 to float*
store float* %158, float** %29
%159 = call i32 @gettimeofday(%struct.timeval* %6, i32* null)
%160 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 1
%161 = load i64, i64* %160
%162 = sitofp i64 %161 to double
%163 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 0
%164 = load i64, i64* %163
%165 = sitofp i64 %164 to double
%166 = call double @llvm.fmuladd.f64(double %165, double 0x3EB0C6F7A0B5ED8D, double %162)
store double %166, double* %7
%167 = load float*, float** %26
%168 = load float*, float** %27
%169 = load float*, float** %29
%170 = call i32 @sgemm_(i8* %15, i8* %16, i32* %12, i32* %13, i32* %14, float* %20, float* %167, i32* %10, float* %168, i32* %11, float* %21, float* %169, i32* %17)
%171 = call i32 @gettimeofday(%struct.timeval* %6, i32* null)
%172 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 1
%173 = load i64, i64* %172
%174 = sitofp i64 %173 to double
%175 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 0
%176 = load i64, i64* %175
%177 = sitofp i64 %176 to double
%178 = call double @llvm.fmuladd.f64(double %177, double 0x3EB0C6F7A0B5ED8D, double %174)
store double %178, double* %8
%179 = load double, double* %8
%180 = load double, double* %7
%181 = fsub double %179, %180
store double %181, double* %9
%182 = load i32, i32* %12
%183 = sitofp i32 %182 to double
%184 = fmul double 2.000000e+00, %183
%185 = load i32, i32* %13
%186 = sitofp i32 %185 to double
%187 = fmul double %184, %186
%188 = load i32, i32* %14
%189 = sitofp i32 %188 to double
%190 = fmul double %187, %189
%191 = fmul double %190, 1.000000e-09
store double %191, double* %30
%192 = load double, double* %30
%193 = load double, double* %9
%194 = fdiv double %192, %193
store double %194, double* %31
%195 = load i32, i32* %12
%196 = load i32, i32* %13
%197 = load i32, i32* %14
%198 = load double, double* %9
%199 = load double, double* %30
%200 = load double, double* %31
%201 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i32 %195, i32 %196, i32 %197, double %198, double %199, double %200)
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 float
%13 = alloca float
%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 1024, i32* %6
%18 = bitcast i32* %7 to i8*
store i32 1024, i32* %7
%19 = bitcast i32* %8 to i8*
store i32 1024, i32* %8
store i8 78, i8* %9
store i8 84, i8* %10
store i32 1024, i32* %4
store i32 1024, i32* %5
%20 = bitcast i32* %11 to i8*
store i32 1024, i32* %11
%21 = bitcast float* %12 to i8*
store float 2.000000e+00, float* %12
%22 = bitcast float* %13 to i8*
store float 2.000000e+00, float* %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 float*
%28 = bitcast i8* %24 to float*
%29 = bitcast i8* %25 to float*
%30 = bitcast i8* %26 to float*
br label %31
31: ; preds = %49, %2
%32 = phi i64 [ 0, %2 ], [ %50, %49 ]
%33 = phi float* [ %27, %2 ], [ %46, %49 ]
br label %34
34: ; preds = %31, %34
%35 = phi float* [ %46, %34 ], [ %33, %31 ]
%36 = phi i64 [ %47, %34 ], [ 0, %31 ]
%37 = tail call i64 (...) @rand()
%38 = sitofp i64 %37 to float
%39 = load i64, i64* @RAND_MAX
%40 = sitofp i64 %39 to float
%41 = fdiv float %38, %40
%42 = fpext float %41 to double
%43 = fadd double %42, -5.000000e-01
%44 = fmul double %43, 1.000000e-01
%45 = fptrunc double %44 to float
store float %45, float* %35
%46 = getelementptr inbounds float, float* %35, i64 1
%47 = add nuw i64 %36, 1
%48 = icmp eq i64 %47, 1024
br i1 %48, label %49, label %34
49: ; preds = %34
%50 = add nuw i64 %32, 1
%51 = icmp eq i64 %50, 1024
br i1 %51, label %52, label %31
52: ; preds = %49, %70
%53 = phi i64 [ %71, %70 ], [ 0, %49 ]
%54 = phi float* [ %67, %70 ], [ %28, %49 ]
br label %55
55: ; preds = %52, %55
%56 = phi float* [ %67, %55 ], [ %54, %52 ]
%57 = phi i64 [ %68, %55 ], [ 0, %52 ]
%58 = tail call i64 (...) @rand()
%59 = sitofp i64 %58 to float
%60 = load i64, i64* @RAND_MAX
%61 = sitofp i64 %60 to float
%62 = fdiv float %59, %61
%63 = fpext float %62 to double
%64 = fadd double %63, -5.000000e-01
%65 = fmul double %64, 1.000000e-01
%66 = fptrunc double %65 to float
store float %66, float* %56
%67 = getelementptr inbounds float, float* %56, i64 1
%68 = add nuw i64 %57, 1
%69 = icmp eq i64 %68, 1024
br i1 %69, label %70, label %55
70: ; preds = %55
%71 = add nuw i64 %53, 1
%72 = icmp eq i64 %71, 1024
br i1 %72, label %73, label %52
73: ; preds = %70, %73
%74 = phi i64 [ %109, %73 ], [ 0, %70 ]
%75 = phi float* [ %107, %73 ], [ %30, %70 ]
%76 = phi float* [ %108, %73 ], [ %29, %70 ]
%77 = bitcast float* %75 to i8*
%78 = bitcast float* %76 to i8*
%79 = getelementptr float, float* %75, i64 1024
%80 = getelementptr float, float* %76, i64 1024
%81 = bitcast float* %79 to i8*
%82 = bitcast float* %80 to i8*
%83 = getelementptr float, float* %75, i64 2048
%84 = getelementptr float, float* %76, i64 2048
%85 = bitcast float* %83 to i8*
%86 = bitcast float* %84 to i8*
%87 = getelementptr float, float* %75, i64 3072
%88 = getelementptr float, float* %76, i64 3072
%89 = bitcast float* %87 to i8*
%90 = bitcast float* %88 to i8*
%91 = getelementptr float, float* %75, i64 4096
%92 = getelementptr float, float* %76, i64 4096
%93 = bitcast float* %91 to i8*
%94 = bitcast float* %92 to i8*
%95 = getelementptr float, float* %75, i64 5120
%96 = getelementptr float, float* %76, i64 5120
%97 = bitcast float* %95 to i8*
%98 = bitcast float* %96 to i8*
%99 = getelementptr float, float* %75, i64 6144
%100 = getelementptr float, float* %76, i64 6144
%101 = bitcast float* %99 to i8*
%102 = bitcast float* %100 to i8*
%103 = getelementptr float, float* %75, i64 7168
%104 = getelementptr float, float* %76, i64 7168
%105 = bitcast float* %103 to i8*
%106 = bitcast float* %104 to i8*
%107 = getelementptr float, float* %75, i64 8192
%108 = getelementptr float, float* %76, i64 8192
%109 = add nuw nsw i64 %74, 8
%110 = icmp eq i64 %109, 1024
br i1 %110, label %111, label %73
111: ; preds = %73
%112 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
%113 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 1
%114 = load i64, i64* %113
%115 = sitofp i64 %114 to double
%116 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 0
%117 = load i64, i64* %116
%118 = sitofp i64 %117 to double
%119 = tail call double @llvm.fmuladd.f64(double %118, double 0x3EB0C6F7A0B5ED8D, double %115)
%120 = call i32 @sgemm_(i8* %9, i8* %10, i32* %6, i32* %7, i32* %8, float* %12, float* %27, i32* %4, float* %28, i32* %5, float* %13, float* %30, i32* %11)
%121 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
%122 = load i64, i64* %113
%123 = sitofp i64 %122 to double
%124 = load i64, i64* %116
%125 = sitofp i64 %124 to double
%126 = call double @llvm.fmuladd.f64(double %125, double 0x3EB0C6F7A0B5ED8D, double %123)
%127 = fsub double %126, %119
%128 = load i32, i32* %6
%129 = sitofp i32 %128 to double
%130 = fmul double %129, 2.000000e+00
%131 = load i32, i32* %7
%132 = sitofp i32 %131 to double
%133 = fmul double %130, %132
%134 = load i32, i32* %8
%135 = sitofp i32 %134 to double
%136 = fmul double %133, %135
%137 = fmul double %136, 1.000000e-09
%138 = fdiv double %137, %127
%139 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i32 %128, i32 %131, i32 %134, double %127, double %137, double %138)
ret i32 0
}