static int quantize_coefs(double *coef, int *idx, float *lpc, int order)

{

    int i;

    uint8_t u_coef;

    const float *quant_arr = tns_tmp2_map[TNS_Q_BITS == 4];

    const double iqfac_p = ((1 << (TNS_Q_BITS-1)) - 0.5)/(M_PI/2.0);

    const double iqfac_m = ((1 << (TNS_Q_BITS-1)) + 0.5)/(M_PI/2.0);

    for (i = 0; i < order; i++) {

        idx[i] = ceilf(asin(coef[i])*((coef[i] >= 0) ? iqfac_p : iqfac_m));

        u_coef = (idx[i])&(~(~0<<TNS_Q_BITS));

        lpc[i] = quant_arr[u_coef];

    }

    return order;

}

static int quantize_coefs(double *coef, int *idx, float *lpc, int order)

{

    int i;

    uint8_t u_coef;

    const float *quant_arr = tns_tmp2_map[TNS_Q_BITS == 4];

    const double iqfac_p = ((1 << (TNS_Q_BITS-1)) - 0.5)/(M_PI/2.0);

    const double iqfac_m = ((1 << (TNS_Q_BITS-1)) + 0.5)/(M_PI/2.0);

    for (i = 0; i < order; i++) {

        idx[i] = ceilf(asin(coef[i])*((coef[i] >= 0) ? iqfac_p : iqfac_m));

        u_coef = (idx[i])&(~(~0<<TNS_Q_BITS));

        lpc[i] = quant_arr[u_coef];

    }

    return order;

}

static int FUNC_0(double *VAR_0, int *VAR_1, float *VAR_2, int VAR_3)

{

    int VAR_4;

    uint8_t u_coef;

    const float *VAR_5 = tns_tmp2_map[TNS_Q_BITS == 4];

    const double VAR_6 = ((1 << (TNS_Q_BITS-1)) - 0.5)/(M_PI/2.0);

    const double VAR_7 = ((1 << (TNS_Q_BITS-1)) + 0.5)/(M_PI/2.0);

    for (VAR_4 = 0; VAR_4 < VAR_3; VAR_4++) {

        VAR_1[VAR_4] = ceilf(asin(VAR_0[VAR_4])*((VAR_0[VAR_4] >= 0) ? VAR_6 : VAR_7));

        u_coef = (VAR_1[VAR_4])&(~(~0<<TNS_Q_BITS));

        VAR_2[VAR_4] = VAR_5[u_coef];

    }

    return VAR_3;

}

static int FUNC_0(double *VAR_0, int *VAR_1, float *VAR_2, int VAR_3)
{ int VAR_4; uint8_t u_coef; const float *VAR_5 = tns_tmp2_map[TNS_Q_BITS == 4]; const double VAR_6 = ((1 << (TNS_Q_BITS-1)) - 0.5)/(M_PI/2.0); const double VAR_7 = ((1 << (TNS_Q_BITS-1)) + 0.5)/(M_PI/2.0); for (VAR_4 = 0; VAR_4 < VAR_3; VAR_4++) { VAR_1[VAR_4] = ceilf(asin(VAR_0[VAR_4])*((VAR_0[VAR_4] >= 0) ? VAR_6 : VAR_7)); u_coef = (VAR_1[VAR_4])&(~(~0<<TNS_Q_BITS)); VAR_2[VAR_4] = VAR_5[u_coef]; } return VAR_3; }