// File: /workspace/github_c_makefile_star2_O1/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 %rdx, %r13
xorl %eax, %eax
testq %rcx, %rcx
cmovleq %rax, %rcx
testq %r8, %r8
cmovleq %rax, %r12
movabsq $0x800000000, %rdx      # imm = 0x800000000
cmpq %rdx, %rcx
cmovgeq %rdx, %rcx
movq %rcx, 0x50(%rsp)
cmpq %rdx, %r12
cmovgeq %rdx, %r12
subq %rsi, %r13
movq %rax, 0x48(%rdi)
movq %r13, %rax
addq $0x3, %rax
je 0x205d3
movq %r9, %r14
movq %rsi, %rbp
movq %rdi, %r15
cmpq %rax, 0x50(%rdi)
jae 0x2053d
movq %rax, %rcx
shrq $0x3e, %rcx
movq %rax, %rdx
shrq %rdx
xorl %ebx, %ebx
testq %rcx, %rcx
cmoveq %rdx, %rbx
addq %rax, %rbx
movq 0x58(%r15), %rdi
movq %rbx, %rsi
callq 0x4840
testq %rax, %rax
je 0x205de
movq %rax, 0x58(%r15)
movq %rbx, 0x50(%r15)
movq %r12, 0x48(%rsp)
incq %r13
movq 0x58(%r15), %rdi
addq 0x48(%r15), %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0x43c0
movq 0x48(%r15), %rax
addq %r13, %rax
movq %rax, 0x48(%r15)
movq 0x58(%r15), %rcx
movb $0x0, (%rcx,%rax)
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
testl %r13d, %r13d
js 0x205e4
movq %r15, 0x30(%rsp)
movq 0x10(%r15), %rdx
xorl %r15d, %r15d
testq %rdx, %rdx
je 0x2069a
movl (%rdx), %ecx
testl %ecx, %ecx
je 0x20692
movq 0x30(%rsp), %rax
movq 0x58(%rax), %r12
movq %rcx, 0x18(%rsp)
leal -0x1(%rcx), %esi
movb (%r12), %cl
testb %cl, %cl
movq %r14, 0x20(%rsp)
je 0x205f6
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 0x205bd
jmp 0x205fb
callq 0x4050
movl $0x4b, (%rax)
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movl %r12d, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x811c9dc5, %ebp       # imm = 0x811C9DC5
andl %esi, %ebp
movq 0x10(%rdx), %rdi
movl $0x1, %r14d
movl %ebp, %r15d
movq %rdx, 0x8(%rsp)
movl %esi, 0x40(%rsp)
movq %rdi, 0x38(%rsp)
movl %r15d, %eax
shrl $0x4, %eax
movl (%rdi,%rax,4), %r13d
leal (%r15,%r15), %ebx
andl $0x1e, %ebx
movl %r13d, %eax
movl %ebx, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x20675
testb $0x1, %al
jne 0x2065d
movq 0x18(%rdx), %rax
movl %r15d, %ecx
movq (%rax,%rcx,8), %rdi
movq %r12, %rsi
callq 0x46c0
movq 0x38(%rsp), %rdi
movl 0x40(%rsp), %esi
movq 0x8(%rsp), %rdx
testl %eax, %eax
je 0x20675
addl %r14d, %r15d
andl %esi, %r15d
incl %r14d
cmpl %ebp, %r15d
jne 0x20618
movq 0x18(%rsp), %rcx
movl %ecx, %r15d
jmp 0x20687
movl %ebx, %ecx
shrl %cl, %r13d
testb $0x3, %r13b
movq 0x18(%rsp), %rcx
cmovnel %ecx, %r15d
movq 0x20(%rsp), %r14
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
cmpl %ecx, %r15d
jne 0x2069c
xorl %r15d, %r15d
jmp 0x206a9
movq 0x20(%rdx), %rax
movl %r15d, %ecx
movl (%rax,%rcx,4), %ebx
movb $0x1, %r15b
testb %r15b, %r15b
movq 0x30(%rsp), %r15
jne 0x2096c
movl 0x4(%r15), %eax
movl %eax, 0x14(%rsp)
movslq (%r15), %rsi
cmpl %eax, %esi
jl 0x206fa
incq %rsi
leaq 0x18(%r15), %r8
leaq 0x79773(%rip), %rax     # 0x99e47
movq %rax, (%rsp)
leaq 0x14(%rsp), %rcx
movl $0x8, %edi
movl $0x4, %edx
movl $0x1, %r9d
callq 0x16026
testl %eax, %eax
js 0x205e4
leaq 0x4(%r15), %rbx
movslq (%r15), %rsi
cmpl 0x4(%r15), %esi
jl 0x20739
incq %rsi
leaq 0x8(%r15), %r8
leaq 0x79732(%rip), %rax     # 0x99e47
movq %rax, (%rsp)
movl $0x38, %edi
movl $0x4, %edx
movq %rbx, %rcx
movl $0x1, %r9d
callq 0x16026
testl %eax, %eax
js 0x205e4
movl 0x14(%rsp), %eax
cmpl (%rbx), %eax
jne 0x20aa0
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 0x20964
movq 0x18(%r15), %rax
movq (%rax,%rcx,8), %rsi
movl 0x8(%rdi), %eax
cmpl 0xc(%rdi), %eax
movq %rdi, 0x8(%rsp)
jb 0x207ae
movq %rsi, %r15
movl (%rdi), %esi
movl 0x4(%rdi), %eax
addl %eax, %eax
cmpl %eax, %esi
jbe 0x20792
decl %esi
jmp 0x20794
incl %esi
movq 0x8(%rsp), %rdi
callq 0x21d52
movq 0x8(%rsp), %rdi
testl %eax, %eax
movq %r15, %rsi
js 0x2088b
movl (%rdi), %edx
leal -0x1(%rdx), %r9d
movb (%rsi), %cl
testb %cl, %cl
je 0x207dc
leaq 0x1(%rsi), %rax
movl $0x811c9dc5, %r15d      # imm = 0x811C9DC5
movzbl %cl, %ecx
xorl %r15d, %ecx
imull $0x1000193, %ecx, %r15d # imm = 0x1000193
movb (%rax), %cl
incq %rax
testb %cl, %cl
jne 0x207c4
jmp 0x207e2
movl $0x811c9dc5, %r15d      # imm = 0x811C9DC5
andl %r9d, %r15d
movq 0x10(%rdi), %r8
movl %r15d, %eax
shrl $0x4, %eax
movl (%r8,%rax,4), %eax
leal (%r15,%r15), %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x208d9
movq %r14, 0x20(%rsp)
movl $0x1, %r12d
movl %r15d, %r13d
movq %rdx, 0x28(%rsp)
movl %edx, %ebp
movq %rsi, 0x40(%rsp)
movq %r8, 0x38(%rsp)
movl %r9d, 0x18(%rsp)
movl %r13d, %eax
shrl $0x4, %eax
movl (%r8,%rax,4), %r14d
leal (,%r13,2), %ebx
andl $0x1e, %ebx
movl %r14d, %eax
movl %ebx, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x20895
testb $0x1, %al
jne 0x20871
movq 0x18(%rdi), %rax
movl %r13d, %ecx
movq (%rax,%rcx,8), %rdi
callq 0x46c0
movl 0x18(%rsp), %r9d
movq 0x38(%rsp), %r8
movq 0x40(%rsp), %rsi
movq 0x8(%rsp), %rdi
testl %eax, %eax
je 0x20895
btl %ebx, %r14d
cmovbl %r13d, %ebp
addl %r12d, %r13d
andl %r9d, %r13d
incl %r12d
movl %ebp, %eax
cmpl %r15d, %r13d
jne 0x20825
jmp 0x2089a
movl (%rdi), %r15d
movb $0x1, %al
jmp 0x2093f
movq 0x28(%rsp), %rax
movl %eax, %r15d
movq 0x28(%rsp), %rdx
cmpl %edx, %eax
movq 0x20(%rsp), %r14
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jne 0x208d9
movl %r13d, %eax
shrl $0x4, %eax
movl (%r8,%rax,4), %eax
leal (,%r13,2), %ecx
shrl %cl, %eax
cmpl %edx, %ebp
cmovel %r13d, %ebp
testb $0x2, %al
cmovel %r13d, %ebp
movl %ebp, %r15d
movl %r15d, %eax
shrl $0x4, %eax
movl (%r8,%rax,4), %edx
leal (%r15,%r15), %ecx
andl $0x1e, %ecx
shrl %cl, %edx
testb $0x2, %dl
jne 0x208fc
testb $0x1, %dl
jne 0x2091f
movb $0x1, %cl
xorl %eax, %eax
jmp 0x20941
movq 0x18(%rdi), %rdx
movl %r15d, %r8d
movq %rsi, (%rdx,%r8,8)
movl $0x3, %edx
shll %cl, %edx
notl %edx
movq 0x10(%rdi), %rcx
andl %edx, (%rcx,%rax,4)
incl 0x4(%rdi)
incl 0x8(%rdi)
jmp 0x2093d
movq 0x18(%rdi), %rdx
movl %r15d, %r8d
movq %rsi, (%rdx,%r8,8)
movl $0x3, %edx
shll %cl, %edx
notl %edx
movq 0x10(%rdi), %rcx
andl %edx, (%rcx,%rax,4)
incl 0x4(%rdi)
xorl %eax, %eax
xorl %ecx, %ecx
testb %al, %al
jne 0x20964
testb %cl, %cl
je 0x20955
movq 0x20(%rdi), %rax
movl %r15d, %ecx
movl (%rax,%rcx,4), %ebx
jmp 0x20964
movl 0x4(%rdi), %ebx
decl %ebx
movq 0x20(%rdi), %rax
movl %r15d, %ecx
movl %ebx, (%rax,%rcx,4)
movq 0x30(%rsp), %r15
incl (%r15)
movslq %ebx, %rax
imulq $0x38, %rax, %rcx
movq 0x8(%r15), %rdx
movq 0x18(%r15), %rsi
leaq (%rdx,%rcx), %rbx
movq (%rsi,%rax,8), %rax
leaq 0x10(%rdx,%rcx), %r13
movq %rax, 0x18(%r13)
movl -0x4(%r13), %eax
movl (%r13), %ebp
incl %eax
cmpl %ebp, %eax
jbe 0x209c8
movl %eax, %esi
leaq 0x18(%rbx), %r8
leaq 0x794a0(%rip), %rax     # 0x99e47
movq %rax, (%rsp)
movl $0x10, %edi
movl $0x4, %edx
movq %r13, %rcx
xorl %r9d, %r9d
callq 0x16026
testl %eax, %eax
js 0x205e4
movq 0x18(%rbx), %rax
movl 0xc(%rbx), %ecx
shlq $0x4, %rcx
movq 0x50(%rsp), %rdx
movq %rdx, (%rax,%rcx)
movq 0x48(%rsp), %rdx
movq %rdx, 0x8(%rax,%rcx)
movl 0x38(%r15), %eax
testl %eax, %eax
je 0x20a25
movl (%r13), %esi
cmpl %esi, %ebp
je 0x20a0f
movq 0x20(%rbx), %rdi
imull %eax, %esi
callq 0x4840
testq %rax, %rax
je 0x205e4
movq %rax, 0x20(%rbx)
movslq 0x38(%r15), %rdx
movl 0xc(%rbx), %edi
imull %edx, %edi
addq 0x20(%rbx), %rdi
movq %r14, %rsi
callq 0x43c0
movl 0xc(%rbx), %eax
leal 0x1(%rax), %ecx
movl %ecx, 0xc(%rbx)
cmpl $0x0, 0x30(%rbx)
sete %dl
cmpl $0x2, %ecx
setae %cl
andb %dl, %cl
xorl %r12d, %r12d
cmpb $0x1, %cl
jne 0x205e4
movl %eax, %eax
movq 0x18(%rbx), %rsi
leal -0x1(%rax), %edi
shlq $0x4, %rdi
leaq (%rsi,%rdi), %rcx
movq %rax, %r8
shlq $0x4, %r8
leaq (%rsi,%r8), %rdx
movq (%rsi,%r8), %r8
cmpq %r8, (%rsi,%rdi)
jl 0x205e4
jg 0x20a94
movq 0x8(%rcx), %rcx
movq 0x8(%rdx), %rdx
cmpq %rdx, %rcx
jl 0x20a94
testq %rax, %rax
jne 0x205e4
cmpq %rdx, %rcx
jg 0x205e4
movl $0x1, 0x30(%rbx)
jmp 0x205e4
leaq 0x793ac(%rip), %rdi     # 0x99e53
leaq 0x793b8(%rip), %rsi     # 0x99e66
leaq 0x793ba(%rip), %rcx     # 0x99e6f
movl $0xac, %edx
callq 0x42f0