static inline int qemu_rdma_buffer_mergable(RDMAContext *rdma,

                    uint64_t offset, uint64_t len)

{

    RDMALocalBlock *block =

        &(rdma->local_ram_blocks.block[rdma->current_index]);

    uint8_t *host_addr = block->local_host_addr + (offset - block->offset);

    uint8_t *chunk_end = ram_chunk_end(block, rdma->current_chunk);



    if (rdma->current_length == 0) {

        return 0;

    }



    /*

     * Only merge into chunk sequentially.

     */

    if (offset != (rdma->current_addr + rdma->current_length)) {

        return 0;

    }



    if (rdma->current_index < 0) {

        return 0;

    }



    if (offset < block->offset) {

        return 0;

    }



    if ((offset + len) > (block->offset + block->length)) {

        return 0;

    }



    if (rdma->current_chunk < 0) {

        return 0;

    }



    if ((host_addr + len) > chunk_end) {

        return 0;

    }



    return 1;

}

static inline int qemu_rdma_buffer_mergable(RDMAContext *rdma,

                    uint64_t offset, uint64_t len)

{

    RDMALocalBlock *block =

        &(rdma->local_ram_blocks.block[rdma->current_index]);

    uint8_t *host_addr = block->local_host_addr + (offset - block->offset);

    uint8_t *chunk_end = ram_chunk_end(block, rdma->current_chunk);



    if (rdma->current_length == 0) {

        return 0;

    }



    





    if (offset != (rdma->current_addr + rdma->current_length)) {

        return 0;

    }



    if (rdma->current_index < 0) {

        return 0;

    }



    if (offset < block->offset) {

        return 0;

    }



    if ((offset + len) > (block->offset + block->length)) {

        return 0;

    }



    if (rdma->current_chunk < 0) {

        return 0;

    }



    if ((host_addr + len) > chunk_end) {

        return 0;

    }



    return 1;

}

static inline int FUNC_0(RDMAContext *VAR_0,

                    uint64_t VAR_1, uint64_t VAR_2)

{

    RDMALocalBlock *block =

        &(VAR_0->local_ram_blocks.block[VAR_0->current_index]);

    uint8_t *host_addr = block->local_host_addr + (VAR_1 - block->VAR_1);

    uint8_t *chunk_end = ram_chunk_end(block, VAR_0->current_chunk);



    if (VAR_0->current_length == 0) {

        return 0;

    }



    





    if (VAR_1 != (VAR_0->current_addr + VAR_0->current_length)) {

        return 0;

    }



    if (VAR_0->current_index < 0) {

        return 0;

    }



    if (VAR_1 < block->VAR_1) {

        return 0;

    }



    if ((VAR_1 + VAR_2) > (block->VAR_1 + block->length)) {

        return 0;

    }



    if (VAR_0->current_chunk < 0) {

        return 0;

    }



    if ((host_addr + VAR_2) > chunk_end) {

        return 0;

    }



    return 1;

}

static inline int FUNC_0(RDMAContext *VAR_0,
uint64_t VAR_1, uint64_t VAR_2)
{ RDMALocalBlock *block =
&(VAR_0->local_ram_blocks.block[VAR_0->current_index]); uint8_t *host_addr = block->local_host_addr + (VAR_1 - block->VAR_1); uint8_t *chunk_end = ram_chunk_end(block, VAR_0->current_chunk); if (VAR_0->current_length == 0) { return 0; } if (VAR_1 != (VAR_0->current_addr + VAR_0->current_length)) { return 0; } if (VAR_0->current_index < 0) { return 0; } if (VAR_1 < block->VAR_1) { return 0; } if ((VAR_1 + VAR_2) > (block->VAR_1 + block->length)) { return 0; } if (VAR_0->current_chunk < 0) { return 0; } if ((host_addr + VAR_2) > chunk_end) { return 0; } return 1; }