// File: /workspace/github_cpp_makefile_star2_O1/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, (%rsp)
movl %edx, 0x8(%rsp)
movsd %xmm0, 0x38(%rsp)
movq %rsi, %r14
movq %rdi, %rbx
movb %cl, 0x3a0(%rdi)
leaq 0xe0(%rsp), %r15
movq %r15, %rdi
callq 0x29468
movq %r15, %rdi
callq 0x29474
movl 0x210(%rbx), %ecx
movl 0x214(%rbx), %esi
leaq 0x1f3b8(%rip), %rdx     # 0x3a1b9
leaq 0x1f3be(%rip), %r8      # 0x3a1c6
movq %rbx, %rdi
callq 0x2014a
leaq 0x128(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq 0x118(%rsp), %r15
movq %r15, %rdi
callq 0x93cc
leaq 0x1f391(%rip), %rsi     # 0x3a1cf
movq %rbx, %rdi
movq %r15, %rdx
callq 0x2018c
movq 0x118(%rsp), %rdi
cmpq %r12, %rdi
je 0x1ae66
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), %r15
movq %r15, %rdi
callq 0x93cc
leaq 0x1f33d(%rip), %rsi     # 0x3a1d1
movq %rbx, %rdi
movq %r15, %rdx
callq 0x20254
movq 0xf8(%rsp), %rdi
cmpq %r12, %rdi
je 0x1aebc
movq 0x108(%rsp), %rsi
incq %rsi
callq 0x32b0
leaq 0x28(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0x8(%r14), %rax
testq %rax, %rax
je 0x1af8a
movq (%r14), %rdx
movl $0x1, %r12d
xorl %ecx, %ecx
cmpb $0x23, (%rdx,%rcx)
je 0x1aefe
movl %r12d, %ecx
incl %r12d
cmpq %rcx, %rax
ja 0x1aee8
jmp 0x1af8a
leaq 0xc0(%rsp), %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x32d0
leaq 0x18(%rsp), %rdi
leaq 0xc0(%rsp), %r15
movq %r15, %rsi
callq 0x3360
movq (%r15), %rdi
leaq 0xd0(%rsp), %r13
cmpq %r13, %rdi
je 0x1af45
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x32b0
movl %r12d, %edx
leaq 0xc0(%rsp), %rdi
movq %r14, %rsi
movq $-0x1, %rcx
callq 0x32d0
leaq 0xc0(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x3360
movq (%r15), %rdi
cmpq %r13, %rdi
je 0x1af8a
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x32b0
leaq 0xb0(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq 0xa0(%rsp), %rdi
callq 0x93cc
leaq 0xa0(%rsp), %rsi
callq 0x1a764
movl %eax, %r15d
movb $0x1, %r13b
testb %al, %al
je 0x1afff
leaq 0x90(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
addq %rsi, %rdx
leaq 0x80(%rsp), %rdi
callq 0x93cc
leaq 0x80(%rsp), %rsi
callq 0x1a856
movl %eax, %r13d
xorb $0x1, %r13b
testb %r15b, %r15b
je 0x1b025
leaq 0x90(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1b025
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x32b0
movq 0xa0(%rsp), %rdi
cmpq %r12, %rdi
je 0x1b042
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x32b0
testb %r13b, %r13b
jne 0x1b2b1
cmpb $0x0, (%rsp)
je 0x1b06d
movq %rbx, %rdi
callq 0xa0ea
leaq 0x68(%rbx), %rdi
movl 0x60(%rbx), %esi
callq 0x2f2dc
movq %rbx, %rdi
callq 0xafd4
movq %rbx, %rdi
callq 0xb52c
leaq 0x1f176(%rip), %rdx     # 0x3a1f2
movq %rbx, %rdi
movl %eax, %esi
callq 0x1f426
movzbl 0x8(%rsp), %r12d
cmpb $0x0, (%rsp)
je 0x1b1b1
cmpq $0x0, 0x20(%rsp)
je 0x1b140
leaq 0xe0(%rsp), %rdi
callq 0x2948c
leaq 0xe0(%rsp), %rdi
callq 0x294ba
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 0x93cc
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 0x2a22a
movq 0x60(%rsp), %rdi
cmpq %r13, %rdi
je 0x1b11e
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x32b0
movq %r15, %rdi
callq 0x2a1d2
leaq 0x18(%rsp), %rsi
movl 0x8(%rsi), %ecx
decl %ecx
movq %rbx, %rdi
xorl %edx, %edx
movl %r12d, %r8d
xorl %r9d, %r9d
callq 0x1a948
movq %rbx, %rdi
callq 0xafd4
movq %rbx, %rdi
callq 0xad06
movq %rbx, %rdi
callq 0xae28
cmpb $0x0, 0x14(%rsp)
je 0x1b17e
movq %rbx, %rdi
callq 0xa1a4
addl %eax, 0x2cc(%rbx)
leaq 0x1f099(%rip), %rdx     # 0x3a20d
movq %rbx, %rdi
movl %eax, %esi
callq 0x1f426
movq %rbx, %rdi
callq 0xb52c
leaq 0x1f065(%rip), %rdx     # 0x3a1f2
movq %rbx, %rdi
movl %eax, %esi
callq 0x1f426
leaq 0x68(%rbx), %rdi
movl 0x60(%rbx), %esi
callq 0x2f2dc
cmpb $0x0, (%rsp)
je 0x1b1b1
cmpq $0x0, 0x20(%rsp)
jne 0x1b22b
leaq 0xe0(%rsp), %rdi
callq 0x2948c
leaq 0xe0(%rsp), %rdi
callq 0x294ba
movsd %xmm0, (%rsp)
leaq 0x50(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq 0x40(%rsp), %rdi
callq 0x93cc
leaq 0x218(%rbx), %r15
movsd 0x38(%rsp), %xmm0
subsd (%rsp), %xmm0
leaq 0x40(%rsp), %rsi
movq %r15, %rdi
callq 0x2a22a
movq 0x40(%rsp), %rdi
cmpq %r13, %rdi
je 0x1b223
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x32b0
movq %r15, %rdi
callq 0x2a1d2
movl 0x8(%r14), %ecx
decl %ecx
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
movl %r12d, %r8d
movl $0x1, %r9d
callq 0x1a948
leaq 0x218(%rbx), %rdi
callq 0x2a1dc
movq %rbx, %rdi
callq 0xafd4
movq %rbx, %rdi
callq 0xb52c
leaq 0x1ef88(%rip), %rdx     # 0x3a1f2
movq %rbx, %rdi
movl %eax, %esi
callq 0x1f426
movq %rbx, %rdi
callq 0x29064
movq %rax, 0x2e0(%rbx)
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x1b29f
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 0x1ef27(%rip), %rsi     # 0x3a1df
movq %rbx, %rdi
callq 0x1f6a2
leaq 0x1ef16(%rip), %rsi     # 0x3a1dd
movq %rbx, %rdi
callq 0x1fc9e
callq 0x3180
movq %rax, %rbx
movq 0x60(%rsp), %rdi
cmpq %r13, %rdi
je 0x1b393
movq 0x70(%rsp), %rsi
jmp 0x1b384
jmp 0x1b390
jmp 0x1b390
jmp 0x1b390
movq %rax, %rbx
movq 0x80(%rsp), %rdi
cmpq %rbp, %rdi
je 0x1b36f
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x32b0
jmp 0x1b36f
jmp 0x1b390
movq %rax, %rbx
movq 0x40(%rsp), %rdi
cmpq %r13, %rdi
je 0x1b393
movq 0x50(%rsp), %rsi
jmp 0x1b384
movq %rax, %rbx
movq 0xf8(%rsp), %rdi
cmpq %r12, %rdi
je 0x1b3af
movq 0x108(%rsp), %rsi
jmp 0x1b3a7
movq %rax, %rbx
movq 0x118(%rsp), %rdi
cmpq %r12, %rdi
je 0x1b3af
movq 0x128(%rsp), %rsi
jmp 0x1b3a7
jmp 0x1b390
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
cmpq %r12, %rdi
je 0x1b393
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x32b0
jmp 0x1b393
jmp 0x1b390
movq %rax, %rbx
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x1b3af
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x32b0
movq %rbx, %rdi
callq 0x34a0