// File: /workspace/github_c_makefile_star2_O0/sc932[P]ALE/src/ALElike.c
// Function: validateAlignmentMates
void validateAlignmentMates(alignSet_t *thisAlignment, bam1_t *thisRead, bam1_t *thisReadMate) {

    assert(thisAlignment->contigId1 >= 0 && thisAlignment->contigId2 >= 0);
    assert(thisRead != NULL);
    assert(thisReadMate != NULL);

    assert(strcmp(thisAlignment->name, bam1_qname(thisRead)) == 0);
    assert(strcmp(thisAlignment->name, bam1_qname(thisReadMate)) == 0);
    assert(thisRead != thisReadMate);

    if ( ! (   (thisAlignment->contigId2 == thisRead->core.mtid) 
            && (thisAlignment->contigId1 == thisReadMate->core.mtid)
            && (thisAlignment->contigId2 == thisReadMate->core.tid)
            && (thisAlignment->start1    == thisReadMate->core.mpos)
            && (thisAlignment->start1    == thisRead->core.pos)
            && (thisAlignment->start2    == thisReadMate->core.pos) 
            && (thisAlignment->start2    == thisRead->core.mpos) 
           ) ) {
        fprintf(stderr, "WARNING: The following read and its mate do not agree on the contigs and/or positions of their mappings:");
        fprintf(stderr, "read1: %s %d: %d %d %d %d\t", bam1_qname(thisRead), thisRead->core.flag, thisRead->core.tid, thisRead->core.mtid, thisRead->core.pos, thisRead->core.mpos);
        fprintf(stderr, "read2: %s %d: %d %d %d %d\t", bam1_qname(thisReadMate), thisReadMate->core.flag, thisReadMate->core.tid, thisReadMate->core.mtid, thisReadMate->core.pos, thisReadMate->core.mpos);
        printAlignment(thisAlignment);
    }

    assert(thisAlignment->contigId1 == thisRead->core.tid);
    assert(thisAlignment->contigId2 == thisReadMate->core.tid);
    assert(thisAlignment->start1 == thisRead->core.pos);
    assert(thisAlignment->start2 == thisReadMate->core.pos);

    // assign the end position, if not set already
    if (thisAlignment->end1 < 0){
        thisAlignment->end1 = bam_calend(&thisRead->core, bam1_cigar(thisRead));
    }
    assert(thisAlignment->end1 == bam_calend(&thisRead->core, bam1_cigar(thisRead)));

    if (thisAlignment->end2 < 0){
        thisAlignment->end2 = bam_calend(&thisReadMate->core, bam1_cigar(thisReadMate));
    }
    assert(thisAlignment->end2 == bam_calend(&thisReadMate->core, bam1_cigar(thisReadMate)));

    assert(thisAlignment->start1 <= thisAlignment->end1);
    assert(thisAlignment->start2 <= thisAlignment->end2);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x20(%rax)
jl 0x927a
movq -0x8(%rbp), %rax
cmpl $0x0, 0x24(%rax)
jl 0x927a
jmp 0x9299
leaq 0x2756a(%rip), %rdi     # 0x307eb
leaq 0x26b3d(%rip), %rsi     # 0x2fdc5
movl $0x74b, %edx            # imm = 0x74B
leaq 0x27596(%rip), %rcx     # 0x3082a
callq 0x3220
cmpq $0x0, -0x10(%rbp)
je 0x92a2
jmp 0x92c1
leaq 0x27471(%rip), %rdi     # 0x3071a
leaq 0x26b15(%rip), %rsi     # 0x2fdc5
movl $0x74c, %edx            # imm = 0x74C
leaq 0x2756e(%rip), %rcx     # 0x3082a
callq 0x3220
cmpq $0x0, -0x18(%rbp)
je 0x92ca
jmp 0x92e9
leaq 0x27597(%rip), %rdi     # 0x30868
leaq 0x26aed(%rip), %rsi     # 0x2fdc5
movl $0x74d, %edx            # imm = 0x74D
leaq 0x27546(%rip), %rcx     # 0x3082a
callq 0x3220
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rsi
callq 0x3330
cmpl $0x0, %eax
jne 0x9305
jmp 0x9324
leaq 0x27571(%rip), %rdi     # 0x3087d
leaq 0x26ab2(%rip), %rsi     # 0x2fdc5
movl $0x74f, %edx            # imm = 0x74F
leaq 0x2750b(%rip), %rcx     # 0x3082a
callq 0x3220
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rdi
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rsi
callq 0x3330
cmpl $0x0, %eax
jne 0x9340
jmp 0x935f
leaq 0x2756d(%rip), %rdi     # 0x308b4
leaq 0x26a77(%rip), %rsi     # 0x2fdc5
movl $0x750, %edx            # imm = 0x750
leaq 0x274d0(%rip), %rcx     # 0x3082a
callq 0x3220
movq -0x10(%rbp), %rax
cmpq -0x18(%rbp), %rax
je 0x936b
jmp 0x938a
leaq 0x2757d(%rip), %rdi     # 0x308ef
leaq 0x26a4c(%rip), %rsi     # 0x2fdc5
movl $0x751, %edx            # imm = 0x751
leaq 0x274a5(%rip), %rcx     # 0x3082a
callq 0x3220
movq -0x8(%rbp), %rax
movl 0x24(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x14(%rcx), %eax
jne 0x93fd
movq -0x8(%rbp), %rax
movl 0x20(%rax), %eax
movq -0x18(%rbp), %rcx
cmpl 0x14(%rcx), %eax
jne 0x93fd
movq -0x8(%rbp), %rax
movl 0x24(%rax), %eax
movq -0x18(%rbp), %rcx
cmpl (%rcx), %eax
jne 0x93fd
movq -0x8(%rbp), %rax
movl 0x10(%rax), %eax
movq -0x18(%rbp), %rcx
cmpl 0x18(%rcx), %eax
jne 0x93fd
movq -0x8(%rbp), %rax
movl 0x10(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jne 0x93fd
movq -0x8(%rbp), %rax
movl 0x14(%rax), %eax
movq -0x18(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jne 0x93fd
movq -0x8(%rbp), %rax
movl 0x14(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x18(%rcx), %eax
je 0x94d2
movq 0x2fbf4(%rip), %rax     # 0x38ff8
movq (%rax), %rdi
leaq 0x274fa(%rip), %rsi     # 0x30908
movb $0x0, %al
callq 0x3350
movq 0x2fbdc(%rip), %rax     # 0x38ff8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rdx
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
shrq $0x20, %rax
andq $0xffff, %rax           # imm = 0xFFFF
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl (%rax), %r8d
movq -0x10(%rbp), %rax
movl 0x14(%rax), %r9d
movq -0x10(%rbp), %rax
movl 0x4(%rax), %r10d
movq -0x10(%rbp), %rax
movl 0x18(%rax), %eax
leaq 0x27511(%rip), %rsi     # 0x30971
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
movb $0x0, %al
callq 0x3350
movq 0x2fb82(%rip), %rax     # 0x38ff8
movq (%rax), %rdi
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rdx
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
shrq $0x20, %rax
andq $0xffff, %rax           # imm = 0xFFFF
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl (%rax), %r8d
movq -0x18(%rbp), %rax
movl 0x14(%rax), %r9d
movq -0x18(%rbp), %rax
movl 0x4(%rax), %r10d
movq -0x18(%rbp), %rax
movl 0x18(%rax), %eax
leaq 0x274d2(%rip), %rsi     # 0x3098c
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
movb $0x0, %al
callq 0x3350
movq -0x8(%rbp), %rdi
callq 0xcd90
movq -0x8(%rbp), %rax
movl 0x20(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl (%rcx), %eax
jne 0x94e3
jmp 0x9502
leaq 0x274bd(%rip), %rdi     # 0x309a7
leaq 0x268d4(%rip), %rsi     # 0x2fdc5
movl $0x761, %edx            # imm = 0x761
leaq 0x2732d(%rip), %rcx     # 0x3082a
callq 0x3220
movq -0x8(%rbp), %rax
movl 0x24(%rax), %eax
movq -0x18(%rbp), %rcx
cmpl (%rcx), %eax
jne 0x9513
jmp 0x9532
leaq 0x274bc(%rip), %rdi     # 0x309d6
leaq 0x268a4(%rip), %rsi     # 0x2fdc5
movl $0x762, %edx            # imm = 0x762
leaq 0x272fd(%rip), %rcx     # 0x3082a
callq 0x3220
movq -0x8(%rbp), %rax
movl 0x10(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jne 0x9544
jmp 0x9563
leaq 0x274be(%rip), %rdi     # 0x30a09
leaq 0x26873(%rip), %rsi     # 0x2fdc5
movl $0x763, %edx            # imm = 0x763
leaq 0x272cc(%rip), %rcx     # 0x3082a
callq 0x3220
movq -0x8(%rbp), %rax
movl 0x14(%rax), %eax
movq -0x18(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jne 0x9575
jmp 0x9594
leaq 0x274b9(%rip), %rdi     # 0x30a35
leaq 0x26842(%rip), %rsi     # 0x2fdc5
movl $0x764, %edx            # imm = 0x764
leaq 0x2729b(%rip), %rcx     # 0x3082a
callq 0x3220
movq -0x8(%rbp), %rax
cmpl $0x0, 0x18(%rax)
jge 0x95cf
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
shrq $0x18, %rax
andq $0xff, %rax
cltq
addq %rax, %rsi
callq 0x15e60
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x8(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
shrq $0x18, %rax
andq $0xff, %rax
cltq
addq %rax, %rsi
callq 0x15e60
movl %eax, %ecx
movl -0x1c(%rbp), %eax
cmpl %ecx, %eax
jne 0x960c
jmp 0x962b
leaq 0x27452(%rip), %rdi     # 0x30a65
leaq 0x267ab(%rip), %rsi     # 0x2fdc5
movl $0x76a, %edx            # imm = 0x76A
leaq 0x27204(%rip), %rcx     # 0x3082a
callq 0x3220
movq -0x8(%rbp), %rax
cmpl $0x0, 0x1c(%rax)
jge 0x9666
movq -0x18(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rsi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
shrq $0x18, %rax
andq $0xff, %rax
cltq
addq %rax, %rsi
callq 0x15e60
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x1c(%rax)
movq -0x8(%rbp), %rax
movl 0x1c(%rax), %eax
movl %eax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rsi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
shrq $0x18, %rax
andq $0xff, %rax
cltq
addq %rax, %rsi
callq 0x15e60
movl %eax, %ecx
movl -0x20(%rbp), %eax
cmpl %ecx, %eax
jne 0x96a3
jmp 0x96c2
leaq 0x27404(%rip), %rdi     # 0x30aae
leaq 0x26714(%rip), %rsi     # 0x2fdc5
movl $0x76f, %edx            # imm = 0x76F
leaq 0x2716d(%rip), %rcx     # 0x3082a
callq 0x3220
movq -0x8(%rbp), %rax
movl 0x10(%rax), %eax
movq -0x8(%rbp), %rcx
cmpl 0x18(%rcx), %eax
jg 0x96d4
jmp 0x96f3
leaq 0x27424(%rip), %rdi     # 0x30aff
leaq 0x266e3(%rip), %rsi     # 0x2fdc5
movl $0x771, %edx            # imm = 0x771
leaq 0x2713c(%rip), %rcx     # 0x3082a
callq 0x3220
movq -0x8(%rbp), %rax
movl 0x14(%rax), %eax
movq -0x8(%rbp), %rcx
cmpl 0x1c(%rcx), %eax
jg 0x9705
jmp 0x9724
leaq 0x27420(%rip), %rdi     # 0x30b2c
leaq 0x266b2(%rip), %rsi     # 0x2fdc5
movl $0x772, %edx            # imm = 0x772
leaq 0x2710b(%rip), %rcx     # 0x3082a
callq 0x3220
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)