// File: /workspace/github_c_makefile_star2_O0/icysunlight[P]miniftpd/ftpproto.c
// Function: transfer_list
void transfer_list(int datafd,const char* pathname)
{

    DIR* dir = opendir(pathname);
    if (NULL == dir)
       ERR_EXIT("opendir error");

    struct dirent* entry;
    while ( NULL != (entry = readdir(dir)))
    {
        if ('.' == entry->d_name[0]) 
            continue;

        struct stat fbuf;
        if (-1 == lstat(entry->d_name,&fbuf))
                ERR_EXIT("lstat error");

        char fstatbuf[1024] = {0};
        int off = 0;
        char per[11] = "----------";
        getfileper(&fbuf,per);
        per[10] = '\0';
        off += sprintf(fstatbuf + off,"%s",per);
        off += sprintf(fstatbuf + off," %d",(int)fbuf.st_nlink);
        off += sprintf(fstatbuf + off," %d",fbuf.st_gid);
        off += sprintf(fstatbuf + off," %d",fbuf.st_uid);
        off += sprintf(fstatbuf + off," %d",(int)fbuf.st_size);

        struct tm* tm = gmtime(&fbuf.st_atime);
        char strtime[128];
        strftime(strtime,128,"%b %d %H:%M",tm);
        off += sprintf(fstatbuf + off," %s",strtime);
        off += sprintf(fstatbuf + off," %s",entry->d_name);

        if ( 'l' == per[0] )
        {
            char lcontent[128] = {0};
            readlink(entry->d_name,lcontent,128);
            off += sprintf(fstatbuf + off," -> %s",lcontent);
        }

        off += sprintf(fstatbuf + off,"\r\n");
        writen(datafd,fstatbuf,off);
        fstatbuf[off + 1] = '\0';
        //printf("%s\n",fstatbuf);
    }

    closedir(dir);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x5d0, %rsp            # imm = 0x5D0
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x3130
movq %rax, -0x18(%rbp)
xorl %eax, %eax
cmpq -0x18(%rbp), %rax
jne 0x5a9f
jmp 0x5a89
leaq 0x382a(%rip), %rdi      # 0x92ba
callq 0x3470
movl $0x1, %edi
callq 0x34e0
jmp 0x5aa1
movq -0x18(%rbp), %rdi
callq 0x3390
movq %rax, %rcx
movq %rcx, -0x20(%rbp)
xorl %eax, %eax
cmpq %rcx, %rax
je 0x5dc0
movq -0x20(%rbp), %rax
movsbl 0x13(%rax), %ecx
movl $0x2e, %eax
cmpl %ecx, %eax
jne 0x5acf
jmp 0x5aa1
movq -0x20(%rbp), %rdi
addq $0x13, %rdi
leaq -0xb0(%rbp), %rsi
callq 0x3290
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %ecx, %eax
jne 0x5b06
jmp 0x5af0
leaq 0x37d1(%rip), %rdi      # 0x92c8
callq 0x3470
movl $0x1, %edi
callq 0x34e0
leaq -0x4b0(%rbp), %rdi
xorl %esi, %esi
movl $0x400, %edx            # imm = 0x400
callq 0x3220
movl $0x0, -0x4b4(%rbp)
movq 0x37aa(%rip), %rax      # 0x92d4
movq %rax, -0x4bf(%rbp)
movw 0x37a4(%rip), %ax       # 0x92dc
movw %ax, -0x4b7(%rbp)
movb 0x3799(%rip), %al       # 0x92de
movb %al, -0x4b5(%rbp)
leaq -0x4bf(%rbp), %rsi
leaq -0xb0(%rbp), %rdi
callq 0x5840
movb $0x0, -0x4b5(%rbp)
leaq -0x4b0(%rbp), %rdi
movslq -0x4b4(%rbp), %rax
addq %rax, %rdi
leaq -0x4bf(%rbp), %rdx
leaq 0x376f(%rip), %rsi      # 0x92f3
movb $0x0, %al
callq 0x34d0
addl -0x4b4(%rbp), %eax
movl %eax, -0x4b4(%rbp)
leaq -0x4b0(%rbp), %rdi
movslq -0x4b4(%rbp), %rax
addq %rax, %rdi
movq -0xa0(%rbp), %rax
movl %eax, %edx
leaq 0x3727(%rip), %rsi      # 0x92df
movb $0x0, %al
callq 0x34d0
addl -0x4b4(%rbp), %eax
movl %eax, -0x4b4(%rbp)
leaq -0x4b0(%rbp), %rdi
movslq -0x4b4(%rbp), %rax
addq %rax, %rdi
movl -0x90(%rbp), %edx
leaq 0x36f6(%rip), %rsi      # 0x92df
movb $0x0, %al
callq 0x34d0
addl -0x4b4(%rbp), %eax
movl %eax, -0x4b4(%rbp)
leaq -0x4b0(%rbp), %rdi
movslq -0x4b4(%rbp), %rax
addq %rax, %rdi
movl -0x94(%rbp), %edx
leaq 0x36c5(%rip), %rsi      # 0x92df
movb $0x0, %al
callq 0x34d0
addl -0x4b4(%rbp), %eax
movl %eax, -0x4b4(%rbp)
leaq -0x4b0(%rbp), %rdi
movslq -0x4b4(%rbp), %rax
addq %rax, %rdi
movq -0x80(%rbp), %rax
movl %eax, %edx
leaq 0x3694(%rip), %rsi      # 0x92df
movb $0x0, %al
callq 0x34d0
addl -0x4b4(%rbp), %eax
movl %eax, -0x4b4(%rbp)
leaq -0xb0(%rbp), %rdi
addq $0x48, %rdi
callq 0x3490
movq %rax, -0x4c8(%rbp)
leaq -0x550(%rbp), %rdi
movq -0x4c8(%rbp), %rcx
movl $0x80, %esi
leaq 0x3654(%rip), %rdx      # 0x92e3
callq 0x3420
leaq -0x4b0(%rbp), %rdi
movslq -0x4b4(%rbp), %rax
addq %rax, %rdi
leaq -0x550(%rbp), %rdx
leaq 0x363f(%rip), %rsi      # 0x92f2
movb $0x0, %al
callq 0x34d0
addl -0x4b4(%rbp), %eax
movl %eax, -0x4b4(%rbp)
leaq -0x4b0(%rbp), %rdi
movslq -0x4b4(%rbp), %rax
addq %rax, %rdi
movq -0x20(%rbp), %rdx
addq $0x13, %rdx
leaq 0x360c(%rip), %rsi      # 0x92f2
movb $0x0, %al
callq 0x34d0
addl -0x4b4(%rbp), %eax
movl %eax, -0x4b4(%rbp)
movsbl -0x4bf(%rbp), %ecx
movl $0x6c, %eax
cmpl %ecx, %eax
jne 0x5d67
leaq -0x5d0(%rbp), %rdi
xorl %esi, %esi
movl $0x80, %edx
callq 0x3220
movq -0x20(%rbp), %rdi
addq $0x13, %rdi
leaq -0x5d0(%rbp), %rsi
movl $0x80, %edx
callq 0x30d0
leaq -0x4b0(%rbp), %rdi
movslq -0x4b4(%rbp), %rax
addq %rax, %rdi
leaq -0x5d0(%rbp), %rdx
leaq 0x359b(%rip), %rsi      # 0x92ef
movb $0x0, %al
callq 0x34d0
addl -0x4b4(%rbp), %eax
movl %eax, -0x4b4(%rbp)
leaq -0x4b0(%rbp), %rdi
movslq -0x4b4(%rbp), %rax
addq %rax, %rdi
leaq 0x3c18(%rip), %rsi      # 0x9997
movb $0x0, %al
callq 0x34d0
addl -0x4b4(%rbp), %eax
movl %eax, -0x4b4(%rbp)
movl -0x4(%rbp), %edi
leaq -0x4b0(%rbp), %rsi
movslq -0x4b4(%rbp), %rdx
callq 0x46a0
movl -0x4b4(%rbp), %eax
addl $0x1, %eax
cltq
movb $0x0, -0x4b0(%rbp,%rax)
jmp 0x5aa1
movq -0x18(%rbp), %rdi
callq 0x3270
addq $0x5d0, %rsp            # imm = 0x5D0
popq %rbp
retq
nopw %cs:(%rax,%rax)