// File: /workspace/github_cpp_makefile_star2_O1/Laakeri[P]maxpre/src/probleminstance.cpp
// Function: maxPreprocessor::ProblemInstance::ProblemInstance(std::vector<std::vector<int, std::allocator<int>>, std::allocator<std::vector<int, std::allocator<int>>>> const&, std::vector<unsigned long, std::allocator<unsigned long>> const&, unsigned long)
ProblemInstance::ProblemInstance(const vector<vector<int> >& clauses_, const vector<uint64_t>& weights_, uint64_t topWeight) : tl(*this) {
	assert(clauses_.size() == weights_.size());
	excessVar = 0;
	
	int maxVar = 0;
	
	clauses.reserve(clauses_.size());
	for (unsigned i = 0; i < clauses_.size(); i++) {
		clauses.emplace_back(Clause(clauses_[i], weights_[i]));
	}
	
	for (unsigned i = 0; i < clauses.size(); i++) {
		for (int lit : clauses[i].lit) {
			maxVar = max(maxVar, abs(lit) - 1);
		}
	}
	
	for (unsigned i = 0; i < clauses.size(); i++) {
		for (int& lit : clauses[i].lit) {
			lit=litFromDimacs(lit);
		}
		
		if (clauses[i].weight >= topWeight) clauses[i].weight = HARDWEIGHT;
		
		sort(clauses[i].lit.begin(), clauses[i].lit.end());
		clauses[i].lit.erase(unique(clauses[i].lit.begin(), clauses[i].lit.end()), clauses[i].lit.end());
		clauses[i].updateHash();
	}
	vars = maxVar + 1;
	
	isLabel.resize(vars);
	litClauses.resize(vars*2);
	removedClauses.resize(clauses.size());
	
	tl.init(vars);
	
	for (unsigned i = 0; i < clauses.size(); i++) {
		populateLitClauses(i);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rcx, 0x28(%rsp)
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x18(%rdi), %r12
leaq 0x30(%rdi), %r13
leaq 0x48(%rdi), %rbp
leaq 0x68(%rdi), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 0x50(%rbx)
movups %xmm0, 0x40(%rbx)
movups %xmm0, 0x30(%rbx)
movups %xmm0, 0x20(%rbx)
movups %xmm0, 0x10(%rbx)
movups %xmm0, (%rbx)
movq %rdi, 0x20(%rsp)
movq %rbx, %rsi
callq 0x2f1a0
movq 0x8(%r15), %rsi
subq (%r15), %rsi
sarq $0x3, %rsi
movabsq $-0x5555555555555555, %rax # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %rsi
movq 0x8(%r14), %rax
subq (%r14), %rax
sarq $0x3, %rax
cmpq %rax, %rsi
jne 0x28a1a
movq %r14, 0x30(%rsp)
movl $0x0, 0x64(%rbx)
movq %rbx, %rdi
callq 0x290e6
movq %rbp, (%rsp)
movq %r13, 0x8(%rsp)
movq %r12, 0x10(%rsp)
movq (%r15), %rax
cmpq %rax, 0x8(%r15)
movq %rbx, 0x18(%rsp)
je 0x287f0
movl $0x1, %ebp
xorl %r14d, %r14d
leaq 0x38(%rsp), %r12
leaq 0x50(%rsp), %r13
leaq (%r14,%r14,2), %rcx
leaq (%rax,%rcx,8), %rsi
movq %r12, %rdi
callq 0x1ffa6
movq 0x30(%rsp), %rax
movq (%rax), %rax
movq (%rax,%r14,8), %rdx
movq %r13, %rdi
movq %r12, %rsi
callq 0x29514
movq %rbx, %rdi
movq %r13, %rsi
callq 0x291d6
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x287af
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x287c6
movq 0x48(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
movl %ebp, %r14d
movq (%r15), %rax
movq 0x8(%r15), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rdx, %rcx
incl %ebp
cmpq %r14, %rcx
ja 0x28766
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
movabsq $-0x3333333333333333, %rdx # imm = 0xCCCCCCCCCCCCCCCD
subq %rax, %rcx
je 0x2884f
sarq $0x3, %rcx
imulq %rdx, %rcx
xorl %edx, %edx
xorl %ebp, %ebp
leaq (%rdx,%rdx,4), %rdi
movq (%rax,%rdi,8), %rsi
movq 0x8(%rax,%rdi,8), %rdi
cmpq %rdi, %rsi
je 0x28841
movl (%rsi), %r8d
movl %r8d, %r9d
negl %r9d
cmovsl %r8d, %r9d
decl %r9d
cmpl %r9d, %ebp
cmovlel %r9d, %ebp
addq $0x4, %rsi
jmp 0x2881f
incq %rdx
movl %edx, %esi
cmpq %rsi, %rcx
ja 0x28812
incl %ebp
jmp 0x28854
movl $0x1, %ebp
movq (%rbx), %rax
cmpq %rax, 0x8(%rbx)
je 0x2897b
xorl %r13d, %r13d
leaq (,%r13,4), %r14
addq %r13, %r14
movq (%rax,%r14,8), %r15
movq 0x8(%rax,%r14,8), %rbx
cmpq %rbx, %r15
je 0x2888e
movl (%r15), %edi
callq 0x284a8
movl %eax, (%r15)
addq $0x4, %r15
jmp 0x28878
movq 0x18(%rsp), %rbx
movq (%rbx), %rax
leaq (%rax,%r14,8), %rax
movq 0x28(%rsp), %rcx
cmpq %rcx, 0x18(%rax)
jb 0x288b3
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
movq %rcx, 0x18(%rax)
movq (%rax), %r15
movq 0x8(%rax), %r12
cmpq %r12, %r15
je 0x288ec
movq %r12, %rax
subq %r15, %rax
sarq $0x2, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r15, %rdi
movq %r12, %rsi
callq 0x22eaf
movq %r15, %rdi
movq %r12, %rsi
callq 0x22f92
movq %rbx, %r12
movq (%rbx), %rbx
movq (%rbx,%r14,8), %rdi
movq 0x8(%rbx,%r14,8), %rsi
callq 0x2352e
movq %rax, %r15
movq (%r12), %rax
movq 0x8(%rax,%r14,8), %r12
cmpq %r12, %r15
je 0x2893f
leaq (%rbx,%r14,8), %rbx
movq 0x8(%rbx), %rdx
subq %r12, %rdx
je 0x28929
movq %r15, %rdi
movq %r12, %rsi
callq 0x3450
movq 0x8(%rbx), %rax
movq %rax, %rcx
subq %r12, %rcx
addq %rcx, %r15
cmpq %r15, %rax
je 0x2893f
movq %r15, 0x8(%rbx)
shlq $0x3, %r14
movq 0x18(%rsp), %rbx
addq (%rbx), %r14
movq %r14, %rdi
callq 0x2955a
incl %r13d
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
movabsq $-0x3333333333333333, %rdx # imm = 0xCCCCCCCCCCCCCCCD
imulq %rdx, %rcx
cmpq %r13, %rcx
ja 0x28864
movl %ebp, 0x60(%rbx)
movl %ebp, %esi
movq (%rsp), %rbp
movq %rbp, %rdi
movq 0x10(%rsp), %r12
movq 0x8(%rsp), %r13
callq 0x8cbc
movslq 0x60(%rbx), %rsi
addq %rsi, %rsi
movq %r12, %rdi
callq 0x8cee
movq 0x8(%rbx), %rsi
subq (%rbx), %rsi
sarq $0x3, %rsi
movabsq $-0x3333333333333333, %rax # imm = 0xCCCCCCCCCCCCCCCD
imulq %rax, %rsi
movq %r13, %rdi
callq 0x8cbc
movl 0x60(%rbx), %esi
movq 0x20(%rsp), %rdi
callq 0x2f2dc
movq 0x8(%rbx), %rax
cmpq (%rbx), %rax
je 0x28a0b
xorl %r14d, %r14d
movq %rbx, %rdi
movl %r14d, %esi
callq 0x28aee
movq 0x8(%rbx), %rax
subq (%rbx), %rax
incl %r14d
sarq $0x3, %rax
movabsq $-0x3333333333333333, %rcx # imm = 0xCCCCCCCCCCCCCCCD
imulq %rcx, %rax
cmpq %r14, %rax
ja 0x289df
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x11c74(%rip), %rdi     # 0x3a695
leaq 0x11bf3(%rip), %rsi     # 0x3a61b
leaq 0x11c89(%rip), %rcx     # 0x3a6b8
movl $0x35, %edx
callq 0x31b0
movq %rax, %r14
jmp 0x28aac
jmp 0x28a48
movq %rax, %r14
movq %r12, %rbx
jmp 0x28a94
movq %rax, %r14
jmp 0x28aa2
jmp 0x28a8c
movq %rax, %r14
jmp 0x28a6e
movq %rax, %r14
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x28a6e
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x28a8f
movq 0x48(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
jmp 0x28a8f
movq %rax, %r14
jmp 0x28a94
movq %rax, %r14
movq 0x18(%rsp), %rbx
movq 0x10(%rsp), %r12
movq 0x8(%rsp), %r13
movq (%rsp), %rbp
movq 0x20(%rsp), %rdi
callq 0x2922c
movq (%rbp), %rdi
testq %rdi, %rdi
je 0x28ac1
movq 0x58(%rbx), %rsi
subq %rdi, %rsi
callq 0x32b0
movq (%r13), %rdi
testq %rdi, %rdi
je 0x28ad6
movq 0x40(%rbx), %rsi
subq %rdi, %rsi
callq 0x32b0
movq %r12, %rdi
callq 0x8f6e
movq %rbx, %rdi
callq 0x9226
movq %r14, %rdi
callq 0x34a0