// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/hts.c
// Function: add_to_interval
static inline int add_to_interval(hts_itr_t *iter, bins_t *bin,
                                  int tid, uint32_t interval,
                                  uint64_t min_off, uint64_t max_off)
{
    hts_pair64_max_t *off;
    int j;

    if (!bin->n)
        return 0;
    off = realloc(iter->off, (iter->n_off + bin->n) * sizeof(*off));
    if (!off)
        return -2;

    iter->off = off;
    for (j = 0; j < bin->n; ++j) {
        if (bin->list[j].v > min_off && bin->list[j].u < max_off) {
            iter->off[iter->n_off].u = min_off > bin->list[j].u
                ? min_off : bin->list[j].u;
            iter->off[iter->n_off].v = max_off < bin->list[j].v
                ? max_off : bin->list[j].v;
            // hts_pair64_max_t::max is now used to link
            // file offsets to region list entries.
            // The iterator can use this to decide if it
            // can skip some file regions.
            iter->off[iter->n_off].max = ((uint64_t) tid << 32) | interval;
            iter->n_off++;
        }
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl %ecx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, 0x4(%rax)
jne 0x28f84
movl $0x0, -0x4(%rbp)
jmp 0x2912c
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rdi
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x18(%rbp), %rcx
addl 0x4(%rcx), %eax
cltq
imulq $0x18, %rax, %rsi
callq 0x4820
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x28fbc
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x2912c
movq -0x38(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x60(%rax)
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jge 0x29125
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x3c(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
cmpq -0x28(%rbp), %rax
jbe 0x29115
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x3c(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
cmpq -0x30(%rbp), %rax
jae 0x29115
movq -0x28(%rbp), %rax
movq -0x18(%rbp), %rcx
movq 0x10(%rcx), %rcx
movslq -0x3c(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
cmpq (%rcx), %rax
jbe 0x29046
movq -0x28(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x29060
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x3c(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rax
movq -0x10(%rbp), %rdx
movslq 0x8(%rdx), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
movq -0x30(%rbp), %rax
movq -0x18(%rbp), %rcx
movq 0x10(%rcx), %rcx
movslq -0x3c(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
cmpq 0x8(%rcx), %rax
jae 0x290a5
movq -0x30(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0x290c0
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x3c(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rax
movq -0x10(%rbp), %rdx
movslq 0x8(%rdx), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
movslq -0x1c(%rbp), %rcx
shlq $0x20, %rcx
movl -0x20(%rbp), %eax
orq %rax, %rcx
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rax
movq -0x10(%rbp), %rdx
movslq 0x8(%rdx), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x8(%rax)
jmp 0x29117
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x28fcf
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)