#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__ pow(double const, double);
double compute_root_mean_square_error(const double *problem_grid_old,
                                      const double *problem_grid_new,
                                      const double number_of_interior_points,
                                      const int number_of_rows,
                                      const int number_of_columns) {
  double running_total = 0.0;
  int row = 0;
  int column = 0;
  for (row = 0; row < number_of_rows; row++) {
    for (column = 0; column < number_of_columns; column++) {
      running_total +=
          pow(problem_grid_old[number_of_columns * row + column] -
                  problem_grid_new[number_of_columns * row + column],
              2.0);
    }
  }
  running_total /= number_of_interior_points;
  return running_total;
}


x86 assembly (clang, -O0):
<compute_root_mean_square_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11d0 <compute_root_mean_square_error+0xc0>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    11bd <compute_root_mean_square_error+0xad>
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%ecx
imul   -0x2c(%rbp),%ecx
add    -0x30(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
imul   -0x2c(%rbp),%ecx
add    -0x30(%rbp),%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm0
movsd  0xe65(%rip),%xmm1
call   1030 <pow@plt>
cvtsi2sd %rax,%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    115b <compute_root_mean_square_error+0x4b>
jmp    11c2 <compute_root_mean_square_error+0xb2>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1148 <compute_root_mean_square_error+0x38>
movsd  -0x18(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compute_root_mean_square_error>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
movsd  %xmm0,0x10(%rsp)
test   %edx,%edx
jle    1260 <compute_root_mean_square_error+0x150>
movslq %ecx,%rax
mov    %edx,%edx
mov    %rdx,0x40(%rsp)
mov    %eax,%ebp
mov    %rbp,0x30(%rsp)
and    $0xfffffffe,%ebp
mov    %rsi,0x28(%rsp)
lea    0x8(%rsi),%r15
mov    %rax,0x18(%rsp)
lea    0x0(,%rax,8),%rax
mov    %rax,0x38(%rsp)
mov    %rdi,0x20(%rsp)
lea    0x8(%rdi),%r14
xorpd  %xmm1,%xmm1
xor    %r13d,%r13d
jmp    118a <compute_root_mean_square_error+0x7a>
nopl   (%rax)
add    $0x1,%r13
mov    0x38(%rsp),%rax
add    %rax,%r15
add    %rax,%r14
cmp    0x40(%rsp),%r13
je     1264 <compute_root_mean_square_error+0x154>
test   %ecx,%ecx
jle    1170 <compute_root_mean_square_error+0x60>
mov    %ecx,%r12d
xor    %ebx,%ebx
cmp    $0x1,%ecx
je     1205 <compute_root_mean_square_error+0xf5>
nopl   0x0(%rax,%rax,1)
movsd  %xmm1,0x8(%rsp)
movsd  -0x8(%r14,%rbx,8),%xmm0
subsd  -0x8(%r15,%rbx,8),%xmm0
movsd  0xe44(%rip),%xmm1
call   1030 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  (%r14,%rbx,8),%xmm0
subsd  (%r15,%rbx,8),%xmm0
movsd  0xe17(%rip),%xmm1
call   1030 <pow@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %rax,%xmm1
addsd  0x8(%rsp),%xmm1
add    $0x2,%rbx
cmp    %rbx,%rbp
jne    11a0 <compute_root_mean_square_error+0x90>
testb  $0x1,0x30(%rsp)
mov    %r12d,%ecx
je     1170 <compute_root_mean_square_error+0x60>
mov    %r13,%rax
imul   0x18(%rsp),%rax
add    %rax,%rbx
mov    0x20(%rsp),%rax
movsd  (%rax,%rbx,8),%xmm0
mov    0x28(%rsp),%rax
subsd  (%rax,%rbx,8),%xmm0
movsd  %xmm1,0x8(%rsp)
movsd  0xdbf(%rip),%xmm1
call   1030 <pow@plt>
movsd  0x8(%rsp),%xmm1
mov    %r12d,%ecx
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  %xmm0,%xmm1
jmp    1170 <compute_root_mean_square_error+0x60>
xorpd  %xmm1,%xmm1
divsd  0x10(%rsp),%xmm1
movapd %xmm1,%xmm0
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @compute_root_mean_square_error(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 double
%12 = alloca i32
%13 = 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 double 0.000000e+00, double* %11
store i32 0, i32* %12
store i32 0, i32* %13
store i32 0, i32* %12
br label %14
14: ; preds = %51, %5
%15 = load i32, i32* %12
%16 = load i32, i32* %9
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %54
18: ; preds = %14
store i32 0, i32* %13
br label %19
19: ; preds = %47, %18
%20 = load i32, i32* %13
%21 = load i32, i32* %10
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %50
23: ; preds = %19
%24 = load double*, double** %6
%25 = load i32, i32* %10
%26 = load i32, i32* %12
%27 = mul nsw i32 %25, %26
%28 = load i32, i32* %13
%29 = add nsw i32 %27, %28
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds double, double* %24, i64 %30
%32 = load double, double* %31
%33 = load double*, double** %7
%34 = load i32, i32* %10
%35 = load i32, i32* %12
%36 = mul nsw i32 %34, %35
%37 = load i32, i32* %13
%38 = add nsw i32 %36, %37
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds double, double* %33, i64 %39
%41 = load double, double* %40
%42 = fsub double %32, %41
%43 = call i64 @pow(double %42, double 2.000000e+00)
%44 = sitofp i64 %43 to double
%45 = load double, double* %11
%46 = fadd double %45, %44
store double %46, double* %11
br label %47
47: ; preds = %23
%48 = load i32, i32* %13
%49 = add nsw i32 %48, 1
store i32 %49, i32* %13
br label %19
50: ; preds = %19
br label %51
51: ; preds = %50
%52 = load i32, i32* %12
%53 = add nsw i32 %52, 1
store i32 %53, i32* %12
br label %14
54: ; preds = %14
%55 = load double, double* %8
%56 = load double, double* %11
%57 = fdiv double %56, %55
store double %57, double* %11
%58 = load double, double* %11
ret double %58
}

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