LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbp
leaq 0x20(%rdi), %rax
movl $0x1, %ebx
movq %rdi, %r15
movq %rsi, 0x10(%rsp)
cmpq %rsi, %rax
jae 0xbb7e
movq %rdx, %r9
subq %rbp, %r9
sarq $0x5, %r9
movl $0x1, %r12d
movq %rbp, %r15
movq %rbp, (%rsp)
movq %r9, 0x8(%rsp)
movslq %r12d, %rcx
cmpq %rcx, %r9
jle 0xbb77
movq %rax, %r13
movq %rcx, %r14
shlq $0x5, %r14
leaq (%r15,%r14), %rsi
movq %rsi, %rax
testl %ecx, %ecx
jle 0xbb13
leaq -0x20(%r15), %rdx
movl (%r13), %ecx
movq %rsi, %rax
movq %rax, %r8
subq %rdx, %r8
sarq $0x6, %r8
shlq $0x5, %r8
leaq (%rdx,%r8), %rdi
cmpl %ecx, (%rdx,%r8)
jl 0xbb07
movq %rdi, %rax
jmp 0xbb0a
movq %rdi, %rdx
leaq -0x20(%rax), %rdi
cmpq %rdi, %rdx
jb 0xbaea
subq %r15, %rax
shrq $0x5, %rax
movslq %eax, %rbx
cmpl %eax, %r12d
je 0xbb33
movq %rbx, %rax
shlq $0x5, %rax
movl (%r15,%rax), %eax
cmpl (%r13), %eax
je 0xbb65
movq %r15, %rdi
movq %r13, %rdx
callq 0xcafb
movq %r13, %r15
subq %r14, %r15
shlq $0x5, %rbx
addq %r15, %rbx
addq $0x40, %rbp
movq %rbx, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0xcafb
movq 0x8(%rsp), %r9
incl %r12d
leaq 0x20(%r13), %rax
movq %r13, %rbp
cmpq 0x10(%rsp), %rax
jb 0xbabe
movslq %r12d, %rbx
movq (%rsp), %rbp
shlq $0x5, %rbx
leaq (%r15,%rbx), %rdx
movq %rbp, %rdi
movq %r15, %rsi
callq 0xcafb
addq %rbp, %rbx
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, %rax
subq %rdi, %rax
movq %rax, 0x18(%rsp)
shrq $0x5, %rax
movq %rax, 0x20(%rsp)
movq %rdi, 0x8(%rsp)
leaq 0x20(%rdi), %rax
cmpq %rsi, %rax
jae 0xbc46
movq 0x8(%rsp), %rcx
addq $0x28, %rcx
movl -0x20(%rax), %edx
movl (%rax), %edi
cmpl %edx, %edi
jge 0xbc39
movl -0x1c(%rax), %r10d
movq -0x8(%rax), %r8
movq %r8, 0x50(%rsp)
movups -0x18(%rax), %xmm0
movaps %xmm0, 0x40(%rsp)
movl %edi, -0x20(%rax)
movl 0x4(%rax), %edi
movl %edi, -0x1c(%rax)
leaq 0x8(%rax), %rdi
movq $-0x18, %r8
movl 0x18(%rcx,%r8), %r9d
movl %r9d, -0x8(%rcx,%r8)
addq $0x4, %r8
jne 0xbc12
movl %edx, (%rax)
movl %r10d, 0x4(%rax)
movq 0x50(%rsp), %rdx
movq %rdx, 0x10(%rdi)
movaps 0x40(%rsp), %xmm0
movups %xmm0, (%rdi)
addq $0x40, %rax
addq $0x40, %rcx
cmpq %rsi, %rax
jb 0xbbdf
movq %rsi, 0x30(%rsp)
cmpl $0x3, 0x20(%rsp)
jl 0xbcfe
movq 0x18(%rsp), %rax
sarq $0x5, %rax
movq %rax, 0x38(%rsp)
movl $0x2, %eax
movslq %eax, %rcx
movq %rcx, 0x28(%rsp)
addl %eax, %eax
movl %eax, 0x14(%rsp)
movslq %eax, %r14
movq 0x8(%rsp), %r12
movq 0x38(%rsp), %rcx
movq %rcx, %rax
cmpq %r14, %rcx
jl 0xbcd2
movq %r14, %rbx
shlq $0x5, %rbx
movq 0x28(%rsp), %r13
movq %r13, %r15
shlq $0x6, %r15
shlq $0x5, %r13
movq 0x18(%rsp), %rbp
subq %rbx, %rbp
movq 0x8(%rsp), %r12
leaq (%r12,%r13), %rsi
leaq (%r12,%r15), %rdx
movq %r12, %rdi
callq 0xc9ca
movq %rbp, %rax
sarq $0x5, %rax
addq %rbx, %r12
subq %rbx, %rbp
cmpq %r14, %rax
jge 0xbcb0
movq 0x28(%rsp), %rsi
cmpq %rsi, %rax
jle 0xbcf0
shlq $0x5, %rsi
addq %r12, %rsi
movq %r12, %rdi
movq 0x30(%rsp), %rdx
callq 0xc9ca
movl 0x14(%rsp), %eax
cmpl 0x20(%rsp), %eax
jl 0xbc69
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/Baobaobear[P]sort/./grailsort.hpp
// Function: void Mrrl::grail_MergeWithoutBuffer<baobao::TestClass*, std::less<baobao::TestClass>>(baobao::TestClass*, baobao::TestClass*, baobao::TestClass*, std::less<baobao::TestClass>)
void grail_MergeWithoutBuffer(RandomAccessIterator beg, RandomAccessIterator mid, RandomAccessIterator end, Comp compare) {
    if (mid - beg < end - mid) {
        while (mid - beg) {
            RandomAccessIterator p = grail_BinSearchLeft(mid, end, beg, compare);
            if (p != mid) {
                grail_rotate(beg, mid, p);
                beg += p - mid;
                mid = p;
            }
            if (mid == end) break;
            do {
                ++beg;
            } while ((mid - beg) && grail_lesseq(*beg, *mid, compare));
        }
    }
    else {
        while (end - mid) {
            RandomAccessIterator p = grail_BinSearchRight(beg, mid, end - 1, compare);
            if (p != mid) {
                grail_rotate(p, mid, end);
                end -= mid - p;
                mid = p;
            }
            if (beg == mid) break;
            do {
                --end;
            } while ((end - mid) && grail_lesseq(*(mid - 1), *(end - 1), compare));
        }
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rdi, %r14
movq %rsi, %rax
subq %rdi, %rax
movq %rdx, %rcx
subq %rsi, %rcx
cmpq %rcx, %rax
jge 0xca76
cmpq %r14, %rsi
je 0xcaf1
movq %rbx, %r15
cmpq %rbx, %rsi
jae 0xca31
leaq -0x20(%rsi), %rcx
movl (%r14), %eax
movq %rbx, %r15
movq %r15, %rdi
subq %rcx, %rdi
sarq $0x6, %rdi
shlq $0x5, %rdi
leaq (%rcx,%rdi), %rdx
cmpl %eax, (%rcx,%rdi)
jl 0xca25
movq %rdx, %r15
jmp 0xca28
movq %rdx, %rcx
leaq -0x20(%r15), %rdx
cmpq %rdx, %rcx
jb 0xca09
movq %r15, %r12
subq %rsi, %r12
je 0xca4a
movq %r14, %rdi
movq %r15, %rdx
callq 0xcafb
addq %r12, %r14
movq %r15, %rsi
cmpq %rbx, %rsi
je 0xcaf1
addq $0x20, %r14
movq %r14, %rax
cmpq %rsi, %rax
je 0xcaf1
movl (%rsi), %ecx
leaq 0x20(%rax), %r14
cmpl (%rax), %ecx
movq %r14, %rax
jge 0xca5a
addq $-0x20, %r14
jmp 0xc9f7
cmpq %rsi, %rbx
je 0xcaf1
leaq -0x20(%r14), %r12
cmpq %r14, %rsi
jbe 0xcad1
movl -0x20(%rbx), %eax
movq %r12, %rcx
movq %rsi, %r15
movq %r15, %rdi
subq %rcx, %rdi
sarq $0x6, %rdi
shlq $0x5, %rdi
leaq (%rcx,%rdi), %rdx
cmpl (%rcx,%rdi), %eax
jl 0xcaa9
movq %rdx, %rcx
jmp 0xcaaf
movq %rdx, %r15
movq %rcx, %rdx
leaq -0x20(%r15), %rdi
cmpq %rdi, %rdx
jb 0xca8d
movq %r15, %r13
subq %rsi, %r13
je 0xcad1
movq %r15, %rdi
movq %rbx, %rdx
callq 0xcafb
addq %r13, %rbx
movq %r15, %rsi
cmpq %r14, %rsi
je 0xcaf1
addq $-0x20, %rbx
cmpq %rsi, %rbx
je 0xcaf1
movl -0x20(%rbx), %eax
addq $-0x20, %rbx
cmpl -0x20(%rsi), %eax
jge 0xcada
addq $0x20, %rbx
jmp 0xca7f
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/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:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
movq %rbx, %r12
subq %r14, %rbx
sarq $0x5, %rbx
movq %r15, %rax
subq %r12, %rax
sarq $0x5, %rax
cmpq %rax, %rbx
jg 0xcb41
testq %rbx, %rbx
jle 0xcb60
movq %r14, %rdi
movq %r12, %rsi
callq 0xcb6c
shlq $0x5, %rbx
addq %r12, %rbx
movq %r12, %r14
jmp 0xcb0c
testq %rax, %rax
jle 0xcb60
shlq $0x5, %rax
movq %r12, %rbx
subq %rax, %rbx
movq %rbx, %rdi
movq %r12, %rsi
callq 0xcb6c
movq %r12, %r15
jmp 0xcb0c
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/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:
cmpq %rdx, %rsi
jae 0xcc48
movq %rsi, %rax
movl (%rax), %r8d
cmpq %rsi, %rdi
je 0xcbf1
movl (%rdi), %r9d
cmpl %r9d, %r8d
jge 0xcc19
movl %r8d, (%rcx)
movl 0x4(%rax), %r8d
movl %r8d, 0x4(%rcx)
movl $0x2, %r8d
movl (%rax,%r8,4), %r9d
movl %r9d, (%rcx,%r8,4)
incq %r8
cmpq $0x8, %r8
jne 0xcc02
addq $0x20, %rax
jmp 0xcc3f
movl %r9d, (%rcx)
movl 0x4(%rdi), %r8d
movl %r8d, 0x4(%rcx)
movl $0x2, %r8d
movl (%rdi,%r8,4), %r9d
movl %r9d, (%rcx,%r8,4)
incq %r8
cmpq $0x8, %r8
jne 0xcc2a
addq $0x20, %rdi
addq $0x20, %rcx
cmpq %rdx, %rax
jb 0xcbe1
cmpq %rdi, %rcx
sete %al
cmpq %rsi, %rdi
setae %dl
orb %al, %dl
jne 0xcc88
leaq 0x20(%rdi), %rax
movl (%rdi), %edx
movl %edx, (%rcx)
movl 0x4(%rdi), %edx
movl %edx, 0x4(%rcx)
movl $0x2, %edx
movl (%rdi,%rdx,4), %r8d
movl %r8d, (%rcx,%rdx,4)
incq %rdx
cmpq $0x8, %rdx
jne 0xcc6b
addq $0x20, %rcx
movq %rax, %rdi
cmpq %rsi, %rax
jb 0xcc58
retq
// File: /workspace/github_cpp_makefile_star2_O3/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:
pushq %rbx
cmpq %rdx, %rsi
jae 0xcd5e
movq %rsi, %rax
cmpq %rsi, %rdi
je 0xcca3
movl (%rax), %r8d
cmpl (%rdi), %r8d
jge 0xccf2
movl (%rcx), %r8d
movl 0x4(%rcx), %r9d
movq 0x18(%rcx), %r10
movq %r10, -0x10(%rsp)
movups 0x8(%rcx), %xmm0
movaps %xmm0, -0x20(%rsp)
movl (%rax), %r10d
movl %r10d, (%rcx)
movl 0x4(%rax), %r10d
movl %r10d, 0x4(%rcx)
leaq 0x8(%rax), %r10
movl $0x2, %r11d
movl (%rax,%r11,4), %ebx
movl %ebx, (%rcx,%r11,4)
incq %r11
cmpq $0x8, %r11
jne 0xccd4
movl %r8d, (%rax)
movl %r9d, 0x4(%rax)
addq $0x20, %rax
jmp 0xcd3f
movl (%rcx), %r8d
movl 0x4(%rcx), %r9d
movq 0x18(%rcx), %r10
movq %r10, -0x10(%rsp)
movups 0x8(%rcx), %xmm0
movaps %xmm0, -0x20(%rsp)
movl (%rdi), %r10d
movl %r10d, (%rcx)
movl 0x4(%rdi), %r10d
movl %r10d, 0x4(%rcx)
leaq 0x8(%rdi), %r10
movl $0x2, %r11d
movl (%rdi,%r11,4), %ebx
movl %ebx, (%rcx,%r11,4)
incq %r11
cmpq $0x8, %r11
jne 0xcd23
movl %r8d, (%rdi)
movl %r9d, 0x4(%rdi)
addq $0x20, %rdi
movq -0x10(%rsp), %r8
movq %r8, 0x10(%r10)
movaps -0x20(%rsp), %xmm0
movups %xmm0, (%r10)
addq $0x20, %rcx
cmpq %rdx, %rax
jb 0xcc96
cmpq %rdi, %rcx
sete %al
cmpq %rsi, %rdi
sete %dl
orb %al, %dl
jne 0xcdd9
subq %rdi, %rsi
sarq $0x5, %rsi
movl (%rcx), %eax
movl 0x4(%rcx), %edx
movq 0x18(%rcx), %r8
movq %r8, -0x10(%rsp)
movups 0x8(%rcx), %xmm0
movaps %xmm0, -0x20(%rsp)
movl (%rdi), %r8d
movl %r8d, (%rcx)
movl 0x4(%rdi), %r8d
movl %r8d, 0x4(%rcx)
leaq 0x8(%rdi), %r8
movl $0x2, %r9d
movl (%rdi,%r9,4), %r10d
movl %r10d, (%rcx,%r9,4)
incq %r9
cmpq $0x8, %r9
jne 0xcda4
addq $0x20, %rcx
movl %eax, (%rdi)
movl %edx, 0x4(%rdi)
addq $0x20, %rdi
movq -0x10(%rsp), %rax
movq %rax, 0x10(%r8)
movaps -0x20(%rsp), %xmm0
movups %xmm0, (%r8)
decq %rsi
jne 0xcd75
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/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:
pushq %rbp
pushq %rbx
addq $-0x20, %rdx
leaq -0x20(%rsi), %r8
leaq -0x20(%rcx), %rax
cmpq %rdi, %r8
jb 0xceb5
cmpq %rsi, %rdx
jb 0xcdff
movl (%rdx), %r9d
cmpl (%r8), %r9d
jge 0xce4c
movl (%rax), %r9d
movl -0x1c(%rcx), %r10d
movq -0x8(%rcx), %r11
movq %r11, -0x8(%rsp)
movups -0x18(%rcx), %xmm0
movaps %xmm0, -0x18(%rsp)
movl (%r8), %r11d
movl %r11d, (%rax)
movl 0x4(%r8), %r11d
movl %r11d, -0x1c(%rcx)
leaq 0x8(%r8), %r11
movq $-0x18, %rbx
movl 0x20(%r8,%rbx), %ebp
movl %ebp, (%rcx,%rbx)
addq $0x4, %rbx
jne 0xce31
movl %r9d, (%r8)
movl %r10d, 0x4(%r8)
addq $-0x20, %r8
jmp 0xce96
movl (%rax), %r9d
movl -0x1c(%rcx), %r10d
movq -0x8(%rcx), %r11
movq %r11, -0x8(%rsp)
movups -0x18(%rcx), %xmm0
movaps %xmm0, -0x18(%rsp)
movl (%rdx), %r11d
movl %r11d, (%rax)
movl 0x4(%rdx), %r11d
movl %r11d, -0x1c(%rcx)
leaq 0x8(%rdx), %r11
movq $-0x18, %rbx
movl 0x20(%rdx,%rbx), %ebp
movl %ebp, (%rcx,%rbx)
addq $0x4, %rbx
jne 0xce7e
movl %r9d, (%rdx)
movl %r10d, 0x4(%rdx)
addq $-0x20, %rdx
movq -0x8(%rsp), %r9
movq %r9, 0x10(%r11)
movaps -0x18(%rsp), %xmm0
movups %xmm0, (%r11)
addq $-0x20, %rax
addq $-0x20, %rcx
jmp 0xcde9
cmpq %rax, %rdx
sete %cl
cmpq %rsi, %rdx
setb %dil
orb %cl, %dil
jne 0xcf33
leaq -0x20(%rax), %rcx
movl (%rax), %edi
movl 0x4(%rax), %r8d
movq 0x18(%rax), %r9
movq %r9, -0x8(%rsp)
movups 0x8(%rax), %xmm0
movaps %xmm0, -0x18(%rsp)
movl (%rdx), %r9d
movl %r9d, (%rax)
movl 0x4(%rdx), %r9d
movl %r9d, 0x4(%rax)
leaq 0x8(%rdx), %r9
movl $0x2, %r10d
movl (%rdx,%r10,4), %r11d
movl %r11d, (%rax,%r10,4)
incq %r10
cmpq $0x8, %r10
jne 0xcefb
movl %edi, (%rdx)
movl %r8d, 0x4(%rdx)
leaq -0x20(%rdx), %rdi
movq -0x8(%rsp), %rax
movq %rax, 0x10(%r9)
movaps -0x18(%rsp), %xmm0
movups %xmm0, (%r9)
movq %rdi, %rdx
movq %rcx, %rax
cmpq %rsi, %rdi
jae 0xcec7
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl (%rsi), %eax
movslq %eax, %r11
movq %r11, %rax
shlq $0x5, %rax
addq %rdi, %rax
movl (%rdx), %ebx
xorl %r9d, %r9d
testl %ebx, %ebx
sete %r10b
testl %r11d, %r11d
setg %bpl
cmpq %rcx, %rax
setb %r11b
andb %bpl, %r11b
cmpb $0x1, %r11b
jne 0xd60b
movq %rax, %r11
testl %ebx, %ebx
sete %r15b
movl (%rdi), %ebp
movl (%r11), %r14d
cmpl %ebp, %r14d
setge %r12b
jg 0xd5d2
andb %r12b, %r15b
jne 0xd5d2
movl %r14d, (%r8)
movl 0x4(%r11), %ebp
movl %ebp, 0x4(%r8)
movl $0x2, %r14d
movl (%r11,%r14,4), %ebp
movl %ebp, (%r8,%r14,4)
incq %r14
cmpq $0x8, %r14
jne 0xd5bb
addq $0x20, %r11
jmp 0xd5f7
movl %ebp, (%r8)
movl 0x4(%rdi), %ebp
movl %ebp, 0x4(%r8)
movl $0x2, %r14d
movl (%rdi,%r14,4), %ebp
movl %ebp, (%r8,%r14,4)
incq %r14
cmpq $0x8, %r14
jne 0xd5e2
addq $0x20, %rdi
cmpq %rax, %rdi
setb %bpl
jae 0xd60e
addq $0x20, %r8
cmpq %rcx, %r11
jb 0xd591
jmp 0xd60e
movq %rax, %r11
testb %bpl, %bpl
je 0xd65e
movq %rax, %rdx
subq %rdi, %rdx
shrq $0x5, %rdx
movl %edx, (%rsi)
cmpq %rdi, %rax
jbe 0xd66d
leaq -0x20(%rax), %rdx
leaq -0x20(%rcx), %rsi
movl -0x20(%rax), %r8d
movl %r8d, -0x20(%rcx)
movl -0x1c(%rax), %r8d
movl %r8d, -0x1c(%rcx)
movq $-0x18, %r8
movl (%rax,%r8), %r9d
movl %r9d, (%rcx,%r8)
addq $0x4, %r8
jne 0xd643
movq %rsi, %rcx
movq %rdx, %rax
cmpq %rdx, %rdi
jb 0xd624
jmp 0xd66d
movb %r10b, %r9b
subq %r11, %rcx
shrq $0x5, %rcx
movl %ecx, (%rsi)
movl %r9d, (%rdx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/Baobaobear[P]sort/./grailsort.hpp
// Function: void Mrrl::grail_SmartMergeWithoutBuffer<baobao::TestClass*, std::less<baobao::TestClass>>(baobao::TestClass*, int*, int*, baobao::TestClass*, std::less<baobao::TestClass>)
void grail_SmartMergeWithoutBuffer(RandomAccessIterator beg, int *alen1, int *atype, RandomAccessIterator end, Comp compare) {
    int ftype;

    if (beg == end) return;
    RandomAccessIterator mid = beg + *alen1;
    ftype = !*atype;
    if ((mid - beg) && grail_cmp(*(mid - 1), *mid, compare) - ftype >= 0) {
        while (mid - beg) {
            RandomAccessIterator p = (ftype ? grail_BinSearchLeft(mid, end, beg, compare) : grail_BinSearchRight(mid, end, beg, compare));
            if (p > mid) {
                grail_rotate(beg, mid, p);
                beg += p - mid;
                mid = p;
            }
            if (mid == end) {
                *alen1 = (int)(mid - beg);
                return;
            }
            do {
                beg++;
            } while ((mid - beg) && grail_cmp(*beg, *mid, compare) - ftype < 0);
        }
    }
    *alen1 = (int)(end - beg); *atype = ftype;
}

// Assembly:
cmpq %rcx, %rdi
je 0xd9ba
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %rbx
movq %rdi, %r12
movq %rsi, 0x8(%rsp)
movslq (%rsi), %rsi
movq %rdx, 0x10(%rsp)
movl (%rdx), %r15d
xorl %ebp, %ebp
testl %r15d, %r15d
sete %dil
testq %rsi, %rsi
movb %dil, 0x7(%rsp)
je 0xd98d
testl %r15d, %r15d
sete %al
shlq $0x5, %rsi
movl -0x20(%r12,%rsi), %ecx
movl (%r12,%rsi), %edx
cmpl %ecx, %edx
setge %cl
jg 0xd98d
andb %cl, %al
jne 0xd98d
addq %r12, %rsi
movq %rbx, %r13
testl %r15d, %r15d
je 0xd8fc
cmpq %rbx, %rsi
jae 0xd934
leaq -0x20(%rsi), %rcx
movl (%r12), %eax
movq %rbx, %r13
movq %r13, %rdi
subq %rcx, %rdi
sarq $0x6, %rdi
shlq $0x5, %rdi
leaq (%rcx,%rdi), %rdx
cmpl (%rcx,%rdi), %eax
jl 0xd8eb
movq %rdx, %rcx
jmp 0xd8f1
movq %rdx, %r13
movq %rcx, %rdx
leaq -0x20(%r13), %rdi
cmpq %rdi, %rdx
jb 0xd8cf
jmp 0xd934
cmpq %rbx, %rsi
jae 0xd934
leaq -0x20(%rsi), %rcx
movl (%r12), %eax
movq %rbx, %r13
movq %r13, %rdi
subq %rcx, %rdi
sarq $0x6, %rdi
shlq $0x5, %rdi
leaq (%rcx,%rdi), %rdx
cmpl %eax, (%rcx,%rdi)
jl 0xd928
movq %rdx, %r13
jmp 0xd92b
movq %rdx, %rcx
leaq -0x20(%r13), %rdx
cmpq %rdx, %rcx
jb 0xd90c
movq %r13, %r14
subq %rsi, %r14
jbe 0xd94d
movq %r12, %rdi
movq %r13, %rdx
callq 0xcafb
addq %r14, %r12
movq %r13, %rsi
cmpq %rbx, %rsi
je 0xd9bb
addq $0x20, %r12
movq %r12, %rax
movq %rax, %r12
cmpq %rsi, %rax
je 0xd982
testl %r15d, %r15d
sete %cl
movl (%r12), %edi
movl (%rsi), %r8d
cmpl %edi, %r8d
setge %dl
leaq 0x20(%r12), %rax
cmpl %r8d, %edi
jl 0xd959
andb %dl, %cl
jne 0xd959
cmpq %rsi, %r12
jne 0xd8b7
jmp 0xd990
movq %r12, %rsi
movb 0x7(%rsp), %al
movb %al, %bpl
subq %rsi, %rbx
shrq $0x5, %rbx
movq 0x8(%rsp), %rax
movl %ebx, (%rax)
movq 0x10(%rsp), %rax
movl %ebp, (%rax)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
subq %r12, %rbx
shrq $0x5, %rbx
movq 0x8(%rsp), %rax
movl %ebx, (%rax)
jmp 0xd9ac
// File: /workspace/github_cpp_makefile_star2_O3/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:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rax
subq %rdi, %rax
sarq $0x5, %rax
movl $0x1, %ecx
movl %ecx, %r15d
movl %ecx, %edx
imull %edx, %edx
leal (%r15,%r15), %ecx
cmpq %rdx, %rax
jg 0xd9e9
movl %r15d, %r12d
shlq $0x5, %r12
movq %r12, %rdi
callq 0x2030
movq %rax, %r13
movq %rax, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x20d0
movq %r14, %rdi
movq %rbx, %rsi
movq %r13, %rdx
movl %r15d, %ecx
callq 0xb740
movq %r13, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x21c0
// File: /workspace/github_cpp_makefile_star2_O3/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:
movq %rsi, %r10
subq %rdi, %r10
je 0x11813
movq %rdx, %r8
movq %r10, %r9
sarq $0x5, %r9
movq %r9, %rax
xorl %edx, %edx
divq %rcx
cmpq %rcx, %r9
movl $0x1, %ecx
cmovaeq %rax, %rcx
movl (%r8), %eax
movq %rcx, %rdx
shlq $0x5, %rdx
subq %rdx, %rsi
cmpl -0x20(%rdi,%rdx), %eax
jl 0x117e7
addq %rdx, %rdi
subq %rdx, %r10
cmpq %rsi, %rdi
jb 0x117a4
sarq $0x5, %r10
testq %r10, %r10
jle 0x11813
movq %r10, %rcx
shrq %rcx
movq %rcx, %rdx
shlq $0x5, %rdx
cmpl (%rdi,%rdx), %eax
jl 0x117dd
notq %rcx
addq %r10, %rcx
addq %rdx, %rdi
addq $0x20, %rdi
movq %rcx, %r10
testq %rcx, %rcx
jg 0x117c1
jmp 0x11813
testq %rcx, %rcx
jle 0x11813
movq %rcx, %rdx
shrq %rdx
movq %rdx, %rsi
shlq $0x5, %rsi
cmpl (%rdi,%rsi), %eax
jl 0x1180b
notq %rdx
addq %rcx, %rdx
addq %rsi, %rdi
addq $0x20, %rdi
movq %rdx, %rcx
testq %rdx, %rdx
jg 0x117ef
movq %rdi, %rax
retq
// File: /workspace/github_cpp_makefile_star2_O3/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:
movq %rsi, %r10
subq %rdi, %r10
je 0x118d5
movq %rdx, %r8
movq %r10, %r9
sarq $0x5, %r9
movq %r9, %rax
xorl %edx, %edx
divq %rcx
cmpq %rcx, %r9
movl $0x1, %ecx
cmovaeq %rax, %rcx
movl (%r8), %eax
shlq $0x5, %rcx
leaq (%rdi,%rcx), %rdx
movq %rcx, %r8
negq %r8
leaq (%rsi,%r8), %r9
cmpq %rdi, %r9
jbe 0x1189f
cmpl %eax, -0x20(%rsi,%r8)
jl 0x1189f
subq %rcx, %r10
movq %r9, %rsi
cmpq %rdx, %r9
jae 0x11852
sarq $0x5, %r10
testq %r10, %r10
jle 0x118d5
movq %r10, %rcx
shrq %rcx
movq %rcx, %rdx
shlq $0x5, %rdx
cmpl %eax, (%rdi,%rdx)
jge 0x11895
notq %rcx
addq %r10, %rcx
addq %rdx, %rdi
addq $0x20, %rdi
movq %rcx, %r10
testq %rcx, %rcx
jg 0x11879
jmp 0x118d5
subq %rcx, %rsi
sarq $0x5, %rcx
movq %rsi, %rdi
testq %rcx, %rcx
jle 0x118d5
movq %rcx, %rdx
shrq %rdx
movq %rdx, %rsi
shlq $0x5, %rsi
cmpl %eax, (%rdi,%rsi)
jge 0x118cd
notq %rdx
addq %rcx, %rdx
addq %rsi, %rdi
addq $0x20, %rdi
movq %rdx, %rcx
testq %rdx, %rdx
jg 0x118b1
movq %rdi, %rax
retq
// File: /workspace/github_cpp_makefile_star2_O3/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:
movq %rsi, %r9
movq %rdi, %rax
subq %rdi, %r9
leaq (%r8,%r9), %rsi
movq %rcx, %rdi
subq %rdx, %rdi
testq %rdi, %rdi
setle %dil
testq %r9, %r9
setle %r9b
orb %dil, %r9b
jne 0x119e8
pushq %rbx
movl (%rdx), %edi
leaq 0x8(%rax), %r10
cmpl (%r8), %edi
jl 0x11978
movl (%rax), %edi
movl 0x4(%rax), %r9d
movq 0x10(%r10), %r11
movq %r11, -0x10(%rsp)
movups (%r10), %xmm0
movaps %xmm0, -0x20(%rsp)
movl (%r8), %r10d
movl %r10d, (%rax)
movl 0x4(%r8), %r10d
movl %r10d, 0x4(%rax)
leaq 0x8(%r8), %r10
movl $0x2, %r11d
movl (%r8,%r11,4), %ebx
movl %ebx, (%rax,%r11,4)
incq %r11
cmpq $0x8, %r11
jne 0x1193f
movl %edi, (%r8)
movl %r9d, 0x4(%r8)
movq -0x10(%rsp), %rdi
movq %rdi, 0x10(%r10)
movaps -0x20(%rsp), %xmm0
movups %xmm0, (%r10)
addq $0x20, %r8
addq $0x20, %rax
cmpq %rsi, %r8
jne 0x11904
jmp 0x119e4
movl (%rax), %edi
movl 0x4(%rax), %r9d
movq 0x10(%r10), %r11
movq %r11, -0x10(%rsp)
movups (%r10), %xmm0
movaps %xmm0, -0x20(%rsp)
movl (%rdx), %r10d
movl %r10d, (%rax)
movl 0x4(%rdx), %r10d
movl %r10d, 0x4(%rax)
leaq 0x8(%rdx), %r10
movl $0x2, %r11d
movl (%rdx,%r11,4), %ebx
movl %ebx, (%rax,%r11,4)
incq %r11
cmpq $0x8, %r11
jne 0x119a8
movl %edi, (%rdx)
movl %r9d, 0x4(%rdx)
movq -0x10(%rsp), %rdi
movq %rdi, 0x10(%r10)
movaps -0x20(%rsp), %xmm0
movups %xmm0, (%r10)
addq $0x20, %rdx
addq $0x20, %rax
cmpq %rcx, %rdx
jne 0x11904
jmp 0x119e7
movq %rsi, %r8
popq %rbx
movq %r8, %rdi
movq %rax, %rdx
jmp 0x5c32
// File: /workspace/github_cpp_makefile_star2_O3/Baobaobear[P]sort/./wikisort.hpp
// Function: void InsertionSort<baobao::TestClass*, std::less<baobao::TestClass>>(baobao::TestClass*, baobao::TestClass*, std::less<baobao::TestClass>)
void InsertionSort(BidirectionalIterator first, BidirectionalIterator last, Comparison compare) {
    typedef typename std::iterator_traits<BidirectionalIterator>::value_type T;
    if (first == last) return;

    for (BidirectionalIterator cur = first + 1 ; cur != last ; ++cur) {
        BidirectionalIterator sift = cur;
        BidirectionalIterator sift_1 = cur - 1;

        // Compare first so we can avoid 2 moves for
        // an element already positioned correctly.
        if (compare(*sift, *sift_1)) {
            T tmp = *sift;
            do {
                *sift-- = *sift_1;
            } while (sift != first && compare(tmp, *--sift_1));
            *sift = tmp;
        }
    }
}

// Assembly:
cmpq %rsi, %rdi
je 0x11b87
leaq 0x20(%rdi), %rax
cmpq %rsi, %rax
je 0x11b87
pushq %rbp
pushq %rbx
leaq -0x18(%rsp), %rcx
movq %rdi, %rdx
movl (%rax), %r8d
cmpl (%rdx), %r8d
jge 0x11b74
movl %r8d, -0x20(%rsp)
movl 0x24(%rdx), %r9d
movl %r9d, -0x1c(%rsp)
movl $0x2, %r10d
movl 0x20(%rdx,%r10,4), %r11d
movl %r11d, -0x20(%rsp,%r10,4)
incq %r10
cmpq $0x8, %r10
jne 0x11b03
movl (%rdx), %ebp
movq %rax, %rbx
movq %rdx, %r11
movq %rbx, %r10
movl %ebp, (%rbx)
movl 0x4(%r11), %ebx
movl %ebx, 0x4(%r10)
movl $0x2, %ebx
movl (%r11,%rbx,4), %ebp
movl %ebp, 0x20(%r11,%rbx,4)
incq %rbx
cmpq $0x8, %rbx
jne 0x11b30
leaq -0x20(%r10), %rbx
cmpq %rdi, %rbx
je 0x11b5a
movl -0x20(%r11), %ebp
addq $-0x20, %r11
cmpl %ebp, %r8d
jl 0x11b1e
jmp 0x11b5d
movq %rdi, %rbx
movl %r8d, (%rbx)
movl %r9d, -0x1c(%r10)
movups (%rcx), %xmm0
movups %xmm0, -0x18(%r10)
movq 0x10(%rcx), %r8
movq %r8, -0x8(%r10)
addq $0x20, %rax
addq $0x20, %rdx
cmpq %rsi, %rax
jne 0x11ae3
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/Baobaobear[P]sort/./wikisort.hpp
// Function: baobao::TestClass* FindFirstForward<baobao::TestClass*, baobao::TestClass, std::less<baobao::TestClass>>(baobao::TestClass*, baobao::TestClass*, baobao::TestClass const&, std::less<baobao::TestClass>, unsigned long)
RandomAccessIterator FindFirstForward(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(*(index - 1), value) ; index += skip) {
        if (index >= last - skip) {
            return std::lower_bound(index, last, value, compare);
        }
    }
    return std::lower_bound(index - skip, index, value, compare);
}

// Assembly:
movq %rsi, %r10
subq %rdi, %r10
je 0x11c2e
movq %rdx, %r8
movq %r10, %r9
sarq $0x5, %r9
movq %r9, %rax
xorl %edx, %edx
divq %rcx
cmpq %rcx, %r9
movl $0x1, %ecx
cmovaeq %rax, %rcx
movl (%r8), %eax
movq %rcx, %rdx
shlq $0x5, %rdx
subq %rdx, %rsi
cmpl %eax, -0x20(%rdi,%rdx)
jge 0x11c02
addq %rdx, %rdi
subq %rdx, %r10
cmpq %rsi, %rdi
jb 0x11bbf
sarq $0x5, %r10
testq %r10, %r10
jle 0x11c2e
movq %r10, %rcx
shrq %rcx
movq %rcx, %rdx
shlq $0x5, %rdx
cmpl %eax, (%rdi,%rdx)
jge 0x11bf8
notq %rcx
addq %r10, %rcx
addq %rdx, %rdi
addq $0x20, %rdi
movq %rcx, %r10
testq %rcx, %rcx
jg 0x11bdc
jmp 0x11c2e
testq %rcx, %rcx
jle 0x11c2e
movq %rcx, %rdx
shrq %rdx
movq %rdx, %rsi
shlq $0x5, %rsi
cmpl %eax, (%rdi,%rsi)
jge 0x11c26
notq %rdx
addq %rcx, %rdx
addq %rsi, %rdi
addq $0x20, %rdi
movq %rdx, %rcx
testq %rdx, %rdx
jg 0x11c0a
movq %rdi, %rax
retq
// File: /workspace/github_cpp_makefile_star2_O3/Baobaobear[P]sort/./wikisort.hpp
// Function: baobao::TestClass* FindLastBackward<baobao::TestClass*, baobao::TestClass, std::less<baobao::TestClass>>(baobao::TestClass*, baobao::TestClass*, baobao::TestClass const&, std::less<baobao::TestClass>, unsigned long)
RandomAccessIterator FindLastBackward(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(value, *(index - 1)) ; index -= skip) {
        if (index < first + skip) {
            return std::upper_bound(first, index, value, compare);
        }
    }
    return std::upper_bound(index, index + skip, value, compare);
}

// Assembly:
movq %rsi, %r10
subq %rdi, %r10
je 0x11cf0
movq %rdx, %r8
movq %r10, %r9
sarq $0x5, %r9
movq %r9, %rax
xorl %edx, %edx
divq %rcx
cmpq %rcx, %r9
movl $0x1, %ecx
cmovaeq %rax, %rcx
movl (%r8), %eax
shlq $0x5, %rcx
leaq (%rdi,%rcx), %rdx
movq %rcx, %r8
negq %r8
leaq (%rsi,%r8), %r9
cmpq %rdi, %r9
jbe 0x11cba
cmpl -0x20(%rsi,%r8), %eax
jge 0x11cba
subq %rcx, %r10
movq %r9, %rsi
cmpq %rdx, %r9
jae 0x11c6d
sarq $0x5, %r10
testq %r10, %r10
jle 0x11cf0
movq %r10, %rcx
shrq %rcx
movq %rcx, %rdx
shlq $0x5, %rdx
cmpl (%rdi,%rdx), %eax
jl 0x11cb0
notq %rcx
addq %r10, %rcx
addq %rdx, %rdi
addq $0x20, %rdi
movq %rcx, %r10
testq %rcx, %rcx
jg 0x11c94
jmp 0x11cf0
subq %rcx, %rsi
sarq $0x5, %rcx
movq %rsi, %rdi
testq %rcx, %rcx
jle 0x11cf0
movq %rcx, %rdx
shrq %rdx
movq %rdx, %rsi
shlq $0x5, %rsi
cmpl (%rdi,%rsi), %eax
jl 0x11ce8
notq %rdx
addq %rcx, %rdx
addq %rsi, %rdi
addq $0x20, %rdi
movq %rdx, %rcx
testq %rdx, %rdx
jg 0x11ccc
movq %rdi, %rax
retq
// File: /workspace/github_cpp_makefile_star2_O3/rurban[P]dgnlib/dgndump.c
// Function: Usage()
static void Usage()

{
    printf( "Usage: dgndump [-e xmin ymin xmax ymax] [-s] [-r n] filename.dgn\n" );
    printf( "\n" );
    printf( "  -e xmin ymin xmax ymax: only get elements within extents.\n" );
    printf( "  -s: produce summary report of element types and levels.\n");
    printf( "  -r n: report raw binary contents of elements of type n.\n");

    exit( 1 );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0xc43a(%rip), %rdi      # 0xf11a
callq 0x2460
movl $0xa, %edi
callq 0x23f0
leaq 0xc465(%rip), %rdi      # 0xf15b
callq 0x2460
leaq 0xc495(%rip), %rdi      # 0xf197
callq 0x2460
leaq 0xc4c3(%rip), %rdi      # 0xf1d1
callq 0x2460
movl $0x1, %edi
callq 0x2370
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O3/rurban[P]dgnlib/cpl_conv.cpp
// Function: CPLCalloc
void *CPLCalloc( size_t nCount, size_t nSize )

{
    void        *pReturn;

    if( nSize * nCount == 0 )
        return NULL;
    
    pReturn = VSICalloc( nCount, nSize );
    if( pReturn == NULL )
    {
        CPLError( CE_Fatal, CPLE_OutOfMemory,
                  "CPLCalloc(): Out of memory allocating %d bytes.\n",
                  nSize * nCount );
    }

    return pReturn;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
imulq %rdi, %rbx
testq %rbx, %rbx
je 0x2d5d
callq 0x6ece
movq %rax, %r14
testq %rax, %rax
jne 0x2d60
leaq 0xc54c(%rip), %rdx      # 0xf290
xorl %r14d, %r14d
movl $0x4, %edi
movl $0x2, %esi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x460c
jmp 0x2d60
xorl %r14d, %r14d
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/rurban[P]dgnlib/cpl_conv.cpp
// Function: CPLMalloc
void *CPLMalloc( size_t nSize )

{
    void        *pReturn;

    CPLVerifyConfiguration();

    if( nSize == 0 )
        return NULL;

    if( (ssize_t)nSize < 0 )
    {
        CPLError( CE_Failure, CPLE_AppDefined,
                  "CPLMalloc(%ld): Silly size requested.\n",
                  (long)nSize );
        return NULL;
    }
    
    pReturn = VSIMalloc( nSize );
    if( pReturn == NULL )
    {
        CPLError( CE_Fatal, CPLE_OutOfMemory,
                  "CPLMalloc(): Out of memory allocating %ld bytes.\n",
                  (long)nSize );
    }

    return pReturn;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x2d9e
movq %rdi, %r14
js 0x2da2
movq %r14, %rdi
callq 0x6ed3
movq %rax, %rbx
testq %rax, %rax
jne 0x2dbf
leaq 0xc558(%rip), %rdx      # 0xf2e8
xorl %ebx, %ebx
movl $0x4, %edi
movl $0x2, %esi
jmp 0x2db5
xorl %ebx, %ebx
jmp 0x2dbf
leaq 0xc518(%rip), %rdx      # 0xf2c1
xorl %ebx, %ebx
movl $0x3, %edi
movl $0x1, %esi
movq %r14, %rcx
xorl %eax, %eax
callq 0x460c
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/rurban[P]dgnlib/cpl_conv.cpp
// Function: CPLRealloc
void * CPLRealloc( void * pData, size_t nNewSize )

{
    void        *pReturn;

    if ( nNewSize == 0 )
    {
        VSIFree(pData);
        return NULL;
    }

    if( (ssize_t)nNewSize < 0 )
    {
        CPLError( CE_Failure, CPLE_AppDefined,
                  "CPLRealloc(%ld): Silly size requested.\n",
                  (long)nNewSize );
        return NULL;
    }
    
    if( pData == NULL )
        pReturn = VSIMalloc( nNewSize );
    else
        pReturn = VSIRealloc( pData, nNewSize );
    
    if( pReturn == NULL )
    {
        CPLError( CE_Fatal, CPLE_OutOfMemory,
                  "CPLRealloc(): Out of memory allocating %ld bytes.\n",
                  (long)nNewSize );
    }

    return pReturn;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rsi, %rsi
je 0x2de8
movq %rsi, %rbx
js 0x2df2
testq %rdi, %rdi
je 0x2e08
movq %rbx, %rsi
callq 0x6ed8
jmp 0x2e10
callq 0x6edd
xorl %r14d, %r14d
jmp 0x2e36
leaq 0xc521(%rip), %rdx      # 0xf31a
xorl %r14d, %r14d
movl $0x3, %edi
movl $0x1, %esi
jmp 0x2e2c
movq %rbx, %rdi
callq 0x6ed3
movq %rax, %r14
testq %rax, %rax
jne 0x2e36
leaq 0xc523(%rip), %rdx      # 0xf342
xorl %r14d, %r14d
movl $0x4, %edi
movl $0x2, %esi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x460c
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/rurban[P]dgnlib/cpl_conv.cpp
// Function: CPLStrdup
char *CPLStrdup( const char * pszString )

{
    char        *pszReturn;

    if( pszString == NULL )
        pszString = "";

    pszReturn = VSIStrdup( pszString );
        
    if( pszReturn == NULL )
    {
        CPLError( CE_Fatal, CPLE_OutOfMemory,
                  "CPLStrdup(): Out of memory allocating %d bytes.\n",
                  strlen(pszString) );
        
    }
    
    return( pszReturn );
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
leaq 0xd19d(%rip), %r14      # 0xffec
cmovneq %rdi, %r14
movq %r14, %rdi
callq 0x6ee7
movq %rax, %rbx
testq %rax, %rax
jne 0x2e86
movq %r14, %rdi
callq 0x2120
leaq 0xc503(%rip), %rdx      # 0xf375
movl $0x4, %edi
movl $0x2, %esi
movq %rax, %rcx
xorl %eax, %eax
callq 0x460c
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/rurban[P]dgnlib/cpl_conv.cpp
// Function: CPLReadLine
const char *CPLReadLine( FILE * fp )

{
    char *pszRLBuffer = CPLReadLineBuffer(1);
    int         nReadSoFar = 0;

/* -------------------------------------------------------------------- */
/*      Cleanup case.                                                   */
/* -------------------------------------------------------------------- */
    if( fp == NULL )
    {
        CPLReadLineBuffer( -1 );
        return NULL;
    }

/* -------------------------------------------------------------------- */
/*      Loop reading chunks of the line till we get to the end of       */
/*      the line.                                                       */
/* -------------------------------------------------------------------- */
    int nBytesReadThisTime;

    do {
/* -------------------------------------------------------------------- */
/*      Grow the working buffer if we have it nearly full.  Fail out    */
/*      of read line if we can't reallocate it big enough (for          */
/*      instance for a _very large_ file with no newlines).             */
/* -------------------------------------------------------------------- */
        pszRLBuffer = CPLReadLineBuffer( nReadSoFar + 129 );
        if( pszRLBuffer == NULL )
            return NULL;

/* -------------------------------------------------------------------- */
/*      Do the actual read.                                             */
/* -------------------------------------------------------------------- */
        if( CPLFGets( pszRLBuffer+nReadSoFar, 128, fp ) == NULL )
            return NULL;

        nBytesReadThisTime = strlen(pszRLBuffer+nReadSoFar);
        nReadSoFar += nBytesReadThisTime;

    } while( nBytesReadThisTime >= 127
             && pszRLBuffer[nReadSoFar-1] != 13
             && pszRLBuffer[nReadSoFar-1] != 10 );

    return( pszRLBuffer );
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x1, %edi
callq 0x30a8
testq %rbx, %rbx
je 0x308c
xorl %r12d, %r12d
leal 0x81(%r12), %edi
callq 0x30a8
testq %rax, %rax
je 0x3096
movq %rax, %r14
movslq %r12d, %r15
addq %rax, %r15
movq %r15, %rdi
movl $0x80, %esi
movq %rbx, %rdx
callq 0x2e91
testq %rax, %rax
je 0x3096
movq %r15, %rdi
callq 0x2120
cmpl $0x7f, %eax
jl 0x3099
movl %r12d, %ecx
movl %eax, %r12d
addq %rcx, %r12
movzbl -0x1(%r14,%r12), %eax
cmpl $0xd, %eax
je 0x3099
cmpl $0xa, %eax
jne 0x3034
jmp 0x3099
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x30a8
xorl %r14d, %r14d
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/rurban[P]dgnlib/cpl_conv.cpp
// Function: CPLReadLineBuffer(int)
static char *CPLReadLineBuffer( int nRequiredSize )

{
    
/* -------------------------------------------------------------------- */
/*      A required size of -1 means the buffer should be freed.         */
/* -------------------------------------------------------------------- */
    if( nRequiredSize == -1 )
    {
        if( CPLGetTLS( CTLS_RLBUFFERINFO ) != NULL )
        {
            CPLFree( CPLGetTLS( CTLS_RLBUFFERINFO ) );
            CPLSetTLS( CTLS_RLBUFFERINFO, NULL, FALSE );
        }
        return NULL;
    }

/* -------------------------------------------------------------------- */
/*      If the buffer doesn't exist yet, create it.                     */
/* -------------------------------------------------------------------- */
    GUInt32 *pnAlloc = (GUInt32 *) CPLGetTLS( CTLS_RLBUFFERINFO );

    if( pnAlloc == NULL )
    {
        pnAlloc = (GUInt32 *) CPLMalloc(200);
        *pnAlloc = 196;
        CPLSetTLS( CTLS_RLBUFFERINFO, pnAlloc, TRUE );
    }

/* -------------------------------------------------------------------- */
/*      If it is too small, grow it bigger.                             */
/* -------------------------------------------------------------------- */
    if( (int) *pnAlloc < nRequiredSize+1 )
    {
        int nNewSize = nRequiredSize + 4 + 500;

        pnAlloc = (GUInt32 *) CPLRealloc(pnAlloc,nNewSize);
        if( pnAlloc == NULL )
        {
            CPLSetTLS( CTLS_RLBUFFERINFO, NULL, FALSE );
            return NULL;
        }
            
        *pnAlloc = nNewSize - 4;
        CPLSetTLS( CTLS_RLBUFFERINFO, pnAlloc, TRUE );
    }

    return (char *) (pnAlloc+1);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %edi, %r14d
movl $0x1, %edi
callq 0x50c3
movq %rax, %rbx
cmpl $-0x1, %r14d
je 0x312d
testq %rbx, %rbx
jne 0x30ec
movl $0xc8, %edi
callq 0x2d6b
movq %rax, %rbx
movl $0xc4, (%rax)
movl $0x1, %edi
movq %rax, %rsi
movl $0x1, %edx
callq 0x50f1
cmpl %r14d, (%rbx)
jg 0x3127
leal 0x1f8(%r14), %eax
movslq %eax, %rsi
movq %rbx, %rdi
callq 0x2dcb
testq %rax, %rax
je 0x3144
movq %rax, %rbx
addl $0x1f4, %r14d           # imm = 0x1F4
movl %r14d, (%rax)
movl $0x1, %edi
movq %rax, %rsi
movl $0x1, %edx
callq 0x50f1
addq $0x4, %rbx
jmp 0x3158
testq %rbx, %rbx
je 0x3156
movl $0x1, %edi
callq 0x50c3
movq %rax, %rdi
callq 0x6edd
xorl %ebx, %ebx
movl $0x1, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x50f1
jmp 0x3158
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/rurban[P]dgnlib/cpl_conv.cpp
// Function: CPLScanString
char *CPLScanString( const char *pszString, int nMaxLength,
                     int bTrimSpaces, int bNormalize )
{
    char    *pszBuffer;

    if ( !pszString )
        return NULL;

    if ( !nMaxLength )
        return CPLStrdup( "" );

    pszBuffer = (char *)CPLMalloc( nMaxLength + 1 );
    if ( !pszBuffer )
        return NULL;

    strncpy( pszBuffer, pszString,  nMaxLength );
    pszBuffer[nMaxLength] = '\0';

    if ( bTrimSpaces )
    {
        size_t  i = strlen( pszBuffer );
        while ( i-- > 0 && isspace(pszBuffer[i]) )
            pszBuffer[i] = '\0';
    }

    if ( bNormalize )
    {
        size_t  i = strlen( pszBuffer );
        while ( i-- > 0 )
        {
            if ( pszBuffer[i] == ':' )
                pszBuffer[i] = '_';
        }
    }

    return pszBuffer;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
testq %rdi, %rdi
je 0x3367
movl %esi, %r12d
testl %esi, %esi
je 0x3375
movl %ecx, %ebp
movl %edx, %r14d
movq %rdi, %r15
leal 0x1(%r12), %eax
movslq %eax, %rdi
callq 0x2d6b
testq %rax, %rax
je 0x3367
movq %rax, %rbx
movslq %r12d, %r12
movq %rax, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x2150
movb $0x0, (%rbx,%r12)
testl %r14d, %r14d
je 0x3343
movq %rbx, %rdi
callq 0x2120
testq %rax, %rax
je 0x3343
movq %rax, %r14
movsbl -0x1(%rbx,%r14), %edi
callq 0x2060
testl %eax, %eax
je 0x3343
movb $0x0, -0x1(%rbx,%r14)
decq %r14
jne 0x3329
testl %ebp, %ebp
je 0x3369
movq %rbx, %rdi
callq 0x2120
testq %rax, %rax
je 0x3369
cmpb $0x3a, -0x1(%rbx,%rax)
jne 0x3360
movb $0x5f, -0x1(%rbx,%rax)
decq %rax
jne 0x3354
jmp 0x3369
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0xcc70(%rip), %rdi      # 0xffec
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x2e41
// File: /workspace/github_cpp_makefile_star2_O3/rurban[P]dgnlib/cpl_conv.cpp
// Function: CPLScanLong
long CPLScanLong( const char *pszString, int nMaxLength )
{
    long    iValue;
    char    *pszValue = (char *)CPLMalloc( nMaxLength + 1);

/* -------------------------------------------------------------------- */
/*      Compute string into local buffer, and terminate it.             */
/* -------------------------------------------------------------------- */
    strncpy( pszValue, pszString, nMaxLength );
    pszValue[nMaxLength] = '\0';

/* -------------------------------------------------------------------- */
/*      Use atol() to fetch out the result                              */
/* -------------------------------------------------------------------- */
    iValue = atol( pszValue );

    CPLFree( pszValue );
    return iValue;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
leal 0x1(%rbx), %eax
movslq %eax, %rdi
callq 0x2d6b
movq %rax, %r15
movslq %ebx, %rbx
movq %rax, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x2150
movb $0x0, (%r15,%rbx)
movq %r15, %rdi
callq 0x2360
movq %rax, %rbx
movq %r15, %rdi
callq 0x6edd
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq