// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
cmpl $0x0, 0xd028(%rdi)
jle 0x3209d
movq %rdi, %r12
movslq 0xd000(%rdi), %r15
movq 0xd010(%rdi), %rax
movsd 0x8(%rax), %xmm1
movsd 0xd018(%rdi), %xmm0
subsd %xmm0, %xmm1
andpd 0x422d(%rip), %xmm1     # 0x36030
pushq $0x1
popq %rbx
testb %sil, %sil
je 0x31e21
ucomisd 0x447d(%rip), %xmm1     # 0x36290
jbe 0x31e54
movsd 0xd020(%r12), %xmm1
jmp 0x31e79
xorl %ebp, %ebp
movsd 0x4235(%rip), %xmm2     # 0x36060
ucomisd %xmm1, %xmm2
jbe 0x31e83
movsd 0x10(%rax), %xmm3
movsd 0xd020(%r12), %xmm1
subsd %xmm1, %xmm3
andpd 0x41e4(%rip), %xmm3     # 0x36030
ucomisd %xmm3, %xmm2
ja 0x31e79
jmp 0x31e83
movsd 0x10(%rax), %xmm2
movsd 0xd020(%r12), %xmm1
subsd %xmm1, %xmm2
andpd 0x41c1(%rip), %xmm2     # 0x36030
ucomisd 0x4419(%rip), %xmm2     # 0x36290
jbe 0x31e81
movq %r12, %rdi
callq 0x32472
movl %ebx, %ebp
pushq $0x1
popq %rdi
movl $0xf8, %esi
callq 0x82f0
testq %rax, %rax
je 0x3209d
movq %rax, %r14
movl %ebp, (%rsp)
movl 0xd028(%r12), %eax
movl %eax, 0x18(%r14)
leaq 0x8(%r14), %rsi
movsd 0xd018(%r12), %xmm0
movsd 0xd020(%r12), %xmm1
imulq $0x1a0, %r15, %rax      # imm = 0x1A0
leaq (%r12,%rax), %r15
addq $0x40, %r15
movq %r14, %rdi
movq %r15, %rdx
callq 0x3262b
movq %r12, 0x38(%rsp)
leaq 0xd008(%r12), %rbx
movq %r14, %rbp
addq $0x10, %rbp
xorl %r12d, %r12d
movq (%rbx), %rbx
testq %rbx, %rbx
je 0x31f8b
pushq $0x40
popq %rdi
callq 0x85b0
testq %rax, %rax
je 0x320af
movq %rax, %r13
movl (%rbx), %eax
movl %eax, (%r13)
leaq 0x8(%r13), %rdi
leaq 0x10(%r13), %rsi
movsd 0x8(%rbx), %xmm0
movsd 0x10(%rbx), %xmm1
movq %r15, %rdx
callq 0x3262b
leaq 0x18(%r13), %rdi
leaq 0x20(%r13), %rsi
movsd 0x18(%rbx), %xmm0
movsd 0x20(%rbx), %xmm1
movq %r15, %rdx
callq 0x3262b
leaq 0x28(%r13), %rdi
movq %r13, %rsi
addq $0x30, %rsi
movsd 0x28(%rbx), %xmm0
movsd 0x30(%rbx), %xmm1
movq %r15, %rdx
callq 0x3262b
andq $0x0, 0x38(%r13)
leaq 0x38(%r12), %rax
testq %r12, %r12
cmoveq %rbp, %rax
movq %r13, (%rax)
addq $0x38, %rbx
movq %r13, %r12
jmp 0x31ef4
movl (%rsp), %eax
movl %eax, 0x1c(%r14)
movupd (%r14), %xmm0
movapd %xmm0, (%rsp)
movl 0x18(%r14), %ebx
xorl %r13d, %r13d
leaq 0x10(%rsp), %r15
leaq 0x40(%rsp), %r12
cmpl %ebx, %r13d
jge 0x32086
movq (%rbp), %rbp
cmpl $0x0, (%rbp)
je 0x31ffb
movaps (%rsp), %xmm0
movaps %xmm0, 0x40(%rsp)
movups 0x18(%rbp), %xmm0
movaps %xmm0, 0x50(%rsp)
movups 0x28(%rbp), %xmm0
movaps %xmm0, 0x60(%rsp)
movupd 0x8(%rbp), %xmm0
movapd %xmm0, 0x70(%rsp)
movl $0x1, 0x20(%r14)
movq %r15, %rdi
movq %r12, %rsi
callq 0x32661
jmp 0x32021
movupd 0x8(%rbp), %xmm0
movapd (%rsp), %xmm2
movapd %xmm2, %xmm1
minpd %xmm0, %xmm1
movapd %xmm1, 0x10(%rsp)
movapd %xmm2, %xmm1
maxpd %xmm0, %xmm1
movapd %xmm1, 0x20(%rsp)
testl %r13d, %r13d
je 0x32058
movupd 0x28(%r14), %xmm0
minpd 0x10(%rsp), %xmm0
movupd %xmm0, 0x28(%r14)
movsd 0x38(%r14), %xmm0
maxsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x38(%r14)
movsd 0x40(%r14), %xmm0
maxsd 0x28(%rsp), %xmm0
jmp 0x32074
movaps 0x10(%rsp), %xmm0
movups %xmm0, 0x28(%r14)
movsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x38(%r14)
movsd 0x28(%rsp), %xmm0
movsd %xmm0, 0x40(%r14)
addq $0x38, %rbp
incl %r13d
jmp 0x31fad
movq 0x38(%rsp), %rcx
movq 0xd030(%rcx), %rax
movq %rax, 0x48(%r14)
movq %r14, 0xd030(%rcx)
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%rbp), %rdi
testq %rdi, %rdi
je 0x320bd
callq 0x3245c
movq %r14, %rdi
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x8530