#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*/ STDIN_FILENO;
scalar_t__ read(int /*<<< orphan*/, char *, int);
int get_movement(char *command, int cmd_len, int num_times) {
  char c;
  while (read(STDIN_FILENO, &c, 1)) {
    if (c >= '1' && c <= '9') {
    }
    switch (c) {
    case '\033':
    case '\027':
      return -1;
    case 'h':
    case 'j':
    case 'k':
    case 'l':
    case 'H':
    case 'M':
    case 'L':
    case 'w':
    case 'W':
    case 'b':
    case 'B':
    case 'e':
    case 'E':
    case '(':
    case ')':
    case '{':
    case '}':
    case '0':
    case '$':
    case 'G':
    case ':':
    case 'f':
    case 'F':
    case '%':
    default:
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<get_movement>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    0x2eb7(%rip),%rax
mov    (%rax),%edi
lea    -0x19(%rbp),%rsi
mov    $0x1,%edx
call   1030 <read@plt>
cmp    $0x0,%rax
je     11a9 <get_movement+0x99>
movsbl -0x19(%rbp),%eax
cmp    $0x31,%eax
jl     1162 <get_movement+0x52>
movsbl -0x19(%rbp),%eax
cmp    $0x39,%eax
jg     1162 <get_movement+0x52>
jmp    1162 <get_movement+0x52>
movsbl -0x19(%rbp),%eax
add    $0xffffffe9,%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0x66,%eax
ja     119d <get_movement+0x8d>
mov    -0x28(%rbp),%rax
lea    0xe7d(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0xffffffff,-0x4(%rbp)
jmp    11b0 <get_movement+0xa0>
jmp    119d <get_movement+0x8d>
movl   $0x1,-0x4(%rbp)
jmp    11b0 <get_movement+0xa0>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_movement>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
lea    0x7(%rsp),%rsi
mov    $0x1,%edx
call   1030 <read@plt>
test   %rax,%rax
je     113f <get_movement+0x2f>
mov    0x7(%rsp),%al
add    $0xe9,%al
and    $0xfb,%al
cmp    $0x1,%al
sbb    %eax,%eax
or     $0x1,%eax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@STDIN_FILENO = global i32 0
define i32 @get_movement(i8* %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
br label %9
9: ; preds = %3
%10 = load i32, i32* @STDIN_FILENO
%11 = call i64 @read(i32 %10, i8* %8, i32 1)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %28
13: ; preds = %9
%14 = load i8, i8* %8
%15 = sext i8 %14 to i32
%16 = icmp sge i32 %15, 49
br i1 %16, label %17, label %22
17: ; preds = %13
%18 = load i8, i8* %8
%19 = sext i8 %18 to i32
%20 = icmp sle i32 %19, 57
br i1 %20, label %21, label %22
21: ; preds = %17
br label %22
22: ; preds = %21, %17, %13
%23 = load i8, i8* %8
%24 = sext i8 %23 to i32
switch i32 %24, label %27 [
i32 27, label %25
i32 23, label %25
i32 104, label %26
i32 106, label %26
i32 107, label %26
i32 108, label %26
i32 72, label %26
i32 77, label %26
i32 76, label %26
i32 119, label %26
i32 87, label %26
i32 98, label %26
i32 66, label %26
i32 101, label %26
i32 69, label %26
i32 40, label %26
i32 41, label %26
i32 123, label %26
i32 125, label %26
i32 48, label %26
i32 36, label %26
i32 71, label %26
i32 58, label %26
i32 102, label %26
i32 70, label %26
i32 37, label %26
]
25: ; preds = %22, %22
store i32 -1, i32* %4
br label %29
26: ; preds = %22, %22, %22, %22, %22, %22, %22, %22, %22, %22, %22, %22, %22, %22, %22, %22, %22, %22, %22, %22, %22, %22, %22, %22
br label %27
27: ; preds = %22, %26
store i32 1, i32* %4
br label %29
28: ; preds = %9
store i32 0, i32* %4
br label %29
29: ; preds = %28, %27, %25
%30 = load i32, i32* %4
ret i32 %30
}

LLVM IR (-O2):
@STDIN_FILENO = global i32 0
define i32 @get_movement(i8* nocapture readnone %0, i32 %1, i32 %2) {
%4 = alloca i8
%5 = load i32, i32* @STDIN_FILENO
%6 = call i64 @read(i32 %5, i8* %4, i32 1)
%7 = icmp eq i64 %6, 0
br i1 %7, label %14, label %8
8: ; preds = %3
%9 = load i8, i8* %4
%10 = icmp eq i8 %9, 27
%11 = icmp eq i8 %9, 23
%12 = or i1 %10, %11
%13 = select i1 %12, i32 -1, i32 1
br label %14
14: ; preds = %3, %8
%15 = phi i32 [ %13, %8 ], [ 0, %3 ]
ret i32 %15
}