// File: /workspace/github_cpp_makefile_star2_O3/Laakeri[P]maxpre/src/preprocessor.cpp
// Function: maxPreprocessor::Preprocessor::getPreprocessedInstance()
PreprocessedInstance Preprocessor::getPreprocessedInstance() {
	PreprocessedInstance ret;
	for (unsigned i = 0; i < pi.clauses.size(); i++) {
		if (!pi.isClauseRemoved(i) && pi.clauses[i].isHard()) {
			ret.clauses.push_back(pi.clauses[i].lit);
			ret.weights.push_back(pi.clauses[i].weight);
		}
	}
	for (int var = 0; var < pi.vars; var++) {
		if (pi.isLabel[var] == VAR_TRUE && !pi.isVarRemoved(var)) {
			assert(pi.litClauses[posLit(var)].size() == 1);
		}
		if (pi.isLabel[var] == VAR_FALSE && !pi.isVarRemoved(var)) {
			assert(pi.litClauses[negLit(var)].size() == 1);
		}
		if (pi.litClauses[posLit(var)].size() > 0 || pi.litClauses[negLit(var)].size() > 0) {
			if (pi.isLabel[var] == VAR_TRUE) {
				if (pi.litClauses[negLit(var)].size() == 0) {
					trace.setVar(var, true);
				}
				else {
					assert(pi.litClauses[posLit(var)].size() == 1);
					assert(pi.clauses[pi.litClauses[posLit(var)][0]].lit.size() == 1);
					assert(!pi.clauses[pi.litClauses[posLit(var)][0]].isHard());
					ret.labels.push_back({posLit(var), pi.clauses[pi.litClauses[posLit(var)][0]].weight});
				}
			}
			else if(pi.isLabel[var] == VAR_FALSE) {
				if (pi.litClauses[posLit(var)].size() == 0) {
					trace.setVar(var, false);
				}
				else {
					assert(pi.litClauses[negLit(var)].size() == 1);
					assert(pi.clauses[pi.litClauses[negLit(var)][0]].lit.size() == 1);
					assert(!pi.clauses[pi.litClauses[negLit(var)][0]].isHard());
					ret.labels.push_back({negLit(var), pi.clauses[pi.litClauses[negLit(var)][0]].weight});
				}
			}
		}
	}
	if (trace.removedWeight > 0) {
		int nVar = pi.getExcessVar();
		ret.labels.push_back({negLit(nVar), trace.removedWeight});
		ret.clauses.push_back({posLit(nVar)});
		ret.weights.push_back(HARDWEIGHT);
	}
	auto cmp = [&](pair<int, uint64_t> a, pair<int, uint64_t> b) {
		if (litVariable(a.F) >= pi.vars || litVariable(b.F) >= pi.vars) return a.F > b.F;
		return pi.litClauses[a.F].size() + pi.litClauses[litNegation(a.F)].size() > pi.litClauses[b.F].size() + pi.litClauses[litNegation(b.F)].size();
	};
	sort(ret.labels.begin(), ret.labels.end(), cmp);
	for (int i = 0; i < (int)ret.labels.size(); i++) {
		ret.clauses.push_back({ret.labels[i].F});
		ret.weights.push_back(ret.labels[i].S);
	}
	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%rdi)
