// File: /workspace/github_cpp_makefile_star2_O3/theuni[P]libbtcnet/src/handler.cpp
// Function: CConnectionHandlerInt::ShutdownInt()
void CConnectionHandlerInt::ShutdownInt()
{
    assert(IsEventThread());
    if (m_shutdown)
        return;

    DEBUG_PRINT(LOGINFO, "shutdown started");

    std::map<ConnID, std::unique_ptr<ConnectionBase> > disconnecting;
    {
        optional_lock(m_conn_mutex, m_enable_threading);
        disconnecting.swap(m_connected);
    }
    std::map<ConnID, std::unique_ptr<CConnListener> > binds;
    {
        optional_lock(m_bind_mutex, m_enable_threading);
        binds.swap(m_binds);
    }

    m_shutdown = true;

    for (auto iter = disconnecting.begin(); iter != disconnecting.end(); disconnecting.erase(iter++)) {
        if (iter->second->IsOutgoing())
            m_outgoing_conn_count--;
        else
            m_incoming_conn_count--;
        m_interface.OnDisconnected(iter->first, false);
    }

    for (auto iter = m_connecting.begin(); iter != m_connecting.end(); m_connecting.erase(iter++)) {
        if (iter->second->IsOutgoing()) {
            const CConnection& conn = iter->second->GetBaseConnection();
            m_interface.OnConnectionFailure(conn, conn, false);
        }
    }

    m_dns_resolves.clear();
    binds.clear();

    m_dns_base.free();
    m_outgoing_rate_limit.free();
    m_incoming_rate_limit.free();
    m_incoming_rate_cfg.free();
    m_outgoing_rate_cfg.free();
    m_request_event.free();
    m_shutdown_event.free();

    assert(m_connecting.empty());
    assert(disconnecting.empty());
    assert(m_connected.empty());
    assert(binds.empty());
    assert(m_dns_resolves.empty());
    assert(!m_outgoing_conn_count);
    assert(!m_incoming_conn_count);

    DEBUG_PRINT(LOGINFO, "shutdown complete");
    event_base_loopbreak(m_event_base);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x60, %rsp
movq %rdi, %rbx
cmpb $0x1, 0xec(%rdi)
jne 0x89d1
movq 0x168(%rbx), %r14
callq 0x4310
cmpq %rax, %r14
jne 0x8c71
cmpb $0x0, 0xed(%rbx)
jne 0x8c63
leaq 0x8(%rsp), %r13
movl $0x0, (%r13)
xorl %eax, %eax
movq %rax, 0x8(%r13)
movq %r13, 0x10(%r13)
movq %r13, 0x18(%r13)
movq %rax, 0x20(%r13)
leaq 0xf0(%rbx), %r14
movq %r14, %rdi
callq 0x44f0
testl %eax, %eax
jne 0x8d88
leaq 0xed(%rbx), %r15
movq %rsp, %rdi
movq %rbx, %rsi
callq 0xac10
movq %r14, %rdi
callq 0x42c0
jmp 0x8a0f
cmpb $0x0, 0xed(%rbx)
jne 0x8c63
leaq 0xed(%rbx), %r15
leaq 0x8(%rsp), %r13
movl $0x0, (%r13)
xorl %eax, %eax
movq %rax, 0x8(%r13)
movq %r13, 0x10(%r13)
movq %r13, 0x18(%r13)
movq %rax, 0x20(%r13)
movq %rsp, %rdi
movq %rbx, %rsi
callq 0xac10
leaq 0x38(%rsp), %rax
movl $0x0, (%rax)
xorl %ecx, %ecx
movq %rcx, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
movq %rcx, 0x20(%rax)
cmpb $0x1, 0xec(%rbx)
jne 0x8a64
leaq 0x118(%rbx), %r14
movq %r14, %rdi
callq 0x44f0
testl %eax, %eax
jne 0x8d8f
leaq 0x60(%rbx), %rsi
leaq 0x30(%rsp), %rdi
callq 0xacf0
movq %r14, %rdi
callq 0x42c0
jmp 0x8a72
leaq 0x60(%rbx), %rsi
leaq 0x30(%rsp), %rdi
callq 0xacf0
movb $0x1, (%r15)
movq 0x18(%rsp), %r14
cmpq %r13, %r14
je 0x8ad0
movq %rsp, %r15
movq 0x28(%r14), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
testb %al, %al
je 0x8a99
decl 0xe0(%rbx)
jmp 0x8a9f
decl 0xe4(%rbx)
movq 0xc0(%rbx), %rdi
movq 0x20(%r14), %rsi
movq (%rdi), %rax
xorl %edx, %edx
callq *0x50(%rax)
movq %r14, %rdi
callq 0x4290
movq %rax, %r12
movq %r15, %rdi
movq %r14, %rsi
callq 0xadd0
movq %r12, %r14
cmpq %r13, %r12
jne 0x8a83
movq 0x48(%rbx), %r14
leaq 0x38(%rbx), %r13
cmpq %r13, %r14
je 0x8b2c
leaq 0x30(%rbx), %r15
movq 0x28(%r14), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
testb %al, %al
je 0x8b0e
movq 0x28(%r14), %rdi
callq 0xdf98
movq 0xc0(%rbx), %rdi
movq (%rdi), %r8
movq %rax, %rsi
movq %rax, %rdx
xorl %ecx, %ecx
callq *0x30(%r8)
movq %r14, %rdi
callq 0x4290
movq %rax, %r12
movq %r15, %rdi
movq %r14, %rsi
callq 0xadd0
movq %r12, %r14
cmpq %r13, %r12
jne 0x8ae1
leaq 0x90(%rbx), %rdi
callq 0xae14
leaq 0x30(%rsp), %rdi
callq 0xae42
movq 0x198(%rbx), %rdi
testq %rdi, %rdi
je 0x8b53
callq 0x10d3e
movq $0x0, 0x198(%rbx)
movq 0x188(%rbx), %rdi
testq %rdi, %rdi
je 0x8b6f
callq 0x10d32
movq $0x0, 0x188(%rbx)
movq 0x180(%rbx), %rdi
testq %rdi, %rdi
je 0x8b8b
callq 0x10d32
movq $0x0, 0x180(%rbx)
movq 0x170(%rbx), %rdi
testq %rdi, %rdi
je 0x8ba7
callq 0x10d2c
movq $0x0, 0x170(%rbx)
movq 0x178(%rbx), %rdi
testq %rdi, %rdi
je 0x8bc3
callq 0x10d2c
movq $0x0, 0x178(%rbx)
leaq 0x1a0(%rbx), %rdi
callq 0x11b22
leaq 0x1c8(%rbx), %rdi
callq 0x11b22
cmpq $0x0, 0x58(%rbx)
jne 0x8c90
cmpq $0x0, 0x28(%rsp)
jne 0x8caf
cmpq $0x0, 0x28(%rbx)
jne 0x8cce
cmpq $0x0, 0x58(%rsp)
jne 0x8ced
cmpq $0x0, 0xb8(%rbx)
jne 0x8d0c
cmpl $0x0, 0xe0(%rbx)
jne 0x8d2b
cmpl $0x0, 0xe4(%rbx)
jne 0x8d4a
movq 0x190(%rbx), %rdi
testq %rdi, %rdi
je 0x8d69
callq 0x4480
leaq 0x30(%rsp), %rdi
callq 0xaa7e
movq %rsp, %rdi
callq 0xaad2
addq $0x60, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x9c9d(%rip), %rdi      # 0x12915
leaq 0x9b88(%rip), %rsi      # 0x12807
leaq 0x9c9f(%rip), %rcx      # 0x12925
movl $0x67, %edx
callq 0x4260
leaq 0x9cb8(%rip), %rdi      # 0x1294f
leaq 0x9b69(%rip), %rsi      # 0x12807
leaq 0x9c80(%rip), %rcx      # 0x12925
movl $0x94, %edx
callq 0x4260
leaq 0x9cae(%rip), %rdi      # 0x12964
leaq 0x9b4a(%rip), %rsi      # 0x12807
leaq 0x9c61(%rip), %rcx      # 0x12925
movl $0x95, %edx
callq 0x4260
leaq 0x9ca5(%rip), %rdi      # 0x1297a
leaq 0x9b2b(%rip), %rsi      # 0x12807
leaq 0x9c42(%rip), %rcx      # 0x12925
movl $0x96, %edx
callq 0x4260
leaq 0x9c9a(%rip), %rdi      # 0x1298e
leaq 0x9b0c(%rip), %rsi      # 0x12807
leaq 0x9c23(%rip), %rcx      # 0x12925
movl $0x97, %edx
callq 0x4260
leaq 0x9c89(%rip), %rdi      # 0x1299c
leaq 0x9aed(%rip), %rsi      # 0x12807
leaq 0x9c04(%rip), %rcx      # 0x12925
movl $0x98, %edx
callq 0x4260
leaq 0x9c81(%rip), %rdi      # 0x129b3
leaq 0x9ace(%rip), %rsi      # 0x12807
leaq 0x9be5(%rip), %rcx      # 0x12925
movl $0x99, %edx
callq 0x4260
leaq 0x9c79(%rip), %rdi      # 0x129ca
leaq 0x9aaf(%rip), %rsi      # 0x12807
leaq 0x9bc6(%rip), %rcx      # 0x12925
movl $0x9a, %edx
callq 0x4260
leaq 0xa1df(%rip), %rdi      # 0x12f4f
leaq 0xa1e9(%rip), %rsi      # 0x12f60
leaq 0xa1f3(%rip), %rcx      # 0x12f71
movl $0x4b, %edx
callq 0x4260
movl %eax, %edi
callq 0x4280
movl %eax, %edi
callq 0x4280
jmp 0x8da3
movq %rax, %rbx
jmp 0x8db0
jmp 0x8da3
jmp 0x8da3
jmp 0x8da3
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0xaa7e
movq %rsp, %rdi
callq 0xaad2
movq %rbx, %rdi
callq 0x4640