static void spapr_cpu_core_unrealizefn(DeviceState *dev, Error **errp)

{

    sPAPRCPUCore *sc = SPAPR_CPU_CORE(OBJECT(dev));

    sPAPRCPUCoreClass *scc = SPAPR_CPU_CORE_GET_CLASS(OBJECT(dev));

    size_t size = object_type_get_instance_size(scc->cpu_type);

    CPUCore *cc = CPU_CORE(dev);

    int i;



    for (i = 0; i < cc->nr_threads; i++) {

        void *obj = sc->threads + i * size;

        DeviceState *dev = DEVICE(obj);

        CPUState *cs = CPU(dev);

        PowerPCCPU *cpu = POWERPC_CPU(cs);



        spapr_cpu_destroy(cpu);

        object_unparent(cpu->intc);

        cpu_remove_sync(cs);

        object_unparent(obj);

    }

    g_free(sc->threads);

}

static void spapr_cpu_core_unrealizefn(DeviceState *dev, Error **errp)

{

    sPAPRCPUCore *sc = SPAPR_CPU_CORE(OBJECT(dev));

    sPAPRCPUCoreClass *scc = SPAPR_CPU_CORE_GET_CLASS(OBJECT(dev));

    size_t size = object_type_get_instance_size(scc->cpu_type);

    CPUCore *cc = CPU_CORE(dev);

    int i;



    for (i = 0; i < cc->nr_threads; i++) {

        void *obj = sc->threads + i * size;

        DeviceState *dev = DEVICE(obj);

        CPUState *cs = CPU(dev);

        PowerPCCPU *cpu = POWERPC_CPU(cs);



        spapr_cpu_destroy(cpu);

        object_unparent(cpu->intc);

        cpu_remove_sync(cs);

        object_unparent(obj);

    }

    g_free(sc->threads);

}

static void FUNC_0(DeviceState *VAR_0, Error **VAR_1)

{

    sPAPRCPUCore *sc = SPAPR_CPU_CORE(OBJECT(VAR_0));

    sPAPRCPUCoreClass *scc = SPAPR_CPU_CORE_GET_CLASS(OBJECT(VAR_0));

    size_t size = object_type_get_instance_size(scc->cpu_type);

    CPUCore *cc = CPU_CORE(VAR_0);

    int VAR_2;



    for (VAR_2 = 0; VAR_2 < cc->nr_threads; VAR_2++) {

        void *obj = sc->threads + VAR_2 * size;

        DeviceState *VAR_0 = DEVICE(obj);

        CPUState *cs = CPU(VAR_0);

        PowerPCCPU *cpu = POWERPC_CPU(cs);



        spapr_cpu_destroy(cpu);

        object_unparent(cpu->intc);

        cpu_remove_sync(cs);

        object_unparent(obj);

    }

    g_free(sc->threads);

}

static void FUNC_0(DeviceState *VAR_0, Error **VAR_1)
{ sPAPRCPUCore *sc = SPAPR_CPU_CORE(OBJECT(VAR_0)); sPAPRCPUCoreClass *scc = SPAPR_CPU_CORE_GET_CLASS(OBJECT(VAR_0)); size_t size = object_type_get_instance_size(scc->cpu_type); CPUCore *cc = CPU_CORE(VAR_0); int VAR_2; for (VAR_2 = 0; VAR_2 < cc->nr_threads; VAR_2++) { void *obj = sc->threads + VAR_2 * size; DeviceState *VAR_0 = DEVICE(obj); CPUState *cs = CPU(VAR_0); PowerPCCPU *cpu = POWERPC_CPU(cs); spapr_cpu_destroy(cpu); object_unparent(cpu->intc); cpu_remove_sync(cs); object_unparent(obj); } g_free(sc->threads); }