double _XcmsCubeRoot(double a) {
  register double abs_a, cur_guess, delta;
  if (a == 0.)
    return 0.;
  abs_a = a < 0. ? -a : a;
  if (abs_a > 1.)
    cur_guess = abs_a / 8.;
  else
    cur_guess = abs_a * 8.;
  do {
    delta = (cur_guess - abs_a / (cur_guess * cur_guess)) / 3.;
    cur_guess -= delta;
    if (delta < 0.)
      delta = -delta;
  } while (delta >= cur_guess * 1e-6);
  if (a < 0.)
    cur_guess = -cur_guess;
  return cur_guess;
}


x86 assembly (clang, -O0):
<_XcmsCubeRoot>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    112e <_XcmsCubeRoot+0x2e>
jp     112e <_XcmsCubeRoot+0x2e>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1288 <_XcmsCubeRoot+0x188>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1162 <_XcmsCubeRoot+0x62>
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    116c <_XcmsCubeRoot+0x6c>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe7d(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11a8 <_XcmsCubeRoot+0xa8>
movsd  -0x18(%rbp),%xmm0
movsd  0xe6e(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    11ba <_XcmsCubeRoot+0xba>
movsd  0xe58(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    11bf <_XcmsCubeRoot+0xbf>
movsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
mulsd  -0x20(%rbp),%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  0xe2d(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    122e <_XcmsCubeRoot+0x12e>
movsd  -0x28(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    1233 <_XcmsCubeRoot+0x133>
movsd  -0x28(%rbp),%xmm0
movsd  0xdd8(%rip),%xmm1
mulsd  -0x20(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jae    11bf <_XcmsCubeRoot+0xbf>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    127e <_XcmsCubeRoot+0x17e>
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<_XcmsCubeRoot>:
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1111 <_XcmsCubeRoot+0x11>
jp     1111 <_XcmsCubeRoot+0x11>
movapd %xmm1,%xmm0
ret
movapd 0xee7(%rip),%xmm3
xorpd  %xmm0,%xmm3
xorpd  %xmm8,%xmm8
movapd %xmm0,%xmm4
cmpltsd %xmm8,%xmm4
andpd  %xmm4,%xmm3
andnpd %xmm0,%xmm4
orpd   %xmm3,%xmm4
xor    %eax,%eax
ucomisd 0xede(%rip),%xmm4
seta   %al
lea    0xec4(%rip),%rcx
movapd %xmm4,%xmm3
mulsd  (%rcx,%rax,8),%xmm3
movsd  0xeca(%rip),%xmm9
movapd 0xe9a(%rip),%xmm5
movsd  0xec2(%rip),%xmm6
xchg   %ax,%ax
movapd %xmm3,%xmm7
mulsd  %xmm3,%xmm7
movapd %xmm4,%xmm1
divsd  %xmm7,%xmm1
movapd %xmm3,%xmm2
subsd  %xmm1,%xmm2
divsd  %xmm9,%xmm2
subsd  %xmm2,%xmm3
movapd %xmm2,%xmm1
xorpd  %xmm5,%xmm1
movapd %xmm2,%xmm7
cmpltsd %xmm8,%xmm7
andpd  %xmm7,%xmm1
andnpd %xmm2,%xmm7
orpd   %xmm1,%xmm7
movapd %xmm3,%xmm1
mulsd  %xmm6,%xmm1
ucomisd %xmm1,%xmm7
jae    1170 <_XcmsCubeRoot+0x70>
movapd 0xe3b(%rip),%xmm1
xorpd  %xmm3,%xmm1
xorpd  %xmm2,%xmm2
cmpltsd %xmm2,%xmm0
andpd  %xmm0,%xmm1
andnpd %xmm3,%xmm0
orpd   %xmm1,%xmm0
movapd %xmm0,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @_XcmsCubeRoot(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %3
%7 = load double, double* %3
%8 = fcmp oeq double %7, 0.000000e+00
br i1 %8, label %9, label %10
9: ; preds = %1
store double 0.000000e+00, double* %2
br label %60
10: ; preds = %1
%11 = load double, double* %3
%12 = fcmp olt double %11, 0.000000e+00
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = load double, double* %3
%15 = fneg double %14
br label %18
16: ; preds = %10
%17 = load double, double* %3
br label %18
18: ; preds = %16, %13
%19 = phi double [ %15, %13 ], [ %17, %16 ]
store double %19, double* %4
%20 = load double, double* %4
%21 = fcmp ogt double %20, 1.000000e+00
br i1 %21, label %22, label %25
22: ; preds = %18
%23 = load double, double* %4
%24 = fdiv double %23, 8.000000e+00
store double %24, double* %5
br label %28
25: ; preds = %18
%26 = load double, double* %4
%27 = fmul double %26, 8.000000e+00
store double %27, double* %5
br label %28
28: ; preds = %25, %22
br label %29
29: ; preds = %47, %28
%30 = load double, double* %5
%31 = load double, double* %4
%32 = load double, double* %5
%33 = load double, double* %5
%34 = fmul double %32, %33
%35 = fdiv double %31, %34
%36 = fsub double %30, %35
%37 = fdiv double %36, 3.000000e+00
store double %37, double* %6
%38 = load double, double* %6
%39 = load double, double* %5
%40 = fsub double %39, %38
store double %40, double* %5
%41 = load double, double* %6
%42 = fcmp olt double %41, 0.000000e+00
br i1 %42, label %43, label %46
43: ; preds = %29
%44 = load double, double* %6
%45 = fneg double %44
store double %45, double* %6
br label %46
46: ; preds = %43, %29
br label %47
47: ; preds = %46
%48 = load double, double* %6
%49 = load double, double* %5
%50 = fmul double %49, 0x3EB0C6F7A0B5ED8D
%51 = fcmp oge double %48, %50
br i1 %51, label %29, label %52
52: ; preds = %47
%53 = load double, double* %3
%54 = fcmp olt double %53, 0.000000e+00
br i1 %54, label %55, label %58
55: ; preds = %52
%56 = load double, double* %5
%57 = fneg double %56
store double %57, double* %5
br label %58
58: ; preds = %55, %52
%59 = load double, double* %5
store double %59, double* %2
br label %60
60: ; preds = %58, %9
%61 = load double, double* %2
ret double %61
}

LLVM IR (-O2):
define double @_XcmsCubeRoot(double %0) {
%2 = fcmp oeq double %0, 0.000000e+00
br i1 %2, label %25, label %3
3: ; preds = %1
%4 = fcmp olt double %0, 0.000000e+00
%5 = fneg double %0
%6 = select i1 %4, double %5, double %0
%7 = fcmp ogt double %6, 1.000000e+00
%8 = select i1 %7, double 1.250000e-01, double 8.000000e+00
%9 = fmul double %6, %8
br label %10
10: ; preds = %10, %3
%11 = phi double [ %9, %3 ], [ %16, %10 ]
%12 = fmul double %11, %11
%13 = fdiv double %6, %12
%14 = fsub double %11, %13
%15 = fdiv double %14, 3.000000e+00
%16 = fsub double %11, %15
%17 = fcmp olt double %15, 0.000000e+00
%18 = fneg double %15
%19 = select i1 %17, double %18, double %15
%20 = fmul double %16, 0x3EB0C6F7A0B5ED8D
%21 = fcmp ult double %19, %20
br i1 %21, label %22, label %10
22: ; preds = %10
%23 = fneg double %16
%24 = select i1 %4, double %23, double %16
br label %25
25: ; preds = %1, %22
%26 = phi double [ %24, %22 ], [ 0.000000e+00, %1 ]
ret double %26
}