#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 */
float pi_odd(float, float);
float pi_even(float i, float num_its) {
  if (i >= num_its)
    return 0.0;
  return (4.0 / (1.0 + (i * 2.0))) + pi_odd(i + 1.0, num_its);
}


x86 assembly (clang, -O0):
<pi_even>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
ucomiss -0xc(%rbp),%xmm0
jb     113e <pi_even+0x2e>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11a4 <pi_even+0x94>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
addsd  %xmm1,%xmm1
movsd  0xead(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xea9(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe87(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  -0xc(%rbp),%xmm1
call   1030 <pi_odd@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
cvtss2sd %xmm1,%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pi_even>:
xorps  %xmm2,%xmm2
ucomiss %xmm1,%xmm0
jae    115e <pi_even+0x4e>
push   %rax
xorps  %xmm2,%xmm2
cvtss2sd %xmm0,%xmm2
addsd  %xmm2,%xmm2
addsd  0xed4(%rip),%xmm2
movsd  0xed4(%rip),%xmm3
divsd  %xmm2,%xmm3
movsd  %xmm3,(%rsp)
addss  0xecb(%rip),%xmm0
call   1030 <pi_odd@plt>
cvtss2sd %xmm0,%xmm0
addsd  (%rsp),%xmm0
xorps  %xmm2,%xmm2
cvtsd2ss %xmm0,%xmm2
add    $0x8,%rsp
movaps %xmm2,%xmm0
ret

LLVM IR (-O0):
define float @pi_even(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
store float %0, float* %4
store float %1, float* %5
%6 = load float, float* %4
%7 = load float, float* %5
%8 = fcmp oge float %6, %7
br i1 %8, label %9, label %10
9: ; preds = %2
store float 0.000000e+00, float* %3
br label %24
10: ; preds = %2
%11 = load float, float* %4
%12 = fpext float %11 to double
%13 = call double @llvm.fmuladd.f64(double %12, double 2.000000e+00, double 1.000000e+00)
%14 = fdiv double 4.000000e+00, %13
%15 = load float, float* %4
%16 = fpext float %15 to double
%17 = fadd double %16, 1.000000e+00
%18 = fptrunc double %17 to float
%19 = load float, float* %5
%20 = call float @pi_odd(float %18, float %19)
%21 = fpext float %20 to double
%22 = fadd double %14, %21
%23 = fptrunc double %22 to float
store float %23, float* %3
br label %24
24: ; preds = %10, %9
%25 = load float, float* %3
ret float %25
}

LLVM IR (-O2):
define float @pi_even(float %0, float %1) {
%3 = fcmp ult float %0, %1
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = fpext float %0 to double
%6 = tail call double @llvm.fmuladd.f64(double %5, double 2.000000e+00, double 1.000000e+00)
%7 = fdiv double 4.000000e+00, %6
%8 = fadd float %0, 1.000000e+00
%9 = tail call float @pi_odd(float %8, float %1)
%10 = fpext float %9 to double
%11 = fadd double %7, %10
%12 = fptrunc double %11 to float
br label %13
13: ; preds = %2, %4
%14 = phi float [ %12, %4 ], [ 0.000000e+00, %2 ]
ret float %14
}