// File: /workspace/github_cpp_makefile_star2_O3/EstherJin[P]TetrisRemake/interpreter.cc
// Function: Interpreter::processCommands(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, Game*, int*)
void Interpreter::processCommands(string cmd, Game *g, int *turn){
  string command = "";
  int n = 1;
  if ((cmd[0] >= '0') && (cmd[0] <= '9')) {
    int i = 1;
    n = cmd[0] - '0';
    while ((cmd[i] >= '0') && (cmd[i] <= '9')){
      n = n * 10 + (cmd[i] - '0');
      ++i;
    }
    cmd = cmd.substr(i);
  }
  map<string, vector<string>>::iterator it;
  for(it = commands.begin(); it != commands.end(); it++) {
    string key = it->first;
    vector<string> commands = it->second;
    int size = commands.size();
    for(int i = 0; i < size; ++i){
      if (cmd == commands.at(i)){
        command = key;
      }
    }
  }
  if (command != ""){
    if (command == "norandom"){
      string file;
      cin >> file;
      g->processCommand(command, file, n, *turn);
      g->print(cout);
    } else if (command == "sequence"){
      string file;
      cin >> file;
      ifstream f{file};
      if (f){
        string comm;
        streambuf *cinbuf = cin.rdbuf();
        cin.rdbuf(f.rdbuf());
        while(f >> comm){
          processCommands(comm, g, turn);
        }
        cin.rdbuf(cinbuf);
      }
    } else if (command == "drop") {
      try{
      g->processCommand(command, n, *turn);
      g->print(cout);
      } catch(int i){
        *turn = (*turn % 2) + 1;
        g->print(cout);
      } catch(char const* str){
        cout << "Restart? Yes/No:";
        string s;
        while (cin >> s){
          if (s == "Yes"){
            *turn = 1;
            g->processCommand(command, n, *turn);
            return;
          }
        }
        throw 1;
      }
    } else if (command == "restart") {
      *turn = 1;
      g->processCommand(command, n, *turn);
      g->print(cout);
    } else if ((command == "left")||(command == "right")||(command == "down")) {
      try{
      g->processCommand(command, n, *turn);
      g->print(cout);
      } catch(int i){
        *turn = (*turn % 2) + 1;
        g->print(cout);
      } catch(char const* str){
        *turn = 1;
        g->processCommand(command, n, *turn);
      } catch(char const* str){
        cout << "Restart? Yes/No:";
        string s;
        while (cin >> s){
          if (s == "Yes"){
            *turn = 1;
            g->processCommand(command, n, *turn);
            return;
          }
        }
        throw 1;
      }
    } else {
      g->processCommand(command, n, *turn);
      g->print(cout);
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3b8, %rsp            # imm = 0x3B8
movq %rcx, 0x10(%rsp)
movq %rdx, 0x8(%rsp)
movq %rsi, %r13
movq %rdi, 0x68(%rsp)
leaq 0x28(%rsp), %rbx
movq %rbx, -0x10(%rbx)
leaq 0x728d(%rip), %rdx      # 0x137b4
leaq 0x18(%rsp), %rdi
movq %rdx, %rsi
callq 0x65c6
movq (%r13), %rax
movzbl (%rax), %esi
leal -0x30(%rsi), %ecx
movl $0x1, %r14d
cmpb $0x9, %cl
ja 0xc5cd
addl $-0x30, %esi
movb 0x1(%rax), %cl
leal -0x30(%rcx), %edi
movl $0x1, %edx
movl %esi, %r14d
cmpb $0x9, %dil
ja 0xc583
leal (%r14,%r14,4), %esi
movzbl %cl, %ecx
leal (%rcx,%rsi,2), %r14d
addl $-0x30, %r14d
movb 0x1(%rax,%rdx), %cl
incq %rdx
leal -0x30(%rcx), %esi
cmpb $0xa, %sil
jb 0xc564
leaq 0x1b0(%rsp), %rdi
movq %r13, %rsi
movq $-0x1, %rcx
callq 0x52e0
leaq 0x1b0(%rsp), %rbx
movq %r13, %rdi
movq %rbx, %rsi
callq 0x5340
movq (%rbx), %rdi
leaq 0x1c0(%rsp), %rax
cmpq %rax, %rdi
je 0xc5cd
movq 0x1c0(%rsp), %rsi
incq %rsi
callq 0x52c0
movq %r14, 0x38(%rsp)
movq 0x68(%rsp), %rax
movq 0x18(%rax), %rbp
addq $0x8, %rax
movq %rax, 0x40(%rsp)
cmpq %rax, %rbp
je 0xc6e9
leaq 0x1c0(%rsp), %r14
leaq 0x48(%rsp), %rbx
movq %r14, 0x1b0(%rsp)
movq 0x20(%rbp), %rsi
movq 0x28(%rbp), %rdx
addq %rsi, %rdx
leaq 0x1b0(%rsp), %rdi
callq 0x6530
leaq 0x40(%rbp), %rsi
movq %rbx, %r14
movq %rbx, %rdi
callq 0xd15c
movq 0x50(%rsp), %rbx
subq 0x48(%rsp), %rbx
shrq $0x5, %rbx
testl %ebx, %ebx
jle 0xc6a3
andl $0x7fffffff, %ebx       # imm = 0x7FFFFFFF
movl $0x8, %r12d
xorl %r15d, %r15d
movq 0x48(%rsp), %rax
movq 0x50(%rsp), %rdx
subq %rax, %rdx
sarq $0x5, %rdx
cmpq %r15, %rdx
jbe 0xcc22
movq 0x8(%r13), %rdx
cmpq (%rax,%r12), %rdx
jne 0xc697
testq %rdx, %rdx
je 0xc685
movq -0x8(%rax,%r12), %rsi
movq (%r13), %rdi
callq 0x52d0
testl %eax, %eax
jne 0xc697
leaq 0x18(%rsp), %rdi
leaq 0x1b0(%rsp), %rsi
callq 0x5160
incq %r15
addq $0x20, %r12
cmpq %r15, %rbx
jne 0xc64a
movq %r14, %rbx
movq %r14, %rdi
callq 0x64d2
movq 0x1b0(%rsp), %rdi
leaq 0x1c0(%rsp), %r14
cmpq %r14, %rdi
je 0xc6d3
movq 0x1c0(%rsp), %rsi
incq %rsi
callq 0x52c0
movq %rbp, %rdi
callq 0x51d0
movq %rax, %rbp
cmpq 0x40(%rsp), %rax
jne 0xc5fa
leaq 0x70c4(%rip), %rsi      # 0x137b4
leaq 0x18(%rsp), %rdi
callq 0x50b0
testl %eax, %eax
je 0xcbf4
leaq 0x6bc4(%rip), %rsi      # 0x132cd
leaq 0x18(%rsp), %rdi
callq 0x50b0
testl %eax, %eax
je 0xc802
leaq 0x6e8b(%rip), %rsi      # 0x135ad
leaq 0x18(%rsp), %rdi
callq 0x50b0
testl %eax, %eax
je 0xc90f
leaq 0x6b73(%rip), %rsi      # 0x132ae
leaq 0x18(%rsp), %rdi
callq 0x50b0
testl %eax, %eax
je 0xca32
leaq 0x6b71(%rip), %rsi      # 0x132c5
leaq 0x18(%rsp), %rdi
callq 0x50b0
testl %eax, %eax
je 0xcb20
leaq 0x6b25(%rip), %rsi      # 0x13292
leaq 0x18(%rsp), %rdi
callq 0x50b0
testl %eax, %eax
je 0xcaa9
leaq 0x6b11(%rip), %rsi      # 0x13297
leaq 0x18(%rsp), %rdi
callq 0x50b0
testl %eax, %eax
je 0xcaa9
leaq 0x6b21(%rip), %rsi      # 0x132c0
leaq 0x18(%rsp), %rdi
callq 0x50b0
testl %eax, %eax
je 0xcaa9
leaq 0x180(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
addq %rsi, %rdx
leaq 0x170(%rsp), %rdi
callq 0x6530
movq 0x10(%rsp), %rax
movl (%rax), %ecx
leaq 0x170(%rsp), %rsi
movq 0x8(%rsp), %rdi
movq 0x38(%rsp), %rdx
callq 0x9c9a
movq 0x170(%rsp), %rdi
jmp 0xcb77
leaq 0x1c0(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq $0x0, -0x8(%rbx)
movb $0x0, (%rbx)
movq 0xe7b8(%rip), %rdi      # 0x1afd8
leaq 0x1b0(%rsp), %rsi
callq 0x5350
leaq 0x160(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
addq %rsi, %rdx
leaq 0x150(%rsp), %rdi
callq 0x6530
leaq 0x140(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x1b0(%rsp), %rsi
movq 0x1b8(%rsp), %rdx
addq %rsi, %rdx
leaq 0x130(%rsp), %rdi
callq 0x6530
movq 0x10(%rsp), %rax
movl (%rax), %r8d
leaq 0x150(%rsp), %rsi
leaq 0x130(%rsp), %rdx
movq 0x8(%rsp), %rdi
movq 0x38(%rsp), %rcx
callq 0xa0f8
movq 0x130(%rsp), %rdi
cmpq %r15, %rdi
je 0xc8c3
movq 0x140(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0x150(%rsp), %rdi
cmpq %r14, %rdi
je 0xc8e0
movq 0x160(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0xe6e1(%rip), %rsi      # 0x1afc8
movq 0x8(%rsp), %rdi
callq 0x95ca
movq 0x1b0(%rsp), %rdi
cmpq %rbx, %rdi
je 0xcbf4
movq 0x1c0(%rsp), %rsi
jmp 0xcbec
leaq 0x58(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq $0x0, -0x8(%rbp)
movb $0x0, (%rbp)
movq 0xe6ad(%rip), %rbx      # 0x1afd8
leaq 0x48(%rsp), %rsi
movq %rbx, %rdi
callq 0x5350
leaq 0x1b0(%rsp), %rdi
leaq 0x48(%rsp), %rsi
movl $0x8, %edx
callq 0x5410
movq 0x1b0(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x1d0(%rsp,%rax)
jne 0xcbd0
leaq 0x80(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq (%rbx), %rax
movq -0x18(%rax), %rax
leaq (%rbx,%rax), %rdi
movq 0xe8(%rbx,%rax), %rax
movq %rax, 0x40(%rsp)
leaq 0x1c0(%rsp), %rsi
callq 0x54b0
leaq 0x120(%rsp), %r14
leaq 0x1b0(%rsp), %r15
leaq 0x70(%rsp), %r12
leaq 0x110(%rsp), %r13
movq %r15, %rdi
movq %r12, %rsi
callq 0x5350
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0xcb9a
movq %r14, 0x110(%rsp)
movq 0x70(%rsp), %rsi
movq 0x78(%rsp), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x6530
movq 0x68(%rsp), %rdi
movq %r13, %rsi
movq 0x8(%rsp), %rdx
movq 0x10(%rsp), %rcx
callq 0xc4f4
movq 0x110(%rsp), %rdi
cmpq %r14, %rdi
je 0xc9c2
movq 0x120(%rsp), %rsi
incq %rsi
callq 0x52c0
jmp 0xc9c2
leaq 0x100(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
addq %rsi, %rdx
leaq 0xf0(%rsp), %rdi
callq 0x6530
movq 0x10(%rsp), %rax
movl (%rax), %ecx
leaq 0xf0(%rsp), %rsi
movq 0x8(%rsp), %rdi
movq 0x38(%rsp), %rdx
callq 0x9c9a
movq 0xf0(%rsp), %rdi
cmpq %r14, %rdi
je 0xca93
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0xe52e(%rip), %rsi      # 0x1afc8
movq 0x8(%rsp), %rdi
callq 0x95ca
jmp 0xcbf4
leaq 0xc0(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
addq %rsi, %rdx
leaq 0xb0(%rsp), %rdi
callq 0x6530
movq 0x10(%rsp), %rax
movl (%rax), %ecx
leaq 0xb0(%rsp), %rsi
movq 0x8(%rsp), %rdi
movq 0x38(%rsp), %rdx
callq 0x9c9a
movq 0xb0(%rsp), %rdi
cmpq %r14, %rdi
je 0xcb0a
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0xe4b7(%rip), %rsi      # 0x1afc8
movq 0x8(%rsp), %rdi
callq 0x95ca
jmp 0xcbf4
movq 0x10(%rsp), %rax
movl $0x1, (%rax)
leaq 0x1a0(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
addq %rsi, %rdx
leaq 0x190(%rsp), %rdi
callq 0x6530
movq 0x10(%rsp), %rax
movl (%rax), %ecx
leaq 0x190(%rsp), %rsi
movq 0x8(%rsp), %rdi
movq 0x38(%rsp), %rdx
callq 0x9c9a
movq 0x190(%rsp), %rdi
cmpq %rbx, %rdi
je 0xcb87
movq (%rbx), %rsi
incq %rsi
callq 0x52c0
movq 0xe43a(%rip), %rsi      # 0x1afc8
movq 0x8(%rsp), %rdi
callq 0x95ca
jmp 0xcbf4
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movq 0x40(%rsp), %rsi
callq 0x54b0
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0xcbd0
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x52c0
leaq 0x1b0(%rsp), %rdi
callq 0x5070
movq 0x48(%rsp), %rdi
cmpq %rbp, %rdi
je 0xcbf4
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0xcc10
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x52c0
addq $0x3b8, %rsp            # imm = 0x3B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x653b(%rip), %rdi      # 0x13164
movq %r15, %rsi
xorl %eax, %eax
callq 0x53d0
movq %rax, %r12
movq 0x170(%rsp), %rdi
cmpq %rbx, %rdi
je 0xd076
movq 0x180(%rsp), %rsi
jmp 0xd069
movq %rax, %r12
movq 0x190(%rsp), %rdi
cmpq %rbx, %rdi
je 0xd076
movq 0x1a0(%rsp), %rsi
jmp 0xd069
movq %rdx, %rbx
movq %rax, %r12
movq 0xb0(%rsp), %rdi
cmpq %r14, %rdi
je 0xccd1
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x52c0
jmp 0xccd1
movq %rdx, %rbx
movq %rax, %r12
movq 0xf0(%rsp), %rdi
cmpq %r14, %rdi
je 0xcdcb
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x52c0
jmp 0xcdcb
jmp 0xd028
movq %rdx, %rbx
movq %rax, %r12
cmpl $0x2, %ebx
jne 0xcd0d
movq %r12, %rdi
callq 0x5110
movq 0x10(%rsp), %rdx
movl (%rdx), %eax
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
andl $-0x2, %ecx
negl %ecx
addl %ecx, %eax
incl %eax
movl %eax, (%rdx)
movq 0xe2ca(%rip), %rsi      # 0x1afc8
movq 0x8(%rsp), %rdi
callq 0x95ca
jmp 0xcf14
cmpl $0x1, %ebx
jne 0xd076
movq %r12, %rdi
callq 0x5110
movq 0x10(%rsp), %rax
movl $0x1, (%rax)
leaq 0xa0(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
addq %rsi, %rdx
leaq 0x90(%rsp), %rdi
callq 0x6530
movq 0x10(%rsp), %rax
movl (%rax), %ecx
leaq 0x90(%rsp), %rsi
movq 0x8(%rsp), %rdi
movq 0x38(%rsp), %rdx
callq 0x9c9a
movq 0x90(%rsp), %rdi
cmpq %rbx, %rdi
je 0xcf14
movq 0xa0(%rsp), %rsi
jmp 0xcf0c
movq %rax, %r12
movq 0x90(%rsp), %rdi
cmpq %rbx, %rdi
je 0xcf8a
movq 0xa0(%rsp), %rsi
jmp 0xcf82
jmp 0xcf63
jmp 0xcf63
jmp 0xcdb8
movq %rax, %r12
jmp 0xd05a
jmp 0xd073
movq %rdx, %rbx
movq %rax, %r12
cmpl $0x2, %ebx
jne 0xce07
movq %r12, %rdi
callq 0x5110
movq 0x10(%rsp), %rdx
movl (%rdx), %eax
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
andl $-0x2, %ecx
negl %ecx
addl %ecx, %eax
incl %eax
movl %eax, (%rdx)
movq 0xe1d0(%rip), %rsi      # 0x1afc8
movq 0x8(%rsp), %rdi
callq 0x95ca
jmp 0xcf14
cmpl $0x1, %ebx
jne 0xd076
movq %r12, %rdi
callq 0x5110
movq 0xe1a9(%rip), %rdi      # 0x1afc8
leaq 0x67a9(%rip), %rsi      # 0x135cf
movl $0x10, %edx
callq 0x5310
leaq 0x1c0(%rsp), %r13
movq %r13, -0x10(%r13)
movq $0x0, -0x8(%r13)
movb $0x0, (%r13)
movq 0xe188(%rip), %rbx      # 0x1afd8
leaq 0x1b0(%rsp), %r14
leaq 0x6781(%rip), %r15      # 0x135e0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5350
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0xcf1e
movq %r14, %rdi
movq %r15, %rsi
callq 0x50b0
testl %eax, %eax
jne 0xce5f
movq 0x10(%rsp), %rax
movl $0x1, (%rax)
leaq 0xe0(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
addq %rsi, %rdx
leaq 0xd0(%rsp), %rdi
callq 0x6530
movq 0x10(%rsp), %rax
movl (%rax), %ecx
leaq 0xd0(%rsp), %rsi
movq 0x8(%rsp), %rdi
movq 0x38(%rsp), %rdx
callq 0x9c9a
movq 0xd0(%rsp), %rdi
cmpq %rbx, %rdi
je 0xcef7
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0x1b0(%rsp), %rdi
cmpq %r13, %rdi
je 0xcf14
movq 0x1c0(%rsp), %rsi
incq %rsi
callq 0x52c0
callq 0x5430
jmp 0xcbf4
movl $0x4, %edi
callq 0x5140
movl $0x1, (%rax)
movq 0xe063(%rip), %rsi      # 0x1af98
movq %rax, %rdi
xorl %edx, %edx
callq 0x5470
movq %rax, %r12
movq 0xd0(%rsp), %rdi
cmpq %rbx, %rdi
je 0xcf6d
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x52c0
jmp 0xcf6d
jmp 0xcf63
movq %rax, %r12
jmp 0xcf8a
jmp 0xcf6a
movq %rax, %r12
movq 0x1b0(%rsp), %rdi
cmpq %r13, %rdi
je 0xcf8a
movq 0x1c0(%rsp), %rsi
incq %rsi
callq 0x52c0
callq 0x5430
jmp 0xd076
movq %rax, %r12
movq 0x130(%rsp), %rdi
cmpq %r15, %rdi
je 0xcfb9
movq 0x140(%rsp), %rsi
incq %rsi
callq 0x52c0
jmp 0xcfb9
movq %rax, %r12
movq 0x150(%rsp), %rdi
cmpq %r14, %rdi
je 0xcfe3
movq 0x160(%rsp), %rsi
incq %rsi
callq 0x52c0
jmp 0xcfe3
movq %rax, %r12
jmp 0xd0c0
movq %rax, %r12
movq 0x1b0(%rsp), %rdi
cmpq %rbx, %rdi
je 0xd076
movq 0x1c0(%rsp), %rsi
jmp 0xd069
movq %rax, %r12
jmp 0xd0d7
movq %rax, %r12
movq 0x110(%rsp), %rdi
cmpq %r14, %rdi
je 0xd02b
movq 0x120(%rsp), %rsi
incq %rsi
callq 0x52c0
jmp 0xd02b
movq %rax, %r12
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0xd04d
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x52c0
leaq 0x1b0(%rsp), %rdi
callq 0x5070
movq 0x48(%rsp), %rdi
cmpq %rbp, %rdi
je 0xd076
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x52c0
jmp 0xd076
movq %rax, %r12
leaq 0x28(%rsp), %rbx
jmp 0xd0c0
movq %rax, %r12
leaq 0x28(%rsp), %rbx
jmp 0xd09b
jmp 0xd089
movq %rax, %r12
leaq 0x28(%rsp), %rbx
leaq 0x48(%rsp), %rdi
callq 0x64d2
movq 0x1b0(%rsp), %rdi
leaq 0x1c0(%rsp), %rax
cmpq %rax, %rdi
je 0xd0c0
movq 0x1c0(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0x18(%rsp), %rdi
cmpq %rbx, %rdi
je 0xd0d7
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x52c0
movq %r12, %rdi
callq 0x5480
nop