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


x86 assembly (clang, -O0):
<oo_xirrResult>:
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)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
movl   $0x1,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11d1 <oo_xirrResult+0xc1>
mov    -0x8(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x30(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
subsd  -0x28(%rbp),%xmm1
movsd  0xe78(%rip),%xmm2
divsd  %xmm2,%xmm1
movsd  0xe64(%rip),%xmm2
divsd  %xmm2,%xmm1
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
divsd  %xmm1,%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    115b <oo_xirrResult+0x4b>
movsd  -0x38(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<oo_xirrResult>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
movsd  %xmm0,0x8(%rsp)
movsd  (%rdi),%xmm0
cmp    $0x2,%edx
jl     11b6 <oo_xirrResult+0xa6>
mov    %rsi,%r14
mov    %rdi,%r15
movsd  (%rsi),%xmm1
movsd  %xmm1,0x10(%rsp)
movsd  0x8(%rsp),%xmm1
addsd  0xeb4(%rip),%xmm1
movsd  %xmm1,0x8(%rsp)
mov    %edx,%r12d
mov    $0x1,%ebx
nopw   0x0(%rax,%rax,1)
movsd  %xmm0,0x20(%rsp)
movsd  (%r15,%rbx,8),%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  (%r14,%rbx,8),%xmm1
subsd  0x10(%rsp),%xmm1
divsd  0xe82(%rip),%xmm1
divsd  0xe82(%rip),%xmm1
movsd  0x8(%rsp),%xmm0
call   1030 <pow@plt>
movsd  0x18(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  0x20(%rsp),%xmm0
addsd  %xmm1,%xmm0
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1160 <oo_xirrResult+0x50>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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