// File: /workspace/github_c_makefile_star2_O3/lh3[P]bgt/vcf.c
// Function: bcf_hdr_parse1
int bcf_hdr_parse1(bcf_hdr_t *h, const char *str)
{
	khint_t k;
	if (*str != '#') return -1;
	if (str[1] == '#') {
		uint32_t info;
		int len, ret, id_beg, id_end;
		char *s;

		len = bcf_hdr_parse_line2(str, &info, &id_beg, &id_end);
		if (len < 0) return -1;
		s = (char*)malloc(id_end - id_beg + 1);
		strncpy(s, str + id_beg, id_end - id_beg);
		s[id_end - id_beg] = 0;
		if (len > 0) { // a contig line
			vdict_t *d = (vdict_t*)h->dict[BCF_DT_CTG];
			k = kh_put(vdict, d, s, &ret);
			if (ret == 0) {
				if (hts_verbose >= 2)
					fprintf(stderr, "[W::%s] Duplicated contig name '%s'. Skipped.\n", __func__, s);
				free(s);
			} else {
				kh_val(d, k) = bcf_idinfo_def;
				kh_val(d, k).id = kh_size(d) - 1;
				kh_val(d, k).info[0] = len;
			}
		} else { // a FILTER/INFO/FORMAT line
			vdict_t *d = (vdict_t*)h->dict[BCF_DT_ID];
			k = kh_put(vdict, d, s, &ret);
			if (ret) { // absent from the dict
				kh_val(d, k) = bcf_idinfo_def;
				kh_val(d, k).info[info&0xf] = info;
				kh_val(d, k).id = kh_size(d) - 1;
			} else {
				kh_val(d, k).info[info&0xf] = info;
				free(s);
			}
		}
	} else {
		int i = 0;
		const char *p, *q;
		vdict_t *d = (vdict_t*)h->dict[BCF_DT_ID];
		// add samples
		d = (vdict_t*)h->dict[BCF_DT_SAMPLE];
		for (p = q = str;; ++q) {
			int ret;
			if (*q != '\t' && *q != 0) continue;
			if (++i > 9) {
				char *s;
				s = (char*)malloc(q - p + 1);
				strncpy(s, p, q - p);
				s[q - p] = 0;
				k = kh_put(vdict, d, s, &ret);
				if (ret) { // absent
					kh_val(d, k) = bcf_idinfo_def;
					kh_val(d, k).id = kh_size(d) - 1;
				} else {
					if (hts_verbose >= 2)
						fprintf(stderr, "[W::%s] Duplicated sample name '%s'. Skipped.\n", __func__, s);
				}
			}
			if (*q == 0) break;
			p = q + 1;
		}
	}
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpb $0x23, (%rsi)
jne 0xb4d8
movq %rsi, %r8
movq %rdi, %r15
cmpb $0x23, 0x1(%rsi)
jne 0xb349
leaq 0x4(%rsp), %rsi
leaq 0x10(%rsp), %rdx
leaq 0xc(%rsp), %rcx
movq %r8, %rdi
movq %r8, %r14
callq 0xace8
testl %eax, %eax
js 0xb4d8
movl %eax, %ebp
movslq 0xc(%rsp), %r12
movslq 0x10(%rsp), %r13
subq %r13, %r12
leaq 0x1(%r12), %rdi
callq 0x22e0
movq %rax, %rbx
addq %r13, %r14
movq %rax, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x2080
movb $0x0, (%rbx,%r12)
testl %ebp, %ebp
je 0xb436
movq 0x38(%r15), %r14
leaq 0x14(%rsp), %r15
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0xb4e9
cmpl $0x0, (%r15)
je 0xb488
movq 0x20(%r14), %rcx
movl %eax, %eax
shlq $0x4, %rax
movups 0x13ef1(%rip), %xmm0    # 0x1f220
movups %xmm0, (%rcx,%rax)
movl 0x4(%r14), %ecx
decl %ecx
movq 0x20(%r14), %rdx
movl %ecx, 0xc(%rdx,%rax)
movl %ebp, (%rdx,%rax)
jmp 0xb4d6
movq 0x40(%r15), %r14
leaq 0x1(%r8), %r15
movb $0x23, %al
movq %r8, %r13
xorl %ebx, %ebx
testb %al, %al
je 0xb368
movzbl %al, %eax
cmpl $0x9, %eax
jne 0xb404
cmpl $0x9, %ebx
jl 0xb3f4
movl %ebx, 0x8(%rsp)
movq %r13, %r12
subq %r8, %r12
leaq 0x1(%r12), %rdi
movq %r8, %rbx
callq 0x22e0
movq %rax, %rbp
movq %rax, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x2080
movq %rbp, %rax
subq %rbx, %rax
movb $0x0, (%rax,%r13)
movq %r14, %rdi
movq %rbp, %rsi
leaq 0x4(%rsp), %rdx
callq 0xb4e9
cmpl $0x0, 0x4(%rsp)
je 0xb3e4
movq 0x20(%r14), %rcx
movl %eax, %eax
shlq $0x4, %rax
movups 0x13e54(%rip), %xmm0    # 0x1f220
movups %xmm0, (%rcx,%rax)
movl 0x4(%r14), %ecx
decl %ecx
movq 0x20(%r14), %rdx
movl %ecx, 0xc(%rdx,%rax)
movl 0x8(%rsp), %ebx
jmp 0xb3f4
leaq 0x1ae65(%rip), %rax     # 0x26250
cmpl $0x2, (%rax)
movl 0x8(%rsp), %ebx
jge 0xb412
cmpb $0x0, -0x1(%r15)
je 0xb4d6
incl %ebx
movq %r15, %r8
movb (%r15), %al
incq %r15
incq %r13
jmp 0xb358
movq 0x1abdf(%rip), %rax     # 0x25ff8
movq (%rax), %rdi
leaq 0x13ebc(%rip), %rsi     # 0x1f2df
leaq 0x13ea6(%rip), %rdx     # 0x1f2d0
movq %rbp, %rcx
xorl %eax, %eax
callq 0x2250
jmp 0xb3f4
movq 0x30(%r15), %r14
leaq 0x14(%rsp), %r15
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0xb4e9
cmpl $0x0, (%r15)
je 0xb4b8
movq 0x20(%r14), %rcx
movl %eax, %eax
shlq $0x4, %rax
movups 0x13dbc(%rip), %xmm0    # 0x1f220
movups %xmm0, (%rcx,%rax)
movl 0x4(%rsp), %ecx
movq 0x20(%r14), %rdx
leaq (%rdx,%rax), %rsi
movl %ecx, %edi
andl $0xf, %edi
movl %ecx, (%rsi,%rdi,4)
movl 0x4(%r14), %ecx
decl %ecx
movl %ecx, 0xc(%rdx,%rax)
jmp 0xb4d6
leaq 0x1adc1(%rip), %rax     # 0x26250
cmpl $0x2, (%rax)
jl 0xb4ce
movq 0x1ab5d(%rip), %rax     # 0x25ff8
movq (%rax), %rdi
leaq 0x13dfc(%rip), %rsi     # 0x1f2a1
leaq 0x13e24(%rip), %rdx     # 0x1f2d0
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2250
jmp 0xb4ce
movl %eax, %eax
shlq $0x4, %rax
addq 0x20(%r14), %rax
movl 0x4(%rsp), %ecx
movl %ecx, %edx
andl $0xf, %edx
movl %ecx, (%rax,%rdx,4)
movq %rbx, %rdi
callq 0x2050
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq