LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/icysunlight[P]miniftpd/sysutil.c
// Function: accept_timeout
int accept_timeout(int fd, struct sockaddr_in *addr, unsigned int wait_seconds)
{
    int ret;
    socklen_t addrlen = sizeof(struct sockaddr_in);

    if (wait_seconds > 0)
    {
        fd_set accept_fdset;
        struct timeval timeout;
        FD_ZERO(&accept_fdset);
        FD_SET(fd, &accept_fdset);
        timeout.tv_sec = wait_seconds;
        timeout.tv_usec = 0;
        do
        {
            ret = select(fd + 1, &accept_fdset, NULL, NULL, &timeout);
        } while (ret < 0 && errno == EINTR);
        if (ret == -1)
            return -1;
        else if (ret == 0)
        {
            errno = ETIMEDOUT;
            return -1;
        }
    }

    if (addr != NULL)
        ret = accept(fd, (struct sockaddr*)addr, &addrlen);
    else
        ret = accept(fd, NULL, NULL);
/*  if (ret == -1)
        ERR_EXIT("accept");
        */

    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rsi, %r14
movl %edi, %ebx
movl $0x10, 0xc(%rsp)
testl %edx, %edx
je 0x427d
xorps %xmm0, %xmm0
leaq 0x20(%rsp), %r15
movaps %xmm0, (%r15)
movaps %xmm0, 0x10(%r15)
movaps %xmm0, 0x20(%r15)
movaps %xmm0, 0x30(%r15)
movaps %xmm0, 0x40(%r15)
movaps %xmm0, 0x50(%r15)
leal 0x3f(%rbx), %eax
testl %ebx, %ebx
cmovnsl %ebx, %eax
movl %eax, %esi
andl $-0x40, %esi
movl %ebx, %ecx
subl %esi, %ecx
movl $0x1, %esi
shlq %cl, %rsi
movaps %xmm0, 0x60(%r15)
movaps %xmm0, 0x70(%r15)
sarl $0x6, %eax
cltq
orq %rsi, 0x20(%rsp,%rax,8)
movl %edx, %eax
leaq 0x10(%rsp), %r12
movq %rax, (%r12)
movq $0x0, 0x8(%r12)
leal 0x1(%rbx), %ebp
movl %ebp, %edi
movq %r15, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
movq %r12, %r8
callq 0x3370
movl %eax, %r13d
testl %eax, %eax
jns 0x4260
callq 0x3060
cmpl $0x4, (%rax)
je 0x423e
cmpl $-0x1, %r13d
je 0x4276
testl %r13d, %r13d
jne 0x427d
callq 0x3060
movl $0x6e, (%rax)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x4299
testq %r14, %r14
je 0x428e
leaq 0xc(%rsp), %rdx
movl %ebx, %edi
movq %r14, %rsi
jmp 0x4294
movl %ebx, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x34a0
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/icysunlight[P]miniftpd/sysutil.c
// Function: readn
ssize_t readn(int fd, void *buf, size_t count)
{
    size_t nleft = count;
    ssize_t nread;
    char *bufp = (char*)buf;

    while (nleft > 0)
    {
        if ((nread = read(fd, bufp, nleft)) < 0)
        {
            if (errno == EINTR)
                continue;
            return -1;
        }
        else if (nread == 0)
            return count - nleft;

        bufp += nread;
        nleft -= nread;
    }

    return count;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
testq %rdx, %rdx
je 0x4453
movq %rsi, %r14
movl %edi, %ebp
movq %rbx, %r15
movl %ebp, %edi
movq %r14, %rsi
movq %r15, %rdx
callq 0x3280
testq %rax, %rax
jns 0x4440
callq 0x3060
cmpl $0x4, (%rax)
je 0x4422
jmp 0x444c
je 0x4461
addq %rax, %r14
subq %rax, %r15
jne 0x4422
jmp 0x4453
movq $-0x1, %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
subq %r15, %rbx
jmp 0x4453
// File: /workspace/github_c_makefile_star2_O3/icysunlight[P]miniftpd/sysutil.c
// Function: writen
ssize_t writen(int fd, const void *buf, size_t count)
{
    size_t nleft = count;
    ssize_t nwritten;
    char *bufp = (char*)buf;

    while (nleft > 0)
    {
        if ((nwritten = write(fd, bufp, nleft)) < 0)
        {
            if (errno == EINTR)
                continue;
            return -1;
        }
        else if (nwritten == 0)
            continue;

        bufp += nwritten;
        nleft -= nwritten;
    }

    return count;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
testq %rdx, %rdx
je 0x44ae
movq %rdx, %rbx
movq %rsi, %r14
movl %edi, %ebp
movq %rdx, %r15
movl %ebp, %edi
movq %r14, %rsi
movq %r15, %rdx
callq 0x3100
testq %rax, %rax
js 0x449b
je 0x447d
addq %rax, %r14
subq %rax, %r15
jne 0x447d
jmp 0x44b0
callq 0x3060
cmpl $0x4, (%rax)
je 0x447d
movq $-0x1, %rbx
jmp 0x44b0
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/icysunlight[P]miniftpd/sysutil.c
// Function: readline
ssize_t readline(int sockfd, void *buf, size_t maxline)
{
    int ret;
    int nread;
    char *bufp = buf;
    int nleft = maxline;
    while (1)
    {
        ret = recv_peek(sockfd, bufp, nleft);
        if (ret < 0)
            return ret;
        else if (ret == 0)
            return ret;

        nread = ret;
        int i;
        for (i=0; i<nread; i++)
        {
            if (bufp[i] == '\n')
            {
                ret = readn(sockfd, bufp, i+1);
                if (ret != i+1)
                    exit(EXIT_FAILURE);

                return ret;
            }
        }

        if (nread > nleft)
            exit(EXIT_FAILURE);

        nleft -= nread;
        ret = readn(sockfd, bufp, nread);
        if (ret != nread)
            exit(EXIT_FAILURE);

        bufp += nread;
    }

    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %rbx
movl %edi, %ebp
movslq %r14d, %rdx
callq 0x44be
movq %rax, %r13
testl %r13d, %r13d
js 0x45a8
movl %r13d, %r12d
testl %r12d, %r12d
je 0x45bd
movl %r12d, %eax
negq %rax
movl $0x1, %r15d
cmpb $0xa, -0x1(%rbx,%r15)
je 0x4592
leaq (%rax,%r15), %rcx
incq %rcx
incq %r15
cmpq $0x1, %rcx
jne 0x453f
subl %r12d, %r14d
jl 0x45c1
andl $0x7fffffff, %r13d      # imm = 0x7FFFFFFF
movl %ebp, %edi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x440b
cmpl %eax, %r12d
jne 0x45c1
addq %r13, %rbx
movslq %r14d, %rdx
movl %ebp, %edi
movq %rbx, %rsi
callq 0x44be
movq %rax, %r12
movq %rax, %r13
testl %r12d, %r12d
jns 0x452a
jmp 0x45ab
movl %ebp, %edi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x440b
cmpl %r15d, %eax
jne 0x45c1
cltq
jmp 0x45ae
movq %r13, %r12
movslq %r12d, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
jmp 0x45ae
movl $0x1, %edi
callq 0x34e0
// File: /workspace/github_c_makefile_star2_O3/icysunlight[P]miniftpd/sysutil.c
// Function: send_fd
void send_fd(int sock_fd, int fd)
{
    int ret;
    struct msghdr msg;
    struct cmsghdr *p_cmsg;
    struct iovec vec;
    char cmsgbuf[CMSG_SPACE(sizeof(fd))];
    int *p_fds;
    char sendchar = 0;
    msg.msg_control = cmsgbuf;
    msg.msg_controllen = sizeof(cmsgbuf);
    p_cmsg = CMSG_FIRSTHDR(&msg);
    p_cmsg->cmsg_level = SOL_SOCKET;
    p_cmsg->cmsg_type = SCM_RIGHTS;
    p_cmsg->cmsg_len = CMSG_LEN(sizeof(fd));
    p_fds = (int*)CMSG_DATA(p_cmsg);
    *p_fds = fd;

    msg.msg_name = NULL;
    msg.msg_namelen = 0;
    msg.msg_iov = &vec;
    msg.msg_iovlen = 1;
    msg.msg_flags = 0;

    vec.iov_base = &sendchar;
    vec.iov_len = sizeof(sendchar);
    ret = sendmsg(sock_fd, &msg, 0);
    if (ret != 1)
        ERR_EXIT("sendmsg");
}

// Assembly:
subq $0x78, %rsp
leaq 0xf(%rsp), %rcx
movb $0x0, (%rcx)
leaq 0x20(%rsp), %rdx
leaq 0x40(%rsp), %rax
movq %rdx, 0x20(%rax)
movq $0x18, 0x28(%rax)
movabsq $0x100000001, %r8       # imm = 0x100000001
movq %r8, 0x8(%rdx)
movq $0x14, (%rdx)
movl %esi, 0x10(%rdx)
movq $0x0, (%rax)
xorl %edx, %edx
movl %edx, 0x8(%rax)
leaq 0x10(%rsp), %rsi
movq %rsi, 0x10(%rax)
movl $0x1, %r8d
movq %r8, 0x18(%rax)
movl %edx, 0x30(%rax)
movq %rcx, (%rsi)
movq %r8, 0x8(%rsi)
movq %rax, %rsi
xorl %edx, %edx
callq 0x30b0
cmpl $0x1, %eax
jne 0x4642
addq $0x78, %rsp
retq
callq 0x36f5
// File: /workspace/github_c_makefile_star2_O3/icysunlight[P]miniftpd/session.c
// Function: init_session
void init_session(session_t* ssinf,int conn)
{
    memset(ssinf,0,sizeof(session_t));
    ssinf->ctrlfd = conn;
    ssinf->protofd = ssinf->nobodyfd = -1;

    ssinf->bASCII = 0;

    ssinf->rn_filepath = NULL;
    ssinf->pasv_lsfd = -1;

    ssinf->burg = 0;

    ssinf->ip = 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
addq $0x8, %rdi
xorl %r15d, %r15d
movl $0xc38, %edx            # imm = 0xC38
xorl %esi, %esi
callq 0x3220
movl %ebx, 0x8(%r14)
movq $-0x1, (%r14)
movq %r15, 0xc28(%r14)
movl $0xffffffff, 0xc20(%r14) # imm = 0xFFFFFFFF
movq %r15, 0xc40(%r14)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/icysunlight[P]miniftpd/session.c
// Function: clear_session
void clear_session(session_t* ssinf)
{
    clear_transfer(ssinf);

    if ( -1 != ssinf->nobodyfd )
        close(ssinf->nobodyfd); 
    if ( -1 != ssinf->protofd )
        close(ssinf->protofd); 
    if ( -1 != ssinf->ctrlfd )
        close(ssinf->ctrlfd); 
    if ( -1 != ssinf->datafd )
        close(ssinf->datafd); 
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x479a
movl (%rbx), %edi
cmpl $-0x1, %edi
je 0x4770
callq 0x3260
movl 0x4(%rbx), %edi
cmpl $-0x1, %edi
je 0x477d
callq 0x3260
movl 0x8(%rbx), %edi
cmpl $-0x1, %edi
je 0x478a
callq 0x3260
movl 0xc(%rbx), %edi
cmpl $-0x1, %edi
je 0x4798
popq %rbx
jmp 0x3260
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/icysunlight[P]miniftpd/session.c
// Function: clear_transfer
void clear_transfer(session_t* ssinf)
{
    shutdown(ssinf->datafd,SHUT_RDWR);
    ssinf->datafd = -1;
    if ( has_port(ssinf) )
    {
        free(ssinf->port_addr);
        ssinf->port_addr = NULL;
    }
    if ( has_pasv(ssinf) )
    {
        close(ssinf->pasv_lsfd);
        ssinf->pasv_lsfd = -1;
    }
    if ( NULL != ssinf->rn_filepath )
        free(ssinf->rn_filepath);
    ssinf->rest_pos = 0;
    ssinf->bappe = 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl 0xc(%rdi), %edi
movl $0x2, %esi
callq 0x3150
movl $0xffffffff, 0xc(%rbx)  # imm = 0xFFFFFFFF
movq 0xc18(%rbx), %rdi
testq %rdi, %rdi
je 0x47ce
callq 0x3040
movq $0x0, 0xc18(%rbx)
movl 0xc20(%rbx), %edi
cmpl $-0x1, %edi
je 0x47e8
callq 0x3260
movl $0xffffffff, 0xc20(%rbx) # imm = 0xFFFFFFFF
movq 0xc28(%rbx), %rdi
testq %rdi, %rdi
je 0x47f9
callq 0x3040
movq $0x0, 0xc30(%rbx)
movl $0x0, 0x14(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/icysunlight[P]miniftpd/session.c
// Function: ratelim_do
int ratelim_do(session_t* sess,unsigned int maxrate,int nbytes)
{
    if ( 0 == maxrate )
        return 0;
    struct timeval tv;
    if ( -1 == gettimeofday(&tv,NULL) ) 
        return -1;

    double elapsed = (double)(tv.tv_sec - sess->ts_sec) + 0.000001 * (double)(tv.tv_usec - sess->ts_usec);
    if ( elapsed <= 0 )
        elapsed = 0.01;

    double currate = (double)nbytes / elapsed;
    if ( (int)currate < maxrate )
        return 0;
    double timetosleep = ( currate / (double)maxrate - 1 ) * elapsed;


    struct timespec ts;
    ts.tv_sec = (int)timetosleep;
    ts.tv_nsec = (timetosleep - ts.tv_sec) * 1000000000;

    int ret;
    do 
    {
        ret = nanosleep(&ts,&ts);
    } while ( -1 == ret && EINTR == errno); 

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
testl %esi, %esi
je 0x495e
movl %edx, %r14d
movl %esi, %ebp
movq %rdi, %r15
xorl %ebx, %ebx
leaq 0x8(%rsp), %rdi
xorl %esi, %esi
callq 0x3200
cmpl $-0x1, %eax
je 0x4962
movl 0xc38(%r15), %eax
movl 0xc3c(%r15), %ecx
movq 0x8(%rsp), %rdx
subq %rax, %rdx
cvtsi2sd %rdx, %xmm0
movq 0x10(%rsp), %rax
subq %rcx, %rax
cvtsi2sd %rax, %xmm2
mulsd 0x3894(%rip), %xmm2     # 0x8158
addsd %xmm0, %xmm2
xorpd %xmm0, %xmm0
movapd %xmm2, %xmm1
cmpnlesd %xmm0, %xmm1
andpd %xmm1, %xmm2
movsd 0x387f(%rip), %xmm0     # 0x8160
andnpd %xmm0, %xmm1
orpd %xmm2, %xmm1
xorps %xmm0, %xmm0
cvtsi2sd %r14d, %xmm0
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
cmpl %ebp, %eax
jb 0x4967
movl %ebp, %eax
xorps %xmm2, %xmm2
cvtsi2sd %rax, %xmm2
divsd %xmm2, %xmm0
addsd 0x3855(%rip), %xmm0     # 0x8168
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
cltq
cvttpd2dq %xmm0, %xmm1
cvtdq2pd %xmm1, %xmm1
leaq 0x18(%rsp), %r14
subsd %xmm1, %xmm0
mulsd 0x383a(%rip), %xmm0     # 0x8170
movq %rax, (%r14)
cvttsd2si %xmm0, %rax
movq %rax, 0x8(%r14)
movq %r14, %rdi
movq %r14, %rsi
callq 0x31d0
cmpl $-0x1, %eax
jne 0x4967
callq 0x3060
cmpl $0x4, (%rax)
je 0x4942
jmp 0x4967
xorl %ebx, %ebx
jmp 0x4967
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/icysunlight[P]miniftpd/str.c
// Function: str_split
int str_split(char* str,char *cmd,char* arg,char delim)
{
    char* pos = strchr(str,delim);
    if (NULL == pos)
    {
        strncpy(cmd,str,strlen(str));
        return 1;
    }
    else
    {
        *pos = '\0';
        strncpy(cmd,str,strlen(str));
        strncpy(arg,pos + 1,strlen(pos + 1));
        return 2;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movl %ecx, %esi
callq 0x31b0
testq %rax, %rax
je 0x49f3
movq %rax, %r12
movb $0x0, (%rax)
movq %r14, %rdi
callq 0x3180
movq %r15, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x3080
incq %r12
movq %r12, %rdi
callq 0x3180
movq %rbx, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x3080
movl $0x2, %eax
jmp 0x4a0e
movq %r14, %rdi
callq 0x3180
movq %r15, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x3080
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/icysunlight[P]miniftpd/str.c
// Function: str_octal_to_uint
unsigned int str_octal_to_uint(char* str)
{
    unsigned int ret = 0;
    while (*str) 
    {
        if (*str >= '0' && *str <= '7') 
        {
            ret = ret * 8 + *str - '0';
        }
        else
            return 0;
        str++;
    }
    return ret;
}

// Assembly:
movb (%rdi), %cl
testb %cl, %cl
je 0x4a77
incq %rdi
xorl %eax, %eax
movl %ecx, %edx
andb $-0x8, %dl
cmpb $0x30, %dl
jne 0x4a77
movzbl %cl, %ecx
leal (%rcx,%rax,8), %eax
addl $-0x30, %eax
movb (%rdi), %cl
incq %rdi
testb %cl, %cl
jne 0x4a5a
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/icysunlight[P]miniftpd/parseconf.c
// Function: parseconf_load_file
int parseconf_load_file(const char* file)
{
    FILE* pfile = fopen(file,"r");
    if (NULL == pfile)
    {
        fprintf(stderr, "config file open error\n");
        return -1;
    }

    char line[1024];
    while (NULL != fgets(line,1024,pfile))
    {
        if (-1 == parseconf_load_setting(line)) 
        {
            fprintf(stderr, "config file parse error");
        }
    }
    fclose(pfile);
    return 0;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
leaq 0x3620(%rip), %rsi      # 0x80c1
callq 0x3460
testq %rax, %rax
je 0x4b06
movq %rax, %rbx
movq %rsp, %rdi
movl $0x400, %esi            # imm = 0x400
movq %rax, %rdx
callq 0x32a0
testq %rax, %rax
je 0x4af1
movq %rsp, %r14
movq %r14, %rdi
callq 0x4b12
cmpl $-0x1, %eax
je 0x4aea
movq %r14, %rdi
movl $0x400, %esi            # imm = 0x400
movq %rbx, %rdx
callq 0x32a0
testq %rax, %rax
jne 0x4ac6
jmp 0x4af1
callq 0x375e
jmp 0x4ad3
movq %rbx, %rdi
callq 0x3130
xorl %eax, %eax
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r14
retq
callq 0x3780
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x4afb
// File: /workspace/github_c_makefile_star2_O3/icysunlight[P]miniftpd/ftpproto.c
// Function: ftp_reply
int ftp_reply(session_t* ssinf,int status,const char* text)
{
    char buf[1024] = {0};
    sprintf(buf,"%d %s\r\n",status,text);
    if ( -1 == writen(ssinf->ctrlfd,buf,strlen(buf)))
        ERR_EXIT("written error");
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r14
movq %rsp, %r15
movl $0x400, %edx            # imm = 0x400
movq %r15, %rdi
xorl %esi, %esi
callq 0x3220
leaq 0x3572(%rip), %rsi      # 0x8294
movq %r15, %rdi
movl %ebp, %edx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x34d0
movl 0x8(%r14), %ebx
movq %r15, %rdi
callq 0x3180
movl %ebx, %edi
movq %r15, %rsi
movq %rax, %rdx
callq 0x4466
cmpq $-0x1, %rax
je 0x4d60
xorl %eax, %eax
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0x379c
// File: /workspace/github_c_makefile_star2_O3/icysunlight[P]miniftpd/ftpproto.c
// Function: get_tcpsocket
int get_tcpsocket(session_t* sess,const char* ip,int nport)
{
    ftpipc_send_cmd(sess->protofd,FTPIPC_GET_DATA_FD);
    
    ftpipc_send_data(sess->protofd,ip,strlen(ip));
    ftpipc_send_data(sess->protofd,&nport,sizeof(int));

    ftpipc_send_data(sess->protofd,sess->port_addr,sizeof(struct sockaddr_in));

    int ret = ftpipc_recv_ret(sess->protofd);
    if ( FTPIPC_RET_OK == ret )
    {
        return ftpipc_recv_fd(sess->protofd);
    }
    else
        return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x4(%rsp), %r15
movl %edx, (%r15)
movl 0x4(%rdi), %edi
movl $0x1, %esi
callq 0x69cc
movl 0x4(%rbx), %ebp
movq %r14, %rdi
callq 0x3180
movl %ebp, %edi
movq %r14, %rsi
movl %eax, %edx
callq 0x6a45
movl 0x4(%rbx), %edi
movq %r15, %rsi
movl $0x4, %edx
callq 0x6a45
movl 0x4(%rbx), %edi
movq 0xc18(%rbx), %rsi
movl $0x10, %edx
callq 0x6a45
movl 0x4(%rbx), %edi
callq 0x6a21
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl $0x1, %ecx
jne 0x4e4f
movl 0x4(%rbx), %edi
callq 0x6b3d
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/icysunlight[P]miniftpd/ftpproto.c
// Function: getfileper
void getfileper(struct stat* fbuf,char* per)
{
    switch ( fbuf->st_mode & S_IFMT )
    {
    case S_IFSOCK:
        per[0] = 's';
        break;     
    case S_IFLNK:
        per[0] = 'l';
        break;     
    case S_IFREG:
        per[0] = '-';
        break;     
    case S_IFBLK:
        per[0] = 'b';
        break;     
    case S_IFDIR:
        per[0] = 'd';
        break;     
    case S_IFCHR:
        per[0] = 'c';
        break;     
    case S_IFIFO:
        per[0] = 'p';
        break;     
    }
    
    if ( fbuf->st_mode & S_IRUSR )
        per[1] = 'r';
    if ( fbuf->st_mode & S_IRUSR )
        per[2] = 'w';
    if ( fbuf->st_mode & S_IXUSR )
        per[3] = 'x';
    if ( fbuf->st_mode & S_IRGRP )
        per[4] = 'r';
    if ( fbuf->st_mode & S_IRGRP )
        per[5] = 'w';
    if ( fbuf->st_mode & S_IXGRP )
        per[6] = 'x';
    if ( fbuf->st_mode & S_IROTH )
        per[7] = 'r';
    if ( fbuf->st_mode & S_IROTH )
        per[8] = 'w';
    if ( fbuf->st_mode & S_IXOTH )
        per[9] = 'x';

    if ( fbuf->st_mode & S_ISUID)
        per[3] = (per[3] == 'x') ? 's' : 'S';
    if ( fbuf->st_mode & S_ISGID)
        per[6] = (per[6] == 'x') ? 's' : 'S';
    if ( fbuf->st_mode & S_ISVTX)
        per[9] = (per[9] == 'x') ? 't' : 'T';
}

// Assembly:
movl $0xf000, %eax           # imm = 0xF000
andl 0x18(%rdi), %eax
addl $0xfffff000, %eax       # imm = 0xFFFFF000
cmpl $0xbfff, %eax           # imm = 0xBFFF
ja 0x4e87
shrl $0xc, %eax
movl $0xaab, %ecx            # imm = 0xAAB
btl %eax, %ecx
jae 0x4e87
leaq 0x3c83(%rip), %rcx      # 0x8b05
movb (%rax,%rcx), %al
movb %al, (%rsi)
movl 0x18(%rdi), %eax
btl $0x8, %eax
jae 0x4ea4
movb $0x72, 0x1(%rsi)
movl 0x18(%rdi), %eax
btl $0x8, %eax
jae 0x4ea4
movb $0x77, 0x2(%rsi)
movl 0x18(%rdi), %eax
testb $0x40, %al
je 0x4eaf
movb $0x78, 0x3(%rsi)
movl 0x18(%rdi), %eax
testb $0x20, %al
je 0x4ec5
movb $0x72, 0x4(%rsi)
movl 0x18(%rdi), %eax
testb $0x20, %al
je 0x4ec5
movb $0x77, 0x5(%rsi)
movl 0x18(%rdi), %eax
testb $0x8, %al
je 0x4ed0
movb $0x78, 0x6(%rsi)
movl 0x18(%rdi), %eax
testb $0x4, %al
je 0x4ee6
movb $0x72, 0x7(%rsi)
movl 0x18(%rdi), %eax
testb $0x4, %al
je 0x4ee6
movb $0x77, 0x8(%rsi)
movl 0x18(%rdi), %eax
testb $0x1, %al
je 0x4ef1
movb $0x78, 0x9(%rsi)
movl 0x18(%rdi), %eax
btl $0xb, %eax
jae 0x4f09
cmpb $0x78, 0x3(%rsi)
sete %al
shlb $0x5, %al
orb $0x53, %al
movb %al, 0x3(%rsi)
movl 0x18(%rdi), %eax
btl $0xa, %eax
jae 0x4f21
cmpb $0x78, 0x6(%rsi)
sete %al
shlb $0x5, %al
orb $0x53, %al
movb %al, 0x6(%rsi)
movl 0x18(%rdi), %eax
btl $0x9, %eax
jae 0x4f36
cmpb $0x78, 0x9(%rsi)
sete %al
shlb $0x5, %al
orb $0x54, %al
movb %al, 0x9(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O3/icysunlight[P]miniftpd/ftpproto.c
// Function: cmd_disconn_start
int cmd_disconn_start()
{
    signal(SIGALRM,signal_cmdalarm);
    if ( 0 != tunable_idle_session_timeout) 
    {
        alarm(tunable_idle_session_timeout);
        //printf("alarm time:%u\n",tunable_idle_session_timeout);
    }
    return 0;
}

// Assembly:
pushq %rax
leaq 0x20(%rip), %rsi        # 0x521f
movl $0xe, %edi
callq 0x32f0
leaq 0x70d0(%rip), %rax      # 0xc2e0
movl (%rax), %edi
testl %edi, %edi
je 0x521b
callq 0x3250
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/icysunlight[P]miniftpd/ftpproto.c
// Function: signal_cmdalarm
void signal_cmdalarm(int sigal)
{
    shutdown(pssinf->ctrlfd,SHUT_RD);
    ftp_reply(pssinf,FTP_IDLE_TIMEOUT,"Time out");
    shutdown(pssinf->ctrlfd,SHUT_WR);
    exit(EXIT_SUCCESS);
}

// Assembly:
pushq %rax
movq 0x7101(%rip), %rax      # 0xc328
movl 0x8(%rax), %edi
xorl %esi, %esi
callq 0x3150
movq 0x70f0(%rip), %rdi      # 0xc328
leaq 0x30af(%rip), %rdx      # 0x82ee
movl $0x1a5, %esi            # imm = 0x1A5
callq 0x4cf4
movq 0x70d8(%rip), %rax      # 0xc328
movl 0x8(%rax), %edi
movl $0x1, %esi
callq 0x3150
xorl %edi, %edi
callq 0x34e0
// File: /workspace/github_c_makefile_star2_O3/icysunlight[P]miniftpd/ftpproto.c
// Function: data_disconn_start
int data_disconn_start()
{
    b_dataconn = 0;
    signal(SIGALRM,signal_dataalarm);
    if ( 0 != tunable_data_connection_timeout) 
    {
        alarm(tunable_data_connection_timeout);
    }
    return 0;
}

// Assembly:
pushq %rax
movl $0x0, 0x70b1(%rip)      # 0xc320
leaq 0x20(%rip), %rsi        # 0x5296
movl $0xe, %edi
callq 0x32f0
leaq 0x705d(%rip), %rax      # 0xc2e4
movl (%rax), %edi
testl %edi, %edi
je 0x5292
callq 0x3250
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/icysunlight[P]miniftpd/ftpproto.c
// Function: handle_sigurg
void handle_sigurg(int signal)
{        
    memset(pssinf->cmdline,0,sizeof(char) * MAXCMDLINE);
    memset(pssinf->cmd,0,sizeof(char) * MAXCMDLINE);
    memset(pssinf->arg,0,sizeof(char) * MAXCMDLINE);
    
    int ret = readline(pssinf->ctrlfd,pssinf->cmdline,MAXCMDLINE);
    if (-1 == ret )
        ERR_EXIT("read error");
    if (0 == ret)
        exit(EXIT_SUCCESS);

    str_trim_crlf(pssinf->cmdline);
    str_split(pssinf->cmdline,pssinf->cmd,pssinf->arg,' ');
    str_upper(pssinf->cmd);
    printf("[%s]\t[%s]\n",pssinf->cmd,pssinf->arg);

    if ( 0 == strcmp("ABOR",pssinf->cmd) || 0 == strcmp(pssinf->cmd,"\377\364\377\362ABOR"))
    {
        clear_transfer(pssinf);
        pssinf->burg = 1;        
    }
    else 
    {
        ftp_reply(pssinf,FTP_BADCMD,"Unkown command");
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq 0x705a(%rip), %r14      # 0xc328
leaq 0x18(%r14), %rbx
movl $0xc00, %edx            # imm = 0xC00
movq %rbx, %rdi
xorl %esi, %esi
callq 0x3220
movl 0x8(%r14), %edi
movl $0x400, %edx            # imm = 0x400
movq %rbx, %rsi
callq 0x4500
testl %eax, %eax
je 0x53d1
cmpl $-0x1, %eax
je 0x53d8
movq 0x701e(%rip), %rdi      # 0xc328
addq $0x18, %rdi
callq 0x4974
movq 0x700e(%rip), %rdx      # 0xc328
leaq 0x18(%rdx), %rdi
movl $0x418, %ebx            # imm = 0x418
leaq (%rdx,%rbx), %rsi
movl $0x818, %r14d           # imm = 0x818
addq %r14, %rdx
movl $0x20, %ecx
callq 0x499a
movq 0x6fe7(%rip), %rdi      # 0xc328
addq %rbx, %rdi
callq 0x4a1a
movq 0x6fd8(%rip), %rdx      # 0xc328
leaq (%rdx,%rbx), %rsi
addq %r14, %rdx
leaq 0x2fa4(%rip), %rdi      # 0x8302
xorl %eax, %eax
callq 0x31c0
movq 0x6fbc(%rip), %r14      # 0xc328
addq %r14, %rbx
leaq 0x2f9b(%rip), %rdi      # 0x8311
movq %rbx, %rsi
callq 0x32e0
testl %eax, %eax
je 0x53b0
leaq 0x2f84(%rip), %rsi      # 0x830d
movq %rbx, %rdi
callq 0x32e0
testl %eax, %eax
je 0x53b0
leaq 0x2f7a(%rip), %rdx      # 0x8316
movq %r14, %rdi
movl $0x1f4, %esi            # imm = 0x1F4
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x4cf4
movq %r14, %rdi
callq 0x479a
movq 0x6f69(%rip), %rax      # 0xc328
movl $0x1, 0xc40(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
xorl %edi, %edi
callq 0x34e0
callq 0x37f0
// File: /workspace/github_c_makefile_star2_O3/icysunlight[P]miniftpd/ftpproto.c
// Function: do_pass
static void do_pass(session_t* ssinf)
{
    struct spwd* spw = getspnam(username);
    struct passwd* pw = getpwnam(username);
    if (NULL == spw || NULL == pw) 
    {
        ftp_reply(ssinf,530,"Login incorrect");
    }

    char* encriedpw = crypt(ssinf->arg,spw->sp_pwdp);
    if ( 0 == strcmp(encriedpw,spw->sp_pwdp))
    {
        printf("login success\tusername:%s\n",username);    
        ftp_reply(ssinf,230,"Login successful");
        setegid(pw->pw_gid);
        seteuid(pw->pw_uid);
        chdir(pw->pw_dir);
    }
    else
    {
        ftp_reply(ssinf,530,"Login incorrect");
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %r14
leaq 0x6ccf(%rip), %rbx      # 0xc330
movq %rbx, %rdi
callq 0x3440
movq %rax, %r15
movq %rbx, %rdi
callq 0x3300
movq %rax, %rbx
testq %r15, %r15
setne %al
testq %rbx, %rbx
setne %cl
testb %cl, %al
jne 0x569b
leaq 0x2dd7(%rip), %rdx      # 0x8465
movq %r14, %rdi
movl $0x212, %esi            # imm = 0x212
callq 0x4cf4
leaq 0x818(%r14), %rdi
movq 0x8(%r15), %rsi
callq 0x3520
movq 0x8(%r15), %rsi
movq %rax, %rdi
callq 0x32e0
testl %eax, %eax
je 0x56d4
leaq 0x2da3(%rip), %rdx      # 0x8465
movq %r14, %rdi
movl $0x212, %esi            # imm = 0x212
popq %rbx
popq %r14
popq %r15
jmp 0x4cf4
leaq 0x2d9a(%rip), %rdi      # 0x8475
leaq 0x6c4e(%rip), %rsi      # 0xc330
xorl %eax, %eax
callq 0x31c0
leaq 0x2da0(%rip), %rdx      # 0x8490
movq %r14, %rdi
movl $0xe6, %esi
callq 0x4cf4
movl 0x14(%rbx), %edi
callq 0x3530
movl 0x10(%rbx), %edi
callq 0x3560
movq 0x20(%rbx), %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x3190
// File: /workspace/github_c_makefile_star2_O3/icysunlight[P]miniftpd/ftpproto.c
// Function: do_port
void do_port(session_t *sess)
{
    clear_transfer(sess);

    int naddr[6];  
    sscanf(sess->arg,"%d,%d,%d,%d,%d,%d",&naddr[0],&naddr[1],&naddr[2],&naddr[3],&naddr[4],&naddr[5]);
    char ip[12] = {0};
    sprintf(ip,"%d.%d.%d.%d",naddr[0],naddr[1],naddr[2],naddr[3]);

    unsigned short nport = naddr[4];
    nport = (nport << 8) + naddr[5];


    //printf("addr:\tip:%s\tport:%d\n",ip,nport); 
    sess->port_addr = (struct sockaddr_in*)malloc(sizeof(struct sockaddr_in));

    sess->port_addr->sin_family = AF_INET;
    sess->port_addr->sin_port = htons(nport);
    sess->port_addr->sin_addr.s_addr = (inet_addr(ip));;


    ftp_reply(sess,FTP_PORTOK,"Port commande successful.");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
callq 0x479a
leaq 0x818(%rbx), %rdi
leaq 0x4(%rsp), %rcx
leaq 0x8(%rsp), %r8
leaq 0xc(%rsp), %r9
leaq 0x10(%rsp), %r10
leaq 0x14(%rsp), %r11
leaq 0x2cff(%rip), %rsi      # 0x84ea
movq %rsp, %r14
movq %r14, %rdx
xorl %eax, %eax
pushq %r11
pushq %r10
callq 0x33b0
addq $0x10, %rsp
leaq 0x18(%rsp), %r15
movl $0x0, 0x8(%r15)
movq $0x0, (%r15)
movl (%r14), %edx
movl 0x4(%r14), %ecx
movl 0x8(%r14), %r8d
movl 0xc(%r14), %r9d
leaq 0x2cd2(%rip), %rsi      # 0x84fc
movq %r15, %rdi
xorl %eax, %eax
callq 0x34d0
movl 0x10(%r14), %ebp
shll $0x8, %ebp
addl 0x14(%r14), %ebp
movl $0x10, %edi
callq 0x33a0
movq %rax, 0xc18(%rbx)
movw $0x2, (%rax)
rolw $0x8, %bp
movw %bp, 0x2(%rax)
movq %r15, %rdi
callq 0x32d0
movq 0xc18(%rbx), %rcx
movl %eax, 0x4(%rcx)
leaq 0x2c92(%rip), %rdx      # 0x8508
movq %rbx, %rdi
movl $0xc8, %esi
callq 0x4cf4
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/icysunlight[P]miniftpd/ftpproto.c
// Function: do_pasv
void do_pasv(session_t *sess)
{
    clear_transfer(sess);

    sess->pasv_lsfd = tcp_srv(listenip,0);
    
    struct sockaddr_in srvaddr;
    socklen_t socklen = sizeof(srvaddr);
    if ( -1 == getsockname(sess->pasv_lsfd,(struct sockaddr*)&srvaddr,&socklen))
        ERR_EXIT("getsockname error");
    

    char buf[1024];
    unsigned int port = ntohs(srvaddr.sin_port);
    unsigned int naddr[4];
    sscanf(inet_ntoa(srvaddr.sin_addr),"%u.%u.%u.%d",&naddr[0],&naddr[1],&naddr[2],
            &naddr[3]);

    sprintf(buf,"Entering Passive Mode (%u,%u,%u,%u,%u,%u).",naddr[0],naddr[1],naddr[2],naddr[3],
                port >> 8 , port & 0xFF);

    //printf("port :%u\n",port);
    
    ftp_reply(sess,FTP_PASVOK,buf);


}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x430, %rsp            # imm = 0x430
movq %rdi, %rbx
callq 0x479a
leaq 0x6a60(%rip), %rax      # 0xc308
movq (%rax), %rdi
xorl %esi, %esi
callq 0x3d86
movl %eax, 0xc20(%rbx)
leaq 0x1c(%rsp), %rdx
movl $0x10, (%rdx)
leaq 0x20(%rsp), %rsi
movl %eax, %edi
callq 0x34b0
cmpl $-0x1, %eax
je 0x5967
movzwl 0x22(%rsp), %eax
rolw $0x8, %ax
movzwl %ax, %ebp
movl 0x24(%rsp), %edi
callq 0x3120
leaq 0x4(%rsp), %rcx
leaq 0x8(%rsp), %r8
leaq 0xc(%rsp), %r9
leaq 0x2c31(%rip), %rsi      # 0x8534
movq %rsp, %r14
movq %rax, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x33b0
movl (%r14), %edx
movl 0x4(%r14), %ecx
movl 0x8(%r14), %r8d
movl 0xc(%r14), %r9d
movl %ebp, %r10d
shrl $0x8, %r10d
movzbl %bpl, %r11d
leaq 0x2c0c(%rip), %rsi      # 0x8540
leaq 0x30(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
pushq %r11
pushq %r10
callq 0x34d0
addq $0x10, %rsp
movq %rbx, %rdi
movl $0xe3, %esi
movq %r14, %rdx
callq 0x4cf4
addq $0x430, %rsp            # imm = 0x430
popq %rbx
popq %r14
popq %rbp
retq
callq 0x3805
// File: /workspace/github_c_makefile_star2_O3/icysunlight[P]miniftpd/ftpproto.c
// Function: do_type
void do_type(session_t *sess)
{
    //printf("%s\n",sess->arg);
    if ( 0 == strcmp("A",sess->arg))
    {
        //sess->bASCII = 1;
        //ftp_reply(sess,FTP_TYPEOK,"Switching to ASCII mode.");
        ftp_reply(sess,504,"ASCII mode unimplement");
    }
    else if ( 0 == strcmp("I",sess->arg))
    {
        sess->bASCII = 0;
        ftp_reply(sess,FTP_TYPEOK,"Switching to Binary mode.");
    }
    else
    {
        ftp_reply(sess,FTP_BADCMD,"Unrecognised TYPE command.");
    }
}

// Assembly:
movzbl 0x818(%rdi), %eax
cmpl $0x41, %eax
jne 0x5992
cmpb $0x0, 0x819(%rdi)
jne 0x59a4
leaq 0x2be3(%rip), %rdx      # 0x856b
movl $0x1f8, %esi            # imm = 0x1F8
jmp 0x4cf4
subl $0x49, %eax
jne 0x599e
movzbl 0x819(%rdi), %eax
negl %eax
testl %eax, %eax
je 0x59b5
leaq 0x2bf1(%rip), %rdx      # 0x859c
movl $0x1f4, %esi            # imm = 0x1F4
jmp 0x4cf4
movl $0x0, 0x10(%rdi)
leaq 0x2bbf(%rip), %rdx      # 0x8582
movl $0xc8, %esi
jmp 0x4cf4
// File: /workspace/github_c_makefile_star2_O3/icysunlight[P]miniftpd/ftpproto.c
// Function: do_list
void do_list(session_t *sess)
{
    int data_fd = get_datafd(sess);
    if ( -1 == data_fd )
    {
        ftp_reply(sess,FTP_BADSENDCONN,"Use port or pasv first");
        return;
    }

    char buf[1024];
    getcwd(buf,1024); 
    ftp_reply(sess,FTP_DATACONN,"Here comes the dictionary listing.");
    transfer_list(data_fd,buf);
    close(data_fd);
    ftp_reply(sess,FTP_TRANSFEROK,"Directory send OK.");
    clear_transfer(sess);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x400, %rsp            # imm = 0x400
movq %rdi, %rbx
callq 0x559c
cmpl $-0x1, %eax
je 0x5e8b
movl %eax, %ebp
movq %rsp, %r14
movl $0x400, %esi            # imm = 0x400
movq %r14, %rdi
callq 0x3240
leaq 0x2858(%rip), %rdx      # 0x869d
movq %rbx, %rdi
movl $0x96, %esi
callq 0x4cf4
movl %ebp, %edi
movq %r14, %rsi
callq 0x4f37
movl %ebp, %edi
callq 0x3260
leaq 0x2856(%rip), %rdx      # 0x86c0
movq %rbx, %rdi
movl $0xe2, %esi
callq 0x4cf4
movq %rbx, %rdi
callq 0x479a
addq $0x400, %rsp            # imm = 0x400
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x2725(%rip), %rdx      # 0x85b7
movq %rbx, %rdi
movl $0x1a9, %esi            # imm = 0x1A9
addq $0x400, %rsp            # imm = 0x400
popq %rbx
popq %r14
popq %rbp
jmp 0x4cf4
// File: /workspace/github_c_makefile_star2_O3/icysunlight[P]miniftpd/ftpproto.c
// Function: do_mkd
void do_mkd(session_t *sess)
{
    if ( -1 == mkdir(sess->arg,0777) )
    {
        ftp_reply(sess,FTP_FILEFAIL,"Create dictionary operation filed");
    }
    else 
    {
        char buf[1024] = {0};
        sprintf(buf,"\"%s\" created.",sess->arg);
        ftp_reply(sess,FTP_MKDIROK,buf);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x400, %rsp            # imm = 0x400
movq %rdi, %rbx
leaq 0x818(%rdi), %r14
movq %r14, %rdi
movl $0x1ff, %esi            # imm = 0x1FF
callq 0x30a0
cmpl $-0x1, %eax
je 0x5fde
movq %rsp, %r15
movl $0x400, %edx            # imm = 0x400
movq %r15, %rdi
xorl %esi, %esi
callq 0x3220
leaq 0x2781(%rip), %rsi      # 0x8735
movq %r15, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x34d0
movq %rbx, %rdi
movl $0x101, %esi            # imm = 0x101
movq %r15, %rdx
callq 0x4cf4
addq $0x400, %rsp            # imm = 0x400
popq %rbx
popq %r14
popq %r15
retq
leaq 0x272e(%rip), %rdx      # 0x8713
movq %rbx, %rdi
movl $0x226, %esi            # imm = 0x226
addq $0x400, %rsp            # imm = 0x400
popq %rbx
popq %r14
popq %r15
jmp 0x4cf4
// File: /workspace/github_c_makefile_star2_O3/icysunlight[P]miniftpd/ftpproto.c
// Function: do_rnfr
void do_rnfr(session_t *sess)
{
    if ( NULL == sess->rn_filepath ) 
        sess->rn_filepath = (char*)malloc(strlen(sess->arg));
    else 
    {
        free(sess->rn_filepath);
        sess->rn_filepath = (char*)malloc(strlen(sess->arg) + 2);
    }

    strcpy(sess->rn_filepath,sess->arg);

    ftp_reply(sess,FTP_RESTOK,"Ready for RNTO.");
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0xc28(%rdi), %rdi
testq %rdi, %rdi
je 0x6096
callq 0x3040
leaq 0x818(%rbx), %rdi
callq 0x3180
addq $0x2, %rax
jmp 0x60a2
leaq 0x818(%rbx), %rdi
callq 0x3180
movq %rax, %rdi
callq 0x33a0
movq %rax, 0xc28(%rbx)
leaq 0x818(%rbx), %rsi
movq %rax, %rdi
callq 0x3090
leaq 0x26f8(%rip), %rdx      # 0x87bf
movq %rbx, %rdi
movl $0x15e, %esi            # imm = 0x15E
popq %rbx
jmp 0x4cf4
// File: /workspace/github_c_makefile_star2_O3/icysunlight[P]miniftpd/ftpproto.c
// Function: do_rnto
void do_rnto(session_t *sess)
{
    if ( NULL == sess->rn_filepath) 
    {
        ftp_reply(sess,FTP_NEEDRNFR,"RNFR required first.");
        return;
    }

    if ( -1 == rename(sess->rn_filepath,sess->arg))
    {
        printf("oripath:%s\t,detpath:%s\n",sess->rn_filepath,sess->arg);
        ftp_reply(sess,FTP_FILEFAIL,"Rename failed.");
    }
    else
        ftp_reply(sess,FTP_RENAMEOK,"Rename successful.");

    free(sess->rn_filepath);
    sess->rn_filepath = NULL;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0xc28(%rdi), %rdi
testq %rdi, %rdi
je 0x610d
leaq 0x818(%rbx), %r14
movq %r14, %rsi
callq 0x3480
cmpl $-0x1, %eax
je 0x6128
leaq 0x2708(%rip), %rdx      # 0x880b
movq %rbx, %rdi
movl $0xfa, %esi
jmp 0x614f
leaq 0x26bb(%rip), %rdx      # 0x87cf
movq %rbx, %rdi
movl $0x1f7, %esi            # imm = 0x1F7
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x4cf4
movq 0xc28(%rbx), %rsi
leaq 0x26ae(%rip), %rdi      # 0x87e4
movq %r14, %rdx
xorl %eax, %eax
callq 0x31c0
leaq 0x26b5(%rip), %rdx      # 0x87fc
movq %rbx, %rdi
movl $0x226, %esi            # imm = 0x226
callq 0x4cf4
movq 0xc28(%rbx), %rdi
callq 0x3040
movq $0x0, 0xc28(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/icysunlight[P]miniftpd/ftpproto.c
// Function: do_feat
void do_feat(session_t *sess)
{
    ftp_lreply(sess,FTP_FEAT,"Features");
    writen(sess->ctrlfd," EPRT\r\n",strlen(" EPRT\r\n"));
    writen(sess->ctrlfd," EPSV\r\n",strlen(" EPSV\r\n"));
    writen(sess->ctrlfd," MDTM\r\n",strlen(" MDTM\r\n"));
    writen(sess->ctrlfd," PASV\r\n",strlen(" PASV\r\n"));
    writen(sess->ctrlfd," REST STREAM\r\n",strlen(" REST STREAM\r\n"));
    writen(sess->ctrlfd," SIZE\r\n",strlen(" SIZE\r\n"));
    writen(sess->ctrlfd," TVFS\r\n",strlen(" PASV\r\n"));
    writen(sess->ctrlfd," UTF8\r\n",strlen(" UTF8\r\n"));
    ftp_reply(sess,FTP_FEAT,"End");
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0x24a4(%rip), %rdx      # 0x88d8
movl $0xd3, %esi
callq 0x4d65
movl 0x8(%rbx), %edi
leaq 0x2499(%rip), %rsi      # 0x88e1
movl $0x7, %edx
callq 0x4466
movl 0x8(%rbx), %edi
leaq 0x248d(%rip), %rsi      # 0x88e9
movl $0x7, %edx
callq 0x4466
movl 0x8(%rbx), %edi
leaq 0x2481(%rip), %rsi      # 0x88f1
movl $0x7, %edx
callq 0x4466
movl 0x8(%rbx), %edi
leaq 0x2475(%rip), %rsi      # 0x88f9
movl $0x7, %edx
callq 0x4466
movl 0x8(%rbx), %edi
leaq 0x2469(%rip), %rsi      # 0x8901
movl $0xe, %edx
callq 0x4466
movl 0x8(%rbx), %edi
leaq 0x2464(%rip), %rsi      # 0x8910
movl $0x7, %edx
callq 0x4466
movl 0x8(%rbx), %edi
leaq 0x2458(%rip), %rsi      # 0x8918
movl $0x7, %edx
callq 0x4466
movl 0x8(%rbx), %edi
leaq 0x244c(%rip), %rsi      # 0x8920
movl $0x7, %edx
callq 0x4466
leaq 0x2443(%rip), %rdx      # 0x8928
movq %rbx, %rdi
movl $0xd3, %esi
popq %rbx
jmp 0x4cf4
// File: /workspace/github_c_makefile_star2_O3/icysunlight[P]miniftpd/ftpproto.c
// Function: do_size
void do_size(session_t *sess)
{
    struct stat statbuf;
    if ( -1 == stat(sess->arg,&statbuf) )
    {
        ftp_reply(sess,FTP_FILEFAIL,"Could not get file size.");
        return;
    }

    if ( !S_ISREG(statbuf.st_mode) )
    {
        ftp_reply(sess,FTP_FILEFAIL,"Could not get file size.");
        return;
    }

    char sizebuf[128] = {0};
    sprintf(sizebuf,"%d",(int)statbuf.st_size);
    ftp_reply(sess,FTP_SIZEOK,sizebuf);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rdi, %rbx
addq $0x818, %rdi            # imm = 0x818
movq %rsp, %rsi
callq 0x3340
cmpl $-0x1, %eax
je 0x6586
movl $0xf000, %eax           # imm = 0xF000
andl 0x18(%rsp), %eax
cmpl $0x8000, %eax           # imm = 0x8000
jne 0x6586
xorps %xmm0, %xmm0
leaq 0x90(%rsp), %r14
movaps %xmm0, 0x70(%r14)
movaps %xmm0, 0x60(%r14)
movaps %xmm0, 0x50(%r14)
movaps %xmm0, 0x40(%r14)
movaps %xmm0, 0x30(%r14)
movaps %xmm0, 0x20(%r14)
movaps %xmm0, 0x10(%r14)
movaps %xmm0, (%r14)
movl 0x30(%rsp), %edx
leaq 0x1d77(%rip), %rsi      # 0x82d8
movq %r14, %rdi
xorl %eax, %eax
callq 0x34d0
movq %rbx, %rdi
movl $0xd5, %esi
movq %r14, %rdx
callq 0x4cf4
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r14
retq
leaq 0x239f(%rip), %rdx      # 0x892c
movq %rbx, %rdi
movl $0x226, %esi            # imm = 0x226
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r14
jmp 0x4cf4
// File: /workspace/github_c_makefile_star2_O3/icysunlight[P]miniftpd/ftpproto.c
// Function: do_stat
void do_stat(session_t *sess)
{
    ftp_lreply(sess,FTP_STATOK,"FTP server status:");
    char buf[1024] = {0};

    struct in_addr inaddr;
    inaddr.s_addr = (sess->ip);
    sprintf(buf," Connected to %s\r\n",inet_ntoa(inaddr));
    writen(sess->ctrlfd,buf,strlen(buf));

    memset(buf,0,sizeof(char) * 1024);
    sprintf(buf," Logged in as %s\r\n",username);
    writen(sess->ctrlfd,buf,strlen(buf));
    
    memset(buf,0,sizeof(char) * 1024);
    if ( sess->bASCII )
        sprintf(buf," TYPE: ASCII \r\n");
    else
        sprintf(buf," TYPE: BINARY \r\n");
    writen(sess->ctrlfd,buf,strlen(buf));

    memset(buf,0,sizeof(char) * 1024);
    if ( 0 == tunable_connect_timeout ) 
        sprintf(buf," No session timeout\r\n");
    else
        sprintf(buf," Session timeout in seconds is %u\r\n",tunable_connect_timeout);
    writen(sess->ctrlfd,buf,strlen(buf));

    ftp_reply(sess,FTP_STATOK,"End of status");
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x400, %rsp            # imm = 0x400
movq %rdi, %rbx
leaq 0x238c(%rip), %rdx      # 0x8945
movl $0xd3, %esi
callq 0x4d65
movq %rsp, %r14
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
xorl %esi, %esi
callq 0x3220
movl 0xc44(%rbx), %edi
callq 0x3120
leaq 0x2371(%rip), %rsi      # 0x8958
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x34d0
movl 0x8(%rbx), %ebp
movq %r14, %rdi
callq 0x3180
movl %ebp, %edi
movq %r14, %rsi
movq %rax, %rdx
callq 0x4466
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
xorl %esi, %esi
callq 0x3220
leaq 0x2349(%rip), %rsi      # 0x896b
leaq 0x5d07(%rip), %rdx      # 0xc330
movq %r14, %rdi
xorl %eax, %eax
callq 0x34d0
movl 0x8(%rbx), %ebp
movq %r14, %rdi
callq 0x3180
movl %ebp, %edi
movq %r14, %rsi
movq %rax, %rdx
callq 0x4466
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
xorl %esi, %esi
callq 0x3220
cmpl $0x0, 0x10(%rbx)
je 0x666d
movups 0x2317(%rip), %xmm0     # 0x897e
movaps %xmm0, (%rsp)
jmp 0x667d
movups 0x231a(%rip), %xmm0     # 0x898e
movaps %xmm0, (%rsp)
movb $0x0, 0x10(%rsp)
movl 0x8(%rbx), %ebp
movq %rsp, %r14
movq %r14, %rdi
callq 0x3180
movl %ebp, %edi
movq %r14, %rsi
movq %rax, %rdx
callq 0x4466
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
xorl %esi, %esi
callq 0x3220
leaq 0x5c62(%rip), %rax      # 0xc310
movl (%rax), %edx
testl %edx, %edx
je 0x66c7
leaq 0x22fa(%rip), %rsi      # 0x89b5
movq %rsp, %rdi
xorl %eax, %eax
callq 0x34d0
jmp 0x66e1
movups 0x22d1(%rip), %xmm0     # 0x899f
movaps %xmm0, (%rsp)
movabsq $0xa0d74756f656d, %rax  # imm = 0xA0D74756F656D
movq %rax, 0xe(%rsp)
movl 0x8(%rbx), %ebp
movq %rsp, %r14
movq %r14, %rdi
callq 0x3180
movl %ebp, %edi
movq %r14, %rsi
movq %rax, %rdx
callq 0x4466
leaq 0x22d6(%rip), %rdx      # 0x89d9
movq %rbx, %rdi
movl $0xd3, %esi
callq 0x4cf4
addq $0x400, %rsp            # imm = 0x400
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/icysunlight[P]miniftpd/ftpproto.c
// Function: do_help
void do_help(session_t *sess)
{
    ftp_lreply(sess,FTP_HELP,"The following commands are recognized.");
    writen(sess->ctrlfd," ABOR ACCT ALLO APPE CDUP CWD  DELE EPRT EPSV FEAT HELP LIST MDTM MKD\r\n",
            strlen(" ABOR ACCT ALLO APPE CDUP CWD  DELE EPRT EPSV FEAT HELP LIST MDTM MKD\r\n"));
    writen(sess->ctrlfd," MODE NLST NOOP OPTS PASS PASV PORT PWD  QUIT REIN REST RETR RMD  RNFR\r\n",
            strlen(" MODE NLST NOOP OPTS PASS PASV PORT PWD  QUIT REIN REST RETR RMD  RNFR\r\n"));
    writen(sess->ctrlfd," RNTO SITE SIZE SMNT STAT STOR STOU STRU SYST TYPE USER XCUP XCWD XMKD\r\n",
            strlen(" RNTO SITE SIZE SMNT STAT STOR STOU STRU SYST TYPE USER XCUP XCWD XMKD\r\n"));
    writen(sess->ctrlfd," XPWD XRMD\r\n",strlen(" XPWD XRMD\r\n"));
    ftp_reply(sess,FTP_HELP,"HELP OK");
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0x22b7(%rip), %rdx      # 0x89ef
movl $0xd6, %esi
callq 0x4d65
movl 0x8(%rbx), %edi
leaq 0x22ca(%rip), %rsi      # 0x8a16
movl $0x47, %edx
callq 0x4466
movl 0x8(%rbx), %edi
leaq 0x22fe(%rip), %rsi      # 0x8a5e
movl $0x48, %edx
callq 0x4466
movl 0x8(%rbx), %edi
leaq 0x2333(%rip), %rsi      # 0x8aa7
movl $0x48, %edx
callq 0x4466
movl 0x8(%rbx), %edi
leaq 0x2368(%rip), %rsi      # 0x8af0
movl $0xc, %edx
callq 0x4466
leaq 0x2364(%rip), %rdx      # 0x8afd
movq %rbx, %rdi
movl $0xd6, %esi
popq %rbx
jmp 0x4cf4
nop
// File: /workspace/github_c_makefile_star2_O3/icysunlight[P]miniftpd/ftpnobody.c
// Function: set_minprivilage
void set_minprivilage(void)
{
    struct passwd* pwd = getpwnam("nobody");
    if ( NULL == pwd )
        ERR_EXIT("getpwnam error");
    if ( -1 == setegid(pwd->pw_gid))
        ERR_EXIT("setegid error"); 
    if ( -1 == seteuid(pwd->pw_uid))
        ERR_EXIT("seteuid error"); 

    struct __user_cap_header_struct cap_header;
    cap_header.version = _LINUX_CAPABILITY_VERSION_1;
    cap_header.pid = 0;
    struct __user_cap_data_struct cap_data;
    cap_data.effective = cap_data.permitted = 1 << CAP_NET_BIND_SERVICE;
    cap_data.inheritable = 0;
    if ( -1 == capset(&cap_header,&cap_data))
        ERR_EXIT("capset error");
}

// Assembly:
pushq %rbx
subq $0x20, %rsp
leaq 0x2326(%rip), %rdi      # 0x8b27
callq 0x3300
testq %rax, %rax
je 0x6864
movq %rax, %rbx
movl 0x14(%rax), %edi
callq 0x3530
cmpl $-0x1, %eax
je 0x6869
movl 0x10(%rbx), %edi
callq 0x3560
cmpl $-0x1, %eax
je 0x686e
leaq 0xc(%rsp), %rsi
movq $0x19980330, (%rsi)     # imm = 0x19980330
movabsq $0x40000000400, %rax    # imm = 0x40000000400
leaq 0x14(%rsp), %rdx
movq %rax, (%rdx)
movl $0x0, 0x8(%rdx)
movl $0x7e, %edi
xorl %eax, %eax
callq 0x3320
cmpl $-0x1, %eax
je 0x6873
addq $0x20, %rsp
popq %rbx
retq
callq 0x387f
callq 0x386a
callq 0x3855
callq 0x3840
// File: /workspace/github_c_makefile_star2_O3/icysunlight[P]miniftpd/ftpnobody.c
// Function: do_getdatafd
void do_getdatafd(session_t* ssinf)
{
    char ip[128] = {0};
    int port;
    if ( -1 == ftpipc_recv_data(ssinf->nobodyfd,ip,128))
        return;
    if ( -1 == ftpipc_recv_data(ssinf->nobodyfd,&port,sizeof(int)))
       return;
    //printf("nobody recv data:oip:%s\t,%u\n",ip,port);


    struct sockaddr_in addr;
    if ( -1 == ftpipc_recv_data(ssinf->nobodyfd,&addr,sizeof(addr)))
        return;
    //printf("ip:%s\tport:%d\n",inet_ntoa(addr.sin_addr),ntohs(addr.sin_port)); 



    int fd = tcp_clnt(ip,port);
    if ( -1 == connect_timeout(fd,&addr,tunable_connect_timeout))
    {
        ERR_EXIT("connect_timeout error");
    }
    //printf("connect success\n");
     

    if ( -1 == fd )
        ftpipc_send_ret(ssinf->nobodyfd,FTPIPC_RET_BAD);
    
    ftpipc_send_ret(ssinf->nobodyfd,FTPIPC_RET_OK);
    ftpipc_send_fd(ssinf->nobodyfd,fd); 

    close(fd);
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0xa8, %rsp
movq %rdi, %rbx
xorps %xmm0, %xmm0
leaq 0x20(%rsp), %rsi
movaps %xmm0, 0x70(%rsi)
movaps %xmm0, 0x60(%rsi)
movaps %xmm0, 0x50(%rsi)
movaps %xmm0, 0x40(%rsi)
movaps %xmm0, 0x30(%rsi)
movaps %xmm0, 0x20(%rsi)
movaps %xmm0, 0x10(%rsi)
movaps %xmm0, (%rsi)
movl (%rdi), %edi
movl $0x80, %edx
callq 0x6aae
cmpl $-0x1, %eax
je 0x6944
movl (%rbx), %edi
leaq 0xc(%rsp), %rsi
movl $0x4, %edx
callq 0x6aae
cmpl $-0x1, %eax
je 0x6944
movl (%rbx), %edi
leaq 0x10(%rsp), %rsi
movl $0x10, %edx
callq 0x6aae
cmpl $-0x1, %eax
je 0x6944
movzwl 0xc(%rsp), %esi
leaq 0x20(%rsp), %rdi
callq 0x3e58
movl %eax, %ebp
leaq 0x5a0c(%rip), %rax      # 0xc310
movl (%rax), %edx
leaq 0x10(%rsp), %rsi
movl %ebp, %edi
callq 0x42ab
cmpl $-0x1, %eax
je 0x694e
cmpl $-0x1, %ebp
jne 0x6928
movl (%rbx), %edi
movl $0x2, %esi
callq 0x6a0a
movl (%rbx), %edi
movl $0x1, %esi
callq 0x6a0a
movl (%rbx), %edi
movl %ebp, %esi
callq 0x6b33
movl %ebp, %edi
callq 0x3260
addq $0xa8, %rsp
popq %rbx
popq %rbp
retq
callq 0x3894
nop
// File: /workspace/github_c_makefile_star2_O3/icysunlight[P]miniftpd/ftpipc.c
// Function: ftpipc_init
int ftpipc_init(session_t* ssinf)
{
    int fd[2];
    if (-1 == socketpair(AF_UNIX,SOCK_STREAM,0,fd))
        ERR_EXIT("socketpair error");

    ssinf->protofd = fd[0];
    ssinf->nobodyfd = fd[1];

    return 0;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq 0x8(%rsp), %rcx
movl $0x1, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x3360
cmpl $-0x1, %eax
je 0x698e
movq 0x8(%rsp), %xmm0
pshufd $0xe1, %xmm0, %xmm0     # xmm0 = xmm0[1,0,2,3]
movq %xmm0, (%rbx)
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
retq
callq 0x38a9
// File: /workspace/github_c_makefile_star2_O3/icysunlight[P]miniftpd/ftpipc.c
// Function: ftpipc_close
void ftpipc_close(session_t* ssinf)
{
    if ( ssinf->protofd != -1 )
        close(ssinf->protofd);
    if ( ssinf->nobodyfd != -1 )
        close(ssinf->nobodyfd);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl 0x4(%rdi), %edi
cmpl $-0x1, %edi
je 0x69a4
callq 0x3260
movl (%rbx), %edi
cmpl $-0x1, %edi
je 0x69b1
popq %rbx
jmp 0x3260
popq %rbx
retq