static void ehci_advance_state(EHCIState *ehci, int async)

{

    EHCIQueue *q = NULL;

    int again;



    do {

        switch(ehci_get_state(ehci, async)) {

        case EST_WAITLISTHEAD:

            again = ehci_state_waitlisthead(ehci, async);

            break;



        case EST_FETCHENTRY:

            again = ehci_state_fetchentry(ehci, async);

            break;



        case EST_FETCHQH:

            q = ehci_state_fetchqh(ehci, async);

            if (q != NULL) {

                assert(q->async == async);

                again = 1;

            } else {

                again = 0;

            }

            break;



        case EST_FETCHITD:

            again = ehci_state_fetchitd(ehci, async);

            break;



        case EST_FETCHSITD:

            again = ehci_state_fetchsitd(ehci, async);

            break;



        case EST_ADVANCEQUEUE:

            assert(q != NULL);

            again = ehci_state_advqueue(q);

            break;



        case EST_FETCHQTD:

            assert(q != NULL);

            again = ehci_state_fetchqtd(q);

            break;



        case EST_HORIZONTALQH:

            assert(q != NULL);

            again = ehci_state_horizqh(q);

            break;



        case EST_EXECUTE:

            assert(q != NULL);

            again = ehci_state_execute(q);

            if (async) {

                ehci->async_stepdown = 0;

            }

            break;



        case EST_EXECUTING:

            assert(q != NULL);

            if (async) {

                ehci->async_stepdown = 0;

            }

            again = ehci_state_executing(q);

            break;



        case EST_WRITEBACK:

            assert(q != NULL);

            again = ehci_state_writeback(q);

            if (!async) {

                ehci->periodic_sched_active = PERIODIC_ACTIVE;

            }

            break;



        default:

            fprintf(stderr, "Bad state!\n");

            again = -1;

            g_assert_not_reached();

            break;

        }



        if (again < 0) {

            fprintf(stderr, "processing error - resetting ehci HC\n");

            ehci_reset(ehci);

            again = 0;

        }

    }

    while (again);

}

static void ehci_advance_state(EHCIState *ehci, int async)

