// File: /workspace/github_c_makefile_star2_O2/videolan[P]bitstream/examples/mpeg_print_pcr.c
// Function: main
int main(int i_argc, char **ppsz_argv)
{
    int i;

    if (ppsz_argv[1] != NULL &&
        (!strcmp(ppsz_argv[1], "-h") || !strcmp(ppsz_argv[1], "--help")))
        usage(ppsz_argv[0]);

    setvbuf(stdout, NULL, _IOLBF, 0);

    memset(p_pids, 0, sizeof(p_pids));

    for (i = 0; i < 8192; i++) {
        p_pids[i].i_last_cc = -1;
        psi_assemble_init( &p_pids[i].p_psi_buffer,
                           &p_pids[i].i_psi_buffer_used );
    }

    p_pids[PAT_PID].i_psi_refcount++;

    while (!feof(stdin) && !ferror(stdin)) {
        uint8_t p_ts[TS_SIZE];
        size_t i_ret = fread(p_ts, sizeof(p_ts), 1, stdin);
        if (i_ret != 1) continue;
        if (ts_validate(p_ts)) {
            uint16_t i_pid = ts_get_pid(p_ts);
            ts_pid_t *p_pid = &p_pids[i_pid];
            if (p_pid->i_psi_refcount)
                handle_psi_packet(p_ts);
            p_pid->i_last_cc = ts_get_cc(p_ts);
        }
    }

    return EXIT_FAILURE;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movq 0x8(%rsi), %rdi
testq %rdi, %rdi
je 0x1252
movq %rsi, %rbx
cmpb $0x2d, (%rdi)
jne 0x123e
cmpb $0x68, 0x1(%rdi)
jne 0x123e
cmpb $0x0, 0x2(%rdi)
je 0x1487
leaq 0xdbf(%rip), %rsi       # 0x2004
callq 0x1080
testl %eax, %eax
je 0x1487
movq 0x2d77(%rip), %rax      # 0x3fd0
movq (%rax), %rdi
pushq $0x1
popq %rdx
xorl %esi, %esi
xorl %ecx, %ecx
callq 0x10f0
leaq 0x2e41(%rip), %rbx      # 0x40b0
movl $0x30000, %edx          # imm = 0x30000
movq %rbx, %rdi
xorl %esi, %esi
callq 0x1070
pushq $0x10
popq %rax
cmpq $0x30010, %rax          # imm = 0x30010
je 0x129f
movb $-0x1, -0xc(%rax,%rbx)
andq $0x0, -0x8(%rax,%rbx)
andw $0x0, (%rax,%rbx)
addq $0x18, %rax
jmp 0x1281
movl $0x1, 0x2e07(%rip)      # 0x40b0
movq 0x2d28(%rip), %rbp      # 0x3fd8
pushq $0x1
popq %r15
leaq 0x18(%rsp), %r12
leaq 0xf(%rsp), %r13
movq (%rbp), %rdi
callq 0x10a0
testl %eax, %eax
jne 0x1472
movq (%rbp), %r14
movq %r14, %rdi
callq 0x1040
testl %eax, %eax
jne 0x1472
movl $0xbc, %esi
leaq 0x20(%rsp), %rdi
movq %r15, %rdx
movq %r14, %rcx
callq 0x1050
cmpq $0x1, %rax
jne 0x12be
cmpb $0x47, 0x20(%rsp)
jne 0x12be
movzbl 0x21(%rsp), %r15d
movl %r15d, %eax
andl $0x1f, %eax
shll $0x8, %eax
movzbl 0x22(%rsp), %r14d
orq %rax, %r14
imulq $0x18, %r14, %rax
leaq (%rbx,%rax), %rcx
cmpl $0x0, (%rax,%rbx)
movb 0x23(%rsp), %al
je 0x1464
testb $0x10, %al
je 0x1464
movl %eax, %edx
andb $0xf, %dl
movq %rcx, 0x10(%rsp)
movb 0x4(%rcx), %cl
cmpb %dl, %cl
je 0x145f
movzbl %cl, %ecx
cmpl $0xff, %ecx
je 0x137e
movzbl %al, %eax
subl %eax, %ecx
incl %ecx
testb $0xf, %cl
je 0x137e
movq 0x10(%rsp), %rax
leaq 0x8(%rax), %rdi
leaq 0x10(%rax), %rsi
callq 0x14aa
movb 0x21(%rsp), %r15b
leaq 0x20(%rsp), %rdi
callq 0x1bbd
movzbl %r15b, %ecx
btl $0x6, %ecx
adcq $0x0, %rax
movq %rax, 0x18(%rsp)
leaq 0xdc(%rsp), %rcx
subl %eax, %ecx
movb %cl, 0xf(%rsp)
movq 0x10(%rsp), %rax
leaq 0x8(%rax), %rbp
leaq 0x10(%rax), %r15
cmpq $0x0, 0x8(%rax)
movzwl %r14w, %r14d
je 0x13e0
movq %rbp, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r13, %rcx
callq 0x14cc
testq %rax, %rax
je 0x13e0
movl %r14d, %edi
movq %rax, %rsi
callq 0x15a5
testb $0x40, 0x21(%rsp)
jne 0x13f1
leaq 0xdc(%rsp), %rcx
jmp 0x141b
leaq 0x20(%rsp), %rdi
callq 0x1bbd
leaq 0xdc(%rsp), %rcx
cmpq %rcx, %rax
jae 0x141b
movzbl (%rax), %ecx
addq %rcx, %rax
incq %rax
leaq 0xdc(%rsp), %rcx
jmp 0x141e
movq %rcx, %rax
movq %rax, 0x18(%rsp)
subl %eax, %ecx
movb %cl, 0xf(%rsp)
testb %cl, %cl
je 0x1454
movq %rbp, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r13, %rcx
callq 0x14cc
testq %rax, %rax
je 0x144e
movl %r14d, %edi
movq %rax, %rsi
callq 0x15a5
movb 0xf(%rsp), %cl
jmp 0x1429
movb 0x23(%rsp), %al
movq 0x2b79(%rip), %rbp      # 0x3fd8
movq 0x10(%rsp), %rcx
pushq $0x1
popq %r15
andb $0xf, %al
movb %al, 0x4(%rcx)
jmp 0x12be
pushq $0x1
popq %rax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%rbx), %rdx
movq 0x2b67(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
leaq 0xb70(%rip), %rsi       # 0x200b
xorl %eax, %eax
callq 0x1090
pushq $0x1
popq %rdi
callq 0x1100