static int get_packetheader(NUTContext *nut, ByteIOContext *bc, int prefix_length, int calculate_checksum)

{

    int64_t start, size, last_size;

    start= url_ftell(bc) - prefix_length;



    if(start != nut->packet_start + nut->written_packet_size){

        av_log(nut->avf, AV_LOG_ERROR, "get_packetheader called at weird position\n");

        return -1;

    }

    

    if(calculate_checksum)

        init_checksum(bc, update_adler32, 0);



    size= get_v(bc);

    last_size= get_v(bc);

    if(nut->written_packet_size != last_size){

        av_log(nut->avf, AV_LOG_ERROR, "packet size missmatch %d != %lld at %lld\n", nut->written_packet_size, last_size, start);

        return -1;

    }



    nut->last_packet_start = nut->packet_start;

    nut->packet_start = start;

    nut->written_packet_size= size;



    return size;

}

static int get_packetheader(NUTContext *nut, ByteIOContext *bc, int prefix_length, int calculate_checksum)

{

    int64_t start, size, last_size;

    start= url_ftell(bc) - prefix_length;



    if(start != nut->packet_start + nut->written_packet_size){

        av_log(nut->avf, AV_LOG_ERROR, "get_packetheader called at weird position\n");

        return -1;

    }

    

    if(calculate_checksum)

        init_checksum(bc, update_adler32, 0);



    size= get_v(bc);

    last_size= get_v(bc);

    if(nut->written_packet_size != last_size){

        av_log(nut->avf, AV_LOG_ERROR, "packet size missmatch %d != %lld at %lld\n", nut->written_packet_size, last_size, start);

        return -1;

    }



    nut->last_packet_start = nut->packet_start;

    nut->packet_start = start;

    nut->written_packet_size= size;



    return size;

}

static int FUNC_0(NUTContext *VAR_0, ByteIOContext *VAR_1, int VAR_2, int VAR_3)

{

    int64_t start, size, last_size;

    start= url_ftell(VAR_1) - VAR_2;



    if(start != VAR_0->packet_start + VAR_0->written_packet_size){

        av_log(VAR_0->avf, AV_LOG_ERROR, "FUNC_0 called at weird position\n");

        return -1;

    }

    

    if(VAR_3)

        init_checksum(VAR_1, update_adler32, 0);



    size= get_v(VAR_1);

    last_size= get_v(VAR_1);

    if(VAR_0->written_packet_size != last_size){

        av_log(VAR_0->avf, AV_LOG_ERROR, "packet size missmatch %d != %lld at %lld\n", VAR_0->written_packet_size, last_size, start);

        return -1;

    }



    VAR_0->last_packet_start = VAR_0->packet_start;

    VAR_0->packet_start = start;

    VAR_0->written_packet_size= size;



    return size;

}

static int FUNC_0(NUTContext *VAR_0, ByteIOContext *VAR_1, int VAR_2, int VAR_3)
{ int64_t start, size, last_size; start= url_ftell(VAR_1) - VAR_2; if(start != VAR_0->packet_start + VAR_0->written_packet_size){ av_log(VAR_0->avf, AV_LOG_ERROR, "FUNC_0 called at weird position\n"); return -1; } if(VAR_3)
init_checksum(VAR_1, update_adler32, 0); size= get_v(VAR_1); last_size= get_v(VAR_1); if(VAR_0->written_packet_size != last_size){ av_log(VAR_0->avf, AV_LOG_ERROR, "packet size missmatch %d != %lld at %lld\n", VAR_0->written_packet_size, last_size, start); return -1; } VAR_0->last_packet_start = VAR_0->packet_start; VAR_0->packet_start = start; VAR_0->written_packet_size= size; return size; }