// File: /workspace/github_cpp_makefile_star2_O1/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, %r13d
movq %r8, %r15
movl %edx, %ebp
movq %rsi, %r12
movq %rdi, %rbx
cmpb $0x1, 0xec(%rdi)
jne 0x9556
movq 0x168(%rbx), %r14
callq 0x4310
cmpq %rax, %r14
jne 0x969e
movq 0x40(%rbx), %rcx
leaq 0x38(%rbx), %r14
movq %r14, %rax
testq %rcx, %rcx
je 0x9580
movq %r14, %rax
xorl %edx, %edx
cmpq %r12, 0x20(%rcx)
setl %dl
cmovgeq %rcx, %rax
movq 0x10(%rcx,%rdx,8), %rcx
testq %rcx, %rcx
jne 0x9569
movq %r14, %rsi
cmpq %r14, %rax
je 0x9593
cmpq %r12, 0x20(%rax)
cmovgq %r14, %rax
movq %rax, %rsi
cmpq %r14, %rsi
je 0x967f
movq %r15, %r12
leaq 0x30(%rbx), %rdi
movq 0x28(%rsi), %rax
movq %rax, (%rsp)
movq $0x0, 0x28(%rsi)
movq %rdi, 0x8(%rsp)
callq 0xaf62
movb 0xed(%rbx), %r15b
xorb $0x1, %r15b
andb %r13b, %r15b
testb $0x4, %bpl
jne 0x95f0
movq 0xc0(%rbx), %rdi
movq (%rdi), %rax
testb $0x2, %bpl
jne 0x9600
movzbl %r15b, %ecx
movq %r12, %rsi
movq %r12, %rdx
callq *0x30(%rax)
jmp 0x960d
movq 0xc0(%rbx), %rdi
movq (%rdi), %rax
addq $0x38, %rax
jmp 0x9604
addq $0x28, %rax
movzbl %r15b, %edx
movq %r12, %rsi
callq *(%rax)
andb %al, %r15b
cmpb $0x1, %r15b
jne 0x9646
movq %rbx, %rdi
callq 0x92ca
leaq 0x10(%rsp), %rdx
movq %rax, (%rdx)
movq %rsp, %rcx
movq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0xb11a
movq 0x28(%rax), %rdi
movq 0x10(%rsp), %rsi
callq 0xdf14
jmp 0x9661
addq $0x1a0, %rbx            # imm = 0x1A0
movq %rbx, %rdi
callq 0x11d00
testb %al, %al
je 0x9661
movq %rbx, %rdi
callq 0x11d50
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x9670
movq (%rdi), %rax
callq *0x8(%rax)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x95ce(%rip), %rdi      # 0x12c54
leaq 0x917e(%rip), %rsi      # 0x1280b
leaq 0x9559(%rip), %rcx      # 0x12bed
movl $0x105, %edx            # imm = 0x105
callq 0x4260
leaq 0x9274(%rip), %rdi      # 0x12919
leaq 0x915f(%rip), %rsi      # 0x1280b
leaq 0x953a(%rip), %rcx      # 0x12bed
movl $0x103, %edx            # imm = 0x103
callq 0x4260
jmp 0x96c1
jmp 0x96c1
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x96d3
movq (%rdi), %rax
callq *0x8(%rax)
movq %rbx, %rdi
callq 0x4640
nop