// File: /workspace/github_c_makefile_star2_O0/josch[P]stride/measure.c
// Function: Presnell
int Presnell(char *Asn1, int L1, char *Asn2, int L2, char SecStr, float Threshold, 
	     float *Q2, float *O)
{
  int Boundaries(char *Asn, int L, char SecondStr, int (*Bound)[2]);
  int Bound1[MAX_ASSIGN][2], Bound2[MAX_ASSIGN][2], Length1[MAX_ASSIGN], 
      Length2[MAX_ASSIGN], NSeg1, NSeg2;
  int Overlap, MaxOverlap, TP=0, FP=0, FN=0;
  register int i, j;

  NSeg1 = Boundaries(Asn1,L1,SecStr,Bound1);
  NSeg2 = Boundaries(Asn2,L2,SecStr,Bound2);
  

  for(i=0; i<NSeg1; i++)
    Length1[i] = Bound1[i][1]-Bound1[i][0]+1;

  for(j=0; j<NSeg2; j++)
    Length2[j] = Bound2[j][1]-Bound2[j][0]+1;
									    
  for(i=0; i<NSeg1; i++) {
    MaxOverlap = 0;
    for(j=0; j<NSeg2; j++) {
      Overlap = Minimum(Bound1[i][1],Bound2[j][1])-Maximum(Bound1[i][0],Bound2[j][0])+1;
      if( Overlap > MaxOverlap ) MaxOverlap = Overlap;
    }
    if( (float)MaxOverlap/(float)Length1[i] >= Threshold ) 
      TP++;
    else
      FN++;
  }

  for(i=0; i<NSeg2; i++) {
    MaxOverlap = 0;
    for(j=0; j<NSeg1; j++) {
      Overlap = Minimum(Bound2[i][1],Bound1[j][1])-Maximum(Bound2[i][0],Bound1[j][0])+1;
      if( Overlap > MaxOverlap ) MaxOverlap = Overlap;
    }
    if( (float)MaxOverlap/(float)Length2[i] < Threshold ) 
      FP++;
  }

  if( TP+FN != 0 ) {
    *Q2 = (float)TP/((float)TP+(float)FN);
    *O = (float)FP/((float)TP+(float)FN);
  }
  else {
    *Q2 = -1.0;
    *O = -1.0;
  }

  return(1);
}

