// File: /workspace/github_c_makefile_star2_O0/videolan[P]bitstream/examples/dvb_print_si.c
// Function: handle_pmt
static void handle_pmt(uint16_t i_pid, uint8_t *p_pmt)
{
    uint16_t i_sid = pmt_get_program(p_pmt);
    sid_t *p_sid;
    int i;

    /* we do this before checking the service ID */
    if (!pmt_validate(p_pmt)) {
        switch (i_print_type) {
        case PRINT_XML:
            printf("<ERROR type=\"invalid_pmt_section\" pid=\"%hu\"/>\n",
                   i_pid);
            break;
        default:
            printf("invalid PMT section received on PID %hu\n", i_pid);
        }
        free(p_pmt);
        return;
    }

    for (i = 0; i < i_nb_sids; i++)
        if (pp_sids[i]->i_sid && pp_sids[i]->i_sid == i_sid)
            break;

    if (i == i_nb_sids) {
        switch (i_print_type) {
        case PRINT_XML:
            printf("<ERROR type=\"ghost_pmt\" program=\"%hu\" pid=\"%hu\"/>\n",
                   i_sid, i_pid);
            break;
        default:
            printf("ghost PMT for service %hu carried on PID %hu\n", i_sid,
                   i_pid);
        }
        p_sid = malloc(sizeof(sid_t));
        pp_sids = realloc(pp_sids, ++i_nb_sids * sizeof(sid_t *));
        pp_sids[i] = p_sid;
        p_sid->i_sid = i_sid;
        p_sid->i_pmt_pid = i_pid;
        p_sid->p_current_pmt = NULL;
        psi_table_init(p_sid->pp_eit_sections);
    } else {
        p_sid = pp_sids[i];
        if (i_pid != p_sid->i_pmt_pid) {
            switch (i_print_type) {
            case PRINT_XML:
                printf("<ERROR type=\"ghost_pmt\" program=\"%hu\" pid=\"%hu\"/>\n",
                       i_sid, i_pid);
                break;
            default:
                printf("ghost PMT for service %hu carried on PID %hu\n", i_sid,
                       i_pid);
            }
        }
    }

    if (p_sid->p_current_pmt != NULL &&
        psi_compare(p_sid->p_current_pmt, p_pmt)) {
        /* Identical PMT. Shortcut. */
        free(p_pmt);
        return;
    }

    if (p_sid->p_current_pmt)
        handle_pmt_es(p_sid->p_current_pmt, false);

    free(p_sid->p_current_pmt);
    p_sid->p_current_pmt = p_pmt;
    handle_pmt_es(p_pmt, true);

    if (pb_print_table[TABLE_PMT])
        pmt_print(p_pmt, print_wrapper, NULL, iconv_wrapper, NULL,
                  i_print_type);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movw %di, %ax
movw %ax, -0x2(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x4b90
movw %ax, -0x12(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1c7e0
testb $0x1, %al
jne 0x37ae
movl 0x34b7d(%rip), %eax     # 0x382f0
subl $0x1, %eax
jne 0x378e
jmp 0x377a
movzwl -0x2(%rbp), %esi
leaq 0x273da(%rip), %rdi     # 0x2ab5f
movb $0x0, %al
callq 0x20b0
jmp 0x37a0
movzwl -0x2(%rbp), %esi
leaq 0x273f5(%rip), %rdi     # 0x2ab8e
movb $0x0, %al
callq 0x20b0
movq -0x10(%rbp), %rdi
callq 0x2030
jmp 0x39c5
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl 0x69b62(%rip), %eax     # 0x6d320
jge 0x3800
movq 0x69b61(%rip), %rax     # 0x6d328
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movzwl (%rax), %eax
cmpl $0x0, %eax
je 0x37f3
movq 0x69b4a(%rip), %rax     # 0x6d328
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movzwl (%rax), %eax
movzwl -0x12(%rbp), %ecx
cmpl %ecx, %eax
jne 0x37f3
jmp 0x3800
jmp 0x37f5
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x37b5
movl -0x24(%rbp), %eax
cmpl 0x69b17(%rip), %eax     # 0x6d320
jne 0x38c6
movl 0x34adb(%rip), %eax     # 0x382f0
subl $0x1, %eax
jne 0x3834
jmp 0x381c
movzwl -0x12(%rbp), %esi
movzwl -0x2(%rbp), %edx
leaq 0x2738c(%rip), %rdi     # 0x2abb7
movb $0x0, %al
callq 0x20b0
jmp 0x384a
movzwl -0x12(%rbp), %esi
movzwl -0x2(%rbp), %edx
leaq 0x273a7(%rip), %rdi     # 0x2abea
movb $0x0, %al
callq 0x20b0
movl $0x810, %edi            # imm = 0x810
callq 0x2150
movq %rax, -0x20(%rbp)
movq 0x69ac9(%rip), %rdi     # 0x6d328
movl 0x69abb(%rip), %eax     # 0x6d320
addl $0x1, %eax
movl %eax, 0x69ab2(%rip)     # 0x6d320
movslq %eax, %rsi
shlq $0x3, %rsi
callq 0x2180
movq %rax, 0x69aa7(%rip)     # 0x6d328
movq -0x20(%rbp), %rdx
movq 0x69a9c(%rip), %rax     # 0x6d328
movslq -0x24(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movw -0x12(%rbp), %cx
movq -0x20(%rbp), %rax
movw %cx, (%rax)
movw -0x2(%rbp), %cx
movq -0x20(%rbp), %rax
movw %cx, 0x2(%rax)
movq -0x20(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x20(%rbp), %rdi
addq $0x10, %rdi
callq 0x2bb0
jmp 0x3928
movq 0x69a5b(%rip), %rax     # 0x6d328
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x20(%rbp)
movzwl -0x2(%rbp), %eax
movq -0x20(%rbp), %rcx
movzwl 0x2(%rcx), %ecx
cmpl %ecx, %eax
je 0x3926
movl 0x34a01(%rip), %eax     # 0x382f0
subl $0x1, %eax
jne 0x390e
jmp 0x38f6
movzwl -0x12(%rbp), %esi
movzwl -0x2(%rbp), %edx
leaq 0x272b2(%rip), %rdi     # 0x2abb7
movb $0x0, %al
callq 0x20b0
jmp 0x3924
movzwl -0x12(%rbp), %esi
movzwl -0x2(%rbp), %edx
leaq 0x272cd(%rip), %rdi     # 0x2abea
movb $0x0, %al
callq 0x20b0
jmp 0x3926
jmp 0x3928
movq -0x20(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x3955
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0x53d0
testb $0x1, %al
jne 0x394a
jmp 0x3955
movq -0x10(%rbp), %rdi
callq 0x2030
jmp 0x39c5
movq -0x20(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x396f
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
xorl %esi, %esi
callq 0x4f40
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x2030
movq -0x10(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x4f40
testb $0x1, 0x6996f(%rip)     # 0x6d30c
je 0x39c5
movq -0x10(%rbp), %rdi
movl 0x34946(%rip), %r9d     # 0x382f0
leaq 0x192f(%rip), %rsi      # 0x52e0
xorl %eax, %eax
movl %eax, %r8d
leaq 0x192e3(%rip), %rcx     # 0x1cca0
movq %r8, %rdx
callq 0x1c9a0
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)