// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x10825
movq -0x10(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x30(%rbp)
callq 0xfde0
movq %rax, -0x38(%rbp)
movq $0x0, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq $0x0, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rdx
movl $0x2, %esi
callq 0x8860
cmpl $0x0, %eax
jl 0x107e9
movq -0x30(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x10612
jmp 0x105eb
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movsbl (%rax), %eax
cmpl $0x23, %eax
je 0x1066c
leaq 0x1dc37(%rip), %rax     # 0x2e260
cmpl $0x2, (%rax)
jl 0x1064d
movq 0x1d9c3(%rip), %rax     # 0x2dff8
movq (%rax), %rdi
leaq 0x17bcf(%rip), %rsi     # 0x2820e
leaq 0x17be0(%rip), %rdx     # 0x28226
movb $0x0, %al
callq 0x2260
movq -0x18(%rbp), %rdi
callq 0x2040
movq -0x38(%rbp), %rdi
callq 0xfe40
movq $0x0, -0x8(%rbp)
jmp 0x10836
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movsbl 0x1(%rax), %eax
cmpl $0x23, %eax
je 0x107a9
movq -0x10(%rbp), %rax
cmpq $0x0, 0x30(%rax)
je 0x107a9
movq $0x0, -0x60(%rbp)
movq $0x0, -0x68(%rbp)
movq $0x0, -0x58(%rbp)
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rdi
leaq 0x17a27(%rip), %rsi     # 0x280de
callq 0x2380
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
callq 0x7500
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rdi
xorl %esi, %esi
leaq -0x68(%rbp), %rdx
leaq -0x3c(%rbp), %rcx
callq 0x10840
cmpl $0x0, %eax
jl 0x1078e
leaq 0x17b43(%rip), %rdi     # 0x28233
leaq -0x28(%rbp), %rsi
callq 0x10880
movq -0x58(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x10880
movq -0x50(%rbp), %rdi
xorl %esi, %esi
leaq -0x68(%rbp), %rdx
leaq -0x3c(%rbp), %rcx
callq 0x10840
leaq 0x17b21(%rip), %rdi     # 0x28241
leaq -0x28(%rbp), %rsi
callq 0x10880
movq -0x58(%rbp), %rdi
callq 0x2390
movl %eax, %edi
leaq -0x28(%rbp), %rsi
callq 0x108c0
leaq 0x17f17(%rip), %rdi     # 0x2865b
movl $0x2, %esi
leaq -0x28(%rbp), %rdx
callq 0x10ab0
cmpl $0xa, -0x3c(%rbp)
je 0x10789
jmp 0x1075a
movq -0x50(%rbp), %rdi
callq 0x10c00
movl %eax, %ecx
movl %ecx, -0x6c(%rbp)
xorl %eax, %eax
cmpl $0xa, %ecx
movb %al, -0x6d(%rbp)
je 0x1077c
cmpl $-0x1, -0x6c(%rbp)
setne %al
movb %al, -0x6d(%rbp)
movb -0x6d(%rbp), %al
testb $0x1, %al
jne 0x10785
jmp 0x10787
jmp 0x1075a
jmp 0x10789
jmp 0x106cd
movq -0x58(%rbp), %rdi
callq 0x2040
movq -0x50(%rbp), %rdi
callq 0x7560
movq -0x48(%rbp), %rdi
callq 0x2030
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x30(%rbp), %rax
movq (%rax), %rax
movl %eax, %esi
leaq -0x28(%rbp), %rdx
callq 0x10ab0
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movsbl 0x1(%rax), %eax
cmpl $0x23, %eax
je 0x107d6
jmp 0x107e9
movl $0xa, %edi
leaq -0x28(%rbp), %rsi
callq 0x10ce0
jmp 0x105eb
movq -0x28(%rbp), %rax
addq $0x1, %rax
movl %eax, %ecx
movq -0x38(%rbp), %rax
movl %ecx, (%rax)
movq -0x20(%rbp), %rax
movl %eax, %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x18(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x38(%rbp), %rdi
callq 0xfb00
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x10836
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0xff80
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq