// File: /workspace/github_c_makefile_star2_O3/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, %r14d
movq %rdi, %rbx
movslq %esi, %r13
movq %r13, %rdi
shlq $0x5, %rdi
leaq 0x19d5e(%rip), %rsi     # 0xb1cf8
movl $0x3, %edx
callq 0x3a0e1
testl %ebp, %ebp
jle 0x98239
movl %ebp, %ecx
movq %rcx, 0x28(%rsp)
movl %r14d, %edi
leaq (,%rdi,8), %rbp
xorl %r8d, %r8d
movl %r14d, 0x4(%rsp)
movq %r13, 0x30(%rsp)
movq %rax, 0x20(%rsp)
movq %rdi, 0x10(%rsp)
movq %rbp, 0x18(%rsp)
testl %r14d, %r14d
jle 0x9822b
movq %r8, 0x8(%rsp)
movq %r8, %r15
shlq $0x5, %r15
movq %rdi, %rbp
movq %rbx, %r14
xorl %r12d, %r12d
leaq 0x1(%r12), %rax
movq %rax, 0x38(%rsp)
cmpq %r13, %rax
jge 0x980c5
movl $0x1, %r13d
movq (%r14,%r13,8), %rax
movsd 0x8(%rax,%r15), %xmm0
movq (%rbx,%r12,8), %rax
movsd 0x8(%rax,%r15), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x98053
leaq 0x13ad4(%rip), %rdi     # 0xabb08
callq 0x54bec
testl %eax, %eax
je 0x98069
movq (%r14,%r13,8), %rax
movsd 0x8(%rax,%r15), %xmm0
movq (%rbx,%r12,8), %rax
movsd 0x8(%rax,%r15), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x980b9
leaq 0x13aa8(%rip), %rdi     # 0xabb08
callq 0x54bec
testl %eax, %eax
je 0x980b9
movq (%r14,%r13,8), %rax
movups (%rax,%r15), %xmm0
movups 0x10(%rax,%r15), %xmm1
movaps %xmm1, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
movq (%rbx,%r12,8), %rcx
movups (%rcx,%r15), %xmm0
movups 0x10(%rcx,%r15), %xmm1
movups %xmm0, (%rax,%r15)
movups %xmm1, 0x10(%rax,%r15)
movq (%rbx,%r12,8), %rax
movapd 0x40(%rsp), %xmm0
movapd 0x50(%rsp), %xmm1
movupd %xmm1, 0x10(%rax,%r15)
movupd %xmm0, (%rax,%r15)
incq %r13
cmpq %r13, %rbp
jne 0x98011
addq $0x8, %r14
decq %rbp
movq 0x10(%rsp), %rdi
movq 0x38(%rsp), %r12
cmpq %rdi, %r12
movq 0x30(%rsp), %r13
jne 0x97ff8
movl 0x4(%rsp), %r14d
testl %r14d, %r14d
movq 0x20(%rsp), %rax
movq 0x18(%rsp), %rbp
movq 0x8(%rsp), %r8
jle 0x9822b
xorl %r12d, %r12d
movl %r12d, %esi
movslq %r12d, %rcx
leal 0x1(%rcx), %edx
cmpl %edx, %r14d
movl %edx, %r8d
cmovgl %r14d, %r8d
leal -0x1(%r8), %edi
leaq 0x1(%rcx), %r9
cmpq %r13, %r9
jge 0x9814c
movq -0x8(%rbx,%r9,8), %r10
movq (%rbx,%r9,8), %r11
movsd 0x8(%r10,%r15), %xmm0
incl %r12d
incq %r9
ucomisd 0x8(%r11,%r15), %xmm0
jne 0x98145
jnp 0x9811f
leal -0x1(%r12), %edi
jmp 0x9814f
movl %r8d, %r12d
movl %edi, %r8d
subl %esi, %r8d
jne 0x9816c
xorps %xmm0, %xmm0
cvtsi2sd %r12d, %xmm0
movq (%rbx,%rcx,8), %rcx
movsd %xmm0, 0x10(%rcx,%r15)
jmp 0x981b8
jl 0x981b8
leal 0x2(%rsi), %r9d
imull %r8d, %r9d
notl %esi
addl %esi, %edi
movq %r8, %rsi
imulq %rdi, %rsi
shrq %rsi
addl %r9d, %edx
addl %esi, %edx
xorps %xmm0, %xmm0
cvtsi2sd %edx, %xmm0
incl %r8d
xorps %xmm1, %xmm1
cvtsi2sd %r8d, %xmm1
divsd %xmm1, %xmm0
leaq (%rbx,%rcx,8), %rcx
xorl %edx, %edx
movq (%rcx,%rdx,8), %rsi
movsd %xmm0, 0x10(%rsi,%r15)
incq %rdx
cmpl %edx, %r8d
jne 0x981a5
cmpl %r14d, %r12d
jl 0x98104
testl %r14d, %r14d
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %r8
jle 0x9822b
xorl %esi, %esi
movq (%rbx,%rsi,8), %rcx
movslq 0x18(%rcx,%r15), %rdx
shlq $0x5, %rdx
movupd (%rcx,%r15), %xmm0
movupd 0x10(%rcx,%r15), %xmm1
movupd %xmm1, 0x10(%rax,%rdx)
movupd %xmm0, (%rax,%rdx)
incq %rsi
cmpq %rsi, %rdi
jne 0x981d2
testl %r14d, %r14d
jle 0x9822b
xorl %edx, %edx
movq (%rbx,%rdx), %rcx
movupd (%rax,%rdx,4), %xmm0
movupd 0x10(%rax,%rdx,4), %xmm1
movupd %xmm1, 0x10(%rcx,%r15)
movupd %xmm0, (%rcx,%r15)
addq $0x8, %rdx
cmpq %rdx, %rbp
jne 0x98206
incq %r8
cmpq 0x28(%rsp), %r8
jne 0x97fda
movq %rax, %rdi
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3a180