// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/synced_bcf_reader.c
// Function: regions_add
static int _regions_add(bcf_sr_regions_t *reg, const char *chr, hts_pos_t start, hts_pos_t end)
{
    if ( start==-1 && end==-1 )
    {
        start = 0; end = MAX_CSI_COOR-1;
    }
    else
    {
        start--; end--; // store 0-based coordinates
    }

    if ( !reg->seq_hash )
         reg->seq_hash = khash_str2int_init();

    int iseq;
    if ( khash_str2int_get(reg->seq_hash, chr, &iseq)<0 )
    {
        // the chromosome block does not exist
        iseq = reg->nseqs++;
        reg->seq_names = (char**) realloc(reg->seq_names,sizeof(char*)*reg->nseqs);
        reg->regs = (region_t*) realloc(reg->regs,sizeof(region_t)*reg->nseqs);
        memset(&reg->regs[reg->nseqs-1],0,sizeof(region_t));
        reg->seq_names[iseq] = strdup(chr);
        reg->regs[iseq].creg = -1;
        khash_str2int_set(reg->seq_hash,reg->seq_names[iseq],iseq);
    }

    region_t *creg = &reg->regs[iseq];
    hts_expand(region1_t,creg->nregs+1,creg->mregs,creg->regs);
    creg->regs[creg->nregs].start = start;
    creg->regs[creg->nregs].end   = end;
    creg->nregs++;

    return 0; // FIXME: check for errs in this function
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
cmpq $-0x1, -0x18(%rbp)
jne 0x392ce
cmpq $-0x1, -0x20(%rbp)
jne 0x392ce
movq $0x0, -0x18(%rbp)
movabsq $0xffffffffffe, %rax    # imm = 0xFFFFFFFFFFE
movq %rax, -0x20(%rbp)
jmp 0x392e6
movq -0x18(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x18(%rbp)
movq -0x20(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x88(%rax)
jne 0x39307
callq 0x3ad60
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x88(%rax)
movq -0x8(%rbp), %rax
movq 0x88(%rax), %rdi
movq -0x10(%rbp), %rsi
leaq -0x24(%rbp), %rdx
callq 0x3a580
cmpl $0x0, %eax
jge 0x39429
movq -0x8(%rbp), %rcx
movl 0x98(%rcx), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, 0x98(%rcx)
movl %eax, -0x24(%rbp)
movq -0x8(%rbp), %rax
movq 0x90(%rax), %rdi
movq -0x8(%rbp), %rax
movslq 0x98(%rax), %rsi
shlq $0x3, %rsi
callq 0x4840
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x90(%rax)
movq -0x8(%rbp), %rax
movq 0x80(%rax), %rdi
movq -0x8(%rbp), %rax
movslq 0x98(%rax), %rax
imulq $0x18, %rax, %rsi
callq 0x4840
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x80(%rax)
movq -0x8(%rbp), %rax
movq 0x80(%rax), %rdi
movq -0x8(%rbp), %rax
movl 0x98(%rax), %eax
subl $0x1, %eax
cltq
imulq $0x18, %rax, %rax
addq %rax, %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x4240
movq -0x10(%rbp), %rdi
callq 0x4930
movq %rax, %rdx
movq -0x8(%rbp), %rax
movq 0x90(%rax), %rax
movslq -0x24(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x8(%rbp), %rax
movq 0x80(%rax), %rax
movslq -0x24(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl $0xffffffff, 0x10(%rax) # imm = 0xFFFFFFFF
movq -0x8(%rbp), %rax
movq 0x88(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x90(%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
movl -0x24(%rbp), %edx
callq 0x3b5f0
movq -0x8(%rbp), %rax
movq 0x80(%rax), %rax
movslq -0x24(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movl 0x8(%rax), %eax
addl $0x1, %eax
movq -0x30(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jle 0x394b6
movq -0x30(%rbp), %rax
movl 0x8(%rax), %eax
addl $0x1, %eax
cmpl $0x1, %eax
jl 0x39474
movq -0x30(%rbp), %rax
movl 0x8(%rax), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x3947e
movl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x3947e
movl -0x34(%rbp), %eax
movslq %eax, %rdi
movq -0x30(%rbp), %rax
movslq 0xc(%rax), %rsi
movq -0x30(%rbp), %r9
movl $0x4, %edx
movl $0x10, %ecx
xorl %r8d, %r8d
leaq 0xd8fb0(%rip), %rax     # 0x112454
movq %rax, (%rsp)
callq 0x16180
movl %eax, %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0xc(%rax)
jmp 0x394b8
movq -0x18(%rbp), %rcx
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq -0x30(%rbp), %rdx
movslq 0x8(%rdx), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rcx
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq -0x30(%rbp), %rdx
movslq 0x8(%rdx), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
movq -0x30(%rbp), %rax
movl 0x8(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x8(%rax)
xorl %eax, %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)