LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/shaovie[P]reactor/src/poller.cpp
// Function: poller::add(ev_handler*, int, unsigned int)
int poller::add(ev_handler *eh, const int fd, const uint32_t ev) {
    eh->set_poller(this);
    int64_t seq = this->seq.fetch_add(1, std::memory_order_relaxed);
    eh->set_seq(seq);
    auto pd = this->poll_descs->new_one(fd);
    pd->fd = fd;
    pd->eh = eh;
    pd->events = ev;
    pd->seq = seq;
    this->poll_descs->store(fd, pd);

    struct epoll_event epev;
    epev.events = ev;
    epev.data.ptr = pd;

    if (::epoll_ctl(this->efd, EPOLL_CTL_ADD, fd, &epev) == 0)
        return 0;
    this->poll_descs->del(fd);
    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, %r8d
movl %edx, %ebx
movq %rsi, %r13
movq %rdi, %r14
movq %rdi, 0x18(%rsi)
movl $0x1, %ebp
lock
xaddq %rbp, 0x48(%rdi)
movq %rbp, 0x10(%rsi)
movq 0x30(%rdi), %r12
cmpl %edx, (%r12)
jle 0x7933
movq 0x8(%r12), %rax
movslq %ebx, %rcx
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,8), %r15
movl %ebx, (%r15)
movq %r13, 0x10(%r15)
movl %r8d, 0x4(%r15)
movq %rbp, 0x8(%r15)
jmp 0x798d
movl $0x18, %edi
movl %r8d, 0x8(%rsp)
callq 0x6490
movq %rax, %r15
movl %ebx, (%rax)
movq %r13, 0x10(%rax)
movl 0x8(%rsp), %eax
movl %eax, 0x4(%r15)
movq %rbp, 0x8(%r15)
movl %ebx, 0xc(%rsp)
leaq 0x48(%r12), %r13
movq %r13, %rdi
callq 0x6680
testl %eax, %eax
jne 0x79d0
addq $0x10, %r12
leaq 0xc(%rsp), %rsi
movq %r12, %rdi
callq 0x67d0
movq %r15, (%rax)
movq %r13, %rdi
callq 0x6360
movl 0x8(%rsp), %r8d
leaq 0xc(%rsp), %rcx
movl %r8d, (%rcx)
movq %r15, 0x4(%rcx)
movl 0x4(%r14), %edi
movl $0x1, %esi
movl %ebx, %edx
callq 0x65c0
testl %eax, %eax
je 0x79bf
movq 0x30(%r14), %rdi
movl %ebx, %esi
callq 0x6840
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x79c1
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %edi
callq 0x6300
nop
// File: /workspace/github_cpp_makefile_star2_O3/shaovie[P]reactor/src/poller.cpp
// Function: poller::append(int, unsigned int)
int poller::append(const int fd, const uint32_t ev) {
    auto pd = this->poll_descs->load(fd);
    if (pd == nullptr)
        return -1;

    // Always save first, recover if failed  (this method is for multi-threading scenarios)."
    pd->events |= ev;
    
    struct epoll_event epev;
    epev.events = pd->events;
    epev.data.ptr = pd;
    if (::epoll_ctl(this->efd, EPOLL_CTL_MOD, fd, &epev) != 0) {
        pd->events &= ~ev;
        return -1;
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %edx, %ebx
movl %esi, %ebp
movq %rdi, %r14
movq 0x30(%rdi), %r12
movl %esi, 0x4(%rsp)
cmpl %esi, (%r12)
jle 0x7a51
movq 0x8(%r12), %rax
movslq %ebp, %rcx
leaq (%rcx,%rcx,2), %rcx
cmpl $-0x1, (%rax,%rcx,8)
je 0x7ac9
leaq (%rax,%rcx,8), %r12
jmp 0x7a89
leaq 0x48(%r12), %r15
movq %r15, %rdi
callq 0x6680
testl %eax, %eax
jne 0x7adb
addq $0x10, %r12
leaq 0x4(%rsp), %rsi
movq %r12, %rdi
callq 0x6630
testq %rax, %rax
je 0x7ac1
movq 0x10(%rax), %r12
movq %r15, %rdi
callq 0x6360
testq %r12, %r12
je 0x7ac9
movl 0x4(%r12), %eax
orl %ebx, %eax
movl %eax, 0x4(%r12)
leaq 0x4(%rsp), %rcx
movl %eax, (%rcx)
movq %r12, 0x4(%rcx)
movl 0x4(%r14), %edi
movl $0x3, %esi
movl %ebp, %edx
callq 0x65c0
testl %eax, %eax
je 0x7abd
notl %ebx
andl %ebx, 0x4(%r12)
jmp 0x7ac9
xorl %eax, %eax
jmp 0x7ace
movq %r15, %rdi
callq 0x6360
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %edi
callq 0x6300
movq %rax, %rbx
movq %r15, %rdi
callq 0x6360
movq %rbx, %rdi
callq 0x6740
nop
// File: /workspace/github_cpp_makefile_star2_O3/shaovie[P]reactor/src/poller.cpp
// Function: poller::remove(int, unsigned int)
int poller::remove(const int fd, const uint32_t ev) {
    if (ev == ev_handler::ev_all) {
        this->poll_descs->del(fd);
        return ::epoll_ctl(this->efd, EPOLL_CTL_DEL, fd, nullptr);
    }
    auto pd = this->poll_descs->load(fd);
    if (pd == nullptr)
        return -1;
    if ((pd->events & (~ev)) == 0) {
        this->poll_descs->del(fd);
        return ::epoll_ctl(this->efd, EPOLL_CTL_DEL, fd, nullptr);
    }

    // Always save first, recover if failed  (this method is for multi-threading scenarios)."
    pd->events &= (~ev);

    struct epoll_event epev;
    epev.events = pd->events;
    epev.data.ptr = pd;
    if (::epoll_ctl(this->efd, EPOLL_CTL_MOD, fd, &epev) != 0) {
        pd->events |= ev;
        return -1;
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %esi, %ebx
movq %rdi, %r14
movq 0x30(%rdi), %r12
cmpl $0x2005, %edx           # imm = 0x2005
jne 0x7b3b
movq %r12, %rdi
movl %ebx, %esi
callq 0x6840
movl 0x4(%r14), %edi
movl $0x2, %esi
movl %ebx, %edx
xorl %ecx, %ecx
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x65c0
movl %edx, %ebp
movl %ebx, 0x4(%rsp)
cmpl %ebx, (%r12)
jle 0x7b63
movq 0x8(%r12), %rax
movslq %ebx, %rcx
leaq (%rcx,%rcx,2), %rcx
cmpl $-0x1, (%rax,%rcx,8)
je 0x7bfc
leaq (%rax,%rcx,8), %r12
jmp 0x7b9f
leaq 0x48(%r12), %r15
movq %r15, %rdi
callq 0x6680
testl %eax, %eax
jne 0x7c12
addq $0x10, %r12
leaq 0x4(%rsp), %rsi
movq %r12, %rdi
callq 0x6630
testq %rax, %rax
je 0x7bf4
movq 0x10(%rax), %r12
movq %r15, %rdi
callq 0x6360
testq %r12, %r12
je 0x7bfc
movl %ebp, %eax
notl %eax
andl 0x4(%r12), %eax
je 0x7bd5
movl %eax, 0x4(%r12)
leaq 0x4(%rsp), %rcx
movl %eax, (%rcx)
movq %r12, 0x4(%rcx)
movl 0x4(%r14), %edi
movl $0x3, %esi
movl %ebx, %edx
callq 0x65c0
testl %eax, %eax
je 0x7c0e
orl %ebp, 0x4(%r12)
jmp 0x7bfc
movq 0x30(%r14), %rdi
movl %ebx, %esi
callq 0x6840
movl 0x4(%r14), %edi
movl $0x2, %esi
movl %ebx, %edx
xorl %ecx, %ecx
callq 0x65c0
jmp 0x7c01
movq %r15, %rdi
callq 0x6360
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
jmp 0x7c01
movl %eax, %edi
callq 0x6300
movq %rax, %rbx
movq %r15, %rdi
callq 0x6360
movq %rbx, %rdi
callq 0x6740
// File: /workspace/github_cpp_makefile_star2_O3/shaovie[P]reactor/src/poller.cpp
// Function: poller::set_cpu_affinity()
void poller::set_cpu_affinity() {
    if (this->cpu_id == -1)
        return;
    cpu_set_t cpu_set;
    CPU_ZERO(&cpu_set);
    CPU_SET(this->cpu_id, &cpu_set);
    if (pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpu_set) != 0)
        fprintf(stderr, "reactor: set cpu affinity fail! %s\n", strerror(errno));
}

// Assembly:
movl (%rdi), %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, %rcx
je 0x7ca0
subq $0x88, %rsp
xorps %xmm0, %xmm0
movaps %xmm0, 0x70(%rsp)
movaps %xmm0, 0x60(%rsp)
movaps %xmm0, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movaps %xmm0, (%rsp)
cmpl $0x3ff, %ecx            # imm = 0x3FF
ja 0x7c80
movl $0x1, %eax
shlq %cl, %rax
shrl $0x6, %ecx
orq %rax, (%rsp,%rcx,8)
callq 0x6400
movq %rsp, %rdx
movl $0x80, %esi
movq %rax, %rdi
callq 0x6720
testl %eax, %eax
jne 0x7ca1
addq $0x88, %rsp
retq
callq 0x6a3c
jmp 0x7c99
// File: /workspace/github_cpp_makefile_star2_O3/shaovie[P]reactor/src/poll_desc.h
// Function: poll_desc_map::~poll_desc_map()
~poll_desc_map() {
        if (this->arr != nullptr)
            delete[] this->arr;
        this->mtx.lock();
        for (const auto &kv : this->map)
            delete kv.second;
        
        this->mtx.unlock();
    }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0x7e86
callq 0x6570
leaq 0x48(%rbx), %r14
movq %r14, %rdi
callq 0x6680
testl %eax, %eax
jne 0x7ec6
movq 0x20(%rbx), %r15
testq %r15, %r15
je 0x7ead
movq 0x10(%r15), %rdi
callq 0x6470
movq (%r15), %r15
jmp 0x7e9a
addq $0x10, %rbx
movq %r14, %rdi
callq 0x6360
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x60a0
movl %eax, %edi
callq 0x6300
movq %rax, %rdi
callq 0x745b
nop
// File: /workspace/github_cpp_makefile_star2_O3/shaovie[P]reactor/src/poll_desc.h
// Function: poll_desc_map::del(int)
void del(const int i) {
        if (i < this->arr_size) {
            poll_desc *p = &(this->arr[i]);
            p->events =  0;
            p->fd     = -1;
            p->seq    = -1;
            p->eh     = nullptr;
            return;
        }
        this->mtx.lock();
        auto ret = this->map.find(i);
        if (ret != this->map.end()) {
            delete ret->second;
            this->map.erase(ret);
        }
        this->mtx.unlock();
    }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movl %esi, 0xc(%rsp)
cmpl %esi, (%rdi)
jle 0x7f12
movq 0x8(%rbx), %rax
movslq %esi, %rcx
leaq (%rcx,%rcx,2), %rcx
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %rdx, (%rax,%rcx,8)
movq $-0x1, 0x8(%rax,%rcx,8)
movq $0x0, 0x10(%rax,%rcx,8)
jmp 0x7f57
leaq 0x48(%rbx), %r14
movq %r14, %rdi
callq 0x6680
testl %eax, %eax
jne 0x7f61
addq $0x10, %rbx
leaq 0xc(%rsp), %rsi
movq %rbx, %rdi
callq 0x6630
testq %rax, %rax
je 0x7f4f
movq %rax, %r15
movq 0x10(%rax), %rdi
callq 0x6470
movq %rbx, %rdi
movq %r15, %rsi
callq 0x65e0
movq %r14, %rdi
callq 0x6360
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
movl %eax, %edi
callq 0x6300
// File: /workspace/github_cpp_makefile_star2_O3/shaovie[P]reactor/src/poll_sync_opt.cpp
// Function: poll_sync_opt::~poll_sync_opt()
poll_sync_opt::~poll_sync_opt() {
   if (this->efd != -1)
        ::close(this->efd);
    
   if (this->readq != nullptr)
       delete this->readq;
   if (this->writeq != nullptr)
       delete this->writeq;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x6ade(%rip), %rax      # 0xefc8
addq $0x10, %rax
movq %rax, (%rdi)
movl 0x30(%rdi), %edi
cmpl $-0x1, %edi
je 0x84fe
callq 0x6820
movq 0x68(%rbx), %r14
testq %r14, %r14
je 0x851d
movq 0x10(%r14), %rdi
testq %rdi, %rdi
je 0x8515
callq 0x6570
movq %r14, %rdi
callq 0x6470
movq 0x70(%rbx), %rbx
testq %rbx, %rbx
je 0x8543
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x8534
callq 0x6570
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x6470
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rdi
callq 0x745b
nop
// File: /workspace/github_cpp_makefile_star2_O3/shaovie[P]reactor/src/poll_sync_opt.cpp
// Function: poll_sync_opt::do_sync(poll_sync_opt::opt_arg const&)
void poll_sync_opt::do_sync(const poll_sync_opt::opt_arg &arg) {
    if (arg.type == poll_sync_opt::sync_cache_t) {
        auto p = (poll_sync_opt::sync_cache *)arg.arg;
        this->poll->poll_cache_set(p->id, p->value, p->free_func);
        delete p;
    }
}

// Assembly:
cmpl $0x1, (%rsi)
jne 0x8592
pushq %rbx
movq 0x8(%rsi), %rbx
movq 0x18(%rdi), %rdi
movl (%rbx), %esi
movq 0x8(%rbx), %rdx
movq 0x10(%rbx), %rcx
callq 0x63c0
movq %rbx, %rdi
popq %rbx
jmp 0x6470
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/shaovie[P]reactor/src/poll_sync_opt.cpp
// Function: poll_sync_opt::open(poller*)
int poll_sync_opt::open(poller *poll) {
    int fd = ::eventfd(0, EFD_NONBLOCK|EFD_CLOEXEC);
    if (fd == -1) {
        fprintf(stderr, "reactor: create eventfd fail! %s\n", strerror(errno));
        return -1;
    }
    if (poll->add(this, fd, ev_handler::ev_read) == -1) {
        fprintf(stderr, "reactor: add eventfd to poller fail! %s\n", strerror(errno));
        ::close(fd);
        return -1;
    }
    this->efd = fd;
    return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
xorl %edi, %edi
movl $0x80800, %esi          # imm = 0x80800
callq 0x6540
cmpl $-0x1, %eax
je 0x85d2
movl %eax, %ebp
movq %r14, %rdi
movq %rbx, %rsi
movl %eax, %edx
movl $0x2001, %ecx           # imm = 0x2001
callq 0x67e0
cmpl $-0x1, %eax
je 0x85d9
movl %ebp, 0x30(%rbx)
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
callq 0x6ab8
jmp 0x85e0
movl %ebp, %edi
callq 0x6a7a
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x85cd
nop
// File: /workspace/github_cpp_makefile_star2_O3/shaovie[P]reactor/src/poll_sync_opt.cpp
// Function: poll_sync_opt::push(poll_sync_opt::opt_arg const&)
void poll_sync_opt::push(const poll_sync_opt::opt_arg &arg) {
    this->mtx.lock();
    this->writeq->push_back(arg);
    this->mtx.unlock();

    int expected = 0;
    if (!this->notified.compare_exchange_strong(expected, 1))
        return ;
    int64_t v = 1;
    int ret = 0;
    do {
        ret = ::write(this->efd, (void *)&v, sizeof(v));
    } while (ret == -1 && errno == EINTR);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x38(%rdi), %r14
movq %r14, %rdi
callq 0x6680
testl %eax, %eax
jne 0x86a7
movq 0x70(%rbx), %r12
movl (%r12), %esi
movl 0xc(%r12), %ecx
cmpl %esi, %ecx
jne 0x862c
movq %r12, %rdi
callq 0x61d0
movl (%r12), %esi
movl 0xc(%r12), %ecx
movq 0x10(%r12), %rdx
movslq 0x8(%r12), %rdi
leal 0x1(%rdi), %eax
shlq $0x4, %rdi
movl (%r15), %r8d
movl %r8d, (%rdx,%rdi)
movq 0x8(%r15), %r8
movq %r8, 0x8(%rdx,%rdi)
cltd
idivl %esi
movl %edx, 0x8(%r12)
incl %ecx
movl %ecx, 0xc(%r12)
movq %r14, %rdi
callq 0x6360
movl $0x1, %ecx
xorl %eax, %eax
lock
cmpxchgl %ecx, 0x60(%rbx)
jne 0x869b
movq %rsp, %r14
movq $0x1, (%r14)
movl 0x30(%rbx), %edi
movl $0x8, %edx
movq %r14, %rsi
callq 0x6140
cmpl $-0x1, %eax
jne 0x869b
callq 0x6040
cmpl $0x4, (%rax)
je 0x867c
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movl %eax, %edi
callq 0x6300
// File: /workspace/github_cpp_makefile_star2_O3/shaovie[P]reactor/src/poll_sync_opt.cpp
// Function: poll_sync_opt::on_read()
bool poll_sync_opt::on_read() {
    if (this->readq->empty()) {
        this->mtx.lock();
        std::swap(this->readq, this->writeq);
        this->mtx.unlock();
    }
    for (auto i = 0; i < 8 && !this->readq->empty(); ++i) {
        poll_sync_opt::opt_arg &arg = this->readq->front();
        this->do_sync(arg);
        this->readq->pop_front();
    }
    if (!this->readq->empty()) // Ignore readable eventfd, continue
        return true;

    int64_t v = 0;
    int ret = 0;
    do {
        ret = ::read(this->efd, (void *)&v, sizeof(v));
    } while (ret == -1 && errno == EINTR);

    this->notified.store(0);
    return true;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq 0x68(%rdi), %rax
cmpl $0x0, 0xc(%rax)
jne 0x86ee
leaq 0x38(%rbx), %r14
movq %r14, %rdi
callq 0x6680
testl %eax, %eax
jne 0x878f
movdqu 0x68(%rbx), %xmm0
pshufd $0x4e, %xmm0, %xmm0     # xmm0 = xmm0[2,3,0,1]
movdqu %xmm0, 0x68(%rbx)
movq %r14, %rdi
callq 0x6360
movl $0x8, %ebp
movq 0x68(%rbx), %rax
cmpl $0x0, 0xc(%rax)
je 0x8754
movslq 0x4(%rax), %rsi
shlq $0x4, %rsi
addq 0x10(%rax), %rsi
movq %rbx, %rdi
callq 0x6080
movq 0x68(%rbx), %rcx
movl 0xc(%rcx), %esi
testl %esi, %esi
je 0x8746
movq 0x10(%rcx), %rdx
movslq 0x4(%rcx), %rdi
leal 0x1(%rdi), %eax
shlq $0x4, %rdi
movl $0x0, (%rdx,%rdi)
movq $0x0, 0x8(%rdx,%rdi)
cltd
idivl (%rcx)
movl %edx, 0x4(%rcx)
decl %esi
movl %esi, 0xc(%rcx)
decl %ebp
jne 0x86f3
movq 0x68(%rbx), %rax
cmpl $0x0, 0xc(%rax)
jne 0x8784
leaq 0x8(%rsp), %r14
movq $0x0, (%r14)
movl 0x30(%rbx), %edi
movl $0x8, %edx
movq %r14, %rsi
callq 0x6640
cmpl $-0x1, %eax
jne 0x877f
callq 0x6040
cmpl $0x4, (%rax)
je 0x8760
xorl %eax, %eax
xchgl %eax, 0x60(%rbx)
movb $0x1, %al
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movl %eax, %edi
callq 0x6300
// File: /workspace/github_cpp_makefile_star2_O3/shaovie[P]reactor/src/poller.h
// Function: poller::poll_cache_set(int, void*, void (*)(void*))
void poll_cache_set(const int id, void *val, void (*free_func)(void *)) {
        auto itor = this->pcache.find(id);
        if (itor != this->pcache.end())
            free_func(itor->second);
        this->pcache[id] = val;
    }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rcx, %r15
movq %rdx, %rbx
movq %rdi, %r14
leaq 0xc(%rsp), %rax
movl %esi, (%rax)
addq $0x50, %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x6380
testq %rax, %rax
je 0x87ca
movq 0x10(%rax), %rdi
callq *%r15
leaq 0xc(%rsp), %rsi
movq %r14, %rdi
callq 0x6240
movq %rbx, (%rax)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/shaovie[P]reactor/src/ringq.h
// Function: ringq<async_send::item>::grow()
void grow() {
        int new_size = this->size * 2;
        if (new_size == 0)
            new_size = 2;
        item_t *newrq = new item_t[new_size]();

        for (int i = 0; i < this->len; ++i)
            newrq[i] = this->rq[(this->head + i) % this->size];
        delete[] this->rq;
        this->rq = newrq;
        this->size = new_size;
        this->head = 0;
        this->tail = this->len;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movl (%rdi), %r12d
leal (%r12,%r12), %eax
testl %r12d, %r12d
movl $0x2, %ebp
cmovnel %eax, %ebp
movslq %ebp, %r15
movl $0x28, %ecx
movq %r15, %rax
mulq %rcx
movq $-0x1, %rdi
cmovnoq %rax, %rdi
callq 0x6030
movq %rax, %r14
leaq (%r15,%r15,4), %rax
leaq (%r14,%rax,8), %rax
xorl %ecx, %ecx
xorps %xmm0, %xmm0
movq %r14, %rdx
movq %rcx, (%rdx)
movl $0xffffffff, (%rdx)     # imm = 0xFFFFFFFF
movq $-0x1, 0x8(%rdx)
movups %xmm0, 0x10(%rdx)
movq %rcx, 0x20(%rdx)
addq $0x28, %rdx
cmpq %rax, %rdx
jne 0x9f32
movslq 0xc(%rbx), %rax
movq 0x10(%rbx), %rdi
testq %rax, %rax
jle 0x9fae
movl 0x4(%rbx), %ecx
shlq $0x3, %rax
leaq (%rax,%rax,4), %rsi
xorl %r8d, %r8d
movl %ecx, %eax
cltd
idivl %r12d
movslq %edx, %rax
leaq (%rax,%rax,4), %rax
movl (%rdi,%rax,8), %edx
movl %edx, (%r14,%r8)
movq 0x10(%rdi,%rax,8), %rdx
movq %rdx, 0x10(%r14,%r8)
movq 0x20(%rdi,%rax,8), %rdx
movq %rdx, 0x20(%r14,%r8)
movq 0x18(%rdi,%rax,8), %rax
movq %rax, 0x18(%r14,%r8)
incl %ecx
addq $0x28, %r8
cmpq %r8, %rsi
jne 0x9f6f
jmp 0x9fb3
testq %rdi, %rdi
je 0x9fbb
callq 0x6570
movl 0xc(%rbx), %eax
movq %r14, 0x10(%rbx)
movl %ebp, (%rbx)
movl $0x0, 0x4(%rbx)
movl %eax, 0x8(%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/shaovie[P]reactor/src/acceptor.cpp
// Function: acceptor::uds_open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, options const&)
int acceptor::uds_open(const std::string &addr, const options &opt) {
    ::remove(addr.c_str());
    int fd = ::socket(AF_UNIX, SOCK_STREAM, 0);
    if (fd == -1) {
        fprintf(stderr, "reactor: create unix socket fail! %s\n", strerror(errno));
        return -1;
    }
    struct sockaddr_un laddr;
    laddr.sun_family = AF_UNIX;
    ::strcpy(laddr.sun_path, addr.c_str());
    return this->listen(fd,
        reinterpret_cast<sockaddr *>(&laddr), sizeof(laddr),
        opt.backlog);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x78, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq (%rsi), %rdi
callq 0x6790
movl $0x1, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x60e0
cmpl $-0x1, %eax
je 0x8cb9
movl %eax, %ebp
leaq 0xc(%rsp), %rdi
movw $0x1, -0x2(%rdi)
movq (%r15), %rsi
callq 0x6460
movl 0x20(%r14), %r8d
leaq 0xa(%rsp), %rdx
movq %rbx, %rdi
movl %ebp, %esi
movl $0x6e, %ecx
callq 0x67f0
addq $0x78, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0x6af5
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x8cae
nop
// File: /workspace/github_cpp_makefile_star2_O3/shaovie[P]reactor/src/acceptor.cpp
// Function: acceptor::on_read()
bool acceptor::on_read() {
    int fd = this->get_fd();
    int conn = -1;
    for (int i = 0; i < 128; ++i) {
        conn = ::accept4(fd, nullptr, nullptr, SOCK_NONBLOCK|SOCK_CLOEXEC);
        if (conn == -1) {
            if (errno == EINTR) {
                continue;
            } else if (errno == EMFILE) {
                // 句柄不足，暂停200毫秒，不然会一直触发事件
                if (this->get_poller()->schedule_timer(this, 200, 0) == 0) {
                    this->get_poller()->remove(fd, ev_handler::ev_all);
                }
            }
            break;
        }
        auto eh = this->new_conn_func();
        if (eh == nullptr) {
            socket::close(conn);
            break;
        }
        eh->set_fd(conn);
        if (eh->on_open() == false)
            eh->on_close();
    }
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rax
callq *0x40(%rax)
movl %eax, %ebp
movl $0x80, %r12d
movl %ebp, %edi
xorl %esi, %esi
xorl %edx, %edx
movl $0x80800, %ecx          # imm = 0x80800
callq 0x6230
cmpl $-0x1, %eax
je 0x901c
movl %eax, %r15d
callq *0x30(%rbx)
testq %rax, %rax
je 0x9061
movq %rax, %r14
movq (%rax), %rax
movq %r14, %rdi
movl %r15d, %esi
callq *0x48(%rax)
movq (%r14), %rax
movq %r14, %rdi
callq *0x10(%rax)
testb %al, %al
jne 0x9028
movq (%r14), %rax
movq %r14, %rdi
callq *0x38(%rax)
jmp 0x9028
callq 0x6040
movl (%rax), %eax
cmpl $0x4, %eax
jne 0x902f
decl %r12d
jne 0x8fd5
jmp 0x9069
cmpl $0x18, %eax
jne 0x9069
movq 0x18(%rbx), %rax
movq 0x20(%rax), %rdi
movq %rbx, %rsi
movl $0xc8, %edx
xorl %ecx, %ecx
callq 0x6530
testl %eax, %eax
jne 0x9069
movq 0x18(%rbx), %rdi
movl %ebp, %esi
movl $0x2005, %edx           # imm = 0x2005
callq 0x6780
jmp 0x9069
movl %r15d, %edi
callq 0x6820
movb $0x1, %al
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/shaovie[P]reactor/src/acceptor.cpp
// Function: acceptor::listen(int, sockaddr const*, unsigned int, int)
int acceptor::listen(const int fd,
    const struct sockaddr *addr, socklen_t addrlen,
    const int backlog) {
    if (::bind(fd, addr, addrlen) == -1) {
        socket::close(fd);
        fprintf(stderr, "reactor: bind fail! %s\n", strerror(errno));
        return -1;
    }

    if (::listen(fd, backlog) == -1) {
        socket::close(fd);
        fprintf(stderr, "reactor: listen fail! %s\n", strerror(errno));
        return -1;
    }

    if (this->get_reactor()->add_ev_handler(this, fd, ev_handler::ev_accept) != 0) {
        socket::close(fd);
        fprintf(stderr, "reactor: add accept ev handler fail! %s\n", strerror(errno));
        return -1;
    }
    this->set_fd(fd);
    return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %r8d, %ebp
movl %esi, %ebx
movq %rdi, %r14
movl %esi, %edi
movq %rdx, %rsi
movl %ecx, %edx
callq 0x6070
cmpl $-0x1, %eax
je 0x9104
movl %ebx, %edi
movl %ebp, %esi
callq 0x6510
cmpl $-0x1, %eax
je 0x910d
movq 0x20(%r14), %rdi
movq %r14, %rsi
movl %ebx, %edx
movl $0x2001, %ecx           # imm = 0x2001
callq 0x65d0
testl %eax, %eax
jne 0x9116
movq (%r14), %rax
movq %r14, %rdi
movl %ebx, %esi
callq *0x48(%rax)
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
movl %ebx, %edi
callq 0x6c61
jmp 0x911d
movl %ebx, %edi
callq 0x6c30
jmp 0x911d
movl %ebx, %edi
callq 0x6bff
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x90ff
// File: /workspace/github_cpp_makefile_star2_O3/shaovie[P]reactor/src/connector.cpp
// Function: connector::connect(ev_handler*, inet_address const&, int, unsigned long)
int connector::connect(ev_handler *eh,
    const inet_address &remote_addr, 
    const int timeout /*milliseconds*/,
    const size_t rcvbuf_size) {

    int fd = ::socket(AF_INET, SOCK_STREAM|SOCK_NONBLOCK|SOCK_CLOEXEC, 0);
    if (fd == -1)
        return -1;

    // `sysctl -a | grep net.ipv4.tcp_rmem` 返回 min default max
    // 默认内核会在min,max之间动态调整, default是初始值, 如果设置了SO_RCVBUF, 
    // 缓冲区大小不变成固定值, 内核也不会进行动态调整了.
    //
    // 必须在listen/connect之前调用
    // must < `sysctl -a | grep net.core.rmem_max`
    
    if (rcvbuf_size > 0 && socket::set_rcvbuf(fd, rcvbuf_size) == -1) {
        socket::close(fd);
        return -1;
    }
    int ret = ::connect(fd,
        reinterpret_cast<sockaddr *>(remote_addr.get_addr()),
        remote_addr.get_addr_size());

    if (ret == 0) {
        eh->set_fd(fd); // fd 所有权转移, 从此后eh管理fd
        if (eh->on_open() == false) {
            eh->on_close(); 
            return -1;
        }
        return 0;
    } else if (errno == EINPROGRESS) {
        if (timeout < 1) {
            socket::close(fd);
            return -1;
        }
        return this->nblock_connect(eh, fd, timeout);
    }
    socket::close(fd);
    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %r12
movl %ecx, %r14d
movq %rdx, %r13
movq %rsi, %rbx
movq %rdi, 0x8(%rsp)
movl $0x2, %edi
movl $0x80801, %esi          # imm = 0x80801
xorl %edx, %edx
callq 0x60e0
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $-0x1, %eax
je 0x920e
movl %eax, %r15d
testq %r12, %r12
je 0x9197
leaq 0x10(%rsp), %rcx
movq %r12, (%rcx)
movl %r15d, %edi
movl $0x1, %esi
movl $0x8, %edx
movl $0x8, %r8d
callq 0x6760
cmpl $-0x1, %eax
je 0x9201
movl %r15d, %edi
movq %r13, %rsi
movl $0x10, %edx
callq 0x63e0
testl %eax, %eax
je 0x91db
callq 0x6040
cmpl $0x73, (%rax)
jne 0x91d1
testl %r14d, %r14d
jle 0x91d1
movq 0x8(%rsp), %rdi
movq %rbx, %rsi
movl %r15d, %edx
movl %r14d, %ecx
callq 0x61b0
movl %eax, %ebp
jmp 0x920e
movl %r15d, %edi
callq 0x6820
jmp 0x920e
movq (%rbx), %rax
movq %rbx, %rdi
movl %r15d, %esi
callq *0x48(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
xorl %ebp, %ebp
testb %al, %al
jne 0x920e
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x38(%rax)
jmp 0x9209
movl %r15d, %edi
callq 0x6820
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/shaovie[P]reactor/src/connector.cpp
// Function: connector::nblock_connect(ev_handler*, int, int)
int connector::nblock_connect(ev_handler *eh, const int fd, const int timeout) {
    in_progress_connect *ipc = new in_progress_connect(this, eh);

    ipc->set_fd(fd);
    if (this->get_reactor()->add_ev_handler(ipc, fd, ev_handler::ev_connect) == -1) {
        delete ipc;
        socket::close(fd);
        return -1;
    }
    // 要在同一个poller中注册定时器
    //
    // add_ev_handler 和 schedule_timer 不保证原子性,
    // 有可能schedule_timer的时候 ipc已经触发了I/O事件
    ipc->get_poller()->schedule_timer(ipc, timeout, 0);
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %ecx, %ebx
movl %edx, %ebp
movq %rsi, %r15
movq %rdi, %r12
movl $0x48, %edi
callq 0x6490
movq %rax, %r14
movq $-0x1, 0x10(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rax)
movq $0x0, 0x28(%rax)
movq 0x5d83(%rip), %rax      # 0xefe0
addq $0x10, %rax
movq %rax, (%r14)
movw $0x0, 0x30(%r14)
movb $0x0, 0x32(%r14)
movq %r12, 0x38(%r14)
movq %r15, 0x40(%r14)
movl %ebp, 0x8(%r14)
movq 0x20(%r12), %rdi
movq %r14, %rsi
movl %ebp, %edx
movl $0x2005, %ecx           # imm = 0x2005
callq 0x65d0
cmpl $-0x1, %eax
je 0x92ad
movq 0x18(%r14), %rax
movq 0x20(%rax), %rdi
xorl %ebp, %ebp
movq %r14, %rsi
movl %ebx, %edx
xorl %ecx, %ecx
callq 0x6530
jmp 0x92c2
movq (%r14), %rax
movq %r14, %rdi
callq *0x8(%rax)
movl %ebp, %edi
callq 0x6820
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/shaovie[P]reactor/src/connector.cpp
// Function: in_progress_connect::on_read()
virtual bool on_read() {
        if (this->io_ev_trigger)
            return true;
        this->eh->on_connect_fail(err_connect_fail);
        this->get_poller()->cancel_timer(this);
        this->io_ev_trigger = true;
        return false;
    }

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movb 0x31(%rdi), %bl
testb %bl, %bl
jne 0x9306
movq %rdi, %r14
movq 0x40(%rdi), %rdi
movq (%rdi), %rax
movl $0x2, %esi
callq *0x28(%rax)
movq 0x18(%r14), %rax
movq 0x20(%rax), %rdi
movq %r14, %rsi
callq 0x63f0
movb $0x1, 0x31(%r14)
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/shaovie[P]reactor/src/connector.cpp
// Function: in_progress_connect::on_write()
virtual bool on_write() {
        if (this->io_ev_trigger)
            return true;
        int fd = this->get_fd();
        this->set_fd(-1); // From here on, the `fd` resources will be managed by eh.
        this->get_poller()->cancel_timer(this);
        this->io_ev_trigger = true;

        this->ok = true;
        this->eh->set_fd(fd);
        return true;
    }

// Assembly:
cmpb $0x0, 0x31(%rdi)
jne 0x935a
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rax
callq *0x40(%rax)
movl %eax, %ebp
movq (%rbx), %rax
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq *0x48(%rax)
movq 0x18(%rbx), %rax
movq 0x20(%rax), %rdi
movq %rbx, %rsi
callq 0x63f0
movw $0x101, 0x30(%rbx)      # imm = 0x101
movq 0x40(%rbx), %rdi
movq (%rdi), %rax
movl %ebp, %esi
callq *0x48(%rax)
addq $0x8, %rsp
popq %rbx
popq %rbp
movb $0x1, %al
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/shaovie[P]reactor/src/connector.cpp
// Function: in_progress_connect::on_close()
virtual void on_close() {
        // maybe trigger EPOLLHUP | EPOLLERR
        if (this->timeout_trigger == false || this->io_ev_trigger == false) {
            this->eh->on_connect_fail(err_connect_fail);
            this->get_poller()->cancel_timer(this);
        }
        this->destroy();

        // eh部分不能在on_write里边调用, 因为fd对应的eh变化了，在poller中fd对应的eh
        // 没有及时更新, 产生混乱
        if (this->ok == true && this->eh->on_open() == false)
            this->eh->on_close();
        delete this;
    }

// Assembly:
pushq %rbx
movq %rdi, %rbx
cmpb $0x0, 0x32(%rdi)
je 0x93ba
cmpb $0x0, 0x31(%rbx)
jne 0x93d9
movq 0x40(%rbx), %rdi
movq (%rdi), %rax
movl $0x2, %esi
callq *0x28(%rax)
movq 0x18(%rbx), %rax
movq 0x20(%rax), %rdi
movq %rbx, %rsi
callq 0x63f0
movl 0x8(%rbx), %edi
cmpl $-0x1, %edi
je 0x93ed
callq 0x6820
movl $0xffffffff, 0x8(%rbx)  # imm = 0xFFFFFFFF
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rbx)
cmpb $0x1, 0x30(%rbx)
jne 0x9412
movq 0x40(%rbx), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
testb %al, %al
jne 0x9412
movq 0x40(%rbx), %rdi
movq (%rdi), %rax
callq *0x38(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
popq %rbx
jmpq *0x8(%rax)
// File: /workspace/github_cpp_makefile_star2_O3/shaovie[P]reactor/src/io_handle.cpp
// Function: io_handle::recv(char*&)
int io_handle::recv(char* &buff) {
    if (this->fd == -1)
        return -1;
    
    int ret = 0;
    do {
        ret = ::recv(this->fd, this->poll->io_buf, this->poll->io_buf_size, 0);
        if (ret > 0) {
            buff = this->poll->io_buf;
            break;
        }
    } while (ret == -1 && errno == EINTR);
    return ret;
}

// Assembly:
cmpl $-0x1, 0x8(%rdi)
je 0x948f
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movl 0x8(%r14), %edi
movq 0x18(%r14), %rax
movq 0x10(%rax), %rsi
movslq 0xc(%rax), %rdx
xorl %ecx, %ecx
callq 0x6120
testl %eax, %eax
jg 0x9495
cmpl $-0x1, %eax
jne 0x94a0
callq 0x6040
cmpl $0x4, (%rax)
je 0x945e
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x94a0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
movq 0x18(%r14), %rcx
movq 0x10(%rcx), %rcx
movq %rcx, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/shaovie[P]reactor/src/io_handle.cpp
// Function: io_handle::async_send(char const*, int)
int io_handle::async_send(const char *buff, const int len) {
    char *bf = new char[len];
    ::memcpy(bf, buff, len);
    this->poll->push(async_send::item(this->fd, this->seq, async_send_buf(bf, len)));
    return len;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
movq %rdi, %r15
movslq %edx, %rbx
testl %ebx, %ebx
movq $-0x1, %rdi
cmovnsq %rbx, %rdi
callq 0x6030
movq %rax, %r12
movq %rax, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x63d0
movq 0x18(%r15), %rax
movl 0x8(%r15), %ecx
movq 0x10(%r15), %rdx
movq %rsp, %rsi
movl %ecx, (%rsi)
movq %rdx, 0x8(%rsi)
movq $0x0, 0x10(%rsi)
movl $0x0, 0x18(%rsi)
movl %ebx, 0x1c(%rsi)
movq %r12, 0x20(%rsi)
movq 0x28(%rax), %rdi
callq 0x6250
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/shaovie[P]reactor/src/io_handle.cpp
// Function: io_handle::on_write()
bool io_handle::on_write() {
    if (this->fd == -1)
        return false; // goto on_close
                      
    int n = this->async_send_buf_q->length();
    for (auto i = 0; i < n; ++i) {
        async_send_buf &asb = this->async_send_buf_q->front();
        auto ret = ::send(this->fd, asb.buf + asb.sendn, asb.len - asb.sendn, 0);
        if (ret > 0) {
            this->async_send_buf_size -= ret;
            if (ret == (asb.len - asb.sendn)) {
                delete[] asb.buf;
                this->async_send_buf_q->pop_front();
                continue;
            }
            asb.sendn += ret;
        }
        break;
    }
    if (this->async_send_buf_q->empty() && this->async_send_polling == true) {
        this->poll->remove(this->fd, ev_handler::ev_write);
        this->async_send_polling = false;
        this->on_send_buffer_drained();
    }
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl 0x8(%rdi), %ebp
cmpl $-0x1, %ebp
je 0x9842
movq %rdi, %rbx
movq 0x38(%rdi), %rax
movl 0xc(%rax), %r14d
testl %r14d, %r14d
jle 0x9814
movq 0x38(%rbx), %rax
movq 0x10(%rax), %r15
movslq 0x4(%rax), %r12
shlq $0x4, %r12
movl 0x8(%rbx), %edi
movslq (%r15,%r12), %rax
movq 0x8(%r15,%r12), %rsi
addq %rax, %rsi
movslq 0x4(%r15,%r12), %rdx
subq %rax, %rdx
xorl %ecx, %ecx
callq 0x6260
testq %rax, %rax
jle 0x9814
addq %r12, %r15
subl %eax, 0x34(%rbx)
movslq 0x4(%r15), %rdx
movslq (%r15), %rcx
subq %rcx, %rdx
cmpq %rdx, %rax
jne 0x980f
movq 0x8(%r15), %rdi
testq %rdi, %rdi
je 0x97d8
callq 0x6570
movq 0x38(%rbx), %rcx
movl 0xc(%rcx), %esi
testl %esi, %esi
je 0x9804
movq 0x10(%rcx), %rdx
movslq 0x4(%rcx), %rdi
leal 0x1(%rdi), %eax
shlq $0x4, %rdi
xorps %xmm0, %xmm0
movups %xmm0, (%rdx,%rdi)
cltd
idivl (%rcx)
movl %edx, 0x4(%rcx)
decl %esi
movl %esi, 0xc(%rcx)
decl %r14d
jne 0x9782
jmp 0x9814
addl %eax, %ecx
movl %ecx, (%r15)
movq 0x38(%rbx), %rax
cmpl $0x0, 0xc(%rax)
jne 0x9842
cmpb $0x1, 0x30(%rbx)
jne 0x9842
movq 0x18(%rbx), %rdi
movl 0x8(%rbx), %esi
movl $0x4, %edx
callq 0x6780
movb $0x0, 0x30(%rbx)
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x58(%rax)
cmpl $-0x1, %ebp
setne %al
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/shaovie[P]reactor/src/io_handle.cpp
// Function: io_handle::destroy()
void io_handle::destroy() {
    ev_handler::destroy();

    if (this->async_send_buf_q != nullptr) {
        int n = this->async_send_buf_q->length();
        for (auto i = 0; i < n; ++i) {
            async_send_buf &asb = this->async_send_buf_q->front();
            delete[] asb.buf;
            this->async_send_buf_q->pop_front();
        }
        delete this->async_send_buf_q;
        this->async_send_buf_size = 0;
        this->async_send_buf_q = nullptr;
    }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl 0x8(%rdi), %edi
cmpl $-0x1, %edi
je 0x9a11
callq 0x6820
movl $0xffffffff, 0x8(%rbx)  # imm = 0xFFFFFFFF
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rbx)
movq 0x38(%rbx), %r14
testq %r14, %r14
je 0x9aaf
movl 0xc(%r14), %ebp
testl %ebp, %ebp
jle 0x9a85
movq 0x38(%rbx), %rcx
movq 0x10(%rcx), %rax
movslq 0x4(%rcx), %rdx
shlq $0x4, %rdx
movq 0x8(%rax,%rdx), %rdi
testq %rdi, %rdi
je 0x9a50
callq 0x6570
movq 0x38(%rbx), %rcx
movl 0xc(%rcx), %esi
testl %esi, %esi
je 0x9a78
movq 0x10(%rcx), %rdx
movslq 0x4(%rcx), %rdi
leal 0x1(%rdi), %eax
shlq $0x4, %rdi
xorps %xmm0, %xmm0
movups %xmm0, (%rdx,%rdi)
cltd
idivl (%rcx)
movl %edx, 0x4(%rcx)
decl %esi
movl %esi, 0xc(%rcx)
decl %ebp
jne 0x9a2d
movq 0x38(%rbx), %r14
testq %r14, %r14
je 0x9a95
movq 0x10(%r14), %rdi
testq %rdi, %rdi
je 0x9a98
callq 0x6570
jmp 0x9a98
xorl %r14d, %r14d
movq %r14, %rdi
callq 0x6470
movl $0x0, 0x34(%rbx)
movq $0x0, 0x38(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/shaovie[P]reactor/src/async_send.cpp
// Function: async_send::~async_send()
async_send::~async_send() {
   if (this->efd != -1)
        ::close(this->efd);
    
   if (this->readq != nullptr)
       delete this->readq;
   if (this->writeq != nullptr)
       delete this->writeq;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x542a(%rip), %rax      # 0xefb0
addq $0x10, %rax
movq %rax, (%rdi)
movl 0x30(%rdi), %edi
cmpl $-0x1, %edi
je 0x9b9a
callq 0x6820
movq 0x68(%rbx), %r14
testq %r14, %r14
je 0x9bb9
movq 0x10(%r14), %rdi
testq %rdi, %rdi
je 0x9bb1
callq 0x6570
movq %r14, %rdi
callq 0x6470
movq 0x70(%rbx), %rbx
testq %rbx, %rbx
je 0x9bdf
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x9bd0
callq 0x6570
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x6470
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rdi
callq 0x745b
nop
// File: /workspace/github_cpp_makefile_star2_O3/shaovie[P]reactor/src/async_send.cpp
// Function: async_send::push(async_send::item const&)
void async_send::push(const async_send::item &asi) {
    this->mtx.lock();
    this->writeq->push_back(asi);
    this->mtx.unlock();

    int expected = 0;
    if (!this->notified.compare_exchange_strong(expected, 1))
        return ;
    int64_t v = 1;
    int ret = 0;
    do {
        ret = ::write(this->efd, (void *)&v, sizeof(v));
    } while (ret == -1 && errno == EINTR);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r12
movq %rdi, %rbx
leaq 0x38(%rdi), %r14
movq %r14, %rdi
callq 0x6680
testl %eax, %eax
jne 0x9d23
movq 0x70(%rbx), %r15
movl (%r15), %esi
movl 0xc(%r15), %ecx
cmpl %esi, %ecx
jne 0x9c96
movq %r15, %rdi
callq 0x62b0
movl (%r15), %esi
movl 0xc(%r15), %ecx
movq 0x10(%r15), %rax
movslq 0x8(%r15), %rdx
leaq (%rdx,%rdx,4), %rdi
movl (%r12), %r8d
movl %r8d, (%rax,%rdi,8)
movq 0x10(%r12), %r8
movq %r8, 0x10(%rax,%rdi,8)
movq 0x20(%r12), %r8
movq %r8, 0x20(%rax,%rdi,8)
movq 0x18(%r12), %r8
movq %r8, 0x18(%rax,%rdi,8)
leal 0x1(%rdx), %eax
cltd
idivl %esi
movl %edx, 0x8(%r15)
incl %ecx
movl %ecx, 0xc(%r15)
movq %r14, %rdi
callq 0x6360
movl $0x1, %ecx
xorl %eax, %eax
lock
cmpxchgl %ecx, 0x60(%rbx)
jne 0x9d17
movq %rsp, %r14
movq $0x1, (%r14)
movl 0x30(%rbx), %edi
movl $0x8, %edx
movq %r14, %rsi
callq 0x6140
cmpl $-0x1, %eax
jne 0x9d17
callq 0x6040
cmpl $0x4, (%rax)
je 0x9cf8
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movl %eax, %edi
callq 0x6300
// File: /workspace/github_cpp_makefile_star2_O3/shaovie[P]reactor/src/async_send.cpp
// Function: async_send::on_read()
bool async_send::on_read() {
    if (this->readq->empty()) {
        this->mtx.lock();
        std::swap(this->readq, this->writeq);
        this->mtx.unlock();
    }
    for (auto i = 0; i < 256 && !this->readq->empty(); ++i) { // 1次最多处理256个
        async_send::item &asi = this->readq->front();
        poll_desc *pd = this->poll->get_poll_desc(asi.fd);
        if (pd != nullptr && asi.seq == pd->seq) // 保证对象没有释放呢
            pd->eh->sync_ordered_send(asi.asb);
        else
            delete[] asi.asb.buf;
        
        this->readq->pop_front();
    }
    if (!this->readq->empty()) // Ignore readable eventfd, continue
        return true;

    int64_t v = 0;
    int ret = 0;
    do {
        ret = ::read(this->efd, (void *)&v, sizeof(v));
    } while (ret == -1 && errno == EINTR);

    this->notified.store(0);
    return true;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq 0x68(%rdi), %rax
cmpl $0x0, 0xc(%rax)
jne 0x9d6a
leaq 0x38(%rbx), %r14
movq %r14, %rdi
callq 0x6680
testl %eax, %eax
jne 0x9e54
movdqu 0x68(%rbx), %xmm0
pshufd $0x4e, %xmm0, %xmm0     # xmm0 = xmm0[2,3,0,1]
movdqu %xmm0, 0x68(%rbx)
movq %r14, %rdi
callq 0x6360
movl $0x100, %ebp            # imm = 0x100
movq 0x68(%rbx), %rax
cmpl $0x0, 0xc(%rax)
je 0x9e19
movq 0x10(%rax), %rcx
movslq 0x4(%rax), %rax
leaq (%rax,%rax,4), %rax
leaq (%rcx,%rax,8), %r14
movq 0x18(%rbx), %rdi
movl (%r14), %esi
callq 0x6350
testq %rax, %rax
je 0x9dbb
movq 0x8(%r14), %rcx
cmpq 0x8(%rax), %rcx
jne 0x9dbb
movq 0x10(%rax), %rdi
addq $0x18, %r14
movq (%rdi), %rax
movq %r14, %rsi
callq *0x50(%rax)
jmp 0x9dc9
movq 0x20(%r14), %rdi
testq %rdi, %rdi
je 0x9dc9
callq 0x6570
movq 0x68(%rbx), %rcx
movl 0xc(%rcx), %esi
testl %esi, %esi
je 0x9e07
movq 0x10(%rcx), %rdx
movslq 0x4(%rcx), %rax
leaq (%rax,%rax,4), %rdi
movl $0xffffffff, (%rdx,%rdi,8) # imm = 0xFFFFFFFF
incl %eax
pxor %xmm0, %xmm0
movdqu %xmm0, 0x10(%rdx,%rdi,8)
movq $0x0, 0x20(%rdx,%rdi,8)
cltd
idivl (%rcx)
movl %edx, 0x4(%rcx)
decl %esi
movl %esi, 0xc(%rcx)
decl %ebp
jne 0x9d6f
movq 0x68(%rbx), %rax
cmpl $0x0, 0xc(%rax)
jne 0x9e49
leaq 0x8(%rsp), %r14
movq $0x0, (%r14)
movl 0x30(%rbx), %edi
movl $0x8, %edx
movq %r14, %rsi
callq 0x6640
cmpl $-0x1, %eax
jne 0x9e44
callq 0x6040
cmpl $0x4, (%rax)
je 0x9e25
xorl %eax, %eax
xchgl %eax, 0x60(%rbx)
movb $0x1, %al
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movl %eax, %edi
callq 0x6300
nop
// File: /workspace/github_cpp_makefile_star2_O3/shaovie[P]reactor/src/reactor.cpp
// Function: reactor::add_ev_handler(ev_handler*, int, unsigned int)
int reactor::add_ev_handler(ev_handler *eh, const int fd, const uint32_t events) {
    if (fd < 0 || eh == nullptr || events == 0)
        return -1;
    int i = 0;
    if (this->poller_num > 1)
        i = fd % this->poller_num;
    eh->set_reactor(this);
    return this->pollers[i].add(eh, fd, events);
}

// Assembly:
movl %edx, %r8d
testl %edx, %edx
sets %al
testq %rsi, %rsi
sete %dl
testl %ecx, %ecx
sete %r9b
orb %dl, %r9b
orb %al, %r9b
je 0xa1c4
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
movl (%rdi), %r9d
cmpl $0x2, %r9d
jl 0xa1d7
movl %r8d, %eax
xorl %edx, %edx
divl %r9d
jmp 0xa1d9
xorl %edx, %edx
movq %rdi, 0x20(%rsi)
movq %rdx, %rax
shlq $0x7, %rax
leaq (%rax,%rdx,8), %rax
addq 0x8(%rdi), %rax
movq %rax, %rdi
movl %r8d, %edx
jmp 0x67e0
nop
// File: /workspace/github_cpp_makefile_star2_O3/shaovie[P]reactor/src/reactor.cpp
// Function: reactor::append_ev(int, unsigned int)
int reactor::append_ev(const int fd, const uint32_t events) {
    if (fd < 0 || events == 0)
        return -1;
    int i = 0;
    if (this->poller_num > 1)
        i = fd % this->poller_num;
    return this->pollers[i].append(fd, events);
}

// Assembly:
movl %edx, %ecx
testl %esi, %esi
sets %al
testl %edx, %edx
sete %dl
orb %al, %dl
je 0xa222
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
movl (%rdi), %r8d
cmpl $0x2, %r8d
jl 0xa234
movl %esi, %eax
xorl %edx, %edx
divl %r8d
jmp 0xa236
xorl %edx, %edx
movq %rdx, %rax
shlq $0x7, %rax
leaq (%rax,%rdx,8), %rax
addq 0x8(%rdi), %rax
movq %rax, %rdi
movl %ecx, %edx
jmp 0x61f0
nop
// File: /workspace/github_cpp_makefile_star2_O3/shaovie[P]reactor/src/reactor.cpp
// Function: reactor::remove_ev(int, unsigned int)
int reactor::remove_ev(const int fd, const uint32_t events) {
    if (fd < 0 || events == 0)
        return -1;
    int i = 0;
    if (this->poller_num > 1)
        i = fd % this->poller_num;
    return this->pollers[i].remove(fd, events);
}

// Assembly:
movl %edx, %ecx
testl %esi, %esi
sets %al
testl %edx, %edx
sete %dl
orb %al, %dl
je 0xa266
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
movl (%rdi), %r8d
cmpl $0x2, %r8d
jl 0xa278
movl %esi, %eax
xorl %edx, %edx
divl %r8d
jmp 0xa27a
xorl %edx, %edx
movq %rdx, %rax
shlq $0x7, %rax
leaq (%rax,%rdx,8), %rax
addq 0x8(%rdi), %rax
movq %rax, %rdi
movl %ecx, %edx
jmp 0x6780
nop
// File: /workspace/github_cpp_makefile_star2_O3/shaovie[P]reactor/src/reactor.cpp
// Function: reactor::run(bool)
void reactor::run(const bool join) {
    if (!join) {
        for (int i = 0; i < this->poller_num; ++i) {
            std::thread thr(&poller::run, &(this->pollers[i]));
            thr.detach();
        }
        return ;
    }
    std::thread **threads = new std::thread*[this->poller_num]();
    for (int i = 0; i < this->poller_num; ++i) {
        threads[i] = new std::thread(&poller::run, &(this->pollers[i]));
    }
    for (int i = 0; i < this->poller_num; ++i) {
        threads[i]->join();
        delete threads[i];
    }
    delete[] threads;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movslq (%rdi), %r12
testl %esi, %esi
je 0xa37e
movq %r12, %rax
shlq $0x3, %rax
testl %r12d, %r12d
movq $-0x1, %r15
cmovnsq %rax, %r15
movq %r15, %rdi
callq 0x6030
movq %rax, %r14
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x62a0
testl %r12d, %r12d
jle 0xa374
xorl %ebp, %ebp
leaq 0x8(%rsp), %r12
xorl %r15d, %r15d
movl $0x8, %edi
callq 0x6490
movq %rax, %r13
movq 0x4ccc(%rip), %rax      # 0xefd0
movq %rax, 0x10(%rsp)
movq $0x0, 0x18(%rsp)
movq 0x8(%rbx), %rax
addq %rbp, %rax
movq %rax, 0x8(%rsp)
movq %r13, %rdi
leaq 0x10(%rsp), %rsi
movq %r12, %rdx
callq 0x60b0
movq %r13, (%r14,%r15,8)
incq %r15
movslq (%rbx), %rax
addq $0x88, %rbp
cmpq %rax, %r15
jl 0xa2f0
testl %eax, %eax
jle 0xa374
xorl %r12d, %r12d
movq (%r14,%r12,8), %r15
movq %r15, %rdi
callq 0x66f0
cmpq $0x0, (%r15)
jne 0xa404
movq %r15, %rdi
callq 0x6470
incq %r12
movslq (%rbx), %rax
cmpq %rax, %r12
jl 0xa34b
movq %r14, %rdi
callq 0x6570
jmp 0xa3e8
testl %r12d, %r12d
jle 0xa3e8
xorl %r13d, %r13d
leaq 0x8(%rsp), %r14
leaq 0x10(%rsp), %r15
leaq 0x20(%rsp), %r12
xorl %ebp, %ebp
movq 0x4c32(%rip), %rax      # 0xefd0
movq %rax, 0x10(%rsp)
movq $0x0, 0x18(%rsp)
movq 0x8(%rbx), %rax
addq %r13, %rax
movq %rax, 0x20(%rsp)
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x60b0
movq %r14, %rdi
callq 0x6730
cmpq $0x0, 0x8(%rsp)
jne 0xa404
incq %rbp
movslq (%rbx), %rax
addq $0x88, %r13
cmpq %rax, %rbp
jl 0xa397
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpq $0x0, 0x8(%rsp)
jne 0xa404
movq %rax, %rbx
jmp 0xa414
callq 0x6100
movq %rax, %rbx
movq %r13, %rdi
callq 0x6470
movq %rbx, %rdi
callq 0x6740
// File: /workspace/github_cpp_makefile_star2_O3/onai[P]npio/example1.c
// Function: main
int main()
{
  int i;
  npio_Array array;

  npio_init_array(&array);
  npio_load("test1.npy", &array);

  printf("shape: ");
  for (i = 0; i < array.dim; ++i)
    printf("%ld ", array.shape[i]);
  printf("\n");

  npio_free_array(&array);
  return 0;
}

// Assembly:
pushq %rax
leaq 0xe90(%rip), %rdi       # 0x2004
xorl %esi, %esi
xorl %eax, %eax
callq 0x1060
leaq 0xe8a(%rip), %rdi       # 0x200e
xorl %eax, %eax
callq 0x1040
movl $0xa, %edi
callq 0x1030
xorl %edi, %edi
callq 0x1050
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_cpp_makefile_star2_O3/schuyler[P]quickfix/src/wrapper.cpp
// Function: beacon2d_fix
void beacon2d_fix(Beacon2D *b, float tick, float rmsError, int maxTries) {
        Beacon2D estimate = b->Fix<Beacon2D::DifferenceSolver>(tick, rmsError, maxTries);
        //Beacon2D estimate = b->Fix<Beacon2D::RangeSolver>(rmsError);
        // TODO: take these out and return the values
        b->Position(estimate.Position());
        b->Error(estimate.Error());
    }

// Assembly:
pushq %r14
pushq %rbx
subq $0x68, %rsp
movl %esi, %edx
movq %rdi, %rbx
movq %rsp, %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0xdb30
movsd 0x20(%r14), %xmm0
movsd %xmm0, 0x20(%rbx)
movss 0x40(%r14), %xmm0
movss %xmm0, 0x40(%rbx)
movq 0x10(%r14), %rdi
callq 0xd740
movq (%r14), %rdi
callq 0xd740
addq $0x68, %rsp
popq %rbx
popq %r14
retq