#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_op_digital_service_id {
  int dummy;
};
struct cec_msg {
  int len;
  int /*<<< orphan*/ *msg;
};

/* Variables and functions */
int /*<<< orphan*/ CEC_MSG_SELECT_DIGITAL_SERVICE;
int /*<<< orphan*/
cec_set_digital_service_id(int /*<<< orphan*/ *,
                           struct cec_op_digital_service_id const *);
void cec_msg_select_digital_service(
    struct cec_msg *msg, const struct cec_op_digital_service_id *digital) {
  msg->len = 9;
  msg->msg[1] = CEC_MSG_SELECT_DIGITAL_SERVICE;
  cec_set_digital_service_id(msg->msg + 2, digital);
}


x86 assembly (clang, -O0):
<cec_msg_select_digital_service>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x9,(%rax)
mov    0x2ebf(%rip),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0x4(%rax)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rdi
add    $0x8,%rdi
mov    -0x10(%rbp),%rsi
call   1030 <cec_set_digital_service_id@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cec_msg_select_digital_service>:
movl   $0x9,(%rdi)
mov    0x2ed3(%rip),%rax
mov    (%rax),%eax
mov    0x8(%rdi),%rdi
mov    %eax,0x4(%rdi)
add    $0x8,%rdi
jmp    1030 <cec_set_digital_service_id@plt>

LLVM IR (-O0):
%struct.cec_msg = type { i32, i32* }
%struct.cec_op_digital_service_id = type { i32 }
@CEC_MSG_SELECT_DIGITAL_SERVICE = global i32 0
define void @cec_msg_select_digital_service(%struct.cec_msg* %0, %struct.cec_op_digital_service_id* %1) {
%3 = alloca %struct.cec_msg*
%4 = alloca %struct.cec_op_digital_service_id*
store %struct.cec_msg* %0, %struct.cec_msg** %3
store %struct.cec_op_digital_service_id* %1, %struct.cec_op_digital_service_id** %4
%5 = load %struct.cec_msg*, %struct.cec_msg** %3
%6 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %5, i32 0, i32 0
store i32 9, i32* %6
%7 = load i32, i32* @CEC_MSG_SELECT_DIGITAL_SERVICE
%8 = load %struct.cec_msg*, %struct.cec_msg** %3
%9 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %8, i32 0, i32 1
%10 = load i32*, i32** %9
%11 = getelementptr inbounds i32, i32* %10, i64 1
store i32 %7, i32* %11
%12 = load %struct.cec_msg*, %struct.cec_msg** %3
%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 2
%16 = load %struct.cec_op_digital_service_id*, %struct.cec_op_digital_service_id** %4
%17 = call i32 @cec_set_digital_service_id(i32* %15, %struct.cec_op_digital_service_id* %16)
ret void
}

LLVM IR (-O2):
%struct.cec_msg = type { i32, i32* }
%struct.cec_op_digital_service_id = type { i32 }
@CEC_MSG_SELECT_DIGITAL_SERVICE = global i32 0
define void @cec_msg_select_digital_service(%struct.cec_msg* nocapture %0, %struct.cec_op_digital_service_id* %1) {
%3 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %0, i64 0, i32 0
store i32 9, i32* %3
%4 = load i32, i32* @CEC_MSG_SELECT_DIGITAL_SERVICE
%5 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %0, i64 0, i32 1
%6 = load i32*, i32** %5
%7 = getelementptr inbounds i32, i32* %6, i64 1
store i32 %4, i32* %7
%8 = getelementptr inbounds i32, i32* %6, i64 2
%9 = tail call i32 @cec_set_digital_service_id(i32* %8, %struct.cec_op_digital_service_id* %1)
ret void
}