#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 frexpf(float, int *);
float ldexpf(float, int);
int /*<<< orphan*/ mtherrf(char *, int);
float sqrtf(float xx) {
  float f, x, y;
  int e;
  f = xx;
  if (f <= 0.0) {
    if (f < 0.0)
      mtherrf("sqrtf", 1);
    return (0.0);
  }
  x = frexpf(f, &e);
  if (e & 1) {
    x = x + x;
    e -= 1;
  }
  e >>= 1;
  if (x > 1.41421356237) {
    x = x - 2.0;
    y = (((((-9.8843065718E-4 * x + 7.9479950957E-4) * x - 3.5890535377E-3) *
               x +
           1.1028809744E-2) *
              x -
          4.4195203560E-2) *
             x +
         3.5355338194E-1) *
            x +
        1.41421356237E0;
    goto sqdon;
  }
  if (x > 0.707106781187) {
    x = x - 1.0;
    y = (((((1.35199291026E-2 * x - 2.26657767832E-2) * x + 2.78720776889E-2) *
               x -
           3.89582788321E-2) *
              x +
          6.24811144548E-2) *
             x -
         1.25001503933E-1) *
            x * x +
        0.5 * x + 1.0;
    goto sqdon;
  }
  x = x - 0.5;
  y = (((((-3.9495006054E-1 * x + 5.1743034569E-1) * x - 4.3214437330E-1) * x +
         3.5310730460E-1) *
            x -
        3.5354581892E-1) *
           x +
       7.0710676017E-1) *
          x +
      7.07106781187E-1;
sqdon:
  y = ldexpf(y, e);
  return (y);
}


x86 assembly (clang, -O0):
<sqrtf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jb     1191 <sqrtf+0x61>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    1184 <sqrtf+0x54>
lea    0xf3e(%rip),%rdi
mov    $0x1,%esi
call   1050 <mtherrf@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    14a5 <sqrtf+0x375>
movss  -0xc(%rbp),%xmm0
lea    -0x18(%rbp),%rdi
call   1030 <frexpf@plt>
movss  %xmm0,-0x10(%rbp)
mov    -0x18(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     11cb <sqrtf+0x9b>
movss  -0x10(%rbp),%xmm0
addss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
mov    -0x18(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x18(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe1b(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    12b9 <sqrtf+0x189>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeb0(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe82(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe7e(%rip),%xmm1
addsd  %xmm1,%xmm0
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe55(%rip),%xmm1
addsd  %xmm1,%xmm0
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe34(%rip),%xmm1
addsd  %xmm1,%xmm0
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe13(%rip),%xmm1
addsd  %xmm1,%xmm0
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdf2(%rip),%xmm1
addsd  %xmm1,%xmm0
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd59(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
jmp    1489 <sqrtf+0x359>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd3e(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    13c4 <sqrtf+0x294>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd63(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd6d(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd69(%rip),%xmm1
addsd  %xmm1,%xmm0
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd40(%rip),%xmm1
addsd  %xmm1,%xmm0
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd1f(%rip),%xmm1
addsd  %xmm1,%xmm0
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xcfe(%rip),%xmm1
addsd  %xmm1,%xmm0
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xcdd(%rip),%xmm1
addsd  %xmm1,%xmm0
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm3
movsd  0xca2(%rip),%xmm1
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xc96(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
jmp    1489 <sqrtf+0x359>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xc6b(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xc3d(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xc39(%rip),%xmm1
addsd  %xmm1,%xmm0
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xc10(%rip),%xmm1
addsd  %xmm1,%xmm0
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xbef(%rip),%xmm1
addsd  %xmm1,%xmm0
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xbce(%rip),%xmm1
addsd  %xmm1,%xmm0
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xbad(%rip),%xmm1
addsd  %xmm1,%xmm0
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xb8c(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
mov    -0x18(%rbp),%edi
call   1040 <ldexpf@plt>
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sqrtf>:
push   %rax
xorps  %xmm1,%xmm1
ucomiss %xmm0,%xmm1
jae    1152 <sqrtf+0x22>
lea    0x4(%rsp),%rdi
call   1030 <frexpf@plt>
mov    0x4(%rsp),%edi
test   $0x1,%dil
je     116a <sqrtf+0x3a>
movaps %xmm0,%xmm1
jmp    1172 <sqrtf+0x42>
jbe    1165 <sqrtf+0x35>
lea    0xf65(%rip),%rdi
mov    $0x1,%esi
call   1050 <mtherrf@plt>
xorps  %xmm0,%xmm0
pop    %rax
ret
movss  0xe8e(%rip),%xmm1
addss  %xmm1,%xmm0
sar    %edi
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
ucomisd 0xe89(%rip),%xmm1
jbe    11ed <sqrtf+0xbd>
addss  0xe7b(%rip),%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
movsd  0xef0(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  0xeec(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  0xee8(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  0xee4(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  0xee0(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  0xedc(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  0xe28(%rip),%xmm0
jmp    12c4 <sqrtf+0x194>
ucomisd 0xe23(%rip),%xmm1
jbe    1265 <sqrtf+0x135>
addss  0xe09(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe45(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xe41(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xe3d(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xe39(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xe35(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xe31(%rip),%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  0xe29(%rip),%xmm0
addsd  %xmm1,%xmm0
addsd  0xe25(%rip),%xmm0
jmp    12c4 <sqrtf+0x194>
addss  0xd97(%rip),%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
movsd  0xda4(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  0xda0(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  0xd9c(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  0xd98(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  0xd94(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  0xd90(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  0xd54(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rax
jmp    1040 <ldexpf@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"sqrtf\00"
define float @sqrtf(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca i32
store float %0, float* %3
%8 = load float, float* %3
store float %8, float* %4
%9 = load float, float* %4
%10 = fpext float %9 to double
%11 = fcmp ole double %10, 0.000000e+00
br i1 %11, label %12, label %19
12: ; preds = %1
%13 = load float, float* %4
%14 = fpext float %13 to double
%15 = fcmp olt double %14, 0.000000e+00
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = call i32 @mtherrf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 1)
br label %18
18: ; preds = %16, %12
store float 0.000000e+00, float* %2
br label %125
19: ; preds = %1
%20 = load float, float* %4
%21 = call float @frexpf(float %20, i32* %7)
store float %21, float* %5
%22 = load i32, i32* %7
%23 = and i32 %22, 1
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %31
25: ; preds = %19
%26 = load float, float* %5
%27 = load float, float* %5
%28 = fadd float %26, %27
store float %28, float* %5
%29 = load i32, i32* %7
%30 = sub nsw i32 %29, 1
store i32 %30, i32* %7
br label %31
31: ; preds = %25, %19
%32 = load i32, i32* %7
%33 = ashr i32 %32, 1
store i32 %33, i32* %7
%34 = load float, float* %5
%35 = fpext float %34 to double
%36 = fcmp ogt double %35, 0x3FF6A09E667F055A
br i1 %36, label %37, label %61
37: ; preds = %31
%38 = load float, float* %5
%39 = fpext float %38 to double
%40 = fsub double %39, 2.000000e+00
%41 = fptrunc double %40 to float
store float %41, float* %5
%42 = load float, float* %5
%43 = fpext float %42 to double
%44 = call double @llvm.fmuladd.f64(double 0xBF5031C7563475B1, double %43, double 0x3F4A0B42F342EDA4)
%45 = load float, float* %5
%46 = fpext float %45 to double
%47 = call double @llvm.fmuladd.f64(double %44, double %46, double 0xBF6D66CA722D2CF6)
%48 = load float, float* %5
%49 = fpext float %48 to double
%50 = call double @llvm.fmuladd.f64(double %47, double %49, double 0x3F869645C950753F)
%51 = load float, float* %5
%52 = fpext float %51 to double
%53 = call double @llvm.fmuladd.f64(double %50, double %52, double 0xBFA6A0C0F3DC4B67)
%54 = load float, float* %5
%55 = fpext float %54 to double
%56 = call double @llvm.fmuladd.f64(double %53, double %55, double 0x3FD6A09E5D34A3CB)
%57 = load float, float* %5
%58 = fpext float %57 to double
%59 = call double @llvm.fmuladd.f64(double %56, double %58, double 0x3FF6A09E667F055A)
%60 = fptrunc double %59 to float
store float %60, float* %6
br label %120
61: ; preds = %31
%62 = load float, float* %5
%63 = fpext float %62 to double
%64 = fcmp ogt double %63, 0x3FE6A09E667F4BB8
br i1 %64, label %65, label %96
65: ; preds = %61
%66 = load float, float* %5
%67 = fpext float %66 to double
%68 = fsub double %67, 1.000000e+00
%69 = fptrunc double %68 to float
store float %69, float* %5
%70 = load float, float* %5
%71 = fpext float %70 to double
%72 = call double @llvm.fmuladd.f64(double 0x3F8BB0562AB82071, double %71, double 0xBF9735B28816D097)
%73 = load float, float* %5
%74 = fpext float %73 to double
%75 = call double @llvm.fmuladd.f64(double %72, double %74, double 0x3F9C8A7F7894E2E4)
%76 = load float, float* %5
%77 = fpext float %76 to double
%78 = call double @llvm.fmuladd.f64(double %75, double %77, double 0xBFA3F256EAFC112E)
%79 = load float, float* %5
%80 = fpext float %79 to double
%81 = call double @llvm.fmuladd.f64(double %78, double %80, double 0x3FAFFD864E66E953)
%82 = load float, float* %5
%83 = fpext float %82 to double
%84 = call double @llvm.fmuladd.f64(double %81, double %83, double 0xBFC0000C9DABE913)
%85 = load float, float* %5
%86 = fpext float %85 to double
%87 = fmul double %84, %86
%88 = load float, float* %5
%89 = fpext float %88 to double
%90 = load float, float* %5
%91 = fpext float %90 to double
%92 = fmul double 5.000000e-01, %91
%93 = call double @llvm.fmuladd.f64(double %87, double %89, double %92)
%94 = fadd double %93, 1.000000e+00
%95 = fptrunc double %94 to float
store float %95, float* %6
br label %120
96: ; preds = %61
%97 = load float, float* %5
%98 = fpext float %97 to double
%99 = fsub double %98, 5.000000e-01
%100 = fptrunc double %99 to float
store float %100, float* %5
%101 = load float, float* %5
%102 = fpext float %101 to double
%103 = call double @llvm.fmuladd.f64(double 0xBFD946DC9E64A42B, double %102, double 0x3FE08ECA159649EE)
%104 = load float, float* %5
%105 = fpext float %104 to double
%106 = call double @llvm.fmuladd.f64(double %103, double %105, double 0xBFDBA840DF9E54A2)
%107 = load float, float* %5
%108 = fpext float %107 to double
%109 = call double @llvm.fmuladd.f64(double %106, double %108, double 0x3FD6994F614F15E1)
%110 = load float, float* %5
%111 = fpext float %110 to double
%112 = call double @llvm.fmuladd.f64(double %109, double %111, double 0xBFD6A07EA4798833)
%113 = load float, float* %5
%114 = fpext float %113 to double
%115 = call double @llvm.fmuladd.f64(double %112, double %114, double 0x3FE6A09E5B36BDC5)
%116 = load float, float* %5
%117 = fpext float %116 to double
%118 = call double @llvm.fmuladd.f64(double %115, double %117, double 0x3FE6A09E667F4BB8)
%119 = fptrunc double %118 to float
store float %119, float* %6
br label %120
120: ; preds = %96, %65, %37
%121 = load float, float* %6
%122 = load i32, i32* %7
%123 = call float @ldexpf(float %121, i32 %122)
store float %123, float* %6
%124 = load float, float* %6
store float %124, float* %2
br label %125
125: ; preds = %120, %18
%126 = load float, float* %2
ret float %126
}

LLVM IR (-O2):
@.str = [6 x i8] c"sqrtf\00"
define float @sqrtf(float %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = fcmp ugt float %0, 0.000000e+00
br i1 %4, label %9, label %5
5: ; preds = %1
%6 = fcmp olt float %0, 0.000000e+00
br i1 %6, label %7, label %58
7: ; preds = %5
%8 = tail call i32 @mtherrf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 1)
br label %58
9: ; preds = %1
%10 = call float @frexpf(float %0, i32* %2)
%11 = load i32, i32* %2
%12 = and i32 %11, 1
%13 = icmp eq i32 %12, 0
%14 = xor i1 %13, true
%15 = sext i1 %14 to i32
%16 = add nsw i32 %11, %15
%17 = select i1 %13, float -0.000000e+00, float %10
%18 = fadd float %10, %17
%19 = ashr i32 %16, 1
%20 = fpext float %18 to double
%21 = fcmp ogt double %20, 0x3FF6A09E667F055A
br i1 %21, label %22, label %31
22: ; preds = %9
%23 = fadd float %18, -2.000000e+00
%24 = fpext float %23 to double
%25 = tail call double @llvm.fmuladd.f64(double %24, double 0xBF5031C7563475B1, double 0x3F4A0B42F342EDA4)
%26 = tail call double @llvm.fmuladd.f64(double %25, double %24, double 0xBF6D66CA722D2CF6)
%27 = tail call double @llvm.fmuladd.f64(double %26, double %24, double 0x3F869645C950753F)
%28 = tail call double @llvm.fmuladd.f64(double %27, double %24, double 0xBFA6A0C0F3DC4B67)
%29 = tail call double @llvm.fmuladd.f64(double %28, double %24, double 0x3FD6A09E5D34A3CB)
%30 = tail call double @llvm.fmuladd.f64(double %29, double %24, double 0x3FF6A09E667F055A)
br label %54
31: ; preds = %9
%32 = fcmp ogt double %20, 0x3FE6A09E667F4BB8
br i1 %32, label %33, label %45
33: ; preds = %31
%34 = fadd float %18, -1.000000e+00
%35 = fpext float %34 to double
%36 = tail call double @llvm.fmuladd.f64(double %35, double 0x3F8BB0562AB82071, double 0xBF9735B28816D097)
%37 = tail call double @llvm.fmuladd.f64(double %36, double %35, double 0x3F9C8A7F7894E2E4)
%38 = tail call double @llvm.fmuladd.f64(double %37, double %35, double 0xBFA3F256EAFC112E)
%39 = tail call double @llvm.fmuladd.f64(double %38, double %35, double 0x3FAFFD864E66E953)
%40 = tail call double @llvm.fmuladd.f64(double %39, double %35, double 0xBFC0000C9DABE913)
%41 = fmul double %40, %35
%42 = fmul double %35, 5.000000e-01
%43 = tail call double @llvm.fmuladd.f64(double %41, double %35, double %42)
%44 = fadd double %43, 1.000000e+00
br label %54
45: ; preds = %31
%46 = fadd float %18, -5.000000e-01
%47 = fpext float %46 to double
%48 = tail call double @llvm.fmuladd.f64(double %47, double 0xBFD946DC9E64A42B, double 0x3FE08ECA159649EE)
%49 = tail call double @llvm.fmuladd.f64(double %48, double %47, double 0xBFDBA840DF9E54A2)
%50 = tail call double @llvm.fmuladd.f64(double %49, double %47, double 0x3FD6994F614F15E1)
%51 = tail call double @llvm.fmuladd.f64(double %50, double %47, double 0xBFD6A07EA4798833)
%52 = tail call double @llvm.fmuladd.f64(double %51, double %47, double 0x3FE6A09E5B36BDC5)
%53 = tail call double @llvm.fmuladd.f64(double %52, double %47, double 0x3FE6A09E667F4BB8)
br label %54
54: ; preds = %45, %33, %22
%55 = phi double [ %30, %22 ], [ %44, %33 ], [ %53, %45 ]
%56 = fptrunc double %55 to float
%57 = tail call float @ldexpf(float %56, i32 %19)
br label %58
58: ; preds = %5, %7, %54
%59 = phi float [ %57, %54 ], [ 0.000000e+00, %7 ], [ 0.000000e+00, %5 ]
ret float %59
}