static int ata_passthrough_16_xfer_size(SCSIDevice *dev, uint8_t *buf)

{

    int extend = buf[1] & 0x1;

    int length = buf[2] & 0x3;

    int xfer;

    int unit = ata_passthrough_xfer_unit(dev, buf);



    switch (length) {

    case 0:

    case 3: /* USB-specific.  */


        xfer = 0;

        break;

    case 1:

        xfer = buf[4];

        xfer |= (extend ? buf[3] << 8 : 0);

        break;

    case 2:

        xfer = buf[6];

        xfer |= (extend ? buf[5] << 8 : 0);

        break;

    }



    return xfer * unit;

}
static int ata_passthrough_16_xfer_size(SCSIDevice *dev, uint8_t *buf)

{

    int extend = buf[1] & 0x1;

    int length = buf[2] & 0x3;

    int xfer;

    int unit = ata_passthrough_xfer_unit(dev, buf);



    switch (length) {

    case 0:

    case 3: 


        xfer = 0;

        break;

    case 1:

        xfer = buf[4];

        xfer |= (extend ? buf[3] << 8 : 0);

        break;

    case 2:

        xfer = buf[6];

        xfer |= (extend ? buf[5] << 8 : 0);

        break;

    }



    return xfer * unit;

}
static int FUNC_0(SCSIDevice *VAR_0, uint8_t *VAR_1)

{

    int VAR_2 = VAR_1[1] & 0x1;

    int VAR_3 = VAR_1[2] & 0x3;

    int VAR_4;

    int VAR_5 = ata_passthrough_xfer_unit(VAR_0, VAR_1);



    switch (VAR_3) {

    case 0:

    case 3: 


        VAR_4 = 0;

        break;

    case 1:

        VAR_4 = VAR_1[4];

        VAR_4 |= (VAR_2 ? VAR_1[3] << 8 : 0);

        break;

    case 2:

        VAR_4 = VAR_1[6];

        VAR_4 |= (VAR_2 ? VAR_1[5] << 8 : 0);

        break;

    }



    return VAR_4 * VAR_5;

}
static int FUNC_0(SCSIDevice *VAR_0, uint8_t *VAR_1)
{ int VAR_2 = VAR_1[1] & 0x1; int VAR_3 = VAR_1[2] & 0x3; int VAR_4; int VAR_5 = ata_passthrough_xfer_unit(VAR_0, VAR_1); switch (VAR_3) { case 0:
case 3:
VAR_4 = 0; break; case 1:
VAR_4 = VAR_1[4]; VAR_4 |= (VAR_2 ? VAR_1[3] << 8 : 0); break; case 2:
VAR_4 = VAR_1[6]; VAR_4 |= (VAR_2 ? VAR_1[5] << 8 : 0); break; } return VAR_4 * VAR_5; }