// File: /workspace/github_cpp_makefile_star2_O3/theuni[P]libbtcnet/src/handler.cpp
// Function: CConnectionHandlerInt::OnDisconnected(long, bool)
void CConnectionHandlerInt::OnDisconnected(ConnID id, bool reconnect)
{
    assert(IsEventThread());
    std::unique_ptr<ConnectionBase> moved;
    reconnect = reconnect && !m_shutdown;
    {
        optional_lock(m_conn_mutex, m_enable_threading);
        auto it = m_connected.find(id);
        assert(it != m_connected.end());
        moved.swap(it->second);
        m_connected.erase(it);
    }

    bool outgoing = moved->IsOutgoing();
    if (outgoing)
        m_outgoing_conn_count--;
    else
        m_incoming_conn_count--;

    bool ret = m_interface.OnDisconnected(id, reconnect);
    if (reconnect && ret) {
        ConnID newId = GetNextConnectionIndex();
        auto it = m_connecting.emplace_hint(m_connecting.end(), newId, std::move(moved));
        it->second->Retry(newId);
    } else if (m_request_event)
        m_request_event.active();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
movb 0xec(%rdi), %r13b
cmpb $0x1, %r13b
jne 0x90d1
movq 0x168(%rbx), %r15
callq 0x4310
cmpq %rax, %r15
jne 0x9210
movb 0xed(%rbx), %r15b
leaq 0xf0(%rbx), %r12
movq %r12, %rdi
callq 0x44f0
testl %eax, %eax
jne 0x922f
xorb $0x1, %r15b
andb %r15b, %bpl
jmp 0x90e3
movb 0xed(%rbx), %al
xorb $0x1, %al
andb %al, %bpl
leaq 0xf0(%rbx), %r12
movq 0x10(%rbx), %rax
testq %rax, %rax
je 0x91f1
leaq 0x8(%rbx), %rcx
movq %rcx, %rsi
xorl %edx, %edx
cmpq %r14, 0x20(%rax)
setl %dl
cmovgeq %rax, %rsi
movq 0x10(%rax,%rdx,8), %rax
testq %rax, %rax
jne 0x90f7
cmpq %rcx, %rsi
je 0x91f1
cmpq %r14, 0x20(%rsi)
jg 0x91f1
movq 0x28(%rsi), %r15
movq %r15, 0x8(%rsp)
movq $0x0, 0x28(%rsi)
movq %rbx, %rdi
callq 0xadd0
testb %r13b, %r13b
je 0x9147
movq %r12, %rdi
callq 0x42c0
movq (%r15), %rax
movq %r15, %rdi
callq *0x20(%rax)
testb %al, %al
je 0x915c
decl 0xe0(%rbx)
jmp 0x9162
decl 0xe4(%rbx)
movq 0xc0(%rbx), %rdi
movq (%rdi), %rax
movzbl %bpl, %edx
movq %r14, %rsi
callq *0x50(%rax)
andb %al, %bpl
cmpb $0x1, %bpl
jne 0x91be
movq %rbx, %rdi
callq 0x925e
leaq 0x10(%rsp), %rdx
movq %rax, (%rdx)
leaq 0x30(%rbx), %rdi
addq $0x38, %rbx
leaq 0x8(%rsp), %rcx
movq %rbx, %rsi
callq 0xaf8e
movq 0x28(%rax), %rdi
movq 0x10(%rsp), %rsi
callq 0xdd70
movq 0x8(%rsp), %r15
testq %r15, %r15
jne 0x91d9
jmp 0x91e2
addq $0x1a0, %rbx            # imm = 0x1A0
movq %rbx, %rdi
callq 0x11b3e
testb %al, %al
je 0x91d9
movq %rbx, %rdi
callq 0x11b8e
movq (%r15), %rax
movq %r15, %rdi
callq *0x8(%rax)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x9934(%rip), %rdi      # 0x12b2c
leaq 0x9608(%rip), %rsi      # 0x12807
leaq 0x98ed(%rip), %rcx      # 0x12af3
movl $0xd9, %edx
callq 0x4260
leaq 0x96fe(%rip), %rdi      # 0x12915
leaq 0x95e9(%rip), %rsi      # 0x12807
leaq 0x98ce(%rip), %rcx      # 0x12af3
movl $0xd3, %edx
callq 0x4260
movl %eax, %edi
callq 0x4280
jmp 0x9238
movq %rax, %rbx
movq 0x8(%rsp), %r15
testq %r15, %r15
jne 0x924c
jmp 0x9255
jmp 0x9249
movq %rax, %rbx
movq (%r15), %rax
movq %r15, %rdi
callq *0x8(%rax)
movq %rbx, %rdi
callq 0x4640
nop