// File: /workspace/github_cpp_makefile_star2_O3/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 $0x78, %rsp
movq 0xf0(%rsi), %rcx
testq %rcx, %rcx
je 0x3af6e
movq %rdx, %rbx
movq %rdi, %r14
movupd (%rdx), %xmm1
movupd 0x10(%rdx), %xmm2
movupd 0x20(%rdx), %xmm0
movq %rcx, %rax
movq 0x10(%rcx), %rbp
testq %rbp, %rbp
jne 0x3af7d
movq 0x48(%rax), %rcx
testq %rcx, %rcx
jne 0x3af32
movsd (%rax), %xmm3
movsd 0x8(%rax), %xmm4
unpcklpd %xmm4, %xmm4            # xmm4 = xmm4[0,0]
mulpd %xmm2, %xmm4
unpcklpd %xmm3, %xmm3            # xmm3 = xmm3[0,0]
mulpd %xmm1, %xmm3
addpd %xmm4, %xmm3
addpd %xmm3, %xmm0
movapd %xmm0, 0x30(%rsp)
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movsd (%rax), %xmm3
movsd 0x8(%rax), %xmm4
unpcklpd %xmm4, %xmm4            # xmm4 = xmm4[0,0]
mulpd %xmm2, %xmm4
unpcklpd %xmm3, %xmm3            # xmm3 = xmm3[0,0]
mulpd %xmm1, %xmm3
addpd %xmm4, %xmm3
addpd %xmm3, %xmm0
leaq 0x30(%rsp), %r15
movapd %xmm0, (%r15)
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
xorl %r13d, %r13d
leaq 0x10(%rsp), %r12
movl (%rbp), %edx
cmpl $0x1, %edx
je 0x3b02a
testl %edx, %edx
jne 0x3b132
movsd 0x8(%rbp), %xmm4
movsd 0x10(%rbp), %xmm1
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
movupd (%rbx), %xmm2
movupd 0x10(%rbx), %xmm3
mulpd %xmm1, %xmm3
movupd 0x20(%rbx), %xmm1
unpcklpd %xmm4, %xmm4            # xmm4 = xmm4[0,0]
mulpd %xmm2, %xmm4
addpd %xmm3, %xmm4
addpd %xmm1, %xmm4
movapd %xmm4, 0x60(%rsp)
movapd %xmm4, %xmm1
unpckhpd %xmm4, %xmm1            # xmm1 = xmm1[1],xmm4[1]
movapd %xmm0, %xmm2
cmpunordsd %xmm0, %xmm2
movapd %xmm2, %xmm3
andpd %xmm1, %xmm3
maxsd %xmm0, %xmm1
andnpd %xmm1, %xmm2
orpd %xmm3, %xmm2
movlpd %xmm2, 0x10(%rsp)
jmp 0x3b0c5
movupd (%rbx), %xmm1
movupd 0x10(%rbx), %xmm3
movupd 0x20(%rbx), %xmm0
movsd 0x8(%rbp), %xmm7
movsd 0x10(%rbp), %xmm2
movsd 0x18(%rbp), %xmm4
movsd 0x20(%rbp), %xmm5
unpcklpd %xmm5, %xmm5            # xmm5 = xmm5[0,0]
mulpd %xmm3, %xmm5
unpcklpd %xmm4, %xmm4            # xmm4 = xmm4[0,0]
mulpd %xmm1, %xmm4
addpd %xmm5, %xmm4
addpd %xmm0, %xmm4
movsd 0x30(%rbp), %xmm5
movsd 0x28(%rbp), %xmm6
movapd %xmm4, 0x40(%rsp)
unpcklpd %xmm5, %xmm5            # xmm5 = xmm5[0,0]
mulpd %xmm3, %xmm5
unpcklpd %xmm6, %xmm6            # xmm6 = xmm6[0,0]
mulpd %xmm1, %xmm6
addpd %xmm5, %xmm6
addpd %xmm0, %xmm6
movapd %xmm6, 0x50(%rsp)
unpcklpd %xmm2, %xmm2            # xmm2 = xmm2[0,0]
mulpd %xmm3, %xmm2
unpcklpd %xmm7, %xmm7            # xmm7 = xmm7[0,0]
mulpd %xmm1, %xmm7
addpd %xmm2, %xmm7
addpd %xmm0, %xmm7
movapd %xmm7, (%rsp)
movapd %xmm7, 0x60(%rsp)
movq %r12, %rdi
movq %r15, %rsi
callq 0x3aa33
movapd (%rsp), %xmm4
testb $0x1, %r13b
je 0x3b0fb
movupd (%r14), %xmm0
minpd 0x10(%rsp), %xmm0
movupd %xmm0, (%r14)
movsd 0x10(%r14), %xmm0
maxsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x10(%r14)
movsd 0x18(%r14), %xmm0
maxsd 0x28(%rsp), %xmm0
jmp 0x3b116
movaps 0x10(%rsp), %xmm0
movups %xmm0, (%r14)
movsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x10(%r14)
movsd 0x28(%rsp), %xmm0
movsd %xmm0, 0x18(%r14)
movapd %xmm4, 0x30(%rsp)
movapd %xmm4, %xmm0
unpckhpd %xmm4, %xmm0            # xmm0 = xmm0[1],xmm4[1]
movb $0x1, %r13b
jmp 0x3afb4
movq 0x15e5f(%rip), %rax     # 0x50f98
movq (%rax), %rdi
leaq 0x4e02(%rip), %rsi      # 0x3ff45
xorl %eax, %eax
movapd %xmm4, (%rsp)
callq 0x75f0
jmp 0x3b0c0