// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/regidx.c
// Function: regidx_init_string
regidx_t *regidx_init_string(const char *str, regidx_parse_f parser, regidx_free_f free_f, size_t payload_size, void *usr_dat)
{
    kstring_t tmp = KS_INITIALIZE;
    regidx_t *idx = (regidx_t*) calloc(1,sizeof(regidx_t));
    if ( !idx ) return NULL;

    idx->free  = free_f;
    idx->parse = parser ? parser : regidx_parse_tab;
    idx->usr   = usr_dat;
    idx->seq2regs = khash_str2int_init();
    if (!idx->seq2regs) goto fail;
    idx->payload_size = payload_size;
    if ( payload_size ) {
        idx->payload = malloc(payload_size);
        if (!idx->payload) goto fail;
    }

    const char *ss = str;
    while ( *ss )
    {
        while ( *ss && isspace_c(*ss) ) ss++;
        const char *se = ss;
        while ( *se && *se!='\r' && *se!='\n' ) se++;
        if (kputsn(ss, se-ss, ks_clear(&tmp)) < 0) goto fail;
        if (regidx_insert(idx, tmp.s) < 0) goto fail;
        while ( *se && isspace_c(*se) ) se++;
        ss = se;
    }
    ks_free(&tmp);
    return idx;

 fail:
    regidx_destroy(idx);
    ks_free(&tmp);
    return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %r12
movq %rcx, %r15
movq %rdx, %rbp
movq %rsi, %r13
movq %rdi, %r14
movl $0x1, %edi
movl $0x60, %esi
callq 0x4300
testq %rax, %rax
je 0x20372
movq %rax, %rbx
movq %rbp, 0x20(%rax)
testq %r13, %r13
leaq 0x18a(%rip), %rax       # 0x203b0
cmovneq %r13, %rax
movq %rax, 0x28(%rbx)
movq %r12, 0x30(%rbx)
movl $0x1, %edi
movl $0x28, %esi
callq 0x4300
movq %rax, 0x10(%rbx)
testq %rax, %rax
je 0x20376
movl %r15d, 0x38(%rbx)
testq %r15, %r15
je 0x2026c
movq %r15, %rdi
callq 0x4680
movq %rax, 0x40(%rbx)
testq %rax, %rax
je 0x20376
movb (%r14), %r12b
xorl %ebp, %ebp
testb %r12b, %r12b
je 0x20386
callq 0x4510
movq %rax, %r13
movl $0x2401, %esi           # imm = 0x2401
xorl %edi, %edi
movq (%r13), %rdx
movzbl %r12b, %ecx
testb $0x20, 0x1(%rdx,%rcx,2)
je 0x202a7
movb 0x1(%r14), %r12b
incq %r14
testb %r12b, %r12b
jne 0x2028d
xorl %r12d, %r12d
xorl %r15d, %r15d
cmpb $0xd, %r12b
ja 0x202b9
movzbl %r12b, %ecx
btl %ecx, %esi
jb 0x202c3
movb 0x1(%r14,%r15), %r12b
incq %r15
jmp 0x202aa
cmpq $-0x2, %r15
je 0x203a0
leaq 0x2(%r15), %rdx
cmpq %rdx, %rdi
movq %rbp, %r12
jae 0x2030d
movq %rdx, %rcx
shrq $0x3e, %rcx
shrq %rdx
testq %rcx, %rcx
movl $0x0, %ecx
cmoveq %rdx, %rcx
leaq (%rcx,%r15), %rsi
addq $0x2, %rsi
movq %r12, %rdi
movq %rsi, (%rsp)
callq 0x4840
movq %rax, %rbp
testq %rax, %rax
jne 0x20314
jmp 0x20379
movq %rdi, (%rsp)
movq %r12, %rbp
movq %rbp, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x43c0
movb $0x0, (%rbp,%r15)
testl %r15d, %r15d
js 0x203ab
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x1fb65
testl %eax, %eax
js 0x203ab
addq %r15, %r14
movb (%r14), %r12b
testb %r12b, %r12b
je 0x20386
movq (%r13), %rdx
movzbl %r12b, %ecx
testb $0x20, 0x1(%rdx,%rcx,2)
je 0x20364
movb 0x1(%r14), %r12b
incq %r14
testb %r12b, %r12b
jne 0x2034b
jmp 0x20386
movl $0x2401, %esi           # imm = 0x2401
movq (%rsp), %rdi
jmp 0x20289
xorl %ebx, %ebx
jmp 0x2038e
xorl %r12d, %r12d
movq %rbx, %rdi
callq 0x2054c
xorl %ebx, %ebx
movq %r12, %rbp
movq %rbp, %rdi
callq 0x45c0
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x4050
movl $0x4b, (%rax)
movq %rbp, %r12
jmp 0x20379