// File: /workspace/github_c_makefile_star2_O1/olcaytaner[P]Isell/rule.c
// Function: write_condition
void write_condition(Decisionconditionptr condition)
{
	/*!Last Changed 29.01.2004*/
	/*!Last Changed 30.10.2003*/
	char st[10], pst[READLINELENGTH];
	int sindex, i, j, dim = current_dataset->multifeaturecount - 1;
	double newsplit;
	double newweight, *weights;
	weights = safecalloc(dim, sizeof(double), "write_condition", 5);
	if (condition->next != NULL)
		 strcpy(st," AND ");
	else
		 strcpy(st,"");
	if (condition->featureindex >= 0)
   switch (current_dataset->features[condition->featureindex].type)
			 { 
    	case INTEGER:fprintf(output,"F%d %c %d%s",condition->featureindex + 1, condition->comparison, (int)condition->value, st);
		  		            break;
   		case    REAL:if (!mustrealize)
  						            fprintf(output,"F%d %c %5.4f%s", condition->featureindex + 1, condition->comparison, condition->value, st);
						            else
																		 {
																			 newsplit = (double) (condition->value * sqrt(variance.values[condition->featureindex].floatvalue) + mean.values[condition->featureindex].floatvalue);
                    fprintf(output,"F%d %c %5.4f%s", condition->featureindex + 1, condition->comparison, newsplit, st);
																		 }
	  			            break;
   		case  STRING:sindex = (int) condition->value;
						            fprintf(output,"F%d %c %s%s",condition->featureindex + 1,condition->comparison,current_dataset->features[condition->featureindex].strings[sindex], st);
		  		            break;
	   }
	else
	 {
		 if (condition->featureindex == LINEAR)
			 {
     newsplit = (double) condition->w0;
		   for (i = 0; i < dim - 1; i++)
					 {
						 newweight = condition->w.values[0][i] / sqrt(variance.values[i].floatvalue);
							newsplit += (double) (mean.values[i].floatvalue * newweight);
							set_precision(pst, NULL, "F%d ");
			  	 fprintf(output, pst, newweight, i + 1);
					 }
					newweight = condition->w.values[0][i] / sqrt(variance.values[i].floatvalue);
					newsplit += (double) (mean.values[i].floatvalue * newweight);
			  set_precision(pst, NULL, NULL);
			  fprintf(output, pst, newweight);
					set_precision(pst, "F%d %c ", "%s");
			  fprintf(output, pst, dim, condition->comparison, newsplit, st);
			 }
			else
				 if (condition->featureindex == QUADRATIC)
					 {
						 sindex = 0;
       newsplit = (double) condition->w0;
   		  for (i = 0; i < dim; i++)
							  for (j = i; j < dim; j++)
									 {
										 newweight = condition->w.values[0][sindex] / sqrt(variance.values[i].floatvalue * variance.values[j].floatvalue);
											weights[i] -= newweight * mean.values[j].floatvalue;
											weights[j] -= newweight * mean.values[i].floatvalue;
											newsplit -= (double) (newweight * mean.values[i].floatvalue * mean.values[j].floatvalue);
           set_precision(pst, NULL, "F%dF%d ");
										 fprintf(output, pst, newweight, i + 1, j + 1);  
										 sindex++;
									 }
							for (i = 0; i < dim - 1; i++)
							 {								 
								 newweight = condition->w.values[0][sindex] / sqrt(variance.values[i].floatvalue);
								 weights[i] += newweight;
									newsplit += (double) (newweight * mean.values[i].floatvalue);
         set_precision(pst, NULL, "F%d ");
								 fprintf(output, pst, weights[i], i + 1);  
								 sindex++;
							 }
							newweight = condition->w.values[0][sindex] / sqrt(variance.values[i].floatvalue);
							weights[i] += newweight;
							newsplit += (double) (newweight * mean.values[i].floatvalue);
			    set_precision(pst, NULL, NULL);
       fprintf(output, pst, weights[i]);
			    set_precision(pst, "F%d %c ", "%s");
       fprintf(output, pst, i + 1, condition->comparison, newsplit, st);
					 }
		}
	safe_free(weights);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x7a188, %rsp          # imm = 0x7A188
movq %rdi, %r14
leaq 0x58f9f(%rip), %rbx     # 0xd2870
movq (%rbx), %rax
movslq 0x1c0(%rax), %r13
leaq -0x1(%r13), %rdi
leaq 0x3337e(%rip), %rdx     # 0xacc64
movl $0x8, %esi
movq %rdi, 0x38(%rsp)
movl $0x5, %ecx
callq 0x39210
movq %rax, 0x28(%rsp)
movq %r14, 0x8(%rsp)
cmpq $0x0, 0x48(%r14)
je 0x7991c
movw $0x20, 0x20(%rsp)
movl $0x444e4120, 0x1c(%rsp) # imm = 0x444E4120
jmp 0x79921
movb $0x0, 0x1c(%rsp)
movq 0x8(%rsp), %rax
movslq (%rax), %rdx
testq %rdx, %rdx
js 0x7998c
movq (%rbx), %rax
imulq $0x340, %rdx, %rcx      # imm = 0x340
movl 0x30f08(%rax,%rcx), %esi
cmpl $0x2, %esi
je 0x79abb
cmpl $0x1, %esi
je 0x79a76
testl %esi, %esi
jne 0x79f9a
leaq 0x335748(%rip), %rax    # 0x3af0a8
movq (%rax), %rdi
incl %edx
movq 0x8(%rsp), %rax
movsbl 0x4(%rax), %ecx
cvttsd2si 0x8(%rax), %r8d
leaq 0x332ff(%rip), %rsi     # 0xacc7a
leaq 0x1c(%rsp), %r9
xorl %eax, %eax
callq 0x42e0
jmp 0x79f9a
cmpl $-0x3, %edx
je 0x79afb
cmpl $-0x2, %edx
jne 0x79f9a
movq 0x8(%rsp), %rax
movsd 0x30(%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
cmpl $0x3, %r13d
jl 0x79c94
addl $-0x2, %r13d
movq %r13, %rbx
xorl %r12d, %r12d
leaq 0x3355df(%rip), %r14    # 0x3aefa8
leaq 0x332dc(%rip), %r13     # 0xaccac
leaq 0x60(%rsp), %rbp
leaq 0x3356cc(%rip), %r15    # 0x3af0a8
movq 0x8(%rsp), %rax
movq 0x28(%rax), %rax
movq (%rax), %rax
movsd (%rax,%r12,8), %xmm0
movsd %xmm0, (%rsp)
leaq 0x3355de(%rip), %rax    # 0x3aefd8
movq (%rax), %rax
movsd (%rax,%r12,8), %xmm0
ucomisd 0x292fd(%rip), %xmm0    # 0xa2d08
jb 0x79a13
sqrtsd %xmm0, %xmm0
jmp 0x79a18
callq 0x4300
movsd (%rsp), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
movq (%r14), %rax
movsd (%rax,%r12,8), %xmm0
mulsd %xmm1, %xmm0
movsd 0x10(%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x10(%rsp)
movq %rbp, %rdi
xorl %esi, %esi
movq %r13, %rdx
callq 0x39529
movq (%r15), %rdi
incq %r12
movq %rbp, %rsi
movsd (%rsp), %xmm0
movl %r12d, %edx
movb $0x1, %al
callq 0x42e0
cmpq %r12, %rbx
jne 0x799dc
jmp 0x79c97
movq 0x8(%rsp), %r8
cvttsd2si 0x8(%r8), %esi
addq %rcx, %rax
addq $0x30f08, %rax          # imm = 0x30F08
leaq 0x335617(%rip), %rcx    # 0x3af0a8
movq (%rcx), %rdi
incl %edx
movsbl 0x4(%r8), %ecx
movslq %esi, %rsi
movq 0x20(%rax,%rsi,8), %r8
leaq 0x331eb(%rip), %rsi     # 0xacc95
leaq 0x1c(%rsp), %r9
xorl %eax, %eax
callq 0x42e0
jmp 0x79f9a
leaq 0x3354e2(%rip), %rax    # 0x3aefa4
cmpl $0x0, (%rax)
je 0x79f20
movq 0x8(%rsp), %rax
movsd 0x8(%rax), %xmm2
leaq 0x3354fc(%rip), %rax    # 0x3aefd8
movq (%rax), %rax
movsd (%rax,%rdx,8), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x79f48
sqrtsd %xmm0, %xmm0
jmp 0x79f57
movq 0x8(%rsp), %rax
movsd 0x30(%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
xorl %r15d, %r15d
cmpl $0x2, %r13d
jl 0x79d65
movq %r13, 0x48(%rsp)
movl 0x38(%rsp), %eax
movq %rax, 0x50(%rsp)
xorl %r14d, %r14d
movq 0x28(%rsp), %rbx
xorl %r12d, %r12d
xorl %eax, %eax
leaq 0x1(%r12), %rcx
movq %rcx, 0x40(%rsp)
movq %rax, 0x30(%rsp)
cltq
movq %rax, 0x58(%rsp)
leaq (,%rax,8), %rbp
xorl %r15d, %r15d
movq 0x8(%rsp), %rax
movq 0x28(%rax), %rax
movq (%rax), %rax
addq %rbp, %rax
movsd (%rax,%r15,8), %xmm0
movsd %xmm0, (%rsp)
leaq 0x335463(%rip), %rax    # 0x3aefd8
movq (%rax), %rax
movsd (%rax,%r12,8), %xmm0
addq %r14, %rax
mulsd (%rax,%r15,8), %xmm0
ucomisd 0x29179(%rip), %xmm0    # 0xa2d08
jb 0x79b97
sqrtsd %xmm0, %xmm0
jmp 0x79b9c
callq 0x4300
movsd (%rsp), %xmm2
divsd %xmm0, %xmm2
movsd %xmm2, (%rsp)
leaq 0x3353f7(%rip), %rax    # 0x3aefa8
movq (%rax), %rax
leaq (%rax,%r14), %rcx
movq 0x28(%rsp), %rdx
movsd (%rdx,%r12,8), %xmm0
movsd (%rcx,%r15,8), %xmm1
mulsd %xmm2, %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, (%rdx,%r12,8)
movsd (%rbx,%r15,8), %xmm0
movsd (%rax,%r12,8), %xmm1
mulsd %xmm2, %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, (%rbx,%r15,8)
movsd (%rax,%r12,8), %xmm0
mulsd %xmm2, %xmm0
mulsd (%rcx,%r15,8), %xmm0
movsd 0x10(%rsp), %xmm1
subsd %xmm0, %xmm1
movsd %xmm1, 0x10(%rsp)
leaq 0x60(%rsp), %r13
movq %r13, %rdi
xorl %esi, %esi
leaq 0x33087(%rip), %rdx     # 0xacca9
callq 0x39529
leaq 0x33547a(%rip), %rax    # 0x3af0a8
movq (%rax), %rdi
leal (%r12,%r15), %ecx
incl %ecx
movq %r13, %rsi
movsd (%rsp), %xmm0
movq 0x40(%rsp), %rdx
movb $0x1, %al
callq 0x42e0
incq %r15
leal (%r12,%r15), %eax
cmpl %eax, 0x38(%rsp)
jg 0x79b54
addq $0x8, %rbx
addq $0x8, %r14
movq 0x58(%rsp), %rax
addq %r15, %rax
movq 0x40(%rsp), %rcx
movq %rcx, %r12
cmpq 0x50(%rsp), %rcx
jne 0x79b33
movq 0x30(%rsp), %rcx
addl %r15d, %ecx
movq 0x48(%rsp), %r13
xorl %r15d, %r15d
jmp 0x79d67
xorl %r12d, %r12d
movq 0x8(%rsp), %rax
movq 0x28(%rax), %rax
movq (%rax), %rax
movsd (%rax,%r12,8), %xmm0
movsd %xmm0, (%rsp)
leaq 0x335323(%rip), %rax    # 0x3aefd8
movq (%rax), %rax
movsd (%rax,%r12,8), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x79cce
sqrtsd %xmm0, %xmm0
jmp 0x79cd3
callq 0x4300
movsd (%rsp), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
leaq 0x3352c0(%rip), %rax    # 0x3aefa8
movq (%rax), %rax
movsd (%rax,%r12,8), %xmm0
mulsd %xmm1, %xmm0
addsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
leaq 0x60(%rsp), %r12
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x39529
leaq 0x33538f(%rip), %rbx    # 0x3af0a8
movq (%rbx), %rdi
movq %r12, %rsi
movsd (%rsp), %xmm0
movb $0x1, %al
callq 0x42e0
leaq 0x32f6f(%rip), %rsi     # 0xacca1
leaq 0x2b1bf(%rip), %rdx     # 0xa4ef8
movq %r12, %rdi
callq 0x39529
movq (%rbx), %rdi
movq 0x8(%rsp), %rax
movsbl 0x4(%rax), %ecx
leaq 0x1c(%rsp), %r8
movq %r12, %rsi
movq 0x38(%rsp), %rdx
movsd 0x10(%rsp), %xmm0
jmp 0x79f93
xorl %ecx, %ecx
cmpl $0x3, %r13d
jl 0x79e49
addl $-0x2, %r13d
movq %rcx, 0x30(%rsp)
movslq %ecx, %rbx
shlq $0x3, %rbx
xorl %r15d, %r15d
leaq 0x60(%rsp), %r12
leaq 0x335318(%rip), %rbp    # 0x3af0a8
movq 0x28(%rsp), %r14
movq 0x8(%rsp), %rax
movq 0x28(%rax), %rax
movq (%rax), %rax
addq %rbx, %rax
movsd (%rax,%r15,8), %xmm1
leaq 0x335227(%rip), %rax    # 0x3aefd8
movq (%rax), %rax
movsd (%rax,%r15,8), %xmm0
ucomisd 0x28f46(%rip), %xmm0    # 0xa2d08
jb 0x79dca
sqrtsd %xmm0, %xmm0
jmp 0x79dd9
movsd %xmm1, (%rsp)
callq 0x4300
movsd (%rsp), %xmm1
divsd %xmm0, %xmm1
movsd (%r14,%r15,8), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%r14,%r15,8)
leaq 0x3351b4(%rip), %rax    # 0x3aefa8
movq (%rax), %rax
mulsd (%rax,%r15,8), %xmm1
movsd 0x10(%rsp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
movq %r12, %rdi
xorl %esi, %esi
leaq 0x32e93(%rip), %rdx     # 0xaccac
callq 0x39529
movq (%rbp), %rdi
movsd (%r14,%r15,8), %xmm0
incq %r15
movq %r12, %rsi
movl %r15d, %edx
movb $0x1, %al
callq 0x42e0
cmpq %r15, %r13
jne 0x79d95
movq 0x30(%rsp), %rcx
addl %r15d, %ecx
movq 0x8(%rsp), %rax
movq 0x28(%rax), %rax
movq (%rax), %rax
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%rsp)
leaq 0x33516f(%rip), %rax    # 0x3aefd8
movq (%rax), %rax
movl %r15d, %ebx
movsd (%rax,%rbx,8), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x79e84
sqrtsd %xmm0, %xmm0
jmp 0x79e89
callq 0x4300
movsd (%rsp), %xmm1
divsd %xmm0, %xmm1
movq 0x28(%rsp), %r12
movsd (%r12,%rbx,8), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%r12,%rbx,8)
leaq 0x3350fa(%rip), %rax    # 0x3aefa8
movq (%rax), %rax
mulsd (%rax,%rbx,8), %xmm1
addsd 0x10(%rsp), %xmm1
movsd %xmm1, (%rsp)
leaq 0x60(%rsp), %r15
movq %r15, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x39529
leaq 0x3351cf(%rip), %r14    # 0x3af0a8
movq (%r14), %rdi
movsd (%r12,%rbx,8), %xmm0
movq %r15, %rsi
movb $0x1, %al
callq 0x42e0
leaq 0x32dae(%rip), %rsi     # 0xacca1
leaq 0x2affe(%rip), %rdx     # 0xa4ef8
movq %r15, %rdi
callq 0x39529
movq (%r14), %rdi
leal 0x1(%rbx), %edx
movq 0x8(%rsp), %rax
movsbl 0x4(%rax), %ecx
leaq 0x1c(%rsp), %r8
movq %r15, %rsi
movsd (%rsp), %xmm0
jmp 0x79f93
leaq 0x335181(%rip), %rax    # 0x3af0a8
movq (%rax), %rdi
incl %edx
movq 0x8(%rsp), %rax
movsbl 0x4(%rax), %ecx
movsd 0x8(%rax), %xmm0
leaq 0x32d45(%rip), %rsi     # 0xacc86
leaq 0x1c(%rsp), %r8
jmp 0x79f93
movsd %xmm2, (%rsp)
callq 0x4300
movsd (%rsp), %xmm2
mulsd %xmm0, %xmm2
leaq 0x335046(%rip), %rax    # 0x3aefa8
movq (%rax), %rax
movq 0x8(%rsp), %rsi
movslq (%rsi), %rcx
addsd (%rax,%rcx,8), %xmm2
leaq 0x33512f(%rip), %rax    # 0x3af0a8
movq (%rax), %rdi
leal 0x1(%rcx), %edx
movsbl 0x4(%rsi), %ecx
leaq 0x32cfc(%rip), %rsi     # 0xacc86
leaq 0x1c(%rsp), %r8
movapd %xmm2, %xmm0
movb $0x1, %al
callq 0x42e0
movq 0x28(%rsp), %rdi
callq 0x39194
addq $0x7a188, %rsp          # imm = 0x7A188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq