// File: Laakeri[P]maxpre/src/./SE.cpp
// Function: maxPreprocessor::Preprocessor::trySEHash(std::vector<int, std::allocator<int>>&, int, std::vector<int, std::allocator<int>>&)
void Preprocessor::trySEHash(vector<int>& clauses, int tLit, vector<int>& toRemove) {
	int k = 1;
	int n = clauses.size();
	while ((1<<k) < n) k++;
	vector<vector<pair<int, uint64_t> > > has(1 << k);
	for (int c : clauses) {
		uint64_t h = 0;
		int ml = pi.clauses[c].lit[0];
		for (int l : pi.clauses[c].lit) {
			h |= ((uint64_t)1 << (uint64_t)(l%k));
			if (pi.litClauses[l].size() < pi.litClauses[ml].size()) ml = l;
		}
		if (tLit == -1 || ml == tLit) {
			has[h].push_back({c, pi.clauses[c].hash});
		}
	}
	
	for (int c1 : clauses) {
		int64_t h = 0;
		uint64_t h64 = pi.clauses[c1].hash;
		for (int l : pi.clauses[c1].lit) {
			h |= ((int64_t)1 << (int64_t)(l%k));
		}
		for (int64_t sub = 0; (sub = (sub - h) & h);) {
			for (auto c2 : has[sub]) {
				if (!pi.canSubsume2(h64, c2.S)) continue;
				if (c1 == c2.F) continue;
				if (pi.clauses[c1].lit.size() == pi.clauses[c2.F].lit.size() && pi.canSubsume(c1, c2.F) && pi.canSubsume(c2.F, c1) && c1 > c2.F) {
					if (isSubsumed(pi.clauses[c1].lit, pi.clauses[c2.F].lit)) {
						if (pi.clauses[c1].isHard() && pi.clauses[c2.F].isHard()) {
							toRemove.push_back(c2.F);
						}
						else if(pi.clauses[c1].isHard()) {
							toRemove.push_back(c2.F);
						}
						else if(pi.clauses[c2.F].isHard()) {
							toRemove.push_back(c1);
						}
						else {
							pi.clauses[c1].weight += pi.clauses[c2.F].weight;
							pi.clauses[c2.F].weight = 0;
							toRemove.push_back(c2.F);
						}
					}
				}
				else if (pi.clauses[c1].lit.size() > pi.clauses[c2.F].lit.size() && pi.canSubsume(c2.F, c1) && pi.clauses[c2.F].isHard()) {
					if (isSubsumed(pi.clauses[c1].lit, pi.clauses[c2.F].lit)) {
						toRemove.push_back(c1);
					}
				}
				else if (pi.clauses[c2.F].lit.size() > pi.clauses[c1].lit.size() && pi.canSubsume(c1, c2.F) && pi.clauses[c1].isHard()) {
					if (isSubsumed(pi.clauses[c2.F].lit, pi.clauses[c1].lit)) {
						toRemove.push_back(c2.F);
					}
				}
			}
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1d0, %rsp            # imm = 0x1D0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x148(%rbp)
movl $0x1, -0x24(%rbp)
movq -0x10(%rbp), %rdi
callq 0xf940
movl %eax, -0x28(%rbp)
movl -0x24(%rbp), %ecx
movl $0x1, %eax
shll %cl, %eax
cmpl -0x28(%rbp), %eax
jge 0x13f02
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x13ee8
movb -0x24(%rbp), %cl
movl $0x1, %eax
shll %cl, %eax
cltq
movq %rax, -0x158(%rbp)
leaq -0x41(%rbp), %rdi
movq %rdi, -0x150(%rbp)
callq 0x3cc90
movq -0x158(%rbp), %rsi
movq -0x150(%rbp), %rdx
leaq -0x40(%rbp), %rdi
callq 0x3ccb0
jmp 0x13f3e
leaq -0x41(%rbp), %rdi
callq 0x3cd20
movq -0x10(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rdi
callq 0xa800
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rdi
callq 0xa830
movq %rax, -0x70(%rbp)
leaq -0x68(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0xa860
testb $0x1, %al
jne 0x13f7f
jmp 0x14161
leaq -0x68(%rbp), %rdi
callq 0xa8a0
movq -0x148(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x74(%rbp)
movq $0x0, -0x80(%rbp)
movslq -0x74(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xa7c0
movq -0x148(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x84(%rbp)
movslq -0x74(%rbp), %rsi
callq 0x3c600
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rdi
callq 0xa800
movq %rax, -0x98(%rbp)
movq -0x90(%rbp), %rdi
callq 0xa830
movq %rax, -0xa0(%rbp)
leaq -0x98(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0xa860
testb $0x1, %al
jne 0x14012
jmp 0x140d2
leaq -0x98(%rbp), %rdi
callq 0xa8a0
movq -0x148(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0xa4(%rbp)
movl -0xa4(%rbp), %eax
cltd
idivl -0x24(%rbp)
movslq %edx, %rcx
movl $0x1, %eax
shlq %cl, %rax
orq -0x80(%rbp), %rax
movq %rax, -0x80(%rbp)
addq $0x18, %rdi
movslq -0xa4(%rbp), %rsi
callq 0xaab0
movq %rax, %rdi
callq 0xf940
movq -0x148(%rbp), %rdi
movq %rax, -0x160(%rbp)
addq $0x18, %rdi
movslq -0x84(%rbp), %rsi
callq 0xaab0
movq %rax, %rdi
callq 0xf940
movq %rax, %rcx
movq -0x160(%rbp), %rax
cmpq %rcx, %rax
jae 0x140bf
movl -0xa4(%rbp), %eax
movl %eax, -0x84(%rbp)
jmp 0x140bf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x41(%rbp), %rdi
callq 0x3cd20
jmp 0x14854
jmp 0x140c1
leaq -0x98(%rbp), %rdi
callq 0xa930
jmp 0x13ff6
cmpl $-0x1, -0x14(%rbp)
je 0x140e3
movl -0x84(%rbp), %eax
cmpl -0x14(%rbp), %eax
jne 0x14151
movq -0x80(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0x3cd40
movq -0x148(%rbp), %rdi
movq %rax, -0x168(%rbp)
movslq -0x74(%rbp), %rsi
callq 0x3c600
movq %rax, %rdx
addq $0x20, %rdx
leaq -0xb8(%rbp), %rdi
leaq -0x74(%rbp), %rsi
callq 0x3cd90
jmp 0x14120
movq -0x168(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x3cd60
jmp 0x14135
jmp 0x14151
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x3cea0
jmp 0x14854
jmp 0x14153
leaq -0x68(%rbp), %rdi
callq 0xa930
jmp 0x13f69
movq -0x10(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0xc0(%rbp), %rdi
callq 0xa800
movq %rax, -0xc8(%rbp)
movq -0xc0(%rbp), %rdi
callq 0xa830
movq %rax, -0xd0(%rbp)
leaq -0xc8(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0xa860
testb $0x1, %al
jne 0x141ae
jmp 0x14842
leaq -0xc8(%rbp), %rdi
callq 0xa8a0
movq -0x148(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0xd4(%rbp)
movq $0x0, -0xe0(%rbp)
movslq -0xd4(%rbp), %rsi
callq 0x3c600
movq -0x148(%rbp), %rdi
movq 0x20(%rax), %rax
movq %rax, -0xe8(%rbp)
movslq -0xd4(%rbp), %rsi
callq 0x3c600
movq %rax, -0xf0(%rbp)
movq -0xf0(%rbp), %rdi
callq 0xa800
movq %rax, -0xf8(%rbp)
movq -0xf0(%rbp), %rdi
callq 0xa830
movq %rax, -0x100(%rbp)
leaq -0xf8(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0xa860
testb $0x1, %al
jne 0x14244
jmp 0x14289
leaq -0xf8(%rbp), %rdi
callq 0xa8a0
movl (%rax), %eax
movl %eax, -0x104(%rbp)
movl -0x104(%rbp), %eax
cltd
idivl -0x24(%rbp)
movslq %edx, %rcx
movl $0x1, %eax
shlq %cl, %rax
orq -0xe0(%rbp), %rax
movq %rax, -0xe0(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0xa930
jmp 0x1422b
movq $0x0, -0x110(%rbp)
movq -0x110(%rbp), %rax
subq -0xe0(%rbp), %rax
andq -0xe0(%rbp), %rax
movq %rax, -0x110(%rbp)
cmpq $0x0, %rax
je 0x1482f
movq -0x110(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0x3cd40
movq %rax, -0x118(%rbp)
movq -0x118(%rbp), %rdi
callq 0x3cdc0
movq %rax, -0x120(%rbp)
movq -0x118(%rbp), %rdi
callq 0x3cdf0
movq %rax, -0x128(%rbp)
leaq -0x120(%rbp), %rdi
leaq -0x128(%rbp), %rsi
callq 0x3ce20
testb $0x1, %al
jne 0x14313
jmp 0x1482a
leaq -0x120(%rbp), %rdi
callq 0x3ce60
movq -0x148(%rbp), %rdi
movups (%rax), %xmm0
movaps %xmm0, -0x140(%rbp)
movq -0xe8(%rbp), %rsi
movq -0x138(%rbp), %rdx
callq 0x5fc10
movb %al, -0x169(%rbp)
jmp 0x1434b
movb -0x169(%rbp), %al
testb $0x1, %al
jne 0x1435c
jmp 0x14357
jmp 0x14819
movl -0xd4(%rbp), %eax
cmpl -0x140(%rbp), %eax
jne 0x1436f
jmp 0x14819
movq -0x148(%rbp), %rdi
movslq -0xd4(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
callq 0xf940
movq -0x148(%rbp), %rdi
movq %rax, -0x178(%rbp)
movslq -0x140(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
callq 0xf940
movq %rax, %rcx
movq -0x178(%rbp), %rax
cmpq %rcx, %rax
jne 0x145f6
movq -0x148(%rbp), %rdi
movl -0xd4(%rbp), %esi
movl -0x140(%rbp), %edx
callq 0x5fcf0
movb %al, -0x179(%rbp)
jmp 0x143df
movb -0x179(%rbp), %al
testb $0x1, %al
jne 0x143ee
jmp 0x145f6
movq -0x148(%rbp), %rdi
movl -0x140(%rbp), %esi
movl -0xd4(%rbp), %edx
callq 0x5fcf0
movb %al, -0x17a(%rbp)
jmp 0x1440e
movb -0x17a(%rbp), %al
testb $0x1, %al
jne 0x1441d
jmp 0x145f6
movl -0xd4(%rbp), %eax
cmpl -0x140(%rbp), %eax
jle 0x145f6
movq -0x148(%rbp), %rdi
movslq -0xd4(%rbp), %rsi
callq 0x3c600
movq -0x148(%rbp), %rdi
movq %rax, -0x188(%rbp)
movslq -0x140(%rbp), %rsi
callq 0x3c600
movq -0x148(%rbp), %rdi
movq -0x188(%rbp), %rsi
movq %rax, %rdx
callq 0x13a00
testb $0x1, %al
jne 0x1447b
jmp 0x145f1
movq -0x148(%rbp), %rdi
movslq -0xd4(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
callq 0x60e90
movb %al, -0x189(%rbp)
jmp 0x1449e
movb -0x189(%rbp), %al
testb $0x1, %al
jne 0x144aa
jmp 0x144f0
movq -0x148(%rbp), %rdi
movslq -0x140(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
callq 0x60e90
movb %al, -0x18a(%rbp)
jmp 0x144cd
movb -0x18a(%rbp), %al
testb $0x1, %al
jne 0x144d9
jmp 0x144f0
movq -0x20(%rbp), %rdi
leaq -0x140(%rbp), %rsi
callq 0xa8c0
jmp 0x144eb
jmp 0x145ef
movq -0x148(%rbp), %rdi
movslq -0xd4(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
callq 0x60e90
movb %al, -0x18b(%rbp)
jmp 0x14513
movb -0x18b(%rbp), %al
testb $0x1, %al
jne 0x1451f
jmp 0x14536
movq -0x20(%rbp), %rdi
leaq -0x140(%rbp), %rsi
callq 0xa8c0
jmp 0x14531
jmp 0x145ed
movq -0x148(%rbp), %rdi
movslq -0x140(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
callq 0x60e90
movb %al, -0x18c(%rbp)
jmp 0x14559
movb -0x18c(%rbp), %al
testb $0x1, %al
jne 0x14565
jmp 0x14579
movq -0x20(%rbp), %rdi
leaq -0xd4(%rbp), %rsi
callq 0xa8c0
jmp 0x14577
jmp 0x145eb
movq -0x148(%rbp), %rdi
movslq -0x140(%rbp), %rsi
callq 0x3c600
movq -0x148(%rbp), %rdi
movq 0x18(%rax), %rax
movq %rax, -0x198(%rbp)
movslq -0xd4(%rbp), %rsi
callq 0x3c600
movq -0x198(%rbp), %rdx
movq -0x148(%rbp), %rdi
movq 0x18(%rax), %rcx
addq %rdx, %rcx
movq %rcx, 0x18(%rax)
movslq -0x140(%rbp), %rsi
callq 0x3c600
movq $0x0, 0x18(%rax)
movq -0x20(%rbp), %rdi
leaq -0x140(%rbp), %rsi
callq 0xa8c0
jmp 0x145e9
jmp 0x145eb
jmp 0x145ed
jmp 0x145ef
jmp 0x145f1
jmp 0x14817
movq -0x148(%rbp), %rdi
movslq -0xd4(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
callq 0xf940
movq -0x148(%rbp), %rdi
movq %rax, -0x1a0(%rbp)
movslq -0x140(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
callq 0xf940
movq %rax, %rcx
movq -0x1a0(%rbp), %rax
cmpq %rcx, %rax
jbe 0x14706
movq -0x148(%rbp), %rdi
movl -0x140(%rbp), %esi
movl -0xd4(%rbp), %edx
callq 0x5fcf0
movb %al, -0x1a1(%rbp)
jmp 0x14666
movb -0x1a1(%rbp), %al
testb $0x1, %al
jne 0x14675
jmp 0x14706
movq -0x148(%rbp), %rdi
movslq -0x140(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
callq 0x60e90
movb %al, -0x1a2(%rbp)
jmp 0x14698
movb -0x1a2(%rbp), %al
testb $0x1, %al
jne 0x146a4
jmp 0x14706
movq -0x148(%rbp), %rdi
movslq -0xd4(%rbp), %rsi
callq 0x3c600
movq -0x148(%rbp), %rdi
movq %rax, -0x1b0(%rbp)
movslq -0x140(%rbp), %rsi
callq 0x3c600
movq -0x148(%rbp), %rdi
movq -0x1b0(%rbp), %rsi
movq %rax, %rdx
callq 0x13a00
testb $0x1, %al
jne 0x146ed
jmp 0x14701
movq -0x20(%rbp), %rdi
leaq -0xd4(%rbp), %rsi
callq 0xa8c0
jmp 0x146ff
jmp 0x14701
jmp 0x14815
movq -0x148(%rbp), %rdi
movslq -0x140(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
callq 0xf940
movq -0x148(%rbp), %rdi
movq %rax, -0x1b8(%rbp)
movslq -0xd4(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
callq 0xf940
movq %rax, %rcx
movq -0x1b8(%rbp), %rax
cmpq %rcx, %rax
jbe 0x14813
movq -0x148(%rbp), %rdi
movl -0xd4(%rbp), %esi
movl -0x140(%rbp), %edx
callq 0x5fcf0
movb %al, -0x1b9(%rbp)
jmp 0x14776
movb -0x1b9(%rbp), %al
testb $0x1, %al
jne 0x14785
jmp 0x14813
movq -0x148(%rbp), %rdi
movslq -0xd4(%rbp), %rsi
callq 0x3c600
movq %rax, %rdi
callq 0x60e90
movb %al, -0x1ba(%rbp)
jmp 0x147a8
movb -0x1ba(%rbp), %al
testb $0x1, %al
jne 0x147b4
jmp 0x14813
movq -0x148(%rbp), %rdi
movslq -0x140(%rbp), %rsi
callq 0x3c600
movq -0x148(%rbp), %rdi
movq %rax, -0x1c8(%rbp)
movslq -0xd4(%rbp), %rsi
callq 0x3c600
movq -0x148(%rbp), %rdi
movq -0x1c8(%rbp), %rsi
movq %rax, %rdx
callq 0x13a00
testb $0x1, %al
jne 0x147fd
jmp 0x14811
movq -0x20(%rbp), %rdi
leaq -0x140(%rbp), %rsi
callq 0xa8c0
jmp 0x1480f
jmp 0x14811
jmp 0x14813
jmp 0x14815
jmp 0x14817
jmp 0x14819
leaq -0x120(%rbp), %rdi
callq 0x3ce80
jmp 0x142f7
jmp 0x14294
jmp 0x14831
leaq -0xc8(%rbp), %rdi
callq 0xa930
jmp 0x14192
leaq -0x40(%rbp), %rdi
callq 0x3cea0
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbp
retq
movq -0x50(%rbp), %rdi
callq 0x4610
nopl (%rax)