// File: /workspace/github_c_makefile_star2_O0/icebert[P]pblat/htslib/cram/open_trace_file.c
// Function: open_path_mfile
mFILE *open_path_mfile(char *file, char *path, char *relative_to) {
    char *newsearch;
    char *ele;
    mFILE *fp;

    /* Use path first */
    if (!path)
	path = getenv("RAWDATA");
    if (NULL == (newsearch = tokenise_search_path(path)))
	return NULL;
    
    /*
     * Step through the search path testing out each component.
     * We now look through each path element treating some prefixes as
     * special, otherwise we treat the element as a directory.
     */
    for (ele = newsearch; *ele; ele += strlen(ele)+1) {
	char *ele2;

	/*
	 * '|' prefixing a path component indicates that we do not
	 * wish to perform the compression extension searching in that
	 * location.
	 *
	 * NB: this has been removed from the htslib implementation.
	 */
	if (*ele == '|') {
	    ele2 = ele+1;
	} else {
	    ele2 = ele;
	}

	if (0 == strncmp(ele2, "URL=", 4)) {
	    if ((fp = find_file_url(file, ele2+4))) {
		free(newsearch);
		return fp;
	    }
	} else if (!strncmp(ele2, "http:", 5) ||
		   !strncmp(ele2, "ftp:", 4)) {
	    if ((fp = find_file_url(file, ele2))) {
		free(newsearch);
		return fp;
	    }
	} else if ((fp = find_file_dir(file, ele2))) {
	    free(newsearch);
	    return fp;
	} 
    }

    free(newsearch);

    /* Look in the same location as the incoming 'relative_to' filename */
    if (relative_to) {
	char *cp;
	char relative_path[PATH_MAX+1];
	strcpy(relative_path, relative_to);
	if ((cp = strrchr(relative_path, '/')))
	    *cp = 0;
	if ((fp = find_file_dir(file, relative_path)))
	    return fp;
    }

    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1050, %rsp           # imm = 0x1050
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x8f79e
leaq 0x53cab(%rip), %rdi     # 0xe3440
callq 0x68d0
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x8f050
movq %rax, %rcx
movq %rcx, -0x28(%rbp)
xorl %eax, %eax
cmpq %rcx, %rax
jne 0x8f7c2
movq $0x0, -0x8(%rbp)
jmp 0x8f96c
movq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpb $0x0, (%rax)
je 0x8f8fc
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x7c, %eax
jne 0x8f7f1
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x8f7f9
movq -0x30(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
leaq 0x53c44(%rip), %rsi     # 0xe3448
movl $0x4, %edx
callq 0x6320
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x8f84c
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rsi
addq $0x4, %rsi
callq 0x8f4a0
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
je 0x8f847
movq -0x28(%rbp), %rdi
callq 0x6880
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x8f96c
jmp 0x8f8e0
movq -0x40(%rbp), %rdi
leaq 0x53bda(%rip), %rsi     # 0xe3431
movl $0x5, %edx
callq 0x6320
cmpl $0x0, %eax
je 0x8f880
movq -0x40(%rbp), %rdi
leaq 0x53bca(%rip), %rsi     # 0xe343b
movl $0x4, %edx
callq 0x6320
cmpl $0x0, %eax
jne 0x8f8af
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x8f4a0
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
je 0x8f8ad
movq -0x28(%rbp), %rdi
callq 0x6880
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x8f96c
jmp 0x8f8de
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x8f980
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
je 0x8f8dc
movq -0x28(%rbp), %rdi
callq 0x6880
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x8f96c
jmp 0x8f8de
jmp 0x8f8e0
jmp 0x8f8e2
movq -0x30(%rbp), %rdi
callq 0x62c0
addq $0x1, %rax
addq -0x30(%rbp), %rax
movq %rax, -0x30(%rbp)
jmp 0x8f7ca
movq -0x28(%rbp), %rdi
callq 0x6880
cmpq $0x0, -0x20(%rbp)
je 0x8f964
leaq -0x1050(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x6680
leaq -0x1050(%rbp), %rdi
movl $0x2f, %esi
callq 0x67b0
movq %rax, -0x48(%rbp)
cmpq $0x0, %rax
je 0x8f93e
movq -0x48(%rbp), %rax
movb $0x0, (%rax)
movq -0x10(%rbp), %rdi
leaq -0x1050(%rbp), %rsi
callq 0x8f980
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
je 0x8f962
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x8f96c
jmp 0x8f964
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x1050, %rsp           # imm = 0x1050
popq %rbp
retq
nopl (%rax)