// File: /workspace/github_cpp_makefile_star2_O2/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 %r12
pushq %rbx
subq $0x40, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x10(%rsi), %rdi
movsd (%rsi), %xmm0
minsd 0x30(%rsi), %xmm0
movsd %xmm0, (%r14)
movsd 0x8(%rsi), %xmm0
minsd 0x38(%rsi), %xmm0
movsd %xmm0, 0x8(%r14)
movsd (%rsi), %xmm0
maxsd 0x30(%rsi), %xmm0
movsd %xmm0, 0x10(%r14)
movsd 0x8(%rsi), %xmm0
maxsd 0x38(%rsi), %xmm0
movsd %xmm0, 0x18(%r14)
movq %r14, %rsi
callq 0x32a02
testl %eax, %eax
je 0x326dd
leaq 0x20(%rbx), %rdi
movq %r14, %rsi
callq 0x32a02
testl %eax, %eax
je 0x326dd
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
xorl %r15d, %r15d
movsd 0x3bb0(%rip), %xmm5     # 0x36298
movsd 0x3bb0(%rip), %xmm6     # 0x362a0
movsd 0x3bb0(%rip), %xmm7     # 0x362a8
movsd 0x3977(%rip), %xmm8     # 0x36078
movsd 0x3ba6(%rip), %xmm9     # 0x362b0
movsd 0x397d(%rip), %xmm10    # 0x36090
movapd 0x3914(%rip), %xmm11    # 0x36030
movsd 0x3b6b(%rip), %xmm12    # 0x36290
movapd 0x3992(%rip), %xmm13    # 0x360c0
pushq $0x1
popq %rbp
movsd 0x18ce(%rip), %xmm15    # 0x34008
cmpq $0x2, %r15
je 0x326d0
movsd (%rbx,%r15,8), %xmm1
movsd 0x10(%rbx,%r15,8), %xmm0
movapd %xmm0, %xmm2
mulsd %xmm5, %xmm2
movapd %xmm1, %xmm3
mulsd %xmm6, %xmm3
addsd %xmm3, %xmm2
movsd 0x20(%rbx,%r15,8), %xmm14
movapd %xmm14, %xmm4
mulsd %xmm7, %xmm4
addsd %xmm2, %xmm4
movsd 0x30(%rbx,%r15,8), %xmm2
mulsd %xmm8, %xmm2
addsd %xmm4, %xmm2
movapd %xmm0, %xmm4
mulsd %xmm9, %xmm4
mulsd %xmm10, %xmm1
addsd %xmm4, %xmm1
mulsd %xmm10, %xmm14
addsd %xmm1, %xmm14
mulsd %xmm8, %xmm0
addsd %xmm3, %xmm0
movapd %xmm2, %xmm1
andpd %xmm11, %xmm1
ucomisd %xmm1, %xmm12
jbe 0x32807
movapd %xmm14, %xmm1
andpd %xmm11, %xmm1
xorl %r12d, %r12d
ucomisd %xmm12, %xmm1
jbe 0x32956
xorpd %xmm13, %xmm0
divsd %xmm14, %xmm0
ucomisd %xmm12, %xmm0
jbe 0x32956
movsd 0x3ad1(%rip), %xmm1     # 0x362c0
ucomisd %xmm0, %xmm1
jbe 0x32956
movsd %xmm0, 0x10(%rsp)
movl %ebp, %r12d
jmp 0x32956
mulsd 0x3aa9(%rip), %xmm0     # 0x362b8
mulsd %xmm2, %xmm0
movapd %xmm14, %xmm3
mulsd %xmm14, %xmm3
addsd %xmm0, %xmm3
xorl %r12d, %r12d
ucomisd %xmm12, %xmm3
jbe 0x32956
ucomisd 0x39c9(%rip), %xmm3     # 0x36200
movapd %xmm14, 0x20(%rsp)
jb 0x32846
sqrtsd %xmm3, %xmm0
jmp 0x32875
movapd %xmm3, %xmm0
movapd %xmm2, (%rsp)
movapd %xmm3, 0x30(%rsp)
callq 0x8390
movapd 0x30(%rsp), %xmm3
movapd (%rsp), %xmm2
movapd 0x20(%rsp), %xmm14
movsd 0x3a1b(%rip), %xmm12    # 0x36290
subsd %xmm14, %xmm0
addsd %xmm2, %xmm2
divsd %xmm2, %xmm0
xorl %r12d, %r12d
ucomisd %xmm12, %xmm0
jbe 0x328a3
movsd 0x3a2c(%rip), %xmm1     # 0x362c0
ucomisd %xmm0, %xmm1
jbe 0x328a3
movsd %xmm0, 0x10(%rsp)
movl %ebp, %r12d
ucomisd 0x3955(%rip), %xmm3     # 0x36200
jb 0x328b3
sqrtsd %xmm3, %xmm0
jmp 0x328d6
movapd %xmm3, %xmm0
movapd %xmm2, (%rsp)
callq 0x8390
movapd (%rsp), %xmm2
movapd 0x20(%rsp), %xmm14
movsd 0x39ba(%rip), %xmm12    # 0x36290
movsd 0x39ba(%rip), %xmm5     # 0x36298
movsd 0x39ba(%rip), %xmm6     # 0x362a0
movsd 0x39ba(%rip), %xmm7     # 0x362a8
movsd 0x3781(%rip), %xmm8     # 0x36078
movsd 0x39b0(%rip), %xmm9     # 0x362b0
movsd 0x3787(%rip), %xmm10    # 0x36090
movapd 0x371e(%rip), %xmm11    # 0x36030
movapd 0x37a5(%rip), %xmm13    # 0x360c0
movsd 0x16e4(%rip), %xmm15    # 0x34008
xorpd %xmm13, %xmm14
subsd %xmm0, %xmm14
divsd %xmm2, %xmm14
ucomisd %xmm12, %xmm14
jbe 0x32956
movsd 0x397e(%rip), %xmm0     # 0x362c0
ucomisd %xmm14, %xmm0
jbe 0x32956
movl %r12d, %eax
incl %r12d
movsd %xmm14, 0x10(%rsp,%rax,8)
movq %r15, %rax
orq $0x2, %rax
movl %r12d, %ecx
xorl %edx, %edx
cmpq %rdx, %rcx
je 0x329fa
movsd 0x10(%rsp,%rdx,8), %xmm0
movapd %xmm15, %xmm1
subsd %xmm0, %xmm1
movapd %xmm1, %xmm2
mulsd %xmm1, %xmm2
mulsd %xmm1, %xmm2
movapd %xmm1, %xmm3
mulsd %xmm8, %xmm3
mulsd %xmm3, %xmm1
mulsd %xmm0, %xmm1
mulsd 0x10(%rbx,%r15,8), %xmm1
mulsd (%rbx,%r15,8), %xmm2
addsd %xmm1, %xmm2
mulsd %xmm0, %xmm3
mulsd %xmm0, %xmm3
mulsd 0x20(%rbx,%r15,8), %xmm3
addsd %xmm2, %xmm3
movapd %xmm0, %xmm1
mulsd %xmm0, %xmm1
mulsd %xmm0, %xmm1
mulsd 0x30(%rbx,%r15,8), %xmm1
addsd %xmm3, %xmm1
movsd (%r14,%r15,8), %xmm0
minsd %xmm1, %xmm0
movsd %xmm0, (%r14,%r15,8)
movsd (%r14,%rax,8), %xmm0
maxsd %xmm1, %xmm0
movsd %xmm0, (%r14,%rax,8)
incq %rdx
jmp 0x32962
incq %r15
jmp 0x3273a