static int qemu_rdma_search_ram_block(RDMAContext *rdma,

                                      uint64_t block_offset,

                                      uint64_t offset,

                                      uint64_t length,

                                      uint64_t *block_index,

                                      uint64_t *chunk_index)

{

    uint64_t current_addr = block_offset + offset;

    RDMALocalBlock *block = g_hash_table_lookup(rdma->blockmap,

                                                (void *) block_offset);

    assert(block);

    assert(current_addr >= block->offset);

    assert((current_addr + length) <= (block->offset + block->length));



    *block_index = block->index;

    *chunk_index = ram_chunk_index(block->local_host_addr,

                block->local_host_addr + (current_addr - block->offset));



    return 0;

}

static int qemu_rdma_search_ram_block(RDMAContext *rdma,

                                      uint64_t block_offset,

                                      uint64_t offset,

                                      uint64_t length,

                                      uint64_t *block_index,

                                      uint64_t *chunk_index)

{

    uint64_t current_addr = block_offset + offset;

    RDMALocalBlock *block = g_hash_table_lookup(rdma->blockmap,

                                                (void *) block_offset);

    assert(block);

    assert(current_addr >= block->offset);

    assert((current_addr + length) <= (block->offset + block->length));



    *block_index = block->index;

    *chunk_index = ram_chunk_index(block->local_host_addr,

                block->local_host_addr + (current_addr - block->offset));



    return 0;

}

static int FUNC_0(RDMAContext *VAR_0,

                                      uint64_t VAR_1,

                                      uint64_t VAR_2,

                                      uint64_t VAR_3,

                                      uint64_t *VAR_4,

                                      uint64_t *VAR_5)

{

    uint64_t current_addr = VAR_1 + VAR_2;

    RDMALocalBlock *block = g_hash_table_lookup(VAR_0->blockmap,

                                                (void *) VAR_1);

    assert(block);

    assert(current_addr >= block->VAR_2);

    assert((current_addr + VAR_3) <= (block->VAR_2 + block->VAR_3));



    *VAR_4 = block->index;

    *VAR_5 = ram_chunk_index(block->local_host_addr,

                block->local_host_addr + (current_addr - block->VAR_2));



    return 0;

}

static int FUNC_0(RDMAContext *VAR_0,
uint64_t VAR_1,
uint64_t VAR_2,
uint64_t VAR_3,
uint64_t *VAR_4,
uint64_t *VAR_5)
{ uint64_t current_addr = VAR_1 + VAR_2; RDMALocalBlock *block = g_hash_table_lookup(VAR_0->blockmap,
(void *) VAR_1); assert(block); assert(current_addr >= block->VAR_2); assert((current_addr + VAR_3) <= (block->VAR_2 + block->VAR_3)); *VAR_4 = block->index; *VAR_5 = ram_chunk_index(block->local_host_addr,
block->local_host_addr + (current_addr - block->VAR_2)); return 0; }