// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movss %xmm0, -0x2c(%rbp)
movl %r8d, -0x30(%rbp)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x40(%rbp)
cmpl $0x0, -0x30(%rbp)
je 0x471f
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x4fb0
cmpl $0x0, %eax
jne 0x471d
movl $0x0, -0x4(%rbp)
jmp 0x48f5
jmp 0x471f
movq -0x50(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x28(%rbp), %rdi
movq -0x28(%rbp), %rsi
addq $0x1, %rsi
movq -0x40(%rbp), %rdx
callq 0x4b70
movq %rax, %rcx
movq -0x60(%rbp), %rax
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpq -0x40(%rbp), %rax
jge 0x47bf
movq -0x48(%rbp), %rax
movss (%rax), %xmm0
movq -0x58(%rbp), %rax
movq -0x28(%rbp), %rcx
movss (%rax,%rcx,4), %xmm1
movq -0x58(%rbp), %rax
movq -0x38(%rbp), %rcx
addss (%rax,%rcx,4), %xmm1
subss %xmm1, %xmm0
movss -0x2c(%rbp), %xmm1
callq 0x4650
cmpl $0x0, %eax
je 0x47a5
movl $0x0, -0x4(%rbp)
jmp 0x48f5
movq -0x48(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x48(%rbp)
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x475a
movq -0x10(%rbp), %rax
cmpl $0x0, 0x38(%rax)
je 0x485b
movq -0x50(%rbp), %rax
movq -0x20(%rbp), %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpq -0x20(%rbp), %rax
jge 0x4859
movq -0x48(%rbp), %rax
movss (%rax), %xmm0
movq -0x58(%rbp), %rax
movq -0x38(%rbp), %rcx
movss (%rax,%rcx,4), %xmm1
movq -0x58(%rbp), %rax
movq -0x20(%rbp), %rcx
addss (%rax,%rcx,4), %xmm1
subss %xmm1, %xmm0
movss -0x2c(%rbp), %xmm1
callq 0x4650
cmpl $0x0, %eax
je 0x4833
movl $0x0, -0x4(%rbp)
jmp 0x48f5
movq -0x40(%rbp), %rax
subq -0x38(%rbp), %rax
subq $0x1, %rax
shlq $0x2, %rax
addq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x47e8
jmp 0x485b
movq -0x50(%rbp), %rax
movq -0x28(%rbp), %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpq -0x28(%rbp), %rax
jge 0x48ee
movq -0x48(%rbp), %rax
movss (%rax), %xmm0
movq -0x58(%rbp), %rax
movq -0x38(%rbp), %rcx
movss (%rax,%rcx,4), %xmm1
movq -0x58(%rbp), %rax
movq -0x28(%rbp), %rcx
addss (%rax,%rcx,4), %xmm1
subss %xmm1, %xmm0
movss -0x2c(%rbp), %xmm1
callq 0x4650
cmpl $0x0, %eax
je 0x48c8
movq -0x38(%rbp), %rax
cmpq -0x20(%rbp), %rax
je 0x48c8
movl $0x0, -0x4(%rbp)
jmp 0x48f5
movq -0x40(%rbp), %rax
subq -0x38(%rbp), %rax
subq $0x1, %rax
shlq $0x2, %rax
addq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x4876
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nop