// File: /workspace/github_cpp_makefile_star2_O2/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 $0x708, %rsp            # imm = 0x708
movq %rdi, %rbx
leaq -0x90(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0x5485(%rip), %rdi      # 0x7fd0
leaq 0x253f(%rip), %rsi      # 0x5091
callq 0x21c0
leaq 0x2539(%rip), %rsi      # 0x5097
movq %rax, %rdi
callq 0x21c0
leaq 0x253b(%rip), %rsi      # 0x50a8
movq %rax, %rdi
callq 0x21c0
movq 0x5464(%rip), %rdi      # 0x7fe0
leaq -0xa0(%rbp), %rsi
callq 0x2030
cmpq $0x0, -0x98(%rbp)
je 0x30c5
xorps %xmm0, %xmm0
movaps %xmm0, -0x80(%rbp)
andq $0x0, -0x70(%rbp)
leaq -0x510(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
pushq $0x20
popq %rdx
callq 0x29f4
leaq -0x80(%rbp), %r14
leaq -0x510(%rbp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x39e8
movq %r15, %rdi
callq 0x293a
movq (%r14), %rsi
leaq -0xe0(%rbp), %rdi
callq 0x2280
leaq 0x2566(%rip), %rsi      # 0x5152
leaq -0x60(%rbp), %rdi
leaq -0x510(%rbp), %rdx
callq 0x3714
movq -0x80(%rbp), %rsi
movq -0x78(%rbp), %rax
subq %rsi, %rax
cmpq $0x21, %rax
jb 0x2c1a
addq $0x20, %rsi
leaq -0x60(%rbp), %rdi
callq 0x2100
leaq 0x2531(%rip), %rsi      # 0x5152
leaq -0xc0(%rbp), %rdi
leaq -0x510(%rbp), %rdx
callq 0x3714
movq -0x80(%rbp), %rsi
movq -0x78(%rbp), %rax
subq %rsi, %rax
cmpq $0x41, %rax
jb 0x2c55
addq $0x40, %rsi
leaq -0xc0(%rbp), %rdi
callq 0x2100
leaq 0x2451(%rip), %rsi      # 0x50ad
leaq -0x510(%rbp), %r14
leaq -0x730(%rbp), %rdx
movq %r14, %rdi
callq 0x3714
leaq -0x4f0(%rbp), %r15
leaq 0x2432(%rip), %rsi      # 0x50b2
leaq -0x2f0(%rbp), %rdx
movq %r15, %rdi
callq 0x3714
leaq -0x4d0(%rbp), %r15
leaq 0x241a(%rip), %rsi      # 0x50b7
leaq -0x30(%rbp), %rdx
movq %r15, %rdi
callq 0x3714
leaq -0x4b0(%rbp), %r15
leaq 0x2405(%rip), %rsi      # 0x50bc
leaq -0x29(%rbp), %rdx
movq %r15, %rdi
callq 0x3714
leaq -0x490(%rbp), %r15
leaq 0x23f0(%rip), %rsi      # 0x50c1
leaq -0x3d(%rbp), %rdx
movq %r15, %rdi
callq 0x3714
leaq -0x470(%rbp), %r15
leaq 0x23dc(%rip), %rsi      # 0x50c7
leaq -0x3c(%rbp), %rdx
movq %r15, %rdi
callq 0x3714
leaq -0x450(%rbp), %r15
leaq 0x23c8(%rip), %rsi      # 0x50cd
leaq -0x3b(%rbp), %rdx
movq %r15, %rdi
callq 0x3714
leaq -0x430(%rbp), %r15
leaq 0x23b5(%rip), %rsi      # 0x50d4
leaq -0x3a(%rbp), %rdx
movq %r15, %rdi
callq 0x3714
leaq -0x410(%rbp), %r15
leaq 0x23a0(%rip), %rsi      # 0x50d9
leaq -0x39(%rbp), %rdx
movq %r15, %rdi
callq 0x3714
leaq -0x3f0(%rbp), %r15
leaq 0x238a(%rip), %rsi      # 0x50dd
leaq -0x38(%rbp), %rdx
movq %r15, %rdi
callq 0x3714
leaq -0x3d0(%rbp), %r15
leaq 0x2376(%rip), %rsi      # 0x50e3
leaq -0x37(%rbp), %rdx
movq %r15, %rdi
callq 0x3714
leaq -0x3b0(%rbp), %r15
leaq 0x235a(%rip), %rsi      # 0x50e1
leaq -0x36(%rbp), %rdx
movq %r15, %rdi
callq 0x3714
leaq -0x390(%rbp), %r15
leaq 0x2346(%rip), %rsi      # 0x50e7
leaq -0x35(%rbp), %rdx
movq %r15, %rdi
callq 0x3714
leaq -0x370(%rbp), %r15
leaq 0x2332(%rip), %rsi      # 0x50ed
leaq -0x34(%rbp), %rdx
movq %r15, %rdi
callq 0x3714
leaq -0x350(%rbp), %r15
leaq 0x231e(%rip), %rsi      # 0x50f3
leaq -0x33(%rbp), %rdx
movq %r15, %rdi
callq 0x3714
leaq -0x330(%rbp), %r15
leaq 0x2308(%rip), %rsi      # 0x50f7
leaq -0x32(%rbp), %rdx
movq %r15, %rdi
callq 0x3714
leaq -0x310(%rbp), %r15
leaq 0x2349(%rip), %rsi      # 0x5152
leaq -0x31(%rbp), %rdx
movq %r15, %rdi
callq 0x3714
leaq 0x22e0(%rip), %rsi      # 0x50fc
leaq -0x730(%rbp), %r15
leaq -0x2f0(%rbp), %rdx
movq %r15, %rdi
callq 0x3714
leaq -0x710(%rbp), %r12
leaq 0x2272(%rip), %rsi      # 0x50b2
leaq -0x30(%rbp), %rdx
movq %r12, %rdi
callq 0x3714
leaq -0x6f0(%rbp), %r12
leaq 0x225d(%rip), %rsi      # 0x50b7
leaq -0x29(%rbp), %rdx
movq %r12, %rdi
callq 0x3714
leaq -0x6d0(%rbp), %r12
leaq 0x227d(%rip), %rsi      # 0x50f1
leaq -0x3d(%rbp), %rdx
movq %r12, %rdi
callq 0x3714
leaq -0x6b0(%rbp), %r12
leaq 0x2270(%rip), %rsi      # 0x50fe
leaq -0x3c(%rbp), %rdx
movq %r12, %rdi
callq 0x3714
leaq -0x690(%rbp), %r12
leaq 0x2233(%rip), %rsi      # 0x50db
leaq -0x3b(%rbp), %rdx
movq %r12, %rdi
callq 0x3714
leaq -0x670(%rbp), %r12
leaq 0x223e(%rip), %rsi      # 0x5100
leaq -0x3a(%rbp), %rdx
movq %r12, %rdi
callq 0x3714
leaq -0x650(%rbp), %r12
leaq 0x2226(%rip), %rsi      # 0x5102
leaq -0x39(%rbp), %rdx
movq %r12, %rdi
callq 0x3714
leaq -0x630(%rbp), %r12
leaq 0x220e(%rip), %rsi      # 0x5104
leaq -0x38(%rbp), %rdx
movq %r12, %rdi
callq 0x3714
leaq -0x610(%rbp), %r12
leaq 0x21cd(%rip), %rsi      # 0x50dd
leaq -0x37(%rbp), %rdx
movq %r12, %rdi
callq 0x3714
leaq -0x5f0(%rbp), %r12
leaq 0x21b9(%rip), %rsi      # 0x50e3
leaq -0x36(%rbp), %rdx
movq %r12, %rdi
callq 0x3714
leaq -0x5d0(%rbp), %r12
leaq 0x219d(%rip), %rsi      # 0x50e1
leaq -0x35(%rbp), %rdx
movq %r12, %rdi
callq 0x3714
leaq -0x5b0(%rbp), %r12
leaq 0x2189(%rip), %rsi      # 0x50e7
leaq -0x34(%rbp), %rdx
movq %r12, %rdi
callq 0x3714
leaq -0x590(%rbp), %r12
leaq 0x218e(%rip), %rsi      # 0x5106
leaq -0x33(%rbp), %rdx
movq %r12, %rdi
callq 0x3714
leaq -0x570(%rbp), %r12
leaq 0x2161(%rip), %rsi      # 0x50f3
leaq -0x32(%rbp), %rdx
movq %r12, %rdi
callq 0x3714
leaq -0x550(%rbp), %r12
leaq 0x215d(%rip), %rsi      # 0x5109
leaq -0x31(%rbp), %rdx
movq %r12, %rdi
callq 0x3714
leaq -0x530(%rbp), %r12
leaq 0x218c(%rip), %rsi      # 0x5152
leaq -0x3e(%rbp), %rdx
movq %r12, %rdi
callq 0x3714
xorl %r13d, %r13d
leaq -0xe0(%rbp), %r12
cmpq $0x10, %r13
je 0x30cd
movq %r14, %rdi
movq %r12, %rsi
callq 0x374f
testb %al, %al
jne 0x3011
movq %r15, %rdi
movq %r12, %rsi
callq 0x374f
testb %al, %al
jne 0x3011
incq %r13
addq $0x20, %r15
addq $0x20, %r14
jmp 0x2fdc
movl %r13d, %eax
leaq 0x2025(%rip), %rcx      # 0x5040
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq -0x2f0(%rbp), %rdi
callq 0x21f0
leaq 0x214a(%rip), %rsi      # 0x5181
leaq -0x2f0(%rbp), %rdi
pushq $0xa
popq %rdx
callq 0x2120
leaq -0x2f0(%rbp), %rdi
callq 0x2330
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 -0x2f0(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2230
movslq %r14d, %rdx
leaq -0x2f0(%rbp), %rdi
movq %rbx, %rsi
callq 0x2220
leaq -0x2f0(%rbp), %rdi
callq 0x2040
movq 0x4f2f(%rip), %rdi      # 0x7fd0
movq %rbx, %rsi
callq 0x21c0
movq %rax, %rdi
callq 0x20e0
movq %r15, %rsp
leaq -0x2f0(%rbp), %rdi
callq 0x2050
jmp 0x3459
pushq $0x1
popq %rbx
jmp 0x34c5
movq 0x4efc(%rip), %rdi      # 0x7fd0
leaq 0x2139(%rip), %rsi      # 0x5214
callq 0x21c0
leaq -0xe0(%rbp), %rsi
movq %rax, %rdi
callq 0x21a0
jmp 0x3451
movq %rbx, %rdi
callq 0x4654
jmp 0x3459
cmpq $0x0, -0x58(%rbp)
je 0x33f6
movq -0x60(%rbp), %rsi
movq %rbx, %rdi
callq 0x4588
jmp 0x3459
cmpq $0x0, -0x58(%rbp)
je 0x33ff
leaq -0x2f0(%rbp), %rdi
leaq -0x60(%rbp), %rsi
pushq $0x8
popq %rdx
callq 0x2300
leaq -0x2f0(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x2110
leaq -0x2f0(%rbp), %rdi
callq 0x20c0
movl -0x30(%rbp), %esi
movq %rbx, %rdi
callq 0x3ef8
movl %eax, %r14d
movq 0x4e64(%rip), %rdi      # 0x7fd0
leaq 0x2005(%rip), %rsi      # 0x5178
callq 0x21c0
movl -0x30(%rbp), %esi
movq %rax, %rdi
callq 0x2320
leaq 0x1fdd(%rip), %rsi      # 0x5167
movq %rax, %rdi
callq 0x21c0
cmpl $0x5, %r14d
ja 0x3516
movl %r14d, %esi
shlq $0x5, %rsi
addq 0x68(%rbx), %rsi
movq 0x4e22(%rip), %rdi      # 0x7fd0
callq 0x21a0
jmp 0x3534
cmpq $0x0, -0x58(%rbp)
je 0x3408
movq -0x60(%rbp), %rsi
movq %rbx, %rdi
callq 0x45b4
jmp 0x3459
cmpq $0x0, -0x58(%rbp)
je 0x3411
movq -0x60(%rbp), %rsi
movq %rbx, %rdi
callq 0x4530
jmp 0x3459
pushq $0x1
popq %rsi
pushq $0x2
popq %rdx
movq %rbx, %rdi
callq 0x4660
jmp 0x3459
movq %rbx, %rdi
callq 0x4658
jmp 0x3459
cmpq $0x0, -0x58(%rbp)
je 0x341a
leaq -0x2f0(%rbp), %rdi
leaq -0x60(%rbp), %rsi
pushq $0x8
popq %rdx
callq 0x2300
leaq -0x2f0(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x2110
leaq -0x2f0(%rbp), %rdi
callq 0x20c0
movl -0x30(%rbp), %esi
leaq -0x2f0(%rbp), %rdx
movq %rbx, %rdi
callq 0x3e70
xorl %r14d, %r14d
movq 0x4d6a(%rip), %rbx      # 0x7fd0
cmpq $0x200, %r14            # imm = 0x200
je 0x33e8
movsbl -0x2f0(%rbp,%r14), %esi
movq %rbx, %rdi
callq 0x2200
incq %r14
jmp 0x3266
pushq $0x1
popq %rbx
jmp 0x345b
movq %rbx, %rdi
callq 0x465c
jmp 0x3459
cmpq $0x0, -0x58(%rbp)
je 0x3423
leaq -0x2f0(%rbp), %rdi
leaq -0x60(%rbp), %rsi
pushq $0x8
popq %rdx
callq 0x2300
leaq -0x2f0(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x2110
leaq -0x2f0(%rbp), %rdi
callq 0x20c0
movl -0x30(%rbp), %esi
movq %rbx, %rdi
callq 0x3ef8
cmpl $0x1, %eax
jne 0x34e2
movq 0x4cdd(%rip), %rdi      # 0x7fd0
leaq 0x1e39(%rip), %rsi      # 0x5133
callq 0x21c0
movq 0x4cda(%rip), %rdi      # 0x7fe0
leaq -0x29(%rbp), %rsi
callq 0x2270
movb -0x29(%rbp), %al
andb $-0x21, %al
cmpb $0x59, %al
jne 0x3541
pushq $0x2e
popq %rdi
leaq -0x2f0(%rbp), %rsi
callq 0x2aa9
movl -0x30(%rbp), %esi
leaq -0x2f0(%rbp), %rdx
movq %rbx, %rdi
callq 0x3df4
jmp 0x3459
cmpq $0x0, -0x58(%rbp)
je 0x342c
leaq -0x2f0(%rbp), %rdi
leaq -0x60(%rbp), %rsi
pushq $0x2f
popq %rdx
callq 0x29f4
xorl %r14d, %r14d
xorl %r15d, %r15d
movq -0x2f0(%rbp), %rax
movq -0x2e8(%rbp), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
cmpq %r15, %rcx
jbe 0x33da
movq (%rax,%r14), %rsi
movq %rbx, %rdi
callq 0x45b4
incq %r15
addq $0x20, %r14
jmp 0x3366
movq %rbx, %rdi
callq 0x402c
jmp 0x3459
cmpq $0x0, -0x58(%rbp)
je 0x3435
movq -0x60(%rbp), %rsi
movq %rbx, %rdi
callq 0x455c
jmp 0x3459
cmpq $0x0, -0x58(%rbp)
je 0x343e
movq -0x60(%rbp), %rsi
movq -0xc0(%rbp), %rdx
movq %rbx, %rdi
callq 0x4530
jmp 0x3459
leaq -0x2f0(%rbp), %rdi
callq 0x293a
jmp 0x3459
movq 0x4be1(%rip), %rdi      # 0x7fd0
callq 0x20e0
jmp 0x3459
leaq 0x1dd7(%rip), %rsi      # 0x51d4
jmp 0x3445
leaq 0x1d4d(%rip), %rsi      # 0x5153
jmp 0x3445
leaq 0x1ddc(%rip), %rsi      # 0x51eb
jmp 0x3445
leaq 0x1d92(%rip), %rsi      # 0x51aa
jmp 0x3445
leaq 0x1ceb(%rip), %rsi      # 0x510c
jmp 0x3445
leaq 0x1cf5(%rip), %rsi      # 0x511f
jmp 0x3445
leaq 0x1dce(%rip), %rsi      # 0x5201
jmp 0x3445
leaq 0x1d83(%rip), %rsi      # 0x51bf
jmp 0x3445
leaq 0x1d45(%rip), %rsi      # 0x518a
movq 0x4b84(%rip), %rdi      # 0x7fd0
callq 0x21c0
movq %rax, %rdi
callq 0x20e0
xorl %ebx, %ebx
movl $0x200, %r14d           # imm = 0x200
leaq (%r14,%rbp), %rdi
addq $-0x730, %rdi           # imm = 0xF8D0
callq 0x20b0
addq $-0x20, %r14
cmpq $-0x20, %r14
jne 0x3461
movl $0x200, %r14d           # imm = 0x200
leaq (%r14,%rbp), %rdi
addq $-0x510, %rdi           # imm = 0xFAF0
callq 0x20b0
addq $-0x20, %r14
cmpq $-0x20, %r14
jne 0x3481
leaq -0xc0(%rbp), %rdi
callq 0x20b0
leaq -0x60(%rbp), %rdi
callq 0x20b0
leaq -0xe0(%rbp), %rdi
callq 0x20b0
leaq -0x80(%rbp), %rdi
callq 0x293a
leaq -0xa0(%rbp), %rdi
callq 0x20b0
movl %ebx, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x2e
popq %rdi
leaq -0x2f0(%rbp), %rsi
callq 0x2aa9
movl -0x30(%rbp), %esi
leaq -0x2f0(%rbp), %rdx
movq %rbx, %rdi
callq 0x3df4
movl -0x30(%rbp), %esi
pushq $0x1
popq %rdx
movq %rbx, %rdi
callq 0x3f90
jmp 0x3459
movq 0x4ab3(%rip), %rdi      # 0x7fd0
leaq 0x1c48(%rip), %rsi      # 0x516c
callq 0x21c0
movq %rax, %rdi
movl %r14d, %esi
callq 0x2320
movq %rax, %rdi
callq 0x20e0
jmp 0x3459
movq 0x4a98(%rip), %rdi      # 0x7fe0
pushq $0xa
popq %rdx
movl $0x7fff, %esi           # imm = 0x7FFF
callq 0x2130
jmp 0x3459
jmp 0x3662
jmp 0x3662
jmp 0x3568
jmp 0x3568
movq %rax, %rbx
leaq -0x2f0(%rbp), %rdi
callq 0x20c0
jmp 0x3665
jmp 0x3662
jmp 0x3662
jmp 0x3662
jmp 0x3662
jmp 0x3662
jmp 0x35a8
jmp 0x35a8
jmp 0x3662
jmp 0x3662
jmp 0x3662
movq %rax, %rbx
leaq -0x2f0(%rbp), %rdi
callq 0x2050
jmp 0x3665
jmp 0x364c
jmp 0x3651
jmp 0x3662
movq %rax, %rbx
leaq -0x2f0(%rbp), %rdi
callq 0x293a
jmp 0x3665
jmp 0x35fd
jmp 0x35fd
jmp 0x35fd
jmp 0x35fd
jmp 0x35fd
jmp 0x35fd
jmp 0x35fd
jmp 0x35fd
jmp 0x35fd
jmp 0x35fd
jmp 0x35fd
jmp 0x35fd
jmp 0x35fd
jmp 0x35fd
jmp 0x35fd
movq %rax, %rbx
addq $-0x20, %r12
movq %r12, %rdi
callq 0x20b0
cmpq %r15, %r12
jne 0x3600
jmp 0x3685
movq %rax, %rbx
jmp 0x3685
jmp 0x3636
jmp 0x3636
jmp 0x3636
jmp 0x3636
jmp 0x3636
jmp 0x3636
jmp 0x3636
jmp 0x3636
jmp 0x3636
jmp 0x3636
jmp 0x3636
jmp 0x3636
jmp 0x3636
jmp 0x3636
jmp 0x3636
movq %rax, %rbx
addq $-0x20, %r15
movq %r15, %rdi
callq 0x20b0
cmpq %r14, %r15
jne 0x3639
jmp 0x36a5
movq %rax, %rbx
jmp 0x36a5
movq %rax, %rbx
jmp 0x36b1
movq %rax, %rbx
jmp 0x36ba
jmp 0x365d
movq %rax, %rbx
jmp 0x36c6
movq %rax, %rbx
movl $0x200, %r14d           # imm = 0x200
leaq (%r14,%rbp), %rdi
addq $-0x730, %rdi           # imm = 0xF8D0
callq 0x20b0
addq $-0x20, %r14
cmpq $-0x20, %r14
jne 0x366b
movl $0x200, %r14d           # imm = 0x200
leaq (%r14,%rbp), %rdi
addq $-0x510, %rdi           # imm = 0xFAF0
callq 0x20b0
addq $-0x20, %r14
cmpq $-0x20, %r14
jne 0x368b
leaq -0xc0(%rbp), %rdi
callq 0x20b0
leaq -0x60(%rbp), %rdi
callq 0x20b0
leaq -0xe0(%rbp), %rdi
callq 0x20b0
leaq -0x80(%rbp), %rdi
callq 0x293a
leaq -0xa0(%rbp), %rdi
callq 0x20b0
movq %rbx, %rdi
callq 0x2340
movq %rax, %rbx
jmp 0x36cf