// File: /workspace/github_cpp_makefile_star2_O2/bobverity[P]MavericK/writeOut.cpp
// Function: printQmatrixError_ind(globals&, int)
void printQmatrixError_ind(globals &globals, int Kindex) {
    int K = globals.Kmin+Kindex;
    
    // open outputQmatrixError_ind filestream for this K
    string s = globals.outputQmatrixError_ind_filePath;
    s.erase(end(s)-4,end(s));
    s = s + "_K" + to_string((long long)K) + ".csv";
    globals.outputQmatrixError_ind_fileStream = safe_ofstream(s,globals.outputLog_on, globals.outputLog_fileStream);
    
    // write headers
    globals.outputQmatrixError_ind_fileStream << "index,label";
    if (globals.popCol_on)
        globals.outputQmatrixError_ind_fileStream << ",given_population";
    for (int k=0; k<K; k++)
        globals.outputQmatrixError_ind_fileStream << ",deme" << k+1;
    globals.outputQmatrixError_ind_fileStream << "\n";
    
    // write results
    for (int i=0; i<globals.n; i++) {
        
        // individual index
        globals.outputQmatrixError_ind_fileStream << i+1;
        globals.outputQmatrixError_ind_fileStream << ",";
        
        // individual label
        globals.outputQmatrixError_ind_fileStream << globals.indLabels_vec[i];
        globals.outputQmatrixError_ind_fileStream << ",";
        
        // population data
        if (globals.popCol_on) {
            globals.outputQmatrixError_ind_fileStream << globals.pop_vec[i];
            globals.outputQmatrixError_ind_fileStream << ",";
        }
        
        // standard errors
        for (int k=0; k<K; k++) {
            char * buffer = new char[256];
            sprintf(buffer, "%.6f", my_round(globals.QmatrixError_ind[Kindex][i][k]*1e6)/1e6);
            string s = buffer;
            delete [] buffer;
            globals.outputQmatrixError_ind_fileStream << s;
            if (k<(K-1))
                globals.outputQmatrixError_ind_fileStream << ",";
        }
        
        globals.outputQmatrixError_ind_fileStream << "\n";      
    }
    
    globals.outputQmatrixError_ind_fileStream.flush();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2c8, %rsp            # imm = 0x2C8
movl 0x2bc8(%rdi), %ebx
movl %esi, 0x18(%rsp)
addl %esi, %ebx
movq %rdi, 0x8(%rsp)
leaq 0x3c0(%rdi), %rsi
leaq 0x48(%rsp), %r14
movq %r14, %rdi
callq 0x3430
movq (%r14), %rax
movq 0x8(%r14), %rcx
leaq (%rax,%rcx), %rdx
leaq (%rax,%rcx), %rsi
addq $-0x4, %rsi
movq %r14, %rdi
callq 0x30a0
leaq 0x3d55(%rip), %rdx      # 0x2983e
leaq 0xa8(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x110be
movslq %ebx, %rsi
leaq 0x88(%rsp), %rdi
callq 0x60a6
leaq 0x28(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
leaq 0x88(%rsp), %rdx
callq 0x601b
leaq 0x1841(%rip), %rdx      # 0x2736d
leaq 0xc8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0xcf2e
movl %ebx, 0x10(%rsp)
leaq 0x48(%rsp), %r14
leaq 0xc8(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x33f0
movq %r15, %rdi
callq 0x3170
leaq 0x28(%rsp), %rdi
callq 0x3170
leaq 0x88(%rsp), %rdi
callq 0x3170
leaq 0xa8(%rsp), %rdi
callq 0x3170
leaq 0x68(%rsp), %rdi
movq %r14, %rsi
callq 0x3430
movq 0x8(%rsp), %rbx
movzbl 0x2c3c(%rbx), %edx
leaq 0x970(%rbx), %rcx
leaq 0xc8(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x22438
leaq 0x1370(%rbx), %r14
leaq 0xc8(%rsp), %rsi
movq %r14, %rdi
callq 0x33d0
leaq 0xc8(%rsp), %rdi
callq 0x3460
leaq 0x68(%rsp), %rdi
callq 0x3170
leaq 0x3e09(%rip), %rsi      # 0x299f6
movq %r14, %rdi
callq 0x3350
movq 0x8(%rsp), %rax
cmpb $0x1, 0x2ba1(%rax)
jne 0x25c12
leaq 0x3df8(%rip), %rsi      # 0x29a02
movq %r14, %rdi
callq 0x3350
xorl %ebx, %ebx
movl 0x10(%rsp), %eax
testl %eax, %eax
cmovgl %eax, %ebx
movl %ebx, %ebp
negl %ebp
pushq $0x1
popq %r12
leaq 0x3df9(%rip), %r15      # 0x29a25
leal (%r12,%rbp), %eax
cmpl $0x1, %eax
je 0x25c55
movq %r14, %rdi
movq %r15, %rsi
callq 0x3350
leal 0x1(%r12), %r13d
movq %rax, %rdi
movl %r12d, %esi
callq 0x3570
movl %r13d, %r12d
jmp 0x25c2c
leaq 0x1c5f(%rip), %rsi      # 0x278bb
movq %r14, %rdi
callq 0x3350
movslq 0x18(%rsp), %rax
movl 0x10(%rsp), %ecx
decl %ecx
movslq %ecx, %rcx
movq %rcx, 0x18(%rsp)
movl %ebx, %ecx
movq %rcx, 0x10(%rsp)
xorl %r12d, %r12d
imulq $0x18, %rax, %rbx
leaq 0xc8(%rsp), %rbp
movq 0x8(%rsp), %rax
movslq 0x2d18(%rax), %rax
cmpq %rax, %r12
jge 0x25df1
leaq 0x1(%r12), %rsi
movq %r14, %rdi
movq %rsi, 0x20(%rsp)
callq 0x3570
movq %r14, %rdi
leaq 0x1582(%rip), %rsi      # 0x27240
callq 0x3350
movq %r12, %r15
shlq $0x5, %r15
movq 0x8(%rsp), %rax
movq 0x2c58(%rax), %rsi
addq %r15, %rsi
movq %r14, %rdi
callq 0x3310
movq %r14, %rdi
leaq 0x1555(%rip), %rsi      # 0x27240
callq 0x3350
movq 0x8(%rsp), %rax
cmpb $0x0, 0x2ba1(%rax)
je 0x25d24
movq 0x8(%rsp), %rax
addq 0x2c70(%rax), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x3310
movq %r14, %rdi
leaq 0x1521(%rip), %rsi      # 0x27240
callq 0x3350
imulq $0x18, %r12, %r13
xorl %r12d, %r12d
cmpq %r12, 0x10(%rsp)
je 0x25dd8
movl $0x100, %edi            # imm = 0x100
callq 0x3030
movsd 0x3988(%rip), %xmm1     # 0x296d0
movq %rax, %r15
movq 0x8(%rsp), %rax
movq 0x2db8(%rax), %rax
movq (%rax,%rbx), %rax
movq (%rax,%r13), %rax
movsd (%rax,%r12,8), %xmm0
mulsd %xmm1, %xmm0
callq 0x14cb8
movsd 0x395a(%rip), %xmm1     # 0x296d0
cvtsi2sd %eax, %xmm0
divsd %xmm1, %xmm0
movq %r15, %rdi
leaq 0x3cb1(%rip), %rsi      # 0x29a39
movb $0x1, %al
callq 0x3080
movq %rbp, %rdi
movq %r15, %rsi
leaq 0x28(%rsp), %rdx
callq 0x3130
movq %r15, %rdi
callq 0x3400
movq %r14, %rdi
movq %rbp, %rsi
callq 0x3310
cmpq 0x18(%rsp), %r12
jge 0x25dc8
movq %r14, %rdi
leaq 0x147d(%rip), %rsi      # 0x27240
callq 0x3350
movq %rbp, %rdi
callq 0x3170
incq %r12
jmp 0x25d2b
movq %r14, %rdi
leaq 0x1ad9(%rip), %rsi      # 0x278bb
callq 0x3350
movq 0x20(%rsp), %r12
jmp 0x25c8d
movq %r14, %rdi
callq 0x3230
leaq 0x48(%rsp), %rdi
callq 0x3170
addq $0x2c8, %rsp            # imm = 0x2C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
callq 0x3460
jmp 0x25e2a
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
jmp 0x25e78
jmp 0x25e7f
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x3170
jmp 0x25e45
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x3170
jmp 0x25e57
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
jmp 0x25e78
jmp 0x25e7f
jmp 0x25e7f
jmp 0x25e7f
jmp 0x25e7f
jmp 0x25e7f
jmp 0x25e7f
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
callq 0x3170
jmp 0x25e82
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x3170
movq %rbx, %rdi
callq 0x35a0