// File: lianxings[P]ftp_benchmark/ftp_benchmark.cc
// Function: main
int main(int argc, char *argv[])
{
    if (argc == 1) {
        usage(argv[0]);
        return -1;
    }

    string srcDirPath = "";
    string dstDirPath = "";
    string sizeStr = "";
    int threadNum = 8;
    bool recursively = false;
    ftpInfo * pFtp = new ftpInfo();
    recvParam * pRecv = new recvParam();
    char optchar;

    gFtpDebug = false;
    while ((optchar = getopt(argc, argv, "s:d:t:r:n:u:p:w:l:f:S:vih")) != -1) {
        switch(optchar) {
        case 's':
            srcDirPath = optarg;
            break;
        case 'd':
            dstDirPath =  optarg;
            break;
        case 't':
            threadNum = atoi(optarg);
            break;
        case 'i':
            gFtpDebug = true;
            break;
        case 'r':
            recursively = true;
            break;
        case 'n':
            pFtp->ftpServer = optarg;
            break;
        case 'u':
            pFtp->user = optarg;
            pRecv->testName = optarg;
            break;
        case 'p':
            pFtp->pass = optarg;
            break;
        case 'w':
            pRecv->width = atoi(optarg);
            break;
        case 'l':
            pRecv->layer = atoi(optarg);
            break;
        case 'f':
            pRecv->fileNum = atoi(optarg);
            break;
        case 'S':
            sizeStr = optarg;
            break;
        case 'v':
            pRecv->verify = true;
            break;
        case 'h':
            usage(argv[0]);
            exit(0);
        default:
            fprintf(stderr, "unkown option: %c\n", optchar);
            return -1;
        }
    }

    if (pFtp->ftpServer == NULL || strlen(pFtp->ftpServer) == 0) {
        fprintf(stderr, "ftp server not specified.\n");
        return -1;
    }

    if (pFtp->user == NULL || strlen(pFtp->user) == 0) {
        fprintf(stderr, "ftp user not specified.\n");
        return -1;
    }

    if (pFtp->pass == NULL || strlen(pFtp->pass) == 0) {
        fprintf(stderr, "ftp password not specified.\n");
        return -1;
    }

    if (srcDirPath.empty()) {
        fprintf(stderr, "source directory path not specified.\n");
        return -1;
    }

    if (dstDirPath.empty()) {
        fprintf(stderr, " destination directory path not specified.\n");
        return -1;
    }

    if (srcDirPath.compare("null") == 0) {
        if (pRecv->fileNum < 0) {
            fprintf(stderr, " source path is %s, please specify the number of file by option '-f'.\n", srcDirPath.c_str());
            return -1;
        }
        if (sizeStr == "") {
            fprintf(stderr, " source path is %s, please specify file size by option '-S'.\n", srcDirPath.c_str());
            return -1;
        }
        if (pRecv->width < 0) {
            fprintf(stderr, " source path is %s, please specify directry width by option '-w'.\n", srcDirPath.c_str());
            return -1;
        }
        if (pRecv->layer < 0) {
            fprintf(stderr, " source path is %s, please specify directory layer by option '-l'.\n", srcDirPath.c_str());
            return -1;
        }
        size_t colonLoc = sizeStr.find_first_of(":");
		if (colonLoc == std::string::npos) {
            pRecv->fileSize = string_to_size(sizeStr.c_str());
		} else {
			pRecv->minSize = string_to_size(sizeStr.substr(0, colonLoc).c_str());
		    pRecv->maxSize = string_to_size(sizeStr.substr(colonLoc+1).c_str());
	        if ((pRecv->minSize < 0) || (pRecv->maxSize <= 0) || (pRecv->minSize > pRecv->maxSize)) {
	            printf("the value of sizerange is invalid: minsize is %ld, maxsize is %ld.\n", 
					pRecv->minSize, pRecv->maxSize);
				return 0;
	        }
	        pRecv->fileSize = pRecv->maxSize;
		}
    }

    // parse source path and destination path and get the compound mode
    string srcLocation, dstLocation;
    string realSrcPath, realDstPath;
    int compoundMode = 0;  // 1: local to ftp, 2: ftp to local, 3: ftp to null
    int colonLoc = 0;
    colonLoc = srcDirPath.find(":");
    if (colonLoc != std::string::npos) {
        srcLocation = srcDirPath.substr(0, colonLoc);
        realSrcPath = srcDirPath.substr(colonLoc + 1, srcDirPath.size() - colonLoc - 1);
    } else {
        if (srcDirPath.compare("null") != 0) {
            fprintf(stderr, "the format of source path %s is invalid.\n\n", srcDirPath.c_str());
            usage(argv[0]);
            return -1;
        } else {
            realSrcPath = srcDirPath;
        }
    }

    if (dstDirPath.compare("null") != 0) {
        if (dstDirPath.at(dstDirPath.size() - 1) != '/') {
            dstDirPath.push_back('/');
        }
    }

    colonLoc = dstDirPath.find(":");
    if (colonLoc != std::string::npos) {
        dstLocation = dstDirPath.substr(0, colonLoc);
        realDstPath = dstDirPath.substr(colonLoc + 1, dstDirPath.size() - colonLoc - 1);
    } else {
        if (dstDirPath.compare("null") != 0) {
            fprintf(stderr, "the format of destination path %s is invalid.\n\n ", dstDirPath.c_str());
            usage(argv[0]);
            return -1;
        } else {
            realDstPath = dstDirPath;
        }
    }

    if ((srcLocation.compare("local") == 0) && (dstLocation.compare("ftp") == 0)) {
        compoundMode = 1;
    } else if ((srcLocation.compare("ftp") == 0) && (dstLocation.compare("local") == 0)) {
        compoundMode = 2;
    } else if ((srcLocation.compare("ftp") == 0) && (dstDirPath.compare("null") == 0)) {
        compoundMode = 3;
    } else if ((srcDirPath.compare("null") == 0) && (dstLocation.compare("ftp") == 0)) {
        compoundMode = 4;
    } else {
        fprintf(stderr, "the format of source path %s or destination path %s is invalid.\n\n ",\
                                                       srcDirPath.c_str(), dstDirPath.c_str());
        usage(argv[0]);
        return -1;
    }

    // open log file
    normalFd = fopen(normalLogFile, "a");
    if (normalFd == NULL) {
        fprintf(stdout, "open file '%s' failed.\n", normalLogFile);
        return -1;
    }
    errorFd = fopen(errorLogFile, "a");
    if (errorFd == NULL) {
        fprintf(stdout, "open file '%s' failed.\n", errorLogFile);
        return -1;
    }


    char printBuf[1024];
    char * buf = new char[128];
    int len = snprintf(printBuf, sizeof(printBuf) - 1, "\nStarting a new Data Transfer Task.\n");
    snprintf(printBuf + len, sizeof(printBuf) - 1 - len, "source path: %s, destintion path: %s\n", 
                                                           srcDirPath.c_str(), dstDirPath.c_str());
    std::cout << printBuf << std::endl;
    fwrite(printBuf, 1, strlen(printBuf), normalFd);
    
    len = snprintf(printBuf, sizeof(printBuf) - 1, "\nData Transfer Error Information.\n");
    snprintf(printBuf + len, sizeof(printBuf) - 1 - len, "source path: %s, destintion path: %s\n", 
                                                           srcDirPath.c_str(), dstDirPath.c_str());
    fwrite(printBuf, 1, strlen(printBuf), errorFd);
    snprintf(printBuf, sizeof(printBuf), "=========================================================================================\n");
    fwrite(printBuf, 1, strlen(printBuf), normalFd);
    fwrite(printBuf, 1, strlen(printBuf), errorFd);

    std::thread printThread;
    std::thread taskThread;
    std::vector<std::thread> workThreads;

    int deep = 1;
    struct timeval start_time;
    struct timeval end_time;
    gettimeofday(&start_time, NULL);

    // according to compound mode, running corresponding task producer and task executor
    if (compoundMode == 1) {  // source is local, destination is ftp
        taskThread = std::thread(local2ftp_dispatcher, pFtp, realSrcPath, realDstPath);
        for (int i = 0; i < threadNum; i++) {
            workThreads.push_back(std::thread(local2ftp_worker, pFtp, i, pRecv->verify));
            ++liveWorkThread;
        }
    } else if (compoundMode == 2) {  // source is ftp, destination is local
        taskThread = std::thread(ftp2local_dispatcher, pFtp, realSrcPath, realDstPath);
        for (int i = 0; i < threadNum; i++) {
            workThreads.push_back(std::thread(ftp2local_worker, pFtp, i, pRecv->verify));
            ++liveWorkThread;
        }
    } else if (compoundMode == 3) {  // source is ftp, destination is null
        taskThread = std::thread(ftp2null_dispatcher, pFtp, realSrcPath, realDstPath);
        for (int i = 0; i < threadNum; i++) {
            workThreads.push_back(std::thread(ftp2null_worker, pFtp, i, pRecv->verify));
            ++liveWorkThread;
        }
    } else if (compoundMode == 4) {  // source is null, destination is ftp
        fileNum = pow(pRecv->width, pRecv->layer) * pRecv->fileNum * threadNum;
        for (int i = 0; i < threadNum; i++) {
            workThreads.push_back(std::thread(null2ftp_worker, pFtp, pRecv, realDstPath, i));
            ++liveWorkThread;
        }
    }
    printThread = std::thread(task_print);

    if (compoundMode != 4) {
        taskThread.join();
    }
    for (auto & th : workThreads) {
        th.join();
    }
    gettimeofday(&end_time, NULL);

    endFlag = 1;
    printThread.join();

    len = snprintf(printBuf, sizeof(printBuf) - 1, "\n\n---------- statistic information ----------\n");

    long long interval = ((long long)end_time.tv_sec*1000000 + end_time.tv_usec) - ((long long)start_time.tv_sec*1000000 + start_time.tv_usec);
    len += snprintf(printBuf + len, sizeof(printBuf) - 1 - len, "total time: %.2f s\n", ((float)interval / 1000000));

    size_to_string(totalFileSize, buf);
    len += snprintf(printBuf + len, sizeof(printBuf) - 1 - len, "total size: %s (%ld B)\n", buf, totalFileSize);

    int64_t finishSizeTmp = finishSize;
    size_to_string(finishSizeTmp, buf);
    len += snprintf(printBuf + len, sizeof(printBuf) - 1 - len, "transfer size: %s (%ld B)\n", buf, finishSizeTmp);

    long errorSizeTmp = errorSize;
    size_to_string(errorSizeTmp, buf);
    len += snprintf(printBuf + len, sizeof(printBuf) - 1 - len, "failed size: %s (%ld B)\n", buf, errorSizeTmp);

    if (pRecv->verify) {
        if (compoundMode == 1 || compoundMode == 4) {  // ftp is destination, upload
            long md5UploadFailed = md5Failed;
            len += snprintf(printBuf + len, sizeof(printBuf) - 1 - len, "md5 file upload failed: %ld\n", md5UploadFailed);
        } else if (compoundMode == 2 || compoundMode == 3) {  // ftp is source, download
            long verifyFailedNum = verifyFailed;
            len += snprintf(printBuf + len, sizeof(printBuf) - 1 - len, "verify failed: %ld\n", verifyFailedNum);
        }
    }

    int uploadRate = ((double)finishSizeTmp/interval) * 1000000;
    size_to_string(uploadRate, buf);
    snprintf(printBuf + len, sizeof(printBuf) - 1 - len, "average copy rate: %s/s\n\n", buf);
    write(1, printBuf, strlen(printBuf));
    fwrite(printBuf, 1, strlen(printBuf), normalFd);

    long fileNumTmp = fileNum;
    if (failed == 0) {
        long finishedTmp = finished;
        len = snprintf(printBuf, sizeof(printBuf) - 1, "Data Migration Succeeded!\n");
        len += snprintf(printBuf + len, sizeof(printBuf) - 1 - len, "source path: %s, destintion path: %s, total number: %ld, Finished number: %ld\n",
                                                                     srcDirPath.c_str(), dstDirPath.c_str(), fileNumTmp, finishedTmp);
        snprintf(printBuf + len, sizeof(printBuf) - 1 - len, "=========================================================================================\n\n");
        fwrite(printBuf, 1, strlen(printBuf), normalFd);
    } else {
        long failedTmp = failed;
        len = snprintf(printBuf, sizeof(printBuf) - 1, "Data Migration failed!\n");
        len += snprintf(printBuf + len, sizeof(printBuf) - 1 - len, "Please view the file './FtpBenchMarkError.log' for detailed information.\n");
        len += snprintf(printBuf + len, sizeof(printBuf) - 1 - len, "source path: %s, destintion path: %s, total number: %ld, Failed number: %ld\n",
                                                                     srcDirPath.c_str(), dstDirPath.c_str(), fileNumTmp, failedTmp);
        snprintf(printBuf + len, sizeof(printBuf) - 1 - len, "=========================================================================================\n\n");
        fwrite(printBuf, 1, strlen(printBuf), normalFd);
    }
    fwrite(printBuf + len, 1, strlen(printBuf) - len, errorFd);

    if (normalFd) {
        fflush(normalFd);
        fclose(normalFd);
    }
    if (errorFd) {
        fflush(errorFd);
        fclose(errorFd);
    }
    delete [] buf;

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x940, %rsp            # imm = 0x940
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x1, -0x8(%rbp)
jne 0xb187
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0xcf80
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xcf6a
leaq -0x31(%rbp), %rdi
movq %rdi, -0x740(%rbp)
callq 0x4820
movq -0x740(%rbp), %rdx
leaq 0x117a7(%rip), %rsi     # 0x1c94c
leaq -0x30(%rbp), %rdi
callq 0xd720
jmp 0xb1b0
leaq -0x31(%rbp), %rdi
callq 0x4510
leaq -0x69(%rbp), %rdi
movq %rdi, -0x748(%rbp)
callq 0x4820
movq -0x748(%rbp), %rdx
leaq 0x11775(%rip), %rsi     # 0x1c94c
leaq -0x68(%rbp), %rdi
callq 0xd720
jmp 0xb1e2
leaq -0x69(%rbp), %rdi
callq 0x4510
leaq -0x91(%rbp), %rdi
movq %rdi, -0x750(%rbp)
callq 0x4820
movq -0x750(%rbp), %rdx
leaq 0x11740(%rip), %rsi     # 0x1c94c
leaq -0x90(%rbp), %rdi
callq 0xd720
jmp 0xb21a
leaq -0x91(%rbp), %rdi
callq 0x4510
movl $0x8, -0x98(%rbp)
movb $0x0, -0x99(%rbp)
movl $0x18, %edi
callq 0x44b0
movq %rax, -0x758(%rbp)
jmp 0xb24a
movq -0x758(%rbp), %rdi
callq 0xda90
jmp 0xb258
movq -0x758(%rbp), %rax
movq %rax, -0xa8(%rbp)
movl $0x50, %edi
callq 0x44b0
movq %rax, -0x760(%rbp)
jmp 0xb279
movq -0x760(%rbp), %rdi
callq 0xdac0
jmp 0xb287
movq -0x760(%rbp), %rax
movq %rax, -0xb0(%rbp)
movb $0x0, 0x1b334(%rip)     # 0x265d0
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
leaq 0x11451(%rip), %rdx     # 0x1c6fb
callq 0x40e0
movb %al, -0xb1(%rbp)
movsbl %al, %eax
cmpl $-0x1, %eax
je 0xb531
movsbl -0xb1(%rbp), %eax
addl $-0x53, %eax
movl %eax, %ecx
movq %rcx, -0x768(%rbp)
subl $0x24, %eax
ja 0xb4f7
movq -0x768(%rbp), %rax
leaq 0x10d25(%rip), %rcx     # 0x1c010
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x31(%rbp), %rdi
callq 0x4510
jmp 0xcf76
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x69(%rbp), %rdi
callq 0x4510
jmp 0xcf5f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x91(%rbp), %rdi
callq 0x4510
jmp 0xcf56
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0xcf4a
movq -0x758(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
movl $0x18, %esi
callq 0x44c0
jmp 0xcf4a
movq -0x760(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
movl $0x50, %esi
callq 0x44c0
jmp 0xcf4a
movq 0x1abff(%rip), %rax     # 0x25fa0
movq (%rax), %rsi
leaq -0x30(%rbp), %rdi
callq 0x4630
jmp 0xb3af
jmp 0xb52c
movq 0x1abe5(%rip), %rax     # 0x25fa0
movq (%rax), %rsi
leaq -0x68(%rbp), %rdi
callq 0x4630
jmp 0xb3c9
jmp 0xb52c
movq 0x1abcb(%rip), %rax     # 0x25fa0
movq (%rax), %rdi
callq 0x4710
movl %eax, -0x98(%rbp)
jmp 0xb52c
movb $0x1, 0x1b1e1(%rip)     # 0x265d0
jmp 0xb52c
movb $0x1, -0x99(%rbp)
jmp 0xb52c
movq 0x1ab99(%rip), %rax     # 0x25fa0
movq (%rax), %rcx
movq -0xa8(%rbp), %rax
movq %rcx, (%rax)
jmp 0xb52c
movq 0x1ab80(%rip), %rax     # 0x25fa0
movq (%rax), %rdx
movq -0xa8(%rbp), %rcx
movq %rdx, 0x8(%rcx)
movq (%rax), %rsi
movq -0xb0(%rbp), %rdi
callq 0x4630
jmp 0xb43f
jmp 0xb52c
movq 0x1ab55(%rip), %rax     # 0x25fa0
movq (%rax), %rcx
movq -0xa8(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0xb52c
movq 0x1ab3b(%rip), %rax     # 0x25fa0
movq (%rax), %rdi
callq 0x4710
movl %eax, %ecx
movq -0xb0(%rbp), %rax
movl %ecx, 0x20(%rax)
jmp 0xb52c
movq 0x1ab1b(%rip), %rax     # 0x25fa0
movq (%rax), %rdi
callq 0x4710
movl %eax, %ecx
movq -0xb0(%rbp), %rax
movl %ecx, 0x24(%rax)
jmp 0xb52c
movq 0x1aafb(%rip), %rax     # 0x25fa0
movq (%rax), %rdi
callq 0x4710
movl %eax, %ecx
movq -0xb0(%rbp), %rax
movl %ecx, 0x28(%rax)
jmp 0xb52c
movq 0x1aade(%rip), %rax     # 0x25fa0
movq (%rax), %rsi
leaq -0x90(%rbp), %rdi
callq 0x4630
jmp 0xb4d3
jmp 0xb52c
movq -0xb0(%rbp), %rax
movb $0x1, 0x4c(%rax)
jmp 0xb52c
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0xcf80
jmp 0xb4f0
xorl %edi, %edi
callq 0x45b0
movq 0x1aaca(%rip), %rax     # 0x25fc8
movq (%rax), %rdi
movsbl -0xb1(%rbp), %edx
leaq 0x11206(%rip), %rsi     # 0x1c715
movb $0x0, %al
callq 0x4680
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0xb8(%rbp)
jmp 0xcf2a
jmp 0xb29c
movq -0xa8(%rbp), %rax
cmpq $0x0, (%rax)
je 0xb553
movq -0xa8(%rbp), %rax
movq (%rax), %rdi
callq 0x41d0
cmpq $0x0, %rax
jne 0xb581
movq 0x1aa6e(%rip), %rax     # 0x25fc8
movq (%rax), %rdi
leaq 0x111c4(%rip), %rsi     # 0x1c728
movb $0x0, %al
callq 0x4680
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0xb8(%rbp)
jmp 0xcf2a
movq -0xa8(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0xb5a5
movq -0xa8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x41d0
cmpq $0x0, %rax
jne 0xb5d3
movq 0x1aa1c(%rip), %rax     # 0x25fc8
movq (%rax), %rdi
leaq 0x1118d(%rip), %rsi     # 0x1c743
movb $0x0, %al
callq 0x4680
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0xb8(%rbp)
jmp 0xcf2a
movq -0xa8(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0xb5f7
movq -0xa8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x41d0
cmpq $0x0, %rax
jne 0xb625
movq 0x1a9ca(%rip), %rax     # 0x25fc8
movq (%rax), %rdi
leaq 0x11154(%rip), %rsi     # 0x1c75c
movb $0x0, %al
callq 0x4680
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0xb8(%rbp)
jmp 0xcf2a
leaq -0x30(%rbp), %rdi
callq 0x47a0
testb $0x1, %al
jne 0xb634
jmp 0xb662
movq 0x1a98d(%rip), %rax     # 0x25fc8
movq (%rax), %rdi
leaq 0x11134(%rip), %rsi     # 0x1c779
movb $0x0, %al
callq 0x4680
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0xb8(%rbp)
jmp 0xcf2a
leaq -0x68(%rbp), %rdi
callq 0x47a0
testb $0x1, %al
jne 0xb671
jmp 0xb69f
movq 0x1a950(%rip), %rax     # 0x25fc8
movq (%rax), %rdi
leaq 0x1111d(%rip), %rsi     # 0x1c79f
movb $0x0, %al
callq 0x4680
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0xb8(%rbp)
jmp 0xcf2a
leaq -0x30(%rbp), %rdi
leaq 0x11121(%rip), %rsi     # 0x1c7cb
callq 0x4120
cmpl $0x0, %eax
jne 0xb9f9
movq -0xb0(%rbp), %rax
cmpl $0x0, 0x28(%rax)
jge 0xb70d
movq 0x1a8fc(%rip), %rax     # 0x25fc8
movq (%rax), %rax
movq %rax, -0x770(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x41b0
movq -0x770(%rbp), %rdi
movq %rax, %rdx
leaq 0x110e0(%rip), %rsi     # 0x1c7d0
movb $0x0, %al
callq 0x4680
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0xb8(%rbp)
jmp 0xcf2a
leaq 0x11238(%rip), %rsi     # 0x1c94c
leaq -0x90(%rbp), %rdi
callq 0xdb60
movb %al, -0x771(%rbp)
jmp 0xb728
movb -0x771(%rbp), %al
testb $0x1, %al
jne 0xb734
jmp 0xb77c
movq 0x1a88d(%rip), %rax     # 0x25fc8
movq (%rax), %rax
movq %rax, -0x780(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x41b0
movq -0x780(%rbp), %rdi
movq %rax, %rdx
leaq 0x110b8(%rip), %rsi     # 0x1c817
movb $0x0, %al
callq 0x4680
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0xb8(%rbp)
jmp 0xcf2a
movq -0xb0(%rbp), %rax
cmpl $0x0, 0x20(%rax)
jge 0xb7d1
movq 0x1a838(%rip), %rax     # 0x25fc8
movq (%rax), %rax
movq %rax, -0x788(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x41b0
movq -0x788(%rbp), %rdi
movq %rax, %rdx
leaq 0x110a1(%rip), %rsi     # 0x1c855
movb $0x0, %al
callq 0x4680
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0xb8(%rbp)
jmp 0xcf2a
movq -0xb0(%rbp), %rax
cmpl $0x0, 0x24(%rax)
jge 0xb826
movq 0x1a7e3(%rip), %rax     # 0x25fc8
movq (%rax), %rax
movq %rax, -0x790(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x41b0
movq -0x790(%rbp), %rdi
movq %rax, %rdx
leaq 0x1108f(%rip), %rsi     # 0x1c898
movb $0x0, %al
callq 0x4680
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0xb8(%rbp)
jmp 0xcf2a
leaq -0x90(%rbp), %rdi
leaq 0x110a8(%rip), %rsi     # 0x1c8dc
xorl %eax, %eax
movl %eax, %edx
callq 0x4220
movq %rax, -0xc0(%rbp)
cmpq $-0x1, -0xc0(%rbp)
jne 0xb882
leaq -0x90(%rbp), %rdi
callq 0x41b0
movq %rax, %rdi
callq 0x15c10
movq %rax, -0x798(%rbp)
jmp 0xb86b
movq -0x798(%rbp), %rcx
movq -0xb0(%rbp), %rax
movq %rcx, 0x30(%rax)
jmp 0xb9f7
movq -0xc0(%rbp), %rcx
xorl %eax, %eax
movl %eax, %edx
leaq -0xe0(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x44d0
jmp 0xb8a2
leaq -0xe0(%rbp), %rdi
callq 0x41b0
movq %rax, %rdi
callq 0x15c10
movq %rax, -0x7a0(%rbp)
jmp 0xb8bf
movq -0x7a0(%rbp), %rcx
movq -0xb0(%rbp), %rax
movq %rcx, 0x40(%rax)
leaq -0xe0(%rbp), %rdi
callq 0x4280
movq -0xc0(%rbp), %rdx
incq %rdx
leaq -0x100(%rbp), %rdi
leaq -0x90(%rbp), %rsi
movq $-0x1, %rcx
callq 0x44d0
jmp 0xb903
leaq -0x100(%rbp), %rdi
callq 0x41b0
movq %rax, %rdi
callq 0x15c10
movq %rax, -0x7a8(%rbp)
jmp 0xb920
movq -0x7a8(%rbp), %rcx
movq -0xb0(%rbp), %rax
movq %rcx, 0x38(%rax)
leaq -0x100(%rbp), %rdi
callq 0x4280
movq -0xb0(%rbp), %rax
cmpq $0x0, 0x40(%rax)
jl 0xb972
movq -0xb0(%rbp), %rax
cmpq $0x0, 0x38(%rax)
jle 0xb972
movq -0xb0(%rbp), %rax
movq 0x40(%rax), %rax
movq -0xb0(%rbp), %rcx
cmpq 0x38(%rcx), %rax
jle 0xb9e1
movq -0xb0(%rbp), %rax
movq 0x38(%rax), %rdx
movq 0x40(%rax), %rsi
leaq 0x10f56(%rip), %rdi     # 0x1c8de
xorl %eax, %eax
callq 0x4070
jmp 0xb991
movl $0x0, -0x4(%rbp)
movl $0x1, -0xb8(%rbp)
jmp 0xcf2a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x4280
jmp 0xcf4a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x4280
jmp 0xcf4a
movq -0xb0(%rbp), %rax
movq 0x38(%rax), %rcx
movq -0xb0(%rbp), %rax
movq %rcx, 0x30(%rax)
jmp 0xb9f9
leaq -0x120(%rbp), %rdi
callq 0x4650
leaq -0x140(%rbp), %rdi
callq 0x4650
leaq -0x160(%rbp), %rdi
callq 0x4650
leaq -0x180(%rbp), %rdi
callq 0x4650
movl $0x0, -0x184(%rbp)
movl $0x0, -0x188(%rbp)
leaq -0x30(%rbp), %rdi
leaq 0x10e94(%rip), %rsi     # 0x1c8dc
xorl %eax, %eax
movl %eax, %edx
callq 0x48d0
movl %eax, -0x188(%rbp)
movslq -0x188(%rbp), %rax
cmpq $-0x1, %rax
je 0xbb2a
movslq -0x188(%rbp), %rcx
xorl %eax, %eax
movl %eax, %edx
leaq -0x1a8(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x44d0
jmp 0xba85
leaq -0x120(%rbp), %rdi
leaq -0x1a8(%rbp), %rsi
movq %rsi, -0x7c0(%rbp)
callq 0x45c0
movq -0x7c0(%rbp), %rdi
callq 0x4280
movl -0x188(%rbp), %eax
incl %eax
cltq
movq %rax, -0x7b0(%rbp)
leaq -0x30(%rbp), %rdi
movq %rdi, -0x7b8(%rbp)
callq 0x42e0
movq -0x7b8(%rbp), %rsi
movq -0x7b0(%rbp), %rdx
movslq -0x188(%rbp), %rcx
notq %rcx
addq %rax, %rcx
leaq -0x1c8(%rbp), %rdi
callq 0x44d0
jmp 0xbaf5
leaq -0x160(%rbp), %rdi
leaq -0x1c8(%rbp), %rsi
callq 0x45c0
leaq -0x1c8(%rbp), %rdi
callq 0x4280
jmp 0xbbab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0xcef8
leaq -0x30(%rbp), %rdi
leaq 0x10c96(%rip), %rsi     # 0x1c7cb
callq 0x4120
cmpl $0x0, %eax
je 0xbb95
movq 0x1a482(%rip), %rax     # 0x25fc8
movq (%rax), %rax
movq %rax, -0x7c8(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x41b0
movq -0x7c8(%rbp), %rdi
movq %rax, %rdx
leaq 0x10db8(%rip), %rsi     # 0x1c922
xorl %eax, %eax
callq 0x4680
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0xcf80
jmp 0xbb7f
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0xb8(%rbp)
jmp 0xcec6
leaq -0x160(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x4050
jmp 0xbba7
jmp 0xbba9
jmp 0xbbab
leaq -0x68(%rbp), %rdi
leaq 0x10c15(%rip), %rsi     # 0x1c7cb
callq 0x4120
cmpl $0x0, %eax
je 0xbc0e
leaq -0x68(%rbp), %rdi
movq %rdi, -0x7d8(%rbp)
callq 0x42e0
movq -0x7d8(%rbp), %rdi
movq %rax, %rsi
decq %rsi
callq 0x4880
movq %rax, -0x7d0(%rbp)
jmp 0xbbeb
movq -0x7d0(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2f, %eax
je 0xbc0c
leaq -0x68(%rbp), %rdi
movl $0x2f, %esi
callq 0x43c0
jmp 0xbc0a
jmp 0xbc0c
jmp 0xbc0e
leaq -0x68(%rbp), %rdi
leaq 0x10cc3(%rip), %rsi     # 0x1c8dc
xorl %eax, %eax
movl %eax, %edx
callq 0x48d0
movl %eax, -0x188(%rbp)
movslq -0x188(%rbp), %rax
cmpq $-0x1, %rax
je 0xbcea
movslq -0x188(%rbp), %rcx
xorl %eax, %eax
movl %eax, %edx
leaq -0x1e8(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x44d0
jmp 0xbc56
leaq -0x140(%rbp), %rdi
leaq -0x1e8(%rbp), %rsi
movq %rsi, -0x7f0(%rbp)
callq 0x45c0
movq -0x7f0(%rbp), %rdi
callq 0x4280
movl -0x188(%rbp), %eax
incl %eax
cltq
movq %rax, -0x7e0(%rbp)
leaq -0x68(%rbp), %rdi
movq %rdi, -0x7e8(%rbp)
callq 0x42e0
movq -0x7e8(%rbp), %rsi
movq -0x7e0(%rbp), %rdx
movslq -0x188(%rbp), %rcx
notq %rcx
addq %rax, %rcx
leaq -0x208(%rbp), %rdi
callq 0x44d0
jmp 0xbcc6
leaq -0x180(%rbp), %rdi
leaq -0x208(%rbp), %rsi
callq 0x45c0
leaq -0x208(%rbp), %rdi
callq 0x4280
jmp 0xbd6b
leaq -0x68(%rbp), %rdi
leaq 0x10ad6(%rip), %rsi     # 0x1c7cb
callq 0x4120
cmpl $0x0, %eax
je 0xbd55
movq 0x1a2c2(%rip), %rax     # 0x25fc8
movq (%rax), %rax
movq %rax, -0x7f8(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x41b0
movq -0x7f8(%rbp), %rdi
movq %rax, %rdx
leaq 0x10c23(%rip), %rsi     # 0x1c94d
xorl %eax, %eax
callq 0x4680
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0xcf80
jmp 0xbd3f
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0xb8(%rbp)
jmp 0xcec6
leaq -0x180(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x4050
jmp 0xbd67
jmp 0xbd69
jmp 0xbd6b
leaq -0x120(%rbp), %rdi
leaq 0x10c05(%rip), %rsi     # 0x1c97e
callq 0x4120
cmpl $0x0, %eax
jne 0xbdaa
leaq -0x140(%rbp), %rdi
leaq 0x10bf3(%rip), %rsi     # 0x1c984
callq 0x4120
cmpl $0x0, %eax
jne 0xbdaa
movl $0x1, -0x184(%rbp)
jmp 0xbed1
leaq -0x120(%rbp), %rdi
leaq 0x10bcc(%rip), %rsi     # 0x1c984
callq 0x4120
cmpl $0x0, %eax
jne 0xbde9
leaq -0x140(%rbp), %rdi
leaq 0x10bae(%rip), %rsi     # 0x1c97e
callq 0x4120
cmpl $0x0, %eax
jne 0xbde9
movl $0x2, -0x184(%rbp)
jmp 0xbecf
leaq -0x120(%rbp), %rdi
leaq 0x10b8d(%rip), %rsi     # 0x1c984
callq 0x4120
cmpl $0x0, %eax
jne 0xbe25
leaq -0x68(%rbp), %rdi
leaq 0x109bf(%rip), %rsi     # 0x1c7cb
callq 0x4120
cmpl $0x0, %eax
jne 0xbe25
movl $0x3, -0x184(%rbp)
jmp 0xbecd
leaq -0x30(%rbp), %rdi
leaq 0x1099b(%rip), %rsi     # 0x1c7cb
callq 0x4120
cmpl $0x0, %eax
jne 0xbe5e
leaq -0x140(%rbp), %rdi
leaq 0x10b3c(%rip), %rsi     # 0x1c984
callq 0x4120
cmpl $0x0, %eax
jne 0xbe5e
movl $0x4, -0x184(%rbp)
jmp 0xbecb
movq 0x1a163(%rip), %rax     # 0x25fc8
movq (%rax), %rax
movq %rax, -0x808(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x41b0
movq %rax, -0x800(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x41b0
movq -0x808(%rbp), %rdi
movq -0x800(%rbp), %rdx
movq %rax, %rcx
leaq 0x10ae8(%rip), %rsi     # 0x1c988
xorl %eax, %eax
callq 0x4680
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0xcf80
jmp 0xbeb5
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0xb8(%rbp)
jmp 0xcec6
jmp 0xbecd
jmp 0xbecf
jmp 0xbed1
movq 0x1a5b8(%rip), %rdi     # 0x26490
leaq 0x10aec(%rip), %rsi     # 0x1c9cb
callq 0x4590
movq %rax, -0x810(%rbp)
jmp 0xbeed
movq -0x810(%rbp), %rax
movq %rax, 0x1a6dd(%rip)     # 0x265d8
cmpq $0x0, 0x1a6d5(%rip)     # 0x265d8
jne 0xbf3a
movq 0x1a07c(%rip), %rax     # 0x25f88
movq (%rax), %rdi
movq 0x1a57a(%rip), %rdx     # 0x26490
leaq 0x10ab0(%rip), %rsi     # 0x1c9cd
movb $0x0, %al
callq 0x4680
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0xb8(%rbp)
jmp 0xcec6
movq 0x1a557(%rip), %rdi     # 0x26498
leaq 0x10a83(%rip), %rsi     # 0x1c9cb
callq 0x4590
movq %rax, -0x818(%rbp)
jmp 0xbf56
movq -0x818(%rbp), %rax
movq %rax, 0x1a67c(%rip)     # 0x265e0
cmpq $0x0, 0x1a674(%rip)     # 0x265e0
jne 0xbfa3
movq 0x1a013(%rip), %rax     # 0x25f88
movq (%rax), %rdi
movq 0x1a519(%rip), %rdx     # 0x26498
leaq 0x10a47(%rip), %rsi     # 0x1c9cd
movb $0x0, %al
callq 0x4680
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0xb8(%rbp)
jmp 0xcec6
movl $0x80, %edi
callq 0x4030
movq %rax, -0x820(%rbp)
jmp 0xbfb6
movq -0x820(%rbp), %rax
movq %rax, -0x618(%rbp)
leaq 0x10a1a(%rip), %rdx     # 0x1c9e5
xorl %eax, %eax
movb %al, -0x831(%rbp)
leaq -0x610(%rbp), %rdi
movq %rdi, -0x830(%rbp)
movl $0x3ff, %esi            # imm = 0x3FF
movq %rsi, -0x858(%rbp)
callq 0x4740
movl %eax, %ecx
movq -0x858(%rbp), %rax
movl %ecx, -0x61c(%rbp)
movslq -0x61c(%rbp), %rcx
leaq -0x610(%rbp,%rcx), %rdx
movq %rdx, -0x850(%rbp)
subq %rcx, %rax
movq %rax, -0x848(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x41b0
movq %rax, -0x840(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x41b0
movq -0x850(%rbp), %rdi
movq -0x848(%rbp), %rsi
movq -0x840(%rbp), %rcx
movq %rax, %r8
movb -0x831(%rbp), %al
leaq 0x109ab(%rip), %rdx     # 0x1ca0a
callq 0x4740
movq -0x830(%rbp), %rsi
movq 0x19f4e(%rip), %rdi     # 0x25fc0
callq 0x4490
movq %rax, -0x828(%rbp)
jmp 0xc080
movq -0x828(%rbp), %rdi
movq 0x19f0a(%rip), %rsi     # 0x25f98
callq 0x44e0
jmp 0xc095
leaq -0x610(%rbp), %rdi
movq %rdi, -0x860(%rbp)
callq 0x41d0
movq -0x860(%rbp), %rdi
movq %rax, %rdx
movq 0x1a51f(%rip), %rcx     # 0x265d8
movl $0x1, %esi
callq 0x4890
jmp 0xc0c5
leaq 0x10964(%rip), %rdx     # 0x1ca30
xorl %eax, %eax
movb %al, -0x869(%rbp)
leaq -0x610(%rbp), %rdi
movq %rdi, -0x868(%rbp)
movl $0x3ff, %esi            # imm = 0x3FF
movq %rsi, -0x890(%rbp)
callq 0x4740
movl %eax, %ecx
movq -0x890(%rbp), %rax
movl %ecx, -0x61c(%rbp)
movslq -0x61c(%rbp), %rcx
leaq -0x610(%rbp,%rcx), %rdx
movq %rdx, -0x888(%rbp)
subq %rcx, %rax
movq %rax, -0x880(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x41b0
movq %rax, -0x878(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x41b0
movq -0x888(%rbp), %rdi
movq -0x880(%rbp), %rsi
movq -0x878(%rbp), %rcx
movq %rax, %r8
movb -0x869(%rbp), %al
leaq 0x108aa(%rip), %rdx     # 0x1ca0a
callq 0x4740
movq -0x868(%rbp), %rdi
callq 0x41d0
movq -0x868(%rbp), %rdi
movq %rax, %rdx
movq 0x1a45e(%rip), %rcx     # 0x265e0
movl $0x1, %esi
callq 0x4890
jmp 0xc18e
leaq 0x108be(%rip), %rdx     # 0x1ca53
xorl %eax, %eax
leaq -0x610(%rbp), %rdi
movq %rdi, -0x898(%rbp)
movl $0x400, %esi            # imm = 0x400
callq 0x4740
movq -0x898(%rbp), %rdi
callq 0x41d0
movq -0x898(%rbp), %rdi
movq %rax, %rdx
movq 0x1a40c(%rip), %rcx     # 0x265d8
movl $0x1, %esi
callq 0x4890
jmp 0xc1d8
leaq -0x610(%rbp), %rdi
movq %rdi, -0x8a0(%rbp)
callq 0x41d0
movq -0x8a0(%rbp), %rdi
movq %rax, %rdx
movq 0x1a3e4(%rip), %rcx     # 0x265e0
movl $0x1, %esi
callq 0x4890
jmp 0xc208
leaq -0x628(%rbp), %rdi
callq 0xdb90
leaq -0x630(%rbp), %rdi
callq 0xdb90
leaq -0x648(%rbp), %rdi
callq 0xdbb0
movl $0x1, -0x64c(%rbp)
leaq -0x660(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x4760
cmpl $0x1, -0x184(%rbp)
jne 0xc357
leaq -0x61ba(%rip), %rsi     # 0x60a0
leaq -0x678(%rbp), %rdi
leaq -0xa8(%rbp), %rdx
leaq -0x160(%rbp), %rcx
leaq -0x180(%rbp), %r8
callq 0xdbd0
jmp 0xc27d
leaq -0x630(%rbp), %rdi
leaq -0x678(%rbp), %rsi
callq 0xdca0
leaq -0x678(%rbp), %rdi
callq 0xdce0
movl $0x0, -0x67c(%rbp)
movl -0x67c(%rbp), %eax
cmpl -0x98(%rbp), %eax
jge 0xc352
movq -0xb0(%rbp), %r8
addq $0x4c, %r8
leaq -0x729a(%rip), %rsi     # 0x5030
leaq -0x688(%rbp), %rdi
leaq -0xa8(%rbp), %rdx
leaq -0x67c(%rbp), %rcx
callq 0xdd40
jmp 0xc2e6
leaq -0x648(%rbp), %rdi
leaq -0x688(%rbp), %rsi
callq 0xdd10
jmp 0xc2fb
leaq -0x688(%rbp), %rdi
callq 0xdce0
leaq 0x1a2e2(%rip), %rdi     # 0x265f0
callq 0xde10
movl -0x67c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x67c(%rbp)
jmp 0xc2a6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0xcea0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x688(%rbp), %rdi
callq 0xdce0
jmp 0xcea0
jmp 0xc668
cmpl $0x2, -0x184(%rbp)
jne 0xc457
leaq -0x497b(%rip), %rsi     # 0x79f0
leaq -0x690(%rbp), %rdi
leaq -0xa8(%rbp), %rdx
leaq -0x160(%rbp), %rcx
leaq -0x180(%rbp), %r8
callq 0xdbd0
jmp 0xc38e
leaq -0x630(%rbp), %rdi
leaq -0x690(%rbp), %rsi
callq 0xdca0
leaq -0x690(%rbp), %rdi
callq 0xdce0
movl $0x0, -0x694(%rbp)
movl -0x694(%rbp), %eax
cmpl -0x98(%rbp), %eax
jge 0xc452
movq -0xb0(%rbp), %r8
addq $0x4c, %r8
leaq -0x57eb(%rip), %rsi     # 0x6bf0
leaq -0x6a0(%rbp), %rdi
leaq -0xa8(%rbp), %rdx
leaq -0x694(%rbp), %rcx
callq 0xdd40
jmp 0xc3f7
leaq -0x648(%rbp), %rdi
leaq -0x6a0(%rbp), %rsi
callq 0xdd10
jmp 0xc40c
leaq -0x6a0(%rbp), %rdi
callq 0xdce0
leaq 0x1a1d1(%rip), %rdi     # 0x265f0
callq 0xde10
movl -0x694(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x694(%rbp)
jmp 0xc3b7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x6a0(%rbp), %rdi
callq 0xdce0
jmp 0xcea0
jmp 0xc666
cmpl $0x3, -0x184(%rbp)
jne 0xc557
leaq -0x30ab(%rip), %rsi     # 0x93c0
leaq -0x6a8(%rbp), %rdi
leaq -0xa8(%rbp), %rdx
leaq -0x160(%rbp), %rcx
leaq -0x180(%rbp), %r8
callq 0xdbd0
jmp 0xc48e
leaq -0x630(%rbp), %rdi
leaq -0x6a8(%rbp), %rsi
callq 0xdca0
leaq -0x6a8(%rbp), %rdi
callq 0xdce0
movl $0x0, -0x6ac(%rbp)
movl -0x6ac(%rbp), %eax
cmpl -0x98(%rbp), %eax
jge 0xc552
movq -0xb0(%rbp), %r8
addq $0x4c, %r8
leaq -0x3cbb(%rip), %rsi     # 0x8820
leaq -0x6b8(%rbp), %rdi
leaq -0xa8(%rbp), %rdx
leaq -0x6ac(%rbp), %rcx
callq 0xdd40
jmp 0xc4f7
leaq -0x648(%rbp), %rdi
leaq -0x6b8(%rbp), %rsi
callq 0xdd10
jmp 0xc50c
leaq -0x6b8(%rbp), %rdi
callq 0xdce0
leaq 0x1a0d1(%rip), %rdi     # 0x265f0
callq 0xde10
movl -0x6ac(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6ac(%rbp)
jmp 0xc4b7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x6b8(%rbp), %rdi
callq 0xdce0
jmp 0xcea0
jmp 0xc664
cmpl $0x4, -0x184(%rbp)
jne 0xc662
movq -0xb0(%rbp), %rax
movl 0x20(%rax), %edi
movl 0x24(%rax), %esi
callq 0xde40
movsd %xmm0, -0x8a8(%rbp)
jmp 0xc580
movsd -0x8a8(%rbp), %xmm0
movq -0xb0(%rbp), %rax
cvtsi2sdl 0x28(%rax), %xmm1
mulsd %xmm1, %xmm0
cvtsi2sdl -0x98(%rbp), %xmm1
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %rsi
leaq 0x1a048(%rip), %rdi     # 0x265f8
callq 0xde70
movl $0x0, -0x6bc(%rbp)
movl -0x6bc(%rbp), %eax
cmpl -0x98(%rbp), %eax
jge 0xc660
leaq -0x25c8(%rip), %rsi     # 0xa010
leaq -0x6c8(%rbp), %rdi
leaq -0xa8(%rbp), %rdx
leaq -0xb0(%rbp), %rcx
leaq -0x180(%rbp), %r8
leaq -0x6bc(%rbp), %r9
callq 0xdf00
jmp 0xc602
leaq -0x648(%rbp), %rdi
leaq -0x6c8(%rbp), %rsi
callq 0xdd10
jmp 0xc617
leaq -0x6c8(%rbp), %rdi
callq 0xdce0
leaq 0x19fc6(%rip), %rdi     # 0x265f0
callq 0xde10
movl -0x6bc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6bc(%rbp)
jmp 0xc5bf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x6c8(%rbp), %rdi
callq 0xdce0
jmp 0xcea0
jmp 0xc662
jmp 0xc664
jmp 0xc666
jmp 0xc668
leaq -0x7b5f(%rip), %rsi     # 0x4b10
leaq -0x6d0(%rbp), %rdi
callq 0xdfe0
jmp 0xc67d
leaq -0x628(%rbp), %rdi
leaq -0x6d0(%rbp), %rsi
callq 0xdca0
leaq -0x6d0(%rbp), %rdi
callq 0xdce0
cmpl $0x4, -0x184(%rbp)
je 0xc6b5
leaq -0x630(%rbp), %rdi
callq 0x47d0
jmp 0xc6b3
jmp 0xc6b5
leaq -0x648(%rbp), %rax
movq %rax, -0x6d8(%rbp)
movq -0x6d8(%rbp), %rdi
callq 0xe0a0
movq %rax, -0x6e0(%rbp)
movq -0x6d8(%rbp), %rdi
callq 0xe0d0
movq %rax, -0x6e8(%rbp)
leaq -0x6e0(%rbp), %rdi
leaq -0x6e8(%rbp), %rsi
callq 0xe100
testb $0x1, %al
jne 0xc702
jmp 0xc733
leaq -0x6e0(%rbp), %rdi
callq 0xe140
movq %rax, -0x6f0(%rbp)
movq -0x6f0(%rbp), %rdi
callq 0x47d0
jmp 0xc723
jmp 0xc725
leaq -0x6e0(%rbp), %rdi
callq 0xe160
jmp 0xc6e9
xorl %eax, %eax
movl %eax, %esi
leaq -0x670(%rbp), %rdi
callq 0x4760
leaq 0x19ea2(%rip), %rdi     # 0x265ec
movl $0x1, %esi
callq 0xd690
leaq -0x628(%rbp), %rdi
callq 0x47d0
jmp 0xc762
leaq 0x10345(%rip), %rdx     # 0x1caae
xorl %eax, %eax
leaq -0x610(%rbp), %rdi
movl $0x3ff, %esi            # imm = 0x3FF
movq %rsi, -0x8b0(%rbp)
callq 0x4740
movq -0x8b0(%rbp), %rsi
movl %eax, -0x61c(%rbp)
movq -0x670(%rbp), %rax
movq -0x668(%rbp), %rcx
imulq $0xf4240, %rax, %rax    # imm = 0xF4240
addq %rcx, %rax
movq -0x660(%rbp), %rcx
movq -0x658(%rbp), %rdx
imulq $0xf4240, %rcx, %rcx    # imm = 0xF4240
addq %rdx, %rcx
subq %rcx, %rax
movq %rax, -0x6f8(%rbp)
movslq -0x61c(%rbp), %rax
leaq -0x610(%rbp,%rax), %rdi
subq %rax, %rsi
cvtsi2ssq -0x6f8(%rbp), %xmm0
movss 0xf817(%rip), %xmm1     # 0x1c004
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x102e1(%rip), %rdx     # 0x1cadd
movb $0x1, %al
callq 0x4740
movl %eax, %ecx
movl -0x61c(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x61c(%rbp)
movq 0x19e16(%rip), %rdi     # 0x26630
movq -0x618(%rbp), %rsi
callq 0x15a90
jmp 0xc828
movslq -0x61c(%rbp), %rax
leaq -0x610(%rbp,%rax), %rdi
movl $0x3ff, %esi            # imm = 0x3FF
subq %rax, %rsi
movq -0x618(%rbp), %rcx
movq 0x19de3(%rip), %r8      # 0x26630
leaq 0x1029d(%rip), %rdx     # 0x1caf1
xorl %eax, %eax
callq 0x4740
movl %eax, %ecx
movl -0x61c(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x61c(%rbp)
leaq 0x19dae(%rip), %rdi     # 0x26620
callq 0xd340
movq %rax, -0x700(%rbp)
movq -0x700(%rbp), %rdi
movq -0x618(%rbp), %rsi
callq 0x15a90
jmp 0xc893
movslq -0x61c(%rbp), %rax
leaq -0x610(%rbp,%rax), %rdi
movl $0x3ff, %esi            # imm = 0x3FF
subq %rax, %rsi
movq -0x618(%rbp), %rcx
movq -0x700(%rbp), %r8
leaq 0x1024a(%rip), %rdx     # 0x1cb09
xorl %eax, %eax
callq 0x4740
movl %eax, %ecx
movl -0x61c(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x61c(%rbp)
leaq 0x19d4b(%rip), %rdi     # 0x26628
callq 0xd2c0
movq %rax, -0x708(%rbp)
movq -0x708(%rbp), %rdi
movq -0x618(%rbp), %rsi
callq 0x15a90
jmp 0xc8fe
leaq -0x610(%rbp), %rdi
movslq -0x61c(%rbp), %rax
addq %rax, %rdi
movslq -0x61c(%rbp), %rax
movl $0x3ff, %esi            # imm = 0x3FF
subq %rax, %rsi
movq -0x618(%rbp), %rcx
movq -0x708(%rbp), %r8
leaq 0x101f1(%rip), %rdx     # 0x1cb24
movb $0x0, %al
callq 0x4740
addl -0x61c(%rbp), %eax
movl %eax, -0x61c(%rbp)
movq -0xb0(%rbp), %rax
testb $0x1, 0x4c(%rax)
je 0xca29
cmpl $0x1, -0x184(%rbp)
je 0xc969
cmpl $0x4, -0x184(%rbp)
jne 0xc9bf
leaq 0x19ca0(%rip), %rdi     # 0x26610
callq 0xd2c0
movq %rax, -0x710(%rbp)
leaq -0x610(%rbp), %rdi
movslq -0x61c(%rbp), %rax
addq %rax, %rdi
movslq -0x61c(%rbp), %rax
movl $0x3ff, %esi            # imm = 0x3FF
subq %rax, %rsi
movq -0x710(%rbp), %rcx
leaq 0x10193(%rip), %rdx     # 0x1cb3d
movb $0x0, %al
callq 0x4740
addl -0x61c(%rbp), %eax
movl %eax, -0x61c(%rbp)
jmp 0xca27
cmpl $0x2, -0x184(%rbp)
je 0xc9d1
cmpl $0x3, -0x184(%rbp)
jne 0xca25
leaq 0x19c40(%rip), %rdi     # 0x26618
callq 0xd2c0
movq %rax, -0x718(%rbp)
leaq -0x610(%rbp), %rdi
movslq -0x61c(%rbp), %rax
addq %rax, %rdi
movslq -0x61c(%rbp), %rax
movl $0x3ff, %esi            # imm = 0x3FF
subq %rax, %rsi
movq -0x718(%rbp), %rcx
leaq 0x10148(%rip), %rdx     # 0x1cb5a
movb $0x0, %al
callq 0x4740
addl -0x61c(%rbp), %eax
movl %eax, -0x61c(%rbp)
jmp 0xca27
jmp 0xca29
cvtsi2sdq -0x700(%rbp), %xmm0
cvtsi2sdq -0x6f8(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd 0xf5c1(%rip), %xmm1     # 0x1c008
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x71c(%rbp)
movslq -0x71c(%rbp), %rdi
movq -0x618(%rbp), %rsi
callq 0x15a90
jmp 0xca6a
movslq -0x61c(%rbp), %rax
leaq -0x610(%rbp,%rax), %rdi
movl $0x3ff, %esi            # imm = 0x3FF
subq %rax, %rsi
movq -0x618(%rbp), %rcx
leaq 0x100df(%rip), %rdx     # 0x1cb6e
xorl %eax, %eax
callq 0x4740
leaq -0x610(%rbp), %rdi
movq %rdi, -0x8b8(%rbp)
callq 0x41d0
movq -0x8b8(%rbp), %rsi
movq %rax, %rdx
movl $0x1, %edi
callq 0x4160
jmp 0xcabf
leaq -0x610(%rbp), %rdi
movq %rdi, -0x8c0(%rbp)
callq 0x41d0
movq -0x8c0(%rbp), %rdi
movq %rax, %rdx
movq 0x19af5(%rip), %rcx     # 0x265d8
movl $0x1, %esi
callq 0x4890
jmp 0xcaef
leaq 0x19b02(%rip), %rdi     # 0x265f8
callq 0xd2c0
movq %rax, -0x728(%rbp)
leaq 0x19aff(%rip), %rdi     # 0x26608
callq 0xd2c0
cmpq $0x0, %rax
jne 0xcc48
leaq 0x19ae1(%rip), %rdi     # 0x26600
callq 0xd2c0
movq %rax, -0x730(%rbp)
leaq 0x10056(%rip), %rdx     # 0x1cb88
xorl %eax, %eax
movb %al, -0x8c9(%rbp)
leaq -0x610(%rbp), %rdi
movq %rdi, -0x8c8(%rbp)
movl $0x3ff, %esi            # imm = 0x3FF
movq %rsi, -0x8d8(%rbp)
callq 0x4740
movl %eax, %ecx
movq -0x8d8(%rbp), %rax
movl %ecx, -0x61c(%rbp)
movslq -0x61c(%rbp), %rcx
leaq -0x610(%rbp,%rcx), %rdx
movq %rdx, -0x8f0(%rbp)
subq %rcx, %rax
movq %rax, -0x8e8(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x41b0
movq %rax, -0x8e0(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x41b0
movq -0x8f0(%rbp), %rdi
movq -0x8e8(%rbp), %rsi
movq -0x8e0(%rbp), %rcx
movq %rax, %r8
movb -0x8c9(%rbp), %al
movq -0x728(%rbp), %r9
movq -0x730(%rbp), %r10
movq %rsp, %rdx
movq %r10, (%rdx)
leaq 0xffc9(%rip), %rdx      # 0x1cba3
callq 0x4740
movq -0x8d8(%rbp), %rsi
movl %eax, %edx
movb -0x8c9(%rbp), %al
movl -0x61c(%rbp), %ecx
addl %edx, %ecx
movl %ecx, -0x61c(%rbp)
movslq -0x61c(%rbp), %rcx
leaq -0x610(%rbp,%rcx), %rdi
subq %rcx, %rsi
leaq 0xffdd(%rip), %rdx      # 0x1cbf2
callq 0x4740
movq -0x8c8(%rbp), %rdi
callq 0x41d0
movq -0x8c8(%rbp), %rdi
movq %rax, %rdx
movq 0x199a1(%rip), %rcx     # 0x265d8
movl $0x1, %esi
callq 0x4890
jmp 0xcc43
jmp 0xcdb0
leaq 0x199b9(%rip), %rdi     # 0x26608
callq 0xd2c0
movq %rax, -0x738(%rbp)
leaq 0xffec(%rip), %rdx      # 0x1cc4e
xorl %eax, %eax
movb %al, -0x8f9(%rbp)
leaq -0x610(%rbp), %rdi
movq %rdi, -0x8f8(%rbp)
movl $0x3ff, %esi            # imm = 0x3FF
movq %rsi, -0x908(%rbp)
callq 0x4740
movq -0x908(%rbp), %rsi
movl %eax, %ecx
movb -0x8f9(%rbp), %al
movl %ecx, -0x61c(%rbp)
movslq -0x61c(%rbp), %rcx
leaq -0x610(%rbp,%rcx), %rdi
subq %rcx, %rsi
leaq 0xffaf(%rip), %rdx      # 0x1cc66
callq 0x4740
movl %eax, %edx
movq -0x908(%rbp), %rax
movl -0x61c(%rbp), %ecx
addl %edx, %ecx
movl %ecx, -0x61c(%rbp)
movslq -0x61c(%rbp), %rcx
leaq -0x610(%rbp,%rcx), %rdx
movq %rdx, -0x920(%rbp)
subq %rcx, %rax
movq %rax, -0x918(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x41b0
movq %rax, -0x910(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x41b0
movq -0x920(%rbp), %rdi
movq -0x918(%rbp), %rsi
movq -0x910(%rbp), %rcx
movq %rax, %r8
movb -0x8f9(%rbp), %al
movq -0x728(%rbp), %r9
movq -0x738(%rbp), %r10
movq %rsp, %rdx
movq %r10, (%rdx)
leaq 0xff6b(%rip), %rdx      # 0x1ccb0
callq 0x4740
movq -0x908(%rbp), %rsi
movl %eax, %edx
movb -0x8f9(%rbp), %al
movl -0x61c(%rbp), %ecx
addl %edx, %ecx
movl %ecx, -0x61c(%rbp)
movslq -0x61c(%rbp), %rcx
leaq -0x610(%rbp,%rcx), %rdi
subq %rcx, %rsi
leaq 0xfe72(%rip), %rdx      # 0x1cbf2
callq 0x4740
movq -0x8f8(%rbp), %rdi
callq 0x41d0
movq -0x8f8(%rbp), %rdi
movq %rax, %rdx
movq 0x19836(%rip), %rcx     # 0x265d8
movl $0x1, %esi
callq 0x4890
jmp 0xcdae
jmp 0xcdb0
movslq -0x61c(%rbp), %rax
leaq -0x610(%rbp,%rax), %rax
movq %rax, -0x928(%rbp)
leaq -0x610(%rbp), %rdi
callq 0x41d0
movq -0x928(%rbp), %rdi
movq %rax, %rdx
movslq -0x61c(%rbp), %rax
subq %rax, %rdx
movq 0x197f3(%rip), %rcx     # 0x265e0
movl $0x1, %esi
callq 0x4890
jmp 0xcdf9
cmpq $0x0, 0x197d7(%rip)     # 0x265d8
je 0xce21
movq 0x197ce(%rip), %rdi     # 0x265d8
callq 0x4580
jmp 0xce11
movq 0x197c0(%rip), %rdi     # 0x265d8
callq 0x44a0
jmp 0xce1f
jmp 0xce21
cmpq $0x0, 0x197b7(%rip)     # 0x265e0
je 0xce49
movq 0x197ae(%rip), %rdi     # 0x265e0
callq 0x4580
jmp 0xce39
movq 0x197a0(%rip), %rdi     # 0x265e0
callq 0x44a0
jmp 0xce47
jmp 0xce49
movq -0x618(%rbp), %rax
movq %rax, -0x930(%rbp)
cmpq $0x0, %rax
je 0xce69
movq -0x930(%rbp), %rdi
callq 0x4600
movl $0x0, -0x4(%rbp)
movl $0x1, -0xb8(%rbp)
leaq -0x648(%rbp), %rdi
callq 0xe180
leaq -0x630(%rbp), %rdi
callq 0xdce0
leaq -0x628(%rbp), %rdi
callq 0xdce0
jmp 0xcec6
leaq -0x648(%rbp), %rdi
callq 0xe180
leaq -0x630(%rbp), %rdi
callq 0xdce0
leaq -0x628(%rbp), %rdi
callq 0xdce0
jmp 0xcef8
leaq -0x180(%rbp), %rdi
callq 0x4280
leaq -0x160(%rbp), %rdi
callq 0x4280
leaq -0x140(%rbp), %rdi
callq 0x4280
leaq -0x120(%rbp), %rdi
callq 0x4280
jmp 0xcf2a
leaq -0x180(%rbp), %rdi
callq 0x4280
leaq -0x160(%rbp), %rdi
callq 0x4280
leaq -0x140(%rbp), %rdi
callq 0x4280
leaq -0x120(%rbp), %rdi
callq 0x4280
jmp 0xcf4a
leaq -0x90(%rbp), %rdi
callq 0x4280
leaq -0x68(%rbp), %rdi
callq 0x4280
leaq -0x30(%rbp), %rdi
callq 0x4280
jmp 0xcf6a
leaq -0x90(%rbp), %rdi
callq 0x4280
leaq -0x68(%rbp), %rdi
callq 0x4280
leaq -0x30(%rbp), %rdi
callq 0x4280
jmp 0xcf76
movl -0x4(%rbp), %eax
addq $0x940, %rsp            # imm = 0x940
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0x4810
nop