// File: /workspace/github_cpp_makefile_star2_O3/mmoanis[P]mpegts_demux/MpegTsDemux.cpp
// Function: MpegTsDemuxer::RegisterStream(unsigned short, Program const&, bool)
bool MpegTsDemuxer::RegisterStream(PID id, const Program& prog, bool video)
{
    Streams::iterator s = m_streams.find(id);
    if (s == m_streams.end()) {
        string filename = GetFileName(video, id, prog.id);
        Stream *S = new Stream(filename.c_str(), id, prog.id);
        m_streams.insert( make_pair(id, S) );
        if (m_info)
            cout << "[INFO]: PKT#" << m_pnum << " STREAM=" << id << " PROGRAM=" << prog.id << " TYPE=" << (video? "VIDEO" : "AUDIO") << endl;
        else
            cout << "[INFO]: PKT#" << m_pnum << " STREAM=" << id << " TYPE=" << (video? "VIDEO" : "AUDIO") << endl;
        // expect packet for stream
        m_filters.insert( make_pair(id, DEMUXER_EVENT_PES) );
    }  else {
        if ((*s).second->GetPId() != prog.id && prog.id != MPEGTS_PID_NULL) {
            // Support updating stream information.
            cout << "[WARNING]: PKT#" << m_pnum << " STREAM=" << id << " PROGRAM=" << (*s).second->GetPId() << " appeared in PROGRAM=" << prog.id << endl;
            (*s).second->SetPId(prog.id);
        }
    }
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movl %ecx, %ebp
movq %rdx, %r15
movl %esi, %r12d
movq %rdi, %rbx
movq 0x40(%rdi), %rax
testq %rax, %rax
je 0x4132
leaq 0x38(%rbx), %rcx
movq %rcx, %r13
xorl %edx, %edx
cmpw %r12w, 0x20(%rax)
setb %dl
cmovaeq %rax, %r13
movq 0x10(%rax,%rdx,8), %rax
testq %rax, %rax
jne 0x410a
cmpq %rcx, %r13
je 0x4132
cmpw %r12w, 0x20(%r13)
jbe 0x43a3
leaq 0x20(%rsp), %rdi
callq 0x20e0
leaq 0x30(%rsp), %r13
leaq 0x150b(%rip), %rax      # 0x5653
leaq 0x150a(%rip), %rsi      # 0x5659
testb %bpl, %bpl
cmovneq %rax, %rsi
movl $0x5, %edx
movq %r13, %rdi
callq 0x2160
leaq 0x14f5(%rip), %rsi      # 0x565f
movl $0x4, %edx
movq %r13, %rdi
callq 0x2160
movzwl %r12w, %r14d
movq %r13, %rdi
movq %r14, %rsi
callq 0x20b0
leaq 0x38(%rsp), %rsi
movq %rsp, %rdi
callq 0x21c0
movq 0x3e1e(%rip), %rsi      # 0x7fb8
leaq 0x20(%rsp), %rdi
callq 0x20f0
leaq 0xa0(%rsp), %rdi
callq 0x2060
movl $0x10, %edi
callq 0x2140
movq %rax, %r13
movq (%rsp), %rsi
movzwl (%r15), %ecx
movq %rax, %rdi
movl %r14d, %edx
callq 0x2828
leaq 0x30(%rbx), %rdi
leaq 0x20(%rsp), %rsi
movw %r12w, (%rsi)
movq %r13, 0x8(%rsi)
callq 0x48e6
cmpb $0x1, 0x98(%rbx)
jne 0x42b6
movq 0x3dd5(%rip), %rdi      # 0x7fd0
leaq 0x13bd(%rip), %rsi      # 0x55bf
movl $0xc, %edx
callq 0x2160
movq 0x90(%rbx), %rsi
movq 0x3db6(%rip), %rdi      # 0x7fd0
callq 0x20b0
movq %rax, %r12
leaq 0xff1(%rip), %rsi       # 0x521a
movl $0x8, %edx
movq %rax, %rdi
callq 0x2160
movq %r12, %rdi
movq %r14, %rsi
callq 0x20b0
movq %rax, %r12
leaq 0x123c(%rip), %rsi      # 0x5487
movl $0x9, %edx
movq %rax, %rdi
callq 0x2160
movzwl (%r15), %esi
movq %r12, %rdi
callq 0x20b0
movq %rax, %r15
leaq 0x13bc(%rip), %rsi      # 0x562a
movl $0x6, %edx
movq %rax, %rdi
callq 0x2160
leaq 0x13af(%rip), %rax      # 0x5631
leaq 0x13ae(%rip), %rsi      # 0x5637
testb %bpl, %bpl
cmovneq %rax, %rsi
movl $0x5, %edx
movq %r15, %rdi
callq 0x2160
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2120
jmp 0x4350
movq 0x3d13(%rip), %rdi      # 0x7fd0
leaq 0x12fb(%rip), %rsi      # 0x55bf
movl $0xc, %edx
callq 0x2160
movq 0x90(%rbx), %rsi
movq 0x3cf4(%rip), %rdi      # 0x7fd0
callq 0x20b0
movq %rax, %r15
leaq 0xf2f(%rip), %rsi       # 0x521a
movl $0x8, %edx
movq %rax, %rdi
callq 0x2160
movq %r15, %rdi
movq %r14, %rsi
callq 0x20b0
movq %rax, %r15
leaq 0x131d(%rip), %rsi      # 0x562a
movl $0x6, %edx
movq %rax, %rdi
callq 0x2160
leaq 0x1310(%rip), %rax      # 0x5631
leaq 0x130f(%rip), %rsi      # 0x5637
testb %bpl, %bpl
cmovneq %rax, %rsi
movl $0x5, %edx
movq %r15, %rdi
callq 0x2160
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2120
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
btsq $0x21, %r14
addq $0x60, %rbx
leaq 0x20(%rsp), %rsi
movq %r14, (%rsi)
movq %rbx, %rdi
callq 0x4854
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x438f
callq 0x2110
movb $0x1, %al
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x28(%r13), %rax
movzwl (%r15), %ecx
cmpw %cx, 0xa(%rax)
sete %al
cmpl $0x1fff, %ecx           # imm = 0x1FFF
sete %cl
orb %al, %cl
jne 0x438f
movq 0x3c0a(%rip), %r14      # 0x7fd0
leaq 0xfe0(%rip), %rsi       # 0x53ad
movl $0xf, %edx
movq %r14, %rdi
callq 0x2160
movq 0x90(%rbx), %rsi
movq %r14, %rdi
callq 0x20b0
movq %rax, %rbx
leaq 0xe27(%rip), %rsi       # 0x521a
movl $0x8, %edx
movq %rax, %rdi
callq 0x2160
movzwl %r12w, %esi
movq %rbx, %rdi
callq 0x20b0
movq %rax, %rbx
leaq 0x1071(%rip), %rsi      # 0x5487
movl $0x9, %edx
movq %rax, %rdi
callq 0x2160
movq 0x28(%r13), %rax
movzwl 0xa(%rax), %esi
movq %rbx, %rdi
callq 0x20b0
movq %rax, %rbx
leaq 0x1200(%rip), %rsi      # 0x563d
movl $0x15, %edx
movq %rax, %rdi
callq 0x2160
movzwl (%r15), %esi
movq %rbx, %rdi
callq 0x20b0
movq %rax, %rbx
movq (%rax), %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
movq 0x28(%r13), %rax
movzwl (%r15), %ecx
movw %cx, 0xa(%rax)
jmp 0x438f
jmp 0x44c5
jmp 0x44c5
movq %rax, %rbx
movq %r13, %rdi
callq 0x2110
jmp 0x44c8
movq %rax, %rbx
movq 0x3b0c(%rip), %rsi      # 0x7fb8
leaq 0x20(%rsp), %rdi
callq 0x20f0
leaq 0xa0(%rsp), %rdi
callq 0x2060
jmp 0x44db
movq %rax, %rbx
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x44db
callq 0x2110
movq %rbx, %rdi
callq 0x21f0