// File: cybozu[P]yrmcds/src/config.cpp
// Function: yrmcds::counter_config::load(cybozu::config_parser const&)
void counter_config::load(const cybozu::config_parser& cp) {
    if( cp.exists(COUNTER_ENABLE) )
        m_enable = cp.get_as_bool(COUNTER_ENABLE);

    if( cp.exists(COUNTER_PORT) ) {
        int n = cp.get_as_int(COUNTER_PORT);
        if( n < 1 || n > 65535 )
            throw config::bad_config("Bad port: " + cp.get(COUNTER_PORT));
        m_port = static_cast<std::uint16_t>(n);
    }

    if( cp.exists(COUNTER_MAX_CONNECTIONS) ) {
        int conns = cp.get_as_int(COUNTER_MAX_CONNECTIONS);
        if( conns < 0 )
            throw config::bad_config("counter.max_connections must be >= 0");
        m_max_connections = conns;
    }

    if( cp.exists(COUNTER_BUCKETS) ) {
        int buckets = cp.get_as_int(COUNTER_BUCKETS);
        if( buckets < 1 )
            throw config::bad_config("buckets must be > 0");
        if( buckets < 10000 )
            cybozu::logger::warning() << "Too small bucket count!";
        m_buckets = buckets;
    }

    if( cp.exists(COUNTER_STAT_INTERVAL) ) {
        int n = cp.get_as_int(COUNTER_STAT_INTERVAL);
        if( n < 10 )
            throw config::bad_config("counter.stat_interval must be >= 10");
        m_stat_interval = n;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x3d0, %rsp            # imm = 0x3D0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x298(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x290(%rbp)
leaq -0x31(%rbp), %rdi
movq %rdi, -0x288(%rbp)
callq 0x8bd0
movq -0x288(%rbp), %rdx
leaq 0x63149(%rip), %rsi     # 0x7a620
leaq -0x30(%rbp), %rdi
callq 0xa160
jmp 0x174e2
movq -0x290(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x1b350
movb %al, -0x299(%rbp)
jmp 0x174fa
leaq -0x30(%rbp), %rdi
callq 0x83f0
leaq -0x31(%rbp), %rdi
callq 0x86a0
movb -0x299(%rbp), %al
testb $0x1, %al
jne 0x1751b
jmp 0x175ef
movq -0x10(%rbp), %rax
movq %rax, -0x2b0(%rbp)
leaq -0x69(%rbp), %rdi
movq %rdi, -0x2a8(%rbp)
callq 0x8bd0
movq -0x2a8(%rbp), %rdx
leaq 0x630dc(%rip), %rsi     # 0x7a620
leaq -0x68(%rbp), %rdi
callq 0xa160
jmp 0x1754f
movq -0x2b0(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x1b3a0
movb %al, -0x2b1(%rbp)
jmp 0x17567
movq -0x298(%rbp), %rax
movb -0x2b1(%rbp), %cl
andb $0x1, %cl
movb %cl, (%rax)
leaq -0x68(%rbp), %rdi
callq 0x83f0
leaq -0x69(%rbp), %rdi
callq 0x86a0
jmp 0x175ef
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x175b0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x83f0
leaq -0x31(%rbp), %rdi
callq 0x86a0
jmp 0x17ffb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x175e1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x83f0
leaq -0x69(%rbp), %rdi
callq 0x86a0
jmp 0x17ffb
movq -0x10(%rbp), %rax
movq %rax, -0x2c8(%rbp)
leaq -0x91(%rbp), %rdi
movq %rdi, -0x2c0(%rbp)
callq 0x8bd0
movq -0x2c0(%rbp), %rdx
leaq 0x63014(%rip), %rsi     # 0x7a62f
leaq -0x90(%rbp), %rdi
callq 0xa160
jmp 0x17629
movq -0x2c8(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x1b350
movb %al, -0x2c9(%rbp)
jmp 0x17644
leaq -0x90(%rbp), %rdi
callq 0x83f0
leaq -0x91(%rbp), %rdi
callq 0x86a0
movb -0x2c9(%rbp), %al
testb $0x1, %al
jne 0x1766b
jmp 0x178a9
movq -0x10(%rbp), %rax
movq %rax, -0x2e0(%rbp)
leaq -0xb9(%rbp), %rdi
movq %rdi, -0x2d8(%rbp)
callq 0x8bd0
movq -0x2d8(%rbp), %rdx
leaq 0x62f98(%rip), %rsi     # 0x7a62f
leaq -0xb8(%rbp), %rdi
callq 0xa160
jmp 0x176a5
movq -0x2e0(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x1b460
movl %eax, -0x2e4(%rbp)
jmp 0x176c0
leaq -0xb8(%rbp), %rdi
callq 0x83f0
leaq -0xb9(%rbp), %rdi
callq 0x86a0
movl -0x2e4(%rbp), %eax
movl %eax, -0x98(%rbp)
cmpl $0x1, -0x98(%rbp)
jl 0x176fd
cmpl $0xffff, -0x98(%rbp)    # imm = 0xFFFF
jle 0x17898
movb $0x1, -0x102(%rbp)
movl $0x10, %edi
callq 0x82f0
movq %rax, -0x300(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x2f8(%rbp)
leaq -0x101(%rbp), %rdi
movq %rdi, -0x2f0(%rbp)
callq 0x8bd0
movq -0x2f0(%rbp), %rdx
leaq 0x62eee(%rip), %rsi     # 0x7a62f
leaq -0x100(%rbp), %rdi
callq 0xa160
jmp 0x1774f
movq -0x2f8(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0x1b5d0
movq %rax, -0x308(%rbp)
jmp 0x1776b
movq -0x308(%rbp), %rdx
leaq 0x62c87(%rip), %rsi     # 0x7a400
leaq -0xe0(%rbp), %rdi
callq 0xe550
jmp 0x17787
movq -0x300(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x1b680
jmp 0x1779c
movq -0x300(%rbp), %rdi
movb $0x0, -0x102(%rbp)
leaq 0x96b17(%rip), %rsi     # 0xae2c8
leaq 0x3f08(%rip), %rdx      # 0x1b6c0
callq 0x8b70
jmp 0x18004
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x177e8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x83f0
leaq -0x91(%rbp), %rdi
callq 0x86a0
jmp 0x17ffb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x1781f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x83f0
leaq -0xb9(%rbp), %rdi
callq 0x86a0
jmp 0x17ffb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x17870
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x17864
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x83f0
leaq -0x100(%rbp), %rdi
callq 0x83f0
leaq -0x101(%rbp), %rdi
callq 0x86a0
testb $0x1, -0x102(%rbp)
jne 0x17887
jmp 0x17893
movq -0x300(%rbp), %rdi
callq 0x8490
jmp 0x17ffb
movq -0x298(%rbp), %rax
movl -0x98(%rbp), %ecx
movw %cx, 0x2(%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x318(%rbp)
leaq -0x129(%rbp), %rdi
movq %rdi, -0x310(%rbp)
callq 0x8bd0
movq -0x310(%rbp), %rdx
leaq 0x62d6b(%rip), %rsi     # 0x7a640
leaq -0x128(%rbp), %rdi
callq 0xa160
jmp 0x178e3
movq -0x318(%rbp), %rdi
leaq -0x128(%rbp), %rsi
callq 0x1b350
movb %al, -0x319(%rbp)
jmp 0x178fe
leaq -0x128(%rbp), %rdi
callq 0x83f0
leaq -0x129(%rbp), %rdi
callq 0x86a0
movb -0x319(%rbp), %al
testb $0x1, %al
jne 0x17925
jmp 0x17af9
movq -0x10(%rbp), %rax
movq %rax, -0x330(%rbp)
leaq -0x151(%rbp), %rdi
movq %rdi, -0x328(%rbp)
callq 0x8bd0
movq -0x328(%rbp), %rdx
leaq 0x62cef(%rip), %rsi     # 0x7a640
leaq -0x150(%rbp), %rdi
callq 0xa160
jmp 0x1795f
movq -0x330(%rbp), %rdi
leaq -0x150(%rbp), %rsi
callq 0x1b460
movl %eax, -0x334(%rbp)
jmp 0x1797a
leaq -0x150(%rbp), %rdi
callq 0x83f0
leaq -0x151(%rbp), %rdi
callq 0x86a0
movl -0x334(%rbp), %eax
movl %eax, -0x130(%rbp)
cmpl $0x0, -0x130(%rbp)
jge 0x17ae9
movb $0x1, -0x17a(%rbp)
movl $0x10, %edi
callq 0x82f0
movq %rax, -0x348(%rbp)
leaq -0x179(%rbp), %rdi
movq %rdi, -0x340(%rbp)
callq 0x8bd0
movq -0x340(%rbp), %rdx
leaq 0x62a27(%rip), %rsi     # 0x7a40b
leaq -0x178(%rbp), %rdi
callq 0xa160
jmp 0x179f2
movq -0x348(%rbp), %rdi
leaq -0x178(%rbp), %rsi
callq 0x1b680
jmp 0x17a07
movq -0x348(%rbp), %rdi
movb $0x0, -0x17a(%rbp)
leaq 0x968ac(%rip), %rsi     # 0xae2c8
leaq 0x3c9d(%rip), %rdx      # 0x1b6c0
callq 0x8b70
jmp 0x18004
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x17a53
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x128(%rbp), %rdi
callq 0x83f0
leaq -0x129(%rbp), %rdi
callq 0x86a0
jmp 0x17ffb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x17a8a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x150(%rbp), %rdi
callq 0x83f0
leaq -0x151(%rbp), %rdi
callq 0x86a0
jmp 0x17ffb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x17ac1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x178(%rbp), %rdi
callq 0x83f0
leaq -0x179(%rbp), %rdi
callq 0x86a0
testb $0x1, -0x17a(%rbp)
jne 0x17ad8
jmp 0x17ae4
movq -0x348(%rbp), %rdi
callq 0x8490
jmp 0x17ffb
movq -0x298(%rbp), %rax
movl -0x130(%rbp), %ecx
movl %ecx, 0x4(%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x358(%rbp)
leaq -0x1a1(%rbp), %rdi
movq %rdi, -0x350(%rbp)
callq 0x8bd0
movq -0x350(%rbp), %rdx
leaq 0x62b3b(%rip), %rsi     # 0x7a660
leaq -0x1a0(%rbp), %rdi
callq 0xa160
jmp 0x17b33
movq -0x358(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
callq 0x1b350
movb %al, -0x359(%rbp)
jmp 0x17b4e
leaq -0x1a0(%rbp), %rdi
callq 0x83f0
leaq -0x1a1(%rbp), %rdi
callq 0x86a0
movb -0x359(%rbp), %al
testb $0x1, %al
jne 0x17b75
jmp 0x17da8
movq -0x10(%rbp), %rax
movq %rax, -0x370(%rbp)
leaq -0x1c9(%rbp), %rdi
movq %rdi, -0x368(%rbp)
callq 0x8bd0
movq -0x368(%rbp), %rdx
leaq 0x62abf(%rip), %rsi     # 0x7a660
leaq -0x1c8(%rbp), %rdi
callq 0xa160
jmp 0x17baf
movq -0x370(%rbp), %rdi
leaq -0x1c8(%rbp), %rsi
callq 0x1b460
movl %eax, -0x374(%rbp)
jmp 0x17bca
leaq -0x1c8(%rbp), %rdi
callq 0x83f0
leaq -0x1c9(%rbp), %rdi
callq 0x86a0
movl -0x374(%rbp), %eax
movl %eax, -0x1a8(%rbp)
cmpl $0x1, -0x1a8(%rbp)
jge 0x17d39
movb $0x1, -0x1f2(%rbp)
movl $0x10, %edi
callq 0x82f0
movq %rax, -0x388(%rbp)
leaq -0x1f1(%rbp), %rdi
movq %rdi, -0x380(%rbp)
callq 0x8bd0
movq -0x380(%rbp), %rdx
leaq 0x627fc(%rip), %rsi     # 0x7a430
leaq -0x1f0(%rbp), %rdi
callq 0xa160
jmp 0x17c42
movq -0x388(%rbp), %rdi
leaq -0x1f0(%rbp), %rsi
callq 0x1b680
jmp 0x17c57
movq -0x388(%rbp), %rdi
movb $0x0, -0x1f2(%rbp)
leaq 0x9665c(%rip), %rsi     # 0xae2c8
leaq 0x3a4d(%rip), %rdx      # 0x1b6c0
callq 0x8b70
jmp 0x18004
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x17ca3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x1a0(%rbp), %rdi
callq 0x83f0
leaq -0x1a1(%rbp), %rdi
callq 0x86a0
jmp 0x17ffb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x17cda
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x1c8(%rbp), %rdi
callq 0x83f0
leaq -0x1c9(%rbp), %rdi
callq 0x86a0
jmp 0x17ffb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x17d11
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x1f0(%rbp), %rdi
callq 0x83f0
leaq -0x1f1(%rbp), %rdi
callq 0x86a0
testb $0x1, -0x1f2(%rbp)
jne 0x17d28
jmp 0x17d34
movq -0x388(%rbp), %rdi
callq 0x8490
jmp 0x17ffb
cmpl $0x2710, -0x1a8(%rbp)   # imm = 0x2710
jge 0x17d98
leaq -0x208(%rbp), %rdi
movq %rdi, -0x390(%rbp)
callq 0x1b6e0
movq -0x390(%rbp), %rdi
leaq 0x626de(%rip), %rsi     # 0x7a444
callq 0x1b730
jmp 0x17d6d
leaq -0x208(%rbp), %rdi
callq 0xa770
jmp 0x17d98
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x208(%rbp), %rdi
callq 0xa770
jmp 0x17ffb
movq -0x298(%rbp), %rax
movl -0x1a8(%rbp), %ecx
movl %ecx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x3a0(%rbp)
leaq -0x229(%rbp), %rdi
movq %rdi, -0x398(%rbp)
callq 0x8bd0
movq -0x398(%rbp), %rdx
leaq 0x6289c(%rip), %rsi     # 0x7a670
leaq -0x228(%rbp), %rdi
callq 0xa160
jmp 0x17de2
movq -0x3a0(%rbp), %rdi
leaq -0x228(%rbp), %rsi
callq 0x1b350
movb %al, -0x3a1(%rbp)
jmp 0x17dfd
leaq -0x228(%rbp), %rdi
callq 0x83f0
leaq -0x229(%rbp), %rdi
callq 0x86a0
movb -0x3a1(%rbp), %al
testb $0x1, %al
jne 0x17e24
jmp 0x17ff2
movq -0x10(%rbp), %rax
movq %rax, -0x3b8(%rbp)
leaq -0x251(%rbp), %rdi
movq %rdi, -0x3b0(%rbp)
callq 0x8bd0
movq -0x3b0(%rbp), %rdx
leaq 0x62820(%rip), %rsi     # 0x7a670
leaq -0x250(%rbp), %rdi
callq 0xa160
jmp 0x17e5e
movq -0x3b8(%rbp), %rdi
leaq -0x250(%rbp), %rsi
callq 0x1b460
movl %eax, -0x3bc(%rbp)
jmp 0x17e79
leaq -0x250(%rbp), %rdi
callq 0x83f0
leaq -0x251(%rbp), %rdi
callq 0x86a0
movl -0x3bc(%rbp), %eax
movl %eax, -0x230(%rbp)
cmpl $0xa, -0x230(%rbp)
jge 0x17fe2
movb $0x1, -0x27a(%rbp)
movl $0x10, %edi
callq 0x82f0
movq %rax, -0x3d0(%rbp)
leaq -0x279(%rbp), %rdi
movq %rdi, -0x3c8(%rbp)
callq 0x8bd0
movq -0x3c8(%rbp), %rdx
leaq 0x62579(%rip), %rsi     # 0x7a45c
leaq -0x278(%rbp), %rdi
callq 0xa160
jmp 0x17ef1
movq -0x3d0(%rbp), %rdi
leaq -0x278(%rbp), %rsi
callq 0x1b680
jmp 0x17f06
movq -0x3d0(%rbp), %rdi
movb $0x0, -0x27a(%rbp)
leaq 0x963ad(%rip), %rsi     # 0xae2c8
leaq 0x379e(%rip), %rdx      # 0x1b6c0
callq 0x8b70
jmp 0x18004
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x17f52
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x228(%rbp), %rdi
callq 0x83f0
leaq -0x229(%rbp), %rdi
callq 0x86a0
jmp 0x17ffb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x17f89
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x250(%rbp), %rdi
callq 0x83f0
leaq -0x251(%rbp), %rdi
callq 0x86a0
jmp 0x17ffb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x17fbd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x278(%rbp), %rdi
callq 0x83f0
leaq -0x279(%rbp), %rdi
callq 0x86a0
testb $0x1, -0x27a(%rbp)
jne 0x17fd4
jmp 0x17fe0
movq -0x3d0(%rbp), %rdi
callq 0x8490
jmp 0x17ffb
movq -0x298(%rbp), %rax
movl -0x230(%rbp), %ecx
movl %ecx, 0xc(%rax)
addq $0x3d0, %rsp            # imm = 0x3D0
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0x8bc0
nopw %cs:(%rax,%rax)