#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_5__ TYPE_1__;

/* Type definitions */
struct TYPE_5__ {
  int /*<<< orphan*/ window_group;
  int /*<<< orphan*/ flags;
};
typedef TYPE_1__ XWMHints;
typedef int /*<<< orphan*/ XEvent;
typedef int /*<<< orphan*/ Window;
typedef int /*<<< orphan*/ Display;

/* Variables and functions */
int /*<<< orphan*/ BlackPixel(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ CopyFromParent;
int /*<<< orphan*/ RootWindow(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ WhitePixel(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ WindowGroupHint;
TYPE_1__ *XAllocWMHints();
int /*<<< orphan*/ XCreateWindow(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                 int /*<<< orphan*/, int /*<<< orphan*/, int,
                                 int, int, int /*<<< orphan*/,
                                 int /*<<< orphan*/, int /*<<< orphan*/,
                                 int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ XFlush(int /*<<< orphan*/ *);
int /*<<< orphan*/ XFree(TYPE_1__ *);
int /*<<< orphan*/ XMapWindow(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ XNextEvent(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ *XOpenDisplay(int /*<<< orphan*/ *);
int /*<<< orphan*/ XSetTransientForHint(int /*<<< orphan*/ *,
                                        int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ XSetWMHints(int /*<<< orphan*/ *, int /*<<< orphan*/,
                               TYPE_1__ *);
int /*<<< orphan*/ XSetWindowBackground(int /*<<< orphan*/ *,
                                        int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int main() {
  Display *display;
  Window one, two, group;
  XEvent report;
  XWMHints *wmhints;
  display = XOpenDisplay(NULL);
  if (display == NULL) {
    fprintf(stderr, "couldn't connect to X server :0\n");
    return 0;
  }
  group = XCreateWindow(display, RootWindow(display, 0), 0, 0, 1, 1, 10,
                        CopyFromParent, CopyFromParent, CopyFromParent, 0, 0);
  one = XCreateWindow(display, RootWindow(display, 0), 0, 0, 100, 100, 10,
                      CopyFromParent, CopyFromParent, CopyFromParent, 0, 0);
  two = XCreateWindow(display, RootWindow(display, 0), 0, 0, 100, 100, 10,
                      CopyFromParent, CopyFromParent, CopyFromParent, 0, 0);
  XSetWindowBackground(display, one, WhitePixel(display, 0));
  XSetWindowBackground(display, two, BlackPixel(display, 0));
  XSetTransientForHint(display, two, RootWindow(display, 0));
  wmhints = XAllocWMHints();
  wmhints->flags = WindowGroupHint;
  wmhints->window_group = group;
  XSetWMHints(display, one, wmhints);
  XSetWMHints(display, two, wmhints);
  XFree(wmhints);
  XMapWindow(display, one);
  XMapWindow(display, two);
  XFlush(display);
  while (1) {
    XNextEvent(display, &report);
  }
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1070 <XOpenDisplay@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    122a <main+0x4a>
mov    0x2dc7(%rip),%rax
mov    (%rax),%edi
lea    0xde6(%rip),%rsi
call   1080 <fprintf@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret
mov    -0x10(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
call   10c0 <RootWindow@plt>
mov    -0x70(%rbp),%rdi
mov    %eax,%esi
mov    0x2d86(%rip),%rax
mov    (%rax),%r11d
mov    0x2d7c(%rip),%rax
mov    (%rax),%r10d
mov    0x2d72(%rip),%rax
mov    (%rax),%eax
xor    %ecx,%ecx
mov    $0x1,%r9d
mov    %ecx,%edx
mov    %r9d,%r8d
movl   $0xa,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
movl   $0x0,0x20(%rsp)
movl   $0x0,0x28(%rsp)
call   10b0 <XCreateWindow@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
call   10c0 <RootWindow@plt>
mov    -0x68(%rbp),%rdi
mov    %eax,%esi
mov    0x2d16(%rip),%rax
mov    (%rax),%r11d
mov    0x2d0c(%rip),%rax
mov    (%rax),%r10d
mov    0x2d02(%rip),%rax
mov    (%rax),%eax
xor    %ecx,%ecx
mov    $0x64,%r9d
mov    %ecx,%edx
mov    %r9d,%r8d
movl   $0xa,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
movl   $0x0,0x20(%rsp)
movl   $0x0,0x28(%rsp)
call   10b0 <XCreateWindow@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
call   10c0 <RootWindow@plt>
mov    -0x60(%rbp),%rdi
mov    %eax,%esi
mov    0x2ca6(%rip),%rax
mov    (%rax),%r11d
mov    0x2c9c(%rip),%rax
mov    (%rax),%r10d
mov    0x2c92(%rip),%rax
mov    (%rax),%eax
xor    %ecx,%ecx
mov    $0x64,%r9d
mov    %ecx,%edx
mov    %r9d,%r8d
movl   $0xa,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
movl   $0x0,0x20(%rsp)
movl   $0x0,0x28(%rsp)
call   10b0 <XCreateWindow@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
call   1060 <WhitePixel@plt>
mov    -0x58(%rbp),%rdi
mov    -0x4c(%rbp),%esi
mov    %eax,%edx
call   1100 <XSetWindowBackground@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
call   10d0 <BlackPixel@plt>
mov    -0x48(%rbp),%rdi
mov    -0x3c(%rbp),%esi
mov    %eax,%edx
call   1100 <XSetWindowBackground@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
call   10c0 <RootWindow@plt>
mov    -0x38(%rbp),%rdi
mov    -0x2c(%rbp),%esi
mov    %eax,%edx
call   1030 <XSetTransientForHint@plt>
mov    $0x0,%al
call   1090 <XAllocWMHints@plt>
mov    %rax,-0x28(%rbp)
mov    0x2bef(%rip),%rax
mov    (%rax),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x1c(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x28(%rbp),%rdx
call   1050 <XSetWMHints@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x28(%rbp),%rdx
call   1050 <XSetWMHints@plt>
mov    -0x28(%rbp),%rdi
call   1040 <XFree@plt>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   10f0 <XMapWindow@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   10f0 <XMapWindow@plt>
mov    -0x10(%rbp),%rdi
call   10e0 <XFlush@plt>
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   10a0 <XNextEvent@plt>
jmp    145d <main+0x27d>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
xor    %edi,%edi
call   1070 <XOpenDisplay@plt>
test   %rax,%rax
je     136d <main+0x18d>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
call   10c0 <RootWindow@plt>
mov    0x2dc0(%rip),%r12
mov    (%r12),%ebp
mov    %rbx,%rdi
mov    %eax,%esi
xor    %edx,%edx
xor    %ecx,%ecx
mov    $0x1,%r8d
mov    $0x1,%r9d
push   $0x0
push   $0x0
push   %rbp
push   %rbp
push   %rbp
push   $0xa
call   10b0 <XCreateWindow@plt>
add    $0x30,%rsp
mov    %eax,%r14d
mov    %rbx,%rdi
xor    %esi,%esi
call   10c0 <RootWindow@plt>
mov    (%r12),%ebp
mov    %rbx,%rdi
mov    %eax,%esi
xor    %edx,%edx
xor    %ecx,%ecx
mov    $0x64,%r8d
mov    $0x64,%r9d
push   $0x0
push   $0x0
push   %rbp
push   %rbp
push   %rbp
push   $0xa
call   10b0 <XCreateWindow@plt>
add    $0x30,%rsp
mov    %eax,%r15d
mov    %rbx,%rdi
xor    %esi,%esi
call   10c0 <RootWindow@plt>
mov    (%r12),%ebp
mov    %rbx,%rdi
mov    %eax,%esi
xor    %edx,%edx
xor    %ecx,%ecx
mov    $0x64,%r8d
mov    $0x64,%r9d
push   $0x0
push   $0x0
push   %rbp
push   %rbp
push   %rbp
push   $0xa
call   10b0 <XCreateWindow@plt>
add    $0x30,%rsp
mov    %eax,%r12d
mov    %rbx,%rdi
xor    %esi,%esi
call   1060 <WhitePixel@plt>
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %eax,%edx
call   1100 <XSetWindowBackground@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   10d0 <BlackPixel@plt>
mov    %rbx,%rdi
mov    %r12d,%esi
mov    %eax,%edx
call   1100 <XSetWindowBackground@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   10c0 <RootWindow@plt>
mov    %rbx,%rdi
mov    %r12d,%esi
mov    %eax,%edx
call   1030 <XSetTransientForHint@plt>
xor    %eax,%eax
call   1090 <XAllocWMHints@plt>
mov    %rax,%rbp
mov    0x2cec(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x4(%rbp)
mov    %r14d,0x0(%rbp)
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %rbp,%rdx
call   1050 <XSetWMHints@plt>
mov    %rbx,%rdi
mov    %r12d,%esi
mov    %rbp,%rdx
call   1050 <XSetWMHints@plt>
mov    %rbp,%rdi
call   1040 <XFree@plt>
mov    %rbx,%rdi
mov    %r15d,%esi
call   10f0 <XMapWindow@plt>
mov    %rbx,%rdi
mov    %r12d,%esi
call   10f0 <XMapWindow@plt>
mov    %rbx,%rdi
call   10e0 <XFlush@plt>
lea    0xc(%rsp),%rbp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
mov    %rbp,%rsi
call   10a0 <XNextEvent@plt>
jmp    1360 <main+0x180>
mov    0x2c64(%rip),%rax
mov    (%rax),%edi
lea    0xc83(%rip),%rsi
call   1080 <fprintf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
%struct.TYPE_5__ = type { i32, i32 }
@stderr = global i32 0
@.str = [33 x i8] c"couldn't connect to X server :0\0A\00"
@CopyFromParent = global i32 0
@WindowGroupHint = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32* @XOpenDisplay(i32* null)
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %8
5: ; preds = %0
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
ret i32 0
8: ; preds = %0
%9 = tail call i32 @RootWindow(i32* %3, i32 0)
%10 = load i32, i32* @CopyFromParent
%11 = tail call i32 @XCreateWindow(i32* %3, i32 %9, i32 0, i32 0, i32 1, i32 1, i32 10, i32 %10, i32 %10, i32 %10, i32 0, i32 0)
%12 = tail call i32 @RootWindow(i32* %3, i32 0)
%13 = load i32, i32* @CopyFromParent
%14 = tail call i32 @XCreateWindow(i32* %3, i32 %12, i32 0, i32 0, i32 100, i32 100, i32 10, i32 %13, i32 %13, i32 %13, i32 0, i32 0)
%15 = tail call i32 @RootWindow(i32* %3, i32 0)
%16 = load i32, i32* @CopyFromParent
%17 = tail call i32 @XCreateWindow(i32* %3, i32 %15, i32 0, i32 0, i32 100, i32 100, i32 10, i32 %16, i32 %16, i32 %16, i32 0, i32 0)
%18 = tail call i32 @WhitePixel(i32* %3, i32 0)
%19 = tail call i32 @XSetWindowBackground(i32* %3, i32 %14, i32 %18)
%20 = tail call i32 @BlackPixel(i32* %3, i32 0)
%21 = tail call i32 @XSetWindowBackground(i32* %3, i32 %17, i32 %20)
%22 = tail call i32 @RootWindow(i32* %3, i32 0)
%23 = tail call i32 @XSetTransientForHint(i32* %3, i32 %17, i32 %22)
%24 = tail call %struct.TYPE_5__* (...) @XAllocWMHints()
%25 = load i32, i32* @WindowGroupHint
%26 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %24, i64 0, i32 1
store i32 %25, i32* %26
%27 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %24, i64 0, i32 0
store i32 %11, i32* %27
%28 = tail call i32 @XSetWMHints(i32* %3, i32 %14, %struct.TYPE_5__* %24)
%29 = tail call i32 @XSetWMHints(i32* %3, i32 %17, %struct.TYPE_5__* %24)
%30 = tail call i32 @XFree(%struct.TYPE_5__* %24)
%31 = tail call i32 @XMapWindow(i32* %3, i32 %14)
%32 = tail call i32 @XMapWindow(i32* %3, i32 %17)
%33 = tail call i32 @XFlush(i32* %3)
br label %34
34: ; preds = %34, %8
%35 = call i32 @XNextEvent(i32* %3, i32* %1)
br label %34
}