// File: /workspace/github_cpp_makefile_star2_O1/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
movb 0xec(%rdi), %bpl
cmpb $0x1, %bpl
jne 0x89e7
movq 0x168(%rbx), %r14
callq 0x4310
cmpq %rax, %r14
jne 0x8ccb
cmpb $0x0, 0xed(%rbx)
jne 0x8cbc
leaq 0x10(%rsp), %r13
movl $0x0, (%r13)
xorl %eax, %eax
movq %rax, 0x8(%r13)
movq %r13, 0x10(%r13)
movq %r13, 0x18(%r13)
movq %rax, 0x20(%r13)
testb %bpl, %bpl
je 0x8a4b
leaq 0xf0(%rbx), %r14
movq %r14, %rdi
callq 0x44f0
testl %eax, %eax
jne 0x8de2
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0xad7a
testb %bpl, %bpl
je 0x8a58
movq %r14, %rdi
callq 0x42c0
jmp 0x8a58
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0xad7a
leaq 0x40(%rsp), %rax
movl $0x0, (%rax)
xorl %ecx, %ecx
movq %rcx, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
movq %rcx, 0x20(%rax)
movb 0xec(%rbx), %bpl
cmpb $0x1, %bpl
jne 0x8ab6
leaq 0x118(%rbx), %r14
movq %r14, %rdi
callq 0x44f0
testl %eax, %eax
jne 0x8de9
leaq 0x60(%rbx), %rsi
leaq 0x38(%rsp), %rdi
callq 0xae6e
testb %bpl, %bpl
je 0x8ac4
movq %r14, %rdi
callq 0x42c0
jmp 0x8ac4
leaq 0x60(%rbx), %rsi
leaq 0x38(%rsp), %rdi
callq 0xae6e
movb $0x1, 0xed(%rbx)
movq 0x20(%rsp), %r14
cmpq %r13, %r14
je 0x8b27
leaq 0x8(%rsp), %r15
movq 0x28(%r14), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
testb %al, %al
je 0x8af0
decl 0xe0(%rbx)
jmp 0x8af6
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 0xaf62
movq %r12, %r14
cmpq %r13, %r12
jne 0x8ada
movq 0x48(%rbx), %r14
leaq 0x38(%rbx), %r13
cmpq %r13, %r14
je 0x8b83
leaq 0x30(%rbx), %r15
movq 0x28(%r14), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
testb %al, %al
je 0x8b65
movq 0x28(%r14), %rdi
callq 0xe14c
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 0xaf62
movq %r12, %r14
cmpq %r13, %r12
jne 0x8b38
leaq 0x90(%rbx), %rdi
callq 0xafa6
leaq 0x38(%rsp), %rdi
callq 0xafd4
movq 0x198(%rbx), %rdi
testq %rdi, %rdi
je 0x8baa
callq 0x10ee6
movq $0x0, 0x198(%rbx)
movq 0x188(%rbx), %rdi
testq %rdi, %rdi
je 0x8bc6
callq 0x10eda
movq $0x0, 0x188(%rbx)
movq 0x180(%rbx), %rdi
testq %rdi, %rdi
je 0x8be2
callq 0x10eda
movq $0x0, 0x180(%rbx)
movq 0x170(%rbx), %rdi
testq %rdi, %rdi
je 0x8bfe
callq 0x10ed4
movq $0x0, 0x170(%rbx)
movq 0x178(%rbx), %rdi
testq %rdi, %rdi
je 0x8c1a
callq 0x10ed4
movq $0x0, 0x178(%rbx)
leaq 0x1a0(%rbx), %rdi
callq 0x11ce4
leaq 0x1c8(%rbx), %rdi
callq 0x11ce4
cmpq $0x0, 0x58(%rbx)
jne 0x8cea
cmpq $0x0, 0x30(%rsp)
jne 0x8d09
cmpq $0x0, 0x28(%rbx)
jne 0x8d28
cmpq $0x0, 0x60(%rsp)
jne 0x8d47
cmpq $0x0, 0xb8(%rbx)
jne 0x8d66
cmpl $0x0, 0xe0(%rbx)
jne 0x8d85
cmpl $0x0, 0xe4(%rbx)
jne 0x8da4
movq 0x190(%rbx), %rdi
testq %rdi, %rdi
je 0x8dc3
callq 0x4480
leaq 0x38(%rsp), %rdi
callq 0xabe4
leaq 0x8(%rsp), %rdi
callq 0xac38
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x9c47(%rip), %rdi      # 0x12919
leaq 0x9b32(%rip), %rsi      # 0x1280b
leaq 0x9c49(%rip), %rcx      # 0x12929
movl $0x67, %edx
callq 0x4260
leaq 0x9c62(%rip), %rdi      # 0x12953
leaq 0x9b13(%rip), %rsi      # 0x1280b
leaq 0x9c2a(%rip), %rcx      # 0x12929
movl $0x94, %edx
callq 0x4260
leaq 0x9c58(%rip), %rdi      # 0x12968
leaq 0x9af4(%rip), %rsi      # 0x1280b
leaq 0x9c0b(%rip), %rcx      # 0x12929
movl $0x95, %edx
callq 0x4260
leaq 0x9c4f(%rip), %rdi      # 0x1297e
leaq 0x9ad5(%rip), %rsi      # 0x1280b
leaq 0x9bec(%rip), %rcx      # 0x12929
movl $0x96, %edx
callq 0x4260
leaq 0x9c44(%rip), %rdi      # 0x12992
leaq 0x9ab6(%rip), %rsi      # 0x1280b
leaq 0x9bcd(%rip), %rcx      # 0x12929
movl $0x97, %edx
callq 0x4260
leaq 0x9c33(%rip), %rdi      # 0x129a0
leaq 0x9a97(%rip), %rsi      # 0x1280b
leaq 0x9bae(%rip), %rcx      # 0x12929
movl $0x98, %edx
callq 0x4260
leaq 0x9c2b(%rip), %rdi      # 0x129b7
leaq 0x9a78(%rip), %rsi      # 0x1280b
leaq 0x9b8f(%rip), %rcx      # 0x12929
movl $0x99, %edx
callq 0x4260
leaq 0x9c23(%rip), %rdi      # 0x129ce
leaq 0x9a59(%rip), %rsi      # 0x1280b
leaq 0x9b70(%rip), %rcx      # 0x12929
movl $0x9a, %edx
callq 0x4260
leaq 0xa189(%rip), %rdi      # 0x12f53
leaq 0xa193(%rip), %rsi      # 0x12f64
leaq 0xa19d(%rip), %rcx      # 0x12f75
movl $0x4b, %edx
callq 0x4260
movl %eax, %edi
callq 0x4280
movl %eax, %edi
callq 0x4280
jmp 0x8dfd
movq %rax, %rbx
jmp 0x8e0a
jmp 0x8dfd
jmp 0x8dfd
jmp 0x8dfd
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0xabe4
leaq 0x8(%rsp), %rdi
callq 0xac38
movq %rbx, %rdi
callq 0x4640