/**
 * generated using metalibm 1.1
 * sha1 git: b'"44931432e12dbbda32ae5520e55557ff367a96bb"'(clean)
 * 
 * INFO: git status was clean when file was generated.
 * 
 * command used for generation:
 *   metalibm_functions/ml_cbrt.py --precision binary64 --target x86_sse2 \
 *     --output /root/s_cbrt_sse2.c
 * 
**/
#include <stdint.h>
#include <math.h>
#include <ml_support_lib.h>
#include <emmintrin.h>
#include <xmmintrin.h>


static const __m128i my_cbrt_cst = {INT32_C(0)}/*sse*/;
static const __m128i my_cbrt_cst1 = {INT32_C(0)}/*sse*/;
static const __m128d my_cbrt_cst2 = {1.0}/*sse*/;
static const __m128d my_cbrt_cst3 = {1.0}/*sse*/;
static const __m128d my_cbrt_cst4 = {0.3333333333333333}/*sse*/;
static const __m128d my_cbrt_cst5 = {1.0}/*sse*/;
static const __m128d my_cbrt_cst6 = {0.3333333333333333}/*sse*/;
static const __m128d my_cbrt_cst7 = {1.0}/*sse*/;
static const __m128d my_cbrt_cst8 = {0.3333333333333333}/*sse*/;
static const __m128d my_cbrt_cst9 = {1.0}/*sse*/;
static const __m128d my_cbrt_cst10 = {0.3333333333333333}/*sse*/;
static const __m128d my_cbrt_cst11 = {1.0}/*sse*/;
static const __m128d my_cbrt_cst12 = {0.3333333333333333}/*sse*/;
static const __m128d my_cbrt_cst13 = {1.0}/*sse*/;
static const __m128d my_cbrt_cst14 = {0.3333333333333333}/*sse*/;
static const __m128d my_cbrt_cst15 = {1.0}/*sse*/;
static const __m128d my_cbrt_cst16 = {0.3333333333333333}/*sse*/;
static const __m128d my_cbrt_cst17 = {1.0}/*sse*/;
static const __m128d my_cbrt_cst18 = {0.3333333333333333}/*sse*/;
static const double my_cbrt_cbrt_mod_table[6][1]  = {
    { 0x1p-1},
    { 0x1.428a2f98d728bp-1},
    { 0x1.965fea53d6e3dp-1},
    { 0x1p0},
    { 0x1.428a2f98d728bp0},
    { 0x1.965fea53d6e3dp0}
};
static const double my_cbrt_cbrt_approx_table[64][1]  = {
    { 0x1p0},
    { 0x1.01539221d4c97p0},
    { 0x1.02a3ad2ef6f48p0},
    { 0x1.03f06771a2e33p0},
    { 0x1.0539d6521256fp0},
    { 0x1.06800e629d672p0},
    { 0x1.07c3236b0a73ap0},
    { 0x1.090328731deb2p0},
    { 0x1.0a402fcc79298p0},
    { 0x1.0b7a4b1bd64acp0},
    { 0x1.0cb18b61ad8cfp0},
    { 0x1.0de601024fb88p0},
    { 0x1.0f17bbcd80046p0},
    { 0x1.1046cb0597001p0},
    { 0x1.11733d66373bdp0},
    { 0x1.129d212a9ba9cp0},
    { 0x1.13c484138704fp0},
    { 0x1.14e9736cdaf39p0},
    { 0x1.160bfc12dd091p0},
    { 0x1.172c2a772f508p0},
    { 0x1.184a0aa58191fp0},
    { 0x1.1965a848001d3p0},
    { 0x1.1a7f0eab8483dp0},
    { 0x1.1b9648c38c55dp0},
    { 0x1.1cab612df9a46p0},
    { 0x1.1dbe6236a0c45p0},
    { 0x1.1ecf55daa68a5p0},
    { 0x1.1fde45cbb1f9fp0},
    { 0x1.20eb3b72f42d5p0},
    { 0x1.21f63ff409043p0},
    { 0x1.22ff5c2fb2fdp0},
    { 0x1.240698c6746e5p0},
    { 0x1.250bfe1b082f5p0},
    { 0x1.260f9454bb99bp0},
    { 0x1.27116361abaeap0},
    { 0x1.281172f8e7074p0},
    { 0x1.290fca9c761f8p0},
    { 0x1.2a0c719b4b6d1p0},
    { 0x1.2b076f131c9d7p0},
    { 0x1.2c00c9f2263edp0},
    { 0x1.2cf888f8db02fp0},
    { 0x1.2deeb2bb7fb79p0},
    { 0x1.2ee34da3b4fe3p0},
    { 0x1.2fd65ff1efbbcp0},
    { 0x1.30c7efbee12adp0},
    { 0x1.31b802fccf6a2p0},
    { 0x1.32a69f78df567p0},
    { 0x1.3393cadc50709p0},
    { 0x1.347f8aadab855p0},
    { 0x1.3569e451e4c2bp0},
    { 0x1.3652dd0d71db1p0},
    { 0x1.373a7a0554cdfp0},
    { 0x1.3820c0401be52p0},
    { 0x1.3905b4a6d76cep0},
    { 0x1.39e95c0605a66p0},
    { 0x1.3acbbb0e756b7p0},
    { 0x1.3bacd6561ff5ep0},
    { 0x1.3c8cb258fa341p0},
    { 0x1.3d6b5379be10cp0},
    { 0x1.3e48be02ac0cfp0},
    { 0x1.3f24f62645865p0},
    { 0x1.4p0},
    { 0x1.40d9df94f1be1p0},
    { 0x1.41b298d47800ep0}
};

