// File: /workspace/github_c_makefile_star2_O3/sheneman[P]clearcut/clearcut.c
// Function: NJ_check
static inline
int 
NJ_check(NJ_ARGS *nj_args,
	 DMAT *dmat,
	 long int a,
	 long int b,
	 float min,
	 int additivity) {


  long int i, size;
  float *ptr, *val, *r2;
  

  /* some aliases for speed and readability reasons */
  val  = dmat->val;
  r2   = dmat->r2;
  size = dmat->size;


  /* now determine if joining a, b will result in broken distances */
  if(additivity) {
    if(!NJ_check_additivity(dmat, a, b)) {
      return(0);
    }
  }

  /* scan the horizontal of row b, punt if anything < min */
  ptr = &(val[NJ_MAP(b, b+1, size)]);  
  for(i=b+1;i<size;i++) {
    if( NJ_FLT_LT( (*ptr - (r2[b] + r2[i])), min) ) {
      return(0);
    }
    ptr++;
  }

  /* scan the vertical component of row a, punt if anything < min */
  if(nj_args->norandom) {  /* if we are doing random joins, we checked this */
    ptr = val + a;
    for(i=0;i<a;i++) {
      if( NJ_FLT_LT( (*ptr - (r2[i] + r2[a])), min) ) {
	return(0);
      }
      ptr += size-i-1;
    }
  }

  /* scan the vertical component of row b, punt if anything < min */
  ptr = val + b;
  for(i=0;i<b;i++) {
    if( NJ_FLT_LT( (*ptr - (r2[i] + r2[b])), min) && i!=a) {
      return(0);
    }
    ptr += size-i-1;
  }

  return(1);
}

// Assembly:
pushq %rbx
movq 0x8(%rsi), %r9
movq 0x18(%rsi), %r10
movq 0x30(%rsi), %rsi
testl %r8d, %r8d
je 0x44e0
leaq -0x1(%r9), %rax
cmpq %rcx, %rax
jne 0x43f3
xorl %eax, %eax
testq %rdx, %rdx
jne 0x43f7
cmpq $0x1, %rcx
sete %al
incq %rax
jmp 0x43f7
leaq 0x1(%rcx), %rax
leaq (%r9,%r9), %r8
movq %rdx, %r11
notq %r11
leaq (%r11,%r9,2), %r11
imulq %rdx, %r11
movq %r11, %rbx
shrq $0x3f, %rbx
addq %r11, %rbx
andq $-0x2, %rbx
leaq (%r10,%rbx,2), %r11
movss (%r11,%rcx,4), %xmm1
movss (%rsi,%rdx,4), %xmm3
movss (%rsi,%rcx,4), %xmm2
cmpq %rcx, %rax
jle 0x4459
leaq (%r11,%rax,4), %r11
movq %rcx, %rbx
notq %rbx
addq %rbx, %r8
imulq %rcx, %r8
movq %r8, %rbx
shrq $0x3f, %rbx
addq %r8, %rbx
andq $-0x2, %rbx
leaq (%r10,%rbx,2), %r8
leaq (%r8,%rax,4), %rax
jmp 0x4480
movq %rax, %r11
notq %r11
addq %r11, %r8
imulq %rax, %r8
movq %r8, %rax
shrq $0x3f, %rax
addq %r8, %rax
andq $-0x2, %rax
leaq (%r10,%rax,2), %rax
leaq (%rax,%rdx,4), %r11
leaq (%rax,%rcx,4), %rax
movaps %xmm3, %xmm4
unpcklps %xmm2, %xmm4            # xmm4 = xmm4[0],xmm2[0],xmm4[1],xmm2[1]
unpcklps %xmm3, %xmm2            # xmm2 = xmm2[0],xmm3[0],xmm2[1],xmm3[1]
subps %xmm2, %xmm4
movss (%rax), %xmm2
shufps $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0]
addps %xmm4, %xmm1
mulps 0x3bc2(%rip), %xmm1     # 0x8060
movss (%r11), %xmm3
unpcklps %xmm2, %xmm3            # xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1]
subps %xmm1, %xmm3
movaps %xmm3, %xmm4
shufps $0x55, %xmm3, %xmm4     # xmm4 = xmm4[1,1],xmm3[1,1]
addss %xmm3, %xmm4
mulss 0x3bc0(%rip), %xmm4     # 0x807c
shufps $0x55, %xmm1, %xmm1     # xmm1 = xmm1[1,1,1,1]
addss %xmm4, %xmm1
subss %xmm1, %xmm2
andps 0x3b71(%rip), %xmm2     # 0x8040
movss 0x3b9d(%rip), %xmm1     # 0x8074
ucomiss %xmm2, %xmm1
ja 0x44e0
xorl %eax, %eax
popq %rbx
retq
leaq 0x1(%rcx), %rax
cmpq %r9, %rax
jge 0x4549
movq %rcx, %r8
notq %r8
leaq (%r8,%r9,2), %r8
imulq %rcx, %r8
movq %r8, %r11
shrq $0x3f, %r11
addq %r8, %r11
andq $-0x2, %r11
leaq (%r10,%r11,2), %r8
movss (%rsi,%rcx,4), %xmm1
movaps 0x3b2b(%rip), %xmm2     # 0x8040
movss 0x3b57(%rip), %xmm3     # 0x8074
movss (%r8,%rax,4), %xmm4
movss (%rsi,%rax,4), %xmm5
addss %xmm1, %xmm5
subss %xmm5, %xmm4
ucomiss %xmm4, %xmm0
jbe 0x4541
subss %xmm0, %xmm4
andps %xmm2, %xmm4
ucomiss %xmm4, %xmm3
jbe 0x44dc
incq %rax
cmpq %rax, %r9
jne 0x451d
cmpl $0x0, 0x38(%rdi)
sete %al
testq %rdx, %rdx
setle %dil
orb %al, %dil
jne 0x45b3
leaq (%r10,%rdx,4), %rdi
movss (%rsi,%rdx,4), %xmm1
leaq -0x1(%r9), %r8
xorl %eax, %eax
movaps 0x3ace(%rip), %xmm2     # 0x8040
movss 0x3afa(%rip), %xmm3     # 0x8074
xorl %r11d, %r11d
movss (%rdi), %xmm4
movss (%rsi,%r11,4), %xmm5
addss %xmm1, %xmm5
subss %xmm5, %xmm4
ucomiss %xmm4, %xmm0
jbe 0x45a4
subss %xmm0, %xmm4
andps %xmm2, %xmm4
ucomiss %xmm4, %xmm3
jbe 0x44de
leaq (%rdi,%r8,4), %rdi
incq %r11
decq %r8
cmpq %r11, %rdx
jne 0x457d
movl $0x1, %eax
testq %rcx, %rcx
jle 0x44de
leaq (%r10,%rcx,4), %rdi
movss (%rsi,%rcx,4), %xmm1
decq %r9
xorl %r8d, %r8d
movaps 0x3a69(%rip), %xmm2     # 0x8040
movss 0x3a95(%rip), %xmm3     # 0x8074
cmpq %r8, %rdx
je 0x460b
movss (%rdi), %xmm4
movss (%rsi,%r8,4), %xmm5
addss %xmm1, %xmm5
subss %xmm5, %xmm4
ucomiss %xmm4, %xmm0
jbe 0x460b
subss %xmm0, %xmm4
andps %xmm2, %xmm4
ucomiss %xmm4, %xmm3
jbe 0x44dc
leaq (%rdi,%r9,4), %rdi
incq %r8
decq %r9
cmpq %r8, %rcx
jne 0x45df
jmp 0x44de