#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 absoluteValue(float);
float squareRoot(float x, float epsilon) {
  float guess = 1.0;
  while (absoluteValue(guess * guess - x) >= epsilon)
    guess = (x / guess + guess) / 2.0;
  return guess;
}


x86 assembly (clang, -O0):
<squareRoot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  0xed6(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
movss  -0x4(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
call   1030 <absoluteValue@plt>
ucomiss -0x8(%rbp),%xmm0
jb     118f <squareRoot+0x7f>
movss  -0x4(%rbp),%xmm0
divss  -0xc(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe8b(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    112f <squareRoot+0x1f>
movss  -0xc(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<squareRoot>:
sub    $0x48,%rsp
movss  %xmm1,0xc(%rsp)
movaps %xmm0,%xmm1
movss  0xeeb(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm1,0x20(%rsp)
subss  %xmm1,%xmm0
call   1030 <absoluteValue@plt>
movss  0xc(%rsp),%xmm1
ucomiss %xmm1,%xmm0
jb     119c <squareRoot+0x8c>
movaps 0xeb6(%rip),%xmm0
xorps  0x20(%rsp),%xmm0
movaps %xmm0,0x30(%rsp)
movss  0xeb4(%rip),%xmm0
nopl   0x0(%rax)
movaps 0x20(%rsp),%xmm1
divss  %xmm0,%xmm1
addss  %xmm0,%xmm1
mulss  0xe9f(%rip),%xmm1
movaps %xmm1,0x10(%rsp)
movaps %xmm1,%xmm0
mulss  %xmm1,%xmm0
addss  0x30(%rsp),%xmm0
call   1030 <absoluteValue@plt>
movss  0xc(%rsp),%xmm1
ucomiss %xmm1,%xmm0
movaps 0x10(%rsp),%xmm0
jae    1160 <squareRoot+0x50>
movaps 0x10(%rsp),%xmm0
add    $0x48,%rsp
ret

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

LLVM IR (-O2):
define float @squareRoot(float %0, float %1) {
%3 = fneg float %0
%4 = fsub float 1.000000e+00, %0
%5 = tail call float @absoluteValue(float %4)
%6 = fcmp ult float %5, %1
br i1 %6, label %15, label %7
7: ; preds = %2, %7
%8 = phi float [ %11, %7 ], [ 1.000000e+00, %2 ]
%9 = fdiv float %0, %8
%10 = fadd float %8, %9
%11 = fmul float %10, 5.000000e-01
%12 = tail call float @llvm.fmuladd.f32(float %11, float %11, float %3)
%13 = tail call float @absoluteValue(float %12)
%14 = fcmp ult float %13, %1
br i1 %14, label %15, label %7
15: ; preds = %7, %2
%16 = phi float [ 1.000000e+00, %2 ], [ %11, %7 ]
ret float %16
}