// File: /workspace/github_c_makefile_star2_O0/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:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movsd 0x194a4(%rip), %xmm0    # 0xe7570
movsd %xmm0, -0x28(%rbp)
movsd 0x19497(%rip), %xmm0    # 0xe7570
movsd %xmm0, -0x30(%rbp)
movsd 0x1948a(%rip), %xmm0    # 0xe7570
movsd %xmm0, -0x38(%rbp)
movsd 0x1947d(%rip), %xmm0    # 0xe7570
movsd %xmm0, -0x40(%rbp)
movl $0xffffffff, -0x44(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x48(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x4c(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x50(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x54(%rbp)
movl -0x54(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl (%rcx), %eax
jge 0xce2d2
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x54(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x1, %eax
jne 0xce204
movq -0x10(%rbp), %rdi
movl -0x54(%rbp), %esi
callq 0xcdc10
cmpl $0x0, %eax
jne 0xce1b8
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x54(%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 0xce1b6
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x54(%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 -0x54(%rbp), %eax
movl %eax, -0x44(%rbp)
jmp 0xce1b8
movq -0x10(%rbp), %rdi
movl -0x54(%rbp), %esi
callq 0xcdc50
cmpl $0x0, %eax
jne 0xce1ff
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x54(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd -0x30(%rbp), %xmm0
jb 0xce1fd
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x54(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x30(%rbp)
movl -0x54(%rbp), %eax
movl %eax, -0x48(%rbp)
jmp 0xce1ff
jmp 0xce2c2
movq -0x10(%rbp), %rdi
movl -0x54(%rbp), %esi
callq 0xcdc10
cmpl $0x0, %eax
jne 0xce279
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x54(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
ucomisd -0x38(%rbp), %xmm0
jb 0xce277
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x54(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, -0x38(%rbp)
movl -0x54(%rbp), %eax
movl %eax, -0x4c(%rbp)
jmp 0xce279
movq -0x10(%rbp), %rdi
movl -0x54(%rbp), %esi
callq 0xcdc50
cmpl $0x0, %eax
jne 0xce2c0
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x54(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd -0x40(%rbp), %xmm0
jb 0xce2be
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x54(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x40(%rbp)
movl -0x54(%rbp), %eax
movl %eax, -0x50(%rbp)
jmp 0xce2c0
jmp 0xce2c2
jmp 0xce2c4
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0xce11b
movsd -0x28(%rbp), %xmm3
addsd -0x30(%rbp), %xmm3
movsd -0x38(%rbp), %xmm2
addsd -0x40(%rbp), %xmm2
movaps %xmm2, %xmm4
movaps %xmm3, %xmm1
cmpunordsd %xmm1, %xmm1
movaps %xmm1, %xmm0
pand %xmm4, %xmm0
maxsd %xmm3, %xmm2
pandn %xmm2, %xmm1
por %xmm0, %xmm1
movq -0x10(%rbp), %rax
movsd 0x48(%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0xce31c
movl $0x1, -0x4(%rbp)
jmp 0xce363
movsd -0x28(%rbp), %xmm0
addsd -0x30(%rbp), %xmm0
movsd -0x38(%rbp), %xmm1
addsd -0x40(%rbp), %xmm1
ucomisd %xmm1, %xmm0
jbe 0xce34a
movl -0x44(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movl -0x48(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
jmp 0xce35c
movl -0x4c(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movl -0x50(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)