// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/faidx.c
// Function: fai_insert_index
static inline int fai_insert_index(faidx_t *idx, const char *name, int64_t 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 $0x58, %rsp
testq %rsi, %rsi
je 0x38e44
movq %r9, %r12
movl %r8d, %ebp
movl %ecx, %r14d
movq %rdi, %rbx
movq %rdx, 0x40(%rsp)
movq %rsi, 0x38(%rsp)
movq %rsi, %rdi
callq 0x49a0
movq %rax, %r13
movq 0x18(%rbx), %r15
movl 0x8(%r15), %eax
cmpl 0xc(%r15), %eax
movq %rbx, 0x48(%rsp)
jb 0x38c25
movl (%r15), %esi
movl 0x4(%r15), %eax
addl %eax, %eax
cmpl %eax, %esi
jbe 0x38c13
decl %esi
jmp 0x38c15
incl %esi
movq %r15, %rdi
callq 0x39bab
testl %eax, %eax
js 0x38d08
movl %r14d, 0xc(%rsp)
movl (%r15), %ebx
leal -0x1(%rbx), %r14d
movq %r13, %rdi
callq 0x39e55
movl %eax, %edi
andl %r14d, %edi
movq %r15, 0x18(%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 0x38c60
movl %edi, %r15d
jmp 0x38d42
movq %r13, 0x10(%rsp)
movl %ebp, 0x8(%rsp)
movq %r12, 0x30(%rsp)
movq %rbx, %r15
pushq $0x1
popq %rbx
movl %edi, %ebp
movq %r15, 0x28(%rsp)
movq %rdi, 0x50(%rsp)
movl %r14d, 0x24(%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 0x38d10
testb $0x1, %al
jne 0x38cd7
movq 0x18(%rsp), %rax
movq 0x18(%rax), %rax
movl %ebp, %ecx
movq (%rax,%rcx,8), %rdi
movq 0x10(%rsp), %rsi
movq %rdx, %r14
callq 0x4750
movq 0x50(%rsp), %rdi
movq %r14, %rdx
movl 0x24(%rsp), %r14d
testl %eax, %eax
je 0x38d10
btl %r12d, %r13d
cmovbl %ebp, %r15d
addl %ebx, %ebp
andl %r14d, %ebp
incl %ebx
cmpl %edi, %ebp
jne 0x38c85
movb $0x1, %al
movq 0x28(%rsp), %rsi
movl %esi, %ecx
cmpl %esi, %r15d
movq 0x30(%rsp), %r12
movl 0x8(%rsp), %ebp
movq 0x10(%rsp), %r13
je 0x38d35
jmp 0x38d42
movl (%r15), %r15d
jmp 0x38dbf
movl %r12d, %ecx
shrl %cl, %r13d
testb $0x2, %r13b
sete %al
movl %r15d, %ecx
movl %ebp, %edi
movq 0x30(%rsp), %r12
movl 0x8(%rsp), %ebp
movq 0x10(%rsp), %r13
movq 0x28(%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 0x38d8a
testb $0x1, %dl
movl 0xc(%rsp), %r14d
je 0x38e7a
movq 0x18(%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 0x38dbf
movq 0x18(%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 0xc(%rsp), %r14d
movq 0x48(%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 0x38e0c
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 0x48c0
testq %rax, %rax
je 0x38e59
movq %rax, 0x10(%r15)
movl 0x8(%r15), %ecx
jmp 0x38e10
movq 0x10(%r15), %rax
leal 0x1(%rcx), %edx
movl %edx, 0x8(%r15)
movslq %ecx, %rcx
movq %r13, (%rax,%rcx,8)
movq 0x40(%rsp), %rax
movq %rax, 0x8(%rbx)
movl %r14d, (%rbx)
movl %ebp, 0x4(%rbx)
movq %r12, 0x10(%rbx)
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x1e185(%rip), %rax     # 0x56fd0
movq (%rax), %rcx
leaq 0xe485(%rip), %rdi      # 0x472da
pushq $0x20
jmp 0x38e6c
movq 0x1e170(%rip), %rax     # 0x56fd0
movq (%rax), %rcx
leaq 0xe4d7(%rip), %rdi      # 0x47341
pushq $0x1f
popq %rsi
pushq $0x1
popq %rdx
callq 0x4a20
pushq $-0x1
popq %rbx
jmp 0x38e33
movq 0x1e14f(%rip), %rax     # 0x56fd0
movq (%rax), %rdi
leaq 0xe470(%rip), %rsi      # 0x472fb
xorl %ebx, %ebx
movq 0x38(%rsp), %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0x4770
movq %r13, %rdi
callq 0x4600
jmp 0x38e33