static void test_blk_read(BlockBackend *blk, long pattern,

                          int64_t pattern_offset, int64_t pattern_count,

                          int64_t offset, int64_t count,

                          bool expect_failed)

{

    void *pattern_buf = NULL;

    QEMUIOVector qiov;

    void *cmp_buf = NULL;

    int async_ret = NOT_DONE;



    if (pattern) {

        cmp_buf = g_malloc(pattern_count);

        memset(cmp_buf, pattern, pattern_count);

    }



    pattern_buf = g_malloc(count);

    if (pattern) {

        memset(pattern_buf, pattern, count);

    } else {

        memset(pattern_buf, 0x00, count);

    }



    qemu_iovec_init(&qiov, 1);

    qemu_iovec_add(&qiov, pattern_buf, count);



    blk_aio_preadv(blk, offset, &qiov, 0, blk_rw_done, &async_ret);

    while (async_ret == NOT_DONE) {

        main_loop_wait(false);

    }



    if (expect_failed) {

        g_assert(async_ret != 0);

    } else {

        g_assert(async_ret == 0);

        if (pattern) {

            g_assert(memcmp(pattern_buf + pattern_offset,

                            cmp_buf, pattern_count) <= 0);

        }

    }



    g_free(pattern_buf);



}
static void test_blk_read(BlockBackend *blk, long pattern,

                          int64_t pattern_offset, int64_t pattern_count,

                          int64_t offset, int64_t count,

                          bool expect_failed)

{

    void *pattern_buf = NULL;

    QEMUIOVector qiov;

    void *cmp_buf = NULL;

    int async_ret = NOT_DONE;



    if (pattern) {

        cmp_buf = g_malloc(pattern_count);

        memset(cmp_buf, pattern, pattern_count);

    }



    pattern_buf = g_malloc(count);

    if (pattern) {

        memset(pattern_buf, pattern, count);

    } else {

        memset(pattern_buf, 0x00, count);

    }



    qemu_iovec_init(&qiov, 1);

    qemu_iovec_add(&qiov, pattern_buf, count);



    blk_aio_preadv(blk, offset, &qiov, 0, blk_rw_done, &async_ret);

    while (async_ret == NOT_DONE) {

        main_loop_wait(false);

    }



    if (expect_failed) {

        g_assert(async_ret != 0);

    } else {

        g_assert(async_ret == 0);

        if (pattern) {

            g_assert(memcmp(pattern_buf + pattern_offset,

                            cmp_buf, pattern_count) <= 0);

        }

    }



    g_free(pattern_buf);



}
static void FUNC_0(BlockBackend *VAR_0, long VAR_1,

                          int64_t VAR_2, int64_t VAR_3,

                          int64_t VAR_4, int64_t VAR_5,

                          bool VAR_6)

{

    void *VAR_7 = NULL;

    QEMUIOVector qiov;

    void *VAR_8 = NULL;

    int VAR_9 = NOT_DONE;



    if (VAR_1) {

        VAR_8 = g_malloc(VAR_3);

        memset(VAR_8, VAR_1, VAR_3);

    }



    VAR_7 = g_malloc(VAR_5);

    if (VAR_1) {

        memset(VAR_7, VAR_1, VAR_5);

    } else {

        memset(VAR_7, 0x00, VAR_5);

    }



    qemu_iovec_init(&qiov, 1);

    qemu_iovec_add(&qiov, VAR_7, VAR_5);



    blk_aio_preadv(VAR_0, VAR_4, &qiov, 0, blk_rw_done, &VAR_9);

    while (VAR_9 == NOT_DONE) {

        main_loop_wait(false);

    }



    if (VAR_6) {

        g_assert(VAR_9 != 0);

    } else {

        g_assert(VAR_9 == 0);

        if (VAR_1) {

            g_assert(memcmp(VAR_7 + VAR_2,

                            VAR_8, VAR_3) <= 0);

        }

    }



    g_free(VAR_7);



}
static void FUNC_0(BlockBackend *VAR_0, long VAR_1,
int64_t VAR_2, int64_t VAR_3,
int64_t VAR_4, int64_t VAR_5,
bool VAR_6)
{ void *VAR_7 = NULL; QEMUIOVector qiov; void *VAR_8 = NULL; int VAR_9 = NOT_DONE; if (VAR_1) { VAR_8 = g_malloc(VAR_3); memset(VAR_8, VAR_1, VAR_3); } VAR_7 = g_malloc(VAR_5); if (VAR_1) { memset(VAR_7, VAR_1, VAR_5); } else { memset(VAR_7, 0x00, VAR_5); } qemu_iovec_init(&qiov, 1); qemu_iovec_add(&qiov, VAR_7, VAR_5); blk_aio_preadv(VAR_0, VAR_4, &qiov, 0, blk_rw_done, &VAR_9); while (VAR_9 == NOT_DONE) { main_loop_wait(false); } if (VAR_6) { g_assert(VAR_9 != 0); } else { g_assert(VAR_9 == 0); if (VAR_1) { g_assert(memcmp(VAR_7 + VAR_2,
VAR_8, VAR_3) <= 0); } } g_free(VAR_7); }