// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/regidx.c
// Function: regidx_push
int regidx_push(regidx_t *idx, char *chr_beg, char *chr_end, hts_pos_t beg, hts_pos_t end, void *payload)
{
    if (beg < 0) beg = 0;
    if (end < 0) end = 0;
    if ( beg > MAX_COOR_0 ) beg = MAX_COOR_0;
    if ( end > MAX_COOR_0 ) end = MAX_COOR_0;

    int rid;
    if (kputsn(chr_beg, chr_end-chr_beg+1, ks_clear(&idx->str)) < 0) return -1;
    if ( khash_str2int_get(idx->seq2regs, idx->str.s, &rid)!=0 )
    {
        // new chromosome
        int m_tmp = idx->mseq;
        if (hts_resize(char*, idx->nseq + 1, &m_tmp,
                       &idx->seq_names, HTS_RESIZE_CLEAR) < 0) {
            return -1;
        }
        if (hts_resize(reglist_t, idx->nseq + 1, &idx->mseq,
                       &idx->seq, HTS_RESIZE_CLEAR) < 0) {
            return -1;
        }
        assert(m_tmp == idx->mseq);
        idx->seq_names[idx->nseq] = strdup(idx->str.s);
        rid = khash_str2int_inc(idx->seq2regs, idx->seq_names[idx->nseq]);
        idx->nseq++;
    }

    reglist_t *list = &idx->seq[rid];
    list->seq = idx->seq_names[rid];
    int mreg = list->mreg;
    if (hts_resize(reg_t, list->nreg + 1, &list->mreg, &list->reg, 0) < 0)
        return -1;
    list->reg[list->nreg].beg = beg;
    list->reg[list->nreg].end = end;
    if ( idx->payload_size ) {
        if ( mreg != list->mreg ) {
            uint8_t *new_dat = realloc(list->dat, idx->payload_size*list->mreg);
            if (!new_dat) return -1;
            list->dat = new_dat;
        }
        memcpy(list->dat + idx->payload_size*list->nreg, payload, idx->payload_size);
    }
    list->nreg++;
    if ( !list->unsorted && list->nreg>1 && cmp_regs(&list->reg[list->nreg-2],&list->reg[list->nreg-1])>0 ) list->unsorted = 1;
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %r8, %r12
movq %rcx, %rbp
movq %rdx, %rbx
xorl %eax, %eax
testq %rcx, %rcx
cmovleq %rax, %rbp
testq %r8, %r8
cmovleq %rax, %r12
movabsq $0x800000000, %rcx      # imm = 0x800000000
cmpq %rcx, %rbp
cmovgeq %rcx, %rbp
cmpq %rcx, %r12
cmovgeq %rcx, %r12
subq %rsi, %rbx
movq %rax, 0x48(%rdi)
movq %rbx, %rax
addq $0x3, %rax
je 0x1fc74
movq %r9, %r14
movq %rsi, %r13
movq %rdi, %r15
cmpq %rax, 0x50(%rdi)
movq %rbp, 0x50(%rsp)
jae 0x1fc89
movq %rax, %rcx
shrq $0x3e, %rcx
movq %rax, %rdx
shrq %rdx
xorl %ebp, %ebp
testq %rcx, %rcx
cmoveq %rdx, %rbp
addq %rax, %rbp
movq 0x58(%r15), %rdi
movq %rbp, %rsi
callq 0x4840
testq %rax, %rax
je 0x1fc7f
movq %rax, 0x58(%r15)
movq %rbp, 0x50(%r15)
movq 0x48(%r15), %rdi
jmp 0x1fc8f
callq 0x4050
movl $0x4b, (%rax)
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
jmp 0x201b3
movq 0x58(%r15), %rax
xorl %edi, %edi
addq %rax, %rdi
incq %rbx
movq %r13, %rsi
movq %rbx, %rdx
callq 0x43c0
movq 0x48(%r15), %rax
addq %rbx, %rax
movq %rax, 0x48(%r15)
movq 0x58(%r15), %rcx
movb $0x0, (%rcx,%rax)
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testl %ebx, %ebx
js 0x201b3
movq %r12, 0x10(%rsp)
movq %r14, 0x18(%rsp)
movq %r15, 0x20(%rsp)
movq 0x10(%r15), %rax
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x1fdbe
movq 0x8(%rsp), %rax
movl (%rax), %ecx
testl %ecx, %ecx
je 0x1fd25
movq 0x20(%rsp), %rax
movq 0x58(%rax), %r12
movq %rcx, 0x30(%rsp)
leal -0x1(%rcx), %edx
movb (%r12), %cl
testb %cl, %cl
je 0x1fd2d
leaq 0x1(%r12), %rax
movl $0x811c9dc5, %ebp       # imm = 0x811C9DC5
movzbl %cl, %ecx
xorl %ebp, %ecx
imull $0x1000193, %ecx, %ebp  # imm = 0x1000193
movb (%rax), %cl
incq %rax
testb %cl, %cl
jne 0x1fd0f
jmp 0x1fd32
xorl %r15d, %r15d
jmp 0x1fdb5
movl $0x811c9dc5, %ebp       # imm = 0x811C9DC5
andl %edx, %ebp
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rsi
movl $0x1, %r14d
movl %ebp, %r15d
movl %edx, 0x40(%rsp)
movq %rsi, 0x38(%rsp)
movl %r15d, %eax
shrl $0x4, %eax
movl (%rsi,%rax,4), %ebx
leal (%r15,%r15), %r13d
andl $0x1e, %r13d
movl %ebx, %eax
movl %r13d, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x1fda4
testb $0x1, %al
jne 0x1fd94
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rax
movl %r15d, %ecx
movq (%rax,%rcx,8), %rdi
movq %r12, %rsi
callq 0x46c0
movq 0x38(%rsp), %rsi
movl 0x40(%rsp), %edx
testl %eax, %eax
je 0x1fda4
addl %r14d, %r15d
andl %edx, %r15d
incl %r14d
cmpl %ebp, %r15d
jne 0x1fd4f
jmp 0x1fdbe
movl %r13d, %ecx
shrl %cl, %ebx
testb $0x3, %bl
movq 0x30(%rsp), %rcx
cmovnel %ecx, %r15d
cmpl %ecx, %r15d
jne 0x1febb
movq 0x20(%rsp), %r15
movl 0x4(%r15), %ecx
movl %ecx, 0x2c(%rsp)
movl (%r15), %eax
cmpl %ecx, %eax
jge 0x1fdde
movq 0x18(%rsp), %r14
movq 0x10(%rsp), %r12
jmp 0x1fe26
movslq %eax, %rsi
incq %rsi
leaq 0x18(%r15), %r8
leaq 0x77121(%rip), %rax     # 0x96f10
movq %rax, (%rsp)
leaq 0x2c(%rsp), %rcx
movl $0x8, %edi
movl $0x4, %edx
movl $0x1, %r9d
callq 0x15a69
testl %eax, %eax
movq 0x18(%rsp), %r14
movq 0x10(%rsp), %r12
js 0x1fc7f
movl (%r15), %eax
movl 0x4(%r15), %ecx
cmpl %ecx, %eax
jl 0x1fe64
leaq 0x4(%r15), %rbx
incl %eax
movslq %eax, %rsi
leaq 0x8(%r15), %r8
leaq 0x770d2(%rip), %rax     # 0x96f10
movq %rax, (%rsp)
movl $0x38, %edi
movl $0x4, %edx
movq %rbx, %rcx
movl $0x1, %r9d
callq 0x15a69
testl %eax, %eax
js 0x1fc7f
movl (%rbx), %ecx
cmpl %ecx, 0x2c(%rsp)
jne 0x201c4
movq 0x58(%r15), %rdi
callq 0x4930
movq 0x18(%r15), %rdx
movslq (%r15), %rcx
movq %rax, (%rdx,%rcx,8)
movq 0x10(%r15), %rdi
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testq %rdi, %rdi
je 0x200a6
movq 0x18(%r15), %rax
movq (%rax,%rcx,8), %rsi
movl 0x8(%rdi), %eax
cmpl 0xc(%rdi), %eax
movq %rdi, 0x8(%rsp)
jb 0x1fefa
movq %rsi, %r13
movl (%rdi), %esi
movl 0x4(%rdi), %eax
addl %eax, %eax
cmpl %eax, %esi
jbe 0x1fede
decl %esi
jmp 0x1fee0
movq 0x8(%rsp), %rax
movq 0x20(%rax), %rax
movl %r15d, %ecx
movl (%rax,%rcx,4), %ebx
movq 0x18(%rsp), %r14
movq 0x20(%rsp), %r15
movq 0x10(%rsp), %r12
jmp 0x200a9
incl %esi
movq 0x8(%rsp), %rdi
callq 0x213b5
movq 0x8(%rsp), %rdi
testl %eax, %eax
movq %r13, %rsi
js 0x200a6
movl (%rdi), %r13d
leal -0x1(%r13), %edx
movb (%rsi), %cl
testb %cl, %cl
je 0x1ff26
leaq 0x1(%rsi), %rax
movl $0x811c9dc5, %ebp       # imm = 0x811C9DC5
movzbl %cl, %ecx
xorl %ebp, %ecx
imull $0x1000193, %ecx, %ebp  # imm = 0x1000193
movb (%rax), %cl
incq %rax
testb %cl, %cl
jne 0x1ff10
jmp 0x1ff2b
movl $0x811c9dc5, %ebp       # imm = 0x811C9DC5
andl %edx, %ebp
movq 0x10(%rdi), %r8
movl %ebp, %eax
shrl $0x4, %eax
movl (%r8,%rax,4), %eax
leal (,%rbp,2), %ecx
shrl %cl, %eax
testb $0x2, %al
je 0x1ff4f
movl %ebp, %r13d
jmp 0x2001a
movl $0x1, %r12d
movl %ebp, %r15d
movq %r13, 0x48(%rsp)
movq %rsi, 0x40(%rsp)
movq %r8, 0x38(%rsp)
movl %edx, 0x30(%rsp)
movl %r15d, %eax
shrl $0x4, %eax
movl (%r8,%rax,4), %r14d
leal (%r15,%r15), %ebx
andl $0x1e, %ebx
movl %r14d, %eax
movl %ebx, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x1ffe7
testb $0x1, %al
jne 0x1ffb2
movq 0x18(%rdi), %rax
movl %r15d, %ecx
movq (%rax,%rcx,8), %rdi
callq 0x46c0
movl 0x30(%rsp), %edx
movq 0x38(%rsp), %r8
movq 0x40(%rsp), %rsi
movq 0x8(%rsp), %rdi
testl %eax, %eax
je 0x1ffe7
btl %ebx, %r14d
cmovbl %r15d, %r13d
addl %r12d, %r15d
andl %edx, %r15d
incl %r12d
cmpl %ebp, %r15d
jne 0x1ff6b
movb $0x1, %al
movq 0x48(%rsp), %rdx
movl %edx, %ecx
cmpl %edx, %r13d
movq 0x18(%rsp), %r14
movq 0x20(%rsp), %r15
movq 0x10(%rsp), %r12
je 0x2000d
jmp 0x2001a
movl %ebx, %ecx
shrl %cl, %r14d
testb $0x2, %r14b
sete %al
movl %r13d, %ecx
movl %r15d, %ebp
movq 0x18(%rsp), %r14
movq 0x20(%rsp), %r15
movq 0x10(%rsp), %r12
movq 0x48(%rsp), %rdx
cmpl %edx, %ecx
cmovel %ebp, %ecx
testb %al, %al
cmovnel %ebp, %ecx
movl %ecx, %r13d
movl %r13d, %edx
shrl $0x4, %edx
movl (%r8,%rdx,4), %r8d
leal (,%r13,2), %ecx
andl $0x1e, %ecx
shrl %cl, %r8d
movl %r13d, %eax
testb $0x2, %r8b
jne 0x2004a
testb $0x1, %r8b
jne 0x2007e
movq 0x20(%rdi), %rcx
movl (%rcx,%rax,4), %ebx
jmp 0x200a6
movl $0x3, %r8d
shll %cl, %r8d
movq 0x18(%rdi), %rcx
movq %rsi, (%rcx,%rax,8)
notl %r8d
movq 0x10(%rdi), %rcx
andl %r8d, (%rcx,%rdx,4)
movq 0x4(%rdi), %rbx
movq %rbx, %xmm0
pcmpeqd %xmm1, %xmm1
psubd %xmm1, %xmm0
movq %xmm0, 0x4(%rdi)
jmp 0x2009f
movq 0x18(%rdi), %r8
movq %rsi, (%r8,%rax,8)
movl $0x3, %esi
shll %cl, %esi
notl %esi
movq 0x10(%rdi), %rcx
andl %esi, (%rcx,%rdx,4)
movl 0x4(%rdi), %ebx
leal 0x1(%rbx), %ecx
movl %ecx, 0x4(%rdi)
movq 0x20(%rdi), %rcx
movl %ebx, (%rcx,%rax,4)
incl (%r15)
movslq %ebx, %rdx
imulq $0x38, %rdx, %rax
movq 0x8(%r15), %rcx
movq 0x18(%r15), %rsi
leaq (%rcx,%rax), %rbx
movq (%rsi,%rdx,8), %rdx
movq %rdx, 0x28(%rcx,%rax)
movl 0xc(%rcx,%rax), %edi
movl 0x10(%rcx,%rax), %ebp
leal 0x1(%rdi), %edx
cmpl %ebp, %edx
jbe 0x20109
addq %rax, %rcx
addq $0x10, %rcx
movl %edx, %esi
leaq 0x18(%rbx), %r8
leaq 0x76e28(%rip), %rax     # 0x96f10
movq %rax, (%rsp)
movl $0x10, %edi
movl $0x4, %edx
xorl %r9d, %r9d
callq 0x15a69
testl %eax, %eax
js 0x1fc7f
movl 0xc(%rbx), %edi
movq 0x18(%rbx), %rax
movl %edi, %ecx
shlq $0x4, %rcx
movq 0x50(%rsp), %rdx
movq %rdx, (%rax,%rcx)
movq %r12, 0x8(%rax,%rcx)
movl 0x38(%r15), %ecx
testl %ecx, %ecx
je 0x20168
movl 0x10(%rbx), %esi
movq 0x20(%rbx), %rax
cmpl %esi, %ebp
je 0x20154
imull %ecx, %esi
movq %rax, %rdi
callq 0x4840
testq %rax, %rax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
je 0x201b3
movq %rax, 0x20(%rbx)
movl 0x38(%r15), %ecx
movl 0xc(%rbx), %edi
imull %ecx, %edi
addq %rax, %rdi
movslq %ecx, %rdx
movq %r14, %rsi
callq 0x43c0
movl 0xc(%rbx), %edi
leal 0x1(%rdi), %eax
movl %eax, 0xc(%rbx)
xorl %ecx, %ecx
cmpl $0x0, 0x30(%rbx)
jne 0x201b3
cmpl $0x2, %eax
jb 0x201b3
movq 0x18(%rbx), %rdx
leal -0x1(%rdi), %esi
shlq $0x4, %rsi
leaq (%rdx,%rsi), %rax
movl %edi, %edi
shlq $0x4, %rdi
leaq (%rdx,%rdi), %rcx
movq (%rdx,%rdi), %rdi
cmpq %rdi, (%rdx,%rsi)
jl 0x201b1
jg 0x201aa
movq 0x8(%rax), %rax
cmpq 0x8(%rcx), %rax
jge 0x201b1
movl $0x1, 0x30(%rbx)
xorl %ecx, %ecx
movl %ecx, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x76d51(%rip), %rdi     # 0x96f1c
leaq 0x76d5d(%rip), %rsi     # 0x96f2f
leaq 0x76d5f(%rip), %rcx     # 0x96f38
movl $0xac, %edx
callq 0x42f0