void qtest_qmp(QTestState *s, const char *fmt, ...)
{
    va_list ap;
    bool has_reply = false;
    int nesting = 0;
    /* Send QMP request */
    va_start(ap, fmt);
    socket_sendf(s->qmp_fd, fmt, ap);
    va_end(ap);
    /* Receive reply */
    while (!has_reply || nesting > 0) {
        ssize_t len;
        char c;
        len = read(s->qmp_fd, &c, 1);
        if (len == -1 && errno == EINTR) {
            continue;
        switch (c) {
        case '{':
            nesting++;
            has_reply = true;
            break;
        case '}':
            nesting--;
            break;
void qtest_qmp(QTestState *s, const char *fmt, ...)
{
    va_list ap;
    bool has_reply = false;
    int nesting = 0;
    
    va_start(ap, fmt);
    socket_sendf(s->qmp_fd, fmt, ap);
    va_end(ap);
    
    while (!has_reply || nesting > 0) {
        ssize_t len;
        char c;
        len = read(s->qmp_fd, &c, 1);
        if (len == -1 && errno == EINTR) {
            continue;
        switch (c) {
        case '{':
            nesting++;
            has_reply = true;
            break;
        case '}':
            nesting--;
            break;
void FUNC_0(QTestState *VAR_0, const char *VAR_1, ...)
{
    va_list ap;
    bool has_reply = false;
    int VAR_2 = 0;
    
    va_start(ap, VAR_1);
    socket_sendf(VAR_0->qmp_fd, VAR_1, ap);
    va_end(ap);
    
    while (!has_reply || VAR_2 > 0) {
        ssize_t len;
        char VAR_3;
        len = read(VAR_0->qmp_fd, &VAR_3, 1);
        if (len == -1 && errno == EINTR) {
            continue;
        switch (VAR_3) {
        case '{':
            VAR_2++;
            has_reply = true;
            break;
        case '}':
            VAR_2--;
            break;
void FUNC_0(QTestState *VAR_0, const char *VAR_1, ...)
{ va_list ap; bool has_reply = false; int VAR_2 = 0; va_start(ap, VAR_1); socket_sendf(VAR_0->qmp_fd, VAR_1, ap); va_end(ap); while (!has_reply || VAR_2 > 0) { ssize_t len; char VAR_3; len = read(VAR_0->qmp_fd, &VAR_3, 1); if (len == -1 && errno == EINTR) { continue; switch (VAR_3) { case '{': VAR_2++; has_reply = true; break; case '}': VAR_2--; break;