// File: /workspace/github_c_makefile_star2_O0/icebert[P]pblat/htslib/hts.c
// Function: hts_idx_load_core
static int hts_idx_load_core(hts_idx_t *idx, BGZF *fp, int fmt)
{
    int32_t i, n, is_be;
    is_be = ed_is_big();
    if (idx == NULL) return -4;
    for (i = 0; i < idx->n; ++i) {
        bidx_t *h;
        lidx_t *l = &idx->lidx[i];
        uint32_t key;
        int j, absent;
        bins_t *p;
        h = idx->bidx[i] = kh_init(bin);
        if (bgzf_read(fp, &n, 4) != 4) return -1;
        if (is_be) ed_swap_4p(&n);
        for (j = 0; j < n; ++j) {
            khint_t k;
            if (bgzf_read(fp, &key, 4) != 4) return -1;
            if (is_be) ed_swap_4p(&key);
            k = kh_put(bin, h, key, &absent);
            if (absent <= 0) return -3; // Duplicate bin number
            p = &kh_val(h, k);
            if (fmt == HTS_FMT_CSI) {
                if (bgzf_read(fp, &p->loff, 8) != 8) return -1;
                if (is_be) ed_swap_8p(&p->loff);
            } else p->loff = 0;
            if (bgzf_read(fp, &p->n, 4) != 4) return -1;
            if (is_be) ed_swap_4p(&p->n);
            p->m = p->n;
            p->list = (hts_pair64_t*)malloc(p->m * sizeof(hts_pair64_t));
            if (p->list == NULL) return -2;
            if (bgzf_read(fp, p->list, p->n<<4) != p->n<<4) return -1;
            if (is_be) swap_bins(p);
        }
        if (fmt != HTS_FMT_CSI) { // load linear index
            int j;
            if (bgzf_read(fp, &l->n, 4) != 4) return -1;
            if (is_be) ed_swap_4p(&l->n);
            l->m = l->n;
            l->offset = (uint64_t*)malloc(l->n * sizeof(uint64_t));
            if (l->offset == NULL) return -2;
            if (bgzf_read(fp, l->offset, l->n << 3) != l->n << 3) return -1;
            if (is_be) for (j = 0; j < l->n; ++j) ed_swap_8p(&l->offset[j]);
            for (j = 1; j < l->n; ++j) // fill missing values; may happen given older samtools and tabix
                if (l->offset[j] == 0) l->offset[j] = l->offset[j-1];
            update_loff(idx, i, 1);
        }
    }
    if (bgzf_read(fp, &idx->n_no_coor, 8) != 8) idx->n_no_coor = 0;
    if (is_be) ed_swap_8p(&idx->n_no_coor);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
callq 0x72270
movl %eax, -0x28(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x787fe
movl $0xfffffffc, -0x4(%rbp) # imm = 0xFFFFFFFC
jmp 0x78bca
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x14(%rcx), %eax
jge 0x78b88
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movslq -0x20(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
callq 0x75190
movq -0x10(%rbp), %rcx
movq 0x28(%rcx), %rcx
movslq -0x20(%rbp), %rdx
movq %rax, (%rcx,%rdx,8)
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rdi
leaq -0x24(%rbp), %rsi
movl $0x4, %edx
callq 0x9c7b0
cmpq $0x4, %rax
je 0x78869
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x78bca
cmpl $0x0, -0x28(%rbp)
je 0x78878
leaq -0x24(%rbp), %rdi
callq 0x758f0
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x78a1d
movq -0x18(%rbp), %rdi
leaq -0x3c(%rbp), %rsi
movl $0x4, %edx
callq 0x9c7b0
cmpq $0x4, %rax
je 0x788af
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x78bca
cmpl $0x0, -0x28(%rbp)
je 0x788be
leaq -0x3c(%rbp), %rdi
callq 0x758f0
movq -0x30(%rbp), %rdi
movl -0x3c(%rbp), %esi
leaq -0x44(%rbp), %rdx
callq 0x77ca0
movl %eax, -0x54(%rbp)
cmpl $0x0, -0x44(%rbp)
jg 0x788e3
movl $0xfffffffd, -0x4(%rbp) # imm = 0xFFFFFFFD
jmp 0x78bca
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x54(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
cmpl $0x0, -0x1c(%rbp)
jne 0x7893c
movq -0x18(%rbp), %rdi
movq -0x50(%rbp), %rsi
addq $0x8, %rsi
movl $0x8, %edx
callq 0x9c7b0
cmpq $0x8, %rax
je 0x78927
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x78bca
cmpl $0x0, -0x28(%rbp)
je 0x7893a
movq -0x50(%rbp), %rdi
addq $0x8, %rdi
callq 0x78720
jmp 0x78948
movq -0x50(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x18(%rbp), %rdi
movq -0x50(%rbp), %rsi
addq $0x4, %rsi
movl $0x4, %edx
callq 0x9c7b0
cmpq $0x4, %rax
je 0x78970
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x78bca
cmpl $0x0, -0x28(%rbp)
je 0x78983
movq -0x50(%rbp), %rdi
addq $0x4, %rdi
callq 0x758f0
movq -0x50(%rbp), %rax
movl 0x4(%rax), %ecx
movq -0x50(%rbp), %rax
movl %ecx, (%rax)
movq -0x50(%rbp), %rax
movslq (%rax), %rdi
shlq $0x4, %rdi
callq 0x69c0
movq %rax, %rcx
movq -0x50(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x50(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x789c2
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x78bca
movq -0x18(%rbp), %rdi
movq -0x50(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x50(%rbp), %rax
movl 0x4(%rax), %eax
shll $0x4, %eax
movslq %eax, %rdx
callq 0x9c7b0
movq -0x50(%rbp), %rcx
movl 0x4(%rcx), %ecx
shll $0x4, %ecx
movslq %ecx, %rcx
cmpq %rcx, %rax
je 0x789fe
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x78bca
cmpl $0x0, -0x28(%rbp)
je 0x78a0d
movq -0x50(%rbp), %rdi
callq 0x786b0
jmp 0x78a0f
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x7887f
cmpl $0x0, -0x1c(%rbp)
je 0x78b78
movq -0x18(%rbp), %rdi
movq -0x38(%rbp), %rsi
movl $0x4, %edx
callq 0x9c7b0
cmpq $0x4, %rax
je 0x78a4b
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x78bca
cmpl $0x0, -0x28(%rbp)
je 0x78a5a
movq -0x38(%rbp), %rdi
callq 0x758f0
movq -0x38(%rbp), %rax
movl (%rax), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x38(%rbp), %rax
movslq (%rax), %rdi
shlq $0x3, %rdi
callq 0x69c0
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x38(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x78a99
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x78bca
movq -0x18(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x38(%rbp), %rax
movl (%rax), %eax
shll $0x3, %eax
movslq %eax, %rdx
callq 0x9c7b0
movq -0x38(%rbp), %rcx
movl (%rcx), %ecx
shll $0x3, %ecx
movslq %ecx, %rcx
cmpq %rcx, %rax
je 0x78ad3
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x78bca
cmpl $0x0, -0x28(%rbp)
je 0x78b10
movl $0x0, -0x58(%rbp)
movl -0x58(%rbp), %eax
movq -0x38(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x78b0e
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rdi
movslq -0x58(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
callq 0x78720
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x78ae0
jmp 0x78b10
movl $0x1, -0x58(%rbp)
movl -0x58(%rbp), %eax
movq -0x38(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x78b67
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x58(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
jne 0x78b5a
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x58(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdx
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x58(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0x78b5c
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x78b17
movq -0x10(%rbp), %rdi
movl -0x20(%rbp), %esi
movl $0x1, %edx
callq 0x745e0
jmp 0x78b7a
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x78805
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x20, %rsi
movl $0x8, %edx
callq 0x9c7b0
cmpq $0x8, %rax
je 0x78bb0
movq -0x10(%rbp), %rax
movq $0x0, 0x20(%rax)
cmpl $0x0, -0x28(%rbp)
je 0x78bc3
movq -0x10(%rbp), %rdi
addq $0x20, %rdi
callq 0x78720
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)