// File: /workspace/github_c_makefile_star2_O1/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 $0x278, %rsp            # imm = 0x278
movl $0x1, %eax
movl %eax, 0x34e549(%rip)    # 0x3aefa4
movl %eax, 0x2d440f(%rip)    # 0x334e70
movq 0x71e10(%rip), %rdi     # 0xd2878
movq 0x71ac1(%rip), %rsi     # 0xd2530
callq 0x14f16
movq %rax, 0x71df5(%rip)     # 0xd2870
testq %rax, %rax
je 0x60f44
cmpl $0x0, (%rax)
je 0x60f32
movq 0x71aa4(%rip), %rdi     # 0xd2538
callq 0x4200
movl %eax, %edi
callq 0x39f5b
leaq 0x41f18(%rip), %rdi     # 0xa29bf
callq 0x536e7
movl %eax, %ebx
leaq 0x41f16(%rip), %rdi     # 0xa29cb
callq 0x534b6
movsd %xmm0, 0xa8(%rsp)
leaq 0x41f0c(%rip), %rdi     # 0xa29d6
callq 0x5341c
movl %eax, %ebp
leaq 0x41edb(%rip), %rdi     # 0xa29b3
callq 0x53784
movq %rax, %r14
leaq 0x41efc(%rip), %rdi     # 0xa29e3
callq 0x5341c
movl $0x2, %ecx
movl %ecx, 0x10(%rsp)
movl %eax, 0x8(%rsp)
movl $0x0, (%rsp)
leaq 0xb8(%rsp), %r15
xorpd %xmm1, %xmm1
xorps %xmm2, %xmm2
movq %r15, %rdi
xorl %esi, %esi
xorl %edx, %edx
movl %ebx, %ecx
movsd 0xa8(%rsp), %xmm0
movl %ebp, %r8d
movq %r14, %r9
callq 0x43275
leaq 0x150(%rsp), %r12
movl $0x90, %edx
movq %r12, %rdi
movq %r15, %rsi
callq 0x4310
movq 0x71d25(%rip), %rdi     # 0xd2870
leaq 0x2d42de(%rip), %r14    # 0x334e30
movq %r14, %rsi
callq 0x5c7af
callq 0x5e071
callq 0x5df2c
leaq 0x2d42cd(%rip), %rsi    # 0x334e38
leaq 0xb0(%rsp), %rbx
movq %r14, %rdi
movq %rbx, %rdx
movl $0x4, %ecx
callq 0x30746
movq (%rbx), %rdi
movq %rdi, 0x2d42a3(%rip)    # 0x334e30
callq 0x2fa14
movl %eax, 0x8(%r12)
movl %eax, 0x10(%r12)
movq %r12, %r15
movq 0x2d429a(%rip), %rdi    # 0x334e40
callq 0x2fa14
movl %eax, 0xc(%r12)
movq 0x2d4279(%rip), %rdi    # 0x334e30
xorl %esi, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0xfffffffe, %ecx       # imm = 0xFFFFFFFE
callq 0x2f755
leaq 0x98(%rsp), %rcx
movq %rax, (%rcx)
movq %rdx, 0x8(%rcx)
movq %rcx, %r14
movq 0x2d425f(%rip), %rdi    # 0x334e40
xorl %esi, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0xfffffffe, %ecx       # imm = 0xFFFFFFFE
callq 0x2f755
movq %rax, %r12
movq %rdx, %r13
movq 0x2d4239(%rip), %rdi    # 0x334e38
xorl %esi, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0xfffffffe, %ecx       # imm = 0xFFFFFFFE
callq 0x2f755
movq %rax, %rbp
movq %rdx, %rbx
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movl $0x2, %eax
movl %eax, (%rsp)
leaq 0x1e0(%rsp), %r14
movq %r14, %rdi
movq %r12, %rcx
movq %r13, %r8
movq %r15, %r9
callq 0x42ac4
leaq 0xb8(%rsp), %r15
movl $0x98, %edx
movq %r15, %rdi
movq %r14, %rsi
callq 0x4310
movl $0x13, %ecx
movq %rsp, %rdi
movq %r15, %rsi
rep  movsq (%rsi), %es:(%rdi)
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x45686
addsd 0x42091(%rip), %xmm0    # 0xa2d08
leaq 0x4533a(%rip), %rdi     # 0xa5fb8
callq 0x3403a
leaq 0x98(%rsp), %r14
movq %r14, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x3eecc
movq %r14, %rdi
movq %rbp, %rsi
movq %rbx, %rdx
callq 0x3eecc
movq %r12, %rdi
movq %r13, %rsi
callq 0x3dbad
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x3dbad
movq 0x2d417c(%rip), %rsi    # 0x334e40
leaq 0x2d4165(%rip), %rbx    # 0x334e30
movq %rbx, %rdi
callq 0x2fd59
movq 0x2d415e(%rip), %rsi    # 0x334e38
movq %rbx, %rdi
callq 0x2fd59
movq 0x71857(%rip), %rdi     # 0xd2540
leaq 0x47bb1(%rip), %rsi     # 0xa88a1
callq 0x40f0
testq %rax, %rax
je 0x60f32
movq %rax, %rbx
movq 0x2d4128(%rip), %rsi    # 0x334e30
movq %rax, %rdi
callq 0x2fa66
movq %rbx, %rdi
callq 0x42a0
movq 0x71829(%rip), %rdi     # 0xd2548
leaq 0x47b7b(%rip), %rsi     # 0xa88a1
callq 0x40f0
testq %rax, %rax
je 0x60f32
movq %rax, %r14
movslq 0x98(%rsp), %rdi
shlq $0x3, %rdi
leaq 0x47db2(%rip), %rsi     # 0xa8afc
movl $0x14, %edx
callq 0x390f5
movq %rax, %rbx
cmpl $0x0, 0x98(%rsp)
jle 0x60e09
leaq 0xc0(%rsp), %r15
xorl %r12d, %r12d
movl $0x12, %ecx
movq %rsp, %rdi
movq %r15, %rsi
rep  movsq (%rsi), %es:(%rdi)
callq 0x44212
movq %rax, (%rbx,%r12,8)
cmpl $0x0, 0x114(%rsp)
jle 0x60df5
xorl %r13d, %r13d
xorl %ebp, %ebp
testq %r13, %r13
je 0x60dbd
movq (%rbx,%r12,8), %rcx
movq -0x8(%rcx,%r13), %rax
addq %r13, %rcx
movq (%rax), %rdi
movq 0xb8(%rsp), %rax
movq (%rax,%r13), %rsi
movq 0x8(%rax,%r13), %rdx
jmp 0x60ddc
movq 0xa0(%rsp), %rax
movq (%rax,%r12,8), %rdi
movq 0xb8(%rsp), %rax
movq (%rbx,%r12,8), %rcx
movq (%rax), %rsi
movq 0x8(%rax), %rdx
callq 0x43994
incq %rbp
movslq 0x114(%rsp), %rax
addq $0x10, %r13
cmpq %rax, %rbp
jl 0x60d96
incq %r12
movslq 0x98(%rsp), %rax
cmpq %rax, %r12
jl 0x60d70
cmpl $0x0, 0x98(%rsp)
jle 0x60ebd
xorl %r15d, %r15d
leaq 0x4c391(%rip), %r12     # 0xad1b2
leaq 0x4c8c1(%rip), %r13     # 0xad6e9
movl 0x98(%rsp), %eax
testl %eax, %eax
jle 0x60e9c
xorl %ebp, %ebp
movq (%rbx,%r15,8), %rdx
movslq 0x4(%rdx), %rcx
testq %rcx, %rcx
jle 0x60e72
movq 0x8(%rdx), %rdx
movq (%rdx), %rdx
movq (%rbx,%rbp,8), %rsi
movq 0x8(%rsi), %rsi
movq (%rsi), %rsi
xorpd %xmm0, %xmm0
xorl %edi, %edi
movsd (%rdx,%rdi,8), %xmm1
mulsd (%rsi,%rdi,8), %xmm1
addsd %xmm1, %xmm0
incq %rdi
cmpq %rdi, %rcx
jne 0x60e5a
jmp 0x60e76
xorpd %xmm0, %xmm0
decl %eax
cmpq %rax, %rbp
movq %r13, %rsi
cmoveq %r12, %rsi
movq %r14, %rdi
movb $0x1, %al
callq 0x42e0
incq %rbp
movslq 0x98(%rsp), %rax
cmpq %rax, %rbp
jl 0x60e35
movl $0xa, %edi
movq %r14, %rsi
callq 0x4150
incq %r15
movslq 0x98(%rsp), %rax
cmpq %rax, %r15
jl 0x60e28
movq %r14, %rdi
callq 0x42a0
cmpl $0x0, 0x98(%rsp)
jle 0x60ef2
xorl %r14d, %r14d
movq (%rbx,%r14,8), %rdi
movl 0x114(%rsp), %esi
callq 0x44307
incq %r14
movslq 0x98(%rsp), %rax
cmpq %rax, %r14
jl 0x60ed2
movq %rbx, %rdi
callq 0x39194
movq 0x2d3f2f(%rip), %rdi    # 0x334e30
callq 0x2f616
xorl %eax, %eax
movq %rax, 0x2d3f21(%rip)    # 0x334e30
movq %rax, 0x2d3f22(%rip)    # 0x334e38
movq %rax, 0x2d3f23(%rip)    # 0x334e40
movq 0x98(%rsp), %rdi
movq 0xa0(%rsp), %rsi
callq 0x3dbad
addq $0x278, %rsp            # imm = 0x278
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4a77b(%rip), %rdi     # 0xab6c6
addq $0x278, %rsp            # imm = 0x278
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4090