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

/* Variables and functions */
int DisplayHeight(int /*<<< orphan*/ *, int /*<<< orphan*/);
int DisplayWidth(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ XCloseDisplay(int /*<<< orphan*/ *);
int /*<<< orphan*/ XFlush(int /*<<< orphan*/ *);
int /*<<< orphan*/ *XOpenDisplay(int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ mouseMove(int /*<<< orphan*/ *, int, int);
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ usleep(int);
int main(int argc, char *argv[]) {
  Display *display;
  int display_width, display_height;
  int i;
  display = XOpenDisplay(NULL);
  if (display == NULL) {
    fprintf(stderr, "Cannot open display.\n");
    exit(1);
  }
  usleep(50);
  display_width = DisplayWidth(display, 0);
  display_height = DisplayHeight(display, 0);
  i = 0;
  while (1) {
    int x = 0, y = 0;
    i++;
    scanf("%d", &x);
    scanf("%d", &y);
    printf("%d %d\n", x, y);
    mouseMove(display, x, y);
    XFlush(display);
    if (i > 10)
      break;
  }
  XFlush(display);
  XCloseDisplay(display);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1060 <XOpenDisplay@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11fd <main+0x4d>
mov    0x2dfb(%rip),%rax
mov    (%rax),%edi
lea    0xe12(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    $0x32,%edi
call   10d0 <usleep@plt>
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
call   1040 <DisplayWidth@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
call   1030 <DisplayHeight@plt>
mov    %eax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
lea    0xdce(%rip),%rdi
lea    -0x28(%rbp),%rsi
call   1080 <scanf@plt>
lea    0xdbe(%rip),%rdi
lea    -0x2c(%rbp),%rsi
call   1080 <scanf@plt>
mov    -0x28(%rbp),%esi
mov    -0x2c(%rbp),%edx
lea    0xdab(%rip),%rdi
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    -0x2c(%rbp),%edx
call   10c0 <mouseMove@plt>
mov    -0x18(%rbp),%rdi
call   1090 <XFlush@plt>
cmpl   $0xa,-0x24(%rbp)
jle    129a <main+0xea>
jmp    129f <main+0xef>
jmp    122a <main+0x7a>
mov    -0x18(%rbp),%rdi
call   1090 <XFlush@plt>
mov    -0x18(%rbp),%rdi
call   10b0 <XCloseDisplay@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %edi,%edi
call   1060 <XOpenDisplay@plt>
test   %rax,%rax
je     1281 <main+0xd1>
mov    %rax,%rbx
mov    $0x32,%edi
call   10d0 <usleep@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <DisplayWidth@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <DisplayHeight@plt>
mov    $0xb,%ebp
lea    0xe1e(%rip),%r14
lea    0x4(%rsp),%r15
mov    %rsp,%r12
lea    0xe12(%rip),%r13
nopw   0x0(%rax,%rax,1)
movl   $0x0,0x4(%rsp)
movl   $0x0,(%rsp)
mov    %r14,%rdi
mov    %r15,%rsi
call   1080 <scanf@plt>
mov    %r14,%rdi
mov    %r12,%rsi
call   1080 <scanf@plt>
mov    0x4(%rsp),%esi
mov    (%rsp),%edx
mov    %r13,%rdi
call   1050 <printf@plt>
mov    0x4(%rsp),%esi
mov    (%rsp),%edx
mov    %rbx,%rdi
call   10c0 <mouseMove@plt>
mov    %rbx,%rdi
call   1090 <XFlush@plt>
add    $0xffffffff,%ebp
jne    1210 <main+0x60>
mov    %rbx,%rdi
call   1090 <XFlush@plt>
mov    %rbx,%rdi
call   10b0 <XCloseDisplay@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2d58(%rip),%rax
mov    (%rax),%edi
lea    0xd6f(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [22 x i8] c"Cannot open display.\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [7 x i8] c"%d %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = call i32* @XOpenDisplay(i32* null)
store i32* %12, i32** %6
%13 = load i32*, i32** %6
%14 = icmp eq i32* %13, null
br i1 %14, label %15, label %19
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%18 = call i32 @exit(i32 1)
unreachable
19: ; preds = %2
%20 = call i32 @usleep(i32 50)
%21 = load i32*, i32** %6
%22 = call i32 @DisplayWidth(i32* %21, i32 0)
store i32 %22, i32* %7
%23 = load i32*, i32** %6
%24 = call i32 @DisplayHeight(i32* %23, i32 0)
store i32 %24, i32* %8
store i32 0, i32* %9
br label %25
25: ; preds = %19, %42
store i32 0, i32* %10
store i32 0, i32* %11
%26 = load i32, i32* %9
%27 = add nsw i32 %26, 1
store i32 %27, i32* %9
%28 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %10)
%29 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %11)
%30 = load i32, i32* %10
%31 = load i32, i32* %11
%32 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %30, i32 %31)
%33 = load i32*, i32** %6
%34 = load i32, i32* %10
%35 = load i32, i32* %11
%36 = call i32 @mouseMove(i32* %33, i32 %34, i32 %35)
%37 = load i32*, i32** %6
%38 = call i32 @XFlush(i32* %37)
%39 = load i32, i32* %9
%40 = icmp sgt i32 %39, 10
br i1 %40, label %41, label %42
41: ; preds = %25
br label %43
42: ; preds = %25
br label %25
43: ; preds = %41
%44 = load i32*, i32** %6
%45 = call i32 @XFlush(i32* %44)
%46 = load i32*, i32** %6
%47 = call i32 @XCloseDisplay(i32* %46)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [22 x i8] c"Cannot open display.\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [7 x i8] c"%d %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = tail call i32* @XOpenDisplay(i32* null)
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %2
%12 = tail call i32 @usleep(i32 50)
%13 = tail call i32 @DisplayWidth(i32* %5, i32 0)
%14 = tail call i32 @DisplayHeight(i32* %5, i32 0)
%15 = bitcast i32* %3 to i8*
%16 = bitcast i32* %4 to i8*
br label %17
17: ; preds = %17, %11
%18 = phi i32 [ 0, %11 ], [ %19, %17 ]
store i32 0, i32* %3
store i32 0, i32* %4
%19 = add nuw nsw i32 %18, 1
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%22 = load i32, i32* %3
%23 = load i32, i32* %4
%24 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %22, i32 %23)
%25 = load i32, i32* %3
%26 = load i32, i32* %4
%27 = call i32 @mouseMove(i32* %5, i32 %25, i32 %26)
%28 = call i32 @XFlush(i32* %5)
%29 = icmp eq i32 %19, 11
br i1 %29, label %30, label %17
30: ; preds = %17
%31 = call i32 @XFlush(i32* %5)
%32 = call i32 @XCloseDisplay(i32* %5)
ret i32 0
}