// File: adamiaonr[P]rid-analytics/src/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)
				throw_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();

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

				return new (alloc_node()) xpath_ast_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) throw_error("Two axis specifiers in one step");

					axis = parse_axis_name(nt_name, axis_specified);

					if (!axis_specified) throw_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 throw_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) throw_error("Unrecognized node type");

							nt_name = xpath_lexer_string();
						}
						else if (nt_name == PUGIXML_TEXT("processing-instruction"))
						{
							if (_lexer.current() != lex_quoted_string)
								throw_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)
								throw_error("Unmatched brace near processing-instruction()");
							_lexer.next();
						}
						else
							throw_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 throw_error("Unrecognized node test");

			xpath_ast_node* n = new (alloc_node()) xpath_ast_node(ast_step, set, axis, nt_type, alloc_string(nt_name));

			xpath_ast_node* last = 0;

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

				xpath_ast_node* expr = parse_expression();

				xpath_ast_node* pred = new (alloc_node()) xpath_ast_node(ast_predicate, 0, expr, predicate_default);

				if (_lexer.current() != lex_close_square_brace)
					throw_error("Unmatched square brace");
				_lexer.next();

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

				last = pred;
			}

			return n;
		}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x80(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x214b0
movq -0x18(%rbp), %rdi
callq 0x10790
cmpl $0x1, %eax
je 0x214b0
movq -0x80(%rbp), %rdi
leaq 0x3f806(%rip), %rsi     # 0x60cb1
callq 0x1eef0
movq -0x80(%rbp), %rdi
movb $0x0, -0x19(%rbp)
movl $0x3, -0x20(%rbp)
addq $0x8, %rdi
callq 0x1eed0
cmpl $0x16, %eax
jne 0x214ea
movq -0x80(%rbp), %rdi
movl $0x2, -0x20(%rbp)
movb $0x1, -0x19(%rbp)
addq $0x8, %rdi
callq 0x1e7c0
jmp 0x215ae
movq -0x80(%rbp), %rdi
addq $0x8, %rdi
callq 0x1eed0
cmpl $0x17, %eax
jne 0x2154a
movq -0x80(%rbp), %rdi
addq $0x8, %rdi
callq 0x1e7c0
movq -0x80(%rbp), %rdi
callq 0x1f650
movq %rax, %rdi
movq %rdi, -0x88(%rbp)
movq -0x18(%rbp), %rdx
movl $0x38, %esi
movl $0xc, %ecx
movl $0x2, %r8d
xorl %eax, %eax
movl %eax, %r9d
callq 0x1fcc0
movq -0x88(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x219f8
movq -0x80(%rbp), %rdi
addq $0x8, %rdi
callq 0x1eed0
cmpl $0x18, %eax
jne 0x215aa
movq -0x80(%rbp), %rdi
addq $0x8, %rdi
callq 0x1e7c0
movq -0x80(%rbp), %rdi
callq 0x1f650
movq %rax, %rdi
movq %rdi, -0x90(%rbp)
movq -0x18(%rbp), %rdx
movl $0x38, %esi
movl $0x9, %ecx
movl $0x2, %r8d
xorl %eax, %eax
movl %eax, %r9d
callq 0x1fcc0
movq -0x90(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x219f8
jmp 0x215ac
jmp 0x215ae
movl $0x0, -0x24(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x1e7a0
movq -0x80(%rbp), %rdi
addq $0x8, %rdi
callq 0x1eed0
cmpl $0x14, %eax
jne 0x2187f
movq -0x80(%rbp), %rdi
addq $0x8, %rdi
callq 0x1f6e0
movq -0x80(%rbp), %rdi
movq (%rax), %rcx
movq %rcx, -0x38(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
addq $0x8, %rdi
callq 0x1e7c0
movq -0x80(%rbp), %rdi
addq $0x8, %rdi
callq 0x1eed0
cmpl $0x19, %eax
jne 0x216f2
testb $0x1, -0x19(%rbp)
je 0x21629
movq -0x80(%rbp), %rdi
leaq 0x3fcbd(%rip), %rsi     # 0x612e1
callq 0x1eef0
movq -0x80(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x19(%rbp), %rdx
callq 0x21a10
movl %eax, -0x20(%rbp)
testb $0x1, -0x19(%rbp)
jne 0x21653
movq -0x80(%rbp), %rdi
leaq 0x3fcb3(%rip), %rsi     # 0x61301
callq 0x1eef0
movq -0x80(%rbp), %rdi
addq $0x8, %rdi
callq 0x1e7c0
movq -0x80(%rbp), %rdi
addq $0x8, %rdi
callq 0x1eed0
cmpl $0x9, %eax
jne 0x216a1
movl $0x7, -0x24(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x1e7a0
movq -0x80(%rbp), %rdi
movq -0x48(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x30(%rbp)
addq $0x8, %rdi
callq 0x1e7c0
jmp 0x216f0
movq -0x80(%rbp), %rdi
addq $0x8, %rdi
callq 0x1eed0
cmpl $0x14, %eax
jne 0x216de
movq -0x80(%rbp), %rdi
addq $0x8, %rdi
callq 0x1f6e0
movq -0x80(%rbp), %rdi
movq (%rax), %rcx
movq %rcx, -0x38(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
addq $0x8, %rdi
callq 0x1e7c0
jmp 0x216ee
movq -0x80(%rbp), %rdi
leaq 0x3fc25(%rip), %rsi     # 0x6130e
callq 0x1eef0
jmp 0x216f0
jmp 0x216f2
cmpl $0x0, -0x24(%rbp)
jne 0x2187d
movq -0x80(%rbp), %rdi
addq $0x8, %rdi
callq 0x1eed0
cmpl $0xc, %eax
jne 0x21832
movq -0x80(%rbp), %rdi
addq $0x8, %rdi
callq 0x1e7c0
movq -0x80(%rbp), %rdi
addq $0x8, %rdi
callq 0x1eed0
cmpl $0xd, %eax
jne 0x21782
movq -0x80(%rbp), %rdi
addq $0x8, %rdi
callq 0x1e7c0
movq -0x80(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x1fb00
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jne 0x21764
movq -0x80(%rbp), %rdi
leaq 0x3fbc6(%rip), %rsi     # 0x61325
callq 0x1eef0
leaq -0x58(%rbp), %rdi
callq 0x1e7a0
movq -0x58(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x30(%rbp)
jmp 0x21830
leaq -0x38(%rbp), %rdi
leaq 0x3f547(%rip), %rsi     # 0x60cd4
callq 0x1f770
testb $0x1, %al
jne 0x2179b
jmp 0x2181e
movq -0x80(%rbp), %rdi
addq $0x8, %rdi
callq 0x1eed0
cmpl $0xe, %eax
je 0x217bd
movq -0x80(%rbp), %rdi
leaq 0x3fb84(%rip), %rsi     # 0x6133c
callq 0x1eef0
movq -0x80(%rbp), %rdi
movl $0x6, -0x24(%rbp)
addq $0x8, %rdi
callq 0x1f6e0
movq -0x80(%rbp), %rdi
movq (%rax), %rcx
movq %rcx, -0x38(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
addq $0x8, %rdi
callq 0x1e7c0
movq -0x80(%rbp), %rdi
addq $0x8, %rdi
callq 0x1eed0
cmpl $0xd, %eax
je 0x2180f
movq -0x80(%rbp), %rdi
leaq 0x3fb75(%rip), %rsi     # 0x6137f
callq 0x1eef0
movq -0x80(%rbp), %rdi
addq $0x8, %rdi
callq 0x1e7c0
jmp 0x2182e
movq -0x80(%rbp), %rdi
leaq 0x3fb84(%rip), %rsi     # 0x613ad
callq 0x1eef0
jmp 0x21830
jmp 0x2187b
movq -0x30(%rbp), %rax
movq -0x38(%rbp), %rcx
subq %rcx, %rax
cmpq $0x2, %rax
jle 0x21872
movq -0x30(%rbp), %rax
movsbl -0x2(%rax), %eax
cmpl $0x3a, %eax
jne 0x21872
movq -0x30(%rbp), %rax
movsbl -0x1(%rax), %eax
cmpl $0x2a, %eax
jne 0x21872
movq -0x30(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x30(%rbp)
movl $0x8, -0x24(%rbp)
jmp 0x21879
movl $0x1, -0x24(%rbp)
jmp 0x2187b
jmp 0x2187d
jmp 0x218b9
movq -0x80(%rbp), %rdi
addq $0x8, %rdi
callq 0x1eed0
cmpl $0x9, %eax
jne 0x218a7
movq -0x80(%rbp), %rdi
movl $0x7, -0x24(%rbp)
addq $0x8, %rdi
callq 0x1e7c0
jmp 0x218b7
movq -0x80(%rbp), %rdi
leaq 0x3fa5c(%rip), %rsi     # 0x6130e
callq 0x1eef0
jmp 0x218b9
movq -0x80(%rbp), %rdi
callq 0x1f650
movq -0x80(%rbp), %rdi
movq %rax, -0x98(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0xa8(%rbp)
movl -0x20(%rbp), %eax
movl %eax, -0xa0(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x9c(%rbp)
leaq -0x38(%rbp), %rsi
callq 0x204b0
movq -0xa8(%rbp), %rdx
movl -0xa0(%rbp), %ecx
movl -0x9c(%rbp), %r8d
movq -0x98(%rbp), %rdi
movq %rax, %r9
movl $0x38, %esi
callq 0x1fcc0
movq -0x98(%rbp), %rax
movq %rax, -0x60(%rbp)
movq $0x0, -0x68(%rbp)
movq -0x80(%rbp), %rdi
addq $0x8, %rdi
callq 0x1eed0
cmpl $0x12, %eax
jne 0x219f0
movq -0x80(%rbp), %rdi
addq $0x8, %rdi
callq 0x1e7c0
movq -0x80(%rbp), %rdi
callq 0x1eea0
movq -0x80(%rbp), %rdi
movq %rax, -0x70(%rbp)
callq 0x1f650
movq %rax, %rdi
movq %rdi, -0xb0(%rbp)
movq -0x70(%rbp), %rcx
movl $0x10, %esi
xorl %eax, %eax
movl %eax, %edx
xorl %r8d, %r8d
callq 0x202c0
movq -0xb0(%rbp), %rax
movq -0x80(%rbp), %rdi
movq %rax, -0x78(%rbp)
addq $0x8, %rdi
callq 0x1eed0
cmpl $0x13, %eax
je 0x219b3
movq -0x80(%rbp), %rdi
leaq 0x3f36a(%rip), %rsi     # 0x60d18
callq 0x1eef0
movq -0x80(%rbp), %rdi
addq $0x8, %rdi
callq 0x1e7c0
cmpq $0x0, -0x68(%rbp)
je 0x219d6
movq -0x68(%rbp), %rdi
movq -0x78(%rbp), %rsi
callq 0x20760
jmp 0x219e3
movq -0x60(%rbp), %rdi
movq -0x78(%rbp), %rsi
callq 0x21c50
movq -0x78(%rbp), %rax
movq %rax, -0x68(%rbp)
jmp 0x2192e
movq -0x60(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0xb0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)