// File: /workspace/github_c_makefile_star2_O1/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:
testb $0x1, (%rdi)
jne 0xc130
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
leaq 0x10(%rdi), %rbx
movq %rdi, 0x28(%rsp)
callq 0xb807
movq %rax, 0x30(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
movq 0x28(%rsp), %rdi
movl $0x2, %esi
movq %rbx, 0x38(%rsp)
movq %rbx, %rdx
callq 0x6671
movq 0x28(%rsp), %rcx
testl %eax, %eax
js 0xc139
movq 0x38(%rsp), %rax
cmpq $0x0, (%rax)
je 0xc11e
movq 0x20(%rcx), %rax
cmpb $0x23, (%rax)
jne 0xc16f
cmpb $0x23, 0x1(%rax)
je 0xc024
movq 0x30(%rcx), %rdi
testq %rdi, %rdi
je 0xc024
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
movq $0x0, 0x50(%rsp)
leaq 0x1350d(%rip), %rsi     # 0x1f23b
callq 0x2370
movq %rax, 0x60(%rsp)
movq %rax, %rdi
callq 0x5b18
movq %rax, %rbx
movq %rax, %rdi
xorl %esi, %esi
leaq 0x40(%rsp), %rdx
leaq 0x24(%rsp), %rcx
xorl %r8d, %r8d
callq 0x5b79
testl %eax, %eax
js 0xc003
movq (%rsp), %r14
leaq 0xe(%r14), %rax
cmpq 0x8(%rsp), %rax
jb 0xbdb9
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, %rsi
shrq $0x10, %rsi
orq %rax, %rsi
incq %rsi
movq %rsi, 0x8(%rsp)
movq 0x10(%rsp), %rdi
callq 0x2330
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %r13
movabsq $0x3d44493c3d676974, %rax # imm = 0x3D44493C3D676974
movq %rax, 0x5(%r13,%r14)
movabsq $0x6769746e6f632323, %rax # imm = 0x6769746E6F632323
movq %rax, (%r13,%r14)
leaq 0xd(%r14), %rbp
movq %rbp, (%rsp)
movb $0x0, 0xd(%r13,%r14)
movq 0x50(%rsp), %r15
movq %r15, %rdi
callq 0x2170
movslq %eax, %r12
leaq (%r14,%r12), %rax
addq $0xe, %rax
cmpq 0x8(%rsp), %rax
jb 0xbe4f
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, %rsi
shrq $0x10, %rsi
orq %rax, %rsi
incq %rsi
movq %rsi, 0x8(%rsp)
movq %r13, %rdi
callq 0x2330
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %r13
movq %r13, %rdi
addq %rbp, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x2280
leaq (%r12,%rbp), %r14
movq %r14, (%rsp)
movb $0x0, (%r13,%r14)
movq %rbx, %rdi
xorl %esi, %esi
leaq 0x40(%rsp), %rdx
leaq 0x24(%rsp), %rcx
xorl %r8d, %r8d
callq 0x5b79
leaq (%r12,%rbp), %rax
addq $0x9, %rax
cmpq 0x8(%rsp), %rax
jb 0xbedf
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, %rsi
shrq $0x10, %rsi
orq %rax, %rsi
incq %rsi
movq %rsi, 0x8(%rsp)
movq %r13, %rdi
callq 0x2330
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rax
movabsq $0x3d6874676e656c2c, %rcx # imm = 0x3D6874676E656C2C
movq %rcx, (%rax,%r14)
leaq 0x8(%r14), %rcx
movq %rcx, (%rsp)
movb $0x0, 0x8(%rax,%r14)
movq 0x50(%rsp), %rdi
callq 0x2380
movl %eax, %edi
movq %rsp, %rsi
callq 0xc19d
movq (%rsp), %r14
leaq 0x3(%r14), %rax
cmpq 0x8(%rsp), %rax
jb 0xbf6b
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, %rsi
shrq $0x10, %rsi
orq %rax, %rsi
incq %rsi
movq %rsi, 0x8(%rsp)
movq 0x10(%rsp), %rdi
callq 0x2330
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rax
movw $0xa3e, (%rax,%r14)     # imm = 0xA3E
leaq 0x2(%r14), %rcx
movq %rcx, (%rsp)
movb $0x0, 0x2(%rax,%r14)
cmpl $0xa, 0x24(%rsp)
jne 0xbf94
movq %rbx, %rdi
jmp 0xbd46
movl 0x8(%rbx), %edx
testb $0x3, %dl
je 0xbfa8
movl (%rbx), %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl 0x4(%rbx), %ecx
jge 0xbff0
movl (%rbx), %eax
cmpl 0x4(%rbx), %eax
jl 0xbfe0
movl $0x0, (%rbx)
movq 0x10(%rbx), %rdi
movq 0x18(%rbx), %rsi
sarl $0x2, %edx
callq 0x2240
movl %eax, 0x4(%rbx)
movl 0x8(%rbx), %ecx
movl %ecx, %edx
sarl $0x2, %edx
cmpl %edx, %eax
jge 0xbfdc
andl $-0x4, %ecx
incl %ecx
movl %ecx, 0x8(%rbx)
testl %eax, %eax
je 0xbffc
movq 0x18(%rbx), %rax
movslq (%rbx), %rcx
leal 0x1(%rcx), %edx
movl %edx, (%rbx)
movzbl (%rax,%rcx), %eax
cmpl $0xa, %eax
je 0xbf8c
cmpl $-0x1, %eax
jne 0xbf94
jmp 0xbf8c
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0xbff0
movq 0x50(%rsp), %rdi
callq 0x2050
movq %rbx, %rdi
callq 0x5b5d
movq 0x60(%rsp), %rdi
callq 0x2040
movq 0x28(%rsp), %rcx
movq 0x20(%rcx), %r12
movslq 0x10(%rcx), %rbx
movq (%rsp), %r14
leaq (%rbx,%r14), %rax
incq %rax
cmpq 0x8(%rsp), %rax
jb 0xc086
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, %rsi
shrq $0x10, %rsi
orq %rax, %rsi
incq %rsi
movq %rsi, 0x8(%rsp)
movq 0x10(%rsp), %rdi
callq 0x2330
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %r15
leaq (%r15,%r14), %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x2280
addq %r14, %rbx
movq %rbx, (%rsp)
movb $0x0, (%r15,%rbx)
movq 0x28(%rsp), %rcx
movq 0x20(%rcx), %rax
cmpb $0x23, 0x1(%rax)
jne 0xc139
leaq 0x1(%rbx), %r14
cmpq 0x8(%rsp), %r14
jb 0xc10f
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, %rsi
shrq $0x10, %rsi
orq %rcx, %rsi
incq %rsi
movq %rsi, 0x8(%rsp)
movq %r15, %rdi
callq 0x2330
movq 0x28(%rsp), %rcx
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rax
movq %r14, (%rsp)
movw $0xa, (%rax,%rbx)
movq %rcx, %rdi
movl $0x2, %esi
movq 0x38(%rsp), %rdx
jmp 0xbcd1
movq 0x38(%rdi), %rdi
jmp 0xb8f8
movl (%rsp), %eax
incl %eax
movq 0x30(%rsp), %rbx
movl %eax, (%rbx)
movl 0x8(%rsp), %eax
movl %eax, 0x4(%rbx)
movq 0x10(%rsp), %rax
movq %rax, 0x48(%rbx)
movq %rbx, %rdi
callq 0xb655
movq %rbx, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1a0da(%rip), %rax     # 0x26250
cmpl $0x2, (%rax)
movq 0x30(%rsp), %rbx
jge 0xc196
movq 0x10(%rsp), %rdi
callq 0x2050
movq %rbx, %rdi
callq 0xb84a
xorl %ebx, %ebx
jmp 0xc15d
callq 0x2b80
jmp 0xc180