// File: /workspace/github_cpp_makefile_star2_O2/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 0x7d2(%rip), %r14       # 0x9192
leaq 0x8(%rsp), %r15
leaq 0x7(%rsp), %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x2d6a
xorl %r13d, %r13d
leaq 0x4bb9(%rip), %r12      # 0xd598
xorl %ebp, %ebp
cmpq %r13, 0x8(%rbx)
jbe 0x8a29
movq (%rbx), %rax
movb (%rax,%r13), %al
cmpb $0x22, %al
sete %cl
xorb %cl, %bpl
cmpb $0x20, %al
jne 0x8a19
movl %ebp, %ecx
andb $0x1, %cl
jne 0x8a19
movq %r12, %rdi
movq %r15, %rsi
callq 0x4ee4
movq %r15, %rdi
movq %r14, %rsi
callq 0x2320
jmp 0x8a24
movsbl %al, %esi
movq %r15, %rdi
callq 0x21a0
incq %r13
jmp 0x89e1
movb $0x1, %bpl
xorl %r15d, %r15d
pushq $-0x60
popq %r12
leaq 0x6f5(%rip), %rbx       # 0x912f
leaq 0x6ea(%rip), %r14       # 0x912b
xorl %r13d, %r13d
movq 0x4b55(%rip), %rax      # 0xd5a0
movq 0x4b46(%rip), %rdi      # 0xd598
movq %rax, %rcx
subq %rdi, %rcx
sarq $0x5, %rcx
cmpq %r15, %rcx
jbe 0x8b80
addq %r12, %rdi
addq $0x60, %rdi
movq %rbx, %rsi
callq 0x2e1b
testb %al, %al
je 0x8af6
incl %r13d
cmpq $0x3, %r15
jb 0x8af6
leaq 0x3(%r15), %rcx
movq 0x4b14(%rip), %rdx      # 0xd5a0
movq 0x4b05(%rip), %rax      # 0xd598
subq %rax, %rdx
sarq $0x5, %rdx
cmpq %rcx, %rdx
jbe 0x8af6
leaq (%rax,%r12), %rdi
addq $0x60, %rdi
movq %rbx, %rsi
callq 0x2e1b
testb %al, %al
je 0x8af6
movq 0x4ade(%rip), %rdi      # 0xd598
leaq (%rdi,%r12), %rsi
addq $0x40, %rsi
addq %r12, %rdi
callq 0x4e3a
testb %al, %al
jne 0x8bca
movq 0x4abf(%rip), %rax      # 0xd598
leaq (%rax,%r12), %rdi
addq $0x80, %rdi
leaq (%rax,%r12), %rsi
addq $0xc0, %rsi
callq 0x4e3a
movl %eax, %ebp
movq 0x4a9b(%rip), %rax      # 0xd598
leaq (%rax,%r12), %rdi
addq $0x60, %rdi
movq %r14, %rsi
callq 0x2e1b
testb %al, %al
je 0x8b74
incl %r13d
cmpq $0x3, %r15
jb 0x8b74
leaq 0x3(%r15), %rax
movq 0x4a7b(%rip), %rcx      # 0xd5a0
movq 0x4a6c(%rip), %rdi      # 0xd598
subq %rdi, %rcx
sarq $0x5, %rcx
cmpq %rax, %rcx
jbe 0x8b74
leaq (%rdi,%r12), %rsi
addq $0x40, %rsi
addq %r12, %rdi
callq 0x68e9
testb %al, %al
jne 0x8bc6
movq 0x4a45(%rip), %rax      # 0xd598
leaq (%rax,%r12), %rdi
addq $0x80, %rdi
leaq (%rax,%r12), %rsi
addq $0xc0, %rsi
callq 0x68e9
movl %eax, %ebp
xorb $0x1, %bpl
incq %r15
addq $0x20, %r12
jmp 0x8a44
testl %r13d, %r13d
setne %cl
cmpq %rdi, %rax
sete %al
orb %cl, %al
jne 0x8b9b
leaq 0x40(%rdi), %rsi
callq 0x4e3a
movl %eax, %ebp
leaq 0x49f6(%rip), %rdi      # 0xd598
callq 0x8484
leaq 0x8(%rsp), %rdi
callq 0x2110
andb $0x1, %bpl
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ebp, %ebp
jmp 0x8b9b
movb $0x1, %bpl
jmp 0x8b9b
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x2110
movq %rbx, %rdi
callq 0x22f0