#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 scalar_t__ uint8_t;
typedef int uint64_t;

/* Variables and functions */
void ts_decode_pts_dts(uint8_t *data, uint64_t *value) {
  uint64_t pts1 = ((unsigned int)data[0] & 0x0E) >> 1;
  uint64_t pts2 =
      ((unsigned int)data[1] << 7) | (((unsigned int)data[2] & 0xFE) >> 1);
  uint64_t pts3 =
      ((unsigned int)data[3] << 7) | (((unsigned int)data[4] & 0xFE) >> 1);
  *value = (pts1 << 30) | (pts2 << 15) | pts3;
}


x86 assembly (clang, -O0):
<ts_decode_pts_dts>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
and    $0xe,%eax
shr    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
shl    $0x7,%eax
mov    -0x8(%rbp),%rcx
mov    0x10(%rcx),%rcx
and    $0xfe,%ecx
shr    $0x1,%ecx
or     %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%rax
shl    $0x7,%eax
mov    -0x8(%rbp),%rcx
mov    0x20(%rcx),%rcx
and    $0xfe,%ecx
shr    $0x1,%ecx
or     %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%ecx
shl    $0x1e,%ecx
mov    -0x18(%rbp),%eax
shl    $0xf,%eax
or     %eax,%ecx
or     -0x1c(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<ts_decode_pts_dts>:
mov    (%rdi),%eax
mov    0x8(%rdi),%r8d
mov    0x10(%rdi),%edx
mov    0x18(%rdi),%ecx
shl    $0x7,%ecx
mov    0x20(%rdi),%edi
shr    %edi
and    $0x7f,%edi
or     %ecx,%edi
and    $0xfffffffe,%eax
shl    $0x1d,%eax
shl    $0x16,%r8d
shl    $0xe,%edx
and    $0x3f8000,%edx
or     %r8d,%edx
or     %eax,%edx
or     %edi,%edx
mov    %edx,(%rsi)
ret

LLVM IR (-O0):
define void @ts_decode_pts_dts(i64* %0, i32* %1) {
%3 = alloca i64*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i64* %0, i64** %3
store i32* %1, i32** %4
%8 = load i64*, i64** %3
%9 = getelementptr inbounds i64, i64* %8, i64 0
%10 = load i64, i64* %9
%11 = trunc i64 %10 to i32
%12 = and i32 %11, 14
%13 = lshr i32 %12, 1
store i32 %13, i32* %5
%14 = load i64*, i64** %3
%15 = getelementptr inbounds i64, i64* %14, i64 1
%16 = load i64, i64* %15
%17 = trunc i64 %16 to i32
%18 = shl i32 %17, 7
%19 = load i64*, i64** %3
%20 = getelementptr inbounds i64, i64* %19, i64 2
%21 = load i64, i64* %20
%22 = trunc i64 %21 to i32
%23 = and i32 %22, 254
%24 = lshr i32 %23, 1
%25 = or i32 %18, %24
store i32 %25, i32* %6
%26 = load i64*, i64** %3
%27 = getelementptr inbounds i64, i64* %26, i64 3
%28 = load i64, i64* %27
%29 = trunc i64 %28 to i32
%30 = shl i32 %29, 7
%31 = load i64*, i64** %3
%32 = getelementptr inbounds i64, i64* %31, i64 4
%33 = load i64, i64* %32
%34 = trunc i64 %33 to i32
%35 = and i32 %34, 254
%36 = lshr i32 %35, 1
%37 = or i32 %30, %36
store i32 %37, i32* %7
%38 = load i32, i32* %5
%39 = shl i32 %38, 30
%40 = load i32, i32* %6
%41 = shl i32 %40, 15
%42 = or i32 %39, %41
%43 = load i32, i32* %7
%44 = or i32 %42, %43
%45 = load i32*, i32** %4
store i32 %44, i32* %45
ret void
}

LLVM IR (-O2):
define void @ts_decode_pts_dts(i64* nocapture %0, i32* nocapture writeonly %1) {
%3 = load i64, i64* %0
%4 = trunc i64 %3 to i32
%5 = getelementptr inbounds i64, i64* %0, i64 1
%6 = load i64, i64* %5
%7 = trunc i64 %6 to i32
%8 = getelementptr inbounds i64, i64* %0, i64 2
%9 = load i64, i64* %8
%10 = trunc i64 %9 to i32
%11 = getelementptr inbounds i64, i64* %0, i64 3
%12 = load i64, i64* %11
%13 = trunc i64 %12 to i32
%14 = shl i32 %13, 7
%15 = getelementptr inbounds i64, i64* %0, i64 4
%16 = load i64, i64* %15
%17 = trunc i64 %16 to i32
%18 = lshr i32 %17, 1
%19 = and i32 %18, 127
%20 = or i32 %19, %14
%21 = shl i32 %4, 29
%22 = and i32 %21, -1073741824
%23 = shl i32 %7, 22
%24 = shl i32 %10, 14
%25 = and i32 %24, 4161536
%26 = or i32 %25, %23
%27 = or i32 %26, %22
%28 = or i32 %27, %20
store i32 %28, i32* %1
ret void
}