// File: /workspace/github_c_makefile_star2_O1/sc932[P]ALE/src/ALElike.c
// Function: getContributionsForPositions
double getContributionsForPositions(bam1_t *read, contig_t *contig, int qOff, int alignmentLength, float *depthPositions, double *loglikelihoodPositions, int applySoftClip) {
  int i,j;
  int seqPos = 0;
  int refPos = 0;
  int matches = 0;
  int readlen = read->core.l_qseq;
  char *contigSeq = contig->seq;
  double softclipContribution = 0.0;

  if(read == NULL){
	for(refPos = 0; refPos < alignmentLength; refPos++) {
		depthPositions[refPos] = 0.0;
		loglikelihoodPositions[refPos] = getMinLogLike();
	}
	return softclipContribution;
  }
  assert((read->core.flag & BAM_FUNMAP) == 0);

  // read CIGAR first
  uint32_t *cigar = bam1_cigar(read);
  char *readQual = (char*) bam1_qual(read);
  char *MD = getMD(read, contigSeq);
  int numCigarOperations = read->core.n_cigar;
  int ref2seqPos[alignmentLength];

  // initialize loglikelihoodPositions
  for(j=0; j < alignmentLength; j++) {
    loglikelihoodPositions[j] = 0.0;
  }

  for(i=0 ; i < numCigarOperations ; i++) {
    uint32_t cigarInt = *(cigar+i);
    uint32_t cigarFlag = (cigarInt & BAM_CIGAR_MASK);
    uint32_t count = (cigarInt >> BAM_CIGAR_SHIFT);
    ////printf("CIGAR: %u %u %u\n", cigarInt, cigarFlag, count);
    switch (cigarFlag) {
      case(BAM_CMATCH): // match or mismatch
      case(BAM_CEQUAL): // match
      case(BAM_CDIFF):  // mismatch (will be distinguished from match in MD field)
        matches += count;
        for(j=0; j < count; j++) {
        	loglikelihoodPositions[refPos+j] += loglikeMatch(readQual, seqPos+j, 1, qOff);
        	depthPositions[refPos+j] = 1.0;
		    ref2seqPos[refPos+j] = seqPos+j;
        }
        seqPos += count;
        refPos += count;
        break;
      case(BAM_CINS)   : // insertion to the reference.
	if (refPos + 1 < contig->seqLen) {
		double insPenalty = loglikeInsertion(readQual, seqPos, count, qOff) / 2;
		loglikelihoodPositions[refPos] += insPenalty;
		loglikelihoodPositions[refPos+1] += insPenalty;
	} else
		loglikelihoodPositions[refPos] += loglikeInsertion(readQual, seqPos, count, qOff);
        // only increment seqPos
        seqPos += count;
        break;
      case(BAM_CDEL): // deletion from the reference
	{
		assert(refPos + count <= contig->seqLen);
		double delPenalty = loglikeDeletion(readQual, seqPos, count, qOff, readlen) / count;
		for(j=refPos; j < refPos+count; j++) {
			loglikelihoodPositions[j] += delPenalty;
			depthPositions[j] = 0.0;
			ref2seqPos[j] = seqPos;
		}
	}
        // only increment refPos
        refPos += count;
        break;
      case(BAM_CREF_SKIP):
        // assume this is a spliced alignment for RNA, so okay, but no data
        // only increment refPos
		for(j=refPos; j < refPos+count; j++) {
			depthPositions[j] = 0.0;
			ref2seqPos[j] = seqPos;
		}
		refPos += count;
        break;
      case(BAM_CPAD): // silent deletion from padded reference (not in reference or query)
      case(BAM_CHARD_CLIP):
		// hard clipped region is not represented in sequence or quality string, so no information is available for analysis
        break;
      case(BAM_CSOFT_CLIP):
        // soft clipped sequences present in SEQ
        // apply mismatches to clipped portion of the read against the contig past the alignment
        if (seqPos == 0) {
        	// SoftClipped to the left
        	int refPos2 = refPos - count;
        	if (refPos2 < 0) refPos2 = 0;
        	int span = refPos - refPos2;
        	double logMiss = loglikeMiss(readQual, seqPos + count - span, span, qOff);
        	if (applySoftClip)
        		for(j=refPos2; j < refPos; j++)
        			contig->matchLogLikelihood[j] += logMiss / span;
        	softclipContribution += logMiss; // Zmatch already accounts for clipped bases (entire read)
        } else {
        	// SoftClipped to the right
        	int refPos2 = refPos + count;
        	if (refPos2 >= contig->seqLen) refPos2 = contig->seqLen - 1;
        	int span = refPos2 - refPos;
        	double logMiss = loglikeMiss(readQual, seqPos, span, qOff);
        	if (applySoftClip)
        		for(j=refPos; j < refPos2; j++)
        			contig->matchLogLikelihood[j] += logMiss / span;
        	softclipContribution += logMiss; // Zmatch already accounts for clipped bases (entire read)
        }
        seqPos += count;
        readlen -= count;
        break;
    }
  }
  if ((seqPos != read->core.l_qseq) || (refPos != alignmentLength)) {
        fprintf(stderr, "WARNING: Read CIGAR does not match sequence and/or reference alignment lengths: %s %d: seqPos %d seqLen: %d refPos %d alignmentLen: %d\n", bam1_qname(read), read->core.flag, seqPos, read->core.l_qseq, refPos, alignmentLength);
  }

  // now process MD field
  refPos = 0;
  if (MD != NULL && MD[0] == 'Z') {
	  int stop = 0;
	  int pos = 1;

	  // parse MD field
	  while(stop == 0){
	    // matches
	    int seqCount = 0;
	    while(isdigit(MD[pos])){
	        seqCount = seqCount*10 + (int)(MD[pos]) - 48; // chr(48) == '0'
	        pos++;
	    }
	    refPos += seqCount;

	    double logMatch;
	    double logMiss;
	    // misses
	    int baseAmbiguity = 0;
	    while((baseAmbiguity = getBaseAmbibuity(MD[pos])) > 0){
	      char seqBase = contig->seq[refPos + read->core.pos];
	      if (seqBase != MD[pos]) {
	    	  fprintf(stderr, "WARNING: MD field calls mismatch but it does agree with the reference! %s %d: refpos %d MDpos %d: '%c' vs '%c'\n", bam1_qname(read), read->core.flag, refPos+read->core.pos, pos, seqBase, MD[pos]);
	      }
          seqPos = ref2seqPos[refPos];
	      logMatch = loglikeMatch(readQual, seqPos, 1, qOff);
	      if(baseAmbiguity == 1){
	          logMiss = loglikeMiss(readQual, seqPos, 1, qOff);
	      } else {
	    	  if (baseAmbiguity == 4 || isAmbiguousMatch(seqBase, bam1_seq(read)[seqPos]) == 0) {
	    		  logMiss = log(1.0/(float)baseAmbiguity);
	    	  } else {
	    		  // ambiguous match, so offset this mismatch hit (i.e. make the following statements a noop)
	    		  matches++;
	    		  logMiss = logMatch;
	    	  }
	      }
          // logMatch was already applied, so replace it with logMiss
	      loglikelihoodPositions[refPos] += logMiss - logMatch;

	      refPos++;
	      pos++;
	      matches--;
	      ////printf("MD %d miss  %d. %f\n", seqPos, 1, loglikelihood);
	    }

	    // deletions
	    if(MD[pos] == '^'){
	      pos++;
	      while(isalpha(MD[pos])){
	        pos++;
	        refPos++;
	      }
	    }

	    // sees if we are at the end
	    if(MD[pos] == '\0'){
	      stop = 1;
	      continue;
	    }
	  }
	  if (refPos != alignmentLength) fprintf(stderr, "WARNING: CIGAR and MD field disagree on match region for %s\n", bam1_qname(read));
  } else {
	  printf("WARNING: could not find the MD tag for %s\n", bam1_qname(read));
  }

  double identity = ((double)matches) / ((double) readlen);
  setLeastIdentity(identity);

  return softclipContribution;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %r9, %r13
movq %r8, %r15
movq %rsi, -0x68(%rbp)
testq %rdi, %rdi
je 0x5d86
movq %rdi, %r14
movq %r15, -0xb8(%rbp)
movl %edx, -0x2c(%rbp)
movq %rcx, -0x90(%rbp)
movq 0x8(%rdi), %rax
btq $0x22, %rax
jb 0x6538
movl 0x10(%r14), %ecx
movq -0x68(%rbp), %rdx
movq 0x10(%rdx), %rsi
movl %eax, %r12d
shrl $0x18, %r12d
addq 0x30(%r14), %r12
shrq $0x30, %rax
leaq (%r12,%rax,4), %r15
movq %rcx, -0x98(%rbp)
leal 0x1(%rcx), %eax
sarl %eax
movslq %eax, %rbx
movq %r14, %rdi
callq 0x593b
movq %rax, -0xc0(%rbp)
movq %rsp, -0xd8(%rbp)
movq 0x8(%r14), %rax
shrq $0x30, %rax
movq %rax, -0x78(%rbp)
movq -0x90(%rbp), %rcx
movl %ecx, %edx
movq %rsp, %rsi
leaq 0xf(,%rdx,4), %rax
andq $-0x10, %rax
subq %rax, %rsi
movq %rsi, -0xa0(%rbp)
movq %rsi, %rsp
testl %ecx, %ecx
jle 0x5d55
shlq $0x3, %rdx
movq %r13, %rdi
xorl %esi, %esi
callq 0x3260
addq %rbx, %r15
movq %r15, -0x70(%rbp)
cmpq $0x0, -0x78(%rbp)
movq %r13, -0x50(%rbp)
movq %r14, -0x48(%rbp)
jne 0x5dbf
movl $0x0, -0x30(%rbp)
xorpd %xmm0, %xmm0
movsd %xmm0, -0x80(%rbp)
xorl %r10d, %r10d
xorl %r15d, %r15d
jmp 0x61ed
xorpd %xmm0, %xmm0
movsd %xmm0, -0x80(%rbp)
testl %ecx, %ecx
jle 0x64d0
movl %ecx, %ebx
xorl %r14d, %r14d
movl $0x0, (%r15,%r14,4)
xorl %eax, %eax
callq 0xa881
movsd %xmm0, (%r13,%r14,8)
incq %r14
cmpq %r14, %rbx
jne 0x5d9c
jmp 0x64d0
xorpd %xmm0, %xmm0
movsd %xmm0, -0x80(%rbp)
xorl %ebx, %ebx
xorl %r15d, %r15d
xorl %r10d, %r10d
movl $0x0, -0x30(%rbp)
movq %r12, -0x60(%rbp)
movl (%r12,%rbx,4), %eax
movl %eax, %ecx
andl $0xf, %ecx
cmpl $0x8, %ecx
ja 0x61e0
movl %eax, %r8d
shrl $0x4, %r8d
leaq 0x17d15(%rip), %rdx     # 0x1db10
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movq %r10, -0x88(%rbp)
movq %rbx, -0x38(%rbp)
movl %r15d, -0x40(%rbp)
cmpl $0x10, %eax
movl -0x2c(%rbp), %ebx
movq -0x70(%rbp), %r12
jb 0x5ec2
movl -0x40(%rbp), %eax
movq %rax, -0xb0(%rbp)
movslq -0x88(%rbp), %rax
movq -0x50(%rbp), %rcx
leaq (%rcx,%rax,8), %rcx
movq %rcx, -0xa8(%rbp)
movq -0xb8(%rbp), %rcx
leaq (%rcx,%rax,4), %rcx
movq %rcx, -0xd0(%rbp)
movq -0xa0(%rbp), %rcx
leaq (%rcx,%rax,4), %rax
movq %rax, -0xc8(%rbp)
xorl %r14d, %r14d
movq -0xb0(%rbp), %rax
leal (%rax,%r14), %r15d
movq %r12, %rdi
movl %r15d, %esi
movl $0x1, %edx
movl %ebx, %ecx
movq %r8, %r13
callq 0x5aaf
movq %r13, %r8
movq -0xa8(%rbp), %rax
addsd (%rax,%r14,8), %xmm0
movsd %xmm0, (%rax,%r14,8)
movq -0xd0(%rbp), %rax
movl $0x3f800000, (%rax,%r14,4) # imm = 0x3F800000
movq -0xc8(%rbp), %rax
movl %r15d, (%rax,%r14,4)
incq %r14
cmpq %r14, %r13
jne 0x5e6a
addl %r8d, -0x30(%rbp)
movl -0x40(%rbp), %r15d
addl %r8d, %r15d
movq -0x88(%rbp), %r10
addl %r8d, %r10d
movq -0x50(%rbp), %r13
movq -0x48(%rbp), %r14
movq -0x60(%rbp), %r12
movq -0x38(%rbp), %rbx
jmp 0x61e0
leal (%r8,%r10), %r14d
cmpl %r14d, %r10d
jae 0x60d7
movq %r13, %r12
movq %rbx, -0x38(%rbp)
movslq %r10d, %rbx
movq -0xb8(%rbp), %rax
leaq (%rax,%rbx,4), %rdi
decl %r8d
leaq 0x4(,%r8,4), %rdx
xorl %esi, %esi
movq %r10, %r13
callq 0x3260
movq %r13, %rcx
movq -0xa0(%rbp), %rax
leaq (%rax,%rbx,4), %rax
movl %r15d, (%rax)
addq $0x4, %rax
incl %ecx
cmpl %ecx, %r14d
ja 0x5f31
movl %r14d, %r10d
movq -0x48(%rbp), %r14
jmp 0x6106
movq %rbx, -0x38(%rbp)
testl %r15d, %r15d
movl %r15d, -0x40(%rbp)
movq %r8, -0x58(%rbp)
je 0x6116
movl %r15d, %esi
leal (%r8,%r10), %eax
movq -0x68(%rbp), %rcx
movl 0x8(%rcx), %ecx
leal -0x1(%rcx), %ebx
cmpl %ecx, %eax
cmovll %eax, %ebx
movl %ebx, %r15d
subl %r10d, %r15d
movq -0x70(%rbp), %rdi
movl %r15d, %edx
movl -0x2c(%rbp), %ecx
movq %r10, %r13
callq 0x5a37
cmpl $0x0, 0x10(%rbp)
je 0x61ac
cmpl %r13d, %ebx
movq %r13, %r10
movq -0x58(%rbp), %rsi
jle 0x619e
xorps %xmm2, %xmm2
cvtsi2sd %r15d, %xmm2
movapd %xmm0, %xmm1
divsd %xmm2, %xmm1
movq -0x68(%rbp), %rax
movq 0x38(%rax), %rax
movslq %r10d, %rcx
movslq %ebx, %rdx
movq -0x50(%rbp), %r13
xorps %xmm2, %xmm2
cvtss2sd (%rax,%rcx,4), %xmm2
addsd %xmm1, %xmm2
cvtsd2ss %xmm2, %xmm2
movss %xmm2, (%rax,%rcx,4)
incq %rcx
cmpq %rcx, %rdx
jne 0x5fca
jmp 0x6194
movq %r13, %r12
movq %rbx, -0x38(%rbp)
leal 0x1(%r10), %ebx
movq -0x68(%rbp), %rax
movl 0x8(%rax), %r14d
movq -0x70(%rbp), %rdi
movl %r15d, %esi
movq %r8, -0x58(%rbp)
movl %r8d, %edx
movl -0x2c(%rbp), %ecx
movq %r10, %r13
callq 0x5a37
cmpl %r14d, %ebx
jge 0x60e3
mulsd 0x17a3f(%rip), %xmm0    # 0x1da68
movslq %r13d, %rax
movsd (%r12,%rax,8), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%r12,%rax,8)
jmp 0x60e6
leal (%r8,%r10), %r14d
movq -0x68(%rbp), %rax
cmpl 0x8(%rax), %r14d
ja 0x6519
movq %r13, %r12
movq %r10, %r13
movq -0x70(%rbp), %rdi
movl %r15d, %esi
movl %r8d, %edx
movl -0x2c(%rbp), %ecx
movq %r8, -0x58(%rbp)
movq -0x98(%rbp), %r8
callq 0x5b2c
cmpl %r14d, %r13d
jae 0x60ce
xorps %xmm1, %xmm1
cvtsi2sdl -0x58(%rbp), %xmm1
divsd %xmm1, %xmm0
movslq %r13d, %rdx
leaq (%r12,%rdx,8), %rax
movq -0xb8(%rbp), %rcx
leaq (%rcx,%rdx,4), %rcx
movq -0xa0(%rbp), %rsi
leaq (%rsi,%rdx,4), %rdx
movl %r13d, %esi
xorl %edi, %edi
movsd (%rax,%rdi,8), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%rax,%rdi,8)
movl $0x0, (%rcx,%rdi,4)
movl %r15d, (%rdx,%rdi,4)
incq %rdi
leal (%rsi,%rdi), %r8d
cmpl %r8d, %r14d
ja 0x60a9
movl %r14d, %r10d
movq -0x48(%rbp), %r14
jmp 0x610a
movl %r14d, %r10d
movq -0x48(%rbp), %r14
jmp 0x61e0
movl %r13d, %ebx
movq -0x48(%rbp), %r14
movq %r13, %r10
movslq %ebx, %rax
addsd (%r12,%rax,8), %xmm0
movsd %xmm0, (%r12,%rax,8)
movq -0x58(%rbp), %rax
addl %r15d, %eax
movl %eax, %r15d
movq -0x38(%rbp), %rbx
movq %r12, %r13
movq -0x60(%rbp), %r12
jmp 0x61e0
movl %r10d, %ebx
subl %r8d, %ebx
testl %ebx, %ebx
movl $0x0, %eax
cmovlel %eax, %ebx
movl %r10d, %r15d
subl %ebx, %r15d
movl %r8d, %esi
subl %r15d, %esi
movq -0x70(%rbp), %rdi
movl %r15d, %edx
movl -0x2c(%rbp), %ecx
movq %r10, %r13
callq 0x5a37
cmpl $0x0, 0x10(%rbp)
je 0x61ac
cmpl %ebx, %r13d
movq %r13, %r10
movq -0x58(%rbp), %rsi
jle 0x619e
xorps %xmm2, %xmm2
cvtsi2sd %r15d, %xmm2
movapd %xmm0, %xmm1
divsd %xmm2, %xmm1
movq -0x68(%rbp), %rax
movq 0x38(%rax), %rax
movl %ebx, %ecx
movl %r10d, %edx
movq -0x50(%rbp), %r13
xorps %xmm2, %xmm2
cvtss2sd (%rax,%rcx,4), %xmm2
addsd %xmm1, %xmm2
cvtsd2ss %xmm2, %xmm2
movss %xmm2, (%rax,%rcx,4)
incq %rcx
cmpq %rcx, %rdx
jne 0x6177
movl -0x40(%rbp), %r15d
movq -0x38(%rbp), %rbx
jmp 0x61bf
movl -0x40(%rbp), %r15d
movq -0x38(%rbp), %rbx
movq -0x50(%rbp), %r13
jmp 0x61bf
movl -0x40(%rbp), %r15d
movq -0x38(%rbp), %rbx
movq %r13, %r10
movq -0x50(%rbp), %r13
movq -0x58(%rbp), %rsi
movsd -0x80(%rbp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, -0x80(%rbp)
addl %esi, %r15d
movq -0x98(%rbp), %rax
subl %esi, %eax
movq %rax, -0x98(%rbp)
incq %rbx
cmpq -0x78(%rbp), %rbx
jne 0x5ddb
movl 0x10(%r14), %r9d
cmpl %r9d, %r15d
movq -0x90(%rbp), %rax
jne 0x64e4
cmpl %eax, %r10d
jne 0x64e4
leaq 0x30(%r14), %rcx
movq -0xc0(%rbp), %rax
testq %rax, %rax
je 0x649c
cmpb $0x5a, (%rax)
jne 0x649c
movq %rcx, -0x60(%rbp)
callq 0x36a0
movq -0xc0(%rbp), %r8
movq %rax, -0x88(%rbp)
movq %r8, %rax
incq %rax
movq %rax, -0x78(%rbp)
movl $0x1, %r14d
xorl %eax, %eax
movq -0x88(%rbp), %rcx
movq (%rcx), %rcx
movslq %r14d, %rdx
movsbq (%r8,%rdx), %rsi
testb $0x8, 0x1(%rcx,%rsi,2)
jne 0x626e
xorl %r12d, %r12d
jmp 0x6296
addq -0x78(%rbp), %rdx
xorl %r12d, %r12d
movsbl %sil, %esi
leal (%r12,%r12,4), %edi
leal (%rsi,%rdi,2), %r12d
addl $-0x30, %r12d
movsbq (%rdx), %rsi
incl %r14d
incq %rdx
testb $0x8, 0x1(%rcx,%rsi,2)
jne 0x6275
addl %eax, %r12d
movslq %r14d, %r13
movb (%r8,%r13), %r15b
movsbl %r15b, %edi
callq 0x5bda
testl %eax, %eax
je 0x643f
movl %eax, %ebx
movslq %r12d, %rax
movq -0xa0(%rbp), %rcx
leaq (%rcx,%rax,4), %rcx
movq %rcx, -0xc8(%rbp)
movq -0x50(%rbp), %rcx
leaq (%rcx,%rax,8), %rax
movq %rax, -0x38(%rbp)
movl %r13d, %eax
movq %rax, -0x40(%rbp)
addq -0x78(%rbp), %r13
movq %r13, -0xd0(%rbp)
xorl %r13d, %r13d
movq -0x68(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x48(%rbp), %rcx
movl 0x4(%rcx), %r8d
addl %r12d, %r8d
movslq %r8d, %rcx
movsbl (%rax,%rcx), %eax
movq %rax, -0xa8(%rbp)
cmpb %r15b, %al
jne 0x63fb
movq -0xc8(%rbp), %rax
movl (%rax,%r13,4), %r15d
movq -0x70(%rbp), %rdi
movl %r15d, %esi
movl $0x1, %edx
movl -0x2c(%rbp), %ecx
callq 0x5aaf
movsd %xmm0, -0xb0(%rbp)
cmpl $0x4, %ebx
je 0x639d
cmpl $0x1, %ebx
jne 0x635a
movq -0x70(%rbp), %rdi
movl %r15d, %esi
movl $0x1, %edx
movl -0x2c(%rbp), %ecx
callq 0x5a37
jmp 0x63b5
movq -0x48(%rbp), %rdx
movq 0x8(%rdx), %rax
movq %rax, %rcx
shrq $0x30, %rcx
shlq $0x2, %rcx
addq 0x30(%rdx), %rcx
movslq %r15d, %rdx
shrl $0x18, %eax
addq %rcx, %rax
movsbl (%rdx,%rax), %esi
movq -0xa8(%rbp), %rdi
callq 0x5bf5
testl %eax, %eax
je 0x639d
movl -0x30(%rbp), %eax
incl %eax
movsd -0xb0(%rbp), %xmm0
jmp 0x63b8
xorps %xmm1, %xmm1
cvtsi2sd %ebx, %xmm1
movsd 0x1768c(%rip), %xmm0    # 0x1da38
divsd %xmm1, %xmm0
callq 0x3290
movl -0x30(%rbp), %eax
subsd -0xb0(%rbp), %xmm0
movq -0x38(%rbp), %rcx
addsd (%rcx,%r13,8), %xmm0
movsd %xmm0, (%rcx,%r13,8)
decl %eax
movl %eax, -0x30(%rbp)
movq -0xd0(%rbp), %rax
movb (%rax,%r13), %r15b
movsbl %r15b, %edi
callq 0x5bda
movl %eax, %ebx
incl %r12d
incq %r13
testl %eax, %eax
jne 0x62e9
jmp 0x643c
movsbl %r15b, %r10d
movq 0x25bf2(%rip), %rax     # 0x2bff8
movq (%rax), %rdi
movq -0x48(%rbp), %rax
movq 0x30(%rax), %rdx
movzwl 0xc(%rax), %ecx
movq -0x40(%rbp), %rax
leal (%rax,%r13), %r9d
leaq 0x1bb2c(%rip), %rsi     # 0x21f50
xorl %eax, %eax
pushq %r10
pushq -0xa8(%rbp)
callq 0x3350
addq $0x10, %rsp
jmp 0x6313
addl %r13d, %r14d
cmpb $0x5e, %r15b
movq -0xc0(%rbp), %r8
jne 0x6478
movq -0x88(%rbp), %rax
movq (%rax), %rcx
movslq %r14d, %rdx
addq -0x78(%rbp), %rdx
decl %r12d
movl %r12d, %eax
movsbq (%rdx), %rsi
incl %r14d
incq %rdx
incl %eax
testb $0x4, 0x1(%rcx,%rsi,2)
jne 0x6463
jmp 0x647b
movl %r12d, %eax
movslq %r14d, %rcx
cmpb $0x0, (%r8,%rcx)
jne 0x6250
cmpl -0x90(%rbp), %eax
je 0x64ad
movq -0x60(%rbp), %rdi
callq 0x379d
jmp 0x64ad
movq (%rcx), %rsi
leaq 0x1bb57(%rip), %rdi     # 0x21ffd
xorl %eax, %eax
callq 0x3210
xorps %xmm0, %xmm0
cvtsi2sdl -0x30(%rbp), %xmm0
xorps %xmm1, %xmm1
cvtsi2sdl -0x98(%rbp), %xmm1
divsd %xmm1, %xmm0
callq 0xa8e1
movq -0xd8(%rbp), %rsp
movsd -0x80(%rbp), %xmm0
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x25b0d(%rip), %rax     # 0x2bff8
movq (%rax), %rdi
movq 0x30(%r14), %rdx
movzwl 0xc(%r14), %ecx
leaq 0x1b9ca(%rip), %rsi     # 0x21ec8
movl %r15d, %r8d
xorl %eax, %eax
pushq -0x90(%rbp)
pushq %r10
callq 0x3350
addq $0x10, %rsp
jmp 0x620a
leaq 0x1b987(%rip), %rdi     # 0x21ea7
leaq 0x1b7de(%rip), %rsi     # 0x21d05
leaq 0x1b91d(%rip), %rcx     # 0x21e4b
movl $0x235, %edx            # imm = 0x235
callq 0x3230
leaq 0x1b8e8(%rip), %rdi     # 0x21e27
leaq 0x1b7bf(%rip), %rsi     # 0x21d05
leaq 0x1b8fe(%rip), %rcx     # 0x21e4b
movl $0x209, %edx            # imm = 0x209
callq 0x3230