// File: /workspace/github_c_makefile_star2_O3/olcaytaner[P]Isell/svmsolve.c
// Function: nu_select_working_set
int nu_select_working_set(Solverptr s, int* out_i, int* out_j)
{
	/*Last Changed 29.04.2005*/
	double Gmax1 = -DBL_MAX, Gmax2 = -DBL_MAX, Gmax3 = -DBL_MAX, Gmax4 = -DBL_MAX;	
	int Gmax1_idx = -1, Gmax2_idx = -1, Gmax3_idx = -1, Gmax4_idx = -1, i;
	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] >= Gmax3)
							 {  
					    Gmax3 = -s->G[i];
					    Gmax3_idx = i;
							 }
					 }
			  if (!is_lower_bound(s, i))	
					 {
				   if (s->G[i] >= Gmax4)
							 {
					    Gmax4 = s->G[i];
					    Gmax4_idx = i;
							 }
					 }
			 }
	 }
	if (fmax(Gmax1 + Gmax2, Gmax3 + Gmax4) < s->eps)
 		return 1;
	if (Gmax1 + Gmax2 > Gmax3 + Gmax4)
	 {
 		*out_i = Gmax1_idx;
 		*out_j = Gmax2_idx;
	 }
	else
	 {
		 *out_i = Gmax3_idx;
		 *out_j = Gmax4_idx;
	 }
	return 0;
}

// Assembly:
movslq (%rdi), %rax
testq %rax, %rax
jle 0x9629d
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
movq 0x8(%rdi), %r11
movq 0x18(%rdi), %rbx
movsd 0x1497c(%rip), %xmm2    # 0xaab18
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
xorl %r14d, %r14d
movapd 0x10023(%rip), %xmm3    # 0xa61d0
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
movapd %xmm2, %xmm1
movapd %xmm2, %xmm4
movapd %xmm2, %xmm0
cmpb $0x1, (%r11,%r14)
movb (%rbx,%r14), %bpl
jne 0x9622c
cmpb $0x1, %bpl
je 0x96213
movq 0x10(%rdi), %r15
movsd (%r15,%r14,8), %xmm5
xorpd %xmm3, %xmm5
ucomisd %xmm0, %xmm5
movapd %xmm0, %xmm6
cmpnlesd %xmm5, %xmm6
movapd %xmm6, %xmm7
andnpd %xmm5, %xmm7
andpd %xmm0, %xmm6
orpd %xmm7, %xmm6
movapd %xmm6, %xmm0
cmovael %r14d, %r8d
testb %bpl, %bpl
je 0x96281
movq 0x10(%rdi), %r15
movsd (%r15,%r14,8), %xmm5
ucomisd %xmm4, %xmm5
jb 0x96281
movapd %xmm5, %xmm4
movl %r14d, %r10d
jmp 0x96281
cmpb $0x1, %bpl
je 0x9626a
movq 0x10(%rdi), %r15
movsd (%r15,%r14,8), %xmm5
xorpd %xmm3, %xmm5
ucomisd %xmm1, %xmm5
movapd %xmm1, %xmm6
cmpnlesd %xmm5, %xmm6
movapd %xmm6, %xmm7
andnpd %xmm5, %xmm7
andpd %xmm1, %xmm6
orpd %xmm7, %xmm6
movapd %xmm6, %xmm1
cmovael %r14d, %ecx
testb %bpl, %bpl
je 0x96281
movq 0x10(%rdi), %r15
movsd (%r15,%r14,8), %xmm5
ucomisd %xmm2, %xmm5
jb 0x96281
movapd %xmm5, %xmm2
movl %r14d, %r9d
incq %r14
cmpq %r14, %rax
jne 0x961ca
addsd %xmm4, %xmm0
addsd %xmm2, %xmm1
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x962c0
movsd 0x1b9cb(%rip), %xmm0    # 0xb1c70
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
movapd %xmm0, %xmm1
movapd %xmm0, %xmm2
cmpunordsd %xmm0, %xmm2
movapd %xmm2, %xmm3
andpd %xmm1, %xmm3
movapd %xmm1, %xmm4
maxsd %xmm0, %xmm4
andnpd %xmm4, %xmm2
orpd %xmm3, %xmm2
movsd 0x48(%rdi), %xmm3
movl $0x1, %eax
ucomisd %xmm2, %xmm3
ja 0x96304
ucomisd %xmm1, %xmm0
cmoval %r8d, %ecx
cmoval %r10d, %r9d
movl %ecx, (%rsi)
movl %r9d, (%rdx)
xorl %eax, %eax
retq