// File: /workspace/github_c_makefile_star2_O0/skoren[P]bacValidation/bamcat.c
// Function: sam_header_compare_lines
static int sam_header_compare_lines(HeaderLine *hline1, HeaderLine *hline2)
{
    HeaderTag *t1, *t2;

    if ( hline1->type[0]!=hline2->type[0] || hline1->type[1]!=hline2->type[1] )
        return 0;

    int itype = tag_exists(hline1->type,types);
    if ( itype==-1 ) {
		debug("[sam_header_compare_lines] Unknown type [%c%c]\n", hline1->type[0],hline1->type[1]);
		return -1; // FIXME (lh3): error; I do not know how this will be handled in Petr's code
	}

    if ( unique_tags[itype] )
    {
        t1 = header_line_has_tag(hline1,unique_tags[itype][0]);
        t2 = header_line_has_tag(hline2,unique_tags[itype][0]);
        if ( !t1 || !t2 ) // this should never happen, the unique tags are required
            return 2;

        if ( strcmp(t1->value,t2->value) )
            return 0;   // the unique tags differ, cannot be merged
    }
    if ( !required_tags[itype] && !optional_tags[itype] )
    {
        t1 = hline1->tags->data;
        t2 = hline2->tags->data;
        if ( !strcmp(t1->value,t2->value) ) return 1; // identical comments
        return 0;
    }

    int missing=0, itag=0;
    while ( required_tags[itype] && required_tags[itype][itag] )
    {
        t1 = header_line_has_tag(hline1,required_tags[itype][itag]);
        t2 = header_line_has_tag(hline2,required_tags[itype][itag]);
        if ( !t1 && !t2 )
            return 2;       // this should never happen
        else if ( !t1 || !t2 )
            missing = 1;    // there is some tag missing in one of the hlines
        else if ( strcmp(t1->value,t2->value) )
        {
            if ( unique_tags[itype] )
                return 2;   // the lines have a matching unique tag but have a conflicting tag
                    
            return 0;    // the lines contain conflicting tags, cannot be merged
        }
        itag++;
    }
    itag = 0;
    while ( optional_tags[itype] && optional_tags[itype][itag] )
    {
        t1 = header_line_has_tag(hline1,optional_tags[itype][itag]);
        t2 = header_line_has_tag(hline2,optional_tags[itype][itag]);
        if ( !t1 && !t2 )
        {
            itag++;
            continue;
        }
        if ( !t1 || !t2 )
            missing = 1;    // there is some tag missing in one of the hlines
        else if ( strcmp(t1->value,t2->value) )
        {
            if ( unique_tags[itype] )
                return 2;   // the lines have a matching unique tag but have a conflicting tag

            return 0;   // the lines contain conflicting tags, cannot be merged
        }
        itag++;
    }
    if ( missing ) return 3;    // there are some missing complementary tags with no conflicts, can be merged
    return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
movq -0x18(%rbp), %rcx
movsbl (%rcx), %ecx
cmpl %ecx, %eax
jne 0xc146
movq -0x10(%rbp), %rax
movsbl 0x1(%rax), %eax
movq -0x18(%rbp), %rcx
movsbl 0x1(%rcx), %ecx
cmpl %ecx, %eax
je 0xc152
movl $0x0, -0x4(%rbp)
jmp 0xc4e5
movq -0x10(%rbp), %rdi
leaq 0xb6e3(%rip), %rsi      # 0x17840
callq 0xdb00
movl %eax, -0x2c(%rbp)
cmpl $-0x1, -0x2c(%rbp)
jne 0xc194
movq -0x10(%rbp), %rax
movsbl (%rax), %esi
movq -0x10(%rbp), %rax
movsbl 0x1(%rax), %edx
leaq 0x66ea(%rip), %rdi      # 0x1286b
movb $0x0, %al
callq 0xb9c0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xc4e5
movslq -0x2c(%rbp), %rcx
leaq 0xb731(%rip), %rax      # 0x178d0
cmpq $0x0, (%rax,%rcx,8)
je 0xc22a
movq -0x10(%rbp), %rdi
movslq -0x2c(%rbp), %rcx
leaq 0xb717(%rip), %rax      # 0x178d0
movq (%rax,%rcx,8), %rax
movq (%rax), %rsi
callq 0xb7d0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
movslq -0x2c(%rbp), %rcx
leaq 0xb6f8(%rip), %rax      # 0x178d0
movq (%rax,%rcx,8), %rax
movq (%rax), %rsi
callq 0xb7d0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0xc1f6
cmpq $0x0, -0x28(%rbp)
jne 0xc202
movl $0x2, -0x4(%rbp)
jmp 0xc4e5
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x3570
cmpl $0x0, %eax
je 0xc228
movl $0x0, -0x4(%rbp)
jmp 0xc4e5
jmp 0xc22a
movslq -0x2c(%rbp), %rcx
leaq 0xb66b(%rip), %rax      # 0x178a0
cmpq $0x0, (%rax,%rcx,8)
jne 0xc2a0
movslq -0x2c(%rbp), %rcx
leaq 0xb629(%rip), %rax      # 0x17870
cmpq $0x0, (%rax,%rcx,8)
jne 0xc2a0
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x3570
cmpl $0x0, %eax
jne 0xc294
movl $0x1, -0x4(%rbp)
jmp 0xc4e5
movl $0x0, -0x4(%rbp)
jmp 0xc4e5
movl $0x0, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movslq -0x2c(%rbp), %rdx
xorl %eax, %eax
leaq 0xb5e5(%rip), %rcx      # 0x178a0
cmpq $0x0, (%rcx,%rdx,8)
movb %al, -0x35(%rbp)
je 0xc2e3
movslq -0x2c(%rbp), %rcx
leaq 0xb5d0(%rip), %rax      # 0x178a0
movq (%rax,%rcx,8), %rax
movslq -0x34(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
setne %al
movb %al, -0x35(%rbp)
movb -0x35(%rbp), %al
testb $0x1, %al
jne 0xc2ef
jmp 0xc3be
movq -0x10(%rbp), %rdi
movslq -0x2c(%rbp), %rcx
leaq 0xb5a2(%rip), %rax      # 0x178a0
movq (%rax,%rcx,8), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0xb7d0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
movslq -0x2c(%rbp), %rcx
leaq 0xb57e(%rip), %rax      # 0x178a0
movq (%rax,%rcx,8), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0xb7d0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0xc351
cmpq $0x0, -0x28(%rbp)
jne 0xc351
movl $0x2, -0x4(%rbp)
jmp 0xc4e5
cmpq $0x0, -0x20(%rbp)
je 0xc35f
cmpq $0x0, -0x28(%rbp)
jne 0xc368
movl $0x1, -0x30(%rbp)
jmp 0xc3ae
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x3570
cmpl $0x0, %eax
je 0xc3ac
movslq -0x2c(%rbp), %rcx
leaq 0xb543(%rip), %rax      # 0x178d0
cmpq $0x0, (%rax,%rcx,8)
je 0xc3a0
movl $0x2, -0x4(%rbp)
jmp 0xc4e5
movl $0x0, -0x4(%rbp)
jmp 0xc4e5
jmp 0xc3ae
jmp 0xc3b0
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xc2ae
movl $0x0, -0x34(%rbp)
movslq -0x2c(%rbp), %rdx
xorl %eax, %eax
leaq 0xb49e(%rip), %rcx      # 0x17870
cmpq $0x0, (%rcx,%rdx,8)
movb %al, -0x36(%rbp)
je 0xc3fa
movslq -0x2c(%rbp), %rcx
leaq 0xb489(%rip), %rax      # 0x17870
movq (%rax,%rcx,8), %rax
movslq -0x34(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
setne %al
movb %al, -0x36(%rbp)
movb -0x36(%rbp), %al
testb $0x1, %al
jne 0xc406
jmp 0xc4cf
movq -0x10(%rbp), %rdi
movslq -0x2c(%rbp), %rcx
leaq 0xb45b(%rip), %rax      # 0x17870
movq (%rax,%rcx,8), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0xb7d0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
movslq -0x2c(%rbp), %rcx
leaq 0xb437(%rip), %rax      # 0x17870
movq (%rax,%rcx,8), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0xb7d0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0xc46a
cmpq $0x0, -0x28(%rbp)
jne 0xc46a
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xc3c5
cmpq $0x0, -0x20(%rbp)
je 0xc478
cmpq $0x0, -0x28(%rbp)
jne 0xc481
movl $0x1, -0x30(%rbp)
jmp 0xc4c1
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x3570
cmpl $0x0, %eax
je 0xc4bf
movslq -0x2c(%rbp), %rcx
leaq 0xb42a(%rip), %rax      # 0x178d0
cmpq $0x0, (%rax,%rcx,8)
je 0xc4b6
movl $0x2, -0x4(%rbp)
jmp 0xc4e5
movl $0x0, -0x4(%rbp)
jmp 0xc4e5
jmp 0xc4c1
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xc3c5
cmpl $0x0, -0x30(%rbp)
je 0xc4de
movl $0x3, -0x4(%rbp)
jmp 0xc4e5
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nop