// File: cybozu[P]yrmcds/src/counter/counter.cpp
// Function: yrmcds::counter::response::error(yrmcds::counter::status)
void response::error(counter::status status) {
    switch( status ) {
    case counter::status::NotFound:
        send_error(status, STATUS_NOT_FOUND,
                   sizeof(STATUS_NOT_FOUND) - 1);
        break;
    case counter::status::Invalid:
        send_error(status, STATUS_INVALID,
                   sizeof(STATUS_INVALID) - 1);
        break;
    case counter::status::ResourceNotAvailable:
        send_error(status, STATUS_RESOURCE_NOT_AVAILABLE,
                   sizeof(STATUS_RESOURCE_NOT_AVAILABLE) - 1);
        break;
    case counter::status::NotAcquired:
        send_error(status, STATUS_NOT_ACQUIRED,
                   sizeof(STATUS_NOT_ACQUIRED) - 1);
        break;
    case counter::status::UnknownCommand:
        send_error(status, STATUS_UNKNOWN_COMMAND,
                   sizeof(STATUS_UNKNOWN_COMMAND) - 1);
        break;
    case counter::status::OutOfMemory:
        send_error(status, STATUS_OUT_OF_MEMORY,
                   sizeof(STATUS_OUT_OF_MEMORY) - 1);
        break;
    default:
        cybozu::dump_stack();
        throw std::logic_error("<counter::response::error> invalid status: " +
                               std::to_string((std::uint8_t)status));
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movb %sil, %al
movq %rdi, -0x8(%rbp)
movb %al, -0x9(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x68(%rbp)
movb -0x9(%rbp), %al
movb %al, -0x5e(%rbp)
subb $-0x7f, %al
je 0x5c126
jmp 0x5c07a
movb -0x5e(%rbp), %al
subb $-0x7e, %al
je 0x5c144
jmp 0x5c087
movb -0x5e(%rbp), %al
subb $0x1, %al
je 0x5c0ae
jmp 0x5c090
movb -0x5e(%rbp), %al
subb $0x4, %al
je 0x5c0cc
jmp 0x5c099
movb -0x5e(%rbp), %al
subb $0x21, %al
je 0x5c0ea
jmp 0x5c0a2
movb -0x5e(%rbp), %al
subb $0x22, %al
je 0x5c108
jmp 0x5c162
movq -0x68(%rbp), %rdi
leaq 0x20bef(%rip), %rdx     # 0x7cca8
movl $0x9, %ecx
movzbl -0x9(%rbp), %esi
callq 0x5c230
jmp 0x5c217
movq -0x68(%rbp), %rdi
leaq 0x20be9(%rip), %rdx     # 0x7ccc0
movl $0x11, %ecx
movzbl -0x9(%rbp), %esi
callq 0x5c230
jmp 0x5c217
movq -0x68(%rbp), %rdi
leaq 0x20beb(%rip), %rdx     # 0x7cce0
movl $0x16, %ecx
movzbl -0x9(%rbp), %esi
callq 0x5c230
jmp 0x5c217
movq -0x68(%rbp), %rdi
leaq 0x20be4(%rip), %rdx     # 0x7ccf7
movl $0xc, %ecx
movzbl -0x9(%rbp), %esi
callq 0x5c230
jmp 0x5c217
movq -0x68(%rbp), %rdi
leaq 0x20bdf(%rip), %rdx     # 0x7cd10
movl $0xf, %ecx
movzbl -0x9(%rbp), %esi
callq 0x5c230
jmp 0x5c217
movq -0x68(%rbp), %rdi
leaq 0x20bd1(%rip), %rdx     # 0x7cd20
movl $0xb, %ecx
movzbl -0x9(%rbp), %esi
callq 0x5c230
jmp 0x5c217
callq 0x16af0
movb $0x1, -0x5d(%rbp)
movl $0x10, %edi
callq 0x82f0
movq %rax, -0x70(%rbp)
movzbl -0x9(%rbp), %esi
leaq -0x50(%rbp), %rdi
callq 0x1baf0
jmp 0x5c188
leaq 0x20b9d(%rip), %rsi     # 0x7cd2c
leaq -0x30(%rbp), %rdi
leaq -0x50(%rbp), %rdx
callq 0xb510
jmp 0x5c19e
movq -0x70(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x8a00
jmp 0x5c1ad
movq -0x70(%rbp), %rdi
movb $0x0, -0x5d(%rbp)
movq 0x52e04(%rip), %rsi     # 0xaefc0
movq 0x52dbd(%rip), %rdx     # 0xaef80
callq 0x8b70
jmp 0x5c226
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x5c204
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x5c1fb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x83f0
leaq -0x50(%rbp), %rdi
callq 0x83f0
testb $0x1, -0x5d(%rbp)
jne 0x5c20c
jmp 0x5c215
movq -0x70(%rbp), %rdi
callq 0x8490
jmp 0x5c21d
addq $0x70, %rsp
popq %rbp
retq
movq -0x58(%rbp), %rdi
callq 0x8bc0
nopw %cs:(%rax,%rax)