#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 min_width;
  int max_width;
  int min_height;
  int max_height;
  int flags;
};
typedef TYPE_1__ XSizeHints;
typedef int /*<<< orphan*/ XEvent;
typedef scalar_t__ Window;
typedef int /*<<< orphan*/ Display;

/* Variables and functions */
scalar_t__ DefaultRootWindow(int /*<<< orphan*/ *);
int /*<<< orphan*/ ExposureMask;
scalar_t__ None;
int PMaxSize;
int PMinSize;
int /*<<< orphan*/ XCloseDisplay(int /*<<< orphan*/ *);
scalar_t__ XCreateSimpleWindow(int /*<<< orphan*/ *, scalar_t__, int, int, int,
                               int, int /*<<< orphan*/, int /*<<< orphan*/,
                               int /*<<< orphan*/);
int /*<<< orphan*/ XMapWindow(int /*<<< orphan*/ *, scalar_t__);
int /*<<< orphan*/ XNextEvent(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ *XOpenDisplay(int /*<<< orphan*/ *);
int /*<<< orphan*/ XSelectInput(int /*<<< orphan*/ *, scalar_t__,
                                int /*<<< orphan*/);
int /*<<< orphan*/ XSetTransientForHint(int /*<<< orphan*/ *, scalar_t__,
                                        scalar_t__);
int /*<<< orphan*/ XSetWMNormalHints(int /*<<< orphan*/ *, scalar_t__,
                                     TYPE_1__ *);
int /*<<< orphan*/ XStoreName(int /*<<< orphan*/ *, scalar_t__, char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ sleep(int);
int main(void) {
  Display *d;
  Window r, f, t = None;
  XSizeHints h;
  XEvent e;
  d = XOpenDisplay(NULL);
  if (!d)
    exit(1);
  r = DefaultRootWindow(d);
  f = XCreateSimpleWindow(d, r, 100, 100, 400, 400, 0, 0, 0);
  h.min_width = h.max_width = h.min_height = h.max_height = 400;
  h.flags = PMinSize | PMaxSize;
  XSetWMNormalHints(d, f, &h);
  XStoreName(d, f, "floating");
  XMapWindow(d, f);
  XSelectInput(d, f, ExposureMask);
  while (1) {
    XNextEvent(d, &e);
    if (t == None) {
      sleep(5);
      t = XCreateSimpleWindow(d, r, 50, 50, 100, 100, 0, 0, 0);
      XSetTransientForHint(d, t, f);
      XStoreName(d, t, "transient");
      XMapWindow(d, t);
      XSelectInput(d, t, ExposureMask);
    }
  }
  XCloseDisplay(d);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e1a(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1070 <XOpenDisplay@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11ef <main+0x3f>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    -0x10(%rbp),%rdi
call   1050 <DefaultRootWindow@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x64,%ecx
mov    $0x190,%r9d
xor    %eax,%eax
mov    %ecx,%edx
mov    %r9d,%r8d
movl   $0x0,(%rsp)
movl   $0x0,0x8(%rsp)
movl   $0x0,0x10(%rsp)
call   10a0 <XCreateSimpleWindow@plt>
mov    %rax,-0x20(%rbp)
movl   $0x190,-0x34(%rbp)
movl   $0x190,-0x38(%rbp)
movl   $0x190,-0x3c(%rbp)
movl   $0x190,-0x40(%rbp)
mov    0x2d6f(%rip),%rax
mov    (%rax),%eax
mov    0x2d96(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
lea    -0x40(%rbp),%rdx
call   1060 <XSetWMNormalHints@plt>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
lea    0xd79(%rip),%rdx
call   1040 <XStoreName@plt>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   10b0 <XMapWindow@plt>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    0x2d28(%rip),%rax
mov    (%rax),%edx
call   1090 <XSelectInput@plt>
mov    -0x10(%rbp),%rdi
lea    -0x44(%rbp),%rsi
call   1080 <XNextEvent@plt>
mov    -0x28(%rbp),%rax
mov    0x2d19(%rip),%rcx
cmp    (%rcx),%rax
jne    135c <main+0x1ac>
mov    $0x5,%edi
call   10d0 <sleep@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x32,%ecx
mov    $0x64,%r9d
xor    %eax,%eax
mov    %ecx,%edx
mov    %r9d,%r8d
movl   $0x0,(%rsp)
movl   $0x0,0x8(%rsp)
movl   $0x0,0x10(%rsp)
call   10a0 <XCreateSimpleWindow@plt>
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <XSetTransientForHint@plt>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
lea    0xcd5(%rip),%rdx
call   1040 <XStoreName@plt>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   10b0 <XMapWindow@plt>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    0x2c7b(%rip),%rax
mov    (%rax),%edx
call   1090 <XSelectInput@plt>
jmp    12af <main+0xff>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    0x2e1b(%rip),%r13
mov    0x0(%r13),%rbp
xor    %edi,%edi
call   1070 <XOpenDisplay@plt>
test   %rax,%rax
je     1307 <main+0x157>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <DefaultRootWindow@plt>
sub    $0x8,%rsp
mov    %rbx,%rdi
mov    %rax,0x8(%rsp)
mov    %rax,%rsi
mov    $0x64,%edx
mov    $0x64,%ecx
mov    $0x190,%r8d
mov    $0x190,%r9d
push   $0x0
push   $0x0
push   $0x0
call   10a0 <XCreateSimpleWindow@plt>
add    $0x20,%rsp
mov    %rax,%r14
movaps 0xdde(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
mov    0x2d9a(%rip),%rax
mov    0x2dc3(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    %ecx,0x20(%rsp)
lea    0x10(%rsp),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <XSetWMNormalHints@plt>
lea    0xdbc(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <XStoreName@plt>
lea    0xc(%rsp),%r12
mov    %r14,%r15
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r15,%rsi
call   10b0 <XMapWindow@plt>
mov    0x2d4e(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1090 <XSelectInput@plt>
nop
mov    %rbx,%rdi
mov    %r12,%rsi
call   1080 <XNextEvent@plt>
cmp    0x0(%r13),%rbp
jne    1290 <main+0xe0>
mov    $0x5,%edi
call   10d0 <sleep@plt>
sub    $0x8,%rsp
mov    %rbx,%rdi
mov    0x8(%rsp),%rsi
mov    $0x32,%edx
mov    $0x32,%ecx
mov    $0x64,%r8d
mov    $0x64,%r9d
push   $0x0
push   $0x0
push   $0x0
call   10a0 <XCreateSimpleWindow@plt>
add    $0x20,%rsp
mov    %rax,%r15
mov    %rbx,%rdi
mov    %rax,%rsi
mov    %r14,%rdx
call   1030 <XSetTransientForHint@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
lea    0xd1f(%rip),%rdx
call   1040 <XStoreName@plt>
mov    %r15,%rbp
jmp    1270 <main+0xc0>
mov    $0x1,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32, i32, i32, i32, i32 }
@None = global i64 0
@PMinSize = global i32 0
@PMaxSize = global i32 0
@.str = [9 x i8] c"floating\00"
@ExposureMask = global i32 0
@.str.1 = [10 x i8] c"transient\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca %struct.TYPE_3__
%7 = alloca i32
store i32 0, i32* %1
%8 = load i64, i64* @None
store i64 %8, i64* %5
%9 = call i32* @XOpenDisplay(i32* null)
store i32* %9, i32** %2
%10 = load i32*, i32** %2
%11 = icmp ne i32* %10, null
br i1 %11, label %14, label %12
12: ; preds = %0
%13 = call i32 @exit(i32 1)
unreachable
14: ; preds = %0
%15 = load i32*, i32** %2
%16 = call i64 @DefaultRootWindow(i32* %15)
store i64 %16, i64* %3
%17 = load i32*, i32** %2
%18 = load i64, i64* %3
%19 = call i64 @XCreateSimpleWindow(i32* %17, i64 %18, i32 100, i32 100, i32 400, i32 400, i32 0, i32 0, i32 0)
store i64 %19, i64* %4
%20 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %6, i32 0, i32 3
store i32 400, i32* %20
%21 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %6, i32 0, i32 2
store i32 400, i32* %21
%22 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %6, i32 0, i32 1
store i32 400, i32* %22
%23 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %6, i32 0, i32 0
store i32 400, i32* %23
%24 = load i32, i32* @PMinSize
%25 = load i32, i32* @PMaxSize
%26 = or i32 %24, %25
%27 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %6, i32 0, i32 4
store i32 %26, i32* %27
%28 = load i32*, i32** %2
%29 = load i64, i64* %4
%30 = call i32 @XSetWMNormalHints(i32* %28, i64 %29, %struct.TYPE_3__* %6)
%31 = load i32*, i32** %2
%32 = load i64, i64* %4
%33 = call i32 @XStoreName(i32* %31, i64 %32, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%34 = load i32*, i32** %2
%35 = load i64, i64* %4
%36 = call i32 @XMapWindow(i32* %34, i64 %35)
%37 = load i32*, i32** %2
%38 = load i64, i64* %4
%39 = load i32, i32* @ExposureMask
%40 = call i32 @XSelectInput(i32* %37, i64 %38, i32 %39)
br label %41
41: ; preds = %14, %66
%42 = load i32*, i32** %2
%43 = call i32 @XNextEvent(i32* %42, i32* %7)
%44 = load i64, i64* %5
%45 = load i64, i64* @None
%46 = icmp eq i64 %44, %45
br i1 %46, label %47, label %66
47: ; preds = %41
%48 = call i32 @sleep(i32 5)
%49 = load i32*, i32** %2
%50 = load i64, i64* %3
%51 = call i64 @XCreateSimpleWindow(i32* %49, i64 %50, i32 50, i32 50, i32 100, i32 100, i32 0, i32 0, i32 0)
store i64 %51, i64* %5
%52 = load i32*, i32** %2
%53 = load i64, i64* %5
%54 = load i64, i64* %4
%55 = call i32 @XSetTransientForHint(i32* %52, i64 %53, i64 %54)
%56 = load i32*, i32** %2
%57 = load i64, i64* %5
%58 = call i32 @XStoreName(i32* %56, i64 %57, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%59 = load i32*, i32** %2
%60 = load i64, i64* %5
%61 = call i32 @XMapWindow(i32* %59, i64 %60)
%62 = load i32*, i32** %2
%63 = load i64, i64* %5
%64 = load i32, i32* @ExposureMask
%65 = call i32 @XSelectInput(i32* %62, i64 %63, i32 %64)
br label %66
66: ; preds = %47, %41
br label %41
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i32, i32, i32, i32, i32 }
@None = global i64 0
@PMinSize = global i32 0
@PMaxSize = global i32 0
@.str = [9 x i8] c"floating\00"
@ExposureMask = global i32 0
@.str.1 = [10 x i8] c"transient\00"
define i32 @main() {
%1 = alloca %struct.TYPE_3__
%2 = alloca i32
%3 = load i64, i64* @None
%4 = bitcast %struct.TYPE_3__* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = tail call i32* @XOpenDisplay(i32* null)
%7 = icmp eq i32* %6, null
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %0
%11 = tail call i64 @DefaultRootWindow(i32* %6)
%12 = tail call i64 @XCreateSimpleWindow(i32* %6, i64 %11, i32 100, i32 100, i32 400, i32 400, i32 0, i32 0, i32 0)
%13 = bitcast %struct.TYPE_3__* %1 to <4 x i32>*
store <4 x i32> <i32 400, i32 400, i32 400, i32 400>, <4 x i32>* %13
%14 = load i32, i32* @PMinSize
%15 = load i32, i32* @PMaxSize
%16 = or i32 %15, %14
%17 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %1, i64 0, i32 4
store i32 %16, i32* %17
%18 = call i32 @XSetWMNormalHints(i32* %6, i64 %12, %struct.TYPE_3__* %1)
%19 = call i32 @XStoreName(i32* %6, i64 %12, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %20
20: ; preds = %10, %30
%21 = phi i64 [ %32, %30 ], [ %12, %10 ]
%22 = phi i64 [ %32, %30 ], [ %3, %10 ]
%23 = call i32 @XMapWindow(i32* %6, i64 %21)
%24 = load i32, i32* @ExposureMask
%25 = call i32 @XSelectInput(i32* %6, i64 %21, i32 %24)
br label %26
26: ; preds = %20, %26
%27 = call i32 @XNextEvent(i32* %6, i32* %2)
%28 = load i64, i64* @None
%29 = icmp eq i64 %22, %28
br i1 %29, label %30, label %26
30: ; preds = %26
%31 = call i32 @sleep(i32 5)
%32 = call i64 @XCreateSimpleWindow(i32* %6, i64 %11, i32 50, i32 50, i32 100, i32 100, i32 0, i32 0, i32 0)
%33 = call i32 @XSetTransientForHint(i32* %6, i64 %32, i64 %12)
%34 = call i32 @XStoreName(i32* %6, i64 %32, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %20
}