LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/niuyuling[P]CProxy/main.c
// Function: create_server_socket
int create_server_socket(int port)
{
    int server_sock;
    int optval = 1;
    struct sockaddr_in server_addr;
    if ((server_sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
        perror("socket");
        return -1;
    }
    if (setsockopt(server_sock, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval)) < 0) {
        perror("setsockopt");
        return -1;
    }
    memset(&server_addr, 0, sizeof(server_addr));
    server_addr.sin_family = AF_INET;
    server_addr.sin_port = htons(port);
    server_addr.sin_addr.s_addr = INADDR_ANY;
    if (bind(server_sock, (struct sockaddr *)&server_addr, sizeof(server_addr)) != 0) {
        perror("bind");
        return -1;
    }
    if (listen(server_sock, 500) < 0) {
        perror("listen");
        return -1;
    }
    return server_sock;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x8(%rbp)
movl $0x1, -0x10(%rbp)
movl $0x2, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x2580
movl %eax, -0xc(%rbp)
cmpl $0x0, %eax
jge 0x26e3
leaq 0x9a99(%rip), %rdi      # 0xc16b
callq 0x2480
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x27a0
movl -0xc(%rbp), %edi
movl $0x1, %esi
movl $0x2, %edx
leaq -0x10(%rbp), %rcx
movl $0x4, %r8d
callq 0x20a0
cmpl $0x0, %eax
jge 0x271c
leaq 0x9a1c(%rip), %rdi      # 0xc127
callq 0x2480
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x27a0
leaq -0x20(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x21c0
movw $0x2, -0x20(%rbp)
movl -0x8(%rbp), %eax
movzwl %ax, %edi
callq 0x2160
movw %ax, -0x1e(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0xc(%rbp), %edi
leaq -0x20(%rbp), %rsi
movl $0x10, %edx
callq 0x2430
cmpl $0x0, %eax
je 0x2773
leaq 0x9a11(%rip), %rdi      # 0xc176
callq 0x2480
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x27a0
movl -0xc(%rbp), %edi
movl $0x1f4, %esi            # imm = 0x1F4
callq 0x2380
cmpl $0x0, %eax
jge 0x279a
leaq 0x9e44(%rip), %rdi      # 0xc5d0
callq 0x2480
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x27a0
movl -0xc(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/niuyuling[P]CProxy/main.c
// Function: create_server_socket6
int create_server_socket6(int port)
{
    int server_sock;
    int optval = SO_REUSEADDR;
    struct sockaddr_in6 server_addr;
    if ((server_sock = socket(AF_INET6, SOCK_STREAM, 0)) < 0) {
        perror("socket");
        return -1;
    }

    if (setsockopt(server_sock, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval)) < 0) {
        perror("setsockopt");
        return -1;
    }

    if (setsockopt(server_sock, IPPROTO_IPV6, IPV6_V6ONLY, &optval, sizeof(optval)) < 0) {
        perror("setsockopt");
        return -1;
    }

    memset(&server_addr, 0, sizeof(server_addr));
    server_addr.sin6_family = AF_INET6;
    server_addr.sin6_port = htons(port);
    server_addr.sin6_addr = in6addr_any;

    if (bind(server_sock, (struct sockaddr *)&server_addr, sizeof(struct sockaddr_in6)) != 0) {
        perror("bind");
        return -1;
    }

    if (listen(server_sock, 500) < 0) {
        perror("listen");
        return -1;
    }

    return server_sock;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x8(%rbp)
movl $0x2, -0x10(%rbp)
movl $0xa, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x2580
movl %eax, -0xc(%rbp)
cmpl $0x0, %eax
jge 0x27f3
leaq 0x9989(%rip), %rdi      # 0xc16b
callq 0x2480
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x28f8
movl -0xc(%rbp), %edi
movl $0x1, %esi
movl $0x2, %edx
leaq -0x10(%rbp), %rcx
movl $0x4, %r8d
callq 0x20a0
cmpl $0x0, %eax
jge 0x282c
leaq 0x990c(%rip), %rdi      # 0xc127
callq 0x2480
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x28f8
movl -0xc(%rbp), %edi
movl $0x29, %esi
movl $0x1a, %edx
leaq -0x10(%rbp), %rcx
movl $0x4, %r8d
callq 0x20a0
cmpl $0x0, %eax
jge 0x2865
leaq 0x98d3(%rip), %rdi      # 0xc127
callq 0x2480
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x28f8
leaq -0x2c(%rbp), %rdi
xorl %esi, %esi
movl $0x1c, %edx
callq 0x21c0
movw $0xa, -0x2c(%rbp)
movl -0x8(%rbp), %eax
movzwl %ax, %edi
callq 0x2160
movw %ax, -0x2a(%rbp)
movq 0xc72f(%rip), %rax      # 0xefc0
movq (%rax), %rcx
movq %rcx, -0x24(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x1c(%rbp)
movl -0xc(%rbp), %edi
leaq -0x2c(%rbp), %rsi
movl $0x1c, %edx
callq 0x2430
cmpl $0x0, %eax
je 0x28cb
leaq 0x98b9(%rip), %rdi      # 0xc176
callq 0x2480
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x28f8
movl -0xc(%rbp), %edi
movl $0x1f4, %esi            # imm = 0x1F4
callq 0x2380
cmpl $0x0, %eax
jge 0x28f2
leaq 0x9cec(%rip), %rdi      # 0xc5d0
callq 0x2480
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x28f8
movl -0xc(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/niuyuling[P]CProxy/main.c
// Function: accept_client
void accept_client()
{
    struct epoll_event epollEvent;
    struct sockaddr_in addr;
    conn_t *client;
    socklen_t addr_len = sizeof(addr);

    // 偶数为客户端,奇数为服务端
    for (client = cts; client - cts < MAX_CONNECTION; client += 2)
        if (client->fd < 0)
            break;
    if (client - cts >= MAX_CONNECTION)
        return;
    client->timer = (client + 1)->timer = 0;
    client->fd = accept(server_sock, (struct sockaddr *)&addr, &addr_len);
    if (client->fd < 0)
        return;
    fcntl(client->fd, F_SETFL, O_NONBLOCK);
    epollEvent.events = EPOLLIN | EPOLLET;
    epollEvent.data.ptr = client;
    epoll_ctl(epollfd, EPOLL_CTL_ADD, client->fd, &epollEvent);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl $0x10, -0x2c(%rbp)
leaq 0xcb4a(%rip), %rax      # 0xf470
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
leaq 0xcb3b(%rip), %rcx      # 0xf470
subq %rcx, %rax
movl $0x28, %ecx
cqto
idivq %rcx
cmpq $0x3fc, %rax            # imm = 0x3FC
jge 0x2966
movq -0x28(%rbp), %rax
cmpl $0x0, 0x10(%rax)
jge 0x2956
jmp 0x2966
jmp 0x2958
movq -0x28(%rbp), %rax
addq $0x50, %rax
movq %rax, -0x28(%rbp)
jmp 0x292a
movq -0x28(%rbp), %rax
leaq 0xcaff(%rip), %rcx      # 0xf470
subq %rcx, %rax
movl $0x28, %ecx
cqto
idivq %rcx
cmpq $0x3fc, %rax            # imm = 0x3FC
jl 0x298b
jmp 0x2a0b
movq -0x28(%rbp), %rax
movl $0x0, 0x48(%rax)
movq -0x28(%rbp), %rax
movl $0x0, 0x20(%rax)
movl 0x16a29(%rip), %edi     # 0x193d0
leaq -0x1c(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x2490
movl %eax, %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x28(%rbp), %rax
cmpl $0x0, 0x10(%rax)
jge 0x29c9
jmp 0x2a0b
movq -0x28(%rbp), %rax
movl 0x10(%rax), %edi
movl $0x4, %esi
movl $0x800, %edx            # imm = 0x800
movb $0x0, %al
callq 0x20c0
movl $0x80000001, -0xc(%rbp) # imm = 0x80000001
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movl 0x169de(%rip), %edi     # 0x193d4
movq -0x28(%rbp), %rax
movl 0x10(%rax), %edx
movl $0x1, %esi
leaq -0xc(%rbp), %rcx
callq 0x2240
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/niuyuling[P]CProxy/main.c
// Function: accept_client6
void accept_client6()
{
    struct epoll_event epollEvent;
    struct sockaddr_in6 addr;
    conn_t *client;
    socklen_t addr_len = sizeof(addr);

    // 偶数为客户端,奇数为服务端
    for (client = cts; client - cts < MAX_CONNECTION; client += 2)
        if (client->fd < 0)
            break;
    if (client - cts >= MAX_CONNECTION)
        return;
    client->timer = (client + 1)->timer = 0;
    client->fd = accept(server_sock6, (struct sockaddr *)&addr, &addr_len);
    if (client->fd < 0)
        return;
    fcntl(client->fd, F_SETFL, O_NONBLOCK);
    epollEvent.events = EPOLLIN | EPOLLET;
    epollEvent.data.ptr = client;
    epoll_ctl(epollfd, EPOLL_CTL_ADD, client->fd, &epollEvent);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl $0x1c, -0x34(%rbp)
leaq 0xca3a(%rip), %rax      # 0xf470
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
leaq 0xca2b(%rip), %rcx      # 0xf470
subq %rcx, %rax
movl $0x28, %ecx
cqto
idivq %rcx
cmpq $0x3fc, %rax            # imm = 0x3FC
jge 0x2a76
movq -0x30(%rbp), %rax
cmpl $0x0, 0x10(%rax)
jge 0x2a66
jmp 0x2a76
jmp 0x2a68
movq -0x30(%rbp), %rax
addq $0x50, %rax
movq %rax, -0x30(%rbp)
jmp 0x2a3a
movq -0x30(%rbp), %rax
leaq 0xc9ef(%rip), %rcx      # 0xf470
subq %rcx, %rax
movl $0x28, %ecx
cqto
idivq %rcx
cmpq $0x3fc, %rax            # imm = 0x3FC
jl 0x2a9b
jmp 0x2b1b
movq -0x30(%rbp), %rax
movl $0x0, 0x48(%rax)
movq -0x30(%rbp), %rax
movl $0x0, 0x20(%rax)
movl 0x16921(%rip), %edi     # 0x193d8
leaq -0x28(%rbp), %rsi
leaq -0x34(%rbp), %rdx
callq 0x2490
movl %eax, %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x30(%rbp), %rax
cmpl $0x0, 0x10(%rax)
jge 0x2ad9
jmp 0x2b1b
movq -0x30(%rbp), %rax
movl 0x10(%rax), %edi
movl $0x4, %esi
movl $0x800, %edx            # imm = 0x800
movb $0x0, %al
callq 0x20c0
movl $0x80000001, -0xc(%rbp) # imm = 0x80000001
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
movl 0x168ce(%rip), %edi     # 0x193d4
movq -0x30(%rbp), %rax
movl 0x10(%rax), %edx
movl $0x1, %esi
leaq -0xc(%rbp), %rcx
callq 0x2240
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/niuyuling[P]CProxy/main.c
// Function: get_executable_path
int get_executable_path(char *processdir, char *processname, int len)
{
    char *filename;
    if (readlink("/proc/self/exe", processdir, len) <= 0)
        return -1;
    filename = strrchr(processdir, '/');
    if (filename == NULL)
        return -1;
    ++filename;
    strcpy(processname, filename);
    *filename = '\0';
    return (int)(filename - processdir);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq -0x10(%rbp), %rsi
movslq -0x1c(%rbp), %rdx
leaq 0x91ff(%rip), %rdi      # 0xc151
callq 0x20b0
cmpq $0x0, %rax
jg 0x2f66
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2fb6
movq -0x10(%rbp), %rdi
movl $0x2f, %esi
callq 0x21a0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x2f88
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2fb6
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x2080
movq -0x28(%rbp), %rax
movb $0x0, (%rax)
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/niuyuling[P]CProxy/main.c
// Function: server_ini
void server_ini()
{
    signal(SIGPIPE, SIG_IGN);   // 忽略PIPE信号

    if (daemon(1, 1)) {
        perror("daemon");
        return;
    }

    while (process-- > 1 && fork() == 0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0xd, %edi
movl $0x1, %esi
callq 0x22c0
movl $0x1, %esi
movl %esi, %edi
callq 0x23b0
cmpl $0x0, %eax
je 0x2ff6
leaq 0x9171(%rip), %rdi      # 0xc160
callq 0x2480
jmp 0x302c
jmp 0x2ff8
movl 0x193ce(%rip), %ecx     # 0x1c3cc
movl %ecx, %eax
addl $-0x1, %eax
movl %eax, 0x193c3(%rip)     # 0x1c3cc
xorl %eax, %eax
cmpl $0x1, %ecx
movb %al, -0x1(%rbp)
jle 0x3021
callq 0x2560
cmpl $0x0, %eax
sete %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
testb $0x1, %al
jne 0x302a
jmp 0x302c
jmp 0x2ff8
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/niuyuling[P]CProxy/main.c
// Function: udp_listen
int udp_listen(char *ip, int port)
{
    struct sockaddr_in addr;
    int fd, opt = 1;

    if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
        perror("udp socket");
        exit(1);
    }
    setsockopt(fd, SOL_IP, IP_TRANSPARENT, &opt, sizeof(opt));
    setsockopt(fd, SOL_IP, IP_RECVORIGDSTADDR, &opt, sizeof(opt));
    memset(&addr, 0, sizeof(addr));
    addr.sin_addr.s_addr = inet_addr(ip);
    addr.sin_port = htons(port);
    addr.sin_family = AF_INET;
    if (bind(fd, (struct sockaddr *)&addr, sizeof(addr)) != 0) {
        perror("udp bind");
        exit(1);
    }

    return fd;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl $0x1, -0x24(%rbp)
movl $0x2, %esi
xorl %edx, %edx
movl %esi, %edi
callq 0x2580
movl %eax, -0x20(%rbp)
cmpl $0x0, %eax
jge 0x3082
leaq 0x90f4(%rip), %rdi      # 0xc167
callq 0x2480
movl $0x1, %edi
callq 0x24e0
movl -0x20(%rbp), %edi
xorl %esi, %esi
movl $0x13, %edx
leaq -0x24(%rbp), %rcx
movl $0x4, %r8d
callq 0x20a0
movl -0x20(%rbp), %edi
xorl %esi, %esi
movl $0x14, %edx
leaq -0x24(%rbp), %rcx
movl $0x4, %r8d
callq 0x20a0
leaq -0x1c(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x21c0
movq -0x8(%rbp), %rdi
callq 0x22a0
movl %eax, -0x18(%rbp)
movl -0xc(%rbp), %eax
movzwl %ax, %edi
callq 0x2160
movw %ax, -0x1a(%rbp)
movw $0x2, -0x1c(%rbp)
movl -0x20(%rbp), %edi
leaq -0x1c(%rbp), %rsi
movl $0x10, %edx
callq 0x2430
cmpl $0x0, %eax
je 0x3111
leaq 0x9070(%rip), %rdi      # 0xc172
callq 0x2480
movl $0x1, %edi
callq 0x24e0
movl -0x20(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/niuyuling[P]CProxy/main.c
// Function: timeout_check
void *timeout_check(void *nullPtr)
{
    while (1) {
        sleep(60);
        if (server_sock >= 0 || server_sock6 >= 0)
            tcp_timeout_check(NULL);
        if (global.dns_listen_fd >= 0)
            dns_timeout_check();
        if (global.udp_listen_fd >= 0)
            udp_timeout_check();
    }

    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movl $0x3c, %edi
callq 0x2530
cmpl $0x0, 0x16293(%rip)     # 0x193d0
jge 0x3148
cmpl $0x0, 0x16292(%rip)     # 0x193d8
jl 0x3151
xorl %eax, %eax
movl %eax, %edi
callq 0x3e60
cmpl $0x0, 0x1927c(%rip)     # 0x1c3d4
jl 0x3161
movb $0x0, %al
callq 0x74a0
cmpl $0x0, 0x19270(%rip)     # 0x1c3d8
jl 0x3171
movb $0x0, %al
callq 0x8c80
jmp 0x312c
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/niuyuling[P]CProxy/main.c
// Function: thread_loop
void thread_loop(conf * configure)
{
    pthread_t thread_id = 0;
    /*
    sigset_t signal_mask;
    sigemptyset(&signal_mask);
    sigaddset(&signal_mask, SIGPIPE); // 忽略PIPE信号
    if (pthread_sigmask(SIG_BLOCK, &signal_mask, NULL) != 0) {
        printf("block sigpipe error\n");
    }
    */
    
    if (global.timeout_m)
        pthread_create(&thread_id, NULL, &timeout_check, NULL);
    
    if (server_sock >= 0)
    {
        if (global.dns_listen_fd >= 0) {
            dns_init();
            pthread_create(&thread_id, NULL, &dns_loop, NULL);
        }
        if (global.udp_listen_fd >= 0) {
            udp_init();
            //udp_loop(NULL);
            pthread_create(&thread_id, NULL, &udp_loop, NULL);
        }
        
        if (pthread_create(&thread_id, NULL, &tcp_loop, (void *)configure) != 0)
            perror("pthread_create");
    }
    
    if (global.dns_listen_fd >= 0)
    {
        dns_init();
        if (global.udp_listen_fd >= 0)
        {
            udp_init();
            pthread_create(&thread_id, NULL, &udp_loop, NULL);
        }
        dns_loop(NULL);
    }

    udp_init();
    udp_loop(NULL);

    //pthread_join(thread_id, NULL);
    //pthread_exit(NULL);

    /*  线程分离
       pthread_attr_t attr;
       pthread_attr_init(&attr);
       pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
       pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
       pthread_create(&thread_id, &attr, &tcp_timeout_check, NULL);
       pthread_create(&thread_id, &attr, &tcp_loop, (void *)configure);
       pthread_exit(NULL);
     */
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq $0x0, -0x10(%rbp)
cmpl $0x0, 0x18f19(%rip)     # 0x1c3e4
je 0x34e4
leaq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %ecx
leaq -0x3bc(%rip), %rdx      # 0x3120
movq %rcx, %rsi
callq 0x2440
cmpl $0x0, 0x15ee5(%rip)     # 0x193d0
jl 0x3566
cmpl $0x0, 0x18ee0(%rip)     # 0x1c3d4
jl 0x3514
movb $0x0, %al
callq 0x75f0
leaq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %ecx
leaq 0x42d4(%rip), %rdx      # 0x77e0
movq %rcx, %rsi
callq 0x2440
cmpl $0x0, 0x18ebd(%rip)     # 0x1c3d8
jl 0x353b
movb $0x0, %al
callq 0x8e40
leaq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %ecx
leaq 0x5a1d(%rip), %rdx      # 0x8f50
movq %rcx, %rsi
callq 0x2440
movq -0x8(%rbp), %rcx
leaq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq -0xa1e(%rip), %rdx      # 0x2b30
callq 0x2440
cmpl $0x0, %eax
je 0x3564
leaq 0x8c3d(%rip), %rdi      # 0xc19c
callq 0x2480
jmp 0x3566
cmpl $0x0, 0x18e67(%rip)     # 0x1c3d4
jl 0x35a6
movb $0x0, %al
callq 0x75f0
cmpl $0x0, 0x18e5b(%rip)     # 0x1c3d8
jl 0x359d
movb $0x0, %al
callq 0x8e40
leaq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %ecx
leaq 0x59bb(%rip), %rdx      # 0x8f50
movq %rcx, %rsi
callq 0x2440
xorl %eax, %eax
movl %eax, %edi
callq 0x77e0
movb $0x0, %al
callq 0x8e40
xorl %eax, %eax
movl %eax, %edi
callq 0x8f50
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/niuyuling[P]CProxy/main.c
// Function: help_information
static char help_information(void)
{
    static const char name[] = "C";
    static const char subject[] = "Proxy Server";
    static const struct {
        const char *email;
    } author = {
        "AIXIAO@AIXIAO.ME",
    };

    static const char usage[] = "Usage: [-?h] [-s signal] [-c filename]";
    static const char *s_help[] = {
        "",
        "Options:",
        "    -s --signal            : send signal to a master process: stop, quit, restart, reload, status",
        "    -c --config            : set configuration file, default: CProxy.conf",
        "    -? -h --? --help       : help information",
        "",
        0
    };

    fprintf(stderr, "%s %s\n", name, subject);
    fprintf(stderr, "Author: %s\n", author.email);
    fprintf(stderr, "%s\n", usage);

    int l;
    for (l = 0; s_help[l]; l++) {
        fprintf(stderr, "%s\n", s_help[l]);
    }

    BUILD("Compile、link.\n");

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq 0xb2f1(%rip), %rax      # 0xeff0
movq (%rax), %rdi
leaq 0x8628(%rip), %rsi      # 0xc331
leaq 0x83d8(%rip), %rdx      # 0xc0e8
leaq 0x83d3(%rip), %rcx      # 0xc0ea
movb $0x0, %al
callq 0x22d0
movq 0xb2cb(%rip), %rax      # 0xeff0
movq (%rax), %rdi
movq 0xb041(%rip), %rdx      # 0xed70
leaq 0x8602(%rip), %rsi      # 0xc338
movb $0x0, %al
callq 0x22d0
movq 0xb2ac(%rip), %rax      # 0xeff0
movq (%rax), %rdi
leaq 0x85f2(%rip), %rsi      # 0xc340
leaq 0x83ab(%rip), %rdx      # 0xc100
movb $0x0, %al
callq 0x22d0
movl $0x0, -0x4(%rbp)
movslq -0x4(%rbp), %rcx
leaq 0xb6b2(%rip), %rax      # 0xf420
cmpq $0x0, (%rax,%rcx,8)
je 0x3da7
movq 0xb274(%rip), %rax      # 0xeff0
movq (%rax), %rdi
movslq -0x4(%rbp), %rcx
leaq 0xb696(%rip), %rax      # 0xf420
movq (%rax,%rcx,8), %rdx
leaq 0x85ab(%rip), %rsi      # 0xc340
movb $0x0, %al
callq 0x22d0
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x3d63
jmp 0x3da9
movq 0xb240(%rip), %rax      # 0xeff0
movq (%rax), %rdi
leaq 0x858a(%rip), %rsi      # 0xc344
leaq 0x858a(%rip), %rdx      # 0xc34b
leaq 0x858f(%rip), %rcx      # 0xc357
movb $0x0, %al
callq 0x22d0
movq 0xb21a(%rip), %rax      # 0xeff0
movq (%rax), %rdi
leaq 0x8580(%rip), %rsi      # 0xc360
movb $0x0, %al
callq 0x22d0
xorl %eax, %eax
addq $0x10, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/niuyuling[P]CProxy/http_proxy.c
// Function: tcp_timeout_check
void *tcp_timeout_check(void *nullPtr)
{
    int i;

    for (i = 0; i < MAX_CONNECTION; i += 2) {
        if (cts[i].fd > -1) {
            if (cts[i].timer >= timeout_minute) {
                printf("关闭连接\n");
                close_connection(cts + i);
            } else
                cts[i].timer++;
        }
    }

    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
cmpl $0x3fc, -0xc(%rbp)      # imm = 0x3FC
jge 0x3f09
movslq -0xc(%rbp), %rcx
leaq 0xb5e5(%rip), %rax      # 0xf470
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
cmpl $-0x1, 0x10(%rax)
jle 0x3ef9
movslq -0xc(%rbp), %rcx
leaq 0xb5cd(%rip), %rax      # 0xf470
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0x20(%rax), %eax
cmpl 0x186dd(%rip), %eax     # 0x1c590
jl 0x3edc
leaq 0x84d6(%rip), %rdi      # 0xc392
movb $0x0, %al
callq 0x2180
movslq -0xc(%rbp), %rax
leaq 0xb5a2(%rip), %rdi      # 0xf470
imulq $0x28, %rax, %rax
addq %rax, %rdi
callq 0x3f20
jmp 0x3ef7
movslq -0xc(%rbp), %rcx
leaq 0xb589(%rip), %rax      # 0xf470
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0x20(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x20(%rax)
jmp 0x3ef9
jmp 0x3efb
movl -0xc(%rbp), %eax
addl $0x2, %eax
movl %eax, -0xc(%rbp)
jmp 0x3e73
xorl %eax, %eax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/niuyuling[P]CProxy/http_proxy.c
// Function: close_connection
void close_connection(conn_t * conn)
{
    epoll_ctl(epollfd, EPOLL_CTL_DEL, conn->fd, NULL);
    close(conn->fd);
    if ((conn - cts) & 1) {
        char *server_data;

        server_data = conn->ready_data;
        memset(conn, 0, sizeof(conn_t));
        conn->ready_data = server_data;
        conn--->fd = -1;
    } else {
        free(conn->ready_data);
        free(conn->incomplete_data);
        memset(conn, 0, sizeof(conn_t));
        conn++->fd = -1;
    }
    if (conn->fd >= 0)
        close_connection(conn);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
leaq 0x154a1(%rip), %rax     # 0x193d4
movl (%rax), %edi
movq -0x8(%rbp), %rax
movl 0x10(%rax), %edx
movl $0x2, %esi
xorl %eax, %eax
movl %eax, %ecx
callq 0x2240
movq -0x8(%rbp), %rax
movl 0x10(%rax), %edi
callq 0x2200
movq -0x8(%rbp), %rax
leaq 0xb50f(%rip), %rcx      # 0xf470
subq %rcx, %rax
movl $0x28, %ecx
cqto
idivq %rcx
andq $0x1, %rax
cmpq $0x0, %rax
je 0x3fb6
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rdi
xorl %esi, %esi
movl $0x28, %edx
callq 0x21c0
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
movq -0x8(%rbp), %rax
movq %rax, %rcx
addq $-0x28, %rcx
movq %rcx, -0x8(%rbp)
movl $0xffffffff, 0x10(%rax) # imm = 0xFFFFFFFF
jmp 0x3ff5
movq -0x8(%rbp), %rax
movq (%rax), %rdi
callq 0x2030
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x2030
movq -0x8(%rbp), %rdi
xorl %esi, %esi
movl $0x28, %edx
callq 0x21c0
movq -0x8(%rbp), %rax
movq %rax, %rcx
addq $0x28, %rcx
movq %rcx, -0x8(%rbp)
movl $0xffffffff, 0x10(%rax) # imm = 0xFFFFFFFF
movq -0x8(%rbp), %rax
cmpl $0x0, 0x10(%rax)
jl 0x4008
movq -0x8(%rbp), %rdi
callq 0x3f20
addq $0x10, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/niuyuling[P]CProxy/http_proxy.c
// Function: clientToserver
void clientToserver(conn_t * in)
{
    int write_len;
    conn_t *remote;
    remote = in + 1;

    write_len = write(remote->fd, in->ready_data, in->ready_data_len);
    if (write_len == in->ready_data_len) {
        in->ready_data_len = 0;
        in->ready_data = NULL;
    } else {
        close_connection(remote);
    }

    return;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x28, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movl 0x10(%rax), %edi
movq -0x8(%rbp), %rax
movq (%rax), %rsi
movq -0x8(%rbp), %rax
movslq 0x14(%rax), %rdx
callq 0x20d0
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x14(%rcx), %eax
jne 0x406a
movq -0x8(%rbp), %rax
movl $0x0, 0x14(%rax)
movq -0x8(%rbp), %rax
movq $0x0, (%rax)
jmp 0x4073
movq -0x18(%rbp), %rdi
callq 0x3f20
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/niuyuling[P]CProxy/http_proxy.c
// Function: check_ipversion
int check_ipversion(char *address)
{
    struct in6_addr bindaddr;

    if (inet_pton(AF_INET, address, &bindaddr) == 1) {
        return AF_INET;
    } else {
        if (inet_pton(AF_INET6, address, &bindaddr) == 1) {
            return AF_INET6;
        }
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rsi
movl $0x2, %edi
leaq -0x20(%rbp), %rdx
callq 0x2310
cmpl $0x1, %eax
jne 0x40ac
movl $0x2, -0x4(%rbp)
jmp 0x40d5
movq -0x10(%rbp), %rsi
movl $0xa, %edi
leaq -0x20(%rbp), %rdx
callq 0x2310
cmpl $0x1, %eax
jne 0x40cc
movl $0xa, -0x4(%rbp)
jmp 0x40d5
jmp 0x40ce
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/niuyuling[P]CProxy/http_proxy.c
// Function: serverToClient
static void serverToClient(conn_t * server)
{
    conn_t *client;
    int write_len;

    client = server - 1;
    while ((server->ready_data_len = read(server->fd, server->ready_data, BUFFER_SIZE)) > 0) {
        dataEncode(server->ready_data, server->ready_data_len, sslEncodeCode);
        write_len = write(client->fd, server->ready_data, server->ready_data_len);
        if (write_len <= 0) {
            if (write_len == 0 || errno != EAGAIN)
                close_connection(server);
            else
                server->sent_len = 0;
            return;
        } else if (write_len < server->ready_data_len) {
            server->sent_len = write_len;
            ev.events = EPOLLIN | EPOLLOUT | EPOLLET;
            ev.data.ptr = client;
            epoll_ctl(epollfd, EPOLL_CTL_MOD, client->fd, &ev);
            return;
        }
        if (server->ready_data_len < BUFFER_SIZE)
            break;
    }
    //判断是否关闭连接
    if (server->ready_data_len == 0 || (server->ready_data_len == -1 && errno != EAGAIN))
        close_connection(server);
    else
        server->ready_data_len = server->sent_len = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $-0x28, %rax
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movl 0x10(%rax), %edi
movq -0x8(%rbp), %rax
movq (%rax), %rsi
movl $0x2000, %edx           # imm = 0x2000
callq 0x2260
movq -0x8(%rbp), %rcx
movl %eax, 0x14(%rcx)
cmpl $0x0, %eax
jle 0x4653
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x8(%rbp), %rax
movl 0x14(%rax), %esi
movl 0x18120(%rip), %edx     # 0x1c6b4
callq 0x3e20
movq -0x10(%rbp), %rax
movl 0x10(%rax), %edi
movq -0x8(%rbp), %rax
movq (%rax), %rsi
movq -0x8(%rbp), %rax
movslq 0x14(%rax), %rdx
callq 0x20d0
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jg 0x45e8
cmpl $0x0, -0x14(%rbp)
je 0x45cd
callq 0x2050
cmpl $0xb, (%rax)
je 0x45d8
movq -0x8(%rbp), %rdi
callq 0x3f20
jmp 0x45e3
movq -0x8(%rbp), %rax
movl $0x0, 0x1c(%rax)
jmp 0x4692
movl -0x14(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x14(%rcx), %eax
jge 0x463d
movl -0x14(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x1c(%rax)
leaq 0x14dd7(%rip), %rax     # 0x193dc
movl $0x80000005, (%rax)     # imm = 0x80000005
movq -0x10(%rbp), %rcx
leaq 0x14dc6(%rip), %rax     # 0x193dc
movq %rcx, 0x4(%rax)
leaq 0x14db3(%rip), %rax     # 0x193d4
movl (%rax), %edi
movq -0x10(%rbp), %rax
movl 0x10(%rax), %edx
movl $0x3, %esi
leaq 0x14da6(%rip), %rcx     # 0x193dc
callq 0x2240
jmp 0x4692
jmp 0x463f
movq -0x8(%rbp), %rax
cmpl $0x2000, 0x14(%rax)     # imm = 0x2000
jge 0x464e
jmp 0x4653
jmp 0x4558
movq -0x8(%rbp), %rax
cmpl $0x0, 0x14(%rax)
je 0x4671
movq -0x8(%rbp), %rax
cmpl $-0x1, 0x14(%rax)
jne 0x467c
callq 0x2050
cmpl $0xb, (%rax)
je 0x467c
movq -0x8(%rbp), %rdi
callq 0x3f20
jmp 0x4692
movq -0x8(%rbp), %rax
movl $0x0, 0x1c(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x14(%rax)
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/niuyuling[P]CProxy/http_proxy.c
// Function: read_data
static char *read_data(conn_t * in, char *data, int *data_len)
{
    char *new_data;
    int read_len;

    do {
        new_data = (char *)realloc(data, *data_len + BUFFER_SIZE + 1);
        if (new_data == NULL) {
            free(data);
            return NULL;
        }
        data = new_data;
        read_len = read(in->fd, data + *data_len, BUFFER_SIZE);
        /* 判断是否关闭连接 */
        if (read_len <= 0) {
            if (read_len == 0 || *data_len == 0 || errno != EAGAIN) {
                free(data);
                return NULL;
            }
            break;
        }
        *data_len += read_len;
    } while (read_len == BUFFER_SIZE);
    *(data + *data_len) = '\0';

    return data;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rax
movl (%rax), %eax
addl $0x2000, %eax           # imm = 0x2000
addl $0x1, %eax
movslq %eax, %rsi
callq 0x23e0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x46ef
movq -0x18(%rbp), %rdi
callq 0x2030
movq $0x0, -0x8(%rbp)
jmp 0x477c
movq -0x28(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movl 0x10(%rax), %edi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rax
movslq (%rax), %rax
addq %rax, %rsi
movl $0x2000, %edx           # imm = 0x2000
callq 0x2260
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
jg 0x474d
cmpl $0x0, -0x2c(%rbp)
je 0x4738
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x4738
callq 0x2050
cmpl $0xb, (%rax)
je 0x474b
movq -0x18(%rbp), %rdi
callq 0x2030
movq $0x0, -0x8(%rbp)
jmp 0x477c
jmp 0x4765
movl -0x2c(%rbp), %ecx
movq -0x20(%rbp), %rax
addl (%rax), %ecx
movl %ecx, (%rax)
cmpl $0x2000, -0x2c(%rbp)    # imm = 0x2000
je 0x46b4
movq -0x18(%rbp), %rax
movq -0x20(%rbp), %rcx
movslq (%rcx), %rcx
movb $0x0, (%rax,%rcx)
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/niuyuling[P]CProxy/http_proxy.c
// Function: request_type
static int8_t request_type(char *data)
{
    if (strncmp(data, "GET", 3) == 0 || 
        strncmp(data, "POST", 4) == 0 || 
        strncmp(data, "CONNECT", 7) == 0 || 
        strncmp(data, "HEAD", 4) == 0 || 
        strncmp(data, "PUT", 3) == 0 || 
        strncmp(data, "OPTIONS", 7) == 0 || 
        strncmp(data, "MOVE", 4) == 0 || 
        strncmp(data, "COPY", 4) == 0 || 
        strncmp(data, "TRACE", 5) == 0 || 
        strncmp(data, "DELETE", 6) == 0 || 
        strncmp(data, "LINK", 4) == 0 || 
        strncmp(data, "UNLINK", 6) == 0 || 
        strncmp(data, "PATCH", 5) == 0 || 
        strncmp(data, "WRAPPED", 7) == 0)
        return HTTP_TYPE;
    return OTHER_TYPE;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x7c1a(%rip), %rsi      # 0xc3c1
movl $0x3, %edx
callq 0x2070
cmpl $0x0, %eax
je 0x492c
movq -0x10(%rbp), %rdi
leaq 0x7c00(%rip), %rsi      # 0xc3c5
movl $0x4, %edx
callq 0x2070
cmpl $0x0, %eax
je 0x492c
movq -0x10(%rbp), %rdi
leaq 0x7be7(%rip), %rsi      # 0xc3ca
movl $0x7, %edx
callq 0x2070
cmpl $0x0, %eax
je 0x492c
movq -0x10(%rbp), %rdi
leaq 0x7bd1(%rip), %rsi      # 0xc3d2
movl $0x4, %edx
callq 0x2070
cmpl $0x0, %eax
je 0x492c
movq -0x10(%rbp), %rdi
leaq 0x7bb8(%rip), %rsi      # 0xc3d7
movl $0x3, %edx
callq 0x2070
cmpl $0x0, %eax
je 0x492c
movq -0x10(%rbp), %rdi
leaq 0x7b9e(%rip), %rsi      # 0xc3db
movl $0x7, %edx
callq 0x2070
cmpl $0x0, %eax
je 0x492c
movq -0x10(%rbp), %rdi
leaq 0x7b88(%rip), %rsi      # 0xc3e3
movl $0x4, %edx
callq 0x2070
cmpl $0x0, %eax
je 0x492c
movq -0x10(%rbp), %rdi
leaq 0x7b6f(%rip), %rsi      # 0xc3e8
movl $0x4, %edx
callq 0x2070
cmpl $0x0, %eax
je 0x492c
movq -0x10(%rbp), %rdi
leaq 0x7b56(%rip), %rsi      # 0xc3ed
movl $0x5, %edx
callq 0x2070
cmpl $0x0, %eax
je 0x492c
movq -0x10(%rbp), %rdi
leaq 0x7b3e(%rip), %rsi      # 0xc3f3
movl $0x6, %edx
callq 0x2070
cmpl $0x0, %eax
je 0x492c
movq -0x10(%rbp), %rdi
leaq 0x7b2d(%rip), %rsi      # 0xc3fc
movl $0x4, %edx
callq 0x2070
cmpl $0x0, %eax
je 0x492c
movq -0x10(%rbp), %rdi
leaq 0x7b11(%rip), %rsi      # 0xc3fa
movl $0x6, %edx
callq 0x2070
cmpl $0x0, %eax
je 0x492c
movq -0x10(%rbp), %rdi
leaq 0x7afe(%rip), %rsi      # 0xc401
movl $0x5, %edx
callq 0x2070
cmpl $0x0, %eax
je 0x492c
movq -0x10(%rbp), %rdi
leaq 0x7aea(%rip), %rsi      # 0xc407
movl $0x7, %edx
callq 0x2070
cmpl $0x0, %eax
jne 0x4932
movb $0x0, -0x1(%rbp)
jmp 0x4936
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
addq $0x10, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/niuyuling[P]CProxy/http_proxy.c
// Function: copy_data
static int8_t copy_data(conn_t * ct)
{
    dataEncode(ct->incomplete_data, ct->incomplete_data_len, sslEncodeCode);

    if (ct->ready_data) {
        char *new_data;

        new_data = (char *)realloc(ct->ready_data, ct->ready_data_len + ct->incomplete_data_len);
        if (new_data == NULL)
            return 1;
        ct->ready_data = new_data;
        memcpy(new_data + ct->ready_data_len, ct->incomplete_data, ct->incomplete_data_len);
        ct->ready_data_len += ct->incomplete_data_len;
        free(ct->incomplete_data);
    } else {
        ct->ready_data = ct->incomplete_data;
        ct->ready_data_len = ct->incomplete_data_len;
    }
    ct->incomplete_data = NULL;
    ct->incomplete_data_len = 0;

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rax
movl 0x18(%rax), %esi
movl 0x17d53(%rip), %edx     # 0x1c6b4
callq 0x3e20
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
je 0x49f4
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movl 0x14(%rax), %eax
movq -0x10(%rbp), %rcx
addl 0x18(%rcx), %eax
movslq %eax, %rsi
callq 0x23e0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x49a5
movb $0x1, -0x1(%rbp)
jmp 0x4a2c
movq -0x18(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rax
movslq 0x14(%rax), %rax
addq %rax, %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x10(%rbp), %rax
movslq 0x18(%rax), %rdx
callq 0x2300
movq -0x10(%rbp), %rax
movl 0x18(%rax), %ecx
movq -0x10(%rbp), %rax
addl 0x14(%rax), %ecx
movl %ecx, 0x14(%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x2030
jmp 0x4a11
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
movl 0x18(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x18(%rax)
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/niuyuling[P]CProxy/http_request.c
// Function: copy_new_mem
int8_t copy_new_mem(char *src, int src_len, char **dest)
{
    *dest = (char *)malloc(src_len + 1);
    if (*dest == NULL)
        return 1;
    memcpy(*dest, src, src_len);
    *((*dest) + src_len) = '\0';

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdi
callq 0x2350
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x4ccb
movb $0x1, -0x1(%rbp)
jmp 0x4cf2
movq -0x20(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
movslq -0x14(%rbp), %rdx
callq 0x2300
movq -0x20(%rbp), %rax
movq (%rax), %rax
movslq -0x14(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/niuyuling[P]CProxy/http_request.c
// Function: get_http_path
char *get_http_path(char *url, int url_len, char *path)
{
    char *_p0, *_p1;
    _p0 = _p1 = NULL;

    _p1 = strchr(url, '\0');

    if (url_len > 7) {
        if (url) {
            _p0 = strstr(url + 7, "/");
            if (_p0)
                return memcpy(path, _p0, _p1 - _p0);
            else
                return memcpy(path, "/", 1); // 如果没有资源路径就默认"/"
        }
    } else {
        return memcpy(path, "/", 1);
    }

    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x2170
movq %rax, -0x30(%rbp)
cmpl $0x7, -0x14(%rbp)
jle 0x5848
cmpq $0x0, -0x10(%rbp)
je 0x5846
movq -0x10(%rbp), %rdi
addq $0x7, %rdi
leaq 0x6c44(%rip), %rsi      # 0xc442
callq 0x2570
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x5834
movq -0x20(%rbp), %rdi
movq %rdi, -0x38(%rbp)
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq -0x28(%rbp), %rax
subq %rax, %rdx
callq 0x2300
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x5862
movq -0x20(%rbp), %rax
movb 0x6c04(%rip), %cl       # 0xc442
movb %cl, (%rax)
movq %rax, -0x8(%rbp)
jmp 0x5862
jmp 0x585a
movq -0x20(%rbp), %rax
movb 0x6bf0(%rip), %cl       # 0xc442
movb %cl, (%rax)
movq %rax, -0x8(%rbp)
jmp 0x5862
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/niuyuling[P]CProxy/http_request.c
// Function: free_http_request
void free_http_request(struct http_request *http_request)
{
    if (http_request->method)
        free(http_request->method);
    if (http_request->U)
        free(http_request->U);
    if (http_request->version)
        free(http_request->version);
    if (http_request->host)
        free(http_request->host);
    if (http_request->port)
        free(http_request->port);
    if (http_request->H)
        free(http_request->H);
    if (http_request->url)
        free(http_request->url);
    if (http_request->uri)
        free(http_request->uri);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpq $0x0, (%rax)
je 0x5aa2
movq -0x8(%rbp), %rax
movq (%rax), %rdi
callq 0x2030
movq -0x8(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x5aba
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x2030
movq -0x8(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x5ad2
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x2030
movq -0x8(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x5aea
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x2030
movq -0x8(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x5b02
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x2030
movq -0x8(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x5b1a
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x2030
movq -0x8(%rbp), %rax
cmpq $0x0, 0x30(%rax)
je 0x5b32
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rdi
callq 0x2030
movq -0x8(%rbp), %rax
cmpq $0x0, 0x38(%rax)
je 0x5b4a
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x2030
addq $0x10, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/niuyuling[P]CProxy/http_request.c
// Function: delete_head
static char *delete_head(char *head, int *head_len, const char *needle, int string)
{
    char *temp_stack;
    char *_p1, *_p2, *_p3;
    _p1 = _p2 = _p3 = NULL;
    int temp_stack_len;

    _p1 = strstr(head, needle); // _p1指向head字符串中的"needle"字符处(needle字符串的第一个字符)
    if (_p1 == NULL) {
        //perror("_p1 HEAD NULL");
        return head;
    }
    _p2 = strchr(_p1, string);  // _p2指向head字符串中"string"字符到末尾中的'\0'
    if (_p2 == NULL) {
        //perror("_p2 HEAD NULL");
        return head;
    }
    _p3 = strchr(_p1, '\0');    // _p3指向head字符串末尾的'\0'
    if (_p3 == NULL) {
        //perror("_p3 HEAD NULL");
        return head;
    }
    temp_stack_len = (_p1 - head) + (_p3 - _p2);
    temp_stack = (char *)alloca(temp_stack_len + 1); // 分配临时栈内存，长度是去除needle到string处
    if (temp_stack == NULL) {
        perror("alloca");
        return head;
    }
    memset(temp_stack, 0, temp_stack_len + 1);
    memmove(temp_stack, head, (_p1 - head) - 1);
    strncat(temp_stack, _p2, _p3 - _p2);

    memset(head, 0, *head_len);
    *head_len = temp_stack_len;
    return memmove(head, temp_stack, temp_stack_len);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movq $0x0, -0x48(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x2570
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x6a74
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x6b89
movq -0x38(%rbp), %rdi
movl -0x24(%rbp), %esi
callq 0x2170
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x6a98
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x6b89
movq -0x38(%rbp), %rdi
xorl %esi, %esi
callq 0x2170
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x6abb
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x6b89
movl -0x38(%rbp), %eax
movl -0x10(%rbp), %ecx
subl %ecx, %eax
movl -0x48(%rbp), %ecx
movl -0x40(%rbp), %edx
subl %edx, %ecx
addl %ecx, %eax
movl %eax, -0x4c(%rbp)
movslq -0x4c(%rbp), %rcx
addq $0x10, %rcx
andq $-0x10, %rcx
movq %rsp, %rax
subq %rcx, %rax
movq %rax, %rsp
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x6b09
leaq 0x5994(%rip), %rdi      # 0xc48b
callq 0x2480
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x6b89
movq -0x30(%rbp), %rdi
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdx
xorl %esi, %esi
callq 0x21c0
movq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x38(%rbp), %rdx
movq -0x10(%rbp), %rax
subq %rax, %rdx
subq $0x1, %rdx
callq 0x2450
movq -0x30(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq -0x40(%rbp), %rax
subq %rax, %rdx
callq 0x21f0
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movslq (%rax), %rdx
xorl %esi, %esi
callq 0x21c0
movl -0x4c(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movq -0x10(%rbp), %rdi
movq %rdi, -0x58(%rbp)
movq -0x30(%rbp), %rsi
movslq -0x4c(%rbp), %rdx
callq 0x2450
movq -0x58(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rbp, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/niuyuling[P]CProxy/http_request.c
// Function: splice_head
static char *splice_head(char *head, int *head_len, const char *needle, char *string, int string_len)
{
    char *tail_head;
    char *_p0;
    char *_p1;

    _p1 = strstr(head, needle);
    if (_p1 == NULL) {
        return head;
    }
    _p1 = _p1 + 1;
    _p0 = strchr(_p1, '\0');

    tail_head = (char *)alloca((_p0 - _p1) + 1);
    if (tail_head == NULL) {
        perror("alloca");
        return head;
    }
    memset(tail_head, 0, (_p0 - _p1) + 1);
    memcpy(tail_head, _p1, (_p0 - _p1));

    memset(head, 0, *head_len);
    memcpy(head, string, string_len);
    strncat(head, tail_head, (_p0 - _p1));
    *head_len = string_len + (_p0 - _p1);
    return head;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movl %r8d, -0x2c(%rbp)
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x2570
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x6be1
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x6cca
movq -0x48(%rbp), %rax
incq %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
xorl %esi, %esi
callq 0x2170
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rcx
movq -0x48(%rbp), %rax
subq %rax, %rcx
addq $0x10, %rcx
andq $-0x10, %rcx
movq %rsp, %rax
subq %rcx, %rax
movq %rax, %rsp
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x6c3b
leaq 0x5862(%rip), %rdi      # 0xc48b
callq 0x2480
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x6cca
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rdx
movq -0x48(%rbp), %rax
subq %rax, %rdx
addq $0x1, %rdx
xorl %esi, %esi
callq 0x21c0
movq -0x38(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq -0x48(%rbp), %rax
subq %rax, %rdx
callq 0x2300
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movslq (%rax), %rdx
xorl %esi, %esi
callq 0x21c0
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rsi
movslq -0x2c(%rbp), %rdx
callq 0x2300
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq -0x48(%rbp), %rax
subq %rax, %rdx
callq 0x21f0
movslq -0x2c(%rbp), %rax
movq -0x40(%rbp), %rcx
movq -0x48(%rbp), %rdx
subq %rdx, %rcx
addq %rcx, %rax
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rbp, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/niuyuling[P]CProxy/http_request.c
// Function: conf_handle_strrep
static char *conf_handle_strrep(char *str, int *str_len, tcp * temp)
{
    tcp *p = temp;

    while (p) {
        if (p->strrep) {
            str = replace(str, str_len, p->strrep_s, p->strrep_s_len, p->strrep_t, p->strrep_t_len);
        }

        p = p->next;
    }

    return str;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x6d4b
movq -0x20(%rbp), %rax
cmpq $0x0, (%rax)
je 0x6d3d
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdx
movq -0x20(%rbp), %rax
movl 0x20(%rax), %ecx
movq -0x20(%rbp), %rax
movq 0x18(%rax), %r8
movq -0x20(%rbp), %rax
movl 0x24(%rax), %r9d
callq 0x4d00
movq %rax, -0x8(%rbp)
movq -0x20(%rbp), %rax
movq 0x50(%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0x6cfc
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/niuyuling[P]CProxy/http_request.c
// Function: conf_handle_regrep
static char *conf_handle_regrep(char *str, int *str_len, tcp * temp)
{
    tcp *p = temp;

    while (p) {
        if (p->regrep) {
            str = regrep(str, str_len, p->regrep_s, p->regrep_t, p->regrep_t_len);
        }

        p = p->next;
    }

    return str;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x6dc5
movq -0x20(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x6db7
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x20(%rbp), %rax
movq 0x38(%rax), %rdx
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rcx
movq -0x20(%rbp), %rax
movl 0x4c(%rax), %r8d
callq 0x6dd0
movq %rax, -0x8(%rbp)
movq -0x20(%rbp), %rax
movq 0x50(%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0x6d7c
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/niuyuling[P]CProxy/httpdns.c
// Function: dns_timeout_check
void dns_timeout_check()
{
    int i;

    for (i = 0; i < DNS_MAX_CONCURRENT; i++) {
        if (dns_list[i].fd > -1) {
            if (dns_list[i].timer >= global.timeout_m) {
                dnsProxyStop(dns_list + i);
            } else {
                dns_list[i].timer++;
            }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x0, -0x4(%rbp)
cmpl $0x200, -0x4(%rbp)      # imm = 0x200
jge 0x7553
movslq -0x4(%rbp), %rcx
leaq 0x15279(%rip), %rax     # 0x1c740
imulq $0x240, %rcx, %rcx      # imm = 0x240
addq %rcx, %rax
cmpl $-0x1, 0x22c(%rax)
jle 0x7543
movslq -0x4(%rbp), %rcx
leaq 0x1525b(%rip), %rax     # 0x1c740
imulq $0x240, %rcx, %rcx      # imm = 0x240
addq %rcx, %rax
movl 0x230(%rax), %eax
leaq 0x14ed4(%rip), %rcx     # 0x1c3d0
cmpl 0x14(%rcx), %eax
jl 0x751d
movslq -0x4(%rbp), %rax
leaq 0x15234(%rip), %rdi     # 0x1c740
imulq $0x240, %rax, %rax      # imm = 0x240
addq %rax, %rdi
callq 0x7560
jmp 0x7541
movslq -0x4(%rbp), %rcx
leaq 0x15218(%rip), %rax     # 0x1c740
imulq $0x240, %rcx, %rcx      # imm = 0x240
addq %rcx, %rax
movl 0x230(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x230(%rax)
jmp 0x7543
jmp 0x7545
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x74af
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/niuyuling[P]CProxy/httpdns.c
// Function: dnsProxyStop
static void dnsProxyStop(dns_t * dns)
{
    epoll_ctl(dns_efd, EPOLL_CTL_DEL, dns->fd, NULL);
    close(dns->fd);
    if (httpdns.tcpDNS_mode == 0)
        free(dns->out_request);
    memset(((char *)dns) + DNS_REQUEST_MAX_SIZE + sizeof(struct sockaddr_in), 0, sizeof(dns_t) - DNS_REQUEST_MAX_SIZE + -sizeof(struct sockaddr_in));
    dns->fd = -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movl 0x5d1ce(%rip), %edi     # 0x64740
movq -0x8(%rbp), %rax
movl 0x22c(%rax), %edx
movl $0x2, %esi
xorl %eax, %eax
movl %eax, %ecx
callq 0x2240
movq -0x8(%rbp), %rax
movl 0x22c(%rax), %edi
callq 0x2200
movb 0x15191(%rip), %al      # 0x1c730
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x75b9
movq -0x8(%rbp), %rax
movq 0x218(%rax), %rdi
callq 0x2030
movq -0x8(%rbp), %rdi
addq $0x200, %rdi            # imm = 0x200
addq $0x2, %rdi
addq $0x10, %rdi
xorl %esi, %esi
movl $0x32, %edx
callq 0x21c0
movq -0x8(%rbp), %rax
movl $0xffffffff, 0x22c(%rax) # imm = 0xFFFFFFFF
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)