struct USBEndpoint *usb_ep_get(USBDevice *dev, int pid, int ep)

{

    struct USBEndpoint *eps = pid == USB_TOKEN_IN ? dev->ep_in : dev->ep_out;

    if (ep == 0) {

        return &dev->ep_ctl;

    }

    assert(pid == USB_TOKEN_IN || pid == USB_TOKEN_OUT);

    assert(ep > 0 && ep <= USB_MAX_ENDPOINTS);

    return eps + ep - 1;

}

struct USBEndpoint *usb_ep_get(USBDevice *dev, int pid, int ep)

{

    struct USBEndpoint *eps = pid == USB_TOKEN_IN ? dev->ep_in : dev->ep_out;

    if (ep == 0) {

        return &dev->ep_ctl;

    }

    assert(pid == USB_TOKEN_IN || pid == USB_TOKEN_OUT);

    assert(ep > 0 && ep <= USB_MAX_ENDPOINTS);

    return eps + ep - 1;

}

struct USBEndpoint *FUNC_0(USBDevice *VAR_0, int VAR_1, int VAR_2)

{

    struct USBEndpoint *VAR_3 = VAR_1 == USB_TOKEN_IN ? VAR_0->ep_in : VAR_0->ep_out;

    if (VAR_2 == 0) {

        return &VAR_0->ep_ctl;

    }

    assert(VAR_1 == USB_TOKEN_IN || VAR_1 == USB_TOKEN_OUT);

    assert(VAR_2 > 0 && VAR_2 <= USB_MAX_ENDPOINTS);

    return VAR_3 + VAR_2 - 1;

}

struct USBEndpoint *FUNC_0(USBDevice *VAR_0, int VAR_1, int VAR_2)
{ struct USBEndpoint *VAR_3 = VAR_1 == USB_TOKEN_IN ? VAR_0->ep_in : VAR_0->ep_out; if (VAR_2 == 0) { return &VAR_0->ep_ctl; } assert(VAR_1 == USB_TOKEN_IN || VAR_1 == USB_TOKEN_OUT); assert(VAR_2 > 0 && VAR_2 <= USB_MAX_ENDPOINTS); return VAR_3 + VAR_2 - 1; }