// File: /workspace/github_c_makefile_star2_O0/icebert[P]pblat/htslib/tbx.c
// Function: tbx_index
tbx_t *tbx_index(BGZF *fp, int min_shift, const tbx_conf_t *conf)
{
    tbx_t *tbx;
    kstring_t str;
    int ret, first = 0, n_lvls, fmt;
    int64_t lineno = 0;
    uint64_t last_off = 0;
    tbx_intv_t intv;

    str.s = 0; str.l = str.m = 0;
    tbx = (tbx_t*)calloc(1, sizeof(tbx_t));
    tbx->conf = *conf;
    if (min_shift > 0) n_lvls = (TBX_MAX_SHIFT - min_shift + 2) / 3, fmt = HTS_FMT_CSI;
    else min_shift = 14, n_lvls = 5, fmt = HTS_FMT_TBI;
    while ((ret = bgzf_getline(fp, '\n', &str)) >= 0) {
        ++lineno;
        if (lineno <= tbx->conf.line_skip || str.s[0] == tbx->conf.meta_char) {
            last_off = bgzf_tell(fp);
            continue;
        }
        if (first == 0) {
            tbx->idx = hts_idx_init(0, fmt, last_off, min_shift, n_lvls);
            first = 1;
        }
        get_intv(tbx, &str, &intv, 1);
        ret = hts_idx_push(tbx->idx, intv.tid, intv.beg, intv.end, bgzf_tell(fp), 1);
        if (ret < 0)
        {
            free(str.s);
            tbx_destroy(tbx);
            return NULL;
        }
    }
    if ( !tbx->idx ) tbx->idx = hts_idx_init(0, fmt, last_off, min_shift, n_lvls);   // empty file
    if ( !tbx->dict ) tbx->dict = kh_init(s2i);
    hts_idx_finish(tbx->idx, bgzf_tell(fp));
    tbx_set_meta(tbx);
    free(str.s);
    return tbx;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movl $0x0, -0x48(%rbp)
movq $0x0, -0x58(%rbp)
movq $0x0, -0x60(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
movl $0x1, %edi
movl $0x28, %esi
callq 0x6460
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq -0x20(%rbp), %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rcx
movq %rcx, 0x10(%rax)
cmpl $0x0, -0x14(%rbp)
jle 0x7963b
movl $0x1f, %eax
subl -0x14(%rbp), %eax
addl $0x2, %eax
movl $0x3, %ecx
cltd
idivl %ecx
movl %eax, -0x4c(%rbp)
movl $0x0, -0x50(%rbp)
jmp 0x79650
movl $0xe, -0x14(%rbp)
movl $0x5, -0x4c(%rbp)
movl $0x2, -0x50(%rbp)
jmp 0x79652
movq -0x10(%rbp), %rdi
movl $0xa, %esi
leaq -0x40(%rbp), %rdx
callq 0x9db10
movl %eax, -0x44(%rbp)
cmpl $0x0, %eax
jl 0x79777
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq -0x28(%rbp), %rcx
movslq 0x14(%rcx), %rcx
cmpq %rcx, %rax
jle 0x7969d
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
movq -0x28(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jne 0x796c2
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
shlq $0x10, %rax
movq -0x10(%rbp), %rcx
movl 0xc(%rcx), %ecx
andl $0xffff, %ecx           # imm = 0xFFFF
movslq %ecx, %rcx
orq %rcx, %rax
movq %rax, -0x60(%rbp)
jmp 0x79652
cmpl $0x0, -0x48(%rbp)
jne 0x796ef
movl -0x50(%rbp), %esi
movq -0x60(%rbp), %rdx
movl -0x14(%rbp), %ecx
movl -0x4c(%rbp), %r8d
xorl %edi, %edi
callq 0x74230
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x18(%rax)
movl $0x1, -0x48(%rbp)
movq -0x28(%rbp), %rdi
leaq -0x40(%rbp), %rsi
leaq -0x88(%rbp), %rdx
movl $0x1, %ecx
callq 0x791c0
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rdi
movl -0x68(%rbp), %esi
movq -0x88(%rbp), %rax
movl %eax, %edx
movq -0x80(%rbp), %rax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %r8
shlq $0x10, %r8
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
andl $0xffff, %eax           # imm = 0xFFFF
cltq
orq %rax, %r8
movl $0x1, %r9d
callq 0x74d00
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x44(%rbp)
jge 0x79772
movq -0x30(%rbp), %rdi
callq 0x6880
movq -0x28(%rbp), %rdi
callq 0x79810
movq $0x0, -0x8(%rbp)
jmp 0x79801
jmp 0x79652
movq -0x28(%rbp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x797a2
movl -0x50(%rbp), %esi
movq -0x60(%rbp), %rdx
movl -0x14(%rbp), %ecx
movl -0x4c(%rbp), %r8d
xorl %edi, %edi
callq 0x74230
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x28(%rbp), %rax
cmpq $0x0, 0x20(%rax)
jne 0x797bd
callq 0x6f430
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
shlq $0x10, %rsi
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
andl $0xffff, %eax           # imm = 0xFFFF
cltq
orq %rax, %rsi
callq 0x743c0
movq -0x28(%rbp), %rdi
callq 0x79350
movq -0x30(%rbp), %rdi
callq 0x6880
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x90, %rsp
popq %rbp
retq
nop