// File: /workspace/github_cpp_makefile_star2_O2/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, 0x8(%rsp)
movl %r8d, %r15d
movl %edx, %r12d
movsd %xmm0, 0x10(%rsp)
movq %rsi, %r14
movq %rdi, %rbx
movb %cl, 0x3a0(%rdi)
leaq 0x40(%rsp), %r13
movq %r13, %rdi
callq 0x21ad4
movq %r13, %rdi
callq 0x21ae0
movl 0x210(%rbx), %ecx
movl 0x214(%rbx), %esi
leaq 0x1b149(%rip), %rdx     # 0x301e9
leaq 0x1b14f(%rip), %r8      # 0x301f6
movq %rbx, %rdi
callq 0x193f8
leaq 0x118(%rsp), %r13
movq %r13, %rdi
movq %r14, %rsi
callq 0x33a0
leaq 0x1b136(%rip), %rsi     # 0x301ff
movq %rbx, %rdi
movq %r13, %rdx
callq 0x1943a
leaq 0x118(%rsp), %rdi
callq 0x3130
leaq 0xf8(%rsp), %r13
movq %r13, %rdi
movq %r14, %rsi
callq 0x33a0
leaq 0x1b106(%rip), %rsi     # 0x30201
movq %rbx, %rdi
movq %r13, %rdx
callq 0x1949c
leaq 0xf8(%rsp), %rdi
callq 0x3130
leaq 0x30(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0x8(%r14), %rax
pushq $0x1
popq %rbp
leal -0x1(%rbp), %ecx
cmpq %rcx, %rax
jbe 0x1519f
movq (%r14), %rdx
cmpb $0x23, (%rdx,%rcx)
je 0x15140
incl %ebp
jmp 0x1512b
leaq 0xd8(%rsp), %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x32d0
leaq 0x20(%rsp), %rdi
leaq 0xd8(%rsp), %r13
movq %r13, %rsi
callq 0x3350
movq %r13, %rdi
callq 0x3130
movl %ebp, %edx
leaq 0xd8(%rsp), %rdi
pushq $-0x1
popq %rcx
movq %r14, %rsi
callq 0x32d0
leaq 0xd8(%rsp), %r13
movq %r14, %rdi
movq %r13, %rsi
callq 0x3350
movq %r13, %rdi
callq 0x3130
leaq 0x58(%rsp), %rdi
movq %r14, %rsi
callq 0x33a0
leaq 0x58(%rsp), %rsi
callq 0x14b0a
testb %al, %al
je 0x1540d
leaq 0xb8(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x33a0
leaq 0xb8(%rsp), %rsi
callq 0x14ba4
movl %eax, %r13d
leaq 0xb8(%rsp), %rdi
callq 0x3130
leaq 0x58(%rsp), %rdi
callq 0x3130
testb %r13b, %r13b
je 0x15417
testb %r15b, %r15b
je 0x15221
movq %rbx, %rdi
callq 0x7d5c
leaq 0x68(%rbx), %rdi
movl 0x60(%rbx), %esi
callq 0x26c94
movq %rbx, %rdi
callq 0x88bc
movq %rbx, %rdi
callq 0x8cf6
leaq 0x1aff2(%rip), %rdx     # 0x30222
movq %rbx, %rdi
movl %eax, %esi
callq 0x189d8
movzbl %r12b, %r12d
testb %r15b, %r15b
je 0x15342
cmpq $0x0, 0x28(%rsp)
je 0x152d7
leaq 0x40(%rsp), %rdi
callq 0x21af8
leaq 0x40(%rsp), %rdi
callq 0x21b26
movsd %xmm0, 0x18(%rsp)
leaq 0x98(%rsp), %rdi
movq %r14, %rsi
callq 0x33a0
leaq 0x218(%rbx), %r15
movsd 0x18(%rsp), %xmm1
addsd %xmm1, %xmm1
movsd 0x10(%rsp), %xmm0
subsd %xmm1, %xmm0
leaq 0x98(%rsp), %rsi
movq %r15, %rdi
callq 0x225d0
leaq 0x98(%rsp), %rdi
callq 0x3130
movq %r15, %rdi
callq 0x22578
leaq 0x20(%rsp), %rsi
movl 0x8(%rsi), %ecx
decl %ecx
movq %rbx, %rdi
xorl %edx, %edx
movl %r12d, %r8d
xorl %r9d, %r9d
callq 0x14c3e
movq %rbx, %rdi
callq 0x88bc
movq %rbx, %rdi
callq 0x8694
movq %rbx, %rdi
callq 0x876c
cmpb $0x0, 0x8(%rsp)
je 0x15315
movq %rbx, %rdi
callq 0x7dc6
addl %eax, 0x2cc(%rbx)
leaq 0x1af32(%rip), %rdx     # 0x3023d
movq %rbx, %rdi
movl %eax, %esi
callq 0x189d8
movq %rbx, %rdi
callq 0x8cf6
leaq 0x1aefe(%rip), %rdx     # 0x30222
movq %rbx, %rdi
movl %eax, %esi
callq 0x189d8
leaq 0x68(%rbx), %rdi
movl 0x60(%rbx), %esi
callq 0x26c94
cmpq $0x0, 0x28(%rsp)
jne 0x1539b
leaq 0x40(%rsp), %rdi
callq 0x21af8
leaq 0x40(%rsp), %rdi
callq 0x21b26
movsd %xmm0, 0x8(%rsp)
leaq 0x78(%rsp), %rdi
movq %r14, %rsi
callq 0x33a0
leaq 0x218(%rbx), %r15
movsd 0x10(%rsp), %xmm0
subsd 0x8(%rsp), %xmm0
leaq 0x78(%rsp), %rsi
movq %r15, %rdi
callq 0x225d0
leaq 0x78(%rsp), %rdi
callq 0x3130
movq %r15, %rdi
callq 0x22578
movl 0x8(%r14), %ecx
decl %ecx
pushq $0x1
popq %r9
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
movl %r12d, %r8d
callq 0x14c3e
leaq 0x218(%rbx), %rdi
callq 0x22582
movq %rbx, %rdi
callq 0x88bc
movq %rbx, %rdi
callq 0x8cf6
leaq 0x1ae4a(%rip), %rdx     # 0x30222
movq %rbx, %rdi
movl %eax, %esi
callq 0x189d8
movq %rbx, %rdi
callq 0x217a2
movq %rax, 0x2e0(%rbx)
leaq 0x20(%rsp), %rdi
callq 0x3130
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x58(%rsp), %rdi
callq 0x3130
leaq 0x1adf1(%rip), %rsi     # 0x3020f
movq %rbx, %rdi
callq 0x18be4
leaq 0x1ade0(%rip), %rsi     # 0x3020d
movq %rbx, %rdi
callq 0x18fd8
callq 0x3190
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
jmp 0x1548f
jmp 0x15498
jmp 0x15498
jmp 0x15498
jmp 0x15498
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
jmp 0x1548f
movq %rax, %rbx
leaq 0xb8(%rsp), %rdi
callq 0x3130
jmp 0x1548a
movq %rax, %rbx
leaq 0xf8(%rsp), %rdi
jmp 0x154a0
movq %rax, %rbx
leaq 0x118(%rsp), %rdi
jmp 0x154a0
jmp 0x15498
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x3130
jmp 0x1549b
jmp 0x15498
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x3130
movq %rbx, %rdi
callq 0x3490