// File: wichtounet[P]articles/plf_colony_alpha/plf_timsort.h
// Function: plf::TimSort<Trivial<8>**, plf::colony<Trivial<8>, std::allocator<Trivial<8>>, unsigned short>::sort_dereferencer<plf::colony<Trivial<8>, std::allocator<Trivial<8>>, unsigned short>::less>>::mergeAt(long)
void mergeAt(diff_t const i)
	{
		diff_t const stackSize = pending_.size();
		assert(stackSize >= 2);
		assert(i >= 0);
		assert(i == stackSize - 2 || i == stackSize - 3);

		iter_t base1 = pending_[i].base;
		diff_t len1 = pending_[i].len;
		iter_t base2 = pending_[i + 1].base;
		diff_t len2 = pending_[i + 1].len;

		assert(len1 > 0 && len2 > 0);
		assert(base1 + len1 == base2);

		pending_[i].len = len1 + len2;

		if (i == stackSize - 3)
		{
			pending_[i + 1] = pending_[i + 2];
		}

		pending_.pop_back();

		diff_t const k = gallopRight(*base2, base1, len1, 0);
		assert(k >= 0);

		base1 += k;
		len1 -= k;

		if (len1 == 0)
		{
			return;
		}

		len2 = gallopLeft(*(base1 + (len1 - 1)), base2, len2, len2 - 1);
		assert(len2 >= 0);
		if (len2 == 0)
		{
			return;
		}

		if (len1 <= len2)
		{
			mergeLo(base1, len1, base2, len2);
		}
		else
		{
			mergeHi(base1, len1, base2, len2);
		}
	}

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x50(%rsp)
movq %rsi, 0x48(%rsp)
movq 0x50(%rsp), %rdi
movq %rdi, 0x8(%rsp)
addq $0x20, %rdi
callq 0xe68a0
movq 0x8(%rsp), %rdi
movq %rax, 0x40(%rsp)
addq $0x20, %rdi
movq 0x48(%rsp), %rsi
callq 0xe6c00
movq 0x8(%rsp), %rdi
movq (%rax), %rax
movq %rax, 0x38(%rsp)
addq $0x20, %rdi
movq 0x48(%rsp), %rsi
callq 0xe6c00
movq 0x8(%rsp), %rdi
movq 0x8(%rax), %rax
movq %rax, 0x30(%rsp)
addq $0x20, %rdi
movq 0x48(%rsp), %rsi
addq $0x1, %rsi
callq 0xe6c00
movq 0x8(%rsp), %rdi
movq (%rax), %rax
movq %rax, 0x28(%rsp)
addq $0x20, %rdi
movq 0x48(%rsp), %rsi
addq $0x1, %rsi
callq 0xe6c00
movq 0x8(%rsp), %rdi
movq 0x8(%rax), %rax
movq %rax, 0x20(%rsp)
movq 0x30(%rsp), %rax
addq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
addq $0x20, %rdi
movq 0x48(%rsp), %rsi
callq 0xe6c00
movq 0x10(%rsp), %rcx
movq %rcx, 0x8(%rax)
movq 0x48(%rsp), %rax
movq 0x40(%rsp), %rcx
subq $0x3, %rcx
cmpq %rcx, %rax
jne 0xe6d3e
movq 0x8(%rsp), %rdi
addq $0x20, %rdi
movq 0x48(%rsp), %rsi
addq $0x2, %rsi
callq 0xe6c00
movq 0x8(%rsp), %rdi
movq %rax, (%rsp)
addq $0x20, %rdi
movq 0x48(%rsp), %rsi
addq $0x1, %rsi
callq 0xe6c00
movq (%rsp), %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rcx
movq %rcx, 0x8(%rax)
movq 0x8(%rsp), %rdi
addq $0x20, %rdi
callq 0xe6e40
movq 0x8(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq 0x38(%rsp), %rdx
movq 0x30(%rsp), %rcx
xorl %eax, %eax
movl %eax, %r8d
callq 0xe6e60
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rax
shlq $0x3, %rax
addq 0x38(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x18(%rsp), %rcx
movq 0x30(%rsp), %rax
subq %rcx, %rax
movq %rax, 0x30(%rsp)
cmpq $0x0, 0x30(%rsp)
jne 0xe6da1
jmp 0xe6e2c
movq 0x8(%rsp), %rdi
movq 0x38(%rsp), %rsi
movq 0x30(%rsp), %rax
subq $0x1, %rax
shlq $0x3, %rax
addq %rax, %rsi
movq 0x28(%rsp), %rdx
movq 0x20(%rsp), %rcx
movq 0x20(%rsp), %r8
subq $0x1, %r8
callq 0xe70c0
movq %rax, 0x20(%rsp)
cmpq $0x0, 0x20(%rsp)
jne 0xe6de2
jmp 0xe6e2c
movq 0x30(%rsp), %rax
cmpq 0x20(%rsp), %rax
jg 0xe6e0e
movq 0x8(%rsp), %rdi
movq 0x38(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq 0x28(%rsp), %rcx
movq 0x20(%rsp), %r8
callq 0xe7320
jmp 0xe6e2c
movq 0x8(%rsp), %rdi
movq 0x38(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq 0x28(%rsp), %rcx
movq 0x20(%rsp), %r8
callq 0xe7940
addq $0x58, %rsp
retq
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)