// File: /workspace/github_cpp_makefile_star2_O1/ostafen[P]Fast-Insertion-Sort/src/algo.cpp
// Function: MergeSort<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>::merge(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, int, int, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*)
void merge(T arr[], int l, int m, int r, T *L)
    {
        int i, j, k;
        int n1 = m - l + 1;
        int n2 = r - m;

        //T L[n1];
        T *R = arr + m + 1; //T R[n2];

        for (i = 0; i < n1; i++)
            L[i] = arr[l + i];

        /*for (j = 0; j < n2; j++)
            R[j] = arr[m + 1 + j];*/

        i = 0;
        j = 0;
        k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        while (i < n1)
            arr[k++] = L[i++];

        while (j < n2)
            arr[k++] = R[j++];
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r9, %r12
movq %rsi, 0x10(%rsp)
subl %ecx, %r8d
movl %r8d, 0x4(%rsp)
movl %ecx, 0x1c(%rsp)
movslq %ecx, %rbp
movl %ebp, %eax
subl %edx, %eax
movq %rax, 0x8(%rsp)
movl %edx, (%rsp)
movslq %edx, %rbx
js 0x55ac
movq 0x8(%rsp), %rax
leal 0x1(%rax), %r15d
movq %rbx, %r13
shlq $0x5, %r13
addq 0x10(%rsp), %r13
movq %r12, %r14
movq %r14, %rdi
movq %r13, %rsi
callq 0x30c0
addq $0x20, %r13
addq $0x20, %r14
decq %r15
jne 0x5594
movq %r12, 0x28(%rsp)
shlq $0x5, %rbp
movq %rbp, 0x20(%rsp)
cmpl $0x0, 0x8(%rsp)
setns %al
movl 0x4(%rsp), %r14d
testl %r14d, %r14d
setg %cl
andb %al, %cl
xorl %eax, %eax
movl (%rsp), %ebp
movl $0x0, %edx
cmpb $0x1, %cl
jne 0x5676
movq 0x10(%rsp), %rax
movq 0x20(%rsp), %rcx
addq %rax, %rcx
addq $0x20, %rcx
movq %rcx, 0x30(%rsp)
shlq $0x5, %rbx
addq %rax, %rbx
xorl %edx, %edx
movl (%rsp), %ebp
xorl %eax, %eax
movl %ebp, %r12d
movl %edx, %ebp
movslq %edx, %r13
shlq $0x5, %r13
addq 0x28(%rsp), %r13
movl %eax, %r15d
movslq %eax, %r14
shlq $0x5, %r14
addq 0x30(%rsp), %r14
movq %r13, %rdi
movq %r14, %rsi
callq 0x3050
movq %rbx, %rdi
testl %eax, %eax
jle 0x564e
movq %r14, %rsi
callq 0x30c0
movl %r15d, %eax
incl %eax
movl 0x4(%rsp), %r14d
movl %ebp, %edx
jmp 0x5662
movq %r13, %rsi
callq 0x30c0
movl %ebp, %edx
incl %edx
movl 0x4(%rsp), %r14d
movl %r15d, %eax
movl %r12d, %ebp
incl %ebp
cmpl 0x8(%rsp), %edx
jg 0x5676
addq $0x20, %rbx
cmpl %r14d, %eax
jl 0x5606
cmpl 0x8(%rsp), %edx
jg 0x56cd
movl %eax, 0x8(%rsp)
movslq %edx, %rax
movslq %ebp, %r13
shlq $0x5, %r13
addq 0x10(%rsp), %r13
shlq $0x5, %rax
movq 0x28(%rsp), %r12
addq %rax, %r12
movl (%rsp), %eax
addl %edx, %eax
movl 0x1c(%rsp), %r15d
notl %r15d
addl %eax, %r15d
xorl %ebx, %ebx
movq %r13, %rdi
movq %r12, %rsi
callq 0x30c0
addq $0x20, %r13
decl %ebx
addq $0x20, %r12
cmpl %ebx, %r15d
jne 0x56ad
subl %ebx, %ebp
movl 0x8(%rsp), %eax
cmpl %r14d, %eax
jge 0x5719
movslq %eax, %r15
movslq %r14d, %r12
movslq %ebp, %r14
shlq $0x5, %r14
movq 0x10(%rsp), %rcx
addq %rcx, %r14
movq %r15, %rax
shlq $0x5, %rax
movq 0x20(%rsp), %rdx
addq %rax, %rdx
leaq (%rcx,%rdx), %rbx
addq $0x20, %rbx
incq %r15
movq %r14, %rdi
movq %rbx, %rsi
callq 0x30c0
addq $0x20, %r14
addq $0x20, %rbx
cmpq %r12, %r15
jl 0x56fe
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rdi
callq 0x4af8