#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 ilogbp1f(float);
float ldexpkf(float, int);
float mlaf(float, float, float);
float mulsignf(float, float);
float xfabsf(float);
float xcbrtf(float d) {
  float x, y, q = 1.0f;
  int e, r;
  e = ilogbp1f(d);
  d = ldexpkf(d, -e);
  r = (e + 6144) % 3;
  q = (r == 1) ? 1.2599210498948731647672106f : q;
  q = (r == 2) ? 1.5874010519681994747517056f : q;
  q = ldexpkf(q, (e + 6144) / 3 - 2048);
  q = mulsignf(q, d);
  d = xfabsf(d);
  x = -0.601564466953277587890625f;
  x = mlaf(x, d, 2.8208892345428466796875f);
  x = mlaf(x, d, -5.532182216644287109375f);
  x = mlaf(x, d, 5.898262500762939453125f);
  x = mlaf(x, d, -3.8095417022705078125f);
  x = mlaf(x, d, 2.2241256237030029296875f);
  y = d * x * x;
  y = (y - (2.0f / 3.0f) * y * (y * x - 1.0f)) * q;
  return y;
}


x86 assembly (clang, -O0):
<xcbrtf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  0xe9b(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <ilogbp1f@plt>
mov    %eax,-0x14(%rbp)
movss  -0x4(%rbp),%xmm0
xor    %edi,%edi
sub    -0x14(%rbp),%edi
call   1070 <ldexpkf@plt>
movss  %xmm0,-0x4(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1800,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %edx,-0x18(%rbp)
cmpl   $0x1,-0x18(%rbp)
jne    11ba <xcbrtf+0x6a>
movss  0xe54(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
jmp    11c4 <xcbrtf+0x74>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
cmpl   $0x2,-0x18(%rbp)
jne    11ea <xcbrtf+0x9a>
movss  0xe28(%rip),%xmm0
movss  %xmm0,-0x20(%rbp)
jmp    11f4 <xcbrtf+0xa4>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
mov    -0x14(%rbp),%eax
add    $0x1800,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
sub    $0x800,%edi
call   1070 <ldexpkf@plt>
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
movss  -0x4(%rbp),%xmm1
call   1060 <mulsignf@plt>
movss  %xmm0,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
call   1050 <xfabsf@plt>
movss  %xmm0,-0x4(%rbp)
movss  0xdd8(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0x4(%rbp),%xmm1
movss  0xdbd(%rip),%xmm2
call   1040 <mlaf@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0x4(%rbp),%xmm1
movss  0xd9d(%rip),%xmm2
call   1040 <mlaf@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0x4(%rbp),%xmm1
movss  0xd7d(%rip),%xmm2
call   1040 <mlaf@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0x4(%rbp),%xmm1
movss  0xd5d(%rip),%xmm2
call   1040 <mlaf@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0x4(%rbp),%xmm1
movss  0xd3d(%rip),%xmm2
call   1040 <mlaf@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm1
movss  0xd0e(%rip),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
movss  -0x8(%rbp),%xmm3
mulss  %xmm3,%xmm2
movss  0xcef(%rip),%xmm3
addss  %xmm3,%xmm2
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mulss  -0x10(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xcbrtf>:
push   %rbx
sub    $0x10,%rsp
movss  %xmm0,0x8(%rsp)
call   1030 <ilogbp1f@plt>
mov    %eax,%ebx
mov    %eax,%edi
neg    %edi
movss  0x8(%rsp),%xmm0
call   1070 <ldexpkf@plt>
movss  %xmm0,0x8(%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     11c0 <xcbrtf+0x70>
mov    %bl,%dl
lea    0xe47(%rip),%rsi
movss  (%rsi,%rdx,4),%xmm0
jmp    11c8 <xcbrtf+0x78>
movss  0xe40(%rip),%xmm0
lea    (%rax,%rcx,1),%edi
add    $0xfffff800,%edi
call   1070 <ldexpkf@plt>
movss  0x8(%rsp),%xmm1
call   1060 <mulsignf@plt>
movss  %xmm0,0xc(%rsp)
movss  0x8(%rsp),%xmm0
call   1050 <xfabsf@plt>
movaps %xmm0,%xmm1
movss  %xmm0,0x8(%rsp)
movss  0xe09(%rip),%xmm0
movss  0xe05(%rip),%xmm2
call   1040 <mlaf@plt>
movss  0xdfc(%rip),%xmm2
movss  0x8(%rsp),%xmm1
call   1040 <mlaf@plt>
movss  0xded(%rip),%xmm2
movss  0x8(%rsp),%xmm1
call   1040 <mlaf@plt>
movss  0xdde(%rip),%xmm2
movss  0x8(%rsp),%xmm1
call   1040 <mlaf@plt>
movss  0xdcf(%rip),%xmm2
movss  0x8(%rsp),%xmm1
call   1040 <mlaf@plt>
movss  0x8(%rsp),%xmm2
mulss  %xmm0,%xmm2
mulss  %xmm0,%xmm2
mulss  %xmm2,%xmm0
addss  0xdae(%rip),%xmm0
movss  0xdaa(%rip),%xmm1
mulss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
addss  %xmm2,%xmm0
mulss  0xc(%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define float @xcbrtf(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca i32
%7 = alloca i32
store float %0, float* %2
store float 1.000000e+00, float* %5
%8 = load float, float* %2
%9 = call i32 @ilogbp1f(float %8)
store i32 %9, i32* %6
%10 = load float, float* %2
%11 = load i32, i32* %6
%12 = sub nsw i32 0, %11
%13 = call float @ldexpkf(float %10, i32 %12)
store float %13, float* %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 float, float* %5
br label %22
22: ; preds = %20, %19
%23 = phi float [ 0x3FF428A300000000, %19 ], [ %21, %20 ]
store float %23, float* %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 float, float* %5
br label %29
29: ; preds = %27, %26
%30 = phi float [ 0x3FF965FEA0000000, %26 ], [ %28, %27 ]
store float %30, float* %5
%31 = load float, float* %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 float @ldexpkf(float %31, i32 %35)
store float %36, float* %5
%37 = load float, float* %5
%38 = load float, float* %2
%39 = call float @mulsignf(float %37, float %38)
store float %39, float* %5
%40 = load float, float* %2
%41 = call float @xfabsf(float %40)
store float %41, float* %2
store float 0xBFE3400420000000, float* %3
%42 = load float, float* %3
%43 = load float, float* %2
%44 = call float @mlaf(float %42, float %43, float 0x4006912E60000000)
store float %44, float* %3
%45 = load float, float* %3
%46 = load float, float* %2
%47 = call float @mlaf(float %45, float %46, float 0xC01620F460000000)
store float %47, float* %3
%48 = load float, float* %3
%49 = load float, float* %2
%50 = call float @mlaf(float %48, float %49, float 0x401797D220000000)
store float %50, float* %3
%51 = load float, float* %3
%52 = load float, float* %2
%53 = call float @mlaf(float %51, float %52, float 0xC00E79F100000000)
store float %53, float* %3
%54 = load float, float* %3
%55 = load float, float* %2
%56 = call float @mlaf(float %54, float %55, float 0x4001CB0260000000)
store float %56, float* %3
%57 = load float, float* %2
%58 = load float, float* %3
%59 = fmul float %57, %58
%60 = load float, float* %3
%61 = fmul float %59, %60
store float %61, float* %4
%62 = load float, float* %4
%63 = load float, float* %4
%64 = fmul float 0x3FE5555560000000, %63
%65 = load float, float* %4
%66 = load float, float* %3
%67 = call float @llvm.fmuladd.f32(float %65, float %66, float -1.000000e+00)
%68 = fneg float %64
%69 = call float @llvm.fmuladd.f32(float %68, float %67, float %62)
%70 = load float, float* %5
%71 = fmul float %69, %70
store float %71, float* %4
%72 = load float, float* %4
ret float %72
}

LLVM IR (-O2):
define float @xcbrtf(float %0) {
%2 = tail call i32 @ilogbp1f(float %0)
%3 = sub nsw i32 0, %2
%4 = tail call float @ldexpkf(float %0, i32 %3)
%5 = add nsw i32 %2, 6144
%6 = srem i32 %5, 3
%7 = icmp eq i32 %6, 1
%8 = select i1 %7, float 0x3FF428A300000000, float 1.000000e+00
%9 = icmp eq i32 %6, 2
%10 = select i1 %9, float 0x3FF965FEA0000000, float %8
%11 = sdiv i32 %5, 3
%12 = add nsw i32 %11, -2048
%13 = tail call float @ldexpkf(float %10, i32 %12)
%14 = tail call float @mulsignf(float %13, float %4)
%15 = tail call float @xfabsf(float %4)
%16 = tail call float @mlaf(float 0xBFE3400420000000, float %15, float 0x4006912E60000000)
%17 = tail call float @mlaf(float %16, float %15, float 0xC01620F460000000)
%18 = tail call float @mlaf(float %17, float %15, float 0x401797D220000000)
%19 = tail call float @mlaf(float %18, float %15, float 0xC00E79F100000000)
%20 = tail call float @mlaf(float %19, float %15, float 0x4001CB0260000000)
%21 = fmul float %15, %20
%22 = fmul float %20, %21
%23 = tail call float @llvm.fmuladd.f32(float %22, float %20, float -1.000000e+00)
%24 = fmul float %22, 0xBFE5555560000000
%25 = tail call float @llvm.fmuladd.f32(float %24, float %23, float %22)
%26 = fmul float %14, %25
ret float %26
}