// File: /workspace/github_cpp_makefile_star2_O3/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), %rax
movq %rax, 0x20(%rsp)
leaq 0x68(%rdi), %rbp
xorps %xmm0, %xmm0
movups %xmm0, 0x50(%rdi)
movups %xmm0, 0x40(%rdi)
movups %xmm0, 0x30(%rdi)
movups %xmm0, 0x20(%rdi)
movups %xmm0, 0x10(%rdi)
movups %xmm0, (%rdi)
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x2e490
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 0x27d1b
movq %r14, 0x30(%rsp)
movl $0x0, 0x64(%rbx)
movq %rbx, %rdi
callq 0x283bc
movq %rbp, 0x8(%rsp)
movq %r13, 0x10(%rsp)
movq %r12, 0x18(%rsp)
movq (%r15), %rax
cmpq %rax, 0x8(%r15)
je 0x27af3
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 0x1f3de
movq 0x30(%rsp), %rax
movq (%rax), %rax
movq (%rax,%r14,8), %rdx
movq %r13, %rdi
movq %r12, %rsi
callq 0x287cc
movq %rbx, %rdi
movq %r13, %rsi
callq 0x284a4
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x27ab2
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x27ac9
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 0x27a69
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
movq %rcx, %rdx
movabsq $-0x3333333333333333, %rsi # imm = 0xCCCCCCCCCCCCCCCD
subq %rax, %rdx
je 0x27c73
sarq $0x3, %rdx
imulq %rsi, %rdx
xorl %esi, %esi
xorl %r13d, %r13d
leaq (%rsi,%rsi,4), %r8
movq (%rax,%r8,8), %rdi
movq 0x8(%rax,%r8,8), %r8
cmpq %r8, %rdi
je 0x27b4c
movl (%rdi), %r9d
movl %r9d, %r10d
negl %r10d
cmovsl %r9d, %r10d
decl %r10d
cmpl %r10d, %r13d
cmovlel %r10d, %r13d
addq $0x4, %rdi
jmp 0x27b2a
incq %rsi
movl %esi, %edi
cmpq %rdi, %rdx
ja 0x27b1d
incl %r13d
cmpq %rax, %rcx
je 0x27c79
xorl %ebp, %ebp
leaq (,%rbp,4), %r12
addq %rbp, %r12
movq (%rax,%r12,8), %r14
movq 0x8(%rax,%r12,8), %r15
cmpq %r15, %r14
je 0x27b94
movl (%r14), %edi
callq 0x277d0
movl %eax, (%r14)
addq $0x4, %r14
cmpq %r15, %r14
jne 0x27b7d
movq (%rbx), %rax
leaq (%rax,%r12,8), %rdi
movq 0x28(%rsp), %rax
cmpq %rax, 0x18(%rdi)
jb 0x27bb1
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
movq %rax, 0x18(%rdi)
movq (%rdi), %r14
movq 0x8(%rdi), %r15
cmpq %r15, %r14
je 0x27c45
movq %r15, %rax
subq %r14, %rax
sarq $0x2, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2226b
movq %r14, %rdi
movq %r15, %rsi
callq 0x2234e
movq (%rbx), %rax
leaq (%rax,%r12,8), %rdi
movq (%rdi), %rcx
movq 0x8(%rdi), %rax
cmpq %rax, %rcx
je 0x27c45
addq $0x4, %rcx
cmpq %rax, %rcx
je 0x27c45
movl -0x4(%rcx), %edx
leaq 0x4(%rcx), %rsi
cmpl (%rcx), %edx
movq %rsi, %rcx
jne 0x27c05
leaq -0x8(%rsi), %rcx
cmpq %rax, %rsi
je 0x27c38
movl %edx, %r8d
movl (%rsi), %edx
cmpl %edx, %r8d
je 0x27c32
movl %edx, 0x4(%rcx)
addq $0x4, %rcx
addq $0x4, %rsi
jmp 0x27c1c
addq $0x4, %rcx
cmpq %rax, %rcx
je 0x27c45
movq %rcx, 0x8(%rdi)
callq 0x28812
incl %ebp
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
movabsq $-0x3333333333333333, %rdx # imm = 0xCCCCCCCCCCCCCCCD
imulq %rdx, %rcx
cmpq %rbp, %rcx
ja 0x27b64
jmp 0x27c79
movl $0x1, %r13d
movl %r13d, 0x60(%rbx)
movl %r13d, %esi
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %r12
movq 0x10(%rsp), %r13
movq 0x8(%rsp), %rbp
callq 0x8cac
movslq 0x60(%rbx), %rsi
addq %rsi, %rsi
movq %r12, %rdi
callq 0x8cde
movq 0x8(%rbx), %rsi
subq (%rbx), %rsi
sarq $0x3, %rsi
movabsq $-0x3333333333333333, %rax # imm = 0xCCCCCCCCCCCCCCCD
imulq %rax, %rsi
movq %r13, %rdi
callq 0x8cac
movl 0x60(%rbx), %esi
movq %rbp, %rdi
callq 0x2e5cc
movq 0x8(%rbx), %rax
cmpq (%rbx), %rax
je 0x27d0c
xorl %r14d, %r14d
movq %rbx, %rdi
movl %r14d, %esi
callq 0x27de2
movq 0x8(%rbx), %rax
subq (%rbx), %rax
incl %r14d
sarq $0x3, %rax
movabsq $-0x3333333333333333, %rcx # imm = 0xCCCCCCCCCCCCCCCD
imulq %rcx, %rax
cmpq %r14, %rax
ja 0x27ce0
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x11a13(%rip), %rdi     # 0x39735
leaq 0x11992(%rip), %rsi     # 0x396bb
leaq 0x11a28(%rip), %rcx     # 0x39758
movl $0x35, %edx
callq 0x31b0
movq %rax, %r14
jmp 0x27d9c
jmp 0x27d41
movq %rax, %r14
jmp 0x27d94
jmp 0x27d82
movq %rax, %r14
jmp 0x27d67
movq %rax, %r14
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x27d67
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x27d85
movq 0x48(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
jmp 0x27d85
jmp 0x27d82
movq %rax, %r14
movq 0x18(%rsp), %r12
movq 0x10(%rsp), %r13
movq 0x8(%rsp), %rbp
movq %rbp, %rdi
callq 0x284fa
movq 0x20(%rsp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x27db5
movq 0x58(%rbx), %rsi
subq %rdi, %rsi
callq 0x32b0
movq (%r13), %rdi
testq %rdi, %rdi
je 0x27dca
movq 0x40(%rbx), %rsi
subq %rdi, %rsi
callq 0x32b0
movq %r12, %rdi
callq 0x8f5e
movq %rbx, %rdi
callq 0x921c
movq %r14, %rdi
callq 0x34a0