// File: lianxings[P]ftp_benchmark/ftp_benchmark.cc
// Function: ftp2local_worker(ftpInfo*, int, bool)
void ftp2local_worker(ftpInfo * pFtp, int id, bool verify) 
{
    string srcPath, dstPath;
    int ioUnit = 256 << 10;
    char * dataBuf = new char[ioUnit];
    char printBuf[1024];
    char sizeStrBuf[128];
    ftplib::accesstype type = ftplib::fileread;
    ftplib::transfermode mode = ftplib::image;
    FILE *local = NULL;
    ftphandle *nData = NULL;
    char ac[3] = "wb";

    ftplib * ftpClient = new ftplib();
    int ret = connect_and_login_ftp (ftpClient, pFtp, 0);
    if (ret < 0) {
        if (ret == -2)
            fprintf(stderr, "login ftp server %s failed.\n", pFtp->ftpServer);
        --liveWorkThread;
        return;
    }

    while((!tasksQueue.empty()) || (!exitFlag)) {
        task<fileInfo> taskTmp;  
        if (get_task_from_queue(taskTmp) < 0) 
            continue;

        fileInfo srcInfo, dstInfo;
        srcInfo = taskTmp.src;
        dstInfo = taskTmp.dst;
        srcPath = srcInfo.name;
        dstPath = dstInfo.name;
        memset(printBuf, 0, sizeof(printBuf));
        memset(printBuf, 0, sizeof(sizeStrBuf));
        size_to_string(srcInfo.size, sizeStrBuf);
		local = fopen64(dstPath.c_str(), ac);
		if (local == NULL) {
            ++failed;
            errorSize += srcInfo.size;
            sprintf(printBuf, "\nopen destination file failed: source: %s, destination: %s, size: %s\n", 
                                                           srcPath.c_str(), dstPath.c_str(), sizeStrBuf);
            fwrite(printBuf, 1, strlen(printBuf), errorFd);
            write(1, printBuf, strlen(printBuf));
            if (failed <= 10) {
                continue;
            } else {
                --liveWorkThread;
                break;
            }
		}
        
        // get ftp data connection 
        int ret = build_ftp_data_connection(srcPath, type, mode, ftpClient, pFtp, &nData);
        if (ret < 0) {
            ++failed;
            errorSize += srcInfo.size;
            if (ret == -1)
                sprintf(printBuf, "\nget ftp data connection failed: source: %s, destination: %s, size: %s\n",\
                                                                srcPath.c_str(), dstPath.c_str(), sizeStrBuf);
            else
                sprintf(printBuf, "\nre-login ftp server %s failed: source: %s, destination: %s, size: %s\n",\
                                             pFtp->ftpServer , srcPath.c_str(), dstPath.c_str(), sizeStrBuf);
            fwrite(printBuf, 1, strlen(printBuf), errorFd);
            write(2, printBuf, strlen(printBuf));
            if (local != NULL) fclose(local);
            continue;
        }

		char checkSumBuf[33] = {'\0'};
		char tmp[3] = {'\0'};
        Md5Context md5Context;
        MD5_HASH md5;
        if (verify){
            memset(checkSumBuf, 0, sizeof(checkSumBuf));
            memset(tmp, 0, sizeof(tmp));
            Md5Initialise( &md5Context );
        }

        int readed = 0;
        while ((readed = ftpClient->FtpRead(dataBuf, ioUnit, nData)) > 0) {
            if (fwrite(dataBuf, 1, readed, local) <= 0) {
                ++failed;
                errorSize += srcInfo.size;
                sprintf(printBuf, "\nwrite destination file failed: source: %s, destination: %s, size: %s\n", 
                                                                srcPath.c_str(), dstPath.c_str(), sizeStrBuf);
                fwrite(printBuf, 1, strlen(printBuf), errorFd);
                write(1, printBuf, strlen(printBuf));
                break;
            }
            if (verify) {
                Md5Update( &md5Context, (const void*)dataBuf, readed);
            }
            finishSize += readed;
        }
        if (readed < 0) {
            ++failed;
            errorSize += srcInfo.size;
            sprintf(printBuf, "\nread source file failed: source: %s, destination: %s, size: %s\n", 
                                                      srcPath.c_str(), dstPath.c_str(), sizeStrBuf);
            fwrite(printBuf, 1, strlen(printBuf), errorFd);
            write(1, printBuf, strlen(printBuf));
        } else {
            ++finished;
            if (verify) {
                Md5Finalise( &md5Context, &md5);
                for(int j = 0; j < sizeof(md5); j++) {
                    sprintf( tmp,"%2.2x", md5.bytes[j]);
                    strcat(checkSumBuf, tmp);
                }
            }
        }
        fflush(local);
        if (local != NULL) fclose(local);
        ftpClient->FtpClose(nData);

        if (readed >= 0 && verify) {
            string newSrcPath = srcPath + ".md5";
            int ret = build_ftp_data_connection(newSrcPath, type, mode, ftpClient, pFtp, &nData);
            if (ret < 0) {
                if (ret == -1)
                    sprintf(printBuf, "\nget ftp data connection failed: read md5 file %s\n", newSrcPath.c_str());
                else
                    sprintf(printBuf, "\nre-login ftp server %s failed: read md5 file %s\n",\
                                                      pFtp->ftpServer , newSrcPath.c_str());
                fwrite(printBuf, 1, strlen(printBuf), errorFd);
                write(2, printBuf, strlen(printBuf));
                continue;
            }

            memset(dataBuf, 0, ioUnit);
            if (ftpClient->FtpRead(dataBuf, ioUnit, nData) <= 0) {
                ++verifyFailed;
                sprintf(printBuf, "\nread md5 file %s failed\n", newSrcPath.c_str());
                fwrite(printBuf, 1, strlen(printBuf), errorFd);
                //write(1, printBuf, strlen(printBuf));
            } else if (strncmp(checkSumBuf, dataBuf, 32) != 0) {
                ++verifyFailed;
				sprintf(printBuf, "\nverify file '%s' failed: upload md5: %s, download md5: %s\n",  
                                                           srcPath.c_str(), dataBuf, checkSumBuf);
                fwrite(printBuf, 1, strlen(printBuf), errorFd);
                write(1, printBuf, strlen(printBuf));
			}
            ftpClient->FtpClose(nData);
        }

        if (failed > 10) {
            --liveWorkThread;
            break;
        }
    }

    ftpClient->Quit();
    delete ftpClient;
    delete [] dataBuf;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x850, %rsp            # imm = 0x850
movb %dl, %al
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
andb $0x1, %al
movb %al, -0xd(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x4650
leaq -0x50(%rbp), %rdi
callq 0x4650
movl $0x40000, -0x54(%rbp)   # imm = 0x40000
movslq -0x54(%rbp), %rdi
callq 0x4030
movq %rax, -0x718(%rbp)
jmp 0x6c34
movq -0x718(%rbp), %rax
movq %rax, -0x60(%rbp)
movl $0x3, -0x4f4(%rbp)
movl $0x49, -0x4f8(%rbp)
movq $0x0, -0x500(%rbp)
movq $0x0, -0x508(%rbp)
movb $0x0, -0x50a(%rbp)
movw $0x6277, -0x50c(%rbp)   # imm = 0x6277
movl $0x8, %edi
callq 0x44b0
movq %rax, -0x720(%rbp)
jmp 0x6c8c
movq -0x720(%rbp), %rdi
callq 0x16370
jmp 0x6c9a
movq -0x720(%rbp), %rax
movq %rax, -0x518(%rbp)
movq -0x518(%rbp), %rdi
movq -0x8(%rbp), %rsi
xorl %edx, %edx
callq 0x5dd0
movl %eax, -0x724(%rbp)
jmp 0x6cc2
movl -0x724(%rbp), %eax
movl %eax, -0x51c(%rbp)
cmpl $0x0, -0x51c(%rbp)
jge 0x6d4f
cmpl $-0x2, -0x51c(%rbp)
jne 0x6d34
movq 0x1f2e1(%rip), %rax     # 0x25fc8
movq (%rax), %rdi
movq -0x8(%rbp), %rax
movq (%rax), %rdx
leaq 0x1613b(%rip), %rsi     # 0x1ce33
movb $0x0, %al
callq 0x4680
jmp 0x6d34
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x79d3
movq -0x720(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
movl $0x8, %esi
callq 0x44c0
jmp 0x79d3
leaq 0x1f8b5(%rip), %rdi     # 0x265f0
callq 0xd3c0
movl $0x1, -0x520(%rbp)
jmp 0x79b8
jmp 0x6d51
leaq 0x1f7a0(%rip), %rdi     # 0x264f8
callq 0xd3f0
movb %al, -0x725(%rbp)
jmp 0x6d65
movb -0x725(%rbp), %cl
movb $0x1, %al
testb $0x1, %cl
movb %al, -0x726(%rbp)
jne 0x6d7a
jmp 0x6d94
leaq 0x1f867(%rip), %rdi     # 0x265e8
callq 0xd230
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
movb %al, -0x726(%rbp)
movb -0x726(%rbp), %al
testb $0x1, %al
jne 0x6da3
jmp 0x7952
leaq -0x570(%rbp), %rdi
callq 0xd410
jmp 0x6db1
leaq -0x570(%rbp), %rdi
callq 0x5eb0
movl %eax, -0x72c(%rbp)
jmp 0x6dc5
movl -0x72c(%rbp), %eax
cmpl $0x0, %eax
jge 0x6df0
movl $0x2, -0x520(%rbp)
jmp 0x78f3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x7941
leaq -0x598(%rbp), %rdi
callq 0xd460
jmp 0x6dfe
leaq -0x5c0(%rbp), %rdi
callq 0xd460
jmp 0x6e0c
leaq -0x598(%rbp), %rdi
leaq -0x570(%rbp), %rsi
callq 0xd4d0
jmp 0x6e21
leaq -0x548(%rbp), %rsi
leaq -0x5c0(%rbp), %rdi
callq 0xd4d0
jmp 0x6e36
leaq -0x30(%rbp), %rdi
leaq -0x598(%rbp), %rsi
callq 0x4050
jmp 0x6e48
leaq -0x50(%rbp), %rdi
leaq -0x5c0(%rbp), %rsi
callq 0x4050
jmp 0x6e5a
leaq -0x470(%rbp), %rdi
xorl %esi, %esi
movl $0x400, %edx            # imm = 0x400
callq 0x4250
xorps %xmm0, %xmm0
movaps %xmm0, -0x740(%rbp)
movaps %xmm0, -0x400(%rbp)
movaps %xmm0, -0x410(%rbp)
movaps %xmm0, -0x420(%rbp)
movaps %xmm0, -0x430(%rbp)
movaps %xmm0, -0x440(%rbp)
movaps %xmm0, -0x450(%rbp)
movaps %xmm0, -0x460(%rbp)
movaps %xmm0, -0x470(%rbp)
movq -0x578(%rbp), %rdi
leaq -0x4f0(%rbp), %rsi
callq 0x15a90
jmp 0x6ec4
leaq -0x50(%rbp), %rdi
callq 0x41b0
movq %rax, %rdi
leaq -0x50c(%rbp), %rsi
callq 0x4540
movq %rax, -0x748(%rbp)
jmp 0x6ee5
movq -0x748(%rbp), %rax
movq %rax, -0x500(%rbp)
cmpq $0x0, -0x500(%rbp)
jne 0x7016
leaq 0x1f700(%rip), %rdi     # 0x26608
callq 0xd510
movq -0x578(%rbp), %rsi
leaq 0x1f70d(%rip), %rdi     # 0x26628
callq 0xd540
leaq -0x30(%rbp), %rdi
callq 0x41b0
movq %rax, -0x758(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x41b0
movq -0x758(%rbp), %rdx
movq %rax, %rcx
leaq 0x15491(%rip), %rsi     # 0x1c3db
xorl %eax, %eax
leaq -0x470(%rbp), %rdi
movq %rdi, -0x750(%rbp)
leaq -0x4f0(%rbp), %r8
callq 0x40d0
movq -0x750(%rbp), %rdi
callq 0x41d0
movq -0x750(%rbp), %rdi
movq %rax, %rdx
movq 0x1f65d(%rip), %rcx     # 0x265e0
movl $0x1, %esi
callq 0x4890
jmp 0x6f8f
leaq -0x470(%rbp), %rdi
movq %rdi, -0x760(%rbp)
callq 0x41d0
movq -0x760(%rbp), %rsi
movq %rax, %rdx
movl $0x1, %edi
callq 0x4160
jmp 0x6fb8
leaq 0x1f649(%rip), %rdi     # 0x26608
callq 0xd2c0
cmpq $0xa, %rax
jg 0x6ffb
movl $0x2, -0x520(%rbp)
jmp 0x78db
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x7935
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x7929
leaq 0x1f5ee(%rip), %rdi     # 0x265f0
callq 0xd3c0
movl $0x3, -0x520(%rbp)
jmp 0x78db
leaq -0x5e8(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x41c0
jmp 0x7028
movl -0x4f4(%rbp), %esi
movl -0x4f8(%rbp), %edx
movq -0x518(%rbp), %rcx
movq -0x8(%rbp), %r8
leaq -0x5e8(%rbp), %rdi
leaq -0x508(%rbp), %r9
callq 0x5fd0
movl %eax, -0x764(%rbp)
jmp 0x705a
leaq -0x5e8(%rbp), %rdi
callq 0x4280
movl -0x764(%rbp), %eax
movl %eax, -0x5c4(%rbp)
cmpl $0x0, -0x5c4(%rbp)
jge 0x71f7
leaq 0x1f582(%rip), %rdi     # 0x26608
callq 0xd510
movq -0x578(%rbp), %rsi
leaq 0x1f58f(%rip), %rdi     # 0x26628
callq 0xd540
cmpl $-0x1, -0x5c4(%rbp)
jne 0x7113
leaq -0x470(%rbp), %rax
movq %rax, -0x778(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x41b0
movq %rax, -0x770(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x41b0
movq -0x778(%rbp), %rdi
movq -0x770(%rbp), %rdx
movq %rax, %rcx
leaq -0x4f0(%rbp), %r8
leaq 0x15151(%rip), %rsi     # 0x1c23e
movb $0x0, %al
callq 0x40d0
jmp 0x7175
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x5e8(%rbp), %rdi
callq 0x4280
jmp 0x7929
leaq -0x470(%rbp), %rax
movq %rax, -0x790(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x788(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x41b0
movq %rax, -0x780(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x41b0
movq -0x790(%rbp), %rdi
movq -0x788(%rbp), %rdx
movq -0x780(%rbp), %rcx
movq %rax, %r8
leaq -0x4f0(%rbp), %r9
leaq 0x15118(%rip), %rsi     # 0x1c286
movb $0x0, %al
callq 0x40d0
leaq -0x470(%rbp), %rdi
movq %rdi, -0x798(%rbp)
callq 0x41d0
movq -0x798(%rbp), %rdi
movq %rax, %rdx
movq 0x1f447(%rip), %rcx     # 0x265e0
movl $0x1, %esi
callq 0x4890
jmp 0x71a5
leaq -0x470(%rbp), %rdi
movq %rdi, -0x7a0(%rbp)
callq 0x41d0
movq -0x7a0(%rbp), %rsi
movq %rax, %rdx
movl $0x2, %edi
callq 0x4160
jmp 0x71ce
cmpq $0x0, -0x500(%rbp)
je 0x71e8
movq -0x500(%rbp), %rdi
callq 0x44a0
jmp 0x71e6
jmp 0x71e8
movl $0x2, -0x520(%rbp)
jmp 0x78db
leaq -0x610(%rbp), %rdi
xorl %esi, %esi
movl $0x21, %edx
callq 0x4250
leaq -0x614(%rbp), %rdi
xorl %esi, %esi
movl $0x3, %edx
callq 0x4250
testb $0x1, -0xd(%rbp)
je 0x725b
xorps %xmm0, %xmm0
movaps %xmm0, -0x600(%rbp)
movaps %xmm0, -0x610(%rbp)
movb $0x0, -0x5f0(%rbp)
movb $0x0, -0x612(%rbp)
movw $0x0, -0x614(%rbp)
leaq -0x6ac(%rbp), %rdi
callq 0x1a1d0
jmp 0x7259
jmp 0x725b
movl $0x0, -0x6c0(%rbp)
movq -0x518(%rbp), %rdi
movq -0x60(%rbp), %rsi
movl -0x54(%rbp), %edx
movq -0x508(%rbp), %rcx
callq 0x18800
movl %eax, -0x7a4(%rbp)
jmp 0x7287
movl -0x7a4(%rbp), %eax
movl %eax, -0x6c0(%rbp)
cmpl $0x0, %eax
jle 0x73c3
movq -0x60(%rbp), %rdi
movslq -0x6c0(%rbp), %rdx
movq -0x500(%rbp), %rcx
movl $0x1, %esi
callq 0x4890
movq %rax, -0x7b0(%rbp)
jmp 0x72c1
movq -0x7b0(%rbp), %rax
cmpq $0x0, %rax
ja 0x738b
leaq 0x1f32f(%rip), %rdi     # 0x26608
callq 0xd510
movq -0x578(%rbp), %rsi
leaq 0x1f33c(%rip), %rdi     # 0x26628
callq 0xd540
leaq -0x30(%rbp), %rdi
callq 0x41b0
movq %rax, -0x7c0(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x41b0
movq -0x7c0(%rbp), %rdx
movq %rax, %rcx
leaq 0x15106(%rip), %rsi     # 0x1c421
xorl %eax, %eax
leaq -0x470(%rbp), %rdi
movq %rdi, -0x7b8(%rbp)
leaq -0x4f0(%rbp), %r8
callq 0x40d0
movq -0x7b8(%rbp), %rdi
callq 0x41d0
movq -0x7b8(%rbp), %rdi
movq %rax, %rdx
movq 0x1f28c(%rip), %rcx     # 0x265e0
movl $0x1, %esi
callq 0x4890
jmp 0x7360
leaq -0x470(%rbp), %rdi
movq %rdi, -0x7c8(%rbp)
callq 0x41d0
movq -0x7c8(%rbp), %rsi
movq %rax, %rdx
movl $0x1, %edi
callq 0x4160
jmp 0x7389
jmp 0x73c3
testb $0x1, -0xd(%rbp)
je 0x73ab
movq -0x60(%rbp), %rsi
movl -0x6c0(%rbp), %edx
leaq -0x6ac(%rbp), %rdi
callq 0x1a220
jmp 0x73a9
jmp 0x73ab
movslq -0x6c0(%rbp), %rsi
leaq 0x1f267(%rip), %rdi     # 0x26620
callq 0xd580
jmp 0x7265
cmpl $0x0, -0x6c0(%rbp)
jge 0x748c
leaq 0x1f231(%rip), %rdi     # 0x26608
callq 0xd510
movq -0x578(%rbp), %rsi
leaq 0x1f23e(%rip), %rdi     # 0x26628
callq 0xd540
leaq -0x30(%rbp), %rdi
callq 0x41b0
movq %rax, -0x7d8(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x41b0
movq -0x7d8(%rbp), %rdx
movq %rax, %rcx
leaq 0x14eee(%rip), %rsi     # 0x1c307
xorl %eax, %eax
leaq -0x470(%rbp), %rdi
movq %rdi, -0x7d0(%rbp)
leaq -0x4f0(%rbp), %r8
callq 0x40d0
movq -0x7d0(%rbp), %rdi
callq 0x41d0
movq -0x7d0(%rbp), %rdi
movq %rax, %rdx
movq 0x1f18e(%rip), %rcx     # 0x265e0
movl $0x1, %esi
callq 0x4890
jmp 0x745e
leaq -0x470(%rbp), %rdi
movq %rdi, -0x7e0(%rbp)
callq 0x41d0
movq -0x7e0(%rbp), %rsi
movq %rax, %rdx
movl $0x1, %edi
callq 0x4160
jmp 0x7487
jmp 0x7516
leaq 0x1f16d(%rip), %rdi     # 0x26600
callq 0xd510
testb $0x1, -0xd(%rbp)
je 0x7514
leaq -0x6ac(%rbp), %rdi
leaq -0x6bc(%rbp), %rsi
callq 0x1b700
jmp 0x74b3
movl $0x0, -0x6c4(%rbp)
movslq -0x6c4(%rbp), %rax
cmpq $0x10, %rax
jae 0x7512
leaq -0x614(%rbp), %rdi
movslq -0x6c4(%rbp), %rax
movzbl -0x6bc(%rbp,%rax), %edx
leaq 0x14e61(%rip), %rsi     # 0x1c348
movb $0x0, %al
callq 0x40d0
leaq -0x610(%rbp), %rdi
leaq -0x614(%rbp), %rsi
callq 0x4830
movl -0x6c4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c4(%rbp)
jmp 0x74bd
jmp 0x7514
jmp 0x7516
movq -0x500(%rbp), %rdi
callq 0x4580
jmp 0x7524
cmpq $0x0, -0x500(%rbp)
je 0x753e
movq -0x500(%rbp), %rdi
callq 0x44a0
jmp 0x753c
jmp 0x753e
movq -0x518(%rbp), %rdi
movq -0x508(%rbp), %rsi
callq 0x18690
jmp 0x7553
cmpl $0x0, -0x6c0(%rbp)
jl 0x78a7
testb $0x1, -0xd(%rbp)
je 0x78a7
leaq 0x14ddd(%rip), %rdx     # 0x1c34e
leaq -0x6e8(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0xd5c0
jmp 0x7583
leaq -0x710(%rbp), %rdi
leaq -0x6e8(%rbp), %rsi
callq 0x41c0
jmp 0x7598
movl -0x4f4(%rbp), %esi
movl -0x4f8(%rbp), %edx
movq -0x518(%rbp), %rcx
movq -0x8(%rbp), %r8
leaq -0x710(%rbp), %rdi
leaq -0x508(%rbp), %r9
callq 0x5fd0
movl %eax, -0x7e4(%rbp)
jmp 0x75ca
leaq -0x710(%rbp), %rdi
callq 0x4280
movl -0x7e4(%rbp), %eax
movl %eax, -0x6ec(%rbp)
cmpl $0x0, -0x6ec(%rbp)
jge 0x7709
cmpl $-0x1, -0x6ec(%rbp)
jne 0x765a
leaq -0x470(%rbp), %rax
movq %rax, -0x7f0(%rbp)
leaq -0x6e8(%rbp), %rdi
callq 0x41b0
movq -0x7f0(%rbp), %rdi
movq %rax, %rdx
leaq 0x14e45(%rip), %rsi     # 0x1c468
movb $0x0, %al
callq 0x40d0
jmp 0x76a1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x7896
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x710(%rbp), %rdi
callq 0x4280
jmp 0x7896
leaq -0x470(%rbp), %rax
movq %rax, -0x800(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x7f8(%rbp)
leaq -0x6e8(%rbp), %rdi
callq 0x41b0
movq -0x800(%rbp), %rdi
movq -0x7f8(%rbp), %rdx
movq %rax, %rcx
leaq 0x14e01(%rip), %rsi     # 0x1c49b
movb $0x0, %al
callq 0x40d0
leaq -0x470(%rbp), %rdi
movq %rdi, -0x808(%rbp)
callq 0x41d0
movq -0x808(%rbp), %rdi
movq %rax, %rdx
movq 0x1ef1b(%rip), %rcx     # 0x265e0
movl $0x1, %esi
callq 0x4890
jmp 0x76d1
leaq -0x470(%rbp), %rdi
movq %rdi, -0x810(%rbp)
callq 0x41d0
movq -0x810(%rbp), %rsi
movq %rax, %rdx
movl $0x2, %edi
callq 0x4160
jmp 0x76fa
movl $0x2, -0x520(%rbp)
jmp 0x787c
movq -0x60(%rbp), %rdi
movslq -0x54(%rbp), %rdx
xorl %esi, %esi
callq 0x4250
movq -0x518(%rbp), %rdi
movq -0x60(%rbp), %rsi
movl -0x54(%rbp), %edx
movq -0x508(%rbp), %rcx
callq 0x18800
movl %eax, -0x814(%rbp)
jmp 0x773a
movl -0x814(%rbp), %eax
cmpl $0x0, %eax
jg 0x77aa
leaq 0x1eecc(%rip), %rdi     # 0x26618
callq 0xd510
leaq -0x6e8(%rbp), %rdi
callq 0x41b0
movq %rax, %rdx
leaq 0x14d66(%rip), %rsi     # 0x1c4cd
xorl %eax, %eax
leaq -0x470(%rbp), %rdi
movq %rdi, -0x820(%rbp)
callq 0x40d0
movq -0x820(%rbp), %rdi
callq 0x41d0
movq -0x820(%rbp), %rdi
movq %rax, %rdx
movq 0x1ee47(%rip), %rcx     # 0x265e0
movl $0x1, %esi
callq 0x4890
jmp 0x77a5
jmp 0x785d
leaq -0x610(%rbp), %rdi
movq -0x60(%rbp), %rsi
movl $0x20, %edx
callq 0x4200
cmpl $0x0, %eax
je 0x785b
leaq 0x1ee49(%rip), %rdi     # 0x26618
callq 0xd510
leaq -0x30(%rbp), %rdi
callq 0x41b0
movq %rax, %rdx
movq -0x60(%rbp), %rcx
leaq 0x14cfc(%rip), %rsi     # 0x1c4e7
xorl %eax, %eax
leaq -0x470(%rbp), %rdi
movq %rdi, -0x828(%rbp)
leaq -0x610(%rbp), %r8
callq 0x40d0
movq -0x828(%rbp), %rdi
callq 0x41d0
movq -0x828(%rbp), %rdi
movq %rax, %rdx
movq 0x1edbc(%rip), %rcx     # 0x265e0
movl $0x1, %esi
callq 0x4890
jmp 0x7830
leaq -0x470(%rbp), %rdi
movq %rdi, -0x830(%rbp)
callq 0x41d0
movq -0x830(%rbp), %rsi
movq %rax, %rdx
movl $0x1, %edi
callq 0x4160
jmp 0x7859
jmp 0x785b
jmp 0x785d
movq -0x518(%rbp), %rdi
movq -0x508(%rbp), %rsi
callq 0x18690
jmp 0x7872
movl $0x0, -0x520(%rbp)
leaq -0x6e8(%rbp), %rdi
callq 0x4280
movl -0x520(%rbp), %eax
testl %eax, %eax
jne 0x78db
jmp 0x7894
jmp 0x78a7
leaq -0x6e8(%rbp), %rdi
callq 0x4280
jmp 0x7929
leaq 0x1ed5a(%rip), %rdi     # 0x26608
callq 0xd2c0
cmpq $0xa, %rax
jle 0x78d1
leaq 0x1ed30(%rip), %rdi     # 0x265f0
callq 0xd3c0
movl $0x3, -0x520(%rbp)
jmp 0x78db
movl $0x0, -0x520(%rbp)
leaq -0x5c0(%rbp), %rdi
callq 0xd640
leaq -0x598(%rbp), %rdi
callq 0xd640
leaq -0x570(%rbp), %rdi
callq 0xd660
movl -0x520(%rbp), %eax
movl %eax, -0x834(%rbp)
testl %eax, %eax
je 0x7924
jmp 0x7911
movl -0x834(%rbp), %eax
subl $0x2, %eax
je 0x6d51
jmp 0x7922
jmp 0x7952
jmp 0x6d51
leaq -0x5c0(%rbp), %rdi
callq 0xd640
leaq -0x598(%rbp), %rdi
callq 0xd640
leaq -0x570(%rbp), %rdi
callq 0xd660
jmp 0x79d3
movq -0x518(%rbp), %rdi
callq 0x197d0
jmp 0x7960
movq -0x518(%rbp), %rax
movq %rax, -0x840(%rbp)
cmpq $0x0, %rax
je 0x7991
movq -0x840(%rbp), %rdi
callq 0x164c0
movq -0x840(%rbp), %rdi
movl $0x8, %esi
callq 0x44c0
movq -0x60(%rbp), %rax
movq %rax, -0x848(%rbp)
cmpq $0x0, %rax
je 0x79ae
movq -0x848(%rbp), %rdi
callq 0x4600
movl $0x0, -0x520(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x4280
leaq -0x30(%rbp), %rdi
callq 0x4280
addq $0x850, %rsp            # imm = 0x850
popq %rbp
retq
leaq -0x50(%rbp), %rdi
callq 0x4280
leaq -0x30(%rbp), %rdi
callq 0x4280
movq -0x68(%rbp), %rdi
callq 0x4810
nop