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

/* Variables and functions */
int ButtonPressMask;
int DefaultScreen(int /*<<< orphan*/ *);
int ExposureMask;
int /*<<< orphan*/ RootWindow(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ XCreateSimpleWindow(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                       int /*<<< orphan*/, int /*<<< orphan*/,
                                       int, int, int /*<<< orphan*/,
                                       int /*<<< orphan*/, int);
int /*<<< orphan*/ XFlush(int /*<<< orphan*/ *);
int /*<<< orphan*/ XMapWindow(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ *XOpenDisplay(int /*<<< orphan*/ *);
int /*<<< orphan*/ XSelectInput(int /*<<< orphan*/ *, int /*<<< orphan*/, int);
int main(void) {
  int screen;
  Display *display;
  int depth;
  Window window;
  display = XOpenDisplay(NULL);
  screen = DefaultScreen(display);
  int width = 320;
  int height = 200;
  window = XCreateSimpleWindow(display, RootWindow(display, 0), 0, 0, width,
                               height, 0, 0, 3);
  XSelectInput(display, window, ExposureMask | ButtonPressMask);
  XMapWindow(display, window);
  XFlush(display);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1030 <XOpenDisplay@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1090 <DefaultScreen@plt>
mov    %eax,-0x4(%rbp)
movl   $0x140,-0x1c(%rbp)
movl   $0xc8,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
call   1040 <RootWindow@plt>
mov    -0x28(%rbp),%rdi
mov    %eax,%esi
mov    -0x1c(%rbp),%r8d
mov    -0x20(%rbp),%r9d
xor    %ecx,%ecx
mov    %ecx,%edx
movl   $0x0,(%rsp)
movl   $0x0,0x8(%rsp)
movl   $0x3,0x10(%rsp)
call   1060 <XCreateSimpleWindow@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    0x2de7(%rip),%rax
mov    (%rax),%edx
mov    0x2dee(%rip),%rax
or     (%rax),%edx
call   1050 <XSelectInput@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   1080 <XMapWindow@plt>
mov    -0x10(%rbp),%rdi
call   1070 <XFlush@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %edi,%edi
call   1030 <XOpenDisplay@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1090 <DefaultScreen@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <RootWindow@plt>
sub    $0x8,%rsp
mov    %rbx,%rdi
mov    %eax,%esi
xor    %edx,%edx
xor    %ecx,%ecx
mov    $0x140,%r8d
mov    $0xc8,%r9d
push   $0x3
push   $0x0
push   $0x0
call   1060 <XCreateSimpleWindow@plt>
add    $0x20,%rsp
mov    %eax,%ebp
mov    0x2e18(%rip),%rax
mov    0x2e21(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    %rbx,%rdi
mov    %ebp,%esi
call   1050 <XSelectInput@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1080 <XMapWindow@plt>
mov    %rbx,%rdi
call   1070 <XFlush@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@ExposureMask = global i32 0
@ButtonPressMask = 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 = call i32* @XOpenDisplay(i32* null)
store i32* %7, i32** %2
%8 = load i32*, i32** %2
%9 = call i32 @DefaultScreen(i32* %8)
store i32 %9, i32* %1
store i32 320, i32* %5
store i32 200, i32* %6
%10 = load i32*, i32** %2
%11 = load i32*, i32** %2
%12 = call i32 @RootWindow(i32* %11, i32 0)
%13 = load i32, i32* %5
%14 = load i32, i32* %6
%15 = call i32 @XCreateSimpleWindow(i32* %10, i32 %12, i32 0, i32 0, i32 %13, i32 %14, i32 0, i32 0, i32 3)
store i32 %15, i32* %4
%16 = load i32*, i32** %2
%17 = load i32, i32* %4
%18 = load i32, i32* @ExposureMask
%19 = load i32, i32* @ButtonPressMask
%20 = or i32 %18, %19
%21 = call i32 @XSelectInput(i32* %16, i32 %17, i32 %20)
%22 = load i32*, i32** %2
%23 = load i32, i32* %4
%24 = call i32 @XMapWindow(i32* %22, i32 %23)
%25 = load i32*, i32** %2
%26 = call i32 @XFlush(i32* %25)
ret i32 0
}

LLVM IR (-O2):
@ExposureMask = global i32 0
@ButtonPressMask = global i32 0
define i32 @main() {
%1 = tail call i32* @XOpenDisplay(i32* null)
%2 = tail call i32 @DefaultScreen(i32* %1)
%3 = tail call i32 @RootWindow(i32* %1, i32 0)
%4 = tail call i32 @XCreateSimpleWindow(i32* %1, i32 %3, i32 0, i32 0, i32 320, i32 200, i32 0, i32 0, i32 3)
%5 = load i32, i32* @ExposureMask
%6 = load i32, i32* @ButtonPressMask
%7 = or i32 %6, %5
%8 = tail call i32 @XSelectInput(i32* %1, i32 %4, i32 %7)
%9 = tail call i32 @XMapWindow(i32* %1, i32 %4)
%10 = tail call i32 @XFlush(i32* %1)
ret i32 0
}