// File: /workspace/github_cpp_makefile_star2_O1/instance01[P]chromium-snss-parse/examples/parse_print_types.cpp
// Function: main
int main(int argc, char* argv[]) {
    if (argc != 2) {
        std::cout << "Usage: " << argv[0] << " <filename>" << std::endl;
        std::cout << "For example on ArchLinux you could try and parse ";
        std::cout << "~/.config/chromium/Default/Current Session" << std::endl;
    }

    std::ifstream f(argv[1], std::ios::binary | std::ios::in);
    if (!f.is_open() || f.fail())
        return 1;

    std::vector<std::shared_ptr<Command>> cmds = read_session_file(f);

    for (auto & x : cmds) {
        std::cout << " Size: " << x->size << " Type: " << static_cast<uint16_t>(x->type) << std::endl;
    }

    f.close();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
movq %rsi, %rbx
cmpl $0x2, %edi
je 0x4e28
movq 0x5282(%rip), %r14      # 0x9fd0
leaq 0x13fb(%rip), %rsi      # 0x6150
movl $0x7, %edx
movq %r14, %rdi
callq 0x3150
movq (%rbx), %r15
testq %r15, %r15
je 0x4d86
movq %r15, %rdi
callq 0x30c0
movq 0x5257(%rip), %rdi      # 0x9fd0
movq %r15, %rsi
movq %rax, %rdx
callq 0x3150
jmp 0x4d9e
movq (%r14), %rax
movq -0x18(%rax), %rax
leaq (%r14,%rax), %rdi
movl 0x20(%r14,%rax), %esi
orl $0x1, %esi
callq 0x31d0
leaq 0x13b3(%rip), %rsi      # 0x6158
movl $0xb, %edx
movq %r14, %rdi
callq 0x3150
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3120
movsbl %al, %esi
movq %r14, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x30f0
leaq 0x1384(%rip), %rsi      # 0x6164
movl $0x31, %edx
movq %r14, %rdi
callq 0x3150
leaq 0x13a2(%rip), %rsi      # 0x6196
movl $0x2a, %edx
movq %r14, %rdi
callq 0x3150
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3120
movsbl %al, %esi
movq %r14, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x30f0
movq 0x8(%rbx), %rsi
leaq -0x248(%rbp), %rdi
movl $0xc, %edx
callq 0x3210
leaq -0x1d0(%rbp), %rdi
callq 0x3050
movl $0x1, %ebx
testb %al, %al
je 0x4f2f
movq -0x248(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x5, -0x228(%rbp,%rax)
jne 0x4f2f
leaq -0x40(%rbp), %rdi
leaq -0x248(%rbp), %rsi
callq 0x4895
movq -0x40(%rbp), %r13
movq -0x38(%rbp), %r14
cmpq %r14, %r13
je 0x4f18
movq 0x5139(%rip), %rbx      # 0x9fd0
leaq 0x132b(%rip), %r15      # 0x61c9
movl $0x7, %edx
movq %rbx, %rdi
leaq 0x1314(%rip), %rsi      # 0x61c1
callq 0x3150
movq (%r13), %rax
movzwl 0x8(%rax), %esi
movq %rbx, %rdi
callq 0x30e0
movq %rax, %r12
movl $0x7, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x3150
movq (%r13), %rax
movzwl 0xc(%rax), %esi
movq %r12, %rdi
callq 0x30e0
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x3120
movsbl %al, %esi
movq %r12, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x30f0
addq $0x10, %r13
cmpq %r14, %r13
jne 0x4e9e
leaq -0x248(%rbp), %rdi
callq 0x3040
leaq -0x40(%rbp), %rdi
callq 0x4fbc
xorl %ebx, %ebx
leaq -0x248(%rbp), %rdi
callq 0x3060
movl %ebx, %eax
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4f56
movq %rax, %rbx
jmp 0x4f62
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x4fbc
leaq -0x248(%rbp), %rdi
callq 0x3060
movq %rbx, %rdi
callq 0x3200