// File: sweeterthancandy[P]linux_event_debugger/./linux_event_to_string.h
// Function: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> input_event_to_string<(anonymous namespace)::aux::colour_formatter>(input_event const&, (anonymous namespace)::aux::colour_formatter&&)
std::string input_event_to_string(struct input_event const& ev, colour_formatter&& formatter){

        namespace detail = linux_event_to_string_detail;
        std::string type_s( detail::type_to_string(ev.type));
        std::string code_s;
        std::string value_s = boost::lexical_cast<std::string>(ev.value);

        auto make_it = [](const std::string& type_s, const std::string& code_s, const std::string& value_s){
                return str( boost::format("%-10s %-10s %s")
                                % type_s
                                % code_s
                                % value_s
                       );
        };
        
        switch(ev.type){
                #define AUX_SEQ\
                        ((EV_SYN)(syn_to_string)(formatter.colour_pruple))      \
                        ((EV_KEY)(key_to_string)(formatter.colour_red))         \
                        ((EV_ABS)(abs_to_string)(formatter.colour_blue))        \
                        ((EV_REL)(rel_to_string)(formatter.colour_green))       \
                        ((EV_MSC)(msc_to_string)(formatter.colour_yellow))      \

                #define AUX(r,data,elem)                                        \
                        case BOOST_PP_SEQ_ELEM(0,elem):                         \
                               return BOOST_PP_SEQ_ELEM(2,elem) ( make_it(      \
                                        type_s,                                 \
                                        detail:: BOOST_PP_SEQ_ELEM(1,elem)( ev.code ),   \
                                        value_s                                 \
                                ) ) ;
                BOOST_PP_SEQ_FOR_EACH(AUX,~,AUX_SEQ)
                #undef AUX
                #undef AUX_SEQ
                default:
                        return make_it(type_s, boost::lexical_cast<std::string>(ev.code), value_s );
        }
        assert(0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x230, %rsp            # imm = 0x230
movq %rdi, -0x200(%rbp)
movq %rdi, %rax
movq %rax, -0x1f8(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rax
movzwl 0x10(%rax), %esi
leaq -0x38(%rbp), %rdi
callq 0xe250
leaq -0x58(%rbp), %rdi
callq 0xd970
movq -0x10(%rbp), %rsi
addq $0x14, %rsi
leaq -0x78(%rbp), %rdi
callq 0x1e8e0
jmp 0x19d25
movq -0x10(%rbp), %rax
movzwl 0x10(%rax), %eax
movq %rax, -0x208(%rbp)
subq $0x4, %rax
ja 0x1a156
movq -0x208(%rbp), %rax
leaq 0x45574(%rip), %rcx     # 0x5f2c0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x1a1f9
movq -0x18(%rbp), %rax
movq %rax, -0x210(%rbp)
movq -0x10(%rbp), %rax
movzwl 0x12(%rax), %esi
leaq -0xc8(%rbp), %rdi
callq 0xe700
jmp 0x19d8a
leaq -0xa8(%rbp), %rdi
leaq -0x85(%rbp), %rsi
leaq -0x38(%rbp), %rdx
leaq -0xc8(%rbp), %rcx
leaq -0x78(%rbp), %r8
callq 0x1a2a0
jmp 0x19dae
movq -0x210(%rbp), %rsi
movq -0x200(%rbp), %rdi
leaq -0xa8(%rbp), %rdx
callq 0x1a220
jmp 0x19dca
leaq -0xa8(%rbp), %rdi
callq 0xd3b0
leaq -0xc8(%rbp), %rdi
callq 0xd3b0
movl $0x1, -0xcc(%rbp)
jmp 0x1a1c5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x1a1f0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x19e31
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0xd3b0
leaq -0xc8(%rbp), %rdi
callq 0xd3b0
jmp 0x1a1f0
movq -0x18(%rbp), %rax
movq %rax, -0x218(%rbp)
movq -0x10(%rbp), %rax
movzwl 0x12(%rax), %esi
leaq -0x110(%rbp), %rdi
callq 0xe920
jmp 0x19e63
leaq -0xf0(%rbp), %rdi
leaq -0x85(%rbp), %rsi
leaq -0x38(%rbp), %rdx
leaq -0x110(%rbp), %rcx
leaq -0x78(%rbp), %r8
callq 0x1a2a0
jmp 0x19e87
movq -0x218(%rbp), %rsi
movq -0x200(%rbp), %rdi
leaq -0xf0(%rbp), %rdx
callq 0x1a390
jmp 0x19ea3
leaq -0xf0(%rbp), %rdi
callq 0xd3b0
leaq -0x110(%rbp), %rdi
callq 0xd3b0
movl $0x1, -0xcc(%rbp)
jmp 0x1a1c5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x19ef6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0xd3b0
leaq -0x110(%rbp), %rdi
callq 0xd3b0
jmp 0x1a1f0
movq -0x18(%rbp), %rax
movq %rax, -0x220(%rbp)
movq -0x10(%rbp), %rax
movzwl 0x12(%rax), %esi
leaq -0x150(%rbp), %rdi
callq 0x104d0
jmp 0x19f28
leaq -0x130(%rbp), %rdi
leaq -0x85(%rbp), %rsi
leaq -0x38(%rbp), %rdx
leaq -0x150(%rbp), %rcx
leaq -0x78(%rbp), %r8
callq 0x1a2a0
jmp 0x19f4c
movq -0x220(%rbp), %rsi
movq -0x200(%rbp), %rdi
leaq -0x130(%rbp), %rdx
callq 0x1a410
jmp 0x19f68
leaq -0x130(%rbp), %rdi
callq 0xd3b0
leaq -0x150(%rbp), %rdi
callq 0xd3b0
movl $0x1, -0xcc(%rbp)
jmp 0x1a1c5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x19fbb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x130(%rbp), %rdi
callq 0xd3b0
leaq -0x150(%rbp), %rdi
callq 0xd3b0
jmp 0x1a1f0
movq -0x18(%rbp), %rax
movq %rax, -0x228(%rbp)
movq -0x10(%rbp), %rax
movzwl 0x12(%rax), %esi
leaq -0x190(%rbp), %rdi
callq 0x100c0
jmp 0x19fed
leaq -0x170(%rbp), %rdi
leaq -0x85(%rbp), %rsi
leaq -0x38(%rbp), %rdx
leaq -0x190(%rbp), %rcx
leaq -0x78(%rbp), %r8
callq 0x1a2a0
jmp 0x1a011
movq -0x228(%rbp), %rsi
movq -0x200(%rbp), %rdi
leaq -0x170(%rbp), %rdx
callq 0x1a490
jmp 0x1a02d
leaq -0x170(%rbp), %rdi
callq 0xd3b0
leaq -0x190(%rbp), %rdi
callq 0xd3b0
movl $0x1, -0xcc(%rbp)
jmp 0x1a1c5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x1a080
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x170(%rbp), %rdi
callq 0xd3b0
leaq -0x190(%rbp), %rdi
callq 0xd3b0
jmp 0x1a1f0
movq -0x18(%rbp), %rax
movq %rax, -0x230(%rbp)
movq -0x10(%rbp), %rax
movzwl 0x12(%rax), %esi
leaq -0x1d0(%rbp), %rdi
callq 0x11340
jmp 0x1a0b2
leaq -0x1b0(%rbp), %rdi
leaq -0x85(%rbp), %rsi
leaq -0x38(%rbp), %rdx
leaq -0x1d0(%rbp), %rcx
leaq -0x78(%rbp), %r8
callq 0x1a2a0
jmp 0x1a0d6
movq -0x230(%rbp), %rsi
movq -0x200(%rbp), %rdi
leaq -0x1b0(%rbp), %rdx
callq 0x1a510
jmp 0x1a0f2
leaq -0x1b0(%rbp), %rdi
callq 0xd3b0
leaq -0x1d0(%rbp), %rdi
callq 0xd3b0
movl $0x1, -0xcc(%rbp)
jmp 0x1a1c5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x1a145
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x1b0(%rbp), %rdi
callq 0xd3b0
leaq -0x1d0(%rbp), %rdi
callq 0xd3b0
jmp 0x1a1f0
movq -0x10(%rbp), %rsi
addq $0x12, %rsi
leaq -0x1f0(%rbp), %rdi
callq 0x4a020
jmp 0x1a16c
movq -0x200(%rbp), %rdi
leaq -0x85(%rbp), %rsi
leaq -0x38(%rbp), %rdx
leaq -0x1f0(%rbp), %rcx
leaq -0x78(%rbp), %r8
callq 0x1a2a0
jmp 0x1a190
leaq -0x1f0(%rbp), %rdi
callq 0xd3b0
movl $0x1, -0xcc(%rbp)
jmp 0x1a1c5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x1f0(%rbp), %rdi
callq 0xd3b0
jmp 0x1a1f0
leaq -0x78(%rbp), %rdi
callq 0xd3b0
leaq -0x58(%rbp), %rdi
callq 0xd3b0
leaq -0x38(%rbp), %rdi
callq 0xd3b0
movq -0x1f8(%rbp), %rax
addq $0x230, %rsp            # imm = 0x230
popq %rbp
retq
leaq -0x78(%rbp), %rdi
callq 0xd3b0
leaq -0x58(%rbp), %rdi
callq 0xd3b0
leaq -0x38(%rbp), %rdi
callq 0xd3b0
movq -0x80(%rbp), %rdi
callq 0xdb80
nopw %cs:(%rax,%rax)