static void wait_for_serial(const char *side)

{

    char *serialpath = g_strdup_printf("%s/%s", tmpfs, side);

    FILE *serialfile = fopen(serialpath, "r");

    const char *arch = qtest_get_arch();

    int started = (strcmp(side, "src_serial") == 0 &&

                   strcmp(arch, "ppc64") == 0) ? 0 : 1;



    do {

        int readvalue = fgetc(serialfile);



        if (!started) {

            /* SLOF prints its banner before starting test,

             * to ignore it, mark the start of the test with '_',

             * ignore all characters until this marker

             */

            switch (readvalue) {

            case '_':

                started = 1;

                break;

            case EOF:

                fseek(serialfile, 0, SEEK_SET);

                usleep(1000);

                break;

            }

            continue;

        }

        switch (readvalue) {

        case 'A':

            /* Fine */

            break;



        case 'B':

            /* It's alive! */

            fclose(serialfile);

            g_free(serialpath);

            return;



        case EOF:

            started = (strcmp(side, "src_serial") == 0 &&

                       strcmp(arch, "ppc64") == 0) ? 0 : 1;

            fseek(serialfile, 0, SEEK_SET);

            usleep(1000);

            break;



        default:

            fprintf(stderr, "Unexpected %d on %s serial\n", readvalue, side);

            g_assert_not_reached();

        }

    } while (true);

}

static void wait_for_serial(const char *side)

{

    char *serialpath = g_strdup_printf("%s/%s", tmpfs, side);

    FILE *serialfile = fopen(serialpath, "r");

    const char *arch = qtest_get_arch();

    int started = (strcmp(side, "src_serial") == 0 &&

                   strcmp(arch, "ppc64") == 0) ? 0 : 1;



    do {

        int readvalue = fgetc(serialfile);



        if (!started) {

            







            switch (readvalue) {

            case '_':

                started = 1;

                break;

            case EOF:

                fseek(serialfile, 0, SEEK_SET);

                usleep(1000);

                break;

            }

            continue;

        }

        switch (readvalue) {

        case 'A':

            

            break;



        case 'B':

            

            fclose(serialfile);

            g_free(serialpath);

            return;



        case EOF:

            started = (strcmp(side, "src_serial") == 0 &&

                       strcmp(arch, "ppc64") == 0) ? 0 : 1;

            fseek(serialfile, 0, SEEK_SET);

            usleep(1000);

            break;



        default:

            fprintf(stderr, "Unexpected %d on %s serial\n", readvalue, side);

            g_assert_not_reached();

        }

    } while (true);

}

            g_free(serialpath);
static void FUNC_0(const char *VAR_0)

{

    char *VAR_1 = g_strdup_printf("%s/%s", tmpfs, VAR_0);

    FILE *serialfile = fopen(VAR_1, "r");

    const char *VAR_2 = qtest_get_arch();

    int VAR_3 = (strcmp(VAR_0, "src_serial") == 0 &&

                   strcmp(VAR_2, "ppc64") == 0) ? 0 : 1;



    do {

        int VAR_4 = fgetc(serialfile);



        if (!VAR_3) {

            







            switch (VAR_4) {

            case '_':

                VAR_3 = 1;

                break;

            case EOF:

                fseek(serialfile, 0, SEEK_SET);

                usleep(1000);

                break;

            }

            continue;

        }

        switch (VAR_4) {

        case 'A':

            

            break;



        case 'B':

            

            fclose(serialfile);

            g_free(VAR_1);

            return;



        case EOF:

            VAR_3 = (strcmp(VAR_0, "src_serial") == 0 &&

                       strcmp(VAR_2, "ppc64") == 0) ? 0 : 1;

            fseek(serialfile, 0, SEEK_SET);

            usleep(1000);

            break;



        default:

            fprintf(stderr, "Unexpected %d on %s serial\n", VAR_4, VAR_0);

            g_assert_not_reached();

        }

    } while (true);

}

static void FUNC_0(const char *VAR_0)
{ char *VAR_1 = g_strdup_printf("%s/%s", tmpfs, VAR_0); FILE *serialfile = fopen(VAR_1, "r"); const char *VAR_2 = qtest_get_arch(); int VAR_3 = (strcmp(VAR_0, "src_serial") == 0 &&
strcmp(VAR_2, "ppc64") == 0) ? 0 : 1; do { int VAR_4 = fgetc(serialfile); if (!VAR_3) { switch (VAR_4) { case '_':
VAR_3 = 1; break; case EOF:
fseek(serialfile, 0, SEEK_SET); usleep(1000); break; } continue; } switch (VAR_4) { case 'A':
break; case 'B':
fclose(serialfile); g_free(VAR_1); return; case EOF:
VAR_3 = (strcmp(VAR_0, "src_serial") == 0 &&
strcmp(VAR_2, "ppc64") == 0) ? 0 : 1; fseek(serialfile, 0, SEEK_SET); usleep(1000); break; default:
fprintf(stderr, "Unexpected %d on %s serial\n", VAR_4, VAR_0); g_assert_not_reached(); } } while (true); }