#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 /*<<< orphan*/ move(int, int);
int /*<<< orphan*/ mvaddch(int, int, char);
void movePlayer(char input, int *posY, int *posX) {
  switch (input) {
  case 'w':
    mvaddch(*posY, *posX, '.');
    *posY -= 1;
    break;
  case 'a':
    mvaddch(*posY, *posX, '.');
    *posX -= 1;
    break;
  case 's':
    mvaddch(*posY, *posX, '.');
    *posY += 1;
    break;
  case 'd':
    mvaddch(*posY, *posX, '.');
    *posX += 1;
    break;
  default:
    return;
  }
  mvaddch(*posY, *posX, '@');
  move(*posY, *posX);
}


x86 assembly (clang, -O0):
<movePlayer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movsbl -0x1(%rbp),%eax
add    $0xffffff9f,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x16,%eax
ja     11f8 <movePlayer+0xd8>
mov    -0x20(%rbp),%rax
lea    0xea9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
mov    $0x2e,%edx
call   1030 <mvaddch@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
sub    $0x1,%ecx
mov    %ecx,(%rax)
jmp    11fd <movePlayer+0xdd>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
mov    $0x2e,%edx
call   1030 <mvaddch@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
sub    $0x1,%ecx
mov    %ecx,(%rax)
jmp    11fd <movePlayer+0xdd>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
mov    $0x2e,%edx
call   1030 <mvaddch@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
jmp    11fd <movePlayer+0xdd>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
mov    $0x2e,%edx
call   1030 <mvaddch@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
jmp    11fd <movePlayer+0xdd>
jmp    1224 <movePlayer+0x104>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
mov    $0x40,%edx
call   1030 <mvaddch@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
call   1040 <move@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<movePlayer>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
add    $0xffffff9f,%edi
cmp    $0x16,%edi
ja     1159 <movePlayer+0x39>
mov    %rdx,%r14
mov    %rsi,%rbx
mov    $0xffffffff,%r15d
lea    0xebe(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
mov    %rsi,%rbp
jmp    *%rcx
mov    $0x1,%r15d
mov    %r14,%rbp
jmp    116d <movePlayer+0x4d>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%r15d
mov    %rbx,%rbp
mov    (%rbx),%edi
mov    (%r14),%esi
mov    $0x2e,%edx
call   1030 <mvaddch@plt>
add    %r15d,0x0(%rbp)
mov    (%rbx),%edi
mov    (%r14),%esi
mov    $0x40,%edx
call   1030 <mvaddch@plt>
mov    (%rbx),%edi
mov    (%r14),%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <move@plt>

LLVM IR (-O0):
define void @movePlayer(i8 signext %0, i32* %1, i32* %2) {
%4 = alloca i8
%5 = alloca i32*
%6 = alloca i32*
store i8 %0, i8* %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%7 = load i8, i8* %4
%8 = sext i8 %7 to i32
switch i32 %8, label %45 [
i32 119, label %9
i32 97, label %18
i32 115, label %27
i32 100, label %36
]
9: ; preds = %3
%10 = load i32*, i32** %5
%11 = load i32, i32* %10
%12 = load i32*, i32** %6
%13 = load i32, i32* %12
%14 = call i32 @mvaddch(i32 %11, i32 %13, i8 signext 46)
%15 = load i32*, i32** %5
%16 = load i32, i32* %15
%17 = sub nsw i32 %16, 1
store i32 %17, i32* %15
br label %46
18: ; preds = %3
%19 = load i32*, i32** %5
%20 = load i32, i32* %19
%21 = load i32*, i32** %6
%22 = load i32, i32* %21
%23 = call i32 @mvaddch(i32 %20, i32 %22, i8 signext 46)
%24 = load i32*, i32** %6
%25 = load i32, i32* %24
%26 = sub nsw i32 %25, 1
store i32 %26, i32* %24
br label %46
27: ; preds = %3
%28 = load i32*, i32** %5
%29 = load i32, i32* %28
%30 = load i32*, i32** %6
%31 = load i32, i32* %30
%32 = call i32 @mvaddch(i32 %29, i32 %31, i8 signext 46)
%33 = load i32*, i32** %5
%34 = load i32, i32* %33
%35 = add nsw i32 %34, 1
store i32 %35, i32* %33
br label %46
36: ; preds = %3
%37 = load i32*, i32** %5
%38 = load i32, i32* %37
%39 = load i32*, i32** %6
%40 = load i32, i32* %39
%41 = call i32 @mvaddch(i32 %38, i32 %40, i8 signext 46)
%42 = load i32*, i32** %6
%43 = load i32, i32* %42
%44 = add nsw i32 %43, 1
store i32 %44, i32* %42
br label %46
45: ; preds = %3
br label %57
46: ; preds = %36, %27, %18, %9
%47 = load i32*, i32** %5
%48 = load i32, i32* %47
%49 = load i32*, i32** %6
%50 = load i32, i32* %49
%51 = call i32 @mvaddch(i32 %48, i32 %50, i8 signext 64)
%52 = load i32*, i32** %5
%53 = load i32, i32* %52
%54 = load i32*, i32** %6
%55 = load i32, i32* %54
%56 = call i32 @move(i32 %53, i32 %55)
br label %57
57: ; preds = %46, %45
ret void
}

LLVM IR (-O2):
define void @movePlayer(i8 signext %0, i32* nocapture %1, i32* nocapture %2) {
%4 = sext i8 %0 to i32
switch i32 %4, label %22 [
i32 119, label %8
i32 97, label %5
i32 115, label %6
i32 100, label %7
]
5: ; preds = %3
br label %8
6: ; preds = %3
br label %8
7: ; preds = %3
br label %8
8: ; preds = %3, %7, %6, %5
%9 = phi i32* [ %2, %7 ], [ %1, %6 ], [ %2, %5 ], [ %1, %3 ]
%10 = phi i32 [ 1, %7 ], [ 1, %6 ], [ -1, %5 ], [ -1, %3 ]
%11 = load i32, i32* %1
%12 = load i32, i32* %2
%13 = tail call i32 @mvaddch(i32 %11, i32 %12, i8 signext 46)
%14 = load i32, i32* %9
%15 = add nsw i32 %14, %10
store i32 %15, i32* %9
%16 = load i32, i32* %1
%17 = load i32, i32* %2
%18 = tail call i32 @mvaddch(i32 %16, i32 %17, i8 signext 64)
%19 = load i32, i32* %1
%20 = load i32, i32* %2
%21 = tail call i32 @move(i32 %19, i32 %20)
br label %22
22: ; preds = %3, %8
ret void
}