#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 fabs(double);
double newtonRecursive(double e, double x, double recursiveAnswer) {
  if (fabs(recursiveAnswer * recursiveAnswer - x) <= e) {
    return recursiveAnswer;
  } else {
    recursiveAnswer =
        (recursiveAnswer * recursiveAnswer + x) / (2 * recursiveAnswer);
    return 1.0 * (newtonRecursive(recursiveAnswer, x, e));
  }
}


x86 assembly (clang, -O0):
<newtonRecursive>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movaps 0xea4(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     117e <newtonRecursive+0x6e>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11d3 <newtonRecursive+0xc3>
movsd  -0x20(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe7b(%rip),%xmm1
mulsd  -0x20(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm2
call   1030 <newtonRecursive@plt>
movaps %xmm0,%xmm1
movsd  0xe46(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<newtonRecursive>:
movapd %xmm2,%xmm3
mulsd  %xmm2,%xmm3
subsd  %xmm1,%xmm3
andpd  0xefc(%rip),%xmm3
ucomisd %xmm3,%xmm0
jae    1167 <newtonRecursive+0x67>
movapd 0xede(%rip),%xmm4
xorpd  %xmm1,%xmm4
movapd 0xee2(%rip),%xmm5
xchg   %ax,%ax
movapd %xmm0,%xmm3
movapd %xmm2,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  %xmm2,%xmm2
divsd  %xmm2,%xmm0
movapd %xmm3,%xmm2
mulsd  %xmm3,%xmm2
addsd  %xmm4,%xmm2
andpd  %xmm5,%xmm2
ucomisd %xmm2,%xmm0
movapd %xmm3,%xmm2
jb     1130 <newtonRecursive+0x30>
movapd %xmm3,%xmm0
ret
movapd %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @newtonRecursive(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
%8 = load double, double* %7
%9 = load double, double* %7
%10 = load double, double* %6
%11 = fneg double %10
%12 = call double @llvm.fmuladd.f64(double %8, double %9, double %11)
%13 = call double @llvm.fabs.f64(double %12)
%14 = load double, double* %5
%15 = fcmp ole double %13, %14
br i1 %15, label %16, label %18
16: ; preds = %3
%17 = load double, double* %7
store double %17, double* %4
br label %31
18: ; preds = %3
%19 = load double, double* %7
%20 = load double, double* %7
%21 = load double, double* %6
%22 = call double @llvm.fmuladd.f64(double %19, double %20, double %21)
%23 = load double, double* %7
%24 = fmul double 2.000000e+00, %23
%25 = fdiv double %22, %24
store double %25, double* %7
%26 = load double, double* %7
%27 = load double, double* %6
%28 = load double, double* %5
%29 = call double @newtonRecursive(double %26, double %27, double %28)
%30 = fmul double 1.000000e+00, %29
store double %30, double* %4
br label %31
31: ; preds = %18, %16
%32 = load double, double* %4
ret double %32
}

LLVM IR (-O2):
define double @newtonRecursive(double %0, double %1, double %2) {
%4 = fneg double %1
%5 = tail call double @llvm.fmuladd.f64(double %2, double %2, double %4)
%6 = tail call double @llvm.fabs.f64(double %5)
%7 = fcmp ugt double %6, %0
br i1 %7, label %8, label %17
8: ; preds = %3, %8
%9 = phi double [ %10, %8 ], [ %2, %3 ]
%10 = phi double [ %13, %8 ], [ %0, %3 ]
%11 = tail call double @llvm.fmuladd.f64(double %9, double %9, double %1)
%12 = fmul double %9, 2.000000e+00
%13 = fdiv double %11, %12
%14 = tail call double @llvm.fmuladd.f64(double %10, double %10, double %4)
%15 = tail call double @llvm.fabs.f64(double %14)
%16 = fcmp ugt double %15, %13
br i1 %16, label %8, label %17
17: ; preds = %8, %3
%18 = phi double [ %2, %3 ], [ %10, %8 ]
ret double %18
}