#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 */
scalar_t__ fabs(double);
double compute_error(double *A, double *B, double *C, double *E, double *F,
                     double *V) {
  double error = 0.0;
  long index, index_right, index_front, index_left, index_back, i, j;
  for (i = 1; i < 100 - 1; i++) {
    for (j = 1; j < 50 - 1; j++) {
      index = i * 50 + j;
      index_right = index + 1;
      index_front = index + 50;
      index_left = index - 1;
      index_back = index - 50;
      error += fabs(A[index] * V[index_left] + B[index] * V[index_right] +
                    C[index] * V[index_back] + E[index] * V[index_front] +
                    F[index] * V[index]);
    }
  }
  return (error);
}


x86 assembly (clang, -O0):
<compute_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
movq   $0x1,-0x68(%rbp)
cmpq   $0x63,-0x68(%rbp)
jge    1278 <compute_error+0x168>
movq   $0x1,-0x70(%rbp)
cmpq   $0x31,-0x70(%rbp)
jge    1262 <compute_error+0x152>
imul   $0x32,-0x68(%rbp),%rax
add    -0x70(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
mov    -0x40(%rbp),%rax
add    $0x32,%rax
mov    %rax,-0x50(%rbp)
mov    -0x40(%rbp),%rax
sub    $0x1,%rax
mov    %rax,-0x58(%rbp)
mov    -0x40(%rbp),%rax
sub    $0x32,%rax
mov    %rax,-0x60(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x30(%rbp),%rax
mov    -0x58(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x10(%rbp),%rax
mov    -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
mov    -0x48(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x18(%rbp),%rax
mov    -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
mov    -0x60(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
mov    -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x30(%rbp),%rax
mov    -0x50(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x28(%rbp),%rax
mov    -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
mov    -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <fabs@plt>
cvtsi2sd %rax,%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x70(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x70(%rbp)
jmp    1153 <compute_error+0x43>
jmp    1267 <compute_error+0x157>
mov    -0x68(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x68(%rbp)
jmp    1140 <compute_error+0x30>
movsd  -0x38(%rbp),%xmm0
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compute_error>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,%rbx
mov    %r8,%r15
mov    %rcx,%r12
mov    %rdx,%r13
mov    %rsi,%rbp
add    $0x328,%rbx
add    $0x198,%rdi
add    $0x198,%rbp
add    $0x198,%r13
add    $0x198,%r12
add    $0x198,%r15
xorps  %xmm0,%xmm0
mov    $0x1,%eax
nop
mov    %rax,0x8(%rsp)
xor    %r14d,%r14d
mov    %rdi,0x10(%rsp)
nopl   (%rax)
movsd  %xmm0,(%rsp)
movsd  0x0(%rbp,%r14,1),%xmm0
mulsd  -0x188(%rbx,%r14,1),%xmm0
fe ff ff
movsd  (%rdi,%r14,1),%xmm1
mulsd  -0x198(%rbx,%r14,1),%xmm1
fe ff ff
addsd  %xmm0,%xmm1
movsd  0x0(%r13,%r14,1),%xmm0
mulsd  -0x320(%rbx,%r14,1),%xmm0
fc ff ff
addsd  %xmm1,%xmm0
movsd  (%r12,%r14,1),%xmm1
mulsd  (%rbx,%r14,1),%xmm1
addsd  %xmm0,%xmm1
movsd  (%r15,%r14,1),%xmm0
mulsd  -0x190(%rbx,%r14,1),%xmm0
fe ff ff
addsd  %xmm1,%xmm0
call   1030 <fabs@plt>
mov    0x10(%rsp),%rdi
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  (%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movsd  (%rsp),%xmm0
add    $0x8,%r14
cmp    $0x180,%r14
jne    1170 <compute_error+0x60>
mov    0x8(%rsp),%rax
add    $0x1,%rax
add    $0x190,%rbx
add    $0x190,%rdi
add    $0x190,%rbp
add    $0x190,%r13
add    $0x190,%r12
add    $0x190,%r15
cmp    $0x63,%rax
jne    1160 <compute_error+0x50>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @compute_error(double* %0, double* %1, double* %2, double* %3, double* %4, double* %5) {
%7 = alloca double*
%8 = alloca double*
%9 = alloca double*
%10 = alloca double*
%11 = alloca double*
%12 = alloca double*
%13 = alloca double
%14 = alloca i64
%15 = alloca i64
%16 = alloca i64
%17 = alloca i64
%18 = alloca i64
%19 = alloca i64
%20 = alloca i64
store double* %0, double** %7
store double* %1, double** %8
store double* %2, double** %9
store double* %3, double** %10
store double* %4, double** %11
store double* %5, double** %12
store double 0.000000e+00, double* %13
store i64 1, i64* %19
br label %21
21: ; preds = %94, %6
%22 = load i64, i64* %19
%23 = icmp slt i64 %22, 99
br i1 %23, label %24, label %97
24: ; preds = %21
store i64 1, i64* %20
br label %25
25: ; preds = %90, %24
%26 = load i64, i64* %20
%27 = icmp slt i64 %26, 49
br i1 %27, label %28, label %93
28: ; preds = %25
%29 = load i64, i64* %19
%30 = mul nsw i64 %29, 50
%31 = load i64, i64* %20
%32 = add nsw i64 %30, %31
store i64 %32, i64* %14
%33 = load i64, i64* %14
%34 = add nsw i64 %33, 1
store i64 %34, i64* %15
%35 = load i64, i64* %14
%36 = add nsw i64 %35, 50
store i64 %36, i64* %16
%37 = load i64, i64* %14
%38 = sub nsw i64 %37, 1
store i64 %38, i64* %17
%39 = load i64, i64* %14
%40 = sub nsw i64 %39, 50
store i64 %40, i64* %18
%41 = load double*, double** %7
%42 = load i64, i64* %14
%43 = getelementptr inbounds double, double* %41, i64 %42
%44 = load double, double* %43
%45 = load double*, double** %12
%46 = load i64, i64* %17
%47 = getelementptr inbounds double, double* %45, i64 %46
%48 = load double, double* %47
%49 = load double*, double** %8
%50 = load i64, i64* %14
%51 = getelementptr inbounds double, double* %49, i64 %50
%52 = load double, double* %51
%53 = load double*, double** %12
%54 = load i64, i64* %15
%55 = getelementptr inbounds double, double* %53, i64 %54
%56 = load double, double* %55
%57 = fmul double %52, %56
%58 = call double @llvm.fmuladd.f64(double %44, double %48, double %57)
%59 = load double*, double** %9
%60 = load i64, i64* %14
%61 = getelementptr inbounds double, double* %59, i64 %60
%62 = load double, double* %61
%63 = load double*, double** %12
%64 = load i64, i64* %18
%65 = getelementptr inbounds double, double* %63, i64 %64
%66 = load double, double* %65
%67 = call double @llvm.fmuladd.f64(double %62, double %66, double %58)
%68 = load double*, double** %10
%69 = load i64, i64* %14
%70 = getelementptr inbounds double, double* %68, i64 %69
%71 = load double, double* %70
%72 = load double*, double** %12
%73 = load i64, i64* %16
%74 = getelementptr inbounds double, double* %72, i64 %73
%75 = load double, double* %74
%76 = call double @llvm.fmuladd.f64(double %71, double %75, double %67)
%77 = load double*, double** %11
%78 = load i64, i64* %14
%79 = getelementptr inbounds double, double* %77, i64 %78
%80 = load double, double* %79
%81 = load double*, double** %12
%82 = load i64, i64* %14
%83 = getelementptr inbounds double, double* %81, i64 %82
%84 = load double, double* %83
%85 = call double @llvm.fmuladd.f64(double %80, double %84, double %76)
%86 = call i64 @fabs(double %85)
%87 = sitofp i64 %86 to double
%88 = load double, double* %13
%89 = fadd double %88, %87
store double %89, double* %13
br label %90
90: ; preds = %28
%91 = load i64, i64* %20
%92 = add nsw i64 %91, 1
store i64 %92, i64* %20
br label %25
93: ; preds = %25
br label %94
94: ; preds = %93
%95 = load i64, i64* %19
%96 = add nsw i64 %95, 1
store i64 %96, i64* %19
br label %21
97: ; preds = %21
%98 = load double, double* %13
ret double %98
}

LLVM IR (-O2):
define double @compute_error(double* nocapture %0, double* nocapture %1, double* nocapture %2, double* nocapture %3, double* nocapture %4, double* nocapture %5) {
br label %7
7: ; preds = %6, %49
%8 = phi i64 [ 1, %6 ], [ %50, %49 ]
%9 = phi double [ 0.000000e+00, %6 ], [ %46, %49 ]
%10 = mul nuw nsw i64 %8, 50
br label %11
11: ; preds = %7, %11
%12 = phi i64 [ 1, %7 ], [ %47, %11 ]
%13 = phi double [ %9, %7 ], [ %46, %11 ]
%14 = add nuw nsw i64 %12, %10
%15 = add nuw nsw i64 %14, 1
%16 = add nuw nsw i64 %14, 50
%17 = add nsw i64 %14, -1
%18 = add nsw i64 %14, -50
%19 = getelementptr inbounds double, double* %0, i64 %14
%20 = load double, double* %19
%21 = getelementptr inbounds double, double* %5, i64 %17
%22 = load double, double* %21
%23 = getelementptr inbounds double, double* %1, i64 %14
%24 = load double, double* %23
%25 = getelementptr inbounds double, double* %5, i64 %15
%26 = load double, double* %25
%27 = fmul double %24, %26
%28 = tail call double @llvm.fmuladd.f64(double %20, double %22, double %27)
%29 = getelementptr inbounds double, double* %2, i64 %14
%30 = load double, double* %29
%31 = getelementptr inbounds double, double* %5, i64 %18
%32 = load double, double* %31
%33 = tail call double @llvm.fmuladd.f64(double %30, double %32, double %28)
%34 = getelementptr inbounds double, double* %3, i64 %14
%35 = load double, double* %34
%36 = getelementptr inbounds double, double* %5, i64 %16
%37 = load double, double* %36
%38 = tail call double @llvm.fmuladd.f64(double %35, double %37, double %33)
%39 = getelementptr inbounds double, double* %4, i64 %14
%40 = load double, double* %39
%41 = getelementptr inbounds double, double* %5, i64 %14
%42 = load double, double* %41
%43 = tail call double @llvm.fmuladd.f64(double %40, double %42, double %38)
%44 = tail call i64 @fabs(double %43)
%45 = sitofp i64 %44 to double
%46 = fadd double %13, %45
%47 = add nuw nsw i64 %12, 1
%48 = icmp eq i64 %47, 49
br i1 %48, label %49, label %11
49: ; preds = %11
%50 = add nuw nsw i64 %8, 1
%51 = icmp eq i64 %50, 99
br i1 %51, label %52, label %7
52: ; preds = %49
ret double %46
}