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

/* Type definitions */
struct TYPE_5__ {
  int flags;
  int min_width;
  int min_height;
  int max_width;
  int max_height;
};
typedef TYPE_1__ XSizeHints;
typedef int /*<<< orphan*/ Window;
typedef int /*<<< orphan*/ Display;
typedef int /*<<< orphan*/ Atom;

/* Variables and functions */
int PMaxSize;
int PMinSize;
TYPE_1__ *XAllocSizeHints();
int /*<<< orphan*/ XFree(TYPE_1__ *);
int /*<<< orphan*/ XInternAtom(int /*<<< orphan*/ *, char *,
                               int /*<<< orphan*/);
int /*<<< orphan*/ XSetWMSizeHints(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                   TYPE_1__ *, int /*<<< orphan*/);
void restrictsize(Display *d, Window win, int minw, int minh, int maxw,
                  int maxh) {
  Atom nhints;
  XSizeHints *hints;
  nhints = XInternAtom(d, "WM_NORMAL_HINTS", 0);
  hints = XAllocSizeHints();
  hints->flags = PMinSize | PMaxSize;
  hints->min_width = minw;
  hints->min_height = minh;
  hints->max_width = maxw;
  hints->max_height = maxh;
  XSetWMSizeHints(d, win, hints, nhints);
  XFree(hints);
}


x86 assembly (clang, -O0):
<restrictsize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9d,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe98(%rip),%rsi
xor    %edx,%edx
call   1050 <XInternAtom@plt>
mov    %eax,-0x20(%rbp)
mov    $0x0,%al
call   1040 <XAllocSizeHints@plt>
mov    %rax,-0x28(%rbp)
mov    0x2e54(%rip),%rax
mov    (%rax),%ecx
mov    0x2e6b(%rip),%rax
or     (%rax),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x14(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0x18(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,0xc(%rax)
mov    -0x1c(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,0x10(%rax)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x28(%rbp),%rdx
mov    -0x20(%rbp),%ecx
call   1060 <XSetWMSizeHints@plt>
mov    -0x28(%rbp),%rdi
call   1030 <XFree@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<restrictsize>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,0x4(%rsp)
mov    %r8d,%r15d
mov    %ecx,%r13d
mov    %edx,%ebp
mov    %esi,(%rsp)
mov    %rdi,%rbx
lea    0xe9b(%rip),%rsi
xor    %edx,%edx
call   1050 <XInternAtom@plt>
mov    %eax,%r14d
xor    %eax,%eax
call   1040 <XAllocSizeHints@plt>
mov    %rax,%r12
mov    0x2e58(%rip),%rax
mov    0x2e71(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    %ecx,(%r12)
mov    %ebp,0x4(%r12)
mov    %r13d,0x8(%r12)
mov    %r15d,0xc(%r12)
mov    0x4(%rsp),%eax
mov    %eax,0x10(%r12)
mov    %rbx,%rdi
mov    (%rsp),%esi
mov    %r12,%rdx
mov    %r14d,%ecx
call   1060 <XSetWMSizeHints@plt>
mov    %r12,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <XFree@plt>

LLVM IR (-O0):
%struct.TYPE_5__ = type { i32, i32, i32, i32, i32 }
@.str = [16 x i8] c"WM_NORMAL_HINTS\00"
@PMinSize = global i32 0
@PMaxSize = global i32 0
define void @restrictsize(i32* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca %struct.TYPE_5__*
store i32* %0, i32** %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%15 = load i32*, i32** %7
%16 = call i32 @XInternAtom(i32* %15, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 0)
store i32 %16, i32* %13
%17 = call %struct.TYPE_5__* (...) @XAllocSizeHints()
store %struct.TYPE_5__* %17, %struct.TYPE_5__** %14
%18 = load i32, i32* @PMinSize
%19 = load i32, i32* @PMaxSize
%20 = or i32 %18, %19
%21 = load %struct.TYPE_5__*, %struct.TYPE_5__** %14
%22 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %21, i32 0, i32 0
store i32 %20, i32* %22
%23 = load i32, i32* %9
%24 = load %struct.TYPE_5__*, %struct.TYPE_5__** %14
%25 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %24, i32 0, i32 1
store i32 %23, i32* %25
%26 = load i32, i32* %10
%27 = load %struct.TYPE_5__*, %struct.TYPE_5__** %14
%28 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %27, i32 0, i32 2
store i32 %26, i32* %28
%29 = load i32, i32* %11
%30 = load %struct.TYPE_5__*, %struct.TYPE_5__** %14
%31 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %30, i32 0, i32 3
store i32 %29, i32* %31
%32 = load i32, i32* %12
%33 = load %struct.TYPE_5__*, %struct.TYPE_5__** %14
%34 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %33, i32 0, i32 4
store i32 %32, i32* %34
%35 = load i32*, i32** %7
%36 = load i32, i32* %8
%37 = load %struct.TYPE_5__*, %struct.TYPE_5__** %14
%38 = load i32, i32* %13
%39 = call i32 @XSetWMSizeHints(i32* %35, i32 %36, %struct.TYPE_5__* %37, i32 %38)
%40 = load %struct.TYPE_5__*, %struct.TYPE_5__** %14
%41 = call i32 @XFree(%struct.TYPE_5__* %40)
ret void
}

LLVM IR (-O2):
%struct.TYPE_5__ = type { i32, i32, i32, i32, i32 }
@.str = [16 x i8] c"WM_NORMAL_HINTS\00"
@PMinSize = global i32 0
@PMaxSize = global i32 0
define void @restrictsize(i32* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = tail call i32 @XInternAtom(i32* %0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 0)
%8 = tail call %struct.TYPE_5__* (...) @XAllocSizeHints()
%9 = load i32, i32* @PMinSize
%10 = load i32, i32* @PMaxSize
%11 = or i32 %10, %9
%12 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %8, i64 0, i32 0
store i32 %11, i32* %12
%13 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %8, i64 0, i32 1
store i32 %2, i32* %13
%14 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %8, i64 0, i32 2
store i32 %3, i32* %14
%15 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %8, i64 0, i32 3
store i32 %4, i32* %15
%16 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %8, i64 0, i32 4
store i32 %5, i32* %16
%17 = tail call i32 @XSetWMSizeHints(i32* %0, i32 %1, %struct.TYPE_5__* %8, i32 %7)
%18 = tail call i32 @XFree(%struct.TYPE_5__* %8)
ret void
}