// File: dnegovan[P]Intruder-On-Donnar-V/Space.cpp
// Function: Space::killOccupant(Player&)
bool Space::killOccupant(Player& markNelson)
{
    //opportunity to cancel murder
    std::string prompt = "Are you sure you want to kill ";
    prompt += occupant->getName();
    prompt += "? [y/n]:";
    std::cout << RED;
    char answer = getYesNo(prompt);
    std::cout << RESET;
    if (answer == 'N')
    {
        //continue game
        return true;
    }

    //print this person's death text blurb
    std::cout << std::endl;
    std::string fileName = occupant->getName() + "Death.txt";
    printFile(fileName, NARRATOR_COLOR, 0);
    wait(LONG);

    //update game variables
    if (occupant->getInfected())
    {
        //death cures host
        occupant->setInfected(false);
        markNelson.crewInfected--;
        std::cout << NARRATOR_COLOR << "\nYou knew in your gut you had to do it."
                  << std::endl << occupant->getName()
                  << " had definitely been infected with the parasite.\n"
                  << RESET;
    }
    else
    {
        markNelson.innocentsShot++;
        std::cout << NARRATOR_COLOR << "\nYou are filled with doubt. \nThere "
                  << "wasn't really any evidence that "
                  << occupant->getName()
                  << " had been infected.\n"
                  << RESET;
    }

    wait(LONG);

    occupant->setAlive(false);
    markNelson.crewDead++;

    //trigger game endings if this was last infected person
    if (markNelson.crewInfected == 0)
    {
        if (!markNelson.incubated && markNelson.innocentsShot == 0)
        {
            if (!markNelson.injectedWrong)
            {
                markNelson.state = KILLED_WIFE_PRE_INCUBATION;
                return false;
            }
            else
            {
                markNelson.state = KILLED_WIFE_WRONG_INJECTION;
                return false;
            }
        }
        if (markNelson.innocentsShot > 0)  //incubation doesn't matter for these
        {
            if (markNelson.crewDead < ALL_CREW)
            {
                markNelson.state = SHOT_INNOCENT_AND_WIFE;
                return false;
            }
            if (markNelson.crewDead == ALL_CREW)
            {
                markNelson.state = SHOT_ALL_SOME_INNOCENT;;
                return false;
            }
        }

        //only get to here if you didn't kill any innocents
        if (markNelson.incubated)
        {
            if (markNelson.crewDead == 1)
            {
                markNelson.state = KILLED_WIFE_BEFORE_SPREAD;
                return false;
            }
            if (markNelson.crewDead == 2 && markNelson.injectedWrong)
            {
                //this ending is in two places, see above
                markNelson.state = KILLED_WIFE_WRONG_INJECTION;
                return false;
            }
            if (markNelson.crewDead > 1 && markNelson.crewDead < ALL_CREW)
            {
                markNelson.state = INCUBATED_SOME_SURVIVE;
                return false;
            }
        }
    	if (markNelson.crewDead == ALL_CREW) //incubation doesn't matter here
        {
    		markNelson.state = ALL_CREW_DEAD_YOU_SURVIVE;
            return false;
        }

    }
    //if we made it here, keep playing
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1e0, %rsp            # imm = 0x1E0
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x178(%rbp)
leaq -0x39(%rbp), %rdi
movq %rdi, -0x170(%rbp)
callq 0x33d0
movq -0x170(%rbp), %rdx
leaq 0x267d(%rip), %rsi      # 0x20429
leaq -0x38(%rbp), %rdi
callq 0x32f0
jmp 0x1ddb7
leaq -0x39(%rbp), %rdi
callq 0x3250
movq -0x178(%rbp), %rax
movq 0x8(%rax), %rsi
leaq -0x70(%rbp), %rdi
callq 0x15fc0
jmp 0x1ddd6
leaq -0x38(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x32a0
jmp 0x1dde5
leaq -0x70(%rbp), %rdi
callq 0x3448
leaq 0x2653(%rip), %rsi      # 0x20448
leaq -0x38(%rbp), %rdi
callq 0x3200
jmp 0x1de00
movq 0xb1c1(%rip), %rdi      # 0x28fc8
leaq 0x1bb5(%rip), %rsi      # 0x1f9c3
callq 0x3210
jmp 0x1de15
leaq -0x98(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x30f0
jmp 0x1de27
leaq -0x98(%rbp), %rdi
callq 0x174b0
movb %al, -0x179(%rbp)
jmp 0x1de3b
leaq -0x98(%rbp), %rdi
callq 0x3448
movb -0x179(%rbp), %al
movb %al, -0x71(%rbp)
movq 0xb171(%rip), %rdi      # 0x28fc8
leaq 0x1275(%rip), %rsi      # 0x1f0d3
callq 0x3210
jmp 0x1de65
movsbl -0x71(%rbp), %eax
cmpl $0x4e, %eax
jne 0x1dee3
movb $0x1, -0x1(%rbp)
movl $0x1, -0x9c(%rbp)
jmp 0x1e434
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x39(%rbp), %rdi
callq 0x3250
jmp 0x1e454
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x1e44b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x3448
jmp 0x1e44b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x3448
jmp 0x1e44b
movq 0xb0de(%rip), %rdi      # 0x28fc8
movq 0xb0bf(%rip), %rsi      # 0x28fb0
callq 0x3240
jmp 0x1def8
movq -0x178(%rbp), %rax
movq 0x8(%rax), %rsi
leaq -0xe0(%rbp), %rdi
callq 0x15fc0
jmp 0x1df11
leaq 0x2539(%rip), %rdx      # 0x20451
leaq -0xc0(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x1e900
jmp 0x1df2d
leaq -0xe0(%rbp), %rdi
callq 0x3448
leaq -0x100(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x30f0
jmp 0x1df4e
leaq -0x121(%rbp), %rdi
movq %rdi, -0x188(%rbp)
callq 0x33d0
movq -0x188(%rbp), %rdx
leaq 0x1149(%rip), %rsi      # 0x1f0b8
leaq -0x120(%rbp), %rdi
callq 0x32f0
jmp 0x1df7d
leaq -0x100(%rbp), %rdi
leaq -0x120(%rbp), %rsi
xorps %xmm0, %xmm0
callq 0x18550
jmp 0x1df95
leaq -0x120(%rbp), %rdi
callq 0x3448
leaq -0x121(%rbp), %rdi
callq 0x3250
leaq -0x100(%rbp), %rdi
callq 0x3448
movsd 0x175f(%rip), %xmm0     # 0x1f720
callq 0x188c0
jmp 0x1dfc8
movq -0x178(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x16050
movb %al, -0x189(%rbp)
jmp 0x1dfe0
movb -0x189(%rbp), %al
testb $0x1, %al
jne 0x1dfef
jmp 0x1e168
movq -0x178(%rbp), %rax
movq 0x8(%rax), %rdi
xorl %esi, %esi
callq 0x16030
jmp 0x1e003
movq -0x18(%rbp), %rax
movl 0x24(%rax), %ecx
decl %ecx
movl %ecx, 0x24(%rax)
movq 0xafb2(%rip), %rdi      # 0x28fc8
leaq 0x109b(%rip), %rsi      # 0x1f0b8
callq 0x3210
movq %rax, -0x198(%rbp)
jmp 0x1e02b
movq -0x198(%rbp), %rdi
leaq 0x2422(%rip), %rsi      # 0x2045b
callq 0x3210
movq %rax, -0x1a0(%rbp)
jmp 0x1e047
movq -0x1a0(%rbp), %rdi
movq 0xaf5b(%rip), %rsi      # 0x28fb0
callq 0x3240
movq %rax, -0x1a8(%rbp)
jmp 0x1e063
movq -0x178(%rbp), %rax
movq 0x8(%rax), %rsi
leaq -0x148(%rbp), %rdi
callq 0x15fc0
jmp 0x1e07c
movq -0x1a8(%rbp), %rdi
leaq -0x148(%rbp), %rsi
callq 0x31e0
movq %rax, -0x1b0(%rbp)
jmp 0x1e098
movq -0x1b0(%rbp), %rdi
leaq 0x23dd(%rip), %rsi      # 0x20483
callq 0x3210
movq %rax, -0x1b8(%rbp)
jmp 0x1e0b4
movq -0x1b8(%rbp), %rdi
leaq 0x1011(%rip), %rsi      # 0x1f0d3
callq 0x3210
jmp 0x1e0c9
leaq -0x148(%rbp), %rdi
callq 0x3448
jmp 0x1e259
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x3448
jmp 0x1e44b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x1e426
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x1e12e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x3448
leaq -0x121(%rbp), %rdi
callq 0x3250
leaq -0x100(%rbp), %rdi
callq 0x3448
jmp 0x1e426
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x148(%rbp), %rdi
callq 0x3448
jmp 0x1e426
movq -0x18(%rbp), %rax
movl 0x2c(%rax), %ecx
incl %ecx
movl %ecx, 0x2c(%rax)
movq 0xae4d(%rip), %rdi      # 0x28fc8
leaq 0xf36(%rip), %rsi       # 0x1f0b8
callq 0x3210
movq %rax, -0x1c0(%rbp)
jmp 0x1e190
movq -0x1c0(%rbp), %rdi
leaq 0x2317(%rip), %rsi      # 0x204b5
callq 0x3210
movq %rax, -0x1c8(%rbp)
jmp 0x1e1ac
movq -0x1c8(%rbp), %rdi
leaq 0x231f(%rip), %rsi      # 0x204d9
callq 0x3210
movq %rax, -0x1d0(%rbp)
jmp 0x1e1c8
movq -0x178(%rbp), %rax
movq 0x8(%rax), %rsi
leaq -0x168(%rbp), %rdi
callq 0x15fc0
jmp 0x1e1e1
movq -0x1d0(%rbp), %rdi
leaq -0x168(%rbp), %rsi
callq 0x31e0
movq %rax, -0x1d8(%rbp)
jmp 0x1e1fd
movq -0x1d8(%rbp), %rdi
leaq 0x22ef(%rip), %rsi      # 0x204fa
callq 0x3210
movq %rax, -0x1e0(%rbp)
jmp 0x1e219
movq -0x1e0(%rbp), %rdi
leaq 0xeac(%rip), %rsi       # 0x1f0d3
callq 0x3210
jmp 0x1e22e
leaq -0x168(%rbp), %rdi
callq 0x3448
jmp 0x1e259
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x168(%rbp), %rdi
callq 0x3448
jmp 0x1e426
movsd 0x14bf(%rip), %xmm0     # 0x1f720
callq 0x188c0
jmp 0x1e268
movq -0x178(%rbp), %rax
movq 0x8(%rax), %rdi
xorl %esi, %esi
callq 0x15ff0
jmp 0x1e27c
movq -0x18(%rbp), %rax
movl 0x20(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x20(%rax)
movq -0x18(%rbp), %rax
cmpl $0x0, 0x24(%rax)
jne 0x1e40a
movq -0x18(%rbp), %rax
testb $0x1, 0x28(%rax)
jne 0x1e2f1
movq -0x18(%rbp), %rax
cmpl $0x0, 0x2c(%rax)
jne 0x1e2f1
movq -0x18(%rbp), %rax
testb $0x1, 0x18(%rax)
jne 0x1e2d3
movq -0x18(%rbp), %rax
movl $0x3, 0x30(%rax)
movb $0x0, -0x1(%rbp)
movl $0x1, -0x9c(%rbp)
jmp 0x1e418
movq -0x18(%rbp), %rax
movl $0x4, 0x30(%rax)
movb $0x0, -0x1(%rbp)
movl $0x1, -0x9c(%rbp)
jmp 0x1e418
movq -0x18(%rbp), %rax
cmpl $0x0, 0x2c(%rax)
jle 0x1e34d
movq -0x18(%rbp), %rax
cmpl $0x5, 0x20(%rax)
jge 0x1e323
movq -0x18(%rbp), %rax
movl $0xc, 0x30(%rax)
movb $0x0, -0x1(%rbp)
movl $0x1, -0x9c(%rbp)
jmp 0x1e418
movq -0x18(%rbp), %rax
cmpl $0x5, 0x20(%rax)
jne 0x1e34b
movq -0x18(%rbp), %rax
movl $0xd, 0x30(%rax)
movb $0x0, -0x1(%rbp)
movl $0x1, -0x9c(%rbp)
jmp 0x1e418
jmp 0x1e34d
movq -0x18(%rbp), %rax
testb $0x1, 0x28(%rax)
je 0x1e3e3
movq -0x18(%rbp), %rax
cmpl $0x1, 0x20(%rax)
jne 0x1e383
movq -0x18(%rbp), %rax
movl $0x5, 0x30(%rax)
movb $0x0, -0x1(%rbp)
movl $0x1, -0x9c(%rbp)
jmp 0x1e418
movq -0x18(%rbp), %rax
cmpl $0x2, 0x20(%rax)
jne 0x1e3b2
movq -0x18(%rbp), %rax
testb $0x1, 0x18(%rax)
je 0x1e3b2
movq -0x18(%rbp), %rax
movl $0x4, 0x30(%rax)
movb $0x0, -0x1(%rbp)
movl $0x1, -0x9c(%rbp)
jmp 0x1e418
movq -0x18(%rbp), %rax
cmpl $0x1, 0x20(%rax)
jle 0x1e3e1
movq -0x18(%rbp), %rax
cmpl $0x5, 0x20(%rax)
jge 0x1e3e1
movq -0x18(%rbp), %rax
movl $0xb, 0x30(%rax)
movb $0x0, -0x1(%rbp)
movl $0x1, -0x9c(%rbp)
jmp 0x1e418
jmp 0x1e3e3
movq -0x18(%rbp), %rax
cmpl $0x5, 0x20(%rax)
jne 0x1e408
movq -0x18(%rbp), %rax
movl $0xa, 0x30(%rax)
movb $0x0, -0x1(%rbp)
movl $0x1, -0x9c(%rbp)
jmp 0x1e418
jmp 0x1e40a
movb $0x1, -0x1(%rbp)
movl $0x1, -0x9c(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x3448
jmp 0x1e434
leaq -0xc0(%rbp), %rdi
callq 0x3448
jmp 0x1e44b
leaq -0x38(%rbp), %rdi
callq 0x3448
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x1e0, %rsp            # imm = 0x1E0
popq %rbp
retq
leaq -0x38(%rbp), %rdi
callq 0x3448
movq -0x48(%rbp), %rdi
callq 0x33c0
nopl (%rax)