// File: /workspace/github_cpp_makefile_star2_O3/lotka[P]prologplusplus/main.cpp
// Function: query_test(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void query_test(string s)
{
	if(s == "halt.")
	{
		exit(1);
	}
	PredicateRef p(s,predicates);
	bool unified = false;

	cout << "test" << endl;
	// Basically what happens here is that we try to unify the ref with all
	// the existing predicates, if one works set the unified flag to true
	for(int i = 0; i < predicates.size(); ++i)
	{
		if(predicates[i]->unifyWith(&p))
		{
			unified = true;
		}
	}
	// If unified, print out the variables that worked, these are stored inside the atoms
	// in a list of possibilites, this is potentially a really bad way to do this
	// I think this is going to need some kind of virtual/temporary variables to make this work
	if(unified)
	{
		for(int i = 0; i < p.args.size(); ++i)
		{
			char c;
			for(int j = 0; j < p.args[i]->possibilties.size(); ++j)
			{
				cout << *p.args[i] << "=" << *p.args[i]->possibilties[j] << endl;
			}
			cin >> c;
		}
		cout << endl << "yes" << endl;
	}
	else
	{
		cout << endl << "no" << endl;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x70, %rsp
movq %rdi, %rbx
leaq 0x2a3a(%rip), %rsi      # 0x5004
callq 0x2050
testl %eax, %eax
je 0x2814
leaq -0x38(%rbp), %r14
movq %r14, -0x10(%r14)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq -0x48(%rbp), %rbx
movq %rbx, %rdi
callq 0x2b40
leaq 0x4b2c(%rip), %rdx      # 0x7128
leaq -0x88(%rbp), %rdi
movq %rbx, %rsi
callq 0x336c
movq -0x48(%rbp), %rdi
cmpq %r14, %rdi
je 0x2620
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2130
movq 0x49a9(%rip), %rbx      # 0x6fd0
leaq 0x29dc(%rip), %rsi      # 0x500a
movl $0x4, %edx
movq %rbx, %rdi
callq 0x2150
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2110
movsbl %al, %esi
movq 0x4977(%rip), %rbx      # 0x6fd0
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20a0
movq 0x4ab8(%rip), %rax      # 0x7128
cmpq %rax, 0x4ab9(%rip)      # 0x7130
je 0x2764
xorl %r15d, %r15d
leaq -0x88(%rbp), %r14
xorl %r12d, %r12d
movq (%rax,%r15,8), %rdi
movq %r14, %rsi
callq 0x42a0
orb %al, %r12b
incq %r15
movq 0x4a8d(%rip), %rcx      # 0x7130
movq 0x4a7e(%rip), %rax      # 0x7128
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r15, %rcx
ja 0x268a
testb $0x1, %r12b
je 0x2764
movq -0x68(%rbp), %rax
cmpq %rax, -0x60(%rbp)
je 0x270c
xorl %r12d, %r12d
movq 0x490c(%rip), %r14      # 0x6fe0
leaq -0x21(%rbp), %r15
movq (%rax,%r12,8), %rsi
movq 0x30(%rsi), %rax
cmpq 0x28(%rsi), %rax
jne 0x2808
movq %r14, %rdi
movq %r15, %rsi
callq 0x2190
incq %r12
movq -0x68(%rbp), %rax
movq -0x60(%rbp), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r12, %rcx
ja 0x26d8
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2110
movsbl %al, %esi
movq 0x48a6(%rip), %rdi      # 0x6fd0
callq 0x2030
movq %rax, %rdi
callq 0x20a0
movq %rax, %rbx
leaq 0x28ce(%rip), %rsi      # 0x500f
movl $0x3, %edx
movq %rax, %rdi
callq 0x2150
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2110
jmp 0x27ba
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2110
movsbl %al, %esi
movq 0x484e(%rip), %rdi      # 0x6fd0
callq 0x2030
movq %rax, %rdi
callq 0x20a0
movq %rax, %rbx
leaq 0x287a(%rip), %rsi      # 0x5013
movl $0x2, %edx
movq %rax, %rdi
callq 0x2150
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2110
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20a0
movq -0x68(%rbp), %rdi
testq %rdi, %rdi
je 0x27e2
movq -0x58(%rbp), %rsi
subq %rdi, %rsi
callq 0x2130
leaq -0x78(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x27fb
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x2130
addq $0x70, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x47c1(%rip), %rdi      # 0x6fd0
callq 0x2100
movl $0x1, %edi
callq 0x2160
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r14, %rdi
je 0x284d
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2130
jmp 0x284d
jmp 0x283e
jmp 0x283e
jmp 0x283e
movq %rax, %rbx
leaq -0x88(%rbp), %rdi
callq 0x2afe
movq %rbx, %rdi
callq 0x21d0