#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;
  scalar_t__ *msg;
};
typedef scalar_t__ __u8;

/* Variables and functions */
int /*<<< orphan*/ CEC_MSG_DECK_STATUS;
scalar_t__ CEC_MSG_GIVE_DECK_STATUS;
scalar_t__ CEC_OP_STATUS_REQ_OFF;
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 && status_req != CEC_OP_STATUS_REQ_OFF) ? 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    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x3,(%rax)
mov    0x2eb8(%rip),%rax
mov    (%rax),%rcx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rcx,0x8(%rax)
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rcx,0x10(%rax)
cmpl   $0x0,-0xc(%rbp)
je     116e <cec_msg_give_deck_status+0x6e>
mov    -0x18(%rbp),%rax
mov    0x2e7c(%rip),%rcx
cmp    (%rcx),%rax
je     116e <cec_msg_give_deck_status+0x6e>
mov    0x2e84(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
jmp    1178 <cec_msg_give_deck_status+0x78>
xor    %eax,%eax
mov    %eax,-0x1c(%rbp)
jmp    1178 <cec_msg_give_deck_status+0x78>
mov    -0x1c(%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),%rax
mov    0x8(%rdi),%rcx
mov    %rax,0x8(%rcx)
mov    %rdx,0x10(%rcx)
mov    0x2ead(%rip),%rcx
xor    %eax,%eax
cmp    %rdx,(%rcx)
je     1133 <cec_msg_give_deck_status+0x33>
mov    0x2eb7(%rip),%rax
mov    (%rax),%eax
test   %esi,%esi
cmove  %esi,%eax
mov    %eax,0x4(%rdi)
ret

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

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