// File: /workspace/github_cpp_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %r9d, %ebx
movl %ecx, %r15d
movl 0x80(%rsp), %r11d
movq (%r8), %r14
movq %r8, 0x38(%rsp)
movq 0x8(%r8), %r13
subq %r14, %r13
sarq $0x2, %r13
movq 0x68(%rdi), %r9
movq %rsi, 0x30(%rsp)
movq (%rsi), %r12
movq %rdi, 0x28(%rsp)
movl 0x50(%rdi), %r10d
leal -0x1(%r15), %eax
movl %eax, 0xc(%rsp)
leal 0x1(%r11), %eax
movq %rax, 0x40(%rsp)
movl %ebx, %r8d
cmpq %r8, %r13
jbe 0x2ab4e
movl %edx, %eax
movslq (%r12,%rax,4), %rcx
movq (%r9), %rax
leaq (%rcx,%rcx,4), %rcx
leaq (%rax,%rcx,8), %rsi
movq (%rsi), %rcx
movl (%rcx,%r11,4), %edi
movl (%r14,%r8,4), %r8d
cmpl %edi, %r8d
jge 0x2a9c7
incl %ebx
movq %rbx, %r8
cmpq %rbx, %r13
ja 0x2a9af
jmp 0x2ab4e
movq %r9, 0x10(%rsp)
movl %r15d, %r9d
subl %edx, %r9d
cmpl %edi, %r8d
movl %r10d, 0x1c(%rsp)
jne 0x2aa13
movq %rcx, 0x20(%rsp)
cmpl %r10d, %r9d
jae 0x2aa50
movl %edx, %r8d
movl %r8d, %ebp
leal 0x1(%rbp), %r8d
cmpl %r15d, %r8d
ja 0x2aaa7
movl %r8d, %r9d
movslq (%r12,%r9,4), %r9
leaq (%r9,%r9,4), %r9
movq (%rax,%r9,8), %r9
cmpl %edi, (%r9,%r11,4)
je 0x2a9e9
jmp 0x2aaa7
cmpl %r10d, %r9d
jae 0x2aafe
cmpl %edx, %r15d
movq 0x10(%rsp), %r9
movl %edx, %ebp
jb 0x2ab3e
movl %ebp, %ecx
movslq (%r12,%rcx,4), %rcx
leaq (%rcx,%rcx,4), %rcx
movq (%rax,%rcx,8), %rcx
cmpl %r8d, (%rcx,%r11,4)
jge 0x2ab3e
incl %ebp
cmpl %r15d, %ebp
jbe 0x2aa2c
jmp 0x2ab3e
movl %edx, %ebp
cmpl 0xc(%rsp), %edx
jg 0x2aaa7
movl 0xc(%rsp), %ecx
movl %ecx, %r9d
movl %edx, %r8d
movl %edx, %ebp
movq %r11, %rcx
leal (%r9,%r8), %r11d
movl %r11d, %r10d
shrl $0x1f, %r10d
addl %r11d, %r10d
sarl %r10d
movslq %r10d, %r11
movslq 0x4(%r12,%r11,4), %r11
leaq (%r11,%r11,4), %r11
movq (%rax,%r11,8), %r11
cmpl %edi, (%r11,%rcx,4)
movq %rcx, %r11
je 0x2aa99
decl %r10d
movl %r10d, %r9d
jmp 0x2aaa2
incl %r10d
movl %r10d, %ebp
movl %r10d, %r8d
cmpl %r9d, %r8d
jle 0x2aa64
movq 0x40(%rsp), %rcx
cmpq %rcx, %r13
jbe 0x2aac7
movq 0x8(%rsi), %rax
subq 0x20(%rsp), %rax
sarq $0x2, %rax
cmpq %rcx, %rax
je 0x2ab5f
leal 0x1(%rbx), %r9d
cmpq %r9, %r13
jb 0x2aaf5
movl %ecx, (%rsp)
movq 0x28(%rsp), %rdi
movq 0x30(%rsp), %rsi
movl %ebp, %ecx
movq 0x38(%rsp), %r8
callq 0x2a936
movl 0x80(%rsp), %r11d
testb %al, %al
jne 0x2ab5f
incl %ebp
movq 0x10(%rsp), %r9
jmp 0x2ab3e
movl %r15d, %ecx
movl %edx, %ebp
cmpl %edx, %r15d
movq 0x10(%rsp), %r9
jl 0x2ab3e
leal (%rcx,%rdx), %edi
movl %edi, %esi
shrl $0x1f, %esi
addl %edi, %esi
sarl %esi
movslq %esi, %rdi
movslq (%r12,%rdi,4), %rdi
leaq (%rdi,%rdi,4), %rdi
movq (%rax,%rdi,8), %rdi
cmpl %r8d, (%rdi,%r11,4)
jl 0x2ab34
decl %esi
movl %esi, %ecx
jmp 0x2ab3a
incl %esi
movl %esi, %ebp
movl %esi, %edx
cmpl %ecx, %edx
jle 0x2ab0d
movl %ebp, %edx
cmpl %r15d, %ebp
movl 0x1c(%rsp), %r10d
jbe 0x2a98b
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, %al
jmp 0x2ab50
nop