// File: /workspace/github_cpp_makefile_star2_O1/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 0x469cc
movq %r9, %rbp
movl %ecx, %ebx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r13
movl %r8d, 0x30(%rsp)
movq %rsi, %rdi
callq 0x49c0
movq %rax, %r12
movq 0x18(%r13), %rdi
movl 0x8(%rdi), %eax
cmpl 0xc(%rdi), %eax
movq %rdi, 0x8(%rsp)
movq %r14, 0x48(%rsp)
jb 0x46775
movl (%rdi), %esi
movl 0x4(%rdi), %eax
addl %eax, %eax
cmpl %eax, %esi
jbe 0x4675c
decl %esi
jmp 0x4675e
incl %esi
movq 0x8(%rsp), %rdi
callq 0x47c73
movq 0x8(%rsp), %rdi
testl %eax, %eax
js 0x4686a
movl (%rdi), %eax
movq %rax, 0x10(%rsp)
leal -0x1(%rax), %r8d
movsbl (%r12), %r14d
testl %r14d, %r14d
je 0x467b5
movb 0x1(%r12), %al
testb %al, %al
je 0x467b8
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 0x4679a
jmp 0x467b8
xorl %r14d, %r14d
movq %r13, 0x38(%rsp)
movq %r12, 0x20(%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 0x468b3
movq %r15, 0x40(%rsp)
movl %ebx, 0x2c(%rsp)
movq %rbp, 0x18(%rsp)
movl $0x1, %ebx
movl %r14d, %r12d
movq 0x10(%rsp), %rax
movl %eax, %r13d
movq %rsi, 0x50(%rsp)
movl %r8d, 0x34(%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 0x46872
testb $0x1, %al
jne 0x46850
movq 0x18(%rdi), %rax
movl %r12d, %ecx
movq (%rax,%rcx,8), %rdi
movq 0x20(%rsp), %rsi
callq 0x4750
movl 0x34(%rsp), %r8d
movq 0x50(%rsp), %rsi
movq 0x8(%rsp), %rdi
testl %eax, %eax
je 0x46872
btl %r15d, %ebp
cmovbl %r12d, %r13d
addl %ebx, %r12d
andl %r8d, %r12d
incl %ebx
movl %r13d, %eax
cmpl %r14d, %r12d
jne 0x46808
jmp 0x46877
movl (%rdi), %r14d
jmp 0x468fb
movq 0x10(%rsp), %rax
movl %eax, %r14d
movq 0x10(%rsp), %rcx
cmpl %ecx, %eax
movq 0x18(%rsp), %rbp
movl 0x2c(%rsp), %ebx
movq 0x40(%rsp), %r15
jne 0x468b3
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 0x468ff
movb $0x1, %dl
testb $0x1, %sil
movq 0x20(%rsp), %r12
movq 0x38(%rsp), %r13
je 0x4692c
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 0x4692c
movq 0x18(%rdi), %rdx
movl %r14d, %esi
movq 0x20(%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 0x38(%rsp), %r13
testb %dl, %dl
jne 0x469e7
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 0x4699d
movq %rbp, 0x18(%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 0x48d0
movq %rax, %rbx
testq %rax, %rax
je 0x46a11
movq %r13, %rbp
movq %rbx, 0x10(%r13)
testq %rbx, %rbx
movl %r15d, %ebx
movq %rbp, %r13
movq 0x18(%rsp), %rbp
je 0x469d1
movq 0x10(%r13), %rax
movslq 0x8(%r13), %rcx
leal 0x1(%rcx), %edx
movl %edx, 0x8(%r13)
movq %r12, (%rax,%rcx,8)
movq 0x48(%rsp), %rax
movq %rax, 0x8(%r14)
movl %ebx, (%r14)
movl 0x30(%rsp), %eax
movl %eax, 0x4(%r14)
movq %rbp, 0x10(%r14)
xorl %ebx, %ebx
jmp 0x469d6
callq 0x5f59
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x1d5da(%rip), %rax     # 0x63fc8
movq (%rax), %rdi
leaq 0xf8f3(%rip), %rsi      # 0x562eb
xorl %ebx, %ebx
movq %r15, %rdx
movq %rbp, %rcx
xorl %eax, %eax
callq 0x4770
movq %r12, %rdi
callq 0x4610
jmp 0x469d6
movq %r13, %rbp
callq 0x5f3d
jmp 0x4698d