// File: /workspace/github_c_makefile_star2_O3/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 $0xd8, %rsp
movq 0x8(%rsi), %rdi
testq %rdi, %rdi
je 0x1282
movq %rsi, %rbx
cmpb $0x2d, (%rdi)
jne 0x126e
cmpb $0x68, 0x1(%rdi)
jne 0x126e
cmpb $0x0, 0x2(%rdi)
je 0x1635
leaq 0x1d8f(%rip), %rsi      # 0x3004
callq 0x1080
testl %eax, %eax
je 0x1635
movq 0x3d47(%rip), %rax      # 0x4fd0
movq (%rax), %rdi
xorl %esi, %esi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x10f0
leaq 0x3e0f(%rip), %rbx      # 0x50b0
movl $0x30000, %edx          # imm = 0x30000
movq %rbx, %rdi
xorl %esi, %esi
callq 0x1070
movl $0x10, %eax
movb $-0x1, -0xc(%rax,%rbx)
movq $0x0, -0x8(%rax,%rbx)
movw $0x0, (%rax,%rbx)
addq $0x18, %rax
cmpq $0x30010, %rax          # imm = 0x30010
jne 0x12b5
movl $0x1, 0x3dd1(%rip)      # 0x50b0
movq 0x3cf2(%rip), %r14      # 0x4fd8
movq (%r14), %rdi
callq 0x10a0
testl %eax, %eax
jne 0x161e
leaq 0x10(%rsp), %r12
movq (%r14), %r15
movq %r15, %rdi
callq 0x1040
testl %eax, %eax
jne 0x161e
movl $0xbc, %esi
movl $0x1, %edx
movq %r12, %rdi
movq %r15, %rcx
callq 0x1050
cmpq $0x1, %rax
jne 0x160e
cmpb $0x47, 0x10(%rsp)
jne 0x160e
movzbl 0x11(%rsp), %ecx
movzbl 0x12(%rsp), %eax
movl %ecx, %r15d
andl $0x1f, %r15d
shll $0x8, %r15d
orq %rax, %r15
leaq (%r15,%r15,2), %rax
leaq (%rbx,%rax,8), %r14
cmpl $0x0, (%r14)
je 0x15f8
movb 0x13(%rsp), %al
movl %eax, %esi
andb $0xf, %sil
movzbl 0x4(%r14), %edx
cmpb %sil, %dl
sete %sil
testb $0x10, %al
sete %dil
orb %sil, %dil
jne 0x15f8
cmpl $0xff, %edx
je 0x13c2
movzbl %al, %esi
subl %esi, %edx
incl %edx
testb $0xf, %dl
je 0x13c2
movq 0x8(%r14), %rdi
callq 0x1030
movq $0x0, 0x8(%r14)
movw $0x0, 0x10(%r14)
movb 0x11(%rsp), %cl
movb 0x13(%rsp), %al
testb $0x10, %al
sete %dl
jmp 0x13c4
xorl %edx, %edx
testb $0x40, %cl
leaq 0xcc(%rsp), %r8
movq %r8, %rsi
jne 0x13f0
testb %dl, %dl
jne 0x140d
leaq 0x14(%rsp), %rsi
testb $0x20, %al
je 0x140d
movzbl 0x14(%rsp), %esi
leaq 0x15(%rsp), %rax
addq %rax, %rsi
jmp 0x140d
testb %dl, %dl
jne 0x140a
leaq 0x14(%rsp), %rsi
testb $0x20, %al
je 0x140a
movzbl 0x14(%rsp), %esi
leaq 0x15(%rsp), %rax
addq %rax, %rsi
incq %rsi
movq 0x8(%r14), %rdi
movzwl %r15w, %eax
movl %eax, 0xc(%rsp)
testq %rdi, %rdi
je 0x14cc
movl %r8d, %eax
subl %esi, %eax
movzwl 0x10(%r14), %ecx
movl $0x1000, %edx           # imm = 0x1000
subl %ecx, %edx
movzbl %al, %eax
cmpw %ax, %dx
cmovael %eax, %edx
addq %rcx, %rdi
movzwl %dx, %r15d
movq %r15, %rdx
callq 0x10b0
leaq 0xcc(%rsp), %r8
addw 0x10(%r14), %r15w
movw %r15w, 0x10(%r14)
cmpw $0x3, %r15w
jb 0x14cc
movq 0x8(%r14), %rsi
movzbl 0x1(%rsi), %eax
movzbl 0x2(%rsi), %ecx
andl $0xf, %eax
shll $0x8, %eax
orl %ecx, %eax
cmpl $0xffa, %eax            # imm = 0xFFA
ja 0x14ad
movzwl %ax, %eax
addl $0x3, %eax
cmpw %r15w, %ax
ja 0x14cc
movq $0x0, 0x8(%r14)
movw $0x0, 0x10(%r14)
movl 0xc(%rsp), %edi
callq 0x163d
leaq 0xcc(%rsp), %r8
jmp 0x14cc
movq %rsi, %rdi
callq 0x1030
leaq 0xcc(%rsp), %r8
movq $0x0, 0x8(%r14)
movw $0x0, 0x10(%r14)
testb $0x40, 0x11(%rsp)
je 0x14e0
movb 0x13(%rsp), %cl
testb $0x10, %cl
jne 0x15af
movq %r8, %r15
movl %r8d, %ebp
subl %r15d, %ebp
testb %bpl, %bpl
je 0x15f8
movzwl 0x10(%r14), %r12d
movl $0x1000, %r13d          # imm = 0x1000
subl %r12d, %r13d
movzbl %bpl, %eax
cmpw %ax, %r13w
cmovael %eax, %r13d
movq 0x8(%r14), %rdi
testq %rdi, %rdi
jne 0x1530
cmpb $-0x1, (%r15)
je 0x15f8
movl $0x1000, %edi           # imm = 0x1000
callq 0x10c0
movq %rax, %rdi
movq %rax, 0x8(%r14)
addq %r12, %rdi
movzwl %r13w, %r12d
movq %r15, %rsi
movq %r12, %rdx
callq 0x10b0
movl 0x10(%r14), %eax
leal (%rax,%r13), %ecx
movw %cx, 0x10(%r14)
cmpw $0x3, %cx
jb 0x15a1
movq 0x8(%r14), %rsi
movzbl 0x1(%rsi), %edx
movzbl 0x2(%rsi), %edi
andl $0xf, %edx
shll $0x8, %edx
leal (%rdx,%rdi), %r8d
cmpl $0xffa, %r8d            # imm = 0xFFA
ja 0x15e1
addl %edi, %edx
addl $0x3, %edx
cmpw %cx, %dx
ja 0x15a1
movzwl %dx, %r13d
subl %eax, %r13d
movq $0x0, 0x8(%r14)
movw $0x0, 0x10(%r14)
movzwl %r13w, %r12d
movl 0xc(%rsp), %edi
callq 0x163d
addq %r12, %r15
subb %r13b, %bpl
jne 0x14f2
jmp 0x15f8
leaq 0x14(%rsp), %rax
testb $0x20, %cl
je 0x15d2
movzbl 0x14(%rsp), %eax
cmpq $0xb6, %rax
ja 0x14e0
leaq 0x15(%rsp), %rcx
addq %rcx, %rax
movzbl (%rax), %ecx
leaq (%rax,%rcx), %r15
incq %r15
jmp 0x14e3
movq %rsi, %rdi
callq 0x1030
movq $0x0, 0x8(%r14)
movw $0x0, 0x10(%r14)
movb 0x13(%rsp), %al
andb $0xf, %al
movb %al, 0x4(%r14)
movq 0x39cf(%rip), %r14      # 0x4fd8
leaq 0x10(%rsp), %r12
movq (%r14), %rdi
callq 0x10a0
testl %eax, %eax
je 0x12fb
movl $0x1, %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
callq 0x1120