// File: /workspace/github_cpp_makefile_star2_O1/Laakeri[P]maxpre/src/inputreader.cpp
// Function: maxPreprocessor::InputReader::readCardinalityConstraint(std::istream&)
int InputReader::readCardinalityConstraint(istream& inputF) {
	string inputLine;
	getline(inputF, inputLine);
	stringstream input(inputLine);
	string coding;
	input>>coding;
	if (input.fail()) return 1;
	int codingN;
	if (coding == "CARD") {
		codingN = CardinalityConstraint::CODING_DEFAULT;
	}
	else {
		return 1;
	}
	
	vector<int> inputLiterals;
	vector<int> outputLiterals;
	vector<int> addLiterals;
	string in;
	string compr;
	int p = 0;
	int k = 0;
	bool foundK = false;
	bool iff = 0;
	while (!input.eof() && input>>in) {
		if (input.fail()) return 1;
		if (in == "=" || in == ">=" || in == "<=" || in == ">" || in == "<" || in == "==" || in == "!=" || in == "<:" || in == ">:" || in == "::") {
			if (p != 0) return 1;
			compr = in;
			p = 1;
		}
		else if (in == "OUT") {
			if (p > 1) return 1;
			p = 2;
		}
		else if (in == "ADD") {
			if (p == 0 || p > 2) return 1;
			p = 3;
		}
		else if (in == "IFF") {
			iff = true;
		}
		else {
			stringstream ss;
			ss<<in;
			int t;
			ss>>t;
			if (!ss.eof()) return 1;
			if (ss.fail()) return 1;
			if (p == 0) {
				if (t == 0) return 1;
				inputLiterals.push_back(t);
			}
			else if (p == 1) {
				if (foundK && t == 0) break;
				if (foundK) return 1;
				foundK = true;
				k = t;
			}
			else if (p == 2) {
				if (t == 0) break;
				outputLiterals.push_back(t);
			}
			else if (p == 3) {
				if (t == 0) break;
				addLiterals.push_back(t);
			}
		}
		input>>ws;
	}
	if (!foundK) return 1;
	if (input.fail()) return 1;
	if (inputLiterals.size() == 0) return 1;
	if (compr == ">") {
		compr = ">=";
		k++;
	}
	if (compr == "<") {
		compr = "<=";
		k--;
	}
	if (compr == "==") compr = "=";
	
	int type = -1;
	
	if (compr == ">=") {
		compr = "<=";
		k = (int)inputLiterals.size() - k;
		for (int& lit : inputLiterals) {
			lit = -lit;
		}
	}
	
	if (compr == "<=") type = CardinalityConstraint::CONSTRAINT_LESS_EQ;
	else if (compr == "=") type = CardinalityConstraint::CONSTRAINT_EQUAL;
	else if (compr == "!=") type = CardinalityConstraint::CONSTRAINT_NEQUAL;
	else if (compr == "<:") type = CardinalityConstraint::CONSTRAINT_ALL_LESS;
	else if (compr == ">:") type = CardinalityConstraint::CONSTRAINT_ALL_GREATER;
	else if (compr == "::") type = CardinalityConstraint::CONSTRAINT_ALL_BOTH;
	else return 1;
	
	if (type == CardinalityConstraint::CONSTRAINT_ALL_LESS || type == CardinalityConstraint::CONSTRAINT_ALL_GREATER || type == CardinalityConstraint::CONSTRAINT_ALL_BOTH) {
		if (k != (int)outputLiterals.size()) return 1;
		if (k > (int)inputLiterals.size()) return 1;
		if (k <= 0) return 1;
	}
	else {
		if (outputLiterals.size() > 1) return 1;
	}
	
	if (outputLiterals.size() == 0) {
		iff = false;
	}
	if (type == CardinalityConstraint::CONSTRAINT_ALL_BOTH) {
		iff = true;
	}
	cardinalityConstraints.push_back(CardinalityConstraint(type, codingN, inputLiterals, outputLiterals, k, addLiterals, iff));
	if (input.fail()) return 1;
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
movq %rsi, %r14
movq %rdi, %rbx
leaq 0xe8(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq $0x0, -0x8(%rbp)
movb $0x0, (%rbp)
movq (%rsi), %rax
movq -0x18(%rax), %rdi
addq %rsi, %rdi
movl $0xa, %esi
callq 0x3280
movsbl %al, %edx
leaq 0xd8(%rsp), %rsi
movq %r14, %rdi
callq 0x34d0
movq %rbx, 0xb0(%rsp)
leaq 0xf8(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
movl $0x18, %edx
callq 0x3420
leaq 0xc8(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq $0x0, -0x8(%rbx)
movb $0x0, (%rbx)
leaq 0xf8(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0x3370
movq 0xf8(%rsp), %rax
movq -0x18(%rax), %rax
movl $0x1, %r14d
testb $0x5, 0x118(%rsp,%rax)
jne 0x252e7
leaq 0x1544d(%rip), %rsi     # 0x3a27c
leaq 0xb8(%rsp), %rdi
callq 0x30b0
testl %eax, %eax
jne 0x252e7
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %rax
movaps %xmm0, (%rax)
xorl %r12d, %r12d
movq %r12, 0x10(%rax)
leaq 0x50(%rsp), %rax
movq %r12, 0x10(%rax)
movaps %xmm0, (%rax)
leaq 0x70(%rsp), %rax
movq %r12, 0x10(%rax)
movaps %xmm0, (%rax)
leaq 0xa0(%rsp), %rax
movq %rax, -0x10(%rax)
movq %r12, -0x8(%rax)
movb %r12b, (%rax)
leaq 0x20(%rsp), %rax
movq %rax, -0x10(%rax)
movq %r12, -0x8(%rax)
movb %r12b, (%rax)
leaq 0xf8(%rsp), %r13
leaq 0x90(%rsp), %r15
movl $0x0, 0xc(%rsp)
movq $0x0, 0x68(%rsp)
movq $0x0, 0x88(%rsp)
movq 0xf8(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x118(%rsp,%rax)
jne 0x25237
movq %r13, %rdi
movq %r15, %rsi
callq 0x3370
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x25237
movq 0xf8(%rsp), %rax
movq -0x18(%rax), %rax
movl $0x1, %r14d
testb $0x5, 0x118(%rsp,%rax)
jne 0x2525e
movq %r15, %rdi
leaq 0x15370(%rip), %rsi     # 0x3a28f
callq 0x30b0
testl %eax, %eax
je 0x250ea
movq %r15, %rdi
leaq 0x1534b(%rip), %rsi     # 0x3a281
callq 0x30b0
testl %eax, %eax
je 0x250ea
movq %r15, %rdi
leaq 0x15337(%rip), %rsi     # 0x3a284
callq 0x30b0
testl %eax, %eax
je 0x250ea
movq %r15, %rdi
leaq 0x15323(%rip), %rsi     # 0x3a287
callq 0x30b0
testl %eax, %eax
je 0x250ea
movq %r15, %rdi
leaq 0x1530e(%rip), %rsi     # 0x3a289
callq 0x30b0
testl %eax, %eax
je 0x250ea
movq %r15, %rdi
leaq 0x152f9(%rip), %rsi     # 0x3a28b
callq 0x30b0
testl %eax, %eax
je 0x250ea
movq %r15, %rdi
leaq 0x152e5(%rip), %rsi     # 0x3a28e
callq 0x30b0
testl %eax, %eax
je 0x250ea
movq %r15, %rdi
leaq 0x152d1(%rip), %rsi     # 0x3a291
callq 0x30b0
testl %eax, %eax
je 0x250ea
movq %r15, %rdi
leaq 0x152bd(%rip), %rsi     # 0x3a294
callq 0x30b0
testl %eax, %eax
je 0x250ea
movq %r15, %rdi
leaq 0x152a9(%rip), %rsi     # 0x3a297
callq 0x30b0
testl %eax, %eax
je 0x250ea
movq %r15, %rdi
leaq 0x15295(%rip), %rsi     # 0x3a29a
callq 0x30b0
testl %eax, %eax
je 0x25113
movq %r15, %rdi
leaq 0x15282(%rip), %rsi     # 0x3a29e
callq 0x30b0
testl %eax, %eax
je 0x25124
movq %r15, %rdi
leaq 0x1526f(%rip), %rsi     # 0x3a2a2
callq 0x30b0
testl %eax, %eax
je 0x2513e
leaq 0x280(%rsp), %rdi
callq 0x3200
movq 0x90(%rsp), %rsi
movq 0x98(%rsp), %rdx
leaq 0x290(%rsp), %rdi
callq 0x3310
leaq 0x280(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x3190
movq 0x280(%rsp), %rax
movq -0x18(%rax), %rax
movl 0x2a0(%rsp,%rax), %eax
andl $0x7, %eax
movl $0x1, %r14d
cmpl $0x2, %eax
jne 0x2514a
cmpl $0x3, %r12d
ja 0x251d6
movl %r12d, %eax
leaq 0x151ab(%rip), %rcx     # 0x3a260
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0x8(%rsp), %eax
testl %eax, %eax
je 0x2514a
movq 0x38(%rsp), %rsi
cmpq 0x40(%rsp), %rsi
je 0x251ee
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x38(%rsp)
jmp 0x251d6
testl %r12d, %r12d
jne 0x2525e
movl $0x1, %r12d
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0x3150
movq %r13, %rdi
callq 0x3250
jmp 0x24ebe
cmpl $0x1, %r12d
movl $0x2, %r12d
jle 0x25106
jmp 0x2525e
testl %r12d, %r12d
je 0x2525e
cmpl $0x2, %r12d
movl $0x3, %r12d
jle 0x25106
jmp 0x2525e
movb $0x1, %al
movq %rax, 0x88(%rsp)
jmp 0x25106
movl $0x1, 0x4(%rsp)
jmp 0x25205
movl 0x8(%rsp), %eax
testl %eax, %eax
je 0x251c1
movq 0x58(%rsp), %rsi
cmpq 0x60(%rsp), %rsi
je 0x251e0
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x58(%rsp)
jmp 0x251d6
movl 0x8(%rsp), %eax
testl %eax, %eax
je 0x251c1
movq 0x78(%rsp), %rsi
cmpq 0x80(%rsp), %rsi
je 0x251e7
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x78(%rsp)
jmp 0x251d6
movl 0x8(%rsp), %eax
testl %eax, %eax
sete %cl
movq 0x68(%rsp), %rdx
testb $0x1, %dl
je 0x251cb
andb %dl, %cl
movzbl %cl, %eax
leal 0x1(,%rax,2), %eax
movl %eax, 0x4(%rsp)
jmp 0x25205
movl $0x3, 0x4(%rsp)
jmp 0x25205
movb $0x1, %cl
movq %rcx, 0x68(%rsp)
movl %eax, 0xc(%rsp)
movl $0x0, 0x4(%rsp)
jmp 0x25205
leaq 0x50(%rsp), %rdi
jmp 0x251f3
leaq 0x70(%rsp), %rdi
jmp 0x251f3
leaq 0x30(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x98e8
movl $0x0, 0x4(%rsp)
leaq 0x280(%rsp), %rdi
movq 0x23d9c(%rip), %rsi     # 0x48fb0
callq 0x3220
leaq 0x300(%rsp), %rdi
callq 0x30d0
movl 0x4(%rsp), %eax
testl %eax, %eax
je 0x25106
cmpl $0x3, %eax
jne 0x2525e
testb $0x1, 0x68(%rsp)
je 0x25258
movq 0xf8(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x118(%rsp,%rax)
je 0x25357
movl $0x1, %r14d
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x2527a
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x32b0
movq 0x90(%rsp), %rdi
leaq 0xa0(%rsp), %rax
cmpq %rax, %rdi
je 0x2529f
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x32b0
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x252b9
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x252d0
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x252e7
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
movq 0xb8(%rsp), %rdi
cmpq %rbx, %rdi
je 0x25304
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x32b0
movq 0x23ca5(%rip), %rsi     # 0x48fb0
leaq 0xf8(%rsp), %rdi
callq 0x3220
leaq 0x178(%rsp), %rdi
callq 0x30d0
movq 0xd8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x25342
movq 0xe8(%rsp), %rsi
incq %rsi
callq 0x32b0
movl %r14d, %eax
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x38(%rsp), %rax
cmpq 0x30(%rsp), %rax
je 0x25258
leaq 0x14f19(%rip), %rsi     # 0x3a287
leaq 0x10(%rsp), %rdi
callq 0x30b0
testl %eax, %eax
je 0x25383
movl 0xc(%rsp), %r15d
jmp 0x2539c
leaq 0x14ef7(%rip), %rsi     # 0x3a281
leaq 0x10(%rsp), %rdi
callq 0x33a0
movl 0xc(%rsp), %r15d
incl %r15d
leaq 0x14ee6(%rip), %rsi     # 0x3a289
leaq 0x10(%rsp), %rdi
callq 0x30b0
testl %eax, %eax
jne 0x253c5
leaq 0x14ecc(%rip), %rsi     # 0x3a284
leaq 0x10(%rsp), %rdi
callq 0x33a0
decl %r15d
leaq 0x14ebf(%rip), %rsi     # 0x3a28b
leaq 0x10(%rsp), %rdi
callq 0x30b0
testl %eax, %eax
jne 0x253eb
leaq 0x14eae(%rip), %rsi     # 0x3a28f
leaq 0x10(%rsp), %rdi
callq 0x33a0
leaq 0x14e8f(%rip), %rsi     # 0x3a281
leaq 0x10(%rsp), %rdi
callq 0x30b0
testl %eax, %eax
jne 0x2543b
leaq 0x14e7d(%rip), %rsi     # 0x3a284
leaq 0x10(%rsp), %rdi
callq 0x33a0
movq 0x30(%rsp), %rcx
movq 0x38(%rsp), %rdx
movq %rdx, %rax
subq %rcx, %rax
shrq $0x2, %rax
subl %r15d, %eax
cmpq %rcx, %rdx
je 0x25438
negl (%rcx)
addq $0x4, %rcx
cmpq %rdx, %rcx
jne 0x2542d
movl %eax, %r15d
leaq 0x14e42(%rip), %rsi     # 0x3a284
leaq 0x10(%rsp), %rdi
callq 0x30b0
testl %eax, %eax
je 0x254db
leaq 0x14e34(%rip), %rsi     # 0x3a28f
leaq 0x10(%rsp), %rdi
callq 0x30b0
testl %eax, %eax
je 0x254e2
leaq 0x14e1e(%rip), %rsi     # 0x3a28e
leaq 0x10(%rsp), %rdi
callq 0x30b0
testl %eax, %eax
je 0x254e9
leaq 0x14e0c(%rip), %rsi     # 0x3a291
leaq 0x10(%rsp), %rdi
callq 0x30b0
movb $0x1, %r14b
testl %eax, %eax
je 0x255d4
leaq 0x14df3(%rip), %rsi     # 0x3a294
leaq 0x10(%rsp), %rdi
callq 0x30b0
testl %eax, %eax
je 0x255db
leaq 0x14ddd(%rip), %rsi     # 0x3a297
leaq 0x10(%rsp), %rdi
callq 0x30b0
movl $0x1, %r14d
testl %eax, %eax
jne 0x2525e
movl $0x6, %esi
movb $0x1, %al
jmp 0x254f0
movl $0x3, %esi
jmp 0x254ee
movl $0x1, %esi
jmp 0x254ee
movl $0x2, %esi
xorl %eax, %eax
xorl %r14d, %r14d
orb %al, %r14b
movq 0x58(%rsp), %rcx
subq 0x50(%rsp), %rcx
cmpb $0x1, %r14b
jne 0x2553d
shrq $0x2, %rcx
cmpl %ecx, %r15d
jne 0x25258
testl %r15d, %r15d
jle 0x25258
movq 0x38(%rsp), %rcx
subq 0x30(%rsp), %rcx
shrq $0x2, %rcx
movl $0x1, %r14d
movl %r15d, %r9d
cmpl %ecx, %r15d
jle 0x25550
jmp 0x2525e
movl %r15d, %r9d
movl $0x1, %r14d
cmpq $0x4, %rcx
ja 0x2525e
leaq 0x50(%rsp), %r8
movq (%r8), %rcx
cmpq %rcx, 0x8(%r8)
setne %cl
andb 0x88(%rsp), %cl
orb %cl, %al
leaq 0x70(%rsp), %r10
movzbl %al, %eax
leaq 0x280(%rsp), %rdi
leaq 0x30(%rsp), %rcx
movl $0x1, %edx
pushq %rax
pushq %r10
callq 0x33680
addq $0x10, %rsp
movq 0xb0(%rsp), %rdi
addq $0x70, %rdi
leaq 0x280(%rsp), %rsi
callq 0x26d8e
leaq 0x280(%rsp), %rdi
callq 0x2698e
movq 0xf8(%rsp), %rax
movq -0x18(%rax), %rax
xorl %r14d, %r14d
testb $0x5, 0x118(%rsp,%rax)
setne %r14b
jmp 0x2525e
movl $0x4, %esi
jmp 0x255e0
movl $0x5, %esi
xorl %eax, %eax
jmp 0x254f3
jmp 0x255eb
jmp 0x2563b
movq %rax, %r14
movq 0x239bb(%rip), %rsi     # 0x48fb0
leaq 0x280(%rsp), %rdi
callq 0x3220
leaq 0x300(%rsp), %rdi
callq 0x30d0
jmp 0x2563e
movq %rax, %r14
leaq 0x280(%rsp), %rdi
callq 0x2698e
jmp 0x2563e
jmp 0x2563b
jmp 0x2563b
jmp 0x2563b
movq %rax, %r14
jmp 0x256c7
jmp 0x25633
movq %rax, %r14
jmp 0x25705
movq %rax, %r14
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x2565a
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x32b0
movq 0x90(%rsp), %rdi
leaq 0xa0(%rsp), %rax
cmpq %rax, %rdi
je 0x2567f
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x32b0
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x25699
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x256b0
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x256c7
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
movq 0xb8(%rsp), %rdi
cmpq %rbx, %rdi
je 0x256e4
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x32b0
movq 0x238c5(%rip), %rsi     # 0x48fb0
leaq 0xf8(%rsp), %rdi
callq 0x3220
leaq 0x178(%rsp), %rdi
callq 0x30d0
movq 0xd8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x25722
movq 0xe8(%rsp), %rsi
incq %rsi
callq 0x32b0
movq %r14, %rdi
callq 0x34a0