// File: Laakeri[P]maxpre/src/AMSLEX.cpp
// Function: maxPreprocessor::AMSLEX::CSO2(std::vector<int, std::allocator<int>> const&, unsigned int, unsigned int, std::vector<int, std::allocator<int>> const&, unsigned int, unsigned int)
bool AMSLEX::CSO2(const vector<int>& D, unsigned b, unsigned e, const vector<int>& S, unsigned j, unsigned d) {
	while (j < S.size() && S[j] < pi.clauses[D[b]].lit[d]) j++;
	if (j >= S.size()) return false;
	
	if (S[j] == pi.clauses[D[b]].lit[d]) {
		unsigned ee = b;
		if (e - b < BSconst) {
			while (ee + 1 <= e && pi.clauses[D[ee + 1]].lit[d] == S[j]) ee++;
		}
		else {
			int mi = b;
			int ma = e - 1;
			while (mi <= ma) {
				int mid = (mi+ma)/2;
				if (pi.clauses[D[mid + 1]].lit[d] == S[j]) {
					ee = mid + 1;
					mi = mid + 1;
				}
				else {
					ma = mid - 1;
				}
			}
		}
		if (S.size() > d + 1 && pi.clauses[D[b]].lit.size() == d + 1) {
			return true;
		}
		if (j + 1 <= S.size()) {
			if (CSO2(D, b, ee, S, j + 1, d + 1)) {
				return true;
			}
		}
		b = ee + 1;
	}
	else {
		if (e - b < BSconst) {
			while (b <= e && pi.clauses[D[b]].lit[d] < S[j]) b++;
		}
		else {
			int mi = b;
			int ma = e;
			while (mi <= ma) {
				int mid = (mi+ma)/2;
				if (pi.clauses[D[mid]].lit[d] < S[j]) {
					b = mid + 1;
					mi = mid + 1;
				}
				else {
					ma = mid - 1;
				}
			}
		}
	}
	if (b <= e) return CSO2(D, b, e, S, j, d);
	return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movl 0x10(%rbp), %eax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl %ecx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movl %r9d, -0x2c(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x50(%rbp)
movl -0x2c(%rbp), %eax
movq %rax, -0x60(%rbp)
movq -0x28(%rbp), %rdi
callq 0xf940
movq -0x60(%rbp), %rcx
movq %rax, %rdx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, -0x51(%rbp)
jae 0x67f84
movq -0x28(%rbp), %rdi
movl -0x2c(%rbp), %eax
movl %eax, %esi
callq 0x3c5b0
movq %rax, %rcx
movq -0x50(%rbp), %rax
movl (%rcx), %ecx
movl %ecx, -0x64(%rbp)
movq 0x68(%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %eax
movl %eax, %esi
callq 0x3c5b0
movq -0x70(%rbp), %rdi
movslq (%rax), %rsi
callq 0x3d060
movq %rax, %rdi
movl 0x10(%rbp), %eax
movl %eax, %esi
callq 0x3c5b0
movq %rax, %rcx
movl -0x64(%rbp), %eax
cmpl (%rcx), %eax
setl %al
movb %al, -0x51(%rbp)
movb -0x51(%rbp), %al
testb $0x1, %al
jne 0x67f8d
jmp 0x67f9b
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x67f0c
movl -0x2c(%rbp), %eax
movq %rax, -0x78(%rbp)
movq -0x28(%rbp), %rdi
callq 0xf940
movq %rax, %rcx
movq -0x78(%rbp), %rax
cmpq %rcx, %rax
jb 0x67fc0
movb $0x0, -0x1(%rbp)
jmp 0x683d9
movq -0x28(%rbp), %rdi
movl -0x2c(%rbp), %eax
movl %eax, %esi
callq 0x3c5b0
movq %rax, %rcx
movq -0x50(%rbp), %rax
movl (%rcx), %ecx
movl %ecx, -0x7c(%rbp)
movq 0x68(%rax), %rax
movq %rax, -0x88(%rbp)
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %eax
movl %eax, %esi
callq 0x3c5b0
movq -0x88(%rbp), %rdi
movslq (%rax), %rsi
callq 0x3d060
movq %rax, %rdi
movl 0x10(%rbp), %eax
movl %eax, %esi
callq 0x3c5b0
movq %rax, %rcx
movl -0x7c(%rbp), %eax
cmpl (%rcx), %eax
jne 0x68252
movq -0x50(%rbp), %rcx
movl -0x1c(%rbp), %eax
movl %eax, -0x30(%rbp)
movl -0x20(%rbp), %eax
subl -0x1c(%rbp), %eax
cmpl 0x50(%rcx), %eax
jae 0x680d2
jmp 0x68038
movl -0x30(%rbp), %ecx
addl $0x1, %ecx
xorl %eax, %eax
cmpl -0x20(%rbp), %ecx
movb %al, -0x89(%rbp)
ja 0x680b3
movq -0x50(%rbp), %rax
movq 0x68(%rax), %rax
movq %rax, -0x98(%rbp)
movq -0x18(%rbp), %rdi
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
callq 0x3c5b0
movq -0x98(%rbp), %rdi
movslq (%rax), %rsi
callq 0x3d060
movq %rax, %rdi
movl 0x10(%rbp), %eax
movl %eax, %esi
callq 0x3c5b0
movl (%rax), %eax
movl %eax, -0x90(%rbp)
movq -0x28(%rbp), %rdi
movl -0x2c(%rbp), %eax
movl %eax, %esi
callq 0x3c5b0
movq %rax, %rcx
movl -0x90(%rbp), %eax
cmpl (%rcx), %eax
sete %al
movb %al, -0x89(%rbp)
movb -0x89(%rbp), %al
testb $0x1, %al
jne 0x680bf
jmp 0x680cd
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x68038
jmp 0x68184
movl -0x1c(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x20(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x38(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x38(%rbp), %eax
jg 0x68182
movl -0x34(%rbp), %eax
addl -0x38(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movq -0x50(%rbp), %rax
movl %ecx, -0x3c(%rbp)
movq 0x68(%rax), %rax
movq %rax, -0xa8(%rbp)
movq -0x18(%rbp), %rdi
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0x3c5b0
movq -0xa8(%rbp), %rdi
movslq (%rax), %rsi
callq 0x3d060
movq %rax, %rdi
movl 0x10(%rbp), %eax
movl %eax, %esi
callq 0x3c5b0
movl (%rax), %eax
movl %eax, -0x9c(%rbp)
movq -0x28(%rbp), %rdi
movl -0x2c(%rbp), %eax
movl %eax, %esi
callq 0x3c5b0
movq %rax, %rcx
movl -0x9c(%rbp), %eax
cmpl (%rcx), %eax
jne 0x68174
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x6817d
movl -0x3c(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x680e1
jmp 0x68184
movq -0x28(%rbp), %rdi
callq 0xf940
movl 0x10(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
cmpq %rcx, %rax
jbe 0x681e4
movq -0x50(%rbp), %rax
movq 0x68(%rax), %rax
movq %rax, -0xb0(%rbp)
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %eax
movl %eax, %esi
callq 0x3c5b0
movq -0xb0(%rbp), %rdi
movslq (%rax), %rsi
callq 0x3d060
movq %rax, %rdi
callq 0xf940
movl 0x10(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
cmpq %rcx, %rax
jne 0x681e4
movb $0x1, -0x1(%rbp)
jmp 0x683d9
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, %eax
movq %rax, -0xb8(%rbp)
movq -0x28(%rbp), %rdi
callq 0xf940
movq %rax, %rcx
movq -0xb8(%rbp), %rax
cmpq %rcx, %rax
ja 0x68244
movq -0x50(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
movl -0x30(%rbp), %ecx
movq -0x28(%rbp), %r8
movl -0x2c(%rbp), %r9d
addl $0x1, %r9d
movl 0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, (%rsp)
callq 0x67ee0
testb $0x1, %al
jne 0x68239
jmp 0x68242
movb $0x1, -0x1(%rbp)
jmp 0x683d9
jmp 0x68244
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x683a5
movq -0x50(%rbp), %rcx
movl -0x20(%rbp), %eax
subl -0x1c(%rbp), %eax
cmpl 0x50(%rcx), %eax
jae 0x682f9
jmp 0x68267
movl -0x1c(%rbp), %ecx
xorl %eax, %eax
cmpl -0x20(%rbp), %ecx
movb %al, -0xb9(%rbp)
ja 0x682da
movq -0x50(%rbp), %rax
movq 0x68(%rax), %rax
movq %rax, -0xc8(%rbp)
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %eax
movl %eax, %esi
callq 0x3c5b0
movq -0xc8(%rbp), %rdi
movslq (%rax), %rsi
callq 0x3d060
movq %rax, %rdi
movl 0x10(%rbp), %eax
movl %eax, %esi
callq 0x3c5b0
movl (%rax), %eax
movl %eax, -0xc0(%rbp)
movq -0x28(%rbp), %rdi
movl -0x2c(%rbp), %eax
movl %eax, %esi
callq 0x3c5b0
movq %rax, %rcx
movl -0xc0(%rbp), %eax
cmpl (%rcx), %eax
setl %al
movb %al, -0xb9(%rbp)
movb -0xb9(%rbp), %al
testb $0x1, %al
jne 0x682e6
jmp 0x682f4
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x68267
jmp 0x683a3
movl -0x1c(%rbp), %eax
movl %eax, -0x40(%rbp)
movl -0x20(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x40(%rbp), %eax
cmpl -0x44(%rbp), %eax
jg 0x683a1
movl -0x40(%rbp), %eax
addl -0x44(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movq -0x50(%rbp), %rax
movl %ecx, -0x48(%rbp)
movq 0x68(%rax), %rax
movq %rax, -0xd8(%rbp)
movq -0x18(%rbp), %rdi
movslq -0x48(%rbp), %rsi
callq 0x3c5b0
movq -0xd8(%rbp), %rdi
movslq (%rax), %rsi
callq 0x3d060
movq %rax, %rdi
movl 0x10(%rbp), %eax
movl %eax, %esi
callq 0x3c5b0
movl (%rax), %eax
movl %eax, -0xcc(%rbp)
movq -0x28(%rbp), %rdi
movl -0x2c(%rbp), %eax
movl %eax, %esi
callq 0x3c5b0
movq %rax, %rcx
movl -0xcc(%rbp), %eax
cmpl (%rcx), %eax
jge 0x68393
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x6839c
movl -0x48(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x68305
jmp 0x683a3
jmp 0x683a5
movl -0x1c(%rbp), %eax
cmpl -0x20(%rbp), %eax
ja 0x683d5
movq -0x50(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
movl -0x20(%rbp), %ecx
movq -0x28(%rbp), %r8
movl -0x2c(%rbp), %r9d
movl 0x10(%rbp), %eax
movl %eax, (%rsp)
callq 0x67ee0
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x683d9
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0xe0, %rsp
popq %rbp
retq
nopw (%rax,%rax)