#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 void *__u8;

/* Variables and functions */
int CEC_MSG_REPORT_FEATURES;
void cec_msg_report_features(struct cec_msg *msg, __u8 cec_version,
                             __u8 all_device_types, __u8 rc_profile,
                             __u8 dev_features) {
  msg->len = 6;
  msg->msg[0] |= 0xf;
  msg->msg[1] = CEC_MSG_REPORT_FEATURES;
  msg->msg[2] = cec_version;
  msg->msg[3] = all_device_types;
  msg->msg[4] = rc_profile;
  msg->msg[5] = dev_features;
}


x86 assembly (clang, -O0):
<cec_msg_report_features>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x6,(%rax)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%ecx
or     $0xf,%ecx
mov    %ecx,(%rax)
mov    0x2ea0(%rip),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0x4(%rax)
mov    -0x10(%rbp),%rax
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0x8(%rax)
mov    -0x18(%rbp),%rax
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0xc(%rax)
mov    -0x20(%rbp),%rax
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0x10(%rax)
mov    -0x28(%rbp),%rax
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0x14(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<cec_msg_report_features>:
movl   $0x6,(%rdi)
mov    0x8(%rdi),%rax
orl    $0xf,(%rax)
mov    0x2ec4(%rip),%rdi
mov    (%rdi),%edi
mov    %edi,0x4(%rax)
mov    %esi,0x8(%rax)
mov    %edx,0xc(%rax)
mov    %ecx,0x10(%rax)
mov    %r8d,0x14(%rax)
ret

LLVM IR (-O0):
%struct.cec_msg = type { i32, i32* }
@CEC_MSG_REPORT_FEATURES = global i32 0
define void @cec_msg_report_features(%struct.cec_msg* %0, i8* %1, i8* %2, i8* %3, i8* %4) {
%6 = alloca %struct.cec_msg*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
store %struct.cec_msg* %0, %struct.cec_msg** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i8* %4, i8** %10
%11 = load %struct.cec_msg*, %struct.cec_msg** %6
%12 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %11, i32 0, i32 0
store i32 6, i32* %12
%13 = load %struct.cec_msg*, %struct.cec_msg** %6
%14 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %13, i32 0, i32 1
%15 = load i32*, i32** %14
%16 = getelementptr inbounds i32, i32* %15, i64 0
%17 = load i32, i32* %16
%18 = or i32 %17, 15
store i32 %18, i32* %16
%19 = load i32, i32* @CEC_MSG_REPORT_FEATURES
%20 = load %struct.cec_msg*, %struct.cec_msg** %6
%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 1
store i32 %19, i32* %23
%24 = load i8*, i8** %7
%25 = ptrtoint i8* %24 to i32
%26 = load %struct.cec_msg*, %struct.cec_msg** %6
%27 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %26, i32 0, i32 1
%28 = load i32*, i32** %27
%29 = getelementptr inbounds i32, i32* %28, i64 2
store i32 %25, i32* %29
%30 = load i8*, i8** %8
%31 = ptrtoint i8* %30 to i32
%32 = load %struct.cec_msg*, %struct.cec_msg** %6
%33 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %32, i32 0, i32 1
%34 = load i32*, i32** %33
%35 = getelementptr inbounds i32, i32* %34, i64 3
store i32 %31, i32* %35
%36 = load i8*, i8** %9
%37 = ptrtoint i8* %36 to i32
%38 = load %struct.cec_msg*, %struct.cec_msg** %6
%39 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %38, i32 0, i32 1
%40 = load i32*, i32** %39
%41 = getelementptr inbounds i32, i32* %40, i64 4
store i32 %37, i32* %41
%42 = load i8*, i8** %10
%43 = ptrtoint i8* %42 to i32
%44 = load %struct.cec_msg*, %struct.cec_msg** %6
%45 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %44, i32 0, i32 1
%46 = load i32*, i32** %45
%47 = getelementptr inbounds i32, i32* %46, i64 5
store i32 %43, i32* %47
ret void
}

LLVM IR (-O2):
%struct.cec_msg = type { i32, i32* }
@CEC_MSG_REPORT_FEATURES = global i32 0
define void @cec_msg_report_features(%struct.cec_msg* nocapture %0, i8* %1, i8* %2, i8* %3, i8* %4) {
%6 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %0, i64 0, i32 0
store i32 6, i32* %6
%7 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %0, i64 0, i32 1
%8 = load i32*, i32** %7
%9 = load i32, i32* %8
%10 = or i32 %9, 15
store i32 %10, i32* %8
%11 = load i32, i32* @CEC_MSG_REPORT_FEATURES
%12 = getelementptr inbounds i32, i32* %8, i64 1
store i32 %11, i32* %12
%13 = ptrtoint i8* %1 to i64
%14 = trunc i64 %13 to i32
%15 = getelementptr inbounds i32, i32* %8, i64 2
store i32 %14, i32* %15
%16 = ptrtoint i8* %2 to i64
%17 = trunc i64 %16 to i32
%18 = getelementptr inbounds i32, i32* %8, i64 3
store i32 %17, i32* %18
%19 = ptrtoint i8* %3 to i64
%20 = trunc i64 %19 to i32
%21 = getelementptr inbounds i32, i32* %8, i64 4
store i32 %20, i32* %21
%22 = ptrtoint i8* %4 to i64
%23 = trunc i64 %22 to i32
%24 = getelementptr inbounds i32, i32* %8, i64 5
store i32 %23, i32* %24
ret void
}