static int index_search_timestamp(AVIndexEntry *entries, 

                                  int nb_entries, int wanted_timestamp)

{

    int a, b, m;

    int64_t timestamp;



    if (nb_entries <= 0)

        return -1;

    

    a = 0;

    b = nb_entries - 1;

    while (a <= b) {

        m = (a + b) >> 1;

        timestamp = entries[m].timestamp;

        if (timestamp == wanted_timestamp)

            goto found;

        else if (timestamp > wanted_timestamp) {

            b = m - 1;

        } else {

            a = m + 1;

        }

    }

    m = a;

    if (m > 0)

        m--;

 found:

    return m;

}

static int index_search_timestamp(AVIndexEntry *entries, 

                                  int nb_entries, int wanted_timestamp)

{

    int a, b, m;

    int64_t timestamp;



    if (nb_entries <= 0)

        return -1;

    

    a = 0;

    b = nb_entries - 1;

    while (a <= b) {

        m = (a + b) >> 1;

        timestamp = entries[m].timestamp;

        if (timestamp == wanted_timestamp)

            goto found;

        else if (timestamp > wanted_timestamp) {

            b = m - 1;

        } else {

            a = m + 1;

        }

    }

    m = a;

    if (m > 0)

        m--;

 found:

    return m;

}

static int FUNC_0(AVIndexEntry *VAR_0, 

                                  int VAR_1, int VAR_2)

{

    int VAR_3, VAR_4, VAR_5;

    int64_t timestamp;



    if (VAR_1 <= 0)

        return -1;

    

    VAR_3 = 0;

    VAR_4 = VAR_1 - 1;

    while (VAR_3 <= VAR_4) {

        VAR_5 = (VAR_3 + VAR_4) >> 1;

        timestamp = VAR_0[VAR_5].timestamp;

        if (timestamp == VAR_2)

            goto found;

        else if (timestamp > VAR_2) {

            VAR_4 = VAR_5 - 1;

        } else {

            VAR_3 = VAR_5 + 1;

        }

    }

    VAR_5 = VAR_3;

    if (VAR_5 > 0)

        VAR_5--;

 found:

    return VAR_5;

}

static int FUNC_0(AVIndexEntry *VAR_0,
int VAR_1, int VAR_2)
{ int VAR_3, VAR_4, VAR_5; int64_t timestamp; if (VAR_1 <= 0)
return -1; VAR_3 = 0; VAR_4 = VAR_1 - 1; while (VAR_3 <= VAR_4) { VAR_5 = (VAR_3 + VAR_4) >> 1; timestamp = VAR_0[VAR_5].timestamp; if (timestamp == VAR_2)
goto found; else if (timestamp > VAR_2) { VAR_4 = VAR_5 - 1; } else { VAR_3 = VAR_5 + 1; } } VAR_5 = VAR_3; if (VAR_5 > 0)
VAR_5--; found:
return VAR_5; }