void qdist_add(struct qdist *dist, double x, long count)

{

    struct qdist_entry *entry = NULL;



    if (dist->n) {

        struct qdist_entry e;



        e.x = x;

        entry = bsearch(&e, dist->entries, dist->n, sizeof(e), qdist_cmp);

    }



    if (entry) {

        entry->count += count;

        return;

    }



    if (unlikely(dist->n == dist->size)) {

        dist->size *= 2;

        dist->entries = g_realloc(dist->entries,

                                  sizeof(*dist->entries) * (dist->size));

    }

    dist->n++;

    entry = &dist->entries[dist->n - 1];

    entry->x = x;

    entry->count = count;

    qsort(dist->entries, dist->n, sizeof(*entry), qdist_cmp);

}

void qdist_add(struct qdist *dist, double x, long count)

{

    struct qdist_entry *entry = NULL;



    if (dist->n) {

        struct qdist_entry e;



        e.x = x;

        entry = bsearch(&e, dist->entries, dist->n, sizeof(e), qdist_cmp);

    }



    if (entry) {

        entry->count += count;

        return;

    }



    if (unlikely(dist->n == dist->size)) {

        dist->size *= 2;

        dist->entries = g_realloc(dist->entries,

                                  sizeof(*dist->entries) * (dist->size));

    }

    dist->n++;

    entry = &dist->entries[dist->n - 1];

    entry->x = x;

    entry->count = count;

    qsort(dist->entries, dist->n, sizeof(*entry), qdist_cmp);

}

        dist->entries = g_realloc(dist->entries,                                   sizeof(*dist->entries) * (dist->size));
void FUNC_0(struct qdist *VAR_0, double VAR_1, long VAR_2)

{

    struct qdist_entry *VAR_3 = NULL;



    if (VAR_0->n) {

        struct qdist_entry VAR_4;



        VAR_4.VAR_1 = VAR_1;

        VAR_3 = bsearch(&VAR_4, VAR_0->entries, VAR_0->n, sizeof(VAR_4), qdist_cmp);

    }



    if (VAR_3) {

        VAR_3->VAR_2 += VAR_2;

        return;

    }



    if (unlikely(VAR_0->n == VAR_0->size)) {

        VAR_0->size *= 2;

        VAR_0->entries = g_realloc(VAR_0->entries,

                                  sizeof(*VAR_0->entries) * (VAR_0->size));

    }

    VAR_0->n++;

    VAR_3 = &VAR_0->entries[VAR_0->n - 1];

    VAR_3->VAR_1 = VAR_1;

    VAR_3->VAR_2 = VAR_2;

    qsort(VAR_0->entries, VAR_0->n, sizeof(*VAR_3), qdist_cmp);

}

void FUNC_0(struct qdist *VAR_0, double VAR_1, long VAR_2)
{ struct qdist_entry *VAR_3 = NULL; if (VAR_0->n) { struct qdist_entry VAR_4; VAR_4.VAR_1 = VAR_1; VAR_3 = bsearch(&VAR_4, VAR_0->entries, VAR_0->n, sizeof(VAR_4), qdist_cmp); } if (VAR_3) { VAR_3->VAR_2 += VAR_2; return; } if (unlikely(VAR_0->n == VAR_0->size)) { VAR_0->size *= 2; VAR_0->entries = g_realloc(VAR_0->entries,
sizeof(*VAR_0->entries) * (VAR_0->size)); } VAR_0->n++; VAR_3 = &VAR_0->entries[VAR_0->n - 1]; VAR_3->VAR_1 = VAR_1; VAR_3->VAR_2 = VAR_2; qsort(VAR_0->entries, VAR_0->n, sizeof(*VAR_3), qdist_cmp); }