// File: /workspace/github_cpp_makefile_star2_O3/dmonaldo[P]simple-network-file-system/Shell.cpp
// Function: Shell::run_script(char*)
void Shell::run_script(char *file_name)
{
  // make sure that the file system is mounted
  if (!is_mounted)
  	return;
  // open script file
  ifstream infile;
  infile.open(file_name);
  if (infile.fail()) {
    cerr << "Could not open script file" << endl;
    return;
  }


  // execute each line in the script
  bool user_quit = false;
  string command_str;
  getline(infile, command_str, '\n');
  while (!infile.eof() && !user_quit) {
    cout << PROMPT_STRING << command_str << endl;
    user_quit = execute_command(command_str);
    getline(infile, command_str);
  }

  // clean up
  unmountNFS();
  infile.close();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x248, %rsp            # imm = 0x248
cmpb $0x1, 0x4(%rdi)
jne 0x8280
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x40(%rsp), %r15
movq %r15, %rdi
callq 0x3300
movq %r15, %rdi
movq %r14, %rsi
movl $0x8, %edx
callq 0x31c0
movq 0x40(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x60(%rsp,%rax)
je 0x812d
movq 0x4f07(%rip), %rbx      # 0xcff0
leaq 0x2486(%rip), %rsi      # 0xa576
movl $0x1a, %edx
movq %rbx, %rdi
callq 0x3310
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x3280
movsbl %al, %esi
movq 0x4ed5(%rip), %rdi      # 0xcff0
callq 0x3040
movq %rax, %rdi
callq 0x31e0
jmp 0x8276
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x40(%rsp), %r14
movq %rsp, %rsi
movq %r14, %rdi
movl $0xa, %edx
callq 0x3470
leaq 0x30(%rsp), %r15
xorl %ebp, %ebp
leaq 0x20(%rsp), %r12
movq %rsp, %r13
testb $0x1, %bpl
jne 0x8240
movq 0x40(%rsp), %rax
movq -0x18(%rax), %rax
movl 0x60(%rsp,%rax), %eax
andl $0x2, %eax
jne 0x8240
movq 0x50f4(%rip), %rsi      # 0xd280
movq 0x50f5(%rip), %rdx      # 0xd288
movq 0x4e2e(%rip), %rdi      # 0xcfc8
callq 0x3310
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %rax, %rdi
callq 0x3310
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x3280
movsbl %al, %esi
movq %rbp, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31e0
movq %r15, 0x20(%rsp)
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x5ce8
movq %rbx, %rdi
movq %r12, %rsi
callq 0x7a3c
movl %eax, %ebp
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x8217
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x32c0
movq 0x40(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3280
movsbl %al, %edx
movq %r14, %rdi
movq %r13, %rsi
callq 0x3470
jmp 0x8165
cmpb $0x1, 0x4(%rbx)
jne 0x8251
movl (%rbx), %edi
callq 0x34a0
movb $0x0, 0x4(%rbx)
leaq 0x40(%rsp), %rdi
callq 0x3090
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x8276
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x32c0
leaq 0x40(%rsp), %rdi
callq 0x30b0
addq $0x248, %rsp            # imm = 0x248
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x82b5
movq %rax, %rbx
jmp 0x82d3
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x82b8
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x32c0
jmp 0x82b8
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x82d3
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x32c0
leaq 0x40(%rsp), %rdi
callq 0x30b0
movq %rbx, %rdi
callq 0x3440
nop