// File: /workspace/github_cpp_makefile_star2_O2/thierry7100[P]CutOptim/include/nanosvg.h
// Function: nsvg__parseGradient(NSVGparser*, char const**, char)
static void nsvg__parseGradient(NSVGparser* p, const char** attr, char type)
{
	int i;
	NSVGgradientData* grad = (NSVGgradientData*)malloc(sizeof(NSVGgradientData));
	if (grad == NULL) return;
	memset(grad, 0, sizeof(NSVGgradientData));
	grad->units = NSVG_OBJECT_SPACE;
	grad->type = type;
	if (grad->type == NSVG_PAINT_LINEAR_GRADIENT) {
		grad->linear.x1 = nsvg__coord(0.0, NSVG_UNITS_PERCENT);
		grad->linear.y1 = nsvg__coord(0.0, NSVG_UNITS_PERCENT);
		grad->linear.x2 = nsvg__coord(100.0, NSVG_UNITS_PERCENT);
		grad->linear.y2 = nsvg__coord(0.0, NSVG_UNITS_PERCENT);
	} else if (grad->type == NSVG_PAINT_RADIAL_GRADIENT) {
		grad->radial.cx = nsvg__coord(50.0, NSVG_UNITS_PERCENT);
		grad->radial.cy = nsvg__coord(50.0, NSVG_UNITS_PERCENT);
		grad->radial.r = nsvg__coord(50.0, NSVG_UNITS_PERCENT);
	}

	nsvg__xformIdentity(grad->xform);

	for (i = 0; attr[i]; i += 2) {
		if (strcmp(attr[i], "id") == 0) {
			strncpy(grad->id, attr[i+1], 63);
			grad->id[63] = '\0';
		} else if (!nsvg__parseAttr(p, attr[i], attr[i + 1])) {
			if (strcmp(attr[i], "gradientUnits") == 0) {
				if (strcmp(attr[i+1], "objectBoundingBox") == 0)
					grad->units = NSVG_OBJECT_SPACE;
				else
					grad->units = NSVG_USER_SPACE;
			} else if (strcmp(attr[i], "gradientTransform") == 0) {
				nsvg__parseTransform(grad->xform, attr[i + 1]);
			} else if (strcmp(attr[i], "cx") == 0) {
				grad->radial.cx = nsvg__parseCoordinateRaw(attr[i + 1]);
			} else if (strcmp(attr[i], "cy") == 0) {
				grad->radial.cy = nsvg__parseCoordinateRaw(attr[i + 1]);
			} else if (strcmp(attr[i], "r") == 0) {
				grad->radial.r = nsvg__parseCoordinateRaw(attr[i + 1]);
			} else if (strcmp(attr[i], "fx") == 0) {
				grad->radial.fx = nsvg__parseCoordinateRaw(attr[i + 1]);
			} else if (strcmp(attr[i], "fy") == 0) {
				grad->radial.fy = nsvg__parseCoordinateRaw(attr[i + 1]);
			} else if (strcmp(attr[i], "x1") == 0) {
				grad->linear.x1 = nsvg__parseCoordinateRaw(attr[i + 1]);
			} else if (strcmp(attr[i], "y1") == 0) {
				grad->linear.y1 = nsvg__parseCoordinateRaw(attr[i + 1]);
			} else if (strcmp(attr[i], "x2") == 0) {
				grad->linear.x2 = nsvg__parseCoordinateRaw(attr[i + 1]);
			} else if (strcmp(attr[i], "y2") == 0) {
				grad->linear.y2 = nsvg__parseCoordinateRaw(attr[i + 1]);
			} else if (strcmp(attr[i], "spreadMethod") == 0) {
				if (strcmp(attr[i+1], "pad") == 0)
					grad->spread = NSVG_SPREAD_PAD;
				else if (strcmp(attr[i+1], "reflect") == 0)
					grad->spread = NSVG_SPREAD_REFLECT;
				else if (strcmp(attr[i+1], "repeat") == 0)
					grad->spread = NSVG_SPREAD_REPEAT;
			} else if (strcmp(attr[i], "xlink:href") == 0) {
				const char *href = attr[i+1];
				strncpy(grad->ref, href+1, 62);
				grad->ref[62] = '\0';
			}
		}
	}

	grad->next = p->gradients;
	p->gradients = grad;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
pushq $0x1
popq %rdi
movl $0x128, %esi            # imm = 0x128
callq 0x82f0
testq %rax, %rax
je 0x30564
movq %rax, %r15
movb $0x1, 0xd9(%rax)
movb %bpl, 0x80(%rax)
cmpb $0x2, %bpl
jne 0x301f5
andq $0x0, 0xb8(%r15)
movl $0x7, 0xc0(%r15)
movsd 0x6070(%rip), %xmm0     # 0x36260
xorps %xmm1, %xmm1
jmp 0x30200
movsd 0x5e83(%rip), %xmm1     # 0x36080
movaps %xmm1, %xmm0
movsd %xmm1, 0x88(%r15)
pushq $0x7
popq %rax
movl %eax, 0x90(%r15)
movsd %xmm1, 0x98(%r15)
movl %eax, 0xa0(%r15)
movsd %xmm0, 0xa8(%r15)
movl %eax, 0xb0(%r15)
leaq 0xe0(%r15), %rax
movq %rax, 0x10(%rsp)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0xe0(%r15)
xorps %xmm0, %xmm0
movups %xmm0, 0xe8(%r15)
movq %rax, 0xf8(%r15)
movups %xmm0, 0x100(%r15)
movq %r15, %rax
addq $0x40, %rax
movq %rax, 0x8(%rsp)
addq $0x8, %r14
leaq 0x7a83(%rip), %rbp      # 0x37d04
leaq 0x7a9c(%rip), %r12      # 0x37d24
movq -0x8(%r14), %rsi
testq %rsi, %rsi
je 0x3054f
cmpb $0x69, (%rsi)
jne 0x302aa
cmpb $0x64, 0x1(%rsi)
jne 0x302aa
cmpb $0x0, 0x2(%rsi)
je 0x30364
movq (%r14), %rdx
movq %rbx, %rdi
callq 0x30855
testl %eax, %eax
je 0x302bf
addq $0x10, %r14
jmp 0x30288
movq -0x8(%r14), %r13
movq %r13, %rdi
movq %rbp, %rsi
callq 0x85d0
testl %eax, %eax
je 0x30344
movq %r13, %rdi
movq %r12, %rsi
callq 0x85d0
testl %eax, %eax
je 0x3037c
movzbl (%r13), %eax
cmpl $0x79, %eax
je 0x30426
cmpl $0x66, %eax
je 0x3039b
cmpl $0x72, %eax
je 0x30402
cmpl $0x78, %eax
je 0x303e0
cmpl $0x63, %eax
jne 0x3044a
cmpb $0x78, 0x1(%r13)
jne 0x30329
cmpb $0x0, 0x2(%r13)
je 0x304eb
cmpb $0x79, 0x1(%r13)
jne 0x3044a
cmpb $0x0, 0x2(%r13)
jne 0x3044a
jmp 0x30532
movq (%r14), %rdi
leaq 0x79c4(%rip), %rsi      # 0x37d12
callq 0x85d0
testl %eax, %eax
je 0x3038e
movb $0x0, 0xd9(%r15)
jmp 0x302b9
movq (%r14), %rsi
movq %r15, %rdi
pushq $0x3f
popq %rdx
callq 0x8230
movb $0x0, 0x3f(%r15)
jmp 0x302b9
movq (%r14), %rsi
movq 0x10(%rsp), %rdi
callq 0x30f21
jmp 0x302b9
movb $0x1, 0xd9(%r15)
jmp 0x302b9
cmpb $0x78, 0x1(%r13)
jne 0x303ad
cmpb $0x0, 0x2(%r13)
je 0x30515
cmpb $0x79, 0x1(%r13)
jne 0x3044a
cmpb $0x0, 0x2(%r13)
jne 0x3044a
movq (%r14), %rdi
callq 0x31389
movsd %xmm0, 0xc8(%r15)
movl %eax, 0xd0(%r15)
jmp 0x302b9
cmpb $0x31, 0x1(%r13)
jne 0x303f2
cmpb $0x0, 0x2(%r13)
je 0x304eb
cmpb $0x32, 0x1(%r13)
jne 0x3044a
cmpb $0x0, 0x2(%r13)
jne 0x3044a
jmp 0x30409
cmpb $0x0, 0x1(%r13)
jne 0x3044a
movq (%r14), %rdi
callq 0x31389
movsd %xmm0, 0xa8(%r15)
movl %eax, 0xb0(%r15)
jmp 0x302b9
cmpb $0x31, 0x1(%r13)
jne 0x30438
cmpb $0x0, 0x2(%r13)
je 0x30532
cmpb $0x32, 0x1(%r13)
jne 0x3044a
cmpb $0x0, 0x2(%r13)
je 0x30515
movq %r13, %rdi
leaq 0x78e2(%rip), %rsi      # 0x37d36
callq 0x85d0
testl %eax, %eax
je 0x30491
movq %r13, %rdi
leaq 0x78ef(%rip), %rsi      # 0x37d56
callq 0x85d0
testl %eax, %eax
jne 0x302b9
movq (%r14), %rsi
incq %rsi
movq 0x8(%rsp), %rdi
pushq $0x3e
popq %rdx
callq 0x8230
movb $0x0, 0x7e(%r15)
jmp 0x302b9
movq (%r14), %r13
movq %r13, %rdi
leaq 0x78a5(%rip), %rsi      # 0x37d43
callq 0x85d0
testl %eax, %eax
je 0x304de
movq %r13, %rdi
leaq 0x7896(%rip), %rsi      # 0x37d47
callq 0x85d0
testl %eax, %eax
je 0x30508
movq %r13, %rdi
leaq 0x788b(%rip), %rsi      # 0x37d4f
callq 0x85d0
testl %eax, %eax
jne 0x302b9
movb $0x2, 0xd8(%r15)
jmp 0x302b9
movb $0x0, 0xd8(%r15)
jmp 0x302b9
movq (%r14), %rdi
callq 0x31389
movsd %xmm0, 0x88(%r15)
movl %eax, 0x90(%r15)
jmp 0x302b9
movb $0x1, 0xd8(%r15)
jmp 0x302b9
movq (%r14), %rdi
callq 0x31389
movsd %xmm0, 0xb8(%r15)
movl %eax, 0xc0(%r15)
jmp 0x302b9
movq (%r14), %rdi
callq 0x31389
movsd %xmm0, 0x98(%r15)
movl %eax, 0xa0(%r15)
jmp 0x302b9
movq 0xd040(%rbx), %rax
movq %rax, 0x120(%r15)
movq %r15, 0xd040(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq