// File: /workspace/github_cpp_makefile_star2_O1/EstherJin[P]TetrisRemake/main.cc
// Function: main
int main(int argc, char *argv[]) {
  cin.exceptions(ios::eofbit|ios::failbit);
  bool textOnly = false;
  int startlvl = 0;
  string script1 = "sequence1.txt";
  string script2 = "sequence2.txt";
  unsigned int seed = 1;

  for (int i = 1; i < argc; ++i) {
    string argvv = argv[i];
    if (argvv == "-text"){
      textOnly = true;
    } else if (argvv == "-startlevel"){
      ++i;
      if (i < argc){
        startlvl = stoi(argv[i]);
        if (!((startlvl >= 0) && (startlvl <= 4))) {
          startlvl = 0;
        }
      }
    } else if (argvv == "-scriptfile1"){
      ++i;
      if (i < argc){
        script1 = argv[i];
      }
    } else if (argvv == "-scriptfile2"){
      ++i;
      if (i < argc){
        script2 = argv[i];
      }
    } else if (argvv == "-seed"){
      ++i;
      if (i < argc){
        int seedd = stoi(argv[i]);
        if (seedd >= 0) {
          seed = seedd;
        }
      }
    }
  }

  string cmd;
  Interpreter interpret;
  Game g{startlvl, textOnly, script1, script2, seed};
  g.print(cout);
  int turn = 1;

  try {
  while (true) {
    cin >> cmd;
	if (cin.eof()) break;
    string comm;
    interpret.processCommands(cmd, &g, &turn);
  }
  }
  catch (ios::failure &) {}
  catch (int i){}
  cout << "Thanks for playing!"<< endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1c8, %rsp            # imm = 0x1C8
movq %rsi, %r12
movl %edi, %r15d
movq 0x1559e(%rip), %rcx     # 0x1afd8
movq (%rcx), %rax
movq -0x18(%rax), %rax
leaq (%rcx,%rax), %rdi
movl $0x6, 0x1c(%rcx,%rax)
movl 0x20(%rcx,%rax), %esi
callq 0x5460
leaq 0xb8(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0xd59b(%rip), %rsi      # 0x13004
leaq 0xd5a1(%rip), %rdx      # 0x13011
leaq 0xa8(%rsp), %rdi
callq 0x65a0
leaq 0x98(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0xd582(%rip), %rsi      # 0x13012
leaq 0xd588(%rip), %rdx      # 0x1301f
leaq 0x88(%rsp), %rdi
callq 0x65a0
cmpl $0x2, %r15d
jl 0x5dea
movl $0x1, %r14d
leaq 0x158(%rsp), %rbx
leaq 0x148(%rsp), %r13
leaq 0x30(%rsp), %rbp
movq $0x0, 0x80(%rsp)
movq $0x0, 0x20(%rsp)
movl $0x1, 0xc(%rsp)
movq %r12, 0x10(%rsp)
movslq %r14d, %rax
movq (%r12,%rax,8), %rsi
movq %r13, %rdi
movq %rbp, %rdx
callq 0x6324
movq %r13, %rdi
leaq 0xd519(%rip), %rsi      # 0x13020
callq 0x50b0
testl %eax, %eax
je 0x5c3a
movq %r13, %rdi
leaq 0xd508(%rip), %rsi      # 0x13026
callq 0x50b0
testl %eax, %eax
je 0x5c49
movq %r13, %rdi
leaq 0xd4fd(%rip), %rsi      # 0x13032
callq 0x50b0
testl %eax, %eax
je 0x5d21
movq %r13, %rdi
leaq 0xd4f3(%rip), %rsi      # 0x1303f
callq 0x50b0
testl %eax, %eax
je 0x5d6d
movq %r13, %rdi
leaq 0xd4e9(%rip), %rsi      # 0x1304c
callq 0x50b0
testl %eax, %eax
jne 0x5db3
incl %r14d
cmpl %r15d, %r14d
jge 0x5db3
movslq %r14d, %rax
movq (%r12,%rax,8), %rsi
movq %rbp, %rdi
leaq 0xc8(%rsp), %rdx
callq 0x6324
movq 0x30(%rsp), %rbx
callq 0x5050
movq %rax, %rbp
movl (%rax), %eax
movl %eax, 0x1c(%rsp)
movl $0x0, (%rbp)
movq %rbx, %rdi
leaq 0x60(%rsp), %rsi
movl $0xa, %edx
callq 0x5390
cmpq %rbx, 0x60(%rsp)
je 0x5ff6
movq %rax, %r12
addq $-0x80000000, %rax      # imm = 0x80000000
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
cmpq %rcx, %rax
jb 0x5fea
movl (%rbp), %eax
cmpl $0x22, %eax
je 0x5fea
testl %eax, %eax
jne 0x5bfd
movl 0x1c(%rsp), %eax
movl %eax, (%rbp)
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x5c19
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x52c0
testl %r12d, %r12d
movl 0xc(%rsp), %eax
cmovnsl %r12d, %eax
movl %eax, 0xc(%rsp)
leaq 0x158(%rsp), %rbx
movq 0x10(%rsp), %r12
jmp 0x5d17
movb $0x1, %al
movq %rax, 0x80(%rsp)
jmp 0x5db3
incl %r14d
cmpl %r15d, %r14d
jge 0x5db3
movslq %r14d, %rax
movq (%r12,%rax,8), %rsi
movq %rbp, %rdi
leaq 0xc8(%rsp), %rdx
callq 0x6324
movq 0x30(%rsp), %r12
callq 0x5050
movq %rax, %rbp
movl (%rax), %ebx
movl $0x0, (%rax)
movq %r12, %rdi
leaq 0x60(%rsp), %rsi
movl $0xa, %edx
callq 0x5390
cmpq %r12, 0x60(%rsp)
je 0x5fde
leaq -0x80000000(%rax), %rcx
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
cmpq %rdx, %rcx
jb 0x5fd2
movl (%rbp), %ecx
cmpl $0x22, %ecx
je 0x5fd2
movl %r15d, %r13d
movq %rax, %r15
testl %ecx, %ecx
movq 0x10(%rsp), %r12
jne 0x5cd6
movl %ebx, (%rbp)
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x5cf2
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x52c0
cmpl $0x5, %r15d
movl $0x0, %eax
cmovael %eax, %r15d
movq %r15, 0x20(%rsp)
leaq 0x158(%rsp), %rbx
movl %r13d, %r15d
leaq 0x148(%rsp), %r13
leaq 0x30(%rsp), %rbp
jmp 0x5db3
incl %r14d
cmpl %r15d, %r14d
jge 0x5db3
movslq %r14d, %rax
movq 0x10(%rsp), %rcx
movq (%rcx,%rax,8), %r12
movq 0xb0(%rsp), %rbp
movq %r12, %rdi
callq 0x5120
leaq 0xa8(%rsp), %rdi
xorl %esi, %esi
movq %rbp, %rdx
leaq 0x30(%rsp), %rbp
movq %r12, %rcx
movq 0x10(%rsp), %r12
movq %rax, %r8
callq 0x5400
jmp 0x5db3
incl %r14d
cmpl %r15d, %r14d
jge 0x5db3
movslq %r14d, %rax
movq 0x10(%rsp), %rcx
movq (%rcx,%rax,8), %r12
movq 0x90(%rsp), %rbp
movq %r12, %rdi
callq 0x5120
leaq 0x88(%rsp), %rdi
xorl %esi, %esi
movq %rbp, %rdx
leaq 0x30(%rsp), %rbp
movq %r12, %rcx
movq 0x10(%rsp), %r12
movq %rax, %r8
callq 0x5400
movq 0x148(%rsp), %rdi
cmpq %rbx, %rdi
je 0x5dd0
movq 0x158(%rsp), %rsi
incq %rsi
callq 0x52c0
incl %r14d
cmpl %r15d, %r14d
jl 0x5aeb
movl 0xc(%rsp), %ebp
movq 0x80(%rsp), %r15
jmp 0x5dfb
movq $0x0, 0x20(%rsp)
movl $0x1, %ebp
xorl %r15d, %r15d
leaq 0x70(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x30(%rsp), %rdi
callq 0xaca8
leaq 0x138(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq 0xa8(%rsp), %rsi
movq 0xb0(%rsp), %rdx
addq %rsi, %rdx
leaq 0x128(%rsp), %rdi
callq 0x6510
leaq 0x118(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x88(%rsp), %rsi
movq 0x90(%rsp), %rdx
addq %rsi, %rdx
leaq 0x108(%rsp), %rdi
callq 0x6510
movzbl %r15b, %edx
andl $0x1, %edx
leaq 0x148(%rsp), %rdi
leaq 0x128(%rsp), %rcx
leaq 0x108(%rsp), %r8
movq 0x20(%rsp), %rsi
movl %ebp, %r9d
callq 0x90b8
movq 0x108(%rsp), %rdi
cmpq %r14, %rdi
je 0x5eba
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0x128(%rsp), %rdi
cmpq %rbx, %rdi
je 0x5ed7
movq 0x138(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0x150ea(%rip), %rsi     # 0x1afc8
leaq 0x148(%rsp), %rdi
callq 0x9518
leaq 0x2c(%rsp), %rax
movl $0x1, (%rax)
leaq 0xd8(%rsp), %rbx
leaq 0xf8(%rsp), %r14
leaq 0x60(%rsp), %r15
leaq 0xe8(%rsp), %r12
leaq 0x148(%rsp), %rbp
movq 0x150b6(%rip), %r13     # 0x1afd8
movq %r13, %rdi
movq %r15, %rsi
callq 0x5350
movq (%r13), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x20(%r13,%rax)
jne 0x6169
movq %rbx, 0xc8(%rsp)
movq $0x0, 0xd0(%rsp)
movb $0x0, 0xd8(%rsp)
movq %r14, 0xe8(%rsp)
movq 0x60(%rsp), %rsi
movq 0x68(%rsp), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x6510
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
movq %rbp, %rdx
leaq 0x2c(%rsp), %rcx
callq 0xc650
movq 0xe8(%rsp), %rdi
cmpq %r14, %rdi
je 0x5fac
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0xc8(%rsp), %rdi
cmpq %rbx, %rdi
je 0x5f1b
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x52c0
jmp 0x5f1b
leaq 0xd08d(%rip), %rdi      # 0x13066
callq 0x53b0
leaq 0xd081(%rip), %rdi      # 0x13066
callq 0x51a0
leaq 0xd075(%rip), %rdi      # 0x13066
callq 0x53b0
leaq 0xd069(%rip), %rdi      # 0x13066
callq 0x51a0
jmp 0x6092
movq %rax, %r15
cmpl $0x0, (%rbp)
jne 0x60a3
movl 0x1c(%rsp), %eax
movl %eax, (%rbp)
jmp 0x60a3
jmp 0x629b
movq %rax, %r15
movq 0x108(%rsp), %rdi
cmpq %r14, %rdi
je 0x604a
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x52c0
jmp 0x604a
movq %rax, %r15
movq 0x128(%rsp), %rdi
cmpq %rbx, %rdi
je 0x62ab
movq 0x138(%rsp), %rsi
incq %rsi
callq 0x52c0
jmp 0x62ab
movq %rax, %r15
jmp 0x62ab
movq %rax, %r15
jmp 0x62b5
movq %rax, %r15
jmp 0x62f6
movq %rax, %r15
jmp 0x631b
jmp 0x6092
movq %rax, %r15
jmp 0x60bf
movq %rax, %r15
cmpl $0x0, (%rbp)
jne 0x60a3
movl %ebx, (%rbp)
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x60bf
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0x148(%rsp), %rdi
leaq 0x158(%rsp), %rax
cmpq %rax, %rdi
je 0x62d1
movq 0x158(%rsp), %rsi
jmp 0x62c9
movq %rax, %r15
jmp 0x62d1
movq %rdx, %r12
movq %rax, %r15
jmp 0x6118
movq %rdx, %r12
movq %rax, %r15
movq 0xe8(%rsp), %rdi
cmpq %r14, %rdi
je 0x6118
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0xc8(%rsp), %rdi
cmpq %rbx, %rdi
je 0x613d
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x52c0
jmp 0x613d
movq %rdx, %r12
movq %rax, %r15
cmpl $0x2, %r12d
jne 0x6152
movq %r15, %rdi
callq 0x5110
callq 0x5430
jmp 0x6169
cmpl $0x1, %r12d
jne 0x629e
movq %r15, %rdi
callq 0x5110
callq 0x5430
movq 0x14e58(%rip), %rbx     # 0x1afc8
leaq 0xcedb(%rip), %rsi      # 0x13052
movl $0x13, %edx
movq %rbx, %rdi
callq 0x5310
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x5280
movsbl %al, %esi
movq 0x14e26(%rip), %rdi     # 0x1afc8
callq 0x5030
movq %rax, %rdi
callq 0x51c0
movq 0x1b8(%rsp), %rdi
testq %rdi, %rdi
je 0x61c1
callq 0x63c0
movq 0x1a8(%rsp), %rdi
testq %rdi, %rdi
je 0x61d3
callq 0x63c0
leaq 0x188(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x61f4
movq 0x188(%rsp), %rsi
incq %rsi
callq 0x52c0
leaq 0x168(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6215
movq 0x168(%rsp), %rsi
incq %rsi
callq 0x52c0
leaq 0x30(%rsp), %rdi
callq 0x6430
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x623b
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0x6260
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0xa8(%rsp), %rdi
leaq 0xb8(%rsp), %rax
cmpq %rax, %rdi
je 0x6285
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x52c0
xorl %eax, %eax
addq $0x1c8, %rsp            # imm = 0x1C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x629b
movq %rax, %r15
leaq 0x148(%rsp), %rdi
callq 0x6362
leaq 0x30(%rsp), %rdi
callq 0x6430
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x62d1
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0x62f6
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x52c0
movq 0xa8(%rsp), %rdi
leaq 0xb8(%rsp), %rax
cmpq %rax, %rdi
je 0x631b
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x52c0
movq %r15, %rdi
callq 0x5480
nop