#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int uint64_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int ntohl(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, unsigned int, int, ...);
int read(int /*<<< orphan*/, unsigned char *, int);
int main() {
  uint64_t pcr;
  unsigned int num = 0;
  unsigned char buffer[192];
  while (read(0, buffer, 192) == 192) {
    ++num;
    if ((buffer[7] & 0x20) && (buffer[8] >= 7) && (buffer[9] & 0x10)) {
      pcr = (buffer[10] << 25) | (buffer[11] << 17) | (buffer[12] << 9) |
            (buffer[13] << 1) | (buffer[14] >> 7);
      pcr *= 300;
      pcr += ((buffer[14] & 1) << 8) | buffer[15];
      printf("%d %d %lld (%lld)\n", num,
             ntohl(*(uint32_t *)buffer) & 0x3fffffff, pcr, pcr & 0x3fffffff);
    } else {
      printf("%d %d\n", num, ntohl(*(uint32_t *)buffer) & 0x3fffffff);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    -0xd0(%rbp),%rsi
xor    %edi,%edi
mov    $0xc0,%edx
call   1040 <read@plt>
cmp    $0xc0,%eax
jne    1281 <main+0x151>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
movzbl -0xc9(%rbp),%eax
and    $0x20,%eax
cmp    $0x0,%eax
je     124c <main+0x11c>
movzbl -0xc8(%rbp),%eax
cmp    $0x7,%eax
jl     124c <main+0x11c>
movzbl -0xc7(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     124c <main+0x11c>
movzbl -0xc6(%rbp),%eax
shl    $0x19,%eax
movzbl -0xc5(%rbp),%ecx
shl    $0x11,%ecx
or     %ecx,%eax
movzbl -0xc4(%rbp),%ecx
shl    $0x9,%ecx
or     %ecx,%eax
movzbl -0xc3(%rbp),%ecx
shl    $0x1,%ecx
or     %ecx,%eax
movzbl -0xc2(%rbp),%ecx
sar    $0x7,%ecx
or     %ecx,%eax
mov    %eax,-0x8(%rbp)
imul   $0x12c,-0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
movzbl -0xc2(%rbp),%eax
and    $0x1,%eax
shl    $0x8,%eax
movzbl -0xc1(%rbp),%ecx
or     %ecx,%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0xd4(%rbp)
mov    -0xd0(%rbp),%edi
call   1050 <ntohl@plt>
mov    -0xd4(%rbp),%esi
mov    %eax,%edx
and    $0x3fffffff,%edx
mov    -0x8(%rbp),%ecx
mov    -0x8(%rbp),%r8d
and    $0x3fffffff,%r8d
lea    0xdc0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    127c <main+0x14c>
mov    -0xc(%rbp),%eax
mov    %eax,-0xd8(%rbp)
mov    -0xd0(%rbp),%edi
call   1050 <ntohl@plt>
mov    -0xd8(%rbp),%esi
mov    %eax,%edx
and    $0x3fffffff,%edx
lea    0xd9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1149 <main+0x19>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xc0,%rsp
mov    %rsp,%rsi
xor    %edi,%edi
mov    $0xc0,%edx
call   1040 <read@plt>
cmp    $0xc0,%eax
jne    123e <main+0x10e>
mov    $0x1,%ebx
lea    0xe9b(%rip),%r14
lea    0xea7(%rip),%r15
mov    %rsp,%r12
jmp    11b8 <main+0x88>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%rsp),%edi
call   1050 <ntohl@plt>
and    $0x3fffffff,%eax
mov    %r15,%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %edi,%edi
mov    %r12,%rsi
mov    $0xc0,%edx
call   1040 <read@plt>
add    $0x1,%ebx
cmp    $0xc0,%eax
jne    123e <main+0x10e>
testb  $0x20,0x7(%rsp)
je     1180 <main+0x50>
cmpb   $0x7,0x8(%rsp)
jb     1180 <main+0x50>
testb  $0x10,0x9(%rsp)
je     1180 <main+0x50>
movzbl 0xa(%rsp),%eax
shl    $0x19,%eax
movzbl 0xb(%rsp),%ecx
shl    $0x11,%ecx
or     %eax,%ecx
movzbl 0xc(%rsp),%eax
shl    $0x9,%eax
or     %ecx,%eax
movzbl 0xd(%rsp),%ecx
lea    (%rax,%rcx,2),%eax
movzbl 0xe(%rsp),%ecx
mov    %ecx,%edx
shr    $0x7,%edx
or     %eax,%edx
imul   $0x12c,%edx,%eax
and    $0x1,%ecx
shl    $0x8,%ecx
movzbl 0xf(%rsp),%ebp
or     %ecx,%ebp
add    %eax,%ebp
mov    (%rsp),%edi
call   1050 <ntohl@plt>
and    $0x3fffffff,%eax
mov    %ebp,%r8d
and    $0x3fffffff,%r8d
mov    %r14,%rdi
mov    %ebx,%esi
mov    %eax,%edx
mov    %ebp,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
jmp    119b <main+0x6b>
xor    %eax,%eax
add    $0xc0,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [19 x i8] c"%d %d %lld (%lld)\0A\00"
@.str.1 = [7 x i8] c"%d %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [192 x i8]
store i32 0, i32* %1
store i32 0, i32* %3
br label %5
5: ; preds = %84, %0
%6 = getelementptr inbounds [192 x i8], [192 x i8]* %4, i64 0, i64 0
%7 = call i32 @read(i32 0, i8* %6, i32 192)
%8 = icmp eq i32 %7, 192
br i1 %8, label %9, label %85
9: ; preds = %5
%10 = load i32, i32* %3
%11 = add i32 %10, 1
store i32 %11, i32* %3
%12 = getelementptr inbounds [192 x i8], [192 x i8]* %4, i64 0, i64 7
%13 = load i8, i8* %12
%14 = zext i8 %13 to i32
%15 = and i32 %14, 32
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %76
17: ; preds = %9
%18 = getelementptr inbounds [192 x i8], [192 x i8]* %4, i64 0, i64 8
%19 = load i8, i8* %18
%20 = zext i8 %19 to i32
%21 = icmp sge i32 %20, 7
br i1 %21, label %22, label %76
22: ; preds = %17
%23 = getelementptr inbounds [192 x i8], [192 x i8]* %4, i64 0, i64 9
%24 = load i8, i8* %23
%25 = zext i8 %24 to i32
%26 = and i32 %25, 16
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %76
28: ; preds = %22
%29 = getelementptr inbounds [192 x i8], [192 x i8]* %4, i64 0, i64 10
%30 = load i8, i8* %29
%31 = zext i8 %30 to i32
%32 = shl i32 %31, 25
%33 = getelementptr inbounds [192 x i8], [192 x i8]* %4, i64 0, i64 11
%34 = load i8, i8* %33
%35 = zext i8 %34 to i32
%36 = shl i32 %35, 17
%37 = or i32 %32, %36
%38 = getelementptr inbounds [192 x i8], [192 x i8]* %4, i64 0, i64 12
%39 = load i8, i8* %38
%40 = zext i8 %39 to i32
%41 = shl i32 %40, 9
%42 = or i32 %37, %41
%43 = getelementptr inbounds [192 x i8], [192 x i8]* %4, i64 0, i64 13
%44 = load i8, i8* %43
%45 = zext i8 %44 to i32
%46 = shl i32 %45, 1
%47 = or i32 %42, %46
%48 = getelementptr inbounds [192 x i8], [192 x i8]* %4, i64 0, i64 14
%49 = load i8, i8* %48
%50 = zext i8 %49 to i32
%51 = ashr i32 %50, 7
%52 = or i32 %47, %51
store i32 %52, i32* %2
%53 = load i32, i32* %2
%54 = mul nsw i32 %53, 300
store i32 %54, i32* %2
%55 = getelementptr inbounds [192 x i8], [192 x i8]* %4, i64 0, i64 14
%56 = load i8, i8* %55
%57 = zext i8 %56 to i32
%58 = and i32 %57, 1
%59 = shl i32 %58, 8
%60 = getelementptr inbounds [192 x i8], [192 x i8]* %4, i64 0, i64 15
%61 = load i8, i8* %60
%62 = zext i8 %61 to i32
%63 = or i32 %59, %62
%64 = load i32, i32* %2
%65 = add nsw i32 %64, %63
store i32 %65, i32* %2
%66 = load i32, i32* %3
%67 = getelementptr inbounds [192 x i8], [192 x i8]* %4, i64 0, i64 0
%68 = bitcast i8* %67 to i32*
%69 = load i32, i32* %68
%70 = call i32 @ntohl(i32 %69)
%71 = and i32 %70, 1073741823
%72 = load i32, i32* %2
%73 = load i32, i32* %2
%74 = and i32 %73, 1073741823
%75 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %66, i32 %71, i32 %72, i32 %74)
br label %84
76: ; preds = %22, %17, %9
%77 = load i32, i32* %3
%78 = getelementptr inbounds [192 x i8], [192 x i8]* %4, i64 0, i64 0
%79 = bitcast i8* %78 to i32*
%80 = load i32, i32* %79
%81 = call i32 @ntohl(i32 %80)
%82 = and i32 %81, 1073741823
%83 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %77, i32 %82)
br label %84
84: ; preds = %76, %28
br label %5
85: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"%d %d %lld (%lld)\0A\00"
@.str.1 = [7 x i8] c"%d %d\0A\00"
define i32 @main() {
%1 = alloca [192 x i8]
%2 = getelementptr inbounds [192 x i8], [192 x i8]* %1, i64 0, i64 0
%3 = call i32 @read(i32 0, i8* %2, i32 192)
%4 = icmp eq i32 %3, 192
br i1 %4, label %5, label %69
5: ; preds = %0
%6 = getelementptr inbounds [192 x i8], [192 x i8]* %1, i64 0, i64 7
%7 = getelementptr inbounds [192 x i8], [192 x i8]* %1, i64 0, i64 8
%8 = getelementptr inbounds [192 x i8], [192 x i8]* %1, i64 0, i64 9
%9 = getelementptr inbounds [192 x i8], [192 x i8]* %1, i64 0, i64 10
%10 = getelementptr inbounds [192 x i8], [192 x i8]* %1, i64 0, i64 11
%11 = getelementptr inbounds [192 x i8], [192 x i8]* %1, i64 0, i64 12
%12 = getelementptr inbounds [192 x i8], [192 x i8]* %1, i64 0, i64 13
%13 = getelementptr inbounds [192 x i8], [192 x i8]* %1, i64 0, i64 14
%14 = getelementptr inbounds [192 x i8], [192 x i8]* %1, i64 0, i64 15
%15 = bitcast [192 x i8]* %1 to i32*
br label %16
16: ; preds = %5, %66
%17 = phi i32 [ 0, %5 ], [ %18, %66 ]
%18 = add i32 %17, 1
%19 = load i8, i8* %6
%20 = and i8 %19, 32
%21 = icmp ne i8 %20, 0
%22 = load i8, i8* %7
%23 = icmp ugt i8 %22, 6
%24 = select i1 %21, i1 %23, i1 false
br i1 %24, label %25, label %61
25: ; preds = %16
%26 = load i8, i8* %8
%27 = and i8 %26, 16
%28 = icmp eq i8 %27, 0
br i1 %28, label %61, label %29
29: ; preds = %25
%30 = load i8, i8* %9
%31 = zext i8 %30 to i32
%32 = shl i32 %31, 25
%33 = load i8, i8* %10
%34 = zext i8 %33 to i32
%35 = shl nuw nsw i32 %34, 17
%36 = or i32 %35, %32
%37 = load i8, i8* %11
%38 = zext i8 %37 to i32
%39 = shl nuw nsw i32 %38, 9
%40 = or i32 %36, %39
%41 = load i8, i8* %12
%42 = zext i8 %41 to i32
%43 = shl nuw nsw i32 %42, 1
%44 = or i32 %40, %43
%45 = load i8, i8* %13
%46 = zext i8 %45 to i32
%47 = lshr i32 %46, 7
%48 = or i32 %44, %47
%49 = mul nsw i32 %48, 300
%50 = shl nuw nsw i32 %46, 8
%51 = and i32 %50, 256
%52 = load i8, i8* %14
%53 = zext i8 %52 to i32
%54 = or i32 %51, %53
%55 = add nsw i32 %49, %54
%56 = load i32, i32* %15
%57 = tail call i32 @ntohl(i32 %56)
%58 = and i32 %57, 1073741823
%59 = and i32 %55, 1073741823
%60 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %18, i32 %58, i32 %55, i32 %59)
br label %66
61: ; preds = %25, %16
%62 = load i32, i32* %15
%63 = tail call i32 @ntohl(i32 %62)
%64 = and i32 %63, 1073741823
%65 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %18, i32 %64)
br label %66
66: ; preds = %61, %29
%67 = call i32 @read(i32 0, i8* %2, i32 192)
%68 = icmp eq i32 %67, 192
br i1 %68, label %16, label %69
69: ; preds = %66, %0
ret i32 0
}