// File: thierry7100[P]CutOptim/include/nanosvg.h
// Function: nsvg__addPath(NSVGparser*, char)
static void nsvg__addPath(NSVGparser* p, char closed)
{
	NSVGattrib* attr = nsvg__getAttr(p);
	NSVGpath* path = NULL;
	NSVGPathElt *sElt;
	NSVGPathElt *dElt, *oldElt;
	double bounds[4];
	double curve[8];
	double LastX, LastY;

	int i;

	if (p->nElts < 1)       //  No element in path !
		return;

	if (closed )
	{
        if ( fabs(p->LastElt->EndX - p->StartX) > NSVG_EPSILON || fabs(p->LastElt->EndY - p->StartY) > NSVG_EPSILON )
            nsvg__lineTo(p, p->StartX, p->StartY);      //  Add segment to first point if not yet in this point
	}
	else
	{
        //  Check for closed path, even if 'z' is not used, but start and end points are close
        if ( fabs(p->LastElt->EndX - p->StartX) < NSVG_EPSILON2 && fabs(p->LastElt->EndY - p->StartY) < NSVG_EPSILON2 )
        {
            nsvg__lineTo(p, p->StartX, p->StartY);      //  Add segment to first point
            closed = 1;
        }
	}
	//  Allocate path
	path = (NSVGpath*)malloc(sizeof(NSVGpath));
	if (path == NULL) goto error;
	memset(path, 0, sizeof(NSVGpath));
    //
    path->nElts = p->nElts;
    nsvg__xformPoint(&path->StartX, &path->StartY, p->StartX, p->StartY, attr->xform);
    oldElt = NULL;
    for (sElt = p->FirstElt; sElt != NULL; sElt = sElt->next)
    {
        dElt =(NSVGPathElt *)malloc(sizeof(NSVGPathElt));
        if ( dElt == NULL)
        {
            goto error;
        }
        //  Apply transform from parser to path
        dElt->Type = sElt->Type;
        nsvg__xformPoint(&dElt->EndX, &dElt->EndY, sElt->EndX, sElt->EndY, attr->xform);
        nsvg__xformPoint(&dElt->BzCtrl1X, &dElt->BzCtrl1Y, sElt->BzCtrl1X, sElt->BzCtrl1Y, attr->xform);
        nsvg__xformPoint(&dElt->BzCtrl2X, &dElt->BzCtrl2Y, sElt->BzCtrl2X, sElt->BzCtrl2Y, attr->xform);
        dElt->next = NULL;
        if ( oldElt != NULL)
            oldElt->next = dElt;
        else
            path->PathElts = dElt;
        oldElt = dElt;
    }
	path->closed = closed;

	// Find path bounds
	LastX = path->StartX;
	LastY = path->StartY;
	for (dElt = path->PathElts, i = 0; i < path->nElts; dElt = dElt->next, i++)
	{
        if ( dElt->Type == NSVG_PATH_LINE )
        {
            bounds[0] = nsvg__minf(LastX, dElt->EndX);
            bounds[1] = nsvg__minf(LastY, dElt->EndY);
            bounds[2] = nsvg__maxf(LastX, dElt->EndX);
            bounds[3] = nsvg__maxf(LastY, dElt->EndY);
        }
        else
        {
            curve[0] = LastX;
            curve[1] = LastY;
            curve[2] = dElt->BzCtrl1X;
            curve[3] = dElt->BzCtrl1Y;
            curve[4] = dElt->BzCtrl2X;
            curve[5] = dElt->BzCtrl2Y;
            curve[6] = dElt->EndX;
            curve[7] = dElt->EndY;
            path->hasBezier = true;
            nsvg__curveBounds(bounds, curve);
        }
		if (i == 0)
		{
			path->bounds[0] = bounds[0];
			path->bounds[1] = bounds[1];
			path->bounds[2] = bounds[2];
			path->bounds[3] = bounds[3];
		} else
		{
			path->bounds[0] = nsvg__minf(path->bounds[0], bounds[0]);
			path->bounds[1] = nsvg__minf(path->bounds[1], bounds[1]);
			path->bounds[2] = nsvg__maxf(path->bounds[2], bounds[2]);
			path->bounds[3] = nsvg__maxf(path->bounds[3], bounds[3]);
		}
	}

	path->next = p->plist;
	p->plist = path;

	return;

error:
	if (path != NULL) {
		if (path->PathElts != NULL) nsvg__deletePathElts(path->PathElts);
		free(path);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movb %sil, %al
movq %rdi, -0x8(%rbp)
movb %al, -0x9(%rbp)
movq -0x8(%rbp), %rdi
callq 0x7a330
movq %rax, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x1, 0xd028(%rax)
jge 0x7d6ec
jmp 0x7dc23
cmpb $0x0, -0x9(%rbp)
je 0x7d786
movq -0x8(%rbp), %rax
movq 0xd010(%rax), %rax
movsd 0x8(%rax), %xmm0
movq -0x8(%rbp), %rax
subsd 0xd018(%rax), %xmm0
movaps 0x6997(%rip), %xmm1     # 0x840b0
pand %xmm1, %xmm0
movsd 0x6b33(%rip), %xmm1     # 0x84258
ucomisd %xmm1, %xmm0
ja 0x7d760
movq -0x8(%rbp), %rax
movq 0xd010(%rax), %rax
movsd 0x10(%rax), %xmm0
movq -0x8(%rbp), %rax
subsd 0xd020(%rax), %xmm0
movaps 0x6962(%rip), %xmm1     # 0x840b0
pand %xmm1, %xmm0
movsd 0x6afe(%rip), %xmm1     # 0x84258
ucomisd %xmm1, %xmm0
jbe 0x7d781
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movsd 0xd018(%rax), %xmm0
movq -0x8(%rbp), %rax
movsd 0xd020(%rax), %xmm1
callq 0x7e230
jmp 0x7d817
movq -0x8(%rbp), %rax
movq 0xd010(%rax), %rax
movsd 0x8(%rax), %xmm1
movq -0x8(%rbp), %rax
subsd 0xd018(%rax), %xmm1
movaps 0x6907(%rip), %xmm0     # 0x840b0
pand %xmm0, %xmm1
movsd 0x6923(%rip), %xmm0     # 0x840d8
ucomisd %xmm1, %xmm0
jbe 0x7d815
movq -0x8(%rbp), %rax
movq 0xd010(%rax), %rax
movsd 0x10(%rax), %xmm1
movq -0x8(%rbp), %rax
subsd 0xd020(%rax), %xmm1
movaps 0x68d2(%rip), %xmm0     # 0x840b0
pand %xmm0, %xmm1
movsd 0x68ee(%rip), %xmm0     # 0x840d8
ucomisd %xmm1, %xmm0
jbe 0x7d815
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movsd 0xd018(%rax), %xmm0
movq -0x8(%rbp), %rax
movsd 0xd020(%rax), %xmm1
callq 0x7e230
movb $0x1, -0x9(%rbp)
jmp 0x7d817
movl $0xf8, %edi
callq 0x9730
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x7d831
jmp 0x7dbfb
movq -0x20(%rbp), %rdi
xorl %esi, %esi
movl $0xf8, %edx
callq 0x92f0
movq -0x8(%rbp), %rax
movl 0xd028(%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x20(%rbp), %rdi
movq -0x20(%rbp), %rsi
addq $0x8, %rsi
movq -0x8(%rbp), %rax
movsd 0xd018(%rax), %xmm0
movq -0x8(%rbp), %rax
movsd 0xd020(%rax), %xmm1
movq -0x18(%rbp), %rdx
addq $0x40, %rdx
callq 0x7e4f0
movq $0x0, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq 0xd008(%rax), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x7d99e
movl $0x40, %edi
callq 0x9730
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x7d8bf
jmp 0x7dbfb
movq -0x28(%rbp), %rax
movl (%rax), %ecx
movq -0x30(%rbp), %rax
movl %ecx, (%rax)
movq -0x30(%rbp), %rdi
addq $0x8, %rdi
movq -0x30(%rbp), %rsi
addq $0x10, %rsi
movq -0x28(%rbp), %rax
movsd 0x8(%rax), %xmm0
movq -0x28(%rbp), %rax
movsd 0x10(%rax), %xmm1
movq -0x18(%rbp), %rdx
addq $0x40, %rdx
callq 0x7e4f0
movq -0x30(%rbp), %rdi
addq $0x18, %rdi
movq -0x30(%rbp), %rsi
addq $0x20, %rsi
movq -0x28(%rbp), %rax
movsd 0x18(%rax), %xmm0
movq -0x28(%rbp), %rax
movsd 0x20(%rax), %xmm1
movq -0x18(%rbp), %rdx
addq $0x40, %rdx
callq 0x7e4f0
movq -0x30(%rbp), %rdi
addq $0x28, %rdi
movq -0x30(%rbp), %rsi
addq $0x30, %rsi
movq -0x28(%rbp), %rax
movsd 0x28(%rax), %xmm0
movq -0x28(%rbp), %rax
movsd 0x30(%rax), %xmm1
movq -0x18(%rbp), %rdx
addq $0x40, %rdx
callq 0x7e4f0
movq -0x30(%rbp), %rax
movq $0x0, 0x38(%rax)
cmpq $0x0, -0x38(%rbp)
je 0x7d979
movq -0x30(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x38(%rax)
jmp 0x7d985
movq -0x30(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x30(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x7d89a
movsbl -0x9(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x1c(%rax)
movq -0x20(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0xa8(%rbp)
movq -0x20(%rbp), %rax
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0xb0(%rbp)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x30(%rbp)
movl $0x0, -0xb4(%rbp)
movl -0xb4(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x18(%rcx), %eax
jge 0x7dbd7
movq -0x30(%rbp), %rax
cmpl $0x0, (%rax)
jne 0x7da6d
movsd -0xa8(%rbp), %xmm0
movq -0x30(%rbp), %rax
movsd 0x8(%rax), %xmm1
callq 0x7e6c0
movsd %xmm0, -0x60(%rbp)
movsd -0xb0(%rbp), %xmm0
movq -0x30(%rbp), %rax
movsd 0x10(%rax), %xmm1
callq 0x7e6c0
movsd %xmm0, -0x58(%rbp)
movsd -0xa8(%rbp), %xmm0
movq -0x30(%rbp), %rax
movsd 0x8(%rax), %xmm1
callq 0x7e700
movsd %xmm0, -0x50(%rbp)
movsd -0xb0(%rbp), %xmm0
movq -0x30(%rbp), %rax
movsd 0x10(%rax), %xmm1
callq 0x7e700
movsd %xmm0, -0x48(%rbp)
jmp 0x7db02
movsd -0xa8(%rbp), %xmm0
movsd %xmm0, -0xa0(%rbp)
movsd -0xb0(%rbp), %xmm0
movsd %xmm0, -0x98(%rbp)
movq -0x30(%rbp), %rax
movsd 0x18(%rax), %xmm0
movsd %xmm0, -0x90(%rbp)
movq -0x30(%rbp), %rax
movsd 0x20(%rax), %xmm0
movsd %xmm0, -0x88(%rbp)
movq -0x30(%rbp), %rax
movsd 0x28(%rax), %xmm0
movsd %xmm0, -0x80(%rbp)
movq -0x30(%rbp), %rax
movsd 0x30(%rax), %xmm0
movsd %xmm0, -0x78(%rbp)
movq -0x30(%rbp), %rax
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0x70(%rbp)
movq -0x30(%rbp), %rax
movsd 0x10(%rax), %xmm0
movsd %xmm0, -0x68(%rbp)
movq -0x20(%rbp), %rax
movl $0x1, 0x20(%rax)
leaq -0x60(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x7e740
cmpl $0x0, -0xb4(%rbp)
jne 0x7db45
movsd -0x60(%rbp), %xmm0
movq -0x20(%rbp), %rax
movsd %xmm0, 0x28(%rax)
movsd -0x58(%rbp), %xmm0
movq -0x20(%rbp), %rax
movsd %xmm0, 0x30(%rax)
movsd -0x50(%rbp), %xmm0
movq -0x20(%rbp), %rax
movsd %xmm0, 0x38(%rax)
movsd -0x48(%rbp), %xmm0
movq -0x20(%rbp), %rax
movsd %xmm0, 0x40(%rax)
jmp 0x7dbb5
movq -0x20(%rbp), %rax
movsd 0x28(%rax), %xmm0
movsd -0x60(%rbp), %xmm1
callq 0x7e6c0
movq -0x20(%rbp), %rax
movsd %xmm0, 0x28(%rax)
movq -0x20(%rbp), %rax
movsd 0x30(%rax), %xmm0
movsd -0x58(%rbp), %xmm1
callq 0x7e6c0
movq -0x20(%rbp), %rax
movsd %xmm0, 0x30(%rax)
movq -0x20(%rbp), %rax
movsd 0x38(%rax), %xmm0
movsd -0x50(%rbp), %xmm1
callq 0x7e700
movq -0x20(%rbp), %rax
movsd %xmm0, 0x38(%rax)
movq -0x20(%rbp), %rax
movsd 0x40(%rax), %xmm0
movsd -0x48(%rbp), %xmm1
callq 0x7e700
movq -0x20(%rbp), %rax
movsd %xmm0, 0x40(%rax)
jmp 0x7dbb7
movq -0x30(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x30(%rbp)
movl -0xb4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb4(%rbp)
jmp 0x7d9e0
movq -0x8(%rbp), %rax
movq 0xd030(%rax), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x20(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xd030(%rax)
jmp 0x7dc23
cmpq $0x0, -0x20(%rbp)
je 0x7dc23
movq -0x20(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x7dc1a
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x7e1f0
movq -0x20(%rbp), %rdi
callq 0x9690
addq $0xc0, %rsp
popq %rbp
retq
nopl (%rax)