// File: cybozu[P]yrmcds/src/memcache/handler.cpp
// Function: yrmcds::memcache::handler::on_master_start()
void handler::on_master_start() {
    m_is_slave = false;
    cybozu::tcp_server_socket::wrapper w =
        [this](int s, const cybozu::ip_address&) {
        return make_repl_socket(s);
    };
    if( g_config.bind_ip().empty() ) {
        m_reactor.add_resource(
            make_server_socket(nullptr, g_config.repl_port(), w),
            cybozu::reactor::EVENT_IN);
    } else {
        m_reactor.add_resource(
            make_server_socket(g_config.vip(), g_config.repl_port(), w, true),
            cybozu::reactor::EVENT_IN);
        for( auto& s: g_config.bind_ip() ) {
            m_reactor.add_resource(
                make_server_socket(s, g_config.repl_port(), w),
                cybozu::reactor::EVENT_IN);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x160, %rsp            # imm = 0x160
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xf8(%rbp)
movb $0x0, 0x38(%rax)
movq %rax, -0x30(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x37880
leaq 0x7882a(%rip), %rdi     # 0xafd00
callq 0x2c650
movq %rax, %rdi
callq 0x2c670
testb $0x1, %al
jne 0x374ec
jmp 0x375d8
movq -0xf8(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x108(%rbp)
leaq 0x787fb(%rip), %rdi     # 0xafd00
callq 0x39d00
movw %ax, -0xfa(%rbp)
leaq -0x60(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x2c7b0
jmp 0x37520
movw -0xfa(%rbp), %ax
movzwl %ax, %edx
xorl %r8d, %r8d
movl %r8d, %esi
leaq -0x40(%rbp), %rdi
leaq -0x60(%rbp), %rcx
callq 0x2c6b0
jmp 0x3753f
leaq -0x38(%rbp), %rdi
movq %rdi, -0x110(%rbp)
leaq -0x40(%rbp), %rsi
callq 0x2c860
movq -0x108(%rbp), %rdi
movq -0x110(%rbp), %rsi
movl $0x1, %edx
callq 0xea00
jmp 0x3756d
leaq -0x38(%rbp), %rdi
callq 0x11290
leaq -0x40(%rbp), %rdi
callq 0x2c8b0
leaq -0x60(%rbp), %rdi
callq 0x2c910
jmp 0x3785c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x3786e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x375ca
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x11290
leaq -0x40(%rbp), %rdi
callq 0x2c8b0
leaq -0x60(%rbp), %rdi
callq 0x2c910
jmp 0x3786e
movq -0xf8(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x130(%rbp)
leaq 0x7870f(%rip), %rdi     # 0xafd00
movq %rdi, -0x128(%rbp)
callq 0x22f30
movq -0x128(%rbp), %rdi
movq %rax, -0x120(%rbp)
callq 0x39d00
movw %ax, -0x112(%rbp)
leaq -0xa0(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x2c7b0
jmp 0x37629
movq -0x120(%rbp), %rsi
movw -0x112(%rbp), %ax
movzwl %ax, %edx
leaq -0x80(%rbp), %rdi
leaq -0xa0(%rbp), %rcx
movl $0x1, %r8d
callq 0x2c930
jmp 0x37652
leaq -0x78(%rbp), %rdi
movq %rdi, -0x138(%rbp)
leaq -0x80(%rbp), %rsi
callq 0x2c860
movq -0x130(%rbp), %rdi
movq -0x138(%rbp), %rsi
movl $0x1, %edx
callq 0xea00
jmp 0x37680
leaq -0x78(%rbp), %rdi
callq 0x11290
leaq -0x80(%rbp), %rdi
callq 0x2c8b0
leaq -0xa0(%rbp), %rdi
callq 0x2c910
leaq 0x7865b(%rip), %rdi     # 0xafd00
callq 0x2c650
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rdi
callq 0x2ca30
movq %rax, -0xb0(%rbp)
movq -0xa8(%rbp), %rdi
callq 0x2ca60
movq %rax, -0xb8(%rbp)
leaq -0xb0(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x2ca90
testb $0x1, %al
jne 0x376f3
jmp 0x3785a
leaq -0xb0(%rbp), %rdi
callq 0x2cad0
movq %rax, %rcx
movq -0xf8(%rbp), %rax
movq %rcx, -0xc0(%rbp)
movq 0x28(%rax), %rax
movq %rax, -0x150(%rbp)
movq -0xc0(%rbp), %rax
movq %rax, -0x148(%rbp)
leaq 0x785d0(%rip), %rdi     # 0xafd00
callq 0x39d00
movw %ax, -0x13a(%rbp)
leaq -0xf0(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x2c7b0
jmp 0x3774e
movq -0x148(%rbp), %rsi
movw -0x13a(%rbp), %ax
movzwl %ax, %edx
leaq -0xd0(%rbp), %rdi
leaq -0xf0(%rbp), %rcx
xorl %r8d, %r8d
callq 0x2c930
jmp 0x37777
leaq -0xc8(%rbp), %rdi
movq %rdi, -0x158(%rbp)
leaq -0xd0(%rbp), %rsi
callq 0x2c860
movq -0x150(%rbp), %rdi
movq -0x158(%rbp), %rsi
movl $0x1, %edx
callq 0xea00
jmp 0x377ab
leaq -0xc8(%rbp), %rdi
callq 0x11290
leaq -0xd0(%rbp), %rdi
callq 0x2c8b0
leaq -0xf0(%rbp), %rdi
callq 0x2c910
leaq -0xb0(%rbp), %rdi
callq 0x2caf0
jmp 0x376d7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x3780c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x11290
leaq -0x80(%rbp), %rdi
callq 0x2c8b0
leaq -0xa0(%rbp), %rdi
callq 0x2c910
jmp 0x3786e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x3784c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x11290
leaq -0xd0(%rbp), %rdi
callq 0x2c8b0
leaq -0xf0(%rbp), %rdi
callq 0x2c910
jmp 0x3786e
jmp 0x3785c
leaq -0x28(%rbp), %rdi
callq 0x2c910
addq $0x160, %rsp            # imm = 0x160
popq %rbp
retq
leaq -0x28(%rbp), %rdi
callq 0x2c910
movq -0x68(%rbp), %rdi
callq 0x8bc0