// File: adamiaonr[P]rid-analytics/src/pugixml.cpp
// Function: pugi::impl::(anonymous namespace)::xpath_ast_node::eval_string_concat(pugi::impl::(anonymous namespace)::xpath_context const&, pugi::impl::(anonymous namespace)::xpath_stack const&)
xpath_string eval_string_concat(const xpath_context& c, const xpath_stack& stack)
		{
			assert(_type == ast_func_concat);

			xpath_allocator_capture ct(stack.temp);

			// count the string number
			size_t count = 1;
			for (xpath_ast_node* nc = _right; nc; nc = nc->_next) count++;

			// gather all strings
			xpath_string static_buffer[4];
			xpath_string* buffer = static_buffer;

			// allocate on-heap for large concats
			if (count > sizeof(static_buffer) / sizeof(static_buffer[0]))
			{
				buffer = static_cast<xpath_string*>(stack.temp->allocate(count * sizeof(xpath_string)));
				assert(buffer);
			}

			// evaluate all strings to temporary stack
			xpath_stack swapped_stack = {stack.temp, stack.result};

			buffer[0] = _left->eval_string(c, swapped_stack);

			size_t pos = 1;
			for (xpath_ast_node* n = _right; n; n = n->_next, ++pos) buffer[pos] = n->eval_string(c, swapped_stack);
			assert(pos == count);

			// get total length
			size_t length = 0;
			for (size_t i = 0; i < count; ++i) length += buffer[i].length();

			// create final string
			char_t* result = static_cast<char_t*>(stack.result->allocate((length + 1) * sizeof(char_t)));
			assert(result);

			char_t* ri = result;

			for (size_t j = 0; j < count; ++j)
				for (const char_t* bi = buffer[j].c_str(); *bi; ++bi)
					*ri++ = *bi;

			*ri = 0;

			return xpath_string::from_heap_preallocated(result, ri);
		}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x190, %rsp            # imm = 0x190
movq %rdi, -0x150(%rbp)
movq %rdi, -0x148(%rbp)
movq %rsi, -0x8(%rbp)
movq %rdx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x140(%rbp)
movsbl (%rax), %eax
cmpl $0x21, %eax
jne 0x266aa
jmp 0x266c9
leaq 0x3b537(%rip), %rdi     # 0x61be8
leaq 0x384bd(%rip), %rsi     # 0x5eb75
movl $0x2886, %edx           # imm = 0x2886
leaq 0x3b53d(%rip), %rcx     # 0x61c01
callq 0x5310
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rsi
leaq -0x30(%rbp), %rdi
callq 0x24520
movq -0x140(%rbp), %rax
movq $0x1, -0x38(%rbp)
movq 0x10(%rax), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x26712
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x40(%rbp)
jmp 0x266f1
leaq -0xa0(%rbp), %rax
movq %rax, %rcx
addq $0x60, %rcx
movq %rcx, -0x160(%rbp)
movq %rax, -0x158(%rbp)
movq -0x158(%rbp), %rdi
movq %rdi, -0x168(%rbp)
callq 0x25fb0
jmp 0x26743
movq -0x160(%rbp), %rcx
movq -0x168(%rbp), %rax
addq $0x18, %rax
cmpq %rcx, %rax
movq %rax, -0x158(%rbp)
jne 0x2672e
leaq -0xa0(%rbp), %rax
movq %rax, -0xb8(%rbp)
cmpq $0x4, -0x38(%rbp)
jbe 0x267f3
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x38(%rbp), %rax
shlq $0x3, %rax
leaq (%rax,%rax,2), %rsi
callq 0x263a0
movq %rax, -0x170(%rbp)
jmp 0x26798
movq -0x170(%rbp), %rax
movq %rax, -0xb8(%rbp)
cmpq $0x0, -0xb8(%rbp)
je 0x267b2
jmp 0x267f1
leaq 0x3b4c7(%rip), %rdi     # 0x61c80
leaq 0x383b5(%rip), %rsi     # 0x5eb75
movl $0x2896, %edx           # imm = 0x2896
leaq 0x3b435(%rip), %rcx     # 0x61c01
callq 0x5310
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x25a20
jmp 0x26ae7
jmp 0x267f3
movq -0x140(%rbp), %rax
movq -0x18(%rbp), %rcx
movq 0x8(%rcx), %rcx
movq %rcx, -0xc8(%rbp)
movq -0x18(%rbp), %rcx
movq (%rcx), %rcx
movq %rcx, -0xc0(%rbp)
movq 0x8(%rax), %rsi
movq -0x10(%rbp), %rdx
leaq -0xe0(%rbp), %rdi
leaq -0xc8(%rbp), %rcx
callq 0x24550
jmp 0x26834
movq -0x140(%rbp), %rax
movq -0xb8(%rbp), %rcx
movq -0xe0(%rbp), %rdx
movq %rdx, (%rcx)
movq -0xd8(%rbp), %rdx
movq %rdx, 0x8(%rcx)
movq -0xd0(%rbp), %rdx
movq %rdx, 0x10(%rcx)
movq $0x1, -0xe8(%rbp)
movq 0x10(%rax), %rax
movq %rax, -0xf0(%rbp)
cmpq $0x0, -0xf0(%rbp)
je 0x268fd
movq -0xf0(%rbp), %rsi
movq -0x10(%rbp), %rdx
leaq -0x108(%rbp), %rdi
leaq -0xc8(%rbp), %rcx
callq 0x24550
jmp 0x268a2
movq -0xb8(%rbp), %rax
imulq $0x18, -0xe8(%rbp), %rcx
addq %rcx, %rax
movq -0x108(%rbp), %rcx
movq %rcx, (%rax)
movq -0x100(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0xf8(%rbp), %rcx
movq %rcx, 0x10(%rax)
movq -0xf0(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0xf0(%rbp)
movq -0xe8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xe8(%rbp)
jmp 0x26878
movq -0xe8(%rbp), %rax
cmpq -0x38(%rbp), %rax
jne 0x2690c
jmp 0x2692b
leaq 0x3b374(%rip), %rdi     # 0x61c87
leaq 0x3825b(%rip), %rsi     # 0x5eb75
movl $0x28a0, %edx           # imm = 0x28A0
leaq 0x3b2db(%rip), %rcx     # 0x61c01
callq 0x5310
movq $0x0, -0x110(%rbp)
movq $0x0, -0x118(%rbp)
movq -0x118(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x2699b
movq -0xb8(%rbp), %rax
movq -0x118(%rbp), %rcx
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,8), %rdi
callq 0x11fc0
movq %rax, -0x178(%rbp)
jmp 0x26972
movq -0x178(%rbp), %rax
addq -0x110(%rbp), %rax
movq %rax, -0x110(%rbp)
movq -0x118(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x118(%rbp)
jmp 0x26941
movq -0x18(%rbp), %rax
movq (%rax), %rdi
movq -0x110(%rbp), %rsi
incq %rsi
callq 0x263a0
movq %rax, -0x180(%rbp)
jmp 0x269ba
movq -0x180(%rbp), %rax
movq %rax, -0x120(%rbp)
cmpq $0x0, -0x120(%rbp)
je 0x269d4
jmp 0x269f3
leaq 0x3ae60(%rip), %rdi     # 0x6183b
leaq 0x38193(%rip), %rsi     # 0x5eb75
movl $0x28a8, %edx           # imm = 0x28A8
leaq 0x3b213(%rip), %rcx     # 0x61c01
callq 0x5310
movq -0x120(%rbp), %rax
movq %rax, -0x128(%rbp)
movq $0x0, -0x130(%rbp)
movq -0x130(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x26aa8
movq -0xb8(%rbp), %rax
movq -0x130(%rbp), %rcx
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,8), %rdi
callq 0x11fa0
movq %rax, -0x188(%rbp)
jmp 0x26a41
movq -0x188(%rbp), %rax
movq %rax, -0x138(%rbp)
movq -0x138(%rbp), %rax
cmpb $0x0, (%rax)
je 0x26a8f
movq -0x138(%rbp), %rax
movb (%rax), %cl
movq -0x128(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x128(%rbp)
movb %cl, (%rax)
movq -0x138(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x138(%rbp)
jmp 0x26a4f
jmp 0x26a91
movq -0x130(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x130(%rbp)
jmp 0x26a0c
movq -0x150(%rbp), %rdi
movq -0x128(%rbp), %rax
movb $0x0, (%rax)
movq -0x120(%rbp), %rsi
movq -0x128(%rbp), %rdx
callq 0x26d90
jmp 0x26ace
leaq -0x30(%rbp), %rdi
callq 0x25a20
movq -0x148(%rbp), %rax
addq $0x190, %rsp            # imm = 0x190
popq %rbp
retq
movq -0xa8(%rbp), %rdi
callq 0x5920
nopw %cs:(%rax,%rax)