// File: /workspace/github_cpp_makefile_star2_O3/dnegovan[P]Intruder-On-Donnar-V/Game.cpp
// Function: Game::printEnding()
void Game::printEnding()
{
    //enum is in the same order as file.  formula to find 1st line of ending
    int line = markNelson.state * 4 - 2;

    std::ifstream stream("endings.txt", std::ios::in);
    std::string endingText1;
    std::string endingText2;

    //get each line until we have the right one, then stop
    for (int i = 0; i < line; i++)
    {
        getline(stream, endingText1);
    }
    //each ending is two lines, have first using loop above, so grab second one
    getline(stream, endingText2);

    std::cout << std::endl << std::endl;

    //check for best ending, different color if so
    if (markNelson.state == SAVED_WIFE)
    {
        std::cout << NARRATOR_COLOR << "PARASITE ERADICATED!\n";
        printString(endingText1, NARRATOR_COLOR, SHORT);
        printString(endingText2, NARRATOR_COLOR, SHORT);
    }
    else
    {
        std::cout << RED << "GAME OVER\n";
        printString(endingText1, RED, SHORT);
        printString(endingText2, RED, SHORT);
    }

    //long dramatic pause before play again menu
    std::cout << std::endl;
    wait(LONG);
    std::cout << std::endl;

    stream.close();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x348, %rsp            # imm = 0x348
movq %rdi, %r14
movl 0x30(%rdi), %r15d
leaq 0x45ae(%rip), %rsi      # 0x17192
leaq -0x370(%rbp), %rbx
movq %rbx, %rdi
movl $0x8, %edx
callq 0x3340
leaq -0x38(%rbp), %rcx
movq %rcx, -0x10(%rcx)
xorl %eax, %eax
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq -0x58(%rbp), %r13
movq %r13, -0x10(%r13)
movq %rax, -0x8(%r13)
movb %al, (%r13)
testl %r15d, %r15d
jle 0x12c61
leal -0x2(,%r15,4), %eax
cmpl $0x2, %eax
movl $0x1, %r12d
cmovgel %eax, %r12d
leaq -0x48(%rbp), %r15
movq -0x370(%rbp), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x31d0
movsbl %al, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3350
decl %r12d
jne 0x12c36
movq -0x370(%rbp), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x31d0
movsbl %al, %edx
leaq -0x370(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x3350
movq 0x9335(%rip), %rdi      # 0x1bfc8
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x31d0
movsbl %al, %esi
movq 0x931a(%rip), %rbx      # 0x1bfc8
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3140
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x31d0
movsbl %al, %esi
movq %r15, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3140
cmpl $0x6, 0x30(%r14)
jne 0x12e26
movq 0x92ce(%rip), %rdi      # 0x1bfc8
leaq 0x3392(%rip), %rsi      # 0x16093
movl $0x5, %edx
callq 0x3210
movq 0x92b6(%rip), %rdi      # 0x1bfc8
leaq 0x4485(%rip), %rsi      # 0x1719e
movl $0x15, %edx
callq 0x3210
leaq -0x158(%rbp), %r14
movq %r14, -0x10(%r14)
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
addq %rsi, %rdx
leaq -0x168(%rbp), %rdi
callq 0xd7ca
leaq -0x138(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x333c(%rip), %rsi      # 0x16093
leaq 0x333a(%rip), %rdx      # 0x16098
leaq -0x148(%rbp), %rdi
callq 0xe56e
leaq -0x168(%rbp), %rdi
leaq -0x148(%rbp), %rsi
movsd 0x3288(%rip), %xmm0     # 0x16008
callq 0x109ae
movq -0x148(%rbp), %rdi
cmpq %r15, %rdi
je 0x12d96
callq 0x31c0
movq -0x168(%rbp), %rdi
cmpq %r14, %rdi
je 0x12da7
callq 0x31c0
leaq -0x118(%rbp), %r14
movq %r14, -0x10(%r14)
movq -0x68(%rbp), %rsi
movq -0x60(%rbp), %rdx
addq %rsi, %rdx
leaq -0x128(%rbp), %rdi
callq 0xd7ca
leaq -0xf8(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x32b8(%rip), %rsi      # 0x16093
leaq 0x32b6(%rip), %rdx      # 0x16098
leaq -0x108(%rbp), %rdi
callq 0xe56e
leaq -0x128(%rbp), %rdi
leaq -0x108(%rbp), %rsi
movsd 0x3204(%rip), %xmm0     # 0x16008
callq 0x109ae
movq -0x108(%rbp), %rdi
cmpq %r15, %rdi
je 0x12e1a
callq 0x31c0
movq -0x128(%rbp), %rdi
jmp 0x12f51
movq 0x919b(%rip), %rdi      # 0x1bfc8
leaq 0x3b8f(%rip), %rsi      # 0x169c3
movl $0x5, %edx
callq 0x3210
movq 0x9183(%rip), %rdi      # 0x1bfc8
leaq 0x4368(%rip), %rsi      # 0x171b4
movl $0xa, %edx
callq 0x3210
leaq -0xd8(%rbp), %r14
movq %r14, -0x10(%r14)
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
addq %rsi, %rdx
leaq -0xe8(%rbp), %rdi
callq 0xd7ca
leaq -0xb8(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x3b39(%rip), %rsi      # 0x169c3
leaq 0x3b37(%rip), %rdx      # 0x169c8
leaq -0xc8(%rbp), %rdi
callq 0xe56e
leaq -0xe8(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
movsd 0x3155(%rip), %xmm0     # 0x16008
callq 0x109ae
movq -0xc8(%rbp), %rdi
cmpq %r15, %rdi
je 0x12ec9
callq 0x31c0
movq -0xe8(%rbp), %rdi
cmpq %r14, %rdi
je 0x12eda
callq 0x31c0
leaq -0x98(%rbp), %r14
movq %r14, -0x10(%r14)
movq -0x68(%rbp), %rsi
movq -0x60(%rbp), %rdx
addq %rsi, %rdx
leaq -0xa8(%rbp), %rdi
callq 0xd7ca
leaq -0x78(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x3ab8(%rip), %rsi      # 0x169c3
leaq 0x3ab6(%rip), %rdx      # 0x169c8
leaq -0x88(%rbp), %rdi
callq 0xe56e
leaq -0xa8(%rbp), %rdi
leaq -0x88(%rbp), %rsi
movsd 0x30d4(%rip), %xmm0     # 0x16008
callq 0x109ae
movq -0x88(%rbp), %rdi
cmpq %r15, %rdi
je 0x12f4a
callq 0x31c0
movq -0xa8(%rbp), %rdi
cmpq %r14, %rdi
je 0x12f5b
callq 0x31c0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x31d0
movsbl %al, %esi
movq 0x904f(%rip), %rbx      # 0x1bfc8
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3140
movsd 0x378f(%rip), %xmm0     # 0x16720
callq 0x10960
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x31d0
movsbl %al, %esi
movq 0x9014(%rip), %rdi      # 0x1bfc8
callq 0x3030
movq %rax, %rdi
callq 0x3140
leaq -0x370(%rbp), %rdi
callq 0x3040
movq -0x68(%rbp), %rdi
cmpq %r13, %rdi
je 0x12fdb
callq 0x31c0
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x12fed
callq 0x31c0
leaq -0x370(%rbp), %rdi
callq 0x3050
addq $0x348, %rsp            # imm = 0x348
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x88(%rbp), %rdi
cmpq %r15, %rdi
je 0x1303a
callq 0x31c0
jmp 0x1303a
movq %rax, %rbx
movq -0x108(%rbp), %rdi
cmpq %r15, %rdi
je 0x13046
callq 0x31c0
jmp 0x13046
movq %rax, %rbx
movq -0xa8(%rbp), %rdi
jmp 0x13091
movq %rax, %rbx
movq -0x128(%rbp), %rdi
jmp 0x13091
movq %rax, %rbx
movq -0xc8(%rbp), %rdi
cmpq %r15, %rdi
je 0x1307e
callq 0x31c0
jmp 0x1307e
movq %rax, %rbx
movq -0x148(%rbp), %rdi
cmpq %r15, %rdi
je 0x1308a
callq 0x31c0
jmp 0x1308a
movq %rax, %rbx
movq -0xe8(%rbp), %rdi
jmp 0x13091
movq %rax, %rbx
movq -0x168(%rbp), %rdi
cmpq %r14, %rdi
je 0x130a2
callq 0x31c0
jmp 0x130a2
jmp 0x1309f
movq %rax, %rbx
movq -0x68(%rbp), %rdi
cmpq %r13, %rdi
je 0x130b0
callq 0x31c0
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x130c2
callq 0x31c0
leaq -0x370(%rbp), %rdi
callq 0x3050
movq %rbx, %rdi
callq 0x3320