#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int sscanf(char *, char *, int *, int *);
scalar_t__ strstr(char *, char *);
int getmove(int *start, int *end) {
  char str[20];
  printf("\nenter your move ? ");
  scanf("%20s", &str[0]);
  if (strstr(str, "part"))
    return 0;
  else if (sscanf(str, "%d-%d", start, end) == 2) {
    printf("MOVE: %d - %d\n", *start, *end);
    return 1;
  } else if (sscanf(str, "%dx%d", start, end) == 2)
    return 2;
  else if (strstr(str, "quit"))
    return 3;
  else if (strstr(str, "load"))
    return 4;
  else if (strstr(str, "save"))
    return 5;
  else if (strstr(str, "time"))
    return 6;
  return 7;
}


x86 assembly (clang, -O0):
<getmove>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rsi
lea    0xeab(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x30(%rbp),%rdi
lea    0xea0(%rip),%rsi
call   1060 <strstr@plt>
cmp    $0x0,%rax
je     1194 <getmove+0x54>
movl   $0x0,-0x4(%rbp)
jmp    12c5 <getmove+0x185>
lea    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xe77(%rip),%rsi
call   1040 <sscanf@plt>
cmp    $0x2,%eax
jne    11db <getmove+0x9b>
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12c5 <getmove+0x185>
lea    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xe45(%rip),%rsi
call   1040 <sscanf@plt>
cmp    $0x2,%eax
jne    1208 <getmove+0xc8>
movl   $0x2,-0x4(%rbp)
jmp    12c5 <getmove+0x185>
lea    -0x30(%rbp),%rdi
lea    0xe26(%rip),%rsi
call   1060 <strstr@plt>
cmp    $0x0,%rax
je     122e <getmove+0xee>
movl   $0x3,-0x4(%rbp)
jmp    12c5 <getmove+0x185>
lea    -0x30(%rbp),%rdi
lea    0xe05(%rip),%rsi
call   1060 <strstr@plt>
cmp    $0x0,%rax
je     1254 <getmove+0x114>
movl   $0x4,-0x4(%rbp)
jmp    12c5 <getmove+0x185>
lea    -0x30(%rbp),%rdi
lea    0xde4(%rip),%rsi
call   1060 <strstr@plt>
cmp    $0x0,%rax
je     127a <getmove+0x13a>
movl   $0x5,-0x4(%rbp)
jmp    12c5 <getmove+0x185>
lea    -0x30(%rbp),%rdi
lea    0xdc3(%rip),%rsi
call   1060 <strstr@plt>
cmp    $0x0,%rax
je     12a0 <getmove+0x160>
movl   $0x6,-0x4(%rbp)
jmp    12c5 <getmove+0x185>
jmp    12a5 <getmove+0x165>
jmp    12aa <getmove+0x16a>
jmp    12af <getmove+0x16f>
jmp    12b4 <getmove+0x174>
jmp    12b9 <getmove+0x179>
jmp    12be <getmove+0x17e>
movl   $0x7,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getmove>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
lea    0xea9(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xead(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1050 <scanf@plt>
lea    0xea0(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strstr@plt>
test   %rax,%rax
jne    1247 <getmove+0x107>
lea    0xe8d(%rip),%rsi
mov    %rsp,%rdi
mov    %r15,%rdx
mov    %r14,%rcx
call   1040 <sscanf@plt>
cmp    $0x2,%eax
jne    11c2 <getmove+0x82>
mov    (%r15),%esi
mov    (%r14),%edx
lea    0xe73(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%ebp
jmp    1247 <getmove+0x107>
lea    0xe6a(%rip),%rsi
mov    %rsp,%rdi
mov    %r15,%rdx
mov    %r14,%rcx
call   1040 <sscanf@plt>
mov    $0x2,%ebp
cmp    $0x2,%eax
je     1247 <getmove+0x107>
lea    0xe51(%rip),%rsi
mov    %rsp,%rdi
call   1060 <strstr@plt>
mov    $0x3,%ebp
test   %rax,%rax
jne    1247 <getmove+0x107>
lea    0xe3d(%rip),%rsi
mov    %rsp,%rdi
call   1060 <strstr@plt>
mov    $0x4,%ebp
test   %rax,%rax
jne    1247 <getmove+0x107>
lea    0xe29(%rip),%rsi
mov    %rsp,%rdi
call   1060 <strstr@plt>
mov    $0x5,%ebp
test   %rax,%rax
jne    1247 <getmove+0x107>
lea    0xe15(%rip),%rsi
mov    %rsp,%rdi
call   1060 <strstr@plt>
xor    %ebp,%ebp
test   %rax,%rax
sete   %bpl
or     $0x6,%ebp
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"\0Aenter your move ? \00"
@.str.1 = [5 x i8] c"%20s\00"
@.str.2 = [5 x i8] c"part\00"
@.str.3 = [6 x i8] c"%d-%d\00"
@.str.4 = [15 x i8] c"MOVE: %d - %d\0A\00"
@.str.5 = [6 x i8] c"%dx%d\00"
@.str.6 = [5 x i8] c"quit\00"
@.str.7 = [5 x i8] c"load\00"
@.str.8 = [5 x i8] c"save\00"
@.str.9 = [5 x i8] c"time\00"
define i32 @getmove(i32* %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca [20 x i8]
store i32* %0, i32** %4
store i32* %1, i32** %5
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%8 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%9 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%11 = call i64 @strstr(i8* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %2
store i32 0, i32* %3
br label %60
14: ; preds = %2
%15 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%16 = load i32*, i32** %4
%17 = load i32*, i32** %5
%18 = call i32 @sscanf(i8* %15, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32* %16, i32* %17)
%19 = icmp eq i32 %18, 2
br i1 %19, label %20, label %26
20: ; preds = %14
%21 = load i32*, i32** %4
%22 = load i32, i32* %21
%23 = load i32*, i32** %5
%24 = load i32, i32* %23
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 %22, i32 %24)
store i32 1, i32* %3
br label %60
26: ; preds = %14
%27 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%28 = load i32*, i32** %4
%29 = load i32*, i32** %5
%30 = call i32 @sscanf(i8* %27, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32* %28, i32* %29)
%31 = icmp eq i32 %30, 2
br i1 %31, label %32, label %33
32: ; preds = %26
store i32 2, i32* %3
br label %60
33: ; preds = %26
%34 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%35 = call i64 @strstr(i8* %34, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%36 = icmp ne i64 %35, 0
br i1 %36, label %37, label %38
37: ; preds = %33
store i32 3, i32* %3
br label %60
38: ; preds = %33
%39 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%40 = call i64 @strstr(i8* %39, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%41 = icmp ne i64 %40, 0
br i1 %41, label %42, label %43
42: ; preds = %38
store i32 4, i32* %3
br label %60
43: ; preds = %38
%44 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%45 = call i64 @strstr(i8* %44, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%46 = icmp ne i64 %45, 0
br i1 %46, label %47, label %48
47: ; preds = %43
store i32 5, i32* %3
br label %60
48: ; preds = %43
%49 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%50 = call i64 @strstr(i8* %49, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%51 = icmp ne i64 %50, 0
br i1 %51, label %52, label %53
52: ; preds = %48
store i32 6, i32* %3
br label %60
53: ; preds = %48
br label %54
54: ; preds = %53
br label %55
55: ; preds = %54
br label %56
56: ; preds = %55
br label %57
57: ; preds = %56
br label %58
58: ; preds = %57
br label %59
59: ; preds = %58
store i32 7, i32* %3
br label %60
60: ; preds = %59, %52, %47, %42, %37, %32, %20, %13
%61 = load i32, i32* %3
ret i32 %61
}

LLVM IR (-O2):
@.str = [20 x i8] c"\0Aenter your move ? \00"
@.str.1 = [5 x i8] c"%20s\00"
@.str.2 = [5 x i8] c"part\00"
@.str.3 = [6 x i8] c"%d-%d\00"
@.str.4 = [15 x i8] c"MOVE: %d - %d\0A\00"
@.str.5 = [6 x i8] c"%dx%d\00"
@.str.6 = [5 x i8] c"quit\00"
@.str.7 = [5 x i8] c"load\00"
@.str.8 = [5 x i8] c"save\00"
@.str.9 = [5 x i8] c"time\00"
define i32 @getmove(i32* %0, i32* %1) {
%3 = alloca [20 x i8]
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%7 = call i64 @strstr(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %32
9: ; preds = %2
%10 = call i32 @sscanf(i8* %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32* %0, i32* %1)
%11 = icmp eq i32 %10, 2
br i1 %11, label %12, label %16
12: ; preds = %9
%13 = load i32, i32* %0
%14 = load i32, i32* %1
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 %13, i32 %14)
br label %32
16: ; preds = %9
%17 = call i32 @sscanf(i8* %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32* %0, i32* %1)
%18 = icmp eq i32 %17, 2
br i1 %18, label %32, label %19
19: ; preds = %16
%20 = call i64 @strstr(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %32
22: ; preds = %19
%23 = call i64 @strstr(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %32
25: ; preds = %22
%26 = call i64 @strstr(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %32
28: ; preds = %25
%29 = call i64 @strstr(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%30 = icmp eq i64 %29, 0
%31 = select i1 %30, i32 7, i32 6
br label %32
32: ; preds = %28, %25, %22, %19, %16, %2, %12
%33 = phi i32 [ 1, %12 ], [ 0, %2 ], [ 2, %16 ], [ 3, %19 ], [ 4, %22 ], [ 5, %25 ], [ %31, %28 ]
ret i32 %33
}