// File: lianxings[P]ftp_benchmark/ftp_benchmark.cc
// Function: null2ftp_worker_core(recvParam*, ftplib*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int, ftpInfo*)
static void null2ftp_worker_core(recvParam * pRecv, ftplib * ftpClient, string ftpPath, int deep, ftpInfo * pFtp) 
{
    int ret = 0;
    int retry = 0;
    char nameBuf[512];
    int ioUnit = 256 << 10;
    char printBuf[1024];
    char sizeStrBuf[128];
    ftplib::accesstype type = ftplib::filewrite;
    ftplib::transfermode mode = ftplib::image;
    ftphandle *nData = NULL;
    char ac[3] = "rb";

    // normalize directory path format
    string nullStr("");
    normalize_dir_format(nullStr, ftpPath);

    // check if ftp directory exists
    if (!ftpClient->Chdir(ftpPath.c_str())) {
        fprintf(stderr, "change to directory %s failed: %s.\n", ftpPath.c_str(), ftpClient->mp_ftphandle->response);
        return;
    }

    if (deep <= pRecv->layer) {
        for (int i = 0; i < pRecv->width; i++) {
            sprintf(nameBuf, "%s_dir_%d/", pRecv->testName.c_str(), i);
		    string dirPath = ftpPath + nameBuf;
            retry = 0;
            if (!ftpClient->Chdir(dirPath.c_str())) {
                if (!ftpClient->Mkdir(dirPath.c_str())) {
                    fprintf(stderr, "make directory %s failed: %s.\n", dirPath.c_str(), ftpClient->mp_ftphandle->response);
                        continue;
                }
            }
			null2ftp_worker_core(pRecv, ftpClient, dirPath, deep + 1, pFtp);
		}
	} else {        
        char * dataBuf = (char *)malloc(ioUnit);
		if (dataBuf == NULL) {
            fprintf(stderr, "allocate %d memory failed.\n", ioUnit);
			return;
		}
        
        srand(time(NULL));
        for (int i = 0; i < pRecv->fileNum; i++) {
            int64_t osize;
            if (pRecv->maxSize == pRecv->fileSize) {
				osize = rand();
				osize = (osize << 24) + osize;
                osize = (osize%(pRecv->maxSize - pRecv->minSize + 1)) + pRecv->minSize;
            } else {
                osize = pRecv->fileSize;
			}
            //++fileNum;
            totalFileSize += osize;
            size_to_string(osize, sizeStrBuf);
            sprintf(nameBuf, "%s_file_%d", pRecv->testName.c_str(), i);
			string filePath = ftpPath + nameBuf;
            ret = build_ftp_data_connection(filePath, type, mode, ftpClient, pFtp, &nData);
            if (ret < 0) {
                ++failed;
                errorSize += osize;
                if (ret == -1)
                    sprintf(printBuf, "\nget ftp data connection failed: source: null, destination: %s, size: %s\n",\
                                                                                      filePath.c_str(), sizeStrBuf);
                else
                    sprintf(printBuf, "\nre-login ftp server %s failed: source: null, destination: %s, size: %s\n",\
                                                                   pFtp->ftpServer , filePath.c_str(), sizeStrBuf);
                fwrite(printBuf, 1, strlen(printBuf), errorFd);
                write(2, printBuf, strlen(printBuf));
                continue;
            }

            Md5Context md5Context;
            if (pRecv->verify){
                Md5Initialise( &md5Context );
            }

            int upload = 0;
            int ioUnitTmp = ioUnit;
            while (upload < osize) {
                if (ioUnitTmp > osize - upload)
                    ioUnitTmp = osize - upload;
                memset(dataBuf, rand()%94+33, ioUnitTmp);
                if (ftpClient->FtpWrite(dataBuf, ioUnitTmp, nData) < ioUnitTmp) {
                    ++failed;
                    errorSize += osize;
                    sprintf(printBuf, "\nftp write failed: source: null, destination: %s, size: %s\n", filePath.c_str(), sizeStrBuf);
                    fwrite(printBuf, 1, strlen(printBuf), errorFd);
                    write(2, printBuf, strlen(printBuf));
                    break;
                }
                if (pRecv->verify) {
                    Md5Update( &md5Context, (const void*)dataBuf, ioUnitTmp);
                }
                finishSize += ioUnitTmp;
                upload += ioUnitTmp;
            }
            
            char md5str[33] = {'\0'};
            if (upload == osize) {
                ++finished;
                if(pRecv->verify) {
                    MD5_HASH md5;
                    char tmp[3] = {'\0'};
                    Md5Finalise( &md5Context, &md5);
                    memset(md5str, 0, sizeof(md5str));
                    for(int j = 0; j < sizeof(md5); j++ ) {
                        sprintf( tmp,"%2.2x", md5.bytes[j]);
                        strcat(md5str, tmp);
                    }
                }
            }
            
            ftpClient->FtpClose(nData);

            if (pRecv->verify) {   // if need to verify
                string newFilePath = filePath + ".md5";
                ret = build_ftp_data_connection(newFilePath, type, mode, ftpClient, pFtp, &nData);
                if (ret < 0) {
                    ++md5Failed;
                    if (ret == -1)
                        sprintf(printBuf, "\nget ftp data connection failed: source: null, destination: %s\n",\
                                                                                         newFilePath.c_str());
                    else
                        sprintf(printBuf, "\nre-login ftp server %s failed: source: null, destination: %s\n",\
                                                                      pFtp->ftpServer , newFilePath.c_str());
                    fwrite(printBuf, 1, strlen(printBuf), errorFd);
                    write(2, printBuf, strlen(printBuf));
                    continue;
                }
                
                if (ftpClient->FtpWrite(md5str, strlen(md5str), nData) < strlen(md5str)) {
                    ++md5Failed;
                    sprintf(printBuf, "\nftp write failed: source: null, destination: %s\n", newFilePath.c_str());
                    fwrite(printBuf, 1, strlen(printBuf), errorFd);
                    write(2, printBuf, strlen(printBuf));
                    break;
                }
                ftpClient->FtpClose(nData);
            }
            
        }
		free(dataBuf);
    }
	return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa00, %rsp            # imm = 0xA00
movq %rdx, -0x8e8(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq %r8, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
movl $0x40000, -0x234(%rbp)  # imm = 0x40000
movl $0x4, -0x6c4(%rbp)
movl $0x49, -0x6c8(%rbp)
movq $0x0, -0x6d0(%rbp)
movb $0x0, -0x6d2(%rbp)
movw $0x6272, -0x6d4(%rbp)   # imm = 0x6272
leaq -0x6f9(%rbp), %rdi
movq %rdi, -0x8e0(%rbp)
callq 0x4820
movq -0x8e0(%rbp), %rdx
leaq 0x124bf(%rip), %rsi     # 0x1c94c
leaq -0x6f8(%rbp), %rdi
callq 0xd720
jmp 0xa49b
leaq -0x6f9(%rbp), %rdi
callq 0x4510
movq -0x8e8(%rbp), %rsi
leaq -0x6f8(%rbp), %rdi
callq 0x15d20
jmp 0xa4bc
movq -0x8e8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq %rax, -0x8f8(%rbp)
callq 0x41b0
movq -0x8f8(%rbp), %rdi
movq %rax, %rsi
callq 0x18d00
movl %eax, -0x8ec(%rbp)
jmp 0xa4ea
movl -0x8ec(%rbp), %eax
cmpl $0x0, %eax
jne 0xa585
movq -0x8e8(%rbp), %rdi
movq 0x1bac1(%rip), %rax     # 0x25fc8
movq (%rax), %rax
movq %rax, -0x900(%rbp)
callq 0x41b0
movq -0x900(%rbp), %rdi
movq %rax, %rdx
movq -0x10(%rbp), %rax
movq (%rax), %rcx
addq $0x88, %rcx
leaq 0x1291b(%rip), %rsi     # 0x1ce50
movb $0x0, %al
callq 0x4680
movl $0x1, -0x710(%rbp)
jmp 0xb123
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x708(%rbp)
movl %eax, -0x70c(%rbp)
leaq -0x6f9(%rbp), %rdi
callq 0x4510
jmp 0xb144
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x708(%rbp)
movl %eax, -0x70c(%rbp)
jmp 0xb138
movl -0x1c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x24(%rcx), %eax
jg 0xa7ab
movl $0x0, -0x714(%rbp)
movl -0x714(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x20(%rcx), %eax
jge 0xa7a6
movq -0x8(%rbp), %rdi
callq 0x41b0
movq %rax, %rdx
movl -0x714(%rbp), %ecx
leaq 0x128a9(%rip), %rsi     # 0x1ce74
xorl %eax, %eax
leaq -0x230(%rbp), %rdi
movq %rdi, -0x908(%rbp)
callq 0x40d0
movq -0x8e8(%rbp), %rsi
movq -0x908(%rbp), %rdx
leaq -0x738(%rbp), %rdi
callq 0xd5c0
jmp 0xa5fc
movl $0x0, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x918(%rbp)
leaq -0x738(%rbp), %rdi
callq 0x41b0
movq -0x918(%rbp), %rdi
movq %rax, %rsi
callq 0x18d00
movl %eax, -0x90c(%rbp)
jmp 0xa631
movl -0x90c(%rbp), %eax
cmpl $0x0, %eax
jne 0xa6e1
movq -0x10(%rbp), %rax
movq %rax, -0x928(%rbp)
leaq -0x738(%rbp), %rdi
callq 0x41b0
movq -0x928(%rbp), %rdi
movq %rax, %rsi
callq 0x18c60
movl %eax, -0x91c(%rbp)
jmp 0xa66e
movl -0x91c(%rbp), %eax
cmpl $0x0, %eax
jne 0xa6df
movq 0x1b948(%rip), %rax     # 0x25fc8
movq (%rax), %rax
movq %rax, -0x930(%rbp)
leaq -0x738(%rbp), %rdi
callq 0x41b0
movq -0x930(%rbp), %rdi
movq %rax, %rdx
movq -0x10(%rbp), %rax
movq (%rax), %rcx
addq $0x88, %rcx
leaq 0x127ca(%rip), %rsi     # 0x1ce7f
movb $0x0, %al
callq 0x4680
movl $0x4, -0x710(%rbp)
jmp 0xa747
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x708(%rbp)
movl %eax, -0x70c(%rbp)
jmp 0xa795
jmp 0xa6e1
movq -0x8(%rbp), %rax
movq %rax, -0x940(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x938(%rbp)
leaq -0x758(%rbp), %rdi
leaq -0x738(%rbp), %rsi
callq 0x41c0
jmp 0xa70c
movq -0x938(%rbp), %rsi
movq -0x940(%rbp), %rdi
movl -0x1c(%rbp), %ecx
incl %ecx
movq -0x28(%rbp), %r8
leaq -0x758(%rbp), %rdx
callq 0xa400
jmp 0xa731
leaq -0x758(%rbp), %rdi
callq 0x4280
movl $0x0, -0x710(%rbp)
leaq -0x738(%rbp), %rdi
callq 0x4280
movl -0x710(%rbp), %eax
testl %eax, %eax
je 0xa761
jmp 0xa75f
jmp 0xa763
jmp 0xa763
movl -0x714(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x714(%rbp)
jmp 0xa59f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x708(%rbp)
movl %eax, -0x70c(%rbp)
leaq -0x758(%rbp), %rdi
callq 0x4280
leaq -0x738(%rbp), %rdi
callq 0x4280
jmp 0xb138
jmp 0xb119
movslq -0x234(%rbp), %rdi
callq 0x4620
movq %rax, -0x760(%rbp)
cmpq $0x0, -0x760(%rbp)
jne 0xa7f5
movq 0x1b7f9(%rip), %rax     # 0x25fc8
movq (%rax), %rdi
movl -0x234(%rbp), %edx
leaq 0x126bf(%rip), %rsi     # 0x1ce9e
movb $0x0, %al
callq 0x4680
movl $0x1, -0x710(%rbp)
jmp 0xb123
xorl %eax, %eax
movl %eax, %edi
callq 0x4410
movl %eax, %edi
callq 0x4470
movl $0x0, -0x764(%rbp)
movl -0x764(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x28(%rcx), %eax
jge 0xb10d
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movq -0x8(%rbp), %rcx
cmpq 0x30(%rcx), %rax
jne 0xa88c
callq 0x4100
cltq
movq %rax, -0x770(%rbp)
movq -0x770(%rbp), %rax
shlq $0x18, %rax
addq -0x770(%rbp), %rax
movq %rax, -0x770(%rbp)
movq -0x770(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x38(%rcx), %rcx
movq -0x8(%rbp), %rdx
subq 0x40(%rdx), %rcx
addq $0x1, %rcx
cqto
idivq %rcx
movq -0x8(%rbp), %rax
addq 0x40(%rax), %rdx
movq %rdx, -0x770(%rbp)
jmp 0xa89b
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x770(%rbp)
movq -0x770(%rbp), %rcx
movq 0x1bd87(%rip), %rax     # 0x26630
addq %rcx, %rax
movq %rax, 0x1bd7d(%rip)     # 0x26630
movq -0x770(%rbp), %rdi
leaq -0x6c0(%rbp), %rsi
callq 0x15a90
jmp 0xa8c8
movq -0x8(%rbp), %rdi
callq 0x41b0
movq %rax, %rdx
movl -0x764(%rbp), %ecx
leaq 0x125d9(%rip), %rsi     # 0x1ceba
xorl %eax, %eax
leaq -0x230(%rbp), %rdi
movq %rdi, -0x948(%rbp)
callq 0x40d0
movq -0x8e8(%rbp), %rsi
movq -0x948(%rbp), %rdx
leaq -0x790(%rbp), %rdi
callq 0xd5c0
jmp 0xa912
leaq -0x7b0(%rbp), %rdi
leaq -0x790(%rbp), %rsi
callq 0x41c0
jmp 0xa927
movl -0x6c4(%rbp), %esi
movl -0x6c8(%rbp), %edx
movq -0x10(%rbp), %rcx
movq -0x28(%rbp), %r8
leaq -0x7b0(%rbp), %rdi
leaq -0x6d0(%rbp), %r9
callq 0x5fd0
movl %eax, -0x94c(%rbp)
jmp 0xa956
movl -0x94c(%rbp), %eax
movl %eax, -0x2c(%rbp)
leaq -0x7b0(%rbp), %rdi
callq 0x4280
cmpl $0x0, -0x2c(%rbp)
jge 0xaac8
leaq 0x1bc8c(%rip), %rdi     # 0x26608
callq 0xd510
movq -0x770(%rbp), %rsi
leaq 0x1bc99(%rip), %rdi     # 0x26628
callq 0xd540
cmpl $-0x1, -0x2c(%rbp)
jne 0xaa12
leaq -0x640(%rbp), %rax
movq %rax, -0x958(%rbp)
leaq -0x790(%rbp), %rdi
callq 0x41b0
movq -0x958(%rbp), %rdi
movq %rax, %rdx
leaq -0x6c0(%rbp), %rcx
leaq 0x124f9(%rip), %rsi     # 0x1cec5
movb $0x0, %al
callq 0x40d0
jmp 0xaa60
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x708(%rbp)
movl %eax, -0x70c(%rbp)
jmp 0xb0ff
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x708(%rbp)
movl %eax, -0x70c(%rbp)
leaq -0x7b0(%rbp), %rdi
callq 0x4280
jmp 0xb0ff
leaq -0x640(%rbp), %rax
movq %rax, -0x968(%rbp)
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x960(%rbp)
leaq -0x790(%rbp), %rdi
callq 0x41b0
movq -0x968(%rbp), %rdi
movq -0x960(%rbp), %rdx
movq %rax, %rcx
leaq -0x6c0(%rbp), %r8
leaq 0x124b6(%rip), %rsi     # 0x1cf0f
movb $0x0, %al
callq 0x40d0
leaq -0x640(%rbp), %rdi
movq %rdi, -0x970(%rbp)
callq 0x41d0
movq -0x970(%rbp), %rdi
movq %rax, %rdx
movq 0x1bb5c(%rip), %rcx     # 0x265e0
movl $0x1, %esi
callq 0x4890
jmp 0xaa90
leaq -0x640(%rbp), %rdi
movq %rdi, -0x978(%rbp)
callq 0x41d0
movq -0x978(%rbp), %rsi
movq %rax, %rdx
movl $0x2, %edi
callq 0x4160
jmp 0xaab9
movl $0x7, -0x710(%rbp)
jmp 0xb0bc
movq -0x8(%rbp), %rax
testb $0x1, 0x4c(%rax)
je 0xaae2
leaq -0x848(%rbp), %rdi
callq 0x1a1d0
jmp 0xaae0
jmp 0xaae2
movl $0x0, -0x84c(%rbp)
movl -0x234(%rbp), %eax
movl %eax, -0x850(%rbp)
movslq -0x84c(%rbp), %rax
cmpq -0x770(%rbp), %rax
jge 0xacbc
movslq -0x850(%rbp), %rax
movq -0x770(%rbp), %rcx
movslq -0x84c(%rbp), %rdx
subq %rdx, %rcx
cmpq %rcx, %rax
jle 0xab40
movq -0x770(%rbp), %rax
movslq -0x84c(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x850(%rbp)
movq -0x760(%rbp), %rax
movq %rax, -0x988(%rbp)
callq 0x4100
movq -0x988(%rbp), %rdi
movl %eax, %edx
movslq %edx, %rax
imulq $-0x51b3bea3, %rax, %rax # imm = 0xAE4C415D
shrq $0x20, %rax
addl %edx, %eax
movl %eax, %ecx
shrl $0x1f, %ecx
sarl $0x6, %eax
addl %ecx, %eax
imull $0x5e, %eax, %eax
negl %eax
movl %eax, %ecx
movl %edx, %eax
leal 0x21(%rax,%rcx), %esi
movslq -0x850(%rbp), %rdx
callq 0x4250
movq -0x10(%rbp), %rdi
movq -0x760(%rbp), %rsi
movl -0x850(%rbp), %edx
movq -0x6d0(%rbp), %rcx
callq 0x18940
movl %eax, -0x97c(%rbp)
jmp 0xabb4
movl -0x97c(%rbp), %eax
cmpl -0x850(%rbp), %eax
jge 0xac6b
leaq 0x1ba3b(%rip), %rdi     # 0x26608
callq 0xd510
movq -0x770(%rbp), %rsi
leaq 0x1ba48(%rip), %rdi     # 0x26628
callq 0xd540
leaq -0x790(%rbp), %rdi
callq 0x41b0
movq %rax, %rdx
leaq 0x1235d(%rip), %rsi     # 0x1cf58
xorl %eax, %eax
leaq -0x640(%rbp), %rdi
movq %rdi, -0x990(%rbp)
leaq -0x6c0(%rbp), %rcx
callq 0x40d0
movq -0x990(%rbp), %rdi
callq 0x41d0
movq -0x990(%rbp), %rdi
movq %rax, %rdx
movq 0x1b9ac(%rip), %rcx     # 0x265e0
movl $0x1, %esi
callq 0x4890
jmp 0xac40
leaq -0x640(%rbp), %rdi
movq %rdi, -0x998(%rbp)
callq 0x41d0
movq -0x998(%rbp), %rsi
movq %rax, %rdx
movl $0x2, %edi
callq 0x4160
jmp 0xac69
jmp 0xacbc
movq -0x8(%rbp), %rax
testb $0x1, 0x4c(%rax)
je 0xac92
movq -0x760(%rbp), %rsi
movl -0x850(%rbp), %edx
leaq -0x848(%rbp), %rdi
callq 0x1a220
jmp 0xac90
jmp 0xac92
movslq -0x850(%rbp), %rsi
leaq 0x1b980(%rip), %rdi     # 0x26620
callq 0xd580
movl -0x850(%rbp), %eax
addl -0x84c(%rbp), %eax
movl %eax, -0x84c(%rbp)
jmp 0xaaf8
leaq -0x880(%rbp), %rdi
xorl %esi, %esi
movl $0x21, %edx
callq 0x4250
movslq -0x84c(%rbp), %rax
cmpq -0x770(%rbp), %rax
jne 0xad98
leaq 0x1b916(%rip), %rdi     # 0x26600
callq 0xd510
movq -0x8(%rbp), %rax
testb $0x1, 0x4c(%rax)
je 0xad96
movb $0x0, -0x892(%rbp)
movw $0x0, -0x894(%rbp)
leaq -0x848(%rbp), %rdi
leaq -0x890(%rbp), %rsi
callq 0x1b700
jmp 0xad22
leaq -0x880(%rbp), %rdi
xorl %esi, %esi
movl $0x21, %edx
callq 0x4250
movl $0x0, -0x898(%rbp)
movslq -0x898(%rbp), %rax
cmpq $0x10, %rax
jae 0xad94
leaq -0x894(%rbp), %rdi
movslq -0x898(%rbp), %rax
movzbl -0x890(%rbp,%rax), %edx
leaq 0x115df(%rip), %rsi     # 0x1c348
movb $0x0, %al
callq 0x40d0
leaq -0x880(%rbp), %rdi
leaq -0x894(%rbp), %rsi
callq 0x4830
movl -0x898(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x898(%rbp)
jmp 0xad3f
jmp 0xad96
jmp 0xad98
movq -0x10(%rbp), %rdi
movq -0x6d0(%rbp), %rsi
callq 0x18690
jmp 0xadaa
movq -0x8(%rbp), %rax
testb $0x1, 0x4c(%rax)
je 0xb0b2
leaq 0x1158f(%rip), %rdx     # 0x1c34e
leaq -0x8b8(%rbp), %rdi
leaq -0x790(%rbp), %rsi
callq 0xd5c0
jmp 0xadd4
leaq -0x8d8(%rbp), %rdi
leaq -0x8b8(%rbp), %rsi
callq 0x41c0
jmp 0xade9
movl -0x6c4(%rbp), %esi
movl -0x6c8(%rbp), %edx
movq -0x10(%rbp), %rcx
movq -0x28(%rbp), %r8
leaq -0x8d8(%rbp), %rdi
leaq -0x6d0(%rbp), %r9
callq 0x5fd0
movl %eax, -0x99c(%rbp)
jmp 0xae18
movl -0x99c(%rbp), %eax
movl %eax, -0x2c(%rbp)
leaq -0x8d8(%rbp), %rdi
callq 0x4280
cmpl $0x0, -0x2c(%rbp)
jge 0xaf69
leaq 0x1b7d2(%rip), %rdi     # 0x26610
callq 0xd510
cmpl $-0x1, -0x2c(%rbp)
jne 0xaeba
leaq -0x640(%rbp), %rax
movq %rax, -0x9a8(%rbp)
leaq -0x8b8(%rbp), %rdi
callq 0x41b0
movq -0x9a8(%rbp), %rdi
movq %rax, %rdx
leaq 0x12120(%rip), %rsi     # 0x1cf94
movb $0x0, %al
callq 0x40d0
jmp 0xaf01
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x708(%rbp)
movl %eax, -0x70c(%rbp)
jmp 0xb0a4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x708(%rbp)
movl %eax, -0x70c(%rbp)
leaq -0x8d8(%rbp), %rdi
callq 0x4280
jmp 0xb0a4
leaq -0x640(%rbp), %rax
movq %rax, -0x9b8(%rbp)
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x9b0(%rbp)
leaq -0x8b8(%rbp), %rdi
callq 0x41b0
movq -0x9b8(%rbp), %rdi
movq -0x9b0(%rbp), %rdx
movq %rax, %rcx
leaq 0x120da(%rip), %rsi     # 0x1cfd4
movb $0x0, %al
callq 0x40d0
leaq -0x640(%rbp), %rdi
movq %rdi, -0x9c0(%rbp)
callq 0x41d0
movq -0x9c0(%rbp), %rdi
movq %rax, %rdx
movq 0x1b6bb(%rip), %rcx     # 0x265e0
movl $0x1, %esi
callq 0x4890
jmp 0xaf31
leaq -0x640(%rbp), %rdi
movq %rdi, -0x9c8(%rbp)
callq 0x41d0
movq -0x9c8(%rbp), %rsi
movq %rax, %rdx
movl $0x2, %edi
callq 0x4160
jmp 0xaf5a
movl $0x7, -0x710(%rbp)
jmp 0xb08a
movq -0x10(%rbp), %rax
movq %rax, -0x9e0(%rbp)
leaq -0x880(%rbp), %rdi
movq %rdi, -0x9d8(%rbp)
callq 0x41d0
movq -0x9e0(%rbp), %rdi
movq -0x9d8(%rbp), %rsi
movl %eax, %edx
movq -0x6d0(%rbp), %rcx
callq 0x18940
movl %eax, -0x9cc(%rbp)
jmp 0xafab
movl -0x9cc(%rbp), %eax
cltq
movq %rax, -0x9e8(%rbp)
leaq -0x880(%rbp), %rdi
callq 0x41d0
movq %rax, %rcx
movq -0x9e8(%rbp), %rax
cmpq %rcx, %rax
jae 0xb06e
leaq 0x1b630(%rip), %rdi     # 0x26610
callq 0xd510
leaq -0x8b8(%rbp), %rdi
callq 0x41b0
movq %rax, %rdx
leaq 0x12018(%rip), %rsi     # 0x1d013
xorl %eax, %eax
leaq -0x640(%rbp), %rdi
movq %rdi, -0x9f0(%rbp)
callq 0x40d0
movq -0x9f0(%rbp), %rdi
callq 0x41d0
movq -0x9f0(%rbp), %rdi
movq %rax, %rdx
movq 0x1b5b3(%rip), %rcx     # 0x265e0
movl $0x1, %esi
callq 0x4890
jmp 0xb039
leaq -0x640(%rbp), %rdi
movq %rdi, -0x9f8(%rbp)
callq 0x41d0
movq -0x9f8(%rbp), %rsi
movq %rax, %rdx
movl $0x2, %edi
callq 0x4160
jmp 0xb062
movl $0x5, -0x710(%rbp)
jmp 0xb08a
movq -0x10(%rbp), %rdi
movq -0x6d0(%rbp), %rsi
callq 0x18690
jmp 0xb080
movl $0x0, -0x710(%rbp)
leaq -0x8b8(%rbp), %rdi
callq 0x4280
movl -0x710(%rbp), %eax
testl %eax, %eax
jne 0xb0bc
jmp 0xb0a2
jmp 0xb0b2
leaq -0x8b8(%rbp), %rdi
callq 0x4280
jmp 0xb0ff
movl $0x0, -0x710(%rbp)
leaq -0x790(%rbp), %rdi
callq 0x4280
movl -0x710(%rbp), %eax
movl %eax, -0x9fc(%rbp)
testl %eax, %eax
je 0xb0e9
jmp 0xb0da
movl -0x9fc(%rbp), %eax
subl $0x5, %eax
je 0xb10d
jmp 0xb0e7
jmp 0xb0eb
jmp 0xb0eb
movl -0x764(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x764(%rbp)
jmp 0xa80f
leaq -0x790(%rbp), %rdi
callq 0x4280
jmp 0xb138
movq -0x760(%rbp), %rdi
callq 0x45a0
movl $0x1, -0x710(%rbp)
leaq -0x6f8(%rbp), %rdi
callq 0x4280
addq $0xa00, %rsp            # imm = 0xA00
popq %rbp
retq
leaq -0x6f8(%rbp), %rdi
callq 0x4280
movq -0x708(%rbp), %rdi
callq 0x4810