// File: /workspace/github_c_makefile_star2_O2/stonezwr[P]SpiKL-IP/main.C
// Function: CollectResultsFromNetwork(Network*)
void CollectResultsFromNetwork(Network array_network[]){
    int num_speeches = array_network[0].NumSpeech();
    int num_iters = array_network[0].NumIteration();
    vector<int> num_each_speech = array_network[0].NumEachSpeech();

    vector<int> r_correct(num_iters, 0);
    vector<int> r_wrong(num_iters, 0);
    vector<int> r_even(num_iters, 0);
    vector<vector<int> > r_correct_bd(num_iters, vector<int>(CLS, 0)); 

    for(int i = 0; i < NUM_THREADS; ++i)
        array_network[i].MergeReadoutResults(r_correct, r_wrong, r_even, r_correct_bd);

    auto max_rate_iter = max_element(r_correct.begin(),r_correct.end());
    int max_rate = *max_rate_iter;
    int max_ind = distance(r_correct.begin(), max_rate_iter);
    cout<<"Best performance achieved @"<<max_ind<<" = "<<max_rate<<"/"<<num_speeches<<" = "<<double(max_rate)*100/double(num_speeches)<<'%'<<endl;
    if(r_correct.size() >= 50)
        cout<<"Performance at 50th iteration = "<<double(r_correct[49])*100/double(num_speeches)<<'%'<<endl;
    if(r_correct.size() >= 100)
        cout<<"Performance at 100th iteration = "<<double(r_correct[99])*100/double(num_speeches)<<'%'<<endl;
    if(r_correct.size() >= 200)
        cout<<"Performance at 200th iteration = "<<double(r_correct[199])*100/double(num_speeches)<<'%'<<endl;
    if(r_correct.size() >= 300)
        cout<<"Performance at 300th iteration = "<<double(r_correct[299])*100/double(num_speeches)<<'%'<<endl;

    assert(num_each_speech.size() == r_correct_bd[max_ind].size());
    for(int i = 0; i < num_each_speech.size(); ++i){
        if(num_each_speech[i] != 0)
            cout<<"Performance for "<<i<<"th class = "<<r_correct_bd[max_ind][i]*100/double(num_each_speech[i])<<'%'<<endl;
    }
    PrintResultsToFile(r_correct, r_wrong, r_even, num_speeches);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rdi, %r14
movq 0x198(%rdi), %rbx
movq 0x210(%rdi), %r12
subq 0x208(%rdi), %r12
subq 0x190(%rdi), %rbx
leaq 0x50(%rsp), %rdi
movq %r14, %rsi
callq 0xd47c
shrq $0x2, %rbx
movslq %ebx, %r15
leaq 0x80(%rsp), %rdx
andl $0x0, (%rdx)
leaq 0x10(%rsp), %rdi
leaq 0x68(%rsp), %rcx
movq %r15, %rsi
callq 0xe78a
leaq 0x68(%rsp), %rdx
andl $0x0, (%rdx)
leaq 0x80(%rsp), %rdi
leaq 0x38(%rsp), %rcx
movq %r15, %rsi
callq 0xe78a
leaq 0x38(%rsp), %rdx
andl $0x0, (%rdx)
leaq 0x68(%rsp), %rdi
leaq 0xa0(%rsp), %rcx
movq %r15, %rsi
callq 0xe78a
leaq 0x9c(%rsp), %rdx
andl $0x0, (%rdx)
leaq 0xa0(%rsp), %rdi
pushq $0x1a
popq %rsi
leaq 0xf(%rsp), %rcx
callq 0xe78a
leaq 0x38(%rsp), %rdi
leaq 0xa0(%rsp), %rdx
leaq 0xe(%rsp), %rcx
movq %r15, %rsi
callq 0xe7e0
shrq $0x3, %r12
movq %r12, 0x30(%rsp)
leaq 0xa0(%rsp), %rdi
callq 0x520c
xorl %ebx, %ebx
leaq 0x10(%rsp), %r15
leaq 0x80(%rsp), %r12
leaq 0x68(%rsp), %r13
leaq 0x38(%rsp), %rbp
cmpq $0xde8, %rbx            # imm = 0xDE8
je 0x12eb6
leaq (%r14,%rbx), %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r13, %rcx
movq %rbp, %r8
callq 0xd9ce
addq $0x2c8, %rbx            # imm = 0x2C8
jmp 0x12e8f
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0x1347d
movq %rax, %r14
movl (%rax), %ebp
subq 0x10(%rsp), %r14
movq 0xd0f2(%rip), %rdi      # 0x1ffc8
leaq 0x3e66(%rip), %rsi      # 0x16d43
callq 0x32a0
movq 0x30(%rsp), %rbx
shrq $0x2, %r14
movq %rax, %rdi
movl %r14d, %esi
callq 0x3530
leaq 0x3ea1(%rip), %rsi      # 0x16d9e
movq %rax, %rdi
callq 0x32a0
movq %rax, %rdi
movl %ebp, %esi
callq 0x3530
leaq 0x1406(%rip), %rsi      # 0x1431c
movq %rax, %rdi
callq 0x32a0
movq %rax, %rdi
movl %ebx, %esi
callq 0x3530
leaq 0x3e6f(%rip), %rsi      # 0x16d9e
movq %rax, %rdi
callq 0x32a0
cvtsi2sd %ebp, %xmm0
mulsd 0x2445(%rip), %xmm0     # 0x15388
cvtsi2sd %ebx, %xmm1
movsd %xmm1, 0x28(%rsp)
divsd %xmm1, %xmm0
movq %rax, %rdi
callq 0x34d0
pushq $0x25
popq %rsi
movq %rax, %rdi
callq 0x3310
movq %rax, %rdi
callq 0x3160
movq 0x18(%rsp), %rax
subq 0x10(%rsp), %rax
cmpq $0xc5, %rax
jb 0x130e4
movq 0xd03f(%rip), %rdi      # 0x1ffc8
leaq 0x3dcf(%rip), %rsi      # 0x16d5f
callq 0x32a0
movq 0x10(%rsp), %rcx
cvtsi2sdl 0xc4(%rcx), %xmm0
mulsd 0x23de(%rip), %xmm0     # 0x15388
divsd 0x28(%rsp), %xmm0
movq %rax, %rdi
callq 0x34d0
pushq $0x25
popq %rsi
movq %rax, %rdi
callq 0x3310
movq %rax, %rdi
callq 0x3160
movq 0x18(%rsp), %rax
subq 0x10(%rsp), %rax
cmpq $0x18d, %rax            # imm = 0x18D
jb 0x130e4
movq 0xcfe0(%rip), %rdi      # 0x1ffc8
leaq 0x3d91(%rip), %rsi      # 0x16d80
callq 0x32a0
movq 0x10(%rsp), %rcx
cvtsi2sdl 0x18c(%rcx), %xmm0
mulsd 0x237f(%rip), %xmm0     # 0x15388
divsd 0x28(%rsp), %xmm0
movq %rax, %rdi
callq 0x34d0
pushq $0x25
popq %rsi
movq %rax, %rdi
callq 0x3310
movq %rax, %rdi
callq 0x3160
movq 0x18(%rsp), %rax
subq 0x10(%rsp), %rax
cmpq $0x31d, %rax            # imm = 0x31D
jb 0x130e4
movq 0xcf81(%rip), %rdi      # 0x1ffc8
leaq 0x3d54(%rip), %rsi      # 0x16da2
callq 0x32a0
movq 0x10(%rsp), %rcx
cvtsi2sdl 0x31c(%rcx), %xmm0
mulsd 0x2320(%rip), %xmm0     # 0x15388
divsd 0x28(%rsp), %xmm0
movq %rax, %rdi
callq 0x34d0
pushq $0x25
popq %rsi
movq %rax, %rdi
callq 0x3310
movq %rax, %rdi
callq 0x3160
movq 0x18(%rsp), %rax
subq 0x10(%rsp), %rax
cmpq $0x4ad, %rax            # imm = 0x4AD
jb 0x130e4
movq 0xcf26(%rip), %rdi      # 0x1ffc8
leaq 0x3d1b(%rip), %rsi      # 0x16dc4
callq 0x32a0
movq 0x10(%rsp), %rcx
cvtsi2sdl 0x4ac(%rcx), %xmm0
mulsd 0x22c5(%rip), %xmm0     # 0x15388
divsd 0x28(%rsp), %xmm0
movq %rax, %rdi
callq 0x34d0
pushq $0x25
popq %rsi
movq %rax, %rdi
callq 0x3310
movq %rax, %rdi
callq 0x3160
movq 0x50(%rsp), %rax
movq 0x58(%rsp), %rcx
movq %rcx, %rdx
subq %rax, %rdx
movslq %r14d, %rsi
movq 0x38(%rsp), %rdi
imulq $0x18, %rsi, %rbx
movq 0x8(%rdi,%rbx), %rsi
subq (%rdi,%rbx), %rsi
cmpq %rsi, %rdx
jne 0x13214
xorl %r14d, %r14d
movq 0xceac(%rip), %r15      # 0x1ffc8
leaq 0x3d24(%rip), %r12      # 0x16e47
leaq 0x3d2e(%rip), %r13      # 0x16e58
pushq $0x25
popq %rbp
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x2, %rdx
cmpq %r14, %rdx
jbe 0x131b1
cmpl $0x0, (%rax,%r14,4)
je 0x131a9
movq %r15, %rdi
movq %r12, %rsi
callq 0x32a0
movq %rax, %rdi
movl %r14d, %esi
callq 0x3530
movq %rax, %rdi
movq %r13, %rsi
callq 0x32a0
movq 0x38(%rsp), %rcx
movq (%rcx,%rbx), %rcx
imull $0x64, (%rcx,%r14,4), %ecx
cvtsi2sd %ecx, %xmm0
movq 0x50(%rsp), %rcx
cvtsi2sdl (%rcx,%r14,4), %xmm1
divsd %xmm1, %xmm0
movq %rax, %rdi
callq 0x34d0
movq %rax, %rdi
movl %ebp, %esi
callq 0x3310
movq %rax, %rdi
callq 0x3160
movq 0x50(%rsp), %rax
movq 0x58(%rsp), %rcx
incq %r14
jmp 0x1312d
leaq 0x10(%rsp), %rdi
leaq 0x80(%rsp), %rsi
leaq 0x68(%rsp), %rdx
movq 0x30(%rsp), %rcx
callq 0x12b61
leaq 0x38(%rsp), %rdi
callq 0xe88c
leaq 0x68(%rsp), %rdi
callq 0x520c
leaq 0x80(%rsp), %rdi
callq 0x520c
leaq 0x10(%rsp), %rdi
callq 0x520c
leaq 0x50(%rsp), %rdi
callq 0x520c
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3bcb(%rip), %rdi      # 0x16de6
leaq 0x3a46(%rip), %rsi      # 0x16c68
leaq 0x3bf4(%rip), %rcx      # 0x16e1d
pushq $0x58
popq %rdx
callq 0x31b0
jmp 0x1325d
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0x520c
jmp 0x1326a
movq %rax, %rbx
jmp 0x1326a
movq %rax, %rbx
jmp 0x13274
movq %rax, %rbx
jmp 0x13281
movq %rax, %rbx
jmp 0x1328b
jmp 0x1325d
jmp 0x1325d
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0xe88c
leaq 0x68(%rsp), %rdi
callq 0x520c
leaq 0x80(%rsp), %rdi
callq 0x520c
leaq 0x10(%rsp), %rdi
callq 0x520c
leaq 0x50(%rsp), %rdi
callq 0x520c
movq %rbx, %rdi
callq 0x3540