// File: /workspace/github_c_makefile_star2_O2/zhou-lab[P]tbmate/htslib/faidx.c
// Function: fai_insert_index
static inline int fai_insert_index(faidx_t *idx, const char *name, int len, int line_len, int line_blen, uint64_t offset)
{
    if (!name) {
        fprintf(stderr, "[fai_build_core] malformed line\n");
        return -1;
    }

    char *name_key = strdup(name);
    int absent;
    khint_t k = kh_put(s, idx->hash, name_key, &absent);
    faidx1_t *v = &kh_value(idx->hash, k);

    if (! absent) {
        fprintf(stderr, "[fai_build_core] ignoring duplicate sequence \"%s\" at byte offset %"PRIu64"\n", name, offset);
        free(name_key);
        return 0;
    }

    if (idx->n == idx->m) {
        char **tmp;
        idx->m = idx->m? idx->m<<1 : 16;
        if (!(tmp = (char**)realloc(idx->name, sizeof(char*) * idx->m))) {
            fprintf(stderr, "[fai_build_core] out of memory\n");
            return -1;
        }
        idx->name = tmp;
    }
    idx->name[idx->n++] = name_key;
    v->len = len;
    v->line_len = line_len;
    v->line_blen = line_blen;
    v->offset = offset;

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
testq %rsi, %rsi
je 0x22dbc
movq %r9, %r12
movl %r8d, %ebp
movl %ecx, %r14d
movq %rdi, %rbx
movl %edx, 0x18(%rsp)
movq %rsi, 0x30(%rsp)
movq %rsi, %rdi
callq 0x3600
movq %rax, %r13
movq 0x18(%rbx), %r15
movl 0x8(%r15), %eax
cmpl 0xc(%r15), %eax
movq %rbx, 0x38(%rsp)
jb 0x22ba0
movl (%r15), %esi
movl 0x4(%r15), %eax
addl %eax, %eax
cmpl %eax, %esi
jbe 0x22b8e
decl %esi
jmp 0x22b90
incl %esi
movq %r15, %rdi
callq 0x23b25
testl %eax, %eax
js 0x22c81
movl %r14d, 0x4(%rsp)
movl (%r15), %ebx
leal -0x1(%rbx), %r14d
movq %r13, %rdi
callq 0x23dcf
movl %eax, %edi
andl %r14d, %edi
movq %r15, 0x10(%rsp)
movq 0x10(%r15), %rdx
movl %edi, %eax
shrl $0x4, %eax
movl (%rdx,%rax,4), %eax
leal (%rdi,%rdi), %ecx
shrl %cl, %eax
testb $0x2, %al
je 0x22bdb
movl %edi, %r15d
jmp 0x22cba
movq %r13, 0x8(%rsp)
movl %ebp, (%rsp)
movq %r12, 0x28(%rsp)
movq %rbx, %r15
pushq $0x1
popq %rbx
movl %edi, %ebp
movq %r15, 0x20(%rsp)
movq %rdi, 0x40(%rsp)
movl %r14d, 0x1c(%rsp)
movl %ebp, %eax
shrl $0x4, %eax
movl (%rdx,%rax,4), %r13d
leal (,%rbp,2), %r12d
andl $0x1e, %r12d
movl %r13d, %eax
movl %r12d, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x22c89
testb $0x1, %al
jne 0x22c51
movq 0x10(%rsp), %rax
movq 0x18(%rax), %rax
movl %ebp, %ecx
movq (%rax,%rcx,8), %rdi
movq 0x8(%rsp), %rsi
movq %rdx, %r14
callq 0x3630
movq 0x40(%rsp), %rdi
movq %r14, %rdx
movl 0x1c(%rsp), %r14d
testl %eax, %eax
je 0x22c89
btl %r12d, %r13d
cmovbl %ebp, %r15d
addl %ebx, %ebp
andl %r14d, %ebp
incl %ebx
cmpl %edi, %ebp
jne 0x22bff
movb $0x1, %al
movq 0x20(%rsp), %rsi
movl %esi, %ecx
cmpl %esi, %r15d
movq 0x28(%rsp), %r12
movl (%rsp), %ebp
movq 0x8(%rsp), %r13
je 0x22cad
jmp 0x22cba
movl (%r15), %r15d
jmp 0x22d37
movl %r12d, %ecx
shrl %cl, %r13d
testb $0x2, %r13b
sete %al
movl %r15d, %ecx
movl %ebp, %edi
movq 0x28(%rsp), %r12
movl (%rsp), %ebp
movq 0x8(%rsp), %r13
movq 0x20(%rsp), %rsi
cmpl %esi, %ecx
cmovel %edi, %ecx
testb %al, %al
cmovnel %edi, %ecx
movl %ecx, %r15d
movl %r15d, %eax
shrl $0x4, %eax
movl (%rdx,%rax,4), %edx
leal (%r15,%r15), %ecx
andl $0x1e, %ecx
shrl %cl, %edx
testb $0x2, %dl
jne 0x22d02
testb $0x1, %dl
movl 0x4(%rsp), %r14d
je 0x22df2
movq 0x10(%rsp), %rdi
movq 0x18(%rdi), %rdx
movl %r15d, %esi
movq %r13, (%rdx,%rsi,8)
pushq $0x3
popq %rdx
shll %cl, %edx
notl %edx
movq 0x10(%rdi), %rcx
andl %edx, (%rcx,%rax,4)
incl 0x4(%rdi)
jmp 0x22d37
movq 0x10(%rsp), %rdi
movq 0x18(%rdi), %rdx
movl %r15d, %esi
movq %r13, (%rdx,%rsi,8)
pushq $0x3
popq %rdx
shll %cl, %edx
notl %edx
movq 0x10(%rdi), %rcx
andl %edx, (%rcx,%rax,4)
movq 0x4(%rdi), %xmm0
pcmpeqd %xmm1, %xmm1
psubd %xmm1, %xmm0
movq %xmm0, 0x4(%rdi)
movl 0x4(%rsp), %r14d
movq 0x38(%rsp), %rdx
movq 0x18(%rdx), %rax
movl %r15d, %ecx
movq %rdx, %r15
imulq $0x18, %rcx, %rbx
addq 0x20(%rax), %rbx
movl 0x8(%rdx), %ecx
cmpl 0xc(%rdx), %ecx
jne 0x22d84
leal (%rcx,%rcx), %eax
testl %ecx, %ecx
pushq $0x10
popq %rcx
cmovnel %eax, %ecx
movl %ecx, 0xc(%r15)
movq 0x10(%r15), %rdi
movslq %ecx, %rsi
shlq $0x3, %rsi
callq 0x37c0
testq %rax, %rax
je 0x22dd1
movq %rax, 0x10(%r15)
movl 0x8(%r15), %ecx
jmp 0x22d88
movq 0x10(%r15), %rax
leal 0x1(%rcx), %edx
movl %edx, 0x8(%r15)
movslq %ecx, %rcx
movq %r13, (%rax,%rcx,8)
movslq 0x18(%rsp), %rax
movq %rax, 0x8(%rbx)
movl %r14d, (%rbx)
movl %ebp, 0x4(%rbx)
movq %r12, 0x10(%rbx)
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x30225(%rip), %rax     # 0x52fe8
movq (%rax), %rcx
leaq 0x1f80a(%rip), %rdi     # 0x425d7
pushq $0x20
jmp 0x22de4
movq 0x30210(%rip), %rax     # 0x52fe8
movq (%rax), %rcx
leaq 0x1f85c(%rip), %rdi     # 0x4263e
pushq $0x1f
popq %rsi
pushq $0x1
popq %rdx
callq 0x3780
pushq $-0x1
popq %rbx
jmp 0x22dab
movq 0x301ef(%rip), %rax     # 0x52fe8
movq (%rax), %rdi
leaq 0x1f7f5(%rip), %rsi     # 0x425f8
xorl %ebx, %ebx
movq 0x30(%rsp), %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0x37f0
movq %r13, %rdi
callq 0x3370
jmp 0x22dab