// File: jliesch[P]ofxget/pugixml/pugixml.cpp
// Function: pugi::impl::(anonymous namespace)::xpath_parser::parse_step(pugi::impl::(anonymous namespace)::xpath_ast_node*)
xpath_ast_node* parse_step(xpath_ast_node* set)
		{
			if (set && set->rettype() != xpath_type_node_set)
				return error("Step has to be applied to node set");

			bool axis_specified = false;
			axis_t axis = axis_child; // implied child axis

			if (_lexer.current() == lex_axis_attribute)
			{
				axis = axis_attribute;
				axis_specified = true;

				_lexer.next();
			}
			else if (_lexer.current() == lex_dot)
			{
				_lexer.next();

				if (_lexer.current() == lex_open_square_brace)
					return error("Predicates are not allowed after an abbreviated step");

				return alloc_node(ast_step, set, axis_self, nodetest_type_node, 0);
			}
			else if (_lexer.current() == lex_double_dot)
			{
				_lexer.next();

				if (_lexer.current() == lex_open_square_brace)
					return error("Predicates are not allowed after an abbreviated step");

				return alloc_node(ast_step, set, axis_parent, nodetest_type_node, 0);
			}

			nodetest_t nt_type = nodetest_none;
			xpath_lexer_string nt_name;

			if (_lexer.current() == lex_string)
			{
				// node name test
				nt_name = _lexer.contents();
				_lexer.next();

				// was it an axis name?
				if (_lexer.current() == lex_double_colon)
				{
					// parse axis name
					if (axis_specified)
						return error("Two axis specifiers in one step");

					axis = parse_axis_name(nt_name, axis_specified);

					if (!axis_specified)
						return error("Unknown axis");

					// read actual node test
					_lexer.next();

					if (_lexer.current() == lex_multiply)
					{
						nt_type = nodetest_all;
						nt_name = xpath_lexer_string();
						_lexer.next();
					}
					else if (_lexer.current() == lex_string)
					{
						nt_name = _lexer.contents();
						_lexer.next();
					}
					else
					{
						return error("Unrecognized node test");
					}
				}

				if (nt_type == nodetest_none)
				{
					// node type test or processing-instruction
					if (_lexer.current() == lex_open_brace)
					{
						_lexer.next();

						if (_lexer.current() == lex_close_brace)
						{
							_lexer.next();

							nt_type = parse_node_test_type(nt_name);

							if (nt_type == nodetest_none)
								return error("Unrecognized node type");

							nt_name = xpath_lexer_string();
						}
						else if (nt_name == PUGIXML_TEXT("processing-instruction"))
						{
							if (_lexer.current() != lex_quoted_string)
								return error("Only literals are allowed as arguments to processing-instruction()");

							nt_type = nodetest_pi;
							nt_name = _lexer.contents();
							_lexer.next();

							if (_lexer.current() != lex_close_brace)
								return error("Unmatched brace near processing-instruction()");
							_lexer.next();
						}
						else
						{
							return error("Unmatched brace near node type test");
						}
					}
					// QName or NCName:*
					else
					{
						if (nt_name.end - nt_name.begin > 2 && nt_name.end[-2] == ':' && nt_name.end[-1] == '*') // NCName:*
						{
							nt_name.end--; // erase *

							nt_type = nodetest_all_in_namespace;
						}
						else
						{
							nt_type = nodetest_name;
						}
					}
				}
			}
			else if (_lexer.current() == lex_multiply)
			{
				nt_type = nodetest_all;
				_lexer.next();
			}
			else
			{
				return error("Unrecognized node test");
			}

			const char_t* nt_name_copy = alloc_string(nt_name);
			if (!nt_name_copy) return 0;

			xpath_ast_node* n = alloc_node(ast_step, set, axis, nt_type, nt_name_copy);
			if (!n) return 0;

			xpath_ast_node* last = 0;

			while (_lexer.current() == lex_open_square_brace)
			{
				_lexer.next();

				xpath_ast_node* expr = parse_expression();
				if (!expr) return 0;

				xpath_ast_node* pred = alloc_node(ast_predicate, 0, expr, predicate_default);
				if (!pred) return 0;

				if (_lexer.current() != lex_close_square_brace)
					return error("Expected ']' to match an opening '['");
				_lexer.next();

				if (last) last->set_next(pred);
				else n->set_right(pred);

				last = pred;
			}

			return n;
		}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x88(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x5d34f
movq -0x18(%rbp), %rdi
callq 0x4b490
cmpl $0x1, %eax
je 0x5d34f
movq -0x88(%rbp), %rdi
leaq 0x1007c(%rip), %rsi     # 0x6d3bd
callq 0x5af80
movq %rax, -0x8(%rbp)
jmp 0x5d9a9
movq -0x88(%rbp), %rdi
movb $0x0, -0x19(%rbp)
movl $0x3, -0x20(%rbp)
addq $0x8, %rdi
callq 0x5af60
cmpl $0x16, %eax
jne 0x5d38f
movq -0x88(%rbp), %rdi
movl $0x2, -0x20(%rbp)
movb $0x1, -0x19(%rbp)
addq $0x8, %rdi
callq 0x5a830
jmp 0x5d49b
movq -0x88(%rbp), %rdi
addq $0x8, %rdi
callq 0x5af60
cmpl $0x17, %eax
jne 0x5d413
movq -0x88(%rbp), %rdi
addq $0x8, %rdi
callq 0x5a830
movq -0x88(%rbp), %rdi
addq $0x8, %rdi
callq 0x5af60
cmpl $0x12, %eax
jne 0x5d3e5
movq -0x88(%rbp), %rdi
leaq 0x1066a(%rip), %rsi     # 0x6da41
callq 0x5af80
movq %rax, -0x8(%rbp)
jmp 0x5d9a9
movq -0x88(%rbp), %rdi
movq -0x18(%rbp), %rdx
movl $0x38, %esi
movl $0xc, %ecx
movl $0x2, %r8d
xorl %eax, %eax
movl %eax, %r9d
callq 0x5b8b0
movq %rax, -0x8(%rbp)
jmp 0x5d9a9
movq -0x88(%rbp), %rdi
addq $0x8, %rdi
callq 0x5af60
cmpl $0x18, %eax
jne 0x5d497
movq -0x88(%rbp), %rdi
addq $0x8, %rdi
callq 0x5a830
movq -0x88(%rbp), %rdi
addq $0x8, %rdi
callq 0x5af60
cmpl $0x12, %eax
jne 0x5d469
movq -0x88(%rbp), %rdi
leaq 0x105e6(%rip), %rsi     # 0x6da41
callq 0x5af80
movq %rax, -0x8(%rbp)
jmp 0x5d9a9
movq -0x88(%rbp), %rdi
movq -0x18(%rbp), %rdx
movl $0x38, %esi
movl $0x9, %ecx
movl $0x2, %r8d
xorl %eax, %eax
movl %eax, %r9d
callq 0x5b8b0
movq %rax, -0x8(%rbp)
jmp 0x5d9a9
jmp 0x5d499
jmp 0x5d49b
movl $0x0, -0x24(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x5a810
movq -0x88(%rbp), %rdi
addq $0x8, %rdi
callq 0x5af60
cmpl $0x14, %eax
jne 0x5d7ff
movq -0x88(%rbp), %rdi
addq $0x8, %rdi
callq 0x5b700
movq -0x88(%rbp), %rdi
movq (%rax), %rcx
movq %rcx, -0x38(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
addq $0x8, %rdi
callq 0x5a830
movq -0x88(%rbp), %rdi
addq $0x8, %rdi
callq 0x5af60
cmpl $0x19, %eax
jne 0x5d624
testb $0x1, -0x19(%rbp)
je 0x5d52e
movq -0x88(%rbp), %rdi
leaq 0x10556(%rip), %rsi     # 0x6da76
callq 0x5af80
movq %rax, -0x8(%rbp)
jmp 0x5d9a9
movq -0x88(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x19(%rbp), %rdx
callq 0x5d9c0
movl %eax, -0x20(%rbp)
testb $0x1, -0x19(%rbp)
jne 0x5d567
movq -0x88(%rbp), %rdi
leaq 0x1053d(%rip), %rsi     # 0x6da96
callq 0x5af80
movq %rax, -0x8(%rbp)
jmp 0x5d9a9
movq -0x88(%rbp), %rdi
addq $0x8, %rdi
callq 0x5a830
movq -0x88(%rbp), %rdi
addq $0x8, %rdi
callq 0x5af60
cmpl $0x9, %eax
jne 0x5d5be
movl $0x7, -0x24(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x5a810
movq -0x88(%rbp), %rdi
movq -0x48(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x30(%rbp)
addq $0x8, %rdi
callq 0x5a830
jmp 0x5d622
movq -0x88(%rbp), %rdi
addq $0x8, %rdi
callq 0x5af60
cmpl $0x14, %eax
jne 0x5d604
movq -0x88(%rbp), %rdi
addq $0x8, %rdi
callq 0x5b700
movq -0x88(%rbp), %rdi
movq (%rax), %rcx
movq %rcx, -0x38(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
addq $0x8, %rdi
callq 0x5a830
jmp 0x5d620
movq -0x88(%rbp), %rdi
leaq 0x10491(%rip), %rsi     # 0x6daa3
callq 0x5af80
movq %rax, -0x8(%rbp)
jmp 0x5d9a9
jmp 0x5d622
jmp 0x5d624
cmpl $0x0, -0x24(%rbp)
jne 0x5d7fd
movq -0x88(%rbp), %rdi
addq $0x8, %rdi
callq 0x5af60
cmpl $0xc, %eax
jne 0x5d7b2
movq -0x88(%rbp), %rdi
addq $0x8, %rdi
callq 0x5a830
movq -0x88(%rbp), %rdi
addq $0x8, %rdi
callq 0x5af60
cmpl $0xd, %eax
jne 0x5d6cf
movq -0x88(%rbp), %rdi
addq $0x8, %rdi
callq 0x5a830
movq -0x88(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x5b620
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jne 0x5d6b1
movq -0x88(%rbp), %rdi
leaq 0x10417(%rip), %rsi     # 0x6daba
callq 0x5af80
movq %rax, -0x8(%rbp)
jmp 0x5d9a9
leaq -0x58(%rbp), %rdi
callq 0x5a810
movq -0x58(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x30(%rbp)
jmp 0x5d7b0
leaq -0x38(%rbp), %rdi
leaq 0xfd06(%rip), %rsi      # 0x6d3e0
callq 0x5baa0
testb $0x1, %al
jne 0x5d6e8
jmp 0x5d792
movq -0x88(%rbp), %rdi
addq $0x8, %rdi
callq 0x5af60
cmpl $0xe, %eax
je 0x5d719
movq -0x88(%rbp), %rdi
leaq 0x103c6(%rip), %rsi     # 0x6dad1
callq 0x5af80
movq %rax, -0x8(%rbp)
jmp 0x5d9a9
movq -0x88(%rbp), %rdi
movl $0x6, -0x24(%rbp)
addq $0x8, %rdi
callq 0x5b700
movq -0x88(%rbp), %rdi
movq (%rax), %rcx
movq %rcx, -0x38(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
addq $0x8, %rdi
callq 0x5a830
movq -0x88(%rbp), %rdi
addq $0x8, %rdi
callq 0x5af60
cmpl $0xd, %eax
je 0x5d780
movq -0x88(%rbp), %rdi
leaq 0x103a2(%rip), %rsi     # 0x6db14
callq 0x5af80
movq %rax, -0x8(%rbp)
jmp 0x5d9a9
movq -0x88(%rbp), %rdi
addq $0x8, %rdi
callq 0x5a830
jmp 0x5d7ae
movq -0x88(%rbp), %rdi
leaq 0x103a2(%rip), %rsi     # 0x6db42
callq 0x5af80
movq %rax, -0x8(%rbp)
jmp 0x5d9a9
jmp 0x5d7b0
jmp 0x5d7fb
movq -0x30(%rbp), %rax
movq -0x38(%rbp), %rcx
subq %rcx, %rax
cmpq $0x2, %rax
jle 0x5d7f2
movq -0x30(%rbp), %rax
movsbl -0x2(%rax), %eax
cmpl $0x3a, %eax
jne 0x5d7f2
movq -0x30(%rbp), %rax
movsbl -0x1(%rax), %eax
cmpl $0x2a, %eax
jne 0x5d7f2
movq -0x30(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x30(%rbp)
movl $0x8, -0x24(%rbp)
jmp 0x5d7f9
movl $0x1, -0x24(%rbp)
jmp 0x5d7fb
jmp 0x5d7fd
jmp 0x5d84b
movq -0x88(%rbp), %rdi
addq $0x8, %rdi
callq 0x5af60
cmpl $0x9, %eax
jne 0x5d82d
movq -0x88(%rbp), %rdi
movl $0x7, -0x24(%rbp)
addq $0x8, %rdi
callq 0x5a830
jmp 0x5d849
movq -0x88(%rbp), %rdi
leaq 0x10268(%rip), %rsi     # 0x6daa3
callq 0x5af80
movq %rax, -0x8(%rbp)
jmp 0x5d9a9
jmp 0x5d84b
movq -0x88(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x5c150
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x60(%rbp)
jne 0x5d873
movq $0x0, -0x8(%rbp)
jmp 0x5d9a9
movq -0x88(%rbp), %rdi
movq -0x18(%rbp), %rdx
movl -0x20(%rbp), %ecx
movl -0x24(%rbp), %r8d
movq -0x60(%rbp), %r9
movl $0x38, %esi
callq 0x5b8b0
movq %rax, -0x68(%rbp)
cmpq $0x0, -0x68(%rbp)
jne 0x5d8ab
movq $0x0, -0x8(%rbp)
jmp 0x5d9a9
movq $0x0, -0x70(%rbp)
movq -0x88(%rbp), %rdi
addq $0x8, %rdi
callq 0x5af60
cmpl $0x12, %eax
jne 0x5d9a1
movq -0x88(%rbp), %rdi
addq $0x8, %rdi
callq 0x5a830
movq -0x88(%rbp), %rdi
xorl %esi, %esi
callq 0x5af10
movq %rax, -0x78(%rbp)
cmpq $0x0, -0x78(%rbp)
jne 0x5d902
movq $0x0, -0x8(%rbp)
jmp 0x5d9a9
movq -0x88(%rbp), %rdi
movq -0x78(%rbp), %rcx
movl $0x10, %esi
xorl %eax, %eax
movl %eax, %edx
xorl %r8d, %r8d
callq 0x5bf50
movq %rax, -0x80(%rbp)
cmpq $0x0, -0x80(%rbp)
jne 0x5d933
movq $0x0, -0x8(%rbp)
jmp 0x5d9a9
movq -0x88(%rbp), %rdi
addq $0x8, %rdi
callq 0x5af60
cmpl $0x13, %eax
je 0x5d961
movq -0x88(%rbp), %rdi
leaq 0xfba2(%rip), %rsi      # 0x6d4f8
callq 0x5af80
movq %rax, -0x8(%rbp)
jmp 0x5d9a9
movq -0x88(%rbp), %rdi
addq $0x8, %rdi
callq 0x5a830
cmpq $0x0, -0x70(%rbp)
je 0x5d987
movq -0x70(%rbp), %rdi
movq -0x80(%rbp), %rsi
callq 0x5c380
jmp 0x5d994
movq -0x68(%rbp), %rdi
movq -0x80(%rbp), %rsi
callq 0x5dc00
movq -0x80(%rbp), %rax
movq %rax, -0x70(%rbp)
jmp 0x5d8b3
movq -0x68(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)