// File: /workspace/github_c_makefile_star2_O2/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 %r9, %r15
movq %rcx, %r13
movq %rsi, %rax
movq %rdi, %r14
xorl %ebp, %ebp
testq %rcx, %rcx
cmovleq %rbp, %r13
testq %r8, %r8
cmovgq %r8, %rbp
movabsq $0x800000000, %rcx      # imm = 0x800000000
cmpq %rcx, %r13
cmovgeq %rcx, %r13
cmpq %rcx, %rbp
cmovgeq %rcx, %rbp
subq %rsi, %rdx
leaq 0x1(%rdx), %rsi
leaq 0x48(%rdi), %rdx
andq $0x0, 0x48(%rdi)
movq %rax, %rdi
callq 0x1b4da
pushq $-0x1
popq %r12
testl %eax, %eax
js 0x1ba4d
movq 0x10(%r14), %rdi
movq 0x58(%r14), %rsi
leaq 0xc(%rsp), %rdx
callq 0x1b329
testl %eax, %eax
je 0x1b764
movl 0x4(%r14), %ecx
movl %ecx, 0x8(%rsp)
movl (%r14), %eax
cmpl %ecx, %eax
jl 0x1b6d2
movslq %eax, %rsi
incq %rsi
leaq 0x18(%r14), %r8
leaq 0x5d81c(%rip), %rax     # 0x78ec7
movq %rax, (%rsp)
pushq $0x8
popq %rdi
pushq $0x4
popq %rdx
leaq 0x8(%rsp), %rcx
pushq $0x1
popq %r9
callq 0x12c5c
testl %eax, %eax
js 0x1ba4d
movl (%r14), %eax
movl 0x4(%r14), %ecx
cmpl %ecx, %eax
jl 0x1b70a
leaq 0x4(%r14), %rbx
incl %eax
movslq %eax, %rsi
leaq 0x8(%r14), %r8
leaq 0x5d7dd(%rip), %rax     # 0x78ec7
movq %rax, (%rsp)
pushq $0x38
popq %rdi
pushq $0x4
popq %rdx
pushq $0x1
popq %r9
movq %rbx, %rcx
callq 0x12c5c
testl %eax, %eax
js 0x1ba4d
movl (%rbx), %ecx
cmpl %ecx, 0x8(%rsp)
jne 0x1ba5f
movq 0x58(%r14), %rdi
callq 0x4930
movq 0x18(%r14), %rdx
movslq (%r14), %rcx
movq %rax, (%rdx,%rcx,8)
movq 0x10(%r14), %r12
pushq $-0x1
popq %rbx
testq %r12, %r12
je 0x1b942
movq 0x18(%r14), %rax
movq (%rax,%rcx,8), %rax
movq %rax, 0x10(%rsp)
movl 0x8(%r12), %eax
cmpl 0xc(%r12), %eax
jb 0x1b785
movl (%r12), %esi
movl 0x4(%r12), %eax
addl %eax, %eax
cmpl %eax, %esi
jbe 0x1b773
decl %esi
jmp 0x1b775
movq %r15, %r12
movq %rbp, %r15
movl 0xc(%rsp), %ebx
jmp 0x1b94f
incl %esi
movq %r12, %rdi
callq 0x1c9a1
testl %eax, %eax
js 0x1b942
movq %r15, 0x18(%rsp)
movl (%r12), %ebx
leal -0x1(%rbx), %r15d
movq 0x10(%rsp), %rdi
callq 0x1c987
movl %eax, %edi
andl %r15d, %edi
movq 0x10(%r12), %rsi
movl %edi, %eax
shrl $0x4, %eax
movl (%rsi,%rax,4), %eax
leal (%rdi,%rdi), %ecx
shrl %cl, %eax
testb $0x2, %al
je 0x1b7c3
movl %edi, %ebx
movq 0x18(%rsp), %r15
jmp 0x1b8b0
movl %r15d, %edx
movq %r12, 0x20(%rsp)
movq %rbp, 0x28(%rsp)
movq %r13, 0x30(%rsp)
pushq $0x1
popq %rbp
movl %edi, %r12d
movq %rbx, 0x38(%rsp)
movq %r14, 0x50(%rsp)
movq %rdi, 0x48(%rsp)
movq %rsi, 0x40(%rsp)
movl %r12d, %eax
shrl $0x4, %eax
movl (%rsi,%rax,4), %r15d
leal (%r12,%r12), %r13d
andl $0x1e, %r13d
movl %r15d, %eax
movl %r13d, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x1b87c
testb $0x1, %al
jne 0x1b844
movq 0x20(%rsp), %rax
movq 0x18(%rax), %rax
movl %r12d, %ecx
movq (%rax,%rcx,8), %rdi
movq 0x10(%rsp), %rsi
movl %edx, %r14d
callq 0x46c0
movl %r14d, %edx
movq 0x48(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq 0x50(%rsp), %r14
testl %eax, %eax
je 0x1b87c
btl %r13d, %r15d
cmovbl %r12d, %ebx
addl %ebp, %r12d
andl %edx, %r12d
incl %ebp
cmpl %edi, %r12d
jne 0x1b7ef
movb $0x1, %al
movq 0x38(%rsp), %rdx
movl %edx, %ecx
cmpl %edx, %ebx
movq 0x18(%rsp), %r15
movq 0x30(%rsp), %r13
movq 0x28(%rsp), %rbp
movq 0x20(%rsp), %r12
je 0x1b8a2
jmp 0x1b8b0
movl %r13d, %ecx
shrl %cl, %r15d
testb $0x2, %r15b
sete %al
movl %ebx, %ecx
movl %r12d, %edi
movq 0x18(%rsp), %r15
movq 0x30(%rsp), %r13
movq 0x28(%rsp), %rbp
movq 0x20(%rsp), %r12
cmpl 0x38(%rsp), %ecx
cmovel %edi, %ecx
testb %al, %al
cmovnel %edi, %ecx
movl %ecx, %ebx
movl %ebx, %edx
shrl $0x4, %edx
movl (%rsi,%rdx,4), %esi
leal (%rbx,%rbx), %ecx
andl $0x1e, %ecx
shrl %cl, %esi
movl %ebx, %eax
testb $0x2, %sil
jne 0x1b8d8
testb $0x1, %sil
jne 0x1b910
movq 0x20(%r12), %rcx
movl (%rcx,%rax,4), %ebx
jmp 0x1b942
pushq $0x3
popq %rsi
shll %cl, %esi
movq 0x18(%r12), %rcx
movq 0x10(%rsp), %rdi
movq %rdi, (%rcx,%rax,8)
notl %esi
movq 0x10(%r12), %rcx
andl %esi, (%rcx,%rdx,4)
movq 0x4(%r12), %rbx
movq %rbx, %xmm0
pcmpeqd %xmm1, %xmm1
psubd %xmm1, %xmm0
movq %xmm0, 0x4(%r12)
jmp 0x1b93a
movq 0x18(%r12), %rsi
movq 0x10(%rsp), %rdi
movq %rdi, (%rsi,%rax,8)
pushq $0x3
popq %rsi
shll %cl, %esi
notl %esi
movq 0x10(%r12), %rcx
andl %esi, (%rcx,%rdx,4)
movl 0x4(%r12), %ebx
leal 0x1(%rbx), %ecx
movl %ecx, 0x4(%r12)
movq 0x20(%r12), %rcx
movl %ebx, (%rcx,%rax,4)
movq %r15, %r12
movq %rbp, %r15
movl %ebx, 0xc(%rsp)
incl (%r14)
movslq %ebx, %rdx
imulq $0x38, %rdx, %rax
movq 0x8(%r14), %rcx
movq 0x18(%r14), %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 0x1b9ab
addq %rax, %rcx
addq $0x10, %rcx
movl %edx, %esi
leaq 0x18(%rbx), %r8
leaq 0x5d539(%rip), %rax     # 0x78ec7
movq %rax, (%rsp)
pushq $0x10
popq %rdi
pushq $0x4
popq %rdx
xorl %r9d, %r9d
callq 0x12c5c
testl %eax, %eax
js 0x1ba49
movl 0xc(%rbx), %edi
movq 0x18(%rbx), %rax
movl %edi, %ecx
shlq $0x4, %rcx
movq %r13, (%rax,%rcx)
movq %r15, 0x8(%rax,%rcx)
movl 0x38(%r14), %ecx
testl %ecx, %ecx
je 0x1ba09
movl 0x10(%rbx), %esi
movq 0x20(%rbx), %rax
cmpl %esi, %ebp
jne 0x1b9d6
movq %r12, %rsi
jmp 0x1b9f8
imull %ecx, %esi
movq %rax, %rdi
callq 0x4840
testq %rax, %rax
movq %r12, %rsi
pushq $-0x1
popq %r12
je 0x1ba4d
movq %rax, 0x20(%rbx)
movl 0x38(%r14), %ecx
movl 0xc(%rbx), %edi
imull %ecx, %edi
addq %rax, %rdi
movslq %ecx, %rdx
callq 0x43c0
movl 0xc(%rbx), %edi
leal 0x1(%rdi), %eax
movl %eax, 0xc(%rbx)
xorl %r12d, %r12d
cmpl $0x0, 0x30(%rbx)
jne 0x1ba4d
cmpl $0x2, %eax
jb 0x1ba4d
movq 0x18(%rbx), %rcx
leal -0x1(%rdi), %eax
shlq $0x4, %rax
addq %rcx, %rax
movl %edi, %esi
shlq $0x4, %rsi
addq %rcx, %rsi
movq %rax, %rdi
callq 0x1ba7e
testl %eax, %eax
jle 0x1ba4d
movl $0x1, 0x30(%rbx)
jmp 0x1ba4d
pushq $-0x1
popq %r12
movl %r12d, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5d46d(%rip), %rdi     # 0x78ed3
leaq 0x5d479(%rip), %rsi     # 0x78ee6
leaq 0x5d47b(%rip), %rcx     # 0x78eef
movl $0xac, %edx
callq 0x42f0