// File: /workspace/github_cpp_makefile_star2_O1/Baobaobear[P]sort/./sortlib.hpp
// Function: void baobao::internal::tim_sort_stack_merge_with_buffer_13<false, baobao::TestClass*, baobao::TestClass*, std::less<baobao::TestClass>>(baobao::TestClass*, unsigned long, baobao::TestClass**, baobao::TestClass**&, baobao::TestClass*, std::less<baobao::TestClass>)
void tim_sort_stack_merge_with_buffer_13(RandomAccessBufferIterator buf, size_t bufsize, RandomAccessIterator* run_stack, RandomAccessIterator* &stack_top, RandomAccessIterator end, Comp compare)
{
    while (stack_top - run_stack >= 2 && end - stack_top[0] > stack_top[0] - stack_top[-1])
    {
        if (stack_top - run_stack > 2 && (stack_top[0] - stack_top[-2]) * 4 / 3 >= stack_top[-1] - stack_top[-3]) // a >= c
        {
            merge_2_part_with_buffer<safecopy>(buf, bufsize, stack_top[-3], stack_top[-2], stack_top[-1], compare);
            stack_top[-2] = stack_top[-1];
            stack_top[-1] = stack_top[0];
            --stack_top;
            while (stack_top - run_stack > 2 && (stack_top[-1] - stack_top[-2]) * 4 / 3 >= (stack_top[-2] - stack_top[-3]))
            {
                merge_2_part_with_buffer<safecopy>(buf, bufsize, stack_top[-3], stack_top[-2], stack_top[-1], compare);
                stack_top[-2] = stack_top[-1];
                stack_top[-1] = stack_top[0];
                --stack_top;
            }
        }
        else if ((stack_top[0] - stack_top[-1]) * 4 / 3 >= (stack_top[-1] - stack_top[-2])) // 1.333 * a > b
        {
            merge_2_part_with_buffer<safecopy>(buf, bufsize, stack_top[-2], stack_top[-1], stack_top[0], compare);
            stack_top[-1] = stack_top[0];
            --stack_top;
        }
        else
        {
            break;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r13
movq (%rcx), %rdi
movq %rdi, %rax
subq %rdx, %rax
cmpq $0x9, %rax
jl 0x9ea0
movq %r8, %rbx
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r12
movabsq $0x5555555555555556, %rbp # imm = 0x5555555555555556
movq -0x8(%rdi), %r9
movq (%rdi), %r8
movq %rbx, %rcx
subq %r8, %rcx
movq %r8, %rsi
subq %r9, %rsi
cmpq %rsi, %rcx
jle 0x9ea0
cmpq $0x10, %rax
je 0x9d97
movq -0x18(%rdi), %r10
movq -0x10(%rdi), %rcx
movq %r8, %rax
subq %rcx, %rax
sarq $0x3, %rax
imulq %rbp
movq %rdx, %rax
shrq $0x3f, %rax
addq %rdx, %rax
movq %r9, %rdx
subq %r10, %rdx
sarq $0x5, %rdx
cmpq %rdx, %rax
jge 0x9df6
sarq $0x3, %rsi
movq %rsi, %rax
imulq %rbp
movq %rdx, %rax
shrq $0x3f, %rax
addq %rdx, %rax
movq -0x10(%rdi), %rdx
movq %r9, %rcx
subq %rdx, %rcx
sarq $0x5, %rcx
cmpq %rcx, %rax
jl 0x9ea0
movq %r13, %rdi
movq %r12, %rsi
movq %r9, %rcx
callq 0x7784
movq (%r14), %rax
movq (%rax), %rcx
movq %rcx, -0x8(%rax)
addq $-0x8, (%r14)
movq (%r14), %rdi
movq %rdi, %rax
subq %r15, %rax
cmpq $0x8, %rax
jg 0x9d47
jmp 0x9ea0
movq %r13, %rdi
movq %r12, %rsi
movq %r10, %rdx
movq %r9, %r8
callq 0x7784
movq (%r14), %rax
movq -0x8(%rax), %rcx
movq %rcx, -0x10(%rax)
movq (%r14), %rax
movq (%rax), %rcx
movq %rcx, -0x8(%rax)
movq (%r14), %rax
leaq -0x8(%rax), %rcx
movq %rcx, (%r14)
subq %r15, %rcx
cmpq $0x11, %rcx
jl 0x9dde
movq -0x10(%rax), %r8
movq -0x20(%rax), %r9
movq -0x18(%rax), %rcx
movq %r8, %rax
subq %rcx, %rax
sarq $0x3, %rax
imulq %rbp
movq %rdx, %rax
shrq $0x3f, %rax
addq %rdx, %rax
movq %rcx, %rdx
subq %r9, %rdx
sarq $0x5, %rdx
cmpq %rdx, %rax
jl 0x9dde
movq %r13, %rdi
movq %r12, %rsi
movq %r9, %rdx
callq 0x7784
movq (%r14), %rax
movq -0x8(%rax), %rcx
movq %rcx, -0x10(%rax)
movq (%r14), %rax
movq (%rax), %rcx
movq %rcx, -0x8(%rax)
movq (%r14), %rax
leaq -0x8(%rax), %rcx
movq %rcx, (%r14)
subq %r15, %rcx
cmpq $0x10, %rcx
jg 0x9e2f
jmp 0x9dde
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq