// File: /workspace/github_c_makefile_star2_O3/olcaytaner[P]Isell/savecode.c
// Function: code_calculate_distance
void code_calculate_distance(FILE* testcodefile, PROGRAMMING_LANGUAGE_TYPE language, Datasetptr d)
{
 /*!Last Changed 13.06.2006*/
 char st[MAXLENGTH];
 int *symbolic, *numeric, scount, ncount;
 code_set_variable(testcodefile, language, "sum", "0.0"); 
 code_for(testcodefile, language, "j", 0, d->featurecount - 1, 1); 
 code_array_index_variable(st, language, "testdataconverted", "j");
 code_set_variable(testcodefile, language, "x_j", st);
 code_2d_array_index_variable(st, language, "m", "i", "j");
 code_set_variable(testcodefile, language, "m_ij", st);
 code_switch(testcodefile, language, "j");
 symbolic = symbolic_features(d, &scount);
 numeric = numeric_features(d, &ncount);
 if (scount > 0)
  {
   code_case(testcodefile, language, symbolic, scount);
   code_if(testcodefile, language, "==", "m_ij", "x_j");
   code_set_variable(testcodefile, language, "sum", "sum + 1");
   code_endif(testcodefile, language);
   code_endcase(testcodefile, language);
  }
 if (ncount > 0)
  {
   code_case(testcodefile, language, numeric, ncount);
   code_set_variable(testcodefile, language, "sum", "sum + (x_j - m_ij) * (x_j - m_ij)");
   code_endcase(testcodefile, language);
  }
 safe_free(symbolic);
 safe_free(numeric);
 code_endswitch(testcodefile, language);
 code_endfor(testcodefile, language, "j");
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf4250, %rsp          # imm = 0xF4250
movq %rdx, %r12
movl %esi, %ebx
movq %rdi, %r14
leaq 0x31dbd(%rip), %rdx     # 0xb0cad
leaq 0x31d1e(%rip), %rcx     # 0xb0c15
callq 0x7d316
movl 0x1bc(%r12), %r8d
decl %r8d
leaq 0x31aa6(%rip), %rdx     # 0xb09b4
movq %r14, %rdi
movl %ebx, %esi
xorl %ecx, %ecx
movl $0x1, %r9d
callq 0x7e3dc
movl %ebx, %r15d
cmpl $0x5, %ebx
ja 0x7ef4d
leaq 0x54e51(%rip), %rax     # 0xd3d80
movq (%rax,%r15,8), %rsi
leaq 0x3194a(%rip), %rdx     # 0xb0884
leaq 0x31a73(%rip), %rcx     # 0xb09b4
leaq 0x10(%rsp), %rdi
xorl %eax, %eax
callq 0x41b0
leaq 0x31a74(%rip), %rdx     # 0xb09c8
leaq 0x10(%rsp), %rcx
movq %r14, %rdi
movl %ebx, %esi
callq 0x7d316
cmpl $0x5, %ebx
ja 0x7ef94
leaq 0x54d81(%rip), %rax     # 0xd3cf0
movq (%rax,%r15,8), %rsi
leaq 0x311de(%rip), %rdx     # 0xb0158
leaq 0x31d38(%rip), %rcx     # 0xb0cb9
leaq 0x31a2c(%rip), %r8      # 0xb09b4
leaq 0x10(%rsp), %rdi
xorl %eax, %eax
callq 0x41b0
leaq 0x318fb(%rip), %rdx     # 0xb0896
leaq 0x10(%rsp), %rcx
movq %r14, %rdi
movl %ebx, %esi
callq 0x7d316
leaq 0x31a03(%rip), %rdx     # 0xb09b4
movq %r14, %rdi
movl %ebx, %esi
callq 0x7de42
leaq 0xc(%rsp), %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0x15064
movq %rax, %r15
leaq 0x8(%rsp), %rsi
movq %r12, %rdi
callq 0x15156
movq %rax, %r12
movl (%r13), %ecx
testl %ecx, %ecx
jle 0x7f070
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rdx
callq 0x7dbeb
leaq 0x29f2a(%rip), %rsi     # 0xa8f28
leaq 0x31891(%rip), %rdx     # 0xb0896
leaq 0x319bc(%rip), %rcx     # 0xb09c8
leaq 0x7a130(%rsp), %r13
movl %ebx, %edi
movq %r13, %r8
callq 0x7df46
movq %r14, %rdi
movl %ebx, %esi
movq %r13, %rdx
callq 0x7e093
leaq 0x31c7b(%rip), %rdx     # 0xb0cad
leaq 0x31862(%rip), %rcx     # 0xb089b
movq %r14, %rdi
movl %ebx, %esi
callq 0x7d316
movq %r14, %rdi
movl %ebx, %esi
callq 0x7e23a
cmpl $0x3, %ebx
ja 0x7f070
cmpl $0x2, %ebx
je 0x7f070
leaq 0x313db(%rip), %rdi     # 0xb0439
movl $0x7, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x42c0
movl 0x8(%rsp), %ecx
testl %ecx, %ecx
jle 0x7f0c0
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
callq 0x7dbeb
leaq 0x31c21(%rip), %rdx     # 0xb0cad
leaq 0x31810(%rip), %rcx     # 0xb08a3
movq %r14, %rdi
movl %ebx, %esi
callq 0x7d316
cmpl $0x3, %ebx
ja 0x7f0c0
cmpl $0x2, %ebx
je 0x7f0c0
leaq 0x3138b(%rip), %rdi     # 0xb0439
movl $0x7, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x42c0
movq %r15, %rdi
callq 0x3a180
movq %r12, %rdi
callq 0x3a180
movq %r14, %rdi
movl %ebx, %esi
callq 0x7deaa
movq %r14, %rdi
movl %ebx, %esi
callq 0x7e686
addq $0xf4250, %rsp          # imm = 0xF4250
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq