#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 */
void sub(size_t r, size_t c, double X[r][c], double Y[r][c], double Z[r][c]) {
  size_t i, j;
  for (i = 0; i < r; i++) {
    for (j = 0; j < c; j++)
      Z[i][j] = X[i][j] - Y[i][j];
  }
}


x86 assembly (clang, -O0):
<sub>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x40(%rbp)
movq   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x8(%rbp),%rax
jae    11da <sub+0xda>
movq   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    11c4 <sub+0xc4>
mov    -0x40(%rbp),%rcx
mov    -0x48(%rbp),%rdx
mov    -0x50(%rbp),%rsi
mov    -0x18(%rbp),%rax
imul   -0x30(%rbp),%rsi
shl    $0x3,%rsi
add    %rsi,%rax
mov    -0x38(%rbp),%rsi
movsd  (%rax,%rsi,8),%xmm0
mov    -0x20(%rbp),%rax
imul   -0x30(%rbp),%rdx
shl    $0x3,%rdx
add    %rdx,%rax
mov    -0x38(%rbp),%rdx
subsd  (%rax,%rdx,8),%xmm0
mov    -0x28(%rbp),%rax
imul   -0x30(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    -0x38(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    114e <sub+0x4e>
jmp    11c9 <sub+0xc9>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1138 <sub+0x38>
pop    %rbp
ret

x86 assembly (clang, -O2):
<sub>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %r8,-0x38(%rsp)
mov    %rcx,-0x40(%rsp)
mov    %rdx,-0x48(%rsp)
test   %rdi,%rdi
je     140f <sub+0x30f>
lea    -0x4(%rsi),%rax
mov    %rax,-0x18(%rsp)
mov    %rax,%rcx
shr    $0x2,%rcx
add    $0x1,%rcx
mov    %rsi,%rax
and    $0xfffffffffffffffc,%rax
mov    %rax,-0x28(%rsp)
mov    %rcx,%rax
mov    %rcx,-0x20(%rsp)
and    $0xfffffffffffffffe,%rcx
mov    %rcx,-0x30(%rsp)
mov    %esi,%r9d
and    $0x3,%r9d
mov    -0x48(%rsp),%rdx
lea    0x30(%rdx),%r13
lea    0x0(,%rsi,8),%r12
mov    -0x40(%rsp),%rcx
lea    0x30(%rcx),%r10
mov    -0x38(%rsp),%r8
lea    0x30(%r8),%rax
xor    %r15d,%r15d
mov    %r9,-0x50(%rsp)
mov    %rdi,-0x58(%rsp)
mov    %r12,-0x60(%rsp)
jmp    11bf <sub+0xbf>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%r15
add    %r12,%r13
add    %r12,%r10
add    %r12,%rax
add    %r12,%r8
add    %r12,%rcx
add    %r12,%rdx
cmp    %rdi,%r15
je     140f <sub+0x30f>
test   %rsi,%rsi
je     11a0 <sub+0xa0>
cmp    $0x4,%rsi
jae    11e0 <sub+0xe0>
xor    %r11d,%r11d
jmp    1360 <sub+0x260>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r15,%rdi
imul   %rsi,%rdi
lea    (%rdi,%rsi,1),%rbp
mov    -0x38(%rsp),%rbx
lea    (%rbx,%rdi,8),%r14
lea    (%rbx,%rbp,8),%r12
mov    -0x48(%rsp),%r9
lea    (%r9,%rdi,8),%r11
lea    (%r9,%rbp,8),%rbx
mov    %rbx,-0x68(%rsp)
mov    -0x40(%rsp),%r9
lea    (%r9,%rdi,8),%rdi
mov    %rdi,-0x8(%rsp)
lea    (%r9,%rbp,8),%rdi
cmp    -0x68(%rsp),%r14
setb   %bpl
mov    %r11,-0x10(%rsp)
cmp    %r12,%r11
setb   %r9b
mov    %r14,-0x68(%rsp)
cmp    %rdi,%r14
mov    -0x8(%rsp),%r14
setb   %dil
cmp    %r12,%r14
setb   %bl
test   %r9b,%bpl
jne    127a <sub+0x17a>
mov    $0x0,%r11d
and    %bl,%dil
mov    -0x58(%rsp),%rdi
mov    -0x50(%rsp),%r9
mov    -0x60(%rsp),%r12
jne    1360 <sub+0x260>
cmpq   $0x4,-0x18(%rsp)
jae    1291 <sub+0x191>
xor    %ebp,%ebp
jmp    1308 <sub+0x208>
xor    %r11d,%r11d
mov    -0x58(%rsp),%rdi
mov    -0x50(%rsp),%r9
mov    -0x60(%rsp),%r12
jmp    1360 <sub+0x260>
mov    -0x30(%rsp),%rbx
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
movupd -0x30(%r13,%rbp,8),%xmm0
movupd -0x20(%r13,%rbp,8),%xmm1
movupd -0x30(%r10,%rbp,8),%xmm2
subpd  %xmm2,%xmm0
movupd -0x20(%r10,%rbp,8),%xmm2
subpd  %xmm2,%xmm1
movupd %xmm0,-0x30(%rax,%rbp,8)
movupd %xmm1,-0x20(%rax,%rbp,8)
movupd -0x10(%r13,%rbp,8),%xmm0
movupd 0x0(%r13,%rbp,8),%xmm1
movupd -0x10(%r10,%rbp,8),%xmm2
subpd  %xmm2,%xmm0
movupd (%r10,%rbp,8),%xmm2
subpd  %xmm2,%xmm1
movupd %xmm0,-0x10(%rax,%rbp,8)
movupd %xmm1,(%rax,%rbp,8)
add    $0x8,%rbp
add    $0xfffffffffffffffe,%rbx
jne    12a0 <sub+0x1a0>
testb  $0x1,-0x20(%rsp)
je     1344 <sub+0x244>
mov    -0x10(%rsp),%rbx
movupd (%rbx,%rbp,8),%xmm0
movupd 0x10(%rbx,%rbp,8),%xmm1
movupd (%r14,%rbp,8),%xmm2
subpd  %xmm2,%xmm0
movupd 0x10(%r14,%rbp,8),%xmm2
subpd  %xmm2,%xmm1
mov    -0x68(%rsp),%rbx
movupd %xmm0,(%rbx,%rbp,8)
movupd %xmm1,0x10(%rbx,%rbp,8)
mov    -0x28(%rsp),%rbp
mov    %rbp,%r11
cmp    %rsi,%rbp
je     11a0 <sub+0xa0>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r11,%rbx
not    %rbx
add    %rsi,%rbx
test   %r9,%r9
je     139c <sub+0x29c>
mov    %r9,%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  (%rdx,%r11,8),%xmm0
subsd  (%rcx,%r11,8),%xmm0
movsd  %xmm0,(%r8,%r11,8)
add    $0x1,%r11
add    $0xffffffffffffffff,%rbp
jne    1380 <sub+0x280>
cmp    $0x3,%rbx
jb     11a0 <sub+0xa0>
cs nopw 0x0(%rax,%rax,1)
movsd  (%rdx,%r11,8),%xmm0
subsd  (%rcx,%r11,8),%xmm0
movsd  %xmm0,(%r8,%r11,8)
movsd  0x8(%rdx,%r11,8),%xmm0
subsd  0x8(%rcx,%r11,8),%xmm0
movsd  %xmm0,0x8(%r8,%r11,8)
movsd  0x10(%rdx,%r11,8),%xmm0
subsd  0x10(%rcx,%r11,8),%xmm0
movsd  %xmm0,0x10(%r8,%r11,8)
movsd  0x18(%rdx,%r11,8),%xmm0
subsd  0x18(%rcx,%r11,8),%xmm0
movsd  %xmm0,0x18(%r8,%r11,8)
add    $0x4,%r11
cmp    %r11,%rsi
jne    13b0 <sub+0x2b0>
jmp    11a0 <sub+0xa0>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @sub(i64 %0, i64 %1, double* %2, double* %3, double* %4) {
%6 = alloca i64
%7 = alloca i64
%8 = alloca double*
%9 = alloca double*
%10 = alloca double*
%11 = alloca i64
%12 = alloca i64
store i64 %0, i64* %6
store i64 %1, i64* %7
store double* %2, double** %8
store double* %3, double** %9
store double* %4, double** %10
%13 = load i64, i64* %6
%14 = load i64, i64* %7
%15 = load i64, i64* %6
%16 = load i64, i64* %7
%17 = load i64, i64* %6
%18 = load i64, i64* %7
store i64 0, i64* %11
br label %19
19: ; preds = %54, %5
%20 = load i64, i64* %11
%21 = load i64, i64* %6
%22 = icmp ult i64 %20, %21
br i1 %22, label %23, label %57
23: ; preds = %19
store i64 0, i64* %12
br label %24
24: ; preds = %50, %23
%25 = load i64, i64* %12
%26 = load i64, i64* %7
%27 = icmp ult i64 %25, %26
br i1 %27, label %28, label %53
28: ; preds = %24
%29 = load double*, double** %8
%30 = load i64, i64* %11
%31 = mul nsw i64 %30, %14
%32 = getelementptr inbounds double, double* %29, i64 %31
%33 = load i64, i64* %12
%34 = getelementptr inbounds double, double* %32, i64 %33
%35 = load double, double* %34
%36 = load double*, double** %9
%37 = load i64, i64* %11
%38 = mul nsw i64 %37, %16
%39 = getelementptr inbounds double, double* %36, i64 %38
%40 = load i64, i64* %12
%41 = getelementptr inbounds double, double* %39, i64 %40
%42 = load double, double* %41
%43 = fsub double %35, %42
%44 = load double*, double** %10
%45 = load i64, i64* %11
%46 = mul nsw i64 %45, %18
%47 = getelementptr inbounds double, double* %44, i64 %46
%48 = load i64, i64* %12
%49 = getelementptr inbounds double, double* %47, i64 %48
store double %43, double* %49
br label %50
50: ; preds = %28
%51 = load i64, i64* %12
%52 = add i64 %51, 1
store i64 %52, i64* %12
br label %24
53: ; preds = %24
br label %54
54: ; preds = %53
%55 = load i64, i64* %11
%56 = add i64 %55, 1
store i64 %56, i64* %11
br label %19
57: ; preds = %19
ret void
}

LLVM IR (-O2):
define void @sub(i64 %0, i64 %1, double* nocapture %2, double* nocapture %3, double* nocapture writeonly %4) {
%6 = icmp eq i64 %0, 0
br i1 %6, label %163, label %7
7: ; preds = %5
%8 = icmp eq i64 %1, 0
%9 = add i64 %1, -4
%10 = lshr i64 %9, 2
%11 = add nuw nsw i64 %10, 1
%12 = icmp ult i64 %1, 4
%13 = and i64 %1, -4
%14 = and i64 %11, 1
%15 = icmp ult i64 %9, 4
%16 = and i64 %11, 9223372036854775806
%17 = icmp eq i64 %14, 0
%18 = icmp eq i64 %13, %1
%19 = and i64 %1, 3
%20 = icmp eq i64 %19, 0
br label %21
21: ; preds = %7, %160
%22 = phi i64 [ 0, %7 ], [ %161, %160 ]
%23 = mul i64 %22, %1
%24 = getelementptr double, double* %4, i64 %23
%25 = add i64 %23, %1
%26 = getelementptr double, double* %4, i64 %25
%27 = getelementptr double, double* %2, i64 %23
%28 = getelementptr double, double* %2, i64 %25
%29 = getelementptr double, double* %3, i64 %23
%30 = getelementptr double, double* %3, i64 %25
br i1 %8, label %160, label %31
31: ; preds = %21
%32 = mul nsw i64 %22, %1
%33 = getelementptr inbounds double, double* %2, i64 %32
%34 = getelementptr inbounds double, double* %3, i64 %32
%35 = getelementptr inbounds double, double* %4, i64 %32
br i1 %12, label %110, label %36
36: ; preds = %31
%37 = icmp ult double* %24, %28
%38 = icmp ult double* %27, %26
%39 = and i1 %37, %38
%40 = icmp ult double* %24, %30
%41 = icmp ult double* %29, %26
%42 = and i1 %40, %41
%43 = or i1 %39, %42
br i1 %43, label %110, label %44
44: ; preds = %36
br i1 %15, label %88, label %45
45: ; preds = %44, %45
%46 = phi i64 [ %85, %45 ], [ 0, %44 ]
%47 = phi i64 [ %86, %45 ], [ 0, %44 ]
%48 = getelementptr inbounds double, double* %33, i64 %46
%49 = bitcast double* %48 to <2 x double>*
%50 = load <2 x double>, <2 x double>* %49
%51 = getelementptr inbounds double, double* %48, i64 2
%52 = bitcast double* %51 to <2 x double>*
%53 = load <2 x double>, <2 x double>* %52
%54 = getelementptr inbounds double, double* %34, i64 %46
%55 = bitcast double* %54 to <2 x double>*
%56 = load <2 x double>, <2 x double>* %55
%57 = getelementptr inbounds double, double* %54, i64 2
%58 = bitcast double* %57 to <2 x double>*
%59 = load <2 x double>, <2 x double>* %58
%60 = fsub <2 x double> %50, %56
%61 = fsub <2 x double> %53, %59
%62 = getelementptr inbounds double, double* %35, i64 %46
%63 = bitcast double* %62 to <2 x double>*
store <2 x double> %60, <2 x double>* %63
%64 = getelementptr inbounds double, double* %62, i64 2
%65 = bitcast double* %64 to <2 x double>*
store <2 x double> %61, <2 x double>* %65
%66 = or i64 %46, 4
%67 = getelementptr inbounds double, double* %33, i64 %66
%68 = bitcast double* %67 to <2 x double>*
%69 = load <2 x double>, <2 x double>* %68
%70 = getelementptr inbounds double, double* %67, i64 2
%71 = bitcast double* %70 to <2 x double>*
%72 = load <2 x double>, <2 x double>* %71
%73 = getelementptr inbounds double, double* %34, i64 %66
%74 = bitcast double* %73 to <2 x double>*
%75 = load <2 x double>, <2 x double>* %74
%76 = getelementptr inbounds double, double* %73, i64 2
%77 = bitcast double* %76 to <2 x double>*
%78 = load <2 x double>, <2 x double>* %77
%79 = fsub <2 x double> %69, %75
%80 = fsub <2 x double> %72, %78
%81 = getelementptr inbounds double, double* %35, i64 %66
%82 = bitcast double* %81 to <2 x double>*
store <2 x double> %79, <2 x double>* %82
%83 = getelementptr inbounds double, double* %81, i64 2
%84 = bitcast double* %83 to <2 x double>*
store <2 x double> %80, <2 x double>* %84
%85 = add nuw i64 %46, 8
%86 = add i64 %47, 2
%87 = icmp eq i64 %86, %16
br i1 %87, label %88, label %45
88: ; preds = %45, %44
%89 = phi i64 [ 0, %44 ], [ %85, %45 ]
br i1 %17, label %109, label %90
90: ; preds = %88
%91 = getelementptr inbounds double, double* %33, i64 %89
%92 = bitcast double* %91 to <2 x double>*
%93 = load <2 x double>, <2 x double>* %92
%94 = getelementptr inbounds double, double* %91, i64 2
%95 = bitcast double* %94 to <2 x double>*
%96 = load <2 x double>, <2 x double>* %95
%97 = getelementptr inbounds double, double* %34, i64 %89
%98 = bitcast double* %97 to <2 x double>*
%99 = load <2 x double>, <2 x double>* %98
%100 = getelementptr inbounds double, double* %97, i64 2
%101 = bitcast double* %100 to <2 x double>*
%102 = load <2 x double>, <2 x double>* %101
%103 = fsub <2 x double> %93, %99
%104 = fsub <2 x double> %96, %102
%105 = getelementptr inbounds double, double* %35, i64 %89
%106 = bitcast double* %105 to <2 x double>*
store <2 x double> %103, <2 x double>* %106
%107 = getelementptr inbounds double, double* %105, i64 2
%108 = bitcast double* %107 to <2 x double>*
store <2 x double> %104, <2 x double>* %108
br label %109
109: ; preds = %88, %90
br i1 %18, label %160, label %110
110: ; preds = %36, %31, %109
%111 = phi i64 [ 0, %36 ], [ 0, %31 ], [ %13, %109 ]
%112 = xor i64 %111, -1
%113 = add i64 %112, %1
br i1 %20, label %126, label %114
114: ; preds = %110, %114
%115 = phi i64 [ %123, %114 ], [ %111, %110 ]
%116 = phi i64 [ %124, %114 ], [ 0, %110 ]
%117 = getelementptr inbounds double, double* %33, i64 %115
%118 = load double, double* %117
%119 = getelementptr inbounds double, double* %34, i64 %115
%120 = load double, double* %119
%121 = fsub double %118, %120
%122 = getelementptr inbounds double, double* %35, i64 %115
store double %121, double* %122
%123 = add nuw i64 %115, 1
%124 = add i64 %116, 1
%125 = icmp eq i64 %124, %19
br i1 %125, label %126, label %114
126: ; preds = %114, %110
%127 = phi i64 [ %111, %110 ], [ %123, %114 ]
%128 = icmp ult i64 %113, 3
br i1 %128, label %160, label %129
129: ; preds = %126, %129
%130 = phi i64 [ %158, %129 ], [ %127, %126 ]
%131 = getelementptr inbounds double, double* %33, i64 %130
%132 = load double, double* %131
%133 = getelementptr inbounds double, double* %34, i64 %130
%134 = load double, double* %133
%135 = fsub double %132, %134
%136 = getelementptr inbounds double, double* %35, i64 %130
store double %135, double* %136
%137 = add nuw i64 %130, 1
%138 = getelementptr inbounds double, double* %33, i64 %137
%139 = load double, double* %138
%140 = getelementptr inbounds double, double* %34, i64 %137
%141 = load double, double* %140
%142 = fsub double %139, %141
%143 = getelementptr inbounds double, double* %35, i64 %137
store double %142, double* %143
%144 = add nuw i64 %130, 2
%145 = getelementptr inbounds double, double* %33, i64 %144
%146 = load double, double* %145
%147 = getelementptr inbounds double, double* %34, i64 %144
%148 = load double, double* %147
%149 = fsub double %146, %148
%150 = getelementptr inbounds double, double* %35, i64 %144
store double %149, double* %150
%151 = add nuw i64 %130, 3
%152 = getelementptr inbounds double, double* %33, i64 %151
%153 = load double, double* %152
%154 = getelementptr inbounds double, double* %34, i64 %151
%155 = load double, double* %154
%156 = fsub double %153, %155
%157 = getelementptr inbounds double, double* %35, i64 %151
store double %156, double* %157
%158 = add nuw i64 %130, 4
%159 = icmp eq i64 %158, %1
br i1 %159, label %160, label %129
160: ; preds = %126, %129, %109, %21
%161 = add nuw i64 %22, 1
%162 = icmp eq i64 %161, %0
br i1 %162, label %163, label %21
163: ; preds = %160, %5
ret void
}