// File: /workspace/github_cpp_makefile_star2_O3/mmoanis[P]mpegts_demux/mpegts_demux.cpp
// Function: main
int main(int argc, char *argv[])
{
    print_banner(cout);

    /// CMD LINE OPTIONS
    const char  *filename = NULL;
    bool info = false;
    switch(argc) {
        case 2:
            filename = argv[1];
            break;
        case 3:
            if (strncmp(argv[1], "-i", 3) == 0) {
                info = true;
                filename = argv[2];
                break;
            }
            // fall through
        default:
            print_usage(cerr);
            return -1;
    }

    MpegTsBitStream bitStream(filename);
    MpegTsDemuxer demuxer(info);
    Packet packet;

    while (bitStream.good() && bitStream.GetPacket(packet)) {
        if (!demuxer.DecodePacket(packet))
            break;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x178, %rsp            # imm = 0x178
movq %rsi, %rbx
movl %edi, %ebp
movq 0x5c3b(%rip), %r14      # 0x7fd0
leaq 0x2c68(%rip), %rsi      # 0x5004
movl $0x11, %edx
movq %r14, %rdi
callq 0x2160
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2120
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
cmpl $0x2, %ebp
je 0x2567
cmpl $0x3, %ebp
jne 0x23f7
movq 0x8(%rbx), %rax
cmpb $0x2d, (%rax)
jne 0x23f7
cmpb $0x69, 0x1(%rax)
jne 0x23f7
cmpb $0x0, 0x2(%rax)
je 0x25ec
movq 0x5bf2(%rip), %rbx      # 0x7ff0
leaq 0x2c11(%rip), %rsi      # 0x5016
movl $0x23, %edx
movq %rbx, %rdi
callq 0x2160
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2120
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
leaq 0x2bfa(%rip), %rsi      # 0x503a
movl $0x40, %edx
movq %rbx, %rdi
callq 0x2160
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2120
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
leaq 0x2c00(%rip), %rsi      # 0x507b
movl $0x44, %edx
movq %rbx, %rdi
callq 0x2160
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2120
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
leaq 0x2c0a(%rip), %rsi      # 0x50c0
movl $0x8, %edx
movq %rbx, %rdi
callq 0x2160
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2120
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
leaq 0x2bd8(%rip), %rsi      # 0x50c9
movl $0x2b, %edx
movq %rbx, %rdi
callq 0x2160
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2120
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
leaq 0x2bc9(%rip), %rsi      # 0x50f5
movl $0x20, %edx
movq %rbx, %rdi
callq 0x2160
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2120
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x25de
movl $0x8, %eax
xorl %ebp, %ebp
movq (%rbx,%rax), %rsi
leaq 0x8(%rsp), %rdi
callq 0x2620
movzbl %bpl, %esi
leaq 0x18(%rsp), %rdi
callq 0x2a44
leaq 0x8(%rsp), %rbx
leaq 0xbc(%rsp), %r14
leaq 0x18(%rsp), %r15
cmpb $0x0, 0x10(%rsp)
jne 0x25c8
testb $0x1, 0x11(%rsp)
jne 0x25c8
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2704
testb %al, %al
je 0x25c8
movq %r15, %rdi
movq %r14, %rsi
callq 0x2b7e
testb %al, %al
jne 0x259c
leaq 0x18(%rsp), %rdi
callq 0x2b14
leaq 0x8(%rsp), %rdi
callq 0x26f6
xorl %eax, %eax
addq $0x178, %rsp            # imm = 0x178
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, %bpl
movl $0x10, %eax
jmp 0x256e
movq %rax, %rbx
jmp 0x260b
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x2b14
leaq 0x8(%rsp), %rdi
callq 0x26f6
movq %rbx, %rdi
callq 0x21f0
nopl (%rax)