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

/* Variables and functions */
void cec_ops_select_analogue_service(const struct cec_msg *msg,
                                     __u8 *ana_bcast_type, __u16 *ana_freq,
                                     __u8 *bcast_system) {
  *ana_bcast_type = msg->msg[2];
  *ana_freq = (msg->msg[3] << 8) | msg->msg[4];
  *bcast_system = msg->msg[5];
}


x86 assembly (clang, -O0):
<cec_ops_select_analogue_service>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x8(%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0xc(%rax),%ecx
shl    $0x8,%ecx
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
or     0x10(%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x14(%rax),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<cec_ops_select_analogue_service>:
mov    (%rdi),%rax
mov    0x8(%rax),%edi
mov    %edi,(%rsi)
mov    0xc(%rax),%esi
shl    $0x8,%esi
or     0x10(%rax),%esi
mov    %esi,(%rdx)
mov    0x14(%rax),%eax
mov    %eax,(%rcx)
ret

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

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