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

/* Variables and functions */
int CEC_MSG_RECORD_ON;
int CEC_OP_RECORD_SRC_ANALOG;
void cec_msg_record_on_analog(struct cec_msg *msg, __u8 ana_bcast_type,
                              __u16 ana_freq, __u8 bcast_system) {
  msg->len = 7;
  msg->msg[1] = CEC_MSG_RECORD_ON;
  msg->msg[2] = CEC_OP_RECORD_SRC_ANALOG;
  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_record_on_analog>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x7,(%rax)
mov    0x2eb4(%rip),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0x4(%rax)
mov    0x2ea8(%rip),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0x8(%rax)
mov    -0x10(%rbp),%rax
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0xc(%rax)
mov    -0x14(%rbp),%ecx
sar    $0x8,%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0x10(%rax)
mov    -0x14(%rbp),%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0x14(%rax)
mov    -0x20(%rbp),%rax
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0x18(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<cec_msg_record_on_analog>:
movl   $0x7,(%rdi)
mov    0x2ecb(%rip),%rax
mov    (%rax),%eax
mov    0x8(%rdi),%rdi
mov    %eax,0x4(%rdi)
mov    0x2ec3(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x8(%rdi)
mov    %esi,0xc(%rdi)
movzbl %dl,%eax
sar    $0x8,%edx
mov    %edx,0x10(%rdi)
mov    %eax,0x14(%rdi)
mov    %ecx,0x18(%rdi)
ret

LLVM IR (-O0):
%struct.cec_msg = type { i32, i32* }
@CEC_MSG_RECORD_ON = global i32 0
@CEC_OP_RECORD_SRC_ANALOG = global i32 0
define void @cec_msg_record_on_analog(%struct.cec_msg* %0, i8* %1, i32 %2, i8* %3) {
%5 = alloca %struct.cec_msg*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
store %struct.cec_msg* %0, %struct.cec_msg** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%9 = load %struct.cec_msg*, %struct.cec_msg** %5
%10 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %9, i32 0, i32 0
store i32 7, i32* %10
%11 = load i32, i32* @CEC_MSG_RECORD_ON
%12 = load %struct.cec_msg*, %struct.cec_msg** %5
%13 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %12, i32 0, i32 1
%14 = load i32*, i32** %13
%15 = getelementptr inbounds i32, i32* %14, i64 1
store i32 %11, i32* %15
%16 = load i32, i32* @CEC_OP_RECORD_SRC_ANALOG
%17 = load %struct.cec_msg*, %struct.cec_msg** %5
%18 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %17, i32 0, i32 1
%19 = load i32*, i32** %18
%20 = getelementptr inbounds i32, i32* %19, i64 2
store i32 %16, i32* %20
%21 = load i8*, i8** %6
%22 = ptrtoint i8* %21 to i32
%23 = load %struct.cec_msg*, %struct.cec_msg** %5
%24 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %23, i32 0, i32 1
%25 = load i32*, i32** %24
%26 = getelementptr inbounds i32, i32* %25, i64 3
store i32 %22, i32* %26
%27 = load i32, i32* %7
%28 = ashr i32 %27, 8
%29 = load %struct.cec_msg*, %struct.cec_msg** %5
%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 4
store i32 %28, i32* %32
%33 = load i32, i32* %7
%34 = and i32 %33, 255
%35 = load %struct.cec_msg*, %struct.cec_msg** %5
%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 5
store i32 %34, i32* %38
%39 = load i8*, i8** %8
%40 = ptrtoint i8* %39 to i32
%41 = load %struct.cec_msg*, %struct.cec_msg** %5
%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 6
store i32 %40, i32* %44
ret void
}

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