#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_6__ {
  scalar_t__ *l;
};
struct TYPE_7__ {
  int format;
  TYPE_1__ data;
  int /*<<< orphan*/ window;
  int /*<<< orphan*/ *display;
  int /*<<< orphan*/ message_type;
  int /*<<< orphan*/ type;
};
struct TYPE_8__ {
  TYPE_2__ xclient;
};
typedef TYPE_3__ XEvent;
typedef int /*<<< orphan*/ Window;
typedef int /*<<< orphan*/ Display;

/* Variables and functions */
int /*<<< orphan*/ ClientMessage;
int /*<<< orphan*/ CopyFromParent;
int /*<<< orphan*/ DefaultScreen(int /*<<< orphan*/ *);
int /*<<< orphan*/ False;
scalar_t__ IconicState;
int /*<<< orphan*/ RootWindow(int /*<<< orphan*/ *, int /*<<< orphan*/);
int SubstructureNotifyMask;
int SubstructureRedirectMask;
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*/ XSendEvent(int /*<<< orphan*/ *, int /*<<< orphan*/,
                              int /*<<< orphan*/, int, TYPE_3__ *);
int /*<<< orphan*/ XSetWindowBackground(int /*<<< orphan*/ *,
                                        int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ usleep(int);
int main() {
  Display *display;
  Window win;
  XEvent report;
  XEvent msg;
  int x = 50, y = 50, h = 100, w = 400;
  display = XOpenDisplay(NULL);
  if (display == NULL) {
    fprintf(stderr, "couldn't connect to X server :0\n");
    return 0;
  }
  win = XCreateWindow(display, RootWindow(display, DefaultScreen(display)), x,
                      y, w, h, 10, CopyFromParent, CopyFromParent,
                      CopyFromParent, 0, NULL);
  XSetWindowBackground(display, win,
                       WhitePixel(display, DefaultScreen(display)));
  usleep(1000000);
  XMapWindow(display, win);
  XFlush(display);
  usleep(1000000);
  msg.xclient.type = ClientMessage;
  msg.xclient.message_type = XInternAtom(display, "WM_CHANGE_STATE", False);
  msg.xclient.display = display;
  msg.xclient.window = win;
  msg.xclient.format = 32;
  msg.xclient.data.l[0] = IconicState;
  msg.xclient.data.l[1] = 0;
  msg.xclient.data.l[2] = 0;
  msg.xclient.data.l[3] = 0;
  msg.xclient.data.l[4] = 0;
  XSendEvent(display, RootWindow(display, DefaultScreen(display)), False,
             SubstructureNotifyMask | SubstructureRedirectMask, &msg);
  while (1) {
    XNextEvent(display, &report);
  }
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0xe8,%rsp
movl   $0x0,-0xc(%rbp)
movl   $0x32,-0x74(%rbp)
movl   $0x32,-0x78(%rbp)
movl   $0x64,-0x7c(%rbp)
movl   $0x190,-0x80(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <XOpenDisplay@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1238 <main+0x68>
mov    0x2daa(%rip),%rax
mov    (%rax),%edi
lea    0xdd9(%rip),%rsi
call   1060 <fprintf@plt>
xor    %eax,%eax
add    $0xe8,%rsp
pop    %rbx
pop    %rbp
ret
mov    -0x18(%rbp),%rax
mov    %rax,-0xb0(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0xb8(%rbp)
mov    -0x18(%rbp),%rdi
call   10e0 <DefaultScreen@plt>
mov    -0xb8(%rbp),%rdi
mov    %eax,%esi
call   10a0 <RootWindow@plt>
mov    -0xb0(%rbp),%rdi
mov    %eax,%esi
mov    -0x74(%rbp),%edx
mov    -0x78(%rbp),%ecx
mov    -0x80(%rbp),%r8d
mov    -0x7c(%rbp),%r9d
mov    0x2d35(%rip),%rax
mov    (%rax),%r11d
mov    0x2d2b(%rip),%rax
mov    (%rax),%r10d
mov    0x2d21(%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   1090 <XCreateWindow@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0xa0(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x94(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0xa8(%rbp)
mov    -0x18(%rbp),%rdi
call   10e0 <DefaultScreen@plt>
mov    -0xa8(%rbp),%rdi
mov    %eax,%esi
call   1040 <WhitePixel@plt>
mov    -0xa0(%rbp),%rdi
mov    -0x94(%rbp),%esi
mov    %eax,%edx
call   10d0 <XSetWindowBackground@plt>
mov    $0xf4240,%edi
call   10f0 <usleep@plt>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   10c0 <XMapWindow@plt>
mov    -0x18(%rbp),%rdi
call   10b0 <XFlush@plt>
mov    $0xf4240,%edi
call   10f0 <usleep@plt>
mov    0x2c93(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2c93(%rip),%rax
mov    (%rax),%edx
lea    0xcc3(%rip),%rsi
call   1080 <XInternAtom@plt>
mov    %eax,-0x50(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x60(%rbp)
movl   $0x20,-0x70(%rbp)
mov    0x2c5e(%rip),%rax
mov    (%rax),%rcx
mov    -0x68(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x68(%rbp),%rax
movq   $0x0,0x8(%rax)
mov    -0x68(%rbp),%rax
movq   $0x0,0x10(%rax)
mov    -0x68(%rbp),%rax
movq   $0x0,0x18(%rax)
mov    -0x68(%rbp),%rax
movq   $0x0,0x20(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    -0x18(%rbp),%rdi
call   10e0 <DefaultScreen@plt>
mov    -0x90(%rbp),%rdi
mov    %eax,%esi
call   10a0 <RootWindow@plt>
mov    -0x88(%rbp),%rdi
mov    %eax,%esi
mov    0x2bef(%rip),%rax
mov    (%rax),%edx
mov    0x2bae(%rip),%rax
mov    (%rax),%ecx
mov    0x2bb5(%rip),%rax
or     (%rax),%ecx
lea    -0x70(%rbp),%r8
call   1030 <XSendEvent@plt>
mov    -0x18(%rbp),%rdi
lea    -0x48(%rbp),%rsi
call   1070 <XNextEvent@plt>
jmp    1416 <main+0x246>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %edi,%edi
call   1040 <XOpenDisplay@plt>
test   %rax,%rax
jne    11dd <main+0x2d>
mov    0x2e12(%rip),%rax
mov    (%rax),%edi
lea    0xe31(%rip),%rsi
call   1050 <fprintf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    %rax,%rbx
mov    %rax,%rdi
call   10c0 <DefaultScreen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1080 <RootWindow@plt>
mov    0x2dd7(%rip),%rcx
mov    (%rcx),%ebp
mov    %rbx,%rdi
mov    %eax,%esi
mov    $0x32,%edx
mov    $0x32,%ecx
mov    $0x190,%r8d
mov    $0x64,%r9d
push   $0x0
push   $0x0
push   %rbp
push   %rbp
push   %rbp
push   $0xa
call   1070 <XCreateWindow@plt>
add    $0x30,%rsp
mov    %eax,%ebp
mov    %rbx,%rdi
call   10c0 <DefaultScreen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <WhitePixel@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %eax,%edx
call   10b0 <XSetWindowBackground@plt>
mov    $0xf4240,%edi
call   10d0 <usleep@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
call   10a0 <XMapWindow@plt>
mov    %rbx,%rdi
call   1090 <XFlush@plt>
mov    $0xf4240,%edi
call   10d0 <usleep@plt>
mov    0x2d73(%rip),%rax
mov    (%rax),%edx
lea    0xda3(%rip),%rsi
mov    %rbx,%rdi
call   1060 <XInternAtom@plt>

LLVM IR (-O0):
%struct.TYPE_8__ = type { %struct.TYPE_7__ }
%struct.TYPE_7__ = type { i32, %struct.TYPE_6__, i32, i32*, i32, i32 }
%struct.TYPE_6__ = type { i64* }
@stderr = global i32 0
@.str = [33 x i8] c"couldn't connect to X server :0\0A\00"
@CopyFromParent = global i32 0
@ClientMessage = global i32 0
@.str.1 = [16 x i8] c"WM_CHANGE_STATE\00"
@False = global i32 0
@IconicState = global i64 0
@SubstructureNotifyMask = global i32 0
@SubstructureRedirectMask = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca %struct.TYPE_8__
%5 = alloca %struct.TYPE_8__
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
store i32 50, i32* %6
store i32 50, i32* %7
store i32 100, i32* %8
store i32 400, i32* %9
%10 = call i32* @XOpenDisplay(i32* null)
store i32* %10, i32** %2
%11 = load i32*, i32** %2
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %16
13: ; preds = %0
%14 = load i32, i32* @stderr
%15 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
ret i32 0
16: ; preds = %0
%17 = load i32*, i32** %2
%18 = load i32*, i32** %2
%19 = load i32*, i32** %2
%20 = call i32 @DefaultScreen(i32* %19)
%21 = call i32 @RootWindow(i32* %18, i32 %20)
%22 = load i32, i32* %6
%23 = load i32, i32* %7
%24 = load i32, i32* %9
%25 = load i32, i32* %8
%26 = load i32, i32* @CopyFromParent
%27 = load i32, i32* @CopyFromParent
%28 = load i32, i32* @CopyFromParent
%29 = call i32 @XCreateWindow(i32* %17, i32 %21, i32 %22, i32 %23, i32 %24, i32 %25, i32 10, i32 %26, i32 %27, i32 %28, i32 0, i32* null)
store i32 %29, i32* %3
%30 = load i32*, i32** %2
%31 = load i32, i32* %3
%32 = load i32*, i32** %2
%33 = load i32*, i32** %2
%34 = call i32 @DefaultScreen(i32* %33)
%35 = call i32 @WhitePixel(i32* %32, i32 %34)
%36 = call i32 @XSetWindowBackground(i32* %30, i32 %31, i32 %35)
%37 = call i32 @usleep(i32 1000000)
%38 = load i32*, i32** %2
%39 = load i32, i32* %3
%40 = call i32 @XMapWindow(i32* %38, i32 %39)
%41 = load i32*, i32** %2
%42 = call i32 @XFlush(i32* %41)
%43 = call i32 @usleep(i32 1000000)
%44 = load i32, i32* @ClientMessage
%45 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %5, i32 0, i32 0
%46 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %45, i32 0, i32 5
store i32 %44, i32* %46
%47 = load i32*, i32** %2
%48 = load i32, i32* @False
%49 = call i32 @XInternAtom(i32* %47, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %48)
%50 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %5, i32 0, i32 0
%51 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %50, i32 0, i32 4
store i32 %49, i32* %51
%52 = load i32*, i32** %2
%53 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %5, i32 0, i32 0
%54 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %53, i32 0, i32 3
store i32* %52, i32** %54
%55 = load i32, i32* %3
%56 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %5, i32 0, i32 0
%57 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %56, i32 0, i32 2
store i32 %55, i32* %57
%58 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %5, i32 0, i32 0
%59 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %58, i32 0, i32 0
store i32 32, i32* %59
%60 = load i64, i64* @IconicState
%61 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %5, i32 0, i32 0
%62 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %61, i32 0, i32 1
%63 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %62, i32 0, i32 0
%64 = load i64*, i64** %63
%65 = getelementptr inbounds i64, i64* %64, i64 0
store i64 %60, i64* %65
%66 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %5, i32 0, i32 0
%67 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %66, i32 0, i32 1
%68 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %67, i32 0, i32 0
%69 = load i64*, i64** %68
%70 = getelementptr inbounds i64, i64* %69, i64 1
store i64 0, i64* %70
%71 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %5, i32 0, i32 0
%72 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %71, i32 0, i32 1
%73 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %72, i32 0, i32 0
%74 = load i64*, i64** %73
%75 = getelementptr inbounds i64, i64* %74, i64 2
store i64 0, i64* %75
%76 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %5, i32 0, i32 0
%77 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %76, i32 0, i32 1
%78 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %77, i32 0, i32 0
%79 = load i64*, i64** %78
%80 = getelementptr inbounds i64, i64* %79, i64 3
store i64 0, i64* %80
%81 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %5, i32 0, i32 0
%82 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %81, i32 0, i32 1
%83 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %82, i32 0, i32 0
%84 = load i64*, i64** %83
%85 = getelementptr inbounds i64, i64* %84, i64 4
store i64 0, i64* %85
%86 = load i32*, i32** %2
%87 = load i32*, i32** %2
%88 = load i32*, i32** %2
%89 = call i32 @DefaultScreen(i32* %88)
%90 = call i32 @RootWindow(i32* %87, i32 %89)
%91 = load i32, i32* @False
%92 = load i32, i32* @SubstructureNotifyMask
%93 = load i32, i32* @SubstructureRedirectMask
%94 = or i32 %92, %93
%95 = call i32 @XSendEvent(i32* %86, i32 %90, i32 %91, i32 %94, %struct.TYPE_8__* %5)
br label %96
96: ; preds = %16, %96
%97 = load i32*, i32** %2
%98 = call i32 @XNextEvent(i32* %97, %struct.TYPE_8__* %4)
br label %96
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [33 x i8] c"couldn't connect to X server :0\0A\00"
@CopyFromParent = global i32 0
@ClientMessage = global i32 0
@.str.1 = [16 x i8] c"WM_CHANGE_STATE\00"
@False = global i32 0
@IconicState = global i64 0
@SubstructureNotifyMask = global i32 0
@SubstructureRedirectMask = global i32 0
define i32 @main() {
%1 = tail call i32* @XOpenDisplay(i32* null)
%2 = icmp eq i32* %1, null
br i1 %2, label %3, label %6
3: ; preds = %0
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
ret i32 0
6: ; preds = %0
%7 = tail call i32 @DefaultScreen(i32* %1)
%8 = tail call i32 @RootWindow(i32* %1, i32 %7)
%9 = load i32, i32* @CopyFromParent
%10 = tail call i32 @XCreateWindow(i32* %1, i32 %8, i32 50, i32 50, i32 400, i32 100, i32 10, i32 %9, i32 %9, i32 %9, i32 0, i32* null)
%11 = tail call i32 @DefaultScreen(i32* %1)
%12 = tail call i32 @WhitePixel(i32* %1, i32 %11)
%13 = tail call i32 @XSetWindowBackground(i32* %1, i32 %10, i32 %12)
%14 = tail call i32 @usleep(i32 1000000)
%15 = tail call i32 @XMapWindow(i32* %1, i32 %10)
%16 = tail call i32 @XFlush(i32* %1)
%17 = tail call i32 @usleep(i32 1000000)
%18 = load i32, i32* @False
%19 = tail call i32 @XInternAtom(i32* %1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %18)
unreachable
}