static int decode_ics(AACContext * ac, SingleChannelElement * sce, GetBitContext * gb, int common_window, int scale_flag) {

    Pulse pulse;

    TemporalNoiseShaping * tns = &sce->tns;

    IndividualChannelStream * ics = &sce->ics;

    float * out = sce->coeffs;

    int global_gain, pulse_present = 0;



    /* This assignment is to silence a GCC warning about the variable being used

     * uninitialized when in fact it always is.

     */

    pulse.num_pulse = 0;



    global_gain = get_bits(gb, 8);



    if (!common_window && !scale_flag) {

        if (decode_ics_info(ac, ics, gb, 0) < 0)

            return -1;

    }



    if (decode_band_types(ac, sce->band_type, sce->band_type_run_end, gb, ics) < 0)

        return -1;

    if (decode_scalefactors(ac, sce->sf, gb, global_gain, ics, sce->band_type, sce->band_type_run_end) < 0)

        return -1;



    pulse_present = 0;

    if (!scale_flag) {

        if ((pulse_present = get_bits1(gb))) {

            if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) {

                av_log(ac->avccontext, AV_LOG_ERROR, "Pulse tool not allowed in eight short sequence.\n");

                return -1;

            }

            decode_pulses(&pulse, gb, ics->swb_offset);

        }

        if ((tns->present = get_bits1(gb)) && decode_tns(ac, tns, gb, ics))

            return -1;

        if (get_bits1(gb)) {

            av_log_missing_feature(ac->avccontext, "SSR", 1);

            return -1;

        }

    }



    if (decode_spectrum_and_dequant(ac, out, gb, sce->sf, pulse_present, &pulse, ics, sce->band_type) < 0)

        return -1;

    return 0;

}

static int decode_ics(AACContext * ac, SingleChannelElement * sce, GetBitContext * gb, int common_window, int scale_flag) {

    Pulse pulse;

    TemporalNoiseShaping * tns = &sce->tns;

    IndividualChannelStream * ics = &sce->ics;

    float * out = sce->coeffs;

    int global_gain, pulse_present = 0;



    





    pulse.num_pulse = 0;



    global_gain = get_bits(gb, 8);



    if (!common_window && !scale_flag) {

        if (decode_ics_info(ac, ics, gb, 0) < 0)

            return -1;

    }



    if (decode_band_types(ac, sce->band_type, sce->band_type_run_end, gb, ics) < 0)

        return -1;

    if (decode_scalefactors(ac, sce->sf, gb, global_gain, ics, sce->band_type, sce->band_type_run_end) < 0)

        return -1;



    pulse_present = 0;

    if (!scale_flag) {

        if ((pulse_present = get_bits1(gb))) {

            if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) {

                av_log(ac->avccontext, AV_LOG_ERROR, "Pulse tool not allowed in eight short sequence.\n");

                return -1;

            }

            decode_pulses(&pulse, gb, ics->swb_offset);

        }

        if ((tns->present = get_bits1(gb)) && decode_tns(ac, tns, gb, ics))

            return -1;

        if (get_bits1(gb)) {

            av_log_missing_feature(ac->avccontext, "SSR", 1);

            return -1;

        }

    }



    if (decode_spectrum_and_dequant(ac, out, gb, sce->sf, pulse_present, &pulse, ics, sce->band_type) < 0)

        return -1;

    return 0;

}

static int FUNC_0(AACContext * VAR_0, SingleChannelElement * VAR_1, GetBitContext * VAR_2, int VAR_3, int VAR_4) {

    Pulse pulse;

    TemporalNoiseShaping * tns = &VAR_1->tns;

    IndividualChannelStream * ics = &VAR_1->ics;

    float * VAR_5 = VAR_1->coeffs;

    int VAR_6, VAR_7 = 0;



    





    pulse.num_pulse = 0;



    VAR_6 = get_bits(VAR_2, 8);



    if (!VAR_3 && !VAR_4) {

        if (decode_ics_info(VAR_0, ics, VAR_2, 0) < 0)

            return -1;

    }



    if (decode_band_types(VAR_0, VAR_1->band_type, VAR_1->band_type_run_end, VAR_2, ics) < 0)

        return -1;

    if (decode_scalefactors(VAR_0, VAR_1->sf, VAR_2, VAR_6, ics, VAR_1->band_type, VAR_1->band_type_run_end) < 0)

        return -1;



    VAR_7 = 0;

    if (!VAR_4) {

        if ((VAR_7 = get_bits1(VAR_2))) {

            if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) {

                av_log(VAR_0->avccontext, AV_LOG_ERROR, "Pulse tool not allowed in eight short sequence.\n");

                return -1;

            }

            decode_pulses(&pulse, VAR_2, ics->swb_offset);

        }

        if ((tns->present = get_bits1(VAR_2)) && decode_tns(VAR_0, tns, VAR_2, ics))

            return -1;

        if (get_bits1(VAR_2)) {

            av_log_missing_feature(VAR_0->avccontext, "SSR", 1);

            return -1;

        }

    }



    if (decode_spectrum_and_dequant(VAR_0, VAR_5, VAR_2, VAR_1->sf, VAR_7, &pulse, ics, VAR_1->band_type) < 0)

        return -1;

    return 0;

}

static int FUNC_0(AACContext * VAR_0, SingleChannelElement * VAR_1, GetBitContext * VAR_2, int VAR_3, int VAR_4) { Pulse pulse; TemporalNoiseShaping * tns = &VAR_1->tns; IndividualChannelStream * ics = &VAR_1->ics; float * VAR_5 = VAR_1->coeffs; int VAR_6, VAR_7 = 0; pulse.num_pulse = 0; VAR_6 = get_bits(VAR_2, 8); if (!VAR_3 && !VAR_4) { if (decode_ics_info(VAR_0, ics, VAR_2, 0) < 0)
return -1; } if (decode_band_types(VAR_0, VAR_1->band_type, VAR_1->band_type_run_end, VAR_2, ics) < 0)
return -1; if (decode_scalefactors(VAR_0, VAR_1->sf, VAR_2, VAR_6, ics, VAR_1->band_type, VAR_1->band_type_run_end) < 0)
return -1; VAR_7 = 0; if (!VAR_4) { if ((VAR_7 = get_bits1(VAR_2))) { if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) { av_log(VAR_0->avccontext, AV_LOG_ERROR, "Pulse tool not allowed in eight short sequence.\n"); return -1; } decode_pulses(&pulse, VAR_2, ics->swb_offset); } if ((tns->present = get_bits1(VAR_2)) && decode_tns(VAR_0, tns, VAR_2, ics))
return -1; if (get_bits1(VAR_2)) { av_log_missing_feature(VAR_0->avccontext, "SSR", 1); return -1; } } if (decode_spectrum_and_dequant(VAR_0, VAR_5, VAR_2, VAR_1->sf, VAR_7, &pulse, ics, VAR_1->band_type) < 0)
return -1; return 0; }