movups %xmm0, 0x20(%rdi)
movups %xmm0, 0x10(%rdi)
movups %xmm0, (%rdi)
movq $0x0, 0x40(%rdi)
movq 0x8(%rsi), %rax
cmpq (%rsi), %rax
je 0x198d9
leaq 0x18(%rbx), %r15
xorl %r12d, %r12d
movabsq $-0x3333333333333333, %r13 # imm = 0xCCCCCCCCCCCCCCCD
movq %r14, %rdi
movl %r12d, %esi
callq 0x27804
movq (%r14), %rcx
testb %al, %al
jne 0x198c2
leaq (%r12,%r12,4), %rbp
leaq (%rcx,%rbp,8), %rdi
callq 0x2883e
movq (%r14), %rcx
testb %al, %al
je 0x198c2
leaq (%rcx,%rbp,8), %rsi
movq %rbx, %rdi
callq 0x1f07e
movq (%r14), %rcx
leaq (%rcx,%rbp,8), %rdx
addq $0x18, %rdx
movq 0x20(%rbx), %rsi
cmpq 0x28(%rbx), %rsi
je 0x198b7
movq (%rdx), %rax
movq %rax, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x20(%rbx)
jmp 0x198c2
movq %r15, %rdi
callq 0x23bec
movq (%r14), %rcx
incl %r12d
movq 0x8(%r14), %rax
subq %rcx, %rax
sarq $0x3, %rax
imulq %r13, %rax
cmpq %r12, %rax
ja 0x19860
cmpl $0x0, 0x60(%r14)
jle 0x19b34
leaq 0x30(%rbx), %rax
movq %rax, 0x30(%rsp)
leaq 0x2f0(%r14), %rax
movq %rax, 0x28(%rsp)
movl $0x1, %r13d
xorl %r15d, %r15d
xorl %ebp, %ebp
movq 0x48(%r14), %rax
cmpl $0x1, (%rax,%rbp,4)
jne 0x1993d
movq %r14, %rdi
movl %ebp, %esi
callq 0x278a0
testb %al, %al
jne 0x1993d
leal -0x1(%r13), %eax
cltq
movq 0x18(%r14), %rcx
leaq (%rax,%rax,2), %rax
movq 0x8(%rcx,%rax,8), %rdx
subq (%rcx,%rax,8), %rdx
cmpq $0x4, %rdx
jne 0x19d6a
movq 0x48(%r14), %rax
cmpl $0x2, (%rax,%rbp,4)
jne 0x19974
movq %r14, %rdi
movl %ebp, %esi
callq 0x278a0
movq 0x18(%r14), %rcx
testb %al, %al
jne 0x19978
movslq %r13d, %rax
leaq (%rax,%rax,2), %rax
movq 0x8(%rcx,%rax,8), %rdx
subq (%rcx,%rax,8), %rdx
cmpq $0x4, %rdx
je 0x19978
jmp 0x19d4b
movq 0x18(%r14), %rcx
movq %r15, %rsi
sarq $0x20, %rsi
leaq (%rsi,%rsi,2), %r12
movq (%rcx,%r12,8), %rax
movq 0x8(%rcx,%r12,8), %rdi
movq %rdi, %rdx
subq %rax, %rdx
jne 0x199ae
movq %rsi, %r8
orq $0x1, %r8
leaq (%r8,%r8,2), %r8
movq 0x8(%rcx,%r8,8), %r9
cmpq (%rcx,%r8,8), %r9
je 0x19b13
movq 0x48(%r14), %r8
movl (%r8,%rbp,4), %r8d
cmpl $0x2, %r8d
je 0x19a5f
cmpl $0x1, %r8d
jne 0x19b13
orq $0x1, %rsi
leaq (%rsi,%rsi,2), %rsi
movq 0x8(%rcx,%rsi,8), %rdi
cmpq (%rcx,%rsi,8), %rdi
je 0x19aed
cmpq $0x4, %rdx
jne 0x19d89
movslq (%rax), %rcx
movq (%r14), %rax
leaq (%rcx,%rcx,4), %rcx
movq 0x8(%rax,%rcx,8), %rdx
subq (%rax,%rcx,8), %rdx
cmpq $0x4, %rdx
jne 0x19da8
leaq (%rax,%rcx,8), %rdi
callq 0x2883e
testb %al, %al
jne 0x19dc7
leal -0x1(%r13), %eax
movq (%r14), %rcx
movq 0x18(%r14), %rdx
movq (%rdx,%r12,8), %rdx
movslq (%rdx), %rdx
leaq (%rdx,%rdx,4), %rdx
movl %eax, 0x8(%rsp)
movq 0x18(%rcx,%rdx,8), %rax
movq %rax, 0x10(%rsp)
movq 0x38(%rbx), %rsi
cmpq 0x40(%rbx), %rsi
jne 0x19ade
movq 0x30(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x2082e
jmp 0x19b13
cmpq %rax, %rdi
je 0x19af1
movslq %r13d, %rax
leaq (%rax,%rax,2), %r12
movq (%rcx,%r12,8), %rax
movq 0x8(%rcx,%r12,8), %rcx
subq %rax, %rcx
cmpq $0x4, %rcx
jne 0x19de6
movslq (%rax), %rcx
movq (%r14), %rax
leaq (%rcx,%rcx,4), %rcx
movq 0x8(%rax,%rcx,8), %rdx
subq (%rax,%rcx,8), %rdx
cmpq $0x4, %rdx
jne 0x19e05
leaq (%rax,%rcx,8), %rdi
callq 0x2883e
testb %al, %al
jne 0x19e24
movq (%r14), %rax
movq 0x18(%r14), %rcx
movq (%rcx,%r12,8), %rcx
movslq (%rcx), %rcx
leaq (%rcx,%rcx,4), %rcx
movl %r13d, 0x8(%rsp)
movq 0x18(%rax,%rcx,8), %rax
movq %rax, 0x10(%rsp)
movq 0x38(%rbx), %rsi
cmpq 0x40(%rbx), %rsi
je 0x19b04
movups 0x8(%rsp), %xmm0
movups %xmm0, (%rsi)
addq $0x10, 0x38(%rbx)
jmp 0x19b13
movb $0x1, %al
jmp 0x19af3
xorl %eax, %eax
movzbl %al, %edx
movq 0x28(%rsp), %rdi
movl %ebp, %esi
callq 0x2684c
jmp 0x19b13
movq 0x30(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x2082e
incq %rbp
movslq 0x60(%r14), %rax
movabsq $0x200000000, %rcx      # imm = 0x200000000
addq %rcx, %r15
addl $0x2, %r13d
cmpq %rax, %rbp
jl 0x19904
cmpq $0x0, 0x2f0(%r14)
je 0x19c00
movq %r14, %rdi
callq 0x28322
movl %eax, %r15d
leal 0x1(,%r15,2), %eax
movl %eax, 0x8(%rsp)
movq 0x2f0(%r14), %rax
movq %rax, 0x10(%rsp)
movq 0x38(%rbx), %rsi
cmpq 0x40(%rbx), %rsi
je 0x19b7e
movups 0x8(%rsp), %xmm0
movups %xmm0, (%rsi)
addq $0x10, 0x38(%rbx)
jmp 0x19b8c
leaq 0x30(%rbx), %rdi
leaq 0x8(%rsp), %rdx
callq 0x2082e
addl %r15d, %r15d
leaq 0x24(%rsp), %rsi
movl %r15d, (%rsi)
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rcx
movl $0x1, %edx
callq 0x1e9a8
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x2259a
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x19bcf
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
movq 0x20(%rbx), %rsi
cmpq 0x28(%rbx), %rsi
je 0x19bf0
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
movq %rax, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x20(%rbx)
jmp 0x19c00
leaq 0x18(%rbx), %rdi
leaq 0x1e7ad(%rip), %rdx     # 0x383a8
callq 0x23bec
movq 0x30(%rbx), %r12
movq 0x38(%rbx), %r15
cmpq %r15, %r12
je 0x19c78
movq %r15, %r13
subq %r12, %r13
movq %r13, %rax
sarq $0x4, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rcx
callq 0x1e18f
cmpq $0x101, %r13            # imm = 0x101
jl 0x19c6a
leaq 0x100(%r12), %r13
movq %r12, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x1e65a
cmpq %r15, %r13
je 0x19c78
movq %r13, %rdi
movq %r14, %rsi
callq 0x1e706
addq $0x10, %r13
jmp 0x19c54
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x1e65a
movq 0x30(%rbx), %rax
movq 0x38(%rbx), %rcx
subq %rax, %rcx
shrq $0x4, %rcx
testl %ecx, %ecx
jle 0x19d39
leaq 0x18(%rbx), %rcx
movq %rcx, 0x28(%rsp)
movl $0x8, %ebp
xorl %r14d, %r14d
leaq 0x8(%rsp), %r15
leaq 0x24(%rsp), %r12
leaq 0x7(%rsp), %r13
movl -0x8(%rax,%rbp), %eax
movl %eax, 0x24(%rsp)
movl $0x1, %edx
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rcx
callq 0x1e9a8
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2259a
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x19cec
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
movq 0x30(%rbx), %rdx
addq %rbp, %rdx
movq 0x20(%rbx), %rsi
cmpq 0x28(%rbx), %rsi
je 0x19d0d
movq (%rdx), %rax
movq %rax, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x20(%rbx)
jmp 0x19d17
movq 0x28(%rsp), %rdi
callq 0x23bec
incq %r14
movq 0x30(%rbx), %rax
movq 0x38(%rbx), %rcx
subq %rax, %rcx
shrq $0x4, %rcx
movslq %ecx, %rcx
addq $0x10, %rbp
cmpq %rcx, %r14
jl 0x19caf
movq %rbx, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1ed3e(%rip), %rdi     # 0x38a90
leaq 0x1e68e(%rip), %rsi     # 0x383e7
leaq 0x1f366(%rip), %rcx     # 0x390c6
movl $0x1b1, %edx            # imm = 0x1B1
callq 0x31b0
leaq 0x1eccd(%rip), %rdi     # 0x38a3e
leaq 0x1e66f(%rip), %rsi     # 0x383e7
leaq 0x1f347(%rip), %rcx     # 0x390c6
movl $0x1ae, %edx            # imm = 0x1AE
callq 0x31b0
leaq 0x1ecae(%rip), %rdi     # 0x38a3e
leaq 0x1e650(%rip), %rsi     # 0x383e7
leaq 0x1f328(%rip), %rcx     # 0x390c6
movl $0x1b9, %edx            # imm = 0x1B9
callq 0x31b0
leaq 0x1f365(%rip), %rdi     # 0x39114
leaq 0x1e631(%rip), %rsi     # 0x383e7
leaq 0x1f309(%rip), %rcx     # 0x390c6
movl $0x1ba, %edx            # imm = 0x1BA
callq 0x31b0
leaq 0x1f380(%rip), %rdi     # 0x3914e
leaq 0x1e612(%rip), %rsi     # 0x383e7
leaq 0x1f2ea(%rip), %rcx     # 0x390c6
movl $0x1bb, %edx            # imm = 0x1BB
callq 0x31b0
leaq 0x1eca3(%rip), %rdi     # 0x38a90
leaq 0x1e5f3(%rip), %rsi     # 0x383e7
leaq 0x1f2cb(%rip), %rcx     # 0x390c6
movl $0x1c4, %edx            # imm = 0x1C4
callq 0x31b0
leaq 0x1f376(%rip), %rdi     # 0x39182
leaq 0x1e5d4(%rip), %rsi     # 0x383e7
leaq 0x1f2ac(%rip), %rcx     # 0x390c6
movl $0x1c5, %edx            # imm = 0x1C5
callq 0x31b0
leaq 0x1f391(%rip), %rdi     # 0x391bc
leaq 0x1e5b5(%rip), %rsi     # 0x383e7
leaq 0x1f28d(%rip), %rcx     # 0x390c6
movl $0x1c6, %edx            # imm = 0x1C6
callq 0x31b0
jmp 0x19e71
jmp 0x19e53
jmp 0x19e71
jmp 0x19e71
jmp 0x19e71
jmp 0x19e71
jmp 0x19e71
jmp 0x19e71
movq %rax, %r14
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x19e74
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
jmp 0x19e74
jmp 0x19e71
movq %rax, %r14
movq %rbx, %rdi
callq 0x1f540
movq %r14, %rdi
callq 0x34a0