#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 */
typedef struct TYPE_7__ TYPE_3__;
typedef struct TYPE_6__ TYPE_2__;
typedef struct TYPE_5__ TYPE_1__;

/* Type definitions */
struct TYPE_5__ {
  unsigned long *l;
};
struct TYPE_6__ {
  int format;
  TYPE_1__ data;
  int /*<<< orphan*/ window;
  int /*<<< orphan*/ message_type;
  int /*<<< orphan*/ send_event;
  scalar_t__ serial;
  int /*<<< orphan*/ type;
};
struct TYPE_7__ {
  TYPE_2__ xclient;
};
typedef TYPE_3__ XEvent;
typedef int /*<<< orphan*/ Window;
typedef int /*<<< orphan*/ Display;

/* Variables and functions */
int /*<<< orphan*/ ClientMessage;
int /*<<< orphan*/ DefaultRootWindow(int /*<<< orphan*/ *);
int /*<<< orphan*/ False;
long SubstructureNotifyMask;
long SubstructureRedirectMask;
int /*<<< orphan*/ True;
int /*<<< orphan*/ XInternAtom(int /*<<< orphan*/ *, char *,
                               int /*<<< orphan*/);
scalar_t__ XSendEvent(int /*<<< orphan*/ *, int /*<<< orphan*/,
                      int /*<<< orphan*/, long, TYPE_3__ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
int send_client_msg(Display *disp, Window win, char *msg, unsigned long data0,
                    unsigned long data1, unsigned long data2,
                    unsigned long data3, unsigned long data4) {
  XEvent event;
  long mask = SubstructureRedirectMask | SubstructureNotifyMask;
  event.xclient.type = ClientMessage;
  event.xclient.serial = 0;
  event.xclient.send_event = True;
  event.xclient.message_type = XInternAtom(disp, msg, False);
  event.xclient.window = win;
  event.xclient.format = 32;
  event.xclient.data.l[0] = data0;
  event.xclient.data.l[1] = data1;
  event.xclient.data.l[2] = data2;
  event.xclient.data.l[3] = data3;
  event.xclient.data.l[4] = data4;
  if (XSendEvent(disp, DefaultRootWindow(disp), False, mask, &event)) {
    return 1;
  } else {
    fprintf(stderr, "Cannot send %s event.\n", msg);
    return 0;
  }
}


x86 assembly (clang, -O0):
<send_client_msg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
mov    0x2e4f(%rip),%rax
mov    (%rax),%rax
mov    0x2e3d(%rip),%rcx
or     (%rcx),%rax
mov    %rax,-0x70(%rbp)
mov    0x2e4f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x40(%rbp)
movq   $0x0,-0x48(%rbp)
mov    0x2e43(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x50(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    0x2e37(%rip),%rax
mov    (%rax),%edx
call   1060 <XInternAtom@plt>
mov    %eax,-0x54(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x58(%rbp)
movl   $0x20,-0x68(%rbp)
mov    -0x28(%rbp),%rcx
mov    -0x60(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x30(%rbp),%rcx
mov    -0x60(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0x38(%rbp),%rcx
mov    -0x60(%rbp),%rax
mov    %rcx,0x10(%rax)
mov    0x10(%rbp),%rcx
mov    -0x60(%rbp),%rax
mov    %rcx,0x18(%rax)
mov    0x18(%rbp),%rcx
mov    -0x60(%rbp),%rax
mov    %rcx,0x20(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <DefaultRootWindow@plt>
mov    -0x78(%rbp),%rdi
mov    %eax,%esi
mov    0x2dc7(%rip),%rax
mov    (%rax),%edx
mov    -0x70(%rbp),%rcx
lea    -0x68(%rbp),%r8
call   1030 <XSendEvent@plt>
cmp    $0x0,%rax
je     1246 <send_client_msg+0x106>
movl   $0x1,-0x4(%rbp)
jmp    1266 <send_client_msg+0x126>
mov    0x2d7b(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xda6(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_client_msg>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%eax
mov    %rdx,%rsi
mov    %eax,%edx
call   1030 <XInternAtom@plt>

LLVM IR (-O0):
%struct.TYPE_7__ = type { %struct.TYPE_6__ }
%struct.TYPE_6__ = type { i32, %struct.TYPE_5__, i32, i32, i32, i64, i32 }
%struct.TYPE_5__ = type { i64* }
@SubstructureRedirectMask = global i64 0
@SubstructureNotifyMask = global i64 0
@ClientMessage = global i32 0
@True = global i32 0
@False = global i32 0
@stderr = global i32 0
@.str = [23 x i8] c"Cannot send %s event.\0A\00"
define i32 @send_client_msg(i32* %0, i32 %1, i8* %2, i64 %3, i64 %4, i64 %5, i64 %6, i64 %7) {
%9 = alloca i32
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i64
%14 = alloca i64
%15 = alloca i64
%16 = alloca i64
%17 = alloca i64
%18 = alloca %struct.TYPE_7__
%19 = alloca i64
store i32* %0, i32** %10
store i32 %1, i32* %11
store i8* %2, i8** %12
store i64 %3, i64* %13
store i64 %4, i64* %14
store i64 %5, i64* %15
store i64 %6, i64* %16
store i64 %7, i64* %17
%20 = load i64, i64* @SubstructureRedirectMask
%21 = load i64, i64* @SubstructureNotifyMask
%22 = or i64 %20, %21
store i64 %22, i64* %19
%23 = load i32, i32* @ClientMessage
%24 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %18, i32 0, i32 0
%25 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %24, i32 0, i32 6
store i32 %23, i32* %25
%26 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %18, i32 0, i32 0
%27 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %26, i32 0, i32 5
store i64 0, i64* %27
%28 = load i32, i32* @True
%29 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %18, i32 0, i32 0
%30 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %29, i32 0, i32 4
store i32 %28, i32* %30
%31 = load i32*, i32** %10
%32 = load i8*, i8** %12
%33 = load i32, i32* @False
%34 = call i32 @XInternAtom(i32* %31, i8* %32, i32 %33)
%35 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %18, i32 0, i32 0
%36 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %35, i32 0, i32 3
store i32 %34, i32* %36
%37 = load i32, i32* %11
%38 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %18, i32 0, i32 0
%39 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %38, i32 0, i32 2
store i32 %37, i32* %39
%40 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %18, i32 0, i32 0
%41 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %40, i32 0, i32 0
store i32 32, i32* %41
%42 = load i64, i64* %13
%43 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %18, i32 0, i32 0
%44 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %43, i32 0, i32 1
%45 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %44, i32 0, i32 0
%46 = load i64*, i64** %45
%47 = getelementptr inbounds i64, i64* %46, i64 0
store i64 %42, i64* %47
%48 = load i64, i64* %14
%49 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %18, i32 0, i32 0
%50 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %49, i32 0, i32 1
%51 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %50, i32 0, i32 0
%52 = load i64*, i64** %51
%53 = getelementptr inbounds i64, i64* %52, i64 1
store i64 %48, i64* %53
%54 = load i64, i64* %15
%55 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %18, i32 0, i32 0
%56 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %55, i32 0, i32 1
%57 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %56, i32 0, i32 0
%58 = load i64*, i64** %57
%59 = getelementptr inbounds i64, i64* %58, i64 2
store i64 %54, i64* %59
%60 = load i64, i64* %16
%61 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %18, i32 0, i32 0
%62 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %61, i32 0, i32 1
%63 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %62, i32 0, i32 0
%64 = load i64*, i64** %63
%65 = getelementptr inbounds i64, i64* %64, i64 3
store i64 %60, i64* %65
%66 = load i64, i64* %17
%67 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %18, i32 0, i32 0
%68 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %67, i32 0, i32 1
%69 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %68, i32 0, i32 0
%70 = load i64*, i64** %69
%71 = getelementptr inbounds i64, i64* %70, i64 4
store i64 %66, i64* %71
%72 = load i32*, i32** %10
%73 = load i32*, i32** %10
%74 = call i32 @DefaultRootWindow(i32* %73)
%75 = load i32, i32* @False
%76 = load i64, i64* %19
%77 = call i64 @XSendEvent(i32* %72, i32 %74, i32 %75, i64 %76, %struct.TYPE_7__* %18)
%78 = icmp ne i64 %77, 0
br i1 %78, label %79, label %80
79: ; preds = %8
store i32 1, i32* %9
br label %84
80: ; preds = %8
%81 = load i32, i32* @stderr
%82 = load i8*, i8** %12
%83 = call i32 @fprintf(i32 %81, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %82)
store i32 0, i32* %9
br label %84
84: ; preds = %80, %79
%85 = load i32, i32* %9
ret i32 %85
}

LLVM IR (-O2):
@SubstructureRedirectMask = global i64 0
@SubstructureNotifyMask = global i64 0
@ClientMessage = global i32 0
@True = global i32 0
@False = global i32 0
@stderr = global i32 0
define i32 @send_client_msg(i32* %0, i32 %1, i8* %2, i64 %3, i64 %4, i64 %5, i64 %6, i64 %7) {
%9 = load i32, i32* @False
%10 = tail call i32 @XInternAtom(i32* %0, i8* %2, i32 %9)
unreachable
}