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


x86 assembly (clang, -O0):
<vector_erk_operation_inner2>:
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    11f9 <vector_erk_operation_inner2+0xe9>
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    0x10(%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    -0x10(%rbp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
movsd  -0x48(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  0xe2e(%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_inner2+0x34>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vector_erk_operation_inner2>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,(%rsp)
mov    0x60(%rsp),%r14
test   %r14,%r14
je     11d0 <vector_erk_operation_inner2+0xc0>
mov    %r9,%r15
mov    %r8,%r12
mov    %rcx,%r13
mov    %rdi,%rbx
xor    %ebp,%ebp
xchg   %ax,%ax
movsd  0xeb8(%rip),%xmm1
divsd  0x0(%r13,%rbp,8),%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  (%r12,%rbp,8),%xmm2
subsd  (%r15,%rbp,8),%xmm2
movsd  %xmm2,0x10(%rsp)
mov    0x50(%rsp),%rdx
movsd  (%rdx,%rbp,8),%xmm0
addsd  %xmm2,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe87(%rip),%xmm1
call   1030 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
mov    (%rsp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
movsd  0x10(%rsp),%xmm0
mulsd  0x8(%rsp),%xmm0
movsd  0xe5a(%rip),%xmm1
call   1030 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  (%rbx),%xmm0
movsd  %xmm0,(%rbx)
add    $0x1,%rbp
cmp    %rbp,%r14
jne    1140 <vector_erk_operation_inner2+0x30>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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