// File: /workspace/github_cpp_makefile_star2_O1/CominLab[P]QCluster/em.cc
// Function: hard_em(int, int, int, double**, double**, double*, double**, double*, int, double**, int*, double*, int, char, int)
int hard_em(int K, int N, int row_length, double** data, 
		double **quality, double *expected_qual, double **quality_1, double *expected_freq,
		int num_nt, double** data_1, int* assignment, double *Z, 
		int num_trials, char dist_type, int verbose)
{
	// Allocate matrices for centroids, distances, assignment and the 
	// vector for the number of members
	double**  centroids = new double*[K];
	centroids[0] = new double[row_length*K];
	for(int k=1; k<K; ++k) {
		centroids[k] = centroids[0] + k*row_length;
	} // K*row_length matrix for centroid locations

	double**  centroids_tilde = new double*[K];
	centroids_tilde[0] = new double[row_length*K];
	for(int k=1; k<K; ++k) {
		centroids_tilde[k] = centroids_tilde[0] + k*row_length;
	} // K*row_length matrix for X_tilde vars for centroids

	int* tmp_assignment = new int[N];
	int *numMembers = new int[K];  // number of members in each cluster
	double** tmp_data = new double*[N];
	double** tmp_data_1 = new double*[N];

	// call clustering routine
	double min_distortion = 0;
	for (int t=0; t<num_trials; t++) {
		if (verbose > 0) {
			cerr<<"Calling EM routine, attempt "<<t+1<<endl;
		}
		double distortion =	em_routine(K, N, row_length, data, quality, 
				expected_qual, quality_1, expected_freq, num_nt, data_1,
				tmp_assignment, numMembers, centroids, centroids_tilde,
				tmp_data, tmp_data_1, dist_type, verbose);
		if (verbose > 0) {
			cerr<<"Resulting distortion: "<<distortion<<endl;
		}
		if (!t || (distortion < min_distortion)) {
			if (verbose > 0) {
				cerr<<"Updating best partitioning and minimal distortion"<<endl;
			}
			min_distortion = distortion;
			memcpy(assignment, tmp_assignment, N*sizeof(*assignment));
		}
	}
	if (verbose > 0) {
		cerr<<"Resulting minimal distortion: "<<min_distortion<<endl;
	}
	//evaluate confidence if using KL with raw counts
	if (dist_type == 'k') {
		eval_confidence(K, N, row_length, data, centroids, Z, quality, expected_qual, expected_freq);
	}
	// delete allocated arrays
	delete[] centroids[0];
	delete[] centroids;
	delete[] centroids_tilde[0];
	delete[] centroids_tilde;
	delete[] numMembers;
	delete[] tmp_data;
	delete[] tmp_data_1;
	delete[] tmp_assignment;

	// return the number of clusters
	return count_num_clusters(N, assignment);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movq %r9, 0x60(%rsp)
movq %r8, 0x68(%rsp)
movq %rcx, 0x20(%rsp)
movl %edx, %r15d
movl %esi, 0x4(%rsp)
movl %edi, %ebp
movslq %edi, %r13
leaq (,%r13,8), %rbx
testl %r13d, %r13d
movq $-0x1, %r14
movq %rbx, 0xd8(%rsp)
cmovsq %r14, %rbx
movq %rbx, %rdi
callq 0x2030
movq %rax, %r12
movl %r15d, %eax
imull %ebp, %eax
cltq
leaq (,%rax,8), %rdi
testl %eax, %eax
cmovsq %r14, %rdi
movq %rdi, 0x28(%rsp)
callq 0x2030
movq %rax, (%r12)
movl %r15d, 0x1c(%rsp)
movslq %r15d, %r14
movl %ebp, 0x8(%rsp)
movl %ebp, %esi
movq %r13, 0x80(%rsp)
cmpl $0x2, %r13d
jl 0x40fb
leaq (,%r14,8), %rcx
leaq (%rax,%r14,8), %rax
movl $0x1, %edx
movq %rax, (%r12,%rdx,8)
incq %rdx
addq %rcx, %rax
cmpq %rdx, %rsi
jne 0x40ec
movq %r12, 0x40(%rsp)
movq %rsi, %r13
movq %rbx, %rdi
callq 0x2030
movq %rax, %rbx
movq 0x28(%rsp), %rdi
callq 0x2030
movq %rax, (%rbx)
movl 0x8(%rsp), %eax
movl %eax, %r12d
cmpl $0x2, %eax
jl 0x414b
movq %r13, %rsi
shlq $0x3, %r14
movl $0x1, %eax
movq %r14, %rcx
movq (%rbx), %rdx
addq %rcx, %rdx
movq %rdx, (%rbx,%rax,8)
incq %rax
addq %r14, %rcx
cmpq %rax, %rsi
jne 0x4136
movq %rbx, 0x58(%rsp)
movl 0x4(%rsp), %r15d
movslq %r15d, %rax
leaq (,%rax,4), %rdi
testl %eax, %eax
movq $-0x1, %rcx
movq %rdi, 0xb8(%rsp)
cmovsq %rcx, %rdi
leaq (,%rax,8), %rbx
cmovsq %rcx, %rbx
movq $-0x1, %rbp
callq 0x2030
movq %rax, 0x10(%rsp)
movq 0x80(%rsp), %rax
leaq (,%rax,4), %rax
movl %r12d, %r14d
testl %r12d, %r12d
movq %rax, 0xc8(%rsp)
cmovnsq %rax, %rbp
movq %rbp, %rdi
callq 0x2030
movq %rax, 0x30(%rsp)
movq %rbx, %rdi
callq 0x2030
movq %rax, 0xc0(%rsp)
movq %rbx, 0xe0(%rsp)
movq %rbx, %rdi
callq 0x2030
movq %rax, 0xa8(%rsp)
movl %r15d, %ebx
cmpl $0x0, 0x150(%rsp)
movq %rbx, 0x38(%rsp)
movq %r13, 0x48(%rsp)
jle 0x4b7e
testl %r14d, %r14d
setg 0xf(%rsp)
xorpd %xmm0, %xmm0
movsd %xmm0, 0x70(%rsp)
movq $0x0, 0x78(%rsp)
movsbl 0x158(%rsp), %eax
movl %eax, 0xb0(%rsp)
movq %r13, %rdi
movl %r14d, %r9d
movl %r9d, %ebp
movq %rdi, %r14
movl %r15d, %ebx
cmpl $0x0, 0x160(%rsp)
jle 0x429c
movl $0x1c, %edx
movq 0x7d9d(%rip), %r15      # 0xbff0
movq %r15, %rdi
leaq 0x48d3(%rip), %rsi      # 0x8b30
callq 0x2240
movq 0x78(%rsp), %rax
leal 0x1(%rax), %esi
movq %r15, %rdi
callq 0x2310
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x21e0
movsbl %al, %esi
movq %r15, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2140
movq 0xe0(%rsp), %r15
movq %r15, %rdi
callq 0x2030
movq %rax, 0x50(%rsp)
movq %r15, %rdi
callq 0x2030
movq %rax, 0x90(%rsp)
movq $0x0, 0xa0(%rsp)
movl %ebx, %edi
callq 0x3eb4
movl 0xb0(%rsp), %eax
cmpl $0x63, %eax
movl 0x1c(%rsp), %r13d
jle 0x430d
cmpl $0x64, %eax
movq 0x10(%rsp), %rdx
movq %r14, %rdi
movl %ebp, %r9d
je 0x4345
cmpl $0x6b, %eax
movq 0x30(%rsp), %r14
je 0x435a
cmpl $0x73, %eax
jne 0x436a
leaq 0xc42(%rip), %rsi       # 0x4f4d
jmp 0x4361
leaq 0xdc2(%rip), %rsi       # 0x50d6
leaq 0x1249(%rip), %rcx      # 0x5564
cmpl $0x61, %eax
movq 0x10(%rsp), %rdx
movq %r14, %rdi
movl %ebp, %r9d
movq 0x30(%rsp), %r14
je 0x4378
cmpl $0x63, %eax
jne 0x436a
leaq 0xd4a(%rip), %rsi       # 0x5086
leaq 0x10ee(%rip), %rcx      # 0x5431
jmp 0x4378
leaq 0xcb8(%rip), %rsi       # 0x5004
leaq 0xf95(%rip), %rcx       # 0x52e8
movq 0x30(%rsp), %r14
jmp 0x4378
leaq 0xb57(%rip), %rsi       # 0x4eb8
leaq 0x1036(%rip), %rcx      # 0x539e
jmp 0x4378
leaq 0xb1b(%rip), %rsi       # 0x4e8c
leaq 0xeec(%rip), %rcx       # 0x5264
movq %rcx, 0xd0(%rsp)
movq %rsi, 0x98(%rsp)
movl %r9d, %r15d
movq %rdi, %rbp
cmpl $0x0, 0x160(%rsp)
jle 0x43e5
movl $0x29, %edx
movq %r14, %r12
movq 0x7c49(%rip), %r14      # 0xbff0
movq %r14, %rdi
leaq 0x4804(%rip), %rsi      # 0x8bb5
callq 0x2240
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21e0
movsbl %al, %esi
movq %r14, %rdi
movq %r12, %r14
callq 0x2040
movq %rax, %rdi
callq 0x2140
movq 0x10(%rsp), %rdx
movq %rdx, %rdi
xorl %esi, %esi
movq 0xb8(%rsp), %rdx
callq 0x2130
movq %r14, %rdi
movl $0xff, %esi
movq 0xc8(%rsp), %rdx
callq 0x2130
testl %r15d, %r15d
movq 0x60(%rsp), %r12
movq 0xd0(%rsp), %r15
jle 0x449d
movq %rbp, %r14
xorl %ebx, %ebx
callq 0x20a0
cltd
idivl 0x4(%rsp)
movslq %edx, %rax
movq 0x20(%rsp), %rcx
leaq (%rcx,%rax,8), %rdx
movq 0x138(%rsp), %rcx
leaq (%rcx,%rax,8), %r8
movq 0x40(%rsp), %rcx
movq (%rcx,%rbx,8), %r9
movq 0x68(%rsp), %rcx
leaq (%rcx,%rax,8), %r10
movq 0x120(%rsp), %rcx
leaq (%rcx,%rax,8), %rax
subq $0x8, %rsp
movl $0x1, %edi
movl 0x24(%rsp), %esi
movl 0x138(%rsp), %ecx
pushq 0x130(%rsp)
pushq %rax
pushq %r12
pushq %r10
movq 0x80(%rsp), %rax
pushq (%rax,%rbx,8)
callq *%r15
addq $0x30, %rsp
incq %rbx
cmpq %rbx, %r14
jne 0x4423
movq 0x20(%rsp), %rsi
movl 0x8(%rsp), %r9d
movq 0x38(%rsp), %rbx
movl 0x4(%rsp), %r15d
testl %r15d, %r15d
jle 0x458b
xorl %r14d, %r14d
xorl %r15d, %r15d
testl %r9d, %r9d
jle 0x4553
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
xorl %ebx, %ebx
movsd 0x462f(%rip), %xmm0     # 0x8b08
movsd %xmm0, 0x28(%rsp)
movq 0x40(%rsp), %rax
movq (%rax,%rbx,8), %rdi
movq (%rsi,%r14,8), %rsi
movq 0x58(%rsp), %rax
movq (%rax,%rbx,8), %rcx
movq 0x68(%rsp), %rax
movq (%rax,%r14,8), %r8
subq $0x8, %rsp
movl %r13d, %edx
movq 0x68(%rsp), %r9
pushq 0x130(%rsp)
callq *0xa8(%rsp)
movsd 0x38(%rsp), %xmm1
addq $0x10, %rsp
cmpl $-0x1, %r12d
sete %al
ucomisd %xmm0, %xmm1
seta %cl
orb %al, %cl
movl %ebx, %eax
testb %cl, %cl
jne 0x453b
movl %r12d, %eax
jne 0x4541
movapd %xmm1, %xmm0
incq %rbx
movl %eax, %r12d
cmpq %rbx, %rbp
movq 0x20(%rsp), %rsi
jne 0x44d9
jmp 0x4558
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movb $0x1, %dl
testb $0x1, %r15b
movq 0x10(%rsp), %rcx
jne 0x456c
cmpl %eax, (%rcx,%r14,4)
setne %dl
movl %eax, (%rcx,%r14,4)
incq %r14
movl %edx, %r15d
movq 0x38(%rsp), %rbx
cmpq %rbx, %r14
movl 0x8(%rsp), %r9d
jne 0x44c0
jmp 0x458d
xorl %edx, %edx
movl %edx, 0xb4(%rsp)
movl %r9d, %r12d
movq 0x30(%rsp), %r14
movq %r14, %rdi
xorl %esi, %esi
movq 0xc8(%rsp), %rdx
callq 0x2130
movq 0x10(%rsp), %rdx
movl 0x4(%rsp), %r15d
testl %r15d, %r15d
movq %rbp, %rdi
jle 0x45d2
xorl %eax, %eax
movslq (%rdx,%rax,4), %rcx
incl (%r14,%rcx,4)
incq %rax
cmpq %rax, %rbx
jne 0x45c2
movl $0x13, %r8d
movl %r12d, %r9d
testl %r12d, %r12d
jle 0x4618
cmpl $0x0, (%r14)
movq 0x20(%rsp), %rsi
je 0x4627
movl $0x1, %eax
cmpq %rax, %rdi
je 0x46ae
leaq 0x1(%rax), %rcx
cmpl $0x0, (%r14,%rax,4)
movq %rcx, %rax
jne 0x45f0
decq %rcx
cmpq 0x80(%rsp), %rcx
setl %r14b
jmp 0x462a
movb 0xf(%rsp), %r14b
movq 0x20(%rsp), %rsi
jmp 0x46ba
movb $0x1, %r14b
cmpl $0x0, 0x160(%rsp)
jle 0x4676
movl $0x1a, %edx
movq 0x79b0(%rip), %r15      # 0xbff0
movq %r15, %rdi
leaq 0x4595(%rip), %rsi      # 0x8bdf
callq 0x2240
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x21e0
movsbl %al, %esi
movq %r15, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2140
movq 0x7b7b(%rip), %rdi      # 0xc1f8
testq %rdi, %rdi
je 0x4687
callq 0x2270
movl 0x4(%rsp), %r15d
movl %r15d, %edi
callq 0x3eb4
movl $0x4, %r8d
movq 0x20(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq 0x48(%rsp), %rdi
movl %r12d, %r9d
jmp 0x46ba
cmpq 0x80(%rsp), %rax
setl %r14b
testb %r14b, %r14b
je 0x46c9
movq 0x30(%rsp), %r14
jmp 0x4a30
movq $0x0, 0xa0(%rsp)
xorpd %xmm0, %xmm0
testl %r15d, %r15d
jle 0x4759
xorl %ebx, %ebx
movq 0x60(%rsp), %r14
movq 0x98(%rsp), %r12
movq 0x40(%rsp), %r15
movsd %xmm0, 0x28(%rsp)
movslq (%rdx,%rbx,4), %rax
movq (%r15,%rax,8), %rdi
movq 0x20(%rsp), %rcx
movq (%rcx,%rbx,8), %rsi
movq 0x58(%rsp), %rcx
movq (%rcx,%rax,8), %rcx
movq 0x68(%rsp), %rax
movq (%rax,%rbx,8), %r8
subq $0x8, %rsp
movl 0x24(%rsp), %edx
movq %r14, %r9
pushq 0x130(%rsp)
callq *%r12
movq 0x20(%rsp), %rdx
addq $0x10, %rsp
movsd 0x28(%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x28(%rsp)
movsd 0x28(%rsp), %xmm0
incq %rbx
cmpq %rbx, 0x38(%rsp)
jne 0x46f2
movsd %xmm0, 0xa0(%rsp)
cmpb $0x0, 0xb4(%rsp)
je 0x4851
movl 0x4(%rsp), %edi
leaq 0xa0(%rsp), %rcx
callq 0x3f21
testb %al, %al
movl 0x8(%rsp), %r9d
movq 0x38(%rsp), %rbx
movq 0x30(%rsp), %r14
movq 0xc0(%rsp), %r15
je 0x490c
movl %r9d, %r12d
cmpl $0x0, 0x160(%rsp)
jle 0x47f5
movl $0x1f, %edx
movq %r14, %r15
movq 0x7834(%rip), %r14      # 0xbff0
movq %r14, %rdi
leaq 0x4452(%rip), %rsi      # 0x8c18
callq 0x2240
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21e0
movsbl %al, %esi
movq %r14, %rdi
movq %r15, %r14
callq 0x2040
movq %rax, %rdi
callq 0x2140
movq 0x79fc(%rip), %rdi      # 0xc1f8
testq %rdi, %rdi
je 0x4806
callq 0x2270
movq 0x50(%rsp), %rdi
callq 0x2270
movq 0x90(%rsp), %rdi
callq 0x2270
movl $0x1, %r8d
movsd 0xa0(%rsp), %xmm0
movsd %xmm0, 0x88(%rsp)
movq 0x20(%rsp), %rsi
movl 0x4(%rsp), %r15d
movq 0x10(%rsp), %rdx
movq 0x48(%rsp), %rdi
movl %r12d, %r9d
jmp 0x4a30
movsd %xmm0, 0x28(%rsp)
cmpl $0x0, 0x160(%rsp)
movq 0x38(%rsp), %rbx
movq %rbp, %r14
movq 0x30(%rsp), %r12
jle 0x48b0
movl $0x1d, %edx
movq 0x7776(%rip), %r15      # 0xbff0
movq %r15, %rdi
leaq 0x4376(%rip), %rsi      # 0x8bfa
callq 0x2240
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x21e0
movsbl %al, %esi
movq %r15, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2140
movq 0x7941(%rip), %rdi      # 0xc1f8
testq %rdi, %rdi
je 0x48c1
callq 0x2270
movq 0x50(%rsp), %rdi
callq 0x2270
movq 0x90(%rsp), %rdi
callq 0x2270
movl $0x1, %r8d
movsd 0x28(%rsp), %xmm0
movsd %xmm0, 0x88(%rsp)
movq 0x20(%rsp), %rsi
movl 0x4(%rsp), %r15d
movq 0x10(%rsp), %rdx
movq %r14, %rdi
movl 0x8(%rsp), %r9d
movq %r12, %r14
jmp 0x4a30
testl %r9d, %r9d
movq 0x20(%rsp), %rsi
movq 0xa8(%rsp), %r8
movq 0x138(%rsp), %r10
movq 0x120(%rsp), %r11
jle 0x4a20
xorl %r14d, %r14d
movq 0x10(%rsp), %rdx
movl $0x0, %edi
cmpl $0x0, 0x4(%rsp)
movq 0x68(%rsp), %r9
jle 0x4991
xorl %eax, %eax
xorl %edi, %edi
movl (%rdx,%rax,4), %ecx
cmpq %rcx, %r14
jne 0x4989
movq (%rsi,%rax,8), %rcx
movslq %edi, %rdi
movq %rcx, (%r15,%rdi,8)
movq (%r10,%rax,8), %rcx
movq %rcx, (%r8,%rdi,8)
movq (%r9,%rax,8), %rcx
movq 0x50(%rsp), %r12
movq %rcx, (%r12,%rdi,8)
movq (%r11,%rax,8), %rcx
movq 0x90(%rsp), %r12
movq %rcx, (%r12,%rdi,8)
incl %edi
incq %rax
cmpq %rax, %rbx
jne 0x494f
movq 0x40(%rsp), %rax
movq (%rax,%r14,8), %r9
subq $0x8, %rsp
movl 0x24(%rsp), %esi
movq %r15, %rdx
movl 0x138(%rsp), %ecx
pushq 0x130(%rsp)
pushq 0xa0(%rsp)
pushq 0x78(%rsp)
pushq 0x70(%rsp)
movq 0x80(%rsp), %rax
pushq (%rax,%r14,8)
callq *0x100(%rsp)
movq 0x150(%rsp), %r11
movq 0x168(%rsp), %r10
movq 0xd8(%rsp), %r8
movq 0x40(%rsp), %rdx
movq 0x50(%rsp), %rsi
addq $0x30, %rsp
incq %r14
movq 0x48(%rsp), %rdi
cmpq %rdi, %r14
jne 0x493a
movl 0x4(%rsp), %r15d
movq 0x30(%rsp), %r14
movl 0x8(%rsp), %r9d
xorl %r8d, %r8d
jmp 0x4a30
movq %rbp, %rdi
xorl %r8d, %r8d
movl 0x4(%rsp), %r15d
movq 0x10(%rsp), %rdx
testl %r8d, %r8d
je 0x44b1
cmpl $0x4, %r8d
jne 0x4a49
movl 0x1c(%rsp), %r13d
jmp 0x4388
cmpl $0x0, 0x160(%rsp)
jle 0x4ab5
movl $0x16, %edx
movq %rdi, %r14
movq 0x758e(%rip), %r13      # 0xbff0
movq %r13, %rdi
leaq 0x40e1(%rip), %rsi      # 0x8b4d
movl %r9d, %ebp
callq 0x2240
movq %r13, %rdi
movsd 0x88(%rsp), %xmm0
callq 0x22d0
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x21e0
movsbl %al, %esi
movq %r13, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2140
movl %ebp, %r9d
movq %r14, %rdi
cmpl $0x0, 0x78(%rsp)
movb 0x158(%rsp), %r13b
je 0x4ad9
movsd 0x70(%rsp), %xmm0
ucomisd 0x88(%rsp), %xmm0
jbe 0x4b63
movl %r9d, %r12d
movq %rdi, %r14
cmpl $0x0, 0x160(%rsp)
jle 0x4b34
movl $0x31, %edx
movq 0x74fb(%rip), %r13      # 0xbff0
movq %r13, %rdi
leaq 0x4065(%rip), %rsi      # 0x8b64
callq 0x2240
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x21e0
movsbl %al, %esi
movq %r13, %rdi
movb 0x158(%rsp), %r13b
callq 0x2040
movq %rax, %rdi
callq 0x2140
movq 0x140(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq 0xb8(%rsp), %rdx
callq 0x2190
movsd 0x88(%rsp), %xmm0
movsd %xmm0, 0x70(%rsp)
movq %r14, %rdi
movl %r12d, %r9d
movq 0x78(%rsp), %rax
incl %eax
movq %rax, 0x78(%rsp)
cmpl 0x150(%rsp), %eax
jne 0x4234
jmp 0x4b96
xorpd %xmm0, %xmm0
movsd %xmm0, 0x70(%rsp)
movq %r13, %rdi
movl %r14d, %r9d
movb 0x158(%rsp), %r13b
cmpl $0x0, 0x160(%rsp)
jle 0x4bfe
movq 0x7449(%rip), %r12      # 0xbff0
leaq 0x3fe8(%rip), %rsi      # 0x8b96
movl $0x1e, %edx
movq %r12, %rdi
movl %r9d, %r14d
callq 0x2240
movq %r12, %rdi
movsd 0x70(%rsp), %xmm0
callq 0x22d0
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x21e0
movsbl %al, %esi
movq %r12, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2140
movl %r14d, %r9d
movq 0x48(%rsp), %rdi
cmpb $0x6b, %r13b
setne %al
testl %r15d, %r15d
setle %cl
orb %al, %cl
jne 0x4d86
movq 0x148(%rsp), %rbp
xorl %r12d, %r12d
movl 0x1c(%rsp), %r13d
testl %r9d, %r9d
movq 0x68(%rsp), %r14
movq %r12, %rdx
movq 0x60(%rsp), %r9
movq 0x40(%rsp), %rax
movq 0x128(%rsp), %r15
jle 0x4c91
xorl %ebx, %ebx
movq %rdx, 0x28(%rsp)
movq (%rax,%rbx,8), %rdi
movq 0x20(%rsp), %rax
movq (%rax,%rdx,8), %rsi
movq (%r14,%rdx,8), %r8
subq $0x8, %rsp
movl %r13d, %edx
xorl %ecx, %ecx
movq %r9, %r12
pushq %r15
callq 0x4eb8
movq 0x38(%rsp), %rdx
movq 0x50(%rsp), %rax
movq %r12, %r9
movq 0x58(%rsp), %rdi
addq $0x10, %rsp
movsd %xmm0, (%rbp,%rbx,8)
incq %rbx
cmpq %rbx, %rdi
jne 0x4c49
movq %rdx, %rax
imulq 0x80(%rsp), %rax
movq 0x148(%rsp), %rcx
movsd (%rcx,%rax,8), %xmm0
movl 0x8(%rsp), %r9d
cmpl $0x2, %r9d
movq %rdx, %r12
jl 0x4cd5
movl $0x1, %eax
movsd (%rbp,%rax,8), %xmm3
minsd %xmm0, %xmm3
incq %rax
movapd %xmm3, %xmm0
cmpq %rax, %rdi
jne 0x4cbd
jmp 0x4cd9
movapd %xmm0, %xmm3
xorpd %xmm2, %xmm2
testl %r9d, %r9d
jle 0x4d4e
xorl %ebx, %ebx
movsd %xmm3, 0x50(%rsp)
movsd (%rbp,%rbx,8), %xmm0
subsd %xmm3, %xmm0
movsd %xmm0, (%rbp,%rbx,8)
ucomisd 0x3e0e(%rip), %xmm0     # 0x8b10
xorpd %xmm1, %xmm1
ja 0x4d3c
xorpd 0x3e10(%rip), %xmm0     # 0x8b20
movl %r9d, %r14d
movsd %xmm2, 0x98(%rsp)
callq 0x2340
movsd 0x50(%rsp), %xmm3
movsd 0x98(%rsp), %xmm2
movl %r14d, %r9d
movq 0x48(%rsp), %rdi
movapd %xmm0, %xmm1
movsd %xmm1, (%rbp,%rbx,8)
addsd %xmm1, %xmm2
incq %rbx
cmpq %rbx, %rdi
jne 0x4cea
testl %r9d, %r9d
jle 0x4d6d
xorl %eax, %eax
movsd (%rbp,%rax,8), %xmm0
divsd %xmm2, %xmm0
movsd %xmm0, (%rbp,%rax,8)
incq %rax
cmpq %rax, %rdi
jne 0x4d55
incq %r12
addq 0xd8(%rsp), %rbp
movq 0x38(%rsp), %rbx
cmpq %rbx, %r12
jne 0x4c23
movq 0x40(%rsp), %r14
movq (%r14), %rdi
testq %rdi, %rdi
je 0x4d98
callq 0x2270
movq %r14, %rdi
callq 0x2270
movq 0x58(%rsp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
movq 0x140(%rsp), %r13
je 0x4dba
callq 0x2270
movq 0x58(%rsp), %rdi
callq 0x2270
movq 0x30(%rsp), %rdi
callq 0x2270
movq 0xc0(%rsp), %rdi
callq 0x2270
movq 0xa8(%rsp), %rdi
callq 0x2270
movq 0x10(%rsp), %rdi
callq 0x2270
cmpl $0x0, 0x4(%rsp)
jle 0x4e17
xorl %eax, %eax
xorl %r12d, %r12d
movl (%r13,%rax,4), %ecx
cmpl %r12d, %ecx
cmovgl %ecx, %r12d
incq %rax
cmpq %rax, %rbx
jne 0x4dfe
incl %r12d
jmp 0x4e1d
movl $0x1, %r12d
leaq (,%r12,4), %r15
movq %r15, %rdi
callq 0x2030
movq %rax, %r14
xorl %ebx, %ebx
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x2130
cmpl $0x0, 0x4(%rsp)
movq 0x38(%rsp), %rdx
jle 0x4e62
xorl %eax, %eax
movslq (%r13,%rax,4), %rcx
movl $0x1, (%r14,%rcx,4)
incq %rax
cmpq %rax, %rdx
jne 0x4e4d
xorl %eax, %eax
addl (%r14,%rax,4), %ebx
incq %rax
cmpq %rax, %r12
jne 0x4e64
movq %r14, %rdi
callq 0x2270
movl %ebx, %eax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq