// File: /workspace/github_c_makefile_star2_O3/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 $0xa8, %rsp
movq %rdi, %r14
movq 0x198(%rdi), %rbx
movq 0x210(%rdi), %r12
subq 0x208(%rdi), %r12
subq 0x190(%rdi), %rbx
leaq 0x48(%rsp), %rdi
movq %r14, %rsi
callq 0xfab2
shrq $0x2, %rbx
movslq %ebx, %r15
leaq 0x90(%rsp), %rdx
movl $0x0, (%rdx)
leaq 0x8(%rsp), %rdi
leaq 0x60(%rsp), %rcx
movq %r15, %rsi
callq 0x15476
leaq 0x60(%rsp), %rdx
movl $0x0, (%rdx)
leaq 0x90(%rsp), %rdi
leaq 0x78(%rsp), %rcx
movq %r15, %rsi
callq 0x15476
leaq 0x78(%rsp), %rdx
movl $0x0, (%rdx)
leaq 0x60(%rsp), %rdi
leaq 0x20(%rsp), %rcx
movq %r15, %rsi
callq 0x15476
xorpd %xmm0, %xmm0
movapd %xmm0, 0x20(%rsp)
movq $0x0, 0x30(%rsp)
movl $0x68, %edi
callq 0x32e0
leaq 0x20(%rsp), %rdx
movq %rax, (%rdx)
movq %rax, %rcx
addq $0x68, %rcx
movq %rcx, 0x10(%rdx)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x50(%rax)
movupd %xmm0, 0x40(%rax)
movupd %xmm0, 0x30(%rax)
movupd %xmm0, 0x20(%rax)
movupd %xmm0, 0x10(%rax)
movupd %xmm0, (%rax)
movq $0x0, 0x60(%rax)
movq %rcx, 0x8(%rdx)
leaq 0x78(%rsp), %rdi
leaq 0x7(%rsp), %rcx
movq %r15, %rsi
callq 0x1120c
shrq $0x3, %r12
movq %r12, 0x40(%rsp)
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x16308
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x32f0
xorl %ebp, %ebp
leaq 0x8(%rsp), %rbx
leaq 0x90(%rsp), %r15
leaq 0x60(%rsp), %r12
leaq 0x78(%rsp), %r13
leaq (%r14,%rbp), %rdi
movq %rbx, %rsi
movq %r15, %rdx
movq %r12, %rcx
movq %r13, %r8
callq 0x101d2
addq $0x2c8, %rbp            # imm = 0x2C8
cmpq $0xde8, %rbp            # imm = 0xDE8
jne 0x16321
movq 0x8(%rsp), %rbx
movq 0x10(%rsp), %rax
cmpq %rax, %rbx
sete %dl
leaq 0x4(%rbx), %rcx
cmpq %rax, %rcx
sete %sil
orb %dl, %sil
je 0x16370
movq %rbx, %r14
movq 0x40(%rsp), %r15
jmp 0x1638e
movl (%rbx), %edx
movq %rbx, %r14
movq 0x40(%rsp), %r15
movl (%rcx), %esi
cmpl %esi, %edx
cmovlel %esi, %edx
cmovlq %rcx, %r14
addq $0x4, %rcx
cmpq %rax, %rcx
jne 0x1637a
movl (%r14), %ebp
movq 0xac38(%rip), %rdi      # 0x20fd0
leaq 0x39dc(%rip), %rsi      # 0x19d7b
movl $0x1b, %edx
callq 0x3340
subq %rbx, %r14
shrq $0x2, %r14
movq 0xac19(%rip), %rdi      # 0x20fd0
movl %r14d, %esi
callq 0x3560
movq %rax, %rbx
leaq 0x3a0d(%rip), %rsi      # 0x19dd6
movl $0x3, %edx
movq %rax, %rdi
callq 0x3340
movq %rbx, %rdi
movl %ebp, %esi
callq 0x3560
movq %rax, %rbx
leaq 0xf52(%rip), %rsi       # 0x1733c
movl $0x1, %edx
movq %rax, %rdi
callq 0x3340
movq %rbx, %rdi
movl %r15d, %esi
callq 0x3560
movq %rax, %rbx
leaq 0x39ca(%rip), %rsi      # 0x19dd6
movl $0x3, %edx
movq %rax, %rdi
callq 0x3340
cvtsi2sd %ebp, %xmm0
mulsd 0x1f83(%rip), %xmm0     # 0x183a8
cvtsi2sd %r15d, %xmm1
movsd %xmm1, 0x38(%rsp)
divsd %xmm1, %xmm0
movq %rbx, %rdi
callq 0x34f0
leaq 0x20(%rsp), %rsi
movb $0x25, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x3340
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x32b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31e0
movq 0x10(%rsp), %rax
subq 0x8(%rsp), %rax
cmpq $0xc5, %rax
jb 0x166d7
movq 0xab38(%rip), %rdi      # 0x20fd0
leaq 0x38f8(%rip), %rsi      # 0x19d97
movl $0x20, %edx
callq 0x3340
movq 0x8(%rsp), %rax
xorps %xmm0, %xmm0
cvtsi2sdl 0xc4(%rax), %xmm0
mulsd 0x1ee7(%rip), %xmm0     # 0x183a8
divsd 0x38(%rsp), %xmm0
movq 0xab02(%rip), %rdi      # 0x20fd0
callq 0x34f0
leaq 0x20(%rsp), %rsi
movb $0x25, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x3340
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x32b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31e0
movq 0x10(%rsp), %rax
subq 0x8(%rsp), %rax
cmpq $0x18d, %rax            # imm = 0x18D
jb 0x166d7
movq 0xaaa1(%rip), %rdi      # 0x20fd0
leaq 0x3882(%rip), %rsi      # 0x19db8
movl $0x21, %edx
callq 0x3340
movq 0x8(%rsp), %rax
xorps %xmm0, %xmm0
cvtsi2sdl 0x18c(%rax), %xmm0
mulsd 0x1e50(%rip), %xmm0     # 0x183a8
divsd 0x38(%rsp), %xmm0
movq 0xaa6b(%rip), %rdi      # 0x20fd0
callq 0x34f0
leaq 0x20(%rsp), %rsi
movb $0x25, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x3340
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x32b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31e0
movq 0x10(%rsp), %rax
subq 0x8(%rsp), %rax
cmpq $0x31d, %rax            # imm = 0x31D
jb 0x166d7
movq 0xaa0a(%rip), %rdi      # 0x20fd0
leaq 0x380d(%rip), %rsi      # 0x19dda
movl $0x21, %edx
callq 0x3340
movq 0x8(%rsp), %rax
xorps %xmm0, %xmm0
cvtsi2sdl 0x31c(%rax), %xmm0
mulsd 0x1db9(%rip), %xmm0     # 0x183a8
divsd 0x38(%rsp), %xmm0
movq 0xa9d4(%rip), %rdi      # 0x20fd0
callq 0x34f0
leaq 0x20(%rsp), %rsi
movb $0x25, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x3340
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x32b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31e0
movq 0x10(%rsp), %rax
subq 0x8(%rsp), %rax
cmpq $0x4ad, %rax            # imm = 0x4AD
jb 0x166d7
movq 0xa973(%rip), %rdi      # 0x20fd0
leaq 0x3798(%rip), %rsi      # 0x19dfc
movl $0x21, %edx
callq 0x3340
movq 0x8(%rsp), %rax
xorps %xmm0, %xmm0
cvtsi2sdl 0x4ac(%rax), %xmm0
mulsd 0x1d22(%rip), %xmm0     # 0x183a8
divsd 0x38(%rsp), %xmm0
movq 0xa93d(%rip), %rdi      # 0x20fd0
callq 0x34f0
leaq 0x20(%rsp), %rsi
movb $0x25, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x3340
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x32b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31e0
movq 0x48(%rsp), %rax
movq 0x50(%rsp), %rcx
movq %rcx, %rdx
subq %rax, %rdx
movslq %r14d, %rsi
movq 0x78(%rsp), %rdi
leaq (%rsi,%rsi,2), %r12
movq 0x8(%rdi,%r12,8), %rsi
subq (%rdi,%r12,8), %rsi
cmpq %rsi, %rdx
jne 0x16889
cmpq %rax, %rcx
je 0x167ef
xorl %r14d, %r14d
movq 0xa8b8(%rip), %r15      # 0x20fd0
leaq 0x3771(%rip), %r13      # 0x19e90
leaq 0x20(%rsp), %rbp
cmpl $0x0, (%rax,%r14,4)
je 0x167d9
movl $0x10, %edx
movq %r15, %rdi
leaq 0x3741(%rip), %rsi      # 0x19e7f
callq 0x3340
movq %r15, %rdi
movl %r14d, %esi
callq 0x3560
movq %rax, %rbx
movl $0xb, %edx
movq %rax, %rdi
movq %r13, %rsi
callq 0x3340
movq 0x78(%rsp), %rax
movq (%rax,%r12,8), %rax
imull $0x64, (%rax,%r14,4), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movq 0x48(%rsp), %rax
xorps %xmm1, %xmm1
cvtsi2sdl (%rax,%r14,4), %xmm1
divsd %xmm1, %xmm0
movq %rbx, %rdi
callq 0x34f0
movb $0x25, 0x20(%rsp)
movl $0x1, %edx
movq %rax, %rdi
movq %rbp, %rsi
callq 0x3340
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x32b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31e0
movq 0x48(%rsp), %rax
movq 0x50(%rsp), %rcx
incq %r14
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x2, %rdx
cmpq %r14, %rdx
ja 0x16724
leaq 0x8(%rsp), %rdi
leaq 0x90(%rsp), %rsi
leaq 0x60(%rsp), %rdx
movq 0x40(%rsp), %rcx
callq 0x15e0b
leaq 0x78(%rsp), %rdi
callq 0x112a4
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x1682c
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x32f0
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x16849
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x32f0
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x16860
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x32f0
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x16877
movq 0x58(%rsp), %rsi
subq %rdi, %rsi
callq 0x32f0
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x358e(%rip), %rdi      # 0x19e1e
leaq 0x3409(%rip), %rsi      # 0x19ca0
leaq 0x35b7(%rip), %rcx      # 0x19e55
movl $0x58, %edx
callq 0x31b0
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x168e9
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x32f0
jmp 0x168e9
movq %rax, %rbx
jmp 0x168e9
movq %rax, %rbx
jmp 0x16900
movq %rax, %rbx
jmp 0x1691d
movq %rax, %rbx
jmp 0x16934
jmp 0x168dc
jmp 0x168dc
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x112a4
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x16900
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x32f0
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x1691d
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x32f0
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x16934
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x32f0
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x1694b
movq 0x58(%rsp), %rsi
subq %rdi, %rsi
callq 0x32f0
movq %rbx, %rdi
callq 0x3570