// File: /workspace/github_cpp_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movl %r9d, 0x14(%rsp)
movl %r8d, %r15d
movl %edx, 0x8(%rsp)
movsd %xmm0, 0x38(%rsp)
movq %rsi, %r14
movq %rdi, %rbx
movb %cl, 0x3a0(%rdi)
leaq 0xe0(%rsp), %r13
movq %r13, %rdi
callq 0x28720
movq %r13, %rdi
callq 0x2872c
movl 0x210(%rbx), %ecx
movl 0x214(%rbx), %esi
leaq 0x1ede5(%rip), %rdx     # 0x39269
leaq 0x1edeb(%rip), %r8      # 0x39276
movq %rbx, %rdi
callq 0x1f578
leaq 0x128(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq 0x118(%rsp), %r13
movq %r13, %rdi
callq 0x93d0
leaq 0x1edbe(%rip), %rsi     # 0x3927f
movq %rbx, %rdi
movq %r13, %rdx
callq 0x1f5ba
movq 0x118(%rsp), %rdi
cmpq %r12, %rdi
je 0x1a4e9
movq 0x128(%rsp), %rsi
incq %rsi
callq 0x32b0
leaq 0x108(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq 0xf8(%rsp), %r13
movq %r13, %rdi
callq 0x93d0
leaq 0x1ed6a(%rip), %rsi     # 0x39281
movq %rbx, %rdi
movq %r13, %rdx
callq 0x1f682
movq 0xf8(%rsp), %rdi
cmpq %r12, %rdi
je 0x1a53f
movq 0x108(%rsp), %rsi
incq %rsi
callq 0x32b0
leaq 0x28(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
testq %rdx, %rdx
je 0x1a57a
movl $0x1, %ebp
xorl %ecx, %ecx
cmpb $0x23, (%rsi,%rcx)
je 0x1a581
movl %ebp, %ecx
incl %ebp
cmpq %rcx, %rdx
ja 0x1a566
jmp 0x1a615
xorl %edx, %edx
jmp 0x1a615
leaq 0xc0(%rsp), %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x32d0
leaq 0x18(%rsp), %rdi
leaq 0xc0(%rsp), %r13
movq %r13, %rsi
callq 0x3360
movq (%r13), %rdi
leaq 0xd0(%rsp), %r12
cmpq %r12, %rdi
je 0x1a5c9
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x32b0
movl %ebp, %edx
leaq 0xc0(%rsp), %rdi
movq %r14, %rsi
movq $-0x1, %rcx
callq 0x32d0
leaq 0xc0(%rsp), %r13
movq %r14, %rdi
movq %r13, %rsi
callq 0x3360
movq (%r13), %rdi
cmpq %r12, %rdi
je 0x1a60e
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x32b0
movq (%r14), %rsi
movq 0x8(%r14), %rdx
leaq 0xb0(%rsp), %rbp
movq %rbp, -0x10(%rbp)
addq %rsi, %rdx
leaq 0xa0(%rsp), %rdi
callq 0x93d0
leaq 0xa0(%rsp), %rsi
callq 0x19e84
movb $0x1, %r13b
testb %al, %al
je 0x1a69d
leaq 0x90(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
addq %rsi, %rdx
leaq 0x80(%rsp), %rdi
callq 0x93d0
leaq 0x80(%rsp), %rsi
callq 0x19f40
movl %eax, %r13d
xorb $0x1, %r13b
movq 0x80(%rsp), %rdi
cmpq %r12, %rdi
je 0x1a69d
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x32b0
movq 0xa0(%rsp), %rdi
cmpq %rbp, %rdi
je 0x1a6ba
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x32b0
testb %r13b, %r13b
jne 0x1a923
testb %r15b, %r15b
je 0x1a6e4
movq %rbx, %rdi
callq 0xa0ee
leaq 0x68(%rbx), %rdi
movl 0x60(%rbx), %esi
callq 0x2e5cc
movq %rbx, %rdi
callq 0xaed0
movq %rbx, %rdi
callq 0xb3de
leaq 0x1ebaf(%rip), %rdx     # 0x392a2
movq %rbx, %rdi
movl %eax, %esi
callq 0x1e844
movzbl 0x8(%rsp), %r12d
testb %r15b, %r15b
je 0x1a821
cmpq $0x0, 0x20(%rsp)
je 0x1a7b6
leaq 0xe0(%rsp), %rdi
callq 0x28744
leaq 0xe0(%rsp), %rdi
callq 0x28772
movsd %xmm0, 0x8(%rsp)
leaq 0x70(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq 0x60(%rsp), %rdi
callq 0x93d0
leaq 0x218(%rbx), %r15
movsd 0x8(%rsp), %xmm1
addsd %xmm1, %xmm1
movsd 0x38(%rsp), %xmm0
subsd %xmm1, %xmm0
leaq 0x60(%rsp), %rsi
movq %r15, %rdi
callq 0x294e2
movq 0x60(%rsp), %rdi
cmpq %r13, %rdi
je 0x1a794
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x32b0
movq %r15, %rdi
callq 0x2948a
leaq 0x18(%rsp), %rsi
movl 0x8(%rsi), %ecx
decl %ecx
movq %rbx, %rdi
xorl %edx, %edx
movl %r12d, %r8d
xorl %r9d, %r9d
callq 0x19ffc
movq %rbx, %rdi
callq 0xaed0
movq %rbx, %rdi
callq 0xac5a
movq %rbx, %rdi
callq 0xad46
cmpb $0x0, 0x14(%rsp)
je 0x1a7f4
movq %rbx, %rdi
callq 0xa1a0
addl %eax, 0x2cc(%rbx)
leaq 0x1ead3(%rip), %rdx     # 0x392bd
movq %rbx, %rdi
movl %eax, %esi
callq 0x1e844
movq %rbx, %rdi
callq 0xb3de
leaq 0x1ea9f(%rip), %rdx     # 0x392a2
movq %rbx, %rdi
movl %eax, %esi
callq 0x1e844
leaq 0x68(%rbx), %rdi
movl 0x60(%rbx), %esi
callq 0x2e5cc
cmpq $0x0, 0x20(%rsp)
jne 0x1a89d
leaq 0xe0(%rsp), %rdi
callq 0x28744
leaq 0xe0(%rsp), %rdi
callq 0x28772
movsd %xmm0, 0x8(%rsp)
leaq 0x50(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq 0x40(%rsp), %rdi
callq 0x93d0
leaq 0x218(%rbx), %r15
movsd 0x38(%rsp), %xmm0
subsd 0x8(%rsp), %xmm0
leaq 0x40(%rsp), %rsi
movq %r15, %rdi
callq 0x294e2
movq 0x40(%rsp), %rdi
cmpq %r13, %rdi
je 0x1a895
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x32b0
movq %r15, %rdi
callq 0x2948a
movl 0x8(%r14), %ecx
decl %ecx
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
movl %r12d, %r8d
movl $0x1, %r9d
callq 0x19ffc
leaq 0x218(%rbx), %rdi
callq 0x29494
movq %rbx, %rdi
callq 0xaed0
movq %rbx, %rdi
callq 0xb3de
leaq 0x1e9c6(%rip), %rdx     # 0x392a2
movq %rbx, %rdi
movl %eax, %esi
callq 0x1e844
movq %rbx, %rdi
callq 0x28338
movq %rax, 0x2e0(%rbx)
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x1a911
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x32b0
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1e965(%rip), %rsi     # 0x3928f
movq %rbx, %rdi
callq 0x1eac0
leaq 0x1e954(%rip), %rsi     # 0x3928d
movq %rbx, %rdi
callq 0x1f0da
callq 0x3180
movq %rax, %rbx
movq 0x60(%rsp), %rdi
cmpq %r13, %rdi
je 0x1aa05
movq 0x70(%rsp), %rsi
jmp 0x1a9f6
jmp 0x1aa02
jmp 0x1aa02
jmp 0x1aa02
movq %rax, %rbx
movq 0x80(%rsp), %rdi
cmpq %r12, %rdi
je 0x1a9e1
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x32b0
jmp 0x1a9e1
jmp 0x1aa02
movq %rax, %rbx
movq 0x40(%rsp), %rdi
cmpq %r13, %rdi
je 0x1aa05
movq 0x50(%rsp), %rsi
jmp 0x1a9f6
movq %rax, %rbx
movq 0xf8(%rsp), %rdi
cmpq %r12, %rdi
je 0x1aa21
movq 0x108(%rsp), %rsi
jmp 0x1aa19
movq %rax, %rbx
movq 0x118(%rsp), %rdi
cmpq %r12, %rdi
je 0x1aa21
movq 0x128(%rsp), %rsi
jmp 0x1aa19
jmp 0x1aa02
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
cmpq %rbp, %rdi
je 0x1aa05
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x32b0
jmp 0x1aa05
jmp 0x1aa02
movq %rax, %rbx
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x1aa21
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x32b0
movq %rbx, %rdi
callq 0x34a0