// File: cybozu[P]yrmcds/src/counter/sockets.cpp
// Function: yrmcds::counter::counter_socket::execute(yrmcds::counter::request const&)
void counter_socket::execute(const counter::request& cmd) {
    counter::response r(*this, cmd);

    if( cmd.status() != counter::status::OK ) {
        r.error( cmd.status() );
        return;
    }

    g_stats.ops[(std::size_t)cmd.command()].fetch_add(1);

    switch( cmd.command() ) {
    case counter::command::Noop:
        r.success();
        break;
    case counter::command::Get:
        cmd_get(cmd, r);
        break;
    case counter::command::Acquire:
        cmd_acquire(cmd, r);
        break;
    case counter::command::Release:
        cmd_release(cmd, r);
        break;
    case counter::command::Stats:
        r.stats();
        break;
    case counter::command::Dump:
        cmd_dump(r);
        break;
    default:
        cybozu::logger::info() << "not implemented";
        r.error( counter::status::UnknownCommand );
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x30(%rbp)
movq %rsi, -0x38(%rbp)
movq -0x30(%rbp), %rsi
movq %rsi, -0x70(%rbp)
movq -0x38(%rbp), %rdx
leaq -0x48(%rbp), %rdi
callq 0x329c0
movq -0x38(%rbp), %rdi
callq 0x329f0
cmpb $0x0, %al
je 0x2f76f
movq -0x38(%rbp), %rdi
callq 0x329f0
leaq -0x48(%rbp), %rdi
movzbl %al, %esi
callq 0x5c050
jmp 0x2f8fb
movq -0x38(%rbp), %rdi
callq 0x32a10
movzbl %al, %eax
movl %eax, %ecx
leaq 0x806bc(%rip), %rax     # 0xafe40
leaq 0xc0(%rax,%rcx,8), %rax
movq %rax, -0x8(%rbp)
movq $0x1, -0x10(%rbp)
movl $0x5, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x80(%rbp)
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
movq %rcx, -0x20(%rbp)
decl %eax
movl %eax, %ecx
movq %rcx, -0x78(%rbp)
subl $0x4, %eax
ja 0x2f7d3
movq -0x78(%rbp), %rax
leaq 0x4b7a2(%rip), %rcx     # 0x7af6c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x80(%rbp), %rcx
movq -0x20(%rbp), %rax
lock
xaddq %rax, (%rcx)
movq %rax, -0x28(%rbp)
jmp 0x2f830
movq -0x80(%rbp), %rcx
movq -0x20(%rbp), %rax
lock
xaddq %rax, (%rcx)
movq %rax, -0x28(%rbp)
jmp 0x2f830
movq -0x80(%rbp), %rcx
movq -0x20(%rbp), %rax
lock
xaddq %rax, (%rcx)
movq %rax, -0x28(%rbp)
jmp 0x2f830
movq -0x80(%rbp), %rcx
movq -0x20(%rbp), %rax
lock
xaddq %rax, (%rcx)
movq %rax, -0x28(%rbp)
jmp 0x2f830
movq -0x80(%rbp), %rcx
movq -0x20(%rbp), %rax
lock
xaddq %rax, (%rcx)
movq %rax, -0x28(%rbp)
movq -0x38(%rbp), %rdi
callq 0x32a10
movzbl %al, %ecx
movq %rcx, -0x88(%rbp)
subb $0x11, %al
ja 0x2f8bf
movq -0x88(%rbp), %rax
leaq 0x4b72b(%rip), %rcx     # 0x7af80
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq -0x48(%rbp), %rdi
callq 0x5c000
jmp 0x2f8fb
movq -0x70(%rbp), %rdi
movq -0x38(%rbp), %rsi
leaq -0x48(%rbp), %rdx
callq 0x2f930
jmp 0x2f8fb
movq -0x70(%rbp), %rdi
movq -0x38(%rbp), %rsi
leaq -0x48(%rbp), %rdx
callq 0x2fab0
jmp 0x2f8fb
movq -0x70(%rbp), %rdi
movq -0x38(%rbp), %rsi
leaq -0x48(%rbp), %rdx
callq 0x2fc60
jmp 0x2f8fb
leaq -0x48(%rbp), %rdi
callq 0x5c420
jmp 0x2f8fb
movq -0x70(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x2fe00
jmp 0x2f8fb
leaq -0x58(%rbp), %rdi
movq %rdi, -0x90(%rbp)
callq 0x22390
movq -0x90(%rbp), %rdi
leaq 0x4ba4b(%rip), %rsi     # 0x7b328
callq 0x32a30
jmp 0x2f8e4
leaq -0x58(%rbp), %rdi
callq 0xa770
leaq -0x48(%rbp), %rdi
movl $0x81, %esi
callq 0x5c050
addq $0x90, %rsp
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x58(%rbp), %rdi
callq 0xa770
movq -0x60(%rbp), %rdi
callq 0x8bc0
nopw %cs:(%rax,%rax)