#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;
};
typedef int /*<<< orphan*/ __u8;

/* Variables and functions */
int /*<<< orphan*/ CEC_MSG_DECK_STATUS;
int /*<<< orphan*/ CEC_MSG_GIVE_DECK_STATUS;
void cec_msg_give_deck_status(struct cec_msg *msg, int reply, __u8 status_req) {
  msg->len = 3;
  msg->msg[1] = CEC_MSG_GIVE_DECK_STATUS;
  msg->msg[2] = status_req;
  msg->reply = reply ? CEC_MSG_DECK_STATUS : 0;
}


x86 assembly (clang, -O0):
<cec_msg_give_deck_status>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x3,(%rax)
mov    0x2eb9(%rip),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0x4(%rax)
mov    -0x10(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0x8(%rax)
cmpl   $0x0,-0xc(%rbp)
je     1155 <cec_msg_give_deck_status+0x55>
mov    0x2e9d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
jmp    115f <cec_msg_give_deck_status+0x5f>
xor    %eax,%eax
mov    %eax,-0x14(%rbp)
jmp    115f <cec_msg_give_deck_status+0x5f>
mov    -0x14(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<cec_msg_give_deck_status>:
movl   $0x3,(%rdi)
mov    0x2ecb(%rip),%rax
mov    (%rax),%eax
mov    0x8(%rdi),%rcx
mov    %eax,0x4(%rcx)
mov    %edx,0x8(%rcx)
test   %esi,%esi
je     1126 <cec_msg_give_deck_status+0x26>
mov    0x2ec4(%rip),%rax
mov    (%rax),%esi
mov    %esi,0x4(%rdi)
ret

LLVM IR (-O0):
%struct.cec_msg = type { i32, i32, i32* }
@CEC_MSG_GIVE_DECK_STATUS = global i32 0
@CEC_MSG_DECK_STATUS = global i32 0
define void @cec_msg_give_deck_status(%struct.cec_msg* %0, i32 %1, i32 %2) {
%4 = alloca %struct.cec_msg*
%5 = alloca i32
%6 = alloca i32
store %struct.cec_msg* %0, %struct.cec_msg** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load %struct.cec_msg*, %struct.cec_msg** %4
%8 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %7, i32 0, i32 0
store i32 3, i32* %8
%9 = load i32, i32* @CEC_MSG_GIVE_DECK_STATUS
%10 = load %struct.cec_msg*, %struct.cec_msg** %4
%11 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %10, i32 0, i32 2
%12 = load i32*, i32** %11
%13 = getelementptr inbounds i32, i32* %12, i64 1
store i32 %9, i32* %13
%14 = load i32, i32* %6
%15 = load %struct.cec_msg*, %struct.cec_msg** %4
%16 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %15, i32 0, i32 2
%17 = load i32*, i32** %16
%18 = getelementptr inbounds i32, i32* %17, i64 2
store i32 %14, i32* %18
%19 = load i32, i32* %5
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %3
%22 = load i32, i32* @CEC_MSG_DECK_STATUS
br label %24
23: ; preds = %3
br label %24
24: ; preds = %23, %21
%25 = phi i32 [ %22, %21 ], [ 0, %23 ]
%26 = load %struct.cec_msg*, %struct.cec_msg** %4
%27 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %26, i32 0, i32 1
store i32 %25, i32* %27
ret void
}

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