void qmp_dump_guest_memory(bool paging, const char *file, bool has_begin,

                           int64_t begin, bool has_length, int64_t length,

                           Error **errp)

{

    const char *p;

    int fd = -1;

    DumpState *s;

    int ret;



    if (has_begin && !has_length) {

        error_set(errp, QERR_MISSING_PARAMETER, "length");

        return;

    }

    if (!has_begin && has_length) {

        error_set(errp, QERR_MISSING_PARAMETER, "begin");

        return;

    }



#if !defined(WIN32)

    if (strstart(file, "fd:", &p)) {

        fd = monitor_get_fd(cur_mon, p, errp);

        if (fd == -1) {

            return;

        }

    }

#endif



    if  (strstart(file, "file:", &p)) {

        fd = qemu_open(p, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IRUSR);

        if (fd < 0) {

            error_setg_file_open(errp, errno, p);

            return;

        }

    }



    if (fd == -1) {

        error_set(errp, QERR_INVALID_PARAMETER, "protocol");

        return;

    }



    s = g_malloc(sizeof(DumpState));



    ret = dump_init(s, fd, paging, has_begin, begin, length, errp);

    if (ret < 0) {

        g_free(s);

        return;

    }



    if (create_vmcore(s) < 0 && !error_is_set(s->errp)) {

        error_set(errp, QERR_IO_ERROR);

    }



    g_free(s);

}

void qmp_dump_guest_memory(bool paging, const char *file, bool has_begin,

                           int64_t begin, bool has_length, int64_t length,

                           Error **errp)

{

    const char *p;

    int fd = -1;

    DumpState *s;

    int ret;



    if (has_begin && !has_length) {

        error_set(errp, QERR_MISSING_PARAMETER, "length");

        return;

    }

    if (!has_begin && has_length) {

        error_set(errp, QERR_MISSING_PARAMETER, "begin");

        return;

    }



#if !defined(WIN32)

    if (strstart(file, "fd:", &p)) {

        fd = monitor_get_fd(cur_mon, p, errp);

        if (fd == -1) {

            return;

        }

    }

#endif



    if  (strstart(file, "file:", &p)) {

        fd = qemu_open(p, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IRUSR);

        if (fd < 0) {

            error_setg_file_open(errp, errno, p);

            return;

        }

    }



    if (fd == -1) {

        error_set(errp, QERR_INVALID_PARAMETER, "protocol");

        return;

    }



    s = g_malloc(sizeof(DumpState));



    ret = dump_init(s, fd, paging, has_begin, begin, length, errp);

    if (ret < 0) {

        g_free(s);

        return;

    }



    if (create_vmcore(s) < 0 && !error_is_set(s->errp)) {

        error_set(errp, QERR_IO_ERROR);

    }



    g_free(s);

}

void FUNC_0(bool VAR_0, const char *VAR_1, bool VAR_2,

                           int64_t VAR_3, bool VAR_4, int64_t VAR_5,

                           Error **VAR_6)

{

    const char *VAR_7;

    int VAR_8 = -1;

    DumpState *s;

    int VAR_9;



    if (VAR_2 && !VAR_4) {

        error_set(VAR_6, QERR_MISSING_PARAMETER, "VAR_5");

        return;

    }

    if (!VAR_2 && VAR_4) {

        error_set(VAR_6, QERR_MISSING_PARAMETER, "VAR_3");

        return;

    }



#if !defined(WIN32)

    if (strstart(VAR_1, "VAR_8:", &VAR_7)) {

        VAR_8 = monitor_get_fd(cur_mon, VAR_7, VAR_6);

        if (VAR_8 == -1) {

            return;

        }

    }

#endif



    if  (strstart(VAR_1, "VAR_1:", &VAR_7)) {

        VAR_8 = qemu_open(VAR_7, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IRUSR);

        if (VAR_8 < 0) {

            error_setg_file_open(VAR_6, errno, VAR_7);

            return;

        }

    }



    if (VAR_8 == -1) {

        error_set(VAR_6, QERR_INVALID_PARAMETER, "protocol");

        return;

    }



    s = g_malloc(sizeof(DumpState));



    VAR_9 = dump_init(s, VAR_8, VAR_0, VAR_2, VAR_3, VAR_5, VAR_6);

    if (VAR_9 < 0) {

        g_free(s);

        return;

    }



    if (create_vmcore(s) < 0 && !error_is_set(s->VAR_6)) {

        error_set(VAR_6, QERR_IO_ERROR);

    }



    g_free(s);

}

void FUNC_0(bool VAR_0, const char *VAR_1, bool VAR_2,
int64_t VAR_3, bool VAR_4, int64_t VAR_5,
Error **VAR_6)
{ const char *VAR_7; int VAR_8 = -1; DumpState *s; int VAR_9; if (VAR_2 && !VAR_4) { error_set(VAR_6, QERR_MISSING_PARAMETER, "VAR_5"); return; } if (!VAR_2 && VAR_4) { error_set(VAR_6, QERR_MISSING_PARAMETER, "VAR_3"); return; } #if !defined(WIN32)
if (strstart(VAR_1, "VAR_8:", &VAR_7)) { VAR_8 = monitor_get_fd(cur_mon, VAR_7, VAR_6); if (VAR_8 == -1) { return; } } #endif
if  (strstart(VAR_1, "VAR_1:", &VAR_7)) { VAR_8 = qemu_open(VAR_7, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IRUSR); if (VAR_8 < 0) { error_setg_file_open(VAR_6, errno, VAR_7); return; } } if (VAR_8 == -1) { error_set(VAR_6, QERR_INVALID_PARAMETER, "protocol"); return; } s = g_malloc(sizeof(DumpState)); VAR_9 = dump_init(s, VAR_8, VAR_0, VAR_2, VAR_3, VAR_5, VAR_6); if (VAR_9 < 0) { g_free(s); return; } if (create_vmcore(s) < 0 && !error_is_set(s->VAR_6)) { error_set(VAR_6, QERR_IO_ERROR); } g_free(s); }