// File: /workspace/github_cpp_makefile_star2_O3/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 0x27eb(%rip), %rsi      # 0x1742e
leaq 0x2802(%rip), %rdx      # 0x1744c
leaq -0x88(%rbp), %rdi
callq 0xe56e
movq 0x8(%r14), %rsi
leaq -0x48(%rbp), %rdi
callq 0xeac0
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 0x14c89
callq 0x31c0
leaq 0x27bd(%rip), %rsi      # 0x1744d
leaq -0x88(%rbp), %rdi
callq 0x3370
movq 0x7325(%rip), %rdi      # 0x1bfc8
leaq 0x1d19(%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 0xd7ca
leaq -0xe8(%rbp), %rdi
callq 0xf629
movl %eax, %r12d
movq -0xe8(%rbp), %rdi
cmpq %r15, %rdi
je 0x14cf9
callq 0x31c0
movq 0x72c8(%rip), %r13      # 0x1bfc8
leaq 0x13a7(%rip), %rsi      # 0x160ae
movl $0x4, %edx
movq %r13, %rdi
callq 0x3210
movb $0x1, %r15b
cmpb $0x4e, %r12b
je 0x15083
movq (%r13), %rax
addq -0x18(%rax), %r13
movq %r13, %rdi
movl $0xa, %esi
callq 0x31d0
movsbl %al, %esi
movq 0x7288(%rip), %rdi      # 0x1bfc8
callq 0x3030
movq %rax, %rdi
callq 0x3140
movq 0x8(%r14), %rsi
leaq -0x68(%rbp), %rdi
callq 0xeac0
leaq -0x38(%rbp), %r15
leaq 0x26f1(%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 0x14d8e
movq %rdx, -0x48(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x38(%rbp)
jmp 0x14d95
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 0x14dbf
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 0xd7ca
leaq -0x98(%rbp), %r13
movq %r13, -0x10(%r13)
leaq 0x12a0(%rip), %rsi      # 0x16093
leaq 0x129e(%rip), %rdx      # 0x16098
leaq -0xa8(%rbp), %rdi
callq 0xe56e
leaq -0xc8(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
xorps %xmm0, %xmm0
callq 0x106b8
movq -0xa8(%rbp), %rdi
cmpq %r13, %rdi
je 0x14e2d
callq 0x31c0
movq -0xc8(%rbp), %rdi
cmpq %r15, %rdi
je 0x14e3e
callq 0x31c0
movsd 0x18da(%rip), %xmm0     # 0x16720
callq 0x10960
movq 0x8(%r14), %rdi
callq 0xeb0c
testb %al, %al
je 0x14f18
movq 0x8(%r14), %rdi
xorl %esi, %esi
callq 0xeb02
decl 0x24(%rbx)
movq 0x7157(%rip), %rdi      # 0x1bfc8
leaq 0x121b(%rip), %rsi      # 0x16093
movl $0x5, %edx
callq 0x3210
movq 0x713f(%rip), %r15      # 0x1bfc8
leaq 0x25d0(%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 0x710d(%rip), %rdi      # 0x1bfc8
callq 0x3030
movq %rax, %rdi
callq 0x3140
movq %rax, %r15
movq 0x8(%r14), %rsi
leaq -0x68(%rbp), %rdi
callq 0xeac0
movq -0x68(%rbp), %rsi
movq -0x60(%rbp), %rdx
movq %r15, %rdi
callq 0x3210
movq %rax, %r15
leaq 0x2596(%rip), %rsi      # 0x17488
movl $0x31, %edx
movq %rax, %rdi
callq 0x3210
leaq 0x11a8(%rip), %rsi      # 0x160ae
movl $0x4, %edx
movq %r15, %rdi
callq 0x3210
jmp 0x14faf
incl 0x2c(%rbx)
movq 0x70a6(%rip), %rdi      # 0x1bfc8
leaq 0x116a(%rip), %rsi      # 0x16093
movl $0x5, %edx
callq 0x3210
movq 0x708e(%rip), %rdi      # 0x1bfc8
leaq 0x2579(%rip), %rsi      # 0x174ba
movl $0x23, %edx
callq 0x3210
movq 0x7076(%rip), %rdi      # 0x1bfc8
leaq 0x2585(%rip), %rsi      # 0x174de
movl $0x20, %edx
callq 0x3210
movq 0x8(%r14), %rsi
leaq -0x68(%rbp), %rdi
callq 0xeac0
movq -0x68(%rbp), %rsi
movq -0x60(%rbp), %rdx
movq 0x7049(%rip), %rdi      # 0x1bfc8
callq 0x3210
movq %rax, %r15
leaq 0x2571(%rip), %rsi      # 0x174ff
movl $0x14, %edx
movq %rax, %rdi
callq 0x3210
leaq 0x110c(%rip), %rsi      # 0x160ae
movl $0x4, %edx
movq %r15, %rdi
callq 0x3210
movq -0x68(%rbp), %rdi
cmpq %r12, %rdi
je 0x14fbd
callq 0x31c0
movsd 0x175b(%rip), %xmm0     # 0x16720
callq 0x10960
movq 0x8(%r14), %rdi
xorl %esi, %esi
callq 0xeaee
movl 0x20(%rbx), %ecx
leal 0x1(%rcx), %eax
movl %eax, 0x20(%rbx)
movb $0x1, %r15b
cmpl $0x0, 0x24(%rbx)
jne 0x15071
movb 0x28(%rbx), %dl
movl 0x2c(%rbx), %esi
testl %esi, %esi
setne %dil
orb %dl, %dil
je 0x1500e
testl %esi, %esi
jle 0x15034
cmpl $0x3, %ecx
jg 0x15026
movl $0xc, 0x30(%rbx)
jmp 0x1506e
cmpb $0x0, 0x18(%rbx)
je 0x1501d
movl $0x4, 0x30(%rbx)
jmp 0x1506e
movl $0x3, 0x30(%rbx)
jmp 0x1506e
cmpl $0x5, %eax
jne 0x15034
movl $0xd, 0x30(%rbx)
jmp 0x1506e
testb %dl, %dl
je 0x15062
cmpl $0x1, %ecx
je 0x1504a
testl %ecx, %ecx
jne 0x15052
movl $0x5, 0x30(%rbx)
jmp 0x1506e
cmpb $0x1, 0x18(%rbx)
je 0x15014
jmp 0x15059
decl %ecx
cmpl $0x2, %ecx
ja 0x15062
movl $0xb, 0x30(%rbx)
jmp 0x1506e
cmpl $0x5, %eax
jne 0x15071
movl $0xa, 0x30(%rbx)
xorl %r15d, %r15d
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x15083
callq 0x31c0
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x15098
callq 0x31c0
movl %r15d, %eax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1511f
jmp 0x1511f
movq %rax, %rbx
movq -0xa8(%rbp), %rdi
cmpq %r13, %rdi
je 0x150ca
callq 0x31c0
jmp 0x150ca
movq %rax, %rbx
movq -0xc8(%rbp), %rdi
cmpq %r15, %rdi
jne 0x150f1
jmp 0x15122
movq %rax, %rbx
leaq -0x58(%rbp), %rax
jmp 0x15110
jmp 0x1511a
jmp 0x150e5
movq %rax, %rbx
movq -0x68(%rbp), %rdi
cmpq %r12, %rdi
je 0x15122
callq 0x31c0
jmp 0x15122
movq %rax, %rbx
movq -0xe8(%rbp), %rdi
cmpq %r15, %rdi
jne 0x1512f
jmp 0x15134
movq %rax, %rbx
leaq -0x38(%rbp), %rax
movq -0x10(%rax), %rdi
jmp 0x1512a
jmp 0x1511a
jmp 0x1511a
movq %rax, %rbx
jmp 0x15134
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x15134
callq 0x31c0
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x15149
callq 0x31c0
movq %rbx, %rdi
callq 0x3320
nop