// File: /workspace/github_cpp_makefile_star2_O1/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 %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
leaq 0x2a35(%rip), %rsi      # 0x5004
callq 0x2050
testl %eax, %eax
je 0x2828
leaq -0x40(%rbp), %r14
movq %r14, -0x10(%r14)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq -0x50(%rbp), %rbx
movq %rbx, %rdi
callq 0x2b54
leaq 0x4b27(%rip), %rdx      # 0x7128
leaq -0x90(%rbp), %rdi
movq %rbx, %rsi
callq 0x3360
movq -0x50(%rbp), %rdi
cmpq %r14, %rdi
je 0x2625
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2130
movq 0x49a4(%rip), %rbx      # 0x6fd0
leaq 0x29d7(%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 0x4972(%rip), %rbx      # 0x6fd0
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20a0
movq 0x4ab3(%rip), %rax      # 0x7128
cmpq %rax, 0x4ab4(%rip)      # 0x7130
je 0x2776
xorl %r15d, %r15d
leaq -0x90(%rbp), %r14
movl $0x1, %r12d
xorl %r13d, %r13d
movq (%rax,%r15,8), %rdi
movq %r14, %rsi
callq 0x42b2
movzbl %r13b, %r13d
testb %al, %al
cmovnel %r12d, %r13d
incq %r15
movq 0x4a7b(%rip), %rcx      # 0x7130
movq 0x4a6c(%rip), %rax      # 0x7128
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r15, %rcx
ja 0x2695
testb $0x1, %r13b
je 0x2776
movq -0x70(%rbp), %rax
cmpq %rax, -0x68(%rbp)
je 0x271e
xorl %r12d, %r12d
movq 0x48fa(%rip), %r14      # 0x6fe0
leaq -0x29(%rbp), %r15
movq (%rax,%r12,8), %rsi
movq 0x30(%rsi), %rax
cmpq 0x28(%rsi), %rax
jne 0x281c
movq %r14, %rdi
movq %r15, %rsi
callq 0x2190
incq %r12
movq -0x70(%rbp), %rax
movq -0x68(%rbp), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r12, %rcx
ja 0x26ea
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2110
movsbl %al, %esi
movq 0x4894(%rip), %rdi      # 0x6fd0
callq 0x2030
movq %rax, %rdi
callq 0x20a0
movq %rax, %rbx
leaq 0x28bc(%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 0x27cc
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2110
movsbl %al, %esi
movq 0x483c(%rip), %rdi      # 0x6fd0
callq 0x2030
movq %rax, %rdi
callq 0x20a0
movq %rax, %rbx
leaq 0x2868(%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 -0x70(%rbp), %rdi
testq %rdi, %rdi
je 0x27f4
movq -0x60(%rbp), %rsi
subq %rdi, %rsi
callq 0x2130
leaq -0x80(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x280d
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x2130
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x47ad(%rip), %rdi      # 0x6fd0
callq 0x2100
movl $0x1, %edi
callq 0x2160
movq %rax, %rbx
movq -0x50(%rbp), %rdi
cmpq %r14, %rdi
je 0x2861
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2130
jmp 0x2861
jmp 0x2852
jmp 0x2852
jmp 0x2852
movq %rax, %rbx
leaq -0x90(%rbp), %rdi
callq 0x2b12
movq %rbx, %rdi
callq 0x21d0