// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/svm.c
// Function: svm_group_classes
int svm_group_classes(Svm_problem prob, int **start_ret, int **count_ret, int *perm)
{
	/*Last Changed 02.05.2005*/
	int l,  *count, *data_label, i, classno, *start, classes[MAXCLASSES], nr_class = 0;
 l = prob.l;
 for (i = 0; i < l; i++)
	  search_and_add_into_list(classes, &nr_class, (int)prob.y[i]);
 count = safecalloc(nr_class, sizeof(int), "svm_group_classes", 5);
	data_label = safemalloc(l * sizeof(int), "svm_group_classes", 6);
	for (i = 0; i < l; i++)
	 {
		 classno = search_list(classes, nr_class, (int)prob.y[i]);
			(count[classno])++;
		 data_label[i] = classno;
	 }
	start = safemalloc(nr_class * sizeof(int), "svm_group_classes", 11);
	start[0] = 0;
	for (i = 1;i < nr_class; i++)
		 start[i] = start[i - 1] + count[i - 1];
	for (i = 0; i < l; i++)
	 {
 		perm[start[data_label[i]]] = i;
		 ++start[data_label[i]];
	 }
	start[0] = 0;
	for (i = 1;i < nr_class; i++)
		 start[i] = start[i - 1] + count[i - 1];
	*start_ret = start;
	*count_ret = count;
	safe_free(data_label);
 return nr_class;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
leaq 0x10(%rbp), %rax
movq %rax, -0x120(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl $0x0, -0x114(%rbp)
movl (%rax), %eax
movl %eax, -0x1c(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0xc7052
movq -0x120(%rbp), %rax
leaq -0x110(%rbp), %rdi
movq 0x8(%rax), %rax
movslq -0x34(%rbp), %rcx
cvttsd2si (%rax,%rcx,8), %edx
leaq -0x114(%rbp), %rsi
callq 0x50840
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xc7018
movslq -0x114(%rbp), %rdi
movl $0x4, %esi
leaq 0x27024(%rip), %rdx     # 0xee089
movl $0x5, %ecx
callq 0x52f40
movq %rax, -0x28(%rbp)
movslq -0x1c(%rbp), %rdi
shlq $0x2, %rdi
leaq 0x27007(%rip), %rsi     # 0xee089
movl $0x6, %edx
callq 0x52d70
movq %rax, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0xc70f2
movq -0x120(%rbp), %rax
leaq -0x110(%rbp), %rdi
movl -0x114(%rbp), %esi
movq 0x8(%rax), %rax
movslq -0x34(%rbp), %rcx
cvttsd2si (%rax,%rcx,8), %edx
callq 0x508f0
movl %eax, -0x38(%rbp)
movq -0x28(%rbp), %rax
movslq -0x38(%rbp), %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movl -0x38(%rbp), %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 0xc7097
movslq -0x114(%rbp), %rdi
shlq $0x2, %rdi
leaq 0x26f85(%rip), %rsi     # 0xee089
movl $0xb, %edx
callq 0x52d70
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movl $0x0, (%rax)
movl $0x1, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x114(%rbp), %eax
jge 0xc7164
movq -0x40(%rbp), %rax
movl -0x34(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
movq -0x28(%rbp), %rax
movl -0x34(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
addl (%rax,%rcx,4), %edx
movq -0x40(%rbp), %rax
movslq -0x34(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xc7123
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0xc71b5
movl -0x34(%rbp), %edx
movq -0x18(%rbp), %rax
movq -0x40(%rbp), %rcx
movq -0x30(%rbp), %rsi
movslq -0x34(%rbp), %rdi
movslq (%rsi,%rdi,4), %rsi
movslq (%rcx,%rsi,4), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x40(%rbp), %rax
movq -0x30(%rbp), %rcx
movslq -0x34(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xc716b
movq -0x40(%rbp), %rax
movl $0x0, (%rax)
movl $0x1, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x114(%rbp), %eax
jge 0xc7207
movq -0x40(%rbp), %rax
movl -0x34(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
movq -0x28(%rbp), %rax
movl -0x34(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
addl (%rax,%rcx,4), %edx
movq -0x40(%rbp), %rax
movslq -0x34(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xc71c6
movq -0x40(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x30(%rbp), %rdi
callq 0x52e80
movl -0x114(%rbp), %eax
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
nopw %cs:(%rax,%rax)