// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/region.c
// Function: reg_insert
static int reg_insert(reghash_t *h, int tid, hts_pos_t beg, hts_pos_t end) {

    khint_t k;
    reglist_t *p;

    if (!h)
        return -1;

    // Put reg in the hash table if not already there
    k = kh_get(reg, h, tid);
    if (k == kh_end(h)) { // absent from the hash table
        int ret;
        k = kh_put(reg, h, tid, &ret);
        if (-1 == ret) {
            return -1;
        }
        memset(&kh_val(h, k), 0, sizeof(reglist_t));
        kh_val(h, k).tid = tid;
    }
    p = &kh_val(h, k);

    // Add beg and end to the list
    if (p->n == p->m) {
        uint32_t new_m = p->m ? p->m<<1 : 4;
        if (new_m == 0) return -1;
        hts_pair_pos_t *new_a = realloc(p->a, new_m * sizeof(p->a[0]));
        if (new_a == NULL) return -1;
        p->m = new_m;
        p->a = new_a;
    }
    p->a[p->n].beg = beg;
    p->a[p->n++].end = end;

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x30e7a
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x30fdb
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x31330
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl (%rcx), %eax
jne 0x30ef3
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
leaq -0x3c(%rbp), %rdx
callq 0x31470
movl %eax, -0x2c(%rbp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl -0x3c(%rbp), %eax
jne 0x30ebd
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x30fdb
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
movl -0x2c(%rbp), %eax
imulq $0x18, %rax, %rax
addq %rax, %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x4250
movl -0x14(%rbp), %ecx
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x2c(%rbp), %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x10(%rax)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x2c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movl (%rax), %eax
movq -0x38(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jne 0x30f92
movq -0x38(%rbp), %rax
cmpl $0x0, 0x4(%rax)
je 0x30f30
movq -0x38(%rbp), %rax
movl 0x4(%rax), %eax
shll %eax
movl %eax, -0x4c(%rbp)
jmp 0x30f3a
movl $0x4, %eax
movl %eax, -0x4c(%rbp)
jmp 0x30f3a
movl -0x4c(%rbp), %eax
movl %eax, -0x40(%rbp)
cmpl $0x0, -0x40(%rbp)
jne 0x30f52
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x30fdb
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rdi
movl -0x40(%rbp), %eax
movl %eax, %esi
shlq $0x4, %rsi
callq 0x4820
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x30f7c
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x30fdb
movl -0x40(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x48(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rcx
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x38(%rbp), %rdx
movl (%rdx), %edx
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rcx
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x38(%rbp), %rsi
movl (%rsi), %edx
movl %edx, %edi
addl $0x1, %edi
movl %edi, (%rsi)
movl %edx, %edx
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)