// File: /workspace/github_c_makefile_star2_O3/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 0x2a1bd
movq %r9, %r14
movl %r8d, %r15d
movl %ecx, %r12d
movq %rsi, %rbp
movq %rdi, %rbx
movl %edx, 0x20(%rsp)
movq %rsi, %rdi
callq 0x35f0
movq %rax, %r13
movq 0x18(%rbx), %rdi
movl 0x8(%rdi), %eax
cmpl 0xc(%rdi), %eax
movq %rdi, (%rsp)
movq %rbx, 0x38(%rsp)
jb 0x29f77
movl (%rdi), %esi
movl 0x4(%rdi), %eax
addl %eax, %eax
cmpl %eax, %esi
jbe 0x29f60
decl %esi
jmp 0x29f62
incl %esi
movq (%rsp), %rdi
callq 0x2b407
movq (%rsp), %rdi
testl %eax, %eax
js 0x2a085
movl %r12d, 0xc(%rsp)
movl (%rdi), %eax
movq %rax, 0x10(%rsp)
leal -0x1(%rax), %esi
movsbl (%r13), %r12d
testl %r12d, %r12d
je 0x29fba
movb 0x1(%r13), %al
testb %al, %al
je 0x29fbd
movq %r13, %rcx
addq $0x2, %rcx
movl %r12d, %edx
shll $0x5, %edx
subl %r12d, %edx
movsbl %al, %r12d
addl %edx, %r12d
movb (%rcx), %al
incq %rcx
testb %al, %al
jne 0x29f9f
jmp 0x29fbd
xorl %r12d, %r12d
movq %rbp, 0x30(%rsp)
andl %esi, %r12d
movq 0x10(%rdi), %r8
movl %r12d, %eax
shrl $0x4, %eax
movl (%r8,%rax,4), %eax
leal (%r12,%r12), %ecx
shrl %cl, %eax
testb $0x2, %al
je 0x29fe5
movl %r12d, %ebp
jmp 0x2a0bd
movq %r13, 0x18(%rsp)
movl %r15d, 0x8(%rsp)
movq %r14, 0x28(%rsp)
movl $0x1, %ebx
movl %r12d, %r14d
movq 0x10(%rsp), %rbp
movl %esi, 0x24(%rsp)
movq %r8, 0x40(%rsp)
movl %r14d, %eax
shrl $0x4, %eax
movl (%r8,%rax,4), %r13d
leal (%r14,%r14), %r15d
andl $0x1e, %r15d
movl %r13d, %eax
movl %r15d, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x2a08c
testb $0x1, %al
jne 0x2a052
movq 0x18(%rdi), %rax
movl %r14d, %ecx
movq (%rax,%rcx,8), %rdi
movq 0x18(%rsp), %rsi
callq 0x3620
movq 0x40(%rsp), %r8
movl 0x24(%rsp), %esi
movq (%rsp), %rdi
testl %eax, %eax
je 0x2a08c
btl %r15d, %r13d
cmovbl %r14d, %ebp
addl %ebx, %r14d
andl %esi, %r14d
incl %ebx
cmpl %r12d, %r14d
jne 0x2a00a
movb $0x1, %al
movq 0x10(%rsp), %rdx
movl %edx, %ecx
cmpl %edx, %ebp
movq 0x28(%rsp), %r14
movl 0x8(%rsp), %r15d
movq 0x18(%rsp), %r13
je 0x2a0ad
jmp 0x2a0bd
movl (%rdi), %ebp
jmp 0x2a135
movl %r15d, %ecx
shrl %cl, %r13d
testb $0x2, %r13b
sete %al
movl %ebp, %ecx
movl %r14d, %r12d
movq 0x28(%rsp), %r14
movl 0x8(%rsp), %r15d
movq 0x18(%rsp), %r13
cmpl 0x10(%rsp), %ecx
cmovel %r12d, %ecx
testb %al, %al
cmovnel %r12d, %ecx
movl %ecx, %ebp
movl %ebp, %eax
shrl $0x4, %eax
movl (%r8,%rax,4), %edx
leal (,%rbp,2), %ecx
andl $0x1e, %ecx
shrl %cl, %edx
testb $0x2, %dl
jne 0x2a104
testb $0x1, %dl
movl 0xc(%rsp), %r12d
je 0x2a1d0
movq 0x18(%rdi), %rdx
movl %ebp, %esi
movq %r13, (%rdx,%rsi,8)
movl $0x3, %edx
shll %cl, %edx
notl %edx
movq 0x10(%rdi), %rcx
andl %edx, (%rcx,%rax,4)
incl 0x4(%rdi)
jmp 0x2a135
movq 0x18(%rdi), %rdx
movl %ebp, %esi
movq %r13, (%rdx,%rsi,8)
movl $0x3, %edx
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 0xc(%rsp), %r12d
movq 0x38(%rsp), %rdx
movq 0x18(%rdx), %rax
movl %ebp, %ecx
movq %rdx, %rbp
leaq (%rcx,%rcx,2), %rbx
shlq $0x3, %rbx
addq 0x20(%rax), %rbx
movl 0x8(%rdx), %ecx
cmpl 0xc(%rdx), %ecx
jne 0x2a185
leal (%rcx,%rcx), %eax
testl %ecx, %ecx
movl $0x10, %ecx
cmovnel %eax, %ecx
movl %ecx, 0xc(%rbp)
movq 0x10(%rbp), %rdi
movslq %ecx, %rsi
shlq $0x3, %rsi
callq 0x37b0
testq %rax, %rax
je 0x2a1c4
movq %rax, 0x10(%rbp)
movl 0x8(%rbp), %ecx
jmp 0x2a189
movq 0x10(%rbp), %rax
leal 0x1(%rcx), %edx
movl %edx, 0x8(%rbp)
movslq %ecx, %rcx
movq %r13, (%rax,%rcx,8)
movslq 0x20(%rsp), %rax
movq %rax, 0x8(%rbx)
movl %r12d, (%rbx)
movl %r15d, 0x4(%rbx)
movq %r14, 0x10(%rbx)
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x4ad1
jmp 0x2a1c9
callq 0x4ab5
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x2a1ac
movq 0x34e11(%rip), %rax     # 0x5efe8
movq (%rax), %rdi
leaq 0x265f7(%rip), %rsi     # 0x507d8
xorl %ebx, %ebx
movq 0x30(%rsp), %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0x37e0
movq %r13, %rdi
callq 0x3370
jmp 0x2a1ac