static void close_unused_images(BlockDriverState *top, BlockDriverState *base,

                                const char *base_id)

{

    BlockDriverState *intermediate;

    intermediate = top->backing_hd;



    while (intermediate) {

        BlockDriverState *unused;



        /* reached base */

        if (intermediate == base) {

            break;

        }



        unused = intermediate;

        intermediate = intermediate->backing_hd;

        unused->backing_hd = NULL;

        bdrv_delete(unused);

    }

    top->backing_hd = base;

}

static void close_unused_images(BlockDriverState *top, BlockDriverState *base,

                                const char *base_id)

{

    BlockDriverState *intermediate;

    intermediate = top->backing_hd;



    while (intermediate) {

        BlockDriverState *unused;



        

        if (intermediate == base) {

            break;

        }



        unused = intermediate;

        intermediate = intermediate->backing_hd;

        unused->backing_hd = NULL;

        bdrv_delete(unused);

    }

    top->backing_hd = base;

}

static void FUNC_0(BlockDriverState *VAR_0, BlockDriverState *VAR_1,

                                const char *VAR_2)

{

    BlockDriverState *intermediate;

    intermediate = VAR_0->backing_hd;



    while (intermediate) {

        BlockDriverState *unused;



        

        if (intermediate == VAR_1) {

            break;

        }



        unused = intermediate;

        intermediate = intermediate->backing_hd;

        unused->backing_hd = NULL;

        bdrv_delete(unused);

    }

    VAR_0->backing_hd = VAR_1;

}

static void FUNC_0(BlockDriverState *VAR_0, BlockDriverState *VAR_1,
const char *VAR_2)
{ BlockDriverState *intermediate; intermediate = VAR_0->backing_hd; while (intermediate) { BlockDriverState *unused; if (intermediate == VAR_1) { break; } unused = intermediate; intermediate = intermediate->backing_hd; unused->backing_hd = NULL; bdrv_delete(unused); } VAR_0->backing_hd = VAR_1; }