#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 */
struct cec_msg {
  int len;
  int *msg;
};
typedef int __u32;

/* Variables and functions */
int CEC_MSG_DEVICE_VENDOR_ID;
void cec_msg_device_vendor_id(struct cec_msg *msg, __u32 vendor_id) {
  msg->len = 5;
  msg->msg[0] |= 0xf;
  msg->msg[1] = CEC_MSG_DEVICE_VENDOR_ID;
  msg->msg[2] = vendor_id >> 16;
  msg->msg[3] = (vendor_id >> 8) & 0xff;
  msg->msg[4] = vendor_id & 0xff;
}


x86 assembly (clang, -O0):
<cec_msg_device_vendor_id>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x5,(%rax)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%ecx
or     $0xf,%ecx
mov    %ecx,(%rax)
mov    0x2ebd(%rip),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0x4(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x10,%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0x8(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x8,%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0xc(%rax)
mov    -0xc(%rbp),%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0x10(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<cec_msg_device_vendor_id>:
mov    %esi,%eax
movl   $0x5,(%rdi)
mov    0x8(%rdi),%rcx
orl    $0xf,(%rcx)
mov    0x2ed2(%rip),%rdx
mov    (%rdx),%edx
mov    %edx,0x4(%rcx)
movzbl %ah,%edx
movzbl %al,%esi
sar    $0x10,%eax
mov    %eax,0x8(%rcx)
mov    %edx,0xc(%rcx)
mov    %esi,0x10(%rcx)
ret

LLVM IR (-O0):
%struct.cec_msg = type { i32, i32* }
@CEC_MSG_DEVICE_VENDOR_ID = global i32 0
define void @cec_msg_device_vendor_id(%struct.cec_msg* %0, i32 %1) {
%3 = alloca %struct.cec_msg*
%4 = alloca i32
store %struct.cec_msg* %0, %struct.cec_msg** %3
store i32 %1, i32* %4
%5 = load %struct.cec_msg*, %struct.cec_msg** %3
%6 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %5, i32 0, i32 0
store i32 5, i32* %6
%7 = load %struct.cec_msg*, %struct.cec_msg** %3
%8 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %7, i32 0, i32 1
%9 = load i32*, i32** %8
%10 = getelementptr inbounds i32, i32* %9, i64 0
%11 = load i32, i32* %10
%12 = or i32 %11, 15
store i32 %12, i32* %10
%13 = load i32, i32* @CEC_MSG_DEVICE_VENDOR_ID
%14 = load %struct.cec_msg*, %struct.cec_msg** %3
%15 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %14, i32 0, i32 1
%16 = load i32*, i32** %15
%17 = getelementptr inbounds i32, i32* %16, i64 1
store i32 %13, i32* %17
%18 = load i32, i32* %4
%19 = ashr i32 %18, 16
%20 = load %struct.cec_msg*, %struct.cec_msg** %3
%21 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %20, i32 0, i32 1
%22 = load i32*, i32** %21
%23 = getelementptr inbounds i32, i32* %22, i64 2
store i32 %19, i32* %23
%24 = load i32, i32* %4
%25 = ashr i32 %24, 8
%26 = and i32 %25, 255
%27 = load %struct.cec_msg*, %struct.cec_msg** %3
%28 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %27, i32 0, i32 1
%29 = load i32*, i32** %28
%30 = getelementptr inbounds i32, i32* %29, i64 3
store i32 %26, i32* %30
%31 = load i32, i32* %4
%32 = and i32 %31, 255
%33 = load %struct.cec_msg*, %struct.cec_msg** %3
%34 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %33, i32 0, i32 1
%35 = load i32*, i32** %34
%36 = getelementptr inbounds i32, i32* %35, i64 4
store i32 %32, i32* %36
ret void
}

LLVM IR (-O2):
%struct.cec_msg = type { i32, i32* }
@CEC_MSG_DEVICE_VENDOR_ID = global i32 0
define void @cec_msg_device_vendor_id(%struct.cec_msg* nocapture %0, i32 %1) {
%3 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %0, i64 0, i32 0
store i32 5, i32* %3
%4 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %0, i64 0, i32 1
%5 = load i32*, i32** %4
%6 = load i32, i32* %5
%7 = or i32 %6, 15
store i32 %7, i32* %5
%8 = load i32, i32* @CEC_MSG_DEVICE_VENDOR_ID
%9 = getelementptr inbounds i32, i32* %5, i64 1
store i32 %8, i32* %9
%10 = ashr i32 %1, 16
%11 = getelementptr inbounds i32, i32* %5, i64 2
store i32 %10, i32* %11
%12 = lshr i32 %1, 8
%13 = and i32 %12, 255
%14 = getelementptr inbounds i32, i32* %5, i64 3
store i32 %13, i32* %14
%15 = and i32 %1, 255
%16 = getelementptr inbounds i32, i32* %5, i64 4
store i32 %15, i32* %16
ret void
}