// File: /workspace/github_c_makefile_star2_O3/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 0x2a2d3
leaq 0x66cb3(%rip), %rdi     # 0x90f7f
xorl %eax, %eax
callq 0x26e94
testq %r15, %r15
je 0x2a2ec
leaq 0x65f7a(%rip), %rdx     # 0x90259
movq %rsp, %rdi
movl $0x1000, %esi           # imm = 0x1000
movq %r15, %rcx
jmp 0x2a2fe
leaq 0x66cb4(%rip), %rdx     # 0x90fa7
movq %rsp, %rdi
movl $0x1000, %esi           # imm = 0x1000
movq %r14, %rcx
xorl %eax, %eax
callq 0x23f33
leaq 0x6bbfd(%rip), %rsi     # 0x95f09
movq %r14, %rdi
callq 0x4e07e
testq %rax, %rax
je 0x2a3ba
movq %rax, %r13
movq %rsp, %rsi
movq %r14, %rdi
callq 0x53228
testq %rax, %rax
je 0x2a3c9
movq %rax, %r12
movl $0xc8, %edi
callq 0x2dff4
movq %rax, %r15
movq %r14, %rdi
callq 0x1feba
movq %rax, 0x8(%r15)
movabsq $0x10000ffffffff, %rax  # imm = 0x10000FFFFFFFF
movq %rax, 0x10(%r15)
movl $0x10000, %edi          # imm = 0x10000
callq 0x2dff4
movq %rax, 0x40(%r15)
movb %bl, 0x34(%r15)
movq %r12, 0x70(%r15)
movq %r13, 0x68(%r15)
movl $0x18, %edi
callq 0x2dff4
movq %rax, %rbx
movl $0x2000, %edi           # imm = 0x2000
callq 0x69d0
movq %rax, 0x10(%rbx)
movq %rbx, 0x80(%r15)
movq 0x18(%r12), %rdi
leaq 0x28872(%rip), %r8      # 0x52c18
movl $0xfffffffc, %esi       # imm = 0xFFFFFFFC
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x50f9e
movq %rax, 0x78(%r15)
jmp 0x2a3dd
leaq 0x66bed(%rip), %rdi     # 0x90fae
xorl %r15d, %r15d
movq %r14, %rsi
jmp 0x2a3d6
leaq 0x66bf2(%rip), %rdi     # 0x90fc2
xorl %r15d, %r15d
movq %rsp, %rsi
xorl %eax, %eax
callq 0x26bea
movq %r15, %rax
addq $0x1000, %rsp           # imm = 0x1000
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq