// File: lianxings[P]ftp_benchmark/ftp_benchmark.cc
// Function: task_print()
void task_print() {
    long finishedTmp = 0;
    long failedTmp = 0;
    long fileNumTmp = 0;
    long lastFinishNum = 0;
    //long errorSizeTmp = 0;
    long long finishSizeTmp = 0;
    long long lastFinishSize = 0;
    string rateStr;

    char printBuf[1024];
    char sizeStrBuf[128];
    snprintf(printBuf, sizeof(printBuf) - 1,"\n%-19s%-22s%-24s%-24s\n",  "Total File Number", "Finished File Number", 
                                                                  "Transfer files per sec", "Transfer Bytes per sec");
    fwrite(printBuf, 1, strlen(printBuf), normalFd);
    while (!endFlag) {
        memset(sizeStrBuf, 0, sizeof(sizeStrBuf));
        memset(printBuf, 0, sizeof(printBuf));
        finishedTmp = finished;
        failedTmp = failed;
        fileNumTmp = fileNum;
        // errorSizeTmp = errorSize;
        finishSizeTmp = finishSize;
        size_to_string(finishSizeTmp - lastFinishSize, sizeStrBuf);
        rateStr = sizeStrBuf;
        rateStr += "/s";
        snprintf(printBuf, sizeof(printBuf) - 1,"\rtotal/finished/failed files number: %ld/%ld/%ld, throughput: %-16s",
                          fileNumTmp, finishedTmp, failedTmp, rateStr.c_str());
        write(1, printBuf, strlen(printBuf));
        snprintf(printBuf, sizeof(printBuf) - 1,"%-19ld%-22ld%-24ld%-24s\n", fileNumTmp, finishedTmp, finishedTmp - lastFinishNum, rateStr.c_str());
        fwrite(printBuf, 1, strlen(printBuf), normalFd);
        lastFinishSize = finishSizeTmp;
        lastFinishNum = finishedTmp;
        sleep(1);
    }

    memset(sizeStrBuf, 0, sizeof(sizeStrBuf));
    memset(printBuf, 0, sizeof(printBuf));
    finishedTmp = finished;
    failedTmp = failed;
    fileNumTmp = fileNum;
    //errorSizeTmp = errorSize;
    finishSizeTmp = finishSize;
    size_to_string(finishSizeTmp - lastFinishSize, sizeStrBuf);
    rateStr = sizeStrBuf;
    rateStr += "/s";
    snprintf(printBuf, sizeof(printBuf) - 1, "\rtotal/finished/failed files number: %ld/%ld/%ld, throughtout: %-16s",
                       fileNumTmp, finishedTmp, failedTmp, rateStr.c_str());
    write(1, printBuf, strlen(printBuf));    
    snprintf(printBuf, sizeof(printBuf) - 1,"%-19ld%-22ld%-24ld%-24s\n", fileNumTmp, finishedTmp, finishedTmp - lastFinishNum, rateStr.c_str());
    fwrite(printBuf, 1, strlen(printBuf), normalFd);

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x5a0, %rsp            # imm = 0x5A0
movq $0x0, -0x8(%rbp)
movq $0x0, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x4650
leaq 0x175e3(%rip), %rcx     # 0x1c13e
movq %rsp, %rax
movq %rcx, (%rax)
leaq 0x17581(%rip), %rdx     # 0x1c0e9
leaq 0x17591(%rip), %rcx     # 0x1c100
leaq 0x1759c(%rip), %r8      # 0x1c112
leaq 0x175aa(%rip), %r9      # 0x1c127
xorl %eax, %eax
leaq -0x450(%rbp), %rdi
movq %rdi, -0x4e8(%rbp)
movl $0x3ff, %esi            # imm = 0x3FF
callq 0x4740
movq -0x4e8(%rbp), %rdi
callq 0x41d0
movq -0x4e8(%rbp), %rdi
movq %rax, %rdx
movq 0x21a24(%rip), %rcx     # 0x265d8
movl $0x1, %esi
callq 0x4890
jmp 0x4bc0
jmp 0x4bc2
leaq 0x21a23(%rip), %rdi     # 0x265ec
callq 0xd230
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x4bdf
jmp 0x4e12
xorps %xmm0, %xmm0
movaps %xmm0, -0x500(%rbp)
movaps %xmm0, -0x460(%rbp)
movaps %xmm0, -0x470(%rbp)
movaps %xmm0, -0x480(%rbp)
movaps %xmm0, -0x490(%rbp)
movaps %xmm0, -0x4a0(%rbp)
movaps %xmm0, -0x4b0(%rbp)
movaps %xmm0, -0x4c0(%rbp)
movaps %xmm0, -0x4d0(%rbp)
leaq -0x450(%rbp), %rdi
xorl %esi, %esi
movl $0x400, %edx            # imm = 0x400
callq 0x4250
leaq 0x219c5(%rip), %rdi     # 0x26600
callq 0xd2c0
movq %rax, -0x8(%rbp)
leaq 0x219bd(%rip), %rdi     # 0x26608
callq 0xd2c0
movq %rax, -0x10(%rbp)
leaq 0x2199d(%rip), %rdi     # 0x265f8
callq 0xd2c0
movq %rax, -0x18(%rbp)
leaq 0x219b5(%rip), %rdi     # 0x26620
callq 0xd340
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rax
subq %rax, %rdi
leaq -0x4d0(%rbp), %rsi
callq 0x15a90
jmp 0x4c8d
leaq -0x50(%rbp), %rdi
leaq -0x4d0(%rbp), %rsi
callq 0x4630
jmp 0x4c9f
leaq 0x174af(%rip), %rsi     # 0x1c155
leaq -0x50(%rbp), %rdi
callq 0x4460
jmp 0x4cb1
movq -0x18(%rbp), %rax
movq %rax, -0x520(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x518(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x510(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x41b0
movq -0x520(%rbp), %rcx
movq -0x518(%rbp), %r8
movq -0x510(%rbp), %r9
movq %rax, %rdx
movq %rsp, %rax
movq %rdx, (%rax)
leaq 0x17458(%rip), %rdx     # 0x1c158
xorl %eax, %eax
leaq -0x450(%rbp), %rdi
movq %rdi, -0x508(%rbp)
movl $0x3ff, %esi            # imm = 0x3FF
callq 0x4740
movq -0x508(%rbp), %rdi
callq 0x41d0
movq -0x508(%rbp), %rsi
movq %rax, %rdx
movl $0x1, %edi
callq 0x4160
jmp 0x4d3c
movq -0x18(%rbp), %rax
movq %rax, -0x540(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x538(%rbp)
movq -0x20(%rbp), %rcx
subq %rcx, %rax
movq %rax, -0x530(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x41b0
movq -0x540(%rbp), %rcx
movq -0x538(%rbp), %r8
movq -0x530(%rbp), %r9
movq %rax, %rdx
movq %rsp, %rax
movq %rdx, (%rax)
leaq 0x1740e(%rip), %rdx     # 0x1c19c
xorl %eax, %eax
leaq -0x450(%rbp), %rdi
movq %rdi, -0x528(%rbp)
movl $0x3ff, %esi            # imm = 0x3FF
callq 0x4740
movq -0x528(%rbp), %rdi
callq 0x41d0
movq -0x528(%rbp), %rdi
movq %rax, %rdx
movq 0x21813(%rip), %rcx     # 0x265d8
movl $0x1, %esi
callq 0x4890
jmp 0x4dd1
movq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
movl $0x1, %edi
callq 0x4330
jmp 0x4ded
jmp 0x4bc2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x4d8(%rbp)
movl %eax, -0x4dc(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x4280
jmp 0x5016
xorps %xmm0, %xmm0
movaps %xmm0, -0x550(%rbp)
movaps %xmm0, -0x460(%rbp)
movaps %xmm0, -0x470(%rbp)
movaps %xmm0, -0x480(%rbp)
movaps %xmm0, -0x490(%rbp)
movaps %xmm0, -0x4a0(%rbp)
movaps %xmm0, -0x4b0(%rbp)
movaps %xmm0, -0x4c0(%rbp)
movaps %xmm0, -0x4d0(%rbp)
leaq -0x450(%rbp), %rdi
xorl %esi, %esi
movl $0x400, %edx            # imm = 0x400
callq 0x4250
leaq 0x21792(%rip), %rdi     # 0x26600
callq 0xd2c0
movq %rax, -0x8(%rbp)
leaq 0x2178a(%rip), %rdi     # 0x26608
callq 0xd2c0
movq %rax, -0x10(%rbp)
leaq 0x2176a(%rip), %rdi     # 0x265f8
callq 0xd2c0
movq %rax, -0x18(%rbp)
leaq 0x21782(%rip), %rdi     # 0x26620
callq 0xd340
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rax
subq %rax, %rdi
leaq -0x4d0(%rbp), %rsi
callq 0x15a90
jmp 0x4ec0
leaq -0x50(%rbp), %rdi
leaq -0x4d0(%rbp), %rsi
callq 0x4630
jmp 0x4ed2
leaq 0x1727c(%rip), %rsi     # 0x1c155
leaq -0x50(%rbp), %rdi
callq 0x4460
jmp 0x4ee4
movq -0x18(%rbp), %rax
movq %rax, -0x570(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x568(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x560(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x41b0
movq -0x570(%rbp), %rcx
movq -0x568(%rbp), %r8
movq -0x560(%rbp), %r9
movq %rax, %rdx
movq %rsp, %rax
movq %rdx, (%rax)
leaq 0x17282(%rip), %rdx     # 0x1c1b5
xorl %eax, %eax
leaq -0x450(%rbp), %rdi
movq %rdi, -0x558(%rbp)
movl $0x3ff, %esi            # imm = 0x3FF
callq 0x4740
movq -0x558(%rbp), %rdi
callq 0x41d0
movq -0x558(%rbp), %rsi
movq %rax, %rdx
movl $0x1, %edi
callq 0x4160
jmp 0x4f6f
movq -0x18(%rbp), %rax
movq %rax, -0x590(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x588(%rbp)
movq -0x20(%rbp), %rcx
subq %rcx, %rax
movq %rax, -0x580(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x41b0
movq -0x590(%rbp), %rcx
movq -0x588(%rbp), %r8
movq -0x580(%rbp), %r9
movq %rax, %rdx
movq %rsp, %rax
movq %rdx, (%rax)
leaq 0x171db(%rip), %rdx     # 0x1c19c
xorl %eax, %eax
leaq -0x450(%rbp), %rdi
movq %rdi, -0x578(%rbp)
movl $0x3ff, %esi            # imm = 0x3FF
callq 0x4740
movq -0x578(%rbp), %rdi
callq 0x41d0
movq -0x578(%rbp), %rdi
movq %rax, %rdx
movq 0x215e0(%rip), %rcx     # 0x265d8
movl $0x1, %esi
callq 0x4890
jmp 0x5004
leaq -0x50(%rbp), %rdi
callq 0x4280
addq $0x5a0, %rsp            # imm = 0x5A0
popq %rbp
retq
movq -0x4d8(%rbp), %rdi
callq 0x4810
nopw %cs:(%rax,%rax)