// File: /workspace/github_cpp_makefile_star2_O3/dak98[P]SocketIO/src/epoll.cpp
// Function: socket_io::epoll::get_event() const
auto epoll::get_event() const -> event
{
    epoll_event events[1];
    int error_code = epoll_wait(handle, events, 1, -1);
    if (error_code == -1 && errno == EINTR)
	throw std::system_error{std::make_error_code(std::errc::interrupted)};
    if (error_code == -1)
	throw std::runtime_error{"An error occured while acquiring an event: " +
		                 get_errno_as_string()};

    auto it = std::find_if(std::begin(monitored_sockets),
			   std::end(monitored_sockets),
			   [=](socket_view const& view)
			   { return view.get_native_handle() ==
			            events[0].data.fd; });
    return {events[0].events, *it};
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, %r14
movl (%rdi), %edi
leaq 0xc(%rsp), %rsi
movl $0x1, %edx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0x8210
cmpl $-0x1, %eax
je 0xd835
movq 0x8(%r14), %rbx
movq 0x10(%r14), %r15
movl 0x10(%rsp), %ebp
movq %r15, %r12
subq %rbx, %r12
movq %r12, %r13
sarq $0x5, %r13
testq %r13, %r13
jle 0xd7c8
incq %r13
movq %rbx, %rdi
callq 0x8430
cmpl %ebp, %eax
je 0xd7fa
leaq 0x8(%rbx), %r14
movq %r14, %rdi
callq 0x8430
cmpl %ebp, %eax
je 0xd814
leaq 0x10(%rbx), %r14
movq %r14, %rdi
callq 0x8430
cmpl %ebp, %eax
je 0xd814
leaq 0x18(%rbx), %r14
movq %r14, %rdi
callq 0x8430
cmpl %ebp, %eax
je 0xd814
addq $0x20, %rbx
decq %r13
addq $-0x20, %r12
cmpq $0x1, %r13
jg 0xd77b
sarq $0x3, %r12
cmpq $0x1, %r12
je 0xd803
cmpq $0x2, %r12
je 0xd7ee
cmpq $0x3, %r12
jne 0xd811
movq %rbx, %rdi
callq 0x8430
cmpl %ebp, %eax
je 0xd7fa
addq $0x8, %rbx
movq %rbx, %rdi
callq 0x8430
cmpl %ebp, %eax
jne 0xd7ff
movq %rbx, %r14
jmp 0xd814
addq $0x8, %rbx
movq %rbx, %rdi
callq 0x8430
cmpl %ebp, %eax
cmoveq %rbx, %r15
movq %r15, %r14
movl 0xc(%rsp), %ecx
movl (%r14), %eax
movl 0x4(%r14), %edx
shlq $0x20, %rax
orq %rcx, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x8030
cmpl $0x4, (%rax)
jne 0xd877
movl $0x20, %edi
callq 0x8220
movq %rax, %rbx
callq 0x8240
movq %rbx, %rdi
movl $0x4, %esi
movq %rax, %rdx
callq 0x8310
movq 0x56b8(%rip), %rsi      # 0x12f20
movq 0x56d1(%rip), %rdx      # 0x12f40
movq %rbx, %rdi
callq 0x8900
movl $0x10, %edi
callq 0x8220
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x8350
leaq 0x11b8(%rip), %rsi      # 0xea4d
leaq 0x38(%rsp), %rdi
leaq 0x18(%rsp), %rdx
callq 0x88e0
movb $0x1, %bpl
leaq 0x38(%rsp), %rsi
movq %rbx, %rdi
callq 0x88a0
xorl %ebp, %ebp
movq 0x5733(%rip), %rsi      # 0x12ff0
movq 0x5674(%rip), %rdx      # 0x12f38
movq %rbx, %rdi
callq 0x8900
movq %rax, %r14
leaq 0x48(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xd8ea
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x84c0
leaq 0x28(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xd905
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x84c0
testb %bpl, %bpl
jne 0xd931
jmp 0xd939
movq %rax, %r14
leaq 0x28(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xd931
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x84c0
jmp 0xd931
jmp 0xd92e
movq %rax, %r14
movq %rbx, %rdi
callq 0x8340
movq %r14, %rdi
callq 0x8970
nop