static void bmdma_addr_write(void *opaque, target_phys_addr_t addr,

                             uint64_t data, unsigned width)

{

    BMDMAState *bm = opaque;

    int shift = addr * 8;

    uint32_t mask = (1ULL << (width * 8)) - 1;



#ifdef DEBUG_IDE

    printf("%s: 0x%08x\n", __func__, (unsigned)data);

#endif

    bm->addr &= ~(mask << shift);

    bm->addr |= ((data & mask) << shift) & ~3;

}

static void bmdma_addr_write(void *opaque, target_phys_addr_t addr,

                             uint64_t data, unsigned width)

{

    BMDMAState *bm = opaque;

    int shift = addr * 8;

    uint32_t mask = (1ULL << (width * 8)) - 1;



#ifdef DEBUG_IDE

    printf("%s: 0x%08x\n", __func__, (unsigned)data);

#endif

    bm->addr &= ~(mask << shift);

    bm->addr |= ((data & mask) << shift) & ~3;

}

static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,

                             uint64_t VAR_2, unsigned VAR_3)

{

    BMDMAState *bm = VAR_0;

    int VAR_4 = VAR_1 * 8;

    uint32_t mask = (1ULL << (VAR_3 * 8)) - 1;



#ifdef DEBUG_IDE

    printf("%s: 0x%08x\n", __func__, (unsigned)VAR_2);

#endif

    bm->VAR_1 &= ~(mask << VAR_4);

    bm->VAR_1 |= ((VAR_2 & mask) << VAR_4) & ~3;

}

static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,
uint64_t VAR_2, unsigned VAR_3)
{ BMDMAState *bm = VAR_0; int VAR_4 = VAR_1 * 8; uint32_t mask = (1ULL << (VAR_3 * 8)) - 1; #ifdef DEBUG_IDE
printf("%s: 0x%08x\n", __func__, (unsigned)VAR_2); #endif
bm->VAR_1 &= ~(mask << VAR_4); bm->VAR_1 |= ((VAR_2 & mask) << VAR_4) & ~3; }