// File: /workspace/github_cpp_makefile_star2_O3/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/sam_header.c
// Function: sam_header_parse2
void *sam_header_parse2(const char *headerText)
{
    list_t *hlines = NULL;
    HeaderLine *hline;
    const char *text;
    char *buf=NULL;
    size_t nbuf = 0;

    if ( !headerText )
		return 0;

    text = headerText;
    while ( (text=nextline(&buf, &nbuf, text)) )
    {
        hline = sam_header_line_parse(buf);
        if ( hline && sam_header_line_validate(hline) )
            hlines = list_append(hlines, hline);
        else
        {
			if (hline) sam_header_line_free(hline);
			sam_header_free(hlines);
            if ( buf ) free(buf);
            return NULL;
        }
    }
    if ( buf ) free(buf);

    return hlines;
}

// Assembly:
testq %rdi, %rdi
je 0x1fbb3
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r15
movb (%rdi), %al
testb %al, %al
je 0x1fc42
movabsq $0x100000000, %rbx      # imm = 0x100000000
movl $0x2401, %edi           # imm = 0x2401
movq $0x0, 0x8(%rsp)
movq $0x0, 0x18(%rsp)
xorl %esi, %esi
movq %r15, %r13
movl $0x1, %ecx
xorl %r14d, %r14d
cmpb $0xd, %al
ja 0x1f809
movzbl %al, %edx
btl %edx, %edi
jb 0x1f817
movb 0x1(%r15), %al
incq %r15
addq %rbx, %r14
incl %ecx
jmp 0x1f7fd
cmpb $0xa, %al
je 0x1f830
cmpl $0xd, %edx
jne 0x1f833
xorl %eax, %eax
cmpb $0xa, 0x1(%r15)
sete %al
leaq (%r15,%rax,2), %r15
jmp 0x1f833
incq %r15
testl %ecx, %ecx
je 0x1f889
movslq %ecx, %rbp
testq %rsi, %rsi
je 0x1f853
cmpq %rbp, 0x18(%rsp)
jae 0x1f86c
movq %rsi, %rdi
movq %rbp, %rsi
callq 0x3610
jmp 0x1f85b
movq %rbp, %rdi
callq 0x31d0
movq %rax, %rsi
testq %rax, %rax
je 0x1fc53
movq %rbp, 0x18(%rsp)
movq %rsi, %rdi
movq %rsi, %r12
movq %r13, %rsi
movq %rbp, %rdx
callq 0x3680
movq %r12, %rsi
sarq $0x20, %r14
movb $0x0, (%r12,%r14)
cmpb $0x40, (%rsi)
movq %rsi, 0x10(%rsp)
jne 0x1fbd6
leaq 0x1(%rsi), %rcx
movq $-0x1, %rax
movq %rsi, %rbp
movzbl (%rcx), %edx
testl %edx, %edx
je 0x1f8bc
cmpl $0x9, %edx
je 0x1f8bc
incq %rcx
decq %rax
incq %rbp
jmp 0x1f8a5
cmpq $-0x3, %rax
jne 0x1fbdf
movl $0x10, %edi
movq %rsi, %r14
callq 0x31d0
movq %rax, %r13
movb 0x1(%r14), %al
movb %al, (%r13)
movb 0x2(%r14), %cl
movb %cl, 0x1(%r13)
movq $0x0, 0x8(%r13)
movq 0xf71b(%rip), %rsi      # 0x2f010
movq $-0x1, %r9
testq %rsi, %rsi
je 0x1f930
leaq 0xf710(%rip), %rdi      # 0x2f018
xorl %edx, %edx
movq %rsi, %r8
cmpb %al, (%r8)
jne 0x1f918
cmpb %cl, 0x1(%r8)
je 0x1f929
movq (%rdi), %r8
addq %rbx, %rdx
addq $0x8, %rdi
testq %r8, %r8
jne 0x1f90d
jmp 0x1f930
sarq $0x20, %rdx
movq %rdx, %r9
xorl %edx, %edx
movb 0x1(%rbp), %dil
incq %rbp
decq %rdx
cmpb $0x9, %dil
je 0x1f932
cmpq $-0x2, %rdx
jne 0x1fbef
testb %dil, %dil
movq %r9, 0x20(%rsp)
je 0x1fa48
movl %edi, %eax
movq %rbp, %r14
testb %al, %al
je 0x1f974
movzbl %al, %eax
cmpl $0x9, %eax
je 0x1f974
movb 0x1(%r14), %al
incq %r14
jmp 0x1f95f
leaq 0xf6f5(%rip), %rax      # 0x2f070
cmpq $0x0, (%rax,%r9,8)
jne 0x1f994
leaq 0xf6b7(%rip), %rax      # 0x2f040
cmpq $0x0, (%rax,%r9,8)
je 0x1fa17
leaq -0x1(%r14), %rcx
movzbl 0x1(%rbp), %esi
addq $0x3, %rbp
movzbl %dil, %edi
movq %rbp, %rdx
callq 0x20af3
movq %rax, %rbp
movq 0x8(%r13), %r12
testq %r12, %r12
je 0x1f9d9
movsbl (%rbp), %esi
movq %r12, %rax
movq 0x8(%rax), %rcx
cmpb %sil, (%rcx)
jne 0x1f9d1
movsbl 0x1(%rcx), %edx
cmpb 0x1(%rbp), %dl
je 0x1fa2a
movq (%rax), %rax
testq %rax, %rax
jne 0x1f9bf
movq %r12, %rdi
movq %rbp, %rsi
callq 0x1f581
movq %rax, 0x8(%r13)
xorl %edx, %edx
movq 0x20(%rsp), %r9
movzbl (%r14,%rdx), %edi
cmpl $0x9, %edi
jne 0x1f9fe
incq %rdx
jmp 0x1f9ef
testl %edi, %edi
je 0x1fa3f
addq %rdx, %r14
movq %r14, %rbp
cmpq $0x1, %rdx
je 0x1f95a
jmp 0x1fbf1
leaq -0x1(%r14), %rcx
movl $0x20, %edi
movl $0x20, %esi
jmp 0x1f9a4
leaq 0x744a(%rip), %rdi      # 0x26e7b
movq 0x10(%rsp), %rcx
xorl %eax, %eax
callq 0x501c
jmp 0x1f9d9
movq 0xf5ca(%rip), %rsi      # 0x2f010
jmp 0x1fa4a
xorl %eax, %eax
movsbl 0x1(%r13), %r8d
testq %rsi, %rsi
je 0x1fc0b
movb (%r13), %dl
movsbl %dl, %ecx
leaq 0xf5b2(%rip), %r9       # 0x2f018
xorl %edi, %edi
cmpb %dl, (%rsi)
jne 0x1fa72
cmpb %r8b, 0x1(%rsi)
je 0x1fa86
movq (%r9), %rsi
addq %rbx, %rdi
addq $0x8, %r9
testq %rsi, %rsi
jne 0x1fa68
jmp 0x1fc0f
movq %rdi, %rdx
sarq $0x1d, %rdx
leaq 0xf5dc(%rip), %rsi      # 0x2f070
movq (%rdx,%rsi), %r9
testq %r9, %r9
je 0x1fae9
movq (%r9), %rdx
testq %rdx, %rdx
je 0x1fae9
movq %rdx, %rsi
xorl %r10d, %r10d
testq %rax, %rax
je 0x1fbd1
movb (%rsi), %r11b
movq %rax, %r14
movq 0x8(%r14), %r12
cmpb %r11b, (%r12)
jne 0x1facf
movb 0x1(%r12), %bpl
cmpb 0x1(%rsi), %bpl
je 0x1fadc
movq (%r14), %r14
testq %r14, %r14
jne 0x1faba
jmp 0x1fbb6
movq 0x8(%r9,%r10,8), %rsi
incq %r10
testq %rsi, %rsi
jne 0x1faab
testq %rax, %rax
je 0x1fb7a
sarq $0x20, %rdi
testq %r9, %r9
je 0x1fb31
movq (%r9), %rdx
testq %rdx, %rdx
je 0x1fb31
movq 0x8(%rax), %r10
movsbl (%r10), %esi
xorl %r11d, %r11d
cmpb %sil, (%rdx)
jne 0x1fb1d
movsbl 0x1(%rdx), %edx
cmpb 0x1(%r10), %dl
je 0x1fb2c
movq 0x8(%r9,%r11,8), %rdx
incq %r11
testq %rdx, %rdx
jne 0x1fb0e
jmp 0x1fb31
testq %r11, %r11
je 0x1fb3b
movq (%rax), %rax
testq %rax, %rax
jne 0x1faf6
jmp 0x1fb7a
leaq 0xf4fe(%rip), %r10      # 0x2f040
movq (%r10,%rdi,8), %r10
testq %r10, %r10
je 0x1fb31
movq (%r10), %r11
testq %r11, %r11
je 0x1fb31
xorl %r14d, %r14d
cmpb %sil, (%r11)
jne 0x1fb61
cmpb %dl, 0x1(%r11)
je 0x1fb70
movq 0x8(%r10,%r14,8), %r11
incq %r14
testq %r11, %r11
jne 0x1fb56
jmp 0x1fb31
testq %r14, %r14
jne 0x1fb31
jmp 0x1fc66
movq 0x8(%rsp), %rdi
movq %r13, %rsi
callq 0x1f581
movq %rax, 0x8(%rsp)
movb (%r15), %al
testb %al, %al
movq 0x10(%rsp), %rsi
movl $0x2401, %edi           # imm = 0x2401
jne 0x1f7f2
movq %rsi, %rdi
callq 0x32c0
movq 0x8(%rsp), %rax
jmp 0x1fc44
xorl %eax, %eax
retq
movq %rsi, %rdx
movsbl %r11b, %esi
movsbl 0x1(%rdx), %edx
leaq 0x730a(%rip), %rdi      # 0x26ed2
xorl %eax, %eax
callq 0x501c
jmp 0x1fc23
movb (%rdx), %r11b
jmp 0x1fbb9
leaq 0x7203(%rip), %rdi      # 0x26de0
jmp 0x1fbe6
leaq 0x722a(%rip), %rdi      # 0x26e10
xorl %eax, %eax
callq 0x501c
jmp 0x1fc04
notl %edx
leaq 0x724a(%rip), %rdi      # 0x26e42
movq 0x10(%rsp), %rsi
xorl %eax, %eax
callq 0x501c
movq 0x8(%rsp), %rbx
jmp 0x1fc30
movb (%r13), %dl
movsbl %dl, %esi
leaq 0x7298(%rip), %rdi      # 0x26eb1
movl %r8d, %edx
xorl %eax, %eax
callq 0x501c
movq 0x8(%rsp), %rbx
movq %r13, %rdi
callq 0x1f4ef
movq %rbx, %rdi
callq 0x1f4b4
movq 0x10(%rsp), %rdi
callq 0x32c0
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x7165(%rip), %rdi      # 0x26dbf
xorl %eax, %eax
callq 0x501c
jmp 0x1fba9
leaq 0x7296(%rip), %rdi      # 0x26f03
jmp 0x1fbc8