// File: /workspace/github_c_makefile_star2_O1/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), %r14
testq %r14, %r14
je 0x1287
movq %rsi, %rbx
leaq 0x1da4(%rip), %rsi      # 0x3004
movq %r14, %rdi
callq 0x1080
testl %eax, %eax
je 0x1630
leaq 0x1d90(%rip), %rsi      # 0x3007
movq %r14, %rdi
callq 0x1080
testl %eax, %eax
je 0x1630
movq 0x3d42(%rip), %rax      # 0x4fd0
movq (%rax), %rdi
xorl %esi, %esi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x10f0
leaq 0x3e0a(%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 0x12ba
incl 0x3dd0(%rip)            # 0x50b0
movq 0x3cf1(%rip), %r14      # 0x4fd8
movq (%r14), %rdi
callq 0x10a0
testl %eax, %eax
jne 0x1619
leaq 0x10(%rsp), %r12
movq (%r14), %r15
movq %r15, %rdi
callq 0x1040
testl %eax, %eax
jne 0x1619
movl $0xbc, %esi
movl $0x1, %edx
movq %r12, %rdi
movq %r15, %rcx
callq 0x1050
cmpq $0x1, %rax
jne 0x1609
cmpb $0x47, 0x10(%rsp)
jne 0x1609
movzbl 0x11(%rsp), %eax
andl $0x1f, %eax
shll $0x8, %eax
movzbl 0x12(%rsp), %r15d
orq %rax, %r15
leaq (%r15,%r15,2), %rax
leaq (%rbx,%rax,8), %r14
cmpl $0x0, (%r14)
je 0x15f3
movzbl 0x13(%rsp), %eax
movl %eax, %edx
andb $0xf, %dl
movzbl 0x4(%r14), %ecx
cmpb %dl, %cl
sete %dl
testb $0x10, %al
sete %sil
orb %dl, %sil
jne 0x15f3
cmpl $0xff, %ecx
je 0x13ab
subl %eax, %ecx
incl %ecx
testb $0xf, %cl
je 0x13ab
movq 0x8(%r14), %rdi
callq 0x1030
movq $0x0, 0x8(%r14)
movw $0x0, 0x10(%r14)
testb $0x40, 0x11(%rsp)
movb 0x13(%rsp), %al
leaq 0xcc(%rsp), %r13
movq %r13, %rsi
jne 0x13dd
testb $0x10, %al
je 0x13fa
leaq 0x14(%rsp), %rsi
testb $0x20, %al
je 0x13fa
movzbl 0x14(%rsp), %esi
leaq 0x15(%rsp), %rax
addq %rax, %rsi
jmp 0x13fa
testb $0x10, %al
je 0x13f7
leaq 0x14(%rsp), %rsi
testb $0x20, %al
je 0x13f7
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 0x14bf
movl %r13d, %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
addw 0x10(%r14), %r15w
movw %r15w, 0x10(%r14)
cmpw $0x3, %r15w
jb 0x147c
movq 0x8(%r14), %rsi
movzbl 0x1(%rsi), %ecx
andl $0xf, %ecx
shll $0x8, %ecx
movzbl 0x2(%rsi), %eax
orl %ecx, %eax
cmpl $0xffb, %eax            # imm = 0xFFB
jae 0x1488
movzwl %ax, %eax
addl $0x3, %eax
cmpw %r15w, %ax
leaq 0xcc(%rsp), %r13
jbe 0x149a
xorl %esi, %esi
jmp 0x14a9
xorl %esi, %esi
leaq 0xcc(%rsp), %r13
jmp 0x14a9
movq %rsi, %rdi
callq 0x1030
xorl %esi, %esi
leaq 0xcc(%rsp), %r13
movq $0x0, 0x8(%r14)
movw $0x0, 0x10(%r14)
testq %rsi, %rsi
je 0x14bf
movl 0xc(%rsp), %edi
callq 0x1638
leaq 0xcc(%rsp), %r13
testb $0x40, 0x11(%rsp)
movq %r13, %r15
je 0x1509
movb 0x13(%rsp), %cl
movl $0xbc, %eax
testb $0x10, %cl
je 0x14ea
movl $0x4, %eax
testb $0x20, %cl
je 0x14ea
movzbl 0x14(%rsp), %eax
addq $0x5, %rax
movq %r13, %r15
cmpq $0xbb, %rax
jg 0x1509
leaq (%rsp,%rax), %rcx
addq $0x10, %rcx
movzbl 0x10(%rsp,%rax), %eax
leaq (%rax,%rcx), %r15
incq %r15
subl %r15d, %r13d
testb %r13b, %r13b
je 0x15f3
movzwl 0x10(%r14), %r12d
movl $0x1000, %ebp           # imm = 0x1000
subl %r12d, %ebp
movzbl %r13b, %eax
cmpw %ax, %bp
cmovael %eax, %ebp
cmpq $0x0, 0x8(%r14)
jne 0x1547
cmpb $-0x1, (%r15)
je 0x15ab
movl $0x1000, %edi           # imm = 0x1000
callq 0x10c0
movq %rax, 0x8(%r14)
addq 0x8(%r14), %r12
movzwl %bp, %edx
movq %r12, %rdi
movq %r15, %rsi
callq 0x10b0
movl 0x10(%r14), %eax
leal (%rax,%rbp), %ecx
movw %cx, 0x10(%r14)
cmpw $0x3, %cx
jb 0x1598
movq 0x8(%r14), %rsi
movzbl 0x1(%rsi), %edx
andl $0xf, %edx
shll $0x8, %edx
movzbl 0x2(%rsi), %edi
leal (%rdx,%rdi), %r12d
cmpl $0xffb, %r12d           # imm = 0xFFB
jae 0x159c
addl %edi, %edx
addl $0x3, %edx
cmpw %cx, %dx
jbe 0x15b0
xorl %esi, %esi
jmp 0x15c4
xorl %esi, %esi
jmp 0x15cf
movq %rsi, %rdi
callq 0x1030
xorl %r13d, %r13d
xorl %esi, %esi
jmp 0x15b5
xorl %r13d, %r13d
jmp 0x15da
movzwl %dx, %ebp
subl %eax, %ebp
movq $0x0, 0x8(%r14)
movw $0x0, 0x10(%r14)
movzwl %r12w, %eax
cmpl $0xffa, %eax            # imm = 0xFFA
ja 0x15da
movzwl %bp, %eax
addq %rax, %r15
subb %bpl, %r13b
jmp 0x15dc
xorl %esi, %esi
testq %rsi, %rsi
je 0x150c
movl 0xc(%rsp), %edi
callq 0x1638
jmp 0x150c
movb 0x13(%rsp), %al
andb $0xf, %al
movb %al, 0x4(%r14)
movq 0x39d4(%rip), %r14      # 0x4fd8
leaq 0x10(%rsp), %r12
movq (%r14), %rdi
callq 0x10a0
testl %eax, %eax
je 0x12fc
movl $0x1, %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
callq 0x1120