// File: thierry7100[P]CutOptim/include/nanosvg.h
// Function: nsvg__parsePath(NSVGparser*, char const**)
static void nsvg__parsePath(NSVGparser* p, const char** attr)
{
	const char* s = NULL;
	char cmd = '\0';
	double args[10];
	int nargs;
	int rargs = 0;
	double cpx, cpy, cpx2, cpy2;
	const char* tmp[4];
	char closedFlag;
	int i;
	char item[64];

	for (i = 0; attr[i]; i += 2) {
		if (strcmp(attr[i], "d") == 0) {
			s = attr[i + 1];
		} else {
			tmp[0] = attr[i];
			tmp[1] = attr[i + 1];
			tmp[2] = 0;
			tmp[3] = 0;
			nsvg__parseAttribs(p, tmp);
		}
	}

	if (s) {
		nsvg__resetPath(p);
		cpx = 0; cpy = 0;
		cpx2 = 0; cpy2 = 0;
		closedFlag = 0;
		nargs = 0;

		while (*s) {
			s = nsvg__getNextPathItem(s, item);
			if (!*item) break;
			if (nsvg__isnum(item[0])) {
				if (nargs < 10)
					args[nargs++] = (double)nsvg__atof(item);
				if (nargs >= rargs) {
					switch (cmd) {
						case 'm':
						case 'M':
							nsvg__pathMoveTo(p, &cpx, &cpy, args, cmd == 'm' ? 1 : 0);
							// Moveto can be followed by multiple coordinate pairs,
							// which should be treated as linetos.
							cmd = (cmd == 'm') ? 'l' : 'L';
							rargs = nsvg__getArgsPerElement(cmd);
							cpx2 = cpx; cpy2 = cpy;
							break;
						case 'l':
						case 'L':
							nsvg__pathLineTo(p, &cpx, &cpy, args, cmd == 'l' ? 1 : 0);
							cpx2 = cpx; cpy2 = cpy;
							break;
						case 'H':
						case 'h':
							nsvg__pathHLineTo(p, &cpx, &cpy, args, cmd == 'h' ? 1 : 0);
							cpx2 = cpx; cpy2 = cpy;
							break;
						case 'V':
						case 'v':
							nsvg__pathVLineTo(p, &cpx, &cpy, args, cmd == 'v' ? 1 : 0);
							cpx2 = cpx; cpy2 = cpy;
							break;
						case 'C':
						case 'c':
							nsvg__pathCubicBezTo(p, &cpx, &cpy, &cpx2, &cpy2, args, cmd == 'c' ? 1 : 0);
							break;
						case 'S':
						case 's':
							nsvg__pathCubicBezShortTo(p, &cpx, &cpy, &cpx2, &cpy2, args, cmd == 's' ? 1 : 0);
							break;
						case 'Q':
						case 'q':
							nsvg__pathQuadBezTo(p, &cpx, &cpy, &cpx2, &cpy2, args, cmd == 'q' ? 1 : 0);
							break;
						case 'T':
						case 't':
							nsvg__pathQuadBezShortTo(p, &cpx, &cpy, &cpx2, &cpy2, args, cmd == 't' ? 1 : 0);
							break;
						case 'A':
						case 'a':
							nsvg__pathArcTo(p, &cpx, &cpy, args, cmd == 'a' ? 1 : 0);
							cpx2 = cpx; cpy2 = cpy;
							break;
						default:
							if (nargs >= 2) {
								cpx = args[nargs-2];
								cpy = args[nargs-1];
								cpx2 = cpx; cpy2 = cpy;
							}
							break;
					}
					nargs = 0;
				}
			} else {
				cmd = item[0];
				rargs = nsvg__getArgsPerElement(cmd);
				if (cmd == 'M' || cmd == 'm') {
					// Commit path.
					if (p->nElts > 0)
						nsvg__addPath(p, closedFlag);
					// Start new subpath.
					nsvg__resetPath(p);
					closedFlag = 0;
					nargs = 0;
				} else if (cmd == 'Z' || cmd == 'z') {
					closedFlag = 1;
					// Commit path.
					if (p->nElts > 0) {
						// Move current point to first point
						cpx = p->StartX;
						cpy = p->StartY;
						cpx2 = cpx; cpy2 = cpy;
						nsvg__addPath(p, closedFlag);
					}
					// Start new subpath.
					nsvg__resetPath(p);
					nsvg__moveTo(p, cpx, cpy);
					closedFlag = 0;
					nargs = 0;
				}
			}
		}
		// Commit path.
		if (p->nElts)
			nsvg__addPath(p, closedFlag);
	}

	nsvg__addShape(p);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movb $0x0, -0x19(%rbp)
movl $0x0, -0x78(%rbp)
movl $0x0, -0xc8(%rbp)
movq -0x10(%rbp), %rax
movslq -0xc8(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0x77cfd
movq -0x10(%rbp), %rax
movslq -0xc8(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xe23e(%rip), %rsi      # 0x85eaa
callq 0x9770
cmpl $0x0, %eax
jne 0x77c90
movq -0x10(%rbp), %rax
movl -0xc8(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x18(%rbp)
jmp 0x77ce7
movq -0x10(%rbp), %rax
movslq -0xc8(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xc0(%rbp)
movq -0x10(%rbp), %rax
movl -0xc8(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xb8(%rbp)
movq $0x0, -0xb0(%rbp)
movq $0x0, -0xa8(%rbp)
movq -0x8(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x77b70
jmp 0x77ce9
movl -0xc8(%rbp), %eax
addl $0x2, %eax
movl %eax, -0xc8(%rbp)
jmp 0x77c40
cmpq $0x0, -0x18(%rbp)
je 0x7822c
movq -0x8(%rbp), %rdi
callq 0x7c0d0
xorps %xmm0, %xmm0
movsd %xmm0, -0x80(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x88(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x90(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x98(%rbp)
movb $0x0, -0xc1(%rbp)
movl $0x0, -0x74(%rbp)
movq -0x18(%rbp), %rax
cmpb $0x0, (%rax)
je 0x7820d
movq -0x18(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x7c120
movq %rax, -0x18(%rbp)
cmpb $0x0, -0x110(%rbp)
jne 0x77d77
jmp 0x7820d
movsbl -0x110(%rbp), %edi
callq 0x7c230
cmpl $0x0, %eax
je 0x780fb
cmpl $0xa, -0x74(%rbp)
jge 0x77db1
leaq -0x110(%rbp), %rdi
callq 0x7aed0
movl -0x74(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x74(%rbp)
cltq
movsd %xmm0, -0x70(%rbp,%rax,8)
movl -0x74(%rbp), %eax
cmpl -0x78(%rbp), %eax
jl 0x780f6
movsbl -0x19(%rbp), %eax
addl $-0x41, %eax
movl %eax, %ecx
movq %rcx, -0x118(%rbp)
subl $0x35, %eax
ja 0x780a1
movq -0x118(%rbp), %rax
leaq 0xc4c8(%rip), %rcx      # 0x842ac
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x8(%rbp), %rdi
leaq -0x70(%rbp), %rcx
movsbl -0x19(%rbp), %edx
xorl %r8d, %r8d
movl $0x1, %eax
cmpl $0x6d, %edx
cmovel %eax, %r8d
leaq -0x80(%rbp), %rsi
leaq -0x88(%rbp), %rdx
callq 0x7c260
movsbl -0x19(%rbp), %ecx
movb $0x6c, %al
movb $0x4c, %dl
movb %dl, -0x11a(%rbp)
cmpl $0x6d, %ecx
movb %al, -0x119(%rbp)
je 0x77e3d
movb -0x11a(%rbp), %al
movb %al, -0x119(%rbp)
movb -0x119(%rbp), %al
movb %al, -0x19(%rbp)
movsbl -0x19(%rbp), %edi
callq 0x7c2f0
movl %eax, -0x78(%rbp)
movsd -0x80(%rbp), %xmm0
movsd %xmm0, -0x90(%rbp)
movsd -0x88(%rbp), %xmm0
movsd %xmm0, -0x98(%rbp)
jmp 0x780ef
movq -0x8(%rbp), %rdi
leaq -0x70(%rbp), %rcx
movsbl -0x19(%rbp), %edx
xorl %r8d, %r8d
movl $0x1, %eax
cmpl $0x6c, %edx
cmovel %eax, %r8d
leaq -0x80(%rbp), %rsi
leaq -0x88(%rbp), %rdx
callq 0x7c360
movsd -0x80(%rbp), %xmm0
movsd %xmm0, -0x90(%rbp)
movsd -0x88(%rbp), %xmm0
movsd %xmm0, -0x98(%rbp)
jmp 0x780ef
movq -0x8(%rbp), %rdi
leaq -0x70(%rbp), %rcx
movsbl -0x19(%rbp), %edx
xorl %r8d, %r8d
movl $0x1, %eax
cmpl $0x68, %edx
cmovel %eax, %r8d
leaq -0x80(%rbp), %rsi
leaq -0x88(%rbp), %rdx
callq 0x7c3f0
movsd -0x80(%rbp), %xmm0
movsd %xmm0, -0x90(%rbp)
movsd -0x88(%rbp), %xmm0
movsd %xmm0, -0x98(%rbp)
jmp 0x780ef
movq -0x8(%rbp), %rdi
leaq -0x70(%rbp), %rcx
movsbl -0x19(%rbp), %edx
xorl %r8d, %r8d
movl $0x1, %eax
cmpl $0x76, %edx
cmovel %eax, %r8d
leaq -0x80(%rbp), %rsi
leaq -0x88(%rbp), %rdx
callq 0x7c460
movsd -0x80(%rbp), %xmm0
movsd %xmm0, -0x90(%rbp)
movsd -0x88(%rbp), %xmm0
movsd %xmm0, -0x98(%rbp)
jmp 0x780ef
movq -0x8(%rbp), %rdi
leaq -0x70(%rbp), %r9
movsbl -0x19(%rbp), %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x63, %edx
cmovel %ecx, %eax
leaq -0x80(%rbp), %rsi
leaq -0x88(%rbp), %rdx
leaq -0x90(%rbp), %rcx
leaq -0x98(%rbp), %r8
movl %eax, (%rsp)
callq 0x7c4d0
jmp 0x780ef
movq -0x8(%rbp), %rdi
leaq -0x70(%rbp), %r9
movsbl -0x19(%rbp), %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x73, %edx
cmovel %ecx, %eax
leaq -0x80(%rbp), %rsi
leaq -0x88(%rbp), %rdx
leaq -0x90(%rbp), %rcx
leaq -0x98(%rbp), %r8
movl %eax, (%rsp)
callq 0x7c640
jmp 0x780ef
movq -0x8(%rbp), %rdi
leaq -0x70(%rbp), %r9
movsbl -0x19(%rbp), %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x71, %edx
cmovel %ecx, %eax
leaq -0x80(%rbp), %rsi
leaq -0x88(%rbp), %rdx
leaq -0x90(%rbp), %rcx
leaq -0x98(%rbp), %r8
movl %eax, (%rsp)
callq 0x7c7e0
jmp 0x780ef
movq -0x8(%rbp), %rdi
leaq -0x70(%rbp), %r9
movsbl -0x19(%rbp), %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x74, %edx
cmovel %ecx, %eax
leaq -0x80(%rbp), %rsi
leaq -0x88(%rbp), %rdx
leaq -0x90(%rbp), %rcx
leaq -0x98(%rbp), %r8
movl %eax, (%rsp)
callq 0x7c9b0
jmp 0x780ef
movq -0x8(%rbp), %rdi
leaq -0x70(%rbp), %rcx
movsbl -0x19(%rbp), %edx
xorl %r8d, %r8d
movl $0x1, %eax
cmpl $0x61, %edx
cmovel %eax, %r8d
leaq -0x80(%rbp), %rsi
leaq -0x88(%rbp), %rdx
callq 0x7cba0
movsd -0x80(%rbp), %xmm0
movsd %xmm0, -0x90(%rbp)
movsd -0x88(%rbp), %xmm0
movsd %xmm0, -0x98(%rbp)
jmp 0x780ef
cmpl $0x2, -0x74(%rbp)
jl 0x780ed
movl -0x74(%rbp), %eax
subl $0x2, %eax
cltq
movsd -0x70(%rbp,%rax,8), %xmm0
movsd %xmm0, -0x80(%rbp)
movl -0x74(%rbp), %eax
subl $0x1, %eax
cltq
movsd -0x70(%rbp,%rax,8), %xmm0
movsd %xmm0, -0x88(%rbp)
movsd -0x80(%rbp), %xmm0
movsd %xmm0, -0x90(%rbp)
movsd -0x88(%rbp), %xmm0
movsd %xmm0, -0x98(%rbp)
jmp 0x780ef
movl $0x0, -0x74(%rbp)
jmp 0x78208
movb -0x110(%rbp), %al
movb %al, -0x19(%rbp)
movsbl -0x19(%rbp), %edi
callq 0x7c2f0
movl %eax, -0x78(%rbp)
movsbl -0x19(%rbp), %eax
cmpl $0x4d, %eax
je 0x78122
movsbl -0x19(%rbp), %eax
cmpl $0x6d, %eax
jne 0x7815b
movq -0x8(%rbp), %rax
cmpl $0x0, 0xd028(%rax)
jle 0x7813f
movq -0x8(%rbp), %rdi
movsbl -0xc1(%rbp), %esi
callq 0x7d6b0
movq -0x8(%rbp), %rdi
callq 0x7c0d0
movb $0x0, -0xc1(%rbp)
movl $0x0, -0x74(%rbp)
jmp 0x78206
movsbl -0x19(%rbp), %eax
cmpl $0x5a, %eax
je 0x78171
movsbl -0x19(%rbp), %eax
cmpl $0x7a, %eax
jne 0x78204
movb $0x1, -0xc1(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x0, 0xd028(%rax)
jle 0x781d7
movq -0x8(%rbp), %rax
movsd 0xd018(%rax), %xmm0
movsd %xmm0, -0x80(%rbp)
movq -0x8(%rbp), %rax
movsd 0xd020(%rax), %xmm0
movsd %xmm0, -0x88(%rbp)
movsd -0x80(%rbp), %xmm0
movsd %xmm0, -0x90(%rbp)
movsd -0x88(%rbp), %xmm0
movsd %xmm0, -0x98(%rbp)
movq -0x8(%rbp), %rdi
movsbl -0xc1(%rbp), %esi
callq 0x7d6b0
movq -0x8(%rbp), %rdi
callq 0x7c0d0
movq -0x8(%rbp), %rdi
movsd -0x80(%rbp), %xmm0
movsd -0x88(%rbp), %xmm1
callq 0x7dc30
movb $0x0, -0xc1(%rbp)
movl $0x0, -0x74(%rbp)
jmp 0x78206
jmp 0x78208
jmp 0x77d48
movq -0x8(%rbp), %rax
cmpl $0x0, 0xd028(%rax)
je 0x7822a
movq -0x8(%rbp), %rdi
movsbl -0xc1(%rbp), %esi
callq 0x7d6b0
jmp 0x7822c
movq -0x8(%rbp), %rdi
callq 0x7dca0
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
nop