// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x1040, %rsp           # imm = 0x1040
movb %dl, %al
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movb %al, -0x19(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x3ae7d
leaq 0x9fec1(%rip), %rdi     # 0xdad37
movb $0x0, %al
callq 0x35d40
cmpq $0x0, -0x18(%rbp)
jne 0x3aea4
leaq -0x1020(%rbp), %rdi
movq -0x10(%rbp), %rcx
movl $0x1000, %esi           # imm = 0x1000
leaq 0x9fec4(%rip), %rdx     # 0xdad5f
movb $0x0, %al
callq 0x31090
jmp 0x3aec2
leaq -0x1020(%rbp), %rdi
movq -0x18(%rbp), %rcx
movl $0x1000, %esi           # imm = 0x1000
leaq 0x9f156(%rip), %rdx     # 0xda011
movb $0x0, %al
callq 0x31090
movq -0x10(%rbp), %rdi
leaq 0xa4ec9(%rip), %rsi     # 0xdfd96
callq 0x71680
movq %rax, -0x1028(%rbp)
cmpq $0x0, -0x1028(%rbp)
jne 0x3af02
movq -0x10(%rbp), %rsi
leaq 0x9fe78(%rip), %rdi     # 0xdad66
movb $0x0, %al
callq 0x358e0
movq $0x0, -0x8(%rbp)
jmp 0x3b06c
movq -0x10(%rbp), %rdi
leaq -0x1020(%rbp), %rsi
callq 0x799f0
movq %rax, -0x1030(%rbp)
cmpq $0x0, %rax
jne 0x3af62
leaq -0x1020(%rbp), %rsi
leaq 0x9fe4d(%rip), %rdi     # 0xdad7a
movb $0x0, %al
callq 0x358e0
cmpq $0x0, -0x1030(%rbp)
je 0x3af4a
movq -0x1030(%rbp), %rdi
callq 0x79810
movq $0x0, -0x1030(%rbp)
movq $0x0, -0x8(%rbp)
jmp 0x3b06c
movl $0xc8, %edi
callq 0x40c50
movq %rax, -0x1038(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2a450
movq %rax, %rcx
movq -0x1038(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x1038(%rbp), %rax
movl $0xffffffff, 0x10(%rax) # imm = 0xFFFFFFFF
movq -0x1038(%rbp), %rax
movl $0x10000, 0x14(%rax)    # imm = 0x10000
movq -0x1038(%rbp), %rax
movslq 0x14(%rax), %rdi
callq 0x40c50
movq %rax, %rcx
movq -0x1038(%rbp), %rax
movq %rcx, 0x40(%rax)
movb -0x19(%rbp), %cl
movq -0x1038(%rbp), %rax
movb %cl, 0x34(%rax)
movq -0x1030(%rbp), %rcx
movq -0x1038(%rbp), %rax
movq %rcx, 0x70(%rax)
movq -0x1028(%rbp), %rcx
movq -0x1038(%rbp), %rax
movq %rcx, 0x68(%rax)
movl $0x18, %edi
callq 0x40c50
movq %rax, -0x1040(%rbp)
movl $0x2000, %edi           # imm = 0x2000
callq 0x69c0
movq %rax, %rcx
movq -0x1040(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x1040(%rbp), %rcx
movq -0x1038(%rbp), %rax
movq %rcx, 0x80(%rax)
movq -0x1030(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0xfffffffc, %esi       # imm = 0xFFFFFFFC
xorl %ecx, %ecx
leaq 0x3e0e4(%rip), %r8      # 0x79130
movl %ecx, %edx
callq 0x76200
movq %rax, %rcx
movq -0x1038(%rbp), %rax
movq %rcx, 0x78(%rax)
movq -0x1038(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x1040, %rsp           # imm = 0x1040
popq %rbp
retq
nopl (%rax)