#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*/ printf(char *);
void double_matrix_multiplication(unsigned int i1, unsigned int j1,
                                  unsigned int i2, unsigned int j2,
                                  double m1[10][10], double m2[10][10],
                                  double m3[10][10]) {
  unsigned int i, j, k;
  if (j1 == i2) {
    for (i = 0; i < i1; i++) {
      for (j = 0; j < j2; j++) {
        m3[i][j] = 0;
      }
    }
    for (i = 0; i < i1; i++) {
      for (j = 0; j < j2; j++) {
        for (k = 0; k < j1; k++) {
          double mult = (m1[i][k] * m2[k][j]);
          m3[i][j] = m3[i][j] + (m1[i][k] * m2[k][j]);
        }
      }
    }
  } else {
    printf("\nError! Operation invalid, please enter with valid matrices.\n");
  }
}


x86 assembly (clang, -O0):
<double_matrix_multiplication>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    129f <double_matrix_multiplication+0x18f>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
jae    119c <double_matrix_multiplication+0x8c>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x10(%rbp),%eax
jae    1189 <double_matrix_multiplication+0x79>
mov    0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   $0x50,%rcx,%rcx
add    %rcx,%rax
mov    -0x28(%rbp),%ecx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1156 <double_matrix_multiplication+0x46>
jmp    118e <double_matrix_multiplication+0x7e>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1143 <double_matrix_multiplication+0x33>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
jae    129a <double_matrix_multiplication+0x18a>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x10(%rbp),%eax
jae    1287 <double_matrix_multiplication+0x177>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jae    1274 <double_matrix_multiplication+0x164>
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   $0x50,%rcx,%rcx
add    %rcx,%rax
mov    -0x2c(%rbp),%ecx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x2c(%rbp),%ecx
imul   $0x50,%rcx,%rcx
add    %rcx,%rax
mov    -0x28(%rbp),%ecx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   $0x50,%rcx,%rcx
add    %rcx,%rax
mov    -0x28(%rbp),%ecx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   $0x50,%rcx,%rcx
add    %rcx,%rax
mov    -0x2c(%rbp),%ecx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x2c(%rbp),%ecx
imul   $0x50,%rcx,%rcx
add    %rcx,%rax
mov    -0x28(%rbp),%ecx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   $0x50,%rcx,%rcx
add    %rcx,%rax
mov    -0x28(%rbp),%ecx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11c9 <double_matrix_multiplication+0xb9>
jmp    1279 <double_matrix_multiplication+0x169>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11b6 <double_matrix_multiplication+0xa6>
jmp    128c <double_matrix_multiplication+0x17c>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11a3 <double_matrix_multiplication+0x93>
jmp    12ab <double_matrix_multiplication+0x19b>
lea    0xd5a(%rip),%rdi
call   1030 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<double_matrix_multiplication>:
cmp    %edx,%esi
jne    11d2 <double_matrix_multiplication+0xb2>
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
test   %edi,%edi
je     12f4 <double_matrix_multiplication+0x1d4>
mov    %esi,%r14d
mov    %r8,0x8(%rsp)
mov    %r9,0x20(%rsp)
mov    0x70(%rsp),%r15
mov    %ecx,%r13d
lea    0x0(,%r13,8),%rax
mov    %rax,0x10(%rsp)
mov    %edi,0x4(%rsp)
mov    %edi,%ebp
lea    -0x1(%rbp),%rax
mov    %ebp,%edx
and    $0x3,%edx
mov    %rdx,0x18(%rsp)
cmp    $0x3,%rax
mov    %ecx,(%rsp)
mov    %rbp,0x30(%rsp)
jae    1303 <double_matrix_multiplication+0x1e3>
xor    %ebx,%ebx
mov    0x18(%rsp),%rax
test   %rax,%rax
je     11de <double_matrix_multiplication+0xbe>
lea    (%rbx,%rbx,4),%r12
shl    $0x4,%r12
add    %r15,%r12
shl    $0x4,%rax
lea    (%rax,%rax,4),%rbp
xor    %ebx,%ebx
jmp    11b9 <double_matrix_multiplication+0x99>
nopl   0x0(%rax)
add    $0x50,%rbx
cmp    %rbx,%rbp
je     11de <double_matrix_multiplication+0xbe>
test   %ecx,%ecx
je     11b0 <double_matrix_multiplication+0x90>
lea    (%r12,%rbx,1),%rdi
xor    %esi,%esi
mov    0x10(%rsp),%rdx
call   1040 <memset@plt>
mov    (%rsp),%ecx
jmp    11b0 <double_matrix_multiplication+0x90>
lea    0xe27(%rip),%rdi
jmp    1030 <puts@plt>
cmpl   $0x0,0x4(%rsp)
mov    0x20(%rsp),%r11
je     12f4 <double_matrix_multiplication+0x1d4>
mov    %r14d,%r12d
mov    %r12d,%r8d
and    $0xfffffffe,%r8d
mov    0x8(%rsp),%rax
lea    0x8(%rax),%rdx
xor    %r9d,%r9d
jmp    1226 <double_matrix_multiplication+0x106>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%r9
add    $0x50,%rdx
cmp    0x30(%rsp),%r9
mov    (%rsp),%ecx
je     12f4 <double_matrix_multiplication+0x1d4>
test   %ecx,%ecx
mov    0x8(%rsp),%rcx
je     1210 <double_matrix_multiplication+0xf0>
mov    %r11,%rbp
xor    %ebx,%ebx
jmp    124d <double_matrix_multiplication+0x12d>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%rbx
add    $0x8,%rbp
cmp    %r13,%rbx
je     1210 <double_matrix_multiplication+0xf0>
test   %r14d,%r14d
je     1240 <double_matrix_multiplication+0x120>
lea    (%r9,%r9,4),%r10
shl    $0x4,%r10
lea    (%r15,%r10,1),%rsi
lea    (%rsi,%rbx,8),%rax
movsd  (%rsi,%rbx,8),%xmm0
cmp    $0x1,%r14d
jne    1280 <double_matrix_multiplication+0x160>
xor    %esi,%esi
jmp    12c4 <double_matrix_multiplication+0x1a4>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbp,%rdi
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
nop
movsd  -0x8(%rdx,%rsi,8),%xmm1
mulsd  (%rdi),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rax)
movsd  (%rdx,%rsi,8),%xmm0
mulsd  0x50(%rdi),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
add    $0x2,%rsi
add    $0xa0,%rdi
cmp    %rsi,%r8
jne    1290 <double_matrix_multiplication+0x170>
test   $0x1,%r12b
je     1240 <double_matrix_multiplication+0x120>
add    %rcx,%r10
movsd  (%r10,%rsi,8),%xmm1
lea    (%rsi,%rsi,4),%rsi
shl    $0x4,%rsi
add    %r11,%rsi
mulsd  (%rsi,%rbx,8),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rax)
jmp    1240 <double_matrix_multiplication+0x120>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
and    $0xfffffffc,%ebp
mov    %rbp,0x28(%rsp)
xor    %ebx,%ebx
mov    %r15,%r12
mov    0x10(%rsp),%rbp
jmp    1336 <double_matrix_multiplication+0x216>
nopw   0x0(%rax,%rax,1)
add    $0x4,%rbx
add    $0x140,%r12
cmp    %rbx,0x28(%rsp)
je     1188 <double_matrix_multiplication+0x68>
test   %ecx,%ecx
je     1320 <double_matrix_multiplication+0x200>
mov    %r12,%rdi
xor    %esi,%esi
mov    %rbp,%rdx
call   1040 <memset@plt>
lea    0x50(%r12),%rdi
xor    %esi,%esi
mov    %rbp,%rdx
call   1040 <memset@plt>
lea    0xa0(%r12),%rdi
xor    %esi,%esi
mov    %rbp,%rdx
call   1040 <memset@plt>
lea    0xf0(%r12),%rdi
xor    %esi,%esi
mov    %rbp,%rdx
call   1040 <memset@plt>
mov    (%rsp),%ecx
jmp    1320 <double_matrix_multiplication+0x200>

LLVM IR (-O0):
@.str = [62 x i8] c"\0AError! Operation invalid, please enter with valid matrices.\0A\00"
define void @double_matrix_multiplication(i32 %0, i32 %1, i32 %2, i32 %3, [10 x double]* %4, [10 x double]* %5, [10 x double]* %6) {
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca [10 x double]*
%13 = alloca [10 x double]*
%14 = alloca [10 x double]*
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca double
store i32 %0, i32* %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store [10 x double]* %4, [10 x double]** %12
store [10 x double]* %5, [10 x double]** %13
store [10 x double]* %6, [10 x double]** %14
%19 = load i32, i32* %9
%20 = load i32, i32* %10
%21 = icmp eq i32 %19, %20
br i1 %21, label %22, label %124
22: ; preds = %7
store i32 0, i32* %15
br label %23
23: ; preds = %44, %22
%24 = load i32, i32* %15
%25 = load i32, i32* %8
%26 = icmp ult i32 %24, %25
br i1 %26, label %27, label %47
27: ; preds = %23
store i32 0, i32* %16
br label %28
28: ; preds = %40, %27
%29 = load i32, i32* %16
%30 = load i32, i32* %11
%31 = icmp ult i32 %29, %30
br i1 %31, label %32, label %43
32: ; preds = %28
%33 = load [10 x double]*, [10 x double]** %14
%34 = load i32, i32* %15
%35 = zext i32 %34 to i64
%36 = getelementptr inbounds [10 x double], [10 x double]* %33, i64 %35
%37 = load i32, i32* %16
%38 = zext i32 %37 to i64
%39 = getelementptr inbounds [10 x double], [10 x double]* %36, i64 0, i64 %38
store double 0.000000e+00, double* %39
br label %40
40: ; preds = %32
%41 = load i32, i32* %16
%42 = add i32 %41, 1
store i32 %42, i32* %16
br label %28
43: ; preds = %28
br label %44
44: ; preds = %43
%45 = load i32, i32* %15
%46 = add i32 %45, 1
store i32 %46, i32* %15
br label %23
47: ; preds = %23
store i32 0, i32* %15
br label %48
48: ; preds = %120, %47
%49 = load i32, i32* %15
%50 = load i32, i32* %8
%51 = icmp ult i32 %49, %50
br i1 %51, label %52, label %123
52: ; preds = %48
store i32 0, i32* %16
br label %53
53: ; preds = %116, %52
%54 = load i32, i32* %16
%55 = load i32, i32* %11
%56 = icmp ult i32 %54, %55
br i1 %56, label %57, label %119
57: ; preds = %53
store i32 0, i32* %17
br label %58
58: ; preds = %112, %57
%59 = load i32, i32* %17
%60 = load i32, i32* %9
%61 = icmp ult i32 %59, %60
br i1 %61, label %62, label %115
62: ; preds = %58
%63 = load [10 x double]*, [10 x double]** %12
%64 = load i32, i32* %15
%65 = zext i32 %64 to i64
%66 = getelementptr inbounds [10 x double], [10 x double]* %63, i64 %65
%67 = load i32, i32* %17
%68 = zext i32 %67 to i64
%69 = getelementptr inbounds [10 x double], [10 x double]* %66, i64 0, i64 %68
%70 = load double, double* %69
%71 = load [10 x double]*, [10 x double]** %13
%72 = load i32, i32* %17
%73 = zext i32 %72 to i64
%74 = getelementptr inbounds [10 x double], [10 x double]* %71, i64 %73
%75 = load i32, i32* %16
%76 = zext i32 %75 to i64
%77 = getelementptr inbounds [10 x double], [10 x double]* %74, i64 0, i64 %76
%78 = load double, double* %77
%79 = fmul double %70, %78
store double %79, double* %18
%80 = load [10 x double]*, [10 x double]** %14
%81 = load i32, i32* %15
%82 = zext i32 %81 to i64
%83 = getelementptr inbounds [10 x double], [10 x double]* %80, i64 %82
%84 = load i32, i32* %16
%85 = zext i32 %84 to i64
%86 = getelementptr inbounds [10 x double], [10 x double]* %83, i64 0, i64 %85
%87 = load double, double* %86
%88 = load [10 x double]*, [10 x double]** %12
%89 = load i32, i32* %15
%90 = zext i32 %89 to i64
%91 = getelementptr inbounds [10 x double], [10 x double]* %88, i64 %90
%92 = load i32, i32* %17
%93 = zext i32 %92 to i64
%94 = getelementptr inbounds [10 x double], [10 x double]* %91, i64 0, i64 %93
%95 = load double, double* %94
%96 = load [10 x double]*, [10 x double]** %13
%97 = load i32, i32* %17
%98 = zext i32 %97 to i64
%99 = getelementptr inbounds [10 x double], [10 x double]* %96, i64 %98
%100 = load i32, i32* %16
%101 = zext i32 %100 to i64
%102 = getelementptr inbounds [10 x double], [10 x double]* %99, i64 0, i64 %101
%103 = load double, double* %102
%104 = call double @llvm.fmuladd.f64(double %95, double %103, double %87)
%105 = load [10 x double]*, [10 x double]** %14
%106 = load i32, i32* %15
%107 = zext i32 %106 to i64
%108 = getelementptr inbounds [10 x double], [10 x double]* %105, i64 %107
%109 = load i32, i32* %16
%110 = zext i32 %109 to i64
%111 = getelementptr inbounds [10 x double], [10 x double]* %108, i64 0, i64 %110
store double %104, double* %111
br label %112
112: ; preds = %62
%113 = load i32, i32* %17
%114 = add i32 %113, 1
store i32 %114, i32* %17
br label %58
115: ; preds = %58
br label %116
116: ; preds = %115
%117 = load i32, i32* %16
%118 = add i32 %117, 1
store i32 %118, i32* %16
br label %53
119: ; preds = %53
br label %120
120: ; preds = %119
%121 = load i32, i32* %15
%122 = add i32 %121, 1
store i32 %122, i32* %15
br label %48
123: ; preds = %48
br label %126
124: ; preds = %7
%125 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0))
br label %126
126: ; preds = %124, %123
ret void
}

LLVM IR (-O2):
@str = [61 x i8] c"\0AError! Operation invalid, please enter with valid matrices.\00"
define void @double_matrix_multiplication(i32 %0, i32 %1, i32 %2, i32 %3, [10 x double]* nocapture %4, [10 x double]* nocapture %5, [10 x double]* nocapture %6) {
%8 = icmp eq i32 %1, %2
br i1 %8, label %9, label %104
9: ; preds = %7
%10 = icmp eq i32 %0, 0
br i1 %10, label %106, label %11
11: ; preds = %9
%12 = icmp eq i32 %3, 0
%13 = zext i32 %3 to i64
%14 = shl nuw nsw i64 %13, 3
%15 = zext i32 %0 to i64
%16 = add nsw i64 %15, -1
%17 = and i64 %15, 3
%18 = icmp ult i64 %16, 3
br i1 %18, label %36, label %19
19: ; preds = %11
%20 = and i64 %15, 4294967292
br label %21
21: ; preds = %60, %19
%22 = phi i64 [ 0, %19 ], [ %61, %60 ]
%23 = phi i64 [ 0, %19 ], [ %62, %60 ]
br i1 %12, label %60, label %24
24: ; preds = %21
%25 = getelementptr [10 x double], [10 x double]* %6, i64 %22, i64 0
%26 = bitcast double* %25 to i8*
%27 = or i64 %22, 1
%28 = getelementptr [10 x double], [10 x double]* %6, i64 %27, i64 0
%29 = bitcast double* %28 to i8*
%30 = or i64 %22, 2
%31 = getelementptr [10 x double], [10 x double]* %6, i64 %30, i64 0
%32 = bitcast double* %31 to i8*
%33 = or i64 %22, 3
%34 = getelementptr [10 x double], [10 x double]* %6, i64 %33, i64 0
%35 = bitcast double* %34 to i8*
br label %60
36: ; preds = %60, %11
%37 = phi i64 [ 0, %11 ], [ %61, %60 ]
%38 = icmp eq i64 %17, 0
br i1 %38, label %49, label %39
39: ; preds = %36, %45
%40 = phi i64 [ %46, %45 ], [ %37, %36 ]
%41 = phi i64 [ %47, %45 ], [ 0, %36 ]
br i1 %12, label %45, label %42
42: ; preds = %39
%43 = getelementptr [10 x double], [10 x double]* %6, i64 %40, i64 0
%44 = bitcast double* %43 to i8*
br label %45
45: ; preds = %42, %39
%46 = add nuw nsw i64 %40, 1
%47 = add i64 %41, 1
%48 = icmp eq i64 %47, %17
br i1 %48, label %49, label %39
49: ; preds = %45, %36
br i1 %10, label %106, label %50
50: ; preds = %49
%51 = icmp eq i32 %3, 0
%52 = icmp eq i32 %1, 0
%53 = zext i32 %0 to i64
%54 = zext i32 %3 to i64
%55 = zext i32 %1 to i64
%56 = and i64 %55, 1
%57 = icmp eq i32 %1, 1
%58 = and i64 %55, 4294967294
%59 = icmp eq i64 %56, 0
br label %64
60: ; preds = %21, %24
%61 = add nuw nsw i64 %22, 4
%62 = add i64 %23, 4
%63 = icmp eq i64 %62, %20
br i1 %63, label %36, label %21
64: ; preds = %50, %101
%65 = phi i64 [ 0, %50 ], [ %102, %101 ]
br i1 %51, label %101, label %66
66: ; preds = %64, %98
%67 = phi i64 [ %99, %98 ], [ 0, %64 ]
br i1 %52, label %98, label %68
68: ; preds = %66
%69 = getelementptr inbounds [10 x double], [10 x double]* %6, i64 %65, i64 %67
%70 = load double, double* %69
br i1 %57, label %89, label %71
71: ; preds = %68, %71
%72 = phi double [ %85, %71 ], [ %70, %68 ]
%73 = phi i64 [ %86, %71 ], [ 0, %68 ]
%74 = phi i64 [ %87, %71 ], [ 0, %68 ]
%75 = getelementptr inbounds [10 x double], [10 x double]* %4, i64 %65, i64 %73
%76 = load double, double* %75
%77 = getelementptr inbounds [10 x double], [10 x double]* %5, i64 %73, i64 %67
%78 = load double, double* %77
%79 = tail call double @llvm.fmuladd.f64(double %76, double %78, double %72)
store double %79, double* %69
%80 = or i64 %73, 1
%81 = getelementptr inbounds [10 x double], [10 x double]* %4, i64 %65, i64 %80
%82 = load double, double* %81
%83 = getelementptr inbounds [10 x double], [10 x double]* %5, i64 %80, i64 %67
%84 = load double, double* %83
%85 = tail call double @llvm.fmuladd.f64(double %82, double %84, double %79)
store double %85, double* %69
%86 = add nuw nsw i64 %73, 2
%87 = add i64 %74, 2
%88 = icmp eq i64 %87, %58
br i1 %88, label %89, label %71
89: ; preds = %71, %68
%90 = phi double [ %70, %68 ], [ %85, %71 ]
%91 = phi i64 [ 0, %68 ], [ %86, %71 ]
br i1 %59, label %98, label %92
92: ; preds = %89
%93 = getelementptr inbounds [10 x double], [10 x double]* %4, i64 %65, i64 %91
%94 = load double, double* %93
%95 = getelementptr inbounds [10 x double], [10 x double]* %5, i64 %91, i64 %67
%96 = load double, double* %95
%97 = tail call double @llvm.fmuladd.f64(double %94, double %96, double %90)
store double %97, double* %69
br label %98
98: ; preds = %92, %89, %66
%99 = add nuw nsw i64 %67, 1
%100 = icmp eq i64 %99, %54
br i1 %100, label %101, label %66
101: ; preds = %98, %64
%102 = add nuw nsw i64 %65, 1
%103 = icmp eq i64 %102, %53
br i1 %103, label %106, label %64
104: ; preds = %7
%105 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str, i64 0, i64 0))
br label %106
106: ; preds = %101, %9, %49, %104
ret void
}