// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/libarray.c
// Function: find_max_occured
int* find_max_occured(int *list, int size, int* newsize)
{
 /*!Last Changed 02.02.2004 added safemalloc*/
 /*!Last Changed 09.05.2003*/
 int *result, i, *tmplist, j = 0, tmp;
 (*newsize) = 0;
 for (i = 0; i < size; i++)
   if (list[i] > 0)
     (*newsize)++;
 result = safemalloc((*newsize) * sizeof(int), "find_max_occured", 6);
 tmplist = safemalloc((*newsize) * sizeof(int), "find_max_occured", 7);
 for (i = 0; i < size; i++)
   if (list[i] > 0)
    {
     result[j] = i;
     tmplist[j] = list[i];
     j++;
    }
 for (i = 1; i < (*newsize); i++)
  {
   j = i;
   while (j > 0 && tmplist[j] >= tmplist[j-1])
    {
     tmp = tmplist[j];
     tmplist[j] = tmplist[j-1];
     tmplist[j-1] = tmp;
     tmp = result[j];
     result[j] = result[j-1];
     result[j-1] = tmp;
     j--;
    }
  }
 safe_free(tmplist);
 return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movl $0x0, -0x34(%rbp)
movq -0x18(%rbp), %rax
movl $0x0, (%rax)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x501b9
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jle 0x501ac
movq -0x18(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0x501ae
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x5018b
movq -0x18(%rbp), %rax
movslq (%rax), %rdi
shlq $0x2, %rdi
leaq 0x9621d(%rip), %rsi     # 0xe63e8
movl $0x6, %edx
callq 0x52d70
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movslq (%rax), %rdi
shlq $0x2, %rdi
leaq 0x961fd(%rip), %rsi     # 0xe63e8
movl $0x7, %edx
callq 0x52d70
movq %rax, -0x30(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x50250
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jle 0x50243
movl -0x24(%rbp), %edx
movq -0x20(%rbp), %rax
movslq -0x34(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq -0x30(%rbp), %rax
movslq -0x34(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x50245
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x50200
movl $0x1, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x5033a
movl -0x24(%rbp), %eax
movl %eax, -0x34(%rbp)
xorl %eax, %eax
cmpl $0x0, -0x34(%rbp)
movb %al, -0x39(%rbp)
jle 0x50298
movq -0x30(%rbp), %rax
movslq -0x34(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movq -0x30(%rbp), %rcx
movl -0x34(%rbp), %edx
subl $0x1, %edx
movslq %edx, %rdx
cmpl (%rcx,%rdx,4), %eax
setge %al
movb %al, -0x39(%rbp)
movb -0x39(%rbp), %al
testb $0x1, %al
jne 0x502a4
jmp 0x5032a
movq -0x30(%rbp), %rax
movslq -0x34(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x38(%rbp)
movq -0x30(%rbp), %rax
movl -0x34(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
movq -0x30(%rbp), %rax
movslq -0x34(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x38(%rbp), %edx
movq -0x30(%rbp), %rax
movl -0x34(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movq -0x20(%rbp), %rax
movslq -0x34(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x38(%rbp)
movq -0x20(%rbp), %rax
movl -0x34(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
movq -0x20(%rbp), %rax
movslq -0x34(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x38(%rbp), %edx
movq -0x20(%rbp), %rax
movl -0x34(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl -0x34(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x5026c
jmp 0x5032c
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x50257
movq -0x30(%rbp), %rdi
callq 0x52e80
movq -0x20(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)