static int mon_init_func(void *opaque, QemuOpts *opts, Error **errp)

{

    CharDriverState *chr;

    const char *chardev;

    const char *mode;

    int flags;



    mode = qemu_opt_get(opts, "mode");

    if (mode == NULL) {

        mode = "readline";

    }

    if (strcmp(mode, "readline") == 0) {

        flags = MONITOR_USE_READLINE;

    } else if (strcmp(mode, "control") == 0) {

        flags = MONITOR_USE_CONTROL;

    } else {

        fprintf(stderr, "unknown monitor mode \"%s\"\n", mode);

        exit(1);

    }



    if (qemu_opt_get_bool(opts, "pretty", 0))

        flags |= MONITOR_USE_PRETTY;



    if (qemu_opt_get_bool(opts, "default", 0))

        flags |= MONITOR_IS_DEFAULT;



    chardev = qemu_opt_get(opts, "chardev");

    chr = qemu_chr_find(chardev);

    if (chr == NULL) {

        fprintf(stderr, "chardev \"%s\" not found\n", chardev);

        exit(1);

    }



    qemu_chr_fe_claim_no_fail(chr);

    monitor_init(chr, flags);

    return 0;

}

static int mon_init_func(void *opaque, QemuOpts *opts, Error **errp)

{

    CharDriverState *chr;

    const char *chardev;

    const char *mode;

    int flags;



    mode = qemu_opt_get(opts, "mode");

    if (mode == NULL) {

        mode = "readline";

    }

    if (strcmp(mode, "readline") == 0) {

        flags = MONITOR_USE_READLINE;

    } else if (strcmp(mode, "control") == 0) {

        flags = MONITOR_USE_CONTROL;

    } else {

        fprintf(stderr, "unknown monitor mode \"%s\"\n", mode);

        exit(1);

    }



    if (qemu_opt_get_bool(opts, "pretty", 0))

        flags |= MONITOR_USE_PRETTY;



    if (qemu_opt_get_bool(opts, "default", 0))

        flags |= MONITOR_IS_DEFAULT;



    chardev = qemu_opt_get(opts, "chardev");

    chr = qemu_chr_find(chardev);

    if (chr == NULL) {

        fprintf(stderr, "chardev \"%s\" not found\n", chardev);

        exit(1);

    }



    qemu_chr_fe_claim_no_fail(chr);

    monitor_init(chr, flags);

    return 0;

}

static int FUNC_0(void *VAR_0, QemuOpts *VAR_1, Error **VAR_2)

{

    CharDriverState *chr;

    const char *VAR_3;

    const char *VAR_4;

    int VAR_5;



    VAR_4 = qemu_opt_get(VAR_1, "VAR_4");

    if (VAR_4 == NULL) {

        VAR_4 = "readline";

    }

    if (strcmp(VAR_4, "readline") == 0) {

        VAR_5 = MONITOR_USE_READLINE;

    } else if (strcmp(VAR_4, "control") == 0) {

        VAR_5 = MONITOR_USE_CONTROL;

    } else {

        fprintf(stderr, "unknown monitor VAR_4 \"%s\"\n", VAR_4);

        exit(1);

    }



    if (qemu_opt_get_bool(VAR_1, "pretty", 0))

        VAR_5 |= MONITOR_USE_PRETTY;



    if (qemu_opt_get_bool(VAR_1, "default", 0))

        VAR_5 |= MONITOR_IS_DEFAULT;



    VAR_3 = qemu_opt_get(VAR_1, "VAR_3");

    chr = qemu_chr_find(VAR_3);

    if (chr == NULL) {

        fprintf(stderr, "VAR_3 \"%s\" not found\n", VAR_3);

        exit(1);

    }



    qemu_chr_fe_claim_no_fail(chr);

    monitor_init(chr, VAR_5);

    return 0;

}

static int FUNC_0(void *VAR_0, QemuOpts *VAR_1, Error **VAR_2)
{ CharDriverState *chr; const char *VAR_3; const char *VAR_4; int VAR_5; VAR_4 = qemu_opt_get(VAR_1, "VAR_4"); if (VAR_4 == NULL) { VAR_4 = "readline"; } if (strcmp(VAR_4, "readline") == 0) { VAR_5 = MONITOR_USE_READLINE; } else if (strcmp(VAR_4, "control") == 0) { VAR_5 = MONITOR_USE_CONTROL; } else { fprintf(stderr, "unknown monitor VAR_4 \"%s\"\n", VAR_4); exit(1); } if (qemu_opt_get_bool(VAR_1, "pretty", 0))
VAR_5 |= MONITOR_USE_PRETTY; if (qemu_opt_get_bool(VAR_1, "default", 0))
VAR_5 |= MONITOR_IS_DEFAULT; VAR_3 = qemu_opt_get(VAR_1, "VAR_3"); chr = qemu_chr_find(VAR_3); if (chr == NULL) { fprintf(stderr, "VAR_3 \"%s\" not found\n", VAR_3); exit(1); } qemu_chr_fe_claim_no_fail(chr); monitor_init(chr, VAR_5); return 0; }