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

/* Type definitions */
struct TYPE_7__ {
  int /*<<< orphan*/ flags;
};
typedef TYPE_2__ XWMHints;
struct TYPE_6__ {
  int x;
  int y;
  int width;
  int height;
};
struct TYPE_8__ {
  int type;
  TYPE_1__ xconfigure;
};
typedef TYPE_3__ XEvent;
typedef int /*<<< orphan*/ Window;
typedef int /*<<< orphan*/ Display;
typedef int /*<<< orphan*/ Atom;

/* Variables and functions */
#define ConfigureNotify 129
int /*<<< orphan*/ CopyFromParent;
#define Expose 128
int /*<<< orphan*/ False;
int /*<<< orphan*/ RootWindow(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ WhitePixel(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ XCreateWindow(int /*<<< orphan*/ *, int /*<<< orphan*/, int,
                                 int, int, int, int, int /*<<< orphan*/,
                                 int /*<<< orphan*/, int /*<<< orphan*/,
                                 int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ XFlush(int /*<<< orphan*/ *);
int /*<<< orphan*/ XInternAtom(int /*<<< orphan*/ *, char *,
                               int /*<<< orphan*/);
int /*<<< orphan*/ XMapWindow(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ XNextEvent(int /*<<< orphan*/ *, TYPE_3__ *);
int /*<<< orphan*/ *XOpenDisplay(int /*<<< orphan*/ *);
int /*<<< orphan*/ XSetWMHints(int /*<<< orphan*/ *, int /*<<< orphan*/,
                               TYPE_2__ *);
int /*<<< orphan*/ XSetWindowBackground(int /*<<< orphan*/ *,
                                        int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ XUrgencyHint;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ stderr;
int main() {
  Display *display;
  Window win;
  XEvent report;
  Atom _net_fs, _net_state;
  XEvent msg;
  int x = 50, y = 50, h = 100, w = 400;
  XWMHints hint;
  display = XOpenDisplay(NULL);
  if (display == NULL) {
    fprintf(stderr, "couldn't connect to X server :0\n");
    return 0;
  }
  _net_state = XInternAtom(display, "_NET_WM_STATE", False);
  _net_fs = XInternAtom(display, "_NET_WM_STATE_FULLSCREEN", False);
  win = XCreateWindow(display, RootWindow(display, 0), x, y, w, h, 10,
                      CopyFromParent, CopyFromParent, CopyFromParent, 0, NULL);
  XSetWindowBackground(display, win, WhitePixel(display, 0));
  XMapWindow(display, win);
  XFlush(display);
  sleep(1);
  printf("urgent on\n");
  hint.flags = XUrgencyHint;
  XSetWMHints(display, win, &hint);
  XFlush(display);
  while (1) {
    XNextEvent(display, &report);
    switch (report.type) {
    case Expose:
      printf("exposed\n");
      break;
    case ConfigureNotify:
      x = report.xconfigure.x;
      y = report.xconfigure.y;
      w = report.xconfigure.width;
      h = report.xconfigure.height;
      printf("confignotify %i,%i-%ix%i\n", x, y, w, h);
      break;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0xb8,%rsp
movl   $0x0,-0xc(%rbp)
movl   $0x32,-0x54(%rbp)
movl   $0x32,-0x58(%rbp)
movl   $0x64,-0x5c(%rbp)
movl   $0x190,-0x60(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1060 <XOpenDisplay@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1238 <main+0x68>
mov    0x2dba(%rip),%rax
mov    (%rax),%edi
lea    0xdd9(%rip),%rsi
call   1070 <fprintf@plt>
xor    %eax,%eax
add    $0xb8,%rsp
pop    %rbx
pop    %rbp
ret
mov    -0x18(%rbp),%rdi
mov    0x2da5(%rip),%rax
mov    (%rax),%edx
lea    0xdd5(%rip),%rsi
call   1090 <XInternAtom@plt>
mov    %eax,-0x38(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2d89(%rip),%rax
mov    (%rax),%edx
lea    0xdc7(%rip),%rsi
call   1090 <XInternAtom@plt>
mov    %eax,-0x34(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
call   10b0 <RootWindow@plt>
mov    -0x80(%rbp),%rdi
mov    %eax,%esi
mov    -0x54(%rbp),%edx
mov    -0x58(%rbp),%ecx
mov    -0x60(%rbp),%r8d
mov    -0x5c(%rbp),%r9d
mov    0x2d2a(%rip),%rax
mov    (%rax),%r11d
mov    0x2d20(%rip),%rax
mov    (%rax),%r10d
mov    0x2d16(%rip),%rax
mov    (%rax),%eax
xor    %ebx,%ebx
xor    %ebx,%ebx
movl   $0xa,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
movl   $0x0,0x20(%rsp)
movq   $0x0,0x28(%rsp)
call   10a0 <XCreateWindow@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
call   1050 <WhitePixel@plt>
mov    -0x78(%rbp),%rdi
mov    -0x6c(%rbp),%esi
mov    %eax,%edx
call   10e0 <XSetWindowBackground@plt>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   10d0 <XMapWindow@plt>
mov    -0x18(%rbp),%rdi
call   10c0 <XFlush@plt>
mov    $0x1,%edi
call   10f0 <sleep@plt>
lea    0xd15(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2c8f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x68(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
lea    -0x68(%rbp),%rdx
call   1040 <XSetWMHints@plt>
mov    -0x18(%rbp),%rdi
call   10c0 <XFlush@plt>
mov    -0x18(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1080 <XNextEvent@plt>
mov    -0x30(%rbp),%eax
mov    %eax,-0x84(%rbp)
sub    $0x80,%eax
je     139b <main+0x1cb>
jmp    1385 <main+0x1b5>
mov    -0x84(%rbp),%eax
sub    $0x81,%eax
je     13ae <main+0x1de>
jmp    13e1 <main+0x211>
lea    0xcb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    13e1 <main+0x211>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x58(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x60(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x54(%rbp),%esi
mov    -0x58(%rbp),%edx
mov    -0x60(%rbp),%ecx
mov    -0x5c(%rbp),%r8d
lea    0xc82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    135f <main+0x18f>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
xor    %edi,%edi
call   1070 <XOpenDisplay@plt>
test   %rax,%rax
je     1322 <main+0x142>
mov    %rax,%r14
mov    0x2de3(%rip),%rbx
mov    (%rbx),%edx
lea    0xe13(%rip),%rsi
mov    %rax,%rdi
call   10a0 <XInternAtom@plt>
mov    (%rbx),%edx
lea    0xe10(%rip),%rsi
mov    %r14,%rdi
call   10a0 <XInternAtom@plt>
mov    %r14,%rdi
xor    %esi,%esi
call   10c0 <RootWindow@plt>
mov    0x2d90(%rip),%rcx
mov    (%rcx),%ebx
mov    %r14,%rdi
mov    %eax,%esi
mov    $0x32,%edx
mov    $0x32,%ecx
mov    $0x190,%r8d
mov    $0x64,%r9d
push   $0x0
push   $0x0
push   %rbx
push   %rbx
push   %rbx
push   $0xa
call   10b0 <XCreateWindow@plt>
add    $0x30,%rsp
mov    %eax,%ebx
mov    %r14,%rdi
xor    %esi,%esi
call   1060 <WhitePixel@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   10f0 <XSetWindowBackground@plt>
mov    %r14,%rdi
mov    %ebx,%esi
call   10e0 <XMapWindow@plt>
mov    %r14,%rdi
call   10d0 <XFlush@plt>
mov    $0x1,%edi
call   1100 <sleep@plt>
lea    0xdc0(%rip),%rdi
call   1030 <puts@plt>
mov    0x2d22(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x8(%rsp)
lea    0x8(%rsp),%rdx
mov    %r14,%rdi
mov    %ebx,%esi
call   1050 <XSetWMHints@plt>
mov    %r14,%rdi
call   10d0 <XFlush@plt>
lea    0x10(%rsp),%rbx
lea    0xd71(%rip),%r15
lea    0xd8e(%rip),%r12
jmp    12fb <main+0x11b>
mov    0x14(%rsp),%esi
mov    0x18(%rsp),%edx
mov    0x1c(%rsp),%ecx
mov    0x20(%rsp),%r8d
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1090 <XNextEvent@plt>
mov    0x10(%rsp),%eax
cmp    $0x81,%eax
je     12e0 <main+0x100>
cmp    $0x80,%eax
jne    12fb <main+0x11b>
mov    %r12,%rdi
call   1030 <puts@plt>
jmp    12fb <main+0x11b>
mov    0x2caf(%rip),%rax
mov    (%rax),%edi
lea    0xcce(%rip),%rsi
call   1080 <fprintf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.TYPE_8__ = type { i32, %struct.TYPE_6__ }
%struct.TYPE_6__ = type { i32, i32, i32, i32 }
%struct.TYPE_7__ = type { i32 }
@stderr = global i32 0
@.str = [33 x i8] c"couldn't connect to X server :0\0A\00"
@.str.1 = [14 x i8] c"_NET_WM_STATE\00"
@False = global i32 0
@.str.2 = [25 x i8] c"_NET_WM_STATE_FULLSCREEN\00"
@CopyFromParent = global i32 0
@.str.3 = [11 x i8] c"urgent on\0A\00"
@XUrgencyHint = global i32 0
@.str.4 = [9 x i8] c"exposed\0A\00"
@.str.5 = [26 x i8] c"confignotify %i,%i-%ix%i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca %struct.TYPE_8__
%5 = alloca i32
%6 = alloca i32
%7 = alloca %struct.TYPE_8__
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca %struct.TYPE_7__
store i32 0, i32* %1
store i32 50, i32* %8
store i32 50, i32* %9
store i32 100, i32* %10
store i32 400, i32* %11
%13 = call i32* @XOpenDisplay(i32* null)
store i32* %13, i32** %2
%14 = load i32*, i32** %2
%15 = icmp eq i32* %14, null
br i1 %15, label %16, label %19
16: ; preds = %0
%17 = load i32, i32* @stderr
%18 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
ret i32 0
19: ; preds = %0
%20 = load i32*, i32** %2
%21 = load i32, i32* @False
%22 = call i32 @XInternAtom(i32* %20, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %21)
store i32 %22, i32* %6
%23 = load i32*, i32** %2
%24 = load i32, i32* @False
%25 = call i32 @XInternAtom(i32* %23, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %24)
store i32 %25, i32* %5
%26 = load i32*, i32** %2
%27 = load i32*, i32** %2
%28 = call i32 @RootWindow(i32* %27, i32 0)
%29 = load i32, i32* %8
%30 = load i32, i32* %9
%31 = load i32, i32* %11
%32 = load i32, i32* %10
%33 = load i32, i32* @CopyFromParent
%34 = load i32, i32* @CopyFromParent
%35 = load i32, i32* @CopyFromParent
%36 = call i32 @XCreateWindow(i32* %26, i32 %28, i32 %29, i32 %30, i32 %31, i32 %32, i32 10, i32 %33, i32 %34, i32 %35, i32 0, i32* null)
store i32 %36, i32* %3
%37 = load i32*, i32** %2
%38 = load i32, i32* %3
%39 = load i32*, i32** %2
%40 = call i32 @WhitePixel(i32* %39, i32 0)
%41 = call i32 @XSetWindowBackground(i32* %37, i32 %38, i32 %40)
%42 = load i32*, i32** %2
%43 = load i32, i32* %3
%44 = call i32 @XMapWindow(i32* %42, i32 %43)
%45 = load i32*, i32** %2
%46 = call i32 @XFlush(i32* %45)
%47 = call i32 @sleep(i32 1)
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%49 = load i32, i32* @XUrgencyHint
%50 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %12, i32 0, i32 0
store i32 %49, i32* %50
%51 = load i32*, i32** %2
%52 = load i32, i32* %3
%53 = call i32 @XSetWMHints(i32* %51, i32 %52, %struct.TYPE_7__* %12)
%54 = load i32*, i32** %2
%55 = call i32 @XFlush(i32* %54)
br label %56
56: ; preds = %19, %81
%57 = load i32*, i32** %2
%58 = call i32 @XNextEvent(i32* %57, %struct.TYPE_8__* %4)
%59 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %4, i32 0, i32 0
%60 = load i32, i32* %59
switch i32 %60, label %81 [
i32 128, label %61
i32 129, label %63
]
61: ; preds = %56
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
br label %81
63: ; preds = %56
%64 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %4, i32 0, i32 1
%65 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %64, i32 0, i32 0
%66 = load i32, i32* %65
store i32 %66, i32* %8
%67 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %4, i32 0, i32 1
%68 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %67, i32 0, i32 1
%69 = load i32, i32* %68
store i32 %69, i32* %9
%70 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %4, i32 0, i32 1
%71 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %70, i32 0, i32 2
%72 = load i32, i32* %71
store i32 %72, i32* %11
%73 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %4, i32 0, i32 1
%74 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %73, i32 0, i32 3
%75 = load i32, i32* %74
store i32 %75, i32* %10
%76 = load i32, i32* %8
%77 = load i32, i32* %9
%78 = load i32, i32* %11
%79 = load i32, i32* %10
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i32 %76, i32 %77, i32 %78, i32 %79)
br label %81
81: ; preds = %56, %63, %61
br label %56
}

LLVM IR (-O2):
%struct.TYPE_8__ = type { i32, %struct.TYPE_6__ }
%struct.TYPE_6__ = type { i32, i32, i32, i32 }
%struct.TYPE_7__ = type { i32 }
@stderr = global i32 0
@.str = [33 x i8] c"couldn't connect to X server :0\0A\00"
@.str.1 = [14 x i8] c"_NET_WM_STATE\00"
@False = global i32 0
@.str.2 = [25 x i8] c"_NET_WM_STATE_FULLSCREEN\00"
@CopyFromParent = global i32 0
@XUrgencyHint = global i32 0
@.str.5 = [26 x i8] c"confignotify %i,%i-%ix%i\0A\00"
@str = [10 x i8] c"urgent on\00"
@str.6 = [8 x i8] c"exposed\00"
define i32 @main() {
%1 = alloca %struct.TYPE_8__
%2 = alloca %struct.TYPE_7__
%3 = bitcast %struct.TYPE_8__* %1 to i8*
%4 = bitcast %struct.TYPE_7__* %2 to i8*
%5 = tail call i32* @XOpenDisplay(i32* null)
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = load i32, i32* @stderr
%9 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
ret i32 0
10: ; preds = %0
%11 = load i32, i32* @False
%12 = tail call i32 @XInternAtom(i32* %5, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = load i32, i32* @False
%14 = tail call i32 @XInternAtom(i32* %5, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %13)
%15 = tail call i32 @RootWindow(i32* %5, i32 0)
%16 = load i32, i32* @CopyFromParent
%17 = tail call i32 @XCreateWindow(i32* %5, i32 %15, i32 50, i32 50, i32 400, i32 100, i32 10, i32 %16, i32 %16, i32 %16, i32 0, i32* null)
%18 = tail call i32 @WhitePixel(i32* %5, i32 0)
%19 = tail call i32 @XSetWindowBackground(i32* %5, i32 %17, i32 %18)
%20 = tail call i32 @XMapWindow(i32* %5, i32 %17)
%21 = tail call i32 @XFlush(i32* %5)
%22 = tail call i32 @sleep(i32 1)
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
%24 = load i32, i32* @XUrgencyHint
%25 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %2, i64 0, i32 0
store i32 %24, i32* %25
%26 = call i32 @XSetWMHints(i32* %5, i32 %17, %struct.TYPE_7__* %2)
%27 = call i32 @XFlush(i32* %5)
%28 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %1, i64 0, i32 0
%29 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %1, i64 0, i32 1, i32 0
%30 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %1, i64 0, i32 1, i32 1
%31 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %1, i64 0, i32 1, i32 2
%32 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %1, i64 0, i32 1, i32 3
br label %33
33: ; preds = %36, %10
%34 = call i32 @XNextEvent(i32* %5, %struct.TYPE_8__* %1)
%35 = load i32, i32* %28
switch i32 %35, label %36 [
i32 128, label %37
i32 129, label %39
]
36: ; preds = %33, %39, %37
br label %33
37: ; preds = %33
%38 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.6, i64 0, i64 0))
br label %36
39: ; preds = %33
%40 = load i32, i32* %29
%41 = load i32, i32* %30
%42 = load i32, i32* %31
%43 = load i32, i32* %32
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i32 %40, i32 %41, i32 %42, i32 %43)
br label %36
}