#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*/ sprintf(char *, char *);
int /*<<< orphan*/ sscanf(char *, char *, char *, char *, char *);
scalar_t__ strcmp(char *, char *);
int enginecommand(char str[256], char reply[256]) {
  char command[256], param1[256], param2[256];
  sscanf(str, "%s %s %s", command, param1, param2);
  if (strcmp(command, "name") == 0) {
    sprintf(reply, "Simple Checkers 1.14");
    return 1;
  }
  if (strcmp(command, "about") == 0) {
    sprintf(reply, "Simple Checkers 1.14\n\n2002 by Martin Fierz");
    return 1;
  }
  if (strcmp(command, "help") == 0) {
    sprintf(reply, "simplechhelp.htm");
    return 1;
  }
  if (strcmp(command, "set") == 0) {
    if (strcmp(param1, "hashsize") == 0) {
      sprintf(reply, "?");
      return 0;
    }
    if (strcmp(param1, "book") == 0) {
      sprintf(reply, "?");
      return 0;
    }
  }
  if (strcmp(command, "get") == 0) {
    if (strcmp(param1, "hashsize") == 0) {
      sprintf(reply, "?");
      return 0;
    }
    if (strcmp(param1, "book") == 0) {
      sprintf(reply, "?");
      return 0;
    }
    if (strcmp(param1, "protocolversion") == 0) {
      sprintf(reply, "2");
      return 1;
    }
    if (strcmp(param1, "gametype") == 0) {
      sprintf(reply, "21");
      return 1;
    }
  }
  sprintf(reply, "?");
  return 0;
}


