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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %r9d, 0x1c(%rsp)
movq %r8, %r13
movl %ecx, %r10d
movl %edx, %ebp
movq 0x90(%rsp), %rax
movl 0x88(%rsp), %r11d
movl 0x80(%rsp), %r12d
movq %r8, %r14
shrq $0x20, %r14
subl %r13d, %r14d
movq 0x58(%rdi), %rbx
movq %rsi, 0x40(%rsp)
movq (%rsi), %rdx
movq %rdi, 0x38(%rsp)
movl 0x50(%rdi), %r9d
movq (%rax), %r15
leal -0x1(%r10), %eax
movl %eax, 0x4(%rsp)
leal 0x1(%r11), %eax
movq %rax, 0x20(%rsp)
cmpl %r14d, %r12d
jae 0x2a920
movl %ebp, %eax
leaq (%rax,%rax,2), %rax
leaq (%rdx,%rax,4), %rcx
movl (%rcx), %eax
leal (%rax,%r11), %esi
movslq (%rbx,%rsi,4), %rsi
movl %r12d, %r12d
leal (%r12,%r13), %edi
movslq (%rbx,%rdi,4), %rdi
cmpl %esi, %edi
jge 0x2a747
incq %r12
cmpq %r14, %r12
jb 0x2a72e
jmp 0x2a920
cmpl %esi, %edi
jne 0x2a79a
movq %rcx, 0x28(%rsp)
movq %rax, 0x8(%rsp)
testl %r11d, %r11d
movl %r9d, 0x18(%rsp)
movq %r15, 0x30(%rsp)
movl %ebp, (%rsp)
je 0x2a7d7
movl %r10d, %edi
subl %ebp, %edi
cmpl %r9d, %edi
jae 0x2a7e9
movl %ebp, %edi
movl %edi, %ebp
leal 0x1(%rbp), %edi
cmpl %r10d, %edi
ja 0x2a853
movl %edi, %r8d
leaq (%r8,%r8,2), %r8
movl (%rdx,%r8,4), %r8d
addl %r11d, %r8d
cmpl %esi, (%rbx,%r8,4)
je 0x2a773
jmp 0x2a853
testl %r11d, %r11d
je 0x2a7e0
movl %r10d, %eax
subl %ebp, %eax
cmpl %r9d, %eax
jae 0x2a8e1
cmpl %ebp, %r10d
jb 0x2a8d6
movl %ebp, %eax
leaq (%rax,%rax,2), %rax
movl (%rdx,%rax,4), %eax
addl %r11d, %eax
cmpl %edi, (%rbx,%rax,4)
jge 0x2a8d6
incl %ebp
cmpl %r10d, %ebp
jbe 0x2a7b6
jmp 0x2a8d6
movl 0x4(%r15,%rsi,4), %ebp
decl %ebp
jmp 0x2a853
movl (%r15,%rdi,4), %ebp
jmp 0x2a8d6
cmpl 0x4(%rsp), %ebp
jg 0x2a853
movl (%rsp), %eax
movl %eax, %r8d
movl %eax, %r9d
movl 0x4(%rsp), %eax
movl %eax, %edi
movq %r10, 0x10(%rsp)
movq %r11, %r15
leal (%r9,%rdi), %r11d
movl %r11d, %r10d
shrl $0x1f, %r10d
addl %r11d, %r10d
sarl %r10d
leal 0x1(%r10), %r11d
movslq %r11d, %rbp
leaq (%rbp,%rbp,2), %rbp
movl (%rdx,%rbp,4), %eax
movq %r15, %rcx
addl %r15d, %eax
movl %r11d, %ebp
cmpl %esi, (%rbx,%rax,4)
je 0x2a840
decl %r10d
movl %r10d, %edi
movl %r9d, %r11d
movl %r8d, %ebp
movl %ebp, %r8d
movl %r11d, %r9d
cmpl %edi, %r11d
movq 0x10(%rsp), %r10
movq %rcx, %r11
jle 0x2a803
movq 0x20(%rsp), %rcx
cmpl %ecx, %r14d
jbe 0x2a871
movq 0x28(%rsp), %rax
movl 0x4(%rax), %eax
subl 0x8(%rsp), %eax
cmpl %ecx, %eax
je 0x2a931
leaq 0x1(%r12), %rax
cmpl %r14d, %eax
ja 0x2a8ca
subq $0x8, %rsp
movq 0x40(%rsp), %rdi
movq 0x48(%rsp), %rsi
movq %rdx, 0x10(%rsp)
movl 0x8(%rsp), %edx
movl %ebp, %ecx
movq %r13, %r8
movl 0x24(%rsp), %r9d
pushq 0x98(%rsp)
pushq 0x30(%rsp)
pushq %rax
movq %r10, 0x30(%rsp)
movq %r11, %r15
callq 0x2a6a8
movq 0x28(%rsp), %rdx
movq %r15, %r11
movq 0x30(%rsp), %r10
addq $0x20, %rsp
testb %al, %al
jne 0x2a931
incl %ebp
movl 0x18(%rsp), %r9d
movq 0x30(%rsp), %r15
cmpl %r10d, %ebp
jbe 0x2a70e
jmp 0x2a920
movl %r10d, %ecx
movl %ebp, %eax
cmpl %ebp, %r10d
jl 0x2a8d6
leal (%rcx,%rax), %r8d
movl %r8d, %esi
shrl $0x1f, %esi
addl %r8d, %esi
sarl %esi
movslq %esi, %r8
leaq (%r8,%r8,2), %r8
movl (%rdx,%r8,4), %r8d
addl %r11d, %r8d
cmpl %edi, (%rbx,%r8,4)
jl 0x2a914
decl %esi
movl %esi, %ecx
jmp 0x2a91a
incl %esi
movl %esi, %eax
movl %esi, %ebp
cmpl %ecx, %eax
jle 0x2a8eb
jmp 0x2a8d6
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, %al
jmp 0x2a922
nop