// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movl %esi, %r12d
movq %rdi, %rbx
cvtsi2sd %esi, %xmm0
movsd %xmm0, 0x40(%rsp)
addsd %xmm0, %xmm0
callq 0x3050
cvttsd2si %xmm0, %r14
leaq (,%r14,8), %rdi
movq %rdi, 0x98(%rsp)
callq 0x3420
movq %rax, 0x28(%rsp)
xorl %eax, %eax
callq 0xaba1
testl %eax, %eax
movq %r12, 0x20(%rsp)
movq %rbx, 0x30(%rsp)
movq %r14, 0xb0(%rsp)
je 0x705f
movl (%rbx), %ecx
xorpd %xmm0, %xmm0
movapd %xmm0, 0x70(%rsp)
movq $0x0, 0x38(%rsp)
testl %ecx, %ecx
jle 0x7269
movl %r12d, %ebp
movsd 0x1700a(%rip), %xmm0    # 0x1da30
divsd 0x40(%rsp), %xmm0
movsd %xmm0, 0xb8(%rsp)
movslq %r12d, %rax
movq %rax, 0xa0(%rsp)
leal (%r12,%r12), %eax
movl %eax, 0x94(%rsp)
xorl %ecx, %ecx
movq 0xa0(%rbx), %rax
movq (%rax,%rcx,8), %rax
movq %rax, 0x10(%rsp)
movl 0x8(%rax), %edx
cmpl %r12d, %edx
movq %rcx, %rbx
jle 0x6b1e
movq %rbx, 0xa8(%rsp)
xorl %eax, %eax
callq 0xaba1
testl %eax, %eax
je 0x6c40
cmpq $0x0, 0xb0(%rsp)
jle 0x6aa2
movq 0x28(%rsp), %rdi
xorl %esi, %esi
movq 0x98(%rsp), %rdx
callq 0x3260
movq 0x10(%rsp), %rax
movl 0x8(%rax), %eax
movl %eax, 0x50(%rsp)
subl %r12d, %eax
jle 0x6b3f
movl %eax, %ebx
xorl %r15d, %r15d
movq $0x0, 0x38(%rsp)
testl %r12d, %r12d
jle 0x6afb
movq 0x10(%rsp), %rax
movq 0x10(%rax), %r14
addq %r15, %r14
xorl %r13d, %r13d
xorl %r12d, %r12d
movsbl (%r14,%r13), %edi
movl %r13d, %esi
callq 0x68f1
addl %eax, %r12d
incq %r13
cmpq %r13, %rbp
jne 0x6adc
testl %r12d, %r12d
jns 0x6afe
jmp 0x6b0f
xorl %r12d, %r12d
movl %r12d, %eax
movq 0x28(%rsp), %rcx
incq (%rcx,%rax,8)
incq 0x38(%rsp)
incq %r15
cmpq %rbx, %r15
movq 0x20(%rsp), %r12
jne 0x6ac5
jmp 0x6b48
testl %edx, %edx
jle 0x703e
movq 0x10(%rsp), %rax
movq 0x50(%rax), %rdi
shlq $0x2, %rdx
xorl %esi, %esi
callq 0x3260
jmp 0x703e
movq $0x0, 0x38(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x70(%rsp)
movl 0x50(%rsp), %ecx
cmpl %r12d, %ecx
jle 0x6c40
xorps %xmm0, %xmm0
cvtsi2sdq 0x38(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x70(%rsp)
xorl %ebx, %ebx
testl %r12d, %r12d
jle 0x6bb9
movl %ecx, 0x50(%rsp)
movq 0x10(%rsp), %rax
movq 0x10(%rax), %r14
addq %rbx, %r14
xorl %r13d, %r13d
xorl %r15d, %r15d
movsbl (%r14,%r13), %edi
movl %r13d, %esi
callq 0x68f1
addl %eax, %r15d
incq %r13
cmpq %r13, %rbp
jne 0x6b96
testl %r15d, %r15d
jns 0x6bbc
movl 0x50(%rsp), %ecx
jmp 0x6c2d
xorl %r15d, %r15d
movl %r15d, %eax
movq 0x28(%rsp), %rcx
xorps %xmm0, %xmm0
cvtsi2sdq (%rcx,%rax,8), %xmm0
divsd 0x8(%rsp), %xmm0
movapd %xmm0, 0x50(%rsp)
callq 0x3290
movq 0x30(%rsp), %rax
movupd 0x10(%rax), %xmm1
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
addpd %xmm1, %xmm0
movupd %xmm0, 0x10(%rax)
movsd 0x20(%rax), %xmm0
addsd 0x16e2e(%rip), %xmm0    # 0x1da30
movsd %xmm0, 0x20(%rax)
movapd 0x16f01(%rip), %xmm0    # 0x1db10
unpcklpd 0x50(%rsp), %xmm0       # xmm0 = xmm0[0],mem[0]
movapd 0x70(%rsp), %xmm1
addpd %xmm0, %xmm1
movapd %xmm1, 0x70(%rsp)
movq 0x10(%rsp), %rax
movl 0x8(%rax), %ecx
incq %rbx
movl %ecx, %eax
subl %r12d, %eax
cltq
cmpq %rax, %rbx
jl 0x6b7b
movapd 0x70(%rsp), %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
divsd %xmm1, %xmm0
callq 0x3290
movapd %xmm0, 0xc0(%rsp)
xorps %xmm0, %xmm0
cvtsi2sdq 0x38(%rsp), %xmm0
movsd %xmm0, 0x50(%rsp)
testl %r12d, %r12d
jle 0x6d6b
movq 0x10(%rsp), %rax
movq 0x10(%rax), %rcx
movq %rcx, 0x88(%rsp)
movq 0x50(%rax), %rax
movq %rax, 0x18(%rsp)
movl $0x1, %r15d
xorl %eax, %eax
movq %rax, %rcx
movq 0x18(%rsp), %rax
movl $0x0, (%rax,%rcx,4)
movq %rcx, 0x48(%rsp)
leaq 0x1(%rcx), %rax
movq %rax, 0x68(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd 0x16d69(%rip), %xmm1    # 0x1da30
divsd %xmm0, %xmm1
movsd %xmm1, 0x40(%rsp)
xorpd %xmm0, %xmm0
movss %xmm0, 0x8(%rsp)
movq 0x88(%rsp), %rbx
xorl %r14d, %r14d
xorl %r13d, %r13d
xorl %r12d, %r12d
movsbl (%rbx,%r13), %edi
movl %r13d, %esi
callq 0x68f1
addl %eax, %r12d
incq %r13
cmpq %r13, %rbp
jne 0x6cec
testl %r12d, %r12d
js 0x6d4f
movl %r12d, %eax
movq 0x28(%rsp), %rcx
xorps %xmm0, %xmm0
cvtsi2sdq (%rcx,%rax,8), %xmm0
mulsd 0x40(%rsp), %xmm0
divsd 0x50(%rsp), %xmm0
xorps %xmm1, %xmm1
cvtss2sd 0x8(%rsp), %xmm1
addsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsd2ss %xmm1, %xmm0
movq 0x18(%rsp), %rax
movq 0x48(%rsp), %rcx
movss %xmm0, 0x8(%rsp)
movss %xmm0, (%rax,%rcx,4)
incq %r14
incq %rbx
cmpq %r15, %r14
jne 0x6ce6
incq %r15
movq 0x68(%rsp), %rax
cmpq %rbp, %rax
jne 0x6c9b
movq 0x10(%rsp), %rax
movl 0x8(%rax), %eax
movl %eax, 0x64(%rsp)
movl %eax, %ecx
movq 0x20(%rsp), %rax
subl %eax, %ecx
movl %ecx, 0x40(%rsp)
cmpl %eax, %ecx
jle 0x6e5c
movq 0x10(%rsp), %rcx
movq 0x50(%rcx), %rcx
movq %rcx, 0x18(%rsp)
movslq 0x40(%rsp), %rcx
movq %rcx, 0x48(%rsp)
movq 0xa0(%rsp), %r15
movq 0x18(%rsp), %rcx
movl $0x0, (%rcx,%r15,4)
testl %eax, %eax
jle 0x6e49
movq 0x10(%rsp), %rax
movq 0x10(%rax), %r12
addq %r15, %r12
xorpd %xmm0, %xmm0
movss %xmm0, 0x8(%rsp)
xorl %r14d, %r14d
xorl %r13d, %r13d
xorl %ebx, %ebx
movsbl (%r12,%r13), %edi
movl %r13d, %esi
callq 0x68f1
addl %eax, %ebx
incq %r13
cmpq %r13, %rbp
jne 0x6ddf
testl %ebx, %ebx
js 0x6e3e
movl %ebx, %eax
movq 0x28(%rsp), %rcx
xorps %xmm0, %xmm0
cvtsi2sdq (%rcx,%rax,8), %xmm0
mulsd 0xb8(%rsp), %xmm0
divsd 0x50(%rsp), %xmm0
xorps %xmm1, %xmm1
cvtss2sd 0x8(%rsp), %xmm1
addsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsd2ss %xmm1, %xmm0
movq 0x18(%rsp), %rax
movss %xmm0, 0x8(%rsp)
movss %xmm0, (%rax,%r15,4)
incq %r14
decq %r12
cmpq %rbp, %r14
jne 0x6dda
incq %r15
cmpq 0x48(%rsp), %r15
movq 0x20(%rsp), %rax
jne 0x6dac
testl %eax, %eax
jle 0x6f6d
movl 0x64(%rsp), %ecx
movslq %ecx, %rdx
movslq 0x40(%rsp), %r15
movq 0x10(%rsp), %rax
movq 0x50(%rax), %rax
movq %rax, 0x48(%rsp)
subl 0x94(%rsp), %ecx
movl %ecx, 0x68(%rsp)
movq %r15, 0x18(%rsp)
movq %rdx, 0x88(%rsp)
movq 0x48(%rsp), %rax
movl $0x0, (%rax,%r15,4)
movq %rdx, %rax
subq %r15, %rax
jle 0x6f55
movslq 0x68(%rsp), %r14
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd 0x16b6d(%rip), %xmm1    # 0x1da30
divsd %xmm0, %xmm1
movsd %xmm1, 0x40(%rsp)
movq %r14, %rbx
movq 0x10(%rsp), %rax
addq 0x10(%rax), %rbx
xorpd %xmm0, %xmm0
movss %xmm0, 0x8(%rsp)
xorl %r13d, %r13d
xorl %r12d, %r12d
movsbl (%rbx,%r13), %edi
movl %r13d, %esi
callq 0x68f1
addl %eax, %r12d
incq %r13
cmpq %r13, %rbp
jne 0x6ee9
testl %r12d, %r12d
js 0x6f48
movl %r12d, %eax
movq 0x28(%rsp), %rcx
xorps %xmm0, %xmm0
cvtsi2sdq (%rcx,%rax,8), %xmm0
mulsd 0x40(%rsp), %xmm0
divsd 0x50(%rsp), %xmm0
xorps %xmm1, %xmm1
cvtss2sd 0x8(%rsp), %xmm1
addsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsd2ss %xmm1, %xmm0
movq 0x48(%rsp), %rax
movss %xmm0, 0x8(%rsp)
movss %xmm0, (%rax,%r15,4)
incq %r14
incq %rbx
cmpq 0x18(%rsp), %r14
jl 0x6ee3
incq %r15
incl 0x68(%rsp)
movq 0x88(%rsp), %rdx
cmpq %rdx, %r15
jl 0x6e96
movl 0x64(%rsp), %edx
testl %edx, %edx
jle 0x6ff9
movq 0x10(%rsp), %rax
movq 0x50(%rax), %rax
xorl %r14d, %r14d
xorl %ebx, %ebx
movq 0x20(%rsp), %r12
movss (%rax,%r14,4), %xmm0
movss 0x1adb2(%rip), %xmm1    # 0x21d4c
ucomiss %xmm0, %xmm1
jb 0x7284
ucomiss 0x1ada6(%rip), %xmm0    # 0x21d50
jb 0x7284
jbe 0x6fe4
cvtss2sd %xmm0, %xmm0
callq 0x3290
subsd 0xc0(%rsp), %xmm0
callq 0xab52
cvtsd2ss %xmm0, %xmm0
movq 0x10(%rsp), %rcx
movq 0x50(%rcx), %rax
movss %xmm0, (%rax,%r14,4)
incq %rbx
movl 0x8(%rcx), %edx
jmp 0x6fec
movl $0x0, (%rax,%r14,4)
incq %r14
movslq %edx, %rcx
cmpq %rcx, %r14
jl 0x6f8c
jmp 0x7000
xorl %ebx, %ebx
movq 0x20(%rsp), %r12
subq 0xa0(%rsp), %rbx
jle 0x7036
xorps %xmm0, %xmm0
cvtsi2sd %rbx, %xmm0
movq 0x30(%rsp), %rax
movupd 0x10(%rax), %xmm1
movapd 0xc0(%rsp), %xmm2
mulsd %xmm0, %xmm2
unpcklpd %xmm2, %xmm2            # xmm2 = xmm2[0,0]
subpd %xmm2, %xmm1
movupd %xmm1, 0x10(%rax)
movq 0xa8(%rsp), %rbx
incq %rbx
movq 0x30(%rsp), %rax
movslq (%rax), %rax
cmpq %rax, %rbx
movq %rbx, %rcx
movq 0x30(%rsp), %rbx
jl 0x6a4d
jmp 0x7269
testq %r14, %r14
jle 0x7078
movq 0x28(%rsp), %rdi
xorl %esi, %esi
movq 0x98(%rsp), %rdx
callq 0x3260
movq 0x30(%rsp), %rax
movslq (%rax), %rcx
testq %rcx, %rcx
jle 0x7269
movq 0xa0(%rax), %rax
movq %rax, 0x48(%rsp)
movl %r12d, %r14d
xorl %edx, %edx
movq $0x0, 0x38(%rsp)
movq %rcx, 0x18(%rsp)
movq 0x48(%rsp), %rax
movq (%rax,%rdx,8), %rax
movq %rax, 0x50(%rsp)
movl 0x8(%rax), %eax
subl %r12d, %eax
movq %rdx, 0x8(%rsp)
jle 0x711c
jle 0x711c
movl %eax, %ebp
xorl %r15d, %r15d
testl %r12d, %r12d
jle 0x7102
movq 0x50(%rsp), %rax
movq 0x10(%rax), %r12
addq %r15, %r12
xorl %r13d, %r13d
xorl %ebx, %ebx
movsbl (%r12,%r13), %edi
movl %r13d, %esi
callq 0x68f1
addl %eax, %ebx
incq %r13
cmpq %r13, %r14
jne 0x70e0
testl %ebx, %ebx
movq 0x20(%rsp), %r12
jns 0x7104
jmp 0x7114
xorl %ebx, %ebx
movl %ebx, %eax
movq 0x28(%rsp), %rcx
incq (%rcx,%rax,8)
incq 0x38(%rsp)
incq %r15
cmpq %rbp, %r15
jne 0x70ca
movq 0x8(%rsp), %rdx
incq %rdx
movq 0x18(%rsp), %rcx
cmpq %rcx, %rdx
jne 0x70a8
testl %ecx, %ecx
movq 0x30(%rsp), %rbx
jle 0x7269
xorps %xmm0, %xmm0
cvtsi2sdq 0x38(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x70(%rsp)
xorl %edx, %edx
movq 0xa0(%rbx), %rax
movq (%rax,%rdx,8), %rbx
movl 0x8(%rbx), %esi
cmpl 0x20(%rsp), %esi
jle 0x724b
movq %rdx, 0x18(%rsp)
xorl %r15d, %r15d
movq 0x20(%rsp), %rcx
testl %ecx, %ecx
jle 0x71bb
movl %esi, 0x50(%rsp)
movq %rbx, %r12
movq 0x10(%rbx), %rbx
addq %r15, %rbx
xorl %r13d, %r13d
xorl %ebp, %ebp
movsbl (%rbx,%r13), %edi
movl %r13d, %esi
callq 0x68f1
addl %eax, %ebp
incq %r13
cmpq %r13, %r14
jne 0x7197
testl %ebp, %ebp
movq %r12, %rbx
jns 0x71bd
movl 0x50(%rsp), %esi
jmp 0x7228
xorl %ebp, %ebp
movl %ebp, %eax
movq 0x28(%rsp), %rcx
xorps %xmm0, %xmm0
cvtsi2sdq (%rcx,%rax,8), %xmm0
divsd 0x8(%rsp), %xmm0
movapd %xmm0, 0x50(%rsp)
callq 0x3290
movq 0x30(%rsp), %rax
movupd 0x10(%rax), %xmm1
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
addpd %xmm1, %xmm0
movupd %xmm0, 0x10(%rax)
movsd 0x20(%rax), %xmm0
addsd 0x1682e(%rip), %xmm0    # 0x1da30
movsd %xmm0, 0x20(%rax)
movapd 0x16901(%rip), %xmm0    # 0x1db10
unpcklpd 0x50(%rsp), %xmm0       # xmm0 = xmm0[0],mem[0]
movapd 0x70(%rsp), %xmm1
addpd %xmm0, %xmm1
movapd %xmm1, 0x70(%rsp)
movl 0x8(%rbx), %esi
incq %r15
movl %esi, %eax
movq 0x20(%rsp), %rcx
subl %ecx, %eax
cltq
cmpq %rax, %r15
jl 0x7180
movq 0x30(%rsp), %rax
movl (%rax), %ecx
movq 0x18(%rsp), %rdx
incq %rdx
movslq %ecx, %rax
cmpq %rax, %rdx
movq 0x30(%rsp), %rbx
jl 0x715b
movq 0x20(%rsp), %r12
jmp 0x6a13
movq 0x28(%rsp), %rdi
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3070
leaq 0x1adfd(%rip), %rdi     # 0x22088
leaq 0x1aad3(%rip), %rsi     # 0x21d65
leaq 0x1ae3a(%rip), %rcx     # 0x220d3
movl $0x3ec, %edx            # imm = 0x3EC
callq 0x3230