// File: /workspace/github_cpp_makefile_star2_O1/Laakeri[P]maxpre/src/inputreader.cpp
// Function: maxPreprocessor::InputReader::readClauses(std::istream&, bool)
int InputReader::readClauses(istream& input, bool maxSat) {
	clauses.clear();
	weights.clear();
	cardinalityConstraints.clear();
	readError = "";
	currentLine = 0;
	string line;
	while (getline(input, line)) {
		currentLine++;
		if (line.size() > 0 && line[0] == 'p') break;
	}
	if (line.size() == 0 || line[0] != 'p') {
		readError = "Cannot find the p-line of the input";
		return 1;
	}
	stringstream parameterLine;
	parameterLine<<line;
	parameterLine>>line;
	if (line != "p") {
		readError = "Invalid p-line of the input (line "+to_string(currentLine)+")";
		return 1;
	}
	parameterLine>>line>>nbvar>>nbclauses;
	clauses.reserve(nbclauses);
	weights.reserve(nbclauses);
	if (parameterLine.fail()) {
		readError = "Invalid p-line of the input (line "+to_string(currentLine)+")";
		return 1;
	}
	if (line == "wcnf" && maxSat) {
		inputFormat = INPUT_FORMAT_WPMS;
		if (!(parameterLine>>top)) {
			cerr<<"Weighted Max-SAT input format"<<endl;
			top = (1ull << 63ull) - 1;
		}
		else {
			cerr<<"Weighted Partial Max-SAT input format"<<endl;
		}
		cerr<<"Top "<<top<<endl;
	}
	else if (line == "cnf" && maxSat) {
		inputFormat = INPUT_FORMAT_MS;
		cerr<<"Max-SAT input format"<<endl;
		top = (1ull << 63ull) - 1;
	}
	else if (line == "cnf" && !maxSat) {
		inputFormat = INPUT_FORMAT_SAT;
		cerr<<"SAT input format"<<endl;
		top = (1ull << 63ull) - 1;
	}
	else {
		readError = "Invalid p-line of the input (problem type "+line+" and the dimacs format do not match) (line "+to_string(currentLine)+")";
		return 1;
	}
	while (1) {
		currentLine++;
		int status = readLine(input);
		if (status == 1) break;
		else if (status == 2) return 1;
		assert(status == 0);
	}
	int freeVar = 1;
	for (auto& clause : clauses) {
		for (int lit : clause) {
			freeVar = max(freeVar, abs(lit) + 1);
		}
	}
	for (auto& cc : cardinalityConstraints) {
		for (int lit : cc.inputLiterals) freeVar = max(freeVar, abs(lit) + 1);
		for (int lit : cc.outputLiterals) freeVar = max(freeVar, abs(lit) + 1);
		for (int lit : cc.addLiterals) freeVar = max(freeVar, abs(lit) + 1);
	}
	for (auto& cc : cardinalityConstraints) {
		vector<vector<int> > cls = cc.getClauses(freeVar);
		for (auto& clause : cls) {
			clauses.push_back(clause);
			weights.push_back(top);
			for (int lit : clause) {
				freeVar = max(freeVar, abs(lit) + 1);
			}
		}
	}
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x268, %rsp            # imm = 0x268
movl %edx, %ebp
movq %rsi, %r13
movq %rdi, %rbx
addq $0x40, %rdi
movq 0x40(%rbx), %rsi
movq %rdi, 0x88(%rsp)
callq 0x9c52
movq 0x58(%rbx), %rax
cmpq %rax, 0x60(%rbx)
je 0x25ef4
movq %rax, 0x60(%rbx)
leaq 0x58(%rbx), %rax
movq %rax, 0x80(%rsp)
leaq 0x70(%rbx), %rdi
movq 0x70(%rbx), %rsi
callq 0x27156
leaq 0x10(%rbx), %r12
movq 0x18(%rbx), %rdx
leaq 0x1510f(%rip), %rcx     # 0x3b02b
movq %r12, %rdi
xorl %esi, %esi
xorl %r8d, %r8d
callq 0x3400
movl $0x0, 0x8(%rbx)
leaq 0x50(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x40(%rsp), %r15
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x3280
movsbl %al, %edx
movq %r13, %rdi
movq %r15, %rsi
callq 0x34d0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x25f8f
incl 0x8(%rbx)
cmpq $0x0, 0x48(%rsp)
je 0x25f49
movq 0x40(%rsp), %rax
cmpb $0x70, (%rax)
jne 0x25f49
cmpq $0x0, 0x48(%rsp)
je 0x26060
movq 0x40(%rsp), %rax
cmpb $0x70, (%rax)
jne 0x26060
leaq 0xe0(%rsp), %rdi
callq 0x3200
leaq 0xf0(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
callq 0x3310
leaq 0xe0(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x3370
leaq 0x12bcc(%rip), %rsi     # 0x38bb2
leaq 0x40(%rsp), %rdi
callq 0x30b0
testl %eax, %eax
je 0x26086
movl 0x8(%rbx), %ebx
movl %ebx, %ebp
negl %ebp
cmovsl %ebx, %ebp
movl $0x1, %r14d
cmpl $0xa, %ebp
jb 0x261df
movl $0x4, %r14d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %ebp, %ecx
cmpl $0x63, %ecx
jbe 0x261d6
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0x261dc
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0x261df
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r14d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x2601e
addl $-0x3, %r14d
jmp 0x261df
movq 0x18(%rbx), %rdx
movl $0x1, %r14d
leaq 0x1429d(%rip), %rcx     # 0x3a30e
movl $0x23, %r8d
movq %r12, %rdi
xorl %esi, %esi
callq 0x3400
jmp 0x26493
leaq 0xe0(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x3370
movq %rax, %rdi
movq %rbx, %rsi
callq 0x3190
leaq 0x4(%rbx), %r15
movq %rax, %rdi
movq %r15, %rsi
callq 0x3190
movslq (%r15), %rsi
movq 0x88(%rsp), %rdi
callq 0x26a76
movslq (%r15), %rsi
movq 0x80(%rsp), %rdi
callq 0x26b5c
movq 0xe0(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x100(%rsp,%rax)
je 0x26150
movl 0x8(%rbx), %ebx
movl %ebx, %ebp
negl %ebp
cmovsl %ebx, %ebp
movl $0x1, %r14d
cmpl $0xa, %ebp
jb 0x26336
movl $0x4, %r14d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %ebp, %ecx
cmpl $0x63, %ecx
jbe 0x2632d
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0x26333
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0x26336
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r14d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x2610e
addl $-0x3, %r14d
jmp 0x26336
leaq 0x12401(%rip), %rsi     # 0x38558
leaq 0x40(%rsp), %rdi
callq 0x30b0
testl %eax, %eax
setne %al
movl %ebp, %ecx
xorb $0x1, %cl
orb %al, %cl
jne 0x26283
movl $0x1, 0x38(%rbx)
leaq 0x30(%rbx), %r15
leaq 0xe0(%rsp), %rdi
movq %r15, %rsi
callq 0x3160
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
je 0x264c4
movq 0x22e49(%rip), %rdi     # 0x48ff0
leaq 0x141a7(%rip), %rsi     # 0x3a355
movl $0x1d, %edx
callq 0x3310
movq 0x22e31(%rip), %rdi     # 0x48ff0
callq 0x3130
movabsq $0x7fffffffffffffff, %rax # imm = 0x7FFFFFFFFFFFFFFF
movq %rax, (%r15)
jmp 0x264e8
addl $-0x2, %r14d
jmp 0x261df
decl %r14d
shrl $0x1f, %ebx
leal (%r14,%rbx), %esi
leaq 0x10(%rsp), %r13
movq %r13, -0x10(%r13)
movq %rsp, %rdi
movl $0x2d, %edx
callq 0x3330
movq %rsp, %r15
addq (%r15), %rbx
movq %rbx, %rdi
movl %r14d, %esi
movl %ebp, %edx
callq 0x26d21
leaq 0x1411c(%rip), %rcx     # 0x3a332
movl $0x22, %r8d
movq %r15, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3300
leaq 0x30(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x2624f
movq %rdx, 0x20(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x30(%rsp)
jmp 0x26256
movups (%rcx), %xmm0
movups %xmm0, (%r14)
movq 0x8(%rax), %rdx
leaq 0x20(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x142ed(%rip), %rsi     # 0x3a566
callq 0x34e0
jmp 0x263d5
leaq 0x122cf(%rip), %rsi     # 0x38559
leaq 0x40(%rsp), %rdi
callq 0x30b0
testl %eax, %eax
sete %al
testb %bpl, %al
je 0x262b4
movl $0x14, %edx
leaq 0x140b4(%rip), %rsi     # 0x3a35e
movl $0x2, %eax
jmp 0x2654c
leaq 0x1229e(%rip), %rsi     # 0x38559
leaq 0x40(%rsp), %rdi
callq 0x30b0
testl %eax, %eax
setne %al
orb %bpl, %al
je 0x2653b
leaq 0x140c4(%rip), %rsi     # 0x3a39e
leaq 0xc0(%rsp), %rdi
leaq 0x40(%rsp), %rdx
callq 0x26c99
leaq 0x140d6(%rip), %rsi     # 0x3a3c9
leaq 0xc0(%rsp), %rdi
callq 0x34e0
leaq 0x10(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x26737
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x2673e
addl $-0x2, %r14d
jmp 0x26336
decl %r14d
shrl $0x1f, %ebx
leal (%r14,%rbx), %esi
leaq 0x10(%rsp), %r13
movq %r13, -0x10(%r13)
movq %rsp, %rdi
movl $0x2d, %edx
callq 0x3330
movq %rsp, %r15
addq (%r15), %rbx
movq %rbx, %rdi
movl %r14d, %esi
movl %ebp, %edx
callq 0x26d21
leaq 0x13fc5(%rip), %rcx     # 0x3a332
movl $0x22, %r8d
movq %r15, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3300
leaq 0x30(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x263a6
movq %rdx, 0x20(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x30(%rsp)
jmp 0x263ad
movups (%rcx), %xmm0
movups %xmm0, (%r14)
movq 0x8(%rax), %rdx
leaq 0x20(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x14196(%rip), %rsi     # 0x3a566
callq 0x34e0
leaq 0x70(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x263fc
movq %rdx, 0x60(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x70(%rsp)
jmp 0x26403
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
leaq 0x60(%rsp), %rbx
movq %rdx, 0x8(%rbx)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %r12, %rdi
movq %rbx, %rsi
callq 0x3360
movq (%rbx), %rdi
cmpq %r15, %rdi
je 0x2643f
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x32b0
movq 0x20(%rsp), %rdi
cmpq %r14, %rdi
je 0x26456
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x32b0
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x2646c
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x32b0
movl $0x1, %r14d
movq 0x22b37(%rip), %rsi     # 0x48fb0
leaq 0xe0(%rsp), %rdi
callq 0x3220
leaq 0x160(%rsp), %rdi
callq 0x30d0
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x264af
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x32b0
movl %r14d, %eax
addq $0x268, %rsp            # imm = 0x268
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x22b25(%rip), %rdi     # 0x48ff0
leaq 0x13ea1(%rip), %rsi     # 0x3a373
movl $0x25, %edx
callq 0x3310
movq 0x22b0d(%rip), %rdi     # 0x48ff0
callq 0x3130
movq 0x22b01(%rip), %rdi     # 0x48ff0
leaq 0x13ea3(%rip), %rsi     # 0x3a399
movl $0x4, %edx
callq 0x3310
movq (%r15), %rsi
movq 0x22ae6(%rip), %rdi     # 0x48ff0
callq 0x31d0
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x3280
movsbl %al, %esi
movq %r15, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x31e0
jmp 0x26575
movl $0x10, %edx
leaq 0x13e1b(%rip), %rsi     # 0x3a362
movl $0x3, %eax
movl %eax, 0x38(%rbx)
movq 0x22a9a(%rip), %rdi     # 0x48ff0
callq 0x3310
movq 0x22a8e(%rip), %rdi     # 0x48ff0
callq 0x3130
movabsq $0x7fffffffffffffff, %rax # imm = 0x7FFFFFFFFFFFFFFF
movq %rax, 0x30(%rbx)
leaq 0x13cf4(%rip), %r15     # 0x3a270
incl 0x8(%rbx)
movq %rbx, %rdi
movq %r13, %rsi
callq 0x2572a
movl %eax, %eax
movl (%r15,%rax,4), %eax
testl %eax, %eax
je 0x2657c
cmpl $0x5, %eax
jne 0x2646c
movq 0x40(%rbx), %rax
movq 0x48(%rbx), %rcx
movl $0x1, %ebp
cmpq %rcx, %rax
je 0x265dd
movq (%rax), %rdx
movq 0x8(%rax), %rsi
cmpq %rsi, %rdx
je 0x265d7
movl (%rdx), %edi
movl %edi, %r8d
negl %r8d
cmovsl %edi, %r8d
incl %r8d
cmpl %r8d, %ebp
cmovlel %r8d, %ebp
addq $0x4, %rdx
jmp 0x265b6
addq $0x18, %rax
jmp 0x265aa
movq 0x70(%rbx), %rsi
movq 0x78(%rbx), %r9
cmpq %r9, %rsi
je 0x26668
movq %rsi, %rax
movq 0x8(%rax), %rcx
movq 0x10(%rax), %rdx
cmpq %rdx, %rcx
je 0x26613
movl (%rcx), %r8d
movl %r8d, %edi
negl %edi
cmovsl %r8d, %edi
incl %edi
cmpl %edi, %ebp
cmovlel %edi, %ebp
addq $0x4, %rcx
jmp 0x265f5
movq 0x20(%rax), %rcx
movq 0x28(%rax), %rdx
cmpq %rdx, %rcx
je 0x26639
movl (%rcx), %r8d
movl %r8d, %edi
negl %edi
cmovsl %r8d, %edi
incl %edi
cmpl %edi, %ebp
cmovlel %edi, %ebp
addq $0x4, %rcx
jmp 0x2661b
movq 0x40(%rax), %rcx
movq 0x48(%rax), %rdx
cmpq %rdx, %rcx
je 0x2665f
movl (%rcx), %r8d
movl %r8d, %edi
negl %edi
cmovsl %r8d, %edi
incl %edi
cmpl %edi, %ebp
cmovlel %edi, %ebp
addq $0x4, %rcx
jmp 0x26641
addq $0x60, %rax
cmpq %r9, %rax
jne 0x265ed
xorl %r14d, %r14d
cmpq %r9, %rsi
je 0x26472
movq %r9, 0x90(%rsp)
leaq 0x30(%rbx), %r15
leaq 0x60(%rsp), %rdi
movq %rdi, %r14
movq %rsi, 0x98(%rsp)
movl %ebp, %edx
callq 0x35666
movq 0x60(%rsp), %r13
movq 0x68(%rsp), %r12
cmpq %r12, %r13
je 0x2670a
movq 0x88(%rsp), %rdi
movq %r13, %rsi
callq 0x1fc42
movq 0x60(%rbx), %rsi
cmpq 0x68(%rbx), %rsi
je 0x266d1
movq 0x30(%rbx), %rax
movq %rax, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x60(%rbx)
jmp 0x266e1
movq 0x80(%rsp), %rdi
movq %r15, %rdx
callq 0x24924
movq (%r13), %rax
movq 0x8(%r13), %rcx
cmpq %rcx, %rax
je 0x26704
movl (%rax), %edx
movl %edx, %esi
negl %esi
cmovsl %edx, %esi
incl %esi
cmpl %esi, %ebp
cmovlel %esi, %ebp
addq $0x4, %rax
jmp 0x266e9
addq $0x18, %r13
jmp 0x266a1
movq %r14, %rdi
callq 0x8f6e
movq 0x98(%rsp), %rsi
movq %r14, %rdi
addq $0x60, %rsi
cmpq 0x90(%rsp), %rsi
jne 0x26685
xorl %r14d, %r14d
jmp 0x26472
movups (%rcx), %xmm0
movups %xmm0, (%r14)
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movl 0x8(%rbx), %esi
leaq 0xa0(%rsp), %rdi
callq 0x269d4
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
leaq 0xa0(%rsp), %rdx
callq 0x26bf1
leaq 0x13de4(%rip), %rsi     # 0x3a566
leaq 0x20(%rsp), %rdi
callq 0x34e0
leaq 0x70(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x267b3
movq %rdx, 0x60(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x70(%rsp)
jmp 0x267ba
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
leaq 0x60(%rsp), %rbx
movq %rdx, 0x8(%rbx)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %r12, %rdi
movq %rbx, %rsi
callq 0x3360
movq (%rbx), %rdi
cmpq %r15, %rdi
je 0x267f6
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x32b0
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x26811
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x32b0
leaq 0xb0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x26832
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x32b0
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0x26848
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x32b0
leaq 0xd0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2646c
movq 0xd0(%rsp), %rsi
jmp 0x26464
movq %rax, %rbx
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2688d
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x32b0
jmp 0x2688d
movq %rax, %rbx
leaq 0xb0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x268b3
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x32b0
jmp 0x268b3
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0x268ce
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x32b0
jmp 0x268ce
movq %rax, %rbx
leaq 0xd0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x26944
movq 0xd0(%rsp), %rsi
jmp 0x2691e
jmp 0x26932
jmp 0x268f1
jmp 0x2690d
jmp 0x26932
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r14, %rdi
je 0x26910
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x32b0
jmp 0x26910
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x26944
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x32b0
jmp 0x26944
jmp 0x26932
jmp 0x26967
jmp 0x26932
jmp 0x26932
jmp 0x26967
movq %rax, %rbx
jmp 0x26944
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x8f6e
movq 0x22665(%rip), %rsi     # 0x48fb0
leaq 0xe0(%rsp), %rdi
callq 0x3220
leaq 0x160(%rsp), %rdi
callq 0x30d0
jmp 0x2696a
movq %rax, %rbx
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x26986
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x32b0
movq %rbx, %rdi
callq 0x34a0