// File: /workspace/github_c_makefile_star2_O1/stonezwr[P]SpiKL-IP/network.C
// Function: Network::CrossValidation(int)
void Network::CrossValidation(int fold){
    int i, j, k, cls, sample;
    std::srand(0);

    assert(fold>1);
    _fold = fold;
    _CVspeeches = vector<vector<Speech*> >(fold, vector<Speech*>());
    cls = CLS;
    sample = _speeches.size();
    cout<<"sample: "<<sample<<endl;
    vector<int> ** index;
    index = new vector<int>*[cls];
    for(i = 0; i < cls; i++){
        index[i] = new vector<int>;
        for(j = 0; j < SAMPLES_PER_CLASS; j++) 
			index[i]->push_back(j+i*SAMPLES_PER_CLASS);
        random_shuffle(index[i]->begin(),index[i]->end());
    }

    for(k = 0; k < fold; k++)
        for(j = (k*SAMPLES_PER_CLASS)/fold; j < ((k+1)*SAMPLES_PER_CLASS)/fold; j++)
            for(i = 0; i < cls; i++){
                _CVspeeches[k].push_back(_speeches[(*index[i])[j]]);
            }

    for(i = 0; i < cls; i++) delete index[i];
    delete [] index;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movl %esi, %ebx
movq %rdi, %r14
xorl %edi, %edi
callq 0x32a0
cmpl $0x1, %ebx
jle 0x10292
movl %ebx, 0x228(%r14)
movl %ebx, %esi
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %rdx
movaps %xmm0, (%rdx)
movq $0x0, 0x10(%rdx)
leaq 0x70(%rsp), %rdi
leaq 0xb(%rsp), %rcx
movq %rsi, 0x20(%rsp)
callq 0x11748
movl %ebx, 0xc(%rsp)
leaq 0x50(%rsp), %rdi
xorps %xmm0, %xmm0
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movq 0x238(%r14), %rax
movups 0x240(%r14), %xmm0
leaq 0x70(%rsp), %r12
movq (%r12), %rcx
movq %rcx, 0x238(%r14)
movq 0x8(%r12), %rcx
movq %rcx, 0x240(%r14)
movq 0x10(%r12), %rcx
movq %rcx, 0x248(%r14)
movq (%rdi), %rcx
movq 0x8(%rdi), %rdx
movq 0x10(%rdi), %rsi
movq %rax, (%rdi)
movups %xmm0, 0x8(%rdi)
movq %rcx, (%r12)
movq %rdx, 0x8(%r12)
movq %rsi, 0x10(%r12)
callq 0x11680
movq %r12, %rdi
callq 0x11680
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x10036
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x32f0
movq 0x210(%r14), %r12
subq 0x208(%r14), %r12
shrq $0x3, %r12
movq 0x10f81(%rip), %r13     # 0x20fd0
leaq 0x8bfc(%rip), %rsi      # 0x18c52
movl $0x8, %edx
movq %r13, %rdi
callq 0x3340
movq %r13, %rdi
movl %r12d, %esi
callq 0x3560
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x32b0
movsbl %al, %esi
movq %r12, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31e0
movl $0xd0, %edi
callq 0x3030
movq %rax, %r12
xorl %ebp, %ebp
leaq 0x50(%rsp), %r13
xorl %r15d, %r15d
movl $0x18, %edi
callq 0x32e0
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
movq %rax, (%r12,%r15,8)
xorl %ebx, %ebx
movq (%r12,%r15,8), %rdi
leal (%rbx,%rbp), %eax
movl %eax, 0x50(%rsp)
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x100ee
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x100f6
movq %r13, %rdx
callq 0x45b2
incl %ebx
cmpl $0xa, %ebx
jne 0x100cd
movq (%r12,%r15,8), %rax
movq (%rax), %rbx
movq 0x8(%rax), %rax
movq %rax, 0x10(%rsp)
cmpq %rax, %rbx
je 0x10169
leaq 0x4(%rbx), %rax
cmpq 0x10(%rsp), %rax
je 0x10169
movl $0x4, %r13d
callq 0x30e0
cltq
movq %r13, %rcx
sarq $0x2, %rcx
incq %rcx
cqto
idivq %rcx
leaq (,%rdx,4), %rax
cmpq %rax, %r13
je 0x10156
leaq (%rbx,%r13), %rax
leaq (%rbx,%rdx,4), %rcx
movl (%rax), %edx
movl (%rcx), %esi
movl %esi, (%rax)
movl %edx, (%rcx)
leaq (%rbx,%r13), %rax
addq $0x4, %rax
addq $0x4, %r13
cmpq 0x10(%rsp), %rax
jne 0x10123
incq %r15
addl $0xa, %ebp
cmpq $0x1a, %r15
leaq 0x50(%rsp), %r13
jne 0x100af
movl 0xc(%rsp), %ecx
cmpl $0x2, %ecx
movl $0x1, %eax
cmovgel %ecx, %eax
movq %rax, 0x28(%rsp)
xorl %edi, %edi
movq $0x0, 0x18(%rsp)
leal (%rdi,%rdi), %eax
leal (%rax,%rax,4), %eax
xorl %edx, %edx
divl %ecx
movl %eax, %esi
leaq 0x1(%rdi), %rax
movq %rax, 0x10(%rsp)
addl %eax, %eax
leal (%rax,%rax,4), %eax
xorl %edx, %edx
divl %ecx
cmpl %eax, %esi
jae 0x10228
movl %eax, %ecx
movq 0x18(%rsp), %rax
xorl %edx, %edx
divq 0x20(%rsp)
movq %rax, %rbp
movl %ecx, %r15d
leaq (%rdi,%rdi,2), %rbx
xorl %r13d, %r13d
movq 0x238(%r14), %rax
movq (%r12,%r13,8), %rcx
movq (%rcx), %rcx
movslq (%rcx,%rbp,4), %rdx
shlq $0x3, %rdx
addq 0x208(%r14), %rdx
leaq (%rax,%rbx,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x10212
movq (%rdx), %rax
movq %rax, (%rsi)
addq $0x8, 0x8(%rdi)
jmp 0x10217
callq 0x122f2
incq %r13
cmpq $0x1a, %r13
jne 0x101da
incq %rbp
cmpq %r15, %rbp
jb 0x101d7
addq $0xa, 0x18(%rsp)
movq 0x10(%rsp), %rdi
cmpq 0x28(%rsp), %rdi
movl 0xc(%rsp), %ecx
jne 0x1019d
xorl %r14d, %r14d
movq (%r12,%r14,8), %rbx
testq %rbx, %rbx
je 0x1026f
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x10262
movq 0x10(%rbx), %rsi
subq %rdi, %rsi
callq 0x32f0
movl $0x18, %esi
movq %rbx, %rdi
callq 0x32f0
incq %r14
cmpq $0x1a, %r14
jne 0x10245
movq %r12, %rdi
callq 0x33d0
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x898f(%rip), %rdi      # 0x18c28
leaq 0x8092(%rip), %rsi      # 0x18332
leaq 0x8988(%rip), %rcx      # 0x18c2f
movl $0x321, %edx            # imm = 0x321
callq 0x31b0
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x102cb
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x32f0
movq %rbx, %rdi
callq 0x3570
nop