// File: Laakeri[P]maxpre/src/AMSLEX.cpp
// Function: maxPreprocessor::AMSLEX::amsLexSENonPerm(std::vector<int, std::allocator<int>> const&)
vector<int> AMSLEX::amsLexSENonPerm(const vector<int>& clauses) {
	vector<int> D(clauses.size());
	for (unsigned i = 0; i < clauses.size(); i++) {
		D[i] = clauses[i];
	}
	auto cmp = [&](int a, int b) {
		return pi.clauses[a].lit < pi.clauses[b].lit;
	};
	sort(D.begin(), D.end(), cmp);
	vector<int> subsumed(D.size());
	unsigned S = 0;
	for (unsigned i = 1; i < D.size(); i++) {
		if (pi.clauses[D[S]].lit.size() <= pi.clauses[D[i]].lit.size() && isPrefix(pi.clauses[D[S]].lit, pi.clauses[D[i]].lit)) {
			subsumed[i] = true;
		}
		else {
			S = i;
		}
	}
	for (unsigned i = 0; i + 1 < D.size(); i++) {
		if (!subsumed[i] && CSO2(D, i + 1, D.size() - 1, pi.clauses[D[i]].lit, 0, 0)) {
			subsumed[i] = true;
		}
	}
	vector<int> ret;
	for (unsigned i = 0; i < D.size(); i++) {
		if (subsumed[i]) ret.push_back(D[i]);
	}
	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x160, %rsp            # imm = 0x160
movq %rdi, -0xc0(%rbp)
movq %rdi, %rax
movq %rax, -0xb8(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0x18(%rbp), %rdi
callq 0xf940
movq %rax, -0xa8(%rbp)
leaq -0x31(%rbp), %rdi
movq %rdi, -0xa0(%rbp)
callq 0xa710
movq -0xa8(%rbp), %rsi
movq -0xa0(%rbp), %rdx
leaq -0x30(%rbp), %rdi
callq 0xa730
jmp 0x6845c
leaq -0x31(%rbp), %rdi
callq 0xa7a0
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
movq %rax, -0xc8(%rbp)
movq -0x18(%rbp), %rdi
callq 0xf940
movq %rax, %rcx
movq -0xc8(%rbp), %rax
cmpq %rcx, %rax
jae 0x684df
movq -0x18(%rbp), %rdi
movl -0x48(%rbp), %eax
movl %eax, %esi
callq 0x3c5b0
movl (%rax), %eax
movl %eax, -0xcc(%rbp)
movl -0x48(%rbp), %eax
movl %eax, %esi
leaq -0x30(%rbp), %rdi
callq 0xa7c0
movl -0xcc(%rbp), %ecx
movl %ecx, (%rax)
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x6846c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x31(%rbp), %rdi
callq 0xa7a0
jmp 0x68960
movq -0xb0(%rbp), %rax
movq %rax, -0x50(%rbp)
leaq -0x30(%rbp), %rdi
movq %rdi, -0xd8(%rbp)
callq 0xa800
movq -0xd8(%rbp), %rdi
movq %rax, -0x58(%rbp)
callq 0xa830
movq %rax, -0x60(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x58(%rbp), %rdi
movq -0x60(%rbp), %rsi
movq -0x68(%rbp), %rdx
callq 0x68970
jmp 0x68529
leaq -0x30(%rbp), %rdi
callq 0xf940
movq %rax, -0xe8(%rbp)
leaq -0x81(%rbp), %rdi
movq %rdi, -0xe0(%rbp)
callq 0xa710
movq -0xe8(%rbp), %rsi
movq -0xe0(%rbp), %rdx
leaq -0x80(%rbp), %rdi
callq 0xa730
jmp 0x68565
leaq -0x81(%rbp), %rdi
callq 0xa7a0
movl $0x0, -0x88(%rbp)
movl $0x1, -0x8c(%rbp)
movl -0x8c(%rbp), %eax
movq %rax, -0xf0(%rbp)
leaq -0x30(%rbp), %rdi
callq 0xf940
movq %rax, %rcx
movq -0xf0(%rbp), %rax
cmpq %rcx, %rax
jae 0x68732
movq -0xb0(%rbp), %rax
movq 0x68(%rax), %rax
movq %rax, -0x108(%rbp)
movl -0x88(%rbp), %eax
movl %eax, %esi
leaq -0x30(%rbp), %rdi
callq 0xa7c0
movq -0x108(%rbp), %rdi
movslq (%rax), %rsi
callq 0x3d060
movq %rax, %rdi
callq 0xf940
movq %rax, %rcx
movq -0xb0(%rbp), %rax
movq %rcx, -0xf8(%rbp)
movq 0x68(%rax), %rax
movq %rax, -0x100(%rbp)
movl -0x8c(%rbp), %eax
movl %eax, %esi
leaq -0x30(%rbp), %rdi
callq 0xa7c0
movq -0x100(%rbp), %rdi
movslq (%rax), %rsi
callq 0x3d060
movq %rax, %rdi
callq 0xf940
movq %rax, %rcx
movq -0xf8(%rbp), %rax
cmpq %rcx, %rax
ja 0x68710
movq -0xb0(%rbp), %rax
movq 0x68(%rax), %rax
movq %rax, -0x120(%rbp)
movl -0x88(%rbp), %eax
movl %eax, %esi
leaq -0x30(%rbp), %rdi
callq 0xa7c0
movq -0x120(%rbp), %rdi
movslq (%rax), %rsi
callq 0x3d060
movq %rax, %rcx
movq -0xb0(%rbp), %rax
movq %rcx, -0x110(%rbp)
movq 0x68(%rax), %rax
movq %rax, -0x118(%rbp)
movl -0x8c(%rbp), %eax
movl %eax, %esi
leaq -0x30(%rbp), %rdi
callq 0xa7c0
movq -0x118(%rbp), %rdi
movslq (%rax), %rsi
callq 0x3d060
movq -0xb0(%rbp), %rdi
movq -0x110(%rbp), %rsi
movq %rax, %rdx
callq 0x67800
testb $0x1, %al
jne 0x686c9
jmp 0x68710
movl -0x8c(%rbp), %eax
movl %eax, %esi
leaq -0x80(%rbp), %rdi
callq 0xa7c0
movl $0x1, (%rax)
jmp 0x6871c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x68957
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x81(%rbp), %rdi
callq 0xa7a0
jmp 0x68957
movl -0x8c(%rbp), %eax
movl %eax, -0x88(%rbp)
jmp 0x6871e
movl -0x8c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8c(%rbp)
jmp 0x68585
movl $0x0, -0x90(%rbp)
movl -0x90(%rbp), %eax
addl $0x1, %eax
movl %eax, %eax
movq %rax, -0x128(%rbp)
leaq -0x30(%rbp), %rdi
callq 0xf940
movq %rax, %rcx
movq -0x128(%rbp), %rax
cmpq %rcx, %rax
jae 0x68864
movl -0x90(%rbp), %eax
movl %eax, %esi
leaq -0x80(%rbp), %rdi
callq 0xa7c0
cmpl $0x0, (%rax)
jne 0x6884e
movl -0x90(%rbp), %eax
incl %eax
movl %eax, -0x134(%rbp)
leaq -0x30(%rbp), %rdi
movq %rdi, -0x140(%rbp)
callq 0xf940
movq -0x140(%rbp), %rdi
movq %rax, %rcx
movq -0xb0(%rbp), %rax
decl %ecx
movl %ecx, -0x130(%rbp)
movq 0x68(%rax), %rax
movq %rax, -0x148(%rbp)
movl -0x90(%rbp), %eax
movl %eax, %esi
callq 0xa7c0
movq -0x148(%rbp), %rdi
movslq (%rax), %rsi
callq 0x3d060
movq -0xb0(%rbp), %rdi
movq -0x140(%rbp), %rsi
movl -0x134(%rbp), %edx
movl -0x130(%rbp), %ecx
movq %rax, %r8
movq %rsp, %rax
movl $0x0, (%rax)
xorl %r9d, %r9d
callq 0x67ee0
movb %al, -0x129(%rbp)
jmp 0x68818
movb -0x129(%rbp), %al
testb $0x1, %al
jne 0x68824
jmp 0x6884e
movl -0x90(%rbp), %eax
movl %eax, %esi
leaq -0x80(%rbp), %rdi
callq 0xa7c0
movl $0x1, (%rax)
jmp 0x6884e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x6894e
jmp 0x68850
movl -0x90(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x90(%rbp)
jmp 0x6873c
movq -0xc0(%rbp), %rdi
movb $0x0, -0x91(%rbp)
callq 0xa7e0
movl $0x0, -0x98(%rbp)
movl -0x98(%rbp), %eax
movq %rax, -0x150(%rbp)
leaq -0x30(%rbp), %rdi
callq 0xf940
movq %rax, %rcx
movq -0x150(%rbp), %rax
cmpq %rcx, %rax
jae 0x68910
movl -0x98(%rbp), %eax
movl %eax, %esi
leaq -0x80(%rbp), %rdi
callq 0xa7c0
cmpl $0x0, (%rax)
je 0x688fa
movl -0x98(%rbp), %eax
movl %eax, %esi
leaq -0x30(%rbp), %rdi
callq 0xa7c0
movq -0xc0(%rbp), %rdi
movq %rax, %rsi
callq 0xa8c0
jmp 0x688de
jmp 0x688fa
movq -0xc0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
callq 0xab00
jmp 0x6894e
jmp 0x688fc
movl -0x98(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x98(%rbp)
jmp 0x68881
movb $0x1, -0x91(%rbp)
testb $0x1, -0x91(%rbp)
jne 0x6892c
movq -0xc0(%rbp), %rdi
callq 0xab00
leaq -0x80(%rbp), %rdi
callq 0xab00
leaq -0x30(%rbp), %rdi
callq 0xab00
movq -0xb8(%rbp), %rax
addq $0x160, %rsp            # imm = 0x160
popq %rbp
retq
leaq -0x80(%rbp), %rdi
callq 0xab00
leaq -0x30(%rbp), %rdi
callq 0xab00
movq -0x40(%rbp), %rdi
callq 0x4610
nopl (%rax)