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


x86 assembly (clang, -O0):
<vector_erk_operation_inner1>:
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    11c4 <vector_erk_operation_inner1+0xb4>
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)
movsd  -0x48(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  0xe63(%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_inner1+0x34>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vector_erk_operation_inner1>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    0x50(%rsp),%r13
test   %r13,%r13
je     1184 <vector_erk_operation_inner1+0x74>
mov    %r9,%r14
mov    %r8,%r15
mov    %rcx,%r12
mov    %rdi,%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  0xeb8(%rip),%xmm1
divsd  (%r12,%rbp,8),%xmm1
movsd  (%r15,%rbp,8),%xmm0
subsd  (%r14,%rbp,8),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xea2(%rip),%xmm1
call   1030 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  (%rbx),%xmm0
movsd  %xmm0,(%rbx)
add    $0x1,%rbp
cmp    %rbp,%r13
jne    1140 <vector_erk_operation_inner1+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @vector_erk_operation_inner1(double* noalias nocapture %0, double* noalias nocapture readnone %1, double* noalias nocapture readnone %2, double* noalias nocapture %3, double* noalias nocapture %4, double* noalias nocapture %5, double* noalias nocapture readnone %6, double* noalias nocapture readnone %7, i64 %8) {
%10 = icmp eq i64 %8, 0
br i1 %10, label %28, label %11
11: ; preds = %9, %11
%12 = phi i64 [ %26, %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 = fmul double %15, %20
%22 = tail call i64 @pow(double %21, double 2.000000e+00)
%23 = sitofp i64 %22 to double
%24 = load double, double* %0
%25 = fadd double %24, %23
store double %25, double* %0
%26 = add nuw i64 %12, 1
%27 = icmp eq i64 %26, %8
br i1 %27, label %28, label %11
28: ; preds = %11, %9
ret void
}