// File: /workspace/github_c_makefile_star2_O3/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 0xffc8
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 0xf(%rsp), %rcx
movq %rsi, 0x28(%rsp)
callq 0x11424
movl %ebx, 0x1c(%rsp)
movq 0x248(%r14), %rax
leaq 0x70(%rsp), %r12
movaps (%r12), %xmm0
movq 0x10(%r12), %rcx
movq %rcx, 0x248(%r14)
movups 0x238(%r14), %xmm1
movups %xmm0, 0x238(%r14)
leaq 0x50(%rsp), %rdi
movaps %xmm1, (%rdi)
movq %rax, 0x10(%rdi)
xorps %xmm0, %xmm0
movaps %xmm0, (%r12)
movq $0x0, 0x10(%r12)
callq 0x11356
movq %r12, %rdi
callq 0x11356
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0xfd78
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x32f0
movq 0x210(%r14), %r12
subq 0x208(%r14), %r12
shrq $0x3, %r12
movq 0x1123f(%rip), %r13     # 0x20fd0
leaq 0x8f5a(%rip), %rsi      # 0x18cf2
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 %r15d, %r15d
leaq 0x50(%rsp), %r13
xorl %ebx, %ebx
movl $0x18, %edi
callq 0x32e0
movq %rax, %rbp
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
movq %rbx, 0x10(%rsp)
movq %rax, (%r12,%rbx,8)
xorl %ebx, %ebx
leal (%r15,%rbx), %eax
movl %eax, 0x50(%rsp)
movq 0x8(%rbp), %rsi
cmpq 0x10(%rbp), %rsi
je 0xfe35
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbp)
jmp 0xfe40
movq %rbp, %rdi
movq %r13, %rdx
callq 0x463c
incl %ebx
cmpl $0xa, %ebx
jne 0xfe17
movq (%rbp), %r13
movq 0x8(%rbp), %rbp
cmpq %rbp, %r13
je 0xfead
leaq 0x4(%r13), %rax
cmpq %rbp, %rax
je 0xfead
movl $0x4, %ebx
callq 0x30e0
cltq
movq %rbx, %rcx
sarq $0x2, %rcx
incq %rcx
cqto
idivq %rcx
leaq (,%rdx,4), %rax
cmpq %rax, %rbx
je 0xfe9c
leaq (%rbx,%r13), %rax
leaq (,%rdx,4), %rcx
addq %r13, %rcx
movl (%rax), %edx
movl (%rcx), %esi
movl %esi, (%rax)
movl %edx, (%rcx)
leaq (%rbx,%r13), %rax
addq $0x4, %rax
addq $0x4, %rbx
cmpq %rbp, %rax
jne 0xfe62
movq 0x10(%rsp), %rbx
incq %rbx
addl $0xa, %r15d
cmpq $0x1a, %rbx
leaq 0x50(%rsp), %r13
jne 0xfdf1
xorl %edi, %edi
movq $0x0, 0x20(%rsp)
leal (%rdi,%rdi), %eax
leal (%rax,%rax,4), %eax
xorl %edx, %edx
movl 0x1c(%rsp), %ecx
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 0xff62
movl %eax, %ecx
movq 0x20(%rsp), %rax
xorl %edx, %edx
divq 0x28(%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 0xff4c
movq (%rdx), %rax
movq %rax, (%rsi)
addq $0x8, 0x8(%rdi)
jmp 0xff51
callq 0x11f82
incq %r13
cmpq $0x1a, %r13
jne 0xff14
incq %rbp
cmpq %r15, %rbp
jb 0xff11
addq $0xa, 0x20(%rsp)
movq 0x10(%rsp), %rdi
cmpq 0x28(%rsp), %rdi
jne 0xfed3
xorl %r14d, %r14d
movq (%r12,%r14,8), %rbx
testq %rbx, %rbx
je 0xff98
movq (%rbx), %rdi
testq %rdi, %rdi
je 0xff98
movq 0x10(%rbx), %rsi
subq %rdi, %rsi
callq 0x32f0
movl $0x18, %esi
movq %rbx, %rdi
callq 0x32f0
incq %r14
cmpq $0x1a, %r14
jne 0xff7b
movq %r12, %rdi
callq 0x33d0
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8cf9(%rip), %rdi      # 0x18cc8
leaq 0x83fc(%rip), %rsi      # 0x183d2
leaq 0x8cf2(%rip), %rcx      # 0x18ccf
movl $0x321, %edx            # imm = 0x321
callq 0x31b0
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x10001
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x32f0
movq %rbx, %rdi
callq 0x3570
nop