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

/* Variables and functions */
void pes_set_dts(uint8_t *p_pes, uint64_t i_dts) {
  p_pes[7] |= 0x40;
  if (p_pes[8] < 10)
    p_pes[8] = 10;
  p_pes[9] &= 0x0f;
  p_pes[9] |= 0x30;
  p_pes[14] = 0x11 | ((i_dts >> 29) & 0xe);
  p_pes[15] = (i_dts >> 22) & 0xff;
  p_pes[16] = 0x1 | ((i_dts >> 14) & 0xfe);
  p_pes[17] = (i_dts >> 7) & 0xff;
  p_pes[18] = 0x1 | ((i_dts << 1) & 0xfe);
}


x86 assembly (clang, -O0):
<pes_set_dts>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    0x1c(%rax),%ecx
or     $0x40,%ecx
mov    %ecx,0x1c(%rax)
mov    -0x8(%rbp),%rax
cmpl   $0xa,0x20(%rax)
jge    1131 <pes_set_dts+0x31>
mov    -0x8(%rbp),%rax
movl   $0xa,0x20(%rax)
mov    -0x8(%rbp),%rax
mov    0x24(%rax),%ecx
and    $0xf,%ecx
mov    %ecx,0x24(%rax)
mov    -0x8(%rbp),%rax
mov    0x24(%rax),%ecx
or     $0x30,%ecx
mov    %ecx,0x24(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x1d,%ecx
and    $0xe,%ecx
or     $0x11,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x38(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x16,%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x3c(%rax)
mov    -0xc(%rbp),%ecx
sar    $0xe,%ecx
and    $0xfe,%ecx
or     $0x1,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x40(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x7,%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x44(%rax)
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
and    $0xfe,%ecx
or     $0x1,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x48(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<pes_set_dts>:
orb    $0x40,0x1c(%rdi)
cmpl   $0x9,0x20(%rdi)
jg     1111 <pes_set_dts+0x11>
movl   $0xa,0x20(%rdi)
mov    0x24(%rdi),%eax
and    $0xf,%eax
or     $0x30,%eax
mov    %eax,0x24(%rdi)
mov    %esi,%eax
sar    $0x1d,%eax
and    $0xe,%eax
or     $0x11,%eax
mov    %eax,0x38(%rdi)
mov    %esi,%eax
shr    $0x16,%eax
movzbl %al,%eax
mov    %eax,0x3c(%rdi)
mov    %esi,%eax
shr    $0xe,%eax
or     $0x1,%eax
movzbl %al,%eax
mov    %eax,0x40(%rdi)
mov    %esi,%eax
shr    $0x7,%eax
movzbl %al,%eax
mov    %eax,0x44(%rdi)
lea    (%rsi,%rsi,1),%eax
add    $0x1,%eax
movzbl %al,%eax
mov    %eax,0x48(%rdi)
ret

LLVM IR (-O0):
define void @pes_set_dts(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32*, i32** %3
%6 = getelementptr inbounds i32, i32* %5, i64 7
%7 = load i32, i32* %6
%8 = or i32 %7, 64
store i32 %8, i32* %6
%9 = load i32*, i32** %3
%10 = getelementptr inbounds i32, i32* %9, i64 8
%11 = load i32, i32* %10
%12 = icmp slt i32 %11, 10
br i1 %12, label %13, label %16
13: ; preds = %2
%14 = load i32*, i32** %3
%15 = getelementptr inbounds i32, i32* %14, i64 8
store i32 10, i32* %15
br label %16
16: ; preds = %13, %2
%17 = load i32*, i32** %3
%18 = getelementptr inbounds i32, i32* %17, i64 9
%19 = load i32, i32* %18
%20 = and i32 %19, 15
store i32 %20, i32* %18
%21 = load i32*, i32** %3
%22 = getelementptr inbounds i32, i32* %21, i64 9
%23 = load i32, i32* %22
%24 = or i32 %23, 48
store i32 %24, i32* %22
%25 = load i32, i32* %4
%26 = ashr i32 %25, 29
%27 = and i32 %26, 14
%28 = or i32 17, %27
%29 = load i32*, i32** %3
%30 = getelementptr inbounds i32, i32* %29, i64 14
store i32 %28, i32* %30
%31 = load i32, i32* %4
%32 = ashr i32 %31, 22
%33 = and i32 %32, 255
%34 = load i32*, i32** %3
%35 = getelementptr inbounds i32, i32* %34, i64 15
store i32 %33, i32* %35
%36 = load i32, i32* %4
%37 = ashr i32 %36, 14
%38 = and i32 %37, 254
%39 = or i32 1, %38
%40 = load i32*, i32** %3
%41 = getelementptr inbounds i32, i32* %40, i64 16
store i32 %39, i32* %41
%42 = load i32, i32* %4
%43 = ashr i32 %42, 7
%44 = and i32 %43, 255
%45 = load i32*, i32** %3
%46 = getelementptr inbounds i32, i32* %45, i64 17
store i32 %44, i32* %46
%47 = load i32, i32* %4
%48 = shl i32 %47, 1
%49 = and i32 %48, 254
%50 = or i32 1, %49
%51 = load i32*, i32** %3
%52 = getelementptr inbounds i32, i32* %51, i64 18
store i32 %50, i32* %52
ret void
}

LLVM IR (-O2):
define void @pes_set_dts(i32* nocapture %0, i32 %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 7
%4 = load i32, i32* %3
%5 = or i32 %4, 64
store i32 %5, i32* %3
%6 = getelementptr inbounds i32, i32* %0, i64 8
%7 = load i32, i32* %6
%8 = icmp slt i32 %7, 10
br i1 %8, label %9, label %10
9: ; preds = %2
store i32 10, i32* %6
br label %10
10: ; preds = %9, %2
%11 = getelementptr inbounds i32, i32* %0, i64 9
%12 = load i32, i32* %11
%13 = and i32 %12, 15
%14 = or i32 %13, 48
store i32 %14, i32* %11
%15 = ashr i32 %1, 29
%16 = and i32 %15, 14
%17 = or i32 %16, 17
%18 = getelementptr inbounds i32, i32* %0, i64 14
store i32 %17, i32* %18
%19 = lshr i32 %1, 22
%20 = and i32 %19, 255
%21 = getelementptr inbounds i32, i32* %0, i64 15
store i32 %20, i32* %21
%22 = lshr i32 %1, 14
%23 = and i32 %22, 254
%24 = or i32 %23, 1
%25 = getelementptr inbounds i32, i32* %0, i64 16
store i32 %24, i32* %25
%26 = lshr i32 %1, 7
%27 = and i32 %26, 255
%28 = getelementptr inbounds i32, i32* %0, i64 17
store i32 %27, i32* %28
%29 = shl i32 %1, 1
%30 = and i32 %29, 254
%31 = or i32 %30, 1
%32 = getelementptr inbounds i32, i32* %0, i64 18
store i32 %31, i32* %32
ret void
}