int ff_find_unused_picture(MpegEncContext *s, int shared){

    int i;



    if(shared){

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

            if(s->picture[i].data[0]==NULL && s->picture[i].type==0) return i;

        }

    }else{

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

            if(s->picture[i].data[0]==NULL && s->picture[i].type!=0) return i; //FIXME

        }

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

            if(s->picture[i].data[0]==NULL) return i;

        }

    }



    assert(0);

    return -1;

}

int ff_find_unused_picture(MpegEncContext *s, int shared){

    int i;



    if(shared){

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

            if(s->picture[i].data[0]==NULL && s->picture[i].type==0) return i;

        }

    }else{

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

            if(s->picture[i].data[0]==NULL && s->picture[i].type!=0) return i; 

        }

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

            if(s->picture[i].data[0]==NULL) return i;

        }

    }



    assert(0);

    return -1;

}

    assert(0);
int FUNC_0(MpegEncContext *VAR_0, int VAR_1){

    int VAR_2;



    if(VAR_1){

        for(VAR_2=0; VAR_2<MAX_PICTURE_COUNT; VAR_2++){

            if(VAR_0->picture[VAR_2].data[0]==NULL && VAR_0->picture[VAR_2].type==0) return VAR_2;

        }

    }else{

        for(VAR_2=0; VAR_2<MAX_PICTURE_COUNT; VAR_2++){

            if(VAR_0->picture[VAR_2].data[0]==NULL && VAR_0->picture[VAR_2].type!=0) return VAR_2; 

        }

        for(VAR_2=0; VAR_2<MAX_PICTURE_COUNT; VAR_2++){

            if(VAR_0->picture[VAR_2].data[0]==NULL) return VAR_2;

        }

    }



    assert(0);

    return -1;

}

int FUNC_0(MpegEncContext *VAR_0, int VAR_1){ int VAR_2; if(VAR_1){ for(VAR_2=0; VAR_2<MAX_PICTURE_COUNT; VAR_2++){ if(VAR_0->picture[VAR_2].data[0]==NULL && VAR_0->picture[VAR_2].type==0) return VAR_2; } }else{ for(VAR_2=0; VAR_2<MAX_PICTURE_COUNT; VAR_2++){ if(VAR_0->picture[VAR_2].data[0]==NULL && VAR_0->picture[VAR_2].type!=0) return VAR_2; } for(VAR_2=0; VAR_2<MAX_PICTURE_COUNT; VAR_2++){ if(VAR_0->picture[VAR_2].data[0]==NULL) return VAR_2; } } assert(0); return -1; }