// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq -0x78(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x25a3(%rip), %rsi      # 0x1742e
leaq 0x25ba(%rip), %rdx      # 0x1744c
leaq -0x88(%rbp), %rdi
callq 0xe724
movq 0x8(%r14), %rsi
leaq -0x48(%rbp), %rdi
callq 0xec70
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
leaq -0x88(%rbp), %rdi
callq 0x3080
leaq -0x38(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x14ed1
callq 0x31c0
leaq 0x2575(%rip), %rsi      # 0x1744d
leaq -0x88(%rbp), %rdi
callq 0x3370
movq 0x70dd(%rip), %rdi      # 0x1bfc8
leaq 0x1ad1(%rip), %rsi      # 0x169c3
movl $0x5, %edx
callq 0x3210
leaq -0xd8(%rbp), %r15
movq %r15, -0x10(%r15)
movq -0x88(%rbp), %rsi
movq -0x80(%rbp), %rdx
addq %rsi, %rdx
leaq -0xe8(%rbp), %rdi
callq 0xd9b2
leaq -0xe8(%rbp), %rdi
callq 0xf806
movl %eax, %r12d
movq -0xe8(%rbp), %rdi
cmpq %r15, %rdi
je 0x14f41
callq 0x31c0
movq 0x7080(%rip), %r13      # 0x1bfc8
leaq 0x115f(%rip), %rsi      # 0x160ae
movl $0x4, %edx
movq %r13, %rdi
callq 0x3210
movb $0x1, %r15b
cmpb $0x4e, %r12b
je 0x152c9
movq (%r13), %rax
addq -0x18(%rax), %r13
movq %r13, %rdi
movl $0xa, %esi
callq 0x31d0
movsbl %al, %esi
movq 0x7040(%rip), %rdi      # 0x1bfc8
callq 0x3030
movq %rax, %rdi
callq 0x3140
movq 0x8(%r14), %rsi
leaq -0x68(%rbp), %rdi
callq 0xec70
leaq -0x38(%rbp), %r15
leaq 0x24a9(%rip), %rsi      # 0x17456
leaq -0x68(%rbp), %rdi
callq 0x3370
movq %r15, -0x48(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x14fd6
movq %rdx, -0x48(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x38(%rbp)
jmp 0x14fdd
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
movq %rdx, -0x40(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq -0x58(%rbp), %r12
movq -0x10(%r12), %rdi
cmpq %r12, %rdi
je 0x15007
callq 0x31c0
leaq -0xb8(%rbp), %r15
movq %r15, -0x10(%r15)
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
addq %rsi, %rdx
leaq -0xc8(%rbp), %rdi
callq 0xd9b2
leaq -0x98(%rbp), %r13
movq %r13, -0x10(%r13)
leaq 0x1058(%rip), %rsi      # 0x16093
leaq 0x1056(%rip), %rdx      # 0x16098
leaq -0xa8(%rbp), %rdi
callq 0xe724
leaq -0xc8(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
xorps %xmm0, %xmm0
callq 0x108e7
movq -0xa8(%rbp), %rdi
cmpq %r13, %rdi
je 0x15075
callq 0x31c0
movq -0xc8(%rbp), %rdi
cmpq %r15, %rdi
je 0x15086
callq 0x31c0
movsd 0x1692(%rip), %xmm0     # 0x16720
callq 0x10b95
movq 0x8(%r14), %rdi
callq 0xecbc
testb %al, %al
je 0x15160
movq 0x8(%r14), %rdi
xorl %esi, %esi
callq 0xecb2
decl 0x24(%rbx)
movq 0x6f0f(%rip), %rdi      # 0x1bfc8
leaq 0xfd3(%rip), %rsi       # 0x16093
movl $0x5, %edx
callq 0x3210
movq 0x6ef7(%rip), %r15      # 0x1bfc8
leaq 0x2388(%rip), %rsi      # 0x17460
movl $0x27, %edx
movq %r15, %rdi
callq 0x3210
movq (%r15), %rax
addq -0x18(%rax), %r15
movq %r15, %rdi
movl $0xa, %esi
callq 0x31d0
movsbl %al, %esi
movq 0x6ec5(%rip), %rdi      # 0x1bfc8
callq 0x3030
movq %rax, %rdi
callq 0x3140
movq %rax, %r15
movq 0x8(%r14), %rsi
leaq -0x68(%rbp), %rdi
callq 0xec70
movq -0x68(%rbp), %rsi
movq -0x60(%rbp), %rdx
movq %r15, %rdi
callq 0x3210
movq %rax, %r15
leaq 0x234e(%rip), %rsi      # 0x17488
movl $0x31, %edx
movq %rax, %rdi
callq 0x3210
leaq 0xf60(%rip), %rsi       # 0x160ae
movl $0x4, %edx
movq %r15, %rdi
callq 0x3210
jmp 0x151f7
incl 0x2c(%rbx)
movq 0x6e5e(%rip), %rdi      # 0x1bfc8
leaq 0xf22(%rip), %rsi       # 0x16093
movl $0x5, %edx
callq 0x3210
movq 0x6e46(%rip), %rdi      # 0x1bfc8
leaq 0x2331(%rip), %rsi      # 0x174ba
movl $0x23, %edx
callq 0x3210
movq 0x6e2e(%rip), %rdi      # 0x1bfc8
leaq 0x233d(%rip), %rsi      # 0x174de
movl $0x20, %edx
callq 0x3210
movq 0x8(%r14), %rsi
leaq -0x68(%rbp), %rdi
callq 0xec70
movq -0x68(%rbp), %rsi
movq -0x60(%rbp), %rdx
movq 0x6e01(%rip), %rdi      # 0x1bfc8
callq 0x3210
movq %rax, %r15
leaq 0x2329(%rip), %rsi      # 0x174ff
movl $0x14, %edx
movq %rax, %rdi
callq 0x3210
leaq 0xec4(%rip), %rsi       # 0x160ae
movl $0x4, %edx
movq %r15, %rdi
callq 0x3210
movq -0x68(%rbp), %rdi
cmpq %r12, %rdi
je 0x15205
callq 0x31c0
movsd 0x1513(%rip), %xmm0     # 0x16720
callq 0x10b95
movq 0x8(%r14), %rdi
xorl %esi, %esi
callq 0xec9e
movl 0x20(%rbx), %ecx
leal 0x1(%rcx), %eax
movl %eax, 0x20(%rbx)
movb $0x1, %r15b
cmpl $0x0, 0x24(%rbx)
jne 0x152b7
movb 0x28(%rbx), %dl
movl 0x2c(%rbx), %esi
testl %esi, %esi
setne %dil
orb %dl, %dil
je 0x15256
testl %esi, %esi
jle 0x1527c
cmpl $0x3, %ecx
jg 0x1526e
movl $0xc, 0x30(%rbx)
jmp 0x152b4
cmpb $0x0, 0x18(%rbx)
je 0x15265
movl $0x4, 0x30(%rbx)
jmp 0x152b4
movl $0x3, 0x30(%rbx)
jmp 0x152b4
cmpl $0x5, %eax
jne 0x1527c
movl $0xd, 0x30(%rbx)
jmp 0x152b4
testb %dl, %dl
je 0x152a8
cmpl $0x1, %ecx
je 0x15292
testl %ecx, %ecx
jne 0x15298
movl $0x5, 0x30(%rbx)
jmp 0x152b4
cmpb $0x1, 0x18(%rbx)
je 0x1525c
decl %ecx
cmpl $0x2, %ecx
ja 0x152a8
movl $0xb, 0x30(%rbx)
jmp 0x152b4
cmpl $0x5, %eax
jne 0x152b7
movl $0xa, 0x30(%rbx)
xorl %r15d, %r15d
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x152c9
callq 0x31c0
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x152de
callq 0x31c0
movl %r15d, %eax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x15365
jmp 0x15365
movq %rax, %rbx
movq -0xa8(%rbp), %rdi
cmpq %r13, %rdi
je 0x15310
callq 0x31c0
jmp 0x15310
movq %rax, %rbx
movq -0xc8(%rbp), %rdi
cmpq %r15, %rdi
jne 0x15337
jmp 0x15368
movq %rax, %rbx
leaq -0x58(%rbp), %rax
jmp 0x15356
jmp 0x15360
jmp 0x1532b
movq %rax, %rbx
movq -0x68(%rbp), %rdi
cmpq %r12, %rdi
je 0x15368
callq 0x31c0
jmp 0x15368
movq %rax, %rbx
movq -0xe8(%rbp), %rdi
cmpq %r15, %rdi
jne 0x15375
jmp 0x1537a
movq %rax, %rbx
leaq -0x38(%rbp), %rax
movq -0x10(%rax), %rdi
jmp 0x15370
jmp 0x15360
jmp 0x15360
movq %rax, %rbx
jmp 0x1537a
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x1537a
callq 0x31c0
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x1538f
callq 0x31c0
movq %rbx, %rdi
callq 0x3320
nop