// File: /workspace/github_c_makefile_star2_O2/skoren[P]bacValidation/bamcat.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:
cmpl $0x2, %edi
jge 0x8c43
xorl %eax, %eax
retq
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %edi, %r14d
movq %rsi, -0x60(%rbp)
movq (%rsi), %rdi
callq 0x820c
movl %r14d, %ecx
pushq $0x1
popq %rdx
movq %rcx, -0x58(%rbp)
cmpq %rcx, %rdx
je 0x8f68
movq -0x60(%rbp), %rcx
leaq (%rcx,%rdx,8), %rcx
movq %rdx, -0x68(%rbp)
movq (%rcx), %rcx
testq %rcx, %rcx
je 0x8f2a
movq %rcx, -0x70(%rbp)
movq 0x10(%rcx), %r13
movq %rax, -0x38(%rbp)
testq %rax, %rax
je 0x8eeb
movq %rax, -0x50(%rbp)
movq 0x10(%rax), %rax
movsbl (%r13), %r14d
movq %rax, -0x30(%rbp)
cmpb (%rax), %r14b
jne 0x8d38
movsbl 0x1(%r13), %r12d
movq -0x30(%rbp), %rax
cmpb 0x1(%rax), %r12b
jne 0x8d38
movq %r13, %rdi
callq 0x93ba
cmpl $-0x1, %eax
je 0x8f01
movslq %eax, %rcx
leaq 0x6b7d(%rip), %rax      # 0xf860
movq %rcx, -0x40(%rbp)
movq (%rax,%rcx,8), %rax
movq %rax, -0x48(%rbp)
testq %rax, %rax
je 0x8d45
movq -0x48(%rbp), %rax
movq (%rax), %r12
movq %r13, %rdi
movq %r12, %rsi
callq 0x89dc
movq %rax, %r14
movq -0x30(%rbp), %rdi
movq %r12, %rsi
callq 0x89dc
testq %r14, %r14
je 0x8f36
testq %rax, %rax
je 0x8f36
movq 0x8(%r14), %rdi
movq 0x8(%rax), %rsi
callq 0x34a0
testl %eax, %eax
je 0x8d45
movq -0x50(%rbp), %rax
movq 0x8(%rax), %rax
jmp 0x8c9a
leaq 0x6ae4(%rip), %rax      # 0xf830
movq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rbx
testq %rbx, %rbx
je 0x8dc1
xorl %edx, %edx
movq (%rbx), %r12
testq %r12, %r12
je 0x8e05
movl %edx, %r15d
movq %r13, %rdi
movq %r12, %rsi
callq 0x89dc
movq %rax, %r14
movq -0x30(%rbp), %rdi
movq %r12, %rsi
callq 0x89dc
movq %r14, %rcx
orq %rax, %rcx
je 0x8f36
pushq $0x1
popq %rcx
testq %r14, %r14
je 0x8db5
testq %rax, %rax
je 0x8db5
movq 0x8(%r14), %rdi
movq 0x8(%rax), %rsi
callq 0x34a0
movl %r15d, %ecx
testl %eax, %eax
jne 0x8e78
addq $0x8, %rbx
movl %ecx, %edx
movq -0x40(%rbp), %rcx
jmp 0x8d5b
leaq 0x6a38(%rip), %rax      # 0xf800
movq (%rax,%rcx,8), %rax
xorl %edx, %edx
movq %rax, -0x40(%rbp)
testq %rax, %rax
movq -0x30(%rbp), %r15
jne 0x8e1d
movq 0x8(%r13), %rax
movq 0x10(%rax), %rax
movq 0x8(%r15), %rcx
movq 0x10(%rcx), %rcx
movq 0x8(%rax), %rdi
movq 0x8(%rcx), %rsi
callq 0x34a0
testl %eax, %eax
jne 0x8d38
jmp 0x8f15
leaq 0x69f4(%rip), %rax      # 0xf800
movq (%rax,%rcx,8), %rax
movq %rax, -0x40(%rbp)
testq %rax, %rax
movq -0x30(%rbp), %r15
je 0x8e8b
xorl %ebx, %ebx
movl %edx, -0x30(%rbp)
movslq %ebx, %rbx
incq %rbx
movq -0x40(%rbp), %rax
movq -0x8(%rax,%rbx,8), %r12
testq %r12, %r12
je 0x8e88
movq %r13, %rdi
movq %r12, %rsi
callq 0x89dc
movq %rax, %r14
movq %r15, %rdi
movq %r12, %rsi
callq 0x89dc
movq %r14, %rcx
orq %rax, %rcx
je 0x8e25
pushq $0x1
popq %rdx
testq %r14, %r14
je 0x8e1f
testq %rax, %rax
je 0x8e1f
movq 0x8(%r14), %rdi
movq 0x8(%rax), %rsi
callq 0x34a0
movl -0x30(%rbp), %edx
testl %eax, %eax
je 0x8e1f
cmpq $0x0, -0x48(%rbp)
je 0x8d38
jmp 0x8f36
movl -0x30(%rbp), %edx
testl %edx, %edx
je 0x8f15
movq 0x8(%r13), %r13
testq %r13, %r13
je 0x8f15
movq 0x10(%r13), %r14
movq %r15, %rdi
movq %r14, %rsi
callq 0x89dc
testq %rax, %rax
jne 0x8e93
pushq $0x10
popq %rdi
callq 0x3470
movq %rax, %r12
movb (%r14), %al
movb %al, (%r12)
movb 0x1(%r14), %al
movb %al, 0x1(%r12)
movq 0x8(%r14), %rdi
callq 0x3600
movq %rax, 0x8(%r12)
movq 0x8(%r15), %rdi
movq %r12, %rsi
callq 0x8243
movq %rax, 0x8(%r15)
jmp 0x8e93
movq %r13, %rdi
callq 0x8297
movq -0x38(%rbp), %rdi
movq %rax, %rsi
callq 0x8243
jmp 0x8f19
leaq 0x29da(%rip), %rdi      # 0xb8e2
movl %r14d, %esi
movl %r12d, %edx
xorl %eax, %eax
callq 0x8ad8
movq -0x38(%rbp), %rax
movq -0x70(%rbp), %rcx
addq $0x8, %rcx
movq -0x68(%rbp), %rdx
jmp 0x8c82
incq %rdx
movq -0x58(%rbp), %rcx
jmp 0x8c6d
movq 0x6093(%rip), %rbx      # 0xefd0
movq (%rbx), %rdi
movq %r13, %rsi
callq 0x8f77
movq (%rbx), %rdi
movq -0x50(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x8f77
leaq 0x2795(%rip), %rdi      # 0xb6f4
xorl %eax, %eax
callq 0x8ad8
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq