LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/ttoobne[P]bohttpd/src/core/epoll.c
// Function: epoll_delete_fd
int epoll_delete_fd(epoll_t* epoll, int fd, epoll_event* event) {
    
    if (epoll == NULL) {
        log_error("epoll is null.");
        return -1;
    }

    /* 删除监听事件 */
    if (epoll_ctl(epoll->epollfd, EPOLL_CTL_DEL, fd, event) != 0) {
        log_error("epoll delete failed.");
        return -1;
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
testq %rdi, %rdi
je 0x352a
movq %rdx, %rcx
movl %esi, %edx
movl (%rdi), %edi
movl $0x2, %esi
callq 0x21f0
testl %eax, %eax
je 0x3557
leaq 0x3f7c(%rip), %rsi      # 0x748c
leaq 0x402c(%rip), %rdx      # 0x7543
leaq 0x4035(%rip), %r8       # 0x7553
movl $0x4, %edi
movl $0x62, %ecx
jmp 0x3549
leaq 0x3f5b(%rip), %rsi      # 0x748c
leaq 0x400b(%rip), %rdx      # 0x7543
leaq 0x3fbe(%rip), %r8       # 0x74fd
movl $0x4, %edi
movl $0x5c, %ecx
xorl %eax, %eax
callq 0x252a
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x3559
xorl %eax, %eax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ttoobne[P]bohttpd/src/core/epoll.c
// Function: epoll_wait_event
int epoll_wait_event(epoll_t* epoll, int maxevents, int timeout) {
    int n;
    int events_num;

    if (epoll == NULL) {
        log_error("epoll is null.");
        return -1;
    }

    /* 最大事件数与宏 MAX_EVENTS 取较小值 */
    events_num = maxevents < MAX_EVENTS ? maxevents : MAX_EVENTS;
    /* 等待就绪事件 */
    if ((n = epoll_wait(epoll->epollfd, epoll->events, events_num, timeout)) < 0) {
        log_error("epoll wait failed.");
    }

    return n;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x35ad
movl %edx, %ecx
movl $0x400, %edx            # imm = 0x400
cmpl %edx, %esi
cmovll %esi, %edx
movl (%rdi), %eax
movq 0x8(%rdi), %rsi
movl %eax, %edi
callq 0x2330
movl %eax, %ebx
testl %eax, %eax
jns 0x35d8
leaq 0x3f00(%rip), %rsi      # 0x748c
leaq 0x3fd5(%rip), %rdx      # 0x7568
leaq 0x3bbc(%rip), %r8       # 0x7156
movl $0x4, %edi
movl $0x79, %ecx
xorl %eax, %eax
callq 0x252a
jmp 0x35d8
leaq 0x3ed8(%rip), %rsi      # 0x748c
leaq 0x3fad(%rip), %rdx      # 0x7568
leaq 0x3f3b(%rip), %r8       # 0x74fd
movl $0x4, %edi
movl $0x71, %ecx
xorl %eax, %eax
callq 0x252a
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/ttoobne[P]bohttpd/src/http/http.c
// Function: http_init_connection
int http_init_connection(int connfd, epoll_t* epoll, config_t* config) {
    http_request_t* rq;
    struct epoll_event epev;

    /* 非阻塞读写 */
    set_nonblocking(connfd);

    if ((rq = http_request_init(connfd, epoll, config)) == NULL) {
        log_error("http_request_t init failed.");
        return -1;
    }

    /* 设置 epoll 监听 connfd 上的读事件，边缘触发 */
    epev.data.ptr = (void*)rq;
    epev.events = EPOLLIN | EPOLLET | EPOLLONESHOT;

    epoll_add_fd(epoll, connfd, &epev);

    /* 添加事件到定时器，设置超时回调函数 */
    add_timer((void*)rq, rq->timeout, http_close_connection);

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r15
movq %rsi, %r14
movl %edi, %ebx
callq 0x5fc0
movl %ebx, %edi
movq %r14, %rsi
movq %r15, %rdx
callq 0x490b
testq %rax, %rax
je 0x3645
movq %rax, %r15
leaq -0x24(%rbp), %rdx
movq %rax, 0x4(%rdx)
movl $0xc0000001, (%rdx)     # imm = 0xC0000001
movq %r14, %rdi
movl %ebx, %esi
callq 0x340b
movq 0x20e8(%r15), %rsi
leaq 0x42(%rip), %rdx        # 0x367b
movq %r15, %rdi
callq 0x4db2
xorl %eax, %eax
jmp 0x3670
leaq 0x3f2d(%rip), %rsi      # 0x7579
leaq 0x3f36(%rip), %rdx      # 0x7589
leaq 0x3f44(%rip), %r8       # 0x759e
movl $0x4, %edi
movl $0x4b, %ecx
xorl %eax, %eax
callq 0x252a
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ttoobne[P]bohttpd/src/http/http.c
// Function: http_close_connection
int http_close_connection(void* http_request) {
    http_request_t* rq;

    rq = (http_request_t*) http_request;
    
    close(rq->fd);

    http_request_destroy(rq);

    log_info("connection closed.");

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl (%rdi), %edi
callq 0x21d0
movq %rbx, %rdi
callq 0x4b4e
leaq 0x3edf(%rip), %rsi      # 0x7579
leaq 0x3fce(%rip), %rdx      # 0x766f
leaq 0x3fdd(%rip), %r8       # 0x7685
movl $0x2, %edi
movl $0x13c, %ecx            # imm = 0x13C
xorl %eax, %eax
callq 0x252a
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ttoobne[P]bohttpd/src/http/http.c
// Function: create_listenfd
int create_listenfd(unsigned short port) {
    int listenfd;
    int optval;
    struct sockaddr_in servaddr;

    /* 创建 socket 描述符 */
    if ((listenfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
        log_error("create socket failed.");
        return -1;
    }

    /* 设置 SO_REUSEADDR 关闭服务端的 TIME_WAIT */
    if (setsockopt(listenfd, SOL_SOCKET, SO_REUSEADDR, (const void *)&optval , sizeof(int)) < 0) {
        log_error("set listenfd reuse adress error.");
	    return -1;
    }

    /* 设置地址与端口号 */
    bzero(&servaddr, sizeof(servaddr));
    servaddr.sin_family = AF_INET;
    servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
    servaddr.sin_port = htons((unsigned short)port);

    /* 绑定地址与端口号 */
    if (bind(listenfd, (struct sockaddr*)&servaddr, sizeof(servaddr)) < 0) {
        log_error("bind error.");
        return -1;
    }

    /* 将描述符设置为监听描述符 */
    if (listen(listenfd, BACKLOG) < 0) {
        log_error("listen error.");
        return -1;
    }

    return listenfd;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movl %edi, %r14d
movl $0x2, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x24a0
testl %eax, %eax
js 0x3773
movl %eax, %ebx
leaq -0x14(%rbp), %rcx
movl %eax, %edi
movl $0x1, %esi
movl $0x2, %edx
movl $0x4, %r8d
callq 0x20d0
testl %eax, %eax
js 0x3794
xorps %xmm0, %xmm0
leaq -0x30(%rbp), %rsi
movaps %xmm0, (%rsi)
movw $0x2, (%rsi)
movl $0x0, 0x4(%rsi)
rolw $0x8, %r14w
movw %r14w, 0x2(%rsi)
movl %ebx, %edi
movl $0x10, %edx
callq 0x2340
testl %eax, %eax
js 0x37b5
movl %ebx, %edi
movl $0x400, %esi            # imm = 0x400
callq 0x2300
testl %eax, %eax
jns 0x37e0
leaq 0x3e20(%rip), %rsi      # 0x7579
leaq 0x3e5a(%rip), %rdx      # 0x75ba
leaq 0x3ea6(%rip), %r8       # 0x760d
movl $0x4, %edi
movl $0x7c, %ecx
jmp 0x37d4
leaq 0x3dff(%rip), %rsi      # 0x7579
leaq 0x3e39(%rip), %rdx      # 0x75ba
leaq 0x3e42(%rip), %r8       # 0x75ca
movl $0x4, %edi
movl $0x64, %ecx
jmp 0x37d4
leaq 0x3dde(%rip), %rsi      # 0x7579
leaq 0x3e18(%rip), %rdx      # 0x75ba
leaq 0x3e37(%rip), %r8       # 0x75e0
movl $0x4, %edi
movl $0x6a, %ecx
jmp 0x37d4
leaq 0x3dbd(%rip), %rsi      # 0x7579
leaq 0x3df7(%rip), %rdx      # 0x75ba
leaq 0x3e37(%rip), %r8       # 0x7601
movl $0x4, %edi
movl $0x76, %ecx
xorl %eax, %eax
callq 0x252a
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ttoobne[P]bohttpd/src/http/http.c
// Function: serve_error
static int serve_error(http_request_t* rq, unsigned status) {
    char body[MAXMSG] = { '\0' };
    int length;

    sprintf(body, "<html><head>");
    sprintf(body, "%s<title>%d %s</title></head>", body, status, get_shortmsg(status));
    sprintf(body, "%s<body bgcolor=\"LightSkyBlue\" align=\"center\">", body);
    sprintf(body, "%s<h1>%d %s</h1><hr>", body, status, get_shortmsg(status));
    sprintf(body, "%s<em>%s</em>", body, SERVER_NAME);
    sprintf(body, "%s</body></html>", body);

    length = strlen(body);

    serve_headers(rq, NULL, "text/html; charset=UTF-8", length, status);

    if (rio_writen(rq->fd, body, length) < 0) {
        log_error("write error.");
        return -1;
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x1000, %rsp           # imm = 0x1000
movl %esi, %r14d
movq %rdi, %rbx
leaq -0x1013(%rbp), %r15
movl $0xff3, %edx            # imm = 0xFF3
movq %r15, %rdi
xorl %esi, %esi
callq 0x21b0
movabsq $0x683c3e6c6d74683c, %rax # imm = 0x683C3E6C6D74683C
movq %rax, -0xd(%r15)
movabsq $0x3e646165683c3e, %rax # imm = 0x3E646165683C3E
movq %rax, -0x8(%r15)
movl %r14d, %edi
callq 0x4138
movq %rax, %r12
leaq 0x3c9d(%rip), %rsi      # 0x7a14
leaq -0x1020(%rbp), %r15
movq %r15, %rdi
movq %r15, %rdx
movl %r14d, %ecx
movq %rax, %r8
xorl %eax, %eax
callq 0x23e0
leaq 0x3c9a(%rip), %rsi      # 0x7a32
movq %r15, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x23e0
leaq 0x3cb5(%rip), %rsi      # 0x7a61
movq %r15, %rdi
movq %r15, %rdx
movl %r14d, %ecx
movq %r12, %r8
xorl %eax, %eax
callq 0x23e0
leaq 0x3cb0(%rip), %rsi      # 0x7a76
leaq 0x392e(%rip), %rcx      # 0x76fb
movq %r15, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x23e0
leaq 0x3ca3(%rip), %rsi      # 0x7a84
movq %r15, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x23e0
movq %r15, %rdi
callq 0x2130
movslq %eax, %r12
leaq 0x3a79(%rip), %rdx      # 0x7879
movq %rbx, %rdi
xorl %esi, %esi
movq %r12, %rcx
movl %r14d, %r8d
callq 0x3e58
movl (%rbx), %edi
movq %r15, %rsi
movq %r12, %rdx
callq 0x5877
testq %rax, %rax
jns 0x3e48
leaq 0x3750(%rip), %rsi      # 0x7579
leaq 0x3c65(%rip), %rdx      # 0x7a95
leaq 0x3894(%rip), %r8       # 0x76cb
movl $0x4, %edi
movl $0x1e2, %ecx            # imm = 0x1E2
xorl %eax, %eax
callq 0x252a
addq $0x1000, %rsp           # imm = 0x1000
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ttoobne[P]bohttpd/src/http/http.c
// Function: get_shortmsg
static char* get_shortmsg(unsigned status) {
    switch (status) {
    case HTTP_CONTINUE:
        return "Continue";

    case HTTP_OK:
        return "OK";

    case HTTP_MOVED_PERMANENTLY:
        return "Moved Permanently";

    case HTTP_MOVED_TEMPORARILY:
        return "Found";
        
    case HTTP_NOT_MODIFIED:
        return "Not Modified";
        
    case HTTP_BAD_REQUEST:
        return "Bad Request";
        
    case HTTP_FORBIDDEN:
        return "Forbidden";
        
    case HTTP_NOT_FOUND:
        return "Not Found";
    
    case HTTP_PRECONDITION_FAILED:
        return "Precondition Failed";
        
    case HTTP_INTERNAL_SERVER_ERROR:
        return "Internal Server Error";

    case HTTP_NOT_IMPLEMENTED:
        return "Not Implemented";

    case HTTP_VERSION_NOT_SUPPORTED:
        return "HTTP Version not supported";
    
    default:
        break;
    }

    return "";
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
cmpl $0x192, %edi            # imm = 0x192
jg 0x4179
cmpl $0x12d, %edi            # imm = 0x12D
jg 0x41ad
cmpl $0x64, %edi
je 0x41ef
cmpl $0xc8, %edi
je 0x4213
cmpl $0x12d, %edi            # imm = 0x12D
jne 0x4237
leaq 0x3657(%rip), %rax      # 0x77cb
jmp 0x423e
cmpl $0x1f3, %edi            # imm = 0x1F3
jg 0x41ce
cmpl $0x193, %edi            # imm = 0x193
je 0x41f8
cmpl $0x194, %edi            # imm = 0x194
je 0x421c
cmpl $0x19c, %edi            # imm = 0x19C
jne 0x4237
leaq 0x3662(%rip), %rax      # 0x780a
jmp 0x423e
cmpl $0x12e, %edi            # imm = 0x12E
je 0x4201
cmpl $0x130, %edi            # imm = 0x130
je 0x4225
cmpl $0x190, %edi            # imm = 0x190
jne 0x4237
leaq 0x361e(%rip), %rax      # 0x77ea
jmp 0x423e
cmpl $0x1f4, %edi            # imm = 0x1F4
je 0x420a
cmpl $0x1f5, %edi            # imm = 0x1F5
je 0x422e
cmpl $0x1f9, %edi            # imm = 0x1F9
jne 0x4237
leaq 0x3657(%rip), %rax      # 0x7844
jmp 0x423e
leaq 0x35c9(%rip), %rax      # 0x77bf
jmp 0x423e
leaq 0x35f7(%rip), %rax      # 0x77f6
jmp 0x423e
leaq 0x35fc(%rip), %rax      # 0x7804
jmp 0x423e
leaq 0x360d(%rip), %rax      # 0x781e
jmp 0x423e
leaq 0x35ae(%rip), %rax      # 0x77c8
jmp 0x423e
leaq 0x35dd(%rip), %rax      # 0x7800
jmp 0x423e
leaq 0x35b1(%rip), %rax      # 0x77dd
jmp 0x423e
leaq 0x35ff(%rip), %rax      # 0x7834
jmp 0x423e
leaq 0x3533(%rip), %rax      # 0x7771
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ttoobne[P]bohttpd/src/http/http_request.c
// Function: http_process_date
static int http_process_date(http_request_t* rq, http_headers_out_t* out, char* st, char* ed) {
    struct tm time;

    if (!strptime(st, "%a, %d %b %Y %H:%M:%S GMT", &time)) {
        log_error("date error.");
        return REQUEST_ERROR;
    }

    out->rtime = mktime(&time);

    return HTTP_OK;    
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x38, %rsp
movq %rdx, %rdi
movq %rsi, %rbx
leaq 0x2f4e(%rip), %rsi      # 0x7707
leaq -0x40(%rbp), %rdx
callq 0x2430
testq %rax, %rax
je 0x47db
leaq -0x40(%rbp), %rdi
callq 0x2310
movq %rax, 0x8(%rbx)
movl $0xc8, %eax
jmp 0x4806
leaq 0x3359(%rip), %rsi      # 0x7b3b
leaq 0x33dd(%rip), %rdx      # 0x7bc6
leaq 0x33e8(%rip), %r8       # 0x7bd8
movl $0x4, %edi
movl $0xc2, %ecx
xorl %eax, %eax
callq 0x252a
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x38, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ttoobne[P]bohttpd/src/http/http_request.c
// Function: http_process_if_modified_since
static int http_process_if_modified_since(http_request_t* rq, http_headers_out_t* out, char* st, char* ed) {
    struct tm time;
    time_t ims;

    if (!strptime(st, "%a, %d %b %Y %H:%M:%S GMT", &time)) {
        log_error("date error.");
        return REQUEST_ERROR;
    }

    ims = mktime(&time);

    if (ims < out->mtime) {
        out->if_modified = 1;   /* 返回 200 */
        out->status = HTTP_OK;
    } else {
        out->if_modified = 2;   /* 返回 304 */
        out->status = HTTP_NOT_MODIFIED;
    }

    return HTTP_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x38, %rsp
movq %rdx, %rdi
movq %rsi, %rbx
leaq 0x2ee4(%rip), %rsi      # 0x7707
leaq -0x40(%rbp), %rdx
callq 0x2430
testq %rax, %rax
je 0x485d
leaq -0x40(%rbp), %rdi
callq 0x2310
movl $0xcf, %ecx
andl (%rbx), %ecx
cmpq 0x10(%rbx), %rax
movl $0xc810, %eax           # imm = 0xC810
movl $0x13020, %edx          # imm = 0x13020
cmovll %eax, %edx
orl %ecx, %edx
movl %edx, (%rbx)
movl $0xc8, %eax
jmp 0x4888
leaq 0x32d7(%rip), %rsi      # 0x7b3b
leaq 0x3379(%rip), %rdx      # 0x7be4
leaq 0x3366(%rip), %r8       # 0x7bd8
movl $0x4, %edi
movl $0xd0, %ecx
xorl %eax, %eax
callq 0x252a
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x38, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ttoobne[P]bohttpd/src/http/http_request.c
// Function: http_process_if_unmodified_since
static int http_process_if_unmodified_since(http_request_t* rq, http_headers_out_t* out, char* st, char* ed) {
    struct tm time;
    time_t iums;

    if (strptime(st, "%a, %d %b %Y %H:%M:%S GMT", &time)) {
        log_error("date error.");
        return REQUEST_ERROR;
    }

    iums = mktime(&time);

    if (iums > out->mtime) {
        out->if_unmodified = 1; /* 返回 412 */
        out->status = HTTP_PRECONDITION_FAILED;
    }

    return HTTP_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x38, %rsp
movq %rdx, %rdi
movq %rsi, %rbx
leaq 0x2e62(%rip), %rsi      # 0x7707
leaq -0x40(%rbp), %rdx
callq 0x2430
testq %rax, %rax
je 0x48e0
leaq 0x3281(%rip), %rsi      # 0x7b3b
leaq 0x3342(%rip), %rdx      # 0x7c03
leaq 0x3310(%rip), %r8       # 0x7bd8
movl $0x4, %edi
movl $0xe6, %ecx
xorl %eax, %eax
callq 0x252a
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x4904
leaq -0x40(%rbp), %rdi
callq 0x2310
movq %rax, %rcx
movl $0xc8, %eax
cmpq 0x10(%rbx), %rcx
jle 0x4904
movl (%rbx), %ecx
andl $0x3f, %ecx
orl $0x19c40, %ecx          # imm = 0x19C40
movl %ecx, (%rbx)
addq $0x38, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ttoobne[P]bohttpd/src/http/http_request.c
// Function: http_request_init
http_request_t* http_request_init(int fd, epoll_t* epoll, config_t* config) {
    http_request_t* rq;

    if ((rq = (http_request_t*)malloc(sizeof(http_request_t))) == NULL) {
        log_error("http_request_t malloc failed.");
        return NULL;
    }

    rq->fd = fd;
    rq->epoll = epoll;
    rq->state = 0;
    rq->have_args = 0;
    rq->bufst = &(rq->buf[0]);
    rq->bufed = &(rq->buf[0]);
    rq->handler = http_process_request_line;    /* 初始时解析请求行 */
    rq->timer.timer_set = 0;
    rq->timer.handler = http_close_connection;  /* 定时器超时回调函数 */
    if (config) {
        rq->root = config->root;
        rq->defile = config->defile;
        rq->timeout = config->timeout;
    }
    
    init_list_head(&(rq->headers_list_head));   /* 初始化链表 */

    return rq;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %r14
movq %rsi, %r15
movl %edi, %r12d
movl $0x20f8, %edi           # imm = 0x20F8
callq 0x22d0
testq %rax, %rax
je 0x49b6
movq %rax, %rbx
movl %r12d, (%rax)
movq %r15, 0x8(%rax)
xorl %eax, %eax
movl %eax, 0x48(%rbx)
movl %eax, 0x50(%rbx)
leaq 0x98(%rbx), %rax
movq %rax, 0x2098(%rbx)
movq %rax, 0x20a0(%rbx)
leaq 0x8a(%rip), %rax        # 0x49ea
movq %rax, 0x20f0(%rbx)
andb $-0x2, 0x20e0(%rbx)
leaq -0x12fa(%rip), %rax     # 0x367b
movq %rax, 0x20d8(%rbx)
testq %r14, %r14
je 0x49a8
leaq 0x8(%r14), %rax
movq %rax, 0x88(%rbx)
leaq 0x108(%r14), %rax
movq %rax, 0x90(%rbx)
movq 0x208(%r14), %rax
movq %rax, 0x20e8(%rbx)
movq %rbx, %rdi
addq $0x58, %rdi
callq 0x4fdc
jmp 0x49de
leaq 0x317e(%rip), %rsi      # 0x7b3b
leaq 0x318f(%rip), %rdx      # 0x7b53
leaq 0x319a(%rip), %r8       # 0x7b65
xorl %ebx, %ebx
movl $0x4, %edi
movl $0x29, %ecx
xorl %eax, %eax
callq 0x252a
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ttoobne[P]bohttpd/src/http/http_request.c
// Function: http_process_request_line
static int http_process_request_line(http_request_t* rq) {
    int ret;

    if (rq->timer.timeout) {
        return REQUEST_TIMEOUT;
    }

    if ((ret = http_parse_request_line(rq)) == REQUEST_OK) {
        /* 当返回 REQUEST_OK 时，请求行已解析完毕，继续解析首部字段 */
        rq->handler = http_process_request_headers;
        return http_process_request_headers(rq);
    }
    
    return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl $0xfffffffd, %eax       # imm = 0xFFFFFFFD
testb $0x2, 0x20e0(%rdi)
jne 0x4a34
movq %rdi, %rbx
callq 0x4240
testl %eax, %eax
jne 0x4a34
leaq 0x161(%rip), %rax       # 0x4b72
movq %rax, 0x20f0(%rbx)
testb $0x2, 0x20e0(%rbx)
movl $0xfffffffd, %eax       # imm = 0xFFFFFFFD
jne 0x4a34
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x4543
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ttoobne[P]bohttpd/src/http/http_request.c
// Function: http_headers_out_init
http_headers_out_t* http_headers_out_init() {
    http_headers_out_t* out;

    if ((out = (http_headers_out_t*)malloc(sizeof(http_headers_out_t))) == NULL) {
        log_error("http_headers_out_t malloc failed.");
        return NULL;
    }

    out->keep_alive = 0;
    out->if_modified = 0;
    out->if_unmodified = 0;
    out->status = 0;

    return out;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl $0x18, %edi
callq 0x22d0
testq %rax, %rax
je 0x4a5b
movq %rax, %rbx
movl $0x0, (%rax)
jmp 0x4a83
leaq 0x30d9(%rip), %rsi      # 0x7b3b
leaq 0x311a(%rip), %rdx      # 0x7b83
leaq 0x3129(%rip), %r8       # 0x7b99
xorl %ebx, %ebx
movl $0x4, %edi
movl $0x48, %ecx
xorl %eax, %eax
callq 0x252a
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ttoobne[P]bohttpd/src/http/http_request.c
// Function: http_analyze_headers
int http_analyze_headers(http_request_t* rq, http_headers_out_t* out) {
    http_header_t* pos;
    list_head_t* head;
    list_head_t* now;
    list_head_t* next;
    http_headers_in_t* in;
    int len;

    /* 获取链表头 */
    head = &(rq->headers_list_head);

    /* 遍历链表中的每一个节点 */
    list_for_each_entry(pos, head, list_node) {
        /* 对于每一个节点循环判断与每一个字段名是否匹配 */
        len = pos->header_name_end - pos->header_name_start + 1;
        for (in = http_headers_in; strlen(in->name) > 0; ++ in) {
            /* 如果匹配，则执行相应处理函数 */
            if (!strncmp(in->name, pos->header_name_start, len)) {
                if (in->handler != NULL) {
                    in->handler(rq, out, pos->header_value_start, pos->header_value_end);
                }

                break;
            }
        }
    }

    /* 销毁链表中的所有节点 */
    now = head->next;
    while (now != head) {
        next = now->next;
        pos = list_entry(now, http_header_t, list_node);

        list_del(now);
        free(pos);
        pos = NULL;

        now = next;
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, -0x38(%rbp)
leaq 0x58(%rdi), %r13
movq %rdi, -0x30(%rbp)
movq 0x60(%rdi), %r14
cmpq %r13, %r14
je 0x4b14
movq 0x67b6(%rip), %rdi      # 0xb270
cmpb $0x0, (%rdi)
je 0x4b0e
movq 0x10(%r14), %r15
movl 0x18(%r14), %eax
subl %r15d, %eax
incl %eax
movslq %eax, %r12
leaq 0x67aa(%rip), %rbx      # 0xb280
movq %r15, %rsi
movq %r12, %rdx
callq 0x2070
testl %eax, %eax
je 0x4af3
movq (%rbx), %rdi
addq $0x10, %rbx
cmpb $0x0, (%rdi)
jne 0x4ad6
jmp 0x4b0e
movq -0x8(%rbx), %rax
testq %rax, %rax
je 0x4b0e
movq 0x20(%r14), %rdx
movq 0x28(%r14), %rcx
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq *%rax
movq 0x8(%r14), %r14
jmp 0x4aae
movq -0x30(%rbp), %rax
movq 0x60(%rax), %rbx
cmpq %r13, %rbx
je 0x4b3d
movq 0x8(%rbx), %r14
movq %rbx, %rdi
callq 0x5038
movq %rbx, %rdi
callq 0x2030
movq %r14, %rbx
cmpq %r13, %r14
jne 0x4b21
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ttoobne[P]bohttpd/src/http/http_timer.c
// Function: init_timer
int init_timer() {
    /* 初始化的主要工作就是初始化一颗红黑树 */
    if (rbtree_init(&timer_rbtree, &timer_nil, rbtree_insert_timer) != 0) {
        log_error("rbtree init error.");
        return -1;
    }

    /* 初始化互斥锁，用于多线程使用定时器的同步操作 */
    if (pthread_mutex_init(&timer_mutex, NULL) != 0) {
        log_error("timer mutex init failed.");
        return -1;
    }

    /* 初始化 current_msec ，可做可不做 */
    if (update_current_msec() != 0) {
        log_error("get current time error.");
        return -1;
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq 0x673f(%rip), %rdi      # 0xb2d8
leaq 0x6750(%rip), %rsi      # 0xb2f0
leaq 0x69d(%rip), %rdx       # 0x5244
callq 0x5068
testl %eax, %eax
je 0x4bd1
leaq 0x306d(%rip), %rsi      # 0x7c24
leaq 0x307c(%rip), %rdx      # 0x7c3a
leaq 0x3080(%rip), %r8       # 0x7c45
movl $0x4, %edi
movl $0x1c, %ecx
jmp 0x4c2e
leaq 0x6748(%rip), %rdi      # 0xb320
xorl %ebx, %ebx
xorl %esi, %esi
callq 0x2440
testl %eax, %eax
je 0x4c06
leaq 0x3038(%rip), %rsi      # 0x7c24
leaq 0x3047(%rip), %rdx      # 0x7c3a
leaq 0x305e(%rip), %r8       # 0x7c58
movl $0x4, %edi
movl $0x22, %ecx
jmp 0x4c2e
callq 0x4f86
testl %eax, %eax
je 0x4c3a
leaq 0x300e(%rip), %rsi      # 0x7c24
leaq 0x301d(%rip), %rdx      # 0x7c3a
leaq 0x304d(%rip), %r8       # 0x7c71
movl $0x4, %edi
movl $0x28, %ecx
xorl %eax, %eax
callq 0x252a
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ttoobne[P]bohttpd/src/http/http_timer.c
// Function: expire_timers
int expire_timers() {
    rbtree_node_t* node;
    http_timer_t* timer;
    http_request_t* ev;

    //while (timer_rbtree.root != &timer_nil) {
    for ( ;; ) {
        //DBG("expire timer pid:%u ready to lock\n", pthread_self());
        pthread_mutex_lock(&timer_mutex);

        //DBG("expire timer pid:%u locked\n", pthread_self());
        
        /* 定时器为空，即红黑树为空 */
        if (timer_rbtree.root == &timer_nil) {
            break;
        }

        /* 获取红黑树中最左边的节点即键最小的节点 */
        if ((node = rbtree_get_min(&timer_rbtree)) == NULL) {
            log_error("get min failed.");
            pthread_mutex_unlock(&timer_mutex);
            return -1;
        }

        update_current_msec();

        /* 计算是否超时 */
        if ((msec_int_t)(node->key - current_msec) <= 0) {
            /* 如果超时 */
            /* 删除红黑树中的节点 */
            rbtree_delete(&timer_rbtree, node);

            pthread_mutex_unlock(&timer_mutex);


            /* 通过偏移量获取 timer 指针 */
            timer = (http_timer_t*) ((char*)node - offsetof(http_timer_t, timer_node));

            /* 标记红黑树中已经不监控该事件 */
            timer->timer_set = 0;

            /* 通过偏移量获取事件指针 */
            ev = (http_request_t*) ((char*)timer - offsetof(http_request_t, timer));
            
            /* 标记事件已超时 */
            timer->timeout = 1;

            /* 执行回调函数 */
            if (timer->handler) {
                timer->handler((void*)ev);
            }

            continue;
        }


        break;
    }

    pthread_mutex_unlock(&timer_mutex);

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x6654(%rip), %rdi      # 0xb320
callq 0x2480
movq 0x6600(%rip), %rax      # 0xb2d8
xorl %ebx, %ebx
leaq 0x660f(%rip), %r13      # 0xb2f0
cmpq %r13, %rax
je 0x4d95
leaq 0x65e7(%rip), %r14      # 0xb2d8
leaq 0x6628(%rip), %r15      # 0xb320
movq %r14, %rdi
callq 0x50b0
testq %rax, %rax
je 0x4d6a
movq %rax, %r12
callq 0x4f86
movq (%r12), %rax
subq 0x6630(%rip), %rax      # 0xb348
testq %rax, %rax
jg 0x4d95
movq %r14, %rdi
movq %r12, %rsi
callq 0x5483
movq %r15, %rdi
callq 0x22b0
movb 0x38(%r12), %al
andb $-0x4, %al
orb $0x2, %al
movb %al, 0x38(%r12)
movq 0x30(%r12), %rax
testq %rax, %rax
je 0x4d54
addq $-0x20a8, %r12          # imm = 0xDF58
movq %r12, %rdi
callq *%rax
movq %r15, %rdi
callq 0x2480
movq 0x6575(%rip), %rax      # 0xb2d8
cmpq %r13, %rax
jne 0x4cf8
jmp 0x4d95
leaq 0x2eb3(%rip), %rsi      # 0x7c24
leaq 0x2f11(%rip), %rdx      # 0x7c89
leaq 0x2f18(%rip), %r8       # 0x7c97
movl $0x4, %edi
movl $0x78, %ecx
xorl %eax, %eax
callq 0x252a
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
leaq 0x6584(%rip), %rdi      # 0xb320
callq 0x22b0
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ttoobne[P]bohttpd/src/http/http_timer.c
// Function: add_timer
int add_timer(void* http_request, msec_t timeout, timer_handler_t* handler) {
    http_request_t* ev;
    http_timer_t* timer;

    if (http_request == NULL) {
        log_error("event ptr is NULL.");
        return -1;
    }

    if (timeout <= 0) {
        log_error("timeout is invalid.");
        return -1;
    }

    ev = (http_request_t*)http_request;
    timer = &(ev->timer);

    if (timer->timer_set) {
        /* 如果定时器已被设置，则先删除再添加 */
        //log_debug("delete timer first?");
        delete_timer(ev);
    }

    /* 设置标记位和回调函数 */
    timer->timer_set = 1;
    timer->timeout = 0;
    timer->handler = handler;

    update_current_msec();

    /* 设置超时时间 */
    timer->timer_node.key = current_msec + timeout;

    pthread_mutex_lock(&timer_mutex);

    /* 向红黑树中插入节点 */
    //log_debug("ready to insert:%d", timer->timer_node.key);
    if (rbtree_insert(&timer_rbtree, &(timer->timer_node)) != 0) {
        log_error("rbtree insert failed.");
        pthread_mutex_unlock(&timer_mutex);
        return -1;
    }

    pthread_mutex_unlock(&timer_mutex);

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
testq %rdi, %rdi
je 0x4e73
movq %rsi, %rbx
testq %rsi, %rsi
je 0x4e94
movq %rdx, %r12
movq %rdi, %r15
leaq 0x20a8(%rdi), %r14
testb $0x1, 0x20e0(%rdi)
je 0x4df0
movq %r15, %rdi
callq 0x4ed8
movb 0x20e0(%r15), %al
andb $-0x4, %al
incb %al
movb %al, 0x20e0(%r15)
movq %r12, 0x20d8(%r15)
callq 0x4f86
addq 0x6533(%rip), %rbx      # 0xb348
movq %rbx, 0x20a8(%r15)
leaq 0x64fd(%rip), %rdi      # 0xb320
callq 0x2480
leaq 0x64a9(%rip), %rdi      # 0xb2d8
movq %r14, %rsi
callq 0x5280
testl %eax, %eax
je 0x4ec8
leaq 0x2dde(%rip), %rsi      # 0x7c24
leaq 0x2e5a(%rip), %rdx      # 0x7ca7
leaq 0x2e84(%rip), %r8       # 0x7cd8
movl $0x4, %edi
movl $0xce, %ecx
xorl %eax, %eax
callq 0x252a
leaq 0x64b4(%rip), %rdi      # 0xb320
callq 0x22b0
jmp 0x4eba
leaq 0x2daa(%rip), %rsi      # 0x7c24
leaq 0x2e26(%rip), %rdx      # 0x7ca7
leaq 0x2e29(%rip), %r8       # 0x7cb1
movl $0x4, %edi
movl $0xad, %ecx
jmp 0x4eb3
leaq 0x2d89(%rip), %rsi      # 0x7c24
leaq 0x2e05(%rip), %rdx      # 0x7ca7
leaq 0x2e1b(%rip), %r8       # 0x7cc4
movl $0x4, %edi
movl $0xb2, %ecx
xorl %eax, %eax
callq 0x252a
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x6451(%rip), %rdi      # 0xb320
callq 0x22b0
xorl %eax, %eax
jmp 0x4ebf
// File: /workspace/github_c_makefile_star2_O1/ttoobne[P]bohttpd/src/http/http_timer.c
// Function: delete_timer
int delete_timer(void* http_request) {
    http_request_t* ev;

    if (http_request == NULL) {
        log_error("event ptr is NULL.");
        return -1;
    }

    ev = (http_request_t*)http_request;

    pthread_mutex_lock(&timer_mutex);

    /* 删除红黑树中的节点 */
    //log_debug("ready to delete:%d", (ev->timer).timer_node.key);
    if (rbtree_delete(&timer_rbtree, &((ev->timer).timer_node)) != 0) {
        log_error("delete rbtree node failed.");
        pthread_mutex_unlock(&timer_mutex);
        return -1;
    }

    pthread_mutex_unlock(&timer_mutex);

    /* 标记红黑树中已经不监控该事件 */
    (ev->timer).timer_set = 0;

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x4f3d
movq %rdi, %rbx
leaq 0x6433(%rip), %rdi      # 0xb320
callq 0x2480
leaq 0x20a8(%rbx), %rsi
leaq 0x63d8(%rip), %rdi      # 0xb2d8
callq 0x5483
testl %eax, %eax
je 0x4f6a
leaq 0x2d14(%rip), %rsi      # 0x7c24
leaq 0x2dd7(%rip), %rdx      # 0x7cee
leaq 0x2ddd(%rip), %r8       # 0x7cfb
movl $0x4, %edi
movl $0xea, %ecx
xorl %eax, %eax
callq 0x252a
leaq 0x63ea(%rip), %rdi      # 0xb320
callq 0x22b0
jmp 0x4f63
leaq 0x2ce0(%rip), %rsi      # 0x7c24
leaq 0x2da3(%rip), %rdx      # 0x7cee
leaq 0x2d5f(%rip), %r8       # 0x7cb1
movl $0x4, %edi
movl $0xdf, %ecx
xorl %eax, %eax
callq 0x252a
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x4f7f
leaq 0x63af(%rip), %rdi      # 0xb320
callq 0x22b0
andb $-0x2, 0x20e0(%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ttoobne[P]bohttpd/src/core/list.c
// Function: _list_add
void __list_add(list_head_t* new, list_head_t* prev, list_head_t* next) {
    next->prev = new;
    new->next = next;
    new->prev = prev;
    prev->next = new;

    return ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, (%rdx)
movq %rdx, 0x8(%rdi)
movq %rsi, (%rdi)
movq %rdi, 0x8(%rsi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ttoobne[P]bohttpd/src/core/list.c
// Function: list_del
void list_del(list_head_t* entry) {
    __list_del(entry->prev, entry->next);

    entry->next = (void*) 0;
    entry->prev = (void*) 0;

    return ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq (%rdi), %rax
movq 0x8(%rdi), %rcx
movq %rax, (%rcx)
movq %rcx, 0x8(%rax)
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ttoobne[P]bohttpd/src/core/rbtree.c
// Function: rbtree_init
int rbtree_init(volatile rbtree_t* tree, rbtree_node_t* nil, rbtree_insert_func* insert) {
    if (tree == NULL) {
        log_error("rbtree ptr is NULL.");
        return -1;
    }

    rbtree_dye_black(nil);
    tree->root = nil;
    tree->nil = nil;
    tree->insert = insert;

    return 0;
}

// Assembly:
testq %rdi, %rdi
je 0x507f
movb $0x0, 0x8(%rsi)
movq %rsi, (%rdi)
movq %rsi, 0x8(%rdi)
movq %rdx, 0x10(%rdi)
xorl %eax, %eax
retq
pushq %rbp
movq %rsp, %rbp
leaq 0x2d3a(%rip), %rsi      # 0x7dc4
leaq 0x2d45(%rip), %rdx      # 0x7dd6
leaq 0x2d4a(%rip), %r8       # 0x7de2
movl $0x4, %edi
movl $0x16, %ecx
xorl %eax, %eax
callq 0x252a
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ttoobne[P]bohttpd/src/core/rbtree.c
// Function: rbtree_get_min
rbtree_node_t* rbtree_get_min(volatile rbtree_t* tree) {
    rbtree_node_t* node;
    rbtree_node_t* nil;

    if (tree == NULL) {
        log_error("rbtree ptr is NULL.");
        return NULL;
    }
    
    node = tree->root;
    nil = tree->nil;

    if (node == nil) {
        return NULL;
    }

    while (node->left_son != nil) {
        node = node->left_son;
    }

    return node;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x50d5
movq (%rdi), %rcx
movq 0x8(%rdi), %rax
cmpq %rax, %rcx
je 0x50ff
movq %rcx, %rbx
movq 0x10(%rcx), %rcx
cmpq %rax, %rcx
jne 0x50c7
jmp 0x5101
leaq 0x2ce8(%rip), %rsi      # 0x7dc4
leaq 0x2d13(%rip), %rdx      # 0x7df6
leaq 0x2cf8(%rip), %r8       # 0x7de2
xorl %ebx, %ebx
movl $0x4, %edi
movl $0x2a, %ecx
xorl %eax, %eax
callq 0x252a
jmp 0x5101
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ttoobne[P]bohttpd/src/core/rbtree.c
// Function: rbtree_find
rbtree_node_t* rbtree_find(volatile rbtree_t* tree, rbtree_key_t key) {
    rbtree_node_t* now;
    rbtree_node_t* nil;
    rbtree_insert_func* insert;

    if (tree == NULL) {
        log_error("rbtree ptr is NULL.");
        return NULL;
    }

    now = tree->root;
    nil = tree->nil;
    insert = tree->insert;

    while (now != nil) {
        /* 通过有符号数比较进行的查找方式 */
        if (insert == rbtree_insert_value) {
            if ((rbtree_key_int_t)key < (rbtree_key_int_t)now->key) {
                now = now->left_son;
            } else if ((rbtree_key_int_t)key > (rbtree_key_int_t)now->key) {
                now = now->right_son;
            } else {
                return now;
            }
        } else if (insert == rbtree_insert_uvalue) {
            /* 通过无符号数比较进行的查找方式 */
            if (key < now->key) {
                now = now->left_son;
            } else if (key > now->key) {
                now = now->right_son;
            } else {
                return now;
            }
        } else if (insert == rbtree_insert_timer) {
            /* timer 的查找方式 */
            if ((rbtree_key_int_t)(key - now->key) < 0) {
                now = now->left_son;
            } else if ((rbtree_key_int_t)(key - now->key) > 0) {
                now = now->right_son;
            } else {
                return now;
            }
        }
    }

    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x519a
movq (%rdi), %rbx
movq 0x8(%rdi), %rax
movq 0x10(%rdi), %rcx
cmpq %rax, %rbx
je 0x5196
leaq 0x9b(%rip), %rdx        # 0x51cc
leaq 0xd0(%rip), %rdi        # 0x5208
leaq 0x105(%rip), %r8        # 0x5244
cmpq %rdx, %rcx
je 0x515d
cmpq %rdi, %rcx
je 0x5172
cmpq %r8, %rcx
jne 0x5191
cmpq (%rbx), %rsi
js 0x5187
movl $0x18, %r9d
jne 0x518d
jmp 0x51c2
movl $0x10, %r9d
cmpq %rsi, (%rbx)
jg 0x518d
movl $0x18, %r9d
jl 0x518d
jmp 0x51c2
movl $0x10, %r9d
cmpq %rsi, (%rbx)
ja 0x518d
movl $0x18, %r9d
jb 0x518d
jmp 0x51c2
movl $0x10, %r9d
movq (%rbx,%r9), %rbx
cmpq %rax, %rbx
jne 0x513f
xorl %ebx, %ebx
jmp 0x51c2
leaq 0x2c23(%rip), %rsi      # 0x7dc4
leaq 0x2c5d(%rip), %rdx      # 0x7e05
leaq 0x2c33(%rip), %r8       # 0x7de2
xorl %ebx, %ebx
movl $0x4, %edi
movl $0x52, %ecx
xorl %eax, %eax
callq 0x252a
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ttoobne[P]bohttpd/src/core/rio.c
// Function: rio_readn
ssize_t rio_readn(int fd, void* usrbuf, size_t* n) {
    size_t nleft = *n;              /* 剩余多少字节未读 */
    ssize_t nread;
    char* bufp = (char*)usrbuf;     /* 读到 usrbuf 的位置 */
    
    while (nleft > 0) {
        if ((nread = read(fd, bufp, nleft)) < 0) {
            if (errno != EINTR) {   /* 当 read 被中断则忽略，否则返回错误 */
                *n = *n - nleft;
                return -1;
            }
        } else if (nread == 0) {    /* 读到 EOF */
            break;
        } else {
            bufp += nread;
            nleft -= nread;
        }
    }
    return (*n - nleft);            /* 返回读了多少字节 */
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq (%rdx), %r14
testq %r14, %r14
je 0x585c
movq %rsi, %r15
movl %edi, %r12d
movl %r12d, %edi
movq %r15, %rsi
movq %r14, %rdx
callq 0x2200
testq %rax, %rax
js 0x584d
je 0x585c
addq %rax, %r15
subq %rax, %r14
jmp 0x5857
callq 0x2050
cmpl $0x4, (%rax)
jne 0x586b
testq %r14, %r14
jne 0x5830
movq (%rbx), %rax
subq %r14, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
subq %r14, (%rbx)
movq $-0x1, %rax
jmp 0x5862
// File: /workspace/github_c_makefile_star2_O1/ttoobne[P]bohttpd/src/core/rio.c
// Function: rio_writen
ssize_t rio_writen(int fd, void* usrbuf, size_t n) {
    size_t nleft = n;       /* 剩余多少字节未写 */
    ssize_t nwrite;       
    char* bufp = usrbuf;    /* 从 usrbuf 写的位置 */

    while (nleft > 0) {
        if ((nwrite = write(fd, bufp, nleft)) <= 0) {
            if (errno != EINTR && errno != EAGAIN) {   /* 当 write 被中断则忽略，否则返回错误 */
                return -1;
            }
        } else {
            bufp += nwrite;
            nleft -= nwrite;
        }
    }
    return n;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %rbx
testq %rdx, %rdx
je 0x58c4
movq %rsi, %r14
movl %edi, %r15d
movq %rbx, %r12
movl %r15d, %edi
movq %r14, %rsi
movq %r12, %rdx
callq 0x20f0
testq %rax, %rax
jle 0x58ae
addq %rax, %r14
subq %rax, %r12
jmp 0x58bf
callq 0x2050
movl (%rax), %eax
cmpl $0x4, %eax
je 0x58bf
cmpl $0xb, %eax
jne 0x58d0
testq %r12, %r12
jne 0x5893
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq $-0x1, %rbx
jmp 0x58c4
// File: /workspace/github_c_makefile_star2_O1/ttoobne[P]bohttpd/src/core/rio.c
// Function: rio_readn_buf
ssize_t	rio_readn_buf(rio_t* rp, void* usrbuf, size_t n) {
    size_t nleft = n;       /* 剩余多少字节未读 */
    ssize_t nread;
    char* bufp = usrbuf;    /* 读到 usrbuf 的位置 */

    while (nleft > 0) {
        if ((nread = rio_read(rp, bufp, nleft)) < 0) {
            return -1;
        } else if (nread == 0) {
            return 0;       /* 读到 EOF，返回 0 */
        } else {
            bufp += nread;
            nleft -= nread;
        }
    }
    return (n - nleft);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %rbx
testq %rdx, %rdx
je 0x5937
movq %rsi, %r14
movq %rdi, %r15
movq %rbx, %r12
movq %r15, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x5943
testq %rax, %rax
js 0x592c
je 0x5935
addq %rax, %r14
subq %rax, %r12
jne 0x590d
jmp 0x5937
movq $-0x1, %rbx
jmp 0x5937
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ttoobne[P]bohttpd/src/core/rio.c
// Function: rio_read
static ssize_t rio_read(rio_t* rp, char* usrbuf, size_t n) {
    size_t cnt;

    while (rp->rio_unread <= 0) {   /* 当内部缓冲区没有内容可读时 */
        if ((rp->rio_unread = read(rp->rio_fd, rp->rio_buf, sizeof rp->rio_buf)) < 0) {
            if (errno != EINTR) {   /* 当 read 被中断则忽略，否则返回错误 */
                return -1;
            }
        } else if (rp->rio_unread == 0) {
            return 0;               /* 读到 EOF，返回 0 */
        } else {
            rp->rio_bufptr = rp->rio_buf;
        }
    }
    
    cnt = rp->rio_unread < n ? rp->rio_unread : n;  /* 实际读到的字节数 */
    memcpy(usrbuf, rp->rio_bufptr, cnt);
    rp->rio_bufptr += cnt;
    rp->rio_unread -= cnt;
    return cnt;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movq 0x8(%rdi), %rax
testq %rax, %rax
jg 0x5998
leaq 0x18(%r14), %r12
movl (%r14), %edi
movl $0x2000, %edx           # imm = 0x2000
movq %r12, %rsi
callq 0x2200
movq %rax, 0x8(%r14)
testq %rax, %rax
js 0x5985
je 0x59c2
movq %r12, 0x10(%r14)
jmp 0x598f
callq 0x2050
cmpl $0x4, (%rax)
jne 0x59c6
movq 0x8(%r14), %rax
testq %rax, %rax
jle 0x5964
cmpq %rbx, %rax
cmovbq %rax, %rbx
movq 0x10(%r14), %rsi
movq %r15, %rdi
movq %rbx, %rdx
callq 0x2280
addq %rbx, 0x10(%r14)
subq %rbx, 0x8(%r14)
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
xorl %ebx, %ebx
jmp 0x59b6
movq $-0x1, %rbx
jmp 0x59b6
// File: /workspace/github_c_makefile_star2_O1/ttoobne[P]bohttpd/src/core/rio.c
// Function: rio_readline_buf
ssize_t	rio_readline_buf(rio_t* rp, void* usrbuf, size_t maxlen) {
    size_t n, rc;
    char c;
    char* bufp = usrbuf;

    for (n = 1; n <= maxlen; ++ n) {
        if ((rc = rio_read(rp, &c, 1)) == 1) {
            *bufp ++ = c;
            if (c == '\n') {        /* 读到换行符 */ 
                n ++ ;
                break;
            }
        } else if (rc == 0) {       /* 读到 EOF */
            break;
        } else {
            return -1;
        }
    }
    *bufp = '\0';
    return (n - 1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
testq %rdx, %rdx
je 0x5a21
movq %rdx, %r15
movq %rdi, %r12
movl $0x1, %ebx
leaq -0x29(%rbp), %r13
movl $0x1, %edx
movq %r12, %rdi
movq %r13, %rsi
callq 0x5943
cmpq $0x1, %rax
jne 0x5a25
movb -0x29(%rbp), %al
movb %al, (%r14)
incq %r14
cmpb $0xa, %al
je 0x5a2d
incq %rbx
cmpq %r15, %rbx
jbe 0x59f4
jmp 0x5a2a
xorl %ebx, %ebx
jmp 0x5a2d
testq %rax, %rax
jne 0x5a43
decq %rbx
movb $0x0, (%r14)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq $-0x1, %rbx
jmp 0x5a31
// File: /workspace/github_c_makefile_star2_O1/ttoobne[P]bohttpd/src/core/threadpool.c
// Function: threadpool_worker
static void* threadpool_worker(void* threadpool) {

    threadpool_t* pool = (threadpool_t*)threadpool;
    threadpool_task_t task;

    for ( ;; ) {
        /* 获取互斥锁 */
        pthread_mutex_lock(&(pool->lock_mutex));

        /* 当任务队列中任务数为空，工作线程阻塞在 nempty_cond 上 */
        while ((pool->task_num == 0) && (!pool->shutdown)) {
            pthread_cond_wait(&(pool->nempty_cond), &(pool->lock_mutex));
        }
        
        /* 若线程池关闭，则线程终止 */
        if (pool->shutdown) {
            break;
        }

        /* 从任务队列首部取任务 */
        task.func = pool->task_queue[pool->task_queue_front].func;
        task.args = pool->task_queue[pool->task_queue_front].args;
        
        /* 循环队列 */
        pool->task_queue_front = (pool->task_queue_front + 1) % pool->task_queue_size;
        pool->task_num -- ;

        /* 取完任务则广播任务队列未满条件 */
        pthread_cond_broadcast(&(pool->nfull_cond));
        /* 解开互斥锁 */
        pthread_mutex_unlock(&(pool->lock_mutex));

        /* 执行任务 */
        (*(task.func))(task.args);
    }

    /* 终止线程 */
    pool->thread_running -- ;
    pthread_mutex_unlock(&(pool->lock_mutex));
    pthread_exit(NULL);

    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
leaq 0x30(%rdi), %rbx
leaq 0x88(%rdi), %r15
leaq 0x58(%rdi), %rax
movq %rax, -0x30(%rbp)
movq %rbx, %rdi
callq 0x2480
movl 0x24(%r14), %ecx
testl %ecx, %ecx
jne 0x5c8a
cmpl $0x0, 0x28(%r14)
jne 0x5c8a
movq %r15, %rdi
movq %rbx, %rsi
callq 0x2110
jmp 0x5c6e
cmpl $0x0, 0x28(%r14)
jne 0x5cd1
movq 0x8(%r14), %rdx
movslq 0x1c(%r14), %rsi
leal 0x1(%rsi), %eax
shlq $0x4, %rsi
movq (%rdx,%rsi), %r12
movq 0x8(%rdx,%rsi), %r13
cltd
idivl 0x18(%r14)
movl %edx, 0x1c(%r14)
decl %ecx
movl %ecx, 0x24(%r14)
movq -0x30(%rbp), %rdi
callq 0x20a0
movq %rbx, %rdi
callq 0x22b0
movq %r13, %rdi
callq *%r12
jmp 0x5c66
decl 0x14(%r14)
movq %rbx, %rdi
callq 0x22b0
xorl %edi, %edi
callq 0x22c0
// File: /workspace/github_c_makefile_star2_O1/ttoobne[P]bohttpd/src/core/threadpool.c
// Function: threadpool_free
static int threadpool_free(threadpool_t* threadpool) {
    if (threadpool == NULL) {
        return -1;
    }

    /* 释放线程 tid 数组空间 */
    if (threadpool->threads) {
        free(threadpool->threads);
        threadpool->threads = NULL;

        /* 由于初始化互斥量和条件变量在 threads 之前，所以此处一定已经初始化成功 */
        pthread_mutex_lock(&(threadpool->lock_mutex));
        pthread_mutex_destroy(&(threadpool->lock_mutex));
        pthread_cond_destroy(&(threadpool->nfull_cond));
        pthread_cond_destroy(&(threadpool->nempty_cond));
    }

    /* 释放任务队列空间 */
    if (threadpool->task_queue) {
        free(threadpool->task_queue);
        threadpool->task_queue = NULL;
    }

    /* 释放线程池空间 */
    free(threadpool);
    threadpool = NULL;

    return 0;
}

// Assembly:
testq %rdi, %rdi
je 0x5d55
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x5d30
callq 0x2030
movq $0x0, (%rbx)
leaq 0x30(%rbx), %r14
movq %r14, %rdi
callq 0x2480
movq %r14, %rdi
callq 0x2170
leaq 0x58(%rbx), %rdi
callq 0x2370
leaq 0x88(%rbx), %rdi
callq 0x2370
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x5d46
callq 0x2030
movq $0x0, 0x8(%rbx)
movq %rbx, %rdi
callq 0x2030
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
// File: /workspace/github_c_makefile_star2_O1/ttoobne[P]bohttpd/src/core/threadpool.c
// Function: threadpool_add_task
int threadpool_add_task(threadpool_t* threadpool, task_function_t* func, void* args) {
    if (threadpool == NULL || func == NULL) {
        log_error("arguments invalid.");
        return -1;
    }

    /* 加锁 */
    pthread_mutex_lock(&(threadpool->lock_mutex));

    /* 如果任务队列中任务已满，则阻塞在条件 nfull_cond 上 */
    while ((threadpool->task_num == threadpool->task_queue_size) && (!threadpool->shutdown)) {
        pthread_cond_wait(&(threadpool->nfull_cond), &(threadpool->lock_mutex));
    }

    /* 如果线程池已经关闭 */
    if (threadpool->shutdown) {
        pthread_mutex_unlock(&(threadpool->lock_mutex));
        log_error("threadpool already shutdown.");
        return -1;
    }

    /* 添加任务到任务队列尾部 */
    threadpool->task_queue[threadpool->task_queue_rear].func = func;
    threadpool->task_queue[threadpool->task_queue_rear].args = args;
    threadpool->task_queue_rear = (threadpool->task_queue_rear + 1) % threadpool->task_queue_size;
    threadpool->task_num ++ ;

    /* 通知一个阻塞在 nempty_cond 上的线程并解锁互斥锁 */
    pthread_cond_signal(&(threadpool->nempty_cond));
    pthread_mutex_unlock(&(threadpool->lock_mutex));

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
setne %al
testq %rsi, %rsi
setne %cl
testb %cl, %al
jne 0x5d9a
leaq 0x210d(%rip), %rsi      # 0x7e8d
leaq 0x21ca(%rip), %rdx      # 0x7f51
leaq 0x2127(%rip), %r8       # 0x7eb5
movl $0x4, %edi
movl $0x8b, %ecx
jmp 0x5e0b
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %rbx
leaq 0x30(%rdi), %r14
movq %r14, %rdi
callq 0x2480
movl 0x18(%rbx), %esi
movl 0x24(%rbx), %ecx
cmpl %esi, %ecx
jne 0x5dde
cmpl $0x0, 0x28(%rbx)
jne 0x5dde
leaq 0x58(%rbx), %r13
movq %r13, %rdi
movq %r14, %rsi
callq 0x2110
movl 0x18(%rbx), %esi
movl 0x24(%rbx), %ecx
cmpl %esi, %ecx
jne 0x5dde
cmpl $0x0, 0x28(%rbx)
je 0x5dc3
cmpl $0x0, 0x28(%rbx)
je 0x5e26
movq %r14, %rdi
callq 0x22b0
leaq 0x209a(%rip), %rsi      # 0x7e8d
leaq 0x2157(%rip), %rdx      # 0x7f51
leaq 0x2164(%rip), %r8       # 0x7f65
movl $0x4, %edi
movl $0x9a, %ecx
xorl %eax, %eax
callq 0x252a
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%rbx), %rdx
movslq 0x20(%rbx), %rdi
leal 0x1(%rdi), %eax
shlq $0x4, %rdi
movq %r12, (%rdx,%rdi)
movq %r15, 0x8(%rdx,%rdi)
cltd
idivl %esi
movl %edx, 0x20(%rbx)
incl %ecx
movl %ecx, 0x24(%rbx)
addq $0x88, %rbx
movq %rbx, %rdi
callq 0x2220
movq %r14, %rdi
callq 0x22b0
xorl %eax, %eax
jmp 0x5e17