// File: /workspace/github_c_makefile_star2_O1/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 0x2a33b
movq %r9, %rbp
movl %ecx, %ebx
movl %edx, %r14d
movq %rsi, %r15
movq %rdi, %r13
movl %r8d, 0x28(%rsp)
movq %rsi, %rdi
callq 0x35f0
movq %rax, %r12
movq 0x18(%r13), %rdi
movl 0x8(%rdi), %eax
cmpl 0xc(%rdi), %eax
movq %rdi, (%rsp)
movl %r14d, 0x24(%rsp)
jb 0x2a0e5
movl (%rdi), %esi
movl 0x4(%rdi), %eax
addl %eax, %eax
cmpl %eax, %esi
jbe 0x2a0ce
decl %esi
jmp 0x2a0d0
incl %esi
movq (%rsp), %rdi
callq 0x2b5e2
movq (%rsp), %rdi
testl %eax, %eax
js 0x2a1d9
movl (%rdi), %eax
movq %rax, 0x8(%rsp)
leal -0x1(%rax), %r8d
movsbl (%r12), %r14d
testl %r14d, %r14d
je 0x2a125
movb 0x1(%r12), %al
testb %al, %al
je 0x2a128
movq %r12, %rcx
addq $0x2, %rcx
movl %r14d, %edx
shll $0x5, %edx
subl %r14d, %edx
movsbl %al, %r14d
addl %edx, %r14d
movb (%rcx), %al
incq %rcx
testb %al, %al
jne 0x2a10a
jmp 0x2a128
xorl %r14d, %r14d
movq %r13, 0x30(%rsp)
movq %r12, 0x18(%rsp)
andl %r8d, %r14d
movq 0x10(%rdi), %rsi
movl %r14d, %eax
shrl $0x4, %eax
movl (%rsi,%rax,4), %eax
leal (%r14,%r14), %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x2a222
movq %r15, 0x38(%rsp)
movl %ebx, 0x20(%rsp)
movq %rbp, 0x10(%rsp)
movl $0x1, %ebx
movl %r14d, %r12d
movq 0x8(%rsp), %rax
movl %eax, %r13d
movq %rsi, 0x40(%rsp)
movl %r8d, 0x2c(%rsp)
movl %r12d, %eax
shrl $0x4, %eax
movl (%rsi,%rax,4), %ebp
leal (%r12,%r12), %r15d
andl $0x1e, %r15d
movl %ebp, %eax
movl %r15d, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x2a1e1
testb $0x1, %al
jne 0x2a1bf
movq 0x18(%rdi), %rax
movl %r12d, %ecx
movq (%rax,%rcx,8), %rdi
movq 0x18(%rsp), %rsi
callq 0x3620
movl 0x2c(%rsp), %r8d
movq 0x40(%rsp), %rsi
movq (%rsp), %rdi
testl %eax, %eax
je 0x2a1e1
btl %r15d, %ebp
cmovbl %r12d, %r13d
addl %ebx, %r12d
andl %r8d, %r12d
incl %ebx
movl %r13d, %eax
cmpl %r14d, %r12d
jne 0x2a178
jmp 0x2a1e6
movl (%rdi), %r14d
jmp 0x2a26a
movq 0x8(%rsp), %rax
movl %eax, %r14d
movq 0x8(%rsp), %rcx
cmpl %ecx, %eax
movq 0x10(%rsp), %rbp
movl 0x20(%rsp), %ebx
movq 0x38(%rsp), %r15
jne 0x2a222
movq %rcx, %rdx
movl %r12d, %eax
shrl $0x4, %eax
movl (%rsi,%rax,4), %eax
leal (%r12,%r12), %ecx
shrl %cl, %eax
cmpl %edx, %r13d
cmovel %r12d, %r13d
testb $0x2, %al
cmovel %r12d, %r13d
movl %r13d, %r14d
movl %r14d, %eax
shrl $0x4, %eax
movl (%rsi,%rax,4), %esi
leal (%r14,%r14), %ecx
andl $0x1e, %ecx
shrl %cl, %esi
testb $0x2, %sil
jne 0x2a26e
movb $0x1, %dl
testb $0x1, %sil
movq 0x18(%rsp), %r12
movq 0x30(%rsp), %r13
je 0x2a29b
movq 0x18(%rdi), %rdx
movl %r14d, %esi
movq %r12, (%rdx,%rsi,8)
movl $0x3, %edx
shll %cl, %edx
notl %edx
movq 0x10(%rdi), %rcx
andl %edx, (%rcx,%rax,4)
incl 0x4(%rdi)
xorl %edx, %edx
jmp 0x2a29b
movq 0x18(%rdi), %rdx
movl %r14d, %esi
movq 0x18(%rsp), %r12
movq %r12, (%rdx,%rsi,8)
movl $0x3, %edx
shll %cl, %edx
notl %edx
movq 0x10(%rdi), %rcx
andl %edx, (%rcx,%rax,4)
incl 0x4(%rdi)
incl 0x8(%rdi)
xorl %edx, %edx
movq 0x30(%rsp), %r13
testb %dl, %dl
jne 0x2a356
movq 0x18(%r13), %rax
movl %r14d, %ecx
leaq (%rcx,%rcx,2), %r14
shlq $0x3, %r14
addq 0x20(%rax), %r14
movl 0xc(%r13), %eax
cmpl %eax, 0x8(%r13)
jne 0x2a30c
movq %rbp, 0x10(%rsp)
movl %ebx, %r15d
leal (%rax,%rax), %ecx
testl %eax, %eax
movl $0x10, %eax
cmovnel %ecx, %eax
movl %eax, 0xc(%r13)
movq 0x10(%r13), %rdi
movslq %eax, %rsi
shlq $0x3, %rsi
callq 0x37b0
movq %rax, %rbx
testq %rax, %rax
je 0x2a380
movq %r13, %rbp
movq %rbx, 0x10(%r13)
testq %rbx, %rbx
movl %r15d, %ebx
movq %rbp, %r13
movq 0x10(%rsp), %rbp
je 0x2a340
movq 0x10(%r13), %rax
movslq 0x8(%r13), %rcx
leal 0x1(%rcx), %edx
movl %edx, 0x8(%r13)
movq %r12, (%rax,%rcx,8)
movslq 0x24(%rsp), %rax
movq %rax, 0x8(%r14)
movl %ebx, (%r14)
movl 0x28(%rsp), %eax
movl %eax, 0x4(%r14)
movq %rbp, 0x10(%r14)
xorl %ebx, %ebx
jmp 0x2a345
callq 0x4b8b
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x33c8b(%rip), %rax     # 0x5dfe8
movq (%rax), %rdi
leaq 0x262a1(%rip), %rsi     # 0x50608
xorl %ebx, %ebx
movq %r15, %rdx
movq %rbp, %rcx
xorl %eax, %eax
callq 0x37e0
movq %r12, %rdi
callq 0x3370
jmp 0x2a345
movq %r13, %rbp
callq 0x4b6f
jmp 0x2a2fc