// File: /workspace/github_cpp_makefile_star2_O1/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 0x8420
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 0xd627
movq 0x8(%rbx), %r14
movq 0x10(%rbx), %r12
movq %r12, %r13
subq %r14, %r13
sarq $0x5, %r13
testq %r13, %r13
jle 0xd583
incq %r13
movq %r14, %rdi
callq 0x8420
cmpl %ebp, %eax
je 0xd5d0
leaq 0x8(%r14), %r15
movq %r15, %rdi
callq 0x8420
cmpl %ebp, %eax
je 0xd5d3
leaq 0x10(%r14), %r15
movq %r15, %rdi
callq 0x8420
cmpl %ebp, %eax
je 0xd5d3
leaq 0x18(%r14), %r15
movq %r15, %rdi
callq 0x8420
cmpl %ebp, %eax
je 0xd5d3
addq $0x20, %r14
decq %r13
cmpq $0x1, %r13
jg 0xd536
movq %r12, %rax
subq %r14, %rax
sarq $0x3, %rax
cmpq $0x1, %rax
je 0xd5c2
cmpq $0x2, %rax
je 0xd5b2
movq %r12, %r15
cmpq $0x3, %rax
jne 0xd5d3
movq %r14, %rdi
callq 0x8420
cmpl %ebp, %eax
je 0xd5d0
addq $0x8, %r14
movq %r14, %rdi
callq 0x8420
cmpl %ebp, %eax
je 0xd5d0
addq $0x8, %r14
movq %r14, %rdi
callq 0x8420
cmpl %ebp, %eax
cmovneq %r12, %r14
movq %r14, %r15
cmpq %r12, %r15
sete %al
leaq 0x8(%r15), %r14
cmpq %r12, %r14
sete %cl
orb %al, %cl
jne 0xd606
movq %r14, %rdi
callq 0x8420
cmpl %ebp, %eax
je 0xd5fd
movq (%r14), %rax
movq %rax, (%r15)
addq $0x8, %r15
addq $0x8, %r14
cmpq %r12, %r14
jne 0xd5e7
movq 0x10(%rbx), %rax
cmpq %rax, %r15
je 0xd631
movq 0x10(%rbx), %rcx
movq %rcx, %rdx
subq %rax, %rdx
addq %rdx, %r15
cmpq %r15, %rcx
je 0xd631
movq %r15, 0x10(%rbx)
jmp 0xd631
callq 0x8030
cmpl $0x2, (%rax)
jne 0xd640
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x8220
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x8340
leaq 0x13c8(%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 0x596a(%rip), %rsi      # 0x12ff0
movq 0x58ab(%rip), %rdx      # 0x12f38
movq %rbx, %rdi
callq 0x8900
movq %rax, %r14
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xd6bb
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x84c0
jmp 0xd6bb
movq %rax, %r14
movb $0x1, %bpl
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xd6de
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x84c0
jmp 0xd6de
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0xd6eb
movq %rbx, %rdi
callq 0x8330
movq %r14, %rdi
callq 0x8970
nop