#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ _mm_free(double *);
double *_mm_malloc(int, int);
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int atoi(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ matrix_mult(double *, double *, double *, int);
double omp_get_wtime();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  char *awnser[] = {"bad", "ok"};
  int i, j, n, is_ok;
  double elapsed, start, end;
  if (argc != 2) {
    fprintf(stderr, "Usage: %s <size>\n", argv[0]);
    exit(EXIT_FAILURE);
  }
  n = atoi(argv[1]);
  n = n % 8 == 0 ? n : n + (8 - n % 8);
  printf("number of rows x cols: %i\n", n);
  double *A = _mm_malloc(n * n * sizeof(double), 64);
  assert(A != NULL);
  double *B = _mm_malloc(n * n * sizeof(double), 64);
  assert(B != NULL);
  double *C = _mm_malloc(n * n * sizeof(double), 64);
  assert(C != NULL);
  for (i = 0; i < n; i++)
    for (j = 0; j < n; j++) {
      A[i * n + j] = 1;
      B[i * n + j] = 1;
      C[i * n + j] = 0;
    }
  start = omp_get_wtime();
  matrix_mult(A, B, C, n);
  end = omp_get_wtime();
  elapsed = end - start;
  is_ok = 1;
  for (i = 0; i < n; i++)
    for (j = 0; j < n; j++)
      if (C[i * n + j] != (double)n) {
        is_ok = 0;
        i = n;
        j = n;
      }
  printf("multiply values are %s\ntime: %.3f seconds\n", awnser[is_ok],
         elapsed);
  _mm_free(A);
  _mm_free(B);
  _mm_free(C);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2c53(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2c50(%rip),%rax
mov    %rax,-0x18(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     11f0 <main+0x60>
mov    0x2e13(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe32(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2def(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    121f <main+0x8f>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x64(%rbp)
jmp    123f <main+0xaf>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x68(%rbp)
mov    -0x2c(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    -0x68(%rbp),%eax
mov    $0x8,%ecx
sub    %edx,%ecx
add    %ecx,%eax
mov    %eax,-0x64(%rbp)
mov    -0x64(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%esi
lea    0xdd2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x2c(%rbp),%eax
imul   -0x2c(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
mov    $0x40,%esi
call   10a0 <_mm_malloc@plt>
mov    %rax,-0x50(%rbp)
cmpq   $0x0,-0x50(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x2c(%rbp),%eax
imul   -0x2c(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
mov    $0x40,%esi
call   10a0 <_mm_malloc@plt>
mov    %rax,-0x58(%rbp)
cmpq   $0x0,-0x58(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x2c(%rbp),%eax
imul   -0x2c(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
mov    $0x40,%esi
call   10a0 <_mm_malloc@plt>
mov    %rax,-0x60(%rbp)
cmpq   $0x0,-0x60(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    137f <main+0x1ef>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    136c <main+0x1dc>
mov    -0x50(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x2c(%rbp),%ecx
add    -0x28(%rbp),%ecx
movslq %ecx,%rcx
movsd  0xcde(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x58(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x2c(%rbp),%ecx
add    -0x28(%rbp),%ecx
movslq %ecx,%rcx
movsd  0xcc0(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x60(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x2c(%rbp),%ecx
add    -0x28(%rbp),%ecx
movslq %ecx,%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    12fd <main+0x16d>
jmp    1371 <main+0x1e1>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    12ea <main+0x15a>
mov    $0x0,%al
call   1030 <omp_get_wtime@plt>
movsd  %xmm0,-0x40(%rbp)
mov    -0x50(%rbp),%rdi
mov    -0x58(%rbp),%rsi
mov    -0x60(%rbp),%rdx
mov    -0x2c(%rbp),%ecx
call   1070 <matrix_mult@plt>
mov    $0x0,%al
call   1030 <omp_get_wtime@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
subsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movl   $0x1,-0x30(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    1450 <main+0x2c0>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    143d <main+0x2ad>
mov    -0x60(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x2c(%rbp),%ecx
add    -0x28(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
cvtsi2sdl -0x2c(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jne    1417 <main+0x287>
jp     1417 <main+0x287>
jmp    142a <main+0x29a>
movl   $0x0,-0x30(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x28(%rbp)
jmp    142f <main+0x29f>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    13db <main+0x24b>
jmp    1442 <main+0x2b2>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    13c8 <main+0x238>
movslq -0x30(%rbp),%rax
mov    -0x20(%rbp,%rax,8),%rsi
movsd  -0x38(%rbp),%xmm0
lea    0xbd7(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    -0x50(%rbp),%rdi
call   10b0 <_mm_free@plt>
mov    -0x58(%rbp),%rdi
call   10b0 <_mm_free@plt>
mov    -0x60(%rbp),%rdi
call   10b0 <_mm_free@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
cmp    $0x2,%edi
jne    1621 <main+0x491>
mov    0x8(%rsi),%rdi
call   1080 <atoi@plt>
lea    0x7(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffff8,%ecx
mov    %eax,%edx
sub    %ecx,%edx
mov    $0x8,%r13d
sub    %edx,%r13d
test   %edx,%edx
cmove  %edx,%r13d
add    %eax,%r13d
lea    0xe51(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13d,%ebp
imul   %r13d,%ebp
shl    $0x3,%ebp
mov    %ebp,%edi
mov    $0x40,%esi
call   10a0 <_mm_malloc@plt>
mov    %rax,%r14
xor    %edi,%edi
test   %rax,%rax
setne  %dil
call   1050 <assert@plt>
mov    %ebp,%edi
mov    $0x40,%esi
call   10a0 <_mm_malloc@plt>
mov    %rax,%r12
xor    %edi,%edi
test   %rax,%rax
setne  %dil
call   1050 <assert@plt>
mov    %ebp,%edi
mov    $0x40,%esi
call   10a0 <_mm_malloc@plt>
xor    %edi,%edi
mov    %rax,0x10(%rsp)
test   %rax,%rax
setne  %dil
call   1050 <assert@plt>
test   %r13d,%r13d
jle    1545 <main+0x3b5>
mov    %r13d,%r15d
mov    %r15d,%ecx
and    $0xfffffffc,%ecx
mov    %rcx,0x50(%rsp)
add    $0xfffffffffffffffc,%rcx
mov    %rcx,0x48(%rsp)
mov    %rcx,%rdx
shr    $0x2,%rdx
add    $0x1,%rdx
mov    %rdx,%rcx
mov    %rdx,0x40(%rsp)
and    $0xfffffffffffffffe,%rdx
mov    %rdx,0x38(%rsp)
mov    %r15,%rcx
neg    %rcx
mov    %rcx,0x58(%rsp)
mov    0x10(%rsp),%rdx
lea    0x30(%rdx),%rdi
lea    0x0(,%r15,8),%rcx
mov    %rcx,0x70(%rsp)
lea    0x30(%r12),%rsi
lea    0x30(%r14),%rcx
lea    0x8(%r14),%rbp
lea    0x8(%r12),%r8
lea    0x8(%rdx),%r9
xor    %eax,%eax
movabs $0x3ff0000000000000,%r11
movapd 0xd34(%rip),%xmm0
xorpd  %xmm1,%xmm1
mov    %r14,0x28(%rsp)
mov    %r12,0x30(%rsp)
mov    %r13d,0x1c(%rsp)
jmp    1314 <main+0x184>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%rax
mov    0x70(%rsp),%rdx
add    %rdx,%rdi
add    %rdx,%rsi
add    %rdx,%rcx
add    %rdx,%rbp
add    %rdx,%r8
add    %rdx,%r9
cmp    %r15,%rax
je     1545 <main+0x3b5>
mov    %rax,%r10
imul   %r15,%r10
cmp    $0x4,%r13d
jae    1330 <main+0x1a0>
xor    %ebx,%ebx
jmp    14c0 <main+0x330>
nopl   0x0(%rax,%rax,1)
mov    %rax,0x20(%rsp)
lea    (%r10,%r15,1),%rdx
lea    (%r14,%r10,8),%rbx
lea    (%r14,%rdx,8),%r14
lea    (%r12,%r10,8),%rax
mov    %rax,0x60(%rsp)
lea    (%r12,%rdx,8),%rax
mov    %rax,0x68(%rsp)
mov    0x10(%rsp),%r13
lea    0x0(,%r10,8),%r12
add    %r13,%r12
lea    0x0(,%rdx,8),%rdx
add    %r13,%rdx
mov    0x68(%rsp),%r13
cmp    %r13,%rbx
setb   0xf(%rsp)
mov    0x60(%rsp),%rax
cmp    %r14,%rax
setb   0xe(%rsp)
cmp    %rdx,%rbx
setb   %bl
cmp    %r14,%r12
setb   %r14b
cmp    %rdx,%rax
setb   %dl
cmp    %r13,%r12
setb   %r12b
mov    0xe(%rsp),%al
test   %al,0xf(%rsp)
jne    14a3 <main+0x313>
and    %r14b,%bl
jne    14a3 <main+0x313>
mov    $0x0,%ebx
and    %r12b,%dl
mov    0x28(%rsp),%r14
mov    0x30(%rsp),%r12
mov    0x1c(%rsp),%r13d
mov    0x20(%rsp),%rax
jne    14c0 <main+0x330>
cmpq   $0x0,0x48(%rsp)
je     1532 <main+0x3a2>
mov    0x38(%rsp),%rdx
xor    %r14d,%r14d
nop
movupd %xmm0,-0x30(%rcx,%r14,8)
movupd %xmm0,-0x20(%rcx,%r14,8)
movupd %xmm0,-0x30(%rsi,%r14,8)
movupd %xmm0,-0x20(%rsi,%r14,8)
movupd %xmm1,-0x30(%rdi,%r14,8)
movupd %xmm1,-0x20(%rdi,%r14,8)
movupd %xmm0,-0x10(%rcx,%r14,8)
movupd %xmm0,(%rcx,%r14,8)
movupd %xmm0,-0x10(%rsi,%r14,8)
movupd %xmm0,(%rsi,%r14,8)
movupd %xmm1,-0x10(%rdi,%r14,8)
movupd %xmm1,(%rdi,%r14,8)
add    $0x8,%r14
add    $0xfffffffffffffffe,%rdx
jne    13f0 <main+0x260>
testb  $0x1,0x40(%rsp)
je     1486 <main+0x2f6>
add    %r10,%r14
mov    0x28(%rsp),%rax
movupd %xmm0,(%rax,%r14,8)
movupd %xmm0,0x10(%rax,%r14,8)
movupd %xmm0,(%r12,%r14,8)
movupd %xmm0,0x10(%r12,%r14,8)
mov    0x10(%rsp),%rdx
movupd %xmm1,(%rdx,%r14,8)
movupd %xmm1,0x10(%rdx,%r14,8)
mov    0x50(%rsp),%rdx
mov    %rdx,%rbx
cmp    %r15,%rdx
mov    0x20(%rsp),%rax
mov    0x28(%rsp),%r14
je     12f0 <main+0x160>
jmp    14c0 <main+0x330>
xor    %ebx,%ebx
mov    0x28(%rsp),%r14
mov    0x30(%rsp),%r12
mov    0x1c(%rsp),%r13d
mov    0x20(%rsp),%rax
nopl   0x0(%rax)
mov    %rbx,%rdx
test   $0x1,%r15b
je     14e8 <main+0x358>
add    %rbx,%r10
mov    %r11,(%r14,%r10,8)
mov    %r11,(%r12,%r10,8)
mov    0x10(%rsp),%rdx
movq   $0x0,(%rdx,%r10,8)
mov    %rbx,%rdx
or     $0x1,%rdx
not    %rbx
cmp    0x58(%rsp),%rbx
je     12f0 <main+0x160>
cs nopw 0x0(%rax,%rax,1)
mov    %r11,-0x8(%rbp,%rdx,8)
mov    %r11,-0x8(%r8,%rdx,8)
movq   $0x0,-0x8(%r9,%rdx,8)
mov    %r11,0x0(%rbp,%rdx,8)
mov    %r11,(%r8,%rdx,8)
movq   $0x0,(%r9,%rdx,8)
add    $0x2,%rdx
cmp    %rdx,%r15
jne    1500 <main+0x370>
jmp    12f0 <main+0x160>
xor    %r14d,%r14d
testb  $0x1,0x40(%rsp)
jne    1452 <main+0x2c2>
jmp    1486 <main+0x2f6>
xor    %ebp,%ebp
xor    %eax,%eax
call   1030 <omp_get_wtime@plt>
movsd  %xmm0,0x20(%rsp)
mov    %r14,%rdi
mov    %r12,%rsi
mov    0x10(%rsp),%rdx
mov    %r13d,%ecx
call   1070 <matrix_mult@plt>
xor    %eax,%eax
call   1030 <omp_get_wtime@plt>
test   %r13d,%r13d
jle    15cf <main+0x43f>
xorps  %xmm1,%xmm1
cvtsi2sd %r13d,%xmm1
mov    $0x1,%eax
xor    %ecx,%ecx
xor    %edx,%edx
mov    0x10(%rsp),%rdi
nopl   0x0(%rax)
mov    %ecx,%esi
imul   %r13d,%esi
add    %edx,%esi
movslq %esi,%rsi
ucomisd (%rdi,%rsi,8),%xmm1
cmovne %ebp,%eax
cmovp  %ebp,%eax
cmovne %r13d,%edx
cmovp  %r13d,%edx
cmovne %r13d,%ecx
cmovp  %r13d,%ecx
add    $0x1,%edx
cmp    %r13d,%edx
jl     1590 <main+0x400>
add    $0x1,%ecx
mov    $0x0,%edx
cmp    %r13d,%ecx
jl     1590 <main+0x400>
mov    %eax,%eax
jmp    15d4 <main+0x444>
mov    $0x1,%eax
subsd  0x20(%rsp),%xmm0
lea    0xa8f(%rip),%rcx
movslq (%rcx,%rax,4),%rsi
add    %rcx,%rsi
lea    0xa55(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    %r14,%rdi
call   10b0 <_mm_free@plt>
mov    %r12,%rdi
call   10b0 <_mm_free@plt>
mov    0x10(%rsp),%rdi
call   10b0 <_mm_free@plt>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x29b8(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0x9e3(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2998(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"bad\00"
@.str.1 = [3 x i8] c"ok\00"
@__const.main.awnser = [2 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i32 0, i32 0)]
@stderr = global i32 0
@.str.2 = [18 x i8] c"Usage: %s <size>\0A\00"
@EXIT_FAILURE = global i32 0
@.str.3 = [27 x i8] c"number of rows x cols: %i\0A\00"
@.str.4 = [43 x i8] c"multiply values are %s\0Atime: %.3f seconds\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [2 x i8*]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double*
%15 = alloca double*
%16 = alloca double*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = bitcast [2 x i8*]* %6 to i8*
%18 = load i32, i32* %4
%19 = icmp ne i32 %18, 2
br i1 %19, label %20, label %28
20: ; preds = %2
%21 = load i32, i32* @stderr
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 0
%24 = load i8*, i8** %23
%25 = call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %24)
%26 = load i32, i32* @EXIT_FAILURE
%27 = call i32 @exit(i32 %26)
unreachable
28: ; preds = %2
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 1
%31 = load i8*, i8** %30
%32 = call i32 @atoi(i8* %31)
store i32 %32, i32* %9
%33 = load i32, i32* %9
%34 = srem i32 %33, 8
%35 = icmp eq i32 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %28
%37 = load i32, i32* %9
br label %44
38: ; preds = %28
%39 = load i32, i32* %9
%40 = load i32, i32* %9
%41 = srem i32 %40, 8
%42 = sub nsw i32 8, %41
%43 = add nsw i32 %39, %42
br label %44
44: ; preds = %38, %36
%45 = phi i32 [ %37, %36 ], [ %43, %38 ]
store i32 %45, i32* %9
%46 = load i32, i32* %9
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i32 %46)
%48 = load i32, i32* %9
%49 = load i32, i32* %9
%50 = mul nsw i32 %48, %49
%51 = sext i32 %50 to i64
%52 = mul i64 %51, 8
%53 = trunc i64 %52 to i32
%54 = call double* @_mm_malloc(i32 %53, i32 64)
store double* %54, double** %14
%55 = load double*, double** %14
%56 = icmp ne double* %55, null
%57 = zext i1 %56 to i32
%58 = call i32 @assert(i32 %57)
%59 = load i32, i32* %9
%60 = load i32, i32* %9
%61 = mul nsw i32 %59, %60
%62 = sext i32 %61 to i64
%63 = mul i64 %62, 8
%64 = trunc i64 %63 to i32
%65 = call double* @_mm_malloc(i32 %64, i32 64)
store double* %65, double** %15
%66 = load double*, double** %15
%67 = icmp ne double* %66, null
%68 = zext i1 %67 to i32
%69 = call i32 @assert(i32 %68)
%70 = load i32, i32* %9
%71 = load i32, i32* %9
%72 = mul nsw i32 %70, %71
%73 = sext i32 %72 to i64
%74 = mul i64 %73, 8
%75 = trunc i64 %74 to i32
%76 = call double* @_mm_malloc(i32 %75, i32 64)
store double* %76, double** %16
%77 = load double*, double** %16
%78 = icmp ne double* %77, null
%79 = zext i1 %78 to i32
%80 = call i32 @assert(i32 %79)
store i32 0, i32* %7
br label %81
81: ; preds = %119, %44
%82 = load i32, i32* %7
%83 = load i32, i32* %9
%84 = icmp slt i32 %82, %83
br i1 %84, label %85, label %122
85: ; preds = %81
store i32 0, i32* %8
br label %86
86: ; preds = %115, %85
%87 = load i32, i32* %8
%88 = load i32, i32* %9
%89 = icmp slt i32 %87, %88
br i1 %89, label %90, label %118
90: ; preds = %86
%91 = load double*, double** %14
%92 = load i32, i32* %7
%93 = load i32, i32* %9
%94 = mul nsw i32 %92, %93
%95 = load i32, i32* %8
%96 = add nsw i32 %94, %95
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds double, double* %91, i64 %97
store double 1.000000e+00, double* %98
%99 = load double*, double** %15
%100 = load i32, i32* %7
%101 = load i32, i32* %9
%102 = mul nsw i32 %100, %101
%103 = load i32, i32* %8
%104 = add nsw i32 %102, %103
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds double, double* %99, i64 %105
store double 1.000000e+00, double* %106
%107 = load double*, double** %16
%108 = load i32, i32* %7
%109 = load i32, i32* %9
%110 = mul nsw i32 %108, %109
%111 = load i32, i32* %8
%112 = add nsw i32 %110, %111
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds double, double* %107, i64 %113
store double 0.000000e+00, double* %114
br label %115
115: ; preds = %90
%116 = load i32, i32* %8
%117 = add nsw i32 %116, 1
store i32 %117, i32* %8
br label %86
118: ; preds = %86
br label %119
119: ; preds = %118
%120 = load i32, i32* %7
%121 = add nsw i32 %120, 1
store i32 %121, i32* %7
br label %81
122: ; preds = %81
%123 = call double (...) @omp_get_wtime()
store double %123, double* %12
%124 = load double*, double** %14
%125 = load double*, double** %15
%126 = load double*, double** %16
%127 = load i32, i32* %9
%128 = call i32 @matrix_mult(double* %124, double* %125, double* %126, i32 %127)
%129 = call double (...) @omp_get_wtime()
store double %129, double* %13
%130 = load double, double* %13
%131 = load double, double* %12
%132 = fsub double %130, %131
store double %132, double* %11
store i32 1, i32* %10
store i32 0, i32* %7
br label %133
133: ; preds = %163, %122
%134 = load i32, i32* %7
%135 = load i32, i32* %9
%136 = icmp slt i32 %134, %135
br i1 %136, label %137, label %166
137: ; preds = %133
store i32 0, i32* %8
br label %138
138: ; preds = %159, %137
%139 = load i32, i32* %8
%140 = load i32, i32* %9
%141 = icmp slt i32 %139, %140
br i1 %141, label %142, label %162
142: ; preds = %138
%143 = load double*, double** %16
%144 = load i32, i32* %7
%145 = load i32, i32* %9
%146 = mul nsw i32 %144, %145
%147 = load i32, i32* %8
%148 = add nsw i32 %146, %147
%149 = sext i32 %148 to i64
%150 = getelementptr inbounds double, double* %143, i64 %149
%151 = load double, double* %150
%152 = load i32, i32* %9
%153 = sitofp i32 %152 to double
%154 = fcmp une double %151, %153
br i1 %154, label %155, label %158
155: ; preds = %142
store i32 0, i32* %10
%156 = load i32, i32* %9
store i32 %156, i32* %7
%157 = load i32, i32* %9
store i32 %157, i32* %8
br label %158
158: ; preds = %155, %142
br label %159
159: ; preds = %158
%160 = load i32, i32* %8
%161 = add nsw i32 %160, 1
store i32 %161, i32* %8
br label %138
162: ; preds = %138
br label %163
163: ; preds = %162
%164 = load i32, i32* %7
%165 = add nsw i32 %164, 1
store i32 %165, i32* %7
br label %133
166: ; preds = %133
%167 = load i32, i32* %10
%168 = sext i32 %167 to i64
%169 = getelementptr inbounds [2 x i8*], [2 x i8*]* %6, i64 0, i64 %168
%170 = load i8*, i8** %169
%171 = load double, double* %11
%172 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0), i8* %170, double %171)
%173 = load double*, double** %14
%174 = call i32 @_mm_free(double* %173)
%175 = load double*, double** %15
%176 = call i32 @_mm_free(double* %175)
%177 = load double*, double** %16
%178 = call i32 @_mm_free(double* %177)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"bad\00"
@.str.1 = [3 x i8] c"ok\00"
@reltable.main = [2 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str to i64), i64 ptrtoint ([2 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.1 to i64), i64 ptrtoint ([2 x i32]* @reltable.main to i64)) to i32)]
@stderr = global i32 0
@.str.2 = [18 x i8] c"Usage: %s <size>\0A\00"
@EXIT_FAILURE = global i32 0
@.str.3 = [27 x i8] c"number of rows x cols: %i\0A\00"
@.str.4 = [43 x i8] c"multiply values are %s\0Atime: %.3f seconds\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %10, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %6)
%8 = load i32, i32* @EXIT_FAILURE
%9 = tail call i32 @exit(i32 %8)
unreachable
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32 @atoi(i8* %12)
%14 = srem i32 %13, 8
%15 = icmp eq i32 %14, 0
%16 = sub nsw i32 8, %14
%17 = select i1 %15, i32 0, i32 %16
%18 = add nsw i32 %17, %13
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i32 %18)
%20 = shl i32 %18, 3
%21 = mul i32 %20, %18
%22 = tail call double* @_mm_malloc(i32 %21, i32 64)
%23 = icmp ne double* %22, null
%24 = zext i1 %23 to i32
%25 = tail call i32 @assert(i32 %24)
%26 = tail call double* @_mm_malloc(i32 %21, i32 64)
%27 = icmp ne double* %26, null
%28 = zext i1 %27 to i32
%29 = tail call i32 @assert(i32 %28)
%30 = tail call double* @_mm_malloc(i32 %21, i32 64)
%31 = icmp ne double* %30, null
%32 = zext i1 %31 to i32
%33 = tail call i32 @assert(i32 %32)
%34 = icmp sgt i32 %18, 0
br i1 %34, label %35, label %154
35: ; preds = %10
%36 = zext i32 %18 to i64
%37 = zext i32 %18 to i64
%38 = and i64 %37, 4294967292
%39 = add nsw i64 %38, -4
%40 = lshr exact i64 %39, 2
%41 = add nuw nsw i64 %40, 1
%42 = icmp ult i32 %18, 4
%43 = and i64 %37, 4294967292
%44 = and i64 %41, 1
%45 = icmp eq i64 %39, 0
%46 = and i64 %41, 9223372036854775806
%47 = icmp eq i64 %44, 0
%48 = icmp eq i64 %43, %37
%49 = and i64 %37, 1
%50 = icmp eq i64 %49, 0
%51 = sub nsw i64 0, %37
br label %52
52: ; preds = %151, %35
%53 = phi i64 [ 0, %35 ], [ %152, %151 ]
%54 = mul i64 %53, %37
%55 = getelementptr double, double* %22, i64 %54
%56 = add i64 %54, %37
%57 = getelementptr double, double* %22, i64 %56
%58 = getelementptr double, double* %26, i64 %54
%59 = getelementptr double, double* %26, i64 %56
%60 = getelementptr double, double* %30, i64 %54
%61 = getelementptr double, double* %30, i64 %56
%62 = mul nsw i64 %53, %36
br i1 %42, label %126, label %63
63: ; preds = %52
%64 = icmp ult double* %55, %59
%65 = icmp ult double* %58, %57
%66 = and i1 %64, %65
%67 = icmp ult double* %55, %61
%68 = icmp ult double* %60, %57
%69 = and i1 %67, %68
%70 = or i1 %66, %69
%71 = icmp ult double* %58, %61
%72 = icmp ult double* %60, %59
%73 = and i1 %71, %72
%74 = or i1 %70, %73
br i1 %74, label %126, label %75
75: ; preds = %63
br i1 %45, label %109, label %76
76: ; preds = %75, %76
%77 = phi i64 [ %106, %76 ], [ 0, %75 ]
%78 = phi i64 [ %107, %76 ], [ 0, %75 ]
%79 = add nuw nsw i64 %77, %62
%80 = getelementptr inbounds double, double* %22, i64 %79
%81 = bitcast double* %80 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %81
%82 = getelementptr inbounds double, double* %80, i64 2
%83 = bitcast double* %82 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %83
%84 = getelementptr inbounds double, double* %26, i64 %79
%85 = bitcast double* %84 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %85
%86 = getelementptr inbounds double, double* %84, i64 2
%87 = bitcast double* %86 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %87
%88 = getelementptr inbounds double, double* %30, i64 %79
%89 = bitcast double* %88 to <2 x double>*
store <2 x double> zeroinitializer, <2 x double>* %89
%90 = getelementptr inbounds double, double* %88, i64 2
%91 = bitcast double* %90 to <2 x double>*
store <2 x double> zeroinitializer, <2 x double>* %91
%92 = or i64 %77, 4
%93 = add nuw nsw i64 %92, %62
%94 = getelementptr inbounds double, double* %22, i64 %93
%95 = bitcast double* %94 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %95
%96 = getelementptr inbounds double, double* %94, i64 2
%97 = bitcast double* %96 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %97
%98 = getelementptr inbounds double, double* %26, i64 %93
%99 = bitcast double* %98 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %99
%100 = getelementptr inbounds double, double* %98, i64 2
%101 = bitcast double* %100 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %101
%102 = getelementptr inbounds double, double* %30, i64 %93
%103 = bitcast double* %102 to <2 x double>*
store <2 x double> zeroinitializer, <2 x double>* %103
%104 = getelementptr inbounds double, double* %102, i64 2
%105 = bitcast double* %104 to <2 x double>*
store <2 x double> zeroinitializer, <2 x double>* %105
%106 = add nuw i64 %77, 8
%107 = add i64 %78, 2
%108 = icmp eq i64 %107, %46
br i1 %108, label %109, label %76
109: ; preds = %76, %75
%110 = phi i64 [ 0, %75 ], [ %106, %76 ]
br i1 %47, label %125, label %111
111: ; preds = %109
%112 = add nuw nsw i64 %110, %62
%113 = getelementptr inbounds double, double* %22, i64 %112
%114 = bitcast double* %113 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %114
%115 = getelementptr inbounds double, double* %113, i64 2
%116 = bitcast double* %115 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %116
%117 = getelementptr inbounds double, double* %26, i64 %112
%118 = bitcast double* %117 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %118
%119 = getelementptr inbounds double, double* %117, i64 2
%120 = bitcast double* %119 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %120
%121 = getelementptr inbounds double, double* %30, i64 %112
%122 = bitcast double* %121 to <2 x double>*
store <2 x double> zeroinitializer, <2 x double>* %122
%123 = getelementptr inbounds double, double* %121, i64 2
%124 = bitcast double* %123 to <2 x double>*
store <2 x double> zeroinitializer, <2 x double>* %124
br label %125
125: ; preds = %109, %111
br i1 %48, label %151, label %126
126: ; preds = %63, %52, %125
%127 = phi i64 [ 0, %63 ], [ 0, %52 ], [ %43, %125 ]
%128 = xor i64 %127, -1
br i1 %50, label %135, label %129
129: ; preds = %126
%130 = add nuw nsw i64 %127, %62
%131 = getelementptr inbounds double, double* %22, i64 %130
store double 1.000000e+00, double* %131
%132 = getelementptr inbounds double, double* %26, i64 %130
store double 1.000000e+00, double* %132
%133 = getelementptr inbounds double, double* %30, i64 %130
store double 0.000000e+00, double* %133
%134 = or i64 %127, 1
br label %135
135: ; preds = %129, %126
%136 = phi i64 [ %127, %126 ], [ %134, %129 ]
%137 = icmp eq i64 %128, %51
br i1 %137, label %151, label %138
138: ; preds = %135, %138
%139 = phi i64 [ %149, %138 ], [ %136, %135 ]
%140 = add nuw nsw i64 %139, %62
%141 = getelementptr inbounds double, double* %22, i64 %140
store double 1.000000e+00, double* %141
%142 = getelementptr inbounds double, double* %26, i64 %140
store double 1.000000e+00, double* %142
%143 = getelementptr inbounds double, double* %30, i64 %140
store double 0.000000e+00, double* %143
%144 = add nuw nsw i64 %139, 1
%145 = add nuw nsw i64 %144, %62
%146 = getelementptr inbounds double, double* %22, i64 %145
store double 1.000000e+00, double* %146
%147 = getelementptr inbounds double, double* %26, i64 %145
store double 1.000000e+00, double* %147
%148 = getelementptr inbounds double, double* %30, i64 %145
store double 0.000000e+00, double* %148
%149 = add nuw nsw i64 %139, 2
%150 = icmp eq i64 %149, %37
br i1 %150, label %151, label %138
151: ; preds = %135, %138, %125
%152 = add nuw nsw i64 %53, 1
%153 = icmp eq i64 %152, %37
br i1 %153, label %154, label %52
154: ; preds = %151, %10
%155 = tail call double (...) @omp_get_wtime()
%156 = tail call i32 @matrix_mult(double* %22, double* %26, double* %30, i32 %18)
%157 = tail call double (...) @omp_get_wtime()
br i1 %34, label %158, label %183
158: ; preds = %154
%159 = sitofp i32 %18 to double
br label %160
160: ; preds = %175, %158
%161 = phi i32 [ 0, %158 ], [ %176, %175 ]
%162 = phi i32 [ 0, %158 ], [ %177, %175 ]
%163 = phi i32 [ 1, %158 ], [ %170, %175 ]
%164 = mul nsw i32 %161, %18
%165 = add nsw i32 %164, %162
%166 = sext i32 %165 to i64
%167 = getelementptr inbounds double, double* %30, i64 %166
%168 = load double, double* %167
%169 = fcmp une double %168, %159
%170 = select i1 %169, i32 0, i32 %163
%171 = select i1 %169, i32 %18, i32 %162
%172 = select i1 %169, i32 %18, i32 %161
%173 = add nsw i32 %171, 1
%174 = icmp slt i32 %173, %18
br i1 %174, label %175, label %178
175: ; preds = %160, %178
%176 = phi i32 [ %172, %160 ], [ %179, %178 ]
%177 = phi i32 [ %173, %160 ], [ 0, %178 ]
br label %160
178: ; preds = %160
%179 = add nsw i32 %172, 1
%180 = icmp slt i32 %179, %18
br i1 %180, label %175, label %181
181: ; preds = %178
%182 = zext i32 %170 to i64
br label %183
183: ; preds = %181, %154
%184 = phi i64 [ 1, %154 ], [ %182, %181 ]
%185 = fsub double %157, %155
%186 = shl i64 %184, 2
%187 = call i8* @llvm.load.relative.i64(i8* bitcast ([2 x i32]* @reltable.main to i8*), i64 %186)
%188 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0), i8* %187, double %185)
%189 = tail call i32 @_mm_free(double* %22)
%190 = tail call i32 @_mm_free(double* %26)
%191 = tail call i32 @_mm_free(double* %30)
ret i32 0
}