// File: /workspace/github_c_makefile_star2_O1/DReichLab[P]adna/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, idx->n_bins + 1);
		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))
			kh_val(bidx, k).loff = kh_key(bidx, k) < idx->n_bins? lidx->offset[hts_bin_bot(kh_key(bidx, k), idx->n_lvls)] : 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 0x65cc
movl (%rax), %esi
testl %esi, %esi
je 0x65e0
movl 0xc(%rdi), %r9d
incl %r9d
leal -0x1(%rsi), %r10d
movl %r10d, %r11d
andl %r9d, %r11d
movl %r9d, %ecx
shrl $0x3, %ecx
leal (,%r9,8), %ebp
xorl %ecx, %ebp
orl $0x1, %ebp
andl %r10d, %ebp
movq 0x10(%rax), %r14
movl %r11d, %r8d
movl %r8d, %ecx
shrl $0x4, %ecx
movl (%r14,%rcx,4), %r15d
leal (%r8,%r8), %ecx
andl $0x1e, %ecx
movl %r15d, %r12d
shrl %cl, %r12d
testb $0x2, %r12b
jne 0x65d3
testb $0x1, %r12b
jne 0x65bc
movq 0x18(%rax), %r12
movl %r8d, %r13d
cmpl %r9d, (%r12,%r13,4)
je 0x65d3
addl %ebp, %r8d
andl %r10d, %r8d
cmpl %r11d, %r8d
jne 0x658c
movl %esi, %r8d
jmp 0x65e3
movl $0x1, %ecx
jmp 0x6625
shrl %cl, %r15d
testb $0x3, %r15b
cmovnel %esi, %r8d
jmp 0x65e3
xorl %r8d, %r8d
xorl %ecx, %ecx
cmpl %esi, %r8d
jne 0x65ee
xorl %esi, %esi
jmp 0x6601
movq 0x20(%rax), %rsi
movl %r8d, %r8d
leaq (%r8,%r8,2), %r8
movq 0x10(%rsi,%r8,8), %rsi
movq (%rsi), %rsi
movl (%rbx), %r8d
testl %r8d, %r8d
jle 0x6625
movq 0x8(%rbx), %r9
xorl %ecx, %ecx
cmpq $-0x1, (%r9,%rcx,8)
jne 0x6625
movq %rsi, (%r9,%rcx,8)
incq %rcx
cmpq %rcx, %r8
jne 0x660f
movl %r8d, %ecx
movl (%rbx), %esi
cmpl %esi, %ecx
jge 0x664d
movl %ecx, %r8d
shlq $0x3, %r8
addq 0x8(%rbx), %r8
cmpq $-0x1, (%r8)
jne 0x6643
movq -0x8(%r8), %r9
movq %r9, (%r8)
addq $0x8, %r8
incl %ecx
cmpl %ecx, %esi
jg 0x6636
testq %rax, %rax
je 0x6711
movl (%rax), %esi
testq %rsi, %rsi
je 0x66fe
movq 0x10(%rax), %r8
xorl %r9d, %r9d
movl $0x92492493, %r10d      # imm = 0x92492493
movl %r9d, %ecx
shrl $0x4, %ecx
movl (%r8,%rcx,4), %r11d
leal (%r9,%r9), %ecx
shrl %cl, %r11d
testb $0x3, %r11b
jne 0x66f2
movq 0x18(%rax), %rcx
movl (%rcx,%r9,4), %r11d
cmpl 0xc(%rdi), %r11d
jae 0x66e3
xorl %r14d, %r14d
testl %r11d, %r11d
je 0x66af
movl %r11d, %ecx
incl %r14d
decl %ecx
movl %ecx, %ebp
sarl $0x3, %ebp
cmpl $0x7, %ecx
movl %ebp, %ecx
ja 0x669e
leal (%r14,%r14,2), %ecx
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
shll %cl, %r15d
movl 0x8(%rdi), %ecx
notl %r15d
imulq %r10, %r15
shrq $0x22, %r15
subl %r15d, %r11d
subl %r14d, %ecx
leal (%rcx,%rcx,2), %ecx
shll %cl, %r11d
movq 0x8(%rbx), %rcx
movslq %r11d, %r11
movq (%rcx,%r11,8), %rcx
jmp 0x66e5
xorl %ecx, %ecx
movq 0x20(%rax), %r11
leaq (%r9,%r9,2), %r14
movq %rcx, 0x8(%r11,%r14,8)
incq %r9
cmpq %rsi, %r9
jne 0x666e
testl %edx, %edx
je 0x6711
movq 0x8(%rbx), %rdi
callq 0x2050
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq