LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/guoxuanhan[P]NetServer/poller.cpp
// Function: Poller::UpdateChannel(Channel*)
void Poller::UpdateChannel(Channel* pchannel)
{
    int fd = pchannel->GetFd();
    struct epoll_event ev;
    ev.events = pchannel->GetEvents();
    ev.data.ptr = pchannel;

    if(epoll_ctl(pollfd_, EPOLL_CTL_MOD, fd, &ev) == -1)
    {
        perror("epoll update error!");
        exit(1);
    }
    std::cout<< "Update Channel!" << std::endl;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
callq 0x49b4
movl %eax, %ebp
movq %rbx, %rdi
callq 0x49bc
leaq 0x4(%rsp), %rcx
movl %eax, (%rcx)
movq %rbx, 0x4(%rcx)
movl (%r14), %edi
pushq $0x3
popq %rsi
movl %ebp, %edx
callq 0x4410
cmpl $-0x1, %eax
je 0x9e1b
movq 0xe1ba(%rip), %rdi      # 0x17fb8
leaq 0x51a8(%rip), %rsi      # 0xefad
callq 0x4300
movq %rax, %rdi
callq 0x41a0
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x5177(%rip), %rdi      # 0xef99
callq 0x42a0
pushq $0x1
popq %rdi
callq 0x43b0
nop
// File: /workspace/github_cpp_makefile_star2_O2/guoxuanhan[P]NetServer/socket.cpp
// Function: Socket::Socket()
Socket::Socket()
{
    serverfd_ = socket(AF_INET, SOCK_STREAM, 0);
    if(-1 == serverfd_)
    {
        perror("socket create fail!");
        exit(-1);
    }
    std::cout << "server create socket" << serverfd_ << std::endl;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
pushq $0x2
popq %rdi
pushq $0x1
popq %rsi
xorl %edx, %edx
callq 0x4090
movl %eax, (%rbx)
cmpl $-0x1, %eax
je 0xa752
movq 0xd885(%rip), %rdi      # 0x17fb8
leaq 0x48e3(%rip), %rsi      # 0xf01d
callq 0x4300
movl (%rbx), %esi
movq %rax, %rdi
callq 0x4560
movq %rax, %rdi
popq %rbx
jmp 0x41a0
leaq 0x48b0(%rip), %rdi      # 0xf009
callq 0x42a0
pushq $-0x1
popq %rdi
callq 0x43b0
// File: /workspace/github_cpp_makefile_star2_O2/guoxuanhan[P]NetServer/socket.cpp
// Function: Socket::Setnonblocking()
void Socket::Setnonblocking()
{
    int opts = fcntl(serverfd_, F_GETFL);
    if (opts<0)
    {
        perror("fcntl(serverfd_,GETFL)");
        exit(1);
    }
    if (fcntl(serverfd_, F_SETFL, opts | O_NONBLOCK) < 0)
    {
        perror("fcntl(serverfd_,SETFL,opts)");
        exit(1);
    }
    std::cout << "server setnonblocking..." << std::endl;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl (%rdi), %edi
pushq $0x3
popq %rsi
xorl %eax, %eax
callq 0x4200
testl %eax, %eax
js 0xa7fd
movl (%rbx), %edi
orl $0x800, %eax            # imm = 0x800
pushq $0x4
popq %rsi
movl %eax, %edx
xorl %eax, %eax
callq 0x4200
testl %eax, %eax
js 0xa806
movq 0xd7d0(%rip), %rdi      # 0x17fb8
leaq 0x4886(%rip), %rsi      # 0xf075
callq 0x4300
movq %rax, %rdi
popq %rbx
jmp 0x41a0
leaq 0x483e(%rip), %rdi      # 0xf042
jmp 0xa80d
leaq 0x484c(%rip), %rdi      # 0xf059
callq 0x42a0
pushq $0x1
popq %rdi
callq 0x43b0
// File: /workspace/github_cpp_makefile_star2_O2/guoxuanhan[P]NetServer/socket.cpp
// Function: Socket::BindAddress(int)
bool Socket::BindAddress(int serverport)
{
    struct sockaddr_in serveraddr;
    memset(&serveraddr, 0, sizeof(serveraddr));
    serveraddr.sin_family = AF_INET;
    serveraddr.sin_addr.s_addr = htonl(INADDR_ANY);//inet_addr(_ServerIP.c_str());
    serveraddr.sin_port = htons(serverport);
    int resval = bind(serverfd_, (struct sockaddr*)&serveraddr, sizeof(serveraddr));
    if (resval == -1)
    {
        close(serverfd_);
        perror("error bind");
        exit(1);
    }
    std::cout << "server bindaddress..." << std::endl;
    return true;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq %rsp, %rax
andq $0x0, 0x8(%rax)
movw $0x2, (%rax)
andl $0x0, 0x4(%rax)
rolw $0x8, %si
movw %si, 0x2(%rax)
movl (%rdi), %edi
pushq $0x10
popq %rdx
movq %rax, %rsi
callq 0x4060
cmpl $-0x1, %eax
je 0xa870
movq 0xd764(%rip), %rdi      # 0x17fb8
leaq 0x483e(%rip), %rsi      # 0xf099
callq 0x4300
movq %rax, %rdi
callq 0x41a0
movb $0x1, %al
addq $0x10, %rsp
popq %rbx
retq
movl (%rbx), %edi
callq 0x45e0
leaq 0x4810(%rip), %rdi      # 0xf08e
callq 0x42a0
pushq $0x1
popq %rdi
callq 0x43b0
nop
// File: /workspace/github_cpp_makefile_star2_O2/guoxuanhan[P]NetServer/socket.cpp
// Function: Socket::Listen()
bool Socket::Listen()
{
    if (listen(serverfd_, 8192) < 0)
    {
        perror("error listen");
        close(serverfd_);
        exit(1);
    }
    std::cout << "server listenning..." << std::endl;
    return true;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl (%rdi), %edi
movl $0x2000, %esi           # imm = 0x2000
callq 0x4350
testl %eax, %eax
js 0xa8bf
movq 0xd711(%rip), %rdi      # 0x17fb8
leaq 0x480e(%rip), %rsi      # 0xf0bc
callq 0x4300
movq %rax, %rdi
callq 0x41a0
movb $0x1, %al
popq %rbx
retq
leaq 0x47e9(%rip), %rdi      # 0xf0af
callq 0x42a0
movl (%rbx), %edi
callq 0x45e0
pushq $0x1
popq %rdi
callq 0x43b0
// File: /workspace/github_cpp_makefile_star2_O2/guoxuanhan[P]NetServer/socket.cpp
// Function: Socket::Accept(sockaddr_in&)
int Socket::Accept(struct sockaddr_in &clientaddr)
{
    socklen_t lengthofsockaddr = sizeof(clientaddr);
    int clientfd = accept(serverfd_, (struct sockaddr*)&clientaddr, &lengthofsockaddr);
    if (clientfd < 0)
    {
        //perror("error accept");
        if(errno == EAGAIN)
            return 0;
        //std::cout << "error accept:there is no new connection accept..." << std::endl;
        return clientfd;
    }
    //std::cout << "server accept,clientfd: " << clientfd << std::endl;
    return clientfd;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
leaq 0xc(%rsp), %rdx
movl $0x10, (%rdx)
movl (%rdi), %edi
callq 0x40f0
movl %eax, %ebx
testl %eax, %eax
jns 0xa904
callq 0x4040
xorl %ecx, %ecx
cmpl $0xb, (%rax)
cmovel %ecx, %ebx
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/guoxuanhan[P]NetServer/tcpconnection.cpp
// Function: TcpConnection::HandleRead()
void TcpConnection::HandleRead()
{
    //接收数据，写入缓冲区
    int result = recvn(fd_, bufferin_);

    //业务回调,可以利用工作线程池处理，投递任务
    if(result > 0)
    {
        messagecallback_(shared_from_this(), bufferin_);//可以用右值引用优化
        //bufferin_.clear();
    }
    else if(result == 0)
    {
        HandleClose();
    }
    else
    {
        HandleError();
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movl 0x20(%rdi), %edi
leaq 0x38(%rbx), %r14
movq %r14, %rsi
callq 0xb4d7
testl %eax, %eax
jle 0xabeb
leaq 0x78(%rbx), %r15
leaq 0x8(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0xb90a
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0xb6aa
leaq 0x10(%rsp), %rdi
callq 0x6c7a
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rbx, %rdi
je 0xac00
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xae4e
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xacf8
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x6c7a
movq %rbx, %rdi
callq 0x4570
nop
// File: /workspace/github_cpp_makefile_star2_O2/guoxuanhan[P]NetServer/tcpconnection.cpp
// Function: TcpConnection::HandleWrite()
void TcpConnection::HandleWrite()
{
    int result = sendn(fd_, bufferout_);
    if(result > 0)
    {
        uint32_t events = spchannel_->GetEvents();
        if(bufferout_.size() > 0)
        {
            //缓冲区满了，数据没发完，就设置EPOLLOUT事件触发
            spchannel_->SetEvents(events | EPOLLOUT);
            loop_->UpdateChannelToPoller(spchannel_.get());
        }
        else
        {
            //数据已发完
            spchannel_->SetEvents(events & (~EPOLLOUT));
            sendcompletecallback_(shared_from_this());
            //发送完毕，如果是半关闭状态，则可以close了
            if(halfclose_)
                HandleClose();
        }
    }
    else if(result < 0)
    {
        HandleError();
    }
    else
    {
        HandleClose();
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movl 0x20(%rdi), %edi
leaq 0x58(%rbx), %rsi
callq 0xb201
testl %eax, %eax
jle 0xac76
movq 0x18(%rbx), %rdi
callq 0x49bc
cmpq $0x0, 0x60(%rbx)
movq 0x18(%rbx), %rdi
je 0xac89
orl $0x4, %eax
movl %eax, %esi
callq 0x49b8
movq 0x10(%rbx), %rdi
movq 0x18(%rbx), %rsi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0x5466
movq %rbx, %rdi
js 0xacd5
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0xacf8
andl $-0x5, %eax
movl %eax, %esi
callq 0x49b8
leaq 0x98(%rbx), %r14
movq %rsp, %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0xb90a
movq %r14, %rdi
movq %r15, %rsi
callq 0xb638
leaq 0x8(%rsp), %rdi
callq 0x6c7a
cmpb $0x1, 0x34(%rbx)
jne 0xaccb
movq %rbx, %rdi
callq 0xacf8
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0xae4e
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x6c7a
movq %rbx, %rdi
callq 0x4570
// File: /workspace/github_cpp_makefile_star2_O2/guoxuanhan[P]NetServer/tcpconnection.cpp
// Function: TcpConnection::HandleClose()
void TcpConnection::HandleClose()
{
    //移除事件
    //loop_->RemoveChannelToPoller(pchannel_);
    //连接标记为清理
    //task添加
    //loop_->AddTask(connectioncleanup_);
    //closecallback_(this);

    //20190217 优雅关闭，发完数据再关闭
    if(disconnected_) {return;}
    if(bufferout_.size() > 0 || bufferin_.size() > 0 || asyncprocessing_)
    {
        //如果还有数据待发送，则先发完,设置半关闭标志位
        halfclose_ = true;
        //还有数据刚刚才收到，但同时又收到FIN
        if(bufferin_.size() > 0)
        {
            messagecallback_(shared_from_this(), bufferin_);
        }
    }
    else
    {
        loop_->AddTask(std::bind(connectioncleanup_, shared_from_this()));
        closecallback_(shared_from_this());
        disconnected_ = true;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x68, %rsp
cmpb $0x0, 0x35(%rdi)
jne 0xae03
movq %rdi, %rbx
movq 0x40(%rdi), %rax
movq 0x60(%rdi), %rcx
orq %rax, %rcx
jne 0xad2c
cmpb $0x1, 0x36(%rbx)
jne 0xad6e
movb $0x1, 0x34(%rbx)
jmp 0xae03
movb $0x1, 0x34(%rbx)
testq %rax, %rax
je 0xae03
leaq 0x38(%rbx), %r14
leaq 0x78(%rbx), %r15
leaq 0x8(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0xb90a
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0xb6aa
leaq 0x10(%rsp), %rdi
callq 0x6c7a
jmp 0xae03
movq 0x10(%rbx), %r14
leaq 0xf8(%rbx), %r15
leaq 0x38(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0xb90a
leaq 0x8(%rsp), %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0xb99e
leaq 0x48(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0xb64c
leaq 0x48(%rsp), %rsi
movq %r14, %rdi
callq 0x549c
leaq 0x48(%rsp), %rdi
callq 0x4a60
leaq 0x8(%rsp), %rdi
callq 0xb694
leaq 0x40(%rsp), %rdi
callq 0x6c7a
leaq 0xb8(%rbx), %r14
leaq 0x8(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0xb90a
movq %r14, %rdi
movq %r15, %rsi
callq 0xb638
leaq 0x10(%rsp), %rdi
callq 0x6c7a
movb $0x1, 0x35(%rbx)
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0xae39
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x4a60
jmp 0xae23
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0xb694
jmp 0xae32
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
jmp 0xae41
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x6c7a
movq %rbx, %rdi
callq 0x4570
// File: /workspace/github_cpp_makefile_star2_O2/guoxuanhan[P]NetServer/tcpconnection.cpp
// Function: TcpConnection::HandleError()
void TcpConnection::HandleError()
{
    if(disconnected_) {return;}
    errorcallback_(shared_from_this());
    //loop_->RemoveChannelToPoller(pchannel_);
    //连接标记为清理
    //task添加
    loop_->AddTask(std::bind(connectioncleanup_, shared_from_this())); //自己不能清理自己，交给loop执行，Tcpserver清理
    disconnected_ = true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x68, %rsp
cmpb $0x0, 0x35(%rdi)
jne 0xaefb
movq %rdi, %rbx
leaq 0xd8(%rdi), %r14
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0xb90a
movq %r14, %rdi
movq %r15, %rsi
callq 0xb638
leaq 0x20(%rsp), %rdi
callq 0x6c7a
movq 0x10(%rbx), %r14
leaq 0xf8(%rbx), %r15
leaq 0x8(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0xb90a
leaq 0x18(%rsp), %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0xb99e
leaq 0x48(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0xb64c
leaq 0x48(%rsp), %rsi
movq %r14, %rdi
callq 0x549c
leaq 0x48(%rsp), %rdi
callq 0x4a60
leaq 0x18(%rsp), %rdi
callq 0xb694
leaq 0x10(%rsp), %rdi
callq 0x6c7a
movb $0x1, 0x35(%rbx)
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x4a60
jmp 0xaf19
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0xb694
jmp 0xaf28
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
jmp 0xaf37
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x6c7a
movq %rbx, %rdi
callq 0x4570
// File: /workspace/github_cpp_makefile_star2_O2/guoxuanhan[P]NetServer/tcpconnection.cpp
// Function: TcpConnection::~TcpConnection()
TcpConnection::~TcpConnection()
{
    //多线程下，加入loop的任务队列？不用，因为已经在当前loop线程
    //移除事件,析构成员变量
    loop_->RemoveChannelToPoller(spchannel_.get());
    close(fd_);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x10(%rdi), %rdi
movq 0x18(%rbx), %rsi
callq 0x545c
movl 0x20(%rbx), %edi
callq 0x45e0
leaq 0x18(%rbx), %r14
leaq 0xf8(%rbx), %rdi
callq 0x4a60
leaq 0xd8(%rbx), %rdi
callq 0x4a60
leaq 0xb8(%rbx), %rdi
callq 0x4a60
leaq 0x98(%rbx), %rdi
callq 0x4a60
leaq 0x78(%rbx), %rdi
callq 0x4a60
leaq 0x58(%rbx), %rdi
callq 0x4170
leaq 0x38(%rbx), %rdi
callq 0x4170
movq %r14, %rdi
callq 0xb5d6
addq $0x8, %rbx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xb6d8
movq %rax, %rdi
callq 0x4ada
// File: /workspace/github_cpp_makefile_star2_O2/guoxuanhan[P]NetServer/tcpconnection.cpp
// Function: TcpConnection::AddChannelToLoop()
void TcpConnection::AddChannelToLoop()
{
    //bug segement fault
    //https://blog.csdn.net/littlefang/article/details/37922113
    //多线程下，加入loop的任务队列
    //主线程直接执行
    //loop_->AddChannelToPoller(pchannel_);
    loop_->AddTask(std::bind(&EventLoop::AddChannelToPoller, loop_, spchannel_.get()));

}

// Assembly:
pushq %r14
pushq %rbx
subq $0x48, %rsp
movq 0x10(%rdi), %rbx
movq 0x18(%rdi), %rax
leaq -0x5cec(%rip), %rcx     # 0x52fc
leaq 0x28(%rsp), %rsi
movq %rcx, (%rsi)
andq $0x0, 0x8(%rsi)
movq %rax, 0x10(%rsi)
movq %rbx, 0x18(%rsi)
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xb5f0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x549c
leaq 0x8(%rsp), %rdi
callq 0x4a60
addq $0x48, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x4a60
movq %rbx, %rdi
callq 0x4570
// File: /workspace/github_cpp_makefile_star2_O2/guoxuanhan[P]NetServer/tcpconnection.cpp
// Function: TcpConnection::Send(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void TcpConnection::Send(const std::string &s)
{
    //std::cout << "TcpConnection::Send" << std::endl;
    bufferout_ += s; //跨线程消息投递成功
    //判断当前线程是不是Loop IO线程
    if(loop_->GetThreadId() == std::this_thread::get_id())
    {
        SendInLoop();
    }
    else
    {
        asyncprocessing_ = false; //异步调用结束
        //std::cout << "asyncprocessing_" << std::endl;
        loop_->AddTask(std::bind(&TcpConnection::SendInLoop, shared_from_this()));//跨线程调用,加入IO线程的任务队列，唤醒
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x50, %rsp
movq %rdi, %rbx
addq $0x58, %rdi
callq 0x45d0
movq 0x10(%rbx), %rdi
callq 0x5478
movq %rax, %r14
callq 0x42d0
cmpq %rax, %r14
jne 0xb078
movq %rbx, %rdi
addq $0x50, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0xb120
movb $0x0, 0x36(%rbx)
movq 0x10(%rbx), %r15
movq %rsp, %rdi
movq %rbx, %rsi
callq 0xb90a
leaq 0x8e(%rip), %rax        # 0xb120
leaq 0x48(%rsp), %r14
movq %rax, -0x18(%r14)
andq $0x0, -0x10(%r14)
leaq 0x8(%rsp), %rbx
movaps -0x8(%rbx), %xmm0
movups %xmm0, -0x8(%r14)
xorps %xmm0, %xmm0
movaps %xmm0, -0x8(%rbx)
leaq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x6ae4
leaq 0x10(%rsp), %rsi
movq %r15, %rdi
callq 0x549c
leaq 0x10(%rsp), %rdi
callq 0x4a60
movq %r14, %rdi
callq 0x6c7a
movq %rbx, %rdi
callq 0x6c7a
addq $0x50, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %r15
leaq 0x10(%rsp), %rdi
callq 0x4a60
jmp 0xb107
movq %rax, %r15
movq %r14, %rdi
callq 0x6c7a
movq %rbx, %rdi
callq 0x6c7a
movq %r15, %rdi
callq 0x4570
nop
// File: /workspace/github_cpp_makefile_star2_O2/guoxuanhan[P]NetServer/tcpconnection.cpp
// Function: TcpConnection::SendInLoop()
void TcpConnection::SendInLoop()
{
    //bufferout_ += s;//copy一次
    if(disconnected_)
    {
        return;
    }
    int result = sendn(fd_, bufferout_);
    if(result > 0)
    {
        uint32_t events = spchannel_->GetEvents();
        if(bufferout_.size() > 0)
        {
            //缓冲区满了，数据没发完，就设置EPOLLOUT事件触发
            spchannel_->SetEvents(events | EPOLLOUT);
            loop_->UpdateChannelToPoller(spchannel_.get());
        }
        else
        {
            //数据已发完
            spchannel_->SetEvents(events & (~EPOLLOUT));
            sendcompletecallback_(shared_from_this());
            //20190217
            if(halfclose_)
                HandleClose();
        }
    }
    else if(result < 0)
    {
        HandleError();
    }
    else
    {
        HandleClose();
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
cmpb $0x0, 0x35(%rdi)
je 0xb139
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rdi, %rbx
movl 0x20(%rdi), %edi
leaq 0x58(%rbx), %rsi
callq 0xb201
testl %eax, %eax
jle 0xb180
movq 0x18(%rbx), %rdi
callq 0x49bc
cmpq $0x0, 0x60(%rbx)
movq 0x18(%rbx), %rdi
je 0xb193
orl $0x4, %eax
movl %eax, %esi
callq 0x49b8
movq 0x10(%rbx), %rdi
movq 0x18(%rbx), %rsi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0x5466
movq %rbx, %rdi
js 0xb1de
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0xacf8
andl $-0x5, %eax
movl %eax, %esi
callq 0x49b8
leaq 0x98(%rbx), %r14
movq %rsp, %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0xb90a
movq %r14, %rdi
movq %r15, %rsi
callq 0xb638
leaq 0x8(%rsp), %rdi
callq 0x6c7a
cmpb $0x1, 0x34(%rbx)
jne 0xb12f
movq %rbx, %rdi
callq 0xacf8
jmp 0xb12f
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0xae4e
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x6c7a
movq %rbx, %rdi
callq 0x4570
// File: /workspace/github_cpp_makefile_star2_O2/guoxuanhan[P]NetServer/tcpconnection.cpp
// Function: TcpConnection::Shutdown()
void TcpConnection::Shutdown()
{
    if(loop_->GetThreadId() == std::this_thread::get_id())
    {
        ShutdownInLoop();
    }
    else
    {
        //不是IO线程，则是跨线程调用,加入IO线程的任务队列，唤醒
        loop_->AddTask(std::bind(&TcpConnection::ShutdownInLoop, shared_from_this()));
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x50, %rsp
movq %rdi, %rbx
movq 0x10(%rdi), %rdi
callq 0x5478
movq %rax, %r14
callq 0x42d0
cmpq %rax, %r14
jne 0xb323
movq %rbx, %rdi
addq $0x50, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0xb3c6
movq 0x10(%rbx), %r15
movq %rsp, %rdi
movq %rbx, %rsi
callq 0xb90a
leaq 0x8d(%rip), %rax        # 0xb3c6
leaq 0x48(%rsp), %r14
movq %rax, -0x18(%r14)
andq $0x0, -0x10(%r14)
leaq 0x8(%rsp), %rbx
movaps -0x8(%rbx), %xmm0
movups %xmm0, -0x8(%r14)
xorps %xmm0, %xmm0
movaps %xmm0, -0x8(%rbx)
leaq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x6ae4
leaq 0x10(%rsp), %rsi
movq %r15, %rdi
callq 0x549c
leaq 0x10(%rsp), %rdi
callq 0x4a60
movq %r14, %rdi
callq 0x6c7a
movq %rbx, %rdi
callq 0x6c7a
addq $0x50, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %r15
leaq 0x10(%rsp), %rdi
callq 0x4a60
jmp 0xb3ae
movq %rax, %r15
movq %r14, %rdi
callq 0x6c7a
movq %rbx, %rdi
callq 0x6c7a
movq %r15, %rdi
callq 0x4570
// File: /workspace/github_cpp_makefile_star2_O2/guoxuanhan[P]NetServer/tcpconnection.cpp
// Function: TcpConnection::ShutdownInLoop()
void TcpConnection::ShutdownInLoop()
{
    if(disconnected_) {return;}
    std::cout << "shutdown" << std::endl;
    closecallback_(shared_from_this()); //应用层清理连接回调
    loop_->AddTask(std::bind(connectioncleanup_, shared_from_this())); //自己不能清理自己，交给loop执行，Tcpserver清理TcpConnection
    disconnected_ = true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x68, %rsp
cmpb $0x0, 0x35(%rdi)
jne 0xb48e
movq %rdi, %rbx
movq 0xcbd3(%rip), %rdi      # 0x17fb8
leaq 0x3d18(%rip), %rsi      # 0xf104
callq 0x4300
movq %rax, %rdi
callq 0x41a0
leaq 0xb8(%rbx), %r14
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0xb90a
movq %r14, %rdi
movq %r15, %rsi
callq 0xb638
leaq 0x20(%rsp), %rdi
callq 0x6c7a
movq 0x10(%rbx), %r14
leaq 0xf8(%rbx), %r15
leaq 0x8(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0xb90a
leaq 0x18(%rsp), %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0xb99e
leaq 0x48(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0xb64c
leaq 0x48(%rsp), %rsi
movq %r14, %rdi
callq 0x549c
leaq 0x48(%rsp), %rdi
callq 0x4a60
leaq 0x18(%rsp), %rdi
callq 0xb694
leaq 0x10(%rsp), %rdi
callq 0x6c7a
movb $0x1, 0x35(%rbx)
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x4a60
jmp 0xb4ac
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0xb694
jmp 0xb4bb
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
jmp 0xb4ca
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x6c7a
movq %rbx, %rdi
callq 0x4570
// File: /workspace/github_cpp_makefile_star2_O2/guoxuanhan[P]NetServer/tcpconnection.cpp
// Function: recvn(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
int recvn(int fd, std::string &bufferin)
{
    int nbyte = 0;
    int readsum = 0;
    char buffer[BUFSIZE];
    for(;;)
    {
        //nbyte = recv(fd, buffer, BUFSIZE, 0);
        nbyte = read(fd, buffer, BUFSIZE);

        if (nbyte > 0)
        {
            bufferin.append(buffer, nbyte);//效率较低，2次拷贝
            readsum += nbyte;
            if(nbyte < BUFSIZE)
                return readsum;//读优化，减小一次读调用，因为一次调用耗时10+us
            else
                continue;
        }
        else if (nbyte < 0)//异常
        {
            if (errno == EAGAIN)//系统缓冲区未有数据，非阻塞返回
            {
                //std::cout << "EAGAIN,系统缓冲区未有数据，非阻塞返回" << std::endl;
                return readsum;
            }
            else if (errno == EINTR)
            {
                std::cout << "errno == EINTR" << std::endl;
                continue;
            }
            else
            {
                //可能是RST
                perror("recv error");
                //std::cout << "recv error" << std::endl;
                return -1;
            }
        }
        else//返回0，客户端关闭socket，FIN
        {
            //std::cout << "client close the Socket" << std::endl;
            return 0;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1018, %rsp           # imm = 0x1018
movq %rsi, 0x8(%rsp)
movl %edi, %ebp
xorl %ebx, %ebx
leaq 0x10(%rsp), %r15
movq 0xcabb(%rip), %r12      # 0x17fb8
leaq 0x3c3c(%rip), %r13      # 0xf140
movl $0x1000, %edx           # imm = 0x1000
movl %ebp, %edi
movq %r15, %rsi
callq 0x4440
movq %rax, %r14
testl %r14d, %r14d
jg 0xb53e
jns 0xb578
callq 0x4040
movl (%rax), %eax
cmpl $0x4, %eax
jne 0xb562
movq %r12, %rdi
movq %r13, %rsi
callq 0x4300
movq %rax, %rdi
callq 0x41a0
jmp 0xb504
movl %r14d, %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x4050
addl %r14d, %ebx
cmpl $0x1000, %r14d          # imm = 0x1000
jae 0xb504
jmp 0xb57a
cmpl $0xb, %eax
je 0xb57a
leaq 0x3b9f(%rip), %rdi      # 0xf10d
callq 0x42a0
pushq $-0x1
popq %rbx
jmp 0xb57a
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x1018, %rsp           # imm = 0x1018
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/guoxuanhan[P]NetServer/tcpserver.cpp
// Function: TcpServer::TcpServer(EventLoop*, int, int)
TcpServer::TcpServer(EventLoop* loop, const int port, const int threadnum)
    : serversocket_(),
    loop_(loop),
    serverchannel_(),
    conncount_(0),
    eventloopthreadpool(loop, threadnum)
{
    //serversocket_.SetSocketOption();
    serversocket_.SetReuseAddr();
    serversocket_.BindAddress(port);
    serversocket_.Listen();
    serversocket_.Setnonblocking();

    serverchannel_.SetFd(serversocket_.fd());
    serverchannel_.SetReadHandle(std::bind(&TcpServer::OnNewConnection, this));
    serverchannel_.SetErrorHandle(std::bind(&TcpServer::OnConnectionError, this));

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %ecx, %r12d
movl %edx, %ebp
movq %rsi, %r13
movq %rdi, %rbx
callq 0xa714
movq %r13, 0x8(%rbx)
leaq 0x10(%rbx), %r14
movq %r14, %rdi
callq 0x495c
andl $0x0, 0x98(%rbx)
andl $0x0, 0xa8(%rbx)
andq $0x0, 0xb0(%rbx)
leaq 0xa8(%rbx), %rax
movq %rax, 0xb8(%rbx)
movq %rax, 0xc0(%rbx)
leaq 0xf8(%rbx), %r15
xorps %xmm0, %xmm0
movups %xmm0, 0xc8(%rbx)
movups %xmm0, 0xd8(%rbx)
movups %xmm0, 0xe8(%rbx)
movq %r15, %rdi
movq %r13, %rsi
movl %r12d, %edx
callq 0x5c50
leaq 0x128(%rbx), %r12
movl $0xa0, %edx
movq %r12, %rdi
xorl %esi, %esi
callq 0x41f0
movq %rbx, %rdi
callq 0xa796
movq %rbx, %rdi
movl %ebp, %esi
callq 0xa81a
movq %rbx, %rdi
callq 0xa88c
movq %rbx, %rdi
callq 0xa7b6
movl (%rbx), %esi
movq %r14, %rdi
callq 0x49b0
leaq 0x115(%rip), %rax       # 0xbd34
leaq 0x30(%rsp), %rsi
movq %rax, (%rsi)
andq $0x0, 0x8(%rsi)
movq %rbx, 0x10(%rsi)
leaq 0x10(%rsp), %rdi
callq 0xc11e
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x4a38
leaq 0x10(%rsp), %rdi
callq 0x4a60
leaq 0x350(%rip), %rax       # 0xbfa8
leaq 0x30(%rsp), %rsi
movq %rax, (%rsi)
andq $0x0, 0x8(%rsi)
movq %rbx, 0x10(%rsi)
leaq 0x10(%rsp), %rdi
callq 0xc11e
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x4a4c
leaq 0x10(%rsp), %rdi
callq 0x4a60
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xbc9d
jmp 0xbcbb
movq %rax, (%rsp)
leaq 0x10(%rsp), %rdi
callq 0x4a60
jmp 0xbcbf
jmp 0xbcbb
movq %rax, (%rsp)
jmp 0xbd0f
movq %rax, (%rsp)
jmp 0xbd23
movq %rax, (%rsp)
leaq 0x148(%rbx), %rax
movq %rax, 0x8(%rsp)
leaq 0x168(%rbx), %r13
leaq 0x188(%rbx), %rbp
leaq 0x1a8(%rbx), %rdi
callq 0x4a60
movq %rbp, %rdi
callq 0x4a60
movq %r13, %rdi
callq 0x4a60
movq 0x8(%rsp), %rdi
callq 0x4a60
movq %r12, %rdi
callq 0x4a60
movq %r15, %rdi
callq 0x5cda
leaq 0xa0(%rbx), %rdi
callq 0xc220
movq %r14, %rdi
callq 0x4984
movq %rbx, %rdi
callq 0xa766
movq (%rsp), %rdi
callq 0x4570
// File: /workspace/github_cpp_makefile_star2_O2/guoxuanhan[P]NetServer/tcpserver.cpp
// Function: Setnonblocking(int)
void Setnonblocking(int fd)
{
    int opts = fcntl(fd, F_GETFL);
    if (opts < 0)
    {
        perror("fcntl(fd,GETFL)");
        exit(1);
    }
    if (fcntl(fd, F_SETFL, opts | O_NONBLOCK) < 0)
    {
        perror("fcntl(fd,SETFL,opts)");
        exit(1);
    }
}

// Assembly:
pushq %rbx
movl %edi, %ebx
pushq $0x3
popq %rsi
xorl %eax, %eax
callq 0x4200
testl %eax, %eax
js 0xc09b
orl $0x800, %eax            # imm = 0x800
pushq $0x4
popq %rsi
movl %ebx, %edi
movl %eax, %edx
xorl %eax, %eax
callq 0x4200
testl %eax, %eax
js 0xc0a4
popq %rbx
retq
leaq 0x3368(%rip), %rdi      # 0xf40a
jmp 0xc0ab
leaq 0x336f(%rip), %rdi      # 0xf41a
callq 0x42a0
pushq $0x1
popq %rdi
callq 0x43b0
// File: /workspace/github_cpp_makefile_star2_O2/guoxuanhan[P]NetServer/tcpserver.cpp
// Function: TcpServer::RemoveConnection(std::shared_ptr<TcpConnection>)
void TcpServer::RemoveConnection(std::shared_ptr<TcpConnection> sptcpconnection)
{
    std::lock_guard<std::mutex> lock(mutex_);
    --conncount_;
    //std::cout << "clean up connection, conncount is" << conncount_ << std::endl;
    tcpconnlist_.erase(sptcpconnection->fd());
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r14
movq %rdi, %r15
leaq 0xd0(%rdi), %rbx
movq %rbx, %rdi
callq 0x56bc
decl 0x98(%r15)
addq $0xa0, %r15
movq (%r14), %rax
movl 0x20(%rax), %eax
leaq 0xc(%rsp), %rsi
movl %eax, (%rsi)
movq %r15, %rdi
callq 0xc970
movq %rbx, %rdi
callq 0x4280
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x4280
movq %r14, %rdi
callq 0x4570
// File: /workspace/github_cpp_makefile_star2_O2/guoxuanhan[P]NetServer/threadpool.cpp
// Function: ThreadPool::~ThreadPool()
ThreadPool::~ThreadPool()
{
    std::cout<< "Clean up the ThreadPool!" << std::endl;
    Stop();
    for(int i = 0; i < threadnum_; i++)
    {
        threadlist_[i]->join();
    }
    for(int i = 0; i < threadnum_; i++)
    {
        delete threadlist_[i];
    }
    threadlist_.clear();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0xb450(%rip), %rdi      # 0x17fb8
leaq 0x2a74(%rip), %rsi      # 0xf5e3
callq 0x4300
movq %rax, %rdi
callq 0x41a0
movq %rbx, %rdi
callq 0xcc14
leaq 0x8(%rbx), %r14
xorl %r15d, %r15d
movslq 0x4(%rbx), %rax
cmpq %rax, %r15
jge 0xcba5
movq (%r14), %rax
movq (%rax,%r15,8), %rdi
callq 0x4540
incq %r15
jmp 0xcb8b
xorl %r12d, %r12d
movslq %eax, %rcx
movq (%r14), %rax
cmpq %rcx, %r12
jge 0xcbd4
movq (%rax,%r12,8), %r15
testq %r15, %r15
je 0xcbc4
movq %r15, %rdi
callq 0x5b52
movq %r15, %rdi
callq 0x42f0
incq %r12
movl 0x4(%rbx), %eax
jmp 0xcba8
cmpq %rax, 0x10(%rbx)
je 0xcbde
movq %rax, 0x10(%rbx)
leaq 0x98(%rbx), %rdi
callq 0x4590
addq $0x20, %rbx
movq %rbx, %rdi
callq 0xd06e
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xd338
jmp 0xcc0b
movq %rax, %rdi
callq 0x4ada
nop
// File: /workspace/github_cpp_makefile_star2_O2/guoxuanhan[P]NetServer/threadpool.cpp
// Function: ThreadPool::Start()
void ThreadPool::Start()
{
    if(threadnum_ > 0)
    {
        started_ = true;
        for(int i = 0; i < threadnum_; i++)
        {
            std::thread *pthread = new std::thread(&ThreadPool::ThreadFunc, this);
            threadlist_.push_back(pthread);
        }
    } else
    {
        std::cout<< "ThreadPool: threadnum < 0!" << std::endl;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl 0x4(%rdi), %eax
testl %eax, %eax
jle 0xccae
movq %rdi, %rbx
movb $0x1, (%rdi)
leaq 0x8(%rdi), %r14
xorl %r12d, %r12d
leaq 0x8(%rsp), %r13
leaq 0x10(%rsp), %rbp
cmpl %eax, %r12d
jge 0xcc9f
pushq $0x8
popq %rdi
callq 0x4320
movq %rax, %r15
leaq 0x83(%rip), %rax        # 0xccea
movq %rax, 0x18(%rsp)
andq $0x0, 0x20(%rsp)
movq %rbx, 0x8(%rsp)
movq %r15, %rdi
leaq 0x18(%rsp), %rsi
movq %r13, %rdx
callq 0xcf76
movq %r15, 0x10(%rsp)
movq %r14, %rdi
movq %rbp, %rsi
callq 0xcff4
incl %r12d
movl 0x4(%rbx), %eax
jmp 0xcc50
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xb303(%rip), %rdi      # 0x17fb8
leaq 0x2940(%rip), %rsi      # 0xf5fc
callq 0x4300
movq %rax, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x41a0
movq %rax, %rbx
movq %r15, %rdi
callq 0x42f0
movq %rbx, %rdi
callq 0x4570
// File: /workspace/github_cpp_makefile_star2_O2/guoxuanhan[P]NetServer/threadpool.cpp
// Function: ThreadPool::AddTask(std::function<void ()>)
void ThreadPool::AddTask(Task task)
{
    {
        std::lock_guard<std::mutex> lock(mutex_);
        taskqueue_.push(task);
    }
    //依次唤醒等待队列的线程
    condition_.notify_one();
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x70(%rdi), %r14
movq %r14, %rdi
callq 0x56bc
leaq 0x20(%rbx), %rdi
movq %r15, %rsi
callq 0xd4cc
movq %r14, %rdi
callq 0x4280
addq $0x98, %rbx
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x41c0
movq %rax, %rbx
movq %r14, %rdi
callq 0x4280
movq %rbx, %rdi
callq 0x4570
// File: /workspace/github_cpp_makefile_star2_O2/guoxuanhan[P]NetServer/timer.cpp
// Function: Timer::Adjust(int, Timer::TimerType, std::function<void ()> const&)
void Timer::Adjust(int timeout, Timer::TimerType timertype, const CallBack &timercallback)
{
    timeout_ = timeout;
    timertype_ = timertype;
    timercallback_ = timercallback;
    TimerManager::GetTimerManagerInstance()->AdjustTimer(this);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl %esi, (%rdi)
movl %edx, 0x4(%rdi)
addq $0x8, %rdi
movq %rcx, %rsi
callq 0x4a8c
callq 0xd8fc
movq %rax, %rdi
movq %rbx, %rsi
popq %rbx
jmp 0xdaa6
// File: /workspace/github_cpp_makefile_star2_O2/guoxuanhan[P]NetServer/timermanager.cpp
// Function: TimerManager::GetTimerManagerInstance()
TimerManager* TimerManager::GetTimerManagerInstance()
{
    if(ptimermanager_ == nullptr) //指针为空，则创建管理器
    {
        std::lock_guard<std::mutex> lock(mutex_);
        if(ptimermanager_ == nullptr) //双重检测
        {
            ptimermanager_ = new TimerManager();
        }
    }
    return ptimermanager_;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq 0xaa59(%rip), %rax      # 0x18360
testq %rax, %rax
jne 0xd94f
leaq 0xaa55(%rip), %rdi      # 0x18368
callq 0x56bc
cmpq $0x0, 0xaa40(%rip)      # 0x18360
jne 0xd93c
pushq $0x58
popq %rdi
callq 0x4320
movq %rax, %r14
movq %rax, %rdi
callq 0xd87c
movq %r14, 0xaa24(%rip)      # 0x18360
leaq 0xaa25(%rip), %rdi      # 0x18368
callq 0x4280
movq 0xaa11(%rip), %rax      # 0x18360
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
movq %r14, %rdi
callq 0x42f0
jmp 0xd967
movq %rax, %rbx
leaq 0xa9fa(%rip), %rdi      # 0x18368
callq 0x4280
movq %rbx, %rdi
callq 0x4570
nop
// File: /workspace/github_cpp_makefile_star2_O2/guoxuanhan[P]NetServer/timermanager.cpp
// Function: TimerManager::AddTimer(Timer*)
void TimerManager::AddTimer(Timer* ptimer)
{
    if(ptimer == nullptr)
        return;
    std::lock_guard<std::mutex> lock(timewheelmutex_);
    CalculateTimer(ptimer);
    AddTimerToTimeWheel(ptimer);
}

// Assembly:
testq %rsi, %rsi
je 0xd9d1
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x20(%rdi), %r15
movq %r15, %rdi
callq 0x56bc
movl (%rbx), %ecx
cmpl $0x2, %ecx
pushq $0x1
popq %rax
cmovgel %ecx, %eax
movl %eax, %ecx
shrl $0xa, %ecx
movl %ecx, 0x28(%rbx)
addl (%r14), %eax
movl $0x400, %ecx            # imm = 0x400
cltd
idivl %ecx
movl %edx, 0x2c(%rbx)
movq %r14, %rdi
movq %rbx, %rsi
callq 0xd9f8
movq %r15, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x4280
retq
// File: /workspace/github_cpp_makefile_star2_O2/guoxuanhan[P]NetServer/timermanager.cpp
// Function: TimerManager::RemoveTimer(Timer*)
void TimerManager::RemoveTimer(Timer* ptimer)
{
    if(ptimer == nullptr)
        return;
    std::lock_guard<std::mutex> lock(timewheelmutex_);
    RemoveTimerFromTimeWheel(ptimer);
}

// Assembly:
testq %rsi, %rsi
je 0xda54
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x20(%rdi), %r15
movq %r15, %rdi
callq 0x56bc
movq %r14, %rdi
movq %rbx, %rsi
callq 0xda56
movq %r15, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x4280
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/guoxuanhan[P]NetServer/timermanager.cpp
// Function: TimerManager::AdjustTimer(Timer*)
void TimerManager::AdjustTimer(Timer* ptimer)
{
    if(ptimer == nullptr)
        return;

    std::lock_guard<std::mutex> lock(timewheelmutex_);
    AdjustTimerToWheel(ptimer);
}

// Assembly:
testq %rsi, %rsi
je 0xdada
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x20(%rdi), %r15
movq %r15, %rdi
callq 0x56bc
movq %r14, %rdi
movq %rbx, %rsi
callq 0xdadc
movq %r15, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x4280
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/guoxuanhan[P]NetServer/timermanager.cpp
// Function: TimerManager::AdjustTimerToWheel(Timer*)
void TimerManager::AdjustTimerToWheel(Timer* ptimer)
{
    if(ptimer == nullptr)
        return;

    RemoveTimerFromTimeWheel(ptimer);
    CalculateTimer(ptimer);
    AddTimerToTimeWheel(ptimer);
}

// Assembly:
testq %rsi, %rsi
je 0xdb23
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0xda56
movl (%rbx), %ecx
cmpl $0x2, %ecx
pushq $0x1
popq %rax
cmovgel %ecx, %eax
movl %eax, %ecx
shrl $0xa, %ecx
movl %ecx, 0x28(%rbx)
addl (%r14), %eax
movl $0x400, %ecx            # imm = 0x400
cltd
idivl %ecx
movl %edx, 0x2c(%rbx)
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xd9f8
retq
// File: /workspace/github_cpp_makefile_star2_O2/guoxuanhan[P]NetServer/timermanager.cpp
// Function: TimerManager::CheckTimer()
void TimerManager::CheckTimer()//执行当前slot的任务
{
    std::lock_guard<std::mutex> lock(timewheelmutex_);
    Timer *ptimer = timewheel[currentslot];
    while(ptimer != nullptr)
    {
        if(ptimer->rotation > 0)
        {
            --ptimer->rotation;
            ptimer = ptimer->next;
        }
        else
        {
            //可执行定时器任务
            ptimer->timercallback_(); //注意：任务里不能把定时器自身给清理掉！！！我认为应该先移除再执行任务
            if(ptimer->timertype_ == Timer::TimerType::TIMER_ONCE)
            {
                Timer *ptemptimer = ptimer;
                ptimer = ptimer->next;
                RemoveTimerFromTimeWheel(ptemptimer);
            }
            else
            {
                Timer *ptemptimer = ptimer;
                ptimer = ptimer->next;
                AdjustTimerToWheel(ptemptimer);
                if(currentslot == ptemptimer->timeslot && ptemptimer->rotation > 0)
                {
                    //如果定时器多于一转的话，需要先对rotation减1，否则会等待两个周期
                    --ptemptimer->rotation;
                }
            }
        }
    }
    currentslot = (++currentslot) % TimerManager::slotnum; //移动至下一个时间槽
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
leaq 0x20(%rdi), %rbx
movq %rbx, %rdi
callq 0x56bc
movslq (%r14), %rax
movq 0x8(%r14), %rcx
movq (%rcx,%rax,8), %r12
testq %r12, %r12
je 0xdba5
movq %r12, %r15
movl 0x28(%r12), %eax
testl %eax, %eax
jle 0xdb63
decl %eax
movl %eax, 0x28(%r15)
movq 0x38(%r15), %r12
jmp 0xdb46
leaq 0x8(%r15), %rdi
callq 0x4a7c
cmpl $0x0, 0x4(%r15)
movq 0x38(%r15), %r12
movq %r14, %rdi
je 0xdb9b
movq %r15, %rsi
callq 0xdadc
movl (%r14), %eax
cmpl 0x2c(%r15), %eax
jne 0xdb46
movl 0x28(%r15), %eax
testl %eax, %eax
jle 0xdb46
decl %eax
movl %eax, 0x28(%r15)
jmp 0xdb46
movq %r15, %rsi
callq 0xda56
jmp 0xdb46
movl (%r14), %eax
incl %eax
movl $0x400, %ecx            # imm = 0x400
cltd
idivl %ecx
movl %edx, (%r14)
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x4280
movq %rax, %r14
movq %rbx, %rdi
callq 0x4280
movq %r14, %rdi
callq 0x4570
nop
// File: /workspace/github_cpp_makefile_star2_O2/guoxuanhan[P]NetServer/timermanager.cpp
// Function: TimerManager::CheckTick()
void TimerManager::CheckTick()
{
    // steady_clock::time_point t1 = steady_clock::now();
    // steady_clock::time_point t2 = steady_clock::now();
    // duration<double> time_span;
    int si = TimerManager::slotinterval;
    struct timeval tv;
    gettimeofday(&tv, NULL);
    int oldtime = (tv.tv_sec % 10000) * 1000 + tv.tv_usec / 1000;
    int time;
    int tickcount;
    while(running_)
    {
        gettimeofday(&tv, NULL);
        time = (tv.tv_sec % 10000) * 1000 + tv.tv_usec / 1000;
        tickcount = (time - oldtime)/slotinterval; //计算两次check的时间间隔占多少个slot
        //oldtime = time;
        oldtime = oldtime + tickcount*slotinterval;

        for(int i = 0; i < tickcount; ++i)
        {
            TimerManager::GetTimerManagerInstance()->CheckTimer();
        }
        std::this_thread::sleep_for(std::chrono::microseconds(500)); //milliseconds(si)时间粒度越小，延时越不精确，因为上下文切换耗时
        // t2 = steady_clock::now();
        // time_span = duration_cast<duration<double>>(t2 - t1);
        // t1 = t2;
        // std::cout << "thread " << time_span.count() << " seconds." << std::endl;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x8(%rsp), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x44f0
movq (%r14), %rax
movq 0x8(%r14), %rcx
movl $0x2710, %esi           # imm = 0x2710
cqto
idivq %rsi
imull $0x3e8, %edx, %esi      # imm = 0x3E8
movl $0x3e8, %ebp            # imm = 0x3E8
movq %rcx, %rax
cqto
idivq %rbp
movq %rax, %r12
addl %esi, %r12d
movq %rsp, %r15
cmpb $0x1, 0x48(%rbx)
jne 0xdc9f
leaq 0x8(%rsp), %rdi
xorl %esi, %esi
callq 0x44f0
movq 0x8(%rsp), %rax
movq 0x10(%rsp), %rcx
cqto
movl $0x2710, %esi           # imm = 0x2710
idivq %rsi
imull $0x3e8, %edx, %esi      # imm = 0x3E8
movq %rcx, %rax
cqto
idivq %rbp
movq %rax, %r13
addl %esi, %r13d
movl %r13d, %r14d
subl %r12d, %r14d
testl %r14d, %r14d
movl $0x0, %eax
cmovlel %eax, %r14d
subl $0x1, %r14d
jb 0xdc8a
callq 0xd8fc
movq %rax, %rdi
callq 0xdb24
jmp 0xdc75
movq $0x1f4, (%rsp)          # imm = 0x1F4
movq %r15, %rdi
callq 0xdd7a
movl %r13d, %r12d
jmp 0xdc29
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/bonetblai[P]mdp-engine/race/./race.h
// Function: state_t::operator<(state_t const&) const
bool operator<(const state_t &s) const {
        return (x_ < s.x_) ||
               ((x_ == s.x_) && (y_ < s.y_)) ||
               ((x_ == s.x_) && (y_ == s.y_) && (dx_ < s.dx_)) ||
               ((x_ == s.x_) && (y_ == s.y_) && (dx_ == s.dx_) && (dy_ < s.dy_));
    }

// Assembly:
movzwl (%rdi), %ecx
movzwl (%rsi), %edx
movb $0x1, %al
cmpw %dx, %cx
jl 0x1bc78
jne 0x1bc76
movzwl 0x2(%rdi), %ecx
movzwl 0x2(%rsi), %edx
cmpw %dx, %cx
jl 0x1bc78
jne 0x1bc76
movzwl 0x4(%rdi), %ecx
cmpw 0x4(%rsi), %cx
jl 0x1bc78
movzwl 0x4(%rdi), %eax
cmpw 0x4(%rsi), %ax
jne 0x1bc76
movzwl 0x6(%rdi), %eax
cmpw 0x6(%rsi), %ax
setl %al
retq
xorl %eax, %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/bonetblai[P]mdp-engine/race/parsing.cc
// Function: ps::header(std::ostream&, unsigned long, unsigned long)
void header(ostream &os, size_t rows, size_t cols) {
    os << "%!PS-Adobe-2.0 EPSF-1.2" << endl
       << "%%Creator: unknown" << endl
       << "%%DocumentFonts:" << endl
       << "%%Pages: 1" << endl
       << "%%BoundingBox: 0 0 " << (cols+2)*BOXW << " " << (rows+2)*BOXW << endl
       << "%%EndComments" << endl
       << "%%EndProlog" << endl
       << "%%Page: 1 1" << endl
       << "0 setlinewidth " << BOXW << " " << BOXW << " translate" << endl;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %rbx
leaq 0x47a7(%rip), %rsi      # 0x20c38
callq 0x5270
movq %rax, %rdi
callq 0x5100
leaq 0x47ab(%rip), %rsi      # 0x20c50
movq %rax, %rdi
callq 0x5270
movq %rax, %rdi
callq 0x5100
leaq 0x47a7(%rip), %rsi      # 0x20c63
movq %rax, %rdi
callq 0x5270
movq %rax, %rdi
callq 0x5100
leaq 0x47a1(%rip), %rsi      # 0x20c74
movq %rax, %rdi
callq 0x5270
movq %rax, %rdi
callq 0x5100
leaq 0x4795(%rip), %rsi      # 0x20c7f
movq %rax, %rdi
callq 0x5270
imulq $0xa, %r14, %rsi
addq $0x14, %rsi
movq %rax, %rdi
callq 0x5180
leaq 0x4975(%rip), %r14      # 0x20e7e
movq %rax, %rdi
movq %r14, %rsi
callq 0x5270
imulq $0xa, %rbx, %rsi
addq $0x14, %rsi
movq %rax, %rdi
callq 0x5180
movq %rax, %rdi
callq 0x5100
leaq 0x4760(%rip), %rsi      # 0x20c93
movq %rax, %rdi
callq 0x5270
movq %rax, %rdi
callq 0x5100
leaq 0x4757(%rip), %rsi      # 0x20ca1
movq %rax, %rdi
callq 0x5270
movq %rax, %rdi
callq 0x5100
leaq 0x474c(%rip), %rsi      # 0x20cad
movq %rax, %rdi
callq 0x5270
movq %rax, %rdi
callq 0x5100
leaq 0x4741(%rip), %rsi      # 0x20cb9
movq %rax, %rdi
callq 0x5270
pushq $0xa
popq %rbx
movq %rax, %rdi
movl %ebx, %esi
callq 0x5420
movq %rax, %rdi
movq %r14, %rsi
callq 0x5270
movq %rax, %rdi
movl %ebx, %esi
callq 0x5420
leaq 0x4720(%rip), %rsi      # 0x20cc9
movq %rax, %rdi
callq 0x5270
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x5100
// File: /workspace/github_cpp_makefile_star2_O2/bonetblai[P]mdp-engine/race/parsing.cc
// Function: ps::draw_filled_rectangle(std::ostream&, int, int, int, int, int, int, int)
void draw_filled_rectangle(ostream &os, int x, int y, int dx, int dy, int r, int g, int b) {
    os << r << " " << g << " " << b << " setrgbcolor" << endl
       << "newpath " << x << " " << y << " moveto "
       << dx << " 0 rlineto 0 " << dy << " rlineto "
       << -dx << " 0 rlineto closepath fill" << endl
       << "0 0 0 setrgbcolor" << endl
       << "newpath " << x << " " << y << " moveto "
       << dx << " 0 rlineto 0 " << dy << " rlineto " << -dx
       << " 0 rlineto closepath stroke" << endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r8d, 0x4(%rsp)
movl %ecx, %r13d
movl %edx, %r12d
movl %esi, %r15d
movl 0x48(%rsp), %ebp
movl 0x40(%rsp), %ebx
movl %r9d, %esi
callq 0x5420
leaq 0x4878(%rip), %r14      # 0x20e7e
movq %rax, %rdi
movq %r14, %rsi
callq 0x5270
movq %rax, %rdi
movl %ebx, %esi
callq 0x5420
movq %rax, %rdi
movq %r14, %rsi
movq %r14, %rbx
callq 0x5270
movq %rax, %rdi
movl %ebp, %esi
callq 0x5420
leaq 0x46e9(%rip), %rsi      # 0x20d23
movq %rax, %rdi
callq 0x5270
movq %rax, %rdi
callq 0x5100
leaq 0x4689(%rip), %rsi      # 0x20cda
movq %rax, %rdi
callq 0x5270
movq %rax, %rdi
movl %r15d, %esi
callq 0x5420
movq %rax, %rdi
movq %r14, %rsi
callq 0x5270
movq %rax, %rdi
movl %r12d, %r14d
movl %r12d, %esi
callq 0x5420
leaq 0x465f(%rip), %rsi      # 0x20ce3
movq %rax, %rdi
callq 0x5270
movq %rax, %rdi
movl %r13d, %esi
callq 0x5420
leaq 0x464e(%rip), %rsi      # 0x20cec
movq %rax, %rdi
callq 0x5270
movq %rax, %rdi
movl 0x4(%rsp), %r12d
movl %r12d, %esi
callq 0x5420
leaq 0x463d(%rip), %rsi      # 0x20cfa
movq %rax, %rdi
callq 0x5270
movl %r13d, %ebp
negl %ebp
movq %rax, %rdi
movl %ebp, %esi
callq 0x5420
leaq 0x4629(%rip), %rsi      # 0x20d04
movq %rax, %rdi
callq 0x5270
movq %rax, %rdi
callq 0x5100
leaq 0x462c(%rip), %rsi      # 0x20d1e
movq %rax, %rdi
callq 0x5270
movq %rax, %rdi
callq 0x5100
movq %rax, %rdi
leaq 0x45ce(%rip), %rsi      # 0x20cda
callq 0x5270
movq %rax, %rdi
movl %r15d, %esi
callq 0x5420
movq %rax, %rdi
movq %rbx, %rsi
callq 0x5270
movq %rax, %rdi
movl %r14d, %esi
callq 0x5420
movq %rax, %rdi
leaq 0x45a7(%rip), %rsi      # 0x20ce3
callq 0x5270
movq %rax, %rdi
movl %r13d, %esi
callq 0x5420
movq %rax, %rdi
leaq 0x4596(%rip), %rsi      # 0x20cec
callq 0x5270
movq %rax, %rdi
movl %r12d, %esi
callq 0x5420
movq %rax, %rdi
leaq 0x458a(%rip), %rsi      # 0x20cfa
callq 0x5270
movq %rax, %rdi
movl %ebp, %esi
callq 0x5420
leaq 0x45aa(%rip), %rsi      # 0x20d30
movq %rax, %rdi
callq 0x5270
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5100
// File: /workspace/github_cpp_makefile_star2_O2/bonetblai[P]mdp-engine/race/parsing.cc
// Function: ps::draw_text(std::ostream&, float, float, float, int, char*)
void draw_text(ostream &os, float x, float y, float angle, int ptsz, char *text) {
    os << "0 0 0 setrgbcolor" << endl
       << "/Helvetica " << ptsz << " selectfont" << endl
       << x << " " << y << " moveto " << angle << " rotate" << endl
       << "(" << text << ") show" << endl;
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
movl %esi, %ebp
movss %xmm2, 0x14(%rsp)
movss %xmm1, 0x10(%rsp)
movss %xmm0, 0xc(%rsp)
leaq 0x44a0(%rip), %rsi      # 0x20d1e
callq 0x5270
movq %rax, %rdi
callq 0x5100
leaq 0x4504(%rip), %rsi      # 0x20d96
movq %rax, %rdi
callq 0x5270
movq %rax, %rdi
movl %ebp, %esi
callq 0x5420
leaq 0x44f7(%rip), %rsi      # 0x20da2
movq %rax, %rdi
callq 0x5270
movq %rax, %rdi
callq 0x5100
movq %rax, %rdi
movss 0xc(%rsp), %xmm0
callq 0x51b0
leaq 0x45ae(%rip), %rsi      # 0x20e7e
movq %rax, %rdi
callq 0x5270
movq %rax, %rdi
movss 0x10(%rsp), %xmm0
callq 0x51b0
leaq 0x43f6(%rip), %rsi      # 0x20ce3
movq %rax, %rdi
callq 0x5270
movq %rax, %rdi
movss 0x14(%rsp), %xmm0
callq 0x51b0
leaq 0x44a4(%rip), %rsi      # 0x20dae
movq %rax, %rdi
callq 0x5270
movq %rax, %rdi
callq 0x5100
leaq 0x151e(%rip), %rsi      # 0x1de3f
movq %rax, %rdi
callq 0x5270
movq %rax, %rdi
movq %rbx, %rsi
callq 0x5270
leaq 0x447b(%rip), %rsi      # 0x20db6
movq %rax, %rdi
callq 0x5270
movq %rax, %rdi
addq $0x18, %rsp
popq %rbx
popq %rbp
jmp 0x5100
nop
// File: /workspace/github_cpp_makefile_star2_O2/hzeller[P]gcode-multi-shell-extrude/multi-shell-extrude.cc
// Function: OffsetCenter(std::vector<Vector2D, std::allocator<Vector2D>> const&, double, double)
Polygon OffsetCenter(const Polygon& polygon, double x_offset, double y_offset) {
  Polygon result;
  for (const Vector2D &p : polygon) {
    result.push_back(Vector2D(p.x + x_offset, p.y + y_offset));
  }
  return result;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
xorps %xmm2, %xmm2
movups %xmm2, (%rdi)
andq $0x0, 0x10(%rdi)
movq (%rsi), %r15
movq 0x8(%rsi), %r12
unpcklpd %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0]
movapd %xmm0, (%rsp)
leaq 0x10(%rsp), %r14
cmpq %r12, %r15
je 0x3612
movupd (%r15), %xmm0
addpd (%rsp), %xmm0
movapd %xmm0, 0x10(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5b92
addq $0x10, %r15
jmp 0x35ec
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x5b22
movq %r14, %rdi
callq 0x33a0