// Assembly:
subq $0x2f58, %rsp           # imm = 0x2F58
movb %r8b, %al
movq 0x2f60(%rsp), %r8
movq %rdi, 0x2f50(%rsp)
movl %esi, 0x2f4c(%rsp)
movq %rdx, 0x2f40(%rsp)
movl %ecx, 0x2f3c(%rsp)
movb %al, 0x2f3b(%rsp)
movss %xmm0, 0x2f34(%rsp)
movq %r9, 0x2f28(%rsp)
movl $0x0, 0x2c(%rsp)
movl $0x0, 0x28(%rsp)
movl $0x0, 0x24(%rsp)
movq 0x2f50(%rsp), %rdi
movl 0x2f4c(%rsp), %esi
movb 0x2f3b(%rsp), %al
leaq 0x1f80(%rsp), %rcx
movsbl %al, %edx
callq 0x61f0
movl %eax, 0x3c(%rsp)
movq 0x2f40(%rsp), %rdi
movl 0x2f3c(%rsp), %esi
movb 0x2f3b(%rsp), %al
leaq 0xfe0(%rsp), %rcx
movsbl %al, %edx
callq 0x61f0
movl %eax, 0x38(%rsp)
movl $0x0, 0x20(%rsp)
movl 0x20(%rsp), %eax
cmpl 0x3c(%rsp), %eax
jge 0x289ba
movslq 0x20(%rsp), %rax
movl 0x1f84(%rsp,%rax,8), %ecx
movslq 0x20(%rsp), %rax
subl 0x1f80(%rsp,%rax,8), %ecx
addl $0x1, %ecx
movslq 0x20(%rsp), %rax
movl %ecx, 0x810(%rsp,%rax,4)
movl 0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x20(%rsp)
jmp 0x2897c
movl $0x0, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
cmpl 0x38(%rsp), %eax
jge 0x289fd
movslq 0x1c(%rsp), %rax
movl 0xfe4(%rsp,%rax,8), %ecx
movslq 0x1c(%rsp), %rax
subl 0xfe0(%rsp,%rax,8), %ecx
addl $0x1, %ecx
movslq 0x1c(%rsp), %rax
movl %ecx, 0x40(%rsp,%rax,4)
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0x289c2
movl $0x0, 0x20(%rsp)
movl 0x20(%rsp), %eax
cmpl 0x3c(%rsp), %eax
jge 0x28b32
movl $0x0, 0x30(%rsp)
movl $0x0, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
cmpl 0x38(%rsp), %eax
jge 0x28ae6
movslq 0x20(%rsp), %rax
movl 0x1f84(%rsp,%rax,8), %eax
movslq 0x1c(%rsp), %rcx
cmpl 0xfe4(%rsp,%rcx,8), %eax
jge 0x28a5d
movslq 0x20(%rsp), %rax
movl 0x1f84(%rsp,%rax,8), %eax
movl %eax, 0x18(%rsp)
jmp 0x28a6d
movslq 0x1c(%rsp), %rax
movl 0xfe4(%rsp,%rax,8), %eax
movl %eax, 0x18(%rsp)
movl 0x18(%rsp), %eax
movl %eax, 0x14(%rsp)
movslq 0x20(%rsp), %rax
movl 0x1f80(%rsp,%rax,8), %eax
movslq 0x1c(%rsp), %rcx
cmpl 0xfe0(%rsp,%rcx,8), %eax
jge 0x28aa1
movslq 0x1c(%rsp), %rax
movl 0xfe0(%rsp,%rax,8), %eax
movl %eax, 0x10(%rsp)
jmp 0x28ab1
movslq 0x20(%rsp), %rax
movl 0x1f80(%rsp,%rax,8), %eax
movl %eax, 0x10(%rsp)
movl 0x14(%rsp), %eax
movl 0x10(%rsp), %ecx
subl %ecx, %eax
addl $0x1, %eax
movl %eax, 0x34(%rsp)
movl 0x34(%rsp), %eax
cmpl 0x30(%rsp), %eax
jle 0x28ad4
movl 0x34(%rsp), %eax
movl %eax, 0x30(%rsp)
jmp 0x28ad6
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0x28a23
cvtsi2ssl 0x30(%rsp), %xmm0
movslq 0x20(%rsp), %rax
cvtsi2ssl 0x810(%rsp,%rax,4), %xmm1
divss %xmm1, %xmm0
ucomiss 0x2f34(%rsp), %xmm0
jb 0x28b15
movl 0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
jmp 0x28b20
movl 0x24(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
jmp 0x28b22
movl 0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x20(%rsp)
jmp 0x28a05
movl $0x0, 0x20(%rsp)
movl 0x20(%rsp), %eax
cmpl 0x38(%rsp), %eax
jge 0x28c5b
movl $0x0, 0x30(%rsp)
movl $0x0, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
cmpl 0x3c(%rsp), %eax
jge 0x28c1b
movslq 0x20(%rsp), %rax
movl 0xfe4(%rsp,%rax,8), %eax
movslq 0x1c(%rsp), %rcx
cmpl 0x1f84(%rsp,%rcx,8), %eax
jge 0x28b92
movslq 0x20(%rsp), %rax
movl 0xfe4(%rsp,%rax,8), %eax
movl %eax, 0xc(%rsp)
jmp 0x28ba2
movslq 0x1c(%rsp), %rax
movl 0x1f84(%rsp,%rax,8), %eax
movl %eax, 0xc(%rsp)
movl 0xc(%rsp), %eax
movl %eax, 0x8(%rsp)
movslq 0x20(%rsp), %rax
movl 0xfe0(%rsp,%rax,8), %eax
movslq 0x1c(%rsp), %rcx
cmpl 0x1f80(%rsp,%rcx,8), %eax
jge 0x28bd6
movslq 0x1c(%rsp), %rax
movl 0x1f80(%rsp,%rax,8), %eax
movl %eax, 0x4(%rsp)
jmp 0x28be6
movslq 0x20(%rsp), %rax
movl 0xfe0(%rsp,%rax,8), %eax
movl %eax, 0x4(%rsp)
movl 0x8(%rsp), %eax
movl 0x4(%rsp), %ecx
subl %ecx, %eax
addl $0x1, %eax
movl %eax, 0x34(%rsp)
movl 0x34(%rsp), %eax
cmpl 0x30(%rsp), %eax
jle 0x28c09
movl 0x34(%rsp), %eax
movl %eax, 0x30(%rsp)
jmp 0x28c0b
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0x28b58
cvtsi2ssl 0x30(%rsp), %xmm1
movslq 0x20(%rsp), %rax
cvtsi2ssl 0x40(%rsp,%rax,4), %xmm0
divss %xmm0, %xmm1
movss 0x2f34(%rsp), %xmm0
ucomiss %xmm1, %xmm0
jbe 0x28c49
movl 0x28(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x28(%rsp)
jmp 0x28c4b
movl 0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x20(%rsp)
jmp 0x28b3a
movl 0x2c(%rsp), %eax
addl 0x24(%rsp), %eax
cmpl $0x0, %eax
je 0x28cb6
cvtsi2ssl 0x2c(%rsp), %xmm0
cvtsi2ssl 0x2c(%rsp), %xmm1
cvtsi2ssl 0x24(%rsp), %xmm2
addss %xmm2, %xmm1
divss %xmm1, %xmm0
movq 0x2f28(%rsp), %rax
movss %xmm0, (%rax)
cvtsi2ssl 0x28(%rsp), %xmm0
cvtsi2ssl 0x2c(%rsp), %xmm1
cvtsi2ssl 0x24(%rsp), %xmm2
addss %xmm2, %xmm1
divss %xmm1, %xmm0
movq 0x2f60(%rsp), %rax
movss %xmm0, (%rax)
jmp 0x28cde
movq 0x2f28(%rsp), %rax
movss 0x2366(%rip), %xmm0     # 0x2b02c
movss %xmm0, (%rax)
movq 0x2f60(%rsp), %rax
movss 0x2352(%rip), %xmm0     # 0x2b02c
movss %xmm0, (%rax)
movl $0x1, %eax
addq $0x2f58, %rsp           # imm = 0x2F58
retq
nopl (%rax,%rax)