// File: dlbeer[P]summary_map/./summary_map.hpp
// Function: summary_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int, summary, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, aggregator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, int>, summary>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, int>>>::sum_to(aggregator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, int>, summary> const&, summary_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int, summary, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, aggregator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, int>, summary>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, int>>>::node*, summary_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int, summary, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, aggregator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, int>, summary>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, int>>>::node*)
static summary_type sum_to(const aggregator_type& ag,
			       node *end, node *root)
    {
	summary_type sum = ag.nothing();
	node *n = end;

	while (n != root) {
	    if (n != end)
		sum = ag.combine(n->value, sum);

	    sum = ag.combine(sum_tree(ag, n->left), sum);

	    // Ascend to an ancestor which is lexicographically before
	    // n.
	    while (is_left_child(n) && n->parent != root)
		n = n->parent;

	    n = n->parent;
	}

	return sum;
    }

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x48(%rsp)
movq %rsi, 0x40(%rsp)
movq %rdx, 0x38(%rsp)
movq 0x48(%rsp), %rdi
callq 0x3900
movl %eax, 0x54(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rax
cmpq 0x38(%rsp), %rax
je 0x3c9c
movq 0x30(%rsp), %rax
cmpq 0x40(%rsp), %rax
je 0x3c00
movq 0x48(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x30(%rsp), %rsi
leaq 0x28(%rsp), %rdi
callq 0x3b60
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rsi
leaq 0x54(%rsp), %rdx
callq 0x3920
movl %eax, 0x2c(%rsp)
movl 0x2c(%rsp), %eax
movl %eax, 0x54(%rsp)
movq 0x48(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x48(%rsp), %rdi
movq 0x30(%rsp), %rax
movq 0x30(%rax), %rsi
callq 0x3d00
movq 0x10(%rsp), %rdi
movl %eax, 0x20(%rsp)
leaq 0x20(%rsp), %rsi
leaq 0x54(%rsp), %rdx
callq 0x3920
movl %eax, 0x24(%rsp)
movl 0x24(%rsp), %eax
movl %eax, 0x54(%rsp)
movq 0x30(%rsp), %rdi
callq 0x3eb0
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0xf(%rsp)
jne 0x3c5a
jmp 0x3c6f
movq 0x30(%rsp), %rax
movq 0x40(%rax), %rax
cmpq 0x38(%rsp), %rax
setne %al
movb %al, 0xf(%rsp)
movb 0xf(%rsp), %al
testb $0x1, %al
jne 0x3c79
jmp 0x3c89
movq 0x30(%rsp), %rax
movq 0x40(%rax), %rax
movq %rax, 0x30(%rsp)
jmp 0x3c41
movq 0x30(%rsp), %rax
movq 0x40(%rax), %rax
movq %rax, 0x30(%rsp)
jmp 0x3bab
movl 0x54(%rsp), %eax
addq $0x58, %rsp
retq
nopw %cs:(%rax,%rax)
nop