#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 /*<<< orphan*/ BlackPixel(int /*<<< orphan*/ *, int);
int DefaultScreen(int /*<<< orphan*/ *);
int /*<<< orphan*/ RootWindow(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ WhitePixel(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ XCreateSimpleWindow(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                       int, int, int, int, int,
                                       int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ XFlush(int /*<<< orphan*/ *);
int /*<<< orphan*/ XMapWindow(int /*<<< orphan*/ *, int /*<<< orphan*/);
Window create_simple_window(Display *display, int width, int height, int x,
                            int y) {
  int screen_num = DefaultScreen(display);
  int win_border_width = 2;
  Window win;
  win = XCreateSimpleWindow(display, RootWindow(display, screen_num), x, y,
                            width, height, win_border_width,
                            BlackPixel(display, screen_num),
                            WhitePixel(display, screen_num));
  XMapWindow(display, win);
  XFlush(display);
  return win;
}


x86 assembly (clang, -O0):
<create_simple_window>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1090 <DefaultScreen@plt>
mov    %eax,-0x1c(%rbp)
movl   $0x2,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1040 <RootWindow@plt>
mov    %eax,-0x40(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1060 <BlackPixel@plt>
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1030 <WhitePixel@plt>
mov    -0x48(%rbp),%rdi
mov    -0x40(%rbp),%esi
mov    -0x3c(%rbp),%edx
mov    -0x38(%rbp),%ecx
mov    -0x34(%rbp),%r8d
mov    -0x30(%rbp),%r9d
mov    -0x2c(%rbp),%r11d
mov    -0x28(%rbp),%r10d
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
call   1050 <XCreateSimpleWindow@plt>
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1080 <XMapWindow@plt>
mov    -0x8(%rbp),%rdi
call   1070 <XFlush@plt>
mov    -0x24(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_simple_window>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8d,(%rsp)
mov    %ecx,%r13d
mov    %edx,0x4(%rsp)
mov    %esi,%r12d
mov    %rdi,%rbx
call   1090 <DefaultScreen@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <RootWindow@plt>
mov    %eax,%r14d
mov    %rbx,%rdi
mov    %ebp,%esi
call   1060 <BlackPixel@plt>
mov    %eax,%r15d
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <WhitePixel@plt>
sub    $0x8,%rsp
mov    %rbx,%rdi
mov    %r14d,%esi
mov    %r13d,%edx
mov    0x8(%rsp),%ecx
mov    %r12d,%r8d
mov    0xc(%rsp),%r9d
push   %rax
push   %r15
push   $0x2
call   1050 <XCreateSimpleWindow@plt>
add    $0x20,%rsp
mov    %eax,%ebp
mov    %rbx,%rdi
mov    %eax,%esi
call   1080 <XMapWindow@plt>
mov    %rbx,%rdi
call   1070 <XFlush@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @create_simple_window(i32* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i32* %0, i32** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%14 = load i32*, i32** %6
%15 = call i32 @DefaultScreen(i32* %14)
store i32 %15, i32* %11
store i32 2, i32* %12
%16 = load i32*, i32** %6
%17 = load i32*, i32** %6
%18 = load i32, i32* %11
%19 = call i32 @RootWindow(i32* %17, i32 %18)
%20 = load i32, i32* %9
%21 = load i32, i32* %10
%22 = load i32, i32* %7
%23 = load i32, i32* %8
%24 = load i32, i32* %12
%25 = load i32*, i32** %6
%26 = load i32, i32* %11
%27 = call i32 @BlackPixel(i32* %25, i32 %26)
%28 = load i32*, i32** %6
%29 = load i32, i32* %11
%30 = call i32 @WhitePixel(i32* %28, i32 %29)
%31 = call i32 @XCreateSimpleWindow(i32* %16, i32 %19, i32 %20, i32 %21, i32 %22, i32 %23, i32 %24, i32 %27, i32 %30)
store i32 %31, i32* %13
%32 = load i32*, i32** %6
%33 = load i32, i32* %13
%34 = call i32 @XMapWindow(i32* %32, i32 %33)
%35 = load i32*, i32** %6
%36 = call i32 @XFlush(i32* %35)
%37 = load i32, i32* %13
ret i32 %37
}

LLVM IR (-O2):
define i32 @create_simple_window(i32* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = tail call i32 @DefaultScreen(i32* %0)
%7 = tail call i32 @RootWindow(i32* %0, i32 %6)
%8 = tail call i32 @BlackPixel(i32* %0, i32 %6)
%9 = tail call i32 @WhitePixel(i32* %0, i32 %6)
%10 = tail call i32 @XCreateSimpleWindow(i32* %0, i32 %7, i32 %3, i32 %4, i32 %1, i32 %2, i32 2, i32 %8, i32 %9)
%11 = tail call i32 @XMapWindow(i32* %0, i32 %10)
%12 = tail call i32 @XFlush(i32* %0)
ret i32 %10
}