// File: /workspace/github_cpp_makefile_star2_O2/bobverity[P]MavericK/writeOut.cpp
// Function: printEvidenceNormalised(globals&)
void printEvidenceNormalised(globals &globals) {
    
    cout << "Calculating normalised results...\n\n";
    
    // normalise exhaustive results
    if (globals.exhaustive_on)
        globals.posterior_exhaustive = normalise_log(globals.logEvidence_exhaustive);
    
    // normalise harmonic mean results
    if (globals.mainRepeats==1) {
        globals.posterior_harmonic_mean = normalise_log(globals.logEvidence_harmonic_grandMean);
    } else {
        normalise_log_sim(globals.posterior_harmonic_mean, globals.posterior_harmonic_LL, globals.posterior_harmonic_UL, globals.logEvidence_harmonic_grandMean, globals.logEvidence_harmonic_grandSE, int(1e6));
    }
    
    // normalise structure estimator results
    if (globals.mainRepeats==1) {
        globals.posterior_structure_mean = normalise_log(globals.logEvidence_structure_grandMean);
    } else {
        normalise_log_sim(globals.posterior_structure_mean, globals.posterior_structure_LL, globals.posterior_structure_UL, globals.logEvidence_structure_grandMean, globals.logEvidence_structure_grandSE, int(1e6));
    }
    
    // normalise thermodynamic integral estimator results
    if (globals.thermodynamic_on)
        normalise_log_sim(globals.posterior_TI_mean, globals.posterior_TI_LL, globals.posterior_TI_UL, globals.logEvidence_TI, globals.logEvidence_TI_SE, int(1e6));
    
    // open file stream
    globals.outputEvidenceNormalised_fileStream = safe_ofstream(globals.outputEvidenceNormalised_filePath, globals.outputLog_on, globals.outputLog_fileStream);
    
    // print headers
    globals.outputEvidenceNormalised_fileStream << "K,posterior_exhaustive,posterior_harmonic_mean,posterior_harmonic_LL,posterior_harmonic_UL,posterior_structure_mean,posterior_structure_LL,posterior_structure_UL,posterior_TI_mean,posterior_TI_LL,posterior_TI_UL\n";
    
    // loop over K
    for (int Kindex=0; Kindex<=(globals.Kmax-globals.Kmin); Kindex++) {
        int K = globals.Kmin+Kindex;
        
        // K
        globals.outputEvidenceNormalised_fileStream << K;
        
        // exhaustive results normalised
        globals.outputEvidenceNormalised_fileStream << "," << process_nan(globals.posterior_exhaustive[Kindex]);
        
        // harmonic mean results normalised
        globals.outputEvidenceNormalised_fileStream << "," << process_nan(globals.posterior_harmonic_mean[Kindex]);
        globals.outputEvidenceNormalised_fileStream << "," << process_nan(globals.posterior_harmonic_LL[Kindex]);
        globals.outputEvidenceNormalised_fileStream << "," << process_nan(globals.posterior_harmonic_UL[Kindex]);
        
        // Structure estimator results normalised
        globals.outputEvidenceNormalised_fileStream << "," << process_nan(globals.posterior_structure_mean[Kindex]);
        globals.outputEvidenceNormalised_fileStream << "," << process_nan(globals.posterior_structure_LL[Kindex]);
        globals.outputEvidenceNormalised_fileStream << "," << process_nan(globals.posterior_structure_UL[Kindex]);
        
        // thermodynamic integral estimator results normalised
        globals.outputEvidenceNormalised_fileStream << "," << process_nan(globals.posterior_TI_mean[Kindex]);
        globals.outputEvidenceNormalised_fileStream << "," << process_nan(globals.posterior_TI_LL[Kindex]);
        globals.outputEvidenceNormalised_fileStream << "," << process_nan(globals.posterior_TI_UL[Kindex]);
        
        globals.outputEvidenceNormalised_fileStream << "\n";
        
    }
    globals.outputEvidenceNormalised_fileStream.flush();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2f8, %rsp            # imm = 0x2F8
movq %rdi, %rbx
movq 0x10268(%rip), %rdi     # 0x33fb8
leaq 0x5ba2(%rip), %rsi      # 0x298f9
callq 0x3350
cmpb $0x1, 0x2c08(%rbx)
jne 0x23db8
leaq 0x2e00(%rbx), %rsi
leaq 0xc0(%rsp), %r14
movq %r14, %rdi
callq 0x537e
leaq 0xf8(%rsp), %rdi
movq %r14, %rsi
callq 0x14e07
leaq 0x2f50(%rbx), %rdi
leaq 0xf8(%rsp), %r14
movq %r14, %rsi
callq 0x55b8
movq %r14, %rdi
callq 0x51a2
leaq 0xc0(%rsp), %rdi
callq 0x51a2
cmpl $0x1, 0x2c0c(%rbx)
jne 0x23e11
leaq 0x2e30(%rbx), %rsi
leaq 0xa8(%rsp), %r14
movq %r14, %rdi
callq 0x537e
leaq 0xf8(%rsp), %rdi
movq %r14, %rsi
callq 0x14e07
leaq 0x2f68(%rbx), %rdi
leaq 0xf8(%rsp), %r14
movq %r14, %rsi
callq 0x55b8
movq %r14, %rdi
callq 0x51a2
leaq 0xa8(%rsp), %rdi
jmp 0x23e6c
leaq 0x2e30(%rbx), %rsi
leaq 0x78(%rsp), %rdi
callq 0x537e
leaq 0x2e48(%rbx), %rsi
leaq 0x60(%rsp), %rdi
callq 0x537e
leaq 0x2f98(%rbx), %rdx
leaq 0x2f80(%rbx), %rsi
leaq 0x2f68(%rbx), %rdi
leaq 0x78(%rsp), %rcx
leaq 0x60(%rsp), %r8
movl $0xf4240, %r9d          # imm = 0xF4240
callq 0x14ebc
leaq 0x60(%rsp), %rdi
callq 0x51a2
leaq 0x78(%rsp), %rdi
callq 0x51a2
cmpl $0x1, 0x2c0c(%rbx)
jne 0x23eca
leaq 0x2ea8(%rbx), %rsi
leaq 0x90(%rsp), %r14
movq %r14, %rdi
callq 0x537e
leaq 0xf8(%rsp), %rdi
movq %r14, %rsi
callq 0x14e07
leaq 0x2fb0(%rbx), %rdi
leaq 0xf8(%rsp), %r14
movq %r14, %rsi
callq 0x55b8
movq %r14, %rdi
callq 0x51a2
leaq 0x90(%rsp), %rdi
jmp 0x23f25
leaq 0x2ea8(%rbx), %rsi
leaq 0x48(%rsp), %rdi
callq 0x537e
leaq 0x2ec0(%rbx), %rsi
leaq 0x30(%rsp), %rdi
callq 0x537e
leaq 0x2fe0(%rbx), %rdx
leaq 0x2fc8(%rbx), %rsi
leaq 0x2fb0(%rbx), %rdi
leaq 0x48(%rsp), %rcx
leaq 0x30(%rsp), %r8
movl $0xf4240, %r9d          # imm = 0xF4240
callq 0x14ebc
leaq 0x30(%rsp), %rdi
callq 0x51a2
leaq 0x48(%rsp), %rdi
callq 0x51a2
cmpb $0x1, 0x2c1c(%rbx)
jne 0x23f8d
leaq 0x2f20(%rbx), %rsi
leaq 0x18(%rsp), %rdi
callq 0x537e
leaq 0x2f38(%rbx), %rsi
movq %rsp, %rdi
callq 0x537e
leaq 0x3028(%rbx), %rdx
leaq 0x3010(%rbx), %rsi
leaq 0x2ff8(%rbx), %rdi
leaq 0x18(%rsp), %rcx
movq %rsp, %r8
movl $0xf4240, %r9d          # imm = 0xF4240
callq 0x14ebc
movq %rsp, %rdi
callq 0x51a2
leaq 0x18(%rsp), %rdi
callq 0x51a2
leaq 0x460(%rbx), %rsi
leaq 0xd8(%rsp), %r14
movq %r14, %rdi
callq 0x3430
movzbl 0x2c3c(%rbx), %edx
leaq 0x970(%rbx), %rcx
leaq 0xf8(%rsp), %rdi
movq %r14, %rsi
callq 0x22438
leaq 0x1b70(%rbx), %r14
leaq 0xf8(%rsp), %rsi
movq %r14, %rdi
callq 0x33d0
leaq 0xf8(%rsp), %r15
movq %r15, %rdi
callq 0x3460
leaq 0xd8(%rsp), %rdi
callq 0x3170
leaq 0x5920(%rip), %rsi      # 0x2991d
movq %r14, %rdi
callq 0x3350
xorl %r13d, %r13d
leaq 0x3231(%rip), %r12      # 0x27240
movslq 0x2bcc(%rbx), %rcx
movslq 0x2bc8(%rbx), %rax
subq %rax, %rcx
cmpq %rcx, %r13
jg 0x24269
movl %eax, %esi
addl %r13d, %esi
movq %r14, %rdi
callq 0x3570
movq %r14, %rdi
movq %r12, %rsi
callq 0x3350
movq %rax, %rbp
movq 0x2f50(%rbx), %rax
movsd (%rax,%r13,8), %xmm0
movq %r15, %rdi
callq 0x161b8
movq %rbp, %rdi
movq %r15, %rsi
callq 0x3310
movq %r15, %rdi
callq 0x3170
movq %r14, %rdi
movq %r12, %rsi
callq 0x3350
movq %rax, %rbp
movq 0x2f68(%rbx), %rax
movsd (%rax,%r13,8), %xmm0
movq %r15, %rdi
callq 0x161b8
movq %rbp, %rdi
movq %r15, %rsi
callq 0x3310
movq %r15, %rdi
callq 0x3170
movq %r14, %rdi
movq %r12, %rsi
callq 0x3350
movq %rax, %rbp
movq 0x2f80(%rbx), %rax
movsd (%rax,%r13,8), %xmm0
movq %r15, %rdi
callq 0x161b8
movq %rbp, %rdi
movq %r15, %rsi
callq 0x3310
movq %r15, %rdi
callq 0x3170
movq %r14, %rdi
movq %r12, %rsi
callq 0x3350
movq %rax, %rbp
movq 0x2f98(%rbx), %rax
movsd (%rax,%r13,8), %xmm0
movq %r15, %rdi
callq 0x161b8
movq %rbp, %rdi
movq %r15, %rsi
callq 0x3310
movq %r15, %rdi
callq 0x3170
movq %r14, %rdi
movq %r12, %rsi
callq 0x3350
movq %rax, %rbp
movq 0x2fb0(%rbx), %rax
movsd (%rax,%r13,8), %xmm0
movq %r15, %rdi
callq 0x161b8
movq %rbp, %rdi
movq %r15, %rsi
callq 0x3310
movq %r15, %rdi
callq 0x3170
movq %r14, %rdi
movq %r12, %rsi
callq 0x3350
movq %rax, %rbp
movq 0x2fc8(%rbx), %rax
movsd (%rax,%r13,8), %xmm0
movq %r15, %rdi
callq 0x161b8
movq %rbp, %rdi
movq %r15, %rsi
callq 0x3310
movq %r15, %rdi
callq 0x3170
movq %r14, %rdi
movq %r12, %rsi
callq 0x3350
movq %rax, %rbp
movq 0x2fe0(%rbx), %rax
movsd (%rax,%r13,8), %xmm0
movq %r15, %rdi
callq 0x161b8
movq %rbp, %rdi
movq %r15, %rsi
callq 0x3310
movq %r15, %rdi
callq 0x3170
movq %r14, %rdi
movq %r12, %rsi
callq 0x3350
movq %rax, %rbp
movq 0x2ff8(%rbx), %rax
movsd (%rax,%r13,8), %xmm0
movq %r15, %rdi
callq 0x161b8
movq %rbp, %rdi
movq %r15, %rsi
callq 0x3310
movq %r15, %rdi
callq 0x3170
movq %r14, %rdi
movq %r12, %rsi
callq 0x3350
movq %rax, %rbp
movq 0x3010(%rbx), %rax
movsd (%rax,%r13,8), %xmm0
movq %r15, %rdi
callq 0x161b8
movq %rbp, %rdi
movq %r15, %rsi
callq 0x3310
movq %r15, %rdi
callq 0x3170
movq %r14, %rdi
movq %r12, %rsi
callq 0x3350
movq %rax, %rbp
movq 0x3028(%rbx), %rax
movsd (%rax,%r13,8), %xmm0
movq %r15, %rdi
callq 0x161b8
movq %rbp, %rdi
movq %r15, %rsi
callq 0x3310
movq %r15, %rdi
callq 0x3170
movq %r14, %rdi
leaq 0x365f(%rip), %rsi      # 0x278bb
callq 0x3350
incq %r13
jmp 0x2400f
movq %r14, %rdi
callq 0x3230
addq $0x2f8, %rsp            # imm = 0x2F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x51a2
jmp 0x24293
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
jmp 0x242f1
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x51a2
jmp 0x242ac
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
jmp 0x242f1
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
jmp 0x242f1
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x51a2
jmp 0x242d2
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
jmp 0x242f1
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
jmp 0x242f1
movq %rax, %rbx
leaq 0xc0(%rsp), %rdi
callq 0x51a2
jmp 0x24339
movq %rax, %rbx
leaq 0xf8(%rsp), %rdi
callq 0x3460
jmp 0x2430d
movq %rax, %rbx
leaq 0xd8(%rsp), %rdi
jmp 0x24334
jmp 0x24329
jmp 0x24329
jmp 0x24329
jmp 0x24329
jmp 0x24329
jmp 0x24329
jmp 0x24329
jmp 0x24329
jmp 0x24329
movq %rax, %rbx
leaq 0xf8(%rsp), %rdi
callq 0x3170
movq %rbx, %rdi
callq 0x35a0