LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: Baobaobear[P]sort/./sortlib.hpp
// Function: void baobao::internal::tim_sort_force_stack_merge_with_buffer<false, baobao::TestClass*, baobao::TestClass*, std::less<baobao::TestClass>>(baobao::TestClass*, unsigned long, baobao::TestClass**, baobao::TestClass**, std::less<baobao::TestClass>)
void tim_sort_force_stack_merge_with_buffer(RandomAccessBufferIterator buf, size_t bufsize, RandomAccessIterator* beg, RandomAccessIterator* end, Comp compare)
{
    while (end - beg > 1)
    {
        if (end - beg > 2)
        {
            if (end[0] - end[-1] <= end[-2] - end[-3])
            {
                merge_2_part_with_buffer<safecopy>(buf, bufsize, end[-2], end[-1], end[0], compare);
                end[-1] = end[0];
                --end;
            }
            else
            {
                merge_2_part_with_buffer<safecopy>(buf, bufsize, end[-3], end[-2], end[-1], compare);
                end[-2] = end[-1];
                end[-1] = end[0];
                --end;
            }
        }
        else
        {
            merge_2_part_with_buffer<safecopy>(buf, bufsize, end[-2], end[-1], end[0], compare);
            end[-1] = end[0];
            --end;
        }
    }
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq %rsi, 0x20(%rsp)
movq %rdx, 0x18(%rsp)
movq %rcx, 0x10(%rsp)
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
subq %rcx, %rax
sarq $0x3, %rax
cmpq $0x1, %rax
jle 0x11968
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
subq %rcx, %rax
sarq $0x3, %rax
cmpq $0x2, %rax
jle 0x1191b
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq 0x10(%rsp), %rcx
movq -0x8(%rcx), %rcx
subq %rcx, %rax
sarq $0x5, %rax
movq 0x10(%rsp), %rcx
movq -0x10(%rcx), %rcx
movq 0x10(%rsp), %rdx
movq -0x18(%rdx), %rdx
subq %rdx, %rcx
sarq $0x5, %rcx
cmpq %rcx, %rax
jg 0x118be
movq 0x28(%rsp), %rdi
movq 0x20(%rsp), %rsi
movq 0x10(%rsp), %rax
movq -0x10(%rax), %rdx
movq 0x10(%rsp), %rax
movq -0x8(%rax), %rcx
movq 0x10(%rsp), %rax
movq (%rax), %r8
callq 0xe640
movq 0x10(%rsp), %rax
movq (%rax), %rcx
movq 0x10(%rsp), %rax
movq %rcx, -0x8(%rax)
movq 0x10(%rsp), %rax
addq $-0x8, %rax
movq %rax, 0x10(%rsp)
jmp 0x11919
movq 0x28(%rsp), %rdi
movq 0x20(%rsp), %rsi
movq 0x10(%rsp), %rax
movq -0x18(%rax), %rdx
movq 0x10(%rsp), %rax
movq -0x10(%rax), %rcx
movq 0x10(%rsp), %rax
movq -0x8(%rax), %r8
callq 0xe640
movq 0x10(%rsp), %rax
movq -0x8(%rax), %rcx
movq 0x10(%rsp), %rax
movq %rcx, -0x10(%rax)
movq 0x10(%rsp), %rax
movq (%rax), %rcx
movq 0x10(%rsp), %rax
movq %rcx, -0x8(%rax)
movq 0x10(%rsp), %rax
addq $-0x8, %rax
movq %rax, 0x10(%rsp)
jmp 0x11963
movq 0x28(%rsp), %rdi
movq 0x20(%rsp), %rsi
movq 0x10(%rsp), %rax
movq -0x10(%rax), %rdx
movq 0x10(%rsp), %rax
movq -0x8(%rax), %rcx
movq 0x10(%rsp), %rax
movq (%rax), %r8
callq 0xe640
movq 0x10(%rsp), %rax
movq (%rax), %rcx
movq 0x10(%rsp), %rax
movq %rcx, -0x8(%rax)
movq 0x10(%rsp), %rax
addq $-0x8, %rax
movq %rax, 0x10(%rsp)
jmp 0x11808
addq $0x38, %rsp
retq
nopl (%rax)
// File: Baobaobear[P]sort/./sortlib.hpp
// Function: void baobao::internal::insert_sort_part_rev<baobao::TestClass*, std::less<baobao::TestClass>>(baobao::TestClass*, baobao::TestClass*, baobao::TestClass*, std::less<baobao::TestClass>)
inline void insert_sort_part_rev(RandomAccessIterator beg, RandomAccessIterator mid, RandomAccessIterator end, Comp compare)
{
    for (RandomAccessIterator i = mid; i < end; ++i)
    {
        if (!compare(*i, *(i - 1)))
        {
            typename std::iterator_traits<RandomAccessIterator>::value_type val = *i;
            RandomAccessIterator j = i - 1;
            *i = *j;
            for (;j != beg && !compare(val, *(j - 1)); --j)
            {
                *j = *(j - 1);
            }
            *j = val;
        }
    }
}

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x48(%rsp)
movq %rsi, 0x40(%rsp)
movq %rdx, 0x38(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rax
cmpq 0x38(%rsp), %rax
jae 0x11a6a
movq 0x30(%rsp), %rsi
movq 0x30(%rsp), %rdx
addq $-0x20, %rdx
leaq 0x57(%rsp), %rdi
callq 0xcd80
testb $0x1, %al
jne 0x11a55
movq 0x30(%rsp), %rsi
leaq 0x10(%rsp), %rdi
callq 0x86a0
movq 0x30(%rsp), %rax
addq $-0x20, %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rsi
movq 0x30(%rsp), %rdi
callq 0x8710
movq 0x8(%rsp), %rcx
xorl %eax, %eax
cmpq 0x48(%rsp), %rcx
movb %al, 0x7(%rsp)
je 0x11a19
movq 0x8(%rsp), %rdx
addq $-0x20, %rdx
leaq 0x57(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0xcd80
xorb $-0x1, %al
movb %al, 0x7(%rsp)
movb 0x7(%rsp), %al
testb $0x1, %al
jne 0x11a23
jmp 0x11a46
movq 0x8(%rsp), %rsi
addq $-0x20, %rsi
movq 0x8(%rsp), %rdi
callq 0x8710
movq 0x8(%rsp), %rax
addq $-0x20, %rax
movq %rax, 0x8(%rsp)
jmp 0x119e9
movq 0x8(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x8710
jmp 0x11a57
movq 0x30(%rsp), %rax
addq $0x20, %rax
movq %rax, 0x30(%rsp)
jmp 0x1198d
addq $0x58, %rsp
retq
nop
// File: Baobaobear[P]sort/./sortlib.hpp
// Function: void baobao::internal::unguarded_insert_single_rev<baobao::TestClass*, std::less<baobao::TestClass>>(baobao::TestClass*, std::less<baobao::TestClass>)
inline void unguarded_insert_single_rev(RandomAccessIterator i, Comp compare)
{
    if (!compare(*i, *(i - 1)))
    {
        typename std::iterator_traits<RandomAccessIterator>::value_type val = *i;
        RandomAccessIterator j = i - 1;
        *i = *j;
        for (; !compare(val, *(j - 1)); --j)
        {
            *j = *(j - 1);
        }
        *j = val;
    }
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq 0x28(%rsp), %rsi
movq 0x28(%rsp), %rdx
addq $-0x20, %rdx
leaq 0x37(%rsp), %rdi
callq 0xcd80
testb $0x1, %al
jne 0x11b0b
movq 0x28(%rsp), %rsi
leaq 0x8(%rsp), %rdi
callq 0x86a0
movq 0x28(%rsp), %rax
addq $-0x20, %rax
movq %rax, (%rsp)
movq (%rsp), %rsi
movq 0x28(%rsp), %rdi
callq 0x8710
movq (%rsp), %rdx
addq $-0x20, %rdx
leaq 0x37(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0xcd80
xorb $-0x1, %al
testb $0x1, %al
jne 0x11ade
jmp 0x11afd
movq (%rsp), %rsi
addq $-0x20, %rsi
movq (%rsp), %rdi
callq 0x8710
movq (%rsp), %rax
addq $-0x20, %rax
movq %rax, (%rsp)
jmp 0x11abf
movq (%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x8710
addq $0x38, %rsp
retq
// File: Baobaobear[P]sort/./sortlib.hpp
// Function: void baobao::internal::unguarded_insert_single<baobao::TestClass*, std::less<baobao::TestClass>>(baobao::TestClass*, std::less<baobao::TestClass>)
inline void unguarded_insert_single(RandomAccessIterator i, Comp compare)
{
    if (compare(*i, *(i - 1)))
    {
        typename std::iterator_traits<RandomAccessIterator>::value_type val = *i;
        RandomAccessIterator j = i - 1;
        *i = *j;
        for (; compare(val, *(j - 1)); --j)
        {
            *j = *(j - 1);
        }
        *j = val;
    }
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq 0x28(%rsp), %rsi
movq 0x28(%rsp), %rdx
addq $-0x20, %rdx
leaq 0x37(%rsp), %rdi
callq 0xcd80
testb $0x1, %al
jne 0x11b37
jmp 0x11bab
movq 0x28(%rsp), %rsi
leaq 0x8(%rsp), %rdi
callq 0x86a0
movq 0x28(%rsp), %rax
addq $-0x20, %rax
movq %rax, (%rsp)
movq (%rsp), %rsi
movq 0x28(%rsp), %rdi
callq 0x8710
movq (%rsp), %rdx
addq $-0x20, %rdx
leaq 0x37(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0xcd80
testb $0x1, %al
jne 0x11b7e
jmp 0x11b9d
movq (%rsp), %rsi
addq $-0x20, %rsi
movq (%rsp), %rdi
callq 0x8710
movq (%rsp), %rax
addq $-0x20, %rax
movq %rax, (%rsp)
jmp 0x11b61
movq (%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x8710
addq $0x38, %rsp
retq
// File: Baobaobear[P]sort/./sortlib.hpp
// Function: baobao::internal::indirect_sort_comp_warp<baobao::TestClass*, std::less<baobao::TestClass>>::operator()(baobao::internal::indirect_sort_iter_warp<baobao::TestClass*> const&, baobao::internal::indirect_sort_iter_warp<baobao::TestClass*> const&) const
bool operator ()(const indirect_sort_iter_warp<RandomAccessIterator>& a, const indirect_sort_iter_warp<RandomAccessIterator>& b) const
    {
        if (compare(*a.it, *b.it))
        {
            return true;
        }
        else if (compare(*b.it, *a.it))
        {
            return false;
        }
        else
        {
            return a.index < b.index;
        }
    }

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movq %rsi, 0x10(%rsp)
movq %rdx, 0x8(%rsp)
movq 0x18(%rsp), %rdi
movq %rdi, (%rsp)
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rsi
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rdx
callq 0xcd80
testb $0x1, %al
jne 0x144d9
jmp 0x144e0
movb $0x1, 0x27(%rsp)
jmp 0x14521
movq (%rsp), %rdi
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rsi
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rdx
callq 0xcd80
testb $0x1, %al
jne 0x14501
jmp 0x14508
movb $0x0, 0x27(%rsp)
jmp 0x14521
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq 0x8(%rsp), %rcx
cmpq (%rcx), %rax
setb %al
andb $0x1, %al
movb %al, 0x27(%rsp)
movb 0x27(%rsp), %al
andb $0x1, %al
addq $0x28, %rsp
retq
nopl (%rax)
// File: Baobaobear[P]sort/./sortlib.hpp
// Function: void baobao::internal::radix_sort_msd_in_place<baobao::TestClass*, baobao::internal::radix_get_index<baobao::TestClass, unsigned int>, std::less<baobao::TestClass>>(baobao::TestClass*, baobao::TestClass*, baobao::internal::radix_get_index<baobao::TestClass, unsigned int>, std::less<baobao::TestClass>)
void radix_sort_msd_in_place(RandomAccessIterator beg, RandomAccessIterator end, RadixIndexFunc get_index, Comp compare)
{
    uint32_t max_offset = 0;
    for (RandomAccessIterator i = beg; i < end; ++i)
    {
        uint32_t offset = radix_get_max_offset(get_index(*i));
        if (max_offset < offset)
            max_offset = offset;
    }
    radix_sort_msd_in_place(beg, end, get_index, max_offset, compare);
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq %rsi, 0x20(%rsp)
movl $0x0, 0x1c(%rsp)
movq 0x28(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rax
cmpq 0x20(%rsp), %rax
jae 0x14c8a
movq 0x10(%rsp), %rsi
leaq 0x37(%rsp), %rdi
callq 0x14cf0
movl %eax, %edi
callq 0x14cb0
movl %eax, 0xc(%rsp)
movl 0x1c(%rsp), %eax
cmpl 0xc(%rsp), %eax
jae 0x14c78
movl 0xc(%rsp), %eax
movl %eax, 0x1c(%rsp)
jmp 0x14c7a
movq 0x10(%rsp), %rax
addq $0x20, %rax
movq %rax, 0x10(%rsp)
jmp 0x14c40
movq 0x28(%rsp), %rdi
movq 0x20(%rsp), %rsi
movl 0x1c(%rsp), %edx
callq 0x14d10
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)
// File: Baobaobear[P]sort/./sortlib.hpp
// Function: unsigned int baobao::internal::radix_get_max_offset<unsigned int>(unsigned int)
uint32_t radix_get_max_offset(RadixIndexValue index)
{
    uint32_t offset = 0;
    for (; index >= 256; index >>= 8)
    {
        offset += 8;
    }
    return offset;
}

// Assembly:
movl %edi, -0x4(%rsp)
movl $0x0, -0x8(%rsp)
cmpl $0x100, -0x4(%rsp)      # imm = 0x100
jb 0x14cde
movl -0x8(%rsp), %eax
addl $0x8, %eax
movl %eax, -0x8(%rsp)
movl -0x4(%rsp), %eax
shrl $0x8, %eax
movl %eax, -0x4(%rsp)
jmp 0x14cbc
movl -0x8(%rsp), %eax
retq
nopw %cs:(%rax,%rax)
nopl (%rax)
// File: Baobaobear[P]sort/./grailsort.hpp
// Function: baobao::TestClass* Mrrl::grail_FindKeys<baobao::TestClass*, std::less<baobao::TestClass>>(baobao::TestClass*, baobao::TestClass*, baobao::TestClass*, std::less<baobao::TestClass>)
RandomAccessIterator grail_FindKeys(RandomAccessIterator beg, RandomAccessIterator end, RandomAccessIterator nkeys, Comp compare)
{
    RandomAccessIterator h0 = beg, u = beg + 1; // first key is always here
    int h = 1;
    while (u < end && h < nkeys - beg)
    {
        int r = (int)(grail_BinSearchLeft(h0, h0 + h, u, compare) - h0);
        if (r == h || grail_not_eq(*u, *(h0 + r), compare)) {
            grail_rotate(h0, h0 + h, u);
            h0 = u - h;
            grail_rotate(h0 + r, u, u + 1);
            ++h;
        }
        ++u;
    }
    grail_rotate(beg, h0, h0 + h);
    return beg + h;
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x38(%rsp)
movq %rsi, 0x30(%rsp)
movq %rdx, 0x28(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x38(%rsp), %rax
addq $0x20, %rax
movq %rax, 0x18(%rsp)
movl $0x1, 0x14(%rsp)
movq 0x18(%rsp), %rcx
xorl %eax, %eax
cmpq 0x30(%rsp), %rcx
movb %al, 0xd(%rsp)
jae 0x156f5
movslq 0x14(%rsp), %rax
movq 0x28(%rsp), %rcx
movq 0x38(%rsp), %rdx
subq %rdx, %rcx
sarq $0x5, %rcx
cmpq %rcx, %rax
setl %al
movb %al, 0xd(%rsp)
movb 0xd(%rsp), %al
testb $0x1, %al
jne 0x15702
jmp 0x157da
movq 0x20(%rsp), %rdi
movq 0x20(%rsp), %rsi
movslq 0x14(%rsp), %rax
shlq $0x5, %rax
addq %rax, %rsi
movq 0x18(%rsp), %rdx
callq 0x169f0
movq 0x20(%rsp), %rcx
subq %rcx, %rax
sarq $0x5, %rax
movl %eax, 0x10(%rsp)
movl 0x10(%rsp), %eax
cmpl 0x14(%rsp), %eax
je 0x1575d
movq 0x18(%rsp), %rdi
movq 0x20(%rsp), %rsi
movslq 0x10(%rsp), %rax
shlq $0x5, %rax
addq %rax, %rsi
callq 0x16a90
testb $0x1, %al
jne 0x1575d
jmp 0x157c7
movq 0x20(%rsp), %rdi
movq 0x20(%rsp), %rsi
movslq 0x14(%rsp), %rax
shlq $0x5, %rax
addq %rax, %rsi
movq 0x18(%rsp), %rdx
callq 0x16af0
movq 0x18(%rsp), %rax
movslq 0x14(%rsp), %rdx
xorl %ecx, %ecx
subq %rdx, %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rdi
movslq 0x10(%rsp), %rax
shlq $0x5, %rax
addq %rax, %rdi
movq 0x18(%rsp), %rsi
movq 0x18(%rsp), %rdx
addq $0x20, %rdx
callq 0x16af0
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
movq 0x18(%rsp), %rax
addq $0x20, %rax
movq %rax, 0x18(%rsp)
jmp 0x156c3
movq 0x38(%rsp), %rdi
movq 0x20(%rsp), %rsi
movq 0x20(%rsp), %rdx
movslq 0x14(%rsp), %rax
shlq $0x5, %rax
addq %rax, %rdx
callq 0x16af0
movq 0x38(%rsp), %rax
movslq 0x14(%rsp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
addq $0x48, %rsp
retq
// File: Baobaobear[P]sort/./grailsort.hpp
// Function: void Mrrl::grail_LazyStableSort<baobao::TestClass*, std::less<baobao::TestClass>>(baobao::TestClass*, baobao::TestClass*, std::less<baobao::TestClass>)
void grail_LazyStableSort(RandomAccessIterator beg, RandomAccessIterator end, Comp compare) {
    int L = (int)(end - beg);
    for (RandomAccessIterator m = beg + 1; m < end; m += 2) {
        if (compare(*m, *(m - 1))) grail_swap1(m - 1, m);
    }
    for (int h = 2; h < L; h *= 2) {
        RandomAccessIterator p0 = beg;
        while (end - p0 >= 2 * h) {
            grail_MergeWithoutBuffer(p0, p0 + h, p0 + h + h, compare);
            p0 += 2 * h;
        }
        if (end - p0 > h) grail_MergeWithoutBuffer(p0, p0 + h, end, compare);
    }
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x38(%rsp)
movq %rsi, 0x30(%rsp)
movq 0x30(%rsp), %rax
movq 0x38(%rsp), %rcx
subq %rcx, %rax
sarq $0x5, %rax
movl %eax, 0x2c(%rsp)
movq 0x38(%rsp), %rax
addq $0x20, %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rax
cmpq 0x30(%rsp), %rax
jae 0x15890
movq 0x20(%rsp), %rsi
movq 0x20(%rsp), %rdx
addq $-0x20, %rdx
leaq 0x47(%rsp), %rdi
callq 0xcd80
testb $0x1, %al
jne 0x1586b
jmp 0x1587e
movq 0x20(%rsp), %rdi
addq $-0x20, %rdi
movq 0x20(%rsp), %rsi
callq 0x16c80
jmp 0x15880
movq 0x20(%rsp), %rax
addq $0x40, %rax
movq %rax, 0x20(%rsp)
jmp 0x15841
movl $0x2, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
cmpl 0x2c(%rsp), %eax
jge 0x1596f
movq 0x38(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x30(%rsp), %rax
movq 0x10(%rsp), %rcx
subq %rcx, %rax
sarq $0x5, %rax
movl 0x1c(%rsp), %ecx
shll %ecx
movslq %ecx, %rcx
cmpq %rcx, %rax
jl 0x15923
movq 0x10(%rsp), %rdi
movq 0x10(%rsp), %rsi
movslq 0x1c(%rsp), %rax
shlq $0x5, %rax
addq %rax, %rsi
movq 0x10(%rsp), %rdx
movslq 0x1c(%rsp), %rax
shlq $0x5, %rax
addq %rax, %rdx
movslq 0x1c(%rsp), %rax
shlq $0x5, %rax
addq %rax, %rdx
callq 0x167d0
movl 0x1c(%rsp), %ecx
shll %ecx
movq 0x10(%rsp), %rax
movslq %ecx, %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, 0x10(%rsp)
jmp 0x158b0
movq 0x30(%rsp), %rax
movq 0x10(%rsp), %rcx
subq %rcx, %rax
sarq $0x5, %rax
movslq 0x1c(%rsp), %rcx
cmpq %rcx, %rax
jle 0x1595e
movq 0x10(%rsp), %rdi
movq 0x10(%rsp), %rsi
movslq 0x1c(%rsp), %rax
shlq $0x5, %rax
addq %rax, %rsi
movq 0x30(%rsp), %rdx
callq 0x167d0
jmp 0x15960
movl 0x1c(%rsp), %eax
shll %eax
movl %eax, 0x1c(%rsp)
jmp 0x15898
addq $0x48, %rsp
retq
nopw %cs:(%rax,%rax)
nop
// File: Baobaobear[P]sort/./grailsort.hpp
// Function: baobao::TestClass* Mrrl::grail_BinSearchLeft<baobao::TestClass*, std::less<baobao::TestClass>>(baobao::TestClass*, baobao::TestClass*, baobao::TestClass*, std::less<baobao::TestClass>)
RandomAccessIterator grail_BinSearchLeft(RandomAccessIterator beg, RandomAccessIterator end, RandomAccessIterator key, Comp compare)
{
    RandomAccessIterator a = beg - 1, b = end, c;
    while (a < b - 1)
    {
        c = a + ((b - a) >> 1);
        if (compare(*c, *key)) a = c;
        else b = c;
    }
    return b;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq %rsi, 0x20(%rsp)
movq %rdx, 0x18(%rsp)
movq 0x28(%rsp), %rax
addq $-0x20, %rax
movq %rax, 0x10(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x10(%rsp), %rax
movq 0x8(%rsp), %rcx
addq $-0x20, %rcx
cmpq %rcx, %rax
jae 0x16a81
movq 0x10(%rsp), %rax
movq 0x8(%rsp), %rcx
movq 0x10(%rsp), %rdx
subq %rdx, %rcx
sarq $0x5, %rcx
sarq %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, (%rsp)
movq (%rsp), %rsi
movq 0x18(%rsp), %rdx
leaq 0x37(%rsp), %rdi
callq 0xcd80
testb $0x1, %al
jne 0x16a6b
jmp 0x16a76
movq (%rsp), %rax
movq %rax, 0x10(%rsp)
jmp 0x16a7f
movq (%rsp), %rax
movq %rax, 0x8(%rsp)
jmp 0x16a1b
movq 0x8(%rsp), %rax
addq $0x38, %rsp
retq
nopl (%rax,%rax)
// File: Baobaobear[P]sort/./grailsort.hpp
// Function: void Mrrl::grail_rotate<baobao::TestClass*>(baobao::TestClass*, baobao::TestClass*, baobao::TestClass*)
void grail_rotate(RandomAccessIterator beg, RandomAccessIterator mid, RandomAccessIterator end)
{
    while (true)
    {
        if (mid - beg <= end - mid)
        {
            if (mid - beg > 0)
            {
                swap_2_part_with_same_length(beg, mid);
                RandomAccessIterator m = mid;
                mid += mid - beg;
                beg = m;
            }
            else
                break;
        }
        else
        {
            if (end - mid > 0)
            {
                swap_2_part_with_same_length(mid - (end - mid), mid);
                RandomAccessIterator m = mid;
                mid -= end - mid;
                end = m;
            }
            else
                break;
        }
    }
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movq %rsi, 0x18(%rsp)
movq %rdx, 0x10(%rsp)
movq 0x18(%rsp), %rax
movq 0x20(%rsp), %rcx
subq %rcx, %rax
sarq $0x5, %rax
movq 0x10(%rsp), %rcx
movq 0x18(%rsp), %rdx
subq %rdx, %rcx
sarq $0x5, %rcx
cmpq %rcx, %rax
jg 0x16b8f
movq 0x18(%rsp), %rax
movq 0x20(%rsp), %rcx
subq %rcx, %rax
sarq $0x5, %rax
cmpq $0x0, %rax
jle 0x16b85
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0x16c20
movq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x18(%rsp), %rax
movq 0x20(%rsp), %rcx
subq %rcx, %rax
sarq $0x5, %rax
shlq $0x5, %rax
addq 0x18(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x8(%rsp), %rax
movq %rax, 0x20(%rsp)
jmp 0x16b8a
jmp 0x16c16
jmp 0x16c11
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
subq %rcx, %rax
sarq $0x5, %rax
cmpq $0x0, %rax
jle 0x16c0d
movq 0x18(%rsp), %rdi
movq 0x10(%rsp), %rcx
movq 0x18(%rsp), %rax
subq %rax, %rcx
sarq $0x5, %rcx
xorl %eax, %eax
subq %rcx, %rax
shlq $0x5, %rax
addq %rax, %rdi
movq 0x18(%rsp), %rsi
callq 0x16c20
movq 0x18(%rsp), %rax
movq %rax, (%rsp)
movq 0x10(%rsp), %rdx
movq 0x18(%rsp), %rax
subq %rax, %rdx
sarq $0x5, %rdx
movq 0x18(%rsp), %rax
xorl %ecx, %ecx
subq %rdx, %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, 0x18(%rsp)
movq (%rsp), %rax
movq %rax, 0x10(%rsp)
jmp 0x16c0f
jmp 0x16c16
jmp 0x16c11
jmp 0x16b03
addq $0x28, %rsp
retq
nopl (%rax,%rax)
// File: Baobaobear[P]sort/./grailsort.hpp
// Function: void Mrrl::grail_MergeLeftWithXBuf<baobao::TestClass*, std::less<baobao::TestClass>>(baobao::TestClass*, baobao::TestClass*, baobao::TestClass*, baobao::TestClass*, std::less<baobao::TestClass>)
void grail_MergeLeftWithXBuf(RandomAccessIterator beg, RandomAccessIterator mid, RandomAccessIterator end, RandomAccessIterator M, Comp compare) {
    RandomAccessIterator p0 = beg, p1 = mid;
    while (p1 < end) {
        if (p0 == mid || compare(*p1, *p0)) *M++ = *p1++;
        else *M++ = *p0++;
    }
    if (M != p0) while (p0 < mid) *M++ = *p0++;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq %rsi, 0x20(%rsp)
movq %rdx, 0x18(%rsp)
movq %rcx, 0x10(%rsp)
movq 0x28(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x20(%rsp), %rax
movq %rax, (%rsp)
movq (%rsp), %rax
cmpq 0x18(%rsp), %rax
jae 0x16d9b
movq 0x8(%rsp), %rax
cmpq 0x20(%rsp), %rax
je 0x16d4b
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
leaq 0x37(%rsp), %rdi
callq 0xcd80
testb $0x1, %al
jne 0x16d4b
jmp 0x16d72
movq (%rsp), %rsi
movq %rsi, %rax
addq $0x20, %rax
movq %rax, (%rsp)
movq 0x10(%rsp), %rdi
movq %rdi, %rax
addq $0x20, %rax
movq %rax, 0x10(%rsp)
callq 0x8710
jmp 0x16d99
movq 0x8(%rsp), %rsi
movq %rsi, %rax
addq $0x20, %rax
movq %rax, 0x8(%rsp)
movq 0x10(%rsp), %rdi
movq %rdi, %rax
addq $0x20, %rax
movq %rax, 0x10(%rsp)
callq 0x8710
jmp 0x16d1b
movq 0x10(%rsp), %rax
cmpq 0x8(%rsp), %rax
je 0x16de0
jmp 0x16da9
movq 0x8(%rsp), %rax
cmpq 0x20(%rsp), %rax
jae 0x16dde
movq 0x8(%rsp), %rsi
movq %rsi, %rax
addq $0x20, %rax
movq %rax, 0x8(%rsp)
movq 0x10(%rsp), %rdi
movq %rdi, %rax
addq $0x20, %rax
movq %rax, 0x10(%rsp)
callq 0x8710
jmp 0x16da9
jmp 0x16de0
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)
nop
// File: Baobaobear[P]sort/./grailsort.hpp
// Function: void Mrrl::grail_MergeLeft<baobao::TestClass*, std::less<baobao::TestClass>>(baobao::TestClass*, baobao::TestClass*, baobao::TestClass*, baobao::TestClass*, std::less<baobao::TestClass>)
void grail_MergeLeft(RandomAccessIterator beg, RandomAccessIterator mid, RandomAccessIterator end, RandomAccessIterator M, Comp compare) {
    RandomAccessIterator p0 = beg, p1 = mid;
    while (p1 < end) {
        if (p0 == mid || compare(*p1, *p0)) {
            grail_swap1(M++, p1++);
        } else {
            grail_swap1(M++, p0++);
        }
    }
    if (M != p0) grail_swapN(M, p0, mid - p0);
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq %rsi, 0x20(%rsp)
movq %rdx, 0x18(%rsp)
movq %rcx, 0x10(%rsp)
movq 0x28(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x20(%rsp), %rax
movq %rax, (%rsp)
movq (%rsp), %rax
cmpq 0x18(%rsp), %rax
jae 0x16e9b
movq 0x8(%rsp), %rax
cmpq 0x20(%rsp), %rax
je 0x16e4b
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
leaq 0x37(%rsp), %rdi
callq 0xcd80
testb $0x1, %al
jne 0x16e4b
jmp 0x16e72
movq 0x10(%rsp), %rdi
movq %rdi, %rax
addq $0x20, %rax
movq %rax, 0x10(%rsp)
movq (%rsp), %rsi
movq %rsi, %rax
addq $0x20, %rax
movq %rax, (%rsp)
callq 0x16c80
jmp 0x16e99
movq 0x10(%rsp), %rdi
movq %rdi, %rax
addq $0x20, %rax
movq %rax, 0x10(%rsp)
movq 0x8(%rsp), %rsi
movq %rsi, %rax
addq $0x20, %rax
movq %rax, 0x8(%rsp)
callq 0x16c80
jmp 0x16e1b
movq 0x10(%rsp), %rax
cmpq 0x8(%rsp), %rax
je 0x16ec7
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rsi
movq 0x20(%rsp), %rdx
movq 0x8(%rsp), %rax
subq %rax, %rdx
sarq $0x5, %rdx
callq 0x16ff0
addq $0x38, %rsp
retq
nopl (%rax)
// File: Baobaobear[P]sort/./grailsort.hpp
// Function: void Mrrl::grail_MergeRight<baobao::TestClass*, std::less<baobao::TestClass>>(baobao::TestClass*, baobao::TestClass*, baobao::TestClass*, baobao::TestClass*, std::less<baobao::TestClass>)
void grail_MergeRight(RandomAccessIterator beg, RandomAccessIterator mid, RandomAccessIterator end, RandomAccessIterator M, Comp compare) {
    RandomAccessIterator p0 = M - 1, p2 = end - 1, p1 = mid - 1;
    while (p1 >= beg) {
        if (p2 < mid || compare(*p2, *p1)) {
            grail_swap1(p0--, p1--);
        } else {
            grail_swap1(p0--, p2--);
        }
    }
    if (p2 != p0) while (p2 >= mid) grail_swap1(p0--, p2--);
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x38(%rsp)
movq %rsi, 0x30(%rsp)
movq %rdx, 0x28(%rsp)
movq %rcx, 0x20(%rsp)
movq 0x20(%rsp), %rax
addq $-0x20, %rax
movq %rax, 0x18(%rsp)
movq 0x28(%rsp), %rax
addq $-0x20, %rax
movq %rax, 0x10(%rsp)
movq 0x30(%rsp), %rax
addq $-0x20, %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
cmpq 0x38(%rsp), %rax
jb 0x16f99
movq 0x10(%rsp), %rax
cmpq 0x30(%rsp), %rax
jb 0x16f44
movq 0x10(%rsp), %rsi
movq 0x8(%rsp), %rdx
leaq 0x47(%rsp), %rdi
callq 0xcd80
testb $0x1, %al
jne 0x16f44
jmp 0x16f6d
movq 0x18(%rsp), %rdi
movq %rdi, %rax
addq $-0x20, %rax
movq %rax, 0x18(%rsp)
movq 0x8(%rsp), %rsi
movq %rsi, %rax
addq $-0x20, %rax
movq %rax, 0x8(%rsp)
callq 0x16c80
jmp 0x16f94
movq 0x18(%rsp), %rdi
movq %rdi, %rax
addq $-0x20, %rax
movq %rax, 0x18(%rsp)
movq 0x10(%rsp), %rsi
movq %rsi, %rax
addq $-0x20, %rax
movq %rax, 0x10(%rsp)
callq 0x16c80
jmp 0x16f12
movq 0x10(%rsp), %rax
cmpq 0x18(%rsp), %rax
je 0x16fde
jmp 0x16fa7
movq 0x10(%rsp), %rax
cmpq 0x30(%rsp), %rax
jb 0x16fdc
movq 0x18(%rsp), %rdi
movq %rdi, %rax
addq $-0x20, %rax
movq %rax, 0x18(%rsp)
movq 0x10(%rsp), %rsi
movq %rsi, %rax
addq $-0x20, %rax
movq %rax, 0x10(%rsp)
callq 0x16c80
jmp 0x16fa7
jmp 0x16fde
addq $0x48, %rsp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)
// File: Baobaobear[P]sort/./grailsort.hpp
// Function: void Mrrl::grail_SmartMergeWithXBuf<baobao::TestClass*, std::less<baobao::TestClass>>(baobao::TestClass*, int*, int*, baobao::TestClass*, baobao::TestClass*, std::less<baobao::TestClass>)
void grail_SmartMergeWithXBuf(RandomAccessIterator beg, int *alen1, int *atype, RandomAccessIterator end, RandomAccessIterator lkeys, Comp compare) {
    RandomAccessIterator p0 = lkeys, p1 = beg, p2 = beg + *alen1, q1 = p2, q2 = end;
    int ftype = !*atype;  // 1 if inverted
    while (p1 < q1 && p2 < q2) {
        if (grail_cmp(*p1, *p2, compare) - ftype < 0)
            *p0++ = *p1++;
        else *p0++ = *p2++;
    }
    if (p1 < q1) {
        *alen1 = (int)(q1 - p1);
        while (p1 < q1) *--q2 = *--q1;
    }
    else {
        *alen1 = (int)(q2 - p2);
        *atype = ftype;
    }
}

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x58(%rsp)
movq %rsi, 0x50(%rsp)
movq %rdx, 0x48(%rsp)
movq %rcx, 0x40(%rsp)
movq %r8, 0x38(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x58(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x58(%rsp), %rax
movq 0x50(%rsp), %rcx
movslq (%rcx), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x48(%rsp), %rax
cmpl $0x0, (%rax)
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, 0xc(%rsp)
movq 0x28(%rsp), %rcx
xorl %eax, %eax
cmpq 0x18(%rsp), %rcx
movb %al, 0xa(%rsp)
jae 0x17877
movq 0x20(%rsp), %rax
cmpq 0x10(%rsp), %rax
setb %al
movb %al, 0xa(%rsp)
movb 0xa(%rsp), %al
testb $0x1, %al
jne 0x17881
jmp 0x178ee
movq 0x28(%rsp), %rdi
movq 0x20(%rsp), %rsi
callq 0x17970
subl 0xc(%rsp), %eax
cmpl $0x0, %eax
jge 0x178c2
movq 0x28(%rsp), %rsi
movq %rsi, %rax
addq $0x20, %rax
movq %rax, 0x28(%rsp)
movq 0x30(%rsp), %rdi
movq %rdi, %rax
addq $0x20, %rax
movq %rax, 0x30(%rsp)
callq 0x8710
jmp 0x178e9
movq 0x20(%rsp), %rsi
movq %rsi, %rax
addq $0x20, %rax
movq %rax, 0x20(%rsp)
movq 0x30(%rsp), %rdi
movq %rdi, %rax
addq $0x20, %rax
movq %rax, 0x30(%rsp)
callq 0x8710
jmp 0x17854
movq 0x28(%rsp), %rax
cmpq 0x18(%rsp), %rax
jae 0x17945
movq 0x18(%rsp), %rax
movq 0x28(%rsp), %rcx
subq %rcx, %rax
sarq $0x5, %rax
movl %eax, %ecx
movq 0x50(%rsp), %rax
movl %ecx, (%rax)
movq 0x28(%rsp), %rax
cmpq 0x18(%rsp), %rax
jae 0x17943
movq 0x18(%rsp), %rsi
addq $-0x20, %rsi
movq %rsi, 0x18(%rsp)
movq 0x10(%rsp), %rdi
addq $-0x20, %rdi
movq %rdi, 0x10(%rsp)
callq 0x8710
jmp 0x17914
jmp 0x1796a
movq 0x10(%rsp), %rax
movq 0x20(%rsp), %rcx
subq %rcx, %rax
sarq $0x5, %rax
movl %eax, %ecx
movq 0x50(%rsp), %rax
movl %ecx, (%rax)
movl 0xc(%rsp), %ecx
movq 0x48(%rsp), %rax
movl %ecx, (%rax)
addq $0x68, %rsp
retq
nop
// File: Baobaobear[P]sort/./grailsort.hpp
// Function: int Mrrl::grail_cmp<baobao::TestClass, std::less<baobao::TestClass>>(baobao::TestClass const&, baobao::TestClass const&, std::less<baobao::TestClass>)
inline int grail_cmp(const ValueType& a, const ValueType& b, Comp compare)
{
    if (compare(a, b))
        return -1;
    else if (compare(b, a))
        return 1;
    return 0;
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x8(%rsp)
movq %rsi, (%rsp)
movq 0x8(%rsp), %rsi
movq (%rsp), %rdx
leaq 0x13(%rsp), %rdi
callq 0xcd80
testb $0x1, %al
jne 0x17996
jmp 0x179a0
movl $0xffffffff, 0x14(%rsp) # imm = 0xFFFFFFFF
jmp 0x179cd
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
leaq 0x13(%rsp), %rdi
callq 0xcd80
testb $0x1, %al
jne 0x179b9
jmp 0x179c3
movl $0x1, 0x14(%rsp)
jmp 0x179cd
jmp 0x179c5
movl $0x0, 0x14(%rsp)
movl 0x14(%rsp), %eax
addq $0x18, %rsp
retq
nopw %cs:(%rax,%rax)
// File: Baobaobear[P]sort/./grailsort.hpp
// Function: void Mrrl::grail_SmartMergeWithBuffer<baobao::TestClass*, std::less<baobao::TestClass>>(baobao::TestClass*, int*, int*, baobao::TestClass*, baobao::TestClass*, std::less<baobao::TestClass>)
void grail_SmartMergeWithBuffer(RandomAccessIterator beg, int *alen1, int *atype, RandomAccessIterator end, RandomAccessIterator lkeys, Comp compare) {
    RandomAccessIterator p0 = lkeys, p1 = beg, p2 = beg + *alen1, q1 = p2, q2 = end;
    int ftype = !*atype;  // 1 if inverted
    while (p1 < q1 && p2 < q2) {
        if (grail_cmp(*p1, *p2, compare) - ftype < 0)
            grail_swap1(p0++, p1++);
        else grail_swap1(p0++, p2++);
    }
    if (p1 < q1) {
        *alen1 = (int)(q1 - p1);
        while (p1 < q1) grail_swap1(--q1, --q2);
    } else {
        *alen1 = (int)(q2 - p2);
        *atype = ftype;
    }
}

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x58(%rsp)
movq %rsi, 0x50(%rsp)
movq %rdx, 0x48(%rsp)
movq %rcx, 0x40(%rsp)
movq %r8, 0x38(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x58(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x58(%rsp), %rax
movq 0x50(%rsp), %rcx
movslq (%rcx), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x48(%rsp), %rax
cmpl $0x0, (%rax)
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, 0xc(%rsp)
movq 0x28(%rsp), %rcx
xorl %eax, %eax
cmpq 0x18(%rsp), %rcx
movb %al, 0xa(%rsp)
jae 0x17a77
movq 0x20(%rsp), %rax
cmpq 0x10(%rsp), %rax
setb %al
movb %al, 0xa(%rsp)
movb 0xa(%rsp), %al
testb $0x1, %al
jne 0x17a81
jmp 0x17aee
movq 0x28(%rsp), %rdi
movq 0x20(%rsp), %rsi
callq 0x17970
subl 0xc(%rsp), %eax
cmpl $0x0, %eax
jge 0x17ac2
movq 0x30(%rsp), %rdi
movq %rdi, %rax
addq $0x20, %rax
movq %rax, 0x30(%rsp)
movq 0x28(%rsp), %rsi
movq %rsi, %rax
addq $0x20, %rax
movq %rax, 0x28(%rsp)
callq 0x16c80
jmp 0x17ae9
movq 0x30(%rsp), %rdi
movq %rdi, %rax
addq $0x20, %rax
movq %rax, 0x30(%rsp)
movq 0x20(%rsp), %rsi
movq %rsi, %rax
addq $0x20, %rax
movq %rax, 0x20(%rsp)
callq 0x16c80
jmp 0x17a54
movq 0x28(%rsp), %rax
cmpq 0x18(%rsp), %rax
jae 0x17b45
movq 0x18(%rsp), %rax
movq 0x28(%rsp), %rcx
subq %rcx, %rax
sarq $0x5, %rax
movl %eax, %ecx
movq 0x50(%rsp), %rax
movl %ecx, (%rax)
movq 0x28(%rsp), %rax
cmpq 0x18(%rsp), %rax
jae 0x17b43
movq 0x18(%rsp), %rdi
addq $-0x20, %rdi
movq %rdi, 0x18(%rsp)
movq 0x10(%rsp), %rsi
addq $-0x20, %rsi
movq %rsi, 0x10(%rsp)
callq 0x16c80
jmp 0x17b14
jmp 0x17b6a
movq 0x10(%rsp), %rax
movq 0x20(%rsp), %rcx
subq %rcx, %rax
sarq $0x5, %rax
movl %eax, %ecx
movq 0x50(%rsp), %rax
movl %ecx, (%rax)
movl 0xc(%rsp), %ecx
movq 0x48(%rsp), %rax
movl %ecx, (%rax)
addq $0x68, %rsp
retq
nop
// File: Baobaobear[P]sort/./grailsort.hpp
// Function: baobao::TestClass* Mrrl::grail_BinSearchRight<baobao::TestClass*, std::less<baobao::TestClass>>(baobao::TestClass*, baobao::TestClass*, baobao::TestClass*, std::less<baobao::TestClass>)
RandomAccessIterator grail_BinSearchRight(RandomAccessIterator beg, RandomAccessIterator end, RandomAccessIterator key, Comp compare)
{
    RandomAccessIterator a = beg - 1, b = end, c;
    while (a < b - 1)
    {
        c = a + ((b - a) >> 1);
        if (compare(*key, *c)) b = c;
        else a = c;
    }
    return b;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq %rsi, 0x20(%rsp)
movq %rdx, 0x18(%rsp)
movq 0x28(%rsp), %rax
addq $-0x20, %rax
movq %rax, 0x10(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x10(%rsp), %rax
movq 0x8(%rsp), %rcx
addq $-0x20, %rcx
cmpq %rcx, %rax
jae 0x17df1
movq 0x10(%rsp), %rax
movq 0x8(%rsp), %rcx
movq 0x10(%rsp), %rdx
subq %rdx, %rcx
sarq $0x5, %rcx
sarq %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, (%rsp)
movq 0x18(%rsp), %rsi
movq (%rsp), %rdx
leaq 0x37(%rsp), %rdi
callq 0xcd80
testb $0x1, %al
jne 0x17ddb
jmp 0x17de6
movq (%rsp), %rax
movq %rax, 0x8(%rsp)
jmp 0x17def
movq (%rsp), %rax
movq %rax, 0x10(%rsp)
jmp 0x17d8b
movq 0x8(%rsp), %rax
addq $0x38, %rsp
retq
nopl (%rax,%rax)
// File: Baobaobear[P]sort/./grailsort.hpp
// Function: void Mrrl::grail_sort<baobao::TestClass*, std::less<baobao::TestClass>>(baobao::TestClass*, baobao::TestClass*, std::less<baobao::TestClass>)
void grail_sort(RandomAccessIterator beg, RandomAccessIterator end, Comp compare)
{
    typedef typename std::iterator_traits<RandomAccessIterator>::value_type value_type;
    int L = 1;
    while (L * L < end - beg) L *= 2;
    value_type * ExtBuf = new value_type[L];
    if (ExtBuf == NULL)
    {
        grail_sort_buffer(beg, end, compare);
    }
    else
    {
        grail_commonSort(beg, end, ExtBuf, L, compare);
        delete[] ExtBuf;
    }
}

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x58(%rsp)
movq %rsi, 0x50(%rsp)
movl $0x1, 0x4c(%rsp)
movl 0x4c(%rsp), %eax
imull 0x4c(%rsp), %eax
cltq
movq 0x50(%rsp), %rcx
movq 0x58(%rsp), %rdx
subq %rdx, %rcx
sarq $0x5, %rcx
cmpq %rcx, %rax
jge 0x17ec3
movl 0x4c(%rsp), %eax
shll %eax
movl %eax, 0x4c(%rsp)
jmp 0x17e96
movslq 0x4c(%rsp), %rax
movq %rax, 0x20(%rsp)
movl $0x20, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x2030
movq %rax, %rcx
movq 0x20(%rsp), %rax
movq %rcx, 0x28(%rsp)
cmpq $0x0, %rax
je 0x17f48
movq 0x28(%rsp), %rax
movq 0x20(%rsp), %rdx
shlq $0x5, %rdx
movq %rax, %rcx
addq %rdx, %rcx
movq %rcx, 0x10(%rsp)
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x61b0
jmp 0x17f30
movq 0x10(%rsp), %rcx
movq 0x8(%rsp), %rax
addq $0x20, %rax
cmpq %rcx, %rax
movq %rax, 0x18(%rsp)
jne 0x17f1f
movq 0x28(%rsp), %rax
movq %rax, 0x40(%rsp)
cmpq $0x0, 0x40(%rsp)
jne 0x17f85
movq 0x58(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0x17e00
jmp 0x17fb7
movq 0x28(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x38(%rsp)
movl %eax, 0x34(%rsp)
callq 0x2200
jmp 0x17fbc
movq 0x58(%rsp), %rdi
movq 0x50(%rsp), %rsi
movq 0x40(%rsp), %rdx
movl 0x4c(%rsp), %ecx
callq 0x15170
movq 0x40(%rsp), %rax
movq %rax, (%rsp)
cmpq $0x0, %rax
je 0x17fb5
movq (%rsp), %rdi
callq 0x2200
jmp 0x17fb7
addq $0x68, %rsp
retq
movq 0x38(%rsp), %rdi
callq 0x2280
nopw %cs:(%rax,%rax)
// File: Baobaobear[P]sort/./wikisort.hpp
// Function: Range<baobao::TestClass*> Wiki::Iterator::nextRange<baobao::TestClass*>(baobao::TestClass*)
Range<Iterator> nextRange(Iterator it) {
            std::size_t start = decimal;

            decimal += decimal_step;
            numerator += numerator_step;
            if (numerator >= denominator) {
                numerator -= denominator;
                ++decimal;
            }

            return Range<Iterator>(it + start, it + decimal);
        }

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x20(%rsp)
movq %rsi, 0x18(%rsp)
movq 0x20(%rsp), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rcx), %rax
movq %rax, 0x10(%rsp)
movq 0x28(%rcx), %rax
addq 0x10(%rcx), %rax
movq %rax, 0x10(%rcx)
movq 0x30(%rcx), %rax
addq 0x18(%rcx), %rax
movq %rax, 0x18(%rcx)
movq 0x18(%rcx), %rax
cmpq 0x20(%rcx), %rax
jb 0x1d253
movq 0x8(%rsp), %rax
movq 0x20(%rax), %rdx
movq 0x18(%rax), %rcx
subq %rdx, %rcx
movq %rcx, 0x18(%rax)
movq 0x10(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x10(%rax)
movq 0x8(%rsp), %rax
movq 0x18(%rsp), %rdx
movq 0x10(%rsp), %rcx
shlq $0x5, %rcx
movq %rdx, %rsi
addq %rcx, %rsi
movq 0x10(%rax), %rax
shlq $0x5, %rax
addq %rax, %rdx
leaq 0x28(%rsp), %rdi
callq 0x1d390
movq 0x28(%rsp), %rax
movq 0x30(%rsp), %rdx
addq $0x38, %rsp
retq
// File: Baobaobear[P]sort/./wikisort.hpp
// Function: Wiki::Iterator::nextLevel()
bool nextLevel() {
            decimal_step += decimal_step;
            numerator_step += numerator_step;
            if (numerator_step >= denominator) {
                numerator_step -= denominator;
                ++decimal_step;
            }

            return decimal_step < size;
        }

// Assembly:
movq %rdi, -0x8(%rsp)
movq -0x8(%rsp), %rcx
movq %rcx, -0x10(%rsp)
movq 0x28(%rcx), %rax
addq 0x28(%rcx), %rax
movq %rax, 0x28(%rcx)
movq 0x30(%rcx), %rax
addq 0x30(%rcx), %rax
movq %rax, 0x30(%rcx)
movq 0x30(%rcx), %rax
cmpq 0x20(%rcx), %rax
jb 0x1d411
movq -0x10(%rsp), %rax
movq 0x20(%rax), %rdx
movq 0x30(%rax), %rcx
subq %rdx, %rcx
movq %rcx, 0x30(%rax)
movq 0x28(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x28(%rax)
movq -0x10(%rsp), %rcx
movq 0x28(%rcx), %rax
cmpq (%rcx), %rax
setb %al
andb $0x1, %al
retq
nopw %cs:(%rax,%rax)
nopl (%rax)
// File: Baobaobear[P]sort/./wikisort.hpp
// Function: void Wiki::MergeExternal<baobao::TestClass*, baobao::TestClass*, std::less<baobao::TestClass>>(baobao::TestClass*, baobao::TestClass*, baobao::TestClass*, baobao::TestClass*, baobao::TestClass*, std::less<baobao::TestClass>)
void MergeExternal(RandomAccessIterator1 first1, RandomAccessIterator1 last1,
                       RandomAccessIterator1 first2, RandomAccessIterator1 last2,
                       RandomAccessIterator2 cache, Comparison compare) {
        // A fits into the cache, so use that instead of the internal buffer
        RandomAccessIterator2 A_index = cache;
        RandomAccessIterator2 A_last = cache + std::distance(first1, last1);
        RandomAccessIterator1 B_index = first2;
        RandomAccessIterator1 B_last = last2;
        RandomAccessIterator1 insert_index = first1;

        if (last2 - first2 > 0 && last1 - first1 > 0) {
            while (true) {
                if (!compare(*B_index, *A_index)) {
                    *insert_index = *A_index;
                    ++A_index;
                    ++insert_index;
                    if (A_index == A_last) break;
                } else {
                    *insert_index = *B_index;
                    ++B_index;
                    ++insert_index;
                    if (B_index == B_last) break;
                }
            }
        }

        // copy the remainder of A into the final array
        std::copy(A_index, A_last, insert_index);
    }

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x58(%rsp)
movq %rsi, 0x50(%rsp)
movq %rdx, 0x48(%rsp)
movq %rcx, 0x40(%rsp)
movq %r8, 0x38(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x58(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0xbb40
movq %rax, %rcx
movq 0x8(%rsp), %rax
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, 0x28(%rsp)
movq 0x48(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x58(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x40(%rsp), %rax
movq 0x48(%rsp), %rcx
subq %rcx, %rax
sarq $0x5, %rax
cmpq $0x0, %rax
jle 0x1d56f
movq 0x50(%rsp), %rax
movq 0x58(%rsp), %rcx
subq %rcx, %rax
sarq $0x5, %rax
cmpq $0x0, %rax
jle 0x1d56f
jmp 0x1d4da
movq 0x20(%rsp), %rsi
movq 0x30(%rsp), %rdx
leaq 0x67(%rsp), %rdi
callq 0xcd80
testb $0x1, %al
jne 0x1d52d
movq 0x30(%rsp), %rsi
movq 0x10(%rsp), %rdi
callq 0x8710
movq 0x30(%rsp), %rax
addq $0x20, %rax
movq %rax, 0x30(%rsp)
movq 0x10(%rsp), %rax
addq $0x20, %rax
movq %rax, 0x10(%rsp)
movq 0x30(%rsp), %rax
cmpq 0x28(%rsp), %rax
jne 0x1d52b
jmp 0x1d56d
jmp 0x1d568
movq 0x20(%rsp), %rsi
movq 0x10(%rsp), %rdi
callq 0x8710
movq 0x20(%rsp), %rax
addq $0x20, %rax
movq %rax, 0x20(%rsp)
movq 0x10(%rsp), %rax
addq $0x20, %rax
movq %rax, 0x10(%rsp)
movq 0x20(%rsp), %rax
cmpq 0x18(%rsp), %rax
jne 0x1d566
jmp 0x1d56d
jmp 0x1d568
jmp 0x1d4da
jmp 0x1d56f
movq 0x30(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq 0x10(%rsp), %rdx
callq 0xc730
addq $0x68, %rsp
retq
nopl (%rax,%rax)
// File: Baobaobear[P]sort/./wikisort.hpp
// Function: baobao::TestClass* FindLastForward<baobao::TestClass*, baobao::TestClass, std::less<baobao::TestClass>>(baobao::TestClass*, baobao::TestClass*, baobao::TestClass const&, std::less<baobao::TestClass>, unsigned long)
RandomAccessIterator FindLastForward(RandomAccessIterator first, RandomAccessIterator last,
                                     const T & value, Comparison compare, std::size_t unique) {
    std::size_t size = std::distance(first, last);
    if (size == 0) return first;

    std::size_t skip = std::max(size / unique, (std::size_t)1);

    RandomAccessIterator index;
    for (index = first + skip ; !compare(value, *(index - 1)) ; index += skip) {
        if (index >= last - skip) {
            return std::upper_bound(index, last, value, compare);
        }
    }
    return std::upper_bound(index - skip, index, value, compare);
}

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x50(%rsp)
movq %rsi, 0x48(%rsp)
movq %rdx, 0x40(%rsp)
movq %rcx, 0x38(%rsp)
movq 0x50(%rsp), %rdi
movq 0x48(%rsp), %rsi
callq 0xbb40
movq %rax, 0x30(%rsp)
cmpq $0x0, 0x30(%rsp)
jne 0x1d5f3
movq 0x50(%rsp), %rax
movq %rax, 0x60(%rsp)
jmp 0x1d6d2
movq 0x30(%rsp), %rax
xorl %ecx, %ecx
movl %ecx, %edx
divq 0x38(%rsp)
movq %rax, 0x20(%rsp)
movq $0x1, 0x18(%rsp)
leaq 0x20(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x1e050
movq (%rax), %rax
movq %rax, 0x28(%rsp)
movq 0x50(%rsp), %rax
movq 0x28(%rsp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, 0x10(%rsp)
movq 0x40(%rsp), %rsi
movq 0x10(%rsp), %rdx
addq $-0x20, %rdx
leaq 0x5f(%rsp), %rdi
callq 0xcd80
xorb $-0x1, %al
testb $0x1, %al
jne 0x1d65c
jmp 0x1d6ab
movq 0x10(%rsp), %rax
movq 0x48(%rsp), %rcx
xorl %edx, %edx
subq 0x28(%rsp), %rdx
shlq $0x5, %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
jb 0x1d694
movq 0x10(%rsp), %rdi
movq 0x48(%rsp), %rsi
movq 0x40(%rsp), %rdx
callq 0xf0e0
movq %rax, 0x60(%rsp)
jmp 0x1d6d2
jmp 0x1d696
movq 0x28(%rsp), %rax
shlq $0x5, %rax
addq 0x10(%rsp), %rax
movq %rax, 0x10(%rsp)
jmp 0x1d63c
movq 0x10(%rsp), %rdi
xorl %eax, %eax
subq 0x28(%rsp), %rax
shlq $0x5, %rax
addq %rax, %rdi
movq 0x10(%rsp), %rsi
movq 0x40(%rsp), %rdx
callq 0xf0e0
movq %rax, 0x60(%rsp)
movq 0x60(%rsp), %rax
addq $0x68, %rsp
retq
nopl (%rax)
// File: Baobaobear[P]sort/./wikisort.hpp
// Function: baobao::TestClass* FindFirstBackward<baobao::TestClass*, baobao::TestClass, std::less<baobao::TestClass>>(baobao::TestClass*, baobao::TestClass*, baobao::TestClass const&, std::less<baobao::TestClass>, unsigned long)
RandomAccessIterator FindFirstBackward(RandomAccessIterator first, RandomAccessIterator last,
                                       const T & value, Comparison compare, std::size_t unique) {
    std::size_t size = std::distance(first, last);
    if (size == 0) return first;

    std::size_t skip = std::max(size / unique, (std::size_t)1);

    RandomAccessIterator index;
    for (index = last - skip ; index > first && !compare(*(index - 1), value) ; index -= skip) {
        if (index < first + skip) {
            return std::lower_bound(first, index, value, compare);
        }
    }
    return std::lower_bound(index, index + skip, value, compare);
}

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x50(%rsp)
movq %rsi, 0x48(%rsp)
movq %rdx, 0x40(%rsp)
movq %rcx, 0x38(%rsp)
movq 0x50(%rsp), %rdi
movq 0x48(%rsp), %rsi
callq 0xbb40
movq %rax, 0x30(%rsp)
cmpq $0x0, 0x30(%rsp)
jne 0x1d723
movq 0x50(%rsp), %rax
movq %rax, 0x60(%rsp)
jmp 0x1d825
movq 0x30(%rsp), %rax
xorl %ecx, %ecx
movl %ecx, %edx
divq 0x38(%rsp)
movq %rax, 0x20(%rsp)
movq $0x1, 0x18(%rsp)
leaq 0x20(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x1e050
movq (%rax), %rax
movq %rax, 0x28(%rsp)
movq 0x48(%rsp), %rax
xorl %ecx, %ecx
subq 0x28(%rsp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rcx
xorl %eax, %eax
cmpq 0x50(%rsp), %rcx
movb %al, 0xd(%rsp)
jbe 0x1d79e
movq 0x10(%rsp), %rsi
addq $-0x20, %rsi
movq 0x40(%rsp), %rdx
leaq 0x5f(%rsp), %rdi
callq 0xcd80
xorb $-0x1, %al
movb %al, 0xd(%rsp)
movb 0xd(%rsp), %al
testb $0x1, %al
jne 0x1d7a8
jmp 0x1d800
movq 0x10(%rsp), %rax
movq 0x50(%rsp), %rcx
movq 0x28(%rsp), %rdx
shlq $0x5, %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
jae 0x1d7de
movq 0x50(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq 0x40(%rsp), %rdx
callq 0xf130
movq %rax, 0x60(%rsp)
jmp 0x1d825
jmp 0x1d7e0
movq 0x28(%rsp), %rdx
movq 0x10(%rsp), %rax
xorl %ecx, %ecx
subq %rdx, %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, 0x10(%rsp)
jmp 0x1d76e
movq 0x10(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq 0x28(%rsp), %rax
shlq $0x5, %rax
addq %rax, %rsi
movq 0x40(%rsp), %rdx
callq 0xf130
movq %rax, 0x60(%rsp)
movq 0x60(%rsp), %rax
addq $0x68, %rsp
retq
nop
// File: Baobaobear[P]sort/./wikisort.hpp
// Function: void Wiki::MergeInternal<baobao::TestClass*, std::less<baobao::TestClass>>(baobao::TestClass*, baobao::TestClass*, baobao::TestClass*, baobao::TestClass*, baobao::TestClass*, std::less<baobao::TestClass>)
void MergeInternal(RandomAccessIterator first1, RandomAccessIterator last1,
                       RandomAccessIterator first2, RandomAccessIterator last2,
                       RandomAccessIterator buffer, Comparison compare) {
        // whenever we find a value to add to the final array, swap it with the value that's already in that spot
        // when this algorithm is finished, 'buffer' will contain its original contents, but in a different order
        RandomAccessIterator A_index = buffer;
        RandomAccessIterator B_index = first2;
        RandomAccessIterator A_last = buffer + std::distance(first1, last1);
        RandomAccessIterator B_last = last2;
        RandomAccessIterator insert_index = first1;

        if (last2 - first2 > 0 && last1 - first1 > 0) {
            while (true) {
                if (!compare(*B_index, *A_index)) {
                    std::iter_swap(insert_index, A_index);
                    ++A_index;
                    ++insert_index;
                    if (A_index == A_last) break;
                } else {
                    std::iter_swap(insert_index, B_index);
                    ++B_index;
                    ++insert_index;
                    if (B_index == B_last) break;
                }
            }
        }

        // BlockSwap
        std::swap_ranges(A_index, A_last, insert_index);
    }

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x58(%rsp)
movq %rsi, 0x50(%rsp)
movq %rdx, 0x48(%rsp)
movq %rcx, 0x40(%rsp)
movq %r8, 0x38(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x48(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x58(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0xbb40
movq %rax, %rcx
movq 0x8(%rsp), %rax
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, 0x20(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x58(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x40(%rsp), %rax
movq 0x48(%rsp), %rcx
subq %rcx, %rax
sarq $0x5, %rax
cmpq $0x0, %rax
jle 0x1d9af
movq 0x50(%rsp), %rax
movq 0x58(%rsp), %rcx
subq %rcx, %rax
sarq $0x5, %rax
cmpq $0x0, %rax
jle 0x1d9af
jmp 0x1d91a
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
leaq 0x67(%rsp), %rdi
callq 0xcd80
testb $0x1, %al
jne 0x1d96d
movq 0x10(%rsp), %rdi
movq 0x30(%rsp), %rsi
callq 0xacc0
movq 0x30(%rsp), %rax
addq $0x20, %rax
movq %rax, 0x30(%rsp)
movq 0x10(%rsp), %rax
addq $0x20, %rax
movq %rax, 0x10(%rsp)
movq 0x30(%rsp), %rax
cmpq 0x20(%rsp), %rax
jne 0x1d96b
jmp 0x1d9ad
jmp 0x1d9a8
movq 0x10(%rsp), %rdi
movq 0x28(%rsp), %rsi
callq 0xacc0
movq 0x28(%rsp), %rax
addq $0x20, %rax
movq %rax, 0x28(%rsp)
movq 0x10(%rsp), %rax
addq $0x20, %rax
movq %rax, 0x10(%rsp)
movq 0x28(%rsp), %rax
cmpq 0x18(%rsp), %rax
jne 0x1d9a6
jmp 0x1d9ad
jmp 0x1d9a8
jmp 0x1d91a
jmp 0x1d9af
movq 0x30(%rsp), %rdi
movq 0x20(%rsp), %rsi
movq 0x10(%rsp), %rdx
callq 0xbff0
addq $0x68, %rsp
retq
nopl (%rax,%rax)