// File: /workspace/github_cpp_makefile_star2_O3/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 0x45a46
movq %r9, %r14
movl %r8d, %r15d
movl %ecx, %r12d
movq %rsi, %rbp
movq %rdi, %rbx
movq %rdx, 0x40(%rsp)
movq %rsi, %rdi
callq 0x49c0
movq %rax, %r13
movq 0x18(%rbx), %rdi
movl 0x8(%rdi), %eax
cmpl 0xc(%rdi), %eax
movq %rdi, 0x8(%rsp)
movq %rbx, 0x48(%rsp)
jb 0x457ff
movl (%rdi), %esi
movl 0x4(%rdi), %eax
addl %eax, %eax
cmpl %eax, %esi
jbe 0x457e6
decl %esi
jmp 0x457e8
incl %esi
movq 0x8(%rsp), %rdi
callq 0x46c91
movq 0x8(%rsp), %rdi
testl %eax, %eax
js 0x4590e
movl %r12d, 0x14(%rsp)
movl (%rdi), %eax
movq %rax, 0x18(%rsp)
leal -0x1(%rax), %esi
movsbl (%r13), %r12d
testl %r12d, %r12d
je 0x45842
movb 0x1(%r13), %al
testb %al, %al
je 0x45845
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 0x45827
jmp 0x45845
xorl %r12d, %r12d
movq %rbp, 0x38(%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 0x4586d
movl %r12d, %ebp
jmp 0x45946
movq %r13, 0x20(%rsp)
movl %r15d, 0x10(%rsp)
movq %r14, 0x30(%rsp)
movl $0x1, %ebx
movl %r12d, %r14d
movq 0x18(%rsp), %rbp
movl %esi, 0x2c(%rsp)
movq %r8, 0x50(%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 0x45915
testb $0x1, %al
jne 0x458db
movq 0x18(%rdi), %rax
movl %r14d, %ecx
movq (%rax,%rcx,8), %rdi
movq 0x20(%rsp), %rsi
callq 0x4750
movq 0x50(%rsp), %r8
movl 0x2c(%rsp), %esi
movq 0x8(%rsp), %rdi
testl %eax, %eax
je 0x45915
btl %r15d, %r13d
cmovbl %r14d, %ebp
addl %ebx, %r14d
andl %esi, %r14d
incl %ebx
cmpl %r12d, %r14d
jne 0x45892
movb $0x1, %al
movq 0x18(%rsp), %rdx
movl %edx, %ecx
cmpl %edx, %ebp
movq 0x30(%rsp), %r14
movl 0x10(%rsp), %r15d
movq 0x20(%rsp), %r13
je 0x45936
jmp 0x45946
movl (%rdi), %ebp
jmp 0x459be
movl %r15d, %ecx
shrl %cl, %r13d
testb $0x2, %r13b
sete %al
movl %ebp, %ecx
movl %r14d, %r12d
movq 0x30(%rsp), %r14
movl 0x10(%rsp), %r15d
movq 0x20(%rsp), %r13
cmpl 0x18(%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 0x4598d
testb $0x1, %dl
movl 0x14(%rsp), %r12d
je 0x45a59
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 0x459be
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 0x14(%rsp), %r12d
movq 0x48(%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 0x45a0e
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 0x48d0
testq %rax, %rax
je 0x45a4d
movq %rax, 0x10(%rbp)
movl 0x8(%rbp), %ecx
jmp 0x45a12
movq 0x10(%rbp), %rax
leal 0x1(%rcx), %edx
movl %edx, 0x8(%rbp)
movslq %ecx, %rcx
movq %r13, (%rax,%rcx,8)
movq 0x40(%rsp), %rax
movq %rax, 0x8(%rbx)
movl %r12d, (%rbx)
movl %r15d, 0x4(%rbx)
movq %r14, 0x10(%rbx)
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x5eb7
jmp 0x45a52
callq 0x5e9b
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x45a35
movq 0x1c568(%rip), %rax     # 0x61fc8
movq (%rax), %rdi
leaq 0xeb41(%rip), %rsi      # 0x545ab
xorl %ebx, %ebx
movq 0x38(%rsp), %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0x4770
movq %r13, %rdi
callq 0x4610
jmp 0x45a35