LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/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 %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
addq $0x8, %rdi
movl $0xc38, %edx            # imm = 0xC38
xorl %esi, %esi
callq 0x3220
movl %ebx, 0x8(%r14)
orq $-0x1, (%r14)
andq $0x0, 0xc28(%r14)
orl $-0x1, 0xc20(%r14)
andq $0x0, 0xc40(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/icysunlight[P]miniftpd/session.c
// Function: begin_session
int begin_session(session_t* sessioninf)
{

    ftpipc_init(sessioninf);

    pid_t pid = fork();
    if (-1 == pid)
        ERR_EXIT("fork error");

    if (pid > 0)
    {
        //nobody process
        //set the process nobody
        ftpipc_setnobody(sessioninf);
        handle_pri(sessioninf);
    }
    if (0 == pid)
    {
        //ftp proto
        ftpipc_setproto(sessioninf);
        handle_ftp(sessioninf);
    }
    
    return 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x64c0
callq 0x3540
cmpl $-0x1, %eax
je 0x42fc
testl %eax, %eax
jle 0x42e6
movq %rbx, %rdi
callq 0x6529
movq %rbx, %rdi
callq 0x6314
jmp 0x42f8
jne 0x42f8
movq %rbx, %rdi
callq 0x6536
movq %rbx, %rdi
callq 0x4fbe
xorl %eax, %eax
popq %rbx
retq
leaq 0x2e75(%rip), %rdi      # 0x7178
callq 0x3470
pushq $0x1
popq %rdi
callq 0x34e0
// File: /workspace/github_c_makefile_star2_O2/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 0x434f
movl (%rbx), %edi
cmpl $-0x1, %edi
je 0x4325
callq 0x3260
movl 0x4(%rbx), %edi
cmpl $-0x1, %edi
je 0x4332
callq 0x3260
movl 0x8(%rbx), %edi
cmpl $-0x1, %edi
je 0x433f
callq 0x3260
movl 0xc(%rbx), %edi
cmpl $-0x1, %edi
je 0x434d
popq %rbx
jmp 0x3260
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/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
pushq $0x2
popq %rsi
callq 0x3150
orl $-0x1, 0xc(%rbx)
movq 0xc18(%rbx), %rdi
testq %rdi, %rdi
je 0x437b
callq 0x3040
andq $0x0, 0xc18(%rbx)
movl 0xc20(%rbx), %edi
cmpl $-0x1, %edi
je 0x4392
callq 0x3260
orl $-0x1, 0xc20(%rbx)
movq 0xc28(%rbx), %rdi
callq 0x3040
andq $0x0, 0xc30(%rbx)
andl $0x0, 0x14(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x44f5
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 0x44f9
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 0x2cf7(%rip), %xmm2     # 0x7158
addsd %xmm0, %xmm2
xorpd %xmm0, %xmm0
movapd %xmm2, %xmm1
cmpnlesd %xmm0, %xmm1
andpd %xmm1, %xmm2
movsd 0x2ce2(%rip), %xmm0     # 0x7160
andnpd %xmm0, %xmm1
orpd %xmm2, %xmm1
cvtsi2sd %r14d, %xmm0
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
cmpl %ebp, %eax
jb 0x44fc
movl %ebp, %eax
cvtsi2sd %rax, %xmm2
divsd %xmm2, %xmm0
addsd 0x2cbe(%rip), %xmm0     # 0x7168
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
cltq
cvttpd2dq %xmm0, %xmm1
cvtdq2pd %xmm1, %xmm1
leaq 0x18(%rsp), %r14
subsd %xmm1, %xmm0
mulsd 0x2ca3(%rip), %xmm0     # 0x7170
movq %rax, (%r14)
cvttsd2si %xmm0, %rax
movq %rax, 0x8(%r14)
movq %r14, %rdi
movq %r14, %rsi
callq 0x31d0
cmpl $-0x1, %eax
jne 0x44fc
callq 0x3060
cmpl $0x4, (%rax)
je 0x44d9
jmp 0x44fc
xorl %ebx, %ebx
jmp 0x44fc
pushq $-0x1
popq %rbx
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/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 0x4588
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
pushq $0x2
jmp 0x45a0
movq %r14, %rdi
callq 0x3180
movq %r15, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x3080
pushq $0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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:
xorl %eax, %eax
movzbl (%rdi), %ecx
testl %ecx, %ecx
je 0x45f8
movl %ecx, %edx
andb $-0x8, %dl
cmpb $0x30, %dl
jne 0x45f6
leal (%rcx,%rax,8), %eax
addl $-0x30, %eax
incq %rdi
jmp 0x45da
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
leaq 0x2a99(%rip), %rsi      # 0x70c1
callq 0x3460
testq %rax, %rax
je 0x46a0
movq %rax, %rbx
movq %rsp, %r14
movq 0x69b9(%rip), %rbp      # 0xaff8
leaq 0x2b55(%rip), %r15      # 0x719b
pushq $0x17
popq %r12
pushq $0x1
popq %r13
movq %r14, %rdi
movl $0x400, %esi            # imm = 0x400
movq %rbx, %rdx
callq 0x32a0
testq %rax, %rax
je 0x4684
movq %r14, %rdi
callq 0x46c1
cmpl $-0x1, %eax
jne 0x464e
movq (%rbp), %rcx
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x3500
jmp 0x464e
movq %rbx, %rdi
callq 0x3130
xorl %eax, %eax
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x6951(%rip), %rax      # 0xaff8
movq (%rax), %rcx
leaq 0x2ad2(%rip), %rdi      # 0x7183
pushq $0x17
popq %rsi
pushq $0x1
popq %rdx
callq 0x3500
pushq $-0x1
popq %rax
jmp 0x468e
// File: /workspace/github_c_makefile_star2_O2/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 0x29ca(%rip), %rsi      # 0x7294
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 0x401f
cmpq $-0x1, %rax
je 0x4908
xorl %eax, %eax
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x298d(%rip), %rdi      # 0x729c
callq 0x3470
pushq $0x1
popq %rdi
callq 0x34e0
// File: /workspace/github_c_makefile_star2_O2/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
pushq $0x1
popq %rsi
callq 0x6542
movl 0x4(%rbx), %ebp
movq %r14, %rdi
callq 0x3180
movl %ebp, %edi
movq %r14, %rsi
movl %eax, %edx
callq 0x65b0
movl 0x4(%rbx), %edi
pushq $0x4
popq %rdx
movq %r15, %rsi
callq 0x65b0
movl 0x4(%rbx), %edi
movq 0xc18(%rbx), %rsi
pushq $0x10
popq %rdx
callq 0x65b0
movl 0x4(%rbx), %edi
callq 0x6591
cmpl $0x1, %eax
jne 0x4a0a
movl 0x4(%rbx), %edi
callq 0x6667
jmp 0x4a0d
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x4a45
shrl $0xc, %eax
movl $0xaab, %ecx            # imm = 0xAAB
btl %eax, %ecx
jae 0x4a45
leaq 0x30c5(%rip), %rcx      # 0x7b05
movb (%rax,%rcx), %al
movb %al, (%rsi)
movl 0x18(%rdi), %eax
btl $0x8, %eax
jae 0x4a62
movb $0x72, 0x1(%rsi)
movl 0x18(%rdi), %eax
btl $0x8, %eax
jae 0x4a62
movb $0x77, 0x2(%rsi)
movl 0x18(%rdi), %eax
testb $0x40, %al
je 0x4a6d
movb $0x78, 0x3(%rsi)
movl 0x18(%rdi), %eax
testb $0x20, %al
je 0x4a83
movb $0x72, 0x4(%rsi)
movl 0x18(%rdi), %eax
testb $0x20, %al
je 0x4a83
movb $0x77, 0x5(%rsi)
movl 0x18(%rdi), %eax
testb $0x8, %al
je 0x4a8e
movb $0x78, 0x6(%rsi)
movl 0x18(%rdi), %eax
testb $0x4, %al
je 0x4aa4
movb $0x72, 0x7(%rsi)
movl 0x18(%rdi), %eax
testb $0x4, %al
je 0x4aa4
movb $0x77, 0x8(%rsi)
movl 0x18(%rdi), %eax
testb $0x1, %al
je 0x4aaf
movb $0x78, 0x9(%rsi)
movl 0x18(%rdi), %eax
btl $0xb, %eax
jae 0x4ac7
cmpb $0x78, 0x3(%rsi)
sete %al
shlb $0x5, %al
orb $0x53, %al
movb %al, 0x3(%rsi)
movl 0x18(%rdi), %eax
btl $0xa, %eax
jae 0x4adf
cmpb $0x78, 0x6(%rsi)
sete %al
shlb $0x5, %al
orb $0x53, %al
movb %al, 0x6(%rsi)
movl 0x18(%rdi), %eax
btl $0x9, %eax
jae 0x4af4
cmpb $0x78, 0x9(%rsi)
sete %al
shlb $0x5, %al
orb $0x54, %al
movb %al, 0x9(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x1e(%rip), %rsi        # 0x4ddb
pushq $0xe
popq %rdi
callq 0x32f0
leaq 0x6514(%rip), %rax      # 0xb2e0
movl (%rax), %edi
testl %edi, %edi
je 0x4dd7
callq 0x3250
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x6545(%rip), %rax      # 0xb328
movl 0x8(%rax), %edi
xorl %esi, %esi
callq 0x3150
movq 0x6534(%rip), %rdi      # 0xb328
leaq 0x24f3(%rip), %rdx      # 0x72ee
movl $0x1a5, %esi            # imm = 0x1A5
callq 0x489c
movq 0x651c(%rip), %rax      # 0xb328
movl 0x8(%rax), %edi
pushq $0x1
popq %rsi
callq 0x3150
xorl %edi, %edi
callq 0x34e0
// File: /workspace/github_c_makefile_star2_O2/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
andl $0x0, 0x64fa(%rip)      # 0xb320
leaq 0x1e(%rip), %rsi        # 0x4e4b
pushq $0xe
popq %rdi
callq 0x32f0
leaq 0x64a8(%rip), %rax      # 0xb2e4
movl (%rax), %edi
testl %edi, %edi
je 0x4e47
callq 0x3250
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x64a8(%rip), %r14      # 0xb328
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 0x40b7
testl %eax, %eax
je 0x4f81
cmpl $-0x1, %eax
je 0x4f88
movq 0x646c(%rip), %rdi      # 0xb328
addq $0x18, %rdi
callq 0x450c
movq 0x645c(%rip), %rdx      # 0xb328
leaq 0x18(%rdx), %rdi
movl $0x418, %ebx            # imm = 0x418
leaq (%rdx,%rbx), %rsi
movl $0x818, %r14d           # imm = 0x818
addq %r14, %rdx
pushq $0x20
popq %rcx
callq 0x4532
movq 0x6437(%rip), %rdi      # 0xb328
addq %rbx, %rdi
callq 0x45ad
movq 0x6428(%rip), %rdx      # 0xb328
leaq (%rdx,%rbx), %rsi
addq %r14, %rdx
leaq 0x23f4(%rip), %rdi      # 0x7302
xorl %eax, %eax
callq 0x31c0
movq 0x640c(%rip), %r14      # 0xb328
addq %r14, %rbx
leaq 0x23eb(%rip), %rdi      # 0x7311
movq %rbx, %rsi
callq 0x32e0
testl %eax, %eax
je 0x4f60
leaq 0x23d4(%rip), %rsi      # 0x730d
movq %rbx, %rdi
callq 0x32e0
testl %eax, %eax
je 0x4f60
leaq 0x23ca(%rip), %rdx      # 0x7316
movq %r14, %rdi
movl $0x1f4, %esi            # imm = 0x1F4
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x489c
movq %r14, %rdi
callq 0x434f
movq 0x63b9(%rip), %rax      # 0xb328
movl $0x1, 0xc40(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
xorl %edi, %edi
callq 0x34e0
leaq 0x2368(%rip), %rdi      # 0x72f7
callq 0x3470
pushq $0x1
popq %rdi
callq 0x34e0
// File: /workspace/github_c_makefile_star2_O2/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 0x6122(%rip), %rbx      # 0xb330
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 0x5248
leaq 0x222a(%rip), %rdx      # 0x7465
movq %r14, %rdi
movl $0x212, %esi            # imm = 0x212
callq 0x489c
leaq 0x818(%r14), %rdi
movq 0x8(%r15), %rsi
callq 0x3520
movq 0x8(%r15), %rsi
movq %rax, %rdi
callq 0x32e0
testl %eax, %eax
je 0x5281
leaq 0x21f6(%rip), %rdx      # 0x7465
movq %r14, %rdi
movl $0x212, %esi            # imm = 0x212
popq %rbx
popq %r14
popq %r15
jmp 0x489c
leaq 0x21ed(%rip), %rdi      # 0x7475
leaq 0x60a1(%rip), %rsi      # 0xb330
xorl %eax, %eax
callq 0x31c0
leaq 0x21f3(%rip), %rdx      # 0x7490
movq %r14, %rdi
movl $0xe6, %esi
callq 0x489c
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_O2/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 0x434f
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 0x2152(%rip), %rsi      # 0x74ea
movq %rsp, %r14
movq %r14, %rdx
xorl %eax, %eax
pushq %r11
pushq %r10
callq 0x33b0
popq %rcx
popq %rdx
leaq 0x18(%rsp), %r15
andl $0x0, 0x8(%r15)
andq $0x0, (%r15)
movl (%r14), %edx
movl 0x4(%r14), %ecx
movl 0x8(%r14), %r8d
movl 0xc(%r14), %r9d
leaq 0x212d(%rip), %rsi      # 0x74fc
movq %r15, %rdi
xorl %eax, %eax
callq 0x34d0
movl 0x10(%r14), %ebp
shll $0x8, %ebp
addl 0x14(%r14), %ebp
pushq $0x10
popq %rdi
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 0x20ef(%rip), %rdx      # 0x7508
movq %rbx, %rdi
movl $0xc8, %esi
callq 0x489c
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x434f
leaq 0x5ebd(%rip), %rax      # 0xb308
movq (%rax), %rdi
xorl %esi, %esi
callq 0x39c5
movl %eax, 0xc20(%rbx)
leaq 0x1c(%rsp), %rdx
movl $0x10, (%rdx)
leaq 0x20(%rsp), %rsi
movl %eax, %edi
callq 0x34b0
cmpl $-0x1, %eax
je 0x5508
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 0x208e(%rip), %rsi      # 0x7534
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 0x2069(%rip), %rsi      # 0x7540
leaq 0x30(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
pushq %r11
pushq %r10
callq 0x34d0
popq %rcx
popq %rdx
movq %rbx, %rdi
movl $0xe3, %esi
movq %r14, %rdx
callq 0x489c
addq $0x430, %rsp            # imm = 0x430
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x2013(%rip), %rdi      # 0x7522
callq 0x3470
pushq $0x1
popq %rdi
callq 0x34e0
// File: /workspace/github_c_makefile_star2_O2/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 0x5542
cmpb $0x0, 0x819(%rdi)
jne 0x5554
leaq 0x2033(%rip), %rdx      # 0x756b
movl $0x1f8, %esi            # imm = 0x1F8
jmp 0x489c
subl $0x49, %eax
jne 0x554e
movzbl 0x819(%rdi), %eax
negl %eax
testl %eax, %eax
je 0x5565
leaq 0x2041(%rip), %rdx      # 0x759c
movl $0x1f4, %esi            # imm = 0x1F4
jmp 0x489c
andl $0x0, 0x10(%rdi)
leaq 0x2012(%rip), %rdx      # 0x7582
movl $0xc8, %esi
jmp 0x489c
// File: /workspace/github_c_makefile_star2_O2/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 0x514d
cmpl $-0x1, %eax
je 0x59e7
movl %eax, %ebp
movq %rsp, %r14
movl $0x400, %esi            # imm = 0x400
movq %r14, %rdi
callq 0x3240
leaq 0x1cfc(%rip), %rdx      # 0x769d
movq %rbx, %rdi
movl $0x96, %esi
callq 0x489c
movl %ebp, %edi
movq %r14, %rsi
callq 0x4af5
movl %ebp, %edi
callq 0x3260
leaq 0x1cfa(%rip), %rdx      # 0x76c0
movq %rbx, %rdi
movl $0xe2, %esi
callq 0x489c
movq %rbx, %rdi
callq 0x434f
addq $0x400, %rsp            # imm = 0x400
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x1bc9(%rip), %rdx      # 0x75b7
movq %rbx, %rdi
movl $0x1a9, %esi            # imm = 0x1A9
addq $0x400, %rsp            # imm = 0x400
popq %rbx
popq %r14
popq %rbp
jmp 0x489c
// File: /workspace/github_c_makefile_star2_O2/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 0x5b3a
movq %rsp, %r15
movl $0x400, %edx            # imm = 0x400
movq %r15, %rdi
xorl %esi, %esi
callq 0x3220
leaq 0x1c25(%rip), %rsi      # 0x7735
movq %r15, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x34d0
movq %rbx, %rdi
movl $0x101, %esi            # imm = 0x101
movq %r15, %rdx
callq 0x489c
addq $0x400, %rsp            # imm = 0x400
popq %rbx
popq %r14
popq %r15
retq
leaq 0x1bd2(%rip), %rdx      # 0x7713
movq %rbx, %rdi
movl $0x226, %esi            # imm = 0x226
addq $0x400, %rsp            # imm = 0x400
popq %rbx
popq %r14
popq %r15
jmp 0x489c
// File: /workspace/github_c_makefile_star2_O2/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 0x5bf2
callq 0x3040
leaq 0x818(%rbx), %rdi
callq 0x3180
addq $0x2, %rax
jmp 0x5bfe
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 0x1b9c(%rip), %rdx      # 0x77bf
movq %rbx, %rdi
movl $0x15e, %esi            # imm = 0x15E
popq %rbx
jmp 0x489c
// File: /workspace/github_c_makefile_star2_O2/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 0x5c69
leaq 0x818(%rbx), %r14
movq %r14, %rsi
callq 0x3480
cmpl $-0x1, %eax
je 0x5c84
leaq 0x1bac(%rip), %rdx      # 0x780b
movq %rbx, %rdi
movl $0xfa, %esi
jmp 0x5cab
leaq 0x1b5f(%rip), %rdx      # 0x77cf
movq %rbx, %rdi
movl $0x1f7, %esi            # imm = 0x1F7
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x489c
movq 0xc28(%rbx), %rsi
leaq 0x1b52(%rip), %rdi      # 0x77e4
movq %r14, %rdx
xorl %eax, %eax
callq 0x31c0
leaq 0x1b59(%rip), %rdx      # 0x77fc
movq %rbx, %rdi
movl $0x226, %esi            # imm = 0x226
callq 0x489c
movq 0xc28(%rbx), %rdi
callq 0x3040
andq $0x0, 0xc28(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x1949(%rip), %rdx      # 0x78d8
movl $0xd3, %esi
callq 0x491c
movl 0x8(%rbx), %edi
leaq 0x193e(%rip), %rsi      # 0x78e1
pushq $0x7
popq %r14
movq %r14, %rdx
callq 0x401f
movl 0x8(%rbx), %edi
leaq 0x1930(%rip), %rsi      # 0x78e9
movq %r14, %rdx
callq 0x401f
movl 0x8(%rbx), %edi
leaq 0x1926(%rip), %rsi      # 0x78f1
movq %r14, %rdx
callq 0x401f
movl 0x8(%rbx), %edi
leaq 0x191c(%rip), %rsi      # 0x78f9
movq %r14, %rdx
callq 0x401f
movl 0x8(%rbx), %edi
leaq 0x1912(%rip), %rsi      # 0x7901
pushq $0xe
popq %rdx
callq 0x401f
movl 0x8(%rbx), %edi
leaq 0x190f(%rip), %rsi      # 0x7910
movq %r14, %rdx
callq 0x401f
movl 0x8(%rbx), %edi
leaq 0x1905(%rip), %rsi      # 0x7918
movq %r14, %rdx
callq 0x401f
movl 0x8(%rbx), %edi
leaq 0x18fb(%rip), %rsi      # 0x7920
movq %r14, %rdx
callq 0x401f
leaq 0x18f4(%rip), %rdx      # 0x7928
movq %rbx, %rdi
movl $0xd3, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x489c
// File: /workspace/github_c_makefile_star2_O2/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 0x60db
movl $0xf000, %eax           # imm = 0xF000
andl 0x18(%rsp), %eax
cmpl $0x8000, %eax           # imm = 0x8000
jne 0x60db
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 0x1222(%rip), %rsi      # 0x72d8
movq %r14, %rdi
xorl %eax, %eax
callq 0x34d0
movq %rbx, %rdi
movl $0xd5, %esi
movq %r14, %rdx
callq 0x489c
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r14
retq
leaq 0x184a(%rip), %rdx      # 0x792c
movq %rbx, %rdi
movl $0x226, %esi            # imm = 0x226
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r14
jmp 0x489c
// File: /workspace/github_c_makefile_star2_O2/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 0x1837(%rip), %rdx      # 0x7945
movl $0xd3, %esi
callq 0x491c
movq %rsp, %r14
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
xorl %esi, %esi
callq 0x3220
movl 0xc44(%rbx), %edi
callq 0x3120
leaq 0x181c(%rip), %rsi      # 0x7958
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 0x401f
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
xorl %esi, %esi
callq 0x3220
leaq 0x17f4(%rip), %rsi      # 0x796b
leaq 0x51b2(%rip), %rdx      # 0xb330
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 0x401f
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
xorl %esi, %esi
callq 0x3220
cmpl $0x0, 0x10(%rbx)
je 0x61c2
movups 0x17c2(%rip), %xmm0     # 0x797e
movaps %xmm0, (%rsp)
jmp 0x61d2
movups 0x17c5(%rip), %xmm0     # 0x798e
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 0x401f
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
xorl %esi, %esi
callq 0x3220
leaq 0x510d(%rip), %rax      # 0xb310
movl (%rax), %edx
testl %edx, %edx
je 0x621c
leaq 0x17a5(%rip), %rsi      # 0x79b5
movq %rsp, %rdi
xorl %eax, %eax
callq 0x34d0
jmp 0x6236
movups 0x177c(%rip), %xmm0     # 0x799f
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 0x401f
leaq 0x1781(%rip), %rdx      # 0x79d9
movq %rbx, %rdi
movl $0xd3, %esi
callq 0x489c
addq $0x400, %rsp            # imm = 0x400
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x175f(%rip), %rdx      # 0x79ef
movl $0xd6, %esi
callq 0x491c
movl 0x8(%rbx), %edi
leaq 0x1772(%rip), %rsi      # 0x7a16
pushq $0x47
popq %rdx
callq 0x401f
movl 0x8(%rbx), %edi
leaq 0x17a8(%rip), %rsi      # 0x7a5e
pushq $0x48
popq %r14
movq %r14, %rdx
callq 0x401f
movl 0x8(%rbx), %edi
leaq 0x17db(%rip), %rsi      # 0x7aa7
movq %r14, %rdx
callq 0x401f
movl 0x8(%rbx), %edi
leaq 0x1812(%rip), %rsi      # 0x7af0
pushq $0xc
popq %rdx
callq 0x401f
leaq 0x1810(%rip), %rdx      # 0x7afd
movq %rbx, %rdi
movl $0xd6, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x489c
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/icysunlight[P]miniftpd/ftpnobody.c
// Function: handle_pri
int handle_pri(session_t* ssinf)
{

    set_minprivilage();
    int cmd;
    while (1)
    {
        cmd = ftpipc_recv_cmd(ssinf->nobodyfd);
        if ( 0 == cmd)
            exit(EXIT_SUCCESS);
        if ( -1 == cmd )
            exit(EXIT_FAILURE);
        switch (cmd)
        {
        case FTPIPC_GET_DATA_FD:
            do_getdatafd(ssinf);
            break;
        }
    }
    return 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x634d
movl (%rbx), %edi
callq 0x6558
cmpl $0x1, %eax
je 0x6334
cmpl $-0x1, %eax
je 0x633e
testl %eax, %eax
jne 0x631d
jmp 0x6346
movq %rbx, %rdi
callq 0x63e1
jmp 0x631d
pushq $0x1
popq %rdi
callq 0x34e0
xorl %edi, %edi
callq 0x34e0
// File: /workspace/github_c_makefile_star2_O2/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 0x17ce(%rip), %rdi      # 0x7b27
callq 0x3300
testq %rax, %rax
je 0x63b2
movq %rax, %rbx
movl 0x14(%rax), %edi
callq 0x3530
cmpl $-0x1, %eax
je 0x63bb
movl 0x10(%rbx), %edi
callq 0x3560
cmpl $-0x1, %eax
je 0x63c4
leaq 0xc(%rsp), %rdi
movq $0x19980330, (%rdi)     # imm = 0x19980330
movabsq $0x40000000400, %rax    # imm = 0x40000000400
leaq 0x14(%rsp), %rsi
movq %rax, (%rsi)
andl $0x0, 0x8(%rsi)
callq 0x6304
cmpl $-0x1, %eax
je 0x63cd
addq $0x20, %rsp
popq %rbx
retq
leaq 0x1775(%rip), %rdi      # 0x7b2e
jmp 0x63d4
leaq 0x177b(%rip), %rdi      # 0x7b3d
jmp 0x63d4
leaq 0x1780(%rip), %rdi      # 0x7b4b
jmp 0x63d4
leaq 0x1785(%rip), %rdi      # 0x7b59
callq 0x3470
pushq $0x1
popq %rdi
callq 0x34e0
// File: /workspace/github_c_makefile_star2_O2/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 0x6601
cmpl $-0x1, %eax
je 0x64a1
movl (%rbx), %edi
leaq 0xc(%rsp), %rsi
pushq $0x4
popq %rdx
callq 0x6601
cmpl $-0x1, %eax
je 0x64a1
movl (%rbx), %edi
leaq 0x10(%rsp), %rsi
pushq $0x10
popq %rdx
callq 0x6601
cmpl $-0x1, %eax
je 0x64a1
movzwl 0xc(%rsp), %esi
leaq 0x20(%rsp), %rdi
callq 0x3aa2
movl %eax, %ebp
leaq 0x4eab(%rip), %rax      # 0xb310
movl (%rax), %edx
leaq 0x10(%rsp), %rsi
movl %ebp, %edi
callq 0x3e96
cmpl $-0x1, %eax
je 0x64ab
cmpl $-0x1, %ebp
jne 0x6487
movl (%rbx), %edi
pushq $0x2
popq %rsi
callq 0x657c
movl (%rbx), %edi
pushq $0x1
popq %rsi
callq 0x657c
movl (%rbx), %edi
movl %ebp, %esi
callq 0x665d
movl %ebp, %edi
callq 0x3260
addq $0xa8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x165f(%rip), %rdi      # 0x7b11
callq 0x3470
pushq $0x1
popq %rdi
callq 0x34e0
nop
// File: /workspace/github_c_makefile_star2_O2/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
pushq $0x1
popq %rdi
leaq 0x8(%rsp), %rcx
movl %edi, %esi
xorl %edx, %edx
callq 0x3360
cmpl $-0x1, %eax
je 0x64f5
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
leaq 0x166a(%rip), %rdi      # 0x7b66
callq 0x3470
pushq $0x1
popq %rdi
callq 0x34e0
// File: /workspace/github_c_makefile_star2_O2/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 0x651a
callq 0x3260
movl (%rbx), %edi
cmpl $-0x1, %edi
je 0x6527
popq %rbx
jmp 0x3260
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/icysunlight[P]miniftpd/ftpipc.c
// Function: ftpipc_recv_data
int ftpipc_recv_data(int fd,void* str,int maxsize)
{
    int bufsize = ftpipc_recv_int(fd);
    if ( bufsize > maxsize )
        return -1;

    if ( bufsize != readn(fd,str,bufsize) )
        return -1;

    return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %r14d
movq %rsi, %rbx
movl %edi, %ebp
callq 0x663e
cmpl %r14d, %eax
jle 0x661c
pushq $-0x1
popq %rax
jmp 0x6639
movslq %eax, %r14
movl %ebp, %edi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x3fc7
movq %rax, %rcx
xorl %eax, %eax
cmpq %r14, %rcx
setne %al
negl %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/icysunlight[P]miniftpd/hash.c
// Function: hash_test
void hash_test()
{
    stu_t stu[3] = {
        {"aaa","12345"},
        {"bbb","dadad"},
        {"ccc","xxxxx"},
    };

    hashtable_t* hash = hashtable_init(5,hash_fun);
    int i = 0;
    for ( i = 0 ; i < 3 ; ++i)
    {
        hashtable_add(hash,stu[i].name,strlen(stu[i].name),stu[i].school,strlen(stu[i].name));
    }

    hashtable_del(hash,"aaa",strlen("aaa"));
    hashtable_add(hash,stu[0].name,strlen(stu[0].name),stu[0].school,strlen(stu[0].name));


    char *str = hashtable_search(hash,"aaa",3);
    if  ( NULL == str )
        printf("not fount\n");
    else
        printf("name:\"aaa\",school:%s\n",str);


    hashtable_destroy(&hash);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x12e(%rip), %rsi       # 0x67ac
pushq $0x5
popq %rdi
callq 0x673e
movq %rax, %rbx
movq %rax, (%rsp)
pushq $0x8
popq %r12
leaq 0x4718(%rip), %r13      # 0xadb0
cmpq $0x38, %r12
je 0x66c8
movq -0x8(%r12,%r13), %r14
movq (%r12,%r13), %r15
movq %r14, %rdi
callq 0x3180
movq %rbx, %rdi
movq %r14, %rsi
movl %eax, %edx
movq %r15, %rcx
movl %eax, %r8d
callq 0x67ce
addq $0x10, %r12
jmp 0x6698
leaq 0x14a8(%rip), %r14      # 0x7b77
pushq $0x3
popq %rbp
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x68a2
leaq 0x1495(%rip), %rcx      # 0x7b7b
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
movl %ebp, %r8d
callq 0x67ce
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x6903
testq %rax, %rax
je 0x671b
leaq 0x1486(%rip), %rdi      # 0x7b95
movq %rax, %rsi
xorl %eax, %eax
callq 0x31c0
jmp 0x6727
leaq 0x14b5(%rip), %rdi      # 0x7bd7
callq 0x30c0
movq %rsp, %rdi
callq 0x6918
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/icysunlight[P]miniftpd/hash.c
// Function: hashtable_init
hashtable_t* hashtable_init(int buckets,hash_fun_t hash_fun)
{
    hashtable_t* hash = (hashtable_t*)malloc(sizeof(hashtable_t));

    int size = buckets * sizeof(node_t*);
    hash->pnode = (node_t**)malloc(size);
    hash->buckets = buckets;
    hash->hash_fun = hash_fun;
    memset(hash->pnode,0,size);

    int i = 0;
    while ( i < buckets )
    {
        (hash->pnode[i]) = (node_t*)malloc(sizeof(node_t));
        (hash->pnode[i])->pnext = NULL;
        i++;
    } 

    return hash;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %r12
movl %edi, %ebx
pushq $0x18
popq %rdi
callq 0x33a0
movq %rax, %r14
leal (,%rbx,8), %eax
movslq %eax, %rsi
pushq $0x1
popq %rdi
callq 0x32c0
movq %rax, %r15
movq %rax, 0x10(%r14)
movl %ebx, (%r14)
movq %r12, 0x8(%r14)
xorl %r13d, %r13d
testl %ebx, %ebx
cmovlel %r13d, %ebx
pushq $0x20
popq %r12
cmpq %r13, %rbx
je 0x679f
movq %r12, %rdi
callq 0x33a0
movq %rax, (%r15,%r13,8)
andq $0x0, 0x10(%rax)
incq %r13
jmp 0x6784
movq %r14, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/icysunlight[P]miniftpd/hash.c
// Function: hash_fun
unsigned int static hash_fun(void* key,int hash_size)
{
    unsigned int hash = 0;
    char* str = key;

    while ( *str ) 
    {
        hash = (*str++) + (hash << 6) + (hash << 16) -hash;
    }

    return (hash & 0x7FFFFFFF) % hash_size;
        
}

// Assembly:
xorl %eax, %eax
movsbl (%rdi), %ecx
testl %ecx, %ecx
je 0x67c2
incq %rdi
imull $0x1003f, %eax, %eax    # imm = 0x1003F
addl %ecx, %eax
jmp 0x67ae
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
xorl %edx, %edx
divl %esi
movl %edx, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/icysunlight[P]miniftpd/hash.c
// Function: hashtable_add
int hashtable_add(hashtable_t* hash,void* key,int key_size,void* val,int val_size)
{
     if  ( NULL != hashtable_get_node(hash,key,key_size)) 
     {
         fprintf(stderr,"key exists.");
         return -1;
     }

     node_t* node = hashtable_getbucket(hash,key);
     node_t* toadd = (node_t*)malloc(sizeof(node_t));
     toadd->key = (void*)malloc(key_size);
     toadd->val = (void*)malloc(val_size);
     toadd->pnext = NULL;
     memcpy(toadd->key,key,key_size);
     memcpy(toadd->val,val,val_size);

     toadd->pnext = node->pnext;
     toadd->pprev = node;
     node->pnext = toadd;
     if ( toadd->pnext )
         toadd->pnext->pprev = toadd;
     
     return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r8d, %ebp
movq %rcx, %rbx
movl %edx, %r13d
movq %rsi, %r14
movq %rdi, %r15
callq 0x69d1
testq %rax, %rax
jne 0x6881
movq %r15, %rdi
movq %r14, %rsi
callq 0x6992
movq %rax, %r15
pushq $0x20
popq %rdi
callq 0x33a0
movq %rax, %r12
movslq %r13d, %r13
movq %r13, %rdi
callq 0x33a0
movq %rbx, (%rsp)
movq %rax, %rbx
movq %rax, (%r12)
movslq %ebp, %rbp
movq %rbp, %rdi
callq 0x33a0
movq %r14, %rsi
movq %rax, %r14
movq %rax, 0x8(%r12)
movq %rbx, %rdi
movq %r13, %rdx
callq 0x3350
movq %r14, %rdi
movq (%rsp), %rsi
movq %rbp, %rdx
callq 0x3350
movq 0x10(%r15), %rcx
movq %rcx, 0x10(%r12)
movq %r15, 0x18(%r12)
movq %r12, 0x10(%r15)
xorl %eax, %eax
testq %rcx, %rcx
je 0x6872
movq %r12, 0x18(%rcx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x4770(%rip), %rax      # 0xaff8
movq (%rax), %rcx
leaq 0x1329(%rip), %rdi      # 0x7bbb
pushq $0xb
popq %rsi
pushq $0x1
popq %rdx
callq 0x3500
pushq $-0x1
popq %rax
jmp 0x6872