// File: cybozu[P]yrmcds/src/memcache/handler.cpp
// Function: yrmcds::memcache::handler::on_master_interval()
void handler::on_master_interval() {
    for( auto it = m_slaves.begin(); it != m_slaves.end(); ) {
        repl_socket* slave = *it;
        if( ! slave->valid() ) {
            it = m_slaves.erase(it);
            continue;
        }
        if( slave->timed_out() ) {
            cybozu::logger::info()
                << "No heartbeats from a slave ("
                << slave->peer_ip()
                << "). Close the replication socket.";
            // close the socket and release resources
            if( ! slave->invalidate() )
                m_reactor.remove_resource(*slave);
            it = m_slaves.erase(it);
            continue;
        }
        ++it;
    }

    if( gc_ready(g_current_time.load(relaxed)) ) {
        m_gc_thread = std::unique_ptr<gc_thread>(
            new gc_thread(m_hash, m_slaves, m_new_slaves));
        m_new_slaves.clear();
        m_gc_thread->start();
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0x20(%rbp)
movq -0x20(%rbp), %rdi
movq %rdi, -0xa8(%rbp)
addq $0x78, %rdi
callq 0x39d20
movq %rax, -0x28(%rbp)
movq -0xa8(%rbp), %rdi
addq $0x78, %rdi
callq 0x39d90
movq %rax, -0x30(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x39d50
testb $0x1, %al
jne 0x37961
jmp 0x37b05
leaq -0x28(%rbp), %rdi
callq 0x39dc0
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
callq 0x2b080
testb $0x1, %al
jne 0x379be
movq -0xa8(%rbp), %rax
addq $0x78, %rax
movq %rax, -0xb0(%rbp)
leaq -0x48(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x39e50
movq -0xb0(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x39de0
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x37937
movq -0x38(%rbp), %rdi
callq 0x39e90
testb $0x1, %al
jne 0x379d0
jmp 0x37af7
leaq -0x58(%rbp), %rdi
movq %rdi, -0xc0(%rbp)
callq 0x22390
movq -0xc0(%rbp), %rdi
leaq 0x43b8b(%rip), %rsi     # 0x7b579
callq 0x34030
movq %rax, -0xb8(%rbp)
jmp 0x379fc
movq -0x38(%rbp), %rsi
leaq -0x88(%rbp), %rdi
callq 0x39f50
jmp 0x37a0e
movq -0xb8(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0xa690
movq %rax, -0xc8(%rbp)
jmp 0x37a2a
movq -0xc8(%rbp), %rdi
leaq 0x43b5e(%rip), %rsi     # 0x7b596
callq 0x3a030
jmp 0x37a3f
leaq -0x88(%rbp), %rdi
callq 0x83f0
leaq -0x58(%rbp), %rdi
callq 0xa770
movq -0x38(%rbp), %rdi
callq 0x23290
testb $0x1, %al
jne 0x37aab
movq -0xa8(%rbp), %rax
movq 0x28(%rax), %rdi
movq -0x38(%rbp), %rsi
callq 0x3a070
jmp 0x37aab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x37a9d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x83f0
leaq -0x58(%rbp), %rdi
callq 0xa770
jmp 0x37c5d
movq -0xa8(%rbp), %rax
addq $0x78, %rax
movq %rax, -0xd0(%rbp)
leaq -0x98(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x39e50
movq -0xd0(%rbp), %rdi
movq -0x98(%rbp), %rsi
callq 0x39de0
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x37937
leaq -0x28(%rbp), %rdi
callq 0x3a0a0
jmp 0x37937
leaq 0x784b4(%rip), %rax     # 0xaffc0
movq %rax, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xe0(%rbp)
movl -0xc(%rbp), %edi
movl $0xffff, %esi           # imm = 0xFFFF
callq 0x104e0
movl %eax, -0x10(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0xd4(%rbp)
decl %eax
subl $0x2, %eax
jb 0x37b61
jmp 0x37b44
movl -0xd4(%rbp), %eax
subl $0x5, %eax
je 0x37b71
jmp 0x37b51
movq -0xe0(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0x37b7f
movq -0xe0(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0x37b7f
movq -0xe0(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0xa8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x36dc0
testb $0x1, %al
jne 0x37b98
jmp 0x37c54
movl $0xb0, %edi
callq 0x8640
movq -0xa8(%rbp), %rcx
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xe8(%rbp)
movq %rcx, %rsi
addq $0x40, %rsi
movq %rcx, %rdx
addq $0x78, %rdx
addq $0x90, %rcx
callq 0x3a0c0
jmp 0x37bd2
movq -0xe8(%rbp), %rsi
leaq -0xa0(%rbp), %rdi
callq 0x3a300
movq -0xa8(%rbp), %rdi
addq $0x68, %rdi
leaq -0xa0(%rbp), %rsi
callq 0x3a330
leaq -0xa0(%rbp), %rdi
callq 0x39b40
movq -0xa8(%rbp), %rdi
addq $0x90, %rdi
callq 0x3a360
movq -0xa8(%rbp), %rdi
addq $0x68, %rdi
callq 0x39be0
movq %rax, %rdi
callq 0x3a380
jmp 0x37c54
movq -0xe8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
movl $0xb0, %esi
callq 0x8650
jmp 0x37c5d
addq $0xf0, %rsp
popq %rbp
retq
movq -0x60(%rbp), %rdi
callq 0x8bc0
nopw %cs:(%rax,%rax)