// File: /workspace/github_cpp_makefile_star2_O1/dnegovan[P]Intruder-On-Donnar-V/CrewMember.cpp
// Function: CrewMember::talk()
void CrewMember::talk()
{
    //create otherCrew vector by removing this name from copy of full crew list
    otherCrew = crewList;
    auto iterator = std::find(otherCrew.begin(), otherCrew.end(), name);
    otherCrew.erase(iterator);

    int input = 0;

    std::cout << NARRATOR_COLOR "\n" << fullTitle << RESET << std::endl;

    //if the occupant is infected, use special dialogue (different txt file)
    std::string fileName;
    if (infected)
    {
        //use infected dialogue options
        fileName = name + "Infected.txt";
    }
    else
    {
        //use regular dialogue options
        fileName = name + ".txt";
    }

    //open dialogue file
    std::ifstream stream(fileName, std::ios::in);

    //diaplay greeting (1st line of file)
    std::string dialogue;
    getline(stream, dialogue);
    std::cout << DIALOGUE_COLOR << dialogue << RESET << "\n" << std::endl;
    stream.close();

    while (true)
    {
        //need to skip the first line, already showed it above
        stream.open(fileName);
        getline(stream, dialogue);

        //menu for asking about other crewmembers
        while (input < 1 || input > ALL_CREW)
        {
            for (int i = 0; i < (ALL_CREW - 1); i++)
            {
                std::cout << i + 1 << ". Ask about " << otherCrew[i] << "\n";
            }

            std::cout << ALL_CREW << ". Return" << std::endl;

            input = getInteger();
        }

        if (input == ALL_CREW)
        {
            //on the menu, 1 more than all other crew will be the cancel option
            return;
        }

        //get and then overwrite any lines between greeting and user's choice
        //repeats until desired option
        for (int i = 0; i < input; i++)
        {
            getline(stream, dialogue);
        }

        std::cout << std::endl;
        printString(dialogue, DIALOGUE_COLOR, 0);
        wait(MED);

        //reset for next loop
        input = 0;
        stream.close();
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x288, %rsp            # imm = 0x288
movq %rdi, %r14
leaq 0x50(%rdi), %rbx
leaq 0xdc08(%rip), %rsi      # 0x1c8f0
movq %rbx, %rdi
callq 0xf1fe
movq 0x50(%r14), %rdi
movq 0x58(%r14), %rsi
leaq 0x8(%r14), %rdx
callq 0xdf4a
movq %rbx, %rdi
movq %rax, %rsi
callq 0xdcb6
movq 0xd2b5(%rip), %r15      # 0x1bfc8
leaq 0x76fe(%rip), %rsi      # 0x16418
movl $0x6, %edx
movq %r15, %rdi
callq 0x3210
movq 0x28(%r14), %rsi
movq 0x30(%r14), %rdx
movq %r15, %rdi
callq 0x3210
movq %rax, %r15
leaq 0x736d(%rip), %rsi      # 0x160ae
movl $0x4, %edx
movq %rax, %rdi
callq 0x3210
movq (%r15), %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
leaq -0x58(%rbp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
cmpb $0x1, 0x49(%r14)
jne 0xedc6
leaq -0x2a0(%rbp), %r15
movq %r15, -0x10(%r15)
movq 0x8(%r14), %rsi
movq 0x10(%r14), %rdx
addq %rsi, %rdx
leaq -0x2b0(%rbp), %rdi
callq 0xd9b2
leaq 0x7667(%rip), %rsi      # 0x1641f
leaq -0x2b0(%rbp), %rdi
callq 0x3370
jmp 0xedfb
leaq -0x2a0(%rbp), %r15
movq %r15, -0x10(%r15)
movq 0x8(%r14), %rsi
movq 0x10(%r14), %rdx
addq %rsi, %rdx
leaq -0x2b0(%rbp), %rdi
callq 0xd9b2
leaq 0x7b9b(%rip), %rsi      # 0x1698a
leaq -0x2b0(%rbp), %rdi
callq 0x3370
leaq -0x68(%rbp), %rdi
leaq -0x2b0(%rbp), %r14
movq %r14, %rsi
callq 0x3230
movq (%r14), %rdi
cmpq %r15, %rdi
je 0xee1b
callq 0x31c0
leaq -0x68(%rbp), %rsi
movq %r14, %rdi
movl $0x8, %edx
callq 0x32e0
leaq -0x38(%rbp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq -0x2b0(%rbp), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x31d0
movsbl %al, %edx
leaq -0x2b0(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x3350
movq 0xd157(%rip), %rdi      # 0x1bfc8
leaq 0x75b4(%rip), %rsi      # 0x1642c
movl $0x5, %edx
callq 0x3210
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq 0xd137(%rip), %rdi      # 0x1bfc8
callq 0x3210
movq %rax, %r15
leaq 0x720e(%rip), %rsi      # 0x160ae
movl $0x4, %edx
movq %rax, %rdi
callq 0x3210
leaq 0x7a90(%rip), %rsi      # 0x16944
movl $0x1, %edx
movq %r15, %rdi
callq 0x3210
movq (%r15), %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
leaq -0x2b0(%rbp), %r15
movq %r15, %rdi
callq 0x3040
leaq 0x7a46(%rip), %r12      # 0x16944
movq %r15, %rdi
leaq -0x68(%rbp), %rsi
movl $0x8, %edx
callq 0x31a0
movq -0x2b0(%rbp), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x31d0
movsbl %al, %edx
movq %r15, %rdi
leaq -0x48(%rbp), %rsi
callq 0x3350
xorl %r15d, %r15d
leal -0x6(%r15), %eax
cmpl $-0x6, %eax
ja 0xf007
movl $0x1, %r15d
xorl %r13d, %r13d
cmpq $0x80, %r13
je 0xefab
movq 0xd069(%rip), %rdi      # 0x1bfc8
movl %r15d, %esi
callq 0x3310
movq %rax, %r14
movl $0xc, %edx
movq %rax, %rdi
leaq 0x74b9(%rip), %rsi      # 0x16432
callq 0x3210
movq (%rbx), %rax
movq (%rax,%r13), %rsi
movq 0x8(%rax,%r13), %rdx
movq %r14, %rdi
callq 0x3210
addq $0x20, %r13
incl %r15d
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x3210
jmp 0xef4f
movq 0xd016(%rip), %rdi      # 0x1bfc8
movl $0x5, %esi
callq 0x3310
movq %rax, %r15
movl $0x8, %edx
movq %rax, %rdi
leaq 0x7335(%rip), %rsi      # 0x16303
callq 0x3210
movq (%r15), %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
callq 0xf8fa
movl %eax, %r15d
jmp 0xef39
cmpl $0x5, %r15d
je 0xf121
testl %r15d, %r15d
jle 0xf049
movq -0x2b0(%rbp), %rax
movq -0x18(%rax), %rdi
leaq -0x2b0(%rbp), %r14
addq %r14, %rdi
movl $0xa, %esi
callq 0x31d0
movsbl %al, %edx
movq %r14, %rdi
leaq -0x48(%rbp), %rsi
callq 0x3350
decl %r15d
jne 0xf016
movq 0xcf78(%rip), %rcx      # 0x1bfc8
movq (%rcx), %rax
movq -0x18(%rax), %rdi
addq %rcx, %rdi
movl $0xa, %esi
callq 0x31d0
leaq -0x98(%rbp), %r14
leaq -0x2b0(%rbp), %r15
movsbl %al, %esi
movq 0xcf4c(%rip), %rdi      # 0x1bfc8
callq 0x3030
movq %rax, %rdi
callq 0x3140
movq %r14, -0xa8(%rbp)
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
addq %rsi, %rdx
leaq -0xa8(%rbp), %rdi
callq 0xd9b2
leaq -0x78(%rbp), %rax
movq %rax, -0x88(%rbp)
leaq -0x88(%rbp), %r13
movq %r13, %rdi
leaq 0x7369(%rip), %rsi      # 0x1642c
leaq 0x7367(%rip), %rdx      # 0x16431
callq 0xe724
xorps %xmm0, %xmm0
leaq -0xa8(%rbp), %rdi
movq %r13, %rsi
callq 0x10be3
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0xf0f6
callq 0x31c0
movq -0xa8(%rbp), %rdi
cmpq %r14, %rdi
je 0xf107
callq 0x31c0
movsd 0x7301(%rip), %xmm0     # 0x16410
callq 0x10b95
movq %r15, %rdi
callq 0x3040
jmp 0xeefe
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0xf133
callq 0x31c0
leaq -0x2b0(%rbp), %rdi
callq 0x3050
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0xf151
callq 0x31c0
addq $0x288, %rsp            # imm = 0x288
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xf167
jmp 0xf17f
movq %rax, %rbx
movq -0x2b0(%rbp), %rdi
cmpq %r15, %rdi
je 0xf1e4
callq 0x31c0
jmp 0xf1e4
jmp 0xf17f
movq %rax, %rbx
jmp 0xf1e4
jmp 0xf1c3
movq %rax, %rbx
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0xf1a3
callq 0x31c0
jmp 0xf1a3
movq %rax, %rbx
movq -0xa8(%rbp), %rdi
leaq -0x98(%rbp), %rax
cmpq %rax, %rdi
je 0xf1c6
callq 0x31c0
jmp 0xf1c6
jmp 0xf1c3
jmp 0xf1c3
jmp 0xf1c3
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0xf1d8
callq 0x31c0
leaq -0x2b0(%rbp), %rdi
callq 0x3050
leaq -0x58(%rbp), %rax
movq -0x68(%rbp), %rdi
cmpq %rax, %rdi
je 0xf1f6
callq 0x31c0
movq %rbx, %rdi
callq 0x3320