// File: jliesch[P]ofxget/pugixml/pugixml.cpp
// Function: pugi::impl::(anonymous namespace)::xpath_ast_node::eval_node_set(pugi::impl::(anonymous namespace)::xpath_context const&, pugi::impl::(anonymous namespace)::xpath_stack const&, pugi::impl::(anonymous namespace)::nodeset_eval_t)
xpath_node_set_raw eval_node_set(const xpath_context& c, const xpath_stack& stack, nodeset_eval_t eval)
		{
			switch (_type)
			{
			case ast_op_union:
			{
				xpath_allocator_capture cr(stack.temp);

				xpath_stack swapped_stack = {stack.temp, stack.result};

				xpath_node_set_raw ls = _left->eval_node_set(c, swapped_stack, eval);
				xpath_node_set_raw rs = _right->eval_node_set(c, stack, eval);

				// we can optimize merging two sorted sets, but this is a very rare operation, so don't bother
				rs.set_type(xpath_node_set::type_unsorted);

				rs.append(ls.begin(), ls.end(), stack.result);
				rs.remove_duplicates();

				return rs;
			}

			case ast_filter:
			{
				xpath_node_set_raw set = _left->eval_node_set(c, stack, _test == predicate_constant_one ? nodeset_eval_first : nodeset_eval_all);

				// either expression is a number or it contains position() call; sort by document order
				if (_test != predicate_posinv) set.sort_do();

				bool once = eval_once(set.type(), eval);

				apply_predicate(set, 0, stack, once);

				return set;
			}

			case ast_func_id:
				return xpath_node_set_raw();

			case ast_step:
			{
				switch (_axis)
				{
				case axis_ancestor:
					return step_do(c, stack, eval, axis_to_type<axis_ancestor>());

				case axis_ancestor_or_self:
					return step_do(c, stack, eval, axis_to_type<axis_ancestor_or_self>());

				case axis_attribute:
					return step_do(c, stack, eval, axis_to_type<axis_attribute>());

				case axis_child:
					return step_do(c, stack, eval, axis_to_type<axis_child>());

				case axis_descendant:
					return step_do(c, stack, eval, axis_to_type<axis_descendant>());

				case axis_descendant_or_self:
					return step_do(c, stack, eval, axis_to_type<axis_descendant_or_self>());

				case axis_following:
					return step_do(c, stack, eval, axis_to_type<axis_following>());

				case axis_following_sibling:
					return step_do(c, stack, eval, axis_to_type<axis_following_sibling>());

				case axis_namespace:
					// namespaced axis is not supported
					return xpath_node_set_raw();

				case axis_parent:
					return step_do(c, stack, eval, axis_to_type<axis_parent>());

				case axis_preceding:
					return step_do(c, stack, eval, axis_to_type<axis_preceding>());

				case axis_preceding_sibling:
					return step_do(c, stack, eval, axis_to_type<axis_preceding_sibling>());

				case axis_self:
					return step_do(c, stack, eval, axis_to_type<axis_self>());

				default:
					assert(false && "Unknown axis"); // unreachable
					return xpath_node_set_raw();
				}
			}

			case ast_step_root:
			{
				assert(!_right); // root step can't have any predicates

				xpath_node_set_raw ns;

				ns.set_type(xpath_node_set::type_sorted);

				if (c.n.node()) ns.push_back(c.n.node().root(), stack.result);
				else if (c.n.attribute()) ns.push_back(c.n.parent().root(), stack.result);

				return ns;
			}

			case ast_variable:
			{
				assert(_rettype == _data.variable->type());

				if (_rettype == xpath_type_node_set)
				{
					const xpath_node_set& s = _data.variable->get_node_set();

					xpath_node_set_raw ns;

					ns.set_type(s.type());
					ns.append(s.begin(), s.end(), stack.result);

					return ns;
				}
			}

			// fallthrough
			default:
				assert(false && "Wrong expression for return type node set"); // unreachable
				return xpath_node_set_raw();
			}
		}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movq %rdi, -0x108(%rbp)
movq %rdi, -0x100(%rbp)
movq %rsi, -0x8(%rbp)
movq %rdx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movl %r8d, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xf8(%rbp)
movsbl (%rax), %eax
addl $-0xf, %eax
movl %eax, %ecx
movq %rcx, -0xf0(%rbp)
subl $0x2a, %eax
ja 0x4ecfc
movq -0xf0(%rbp), %rax
leaq 0x1c396(%rip), %rcx     # 0x6aac0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rsi
leaq -0x40(%rbp), %rdi
callq 0x607e0
movq -0xf8(%rbp), %rax
movq -0x18(%rbp), %rcx
movq 0x8(%rcx), %rcx
movq %rcx, -0x50(%rbp)
movq -0x18(%rbp), %rcx
movq (%rcx), %rcx
movq %rcx, -0x48(%rbp)
movq 0x8(%rax), %rsi
movq -0x10(%rbp), %rdx
movl -0x1c(%rbp), %r8d
leaq -0x70(%rbp), %rdi
leaq -0x50(%rbp), %rcx
callq 0x4e6d0
jmp 0x4e77d
movq -0x108(%rbp), %rdi
movq -0xf8(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movl -0x1c(%rbp), %r8d
callq 0x4e6d0
jmp 0x4e7a2
movq -0x108(%rbp), %rdi
xorl %esi, %esi
callq 0x626d0
jmp 0x4e7b2
leaq -0x70(%rbp), %rdi
callq 0x4ed40
movq %rax, -0x110(%rbp)
jmp 0x4e7c4
leaq -0x70(%rbp), %rdi
callq 0x4ed60
movq %rax, -0x118(%rbp)
jmp 0x4e7d6
movq -0x118(%rbp), %rdx
movq -0x110(%rbp), %rsi
movq -0x108(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rcx
callq 0x626f0
jmp 0x4e7f9
movq -0x108(%rbp), %rdi
callq 0x62810
jmp 0x4e807
leaq -0x40(%rbp), %rdi
callq 0x60890
jmp 0x4ed1b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x60890
jmp 0x4ed2b
movq -0xf8(%rbp), %rax
movq -0x108(%rbp), %rdi
movq 0x8(%rax), %rsi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movsbl 0x3(%rax), %r9d
xorl %r8d, %r8d
movl $0x2, %eax
cmpl $0x3, %r9d
cmovel %eax, %r8d
callq 0x4e6d0
movq -0xf8(%rbp), %rax
movsbl 0x3(%rax), %eax
cmpl $0x1, %eax
je 0x4e87f
movq -0x108(%rbp), %rdi
callq 0x62860
movq -0x108(%rbp), %rdi
callq 0x4ed80
movl %eax, %edi
movl -0x1c(%rbp), %esi
callq 0x628a0
movq -0xf8(%rbp), %rdi
movq -0x108(%rbp), %rsi
andb $0x1, %al
movb %al, -0x7d(%rbp)
movq -0x18(%rbp), %rcx
movb -0x7d(%rbp), %al
xorl %edx, %edx
andb $0x1, %al
movzbl %al, %r8d
callq 0x628d0
jmp 0x4ed1b
movq -0x108(%rbp), %rdi
callq 0x629f0
jmp 0x4ed1b
movq -0xf8(%rbp), %rax
movsbl 0x2(%rax), %eax
movl %eax, %ecx
movq %rcx, -0x120(%rbp)
subl $0xc, %eax
ja 0x4eac7
movq -0x120(%rbp), %rax
leaq 0x1c26f(%rip), %rcx     # 0x6ab6c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0xf8(%rbp), %rsi
movq -0x108(%rbp), %rdi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movl -0x1c(%rbp), %r8d
callq 0x62a20
jmp 0x4ed1b
movq -0xf8(%rbp), %rsi
movq -0x108(%rbp), %rdi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movl -0x1c(%rbp), %r8d
callq 0x62c60
jmp 0x4ed1b
movq -0xf8(%rbp), %rsi
movq -0x108(%rbp), %rdi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movl -0x1c(%rbp), %r8d
callq 0x62ea0
jmp 0x4ed1b
movq -0xf8(%rbp), %rsi
movq -0x108(%rbp), %rdi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movl -0x1c(%rbp), %r8d
callq 0x630c0
jmp 0x4ed1b
movq -0xf8(%rbp), %rsi
movq -0x108(%rbp), %rdi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movl -0x1c(%rbp), %r8d
callq 0x632e0
jmp 0x4ed1b
movq -0xf8(%rbp), %rsi
movq -0x108(%rbp), %rdi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movl -0x1c(%rbp), %r8d
callq 0x63520
jmp 0x4ed1b
movq -0xf8(%rbp), %rsi
movq -0x108(%rbp), %rdi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movl -0x1c(%rbp), %r8d
callq 0x63760
jmp 0x4ed1b
movq -0xf8(%rbp), %rsi
movq -0x108(%rbp), %rdi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movl -0x1c(%rbp), %r8d
callq 0x639a0
jmp 0x4ed1b
movq -0x108(%rbp), %rdi
callq 0x629f0
jmp 0x4ed1b
movq -0xf8(%rbp), %rsi
movq -0x108(%rbp), %rdi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movl -0x1c(%rbp), %r8d
callq 0x63be0
jmp 0x4ed1b
movq -0xf8(%rbp), %rsi
movq -0x108(%rbp), %rdi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movl -0x1c(%rbp), %r8d
callq 0x63e20
jmp 0x4ed1b
movq -0xf8(%rbp), %rsi
movq -0x108(%rbp), %rdi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movl -0x1c(%rbp), %r8d
callq 0x64060
jmp 0x4ed1b
movq -0xf8(%rbp), %rsi
movq -0x108(%rbp), %rdi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movl -0x1c(%rbp), %r8d
callq 0x642a0
jmp 0x4ed1b
leaq 0x1fc8e(%rip), %rdi     # 0x6e75c
leaq 0x1c880(%rip), %rsi     # 0x6b355
movl $0x2a3b, %edx           # imm = 0x2A3B
leaq 0x1fc93(%rip), %rcx     # 0x6e774
callq 0x7180
movq -0xf8(%rbp), %rax
cmpq $0x0, 0x10(%rax)
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x4eafd
jmp 0x4eaff
jmp 0x4eb1e
leaq 0x1fcfe(%rip), %rdi     # 0x6e804
leaq 0x1c848(%rip), %rsi     # 0x6b355
movl $0x2a42, %edx           # imm = 0x2A42
leaq 0x1fc5b(%rip), %rcx     # 0x6e774
callq 0x7180
movq -0x108(%rbp), %rdi
callq 0x629f0
movq -0x108(%rbp), %rdi
movl $0x1, %esi
callq 0x626d0
movq -0x10(%rbp), %rdi
callq 0x49680
movq %rax, -0x98(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x41c30
cmpq $0x0, %rax
je 0x4ebaf
movq -0x10(%rbp), %rdi
callq 0x49680
movq %rax, -0xb8(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x42730
movq %rax, -0xb0(%rbp)
leaq -0xa8(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x495f0
movq -0x108(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rdx
leaq -0xa8(%rbp), %rsi
callq 0x644c0
jmp 0x4ec23
movq -0x10(%rbp), %rdi
callq 0x496d0
movq %rax, -0xc0(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x40990
cmpq $0x0, %rax
je 0x4ec21
movq -0x10(%rbp), %rdi
callq 0x496f0
movq %rax, -0xe0(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x42730
movq %rax, -0xd8(%rbp)
leaq -0xd0(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x495f0
movq -0x108(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rdx
leaq -0xd0(%rbp), %rsi
callq 0x644c0
jmp 0x4ec23
jmp 0x4ed1b
movq -0xf8(%rbp), %rax
movsbl 0x1(%rax), %ecx
movl %ecx, -0x124(%rbp)
movq 0x20(%rax), %rdi
callq 0x4a1d0
movl %eax, %ecx
movl -0x124(%rbp), %eax
cmpl %ecx, %eax
jne 0x4ec50
jmp 0x4ec6f
leaq 0x1f0b7(%rip), %rdi     # 0x6dd0e
leaq 0x1c6f7(%rip), %rsi     # 0x6b355
movl $0x2a50, %edx           # imm = 0x2A50
leaq 0x1fb0a(%rip), %rcx     # 0x6e774
callq 0x7180
movq -0xf8(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x1, %eax
jne 0x4ecfa
movq -0xf8(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x4a2d0
movq -0x108(%rbp), %rdi
movq %rax, -0xe8(%rbp)
callq 0x629f0
movq -0xe8(%rbp), %rdi
callq 0x49da0
movq -0x108(%rbp), %rdi
movl %eax, %esi
callq 0x626d0
movq -0xe8(%rbp), %rdi
callq 0x49e60
movq %rax, -0x130(%rbp)
movq -0xe8(%rbp), %rdi
callq 0x49e80
movq -0x108(%rbp), %rdi
movq -0x130(%rbp), %rsi
movq %rax, %rdx
movq -0x18(%rbp), %rax
movq (%rax), %rcx
callq 0x626f0
jmp 0x4ed1b
jmp 0x4ecfc
leaq 0x1fb09(%rip), %rdi     # 0x6e80c
leaq 0x1c64b(%rip), %rsi     # 0x6b355
movl $0x2a61, %edx           # imm = 0x2A61
leaq 0x1fa5e(%rip), %rcx     # 0x6e774
callq 0x7180
movq -0x100(%rbp), %rax
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
movq -0x78(%rbp), %rdi
callq 0x7600
nopw %cs:(%rax,%rax)