#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_cdc_hec_set_state_adjacent(const struct cec_msg *msg,
                                        __u16 *phys_addr, __u16 *phys_addr1,
                                        __u8 *hec_set_state) {
  *phys_addr = (msg->msg[2] << 8) | msg->msg[3];
  *phys_addr1 = (msg->msg[5] << 8) | msg->msg[6];
  *hec_set_state = msg->msg[7];
}


x86 assembly (clang, -O0):
<cec_ops_cdc_hec_set_state_adjacent>:
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
shl    $0x8,%ecx
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
or     0xc(%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x14(%rax),%ecx
shl    $0x8,%ecx
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
or     0x18(%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x1c(%rax),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.cec_msg = type { i32* }
define void @cec_ops_cdc_hec_set_state_adjacent(%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 = shl i32 %13, 8
%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 = or i32 %14, %19
%21 = load i32*, i32** %6
store i32 %20, i32* %21
%22 = load %struct.cec_msg*, %struct.cec_msg** %5
%23 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %22, i32 0, i32 0
%24 = load i32*, i32** %23
%25 = getelementptr inbounds i32, i32* %24, i64 5
%26 = load i32, i32* %25
%27 = shl i32 %26, 8
%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 6
%32 = load i32, i32* %31
%33 = or i32 %27, %32
%34 = load i32*, i32** %7
store i32 %33, i32* %34
%35 = load %struct.cec_msg*, %struct.cec_msg** %5
%36 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %35, i32 0, i32 0
%37 = load i32*, i32** %36
%38 = getelementptr inbounds i32, i32* %37, i64 7
%39 = load i32, i32* %38
%40 = load i32*, i32** %8
store i32 %39, i32* %40
ret void
}

LLVM IR (-O2):
%struct.cec_msg = type { i32* }
define void @cec_ops_cdc_hec_set_state_adjacent(%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
%9 = shl i32 %8, 8
%10 = getelementptr inbounds i32, i32* %6, i64 3
%11 = load i32, i32* %10
%12 = or i32 %9, %11
store i32 %12, i32* %1
%13 = getelementptr inbounds i32, i32* %6, i64 5
%14 = load i32, i32* %13
%15 = shl i32 %14, 8
%16 = getelementptr inbounds i32, i32* %6, i64 6
%17 = load i32, i32* %16
%18 = or i32 %15, %17
store i32 %18, i32* %2
%19 = getelementptr inbounds i32, i32* %6, i64 7
%20 = load i32, i32* %19
store i32 %20, i32* %3
ret void
}