double root(const double radicand, double exponent) {
  if (exponent < 1)
    return pow(radicand, 1.0 / exponent);
  double rvalue = radicand;
  const double exponent_long = round(exponent);
  if ((exponent_long + 0.0005) > exponent && exponent_long < exponent)
    exponent = exponent_long;
  else if ((exponent_long - 0.0005) < exponent && exponent_long > exponent)
    exponent = exponent_long;
  const double exponent_low = exponent - 1;
  for (unsigned int c = 0; c < 50; ++c)
    rvalue = ((exponent_low)*pow(rvalue, exponent) + radicand) /
             (exponent * pow(rvalue, exponent_low));
  return rvalue;
}


x86 assembly (clang, -O0):
<root>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  0xec6(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1166 <root+0x46>
movsd  -0x10(%rbp),%xmm0
movsd  0xeae(%rip),%xmm1
divsd  -0x18(%rbp),%xmm1
call   1030 <pow@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    129e <root+0x17e>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1040 <round@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  0xe81(%rip),%xmm0
addsd  -0x28(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    11ba <root+0x9a>
movsd  -0x28(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    11ba <root+0x9a>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    11f9 <root+0xd9>
movsd  -0x28(%rbp),%xmm1
movsd  0xe41(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    11f4 <root+0xd4>
movsd  -0x28(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    11f4 <root+0xd4>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    11f9 <root+0xd9>
movsd  -0x18(%rbp),%xmm0
movsd  0xdfa(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x32,-0x34(%rbp)
jae    1294 <root+0x174>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1030 <pow@plt>
movaps %xmm0,%xmm2
movsd  -0x50(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
call   1030 <pow@plt>
movsd  -0x48(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x40(%rbp),%xmm0
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1216 <root+0xf6>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<root>:
push   %rbx
sub    $0x40,%rsp
movapd %xmm1,%xmm2
movsd  0xecf(%rip),%xmm1
ucomisd %xmm2,%xmm1
jbe    1145 <root+0x25>
divsd  %xmm2,%xmm1
add    $0x40,%rsp
pop    %rbx
jmp    1030 <pow@plt>
movsd  %xmm0,(%rsp)
movapd %xmm2,%xmm0
movapd %xmm2,0x10(%rsp)
call   1040 <round@plt>
movapd 0x10(%rsp),%xmm4
movapd %xmm0,%xmm1
ucomisd %xmm0,%xmm4
jbe    117b <root+0x5b>
movsd  0xe97(%rip),%xmm0
addsd  %xmm1,%xmm0
ucomisd %xmm4,%xmm0
ja     11b5 <root+0x95>
movapd %xmm4,%xmm0
movapd %xmm1,%xmm3
addsd  0xe85(%rip),%xmm3
cmpltsd %xmm1,%xmm0
cmpltsd %xmm4,%xmm3
movapd %xmm3,%xmm2
andpd  %xmm1,%xmm2
andnpd %xmm4,%xmm3
orpd   %xmm2,%xmm3
andpd  %xmm0,%xmm3
andnpd %xmm4,%xmm0
orpd   %xmm3,%xmm0
movapd %xmm0,%xmm1
movsd  (%rsp),%xmm0
movsd  0xe56(%rip),%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,0x28(%rsp)
mov    $0x32,%ebx
movapd %xmm1,0x30(%rsp)
nopw   0x0(%rax,%rax,1)
movsd  %xmm0,0x8(%rsp)
call   1030 <pow@plt>
movsd  0x28(%rsp),%xmm1
mulsd  %xmm1,%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <pow@plt>
mulsd  0x30(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
movapd %xmm1,%xmm0
movaps 0x30(%rsp),%xmm1
call   1030 <pow@plt>
movsd  0x28(%rsp),%xmm1
mulsd  %xmm1,%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   1030 <pow@plt>
movapd 0x30(%rsp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0x8(%rsp),%xmm2
divsd  %xmm0,%xmm2
movapd %xmm2,%xmm0
add    $0xfffffffe,%ebx
jne    11e0 <root+0xc0>
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @root(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca i32
store double %0, double* %4
store double %1, double* %5
%10 = load double, double* %5
%11 = fcmp olt double %10, 1.000000e+00
br i1 %11, label %12, label %17
12: ; preds = %2
%13 = load double, double* %4
%14 = load double, double* %5
%15 = fdiv double 1.000000e+00, %14
%16 = call double @pow(double %13, double %15)
store double %16, double* %3
br label %67
17: ; preds = %2
%18 = load double, double* %4
store double %18, double* %6
%19 = load double, double* %5
%20 = call double @llvm.round.f64(double %19)
store double %20, double* %7
%21 = load double, double* %7
%22 = fadd double %21, 5.000000e-04
%23 = load double, double* %5
%24 = fcmp ogt double %22, %23
br i1 %24, label %25, label %31
25: ; preds = %17
%26 = load double, double* %7
%27 = load double, double* %5
%28 = fcmp olt double %26, %27
br i1 %28, label %29, label %31
29: ; preds = %25
%30 = load double, double* %7
store double %30, double* %5
br label %43
31: ; preds = %25, %17
%32 = load double, double* %7
%33 = fsub double %32, 5.000000e-04
%34 = load double, double* %5
%35 = fcmp olt double %33, %34
br i1 %35, label %36, label %42
36: ; preds = %31
%37 = load double, double* %7
%38 = load double, double* %5
%39 = fcmp ogt double %37, %38
br i1 %39, label %40, label %42
40: ; preds = %36
%41 = load double, double* %7
store double %41, double* %5
br label %42
42: ; preds = %40, %36, %31
br label %43
43: ; preds = %42, %29
%44 = load double, double* %5
%45 = fsub double %44, 1.000000e+00
store double %45, double* %8
store i32 0, i32* %9
br label %46
46: ; preds = %62, %43
%47 = load i32, i32* %9
%48 = icmp ult i32 %47, 50
br i1 %48, label %49, label %65
49: ; preds = %46
%50 = load double, double* %8
%51 = load double, double* %6
%52 = load double, double* %5
%53 = call double @pow(double %51, double %52)
%54 = load double, double* %4
%55 = call double @llvm.fmuladd.f64(double %50, double %53, double %54)
%56 = load double, double* %5
%57 = load double, double* %6
%58 = load double, double* %8
%59 = call double @pow(double %57, double %58)
%60 = fmul double %56, %59
%61 = fdiv double %55, %60
store double %61, double* %6
br label %62
62: ; preds = %49
%63 = load i32, i32* %9
%64 = add i32 %63, 1
store i32 %64, i32* %9
br label %46
65: ; preds = %46
%66 = load double, double* %6
store double %66, double* %3
br label %67
67: ; preds = %65, %12
%68 = load double, double* %3
ret double %68
}

LLVM IR (-O2):
define double @root(double %0, double %1) {
%3 = fcmp olt double %1, 1.000000e+00
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = fdiv double 1.000000e+00, %1
%6 = tail call double @pow(double %0, double %5)
br label %37
7: ; preds = %2
%8 = tail call double @llvm.round.f64(double %1)
%9 = fadd double %8, 5.000000e-04
%10 = fcmp ogt double %9, %1
%11 = fcmp olt double %8, %1
%12 = and i1 %11, %10
br i1 %12, label %19, label %13
13: ; preds = %7
%14 = fadd double %8, -5.000000e-04
%15 = fcmp olt double %14, %1
%16 = fcmp ogt double %8, %1
%17 = and i1 %16, %15
%18 = select i1 %17, double %8, double %1
br label %19
19: ; preds = %13, %7
%20 = phi double [ %8, %7 ], [ %18, %13 ]
%21 = fadd double %20, -1.000000e+00
br label %22
22: ; preds = %22, %19
%23 = phi i32 [ 0, %19 ], [ %35, %22 ]
%24 = phi double [ %0, %19 ], [ %34, %22 ]
%25 = tail call double @pow(double %24, double %20)
%26 = tail call double @llvm.fmuladd.f64(double %21, double %25, double %0)
%27 = tail call double @pow(double %24, double %21)
%28 = fmul double %20, %27
%29 = fdiv double %26, %28
%30 = tail call double @pow(double %29, double %20)
%31 = tail call double @llvm.fmuladd.f64(double %21, double %30, double %0)
%32 = tail call double @pow(double %29, double %21)
%33 = fmul double %20, %32
%34 = fdiv double %31, %33
%35 = add nuw nsw i32 %23, 2
%36 = icmp eq i32 %35, 50
br i1 %36, label %37, label %22
37: ; preds = %22, %4
%38 = phi double [ %6, %4 ], [ %34, %22 ]
ret double %38
}