// File: /workspace/github_c_makefile_star2_O3/sheneman[P]clearcut/dist.c
// Function: NJ_DNA_count_tt
void
NJ_DNA_count_tt(NJ_alignment *alignment,
		long int x,
		long int y,
		long int *transitions,
		long int *transversions,
		long int *residues) {

  long int tmp_transitions   = 0;
  long int tmp_transversions = 0;
  long int tmp_residues      = 0;
  char a, b;
  long int i;

  for(i=0;i<alignment->length;i++) {

    a = toupper(alignment->data[x*alignment->length+i]);
    b = toupper(alignment->data[y*alignment->length+i]);
    
    if( (a == 'A' && b == 'T') ||
	(a == 'T' && b == 'A') ||
	(a == 'A' && b == 'C') ||
	(a == 'C' && b == 'A') ||
	(a == 'T' && b == 'G') ||
	(a == 'G' && b == 'T') ||
	(a == 'C' && b == 'G') ||
	(a == 'G' && b == 'C') ) {
      tmp_transversions++;
    }
	
    if( (a == 'C' && b == 'T') ||
	(a == 'T' && b == 'C') ||
	(a == 'G' && b == 'A') ||
	(a == 'A' && b == 'G') ) {
      tmp_transitions++;
    }

    /* count the number of residues */
    if(a != NJ_AMBIGUITY_CHAR &&
       b != NJ_AMBIGUITY_CHAR ) {
      tmp_residues++;
    }

  }
  
  *transitions   = tmp_transitions;
  *transversions = tmp_transversions;
  
  if(residues) {
    *residues = tmp_residues;
  }
  
  return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, 0x20(%rsp)
movq %r8, 0x18(%rsp)
movq %rcx, 0x10(%rsp)
movq 0x8(%rdi), %r14
testq %r14, %r14
jle 0x5605
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %rbp
callq 0x2030
movq (%rax), %rax
movq 0x18(%rbp), %rcx
imulq %r14, %r13
addq %rcx, %r13
imulq %r14, %r12
addq %rcx, %r12
xorl %edx, %edx
movl $0x3f000000, %edi       # imm = 0x3F000000
xorl %esi, %esi
xorl %ecx, %ecx
xorl %r11d, %r11d
movsbq (%r13,%r11), %r10
movl (%rax,%r10,4), %ebp
movsbq (%r12,%r11), %r10
movl (%rax,%r10,4), %r10d
shll $0x18, %ebp
shll $0x18, %r10d
cmpl $0x41000000, %ebp       # imm = 0x41000000
jne 0x54db
cmpl $0x54000000, %r10d      # imm = 0x54000000
je 0x5527
cmpl $0x54000000, %ebp       # imm = 0x54000000
jne 0x54ec
cmpl $0x41000000, %r10d      # imm = 0x41000000
je 0x5527
cmpl $0x41000000, %ebp       # imm = 0x41000000
jne 0x54fd
cmpl $0x43000000, %r10d      # imm = 0x43000000
je 0x5527
cmpl $0x43000000, %ebp       # imm = 0x43000000
jne 0x550e
cmpl $0x41000000, %r10d      # imm = 0x41000000
je 0x5527
cmpl $0x54000000, %ebp       # imm = 0x54000000
jne 0x55ae
cmpl $0x47000000, %r10d      # imm = 0x47000000
jne 0x55ae
incq %rsi
cmpl $0x43000000, %ebp       # imm = 0x43000000
jne 0x553b
cmpl $0x54000000, %r10d      # imm = 0x54000000
je 0x554c
cmpl $0x54000000, %ebp       # imm = 0x54000000
jne 0x5577
cmpl $0x43000000, %r10d      # imm = 0x43000000
jne 0x5577
incq %rdx
cmpl %edi, %ebp
setne %r8b
cmpl %edi, %r10d
setne %r9b
andb %r8b, %r9b
movzbl %r9b, %r8d
addq %r8, %rcx
incq %r11
cmpq %r11, %r14
jne 0x54b0
jmp 0x560b
movl %ebp, %r8d
movl $0x41000000, %ebx       # imm = 0x41000000
xorl %ebx, %r8d
movl %ebp, %r9d
movl $0x47000000, %edi       # imm = 0x47000000
xorl %edi, %r9d
movl %r10d, %r15d
xorl %ebx, %r15d
movl %r10d, %ebx
xorl %edi, %ebx
movl $0x3f000000, %edi       # imm = 0x3F000000
orl %r8d, %ebx
sete %bl
orl %r9d, %r15d
je 0x554c
testb %bl, %bl
je 0x554f
jmp 0x554c
movl %r10d, %r15d
movl $0x47000000, %ebx       # imm = 0x47000000
xorl %ebx, %r15d
movl %ebp, %r8d
movl $0x43000000, %r9d       # imm = 0x43000000
xorl %r9d, %r8d
cmpl %r9d, %r10d
sete 0xf(%rsp)
cmpl $0x54000000, %r10d      # imm = 0x54000000
sete %r9b
cmpl %ebx, %ebp
sete %bl
orl %r15d, %r8d
sete %r15b
testb %r9b, %bl
jne 0x5527
testb %r15b, %r15b
jne 0x5527
andb 0xf(%rsp), %bl
je 0x552a
jmp 0x5527
xorl %ecx, %ecx
xorl %esi, %esi
xorl %edx, %edx
movq 0x10(%rsp), %rax
movq %rdx, (%rax)
movq 0x18(%rsp), %rax
movq %rsi, (%rax)
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x5628
movq %rcx, (%rax)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop