// File: /workspace/github_c_makefile_star2_O0/sheneman[P]clearcut/clearcut.c
// Function: NJ_compute_r
static inline
void
NJ_compute_r(DMAT *dmat,
	     long int a,
	     long int b) {
  
  long int i;         /* a variable used in indexing */
  float *ptrx, *ptry; /* pointers into the distance matrix */
  
  /* some variables to limit pointer dereferencing in loop */
  long int size; 
  float *r, *val;
  
  /* to limit pointer dereferencing */
  size = dmat->size;
  val  = dmat->val;
  r    = dmat->r+a+1;

  /* 
   * Loop through the rows and decrement the stored r values 
   * by the distances stored in the rows and columns of the distance 
   * matrix which are being removed post-join.
   *
   * We do the rows altogether in order to benefit from cache locality.
   */
  ptrx = &(val[NJ_MAP(a, a+1, size)]); 
  ptry = &(val[NJ_MAP(b, b+1, size)]); 

  for(i=a+1;i<size;i++) {
    *r -= *(ptrx++);  

    if(i>b) {
      *r -= *(ptry++); 
    }

    r++;
  }

  /* Similar to the above loop, we now do the columns */
  ptrx = &(val[NJ_MAP(0, a, size)]);  
  ptry = &(val[NJ_MAP(0, b, size)]);  
  r = dmat->r;
  for(i=0;i<b;i++) {
    if(i<a) {
      *r -= *ptrx;
      ptrx += size-i-1;
    }

    *r -= *ptry;
    ptry += size-i-1;
    r++;
  }

  return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x10(%rbp), %rcx
shlq $0x2, %rcx
addq %rcx, %rax
addq $0x4, %rax
movq %rax, -0x40(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x1, %rsi
movq -0x38(%rbp), %rdx
callq 0x4b70
movq %rax, %rcx
movq -0x58(%rbp), %rax
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x18(%rbp), %rdi
movq -0x18(%rbp), %rsi
addq $0x1, %rsi
movq -0x38(%rbp), %rdx
callq 0x4b70
movq %rax, %rcx
movq -0x50(%rbp), %rax
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x38(%rbp), %rax
jge 0x3b25
movq -0x28(%rbp), %rax
movq %rax, %rcx
addq $0x4, %rcx
movq %rcx, -0x28(%rbp)
movss (%rax), %xmm1
movq -0x40(%rbp), %rax
movss (%rax), %xmm0
subss %xmm1, %xmm0
movss %xmm0, (%rax)
movq -0x20(%rbp), %rax
cmpq -0x18(%rbp), %rax
jle 0x3b0b
movq -0x30(%rbp), %rax
movq %rax, %rcx
addq $0x4, %rcx
movq %rcx, -0x30(%rbp)
movss (%rax), %xmm1
movq -0x40(%rbp), %rax
movss (%rax), %xmm0
subss %xmm1, %xmm0
movss %xmm0, (%rax)
movq -0x40(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x3ab1
movq -0x48(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rsi
movq -0x38(%rbp), %rdx
xorl %eax, %eax
movl %eax, %edi
callq 0x4b70
movq %rax, %rcx
movq -0x68(%rbp), %rax
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x18(%rbp), %rsi
movq -0x38(%rbp), %rdx
xorl %eax, %eax
movl %eax, %edi
callq 0x4b70
movq %rax, %rcx
movq -0x60(%rbp), %rax
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x40(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x18(%rbp), %rax
jge 0x3c24
movq -0x20(%rbp), %rax
cmpq -0x10(%rbp), %rax
jge 0x3bd7
movq -0x28(%rbp), %rax
movss (%rax), %xmm1
movq -0x40(%rbp), %rax
movss (%rax), %xmm0
subss %xmm1, %xmm0
movss %xmm0, (%rax)
movq -0x38(%rbp), %rax
subq -0x20(%rbp), %rax
subq $0x1, %rax
shlq $0x2, %rax
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x30(%rbp), %rax
movss (%rax), %xmm1
movq -0x40(%rbp), %rax
movss (%rax), %xmm0
subss %xmm1, %xmm0
movss %xmm0, (%rax)
movq -0x38(%rbp), %rax
subq -0x20(%rbp), %rax
subq $0x1, %rax
shlq $0x2, %rax
addq -0x30(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x40(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x3b8f
addq $0x70, %rsp
popq %rbp
retq
nopw (%rax,%rax)