#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);
void vector_erk_operation_inner3(
    double *restrict erk, double *restrict erkm1, double *restrict erkm2,
    const double *restrict wt, const double *restrict yp,
    const double *restrict phi0, const double *restrict phikm1,
    const double *restrict phikm2, size_t num_elems) {
  size_t i;
  for (i = 0; i < num_elems; ++i) {
    const double iwt = 1.0 / wt[i];
    const double ypmphi = yp[i] - phi0[i];
    *erkm2 += pow((phikm2[i] + ypmphi) * iwt, 2.0);
    *erkm1 += pow((phikm1[i] + ypmphi) * iwt, 2.0);
    *erk += pow(ypmphi * iwt, 2.0);
  }
}


x86 assembly (clang, -O0):
<vector_erk_operation_inner3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    0x20(%rbp),%rax
jae    122e <vector_erk_operation_inner3+0x11e>
mov    -0x20(%rbp),%rax
mov    -0x38(%rbp),%rcx
movsd  0xea6(%rip),%xmm0
divsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
mov    -0x38(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    0x18(%rbp),%rax
mov    -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x48(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  0xe56(%rip),%xmm1
call   1030 <pow@plt>
cvtsi2sd %rax,%xmm0
mov    -0x18(%rbp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
mov    0x10(%rbp),%rax
mov    -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x48(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  0xe21(%rip),%xmm1
call   1030 <pow@plt>
cvtsi2sd %rax,%xmm0
mov    -0x10(%rbp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
movsd  -0x48(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  0xdf9(%rip),%xmm1
call   1030 <pow@plt>
cvtsi2sd %rax,%xmm0
mov    -0x8(%rbp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1144 <vector_erk_operation_inner3+0x34>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vector_erk_operation_inner3>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rdx,0x20(%rsp)
mov    %rsi,0x18(%rsp)
mov    0x70(%rsp),%rbx
test   %rbx,%rbx
je     121d <vector_erk_operation_inner3+0x10d>
mov    %r9,%r15
mov    %r8,%r12
mov    %rcx,%r13
mov    %rdi,%rbp
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nop
movsd  0xea8(%rip),%xmm1
divsd  0x0(%r13,%r14,8),%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  (%r12,%r14,8),%xmm2
subsd  (%r15,%r14,8),%xmm2
movsd  %xmm2,0x10(%rsp)
mov    0x68(%rsp),%rdx
movsd  (%rdx,%r14,8),%xmm0
addsd  %xmm2,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe76(%rip),%xmm1
call   1030 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
mov    0x20(%rsp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
mov    0x60(%rsp),%rax
movsd  (%rax,%r14,8),%xmm0
addsd  0x10(%rsp),%xmm0
mulsd  0x8(%rsp),%xmm0
movsd  0xe3d(%rip),%xmm1
call   1030 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
mov    0x18(%rsp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
movsd  0x10(%rsp),%xmm0
mulsd  0x8(%rsp),%xmm0
movsd  0xe0f(%rip),%xmm1
call   1030 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  0x0(%rbp),%xmm0
movsd  %xmm0,0x0(%rbp)
add    $0x1,%r14
cmp    %r14,%rbx
jne    1150 <vector_erk_operation_inner3+0x40>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @vector_erk_operation_inner3(double* noalias %0, double* noalias %1, double* noalias %2, double* noalias %3, double* noalias %4, double* noalias %5, double* noalias %6, double* noalias %7, i64 %8) {
%10 = alloca double*
%11 = alloca double*
%12 = alloca double*
%13 = alloca double*
%14 = alloca double*
%15 = alloca double*
%16 = alloca double*
%17 = alloca double*
%18 = alloca i64
%19 = alloca i64
%20 = alloca double
%21 = alloca double
store double* %0, double** %10
store double* %1, double** %11
store double* %2, double** %12
store double* %3, double** %13
store double* %4, double** %14
store double* %5, double** %15
store double* %6, double** %16
store double* %7, double** %17
store i64 %8, i64* %18
store i64 0, i64* %19
br label %22
22: ; preds = %75, %9
%23 = load i64, i64* %19
%24 = load i64, i64* %18
%25 = icmp ult i64 %23, %24
br i1 %25, label %26, label %78
26: ; preds = %22
%27 = load double*, double** %13
%28 = load i64, i64* %19
%29 = getelementptr inbounds double, double* %27, i64 %28
%30 = load double, double* %29
%31 = fdiv double 1.000000e+00, %30
store double %31, double* %20
%32 = load double*, double** %14
%33 = load i64, i64* %19
%34 = getelementptr inbounds double, double* %32, i64 %33
%35 = load double, double* %34
%36 = load double*, double** %15
%37 = load i64, i64* %19
%38 = getelementptr inbounds double, double* %36, i64 %37
%39 = load double, double* %38
%40 = fsub double %35, %39
store double %40, double* %21
%41 = load double*, double** %17
%42 = load i64, i64* %19
%43 = getelementptr inbounds double, double* %41, i64 %42
%44 = load double, double* %43
%45 = load double, double* %21
%46 = fadd double %44, %45
%47 = load double, double* %20
%48 = fmul double %46, %47
%49 = call i64 @pow(double %48, double 2.000000e+00)
%50 = sitofp i64 %49 to double
%51 = load double*, double** %12
%52 = load double, double* %51
%53 = fadd double %52, %50
store double %53, double* %51
%54 = load double*, double** %16
%55 = load i64, i64* %19
%56 = getelementptr inbounds double, double* %54, i64 %55
%57 = load double, double* %56
%58 = load double, double* %21
%59 = fadd double %57, %58
%60 = load double, double* %20
%61 = fmul double %59, %60
%62 = call i64 @pow(double %61, double 2.000000e+00)
%63 = sitofp i64 %62 to double
%64 = load double*, double** %11
%65 = load double, double* %64
%66 = fadd double %65, %63
store double %66, double* %64
%67 = load double, double* %21
%68 = load double, double* %20
%69 = fmul double %67, %68
%70 = call i64 @pow(double %69, double 2.000000e+00)
%71 = sitofp i64 %70 to double
%72 = load double*, double** %10
%73 = load double, double* %72
%74 = fadd double %73, %71
store double %74, double* %72
br label %75
75: ; preds = %26
%76 = load i64, i64* %19
%77 = add i64 %76, 1
store i64 %77, i64* %19
br label %22
78: ; preds = %22
ret void
}

LLVM IR (-O2):
define void @vector_erk_operation_inner3(double* noalias nocapture %0, double* noalias nocapture %1, double* noalias nocapture %2, double* noalias nocapture %3, double* noalias nocapture %4, double* noalias nocapture %5, double* noalias nocapture %6, double* noalias nocapture %7, i64 %8) {
%10 = icmp eq i64 %8, 0
br i1 %10, label %44, label %11
11: ; preds = %9, %11
%12 = phi i64 [ %42, %11 ], [ 0, %9 ]
%13 = getelementptr inbounds double, double* %3, i64 %12
%14 = load double, double* %13
%15 = fdiv double 1.000000e+00, %14
%16 = getelementptr inbounds double, double* %4, i64 %12
%17 = load double, double* %16
%18 = getelementptr inbounds double, double* %5, i64 %12
%19 = load double, double* %18
%20 = fsub double %17, %19
%21 = getelementptr inbounds double, double* %7, i64 %12
%22 = load double, double* %21
%23 = fadd double %22, %20
%24 = fmul double %15, %23
%25 = tail call i64 @pow(double %24, double 2.000000e+00)
%26 = sitofp i64 %25 to double
%27 = load double, double* %2
%28 = fadd double %27, %26
store double %28, double* %2
%29 = getelementptr inbounds double, double* %6, i64 %12
%30 = load double, double* %29
%31 = fadd double %20, %30
%32 = fmul double %15, %31
%33 = tail call i64 @pow(double %32, double 2.000000e+00)
%34 = sitofp i64 %33 to double
%35 = load double, double* %1
%36 = fadd double %35, %34
store double %36, double* %1
%37 = fmul double %15, %20
%38 = tail call i64 @pow(double %37, double 2.000000e+00)
%39 = sitofp i64 %38 to double
%40 = load double, double* %0
%41 = fadd double %40, %39
store double %41, double* %0
%42 = add nuw i64 %12, 1
%43 = icmp eq i64 %42, %8
br i1 %43, label %44, label %11
44: ; preds = %11, %9
ret void
}