// File: /workspace/github_c_makefile_star2_O1/olcaytaner[P]Isell/tests.c
// Function: assign_ranks_to_equal_size_observations
void assign_ranks_to_equal_size_observations(Obsptr* obs, int k, int N)
{
	int i, j, t, l, sum;
 Obs tmp, *obsarray;
 obsarray = safemalloc(k * sizeof(Obs), "assign_ranks_to_equal_size_observations", 3); 
	for (i = 0; i < N; i++)
	 {
			for (j = 0; j < k; j++)
				 for (t = j + 1; t < k; t++)
							if ((obs[t][i].observation < obs[j][i].observation && !get_parameter_o("accuracy")) || (obs[t][i].observation > obs[j][i].observation && get_parameter_o("accuracy")))
        {
         tmp = obs[t][i];
         obs[t][i] = obs[j][i];
         obs[j][i] = tmp;
        }
   j = 0;
   while (j < k)
    {
     t = j;
     while (j + 1 < k && obs[j][i].observation == obs[j + 1][i].observation)
       j++;
     if (j != t)
      {
       sum = 0;
       for (l = t + 1; l <= j + 1; l++)
         sum += l;
       for (l = t; l <= j; l++)
         obs[l][i].rij = (sum + 0.0) / (j - t + 1);
      }
     else
       obs[j][i].rij = j + 1;
     j++;
    }
   for (j = 0; j < k; j++)
     obsarray[obs[j][i].index] = obs[j][i];
   for (j = 0; j < k; j++)
     obs[j][i] = obsarray[j];
		}
 safe_free(obsarray);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %edx, %ebp
movl %esi, %ebx
movq %rdi, %r12
movslq %esi, %r14
movq %r14, %rdi
shlq $0x5, %rdi
leaq 0x19909(%rip), %rsi     # 0xaec78
movl $0x3, %edx
callq 0x390f5
testl %ebp, %ebp
jle 0x95612
movl %ebp, %ecx
movq %rcx, 0x20(%rsp)
movl %ebx, %r13d
leaq (,%r13,8), %r8
xorl %ebp, %ebp
movl %ebx, 0x4(%rsp)
movq %r14, 0x10(%rsp)
movq %rax, 0x28(%rsp)
movq %r13, 0x30(%rsp)
movq %r8, 0x18(%rsp)
movq %rbp, 0x8(%rsp)
testl %ebx, %ebx
jle 0x954a0
movq 0x8(%rsp), %rbp
shlq $0x5, %rbp
movq %r13, %r15
movq %r12, %r14
xorl %eax, %eax
movq %rax, %r13
incq %rax
movq %rax, 0x38(%rsp)
cmpq 0x10(%rsp), %rax
jge 0x95486
movl $0x1, %ebx
movq (%r14,%rbx,8), %rax
movq (%r12,%r13,8), %rcx
movsd 0x8(%rcx,%rbp), %xmm0
ucomisd 0x8(%rax,%rbp), %xmm0
jbe 0x9540c
leaq 0x13639(%rip), %rdi     # 0xa8a3c
callq 0x536e7
testl %eax, %eax
je 0x95432
movq (%r14,%rbx,8), %rax
movsd 0x8(%rax,%rbp), %xmm0
movq (%r12,%r13,8), %rax
ucomisd 0x8(%rax,%rbp), %xmm0
jbe 0x9547a
leaq 0x13613(%rip), %rdi     # 0xa8a3c
callq 0x536e7
testl %eax, %eax
je 0x9547a
movq (%r14,%rbx,8), %rax
movups (%rax,%rbp), %xmm0
movups 0x10(%rax,%rbp), %xmm1
movaps %xmm1, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
movq (%r12,%r13,8), %rcx
movups (%rcx,%rbp), %xmm0
movups 0x10(%rcx,%rbp), %xmm1
movups %xmm0, (%rax,%rbp)
movups %xmm1, 0x10(%rax,%rbp)
movq (%r12,%r13,8), %rax
movapd 0x40(%rsp), %xmm0
movapd 0x50(%rsp), %xmm1
movupd %xmm1, 0x10(%rax,%rbp)
movupd %xmm0, (%rax,%rbp)
incq %rbx
cmpq %rbx, %r15
jne 0x953e6
addq $0x8, %r14
decq %r15
movq 0x30(%rsp), %r13
movq 0x38(%rsp), %rax
cmpq %r13, %rax
jne 0x953cb
movl 0x4(%rsp), %ebx
testl %ebx, %ebx
movq 0x10(%rsp), %r14
movq 0x28(%rsp), %rax
movq 0x8(%rsp), %rbp
jle 0x95597
xorl %r15d, %r15d
movl %r15d, %esi
movslq %r15d, %rdx
leal 0x1(%rdx), %edi
cmpl %edi, %ebx
cmovgl %ebx, %edi
leal -0x1(%rdi), %ecx
leaq 0x1(%rdx), %r8
cmpq %r14, %r8
jge 0x95506
movq %rbp, %r9
shlq $0x5, %r9
movq -0x8(%r12,%r8,8), %r10
movq (%r12,%r8,8), %r11
movsd 0x8(%r10,%r9), %xmm0
incl %r15d
incq %r8
ucomisd 0x8(%r11,%r9), %xmm0
jne 0x95500
jnp 0x954d3
leal -0x1(%r15), %ecx
jmp 0x95509
movl %edi, %r15d
movl %ecx, %edi
subl %esi, %edi
jne 0x9552d
xorps %xmm0, %xmm0
cvtsi2sd %r15d, %xmm0
movslq %ecx, %rcx
movq (%r12,%rcx,8), %rcx
movq %rbp, %rdx
shlq $0x5, %rdx
movsd %xmm0, 0x10(%rcx,%rdx)
jmp 0x9558e
xorpd %xmm0, %xmm0
jl 0x9555e
movl %esi, %r8d
notl %r8d
addl %ecx, %r8d
movq %rdi, %r9
imulq %r8, %r9
shrq %r9
leal 0x2(%rsi), %r8d
imull %edi, %r8d
addl %esi, %r8d
leal (%r9,%r8), %edi
incl %edi
xorps %xmm0, %xmm0
cvtsi2sd %edi, %xmm0
subl %esi, %ecx
jl 0x9558e
incl %ecx
xorps %xmm1, %xmm1
cvtsi2sd %ecx, %xmm1
divsd %xmm1, %xmm0
leaq (%r12,%rdx,8), %rdx
xorl %esi, %esi
movq (%rdx,%rsi,8), %rdi
movq %rbp, %r8
shlq $0x5, %r8
movsd %xmm0, 0x10(%rdi,%r8)
incq %rsi
cmpl %esi, %ecx
jne 0x95575
cmpl %ebx, %r15d
jl 0x954be
testl %ebx, %ebx
movq 0x18(%rsp), %r8
jle 0x955d4
xorl %edi, %edi
movq (%r12,%rdi,8), %rcx
movq %rbp, %rdx
shlq $0x5, %rdx
movslq 0x18(%rcx,%rdx), %rsi
shlq $0x5, %rsi
movupd (%rcx,%rdx), %xmm0
movupd 0x10(%rcx,%rdx), %xmm1
movupd %xmm1, 0x10(%rax,%rsi)
movupd %xmm0, (%rax,%rsi)
incq %rdi
cmpq %rdi, %r13
jne 0x955a2
testl %ebx, %ebx
jle 0x95604
xorl %esi, %esi
movq (%r12,%rsi), %rcx
movq %rbp, %rdx
shlq $0x5, %rdx
movupd (%rax,%rsi,4), %xmm0
movupd 0x10(%rax,%rsi,4), %xmm1
movupd %xmm1, 0x10(%rcx,%rdx)
movupd %xmm0, (%rcx,%rdx)
addq $0x8, %rsi
cmpq %rsi, %r8
jne 0x955da
incq %rbp
cmpq 0x20(%rsp), %rbp
jne 0x953ad
movq %rax, %rdi
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x39194