// File: 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
movq %rsp, %rbp
subq $0x380, %rsp            # imm = 0x380
movq %rsi, -0x330(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x328(%rbp)
testb $0x1, 0x6c(%rax)
je 0x6fd0
jmp 0x7426
movq -0x330(%rbp), %rdx
leaq 0x15429(%rip), %rsi     # 0x1c407
leaq -0x50(%rbp), %rdi
movq %rdi, -0x338(%rbp)
callq 0x8970
movq -0x338(%rbp), %rsi
leaq 0x152ab(%rip), %rdx     # 0x1c2a7
leaq -0x30(%rbp), %rdi
callq 0x8440
jmp 0x7007
leaq -0x50(%rbp), %rdi
callq 0x3200
leaq -0x81(%rbp), %rdi
movq %rdi, -0x340(%rbp)
callq 0x3520
movq -0x340(%rbp), %rdx
leaq 0x15397(%rip), %rsi     # 0x1c3c8
leaq -0x80(%rbp), %rdi
callq 0x3b80
jmp 0x703c
leaq -0x81(%rbp), %rdi
callq 0x3350
leaq -0xa9(%rbp), %rdi
movq %rdi, -0x348(%rbp)
callq 0x3520
movq -0x348(%rbp), %rdx
leaq 0x1535f(%rip), %rsi     # 0x1c3c8
leaq -0xa8(%rbp), %rdi
callq 0x3b80
jmp 0x7077
leaq -0xa9(%rbp), %rdi
callq 0x3350
leaq -0x2b8(%rbp), %rdi
leaq -0x30(%rbp), %rsi
movl $0x8, %edx
callq 0x34b0
jmp 0x709a
jmp 0x709c
leaq -0x2b8(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x30b0
movq %rax, -0x350(%rbp)
jmp 0x70b5
movq -0x350(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x33d0
movb %al, -0x351(%rbp)
jmp 0x70d3
movb -0x351(%rbp), %al
testb $0x1, %al
jne 0x70e2
jmp 0x7397
leaq 0x15323(%rip), %rsi     # 0x1c40c
leaq -0x80(%rbp), %rdi
callq 0x8a80
movb %al, -0x352(%rbp)
jmp 0x70fa
movb -0x352(%rbp), %al
testb $0x1, %al
jne 0x7109
jmp 0x723f
movq 0x1feb0(%rip), %rdi     # 0x26fc0
leaq -0xa8(%rbp), %rsi
callq 0x32b0
movq %rax, -0x360(%rbp)
jmp 0x7125
movq -0x360(%rbp), %rdi
movq 0x1fe75(%rip), %rsi     # 0x26fa8
callq 0x3330
jmp 0x713a
movq -0x328(%rbp), %rdi
callq 0x6870
jmp 0x7148
movq -0x328(%rbp), %rdi
addq $0x70, %rdi
leaq 0x15246(%rip), %rsi     # 0x1c3a0
callq 0x8a80
movb %al, -0x361(%rbp)
jmp 0x7167
movb -0x361(%rbp), %al
testb $0x1, %al
jne 0x7176
jmp 0x71fb
movl $0x1, -0x2bc(%rbp)
jmp 0x73fc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x3200
jmp 0x7459
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x81(%rbp), %rdi
callq 0x3350
jmp 0x7450
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0xa9(%rbp), %rdi
callq 0x3350
jmp 0x7447
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x743b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x742f
leaq 0x151c6(%rip), %rsi     # 0x1c3c8
leaq -0xa8(%rbp), %rdi
callq 0x3400
jmp 0x7210
movq -0x328(%rbp), %rax
testb $0x1, 0x6c(%rax)
je 0x723a
leaq -0x2b8(%rbp), %rdi
callq 0x30c0
jmp 0x722b
movl $0x1, -0x2bc(%rbp)
jmp 0x73fc
jmp 0x7392
leaq -0x2e0(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x3170
jmp 0x7251
movq -0x328(%rbp), %rdi
leaq -0x2e0(%rbp), %rsi
callq 0x6ef0
movb %al, -0x362(%rbp)
jmp 0x726c
leaq -0x2e0(%rbp), %rdi
callq 0x3200
movb -0x362(%rbp), %al
testb $0x1, %al
jne 0x7287
jmp 0x7337
leaq -0x300(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x3170
jmp 0x7299
movq -0x328(%rbp), %rdi
leaq -0x300(%rbp), %rsi
leaq -0xa8(%rbp), %rdx
callq 0x6bf0
jmp 0x72b5
leaq -0x300(%rbp), %rdi
callq 0x3200
movq -0x328(%rbp), %rdi
addq $0x70, %rdi
leaq 0x150cd(%rip), %rsi     # 0x1c3a0
callq 0x8a80
movb %al, -0x363(%rbp)
jmp 0x72e0
movb -0x363(%rbp), %al
testb $0x1, %al
jne 0x72ec
jmp 0x7335
movl $0x1, -0x2bc(%rbp)
jmp 0x73fc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x2e0(%rbp), %rdi
callq 0x3200
jmp 0x742f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x300(%rbp), %rdi
callq 0x3200
jmp 0x742f
jmp 0x7390
leaq 0x15089(%rip), %rsi     # 0x1c3c7
leaq -0x320(%rbp), %rdi
leaq -0x80(%rbp), %rdx
callq 0x8970
jmp 0x7350
leaq -0xa8(%rbp), %rdi
leaq -0x320(%rbp), %rsi
callq 0x33e0
jmp 0x7365
leaq -0x320(%rbp), %rdi
callq 0x3200
jmp 0x7390
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x320(%rbp), %rdi
callq 0x3200
jmp 0x742f
jmp 0x7392
jmp 0x709c
leaq -0x2b8(%rbp), %rdi
callq 0x30c0
jmp 0x73a5
movq 0x1fc14(%rip), %rdi     # 0x26fc0
leaq -0xa8(%rbp), %rsi
callq 0x32b0
movq %rax, -0x370(%rbp)
jmp 0x73c1
movq -0x370(%rbp), %rdi
movq 0x1fbd9(%rip), %rsi     # 0x26fa8
callq 0x3330
movq %rax, -0x378(%rbp)
jmp 0x73dd
movq -0x378(%rbp), %rdi
movq 0x1fbbd(%rip), %rsi     # 0x26fa8
callq 0x3330
jmp 0x73f2
movl $0x0, -0x2bc(%rbp)
leaq -0x2b8(%rbp), %rdi
callq 0x30f0
leaq -0xa8(%rbp), %rdi
callq 0x3200
leaq -0x80(%rbp), %rdi
callq 0x3200
leaq -0x30(%rbp), %rdi
callq 0x3200
addq $0x380, %rsp            # imm = 0x380
popq %rbp
retq
leaq -0x2b8(%rbp), %rdi
callq 0x30f0
leaq -0xa8(%rbp), %rdi
callq 0x3200
leaq -0x80(%rbp), %rdi
callq 0x3200
leaq -0x30(%rbp), %rdi
callq 0x3200
movq -0x58(%rbp), %rdi
callq 0x3510
nopw %cs:(%rax,%rax)