// File: /workspace/github_c_makefile_star2_O0/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:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movl %edi, -0xc(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpl $0x2, -0xc(%rbp)
jge 0xbfba
movq $0x0, -0x8(%rbp)
jmp 0xc100
movq -0x20(%rbp), %rax
movq (%rax), %rdi
callq 0xaa80
movq %rax, -0x28(%rbp)
movl $0x1, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0xc0f8
movq -0x20(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0xc0e8
movq -0x28(%rbp), %rax
movq %rax, -0x40(%rbp)
movl $0x0, -0x44(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0xc0ac
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0xc110
movl %eax, -0x30(%rbp)
cmpl $0x0, -0x30(%rbp)
jne 0xc03e
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x40(%rbp)
jmp 0xc007
cmpl $0x2, -0x30(%rbp)
jne 0xc08a
movq 0xaf85(%rip), %rax      # 0x16fd0
movq (%rax), %rdi
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0xc4f0
movq 0xaf6e(%rip), %rax      # 0x16fd0
movq (%rax), %rdi
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0xc4f0
leaq 0x6592(%rip), %rdi      # 0x1260b
movb $0x0, %al
callq 0xb9c0
movq $0x0, -0x8(%rbp)
jmp 0xc100
cmpl $0x3, -0x30(%rbp)
jne 0xc0a5
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0xc5e0
movl $0x1, -0x44(%rbp)
cmpl $0x0, -0x44(%rbp)
jne 0xc0d7
movq -0x28(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0xab90
movq -0x50(%rbp), %rdi
movq %rax, %rsi
callq 0xaae0
movq %rax, -0x28(%rbp)
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0xbfed
jmp 0xc0ea
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0xbfd1
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)