static void get_offset_range(hwaddr phys_addr,

                             ram_addr_t mapping_length,

                             DumpState *s,

                             hwaddr *p_offset,

                             hwaddr *p_filesz)

{

    RAMBlock *block;

    hwaddr offset = s->memory_offset;

    int64_t size_in_block, start;



    /* When the memory is not stored into vmcore, offset will be -1 */

    *p_offset = -1;

    *p_filesz = 0;



    if (s->has_filter) {

        if (phys_addr < s->begin || phys_addr >= s->begin + s->length) {

            return;

        }

    }



    QTAILQ_FOREACH(block, &ram_list.blocks, next) {

        if (s->has_filter) {

            if (block->offset >= s->begin + s->length ||

                block->offset + block->length <= s->begin) {

                /* This block is out of the range */

                continue;

            }



            if (s->begin <= block->offset) {

                start = block->offset;

            } else {

                start = s->begin;

            }



            size_in_block = block->length - (start - block->offset);

            if (s->begin + s->length < block->offset + block->length) {

                size_in_block -= block->offset + block->length -

                                 (s->begin + s->length);

            }

        } else {

            start = block->offset;

            size_in_block = block->length;

        }



        if (phys_addr >= start && phys_addr < start + size_in_block) {

            *p_offset = phys_addr - start + offset;



            /* The offset range mapped from the vmcore file must not spill over

             * the RAMBlock, clamp it. The rest of the mapping will be

             * zero-filled in memory at load time; see

             * <http://refspecs.linuxbase.org/elf/gabi4+/ch5.pheader.html>.

             */

            *p_filesz = phys_addr + mapping_length <= start + size_in_block ?

                        mapping_length :

                        size_in_block - (phys_addr - start);

            return;

        }



        offset += size_in_block;

    }

}

static void get_offset_range(hwaddr phys_addr,

                             ram_addr_t mapping_length,

                             DumpState *s,

                             hwaddr *p_offset,

                             hwaddr *p_filesz)

{

    RAMBlock *block;

    hwaddr offset = s->memory_offset;

    int64_t size_in_block, start;



    

    *p_offset = -1;

    *p_filesz = 0;



    if (s->has_filter) {

        if (phys_addr < s->begin || phys_addr >= s->begin + s->length) {

            return;

        }

    }



    QTAILQ_FOREACH(block, &ram_list.blocks, next) {

        if (s->has_filter) {

            if (block->offset >= s->begin + s->length ||

                block->offset + block->length <= s->begin) {

                

                continue;

            }



            if (s->begin <= block->offset) {

                start = block->offset;

            } else {

                start = s->begin;

            }



            size_in_block = block->length - (start - block->offset);

            if (s->begin + s->length < block->offset + block->length) {

                size_in_block -= block->offset + block->length -

                                 (s->begin + s->length);

            }

        } else {

            start = block->offset;

            size_in_block = block->length;

        }



        if (phys_addr >= start && phys_addr < start + size_in_block) {

            *p_offset = phys_addr - start + offset;



            









            *p_filesz = phys_addr + mapping_length <= start + size_in_block ?

                        mapping_length :

                        size_in_block - (phys_addr - start);

            return;

        }



        offset += size_in_block;

    }

}

    RAMBlock *block;     RAMBlock *block;     QTAILQ_FOREACH(block, &ram_list.blocks, next) {             if (block->offset >= s->begin + s->length ||                 block->offset + block->length <= s->begin) {             if (s->begin <= block->offset) {                 start = block->offset;             size_in_block = block->length - (start - block->offset);             if (s->begin + s->length < block->offset + block->length) {                 size_in_block -= block->offset + block->length -                                  (s->begin + s->length);             start = block->offset;             size_in_block = block->length;             if (block->offset >= s->begin + s->length ||                 block->offset + block->length <= s->begin) {     RAMBlock *block;             if (s->begin + s->length < block->offset + block->length) {     RAMBlock *block;     QTAILQ_FOREACH(block, &ram_list.blocks, next) {     RAMBlock *block;     QTAILQ_FOREACH(block, &ram_list.blocks, next) {     RAMBlock *block;     QTAILQ_FOREACH(block, &ram_list.blocks, next) {     RAMBlock *block;
static void FUNC_0(hwaddr VAR_0,

                             ram_addr_t VAR_1,

                             DumpState *VAR_2,

                             hwaddr *VAR_3,

                             hwaddr *VAR_4)

{

    RAMBlock *block;

    hwaddr offset = VAR_2->memory_offset;

    int64_t size_in_block, start;



    

    *VAR_3 = -1;

    *VAR_4 = 0;



    if (VAR_2->has_filter) {

        if (VAR_0 < VAR_2->begin || VAR_0 >= VAR_2->begin + VAR_2->length) {

            return;

        }

    }



    QTAILQ_FOREACH(block, &ram_list.blocks, next) {

        if (VAR_2->has_filter) {

            if (block->offset >= VAR_2->begin + VAR_2->length ||

                block->offset + block->length <= VAR_2->begin) {

                

                continue;

            }



            if (VAR_2->begin <= block->offset) {

                start = block->offset;

            } else {

                start = VAR_2->begin;

            }



            size_in_block = block->length - (start - block->offset);

            if (VAR_2->begin + VAR_2->length < block->offset + block->length) {

                size_in_block -= block->offset + block->length -

                                 (VAR_2->begin + VAR_2->length);

            }

        } else {

            start = block->offset;

            size_in_block = block->length;

        }



        if (VAR_0 >= start && VAR_0 < start + size_in_block) {

            *VAR_3 = VAR_0 - start + offset;



            









            *VAR_4 = VAR_0 + VAR_1 <= start + size_in_block ?

                        VAR_1 :

                        size_in_block - (VAR_0 - start);

            return;

        }



        offset += size_in_block;

    }

}

static void FUNC_0(hwaddr VAR_0,
ram_addr_t VAR_1,
DumpState *VAR_2,
hwaddr *VAR_3,
hwaddr *VAR_4)
{ RAMBlock *block; hwaddr offset = VAR_2->memory_offset; int64_t size_in_block, start; *VAR_3 = -1; *VAR_4 = 0; if (VAR_2->has_filter) { if (VAR_0 < VAR_2->begin || VAR_0 >= VAR_2->begin + VAR_2->length) { return; } } QTAILQ_FOREACH(block, &ram_list.blocks, next) { if (VAR_2->has_filter) { if (block->offset >= VAR_2->begin + VAR_2->length ||
block->offset + block->length <= VAR_2->begin) { continue; } if (VAR_2->begin <= block->offset) { start = block->offset; } else { start = VAR_2->begin; } size_in_block = block->length - (start - block->offset); if (VAR_2->begin + VAR_2->length < block->offset + block->length) { size_in_block -= block->offset + block->length -
(VAR_2->begin + VAR_2->length); } } else { start = block->offset; size_in_block = block->length; } if (VAR_0 >= start && VAR_0 < start + size_in_block) { *VAR_3 = VAR_0 - start + offset; *VAR_4 = VAR_0 + VAR_1 <= start + size_in_block ?
VAR_1 :
size_in_block - (VAR_0 - start); return; } offset += size_in_block; } }