// File: /workspace/github_cpp_makefile_star2_O3/thierry7100[P]CutOptim/include/nanosvg.h
// Function: nsvg__curveBounds(double*, double*)
static void nsvg__curveBounds(double* bounds, double* curve)
{
	int i, j, count;
	double roots[2], a, b, c, b2ac, t, v;
	double* v0 = &curve[0];
	double* v1 = &curve[2];
	double* v2 = &curve[4];
	double* v3 = &curve[6];

	// Start the bounding box by end points
	bounds[0] = nsvg__minf(v0[0], v3[0]);
	bounds[1] = nsvg__minf(v0[1], v3[1]);
	bounds[2] = nsvg__maxf(v0[0], v3[0]);
	bounds[3] = nsvg__maxf(v0[1], v3[1]);

	// Bezier curve fits inside the convex hull of it's control points.
	// If control points are inside the bounds, we're done.
	if (nsvg__ptInBounds(v1, bounds) && nsvg__ptInBounds(v2, bounds))
		return;

	// Add bezier curve inflection points in X and Y.
	for (i = 0; i < 2; i++) {
		a = -3.0 * v0[i] + 9.0 * v1[i] - 9.0 * v2[i] + 3.0 * v3[i];
		b = 6.0 * v0[i] - 12.0 * v1[i] + 6.0 * v2[i];
		c = 3.0 * v1[i] - 3.0 * v0[i];
		count = 0;
		if (fabs(a) < NSVG_EPSILON) {
			if (fabs(b) > NSVG_EPSILON) {
				t = -c / b;
				if (t > NSVG_EPSILON && t < 1.0-NSVG_EPSILON)
					roots[count++] = t;
			}
		} else {
			b2ac = b*b - 4.0*c*a;
			if (b2ac > NSVG_EPSILON) {
				t = (-b + sqrt(b2ac)) / (2.0 * a);
				if (t > NSVG_EPSILON && t < 1.0-NSVG_EPSILON)
					roots[count++] = t;
				t = (-b - sqrt(b2ac)) / (2.0 * a);
				if (t > NSVG_EPSILON && t < 1.0-NSVG_EPSILON)
					roots[count++] = t;
			}
		}
		for (j = 0; j < count; j++) {
			v = nsvg__evalBezier(roots[j], v0[i], v1[i], v2[i], v3[i]);
			bounds[0+i] = nsvg__minf(bounds[0+i], v);
			bounds[2+i] = nsvg__maxf(bounds[2+i], v);
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movsd (%rsi), %xmm2
minsd 0x30(%rsi), %xmm2
movsd %xmm2, (%rdi)
movsd 0x8(%rsi), %xmm0
minsd 0x38(%rsi), %xmm0
movsd %xmm0, 0x8(%rdi)
movsd (%rsi), %xmm3
maxsd 0x30(%rsi), %xmm3
movsd %xmm3, 0x10(%rdi)
movsd 0x8(%rsi), %xmm1
maxsd 0x38(%rsi), %xmm1
movsd %xmm1, 0x18(%rdi)
movsd 0x10(%rsi), %xmm4
ucomisd %xmm2, %xmm4
jb 0x3aac8
ucomisd %xmm4, %xmm3
jb 0x3aac8
movsd 0x18(%rbx), %xmm4
ucomisd %xmm0, %xmm4
jb 0x3aac8
ucomisd %xmm4, %xmm1
jb 0x3aac8
movsd 0x20(%rbx), %xmm4
ucomisd %xmm2, %xmm4
jb 0x3aac8
ucomisd %xmm4, %xmm3
jb 0x3aac8
movsd 0x28(%rbx), %xmm2
ucomisd %xmm0, %xmm2
jb 0x3aac8
ucomisd %xmm2, %xmm1
jae 0x3ae0e
movb $0x1, %bpl
xorl %r15d, %r15d
movsd 0x3802(%rip), %xmm7     # 0x3e2d8
movsd 0x3801(%rip), %xmm8     # 0x3e2e0
movsd 0x3800(%rip), %xmm9     # 0x3e2e8
movsd 0x3587(%rip), %xmm10    # 0x3e078
movsd 0x37f6(%rip), %xmm11    # 0x3e2f0
movsd 0x358d(%rip), %xmm12    # 0x3e090
movapd 0x3524(%rip), %xmm13    # 0x3e030
movsd 0x37bb(%rip), %xmm14    # 0x3e2d0
movsd 0x14eb(%rip), %xmm5     # 0x3c008
movsd (%rbx,%r15,8), %xmm1
movsd 0x10(%rbx,%r15,8), %xmm0
movapd %xmm0, %xmm2
mulsd %xmm7, %xmm2
movapd %xmm1, %xmm15
mulsd %xmm8, %xmm15
addsd %xmm15, %xmm2
movsd 0x20(%rbx,%r15,8), %xmm6
movapd %xmm6, %xmm4
mulsd %xmm9, %xmm4
addsd %xmm2, %xmm4
movsd 0x30(%rbx,%r15,8), %xmm3
mulsd %xmm10, %xmm3
addsd %xmm4, %xmm3
movapd %xmm0, %xmm2
mulsd %xmm11, %xmm2
mulsd %xmm12, %xmm1
addsd %xmm2, %xmm1
mulsd %xmm12, %xmm6
addsd %xmm1, %xmm6
mulsd %xmm10, %xmm0
addsd %xmm15, %xmm0
movapd %xmm3, %xmm1
andpd %xmm13, %xmm1
ucomisd %xmm1, %xmm14
jbe 0x3abe8
movapd %xmm6, %xmm1
andpd %xmm13, %xmm1
ucomisd %xmm14, %xmm1
jbe 0x3adf9
xorpd 0x350a(%rip), %xmm0     # 0x3e0c0
divsd %xmm6, %xmm0
ucomisd %xmm14, %xmm0
jbe 0x3adf9
movsd 0x3733(%rip), %xmm1     # 0x3e300
ucomisd %xmm0, %xmm1
jbe 0x3adf9
movsd %xmm0, 0x10(%rsp)
movl $0x1, %r12d
jmp 0x3ad55
mulsd 0x3708(%rip), %xmm0     # 0x3e2f8
mulsd %xmm3, %xmm0
movapd %xmm6, %xmm4
mulsd %xmm6, %xmm4
addsd %xmm0, %xmm4
ucomisd %xmm14, %xmm4
jbe 0x3adf9
ucomisd 0x362d(%rip), %xmm4     # 0x3e240
movapd %xmm6, 0x20(%rsp)
jb 0x3ac24
xorps %xmm0, %xmm0
sqrtsd %xmm4, %xmm0
jmp 0x3ac49
movapd %xmm4, %xmm0
movapd %xmm3, (%rsp)
movapd %xmm4, 0x30(%rsp)
callq 0x7380
movapd 0x30(%rsp), %xmm4
movapd (%rsp), %xmm3
movapd 0x20(%rsp), %xmm6
subsd %xmm6, %xmm0
addsd %xmm3, %xmm3
divsd %xmm3, %xmm0
movapd %xmm0, %xmm1
movsd 0x369f(%rip), %xmm2     # 0x3e300
cmpltpd %xmm2, %xmm1
movsd 0x3662(%rip), %xmm2     # 0x3e2d0
cmpltpd %xmm0, %xmm2
andpd %xmm1, %xmm2
movd %xmm2, %r13d
xorl %r12d, %r12d
testb $0x1, %r13b
je 0x3ac91
movsd %xmm0, 0x10(%rsp)
movl $0x1, %r12d
ucomisd 0x35a7(%rip), %xmm4     # 0x3e240
jb 0x3aca4
xorps %xmm0, %xmm0
sqrtsd %xmm4, %xmm0
jmp 0x3acbd
movapd %xmm4, %xmm0
movapd %xmm3, (%rsp)
callq 0x7380
movapd (%rsp), %xmm3
movapd 0x20(%rsp), %xmm6
movsd 0x3613(%rip), %xmm7     # 0x3e2d8
movsd 0x3612(%rip), %xmm8     # 0x3e2e0
movsd 0x3611(%rip), %xmm9     # 0x3e2e8
movsd 0x3398(%rip), %xmm10    # 0x3e078
movsd 0x3607(%rip), %xmm11    # 0x3e2f0
movsd 0x339e(%rip), %xmm12    # 0x3e090
movapd 0x3335(%rip), %xmm13    # 0x3e030
movsd 0x35cc(%rip), %xmm14    # 0x3e2d0
movapd 0x33b3(%rip), %xmm15    # 0x3e0c0
movsd 0x12f3(%rip), %xmm5     # 0x3c008
xorpd %xmm15, %xmm6
subsd %xmm0, %xmm6
divsd %xmm3, %xmm6
ucomisd %xmm14, %xmm6
jbe 0x3ad45
movsd 0x35cf(%rip), %xmm0     # 0x3e300
ucomisd %xmm6, %xmm0
jbe 0x3ad45
movl %r12d, %eax
incl %r12d
movsd %xmm6, 0x10(%rsp,%rax,8)
jmp 0x3ad55
movl $0x1, %r12d
testb $0x1, %r13b
je 0x3adf9
movq %r15, %rax
orq $0x2, %rax
movsd (%r14,%r15,8), %xmm0
movsd 0x10(%r14,%r15,8), %xmm1
xorl %ecx, %ecx
movsd 0x10(%rsp,%rcx,8), %xmm4
movapd %xmm5, %xmm2
subsd %xmm4, %xmm2
movapd %xmm2, %xmm3
mulsd %xmm2, %xmm3
movapd %xmm2, %xmm5
mulsd %xmm10, %xmm5
mulsd %xmm2, %xmm3
mulsd %xmm5, %xmm2
mulsd %xmm4, %xmm2
mulsd 0x10(%rbx,%r15,8), %xmm2
mulsd (%rbx,%r15,8), %xmm3
mulsd %xmm4, %xmm5
mulsd %xmm4, %xmm5
movapd %xmm4, %xmm6
mulsd %xmm4, %xmm6
mulsd 0x20(%rbx,%r15,8), %xmm5
mulsd %xmm4, %xmm6
mulsd 0x30(%rbx,%r15,8), %xmm6
addsd %xmm2, %xmm3
addsd %xmm3, %xmm5
addsd %xmm5, %xmm6
movsd 0x122f(%rip), %xmm5     # 0x3c008
minsd %xmm6, %xmm0
movsd %xmm0, (%r14,%r15,8)
maxsd %xmm6, %xmm1
movsd %xmm1, (%r14,%rax,8)
incq %rcx
cmpq %rcx, %r12
jne 0x3ad6b
movl $0x1, %r15d
testb $0x1, %bpl
movl $0x0, %ebp
jne 0x3ab1d
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq