#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 Abs(double);
double sqrt9(double Nbr) {
  double Number = Nbr / 2;
  const double Tolerance = 1.0e-7;
  do {
    Number = (Number + Nbr / Number) / 2;
  } while (Abs(Number * Number - Nbr) > Tolerance);
  return Number;
}


x86 assembly (clang, -O0):
<sqrt9>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xede(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xec5(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
divsd  -0x10(%rbp),%xmm1
addsd  %xmm1,%xmm0
movsd  0xead(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm2
movsd  -0x8(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <Abs@plt>
movsd  0xe61(%rip),%xmm1
ucomisd %xmm1,%xmm0
ja     1140 <sqrt9+0x30>
movsd  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sqrt9>:
sub    $0x38,%rsp
movsd  0xee4(%rip),%xmm1
mulsd  %xmm0,%xmm1
movapd 0xee8(%rip),%xmm2
movapd %xmm0,0x10(%rsp)
xorpd  %xmm0,%xmm2
movapd %xmm2,(%rsp)
nopw   0x0(%rax,%rax,1)
movapd 0x10(%rsp),%xmm0
divsd  %xmm1,%xmm0
addsd  %xmm0,%xmm1
mulsd  0xeaa(%rip),%xmm1
movapd %xmm1,0x20(%rsp)
mulsd  %xmm1,%xmm1
addsd  (%rsp),%xmm1
movapd %xmm1,%xmm0
call   1030 <Abs@plt>
movapd 0x20(%rsp),%xmm1
ucomisd 0xe8c(%rip),%xmm0
ja     1140 <sqrt9+0x30>
movapd %xmm1,%xmm0
add    $0x38,%rsp
ret

LLVM IR (-O0):
define double @sqrt9(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double %0, double* %2
%5 = load double, double* %2
%6 = fdiv double %5, 2.000000e+00
store double %6, double* %3
store double 0x3E7AD7F29ABCAF48, double* %4
br label %7
7: ; preds = %14, %1
%8 = load double, double* %3
%9 = load double, double* %2
%10 = load double, double* %3
%11 = fdiv double %9, %10
%12 = fadd double %8, %11
%13 = fdiv double %12, 2.000000e+00
store double %13, double* %3
br label %14
14: ; preds = %7
%15 = load double, double* %3
%16 = load double, double* %3
%17 = load double, double* %2
%18 = fneg double %17
%19 = call double @llvm.fmuladd.f64(double %15, double %16, double %18)
%20 = call double @Abs(double %19)
%21 = fcmp ogt double %20, 0x3E7AD7F29ABCAF48
br i1 %21, label %7, label %22
22: ; preds = %14
%23 = load double, double* %3
ret double %23
}

LLVM IR (-O2):
define double @sqrt9(double %0) {
%2 = fmul double %0, 5.000000e-01
%3 = fneg double %0
br label %4
4: ; preds = %4, %1
%5 = phi double [ %2, %1 ], [ %8, %4 ]
%6 = fdiv double %0, %5
%7 = fadd double %5, %6
%8 = fmul double %7, 5.000000e-01
%9 = tail call double @llvm.fmuladd.f64(double %8, double %8, double %3)
%10 = tail call double @Abs(double %9)
%11 = fcmp ogt double %10, 0x3E7AD7F29ABCAF48
br i1 %11, label %4, label %12
12: ; preds = %4
ret double %8
}