// File: /workspace/github_cpp_makefile_star2_O1/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 0x105b2(%rip), %rdi     # 0x41fb8
leaq 0x7f2c(%rip), %rsi      # 0x39939
movl $0x23, %edx
callq 0x3390
cmpb $0x1, 0x2c08(%rbx)
jne 0x31acc
leaq 0x2e00(%rbx), %rsi
leaq 0x2e0(%rsp), %r14
movq %r14, %rdi
callq 0x5da0
leaq 0x90(%rsp), %rdi
movq %r14, %rsi
callq 0x1abc5
movq 0x2f50(%rbx), %rdi
movaps 0x90(%rsp), %xmm0
movq 0xa0(%rsp), %rax
movq %rdi, 0x90(%rsp)
movups 0x2f58(%rbx), %xmm1
movups %xmm0, 0x2f50(%rbx)
movq %rax, 0x2f60(%rbx)
movups %xmm1, 0x98(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x90(%rsp)
movq $0x0, 0xa0(%rsp)
testq %rdi, %rdi
je 0x31aa8
callq 0x3310
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x31aba
callq 0x3310
movq 0x2e0(%rsp), %rdi
testq %rdi, %rdi
je 0x31acc
callq 0x3310
cmpl $0x1, 0x2c0c(%rbx)
jne 0x31b79
leaq 0x2e30(%rbx), %rsi
leaq 0x2c8(%rsp), %r14
movq %r14, %rdi
callq 0x5da0
leaq 0x90(%rsp), %rdi
movq %r14, %rsi
callq 0x1abc5
movq 0x2f68(%rbx), %rdi
movaps 0x90(%rsp), %xmm0
movq 0xa0(%rsp), %rax
movq %rdi, 0x90(%rsp)
movups 0x2f70(%rbx), %xmm1
movups %xmm0, 0x2f68(%rbx)
movq %rax, 0x2f78(%rbx)
movups %xmm1, 0x98(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x90(%rsp)
movq $0x0, 0xa0(%rsp)
testq %rdi, %rdi
je 0x31b5d
callq 0x3310
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x31b6f
callq 0x3310
movq 0x2c8(%rsp), %rdi
jmp 0x31bd9
leaq 0x2e30(%rbx), %rsi
leaq 0x78(%rsp), %rdi
callq 0x5da0
leaq 0x2e48(%rbx), %rsi
leaq 0x60(%rsp), %rdi
callq 0x5da0
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 0x1acc5
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x31bd4
callq 0x3310
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x31be3
callq 0x3310
cmpl $0x1, 0x2c0c(%rbx)
jne 0x31c90
leaq 0x2ea8(%rbx), %rsi
leaq 0x2b0(%rsp), %r14
movq %r14, %rdi
callq 0x5da0
leaq 0x90(%rsp), %rdi
movq %r14, %rsi
callq 0x1abc5
movq 0x2fb0(%rbx), %rdi
movaps 0x90(%rsp), %xmm0
movq 0xa0(%rsp), %rax
movq %rdi, 0x90(%rsp)
movups 0x2fb8(%rbx), %xmm1
movups %xmm0, 0x2fb0(%rbx)
movq %rax, 0x2fc0(%rbx)
movups %xmm1, 0x98(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x90(%rsp)
movq $0x0, 0xa0(%rsp)
testq %rdi, %rdi
je 0x31c74
callq 0x3310
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x31c86
callq 0x3310
movq 0x2b0(%rsp), %rdi
jmp 0x31cf0
leaq 0x2ea8(%rbx), %rsi
leaq 0x48(%rsp), %rdi
callq 0x5da0
leaq 0x2ec0(%rbx), %rsi
leaq 0x30(%rsp), %rdi
callq 0x5da0
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 0x1acc5
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x31ceb
callq 0x3310
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x31cfa
callq 0x3310
cmpb $0x1, 0x2c1c(%rbx)
jne 0x31d68
leaq 0x2f20(%rbx), %rsi
leaq 0x18(%rsp), %rdi
callq 0x5da0
leaq 0x2f38(%rbx), %rsi
movq %rsp, %rdi
callq 0x5da0
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 0x1acc5
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x31d59
callq 0x3310
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x31d68
callq 0x3310
leaq 0x2a0(%rsp), %r13
movq %r13, -0x10(%r13)
movq 0x460(%rbx), %rsi
movq 0x468(%rbx), %rdx
addq %rsi, %rdx
leaq 0x290(%rsp), %r14
movq %r14, %rdi
callq 0xbe10
movzbl 0x2c3c(%rbx), %edx
leaq 0x970(%rbx), %rcx
leaq 0x90(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x2f394
leaq 0x1b70(%rbx), %r14
movq 0x1b70(%rbx), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
leaq 0x98(%rsp), %r15
movq -0x8(%r15), %rax
addq -0x18(%rax), %r12
movq %r12, %rsi
callq 0x35d0
leaq 0x1b78(%rbx), %rdi
movq %r15, %rsi
callq 0x3340
movq 0x101a7(%rip), %rax     # 0x41fa0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x188(%rsp), %r12
movq %rcx, -0xf8(%r12)
movq -0x18(%rcx), %rcx
movq %rax, 0x90(%rsp,%rcx)
movq %r15, %rdi
callq 0x32b0
movq %r12, %rdi
callq 0x30f0
movq 0x290(%rsp), %rdi
cmpq %r13, %rdi
je 0x31e3e
callq 0x3310
leaq 0x7b18(%rip), %rsi      # 0x3995d
movl $0xd4, %edx
movq %r14, %rdi
callq 0x3390
movl 0x2bc8(%rbx), %eax
cmpl %eax, 0x2bcc(%rbx)
jl 0x321e1
leaq 0xa0(%rsp), %rbp
movq $-0x1, %r13
leaq 0x5416(%rip), %r15      # 0x37290
leaq 0x90(%rsp), %r12
leal (%rax,%r13), %esi
incl %esi
movq %r14, %rdi
callq 0x3550
movl $0x1, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x3390
movq 0x2f50(%rbx), %rax
movsd 0x8(%rax,%r13,8), %xmm0
movq %r12, %rdi
callq 0x1c630
movq 0x90(%rsp), %rsi
movq 0x98(%rsp), %rdx
movq %r14, %rdi
callq 0x3390
movq 0x90(%rsp), %rdi
cmpq %rbp, %rdi
je 0x31ee0
callq 0x3310
movl $0x1, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x3390
movq 0x2f68(%rbx), %rax
movsd 0x8(%rax,%r13,8), %xmm0
movq %r12, %rdi
callq 0x1c630
movq 0x90(%rsp), %rsi
movq 0x98(%rsp), %rdx
movq %r14, %rdi
callq 0x3390
movq 0x90(%rsp), %rdi
cmpq %rbp, %rdi
je 0x31f30
callq 0x3310
movl $0x1, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x3390
movq 0x2f80(%rbx), %rax
movsd 0x8(%rax,%r13,8), %xmm0
movq %r12, %rdi
callq 0x1c630
movq 0x90(%rsp), %rsi
movq 0x98(%rsp), %rdx
movq %r14, %rdi
callq 0x3390
movq 0x90(%rsp), %rdi
cmpq %rbp, %rdi
je 0x31f80
callq 0x3310
movl $0x1, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x3390
movq 0x2f98(%rbx), %rax
movsd 0x8(%rax,%r13,8), %xmm0
movq %r12, %rdi
callq 0x1c630
movq 0x90(%rsp), %rsi
movq 0x98(%rsp), %rdx
movq %r14, %rdi
callq 0x3390
movq 0x90(%rsp), %rdi
cmpq %rbp, %rdi
je 0x31fd0
callq 0x3310
movl $0x1, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x3390
movq 0x2fb0(%rbx), %rax
movsd 0x8(%rax,%r13,8), %xmm0
movq %r12, %rdi
callq 0x1c630
movq 0x90(%rsp), %rsi
movq 0x98(%rsp), %rdx
movq %r14, %rdi
callq 0x3390
movq 0x90(%rsp), %rdi
cmpq %rbp, %rdi
je 0x32020
callq 0x3310
movl $0x1, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x3390
movq 0x2fc8(%rbx), %rax
movsd 0x8(%rax,%r13,8), %xmm0
movq %r12, %rdi
callq 0x1c630
movq 0x90(%rsp), %rsi
movq 0x98(%rsp), %rdx
movq %r14, %rdi
callq 0x3390
movq 0x90(%rsp), %rdi
cmpq %rbp, %rdi
je 0x32070
callq 0x3310
movl $0x1, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x3390
movq 0x2fe0(%rbx), %rax
movsd 0x8(%rax,%r13,8), %xmm0
movq %r12, %rdi
callq 0x1c630
movq 0x90(%rsp), %rsi
movq 0x98(%rsp), %rdx
movq %r14, %rdi
callq 0x3390
movq 0x90(%rsp), %rdi
cmpq %rbp, %rdi
je 0x320c0
callq 0x3310
movl $0x1, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x3390
movq 0x2ff8(%rbx), %rax
movsd 0x8(%rax,%r13,8), %xmm0
movq %r12, %rdi
callq 0x1c630
movq 0x90(%rsp), %rsi
movq 0x98(%rsp), %rdx
movq %r14, %rdi
callq 0x3390
movq 0x90(%rsp), %rdi
cmpq %rbp, %rdi
je 0x32110
callq 0x3310
movl $0x1, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x3390
movq 0x3010(%rbx), %rax
movsd 0x8(%rax,%r13,8), %xmm0
movq %r12, %rdi
callq 0x1c630
movq 0x90(%rsp), %rsi
movq 0x98(%rsp), %rdx
movq %r14, %rdi
callq 0x3390
movq 0x90(%rsp), %rdi
cmpq %rbp, %rdi
je 0x32160
callq 0x3310
movl $0x1, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x3390
movq 0x3028(%rbx), %rax
movsd 0x8(%rax,%r13,8), %xmm0
movq %r12, %rdi
callq 0x1c630
movq 0x90(%rsp), %rsi
movq 0x98(%rsp), %rdx
movq %r14, %rdi
callq 0x3390
movq 0x90(%rsp), %rdi
cmpq %rbp, %rdi
je 0x321b0
callq 0x3310
movl $0x1, %edx
movq %r14, %rdi
leaq 0x5763(%rip), %rsi      # 0x37922
callq 0x3390
movslq 0x2bcc(%rbx), %rcx
movslq 0x2bc8(%rbx), %rax
subq %rax, %rcx
incq %r13
cmpq %rcx, %r13
jl 0x31e82
movq %r14, %rdi
callq 0x31f0
addq $0x2f8, %rsp            # imm = 0x2F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x32211
callq 0x3310
jmp 0x32211
movq %rax, %rbx
movq 0x18(%rsp), %rdi
jmp 0x32279
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x3222f
callq 0x3310
jmp 0x3222f
movq %rax, %rbx
movq 0x48(%rsp), %rdi
jmp 0x32279
movq %rax, %rbx
movq 0x2b0(%rsp), %rdi
jmp 0x32279
movq %rax, %rbx
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x3225a
callq 0x3310
jmp 0x3225a
movq %rax, %rbx
movq 0x78(%rsp), %rdi
jmp 0x32279
movq %rax, %rbx
movq 0x2c8(%rsp), %rdi
jmp 0x32279
movq %rax, %rbx
movq 0x2e0(%rsp), %rdi
testq %rdi, %rdi
jne 0x322c6
jmp 0x322cb
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x3440
jmp 0x32295
movq %rax, %rbx
movq 0x290(%rsp), %rdi
cmpq %r13, %rdi
jne 0x322c6
jmp 0x322cb
jmp 0x322b6
jmp 0x322b6
jmp 0x322b6
jmp 0x322b6
jmp 0x322b6
jmp 0x322b6
jmp 0x322b6
jmp 0x322b6
jmp 0x322b6
movq %rax, %rbx
movq 0x90(%rsp), %rdi
cmpq %rbp, %rdi
je 0x322cb
callq 0x3310
movq %rbx, %rdi
callq 0x3580