// File: /workspace/github_cpp_makefile_star2_O2/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 $0x70, %rsp
movq %rdi, %rbx
callq 0x8016
testb %al, %al
je 0x7ef3
cmpb $0x0, 0xed(%rbx)
jne 0x7ee5
leaq 0x48(%rsp), %r13
andl $0x0, (%r13)
andq $0x0, 0x8(%r13)
movq %r13, 0x10(%r13)
movq %r13, 0x18(%r13)
andq $0x0, 0x20(%r13)
leaq 0xf0(%rbx), %rdi
movb 0xec(%rbx), %al
movq %rdi, 0x10(%rsp)
movb %al, 0x18(%rsp)
cmpb $0x1, %al
jne 0x7cdd
callq 0x994c
leaq 0x40(%rsp), %rdi
movq %rbx, %rsi
callq 0x9abc
leaq 0x10(%rsp), %rdi
callq 0x96b0
leaq 0x18(%rsp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
leaq 0x118(%rbx), %rdi
movb 0xec(%rbx), %al
movq %rdi, (%rsp)
movb %al, 0x8(%rsp)
cmpb $0x1, %al
jne 0x7d2c
callq 0x994c
leaq 0x60(%rbx), %rsi
leaq 0x10(%rsp), %rdi
callq 0x9b80
movq %rsp, %rdi
callq 0x96b0
movb $0x1, 0xed(%rbx)
leaq 0x40(%rsp), %r14
movq 0x18(%r14), %r15
cmpq %r13, %r15
je 0x7da1
movq 0x28(%r15), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
testb %al, %al
je 0x7d6d
decl 0xe0(%rbx)
jmp 0x7d73
decl 0xe4(%rbx)
movq 0xc0(%rbx), %rdi
movq 0x20(%r15), %rsi
movq (%rdi), %rax
xorl %edx, %edx
callq *0x50(%rax)
movq %r15, %rdi
callq 0x4290
movq %rax, %r12
movq %r14, %rdi
movq %r15, %rsi
callq 0x9c10
movq %r12, %r15
jmp 0x7d52
leaq 0x30(%rbx), %r14
movq 0x48(%rbx), %r15
leaq 0x38(%rbx), %r13
cmpq %r13, %r15
je 0x7dfa
movq 0x28(%r15), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
testb %al, %al
je 0x7ddf
movq 0x28(%r15), %rdi
callq 0xc54a
movq 0xc0(%rbx), %rdi
movq (%rdi), %r8
movq %rax, %rsi
movq %rax, %rdx
xorl %ecx, %ecx
callq *0x30(%r8)
movq %r15, %rdi
callq 0x4290
movq %rax, %r12
movq %r14, %rdi
movq %r15, %rsi
callq 0x9c10
movq %r12, %r15
jmp 0x7dad
leaq 0x90(%rbx), %rdi
callq 0x9c5e
leaq 0x10(%rsp), %rdi
callq 0x9c8c
leaq 0x198(%rbx), %rdi
callq 0x96c0
leaq 0x188(%rbx), %rdi
callq 0x96d8
leaq 0x180(%rbx), %rdi
callq 0x96d8
leaq 0x170(%rbx), %rdi
callq 0x96f0
leaq 0x178(%rbx), %rdi
callq 0x96f0
leaq 0x1a0(%rbx), %rdi
callq 0xf874
leaq 0x1c8(%rbx), %rdi
callq 0xf874
cmpq $0x0, 0x58(%rbx)
jne 0x7f10
cmpq $0x0, 0x68(%rsp)
jne 0x7f2f
cmpq $0x0, 0x28(%rbx)
jne 0x7f4e
cmpq $0x0, 0x38(%rsp)
jne 0x7f6d
cmpq $0x0, 0xb8(%rbx)
jne 0x7f8c
cmpl $0x0, 0xe0(%rbx)
jne 0x7fab
cmpl $0x0, 0xe4(%rbx)
jne 0x7fca
addq $0x190, %rbx            # imm = 0x190
movq %rbx, %rdi
callq 0x9504
movq %rax, %rdi
callq 0x4490
leaq 0x10(%rsp), %rdi
callq 0x988c
leaq 0x40(%rsp), %rdi
callq 0x98ec
addq $0x70, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x8a1f(%rip), %rdi      # 0x10919
leaq 0x890a(%rip), %rsi      # 0x1080b
leaq 0x8a21(%rip), %rcx      # 0x10929
pushq $0x67
popq %rdx
callq 0x4260
leaq 0x8a3c(%rip), %rdi      # 0x10953
leaq 0x88ed(%rip), %rsi      # 0x1080b
leaq 0x8a04(%rip), %rcx      # 0x10929
movl $0x94, %edx
callq 0x4260
leaq 0x8a32(%rip), %rdi      # 0x10968
leaq 0x88ce(%rip), %rsi      # 0x1080b
leaq 0x89e5(%rip), %rcx      # 0x10929
movl $0x95, %edx
callq 0x4260
leaq 0x8a29(%rip), %rdi      # 0x1097e
leaq 0x88af(%rip), %rsi      # 0x1080b
leaq 0x89c6(%rip), %rcx      # 0x10929
movl $0x96, %edx
callq 0x4260
leaq 0x8a1e(%rip), %rdi      # 0x10992
leaq 0x8890(%rip), %rsi      # 0x1080b
leaq 0x89a7(%rip), %rcx      # 0x10929
movl $0x97, %edx
callq 0x4260
leaq 0x8a0d(%rip), %rdi      # 0x109a0
leaq 0x8871(%rip), %rsi      # 0x1080b
leaq 0x8988(%rip), %rcx      # 0x10929
movl $0x98, %edx
callq 0x4260
leaq 0x8a05(%rip), %rdi      # 0x109b7
leaq 0x8852(%rip), %rsi      # 0x1080b
leaq 0x8969(%rip), %rcx      # 0x10929
movl $0x99, %edx
callq 0x4260
leaq 0x89fd(%rip), %rdi      # 0x109ce
leaq 0x8833(%rip), %rsi      # 0x1080b
leaq 0x894a(%rip), %rcx      # 0x10929
movl $0x9a, %edx
callq 0x4260
jmp 0x7ff6
movq %rax, %rbx
jmp 0x8003
jmp 0x7ff6
jmp 0x7ff6
jmp 0x7ff6
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x988c
leaq 0x40(%rsp), %rdi
callq 0x98ec
movq %rbx, %rdi
callq 0x4660
nop