// File: karel-brinda[P]ococo/ext/htslib/hts.c
// Function: insert_to_l
static inline void insert_to_l(lidx_t *l, int64_t _beg, int64_t _end, uint64_t offset, int min_shift)
{
    int i, beg, end;
    beg = _beg >> min_shift;
    end = (_end - 1) >> min_shift;
    if (l->m < end + 1) {
        int old_m = l->m;
        l->m = end + 1;
        kroundup32(l->m);
        l->offset = (uint64_t*)realloc(l->offset, l->m * sizeof(uint64_t));
        memset(l->offset + old_m, 0xff, 8 * (l->m - old_m)); // fill l->offset with (uint64_t)-1
    }
    if (beg == end) { // to save a loop in this case
        if (l->offset[beg] == (uint64_t)-1) l->offset[beg] = offset;
    } else {
        for (i = beg; i <= end; ++i)
            if (l->offset[i] == (uint64_t)-1) l->offset[i] = offset;
    }
    if (l->n < end + 1) l->n = end + 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movq -0x10(%rbp), %rax
movl -0x24(%rbp), %ecx
sarq %cl, %rax
movl %eax, -0x2c(%rbp)
movq -0x18(%rbp), %rax
subq $0x1, %rax
movl -0x24(%rbp), %ecx
sarq %cl, %rax
movl %eax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movl 0x4(%rax), %eax
movl -0x30(%rbp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jge 0x17074
movq -0x8(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x34(%rbp)
movl -0x30(%rbp), %ecx
addl $0x1, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x8(%rbp), %rax
movl 0x4(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x4(%rax)
movq -0x8(%rbp), %rax
movl 0x4(%rax), %ecx
sarl %ecx
movq -0x8(%rbp), %rax
orl 0x4(%rax), %ecx
movl %ecx, 0x4(%rax)
movq -0x8(%rbp), %rax
movl 0x4(%rax), %ecx
sarl $0x2, %ecx
movq -0x8(%rbp), %rax
orl 0x4(%rax), %ecx
movl %ecx, 0x4(%rax)
movq -0x8(%rbp), %rax
movl 0x4(%rax), %ecx
sarl $0x4, %ecx
movq -0x8(%rbp), %rax
orl 0x4(%rax), %ecx
movl %ecx, 0x4(%rax)
movq -0x8(%rbp), %rax
movl 0x4(%rax), %ecx
sarl $0x8, %ecx
movq -0x8(%rbp), %rax
orl 0x4(%rax), %ecx
movl %ecx, 0x4(%rax)
movq -0x8(%rbp), %rax
movl 0x4(%rax), %ecx
sarl $0x10, %ecx
movq -0x8(%rbp), %rax
orl 0x4(%rax), %ecx
movl %ecx, 0x4(%rax)
movq -0x8(%rbp), %rax
movl 0x4(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x4(%rax)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x8(%rbp), %rax
movslq 0x4(%rax), %rsi
shlq $0x3, %rsi
callq 0x4990
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
movslq -0x34(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
movq -0x8(%rbp), %rax
movl 0x4(%rax), %eax
subl -0x34(%rbp), %eax
shll $0x3, %eax
movslq %eax, %rdx
movl $0xff, %esi
callq 0x42d0
movl -0x2c(%rbp), %eax
cmpl -0x30(%rbp), %eax
jne 0x170a5
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x2c(%rbp), %rcx
cmpq $-0x1, (%rax,%rcx,8)
jne 0x170a3
movq -0x20(%rbp), %rdx
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x2c(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0x170e9
movl -0x2c(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x30(%rbp), %eax
jg 0x170e7
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x28(%rbp), %rcx
cmpq $-0x1, (%rax,%rcx,8)
jne 0x170da
movq -0x20(%rbp), %rdx
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x28(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0x170dc
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x170ab
jmp 0x170e9
movq -0x8(%rbp), %rax
movl (%rax), %eax
movl -0x30(%rbp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jge 0x17105
movl -0x30(%rbp), %ecx
addl $0x1, %ecx
movq -0x8(%rbp), %rax
movl %ecx, (%rax)
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)