#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*/ draw_x(int);
int /*<<< orphan*/ draw_y(int);
char getch();
scalar_t__ kbhit();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ system(char *);
int main(int argc, char *argv[]) {
  int axis_x = 5;
  int axis_y = 10;
  char user_input;
  while (1) {
    system("clear");
    draw_x(axis_x);
    draw_y(axis_y);
    printf("*");
    printf("\n");
    if (kbhit()) {
      user_input = getch();
      switch (user_input) {
      case 'a':
        axis_y--;
        break;
      case 'd':
        axis_y++;
        break;
      case 'w':
        axis_x--;
        break;
      case 's':
        axis_x++;
        break;
      default:
        printf("Please input a/d/w/s\n");
      }
    }
  }
  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)
movl   $0x5,-0x14(%rbp)
movl   $0xa,-0x18(%rbp)
lea    0xed1(%rip),%rdi
call   1030 <system@plt>
mov    -0x14(%rbp),%edi
call   1060 <draw_x@plt>
mov    -0x18(%rbp),%edi
call   1080 <draw_y@plt>
lea    0xebb(%rip),%rdi
call   1040 <printf@plt>
lea    0xec5(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <kbhit@plt>
cmp    $0x0,%rax
je     1246 <main+0xe6>
xor    %eax,%eax
call   1070 <getch@plt>
mov    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
add    $0xffffff9f,%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0x16,%eax
ja     1235 <main+0xd5>
mov    -0x28(%rbp),%rax
lea    0xe0c(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    1241 <main+0xe1>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1241 <main+0xe1>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1241 <main+0xe1>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1241 <main+0xe1>
lea    0xe28(%rip),%rdi
call   1040 <printf@plt>
jmp    1246 <main+0xe6>
jmp    1184 <main+0x24>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    $0x5,%ebx
mov    $0xa,%ebp
lea    0xed3(%rip),%r14
lea    0xed2(%rip),%r15
lea    0xe69(%rip),%r12
jmp    11a8 <main+0x38>
nopl   0x0(%rax)
mov    %r15,%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
call   1050 <system@plt>
mov    %ebx,%edi
call   1070 <draw_x@plt>
mov    %ebp,%edi
call   1090 <draw_y@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1060 <kbhit@plt>
test   %rax,%rax
je     11a8 <main+0x38>
xor    %eax,%eax
call   1080 <getch@plt>
movsbl %al,%eax
add    $0xffffff9f,%eax
cmp    $0x16,%eax
ja     11a0 <main+0x30>
movslq (%r12,%rax,4),%rax
add    %r12,%rax
jmp    *%rax
add    $0xffffffff,%ebp
jmp    11a8 <main+0x38>
add    $0x1,%ebp
jmp    11a8 <main+0x38>
add    $0x1,%ebx
jmp    11a8 <main+0x38>
add    $0xffffffff,%ebx
jmp    11a8 <main+0x38>

LLVM IR (-O0):
@.str = [6 x i8] c"clear\00"
@.str.1 = [2 x i8] c"*\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [22 x i8] c"Please input a/d/w/s\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 i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 5, i32* %6
store i32 10, i32* %7
br label %9
9: ; preds = %2, %38
%10 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%11 = load i32, i32* %6
%12 = call i32 @draw_x(i32 %11)
%13 = load i32, i32* %7
%14 = call i32 @draw_y(i32 %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%16 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%17 = call i64 (...) @kbhit()
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %38
19: ; preds = %9
%20 = call signext i8 (...) @getch()
store i8 %20, i8* %8
%21 = load i8, i8* %8
%22 = sext i8 %21 to i32
switch i32 %22, label %35 [
i32 97, label %23
i32 100, label %26
i32 119, label %29
i32 115, label %32
]
23: ; preds = %19
%24 = load i32, i32* %7
%25 = add nsw i32 %24, -1
store i32 %25, i32* %7
br label %37
26: ; preds = %19
%27 = load i32, i32* %7
%28 = add nsw i32 %27, 1
store i32 %28, i32* %7
br label %37
29: ; preds = %19
%30 = load i32, i32* %6
%31 = add nsw i32 %30, -1
store i32 %31, i32* %6
br label %37
32: ; preds = %19
%33 = load i32, i32* %6
%34 = add nsw i32 %33, 1
store i32 %34, i32* %6
br label %37
35: ; preds = %19
%36 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
br label %37
37: ; preds = %35, %32, %29, %26, %23
br label %38
38: ; preds = %37, %9
br label %9
}

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
@str = [21 x i8] c"Please input a/d/w/s\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %23, %2
%4 = phi i32 [ 10, %2 ], [ %24, %23 ]
%5 = phi i32 [ 5, %2 ], [ %7, %23 ]
br label %6
6: ; preds = %29, %3
%7 = phi i32 [ %5, %3 ], [ %30, %29 ]
br label %8
8: ; preds = %33, %6
%9 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%10 = tail call i32 @draw_x(i32 %7)
%11 = tail call i32 @draw_y(i32 %4)
%12 = tail call i32 @putchar(i32 42)
%13 = tail call i32 @putchar(i32 10)
%14 = tail call i64 (...) @kbhit()
%15 = icmp eq i64 %14, 0
br i1 %15, label %33, label %16
16: ; preds = %8
%17 = tail call signext i8 (...) @getch()
%18 = sext i8 %17 to i32
switch i32 %18, label %31 [
i32 97, label %19
i32 100, label %21
i32 119, label %25
i32 115, label %27
]
19: ; preds = %16
%20 = add nsw i32 %4, -1
br label %23
21: ; preds = %16
%22 = add nsw i32 %4, 1
br label %23
23: ; preds = %21, %19
%24 = phi i32 [ %20, %19 ], [ %22, %21 ]
br label %3
25: ; preds = %16
%26 = add nsw i32 %7, -1
br label %29
27: ; preds = %16
%28 = add nsw i32 %7, 1
br label %29
29: ; preds = %27, %25
%30 = phi i32 [ %26, %25 ], [ %28, %27 ]
br label %6
31: ; preds = %16
%32 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
br label %33
33: ; preds = %31, %8
br label %8
}