{

    EHCIQueue *q = NULL;

    int again;



    do {

        switch(ehci_get_state(ehci, async)) {

        case EST_WAITLISTHEAD:

            again = ehci_state_waitlisthead(ehci, async);

            break;



        case EST_FETCHENTRY:

            again = ehci_state_fetchentry(ehci, async);

            break;



        case EST_FETCHQH:

            q = ehci_state_fetchqh(ehci, async);

            if (q != NULL) {

                assert(q->async == async);

                again = 1;

            } else {

                again = 0;

            }

            break;



        case EST_FETCHITD:

            again = ehci_state_fetchitd(ehci, async);

            break;



        case EST_FETCHSITD:

            again = ehci_state_fetchsitd(ehci, async);

            break;



        case EST_ADVANCEQUEUE:

            assert(q != NULL);

            again = ehci_state_advqueue(q);

            break;



        case EST_FETCHQTD:

            assert(q != NULL);

            again = ehci_state_fetchqtd(q);

            break;



        case EST_HORIZONTALQH:

            assert(q != NULL);

            again = ehci_state_horizqh(q);

            break;



        case EST_EXECUTE:

            assert(q != NULL);

            again = ehci_state_execute(q);

            if (async) {

                ehci->async_stepdown = 0;

            }

            break;



        case EST_EXECUTING:

            assert(q != NULL);

            if (async) {

                ehci->async_stepdown = 0;

            }

            again = ehci_state_executing(q);

            break;



        case EST_WRITEBACK:

            assert(q != NULL);

            again = ehci_state_writeback(q);

            if (!async) {

                ehci->periodic_sched_active = PERIODIC_ACTIVE;

            }

            break;



        default:

            fprintf(stderr, "Bad state!\n");

            again = -1;

            g_assert_not_reached();

            break;

        }



        if (again < 0) {

            fprintf(stderr, "processing error - resetting ehci HC\n");

            ehci_reset(ehci);

            again = 0;

        }

    }

    while (again);

}

        if (again < 0) {
static void FUNC_0(EHCIState *VAR_0, int VAR_1)

{

    EHCIQueue *q = NULL;

    int VAR_2;



    do {

        switch(ehci_get_state(VAR_0, VAR_1)) {

        case EST_WAITLISTHEAD:

            VAR_2 = ehci_state_waitlisthead(VAR_0, VAR_1);

            break;



        case EST_FETCHENTRY:

            VAR_2 = ehci_state_fetchentry(VAR_0, VAR_1);

            break;



        case EST_FETCHQH:

            q = ehci_state_fetchqh(VAR_0, VAR_1);

            if (q != NULL) {

                assert(q->VAR_1 == VAR_1);

                VAR_2 = 1;

            } else {

                VAR_2 = 0;

            }

            break;



        case EST_FETCHITD:

            VAR_2 = ehci_state_fetchitd(VAR_0, VAR_1);

            break;



        case EST_FETCHSITD:

            VAR_2 = ehci_state_fetchsitd(VAR_0, VAR_1);

            break;



        case EST_ADVANCEQUEUE:

            assert(q != NULL);

            VAR_2 = ehci_state_advqueue(q);

            break;



        case EST_FETCHQTD:

            assert(q != NULL);

            VAR_2 = ehci_state_fetchqtd(q);

            break;



        case EST_HORIZONTALQH:

            assert(q != NULL);

            VAR_2 = ehci_state_horizqh(q);

            break;



        case EST_EXECUTE:

            assert(q != NULL);

            VAR_2 = ehci_state_execute(q);

            if (VAR_1) {

                VAR_0->async_stepdown = 0;

            }

            break;



        case EST_EXECUTING:

            assert(q != NULL);

            if (VAR_1) {

                VAR_0->async_stepdown = 0;

            }

            VAR_2 = ehci_state_executing(q);

            break;



        case EST_WRITEBACK:

            assert(q != NULL);

            VAR_2 = ehci_state_writeback(q);

            if (!VAR_1) {

                VAR_0->periodic_sched_active = PERIODIC_ACTIVE;

            }

            break;



        default:

            fprintf(stderr, "Bad state!\n");

            VAR_2 = -1;

            g_assert_not_reached();

            break;

        }



        if (VAR_2 < 0) {

            fprintf(stderr, "processing error - resetting VAR_0 HC\n");

            ehci_reset(VAR_0);

            VAR_2 = 0;

        }

    }

    while (VAR_2);

}

static void FUNC_0(EHCIState *VAR_0, int VAR_1)
{ EHCIQueue *q = NULL; int VAR_2; do { switch(ehci_get_state(VAR_0, VAR_1)) { case EST_WAITLISTHEAD:
VAR_2 = ehci_state_waitlisthead(VAR_0, VAR_1); break; case EST_FETCHENTRY:
VAR_2 = ehci_state_fetchentry(VAR_0, VAR_1); break; case EST_FETCHQH:
q = ehci_state_fetchqh(VAR_0, VAR_1); if (q != NULL) { assert(q->VAR_1 == VAR_1); VAR_2 = 1; } else { VAR_2 = 0; } break; case EST_FETCHITD:
VAR_2 = ehci_state_fetchitd(VAR_0, VAR_1); break; case EST_FETCHSITD:
VAR_2 = ehci_state_fetchsitd(VAR_0, VAR_1); break; case EST_ADVANCEQUEUE:
assert(q != NULL); VAR_2 = ehci_state_advqueue(q); break; case EST_FETCHQTD:
assert(q != NULL); VAR_2 = ehci_state_fetchqtd(q); break; case EST_HORIZONTALQH:
assert(q != NULL); VAR_2 = ehci_state_horizqh(q); break; case EST_EXECUTE:
assert(q != NULL); VAR_2 = ehci_state_execute(q); if (VAR_1) { VAR_0->async_stepdown = 0; } break; case EST_EXECUTING:
assert(q != NULL); if (VAR_1) { VAR_0->async_stepdown = 0; } VAR_2 = ehci_state_executing(q); break; case EST_WRITEBACK:
assert(q != NULL); VAR_2 = ehci_state_writeback(q); if (!VAR_1) { VAR_0->periodic_sched_active = PERIODIC_ACTIVE; } break; default:
fprintf(stderr, "Bad state!\n"); VAR_2 = -1; g_assert_not_reached(); break; } if (VAR_2 < 0) { fprintf(stderr, "processing error - resetting VAR_0 HC\n"); ehci_reset(VAR_0); VAR_2 = 0; } } while (VAR_2); }