// File: Alcaro[P]bridges/arlib/array.h
// Function: void arrayvieww<map<string, JSON>::node const*>::ssort<void JSON::serialize<true>(jsonwriter&) const::'lambda'(map<string, JSON>::node const*, map<string, JSON>::node const*)>(void JSON::serialize<true>(jsonwriter&) const::'lambda'(map<string, JSON>::node const*, map<string, JSON>::node const*) const&)
void ssort(const Tless& less)
	{
		// insertion sort; not the fastest, but it's adaptive, it's simple, and its constant factors are good
		// no real point upgrading to something faster, stable sort is rare
		for (size_t a=1;a<this->count;a++)
		{
			if (!less(this->items[a], this->items[a-1]))
				continue;
			
			size_t probe = 1;
			while (probe < a && less(this->items[a], this->items[a-probe]))
				probe *= 2;
			
			size_t min = a-probe;
			probe /= 2;
			while (probe)
			{
				if (min+probe > a || !less(this->items[a], this->items[min+probe]))
					min += probe;
				probe /= 2;
			}
			
			if (min > a || !less(this->items[a], this->items[min]))
				min++;
			
			size_t newpos = min;
			
			char tmp[sizeof(T)];
			memcpy((void*)tmp, (void*)&this->items[a], sizeof(T));
			memmove((void*)&this->items[newpos+1], (void*)&this->items[newpos], sizeof(T)*(a-newpos));
			memcpy((void*)&this->items[newpos], tmp, sizeof(T));
		}
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
movq $0x1, -0x18(%rbp)
movq -0x40(%rbp), %rcx
movq -0x18(%rbp), %rax
cmpq 0x8(%rcx), %rax
jae 0x2ce46
movq -0x40(%rbp), %rax
movq -0x10(%rbp), %rdi
movq (%rax), %rcx
movq -0x18(%rbp), %rdx
movq (%rcx,%rdx,8), %rsi
movq (%rax), %rax
movq -0x18(%rbp), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rdx
callq 0x2d100
testb $0x1, %al
jne 0x2ccd2
jmp 0x2ce35
movq $0x1, -0x20(%rbp)
movq -0x20(%rbp), %rcx
xorl %eax, %eax
cmpq -0x18(%rbp), %rcx
movb %al, -0x41(%rbp)
jae 0x2cd13
movq -0x40(%rbp), %rax
movq -0x10(%rbp), %rdi
movq (%rax), %rcx
movq -0x18(%rbp), %rdx
movq (%rcx,%rdx,8), %rsi
movq (%rax), %rax
movq -0x18(%rbp), %rcx
subq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
callq 0x2d100
movb %al, -0x41(%rbp)
movb -0x41(%rbp), %al
testb $0x1, %al
jne 0x2cd1c
jmp 0x2cd29
movq -0x20(%rbp), %rax
shlq %rax
movq %rax, -0x20(%rbp)
jmp 0x2ccda
movq -0x18(%rbp), %rax
subq -0x20(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
shrq %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x2cd99
movq -0x28(%rbp), %rax
addq -0x20(%rbp), %rax
cmpq -0x18(%rbp), %rax
ja 0x2cd80
movq -0x40(%rbp), %rax
movq -0x10(%rbp), %rdi
movq (%rax), %rcx
movq -0x18(%rbp), %rdx
movq (%rcx,%rdx,8), %rsi
movq (%rax), %rax
movq -0x28(%rbp), %rcx
addq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
callq 0x2d100
testb $0x1, %al
jne 0x2cd8c
movq -0x20(%rbp), %rax
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
shrq %rax
movq %rax, -0x20(%rbp)
jmp 0x2cd40
movq -0x28(%rbp), %rax
cmpq -0x18(%rbp), %rax
ja 0x2cdca
movq -0x40(%rbp), %rax
movq -0x10(%rbp), %rdi
movq (%rax), %rcx
movq -0x18(%rbp), %rdx
movq (%rcx,%rdx,8), %rsi
movq (%rax), %rax
movq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
callq 0x2d100
testb $0x1, %al
jne 0x2cdd6
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movq -0x40(%rbp), %rax
movq -0x28(%rbp), %rcx
movq %rcx, -0x30(%rbp)
movq (%rax), %rcx
movq -0x18(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movq %rcx, -0x38(%rbp)
movq (%rax), %rdi
movq -0x30(%rbp), %rcx
addq $0x1, %rcx
shlq $0x3, %rcx
addq %rcx, %rdi
movq (%rax), %rsi
movq -0x30(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rsi
movq -0x18(%rbp), %rdx
subq -0x30(%rbp), %rdx
shlq $0x3, %rdx
callq 0x45f0
movq -0x40(%rbp), %rax
movq (%rax), %rax
movq -0x30(%rbp), %rcx
movq -0x38(%rbp), %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x2cc90
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)