LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/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
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl 0x10(%rdi), %edx
leaq 0x12b6d(%rip), %r14     # 0x16384
leal 0x8c03(%rip), %ebp      # 0xc420
movl (%r14), %edi
movl $0x2, %esi
xorl %ecx, %ecx
callq 0x2220
movl 0x10(%rbx), %edi
callq 0x21e0
movl %ebx, %eax
subl %ebp, %eax
btl $0x3, %eax
movq (%rbx), %rdi
jb 0x3868
callq 0x2030
movq 0x8(%rbx), %rdi
callq 0x2030
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
movups %xmm0, (%rbx)
movq $0x0, 0x20(%rbx)
movl $0x28, %eax
jmp 0x387d
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rbx)
movups %xmm0, 0x8(%rbx)
movq %rdi, (%rbx)
movq $-0x28, %rax
movl $0xffffffff, 0x10(%rbx) # imm = 0xFFFFFFFF
movl 0x10(%rbx,%rax), %edx
addq %rax, %rbx
testl %edx, %edx
jns 0x381d
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 %rbx
movq %rdi, %rbx
movl 0x38(%rdi), %edi
movq (%rbx), %rsi
movslq 0x14(%rbx), %rdx
callq 0x20e0
cmpl %eax, 0x14(%rbx)
jne 0x38bc
movl $0x0, 0x14(%rbx)
movq $0x0, (%rbx)
popq %rbx
retq
addq $0x28, %rbx
movq %rbx, %rdi
popq %rbx
jmp 0x3806
// File: /workspace/github_c_makefile_star2_O3/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 %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq -0x28(%rdi), %r14
movl 0x10(%rbx), %edi
movq (%rbx), %rsi
movl $0x2000, %edx           # imm = 0x2000
callq 0x2240
movl %eax, 0x14(%rbx)
testl %eax, %eax
jle 0x3e00
movq (%rbx), %rcx
movb 0x1589d(%rip), %dl      # 0x19664
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
incq %rax
xorb %dl, -0x2(%rcx,%rax)
decq %rax
cmpq $0x1, %rax
ja 0x3dcf
movl -0x18(%rbx), %edi
movq (%rbx), %rsi
movslq 0x14(%rbx), %rdx
callq 0x20e0
movq %rax, %rcx
testl %ecx, %ecx
jle 0x3e1d
movl 0x14(%rbx), %eax
cmpl %ecx, %eax
jg 0x3e47
cmpl $0x1fff, %eax           # imm = 0x1FFF
jg 0x3da7
testl %eax, %eax
je 0x3e38
cmpl $-0x1, %eax
jne 0x3e13
callq 0x2050
cmpl $0xb, (%rax)
jne 0x3e38
xorl %eax, %eax
movl %eax, 0x1c(%rbx)
movl %eax, 0x14(%rbx)
jmp 0x3e30
je 0x3e38
callq 0x2050
cmpl $0xb, (%rax)
jne 0x3e38
movl $0x0, 0x1c(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3806
movl %ecx, 0x1c(%rbx)
leaq 0x1253b(%rip), %rcx     # 0x1638c
movl $0x80000005, (%rcx)     # imm = 0x80000005
movq %r14, 0x4(%rcx)
leaq 0x12522(%rip), %rax     # 0x16384
movl (%rax), %edi
movl -0x18(%rbx), %edx
movl $0x3, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2220
// File: /workspace/github_c_makefile_star2_O3/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 %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movslq 0x18(%rdi), %rax
testq %rax, %rax
jle 0x3ea6
movq 0x8(%rbx), %rcx
movb 0x157ce(%rip), %dl      # 0x19664
incq %rax
xorb %dl, -0x2(%rcx,%rax)
decq %rax
cmpq $0x1, %rax
ja 0x3e99
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x3ef4
movslq 0x14(%rbx), %rax
movslq 0x18(%rbx), %rsi
addq %rax, %rsi
callq 0x23d0
testq %rax, %rax
je 0x3f14
movq %rax, (%rbx)
movslq 0x14(%rbx), %r12
addq %r12, %rax
movq 0x8(%rbx), %r14
movslq 0x18(%rbx), %r15
movq %rax, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x22e0
leal (%r15,%r12), %eax
movl %eax, 0x14(%rbx)
movq %r14, %rdi
callq 0x2030
jmp 0x3f01
movq 0x8(%rbx), %rax
movq %rax, (%rbx)
movl 0x18(%rbx), %eax
movl %eax, 0x14(%rbx)
movq $0x0, 0x8(%rbx)
movl $0x0, 0x18(%rbx)
xorl %eax, %eax
jmp 0x3f16
movb $0x1, %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/niuyuling[P]CProxy/http_proxy.c
// Function: tcp_out
void tcp_out(conn_t * to)
{
    conn_t *from;
    int write_len;

    if (to->fd == -1)
        return;
    else if ((to - cts) & 1)
        from = to - 1;
    else
        from = to + 1;
    from->timer = to->timer = 0;

    write_len = write(to->fd, from->ready_data + from->sent_len, from->ready_data_len - from->sent_len);
    if (write_len == from->ready_data_len - from->sent_len) {
        //服务端的数据可能没全部写入到客户端
        if ((from - cts) & 1) {
            serverToClient(from);
            if (from->fd >= 0 && from->ready_data_len == 0) {
                ev.events = EPOLLIN | EPOLLET;
                ev.data.ptr = to;
                epoll_ctl(epollfd, EPOLL_CTL_MOD, to->fd, &ev);
            }
        } else {
            ev.events = EPOLLIN | EPOLLET;
            ev.data.ptr = to;
            epoll_ctl(epollfd, EPOLL_CTL_MOD, to->fd, &ev);
            free(from->ready_data);
            from->ready_data = NULL;
            from->ready_data_len = 0;
        }
    } else if (write_len > 0) {
        from->sent_len += write_len;
        ev.events = EPOLLIN | EPOLLOUT | EPOLLET;
        ev.data.ptr = to;
        epoll_ctl(epollfd, EPOLL_CTL_MOD, to->fd, &ev);
    } else if (errno != EAGAIN) {
        close_connection(to);
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x10(%rdi), %edi
cmpl $-0x1, %edi
je 0x4034
leal 0x84e5(%rip), %eax      # 0xc420
movl %ebx, %ecx
subl %eax, %ecx
leaq -0x28(%rbx), %r14
leaq 0x28(%rbx), %rax
btl $0x3, %ecx
cmovaeq %rax, %r14
xorl %eax, %eax
movl %eax, 0x20(%rbx)
movl %eax, 0x20(%r14)
movslq 0x1c(%r14), %rax
movq (%r14), %rsi
addq %rax, %rsi
movslq 0x14(%r14), %rdx
subq %rax, %rdx
callq 0x20e0
movl 0x14(%r14), %edx
movl 0x1c(%r14), %ecx
subl %ecx, %edx
cmpl %eax, %edx
jne 0x3fcd
leal 0x849e(%rip), %eax      # 0xc420
movl %r14d, %ecx
subl %eax, %ecx
btl $0x3, %ecx
jb 0x4005
leaq 0x123f8(%rip), %rcx     # 0x1638c
movl $0x80000001, (%rcx)     # imm = 0x80000001
movq %rbx, 0x4(%rcx)
leaq 0x123df(%rip), %rax     # 0x16384
movl (%rax), %edi
movl 0x10(%rbx), %edx
movl $0x3, %esi
callq 0x2220
movq (%r14), %rdi
callq 0x2030
movq $0x0, (%r14)
movl $0x0, 0x14(%r14)
jmp 0x4034
testl %eax, %eax
jle 0x402a
addl %eax, %ecx
movl %ecx, 0x1c(%r14)
leaq 0x123ae(%rip), %rcx     # 0x1638c
movl $0x80000005, (%rcx)     # imm = 0x80000005
movq %rbx, 0x4(%rcx)
leaq 0x12395(%rip), %rax     # 0x16384
movl (%rax), %edi
movl 0x10(%rbx), %edx
movl $0x3, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2220
movq %r14, %rdi
callq 0x3d9c
cmpl $0x0, 0x10(%r14)
js 0x4034
cmpl $0x0, 0x14(%r14)
jne 0x4034
leaq 0x1236a(%rip), %rcx     # 0x1638c
movl $0x80000001, (%rcx)     # imm = 0x80000001
jmp 0x3fe4
callq 0x2050
cmpl $0xb, (%rax)
jne 0x403c
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3806
nop
// File: /workspace/github_c_makefile_star2_O3/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 %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r12
movl %esi, %r14d
movq %rdi, %rbx
leal 0x1(%r14), %eax
movslq %eax, %rdi
callq 0x2330
movq %rax, (%r12)
testq %rax, %rax
je 0x40b5
movq %rax, %r15
movslq %r14d, %r14
movq %rax, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x22e0
movb $0x0, (%r15,%r14)
xorl %eax, %eax
jmp 0x40b7
movb $0x1, %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r14
callq 0x2140
cmpl $0x8, %ebp
jl 0x47d9
testq %r14, %r14
je 0x47de
movq %rax, %r15
leaq 0x7(%r14), %rdi
movl $0x2f, %esi
callq 0x2160
testq %rax, %rax
je 0x47d9
addq %r15, %r14
subq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rdx
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x22e0
movb $0x2f, (%rbx)
jmp 0x47e0
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/niuyuling[P]CProxy/http_request.c
// Function: get_http_host_port_len
void get_http_host_port_len(char *head, int *host_len, int *port_len)
{
    *host_len = 0;
    *port_len = 0;
    char *_p1 = strstr(head, "Host"); // 判断Host行
    if (_p1) {                  // 为真时
        char *_p2 = strstr(_p1, "\n");
        *host_len = (int)(_p2 - _p1);

        char host[*host_len + 1];
        memcpy(host, _p1, *host_len);
        host[*host_len] = '\0';

        char *_p3 = strrchr(host, ':');
        char *_p4 = strchr(host, '\0');
        if (_p3) {
            *port_len = _p4 - (_p3 + 1);
        } else {
            *port_len = *host_len;
        }
    } else {                    // 为假时
        char *_p1 = strstr(head, "host");
        if (_p1) {
            char *_p2 = strstr(_p1, "\n");
            *host_len = (int)(_p2 - _p1);

            char host[*host_len + 1];
            memcpy(host, _p1, *host_len);
            host[*host_len] = '\0';

            char *_p3 = strrchr(host, ':');
            char *_p4 = strchr(host, '\0');
            if (_p3) {
                *port_len = _p4 - (_p3 + 1);
            } else {
                *port_len = *host_len;
            }
        } else {                // 未找到时使用HTTP_HEAD_CACHE_SIZE大小
            *host_len = HTTP_HEAD_HOST_CACHE_SIZE;
            *port_len = HTTP_HEAD_HOST_CACHE_SIZE / 10;
        }
    }

    return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r12
xorl %eax, %eax
movl %eax, (%rsi)
movl %eax, (%rdx)
leaq 0x4b69(%rip), %rsi      # 0x937b
callq 0x2540
testq %rax, %rax
jne 0x4834
leaq 0x4b5d(%rip), %rsi      # 0x9380
movq %r12, %rdi
callq 0x2540
testq %rax, %rax
je 0x48be
movq %rax, %r15
movq %rbx, -0x30(%rbp)
movq %rax, %rdi
movl $0xa, %esi
callq 0x2160
movq %rsp, %r13
subl %r15d, %eax
movl %eax, (%r14)
incl %eax
addq $0xf, %rax
andq $-0x10, %rax
movq %rsp, %r12
subq %rax, %r12
movq %r12, %rsp
movl (%r14), %ebx
movslq %ebx, %r14
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x22e0
movb $0x0, (%r14,%r12)
movq %r12, %rdi
movl $0x3a, %esi
callq 0x2190
testq %rax, %rax
je 0x48a6
movq %rax, %r14
movq %r12, %rdi
callq 0x2140
addl %r12d, %eax
notl %r14d
addl %eax, %r14d
movl %r14d, %ebx
movq -0x30(%rbp), %rax
movl %ebx, (%rax)
movq %r13, %rsp
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x400, (%r14)          # imm = 0x400
movl $0x66, (%rbx)
jmp 0x48af
// File: /workspace/github_c_makefile_star2_O3/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 %rbx
movq %rdi, %rbx
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x48de
callq 0x2030
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x48ec
callq 0x2030
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x48fa
callq 0x2030
movq 0x18(%rbx), %rdi
testq %rdi, %rdi
je 0x4908
callq 0x2030
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
je 0x4916
callq 0x2030
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x4924
callq 0x2030
movq 0x30(%rbx), %rdi
testq %rdi, %rdi
je 0x4932
callq 0x2030
movq 0x38(%rbx), %rdi
testq %rdi, %rdi
je 0x4941
popq %rbx
jmp 0x2030
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, %r13d
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movl $0xa, %esi
callq 0x2160
testq %rax, %rax
je 0x5542
movq %rax, %r12
incq %r12
movq %r12, %rdi
callq 0x2140
movl %r13d, -0x2c(%rbp)
movq %rax, %r13
leaq 0x1(%rax), %rdx
movq %r15, -0x38(%rbp)
movq %rsp, %r15
addq $0x10, %rax
andq $-0x10, %rax
subq %rax, %r15
movq %r15, %rsp
movq %r15, %rdi
xorl %esi, %esi
callq 0x21b0
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x22e0
movslq (%r14), %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x21b0
movslq -0x2c(%rbp), %r12
movq %rbx, %rdi
movq -0x38(%rbp), %rsi
movq %r12, %rdx
callq 0x22e0
movq %rbx, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x21d0
addl %r13d, %r12d
movl %r12d, (%r14)
movq %rbx, %rax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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:
movq %rdi, %rax
testq %rdx, %rdx
je 0x5596
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
cmpq $0x0, (%rbx)
je 0x5586
movl 0x20(%rbx), %ecx
movq 0x10(%rbx), %rdx
movq 0x18(%rbx), %r8
movl 0x24(%rbx), %r9d
movq %rax, %rdi
movq %r14, %rsi
callq 0x40c3
movq 0x50(%rbx), %rbx
testq %rbx, %rbx
jne 0x5566
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/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 %r15
pushq %r14
pushq %rbx
xorl %ebx, %ebx
leaq 0x13cb5(%rip), %r14     # 0x196f0
leaq 0x1393e(%rip), %r15     # 0x19380
cmpl $0x0, 0x22c(%rbx,%r14)
js 0x5a70
movl 0x230(%rbx,%r14), %eax
cmpl 0x14(%r15), %eax
jge 0x5a67
incl %eax
movl %eax, 0x230(%rbx,%r14)
jmp 0x5a70
leaq (%r14,%rbx), %rdi
callq 0x5a86
addq $0x240, %rbx            # imm = 0x240
cmpq $0x48000, %rbx          # imm = 0x48000
jne 0x5a42
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/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 %rbx
movq %rdi, %rbx
movl 0x5bc60(%rip), %edi     # 0x616f0
movl 0x22c(%rbx), %edx
movl $0x2, %esi
xorl %ecx, %ecx
callq 0x2220
movl 0x22c(%rbx), %edi
callq 0x21e0
testb $0x1, 0x13c2c(%rip)     # 0x196e0
jne 0x5ac2
movq 0x218(%rbx), %rdi
callq 0x2030
xorps %xmm0, %xmm0
movups %xmm0, 0x222(%rbx)
movups %xmm0, 0x232(%rbx)
movups %xmm0, 0x212(%rbx)
movw $0x0, 0x242(%rbx)
movl $0xffffffff, 0x22c(%rbx) # imm = 0xFFFFFFFF
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/niuyuling[P]CProxy/httpdns.c
// Function: write_dns_cache
static void write_dns_cache(int sig)
{
    //子进程先写入缓存
    if (child_pid) {
        wait(NULL);
        cfp = fopen(httpdns.cachePath, "a");
    } else {
        cfp = fopen(httpdns.cachePath, "w");
    }
    while (cache) {
        fwrite(cache->dns_cache, *(uint16_t *) cache->dns_cache + *(uint16_t *) (cache->dns_cache + *(uint16_t *) cache->dns_cache + 2) + 4, 1, cfp);
        cache = cache->next;
    }

    exit(0);
}

// Assembly:
pushq %rax
cmpl $0x0, 0x13807(%rip)     # 0x19678
jne 0x5e7c
leaq 0x3567(%rip), %rsi      # 0x93e1
jmp 0x5e8a
xorl %edi, %edi
callq 0x2510
leaq 0x36b9(%rip), %rsi      # 0x9543
movq 0x1381f(%rip), %rdi     # 0x196b0
callq 0x2450
movq %rax, 0x137d3(%rip)     # 0x19670
movq 0x13844(%rip), %rax     # 0x196e8
testq %rax, %rax
je 0x5ee1
movq (%rax), %rdi
movzwl (%rdi), %eax
movzwl 0x2(%rdi,%rax), %ecx
leaq (%rax,%rcx), %rsi
addq $0x4, %rsi
movq 0x137ad(%rip), %rcx     # 0x19670
movl $0x1, %edx
callq 0x24d0
movq 0x13814(%rip), %rax     # 0x196e8
movq 0x8(%rax), %rax
movq %rax, 0x13809(%rip)     # 0x196e8
jmp 0x5ea4
xorl %edi, %edi
callq 0x24b0
// File: /workspace/github_c_makefile_star2_O3/niuyuling[P]CProxy/httpdns.c
// Function: cache_record
static void cache_record(char *request, uint16_t request_len, char *response, uint16_t response_len)
{
    struct dns_cache *cache_temp;

    cache_temp = (struct dns_cache *)malloc(sizeof(struct dns_cache));
    if (cache_temp == NULL)
        return;
    cache_temp->dns_cache = (char *)malloc(request_len + response_len + 2);
    if (cache_temp->dns_cache == NULL) {
        free(cache_temp);
        return;
    }
    cache_temp->next = cache;
    cache = cache_temp;
    //不缓存dnsid
    request += 2;
    request_len -= 2;
    memcpy(cache_temp->dns_cache, &request_len, 2);
    memcpy(cache_temp->dns_cache + 2, request, request_len);
    memcpy(cache_temp->dns_cache + request_len + 2, &response_len, 2);
    memcpy(cache_temp->dns_cache + request_len + 4, response, response_len);
    if (httpdns.cacheLimit) {
        //到达缓存记录条目限制则释放前一半缓存
        if (cache_using >= httpdns.cacheLimit) {
            struct dns_cache *free_c;
            int i;
            for (i = cache_using = httpdns.cacheLimit >> 1; i--; cache_temp = cache_temp->next) ;
            for (free_c = cache_temp->next, cache_temp->next = NULL; free_c; free_c = cache_temp) {
                cache_temp = free_c->next;
                free(free_c->dns_cache);
                free(free_c);
            }
        }
        cache_using++;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, %ebp
movq %rdx, %r14
movl %esi, %r13d
movq %rdi, %r12
movl $0x10, %edi
callq 0x2330
testq %rax, %rax
je 0x6a02
movq %rax, %rbx
movzwl %r13w, %eax
movzwl %bp, %ecx
movq %rcx, 0x10(%rsp)
leaq (%rax,%rcx), %rdi
addq $0x2, %rdi
callq 0x2330
movq %rax, (%rbx)
testq %rax, %rax
je 0x6a11
movq %rax, %r15
movq %r14, 0x8(%rsp)
movq 0x12d95(%rip), %r14     # 0x196e8
movq %r14, 0x8(%rbx)
movq %rbx, 0x12d8a(%rip)     # 0x196e8
addq $0x2, %r12
addl $-0x2, %r13d
movw %r13w, (%rax)
leaq 0x2(%rax), %rdi
movzwl %r13w, %r13d
movq %r12, %rsi
movq %r13, %rdx
callq 0x22e0
movw %bp, 0x2(%r15,%r13)
leaq (%r15,%r13), %rdi
addq $0x4, %rdi
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
callq 0x22e0
movl 0x12d30(%rip), %ecx     # 0x196d0
testl %ecx, %ecx
je 0x6a02
movl 0x12cd2(%rip), %eax     # 0x1967c
cmpl %ecx, %eax
jl 0x69fa
movl %ecx, %eax
sarl %eax
movl %eax, 0x12cc4(%rip)     # 0x1967c
cmpl $0x1, %ecx
je 0x69cb
movl %eax, %ecx
movq 0x8(%rbx), %rbx
decl %ecx
jne 0x69bf
movq 0x8(%rbx), %r14
movq $0x0, 0x8(%rbx)
testq %r14, %r14
je 0x69fa
movq (%r14), %rdi
movq 0x8(%r14), %rbx
callq 0x2030
movq %r14, %rdi
callq 0x2030
movq %rbx, %r14
testq %rbx, %rbx
jne 0x69d8
movl 0x12c82(%rip), %eax     # 0x1967c
incl %eax
movl %eax, 0x12c7a(%rip)     # 0x1967c
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2030
nop
// File: /workspace/github_c_makefile_star2_O3/niuyuling[P]CProxy/httpudp.c
// Function: udp_timeout_check
void udp_timeout_check()
{
    int i;

    for (i = 0; i < MAX_CLIENT_INFO; i++) {
        if (client_info_list[i].server_fd > -1) {
            if (client_info_list[i].timer >= global.timeout_m)
                proxyStop(client_info_list + i);
            else
                client_info_list[i].timer = 0;
        }
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
xorl %ebx, %ebx
leaq 0x5cf0a(%rip), %r14     # 0x63940
leaq 0x12943(%rip), %r15     # 0x19380
cmpl $0x0, 0x1005c(%rbx,%r14)
js 0x6a6d
movl 0x10064(%rbx,%r14), %eax
cmpl 0x14(%r15), %eax
jge 0x6a64
movl $0x0, 0x10064(%rbx,%r14)
jmp 0x6a6d
leaq (%r14,%rbx), %rdi
callq 0x6a83
addq $0x10068, %rbx          # imm = 0x10068
cmpq $0x200d000, %rbx        # imm = 0x200D000
jne 0x6a3d
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/niuyuling[P]CProxy/httpudp.c
// Function: proxyStop
static void proxyStop(info_t * info)
{
    epoll_ctl(udp_efd, EPOLL_CTL_DEL, info->server_fd, NULL);
    epoll_ctl(udp_efd, EPOLL_CTL_DEL, info->responseClientFd, NULL);
    close(info->server_fd);
    close(info->responseClientFd);
    free(info->rsp_data);
    info->rsp_data = NULL;
    do {
        info->server_fd = info->responseClientFd = -1;
        info->rsp_data_len = info->rsp_data_sent_len = info->client_data_sent_len = info->http_request_sent_len = 0;
    } while ((info = info->next) != NULL);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl 0x2069eb3(%rip), %edi   # 0x2070940
movl 0x1005c(%rbx), %edx
movl $0x2, %esi
xorl %ecx, %ecx
callq 0x2220
movl 0x2069e9b(%rip), %edi   # 0x2070940
movl 0x10060(%rbx), %edx
movl $0x2, %esi
xorl %ecx, %ecx
callq 0x2220
movl 0x1005c(%rbx), %edi
callq 0x21e0
movl 0x10060(%rbx), %edi
callq 0x21e0
movq 0x10040(%rbx), %rdi
callq 0x2030
movq $0x0, 0x10040(%rbx)
xorps %xmm0, %xmm0
movq $-0x1, 0x1005c(%rbx)
movups %xmm0, 0x1004c(%rbx)
movq 0x10038(%rbx), %rbx
testq %rbx, %rbx
jne 0x6ae7
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/niuyuling[P]CProxy/conf.c
// Function: print_tcp
void print_tcp(tcp * p)
{
    tcp *temp = p;
    while (temp) {
        if (temp->strrep)
            printf("%s %d\n", temp->strrep, temp->strrep_len);
        if (temp->strrep_s)
            printf("%s %d\n", temp->strrep_s, temp->strrep_s_len);
        if (temp->strrep_t)
            printf("%s %d\n", temp->strrep_t, temp->strrep_t_len);

        if (temp->regrep)
            printf("%s %d\n", temp->regrep, temp->regrep_len);
        if (temp->regrep_s)
            printf("%s %d\n", temp->regrep_s, temp->regrep_s_len);
        if (temp->regrep_t)
            printf("%s %d\n", temp->regrep_t, temp->regrep_t_len);

        temp = temp->next;
    }
}

// Assembly:
testq %rdi, %rdi
je 0x7836
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x1cb5(%rip), %r14      # 0x9454
movq (%rbx), %rsi
testq %rsi, %rsi
je 0x77b4
movl 0x8(%rbx), %edx
movq %r14, %rdi
xorl %eax, %eax
callq 0x2170
movq 0x10(%rbx), %rsi
testq %rsi, %rsi
je 0x77ca
movl 0x20(%rbx), %edx
movq %r14, %rdi
xorl %eax, %eax
callq 0x2170
movq 0x18(%rbx), %rsi
testq %rsi, %rsi
je 0x77e0
movl 0x24(%rbx), %edx
movq %r14, %rdi
xorl %eax, %eax
callq 0x2170
movq 0x28(%rbx), %rsi
testq %rsi, %rsi
je 0x77f6
movl 0x30(%rbx), %edx
movq %r14, %rdi
xorl %eax, %eax
callq 0x2170
movq 0x38(%rbx), %rsi
testq %rsi, %rsi
je 0x780c
movl 0x48(%rbx), %edx
movq %r14, %rdi
xorl %eax, %eax
callq 0x2170
movq 0x40(%rbx), %rsi
testq %rsi, %rsi
je 0x7822
movl 0x4c(%rbx), %edx
movq %r14, %rdi
xorl %eax, %eax
callq 0x2170
movq 0x50(%rbx), %rbx
testq %rbx, %rbx
jne 0x779f
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/niuyuling[P]CProxy/conf.c
// Function: local_reverse
tcp *local_reverse(tcp * head)
{
    tcp *beg = NULL;
    tcp *end = NULL;
    if (head == NULL || head->next == NULL) {
        return head;
    }
    beg = head;
    end = head->next;
    while (end != NULL) {
        //将 end 从链表中摘除
        beg->next = end->next;
        //将 end 移动至链表头
        end->next = head;
        head = end;
        //调整 end 的指向，另其指向 beg 后的一个节点，为反转下一个节点做准备
        end = beg->next;
    }
    return head;
}

// Assembly:
testq %rdi, %rdi
je 0x7864
movq 0x50(%rdi), %rcx
testq %rcx, %rcx
je 0x7867
movq %rdi, %rdx
movq %rcx, %rax
movq 0x50(%rcx), %rcx
movq %rcx, 0x50(%rdi)
movq %rdx, 0x50(%rax)
movq 0x50(%rdi), %rcx
movq %rax, %rdx
testq %rcx, %rcx
jne 0x7848
retq
xorl %eax, %eax
retq
movq %rdi, %rax
retq
// File: /workspace/github_c_makefile_star2_O3/niuyuling[P]CProxy/conf.c
// Function: free_tcp
void free_tcp(tcp ** conf_head)
{
    tcp *t;
    while (*conf_head != NULL) {
        t = *conf_head;
        *conf_head = t->next;

        if (t->strrep)
            free(t->strrep);
        if (t->strrep_s)
            free(t->strrep_s);
        if (t->strrep_t)
            free(t->strrep_t);

        if (t->regrep)
            free(t->regrep);
        if (t->regrep_s)
            free(t->regrep_s);
        if (t->regrep_t)
            free(t->regrep_t);
        if (t)
            free(t);
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq (%rdi), %r14
testq %r14, %r14
je 0x78e4
movq %rdi, %rbx
movq 0x50(%r14), %rax
movq %rax, (%rbx)
movq (%r14), %rdi
testq %rdi, %rdi
je 0x788e
callq 0x2030
movq 0x10(%r14), %rdi
testq %rdi, %rdi
je 0x789c
callq 0x2030
movq 0x18(%r14), %rdi
testq %rdi, %rdi
je 0x78aa
callq 0x2030
movq 0x28(%r14), %rdi
testq %rdi, %rdi
je 0x78b8
callq 0x2030
movq 0x38(%r14), %rdi
testq %rdi, %rdi
je 0x78c6
callq 0x2030
movq 0x40(%r14), %rdi
testq %rdi, %rdi
je 0x78d4
callq 0x2030
movq %r14, %rdi
callq 0x2030
movq (%rbx), %r14
testq %r14, %r14
jne 0x787a
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/niuyuling[P]CProxy/conf.c
// Function: free_conf
void free_conf(conf * p)
{
    // http module
    if (p->http_ip)
        free(p->http_ip);
    if (p->http_del)
        free(p->http_del);
    if (p->http_first)
        free(p->http_first);

    // https module
    if (p->https_ip)
        free(p->https_ip);
    if (p->https_del)
        free(p->https_del);
    if (p->https_first)
        free(p->https_first);

    // httpdns module
    if (p->httpdns_addr)
        free(p->httpdns_addr);
    if (p->httpdns_http_req)
        free(p->httpdns_http_req);

    // httpudp module
    if (p->httpudp_addr)
        free(p->httpudp_addr);
    if (p->httpudp_http_req)
        free(p->httpudp_http_req);

    return;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x28(%rdi), %rdi
testq %rdi, %rdi
je 0x78fe
callq 0x2030
movq 0x30(%rbx), %rdi
testq %rdi, %rdi
je 0x790c
callq 0x2030
movq 0x38(%rbx), %rdi
testq %rdi, %rdi
je 0x791a
callq 0x2030
movq 0x58(%rbx), %rdi
testq %rdi, %rdi
je 0x7928
callq 0x2030
movq 0x60(%rbx), %rdi
testq %rdi, %rdi
je 0x7936
callq 0x2030
movq 0x68(%rbx), %rdi
testq %rdi, %rdi
je 0x7944
callq 0x2030
movq 0x80(%rbx), %rdi
testq %rdi, %rdi
je 0x7955
callq 0x2030
movq 0x88(%rbx), %rdi
testq %rdi, %rdi
je 0x7966
callq 0x2030
movq 0xa0(%rbx), %rdi
testq %rdi, %rdi
je 0x7977
callq 0x2030
movq 0xa8(%rbx), %rdi
testq %rdi, %rdi
je 0x7989
popq %rbx
jmp 0x2030
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/niuyuling[P]CProxy/conf.c
// Function: read_module
static char *read_module(char *buff, const char *module_name)
{
    int len;
    char *p, *p0;

    len = strlen(module_name);
    p = buff;
    while (1) {
        while (*p == ' ' || *p == '\t' || *p == '\r' || *p == '\n')
            p++;
        if (strncasecmp(p, module_name, len) == 0) {
            p += len;
            while (*p == ' ' || *p == '\t' || *p == '\r' || *p == '\n')
                p++;
            if (*p == '{')
                break;
        }
        if ((p = strchr(p, '\n')) == NULL)
            return NULL;
    }
    if ((p0 = strchr(++p, '}')) == NULL)
        return NULL;

    return strndup(p, p0 - p);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x2140
movslq %eax, %r15
leaq 0x1(%r15), %r12
movabsq $0x100002600, %r13      # imm = 0x100002600
movzbl (%rbx), %eax
cmpq $0x20, %rax
ja 0x8576
btq %rax, %r13
jae 0x8576
incq %rbx
jmp 0x8562
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x2340
testl %eax, %eax
jne 0x85ab
leaq (%r12,%rbx), %rbp
addq %r15, %rbx
movzbl (%rbx), %eax
cmpq $0x20, %rax
ja 0x85a6
btq %rax, %r13
jae 0x85a6
incq %rbx
incq %rbp
jmp 0x858f
cmpl $0x7b, %eax
je 0x85c2
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movq %rax, %rbx
testq %rax, %rax
jne 0x8562
jmp 0x85f3
incq %rbx
movq %rbx, %rdi
movl $0x7d, %esi
callq 0x2160
testq %rax, %rax
je 0x85f3
subq %rbp, %rax
movq %rbx, %rdi
movq %rax, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2250
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/niuyuling[P]CProxy/conf.c
// Function: string_pretreatment
static void string_pretreatment(char *str, int *len)
{
    char *lf, *p, *ori_strs[] = { "\\r", "\\n", "\\b", "\\v", "\\f", "\\t", "\\a", "\\b", "\\0" }, to_chrs[] = { '\r', '\n', '\b', '\v', '\f', '\t', '\a', '\b', '\0' };
    int i;

    while ((lf = strchr(str, '\n')) != NULL) {
        for (p = lf + 1; *p == ' ' || *p == '\t' || *p == '\n' || *p == '\r'; p++)
            *len -= 1;
        strcpy(lf, p);
        *len -= 1;
    }
    for (i = 0; i < sizeof(to_chrs); i++) {
        for (p = strstr(str, ori_strs[i]); p; p = strstr(p, ori_strs[i])) {
            //支持\\r
            *(p - 1) == '\\' ? (*p--) : (*p = to_chrs[i]);
            memmove(p + 1, p + 2, strlen(p + 2));
            (*len)--;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, (%rsp)
movl $0xa, %esi
callq 0x2160
testq %rax, %rax
je 0x87de
movabsq $0x100002600, %r14      # imm = 0x100002600
leaq 0x1(%rax), %rsi
movzbl (%rsi), %ecx
cmpq $0x20, %rcx
ja 0x87c1
btq %rcx, %r14
jae 0x87c1
decl (%rbx)
incq %rsi
jmp 0x87ab
movq %rax, %rdi
callq 0x2080
decl (%rbx)
movq (%rsp), %rdi
movl $0xa, %esi
callq 0x2160
testq %rax, %rax
jne 0x87a7
xorl %r14d, %r14d
leaq 0x35a8(%rip), %rax      # 0xbd90
movq (%rax,%r14,8), %r15
movq (%rsp), %rdi
movq %r15, %rsi
callq 0x2540
testq %rax, %rax
je 0x8851
movq %rax, %r12
cmpb $0x5c, -0x1(%r12)
jne 0x880d
decq %r12
jmp 0x881c
leaq 0xd31(%rip), %rax       # 0x9545
movb (%r14,%rax), %al
movb %al, (%r12)
leaq 0x1(%r12), %r13
leaq 0x2(%r12), %rbp
movq %rbp, %rdi
callq 0x2140
movq %r13, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0x2430
decl (%rbx)
movq %r12, %rdi
movq %r15, %rsi
callq 0x2540
movq %rax, %r12
testq %rax, %rax
jne 0x8800
incq %r14
cmpq $0x9, %r14
jne 0x87e1
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ebiggers[P]mysh/mysh_builtin.c
// Function: maybe_execute_builtin
bool maybe_execute_builtin(const struct list_head *cmd_args,
			   const struct list_head *redirs,
			   unsigned cmd_nargs, int *status_ret)
{
	const char *name;
	size_t i;

	mysh_assert(!list_empty(cmd_args));
	mysh_assert(cmd_nargs == list_size(cmd_args));
	name = list_entry(cmd_args->next, struct string, list)->chars;
	for (i = 0; i < NUM_BUILTINS; i++) {
		if (strcmp(builtins[i].name, name) == 0) {
			/* The command matched a builtin.  Execute it. */
			*status_ret = execute_builtin(&builtins[i],
						      cmd_args->next,
						      redirs, cmd_nargs - 1);
			return true;
		}
	}
	/* Not a builtin command */
	return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq (%rdi), %r15
cmpq %rdi, %r15
je 0x2787
movq %rcx, %rbx
movl %edx, %ebp
movq %rsi, %r14
movl %edx, %eax
incq %rax
movq %rdi, %rcx
movq (%rcx), %rcx
decq %rax
cmpq %rdi, %rcx
jne 0x26e3
testq %rax, %rax
jne 0x27a6
movq -0x18(%r15), %r13
leaq 0x4a65(%rip), %rdi      # 0x7167
movq %r13, %rsi
callq 0x2230
testl %eax, %eax
je 0x2752
movq %r14, (%rsp)
movq %rbx, %r14
movq $-0x1, %rbx
leaq 0x80ed(%rip), %r12      # 0xa810
cmpq $0xf, %rbx
je 0x2772
movq 0x18(%r12), %rdi
addq $0x18, %r12
movq %r13, %rsi
callq 0x2230
incq %rbx
testl %eax, %eax
jne 0x2723
cmpq $0x10, %rbx
setb %r13b
movq %r14, %rbx
movq (%rsp), %r14
jmp 0x275c
leaq 0x80b7(%rip), %r12      # 0xa810
movb $0x1, %r13b
decl %ebp
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
movl %ebp, %ecx
callq 0x27c5
movl %eax, (%rbx)
jmp 0x2775
xorl %r13d, %r13d
movl %r13d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4876(%rip), %rdi      # 0x7004
leaq 0x4885(%rip), %rsi      # 0x701a
leaq 0x488d(%rip), %rcx      # 0x7029
movl $0x1da, %edx            # imm = 0x1DA
callq 0x2160
leaq 0x48e1(%rip), %rdi      # 0x708e
leaq 0x4866(%rip), %rsi      # 0x701a
leaq 0x486e(%rip), %rcx      # 0x7029
movl $0x1db, %edx            # imm = 0x1DB
callq 0x2160
// File: /workspace/github_c_makefile_star2_O3/ebiggers[P]mysh/mysh_builtin.c
// Function: execute_builtin
static int execute_builtin(const struct builtin *builtin,
			   const struct list_head *cmd_args,
			   const struct list_head *redirs,
			   unsigned cmd_nargs)
{
	struct orig_fds orig;
	const char *argv[cmd_nargs + 1];
	struct string *s;
	unsigned i;
	int status;
	int ret;

	/* Do redirections for the builtin */
	status = do_redirections(redirs, &orig);
	if (status)
		return status;

	/* Prepare argv for the builtin */
	for (i = 0, s = list_entry(cmd_args->next, struct string, list);
	     i < cmd_nargs;
	     i++, s = list_entry(s->list.next, struct string, list))
	{
		argv[i] = s->chars;
	}
	argv[i] = NULL;

	/* Call the built-in function */
	status = builtin->func(cmd_nargs, argv);

	/* Undo redirections for the builtin, unless this was the 'exec' builtin */
	if (builtin->func != builtin_exec) {
		ret = undo_redirections(&orig);
		if (ret) {
			if (status == 0)
				status = ret;
			mysh_error_with_errno("Failed to restore redirections");
		}
	}
	return status;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, %r14d
movq %rsi, %r12
movq %rdi, %rbx
movq %rsp, -0x30(%rbp)
leal 0x1(%r14), %eax
movq %rsp, %r15
leaq 0xf(,%rax,8), %rax
andq $-0x10, %rax
subq %rax, %r15
movq %r15, %rsp
leaq -0x3c(%rbp), %rsi
movq %rdx, %rdi
callq 0x6419
movl %eax, %r13d
testl %eax, %eax
je 0x2825
movq -0x30(%rbp), %rsp
movl %r13d, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testl %r14d, %r14d
je 0x2846
movl %r14d, %eax
xorl %ecx, %ecx
movq (%r12), %r12
movq -0x18(%r12), %rdx
movq %rdx, (%r15,%rcx,8)
incq %rcx
cmpq %rcx, %rax
jne 0x282f
jmp 0x2848
xorl %eax, %eax
movq $0x0, (%r15,%rax,8)
movl %r14d, %edi
movq %r15, %rsi
callq *0x8(%rbx)
movl %eax, %r13d
leaq 0x2aa(%rip), %rax       # 0x2b0d
cmpq %rax, 0x8(%rbx)
je 0x280f
leaq -0x3c(%rbp), %rdi
callq 0x63cc
testl %eax, %eax
je 0x280f
testl %r13d, %r13d
cmovel %eax, %r13d
leaq 0x4afd(%rip), %rdi      # 0x7381
xorl %eax, %eax
callq 0x249f
jmp 0x280f
// File: /workspace/github_c_makefile_star2_O3/ebiggers[P]mysh/mysh_builtin.c
// Function: set_pwd
int set_pwd()
{
	char *wd = getcwd(NULL, 0);
	int ret;
	if (wd) {
		const char *setenv_argv[] = {"PWD", wd, NULL};
		ret = builtin_setenv(ARRAY_SIZE(setenv_argv) - 1, setenv_argv);
		free(wd);
	} else {
		mysh_error("getcwd()");
		ret = 1;
	}
	return ret;
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x18, %rsp
xorl %edi, %edi
xorl %esi, %esi
callq 0x21a0
testq %rax, %rax
je 0x28d3
movq %rax, %rbx
leaq 0x4804(%rip), %rax      # 0x70af
movq %rsp, %rsi
movq %rax, (%rsi)
movq %rbx, 0x8(%rsi)
movq $0x0, 0x10(%rsi)
movl $0x2, %edi
callq 0x28ef
movl %eax, %ebp
movq %rbx, %rdi
callq 0x2050
jmp 0x28e6
leaq 0x47d9(%rip), %rdi      # 0x70b3
xorl %eax, %eax
callq 0x23e0
movl $0x1, %ebp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ebiggers[P]mysh/mysh_builtin.c
// Function: builtin_setenv
static int builtin_setenv(unsigned argc, const char **argv)
{
	int ret;
	if (argc < 2) {
		mysh_error("usage: setenv VARIABLE VALUE");
		ret = 2;
	} else {
		if (setenv(argv[0], argv[1], 1)) {
			mysh_error_with_errno("setenv %s", argv[0]);
			ret = 1;
		} else {
			insert_shell_param(argv[0], argv[1]);
			ret = 0;
		}
	}
	return ret;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
cmpl $0x1, %edi
ja 0x290d
leaq 0x4aa1(%rip), %rdi      # 0x73a0
xorl %eax, %eax
callq 0x23e0
movl $0x2, %ebx
jmp 0x294e
movq %rsi, %r14
movq (%rsi), %rdi
movq 0x8(%rsi), %rsi
movl $0x1, %ebx
movl $0x1, %edx
callq 0x20d0
movq (%r14), %rsi
testl %eax, %eax
je 0x293d
leaq 0x4a89(%rip), %rdi      # 0x73bd
xorl %eax, %eax
callq 0x249f
jmp 0x294e
movq 0x8(%r14), %rax
movq %rsi, %rdi
movq %rax, %rsi
callq 0x4a31
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/ebiggers[P]mysh/mysh_builtin.c
// Function: builtin_alias
static int builtin_alias(unsigned argc, const char **argv)
{
	int ret;
	if (argc == 0) {
		ret = print_all_shell_aliases();
	} else {
		ret = 0;
		do {
			ret |= do_alias(*argv++);
		} while (--argc);
	}
	return ret;
}

// Assembly:
testl %edi, %edi
je 0x2a06
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %r12d
leaq 0x48b6(%rip), %r14      # 0x725a
xorl %r13d, %r13d
xorl %ebp, %ebp
movq (%rbx,%r13,8), %r15
movq %r15, %rdi
movl $0x3d, %esi
callq 0x2130
testq %rax, %rax
je 0x29d9
movq %rax, %rsi
subq %r15, %rsi
incq %rax
movq %r15, %rdi
movq %rax, %rdx
callq 0x4a61
xorl %ecx, %ecx
testb %al, %al
jne 0x29eb
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x23e0
movl $0x1, %ecx
orl %ecx, %ebp
incq %r13
cmpl %r13d, %r12d
jne 0x29a9
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
jmp 0x5005
// File: /workspace/github_c_makefile_star2_O3/ebiggers[P]mysh/mysh_builtin.c
// Function: builtin_cd
static int builtin_cd(unsigned argc, const char **argv)
{
	int ret = 1;
	const char *dest_dir;

	if (argc) {
		dest_dir = argv[0];
	} else {
		dest_dir = lookup_shell_param("HOME");
		if (!dest_dir) {
			mysh_error("cd: HOME not set");
			goto out;
		}
	}
	if (chdir(dest_dir) != 0)
		mysh_error_with_errno("cd: %s", dest_dir);
	else
		ret = set_pwd();
out:
	return ret;
}

// Assembly:
pushq %rbx
testl %edi, %edi
je 0x2a17
movq (%rsi), %rbx
jmp 0x2a2b
leaq 0x4859(%rip), %rdi      # 0x7277
callq 0x4b5a
movq %rax, %rbx
testq %rax, %rax
je 0x2a50
movq %rbx, %rdi
callq 0x2110
testl %eax, %eax
je 0x2a4a
leaq 0x484f(%rip), %rdi      # 0x728d
movq %rbx, %rsi
xorl %eax, %eax
callq 0x249f
jmp 0x2a5e
popq %rbx
jmp 0x288d
leaq 0x4825(%rip), %rdi      # 0x727c
xorl %eax, %eax
callq 0x23e0
movl $0x1, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/ebiggers[P]mysh/mysh_builtin.c
// Function: builtin_eval
static int builtin_eval(unsigned argc, const char **argv)
{
	size_t total_len = 0;
	unsigned i;
	char *p;

	if (argc == 0)
		return 0;
	i = 0;
	do {
		total_len += strlen(argv[i]);
	} while (++i != argc);
	total_len += argc - 1;

	char input[total_len + 1];
	p = input;
	i = 0;
	do {
		p = stpcpy(p, argv[i]);
		if (i != argc - 1)
			p = stpcpy(p, " ");
	} while (++i != argc);
	return execute_full_shell_input(input, total_len);
}

// Assembly:
testl %edi, %edi
je 0x2b0a
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movl %edi, %r14d
movl %edi, %r13d
xorl %r12d, %r12d
xorl %r15d, %r15d
movq (%rbx,%r12,8), %rdi
callq 0x2100
addq %rax, %r15
incq %r12
cmpq %r12, %r13
jne 0x2a8d
movq %rsp, -0x38(%rbp)
decl %r14d
leaq (%r15,%r14), %rax
addq $0x10, %rax
addq %r14, %r15
andq $-0x10, %rax
movq %rsp, %rcx
subq %rax, %rcx
movq %rcx, %rsp
xorl %r12d, %r12d
movq %rcx, -0x30(%rbp)
movq %rcx, %rax
movq (%rbx,%r12,8), %rsi
movq %rax, %rdi
callq 0x20f0
cmpq %r12, %r14
je 0x2ae3
movw $0x20, (%rax)
incq %rax
incq %r12
cmpq %r12, %r13
jne 0x2aca
movq -0x30(%rbp), %rdi
movq %r15, %rsi
callq 0x3468
movq -0x38(%rbp), %rsp
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/ebiggers[P]mysh/mysh_builtin.c
// Function: builtin_export
static int builtin_export(unsigned argc, const char **argv)
{
	int ret = 0;
	unsigned i;
	for (i = 0; i < argc; i++) {
		ret = do_export(argv[i]);
		if (ret)
			break;
	}
	return ret;
}

// Assembly:
testl %edi, %edi
je 0x2bb9
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %rbx
movl %edi, %r12d
xorl %r13d, %r13d
movq (%rbx,%r13,8), %r14
movq %r14, %rdi
movl $0x3d, %esi
callq 0x2130
testq %rax, %rax
je 0x2b99
movq %rax, %r15
movq %r14, %rdi
callq 0x4ac0
movb $0x0, (%r15)
movq %r14, %rdi
callq 0x4b06
movb $0x3d, (%r15)
jmp 0x2ba1
movq %r14, %rdi
callq 0x4b06
testl %eax, %eax
jne 0x2baf
incq %r13
cmpq %r13, %r12
jne 0x2b66
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/ebiggers[P]mysh/mysh_builtin.c
// Function: builtin_getenv
static int builtin_getenv(unsigned argc, const char **argv)
{
	int ret = 0;
	if (argc) {
		const char *value = getenv(argv[0]);
		if (value) {
			if (puts(value) == EOF) {
				mysh_error_with_errno("getenv: write error");
				ret = 1;
			}
		} else
			ret = 2;
	} else {
		const char **env_p;
		for (env_p = environ; *env_p; env_p++) {
			if (puts(*env_p) == EOF) {
				mysh_error_with_errno("getenv: write error");
				ret = 1;
				break;
			}
		}
	}
	return ret;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testl %edi, %edi
je 0x2bf5
movq (%rsi), %rdi
callq 0x2030
testq %rax, %rax
je 0x2c25
movq %rax, %rdi
callq 0x2080
xorl %ebx, %ebx
cmpl $-0x1, %eax
jne 0x2c2a
leaq 0x46c2(%rip), %rdi      # 0x72a9
xorl %eax, %eax
callq 0x249f
movl $0x1, %ebx
jmp 0x2c2a
movq 0x83d4(%rip), %rax      # 0xafd0
movq (%rax), %r14
movq (%r14), %rdi
xorl %ebx, %ebx
testq %rdi, %rdi
je 0x2c2a
addq $0x8, %r14
callq 0x2080
cmpl $-0x1, %eax
je 0x2be0
movq (%r14), %rdi
addq $0x8, %r14
testq %rdi, %rdi
jne 0x2c0d
jmp 0x2c2a
movl $0x2, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/ebiggers[P]mysh/mysh_builtin.c
// Function: builtin_help
static int builtin_help(unsigned argc, const char **argv)
{
	size_t i;
	if (argc) {
		for (i = 0; i < NUM_BUILTINS; i++) {
			if (strcmp(builtins[i].name, argv[0]) == 0) {
				print_help(&builtins[i]);
				return 0;
			}
		}
	}
	for (i = 0; i < NUM_BUILTINS; i++)
		print_help(&builtins[i]);
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
testl %edi, %edi
je 0x2c6b
movq (%rsi), %rbx
movl $0x10, %r14d
leaq 0x7bc3(%rip), %r15      # 0xa810
movq -0x10(%r14,%r15), %rdi
movq %rbx, %rsi
callq 0x2230
testl %eax, %eax
je 0x2c9c
addq $0x18, %r14
cmpq $0x1a8, %r14            # imm = 0x1A8
jne 0x2c4d
movl $0x10, %r14d
leaq 0x7b98(%rip), %r15      # 0xa810
leaq 0x463e(%rip), %rbx      # 0x72bd
movq (%r14,%r15), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2140
addq $0x18, %r14
cmpq $0x1a8, %r14            # imm = 0x1A8
jne 0x2c7f
jmp 0x2cae
movq (%r14,%r15), %rsi
leaq 0x4616(%rip), %rdi      # 0x72bd
xorl %eax, %eax
callq 0x2140
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/ebiggers[P]mysh/mysh_builtin.c
// Function: builtin_pwd
static int builtin_pwd(unsigned argc, const char **argv)
{
	char *buf;
	int ret = 1;

	buf = getcwd(NULL, 0);
	if (!buf) {
		mysh_error_with_errno("pwd: can't get current working directory");
		goto out;
	}
	if (puts(buf) == EOF)
		mysh_error_with_errno("pwd: write error");
	else
		ret = 0;
	free(buf);
out:
	return ret;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
xorl %ebx, %ebx
xorl %edi, %edi
xorl %esi, %esi
callq 0x21a0
testq %rax, %rax
je 0x2cf7
movq %rax, %r14
movq %rax, %rdi
callq 0x2080
cmpl $-0x1, %eax
jne 0x2ced
leaq 0x4610(%rip), %rdi      # 0x72f1
xorl %eax, %eax
callq 0x249f
movl $0x1, %ebx
movq %r14, %rdi
callq 0x2050
jmp 0x2d0a
leaq 0x45ca(%rip), %rdi      # 0x72c8
xorl %eax, %eax
callq 0x249f
movl $0x1, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq