// File: /workspace/github_cpp_makefile_star2_O1/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/bam_import.c
// Function: sam_header_read
bam_header_t *sam_header_read(tamFile fp)
{
	int ret, dret;
	bam_header_t *header = bam_header_init();
	kstring_t *str = fp->str;
	while ((ret = ks_getuntil(fp->ks, KS_SEP_TAB, str, &dret)) >= 0 && str->s[0] == '@') { // skip header
		str->s[str->l] = dret; // note that str->s is NOT null terminated!!
		append_text(header, str);
		if (dret != '\n') {
			ret = ks_getuntil(fp->ks, '\n', str, &dret);
			str->s[str->l] = '\n'; // NOT null terminated!!
			append_text(header, str);
		}
		++fp->n_lines;
	}
	sam_header_parse(header);
	bam_init_header_hash(header);
	fp->is_first = 1;
	return header;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %eax, %eax
callq 0x11c86
movq %rax, %r14
movq 0x8(%rbx), %rdi
movq 0x10(%rbx), %r15
leaq 0x4(%rsp), %rcx
movl $0x1, %esi
movq %r15, %rdx
callq 0x13054
testl %eax, %eax
js 0x135e4
leaq 0x4(%rsp), %r12
movq 0x10(%r15), %rax
cmpb $0x40, (%rax)
jne 0x135e4
movb 0x4(%rsp), %cl
movq (%r15), %rdx
movb %cl, (%rax,%rdx)
movl 0x30(%r14), %eax
movl (%r15), %ecx
leal -0x1(%rax), %edx
movl %edx, %esi
sarl %esi
orl %edx, %esi
movl %esi, %edx
sarl $0x2, %edx
orl %esi, %edx
movl %edx, %esi
sarl $0x4, %esi
orl %edx, %esi
movl %esi, %edx
sarl $0x8, %edx
orl %esi, %edx
movl %edx, %esi
sarl $0x10, %esi
orl %edx, %esi
addl %ecx, %eax
incl %eax
movl %eax, %ecx
sarl %ecx
orl %eax, %ecx
movl %ecx, %eax
sarl $0x2, %eax
orl %ecx, %eax
movl %eax, %ecx
sarl $0x4, %ecx
orl %eax, %ecx
movl %ecx, %edx
sarl $0x8, %edx
orl %ecx, %edx
movl %edx, %eax
sarl $0x10, %eax
orl %edx, %eax
cmpl %eax, %esi
jge 0x134d2
incl %eax
movq 0x38(%r14), %rdi
movslq %eax, %rsi
callq 0x3610
movq %rax, 0x38(%r14)
movslq 0x30(%r14), %rdi
addq 0x38(%r14), %rdi
movq (%r15), %rdx
movq 0x10(%r15), %rsi
incq %rdx
callq 0x3580
movl (%r15), %eax
movl 0x30(%r14), %ecx
addl %ecx, %eax
incl %eax
movl %eax, 0x30(%r14)
movq 0x38(%r14), %rcx
cltq
movb $0x0, (%rcx,%rax)
cmpl $0xa, 0x4(%rsp)
je 0x135c4
movq 0x8(%rbx), %rdi
movl $0xa, %esi
movq %r15, %rdx
movq %r12, %rcx
callq 0x13054
movq (%r15), %rax
movq 0x10(%r15), %rcx
movb $0xa, (%rcx,%rax)
movl 0x30(%r14), %eax
movl (%r15), %ecx
leal -0x1(%rax), %edx
movl %edx, %esi
sarl %esi
orl %edx, %esi
movl %esi, %edx
sarl $0x2, %edx
orl %esi, %edx
movl %edx, %esi
sarl $0x4, %esi
orl %edx, %esi
movl %esi, %edx
sarl $0x8, %edx
orl %esi, %edx
movl %edx, %esi
sarl $0x10, %esi
orl %edx, %esi
addl %ecx, %eax
incl %eax
movl %eax, %ecx
sarl %ecx
orl %eax, %ecx
movl %ecx, %eax
sarl $0x2, %eax
orl %ecx, %eax
movl %eax, %ecx
sarl $0x4, %ecx
orl %eax, %ecx
movl %ecx, %edx
sarl $0x8, %edx
orl %ecx, %edx
movl %edx, %eax
sarl $0x10, %eax
orl %edx, %eax
cmpl %eax, %esi
jge 0x13594
incl %eax
movq 0x38(%r14), %rdi
movslq %eax, %rsi
callq 0x3610
movq %rax, 0x38(%r14)
movslq 0x30(%r14), %rdi
addq 0x38(%r14), %rdi
movq (%r15), %rdx
movq 0x10(%r15), %rsi
incq %rdx
callq 0x3580
movl (%r15), %eax
movl 0x30(%r14), %ecx
addl %ecx, %eax
incl %eax
movl %eax, 0x30(%r14)
movq 0x38(%r14), %rcx
cltq
movb $0x0, (%rcx,%rax)
incq 0x18(%rbx)
movq 0x8(%rbx), %rdi
movl $0x1, %esi
movq %r15, %rdx
movq %r12, %rcx
callq 0x13054
testl %eax, %eax
jns 0x13453
movq %r14, %rdi
callq 0x132e8
movq %r14, %rdi
callq 0x112f2
movl $0x1, 0x20(%rbx)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq