// File: /workspace/github_cpp_makefile_star2_O2/sagardoshi[P]NegotiationsEncounter/src/GameMaster.cpp
// Function: GameMaster::loadScript(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void GameMaster::loadScript(string filename) {
    if (doSkip) return; // Skip all text until encounter

    string filepath = "txt/" + filename + ".txt";
    string line = "", output = "";

	ifstream in(filepath);

	while (getline(in, line)) {
        if (line == "***") {
            cout << output << endl;
            checkpoint();
            if (uInput == "quit") return; // For every new entry, check for quit
            output = "";

            // Handle "skip" typed within a script file
            if (doSkip) {
                in.close();
                return;
            }
        } else if (isAsteriskEntry(line)) {
            handleSpecificInput(line, output);
            if (uInput == "quit") return; // For every new entry, check for quit
        } else output += "\n" + line;
    }

    in.close();

    cout << output << endl << endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2c8, %rsp            # imm = 0x2C8
cmpb $0x0, 0x6c(%rdi)
jne 0x534d
movq %rsi, %rdx
movq %rdi, %rbx
leaq 0x72c1(%rip), %rsi      # 0xc3f7
leaq 0xc0(%rsp), %r14
movq %r14, %rdi
callq 0x5c1a
leaq 0x714a(%rip), %rdx      # 0xc297
leaq 0x40(%rsp), %rdi
movq %r14, %rsi
callq 0x5a9a
leaq 0xc0(%rsp), %rdi
callq 0x3130
leaq 0x724a(%rip), %rsi      # 0xc3b8
leaq 0x20(%rsp), %rdi
leaq 0xc0(%rsp), %rdx
callq 0x3860
leaq 0x7231(%rip), %rsi      # 0xc3b8
movq %rsp, %rdi
leaq 0xc0(%rsp), %rdx
callq 0x3860
leaq 0xc0(%rsp), %rdi
leaq 0x40(%rsp), %rsi
pushq $0x8
popq %rdx
callq 0x3340
leaq 0x70(%rbx), %r14
leaq 0xc0(%rsp), %r15
leaq 0x20(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x3080
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x52e9
movq %r12, %rdi
leaq 0x7218(%rip), %rsi      # 0xc3fc
callq 0x5c90
testb %al, %al
je 0x523d
movq 0xddd4(%rip), %rdi      # 0x12fc8
movq %rsp, %rsi
callq 0x3200
movq %rax, %rdi
callq 0x3150
movq %rbx, %rdi
callq 0x4d78
movq %r14, %rdi
leaq 0x717a(%rip), %rsi      # 0xc390
callq 0x5c90
testb %al, %al
jne 0x5324
movq %rsp, %rdi
leaq 0x718b(%rip), %rsi      # 0xc3b8
callq 0x33c0
cmpb $0x1, 0x6c(%rbx)
jne 0x51bd
jmp 0x5317
leaq 0xa0(%rsp), %rdi
movq %r12, %rsi
callq 0x32b0
movq %r15, %rbp
leaq 0xa0(%rsp), %r13
movq %r13, %rsi
callq 0x50da
movl %eax, %r15d
movq %r13, %rdi
callq 0x3130
testb %r15b, %r15b
je 0x52b4
leaq 0x60(%rsp), %rdi
movq %r12, %rsi
callq 0x32b0
movq %rbp, %r15
movq %rbx, %rdi
leaq 0x60(%rsp), %rbp
movq %rbp, %rsi
movq %rsp, %rdx
callq 0x4f0e
movq %rbp, %rdi
callq 0x3130
movq %r14, %rdi
leaq 0x70eb(%rip), %rsi      # 0xc390
callq 0x5c90
testb %al, %al
je 0x51bd
jmp 0x5324
leaq 0x80(%rsp), %r13
movq %r13, %rdi
leaq 0x70f1(%rip), %rsi      # 0xc3b7
movq %r12, %rdx
callq 0x5c1a
movq %rsp, %rdi
movq %r13, %rsi
callq 0x33d0
movq %rbp, %r15
movq %r13, %rdi
callq 0x3130
jmp 0x51bd
leaq 0xc0(%rsp), %rdi
callq 0x3090
movq 0xdccb(%rip), %rdi      # 0x12fc8
movq %rsp, %rsi
callq 0x3200
movq %rax, %rdi
callq 0x3150
movq %rax, %rdi
callq 0x3150
jmp 0x5324
leaq 0xc0(%rsp), %rdi
callq 0x3090
leaq 0xc0(%rsp), %rdi
callq 0x30c0
movq %rsp, %rdi
callq 0x3130
leaq 0x20(%rsp), %rdi
callq 0x3130
leaq 0x40(%rsp), %rdi
callq 0x3130
addq $0x2c8, %rsp            # imm = 0x2C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x53ab
movq %rax, %rbx
jmp 0x53b3
movq %rax, %rbx
jmp 0x53bd
movq %rax, %rbx
leaq 0xc0(%rsp), %rdi
jmp 0x53c2
jmp 0x539b
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
jmp 0x5392
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x3130
jmp 0x539e
jmp 0x539b
movq %rax, %rbx
leaq 0xc0(%rsp), %rdi
callq 0x30c0
movq %rsp, %rdi
callq 0x3130
leaq 0x20(%rsp), %rdi
callq 0x3130
leaq 0x40(%rsp), %rdi
callq 0x3130
movq %rbx, %rdi
callq 0x3380
nop