#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 calcAw(int, double);
double calcXT(int, double);
int pow(int, double);
double calcEntriesUptoAgeT(int n, double T, double t) {
  double N = n;
  double Xt = calcXT(n, T);
  if (t <= T)
    return Xt;
  double Aw = calcAw(n, T);
  return N * (1 - pow(1 - 1 / (N - 1.0), Xt * (t - Aw)));
}


x86 assembly (clang, -O0):
<calcEntriesUptoAgeT>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0xc(%rbp),%edi
movsd  -0x18(%rbp),%xmm0
call   1030 <calcXT@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1184 <calcEntriesUptoAgeT+0x54>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1200 <calcEntriesUptoAgeT+0xd0>
mov    -0xc(%rbp),%edi
movsd  -0x18(%rbp),%xmm0
call   1040 <calcAw@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xe53(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xe47(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  0xe3b(%rip),%xmm0
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
movsd  -0x30(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
subsd  -0x38(%rbp),%xmm1
mulsd  %xmm1,%xmm0
call   1050 <pow@plt>
movsd  -0x40(%rbp),%xmm0
mov    %eax,%ecx
mov    $0x1,%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calcEntriesUptoAgeT>:
push   %rbx
sub    $0x20,%rsp
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x18(%rsp)
mov    %edi,%ebx
call   1030 <calcXT@plt>
movsd  0x18(%rsp),%xmm2
ucomisd 0x8(%rsp),%xmm2
jae    11c0 <calcEntriesUptoAgeT+0x90>
xorps  %xmm1,%xmm1
cvtsi2sd %ebx,%xmm1
movsd  %xmm1,(%rsp)
mov    %ebx,%edi
movsd  %xmm0,0x10(%rsp)
movapd %xmm2,%xmm0
call   1040 <calcAw@plt>
movsd  0xe85(%rip),%xmm1
movsd  (%rsp),%xmm2
addsd  %xmm1,%xmm2
divsd  %xmm2,%xmm1
addsd  0xe78(%rip),%xmm1
cvttsd2si %xmm1,%edi
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  0x10(%rsp),%xmm0
mulsd  %xmm1,%xmm0
call   1050 <pow@plt>
mov    $0x1,%ecx
sub    %eax,%ecx
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
mulsd  (%rsp),%xmm0
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @calcEntriesUptoAgeT(i32 %0, double %1, double %2) {
%4 = alloca double
%5 = alloca i32
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
store i32 %0, i32* %5
store double %1, double* %6
store double %2, double* %7
%11 = load i32, i32* %5
%12 = sitofp i32 %11 to double
store double %12, double* %8
%13 = load i32, i32* %5
%14 = load double, double* %6
%15 = call double @calcXT(i32 %13, double %14)
store double %15, double* %9
%16 = load double, double* %7
%17 = load double, double* %6
%18 = fcmp ole double %16, %17
br i1 %18, label %19, label %21
19: ; preds = %3
%20 = load double, double* %9
store double %20, double* %4
br label %40
21: ; preds = %3
%22 = load i32, i32* %5
%23 = load double, double* %6
%24 = call double @calcAw(i32 %22, double %23)
store double %24, double* %10
%25 = load double, double* %8
%26 = load double, double* %8
%27 = fsub double %26, 1.000000e+00
%28 = fdiv double 1.000000e+00, %27
%29 = fsub double 1.000000e+00, %28
%30 = fptosi double %29 to i32
%31 = load double, double* %9
%32 = load double, double* %7
%33 = load double, double* %10
%34 = fsub double %32, %33
%35 = fmul double %31, %34
%36 = call i32 @pow(i32 %30, double %35)
%37 = sub nsw i32 1, %36
%38 = sitofp i32 %37 to double
%39 = fmul double %25, %38
store double %39, double* %4
br label %40
40: ; preds = %21, %19
%41 = load double, double* %4
ret double %41
}

LLVM IR (-O2):
define double @calcEntriesUptoAgeT(i32 %0, double %1, double %2) {
%4 = sitofp i32 %0 to double
%5 = tail call double @calcXT(i32 %0, double %1)
%6 = fcmp ugt double %2, %1
br i1 %6, label %7, label %19
7: ; preds = %3
%8 = tail call double @calcAw(i32 %0, double %1)
%9 = fadd double %4, -1.000000e+00
%10 = fdiv double 1.000000e+00, %9
%11 = fsub double 1.000000e+00, %10
%12 = fptosi double %11 to i32
%13 = fsub double %2, %8
%14 = fmul double %5, %13
%15 = tail call i32 @pow(i32 %12, double %14)
%16 = sub nsw i32 1, %15
%17 = sitofp i32 %16 to double
%18 = fmul double %4, %17
br label %19
19: ; preds = %3, %7
%20 = phi double [ %18, %7 ], [ %5, %3 ]
ret double %20
}