// File: /workspace/github_cpp_makefile_star2_O3/sidvishnoi[P]filesystem-assignment/handleInput.cpp
// Function: handleInput(FileSystem&)
int handleInput(FileSystem &disk) {
    /*
    objective: to create a terminal like CLI to handle disk operations
    input: reference to disk
    return:
        0: continue
        1: exit
    */
    string command;
    cout << KGRN << "(myFileSystem)> " << KRST;
    getline(cin, command);
    if (command.empty()) return 1;

    // split command into function and argument part
    vector<string> tokens;
    tokens = split(command, ' ');
    string fun = tokens[0];
    string arg = "";
    if (tokens.size() > 1) {
        arg = tokens[1];
    }

    string arg2 = "";
    if (tokens.size() > 2) {
        arg2 = tokens[2];
    }

    enum Choice {
        HELP, INFO, TREE, READ, CHECK, WRITE, FORMAT, EXIT, NEW_FILE, CAT, DEL, UNDEL, MKDIR, CD, PWD, LS, END
    };
    string CHOICES[] = {
        "help", "info", "tree", "read", "check", "write", "format", "exit", "new", "cat", "del", "undel", "mkdir", "chdir", "pwd", "list", ""
    };
    string choices[] = {
        "h", "info", "tree", "r", "c", "w", "f", "q", "n", "cat", "del", "undel", "mkdir", "cd", "pwd", "ls", ""
    };

    Choice selected = END;
    for (int i = 0; i < END; ++i) {
        if (CHOICES[i] == fun || choices[i] == fun) {
            selected = static_cast<Choice>(i);
            break;
        }
    }

    int sector;
    // handle command
    switch (selected) {
        case READ: {
            if (arg.empty()) {
                cout << "usage: read SECTOR" << endl;
                return 0;
            }
            // convert string to int
            istringstream(arg) >> sector;
            char readBuffer[kSectorSize_g];
            disk.readSector(sector, readBuffer);
            for (int i = 0; i < kSectorSize_g; ++i) {
                cout << readBuffer[i];
            }
            cout << endl;
            break;
        }
        case WRITE: {
            if (arg.empty()) {
                cout << "usage: write SECTOR" << endl;
                return 0;
            }
            istringstream(arg) >> sector;
            if (disk.getStatus(sector) == FileSystem::BUSY) {
                cout << "Overwrite sector data (y/n)? _\b";
                char t;
                cin >> t;
                if (t == 'y' || t == 'Y') {
                    char buf[kSectorSize_g];
                    createBuffer('.', buf);
                    disk.writeSector(sector, buf);
                } else {
                    cin.ignore(32767, '\n');
                    return 0;
                }
            } else {
                char buf[kSectorSize_g];
                createBuffer('.', buf);
                disk.writeSector(sector, buf);
                disk.setStatus(sector, 1);
            }
            break;
        }
        case CHECK: {
            if (arg.empty()) {
                cout << "usage: check SECTOR" << endl;
                return 0;
            }
            istringstream(arg) >> sector;
            int status = disk.getStatus(sector);
            cout << "sector #" << sector << " is ";
            if (status < disk.END && status > -1) {
                cout << disk.statusMsg[status] << endl;
            } else {
                cout << "pointing to sector #" << status << endl;
            }
            break;
        }
        case FORMAT:
            disk.format();
            break;
        case HELP: {
            ifstream helpFile;
            helpFile.open("help.txt", ios::in | ios::ate);
            int helpFileSize = helpFile.tellg();
            char helpMsg[helpFileSize];
            helpFile.seekg(0);
            helpFile.read(helpMsg, helpFileSize);
            helpFile.close();
            cout << helpMsg << endl;
            break;
        }
        case INFO:
            disk.info();
            break;
        case TREE:
            disk.tree();
            break;
        case NEW_FILE: {
            if (arg.empty()) {
                cout << "usage: new FILE_NAME [SRC_FILE]" << endl;
                return 0;
            }
            disk.createFile(arg.c_str(), arg2.c_str());
            break;
        }
        case CAT: {
            if (arg.empty()) {
                cout << "usage: cat FILE_NAME" << endl;
                return 0;
            }
            disk.readFile(arg.c_str());
            break;
        }
        case DEL: {
            if (arg.empty()) {
                cout << "usage: del FILE_NAME" << endl;
                return 0;
            }
            disk.deleteFile(arg.c_str());
            break;
        }
        case UNDEL: {
            if (arg.empty()) {
                cout << "usage: undel FILE_NAME" << endl;
                return 0;
            }
            disk.undeleteFile(arg.c_str());
            break;
        }
        case MKDIR: {
            if (arg.empty()) {
                cout << "usage: mkdir DIR_NAME" << endl;
                return 0;
            }
            disk.createDir(arg.c_str());
            break;
        }
        case CD: {
            if (arg.empty()) {
                cout << "usage: cd DIR_NAME" << endl;
                return 0;
            }
            vector<string> dir = split(arg, '/');
            for (int i = 0; i < dir.size(); ++i) {
                disk.changeDir(dir[i].c_str());
            }
            break;
        }
        case PWD:
            disk.printWorkingDir();
            break;
        case LS:
            disk.listDirectoryContents();
            break;
        case EXIT:
            return 1;
        default:
            cout << "(myFileSystem): command not found: " << fun << endl;
            return 0;
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x6f8, %rsp            # imm = 0x6F8
movq %rdi, -0x38(%rbp)
leaq -0xc8(%rbp), %r15
movq %r15, -0x10(%r15)
movq $0x0, -0x8(%r15)
movb $0x0, (%r15)
movq 0x52a1(%rip), %rdi      # 0x7fd0
leaq 0x239b(%rip), %rsi      # 0x50d1
movl $0x5, %edx
callq 0x2210
movq 0x5289(%rip), %rdi      # 0x7fd0
leaq 0x2389(%rip), %rsi      # 0x50d7
movl $0x10, %edx
callq 0x2210
movq 0x5271(%rip), %rdi      # 0x7fd0
leaq 0x2382(%rip), %rsi      # 0x50e8
movl $0x4, %edx
callq 0x2210
movq 0x5269(%rip), %rdi      # 0x7fe0
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %edx
movq 0x524e(%rip), %rdi      # 0x7fe0
leaq -0xd8(%rbp), %rsi
callq 0x2370
cmpq $0x0, -0xd0(%rbp)
je 0x35cd
xorps %xmm0, %xmm0
movaps %xmm0, -0x70(%rbp)
movq $0x0, -0x60(%rbp)
leaq -0x500(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
movl $0x20, %edx
callq 0x2b7c
movq -0x60(%rbp), %rax
leaq -0x500(%rbp), %r14
movaps (%r14), %xmm0
movq 0x10(%r14), %rcx
movq %rcx, -0x60(%rbp)
movaps -0x70(%rbp), %xmm1
movaps %xmm0, -0x70(%rbp)
leaq -0x720(%rbp), %rdi
movaps %xmm1, (%rdi)
movq %rax, 0x10(%rdi)
xorps %xmm0, %xmm0
movaps %xmm0, (%r14)
movq $0x0, 0x10(%r14)
callq 0x2a86
movq %r14, %rdi
callq 0x2a86
movq -0x70(%rbp), %rax
leaq -0x88(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq -0x98(%rbp), %rdi
callq 0x2ae4
leaq -0x48(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x2342(%rip), %rdx      # 0x5192
leaq -0x58(%rbp), %rdi
movq %rdx, %rsi
callq 0x3e0e
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rax
subq %rsi, %rax
cmpq $0x21, %rax
jb 0x2e7a
addq $0x20, %rsi
leaq -0x58(%rbp), %rdi
callq 0x20e0
leaq -0xa8(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x2306(%rip), %rdx      # 0x5192
leaq -0xb8(%rbp), %rdi
movq %rdx, %rsi
callq 0x3e0e
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rax
subq %rsi, %rax
cmpq $0x41, %rax
jb 0x2ebc
addq $0x40, %rsi
leaq -0xb8(%rbp), %rdi
callq 0x20e0
leaq -0x710(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x221f(%rip), %rsi      # 0x50ed
leaq 0x221c(%rip), %rdx      # 0x50f1
leaq -0x720(%rbp), %r14
movq %r14, %rdi
callq 0x3e0e
leaq -0x700(%rbp), %r15
leaq -0x6f0(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x21f5(%rip), %rsi      # 0x50f2
leaq 0x21f2(%rip), %rdx      # 0x50f6
movq %r15, %rdi
callq 0x3e0e
leaq -0x6e0(%rbp), %r15
leaq -0x6d0(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x21d2(%rip), %rsi      # 0x50f7
leaq 0x21cf(%rip), %rdx      # 0x50fb
movq %r15, %rdi
callq 0x3e0e
leaq -0x6c0(%rbp), %r15
leaq -0x6b0(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x21af(%rip), %rsi      # 0x50fc
leaq 0x21ac(%rip), %rdx      # 0x5100
movq %r15, %rdi
callq 0x3e0e
leaq -0x6a0(%rbp), %r15
leaq -0x690(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x218c(%rip), %rsi      # 0x5101
leaq 0x218a(%rip), %rdx      # 0x5106
movq %r15, %rdi
callq 0x3e0e
leaq -0x680(%rbp), %r15
leaq -0x670(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x216a(%rip), %rsi      # 0x5107
leaq 0x2168(%rip), %rdx      # 0x510c
movq %r15, %rdi
callq 0x3e0e
leaq -0x660(%rbp), %r15
leaq -0x650(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x2148(%rip), %rsi      # 0x510d
leaq 0x2147(%rip), %rdx      # 0x5113
movq %r15, %rdi
callq 0x3e0e
leaq -0x640(%rbp), %r15
leaq -0x630(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x2127(%rip), %rsi      # 0x5114
leaq 0x2124(%rip), %rdx      # 0x5118
movq %r15, %rdi
callq 0x3e0e
leaq -0x620(%rbp), %r15
leaq -0x610(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x2104(%rip), %rsi      # 0x5119
leaq 0x2100(%rip), %rdx      # 0x511c
movq %r15, %rdi
callq 0x3e0e
leaq -0x600(%rbp), %r15
leaq -0x5f0(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x20e0(%rip), %rsi      # 0x511d
leaq 0x20dc(%rip), %rdx      # 0x5120
movq %r15, %rdi
callq 0x3e0e
leaq -0x5e0(%rbp), %r15
leaq -0x5d0(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x20be(%rip), %rsi      # 0x5123
leaq 0x20ba(%rip), %rdx      # 0x5126
movq %r15, %rdi
callq 0x3e0e
leaq -0x5c0(%rbp), %r15
leaq -0x5b0(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x2094(%rip), %rsi      # 0x5121
leaq 0x2092(%rip), %rdx      # 0x5126
movq %r15, %rdi
callq 0x3e0e
leaq -0x5a0(%rbp), %r15
leaq -0x590(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x2072(%rip), %rsi      # 0x5127
leaq 0x2070(%rip), %rdx      # 0x512c
movq %r15, %rdi
callq 0x3e0e
leaq -0x580(%rbp), %r15
leaq -0x570(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x2050(%rip), %rsi      # 0x512d
leaq 0x204e(%rip), %rdx      # 0x5132
movq %r15, %rdi
callq 0x3e0e
leaq -0x560(%rbp), %r15
leaq -0x550(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x202e(%rip), %rsi      # 0x5133
leaq 0x202a(%rip), %rdx      # 0x5136
movq %r15, %rdi
callq 0x3e0e
leaq -0x540(%rbp), %r15
leaq -0x530(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x200a(%rip), %rsi      # 0x5137
leaq 0x2007(%rip), %rdx      # 0x513b
movq %r15, %rdi
callq 0x3e0e
leaq -0x520(%rbp), %r15
leaq -0x510(%rbp), %r13
movq %r13, -0x10(%r13)
leaq 0x203d(%rip), %rdx      # 0x5192
movq %r15, %rdi
movq %rdx, %rsi
callq 0x3e0e
leaq -0x4f0(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x1fca(%rip), %rsi      # 0x513c
leaq 0x1fc4(%rip), %rdx      # 0x513d
leaq -0x500(%rbp), %r14
movq %r14, %rdi
callq 0x3e0e
leaq -0x4e0(%rbp), %r15
leaq -0x4d0(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x1f51(%rip), %rsi      # 0x50f2
leaq 0x1f4e(%rip), %rdx      # 0x50f6
movq %r15, %rdi
callq 0x3e0e
leaq -0x4c0(%rbp), %r15
leaq -0x4b0(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x1f2e(%rip), %rsi      # 0x50f7
leaq 0x1f2b(%rip), %rdx      # 0x50fb
movq %r15, %rdi
callq 0x3e0e
leaq -0x4a0(%rbp), %r15
leaq -0x490(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x1f40(%rip), %rsi      # 0x5131
leaq 0x1f3a(%rip), %rdx      # 0x5132
movq %r15, %rdi
callq 0x3e0e
leaq -0x480(%rbp), %r15
leaq -0x470(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x1f25(%rip), %rsi      # 0x513e
leaq 0x1f1f(%rip), %rdx      # 0x513f
movq %r15, %rdi
callq 0x3e0e
leaq -0x460(%rbp), %r15
leaq -0x450(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x1eda(%rip), %rsi      # 0x511b
leaq 0x1ed4(%rip), %rdx      # 0x511c
movq %r15, %rdi
callq 0x3e0e
leaq -0x440(%rbp), %r15
leaq -0x430(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x1ed7(%rip), %rsi      # 0x5140
leaq 0x1ed1(%rip), %rdx      # 0x5141
movq %r15, %rdi
callq 0x3e0e
leaq -0x420(%rbp), %r15
leaq -0x410(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x1eb1(%rip), %rsi      # 0x5142
leaq 0x1eab(%rip), %rdx      # 0x5143
movq %r15, %rdi
callq 0x3e0e
leaq -0x400(%rbp), %r15
leaq -0x3f0(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x1e8b(%rip), %rsi      # 0x5144
leaq 0x1e85(%rip), %rdx      # 0x5145
movq %r15, %rdi
callq 0x3e0e
leaq -0x3e0(%rbp), %r15
leaq -0x3d0(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x1e3c(%rip), %rsi      # 0x511d
leaq 0x1e38(%rip), %rdx      # 0x5120
movq %r15, %rdi
callq 0x3e0e
leaq -0x3c0(%rbp), %r15
leaq -0x3b0(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x1e1a(%rip), %rsi      # 0x5123
leaq 0x1e16(%rip), %rdx      # 0x5126
movq %r15, %rdi
callq 0x3e0e
leaq -0x3a0(%rbp), %r15
leaq -0x390(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x1df0(%rip), %rsi      # 0x5121
leaq 0x1dee(%rip), %rdx      # 0x5126
movq %r15, %rdi
callq 0x3e0e
leaq -0x380(%rbp), %r15
leaq -0x370(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x1dce(%rip), %rsi      # 0x5127
leaq 0x1dcc(%rip), %rdx      # 0x512c
movq %r15, %rdi
callq 0x3e0e
leaq -0x360(%rbp), %r15
leaq -0x350(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x1dc5(%rip), %rsi      # 0x5146
leaq 0x1dc0(%rip), %rdx      # 0x5148
movq %r15, %rdi
callq 0x3e0e
leaq -0x340(%rbp), %r15
leaq -0x330(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x1d8a(%rip), %rsi      # 0x5133
leaq 0x1d86(%rip), %rdx      # 0x5136
movq %r15, %rdi
callq 0x3e0e
leaq -0x320(%rbp), %r15
leaq -0x310(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x1d78(%rip), %rsi      # 0x5149
leaq 0x1d73(%rip), %rdx      # 0x514b
movq %r15, %rdi
callq 0x3e0e
leaq -0x300(%rbp), %r15
leaq -0x2f0(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x1d98(%rip), %rdx      # 0x5192
movq %r15, %rdi
movq %rdx, %rsi
callq 0x3e0e
movq -0x98(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x90(%rbp), %r15
movl $0x8, %r14d
xorl %ebx, %ebx
cmpq %r15, -0x720(%rbp,%r14)
jne 0x344e
testq %r15, %r15
je 0x34e7
movq -0x728(%rbp,%r14), %rdi
movq -0x78(%rbp), %rsi
movq %r15, %rdx
callq 0x21f0
testl %eax, %eax
je 0x34e7
cmpq %r15, -0x500(%rbp,%r14)
jne 0x3479
testq %r15, %r15
je 0x34e7
movq -0x508(%rbp,%r14), %rdi
movq -0x78(%rbp), %rsi
movq %r15, %rdx
callq 0x21f0
testl %eax, %eax
je 0x34e7
incq %rbx
addq $0x20, %r14
cmpq $0x10, %rbx
jne 0x341f
movq 0x4b43(%rip), %rdi      # 0x7fd0
leaq 0x1dc0(%rip), %rsi      # 0x5254
movl $0x23, %edx
callq 0x2210
movq -0x98(%rbp), %rsi
movq -0x90(%rbp), %rdx
movq 0x4b1d(%rip), %rdi      # 0x7fd0
callq 0x2210
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2130
jmp 0x3a0e
movl %ebx, %eax
leaq 0x1b90(%rip), %rcx      # 0x5080
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq -0x2e0(%rbp), %rdi
callq 0x2200
leaq 0x1cb5(%rip), %rsi      # 0x51c1
leaq -0x2e0(%rbp), %rdi
movl $0xa, %edx
callq 0x2110
leaq -0x2e0(%rbp), %rdi
callq 0x2340
movq %rax, %r14
movq %rsp, %r15
movl %r14d, %eax
movq %rsp, %rbx
addq $0xf, %rax
andq $-0x10, %rax
subq %rax, %rbx
movq %rbx, %rsp
leaq -0x2e0(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2240
movslq %r14d, %rdx
leaq -0x2e0(%rbp), %rdi
movq %rbx, %rsi
callq 0x2230
leaq -0x2e0(%rbp), %rdi
callq 0x2040
movq %rbx, %rdi
callq 0x20a0
movq 0x4a50(%rip), %r14      # 0x7fd0
movq %r14, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x2210
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq 0x4a24(%rip), %rdi      # 0x7fd0
callq 0x2030
movq %rax, %rdi
callq 0x2130
movq %r15, %rsp
leaq -0x2e0(%rbp), %rdi
callq 0x2050
jmp 0x3a0e
movl $0x1, %ebx
jmp 0x3aca
movq -0x38(%rbp), %rdi
callq 0x4ed4
jmp 0x3a0e
cmpq $0x0, -0x50(%rbp)
je 0x397a
movq -0x58(%rbp), %rsi
movq -0x38(%rbp), %rdi
callq 0x4dd8
jmp 0x3a0e
cmpq $0x0, -0x50(%rbp)
je 0x3988
leaq -0x2e0(%rbp), %rdi
leaq -0x58(%rbp), %rsi
movl $0x8, %edx
callq 0x2310
leaq -0x2e0(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x2100
movq -0x38(%rbp), %rbx
movq 0x498b(%rip), %rsi      # 0x7fc8
leaq -0x2e0(%rbp), %rdi
callq 0x2290
leaq -0x268(%rbp), %rdi
callq 0x2070
movl -0x30(%rbp), %esi
movq %rbx, %rdi
callq 0x46dc
movl %eax, %r14d
movq 0x4966(%rip), %rdi      # 0x7fd0
leaq 0x1b47(%rip), %rsi      # 0x51b8
movl $0x8, %edx
callq 0x2210
movl -0x30(%rbp), %esi
movq 0x494b(%rip), %rdi      # 0x7fd0
callq 0x2330
leaq 0x1b16(%rip), %rsi      # 0x51a7
movl $0x4, %edx
movq %rax, %rdi
callq 0x2210
cmpl $0x5, %r14d
ja 0x3b2e
movl %r14d, %eax
movq 0x68(%rbx), %rcx
shlq $0x5, %rax
movq (%rcx,%rax), %rsi
movq 0x8(%rcx,%rax), %rdx
movq 0x490d(%rip), %rdi      # 0x7fd0
callq 0x2210
jmp 0x3b55
cmpq $0x0, -0x50(%rbp)
je 0x3996
movq -0x58(%rbp), %rsi
movq -0x38(%rbp), %rdi
callq 0x4e08
jmp 0x3a0e
cmpq $0x0, -0x50(%rbp)
je 0x39a4
movq -0x58(%rbp), %rsi
movq -0x38(%rbp), %rdi
callq 0x4d78
jmp 0x3a0e
movq -0x38(%rbp), %rdi
movl $0x1, %esi
movl $0x2, %edx
callq 0x4ee0
jmp 0x3a0e
movq -0x38(%rbp), %rdi
callq 0x4ed8
jmp 0x3a0e
cmpq $0x0, -0x50(%rbp)
je 0x39b2
leaq -0x2e0(%rbp), %rdi
leaq -0x58(%rbp), %rsi
movl $0x8, %edx
callq 0x2310
leaq -0x2e0(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x2100
movq -0x38(%rbp), %rbx
movq 0x4860(%rip), %rsi      # 0x7fc8
leaq -0x2e0(%rbp), %rdi
callq 0x2290
leaq -0x268(%rbp), %rdi
callq 0x2070
movl -0x30(%rbp), %esi
leaq -0x2e0(%rbp), %rdx
movq %rbx, %rdi
callq 0x464c
xorl %r15d, %r15d
movq 0x4834(%rip), %rbx      # 0x7fd0
leaq -0x29(%rbp), %r14
movb -0x2e0(%rbp,%r15), %al
movb %al, -0x29(%rbp)
movl $0x1, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2210
incq %r15
cmpq $0x200, %r15            # imm = 0x200
jne 0x37a0
movq 0x4802(%rip), %rdi      # 0x7fd0
callq 0x20c0
jmp 0x3a0e
movl $0x1, %ebx
jmp 0x3a10
movq -0x38(%rbp), %rdi
callq 0x4edc
jmp 0x3a0e
cmpq $0x0, -0x50(%rbp)
je 0x39c0
leaq -0x2e0(%rbp), %rdi
leaq -0x58(%rbp), %rsi
movl $0x8, %edx
callq 0x2310
leaq -0x2e0(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x2100
movq -0x38(%rbp), %rbx
movq 0x479d(%rip), %rsi      # 0x7fc8
leaq -0x2e0(%rbp), %rdi
callq 0x2290
leaq -0x268(%rbp), %rdi
callq 0x2070
movl -0x30(%rbp), %esi
movq %rbx, %rdi
callq 0x46dc
cmpl $0x1, %eax
jne 0x3af6
movq 0x4772(%rip), %rdi      # 0x7fd0
leaq 0x190e(%rip), %rsi      # 0x5173
movl $0x1f, %edx
callq 0x2210
movq 0x476a(%rip), %rdi      # 0x7fe0
leaq -0x29(%rbp), %rsi
callq 0x2270
movb -0x29(%rbp), %al
andb $-0x21, %al
cmpb $0x59, %al
jne 0x3b62
leaq -0x2e0(%rbp), %rsi
movl $0x2e, %edi
callq 0x2c83
movl -0x30(%rbp), %esi
leaq -0x2e0(%rbp), %rdx
movq %rbx, %rdi
callq 0x45a0
jmp 0x3a0e
cmpq $0x0, -0x50(%rbp)
je 0x39ce
leaq -0x2e0(%rbp), %rdi
leaq -0x58(%rbp), %rsi
movl $0x2f, %edx
callq 0x2b7c
movq -0x2e0(%rbp), %rax
cmpq %rax, -0x2d8(%rbp)
movq -0x38(%rbp), %r15
je 0x391a
xorl %ebx, %ebx
xorl %r14d, %r14d
movq (%rax,%rbx), %rsi
movq %r15, %rdi
callq 0x4e08
incq %r14
movq -0x2e0(%rbp), %rax
movq -0x2d8(%rbp), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
addq $0x20, %rbx
cmpq %r14, %rcx
ja 0x38ed
leaq -0x2e0(%rbp), %rdi
callq 0x2a86
jmp 0x3a0e
movq -0x38(%rbp), %rdi
callq 0x4888
jmp 0x3a0e
cmpq $0x0, -0x50(%rbp)
je 0x39dc
movq -0x58(%rbp), %rsi
movq -0x38(%rbp), %rdi
callq 0x4da8
jmp 0x3a0e
cmpq $0x0, -0x50(%rbp)
je 0x39ea
movq -0x58(%rbp), %rsi
movq -0xb8(%rbp), %rdx
movq -0x38(%rbp), %rdi
callq 0x4d78
jmp 0x3a0e
movl $0x16, %edx
leaq 0x188e(%rip), %rsi      # 0x5214
jmp 0x39f6
movl $0x13, %edx
leaq 0x17ff(%rip), %rsi      # 0x5193
jmp 0x39f6
movl $0x15, %edx
leaq 0x1889(%rip), %rsi      # 0x522b
jmp 0x39f6
movl $0x14, %edx
leaq 0x183a(%rip), %rsi      # 0x51ea
jmp 0x39f6
movl $0x12, %edx
leaq 0x178e(%rip), %rsi      # 0x514c
jmp 0x39f6
movl $0x13, %edx
leaq 0x1793(%rip), %rsi      # 0x515f
jmp 0x39f6
movl $0x12, %edx
leaq 0x1867(%rip), %rsi      # 0x5241
jmp 0x39f6
movl $0x14, %edx
leaq 0x1817(%rip), %rsi      # 0x51ff
jmp 0x39f6
movl $0x1f, %edx
leaq 0x17d4(%rip), %rsi      # 0x51ca
movq 0x45d3(%rip), %rdi      # 0x7fd0
callq 0x2210
movq 0x45c7(%rip), %rdi      # 0x7fd0
callq 0x20c0
xorl %ebx, %ebx
movq $-0x220, %r14           # imm = 0xFDE0
movq -0x10(%r12), %rdi
cmpq %rdi, %r12
je 0x3a2d
movq (%r12), %rsi
incq %rsi
callq 0x21e0
addq $-0x20, %r12
addq $0x20, %r14
jne 0x3a17
movq $-0x220, %r14           # imm = 0xFDE0
leaq -0xc8(%rbp), %r15
leaq -0x88(%rbp), %r12
movq -0x10(%r13), %rdi
cmpq %rdi, %r13
je 0x3a61
movq (%r13), %rsi
incq %rsi
callq 0x21e0
addq $-0x20, %r13
addq $0x20, %r14
jne 0x3a4c
movq -0xb8(%rbp), %rdi
leaq -0xa8(%rbp), %rax
cmpq %rax, %rdi
je 0x3a8d
movq -0xa8(%rbp), %rsi
incq %rsi
callq 0x21e0
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x3aa6
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x21e0
movq -0x98(%rbp), %rdi
cmpq %r12, %rdi
je 0x3ac1
movq -0x88(%rbp), %rsi
incq %rsi
callq 0x21e0
leaq -0x70(%rbp), %rdi
callq 0x2a86
movq -0xd8(%rbp), %rdi
cmpq %r15, %rdi
je 0x3ae5
movq -0xc8(%rbp), %rsi
incq %rsi
callq 0x21e0
movl %ebx, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq -0x2e0(%rbp), %rsi
movl $0x2e, %edi
callq 0x2c83
movl -0x30(%rbp), %esi
leaq -0x2e0(%rbp), %rdx
movq %rbx, %rdi
callq 0x45a0
movl -0x30(%rbp), %esi
movq %rbx, %rdi
movl $0x1, %edx
callq 0x47bc
jmp 0x3a0e
movq 0x449b(%rip), %rdi      # 0x7fd0
leaq 0x1670(%rip), %rsi      # 0x51ac
movl $0x14, %edx
callq 0x2210
movq 0x4483(%rip), %rdi      # 0x7fd0
movl %r14d, %esi
callq 0x2330
movq %rax, %rdi
callq 0x20c0
jmp 0x3a0e
movq 0x4477(%rip), %rdi      # 0x7fe0
movl $0x7fff, %esi           # imm = 0x7FFF
movl $0xa, %edx
callq 0x2120
jmp 0x3a0e
jmp 0x3cd5
jmp 0x3cd5
jmp 0x3b8b
jmp 0x3b8b
movq %rax, %rbx
movq 0x4433(%rip), %rsi      # 0x7fc8
leaq -0x2e0(%rbp), %rdi
callq 0x2290
leaq -0x268(%rbp), %rdi
callq 0x2070
jmp 0x3cd8
jmp 0x3cd5
jmp 0x3cd5
jmp 0x3cd5
jmp 0x3cd5
jmp 0x3cd5
jmp 0x3bde
jmp 0x3bde
jmp 0x3cd5
jmp 0x3cd5
jmp 0x3cd5
movq %rax, %rbx
leaq -0x2e0(%rbp), %rdi
callq 0x2050
jmp 0x3cd8
jmp 0x3cb6
jmp 0x3cbb
movq %rax, %rbx
leaq -0x2e0(%rbp), %rdi
callq 0x2a86
jmp 0x3cd8
jmp 0x3cd5
jmp 0x3c33
jmp 0x3c33
jmp 0x3c33
jmp 0x3c33
jmp 0x3c33
jmp 0x3c33
jmp 0x3c33
jmp 0x3c33
jmp 0x3c33
jmp 0x3c33
jmp 0x3c33
jmp 0x3c33
jmp 0x3c33
jmp 0x3c33
jmp 0x3c33
movq %rax, %rbx
addq $-0x10, %r15
movq -0x10(%r15), %rdi
cmpq %rdi, %r15
je 0x3c4e
movq (%r15), %rsi
incq %rsi
callq 0x21e0
leaq -0x20(%r15), %rax
addq $-0x10, %r15
cmpq %r14, %r15
movq %rax, %r15
jne 0x3c3a
jmp 0x3d04
movq %rax, %rbx
jmp 0x3d04
jmp 0x3c89
jmp 0x3c89
jmp 0x3c89
jmp 0x3c89
jmp 0x3c89
jmp 0x3c89
jmp 0x3c89
jmp 0x3c89
jmp 0x3c89
jmp 0x3c89
jmp 0x3c89
jmp 0x3c89
jmp 0x3c89
jmp 0x3c89
jmp 0x3c89
movq %rax, %rbx
addq $-0x10, %r15
movq -0x10(%r15), %rdi
cmpq %rdi, %r15
je 0x3ca4
movq (%r15), %rsi
incq %rsi
callq 0x21e0
leaq -0x20(%r15), %rax
addq $-0x10, %r15
cmpq %r14, %r15
movq %rax, %r15
jne 0x3c90
jmp 0x3d30
movq %rax, %rbx
jmp 0x3d30
movq %rax, %rbx
jmp 0x3d52
movq %rax, %rbx
jmp 0x3d6b
jmp 0x3ccd
movq %rax, %rbx
jmp 0x3d8d
movq %rax, %rbx
xorl %r14d, %r14d
movq -0x300(%rbp,%r14), %rdi
leaq (%r12,%r14), %rax
cmpq %rdi, %rax
je 0x3cf7
movq (%rax), %rsi
incq %rsi
callq 0x21e0
addq $-0x20, %r14
cmpq $-0x220, %r14           # imm = 0xFDE0
jne 0x3cdb
xorl %r14d, %r14d
movq -0x520(%rbp,%r14), %rdi
leaq (%r14,%r13), %rax
cmpq %rdi, %rax
je 0x3d23
movq (%rax), %rsi
incq %rsi
callq 0x21e0
addq $-0x20, %r14
cmpq $-0x220, %r14           # imm = 0xFDE0
jne 0x3d07
movq -0xb8(%rbp), %rdi
leaq -0xa8(%rbp), %rax
cmpq %rax, %rdi
je 0x3d52
movq -0xa8(%rbp), %rsi
incq %rsi
callq 0x21e0
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x3d6b
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x21e0
movq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rax
cmpq %rax, %rdi
je 0x3d8d
movq -0x88(%rbp), %rsi
incq %rsi
callq 0x21e0
leaq -0x70(%rbp), %rdi
callq 0x2a86
movq -0xd8(%rbp), %rdi
leaq -0xc8(%rbp), %rax
cmpq %rax, %rdi
je 0x3db8
movq -0xc8(%rbp), %rsi
incq %rsi
callq 0x21e0
movq %rbx, %rdi
callq 0x2350
movq %rax, %rbx
jmp 0x3d96
nop