// File: /workspace/github_c_makefile_star2_O0/icebert[P]pblat/htslib/hts.c
// Function: hts_idx_push
int hts_idx_push(hts_idx_t *idx, int tid, int beg, int end, uint64_t offset, int is_mapped)
{
    int bin;
    if (tid<0) beg = -1, end = 0;
    if (tid >= idx->m) { // enlarge the index
        int32_t oldm = idx->m;
        idx->m = idx->m? idx->m<<1 : 2;
        idx->bidx = (bidx_t**)realloc(idx->bidx, idx->m * sizeof(bidx_t*));
        idx->lidx = (lidx_t*) realloc(idx->lidx, idx->m * sizeof(lidx_t));
        memset(&idx->bidx[oldm], 0, (idx->m - oldm) * sizeof(bidx_t*));
        memset(&idx->lidx[oldm], 0, (idx->m - oldm) * sizeof(lidx_t));
    }
    if (idx->n < tid + 1) idx->n = tid + 1;
    if (idx->z.finished) return 0;
    if (idx->z.last_tid != tid || (idx->z.last_tid >= 0 && tid < 0)) { // change of chromosome
        if ( tid>=0 && idx->n_no_coor )
        {
            if (hts_verbose >= 1) fprintf(stderr,"[E::%s] NO_COOR reads not in a single block at the end %d %d\n", __func__, tid,idx->z.last_tid);
            return -1;
        }
        if (tid>=0 && idx->bidx[tid] != 0)
        {
            if (hts_verbose >= 1) fprintf(stderr, "[E::%s] chromosome blocks not continuous\n", __func__);
            return -1;
        }
        idx->z.last_tid = tid;
        idx->z.last_bin = 0xffffffffu;
    } else if (tid >= 0 && idx->z.last_coor > beg) { // test if positions are out of order
        if (hts_verbose >= 1) fprintf(stderr, "[E::%s] unsorted positions\n", __func__);
        return -1;
    }
    if ( tid>=0 )
    {
        if (idx->bidx[tid] == 0) idx->bidx[tid] = kh_init(bin);
        if ( is_mapped)
            insert_to_l(&idx->lidx[tid], beg, end, idx->z.last_off, idx->min_shift); // last_off points to the start of the current record
    }
    else idx->n_no_coor++;
    bin = hts_reg2bin(beg, end, idx->min_shift, idx->n_lvls);
    if ((int)idx->z.last_bin != bin) { // then possibly write the binning index
        if (idx->z.save_bin != 0xffffffffu) // save_bin==0xffffffffu only happens to the first record
            insert_to_b(idx->bidx[idx->z.save_tid], idx->z.save_bin, idx->z.save_off, idx->z.last_off);
        if (idx->z.last_bin == 0xffffffffu && idx->z.save_bin != 0xffffffffu) { // change of chr; keep meta information
            idx->z.off_end = idx->z.last_off;
            insert_to_b(idx->bidx[idx->z.save_tid], META_BIN(idx), idx->z.off_beg, idx->z.off_end);
            insert_to_b(idx->bidx[idx->z.save_tid], META_BIN(idx), idx->z.n_mapped, idx->z.n_unmapped);
            idx->z.n_mapped = idx->z.n_unmapped = 0;
            idx->z.off_beg = idx->z.off_end;
        }
        idx->z.save_off = idx->z.last_off;
        idx->z.save_bin = idx->z.last_bin = bin;
        idx->z.save_tid = tid;
    }
    if (is_mapped) ++idx->z.n_mapped;
    else ++idx->z.n_unmapped;
    idx->z.last_off = offset;
    idx->z.last_coor = beg;
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq %r8, -0x28(%rbp)
movl %r9d, -0x2c(%rbp)
cmpl $0x0, -0x14(%rbp)
jge 0x74d31
movl $0xffffffff, -0x18(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x1c(%rbp)
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x18(%rcx), %eax
jl 0x74e15
movq -0x10(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, -0x34(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x18(%rax)
je 0x74d63
movq -0x10(%rbp), %rax
movl 0x18(%rax), %eax
shll %eax
movl %eax, -0x38(%rbp)
jmp 0x74d6d
movl $0x2, %eax
movl %eax, -0x38(%rbp)
jmp 0x74d6d
movl -0x38(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
movq -0x10(%rbp), %rax
movslq 0x18(%rax), %rsi
shlq $0x3, %rsi
callq 0x6c80
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rdi
movq -0x10(%rbp), %rax
movslq 0x18(%rax), %rsi
shlq $0x4, %rsi
callq 0x6c80
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
movslq -0x34(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
movq -0x10(%rbp), %rax
movl 0x18(%rax), %eax
subl -0x34(%rbp), %eax
movslq %eax, %rdx
shlq $0x3, %rdx
xorl %esi, %esi
callq 0x63a0
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rdi
movslq -0x34(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
movq -0x10(%rbp), %rax
movl 0x18(%rax), %eax
subl -0x34(%rbp), %eax
movslq %eax, %rdx
shlq $0x4, %rdx
xorl %esi, %esi
callq 0x63a0
movq -0x10(%rbp), %rax
movl 0x14(%rax), %eax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jge 0x74e33
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x54(%rax)
je 0x74e49
movl $0x0, -0x4(%rbp)
jmp 0x75180
movq -0x10(%rbp), %rax
movl 0x4c(%rax), %eax
cmpl -0x14(%rbp), %eax
jne 0x74e6d
movq -0x10(%rbp), %rax
cmpl $0x0, 0x4c(%rax)
jl 0x74f21
cmpl $0x0, -0x14(%rbp)
jge 0x74f21
cmpl $0x0, -0x14(%rbp)
jl 0x74ebd
movq -0x10(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x74ebd
cmpl $0x1, 0x9215b(%rip)     # 0x106fe0
jl 0x74eb1
movq 0x90142(%rip), %rax     # 0x104fd0
movq (%rax), %rdi
movl -0x14(%rbp), %ecx
movq -0x10(%rbp), %rax
movl 0x4c(%rax), %r8d
leaq 0x6d6b8(%rip), %rsi     # 0xe255b
leaq 0x6d6ef(%rip), %rdx     # 0xe2599
movb $0x0, %al
callq 0x6a80
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x75180
cmpl $0x0, -0x14(%rbp)
jl 0x74f0a
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x14(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0x74f0a
cmpl $0x1, 0x92103(%rip)     # 0x106fe0
jl 0x74efe
movq 0x900ea(%rip), %rax     # 0x104fd0
movq (%rax), %rdi
leaq 0x6d6b6(%rip), %rsi     # 0xe25a6
leaq 0x6d6a2(%rip), %rdx     # 0xe2599
movb $0x0, %al
callq 0x6a80
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x75180
movl -0x14(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x4c(%rax)
movq -0x10(%rbp), %rax
movl $0xffffffff, 0x40(%rax) # imm = 0xFFFFFFFF
jmp 0x74f69
cmpl $0x0, -0x14(%rbp)
jl 0x74f67
movq -0x10(%rbp), %rax
movl 0x48(%rax), %eax
cmpl -0x18(%rbp), %eax
jle 0x74f67
cmpl $0x1, 0x920a6(%rip)     # 0x106fe0
jl 0x74f5b
movq 0x9008d(%rip), %rax     # 0x104fd0
movq (%rax), %rdi
leaq 0x6d683(%rip), %rsi     # 0xe25d0
leaq 0x6d645(%rip), %rdx     # 0xe2599
movb $0x0, %al
callq 0x6a80
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x75180
jmp 0x74f69
cmpl $0x0, -0x14(%rbp)
jl 0x74fd2
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x14(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
jne 0x74f9a
callq 0x75190
movq %rax, %rdx
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x14(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
cmpl $0x0, -0x2c(%rbp)
je 0x74fd0
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rdi
movslq -0x14(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
movslq -0x18(%rbp), %rsi
movslq -0x1c(%rbp), %rdx
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rcx
movq -0x10(%rbp), %rax
movl 0x4(%rax), %r8d
callq 0x751b0
jmp 0x74fe2
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x20(%rax)
movslq -0x18(%rbp), %rdi
movslq -0x1c(%rbp), %rsi
movq -0x10(%rbp), %rax
movl 0x4(%rax), %edx
movq -0x10(%rbp), %rax
movl 0x8(%rax), %ecx
callq 0x75380
movl %eax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movl 0x40(%rax), %eax
cmpl -0x30(%rbp), %eax
je 0x75135
movq -0x10(%rbp), %rax
cmpl $-0x1, 0x44(%rax)
je 0x7504a
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x10(%rbp), %rcx
movslq 0x50(%rcx), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x10(%rbp), %rax
movl 0x44(%rax), %esi
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rdx
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rcx
callq 0x744e0
movq -0x10(%rbp), %rax
cmpl $-0x1, 0x40(%rax)
jne 0x7510a
movq -0x10(%rbp), %rax
cmpl $-0x1, 0x44(%rax)
je 0x7510a
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x70(%rax)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x10(%rbp), %rcx
movslq 0x50(%rcx), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x10(%rbp), %rax
movl 0xc(%rax), %esi
addl $0x1, %esi
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rdx
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rcx
callq 0x744e0
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x10(%rbp), %rcx
movslq 0x50(%rcx), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x10(%rbp), %rax
movl 0xc(%rax), %esi
addl $0x1, %esi
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rdx
movq -0x10(%rbp), %rax
movq 0x80(%rax), %rcx
callq 0x744e0
movq -0x10(%rbp), %rax
movq $0x0, 0x80(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x78(%rax)
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x68(%rax)
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x60(%rax)
movl -0x30(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x40(%rax)
movq -0x10(%rbp), %rax
movl %ecx, 0x44(%rax)
movl -0x14(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x50(%rax)
cmpl $0x0, -0x2c(%rbp)
je 0x7514d
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x78(%rax)
jmp 0x75163
movq -0x10(%rbp), %rax
movq 0x80(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x80(%rax)
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x58(%rax)
movl -0x18(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x48(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)