void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner,
                                          const char *name,
                                          uint64_t ram_size)
{
    uint64_t addr = 0;
    int i;
    if (nb_numa_nodes == 0 || !have_memdevs) {
        allocate_system_memory_nonnuma(mr, owner, name, ram_size);
        return;
    memory_region_init(mr, owner, name, ram_size);
    for (i = 0; i < MAX_NODES; i++) {
        Error *local_err = NULL;
        uint64_t size = numa_info[i].node_mem;
        HostMemoryBackend *backend = numa_info[i].node_memdev;
        if (!backend) {
            continue;
        MemoryRegion *seg = host_memory_backend_get_memory(backend, &local_err);
        if (local_err) {
            qerror_report_err(local_err);
        memory_region_add_subregion(mr, addr, seg);
        vmstate_register_ram_global(seg);
        addr += size;
void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner,
                                          const char *name,
                                          uint64_t ram_size)
{
    uint64_t addr = 0;
    int i;
    if (nb_numa_nodes == 0 || !have_memdevs) {
        allocate_system_memory_nonnuma(mr, owner, name, ram_size);
        return;
    memory_region_init(mr, owner, name, ram_size);
    for (i = 0; i < MAX_NODES; i++) {
        Error *local_err = NULL;
        uint64_t size = numa_info[i].node_mem;
        HostMemoryBackend *backend = numa_info[i].node_memdev;
        if (!backend) {
            continue;
        MemoryRegion *seg = host_memory_backend_get_memory(backend, &local_err);
        if (local_err) {
            qerror_report_err(local_err);
        memory_region_add_subregion(mr, addr, seg);
        vmstate_register_ram_global(seg);
        addr += size;
void FUNC_0(MemoryRegion *VAR_0, Object *VAR_1,
                                          const char *VAR_2,
                                          uint64_t VAR_3)
{
    uint64_t addr = 0;
    int VAR_4;
    if (nb_numa_nodes == 0 || !have_memdevs) {
        allocate_system_memory_nonnuma(VAR_0, VAR_1, VAR_2, VAR_3);
        return;
    memory_region_init(VAR_0, VAR_1, VAR_2, VAR_3);
    for (VAR_4 = 0; VAR_4 < MAX_NODES; VAR_4++) {
        Error *local_err = NULL;
        uint64_t size = numa_info[VAR_4].node_mem;
        HostMemoryBackend *backend = numa_info[VAR_4].node_memdev;
        if (!backend) {
            continue;
        MemoryRegion *seg = host_memory_backend_get_memory(backend, &local_err);
        if (local_err) {
            qerror_report_err(local_err);
        memory_region_add_subregion(VAR_0, addr, seg);
        vmstate_register_ram_global(seg);
        addr += size;
void FUNC_0(MemoryRegion *VAR_0, Object *VAR_1,
const char *VAR_2,
uint64_t VAR_3)
{ uint64_t addr = 0; int VAR_4; if (nb_numa_nodes == 0 || !have_memdevs) { allocate_system_memory_nonnuma(VAR_0, VAR_1, VAR_2, VAR_3); return; memory_region_init(VAR_0, VAR_1, VAR_2, VAR_3); for (VAR_4 = 0; VAR_4 < MAX_NODES; VAR_4++) { Error *local_err = NULL; uint64_t size = numa_info[VAR_4].node_mem; HostMemoryBackend *backend = numa_info[VAR_4].node_memdev; if (!backend) { continue; MemoryRegion *seg = host_memory_backend_get_memory(backend, &local_err); if (local_err) { qerror_report_err(local_err); memory_region_add_subregion(VAR_0, addr, seg); vmstate_register_ram_global(seg); addr += size;