// File: /workspace/github_cpp_makefile_star2_O3/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 0xddb8(%rip), %rsi      # 0x1c8f0
movq %rbx, %rdi
callq 0xf03a
movq 0x50(%r14), %rdi
movq 0x58(%r14), %rsi
leaq 0x8(%r14), %rdx
callq 0xdd48
movq %rbx, %rdi
movq %rax, %rsi
callq 0xdae2
movq 0xd465(%rip), %r15      # 0x1bfc8
leaq 0x78ae(%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 0x751d(%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)
leaq -0x2a0(%rbp), %r15
leaq -0x2b0(%rbp), %rdi
jne 0xec15
movq %r15, (%rdi)
movq 0x8(%r14), %rsi
movq 0x10(%r14), %rdx
addq %rsi, %rdx
callq 0xd7ca
leaq 0x7818(%rip), %rsi      # 0x1641f
leaq -0x2b0(%rbp), %rdi
callq 0x3370
jmp 0xec3b
movq %r15, (%rdi)
movq 0x8(%r14), %rsi
movq 0x10(%r14), %rdx
addq %rsi, %rdx
callq 0xd7ca
leaq 0x7d5b(%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 0xec5b
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 0xd317(%rip), %rdi      # 0x1bfc8
leaq 0x7774(%rip), %rsi      # 0x1642c
movl $0x5, %edx
callq 0x3210
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq 0xd2f7(%rip), %rdi      # 0x1bfc8
callq 0x3210
movq %rax, %r15
leaq 0x73ce(%rip), %rsi      # 0x160ae
movl $0x4, %edx
movq %rax, %rdi
callq 0x3210
leaq 0x7c50(%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 0x7c06(%rip), %r13      # 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 0xee47
movl $0x1, %r15d
xorl %r12d, %r12d
cmpq $0x80, %r12
je 0xedeb
movq 0xd229(%rip), %rdi      # 0x1bfc8
movl %r15d, %esi
callq 0x3310
movq %rax, %r14
movl $0xc, %edx
movq %rax, %rdi
leaq 0x7679(%rip), %rsi      # 0x16432
callq 0x3210
movq (%rbx), %rax
movq (%rax,%r12), %rsi
movq 0x8(%rax,%r12), %rdx
movq %r14, %rdi
callq 0x3210
addq $0x20, %r12
incl %r15d
movl $0x1, %edx
movq %rax, %rdi
movq %r13, %rsi
callq 0x3210
jmp 0xed8f
movq 0xd1d6(%rip), %rdi      # 0x1bfc8
movl $0x5, %esi
callq 0x3310
movq %rax, %r15
movl $0x8, %edx
movq %rax, %rdi
leaq 0x74f5(%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 0xf6ef
movl %eax, %r15d
jmp 0xed79
cmpl $0x5, %r15d
je 0xef5c
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 0xee51
movq 0xd13d(%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 0xd111(%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 0xd7ca
leaq -0x78(%rbp), %rax
movq %rax, -0x88(%rbp)
leaq -0x88(%rbp), %r12
movq %r12, %rdi
leaq 0x752e(%rip), %rsi      # 0x1642c
leaq 0x752c(%rip), %rdx      # 0x16431
callq 0xe56e
xorps %xmm0, %xmm0
leaq -0xa8(%rbp), %rdi
movq %r12, %rsi
callq 0x109ae
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0xef31
callq 0x31c0
movq -0xa8(%rbp), %rdi
cmpq %r14, %rdi
je 0xef42
callq 0x31c0
movsd 0x74c6(%rip), %xmm0     # 0x16410
callq 0x10960
movq %r15, %rdi
callq 0x3040
jmp 0xed3e
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0xef6e
callq 0x31c0
leaq -0x2b0(%rbp), %rdi
callq 0x3050
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0xef8c
callq 0x31c0
addq $0x288, %rsp            # imm = 0x288
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xefa2
jmp 0xefba
movq %rax, %rbx
movq -0x2b0(%rbp), %rdi
cmpq %r15, %rdi
je 0xf01f
callq 0x31c0
jmp 0xf01f
jmp 0xefba
movq %rax, %rbx
jmp 0xf01f
jmp 0xeffe
movq %rax, %rbx
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0xefde
callq 0x31c0
jmp 0xefde
movq %rax, %rbx
movq -0xa8(%rbp), %rdi
leaq -0x98(%rbp), %rax
cmpq %rax, %rdi
je 0xf001
callq 0x31c0
jmp 0xf001
jmp 0xeffe
jmp 0xeffe
jmp 0xeffe
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0xf013
callq 0x31c0
leaq -0x2b0(%rbp), %rdi
callq 0x3050
leaq -0x58(%rbp), %rax
movq -0x68(%rbp), %rdi
cmpq %rax, %rdi
je 0xf031
callq 0x31c0
movq %rbx, %rdi
callq 0x3320
nop