// File: /workspace/github_cpp_makefile_star2_O3/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 0xfaf9(%rip), %rdi      # 0x40fb8
leaq 0x7473(%rip), %rsi      # 0x38939
movl $0x23, %edx
callq 0x3390
cmpb $0x1, 0x2c08(%rbx)
jne 0x3156e
leaq 0x2e00(%rbx), %rsi
leaq 0x2e0(%rsp), %r14
movq %r14, %rdi
callq 0x5d20
leaq 0x90(%rsp), %rdi
movq %r14, %rsi
callq 0x1a8c5
movq 0x2f50(%rbx), %rdi
movaps 0x90(%rsp), %xmm0
movups %xmm0, 0x2f50(%rbx)
movq 0xa0(%rsp), %rax
movq %rax, 0x2f60(%rbx)
xorps %xmm0, %xmm0
movaps %xmm0, 0x90(%rsp)
movq $0x0, 0xa0(%rsp)
testq %rdi, %rdi
je 0x3155c
callq 0x3310
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x3155c
callq 0x3310
movq 0x2e0(%rsp), %rdi
testq %rdi, %rdi
je 0x3156e
callq 0x3310
cmpl $0x1, 0x2c0c(%rbx)
jne 0x31604
leaq 0x2e30(%rbx), %rsi
leaq 0x2c8(%rsp), %r14
movq %r14, %rdi
callq 0x5d20
leaq 0x90(%rsp), %rdi
movq %r14, %rsi
callq 0x1a8c5
movq 0x2f68(%rbx), %rdi
movaps 0x90(%rsp), %xmm0
movups %xmm0, 0x2f68(%rbx)
movq 0xa0(%rsp), %rax
movq %rax, 0x2f78(%rbx)
xorps %xmm0, %xmm0
movaps %xmm0, 0x90(%rsp)
movq $0x0, 0xa0(%rsp)
testq %rdi, %rdi
je 0x315fa
callq 0x3310
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x315fa
callq 0x3310
movq 0x2c8(%rsp), %rdi
jmp 0x31664
leaq 0x2e30(%rbx), %rsi
leaq 0x78(%rsp), %rdi
callq 0x5d20
leaq 0x2e48(%rbx), %rsi
leaq 0x60(%rsp), %rdi
callq 0x5d20
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 0x1a9be
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x3165f
callq 0x3310
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x3166e
callq 0x3310
cmpl $0x1, 0x2c0c(%rbx)
jne 0x31704
leaq 0x2ea8(%rbx), %rsi
leaq 0x2b0(%rsp), %r14
movq %r14, %rdi
callq 0x5d20
leaq 0x90(%rsp), %rdi
movq %r14, %rsi
callq 0x1a8c5
movq 0x2fb0(%rbx), %rdi
movaps 0x90(%rsp), %xmm0
movups %xmm0, 0x2fb0(%rbx)
movq 0xa0(%rsp), %rax
movq %rax, 0x2fc0(%rbx)
xorps %xmm0, %xmm0
movaps %xmm0, 0x90(%rsp)
movq $0x0, 0xa0(%rsp)
testq %rdi, %rdi
je 0x316fa
callq 0x3310
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x316fa
callq 0x3310
movq 0x2b0(%rsp), %rdi
jmp 0x31764
leaq 0x2ea8(%rbx), %rsi
leaq 0x48(%rsp), %rdi
callq 0x5d20
leaq 0x2ec0(%rbx), %rsi
leaq 0x30(%rsp), %rdi
callq 0x5d20
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 0x1a9be
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x3175f
callq 0x3310
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x3176e
callq 0x3310
cmpb $0x1, 0x2c1c(%rbx)
jne 0x317dc
leaq 0x2f20(%rbx), %rsi
leaq 0x18(%rsp), %rdi
callq 0x5d20
leaq 0x2f38(%rbx), %rsi
movq %rsp, %rdi
callq 0x5d20
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 0x1a9be
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x317cd
callq 0x3310
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x317dc
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 0xbb9a
movzbl 0x2c3c(%rbx), %edx
leaq 0x970(%rbx), %rcx
leaq 0x90(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x2eff8
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 0xf733(%rip), %rax      # 0x40fa0
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 0x318b2
callq 0x3310
leaq 0x70a4(%rip), %rsi      # 0x3895d
movl $0xd4, %edx
movq %r14, %rdi
callq 0x3390
movl 0x2bc8(%rbx), %eax
cmpl %eax, 0x2bcc(%rbx)
jl 0x31c55
leaq 0xa0(%rsp), %rbp
movq $-0x1, %r13
leaq 0x49a2(%rip), %r15      # 0x36290
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 0x1c311
movq 0x90(%rsp), %rsi
movq 0x98(%rsp), %rdx
movq %r14, %rdi
callq 0x3390
movq 0x90(%rsp), %rdi
cmpq %rbp, %rdi
je 0x31954
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 0x1c311
movq 0x90(%rsp), %rsi
movq 0x98(%rsp), %rdx
movq %r14, %rdi
callq 0x3390
movq 0x90(%rsp), %rdi
cmpq %rbp, %rdi
je 0x319a4
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 0x1c311
movq 0x90(%rsp), %rsi
movq 0x98(%rsp), %rdx
movq %r14, %rdi
callq 0x3390
movq 0x90(%rsp), %rdi
cmpq %rbp, %rdi
je 0x319f4
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 0x1c311
movq 0x90(%rsp), %rsi
movq 0x98(%rsp), %rdx
movq %r14, %rdi
callq 0x3390
movq 0x90(%rsp), %rdi
cmpq %rbp, %rdi
je 0x31a44
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 0x1c311
movq 0x90(%rsp), %rsi
movq 0x98(%rsp), %rdx
movq %r14, %rdi
callq 0x3390
movq 0x90(%rsp), %rdi
cmpq %rbp, %rdi
je 0x31a94
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 0x1c311
movq 0x90(%rsp), %rsi
movq 0x98(%rsp), %rdx
movq %r14, %rdi
callq 0x3390
movq 0x90(%rsp), %rdi
cmpq %rbp, %rdi
je 0x31ae4
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 0x1c311
movq 0x90(%rsp), %rsi
movq 0x98(%rsp), %rdx
movq %r14, %rdi
callq 0x3390
movq 0x90(%rsp), %rdi
cmpq %rbp, %rdi
je 0x31b34
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 0x1c311
movq 0x90(%rsp), %rsi
movq 0x98(%rsp), %rdx
movq %r14, %rdi
callq 0x3390
movq 0x90(%rsp), %rdi
cmpq %rbp, %rdi
je 0x31b84
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 0x1c311
movq 0x90(%rsp), %rsi
movq 0x98(%rsp), %rdx
movq %r14, %rdi
callq 0x3390
movq 0x90(%rsp), %rdi
cmpq %rbp, %rdi
je 0x31bd4
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 0x1c311
movq 0x90(%rsp), %rsi
movq 0x98(%rsp), %rdx
movq %r14, %rdi
callq 0x3390
movq 0x90(%rsp), %rdi
cmpq %rbp, %rdi
je 0x31c24
callq 0x3310
movl $0x1, %edx
movq %r14, %rdi
leaq 0x4cef(%rip), %rsi      # 0x36922
callq 0x3390
movslq 0x2bcc(%rbx), %rcx
movslq 0x2bc8(%rbx), %rax
subq %rax, %rcx
incq %r13
cmpq %rcx, %r13
jl 0x318f6
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 0x31c85
callq 0x3310
jmp 0x31c85
movq %rax, %rbx
movq 0x18(%rsp), %rdi
jmp 0x31ced
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x31ca3
callq 0x3310
jmp 0x31ca3
movq %rax, %rbx
movq 0x48(%rsp), %rdi
jmp 0x31ced
movq %rax, %rbx
movq 0x2b0(%rsp), %rdi
jmp 0x31ced
movq %rax, %rbx
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x31cce
callq 0x3310
jmp 0x31cce
movq %rax, %rbx
movq 0x78(%rsp), %rdi
jmp 0x31ced
movq %rax, %rbx
movq 0x2c8(%rsp), %rdi
jmp 0x31ced
movq %rax, %rbx
movq 0x2e0(%rsp), %rdi
testq %rdi, %rdi
jne 0x31d3a
jmp 0x31d3f
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x3440
jmp 0x31d09
movq %rax, %rbx
movq 0x290(%rsp), %rdi
cmpq %r13, %rdi
jne 0x31d3a
jmp 0x31d3f
jmp 0x31d2a
jmp 0x31d2a
jmp 0x31d2a
jmp 0x31d2a
jmp 0x31d2a
jmp 0x31d2a
jmp 0x31d2a
jmp 0x31d2a
jmp 0x31d2a
movq %rax, %rbx
movq 0x90(%rsp), %rdi
cmpq %rbp, %rdi
je 0x31d3f
callq 0x3310
movq %rbx, %rdi
callq 0x3580