#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 /*<<< orphan*/ reply;
  int /*<<< orphan*/ *msg;
};

/* Variables and functions */
int /*<<< orphan*/ CEC_MSG_RECORD_ON;
int /*<<< orphan*/ CEC_MSG_RECORD_TV_SCREEN;
void cec_msg_record_tv_screen(struct cec_msg *msg, int reply) {
  msg->len = 2;
  msg->msg[1] = CEC_MSG_RECORD_TV_SCREEN;
  msg->reply = reply ? CEC_MSG_RECORD_ON : 0;
}


x86 assembly (clang, -O0):
<cec_msg_record_tv_screen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x2,(%rax)
mov    0x2ecc(%rip),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0x4(%rax)
cmpl   $0x0,-0xc(%rbp)
je     1144 <cec_msg_record_tv_screen+0x44>
mov    0x2e9e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
jmp    114e <cec_msg_record_tv_screen+0x4e>
xor    %eax,%eax
mov    %eax,-0x10(%rbp)
jmp    114e <cec_msg_record_tv_screen+0x4e>
mov    -0x10(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<cec_msg_record_tv_screen>:
movl   $0x2,(%rdi)
mov    0x2edb(%rip),%rax
mov    (%rax),%eax
mov    0x8(%rdi),%rcx
mov    %eax,0x4(%rcx)
test   %esi,%esi
je     1123 <cec_msg_record_tv_screen+0x23>
mov    0x2eb7(%rip),%rax
mov    (%rax),%esi
mov    %esi,0x4(%rdi)
ret

LLVM IR (-O0):
%struct.cec_msg = type { i32, i32, i32* }
@CEC_MSG_RECORD_TV_SCREEN = global i32 0
@CEC_MSG_RECORD_ON = global i32 0
define void @cec_msg_record_tv_screen(%struct.cec_msg* %0, i32 %1) {
%3 = alloca %struct.cec_msg*
%4 = alloca i32
store %struct.cec_msg* %0, %struct.cec_msg** %3
store i32 %1, i32* %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 2, i32* %6
%7 = load i32, i32* @CEC_MSG_RECORD_TV_SCREEN
%8 = load %struct.cec_msg*, %struct.cec_msg** %3
%9 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %8, i32 0, i32 2
%10 = load i32*, i32** %9
%11 = getelementptr inbounds i32, i32* %10, i64 1
store i32 %7, i32* %11
%12 = load i32, i32* %4
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = load i32, i32* @CEC_MSG_RECORD_ON
br label %17
16: ; preds = %2
br label %17
17: ; preds = %16, %14
%18 = phi i32 [ %15, %14 ], [ 0, %16 ]
%19 = load %struct.cec_msg*, %struct.cec_msg** %3
%20 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %19, i32 0, i32 1
store i32 %18, i32* %20
ret void
}

LLVM IR (-O2):
%struct.cec_msg = type { i32, i32, i32* }
@CEC_MSG_RECORD_TV_SCREEN = global i32 0
@CEC_MSG_RECORD_ON = global i32 0
define void @cec_msg_record_tv_screen(%struct.cec_msg* nocapture %0, i32 %1) {
%3 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %0, i64 0, i32 0
store i32 2, i32* %3
%4 = load i32, i32* @CEC_MSG_RECORD_TV_SCREEN
%5 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %0, i64 0, i32 2
%6 = load i32*, i32** %5
%7 = getelementptr inbounds i32, i32* %6, i64 1
store i32 %4, i32* %7
%8 = icmp eq i32 %1, 0
%9 = load i32, i32* @CEC_MSG_RECORD_ON
%10 = select i1 %8, i32 0, i32 %9
%11 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %0, i64 0, i32 1
store i32 %10, i32* %11
ret void
}