#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*/ XMoveResizeWindow(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                     unsigned long, unsigned long,
                                     unsigned long, unsigned long);
unsigned long get_randnum(int, unsigned long);
int /*<<< orphan*/ send_client_msg(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                   char *, int /*<<< orphan*/, unsigned long,
                                   unsigned long, unsigned long, unsigned long);
scalar_t__ wm_supports(int /*<<< orphan*/ *, char *);
void move_window(Display *disp, Window *win, unsigned long desk_w,
                 unsigned long desk_h) {
  unsigned long x, y, w, h;
  x = get_randnum(0, desk_w);
  y = get_randnum(0, desk_h);
  w = get_randnum(150, desk_w);
  h = get_randnum(150, desk_h);
  if (wm_supports(disp, "_NET_MOVERESIZE_WINDOW")) {
    send_client_msg(disp, *win, "_NET_MOVERESIZE_WINDOW", 0, x, y, w, h);
  } else {
    XMoveResizeWindow(disp, *win, x, y, w, h);
  }
}


x86 assembly (clang, -O0):
<move_window>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x18(%rbp),%rsi
xor    %edi,%edi
call   1040 <get_randnum@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rsi
xor    %edi,%edi
call   1040 <get_randnum@plt>
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rsi
mov    $0x96,%edi
call   1040 <get_randnum@plt>
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%rsi
mov    $0x96,%edi
call   1040 <get_randnum@plt>
mov    %rax,-0x40(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe5b(%rip),%rsi
call   1050 <wm_supports@plt>
cmp    $0x0,%rax
je     11ea <move_window+0xaa>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%r9
mov    -0x38(%rbp),%r10
mov    -0x40(%rbp),%rax
lea    0xe2b(%rip),%rdx
xor    %ecx,%ecx
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1060 <send_client_msg@plt>
jmp    1209 <move_window+0xc9>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    -0x38(%rbp),%r8
mov    -0x40(%rbp),%r9
call   1030 <XMoveResizeWindow@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<move_window>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%rbp
mov    %rdx,%rbx
mov    %rsi,%r12
mov    %rdi,%r14
xor    %edi,%edi
mov    %rdx,%rsi
call   1040 <get_randnum@plt>
mov    %rax,(%rsp)
xor    %edi,%edi
mov    %rbp,%rsi
call   1040 <get_randnum@plt>
mov    %rax,%r15
mov    $0x96,%edi
mov    %rbx,%rsi
call   1040 <get_randnum@plt>
mov    %rax,%r13
mov    $0x96,%edi
mov    %rbp,%rsi
call   1040 <get_randnum@plt>
mov    %rax,%rbp
lea    0xe67(%rip),%rsi
mov    %r14,%rdi
call   1050 <wm_supports@plt>
mov    (%r12),%esi
test   %rax,%rax
je     11d4 <move_window+0x94>
lea    0xe4f(%rip),%rdx
mov    %r14,%rdi
xor    %ecx,%ecx
mov    (%rsp),%r8
mov    %r15,%r9
push   %rbp
push   %r13
call   1060 <send_client_msg@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r14,%rdi
mov    (%rsp),%rdx
mov    %r15,%rcx
mov    %r13,%r8
mov    %rbp,%r9
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <XMoveResizeWindow@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"_NET_MOVERESIZE_WINDOW\00"
define void @move_window(i32* %0, i32* %1, i64 %2, i64 %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
store i32* %0, i32** %5
store i32* %1, i32** %6
store i64 %2, i64* %7
store i64 %3, i64* %8
%13 = load i64, i64* %7
%14 = call i64 @get_randnum(i32 0, i64 %13)
store i64 %14, i64* %9
%15 = load i64, i64* %8
%16 = call i64 @get_randnum(i32 0, i64 %15)
store i64 %16, i64* %10
%17 = load i64, i64* %7
%18 = call i64 @get_randnum(i32 150, i64 %17)
store i64 %18, i64* %11
%19 = load i64, i64* %8
%20 = call i64 @get_randnum(i32 150, i64 %19)
store i64 %20, i64* %12
%21 = load i32*, i32** %5
%22 = call i64 @wm_supports(i32* %21, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %33
24: ; preds = %4
%25 = load i32*, i32** %5
%26 = load i32*, i32** %6
%27 = load i32, i32* %26
%28 = load i64, i64* %9
%29 = load i64, i64* %10
%30 = load i64, i64* %11
%31 = load i64, i64* %12
%32 = call i32 @send_client_msg(i32* %25, i32 %27, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 0, i64 %28, i64 %29, i64 %30, i64 %31)
br label %42
33: ; preds = %4
%34 = load i32*, i32** %5
%35 = load i32*, i32** %6
%36 = load i32, i32* %35
%37 = load i64, i64* %9
%38 = load i64, i64* %10
%39 = load i64, i64* %11
%40 = load i64, i64* %12
%41 = call i32 @XMoveResizeWindow(i32* %34, i32 %36, i64 %37, i64 %38, i64 %39, i64 %40)
br label %42
42: ; preds = %33, %24
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"_NET_MOVERESIZE_WINDOW\00"
define void @move_window(i32* %0, i32* nocapture %1, i64 %2, i64 %3) {
%5 = tail call i64 @get_randnum(i32 0, i64 %2)
%6 = tail call i64 @get_randnum(i32 0, i64 %3)
%7 = tail call i64 @get_randnum(i32 150, i64 %2)
%8 = tail call i64 @get_randnum(i32 150, i64 %3)
%9 = tail call i64 @wm_supports(i32* %0, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
%11 = load i32, i32* %1
br i1 %10, label %14, label %12
12: ; preds = %4
%13 = tail call i32 @send_client_msg(i32* %0, i32 %11, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 0, i64 %5, i64 %6, i64 %7, i64 %8)
br label %16
14: ; preds = %4
%15 = tail call i32 @XMoveResizeWindow(i32* %0, i32 %11, i64 %5, i64 %6, i64 %7, i64 %8)
br label %16
16: ; preds = %14, %12
ret void
}