char *qemu_find_file(int type, const char *name)

{

    int len;

    const char *subdir;

    char *buf;



    /* If name contains path separators then try it as a straight path.  */

    if ((strchr(name, '/') || strchr(name, '\\'))

        && access(name, R_OK) == 0) {

        return g_strdup(name);

    }

    switch (type) {

    case QEMU_FILE_TYPE_BIOS:

        subdir = "";

        break;

    case QEMU_FILE_TYPE_KEYMAP:

        subdir = "keymaps/";

        break;

    default:

        abort();

    }

    len = strlen(data_dir) + strlen(name) + strlen(subdir) + 2;

    buf = g_malloc0(len);

    snprintf(buf, len, "%s/%s%s", data_dir, subdir, name);

    if (access(buf, R_OK)) {

        g_free(buf);

        return NULL;

    }

    return buf;

}

char *qemu_find_file(int type, const char *name)

{

    int len;

    const char *subdir;

    char *buf;



    

    if ((strchr(name, '/') || strchr(name, '\\'))

        && access(name, R_OK) == 0) {

        return g_strdup(name);

    }

    switch (type) {

    case QEMU_FILE_TYPE_BIOS:

        subdir = "";

        break;

    case QEMU_FILE_TYPE_KEYMAP:

        subdir = "keymaps/";

        break;

    default:

        abort();

    }

    len = strlen(data_dir) + strlen(name) + strlen(subdir) + 2;

    buf = g_malloc0(len);

    snprintf(buf, len, "%s/%s%s", data_dir, subdir, name);

    if (access(buf, R_OK)) {

        g_free(buf);

        return NULL;

    }

    return buf;

}

char *FUNC_0(int VAR_0, const char *VAR_1)

{

    int VAR_2;

    const char *VAR_3;

    char *VAR_4;



    

    if ((strchr(VAR_1, '/') || strchr(VAR_1, '\\'))

        && access(VAR_1, R_OK) == 0) {

        return g_strdup(VAR_1);

    }

    switch (VAR_0) {

    case QEMU_FILE_TYPE_BIOS:

        VAR_3 = "";

        break;

    case QEMU_FILE_TYPE_KEYMAP:

        VAR_3 = "keymaps/";

        break;

    default:

        abort();

    }

    VAR_2 = strlen(data_dir) + strlen(VAR_1) + strlen(VAR_3) + 2;

    VAR_4 = g_malloc0(VAR_2);

    snprintf(VAR_4, VAR_2, "%s/%s%s", data_dir, VAR_3, VAR_1);

    if (access(VAR_4, R_OK)) {

        g_free(VAR_4);

        return NULL;

    }

    return VAR_4;

}

char *FUNC_0(int VAR_0, const char *VAR_1)
{ int VAR_2; const char *VAR_3; char *VAR_4; if ((strchr(VAR_1, '/') || strchr(VAR_1, '\\'))
&& access(VAR_1, R_OK) == 0) { return g_strdup(VAR_1); } switch (VAR_0) { case QEMU_FILE_TYPE_BIOS:
VAR_3 = ""; break; case QEMU_FILE_TYPE_KEYMAP:
VAR_3 = "keymaps/"; break; default:
abort(); } VAR_2 = strlen(data_dir) + strlen(VAR_1) + strlen(VAR_3) + 2; VAR_4 = g_malloc0(VAR_2); snprintf(VAR_4, VAR_2, "%s/%s%s", data_dir, VAR_3, VAR_1); if (access(VAR_4, R_OK)) { g_free(VAR_4); return NULL; } return VAR_4; }