// File: Rubenmp[P]Rubik/src/Rubik.cpp
// Function: main
int main(int argc, char* argv[]){
   Rubik rubik;
   char character;
   vector<char> solution;

   // Options
   if (argc == 1) {
     // Print help and exit
     arguments(argv[0]);
     return 1;    
   }
   else if (argc <= 4){
     // Probably there are better implementations to handle options
     if (argv[1][0] == '-'){
       if (strlen(argv[1]) != 2){ // Two or more options
         if (argv[1][1] == 'M'){ // Execute movement
           ifstream is;
           is.open(argv[2]);
         
           if (!is){
             cerr << "Error: not readable file " << argv[2] << "." << endl;
             return 1;
           }
           is >> rubik; // Read cube
           is.close();

           char mov = argv[1][2];
           if (mov == 'F')
             rubik.F(solution);
           else if (mov == 'f')
             rubik.f(solution);
           else if (mov == 'B')
             rubik.B(solution);
           else if (mov == 'b')
             rubik.b(solution);
           else if (mov == 'R')
             rubik.R(solution);
           else if (mov == 'r')
             rubik.r(solution);
           else if (mov == 'L')
             rubik.L(solution);
           else if (mov == 'l')
             rubik.l(solution);
           else if (mov == 'U')
             rubik.U(solution);
           else if (mov == 'u')
             rubik.u(solution);
           else if (mov == 'D')
             rubik.D(solution);
           else if (mov == 'd')
             rubik.d(solution);
           else{
             cerr << "Error: invalid movement (" << mov << ") to execute." << endl;
             return 1;
           }
           ofstream os;
           os.open(argv[2]);
           
           if (!os){
             cerr << "Error: not writable file " << argv[2] << endl;
             return 1;
           }
           os << rubik; // Write cube
           os.close();
         }
         else{
           cerr << "Error: too many options " << argv[1] << endl;
           return 1;
         }
       }
       else if ((argv[1][1] == 's' || argv[1][1] == 'p') && argc == 3){
         ifstream is;
         is.open(argv[2]);
         
         if (!is){
           cerr << "Error: not readable file " << argv[2] << endl;
           return 1;
         }
         is >> rubik; // Read cube
         is.close();
         if (argv[1][1] == 's'){
           if (rubik.isSolved())
             cout << "y" << endl;
           else
             cout << "n" << endl;
         }
         else
           rubik.printAll();
       }
       else{ // See options
         if (argv[1][1] == 'e') // Example
           Rubik::fileExample();
         else if (argv[1][1] == 'h') // Help
           arguments(argv[0]);
         else if (argv[1][1] == 'i'){ // Interactive mode
           char entry;
           do{
             cout << "Do you want to read of an file (1) or keyboard (2)." << endl;
             cin >> entry;
             cin.ignore(1024, '\n');
           }while(entry != '1' && entry != '2');
           
           if (entry == '1'){
             bool repeat = true;
             char anyKey[100];
             ifstream is;
             
             while (repeat){
               strcpy(anyKey, "");
               cout << "Create a file \"./data/rubik.dat\" with colours in valid order (see -e for explanation of valid file). ";
               cout << "Press any key to continue." << endl;
               cin.getline(anyKey, '\n');
               is.open("./data/rubik.dat");
               if (is)
                 repeat = false;
               else
                 cout << "It's imposible open \"./data/rubik.dat\"" << endl;
               
               is.close();
             }
             
             is.open("./data/rubik.dat");
             is >> rubik;
             is.close();
           }
           else{
             cout << "Reading rubik's cube in terminal (not recommended):" << endl;
             cin >> rubik;
           }
           
           rubik.printAll();
           do{
             cout << "Do you want to correct any position [y/n]?" << endl;
             cin >> character;
           }while (tolower(character) != 'y' && tolower(character) != 'n');
           
           if (tolower(character) == 'y')
             rubik.correctMistakes();
           
           rubik.solveStepByStep(solution);
         }
         else if (argv[1][1] == 'm') // Explain movements
           movements();
         else if (argv[1][1] == 'r'){ // Random solution
           bool boolean = true;
           Rubik aux;
           while (boolean){
             /*
               This is a trick, it will not fail ever... or you will not notice
               (Supposedly it will never repeat the loop if program is correct)
              */
             rubik = Rubik::randomRubik();
             aux = rubik;
             rubik.solve(solution);
             
             if (rubik.isSolved())
               boolean = false;
           }
           aux.printAll();
           cout << endl;
           cout << "Solution: ";
           for (unsigned int i=0; i<solution.size(); ++i)
             cout << solution[i];

           cout << endl << endl;
           rubik.printAll();
           cout << endl;
         }
         else if (argv[1][1] == 'R') // Random Rubik's cube
           cout << Rubik::randomRubik();
         else{
           if (argv[1][1] == 's'){
             cerr << "Error: -s option needs extra argument <input_file>." << endl;
             return 1;
           }
           else{
             cerr << "Error: invalid argument '" << argv[1][1] << "'." << endl;
             return 1;
           }
         }
       }
     }
     else if (argc <= 3) { // Files configuration
       ifstream file;
       file.open(argv[1]);
       if (!file) {
         cerr << "Error: not readable file " << argv[1] << "." << endl;
         return 1;
       }
       else{
         file >> rubik;
         file.close();
         rubik.solve(solution);
         
         if (argc == 2){
           for (unsigned int i=0; i<solution.size(); ++i)
             cout << solution[i];
           cout << endl;
         }
         else if (argc == 3){
           ofstream outFile(argv[2]);
           if (outFile.is_open()) {
             for (unsigned int i=0; i<solution.size(); ++i)
               outFile << solution[i];
             outFile << endl;
             outFile.close();
           }
           else{
             cerr << "Error: can not open " << argv[2] << "." << endl;
             return 1;
           }
         }
         else{
           cerr << "Error: invalid arguments, -h for help." << endl;
           return 1;
         }        
       }
     }
   }  
   else{
     cerr << "Error: invalid number of arguments." << endl;
     return 1;
   }

   return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf90, %rsp            # imm = 0xF90
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x46(%rbp), %rdi
callq 0x11a80
leaq -0x60(%rbp), %rdi
callq 0x3900
cmpl $0x1, -0x8(%rbp)
jne 0x2665
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xe20(%rbp)
leaq -0x81(%rbp), %rdi
movq %rdi, -0xe18(%rbp)
callq 0x23d0
movq -0xe20(%rbp), %rsi
movq -0xe18(%rbp), %rdx
leaq -0x80(%rbp), %rdi
callq 0x3920
jmp 0x25ef
leaq -0x80(%rbp), %rdi
callq 0x15ee0
jmp 0x25fa
leaq -0x80(%rbp), %rdi
callq 0x2140
leaq -0x81(%rbp), %rdi
callq 0x2280
movl $0x1, -0x4(%rbp)
movl $0x1, -0x98(%rbp)
jmp 0x38d2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x2654
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x2140
leaq -0x81(%rbp), %rdi
callq 0x2280
jmp 0x38e7
cmpl $0x4, -0x8(%rbp)
jg 0x387b
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x34ae
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x20f0
cmpq $0x2, %rax
je 0x2b9f
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movsbl 0x1(%rax), %eax
cmpl $0x4d, %eax
jne 0x2b36
leaq -0x2a0(%rbp), %rdi
callq 0x22d0
jmp 0x26bd
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
leaq -0x2a0(%rbp), %rdi
movl $0x8, %edx
callq 0x2150
jmp 0x26d8
movq -0x2a0(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x2a0(%rbp,%rax), %rdi
callq 0x2100
movb %al, -0xe21(%rbp)
jmp 0x26f8
movb -0xe21(%rbp), %al
testb $0x1, %al
jne 0x2707
jmp 0x27b5
movq 0x1a8e2(%rip), %rdi     # 0x1cff0
leaq 0x148ef(%rip), %rsi     # 0x17004
callq 0x2230
movq %rax, -0xe30(%rbp)
jmp 0x2723
movq -0xe30(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x2230
movq %rax, -0xe38(%rbp)
jmp 0x2740
movq -0xe38(%rbp), %rdi
leaq 0x14ad5(%rip), %rsi     # 0x17223
callq 0x2230
movq %rax, -0xe40(%rbp)
jmp 0x275c
movq -0xe40(%rbp), %rdi
movq 0x1a84e(%rip), %rsi     # 0x1cfb8
callq 0x2260
jmp 0x2771
movl $0x1, -0x4(%rbp)
movl $0x1, -0x98(%rbp)
jmp 0x2b07
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x38e7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x2b25
leaq -0x2a0(%rbp), %rdi
leaq -0x46(%rbp), %rsi
callq 0x15c80
jmp 0x27c7
leaq -0x2a0(%rbp), %rdi
callq 0x2070
jmp 0x27d5
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movb 0x2(%rax), %al
movb %al, -0x2a1(%rbp)
movsbl -0x2a1(%rbp), %eax
cmpl $0x46, %eax
jne 0x2806
leaq -0x46(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x5af0
jmp 0x2801
jmp 0x29f8
movsbl -0x2a1(%rbp), %eax
cmpl $0x66, %eax
jne 0x2826
leaq -0x46(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x5bb0
jmp 0x2821
jmp 0x29f6
movsbl -0x2a1(%rbp), %eax
cmpl $0x42, %eax
jne 0x2846
leaq -0x46(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x5c70
jmp 0x2841
jmp 0x29f4
movsbl -0x2a1(%rbp), %eax
cmpl $0x62, %eax
jne 0x2866
leaq -0x46(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x5d30
jmp 0x2861
jmp 0x29f2
movsbl -0x2a1(%rbp), %eax
cmpl $0x52, %eax
jne 0x2886
leaq -0x46(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x55b0
jmp 0x2881
jmp 0x29f0
movsbl -0x2a1(%rbp), %eax
cmpl $0x72, %eax
jne 0x28a6
leaq -0x46(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x5660
jmp 0x28a1
jmp 0x29ee
movsbl -0x2a1(%rbp), %eax
cmpl $0x4c, %eax
jne 0x28c6
leaq -0x46(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x5710
jmp 0x28c1
jmp 0x29ec
movsbl -0x2a1(%rbp), %eax
cmpl $0x6c, %eax
jne 0x28e6
leaq -0x46(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x57c0
jmp 0x28e1
jmp 0x29ea
movsbl -0x2a1(%rbp), %eax
cmpl $0x55, %eax
jne 0x2906
leaq -0x46(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x59b0
jmp 0x2901
jmp 0x29e8
movsbl -0x2a1(%rbp), %eax
cmpl $0x75, %eax
jne 0x2926
leaq -0x46(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x5a50
jmp 0x2921
jmp 0x29e6
movsbl -0x2a1(%rbp), %eax
cmpl $0x44, %eax
jne 0x2946
leaq -0x46(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x5870
jmp 0x2941
jmp 0x29e4
movsbl -0x2a1(%rbp), %eax
cmpl $0x64, %eax
jne 0x2963
leaq -0x46(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x5910
jmp 0x2961
jmp 0x29e2
movq 0x1a686(%rip), %rdi     # 0x1cff0
leaq 0x146ad(%rip), %rsi     # 0x1701e
callq 0x2230
movq %rax, -0xe48(%rbp)
jmp 0x297f
movq -0xe48(%rbp), %rdi
movsbl -0x2a1(%rbp), %esi
callq 0x22e0
movq %rax, -0xe50(%rbp)
jmp 0x299b
movq -0xe50(%rbp), %rdi
leaq 0x1468f(%rip), %rsi     # 0x17038
callq 0x2230
movq %rax, -0xe58(%rbp)
jmp 0x29b7
movq -0xe58(%rbp), %rdi
movq 0x1a5f3(%rip), %rsi     # 0x1cfb8
callq 0x2260
jmp 0x29cc
movl $0x1, -0x4(%rbp)
movl $0x1, -0x98(%rbp)
jmp 0x2b07
jmp 0x29e4
jmp 0x29e6
jmp 0x29e8
jmp 0x29ea
jmp 0x29ec
jmp 0x29ee
jmp 0x29f0
jmp 0x29f2
jmp 0x29f4
jmp 0x29f6
jmp 0x29f8
leaq -0x4a8(%rbp), %rdi
callq 0x23b0
jmp 0x2a06
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
leaq -0x4a8(%rbp), %rdi
movl $0x10, %edx
callq 0x2050
jmp 0x2a21
movq -0x4a8(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x4a8(%rbp,%rax), %rdi
callq 0x2100
movb %al, -0xe59(%rbp)
jmp 0x2a41
movb -0xe59(%rbp), %al
testb $0x1, %al
jne 0x2a50
jmp 0x2ad1
movq 0x1a599(%rip), %rdi     # 0x1cff0
leaq 0x145e8(%rip), %rsi     # 0x17046
callq 0x2230
movq %rax, -0xe68(%rbp)
jmp 0x2a6c
movq -0xe68(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x2230
movq %rax, -0xe70(%rbp)
jmp 0x2a89
movq -0xe70(%rbp), %rdi
movq 0x1a521(%rip), %rsi     # 0x1cfb8
callq 0x2260
jmp 0x2a9e
movl $0x1, -0x4(%rbp)
movl $0x1, -0x98(%rbp)
jmp 0x2afb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x4a8(%rbp), %rdi
callq 0x2360
jmp 0x2b25
leaq -0x4a8(%rbp), %rdi
leaq -0x46(%rbp), %rsi
callq 0x146a0
jmp 0x2ae3
leaq -0x4a8(%rbp), %rdi
callq 0x2330
jmp 0x2af1
movl $0x0, -0x98(%rbp)
leaq -0x4a8(%rbp), %rdi
callq 0x2360
leaq -0x2a0(%rbp), %rdi
callq 0x2090
movl -0x98(%rbp), %eax
testl %eax, %eax
jne 0x38d2
jmp 0x2b23
jmp 0x2b9a
leaq -0x2a0(%rbp), %rdi
callq 0x2090
jmp 0x38e7
movq 0x1a4b3(%rip), %rdi     # 0x1cff0
leaq 0x1451c(%rip), %rsi     # 0x17060
callq 0x2230
movq %rax, -0xe78(%rbp)
jmp 0x2b52
movq -0xe78(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x2230
movq %rax, -0xe80(%rbp)
jmp 0x2b6f
movq -0xe80(%rbp), %rdi
movq 0x1a43b(%rip), %rsi     # 0x1cfb8
callq 0x2260
jmp 0x2b84
movl $0x1, -0x4(%rbp)
movl $0x1, -0x98(%rbp)
jmp 0x38d2
jmp 0x34a9
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movsbl 0x1(%rax), %eax
cmpl $0x73, %eax
je 0x2bc5
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movsbl 0x1(%rax), %eax
cmpl $0x70, %eax
jne 0x2da0
cmpl $0x3, -0x8(%rbp)
jne 0x2da0
leaq -0x6b0(%rbp), %rdi
callq 0x22d0
jmp 0x2bdd
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
leaq -0x6b0(%rbp), %rdi
movl $0x8, %edx
callq 0x2150
jmp 0x2bf8
movq -0x6b0(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x6b0(%rbp,%rax), %rdi
callq 0x2100
movb %al, -0xe81(%rbp)
jmp 0x2c18
movb -0xe81(%rbp), %al
testb $0x1, %al
jne 0x2c27
jmp 0x2cae
movq 0x1a3c2(%rip), %rdi     # 0x1cff0
leaq 0x143cf(%rip), %rsi     # 0x17004
callq 0x2230
movq %rax, -0xe90(%rbp)
jmp 0x2c43
movq -0xe90(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x2230
movq %rax, -0xe98(%rbp)
jmp 0x2c60
movq -0xe98(%rbp), %rdi
movq 0x1a34a(%rip), %rsi     # 0x1cfb8
callq 0x2260
jmp 0x2c75
movl $0x1, -0x4(%rbp)
movl $0x1, -0x98(%rbp)
jmp 0x2d7f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x6b0(%rbp), %rdi
callq 0x2090
jmp 0x38e7
leaq -0x6b0(%rbp), %rdi
leaq -0x46(%rbp), %rsi
callq 0x15c80
jmp 0x2cc0
leaq -0x6b0(%rbp), %rdi
callq 0x2070
jmp 0x2cce
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movsbl 0x1(%rax), %eax
cmpl $0x73, %eax
jne 0x2d68
leaq -0x46(%rbp), %rdi
callq 0x11f00
movb %al, -0xe99(%rbp)
jmp 0x2cf4
movb -0xe99(%rbp), %al
testb $0x1, %al
jne 0x2d00
jmp 0x2d33
movq 0x1a2c1(%rip), %rdi     # 0x1cfc8
leaq 0x1436b(%rip), %rsi     # 0x17079
callq 0x2230
movq %rax, -0xea8(%rbp)
jmp 0x2d1c
movq -0xea8(%rbp), %rdi
movq 0x1a28e(%rip), %rsi     # 0x1cfb8
callq 0x2260
jmp 0x2d31
jmp 0x2d66
movq 0x1a28e(%rip), %rdi     # 0x1cfc8
leaq 0x1433a(%rip), %rsi     # 0x1707b
callq 0x2230
movq %rax, -0xeb0(%rbp)
jmp 0x2d4f
movq -0xeb0(%rbp), %rdi
movq 0x1a25b(%rip), %rsi     # 0x1cfb8
callq 0x2260
jmp 0x2d64
jmp 0x2d66
jmp 0x2d75
leaq -0x46(%rbp), %rdi
callq 0x136a0
jmp 0x2d73
jmp 0x2d75
movl $0x0, -0x98(%rbp)
leaq -0x6b0(%rbp), %rdi
callq 0x2090
movl -0x98(%rbp), %eax
testl %eax, %eax
jne 0x38d2
jmp 0x2d9b
jmp 0x34a7
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movsbl 0x1(%rax), %eax
cmpl $0x65, %eax
jne 0x2dbd
callq 0x14520
jmp 0x2db8
jmp 0x34a5
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movsbl 0x1(%rax), %eax
cmpl $0x68, %eax
jne 0x2e7d
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xec0(%rbp)
leaq -0x6d1(%rbp), %rdi
movq %rdi, -0xeb8(%rbp)
callq 0x23d0
movq -0xec0(%rbp), %rsi
movq -0xeb8(%rbp), %rdx
leaq -0x6d0(%rbp), %rdi
callq 0x3920
jmp 0x2e0f
leaq -0x6d0(%rbp), %rdi
callq 0x15ee0
jmp 0x2e1d
leaq -0x6d0(%rbp), %rdi
callq 0x2140
leaq -0x6d1(%rbp), %rdi
callq 0x2280
jmp 0x34a3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x2e6c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x6d0(%rbp), %rdi
callq 0x2140
leaq -0x6d1(%rbp), %rdi
callq 0x2280
jmp 0x38e7
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movsbl 0x1(%rax), %eax
cmpl $0x69, %eax
jne 0x31cd
jmp 0x2e94
movq 0x1a12d(%rip), %rdi     # 0x1cfc8
leaq 0x141db(%rip), %rsi     # 0x1707d
callq 0x2230
movq %rax, -0xec8(%rbp)
jmp 0x2eb0
movq -0xec8(%rbp), %rdi
movq 0x1a0fa(%rip), %rsi     # 0x1cfb8
callq 0x2260
jmp 0x2ec5
movq 0x1a10c(%rip), %rdi     # 0x1cfd8
leaq -0x6d2(%rbp), %rsi
callq 0x2310
jmp 0x2eda
movq 0x1a0f7(%rip), %rdi     # 0x1cfd8
movl $0x400, %esi            # imm = 0x400
movl $0xa, %edx
callq 0x2160
jmp 0x2ef2
jmp 0x2ef4
movsbl -0x6d2(%rbp), %ecx
xorl %eax, %eax
cmpl $0x31, %ecx
movb %al, -0xec9(%rbp)
je 0x2f1b
movsbl -0x6d2(%rbp), %eax
cmpl $0x32, %eax
setne %al
movb %al, -0xec9(%rbp)
movb -0xec9(%rbp), %al
testb $0x1, %al
jne 0x2e94
movsbl -0x6d2(%rbp), %eax
cmpl $0x31, %eax
jne 0x30d0
movb $0x1, -0x6d3(%rbp)
leaq -0x948(%rbp), %rdi
callq 0x22d0
jmp 0x2f4e
jmp 0x2f50
testb $0x1, -0x6d3(%rbp)
je 0x3088
leaq 0x1589c(%rip), %rsi     # 0x18800
leaq -0x740(%rbp), %rdi
callq 0x2210
movq 0x1a051(%rip), %rdi     # 0x1cfc8
leaq 0x14133(%rip), %rsi     # 0x170b1
callq 0x2230
jmp 0x2f85
movq 0x1a03c(%rip), %rdi     # 0x1cfc8
leaq 0x14184(%rip), %rsi     # 0x17117
callq 0x2230
movq %rax, -0xed8(%rbp)
jmp 0x2fa1
movq -0xed8(%rbp), %rdi
movq 0x1a009(%rip), %rsi     # 0x1cfb8
callq 0x2260
jmp 0x2fb6
movq 0x1a01b(%rip), %rdi     # 0x1cfd8
leaq -0x740(%rbp), %rsi
movl $0xa, %edx
callq 0x20c0
jmp 0x2fd0
leaq 0x1415b(%rip), %rsi     # 0x17132
leaq -0x948(%rbp), %rdi
movl $0x8, %edx
callq 0x2150
jmp 0x2fea
movq -0x948(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x948(%rbp,%rax), %rdi
callq 0x2300
movb %al, -0xed9(%rbp)
jmp 0x300a
movb -0xed9(%rbp), %al
testb $0x1, %al
jne 0x3016
jmp 0x3042
movb $0x0, -0x6d3(%rbp)
jmp 0x3075
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x948(%rbp), %rdi
callq 0x2090
jmp 0x38e7
movq 0x19f7f(%rip), %rdi     # 0x1cfc8
leaq 0x140f3(%rip), %rsi     # 0x17143
callq 0x2230
movq %rax, -0xee8(%rbp)
jmp 0x305e
movq -0xee8(%rbp), %rdi
movq 0x19f4c(%rip), %rsi     # 0x1cfb8
callq 0x2260
jmp 0x3073
jmp 0x3075
leaq -0x948(%rbp), %rdi
callq 0x2070
jmp 0x3083
jmp 0x2f50
leaq 0x140a3(%rip), %rsi     # 0x17132
leaq -0x948(%rbp), %rdi
movl $0x8, %edx
callq 0x2150
jmp 0x30a2
leaq -0x948(%rbp), %rdi
leaq -0x46(%rbp), %rsi
callq 0x15c80
jmp 0x30b4
leaq -0x948(%rbp), %rdi
callq 0x2070
jmp 0x30c2
leaq -0x948(%rbp), %rdi
callq 0x2090
jmp 0x3115
movq 0x19ef1(%rip), %rdi     # 0x1cfc8
leaq 0x1408c(%rip), %rsi     # 0x1716a
callq 0x2230
movq %rax, -0xef0(%rbp)
jmp 0x30ec
movq -0xef0(%rbp), %rdi
movq 0x19ebe(%rip), %rsi     # 0x1cfb8
callq 0x2260
jmp 0x3101
movq 0x19ed0(%rip), %rdi     # 0x1cfd8
leaq -0x46(%rbp), %rsi
callq 0x15c80
jmp 0x3113
jmp 0x3115
leaq -0x46(%rbp), %rdi
callq 0x136a0
jmp 0x3120
jmp 0x3122
movq 0x19e9f(%rip), %rdi     # 0x1cfc8
leaq 0x1406e(%rip), %rsi     # 0x1719e
callq 0x2230
movq %rax, -0xef8(%rbp)
jmp 0x313e
movq -0xef8(%rbp), %rdi
movq 0x19e6c(%rip), %rsi     # 0x1cfb8
callq 0x2260
jmp 0x3153
movq 0x19e7e(%rip), %rdi     # 0x1cfd8
leaq -0x47(%rbp), %rsi
callq 0x2310
jmp 0x3165
jmp 0x3167
movsbl -0x47(%rbp), %edi
callq 0x2340
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x79, %ecx
movb %al, -0xef9(%rbp)
je 0x3194
movsbl -0x47(%rbp), %edi
callq 0x2340
cmpl $0x6e, %eax
setne %al
movb %al, -0xef9(%rbp)
movb -0xef9(%rbp), %al
testb $0x1, %al
jne 0x3122
movsbl -0x47(%rbp), %edi
callq 0x2340
cmpl $0x79, %eax
jne 0x31b9
leaq -0x46(%rbp), %rdi
callq 0x12aa0
jmp 0x31b7
jmp 0x31b9
leaq -0x46(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x14130
jmp 0x31c8
jmp 0x34a1
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movsbl 0x1(%rax), %eax
cmpl $0x6d, %eax
jne 0x31ea
callq 0x15e90
jmp 0x31e5
jmp 0x349f
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movsbl 0x1(%rax), %eax
cmpl $0x72, %eax
jne 0x3386
movb $0x1, -0x949(%rbp)
leaq -0x97f(%rbp), %rdi
callq 0x11a80
jmp 0x3214
jmp 0x3216
testb $0x1, -0x949(%rbp)
je 0x3294
leaq -0x9b5(%rbp), %rdi
callq 0x14660
jmp 0x322d
leaq -0x46(%rbp), %rdi
leaq -0x9b5(%rbp), %rsi
callq 0x11ba0
jmp 0x323f
leaq -0x97f(%rbp), %rdi
leaq -0x46(%rbp), %rsi
callq 0x11ba0
jmp 0x3251
movb $0x42, -0x9b6(%rbp)
leaq -0x46(%rbp), %rdi
leaq -0x60(%rbp), %rsi
leaq -0x9b6(%rbp), %rdx
callq 0x144c0
jmp 0x326e
leaq -0x46(%rbp), %rdi
callq 0x11f00
movb %al, -0xefa(%rbp)
jmp 0x327f
movb -0xefa(%rbp), %al
testb $0x1, %al
jne 0x328b
jmp 0x3292
movb $0x0, -0x949(%rbp)
jmp 0x3216
leaq -0x97f(%rbp), %rdi
callq 0x136a0
jmp 0x32a2
movq 0x19d1f(%rip), %rdi     # 0x1cfc8
movq 0x19d08(%rip), %rsi     # 0x1cfb8
callq 0x2260
jmp 0x32b7
movq 0x19d0a(%rip), %rdi     # 0x1cfc8
leaq 0x13f04(%rip), %rsi     # 0x171c9
callq 0x2230
jmp 0x32cc
movl $0x0, -0x9bc(%rbp)
movl -0x9bc(%rbp), %eax
movq %rax, -0xf08(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x39d0
movq %rax, %rcx
movq -0xf08(%rbp), %rax
cmpq %rcx, %rax
jae 0x3330
movl -0x9bc(%rbp), %eax
movl %eax, %esi
leaq -0x60(%rbp), %rdi
callq 0x39f0
movsbl (%rax), %esi
movq 0x19cb2(%rip), %rdi     # 0x1cfc8
callq 0x22e0
jmp 0x331d
jmp 0x331f
movl -0x9bc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x9bc(%rbp)
jmp 0x32d6
movq 0x19c91(%rip), %rdi     # 0x1cfc8
movq 0x19c7a(%rip), %rsi     # 0x1cfb8
callq 0x2260
movq %rax, -0xf10(%rbp)
jmp 0x334c
movq -0xf10(%rbp), %rdi
movq 0x19c5e(%rip), %rsi     # 0x1cfb8
callq 0x2260
jmp 0x3361
leaq -0x46(%rbp), %rdi
callq 0x136a0
jmp 0x336c
movq 0x19c55(%rip), %rdi     # 0x1cfc8
movq 0x19c3e(%rip), %rsi     # 0x1cfb8
callq 0x2260
jmp 0x3381
jmp 0x349d
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movsbl 0x1(%rax), %eax
cmpl $0x52, %eax
jne 0x33bf
leaq -0x9f2(%rbp), %rdi
callq 0x14660
jmp 0x33a5
movq 0x19c1c(%rip), %rdi     # 0x1cfc8
leaq -0x9f2(%rbp), %rsi
callq 0x146a0
jmp 0x33ba
jmp 0x349b
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movsbl 0x1(%rax), %eax
cmpl $0x73, %eax
jne 0x3417
movq 0x19c19(%rip), %rdi     # 0x1cff0
leaq 0x13df6(%rip), %rsi     # 0x171d4
callq 0x2230
movq %rax, -0xf18(%rbp)
jmp 0x33ec
movq -0xf18(%rbp), %rdi
movq 0x19bbe(%rip), %rsi     # 0x1cfb8
callq 0x2260
jmp 0x3401
movl $0x1, -0x4(%rbp)
movl $0x1, -0x98(%rbp)
jmp 0x38d2
movq 0x19bd2(%rip), %rdi     # 0x1cff0
leaq 0x13de3(%rip), %rsi     # 0x17208
callq 0x2230
movq %rax, -0xf20(%rbp)
jmp 0x3433
movq -0xf20(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movsbl 0x1(%rax), %esi
callq 0x22e0
movq %rax, -0xf28(%rbp)
jmp 0x3454
movq -0xf28(%rbp), %rdi
leaq 0x13dc0(%rip), %rsi     # 0x17222
callq 0x2230
movq %rax, -0xf30(%rbp)
jmp 0x3470
movq -0xf30(%rbp), %rdi
movq 0x19b3a(%rip), %rsi     # 0x1cfb8
callq 0x2260
jmp 0x3485
movl $0x1, -0x4(%rbp)
movl $0x1, -0x98(%rbp)
jmp 0x38d2
jmp 0x349d
jmp 0x349f
jmp 0x34a1
jmp 0x34a3
jmp 0x34a5
jmp 0x34a7
jmp 0x34a9
jmp 0x3879
cmpl $0x3, -0x8(%rbp)
jg 0x3877
leaq -0xc00(%rbp), %rdi
callq 0x22d0
jmp 0x34c6
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
leaq -0xc00(%rbp), %rdi
movl $0x8, %edx
callq 0x2150
jmp 0x34e1
movq -0xc00(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0xc00(%rbp,%rax), %rdi
callq 0x2100
movb %al, -0xf31(%rbp)
jmp 0x3501
movb -0xf31(%rbp), %al
testb $0x1, %al
jne 0x3510
jmp 0x35a7
movq 0x19ad9(%rip), %rdi     # 0x1cff0
leaq 0x13ae6(%rip), %rsi     # 0x17004
callq 0x2230
movq %rax, -0xf40(%rbp)
jmp 0x352c
movq -0xf40(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x2230
movq %rax, -0xf48(%rbp)
jmp 0x3549
movq -0xf48(%rbp), %rdi
leaq 0x13ccc(%rip), %rsi     # 0x17223
callq 0x2230
movq %rax, -0xf50(%rbp)
jmp 0x3565
movq -0xf50(%rbp), %rdi
movq 0x19a45(%rip), %rsi     # 0x1cfb8
callq 0x2260
jmp 0x357a
movl $0x1, -0x4(%rbp)
movl $0x1, -0x98(%rbp)
jmp 0x384f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x3869
leaq -0xc00(%rbp), %rdi
leaq -0x46(%rbp), %rsi
callq 0x15c80
jmp 0x35b9
leaq -0xc00(%rbp), %rdi
callq 0x2070
jmp 0x35c7
movb $0x42, -0xc01(%rbp)
leaq -0x46(%rbp), %rdi
leaq -0x60(%rbp), %rsi
leaq -0xc01(%rbp), %rdx
callq 0x144c0
jmp 0x35e4
cmpl $0x2, -0x8(%rbp)
jne 0x3668
movl $0x0, -0xc08(%rbp)
movl -0xc08(%rbp), %eax
movq %rax, -0xf58(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x39d0
movq %rax, %rcx
movq -0xf58(%rbp), %rax
cmpq %rcx, %rax
jae 0x364e
movl -0xc08(%rbp), %eax
movl %eax, %esi
leaq -0x60(%rbp), %rdi
callq 0x39f0
movsbl (%rax), %esi
movq 0x19994(%rip), %rdi     # 0x1cfc8
callq 0x22e0
jmp 0x363b
jmp 0x363d
movl -0xc08(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc08(%rbp)
jmp 0x35f4
movq 0x19973(%rip), %rdi     # 0x1cfc8
movq 0x1995c(%rip), %rsi     # 0x1cfb8
callq 0x2260
jmp 0x3663
jmp 0x3843
cmpl $0x3, -0x8(%rbp)
jne 0x37fd
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
leaq -0xe08(%rbp), %rdi
movl $0x10, %edx
callq 0x2290
jmp 0x368d
leaq -0xe08(%rbp), %rdi
callq 0x21a0
movb %al, -0xf59(%rbp)
jmp 0x36a1
movb -0xf59(%rbp), %al
testb $0x1, %al
jne 0x36b0
jmp 0x375c
movl $0x0, -0xe0c(%rbp)
movl -0xe0c(%rbp), %eax
movq %rax, -0xf68(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x39d0
movq %rax, %rcx
movq -0xf68(%rbp), %rax
cmpq %rcx, %rax
jae 0x3737
movl -0xe0c(%rbp), %eax
movl %eax, %esi
leaq -0x60(%rbp), %rdi
callq 0x39f0
movsbl (%rax), %esi
leaq -0xe08(%rbp), %rdi
callq 0x22e0
jmp 0x3701
jmp 0x3703
movl -0xe0c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xe0c(%rbp)
jmp 0x36ba
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0xe08(%rbp), %rdi
callq 0x2360
jmp 0x3869
movq 0x1987a(%rip), %rsi     # 0x1cfb8
leaq -0xe08(%rbp), %rdi
callq 0x2260
jmp 0x374c
leaq -0xe08(%rbp), %rdi
callq 0x2330
jmp 0x375a
jmp 0x37d9
movq 0x1988d(%rip), %rdi     # 0x1cff0
leaq 0x13abb(%rip), %rsi     # 0x17225
callq 0x2230
movq %rax, -0xf70(%rbp)
jmp 0x3778
movq -0xf70(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x2230
movq %rax, -0xf78(%rbp)
jmp 0x3795
movq -0xf78(%rbp), %rdi
leaq 0x13a80(%rip), %rsi     # 0x17223
callq 0x2230
movq %rax, -0xf80(%rbp)
jmp 0x37b1
movq -0xf80(%rbp), %rdi
movq 0x197f9(%rip), %rsi     # 0x1cfb8
callq 0x2260
jmp 0x37c6
movl $0x1, -0x4(%rbp)
movl $0x1, -0x98(%rbp)
jmp 0x37e3
movl $0x0, -0x98(%rbp)
leaq -0xe08(%rbp), %rdi
callq 0x2360
movl -0x98(%rbp), %eax
testl %eax, %eax
jne 0x384f
jmp 0x37fb
jmp 0x3841
movq 0x197ec(%rip), %rdi     # 0x1cff0
leaq 0x13a2f(%rip), %rsi     # 0x1723a
callq 0x2230
movq %rax, -0xf88(%rbp)
jmp 0x3819
movq -0xf88(%rbp), %rdi
movq 0x19791(%rip), %rsi     # 0x1cfb8
callq 0x2260
jmp 0x382e
movl $0x1, -0x4(%rbp)
movl $0x1, -0x98(%rbp)
jmp 0x384f
jmp 0x3843
jmp 0x3845
movl $0x0, -0x98(%rbp)
leaq -0xc00(%rbp), %rdi
callq 0x2090
movl -0x98(%rbp), %eax
testl %eax, %eax
jne 0x38d2
jmp 0x3867
jmp 0x3877
leaq -0xc00(%rbp), %rdi
callq 0x2090
jmp 0x38e7
jmp 0x3879
jmp 0x38bf
movq 0x1976e(%rip), %rdi     # 0x1cff0
leaq 0x139d8(%rip), %rsi     # 0x17261
callq 0x2230
movq %rax, -0xf90(%rbp)
jmp 0x3897
movq -0xf90(%rbp), %rdi
movq 0x19713(%rip), %rsi     # 0x1cfb8
callq 0x2260
jmp 0x38ac
movl $0x1, -0x4(%rbp)
movl $0x1, -0x98(%rbp)
jmp 0x38d2
jmp 0x38c1
movl $0x0, -0x4(%rbp)
movl $0x1, -0x98(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x3a10
movl -0x4(%rbp), %eax
addq $0xf90, %rsp            # imm = 0xF90
popq %rbp
retq
leaq -0x60(%rbp), %rdi
callq 0x3a10
movq -0x90(%rbp), %rdi
callq 0x23c0
nopl (%rax)