// File: /workspace/github_cpp_makefile_star2_O3/theuni[P]libbtcnet/src/handler.cpp
// Function: CConnectionHandlerInt::OnConnectionFailure(long, ConnectionFailureType, int, CConnection, bool)
void CConnectionHandlerInt::OnConnectionFailure(ConnID id, ConnectionFailureType type, int /*error*/, CConnection failed, bool retry)
{
    assert(IsEventThread());
    auto it = m_connecting.find(id);
    assert(it != m_connecting.end());
    auto ptr = std::move(it->second);
    m_connecting.erase(it);
    retry = retry && !m_shutdown;
    bool ret = false;

    if ((type & ConnectionFailureType::PROXY) != 0)
        ret = m_interface.OnProxyFailure(failed, retry);
    else if ((type & ConnectionFailureType::RESOLVE) != 0)
        ret = m_interface.OnDnsFailure(std::move(failed), retry);
    else
        ret = m_interface.OnConnectionFailure(failed, failed, retry);
    if (retry && ret) {
        ConnID newId = GetNextConnectionIndex();
        auto newit = m_connecting.emplace_hint(m_connecting.end(), newId, std::move(ptr));
        newit->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 %r9d, %ebp
movq %r8, 0x8(%rsp)
movl %edx, %r13d
movq %rsi, %r14
movq %rdi, %rbx
cmpb $0x1, 0xec(%rdi)
jne 0x94e9
movq 0x168(%rbx), %r15
callq 0x4310
cmpq %rax, %r15
jne 0x9626
movq 0x40(%rbx), %rax
testq %rax, %rax
je 0x9607
leaq 0x30(%rbx), %r15
leaq 0x38(%rbx), %r12
movq %r12, %rsi
xorl %ecx, %ecx
cmpq %r14, 0x20(%rax)
setl %cl
cmovgeq %rax, %rsi
movq 0x10(%rax,%rcx,8), %rax
testq %rax, %rax
jne 0x9501
cmpq %r12, %rsi
je 0x9607
cmpq %r14, 0x20(%rsi)
jg 0x9607
movq 0x28(%rsi), %r14
movq %r14, (%rsp)
movq $0x0, 0x28(%rsi)
movq %r15, %rdi
callq 0xadd0
movb 0xed(%rbx), %al
xorb $0x1, %al
andb %al, %bpl
testb $0x4, %r13b
jne 0x9575
movq 0xc0(%rbx), %rdi
movq (%rdi), %rax
testb $0x2, %r13b
jne 0x9585
movzbl %bpl, %ecx
movq 0x8(%rsp), %rdx
movq %rdx, %rsi
callq *0x30(%rax)
jmp 0x9594
movq 0xc0(%rbx), %rdi
movq (%rdi), %rax
addq $0x38, %rax
jmp 0x9589
addq $0x28, %rax
movzbl %bpl, %edx
movq 0x8(%rsp), %rsi
callq *(%rax)
andb %al, %bpl
cmpb $0x1, %bpl
jne 0x95cf
movq %rbx, %rdi
callq 0x925e
leaq 0x10(%rsp), %rdx
movq %rax, (%rdx)
movq %rsp, %rcx
movq %r15, %rdi
movq %r12, %rsi
callq 0xaf8e
movq 0x28(%rax), %rdi
movq 0x10(%rsp), %rsi
callq 0xdd70
movq (%rsp), %r14
jmp 0x95ea
addq $0x1a0, %rbx            # imm = 0x1A0
movq %rbx, %rdi
callq 0x11b3e
testb %al, %al
je 0x95ea
movq %rbx, %rdi
callq 0x11b8e
testq %r14, %r14
je 0x95f8
movq (%r14), %rax
movq %r14, %rdi
callq *0x8(%rax)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x9642(%rip), %rdi      # 0x12c50
leaq 0x91f2(%rip), %rsi      # 0x12807
leaq 0x95cd(%rip), %rcx      # 0x12be9
movl $0x105, %edx            # imm = 0x105
callq 0x4260
leaq 0x92e8(%rip), %rdi      # 0x12915
leaq 0x91d3(%rip), %rsi      # 0x12807
leaq 0x95ae(%rip), %rcx      # 0x12be9
movl $0x103, %edx            # imm = 0x103
callq 0x4260
jmp 0x9647
movq %rax, %rbx
movq (%rsp), %r14
jmp 0x9653
movq %rax, %rbx
testq %r14, %r14
je 0x9661
movq (%r14), %rax
movq %r14, %rdi
callq *0x8(%rax)
movq %rbx, %rdi
callq 0x4640
nop