// File: /workspace/github_cpp_makefile_star2_O1/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/sam_header.c
// Function: sam_header_merge
void *sam_header_merge(int n, const void **_dicts)
{
	const HeaderDict **dicts = (const HeaderDict**)_dicts;
    HeaderDict *out_dict;
    int idict, status;

    if ( n<2 ) return NULL;

    out_dict = sam_header_clone(dicts[0]);

    for (idict=1; idict<n; idict++)
    {
        const list_t *tmpl_hlines = dicts[idict];

        while ( tmpl_hlines )
        {
            list_t *out_hlines = out_dict;
            int inserted = 0;
            while ( out_hlines )
            {
                status = sam_header_compare_lines(tmpl_hlines->data, out_hlines->data);
                if ( status==0 )
                {
                    out_hlines = out_hlines->next;
                    continue;
                }
                
                if ( status==2 ) 
                {
                    print_header_line(stderr,tmpl_hlines->data);
                    print_header_line(stderr,out_hlines->data);
                    debug("Conflicting lines, cannot merge the headers.\n");
					return 0;
                }
                if ( status==3 )
                    sam_header_line_merge_with(out_hlines->data, tmpl_hlines->data);

                inserted = 1;
                break;
            }
            if ( !inserted )
                out_dict = list_append(out_dict, sam_header_line_clone(tmpl_hlines->data));

            tmpl_hlines = tmpl_hlines->next;
        }
    }

    return out_dict;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
cmpl $0x2, %edi
jge 0x207b0
xorl %r12d, %r12d
jmp 0x20ccc
movl %edi, %ebp
movq %rsi, 0x28(%rsp)
movq (%rsi), %rdi
callq 0x1fa24
movq %rax, %r12
movl %ebp, %eax
movq %rax, 0x20(%rsp)
movl $0x1, %eax
leaq 0xf83b(%rip), %r15      # 0x30010
movq %rax, %rcx
movq 0x28(%rsp), %rax
movq %rcx, 0x30(%rsp)
movq (%rax,%rcx,8), %rax
movq %rax, %r9
testq %rax, %rax
je 0x20cb0
testq %r12, %r12
movq %r9, (%rsp)
je 0x20bab
movq %r12, %r13
movq %r12, 0x8(%rsp)
movq 0x8(%r9), %r14
movq 0x8(%r13), %rbx
movsbl (%r14), %esi
xorl %ecx, %ecx
cmpb (%rbx), %sil
jne 0x20b9a
movsbl 0x1(%r14), %edx
cmpb 0x1(%rbx), %dl
jne 0x20b9a
movq 0xf7dd(%rip), %rdi      # 0x30010
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %rdi, %rdi
je 0x2085a
xorl %ecx, %ecx
cmpb %sil, (%rdi)
jne 0x20849
cmpb %dl, 0x1(%rdi)
je 0x20858
movq 0x8(%r15,%rcx,8), %rdi
incq %rcx
testq %rdi, %rdi
jne 0x2083f
jmp 0x2085a
movl %ecx, %eax
cmpl $-0x1, %eax
je 0x20b68
movslq %eax, %rcx
leaq 0xf833(%rip), %rax      # 0x300a0
movq %rcx, 0x18(%rsp)
movq (%rax,%rcx,8), %rbp
testq %rbp, %rbp
je 0x20922
movq (%rbp), %rcx
movq 0x8(%r14), %rdx
testq %rdx, %rdx
je 0x208b6
movq 0x8(%rdx), %rdi
movb (%rdi), %sil
cmpb (%rcx), %sil
jne 0x208a9
movb 0x1(%rdi), %sil
cmpb 0x1(%rcx), %sil
jne 0x208a9
xorl %esi, %esi
movq %rdi, %rax
jmp 0x208af
movq (%rdx), %rdx
movb $0x1, %sil
testb %sil, %sil
jne 0x20887
jmp 0x208b8
xorl %eax, %eax
movq 0x8(%rbx), %rsi
testq %rsi, %rsi
je 0x208eb
movq 0x8(%rsi), %r8
movb (%r8), %dil
cmpb (%rcx), %dil
jne 0x208de
movb 0x1(%r8), %dil
cmpb 0x1(%rcx), %dil
jne 0x208de
xorl %edi, %edi
movq %r8, %rdx
jmp 0x208e4
movq (%rsi), %rsi
movb $0x1, %dil
testb %dil, %dil
jne 0x208bc
jmp 0x208ed
xorl %edx, %edx
movl $0x2, %ecx
testq %rax, %rax
je 0x20b9a
testq %rdx, %rdx
je 0x20b9a
movq 0x8(%rax), %rdi
movq 0x8(%rdx), %rsi
callq 0x34e0
movq (%rsp), %r9
movl $0x0, %ecx
testl %eax, %eax
jne 0x20b9a
movq %rbp, 0x10(%rsp)
leaq 0xf742(%rip), %rax      # 0x30070
movq 0x18(%rsp), %rcx
movq (%rax,%rcx,8), %r10
testq %r10, %r10
je 0x20a0b
xorl %r12d, %r12d
xorl %r15d, %r15d
movq (%r10,%r12,8), %rcx
testq %rcx, %rcx
je 0x20a48
movq 0x8(%r14), %rdx
testq %rdx, %rdx
je 0x20986
movq 0x8(%rdx), %rdi
movb (%rdi), %sil
cmpb (%rcx), %sil
jne 0x20979
movb 0x1(%rdi), %sil
cmpb 0x1(%rcx), %sil
jne 0x20979
xorl %esi, %esi
movq %rdi, %rax
jmp 0x2097f
movq (%rdx), %rdx
movb $0x1, %sil
testb %sil, %sil
jne 0x20957
jmp 0x20988
xorl %eax, %eax
movq 0x8(%rbx), %rsi
testq %rsi, %rsi
je 0x209bb
movq 0x8(%rsi), %r8
movb (%r8), %dil
cmpb (%rcx), %dil
jne 0x209ae
movb 0x1(%r8), %dil
cmpb 0x1(%rcx), %dil
jne 0x209ae
xorl %edi, %edi
movq %r8, %rdx
jmp 0x209b4
movq (%rsi), %rsi
movb $0x1, %dil
testb %dil, %dil
jne 0x2098c
jmp 0x209bd
xorl %edx, %edx
movq %rax, %rcx
orq %rdx, %rcx
je 0x20b61
movl $0x1, %ebp
testq %rax, %rax
je 0x209fa
testq %rdx, %rdx
je 0x209fa
movq 0x8(%rax), %rdi
movq 0x8(%rdx), %rsi
movq %r10, %rbp
callq 0x34e0
movq %rbp, %r10
movq (%rsp), %r9
movl %r15d, %ebp
testl %eax, %eax
jne 0x20b81
incq %r12
movl %ebp, %r15d
testq %r10, %r10
jne 0x20946
jmp 0x20a4b
xorl %ebp, %ebp
leaq 0xf62c(%rip), %rax      # 0x30040
cmpq $0x0, (%rax,%rcx,8)
jne 0x20a4b
movq 0x8(%r14), %rax
movq 0x8(%rax), %rax
movq 0x8(%rbx), %rcx
movq 0x8(%rcx), %rcx
movq 0x8(%rax), %rdi
movq 0x8(%rcx), %rsi
callq 0x34e0
movq (%rsp), %r9
xorl %ecx, %ecx
testl %eax, %eax
sete %cl
jmp 0x20b8e
movl %r15d, %ebp
leaq 0xf5ee(%rip), %rax      # 0x30040
movq 0x18(%rsp), %rcx
movq (%rax,%rcx,8), %r15
testq %r15, %r15
je 0x20b4f
movq (%r15), %rax
testq %rax, %rax
je 0x20b4f
movq 0x8(%r14), %r14
movq 0x8(%rbx), %rbx
xorl %ecx, %ecx
movq %rcx, %r12
movq %r14, %rdx
testq %rdx, %rdx
je 0x20aaf
movq 0x8(%rdx), %rdi
movb (%rdi), %sil
cmpb (%rax), %sil
jne 0x20aa2
movb 0x1(%rdi), %sil
cmpb 0x1(%rax), %sil
jne 0x20aa2
xorl %esi, %esi
movq %rdi, %rcx
jmp 0x20aa8
movq (%rdx), %rdx
movb $0x1, %sil
testb %sil, %sil
jne 0x20a80
jmp 0x20ab1
xorl %ecx, %ecx
movq %rbx, %rsi
testq %rsi, %rsi
je 0x20ae3
movq 0x8(%rsi), %r8
movb (%r8), %dil
cmpb (%rax), %dil
jne 0x20ad6
movb 0x1(%r8), %dil
cmpb 0x1(%rax), %dil
jne 0x20ad6
xorl %edi, %edi
movq %r8, %rdx
jmp 0x20adc
movq (%rsi), %rsi
movb $0x1, %dil
testb %dil, %dil
jne 0x20ab4
jmp 0x20ae5
xorl %edx, %edx
movq %rcx, %rax
orq %rdx, %rax
jne 0x20afc
movq 0x8(%r15,%r12,8), %rax
incq %r12
testq %rax, %rax
jne 0x20a7d
jmp 0x20b4f
movl $0x1, %esi
testq %rcx, %rcx
je 0x20b22
testq %rdx, %rdx
je 0x20b22
movq 0x8(%rcx), %rdi
movq 0x8(%rdx), %rsi
callq 0x34e0
movq (%rsp), %r9
movl %ebp, %esi
testl %eax, %eax
jne 0x20b81
shlq $0x20, %r12
movabsq $0x100000000, %rax      # imm = 0x100000000
addq %rax, %r12
movq %r12, %rcx
sarq $0x20, %rcx
sarq $0x1d, %r12
movq (%r15,%r12), %rax
movl %esi, %ebp
testq %rax, %rax
jne 0x20a7a
jmp 0x20b51
movl %ebp, %esi
xorl %eax, %eax
testl %esi, %esi
setne %al
leal 0x1(,%rax,2), %ecx
jmp 0x20b8e
movl $0x2, %ecx
jmp 0x20b8e
leaq 0x72b7(%rip), %rdi      # 0x27e26
xorl %eax, %eax
callq 0x4d75
movq (%rsp), %r9
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
jmp 0x20b9a
xorl %ecx, %ecx
cmpq $0x0, 0x10(%rsp)
setne %cl
addl %ecx, %ecx
movq 0x8(%rsp), %r12
leaq 0xf476(%rip), %r15      # 0x30010
testl %ecx, %ecx
jne 0x20bcb
movq (%r13), %r13
testq %r13, %r13
jne 0x20807
movq 0x8(%r9), %rdi
callq 0x1fab0
movq %r12, %rdi
movq %rax, %rsi
callq 0x1fa62
movq (%rsp), %r9
movq %rax, %r12
jmp 0x20ca3
cmpl $0x3, %ecx
je 0x20bf2
cmpl $0x2, %ecx
jne 0x20ca3
movq %r9, %rdi
movq %r13, %rsi
callq 0x4e0d
movq (%rsp), %r9
xorl %ecx, %ecx
movq %r9, %rax
jmp 0x20ca8
movq 0x8(%r13), %rbx
movq 0x8(%r9), %rax
movb (%rbx), %cl
cmpb (%rax), %cl
jne 0x20ca3
movb 0x1(%rbx), %cl
cmpb 0x1(%rax), %cl
jne 0x20ca3
movq 0x8(%rax), %r14
testq %r14, %r14
je 0x20ca3
movq 0x8(%r14), %r15
movq 0x8(%rbx), %r13
movq %r13, %rax
testq %rax, %rax
je 0x20c53
movq 0x8(%rax), %rsi
movb (%rsi), %dl
cmpb (%r15), %dl
jne 0x20c48
movb 0x1(%rsi), %dl
cmpb 0x1(%r15), %dl
jne 0x20c48
xorl %edx, %edx
movq %rsi, %rcx
jmp 0x20c4d
movq (%rax), %rax
movb $0x1, %dl
testb %dl, %dl
jne 0x20c28
jmp 0x20c55
xorl %ecx, %ecx
testq %rcx, %rcx
jne 0x20c94
movl $0x10, %edi
callq 0x31d0
movq %rax, %rbp
movb (%r15), %al
movb %al, (%rbp)
movb 0x1(%r15), %al
movb %al, 0x1(%rbp)
movq 0x8(%r15), %rdi
callq 0x34b0
movq %rax, 0x8(%rbp)
movq %r13, %rdi
movq %rbp, %rsi
callq 0x1fa62
movq (%rsp), %r9
movq %rax, 0x8(%rbx)
movq (%r14), %r14
testq %r14, %r14
jne 0x20c1d
leaq 0xf36d(%rip), %r15      # 0x30010
movq (%r9), %rax
movb $0x1, %cl
testb %cl, %cl
jne 0x207e6
testq %r9, %r9
jne 0x207a8
movq 0x30(%rsp), %rax
incq %rax
cmpq 0x20(%rsp), %rax
jne 0x207d5
movq %r12, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq