// File: /workspace/github_cpp_makefile_star2_O3/halsafar[P]libtmx-parser/./src/tmxparser.cpp
// Function: tmxparser::_parseObjectNode(tinyxml2::XMLElement*, tmxparser::TmxObject*)
TmxReturn _parseObjectNode(tinyxml2::XMLElement* element, TmxObject* outObj)
{
	TmxReturn error = TmxReturn::kSuccess;

	if (element->Attribute("name"))
	{
		outObj->name = element->Attribute("name");
	}

	if (element->Attribute("type"))
	{
		outObj->type = element->Attribute("type");
	}
	outObj->x = element->FloatAttribute("x");
	outObj->y = element->FloatAttribute("y");
	outObj->width = element->FloatAttribute("width");
	outObj->height = element->FloatAttribute("height");
	outObj->rotation = element->FloatAttribute("rotation");
	outObj->referenceGid = element->UnsignedAttribute("gid");
	outObj->visible = element->BoolAttribute("visible");

	error = _parsePropertyNode(element->FirstChildElement("properties"), &outObj->propertyMap);
	if (error)
	{
		return error;
	}


	tinyxml2::XMLElement* shapeElement = NULL;
	if ((shapeElement = element->FirstChildElement("ellipse")) != NULL)
	{
		outObj->shapeType = kEllipse;
	}
	else if ((shapeElement = element->FirstChildElement("polygon")) != NULL)
	{
		outObj->shapeType = kPolygon;
	}
	else if ((shapeElement = element->FirstChildElement("polyline")) != NULL)
	{
		outObj->shapeType = kPolyline;
	}
	else
	{
		outObj->shapeType = kSquare;
	}

	if ((outObj->shapeType == kPolygon || outObj->shapeType == kPolyline) && shapeElement != NULL)
	{
		if (shapeElement->Attribute("points") == NULL)
		{
			LOGE("Missing points attribute for shape requiring one...");
			return TmxReturn::kErrorParsing;
		}

		std::string pointString = shapeElement->Attribute("points");
		std::istringstream pairStringStream(pointString);
		std::string pairToken;
		while(std::getline(pairStringStream, pairToken, ' '))
		{
			TmxShapePoint pair;
			std::istringstream pointStringString(pairToken);
			std::string pointToken;
			std::getline(pointStringString, pointToken, ',');
			pair.first = (float)atof(pointToken.c_str());
			std::getline(pointStringString, pointToken, ',');
			pair.second = (float)atof(pointToken.c_str());

			outObj->shapePoints.push_back(pair);
		}
	}

	return error;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x378, %rsp            # imm = 0x378
movq %rsi, %rbx
movq %rdi, %r14
leaq 0xb155(%rip), %rsi      # 0x12261
xorl %edx, %edx
callq 0xe806
testq %rax, %rax
je 0x714b
leaq 0xb142(%rip), %rsi      # 0x12261
movq %r14, %rdi
xorl %edx, %edx
callq 0xe806
movq %rax, %r15
movq 0x8(%rbx), %r12
movq %rax, %rdi
callq 0x4100
movq %rbx, %rdi
xorl %esi, %esi
movq %r12, %rdx
movq %r15, %rcx
movq %rax, %r8
callq 0x4330
leaq 0xb3b7(%rip), %rsi      # 0x12509
movq %r14, %rdi
xorl %edx, %edx
callq 0xe806
testq %rax, %rax
je 0x7198
leaq 0xb3a1(%rip), %rsi      # 0x12509
movq %r14, %rdi
xorl %edx, %edx
callq 0xe806
movq %rax, %r15
leaq 0x20(%rbx), %r12
movq 0x28(%rbx), %r13
movq %rax, %rdi
callq 0x4100
movq %r12, %rdi
xorl %esi, %esi
movq %r13, %rdx
movq %r15, %rcx
movq %rax, %r8
callq 0x4330
leaq 0xb756(%rip), %rsi      # 0x128f5
movq %r14, %rdi
callq 0x7930
movss %xmm0, 0x40(%rbx)
leaq 0xb210(%rip), %rsi      # 0x123c3
movq %r14, %rdi
callq 0x7930
movss %xmm0, 0x44(%rbx)
leaq 0xaf37(%rip), %rsi      # 0x120fe
movq %r14, %rdi
callq 0x7930
movss %xmm0, 0x48(%rbx)
leaq 0xaf2d(%rip), %rsi      # 0x12108
movq %r14, %rdi
callq 0x7930
movss %xmm0, 0x4c(%rbx)
leaq 0xb31f(%rip), %rsi      # 0x1250e
movq %r14, %rdi
callq 0x7930
movss %xmm0, 0x50(%rbx)
leaq 0xb167(%rip), %rsi      # 0x1236a
movq %r14, %rdi
callq 0x7882
movl %eax, 0x54(%rbx)
leaq 0xb1b0(%rip), %rsi      # 0x123c5
movq %r14, %rdi
callq 0x799a
movb %al, 0x58(%rbx)
leaq 0xaf04(%rip), %rsi      # 0x1212b
movq %r14, %rdi
callq 0xd5f8
leaq 0x60(%rbx), %rsi
movq %rax, %rdi
callq 0x5ac0
testl %eax, %eax
jne 0x7479
leaq 0xb2cd(%rip), %rsi      # 0x12517
movq %r14, %rdi
callq 0xd5f8
testq %rax, %rax
je 0x7266
movl $0x2, 0x98(%rbx)
jmp 0x7477
leaq 0xb2b2(%rip), %rsi      # 0x1251f
movq %r14, %rdi
callq 0xd5f8
testq %rax, %rax
je 0x7289
movq %rax, %r15
movl $0x0, 0x98(%rbx)
jmp 0x72ae
leaq 0xb297(%rip), %rsi      # 0x12527
movq %r14, %rdi
callq 0xd5f8
testq %rax, %rax
je 0x746d
movq %rax, %r15
movl $0x1, 0x98(%rbx)
leaq 0xb27b(%rip), %rsi      # 0x12530
movq %r15, %rdi
xorl %edx, %edx
callq 0xe806
testq %rax, %rax
je 0x748b
leaq 0xb261(%rip), %rsi      # 0x12530
movq %r15, %rdi
xorl %edx, %edx
callq 0xe806
leaq -0x98(%rbp), %r14
leaq -0x218(%rbp), %rdx
movq %r14, %rdi
movq %rax, %rsi
callq 0x40e0
leaq -0x218(%rbp), %rdi
movq %r14, %rsi
movl $0x8, %edx
callq 0x43a0
leaq -0x68(%rbp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq -0x40(%rbp), %r12
leaq 0xa0(%rbx), %rax
movq %rax, -0x58(%rbp)
leaq -0x78(%rbp), %r13
leaq -0x398(%rbp), %r15
leaq -0x50(%rbp), %r14
leaq -0x218(%rbp), %rdi
movq %r13, %rsi
movl $0x20, %edx
callq 0x4400
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x7425
movq $0x0, -0x30(%rbp)
movq %r15, %rdi
movq %r13, %rsi
movl $0x8, %edx
callq 0x43a0
movq %r12, -0x50(%rbp)
movq $0x0, -0x48(%rbp)
movb $0x0, -0x40(%rbp)
movq %r15, %rdi
movq %r14, %rsi
movl $0x2c, %edx
callq 0x4400
movq -0x50(%rbp), %rdi
callq 0x4260
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x30(%rbp)
movq %r15, %rdi
movq %r14, %rsi
movl $0x2c, %edx
callq 0x4400
movq -0x50(%rbp), %rdi
callq 0x4260
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x2c(%rbp)
movq 0xa8(%rbx), %rsi
cmpq 0xb0(%rbx), %rsi
je 0x73ea
movq -0x30(%rbp), %rax
movq %rax, (%rsi)
addq $0x8, 0xa8(%rbx)
jmp 0x73f7
movq -0x58(%rbp), %rdi
leaq -0x30(%rbp), %rdx
callq 0xb69a
movq -0x50(%rbp), %rdi
cmpq %r12, %rdi
je 0x7405
callq 0x41c0
movq %r15, %rdi
movq 0x12bb9(%rip), %rsi     # 0x19fc8
callq 0x42d0
leaq -0x320(%rbp), %rdi
callq 0x40a0
jmp 0x7337
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x7437
callq 0x41c0
movq 0x12b8a(%rip), %rsi     # 0x19fc8
leaq -0x218(%rbp), %rdi
callq 0x42d0
leaq -0x1a0(%rbp), %rdi
callq 0x40a0
leaq -0x88(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x7477
callq 0x41c0
jmp 0x7477
movl $0x3, 0x98(%rbx)
xorl %eax, %eax
addq $0x378, %rsp            # imm = 0x378
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x49ed
movl $0x1, %eax
jmp 0x7479
movq %rax, %rbx
jmp 0x7504
jmp 0x749e
movq %rax, %rbx
jmp 0x74d3
movq %rax, %rbx
movq -0x50(%rbp), %rdi
cmpq %r12, %rdi
je 0x74b4
callq 0x41c0
movq 0x12b0d(%rip), %rsi     # 0x19fc8
leaq -0x398(%rbp), %rdi
callq 0x42d0
leaq -0x320(%rbp), %rdi
callq 0x40a0
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x74e5
callq 0x41c0
movq 0x12adc(%rip), %rsi     # 0x19fc8
leaq -0x218(%rbp), %rdi
callq 0x42d0
leaq -0x1a0(%rbp), %rdi
callq 0x40a0
leaq -0x88(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x7519
callq 0x41c0
movq %rbx, %rdi
callq 0x43d0