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

/* Variables and functions */
void mp2vgop_set_timecode(uint8_t *p_mp2vgop, uint32_t i_timecode) {
  p_mp2vgop[4] = i_timecode >> 17;
  p_mp2vgop[5] = (i_timecode >> 9) & 0xff;
  p_mp2vgop[6] = (i_timecode >> 1) & 0xff;
  p_mp2vgop[7] &= 0x7f;
  p_mp2vgop[7] |= (i_timecode << 7) & 0x80;
}


x86 assembly (clang, -O0):
<mp2vgop_set_timecode>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
sar    $0x11,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x10(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x9,%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x14(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x1,%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x18(%rax)
mov    -0x8(%rbp),%rax
mov    0x1c(%rax),%ecx
and    $0x7f,%ecx
mov    %ecx,0x1c(%rax)
mov    -0xc(%rbp),%ecx
shl    $0x7,%ecx
and    $0x80,%ecx
mov    -0x8(%rbp),%rax
or     0x1c(%rax),%ecx
mov    %ecx,0x1c(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<mp2vgop_set_timecode>:
mov    %esi,%eax
sar    $0x11,%eax
mov    %eax,0x10(%rdi)
mov    %esi,%eax
shr    $0x9,%eax
movzbl %al,%eax
mov    %eax,0x14(%rdi)
mov    %esi,%eax
shr    %eax
movzbl %al,%eax
mov    %eax,0x18(%rdi)
mov    0x1c(%rdi),%eax
and    $0x7f,%eax
shl    $0x7,%esi
movzbl %sil,%ecx
or     %eax,%ecx
mov    %ecx,0x1c(%rdi)
ret

LLVM IR (-O0):
define void @mp2vgop_set_timecode(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = ashr i32 %5, 17
%7 = load i32*, i32** %3
%8 = getelementptr inbounds i32, i32* %7, i64 4
store i32 %6, i32* %8
%9 = load i32, i32* %4
%10 = ashr i32 %9, 9
%11 = and i32 %10, 255
%12 = load i32*, i32** %3
%13 = getelementptr inbounds i32, i32* %12, i64 5
store i32 %11, i32* %13
%14 = load i32, i32* %4
%15 = ashr i32 %14, 1
%16 = and i32 %15, 255
%17 = load i32*, i32** %3
%18 = getelementptr inbounds i32, i32* %17, i64 6
store i32 %16, i32* %18
%19 = load i32*, i32** %3
%20 = getelementptr inbounds i32, i32* %19, i64 7
%21 = load i32, i32* %20
%22 = and i32 %21, 127
store i32 %22, i32* %20
%23 = load i32, i32* %4
%24 = shl i32 %23, 7
%25 = and i32 %24, 128
%26 = load i32*, i32** %3
%27 = getelementptr inbounds i32, i32* %26, i64 7
%28 = load i32, i32* %27
%29 = or i32 %28, %25
store i32 %29, i32* %27
ret void
}

LLVM IR (-O2):
define void @mp2vgop_set_timecode(i32* nocapture %0, i32 %1) {
%3 = ashr i32 %1, 17
%4 = getelementptr inbounds i32, i32* %0, i64 4
store i32 %3, i32* %4
%5 = lshr i32 %1, 9
%6 = and i32 %5, 255
%7 = getelementptr inbounds i32, i32* %0, i64 5
store i32 %6, i32* %7
%8 = lshr i32 %1, 1
%9 = and i32 %8, 255
%10 = getelementptr inbounds i32, i32* %0, i64 6
store i32 %9, i32* %10
%11 = getelementptr inbounds i32, i32* %0, i64 7
%12 = load i32, i32* %11
%13 = and i32 %12, 127
%14 = shl i32 %1, 7
%15 = and i32 %14, 128
%16 = or i32 %13, %15
store i32 %16, i32* %11
ret void
}