// File: oknenavin[P]cxon/examples/common-interface.cxx
// Function: main
int main() {
    using CBOR = cxon::CBOR<>;

    char const  json_in[] = "[1,5,7]";
    std::string json_out;

    std::vector<unsigned char> cbor;
    {
        std::vector<int> cxx;
        auto fbr = cxon::from_bytes(cxx, json_in);      // JSON to C++
            assert(fbr);
        auto tbr = cxon::to_bytes<CBOR>(cbor, cxx);     // C++ to CBOR
            assert(tbr);
    }
    {
        std::vector<int> cxx;
        auto fbr = cxon::from_bytes<CBOR>(cxx, cbor);   // CBOR to C++
            assert(fbr);
        auto tbr = cxon::to_bytes(json_out, cxx);       // C++ to JSON
            assert(tbr);
    }

    assert(json_out == json_in);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movl $0x0, -0x4(%rbp)
movabsq $0x5d372c352c315b, %rax # imm = 0x5D372C352C315B
movq %rax, -0x10(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x2170
leaq -0x48(%rbp), %rdi
callq 0x28e0
leaq -0x60(%rbp), %rdi
movq %rdi, -0xf0(%rbp)
callq 0x2900
movq -0xf0(%rbp), %rsi
leaq -0x78(%rbp), %rdi
leaq -0x10(%rbp), %rdx
callq 0x2920
jmp 0x2348
leaq -0x78(%rbp), %rdi
callq 0x2950
testb $0x1, %al
jne 0x2357
jmp 0x2359
jmp 0x2395
leaq 0x8d54(%rip), %rdi      # 0xb0b4
leaq 0x8d51(%rip), %rsi      # 0xb0b8
movl $0x15, %edx
leaq 0x8d5a(%rip), %rcx      # 0xb0cd
callq 0x20e0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x29c0
jmp 0x252f
leaq -0xa0(%rbp), %rdi
leaq -0x48(%rbp), %rsi
leaq -0x60(%rbp), %rdx
callq 0x2970
jmp 0x23ab
leaq -0xa0(%rbp), %rdi
callq 0x29a0
testb $0x1, %al
jne 0x23bd
jmp 0x23bf
jmp 0x23de
leaq 0x8d12(%rip), %rdi      # 0xb0d8
leaq 0x8ceb(%rip), %rsi      # 0xb0b8
movl $0x17, %edx
leaq 0x8cf4(%rip), %rcx      # 0xb0cd
callq 0x20e0
leaq -0x60(%rbp), %rdi
callq 0x29c0
leaq -0xb8(%rbp), %rdi
movq %rdi, -0xf8(%rbp)
callq 0x2900
movq -0xf8(%rbp), %rsi
leaq -0xd0(%rbp), %rdi
leaq -0x48(%rbp), %rdx
callq 0x2a20
jmp 0x2413
leaq -0xd0(%rbp), %rdi
callq 0x2a50
testb $0x1, %al
jne 0x2425
jmp 0x2427
jmp 0x2466
leaq 0x8c86(%rip), %rdi      # 0xb0b4
leaq 0x8c83(%rip), %rsi      # 0xb0b8
movl $0x1c, %edx
leaq 0x8c8c(%rip), %rcx      # 0xb0cd
callq 0x20e0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x29c0
jmp 0x252f
leaq -0xe8(%rbp), %rdi
leaq -0x30(%rbp), %rsi
leaq -0xb8(%rbp), %rdx
callq 0x2a70
jmp 0x247f
leaq -0xe8(%rbp), %rdi
callq 0x2aa0
testb $0x1, %al
jne 0x2491
jmp 0x2493
jmp 0x24b2
leaq 0x8c3e(%rip), %rdi      # 0xb0d8
leaq 0x8c17(%rip), %rsi      # 0xb0b8
movl $0x1e, %edx
leaq 0x8c20(%rip), %rcx      # 0xb0cd
callq 0x20e0
leaq -0xb8(%rbp), %rdi
callq 0x29c0
leaq -0x30(%rbp), %rdi
leaq -0x10(%rbp), %rsi
callq 0x2ac0
movb %al, -0xf9(%rbp)
jmp 0x24d3
movb -0xf9(%rbp), %al
testb $0x1, %al
jne 0x24df
jmp 0x24e1
jmp 0x2511
leaq 0x8bf4(%rip), %rdi      # 0xb0dc
leaq 0x8bc9(%rip), %rsi      # 0xb0b8
movl $0x21, %edx
leaq 0x8bd2(%rip), %rcx      # 0xb0cd
callq 0x20e0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x252f
leaq -0x48(%rbp), %rdi
callq 0x2af0
leaq -0x30(%rbp), %rdi
callq 0x20c0
movl -0x4(%rbp), %eax
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
leaq -0x48(%rbp), %rdi
callq 0x2af0
leaq -0x30(%rbp), %rdi
callq 0x20c0
movq -0x80(%rbp), %rdi
callq 0x21c0
nopw (%rax,%rax)