// File: jliesch[P]ofxget/pugixml/pugixml.cpp
// Function: pugi::xml_node::attribute(char const*, pugi::xml_attribute&) const
PUGI__FN xml_attribute xml_node::attribute(const char_t* name_, xml_attribute& hint_) const
	{
		xml_attribute_struct* hint = hint_._attr;

		// if hint is not an attribute of node, behavior is not defined
		assert(!hint || (_root && impl::is_attribute_of(hint, _root)));

		if (!_root) return xml_attribute();

		// optimistically search from hint up until the end
		for (xml_attribute_struct* i = hint; i; i = i->next_attribute)
			if (i->name && impl::strequal(name_, i->name))
			{
				// update hint to maximize efficiency of searching for consecutive attributes
				hint_._attr = i->next_attribute;

				return xml_attribute(i);
			}

		// wrap around and search from the first attribute until the hint
		// 'j' null pointer check is technically redundant, but it prevents a crash in case the assertion above fails
		for (xml_attribute_struct* j = _root->first_attribute; j && j != hint; j = j->next_attribute)
			if (j->name && impl::strequal(name_, j->name))
			{
				// update hint to maximize efficiency of searching for consecutive attributes
				hint_._attr = j->next_attribute;

				return xml_attribute(j);
			}

		return xml_attribute();
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movb $0x1, %al
cmpq $0x0, -0x28(%rbp)
movb %al, -0x39(%rbp)
je 0x424eb
movq -0x48(%rbp), %rcx
xorl %eax, %eax
cmpq $0x0, (%rcx)
movb %al, -0x49(%rbp)
je 0x424e5
movq -0x48(%rbp), %rax
movq -0x28(%rbp), %rdi
movq (%rax), %rsi
callq 0x42630
movb %al, -0x49(%rbp)
movb -0x49(%rbp), %al
movb %al, -0x39(%rbp)
movb -0x39(%rbp), %al
testb $0x1, %al
jne 0x424f4
jmp 0x424f6
jmp 0x42515
leaq 0x28eca(%rip), %rdi     # 0x6b3c7
leaq 0x28e51(%rip), %rsi     # 0x6b355
movl $0x159e, %edx           # imm = 0x159E
leaq 0x28eee(%rip), %rcx     # 0x6b3fe
callq 0x7180
movq -0x48(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x4252d
leaq -0x8(%rbp), %rdi
callq 0x40950
jmp 0x4261a
movq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x4258f
movq -0x30(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x4257f
movq -0x18(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x421f0
testb $0x1, %al
jne 0x4255e
jmp 0x4257f
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x30(%rbp), %rsi
leaq -0x8(%rbp), %rdi
callq 0x40970
jmp 0x4261a
jmp 0x42581
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x42535
movq -0x48(%rbp), %rax
movq (%rax), %rax
movq 0x38(%rax), %rax
movq %rax, -0x38(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x38(%rbp)
movb %al, -0x4a(%rbp)
je 0x425b8
movq -0x38(%rbp), %rax
cmpq -0x28(%rbp), %rax
setne %al
movb %al, -0x4a(%rbp)
movb -0x4a(%rbp), %al
testb $0x1, %al
jne 0x425c1
jmp 0x42611
movq -0x38(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x42601
movq -0x18(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x421f0
testb $0x1, %al
jne 0x425e3
jmp 0x42601
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x38(%rbp), %rsi
leaq -0x8(%rbp), %rdi
callq 0x40970
jmp 0x4261a
jmp 0x42603
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x4259e
leaq -0x8(%rbp), %rdi
callq 0x40950
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)