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

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movl %ecx, -0x104(%rbp)
movq %rdx, %rax
movl -0x104(%rbp), %edx
movq %rax, -0x100(%rbp)
movq %rsi, %rax
movq -0x100(%rbp), %rsi
movq %rax, -0xf8(%rbp)
movq %rdi, %r10
movq -0xf8(%rbp), %rdi
movq %r10, -0xf0(%rbp)
movq %r10, %rax
movq %rax, -0xe8(%rbp)
movb 0x18(%rbp), %al
movb 0x10(%rbp), %cl
movq %r10, -0x8(%rbp)
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
movq %r9, -0x28(%rbp)
andb $0x1, %cl
movb %cl, -0x29(%rbp)
andb $0x1, %al
movb %al, -0x2a(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xe0(%rbp)
movl -0x20(%rbp), %eax
subl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
cmpl $0x2, -0x30(%rbp)
jl 0x7db04
jmp 0x7db23
leaq 0xa7a1(%rip), %rdi      # 0x882ac
leaq 0xa5aa(%rip), %rsi      # 0x880bc
movl $0x80, %edx
leaq 0xa796(%rip), %rcx      # 0x882b4
callq 0x4260
movl -0x30(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x7db35
jmp 0x7db54
leaq 0xa7e8(%rip), %rdi      # 0x88324
leaq 0xa579(%rip), %rsi      # 0x880bc
movl $0x81, %edx
leaq 0xa765(%rip), %rcx      # 0x882b4
callq 0x4260
cmpl $0x2, -0x30(%rbp)
jne 0x7dcd0
movq -0x18(%rbp), %rdi
movslq -0x1c(%rbp), %rsi
callq 0x3c5b0
movl (%rax), %eax
movl %eax, -0x5c(%rbp)
leaq -0x5c(%rbp), %rax
movq %rax, -0x58(%rbp)
movq $0x1, -0x50(%rbp)
leaq -0x5d(%rbp), %rdi
movq %rdi, -0x110(%rbp)
callq 0xa710
movq -0x110(%rbp), %rcx
movq -0x58(%rbp), %rsi
movq -0x50(%rbp), %rdx
leaq -0x48(%rbp), %rdi
callq 0x3c9b0
jmp 0x7dbaa
leaq -0x5d(%rbp), %rdi
callq 0xa7a0
movq -0x18(%rbp), %rdi
movslq -0x20(%rbp), %rsi
callq 0x3c5b0
movl (%rax), %eax
movl %eax, -0x9c(%rbp)
leaq -0x9c(%rbp), %rax
movq %rax, -0x98(%rbp)
movq $0x1, -0x90(%rbp)
leaq -0x9d(%rbp), %rdi
movq %rdi, -0x118(%rbp)
callq 0xa710
movq -0x118(%rbp), %rcx
movq -0x98(%rbp), %rsi
movq -0x90(%rbp), %rdx
leaq -0x88(%rbp), %rdi
callq 0x3c9b0
jmp 0x7dc17
leaq -0x9d(%rbp), %rdi
callq 0xa7a0
movq -0xf0(%rbp), %rdi
movq -0xe0(%rbp), %rsi
movq -0x28(%rbp), %r8
movzbl -0x29(%rbp), %r9d
movzbl -0x2a(%rbp), %ecx
andl $0x1, %ecx
movq %rsp, %rax
movl %ecx, (%rax)
andl $0x1, %r9d
leaq -0x48(%rbp), %rdx
leaq -0x88(%rbp), %rcx
callq 0x7b700
jmp 0x7dc5c
leaq -0x88(%rbp), %rdi
callq 0xab00
leaq -0x48(%rbp), %rdi
callq 0xab00
jmp 0x7ddf1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x5d(%rbp), %rdi
callq 0xa7a0
jmp 0x7de01
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x9d(%rbp), %rdi
callq 0xa7a0
jmp 0x7dcc2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x88(%rbp), %rdi
callq 0xab00
leaq -0x48(%rbp), %rdi
callq 0xab00
jmp 0x7de01
movq -0xe0(%rbp), %rsi
movl -0x1c(%rbp), %eax
movl -0x20(%rbp), %ecx
addl %ecx, %eax
movl %eax, %ecx
shrl $0x1f, %ecx
addl %ecx, %eax
sarl %eax
movl %eax, -0xa4(%rbp)
movq -0x18(%rbp), %rdx
movl -0x1c(%rbp), %ecx
movl -0xa4(%rbp), %r8d
movq -0x28(%rbp), %r9
movzbl -0x29(%rbp), %edi
movzbl -0x2a(%rbp), %r10d
andl $0x1, %r10d
movq %rsp, %rax
movl %r10d, 0x8(%rax)
andl $0x1, %edi
movl %edi, (%rax)
leaq -0xc0(%rbp), %rdi
callq 0x7da70
movq -0xe0(%rbp), %rsi
movq -0x18(%rbp), %rdx
movl -0xa4(%rbp), %ecx
incl %ecx
movl -0x20(%rbp), %r8d
movq -0x28(%rbp), %r9
movzbl -0x29(%rbp), %edi
movzbl -0x2a(%rbp), %r10d
andl $0x1, %r10d
movq %rsp, %rax
movl %r10d, 0x8(%rax)
andl $0x1, %edi
movl %edi, (%rax)
leaq -0xd8(%rbp), %rdi
callq 0x7da70
jmp 0x7dd67
movq -0xe0(%rbp), %rsi
movq -0xf0(%rbp), %rdi
movq -0x28(%rbp), %r8
movzbl -0x29(%rbp), %r9d
movzbl -0x2a(%rbp), %ecx
andl $0x1, %ecx
movq %rsp, %rax
movl %ecx, (%rax)
andl $0x1, %r9d
leaq -0xc0(%rbp), %rdx
leaq -0xd8(%rbp), %rcx
callq 0x7b700
jmp 0x7dda3
leaq -0xd8(%rbp), %rdi
callq 0xab00
leaq -0xc0(%rbp), %rdi
callq 0xab00
jmp 0x7ddf1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x7dde3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0xab00
leaq -0xc0(%rbp), %rdi
callq 0xab00
jmp 0x7de01
movq -0xe8(%rbp), %rax
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
movq -0x68(%rbp), %rdi
callq 0x4610
nopw (%rax,%rax)