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

/* Type definitions */
struct TYPE_3__ {
  int flags;
  int x;
  int y;
  int width;
  int height;
  int min_width;
  int min_height;
};
typedef TYPE_1__ XSizeHints;
typedef int /*<<< orphan*/ Window;
typedef int /*<<< orphan*/ Display;

/* Variables and functions */
int /*<<< orphan*/ BlackPixel(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ RootWindow(int /*<<< orphan*/ *, int);
int USPosition;
int USSize;
int /*<<< orphan*/ WhitePixel(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ XCreateSimpleWindow(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                       int, int, int, int, int,
                                       int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ XSetNormalHints(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                   TYPE_1__ *);
int /*<<< orphan*/ XStoreName(int /*<<< orphan*/ *, int /*<<< orphan*/, char *);
Window mk_window(Display *display, int screen) {
  XSizeHints size_hints;
  char *window_name = "Mandelbrot Set";
  int width = 800;
  int height = 1000;
  int x = 0;
  int y = 0;
  int border_width = 4;
  Window win = XCreateSimpleWindow(
      display, RootWindow(display, screen), x, y, width, height, border_width,
      BlackPixel(display, screen), WhitePixel(display, screen));
  size_hints.flags = USPosition | USSize;
  size_hints.x = x;
  size_hints.y = y;
  size_hints.width = width;
  size_hints.height = height;
  size_hints.min_width = 300;
  size_hints.min_height = 300;
  XSetNormalHints(display, win, &size_hints);
  XStoreName(display, win, window_name);
  return win;
}


x86 assembly (clang, -O0):
<mk_window>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    0xe87(%rip),%rax
mov    %rax,-0x30(%rbp)
movl   $0x320,-0x34(%rbp)
movl   $0x3e8,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
movl   $0x0,-0x40(%rbp)
movl   $0x4,-0x44(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1060 <RootWindow@plt>
mov    %eax,-0x64(%rbp)
mov    -0x3c(%rbp),%eax
mov    %eax,-0x60(%rbp)
mov    -0x40(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x58(%rbp)
mov    -0x38(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    -0x44(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1080 <BlackPixel@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <WhitePixel@plt>
mov    -0x70(%rbp),%rdi
mov    -0x64(%rbp),%esi
mov    -0x60(%rbp),%edx
mov    -0x5c(%rbp),%ecx
mov    -0x58(%rbp),%r8d
mov    -0x54(%rbp),%r9d
mov    -0x50(%rbp),%r11d
mov    -0x4c(%rbp),%r10d
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
call   1070 <XCreateSimpleWindow@plt>
mov    %eax,-0x48(%rbp)
mov    0x2dcf(%rip),%rax
mov    (%rax),%eax
mov    0x2da6(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x28(%rbp)
mov    -0x3c(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x40(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x38(%rbp),%eax
mov    %eax,-0x18(%rbp)
movl   $0x12c,-0x14(%rbp)
movl   $0x12c,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x48(%rbp),%esi
lea    -0x28(%rbp),%rdx
call   1050 <XSetNormalHints@plt>
mov    -0x8(%rbp),%rdi
mov    -0x48(%rbp),%esi
mov    -0x30(%rbp),%rdx
call   1030 <XStoreName@plt>
mov    -0x48(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mk_window>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %esi,%ebp
mov    %rdi,%rbx
call   1060 <RootWindow@plt>
mov    %eax,%r14d
mov    %rbx,%rdi
mov    %ebp,%esi
call   1080 <BlackPixel@plt>
mov    %eax,%r15d
mov    %rbx,%rdi
mov    %ebp,%esi
call   1040 <WhitePixel@plt>
sub    $0x8,%rsp
mov    %rbx,%rdi
mov    %r14d,%esi
xor    %edx,%edx
xor    %ecx,%ecx
mov    $0x320,%r8d
mov    $0x3e8,%r9d
push   %rax
push   %r15
push   $0x4
call   1070 <XCreateSimpleWindow@plt>
add    $0x20,%rsp
mov    %eax,%ebp
mov    0x2e39(%rip),%rax
mov    0x2e12(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    %ecx,0x8(%rsp)
movaps 0xe2b(%rip),%xmm0
movups %xmm0,0xc(%rsp)
movabs $0x12c0000012c,%rax
mov    %rax,0x1c(%rsp)
lea    0x8(%rsp),%rdx
mov    %rbx,%rdi
mov    %ebp,%esi
call   1050 <XSetNormalHints@plt>
lea    0xe11(%rip),%rdx
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <XStoreName@plt>
mov    %ebp,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32, i32, i32, i32, i32, i32, i32 }
@.str = [15 x i8] c"Mandelbrot Set\00"
@USPosition = global i32 0
@USSize = global i32 0
define i32 @mk_window(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca %struct.TYPE_3__
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8** %6
store i32 800, i32* %7
store i32 1000, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
store i32 4, i32* %11
%13 = load i32*, i32** %3
%14 = load i32*, i32** %3
%15 = load i32, i32* %4
%16 = call i32 @RootWindow(i32* %14, i32 %15)
%17 = load i32, i32* %9
%18 = load i32, i32* %10
%19 = load i32, i32* %7
%20 = load i32, i32* %8
%21 = load i32, i32* %11
%22 = load i32*, i32** %3
%23 = load i32, i32* %4
%24 = call i32 @BlackPixel(i32* %22, i32 %23)
%25 = load i32*, i32** %3
%26 = load i32, i32* %4
%27 = call i32 @WhitePixel(i32* %25, i32 %26)
%28 = call i32 @XCreateSimpleWindow(i32* %13, i32 %16, i32 %17, i32 %18, i32 %19, i32 %20, i32 %21, i32 %24, i32 %27)
store i32 %28, i32* %12
%29 = load i32, i32* @USPosition
%30 = load i32, i32* @USSize
%31 = or i32 %29, %30
%32 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %5, i32 0, i32 0
store i32 %31, i32* %32
%33 = load i32, i32* %9
%34 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %5, i32 0, i32 1
store i32 %33, i32* %34
%35 = load i32, i32* %10
%36 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %5, i32 0, i32 2
store i32 %35, i32* %36
%37 = load i32, i32* %7
%38 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %5, i32 0, i32 3
store i32 %37, i32* %38
%39 = load i32, i32* %8
%40 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %5, i32 0, i32 4
store i32 %39, i32* %40
%41 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %5, i32 0, i32 5
store i32 300, i32* %41
%42 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %5, i32 0, i32 6
store i32 300, i32* %42
%43 = load i32*, i32** %3
%44 = load i32, i32* %12
%45 = call i32 @XSetNormalHints(i32* %43, i32 %44, %struct.TYPE_3__* %5)
%46 = load i32*, i32** %3
%47 = load i32, i32* %12
%48 = load i8*, i8** %6
%49 = call i32 @XStoreName(i32* %46, i32 %47, i8* %48)
%50 = load i32, i32* %12
ret i32 %50
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i32, i32, i32, i32, i32, i32, i32 }
@.str = [15 x i8] c"Mandelbrot Set\00"
@USPosition = global i32 0
@USSize = global i32 0
define i32 @mk_window(i32* %0, i32 %1) {
%3 = alloca %struct.TYPE_3__
%4 = bitcast %struct.TYPE_3__* %3 to i8*
%5 = tail call i32 @RootWindow(i32* %0, i32 %1)
%6 = tail call i32 @BlackPixel(i32* %0, i32 %1)
%7 = tail call i32 @WhitePixel(i32* %0, i32 %1)
%8 = tail call i32 @XCreateSimpleWindow(i32* %0, i32 %5, i32 0, i32 0, i32 800, i32 1000, i32 4, i32 %6, i32 %7)
%9 = load i32, i32* @USPosition
%10 = load i32, i32* @USSize
%11 = or i32 %10, %9
%12 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %3, i64 0, i32 0
store i32 %11, i32* %12
%13 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %3, i64 0, i32 1
%14 = bitcast i32* %13 to <4 x i32>*
store <4 x i32> <i32 0, i32 0, i32 800, i32 1000>, <4 x i32>* %14
%15 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %3, i64 0, i32 5
store i32 300, i32* %15
%16 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %3, i64 0, i32 6
store i32 300, i32* %16
%17 = call i32 @XSetNormalHints(i32* %0, i32 %8, %struct.TYPE_3__* %3)
%18 = call i32 @XStoreName(i32* %0, i32 %8, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret i32 %8
}