// File: /workspace/github_c_makefile_star2_O0/videolan[P]bitstream/examples/mpeg_print_pcr.c
// Function: handle_psi_packet
static void handle_psi_packet(uint8_t *p_ts)
{
    uint16_t i_pid = ts_get_pid(p_ts);
    ts_pid_t *p_pid = &p_pids[i_pid];
    uint8_t i_cc = ts_get_cc(p_ts);
    const uint8_t *p_payload;
    uint8_t i_length;

    if (ts_check_duplicate(i_cc, p_pid->i_last_cc) || !ts_has_payload(p_ts))
        return;

    if (p_pid->i_last_cc != -1
          && ts_check_discontinuity(i_cc, p_pid->i_last_cc))
        psi_assemble_reset(&p_pid->p_psi_buffer, &p_pid->i_psi_buffer_used);

    p_payload = ts_section(p_ts);
    i_length = p_ts + TS_SIZE - p_payload;

    if (!psi_assemble_empty(&p_pid->p_psi_buffer, &p_pid->i_psi_buffer_used)) {
        uint8_t *p_section = psi_assemble_payload(&p_pid->p_psi_buffer,
                                                  &p_pid->i_psi_buffer_used,
                                                  &p_payload, &i_length);
        if (p_section != NULL)
            handle_section(i_pid, p_section);
    }

    p_payload = ts_next_section( p_ts );
    i_length = p_ts + TS_SIZE - p_payload;

    while (i_length) {
        uint8_t *p_section = psi_assemble_payload(&p_pid->p_psi_buffer,
                                                  &p_pid->i_psi_buffer_used,
                                                  &p_payload, &i_length);
        if (p_section != NULL)
            handle_section(i_pid, p_section);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x14b0
movw %ax, -0xa(%rbp)
movzwl -0xa(%rbp), %eax
movl %eax, %ecx
leaq 0x3baa(%rip), %rax      # 0x50b0
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1660
movb %al, -0x19(%rbp)
movb -0x19(%rbp), %cl
movq -0x18(%rbp), %rax
movzbl %cl, %edi
movzbl 0x4(%rax), %esi
callq 0x1680
testb $0x1, %al
jne 0x1541
movq -0x8(%rbp), %rdi
callq 0x16b0
testb $0x1, %al
jne 0x1546
jmp 0x1656
movq -0x18(%rbp), %rax
movsbl 0x4(%rax), %eax
cmpl $-0x1, %eax
je 0x1581
movb -0x19(%rbp), %cl
movq -0x18(%rbp), %rax
movzbl %cl, %edi
movzbl 0x4(%rax), %esi
callq 0x16e0
testb $0x1, %al
jne 0x156c
jmp 0x1581
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
movq -0x18(%rbp), %rsi
addq $0x10, %rsi
callq 0x1710
movq -0x8(%rbp), %rdi
callq 0x1740
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
addq $0xbc, %rax
movq -0x28(%rbp), %rcx
subq %rcx, %rax
movb %al, -0x29(%rbp)
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
movq -0x18(%rbp), %rsi
addq $0x10, %rsi
callq 0x1790
testb $0x1, %al
jne 0x15f5
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
movq -0x18(%rbp), %rsi
addq $0x10, %rsi
leaq -0x28(%rbp), %rdx
leaq -0x29(%rbp), %rcx
callq 0x17b0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x15f3
movw -0xa(%rbp), %ax
movq -0x38(%rbp), %rsi
movzwl %ax, %edi
callq 0x1950
jmp 0x15f5
movq -0x8(%rbp), %rdi
callq 0x19e0
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
addq $0xbc, %rax
movq -0x28(%rbp), %rcx
subq %rcx, %rax
movb %al, -0x29(%rbp)
cmpb $0x0, -0x29(%rbp)
je 0x1656
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
movq -0x18(%rbp), %rsi
addq $0x10, %rsi
leaq -0x28(%rbp), %rdx
leaq -0x29(%rbp), %rcx
callq 0x17b0
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x1654
movw -0xa(%rbp), %ax
movq -0x40(%rbp), %rsi
movzwl %ax, %edi
callq 0x1950
jmp 0x1616
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)