// File: /workspace/github_cpp_makefile_star2_O1/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 0x70e9(%rip), %rdx      # 0x1376c
leaq 0x18(%rsp), %rdi
movq %rdx, %rsi
callq 0x65a0
movq (%r13), %rax
movzbl (%rax), %esi
leal -0x30(%rsi), %ecx
movl $0x1, %r14d
cmpb $0x9, %cl
ja 0xc729
addl $-0x30, %esi
movb 0x1(%rax), %cl
leal -0x30(%rcx), %edi
movl $0x1, %edx
movl %esi, %r14d
cmpb $0x9, %dil
ja 0xc6df
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 0xc6c0
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 0xc729
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 0xc845
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 0x6510
leaq 0x40(%rbp), %rsi
movq %rbx, %r14
movq %rbx, %rdi
callq 0xd2b8
movq 0x50(%rsp), %rbx
subq 0x48(%rsp), %rbx
shrq $0x5, %rbx
testl %ebx, %ebx
jle 0xc7ff
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 0xcd7e
movq 0x8(%r13), %rdx
cmpq (%rax,%r12), %rdx
jne 0xc7f3
testq %rdx, %rdx
je 0xc7e1
movq -0x8(%rax,%r12), %rsi
movq (%r13), %rdi
callq 0x52d0
testl %eax, %eax
jne 0xc7f3
leaq 0x18(%rsp), %rdi
leaq 0x1b0(%rsp), %rsi
callq 0x5160
incq %r15
addq $0x20, %r12
cmpq %r15, %rbx
jne 0xc7a6
movq %r14, %rbx
movq %r14, %rdi
callq 0x64b4
movq 0x1b0(%rsp), %rdi
leaq 0x1c0(%rsp), %r14
cmpq %r14, %rdi
je 0xc82f
movq 0x1c0(%rsp), %rsi
incq %rsi
callq 0x52c0
movq %rbp, %rdi
callq 0x51d0
movq %rax, %rbp
cmpq 0x40(%rsp), %rax
jne 0xc756
leaq 0x6f20(%rip), %rsi      # 0x1376c
leaq 0x18(%rsp), %rdi
callq 0x50b0
testl %eax, %eax
je 0xcd50
leaq 0x6a68(%rip), %rsi      # 0x132cd
leaq 0x18(%rsp), %rdi
callq 0x50b0
testl %eax, %eax
je 0xc95e
leaq 0x6d0e(%rip), %rsi      # 0x1358c
leaq 0x18(%rsp), %rdi
callq 0x50b0
testl %eax, %eax
je 0xca6b
leaq 0x6a17(%rip), %rsi      # 0x132ae
leaq 0x18(%rsp), %rdi
callq 0x50b0
testl %eax, %eax
je 0xcb8e
leaq 0x6a15(%rip), %rsi      # 0x132c5
leaq 0x18(%rsp), %rdi
callq 0x50b0
testl %eax, %eax
je 0xcc7c
leaq 0x69c9(%rip), %rsi      # 0x13292
leaq 0x18(%rsp), %rdi
callq 0x50b0
testl %eax, %eax
je 0xcc05
leaq 0x69b5(%rip), %rsi      # 0x13297
leaq 0x18(%rsp), %rdi
callq 0x50b0
testl %eax, %eax
je 0xcc05
leaq 0x69c5(%rip), %rsi      # 0x132c0
leaq 0x18(%rsp), %rdi
callq 0x50b0
testl %eax, %eax
je 0xcc05
leaq 0x180(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
addq %rsi, %rdx
leaq 0x170(%rsp), %rdi
callq 0x6510
movq 0x10(%rsp), %rax
movl (%rax), %ecx
leaq 0x170(%rsp), %rsi
movq 0x8(%rsp), %rdi
movq 0x38(%rsp), %rdx
callq 0x9be8
movq 0x170(%rsp), %rdi
jmp 0xccd3
leaq 0x1c0(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq $0x0, -0x8(%rbx)
movb $0x0, (%rbx)
movq 0xe65c(%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 0x6510
leaq 0x140(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x1b0(%rsp), %rsi
movq 0x1b8(%rsp), %rdx
addq %rsi, %rdx
leaq 0x130(%rsp), %rdi
callq 0x6510
movq 0x10(%rsp), %rax
movl (%rax), %r8d
leaq 0x150(%rsp), %rsi
leaq 0x130(%rsp), %rdx
movq 0x8(%rsp), %rdi
movq 0x38(%rsp), %rcx
callq 0xa042
movq 0x130(%rsp), %rdi
cmpq %r15, %rdi
je 0xca1f
movq 0x140(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0x150(%rsp), %rdi
cmpq %r14, %rdi
je 0xca3c
movq 0x160(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0xe585(%rip), %rsi      # 0x1afc8
movq 0x8(%rsp), %rdi
callq 0x9518
movq 0x1b0(%rsp), %rdi
cmpq %rbx, %rdi
je 0xcd50
movq 0x1c0(%rsp), %rsi
jmp 0xcd48
leaq 0x58(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq $0x0, -0x8(%rbp)
movb $0x0, (%rbp)
movq 0xe551(%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 0xcd2c
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 0xccf6
movq %r14, 0x110(%rsp)
movq 0x70(%rsp), %rsi
movq 0x78(%rsp), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x6510
movq 0x68(%rsp), %rdi
movq %r13, %rsi
movq 0x8(%rsp), %rdx
movq 0x10(%rsp), %rcx
callq 0xc650
movq 0x110(%rsp), %rdi
cmpq %r14, %rdi
je 0xcb1e
movq 0x120(%rsp), %rsi
incq %rsi
callq 0x52c0
jmp 0xcb1e
leaq 0x100(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
addq %rsi, %rdx
leaq 0xf0(%rsp), %rdi
callq 0x6510
movq 0x10(%rsp), %rax
movl (%rax), %ecx
leaq 0xf0(%rsp), %rsi
movq 0x8(%rsp), %rdi
movq 0x38(%rsp), %rdx
callq 0x9be8
movq 0xf0(%rsp), %rdi
cmpq %r14, %rdi
je 0xcbef
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0xe3d2(%rip), %rsi      # 0x1afc8
movq 0x8(%rsp), %rdi
callq 0x9518
jmp 0xcd50
leaq 0xc0(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
addq %rsi, %rdx
leaq 0xb0(%rsp), %rdi
callq 0x6510
movq 0x10(%rsp), %rax
movl (%rax), %ecx
leaq 0xb0(%rsp), %rsi
movq 0x8(%rsp), %rdi
movq 0x38(%rsp), %rdx
callq 0x9be8
movq 0xb0(%rsp), %rdi
cmpq %r14, %rdi
je 0xcc66
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0xe35b(%rip), %rsi      # 0x1afc8
movq 0x8(%rsp), %rdi
callq 0x9518
jmp 0xcd50
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 0x6510
movq 0x10(%rsp), %rax
movl (%rax), %ecx
leaq 0x190(%rsp), %rsi
movq 0x8(%rsp), %rdi
movq 0x38(%rsp), %rdx
callq 0x9be8
movq 0x190(%rsp), %rdi
cmpq %rbx, %rdi
je 0xcce3
movq (%rbx), %rsi
incq %rsi
callq 0x52c0
movq 0xe2de(%rip), %rsi      # 0x1afc8
movq 0x8(%rsp), %rdi
callq 0x9518
jmp 0xcd50
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 0xcd2c
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x52c0
leaq 0x1b0(%rsp), %rdi
callq 0x5070
movq 0x48(%rsp), %rdi
cmpq %rbp, %rdi
je 0xcd50
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0xcd6c
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 0x63df(%rip), %rdi      # 0x13164
movq %r15, %rsi
xorl %eax, %eax
callq 0x53d0
movq %rax, %r12
movq 0x170(%rsp), %rdi
cmpq %rbx, %rdi
je 0xd1d2
movq 0x180(%rsp), %rsi
jmp 0xd1c5
movq %rax, %r12
movq 0x190(%rsp), %rdi
cmpq %rbx, %rdi
je 0xd1d2
movq 0x1a0(%rsp), %rsi
jmp 0xd1c5
movq %rdx, %rbx
movq %rax, %r12
movq 0xb0(%rsp), %rdi
cmpq %r14, %rdi
je 0xce2d
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x52c0
jmp 0xce2d
movq %rdx, %rbx
movq %rax, %r12
movq 0xf0(%rsp), %rdi
cmpq %r14, %rdi
je 0xcf27
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x52c0
jmp 0xcf27
jmp 0xd184
movq %rdx, %rbx
movq %rax, %r12
cmpl $0x2, %ebx
jne 0xce69
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 0xe16e(%rip), %rsi      # 0x1afc8
movq 0x8(%rsp), %rdi
callq 0x9518
jmp 0xd070
cmpl $0x1, %ebx
jne 0xd1d2
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 0x6510
movq 0x10(%rsp), %rax
movl (%rax), %ecx
leaq 0x90(%rsp), %rsi
movq 0x8(%rsp), %rdi
movq 0x38(%rsp), %rdx
callq 0x9be8
movq 0x90(%rsp), %rdi
cmpq %rbx, %rdi
je 0xd070
movq 0xa0(%rsp), %rsi
jmp 0xd068
movq %rax, %r12
movq 0x90(%rsp), %rdi
cmpq %rbx, %rdi
je 0xd0e6
movq 0xa0(%rsp), %rsi
jmp 0xd0de
jmp 0xd0bf
jmp 0xd0bf
jmp 0xcf14
movq %rax, %r12
jmp 0xd1b6
jmp 0xd1cf
movq %rdx, %rbx
movq %rax, %r12
cmpl $0x2, %ebx
jne 0xcf63
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 0xe074(%rip), %rsi      # 0x1afc8
movq 0x8(%rsp), %rdi
callq 0x9518
jmp 0xd070
cmpl $0x1, %ebx
jne 0xd1d2
movq %r12, %rdi
callq 0x5110
movq 0xe04d(%rip), %rdi      # 0x1afc8
leaq 0x662c(%rip), %rsi      # 0x135ae
movl $0x10, %edx
callq 0x5310
leaq 0x1c0(%rsp), %r13
movq %r13, -0x10(%r13)
movq $0x0, -0x8(%r13)
movb $0x0, (%r13)
movq 0xe02c(%rip), %rbx      # 0x1afd8
leaq 0x1b0(%rsp), %r14
leaq 0x6604(%rip), %r15      # 0x135bf
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5350
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0xd07a
movq %r14, %rdi
movq %r15, %rsi
callq 0x50b0
testl %eax, %eax
jne 0xcfbb
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 0x6510
movq 0x10(%rsp), %rax
movl (%rax), %ecx
leaq 0xd0(%rsp), %rsi
movq 0x8(%rsp), %rdi
movq 0x38(%rsp), %rdx
callq 0x9be8
movq 0xd0(%rsp), %rdi
cmpq %rbx, %rdi
je 0xd053
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0x1b0(%rsp), %rdi
cmpq %r13, %rdi
je 0xd070
movq 0x1c0(%rsp), %rsi
incq %rsi
callq 0x52c0
callq 0x5430
jmp 0xcd50
movl $0x4, %edi
callq 0x5140
movl $0x1, (%rax)
movq 0xdf07(%rip), %rsi      # 0x1af98
movq %rax, %rdi
xorl %edx, %edx
callq 0x5470
movq %rax, %r12
movq 0xd0(%rsp), %rdi
cmpq %rbx, %rdi
je 0xd0c9
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x52c0
jmp 0xd0c9
jmp 0xd0bf
movq %rax, %r12
jmp 0xd0e6
jmp 0xd0c6
movq %rax, %r12
movq 0x1b0(%rsp), %rdi
cmpq %r13, %rdi
je 0xd0e6
movq 0x1c0(%rsp), %rsi
incq %rsi
callq 0x52c0
callq 0x5430
jmp 0xd1d2
movq %rax, %r12
movq 0x130(%rsp), %rdi
cmpq %r15, %rdi
je 0xd115
movq 0x140(%rsp), %rsi
incq %rsi
callq 0x52c0
jmp 0xd115
movq %rax, %r12
movq 0x150(%rsp), %rdi
cmpq %r14, %rdi
je 0xd13f
movq 0x160(%rsp), %rsi
incq %rsi
callq 0x52c0
jmp 0xd13f
movq %rax, %r12
jmp 0xd21c
movq %rax, %r12
movq 0x1b0(%rsp), %rdi
cmpq %rbx, %rdi
je 0xd1d2
movq 0x1c0(%rsp), %rsi
jmp 0xd1c5
movq %rax, %r12
jmp 0xd233
movq %rax, %r12
movq 0x110(%rsp), %rdi
cmpq %r14, %rdi
je 0xd187
movq 0x120(%rsp), %rsi
incq %rsi
callq 0x52c0
jmp 0xd187
movq %rax, %r12
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0xd1a9
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x52c0
leaq 0x1b0(%rsp), %rdi
callq 0x5070
movq 0x48(%rsp), %rdi
cmpq %rbp, %rdi
je 0xd1d2
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x52c0
jmp 0xd1d2
movq %rax, %r12
leaq 0x28(%rsp), %rbx
jmp 0xd21c
movq %rax, %r12
leaq 0x28(%rsp), %rbx
jmp 0xd1f7
jmp 0xd1e5
movq %rax, %r12
leaq 0x28(%rsp), %rbx
leaq 0x48(%rsp), %rdi
callq 0x64b4
movq 0x1b0(%rsp), %rdi
leaq 0x1c0(%rsp), %rax
cmpq %rax, %rdi
je 0xd21c
movq 0x1c0(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0x18(%rsp), %rdi
cmpq %rbx, %rdi
je 0xd233
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x52c0
movq %r12, %rdi
callq 0x5480
nop