// File: /workspace/github_cpp_makefile_star2_O1/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 0x9118
movq 0x168(%rbx), %r15
callq 0x4310
cmpq %rax, %r15
jne 0x9281
movq $0x0, 0x8(%rsp)
movb 0xed(%rbx), %r12b
leaq 0xf0(%rbx), %r15
testb %r13b, %r13b
je 0x9144
movq %r15, %rdi
callq 0x44f0
testl %eax, %eax
jne 0x92a0
movq 0x10(%rbx), %rdx
leaq 0x8(%rbx), %rax
movq %rax, %rcx
testq %rdx, %rdx
je 0x916f
movq %rax, %rcx
xorl %esi, %esi
cmpq %r14, 0x20(%rdx)
setl %sil
cmovgeq %rdx, %rcx
movq 0x10(%rdx,%rsi,8), %rdx
testq %rdx, %rdx
jne 0x9157
movq %rax, %rsi
cmpq %rax, %rcx
je 0x9182
cmpq %r14, 0x20(%rcx)
cmovgq %rax, %rcx
movq %rcx, %rsi
cmpq %rax, %rsi
je 0x9262
movq 0x8(%rsp), %rax
movq 0x28(%rsi), %rcx
movq %rcx, 0x8(%rsp)
movq %rax, 0x28(%rsi)
movq %rbx, %rdi
callq 0xaf62
testb %r13b, %r13b
je 0x91b2
movq %r15, %rdi
callq 0x42c0
movq 0x8(%rsp), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
xorb $0x1, %r12b
andb %bpl, %r12b
testb %al, %al
je 0x91d0
decl 0xe0(%rbx)
jmp 0x91d6
decl 0xe4(%rbx)
movq 0xc0(%rbx), %rdi
movq (%rdi), %rax
movzbl %r12b, %edx
movq %r14, %rsi
callq *0x50(%rax)
andb %al, %r12b
cmpb $0x1, %r12b
jne 0x9228
movq %rbx, %rdi
callq 0x92ca
leaq 0x10(%rsp), %rdx
movq %rax, (%rdx)
leaq 0x30(%rbx), %rdi
addq $0x38, %rbx
leaq 0x8(%rsp), %rcx
movq %rbx, %rsi
callq 0xb11a
movq 0x28(%rax), %rdi
movq 0x10(%rsp), %rsi
callq 0xdf14
jmp 0x9243
addq $0x1a0, %rbx            # imm = 0x1A0
movq %rbx, %rdi
callq 0x11d00
testb %al, %al
je 0x9243
movq %rbx, %rdi
callq 0x11d50
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x9253
movq (%rdi), %rax
callq *0x8(%rax)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x98c7(%rip), %rdi      # 0x12b30
leaq 0x959b(%rip), %rsi      # 0x1280b
leaq 0x9880(%rip), %rcx      # 0x12af7
movl $0xd9, %edx
callq 0x4260
leaq 0x9691(%rip), %rdi      # 0x12919
leaq 0x957c(%rip), %rsi      # 0x1280b
leaq 0x9861(%rip), %rcx      # 0x12af7
movl $0xd3, %edx
callq 0x4260
movl %eax, %edi
callq 0x4280
jmp 0x92af
jmp 0x92af
jmp 0x92af
jmp 0x92af
movq %rax, %rbx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x92c2
movq (%rdi), %rax
callq *0x8(%rax)
movq %rbx, %rdi
callq 0x4640