#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_x, double *a_y, double *P, double *fn) {
  double error = 0.0;
  long indx, indx_rght, indx_frnt, indx_lft, indx_bck, i, j, indx_ax, indx_ay;
  for (i = 1; i < 300 - 1; i++) {
    for (j = 1; j < 300 - 1; j++) {
      indx = i * 300 + j;
      indx_rght = indx + 1;
      indx_frnt = indx + 300;
      indx_lft = indx - 1;
      indx_bck = indx - 300;
      indx_ax = (i - 1) * (300 - 1) + j - 1;
      indx_ay = (i - 1) * (300 - 2) + j - 1;
      error += fabs(
          a_x[indx_ax] * P[indx_lft] + a_x[indx_ax + 1] * P[indx_rght] +
          a_y[indx_ay] * P[indx_bck] + a_y[indx_ay + (300 - 2)] * P[indx_frnt] -
          (a_x[indx_ax] + a_x[indx_ax + 1] + a_y[indx_ay] +
           a_y[indx_ay + (300 - 2)]) *
              P[indx] -
          1.0 * 1.0 * fn[indx]);
    }
  }
  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)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
movq   $0x1,-0x58(%rbp)
cmpq   $0x12b,-0x58(%rbp)
jge    130c <compute_error+0x1fc>
movq   $0x1,-0x60(%rbp)
cmpq   $0x12b,-0x60(%rbp)
jge    12f6 <compute_error+0x1e6>
imul   $0x12c,-0x58(%rbp),%rax
add    -0x60(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
mov    -0x30(%rbp),%rax
add    $0x12c,%rax
mov    %rax,-0x40(%rbp)
mov    -0x30(%rbp),%rax
sub    $0x1,%rax
mov    %rax,-0x48(%rbp)
mov    -0x30(%rbp),%rax
sub    $0x12c,%rax
mov    %rax,-0x50(%rbp)
mov    -0x58(%rbp),%rax
sub    $0x1,%rax
imul   $0x12b,%rax,%rax
add    -0x60(%rbp),%rax
sub    $0x1,%rax
mov    %rax,-0x68(%rbp)
mov    -0x58(%rbp),%rax
sub    $0x1,%rax
imul   $0x12a,%rax,%rax
add    -0x60(%rbp),%rax
sub    $0x1,%rax
mov    %rax,-0x70(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x68(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x18(%rbp),%rax
mov    -0x48(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x8(%rbp),%rax
mov    -0x68(%rbp),%rcx
movsd  0x8(%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x38(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x10(%rbp),%rax
mov    -0x70(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x50(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
mov    -0x70(%rbp),%rcx
movsd  0x950(%rax,%rcx,8),%xmm1
mov    -0x18(%rbp),%rax
mov    -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x8(%rbp),%rax
mov    -0x68(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x68(%rbp),%rcx
addsd  0x8(%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x70(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x70(%rbp),%rcx
addsd  0x950(%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
subsd  %xmm1,%xmm0
call   1030 <fabs@plt>
cvtsi2sd %rax,%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x60(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x60(%rbp)
jmp    114e <compute_error+0x3e>
jmp    12fb <compute_error+0x1eb>
mov    -0x58(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x58(%rbp)
jmp    1138 <compute_error+0x28>
movsd  -0x28(%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
push   %rax
mov    %rcx,%r14
mov    %rdx,%rbx
mov    %rsi,%r15
mov    %rdi,%r12
add    $0x8,%r12
add    $0x8,%rbx
add    $0x968,%r14
mov    $0x1,%r13d
xorps  %xmm0,%xmm0
nop
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  %xmm0,(%rsp)
movsd  -0x8(%r12,%rbp,1),%xmm1
movsd  (%r12,%rbp,1),%xmm2
movsd  0x968(%rbx,%rbp,1),%xmm0
mulsd  %xmm2,%xmm0
movsd  0x958(%rbx,%rbp,1),%xmm3
mulsd  %xmm1,%xmm3
addsd  %xmm0,%xmm3
movsd  (%r15,%rbp,1),%xmm4
movsd  (%rbx,%rbp,1),%xmm5
mulsd  %xmm4,%xmm5
addsd  %xmm3,%xmm5
movsd  0x950(%r15,%rbp,1),%xmm3
movsd  0x12c0(%rbx,%rbp,1),%xmm0
mulsd  %xmm3,%xmm0
addsd  %xmm2,%xmm1
addsd  %xmm4,%xmm1
addsd  %xmm3,%xmm1
mulsd  0x960(%rbx,%rbp,1),%xmm1
addsd  %xmm5,%xmm0
subsd  %xmm1,%xmm0
subsd  (%r14,%rbp,1),%xmm0
call   1030 <fabs@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  (%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movsd  (%rsp),%xmm0
add    $0x8,%rbp
cmp    $0x950,%rbp
jne    1150 <compute_error+0x40>
add    $0x1,%r13
add    $0x950,%r15
add    $0x958,%r12
add    $0x960,%rbx
add    $0x960,%r14
cmp    $0x12b,%r13
jne    1140 <compute_error+0x30>
add    $0x8,%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) {
%5 = alloca double*
%6 = alloca double*
%7 = alloca double*
%8 = alloca double*
%9 = alloca double
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
%13 = alloca i64
%14 = alloca i64
%15 = alloca i64
%16 = alloca i64
%17 = alloca i64
%18 = alloca i64
store double* %0, double** %5
store double* %1, double** %6
store double* %2, double** %7
store double* %3, double** %8
store double 0.000000e+00, double* %9
store i64 1, i64* %15
br label %19
19: ; preds = %129, %4
%20 = load i64, i64* %15
%21 = icmp slt i64 %20, 299
br i1 %21, label %22, label %132
22: ; preds = %19
store i64 1, i64* %16
br label %23
23: ; preds = %125, %22
%24 = load i64, i64* %16
%25 = icmp slt i64 %24, 299
br i1 %25, label %26, label %128
26: ; preds = %23
%27 = load i64, i64* %15
%28 = mul nsw i64 %27, 300
%29 = load i64, i64* %16
%30 = add nsw i64 %28, %29
store i64 %30, i64* %10
%31 = load i64, i64* %10
%32 = add nsw i64 %31, 1
store i64 %32, i64* %11
%33 = load i64, i64* %10
%34 = add nsw i64 %33, 300
store i64 %34, i64* %12
%35 = load i64, i64* %10
%36 = sub nsw i64 %35, 1
store i64 %36, i64* %13
%37 = load i64, i64* %10
%38 = sub nsw i64 %37, 300
store i64 %38, i64* %14
%39 = load i64, i64* %15
%40 = sub nsw i64 %39, 1
%41 = mul nsw i64 %40, 299
%42 = load i64, i64* %16
%43 = add nsw i64 %41, %42
%44 = sub nsw i64 %43, 1
store i64 %44, i64* %17
%45 = load i64, i64* %15
%46 = sub nsw i64 %45, 1
%47 = mul nsw i64 %46, 298
%48 = load i64, i64* %16
%49 = add nsw i64 %47, %48
%50 = sub nsw i64 %49, 1
store i64 %50, i64* %18
%51 = load double*, double** %5
%52 = load i64, i64* %17
%53 = getelementptr inbounds double, double* %51, i64 %52
%54 = load double, double* %53
%55 = load double*, double** %7
%56 = load i64, i64* %13
%57 = getelementptr inbounds double, double* %55, i64 %56
%58 = load double, double* %57
%59 = load double*, double** %5
%60 = load i64, i64* %17
%61 = add nsw i64 %60, 1
%62 = getelementptr inbounds double, double* %59, i64 %61
%63 = load double, double* %62
%64 = load double*, double** %7
%65 = load i64, i64* %11
%66 = getelementptr inbounds double, double* %64, i64 %65
%67 = load double, double* %66
%68 = fmul double %63, %67
%69 = call double @llvm.fmuladd.f64(double %54, double %58, double %68)
%70 = load double*, double** %6
%71 = load i64, i64* %18
%72 = getelementptr inbounds double, double* %70, i64 %71
%73 = load double, double* %72
%74 = load double*, double** %7
%75 = load i64, i64* %14
%76 = getelementptr inbounds double, double* %74, i64 %75
%77 = load double, double* %76
%78 = call double @llvm.fmuladd.f64(double %73, double %77, double %69)
%79 = load double*, double** %6
%80 = load i64, i64* %18
%81 = add nsw i64 %80, 298
%82 = getelementptr inbounds double, double* %79, i64 %81
%83 = load double, double* %82
%84 = load double*, double** %7
%85 = load i64, i64* %12
%86 = getelementptr inbounds double, double* %84, i64 %85
%87 = load double, double* %86
%88 = call double @llvm.fmuladd.f64(double %83, double %87, double %78)
%89 = load double*, double** %5
%90 = load i64, i64* %17
%91 = getelementptr inbounds double, double* %89, i64 %90
%92 = load double, double* %91
%93 = load double*, double** %5
%94 = load i64, i64* %17
%95 = add nsw i64 %94, 1
%96 = getelementptr inbounds double, double* %93, i64 %95
%97 = load double, double* %96
%98 = fadd double %92, %97
%99 = load double*, double** %6
%100 = load i64, i64* %18
%101 = getelementptr inbounds double, double* %99, i64 %100
%102 = load double, double* %101
%103 = fadd double %98, %102
%104 = load double*, double** %6
%105 = load i64, i64* %18
%106 = add nsw i64 %105, 298
%107 = getelementptr inbounds double, double* %104, i64 %106
%108 = load double, double* %107
%109 = fadd double %103, %108
%110 = load double*, double** %7
%111 = load i64, i64* %10
%112 = getelementptr inbounds double, double* %110, i64 %111
%113 = load double, double* %112
%114 = fneg double %109
%115 = call double @llvm.fmuladd.f64(double %114, double %113, double %88)
%116 = load double*, double** %8
%117 = load i64, i64* %10
%118 = getelementptr inbounds double, double* %116, i64 %117
%119 = load double, double* %118
%120 = call double @llvm.fmuladd.f64(double -1.000000e+00, double %119, double %115)
%121 = call i64 @fabs(double %120)
%122 = sitofp i64 %121 to double
%123 = load double, double* %9
%124 = fadd double %123, %122
store double %124, double* %9
br label %125
125: ; preds = %26
%126 = load i64, i64* %16
%127 = add nsw i64 %126, 1
store i64 %127, i64* %16
br label %23
128: ; preds = %23
br label %129
129: ; preds = %128
%130 = load i64, i64* %15
%131 = add nsw i64 %130, 1
store i64 %131, i64* %15
br label %19
132: ; preds = %19
%133 = load double, double* %9
ret double %133
}

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