// File: /workspace/github_cpp_makefile_star2_O2/Laakeri[P]maxpre/src/preprocessor.cpp
// Function: maxPreprocessor::Preprocessor::doPreprocess(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, int, int, bool, bool)
int Preprocessor::doPreprocess(const string& techniques, int l, int r, bool debug, bool topLevel) {
	int found = 0;
	if (l == r) {
		char tc = techniques[l];
		if (tc == 'b') {
			while (int f = doBCE()) {
				found += f;
			}
			if (debug) doBCE2();
		}
		else if (tc == 'u') {
			while (int f = doUP()) {
				found += f;
			}
			if (debug) doUP2();
		}
		else if (tc == 'v') {
			while (int f = doBVE()) {
				found += f;
			}
			if (debug) doBVE2();
		}
		else if (tc == 's') {
			while (int f = doSE()) {
				found += f;
			}
			if (debug) doSE2();
		}
		else if (tc == 'r') {
			while (int f = doSSR()) {
				found += f;
			}
			if (debug) doSSR2();
		}
		else if (tc == 'l') {
			while (int f = doSLE()) {
				found += f;
			}
			if (debug) doSLE2();
		}
		else if (tc == 'c') {
			while (int f = doBCR()) {
				found += f;
			}
			if (debug) doBCR2();
		}
		else if (tc == 'i') {
			while (int f = doSIE()) {
				found += f;
			}
			if (debug) doSIE2();
		}
		else if (tc == 'e') {
			while (int f = doBIG(false)) {
				found += f;
			}
			if (debug) doBIG2(false);
		}
		else if (tc == 'a') {
			while (int f = doBVA()) {
				found += f;
			}
			if (debug) doBVA2();
		}
		else if (tc == 'g') {
			while (int f = doGSLE()) {
				found += f;
			}
			if (debug) doGSLE2();
		}
		else if (tc == 'p') {
			while (int f = doFLP()) {
				found += f;
			}
			// FLP already checks every label
		}
		else if (tc == 'h') {
			while (int f = doBIG(true)) {
				found += f;
			}
			if (debug) doBIG2(true);
		}
		else if (tc == 't') {
			found += doLS();
		}
		else {
			abort();
		}
		pi.tl.shrink(logLevel > 0);
	}
	else {
		int lp = l;
		int br = 0;
		for (int i = l; i <= r; i++) {
			if (techniques[i] == '[') {
				br++;
			}
			else if(techniques[i] == ']') {
				br--;
				if (br == 0) {
					while (int f = doPreprocess(techniques, lp + 1, i - 1, debug, false)) {
						found += f;
					}
					if (topLevel) {
						for (int j = lp + 1; j <= i - 1; j++) {
							if (techniques[j] != ']' && techniques[j] != '[' && (techniques[j] < '0' || techniques[j] > '9')) {
								bool neverAgain = true;
								for (int jj = i + 1; jj <= r; jj++) {
									if (techniques[jj] == techniques[j]) {
										neverAgain = false;
									}
								}
								if (neverAgain) {
									rLog.neverAgain(techniques[j]);
								}
							}
						}
					}
					lp = i + 1;
				}
			}
			else {
				if (br == 0) {
					assert(lp == i);
					found += doPreprocess(techniques, i, i, debug, false);
					if (topLevel) {
						bool neverAgain = true;
						for (int j = i + 1; j <= r; j++) {
							if (techniques[j] == techniques[i]) {
								neverAgain = false;
							}
						}
						if (neverAgain) {
							rLog.neverAgain(techniques[i]);
						}
					}
					lp = i + 1;
				}
			}
		}
		assert(br == 0);
	}
	return found;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r9d, 0x4(%rsp)
movl %r8d, %r13d
movq %rsi, %r12
movq %rdi, %r14
cmpl %ecx, %edx
jne 0x14cab
movslq %edx, %rax
movq (%r12), %rcx
movzbl (%rcx,%rax), %eax
addl $-0x61, %eax
cmpl $0x15, %eax
ja 0x15044
leaq 0x1a654(%rip), %rcx     # 0x2f2d0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
xorl %ebp, %ebp
movq %r14, %rdi
callq 0x1282c
addl %eax, %ebp
testl %eax, %eax
jne 0x14c87
testb %r13b, %r13b
je 0x14ffd
movq %r14, %rdi
callq 0x12aea
jmp 0x14ffd
movslq %edx, %rbx
movq %r14, 0x10(%rsp)
leaq 0x218(%r14), %rax
movq %rax, 0x8(%rsp)
movslq %ecx, %r14
xorl %eax, %eax
movzbl %r13b, %ecx
movl %ecx, (%rsp)
xorl %ebp, %ebp
movq %r14, 0x18(%rsp)
cmpq %r14, %rbx
jg 0x14e28
movq (%r12), %rcx
movzbl (%rcx,%rbx), %ecx
cmpl $0x5d, %ecx
je 0x14cf8
cmpl $0x5b, %ecx
jne 0x14dac
incl %eax
jmp 0x14e20
decl %eax
jne 0x14e20
incl %edx
movq %rbx, 0x20(%rsp)
leal -0x1(%rbx), %r15d
movq %r12, %rbx
movl (%rsp), %r12d
movq 0x10(%rsp), %r13
movq %r13, %rdi
movq %rbx, %rsi
movl %r15d, %ecx
movl %ebp, %r14d
movl %edx, %ebp
movl %r12d, %r8d
xorl %r9d, %r9d
callq 0x14c3e
movl %ebp, %edx
movl %r14d, %ebp
addl %eax, %ebp
testl %eax, %eax
jne 0x14d17
cmpb $0x0, 0x4(%rsp)
movq %rbx, %r12
movq 0x20(%rsp), %rbx
movq 0x18(%rsp), %r14
je 0x14dfe
movslq %edx, %r15
cmpq %rbx, %r15
jge 0x14dfe
movq (%r12), %rcx
movzbl (%rcx,%r15), %eax
cmpl $0x5b, %eax
je 0x14da7
cmpl $0x5d, %eax
je 0x14da7
leal -0x3a(%rax), %edx
cmpb $-0xb, %dl
ja 0x14da7
movb $0x1, %dl
movq %rbx, %rsi
cmpq %r14, %rsi
jge 0x14d95
cmpb %al, 0x1(%rcx,%rsi)
leaq 0x1(%rsi), %rsi
setne %dil
andb %dil, %dl
jmp 0x14d7f
testb $0x1, %dl
je 0x14da7
movsbl %al, %esi
movq 0x8(%rsp), %rdi
callq 0x22a78
incq %r15
jmp 0x14d56
testl %eax, %eax
jne 0x14e20
cmpl %ebx, %edx
jne 0x15025
movq 0x10(%rsp), %rdi
movq %r12, %rsi
movl %edx, %r13d
movl %edx, %ecx
movl (%rsp), %r8d
xorl %r9d, %r9d
callq 0x14c3e
movl %eax, %r15d
cmpb $0x0, 0x4(%rsp)
je 0x14e16
movq (%r12), %rax
movb $0x1, %cl
movq %rbx, %rdx
cmpq %r14, %rdx
jge 0x14e03
movb 0x1(%rax,%rdx), %sil
incq %rdx
cmpb (%rax,%rbx), %sil
setne %sil
andb %sil, %cl
jmp 0x14de4
leal 0x1(%rbx), %edx
jmp 0x14e1e
testb $0x1, %cl
je 0x14e16
movsbl (%rax,%rbx), %esi
movq 0x8(%rsp), %rdi
callq 0x22a78
addl %r15d, %ebp
movl %r13d, %edx
incl %edx
xorl %eax, %eax
incq %rbx
jmp 0x14cd2
testl %eax, %eax
je 0x15014
leaq 0x1b3aa(%rip), %rdi     # 0x301e1
leaq 0x1a529(%rip), %rsi     # 0x2f367
leaq 0x1b346(%rip), %rcx     # 0x3018b
movl $0x2a2, %edx            # imm = 0x2A2
callq 0x31c0
movq %r14, %rdi
callq 0x14448
movl %eax, %ebp
jmp 0x14ffd
xorl %ebp, %ebp
movq %r14, %rdi
callq 0xd9d0
addl %eax, %ebp
testl %eax, %eax
jne 0x14e60
testb %r13b, %r13b
je 0x14ffd
movq %r14, %rdi
callq 0xdc16
jmp 0x14ffd
xorl %ebp, %ebp
movq %r14, %rdi
callq 0x8b6a
addl %eax, %ebp
testl %eax, %eax
jne 0x14e86
testb %r13b, %r13b
je 0x14ffd
movq %r14, %rdi
callq 0x8c92
jmp 0x14ffd
xorl %ebp, %ebp
movq %r14, %rdi
callq 0x9cbe
addl %eax, %ebp
testl %eax, %eax
jne 0x14eac
testb %r13b, %r13b
je 0x14ffd
movq %r14, %rdi
callq 0x9f7a
jmp 0x14ffd
xorl %ebp, %ebp
movq %r14, %rdi
callq 0x13e0c
addl %eax, %ebp
testl %eax, %eax
jne 0x14ed2
jmp 0x14ffd
xorl %ebp, %ebp
movq %r14, %rdi
callq 0xc7d8
addl %eax, %ebp
testl %eax, %eax
jne 0x14ee7
testb %r13b, %r13b
je 0x14ffd
movq %r14, %rdi
callq 0xcb26
jmp 0x14ffd
xorl %ebp, %ebp
movq %r14, %rdi
callq 0x13486
addl %eax, %ebp
testl %eax, %eax
jne 0x14f0d
testb %r13b, %r13b
je 0x14ffd
movq %r14, %rdi
callq 0x137ec
jmp 0x14ffd
xorl %ebp, %ebp
movq %r14, %rdi
callq 0xde26
addl %eax, %ebp
testl %eax, %eax
jne 0x14f33
testb %r13b, %r13b
je 0x14ffd
movq %r14, %rdi
callq 0xe0ce
jmp 0x14ffd
xorl %ebp, %ebp
pushq $0x1
popq %r15
movq %r14, %rdi
movl %r15d, %esi
callq 0x11640
addl %eax, %ebp
testl %eax, %eax
jne 0x14f5d
testb %r13b, %r13b
je 0x14ffd
pushq $0x1
popq %rsi
movq %r14, %rdi
jmp 0x14fd9
xorl %ebp, %ebp
movq %r14, %rdi
callq 0xee12
addl %eax, %ebp
testl %eax, %eax
jne 0x14f81
testb %r13b, %r13b
je 0x14ffd
movq %r14, %rdi
callq 0xf1f2
jmp 0x14ffd
xorl %ebp, %ebp
movq %r14, %rdi
callq 0xe3e4
addl %eax, %ebp
testl %eax, %eax
jne 0x14fa0
testb %r13b, %r13b
je 0x14ffd
movq %r14, %rdi
callq 0xe716
jmp 0x14ffd
xorl %ebp, %ebp
movq %r14, %rdi
xorl %esi, %esi
callq 0x11640
addl %eax, %ebp
testl %eax, %eax
jne 0x14fbf
testb %r13b, %r13b
je 0x14ffd
movq %r14, %rdi
xorl %esi, %esi
callq 0x11820
jmp 0x14ffd
xorl %ebp, %ebp
movq %r14, %rdi
callq 0xfa3c
addl %eax, %ebp
testl %eax, %eax
jne 0x14fe2
testb %r13b, %r13b
je 0x14ffd
movq %r14, %rdi
callq 0xfb14
leaq 0x68(%r14), %rdi
xorl %esi, %esi
cmpl $0x0, 0x2e8(%r14)
setg %sil
callq 0x26d2c
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1b157(%rip), %rdi     # 0x30183
leaq 0x1a334(%rip), %rsi     # 0x2f367
leaq 0x1b151(%rip), %rcx     # 0x3018b
movl $0x291, %edx            # imm = 0x291
callq 0x31c0
callq 0x3190
nop