// File: /workspace/github_c_makefile_star2_O0/stonezwr[P]SpiKL-IP/network.C
// Function: Network::LSMSupervisedTraining(networkmode_t, int, int)
void Network::LSMSupervisedTraining(networkmode_t networkmode, int tid, int iteration){
    int info = -1;
    int count = 0;
    vector<pair<int, int> > correct, wrong, even;
    vector<pair<Speech*, bool> > predictions; // the predictions for each speech
    FILE * Foutp = NULL;
    char filename[64];
    vector<double> each_sample_errors;    

    // 1. Clear the signals
    LSMClearSignals();
   
    // 2. Load the first speech:
    info = LoadFirstSpeechTrainCV(networkmode);
    double cost = 0;
    // 3. Load the speech for training
    while(info != -1){
        count++;
        int time = 0, end_time = this->SpeechEndTime();
        Foutp = NULL;
        while(!LSMEndOfSpeech(networkmode, end_time)){
            LSMNextTimeStep(++time, true, iteration, end_time, NULL); 
        }

        LSMClearSignals();

        info = LoadNextSpeechTrainCV(networkmode);
    }
    LSMClearSignals();

    // 4. Load the speech for testing
    info = LoadFirstSpeechTestCV(networkmode);
    count = 0;
    while(info != -1){
        Foutp = NULL;
        count++;
        int time = 0, end_time = this->SpeechEndTime();
        while(!LSMEndOfSpeech(networkmode, end_time)){
            LSMNextTimeStep(++time, false, 1, end_time, Foutp);
        }

        ReadoutJudge(correct, wrong, even); // judge the readout output here

        LSMClearSignals();

        info = LoadNextSpeechTestCV(networkmode);
    }
    // 5. Push the recognition result:
    LSMPushResults(correct, wrong, even, iteration);

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x118(%rbp)
movl $0xffffffff, -0x18(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x1c(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x13790
leaq -0x50(%rbp), %rdi
callq 0x13790
leaq -0x68(%rbp), %rdi
callq 0x13790
leaq -0x80(%rbp), %rdi
callq 0x24180
movq $0x0, -0x88(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x5530
movq -0x118(%rbp), %rdi
callq 0x1f080
jmp 0x1fe0a
movq -0x118(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x200e0
movl %eax, -0x11c(%rbp)
jmp 0x1fe21
movl -0x11c(%rbp), %eax
movl %eax, -0x18(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x100(%rbp)
cmpl $-0x1, -0x18(%rbp)
je 0x1ff53
movq -0x118(%rbp), %rdi
movl -0x1c(%rbp), %eax
incl %eax
movl %eax, -0x1c(%rbp)
movl $0x0, -0x104(%rbp)
callq 0x1f290
movl %eax, -0x120(%rbp)
jmp 0x1fe65
movl -0x120(%rbp), %eax
movl %eax, -0x108(%rbp)
movq $0x0, -0x88(%rbp)
movq -0x118(%rbp), %rdi
movl -0xc(%rbp), %esi
movl -0x108(%rbp), %edx
callq 0x1f330
movb %al, -0x121(%rbp)
jmp 0x1fe99
movb -0x121(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x1fea7
jmp 0x1ff20
movq -0x118(%rbp), %rdi
movl -0x104(%rbp), %esi
incl %esi
movl %esi, -0x104(%rbp)
movl -0x14(%rbp), %ecx
movl -0x108(%rbp), %r8d
xorl %eax, %eax
movl %eax, %r9d
movl $0x1, %edx
callq 0x1f390
jmp 0x1fed7
jmp 0x1fe7c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xf0(%rbp)
movl %eax, -0xf4(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x95b0
leaq -0x80(%rbp), %rdi
callq 0x241a0
leaq -0x68(%rbp), %rdi
callq 0x138d0
leaq -0x50(%rbp), %rdi
callq 0x138d0
leaq -0x38(%rbp), %rdi
callq 0x138d0
jmp 0x200d1
movq -0x118(%rbp), %rdi
callq 0x1f080
jmp 0x1ff2e
movq -0x118(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x202f0
movl %eax, -0x128(%rbp)
jmp 0x1ff45
movl -0x128(%rbp), %eax
movl %eax, -0x18(%rbp)
jmp 0x1fe35
movq -0x118(%rbp), %rdi
callq 0x1f080
jmp 0x1ff61
movq -0x118(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x20620
movl %eax, -0x12c(%rbp)
jmp 0x1ff78
movl -0x12c(%rbp), %eax
movl %eax, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
cmpl $-0x1, -0x18(%rbp)
je 0x2007a
movq -0x118(%rbp), %rdi
movq $0x0, -0x88(%rbp)
movl -0x1c(%rbp), %eax
incl %eax
movl %eax, -0x1c(%rbp)
movl $0x0, -0x10c(%rbp)
callq 0x1f290
movl %eax, -0x130(%rbp)
jmp 0x1ffc3
movl -0x130(%rbp), %eax
movl %eax, -0x110(%rbp)
movq -0x118(%rbp), %rdi
movl -0xc(%rbp), %esi
movl -0x110(%rbp), %edx
callq 0x1f330
movb %al, -0x131(%rbp)
jmp 0x1ffec
movb -0x131(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x1fffa
jmp 0x2002d
movq -0x118(%rbp), %rdi
movl -0x10c(%rbp), %esi
incl %esi
movl %esi, -0x10c(%rbp)
movl -0x110(%rbp), %r8d
movq -0x88(%rbp), %r9
xorl %edx, %edx
movl $0x1, %ecx
callq 0x1f390
jmp 0x2002b
jmp 0x1ffcf
movq -0x118(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x50(%rbp), %rdx
leaq -0x68(%rbp), %rcx
callq 0x207e0
jmp 0x20047
movq -0x118(%rbp), %rdi
callq 0x1f080
jmp 0x20055
movq -0x118(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x208a0
movl %eax, -0x138(%rbp)
jmp 0x2006c
movl -0x138(%rbp), %eax
movl %eax, -0x18(%rbp)
jmp 0x1ff88
movq -0x118(%rbp), %rdi
movl -0x14(%rbp), %r8d
leaq -0x38(%rbp), %rsi
leaq -0x50(%rbp), %rdx
leaq -0x68(%rbp), %rcx
callq 0x20a70
jmp 0x20098
leaq -0xe8(%rbp), %rdi
callq 0x95b0
leaq -0x80(%rbp), %rdi
callq 0x241a0
leaq -0x68(%rbp), %rdi
callq 0x138d0
leaq -0x50(%rbp), %rdi
callq 0x138d0
leaq -0x38(%rbp), %rdi
callq 0x138d0
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
movq -0xf0(%rbp), %rdi
callq 0x46d0
nopl (%rax)