#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 getDirection();
int *movePoint(int x, int y) {
  switch (getDirection()) {
  case 1:
    y--;
    break;
  case 2:
    y++;
    break;
  case 4:
    x--;
    break;
  case 3:
    x++;
    break;
  }
  static int r[2];
  r[0] = x;
  r[1] = y;
  return r;
}


x86 assembly (clang, -O0):
<movePoint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
xor    %eax,%eax
call   1030 <getDirection@plt>
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x3,%eax
ja     117e <movePoint+0x6e>
mov    -0x10(%rbp),%rax
lea    0xebe(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    117e <movePoint+0x6e>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    117e <movePoint+0x6e>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
jmp    117e <movePoint+0x6e>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,0x2ea5(%rip)
mov    -0x8(%rbp),%eax
mov    %eax,0x2ea0(%rip)
lea    0x2e95(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<movePoint>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <getDirection@plt>
add    $0xffffffff,%eax
cmp    $0x3,%eax
ja     1148 <movePoint+0x38>
lea    0xed3(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
add    $0xffffffff,%ebx
jmp    1148 <movePoint+0x38>
add    $0x1,%ebx
jmp    1148 <movePoint+0x38>
add    $0x1,%ebp
jmp    1148 <movePoint+0x38>
add    $0xffffffff,%ebp
mov    %ebp,0x2ede(%rip)
lea    0x2ed7(%rip),%rax
mov    %ebx,0x2ed5(%rip)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@movePoint.r = internal global [2 x i32] zeroinitializer
define i32* @movePoint(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 (...) @getDirection()
switch i32 %5, label %18 [
i32 1, label %6
i32 2, label %9
i32 4, label %12
i32 3, label %15
]
6: ; preds = %2
%7 = load i32, i32* %4
%8 = add nsw i32 %7, -1
store i32 %8, i32* %4
br label %18
9: ; preds = %2
%10 = load i32, i32* %4
%11 = add nsw i32 %10, 1
store i32 %11, i32* %4
br label %18
12: ; preds = %2
%13 = load i32, i32* %3
%14 = add nsw i32 %13, -1
store i32 %14, i32* %3
br label %18
15: ; preds = %2
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
br label %18
18: ; preds = %2, %15, %12, %9, %6
%19 = load i32, i32* %3
store i32 %19, i32* getelementptr inbounds ([2 x i32], [2 x i32]* @movePoint.r, i64 0, i64 0)
%20 = load i32, i32* %4
store i32 %20, i32* getelementptr inbounds ([2 x i32], [2 x i32]* @movePoint.r, i64 0, i64 1)
ret i32* getelementptr inbounds ([2 x i32], [2 x i32]* @movePoint.r, i64 0, i64 0)
}

LLVM IR (-O2):
@movePoint.r = internal global [2 x i32] zeroinitializer
define i32* @movePoint(i32 %0, i32 %1) {
%3 = tail call i32 (...) @getDirection()
switch i32 %3, label %12 [
i32 1, label %4
i32 2, label %6
i32 4, label %8
i32 3, label %10
]
4: ; preds = %2
%5 = add nsw i32 %1, -1
br label %12
6: ; preds = %2
%7 = add nsw i32 %1, 1
br label %12
8: ; preds = %2
%9 = add nsw i32 %0, -1
br label %12
10: ; preds = %2
%11 = add nsw i32 %0, 1
br label %12
12: ; preds = %2, %10, %8, %6, %4
%13 = phi i32 [ %0, %2 ], [ %11, %10 ], [ %9, %8 ], [ %0, %6 ], [ %0, %4 ]
%14 = phi i32 [ %1, %2 ], [ %1, %10 ], [ %1, %8 ], [ %7, %6 ], [ %5, %4 ]
store i32 %13, i32* getelementptr inbounds ([2 x i32], [2 x i32]* @movePoint.r, i64 0, i64 0)
store i32 %14, i32* getelementptr inbounds ([2 x i32], [2 x i32]* @movePoint.r, i64 0, i64 1)
ret i32* getelementptr inbounds ([2 x i32], [2 x i32]* @movePoint.r, i64 0, i64 0)
}