#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 __u8;
typedef int __u16;

/* Variables and functions */
int CEC_MSG_TUNER_DEVICE_STATUS;
void cec_msg_tuner_device_status_analog(struct cec_msg *msg, __u8 rec_flag,
                                        __u8 tuner_display_info,
                                        __u8 ana_bcast_type, __u16 ana_freq,
                                        __u8 bcast_system) {
  msg->len = 7;
  msg->msg[1] = CEC_MSG_TUNER_DEVICE_STATUS;
  msg->msg[2] = (rec_flag << 7) | tuner_display_info;
  msg->msg[3] = ana_bcast_type;
  msg->msg[4] = ana_freq >> 8;
  msg->msg[5] = ana_freq & 0xff;
  msg->msg[6] = bcast_system;
}


x86 assembly (clang, -O0):
<cec_msg_tuner_device_status_analog>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9d,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x7,(%rax)
mov    0x2ec6(%rip),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0x4(%rax)
mov    -0xc(%rbp),%ecx
shl    $0x7,%ecx
or     -0x10(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0x8(%rax)
mov    -0x14(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0xc(%rax)
mov    -0x18(%rbp),%ecx
sar    $0x8,%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0x10(%rax)
mov    -0x18(%rbp),%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0x14(%rax)
mov    -0x1c(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0x18(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<cec_msg_tuner_device_status_analog>:
movl   $0x7,(%rdi)
mov    0x2ee3(%rip),%rax
mov    (%rax),%eax
mov    0x8(%rdi),%rdi
mov    %eax,0x4(%rdi)
shl    $0x7,%esi
or     %edx,%esi
mov    %esi,0x8(%rdi)
mov    %ecx,0xc(%rdi)
movzbl %r8b,%eax
sar    $0x8,%r8d
mov    %r8d,0x10(%rdi)
mov    %eax,0x14(%rdi)
mov    %r9d,0x18(%rdi)
ret

LLVM IR (-O0):
%struct.cec_msg = type { i32, i32* }
@CEC_MSG_TUNER_DEVICE_STATUS = global i32 0
define void @cec_msg_tuner_device_status_analog(%struct.cec_msg* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca %struct.cec_msg*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store %struct.cec_msg* %0, %struct.cec_msg** %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%13 = load %struct.cec_msg*, %struct.cec_msg** %7
%14 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %13, i32 0, i32 0
store i32 7, i32* %14
%15 = load i32, i32* @CEC_MSG_TUNER_DEVICE_STATUS
%16 = load %struct.cec_msg*, %struct.cec_msg** %7
%17 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %16, i32 0, i32 1
%18 = load i32*, i32** %17
%19 = getelementptr inbounds i32, i32* %18, i64 1
store i32 %15, i32* %19
%20 = load i32, i32* %8
%21 = shl i32 %20, 7
%22 = load i32, i32* %9
%23 = or i32 %21, %22
%24 = load %struct.cec_msg*, %struct.cec_msg** %7
%25 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %24, i32 0, i32 1
%26 = load i32*, i32** %25
%27 = getelementptr inbounds i32, i32* %26, i64 2
store i32 %23, i32* %27
%28 = load i32, i32* %10
%29 = load %struct.cec_msg*, %struct.cec_msg** %7
%30 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %29, i32 0, i32 1
%31 = load i32*, i32** %30
%32 = getelementptr inbounds i32, i32* %31, i64 3
store i32 %28, i32* %32
%33 = load i32, i32* %11
%34 = ashr i32 %33, 8
%35 = load %struct.cec_msg*, %struct.cec_msg** %7
%36 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %35, i32 0, i32 1
%37 = load i32*, i32** %36
%38 = getelementptr inbounds i32, i32* %37, i64 4
store i32 %34, i32* %38
%39 = load i32, i32* %11
%40 = and i32 %39, 255
%41 = load %struct.cec_msg*, %struct.cec_msg** %7
%42 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %41, i32 0, i32 1
%43 = load i32*, i32** %42
%44 = getelementptr inbounds i32, i32* %43, i64 5
store i32 %40, i32* %44
%45 = load i32, i32* %12
%46 = load %struct.cec_msg*, %struct.cec_msg** %7
%47 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %46, i32 0, i32 1
%48 = load i32*, i32** %47
%49 = getelementptr inbounds i32, i32* %48, i64 6
store i32 %45, i32* %49
ret void
}

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