static int aac_decode_frame(AVCodecContext *avctx, void *data,
                            int *got_frame_ptr, AVPacket *avpkt)
{
    AACContext *ac = avctx->priv_data;
    const uint8_t *buf = avpkt->data;
    int buf_size = avpkt->size;
    GetBitContext gb;
    int buf_consumed;
    int buf_offset;
    int err;
    int new_extradata_size;
    const uint8_t *new_extradata = av_packet_get_side_data(avpkt,
                                       AV_PKT_DATA_NEW_EXTRADATA,
                                       &new_extradata_size);
    int jp_dualmono_size;
    const uint8_t *jp_dualmono   = av_packet_get_side_data(avpkt,
                                       AV_PKT_DATA_JP_DUALMONO,
                                       &jp_dualmono_size);
    if (new_extradata && 0) {
        av_free(avctx->extradata);
        avctx->extradata = av_mallocz(new_extradata_size +
                                      FF_INPUT_BUFFER_PADDING_SIZE);
        if (!avctx->extradata)
            return AVERROR(ENOMEM);
        avctx->extradata_size = new_extradata_size;
        memcpy(avctx->extradata, new_extradata, new_extradata_size);
        push_output_configuration(ac);
        if (decode_audio_specific_config(ac, ac->avctx, &ac->oc[1].m4ac,
                                         avctx->extradata,
                                         avctx->extradata_size*8, 1) < 0) {
            pop_output_configuration(ac);
        }
    }
    ac->dmono_mode = 0;
    if (jp_dualmono && jp_dualmono_size > 0)
        ac->dmono_mode =  1 + *jp_dualmono;
    if (ac->force_dmono_mode >= 0)
        ac->dmono_mode = ac->force_dmono_mode;
    init_get_bits(&gb, buf, buf_size * 8);
    if ((err = aac_decode_frame_int(avctx, data, got_frame_ptr, &gb, avpkt)) < 0)
        return err;
    buf_consumed = (get_bits_count(&gb) + 7) >> 3;
    for (buf_offset = buf_consumed; buf_offset < buf_size; buf_offset++)
        if (buf[buf_offset])
            break;
    return buf_size > buf_offset ? buf_consumed : buf_size;
}
static int aac_decode_frame(AVCodecContext *avctx, void *data,
                            int *got_frame_ptr, AVPacket *avpkt)
{
    AACContext *ac = avctx->priv_data;
    const uint8_t *buf = avpkt->data;
    int buf_size = avpkt->size;
    GetBitContext gb;
    int buf_consumed;
    int buf_offset;
    int err;
    int new_extradata_size;
    const uint8_t *new_extradata = av_packet_get_side_data(avpkt,
                                       AV_PKT_DATA_NEW_EXTRADATA,
                                       &new_extradata_size);
    int jp_dualmono_size;
    const uint8_t *jp_dualmono   = av_packet_get_side_data(avpkt,
                                       AV_PKT_DATA_JP_DUALMONO,
                                       &jp_dualmono_size);
    if (new_extradata && 0) {
        av_free(avctx->extradata);
        avctx->extradata = av_mallocz(new_extradata_size +
                                      FF_INPUT_BUFFER_PADDING_SIZE);
        if (!avctx->extradata)
            return AVERROR(ENOMEM);
        avctx->extradata_size = new_extradata_size;
        memcpy(avctx->extradata, new_extradata, new_extradata_size);
        push_output_configuration(ac);
        if (decode_audio_specific_config(ac, ac->avctx, &ac->oc[1].m4ac,
                                         avctx->extradata,
                                         avctx->extradata_size*8, 1) < 0) {
            pop_output_configuration(ac);
        }
    }
    ac->dmono_mode = 0;
    if (jp_dualmono && jp_dualmono_size > 0)
        ac->dmono_mode =  1 + *jp_dualmono;
    if (ac->force_dmono_mode >= 0)
        ac->dmono_mode = ac->force_dmono_mode;
    init_get_bits(&gb, buf, buf_size * 8);
    if ((err = aac_decode_frame_int(avctx, data, got_frame_ptr, &gb, avpkt)) < 0)
        return err;
    buf_consumed = (get_bits_count(&gb) + 7) >> 3;
    for (buf_offset = buf_consumed; buf_offset < buf_size; buf_offset++)
        if (buf[buf_offset])
            break;
    return buf_size > buf_offset ? buf_consumed : buf_size;
}
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1,
                            int *VAR_2, AVPacket *VAR_3)
{
    AACContext *ac = VAR_0->priv_data;
    const uint8_t *VAR_4 = VAR_3->VAR_1;
    int VAR_5 = VAR_3->size;
    GetBitContext gb;
    int VAR_6;
    int VAR_7;
    int VAR_8;
    int VAR_9;
    const uint8_t *VAR_10 = av_packet_get_side_data(VAR_3,
                                       AV_PKT_DATA_NEW_EXTRADATA,
                                       &VAR_9);
    int VAR_11;
    const uint8_t *VAR_12   = av_packet_get_side_data(VAR_3,
                                       AV_PKT_DATA_JP_DUALMONO,
                                       &VAR_11);
    if (VAR_10 && 0) {
        av_free(VAR_0->extradata);
        VAR_0->extradata = av_mallocz(VAR_9 +
                                      FF_INPUT_BUFFER_PADDING_SIZE);
        if (!VAR_0->extradata)
            return AVERROR(ENOMEM);
        VAR_0->extradata_size = VAR_9;
        memcpy(VAR_0->extradata, VAR_10, VAR_9);
        push_output_configuration(ac);
        if (decode_audio_specific_config(ac, ac->VAR_0, &ac->oc[1].m4ac,
                                         VAR_0->extradata,
                                         VAR_0->extradata_size*8, 1) < 0) {
            pop_output_configuration(ac);
        }
    }
    ac->dmono_mode = 0;
    if (VAR_12 && VAR_11 > 0)
        ac->dmono_mode =  1 + *VAR_12;
    if (ac->force_dmono_mode >= 0)
        ac->dmono_mode = ac->force_dmono_mode;
    init_get_bits(&gb, VAR_4, VAR_5 * 8);
    if ((VAR_8 = aac_decode_frame_int(VAR_0, VAR_1, VAR_2, &gb, VAR_3)) < 0)
        return VAR_8;
    VAR_6 = (get_bits_count(&gb) + 7) >> 3;
    for (VAR_7 = VAR_6; VAR_7 < VAR_5; VAR_7++)
        if (VAR_4[VAR_7])
            break;
    return VAR_5 > VAR_7 ? VAR_6 : VAR_5;
}
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1,
int *VAR_2, AVPacket *VAR_3)
{ AACContext *ac = VAR_0->priv_data; const uint8_t *VAR_4 = VAR_3->VAR_1; int VAR_5 = VAR_3->size; GetBitContext gb; int VAR_6; int VAR_7; int VAR_8; int VAR_9; const uint8_t *VAR_10 = av_packet_get_side_data(VAR_3,
AV_PKT_DATA_NEW_EXTRADATA,
&VAR_9); int VAR_11; const uint8_t *VAR_12   = av_packet_get_side_data(VAR_3,
AV_PKT_DATA_JP_DUALMONO,
&VAR_11); if (VAR_10 && 0) { av_free(VAR_0->extradata); VAR_0->extradata = av_mallocz(VAR_9 +
FF_INPUT_BUFFER_PADDING_SIZE); if (!VAR_0->extradata)
return AVERROR(ENOMEM); VAR_0->extradata_size = VAR_9; memcpy(VAR_0->extradata, VAR_10, VAR_9); push_output_configuration(ac); if (decode_audio_specific_config(ac, ac->VAR_0, &ac->oc[1].m4ac,
VAR_0->extradata,
VAR_0->extradata_size*8, 1) < 0) { pop_output_configuration(ac); } } ac->dmono_mode = 0; if (VAR_12 && VAR_11 > 0)
ac->dmono_mode =  1 + *VAR_12; if (ac->force_dmono_mode >= 0)
ac->dmono_mode = ac->force_dmono_mode; init_get_bits(&gb, VAR_4, VAR_5 * 8); if ((VAR_8 = aac_decode_frame_int(VAR_0, VAR_1, VAR_2, &gb, VAR_3)) < 0)
return VAR_8; VAR_6 = (get_bits_count(&gb) + 7) >> 3; for (VAR_7 = VAR_6; VAR_7 < VAR_5; VAR_7++) if (VAR_4[VAR_7])
break; return VAR_5 > VAR_7 ? VAR_6 : VAR_5; }