// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/savecode.c
// Function: generate_test_code_naivebayes
void generate_test_code_naivebayes(FILE* testcodefile, PROGRAMMING_LANGUAGE_TYPE language, Datasetptr d, Model_naivebayesptr m)
{
 /*!Last Changed 12.08.2007*/
 char st[MAXLENGTH];
	int* numeric, ncount;
 numeric = numeric_features(d, &ncount);
 code_function_header(testcodefile, "naivebayes", d->featurecount, language);
 code_constant_start(testcodefile, language);
 code_1d_array_constant(testcodefile, language, "priors", d->classno, m->priors, REAL_TYPE);  
 code_1d_array_constant(testcodefile, language, "s", d->featurecount, m->s, REAL_TYPE);  
 code_2d_array_constant(testcodefile, language, "m", d->classno, d->featurecount, m->m);
 code_variable_start(testcodefile, language);
 code_add_variable(testcodefile, language, REAL_VARIABLE, 7, "sum", "maxvalue", "gi", "p_i", "m_ij", "s_j", "x_j");
 code_add_variable(testcodefile, language, INTEGER_VARIABLE, 3, "i", "j", "maxindex");
 code_start(testcodefile, language);
 code_set_variable(testcodefile, language, "maxvalue", "-10000.0");  
 code_for(testcodefile, language, "i", 0, d->classno - 1, 1);     
 code_array_index_variable(st, language, "priors", "i");  
 code_set_variable(testcodefile, language, "p_i", st); 
 code_set_variable(testcodefile, language, "gi", "log(p_i)"); 
 code_for(testcodefile, language, "j", 0, d->featurecount - 1, 1); 
 code_array_index_variable(st, language, "s", "j");
 code_set_variable(testcodefile, language, "s_j", st);
 code_2d_array_index_variable(st, language, "m", "i", "j");
 code_set_variable(testcodefile, language, "m_ij", st);
 code_array_index_variable(st, language, "testdata", "j");
 code_set_variable(testcodefile, language, "x_j", st);
 code_switch(testcodefile, language, "j");
 code_case(testcodefile, language, numeric, ncount);
 code_if(testcodefile, language, "!=", "s_j", "0.0");
 code_set_variable(testcodefile, language, "gi", "gi - 0.5 * ((x_j - m_ij) / s_j) * ((x_j - m_ij) / s_j)");
	code_endif(testcodefile, language);
 code_endcase(testcodefile, language);
 code_endswitch(testcodefile, language);
 code_endfor(testcodefile, language, "j");  
 code_compare_and_set_bound(testcodefile, language, ">", "gi", "maxvalue", "maxindex"); 
 code_endfor(testcodefile, language, "i");
 code_function_return_string(testcodefile, "naivebayes", language, "maxindex");   
 code_function_end(testcodefile, language); 
	safe_free(numeric);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x7a180, %rsp          # imm = 0x7A180
movq %rdi, -0x18(%rbp)
movl %esi, -0x1c(%rbp)
movq %rdx, -0x28(%rbp)
movq %rcx, -0x30(%rbp)
movq -0x28(%rbp), %rdi
leaq -0x7a15c(%rbp), %rsi
callq 0x1de20
movq %rax, -0x7a158(%rbp)
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rax
movl 0x1bc(%rax), %edx
movl -0x1c(%rbp), %ecx
leaq 0x2fe78(%rip), %rsi     # 0xe68c4
callq 0xaf1e0
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0xaf9c0
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
movq -0x28(%rbp), %rax
movl 0x10(%rax), %ecx
movq -0x30(%rbp), %rax
movq 0x10(%rax), %r8
leaq 0x36699(%rip), %rdx     # 0xed113
movl $0x1, %r9d
callq 0xb15d0
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
movq -0x28(%rbp), %rax
movl 0x1bc(%rax), %ecx
movq -0x30(%rbp), %rax
movq 0x8(%rax), %r8
leaq 0x2dff4(%rip), %rdx     # 0xe4a99
movl $0x1, %r9d
callq 0xb15d0
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
movq -0x28(%rbp), %rax
movl 0x10(%rax), %ecx
movq -0x28(%rbp), %rax
movl 0x1bc(%rax), %r8d
movq -0x30(%rbp), %rax
movq (%rax), %r9
leaq 0x35cf1(%rip), %rdx     # 0xec7c8
callq 0xb18c0
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0xb00e0
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
movl $0x1, %edx
movl $0x7, %ecx
leaq 0x3681d(%rip), %r8      # 0xed31d
leaq 0x36770(%rip), %r9      # 0xed277
leaq 0x3678c(%rip), %r14     # 0xed29a
leaq 0x3661f(%rip), %rbx     # 0xed134
leaq 0x363ea(%rip), %r11     # 0xecf06
leaq 0x364ff(%rip), %r10     # 0xed022
leaq 0x3650e(%rip), %rax     # 0xed038
movq %r14, (%rsp)
movq %rbx, 0x8(%rsp)
movq %r11, 0x10(%rsp)
movq %r10, 0x18(%rsp)
movq %rax, 0x20(%rsp)
movb $0x0, %al
callq 0xafe40
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
xorl %edx, %edx
movl $0x3, %ecx
leaq 0x367cb(%rip), %r8      # 0xed329
leaq 0x364bf(%rip), %r9      # 0xed024
leaq 0x365ae(%rip), %rax     # 0xed11a
movq %rax, (%rsp)
movb $0x0, %al
callq 0xafe40
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0xaf2c0
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
leaq 0x366e6(%rip), %rdx     # 0xed277
leaq 0x366e8(%rip), %rcx     # 0xed280
callq 0xafa00
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
movq -0x28(%rbp), %rax
movl 0x10(%rax), %r8d
subl $0x1, %r8d
leaq 0x36772(%rip), %rdx     # 0xed329
xorl %ecx, %ecx
movl $0x1, %r9d
callq 0xb10b0
leaq -0x7a150(%rbp), %rdi
movl -0x1c(%rbp), %esi
leaq 0x3653e(%rip), %rdx     # 0xed113
leaq 0x3674d(%rip), %rcx     # 0xed329
callq 0xb04c0
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
leaq -0x7a150(%rbp), %rcx
leaq 0x3653e(%rip), %rdx     # 0xed134
callq 0xafa00
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
leaq 0x36691(%rip), %rdx     # 0xed29a
leaq 0x3668d(%rip), %rcx     # 0xed29d
callq 0xafa00
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
movq -0x28(%rbp), %rax
movl 0x1bc(%rax), %r8d
subl $0x1, %r8d
leaq 0x363f2(%rip), %rdx     # 0xed024
xorl %ecx, %ecx
movl $0x1, %r9d
callq 0xb10b0
leaq -0x7a150(%rbp), %rdi
movl -0x1c(%rbp), %esi
leaq 0x2de49(%rip), %rdx     # 0xe4a99
leaq 0x363cd(%rip), %rcx     # 0xed024
callq 0xb04c0
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
leaq -0x7a150(%rbp), %rcx
leaq 0x363b1(%rip), %rdx     # 0xed022
callq 0xafa00
leaq -0x7a150(%rbp), %rdi
movl -0x1c(%rbp), %esi
leaq 0x35b41(%rip), %rdx     # 0xec7c8
leaq 0x3669b(%rip), %rcx     # 0xed329
leaq 0x3638f(%rip), %r8      # 0xed024
callq 0xb0560
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
leaq -0x7a150(%rbp), %rcx
leaq 0x36257(%rip), %rdx     # 0xecf06
callq 0xafa00
leaq -0x7a150(%rbp), %rdi
movl -0x1c(%rbp), %esi
leaq 0x362a9(%rip), %rdx     # 0xecf6e
leaq 0x36358(%rip), %rcx     # 0xed024
callq 0xb04c0
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
leaq -0x7a150(%rbp), %rcx
leaq 0x36352(%rip), %rdx     # 0xed038
callq 0xafa00
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
leaq 0x3632b(%rip), %rdx     # 0xed024
callq 0xb0930
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
movq -0x7a158(%rbp), %rdx
movl -0x7a15c(%rbp), %ecx
callq 0xb06d0
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
leaq 0x2eda6(%rip), %rdx     # 0xe5acb
leaq 0x362f6(%rip), %rcx     # 0xed022
leaq 0x36552(%rip), %r8      # 0xed285
callq 0xb0d00
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
leaq 0x36554(%rip), %rdx     # 0xed29a
leaq 0x36559(%rip), %rcx     # 0xed2a6
callq 0xafa00
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0xb0ec0
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0xb08e0
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0xb09e0
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
leaq 0x362a0(%rip), %rdx     # 0xed024
callq 0xb13f0
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
leaq 0x36a47(%rip), %rdx     # 0xed7de
leaq 0x364fc(%rip), %rcx     # 0xed29a
leaq 0x364d2(%rip), %r8      # 0xed277
leaq 0x3636e(%rip), %r9      # 0xed11a
callq 0xb33c0
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
leaq 0x3656a(%rip), %rdx     # 0xed329
callq 0xb13f0
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %edx
leaq 0x2faf2(%rip), %rsi     # 0xe68c4
leaq 0x36341(%rip), %rcx     # 0xed11a
callq 0xb01f0
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0xb03a0
movq -0x7a158(%rbp), %rdi
callq 0x52e80
addq $0x7a180, %rsp          # imm = 0x7A180
popq %rbx
popq %r14
popq %rbp
retq
nopw %cs:(%rax,%rax)