// File: /workspace/github_cpp_makefile_star2_O2/halsafar[P]libtmx-parser/./src/tmxparser.cpp
// Function: tmxparser::_parseImageLayerNode(tinyxml2::XMLElement*, tmxparser::TmxImageLayer*)
tmxparser::TmxReturn _parseImageLayerNode(tinyxml2::XMLElement* element, TmxImageLayer* outImageLayer)
{
	TmxReturn error = TmxReturn::kSuccess;

	CHECK_AND_RETRIEVE_REQ_ATTRIBUTE_STRING(element, "name", outImageLayer->name);
	
	// x : optional , default 0
	if (element->QueryUnsignedAttribute("x", &outImageLayer->x) == tinyxml2::XML_NO_ATTRIBUTE)
		outImageLayer->x = 0U;

	// y : optional , default 0
	if (element->QueryUnsignedAttribute("y", &outImageLayer->y) == tinyxml2::XML_NO_ATTRIBUTE)
		outImageLayer->y = 0U;

	// width: optional, default: 0
	if (element->QueryUnsignedAttribute("width", &outImageLayer->widthInTiles) == tinyxml2::XML_NO_ATTRIBUTE)
		outImageLayer->widthInTiles = 0U;
	
	// height: optional, default: 0
	if (element->QueryUnsignedAttribute("height", &outImageLayer->heightInTiles) == tinyxml2::XML_NO_ATTRIBUTE)
		outImageLayer->heightInTiles = 0U;

	// opacity: optional, default: 1.0
	if (element->QueryFloatAttribute("opacity", &outImageLayer->opacity) == tinyxml2::XML_NO_ATTRIBUTE)
		outImageLayer->opacity = 1.f;

	// visible: optional, default: true
	if (element->QueryBoolAttribute("visible", &outImageLayer->visible) == tinyxml2::XML_NO_ATTRIBUTE)
		outImageLayer->visible = true;

	// properties: optional
	if (element->FirstChildElement("properties") != NULL)
	{
		error = _parsePropertyNode(element->FirstChildElement("properties"), &outImageLayer->propertyMap);
		if (error != kSuccess)
		{
			LOGE("Error parsing image layer property node...");
			return error;
		}
	}

	// image: optional
	if (element->FirstChildElement("image") != NULL)
	{
		error = _parseImageNode(element->FirstChildElement("image"), &outImageLayer->image);
		if (error != kSuccess)
			return error;
	}

	return error;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0xaaff(%rip), %rsi      # 0x10261
xorl %edx, %edx
callq 0xc8a0
movq %rbx, %rdi
movq %rax, %rsi
callq 0x4420
cmpq $0x0, 0x8(%rbx)
je 0x58b9
leaq 0x20(%rbx), %r15
leaq 0xb143(%rip), %rsi      # 0x108cd
movq %r14, %rdi
movq %r15, %rdx
callq 0x6932
cmpl $0x1, %eax
jne 0x579e
andl $0x0, (%r15)
leaq 0x24(%rbx), %r15
leaq 0xac1a(%rip), %rsi      # 0x103c3
movq %r14, %rdi
movq %r15, %rdx
callq 0x6932
cmpl $0x1, %eax
jne 0x57bd
andl $0x0, (%r15)
leaq 0x28(%rbx), %r15
leaq 0xa936(%rip), %rsi      # 0x100fe
movq %r14, %rdi
movq %r15, %rdx
callq 0x6932
cmpl $0x1, %eax
jne 0x57dc
andl $0x0, (%r15)
leaq 0x2c(%rbx), %r15
leaq 0xa921(%rip), %rsi      # 0x10108
movq %r14, %rdi
movq %r15, %rdx
callq 0x6932
cmpl $0x1, %eax
jne 0x57fb
andl $0x0, (%r15)
leaq 0x30(%rbx), %r15
leaq 0xabb7(%rip), %rsi      # 0x103bd
movq %r14, %rdi
movq %r15, %rdx
callq 0x6df2
cmpl $0x1, %eax
jne 0x581d
movl $0x3f800000, (%r15)     # imm = 0x3F800000
leaq 0x34(%rbx), %r15
leaq 0xab9d(%rip), %rsi      # 0x103c5
movq %r14, %rdi
movq %r15, %rdx
callq 0x6e20
cmpl $0x1, %eax
jne 0x583c
movb $0x1, (%r15)
leaq 0xa8e8(%rip), %rsi      # 0x1012b
movq %r14, %rdi
callq 0xbae8
testq %rax, %rax
je 0x586f
leaq 0xa8d4(%rip), %rsi      # 0x1012b
movq %r14, %rdi
callq 0xbae8
leaq 0x38(%rbx), %rsi
movq %rax, %rdi
callq 0x5089
testl %eax, %eax
jne 0x58e9
leaq 0xaa19(%rip), %rsi      # 0x1028f
movq %r14, %rdi
callq 0xbae8
testq %rax, %rax
je 0x58a8
leaq 0xaa05(%rip), %rsi      # 0x1028f
movq %r14, %rdi
callq 0xbae8
addq $0x70, %rbx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x5915
movl %eax, %r15d
testl %eax, %eax
jne 0x58ab
xorl %r15d, %r15d
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0x13710(%rip), %rbx     # 0x18fd0
movq (%rbx), %rdi
leaq 0xa7fe(%rip), %rsi      # 0x100c8
leaq 0xa990(%rip), %rdx      # 0x10261
xorl %eax, %eax
callq 0x42f0
movq (%rbx), %rsi
pushq $0xa
popq %rdi
callq 0x4270
pushq $0x2
popq %r15
jmp 0x58ab
movl %eax, %r15d
movq 0x136dd(%rip), %rbx     # 0x18fd0
movq (%rbx), %rcx
leaq 0xac80(%rip), %rdi      # 0x1057d
pushq $0x3c
popq %rsi
pushq $0x1
popq %rdx
callq 0x4430
movq (%rbx), %rsi
pushq $0xa
popq %rdi
callq 0x4270
jmp 0x58ab