#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 */
int ilogbp1(double);
double ldexpk(double, int);
double mulsign(double, double);
double xfabs(double);
double xcbrt(double d) {
  double x, y, q = 1.0;
  int e, r;
  e = ilogbp1(d);
  d = ldexpk(d, -e);
  r = (e + 6144) % 3;
  q = (r == 1) ? 1.2599210498948731647672106 : q;
  q = (r == 2) ? 1.5874010519681994747517056 : q;
  q = ldexpk(q, (e + 6144) / 3 - 2048);
  q = mulsign(q, d);
  d = xfabs(d);
  x = -0.640245898480692909870982;
  x = x * d + 2.96155103020039511818595;
  x = x * d + -5.73353060922947843636166;
  x = x * d + 6.03990368989458747961407;
  x = x * d + -3.85841935510444988821632;
  x = x * d + 2.2307275302496609725722;
  y = x * x;
  y = y * y;
  x -= (d * y - x) * (1.0 / 3.0);
  y = d * x * x;
  y = (y - (2.0 / 3.0) * y * (y * x - 1)) * q;
  return y;
}


x86 assembly (clang, -O0):
<xcbrt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeab(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1050 <ilogbp1@plt>
mov    %eax,-0x24(%rbp)
movsd  -0x8(%rbp),%xmm0
xor    %edi,%edi
sub    -0x24(%rbp),%edi
call   1040 <ldexpk@plt>
movsd  %xmm0,-0x8(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1800,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %edx,-0x28(%rbp)
cmpl   $0x1,-0x28(%rbp)
jne    11aa <xcbrt+0x6a>
movsd  0xe68(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    11b4 <xcbrt+0x74>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
cmpl   $0x2,-0x28(%rbp)
jne    11da <xcbrt+0x9a>
movsd  0xe40(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    11e4 <xcbrt+0xa4>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    -0x24(%rbp),%eax
add    $0x1800,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
sub    $0x800,%edi
call   1040 <ldexpk@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
call   1030 <mulsign@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1060 <xfabs@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  0xe18(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdf5(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdce(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xda7(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd80(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd59(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x10(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xcd8(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm1
movsd  0xca2(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm3
mulsd  %xmm3,%xmm2
movsd  0xc7f(%rip),%xmm3
addsd  %xmm3,%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xcbrt>:
push   %rbx
sub    $0x10,%rsp
movsd  %xmm0,(%rsp)
call   1050 <ilogbp1@plt>
mov    %eax,%ebx
mov    %eax,%edi
neg    %edi
movsd  (%rsp),%xmm0
call   1040 <ldexpk@plt>
movsd  %xmm0,(%rsp)
mov    %ebx,%eax
add    $0x1800,%eax
cltq
imul   $0x55555556,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
lea    (%rax,%rcx,1),%edx
lea    (%rdx,%rdx,2),%edx
neg    %edx
lea    (%rbx,%rdx,1),%esi
add    $0x1800,%esi
xor    %edx,%edx
cmp    $0x1,%esi
sete   %bl
cmp    $0x2,%esi
je     11ad <xcbrt+0x6d>
mov    %bl,%dl
lea    0xe5a(%rip),%rsi
movsd  (%rsi,%rdx,8),%xmm0
jmp    11b5 <xcbrt+0x75>
movsd  0xe5b(%rip),%xmm0
lea    (%rax,%rcx,1),%edi
add    $0xfffff800,%edi
call   1040 <ldexpk@plt>
movsd  (%rsp),%xmm1
call   1030 <mulsign@plt>
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
call   1060 <xfabs@plt>
movsd  0xe33(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xe2f(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xe2b(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xe27(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xe23(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xe1f(%rip),%xmm1
movapd %xmm1,%xmm2
mulsd  %xmm1,%xmm2
mulsd  %xmm2,%xmm2
mulsd  %xmm0,%xmm2
subsd  %xmm1,%xmm2
mulsd  0xe0b(%rip),%xmm2
addsd  %xmm1,%xmm2
mulsd  %xmm2,%xmm0
mulsd  %xmm2,%xmm0
mulsd  %xmm0,%xmm2
addsd  0xdfb(%rip),%xmm2
movsd  0xdfb(%rip),%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
mulsd  0x8(%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @xcbrt(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca i32
%7 = alloca i32
store double %0, double* %2
store double 1.000000e+00, double* %5
%8 = load double, double* %2
%9 = call i32 @ilogbp1(double %8)
store i32 %9, i32* %6
%10 = load double, double* %2
%11 = load i32, i32* %6
%12 = sub nsw i32 0, %11
%13 = call double @ldexpk(double %10, i32 %12)
store double %13, double* %2
%14 = load i32, i32* %6
%15 = add nsw i32 %14, 6144
%16 = srem i32 %15, 3
store i32 %16, i32* %7
%17 = load i32, i32* %7
%18 = icmp eq i32 %17, 1
br i1 %18, label %19, label %20
19: ; preds = %1
br label %22
20: ; preds = %1
%21 = load double, double* %5
br label %22
22: ; preds = %20, %19
%23 = phi double [ 0x3FF428A2F98D728B, %19 ], [ %21, %20 ]
store double %23, double* %5
%24 = load i32, i32* %7
%25 = icmp eq i32 %24, 2
br i1 %25, label %26, label %27
26: ; preds = %22
br label %29
27: ; preds = %22
%28 = load double, double* %5
br label %29
29: ; preds = %27, %26
%30 = phi double [ 0x3FF965FEA53D6E3D, %26 ], [ %28, %27 ]
store double %30, double* %5
%31 = load double, double* %5
%32 = load i32, i32* %6
%33 = add nsw i32 %32, 6144
%34 = sdiv i32 %33, 3
%35 = sub nsw i32 %34, 2048
%36 = call double @ldexpk(double %31, i32 %35)
store double %36, double* %5
%37 = load double, double* %5
%38 = load double, double* %2
%39 = call double @mulsign(double %37, double %38)
store double %39, double* %5
%40 = load double, double* %2
%41 = call double @xfabs(double %40)
store double %41, double* %2
store double 0xBFE47CE4F76BED42, double* %3
%42 = load double, double* %3
%43 = load double, double* %2
%44 = call double @llvm.fmuladd.f64(double %42, double %43, double 0x4007B141AAA12A9C)
store double %44, double* %3
%45 = load double, double* %3
%46 = load double, double* %2
%47 = call double @llvm.fmuladd.f64(double %45, double %46, double 0xC016EF22A5E505B3)
store double %47, double* %3
%48 = load double, double* %3
%49 = load double, double* %2
%50 = call double @llvm.fmuladd.f64(double %48, double %49, double 0x401828DC834C5911)
store double %50, double* %3
%51 = load double, double* %3
%52 = load double, double* %2
%53 = call double @llvm.fmuladd.f64(double %51, double %52, double 0xC00EDE0AF7836A8B)
store double %53, double* %3
%54 = load double, double* %3
%55 = load double, double* %2
%56 = call double @llvm.fmuladd.f64(double %54, double %55, double 0x4001D887ACE5AC54)
store double %56, double* %3
%57 = load double, double* %3
%58 = load double, double* %3
%59 = fmul double %57, %58
store double %59, double* %4
%60 = load double, double* %4
%61 = load double, double* %4
%62 = fmul double %60, %61
store double %62, double* %4
%63 = load double, double* %2
%64 = load double, double* %4
%65 = load double, double* %3
%66 = fneg double %65
%67 = call double @llvm.fmuladd.f64(double %63, double %64, double %66)
%68 = load double, double* %3
%69 = fneg double %67
%70 = call double @llvm.fmuladd.f64(double %69, double 0x3FD5555555555555, double %68)
store double %70, double* %3
%71 = load double, double* %2
%72 = load double, double* %3
%73 = fmul double %71, %72
%74 = load double, double* %3
%75 = fmul double %73, %74
store double %75, double* %4
%76 = load double, double* %4
%77 = load double, double* %4
%78 = fmul double 0x3FE5555555555555, %77
%79 = load double, double* %4
%80 = load double, double* %3
%81 = call double @llvm.fmuladd.f64(double %79, double %80, double -1.000000e+00)
%82 = fneg double %78
%83 = call double @llvm.fmuladd.f64(double %82, double %81, double %76)
%84 = load double, double* %5
%85 = fmul double %83, %84
store double %85, double* %4
%86 = load double, double* %4
ret double %86
}

LLVM IR (-O2):
define double @xcbrt(double %0) {
%2 = tail call i32 @ilogbp1(double %0)
%3 = sub nsw i32 0, %2
%4 = tail call double @ldexpk(double %0, i32 %3)
%5 = add nsw i32 %2, 6144
%6 = srem i32 %5, 3
%7 = icmp eq i32 %6, 1
%8 = select i1 %7, double 0x3FF428A2F98D728B, double 1.000000e+00
%9 = icmp eq i32 %6, 2
%10 = select i1 %9, double 0x3FF965FEA53D6E3D, double %8
%11 = sdiv i32 %5, 3
%12 = add nsw i32 %11, -2048
%13 = tail call double @ldexpk(double %10, i32 %12)
%14 = tail call double @mulsign(double %13, double %4)
%15 = tail call double @xfabs(double %4)
%16 = tail call double @llvm.fmuladd.f64(double %15, double 0xBFE47CE4F76BED42, double 0x4007B141AAA12A9C)
%17 = tail call double @llvm.fmuladd.f64(double %16, double %15, double 0xC016EF22A5E505B3)
%18 = tail call double @llvm.fmuladd.f64(double %17, double %15, double 0x401828DC834C5911)
%19 = tail call double @llvm.fmuladd.f64(double %18, double %15, double 0xC00EDE0AF7836A8B)
%20 = tail call double @llvm.fmuladd.f64(double %19, double %15, double 0x4001D887ACE5AC54)
%21 = fmul double %20, %20
%22 = fmul double %21, %21
%23 = fneg double %20
%24 = tail call double @llvm.fmuladd.f64(double %15, double %22, double %23)
%25 = fneg double %24
%26 = tail call double @llvm.fmuladd.f64(double %25, double 0x3FD5555555555555, double %20)
%27 = fmul double %15, %26
%28 = fmul double %26, %27
%29 = tail call double @llvm.fmuladd.f64(double %28, double %26, double -1.000000e+00)
%30 = fmul double %28, 0xBFE5555555555555
%31 = tail call double @llvm.fmuladd.f64(double %30, double %29, double %28)
%32 = fmul double %14, %31
ret double %32
}