// File: vgteam[P]stream/src/main.cpp
// Function: main
int main(int argc, char** argv) {
    Person person1;
    person1.set_name("Ralph");
    person1.set_id(42);
    person1.set_email("post please");
    Person person2;
    person2.set_name("Sal");
    person2.set_id(99929999);
    person2.set_email("morse code");
    ofstream out;
    out.open("test.stream");
    vector<Person> people = { person1, person2 };
    stream::write_buffered(out, people, 0);
    out.close();
    ifstream in;
    in.open("test.stream");
    function<void(Person&)> lambda = [](Person& p) {
        cout << p.name() << endl;
        cout << p.id() << endl;
    };
    stream::for_each(in, lambda);
    in.close();
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x5a0, %rsp            # imm = 0x5A0
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x40(%rbp), %rdi
movq %rdi, -0x550(%rbp)
callq 0x6c10
movq -0x550(%rbp), %rdi
leaq 0x3f69(%rip), %rsi      # 0xc2d0
callq 0x8b30
jmp 0x836e
leaq -0x40(%rbp), %rdi
movl $0x2a, %esi
callq 0x8d00
jmp 0x837e
leaq 0x3f51(%rip), %rsi      # 0xc2d6
leaq -0x40(%rbp), %rdi
callq 0x8d30
jmp 0x8390
leaq -0x80(%rbp), %rdi
callq 0x6c10
jmp 0x839b
leaq 0x3f40(%rip), %rsi      # 0xc2e2
leaq -0x80(%rbp), %rdi
callq 0x8b30
jmp 0x83ad
leaq -0x80(%rbp), %rdi
movl $0x5f4cf8f, %esi        # imm = 0x5F4CF8F
callq 0x8d00
jmp 0x83bd
leaq 0x3f22(%rip), %rsi      # 0xc2e6
leaq -0x80(%rbp), %rdi
callq 0x8d30
jmp 0x83cf
leaq -0x280(%rbp), %rdi
callq 0x4540
jmp 0x83dd
leaq 0x3f0d(%rip), %rsi      # 0xc2f1
leaq -0x280(%rbp), %rdi
movl $0x10, %edx
callq 0x4050
jmp 0x83f7
leaq -0x308(%rbp), %rdi
movq %rdi, -0x310(%rbp)
leaq -0x40(%rbp), %rsi
callq 0x48a0
jmp 0x8410
leaq -0x2d8(%rbp), %rdi
movq %rdi, -0x310(%rbp)
leaq -0x80(%rbp), %rsi
callq 0x48a0
jmp 0x8429
leaq -0x308(%rbp), %rax
movq %rax, -0x2a8(%rbp)
movq $0x2, -0x2a0(%rbp)
leaq -0x311(%rbp), %rdi
movq %rdi, -0x558(%rbp)
callq 0x8f00
movq -0x558(%rbp), %rcx
movq -0x2a8(%rbp), %rsi
movq -0x2a0(%rbp), %rdx
leaq -0x298(%rbp), %rdi
callq 0x8f20
jmp 0x8478
leaq -0x311(%rbp), %rdi
callq 0x8fa0
leaq -0x308(%rbp), %rax
movq %rax, -0x568(%rbp)
addq $0x60, %rax
movq %rax, -0x560(%rbp)
movq -0x560(%rbp), %rdi
addq $-0x30, %rdi
movq %rdi, -0x570(%rbp)
callq 0x4b60
movq -0x568(%rbp), %rcx
movq -0x570(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x560(%rbp)
jne 0x849d
xorl %eax, %eax
movl %eax, %edx
leaq -0x280(%rbp), %rdi
leaq -0x298(%rbp), %rsi
callq 0x8fc0
jmp 0x84e7
leaq -0x280(%rbp), %rdi
callq 0x4440
jmp 0x84f5
leaq -0x520(%rbp), %rdi
callq 0x43a0
jmp 0x8503
leaq 0x3de7(%rip), %rsi      # 0xc2f1
leaq -0x520(%rbp), %rdi
movl $0x8, %edx
callq 0x4200
jmp 0x851d
leaq -0x540(%rbp), %rdi
movq %rdi, -0x578(%rbp)
leaq -0x541(%rbp), %rsi
callq 0x8720
movq -0x578(%rbp), %rsi
leaq -0x520(%rbp), %rdi
callq 0x9070
jmp 0x854c
leaq -0x520(%rbp), %rdi
callq 0x40b0
jmp 0x855a
movl $0x0, -0x4(%rbp)
leaq -0x540(%rbp), %rdi
callq 0x90e0
leaq -0x520(%rbp), %rdi
callq 0x40e0
leaq -0x298(%rbp), %rdi
callq 0x9100
leaq -0x280(%rbp), %rdi
callq 0x44a0
leaq -0x80(%rbp), %rdi
callq 0x4b60
leaq -0x40(%rbp), %rdi
callq 0x4b60
movl -0x4(%rbp), %eax
addq $0x5a0, %rsp            # imm = 0x5A0
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x8703
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x86fa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x86ee
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
movq -0x310(%rbp), %rax
leaq -0x308(%rbp), %rcx
cmpq %rax, %rcx
movq %rax, -0x580(%rbp)
je 0x8639
movq -0x580(%rbp), %rdi
addq $-0x30, %rdi
movq %rdi, -0x588(%rbp)
callq 0x4b60
movq -0x588(%rbp), %rax
leaq -0x308(%rbp), %rcx
cmpq %rcx, %rax
movq %rax, -0x580(%rbp)
jne 0x8608
jmp 0x86ee
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x311(%rbp), %rdi
callq 0x8fa0
leaq -0x308(%rbp), %rax
movq %rax, -0x598(%rbp)
addq $0x60, %rax
movq %rax, -0x590(%rbp)
movq -0x590(%rbp), %rdi
addq $-0x30, %rdi
movq %rdi, -0x5a0(%rbp)
callq 0x4b60
movq -0x598(%rbp), %rcx
movq -0x5a0(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x590(%rbp)
jne 0x866f
jmp 0x86ee
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x86e2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x86d6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x540(%rbp), %rdi
callq 0x90e0
leaq -0x520(%rbp), %rdi
callq 0x40e0
leaq -0x298(%rbp), %rdi
callq 0x9100
leaq -0x280(%rbp), %rdi
callq 0x44a0
leaq -0x80(%rbp), %rdi
callq 0x4b60
leaq -0x40(%rbp), %rdi
callq 0x4b60
movq -0x48(%rbp), %rdi
callq 0x4580
nopw %cs:(%rax,%rax)