// File: karel-brinda[P]ococo/ext/htslib/hts.c
// Function: reg2bins
static inline int reg2bins(int64_t beg, int64_t end, hts_itr_t *itr, int min_shift, int n_lvls)
{
    int l, t, s = min_shift + (n_lvls<<1) + n_lvls;
    if (beg >= end) return 0;
    if (end >= 1LL<<s) end = 1LL<<s;
    for (--end, l = 0, t = 0; l <= n_lvls; s -= 3, t += 1<<((l<<1)+l), ++l) {
        int b, e, n, i;
        b = t + (beg>>s); e = t + (end>>s); n = e - b + 1;
        if (itr->bins.n + n > itr->bins.m) {
            itr->bins.m = itr->bins.n + n;
            kroundup32(itr->bins.m);
            itr->bins.a = (int*)realloc(itr->bins.a, sizeof(int) * itr->bins.m);
        }
        for (i = b; i <= e; ++i) itr->bins.a[itr->bins.n++] = i;
    }
    return itr->bins.n;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movl %r8d, -0x28(%rbp)
movl -0x24(%rbp), %eax
movl -0x28(%rbp), %ecx
shll %ecx
addl %ecx, %eax
addl -0x28(%rbp), %eax
movl %eax, -0x34(%rbp)
movq -0x10(%rbp), %rax
cmpq -0x18(%rbp), %rax
jl 0x18571
movl $0x0, -0x4(%rbp)
jmp 0x18733
movq -0x18(%rbp), %rax
movl -0x34(%rbp), %ecx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, %rcx
cmpq %rcx, %rax
jl 0x18599
movl -0x34(%rbp), %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x18(%rbp)
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x28(%rbp), %eax
jg 0x18729
movslq -0x30(%rbp), %rax
movq -0x10(%rbp), %rdx
movl -0x34(%rbp), %ecx
sarq %cl, %rdx
movq %rdx, %rcx
addq %rcx, %rax
movl %eax, -0x38(%rbp)
movslq -0x30(%rbp), %rax
movq -0x18(%rbp), %rdx
movl -0x34(%rbp), %ecx
sarq %cl, %rdx
movq %rdx, %rcx
addq %rcx, %rax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
subl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
movq -0x20(%rbp), %rax
movl 0x40(%rax), %eax
addl -0x40(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x44(%rcx), %eax
jle 0x186c2
movq -0x20(%rbp), %rax
movl 0x40(%rax), %ecx
addl -0x40(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x44(%rax)
movq -0x20(%rbp), %rax
movl 0x44(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x44(%rax)
movq -0x20(%rbp), %rax
movl 0x44(%rax), %ecx
sarl %ecx
movq -0x20(%rbp), %rax
orl 0x44(%rax), %ecx
movl %ecx, 0x44(%rax)
movq -0x20(%rbp), %rax
movl 0x44(%rax), %ecx
sarl $0x2, %ecx
movq -0x20(%rbp), %rax
orl 0x44(%rax), %ecx
movl %ecx, 0x44(%rax)
movq -0x20(%rbp), %rax
movl 0x44(%rax), %ecx
sarl $0x4, %ecx
movq -0x20(%rbp), %rax
orl 0x44(%rax), %ecx
movl %ecx, 0x44(%rax)
movq -0x20(%rbp), %rax
movl 0x44(%rax), %ecx
sarl $0x8, %ecx
movq -0x20(%rbp), %rax
orl 0x44(%rax), %ecx
movl %ecx, 0x44(%rax)
movq -0x20(%rbp), %rax
movl 0x44(%rax), %ecx
sarl $0x10, %ecx
movq -0x20(%rbp), %rax
orl 0x44(%rax), %ecx
movl %ecx, 0x44(%rax)
movq -0x20(%rbp), %rax
movl 0x44(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x44(%rax)
movq -0x20(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x20(%rbp), %rax
movslq 0x44(%rax), %rsi
shlq $0x2, %rsi
callq 0x4990
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x48(%rax)
movl -0x38(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jg 0x186fb
movl -0x44(%rbp), %edx
movq -0x20(%rbp), %rax
movq 0x48(%rax), %rax
movq -0x20(%rbp), %rsi
movl 0x40(%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, 0x40(%rsi)
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x186c8
jmp 0x186fd
movl -0x34(%rbp), %eax
subl $0x3, %eax
movl %eax, -0x34(%rbp)
movl -0x2c(%rbp), %ecx
shll %ecx
addl -0x2c(%rbp), %ecx
movl $0x1, %eax
shll %cl, %eax
addl -0x30(%rbp), %eax
movl %eax, -0x30(%rbp)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x185b3
movq -0x20(%rbp), %rax
movl 0x40(%rax), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)