#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[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    -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    %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* %4
%18 = ashr i32 %17, 29
%19 = and i32 %18, 14
%20 = or i32 17, %19
%21 = load i32*, i32** %3
%22 = getelementptr inbounds i32, i32* %21, i64 14
store i32 %20, i32* %22
%23 = load i32, i32* %4
%24 = ashr i32 %23, 22
%25 = and i32 %24, 255
%26 = load i32*, i32** %3
%27 = getelementptr inbounds i32, i32* %26, i64 15
store i32 %25, i32* %27
%28 = load i32, i32* %4
%29 = ashr i32 %28, 14
%30 = and i32 %29, 254
%31 = or i32 1, %30
%32 = load i32*, i32** %3
%33 = getelementptr inbounds i32, i32* %32, i64 16
store i32 %31, i32* %33
%34 = load i32, i32* %4
%35 = ashr i32 %34, 7
%36 = and i32 %35, 255
%37 = load i32*, i32** %3
%38 = getelementptr inbounds i32, i32* %37, i64 17
store i32 %36, i32* %38
%39 = load i32, i32* %4
%40 = shl i32 %39, 1
%41 = and i32 %40, 254
%42 = or i32 1, %41
%43 = load i32*, i32** %3
%44 = getelementptr inbounds i32, i32* %43, i64 18
store i32 %42, i32* %44
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 = ashr i32 %1, 29
%12 = and i32 %11, 14
%13 = or i32 %12, 17
%14 = getelementptr inbounds i32, i32* %0, i64 14
store i32 %13, i32* %14
%15 = lshr i32 %1, 22
%16 = and i32 %15, 255
%17 = getelementptr inbounds i32, i32* %0, i64 15
store i32 %16, i32* %17
%18 = lshr i32 %1, 14
%19 = and i32 %18, 254
%20 = or i32 %19, 1
%21 = getelementptr inbounds i32, i32* %0, i64 16
store i32 %20, i32* %21
%22 = lshr i32 %1, 7
%23 = and i32 %22, 255
%24 = getelementptr inbounds i32, i32* %0, i64 17
store i32 %23, i32* %24
%25 = shl i32 %1, 1
%26 = and i32 %25, 254
%27 = or i32 %26, 1
%28 = getelementptr inbounds i32, i32* %0, i64 18
store i32 %27, i32* %28
ret void
}