#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_report_current_latency(const struct cec_msg *msg, __u16 *phys_addr,
                                    __u8 *video_latency, __u8 *low_latency_mode,
                                    __u8 *audio_out_compensated,
                                    __u8 *audio_out_delay) {
  *phys_addr = (msg->msg[2] << 8) | msg->msg[3];
  *video_latency = msg->msg[4];
  *low_latency_mode = (msg->msg[5] >> 2) & 1;
  *audio_out_compensated = msg->msg[5] & 3;
  *audio_out_delay = msg->msg[6];
}


x86 assembly (clang, -O0):
<cec_ops_report_current_latency>:
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    %r9,-0x30(%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    0x10(%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x14(%rax),%ecx
sar    $0x2,%ecx
and    $0x1,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x14(%rax),%ecx
and    $0x3,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x18(%rax),%ecx
mov    -0x30(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<cec_ops_report_current_latency>:
mov    (%rdi),%rax
mov    0x8(%rax),%edi
shl    $0x8,%edi
or     0xc(%rax),%edi
mov    %edi,(%rsi)
mov    0x10(%rax),%esi
mov    %esi,(%rdx)
mov    0x14(%rax),%edx
shr    $0x2,%edx
and    $0x1,%edx
mov    %edx,(%rcx)
mov    0x14(%rax),%ecx
and    $0x3,%ecx
mov    %ecx,(%r8)
mov    0x18(%rax),%eax
mov    %eax,(%r9)
ret

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

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