#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 */
double **allocateDoubleMatrix(int, int);
double **addMatrix(double **A, double **B, int n, int m) {
  int i, j;
  double **X;
  X = allocateDoubleMatrix(n, m);
  for (i = 0; i < n; i++)
    for (j = 0; j < m; j++)
      X[i][j] = A[i][j] + B[i][j];
  return X;
}


x86 assembly (clang, -O0):
<addMatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1030 <allocateDoubleMatrix@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11bb <addMatrix+0xab>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11a8 <addMatrix+0x98>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x20(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x20(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    114f <addMatrix+0x3f>
jmp    11ad <addMatrix+0x9d>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113c <addMatrix+0x2c>
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<addMatrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %ecx,%r14d
mov    %edx,%ebp
mov    %rsi,0x20(%rsp)
mov    %rdi,%r15
mov    %edx,%edi
mov    %ecx,%esi
call   1030 <allocateDoubleMatrix@plt>
test   %ebp,%ebp
jle    1382 <addMatrix+0x272>
mov    %ebp,%r12d
mov    %r14d,%edx
mov    %edx,%ecx
and    $0xfffffffc,%ecx
mov    %rcx,0x18(%rsp)
add    $0xfffffffffffffffc,%rcx
mov    %rcx,0x10(%rsp)
mov    %rcx,%rsi
shr    $0x2,%rsi
add    $0x1,%rsi
mov    %rsi,%rcx
mov    %rsi,0x8(%rsp)
and    $0xfffffffffffffffe,%rsi
mov    %rsi,(%rsp)
mov    %edx,%r13d
and    $0x3,%r13d
xor    %r9d,%r9d
jmp    118d <addMatrix+0x7d>
nopl   0x0(%rax)
add    $0x1,%r9
cmp    %r12,%r9
je     1382 <addMatrix+0x272>
test   %r14d,%r14d
jle    1180 <addMatrix+0x70>
mov    (%r15,%r9,8),%rsi
mov    0x20(%rsp),%rcx
mov    (%rcx,%r9,8),%rcx
mov    (%rax,%r9,8),%rbp
cmp    $0x4,%r14d
jb     12c0 <addMatrix+0x1b0>
lea    0x0(,%rdx,8),%rdi
add    %rbp,%rdi
lea    (%rsi,%rdx,8),%rbx
lea    (%rcx,%rdx,8),%r11
cmp    %rbx,%rbp
setb   %r10b
cmp    %rdi,%rsi
setb   %r8b
cmp    %r11,%rbp
setb   %bl
cmp    %rdi,%rcx
setb   %dil
test   %r8b,%r10b
jne    12c0 <addMatrix+0x1b0>
mov    $0x0,%r11d
and    %dil,%bl
jne    12c3 <addMatrix+0x1b3>
cmpq   $0x0,0x10(%rsp)
je     1370 <addMatrix+0x260>
mov    (%rsp),%rdi
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
movupd (%rsi,%rbx,8),%xmm0
movupd 0x10(%rsi,%rbx,8),%xmm1
movupd (%rcx,%rbx,8),%xmm2
addpd  %xmm0,%xmm2
movupd 0x10(%rcx,%rbx,8),%xmm0
addpd  %xmm1,%xmm0
movupd %xmm2,0x0(%rbp,%rbx,8)
movupd %xmm0,0x10(%rbp,%rbx,8)
movupd 0x20(%rsi,%rbx,8),%xmm0
movupd 0x30(%rsi,%rbx,8),%xmm1
movupd 0x20(%rcx,%rbx,8),%xmm2
addpd  %xmm0,%xmm2
movupd 0x30(%rcx,%rbx,8),%xmm0
addpd  %xmm1,%xmm0
movupd %xmm2,0x20(%rbp,%rbx,8)
movupd %xmm0,0x30(%rbp,%rbx,8)
add    $0x8,%rbx
add    $0xfffffffffffffffe,%rdi
jne    1210 <addMatrix+0x100>
testb  $0x1,0x8(%rsp)
je     12a1 <addMatrix+0x191>
movupd (%rsi,%rbx,8),%xmm0
movupd 0x10(%rsi,%rbx,8),%xmm1
movupd (%rcx,%rbx,8),%xmm2
addpd  %xmm0,%xmm2
movupd 0x10(%rcx,%rbx,8),%xmm0
addpd  %xmm1,%xmm0
movupd %xmm2,0x0(%rbp,%rbx,8)
movupd %xmm0,0x10(%rbp,%rbx,8)
mov    0x18(%rsp),%rdi
mov    %rdi,%r11
cmp    %rdx,%rdi
je     1180 <addMatrix+0x70>
jmp    12c3 <addMatrix+0x1b3>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %r11d,%r11d
mov    %r11,%rdi
not    %rdi
add    %rdx,%rdi
test   %r13,%r13
je     12fd <addMatrix+0x1ed>
mov    %r13,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsd  (%rsi,%r11,8),%xmm0
addsd  (%rcx,%r11,8),%xmm0
movsd  %xmm0,0x0(%rbp,%r11,8)
add    $0x1,%r11
add    $0xffffffffffffffff,%rbx
jne    12e0 <addMatrix+0x1d0>
cmp    $0x3,%rdi
jb     1180 <addMatrix+0x70>
nopw   0x0(%rax,%rax,1)
movsd  (%rsi,%r11,8),%xmm0
addsd  (%rcx,%r11,8),%xmm0
movsd  %xmm0,0x0(%rbp,%r11,8)
movsd  0x8(%rsi,%r11,8),%xmm0
addsd  0x8(%rcx,%r11,8),%xmm0
movsd  %xmm0,0x8(%rbp,%r11,8)
movsd  0x10(%rsi,%r11,8),%xmm0
addsd  0x10(%rcx,%r11,8),%xmm0
movsd  %xmm0,0x10(%rbp,%r11,8)
movsd  0x18(%rsi,%r11,8),%xmm0
addsd  0x18(%rcx,%r11,8),%xmm0
movsd  %xmm0,0x18(%rbp,%r11,8)
add    $0x4,%r11
cmp    %r11,%rdx
jne    1310 <addMatrix+0x200>
jmp    1180 <addMatrix+0x70>
xor    %ebx,%ebx
testb  $0x1,0x8(%rsp)
jne    1277 <addMatrix+0x167>
jmp    12a1 <addMatrix+0x191>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define double** @addMatrix(double** nocapture %0, double** nocapture %1, i32 %2, i32 %3) {
%5 = tail call double** @allocateDoubleMatrix(i32 %2, i32 %3)
%6 = icmp sgt i32 %2, 0
br i1 %6, label %7, label %163
7: ; preds = %4
%8 = icmp sgt i32 %3, 0
%9 = zext i32 %2 to i64
%10 = zext i32 %3 to i64
%11 = and i64 %10, 4294967292
%12 = add nsw i64 %11, -4
%13 = lshr exact i64 %12, 2
%14 = add nuw nsw i64 %13, 1
%15 = icmp ult i32 %3, 4
%16 = and i64 %10, 4294967292
%17 = and i64 %14, 1
%18 = icmp eq i64 %12, 0
%19 = and i64 %14, 9223372036854775806
%20 = icmp eq i64 %17, 0
%21 = icmp eq i64 %16, %10
%22 = and i64 %10, 3
%23 = icmp eq i64 %22, 0
br label %24
24: ; preds = %7, %160
%25 = phi i64 [ 0, %7 ], [ %161, %160 ]
br i1 %8, label %26, label %160
26: ; preds = %24
%27 = getelementptr inbounds double*, double** %0, i64 %25
%28 = load double*, double** %27
%29 = getelementptr inbounds double*, double** %1, i64 %25
%30 = load double*, double** %29
%31 = getelementptr inbounds double*, double** %5, i64 %25
%32 = load double*, double** %31
br i1 %15, label %110, label %33
33: ; preds = %26
%34 = getelementptr double, double* %32, i64 %10
%35 = getelementptr double, double* %28, i64 %10
%36 = getelementptr double, double* %30, i64 %10
%37 = icmp ult double* %32, %35
%38 = icmp ult double* %28, %34
%39 = and i1 %37, %38
%40 = icmp ult double* %32, %36
%41 = icmp ult double* %30, %34
%42 = and i1 %40, %41
%43 = or i1 %39, %42
br i1 %43, label %110, label %44
44: ; preds = %33
br i1 %18, 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* %28, 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* %30, 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 = fadd <2 x double> %50, %56
%61 = fadd <2 x double> %53, %59
%62 = getelementptr inbounds double, double* %32, 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* %28, 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* %30, 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 = fadd <2 x double> %69, %75
%80 = fadd <2 x double> %72, %78
%81 = getelementptr inbounds double, double* %32, 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, %19
br i1 %87, label %88, label %45
88: ; preds = %45, %44
%89 = phi i64 [ 0, %44 ], [ %85, %45 ]
br i1 %20, label %109, label %90
90: ; preds = %88
%91 = getelementptr inbounds double, double* %28, 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* %30, 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 = fadd <2 x double> %93, %99
%104 = fadd <2 x double> %96, %102
%105 = getelementptr inbounds double, double* %32, 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 %21, label %160, label %110
110: ; preds = %33, %26, %109
%111 = phi i64 [ 0, %33 ], [ 0, %26 ], [ %16, %109 ]
%112 = xor i64 %111, -1
%113 = add nsw i64 %112, %10
br i1 %23, 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* %28, i64 %115
%118 = load double, double* %117
%119 = getelementptr inbounds double, double* %30, i64 %115
%120 = load double, double* %119
%121 = fadd double %118, %120
%122 = getelementptr inbounds double, double* %32, i64 %115
store double %121, double* %122
%123 = add nuw nsw i64 %115, 1
%124 = add i64 %116, 1
%125 = icmp eq i64 %124, %22
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* %28, i64 %130
%132 = load double, double* %131
%133 = getelementptr inbounds double, double* %30, i64 %130
%134 = load double, double* %133
%135 = fadd double %132, %134
%136 = getelementptr inbounds double, double* %32, i64 %130
store double %135, double* %136
%137 = add nuw nsw i64 %130, 1
%138 = getelementptr inbounds double, double* %28, i64 %137
%139 = load double, double* %138
%140 = getelementptr inbounds double, double* %30, i64 %137
%141 = load double, double* %140
%142 = fadd double %139, %141
%143 = getelementptr inbounds double, double* %32, i64 %137
store double %142, double* %143
%144 = add nuw nsw i64 %130, 2
%145 = getelementptr inbounds double, double* %28, i64 %144
%146 = load double, double* %145
%147 = getelementptr inbounds double, double* %30, i64 %144
%148 = load double, double* %147
%149 = fadd double %146, %148
%150 = getelementptr inbounds double, double* %32, i64 %144
store double %149, double* %150
%151 = add nuw nsw i64 %130, 3
%152 = getelementptr inbounds double, double* %28, i64 %151
%153 = load double, double* %152
%154 = getelementptr inbounds double, double* %30, i64 %151
%155 = load double, double* %154
%156 = fadd double %153, %155
%157 = getelementptr inbounds double, double* %32, i64 %151
store double %156, double* %157
%158 = add nuw nsw i64 %130, 4
%159 = icmp eq i64 %158, %10
br i1 %159, label %160, label %129
160: ; preds = %126, %129, %109, %24
%161 = add nuw nsw i64 %25, 1
%162 = icmp eq i64 %161, %9
br i1 %162, label %163, label %24
163: ; preds = %160, %4
ret double** %5
}