#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_6__ TYPE_2__;
typedef struct TYPE_5__ TYPE_1__;

/* Type definitions */
struct TYPE_5__ {
  int /*<<< orphan*/ visual;
  int /*<<< orphan*/ depth;
  int /*<<< orphan*/ screen;
};
typedef TYPE_1__ XVisualInfo;
struct TYPE_6__ {
  int event_mask;
  scalar_t__ border_pixel;
  int /*<<< orphan*/ colormap;
};
typedef TYPE_2__ XSetWindowAttributes;
typedef int /*<<< orphan*/ Window;
typedef int /*<<< orphan*/ Display;
typedef int /*<<< orphan*/ Colormap;

/* Variables and functions */
int /*<<< orphan*/ AllocNone;
int ButtonPressMask;
int ButtonReleaseMask;
int CWBorderPixel;
int CWColormap;
int CWEventMask;
int ExposureMask;
int /*<<< orphan*/ InputOutput;
int KeyPressMask;
int /*<<< orphan*/ None;
int /*<<< orphan*/ RootWindow(int /*<<< orphan*/ *, int /*<<< orphan*/);
int StructureNotifyMask;
int /*<<< orphan*/ XCreateColormap(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                   int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ XCreateWindow(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                 int /*<<< orphan*/, int /*<<< orphan*/, int,
                                 int, int /*<<< orphan*/, int /*<<< orphan*/,
                                 int /*<<< orphan*/, int /*<<< orphan*/, int,
                                 TYPE_2__ *);
int /*<<< orphan*/ XMapWindow(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/
XSetStandardProperties(int /*<<< orphan*/ *, int /*<<< orphan*/, char *, char *,
                       int /*<<< orphan*/, int /*<<< orphan*/ *,
                       int /*<<< orphan*/, int /*<<< orphan*/ *);
Window _setXwin(Display *dpy, XVisualInfo *visInfo) {
  Window win = RootWindow(dpy, visInfo->screen);
  Colormap cmap = XCreateColormap(dpy, win, visInfo->visual, AllocNone);
  XSetWindowAttributes swa;
  swa.colormap = cmap;
  swa.border_pixel = 0;
  swa.event_mask = ExposureMask | StructureNotifyMask | KeyPressMask |
                   ButtonPressMask | ButtonReleaseMask;
  win = XCreateWindow(dpy, win, 0, 0, 800, 600, 0, visInfo->depth, InputOutput,
                      visInfo->visual, CWBorderPixel | CWColormap | CWEventMask,
                      &swa);
  XSetStandardProperties(dpy, win, "s52glx", "s52glx", None, NULL, 0, NULL);
  XMapWindow(dpy, win);
  return win;
}


x86 assembly (clang, -O0):
<_setXwin>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0x60,%rsp
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%esi
call   1050 <RootWindow@plt>
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x20(%rbp),%rax
mov    (%rax),%edx
mov    0x2e3e(%rip),%rax
mov    (%rax),%ecx
call   1060 <XCreateColormap@plt>
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
mov    0x2def(%rip),%rax
mov    (%rax),%eax
mov    0x2dfe(%rip),%rcx
or     (%rcx),%eax
mov    0x2e1d(%rip),%rcx
or     (%rcx),%eax
mov    0x2e1c(%rip),%rcx
or     (%rcx),%eax
mov    0x2ddb(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x40(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x20(%rbp),%rax
mov    0x4(%rax),%r14d
mov    0x2db8(%rip),%rax
mov    (%rax),%ebx
mov    -0x20(%rbp),%rax
mov    (%rax),%r11d
mov    0x2df8(%rip),%rax
mov    (%rax),%r10d
mov    0x2dbe(%rip),%rax
or     (%rax),%r10d
mov    0x2d84(%rip),%rax
or     (%rax),%r10d
xor    %ecx,%ecx
mov    $0x320,%r8d
mov    $0x258,%r9d
lea    -0x40(%rbp),%rax
mov    %ecx,%edx
movl   $0x0,(%rsp)
mov    %r14d,0x8(%rsp)
mov    %ebx,0x10(%rsp)
mov    %r11d,0x18(%rsp)
mov    %r10d,0x20(%rsp)
mov    %rax,0x28(%rsp)
call   1040 <XCreateWindow@plt>
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    0x2d78(%rip),%rax
mov    (%rax),%r8d
lea    0xd9e(%rip),%rcx
xor    %eax,%eax
mov    %eax,%r9d
xor    %eax,%eax
mov    %rcx,%rdx
movl   $0x0,(%rsp)
movq   $0x0,0x8(%rsp)
call   1030 <XSetStandardProperties@plt>
mov    -0x18(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1070 <XMapWindow@plt>
mov    -0x24(%rbp),%eax
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

x86 assembly (clang, -O2):
<_setXwin>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbp
mov    %rdi,%rbx
mov    0x8(%rsi),%esi
call   1050 <RootWindow@plt>
mov    %eax,%r14d
mov    0x0(%rbp),%edx
mov    0x2e53(%rip),%rax
mov    (%rax),%ecx
mov    %rbx,%rdi
mov    %r14d,%esi
call   1060 <XCreateColormap@plt>
mov    0x2e0f(%rip),%rcx
mov    0x2e20(%rip),%rdx
mov    (%rdx),%edx
or     (%rcx),%edx
mov    %eax,0x10(%rsp)
mov    0x2e39(%rip),%rax
or     (%rax),%edx
movq   $0x0,0x8(%rsp)
mov    0x2e2f(%rip),%rax
or     (%rax),%edx
mov    0x2dee(%rip),%rax
or     (%rax),%edx
mov    %edx,(%rsp)
mov    0x0(%rbp),%r11d
mov    0x4(%rbp),%r10d
mov    0x2dd2(%rip),%rcx
mov    0x2e1b(%rip),%rdx
mov    0x2de4(%rip),%rsi
mov    (%rsi),%ebp
or     (%rdx),%ebp
mov    (%rcx),%eax
mov    0x2da7(%rip),%rcx
or     (%rcx),%ebp
mov    %rsp,%r15
mov    %rbx,%rdi
mov    %r14d,%esi
xor    %edx,%edx
xor    %ecx,%ecx
mov    $0x320,%r8d
mov    $0x258,%r9d
push   %r15
push   %rbp
push   %r11
push   %rax
push   %r10
push   $0x0
call   1040 <XCreateWindow@plt>
add    $0x30,%rsp
mov    %eax,%ebp
mov    0x2db0(%rip),%rax
mov    (%rax),%r8d
lea    0xdd6(%rip),%rcx
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %rcx,%rdx
xor    %r9d,%r9d
push   $0x0
push   $0x0
call   1030 <XSetStandardProperties@plt>
add    $0x10,%rsp
mov    %rbx,%rdi
mov    %ebp,%esi
call   1070 <XMapWindow@plt>
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.TYPE_5__ = type { i32, i32, i32 }
%struct.TYPE_6__ = type { i32, i64, i32 }
@AllocNone = global i32 0
@ExposureMask = global i32 0
@StructureNotifyMask = global i32 0
@KeyPressMask = global i32 0
@ButtonPressMask = global i32 0
@ButtonReleaseMask = global i32 0
@InputOutput = global i32 0
@CWBorderPixel = global i32 0
@CWColormap = global i32 0
@CWEventMask = global i32 0
@.str = [7 x i8] c"s52glx\00"
@None = global i32 0
define i32 @_setXwin(i32* %0, %struct.TYPE_5__* %1) {
%3 = alloca i32*
%4 = alloca %struct.TYPE_5__*
%5 = alloca i32
%6 = alloca i32
%7 = alloca %struct.TYPE_6__
store i32* %0, i32** %3
store %struct.TYPE_5__* %1, %struct.TYPE_5__** %4
%8 = load i32*, i32** %3
%9 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%10 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %9, i32 0, i32 2
%11 = load i32, i32* %10
%12 = call i32 @RootWindow(i32* %8, i32 %11)
store i32 %12, i32* %5
%13 = load i32*, i32** %3
%14 = load i32, i32* %5
%15 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%16 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %15, i32 0, i32 0
%17 = load i32, i32* %16
%18 = load i32, i32* @AllocNone
%19 = call i32 @XCreateColormap(i32* %13, i32 %14, i32 %17, i32 %18)
store i32 %19, i32* %6
%20 = load i32, i32* %6
%21 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %7, i32 0, i32 2
store i32 %20, i32* %21
%22 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %7, i32 0, i32 1
store i64 0, i64* %22
%23 = load i32, i32* @ExposureMask
%24 = load i32, i32* @StructureNotifyMask
%25 = or i32 %23, %24
%26 = load i32, i32* @KeyPressMask
%27 = or i32 %25, %26
%28 = load i32, i32* @ButtonPressMask
%29 = or i32 %27, %28
%30 = load i32, i32* @ButtonReleaseMask
%31 = or i32 %29, %30
%32 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %7, i32 0, i32 0
store i32 %31, i32* %32
%33 = load i32*, i32** %3
%34 = load i32, i32* %5
%35 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%36 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %35, i32 0, i32 1
%37 = load i32, i32* %36
%38 = load i32, i32* @InputOutput
%39 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%40 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %39, i32 0, i32 0
%41 = load i32, i32* %40
%42 = load i32, i32* @CWBorderPixel
%43 = load i32, i32* @CWColormap
%44 = or i32 %42, %43
%45 = load i32, i32* @CWEventMask
%46 = or i32 %44, %45
%47 = call i32 @XCreateWindow(i32* %33, i32 %34, i32 0, i32 0, i32 800, i32 600, i32 0, i32 %37, i32 %38, i32 %41, i32 %46, %struct.TYPE_6__* %7)
store i32 %47, i32* %5
%48 = load i32*, i32** %3
%49 = load i32, i32* %5
%50 = load i32, i32* @None
%51 = call i32 @XSetStandardProperties(i32* %48, i32 %49, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %50, i32* null, i32 0, i32* null)
%52 = load i32*, i32** %3
%53 = load i32, i32* %5
%54 = call i32 @XMapWindow(i32* %52, i32 %53)
%55 = load i32, i32* %5
ret i32 %55
}

LLVM IR (-O2):
%struct.TYPE_5__ = type { i32, i32, i32 }
%struct.TYPE_6__ = type { i32, i64, i32 }
@AllocNone = global i32 0
@ExposureMask = global i32 0
@StructureNotifyMask = global i32 0
@KeyPressMask = global i32 0
@ButtonPressMask = global i32 0
@ButtonReleaseMask = global i32 0
@InputOutput = global i32 0
@CWBorderPixel = global i32 0
@CWColormap = global i32 0
@CWEventMask = global i32 0
@.str = [7 x i8] c"s52glx\00"
@None = global i32 0
define i32 @_setXwin(i32* %0, %struct.TYPE_5__* nocapture %1) {
%3 = alloca %struct.TYPE_6__
%4 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 2
%5 = load i32, i32* %4
%6 = tail call i32 @RootWindow(i32* %0, i32 %5)
%7 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 0
%8 = load i32, i32* %7
%9 = load i32, i32* @AllocNone
%10 = tail call i32 @XCreateColormap(i32* %0, i32 %6, i32 %8, i32 %9)
%11 = bitcast %struct.TYPE_6__* %3 to i8*
%12 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %3, i64 0, i32 2
store i32 %10, i32* %12
%13 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %3, i64 0, i32 1
store i64 0, i64* %13
%14 = load i32, i32* @ExposureMask
%15 = load i32, i32* @StructureNotifyMask
%16 = or i32 %15, %14
%17 = load i32, i32* @KeyPressMask
%18 = or i32 %16, %17
%19 = load i32, i32* @ButtonPressMask
%20 = or i32 %18, %19
%21 = load i32, i32* @ButtonReleaseMask
%22 = or i32 %20, %21
%23 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %3, i64 0, i32 0
store i32 %22, i32* %23
%24 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 1
%25 = load i32, i32* %24
%26 = load i32, i32* @InputOutput
%27 = load i32, i32* %7
%28 = load i32, i32* @CWBorderPixel
%29 = load i32, i32* @CWColormap
%30 = or i32 %29, %28
%31 = load i32, i32* @CWEventMask
%32 = or i32 %30, %31
%33 = call i32 @XCreateWindow(i32* %0, i32 %6, i32 0, i32 0, i32 800, i32 600, i32 0, i32 %25, i32 %26, i32 %27, i32 %32, %struct.TYPE_6__* %3)
%34 = load i32, i32* @None
%35 = call i32 @XSetStandardProperties(i32* %0, i32 %33, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %34, i32* null, i32 0, i32* null)
%36 = call i32 @XMapWindow(i32* %0, i32 %33)
ret i32 %33
}