#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 */
double pow(double, double);
double oo_xirrResult_Deriv1(const double *rValues, const double *rDates,
                            const int nCount, double fRate) {
  double D_0 = rDates[0];
  double r = fRate + 1.0;
  double fResult = 0.0;
  int i;
  for (i = 1; i < nCount; ++i) {
    double E_i = ((rDates[i] - D_0) / 86400.0) / 365.0;
    fResult -= E_i * rValues[i] / pow(r, E_i + 1.0);
  }
  return fResult;
}


x86 assembly (clang, -O0):
<oo_xirrResult_Deriv1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xec3(%rip),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
movl   $0x1,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11e4 <oo_xirrResult_Deriv1+0xd4>
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  -0x28(%rbp),%xmm0
movsd  0xe94(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe80(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  0xe4b(%rip),%xmm1
addsd  -0x48(%rbp),%xmm1
call   1030 <pow@plt>
movsd  -0x50(%rbp),%xmm1
divsd  %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1156 <oo_xirrResult_Deriv1+0x46>
movsd  -0x38(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<oo_xirrResult_Deriv1>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
movsd  %xmm0,0x8(%rsp)
xorpd  %xmm0,%xmm0
cmp    $0x2,%edx
jl     11c2 <oo_xirrResult_Deriv1+0xb2>
mov    %rsi,%r15
mov    %rdi,%r14
movsd  (%rsi),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
addsd  0xeb4(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %edx,%r12d
xorpd  %xmm0,%xmm0
mov    $0x1,%ebx
xchg   %ax,%ax
movsd  %xmm0,0x20(%rsp)
movsd  (%r15,%rbx,8),%xmm1
subsd  0x10(%rsp),%xmm1
divsd  0xe8e(%rip),%xmm1
divsd  0xe8e(%rip),%xmm1
movsd  (%r14,%rbx,8),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x18(%rsp)
addsd  0xe66(%rip),%xmm1
movsd  0x8(%rsp),%xmm0
call   1030 <pow@plt>
movsd  0x18(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  0x20(%rsp),%xmm0
subsd  %xmm1,%xmm0
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1160 <oo_xirrResult_Deriv1+0x50>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define double @oo_xirrResult_Deriv1(double* %0, double* %1, i32 %2, double %3) {
%5 = alloca double*
%6 = alloca double*
%7 = alloca i32
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca i32
%13 = alloca double
store double* %0, double** %5
store double* %1, double** %6
store i32 %2, i32* %7
store double %3, double* %8
%14 = load double*, double** %6
%15 = getelementptr inbounds double, double* %14, i64 0
%16 = load double, double* %15
store double %16, double* %9
%17 = load double, double* %8
%18 = fadd double %17, 1.000000e+00
store double %18, double* %10
store double 0.000000e+00, double* %11
store i32 1, i32* %12
br label %19
19: ; preds = %47, %4
%20 = load i32, i32* %12
%21 = load i32, i32* %7
%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* %12
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds double, double* %24, i64 %26
%28 = load double, double* %27
%29 = load double, double* %9
%30 = fsub double %28, %29
%31 = fdiv double %30, 8.640000e+04
%32 = fdiv double %31, 3.650000e+02
store double %32, double* %13
%33 = load double, double* %13
%34 = load double*, double** %5
%35 = load i32, i32* %12
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds double, double* %34, i64 %36
%38 = load double, double* %37
%39 = fmul double %33, %38
%40 = load double, double* %10
%41 = load double, double* %13
%42 = fadd double %41, 1.000000e+00
%43 = call double @pow(double %40, double %42)
%44 = fdiv double %39, %43
%45 = load double, double* %11
%46 = fsub double %45, %44
store double %46, double* %11
br label %47
47: ; preds = %23
%48 = load i32, i32* %12
%49 = add nsw i32 %48, 1
store i32 %49, i32* %12
br label %19
50: ; preds = %19
%51 = load double, double* %11
ret double %51
}

LLVM IR (-O2):
define double @oo_xirrResult_Deriv1(double* nocapture %0, double* nocapture %1, i32 %2, double %3) {
%5 = load double, double* %1
%6 = fadd double %3, 1.000000e+00
%7 = icmp sgt i32 %2, 1
br i1 %7, label %8, label %27
8: ; preds = %4
%9 = zext i32 %2 to i64
br label %10
10: ; preds = %8, %10
%11 = phi i64 [ 1, %8 ], [ %25, %10 ]
%12 = phi double [ 0.000000e+00, %8 ], [ %24, %10 ]
%13 = getelementptr inbounds double, double* %1, i64 %11
%14 = load double, double* %13
%15 = fsub double %14, %5
%16 = fdiv double %15, 8.640000e+04
%17 = fdiv double %16, 3.650000e+02
%18 = getelementptr inbounds double, double* %0, i64 %11
%19 = load double, double* %18
%20 = fmul double %19, %17
%21 = fadd double %17, 1.000000e+00
%22 = tail call double @pow(double %6, double %21)
%23 = fdiv double %20, %22
%24 = fsub double %12, %23
%25 = add nuw nsw i64 %11, 1
%26 = icmp eq i64 %25, %9
br i1 %26, label %27, label %10
27: ; preds = %10, %4
%28 = phi double [ 0.000000e+00, %4 ], [ %24, %10 ]
ret double %28
}