// File: /workspace/github_c_makefile_star2_O2/olcaytaner[P]Isell/process.c
// Function: autoencoder
void autoencoder()
{
 int i, j, li;
 FILE* outfile;
 Mlpparameters parameters;
 Mlpnetwork neuralnetwork;
 matrix train, cv, test;
 matrixptr* hidden_matrices;
 double sum;
 Instanceptr tmpdata;
 mustrealize = YES;
 mustnormalize = YES;
 current_dataset = search_dataset(Datasets, params[0]);
 if (!current_dataset)
  {
   printf(m1320);
   return;
  }
 if (current_dataset->active == NO)
   return;
 mysrand(atoi(params[1]));
 parameters = prepare_Mlpparameters(NULL, NULL, get_parameter_o("weightdecay"), get_parameter_f("decayalpha"), get_parameter_i("hiddenlayers"), (int *) get_parameter_a("hiddennodes"), 0, 0.0, 0.0, get_parameter_i("maxhidden"), AUTOENCODER);
 read_from_train_file(current_dataset, &traindata);
 pre_process();
 create_cvdata();
 divide_instancelist(&traindata, &testdata, &tmpdata, 4);
 traindata = tmpdata;
 parameters.inputnum = data_size(traindata);
 parameters.trnum = parameters.inputnum;
 parameters.cvnum = data_size(cvdata);
 train = instancelist_to_matrix(traindata, CLASSIFICATION, -1, MULTIVARIATE_LINEAR);
 cv = instancelist_to_matrix(cvdata, CLASSIFICATION, -1, MULTIVARIATE_LINEAR);
 test = instancelist_to_matrix(testdata, CLASSIFICATION, -1, MULTIVARIATE_LINEAR);
 neuralnetwork = mlpn_general(train, cv, &parameters, AUTOENCODER);
 set_default_variable("out1", testMlpnNetwork_autoencoder(test, neuralnetwork) + 0.0);
 matrix_rowwise_merge(&train, cv);
 matrix_rowwise_merge(&train, test);
 matrix_free(cv);
 matrix_free(test);
 merge_instancelist(&traindata, cvdata);
 merge_instancelist(&traindata, testdata);
 outfile = fopen(params[2], "w");
 if (!outfile)
   return;
 print_class_information(outfile, traindata);
 fclose(outfile);
 outfile = fopen(params[3], "w");
 if (!outfile)
   return;
 hidden_matrices = safemalloc(train.row * sizeof(matrixptr), "autoencoder", 20);
 for (i = 0; i < train.row; i++)
  {
   hidden_matrices[i] = allocate_hiddens(neuralnetwork.P);
   for (li = 0; li < neuralnetwork.P.layernum; li++)
    {
     if (li == 0)
       calculate_hidden_values(train.values[i], neuralnetwork.weights[0], &(hidden_matrices[i][0]));
     else
       calculate_hidden_values(hidden_matrices[i][li - 1].values[0], neuralnetwork.weights[li], &(hidden_matrices[i][li]));
    }
  }
 for (i = 0; i < train.row; i++)
  {
   for (j = 0; j < train.row; j++)
    {
     sum = 0.0;
     for (li = 0; li < hidden_matrices[i][0].col; li++)
      {
       sum += hidden_matrices[i][0].values[0][li] * hidden_matrices[j][0].values[0][li];
      }
     if (j != train.row - 1)
       fprintf(outfile, "%.6f ", sum);
     else
       fprintf(outfile, "%.6f", sum);
    }
   fprintf(outfile, "\n");
  }
 fclose(outfile);
 for (i = 0; i < train.row; i++)
   free_hiddens(hidden_matrices[i], neuralnetwork.P.layernum);
 safe_free(hidden_matrices);
 deallocate(traindata);
 traindata = NULL;
 testdata = NULL;
 cvdata = NULL;
 matrix_free(train);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1e8, %rsp            # imm = 0x1E8
pushq $0x1
popq %rax
movl %eax, 0x3507d0(%rip)    # 0x3a9fa4
movl %eax, 0x2d6696(%rip)    # 0x32fe70
movq 0x74097(%rip), %rdi     # 0xcd878
movq 0x73d48(%rip), %rsi     # 0xcd530
callq 0x13da6
movq %rax, 0x7407c(%rip)     # 0xcd870
testq %rax, %rax
je 0x59b2d
cmpl $0x0, (%rax)
je 0x59c5c
movq 0x73d2b(%rip), %rdi     # 0xcd538
callq 0x4200
movl %eax, %edi
callq 0x35ca7
leaq 0x3c19f(%rip), %rdi     # 0x959bf
callq 0x4cff1
movl %eax, %ebx
leaq 0x3c19d(%rip), %rdi     # 0x959cb
callq 0x4cdcf
movsd %xmm0, 0xb0(%rsp)
leaq 0x3c193(%rip), %rdi     # 0x959d6
callq 0x4cd35
movl %eax, %ebp
leaq 0x3c162(%rip), %rdi     # 0x959b3
callq 0x4d088
movq %rax, %r15
leaq 0x3c183(%rip), %rdi     # 0x959e3
callq 0x4cd35
pushq $0x2
popq %rcx
movl %ecx, 0x10(%rsp)
andl $0x0, (%rsp)
movl %eax, 0x8(%rsp)
leaq 0x158(%rsp), %r12
xorpd %xmm1, %xmm1
xorps %xmm2, %xmm2
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
movl %ebx, %ecx
movsd 0xb0(%rsp), %xmm0
movl %ebp, %r8d
movq %r15, %r9
callq 0x3df0e
movq 0x73fc9(%rip), %rdi     # 0xcd870
leaq 0x2d6582(%rip), %r14    # 0x32fe30
movq %r14, %rsi
callq 0x5577a
callq 0x56f57
callq 0x56e2d
leaq 0x2d6571(%rip), %rsi    # 0x32fe38
leaq 0xb8(%rsp), %rbx
pushq $0x4
popq %rcx
movq %r14, %rdi
movq %rbx, %rdx
callq 0x2cfe5
movq (%rbx), %rdi
movq %rdi, 0x2d6549(%rip)    # 0x32fe30
callq 0x2c3cc
movl %eax, 0x8(%r12)
movl %eax, 0x10(%r12)
movq 0x2d6543(%rip), %rdi    # 0x32fe40
callq 0x2c3cc
movl %eax, 0xc(%r12)
movq 0x2d6522(%rip), %rdi    # 0x32fe30
pushq $-0x1
popq %rbx
pushq $-0x2
popq %rbp
xorl %esi, %esi
movl %ebx, %edx
movl %ebp, %ecx
callq 0x2c130
movq %rax, %r14
movq %rdx, %r15
leaq 0xa0(%rsp), %rax
movq %r14, (%rax)
movq %rdx, 0x8(%rax)
movq 0x2d6505(%rip), %rdi    # 0x32fe40
xorl %esi, %esi
movl %ebx, %edx
movl %ebp, %ecx
callq 0x2c130
movq %rax, %r12
movq %rdx, %r13
movq 0x2d64e5(%rip), %rdi    # 0x32fe38
xorl %esi, %esi
movl %ebx, %edx
movl %ebp, %ecx
callq 0x2c130
movq %rax, %rbp
movq %rdx, %rbx
pushq $0x2
popq %rax
movl %eax, (%rsp)
leaq 0xc0(%rsp), %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %r12, %rcx
movq %r13, %r8
leaq 0x158(%rsp), %r9
callq 0x3d96a
pushq $0x13
popq %rcx
movq %rsp, %rdi
leaq 0xc0(%rsp), %rsi
rep  movsq (%rsi), %es:(%rdi)
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x3ffab
addsd 0x3c369(%rip), %xmm0    # 0x95d18
leaq 0x3f5a2(%rip), %rdi     # 0x98f58
callq 0x30597
leaq 0xa0(%rsp), %r14
movq %r14, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x3a35c
movq %r14, %rdi
movq %rbp, %rsi
movq %rbx, %rdx
callq 0x3a35c
movq %r12, %rdi
movq %r13, %rsi
callq 0x3929f
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x3929f
movq 0x2d6444(%rip), %rsi    # 0x32fe40
leaq 0x2d642d(%rip), %rbx    # 0x32fe30
movq %rbx, %rdi
callq 0x2c6e4
movq 0x2d6426(%rip), %rsi    # 0x32fe38
movq %rbx, %rdi
callq 0x2c6e4
movq 0x73b1f(%rip), %rdi     # 0xcd540
leaq 0x41e69(%rip), %rsi     # 0x9b891
callq 0x40f0
testq %rax, %rax
je 0x59c5c
movq %rax, %rbx
movq 0x2d63f0(%rip), %rsi    # 0x32fe30
movq %rax, %rdi
callq 0x2c41b
movq %rbx, %rdi
callq 0x42a0
movq 0x73af1(%rip), %rdi     # 0xcd548
leaq 0x41e33(%rip), %rsi     # 0x9b891
callq 0x40f0
testq %rax, %rax
je 0x59c5c
movq %rax, %r14
movslq 0xa0(%rsp), %rdi
shlq $0x3, %rdi
leaq 0x4206a(%rip), %rsi     # 0x9baec
pushq $0x14
popq %rdx
callq 0x34f59
movq %rax, %rbx
xorl %r13d, %r13d
pushq $0x12
popq %r12
movslq 0xa0(%rsp), %rax
cmpq %rax, %r13
jge 0x59b4a
movq %r12, %rcx
movq %rsp, %rdi
leaq 0xc8(%rsp), %rsi
rep  movsq (%rsi), %es:(%rdi)
callq 0x3ee10
movq %rax, (%rbx,%r13,8)
xorl %ebp, %ebp
xorl %r15d, %r15d
movslq 0x11c(%rsp), %rax
cmpq %rax, %r15
jge 0x59b25
testq %rbp, %rbp
je 0x59af8
movq (%rbx,%r13,8), %rcx
movq -0x8(%rcx,%rbp), %rax
addq %rbp, %rcx
movq (%rax), %rdi
movq 0xc0(%rsp), %rax
movq (%rax,%rbp), %rsi
movq 0x8(%rax,%rbp), %rdx
jmp 0x59b17
movq 0xa8(%rsp), %rax
movq (%rax,%r13,8), %rdi
movq 0xc0(%rsp), %rax
movq (%rbx,%r13,8), %rcx
movq (%rax), %rsi
movq 0x8(%rax), %rdx
callq 0x3e5db
incq %r15
addq $0x10, %rbp
jmp 0x59ac4
incq %r13
jmp 0x59a94
leaq 0x44b82(%rip), %rdi     # 0x9e6b6
addq $0x1e8, %rsp            # imm = 0x1E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4090
leaq 0x4665d(%rip), %r12     # 0xa01ae
leaq 0x46b8d(%rip), %r13     # 0xa06e5
xorl %ebp, %ebp
movslq %eax, %rcx
cmpq %rcx, %rbp
jge 0x59bee
xorl %r15d, %r15d
movslq %eax, %rcx
cmpq %rcx, %r15
jge 0x59bd4
movq (%rbx,%rbp,8), %rcx
movl 0x4(%rcx), %edx
testl %edx, %edx
movl $0x0, %esi
cmovlel %esi, %edx
xorpd %xmm0, %xmm0
xorl %esi, %esi
cmpq %rsi, %rdx
je 0x59bb2
movq 0x8(%rcx), %rdi
movq (%rdi), %rdi
movsd (%rdi,%rsi,8), %xmm1
movq (%rbx,%r15,8), %rdi
movq 0x8(%rdi), %rdi
movq (%rdi), %rdi
mulsd (%rdi,%rsi,8), %xmm1
addsd %xmm1, %xmm0
incq %rsi
jmp 0x59b88
decl %eax
cmpq %rax, %r15
movq %r13, %rsi
cmoveq %r12, %rsi
movq %r14, %rdi
movb $0x1, %al
callq 0x42e0
incq %r15
movl 0xa0(%rsp), %eax
jmp 0x59b69
pushq $0xa
popq %rdi
movq %r14, %rsi
callq 0x4150
incq %rbp
movl 0xa0(%rsp), %eax
jmp 0x59b5a
movq %r14, %rdi
callq 0x42a0
xorl %r14d, %r14d
movslq 0xa0(%rsp), %rax
cmpq %rax, %r14
jge 0x59c1b
movq (%rbx,%r14,8), %rdi
movl 0x11c(%rsp), %esi
callq 0x3ef02
incq %r14
jmp 0x59bf9
movq %rbx, %rdi
callq 0x34ff7
movq 0x2d6206(%rip), %rdi    # 0x32fe30
callq 0x2c010
andq $0x0, 0x2d61f9(%rip)    # 0x32fe30
andq $0x0, 0x2d61f9(%rip)    # 0x32fe38
andq $0x0, 0x2d61f9(%rip)    # 0x32fe40
movq 0xa0(%rsp), %rdi
movq 0xa8(%rsp), %rsi
callq 0x3929f
addq $0x1e8, %rsp            # imm = 0x1E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq