// File: 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
movq %rsp, %rbp
subq $0x2e0, %rsp            # imm = 0x2E0
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq 0x3b408(%rip), %rax     # 0x41fd8
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
addq %rcx, %rax
movq %rax, -0x270(%rbp)
movl $0x2, %edi
movl $0x4, %esi
callq 0x7390
movq -0x270(%rbp), %rdi
movl %eax, %esi
callq 0x60f0
movb $0x0, -0x11(%rbp)
movl $0x0, -0x18(%rbp)
leaq -0x39(%rbp), %rdi
movq %rdi, -0x268(%rbp)
callq 0x65d0
movq -0x268(%rbp), %rdx
leaq 0x263dd(%rip), %rsi     # 0x2d004
leaq -0x38(%rbp), %rdi
callq 0x73b0
jmp 0x6c32
leaq -0x39(%rbp), %rdi
callq 0x63e0
leaq -0x71(%rbp), %rdi
movq %rdi, -0x278(%rbp)
callq 0x65d0
movq -0x278(%rbp), %rdx
leaq 0x263b9(%rip), %rsi     # 0x2d012
leaq -0x70(%rbp), %rdi
callq 0x73b0
jmp 0x6c64
leaq -0x71(%rbp), %rdi
callq 0x63e0
movl $0x1, -0x78(%rbp)
movl $0x1, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x7066
movq -0x10(%rbp), %rax
movslq -0x7c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x288(%rbp)
leaq -0xa1(%rbp), %rdi
movq %rdi, -0x280(%rbp)
callq 0x65d0
movq -0x288(%rbp), %rsi
movq -0x280(%rbp), %rdx
leaq -0xa0(%rbp), %rdi
callq 0x73b0
jmp 0x6cc9
leaq -0xa1(%rbp), %rdi
callq 0x63e0
leaq 0x26344(%rip), %rsi     # 0x2d020
leaq -0xa0(%rbp), %rdi
callq 0x7460
movb %al, -0x289(%rbp)
jmp 0x6cf0
movb -0x289(%rbp), %al
testb $0x1, %al
jne 0x6cfc
jmp 0x6d67
movb $0x1, -0x11(%rbp)
jmp 0x703b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x39(%rbp), %rdi
callq 0x63e0
jmp 0x737d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x71(%rbp), %rdi
callq 0x63e0
jmp 0x7374
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xa1(%rbp), %rdi
callq 0x63e0
jmp 0x736b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x7055
leaq 0x262b8(%rip), %rsi     # 0x2d026
leaq -0xa0(%rbp), %rdi
callq 0x7460
movb %al, -0x28a(%rbp)
jmp 0x6d82
movb -0x28a(%rbp), %al
testb $0x1, %al
jne 0x6d91
jmp 0x6e79
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x6e74
movq -0x10(%rbp), %rax
movslq -0x7c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x2a0(%rbp)
leaq -0xc9(%rbp), %rdi
movq %rdi, -0x298(%rbp)
callq 0x65d0
movq -0x2a0(%rbp), %rsi
movq -0x298(%rbp), %rdx
leaq -0xc8(%rbp), %rdi
callq 0x73b0
jmp 0x6de8
xorl %eax, %eax
movl %eax, %esi
leaq -0xc8(%rbp), %rdi
movl $0xa, %edx
callq 0x7490
movl %eax, -0x2a4(%rbp)
jmp 0x6e05
movl -0x2a4(%rbp), %eax
movl %eax, -0x18(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x6230
leaq -0xc9(%rbp), %rdi
callq 0x63e0
cmpl $0x0, -0x18(%rbp)
jl 0x6e32
cmpl $0x4, -0x18(%rbp)
jle 0x6e72
movl $0x0, -0x18(%rbp)
jmp 0x6e72
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x6e61
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x6230
leaq -0xc9(%rbp), %rdi
callq 0x63e0
jmp 0x7055
jmp 0x6e74
jmp 0x7039
leaq 0x261b2(%rip), %rsi     # 0x2d032
leaq -0xa0(%rbp), %rdi
callq 0x7460
movb %al, -0x2a5(%rbp)
jmp 0x6e94
movb -0x2a5(%rbp), %al
testb $0x1, %al
jne 0x6ea0
jmp 0x6ecf
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x6eca
movq -0x10(%rbp), %rax
movslq -0x7c(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq -0x38(%rbp), %rdi
callq 0x64a0
jmp 0x6ec8
jmp 0x6eca
jmp 0x7037
leaq 0x26169(%rip), %rsi     # 0x2d03f
leaq -0xa0(%rbp), %rdi
callq 0x7460
movb %al, -0x2a6(%rbp)
jmp 0x6eea
movb -0x2a6(%rbp), %al
testb $0x1, %al
jne 0x6ef6
jmp 0x6f25
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x6f20
movq -0x10(%rbp), %rax
movslq -0x7c(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq -0x70(%rbp), %rdi
callq 0x64a0
jmp 0x6f1e
jmp 0x6f20
jmp 0x7035
leaq 0x26120(%rip), %rsi     # 0x2d04c
leaq -0xa0(%rbp), %rdi
callq 0x7460
movb %al, -0x2a7(%rbp)
jmp 0x6f40
movb -0x2a7(%rbp), %al
testb $0x1, %al
jne 0x6f4f
jmp 0x7033
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x7031
movq -0x10(%rbp), %rax
movslq -0x7c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x2b8(%rbp)
leaq -0xf1(%rbp), %rdi
movq %rdi, -0x2b0(%rbp)
callq 0x65d0
movq -0x2b8(%rbp), %rsi
movq -0x2b0(%rbp), %rdx
leaq -0xf0(%rbp), %rdi
callq 0x73b0
jmp 0x6fa6
xorl %eax, %eax
movl %eax, %esi
leaq -0xf0(%rbp), %rdi
movl $0xa, %edx
callq 0x7490
movl %eax, -0x2bc(%rbp)
jmp 0x6fc3
leaq -0xf0(%rbp), %rdi
callq 0x6230
leaq -0xf1(%rbp), %rdi
callq 0x63e0
movl -0x2bc(%rbp), %eax
movl %eax, -0xd0(%rbp)
cmpl $0x0, -0xd0(%rbp)
jl 0x702f
movl -0xd0(%rbp), %eax
movl %eax, -0x78(%rbp)
jmp 0x702f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x7021
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x6230
leaq -0xf1(%rbp), %rdi
callq 0x63e0
jmp 0x7055
jmp 0x7031
jmp 0x7033
jmp 0x7035
jmp 0x7037
jmp 0x7039
jmp 0x703b
leaq -0xa0(%rbp), %rdi
callq 0x6230
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x6c7b
leaq -0xa0(%rbp), %rdi
callq 0x6230
jmp 0x736b
leaq -0x118(%rbp), %rdi
callq 0x64c0
leaq -0x148(%rbp), %rdi
callq 0x1a520
jmp 0x7080
movl -0x18(%rbp), %eax
movl %eax, -0x2c4(%rbp)
movb -0x11(%rbp), %al
movb %al, -0x2bd(%rbp)
leaq -0x1e8(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x6150
jmp 0x70a4
leaq -0x208(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x6150
jmp 0x70b6
movl -0x2c4(%rbp), %esi
movb -0x2bd(%rbp), %al
movl -0x78(%rbp), %r9d
movzbl %al, %edx
andl $0x1, %edx
leaq -0x1c8(%rbp), %rdi
leaq -0x1e8(%rbp), %rcx
leaq -0x208(%rbp), %r8
callq 0x15040
jmp 0x70e8
leaq -0x208(%rbp), %rdi
callq 0x6230
leaq -0x1e8(%rbp), %rdi
callq 0x6230
movq 0x3aeb9(%rip), %rsi     # 0x41fc0
leaq -0x1c8(%rbp), %rdi
callq 0x153f0
jmp 0x7115
movl $0x1, -0x20c(%rbp)
jmp 0x7121
movq 0x3aeb0(%rip), %rdi     # 0x41fd8
leaq -0x118(%rbp), %rsi
callq 0x6460
jmp 0x7136
movq 0x3ae9b(%rip), %rdi     # 0x41fd8
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x6600
movb %al, -0x2c5(%rbp)
jmp 0x7154
movb -0x2c5(%rbp), %al
testb $0x1, %al
jne 0x7163
jmp 0x71e3
jmp 0x7342
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x735f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x7353
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x71b0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x208(%rbp), %rdi
callq 0x6230
leaq -0x1e8(%rbp), %rdi
callq 0x6230
jmp 0x7353
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x7347
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x7276
leaq -0x230(%rbp), %rdi
callq 0x64c0
leaq -0x250(%rbp), %rdi
leaq -0x118(%rbp), %rsi
callq 0x6150
jmp 0x7204
leaq -0x148(%rbp), %rdi
leaq -0x250(%rbp), %rsi
leaq -0x1c8(%rbp), %rdx
leaq -0x20c(%rbp), %rcx
callq 0x1daa0
jmp 0x7227
leaq -0x250(%rbp), %rdi
callq 0x6230
leaq -0x230(%rbp), %rdi
callq 0x6230
jmp 0x711f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x726a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x250(%rbp), %rdi
callq 0x6230
leaq -0x230(%rbp), %rdi
callq 0x6230
movl -0x4c(%rbp), %eax
movl %eax, -0x2cc(%rbp)
movl $0x2, %ecx
cmpl %ecx, %eax
jne 0x7318
movq -0x48(%rbp), %rdi
callq 0x6130
movq %rax, -0x260(%rbp)
callq 0x6580
jmp 0x72a3
jmp 0x72a5
movq 0x3ad14(%rip), %rdi     # 0x41fc0
leaq 0x25d9f(%rip), %rsi     # 0x2d052
callq 0x6360
movq %rax, -0x2d8(%rbp)
jmp 0x72c1
movq -0x2d8(%rbp), %rdi
movq 0x3acd1(%rip), %rsi     # 0x41fa0
callq 0x63c0
jmp 0x72d6
leaq -0x1c8(%rbp), %rdi
callq 0x74d0
leaq -0x148(%rbp), %rdi
callq 0x7520
leaq -0x118(%rbp), %rdi
callq 0x6230
leaq -0x70(%rbp), %rdi
callq 0x6230
leaq -0x38(%rbp), %rdi
callq 0x6230
movl -0x4(%rbp), %eax
addq $0x2e0, %rsp            # imm = 0x2E0
popq %rbp
retq
movl -0x2cc(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x7347
movq -0x48(%rbp), %rdi
callq 0x6130
movl (%rax), %eax
movl %eax, -0x254(%rbp)
callq 0x6580
jmp 0x72a5
jmp 0x72a5
leaq -0x1c8(%rbp), %rdi
callq 0x74d0
leaq -0x148(%rbp), %rdi
callq 0x7520
leaq -0x118(%rbp), %rdi
callq 0x6230
leaq -0x70(%rbp), %rdi
callq 0x6230
leaq -0x38(%rbp), %rdi
callq 0x6230
movq -0x48(%rbp), %rdi
callq 0x65c0
nopw %cs:(%rax,%rax)