// File: /workspace/github_cpp_makefile_star2_O2/thierry7100[P]CutOptim/src/ConvexHull.cpp
// Function: makeConvexHullPresorted(std::vector<Point, std::allocator<Point>> const&)
vector<Point> makeConvexHullPresorted(const vector<Point> &points) {
	if (points.size() <= 1)
		return vector<Point>(points);

	// Andrew's monotone chain algorithm. Positive y coordinates correspond to "up"
	// as per the mathematical convention, instead of "down" as per the computer
	// graphics convention. This doesn't affect the correctness of the result.

	vector<Point> upperHull;
	for (const Point &p : points) {
		while (upperHull.size() >= 2) {
			const Point &q = *(upperHull.cend() - 1);  // Same as .back()
			const Point &r = *(upperHull.cend() - 2);
			if ((q.x - r.x) * (p.y - r.y) >= (q.y - r.y) * (p.x - r.x))
				upperHull.pop_back();
			else
				break;
		}
		upperHull.push_back(p);
	}
	upperHull.pop_back();

	vector<Point> lowerHull;
	for (vector<Point>::const_reverse_iterator it = points.crbegin(); it != points.crend(); ++it) {
		const Point &p = *it;
		while (lowerHull.size() >= 2) {
			const Point &q = *(lowerHull.cend() - 1);  // Same as .back()
			const Point &r = *(lowerHull.cend() - 2);
			if ((q.x - r.x) * (p.y - r.y) >= (q.y - r.y) * (p.x - r.x))
				lowerHull.pop_back();
			else
				break;
		}
		lowerHull.push_back(p);
	}
	lowerHull.pop_back();

	if (!(upperHull.size() == 1 && upperHull == lowerHull))
		upperHull.insert(upperHull.end(), lowerHull.cbegin(), lowerHull.cend());
	return upperHull;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq (%rsi), %r15
movq 0x8(%rsi), %r12
movq %r12, %rax
subq %r15, %rax
cmpq $0x10, %rax
ja 0x21128
movq %rbx, %rdi
movq %r14, %rsi
callq 0x21456
jmp 0x2125f
xorpd %xmm0, %xmm0
movupd %xmm0, (%rbx)
andq $0x0, 0x10(%rbx)
cmpq %r12, %r15
je 0x21196
movq 0x8(%rbx), %rax
movq %rax, %rcx
subq (%rbx), %rcx
addq $-0x10, %rax
cmpq $0x11, %rcx
jb 0x21185
movupd -0x10(%rax), %xmm0
movupd (%rax), %xmm1
subpd %xmm0, %xmm1
movupd (%r15), %xmm2
subpd %xmm0, %xmm2
shufpd $0x1, %xmm2, %xmm2      # xmm2 = xmm2[1,0]
mulpd %xmm1, %xmm2
movapd %xmm2, %xmm0
unpckhpd %xmm2, %xmm0            # xmm0 = xmm0[1],xmm2[1]
ucomisd %xmm0, %xmm2
jb 0x21185
movq %rax, 0x8(%rbx)
addq $-0x10, %rcx
jmp 0x21144
movq %rbx, %rdi
movq %r15, %rsi
callq 0x214a6
addq $0x10, %r15
jmp 0x21135
addq $-0x10, 0x8(%rbx)
xorpd %xmm0, %xmm0
movq %rsp, %r15
movapd %xmm0, (%r15)
andq $0x0, 0x10(%r15)
movq 0x8(%r14), %r12
cmpq (%r14), %r12
je 0x21215
addq $-0x10, %r12
movq 0x8(%rsp), %rax
movq %rax, %rcx
subq (%rsp), %rcx
addq $-0x10, %rax
cmpq $0x11, %rcx
jb 0x21208
movupd -0x10(%rax), %xmm0
movupd (%rax), %xmm1
subpd %xmm0, %xmm1
movupd (%r12), %xmm2
subpd %xmm0, %xmm2
shufpd $0x1, %xmm2, %xmm2      # xmm2 = xmm2[1,0]
mulpd %xmm1, %xmm2
movapd %xmm2, %xmm0
unpckhpd %xmm2, %xmm0            # xmm0 = xmm0[1],xmm2[1]
ucomisd %xmm0, %xmm2
jb 0x21208
movq %rax, 0x8(%rsp)
addq $-0x10, %rcx
jmp 0x211c5
movq %r15, %rdi
movq %r12, %rsi
callq 0x214a6
jmp 0x211b0
movq 0x8(%rsp), %rcx
addq $-0x10, %rcx
movq %rcx, 0x8(%rsp)
movq 0x8(%rbx), %rsi
movq %rsi, %rax
subq (%rbx), %rax
cmpq $0x10, %rax
jne 0x2124b
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x214c3
testb %al, %al
jne 0x21257
movq 0x8(%rbx), %rsi
movq 0x8(%rsp), %rcx
movq (%rsp), %rdx
movq %rbx, %rdi
callq 0x214ec
movq %rsp, %rdi
callq 0x2150c
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x21272
jmp 0x21272
movq %rax, %r14
movq %rsp, %rdi
callq 0x2150c
jmp 0x21282
movq %rax, %r14
movq %rbx, %rdi
callq 0x2150c
movq %r14, %rdi
callq 0x8770