#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 calcXT(int, double);
double log(int);
double calcMaxAge(int n, double T) {
  double N = n;
  double Xt = calcXT(n, T);
  return -1 * ((log(N) + 0.577) / (Xt * log(1 - 1 / (N - 1.0))));
}


x86 assembly (clang, -O0):
<calcMaxAge>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x4(%rbp),%edi
movsd  -0x10(%rbp),%xmm0
call   1030 <calcXT@plt>
movsd  %xmm0,-0x20(%rbp)
cvttsd2si -0x18(%rbp),%edi
call   1040 <log@plt>
movsd  0xeb2(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe8a(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xe7e(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  0xe72(%rip),%xmm0
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <log@plt>
movsd  -0x30(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x28(%rbp),%xmm0
mulsd  %xmm2,%xmm0
divsd  %xmm0,%xmm1
movsd  0xe40(%rip),%xmm0
mulsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calcMaxAge>:
push   %rbx
sub    $0x20,%rsp
mov    %edi,%ebx
cvtsi2sd %edi,%xmm1
movsd  %xmm1,(%rsp)
call   1030 <calcXT@plt>
movsd  %xmm0,0x8(%rsp)
mov    %ebx,%edi
call   1040 <log@plt>
addsd  0xeb6(%rip),%xmm0
movapd %xmm0,0x10(%rsp)
movsd  0xeb0(%rip),%xmm0
movsd  (%rsp),%xmm1
addsd  %xmm0,%xmm1
divsd  %xmm1,%xmm0
addsd  0xea3(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <log@plt>
mulsd  0x8(%rsp),%xmm0
movapd 0x10(%rsp),%xmm1
xorpd  0xe96(%rip),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @calcMaxAge(i32 %0, double %1) {
%3 = alloca i32
%4 = alloca double
%5 = alloca double
%6 = alloca double
store i32 %0, i32* %3
store double %1, double* %4
%7 = load i32, i32* %3
%8 = sitofp i32 %7 to double
store double %8, double* %5
%9 = load i32, i32* %3
%10 = load double, double* %4
%11 = call double @calcXT(i32 %9, double %10)
store double %11, double* %6
%12 = load double, double* %5
%13 = fptosi double %12 to i32
%14 = call double @log(i32 %13)
%15 = fadd double %14, 5.770000e-01
%16 = load double, double* %6
%17 = load double, double* %5
%18 = fsub double %17, 1.000000e+00
%19 = fdiv double 1.000000e+00, %18
%20 = fsub double 1.000000e+00, %19
%21 = fptosi double %20 to i32
%22 = call double @log(i32 %21)
%23 = fmul double %16, %22
%24 = fdiv double %15, %23
%25 = fmul double -1.000000e+00, %24
ret double %25
}

LLVM IR (-O2):
define double @calcMaxAge(i32 %0, double %1) {
%3 = sitofp i32 %0 to double
%4 = tail call double @calcXT(i32 %0, double %1)
%5 = tail call double @log(i32 %0)
%6 = fadd double %5, 5.770000e-01
%7 = fadd double %3, -1.000000e+00
%8 = fdiv double 1.000000e+00, %7
%9 = fsub double 1.000000e+00, %8
%10 = fptosi double %9 to i32
%11 = tail call double @log(i32 %10)
%12 = fmul double %4, %11
%13 = fneg double %6
%14 = fdiv double %13, %12
ret double %14
}