// File: /workspace/github_cpp_makefile_star2_O2/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 %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
addq $0xf0, %r14
leaq 0x60(%rsp), %rbp
leaq 0x68(%rsp), %r12
movq (%r14), %r14
testq %r14, %r14
je 0x32cb9
movsd (%r14), %xmm0
movsd 0x8(%r14), %xmm1
leaq 0x30(%rsp), %rdi
leaq 0x38(%rsp), %rsi
movq %rbx, %rdx
callq 0x3262b
movq %r14, 0x28(%rsp)
movq 0x10(%r14), %r13
xorl %r14d, %r14d
testq %r13, %r13
je 0x32cab
movl (%r13), %edx
cmpl $0x1, %edx
je 0x32bc4
testl %edx, %edx
jne 0x32c8e
movsd 0x8(%r13), %xmm0
movsd 0x10(%r13), %xmm1
movq %rbp, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x3262b
movsd 0x38(%rsp), %xmm0
movsd 0x68(%rsp), %xmm1
callq 0x8560
movsd %xmm0, (%rsp)
jmp 0x32c27
movsd 0x18(%r13), %xmm0
movsd 0x20(%r13), %xmm1
leaq 0x40(%rsp), %rdi
leaq 0x48(%rsp), %rsi
movq %rbx, %rdx
callq 0x3262b
movsd 0x28(%r13), %xmm0
movsd 0x30(%r13), %xmm1
leaq 0x50(%rsp), %rdi
leaq 0x58(%rsp), %rsi
movq %rbx, %rdx
callq 0x3262b
movsd 0x8(%r13), %xmm0
movsd 0x10(%r13), %xmm1
movq %rbp, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x3262b
movq %rsp, %rdi
leaq 0x30(%rsp), %rsi
callq 0x32661
testb $0x1, %r14b
je 0x32c5c
movupd (%r15), %xmm0
minpd (%rsp), %xmm0
movupd %xmm0, (%r15)
movsd 0x10(%r15), %xmm0
maxsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x10(%r15)
movsd 0x18(%r15), %xmm0
maxsd 0x18(%rsp), %xmm0
jmp 0x32c76
movaps (%rsp), %xmm0
movups %xmm0, (%r15)
movsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x10(%r15)
movsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x18(%r15)
movaps 0x60(%rsp), %xmm0
movaps %xmm0, 0x30(%rsp)
movb $0x1, %r14b
jmp 0x32b78
movq 0x1a30b(%rip), %rax     # 0x4cfa0
movq (%rax), %rdi
leaq 0x5266(%rip), %rsi      # 0x37f05
xorl %eax, %eax
callq 0x8610
jmp 0x32c27
movq 0x28(%rsp), %r14
addq $0x48, %r14
jmp 0x32b43
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq