// File: 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
subq $0x3d0, %rsp            # imm = 0x3D0
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x398(%rbp)
movl 0x30(%rax), %eax
shll $0x2, %eax
subl $0x2, %eax
movl %eax, -0xc(%rbp)
leaq -0x218(%rbp), %rdi
leaq 0x4bee(%rip), %rsi      # 0x20192
movl $0x8, %edx
callq 0x33e0
leaq -0x238(%rbp), %rdi
callq 0x3300
leaq -0x258(%rbp), %rdi
callq 0x3300
movl $0x0, -0x25c(%rbp)
movl -0x25c(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x1b61a
leaq -0x218(%rbp), %rdi
leaq -0x238(%rbp), %rsi
callq 0x3050
jmp 0x1b5f0
jmp 0x1b5f2
movl -0x25c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x25c(%rbp)
jmp 0x1b5d0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x268(%rbp)
movl %eax, -0x26c(%rbp)
jmp 0x1ba9e
leaq -0x218(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0x3050
jmp 0x1b62f
movq 0xd992(%rip), %rdi      # 0x28fc8
movq 0xd973(%rip), %rsi      # 0x28fb0
callq 0x3240
movq %rax, -0x3a0(%rbp)
jmp 0x1b64b
movq -0x3a0(%rbp), %rdi
movq 0xd957(%rip), %rsi      # 0x28fb0
callq 0x3240
jmp 0x1b660
movq -0x398(%rbp), %rax
cmpl $0x6, 0x30(%rax)
jne 0x1b84f
movq 0xd950(%rip), %rdi      # 0x28fc8
leaq 0x3a39(%rip), %rsi      # 0x1f0b8
callq 0x3210
movq %rax, -0x3a8(%rbp)
jmp 0x1b68d
movq -0x3a8(%rbp), %rdi
leaq 0x4b03(%rip), %rsi      # 0x2019e
callq 0x3210
jmp 0x1b6a2
leaq -0x290(%rbp), %rdi
leaq -0x238(%rbp), %rsi
callq 0x30f0
jmp 0x1b6b7
leaq -0x2b1(%rbp), %rdi
movq %rdi, -0x3b0(%rbp)
callq 0x33d0
movq -0x3b0(%rbp), %rdx
leaq 0x39e0(%rip), %rsi      # 0x1f0b8
leaq -0x2b0(%rbp), %rdi
callq 0x32f0
jmp 0x1b6e6
leaq -0x290(%rbp), %rdi
leaq -0x2b0(%rbp), %rsi
movsd 0x390c(%rip), %xmm0     # 0x1f008
callq 0x18910
jmp 0x1b703
leaq -0x2b0(%rbp), %rdi
callq 0x3448
leaq -0x2b1(%rbp), %rdi
callq 0x3250
leaq -0x290(%rbp), %rdi
callq 0x3448
leaq -0x2d8(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0x30f0
jmp 0x1b73c
leaq -0x2f9(%rbp), %rdi
movq %rdi, -0x3b8(%rbp)
callq 0x33d0
movq -0x3b8(%rbp), %rdx
leaq 0x395b(%rip), %rsi      # 0x1f0b8
leaq -0x2f8(%rbp), %rdi
callq 0x32f0
jmp 0x1b76b
leaq -0x2d8(%rbp), %rdi
leaq -0x2f8(%rbp), %rsi
movsd 0x3887(%rip), %xmm0     # 0x1f008
callq 0x18910
jmp 0x1b788
leaq -0x2f8(%rbp), %rdi
callq 0x3448
leaq -0x2f9(%rbp), %rdi
callq 0x3250
leaq -0x2d8(%rbp), %rdi
callq 0x3448
jmp 0x1ba2a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x268(%rbp)
movl %eax, -0x26c(%rbp)
jmp 0x1b7e3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x268(%rbp)
movl %eax, -0x26c(%rbp)
leaq -0x2b0(%rbp), %rdi
callq 0x3448
leaq -0x2b1(%rbp), %rdi
callq 0x3250
leaq -0x290(%rbp), %rdi
callq 0x3448
jmp 0x1ba9e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x268(%rbp)
movl %eax, -0x26c(%rbp)
jmp 0x1b832
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x268(%rbp)
movl %eax, -0x26c(%rbp)
leaq -0x2f8(%rbp), %rdi
callq 0x3448
leaq -0x2f9(%rbp), %rdi
callq 0x3250
leaq -0x2d8(%rbp), %rdi
callq 0x3448
jmp 0x1ba9e
movq 0xd772(%rip), %rdi      # 0x28fc8
leaq 0x4166(%rip), %rsi      # 0x1f9c3
callq 0x3210
movq %rax, -0x3c0(%rbp)
jmp 0x1b86b
movq -0x3c0(%rbp), %rdi
leaq 0x493b(%rip), %rsi      # 0x201b4
callq 0x3210
jmp 0x1b880
leaq -0x320(%rbp), %rdi
leaq -0x238(%rbp), %rsi
callq 0x30f0
jmp 0x1b895
leaq -0x341(%rbp), %rdi
movq %rdi, -0x3c8(%rbp)
callq 0x33d0
movq -0x3c8(%rbp), %rdx
leaq 0x410d(%rip), %rsi      # 0x1f9c3
leaq -0x340(%rbp), %rdi
callq 0x32f0
jmp 0x1b8c4
leaq -0x320(%rbp), %rdi
leaq -0x340(%rbp), %rsi
movsd 0x372e(%rip), %xmm0     # 0x1f008
callq 0x18910
jmp 0x1b8e1
leaq -0x340(%rbp), %rdi
callq 0x3448
leaq -0x341(%rbp), %rdi
callq 0x3250
leaq -0x320(%rbp), %rdi
callq 0x3448
leaq -0x368(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0x30f0
jmp 0x1b91a
leaq -0x389(%rbp), %rdi
movq %rdi, -0x3d0(%rbp)
callq 0x33d0
movq -0x3d0(%rbp), %rdx
leaq 0x4088(%rip), %rsi      # 0x1f9c3
leaq -0x388(%rbp), %rdi
callq 0x32f0
jmp 0x1b949
leaq -0x368(%rbp), %rdi
leaq -0x388(%rbp), %rsi
movsd 0x36a9(%rip), %xmm0     # 0x1f008
callq 0x18910
jmp 0x1b966
leaq -0x388(%rbp), %rdi
callq 0x3448
leaq -0x389(%rbp), %rdi
callq 0x3250
leaq -0x368(%rbp), %rdi
callq 0x3448
jmp 0x1ba2a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x268(%rbp)
movl %eax, -0x26c(%rbp)
jmp 0x1b9c1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x268(%rbp)
movl %eax, -0x26c(%rbp)
leaq -0x340(%rbp), %rdi
callq 0x3448
leaq -0x341(%rbp), %rdi
callq 0x3250
leaq -0x320(%rbp), %rdi
callq 0x3448
jmp 0x1ba9e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x268(%rbp)
movl %eax, -0x26c(%rbp)
jmp 0x1ba10
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x268(%rbp)
movl %eax, -0x26c(%rbp)
leaq -0x388(%rbp), %rdi
callq 0x3448
leaq -0x389(%rbp), %rdi
callq 0x3250
leaq -0x368(%rbp), %rdi
callq 0x3448
jmp 0x1ba9e
movq 0xd597(%rip), %rdi      # 0x28fc8
movq 0xd578(%rip), %rsi      # 0x28fb0
callq 0x3240
jmp 0x1ba3f
movsd 0x3cd9(%rip), %xmm0     # 0x1f720
callq 0x188c0
jmp 0x1ba4e
movq 0xd573(%rip), %rdi      # 0x28fc8
movq 0xd554(%rip), %rsi      # 0x28fb0
callq 0x3240
jmp 0x1ba63
leaq -0x218(%rbp), %rdi
callq 0x3060
jmp 0x1ba71
leaq -0x258(%rbp), %rdi
callq 0x3448
leaq -0x238(%rbp), %rdi
callq 0x3448
leaq -0x218(%rbp), %rdi
callq 0x3090
addq $0x3d0, %rsp            # imm = 0x3D0
popq %rbp
retq
leaq -0x258(%rbp), %rdi
callq 0x3448
leaq -0x238(%rbp), %rdi
callq 0x3448
leaq -0x218(%rbp), %rdi
callq 0x3090
movq -0x268(%rbp), %rdi
callq 0x33c0
nop