// File: /workspace/github_cpp_makefile_star2_O1/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 0x5c2b(%rip), %r14      # 0x7fd0
leaq 0x2c5b(%rip), %rsi      # 0x5007
movl $0x11, %edx
movq %r14, %rdi
callq 0x2170
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
cmpl $0x2, %ebp
je 0x257e
cmpl $0x3, %ebp
jne 0x240b
movq 0x8(%rbx), %rdi
leaq 0x2c0b(%rip), %rsi      # 0x5004
movl $0x3, %edx
callq 0x2090
testl %eax, %eax
je 0x2587
movq 0x5bde(%rip), %rbx      # 0x7ff0
leaq 0x2c00(%rip), %rsi      # 0x5019
movl $0x23, %edx
movq %rbx, %rdi
callq 0x2170
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
leaq 0x2be9(%rip), %rsi      # 0x503d
movl $0x40, %edx
movq %rbx, %rdi
callq 0x2170
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
leaq 0x2bef(%rip), %rsi      # 0x507e
movl $0x44, %edx
movq %rbx, %rdi
callq 0x2170
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
leaq 0x2bf9(%rip), %rsi      # 0x50c3
movl $0x8, %edx
movq %rbx, %rdi
callq 0x2170
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
leaq 0x2bc7(%rip), %rsi      # 0x50cc
movl $0x2b, %edx
movq %rbx, %rdi
callq 0x2170
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
leaq 0x2bb8(%rip), %rsi      # 0x50f8
movl $0x20, %edx
movq %rbx, %rdi
callq 0x2170
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x25ff
movl $0x8, %eax
xorl %ebp, %ebp
jmp 0x258f
movb $0x1, %bpl
movl $0x10, %eax
movq (%rbx,%rax), %rsi
leaq 0x8(%rsp), %rdi
callq 0x2634
movzbl %bpl, %esi
leaq 0x18(%rsp), %rdi
callq 0x2a58
leaq 0x8(%rsp), %rbx
leaq 0xbc(%rsp), %r14
leaq 0x18(%rsp), %r15
cmpb $0x0, 0x10(%rsp)
jne 0x25e9
testb $0x1, 0x11(%rsp)
jne 0x25e9
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2718
testb %al, %al
je 0x25e9
movq %r15, %rdi
movq %r14, %rsi
callq 0x2b92
testb %al, %al
jne 0x25bd
leaq 0x18(%rsp), %rdi
callq 0x2b28
leaq 0x8(%rsp), %rdi
callq 0x270a
xorl %eax, %eax
addq $0x178, %rsp            # imm = 0x178
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x261f
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x2b28
leaq 0x8(%rsp), %rdi
callq 0x270a
movq %rbx, %rdi
callq 0x2200
nopl (%rax)