static int htab_save_iterate(QEMUFile *f, void *opaque)

{

    sPAPRMachineState *spapr = opaque;

    int fd;

    int rc = 0;



    /* Iteration header */

    if (!spapr->htab_shift) {

        qemu_put_be32(f, -1);

        return 0;

    } else {

        qemu_put_be32(f, 0);

    }



    if (!spapr->htab) {

        assert(kvm_enabled());



        fd = get_htab_fd(spapr);

        if (fd < 0) {

            return fd;

        }



        rc = kvmppc_save_htab(f, fd, MAX_KVM_BUF_SIZE, MAX_ITERATION_NS);

        if (rc < 0) {

            return rc;

        }

    } else  if (spapr->htab_first_pass) {

        htab_save_first_pass(f, spapr, MAX_ITERATION_NS);

    } else {

        rc = htab_save_later_pass(f, spapr, MAX_ITERATION_NS);

    }



    /* End marker */

    qemu_put_be32(f, 0);

    qemu_put_be16(f, 0);

    qemu_put_be16(f, 0);



    return rc;

}

static int htab_save_iterate(QEMUFile *f, void *opaque)

{

    sPAPRMachineState *spapr = opaque;

    int fd;

    int rc = 0;



    

    if (!spapr->htab_shift) {

        qemu_put_be32(f, -1);

        return 0;

    } else {

        qemu_put_be32(f, 0);

    }



    if (!spapr->htab) {

        assert(kvm_enabled());



        fd = get_htab_fd(spapr);

        if (fd < 0) {

            return fd;

        }



        rc = kvmppc_save_htab(f, fd, MAX_KVM_BUF_SIZE, MAX_ITERATION_NS);

        if (rc < 0) {

            return rc;

        }

    } else  if (spapr->htab_first_pass) {

        htab_save_first_pass(f, spapr, MAX_ITERATION_NS);

    } else {

        rc = htab_save_later_pass(f, spapr, MAX_ITERATION_NS);

    }



    

    qemu_put_be32(f, 0);

    qemu_put_be16(f, 0);

    qemu_put_be16(f, 0);



    return rc;

}

static int FUNC_0(QEMUFile *VAR_0, void *VAR_1)

{

    sPAPRMachineState *spapr = VAR_1;

    int VAR_2;

    int VAR_3 = 0;



    

    if (!spapr->htab_shift) {

        qemu_put_be32(VAR_0, -1);

        return 0;

    } else {

        qemu_put_be32(VAR_0, 0);

    }



    if (!spapr->htab) {

        assert(kvm_enabled());



        VAR_2 = get_htab_fd(spapr);

        if (VAR_2 < 0) {

            return VAR_2;

        }



        VAR_3 = kvmppc_save_htab(VAR_0, VAR_2, MAX_KVM_BUF_SIZE, MAX_ITERATION_NS);

        if (VAR_3 < 0) {

            return VAR_3;

        }

    } else  if (spapr->htab_first_pass) {

        htab_save_first_pass(VAR_0, spapr, MAX_ITERATION_NS);

    } else {

        VAR_3 = htab_save_later_pass(VAR_0, spapr, MAX_ITERATION_NS);

    }



    

    qemu_put_be32(VAR_0, 0);

    qemu_put_be16(VAR_0, 0);

    qemu_put_be16(VAR_0, 0);



    return VAR_3;

}

static int FUNC_0(QEMUFile *VAR_0, void *VAR_1)
{ sPAPRMachineState *spapr = VAR_1; int VAR_2; int VAR_3 = 0; if (!spapr->htab_shift) { qemu_put_be32(VAR_0, -1); return 0; } else { qemu_put_be32(VAR_0, 0); } if (!spapr->htab) { assert(kvm_enabled()); VAR_2 = get_htab_fd(spapr); if (VAR_2 < 0) { return VAR_2; } VAR_3 = kvmppc_save_htab(VAR_0, VAR_2, MAX_KVM_BUF_SIZE, MAX_ITERATION_NS); if (VAR_3 < 0) { return VAR_3; } } else  if (spapr->htab_first_pass) { htab_save_first_pass(VAR_0, spapr, MAX_ITERATION_NS); } else { VAR_3 = htab_save_later_pass(VAR_0, spapr, MAX_ITERATION_NS); } qemu_put_be32(VAR_0, 0); qemu_put_be16(VAR_0, 0); qemu_put_be16(VAR_0, 0); return VAR_3; }