// File: /workspace/github_cpp_makefile_star2_O1/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)
movl %ecx, %r11d
movl %edx, %ebp
movl 0x88(%rsp), %r12d
movl 0x80(%rsp), %r14d
leaq 0x1(%r8), %rbx
movq %r8, %rax
shrq $0x20, %rax
subl %r8d, %eax
movq %rax, 0x10(%rsp)
movl %eax, %r15d
movq %rdi, 0x28(%rsp)
movq %rbx, 0x40(%rsp)
movq %r8, 0x8(%rsp)
movq %rsi, 0x20(%rsp)
cmpl %r14d, 0x10(%rsp)
seta %al
jbe 0x2b6c0
movq 0x58(%rdi), %rcx
movl %ebp, %r9d
movq (%rsi), %rdx
leaq (%r9,%r9,2), %r10
movl (%rdx,%r10,4), %edx
addl %r12d, %edx
movl (%rcx,%rdx,4), %edx
movl %r14d, %r10d
addl %r8d, %r14d
cmpl %edx, (%rcx,%r14,4)
movq %r10, %r14
jge 0x2b490
leaq 0x1(%r14), %r10
cmpq %r15, %r10
setb %al
jae 0x2b6c0
addl %ebx, %r14d
jmp 0x2b472
testb %al, %al
je 0x2b6c0
movq 0x58(%rdi), %rcx
leal (%r14,%r8), %eax
movslq (%rcx,%rax,4), %rdx
movq (%rsi), %rax
leaq (%r9,%r9,2), %r10
movq %rax, (%rsp)
movl (%rax,%r10,4), %eax
leal (%rax,%r12), %r9d
cmpl (%rcx,%r9,4), %edx
jne 0x2b507
testl %r12d, %r12d
movq %rax, 0x38(%rsp)
movq %r10, 0x30(%rsp)
je 0x2b54a
movl %r11d, %esi
subl %ebp, %esi
cmpl 0x50(%rdi), %esi
jae 0x2b570
movl %ebp, %esi
movl %esi, %ebx
leal 0x1(%rbx), %esi
cmpl %r11d, %esi
ja 0x2b5db
movl %esi, %r8d
leaq (%r8,%r8,2), %r8
movq (%rsp), %rax
movl (%rax,%r8,4), %r8d
addl %r12d, %r8d
cmpl %edx, (%rcx,%r8,4)
je 0x2b4dc
jmp 0x2b5db
testl %r12d, %r12d
je 0x2b55d
movl %r11d, %r9d
subl %ebp, %r9d
cmpl 0x50(%rdi), %r9d
jae 0x2b676
cmpl %ebp, %r11d
jb 0x2b661
movl %ebp, %edi
leaq (%rdi,%rdi,2), %rdi
movq (%rsp), %rax
movl (%rax,%rdi,4), %edi
addl %r12d, %edi
cmpl %edx, (%rcx,%rdi,4)
jge 0x2b661
incl %ebp
cmpl %r11d, %ebp
jbe 0x2b525
jmp 0x2b661
movq 0x90(%rsp), %rcx
movq (%rcx), %rcx
movl 0x4(%rcx,%rdx,4), %ebx
decl %ebx
jmp 0x2b5db
movq 0x90(%rsp), %rax
movq (%rax), %rax
movl (%rax,%rdx,4), %ebp
jmp 0x2b661
leal -0x1(%r11), %r8d
movl %ebp, %ebx
cmpl %ebp, %r8d
jl 0x2b5db
movl %ebp, %r9d
movl %ebp, %r10d
movl %ebp, %eax
movq %r15, %rbp
movq %r11, %r13
leal (%r10,%r8), %esi
movl %esi, %r11d
shrl $0x1f, %r11d
addl %esi, %r11d
sarl %r11d
leal 0x1(%r11), %esi
movslq %esi, %rbx
leaq (%rbx,%rbx,2), %rbx
movq (%rsp), %rdi
movl (%rdi,%rbx,4), %edi
movq %r12, %r15
addl %r12d, %edi
movl %esi, %ebx
cmpl %edx, (%rcx,%rdi,4)
je 0x2b5c5
decl %r11d
movl %r11d, %r8d
movl %r10d, %esi
movl %r9d, %ebx
movl %ebx, %r9d
movl %esi, %r10d
cmpl %r8d, %esi
movq %r13, %r11
movq %r15, %r12
movq %rbp, %r15
movl %eax, %ebp
jle 0x2b581
leal 0x1(%r12), %r10d
cmpl %r10d, 0x10(%rsp)
jbe 0x2b600
movq (%rsp), %rax
movq 0x30(%rsp), %rcx
leaq (%rax,%rcx,4), %rax
movl 0x4(%rax), %eax
subl 0x38(%rsp), %eax
cmpl %r10d, %eax
je 0x2b649
leal 0x1(%r14), %eax
cmpl 0x10(%rsp), %eax
ja 0x2b64d
subq $0x8, %rsp
movq 0x30(%rsp), %rdi
movq 0x28(%rsp), %rsi
movl %ebp, %edx
movl %ebx, %ecx
movq 0x10(%rsp), %r8
movl 0x24(%rsp), %r9d
pushq 0x98(%rsp)
pushq %r10
pushq %rax
movq %r12, %r13
movq %r11, %r12
callq 0x2b3f4
movq %r12, %r11
movq %r13, %r12
addq $0x20, %rsp
testb %al, %al
je 0x2b64d
xorl %eax, %eax
jmp 0x2b653
incl %ebx
movb $0x1, %al
movl %ebx, %ebp
movq 0x8(%rsp), %r8
testb %al, %al
movq 0x20(%rsp), %rsi
je 0x2b6d1
cmpl %r11d, %ebp
movq 0x28(%rsp), %rdi
movq 0x40(%rsp), %rbx
jbe 0x2b446
jmp 0x2b6c0
movl %r11d, %edi
movl %ebp, %ebx
cmpl %ebp, %r11d
jl 0x2b661
leal (%rdi,%rbx), %r9d
movl %r9d, %r10d
shrl $0x1f, %r10d
addl %r9d, %r10d
sarl %r10d
movslq %r10d, %r9
leaq (%r9,%r9,2), %r9
movq (%rsp), %rax
movl (%rax,%r9,4), %r9d
addl %r12d, %r9d
cmpl %edx, (%rcx,%r9,4)
jl 0x2b6b1
decl %r10d
movl %r10d, %edi
jmp 0x2b6ba
incl %r10d
movl %r10d, %ebx
movl %r10d, %ebp
cmpl %edi, %ebx
jle 0x2b680
jmp 0x2b661
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, %al
jmp 0x2b6c2
nop