// File: /workspace/github_c_makefile_star2_O3/lh3[P]bgt/vcf.c
// Function: vcf_hdr_read
bcf_hdr_t *vcf_hdr_read(htsFile *fp)
{
	if (!fp->is_bin) {
		kstring_t txt, *s = &fp->line;
		bcf_hdr_t *h;
		h = bcf_hdr_init();
		txt.l = txt.m = 0; txt.s = 0;
		while (hts_getline(fp, KS_SEP_LINE, s) >= 0) {
			if (s->l == 0) continue;
			if (s->s[0] != '#') {
				if (hts_verbose >= 2)
					fprintf(stderr, "[E::%s] no sample line\n", __func__);
				free(txt.s);
				bcf_hdr_destroy(h);
				return 0;
			}
			if (s->s[1] != '#' && fp->fn_aux) { // insert contigs here
				int dret;
				gzFile f;
				kstream_t *ks;
				kstring_t tmp;
				tmp.l = tmp.m = 0; tmp.s = 0;
				f = gzopen(fp->fn_aux, "r");
				ks = ks_init(f);
				while (ks_getuntil(ks, 0, &tmp, &dret) >= 0) {
					int c;
					kputs("##contig=<ID=", &txt); kputs(tmp.s, &txt);
					ks_getuntil(ks, 0, &tmp, &dret);
					kputs(",length=", &txt); kputw(atol(tmp.s), &txt);
					kputsn(">\n", 2, &txt);
					if (dret != '\n')
						while ((c = ks_getc(ks)) != '\n' && c != -1); // skip the rest of the line
				}
				free(tmp.s);
				ks_destroy(ks);
				gzclose(f);
			}
			kputsn(s->s, s->l, &txt);
			if (s->s[1] != '#') break;
			kputc('\n', &txt);
		}
		h->l_text = txt.l + 1; // including NULL
		h->m_text = txt.m;
		h->text = txt.s;
		bcf_hdr_parse(h);
		return h;
	} else return bcf_hdr_read((BGZF*)fp->fp);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbp
testb $0x1, (%rdi)
jne 0xc2cb
leaq 0x10(%rbp), %r14
callq 0xb93d
movq %rax, %r13
xorl %r12d, %r12d
xorl %ebx, %ebx
xorl %r15d, %r15d
movq %r14, 0x40(%rsp)
movq %rbp, %rdi
movl $0x2, %esi
movq %r14, %rdx
callq 0x67e0
testl %eax, %eax
js 0xc30d
movq (%r14), %rax
testq %rax, %rax
je 0xbdd7
movq %r13, 0x10(%rsp)
movq %rbp, 0x18(%rsp)
movq 0x20(%rbp), %rbp
cmpb $0x23, (%rbp)
jne 0xc2e2
cmpb $0x23, 0x1(%rbp)
je 0xc1eb
movq 0x18(%rsp), %rcx
movq 0x30(%rcx), %rdi
testq %rdi, %rdi
je 0xc1eb
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq $0x0, 0x30(%rsp)
leaq 0x13405(%rip), %rsi     # 0x1f248
callq 0x2370
movq %rax, 0x38(%rsp)
movq %rax, %rdi
callq 0x5c48
movq %rax, %rbp
movq %rax, %rdi
xorl %esi, %esi
leaq 0x20(%rsp), %rdx
leaq 0xc(%rsp), %rcx
xorl %r8d, %r8d
callq 0x5ca1
testl %eax, %eax
js 0xc1c2
leaq 0xe(%r15), %r14
cmpq %rbx, %r14
jb 0xbec2
movq %r14, %rax
shrq %rax
orq %r14, %rax
movq %rax, %rcx
shrq $0x2, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x4, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x8, %rcx
orq %rax, %rcx
movq %rcx, %rbx
shrq $0x10, %rbx
orq %rcx, %rbx
incq %rbx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x2330
movq %rax, %r12
movabsq $0x3d44493c3d676974, %rax # imm = 0x3D44493C3D676974
movq %rax, 0x5(%r12,%r15)
movabsq $0x6769746e6f632323, %rax # imm = 0x6769746E6F632323
movq %rax, (%r12,%r15)
movb $0x0, 0xd(%r12,%r15)
movq 0x30(%rsp), %rdi
movq %rdi, 0x48(%rsp)
callq 0x2170
movslq %eax, %r13
addq %r13, %r14
cmpq %rbx, %r14
jb 0xbf41
movq %r14, %rax
shrq %rax
orq %r14, %rax
movq %rax, %rcx
shrq $0x2, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x4, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x8, %rcx
orq %rax, %rcx
movq %rcx, %rbx
shrq $0x10, %rbx
orq %rcx, %rbx
incq %rbx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x2330
movq %rax, %r12
addq $0xd, %r15
leaq (%r12,%r15), %rdi
movq 0x48(%rsp), %rsi
movq %r13, %rdx
callq 0x2280
leaq (%r15,%r13), %r14
movb $0x0, (%r12,%r14)
movq %rbp, %rdi
xorl %esi, %esi
leaq 0x20(%rsp), %rdx
leaq 0xc(%rsp), %rcx
xorl %r8d, %r8d
callq 0x5ca1
addq %r13, %r15
addq $0x9, %r15
cmpq %rbx, %r15
jb 0xbfc4
movq %r15, %rax
shrq %rax
orq %r15, %rax
movq %rax, %rcx
shrq $0x2, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x4, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x8, %rcx
orq %rax, %rcx
movq %rcx, %rbx
shrq $0x10, %rbx
orq %rcx, %rbx
incq %rbx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x2330
movq %rax, %r12
movabsq $0x3d6874676e656c2c, %rax # imm = 0x3D6874676E656C2C
movq %rax, (%r12,%r14)
movb $0x0, 0x8(%r12,%r14)
addq $0x8, %r14
movq 0x30(%rsp), %rdi
callq 0x2380
testl %eax, %eax
je 0xc0a9
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
xorl %r13d, %r13d
movl $0xcccccccd, %r8d       # imm = 0xCCCCCCCD
movl %ecx, %edx
imulq %r8, %rdx
shrq $0x23, %rdx
leal (%rdx,%rdx), %esi
leal (%rsi,%rsi,4), %esi
movl %ecx, %edi
subl %esi, %edi
orb $0x30, %dil
movb %dil, 0x50(%rsp,%r13)
incq %r13
cmpl $0x9, %ecx
movl %edx, %ecx
ja 0xbffe
testl %eax, %eax
jns 0xc034
movl %r13d, %eax
incl %r13d
movb $0x2d, 0x50(%rsp,%rax)
movslq %r13d, %rax
addq %rax, %r15
cmpq %rbx, %r15
jb 0xc081
movq %r15, %rax
shrq %rax
orq %r15, %rax
movq %rax, %rcx
shrq $0x2, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x4, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x8, %rcx
orq %rax, %rcx
movq %rcx, %rbx
shrq $0x10, %rbx
orq %rcx, %rbx
incq %rbx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x2330
movq %rax, %r12
movl %r13d, %eax
leaq 0x4f(%rsp), %rcx
addq %rcx, %rax
incl %r13d
movb (%rax), %cl
movb %cl, (%r12,%r14)
incq %r14
decl %r13d
decq %rax
cmpl $0x1, %r13d
jg 0xc08f
movq %r14, %r15
jmp 0xc0f5
cmpq %rbx, %r15
jb 0xc0f0
movq %r15, %rax
shrq %rax
orq %r15, %rax
movq %rax, %rcx
shrq $0x2, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x4, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x8, %rcx
orq %rax, %rcx
movq %rcx, %rbx
shrq $0x10, %rbx
orq %rcx, %rbx
incq %rbx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x2330
movq %rax, %r12
movb $0x30, (%r12,%r14)
movb $0x0, (%r12,%r15)
leaq 0x3(%r15), %rax
cmpq %rbx, %rax
jb 0xc145
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rbx
shrq $0x10, %rbx
orq %rax, %rbx
incq %rbx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x2330
movq %rax, %r12
movw $0xa3e, (%r12,%r15)     # imm = 0xA3E
movb $0x0, 0x2(%r12,%r15)
cmpl $0xa, 0xc(%rsp)
je 0xc1b6
movl 0x8(%rbp), %edx
movl (%rbp), %ecx
movl 0x4(%rbp), %eax
testb $0x3, %dl
je 0xc16b
cmpl %eax, %ecx
jge 0xc1b6
movq 0x18(%rbp), %rsi
cmpl %eax, %ecx
jl 0xc1a8
movl $0x0, (%rbp)
movq 0x10(%rbp), %rdi
sarl $0x2, %edx
callq 0x2240
movl %eax, 0x4(%rbp)
movl 0x8(%rbp), %edx
movl %edx, %ecx
sarl $0x2, %ecx
cmpl %ecx, %eax
jge 0xc19d
andl $-0x4, %edx
incl %edx
movl %edx, 0x8(%rbp)
testl %eax, %eax
je 0xc1b6
movl (%rbp), %ecx
movq 0x18(%rbp), %rsi
movslq %ecx, %rdi
incl %ecx
movl %ecx, (%rbp)
cmpb $0xa, (%rsi,%rdi)
jne 0xc162
addq $0x2, %r15
movq %rbp, %rdi
jmp 0xbe5b
movq 0x30(%rsp), %rdi
callq 0x2050
movq %rbp, %rdi
callq 0x5c85
movq 0x38(%rsp), %rdi
callq 0x2040
movq 0x18(%rsp), %rcx
movq 0x10(%rcx), %rax
movq 0x20(%rcx), %rbp
movq %r15, %r13
movslq %eax, %rdx
addq %rdx, %r15
incq %r15
cmpq %rbx, %r15
jb 0xc244
movq %r15, %rax
shrq %rax
orq %r15, %rax
movq %rax, %rcx
shrq $0x2, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x4, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x8, %rcx
orq %rax, %rcx
movq %rcx, %rbx
shrq $0x10, %rbx
orq %rcx, %rbx
incq %rbx
movq %r12, %rdi
movq %rbx, %rsi
movq %rdx, %r14
callq 0x2330
movq %r14, %rdx
movq %rax, %r12
leaq (%rdx,%r13), %r14
addq %r12, %r13
movq %r13, %rdi
movq %rbp, %rsi
callq 0x2280
movb $0x0, (%r12,%r14)
movq 0x18(%rsp), %rbp
movq 0x20(%rbp), %rax
cmpb $0x23, 0x1(%rax)
jne 0xc305
cmpq %rbx, %r15
movq 0x10(%rsp), %r13
jb 0xc2ba
movq %r15, %rax
shrq %rax
orq %r15, %rax
movq %rax, %rcx
shrq $0x2, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x4, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x8, %rcx
orq %rax, %rcx
movq %rcx, %rbx
shrq $0x10, %rbx
orq %rcx, %rbx
incq %rbx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x2330
movq %rax, %r12
movw $0xa, (%r12,%r14)
movq 0x40(%rsp), %r14
jmp 0xbdd7
movq 0x38(%rbp), %rdi
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xba37
leaq 0x19f67(%rip), %rax     # 0x26250
cmpl $0x2, (%rax)
jge 0xc336
movq %r12, %rdi
callq 0x2050
movq 0x10(%rsp), %rdi
callq 0xb980
xorl %r13d, %r13d
jmp 0xc324
movq %r14, %r15
movq 0x10(%rsp), %r13
incl %r15d
movl %r15d, (%r13)
movl %ebx, 0x4(%r13)
movq %r12, 0x48(%r13)
movq %r13, %rdi
callq 0xb797
movq %r13, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x2ba3
jmp 0xc2ee