// File: /workspace/github_cpp_makefile_star2_O1/thierry7100[P]CutOptim/include/nanosvg.h
// Function: nsvg__getLocalBounds(double*, NSVGshape*, double*)
static void nsvg__getLocalBounds(double* bounds, NSVGshape *shape, double* xform)
{
	NSVGpath* path;
	NSVGPathElt *Elt;

	double curve[4*2], curveBounds[4];
	int first = 1;
	for (path = shape->paths; path != NULL; path = path->next)
	{
		nsvg__xformPoint(&curve[0], &curve[1], path->StartX, path->StartY, xform);
		Elt = path->PathElts;
		while ( Elt )
		{
            if ( Elt->Type == NSVG_PATH_LINE )      //Segment, bounding is easy to compute
            {
                nsvg__xformPoint(&curve[6], &curve[7], Elt->EndX, Elt->EndY, xform);
                curveBounds[0] = fmin(curve[0], curve[6]);
                curveBounds[0] = fmin(curve[1], curve[7]);
                curveBounds[0] = fmax(curve[0], curve[6]);
                curveBounds[0] = fmax(curve[1], curve[7]);
            }
            else if ( Elt->Type == NSVG_PATH_BEZIER_C )
            {
                nsvg__xformPoint(&curve[2], &curve[3], Elt->BzCtrl1X, Elt->BzCtrl1Y, xform);
                nsvg__xformPoint(&curve[4], &curve[5], Elt->BzCtrl2X, Elt->BzCtrl2Y, xform);
                nsvg__xformPoint(&curve[6], &curve[7], Elt->EndX, Elt->EndY, xform);
                nsvg__curveBounds(curveBounds, curve);
            }
            else
            {
                fprintf(stderr, "Non supported PathElt type :%d\n", Elt->Type);

            }
			if (first) {
				bounds[0] = curveBounds[0];
				bounds[1] = curveBounds[1];
				bounds[2] = curveBounds[2];
				bounds[3] = curveBounds[3];
				first = 0;
			} else {
				bounds[0] = nsvg__minf(bounds[0], curveBounds[0]);
				bounds[1] = nsvg__minf(bounds[1], curveBounds[1]);
				bounds[2] = nsvg__maxf(bounds[2], curveBounds[2]);
				bounds[3] = nsvg__maxf(bounds[3], curveBounds[3]);
			}
			curve[0] = curve[6];
			curve[1] = curve[7];
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq 0xf0(%rsi), %rbp
testq %rbp, %rbp
je 0x3c1b9
movq %rdx, %rbx
movq %rdi, %r14
leaq 0x40(%rsp), %rax
movsd 0x30(%rax), %xmm4
movsd 0x38(%rax), %xmm5
movl $0x1, %eax
leaq 0x10(%rsp), %r12
movsd (%rbp), %xmm0
movsd 0x8(%rbp), %xmm1
movsd 0x10(%rbx), %xmm2
mulsd %xmm1, %xmm2
movsd (%rbx), %xmm3
mulsd %xmm0, %xmm3
addsd %xmm2, %xmm3
addsd 0x20(%rbx), %xmm3
movsd %xmm3, 0x40(%rsp)
mulsd 0x18(%rbx), %xmm1
mulsd 0x8(%rbx), %xmm0
addsd %xmm1, %xmm0
addsd 0x28(%rbx), %xmm0
movsd %xmm0, 0x48(%rsp)
movq 0x10(%rbp), %r13
testq %r13, %r13
je 0x3c1ac
testl %eax, %eax
sete %r15b
movl (%r13), %edx
cmpl $0x1, %edx
je 0x3bfe6
testl %edx, %edx
jne 0x3c181
movsd 0x8(%r13), %xmm5
movsd 0x10(%r13), %xmm1
movsd 0x10(%rbx), %xmm2
mulsd %xmm1, %xmm2
movsd (%rbx), %xmm4
mulsd %xmm5, %xmm4
addsd %xmm2, %xmm4
addsd 0x20(%rbx), %xmm4
movsd %xmm4, 0x70(%rsp)
mulsd 0x18(%rbx), %xmm1
mulsd 0x8(%rbx), %xmm5
addsd %xmm1, %xmm5
addsd 0x28(%rbx), %xmm5
movsd %xmm5, 0x78(%rsp)
movapd %xmm5, %xmm1
maxsd %xmm0, %xmm1
cmpunordsd %xmm0, %xmm0
movapd %xmm0, %xmm2
andpd %xmm5, %xmm2
andnpd %xmm1, %xmm0
orpd %xmm2, %xmm0
movlpd %xmm0, 0x10(%rsp)
jmp 0x3c0ec
movsd 0x18(%r13), %xmm5
movsd 0x20(%r13), %xmm4
movsd (%rbx), %xmm9
movsd 0x10(%rbx), %xmm0
movapd %xmm4, %xmm1
mulsd %xmm0, %xmm1
movapd %xmm5, %xmm2
mulsd %xmm9, %xmm2
addsd %xmm1, %xmm2
movsd 0x20(%rbx), %xmm3
addsd %xmm3, %xmm2
movsd %xmm2, 0x50(%rsp)
movsd 0x8(%rbx), %xmm2
movsd 0x18(%rbx), %xmm1
mulsd %xmm1, %xmm4
mulsd %xmm2, %xmm5
addsd %xmm4, %xmm5
movsd 0x28(%rbx), %xmm4
addsd %xmm4, %xmm5
movsd %xmm5, 0x58(%rsp)
movsd 0x28(%r13), %xmm5
movsd 0x30(%r13), %xmm6
movapd %xmm0, %xmm7
mulsd %xmm6, %xmm7
movapd %xmm5, %xmm8
mulsd %xmm9, %xmm8
addsd %xmm7, %xmm8
addsd %xmm3, %xmm8
movsd %xmm8, 0x60(%rsp)
mulsd %xmm1, %xmm6
mulsd %xmm2, %xmm5
addsd %xmm6, %xmm5
addsd %xmm4, %xmm5
movsd %xmm5, 0x68(%rsp)
movsd 0x8(%r13), %xmm6
movsd 0x10(%r13), %xmm5
mulsd %xmm5, %xmm0
mulsd %xmm6, %xmm9
addsd %xmm0, %xmm9
addsd %xmm3, %xmm9
movsd %xmm9, 0x8(%rsp)
movsd %xmm9, 0x70(%rsp)
mulsd %xmm5, %xmm1
mulsd %xmm2, %xmm6
addsd %xmm1, %xmm6
addsd %xmm4, %xmm6
movapd %xmm6, 0x30(%rsp)
movsd %xmm6, 0x78(%rsp)
movq %r12, %rdi
leaq 0x40(%rsp), %rsi
callq 0x3ba24
movapd 0x30(%rsp), %xmm5
movsd 0x8(%rsp), %xmm4
testb $0x1, %r15b
je 0x3c134
movsd (%r14), %xmm0
movsd 0x8(%r14), %xmm1
minsd 0x10(%rsp), %xmm0
movsd %xmm0, (%r14)
minsd 0x18(%rsp), %xmm1
movsd %xmm1, 0x8(%r14)
movsd 0x10(%r14), %xmm0
maxsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x10(%r14)
movsd 0x18(%r14), %xmm0
maxsd 0x28(%rsp), %xmm0
jmp 0x3c15d
movsd 0x10(%rsp), %xmm0
movsd %xmm0, (%r14)
movsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x8(%r14)
movsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x10(%r14)
movsd 0x28(%rsp), %xmm0
movsd %xmm0, 0x18(%r14)
movsd %xmm4, 0x40(%rsp)
movsd %xmm5, 0x48(%rsp)
movb $0x1, %r15b
movapd %xmm5, %xmm0
testq %r13, %r13
jne 0x3bf68
jmp 0x3c1aa
movq 0x15e10(%rip), %rax     # 0x51f98
movq (%rax), %rdi
leaq 0x4d2f(%rip), %rsi      # 0x40ec1
xorl %eax, %eax
movsd %xmm4, 0x8(%rsp)
movapd %xmm5, 0x30(%rsp)
callq 0x75e0
jmp 0x3c0e0
xorl %eax, %eax
movq 0x48(%rbp), %rbp
testq %rbp, %rbp
jne 0x3bf12
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq