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

/* Variables and functions */
void mp2vpic_set_vbvdelay(uint8_t *p_mp2vpic, uint16_t i_vbvdelay) {
  p_mp2vpic[5] &= 0xf8;
  p_mp2vpic[5] |= i_vbvdelay >> 13;
  p_mp2vpic[6] = (i_vbvdelay >> 5) & 0xff;
  p_mp2vpic[7] &= 0x7;
  p_mp2vpic[7] |= (i_vbvdelay << 3) & 0xf8;
}


x86 assembly (clang, -O0):
<mp2vpic_set_vbvdelay>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    0x14(%rax),%ecx
and    $0xf8,%ecx
mov    %ecx,0x14(%rax)
mov    -0xc(%rbp),%ecx
sar    $0xd,%ecx
mov    -0x8(%rbp),%rax
or     0x14(%rax),%ecx
mov    %ecx,0x14(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x5,%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x18(%rax)
mov    -0x8(%rbp),%rax
mov    0x1c(%rax),%ecx
and    $0x7,%ecx
mov    %ecx,0x1c(%rax)
mov    -0xc(%rbp),%ecx
shl    $0x3,%ecx
and    $0xf8,%ecx
mov    -0x8(%rbp),%rax
or     0x1c(%rax),%ecx
mov    %ecx,0x1c(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<mp2vpic_set_vbvdelay>:
mov    $0xf8,%eax
and    0x14(%rdi),%eax
mov    %esi,%ecx
sar    $0xd,%ecx
or     %eax,%ecx
mov    %ecx,0x14(%rdi)
mov    %esi,%eax
shr    $0x5,%eax
movzbl %al,%eax
mov    %eax,0x18(%rdi)
mov    0x1c(%rdi),%eax
and    $0x7,%eax
and    $0x1f,%esi
lea    (%rax,%rsi,8),%eax
mov    %eax,0x1c(%rdi)
ret

LLVM IR (-O0):
define void @mp2vpic_set_vbvdelay(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 5
%7 = load i32, i32* %6
%8 = and i32 %7, 248
store i32 %8, i32* %6
%9 = load i32, i32* %4
%10 = ashr i32 %9, 13
%11 = load i32*, i32** %3
%12 = getelementptr inbounds i32, i32* %11, i64 5
%13 = load i32, i32* %12
%14 = or i32 %13, %10
store i32 %14, i32* %12
%15 = load i32, i32* %4
%16 = ashr i32 %15, 5
%17 = and i32 %16, 255
%18 = load i32*, i32** %3
%19 = getelementptr inbounds i32, i32* %18, i64 6
store i32 %17, i32* %19
%20 = load i32*, i32** %3
%21 = getelementptr inbounds i32, i32* %20, i64 7
%22 = load i32, i32* %21
%23 = and i32 %22, 7
store i32 %23, i32* %21
%24 = load i32, i32* %4
%25 = shl i32 %24, 3
%26 = and i32 %25, 248
%27 = load i32*, i32** %3
%28 = getelementptr inbounds i32, i32* %27, i64 7
%29 = load i32, i32* %28
%30 = or i32 %29, %26
store i32 %30, i32* %28
ret void
}

LLVM IR (-O2):
define void @mp2vpic_set_vbvdelay(i32* nocapture %0, i32 %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 5
%4 = load i32, i32* %3
%5 = and i32 %4, 248
%6 = ashr i32 %1, 13
%7 = or i32 %5, %6
store i32 %7, i32* %3
%8 = lshr i32 %1, 5
%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, 7
%14 = shl i32 %1, 3
%15 = and i32 %14, 248
%16 = or i32 %13, %15
store i32 %16, i32* %11
ret void
}