// File: /workspace/github_c_makefile_star2_O0/icebert[P]pblat/htslib/cram/open_trace_file.c
// Function: find_file_url
mFILE *find_file_url(char *file, char *url) {
    char buf[8192], *cp;
    mFILE *mf = NULL;
    int maxlen = 8190 - strlen(file), len;
    hFILE *hf;

    /* Expand %s for the trace name */
    for (cp = buf; *url && cp - buf < maxlen; url++) {
	if (*url == '%' && *(url+1) == 's') {
	    url++;
	    cp += strlen(strcpy(cp, file));
	} else {
	    *cp++ = *url;
	}
    }
    *cp++ = 0;

    if (!(hf = hopen(buf, "r")))
	return NULL;

    if (NULL == (mf = mfcreate(NULL, 0)))
	return NULL;
    while ((len = hread(hf, buf, 8192)) > 0) {
	if (mfwrite(buf, len, 1, mf) <= 0) {
	    hclose_abruptly(hf);
	    mfdestroy(mf);
	    return NULL;
	}
    }
    if (hclose(hf) < 0) {
	mfdestroy(mf);
	return NULL;
    }

    mrewind(mf);
    return mf;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2050, %rsp           # imm = 0x2050
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq $0x0, -0x2030(%rbp)
movq -0x10(%rbp), %rdi
callq 0x62c0
movq %rax, %rcx
movl $0x1ffe, %eax           # imm = 0x1FFE
subq %rcx, %rax
movl %eax, -0x2034(%rbp)
leaq -0x2020(%rbp), %rax
movq %rax, -0x2028(%rbp)
movq -0x18(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x2041(%rbp)
je 0x8f51e
movq -0x2028(%rbp), %rax
leaq -0x2020(%rbp), %rcx
subq %rcx, %rax
movslq -0x2034(%rbp), %rcx
cmpq %rcx, %rax
setl %al
movb %al, -0x2041(%rbp)
movb -0x2041(%rbp), %al
testb $0x1, %al
jne 0x8f52a
jmp 0x8f5a7
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x25, %eax
jne 0x8f577
movq -0x18(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x73, %eax
jne 0x8f577
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
movq -0x2028(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x6680
movq %rax, %rdi
callq 0x62c0
addq -0x2028(%rbp), %rax
movq %rax, -0x2028(%rbp)
jmp 0x8f594
movq -0x18(%rbp), %rax
movb (%rax), %cl
movq -0x2028(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x2028(%rbp)
movb %cl, (%rax)
jmp 0x8f596
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x8f4e6
movq -0x2028(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x2028(%rbp)
movb $0x0, (%rax)
leaq -0x2020(%rbp), %rdi
leaq 0x507c9(%rip), %rsi     # 0xdfd96
callq 0xa2a70
movq %rax, -0x2040(%rbp)
cmpq $0x0, %rax
jne 0x8f5ec
movq $0x0, -0x8(%rbp)
jmp 0x8f6c1
xorl %eax, %eax
movl %eax, %edi
xorl %esi, %esi
callq 0x8dc40
movq %rax, %rcx
movq %rcx, -0x2030(%rbp)
xorl %eax, %eax
cmpq %rcx, %rax
jne 0x8f615
movq $0x0, -0x8(%rbp)
jmp 0x8f6c1
jmp 0x8f617
movq -0x2040(%rbp), %rdi
leaq -0x2020(%rbp), %rsi
movl $0x2000, %edx           # imm = 0x2000
callq 0x8f6d0
movl %eax, -0x2038(%rbp)
cmpl $0x0, %eax
jle 0x8f683
leaq -0x2020(%rbp), %rdi
movslq -0x2038(%rbp), %rsi
movq -0x2030(%rbp), %rcx
movl $0x1, %edx
callq 0x8ea60
cmpq $0x0, %rax
ja 0x8f681
movq -0x2040(%rbp), %rdi
callq 0xa2480
movq -0x2030(%rbp), %rdi
callq 0x8e630
movq $0x0, -0x8(%rbp)
jmp 0x8f6c1
jmp 0x8f617
movq -0x2040(%rbp), %rdi
callq 0xa23e0
cmpl $0x0, %eax
jge 0x8f6aa
movq -0x2030(%rbp), %rdi
callq 0x8e630
movq $0x0, -0x8(%rbp)
jmp 0x8f6c1
movq -0x2030(%rbp), %rdi
callq 0x8e840
movq -0x2030(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x2050, %rsp           # imm = 0x2050
popq %rbp
retq
nop