#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 */
float fabsfk(float);
int ilogbkf(float);
float ldexp2kf(float, int);
float mlaf(float, float, float);
float mulsignf(float, float);
__attribute__((visibility("default"))) const float xcbrtf(float d) {
  float x, y, q = 1.0f;
  int e, r;
  e = ilogbkf(fabsfk(d)) + 1;
  d = ldexp2kf(d, -e);
  r = (e + 6144) % 3;
  q = (r == 1) ? 1.2599210498948731647672106f : q;
  q = (r == 2) ? 1.5874010519681994747517056f : q;
  q = ldexp2kf(q, (e + 6144) / 3 - 2048);
  q = mulsignf(q, d);
  d = fabsfk(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   1060 <fabsfk@plt>
call   1070 <ilogbkf@plt>
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
movss  -0x4(%rbp),%xmm0
xor    %edi,%edi
sub    -0x14(%rbp),%edi
call   1030 <ldexp2kf@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    11c2 <xcbrtf+0x72>
movss  0xe4c(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
jmp    11cc <xcbrtf+0x7c>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
cmpl   $0x2,-0x18(%rbp)
jne    11f2 <xcbrtf+0xa2>
movss  0xe20(%rip),%xmm0
movss  %xmm0,-0x20(%rbp)
jmp    11fc <xcbrtf+0xac>
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   1030 <ldexp2kf@plt>
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
movss  -0x4(%rbp),%xmm1
call   1050 <mulsignf@plt>
movss  %xmm0,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
call   1060 <fabsfk@plt>
movss  %xmm0,-0x4(%rbp)
movss  0xdd0(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0x4(%rbp),%xmm1
movss  0xdb5(%rip),%xmm2
call   1040 <mlaf@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0x4(%rbp),%xmm1
movss  0xd95(%rip),%xmm2
call   1040 <mlaf@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0x4(%rbp),%xmm1
movss  0xd75(%rip),%xmm2
call   1040 <mlaf@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0x4(%rbp),%xmm1
movss  0xd55(%rip),%xmm2
call   1040 <mlaf@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0x4(%rbp),%xmm1
movss  0xd35(%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  0xd06(%rip),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
movss  -0x8(%rbp),%xmm3
mulss  %xmm3,%xmm2
movss  0xce7(%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   1060 <fabsfk@plt>
call   1070 <ilogbkf@plt>
mov    %eax,%ebx
mov    %eax,%edi
not    %edi
movss  0x8(%rsp),%xmm0
call   1030 <ldexp2kf@plt>
movss  %xmm0,0x8(%rsp)
mov    %ebx,%eax
add    $0x1801,%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    $0x1801,%esi
xor    %edx,%edx
cmp    $0x1,%esi
sete   %bl
cmp    $0x2,%esi
je     11c5 <xcbrtf+0x75>
mov    %bl,%dl
lea    0xe42(%rip),%rsi
movss  (%rsi,%rdx,4),%xmm0
jmp    11cd <xcbrtf+0x7d>
movss  0xe3b(%rip),%xmm0
lea    (%rax,%rcx,1),%edi
add    $0xfffff800,%edi
call   1030 <ldexp2kf@plt>
movss  0x8(%rsp),%xmm1
call   1050 <mulsignf@plt>
movss  %xmm0,0xc(%rsp)
movss  0x8(%rsp),%xmm0
call   1060 <fabsfk@plt>
movaps %xmm0,%xmm1
movss  %xmm0,0x8(%rsp)
movss  0xe04(%rip),%xmm0
movss  0xe00(%rip),%xmm2
call   1040 <mlaf@plt>
movss  0xdf7(%rip),%xmm2
movss  0x8(%rsp),%xmm1
call   1040 <mlaf@plt>
movss  0xde8(%rip),%xmm2
movss  0x8(%rsp),%xmm1
call   1040 <mlaf@plt>
movss  0xdd9(%rip),%xmm2
movss  0x8(%rsp),%xmm1
call   1040 <mlaf@plt>
movss  0xdca(%rip),%xmm2
movss  0x8(%rsp),%xmm1
call   1040 <mlaf@plt>
movss  0x8(%rsp),%xmm2
mulss  %xmm0,%xmm2
mulss  %xmm0,%xmm2
mulss  %xmm2,%xmm0
addss  0xda9(%rip),%xmm0
movss  0xda5(%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 float @fabsfk(float %8)
%10 = call i32 @ilogbkf(float %9)
%11 = add nsw i32 %10, 1
store i32 %11, i32* %6
%12 = load float, float* %2
%13 = load i32, i32* %6
%14 = sub nsw i32 0, %13
%15 = call float @ldexp2kf(float %12, i32 %14)
store float %15, float* %2
%16 = load i32, i32* %6
%17 = add nsw i32 %16, 6144
%18 = srem i32 %17, 3
store i32 %18, i32* %7
%19 = load i32, i32* %7
%20 = icmp eq i32 %19, 1
br i1 %20, label %21, label %22
21: ; preds = %1
br label %24
22: ; preds = %1
%23 = load float, float* %5
br label %24
24: ; preds = %22, %21
%25 = phi float [ 0x3FF428A300000000, %21 ], [ %23, %22 ]
store float %25, float* %5
%26 = load i32, i32* %7
%27 = icmp eq i32 %26, 2
br i1 %27, label %28, label %29
28: ; preds = %24
br label %31
29: ; preds = %24
%30 = load float, float* %5
br label %31
31: ; preds = %29, %28
%32 = phi float [ 0x3FF965FEA0000000, %28 ], [ %30, %29 ]
store float %32, float* %5
%33 = load float, float* %5
%34 = load i32, i32* %6
%35 = add nsw i32 %34, 6144
%36 = sdiv i32 %35, 3
%37 = sub nsw i32 %36, 2048
%38 = call float @ldexp2kf(float %33, i32 %37)
store float %38, float* %5
%39 = load float, float* %5
%40 = load float, float* %2
%41 = call float @mulsignf(float %39, float %40)
store float %41, float* %5
%42 = load float, float* %2
%43 = call float @fabsfk(float %42)
store float %43, float* %2
store float 0xBFE3400420000000, float* %3
%44 = load float, float* %3
%45 = load float, float* %2
%46 = call float @mlaf(float %44, float %45, float 0x4006912E60000000)
store float %46, float* %3
%47 = load float, float* %3
%48 = load float, float* %2
%49 = call float @mlaf(float %47, float %48, float 0xC01620F460000000)
store float %49, float* %3
%50 = load float, float* %3
%51 = load float, float* %2
%52 = call float @mlaf(float %50, float %51, float 0x401797D220000000)
store float %52, float* %3
%53 = load float, float* %3
%54 = load float, float* %2
%55 = call float @mlaf(float %53, float %54, float 0xC00E79F100000000)
store float %55, float* %3
%56 = load float, float* %3
%57 = load float, float* %2
%58 = call float @mlaf(float %56, float %57, float 0x4001CB0260000000)
store float %58, float* %3
%59 = load float, float* %2
%60 = load float, float* %3
%61 = fmul float %59, %60
%62 = load float, float* %3
%63 = fmul float %61, %62
store float %63, float* %4
%64 = load float, float* %4
%65 = load float, float* %4
%66 = fmul float 0x3FE5555560000000, %65
%67 = load float, float* %4
%68 = load float, float* %3
%69 = call float @llvm.fmuladd.f32(float %67, float %68, float -1.000000e+00)
%70 = fneg float %66
%71 = call float @llvm.fmuladd.f32(float %70, float %69, float %64)
%72 = load float, float* %5
%73 = fmul float %71, %72
store float %73, float* %4
%74 = load float, float* %4
ret float %74
}

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