// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/svmsolve.c
// Function: select_working_set
int select_working_set(Solverptr s, int* out_i, int* out_j)
{
 /*Last Changed 28.04.2005*/
	double Gmax1 = -DBL_MAX, Gmax2 = -DBL_MAX;		
	int i, Gmax1_idx = -1, Gmax2_idx = -1;
	for (i = 0; i < s->active_size; i++)
	 {
	 	if (s->y[i] == +1)	
		  {
		  	if (!is_upper_bound(s, i))	
					 {
				   if (-s->G[i] >= Gmax1)
							 {
					    Gmax1 = -s->G[i];
					    Gmax1_idx = i;
							 }
					 }
			  if (!is_lower_bound(s, i))	
					 {
				   if (s->G[i] >= Gmax2)
							 {
					    Gmax2 = s->G[i];
					    Gmax2_idx = i;
							 }
					 }
			 }
		 else		
			 {
			  if (!is_upper_bound(s, i))	
					 {
				   if (-s->G[i] >= Gmax2)
							 {
					    Gmax2 = -s->G[i];
					    Gmax2_idx = i;
							 }
					 }
			  if (!is_lower_bound(s, i))	
					 {
				   if (s->G[i] >= Gmax1)
							 {
					    Gmax1 = s->G[i];
					    Gmax1_idx = i;
							 }
					 }
			 }
	 }
	if (Gmax1 + Gmax2 < s->eps)
 		return 1;
	*out_i = Gmax1_idx;
	*out_j = Gmax2_idx;
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movsd 0x191e4(%rip), %xmm0    # 0xe7570
movsd %xmm0, -0x28(%rbp)
movsd 0x191d7(%rip), %xmm0    # 0xe7570
movsd %xmm0, -0x30(%rbp)
movl $0xffffffff, -0x38(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x3c(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl (%rcx), %eax
jge 0xce56a
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x34(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x1, %eax
jne 0xce49c
movq -0x10(%rbp), %rdi
movl -0x34(%rbp), %esi
callq 0xcdc10
cmpl $0x0, %eax
jne 0xce450
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x34(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
ucomisd -0x28(%rbp), %xmm0
jb 0xce44e
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x34(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, -0x28(%rbp)
movl -0x34(%rbp), %eax
movl %eax, -0x38(%rbp)
jmp 0xce450
movq -0x10(%rbp), %rdi
movl -0x34(%rbp), %esi
callq 0xcdc50
cmpl $0x0, %eax
jne 0xce497
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x34(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd -0x30(%rbp), %xmm0
jb 0xce495
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x34(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x30(%rbp)
movl -0x34(%rbp), %eax
movl %eax, -0x3c(%rbp)
jmp 0xce497
jmp 0xce55a
movq -0x10(%rbp), %rdi
movl -0x34(%rbp), %esi
callq 0xcdc10
cmpl $0x0, %eax
jne 0xce511
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x34(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
ucomisd -0x30(%rbp), %xmm0
jb 0xce50f
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x34(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, -0x30(%rbp)
movl -0x34(%rbp), %eax
movl %eax, -0x3c(%rbp)
jmp 0xce511
movq -0x10(%rbp), %rdi
movl -0x34(%rbp), %esi
callq 0xcdc50
cmpl $0x0, %eax
jne 0xce558
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x34(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd -0x28(%rbp), %xmm0
jb 0xce556
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x34(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x28(%rbp)
movl -0x34(%rbp), %eax
movl %eax, -0x38(%rbp)
jmp 0xce558
jmp 0xce55a
jmp 0xce55c
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xce3b3
movsd -0x28(%rbp), %xmm1
addsd -0x30(%rbp), %xmm1
movq -0x10(%rbp), %rax
movsd 0x48(%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0xce58c
movl $0x1, -0x4(%rbp)
jmp 0xce5a5
movl -0x38(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movl -0x3c(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nop