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

/* Variables and functions */
int /*<<< orphan*/ BlackPixel(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ CopyFromParent;
int /*<<< orphan*/ False;
int /*<<< orphan*/ PropModeAppend;
int /*<<< orphan*/ RootWindow(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ WhitePixel(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ XChangeProperty(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                   int /*<<< orphan*/, int /*<<< orphan*/, int,
                                   int /*<<< orphan*/, char *,
                                   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*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ *XOpenDisplay(int /*<<< orphan*/ *);
int /*<<< orphan*/ XSetWindowBackground(int /*<<< orphan*/ *,
                                        int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strlen(char *);
int main(int argc, char **argv) {
  Display *display;
  Window win1, win2;
  XEvent report;
  int x = 10, y = 10, h = 100, w = 400;
  XSizeHints size;
  XTextProperty name;
  Atom sm_id, enc;
  display = XOpenDisplay(NULL);
  if (display == NULL) {
    fprintf(stderr, "couldn't connect to X server :0\n");
    return 0;
  }
  sm_id = XInternAtom(display, "SM_CLIENT_ID", False);
  enc = XInternAtom(display, "STRING", False);
  win1 = XCreateWindow(display, RootWindow(display, 0), x, y, w, h, 10,
                       CopyFromParent, CopyFromParent, CopyFromParent, 0, NULL);
  win2 = XCreateWindow(display, RootWindow(display, 0), x, y, w, h, 10,
                       CopyFromParent, CopyFromParent, CopyFromParent, 0, NULL);
  XSetWindowBackground(display, win1, WhitePixel(display, 0));
  XSetWindowBackground(display, win2, BlackPixel(display, 0));
  XChangeProperty(display, win1, sm_id, enc, 8, PropModeAppend, "abcdefg",
                  strlen("abcdefg"));
  XChangeProperty(display, win2, sm_id, enc, 8, PropModeAppend, "abcdefg",
                  strlen("abcdefg"));
  XFlush(display);
  XMapWindow(display, win1);
  XMapWindow(display, win2);
  while (1)
    XNextEvent(display, &report);
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0xd8,%rsp
movl   $0x0,-0xc(%rbp)
mov    %edi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0xa,-0x30(%rbp)
movl   $0xa,-0x34(%rbp)
movl   $0x64,-0x38(%rbp)
movl   $0x190,-0x3c(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <XOpenDisplay@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    123f <main+0x6f>
mov    0x2dab(%rip),%rax
mov    (%rax),%edi
lea    0xdd2(%rip),%rsi
call   1060 <fprintf@plt>
xor    %eax,%eax
add    $0xd8,%rsp
pop    %rbx
pop    %rbp
ret
mov    -0x20(%rbp),%rdi
mov    0x2d9e(%rip),%rax
mov    (%rax),%edx
lea    0xdce(%rip),%rsi
call   1080 <XInternAtom@plt>
mov    %eax,-0x48(%rbp)
mov    -0x20(%rbp),%rdi
mov    0x2d82(%rip),%rax
mov    (%rax),%edx
lea    0xdbf(%rip),%rsi
call   1080 <XInternAtom@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0xb0(%rbp)
mov    -0x20(%rbp),%rdi
xor    %esi,%esi
call   10b0 <RootWindow@plt>
mov    -0xb0(%rbp),%rdi
mov    %eax,%esi
mov    -0x30(%rbp),%edx
mov    -0x34(%rbp),%ecx
mov    -0x3c(%rbp),%r8d
mov    -0x38(%rbp),%r9d
mov    0x2d1d(%rip),%rax
mov    (%rax),%r11d
mov    0x2d13(%rip),%rax
mov    (%rax),%r10d
mov    0x2d09(%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,-0x24(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0xa8(%rbp)
mov    -0x20(%rbp),%rdi
xor    %esi,%esi
call   10b0 <RootWindow@plt>
mov    -0xa8(%rbp),%rdi
mov    %eax,%esi
mov    -0x30(%rbp),%edx
mov    -0x34(%rbp),%ecx
mov    -0x3c(%rbp),%r8d
mov    -0x38(%rbp),%r9d
mov    0x2ca1(%rip),%rax
mov    (%rax),%r11d
mov    0x2c97(%rip),%rax
mov    (%rax),%r10d
mov    0x2c8d(%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,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0xa0(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x94(%rbp)
mov    -0x20(%rbp),%rdi
xor    %esi,%esi
call   1040 <WhitePixel@plt>
mov    -0xa0(%rbp),%rdi
mov    -0x94(%rbp),%esi
mov    %eax,%edx
call   10f0 <XSetWindowBackground@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x84(%rbp)
mov    -0x20(%rbp),%rdi
xor    %esi,%esi
call   10c0 <BlackPixel@plt>
mov    -0x90(%rbp),%rdi
mov    -0x84(%rbp),%esi
mov    %eax,%edx
call   10f0 <XSetWindowBackground@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x78(%rbp)
mov    -0x48(%rbp),%eax
mov    %eax,-0x74(%rbp)
mov    -0x4c(%rbp),%eax
mov    %eax,-0x70(%rbp)
mov    0x2bea(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x6c(%rbp)
lea    0xc33(%rip),%rdi
call   1030 <strlen@plt>
mov    -0x80(%rbp),%rdi
mov    -0x78(%rbp),%esi
mov    -0x74(%rbp),%edx
mov    -0x70(%rbp),%ecx
mov    -0x6c(%rbp),%r9d
mov    $0x8,%r8d
lea    0xc10(%rip),%r10
mov    %r10,(%rsp)
mov    %eax,0x8(%rsp)
call   1090 <XChangeProperty@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x48(%rbp),%eax
mov    %eax,-0x58(%rbp)
mov    -0x4c(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    0x2b8d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x50(%rbp)
lea    0xbd6(%rip),%rdi
call   1030 <strlen@plt>
mov    -0x68(%rbp),%rdi
mov    -0x5c(%rbp),%esi
mov    -0x58(%rbp),%edx
mov    -0x54(%rbp),%ecx
mov    -0x50(%rbp),%r9d
mov    $0x8,%r8d
lea    0xbb3(%rip),%r10
mov    %r10,(%rsp)
mov    %eax,0x8(%rsp)
call   1090 <XChangeProperty@plt>
mov    -0x20(%rbp),%rdi
call   10d0 <XFlush@plt>
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   10e0 <XMapWindow@plt>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%esi
call   10e0 <XMapWindow@plt>
mov    -0x20(%rbp),%rdi
lea    -0x2c(%rbp),%rsi
call   1070 <XNextEvent@plt>
jmp    14b0 <main+0x2e0>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %edi,%edi
call   1050 <XOpenDisplay@plt>
test   %rax,%rax
je     137d <main+0x1ad>
mov    %rax,%rbx
mov    0x2df3(%rip),%rbp
mov    0x0(%rbp),%edx
lea    0xe22(%rip),%rsi
mov    %rax,%rdi
call   1080 <XInternAtom@plt>
mov    %eax,%r12d
mov    0x0(%rbp),%edx
lea    0xe1a(%rip),%rsi
mov    %rbx,%rdi
call   1080 <XInternAtom@plt>
mov    %eax,%r13d
mov    %rbx,%rdi
xor    %esi,%esi
call   10b0 <RootWindow@plt>
mov    0x2d98(%rip),%r14
mov    (%r14),%ebp
mov    %rbx,%rdi
mov    %eax,%esi
mov    $0xa,%edx
mov    $0xa,%ecx
mov    $0x190,%r8d
mov    $0x64,%r9d
push   $0x0
push   $0x0
push   %rbp
push   %rbp
push   %rbp
push   $0xa
call   10a0 <XCreateWindow@plt>
add    $0x30,%rsp
mov    %eax,%r15d
mov    %rbx,%rdi
xor    %esi,%esi
call   10b0 <RootWindow@plt>
mov    (%r14),%ebp
mov    %rbx,%rdi
mov    %eax,%esi
mov    $0xa,%edx
mov    $0xa,%ecx
mov    $0x190,%r8d
mov    $0x64,%r9d
push   $0x0
push   $0x0
push   %rbp
push   %rbp
push   %rbp
push   $0xa
call   10a0 <XCreateWindow@plt>
add    $0x30,%rsp
mov    %eax,%ebp
mov    %eax,(%rsp)
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <WhitePixel@plt>
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %eax,%edx
call   10f0 <XSetWindowBackground@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   10c0 <BlackPixel@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %eax,%edx
call   10f0 <XSetWindowBackground@plt>
mov    0x2d0a(%rip),%rax
mov    (%rax),%r14d
lea    0xd55(%rip),%rbp
mov    %rbp,%rdi
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %r12d,%edx
mov    %r13d,%ecx
mov    $0x8,%r8d
mov    %r14d,%r9d
push   %rax
push   %rbp
call   1090 <XChangeProperty@plt>
add    $0x10,%rsp
mov    0x2cd1(%rip),%rax
mov    (%rax),%r14d
mov    %rbp,%rdi
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    (%rsp),%ebp
mov    %ebp,%esi
mov    %r12d,%edx
mov    %r13d,%ecx
mov    $0x8,%r8d
mov    %r14d,%r9d
push   %rax
lea    0xcfc(%rip),%rax
push   %rax
call   1090 <XChangeProperty@plt>
add    $0x10,%rsp
mov    %rbx,%rdi
call   10d0 <XFlush@plt>
mov    %rbx,%rdi
mov    %r15d,%esi
call   10e0 <XMapWindow@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
call   10e0 <XMapWindow@plt>
lea    0x4(%rsp),%rbp
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1070 <XNextEvent@plt>
jmp    1370 <main+0x1a0>
mov    0x2c4c(%rip),%rax
mov    (%rax),%edi
lea    0xc73(%rip),%rsi
call   1060 <fprintf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [33 x i8] c"couldn't connect to X server :0\0A\00"
@.str.1 = [13 x i8] c"SM_CLIENT_ID\00"
@False = global i32 0
@.str.2 = [7 x i8] c"STRING\00"
@CopyFromParent = global i32 0
@PropModeAppend = global i32 0
@.str.3 = [8 x i8] c"abcdefg\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32* @XOpenDisplay(i32* null)
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %10
7: ; preds = %2
%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 = %2
%11 = load i32, i32* @False
%12 = tail call i32 @XInternAtom(i32* %5, i8* getelementptr inbounds ([13 x i8], [13 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 ([7 x i8], [7 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 10, i32 10, i32 400, i32 100, i32 10, i32 %16, i32 %16, i32 %16, i32 0, i32* null)
%18 = tail call i32 @RootWindow(i32* %5, i32 0)
%19 = load i32, i32* @CopyFromParent
%20 = tail call i32 @XCreateWindow(i32* %5, i32 %18, i32 10, i32 10, i32 400, i32 100, i32 10, i32 %19, i32 %19, i32 %19, i32 0, i32* null)
%21 = tail call i32 @WhitePixel(i32* %5, i32 0)
%22 = tail call i32 @XSetWindowBackground(i32* %5, i32 %17, i32 %21)
%23 = tail call i32 @BlackPixel(i32* %5, i32 0)
%24 = tail call i32 @XSetWindowBackground(i32* %5, i32 %20, i32 %23)
%25 = load i32, i32* @PropModeAppend
%26 = tail call i32 @strlen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%27 = tail call i32 @XChangeProperty(i32* %5, i32 %17, i32 %12, i32 %14, i32 8, i32 %25, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 %26)
%28 = load i32, i32* @PropModeAppend
%29 = tail call i32 @strlen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%30 = tail call i32 @XChangeProperty(i32* %5, i32 %20, i32 %12, i32 %14, i32 8, i32 %28, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 %29)
%31 = tail call i32 @XFlush(i32* %5)
%32 = tail call i32 @XMapWindow(i32* %5, i32 %17)
%33 = tail call i32 @XMapWindow(i32* %5, i32 %20)
br label %34
34: ; preds = %34, %10
%35 = call i32 @XNextEvent(i32* %5, i32* %3)
br label %34
}