// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/cram/open_trace_file.c
// Function: find_file_url
mFILE *find_file_url(const char *file, char *url) {
    char *path = NULL, buf[8192];
    mFILE *mf = NULL;
    ssize_t len;
    hFILE *hf = NULL;

    /* Expand %s for the trace name.  Only one digit is allowed between
       The % and s to avoid ambiguity with percent-encoded URLs */

    path = expand_path(file, url, 1);
    if (!path)
        return NULL;

    if (!(hf = hopen(path, "r"))) {
        if (errno != ENOENT)
            hts_log_warning("Failed to open reference \"%s\": %s", path, strerror(errno));
        goto fail;
    }

    if (NULL == (mf = mfcreate(NULL, 0)))
        goto fail;
    while ((len = hread(hf, buf, sizeof(buf))) > 0) {
        if (mfwrite(buf, len, 1, mf) <= 0) {
            hclose_abruptly(hf);
            goto fail;
        }
    }
    if (hclose(hf) < 0 || len < 0) {
        hts_log_warning("Failed to read reference \"%s\": %s", path, strerror(errno));
        goto fail;
    }

    free(path);
    mrewind(mf);
    return mf;

 fail:
    mfdestroy(mf);
    free(path);
    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2050, %rsp           # imm = 0x2050
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq $0x0, -0x2028(%rbp)
movq $0x0, -0x2038(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl $0x1, %edx
callq 0x816d0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x8153b
movq $0x0, -0x8(%rbp)
jmp 0x816b8
movq -0x20(%rbp), %rdi
leaq 0x715ab(%rip), %rsi     # 0xf2af1
movb $0x0, %al
callq 0x158b0
movq %rax, -0x2038(%rbp)
cmpq $0x0, %rax
jne 0x815a4
callq 0x4050
cmpl $0x2, (%rax)
je 0x8159f
movq -0x20(%rbp), %rax
movq %rax, -0x2040(%rbp)
callq 0x4050
movl (%rax), %edi
callq 0x4130
movq -0x2040(%rbp), %rcx
movq %rax, %r8
movl $0x3, %edi
leaq 0x74bd9(%rip), %rsi     # 0xf616a
leaq 0x74be0(%rip), %rdx     # 0xf6178
movb $0x0, %al
callq 0x1b030
jmp 0x8169b
xorl %eax, %eax
movl %eax, %edi
xorl %esi, %esi
callq 0x7fe30
movq %rax, %rcx
movq %rcx, -0x2028(%rbp)
xorl %eax, %eax
cmpq %rcx, %rax
jne 0x815c5
jmp 0x8169b
jmp 0x815c7
movq -0x2038(%rbp), %rdi
leaq -0x2020(%rbp), %rsi
movl $0x2000, %edx           # imm = 0x2000
callq 0x81a10
movq %rax, -0x2030(%rbp)
cmpq $0x0, %rax
jle 0x81621
leaq -0x2020(%rbp), %rdi
movq -0x2030(%rbp), %rsi
movq -0x2028(%rbp), %rcx
movl $0x1, %edx
callq 0x80c30
cmpq $0x0, %rax
ja 0x8161f
movq -0x2038(%rbp), %rdi
callq 0x149d0
jmp 0x8169b
jmp 0x815c7
movq -0x2038(%rbp), %rdi
callq 0x14920
cmpl $0x0, %eax
jl 0x8163c
cmpq $0x0, -0x2030(%rbp)
jge 0x81679
movq -0x20(%rbp), %rax
movq %rax, -0x2048(%rbp)
callq 0x4050
movl (%rax), %edi
callq 0x4130
movq -0x2048(%rbp), %rcx
movq %rax, %r8
movl $0x3, %edi
leaq 0x74b01(%rip), %rsi     # 0xf616a
leaq 0x74b2a(%rip), %rdx     # 0xf619a
movb $0x0, %al
callq 0x1b030
jmp 0x8169b
movq -0x20(%rbp), %rdi
callq 0x45a0
movq -0x2028(%rbp), %rdi
callq 0x80a10
movq -0x2028(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x816b8
movq -0x2028(%rbp), %rdi
callq 0x80800
movq -0x20(%rbp), %rdi
callq 0x45a0
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x2050, %rsp           # imm = 0x2050
popq %rbp
retq
nopw %cs:(%rax,%rax)