// File: Laakeri[P]maxpre/src/preprocessor.cpp
// Function: maxPreprocessor::Preprocessor::preprocess(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, double, bool, bool, bool, bool)
void Preprocessor::preprocess(string techniques, double timeLimit, bool debug, bool BVEgate_, bool initialCall, bool matchLabels) {
	BVEgate = BVEgate_;
	Timer preTime;
	preTime.start();
	log(originalVars, " variables, ", originalClauses, " clauses");
	
	print("c techniques ", techniques);
	log("techniques ", techniques);
	
	string preTechniques;
	for (unsigned i = 0; i < techniques.size(); i++) {
		if (techniques[i] == '#') {
			preTechniques = techniques.substr(0, i);
			techniques = techniques.substr(i + 1);
			break;
		}
	}
	
	if (!validTechniques(techniques) || !validPreTechniques(preTechniques)) {
		log("Invalid techniques");
		print("c Invalid techniques");
		abort();
	}
	
	if (initialCall) {
		removeTautologies();
		pi.tl.init(pi.vars);
		removeEmptyClauses();
	}
	
	int dpRm = removeDuplicateClauses();
	log(dpRm, " duplicate clauses removed");
	
	if (initialCall) {
		if (preTechniques.size() > 0) {
			preTime.stop(); // be sure that these 3 lines will be ran exactly once
			rLog.timePlan(timeLimit - preTime.getTime().count()*2, techniques);
			rLog.startTimer();
			doPreprocess(preTechniques, 0, (int)preTechniques.size() - 1, debug, false);
		}
		
		removeEmptyClauses();
		identifyLabels();
		createLabels();
		
		if (matchLabels) {
			int labelsMatched = eliminateReduntantLabels();
			rLog.labelsMatched += labelsMatched;
			log(labelsMatched, " labels matched");
		}
		
		dpRm = removeDuplicateClauses();
		log(dpRm, " duplicate clauses removed");
		
		pi.tl.init(pi.vars);
	}
	
	if (!initialCall || preTechniques.size() == 0) {
		preTime.stop();// here
		rLog.timePlan(timeLimit - preTime.getTime().count(), techniques);
		rLog.startTimer();
	}
	
	doPreprocess(techniques, 0, (int)techniques.size() - 1, debug, true);
	
	rLog.stopTimer();
	
	removeEmptyClauses();
	
	dpRm = removeDuplicateClauses();
	log(dpRm, " duplicate clauses removed");
	
	rLog.weightRange = pi.getWeightSum();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x260, %rsp            # imm = 0x260
movl %r8d, -0x1bc(%rbp)
movl %ecx, %eax
movl -0x1bc(%rbp), %ecx
movl %eax, -0x1b8(%rbp)
movl %edx, %eax
movl -0x1b8(%rbp), %edx
movl %eax, -0x1b4(%rbp)
movq %rsi, %rax
movl -0x1b4(%rbp), %esi
movq %rax, -0x1a8(%rbp)
movq %rdi, %r8
movq -0x1a8(%rbp), %rdi
movb %r9b, %al
movq %r8, -0x8(%rbp)
movq %rdi, -0x10(%rbp)
movsd %xmm0, -0x18(%rbp)
andb $0x1, %sil
movb %sil, -0x19(%rbp)
andb $0x1, %dl
movb %dl, -0x1a(%rbp)
andb $0x1, %cl
movb %cl, -0x1b(%rbp)
andb $0x1, %al
movb %al, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x1a0(%rbp)
movb -0x1a(%rbp), %cl
andb $0x1, %cl
movb %cl, 0x3a0(%rax)
leaq -0x38(%rbp), %rdi
movq %rdi, -0x1b0(%rbp)
callq 0x60980
movq -0x1b0(%rbp), %rdi
callq 0x609d0
movq -0x1a0(%rbp), %rdi
movl 0x210(%rdi), %ecx
movl 0x214(%rdi), %esi
leaq 0x57fdb(%rip), %rdx     # 0x87149
leaq 0x57fe1(%rip), %r8      # 0x87156
callq 0x3f610
movq -0x1a8(%rbp), %rsi
leaq -0x58(%rbp), %rdi
movq %rdi, -0x198(%rbp)
callq 0x4190
movq -0x1a0(%rbp), %rdi
movq -0x198(%rbp), %rdx
leaq 0x57fb9(%rip), %rsi     # 0x8715f
callq 0x3f670
jmp 0x2f1ad
leaq -0x58(%rbp), %rdi
callq 0x4240
movq -0x1a8(%rbp), %rsi
leaq -0x88(%rbp), %rdi
movq %rdi, -0x1c8(%rbp)
callq 0x4190
movq -0x1a0(%rbp), %rdi
movq -0x1c8(%rbp), %rdx
leaq 0x57f7c(%rip), %rsi     # 0x87161
callq 0x3f700
jmp 0x2f1ec
leaq -0x88(%rbp), %rdi
callq 0x4240
leaq -0xa8(%rbp), %rdi
callq 0x4500
movl $0x0, -0xac(%rbp)
movq -0x1a8(%rbp), %rdi
movl -0xac(%rbp), %eax
movq %rax, -0x1d0(%rbp)
callq 0x42a0
movq %rax, %rcx
movq -0x1d0(%rbp), %rax
cmpq %rcx, %rax
jae 0x2f356
movq -0x1a8(%rbp), %rdi
movl -0xac(%rbp), %eax
movl %eax, %esi
callq 0x46b0
movq %rax, -0x1d8(%rbp)
jmp 0x2f257
movq -0x1d8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x23, %eax
jne 0x2f340
movq -0x1a8(%rbp), %rsi
movl -0xac(%rbp), %eax
movl %eax, %ecx
xorl %eax, %eax
movl %eax, %edx
leaq -0xd0(%rbp), %rdi
callq 0x43b0
jmp 0x2f28b
leaq -0xa8(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
movq %rsi, -0x1e0(%rbp)
callq 0x4490
movq -0x1e0(%rbp), %rdi
callq 0x4240
movq -0x1a8(%rbp), %rsi
movl -0xac(%rbp), %eax
incl %eax
movl %eax, %edx
leaq -0xf0(%rbp), %rdi
movq $-0x1, %rcx
callq 0x43b0
jmp 0x2f2d7
movq -0x1a8(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x4490
leaq -0xf0(%rbp), %rdi
callq 0x4240
jmp 0x2f356
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x4240
jmp 0x2f922
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x4240
jmp 0x2f922
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x2f916
jmp 0x2f342
movl -0xac(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xac(%rbp)
jmp 0x2f20e
movq -0x1a8(%rbp), %rsi
movb $0x0, -0x131(%rbp)
leaq -0x110(%rbp), %rdi
callq 0x4190
jmp 0x2f372
movq -0x1a0(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x2e470
movb %al, -0x1e1(%rbp)
jmp 0x2f38d
movb -0x1e1(%rbp), %cl
movb $0x1, %al
testb $0x1, %cl
movb %al, -0x1e2(%rbp)
jne 0x2f3a2
jmp 0x2f3e7
leaq -0x130(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x4190
jmp 0x2f3b7
movq -0x1a0(%rbp), %rdi
movb $0x1, -0x131(%rbp)
leaq -0x130(%rbp), %rsi
callq 0x2e6d0
movb %al, -0x1e3(%rbp)
jmp 0x2f3d9
movb -0x1e3(%rbp), %al
xorb $-0x1, %al
movb %al, -0x1e2(%rbp)
movb -0x1e2(%rbp), %al
movb %al, -0x1e4(%rbp)
testb $0x1, -0x131(%rbp)
jne 0x2f3fe
jmp 0x2f40a
leaq -0x130(%rbp), %rdi
callq 0x4240
leaq -0x110(%rbp), %rdi
callq 0x4240
movb -0x1e4(%rbp), %al
testb $0x1, %al
jne 0x2f422
jmp 0x2f495
movq -0x1a0(%rbp), %rdi
leaq 0x57d3f(%rip), %rsi     # 0x8716f
callq 0x3cf50
jmp 0x2f437
movq -0x1a0(%rbp), %rdi
leaq 0x57d28(%rip), %rsi     # 0x8716d
callq 0x3e470
jmp 0x2f44c
callq 0x41f0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x2f484
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
testb $0x1, -0x131(%rbp)
jne 0x2f476
jmp 0x2f482
leaq -0x130(%rbp), %rdi
callq 0x4240
jmp 0x2f484
leaq -0x110(%rbp), %rdi
callq 0x4240
jmp 0x2f916
testb $0x1, -0x1b(%rbp)
je 0x2f4d1
movq -0x1a0(%rbp), %rdi
callq 0x10c80
jmp 0x2f4a9
movq -0x1a0(%rbp), %rax
movq %rax, %rdi
addq $0x68, %rdi
movl 0x60(%rax), %esi
callq 0x72190
jmp 0x2f4c1
movq -0x1a0(%rbp), %rdi
callq 0x129e0
jmp 0x2f4cf
jmp 0x2f4d1
movq -0x1a0(%rbp), %rdi
callq 0x13190
movl %eax, -0x1e8(%rbp)
jmp 0x2f4e5
movq -0x1a0(%rbp), %rdi
movl -0x1e8(%rbp), %eax
movl %eax, -0x138(%rbp)
movl -0x138(%rbp), %esi
leaq 0x57c7d(%rip), %rdx     # 0x87182
callq 0x3c620
jmp 0x2f50c
testb $0x1, -0x1b(%rbp)
je 0x2f734
leaq -0xa8(%rbp), %rdi
callq 0x42a0
cmpq $0x0, %rax
jbe 0x2f65e
leaq -0x38(%rbp), %rdi
callq 0x60a10
jmp 0x2f537
movq -0x1a0(%rbp), %rax
addq $0x218, %rax            # imm = 0x218
movq %rax, -0x200(%rbp)
movsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x1f8(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x60a80
movsd %xmm0, -0x1f0(%rbp)
jmp 0x2f56b
movsd -0x1f0(%rbp), %xmm0
movsd %xmm0, -0x140(%rbp)
leaq -0x140(%rbp), %rdi
callq 0xabd0
movsd %xmm0, -0x208(%rbp)
jmp 0x2f591
movq -0x1a8(%rbp), %rsi
movsd -0x1f8(%rbp), %xmm0
movsd -0x208(%rbp), %xmm1
addsd %xmm1, %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, -0x210(%rbp)
leaq -0x160(%rbp), %rdi
callq 0x4190
jmp 0x2f5c6
movsd -0x210(%rbp), %xmm0
movq -0x200(%rbp), %rdi
leaq -0x160(%rbp), %rsi
callq 0x61f40
jmp 0x2f5e3
leaq -0x160(%rbp), %rdi
callq 0x4240
movq -0x1a0(%rbp), %rdi
addq $0x218, %rdi            # imm = 0x218
callq 0x61db0
jmp 0x2f604
leaq -0xa8(%rbp), %rdi
movq %rdi, -0x218(%rbp)
callq 0x42a0
movq -0x1a0(%rbp), %rdi
movq -0x218(%rbp), %rsi
movl %eax, %ecx
decl %ecx
movzbl -0x19(%rbp), %r8d
andl $0x1, %r8d
xorl %r9d, %r9d
movl %r9d, %edx
callq 0x2e930
jmp 0x2f63f
jmp 0x2f65e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x160(%rbp), %rdi
callq 0x4240
jmp 0x2f916
movq -0x1a0(%rbp), %rdi
callq 0x129e0
jmp 0x2f66c
movq -0x1a0(%rbp), %rdi
callq 0x12570
jmp 0x2f67a
movq -0x1a0(%rbp), %rdi
callq 0x12770
jmp 0x2f688
testb $0x1, -0x1c(%rbp)
je 0x2f6df
movq -0x1a0(%rbp), %rdi
callq 0x10d20
movl %eax, -0x21c(%rbp)
jmp 0x2f6a2
movq -0x1a0(%rbp), %rdi
movl -0x21c(%rbp), %eax
movl %eax, -0x164(%rbp)
movl -0x164(%rbp), %ecx
movl 0x2cc(%rdi), %eax
addl %ecx, %eax
movl %eax, 0x2cc(%rdi)
movl -0x164(%rbp), %esi
leaq 0x57ac7(%rip), %rdx     # 0x8719d
callq 0x3c620
jmp 0x2f6dd
jmp 0x2f6df
movq -0x1a0(%rbp), %rdi
callq 0x13190
movl %eax, -0x220(%rbp)
jmp 0x2f6f3
movq -0x1a0(%rbp), %rdi
movl -0x220(%rbp), %eax
movl %eax, -0x138(%rbp)
movl -0x138(%rbp), %esi
leaq 0x57a6f(%rip), %rdx     # 0x87182
callq 0x3c620
jmp 0x2f71a
movq -0x1a0(%rbp), %rax
movq %rax, %rdi
addq $0x68, %rdi
movl 0x60(%rax), %esi
callq 0x72190
jmp 0x2f732
jmp 0x2f734
testb $0x1, -0x1b(%rbp)
je 0x2f750
leaq -0xa8(%rbp), %rdi
callq 0x42a0
cmpq $0x0, %rax
jne 0x2f843
leaq -0x38(%rbp), %rdi
callq 0x60a10
jmp 0x2f75b
movq -0x1a0(%rbp), %rax
addq $0x218, %rax            # imm = 0x218
movq %rax, -0x238(%rbp)
movsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x230(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x60a80
movsd %xmm0, -0x228(%rbp)
jmp 0x2f78f
movsd -0x228(%rbp), %xmm0
movsd %xmm0, -0x170(%rbp)
leaq -0x170(%rbp), %rdi
callq 0xabd0
movsd %xmm0, -0x240(%rbp)
jmp 0x2f7b5
movq -0x1a8(%rbp), %rsi
movsd -0x240(%rbp), %xmm1
movsd -0x230(%rbp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, -0x248(%rbp)
leaq -0x190(%rbp), %rdi
callq 0x4190
jmp 0x2f7e6
movsd -0x248(%rbp), %xmm0
movq -0x238(%rbp), %rdi
leaq -0x190(%rbp), %rsi
callq 0x61f40
jmp 0x2f803
leaq -0x190(%rbp), %rdi
callq 0x4240
movq -0x1a0(%rbp), %rdi
addq $0x218, %rdi            # imm = 0x218
callq 0x61db0
jmp 0x2f824
jmp 0x2f843
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x190(%rbp), %rdi
callq 0x4240
jmp 0x2f916
movq -0x1a8(%rbp), %rdi
callq 0x42a0
movq -0x1a0(%rbp), %rdi
movq -0x1a8(%rbp), %rsi
movl %eax, %ecx
decl %ecx
movzbl -0x19(%rbp), %r8d
andl $0x1, %r8d
xorl %edx, %edx
movl $0x1, %r9d
callq 0x2e930
jmp 0x2f879
movq -0x1a0(%rbp), %rdi
addq $0x218, %rdi            # imm = 0x218
callq 0x61dd0
jmp 0x2f88e
movq -0x1a0(%rbp), %rdi
callq 0x129e0
jmp 0x2f89c
movq -0x1a0(%rbp), %rdi
callq 0x13190
movl %eax, -0x24c(%rbp)
jmp 0x2f8b0
movq -0x1a0(%rbp), %rdi
movl -0x24c(%rbp), %eax
movl %eax, -0x138(%rbp)
movl -0x138(%rbp), %esi
leaq 0x578b2(%rip), %rdx     # 0x87182
callq 0x3c620
jmp 0x2f8d7
movq -0x1a0(%rbp), %rdi
callq 0x5fdb0
movq %rax, -0x258(%rbp)
jmp 0x2f8ec
movq -0x1a0(%rbp), %rax
movq -0x258(%rbp), %rcx
movq %rcx, 0x2e0(%rax)
leaq -0xa8(%rbp), %rdi
callq 0x4240
addq $0x260, %rsp            # imm = 0x260
popq %rbp
retq
leaq -0xa8(%rbp), %rdi
callq 0x4240
movq -0x60(%rbp), %rdi
callq 0x4610
nopl (%rax,%rax)