// File: /workspace/github_cpp_makefile_star2_O1/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, %r14
movl %esi, %r12d
movq %rdi, %rbx
movq 0x40(%rdi), %rdx
leaq 0x38(%rdi), %rax
movq %rax, %rcx
testq %rdx, %rdx
je 0x42c0
movq %rax, %rcx
xorl %esi, %esi
cmpw %r12w, 0x20(%rdx)
setb %sil
cmovaeq %rdx, %rcx
movq 0x10(%rdx,%rsi,8), %rdx
testq %rdx, %rdx
jne 0x42a7
movq %rax, %r13
cmpq %rax, %rcx
je 0x42d4
cmpw %r12w, 0x20(%rcx)
cmovaq %rax, %rcx
movq %rcx, %r13
cmpq %rax, %r13
je 0x43cf
movq 0x28(%r13), %rax
movzwl (%r14), %ecx
cmpw %cx, 0xa(%rax)
sete %al
cmpl $0x1fff, %ecx           # imm = 0x1FFF
sete %cl
orb %al, %cl
jne 0x462c
movq 0x3ccc(%rip), %r15      # 0x7fd0
leaq 0x10a6(%rip), %rsi      # 0x53b1
movl $0xf, %edx
movq %r15, %rdi
callq 0x2170
movq 0x90(%rbx), %rsi
movq %r15, %rdi
callq 0x20c0
movq %rax, %rbx
leaq 0xeed(%rip), %rsi       # 0x521e
movl $0x8, %edx
movq %rax, %rdi
callq 0x2170
movzwl %r12w, %esi
movq %rbx, %rdi
callq 0x20c0
movq %rax, %rbx
leaq 0x1137(%rip), %rsi      # 0x548b
movl $0x9, %edx
movq %rax, %rdi
callq 0x2170
movq 0x28(%r13), %rax
movzwl 0xa(%rax), %esi
movq %rbx, %rdi
callq 0x20c0
movq %rax, %rbx
leaq 0x12c6(%rip), %rsi      # 0x5641
movl $0x15, %edx
movq %rax, %rdi
callq 0x2170
movzwl (%r14), %esi
movq %rbx, %rdi
callq 0x20c0
movq %rax, %rbx
movq (%rax), %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
movq 0x28(%r13), %rax
movzwl (%r14), %ecx
movw %cx, 0xa(%rax)
jmp 0x462c
leaq 0x20(%rsp), %rdi
callq 0x20f0
leaq 0x30(%rsp), %r13
leaq 0x1272(%rip), %rax      # 0x5657
leaq 0x1271(%rip), %rsi      # 0x565d
testb %bpl, %bpl
cmovneq %rax, %rsi
movl $0x5, %edx
movq %r13, %rdi
callq 0x2170
leaq 0x125c(%rip), %rsi      # 0x5663
movl $0x4, %edx
movq %r13, %rdi
callq 0x2170
movzwl %r12w, %r15d
movq %r13, %rdi
movq %r15, %rsi
callq 0x20c0
leaq 0x38(%rsp), %rsi
movq %rsp, %rdi
callq 0x21d0
movq 0x3b81(%rip), %rsi      # 0x7fb8
leaq 0x20(%rsp), %rdi
callq 0x2100
leaq 0xa0(%rsp), %rdi
callq 0x2060
movl $0x10, %edi
callq 0x2150
movq %rax, %r13
movq (%rsp), %rsi
movzwl (%r14), %ecx
movq %rax, %rdi
movl %r15d, %edx
callq 0x283c
leaq 0x30(%rbx), %rdi
leaq 0x20(%rsp), %rsi
movw %r12w, (%rsi)
movq %r13, 0x8(%rsi)
callq 0x4a96
cmpb $0x1, 0x98(%rbx)
jne 0x4553
movq 0x3b38(%rip), %rdi      # 0x7fd0
leaq 0x1124(%rip), %rsi      # 0x55c3
movl $0xc, %edx
callq 0x2170
movq 0x90(%rbx), %rsi
movq 0x3b19(%rip), %rdi      # 0x7fd0
callq 0x20c0
movq %rax, %r12
leaq 0xd58(%rip), %rsi       # 0x521e
movl $0x8, %edx
movq %rax, %rdi
callq 0x2170
movq %r12, %rdi
movq %r15, %rsi
callq 0x20c0
movq %rax, %r12
leaq 0xfa3(%rip), %rsi       # 0x548b
movl $0x9, %edx
movq %rax, %rdi
callq 0x2170
movzwl (%r14), %esi
movq %r12, %rdi
callq 0x20c0
movq %rax, %r14
leaq 0x1123(%rip), %rsi      # 0x562e
movl $0x6, %edx
movq %rax, %rdi
callq 0x2170
leaq 0x1116(%rip), %rax      # 0x5635
leaq 0x1115(%rip), %rsi      # 0x563b
testb %bpl, %bpl
cmovneq %rax, %rsi
movl $0x5, %edx
movq %r14, %rdi
callq 0x2170
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2130
jmp 0x45ed
movq 0x3a76(%rip), %rdi      # 0x7fd0
leaq 0x1062(%rip), %rsi      # 0x55c3
movl $0xc, %edx
callq 0x2170
movq 0x90(%rbx), %rsi
movq 0x3a57(%rip), %rdi      # 0x7fd0
callq 0x20c0
movq %rax, %r14
leaq 0xc96(%rip), %rsi       # 0x521e
movl $0x8, %edx
movq %rax, %rdi
callq 0x2170
movq %r14, %rdi
movq %r15, %rsi
callq 0x20c0
movq %rax, %r14
leaq 0x1084(%rip), %rsi      # 0x562e
movl $0x6, %edx
movq %rax, %rdi
callq 0x2170
leaq 0x1077(%rip), %rax      # 0x5635
leaq 0x1076(%rip), %rsi      # 0x563b
testb %bpl, %bpl
cmovneq %rax, %rsi
movl $0x5, %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
btsq $0x21, %r15
addq $0x60, %rbx
leaq 0x20(%rsp), %rsi
movq %r15, (%rsi)
movq %rbx, %rdi
callq 0x4a04
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x462c
callq 0x2120
movb $0x1, %al
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4674
jmp 0x4674
movq %rax, %rbx
movq %r13, %rdi
callq 0x2120
jmp 0x4677
movq %rax, %rbx
movq 0x395d(%rip), %rsi      # 0x7fb8
leaq 0x20(%rsp), %rdi
callq 0x2100
leaq 0xa0(%rsp), %rdi
callq 0x2060
jmp 0x468a
movq %rax, %rbx
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x468a
callq 0x2120
movq %rbx, %rdi
callq 0x2200