// File: halsafar[P]libtmx-parser/./src/tmxparser.cpp
// Function: tmxparser::_parseObjectGroupNode(tinyxml2::XMLElement*, tmxparser::TmxObjectGroup*)
TmxReturn _parseObjectGroupNode(tinyxml2::XMLElement* element, TmxObjectGroup* outObjectGroup)
{
	TmxReturn error = TmxReturn::kSuccess;

	CHECK_AND_RETRIEVE_OPT_ATTRIBUTE_STRING(element, "name", outObjectGroup->name);

	if (element->Attribute("opacity") != NULL)
	{
		outObjectGroup->opacity = element->FloatAttribute("opacity");
	}
	else
	{
		outObjectGroup->opacity = 1.0f;
	}

	if (element->Attribute("visible") != NULL)
	{
		outObjectGroup->visible = element->BoolAttribute("visible");
	}
	else
	{
		outObjectGroup->visible = true;
	}

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

	for (tinyxml2::XMLElement* child = element->FirstChildElement("object"); child != NULL; child = child->NextSiblingElement("object"))
	{
		TmxObject obj;
		error = _parseObjectNode(child, &obj);
		if (error)
		{
			LOGE("Error parsing object node...");
			return TmxReturn::kErrorParsing;
		}
		outObjectGroup->objects.push_back(obj);
	}

	return error;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x1c55c(%rip), %rsi     # 0x22271
xorl %eax, %eax
movl %eax, %edx
callq 0x1c710
cmpq $0x0, %rax
je 0x5d46
movq -0x10(%rbp), %rdi
leaq 0x1c542(%rip), %rsi     # 0x22271
xorl %eax, %eax
movl %eax, %edx
callq 0x1c710
movq %rax, %rsi
movq -0x18(%rbp), %rdi
callq 0x4360
jmp 0x5d51
movq -0x18(%rbp), %rdi
xorl %esi, %esi
callq 0x4450
movq -0x10(%rbp), %rdi
leaq 0x1c671(%rip), %rsi     # 0x223cd
xorl %eax, %eax
movl %eax, %edx
callq 0x1c710
cmpq $0x0, %rax
je 0x5d86
movq -0x10(%rbp), %rdi
leaq 0x1c657(%rip), %rsi     # 0x223cd
callq 0x84d0
movq -0x18(%rbp), %rax
movss %xmm0, 0x40(%rax)
jmp 0x5d97
movq -0x18(%rbp), %rax
movss 0x1c272(%rip), %xmm0    # 0x22004
movss %xmm0, 0x40(%rax)
movq -0x10(%rbp), %rdi
leaq 0x1c633(%rip), %rsi     # 0x223d5
xorl %eax, %eax
movl %eax, %edx
callq 0x1c710
cmpq $0x0, %rax
je 0x5dcf
movq -0x10(%rbp), %rdi
leaq 0x1c619(%rip), %rsi     # 0x223d5
callq 0x87e0
movb %al, %cl
movq -0x18(%rbp), %rax
andb $0x1, %cl
movb %cl, 0x44(%rax)
jmp 0x5dd7
movq -0x18(%rbp), %rax
movb $0x1, 0x44(%rax)
movq -0x10(%rbp), %rdi
leaq 0x1c359(%rip), %rsi     # 0x2213b
callq 0x7b60
movq %rax, %rdi
movq -0x18(%rbp), %rsi
addq $0x48, %rsi
callq 0x55c0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x5e0b
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x5f22
movq -0x10(%rbp), %rdi
leaq 0x1c6cd(%rip), %rsi     # 0x224e3
callq 0x7b60
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x5f1c
leaq -0xe0(%rbp), %rdi
movq %rdi, -0x100(%rbp)
callq 0x8810
movq -0x100(%rbp), %rsi
movq -0x28(%rbp), %rdi
callq 0x7480
movl %eax, -0xf4(%rbp)
jmp 0x5e55
movl -0xf4(%rbp), %eax
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x5ec7
movq 0x2d16d(%rip), %rax     # 0x32fd8
movq (%rax), %rdi
leaq 0x1c675(%rip), %rsi     # 0x224ea
movb $0x0, %al
callq 0x43a0
movq 0x2d155(%rip), %rax     # 0x32fd8
movq (%rax), %rdi
leaq 0x1caa3(%rip), %rsi     # 0x22930
movb $0x0, %al
callq 0x43a0
movl $0x1, -0x4(%rbp)
movl $0x1, -0xf0(%rbp)
jmp 0x5ee7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe8(%rbp)
movl %eax, -0xec(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x88d0
jmp 0x5f2e
movq -0x18(%rbp), %rdi
subq $-0x80, %rdi
leaq -0xe0(%rbp), %rsi
callq 0x8860
jmp 0x5edd
movl $0x0, -0xf0(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x88d0
movl -0xf0(%rbp), %eax
testl %eax, %eax
je 0x5f01
jmp 0x5eff
jmp 0x5f22
jmp 0x5f03
movq -0x28(%rbp), %rdi
leaq 0x1c5d5(%rip), %rsi     # 0x224e3
callq 0x7f80
movq %rax, -0x28(%rbp)
jmp 0x5e1f
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
movq -0xe8(%rbp), %rdi
callq 0x4470
nopw (%rax,%rax)