// File: /workspace/github_cpp_makefile_star2_O1/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 -0x108(%rbp), %rbx
movq %rbx, %rdi
movq %rdx, %rsi
movl $0x20, %edx
callq 0x2baa
movq %r13, %rdi
movq %rbx, %rsi
movq %r12, %rdx
movq %r15, %rcx
movq %r14, %r8
callq 0x49d2
movl %eax, %ebx
movq 0x10(%rbp), %r8
movq %r13, -0xc0(%rbp)
movq %r13, %rdi
movq %r12, -0xc8(%rbp)
movq %r12, %rsi
movq %r15, -0x90(%rbp)
movq %r15, %rdx
movq %r14, %rcx
movl %eax, %r9d
callq 0x483e
cmpl $0x0, 0x18(%rbp)
movl %ebx, %r15d
movl %ebx, -0x2c(%rbp)
jle 0x4be5
movl $0x1, %eax
movq %rax, -0x78(%rbp)
movq -0xc0(%rbp), %r13
testl %r15d, %r15d
jle 0x4bd5
xorl %r12d, %r12d
movl %r15d, (%rsp)
movq %r13, %rdi
movq -0xc8(%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 0x5196
movq %r13, %rdi
movq %r15, %rsi
movq %rbx, %rdx
movq %r14, %rcx
movq 0x10(%rbp), %r8
movl %r12d, %r9d
callq 0x57f2
incl %r12d
movl -0x2c(%rbp), %r15d
cmpl %r12d, %r15d
movq %rbx, %r14
jne 0x4b81
movq -0x78(%rbp), %rcx
leal 0x1(%rcx), %eax
cmpl 0x18(%rbp), %ecx
movq %rax, -0x78(%rbp)
jne 0x4b79
movq -0x88(%rbp), %rdi
leaq 0x10(%rdi), %rax
movq %rax, -0x80(%rbp)
movq %rax, (%rdi)
leaq 0x3486(%rip), %rdx      # 0x8084
movq %rdx, %rsi
callq 0x620a
testl %r15d, %r15d
jle 0x503c
leaq -0xa0(%rbp), %r13
movl -0x2c(%rbp), %eax
movq %rax, -0xf0(%rbp)
xorl %r15d, %r15d
leaq -0x50(%rbp), %rbx
movq %r13, -0xb0(%rbp)
leaq -0xb0(%rbp), %rdi
leaq 0x3448(%rip), %rdx      # 0x8084
movq %rdx, %rsi
callq 0x620a
movq (%r14), %rax
cmpl $0x0, (%rax,%r15,4)
movq %r15, -0x78(%rbp)
je 0x4cbe
movl (%rax,%r15,4), %r12d
movl %r12d, %r15d
negl %r15d
cmovsl %r12d, %r15d
movl $0x1, %r13d
cmpl $0xa, %r15d
leaq -0x40(%rbp), %rdx
jb 0x4d3d
movl $0x4, %r13d
movl %r15d, %eax
movl $0xd1b71759, %esi       # imm = 0xD1B71759
cmpl $0x63, %eax
jbe 0x4d34
cmpl $0x3e7, %eax            # imm = 0x3E7
jbe 0x4d3a
cmpl $0x2710, %eax           # imm = 0x2710
jb 0x4d3d
movl %eax, %ecx
imulq %rsi, %rcx
shrq $0x2d, %rcx
addl $0x4, %r13d
cmpl $0x1869f, %eax          # imm = 0x1869F
movl %ecx, %eax
ja 0x4c82
addl $-0x3, %r13d
jmp 0x4d3d
movq -0x90(%rbp), %rax
movq (%rax), %rax
movl (%rax,%r15,4), %r13d
movl %r13d, %edi
negl %edi
cmovsl %r13d, %edi
movl $0x1, %r12d
cmpl $0xa, %edi
leaq -0x40(%rbp), %rdx
jb 0x4e17
movl $0x4, %r12d
movl %edi, %eax
movl $0xd1b71759, %esi       # imm = 0xD1B71759
cmpl $0x63, %eax
jbe 0x4e0e
cmpl $0x3e7, %eax            # imm = 0x3E7
jbe 0x4e14
cmpl $0x2710, %eax           # imm = 0x2710
jb 0x4e17
movl %eax, %ecx
imulq %rsi, %rcx
shrq $0x2d, %rcx
addl $0x4, %r12d
cmpl $0x1869f, %eax          # imm = 0x1869F
movl %ecx, %eax
ja 0x4cf5
addl $-0x3, %r12d
jmp 0x4e17
addl $-0x2, %r13d
jmp 0x4d3d
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 0x60fd
movl $0x1, %r8d
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq 0x33c3(%rip), %rcx      # 0x813f
callq 0x2260
leaq -0x60(%rbp), %r15
movq %r15, -0x70(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
leaq -0xd8(%rbp), %r12
je 0x4dac
movq %rdx, -0x70(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x60(%rbp)
jmp 0x4db3
movups (%rcx), %xmm0
movups %xmm0, (%r15)
leaq -0xe8(%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 0x4def
callq 0x2210
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
movq -0x78(%rbp), %r15
je 0x4e05
callq 0x2210
leaq -0x50(%rbp), %rbx
jmp 0x4eec
addl $-0x2, %r12d
jmp 0x4e17
decl %r12d
movl %edi, -0xb4(%rbp)
shrl $0x1f, %r13d
leal (%r12,%r13), %esi
movq %rdx, -0x50(%rbp)
movq %rbx, %rdi
movl $0x2d, %edx
callq 0x2280
addq -0x50(%rbp), %r13
movq %r13, %rdi
movl %r12d, %esi
movl -0xb4(%rbp), %edx
callq 0x60fd
movl $0x1, %r8d
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq 0x32de(%rip), %rcx      # 0x813d
callq 0x2260
leaq -0x60(%rbp), %r15
movq %r15, -0x70(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
leaq -0xd8(%rbp), %r12
je 0x4e8f
movq %rdx, -0x70(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x60(%rbp)
jmp 0x4e96
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 0x4ecb
callq 0x2210
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
movq -0x78(%rbp), %r15
je 0x4ee1
callq 0x2210
leaq -0x50(%rbp), %rbx
leaq -0xe8(%rbp), %r13
movq -0x108(%rbp), %rax
movq %r15, %rcx
shlq $0x5, %rcx
movq %r12, -0xe8(%rbp)
movq (%rax,%rcx), %rsi
movq 0x8(%rax,%rcx), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x6170
movq %r13, %rdi
leaq 0x31c6(%rip), %rsi      # 0x80e5
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 0x4f65
movq %rdx, -0x50(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x40(%rbp)
jmp 0x4f6b
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 0x30f7(%rip), %rsi      # 0x8083
callq 0x23c0
leaq -0x60(%rbp), %rsi
movq %rsi, -0x70(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x4fb5
movq %rdx, -0x70(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x60(%rbp)
jmp 0x4fbb
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 0x4ff8
callq 0x2210
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x500a
callq 0x2210
movq -0xe8(%rbp), %rdi
cmpq %r12, %rdi
je 0x501b
callq 0x2210
movq -0xb0(%rbp), %rdi
cmpq %r13, %rdi
je 0x502c
callq 0x2210
incq %r15
cmpq -0xf0(%rbp), %r15
jne 0x4c27
movq -0xc0(%rbp), %rdi
movq -0xc8(%rbp), %rsi
movq -0x90(%rbp), %rdx
movq %r14, %rcx
movq 0x10(%rbp), %r8
movl -0x2c(%rbp), %r9d
callq 0x4908
leaq -0x108(%rbp), %rdi
callq 0x5aee
movq -0x88(%rbp), %rax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x517e
jmp 0x517e
leaq -0xa0(%rbp), %r13
movq %rax, %r14
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
jmp 0x5149
jmp 0x50df
movq %rax, %r14
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x50c3
callq 0x2210
jmp 0x50c3
movq %rax, %r14
movq -0x80(%rbp), %rbx
leaq -0xa0(%rbp), %r13
jmp 0x5157
movq %rax, %r14
movq -0x80(%rbp), %rbx
jmp 0x5168
leaq -0xa0(%rbp), %r13
movq %rax, %r14
jmp 0x5153
leaq -0xa0(%rbp), %r13
movq %rax, %r14
movq -0xe8(%rbp), %rdi
cmpq %r12, %rdi
jne 0x514e
jmp 0x5153
leaq -0xa0(%rbp), %r13
movq %rax, %r14
jmp 0x513b
movq %rax, %r14
jmp 0x5129
movq %rax, %r14
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x5129
callq 0x2210
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x513b
callq 0x2210
movq -0xe8(%rbp), %rdi
leaq -0xd8(%rbp), %rax
cmpq %rax, %rdi
je 0x5153
callq 0x2210
movq -0x80(%rbp), %rbx
movq -0xb0(%rbp), %rdi
cmpq %r13, %rdi
je 0x5168
callq 0x2210
movq -0x88(%rbp), %rax
movq (%rax), %rdi
cmpq %rbx, %rdi
je 0x5181
callq 0x2210
jmp 0x5181
movq %rax, %r14
leaq -0x108(%rbp), %rdi
callq 0x5aee
movq %r14, %rdi
callq 0x2390
nop