// File: abaheti95[P]HMM-LDA/cpp_hmm_lda_trainer.cpp
// Function: main
int main(int argc, char const *argv[]) {
	std::clock_t start;
	start = std::clock();
	// model parameter initializations
	int num_topics = 50;
	int num_classes = 17;
	// int num_classes = 3;			// topics only setting
	int start_word_id = 0;
	int end_word_id = 1;
	// double alpha = 50.0/num_topics;
	double alpha = 0.5;
	double beta = 0.3;			// topic words prior
	double gamma = 1;			// transition probabilities prior
	double delta = 0.1;		// Class words prior

	// your test
	string vocab_filename = "Data/20newsgroup/20news_vocab.txt";
	vector<string> vocab;
	HMMLDA model(vocab_filename, num_topics, num_classes, 
		start_word_id, end_word_id, alpha, beta, gamma, delta, "20news");
		// start_word_id, end_word_id, alpha, beta, gamma, delta, "20news-topics");
	string documents_filename = "Data/20newsgroup/20news_train_encoded.txt";
	load_documents_to_model(model, documents_filename);
	// string topic_assignments_file = "Results/20news-topics/500_results/topic_assignments.txt";
	// model.load_topic_assignments(topic_assignments_file);
	model.run_counts();
	cout << "Training Started" << endl;
	model.train(2500,100);
	std::cout << "Time: " << (std::clock() - start) / (double)(CLOCKS_PER_SEC) << " s" << std::endl;
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1670, %rsp           # imm = 0x1670
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
callq 0x3180
movq %rax, -0x18(%rbp)
movl $0x32, -0x1c(%rbp)
movl $0x11, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x1, -0x28(%rbp)
movabsq $0x3fe0000000000000, %rax # imm = 0x3FE0000000000000
movq %rax, -0x30(%rbp)
movabsq $0x3fd3333333333333, %rax # imm = 0x3FD3333333333333
movq %rax, -0x38(%rbp)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, -0x40(%rbp)
movabsq $0x3fb999999999999a, %rax # imm = 0x3FB999999999999A
movq %rax, -0x48(%rbp)
leaq -0x69(%rbp), %rdi
movq %rdi, -0x1608(%rbp)
callq 0x3410
movq -0x1608(%rbp), %rdx
leaq 0xa46(%rip), %rsi       # 0x1227a
leaq -0x68(%rbp), %rdi
callq 0x32f0
jmp 0x1183f
leaq -0x69(%rbp), %rdi
callq 0x3280
leaq -0x98(%rbp), %rdi
callq 0x89c0
movl -0x1c(%rbp), %eax
movl %eax, -0x1640(%rbp)
movl -0x20(%rbp), %eax
movl %eax, -0x163c(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x1638(%rbp)
movl -0x28(%rbp), %eax
movl %eax, -0x1634(%rbp)
movsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x1630(%rbp)
movsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x1628(%rbp)
movsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x1620(%rbp)
movsd -0x48(%rbp), %xmm0
movsd %xmm0, -0x1618(%rbp)
leaq -0x15d1(%rbp), %rdi
movq %rdi, -0x1610(%rbp)
callq 0x3410
movq -0x1610(%rbp), %rdx
leaq 0x9cf(%rip), %rsi       # 0x1229c
leaq -0x15d0(%rbp), %rdi
callq 0x32f0
jmp 0x118db
movsd -0x1618(%rbp), %xmm3
movsd -0x1620(%rbp), %xmm2
movsd -0x1628(%rbp), %xmm1
movsd -0x1630(%rbp), %xmm0
movl -0x1634(%rbp), %r9d
movl -0x1638(%rbp), %r8d
movl -0x163c(%rbp), %ecx
movl -0x1640(%rbp), %edx
movq %rsp, %rax
leaq -0x15d0(%rbp), %rsi
movq %rsi, (%rax)
leaq -0x15b0(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x3790
jmp 0x11934
leaq -0x15d0(%rbp), %rdi
callq 0x3160
leaq -0x15d1(%rbp), %rdi
callq 0x3280
leaq -0x15f9(%rbp), %rdi
movq %rdi, -0x1648(%rbp)
callq 0x3410
movq -0x1648(%rbp), %rdx
leaq 0x936(%rip), %rsi       # 0x122a3
leaq -0x15f8(%rbp), %rdi
callq 0x32f0
jmp 0x1197b
leaq -0x15f9(%rbp), %rdi
callq 0x3280
leaq -0x15b0(%rbp), %rdi
leaq -0x15f8(%rbp), %rsi
callq 0x11510
jmp 0x1199c
leaq -0x15b0(%rbp), %rdi
callq 0x4660
jmp 0x119aa
movq 0x8627(%rip), %rdi      # 0x19fd8
leaq 0x915(%rip), %rsi       # 0x122cd
callq 0x3240
movq %rax, -0x1650(%rbp)
jmp 0x119c6
movq -0x1650(%rbp), %rdi
movq 0x85f4(%rip), %rsi      # 0x19fc8
callq 0x3270
jmp 0x119db
leaq -0x15b0(%rbp), %rdi
movl $0x9c4, %esi            # imm = 0x9C4
movl $0x64, %edx
callq 0x4d40
jmp 0x119f3
movq 0x85de(%rip), %rdi      # 0x19fd8
leaq 0x8dd(%rip), %rsi       # 0x122de
callq 0x3240
movq %rax, -0x1658(%rbp)
jmp 0x11a0f
callq 0x3180
movq -0x1658(%rbp), %rdi
movq -0x18(%rbp), %rcx
subq %rcx, %rax
cvtsi2sd %rax, %xmm0
movsd 0x5e1(%rip), %xmm1      # 0x12010
divsd %xmm1, %xmm0
callq 0x3430
movq %rax, -0x1660(%rbp)
jmp 0x11a41
movq -0x1660(%rbp), %rdi
leaq 0x66a(%rip), %rsi       # 0x120b9
callq 0x3240
movq %rax, -0x1668(%rbp)
jmp 0x11a5d
movq -0x1668(%rbp), %rdi
movq 0x855d(%rip), %rsi      # 0x19fc8
callq 0x3270
jmp 0x11a72
movl $0x0, -0x4(%rbp)
leaq -0x15f8(%rbp), %rdi
callq 0x3160
leaq -0x15b0(%rbp), %rdi
callq 0x3c40
leaq -0x98(%rbp), %rdi
callq 0x8b80
leaq -0x68(%rbp), %rdi
callq 0x3160
movl -0x4(%rbp), %eax
addq $0x1670, %rsp           # imm = 0x1670
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x69(%rbp), %rdi
callq 0x3280
jmp 0x11b53
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x11af2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x15d0(%rbp), %rdi
callq 0x3160
leaq -0x15d1(%rbp), %rdi
callq 0x3280
jmp 0x11b3e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x15f9(%rbp), %rdi
callq 0x3280
jmp 0x11b32
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x15f8(%rbp), %rdi
callq 0x3160
leaq -0x15b0(%rbp), %rdi
callq 0x3c40
leaq -0x98(%rbp), %rdi
callq 0x8b80
leaq -0x68(%rbp), %rdi
callq 0x3160
movq -0x78(%rbp), %rdi
callq 0x3400
nopl (%rax)