// File: /workspace/github_cpp_makefile_star2_O3/reedoolang[P]reedoo/cond.cc
// Function: eval_cond(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
bool eval_cond(string cond) {

	string term = "";
	bool state = 0;
	int and_or_count = 0;
	bool r = true;

	for (int i = 0; i < cond.size(); i++) {
		
		if (cond[i] == '"') {
			if (state == 0) {
				state = 1;
			} else {
				state = 0;
			}
		}

		if (cond[i] == ' ' and state == 0) {
			terms.push_back(term);
			term = "";
		}
		else {
			term += cond[i];	
		}
	}

	for (int i = 0; i < terms.size(); i++) {
		//cout << terms[i] << " ";
	}
	//cout << endl;

	for (int i = 0; i < terms.size(); i++) {

		if (terms[i] == "or") {
			and_or_count++;
			if (i-3 >= 0 and i+3 < terms.size()) {
				if (terms[i] == "or") {
					if (terms[i-3] == terms[i-1]) {
						terms.clear();
						return true;
					} else {
						r = false;
					}

					if (terms[i+1] == terms[i+3]) {
						r = true;
					} else {
						r = false;
					}
				}
				
			}
		}

		if (terms[i] == "and") {
			and_or_count++;
			if (i-3 >= 0 and i+3 < terms.size()) {

				if (terms[i-3] != terms[i-1]) {
					terms.clear();
					return false;
				} else {
					r = true;
				}

				if (terms[i+1] != terms[i+3]) {
					r= false;
				} else {
					r = true;
				}
			}
		}
	}

	if (and_or_count == 0) {
		for (int i = 0; i < terms.size(); i++) {
			if (terms[i] == terms[i+2]) {
				terms.clear();
				return true;
			} else {
				terms.clear();
				return false;
			}
		}
	}

	terms.clear();
	
	return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x121c(%rip), %rdx      # 0xe179
leaq 0x8(%rsp), %rdi
movq %rdx, %rsi
callq 0x326a
cmpq $0x0, 0x8(%rbx)
je 0xcfdc
xorl %r13d, %r13d
leaq 0x462d(%rip), %r14      # 0x115a8
leaq 0x8(%rsp), %r15
leaq 0x11f2(%rip), %r12      # 0xe179
xorl %ebp, %ebp
movl %ebp, %ecx
movq (%rbx), %rax
movb (%rax,%r13), %al
cmpb $0x22, %al
sete %bpl
xorb %cl, %bpl
cmpb $0x20, %al
jne 0xcfc8
movl %ebp, %ecx
andb $0x1, %cl
jne 0xcfc8
movq %r14, %rdi
movq %r15, %rsi
callq 0x68a8
movq 0x10(%rsp), %rdx
movq %r15, %rdi
xorl %esi, %esi
movq %r12, %rcx
xorl %r8d, %r8d
callq 0x22d0
jmp 0xcfd3
movsbl %al, %esi
movq %r15, %rdi
callq 0x2190
incq %r13
cmpq %r13, 0x8(%rbx)
ja 0xcf89
movq 0x45cd(%rip), %rbx      # 0x115b0
movq 0x45be(%rip), %r15      # 0x115a8
cmpq %r15, %rbx
je 0xd1aa
xorl %r12d, %r12d
movb $0x1, %al
movl %eax, 0x4(%rsp)
movl $0x3, %r13d
xorl %ebp, %ebp
leaq -0x3(%r13), %r14
addq %r12, %r15
movq %r15, %rdi
leaq 0x1101(%rip), %rsi      # 0xe116
callq 0x20b0
testl %eax, %eax
je 0xd02a
movq 0x4583(%rip), %r15      # 0x115a8
jmp 0xd0cd
incl %ebp
movq 0x4575(%rip), %r15      # 0x115a8
cmpq $0x3, %r14
jb 0xd0cd
movq 0x456c(%rip), %rax      # 0x115b0
subq %r15, %rax
sarq $0x5, %rax
cmpq %r13, %rax
jbe 0xd0cd
addq %r12, %r15
movq %r15, %rdi
leaq 0x10b9(%rip), %rsi      # 0xe116
callq 0x20b0
movq 0x453f(%rip), %r15      # 0x115a8
testl %eax, %eax
jne 0xd0cd
movq -0x58(%r15,%r12), %rdx
cmpq -0x18(%r15,%r12), %rdx
jne 0xd099
testq %rdx, %rdx
je 0xd250
movq -0x60(%r15,%r12), %rdi
movq -0x20(%r15,%r12), %rsi
callq 0x21f0
testl %eax, %eax
je 0xd250
movq 0x28(%r15,%r12), %rdx
cmpq 0x68(%r15,%r12), %rdx
jne 0xd0bd
testq %rdx, %rdx
je 0xd0c7
movq 0x20(%r15,%r12), %rdi
movq 0x60(%r15,%r12), %rsi
callq 0x21f0
testl %eax, %eax
je 0xd0c7
movl $0x0, 0x4(%rsp)
jmp 0xd0cd
movb $0x1, %al
movl %eax, 0x4(%rsp)
addq %r12, %r15
movq %r15, %rdi
leaq 0x1038(%rip), %rsi      # 0xe112
callq 0x20b0
testl %eax, %eax
je 0xd0f6
movq 0x44c6(%rip), %rbx      # 0x115b0
movq 0x44b7(%rip), %r15      # 0x115a8
jmp 0xd179
incl %ebp
movq 0x44b1(%rip), %rbx      # 0x115b0
movq 0x44a2(%rip), %r15      # 0x115a8
cmpq $0x3, %r14
jb 0xd179
movq %rbx, %rax
subq %r15, %rax
sarq $0x5, %rax
cmpq %r13, %rax
jbe 0xd179
movq -0x58(%r15,%r12), %rdx
cmpq -0x18(%r15,%r12), %rdx
jne 0xd238
testq %rdx, %rdx
je 0xd147
movq -0x60(%r15,%r12), %rdi
movq -0x20(%r15,%r12), %rsi
callq 0x21f0
testl %eax, %eax
jne 0xd238
movq 0x28(%r15,%r12), %rdx
cmpq 0x68(%r15,%r12), %rdx
jne 0xd171
movb $0x1, %al
movl %eax, 0x4(%rsp)
testq %rdx, %rdx
je 0xd179
movq 0x20(%r15,%r12), %rdi
movq 0x60(%r15,%r12), %rsi
callq 0x21f0
testl %eax, %eax
je 0xd179
movl $0x0, 0x4(%rsp)
movq %rbx, %rax
subq %r15, %rax
sarq $0x5, %rax
addq $0x20, %r12
leaq 0x1(%r13), %rcx
addq $-0x2, %r13
cmpq %r13, %rax
movq %rcx, %r13
ja 0xd004
testl %ebp, %ebp
leaq 0x18(%rsp), %r14
movl 0x4(%rsp), %ebp
jne 0xd1e9
jmp 0xd1b2
movb $0x1, %bpl
leaq 0x18(%rsp), %r14
cmpq %r15, %rbx
je 0xd1e9
movq 0x8(%r15), %rdx
cmpq 0x48(%r15), %rdx
jne 0xd1d6
testq %rdx, %rdx
je 0xd224
movq (%r15), %rdi
movq 0x40(%r15), %rsi
callq 0x21f0
testl %eax, %eax
je 0xd224
leaq 0x43cb(%rip), %rdi      # 0x115a8
movq %r15, %rsi
callq 0xcc7a
xorl %ebp, %ebp
jmp 0xd1f8
leaq 0x43b8(%rip), %rdi      # 0x115a8
movq %r15, %rsi
callq 0xcc7a
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0xd20f
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21e0
andb $0x1, %bpl
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x437d(%rip), %rdi      # 0x115a8
movq %r15, %rsi
callq 0xcc7a
movb $0x1, %bpl
jmp 0xd1f8
leaq 0x4369(%rip), %rdi      # 0x115a8
movq %r15, %rsi
callq 0xcc7a
xorl %ebp, %ebp
leaq 0x18(%rsp), %r14
jmp 0xd1f8
leaq 0x4351(%rip), %rdi      # 0x115a8
movq %r15, %rsi
callq 0xcc7a
movb $0x1, %bpl
jmp 0xd249
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0xd283
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21e0
movq %rbx, %rdi
callq 0x2320