// File: /workspace/github_cpp_makefile_star2_O3/abaheti95[P]HMM-LDA/Models/cpp_hmm_lda/model.cpp
// Function: HMMLDA::relabel_document(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, std::vector<int, std::allocator<int>>&, std::vector<int, std::allocator<int>>&, std::vector<int, std::allocator<int>>&, std::vector<int, std::allocator<int>>&, int)
string HMMLDA::relabel_document(string &input, vector<int> &document, vector<int> &topic_assignment, vector<int> &class_assignment, vector<int> &num_words_in_document_assigned_to_topic, int iterations) {
	vector<string> words = split(input, ' ');
	int doc_size = input_to_document(words, document, topic_assignment, class_assignment);
	add_counts_for_new_document(document, topic_assignment, class_assignment, num_words_in_document_assigned_to_topic, doc_size);
	// Resample the current document for some iterations
	for(int i = 1; i <= iterations; i++) {
		for(int word_idx = 0; word_idx < doc_size; word_idx++) {
			spl_draw_class(document, class_assignment, topic_assignment, num_words_in_document_assigned_to_topic, word_idx, doc_size);
			spl_draw_topic(document, class_assignment, topic_assignment, num_words_in_document_assigned_to_topic, word_idx, doc_size);
		}
	}
	// Create the output string
	string output = "";
	for(int i = 0; i < doc_size; i++) {
		string assignment = "";
		if(class_assignment[i] == 0)
			assignment = "T" + std::to_string(topic_assignment[i]);
		else
			assignment = "C" + std::to_string(class_assignment[i]);
		output += words[i] + "/" + assignment + " ";
	}
	remove_counts_for_new_document(document, topic_assignment, class_assignment, num_words_in_document_assigned_to_topic, doc_size);
	return output;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movq %r9, %r14
movq %r8, %r15
movq %rcx, %r12
movq %rsi, %r13
movq %rdi, -0x88(%rbp)
leaq -0x100(%rbp), %rbx
movq %rbx, %rdi
movq %rdx, %rsi
movl $0x20, %edx
callq 0x2bac
movq %r13, %rdi
movq %rbx, %rsi
movq %r12, %rdx
movq %r15, %rcx
movq %r14, %r8
callq 0x49d0
movl %eax, %ebx
movq 0x10(%rbp), %r8
movq %r13, -0xb8(%rbp)
movq %r13, %rdi
movq %r12, -0xc0(%rbp)
movq %r12, %rsi
movq %r15, -0x90(%rbp)
movq %r15, %rdx
movq %r14, %rcx
movl %eax, %r9d
callq 0x4834
cmpl $0x0, 0x18(%rbp)
movl %ebx, %r15d
movl %ebx, -0x2c(%rbp)
jle 0x4be3
movl $0x1, %eax
movq %rax, -0x78(%rbp)
movq -0xb8(%rbp), %r13
testl %r15d, %r15d
jle 0x4bd3
xorl %r12d, %r12d
movl %r15d, (%rsp)
movq %r13, %rdi
movq -0xc0(%rbp), %r15
movq %r15, %rsi
movq %r14, %rdx
movq %r14, %rbx
movq -0x90(%rbp), %r14
movq %r14, %rcx
movq 0x10(%rbp), %r8
movl %r12d, %r9d
callq 0x5190
movq %r13, %rdi
movq %r15, %rsi
movq %rbx, %rdx
movq %r14, %rcx
movq 0x10(%rbp), %r8
movl %r12d, %r9d
callq 0x57e6
incl %r12d
movl -0x2c(%rbp), %r15d
cmpl %r12d, %r15d
movq %rbx, %r14
jne 0x4b7f
movq -0x78(%rbp), %rcx
leal 0x1(%rcx), %eax
cmpl 0x18(%rbp), %ecx
movq %rax, -0x78(%rbp)
jne 0x4b77
movq -0x88(%rbp), %rdi
leaq 0x10(%rdi), %rax
movq %rax, -0x80(%rbp)
movq %rax, (%rdi)
leaq 0x3498(%rip), %rdx      # 0x8094
movq %rdx, %rsi
callq 0x6212
testl %r15d, %r15d
jle 0x5036
leaq -0xa0(%rbp), %r13
movl -0x2c(%rbp), %eax
movq %rax, -0xe8(%rbp)
xorl %r15d, %r15d
leaq -0x50(%rbp), %rbx
movq %r13, -0xb0(%rbp)
leaq -0xb0(%rbp), %rdi
leaq 0x345a(%rip), %rdx      # 0x8094
movq %rdx, %rsi
callq 0x6212
movq (%r14), %rax
movl (%rax,%r15,4), %r12d
testq %r12, %r12
movq %r15, -0x78(%rbp)
je 0x4cbd
movl %r12d, %r15d
negl %r15d
cmovsl %r12d, %r15d
movl $0x1, %r13d
cmpl $0xa, %r15d
leaq -0x40(%rbp), %rdx
jb 0x4d42
movl $0x4, %r13d
movl %r15d, %eax
movl $0xd1b71759, %esi       # imm = 0xD1B71759
cmpl $0x63, %eax
jbe 0x4d39
cmpl $0x3e7, %eax            # imm = 0x3E7
jbe 0x4d3f
cmpl $0x2710, %eax           # imm = 0x2710
jb 0x4d42
movl %eax, %ecx
imulq %rsi, %rcx
shrq $0x2d, %rcx
addl $0x4, %r13d
cmpl $0x1869f, %eax          # imm = 0x1869F
movl %ecx, %eax
ja 0x4c7e
addl $-0x3, %r13d
jmp 0x4d42
movq %rbx, %r13
movq -0x90(%rbp), %rax
movq (%rax), %rax
movl (%rax,%r15,4), %ebx
movl %ebx, %r15d
negl %r15d
cmovsl %ebx, %r15d
movl $0x1, %r12d
cmpl $0xa, %r15d
leaq -0x40(%rbp), %rdx
jb 0x4e1c
movl $0x4, %r12d
movl %r15d, %eax
movl $0xd1b71759, %esi       # imm = 0xD1B71759
cmpl $0x63, %eax
jbe 0x4e13
cmpl $0x3e7, %eax            # imm = 0x3E7
jbe 0x4e19
cmpl $0x2710, %eax           # imm = 0x2710
jb 0x4e1c
movl %eax, %ecx
imulq %rsi, %rcx
shrq $0x2d, %rcx
addl $0x4, %r12d
cmpl $0x1869f, %eax          # imm = 0x1869F
movl %ecx, %eax
ja 0x4cfa
addl $-0x3, %r12d
jmp 0x4e1c
addl $-0x2, %r13d
jmp 0x4d42
decl %r13d
shrl $0x1f, %r12d
leal (%r12,%r13), %esi
movq %rdx, -0x50(%rbp)
movq %rbx, %rdi
movl $0x2d, %edx
callq 0x2280
addq -0x50(%rbp), %r12
movq %r12, %rdi
movl %r13d, %esi
movl %r15d, %edx
callq 0x6101
movl $0x1, %r8d
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq 0x33ce(%rip), %rcx      # 0x814f
callq 0x2260
leaq -0x60(%rbp), %r15
movq %r15, -0x70(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
leaq -0xd0(%rbp), %r12
je 0x4db1
movq %rdx, -0x70(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x60(%rbp)
jmp 0x4db8
movups (%rcx), %xmm0
movups %xmm0, (%r15)
leaq -0xe0(%rbp), %r13
movq 0x8(%rax), %rdx
movq %rdx, -0x68(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq -0xb0(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x22a0
movq -0x70(%rbp), %rdi
cmpq %r15, %rdi
je 0x4df4
callq 0x2210
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
movq -0x78(%rbp), %r15
je 0x4e0a
callq 0x2210
leaq -0x50(%rbp), %rbx
jmp 0x4ee6
addl $-0x2, %r12d
jmp 0x4e1c
decl %r12d
shrl $0x1f, %ebx
leal (%r12,%rbx), %esi
movq %rdx, -0x50(%rbp)
movq %r13, %rdi
movl $0x2d, %edx
callq 0x2280
addq -0x50(%rbp), %rbx
movq %rbx, %rdi
movl %r12d, %esi
movl %r15d, %edx
callq 0x6101
movl $0x1, %r8d
movq %r13, %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq 0x32f3(%rip), %rcx      # 0x814d
callq 0x2260
movq %r13, %rbx
leaq -0x60(%rbp), %r15
movq %r15, -0x70(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
leaq -0xd0(%rbp), %r12
je 0x4e8d
movq %rdx, -0x70(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x60(%rbp)
jmp 0x4e94
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
movq %rdx, -0x68(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq -0xb0(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x22a0
movq -0x70(%rbp), %rdi
cmpq %r15, %rdi
je 0x4ec9
callq 0x2210
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
movq -0x78(%rbp), %r15
je 0x4edf
callq 0x2210
leaq -0xe0(%rbp), %r13
movq -0x100(%rbp), %rax
movq %r15, %rcx
shlq $0x5, %rcx
movq %r12, -0xe0(%rbp)
movq (%rax,%rcx), %rsi
movq 0x8(%rax,%rcx), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x6174
movq %r13, %rdi
leaq 0x31dc(%rip), %rsi      # 0x80f5
callq 0x23c0
movq -0xb0(%rbp), %rsi
movq -0xa8(%rbp), %rdx
movq %r13, %rdi
callq 0x20a0
leaq -0x40(%rbp), %rsi
movq %rsi, -0x50(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
leaq -0xa0(%rbp), %r13
je 0x4f5f
movq %rdx, -0x50(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x40(%rbp)
jmp 0x4f65
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, -0x48(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %rbx, %rdi
leaq 0x310d(%rip), %rsi      # 0x8093
callq 0x23c0
leaq -0x60(%rbp), %rsi
movq %rsi, -0x70(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x4faf
movq %rdx, -0x70(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x60(%rbp)
jmp 0x4fb5
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, -0x68(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
movq -0x88(%rbp), %rdi
callq 0x20a0
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x4ff2
callq 0x2210
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x5004
callq 0x2210
movq -0xe0(%rbp), %rdi
cmpq %r12, %rdi
je 0x5015
callq 0x2210
movq -0xb0(%rbp), %rdi
cmpq %r13, %rdi
je 0x5026
callq 0x2210
incq %r15
cmpq -0xe8(%rbp), %r15
jne 0x4c25
movq -0xb8(%rbp), %rdi
movq -0xc0(%rbp), %rsi
movq -0x90(%rbp), %rdx
movq %r14, %rcx
movq 0x10(%rbp), %r8
movl -0x2c(%rbp), %r9d
callq 0x4902
leaq -0x100(%rbp), %rdi
callq 0x5ae8
movq -0x88(%rbp), %rax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5178
jmp 0x5178
leaq -0xa0(%rbp), %r13
movq %rax, %r14
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
jmp 0x5143
jmp 0x50d9
movq %rax, %r14
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x50bd
callq 0x2210
jmp 0x50bd
movq %rax, %r14
movq -0x80(%rbp), %rbx
leaq -0xa0(%rbp), %r13
jmp 0x5151
movq %rax, %r14
movq -0x80(%rbp), %rbx
jmp 0x5162
leaq -0xa0(%rbp), %r13
movq %rax, %r14
jmp 0x514d
leaq -0xa0(%rbp), %r13
movq %rax, %r14
movq -0xe0(%rbp), %rdi
cmpq %r12, %rdi
jne 0x5148
jmp 0x514d
leaq -0xa0(%rbp), %r13
movq %rax, %r14
jmp 0x5135
movq %rax, %r14
jmp 0x5123
movq %rax, %r14
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x5123
callq 0x2210
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x5135
callq 0x2210
movq -0xe0(%rbp), %rdi
leaq -0xd0(%rbp), %rax
cmpq %rax, %rdi
je 0x514d
callq 0x2210
movq -0x80(%rbp), %rbx
movq -0xb0(%rbp), %rdi
cmpq %r13, %rdi
je 0x5162
callq 0x2210
movq -0x88(%rbp), %rax
movq (%rax), %rdi
cmpq %rbx, %rdi
je 0x517b
callq 0x2210
jmp 0x517b
movq %rax, %r14
leaq -0x100(%rbp), %rdi
callq 0x5ae8
movq %r14, %rdi
callq 0x2390
nop