// File: /workspace/github_c_makefile_star2_O0/sc932[P]ALE/src/ALElike.c
// Function: computeKmerStats
void computeKmerStats(assemblyT *theAssembly, int kmerLen){
  int i, j, k, hash;
  long totalKmers, totalKmersInit;
  totalKmers = 0;
  totalKmersInit = pow(4, kmerLen);
  // calculate total possible kmers
  long *kmerVec = malloc(totalKmersInit*sizeof(long));
  double kmerSum = 0.0;
  double kmerNorm = 0.0;
  double logkmerZnorm = 0.0;

  if (!isMetagenome()) {
	    // initialize kmerVec
	    for(j = 0; j < totalKmersInit; j++){
	      kmerVec[j] = 0;
	    }
	    totalKmers = 0;

	    // calculate the kmer spectrum
	    for(i = 0; i < theAssembly->numContigs; i++){
	    	contig_t *contig = theAssembly->contigs[i];
	    	if (contig->seqLen > kmerLen) {
	        	// add up the kmers
	        	for(j = 0; j < contig->seqLen - kmerLen; j++){
	        		hash = getKmerHash(contig->seq, j, kmerLen);
	        		////printf("Hash = %i\n", hash);
	        		if(hash > -1){
	        			kmerVec[hash]++;
	        			totalKmers++;
	        		}
	        	}
	    	}
	    }

	    // apply kmer score to total scores
	    for(i = 0; i < theAssembly->numContigs; i++){
	    	contig_t *contig = theAssembly->contigs[i];
	    	if (contig->seqLen > kmerLen) {
	    		for(j = 0; j < contig->seqLen - kmerLen; j++){
	    			hash = getKmerHash(contig->seq, j, kmerLen);
	    			if(hash > -1){
	    				double score = ((double)kmerVec[hash]) / ((double)totalKmers);
	    				double logScore = log(score);
		    			theAssembly->totalScore += logScore; // k-mer contribution to totalScore
		    			theAssembly->kmerAvgSum += logScore;
		    			theAssembly->kmerAvgNorm += 1.0;
		    			kmerSum += score;
		    			kmerNorm += 1.0;
	    			}
	    		}
	    	}
	    }
	    //printf("Kmer Normalization factor (log): %lf\n", log(kmerSum/kmerNorm));

  }

  // find all kmers present
  for(i = 0; i < theAssembly->numContigs; i++){
    contig_t *contig = theAssembly->contigs[i];
    if (contig->seqLen <= kmerLen){  // this should be exceedingly rare, the contig length <= a tetramer!!
    	// contig is too small to process
    	// there is no information to process
        for(j = 0; j < contig->seqLen; j++){
            contig->kmerLogLikelihood[j] = 0.0;
        }
        continue;
    }

    if (isMetagenome()) {
    	// initialize kmerVec
    	for(j = 0; j < totalKmersInit; j++){
    		kmerVec[j] = 0;
    	}
    	totalKmers = 0;
    	kmerSum = 0.0;
    	kmerNorm = 0.0;

    	// add up the kmer spectrum
    	for(j = 0; j < contig->seqLen - kmerLen; j++){
    		hash = getKmerHash(contig->seq, j, kmerLen);
    		////printf("Hash = %i\n", hash);
    		if(hash > -1){
    			kmerVec[hash]++;
    			totalKmers++;
    		}
    	}

    	// apply the kmer score to the total score
    	for(j = 0; j < contig->seqLen - kmerLen; j++){
    		hash = getKmerHash(contig->seq, j, kmerLen);
    		if(hash > -1){
    			double score = ((double)kmerVec[hash]) / ((double)totalKmers);
    			double logScore = log(score);

    			theAssembly->totalScore += logScore; // k-mer contribution to totalScore
    			theAssembly->kmerAvgSum += logScore;
    			theAssembly->kmerAvgNorm += 1.0;
    			kmerSum += score;
    			kmerNorm += 1.0;
    		}
    	}
    }

    logkmerZnorm = log(kmerSum/kmerNorm);

    //
    // ** Using contig->kmerLogLikelihood[] as just a likelihood.  Will convert back to log(likelihood) at the end **
    //

    ////printf("Calculated all %i kmers!\n", totalKmers);
    // calculate probability of seeing that kmer based on the rest of the contig
    // first kmer - 1 unrolled
    for(j = 0; j < kmerLen; j++){
      contig->kmerLogLikelihood[j] = 0.0;
      for(k = 0; k < j+1; k++){
        hash = getKmerHash(contig->seq, k, kmerLen);
        if(hash > -1){
          contig->kmerLogLikelihood[j] += 1.0/(double)(j+1)*(double)(kmerVec[hash])/(double)(totalKmers);
        }
      }
      ////printf("New likelihood[%i]: %f.\n", j, contig->kmerLikelihood[j]);
    }
    ////printf("First.\n");
    // middle bunch
    for(j = kmerLen; j < contig->seqLen - kmerLen; j++){
      contig->kmerLogLikelihood[j] = 0.0;
      for(k = 0; k < kmerLen; k++){
        hash = getKmerHash(contig->seq, j - k, kmerLen);
        if(hash > -1){
          contig->kmerLogLikelihood[j] += 1.0/(double)(kmerLen)*(double)(kmerVec[hash])/(double)(totalKmers);
        }
      }
      ////printf("New likelihood[%i]: %f.\n", j, contig->kmerLikelihood[j]);
    }
    ////printf("Mid.\n");
    // last bits
    for(j = contig->seqLen - kmerLen; j < contig->seqLen; j++){
      contig->kmerLogLikelihood[j] = 0.0;
      for(k = j - kmerLen; k < j - kmerLen + (contig->seqLen - j); k++){
        hash = getKmerHash(contig->seq, k, kmerLen);
        if(hash > -1){
          contig->kmerLogLikelihood[j] += 1.0/(double)(contig->seqLen - j)*(double)(kmerVec[hash])/(double)(totalKmers);
        }
      }
      ////printf("New likelihood[%i]: %f.\n", j, contig->kmerLikelihood[j]);
    }
    ////printf("Last.\n");
    //
    // ** Converting contig->kmerLogLikelihood[] back to log(likelihood) and normalizing **
    //

    // add up kmer score into total score
    long contributingKmers = 0;
    for(j = 0; j < contig->seqLen; j++){
        assert(contig->kmerLogLikelihood[j] <= 1.0 && contig->kmerLogLikelihood[j] >= 0.0);  // not log yet...
    	if (contig->kmerLogLikelihood[j] > 0.0) {
    		contig->kmerLogLikelihood[j] = validateLogLikelihood( log(contig->kmerLogLikelihood[j]) - logkmerZnorm );
    		contributingKmers++;
    	} else {
    		contig->kmerLogLikelihood[j] = 0.0; // no information, so do not floor per-base value
    	}
    }

   	// z normalize
   	if(contributingKmers - kmerLen > 0){
   		theAssembly->totalScore -= logkmerZnorm*(double)(contributingKmers - kmerLen);
   		theAssembly->kmerAvgSum -= logkmerZnorm*(double)(contributingKmers - kmerLen);
   	}

  }
  free(kmerVec);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq $0x0, -0x28(%rbp)
cvtsi2sdl -0xc(%rbp), %xmm1
movsd 0x25fc9(%rip), %xmm0    # 0x2ba80
callq 0x31b0
cvttsd2si %xmm0, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
shlq $0x3, %rdi
callq 0x3420
movq %rax, -0x38(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x40(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x48(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x50(%rbp)
movb $0x0, %al
callq 0xbec0
cmpl $0x0, %eax
jne 0x5d04
movl $0x0, -0x14(%rbp)
movslq -0x14(%rbp), %rax
cmpq -0x30(%rbp), %rax
jge 0x5b2a
movq -0x38(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq $0x0, (%rax,%rcx,8)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x5b05
movq $0x0, -0x28(%rbp)
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x5bde
movq -0x8(%rbp), %rax
movq 0xa0(%rax), %rax
movslq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movl 0x8(%rax), %eax
cmpl -0xc(%rbp), %eax
jle 0x5bce
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x58(%rbp), %rcx
movl 0x8(%rcx), %ecx
subl -0xc(%rbp), %ecx
cmpl %ecx, %eax
jge 0x5bcc
movq -0x58(%rbp), %rax
movq 0x10(%rax), %rdi
movl -0x14(%rbp), %esi
movl -0xc(%rbp), %edx
callq 0x5a30
movl %eax, -0x1c(%rbp)
cmpl $-0x1, -0x1c(%rbp)
jle 0x5bbf
movq -0x38(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
addq $0x1, %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x5bc1
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x5b72
jmp 0x5bce
jmp 0x5bd0
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x5b39
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x5d02
movq -0x8(%rbp), %rax
movq 0xa0(%rax), %rax
movslq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movl 0x8(%rax), %eax
cmpl -0xc(%rbp), %eax
jle 0x5cf2
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x60(%rbp), %rcx
movl 0x8(%rcx), %ecx
subl -0xc(%rbp), %ecx
cmpl %ecx, %eax
jge 0x5cf0
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rdi
movl -0x14(%rbp), %esi
movl -0xc(%rbp), %edx
callq 0x5a30
movl %eax, -0x1c(%rbp)
cmpl $-0x1, -0x1c(%rbp)
jle 0x5ce0
movq -0x38(%rbp), %rax
movslq -0x1c(%rbp), %rcx
cvtsi2sdq (%rax,%rcx,8), %xmm0
cvtsi2sdq -0x28(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x68(%rbp)
movsd -0x68(%rbp), %xmm0
callq 0x3280
movsd %xmm0, -0x70(%rbp)
movsd -0x70(%rbp), %xmm0
movq -0x8(%rbp), %rax
addsd 0x10(%rax), %xmm0
movsd %xmm0, 0x10(%rax)
movsd -0x70(%rbp), %xmm0
movq -0x8(%rbp), %rax
addsd 0x18(%rax), %xmm0
movsd %xmm0, 0x18(%rax)
movq -0x8(%rbp), %rax
movsd 0x25d8b(%rip), %xmm0    # 0x2ba40
addsd 0x20(%rax), %xmm0
movsd %xmm0, 0x20(%rax)
movsd -0x68(%rbp), %xmm0
addsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
movsd 0x25d6a(%rip), %xmm0    # 0x2ba40
addsd -0x48(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
jmp 0x5ce2
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x5c22
jmp 0x5cf2
jmp 0x5cf4
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x5be5
jmp 0x5d04
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x6368
movq -0x8(%rbp), %rax
movq 0xa0(%rax), %rax
movslq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
movl 0x8(%rax), %eax
cmpl -0xc(%rbp), %eax
jg 0x5d74
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x78(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x5d6f
movq -0x78(%rbp), %rax
movq 0x50(%rax), %rax
movslq -0x14(%rbp), %rcx
xorps %xmm0, %xmm0
movss %xmm0, (%rax,%rcx,4)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x5d44
jmp 0x635a
movb $0x0, %al
callq 0xbec0
cmpl $0x0, %eax
je 0x5f09
movl $0x0, -0x14(%rbp)
movslq -0x14(%rbp), %rax
cmpq -0x30(%rbp), %rax
jge 0x5db0
movq -0x38(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq $0x0, (%rax,%rcx,8)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x5d8b
movq $0x0, -0x28(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x40(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x48(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x78(%rbp), %rcx
movl 0x8(%rcx), %ecx
subl -0xc(%rbp), %ecx
cmpl %ecx, %eax
jge 0x5e29
movq -0x78(%rbp), %rax
movq 0x10(%rax), %rdi
movl -0x14(%rbp), %esi
movl -0xc(%rbp), %edx
callq 0x5a30
movl %eax, -0x1c(%rbp)
cmpl $-0x1, -0x1c(%rbp)
jle 0x5e1c
movq -0x38(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
addq $0x1, %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x5e1e
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x5dcf
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x78(%rbp), %rcx
movl 0x8(%rcx), %ecx
subl -0xc(%rbp), %ecx
cmpl %ecx, %eax
jge 0x5f07
movq -0x78(%rbp), %rax
movq 0x10(%rax), %rdi
movl -0x14(%rbp), %esi
movl -0xc(%rbp), %edx
callq 0x5a30
movl %eax, -0x1c(%rbp)
cmpl $-0x1, -0x1c(%rbp)
jle 0x5ef7
movq -0x38(%rbp), %rax
movslq -0x1c(%rbp), %rcx
cvtsi2sdq (%rax,%rcx,8), %xmm0
cvtsi2sdq -0x28(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x80(%rbp)
movsd -0x80(%rbp), %xmm0
callq 0x3280
movsd %xmm0, -0x88(%rbp)
movsd -0x88(%rbp), %xmm0
movq -0x8(%rbp), %rax
addsd 0x10(%rax), %xmm0
movsd %xmm0, 0x10(%rax)
movsd -0x88(%rbp), %xmm0
movq -0x8(%rbp), %rax
addsd 0x18(%rax), %xmm0
movsd %xmm0, 0x18(%rax)
movq -0x8(%rbp), %rax
movsd 0x25b74(%rip), %xmm0    # 0x2ba40
addsd 0x20(%rax), %xmm0
movsd %xmm0, 0x20(%rax)
movsd -0x80(%rbp), %xmm0
addsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
movsd 0x25b53(%rip), %xmm0    # 0x2ba40
addsd -0x48(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
jmp 0x5ef9
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x5e30
jmp 0x5f09
movsd -0x40(%rbp), %xmm0
divsd -0x48(%rbp), %xmm0
callq 0x3280
movsd %xmm0, -0x50(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x5fec
movq -0x78(%rbp), %rax
movq 0x50(%rax), %rax
movslq -0x14(%rbp), %rcx
xorps %xmm0, %xmm0
movss %xmm0, (%rax,%rcx,4)
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jge 0x5fdc
movq -0x78(%rbp), %rax
movq 0x10(%rax), %rdi
movl -0x18(%rbp), %esi
movl -0xc(%rbp), %edx
callq 0x5a30
movl %eax, -0x1c(%rbp)
cmpl $-0x1, -0x1c(%rbp)
jle 0x5fcc
movl -0x14(%rbp), %eax
addl $0x1, %eax
cvtsi2sd %eax, %xmm0
movsd 0x25ab6(%rip), %xmm1    # 0x2ba40
divsd %xmm0, %xmm1
movq -0x38(%rbp), %rax
movslq -0x1c(%rbp), %rcx
cvtsi2sdq (%rax,%rcx,8), %xmm0
mulsd %xmm0, %xmm1
cvtsi2sdq -0x28(%rbp), %xmm0
divsd %xmm0, %xmm1
movq -0x78(%rbp), %rax
movq 0x50(%rax), %rax
movslq -0x14(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
addsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, (%rax,%rcx,4)
jmp 0x5fce
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x5f4b
jmp 0x5fde
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x5f24
movl -0xc(%rbp), %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x78(%rbp), %rcx
movl 0x8(%rcx), %ecx
subl -0xc(%rbp), %ecx
cmpl %ecx, %eax
jge 0x60b8
movq -0x78(%rbp), %rax
movq 0x50(%rax), %rax
movslq -0x14(%rbp), %rcx
xorps %xmm0, %xmm0
movss %xmm0, (%rax,%rcx,4)
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x60a8
movq -0x78(%rbp), %rax
movq 0x10(%rax), %rdi
movl -0x14(%rbp), %esi
subl -0x18(%rbp), %esi
movl -0xc(%rbp), %edx
callq 0x5a30
movl %eax, -0x1c(%rbp)
cmpl $-0x1, -0x1c(%rbp)
jle 0x6098
cvtsi2sdl -0xc(%rbp), %xmm0
movsd 0x259ea(%rip), %xmm1    # 0x2ba40
divsd %xmm0, %xmm1
movq -0x38(%rbp), %rax
movslq -0x1c(%rbp), %rcx
cvtsi2sdq (%rax,%rcx,8), %xmm0
mulsd %xmm0, %xmm1
cvtsi2sdq -0x28(%rbp), %xmm0
divsd %xmm0, %xmm1
movq -0x78(%rbp), %rax
movq 0x50(%rax), %rax
movslq -0x14(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
addsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, (%rax,%rcx,4)
jmp 0x609a
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x6022
jmp 0x60aa
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x5ff2
movq -0x78(%rbp), %rax
movl 0x8(%rax), %eax
subl -0xc(%rbp), %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x78(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x61a3
movq -0x78(%rbp), %rax
movq 0x50(%rax), %rax
movslq -0x14(%rbp), %rcx
xorps %xmm0, %xmm0
movss %xmm0, (%rax,%rcx,4)
movl -0x14(%rbp), %eax
subl -0xc(%rbp), %eax
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
movl -0x14(%rbp), %ecx
subl -0xc(%rbp), %ecx
movq -0x78(%rbp), %rdx
movl 0x8(%rdx), %edx
subl -0x14(%rbp), %edx
addl %edx, %ecx
cmpl %ecx, %eax
jge 0x6193
movq -0x78(%rbp), %rax
movq 0x10(%rax), %rdi
movl -0x18(%rbp), %esi
movl -0xc(%rbp), %edx
callq 0x5a30
movl %eax, -0x1c(%rbp)
cmpl $-0x1, -0x1c(%rbp)
jle 0x6183
movq -0x78(%rbp), %rax
movl 0x8(%rax), %eax
subl -0x14(%rbp), %eax
cvtsi2sd %eax, %xmm0
movsd 0x258ff(%rip), %xmm1    # 0x2ba40
divsd %xmm0, %xmm1
movq -0x38(%rbp), %rax
movslq -0x1c(%rbp), %rcx
cvtsi2sdq (%rax,%rcx,8), %xmm0
mulsd %xmm0, %xmm1
cvtsi2sdq -0x28(%rbp), %xmm0
divsd %xmm0, %xmm1
movq -0x78(%rbp), %rax
movq 0x50(%rax), %rax
movslq -0x14(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
addsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, (%rax,%rcx,4)
jmp 0x6185
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x60f2
jmp 0x6195
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x60c5
movq $0x0, -0x90(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x78(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x62b6
movq -0x78(%rbp), %rax
movq 0x50(%rax), %rax
movslq -0x14(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm1
movsd 0x2585e(%rip), %xmm0    # 0x2ba40
ucomisd %xmm1, %xmm0
jb 0x6208
movq -0x78(%rbp), %rax
movq 0x50(%rax), %rax
movslq -0x14(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x6208
jmp 0x6227
leaq 0x29ed9(%rip), %rdi     # 0x300e8
leaq 0x29baf(%rip), %rsi     # 0x2fdc5
movl $0x3ec, %edx            # imm = 0x3EC
leaq 0x29f11(%rip), %rcx     # 0x30133
callq 0x3220
movq -0x78(%rbp), %rax
movq 0x50(%rax), %rax
movslq -0x14(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x6292
movq -0x78(%rbp), %rax
movq 0x50(%rax), %rax
movslq -0x14(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
callq 0x3280
subsd -0x50(%rbp), %xmm0
callq 0xbe00
cvtsd2ss %xmm0, %xmm0
movq -0x78(%rbp), %rax
movq 0x50(%rax), %rax
movslq -0x14(%rbp), %rcx
movss %xmm0, (%rax,%rcx,4)
movq -0x90(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x90(%rbp)
jmp 0x62a6
movq -0x78(%rbp), %rax
movq 0x50(%rax), %rax
movslq -0x14(%rbp), %rcx
xorps %xmm0, %xmm0
movss %xmm0, (%rax,%rcx,4)
jmp 0x62a8
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x61b5
movq -0x90(%rbp), %rax
movslq -0xc(%rbp), %rcx
subq %rcx, %rax
cmpq $0x0, %rax
jle 0x6358
movsd -0x50(%rbp), %xmm0
movq -0x90(%rbp), %rax
movslq -0xc(%rbp), %rcx
subq %rcx, %rax
cvtsi2sd %rax, %xmm2
movq -0x8(%rbp), %rax
movsd 0x10(%rax), %xmm1
movq %xmm0, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rcx
movq %rcx, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rax)
movsd -0x50(%rbp), %xmm0
movq -0x90(%rbp), %rax
movslq -0xc(%rbp), %rcx
subq %rcx, %rax
cvtsi2sd %rax, %xmm2
movq -0x8(%rbp), %rax
movsd 0x18(%rax), %xmm1
movq %xmm0, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rcx
movq %rcx, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x18(%rax)
jmp 0x635a
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x5d0b
movq -0x38(%rbp), %rdi
callq 0x3050
addq $0x90, %rsp
popq %rbp
retq
nopw (%rax,%rax)