// File: abaheti95[P]HMM-LDA/Models/cpp_hmm_lda/model.cpp
// Function: HMMLDA::draw_class(int, int, int)
void HMMLDA::draw_class(int document_idx, int word_idx, int doc_size) {
	int old_class = class_assignments[document_idx][word_idx];
	int old_topic = topic_assignments[document_idx][word_idx];
	int word = documents[document_idx][word_idx];
	if(word == start_word_id || word == end_word_id) 
		return;
	// Get neighboring classes
	int previous = -1;
	if(word_idx > 0)
		previous = class_assignments[document_idx][word_idx - 1];
	int future = -1;
	if(word_idx < doc_size-1)
		future = class_assignments[document_idx][word_idx + 1];

	// Remove current word from transition counts
	if(previous != -1)
		num_transitions[previous][old_class]--;
	if(future != -1)
		num_transitions[old_class][future]--;
	if(old_class == 0) {
		// Remove word from topic counts
		num_same_words_assigned_to_topic[word][old_topic]--;
		num_words_assigned_to_topic[old_topic]--;
		num_words_in_doc_assigned_to_topic[document_idx][old_topic]--;
	}
	// Remove the word from class counts
	num_same_words_assigned_to_class[word][old_class]--;
	num_words_assigned_to_class[old_class]--;

	// Build first term of numerator
	vector<double> term_1(num_classes, 0.0);
	if(previous != -1) {
		for(int i = 0; i < num_classes; i++)
			term_1[i] = num_transitions[previous][i];
	}
	//Smoothing
	for(int i = 0; i < num_classes; i++)
		term_1[i] += gamma;

	// Build second term of numerator
	vector<double> term_2(num_classes, 0.0);
	if(future != -1) {
		for(int i = 0; i < num_classes; i++)
			term_2[i] = num_transitions[i][future];
	}
	//Smoothing
	for(int i = 0; i < num_classes; i++)
		term_2[i] += gamma;
	// Adjusting for the itentity value in the numerator term 2
	if(previous != -1 && future != -1 && (previous == future))
		term_2[previous] += 1.0;

	// Calculate numerator
	vector<double> numerator(num_classes, 0.0);
	for(int i = 0; i < num_classes; i++)
		numerator[i] = term_1[i] * term_2[i];

	// Build denominator
	vector<double> denominator(num_words_assigned_to_class.begin(), num_words_assigned_to_class.end());
	if(previous != -1)
		denominator[previous] += 1.0;
	for(int i = 0; i < num_classes; i++)
		denominator[i] += num_classes * gamma;
	
	// Calculate multiplier
	
	// Initialize numerator of multiplier with same word class/topic counts
	vector<double> multiplier_numerator(num_same_words_assigned_to_class[word].begin(), 
		num_same_words_assigned_to_class[word].end());
	multiplier_numerator[0] = num_same_words_assigned_to_topic[word][old_topic];
	
	// Smoothing
	for(int i = 0; i < num_classes; i++) {
		if(i == 0)
			multiplier_numerator[0] += beta;
		else
			multiplier_numerator[i] += delta;
	}

	// Initialize denominator of multiplier with global class/topic counts
	vector<double> multiplier_denominator(num_words_assigned_to_class.begin(), num_words_assigned_to_class.end());
	multiplier_denominator[0] = num_words_assigned_to_topic[old_topic];
	
	// Smoothing
	for(int i = 0; i < num_classes; i++) {
		if(i == 0)
			multiplier_denominator[0] += beta * vocab_size;
		else
			multiplier_denominator[i] += delta * vocab_size;
	}

	// Calculate probability proportions
	vector<double> proportions(num_classes, 0.0);
	for(int i = 0; i < num_classes; i++) {
		proportions[i] = (multiplier_numerator[i] / multiplier_denominator[i]) * numerator[i] / denominator[i];
	}
	// Draw class
	// logging.info('proportions = %s', proportions)
	int new_class = categorical(proportions);
	// if(document_idx == 0) {
	// 	if(new_class == 0) {
	// 		cout << "Printing proportions for class sampling" << document_idx << " " << word_idx << endl;
	// 		print_vector<double>(proportions);
	// 		print_vector<double>(numerator);
	// 		print_vector<double>(multiplier_numerator);
	// 		cout << old_class << " New class chosen " << new_class << endl;
	// 		cout << alpha << " " << beta << " " << gamma << " " << delta << endl; 
	// 	}
	// }
	// logging.info('drew class %d', new_class)
	class_assignments[document_idx][word_idx] = new_class;

	// Restore counts counts
	if(previous != -1) {
		num_transitions[previous][new_class] += 1;
	}
	if(future != -1) {
		num_transitions[new_class][future] += 1;
	}
	if(new_class == 0) {
		// Add word to the topic counts
		num_words_in_doc_assigned_to_topic[document_idx][old_topic] += 1;
		num_same_words_assigned_to_topic[word][old_topic] += 1;
		num_words_assigned_to_topic[old_topic] += 1;
	}
	// Add word to the new class counts
	num_same_words_assigned_to_class[word][new_class] += 1;
	num_words_assigned_to_class[new_class] += 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2c0, %rsp            # imm = 0x2C0
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x1a0(%rbp)
addq $0xd8, %rdi
movslq -0xc(%rbp), %rsi
callq 0x8c10
movq %rax, %rdi
movslq -0x10(%rbp), %rsi
callq 0x8f60
movq -0x1a0(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x18(%rbp)
addq $0xc0, %rdi
movslq -0xc(%rbp), %rsi
callq 0x8c10
movq %rax, %rdi
movslq -0x10(%rbp), %rsi
callq 0x8f60
movq -0x1a0(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x1c(%rbp)
addq $0xa8, %rdi
movslq -0xc(%rbp), %rsi
callq 0x8c10
movq %rax, %rdi
movslq -0x10(%rbp), %rsi
callq 0x8f60
movq -0x1a0(%rbp), %rcx
movl (%rax), %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl 0x8(%rcx), %eax
je 0x55e2
movq -0x1a0(%rbp), %rcx
movl -0x20(%rbp), %eax
cmpl 0xc(%rcx), %eax
jne 0x55e7
jmp 0x6379
movl $0xffffffff, -0x24(%rbp) # imm = 0xFFFFFFFF
cmpl $0x0, -0x10(%rbp)
jle 0x5621
movq -0x1a0(%rbp), %rdi
addq $0xd8, %rdi
movslq -0xc(%rbp), %rsi
callq 0x8c10
movq %rax, %rdi
movl -0x10(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x8f60
movl (%rax), %eax
movl %eax, -0x24(%rbp)
movl $0xffffffff, -0x28(%rbp) # imm = 0xFFFFFFFF
movl -0x10(%rbp), %eax
movl -0x14(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x5662
movq -0x1a0(%rbp), %rdi
addq $0xd8, %rdi
movslq -0xc(%rbp), %rsi
callq 0x8c10
movq %rax, %rdi
movl -0x10(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0x8f60
movl (%rax), %eax
movl %eax, -0x28(%rbp)
cmpl $-0x1, -0x24(%rbp)
je 0x5692
movq -0x1a0(%rbp), %rdi
addq $0x138, %rdi            # imm = 0x138
movslq -0x24(%rbp), %rsi
callq 0x8c10
movq %rax, %rdi
movslq -0x18(%rbp), %rsi
callq 0x8f60
movl (%rax), %ecx
addl $-0x1, %ecx
movl %ecx, (%rax)
cmpl $-0x1, -0x28(%rbp)
je 0x56c2
movq -0x1a0(%rbp), %rdi
addq $0x138, %rdi            # imm = 0x138
movslq -0x18(%rbp), %rsi
callq 0x8c10
movq %rax, %rdi
movslq -0x28(%rbp), %rsi
callq 0x8f60
movl (%rax), %ecx
addl $-0x1, %ecx
movl %ecx, (%rax)
cmpl $0x0, -0x18(%rbp)
jne 0x573a
movq -0x1a0(%rbp), %rdi
addq $0x108, %rdi            # imm = 0x108
movslq -0x20(%rbp), %rsi
callq 0x8c10
movq %rax, %rdi
movslq -0x1c(%rbp), %rsi
callq 0x8f60
movq -0x1a0(%rbp), %rdi
movl (%rax), %ecx
addl $-0x1, %ecx
movl %ecx, (%rax)
addq $0x150, %rdi            # imm = 0x150
movslq -0x1c(%rbp), %rsi
callq 0x8f60
movq -0x1a0(%rbp), %rdi
movl (%rax), %ecx
addl $-0x1, %ecx
movl %ecx, (%rax)
addq $0xf0, %rdi
movslq -0xc(%rbp), %rsi
callq 0x8c10
movq %rax, %rdi
movslq -0x1c(%rbp), %rsi
callq 0x8f60
movl (%rax), %ecx
addl $-0x1, %ecx
movl %ecx, (%rax)
movq -0x1a0(%rbp), %rdi
addq $0x120, %rdi            # imm = 0x120
movslq -0x20(%rbp), %rsi
callq 0x8c10
movq %rax, %rdi
movslq -0x18(%rbp), %rsi
callq 0x8f60
movq -0x1a0(%rbp), %rdi
movl (%rax), %ecx
decl %ecx
movl %ecx, (%rax)
addq $0x168, %rdi            # imm = 0x168
movslq -0x18(%rbp), %rsi
callq 0x8f60
movq %rax, %rcx
movq -0x1a0(%rbp), %rax
movl (%rcx), %edx
decl %edx
movl %edx, (%rcx)
movslq 0x4(%rax), %rax
movq %rax, -0x1b0(%rbp)
movq $0x0, -0x48(%rbp)
leaq -0x49(%rbp), %rdi
movq %rdi, -0x1a8(%rbp)
callq 0x9100
movq -0x1b0(%rbp), %rsi
movq -0x1a8(%rbp), %rcx
leaq -0x40(%rbp), %rdi
leaq -0x48(%rbp), %rdx
callq 0x9120
jmp 0x57ca
leaq -0x49(%rbp), %rdi
callq 0x91a0
cmpl $-0x1, -0x24(%rbp)
je 0x5862
movl $0x0, -0x60(%rbp)
movq -0x1a0(%rbp), %rcx
movl -0x60(%rbp), %eax
cmpl 0x4(%rcx), %eax
jge 0x5860
movq -0x1a0(%rbp), %rdi
addq $0x138, %rdi            # imm = 0x138
movslq -0x24(%rbp), %rsi
callq 0x8c10
movq %rax, %rdi
movslq -0x60(%rbp), %rsi
callq 0x8f60
cvtsi2sdl (%rax), %xmm0
movsd %xmm0, -0x1b8(%rbp)
movslq -0x60(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0x89a0
movsd -0x1b8(%rbp), %xmm0
movsd %xmm0, (%rax)
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0x57e4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x49(%rbp), %rdi
callq 0x91a0
jmp 0x63d0
jmp 0x5862
movl $0x0, -0x64(%rbp)
movq -0x1a0(%rbp), %rcx
movl -0x64(%rbp), %eax
cmpl 0x4(%rcx), %eax
jge 0x58b4
movq -0x1a0(%rbp), %rax
movsd 0x28(%rax), %xmm0
movsd %xmm0, -0x1c0(%rbp)
movslq -0x64(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0x89a0
movsd -0x1c0(%rbp), %xmm0
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x5869
movq -0x1a0(%rbp), %rax
movslq 0x4(%rax), %rax
movq %rax, -0x1d0(%rbp)
movq $0x0, -0x88(%rbp)
leaq -0x89(%rbp), %rdi
movq %rdi, -0x1c8(%rbp)
callq 0x9100
movq -0x1d0(%rbp), %rsi
movq -0x1c8(%rbp), %rcx
leaq -0x80(%rbp), %rdi
leaq -0x88(%rbp), %rdx
callq 0x9120
jmp 0x5904
leaq -0x89(%rbp), %rdi
callq 0x91a0
cmpl $-0x1, -0x28(%rbp)
je 0x59b4
movl $0x0, -0x90(%rbp)
movq -0x1a0(%rbp), %rcx
movl -0x90(%rbp), %eax
cmpl 0x4(%rcx), %eax
jge 0x59b2
movq -0x1a0(%rbp), %rdi
addq $0x138, %rdi            # imm = 0x138
movslq -0x90(%rbp), %rsi
callq 0x8c10
movq %rax, %rdi
movslq -0x28(%rbp), %rsi
callq 0x8f60
cvtsi2sdl (%rax), %xmm0
movsd %xmm0, -0x1d8(%rbp)
movslq -0x90(%rbp), %rsi
leaq -0x80(%rbp), %rdi
callq 0x89a0
movsd -0x1d8(%rbp), %xmm0
movsd %xmm0, (%rax)
movl -0x90(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x90(%rbp)
jmp 0x5924
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x89(%rbp), %rdi
callq 0x91a0
jmp 0x63c7
jmp 0x59b4
movl $0x0, -0x94(%rbp)
movq -0x1a0(%rbp), %rcx
movl -0x94(%rbp), %eax
cmpl 0x4(%rcx), %eax
jge 0x5a15
movq -0x1a0(%rbp), %rax
movsd 0x28(%rax), %xmm0
movsd %xmm0, -0x1e0(%rbp)
movslq -0x94(%rbp), %rsi
leaq -0x80(%rbp), %rdi
callq 0x89a0
movsd -0x1e0(%rbp), %xmm0
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movl -0x94(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x94(%rbp)
jmp 0x59be
cmpl $-0x1, -0x24(%rbp)
je 0x5a46
cmpl $-0x1, -0x28(%rbp)
je 0x5a46
movl -0x24(%rbp), %eax
cmpl -0x28(%rbp), %eax
jne 0x5a46
movslq -0x24(%rbp), %rsi
leaq -0x80(%rbp), %rdi
callq 0x89a0
movsd 0xc5ca(%rip), %xmm0     # 0x12008
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movq -0x1a0(%rbp), %rax
movslq 0x4(%rax), %rax
movq %rax, -0x1f0(%rbp)
movq $0x0, -0xb8(%rbp)
leaq -0xb9(%rbp), %rdi
movq %rdi, -0x1e8(%rbp)
callq 0x9100
movq -0x1f0(%rbp), %rsi
movq -0x1e8(%rbp), %rcx
leaq -0xb0(%rbp), %rdi
leaq -0xb8(%rbp), %rdx
callq 0x9120
jmp 0x5a99
leaq -0xb9(%rbp), %rdi
callq 0x91a0
movl $0x0, -0xc0(%rbp)
movq -0x1a0(%rbp), %rcx
movl -0xc0(%rbp), %eax
cmpl 0x4(%rcx), %eax
jge 0x5b55
movslq -0xc0(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0x89a0
movsd (%rax), %xmm0
movsd %xmm0, -0x200(%rbp)
movslq -0xc0(%rbp), %rsi
leaq -0x80(%rbp), %rdi
callq 0x89a0
movsd -0x200(%rbp), %xmm0
mulsd (%rax), %xmm0
movsd %xmm0, -0x1f8(%rbp)
movslq -0xc0(%rbp), %rsi
leaq -0xb0(%rbp), %rdi
callq 0x89a0
movsd -0x1f8(%rbp), %xmm0
movsd %xmm0, (%rax)
movl -0xc0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc0(%rbp)
jmp 0x5aaf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0xb9(%rbp), %rdi
callq 0x91a0
jmp 0x63be
movq -0x1a0(%rbp), %rdi
addq $0x168, %rdi            # imm = 0x168
movq %rdi, -0x210(%rbp)
callq 0x91c0
movq -0x210(%rbp), %rdi
movq %rax, -0xe0(%rbp)
callq 0x91f0
movq %rax, -0xe8(%rbp)
leaq -0xe9(%rbp), %rdi
movq %rdi, -0x208(%rbp)
callq 0x9100
movq -0x208(%rbp), %rcx
movq -0xe0(%rbp), %rsi
movq -0xe8(%rbp), %rdx
leaq -0xd8(%rbp), %rdi
callq 0x9220
jmp 0x5bbf
leaq -0xe9(%rbp), %rdi
callq 0x91a0
cmpl $-0x1, -0x24(%rbp)
je 0x5c10
movslq -0x24(%rbp), %rsi
leaq -0xd8(%rbp), %rdi
callq 0x89a0
movsd 0xc41f(%rip), %xmm0     # 0x12008
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
jmp 0x5c10
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0xe9(%rbp), %rdi
callq 0x91a0
jmp 0x63b2
movl $0x0, -0xf0(%rbp)
movq -0x1a0(%rbp), %rcx
movl -0xf0(%rbp), %eax
cmpl 0x4(%rcx), %eax
jge 0x5c91
movq -0x1a0(%rbp), %rax
cvtsi2sdl 0x4(%rax), %xmm0
movsd %xmm0, -0x220(%rbp)
movsd 0x28(%rax), %xmm0
movsd %xmm0, -0x218(%rbp)
movslq -0xf0(%rbp), %rsi
leaq -0xd8(%rbp), %rdi
callq 0x89a0
movsd -0x220(%rbp), %xmm0
movsd -0x218(%rbp), %xmm2
movsd (%rax), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax)
movl -0xf0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xf0(%rbp)
jmp 0x5c1a
movq -0x1a0(%rbp), %rdi
addq $0x120, %rdi            # imm = 0x120
movq %rdi, -0x230(%rbp)
movslq -0x20(%rbp), %rsi
callq 0x8c10
movq %rax, %rdi
callq 0x91c0
movq -0x230(%rbp), %rdi
movq %rax, -0x110(%rbp)
movslq -0x20(%rbp), %rsi
callq 0x8c10
movq %rax, %rdi
callq 0x91f0
movq %rax, -0x118(%rbp)
leaq -0x119(%rbp), %rdi
movq %rdi, -0x228(%rbp)
callq 0x9100
movq -0x228(%rbp), %rcx
movq -0x110(%rbp), %rsi
movq -0x118(%rbp), %rdx
leaq -0x108(%rbp), %rdi
callq 0x9220
jmp 0x5d13
leaq -0x119(%rbp), %rdi
callq 0x91a0
movq -0x1a0(%rbp), %rdi
addq $0x108, %rdi            # imm = 0x108
movslq -0x20(%rbp), %rsi
callq 0x8c10
movq %rax, %rdi
movslq -0x1c(%rbp), %rsi
callq 0x8f60
cvtsi2sdl (%rax), %xmm0
movsd %xmm0, -0x238(%rbp)
leaq -0x108(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x89a0
movsd -0x238(%rbp), %xmm0
movsd %xmm0, (%rax)
movl $0x0, -0x120(%rbp)
movq -0x1a0(%rbp), %rcx
movl -0x120(%rbp), %eax
cmpl 0x4(%rcx), %eax
jge 0x5e33
cmpl $0x0, -0x120(%rbp)
jne 0x5de6
movq -0x1a0(%rbp), %rax
movsd 0x20(%rax), %xmm0
movsd %xmm0, -0x240(%rbp)
leaq -0x108(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x89a0
movsd -0x240(%rbp), %xmm0
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
jmp 0x5e1d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x119(%rbp), %rdi
callq 0x91a0
jmp 0x63a6
movq -0x1a0(%rbp), %rax
movsd 0x30(%rax), %xmm0
movsd %xmm0, -0x248(%rbp)
movslq -0x120(%rbp), %rsi
leaq -0x108(%rbp), %rdi
callq 0x89a0
movsd -0x248(%rbp), %xmm0
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
jmp 0x5e1f
movl -0x120(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x120(%rbp)
jmp 0x5d74
movq -0x1a0(%rbp), %rdi
addq $0x168, %rdi            # imm = 0x168
movq %rdi, -0x258(%rbp)
callq 0x91c0
movq -0x258(%rbp), %rdi
movq %rax, -0x140(%rbp)
callq 0x91f0
movq %rax, -0x148(%rbp)
leaq -0x149(%rbp), %rdi
movq %rdi, -0x250(%rbp)
callq 0x9100
movq -0x250(%rbp), %rcx
movq -0x140(%rbp), %rsi
movq -0x148(%rbp), %rdx
leaq -0x138(%rbp), %rdi
callq 0x9220
jmp 0x5e9d
leaq -0x149(%rbp), %rdi
callq 0x91a0
movq -0x1a0(%rbp), %rdi
addq $0x150, %rdi            # imm = 0x150
movslq -0x1c(%rbp), %rsi
callq 0x8f60
cvtsi2sdl (%rax), %xmm0
movsd %xmm0, -0x260(%rbp)
leaq -0x138(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x89a0
movsd -0x260(%rbp), %xmm0
movsd %xmm0, (%rax)
movl $0x0, -0x150(%rbp)
movq -0x1a0(%rbp), %rcx
movl -0x150(%rbp), %eax
cmpl 0x4(%rcx), %eax
jge 0x5ff1
cmpl $0x0, -0x150(%rbp)
jne 0x5f84
movq -0x1a0(%rbp), %rax
movsd 0x20(%rax), %xmm0
movsd %xmm0, -0x270(%rbp)
cvtsi2sdl 0xa0(%rax), %xmm0
movsd %xmm0, -0x268(%rbp)
leaq -0x138(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x89a0
movsd -0x270(%rbp), %xmm0
movsd -0x268(%rbp), %xmm2
movsd (%rax), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax)
jmp 0x5fdb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x149(%rbp), %rdi
callq 0x91a0
jmp 0x639a
movq -0x1a0(%rbp), %rax
movsd 0x30(%rax), %xmm0
movsd %xmm0, -0x280(%rbp)
cvtsi2sdl 0xa0(%rax), %xmm0
movsd %xmm0, -0x278(%rbp)
movslq -0x150(%rbp), %rsi
leaq -0x138(%rbp), %rdi
callq 0x89a0
movsd -0x280(%rbp), %xmm0
movsd -0x278(%rbp), %xmm2
movsd (%rax), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax)
jmp 0x5fdd
movl -0x150(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x150(%rbp)
jmp 0x5ef2
movq -0x1a0(%rbp), %rax
movslq 0x4(%rax), %rax
movq %rax, -0x290(%rbp)
movq $0x0, -0x170(%rbp)
leaq -0x171(%rbp), %rdi
movq %rdi, -0x288(%rbp)
callq 0x9100
movq -0x290(%rbp), %rsi
movq -0x288(%rbp), %rcx
leaq -0x168(%rbp), %rdi
leaq -0x170(%rbp), %rdx
callq 0x9120
jmp 0x6044
leaq -0x171(%rbp), %rdi
callq 0x91a0
movl $0x0, -0x178(%rbp)
movq -0x1a0(%rbp), %rcx
movl -0x178(%rbp), %eax
cmpl 0x4(%rcx), %eax
jge 0x6154
movslq -0x178(%rbp), %rsi
leaq -0x108(%rbp), %rdi
callq 0x89a0
movsd (%rax), %xmm0
movsd %xmm0, -0x2b0(%rbp)
movslq -0x178(%rbp), %rsi
leaq -0x138(%rbp), %rdi
callq 0x89a0
movsd -0x2b0(%rbp), %xmm0
divsd (%rax), %xmm0
movsd %xmm0, -0x2a8(%rbp)
movslq -0x178(%rbp), %rsi
leaq -0xb0(%rbp), %rdi
callq 0x89a0
movsd -0x2a8(%rbp), %xmm0
mulsd (%rax), %xmm0
movsd %xmm0, -0x2a0(%rbp)
movslq -0x178(%rbp), %rsi
leaq -0xd8(%rbp), %rdi
callq 0x89a0
movsd -0x2a0(%rbp), %xmm0
divsd (%rax), %xmm0
movsd %xmm0, -0x298(%rbp)
movslq -0x178(%rbp), %rsi
leaq -0x168(%rbp), %rdi
callq 0x89a0
movsd -0x298(%rbp), %xmm0
movsd %xmm0, (%rax)
movl -0x178(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x178(%rbp)
jmp 0x605a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x171(%rbp), %rdi
callq 0x91a0
jmp 0x638e
leaq -0x198(%rbp), %rdi
leaq -0x168(%rbp), %rsi
callq 0x92a0
jmp 0x6169
leaq -0x198(%rbp), %rdi
callq 0x3680
movl %eax, -0x2b4(%rbp)
jmp 0x617d
leaq -0x198(%rbp), %rdi
callq 0x9390
movl -0x2b4(%rbp), %eax
movq -0x1a0(%rbp), %rdi
movl %eax, -0x17c(%rbp)
movl -0x17c(%rbp), %eax
movl %eax, -0x2b8(%rbp)
addq $0xd8, %rdi
movslq -0xc(%rbp), %rsi
callq 0x8c10
movq %rax, %rdi
movslq -0x10(%rbp), %rsi
callq 0x8f60
movl -0x2b8(%rbp), %ecx
movl %ecx, (%rax)
cmpl $-0x1, -0x24(%rbp)
je 0x622f
movq -0x1a0(%rbp), %rdi
addq $0x138, %rdi            # imm = 0x138
movslq -0x24(%rbp), %rsi
callq 0x8c10
movq %rax, %rdi
movslq -0x17c(%rbp), %rsi
callq 0x8f60
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0x622f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x6382
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x198(%rbp), %rdi
callq 0x9390
jmp 0x6382
cmpl $-0x1, -0x28(%rbp)
je 0x6262
movq -0x1a0(%rbp), %rdi
addq $0x138, %rdi            # imm = 0x138
movslq -0x17c(%rbp), %rsi
callq 0x8c10
movq %rax, %rdi
movslq -0x28(%rbp), %rsi
callq 0x8f60
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
cmpl $0x0, -0x17c(%rbp)
jne 0x62dd
movq -0x1a0(%rbp), %rdi
addq $0xf0, %rdi
movslq -0xc(%rbp), %rsi
callq 0x8c10
movq %rax, %rdi
movslq -0x1c(%rbp), %rsi
callq 0x8f60
movq -0x1a0(%rbp), %rdi
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
addq $0x108, %rdi            # imm = 0x108
movslq -0x20(%rbp), %rsi
callq 0x8c10
movq %rax, %rdi
movslq -0x1c(%rbp), %rsi
callq 0x8f60
movq -0x1a0(%rbp), %rdi
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
addq $0x150, %rdi            # imm = 0x150
movslq -0x1c(%rbp), %rsi
callq 0x8f60
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movq -0x1a0(%rbp), %rdi
addq $0x120, %rdi            # imm = 0x120
movslq -0x20(%rbp), %rsi
callq 0x8c10
movq %rax, %rdi
movslq -0x17c(%rbp), %rsi
callq 0x8f60
movq -0x1a0(%rbp), %rdi
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
addq $0x168, %rdi            # imm = 0x168
movslq -0x17c(%rbp), %rsi
callq 0x8f60
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
leaq -0x168(%rbp), %rdi
callq 0x9390
leaq -0x138(%rbp), %rdi
callq 0x9390
leaq -0x108(%rbp), %rdi
callq 0x9390
leaq -0xd8(%rbp), %rdi
callq 0x9390
leaq -0xb0(%rbp), %rdi
callq 0x9390
leaq -0x80(%rbp), %rdi
callq 0x9390
leaq -0x40(%rbp), %rdi
callq 0x9390
addq $0x2c0, %rsp            # imm = 0x2C0
popq %rbp
retq
leaq -0x168(%rbp), %rdi
callq 0x9390
leaq -0x138(%rbp), %rdi
callq 0x9390
leaq -0x108(%rbp), %rdi
callq 0x9390
leaq -0xd8(%rbp), %rdi
callq 0x9390
leaq -0xb0(%rbp), %rdi
callq 0x9390
leaq -0x80(%rbp), %rdi
callq 0x9390
leaq -0x40(%rbp), %rdi
callq 0x9390
movq -0x58(%rbp), %rdi
callq 0x3400
nopl (%rax)