#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_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int x;
  int y;
  int /*<<< orphan*/ state;
  int /*<<< orphan*/ y_root;
  int /*<<< orphan*/ x_root;
  int /*<<< orphan*/ window;
  int /*<<< orphan*/ root;
};
struct TYPE_4__ {
  TYPE_1__ xbutton;
};
typedef TYPE_2__ XEvent;
typedef int /*<<< orphan*/ Display;

/* Variables and functions */
int /*<<< orphan*/ DefaultRootWindow(int /*<<< orphan*/ *);
int /*<<< orphan*/ XQueryPointer(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                 int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                 int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                 int *, int *, int /*<<< orphan*/ *);
void coords(Display *display, int *x, int *y) {
  XEvent event;
  XQueryPointer(display, DefaultRootWindow(display), &event.xbutton.root,
                &event.xbutton.window, &event.xbutton.x_root,
                &event.xbutton.y_root, &event.xbutton.x, &event.xbutton.y,
                &event.xbutton.state);
  *x = event.xbutton.x;
  *y = event.xbutton.y;
}


x86 assembly (clang, -O0):
<coords>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <DefaultRootWindow@plt>
mov    -0x40(%rbp),%rdi
mov    %eax,%esi
lea    -0x38(%rbp),%rdx
add    $0x18,%rdx
lea    -0x38(%rbp),%rcx
add    $0x14,%rcx
lea    -0x38(%rbp),%r8
add    $0x10,%r8
lea    -0x38(%rbp),%r9
add    $0xc,%r9
lea    -0x38(%rbp),%r11
lea    -0x38(%rbp),%r10
add    $0x4,%r10
lea    -0x38(%rbp),%rax
add    $0x8,%rax
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1040 <XQueryPointer@plt>
mov    -0x38(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x34(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<coords>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
call   1030 <DefaultRootWindow@plt>
lea    0x20(%rsp),%rdx
lea    0x1c(%rsp),%rcx
lea    0x18(%rsp),%r8
lea    0x14(%rsp),%r9
lea    0xc(%rsp),%r10
lea    0x10(%rsp),%r11
sub    $0x8,%rsp
lea    0x10(%rsp),%r12
mov    %rbx,%rdi
mov    %eax,%esi
push   %r11
push   %r10
push   %r12
call   1040 <XQueryPointer@plt>
add    $0x20,%rsp
mov    0x8(%rsp),%eax
mov    %eax,(%r15)
mov    0xc(%rsp),%eax
mov    %eax,(%r14)
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.TYPE_4__ = type { %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i32, i32, i32, i32, i32, i32, i32 }
define void @coords(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca %struct.TYPE_4__
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%8 = load i32*, i32** %4
%9 = load i32*, i32** %4
%10 = call i32 @DefaultRootWindow(i32* %9)
%11 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %7, i32 0, i32 0
%12 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %11, i32 0, i32 6
%13 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %7, i32 0, i32 0
%14 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %13, i32 0, i32 5
%15 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %7, i32 0, i32 0
%16 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %15, i32 0, i32 4
%17 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %7, i32 0, i32 0
%18 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %17, i32 0, i32 3
%19 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %7, i32 0, i32 0
%20 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %19, i32 0, i32 0
%21 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %7, i32 0, i32 0
%22 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %21, i32 0, i32 1
%23 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %7, i32 0, i32 0
%24 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %23, i32 0, i32 2
%25 = call i32 @XQueryPointer(i32* %8, i32 %10, i32* %12, i32* %14, i32* %16, i32* %18, i32* %20, i32* %22, i32* %24)
%26 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %7, i32 0, i32 0
%27 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %26, i32 0, i32 0
%28 = load i32, i32* %27
%29 = load i32*, i32** %5
store i32 %28, i32* %29
%30 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %7, i32 0, i32 0
%31 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %30, i32 0, i32 1
%32 = load i32, i32* %31
%33 = load i32*, i32** %6
store i32 %32, i32* %33
ret void
}

LLVM IR (-O2):
%struct.TYPE_4__ = type { %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i32, i32, i32, i32, i32, i32, i32 }
define void @coords(i32* %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2) {
%4 = alloca %struct.TYPE_4__
%5 = bitcast %struct.TYPE_4__* %4 to i8*
%6 = tail call i32 @DefaultRootWindow(i32* %0)
%7 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %4, i64 0, i32 0, i32 6
%8 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %4, i64 0, i32 0, i32 5
%9 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %4, i64 0, i32 0, i32 4
%10 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %4, i64 0, i32 0, i32 3
%11 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %4, i64 0, i32 0, i32 0
%12 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %4, i64 0, i32 0, i32 1
%13 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %4, i64 0, i32 0, i32 2
%14 = call i32 @XQueryPointer(i32* %0, i32 %6, i32* %7, i32* %8, i32* %9, i32* %10, i32* %11, i32* %12, i32* %13)
%15 = load i32, i32* %11
store i32 %15, i32* %1
%16 = load i32, i32* %12
store i32 %16, i32* %2
ret void
}