// File: adamiaonr[P]rid-analytics/src/prob.cpp
// Function: Prob::print_lm_prob(unsigned char, bool)
void Prob::print_lm_prob(uint8_t iface, bool iface_complement) {

    // decide if we're calculating the iface or 'iface complement' largest match 
    // probabilities
    std::vector<std::vector<std::vector<__float080> > > * lmp;
    if (!iface_complement) lmp = &(this->lm_cond_prob);
    else lmp = &(this->lm_complement_cond_prob);

    printf("\n---------------------");
    for (uint8_t i = 0; i < (this->n + 2); i++)
        printf("-------------");

    printf("\n[|L|]         : |");

    for (uint8_t i = 0; i < (this->n + 1); i++)
        printf(" %-11d|", i);

    if (!iface_complement) printf(" SUM P(L_{i|t}) |");
    else printf(" SUM P(L_{~i|t}) |");

    printf("\n---------------------");
    for (uint8_t i = 0; i < (this->n + 2); i++)
        printf("-------------");

    __float080 cumulative_prob = 0.0;
    __float080 prob = 0.0;

    for (uint8_t fptree_size = 0; fptree_size < (this->n + 1); fptree_size++) {

        if (!iface_complement) printf("\n[P(L_{%d|%d}) ] : |", iface, fptree_size);
        else printf("\n[P(L_{~%d|%d})] : |", iface, fptree_size);

        for (uint8_t f = 0; f < (this->n + 1); f++) {

            prob = (*lmp)[iface][fptree_size][f];
            printf(" %-.5LE|", prob);

            cumulative_prob += prob;
        }

        printf("     %-.5LE|", cumulative_prob);
        cumulative_prob = 0.0;
    }

    printf("\n---------------------");
    for (uint8_t i = 0; i < (this->n + 2); i++)
        printf("-------------");

    printf("\n");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movb %dl, %al
movb %sil, %cl
movq %rdi, -0x8(%rbp)
movb %cl, -0x9(%rbp)
andb $0x1, %al
movb %al, -0xa(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x68(%rbp)
testb $0x1, -0xa(%rbp)
jne 0x5d5a4
movq -0x68(%rbp), %rax
movq %rax, -0x18(%rbp)
jmp 0x5d5b0
movq -0x68(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x18(%rbp)
leaq 0x6f23(%rip), %rdi      # 0x644da
movb $0x0, %al
callq 0x5090
movb $0x0, -0x19(%rbp)
movq -0x68(%rbp), %rax
movzbl -0x19(%rbp), %ecx
movl %ecx, -0x48(%rbp)
fildl -0x48(%rbp)
fldt 0x90(%rax)
flds 0x6eb4(%rip)            # 0x64490
faddp %st, %st(1)
fucompi %st(1), %st
fstp %st(0)
jbe 0x5d5fe
jmp 0x5d5e6
leaq 0x653b(%rip), %rdi      # 0x63b28
movb $0x0, %al
callq 0x5090
movb -0x19(%rbp), %al
addb $0x1, %al
movb %al, -0x19(%rbp)
jmp 0x5d5c2
leaq 0x6eec(%rip), %rdi      # 0x644f1
movb $0x0, %al
callq 0x5090
movb $0x0, -0x1a(%rbp)
movq -0x68(%rbp), %rax
movzbl -0x1a(%rbp), %ecx
movl %ecx, -0x4c(%rbp)
fildl -0x4c(%rbp)
fldt 0x90(%rax)
fld1
faddp %st, %st(1)
fucompi %st(1), %st
fstp %st(0)
jbe 0x5d64c
jmp 0x5d630
movzbl -0x1a(%rbp), %esi
leaq 0x6ec9(%rip), %rdi      # 0x64504
movb $0x0, %al
callq 0x5090
movb -0x1a(%rbp), %al
addb $0x1, %al
movb %al, -0x1a(%rbp)
jmp 0x5d610
testb $0x1, -0xa(%rbp)
jne 0x5d662
leaq 0x6eb3(%rip), %rdi      # 0x6450c
movb $0x0, %al
callq 0x5090
jmp 0x5d670
leaq 0x6eb5(%rip), %rdi      # 0x6451e
movb $0x0, %al
callq 0x5090
leaq 0x6e63(%rip), %rdi      # 0x644da
movb $0x0, %al
callq 0x5090
movb $0x0, -0x1b(%rbp)
movq -0x68(%rbp), %rax
movzbl -0x1b(%rbp), %ecx
movl %ecx, -0x50(%rbp)
fildl -0x50(%rbp)
fldt 0x90(%rax)
flds 0x6df4(%rip)            # 0x64490
faddp %st, %st(1)
fucompi %st(1), %st
fstp %st(0)
jbe 0x5d6be
jmp 0x5d6a6
leaq 0x647b(%rip), %rdi      # 0x63b28
movb $0x0, %al
callq 0x5090
movb -0x1b(%rbp), %al
addb $0x1, %al
movb %al, -0x1b(%rbp)
jmp 0x5d682
fldz
fld %st(0)
fstpt -0x30(%rbp)
fstpt -0x40(%rbp)
movb $0x0, -0x41(%rbp)
movq -0x68(%rbp), %rax
movzbl -0x41(%rbp), %ecx
movl %ecx, -0x54(%rbp)
fildl -0x54(%rbp)
fldt 0x90(%rax)
fld1
faddp %st, %st(1)
fucompi %st(1), %st
fstp %st(0)
jbe 0x5d7cb
jmp 0x5d6f0
testb $0x1, -0xa(%rbp)
jne 0x5d70e
movzbl -0x9(%rbp), %esi
movzbl -0x41(%rbp), %edx
leaq 0x6e2c(%rip), %rdi      # 0x64531
movb $0x0, %al
callq 0x5090
jmp 0x5d724
movzbl -0x9(%rbp), %esi
movzbl -0x41(%rbp), %edx
leaq 0x6e29(%rip), %rdi      # 0x64546
movb $0x0, %al
callq 0x5090
movb $0x0, -0x42(%rbp)
movq -0x68(%rbp), %rax
movzbl -0x42(%rbp), %ecx
movl %ecx, -0x5c(%rbp)
fildl -0x5c(%rbp)
fldt 0x90(%rax)
fld1
faddp %st, %st(1)
fucompi %st(1), %st
fstp %st(0)
jbe 0x5d7a3
jmp 0x5d748
movq -0x18(%rbp), %rdi
movzbl -0x9(%rbp), %eax
movl %eax, %esi
callq 0x5d910
movq %rax, %rdi
movzbl -0x41(%rbp), %eax
movl %eax, %esi
callq 0x358a0
movq %rax, %rdi
movzbl -0x42(%rbp), %eax
movl %eax, %esi
callq 0x34c70
fldt (%rax)
fstpt -0x40(%rbp)
fldt -0x40(%rbp)
movq %rsp, %rax
fstpt (%rax)
leaq 0x6dd8(%rip), %rdi      # 0x6455f
xorl %eax, %eax
callq 0x5090
fldt -0x40(%rbp)
fldt -0x30(%rbp)
faddp %st, %st(1)
fstpt -0x30(%rbp)
movb -0x42(%rbp), %al
addb $0x1, %al
movb %al, -0x42(%rbp)
jmp 0x5d728
fldt -0x30(%rbp)
movq %rsp, %rax
fstpt (%rax)
leaq 0x6da9(%rip), %rdi      # 0x6455b
xorl %eax, %eax
callq 0x5090
fldz
fstpt -0x30(%rbp)
movb -0x41(%rbp), %al
addb $0x1, %al
movb %al, -0x41(%rbp)
jmp 0x5d6cc
leaq 0x6d08(%rip), %rdi      # 0x644da
movb $0x0, %al
callq 0x5090
movb $0x0, -0x43(%rbp)
movq -0x68(%rbp), %rax
movzbl -0x43(%rbp), %ecx
movl %ecx, -0x58(%rbp)
fildl -0x58(%rbp)
fldt 0x90(%rax)
flds 0x6c99(%rip)            # 0x64490
faddp %st, %st(1)
fucompi %st(1), %st
fstp %st(0)
jbe 0x5d819
jmp 0x5d801
leaq 0x6320(%rip), %rdi      # 0x63b28
movb $0x0, %al
callq 0x5090
movb -0x43(%rbp), %al
addb $0x1, %al
movb %al, -0x43(%rbp)
jmp 0x5d7dd
leaq 0x5ca3(%rip), %rdi      # 0x634c3
movb $0x0, %al
callq 0x5090
addq $0x80, %rsp
popq %rbp
retq