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

/* Variables and functions */
int decodeX(int);
int decodeY(int);
int /*<<< orphan*/ printf(char *, int, int, int, ...);
void printMove(int moveValue) {
  char rotate = moveValue >> 31;
  int p = (moveValue >> 16) & 0x7FFF;
  int postitionX = decodeX(p);
  int postitionY = decodeY(p);
  int value = moveValue & 0xFFFF;
  if (rotate) {
    printf("(%i,%i) rotates %i degrees\n", postitionX, postitionY, value);
  } else {
    int vx = decodeX(value);
    int vy = decodeY(value);
    printf("(%i,%i) moves to %i,%i\n", postitionX, postitionY, vx, vy);
  }
}


x86 assembly (clang, -O0):
<printMove>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1f,%eax
mov    %al,-0x5(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x10,%eax
and    $0x7fff,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <decodeX@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <decodeY@plt>
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
and    $0xffff,%eax
mov    %eax,-0x18(%rbp)
cmpb   $0x0,-0x5(%rbp)
je     1199 <printMove+0x69>
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ca <printMove+0x9a>
mov    -0x18(%rbp),%edi
call   1050 <decodeX@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%edi
call   1040 <decodeY@plt>
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printMove>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebp
mov    %edi,%ebx
shr    $0x10,%ebx
and    $0x7fff,%ebx
mov    %ebx,%edi
call   1050 <decodeX@plt>
mov    %eax,%r14d
mov    %ebx,%edi
call   1040 <decodeY@plt>
mov    %eax,%r15d
movzwl %bp,%ebx
test   %ebp,%ebp
js     1192 <printMove+0x62>
mov    %ebx,%edi
call   1050 <decodeX@plt>
mov    %eax,%ebp
mov    %ebx,%edi
call   1040 <decodeY@plt>
lea    0xea6(%rip),%rdi
mov    %r14d,%esi
mov    %r15d,%edx
mov    %ebp,%ecx
mov    %eax,%r8d
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printf@plt>
lea    0xe67(%rip),%rdi
mov    %r14d,%esi
mov    %r15d,%edx
mov    %ebx,%ecx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"(%i,%i) rotates %i degrees\0A\00"
@.str.1 = [24 x i8] c"(%i,%i) moves to %i,%i\0A\00"
define void @printMove(i32 %0) {
%2 = alloca i32
%3 = alloca i8
%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 = ashr i32 %10, 31
%12 = trunc i32 %11 to i8
store i8 %12, i8* %3
%13 = load i32, i32* %2
%14 = ashr i32 %13, 16
%15 = and i32 %14, 32767
store i32 %15, i32* %4
%16 = load i32, i32* %4
%17 = call i32 @decodeX(i32 %16)
store i32 %17, i32* %5
%18 = load i32, i32* %4
%19 = call i32 @decodeY(i32 %18)
store i32 %19, i32* %6
%20 = load i32, i32* %2
%21 = and i32 %20, 65535
store i32 %21, i32* %7
%22 = load i8, i8* %3
%23 = icmp ne i8 %22, 0
br i1 %23, label %24, label %29
24: ; preds = %1
%25 = load i32, i32* %5
%26 = load i32, i32* %6
%27 = load i32, i32* %7
%28 = call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %25, i32 %26, i32 %27)
br label %39
29: ; preds = %1
%30 = load i32, i32* %7
%31 = call i32 @decodeX(i32 %30)
store i32 %31, i32* %8
%32 = load i32, i32* %7
%33 = call i32 @decodeY(i32 %32)
store i32 %33, i32* %9
%34 = load i32, i32* %5
%35 = load i32, i32* %6
%36 = load i32, i32* %8
%37 = load i32, i32* %9
%38 = call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %34, i32 %35, i32 %36, i32 %37)
br label %39
39: ; preds = %29, %24
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"(%i,%i) rotates %i degrees\0A\00"
@.str.1 = [24 x i8] c"(%i,%i) moves to %i,%i\0A\00"
define void @printMove(i32 %0) {
%2 = lshr i32 %0, 16
%3 = and i32 %2, 32767
%4 = tail call i32 @decodeX(i32 %3)
%5 = tail call i32 @decodeY(i32 %3)
%6 = and i32 %0, 65535
%7 = icmp sgt i32 %0, -1
br i1 %7, label %10, label %8
8: ; preds = %1
%9 = tail call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %5, i32 %6)
br label %14
10: ; preds = %1
%11 = tail call i32 @decodeX(i32 %6)
%12 = tail call i32 @decodeY(i32 %6)
%13 = tail call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %4, i32 %5, i32 %11, i32 %12)
br label %14
14: ; preds = %10, %8
ret void
}