void usb_generic_async_ctrl_complete(USBDevice *s, USBPacket *p)

{

    if (p->len < 0) {

        s->setup_state = SETUP_STATE_IDLE;

    }



    switch (s->setup_state) {

    case SETUP_STATE_SETUP:

        if (p->len < s->setup_len) {

            s->setup_len = p->len;

        }

        s->setup_state = SETUP_STATE_DATA;

        p->len = 8;

        break;



    case SETUP_STATE_ACK:

        s->setup_state = SETUP_STATE_IDLE;

        p->len = 0;

        break;



    default:

        break;

    }

    usb_packet_complete(s, p);

}

void usb_generic_async_ctrl_complete(USBDevice *s, USBPacket *p)

{

    if (p->len < 0) {

        s->setup_state = SETUP_STATE_IDLE;

    }



    switch (s->setup_state) {

    case SETUP_STATE_SETUP:

        if (p->len < s->setup_len) {

            s->setup_len = p->len;

        }

        s->setup_state = SETUP_STATE_DATA;

        p->len = 8;

        break;



    case SETUP_STATE_ACK:

        s->setup_state = SETUP_STATE_IDLE;

        p->len = 0;

        break;



    default:

        break;

    }

    usb_packet_complete(s, p);

}

    if (p->len < 0) {         if (p->len < s->setup_len) {             s->setup_len = p->len;         p->len = 8;         p->len = 0;
void FUNC_0(USBDevice *VAR_0, USBPacket *VAR_1)

{

    if (VAR_1->len < 0) {

        VAR_0->setup_state = SETUP_STATE_IDLE;

    }



    switch (VAR_0->setup_state) {

    case SETUP_STATE_SETUP:

        if (VAR_1->len < VAR_0->setup_len) {

            VAR_0->setup_len = VAR_1->len;

        }

        VAR_0->setup_state = SETUP_STATE_DATA;

        VAR_1->len = 8;

        break;



    case SETUP_STATE_ACK:

        VAR_0->setup_state = SETUP_STATE_IDLE;

        VAR_1->len = 0;

        break;



    default:

        break;

    }

    usb_packet_complete(VAR_0, VAR_1);

}

void FUNC_0(USBDevice *VAR_0, USBPacket *VAR_1)
{ if (VAR_1->len < 0) { VAR_0->setup_state = SETUP_STATE_IDLE; } switch (VAR_0->setup_state) { case SETUP_STATE_SETUP:
if (VAR_1->len < VAR_0->setup_len) { VAR_0->setup_len = VAR_1->len; } VAR_0->setup_state = SETUP_STATE_DATA; VAR_1->len = 8; break; case SETUP_STATE_ACK:
VAR_0->setup_state = SETUP_STATE_IDLE; VAR_1->len = 0; break; default:
break; } usb_packet_complete(VAR_0, VAR_1); }