#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 __BUILTIN_DAED_FBETWEEN(double, double);
double fabs(double);
double sqrt(double);
int main() {
  double xn, xnp1, residu, Input, Output, should_be_zero;
  int i;
  Input = __BUILTIN_DAED_FBETWEEN(16.0, 16.1);
  xn = 1.0 / Input;
  xnp1 = xn;
  residu = 2.0 * 0.00000001 * (xn + xnp1) / (xn + xnp1);
  i = 0;
  while (fabs(residu) > 0.00000001) {
    xnp1 = xn * (1.875 + Input * xn * xn * (-1.25 + 0.375 * Input * xn * xn));
    residu = 2.0 * (xnp1 - xn) / (xn + xnp1);
    xn = xnp1;
    i++;
  }
  Output = 1.0 / xnp1;
  should_be_zero = Output - sqrt(Input);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xed9(%rip),%xmm0
movsd  0xed9(%rip),%xmm1
call   1030 <__BUILTIN_DAED_FBETWEEN@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  0xeb7(%rip),%xmm0
divsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm1
addsd  -0x18(%rbp),%xmm1
movsd  0xe89(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  -0x10(%rbp),%xmm1
addsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x3c(%rbp)
movsd  -0x20(%rbp),%xmm0
movaps 0xeaf(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xe73(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    124c <main+0x12c>
movsd  -0x10(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
movsd  0xe6d(%rip),%xmm2
mulsd  -0x28(%rbp),%xmm2
mulsd  -0x10(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm3
mulsd  %xmm3,%xmm2
movsd  0xe4a(%rip),%xmm3
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe32(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
movsd  0xe0b(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  -0x10(%rbp),%xmm1
addsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1195 <main+0x75>
movsd  0xdb4(%rip),%xmm0
divsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movsd  0xed7(%rip),%xmm0
movsd  0xed7(%rip),%xmm1
call   1030 <__BUILTIN_DAED_FBETWEEN@plt>
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
ja     1144 <main+0x24>
xor    %eax,%eax
pop    %rcx
ret
ucomisd %xmm1,%xmm0
jae    1140 <main+0x20>
call   1040 <sqrt@plt>
jmp    1140 <main+0x20>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca i32
store i32 0, i32* %1
%9 = call double @__BUILTIN_DAED_FBETWEEN(double 1.600000e+01, double 1.610000e+01)
store double %9, double* %5
%10 = load double, double* %5
%11 = fdiv double 1.000000e+00, %10
store double %11, double* %2
%12 = load double, double* %2
store double %12, double* %3
%13 = load double, double* %2
%14 = load double, double* %3
%15 = fadd double %13, %14
%16 = fmul double 2.000000e-08, %15
%17 = load double, double* %2
%18 = load double, double* %3
%19 = fadd double %17, %18
%20 = fdiv double %16, %19
store double %20, double* %4
store i32 0, i32* %8
br label %21
21: ; preds = %25, %0
%22 = load double, double* %4
%23 = call double @llvm.fabs.f64(double %22)
%24 = fcmp ogt double %23, 1.000000e-08
br i1 %24, label %25, label %51
25: ; preds = %21
%26 = load double, double* %2
%27 = load double, double* %5
%28 = load double, double* %2
%29 = fmul double %27, %28
%30 = load double, double* %2
%31 = fmul double %29, %30
%32 = load double, double* %5
%33 = fmul double 3.750000e-01, %32
%34 = load double, double* %2
%35 = fmul double %33, %34
%36 = load double, double* %2
%37 = call double @llvm.fmuladd.f64(double %35, double %36, double -1.250000e+00)
%38 = call double @llvm.fmuladd.f64(double %31, double %37, double 1.875000e+00)
%39 = fmul double %26, %38
store double %39, double* %3
%40 = load double, double* %3
%41 = load double, double* %2
%42 = fsub double %40, %41
%43 = fmul double 2.000000e+00, %42
%44 = load double, double* %2
%45 = load double, double* %3
%46 = fadd double %44, %45
%47 = fdiv double %43, %46
store double %47, double* %4
%48 = load double, double* %3
store double %48, double* %2
%49 = load i32, i32* %8
%50 = add nsw i32 %49, 1
store i32 %50, i32* %8
br label %21
51: ; preds = %21
%52 = load double, double* %3
%53 = fdiv double 1.000000e+00, %52
store double %53, double* %6
%54 = load double, double* %6
%55 = load double, double* %5
%56 = call double @sqrt(double %55)
%57 = fsub double %54, %56
store double %57, double* %7
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call double @__BUILTIN_DAED_FBETWEEN(double 1.600000e+01, double 1.610000e+01)
%2 = fcmp olt double %1, 0.000000e+00
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call double @sqrt(double %1)
br label %5
5: ; preds = %0, %3
ret i32 0
}