// File: BrianEnigma[P]cryptoslam/src/cryptogram.cpp
// Function: Cryptogram::paintStats(_win_st*)
void Cryptogram::paintStats(WINDOW *w)
{
    // Print the statistics...
    char letters[26];
    int counts[26];
    int row, col;
    letterDistribution(letters, counts);
    wordDistribution_t words = wordDistribution();

    wclear(w);
    mvwprintw(w, 1, 0, 
              "Number of times each letter/word appears in cyphertext:");
    for (int i=0; i < 26; i++)
    {
        if (i < 13)
        {
            row = 3 + i;
            col = 1;
        } else {
            row = 3 + i - 13;
            col = 20;
        }
        wmove(w, row, col);
        wprintw(w, "%c %4d\n", letters[i], counts[i]);
    }
    int c = 0;
    for (wordDistribution_t::reverse_iterator t = words.rbegin();
         t != words.rend() && c < 13;
         t++, c++)
    {
        wmove(w, 3+c, 40);
        wprintw(w, "%3d %s", (*t).first, (*t).second.c_str());
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x150, %rsp            # imm = 0x150
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x110(%rbp)
leaq -0x30(%rbp), %rsi
leaq -0xa0(%rbp), %rdx
callq 0x30b0
movq -0x110(%rbp), %rsi
leaq -0xd8(%rbp), %rdi
callq 0x3250
movq -0x10(%rbp), %rdi
callq 0x2240
jmp 0x3dec
movq -0x10(%rbp), %rdi
leaq 0x2491(%rip), %rcx      # 0x6288
xorl %edx, %edx
movb %dl, %al
movl $0x1, %esi
callq 0x2090
jmp 0x3e07
movl $0x0, -0xe8(%rbp)
cmpl $0x1a, -0xe8(%rbp)
jge 0x3ed5
cmpl $0xd, -0xe8(%rbp)
jge 0x3e65
movl -0xe8(%rbp), %eax
addl $0x3, %eax
movl %eax, -0xa4(%rbp)
movl $0x1, -0xa8(%rbp)
jmp 0x3e81
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe0(%rbp)
movl %eax, -0xe4(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x4240
jmp 0x402a
movl -0xe8(%rbp), %eax
addl $0x3, %eax
subl $0xd, %eax
movl %eax, -0xa4(%rbp)
movl $0x14, -0xa8(%rbp)
movq -0x10(%rbp), %rdi
movl -0xa4(%rbp), %esi
movl -0xa8(%rbp), %edx
callq 0x2260
jmp 0x3e98
movq -0x10(%rbp), %rdi
movslq -0xe8(%rbp), %rax
movsbl -0x30(%rbp,%rax), %edx
movl -0xa0(%rbp,%rax,4), %ecx
leaq 0x240a(%rip), %rsi      # 0x62c0
xorl %eax, %eax
callq 0x2040
jmp 0x3ebf
jmp 0x3ec1
movl -0xe8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xe8(%rbp)
jmp 0x3e11
movl $0x0, -0xec(%rbp)
leaq -0xf8(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x4260
leaq -0x100(%rbp), %rdi
movq %rdi, -0x120(%rbp)
leaq -0xd8(%rbp), %rsi
callq 0x42c0
movq -0x120(%rbp), %rsi
leaq -0xf8(%rbp), %rdi
callq 0x4290
movb %al, -0x111(%rbp)
jmp 0x3f27
movb -0x111(%rbp), %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x121(%rbp)
jne 0x3f3c
jmp 0x3f4c
cmpl $0xd, -0xec(%rbp)
setl %al
movb %al, -0x121(%rbp)
movb -0x121(%rbp), %al
testb $0x1, %al
jne 0x3f5b
jmp 0x4015
movq -0x10(%rbp), %rdi
movl -0xec(%rbp), %esi
addl $0x3, %esi
movl $0x28, %edx
callq 0x2260
jmp 0x3f74
movq -0x10(%rbp), %rax
movq %rax, -0x138(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x42f0
movq %rax, -0x130(%rbp)
jmp 0x3f94
movq -0x130(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x144(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x42f0
movq %rax, -0x140(%rbp)
jmp 0x3fb8
movq -0x140(%rbp), %rdi
addq $0x8, %rdi
callq 0x2100
movq -0x138(%rbp), %rdi
movl -0x144(%rbp), %edx
movq %rax, %rcx
leaq 0x22e9(%rip), %rsi      # 0x62c8
xorl %eax, %eax
callq 0x2040
jmp 0x3fe8
jmp 0x3fea
leaq -0x108(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
xorl %edx, %edx
callq 0x4320
jmp 0x4001
movl -0xec(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xec(%rbp)
jmp 0x3ef2
leaq -0xd8(%rbp), %rdi
callq 0x4240
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
movq -0xe0(%rbp), %rdi
callq 0x2400
nopw %cs:(%rax,%rax)