// File: /workspace/github_cpp_makefile_star2_O1/mmoanis[P]mpegts_demux/MpegTsDemux.cpp
// Function: MpegTsDemuxer::RegisterProgram(unsigned short, unsigned short)
void MpegTsDemuxer::RegisterProgram(PID id, PID pid)
{
    assert(id != MPEGTS_PID_NULL);

    Programs::iterator p = m_programs.find(id);
    if (p == m_programs.end()) {
        cout << "[INFO]: PKT#" << m_pnum << " PROGRAM=" << id << " PMT=" << pid << endl;

        Program P;
        P.id = id;
        P.pid = pid;
        m_programs.insert(make_pair(id, P));

        // expect packet for PMT
        m_filters.insert( make_pair(pid, DEMUXER_EVENT_PMT) );
    } else {
        if (p->second.pid != pid) {
            // Support updating program information
            cout << "[WARNING]: PKT#" << m_pnum << " PROGRAM=" << id << " PMT=" << p->second.pid << " appeared with PMT=" << pid <<  endl;
            p->second.pid = pid;

            // expect packet for PMT
            m_filters.insert( make_pair(pid, DEMUXER_EVENT_PMT) );
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
cmpl $0x1fff, %esi           # imm = 0x1FFF
je 0x3fe6
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, %rbx
movq 0x10(%rdi), %rdx
leaq 0x8(%rdi), %rax
movq %rax, %rcx
testq %rdx, %rdx
je 0x3df2
movq %rax, %rcx
xorl %esi, %esi
cmpw %r14w, 0x20(%rdx)
setb %sil
cmovaeq %rdx, %rcx
movq 0x10(%rdx,%rsi,8), %rdx
testq %rdx, %rdx
jne 0x3dd9
movq %rax, %r12
cmpq %rax, %rcx
je 0x3e06
cmpw %r14w, 0x20(%rcx)
cmovaq %rax, %rcx
movq %rcx, %r12
cmpq %rax, %r12
je 0x3ef9
cmpw %bp, 0x24(%r12)
je 0x3fd9
movq 0x41ae(%rip), %r15      # 0x7fd0
leaq 0x1588(%rip), %rsi      # 0x53b1
movl $0xf, %edx
movq %r15, %rdi
callq 0x2170
movq 0x90(%rbx), %rsi
movq %r15, %rdi
callq 0x20c0
movq %rax, %r15
leaq 0x163c(%rip), %rsi      # 0x548b
movl $0x9, %edx
movq %rax, %rdi
callq 0x2170
movzwl %r14w, %esi
movq %r15, %rdi
callq 0x20c0
movq %rax, %r14
leaq 0x176c(%rip), %rsi      # 0x55de
movl $0x5, %edx
movq %rax, %rdi
callq 0x2170
movzwl 0x24(%r12), %esi
movq %r14, %rdi
callq 0x20c0
movq %rax, %r15
leaq 0x1739(%rip), %rsi      # 0x55d0
movl $0x13, %edx
movq %rax, %rdi
callq 0x2170
movzwl %bp, %r14d
movq %r15, %rdi
movq %r14, %rsi
callq 0x20c0
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
movw %r14w, 0x24(%r12)
addq $0x60, %rbx
btsq $0x20, %r14
leaq 0x8(%rsp), %rsi
movq %r14, (%rsi)
jmp 0x3fd1
movq 0x40d0(%rip), %r15      # 0x7fd0
leaq 0x16bc(%rip), %rsi      # 0x55c3
movl $0xc, %edx
movq %r15, %rdi
callq 0x2170
movq 0x90(%rbx), %rsi
movq %r15, %rdi
callq 0x20c0
movq %rax, %r15
leaq 0x155e(%rip), %rsi      # 0x548b
movl $0x9, %edx
movq %rax, %rdi
callq 0x2170
movzwl %r14w, %r14d
movq %r15, %rdi
movq %r14, %rsi
callq 0x20c0
movq %rax, %r12
leaq 0x168b(%rip), %rsi      # 0x55de
movl $0x5, %edx
movq %rax, %rdi
callq 0x2170
movzwl %bp, %r15d
movq %r12, %rdi
movq %r15, %rsi
callq 0x20c0
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %r12, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
movl %ebp, %eax
shll $0x10, %eax
orl %r14d, %eax
shlq $0x10, %rax
orq %r14, %rax
leaq 0x8(%rsp), %r14
movw %bp, 0x4(%r14)
movl %eax, (%r14)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x48c0
addq $0x60, %rbx
btsq $0x20, %r15
movq %r15, (%r14)
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x4a04
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1592(%rip), %rdi      # 0x557f
leaq 0x11e8(%rip), %rsi      # 0x51dc
leaq 0x159a(%rip), %rcx      # 0x5595
movl $0x1d1, %edx            # imm = 0x1D1
callq 0x20b0
nop