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


x86 assembly (clang, -O0):
<squareRoot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  0xedf(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xece(%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>
movss  0xe9c(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     119e <squareRoot+0x8e>
movss  -0x4(%rbp),%xmm0
divss  -0xc(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe7c(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1137 <squareRoot+0x27>
movss  -0xc(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<squareRoot>:
sub    $0x38,%rsp
movaps %xmm0,%xmm1
movss  0xef1(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps %xmm1,0x10(%rsp)
subss  %xmm1,%xmm0
call   1030 <absoluteValue@plt>
ucomiss 0xedc(%rip),%xmm0
jb     1198 <squareRoot+0x88>
movaps 0xebf(%rip),%xmm0
xorps  0x10(%rsp),%xmm0
movaps %xmm0,0x20(%rsp)
movss  0xebd(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movaps 0x10(%rsp),%xmm1
divss  %xmm0,%xmm1
addss  %xmm0,%xmm1
mulss  0xea3(%rip),%xmm1
movaps %xmm1,(%rsp)
movaps %xmm1,%xmm0
mulss  %xmm1,%xmm0
addss  0x20(%rsp),%xmm0
call   1030 <absoluteValue@plt>
ucomiss 0xe82(%rip),%xmm0
movaps (%rsp),%xmm0
jae    1160 <squareRoot+0x50>
movaps (%rsp),%xmm0
add    $0x38,%rsp
ret

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

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