// File: linuxnoodle[P]typer/main.cpp
// Function: main
int main(){
    // Clears screen when first ran.
    #ifdef _WIN32
        system("cls");
    #else
        cout << "\x1B[2J"; 
        cout << "\x1B[0;0H";
    #endif

    cout << "Enter the amount of words you want to type: (type \"quotes\" for quotes)\n";
    string s = "bruh";
    
    // Makes sure user input is valid.
    while (s != "quotes" && (!(s.find_first_not_of("0123456789") == string::npos) || s == "0")){
        #ifdef _WIN32
            cout << "Please enter a positive non-zero integer.\n";
        #else
            cout << "\033[0;32mPlease enter a positive non-zero integer.\033[0m\n";
        #endif
        getline(cin, s, '\n');
    }

    ifstream wordsFile;
    
    #ifdef _WIN32
        char *path = getenv("appdata");
        if (s == "quotes"){
            strcat(path, "\\quotes.txt"); 
        } else {
            strcat(getenv("appdata"), "\\words.txt"); 
        }   
    #else
        struct passwd *pw = getpwuid(getuid());
        char *path = pw->pw_dir;
        if (s == "quotes"){
            strcat(path, "/.local/share/quotes.txt");
        } else {
            strcat(path, "/.local/share/words.txt");
        } 
    #endif

    // Reads file into the vector "words".
    wordsFile = ifstream(path);

    if (!wordsFile){
        if (s == "quotes"){
            wordsFile = ifstream("quotes.txt");
        } else {
            wordsFile = ifstream("words.txt");
        }
        if (!wordsFile){
            #ifdef _WIN32
                cerr << "Error: quotes and/or words file is missing. Put \"words.txt\" and \"quotes.txt\" in \%appdata\%\\Roaming\\\n";
            #else
                cerr << "Error: quotes and/or words file is missing. Put \"words.txt\" and \"quotes.txt\" in ~/.local/share/\n";
            #endif
            return -1;
        } else {
            #ifdef _WIN32
                // Moving the files in windows doesn't appear to work, but at the very least, 
                // there is no reason to move them in windows
                if (s == "quotes"){
                    MoveFile("quotes.txt", path);
                } else {
                    MoveFile("words.txt", path);
                }
            #else
                if (s == "quotes"){
                    filesystem::rename("quotes.txt", path);
                } else {
                    filesystem::rename("words.txt", path);
                }
            #endif
        }
    }
    if (wordsFile.is_open()){
        string line;
        while (getline(wordsFile, line)){
            words.push_back(line);
        }
    }
    // Initializes random distribution, as before this the bounds are not decided.
    distribution = uniform_int_distribution<mt19937::result_type>(0, words.size() - 1);

    while (true){
        // Grabs the next phrase, and loads it.
        string phrase;
        if (s == "quotes"){
            phrase = words[distribution(generator)];
        } else {
            phrase = generateString(stoi(s));
        }

        // Clears screen, then displays text in green. 
        // (\033 is the escape character, 0;32 means green.)
        #ifdef _WIN32
            system("cls");
            cout << phrase << "\n";
        #else
            cout << "\x1B[2J";
            cout << "\x1B[0;0H";
            cout << "\033[0;32m" << phrase << "\033[0m\n";
        #endif
        // Splits phrase delimited by space, and finds wordcount. (Will be used to rework new typing system)
        vector<string> splitPhrase;
        istringstream iss(phrase);
        
        string word;
        while (getline(iss, word, ' ')){
            splitPhrase.push_back(word);
        }
        
        int wordCount = splitPhrase.size();
        
        // Starts timer to calculate WPM.
        auto startTime = chrono::system_clock::now();
        
        string userInput;
        getline(cin, userInput, '\n');
        
        float timeTaken = (chrono::duration_cast<chrono::milliseconds>(chrono::system_clock::now() - startTime).count());
        
        cout << "Time taken: " << timeTaken/1000 << "s\n";
        cout << "Raw WPM: " << wordCount/(timeTaken/60000) << "wpm\n";
        
        // Calculates the amount of mistyped characters.
        // First, it checks if the size of the phrase typed and the actual phrase are the same, as if they aren't,
        // checking each character would segfault due to an out of bounds exception.
        // If it is, it adds the difference to the error count, and only check for differences up to the shorter length.
        // If it isn't, it just checks each character with the same indicies.
        
        int errors = 0;
        if (userInput.size() != phrase.size()){
            errors += abs((int)userInput.size() - (int)phrase.size());
            for (int i = 0; i <= abs((int)userInput.size() - (int)phrase.size()); ++i){
                if (phrase[i] != userInput[i]){
                    ++errors;
                }
            }
        } else {
            for (int i = 0; i < (int)phrase.size(); ++i){
                if (phrase[i] != userInput[i]){
                    ++errors;
                }
            }
        }
        
        cout << "Mistyped characters: " << errors << "\n";
        errors = 0;
        
        // Waits for one second so that the user can actually read the output.
        #ifdef _WIN32
            Sleep(1000);
        #else
            usleep(1000000);
        #endif
    }
}

// Assembly:
subq $0xc98, %rsp            # imm = 0xC98
movl $0x0, 0xc94(%rsp)
movq 0x6877(%rip), %rdi      # 0x9fc0
movq %rdi, 0xf0(%rsp)
leaq 0x38b4(%rip), %rsi      # 0x700c
callq 0x3290
movq 0xf0(%rsp), %rdi
leaq 0x38a5(%rip), %rsi      # 0x7011
callq 0x3290
movq 0xf0(%rsp), %rdi
leaq 0x3898(%rip), %rsi      # 0x7018
callq 0x3290
leaq 0xc6f(%rsp), %rdi
movq %rdi, 0xf8(%rsp)
callq 0x3420
movq 0xf8(%rsp), %rdx
leaq 0x38b7(%rip), %rsi      # 0x7060
leaq 0xc70(%rsp), %rdi
callq 0x4640
jmp 0x37b8
leaq 0xc6f(%rsp), %rdi
callq 0x32d0
leaq 0x3899(%rip), %rsi      # 0x7065
leaq 0xc70(%rsp), %rdi
callq 0x4700
movb %al, 0xef(%rsp)
jmp 0x37e2
movb 0xef(%rsp), %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0xee(%rsp)
jne 0x37f9
jmp 0x385e
leaq 0xc70(%rsp), %rdi
leaq 0x3864(%rip), %rsi      # 0x706c
xorl %eax, %eax
movl %eax, %edx
callq 0x3180
movq %rax, %rcx
movb $0x1, %al
cmpq $-0x1, %rcx
movb %al, 0xed(%rsp)
jne 0x3850
leaq 0x384d(%rip), %rsi      # 0x7077
leaq 0xc70(%rsp), %rdi
callq 0x4730
movb %al, 0xec(%rsp)
jmp 0x3840
movb 0xec(%rsp), %al
movb %al, 0xed(%rsp)
jmp 0x3850
movb 0xed(%rsp), %al
movb %al, 0xee(%rsp)
movb 0xee(%rsp), %al
testb $0x1, %al
jne 0x386b
jmp 0x38df
movq 0x674e(%rip), %rdi      # 0x9fc0
leaq 0x3800(%rip), %rsi      # 0x7079
callq 0x3290
jmp 0x3880
movq 0x6751(%rip), %rdi      # 0x9fd8
leaq 0xc70(%rsp), %rsi
movl $0xa, %edx
callq 0x3460
jmp 0x389b
jmp 0x37c5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc60(%rsp)
movl %eax, 0xc5c(%rsp)
leaq 0xc6f(%rsp), %rdi
callq 0x32d0
jmp 0x4520
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc60(%rsp)
movl %eax, 0xc5c(%rsp)
jmp 0x4513
leaq 0xa50(%rsp), %rdi
callq 0x3300
jmp 0x38ee
callq 0x3160
movl %eax, %edi
callq 0x3310
movq %rax, 0xe0(%rsp)
jmp 0x3904
movq 0xe0(%rsp), %rax
movq %rax, 0xa48(%rsp)
movq 0xa48(%rsp), %rax
movq 0x20(%rax), %rax
movq %rax, 0xa40(%rsp)
leaq 0x3736(%rip), %rsi      # 0x7065
leaq 0xc70(%rsp), %rdi
callq 0x4730
movb %al, 0xdf(%rsp)
jmp 0x3945
movb 0xdf(%rsp), %al
testb $0x1, %al
jne 0x3952
jmp 0x3981
movq 0xa40(%rsp), %rdi
leaq 0x374e(%rip), %rsi      # 0x70af
callq 0x3430
jmp 0x3995
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc60(%rsp)
movl %eax, 0xc5c(%rsp)
jmp 0x4506
movq 0xa40(%rsp), %rdi
leaq 0x3738(%rip), %rsi      # 0x70c8
callq 0x3430
movq 0xa40(%rsp), %rsi
leaq 0x838(%rsp), %rdi
movl $0x8, %edx
callq 0x3450
jmp 0x39b1
leaq 0xa50(%rsp), %rdi
leaq 0x838(%rsp), %rsi
callq 0x33d0
jmp 0x39c8
leaq 0x838(%rsp), %rdi
callq 0x3080
movq 0xa50(%rsp), %rax
movq -0x18(%rax), %rax
leaq 0xa50(%rsp,%rax), %rdi
callq 0x3140
movb %al, 0xde(%rsp)
jmp 0x39f7
movb 0xde(%rsp), %al
testb $0x1, %al
jne 0x3a07
jmp 0x3d3d
leaq 0x3657(%rip), %rsi      # 0x7065
leaq 0xc70(%rsp), %rdi
callq 0x4730
movb %al, 0xdd(%rsp)
jmp 0x3a24
movb 0xdd(%rsp), %al
testb $0x1, %al
jne 0x3a34
jmp 0x3ac4
leaq 0x3682(%rip), %rsi      # 0x70bd
leaq 0x630(%rsp), %rdi
movl $0x8, %edx
callq 0x3450
jmp 0x3a4f
leaq 0xa50(%rsp), %rdi
leaq 0x630(%rsp), %rsi
callq 0x33d0
jmp 0x3a66
leaq 0x630(%rsp), %rdi
callq 0x3080
jmp 0x3b2b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc60(%rsp)
movl %eax, 0xc5c(%rsp)
leaq 0x838(%rsp), %rdi
callq 0x3080
jmp 0x4506
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc60(%rsp)
movl %eax, 0xc5c(%rsp)
leaq 0x630(%rsp), %rdi
callq 0x3080
jmp 0x4506
leaq 0x360b(%rip), %rsi      # 0x70d6
leaq 0x428(%rsp), %rdi
movl $0x8, %edx
callq 0x3450
jmp 0x3adf
leaq 0xa50(%rsp), %rdi
leaq 0x428(%rsp), %rsi
callq 0x33d0
jmp 0x3af6
leaq 0x428(%rsp), %rdi
callq 0x3080
jmp 0x3b2b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc60(%rsp)
movl %eax, 0xc5c(%rsp)
leaq 0x428(%rsp), %rdi
callq 0x3080
jmp 0x4506
movq 0xa50(%rsp), %rax
movq -0x18(%rax), %rax
leaq 0xa50(%rsp,%rax), %rdi
callq 0x3140
movb %al, 0xdc(%rsp)
jmp 0x3b4d
movb 0xdc(%rsp), %al
testb $0x1, %al
jne 0x3b5a
jmp 0x3ba3
movq 0x648f(%rip), %rdi      # 0x9ff0
leaq 0x3578(%rip), %rsi      # 0x70e0
callq 0x3290
jmp 0x3b6f
movl $0xffffffff, 0xc94(%rsp) # imm = 0xFFFFFFFF
leaq 0xa50(%rsp), %rdi
callq 0x3080
leaq 0xc70(%rsp), %rdi
callq 0x31b0
movl 0xc94(%rsp), %eax
addq $0xc98, %rsp            # imm = 0xC98
retq
leaq 0x34bb(%rip), %rsi      # 0x7065
leaq 0xc70(%rsp), %rdi
callq 0x4730
movb %al, 0xdb(%rsp)
jmp 0x3bc0
movb 0xdb(%rsp), %al
testb $0x1, %al
jne 0x3bd0
jmp 0x3c86
leaq 0x34e6(%rip), %rsi      # 0x70bd
leaq 0x400(%rsp), %rdi
movl $0x2, %edx
callq 0x4760
jmp 0x3beb
leaq 0x3d8(%rsp), %rdi
leaq 0xa40(%rsp), %rsi
movl $0x2, %edx
callq 0x4860
jmp 0x3c07
leaq 0x400(%rsp), %rdi
leaq 0x3d8(%rsp), %rsi
callq 0x31c0
jmp 0x3c1e
leaq 0x3d8(%rsp), %rdi
callq 0x4960
leaq 0x400(%rsp), %rdi
callq 0x4960
jmp 0x3d39
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc60(%rsp)
movl %eax, 0xc5c(%rsp)
jmp 0x3c74
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc60(%rsp)
movl %eax, 0xc5c(%rsp)
leaq 0x3d8(%rsp), %rdi
callq 0x4960
leaq 0x400(%rsp), %rdi
callq 0x4960
jmp 0x4506
leaq 0x3449(%rip), %rsi      # 0x70d6
leaq 0x3b0(%rsp), %rdi
movl $0x2, %edx
callq 0x4990
jmp 0x3ca1
leaq 0x388(%rsp), %rdi
leaq 0xa40(%rsp), %rsi
movl $0x2, %edx
callq 0x4860
jmp 0x3cbd
leaq 0x3b0(%rsp), %rdi
leaq 0x388(%rsp), %rsi
callq 0x31c0
jmp 0x3cd4
leaq 0x388(%rsp), %rdi
callq 0x4960
leaq 0x3b0(%rsp), %rdi
callq 0x4960
jmp 0x3d39
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc60(%rsp)
movl %eax, 0xc5c(%rsp)
jmp 0x3d27
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc60(%rsp)
movl %eax, 0xc5c(%rsp)
leaq 0x388(%rsp), %rdi
callq 0x4960
leaq 0x3b0(%rsp), %rdi
callq 0x4960
jmp 0x4506
jmp 0x3d3b
jmp 0x3d3d
leaq 0xa50(%rsp), %rdi
callq 0x33c0
movb %al, 0xda(%rsp)
jmp 0x3d53
movb 0xda(%rsp), %al
testb $0x1, %al
jne 0x3d63
jmp 0x3e07
leaq 0x368(%rsp), %rdi
callq 0x3360
leaq 0xa50(%rsp), %rdi
leaq 0x368(%rsp), %rsi
callq 0x3070
movq %rax, 0xd0(%rsp)
jmp 0x3d8f
movq 0xd0(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x3340
movb %al, 0xcf(%rsp)
jmp 0x3daf
movb 0xcf(%rsp), %al
testb $0x1, %al
jne 0x3dbc
jmp 0x3dfa
leaq 0x64ad(%rip), %rdi      # 0xa270
leaq 0x368(%rsp), %rsi
callq 0x4a90
jmp 0x3dd2
jmp 0x3d70
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc60(%rsp)
movl %eax, 0xc5c(%rsp)
leaq 0x368(%rsp), %rdi
callq 0x31b0
jmp 0x4506
leaq 0x368(%rsp), %rdi
callq 0x31b0
leaq 0x6462(%rip), %rdi      # 0xa270
callq 0x4b00
movq %rax, %rdx
decq %rdx
xorl %eax, %eax
movl %eax, %esi
leaq 0x358(%rsp), %rdi
callq 0x4b20
jmp 0x3e2c
movq 0x358(%rsp), %rax
movq %rax, 0x77d5(%rip)      # 0xb610
movq 0x360(%rsp), %rax
movq %rax, 0x77ce(%rip)      # 0xb618
jmp 0x3e4c
leaq 0x338(%rsp), %rdi
callq 0x3360
leaq 0x3205(%rip), %rsi      # 0x7065
leaq 0xc70(%rsp), %rdi
callq 0x4730
movb %al, 0xce(%rsp)
jmp 0x3e76
movb 0xce(%rsp), %al
testb $0x1, %al
jne 0x3e83
jmp 0x3ee1
leaq 0x7786(%rip), %rdi      # 0xb610
leaq 0x63f7(%rip), %rsi      # 0xa288
callq 0x4610
movq %rax, 0xc0(%rsp)
jmp 0x3ea0
movq 0xc0(%rsp), %rsi
leaq 0x63c1(%rip), %rdi      # 0xa270
callq 0x45f0
movq %rax, %rsi
leaq 0x338(%rsp), %rdi
callq 0x3030
jmp 0x3ec6
jmp 0x3f38
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc60(%rsp)
movl %eax, 0xc5c(%rsp)
jmp 0x44f9
xorl %eax, %eax
movl %eax, %esi
leaq 0xc70(%rsp), %rdi
movl $0xa, %edx
callq 0x4b50
movl %eax, 0xbc(%rsp)
jmp 0x3f00
movl 0xbc(%rsp), %esi
leaq 0x318(%rsp), %rdi
callq 0x3640
jmp 0x3f16
leaq 0x338(%rsp), %rdi
leaq 0x318(%rsp), %rsi
callq 0x3320
leaq 0x318(%rsp), %rdi
callq 0x31b0
movq 0x6081(%rip), %rdi      # 0x9fc0
leaq 0x30c6(%rip), %rsi      # 0x700c
callq 0x3290
jmp 0x3f4d
movq 0x606c(%rip), %rdi      # 0x9fc0
leaq 0x30b6(%rip), %rsi      # 0x7011
callq 0x3290
jmp 0x3f62
movq 0x6057(%rip), %rdi      # 0x9fc0
leaq 0x31d1(%rip), %rsi      # 0x7141
callq 0x3290
movq %rax, 0xb0(%rsp)
jmp 0x3f7f
movq 0xb0(%rsp), %rdi
leaq 0x338(%rsp), %rsi
callq 0x3260
movq %rax, 0xa8(%rsp)
jmp 0x3f9e
movq 0xa8(%rsp), %rdi
leaq 0x30fc(%rip), %rsi      # 0x70a9
callq 0x3290
jmp 0x3fb4
leaq 0x300(%rsp), %rdi
callq 0x4530
leaq 0x180(%rsp), %rdi
leaq 0x338(%rsp), %rsi
movl $0x8, %edx
callq 0x33f0
jmp 0x3fdd
leaq 0x160(%rsp), %rdi
callq 0x3360
leaq 0x180(%rsp), %rdi
leaq 0x160(%rsp), %rsi
movl $0x20, %edx
callq 0x3460
movq %rax, 0xa0(%rsp)
jmp 0x400e
movq 0xa0(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x3340
movb %al, 0x9f(%rsp)
jmp 0x402e
movb 0x9f(%rsp), %al
testb $0x1, %al
jne 0x403b
jmp 0x4086
leaq 0x300(%rsp), %rdi
leaq 0x160(%rsp), %rsi
callq 0x4a90
jmp 0x4052
jmp 0x3fea
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc60(%rsp)
movl %eax, 0xc5c(%rsp)
jmp 0x44ec
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc60(%rsp)
movl %eax, 0xc5c(%rsp)
jmp 0x44d2
leaq 0x300(%rsp), %rdi
callq 0x4b00
movl %eax, 0x15c(%rsp)
callq 0x3050
movq %rax, 0x150(%rsp)
leaq 0x130(%rsp), %rdi
movq %rdi, 0x90(%rsp)
callq 0x3360
movq 0x90(%rsp), %rsi
movq 0x5f0d(%rip), %rdi      # 0x9fd8
movl $0xa, %edx
callq 0x3460
jmp 0x40d7
callq 0x3050
movq %rax, 0x110(%rsp)
leaq 0x110(%rsp), %rdi
leaq 0x150(%rsp), %rsi
callq 0x4bd0
movq %rax, 0x88(%rsp)
jmp 0x4103
movq 0x88(%rsp), %rax
movq %rax, 0x118(%rsp)
leaq 0x118(%rsp), %rdi
callq 0x4ba0
movq %rax, 0x80(%rsp)
jmp 0x412a
movq 0x80(%rsp), %rax
movq %rax, 0x120(%rsp)
leaq 0x120(%rsp), %rdi
callq 0x4c20
movq %rax, 0x78(%rsp)
jmp 0x414e
movq 0x78(%rsp), %rax
cvtsi2ss %rax, %xmm0
movss %xmm0, 0x12c(%rsp)
movq 0x5e58(%rip), %rdi      # 0x9fc0
leaq 0x2fda(%rip), %rsi      # 0x7149
callq 0x3290
movq %rax, 0x70(%rsp)
jmp 0x417b
movq 0x70(%rsp), %rdi
movss 0x12c(%rsp), %xmm0
movss 0x2e73(%rip), %xmm1     # 0x7004
divss %xmm1, %xmm0
callq 0x3200
movq %rax, 0x68(%rsp)
jmp 0x41a1
movq 0x68(%rsp), %rdi
leaq 0x2fa9(%rip), %rsi      # 0x7156
callq 0x3290
jmp 0x41b4
movq 0x5e05(%rip), %rdi      # 0x9fc0
leaq 0x2f97(%rip), %rsi      # 0x7159
callq 0x3290
movq %rax, 0x60(%rsp)
jmp 0x41ce
movq 0x60(%rsp), %rdi
cvtsi2ssl 0x15c(%rsp), %xmm0
movss 0x12c(%rsp), %xmm1
movss 0x2e1b(%rip), %xmm2     # 0x7008
divss %xmm2, %xmm1
divss %xmm1, %xmm0
callq 0x3200
movq %rax, 0x58(%rsp)
jmp 0x4201
movq 0x58(%rsp), %rdi
leaq 0x2f56(%rip), %rsi      # 0x7163
callq 0x3290
jmp 0x4214
movl $0x0, 0x10c(%rsp)
leaq 0x130(%rsp), %rdi
callq 0x31e0
movq %rax, 0x50(%rsp)
leaq 0x338(%rsp), %rdi
callq 0x31e0
movq %rax, %rcx
movq 0x50(%rsp), %rax
cmpq %rcx, %rax
je 0x4385
leaq 0x130(%rsp), %rdi
callq 0x31e0
movl %eax, 0x4c(%rsp)
leaq 0x338(%rsp), %rdi
callq 0x31e0
movq %rax, %rcx
movl 0x4c(%rsp), %eax
subl %ecx, %eax
movl %eax, %ecx
negl %ecx
cmovnsl %ecx, %eax
addl 0x10c(%rsp), %eax
movl %eax, 0x10c(%rsp)
movl $0x0, 0x108(%rsp)
movl 0x108(%rsp), %eax
movl %eax, 0x48(%rsp)
leaq 0x130(%rsp), %rdi
callq 0x31e0
movl %eax, 0x44(%rsp)
leaq 0x338(%rsp), %rdi
callq 0x31e0
movl 0x44(%rsp), %ecx
movq %rax, %rdx
movl 0x48(%rsp), %eax
subl %edx, %ecx
movl %ecx, %edx
negl %edx
cmovnsl %edx, %ecx
cmpl %ecx, %eax
jg 0x4380
movslq 0x108(%rsp), %rsi
leaq 0x338(%rsp), %rdi
callq 0x3480
movq %rax, 0x38(%rsp)
jmp 0x42f7
movq 0x38(%rsp), %rax
movsbl (%rax), %eax
movl %eax, 0x2c(%rsp)
movslq 0x108(%rsp), %rsi
leaq 0x130(%rsp), %rdi
callq 0x3480
movq %rax, 0x30(%rsp)
jmp 0x431f
movl 0x2c(%rsp), %eax
movq 0x30(%rsp), %rcx
movsbl (%rcx), %ecx
cmpl %ecx, %eax
je 0x4368
movl 0x10c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x10c(%rsp)
jmp 0x4368
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc60(%rsp)
movl %eax, 0xc5c(%rsp)
leaq 0x130(%rsp), %rdi
callq 0x31b0
jmp 0x44d2
jmp 0x436a
movl 0x108(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x108(%rsp)
jmp 0x4296
jmp 0x4432
movl $0x0, 0x104(%rsp)
movl 0x104(%rsp), %eax
movl %eax, 0x28(%rsp)
leaq 0x338(%rsp), %rdi
callq 0x31e0
movq %rax, %rcx
movl 0x28(%rsp), %eax
cmpl %ecx, %eax
jge 0x4430
movslq 0x104(%rsp), %rsi
leaq 0x338(%rsp), %rdi
callq 0x3480
movq %rax, 0x20(%rsp)
jmp 0x43cf
movq 0x20(%rsp), %rax
movsbl (%rax), %eax
movl %eax, 0x14(%rsp)
movslq 0x104(%rsp), %rsi
leaq 0x130(%rsp), %rdi
callq 0x3480
movq %rax, 0x18(%rsp)
jmp 0x43f7
movl 0x14(%rsp), %eax
movq 0x18(%rsp), %rcx
movsbl (%rcx), %ecx
cmpl %ecx, %eax
je 0x4418
movl 0x10c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x10c(%rsp)
jmp 0x441a
movl 0x104(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x104(%rsp)
jmp 0x4390
jmp 0x4432
movq 0x5b87(%rip), %rdi      # 0x9fc0
leaq 0x2d28(%rip), %rsi      # 0x7168
callq 0x3290
movq %rax, 0x8(%rsp)
jmp 0x444c
movq 0x8(%rsp), %rdi
movl 0x10c(%rsp), %esi
callq 0x3400
movq %rax, (%rsp)
jmp 0x4463
movq (%rsp), %rdi
leaq 0x2bf0(%rip), %rsi      # 0x705e
callq 0x3290
jmp 0x4475
movl $0x0, 0x10c(%rsp)
movl $0xf4240, %edi          # imm = 0xF4240
callq 0x3370
jmp 0x448c
leaq 0x130(%rsp), %rdi
callq 0x31b0
leaq 0x160(%rsp), %rdi
callq 0x31b0
leaq 0x180(%rsp), %rdi
callq 0x3150
leaq 0x300(%rsp), %rdi
callq 0x4540
leaq 0x338(%rsp), %rdi
callq 0x31b0
jmp 0x3e4a
leaq 0x160(%rsp), %rdi
callq 0x31b0
leaq 0x180(%rsp), %rdi
callq 0x3150
leaq 0x300(%rsp), %rdi
callq 0x4540
leaq 0x338(%rsp), %rdi
callq 0x31b0
leaq 0xa50(%rsp), %rdi
callq 0x3080
leaq 0xc70(%rsp), %rdi
callq 0x31b0
movq 0xc60(%rsp), %rdi
callq 0x3410
nopl (%rax)