#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*/ Widget;

/* Variables and functions */
int /*<<< orphan*/ XQueryPointer(int /*<<< orphan*/, int /*<<< orphan*/,
                                 int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                 int *, int *, int *, int *, unsigned int *);
int /*<<< orphan*/ XtDisplay(int /*<<< orphan*/);
int /*<<< orphan*/ XtWindow(int /*<<< orphan*/);
int /*<<< orphan*/ position_near(int /*<<< orphan*/, int, int);
void position_near_mouse(Widget shell) {
  int x, y;
  Window root, child;
  int winx, winy;
  unsigned int mask;
  XQueryPointer(XtDisplay(shell), XtWindow(shell), &root, &child, &x, &y, &winx,
                &winy, &mask);
  position_near(shell, x, y);
}


x86 assembly (clang, -O0):
<position_near_mouse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1060 <XtDisplay@plt>
mov    %eax,-0x24(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <XtWindow@plt>
mov    -0x24(%rbp),%edi
mov    %eax,%esi
lea    -0x10(%rbp),%rdx
lea    -0x14(%rbp),%rcx
lea    -0x8(%rbp),%r8
lea    -0xc(%rbp),%r9
lea    -0x18(%rbp),%r11
lea    -0x1c(%rbp),%r10
lea    -0x20(%rbp),%rax
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1050 <XQueryPointer@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <position_near@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<position_near_mouse>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %edi,%ebx
call   1060 <XtDisplay@plt>
mov    %eax,%ebp
mov    %ebx,%edi
call   1040 <XtWindow@plt>
sub    $0x8,%rsp
lea    0x14(%rsp),%r10
lea    0x18(%rsp),%r11
lea    0x1c(%rsp),%r14
lea    0x24(%rsp),%rdx
lea    0x20(%rsp),%rcx
lea    0x10(%rsp),%r8
lea    0xc(%rsp),%r9
mov    %ebp,%edi
mov    %eax,%esi
push   %r10
push   %r11
push   %r14
call   1050 <XQueryPointer@plt>
add    $0x20,%rsp
mov    0x8(%rsp),%esi
mov    0x4(%rsp),%edx
mov    %ebx,%edi
call   1030 <position_near@plt>
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @position_near_mouse(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %2
%10 = load i32, i32* %2
%11 = call i32 @XtDisplay(i32 %10)
%12 = load i32, i32* %2
%13 = call i32 @XtWindow(i32 %12)
%14 = call i32 @XQueryPointer(i32 %11, i32 %13, i32* %5, i32* %6, i32* %3, i32* %4, i32* %7, i32* %8, i32* %9)
%15 = load i32, i32* %2
%16 = load i32, i32* %3
%17 = load i32, i32* %4
%18 = call i32 @position_near(i32 %15, i32 %16, i32 %17)
ret void
}

LLVM IR (-O2):
define void @position_near_mouse(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = bitcast i32* %2 to i8*
%10 = bitcast i32* %3 to i8*
%11 = bitcast i32* %4 to i8*
%12 = bitcast i32* %5 to i8*
%13 = bitcast i32* %6 to i8*
%14 = bitcast i32* %7 to i8*
%15 = bitcast i32* %8 to i8*
%16 = tail call i32 @XtDisplay(i32 %0)
%17 = tail call i32 @XtWindow(i32 %0)
%18 = call i32 @XQueryPointer(i32 %16, i32 %17, i32* %4, i32* %5, i32* %2, i32* %3, i32* %6, i32* %7, i32* %8)
%19 = load i32, i32* %2
%20 = load i32, i32* %3
%21 = call i32 @position_near(i32 %0, i32 %19, i32 %20)
ret void
}