// File: /workspace/github_cpp_makefile_star2_O2/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 $0x58, %rsp
movl %ecx, %r10d
movl %edx, %ecx
movq 0xa0(%rsp), %rax
movl 0x98(%rsp), %ebx
movl 0x90(%rsp), %r12d
movq %r8, %rdx
shrq $0x20, %rdx
subl %r8d, %edx
movq 0x58(%rdi), %r15
movq %rsi, 0x50(%rsp)
movq (%rsi), %r11
movq %rdi, 0x48(%rsp)
movl 0x50(%rdi), %esi
movl %esi, 0xc(%rsp)
movq (%rax), %rax
movq %rax, 0x30(%rsp)
leal -0x1(%r10), %eax
movl %eax, 0x2c(%rsp)
leal 0x1(%rbx), %eax
movq %rax, 0x38(%rsp)
pushq $0x2
popq %r13
movl %ecx, %eax
imulq $0xc, %rax, %rdi
addq %r11, %rdi
movl %r12d, %r12d
cmpq %rdx, %r12
jae 0x23ab7
leal (%r8,%r12), %eax
movslq (%r15,%rax,4), %rsi
movl (%rdi), %r14d
leal (%r14,%rbx), %eax
movl (%r15,%rax,4), %eax
cmpl %eax, %esi
jge 0x238e1
incq %r12
jmp 0x238bc
cmpl %eax, %esi
movq %r8, 0x40(%rsp)
movq %rdx, 0x20(%rsp)
jne 0x239a0
testl %ebx, %ebx
movl %r9d, 0x8(%rsp)
movq %r10, 0x18(%rsp)
movq %r11, 0x10(%rsp)
je 0x239d6
movl %r10d, %eax
subl %ecx, %eax
movl 0x2c(%rsp), %edx
movl %edx, %r10d
movl %ecx, %r9d
movl %ecx, %ebp
cmpl 0xc(%rsp), %eax
jae 0x23957
movl %ecx, %eax
movl 0x8(%rsp), %r9d
movq 0x18(%rsp), %r10
movq 0x10(%rsp), %r11
movl %eax, %ebp
leal 0x1(%rbp), %eax
cmpl %r10d, %eax
ja 0x239ff
movl %eax, %edx
imulq $0xc, %rdx, %rdx
movl (%r11,%rdx), %edx
addl %ebx, %edx
cmpl %esi, (%r15,%rdx,4)
je 0x23932
jmp 0x239ff
cmpl %r10d, %r9d
jg 0x239f0
leal (%r9,%r10), %eax
cltd
idivl %r13d
leal 0x1(%rax), %edx
movslq %edx, %rdx
imulq $0xc, %rdx, %r11
movl %r13d, %r8d
movq %rbx, %r13
movq 0x10(%rsp), %rbx
movl (%rbx,%r11), %r11d
movq %r13, %rbx
movl %r8d, %r13d
addl %ebx, %r11d
decl %eax
cmpl %esi, (%r15,%r11,4)
cmovel %r10d, %eax
cmovel %edx, %r9d
cmovel %edx, %ebp
movl %eax, %r10d
jmp 0x23957
testl %ebx, %ebx
je 0x239e3
movl %r10d, %eax
subl %ecx, %eax
cmpl 0xc(%rsp), %eax
jae 0x23a6b
cmpl %r10d, %ecx
ja 0x23aa0
movl %ecx, %eax
imulq $0xc, %rax, %rax
movl (%r11,%rax), %eax
addl %ebx, %eax
cmpl %esi, (%r15,%rax,4)
jge 0x23aa0
incl %ecx
jmp 0x239b3
movq 0x30(%rsp), %rax
movl 0x4(%rax,%rsi,4), %ebp
decl %ebp
jmp 0x239ff
movq 0x30(%rsp), %rax
movl (%rax,%rsi,4), %ebp
jmp 0x23aa2
movl 0x8(%rsp), %r9d
movq 0x18(%rsp), %r10
movq 0x10(%rsp), %r11
movq 0x38(%rsp), %rdx
cmpl %edx, 0x20(%rsp)
jbe 0x23a18
movl 0x4(%rdi), %eax
subl %r14d, %eax
cmpl %edx, %eax
je 0x23ac8
leaq 0x1(%r12), %rax
cmpl 0x20(%rsp), %eax
ja 0x23a67
subq $0x8, %rsp
movq 0x50(%rsp), %rdi
movq 0x58(%rsp), %rsi
movl %ecx, %edx
movl %ebp, %ecx
movq 0x48(%rsp), %r8
movl 0x10(%rsp), %r9d
pushq 0xa8(%rsp)
pushq 0x48(%rsp)
pushq %rax
callq 0x23848
movq 0x30(%rsp), %r11
movq 0x38(%rsp), %r10
movl 0x28(%rsp), %r9d
addq $0x20, %rsp
testb %al, %al
jne 0x23ac8
incl %ebp
jmp 0x23aa2
movl %r10d, %edi
movl %ecx, %ebp
cmpl %edi, %ecx
jg 0x23aa2
leal (%rdi,%rcx), %eax
cltd
idivl %r13d
cltq
imulq $0xc, %rax, %rdx
movl (%r11,%rdx), %edx
addl %ebx, %edx
leal 0x1(%rax), %r8d
decl %eax
cmpl %esi, (%r15,%rdx,4)
cmovll %r8d, %ecx
cmovll %edi, %eax
cmovll %r8d, %ebp
movl %eax, %edi
jmp 0x23a70
movl %ecx, %ebp
movl %ebp, %ecx
cmpl %r10d, %ebp
movq 0x40(%rsp), %r8
movq 0x20(%rsp), %rdx
jbe 0x238b0
xorl %eax, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, %al
jmp 0x23ab9