#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 DefaultScreen(int /*<<< orphan*/ *);
int EXIT_SUCCESS;
int /*<<< orphan*/ RootWindow(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ XCloseDisplay(int /*<<< orphan*/ *);
int /*<<< orphan*/ XCreateSimpleWindow(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                       int /*<<< orphan*/, int /*<<< orphan*/,
                                       unsigned long, unsigned long,
                                       unsigned long, unsigned long,
                                       unsigned long);
int /*<<< orphan*/ XFlush(int /*<<< orphan*/ *);
int /*<<< orphan*/ XMapWindow(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ *XOpenDisplay(char *);
int /*<<< orphan*/ sleep(int);
int main(void) {
  Display *display;
  Window window, rootwindow;
  int screen;
  char *display_name = ":0.0";
  unsigned long background = 0x00000000;
  unsigned long border = 0x00ffffff;
  unsigned long border_width = 1;
  unsigned long height = 300;
  unsigned long width = 400;
  display = XOpenDisplay(display_name);
  screen = DefaultScreen(display);
  rootwindow = RootWindow(display, screen);
  window = XCreateSimpleWindow(display, rootwindow, 0, 0, width, height,
                               border_width, border, background);
  XMapWindow(display, window);
  XFlush(display);
  sleep(3);
  XCloseDisplay(display);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe6a(%rip),%rax
mov    %rax,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
movq   $0xffffff,-0x38(%rbp)
movq   $0x1,-0x40(%rbp)
movq   $0x12c,-0x48(%rbp)
movq   $0x190,-0x50(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <XOpenDisplay@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1080 <DefaultScreen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1040 <RootWindow@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x50(%rbp),%r8
mov    -0x48(%rbp),%r9
mov    -0x40(%rbp),%r11
mov    -0x38(%rbp),%r10
mov    -0x30(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1050 <XCreateSimpleWindow@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1070 <XMapWindow@plt>
mov    -0x10(%rbp),%rdi
call   1060 <XFlush@plt>
mov    $0x3,%edi
call   10a0 <sleep@plt>
mov    -0x10(%rbp),%rdi
call   1090 <XCloseDisplay@plt>
mov    0x2d92(%rip),%rax
mov    (%rax),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xe78(%rip),%rdi
call   1030 <XOpenDisplay@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1080 <DefaultScreen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <RootWindow@plt>
sub    $0x8,%rsp
mov    $0x190,%r8d
mov    $0x12c,%r9d
mov    %rbx,%rdi
mov    %eax,%esi
xor    %edx,%edx
xor    %ecx,%ecx
push   $0x0
push   $0xffffff
push   $0x1
call   1050 <XCreateSimpleWindow@plt>
add    $0x20,%rsp
mov    %rbx,%rdi
mov    %eax,%esi
call   1070 <XMapWindow@plt>
mov    %rbx,%rdi
call   1060 <XFlush@plt>
mov    $0x3,%edi
call   10a0 <sleep@plt>
mov    %rbx,%rdi
call   1090 <XCloseDisplay@plt>
mov    0x2de8(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c":0.0\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
store i32 0, i32* %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %6
store i64 0, i64* %7
store i64 16777215, i64* %8
store i64 1, i64* %9
store i64 300, i64* %10
store i64 400, i64* %11
%12 = load i8*, i8** %6
%13 = call i32* @XOpenDisplay(i8* %12)
store i32* %13, i32** %2
%14 = load i32*, i32** %2
%15 = call i32 @DefaultScreen(i32* %14)
store i32 %15, i32* %5
%16 = load i32*, i32** %2
%17 = load i32, i32* %5
%18 = call i32 @RootWindow(i32* %16, i32 %17)
store i32 %18, i32* %4
%19 = load i32*, i32** %2
%20 = load i32, i32* %4
%21 = load i64, i64* %11
%22 = load i64, i64* %10
%23 = load i64, i64* %9
%24 = load i64, i64* %8
%25 = load i64, i64* %7
%26 = call i32 @XCreateSimpleWindow(i32* %19, i32 %20, i32 0, i32 0, i64 %21, i64 %22, i64 %23, i64 %24, i64 %25)
store i32 %26, i32* %3
%27 = load i32*, i32** %2
%28 = load i32, i32* %3
%29 = call i32 @XMapWindow(i32* %27, i32 %28)
%30 = load i32*, i32** %2
%31 = call i32 @XFlush(i32* %30)
%32 = call i32 @sleep(i32 3)
%33 = load i32*, i32** %2
%34 = call i32 @XCloseDisplay(i32* %33)
%35 = load i32, i32* @EXIT_SUCCESS
ret i32 %35
}

LLVM IR (-O2):
@.str = [5 x i8] c":0.0\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32* @XOpenDisplay(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @DefaultScreen(i32* %1)
%3 = tail call i32 @RootWindow(i32* %1, i32 %2)
%4 = tail call i32 @XCreateSimpleWindow(i32* %1, i32 %3, i32 0, i32 0, i64 400, i64 300, i64 1, i64 16777215, i64 0)
%5 = tail call i32 @XMapWindow(i32* %1, i32 %4)
%6 = tail call i32 @XFlush(i32* %1)
%7 = tail call i32 @sleep(i32 3)
%8 = tail call i32 @XCloseDisplay(i32* %1)
%9 = load i32, i32* @EXIT_SUCCESS
ret i32 %9
}