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

/* Variables and functions */
int /*<<< orphan*/ CEC_MSG_FEATURE_ABORT;
int /*<<< orphan*/ cec_msg_set_reply_to(struct cec_msg *, struct cec_msg *);
void cec_msg_reply_feature_abort(struct cec_msg *msg, __u8 reason) {
  cec_msg_set_reply_to(msg, msg);
  msg->len = 4;
  msg->msg[2] = msg->msg[1];
  msg->msg[3] = reason;
  msg->msg[1] = CEC_MSG_FEATURE_ABORT;
}


x86 assembly (clang, -O0):
<cec_msg_reply_feature_abort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <cec_msg_set_reply_to@plt>
mov    -0x8(%rbp),%rax
movl   $0x4,(%rax)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    0x4(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0x8(%rax)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0xc(%rax)
mov    0x2e87(%rip),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0x4(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cec_msg_reply_feature_abort>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
mov    %rdi,%rsi
call   1030 <cec_msg_set_reply_to@plt>
movl   $0x4,(%rbx)
mov    0x8(%rbx),%rax
mov    0x4(%rax),%ecx
mov    %ecx,0x8(%rax)
mov    %ebp,0xc(%rax)
mov    0x2eae(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,0x4(%rax)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
%struct.cec_msg = type { i32, i32* }
@CEC_MSG_FEATURE_ABORT = global i32 0
define void @cec_msg_reply_feature_abort(%struct.cec_msg* %0, i32 %1) {
%3 = tail call i32 @cec_msg_set_reply_to(%struct.cec_msg* %0, %struct.cec_msg* %0)
%4 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %0, i64 0, i32 0
store i32 4, i32* %4
%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
%8 = load i32, i32* %7
%9 = getelementptr inbounds i32, i32* %6, i64 2
store i32 %8, i32* %9
%10 = getelementptr inbounds i32, i32* %6, i64 3
store i32 %1, i32* %10
%11 = load i32, i32* @CEC_MSG_FEATURE_ABORT
store i32 %11, i32* %7
ret void
}