// File: /workspace/github_c_makefile_star2_O3/jiqingxiaoxi[P]RPA/RPA.c
// Function: merge
void merge(int *store,int *temp,int *data,int start,int end,int middle)
{
        int i,j,k;
        i=start;
        j=middle+1;
        k=start;
        while(i<=middle&&j<=end)
        {
                if(data[store[i]*6]<data[store[j]*6])
                {
                        temp[k]=store[i];
                        k++;
                        i++;
                        continue;
                }
                if(data[store[j]*6]<data[store[i]*6])
                {
                        temp[k]=store[j];
                        k++;
                        j++;
                        continue;
                }
        //len
                if(data[store[i]*6+1]<data[store[j]*6+1])
                {
                        temp[k]=store[i];
                        k++;
                        i++;
                        continue;
                }
                if(data[store[j]*6+1]<data[store[i]*6+1])
                {
                        temp[k]=store[j];
                        k++;
                        j++;
                        continue;
                }
        //gi
                if(data[store[i]*6+2]<data[store[j]*6+2])
                {
                        temp[k]=store[i];
                        k++;
                        i++;
                        continue;
                }
                if(data[store[j]*6+2]<data[store[i]*6+2])
                {
                        temp[k]=store[j];
                        k++;
                        j++;
                        continue;
                }
        //position
                if(data[store[i]*6+3]<data[store[j]*6+3])
                {
                        temp[k]=store[i];
                        k++;
                        i++;
                }
                else
                {
                        temp[k]=store[j];
                        k++;
                        j++;
                        continue;
                }
        }
        while(i<=middle)
        {
                temp[k]=store[i];
                k++;
                i++;
        }
        while(j<=end)
        {
                temp[k]=store[j];
                k++;
                j++;
        }
        for(i=start;i<=end;i++)
                store[i]=temp[i];
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, -0x30(%rbp)
leal 0x1(%r9), %edi
cmpl %r9d, %ecx
setg %al
cmpl %r8d, %r9d
setge %r11b
orb %al, %r11b
movslq %ecx, %rax
movl %ecx, -0x34(%rbp)
movq %rsi, -0x40(%rbp)
movq %rax, -0x48(%rbp)
jne 0xb509
leaq (%rsi,%rax,4), %r14
movl %ecx, %r11d
movl %ecx, %ebx
movq -0x30(%rbp), %rcx
movslq %ebx, %rax
movslq (%rcx,%rax,4), %r15
movq %r15, %rax
addq %r15, %rax
leaq (%rax,%rax,2), %r13
movl (%rdx,%r13,4), %r10d
movslq %edi, %rax
movslq (%rcx,%rax,4), %r12
leaq (%r12,%r12), %rax
leaq (%rax,%rax,2), %rax
movl (%rdx,%rax,4), %esi
cmpl %esi, %r10d
jge 0xb4b0
movl %r15d, (%r14)
incl %ebx
jmp 0xb4b7
jle 0xb4ca
movl %r12d, (%r14)
incl %edi
incl %r11d
cmpl %r9d, %ebx
jg 0xb512
addq $0x4, %r14
cmpl %r8d, %edi
jle 0xb47d
jmp 0xb512
movl %r13d, %esi
orl $0x1, %esi
movslq %esi, %rsi
movl (%rdx,%rsi,4), %esi
movl %eax, %r10d
orl $0x1, %r10d
movslq %r10d, %r10
movl (%rdx,%r10,4), %r10d
cmpl %r10d, %esi
jl 0xb4a9
jg 0xb4b2
movl 0x8(%rdx,%r13,4), %esi
movl 0x8(%rdx,%rax,4), %r10d
cmpl %r10d, %esi
jl 0xb4a9
jg 0xb4b2
movl 0xc(%rdx,%r13,4), %esi
cmpl 0xc(%rdx,%rax,4), %esi
jl 0xb4a9
jmp 0xb4b2
movl %ecx, %r11d
movl %ecx, %ebx
movq -0x30(%rbp), %rcx
cmpl %r9d, %ebx
jle 0xb51d
movq -0x40(%rbp), %r14
jmp 0xb548
movslq %r11d, %rdx
movslq %ebx, %rax
leaq (%rcx,%rax,4), %rax
subl %ebx, %r9d
incl %r9d
movq -0x40(%rbp), %r14
leaq (%r14,%rdx,4), %rbx
xorl %edx, %edx
movl (%rax,%rdx,4), %esi
movl %esi, (%rbx,%rdx,4)
incq %rdx
cmpl %edx, %r9d
jne 0xb537
addl %edx, %r11d
cmpl %r8d, %edi
movl -0x34(%rbp), %ebx
jg 0xb57c
movslq %r11d, %rsi
movslq %edi, %rax
movq -0x30(%rbp), %rcx
leaq (%rcx,%rax,4), %rax
movl %r8d, %edx
subl %edi, %edx
incl %edx
leaq (%r14,%rsi,4), %r9
xorl %r10d, %r10d
movl (%rax,%r10,4), %ecx
movl %ecx, (%r9,%r10,4)
incq %r10
cmpl %r10d, %edx
jne 0xb56c
cmpl %r8d, %ebx
jg 0xb5a7
movq -0x48(%rbp), %rdx
leaq (%r14,%rdx,4), %rax
movq -0x30(%rbp), %rcx
leaq (%rcx,%rdx,4), %rdx
subl %ebx, %r8d
incl %r8d
xorl %ecx, %ecx
movl (%rax,%rcx,4), %esi
movl %esi, (%rdx,%rcx,4)
incq %rcx
cmpl %ecx, %r8d
jne 0xb599
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq