// File: /workspace/github_cpp_makefile_star2_O2/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 %r8, %rbx
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r13
movq (%rcx), %rdi
pushq $0x3
popq %rbp
movq %rdi, %rax
subq %r15, %rax
cmpq $0x9, %rax
jl 0x7a01
movq -0x8(%rdi), %r9
movq (%rdi), %r8
movq %rbx, %rcx
subq %r8, %rcx
movq %r8, %rsi
subq %r9, %rsi
cmpq %rsi, %rcx
jle 0x7a01
movq -0x10(%rdi), %rcx
cmpq $0x10, %rax
je 0x7942
movq %r8, %rax
subq %rcx, %rax
sarq $0x3, %rax
cqto
idivq %rbp
movq -0x18(%rdi), %rdx
movq %r9, %rdi
subq %rdx, %rdi
sarq $0x5, %rdi
cmpq %rdi, %rax
jge 0x798b
sarq $0x3, %rsi
movq %rsi, %rax
cqto
idivq %rbp
movq %r9, %rdx
subq %rcx, %rdx
sarq $0x5, %rdx
cmpq %rdx, %rax
jl 0x7a01
movq %r13, %rdi
movq %r12, %rsi
movq %rcx, %rdx
movq %r9, %rcx
callq 0x64ed
movq (%r14), %rax
movq (%rax), %rcx
movq %rcx, -0x8(%rax)
movq (%r14), %rdi
addq $-0x8, %rdi
movq %rdi, (%r14)
jmp 0x78ea
movq %r13, %rdi
movq %r12, %rsi
movq %r9, %r8
callq 0x64ed
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), %rdi
movq %rdi, (%r14)
movq %rdi, %rcx
subq %r15, %rcx
cmpq $0x11, %rcx
jl 0x78ea
movq -0x10(%rax), %r8
movq -0x20(%rax), %r9
movq -0x18(%rax), %rcx
movq %r8, %rax
subq %rcx, %rax
sarq $0x3, %rax
cqto
idivq %rbp
movq %rcx, %rdx
subq %r9, %rdx
sarq $0x5, %rdx
cmpq %rdx, %rax
jl 0x78ea
movq %r13, %rdi
movq %r12, %rsi
movq %r9, %rdx
jmp 0x7994
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq