#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 uint8_t;

/* Variables and functions */
int ts_packet_has_pcr(uint8_t *ts_packet) {
  if (ts_packet[0] == 0x47) {
    if (((ts_packet[3] & (0x20)) ? 1 : 0)) {
      if (ts_packet[4] > 6) {
        if (((ts_packet[5] & (0x10)) ? 1 : 0)) {
          return 1;
        } else {
        }
      } else {
      }
    } else {
    }
  } else {
  }
  return 0;
}


x86 assembly (clang, -O0):
<ts_packet_has_pcr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpl   $0x47,(%rax)
jne    11af <ts_packet_has_pcr+0xaf>
mov    -0x10(%rbp),%rax
mov    0xc(%rax),%eax
and    $0x20,%eax
cmp    $0x0,%eax
je     1137 <ts_packet_has_pcr+0x37>
mov    $0x1,%al
test   $0x1,%al
jne    1146 <ts_packet_has_pcr+0x46>
jmp    11a5 <ts_packet_has_pcr+0xa5>
xor    %eax,%eax
test   $0x1,%al
jne    1146 <ts_packet_has_pcr+0x46>
jmp    11a5 <ts_packet_has_pcr+0xa5>
mov    -0x10(%rbp),%rax
cmpl   $0x6,0x10(%rax)
jle    119b <ts_packet_has_pcr+0x9b>
mov    -0x10(%rbp),%rax
mov    0x14(%rax),%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     1176 <ts_packet_has_pcr+0x76>
mov    $0x1,%al
test   $0x1,%al
jne    1185 <ts_packet_has_pcr+0x85>
jmp    1191 <ts_packet_has_pcr+0x91>
xor    %eax,%eax
test   $0x1,%al
jne    1185 <ts_packet_has_pcr+0x85>
jmp    1191 <ts_packet_has_pcr+0x91>
movl   $0x1,-0x4(%rbp)
jmp    11bb <ts_packet_has_pcr+0xbb>
jmp    1196 <ts_packet_has_pcr+0x96>
jmp    11a0 <ts_packet_has_pcr+0xa0>
jmp    11a0 <ts_packet_has_pcr+0xa0>
jmp    11aa <ts_packet_has_pcr+0xaa>
jmp    11aa <ts_packet_has_pcr+0xaa>
jmp    11b4 <ts_packet_has_pcr+0xb4>
jmp    11b4 <ts_packet_has_pcr+0xb4>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ts_packet_has_pcr>:
cmpl   $0x47,(%rdi)
jne    111c <ts_packet_has_pcr+0x1c>
testb  $0x20,0xc(%rdi)
je     111c <ts_packet_has_pcr+0x1c>
cmpl   $0x7,0x10(%rdi)
jl     111c <ts_packet_has_pcr+0x1c>
mov    $0x1,%eax
testb  $0x10,0x14(%rdi)
jne    111e <ts_packet_has_pcr+0x1e>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @ts_packet_has_pcr(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
store i32* %0, i32** %3
%4 = load i32*, i32** %3
%5 = getelementptr inbounds i32, i32* %4, i64 0
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, 71
br i1 %7, label %8, label %36
8: ; preds = %1
%9 = load i32*, i32** %3
%10 = getelementptr inbounds i32, i32* %9, i64 3
%11 = load i32, i32* %10
%12 = and i32 %11, 32
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %8
br i1 true, label %16, label %34
15: ; preds = %8
br i1 false, label %16, label %34
16: ; preds = %15, %14
%17 = load i32*, i32** %3
%18 = getelementptr inbounds i32, i32* %17, i64 4
%19 = load i32, i32* %18
%20 = icmp sgt i32 %19, 6
br i1 %20, label %21, label %32
21: ; preds = %16
%22 = load i32*, i32** %3
%23 = getelementptr inbounds i32, i32* %22, i64 5
%24 = load i32, i32* %23
%25 = and i32 %24, 16
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %21
br i1 true, label %29, label %30
28: ; preds = %21
br i1 false, label %29, label %30
29: ; preds = %28, %27
store i32 1, i32* %2
br label %38
30: ; preds = %28, %27
br label %31
31: ; preds = %30
br label %33
32: ; preds = %16
br label %33
33: ; preds = %32, %31
br label %35
34: ; preds = %15, %14
br label %35
35: ; preds = %34, %33
br label %37
36: ; preds = %1
br label %37
37: ; preds = %36, %35
store i32 0, i32* %2
br label %38
38: ; preds = %37, %29
%39 = load i32, i32* %2
ret i32 %39
}

LLVM IR (-O2):
define i32 @ts_packet_has_pcr(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = icmp eq i32 %2, 71
br i1 %3, label %4, label %18
4: ; preds = %1
%5 = getelementptr inbounds i32, i32* %0, i64 3
%6 = load i32, i32* %5
%7 = and i32 %6, 32
%8 = icmp eq i32 %7, 0
br i1 %8, label %18, label %9
9: ; preds = %4
%10 = getelementptr inbounds i32, i32* %0, i64 4
%11 = load i32, i32* %10
%12 = icmp sgt i32 %11, 6
br i1 %12, label %13, label %18
13: ; preds = %9
%14 = getelementptr inbounds i32, i32* %0, i64 5
%15 = load i32, i32* %14
%16 = and i32 %15, 16
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %1, %9, %13, %4
br label %19
19: ; preds = %13, %18
%20 = phi i32 [ 0, %18 ], [ 1, %13 ]
ret i32 %20
}