#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;
};

/* Variables and functions */
int CEC_MSG_SET_MENU_LANGUAGE;
int /*<<< orphan*/ memcpy(int *, char const *, int);
void cec_msg_set_menu_language(struct cec_msg *msg, const char *language) {
  msg->len = 5;
  msg->msg[0] |= 0xf;
  msg->msg[1] = CEC_MSG_SET_MENU_LANGUAGE;
  memcpy(msg->msg + 2, language, 3);
}


x86 assembly (clang, -O0):
<cec_msg_set_menu_language>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x5,(%rax)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%ecx
or     $0xf,%ecx
mov    %ecx,(%rax)
mov    0x2eb8(%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
mov    $0x3,%edx
call   1030 <memcpy@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cec_msg_set_menu_language>:
movl   $0x5,(%rdi)
mov    0x8(%rdi),%rdi
orl    $0xf,(%rdi)
mov    0x2ed4(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x4(%rdi)
add    $0x8,%rdi
mov    $0x3,%edx
jmp    1030 <memcpy@plt>

LLVM IR (-O0):
%struct.cec_msg = type { i32, i32* }
@CEC_MSG_SET_MENU_LANGUAGE = global i32 0
define void @cec_msg_set_menu_language(%struct.cec_msg* %0, i8* %1) {
%3 = alloca %struct.cec_msg*
%4 = alloca i8*
store %struct.cec_msg* %0, %struct.cec_msg** %3
store i8* %1, i8** %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 5, i32* %6
%7 = load %struct.cec_msg*, %struct.cec_msg** %3
%8 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %7, i32 0, i32 1
%9 = load i32*, i32** %8
%10 = getelementptr inbounds i32, i32* %9, i64 0
%11 = load i32, i32* %10
%12 = or i32 %11, 15
store i32 %12, i32* %10
%13 = load i32, i32* @CEC_MSG_SET_MENU_LANGUAGE
%14 = load %struct.cec_msg*, %struct.cec_msg** %3
%15 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %14, i32 0, i32 1
%16 = load i32*, i32** %15
%17 = getelementptr inbounds i32, i32* %16, i64 1
store i32 %13, i32* %17
%18 = load %struct.cec_msg*, %struct.cec_msg** %3
%19 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %18, i32 0, i32 1
%20 = load i32*, i32** %19
%21 = getelementptr inbounds i32, i32* %20, i64 2
%22 = load i8*, i8** %4
%23 = call i32 @memcpy(i32* %21, i8* %22, i32 3)
ret void
}

LLVM IR (-O2):
%struct.cec_msg = type { i32, i32* }
@CEC_MSG_SET_MENU_LANGUAGE = global i32 0
define void @cec_msg_set_menu_language(%struct.cec_msg* nocapture %0, i8* %1) {
%3 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %0, i64 0, i32 0
store i32 5, i32* %3
%4 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %0, i64 0, i32 1
%5 = load i32*, i32** %4
%6 = load i32, i32* %5
%7 = or i32 %6, 15
store i32 %7, i32* %5
%8 = load i32, i32* @CEC_MSG_SET_MENU_LANGUAGE
%9 = getelementptr inbounds i32, i32* %5, i64 1
store i32 %8, i32* %9
%10 = getelementptr inbounds i32, i32* %5, i64 2
%11 = tail call i32 @memcpy(i32* %10, i8* %1, i32 3)
ret void
}