// File: /workspace/github_cpp_makefile_star2_O1/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 0x1a1ab
leaq 0x18(%rbx), %rax
movq %rax, 0x20(%rsp)
xorl %r12d, %r12d
movabsq $-0x3333333333333333, %rbp # imm = 0xCCCCCCCCCCCCCCCD
movq %r14, %rdi
movl %r12d, %esi
callq 0x284dc
testb %al, %al
jne 0x1a194
leaq (%r12,%r12,4), %r15
leaq (,%r15,8), %r13
movq (%r14), %rdi
addq %r13, %rdi
callq 0x29586
testb %al, %al
je 0x1a194
addq (%r14), %r13
movq %rbx, %rdi
movq %r13, %rsi
callq 0x1fc42
movq (%r14), %rax
leaq (%rax,%r15,8), %rdx
addq $0x18, %rdx
movq 0x20(%rbx), %rsi
cmpq 0x28(%rbx), %rsi
je 0x1a18a
movq (%rdx), %rax
movq %rax, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x20(%rbx)
jmp 0x1a194
movq 0x20(%rsp), %rdi
callq 0x24924
movq 0x8(%r14), %rax
subq (%r14), %rax
incl %r12d
sarq $0x3, %rax
imulq %rbp, %rax
cmpq %r12, %rax
ja 0x1a12d
cmpl $0x0, 0x60(%r14)
jle 0x1a413
leaq 0x30(%rbx), %rax
movq %rax, 0x30(%rsp)
leaq 0x2f0(%r14), %rax
movq %rax, 0x20(%rsp)
movl $0x1, %r13d
xorl %r15d, %r15d
xorl %ebp, %ebp
movq 0x48(%r14), %rax
cmpl $0x1, (%rax,%rbp,4)
jne 0x1a20f
movq %r14, %rdi
movl %ebp, %esi
callq 0x2859c
testb %al, %al
jne 0x1a20f
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 0x1a649
movq 0x48(%r14), %rax
cmpl $0x2, (%rax,%rbp,4)
jne 0x1a245
movq %r14, %rdi
movl %ebp, %esi
callq 0x2859c
testb %al, %al
jne 0x1a245
movslq %r13d, %rax
movq 0x18(%r14), %rcx
leaq (%rax,%rax,2), %rax
movq 0x8(%rcx,%rax,8), %rdx
subq (%rcx,%rax,8), %rdx
cmpq $0x4, %rdx
jne 0x1a62a
movq %r15, %rdx
sarq $0x20, %rdx
movq 0x18(%r14), %rax
leaq (%rdx,%rdx,2), %r12
movq (%rax,%r12,8), %rcx
movq 0x8(%rax,%r12,8), %rdi
movq %rdi, %rsi
subq %rcx, %rsi
jne 0x1a27f
movq %rdx, %r8
orq $0x1, %r8
leaq (%r8,%r8,2), %r8
movq 0x8(%rax,%r8,8), %r9
cmpq (%rax,%r8,8), %r9
je 0x1a3f2
movq 0x48(%r14), %r8
movl (%r8,%rbp,4), %r8d
cmpl $0x2, %r8d
je 0x1a330
cmpl $0x1, %r8d
jne 0x1a3f2
orq $0x1, %rdx
leaq (%rdx,%rdx,2), %rdx
movq 0x8(%rax,%rdx,8), %rdi
cmpq (%rax,%rdx,8), %rdi
je 0x1a3cc
cmpq $0x4, %rsi
jne 0x1a668
movslq (%rcx), %rcx
movq (%r14), %rax
leaq (%rcx,%rcx,4), %rcx
movq 0x8(%rax,%rcx,8), %rdx
subq (%rax,%rcx,8), %rdx
cmpq $0x4, %rdx
jne 0x1a687
leaq (%rax,%rcx,8), %rdi
callq 0x29586
testb %al, %al
jne 0x1a6a6
movq (%r14), %rax
movq 0x18(%r14), %rcx
movq (%rcx,%r12,8), %rcx
movslq (%rcx), %rcx
leaq (%rcx,%rcx,4), %rcx
leal -0x1(%r13), %edx
movl %edx, 0x8(%rsp)
movq 0x18(%rax,%rcx,8), %rax
movq %rax, 0x10(%rsp)
movq 0x38(%rbx), %rsi
cmpq 0x40(%rbx), %rsi
jne 0x1a3bd
movq 0x30(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x213ee
jmp 0x1a3f2
cmpq %rcx, %rdi
je 0x1a3d0
movabsq $0x100000000, %rcx      # imm = 0x100000000
addq %r15, %rcx
sarq $0x20, %rcx
leaq (%rcx,%rcx,2), %r12
movq (%rax,%r12,8), %rcx
movq 0x8(%rax,%r12,8), %rax
subq %rcx, %rax
cmpq $0x4, %rax
jne 0x1a6c5
movslq (%rcx), %rcx
movq (%r14), %rax
leaq (%rcx,%rcx,4), %rcx
movq 0x8(%rax,%rcx,8), %rdx
subq (%rax,%rcx,8), %rdx
cmpq $0x4, %rdx
jne 0x1a6e4
leaq (%rax,%rcx,8), %rdi
callq 0x29586
testb %al, %al
jne 0x1a703
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 0x1a3e3
movups 0x8(%rsp), %xmm0
movups %xmm0, (%rsi)
addq $0x10, 0x38(%rbx)
jmp 0x1a3f2
movb $0x1, %al
jmp 0x1a3d2
xorl %eax, %eax
movzbl %al, %edx
movq 0x20(%rsp), %rdi
movl %ebp, %esi
callq 0x27524
jmp 0x1a3f2
movq 0x30(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x213ee
incq %rbp
movslq 0x60(%r14), %rax
movabsq $0x200000000, %rcx      # imm = 0x200000000
addq %rcx, %r15
addl $0x2, %r13d
cmpq %rax, %rbp
jl 0x1a1d6
cmpq $0x0, 0x2f0(%r14)
je 0x1a4df
movq %r14, %rdi
callq 0x2904a
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 0x1a45d
movups 0x8(%rsp), %xmm0
movups %xmm0, (%rsi)
addq $0x10, 0x38(%rbx)
jmp 0x1a46b
leaq 0x30(%rbx), %rdi
leaq 0x8(%rsp), %rdx
callq 0x213ee
addl %r15d, %r15d
leaq 0x2c(%rsp), %rsi
movl %r15d, (%rsi)
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rcx
movl $0x1, %edx
callq 0x1f586
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x23202
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x1a4ae
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
movq 0x20(%rbx), %rsi
cmpq 0x28(%rbx), %rsi
je 0x1a4cf
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
movq %rax, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x20(%rbx)
jmp 0x1a4df
leaq 0x18(%rbx), %rdi
leaq 0x1ee1e(%rip), %rdx     # 0x392f8
callq 0x24924
movq 0x30(%rbx), %r12
movq 0x38(%rbx), %r15
cmpq %r15, %r12
je 0x1a557
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 0x1ed1c
cmpq $0x101, %r13            # imm = 0x101
jl 0x1a549
leaq 0x100(%r12), %r13
movq %r12, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x1f231
cmpq %r15, %r13
je 0x1a557
movq %r13, %rdi
movq %r14, %rsi
callq 0x1f2e2
addq $0x10, %r13
jmp 0x1a533
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x1f231
movq 0x30(%rbx), %rax
movq 0x38(%rbx), %rcx
subq %rax, %rcx
shrq $0x4, %rcx
testl %ecx, %ecx
jle 0x1a618
leaq 0x18(%rbx), %rcx
movq %rcx, 0x20(%rsp)
movl $0x8, %ebp
xorl %r14d, %r14d
leaq 0x8(%rsp), %r15
leaq 0x2c(%rsp), %r12
leaq 0x7(%rsp), %r13
movl -0x8(%rax,%rbp), %eax
movl %eax, 0x2c(%rsp)
movl $0x1, %edx
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rcx
callq 0x1f586
movq %rbx, %rdi
movq %r15, %rsi
callq 0x23202
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x1a5cb
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 0x1a5ec
movq (%rdx), %rax
movq %rax, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x20(%rbx)
jmp 0x1a5f6
movq 0x20(%rsp), %rdi
callq 0x24924
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 0x1a58e
movq %rbx, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1f3af(%rip), %rdi     # 0x399e0
leaq 0x1ecff(%rip), %rsi     # 0x39337
leaq 0x1f9d7(%rip), %rcx     # 0x3a016
movl $0x1b1, %edx            # imm = 0x1B1
callq 0x31b0
leaq 0x1f33e(%rip), %rdi     # 0x3998e
leaq 0x1ece0(%rip), %rsi     # 0x39337
leaq 0x1f9b8(%rip), %rcx     # 0x3a016
movl $0x1ae, %edx            # imm = 0x1AE
callq 0x31b0
leaq 0x1f31f(%rip), %rdi     # 0x3998e
leaq 0x1ecc1(%rip), %rsi     # 0x39337
leaq 0x1f999(%rip), %rcx     # 0x3a016
movl $0x1b9, %edx            # imm = 0x1B9
callq 0x31b0
leaq 0x1f9d6(%rip), %rdi     # 0x3a064
leaq 0x1eca2(%rip), %rsi     # 0x39337
leaq 0x1f97a(%rip), %rcx     # 0x3a016
movl $0x1ba, %edx            # imm = 0x1BA
callq 0x31b0
leaq 0x1f9f1(%rip), %rdi     # 0x3a09e
leaq 0x1ec83(%rip), %rsi     # 0x39337
leaq 0x1f95b(%rip), %rcx     # 0x3a016
movl $0x1bb, %edx            # imm = 0x1BB
callq 0x31b0
leaq 0x1f314(%rip), %rdi     # 0x399e0
leaq 0x1ec64(%rip), %rsi     # 0x39337
leaq 0x1f93c(%rip), %rcx     # 0x3a016
movl $0x1c4, %edx            # imm = 0x1C4
callq 0x31b0
leaq 0x1f9e7(%rip), %rdi     # 0x3a0d2
leaq 0x1ec45(%rip), %rsi     # 0x39337
leaq 0x1f91d(%rip), %rcx     # 0x3a016
movl $0x1c5, %edx            # imm = 0x1C5
callq 0x31b0
leaq 0x1fa02(%rip), %rdi     # 0x3a10c
leaq 0x1ec26(%rip), %rsi     # 0x39337
leaq 0x1f8fe(%rip), %rcx     # 0x3a016
movl $0x1c6, %edx            # imm = 0x1C6
callq 0x31b0
jmp 0x1a750
jmp 0x1a732
jmp 0x1a750
jmp 0x1a750
jmp 0x1a750
jmp 0x1a750
jmp 0x1a750
jmp 0x1a750
movq %rax, %r14
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x1a753
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
jmp 0x1a753
jmp 0x1a750
movq %rax, %r14
movq %rbx, %rdi
callq 0x20112
movq %r14, %rdi
callq 0x34a0
nop