x86 assembly (clang, -O0):
<enginecommand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x320,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x120(%rbp),%rdx
lea    -0x220(%rbp),%rcx
lea    -0x320(%rbp),%r8
lea    0xe9d(%rip),%rsi
call   1040 <sscanf@plt>
lea    -0x120(%rbp),%rdi
lea    0xe93(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11a1 <enginecommand+0x71>
mov    -0x18(%rbp),%rdi
lea    0xe7e(%rip),%rsi
call   1050 <sprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    13c4 <enginecommand+0x294>
lea    -0x120(%rbp),%rdi
lea    0xe74(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11da <enginecommand+0xaa>
mov    -0x18(%rbp),%rdi
lea    0xe60(%rip),%rsi
call   1050 <sprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    13c4 <enginecommand+0x294>
lea    -0x120(%rbp),%rdi
lea    0xe6c(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1213 <enginecommand+0xe3>
mov    -0x18(%rbp),%rdi
lea    0xe57(%rip),%rsi
call   1050 <sprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    13c4 <enginecommand+0x294>
lea    -0x120(%rbp),%rdi
lea    0xe49(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    12a7 <enginecommand+0x177>
lea    -0x220(%rbp),%rdi
lea    0xe30(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1269 <enginecommand+0x139>
mov    -0x18(%rbp),%rdi
lea    0xe1f(%rip),%rsi
call   1050 <sprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    13c4 <enginecommand+0x294>
lea    -0x220(%rbp),%rdi
lea    0xe02(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    12a2 <enginecommand+0x172>
mov    -0x18(%rbp),%rdi
lea    0xde6(%rip),%rsi
call   1050 <sprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    13c4 <enginecommand+0x294>
jmp    12a7 <enginecommand+0x177>
lea    -0x120(%rbp),%rdi
lea    0xdc9(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    13ad <enginecommand+0x27d>
lea    -0x220(%rbp),%rdi
lea    0xd9c(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    12fd <enginecommand+0x1cd>
mov    -0x18(%rbp),%rdi
lea    0xd8b(%rip),%rsi
call   1050 <sprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    13c4 <enginecommand+0x294>
lea    -0x220(%rbp),%rdi
lea    0xd6e(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1336 <enginecommand+0x206>
mov    -0x18(%rbp),%rdi
lea    0xd52(%rip),%rsi
call   1050 <sprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    13c4 <enginecommand+0x294>
lea    -0x220(%rbp),%rdi
lea    0xd3e(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    136f <enginecommand+0x23f>
mov    -0x18(%rbp),%rdi
lea    0xd34(%rip),%rsi
call   1050 <sprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    13c4 <enginecommand+0x294>
lea    -0x220(%rbp),%rdi
lea    0xd17(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    13a8 <enginecommand+0x278>
mov    -0x18(%rbp),%rdi
lea    0xd06(%rip),%rsi
call   1050 <sprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    13c4 <enginecommand+0x294>
jmp    13ad <enginecommand+0x27d>
mov    -0x18(%rbp),%rdi
lea    0xcbf(%rip),%rsi
call   1050 <sprintf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x320,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<enginecommand>:
push   %r14
push   %rbx
sub    $0x308,%rsp
mov    %rsi,%r14
lea    0xecc(%rip),%rsi
lea    0x100(%rsp),%rbx
mov    %rsp,%rcx
lea    0x200(%rsp),%r8
mov    %rbx,%rdx
call   1040 <sscanf@plt>
lea    0xeb3(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1250 <enginecommand+0x130>
lea    0xeb5(%rip),%rsi
lea    0x100(%rsp),%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1270 <enginecommand+0x150>
lea    0xec9(%rip),%rsi
lea    0x100(%rsp),%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     129a <enginecommand+0x17a>
lea    0xec2(%rip),%rsi
lea    0x100(%rsp),%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     12b1 <enginecommand+0x191>
lea    0xeb7(%rip),%rsi
lea    0x100(%rsp),%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
jne    12dd <enginecommand+0x1bd>
lea    0xe8c(%rip),%rsi
mov    %rsp,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     12dd <enginecommand+0x1bd>
lea    0xe7d(%rip),%rsi
mov    %rsp,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     12dd <enginecommand+0x1bd>
lea    0xe6e(%rip),%rsi
mov    %rsp,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     12f0 <enginecommand+0x1d0>
lea    0xe66(%rip),%rsi
mov    %rsp,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
jne    12dd <enginecommand+0x1bd>
movb   $0x0,0x2(%r14)
movw   $0x3132,(%r14)
mov    $0x1,%eax
jmp    12e5 <enginecommand+0x1c5>
movups 0xdb7(%rip),%xmm0
movups %xmm0,(%r14)
movabs $0x34312e31207372,%rax
mov    %rax,0xd(%r14)
mov    $0x1,%eax
jmp    12e5 <enginecommand+0x1c5>
movups 0xdcd(%rip),%xmm0
movups %xmm0,0x1b(%r14)
movups 0xdb6(%rip),%xmm0
movups %xmm0,0x10(%r14)
movups 0xd9a(%rip),%xmm0
movups %xmm0,(%r14)
mov    $0x1,%eax
jmp    12e5 <enginecommand+0x1c5>
movups 0xdb8(%rip),%xmm0
movups %xmm0,(%r14)
movb   $0x0,0x10(%r14)
mov    $0x1,%eax
jmp    12e5 <enginecommand+0x1c5>
lea    0xdb6(%rip),%rsi
mov    %rsp,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     12dd <enginecommand+0x1bd>
lea    0xdab(%rip),%rsi
mov    %rsp,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
jne    11be <enginecommand+0x9e>
movw   $0x3f,(%r14)
xor    %eax,%eax
add    $0x308,%rsp
pop    %rbx
pop    %r14
ret
movw   $0x32,(%r14)
mov    $0x1,%eax
jmp    12e5 <enginecommand+0x1c5>

LLVM IR (-O0):
@.str = [9 x i8] c"%s %s %s\00"
@.str.1 = [5 x i8] c"name\00"
@.str.2 = [21 x i8] c"Simple Checkers 1.14\00"
@.str.3 = [6 x i8] c"about\00"
@.str.4 = [43 x i8] c"Simple Checkers 1.14\0A\0A2002 by Martin Fierz\00"
@.str.5 = [5 x i8] c"help\00"
@.str.6 = [17 x i8] c"simplechhelp.htm\00"
@.str.7 = [4 x i8] c"set\00"
@.str.8 = [9 x i8] c"hashsize\00"
@.str.9 = [2 x i8] c"?\00"
@.str.10 = [5 x i8] c"book\00"
@.str.11 = [4 x i8] c"get\00"
@.str.12 = [16 x i8] c"protocolversion\00"
@.str.13 = [2 x i8] c"2\00"
@.str.14 = [9 x i8] c"gametype\00"
@.str.15 = [3 x i8] c"21\00"
define i32 @enginecommand(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca [256 x i8]
%7 = alloca [256 x i8]
%8 = alloca [256 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
%9 = load i8*, i8** %4
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%11 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%13 = call i32 @sscanf(i8* %9, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %10, i8* %11, i8* %12)
%14 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%15 = call i64 @strcmp(i8* %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %2
%18 = load i8*, i8** %5
%19 = call i32 @sprintf(i8* %18, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %3
br label %89
20: ; preds = %2
%21 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%22 = call i64 @strcmp(i8* %21, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %20
%25 = load i8*, i8** %5
%26 = call i32 @sprintf(i8* %25, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %3
br label %89
27: ; preds = %20
%28 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%29 = call i64 @strcmp(i8* %28, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %34
31: ; preds = %27
%32 = load i8*, i8** %5
%33 = call i32 @sprintf(i8* %32, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0))
store i32 1, i32* %3
br label %89
34: ; preds = %27
%35 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%36 = call i64 @strcmp(i8* %35, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %53
38: ; preds = %34
%39 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%40 = call i64 @strcmp(i8* %39, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
%41 = icmp eq i64 %40, 0
br i1 %41, label %42, label %45
42: ; preds = %38
%43 = load i8*, i8** %5
%44 = call i32 @sprintf(i8* %43, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
store i32 0, i32* %3
br label %89
45: ; preds = %38
%46 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%47 = call i64 @strcmp(i8* %46, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
%48 = icmp eq i64 %47, 0
br i1 %48, label %49, label %52
49: ; preds = %45
%50 = load i8*, i8** %5
%51 = call i32 @sprintf(i8* %50, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
store i32 0, i32* %3
br label %89
52: ; preds = %45
br label %53
53: ; preds = %52, %34
%54 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%55 = call i64 @strcmp(i8* %54, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0))
%56 = icmp eq i64 %55, 0
br i1 %56, label %57, label %86
57: ; preds = %53
%58 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%59 = call i64 @strcmp(i8* %58, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
%60 = icmp eq i64 %59, 0
br i1 %60, label %61, label %64
61: ; preds = %57
%62 = load i8*, i8** %5
%63 = call i32 @sprintf(i8* %62, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
store i32 0, i32* %3
br label %89
64: ; preds = %57
%65 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%66 = call i64 @strcmp(i8* %65, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
%67 = icmp eq i64 %66, 0
br i1 %67, label %68, label %71
68: ; preds = %64
%69 = load i8*, i8** %5
%70 = call i32 @sprintf(i8* %69, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
store i32 0, i32* %3
br label %89
71: ; preds = %64
%72 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%73 = call i64 @strcmp(i8* %72, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0))
%74 = icmp eq i64 %73, 0
br i1 %74, label %75, label %78
75: ; preds = %71
%76 = load i8*, i8** %5
%77 = call i32 @sprintf(i8* %76, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0))
store i32 1, i32* %3
br label %89
78: ; preds = %71
%79 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%80 = call i64 @strcmp(i8* %79, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.14, i64 0, i64 0))
%81 = icmp eq i64 %80, 0
br i1 %81, label %82, label %85
82: ; preds = %78
%83 = load i8*, i8** %5
%84 = call i32 @sprintf(i8* %83, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.15, i64 0, i64 0))
store i32 1, i32* %3
br label %89
85: ; preds = %78
br label %86
86: ; preds = %85, %53
%87 = load i8*, i8** %5
%88 = call i32 @sprintf(i8* %87, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
store i32 0, i32* %3
br label %89
89: ; preds = %86, %82, %75, %68, %61, %49, %42, %31, %24, %17
%90 = load i32, i32* %3
ret i32 %90
}

LLVM IR (-O2):
@.str = [9 x i8] c"%s %s %s\00"
@.str.1 = [5 x i8] c"name\00"
@.str.2 = [21 x i8] c"Simple Checkers 1.14\00"
@.str.3 = [6 x i8] c"about\00"
@.str.4 = [43 x i8] c"Simple Checkers 1.14\0A\0A2002 by Martin Fierz\00"
@.str.5 = [5 x i8] c"help\00"
@.str.6 = [17 x i8] c"simplechhelp.htm\00"
@.str.7 = [4 x i8] c"set\00"
@.str.8 = [9 x i8] c"hashsize\00"
@.str.10 = [5 x i8] c"book\00"
@.str.11 = [4 x i8] c"get\00"
@.str.12 = [16 x i8] c"protocolversion\00"
@.str.14 = [9 x i8] c"gametype\00"
@.str.15 = [3 x i8] c"21\00"
define i32 @enginecommand(i8* nocapture %0, i8* nocapture writeonly %1) {
%3 = alloca [256 x i8]
%4 = alloca [256 x i8]
%5 = alloca [256 x i8]
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%9 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %6, i8* %7, i8* %8)
%10 = call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %2
br label %58
13: ; preds = %2
%14 = call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %13
br label %58
17: ; preds = %13
%18 = call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %17
br label %58
21: ; preds = %17
%22 = call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %34
24: ; preds = %21
%25 = call i64 @strcmp(i8* %7, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %24
%28 = bitcast i8* %1 to i16*
store i16 63, i16* %28
br label %58
29: ; preds = %24
%30 = call i64 @strcmp(i8* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %29
%33 = bitcast i8* %1 to i16*
store i16 63, i16* %33
br label %58
34: ; preds = %29, %21
%35 = call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0))
%36 = icmp eq i64 %35, 0
br i1 %36, label %37, label %56
37: ; preds = %34
%38 = call i64 @strcmp(i8* %7, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
%39 = icmp eq i64 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %37
%41 = bitcast i8* %1 to i16*
store i16 63, i16* %41
br label %58
42: ; preds = %37
%43 = call i64 @strcmp(i8* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
%44 = icmp eq i64 %43, 0
br i1 %44, label %45, label %47
45: ; preds = %42
%46 = bitcast i8* %1 to i16*
store i16 63, i16* %46
br label %58
47: ; preds = %42
%48 = call i64 @strcmp(i8* %7, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0))
%49 = icmp eq i64 %48, 0
br i1 %49, label %50, label %52
50: ; preds = %47
%51 = bitcast i8* %1 to i16*
store i16 50, i16* %51
br label %58
52: ; preds = %47
%53 = call i64 @strcmp(i8* %7, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.14, i64 0, i64 0))
%54 = icmp eq i64 %53, 0
br i1 %54, label %55, label %56
55: ; preds = %52
br label %58
56: ; preds = %52, %34
%57 = bitcast i8* %1 to i16*
store i16 63, i16* %57
br label %58
58: ; preds = %56, %55, %50, %45, %40, %32, %27, %20, %16, %12
%59 = phi i32 [ 1, %12 ], [ 1, %16 ], [ 1, %20 ], [ 0, %27 ], [ 0, %32 ], [ 0, %40 ], [ 0, %45 ], [ 1, %50 ], [ 1, %55 ], [ 0, %56 ]
ret i32 %59
}