long double sqrtl(x)
long double x;
{
  int e;
  long double z, w;
  if (x <= 0.0) {
    if (x < 0.0)
      mtherr("sqrtl", 1);
    return (0.0);
  }
  w = x;
  z = frexpl(x, &e);
  x = (-0.20440583154734771959904L * z + 0.89019407351052789754347L) * z +
      0.31356706742295303132394L;
  if ((e & 1) != 0)
    x *= 1.4142135623730950488017E0L;
  x = ldexpl(x, (e >> 1));
  x += w / x;
  x = ldexpl(x, -1);
  x += w / x;
  x = ldexpl(x, -1);
  x += w / x;
  x = ldexpl(x, -1);
  return (x);
}


x86 assembly (clang, -O0):
<sqrtl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
fldt   0x10(%rbp)
fstpt  -0x20(%rbp)
fldt   -0x20(%rbp)
fldz
fucomip %st(1),%st
fstp   %st(0)
jb     1183 <sqrtl+0x53>
jmp    1152 <sqrtl+0x22>
fldt   -0x20(%rbp)
fldz
fucomip %st(1),%st
fstp   %st(0)
jbe    1179 <sqrtl+0x49>
jmp    1166 <sqrtl+0x36>
lea    0xed3(%rip),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1050 <mtherr@plt>
fldz
fstpt  -0x10(%rbp)
jmp    125a <sqrtl+0x12a>
fldt   -0x20(%rbp)
fstpt  -0x50(%rbp)
fldt   -0x20(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
lea    -0x24(%rbp),%rdi
call   1030 <frexpl@plt>
fstpt  -0x40(%rbp)
fldt   -0x40(%rbp)
fldt   0xe5a(%rip)
fmul   %st(1),%st
fldt   0xe62(%rip)
faddp  %st,%st(1)
fmulp  %st,%st(1)
fldt   0xe68(%rip)
faddp  %st,%st(1)
fstpt  -0x20(%rbp)
mov    -0x24(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     11da <sqrtl+0xaa>
fldt   -0x20(%rbp)
fldt   0xe5b(%rip)
fmulp  %st,%st(1)
fstpt  -0x20(%rbp)
fldt   -0x20(%rbp)
mov    -0x24(%rbp),%edi
sar    %edi
mov    %rsp,%rax
fstpt  (%rax)
call   1040 <ldexpl@plt>
fstpt  -0x20(%rbp)
fldt   -0x50(%rbp)
fldt   -0x20(%rbp)
fdivr  %st,%st(1)
faddp  %st,%st(1)
fstpt  -0x20(%rbp)
fldt   -0x20(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
mov    $0xffffffff,%edi
mov    %edi,-0x54(%rbp)
call   1040 <ldexpl@plt>
mov    -0x54(%rbp),%edi
fstpt  -0x20(%rbp)
fldt   -0x50(%rbp)
fldt   -0x20(%rbp)
fdivr  %st,%st(1)
faddp  %st,%st(1)
fstpt  -0x20(%rbp)
fldt   -0x20(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1040 <ldexpl@plt>
mov    -0x54(%rbp),%edi
fstpt  -0x20(%rbp)
fldt   -0x50(%rbp)
fldt   -0x20(%rbp)
fdivr  %st,%st(1)
faddp  %st,%st(1)
fstpt  -0x20(%rbp)
fldt   -0x20(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1040 <ldexpl@plt>
fstpt  -0x20(%rbp)
fldt   -0x20(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sqrtl>:
sub    $0x28,%rsp
fldt   0x30(%rsp)
fldz
fucomi %st(1),%st
jae    11d3 <sqrtl+0xa3>
fstp   %st(0)
fld    %st(0)
fstpt  (%rsp)
lea    0x24(%rsp),%rdi
fstpt  0x18(%rsp)
call   1030 <frexpl@plt>
fldt   0xea3(%rip)
fmul   %st(1),%st
fldt   0xeab(%rip)
faddp  %st,%st(1)
fmulp  %st,%st(1)
fldt   0xeb1(%rip)
faddp  %st,%st(1)
mov    0x24(%rsp),%edi
test   $0x1,%dil
fldt   0xeb1(%rip)
fmul   %st(1),%st
fcmove %st(1),%st
fstp   %st(1)
sar    %edi
fstpt  (%rsp)
call   1040 <ldexpl@plt>
fldt   0x18(%rsp)
fdiv   %st(1),%st
faddp  %st,%st(1)
fstpt  (%rsp)
mov    $0xffffffff,%edi
call   1040 <ldexpl@plt>
fldt   0x18(%rsp)
fdiv   %st(1),%st
faddp  %st,%st(1)
fstpt  (%rsp)
mov    $0xffffffff,%edi
call   1040 <ldexpl@plt>
fldt   0x18(%rsp)
fdiv   %st(1),%st
faddp  %st,%st(1)
fstpt  (%rsp)
mov    $0xffffffff,%edi
call   1040 <ldexpl@plt>
add    $0x28,%rsp
ret
fstp   %st(1)
jbe    11ce <sqrtl+0x9e>
lea    0xe62(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
fstpt  0x18(%rsp)
call   1050 <mtherr@plt>
fldt   0x18(%rsp)
add    $0x28,%rsp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"sqrtl\00"
define x86_fp80 @sqrtl(x86_fp80 %0) {
%2 = alloca x86_fp80
%3 = alloca x86_fp80
%4 = alloca i32
%5 = alloca x86_fp80
%6 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %3
%7 = load x86_fp80, x86_fp80* %3
%8 = fcmp ole x86_fp80 %7, 0xK00000000000000000000
br i1 %8, label %9, label %15
9: ; preds = %1
%10 = load x86_fp80, x86_fp80* %3
%11 = fcmp olt x86_fp80 %10, 0xK00000000000000000000
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @mtherr to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 1)
br label %14
14: ; preds = %12, %9
store x86_fp80 0xK00000000000000000000, x86_fp80* %2
br label %56
15: ; preds = %1
%16 = load x86_fp80, x86_fp80* %3
store x86_fp80 %16, x86_fp80* %6
%17 = load x86_fp80, x86_fp80* %3
%18 = call x86_fp80 @frexpl(x86_fp80 %17, i32* %4)
store x86_fp80 %18, x86_fp80* %5
%19 = load x86_fp80, x86_fp80* %5
%20 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 0xKBFFCD14FC3266E1FE436, x86_fp80 %19, x86_fp80 0xK3FFEE3E3C240D21BD5D1)
%21 = load x86_fp80, x86_fp80* %5
%22 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %20, x86_fp80 %21, x86_fp80 0xK3FFDA08BDCD75E50CEF4)
store x86_fp80 %22, x86_fp80* %3
%23 = load i32, i32* %4
%24 = and i32 %23, 1
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %15
%27 = load x86_fp80, x86_fp80* %3
%28 = fmul x86_fp80 %27, 0xK3FFFB504F333F9DE6484
store x86_fp80 %28, x86_fp80* %3
br label %29
29: ; preds = %26, %15
%30 = load x86_fp80, x86_fp80* %3
%31 = load i32, i32* %4
%32 = ashr i32 %31, 1
%33 = call x86_fp80 @ldexpl(x86_fp80 %30, i32 %32)
store x86_fp80 %33, x86_fp80* %3
%34 = load x86_fp80, x86_fp80* %6
%35 = load x86_fp80, x86_fp80* %3
%36 = fdiv x86_fp80 %34, %35
%37 = load x86_fp80, x86_fp80* %3
%38 = fadd x86_fp80 %37, %36
store x86_fp80 %38, x86_fp80* %3
%39 = load x86_fp80, x86_fp80* %3
%40 = call x86_fp80 @ldexpl(x86_fp80 %39, i32 -1)
store x86_fp80 %40, x86_fp80* %3
%41 = load x86_fp80, x86_fp80* %6
%42 = load x86_fp80, x86_fp80* %3
%43 = fdiv x86_fp80 %41, %42
%44 = load x86_fp80, x86_fp80* %3
%45 = fadd x86_fp80 %44, %43
store x86_fp80 %45, x86_fp80* %3
%46 = load x86_fp80, x86_fp80* %3
%47 = call x86_fp80 @ldexpl(x86_fp80 %46, i32 -1)
store x86_fp80 %47, x86_fp80* %3
%48 = load x86_fp80, x86_fp80* %6
%49 = load x86_fp80, x86_fp80* %3
%50 = fdiv x86_fp80 %48, %49
%51 = load x86_fp80, x86_fp80* %3
%52 = fadd x86_fp80 %51, %50
store x86_fp80 %52, x86_fp80* %3
%53 = load x86_fp80, x86_fp80* %3
%54 = call x86_fp80 @ldexpl(x86_fp80 %53, i32 -1)
store x86_fp80 %54, x86_fp80* %3
%55 = load x86_fp80, x86_fp80* %3
store x86_fp80 %55, x86_fp80* %2
br label %56
56: ; preds = %29, %14
%57 = load x86_fp80, x86_fp80* %2
ret x86_fp80 %57
}

LLVM IR (-O2):
@.str = [6 x i8] c"sqrtl\00"
define x86_fp80 @sqrtl(x86_fp80 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = fcmp ugt x86_fp80 %0, 0xK00000000000000000000
br i1 %4, label %9, label %5
5: ; preds = %1
%6 = fcmp olt x86_fp80 %0, 0xK00000000000000000000
br i1 %6, label %7, label %29
7: ; preds = %5
%8 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @mtherr to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 1)
br label %29
9: ; preds = %1
%10 = call x86_fp80 @frexpl(x86_fp80 %0, i32* %2)
%11 = tail call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %10, x86_fp80 0xKBFFCD14FC3266E1FE436, x86_fp80 0xK3FFEE3E3C240D21BD5D1)
%12 = tail call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %11, x86_fp80 %10, x86_fp80 0xK3FFDA08BDCD75E50CEF4)
%13 = load i32, i32* %2
%14 = and i32 %13, 1
%15 = icmp eq i32 %14, 0
%16 = fmul x86_fp80 %12, 0xK3FFFB504F333F9DE6484
%17 = select i1 %15, x86_fp80 %12, x86_fp80 %16
%18 = ashr i32 %13, 1
%19 = tail call x86_fp80 @ldexpl(x86_fp80 %17, i32 %18)
%20 = fdiv x86_fp80 %0, %19
%21 = fadd x86_fp80 %19, %20
%22 = tail call x86_fp80 @ldexpl(x86_fp80 %21, i32 -1)
%23 = fdiv x86_fp80 %0, %22
%24 = fadd x86_fp80 %22, %23
%25 = tail call x86_fp80 @ldexpl(x86_fp80 %24, i32 -1)
%26 = fdiv x86_fp80 %0, %25
%27 = fadd x86_fp80 %25, %26
%28 = tail call x86_fp80 @ldexpl(x86_fp80 %27, i32 -1)
br label %29
29: ; preds = %5, %7, %9
%30 = phi x86_fp80 [ %28, %9 ], [ 0xK00000000000000000000, %7 ], [ 0xK00000000000000000000, %5 ]
ret x86_fp80 %30
}