// File: Laakeri[P]maxpre/src/cardinalityconstraint.cpp
// Function: maxPreprocessor::CardinalityConstraint::Card(std::vector<int, std::allocator<int>> const&, int, int, int, maxPreprocessor::CardinalityConstraint::Formula&, bool, bool)
vector<int> CardinalityConstraint::Card(const vector<int>& A, int l, int r, int k, Formula& F, bool d1, bool d2) {
	int n = (r-l+1);
	assert(n%k == 0);
	if (n == k) {
		return HSort(A, l, r, F, d1, d2);
	}
	else {
		vector<int> a = Card(A, l, l+k-1, k, F, d1, d2);
		vector<int> b = Card(A, l+k, r, k, F, d1, d2);
		assert((int)a.size() == k && (int)b.size() == k);
		return SMerge(a, b, F, d1, d2);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movl %ecx, -0x9c(%rbp)
movq %rdx, %rax
movl -0x9c(%rbp), %edx
movq %rax, -0x98(%rbp)
movq %rsi, %rax
movq -0x98(%rbp), %rsi
movq %rax, -0x90(%rbp)
movq %rdi, %r10
movq -0x90(%rbp), %rdi
movq %r10, -0x88(%rbp)
movq %r10, %rax
movq %rax, -0x80(%rbp)
movb 0x20(%rbp), %al
movb 0x18(%rbp), %cl
movq 0x10(%rbp), %r11
movq %r10, -0x8(%rbp)
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
movl %r9d, -0x24(%rbp)
andb $0x1, %cl
movb %cl, -0x25(%rbp)
andb $0x1, %al
movb %al, -0x26(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x78(%rbp)
movl -0x20(%rbp), %eax
subl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cltd
idivl -0x24(%rbp)
cmpl $0x0, %edx
jne 0x7dea8
jmp 0x7dec7
leaq 0xa47f(%rip), %rdi      # 0x8832e
leaq 0xa206(%rip), %rsi      # 0x880bc
movl $0x90, %edx
leaq 0xa475(%rip), %rcx      # 0x88337
callq 0x4260
movl -0x2c(%rbp), %eax
cmpl -0x24(%rbp), %eax
jne 0x7df0f
movq -0x78(%rbp), %rsi
movq -0x88(%rbp), %rdi
movq -0x18(%rbp), %rdx
movl -0x1c(%rbp), %ecx
movl -0x20(%rbp), %r8d
movq 0x10(%rbp), %r9
movb -0x25(%rbp), %r10b
movb -0x26(%rbp), %al
andb $0x1, %r10b
andb $0x1, %al
movzbl %r10b, %r10d
movl %r10d, (%rsp)
movzbl %al, %eax
movl %eax, 0x8(%rsp)
callq 0x7da70
jmp 0x7e069
movq -0x78(%rbp), %rsi
movq -0x18(%rbp), %rdx
movl -0x1c(%rbp), %ecx
movl -0x24(%rbp), %r9d
movl %r9d, %edi
movl %ecx, %eax
leal -0x1(%rax,%rdi), %r8d
movq 0x10(%rbp), %rdi
movzbl -0x25(%rbp), %r10d
movzbl -0x26(%rbp), %r11d
andl $0x1, %r11d
movq %rsp, %rax
movl %r11d, 0x10(%rax)
andl $0x1, %r10d
movl %r10d, 0x8(%rax)
movq %rdi, (%rax)
leaq -0x48(%rbp), %rdi
callq 0x7de10
movq -0x78(%rbp), %rsi
movq -0x18(%rbp), %rdx
movl -0x1c(%rbp), %ecx
movl -0x24(%rbp), %r9d
addl %r9d, %ecx
movl -0x20(%rbp), %r8d
movq 0x10(%rbp), %rdi
movzbl -0x25(%rbp), %r10d
movzbl -0x26(%rbp), %r11d
andl $0x1, %r11d
movq %rsp, %rax
movl %r11d, 0x10(%rax)
andl $0x1, %r10d
movl %r10d, 0x8(%rax)
movq %rdi, (%rax)
leaq -0x60(%rbp), %rdi
callq 0x7de10
jmp 0x7df9a
leaq -0x48(%rbp), %rdi
callq 0xf940
movl %eax, %ecx
xorl %eax, %eax
cmpl -0x24(%rbp), %ecx
movb %al, -0x9d(%rbp)
jne 0x7dfc7
leaq -0x60(%rbp), %rdi
callq 0xf940
cmpl -0x24(%rbp), %eax
sete %al
movb %al, -0x9d(%rbp)
movb -0x9d(%rbp), %al
testb $0x1, %al
jne 0x7dfd3
jmp 0x7dfd5
jmp 0x7e002
leaq 0xa3cf(%rip), %rdi      # 0x883ab
leaq 0xa0d9(%rip), %rsi      # 0x880bc
movl $0x97, %edx
leaq 0xa348(%rip), %rcx      # 0x88337
callq 0x4260
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x7e05e
movq -0x78(%rbp), %rsi
movq -0x88(%rbp), %rdi
movq 0x10(%rbp), %r8
movzbl -0x25(%rbp), %r9d
movzbl -0x26(%rbp), %ecx
andl $0x1, %ecx
movq %rsp, %rax
movl %ecx, (%rax)
andl $0x1, %r9d
leaq -0x48(%rbp), %rdx
leaq -0x60(%rbp), %rcx
callq 0x7c7c0
jmp 0x7e035
leaq -0x60(%rbp), %rdi
callq 0xab00
leaq -0x48(%rbp), %rdi
callq 0xab00
jmp 0x7e069
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x60(%rbp), %rdi
callq 0xab00
leaq -0x48(%rbp), %rdi
callq 0xab00
jmp 0x7e076
movq -0x80(%rbp), %rax
addq $0xc0, %rsp
popq %rbp
retq
movq -0x68(%rbp), %rdi
callq 0x4610
nop