// File: /workspace/github_cpp_makefile_star2_O3/halsafar[P]libtmx-parser/./src/tmxparser.cpp
// Function: tmxparser::_parseMapNode(tinyxml2::XMLElement*, tmxparser::TmxMap*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
TmxReturn _parseMapNode(tinyxml2::XMLElement* element, TmxMap* outMap, std::string tilesetPath)
{
	if (element == NULL)
	{
		return TmxReturn::kMissingMapNode;
	}

	outMap->version = element->Attribute("version");
	const char* orientation = element->Attribute("orientation");
	if (orientation != NULL)
	{
		if (strcmp(orientation, "orthogonal") == 0)
		{
			outMap->orientation = TmxOrientation::kOrthogonal;
		}
		else if (strcmp(orientation, "isometric") == 0)
		{
			outMap->orientation = TmxOrientation::kIsometric;
		}
		else if (strcmp(orientation, "staggered") == 0)
		{
			outMap->orientation = TmxOrientation::kStaggered;
		}
	}
	else
	{
		LOGW("Missing orientation attribute");
	}

	CHECK_AND_RETRIEVE_REQ_ATTRIBUTE(element->QueryUnsignedAttribute, "width", &outMap->width);
	CHECK_AND_RETRIEVE_REQ_ATTRIBUTE(element->QueryUnsignedAttribute, "height", &outMap->height);
	CHECK_AND_RETRIEVE_REQ_ATTRIBUTE(element->QueryUnsignedAttribute, "tilewidth", &outMap->tileWidth);
	CHECK_AND_RETRIEVE_REQ_ATTRIBUTE(element->QueryUnsignedAttribute, "tileheight", &outMap->tileHeight);

	CHECK_AND_RETRIEVE_OPT_ATTRIBUTE_STRING(element, "backgroundcolor", outMap->backgroundColor);
	CHECK_AND_RETRIEVE_OPT_ATTRIBUTE_STRING(element, "renderorder", outMap->renderOrder);


	TmxReturn error = _parsePropertyNode(element->FirstChildElement("properties"), &outMap->propertyMap);
	if (error)
	{
		LOGE("Error processing map properties...");
		return error;
	}

	for (tinyxml2::XMLElement* child = element->FirstChildElement("tileset"); child != NULL; child = child->NextSiblingElement("tileset"))
	{
		TmxTileset set;
		error = _parseTilesetNode(child, &set, tilesetPath);
		if (error)
		{
			LOGE("Error processing tileset node...");
			return error;
		}

		outMap->tilesetCollection.push_back(set);
	}

	for (tinyxml2::XMLElement* child = element->FirstChildElement("layer"); child != NULL; child = child->NextSiblingElement("layer"))
	{
		TmxLayer layer;
		error = _parseLayerNode(child, outMap->tilesetCollection, &layer);
		if (error)
		{
			LOGE("Error processing layer node...");
			return error;
		}

		outMap->layerCollection.push_back(layer);
	}

	for (tinyxml2::XMLElement* child = element->FirstChildElement("objectgroup"); child != NULL; child = child->NextSiblingElement("objectgroup"))
	{
		TmxObjectGroup group;
		error = _parseObjectGroupNode(child, &group);
		if (error)
		{
			LOGE("Error processing objectgroup node...");
			return error;
		}

		outMap->objectGroupCollection.push_back(group);
	}

	for (tinyxml2::XMLElement* child = element->FirstChildElement("imagelayer"); child != NULL; child = child->NextSiblingElement("imagelayer"))
	{
		TmxImageLayer imageLayer;
		error = _parseImageLayerNode(child, &imageLayer);
		if (error)
		{
			LOGE("Error parsing imagelayer node...");
			return error;
		}

		outMap->imageLayerCollection.push_back(imageLayer);
	}

	return error;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x158, %rsp            # imm = 0x158
movq %rdx, -0x40(%rbp)
testq %rdi, %rdi
je 0x4f75
movq %rsi, %r12
movq %rdi, %r13
leaq 0xd177(%rip), %rsi      # 0x12065
xorl %edx, %edx
callq 0xe806
movq %rax, %rbx
movq 0x8(%r12), %r14
movq %rax, %rdi
callq 0x4100
movq %r12, %rdi
xorl %esi, %esi
movq %r14, %rdx
movq %rbx, %rcx
movq %rax, %r8
callq 0x4330
leaq 0xd14e(%rip), %rsi      # 0x1206d
movq %r13, %rdi
xorl %edx, %edx
callq 0xe806
testq %rax, %rax
je 0x4f95
movq %rax, %rbx
leaq 0xd141(%rip), %rsi      # 0x12079
movq %rax, %rdi
callq 0x42c0
testl %eax, %eax
je 0x4f7f
leaq 0xd139(%rip), %rsi      # 0x12084
movq %rbx, %rdi
callq 0x42c0
testl %eax, %eax
je 0x4f8a
leaq 0xd130(%rip), %rsi      # 0x1208e
movq %rbx, %rdi
callq 0x42c0
testl %eax, %eax
jne 0x4f9a
movl $0x2, 0x20(%r12)
jmp 0x4f9a
movl $0x3, %ebx
jmp 0x5763
movl $0x0, 0x20(%r12)
jmp 0x4f9a
movl $0x1, 0x20(%r12)
jmp 0x4f9a
callq 0x44e8
leaq 0xd15d(%rip), %rsi      # 0x120fe
movq %r13, %rdi
callq 0xe794
testq %rax, %rax
je 0x5730
leaq 0x24(%r12), %rsi
movq %rax, %rdi
callq 0xe3d2
cmpl $0x1, %eax
je 0x5730
leaq 0xd139(%rip), %rsi      # 0x12108
movq %r13, %rdi
callq 0xe794
testq %rax, %rax
je 0x5737
leaq 0x28(%r12), %rsi
movq %rax, %rdi
callq 0xe3d2
cmpl $0x1, %eax
je 0x5737
leaq 0xd0fd(%rip), %rsi      # 0x120fa
movq %r13, %rdi
callq 0xe794
testq %rax, %rax
je 0x573e
leaq 0x2c(%r12), %rsi
movq %rax, %rdi
callq 0xe3d2
cmpl $0x1, %eax
je 0x573e
leaq 0xd0d9(%rip), %rsi      # 0x12104
movq %r13, %rdi
callq 0xe794
testq %rax, %rax
je 0x5745
leaq 0x30(%r12), %rsi
movq %rax, %rdi
callq 0xe3d2
cmpl $0x1, %eax
je 0x5745
leaq 0xd0b6(%rip), %rsi      # 0x1210f
movq %r13, %rdi
xorl %edx, %edx
callq 0xe806
testq %rax, %rax
je 0x50a3
leaq 0xd0a0(%rip), %rsi      # 0x1210f
movq %r13, %rdi
xorl %edx, %edx
callq 0xe806
movq %rax, %rbx
leaq 0x38(%r12), %r14
movq 0x40(%r12), %r15
movq %rax, %rdi
callq 0x4100
movq %r14, %rdi
xorl %esi, %esi
movq %r15, %rdx
movq %rbx, %rcx
movq %rax, %r8
callq 0x4330
jmp 0x50bc
leaq 0x38(%r12), %rdi
movq 0x40(%r12), %rdx
movl $0x1, %ecx
xorl %esi, %esi
xorl %r8d, %r8d
callq 0x4410
leaq 0xd05c(%rip), %rsi      # 0x1211f
movq %r13, %rdi
xorl %edx, %edx
callq 0xe806
testq %rax, %rax
je 0x510d
leaq 0xd046(%rip), %rsi      # 0x1211f
movq %r13, %rdi
xorl %edx, %edx
callq 0xe806
movq %rax, %rbx
leaq 0x58(%r12), %r14
movq 0x60(%r12), %r15
movq %rax, %rdi
callq 0x4100
movq %r14, %rdi
xorl %esi, %esi
movq %r15, %rdx
movq %rbx, %rcx
movq %rax, %r8
callq 0x4330
jmp 0x5126
leaq 0x58(%r12), %rdi
movq 0x60(%r12), %rdx
movl $0x1, %ecx
xorl %esi, %esi
xorl %r8d, %r8d
callq 0x4410
leaq 0xcffe(%rip), %rsi      # 0x1212b
movq %r13, %rdi
callq 0xd5f8
leaq 0x78(%r12), %rsi
movq %rax, %rdi
callq 0x5ac0
testl %eax, %eax
jne 0x5777
movq %r12, -0x38(%rbp)
leaq 0xd016(%rip), %rsi      # 0x1216b
movq %r13, -0x48(%rbp)
movq %r13, %rdi
callq 0xd5f8
testq %rax, %rax
je 0x5357
movq %rax, %r13
leaq -0x140(%rbp), %rbx
movq -0x38(%rbp), %rax
addq $0xb0, %rax
movq %rax, -0x158(%rbp)
xorl %r14d, %r14d
leaq -0x178(%rbp), %r15
movq %rbx, -0x150(%rbp)
movq %r14, -0x148(%rbp)
movb %r14b, -0x140(%rbp)
leaq -0x118(%rbp), %rax
movq %rax, -0x128(%rbp)
movq %r14, -0x120(%rbp)
movb %r14b, -0x118(%rbp)
leaq -0xd8(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq %r14, -0xe0(%rbp)
movb %r14b, -0xd8(%rbp)
leaq -0xb8(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq %r14, -0xc0(%rbp)
movb %r14b, -0xb8(%rbp)
leaq -0x98(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq %r14, -0xa0(%rbp)
movb %r14b, -0x98(%rbp)
leaq -0x50(%rbp), %rax
movq %rax, -0x80(%rbp)
movq $0x1, -0x78(%rbp)
xorps %xmm0, %xmm0
movups %xmm0, 0xd0(%rbx)
movl $0x3f800000, -0x60(%rbp) # imm = 0x3F800000
movups %xmm0, 0xe8(%rbx)
leaq -0x168(%rbp), %rax
movq %rax, -0x178(%rbp)
movq -0x40(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x90e6
movq %r13, %rdi
leaq -0x150(%rbp), %rsi
movq %r15, %rdx
callq 0x5c28
movl %eax, %r12d
movq -0x178(%rbp), %rdi
leaq -0x168(%rbp), %rax
cmpq %rax, %rdi
je 0x528d
callq 0x41c0
testl %r12d, %r12d
jne 0x5349
movq -0x158(%rbp), %rdi
leaq -0x150(%rbp), %rsi
callq 0x7616
leaq -0x80(%rbp), %rdi
callq 0x7a5a
movq -0xa8(%rbp), %rdi
leaq -0x98(%rbp), %rax
cmpq %rax, %rdi
je 0x52ca
callq 0x41c0
movq -0xc8(%rbp), %rdi
leaq -0xb8(%rbp), %rax
cmpq %rax, %rdi
je 0x52e2
callq 0x41c0
movq -0xe8(%rbp), %rdi
leaq -0xd8(%rbp), %rax
cmpq %rax, %rdi
je 0x52fa
callq 0x41c0
movq -0x128(%rbp), %rdi
leaq -0x118(%rbp), %rax
cmpq %rax, %rdi
je 0x5312
callq 0x41c0
movq -0x150(%rbp), %rdi
cmpq %rbx, %rdi
je 0x5323
callq 0x41c0
testl %r12d, %r12d
jne 0x5727
movq %r13, %rdi
leaq 0xce35(%rip), %rsi      # 0x1216b
callq 0xd720
movq %rax, %r13
testq %rax, %rax
jne 0x518f
jmp 0x5357
callq 0x454a
movl %r12d, -0x2c(%rbp)
jmp 0x52a9
leaq 0xcec1(%rip), %rsi      # 0x1221f
movq -0x48(%rbp), %rdi
callq 0xd5f8
testq %rax, %rax
je 0x546a
movq %rax, %rbx
leaq -0x140(%rbp), %r12
movq -0x38(%rbp), %rax
leaq 0xb0(%rax), %r15
addq $0xc8, %rax
movq %rax, -0x40(%rbp)
leaq -0x150(%rbp), %r13
movq %r12, -0x150(%rbp)
xorl %ecx, %ecx
movq %rcx, -0x148(%rbp)
movb $0x0, -0x140(%rbp)
leaq -0xf0(%rbp), %rax
movq %rax, -0x120(%rbp)
movq $0x1, -0x118(%rbp)
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%r12)
movl $0x3f800000, -0x100(%rbp) # imm = 0x3F800000
movq %rcx, 0x68(%r12)
movups %xmm0, 0x58(%r12)
movups %xmm0, 0x48(%r12)
movq %rbx, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x5e76
movl %eax, %r14d
testl %eax, %eax
jne 0x545f
movq -0x40(%rbp), %rdi
movq %r13, %rsi
callq 0x76d8
movq -0xe8(%rbp), %rdi
testq %rdi, %rdi
je 0x541c
callq 0x41c0
leaq -0x120(%rbp), %rdi
callq 0x7b40
movq -0x150(%rbp), %rdi
cmpq %r12, %rdi
je 0x5439
callq 0x41c0
testl %r14d, %r14d
jne 0x5727
movq %rbx, %rdi
leaq 0xcdd3(%rip), %rsi      # 0x1221f
callq 0xd720
movq %rax, %rbx
testq %rax, %rax
jne 0x5396
jmp 0x546a
callq 0x457e
movl %r14d, -0x2c(%rbp)
jmp 0x540b
leaq 0xcd66(%rip), %rsi      # 0x121d7
movq -0x48(%rbp), %rdi
callq 0xd5f8
testq %rax, %rax
je 0x55a2
movq %rax, %rbx
leaq -0x140(%rbp), %r14
movq -0x38(%rbp), %rax
addq $0xe0, %rax
movq %rax, -0x40(%rbp)
xorl %r15d, %r15d
leaq -0x150(%rbp), %r13
movq %r14, -0x150(%rbp)
movq %r15, -0x148(%rbp)
movb %r15b, -0x140(%rbp)
leaq -0x120(%rbp), %rax
movq %rax, -0x130(%rbp)
movq %r15, -0x128(%rbp)
movb %r15b, -0x120(%rbp)
leaq -0xd8(%rbp), %rax
movq %rax, -0x108(%rbp)
movq $0x1, -0x100(%rbp)
xorps %xmm0, %xmm0
movups %xmm0, 0x48(%r14)
movl $0x3f800000, -0xe8(%rbp) # imm = 0x3F800000
movq %r15, 0x80(%r14)
movups %xmm0, 0x70(%r14)
movups %xmm0, 0x60(%r14)
movq %rbx, %rdi
movq %r13, %rsi
callq 0x5fc1
movl %eax, %r12d
testl %eax, %eax
jne 0x5597
movq -0x40(%rbp), %rdi
movq %r13, %rsi
callq 0x774a
leaq -0xd0(%rbp), %rdi
callq 0x7c1c
leaq -0x108(%rbp), %rdi
callq 0x7b40
movq -0x130(%rbp), %rdi
leaq -0x120(%rbp), %rax
cmpq %rax, %rdi
je 0x5560
callq 0x41c0
movq -0x150(%rbp), %rdi
cmpq %r14, %rdi
je 0x5571
callq 0x41c0
testl %r12d, %r12d
jne 0x5727
movq %rbx, %rdi
leaq 0xcc53(%rip), %rsi      # 0x121d7
callq 0xd720
movq %rax, %rbx
testq %rax, %rax
jne 0x54a5
jmp 0x55a2
callq 0x45b2
movl %r12d, -0x2c(%rbp)
jmp 0x5530
leaq 0xcc71(%rip), %rsi      # 0x1221a
movq -0x48(%rbp), %rdi
callq 0xd5f8
testq %rax, %rax
je 0x572c
movq %rax, %rbx
leaq -0x140(%rbp), %r14
addq $0xf8, -0x38(%rbp)
xorl %r12d, %r12d
leaq -0x150(%rbp), %r15
movq %r14, -0x150(%rbp)
movq %r12, -0x148(%rbp)
movb %r12b, -0x140(%rbp)
leaq -0xe8(%rbp), %rax
movq %rax, -0x118(%rbp)
movq $0x1, -0x110(%rbp)
xorps %xmm0, %xmm0
movups %xmm0, 0x38(%r14)
movl $0x3f800000, -0xf8(%rbp) # imm = 0x3F800000
movups %xmm0, 0x50(%r14)
leaq -0xd0(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq %r12, -0xd8(%rbp)
movb %r12b, -0xd0(%rbp)
leaq -0xb0(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq %r12, -0xb8(%rbp)
movb %r12b, -0xb0(%rbp)
leaq -0x90(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq %r12, -0x98(%rbp)
movb %r12b, -0x90(%rbp)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x6209
movl %eax, %r13d
testl %eax, %eax
jne 0x5719
movq -0x38(%rbp), %rdi
movq %r15, %rsi
callq 0x77d2
movq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %rax
cmpq %rax, %rdi
je 0x56aa
callq 0x41c0
movq -0xc0(%rbp), %rdi
leaq -0xb0(%rbp), %rax
cmpq %rax, %rdi
je 0x56c2
callq 0x41c0
movq -0xe0(%rbp), %rdi
leaq -0xd0(%rbp), %rax
cmpq %rax, %rdi
je 0x56da
callq 0x41c0
leaq -0x118(%rbp), %rdi
callq 0x7b40
movq -0x150(%rbp), %rdi
cmpq %r14, %rdi
je 0x56f7
callq 0x41c0
testl %r13d, %r13d
jne 0x5727
movq %rbx, %rdi
leaq 0xcb14(%rip), %rsi      # 0x1221a
callq 0xd720
movq %rax, %rbx
testq %rax, %rax
jne 0x55d7
jmp 0x572c
callq 0x45e6
movl %r13d, -0x2c(%rbp)
jmp 0x5692
movl -0x2c(%rbp), %ebx
jmp 0x5763
xorl %ebx, %ebx
jmp 0x5763
callq 0x4686
jmp 0x574a
callq 0x4662
jmp 0x574a
callq 0x463e
jmp 0x574a
callq 0x461a
movl $0x2, %ebx
movq 0x1487a(%rip), %rax     # 0x19fd0
movq (%rax), %rsi
movl $0xa, %edi
callq 0x4270
movl %ebx, %eax
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %ebx
callq 0x451b
jmp 0x574f
movq %rax, %rbx
leaq -0x150(%rbp), %rdi
callq 0x7810
jmp 0x57df
movq %rax, %rbx
leaq -0x150(%rbp), %rdi
callq 0x7788
jmp 0x57df
movq %rax, %rbx
movq -0x178(%rbp), %rdi
leaq -0x168(%rbp), %rax
cmpq %rax, %rdi
je 0x57d3
callq 0x41c0
jmp 0x57d3
movq %rax, %rbx
leaq -0x150(%rbp), %rdi
callq 0x7710
jmp 0x57df
movq %rax, %rbx
leaq -0x150(%rbp), %rdi
callq 0x7654
movq %rbx, %rdi
callq 0x43d0