// File: /workspace/github_c_makefile_star2_O3/icebert[P]pblat/htslib/hts.c
// Function: update_loff
static void update_loff(hts_idx_t *idx, int i, int free_lidx)
{
    bidx_t *bidx = idx->bidx[i];
    lidx_t *lidx = &idx->lidx[i];
    khint_t k;
    int l;
    uint64_t offset0 = 0;
    if (bidx) {
        k = kh_get(bin, bidx, META_BIN(idx));
        if (k != kh_end(bidx))
            offset0 = kh_val(bidx, k).list[0].u;
        for (l = 0; l < lidx->n && lidx->offset[l] == (uint64_t)-1; ++l)
            lidx->offset[l] = offset0;
    } else l = 1;
    for (; l < lidx->n; ++l) // fill missing values
        if (lidx->offset[l] == (uint64_t)-1)
            lidx->offset[l] = lidx->offset[l-1];
    if (bidx == 0) return;
    for (k = kh_begin(bidx); k != kh_end(bidx); ++k) // set loff
        if (kh_exist(bidx, k))
        {
            if ( kh_key(bidx, k) < idx->n_bins )
            {
                int bot_bin = hts_bin_bot(kh_key(bidx, k), idx->n_lvls);
                // disable linear index if bot_bin out of bounds
                kh_val(bidx, k).loff = bot_bin < lidx->n ? lidx->offset[bot_bin] : 0;
            }
            else
                kh_val(bidx, k).loff = 0;
        }
    if (free_lidx) {
        free(lidx->offset);
        lidx->m = lidx->n = 0;
        lidx->offset = 0;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq 0x28(%rdi), %rax
movslq %esi, %rbx
movq (%rax,%rbx,8), %rax
shlq $0x4, %rbx
addq 0x30(%rdi), %rbx
testq %rax, %rax
je 0x50082
movl (%rax), %ecx
testl %ecx, %ecx
je 0x5009c
movl 0xc(%rdi), %r10d
incl %r10d
movq %rcx, (%rsp)
leal -0x1(%rcx), %r11d
movl %r11d, %ebp
andl %r10d, %ebp
movq 0x10(%rax), %r14
movl $0x1, %r15d
xorl %r8d, %r8d
movl %ebp, %r9d
movl %r9d, %ecx
shrl $0x4, %ecx
movl (%r14,%rcx,4), %r12d
leal (%r9,%r9), %ecx
andl $0x1e, %ecx
movl %r12d, %r13d
shrl %cl, %r13d
testb $0x2, %r13b
jne 0x5008b
testb $0x1, %r13b
jne 0x50072
movq 0x18(%rax), %r13
movl %r9d, %esi
cmpl %r10d, (%r13,%rsi,4)
je 0x5008b
addl %r15d, %r9d
andl %r11d, %r9d
incl %r15d
cmpl %ebp, %r9d
jne 0x50041
jmp 0x500bc
movl (%rbx), %esi
movl $0x1, %ecx
jmp 0x500df
shrl %cl, %r12d
testb $0x3, %r12b
movq (%rsp), %rcx
cmovnel %ecx, %r9d
jmp 0x5009f
xorl %r9d, %r9d
cmpl %ecx, %r9d
jne 0x500a9
xorl %r8d, %r8d
jmp 0x500bc
movq 0x20(%rax), %rcx
movl %r9d, %esi
leaq (%rsi,%rsi,2), %rsi
movq 0x10(%rcx,%rsi,8), %rcx
movq (%rcx), %r8
movl (%rbx), %esi
testl %esi, %esi
jle 0x500dd
movq 0x8(%rbx), %r9
xorl %ecx, %ecx
cmpq $-0x1, (%r9,%rcx,8)
jne 0x500df
movq %r8, (%r9,%rcx,8)
incq %rcx
cmpq %rcx, %rsi
jne 0x500c8
jmp 0x50100
xorl %ecx, %ecx
cmpl %esi, %ecx
jge 0x50100
movq 0x8(%rbx), %r8
movl %ecx, %ecx
cmpq $-0x1, (%r8,%rcx,8)
jne 0x500f9
movq -0x8(%r8,%rcx,8), %r9
movq %r9, (%r8,%rcx,8)
incq %rcx
cmpl %ecx, %esi
jg 0x500e9
testq %rax, %rax
je 0x501c7
movl (%rax), %r8d
testq %r8, %r8
je 0x501b4
movq 0x10(%rax), %r9
xorl %r10d, %r10d
movl $0x92492493, %r11d      # imm = 0x92492493
movl %r10d, %ecx
shrl $0x4, %ecx
movl (%r9,%rcx,4), %ebp
leal (%r10,%r10), %ecx
shrl %cl, %ebp
testb $0x3, %bpl
jne 0x501a8
movq 0x18(%rax), %rcx
movl (%rcx,%r10,4), %ebp
cmpl 0xc(%rdi), %ebp
jae 0x50199
xorl %r14d, %r14d
testl %ebp, %ebp
je 0x50162
movl %ebp, %ecx
incl %r14d
decl %ecx
movl %ecx, %r15d
sarl $0x3, %r15d
cmpl $0x7, %ecx
movl %r15d, %ecx
ja 0x5014e
leal (%r14,%r14,2), %ecx
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
shll %cl, %r15d
movl 0x8(%rdi), %ecx
notl %r15d
imulq %r11, %r15
shrq $0x22, %r15
subl %r15d, %ebp
subl %r14d, %ecx
leal (%rcx,%rcx,2), %ecx
shll %cl, %ebp
cmpl %esi, %ebp
jge 0x50199
movq 0x8(%rbx), %rcx
movslq %ebp, %r14
movq (%rcx,%r14,8), %rcx
jmp 0x5019b
xorl %ecx, %ecx
movq 0x20(%rax), %r15
leaq (%r10,%r10,2), %r14
movq %rcx, 0x8(%r15,%r14,8)
incq %r10
cmpq %r8, %r10
jne 0x50122
testl %edx, %edx
je 0x501c7
movq 0x8(%rbx), %rdi
callq 0x68a0
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq