// File: ostafen[P]Fast-Insertion-Sort/src/algo.cpp
// Function: MergeSort<int>::merge(int*, int, int, int, int*)
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
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movl %r8d, -0x1c(%rbp)
movq %r9, -0x28(%rbp)
movl -0x18(%rbp), %eax
subl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
movl -0x1c(%rbp), %eax
subl -0x18(%rbp), %eax
movl %eax, -0x3c(%rbp)
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
shlq $0x2, %rcx
addq %rcx, %rax
addq $0x4, %rax
movq %rax, -0x48(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x38(%rbp), %eax
jge 0x62bb
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl -0x2c(%rbp), %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
movq -0x28(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x628d
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x2c(%rbp), %ecx
xorl %eax, %eax
cmpl -0x38(%rbp), %ecx
movb %al, -0x49(%rbp)
jge 0x62e8
movl -0x30(%rbp), %eax
cmpl -0x3c(%rbp), %eax
setl %al
movb %al, -0x49(%rbp)
movb -0x49(%rbp), %al
testb $0x1, %al
jne 0x62f1
jmp 0x6357
movq -0x28(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movq -0x48(%rbp), %rcx
movslq -0x30(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jg 0x632a
movq -0x28(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq -0x10(%rbp), %rax
movslq -0x34(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x6349
movq -0x48(%rbp), %rax
movslq -0x30(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq -0x10(%rbp), %rax
movslq -0x34(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x62cf
jmp 0x6359
movl -0x2c(%rbp), %eax
cmpl -0x38(%rbp), %eax
jge 0x638d
movq -0x28(%rbp), %rax
movl -0x2c(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x2c(%rbp)
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
movq -0x10(%rbp), %rax
movl -0x34(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x34(%rbp)
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x6359
jmp 0x638f
movl -0x30(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jge 0x63c3
movq -0x48(%rbp), %rax
movl -0x30(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x30(%rbp)
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
movq -0x10(%rbp), %rax
movl -0x34(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x34(%rbp)
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x638f
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop