// File: /workspace/github_cpp_makefile_star2_O3/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 0x280(%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 0x280(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0x3370
movq 0x280(%rsp), %rax
movq -0x18(%rax), %rax
movl $0x1, %r14d
testb $0x5, 0x2a0(%rsp,%rax)
jne 0x245b0
leaq 0x15223(%rip), %rsi     # 0x39320
leaq 0xb8(%rsp), %rdi
callq 0x30b0
testl %eax, %eax
jne 0x245b0
xorps %xmm0, %xmm0
leaq 0x38(%rsp), %rax
movaps %xmm0, -0x8(%rax)
xorl %r12d, %r12d
movq %r12, 0x8(%rax)
leaq 0x58(%rsp), %rax
movq %r12, 0x8(%rax)
movaps %xmm0, -0x8(%rax)
leaq 0x78(%rsp), %rax
movq %r12, 0x8(%rax)
movaps %xmm0, -0x8(%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 0x280(%rsp), %r13
leaq 0x90(%rsp), %r15
movl $0x0, 0xc(%rsp)
movq $0x0, 0x68(%rsp)
movq $0x0, 0x88(%rsp)
movl $0x1, %r14d
movq 0x280(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x2a0(%rsp,%rax)
jne 0x24500
movq %r13, %rdi
movq %r15, %rsi
callq 0x3370
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x24500
movq 0x280(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x2a0(%rsp,%rax)
jne 0x24527
movq %r15, %rdi
leaq 0x15143(%rip), %rsi     # 0x39333
callq 0x30b0
testl %eax, %eax
je 0x243b1
movq %r15, %rdi
leaq 0x1511e(%rip), %rsi     # 0x39325
callq 0x30b0
testl %eax, %eax
je 0x243b1
movq %r15, %rdi
leaq 0x1510a(%rip), %rsi     # 0x39328
callq 0x30b0
testl %eax, %eax
je 0x243b1
movq %r15, %rdi
leaq 0x150f6(%rip), %rsi     # 0x3932b
callq 0x30b0
testl %eax, %eax
je 0x243b1
movq %r15, %rdi
leaq 0x150e1(%rip), %rsi     # 0x3932d
callq 0x30b0
testl %eax, %eax
je 0x243b1
movq %r15, %rdi
leaq 0x150cc(%rip), %rsi     # 0x3932f
callq 0x30b0
testl %eax, %eax
je 0x243b1
movq %r15, %rdi
leaq 0x150b8(%rip), %rsi     # 0x39332
callq 0x30b0
testl %eax, %eax
je 0x243b1
movq %r15, %rdi
leaq 0x150a4(%rip), %rsi     # 0x39335
callq 0x30b0
testl %eax, %eax
je 0x243b1
movq %r15, %rdi
leaq 0x15090(%rip), %rsi     # 0x39338
callq 0x30b0
testl %eax, %eax
je 0x243b1
movq %r15, %rdi
leaq 0x1507c(%rip), %rsi     # 0x3933b
callq 0x30b0
testl %eax, %eax
je 0x243b1
movq %r15, %rdi
leaq 0x15068(%rip), %rsi     # 0x3933e
callq 0x30b0
testl %eax, %eax
je 0x243da
movq %r15, %rdi
leaq 0x15055(%rip), %rsi     # 0x39342
callq 0x30b0
testl %eax, %eax
je 0x243eb
movq %r15, %rdi
leaq 0x15042(%rip), %rsi     # 0x39346
callq 0x30b0
testl %eax, %eax
je 0x24405
leaq 0xf8(%rsp), %rdi
callq 0x3200
movq 0x90(%rsp), %rsi
movq 0x98(%rsp), %rdx
leaq 0x108(%rsp), %rdi
callq 0x3310
leaq 0xf8(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x3190
movq 0xf8(%rsp), %rax
movq -0x18(%rax), %rax
movl 0x118(%rsp,%rax), %eax
andl $0x7, %eax
cmpl $0x2, %eax
jne 0x244bc
cmpl $0x3, %r12d
ja 0x24496
movl %r12d, %eax
leaq 0x14f90(%rip), %rcx     # 0x39310
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0x8(%rsp), %eax
testl %eax, %eax
je 0x244bc
movq 0x38(%rsp), %rsi
cmpq 0x40(%rsp), %rsi
je 0x24487
movl %eax, (%rsi)
leaq 0x38(%rsp), %rax
jmp 0x24454
testl %r12d, %r12d
jne 0x24527
movl $0x1, %r12d
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0x3150
movq %r13, %rdi
callq 0x3250
jmp 0x24195
cmpl $0x1, %r12d
movl $0x2, %r12d
jle 0x243cd
jmp 0x24527
testl %r12d, %r12d
je 0x24527
cmpl $0x2, %r12d
movl $0x3, %r12d
jle 0x243cd
jmp 0x24527
movb $0x1, %al
movq %rax, 0x88(%rsp)
jmp 0x243cd
movl 0x8(%rsp), %eax
testl %eax, %eax
je 0x244df
movq 0x58(%rsp), %rsi
cmpq 0x60(%rsp), %rsi
je 0x24479
movl %eax, (%rsi)
leaq 0x58(%rsp), %rax
jmp 0x24454
movl 0x8(%rsp), %eax
testl %eax, %eax
je 0x244df
movq 0x78(%rsp), %rsi
cmpq 0x80(%rsp), %rsi
je 0x24480
movl %eax, (%rsi)
leaq 0x78(%rsp), %rax
addq $0x4, %rsi
movq %rsi, (%rax)
jmp 0x24496
movl 0x8(%rsp), %eax
testb $0x1, 0x68(%rsp)
jne 0x248b6
movl %eax, 0xc(%rsp)
movb $0x1, %al
movq %rax, 0x68(%rsp)
jmp 0x24496
leaq 0x50(%rsp), %rdi
jmp 0x2448c
leaq 0x70(%rsp), %rdi
jmp 0x2448c
leaq 0x30(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x98f8
leaq 0xf8(%rsp), %rdi
movq 0x23b0b(%rip), %rsi     # 0x47fb0
callq 0x3220
leaq 0x178(%rsp), %rdi
callq 0x30d0
jmp 0x243cd
movq 0x23aed(%rip), %rsi     # 0x47fb0
leaq 0xf8(%rsp), %rdi
callq 0x3220
leaq 0x178(%rsp), %rdi
callq 0x30d0
jmp 0x24527
movq 0x23aca(%rip), %rsi     # 0x47fb0
leaq 0xf8(%rsp), %rdi
callq 0x3220
leaq 0x178(%rsp), %rdi
callq 0x30d0
movl $0x1, %r14d
testb $0x1, 0x68(%rsp)
je 0x24527
movq 0x280(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x2a0(%rsp,%rax)
je 0x24620
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x24543
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x32b0
movq 0x90(%rsp), %rdi
leaq 0xa0(%rsp), %rax
cmpq %rax, %rdi
je 0x24568
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x32b0
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x24582
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x24599
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x245b0
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
movq 0xb8(%rsp), %rdi
cmpq %rbx, %rdi
je 0x245cd
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x32b0
movq 0x239dc(%rip), %rsi     # 0x47fb0
leaq 0x280(%rsp), %rdi
callq 0x3220
leaq 0x300(%rsp), %rdi
callq 0x30d0
movq 0xd8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x2460b
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 0x24527
leaq 0x14cf4(%rip), %rsi     # 0x3932b
leaq 0x10(%rsp), %rdi
callq 0x30b0
testl %eax, %eax
je 0x2464c
movl 0xc(%rsp), %r15d
jmp 0x24665
leaq 0x14cd2(%rip), %rsi     # 0x39325
leaq 0x10(%rsp), %rdi
callq 0x33a0
movl 0xc(%rsp), %r15d
incl %r15d
leaq 0x14cc1(%rip), %rsi     # 0x3932d
leaq 0x10(%rsp), %rdi
callq 0x30b0
testl %eax, %eax
jne 0x2468e
leaq 0x14ca7(%rip), %rsi     # 0x39328
leaq 0x10(%rsp), %rdi
callq 0x33a0
decl %r15d
leaq 0x14c9a(%rip), %rsi     # 0x3932f
leaq 0x10(%rsp), %rdi
callq 0x30b0
testl %eax, %eax
jne 0x246b4
leaq 0x14c89(%rip), %rsi     # 0x39333
leaq 0x10(%rsp), %rdi
callq 0x33a0
leaq 0x14c6a(%rip), %rsi     # 0x39325
leaq 0x10(%rsp), %rdi
callq 0x30b0
testl %eax, %eax
jne 0x24704
leaq 0x14c58(%rip), %rsi     # 0x39328
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 0x24701
negl (%rcx)
addq $0x4, %rcx
cmpq %rdx, %rcx
jne 0x246f6
movl %eax, %r15d
leaq 0x14c1d(%rip), %rsi     # 0x39328
leaq 0x10(%rsp), %rdi
callq 0x30b0
testl %eax, %eax
je 0x247a4
leaq 0x14c0f(%rip), %rsi     # 0x39333
leaq 0x10(%rsp), %rdi
callq 0x30b0
testl %eax, %eax
je 0x247ae
leaq 0x14bf9(%rip), %rsi     # 0x39332
leaq 0x10(%rsp), %rdi
callq 0x30b0
testl %eax, %eax
je 0x247b8
leaq 0x14be7(%rip), %rsi     # 0x39335
leaq 0x10(%rsp), %rdi
callq 0x30b0
testl %eax, %eax
je 0x2485d
leaq 0x14bd1(%rip), %rsi     # 0x39338
leaq 0x10(%rsp), %rdi
callq 0x30b0
testl %eax, %eax
je 0x24864
leaq 0x14bbb(%rip), %rsi     # 0x3933b
leaq 0x10(%rsp), %rdi
callq 0x30b0
movl $0x1, %r14d
testl %eax, %eax
jne 0x24527
movb $0x1, %al
movl $0x6, %esi
jmp 0x2486b
movl %r15d, %r9d
movl $0x3, %esi
jmp 0x247c0
movl %r15d, %r9d
movl $0x1, %esi
jmp 0x247c0
movl %r15d, %r9d
movl $0x2, %esi
movq 0x50(%rsp), %rcx
movq 0x58(%rsp), %rdx
movq %rdx, %rax
subq %rcx, %rax
cmpq $0x4, %rax
ja 0x24527
xorl %eax, %eax
cmpq %rcx, %rdx
setne %cl
andb 0x88(%rsp), %cl
orb %al, %cl
leaq 0x70(%rsp), %rax
movzbl %cl, %r10d
leaq 0xf8(%rsp), %rdi
leaq 0x30(%rsp), %rcx
leaq 0x50(%rsp), %r8
movl $0x1, %edx
pushq %r10
pushq %rax
callq 0x326a8
addq $0x10, %rsp
movq 0xb0(%rsp), %rdi
addq $0x70, %rdi
leaq 0xf8(%rsp), %rsi
callq 0x2609e
leaq 0xf8(%rsp), %rdi
callq 0x25ca0
movq 0x280(%rsp), %rax
movq -0x18(%rax), %rax
xorl %r14d, %r14d
testb $0x5, 0x2a0(%rsp,%rax)
setne %r14b
jmp 0x24527
movl $0x4, %esi
jmp 0x24869
movl $0x5, %esi
xorl %eax, %eax
movq 0x50(%rsp), %rcx
movq 0x58(%rsp), %rdx
movq %rdx, %rdi
subq %rcx, %rdi
shrq $0x2, %rdi
movl $0x1, %r14d
cmpl %edi, %r15d
jne 0x24527
testl %r15d, %r15d
jle 0x24527
movq 0x38(%rsp), %rdi
subq 0x30(%rsp), %rdi
shrq $0x2, %rdi
movl %r15d, %r9d
cmpl %edi, %r15d
jle 0x247dc
jmp 0x24527
movq 0x236f3(%rip), %rsi     # 0x47fb0
leaq 0xf8(%rsp), %rdi
movl %eax, %r15d
callq 0x3220
leaq 0x178(%rsp), %rdi
callq 0x30d0
testl %r15d, %r15d
jne 0x24527
jmp 0x24500
jmp 0x248ec
jmp 0x2493c
movq %rax, %r14
movq 0x236ba(%rip), %rsi     # 0x47fb0
leaq 0xf8(%rsp), %rdi
callq 0x3220
leaq 0x178(%rsp), %rdi
callq 0x30d0
jmp 0x2493f
jmp 0x2493c
movq %rax, %r14
leaq 0xf8(%rsp), %rdi
callq 0x25ca0
jmp 0x2493f
jmp 0x2493c
jmp 0x2493c
movq %rax, %r14
jmp 0x249c8
jmp 0x24934
movq %rax, %r14
jmp 0x24a06
movq %rax, %r14
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x2495b
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x32b0
movq 0x90(%rsp), %rdi
leaq 0xa0(%rsp), %rax
cmpq %rax, %rdi
je 0x24980
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x32b0
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x2499a
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x249b1
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x249c8
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
movq 0xb8(%rsp), %rdi
cmpq %rbx, %rdi
je 0x249e5
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x32b0
movq 0x235c4(%rip), %rsi     # 0x47fb0
leaq 0x280(%rsp), %rdi
callq 0x3220
leaq 0x300(%rsp), %rdi
callq 0x30d0
movq 0xd8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x24a23
movq 0xe8(%rsp), %rsi
incq %rsi
callq 0x32b0
movq %r14, %rdi
callq 0x34a0
nop