// File: /workspace/github_c_makefile_star2_O2/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 0x5cc44(%rip), %rbx     # 0xcd870
movq (%rbx), %rax
movslq 0x1c0(%rax), %r12
leaq -0x1(%r12), %r15
leaq 0x2f02d(%rip), %rdx     # 0x9fc6f
pushq $0x8
popq %rsi
pushq $0x5
popq %rcx
movq %r15, %rdi
callq 0x35067
movq %rax, 0x38(%rsp)
movq %r14, 0x8(%rsp)
cmpq $0x0, 0x48(%r14)
je 0x70c72
movw $0x20, 0x20(%rsp)
movl $0x444e4120, 0x1c(%rsp) # imm = 0x444E4120
jmp 0x70c77
movb $0x0, 0x1c(%rsp)
movq 0x8(%rsp), %rax
movslq (%rax), %rdx
testq %rdx, %rdx
js 0x70ce2
movq (%rbx), %rax
imulq $0x340, %rdx, %rcx      # imm = 0x340
movl 0x30f08(%rax,%rcx), %esi
cmpl $0x2, %esi
je 0x70e13
cmpl $0x1, %esi
je 0x70dce
testl %esi, %esi
jne 0x712cd
leaq 0x3393f2(%rip), %rax    # 0x3aa0a8
movq (%rax), %rdi
incl %edx
movq 0x8(%rsp), %rax
movsbl 0x4(%rax), %ecx
cvttsd2si 0x8(%rax), %r8d
leaq 0x2efb4(%rip), %rsi     # 0x9fc85
leaq 0x1c(%rsp), %r9
xorl %eax, %eax
callq 0x42e0
jmp 0x712cd
cmpl $-0x3, %edx
je 0x70e79
cmpl $-0x2, %edx
jne 0x712cd
movq %r15, 0x28(%rsp)
movq 0x8(%rsp), %rax
movsd 0x30(%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
cmpl $0x3, %r12d
pushq $0x2
popq %rbp
cmovgel %r12d, %ebp
addl $-0x2, %ebp
xorl %r15d, %r15d
leaq 0x3392b7(%rip), %r14    # 0x3a9fd8
leaq 0x339280(%rip), %rbx    # 0x3a9fa8
leaq 0x2ef88(%rip), %r12     # 0x9fcb7
leaq 0x60(%rsp), %r13
movq 0x8(%rsp), %rax
movq 0x28(%rax), %rax
movq (%rax), %rcx
movq (%r14), %rax
cmpq %r15, %rbp
je 0x70e53
movsd (%rcx,%r15,8), %xmm0
movsd %xmm0, (%rsp)
movsd (%rax,%r15,8), %xmm0
ucomisd 0x24fb3(%rip), %xmm0    # 0x95d18
jb 0x70d6d
sqrtsd %xmm0, %xmm0
jmp 0x70d72
callq 0x4300
movsd (%rsp), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
movq (%rbx), %rax
movsd (%rax,%r15,8), %xmm0
mulsd %xmm1, %xmm0
movsd 0x10(%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x10(%rsp)
movq %r13, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x35305
leaq 0x3392f7(%rip), %rax    # 0x3aa0a8
movq (%rax), %rdi
incq %r15
movq %r13, %rsi
movsd (%rsp), %xmm0
movl %r15d, %edx
movb $0x1, %al
callq 0x42e0
jmp 0x70d34
movq 0x8(%rsp), %r8
cvttsd2si 0x8(%r8), %esi
addq %rcx, %rax
addq $0x30f08, %rax          # imm = 0x30F08
leaq 0x3392bf(%rip), %rcx    # 0x3aa0a8
movq (%rcx), %rdi
incl %edx
movsbl 0x4(%r8), %ecx
movslq %esi, %rsi
movq 0x20(%rax,%rsi,8), %r8
leaq 0x2ee9e(%rip), %rsi     # 0x9fca0
leaq 0x1c(%rsp), %r9
xorl %eax, %eax
callq 0x42e0
jmp 0x712cd
leaq 0x33918a(%rip), %rax    # 0x3a9fa4
cmpl $0x0, (%rax)
je 0x71253
movq 0x8(%rsp), %rax
movsd 0x8(%rax), %xmm2
leaq 0x3391a4(%rip), %rax    # 0x3a9fd8
movq (%rax), %rax
movsd (%rax,%rdx,8), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x7127b
sqrtsd %xmm0, %xmm0
jmp 0x7128a
movsd (%rcx,%rbp,8), %xmm0
movsd %xmm0, (%rsp)
movsd (%rax,%rbp,8), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x71123
sqrtsd %xmm0, %xmm0
jmp 0x71128
movq 0x8(%rsp), %rax
movsd 0x30(%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movq $0x0, 0x40(%rsp)
testl %r15d, %r15d
movl $0x0, %eax
cmovgl %r15d, %eax
movq %rax, 0x58(%rsp)
movq %r12, 0x50(%rsp)
leal -0x2(%r12), %eax
leaq 0x60(%rsp), %r13
movl %r15d, 0x34(%rsp)
xorl %ebp, %ebp
cmpq 0x58(%rsp), %rbp
je 0x70ff3
movl %eax, 0x4c(%rsp)
movq %r15, 0x28(%rsp)
movslq %r15d, %r12
movq 0x40(%rsp), %rax
movslq %eax, %rbx
leaq 0x1(%rbp), %r14
addl 0x34(%rsp), %eax
movq %rax, 0x40(%rsp)
movq %rbp, %r15
cmpq %rbx, %r12
je 0x70fd9
movq 0x8(%rsp), %rax
movq 0x28(%rax), %rax
movq (%rax), %rax
movsd (%rax,%rbx,8), %xmm0
movsd %xmm0, (%rsp)
leaq 0x3390ca(%rip), %rax    # 0x3a9fd8
movq (%rax), %rax
movsd (%rax,%rbp,8), %xmm0
mulsd (%rax,%r15,8), %xmm0
ucomisd 0x24df4(%rip), %xmm0    # 0x95d18
jb 0x70f2c
sqrtsd %xmm0, %xmm0
jmp 0x70f31
callq 0x4300
movsd (%rsp), %xmm2
divsd %xmm0, %xmm2
movsd %xmm2, (%rsp)
leaq 0x339062(%rip), %rax    # 0x3a9fa8
movq (%rax), %rax
movq 0x38(%rsp), %rcx
movsd (%rcx,%rbp,8), %xmm0
movsd (%rax,%r15,8), %xmm1
mulsd %xmm2, %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, (%rcx,%rbp,8)
movsd (%rcx,%r15,8), %xmm0
movsd (%rax,%rbp,8), %xmm1
mulsd %xmm2, %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, (%rcx,%r15,8)
movsd (%rax,%rbp,8), %xmm0
mulsd %xmm2, %xmm0
mulsd (%rax,%r15,8), %xmm0
movsd 0x10(%rsp), %xmm1
subsd %xmm0, %xmm1
movsd %xmm1, 0x10(%rsp)
movq %r13, %rdi
xorl %esi, %esi
leaq 0x2ed0a(%rip), %rdx     # 0x9fcb4
callq 0x35305
leaq 0x3390f2(%rip), %rax    # 0x3aa0a8
movq (%rax), %rdi
incq %r15
movq %r13, %rsi
movsd (%rsp), %xmm0
movl %r14d, %edx
movl %r15d, %ecx
movb $0x1, %al
callq 0x42e0
incq %rbx
jmp 0x70ee8
decl 0x34(%rsp)
movq 0x28(%rsp), %r15
movl 0x4c(%rsp), %eax
addl %eax, %r15d
decl %eax
movq %r14, %rbp
jmp 0x70eb9
movq 0x50(%rsp), %rax
cmpl $0x3, %eax
pushq $0x2
popq %rcx
cmovgel %eax, %ecx
movq %rcx, 0x28(%rsp)
leal -0x2(%rcx), %r15d
movslq 0x40(%rsp), %r14
movq %r14, %rbx
shlq $0x20, %rbx
shlq $0x3, %r14
xorl %r12d, %r12d
leaq 0x60(%rsp), %rbp
movq 0x38(%rsp), %r13
movq 0x8(%rsp), %rax
movq 0x28(%rax), %rax
movq (%rax), %rax
cmpq %r12, %r15
je 0x710ee
addq %r14, %rax
movsd (%rax,%r12,8), %xmm1
leaq 0x338f8c(%rip), %rax    # 0x3a9fd8
movq (%rax), %rax
movsd (%rax,%r12,8), %xmm0
ucomisd 0x24cbb(%rip), %xmm0    # 0x95d18
jb 0x71065
sqrtsd %xmm0, %xmm0
jmp 0x71074
movsd %xmm1, (%rsp)
callq 0x4300
movsd (%rsp), %xmm1
divsd %xmm0, %xmm1
movsd (%r13,%r12,8), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%r13,%r12,8)
leaq 0x338f17(%rip), %rax    # 0x3a9fa8
movq (%rax), %rax
mulsd (%rax,%r12,8), %xmm1
movsd 0x10(%rsp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
movq %rbp, %rdi
xorl %esi, %esi
leaq 0x2ec01(%rip), %rdx     # 0x9fcb7
callq 0x35305
leaq 0x338fe6(%rip), %rax    # 0x3aa0a8
movq (%rax), %rdi
movsd (%r13,%r12,8), %xmm0
incq %r12
movq %rbp, %rsi
movl %r12d, %edx
movb $0x1, %al
callq 0x42e0
movabsq $0x100000000, %rax      # imm = 0x100000000
addq %rax, %rbx
jmp 0x71027
sarq $0x1d, %rbx
movsd (%rax,%rbx), %xmm0
movsd %xmm0, (%rsp)
leaq 0x338ed5(%rip), %rax    # 0x3a9fd8
movq (%rax), %rax
movsd (%rax,%r15,8), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x711b2
sqrtsd %xmm0, %xmm0
jmp 0x711b7
callq 0x4300
movsd (%rsp), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
movq (%rbx), %rax
movsd (%rax,%rbp,8), %xmm0
mulsd %xmm1, %xmm0
addsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
leaq 0x60(%rsp), %r15
movq %r15, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x35305
leaq 0x338f42(%rip), %rbx    # 0x3aa0a8
movq (%rbx), %rdi
movq %r15, %rsi
movsd (%rsp), %xmm0
movb $0x1, %al
callq 0x42e0
leaq 0x2eb2d(%rip), %rsi     # 0x9fcac
leaq 0x26d4a(%rip), %rdx     # 0x97ed0
movq %r15, %rdi
callq 0x35305
movq (%rbx), %rdi
movq 0x8(%rsp), %rax
movsbl 0x4(%rax), %ecx
leaq 0x1c(%rsp), %r8
movq %r15, %rsi
movq 0x28(%rsp), %rdx
movsd 0x10(%rsp), %xmm0
jmp 0x712c6
callq 0x4300
movsd (%rsp), %xmm1
divsd %xmm0, %xmm1
movq 0x38(%rsp), %rbx
movsd (%rbx,%r15,8), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rbx,%r15,8)
leaq 0x338dcc(%rip), %rax    # 0x3a9fa8
movq (%rax), %rax
mulsd (%rax,%r15,8), %xmm1
addsd 0x10(%rsp), %xmm1
movsd %xmm1, (%rsp)
leaq 0x60(%rsp), %r12
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x35305
leaq 0x338ea0(%rip), %r14    # 0x3aa0a8
movq (%r14), %rdi
movsd (%rbx,%r15,8), %xmm0
movq %r12, %rsi
movb $0x1, %al
callq 0x42e0
leaq 0x2ea8a(%rip), %rsi     # 0x9fcac
leaq 0x26ca7(%rip), %rdx     # 0x97ed0
movq %r12, %rdi
callq 0x35305
movq (%r14), %rdi
movq 0x28(%rsp), %rdx
decl %edx
movq 0x8(%rsp), %rax
movsbl 0x4(%rax), %ecx
leaq 0x1c(%rsp), %r8
movq %r12, %rsi
movsd (%rsp), %xmm0
jmp 0x712c6
leaq 0x338e4e(%rip), %rax    # 0x3aa0a8
movq (%rax), %rdi
incl %edx
movq 0x8(%rsp), %rax
movsbl 0x4(%rax), %ecx
movsd 0x8(%rax), %xmm0
leaq 0x2ea1d(%rip), %rsi     # 0x9fc91
leaq 0x1c(%rsp), %r8
jmp 0x712c6
movsd %xmm2, (%rsp)
callq 0x4300
movsd (%rsp), %xmm2
mulsd %xmm0, %xmm2
leaq 0x338d13(%rip), %rax    # 0x3a9fa8
movq (%rax), %rax
movq 0x8(%rsp), %rsi
movslq (%rsi), %rcx
addsd (%rax,%rcx,8), %xmm2
leaq 0x338dfc(%rip), %rax    # 0x3aa0a8
movq (%rax), %rdi
leal 0x1(%rcx), %edx
movsbl 0x4(%rsi), %ecx
leaq 0x2e9d4(%rip), %rsi     # 0x9fc91
leaq 0x1c(%rsp), %r8
movapd %xmm2, %xmm0
movb $0x1, %al
callq 0x42e0
movq 0x38(%rsp), %rdi
callq 0x34ff7
addq $0x7a188, %rsp          # imm = 0x7A188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq