int i2c_start_transfer(I2CBus *bus, uint8_t address, int recv)

{

    BusChild *kid;

    I2CSlaveClass *sc;

    I2CNode *node;



    if (address == 0x00) {

        /*

         * This is a broadcast, the current_devs will be all the devices of the

         * bus.

         */

        bus->broadcast = true;

    }



    QTAILQ_FOREACH(kid, &bus->qbus.children, sibling) {

        DeviceState *qdev = kid->child;

        I2CSlave *candidate = I2C_SLAVE(qdev);

        if ((candidate->address == address) || (bus->broadcast)) {

            node = g_malloc(sizeof(struct I2CNode));

            node->elt = candidate;

            QLIST_INSERT_HEAD(&bus->current_devs, node, next);

            if (!bus->broadcast) {

                break;

            }

        }

    }



    if (QLIST_EMPTY(&bus->current_devs)) {

        return 1;

    }



    QLIST_FOREACH(node, &bus->current_devs, next) {

        sc = I2C_SLAVE_GET_CLASS(node->elt);

        /* If the bus is already busy, assume this is a repeated

           start condition.  */

        if (sc->event) {

            sc->event(node->elt, recv ? I2C_START_RECV : I2C_START_SEND);

        }

    }

    return 0;

}

int i2c_start_transfer(I2CBus *bus, uint8_t address, int recv)

{

    BusChild *kid;

    I2CSlaveClass *sc;

    I2CNode *node;



    if (address == 0x00) {

        







        bus->broadcast = true;

    }



    QTAILQ_FOREACH(kid, &bus->qbus.children, sibling) {

        DeviceState *qdev = kid->child;

        I2CSlave *candidate = I2C_SLAVE(qdev);

        if ((candidate->address == address) || (bus->broadcast)) {

            node = g_malloc(sizeof(struct I2CNode));

            node->elt = candidate;

            QLIST_INSERT_HEAD(&bus->current_devs, node, next);

            if (!bus->broadcast) {

                break;

            }

        }

    }



    if (QLIST_EMPTY(&bus->current_devs)) {

        return 1;

    }



    QLIST_FOREACH(node, &bus->current_devs, next) {

        sc = I2C_SLAVE_GET_CLASS(node->elt);

        



        if (sc->event) {

            sc->event(node->elt, recv ? I2C_START_RECV : I2C_START_SEND);

        }

    }

    return 0;

}

    if (address == 0x00) {
int FUNC_0(I2CBus *VAR_0, uint8_t VAR_1, int VAR_2)

{

    BusChild *kid;

    I2CSlaveClass *sc;

    I2CNode *node;



    if (VAR_1 == 0x00) {

        







        VAR_0->broadcast = true;

    }



    QTAILQ_FOREACH(kid, &VAR_0->qbus.children, sibling) {

        DeviceState *qdev = kid->child;

        I2CSlave *candidate = I2C_SLAVE(qdev);

        if ((candidate->VAR_1 == VAR_1) || (VAR_0->broadcast)) {

            node = g_malloc(sizeof(struct I2CNode));

            node->elt = candidate;

            QLIST_INSERT_HEAD(&VAR_0->current_devs, node, next);

            if (!VAR_0->broadcast) {

                break;

            }

        }

    }



    if (QLIST_EMPTY(&VAR_0->current_devs)) {

        return 1;

    }



    QLIST_FOREACH(node, &VAR_0->current_devs, next) {

        sc = I2C_SLAVE_GET_CLASS(node->elt);

        



        if (sc->event) {

            sc->event(node->elt, VAR_2 ? I2C_START_RECV : I2C_START_SEND);

        }

    }

    return 0;

}

int FUNC_0(I2CBus *VAR_0, uint8_t VAR_1, int VAR_2)
{ BusChild *kid; I2CSlaveClass *sc; I2CNode *node; if (VAR_1 == 0x00) { VAR_0->broadcast = true; } QTAILQ_FOREACH(kid, &VAR_0->qbus.children, sibling) { DeviceState *qdev = kid->child; I2CSlave *candidate = I2C_SLAVE(qdev); if ((candidate->VAR_1 == VAR_1) || (VAR_0->broadcast)) { node = g_malloc(sizeof(struct I2CNode)); node->elt = candidate; QLIST_INSERT_HEAD(&VAR_0->current_devs, node, next); if (!VAR_0->broadcast) { break; } } } if (QLIST_EMPTY(&VAR_0->current_devs)) { return 1; } QLIST_FOREACH(node, &VAR_0->current_devs, next) { sc = I2C_SLAVE_GET_CLASS(node->elt); if (sc->event) { sc->event(node->elt, VAR_2 ? I2C_START_RECV : I2C_START_SEND); } } return 0; }