// File: /workspace/github_cpp_makefile_star2_O3/dak98[P]SocketIO/src/epoll.cpp
// Function: socket_io::epoll::remove(socket_io::socket_view const&)
auto epoll::remove(socket_view const& to_stop_monitor) -> void
{
    int const sockfd = to_stop_monitor.get_native_handle();
    epoll_event config { 0, { .fd = sockfd } };
    if (epoll_ctl(handle, EPOLL_CTL_DEL, sockfd, &config) == -1)
    {
	if (errno == ENOENT)
	    return;
	throw std::runtime_error{"An error occured while removing a fd: " +
		                 get_errno_as_string()};
    }
    
    auto new_end = std::remove_if(std::begin(monitored_sockets),
				  std::end(monitored_sockets),
				  [=](socket_view const& view)
				  { return view.get_native_handle() ==
				           sockfd; });
    monitored_sockets.erase(new_end, std::end(monitored_sockets));		   
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x8430
movl %eax, %ebp
leaq 0x4c(%rsp), %rcx
movl $0x0, (%rcx)
movl %eax, 0x4(%rcx)
movl (%rbx), %edi
movl $0x2, %esi
movl %eax, %edx
callq 0x86c0
cmpl $-0x1, %eax
je 0xd5c8
movq 0x8(%rbx), %r14
movq %rbx, (%rsp)
movq 0x10(%rbx), %rbx
movq %rbx, %r12
subq %r14, %r12
movq %r12, %r13
sarq $0x5, %r13
testq %r13, %r13
jle 0xd58c
incq %r13
movq %r14, %rdi
callq 0x8430
cmpl %ebp, %eax
je 0xd62b
leaq 0x8(%r14), %r15
movq %r15, %rdi
callq 0x8430
cmpl %ebp, %eax
je 0xd62e
leaq 0x10(%r14), %r15
movq %r15, %rdi
callq 0x8430
cmpl %ebp, %eax
je 0xd62e
leaq 0x18(%r14), %r15
movq %r15, %rdi
callq 0x8430
cmpl %ebp, %eax
je 0xd62e
addq $0x20, %r14
decq %r13
addq $-0x20, %r12
cmpq $0x1, %r13
jg 0xd52f
sarq $0x3, %r12
cmpq $0x1, %r12
je 0xd64a
cmpq $0x2, %r12
je 0xd634
cmpq $0x3, %r12
jne 0xd694
movq %r14, %rdi
callq 0x8430
cmpl %ebp, %eax
movq (%rsp), %r12
je 0xd65c
addq $0x8, %r14
jmp 0xd638
callq 0x8030
cmpl $0x2, (%rax)
je 0xd6a7
movl $0x10, %edi
callq 0x8220
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x8350
leaq 0x1432(%rip), %rsi      # 0xea26
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x88e0
movb $0x1, %bpl
leaq 0x28(%rsp), %rsi
movq %rbx, %rdi
callq 0x88a0
xorl %ebp, %ebp
movq 0x59d4(%rip), %rsi      # 0x12ff0
movq 0x5915(%rip), %rdx      # 0x12f38
movq %rbx, %rdi
callq 0x8900
movq %r14, %r15
movq (%rsp), %r12
jmp 0xd65f
movq (%rsp), %r12
movq %r14, %rdi
callq 0x8430
cmpl %ebp, %eax
je 0xd65c
addq $0x8, %r14
jmp 0xd64e
movq (%rsp), %r12
movq %r14, %rdi
callq 0x8430
cmpl %ebp, %eax
cmovneq %rbx, %r14
movq %r14, %r15
cmpq %rbx, %r15
sete %al
leaq 0x8(%r15), %r14
cmpq %rbx, %r14
sete %cl
orb %al, %cl
jne 0xd69b
movq %r14, %rdi
callq 0x8430
cmpl %ebp, %eax
je 0xd689
movq (%r14), %rax
movq %rax, (%r15)
addq $0x8, %r15
addq $0x8, %r14
cmpq %rbx, %r14
jne 0xd673
jmp 0xd69b
movq %rbx, %r15
movq (%rsp), %r12
cmpq 0x10(%r12), %r15
je 0xd6a7
movq %r15, 0x10(%r12)
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xd6d4
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x84c0
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xd6ef
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x84c0
testb %bpl, %bpl
jne 0xd719
jmp 0xd721
movq %rax, %r14
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xd719
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x84c0
jmp 0xd719
movq %rax, %r14
movq %rbx, %rdi
callq 0x8340
movq %r14, %rdi
callq 0x8970
nop