static void cmd_seek(IDEState *s, uint8_t* buf)

{

    unsigned int lba;

    uint64_t total_sectors = s->nb_sectors >> 2;



    if (total_sectors == 0) {

        ide_atapi_cmd_error(s, SENSE_NOT_READY, ASC_MEDIUM_NOT_PRESENT);

        return;

    }



    lba = ube32_to_cpu(buf + 2);

    if (lba >= total_sectors) {

        ide_atapi_cmd_error(s, SENSE_ILLEGAL_REQUEST, ASC_LOGICAL_BLOCK_OOR);

        return;

    }



    ide_atapi_cmd_ok(s);

}

static void cmd_seek(IDEState *s, uint8_t* buf)

{

    unsigned int lba;

    uint64_t total_sectors = s->nb_sectors >> 2;



    if (total_sectors == 0) {

        ide_atapi_cmd_error(s, SENSE_NOT_READY, ASC_MEDIUM_NOT_PRESENT);

        return;

    }



    lba = ube32_to_cpu(buf + 2);

    if (lba >= total_sectors) {

        ide_atapi_cmd_error(s, SENSE_ILLEGAL_REQUEST, ASC_LOGICAL_BLOCK_OOR);

        return;

    }



    ide_atapi_cmd_ok(s);

}

static void FUNC_0(IDEState *VAR_0, uint8_t* VAR_1)

{

    unsigned int VAR_2;

    uint64_t total_sectors = VAR_0->nb_sectors >> 2;



    if (total_sectors == 0) {

        ide_atapi_cmd_error(VAR_0, SENSE_NOT_READY, ASC_MEDIUM_NOT_PRESENT);

        return;

    }



    VAR_2 = ube32_to_cpu(VAR_1 + 2);

    if (VAR_2 >= total_sectors) {

        ide_atapi_cmd_error(VAR_0, SENSE_ILLEGAL_REQUEST, ASC_LOGICAL_BLOCK_OOR);

        return;

    }



    ide_atapi_cmd_ok(VAR_0);

}

static void FUNC_0(IDEState *VAR_0, uint8_t* VAR_1)
{ unsigned int VAR_2; uint64_t total_sectors = VAR_0->nb_sectors >> 2; if (total_sectors == 0) { ide_atapi_cmd_error(VAR_0, SENSE_NOT_READY, ASC_MEDIUM_NOT_PRESENT); return; } VAR_2 = ube32_to_cpu(VAR_1 + 2); if (VAR_2 >= total_sectors) { ide_atapi_cmd_error(VAR_0, SENSE_ILLEGAL_REQUEST, ASC_LOGICAL_BLOCK_OOR); return; } ide_atapi_cmd_ok(VAR_0); }