#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 */
typedef int /*<<< orphan*/ Window;
typedef int /*<<< orphan*/ Display;
typedef scalar_t__ Atom;

/* Variables and functions */
int /*<<< orphan*/ PropModeReplace;
int /*<<< orphan*/ True;
int /*<<< orphan*/ XChangeProperty(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                   scalar_t__, scalar_t__, int,
                                   int /*<<< orphan*/, unsigned char *,
                                   int const);
scalar_t__ XInternAtom(int /*<<< orphan*/ *, char *, int /*<<< orphan*/);
void no_border(Display *dpy, Window w) {
  static const unsigned MWM_HINTS_DECORATIONS = (1 << 1);
  static const int PROP_MOTIF_WM_HINTS_ELEMENTS = 5;
  typedef struct {
    unsigned long flags;
    unsigned long functions;
    unsigned long decorations;
    long inputMode;
    unsigned long status;
  } PropMotifWmHints;
  PropMotifWmHints motif_hints;
  Atom prop, proptype;
  unsigned long flags = 0;
  motif_hints.flags = MWM_HINTS_DECORATIONS;
  motif_hints.decorations = flags;
  prop = XInternAtom(dpy, "_MOTIF_WM_HINTS", True);
  if (!prop) {
    return;
  }
  proptype = prop;
  XChangeProperty(dpy, w, prop, proptype, 32, PropModeReplace,
                  (unsigned char *)&motif_hints, PROP_MOTIF_WM_HINTS_ELEMENTS);
}


x86 assembly (clang, -O0):
<no_border>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movq   $0x0,-0x50(%rbp)
movq   $0x2,-0x38(%rbp)
mov    -0x50(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e96(%rip),%rax
mov    (%rax),%edx
lea    0xead(%rip),%rsi
call   1030 <XInternAtom@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    1174 <no_border+0x54>
jmp    11b0 <no_border+0x90>
mov    -0x40(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x40(%rbp),%rdx
mov    -0x48(%rbp),%rcx
mov    0x2e46(%rip),%rax
mov    (%rax),%r9d
lea    -0x38(%rbp),%rax
mov    $0x20,%r8d
mov    %rax,(%rsp)
movl   $0x5,0x8(%rsp)
call   1040 <XChangeProperty@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<no_border>:
push   %rbp
push   %rbx
sub    $0x28,%rsp
mov    %esi,%ebp
mov    %rdi,%rbx
movq   $0x2,(%rsp)
movq   $0x0,0x10(%rsp)
mov    0x2ea5(%rip),%rax
mov    (%rax),%edx
lea    0xeb4(%rip),%rsi
call   1030 <XInternAtom@plt>
test   %rax,%rax
je     1181 <no_border+0x61>
mov    0x2e7b(%rip),%rcx
mov    (%rcx),%r9d
mov    %rsp,%r10
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %rax,%rdx
mov    %rax,%rcx
mov    $0x20,%r8d
push   $0x5
push   %r10
call   1040 <XChangeProperty@plt>
add    $0x10,%rsp
add    $0x28,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.PropMotifWmHints = type { i64, i64, i64, i64, i64 }
@no_border.MWM_HINTS_DECORATIONS = internal constant i32 2
@no_border.PROP_MOTIF_WM_HINTS_ELEMENTS = internal constant i32 5
@.str = [16 x i8] c"_MOTIF_WM_HINTS\00"
@True = global i32 0
@PropModeReplace = global i32 0
define void @no_border(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca %struct.PropMotifWmHints
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
store i32* %0, i32** %3
store i32 %1, i32* %4
store i64 0, i64* %8
%9 = getelementptr inbounds %struct.PropMotifWmHints, %struct.PropMotifWmHints* %5, i32 0, i32 0
store i64 2, i64* %9
%10 = load i64, i64* %8
%11 = getelementptr inbounds %struct.PropMotifWmHints, %struct.PropMotifWmHints* %5, i32 0, i32 2
store i64 %10, i64* %11
%12 = load i32*, i32** %3
%13 = load i32, i32* @True
%14 = call i64 @XInternAtom(i32* %12, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %13)
store i64 %14, i64* %6
%15 = load i64, i64* %6
%16 = icmp ne i64 %15, 0
br i1 %16, label %18, label %17
17: ; preds = %2
br label %27
18: ; preds = %2
%19 = load i64, i64* %6
store i64 %19, i64* %7
%20 = load i32*, i32** %3
%21 = load i32, i32* %4
%22 = load i64, i64* %6
%23 = load i64, i64* %7
%24 = load i32, i32* @PropModeReplace
%25 = bitcast %struct.PropMotifWmHints* %5 to i8*
%26 = call i32 @XChangeProperty(i32* %20, i32 %21, i64 %22, i64 %23, i32 32, i32 %24, i8* %25, i32 5)
br label %27
27: ; preds = %18, %17
ret void
}

LLVM IR (-O2):
%struct.PropMotifWmHints = type { i64, i64, i64, i64, i64 }
@.str = [16 x i8] c"_MOTIF_WM_HINTS\00"
@True = global i32 0
@PropModeReplace = global i32 0
define void @no_border(i32* %0, i32 %1) {
%3 = alloca %struct.PropMotifWmHints
%4 = bitcast %struct.PropMotifWmHints* %3 to i8*
%5 = getelementptr inbounds %struct.PropMotifWmHints, %struct.PropMotifWmHints* %3, i64 0, i32 0
store i64 2, i64* %5
%6 = getelementptr inbounds %struct.PropMotifWmHints, %struct.PropMotifWmHints* %3, i64 0, i32 2
store i64 0, i64* %6
%7 = load i32, i32* @True
%8 = tail call i64 @XInternAtom(i32* %0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %2
%11 = load i32, i32* @PropModeReplace
%12 = call i32 @XChangeProperty(i32* %0, i32 %1, i64 %8, i64 %8, i32 32, i32 %11, i8* %4, i32 5)
br label %13
13: ; preds = %2, %10
ret void
}