// File: rksdna[P]json/main.cpp
// Function: main
int main(int argc, char *argv[])
{
    json::writer writer;
    auto read = [&writer](json::item item, const std::string &data, std::size_t row, std::size_t column)
    {
        writer.write(item, data, std::ostream_iterator<char>(std::cout));
    };

    try
    {
        std::ifstream input("sample.json");

        json::reader reader(read);
        reader.read(std::istream_iterator<char>(input), std::istream_iterator<char>());
    }
    catch(json::exception &e)
    {
        std::cerr << e.what() << " at " << e.row() << ":" << e.column() << std::endl;
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x3d0, %rsp            # imm = 0x3D0
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x68(%rbp), %rdi
movq %rdi, -0x388(%rbp)
callq 0x2b80
movq -0x388(%rbp), %rax
movq %rax, -0x70(%rbp)
leaq 0x8c3f(%rip), %rsi      # 0xb0ca
leaq -0x278(%rbp), %rdi
movl $0x8, %edx
callq 0x22f0
jmp 0x249e
leaq -0x358(%rbp), %rdi
movq %rdi, -0x390(%rbp)
leaq -0x70(%rbp), %rsi
callq 0x2700
movq -0x390(%rbp), %rsi
leaq -0x338(%rbp), %rdi
callq 0x2bb0
jmp 0x24ca
leaq -0x358(%rbp), %rdi
callq 0x2c40
leaq -0x368(%rbp), %rdi
leaq -0x278(%rbp), %rsi
callq 0x2d60
jmp 0x24eb
leaq -0x378(%rbp), %rdi
callq 0x2d90
jmp 0x24f9
leaq -0x338(%rbp), %rdi
leaq -0x368(%rbp), %rsi
leaq -0x378(%rbp), %rdx
callq 0x2c60
jmp 0x2515
leaq -0x338(%rbp), %rdi
callq 0x2db0
leaq -0x278(%rbp), %rdi
callq 0x2060
jmp 0x2696
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x280(%rbp)
movl %eax, -0x284(%rbp)
jmp 0x2590
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x280(%rbp)
movl %eax, -0x284(%rbp)
leaq -0x358(%rbp), %rdi
callq 0x2c40
jmp 0x2584
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x280(%rbp)
movl %eax, -0x284(%rbp)
leaq -0x338(%rbp), %rdi
callq 0x2db0
leaq -0x278(%rbp), %rdi
callq 0x2060
movl -0x284(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x26e1
movq -0x280(%rbp), %rdi
callq 0x20a0
movq %rax, -0x380(%rbp)
movq -0x380(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movq %rax, %rsi
movq 0xda20(%rip), %rdi      # 0xfff0
callq 0x21a0
movq %rax, -0x398(%rbp)
jmp 0x25de
movq -0x398(%rbp), %rdi
leaq 0x8aea(%rip), %rsi      # 0xb0d6
callq 0x21a0
movq %rax, -0x3a0(%rbp)
jmp 0x25fa
movq -0x380(%rbp), %rdi
callq 0x2df0
movq %rax, -0x3a8(%rbp)
jmp 0x260f
movq -0x3a8(%rbp), %rsi
movq -0x3a0(%rbp), %rdi
callq 0x2050
movq %rax, -0x3b0(%rbp)
jmp 0x262b
movq -0x3b0(%rbp), %rdi
leaq 0x8aa2(%rip), %rsi      # 0xb0db
callq 0x21a0
movq %rax, -0x3b8(%rbp)
jmp 0x2647
movq -0x380(%rbp), %rdi
callq 0x2e10
movq %rax, -0x3c0(%rbp)
jmp 0x265c
movq -0x3c0(%rbp), %rsi
movq -0x3b8(%rbp), %rdi
callq 0x2050
movq %rax, -0x3c8(%rbp)
jmp 0x2678
movq -0x3c8(%rbp), %rdi
movq 0xd912(%rip), %rsi      # 0xff98
callq 0x21d0
jmp 0x268d
callq 0x2290
jmp 0x2694
jmp 0x2696
movl $0x0, -0x4(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x2e40
movl -0x4(%rbp), %eax
addq $0x3d0, %rsp            # imm = 0x3D0
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x280(%rbp)
movl %eax, -0x284(%rbp)
callq 0x2290
jmp 0x26df
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x280(%rbp)
movl %eax, -0x284(%rbp)
jmp 0x26e1
jmp 0x26e1
leaq -0x68(%rbp), %rdi
callq 0x2e40
movq -0x280(%rbp), %rdi
callq 0x22b0
movq %rax, %rdi
callq 0x2e30
nop