#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 pow(double, int);
void mat_neg_euc(double **src1, double **src2, double **dest, int m, int n) {
  int i;
  int j;
  for (i = 0; i < m; i++)
    for (j = 0; j < n; j++)
      dest[i][j] = -pow((src1[i][j] - src2[i][j]), 2);
}


x86 assembly (clang, -O0):
<mat_neg_euc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11d2 <mat_neg_euc+0xc2>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    11bf <mat_neg_euc+0xaf>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x28(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1145 <mat_neg_euc+0x35>
jmp    11c4 <mat_neg_euc+0xb4>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1132 <mat_neg_euc+0x22>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mat_neg_euc>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r8d,0x4(%rsp)
test   %ecx,%ecx
jle    1243 <mat_neg_euc+0x133>
mov    %rdx,%r15
mov    %rsi,%rbp
mov    %rdi,%rbx
mov    %ecx,%eax
mov    %rax,0x10(%rsp)
mov    0x4(%rsp),%r13d
mov    %r13,0x8(%rsp)
and    $0xfffffffe,%r13d
xor    %r12d,%r12d
jmp    115f <mat_neg_euc+0x4f>
xchg   %ax,%ax
add    $0x1,%r12
cmp    0x10(%rsp),%r12
je     1243 <mat_neg_euc+0x133>
cmpl   $0x0,0x4(%rsp)
jle    1150 <mat_neg_euc+0x40>
cmpl   $0x1,0x4(%rsp)
jne    1180 <mat_neg_euc+0x70>
xor    %r14d,%r14d
jmp    1202 <mat_neg_euc+0xf2>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%rbx,%r12,8),%rax
movsd  (%rax,%r14,8),%xmm0
mov    0x0(%rbp,%r12,8),%rax
subsd  (%rax,%r14,8),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
movapd 0xe49(%rip),%xmm1
xorpd  %xmm1,%xmm0
mov    (%r15,%r12,8),%rax
movlpd %xmm0,(%rax,%r14,8)
mov    (%rbx,%r12,8),%rax
movsd  0x8(%rax,%r14,8),%xmm0
mov    0x0(%rbp,%r12,8),%rax
subsd  0x8(%rax,%r14,8),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
xorpd  0xe12(%rip),%xmm0
mov    (%r15,%r12,8),%rax
movlpd %xmm0,0x8(%rax,%r14,8)
add    $0x2,%r14
cmp    %r14,%r13
jne    1190 <mat_neg_euc+0x80>
testb  $0x1,0x8(%rsp)
je     1150 <mat_neg_euc+0x40>
mov    (%rbx,%r12,8),%rax
movsd  (%rax,%r14,8),%xmm0
mov    0x0(%rbp,%r12,8),%rax
subsd  (%rax,%r14,8),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
xorpd  0xdcc(%rip),%xmm0
mov    (%r15,%r12,8),%rax
movlpd %xmm0,(%rax,%r14,8)
jmp    1150 <mat_neg_euc+0x40>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @mat_neg_euc(double** nocapture %0, double** nocapture %1, double** nocapture %2, i32 %3, i32 %4) {
%6 = icmp sgt i32 %3, 0
br i1 %6, label %7, label %67
7: ; preds = %5
%8 = icmp sgt i32 %4, 0
%9 = zext i32 %3 to i64
%10 = zext i32 %4 to i64
%11 = and i64 %10, 1
%12 = icmp eq i32 %4, 1
%13 = and i64 %10, 4294967294
%14 = icmp eq i64 %11, 0
br label %15
15: ; preds = %7, %64
%16 = phi i64 [ 0, %7 ], [ %65, %64 ]
br i1 %8, label %17, label %64
17: ; preds = %15
%18 = getelementptr inbounds double*, double** %0, i64 %16
%19 = getelementptr inbounds double*, double** %1, i64 %16
%20 = getelementptr inbounds double*, double** %2, i64 %16
br i1 %12, label %50, label %21
21: ; preds = %17, %21
%22 = phi i64 [ %47, %21 ], [ 0, %17 ]
%23 = phi i64 [ %48, %21 ], [ 0, %17 ]
%24 = load double*, double** %18
%25 = getelementptr inbounds double, double* %24, i64 %22
%26 = load double, double* %25
%27 = load double*, double** %19
%28 = getelementptr inbounds double, double* %27, i64 %22
%29 = load double, double* %28
%30 = fsub double %26, %29
%31 = tail call double @pow(double %30, i32 2)
%32 = fneg double %31
%33 = load double*, double** %20
%34 = getelementptr inbounds double, double* %33, i64 %22
store double %32, double* %34
%35 = or i64 %22, 1
%36 = load double*, double** %18
%37 = getelementptr inbounds double, double* %36, i64 %35
%38 = load double, double* %37
%39 = load double*, double** %19
%40 = getelementptr inbounds double, double* %39, i64 %35
%41 = load double, double* %40
%42 = fsub double %38, %41
%43 = tail call double @pow(double %42, i32 2)
%44 = fneg double %43
%45 = load double*, double** %20
%46 = getelementptr inbounds double, double* %45, i64 %35
store double %44, double* %46
%47 = add nuw nsw i64 %22, 2
%48 = add i64 %23, 2
%49 = icmp eq i64 %48, %13
br i1 %49, label %50, label %21
50: ; preds = %21, %17
%51 = phi i64 [ 0, %17 ], [ %47, %21 ]
br i1 %14, label %64, label %52
52: ; preds = %50
%53 = load double*, double** %18
%54 = getelementptr inbounds double, double* %53, i64 %51
%55 = load double, double* %54
%56 = load double*, double** %19
%57 = getelementptr inbounds double, double* %56, i64 %51
%58 = load double, double* %57
%59 = fsub double %55, %58
%60 = tail call double @pow(double %59, i32 2)
%61 = fneg double %60
%62 = load double*, double** %20
%63 = getelementptr inbounds double, double* %62, i64 %51
store double %61, double* %63
br label %64
64: ; preds = %52, %50, %15
%65 = add nuw nsw i64 %16, 1
%66 = icmp eq i64 %65, %9
br i1 %66, label %67, label %15
67: ; preds = %64, %5
ret void
}