// File: cybozu[P]yrmcds/src/counter/handler.cpp
// Function: yrmcds::counter::handler::on_master_start()
void handler::on_master_start() {
    using cybozu::make_server_socket;
    cybozu::tcp_server_socket::wrapper w =
        [this](int s, const cybozu::ip_address&) {
            return make_counter_socket(s);
        };
    auto port = g_config.counter().port();

    if( g_config.bind_ip().empty() ) {
        m_reactor.add_resource(
            make_server_socket(nullptr, port, w),
            cybozu::reactor::EVENT_IN);
    } else {
        m_reactor.add_resource(
            make_server_socket(g_config.vip(), port, w, true),
            cybozu::reactor::EVENT_IN);
        for( auto& s: g_config.bind_ip() ) {
            m_reactor.add_resource(
                make_server_socket(s, 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, -0x100(%rbp)
movq %rax, -0x30(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x2b920
leaq 0x8479e(%rip), %rdi     # 0xafd00
callq 0x220f0
movq %rax, %rdi
callq 0x2c630
movw %ax, -0x32(%rbp)
leaq 0x84786(%rip), %rdi     # 0xafd00
callq 0x2c650
movq %rax, %rdi
callq 0x2c670
testb $0x1, %al
jne 0x2b590
jmp 0x2b674
movq -0x100(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x110(%rbp)
movw -0x32(%rbp), %ax
movw %ax, -0x102(%rbp)
leaq -0x68(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x2c7b0
jmp 0x2b5bc
movw -0x102(%rbp), %ax
movzwl %ax, %edx
xorl %r8d, %r8d
movl %r8d, %esi
leaq -0x48(%rbp), %rdi
leaq -0x68(%rbp), %rcx
callq 0x2c6b0
jmp 0x2b5db
leaq -0x40(%rbp), %rdi
movq %rdi, -0x118(%rbp)
leaq -0x48(%rbp), %rsi
callq 0x2c860
movq -0x110(%rbp), %rdi
movq -0x118(%rbp), %rsi
movl $0x1, %edx
callq 0xea00
jmp 0x2b609
leaq -0x40(%rbp), %rdi
callq 0x11290
leaq -0x48(%rbp), %rdi
callq 0x2c8b0
leaq -0x68(%rbp), %rdi
callq 0x2c910
jmp 0x2b8ed
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x2b8ff
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x2b666
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x11290
leaq -0x48(%rbp), %rdi
callq 0x2c8b0
leaq -0x68(%rbp), %rdi
callq 0x2c910
jmp 0x2b8ff
movq -0x100(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x130(%rbp)
leaq 0x84673(%rip), %rdi     # 0xafd00
callq 0x22f30
movq %rax, -0x128(%rbp)
movw -0x32(%rbp), %ax
movw %ax, -0x11a(%rbp)
leaq -0xa8(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x2c7b0
jmp 0x2b6b6
movq -0x128(%rbp), %rsi
movw -0x11a(%rbp), %ax
movzwl %ax, %edx
leaq -0x88(%rbp), %rdi
leaq -0xa8(%rbp), %rcx
movl $0x1, %r8d
callq 0x2c930
jmp 0x2b6e2
leaq -0x80(%rbp), %rdi
movq %rdi, -0x138(%rbp)
leaq -0x88(%rbp), %rsi
callq 0x2c860
movq -0x130(%rbp), %rdi
movq -0x138(%rbp), %rsi
movl $0x1, %edx
callq 0xea00
jmp 0x2b713
leaq -0x80(%rbp), %rdi
callq 0x11290
leaq -0x88(%rbp), %rdi
callq 0x2c8b0
leaq -0xa8(%rbp), %rdi
callq 0x2c910
leaq 0x845c5(%rip), %rdi     # 0xafd00
callq 0x2c650
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rdi
callq 0x2ca30
movq %rax, -0xb8(%rbp)
movq -0xb0(%rbp), %rdi
callq 0x2ca60
movq %rax, -0xc0(%rbp)
leaq -0xb8(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x2ca90
testb $0x1, %al
jne 0x2b789
jmp 0x2b8eb
leaq -0xb8(%rbp), %rdi
callq 0x2cad0
movq %rax, %rcx
movq -0x100(%rbp), %rax
movq %rcx, -0xc8(%rbp)
movq 0x28(%rax), %rax
movq %rax, -0x150(%rbp)
movq -0xc8(%rbp), %rax
movq %rax, -0x148(%rbp)
movw -0x32(%rbp), %ax
movw %ax, -0x13a(%rbp)
leaq -0xf8(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x2c7b0
jmp 0x2b7dc
movq -0x148(%rbp), %rsi
movw -0x13a(%rbp), %ax
movzwl %ax, %edx
leaq -0xd8(%rbp), %rdi
leaq -0xf8(%rbp), %rcx
xorl %r8d, %r8d
callq 0x2c930
jmp 0x2b805
leaq -0xd0(%rbp), %rdi
movq %rdi, -0x158(%rbp)
leaq -0xd8(%rbp), %rsi
callq 0x2c860
movq -0x150(%rbp), %rdi
movq -0x158(%rbp), %rsi
movl $0x1, %edx
callq 0xea00
jmp 0x2b839
leaq -0xd0(%rbp), %rdi
callq 0x11290
leaq -0xd8(%rbp), %rdi
callq 0x2c8b0
leaq -0xf8(%rbp), %rdi
callq 0x2c910
leaq -0xb8(%rbp), %rdi
callq 0x2caf0
jmp 0x2b76d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x2b89d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x11290
leaq -0x88(%rbp), %rdi
callq 0x2c8b0
leaq -0xa8(%rbp), %rdi
callq 0x2c910
jmp 0x2b8ff
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x2b8dd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x11290
leaq -0xd8(%rbp), %rdi
callq 0x2c8b0
leaq -0xf8(%rbp), %rdi
callq 0x2c910
jmp 0x2b8ff
jmp 0x2b8ed
leaq -0x28(%rbp), %rdi
callq 0x2c910
addq $0x160, %rsp            # imm = 0x160
popq %rbp
retq
leaq -0x28(%rbp), %rdi
callq 0x2c910
movq -0x70(%rbp), %rdi
callq 0x8bc0
nopw %cs:(%rax,%rax)