// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/lib/linefile.c
// Function: lineFileTabixAndIndexMayOpen
struct lineFile *lineFileTabixAndIndexMayOpen(char *fileOrUrl, char *tbiFileOrUrl, bool zTerm)
/* Wrap a line file around a data file that has been compressed and indexed
 * by the tabix command line program. tbiFileOrUrl can be NULL, it defaults to <fileOrUrl>.tbi.
 * It must be readable in addition to fileOrUrl. If there's a problem, warn & return NULL.
 * This works only if kent/src has been compiled with USE_TABIX=1 and linked
 * with the tabix C library. */
{
if (fileOrUrl == NULL)
    errAbort("lineFileTabixMayOpen: fileOrUrl is NULL");

char tbiName[4096];
if (tbiFileOrUrl==NULL)
    safef(tbiName, sizeof(tbiName), "%s.tbi", fileOrUrl);
else
    safef(tbiName, sizeof(tbiName), "%s", tbiFileOrUrl);

htsFile *htsFile = hts_open(fileOrUrl, "r");
if (htsFile == NULL)
    {
    warn("Unable to open \"%s\"", fileOrUrl);
    return NULL;
    }
tbx_t *tabix;
if ((tabix = tbx_index_load2(fileOrUrl, tbiName)) == NULL)
    {
    warn("Unable to load tabix index from \"%s\"", tbiName);
    if (tabix)
        ti_close(tabix);
    tabix = NULL;
    return NULL;
    }
struct lineFile *lf = needMem(sizeof(struct lineFile));
lf->fileName = cloneString(fileOrUrl);
lf->fd = -1;
lf->bufSize = 64 * 1024;
lf->buf = needMem(lf->bufSize);
lf->zTerm = zTerm;
lf->tabix = tabix;
lf->htsFile = htsFile;
kstring_t *kline;
AllocVar(kline);
kline->s = malloc(8192);
lf->kline = kline;
lf->tabixIter = tbx_itr_queryi(tabix, HTS_IDX_REST, 0, 0);
return lf;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1000, %rsp           # imm = 0x1000
movl %edx, %ebx
movq %rsi, %r15
movq %rdi, %r14
testq %rdi, %rdi
jne 0x251f3
leaq 0x5ac93(%rip), %rdi     # 0x7fe7f
xorl %eax, %eax
callq 0x223fb
testq %r15, %r15
je 0x2520c
leaq 0x59f8a(%rip), %rdx     # 0x7f189
movq %rsp, %rdi
movl $0x1000, %esi           # imm = 0x1000
movq %r15, %rcx
jmp 0x2521e
leaq 0x5ac94(%rip), %rdx     # 0x7fea7
movq %rsp, %rdi
movl $0x1000, %esi           # imm = 0x1000
movq %r14, %rcx
xorl %eax, %eax
callq 0x1fab2
leaq 0x5fbdd(%rip), %rsi     # 0x84e09
movq %r14, %rdi
callq 0x4710c
testq %rax, %rax
je 0x252d6
movq %rax, %r13
movq %rsp, %rsi
movq %r14, %rdi
callq 0x4b723
testq %rax, %rax
je 0x252e5
movq %rax, %r12
movl $0xc8, %edi
callq 0x28bb0
movq %rax, %r15
movq %r14, %rdi
callq 0x1c306
movq %rax, 0x8(%r15)
movabsq $0x10000ffffffff, %rax  # imm = 0x10000FFFFFFFF
movq %rax, 0x10(%r15)
movl $0x10000, %edi          # imm = 0x10000
callq 0x28bb0
movq %rax, 0x40(%r15)
movb %bl, 0x34(%r15)
movq %r12, 0x70(%r15)
movq %r13, 0x68(%r15)
pushq $0x18
popq %rdi
callq 0x28bb0
movq %rax, %rbx
movl $0x2000, %edi           # imm = 0x2000
callq 0x69d0
movq %rax, 0x10(%rbx)
movq %rbx, 0x80(%r15)
movq 0x18(%r12), %rdi
leaq 0x25f3b(%rip), %r8      # 0x4b1ff
pushq $-0x4
popq %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x49973
movq %rax, 0x78(%r15)
jmp 0x252f9
leaq 0x5abd1(%rip), %rdi     # 0x7feae
xorl %r15d, %r15d
movq %r14, %rsi
jmp 0x252f2
leaq 0x5abd6(%rip), %rdi     # 0x7fec2
xorl %r15d, %r15d
movq %rsp, %rsi
xorl %eax, %eax
callq 0x22186
movq %r15, %rax
addq $0x1000, %rsp           # imm = 0x1000
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq