// File: /workspace/github_c_makefile_star2_O3/ugobas[P]tnm/align_tnm.c
// Function: Match_chains_by_length
void Match_chains_by_length(int *match1,
			    struct chain *chains1, int Nchain1,
			    struct chain *chains2, int Nchain2)
{
  int match2[Nchain2], free1[Nchain1], free2[Nchain2], i, j;
  for(i=0; i<Nchain1; i++){match1[i]=-1; free1[i]=1;}
  for(i=0; i<Nchain2; i++){match2[i]=-1; free2[i]=1;}
  Best_match(match1, free1, chains1, Nchain1, chains2, Nchain2);
  Best_match(match2, free2, chains2, Nchain2, chains1, Nchain1);
  for(i=0; i<Nchain1; i++){
    j=match1[i];
    if(match2[j]==i){free2[j]=0;} // Freeze reciprocal best matches
    else{match1[i]=-1;}
  }
  Best_match(match1, free1, chains1, Nchain1, chains2, Nchain2);  

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, -0x50(%rbp)
movl %edx, %r14d
movq %rsi, %r15
movq %rdi, %r13
movl %r8d, -0x2c(%rbp)
movl %r8d, %eax
movq %rsp, %rcx
movq %rax, -0x38(%rbp)
leaq 0xf(,%rax,4), %rax
andq $-0x10, %rax
subq %rax, %rcx
movq %rcx, -0x48(%rbp)
movq %rcx, %rsp
movl %edx, %edx
movq %rsp, %r12
leaq 0xf(,%rdx,4), %rcx
andq $-0x10, %rcx
subq %rcx, %r12
movq %r12, %rsp
movq %rsp, %rbx
subq %rax, %rbx
movq %rbx, %rsp
testl %r14d, %r14d
movq %rdx, -0x40(%rbp)
jle 0x11f32
leaq (,%rdx,4), %rdx
movq %r13, %rdi
movl $0xff, %esi
callq 0x2110
movq -0x40(%rbp), %rcx
leal 0x3(%rcx), %eax
decq %rcx
movq %rcx, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
shrl $0x2, %eax
shlq $0x4, %rax
movdqa 0x3f1bb(%rip), %xmm1    # 0x51010
movdqa 0x3f1c3(%rip), %xmm2    # 0x51020
xorl %ecx, %ecx
movdqa 0x3f1c9(%rip), %xmm3    # 0x51030
pxor %xmm3, %xmm0
pcmpeqd %xmm4, %xmm4
movdqa 0x44309(%rip), %xmm5    # 0x56180
movdqa %xmm2, %xmm6
pxor %xmm3, %xmm6
movdqa %xmm6, %xmm7
pcmpgtd %xmm0, %xmm7
pcmpeqd %xmm0, %xmm6
pshufd $0xf5, %xmm6, %xmm8     # xmm8 = xmm6[1,1,3,3]
pand %xmm7, %xmm8
pshufd $0xf5, %xmm7, %xmm6     # xmm6 = xmm7[1,1,3,3]
por %xmm8, %xmm6
movd %xmm6, %edx
notl %edx
testb $0x1, %dl
je 0x11eb3
movl $0x1, (%r12,%rcx)
pxor %xmm4, %xmm6
pextrw $0x4, %xmm6, %edx
testb $0x1, %dl
je 0x11eca
movl $0x1, 0x4(%r12,%rcx)
movdqa %xmm1, %xmm6
pxor %xmm3, %xmm6
movdqa %xmm6, %xmm7
pcmpgtd %xmm0, %xmm7
pcmpeqd %xmm0, %xmm6
pshufd $0xf5, %xmm6, %xmm8     # xmm8 = xmm6[1,1,3,3]
pand %xmm7, %xmm8
pshufd $0xf5, %xmm7, %xmm6     # xmm6 = xmm7[1,1,3,3]
por %xmm8, %xmm6
pxor %xmm4, %xmm6
pextrw $0x0, %xmm6, %edx
testb $0x1, %dl
je 0x11f0a
movl $0x1, 0x8(%r12,%rcx)
pextrw $0x4, %xmm6, %edx
testb $0x1, %dl
je 0x11f1d
movl $0x1, 0xc(%r12,%rcx)
paddq %xmm5, %xmm2
paddq %xmm5, %xmm1
addq $0x10, %rcx
cmpq %rcx, %rax
jne 0x11e77
cmpl $0x0, -0x2c(%rbp)
movl %r14d, -0x30(%rbp)
jle 0x1205d
movq %r15, %r14
movq -0x38(%rbp), %r15
leaq (,%r15,4), %rdx
movq -0x48(%rbp), %rdi
movl $0xff, %esi
callq 0x2110
leal 0x3(%r15), %eax
decq %r15
movq %r15, %xmm0
movq %r14, %r15
movl -0x30(%rbp), %r14d
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
shrl $0x2, %eax
shlq $0x4, %rax
movdqa 0x3f08c(%rip), %xmm1    # 0x51010
movdqa 0x3f094(%rip), %xmm2    # 0x51020
xorl %ecx, %ecx
movdqa 0x3f09a(%rip), %xmm3    # 0x51030
pxor %xmm3, %xmm0
pcmpeqd %xmm4, %xmm4
movdqa 0x441da(%rip), %xmm5    # 0x56180
movdqa %xmm2, %xmm6
pxor %xmm3, %xmm6
movdqa %xmm6, %xmm7
pcmpgtd %xmm0, %xmm7
pcmpeqd %xmm0, %xmm6
pshufd $0xf5, %xmm6, %xmm8     # xmm8 = xmm6[1,1,3,3]
pand %xmm7, %xmm8
pshufd $0xf5, %xmm7, %xmm6     # xmm6 = xmm7[1,1,3,3]
por %xmm8, %xmm6
movd %xmm6, %edx
notl %edx
testb $0x1, %dl
je 0x11fe1
movl $0x1, (%rbx,%rcx)
pxor %xmm4, %xmm6
pextrw $0x4, %xmm6, %edx
testb $0x1, %dl
je 0x11ff7
movl $0x1, 0x4(%rbx,%rcx)
movdqa %xmm1, %xmm6
pxor %xmm3, %xmm6
movdqa %xmm6, %xmm7
pcmpgtd %xmm0, %xmm7
pcmpeqd %xmm0, %xmm6
pshufd $0xf5, %xmm6, %xmm8     # xmm8 = xmm6[1,1,3,3]
pand %xmm7, %xmm8
pshufd $0xf5, %xmm7, %xmm6     # xmm6 = xmm7[1,1,3,3]
por %xmm8, %xmm6
pxor %xmm4, %xmm6
pextrw $0x0, %xmm6, %edx
testb $0x1, %dl
je 0x12036
movl $0x1, 0x8(%rbx,%rcx)
pextrw $0x4, %xmm6, %edx
testb $0x1, %dl
je 0x12048
movl $0x1, 0xc(%rbx,%rcx)
paddq %xmm5, %xmm2
paddq %xmm5, %xmm1
addq $0x10, %rcx
cmpq %rcx, %rax
jne 0x11fa6
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %rdx
movl %r14d, %ecx
movq -0x50(%rbp), %r15
movq %r15, %r8
movq %rdx, -0x38(%rbp)
movl -0x2c(%rbp), %r9d
callq 0x120f9
movq -0x48(%rbp), %r14
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movl -0x30(%rbp), %r15d
movl -0x2c(%rbp), %ecx
movq -0x38(%rbp), %r8
movl %r15d, %r9d
callq 0x120f9
testl %r15d, %r15d
movq -0x40(%rbp), %rsi
jle 0x120d0
xorl %eax, %eax
movslq (%r13,%rax,4), %rdi
movl (%r14,%rdi,4), %edx
cmpq %rdx, %rax
jne 0x120bf
movl $0x0, (%rbx,%rdi,4)
jmp 0x120c8
movl $0xffffffff, (%r13,%rax,4) # imm = 0xFFFFFFFF
incq %rax
cmpq %rax, %rsi
jne 0x120a8
movq %r13, %rdi
movq %r12, %rsi
movq -0x38(%rbp), %rdx
movl %r15d, %ecx
movq -0x50(%rbp), %r8
movl -0x2c(%rbp), %r9d
callq 0x120f9
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq