// File: /workspace/github_cpp_makefile_star2_O1/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 %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 0x3bab5
ucomisd %xmm4, %xmm3
jb 0x3bab5
movsd 0x18(%rbx), %xmm4
ucomisd %xmm0, %xmm4
jb 0x3bab5
ucomisd %xmm4, %xmm1
jb 0x3bab5
movsd 0x20(%rbx), %xmm4
ucomisd %xmm2, %xmm4
jb 0x3bab5
ucomisd %xmm4, %xmm3
jb 0x3bab5
movsd 0x28(%rbx), %xmm2
ucomisd %xmm0, %xmm2
jb 0x3bab5
ucomisd %xmm2, %xmm1
jae 0x3bde0
xorl %r15d, %r15d
movsd 0x3778(%rip), %xmm5     # 0x3f238
movsd 0x3778(%rip), %xmm6     # 0x3f240
movsd 0x3778(%rip), %xmm7     # 0x3f248
movsd 0x3607(%rip), %xmm8     # 0x3f0e0
movsd 0x376e(%rip), %xmm9     # 0x3f250
movsd 0x3605(%rip), %xmm10    # 0x3f0f0
movapd 0x353c(%rip), %xmm11    # 0x3f030
movsd 0x3733(%rip), %xmm12    # 0x3f230
movapd 0x357a(%rip), %xmm13    # 0x3f080
movsd 0x14f9(%rip), %xmm15    # 0x3d008
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 0x3bbd7
movapd %xmm14, %xmm1
andpd %xmm11, %xmm1
xorl %ebp, %ebp
ucomisd %xmm12, %xmm1
jbe 0x3bd2a
xorpd %xmm13, %xmm0
divsd %xmm14, %xmm0
ucomisd %xmm12, %xmm0
jbe 0x3bd2a
movsd 0x36a3(%rip), %xmm1     # 0x3f260
ucomisd %xmm0, %xmm1
jbe 0x3bd2a
movsd %xmm0, 0x10(%rsp)
movl $0x1, %ebp
jmp 0x3bd2a
mulsd 0x3679(%rip), %xmm0     # 0x3f258
mulsd %xmm2, %xmm0
movapd %xmm14, %xmm3
mulsd %xmm14, %xmm3
addsd %xmm0, %xmm3
xorl %ebp, %ebp
ucomisd %xmm12, %xmm3
jbe 0x3bd2a
ucomisd 0x34d2(%rip), %xmm3     # 0x3f0d8
movapd %xmm14, 0x20(%rsp)
jb 0x3bc18
xorps %xmm0, %xmm0
sqrtsd %xmm3, %xmm0
jmp 0x3bc47
movapd %xmm3, %xmm0
movapd %xmm2, (%rsp)
movapd %xmm3, 0x30(%rsp)
callq 0x7370
movapd 0x30(%rsp), %xmm3
movapd (%rsp), %xmm2
movapd 0x20(%rsp), %xmm14
movsd 0x35e9(%rip), %xmm12    # 0x3f230
subsd %xmm14, %xmm0
addsd %xmm2, %xmm2
divsd %xmm2, %xmm0
xorl %ebp, %ebp
ucomisd %xmm12, %xmm0
jbe 0x3bc76
movsd 0x35fb(%rip), %xmm1     # 0x3f260
ucomisd %xmm0, %xmm1
jbe 0x3bc76
movsd %xmm0, 0x10(%rsp)
movl $0x1, %ebp
ucomisd 0x345a(%rip), %xmm3     # 0x3f0d8
jb 0x3bc89
xorps %xmm0, %xmm0
sqrtsd %xmm3, %xmm0
jmp 0x3bcac
movapd %xmm3, %xmm0
movapd %xmm2, (%rsp)
callq 0x7370
movapd (%rsp), %xmm2
movapd 0x20(%rsp), %xmm14
movsd 0x3584(%rip), %xmm12    # 0x3f230
movsd 0x3584(%rip), %xmm5     # 0x3f238
movsd 0x3584(%rip), %xmm6     # 0x3f240
movsd 0x3584(%rip), %xmm7     # 0x3f248
movsd 0x3413(%rip), %xmm8     # 0x3f0e0
movsd 0x357a(%rip), %xmm9     # 0x3f250
movsd 0x3411(%rip), %xmm10    # 0x3f0f0
movapd 0x3348(%rip), %xmm11    # 0x3f030
movapd 0x338f(%rip), %xmm13    # 0x3f080
movsd 0x130e(%rip), %xmm15    # 0x3d008
xorpd %xmm13, %xmm14
subsd %xmm0, %xmm14
divsd %xmm2, %xmm14
ucomisd %xmm12, %xmm14
jbe 0x3bd2a
movsd 0x3548(%rip), %xmm0     # 0x3f260
ucomisd %xmm14, %xmm0
jbe 0x3bd2a
movl %ebp, %eax
incl %ebp
movsd %xmm14, 0x10(%rsp,%rax,8)
testl %ebp, %ebp
jle 0x3bdd0
movq %r15, %rax
orq $0x2, %rax
movl %ebp, %ecx
xorl %edx, %edx
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 (%rbx,%r15,8), %xmm2
mulsd 0x10(%rbx,%r15,8), %xmm1
mulsd %xmm0, %xmm3
mulsd %xmm0, %xmm3
mulsd 0x20(%rbx,%r15,8), %xmm3
addsd %xmm1, %xmm2
movapd %xmm0, %xmm1
mulsd %xmm0, %xmm1
addsd %xmm2, %xmm3
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
cmpq %rdx, %rcx
jne 0x3bd3d
leaq 0x1(%r15), %rax
testq %r15, %r15
movq %rax, %r15
je 0x3bb0f
addq $0x48, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq