// File: /workspace/github_c_makefile_star2_O1/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 0xfd44
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 0x157a6
leaq 0x60(%rsp), %rdx
movl $0x0, (%rdx)
leaq 0x90(%rsp), %rdi
leaq 0x78(%rsp), %rcx
movq %r15, %rsi
callq 0x157a6
leaq 0x78(%rsp), %rdx
movl $0x0, (%rdx)
leaq 0x60(%rsp), %rdi
leaq 0x20(%rsp), %rcx
movq %r15, %rsi
callq 0x157a6
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, 0x8(%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 0x1153e
shrq $0x3, %r12
movq %r12, 0x40(%rsp)
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x16443
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 0x1049c
addq $0x2c8, %rbp            # imm = 0x2C8
cmpq $0xde8, %rbp            # imm = 0xDE8
jne 0x1645c
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 0x164ab
movq %rbx, %r14
movq 0x40(%rsp), %r15
jmp 0x164cb
movq %rbx, %rdx
movq 0x40(%rsp), %r15
movl (%rdx), %esi
movq %rcx, %r14
cmpl (%rcx), %esi
jl 0x164bf
movq %rdx, %r14
addq $0x4, %rcx
movq %r14, %rdx
cmpq %rax, %rcx
jne 0x164b3
movl (%r14), %ebp
movq 0xaafb(%rip), %rdi      # 0x20fd0
leaq 0x37e7(%rip), %rsi      # 0x19cc3
movl $0x1b, %edx
callq 0x3340
subq %rbx, %r14
shrq $0x2, %r14
movq 0xaadc(%rip), %rdi      # 0x20fd0
movl %r14d, %esi
callq 0x3560
movq %rax, %rbx
leaq 0x3818(%rip), %rsi      # 0x19d1e
movl $0x3, %edx
movq %rax, %rdi
callq 0x3340
movq %rbx, %rdi
movl %ebp, %esi
callq 0x3560
movq %rax, %rbx
leaq 0xdf5(%rip), %rsi       # 0x1731c
movl $0x1, %edx
movq %rax, %rdi
callq 0x3340
movq %rbx, %rdi
movl %r15d, %esi
callq 0x3560
movq %rax, %rbx
leaq 0x37d5(%rip), %rsi      # 0x19d1e
movl $0x3, %edx
movq %rax, %rdi
callq 0x3340
cvtsi2sd %ebp, %xmm0
mulsd 0x1da6(%rip), %xmm0     # 0x18308
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 0x1664f
movq 0xa9fb(%rip), %rdi      # 0x20fd0
leaq 0x3703(%rip), %rsi      # 0x19cdf
movl $0x20, %edx
callq 0x3340
movq 0x8(%rsp), %rax
xorps %xmm0, %xmm0
cvtsi2sdl 0xc4(%rax), %xmm0
mulsd 0x1d0a(%rip), %xmm0     # 0x18308
divsd 0x38(%rsp), %xmm0
movq 0xa9c5(%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 0x166e6
movq 0xa964(%rip), %rdi      # 0x20fd0
leaq 0x368d(%rip), %rsi      # 0x19d00
movl $0x21, %edx
callq 0x3340
movq 0x8(%rsp), %rax
xorps %xmm0, %xmm0
cvtsi2sdl 0x18c(%rax), %xmm0
mulsd 0x1c73(%rip), %xmm0     # 0x18308
divsd 0x38(%rsp), %xmm0
movq 0xa92e(%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 0x1677d
movq 0xa8cd(%rip), %rdi      # 0x20fd0
leaq 0x3618(%rip), %rsi      # 0x19d22
movl $0x21, %edx
callq 0x3340
movq 0x8(%rsp), %rax
xorps %xmm0, %xmm0
cvtsi2sdl 0x31c(%rax), %xmm0
mulsd 0x1bdc(%rip), %xmm0     # 0x18308
divsd 0x38(%rsp), %xmm0
movq 0xa897(%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 0x16814
movq 0xa836(%rip), %rdi      # 0x20fd0
leaq 0x35a3(%rip), %rsi      # 0x19d44
movl $0x21, %edx
callq 0x3340
movq 0x8(%rsp), %rax
xorps %xmm0, %xmm0
cvtsi2sdl 0x4ac(%rax), %xmm0
mulsd 0x1b45(%rip), %xmm0     # 0x18308
divsd 0x38(%rsp), %xmm0
movq 0xa800(%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 0x50(%rsp), %rax
subq 0x48(%rsp), %rax
movslq %r14d, %rcx
movq 0x78(%rsp), %rdx
leaq (%rcx,%rcx,2), %r12
movq 0x8(%rdx,%r12,8), %rcx
subq (%rdx,%r12,8), %rcx
cmpq %rcx, %rax
jne 0x169c4
movq 0x48(%rsp), %rax
cmpq %rax, 0x50(%rsp)
je 0x1692a
xorl %r14d, %r14d
movq 0xa77a(%rip), %r15      # 0x20fd0
leaq 0x357b(%rip), %r13      # 0x19dd8
leaq 0x20(%rsp), %rbp
cmpl $0x0, (%rax,%r14,4)
je 0x1690d
movl $0x10, %edx
movq %r15, %rdi
leaq 0x354b(%rip), %rsi      # 0x19dc7
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
incq %r14
movq 0x48(%rsp), %rax
movq 0x50(%rsp), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %r14, %rcx
ja 0x16862
leaq 0x8(%rsp), %rdi
leaq 0x90(%rsp), %rsi
leaq 0x60(%rsp), %rdx
movq 0x40(%rsp), %rcx
callq 0x15f3f
leaq 0x78(%rsp), %rdi
callq 0x115d6
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x16967
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x32f0
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x16984
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x32f0
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x1699b
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x32f0
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x169b2
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 0x339b(%rip), %rdi      # 0x19d66
leaq 0x3216(%rip), %rsi      # 0x19be8
leaq 0x33c4(%rip), %rcx      # 0x19d9d
movl $0x58, %edx
callq 0x31b0
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x16a24
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x32f0
jmp 0x16a24
movq %rax, %rbx
jmp 0x16a24
movq %rax, %rbx
jmp 0x16a3b
movq %rax, %rbx
jmp 0x16a58
movq %rax, %rbx
jmp 0x16a6f
jmp 0x16a17
jmp 0x16a17
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x115d6
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x16a3b
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x32f0
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x16a58
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x32f0
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x16a6f
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x32f0
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x16a86
movq 0x58(%rsp), %rsi
subq %rdi, %rsi
callq 0x32f0
movq %rbx, %rdi
callq 0x3570