double my_cbrt(double);
double my_cbrt(double x){
    int64_t tmp;
    uint64_t _srl_cast;
    int64_t tmp1;
    int64_t tmp2;
    int64_t exp_vx;
    int64_t exp_vx_mod;
    int64_t tmp3;
    int32_t tmp4;
    double cbrt_mod;
    double tmp5;
    int64_t tmp6;
    uint64_t _srl_cast1;
    int64_t tmp7;
    int64_t table_index;
    int32_t tmp8;
    double seed;
    double init_mult;
    int64_t exp_vx_third;
    int64_t tmp9;
    int64_t tmp10;
    double exp_vx_third1;
    double init_approx;
    double tmp11;
    double tmp12;
    double tmp13;
    double tmp14;
    double tmp15;
    double carg;
    double tmp16;
    double tmp17;
    double tmp18;
    double approx_0;
    double tmp19;
    double tmp20;
    double tmp21;
    double carg1;
    double tmp22;
    double tmp23;
    double tmp24;
    double approx_1;
    double tmp25;
    double tmp26;
    double tmp27;
    double carg2;
    double tmp28;
    double tmp29;
    double tmp30;
    double approx_2;
    double tmp31;
    double tmp32;
    double tmp33;
    double carg3;
    double tmp34;
    double tmp35;
    double tmp36;
    double approx_3;
    double tmp37;
    double tmp38;
    double tmp39;
    double carg4;
    double tmp40;
    double tmp41;
    double tmp42;
    double approx_4;
    double tmp43;
    double tmp44;
    double tmp45;
    double carg5;
    double tmp46;
    double tmp47;
    double tmp48;
    double approx_5;
    double tmp49;
    double tmp50;
    double tmp51;
    double carg6;
    double tmp52;
    double tmp53;
    double tmp54;
    double approx_6;
    double tmp55;
    double tmp56;
    double tmp57;
    double carg7;
    double tmp58;
    double tmp59;
    double tmp60;
    double result;
    
    tmp = double_to_64b_encoding(x);
    _srl_cast = tmp;
    tmp1 = _srl_cast >> INT64_C(52);
    tmp2 = tmp1 & INT64_C(2047);
    exp_vx = tmp2 + INT64_C(-1023);
    exp_vx_mod = exp_vx % INT64_C(3);
    tmp3 = exp_vx_mod + INT64_C(3);
    tmp4 = _mm_cvtsi128_si32(my_cbrt_cst);
    cbrt_mod = my_cbrt_cbrt_mod_table[tmp3][tmp4];
    tmp5 = ml_mantissa_extraction_fp64(x);
    tmp6 = double_to_64b_encoding(tmp5);
    _srl_cast1 = tmp6;
    tmp7 = _srl_cast1 >> INT64_C(46);
    table_index = tmp7 & INT64_C(63);
    tmp8 = _mm_cvtsi128_si32(my_cbrt_cst1);
    seed = my_cbrt_cbrt_approx_table[table_index][tmp8];
    init_mult = seed * cbrt_mod;
    exp_vx_third = exp_vx / INT64_C(3);
    tmp9 = exp_vx_third + INT64_C(1023);
    tmp10 = tmp9 << INT64_C(52);
    exp_vx_third1 = double_from_64b_encoding(tmp10);
    init_approx = init_mult * exp_vx_third1;
    tmp11 = _mm_cvtsd_f64(my_cbrt_cst2);
    tmp12 = tmp11 / x;
    tmp13 = init_approx * init_approx;
    tmp14 = init_approx * tmp13;
    tmp15 = _mm_cvtsd_f64(my_cbrt_cst3);
    carg =  - tmp14;
    tmp16 = fma(carg, tmp12, tmp15);
    tmp17 = _mm_cvtsd_f64(my_cbrt_cst4);
    tmp18 = init_approx * tmp17;
    approx_0 = fma(tmp18, tmp16, init_approx);
    tmp19 = approx_0 * approx_0;
    tmp20 = approx_0 * tmp19;
    tmp21 = _mm_cvtsd_f64(my_cbrt_cst5);
    carg1 =  - tmp20;
    tmp22 = fma(carg1, tmp12, tmp21);
    tmp23 = _mm_cvtsd_f64(my_cbrt_cst6);
    tmp24 = approx_0 * tmp23;
    approx_1 = fma(tmp24, tmp22, approx_0);
    tmp25 = approx_1 * approx_1;
    tmp26 = approx_1 * tmp25;
    tmp27 = _mm_cvtsd_f64(my_cbrt_cst7);
    carg2 =  - tmp26;
    tmp28 = fma(carg2, tmp12, tmp27);
    tmp29 = _mm_cvtsd_f64(my_cbrt_cst8);
    tmp30 = approx_1 * tmp29;
    approx_2 = fma(tmp30, tmp28, approx_1);
    tmp31 = approx_2 * approx_2;
    tmp32 = approx_2 * tmp31;
    tmp33 = _mm_cvtsd_f64(my_cbrt_cst9);
    carg3 =  - tmp32;
    tmp34 = fma(carg3, tmp12, tmp33);
    tmp35 = _mm_cvtsd_f64(my_cbrt_cst10);
    tmp36 = approx_2 * tmp35;
    approx_3 = fma(tmp36, tmp34, approx_2);
    tmp37 = approx_3 * approx_3;
    tmp38 = approx_3 * tmp37;
    tmp39 = _mm_cvtsd_f64(my_cbrt_cst11);
    carg4 =  - tmp38;
    tmp40 = fma(carg4, tmp12, tmp39);
    tmp41 = _mm_cvtsd_f64(my_cbrt_cst12);
    tmp42 = approx_3 * tmp41;
    approx_4 = fma(tmp42, tmp40, approx_3);
    tmp43 = approx_4 * approx_4;
    tmp44 = approx_4 * tmp43;
    tmp45 = _mm_cvtsd_f64(my_cbrt_cst13);
    carg5 =  - tmp44;
    tmp46 = fma(carg5, tmp12, tmp45);
    tmp47 = _mm_cvtsd_f64(my_cbrt_cst14);
    tmp48 = approx_4 * tmp47;
    approx_5 = fma(tmp48, tmp46, approx_4);
    tmp49 = approx_5 * approx_5;
    tmp50 = approx_5 * tmp49;
    tmp51 = _mm_cvtsd_f64(my_cbrt_cst15);
    carg6 =  - tmp50;
    tmp52 = fma(carg6, tmp12, tmp51);
    tmp53 = _mm_cvtsd_f64(my_cbrt_cst16);
    tmp54 = approx_5 * tmp53;
    approx_6 = fma(tmp54, tmp52, approx_5);
    tmp55 = approx_6 * approx_6;
    tmp56 = approx_6 * tmp55;
    tmp57 = _mm_cvtsd_f64(my_cbrt_cst17);
    carg7 =  - tmp56;
    tmp58 = fma(carg7, tmp12, tmp57);
    tmp59 = _mm_cvtsd_f64(my_cbrt_cst18);
    tmp60 = approx_6 * tmp59;
    result = fma(tmp60, tmp58, approx_6);
    return result;
}
