// File: cjc12[P]ezSTL/src/../include/algorithm.h
// Function: unsigned int* ezSTL::__quick_sort_partition<unsigned int*, ezSTL::less<unsigned int>>(unsigned int*, unsigned int*, ezSTL::less<unsigned int>)
inline Iterator __quick_sort_partition(Iterator First, Iterator Last, Compare cmp) {
		Iterator Medium = First + (Last - First) / 2;
		// get the medial value of First, Medium, Last - 1
		if ((cmp(*Medium, *First) && cmp(*(Last - 1), *Medium)) || (cmp(*Medium, *(Last - 1)) && cmp(*First, *Medium)))
			swap(*First, *Medium);
		else if ((cmp(*First, *(Last - 1)) && cmp(*(Last - 1), *Medium)) || (cmp(*Medium, *(Last - 1)) && cmp(*(Last - 1), *First)))
			swap(*First, *(Last - 1));
		auto pivot = *First;
		// partition according the value of pivot
		while (First < Last - 1) {
			while (First < Last - 1 && !cmp(*(Last - 1), pivot))
				--Last;
			*First = *(Last - 1);
			while (First < Last - 1 && !cmp(pivot, *First))
				++First;
			*(Last - 1) = *First;
		}
		*First = pivot;
		return First;
	}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq %rsi, 0x20(%rsp)
movq 0x28(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x20(%rsp), %rax
movq 0x28(%rsp), %rcx
subq %rcx, %rax
sarq $0x2, %rax
movl $0x2, %ecx
cqto
idivq %rcx
movq %rax, %rcx
movq 0x8(%rsp), %rax
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rsi
movq 0x28(%rsp), %rdx
leaq 0x37(%rsp), %rdi
callq 0x15e40
testb $0x1, %al
jne 0x1a3c1
jmp 0x1a3dd
movq 0x20(%rsp), %rsi
addq $-0x4, %rsi
movq 0x18(%rsp), %rdx
leaq 0x37(%rsp), %rdi
callq 0x15e40
testb $0x1, %al
jne 0x1a415
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
addq $-0x4, %rdx
leaq 0x37(%rsp), %rdi
callq 0x15e40
testb $0x1, %al
jne 0x1a3fb
jmp 0x1a429
movq 0x28(%rsp), %rsi
movq 0x18(%rsp), %rdx
leaq 0x37(%rsp), %rdi
callq 0x15e40
testb $0x1, %al
jne 0x1a415
jmp 0x1a429
movq 0x28(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0x1ab00
jmp 0x1a4b4
movq 0x28(%rsp), %rsi
movq 0x20(%rsp), %rdx
addq $-0x4, %rdx
leaq 0x37(%rsp), %rdi
callq 0x15e40
testb $0x1, %al
jne 0x1a447
jmp 0x1a463
movq 0x20(%rsp), %rsi
addq $-0x4, %rsi
movq 0x18(%rsp), %rdx
leaq 0x37(%rsp), %rdi
callq 0x15e40
testb $0x1, %al
jne 0x1a49f
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
addq $-0x4, %rdx
leaq 0x37(%rsp), %rdi
callq 0x15e40
testb $0x1, %al
jne 0x1a481
jmp 0x1a4b2
movq 0x20(%rsp), %rsi
addq $-0x4, %rsi
movq 0x28(%rsp), %rdx
leaq 0x37(%rsp), %rdi
callq 0x15e40
testb $0x1, %al
jne 0x1a49f
jmp 0x1a4b2
movq 0x28(%rsp), %rdi
movq 0x20(%rsp), %rsi
addq $-0x4, %rsi
callq 0x1ab00
jmp 0x1a4b4
movq 0x28(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x14(%rsp)
movq 0x28(%rsp), %rax
movq 0x20(%rsp), %rcx
addq $-0x4, %rcx
cmpq %rcx, %rax
jae 0x1a599
jmp 0x1a4d8
movq 0x28(%rsp), %rcx
movq 0x20(%rsp), %rdx
addq $-0x4, %rdx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, 0x7(%rsp)
jae 0x1a50f
movq 0x20(%rsp), %rsi
addq $-0x4, %rsi
leaq 0x37(%rsp), %rdi
leaq 0x14(%rsp), %rdx
callq 0x15e40
xorb $-0x1, %al
movb %al, 0x7(%rsp)
movb 0x7(%rsp), %al
testb $0x1, %al
jne 0x1a519
jmp 0x1a529
movq 0x20(%rsp), %rax
addq $-0x4, %rax
movq %rax, 0x20(%rsp)
jmp 0x1a4d8
movq 0x20(%rsp), %rax
movl -0x4(%rax), %ecx
movq 0x28(%rsp), %rax
movl %ecx, (%rax)
movq 0x28(%rsp), %rcx
movq 0x20(%rsp), %rdx
addq $-0x4, %rdx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, 0x6(%rsp)
jae 0x1a56b
movq 0x28(%rsp), %rdx
leaq 0x37(%rsp), %rdi
leaq 0x14(%rsp), %rsi
callq 0x15e40
xorb $-0x1, %al
movb %al, 0x6(%rsp)
movb 0x6(%rsp), %al
testb $0x1, %al
jne 0x1a575
jmp 0x1a585
movq 0x28(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x28(%rsp)
jmp 0x1a538
movq 0x28(%rsp), %rax
movl (%rax), %ecx
movq 0x20(%rsp), %rax
movl %ecx, -0x4(%rax)
jmp 0x1a4bf
movl 0x14(%rsp), %ecx
movq 0x28(%rsp), %rax
movl %ecx, (%rax)
movq 0x28(%rsp), %rax
addq $0x38, %rsp
retq
nop