#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 atoi(char const *);
int /*<<< orphan*/ engine_force_mode();
int /*<<< orphan*/ engine_force_move(char *);
int /*<<< orphan*/ engine_go();
int /*<<< orphan*/ engine_new_game();
int /*<<< orphan*/ engine_set_result(char *);
int /*<<< orphan*/ engine_undo();
char *fgets(char *, int, int /*<<< orphan*/);
scalar_t__ get_random_mode();
int /*<<< orphan*/ log_entry(char *, char *);
char *parse_time(char const *, int *, int *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ set_base_time(int, int);
int /*<<< orphan*/ set_engine_time(char *);
int /*<<< orphan*/ set_ics_host(char *);
int /*<<< orphan*/ set_ics_mode(int);
int /*<<< orphan*/ set_inc_time(int, int);
int /*<<< orphan*/ set_memory_limit(int);
int /*<<< orphan*/ set_mps(int);
int /*<<< orphan*/ set_opponent_name(char *);
int /*<<< orphan*/ set_opponent_time(char *);
int /*<<< orphan*/ set_pondering(int);
int /*<<< orphan*/ set_random_mode(scalar_t__);
int /*<<< orphan*/ set_show_thinking(int);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ strcmp(char *, char *);
int strlen(char *);
int /*<<< orphan*/ strncmp(char *, char *, int);
int xboardInput() {
  char input[512] = "";
  size_t inputLength = 0;
  char *stream = fgets(input, 512, stdin);
  if (!stream) {
    return 1;
  }
  inputLength = strlen(input) - 1;
  while (input[inputLength] == '\n') {
    input[inputLength--] = 0;
  }
  log_entry("xboard_input", input);
  if (!strncmp(input, "protover", 8)) {
    printf("feature done=0 ping=1 setboard=1 playother=1 san=0 usermove=1 "
           "time=1 sigint=0 sigterm=0 draw=1 reuse=1 analyze=0 "
           "myname=\"Patrician\" variants=\"normal\" colors=0 ics=1 name=1 "
           "pause=1 nps=0 debug=1 memory=1 smp=0 done=1\n");
  } else if (!strcmp(input, "new")) {
    engine_new_game();
    set_random_mode(0);
  } else if (!strncmp(input, "memory", 6)) {
    int megaBytes = atoi(input + 7);
    set_memory_limit(megaBytes);
  } else if (!strcmp(input, "random")) {
    set_random_mode(1 - get_random_mode());
  } else if (!strncmp(input, "ics", 3)) {
    set_ics_host(input + 4);
    set_ics_mode(!strcmp(input + 4, "-"));
  } else if (!strncmp(input, "level", 5)) {
    const char *timeString = input + 6;
    int mps = 0, baseMins = 0, baseSecs = 0, incMins = 0, incSecs = 0;
    mps = atoi(timeString);
    while (*(timeString++) != ' ')
      ;
    timeString = parse_time(timeString, &baseMins, &baseSecs);
    timeString = parse_time(timeString, &incMins, &incSecs);
    set_mps(mps);
    set_base_time(baseMins, baseSecs);
    set_inc_time(incMins, incSecs);
  } else if (!strncmp(input, "accepted", 8) || !strncmp(input, "rejected", 8)) {
  } else if (!strcmp(input, "post")) {
    set_show_thinking(1);
  } else if (!strcmp(input, "nopost")) {
    set_show_thinking(0);
  } else if (!strcmp(input, "hard")) {
    set_pondering(1);
  } else if (!strcmp(input, "easy")) {
    set_pondering(0);
  } else if (!strncmp(input, "ping", 4)) {
    printf("pong%s\n", input + 4);
  } else if (!strncmp(input, "name", 4)) {
    set_opponent_name(input + 5);
  } else if (!strcmp(input, "computer")) {
  } else if (!strncmp(input, "time", 4)) {
    set_engine_time(input + 5);
  } else if (!strncmp(input, "otim", 4)) {
    set_opponent_time(input + 5);
  } else if (!strncmp(input, "usermove", 8)) {
    engine_force_move(input + 9);
  } else if (!strncmp(input, "result", 6)) {
    engine_set_result(input + 7);
  } else if (!strcmp(input, "force")) {
    engine_force_mode();
  } else if (!strcmp(input, "go")) {
    engine_go();
  } else if (!strcmp(input, "undo")) {
    engine_undo();
  } else if (!strcmp(input, "quit")) {
    return 1;
  } else {
    log_entry("xboard_unrecognised", input);
    printf("Error (unknown command): %s\n", input);
  }
  return 0;
}


x86 assembly (clang, -O0):
<xboardInput>:
push   %rbp
mov    %rsp,%rbp
sub    $0x250,%rsp
lea    -0x210(%rbp),%rdi
xor    %esi,%esi
mov    $0x200,%edx
call   10d0 <memset@plt>
movq   $0x0,-0x218(%rbp)
lea    -0x210(%rbp),%rdi
mov    0x2cf1(%rip),%rax
mov    (%rax),%edx
mov    $0x200,%esi
call   10f0 <fgets@plt>
mov    %rax,-0x220(%rbp)
cmpq   $0x0,-0x220(%rbp)
jne    1324 <xboardInput+0x64>
movl   $0x1,-0x4(%rbp)
jmp    196d <xboardInput+0x6ad>
lea    -0x210(%rbp),%rdi
call   1080 <strlen@plt>
sub    $0x1,%eax
cltq
mov    %rax,-0x218(%rbp)
mov    -0x218(%rbp),%rax
movsbl -0x210(%rbp,%rax,1),%eax
ff
cmp    $0xa,%eax
jne    1376 <xboardInput+0xb6>
mov    -0x218(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x218(%rbp)
movb   $0x0,-0x210(%rbp,%rax,1)
jmp    133c <xboardInput+0x7c>
lea    -0x210(%rbp),%rsi
lea    0xc7c(%rip),%rdi
call   1150 <log_entry@plt>
lea    -0x210(%rbp),%rdi
lea    0xc76(%rip),%rsi
mov    $0x8,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    13bd <xboardInput+0xfd>
lea    0xc65(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
jmp    1966 <xboardInput+0x6a6>
lea    -0x210(%rbp),%rdi
lea    0xd24(%rip),%rsi
call   1100 <strcmp@plt>
cmp    $0x0,%eax
jne    13ee <xboardInput+0x12e>
mov    $0x0,%al
call   11e0 <engine_new_game@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10e0 <set_random_mode@plt>
jmp    1961 <xboardInput+0x6a1>
lea    -0x210(%rbp),%rdi
lea    0xcf7(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1435 <xboardInput+0x175>
lea    -0x210(%rbp),%rdi
add    $0x7,%rdi
call   1170 <atoi@plt>
mov    %eax,-0x224(%rbp)
mov    -0x224(%rbp),%edi
call   10b0 <set_memory_limit@plt>
jmp    195c <xboardInput+0x69c>
lea    -0x210(%rbp),%rdi
lea    0xcb7(%rip),%rsi
call   1100 <strcmp@plt>
cmp    $0x0,%eax
jne    146a <xboardInput+0x1aa>
mov    $0x0,%al
call   1180 <get_random_mode@plt>
mov    $0x1,%edi
sub    %rax,%rdi
call   10e0 <set_random_mode@plt>
jmp    1957 <xboardInput+0x697>
lea    -0x210(%rbp),%rdi
lea    0xc89(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    14c9 <xboardInput+0x209>
lea    -0x210(%rbp),%rdi
add    $0x4,%rdi
call   11c0 <set_ics_host@plt>
lea    -0x210(%rbp),%rdi
add    $0x4,%rdi
lea    0xc58(%rip),%rsi
call   1100 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1120 <set_ics_mode@plt>
jmp    1952 <xboardInput+0x692>
lea    -0x210(%rbp),%rdi
lea    0xc30(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    15da <xboardInput+0x31a>
lea    -0x210(%rbp),%rax
add    $0x6,%rax
mov    %rax,-0x230(%rbp)
movl   $0x0,-0x234(%rbp)
movl   $0x0,-0x238(%rbp)
movl   $0x0,-0x23c(%rbp)
movl   $0x0,-0x240(%rbp)
movl   $0x0,-0x244(%rbp)
mov    -0x230(%rbp),%rdi
call   1170 <atoi@plt>
mov    %eax,-0x234(%rbp)
mov    -0x230(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x230(%rbp)
movsbl (%rax),%eax
cmp    $0x20,%eax
je     1566 <xboardInput+0x2a6>
jmp    1540 <xboardInput+0x280>
mov    -0x230(%rbp),%rdi
lea    -0x238(%rbp),%rsi
lea    -0x23c(%rbp),%rdx
call   1090 <parse_time@plt>
mov    %rax,-0x230(%rbp)
mov    -0x230(%rbp),%rdi
lea    -0x240(%rbp),%rsi
lea    -0x244(%rbp),%rdx
call   1090 <parse_time@plt>
mov    %rax,-0x230(%rbp)
mov    -0x234(%rbp),%edi
call   1060 <set_mps@plt>
mov    -0x238(%rbp),%edi
mov    -0x23c(%rbp),%esi
call   1070 <set_base_time@plt>
mov    -0x240(%rbp),%edi
mov    -0x244(%rbp),%esi
call   1130 <set_inc_time@plt>
jmp    194d <xboardInput+0x68d>
lea    -0x210(%rbp),%rdi
lea    0xb25(%rip),%rsi
mov    $0x8,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
je     161c <xboardInput+0x35c>
lea    -0x210(%rbp),%rdi
lea    0xb0d(%rip),%rsi
mov    $0x8,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1621 <xboardInput+0x361>
jmp    1948 <xboardInput+0x688>
lea    -0x210(%rbp),%rdi
lea    0xaf2(%rip),%rsi
call   1100 <strcmp@plt>
cmp    $0x0,%eax
jne    164c <xboardInput+0x38c>
mov    $0x1,%edi
call   1110 <set_show_thinking@plt>
jmp    1943 <xboardInput+0x683>
lea    -0x210(%rbp),%rdi
lea    0xac5(%rip),%rsi
call   1100 <strcmp@plt>
cmp    $0x0,%eax
jne    1674 <xboardInput+0x3b4>
xor    %edi,%edi
call   1110 <set_show_thinking@plt>
jmp    193e <xboardInput+0x67e>
lea    -0x210(%rbp),%rdi
lea    0xaa4(%rip),%rsi
call   1100 <strcmp@plt>
cmp    $0x0,%eax
jne    169f <xboardInput+0x3df>
mov    $0x1,%edi
call   1140 <set_pondering@plt>
jmp    1939 <xboardInput+0x679>
lea    -0x210(%rbp),%rdi
lea    0xa7e(%rip),%rsi
call   1100 <strcmp@plt>
cmp    $0x0,%eax
jne    16c7 <xboardInput+0x407>
xor    %edi,%edi
call   1140 <set_pondering@plt>
jmp    1934 <xboardInput+0x674>
lea    -0x210(%rbp),%rdi
lea    0xa5b(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1706 <xboardInput+0x446>
lea    -0x210(%rbp),%rsi
add    $0x4,%rsi
lea    0xa3b(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
jmp    192f <xboardInput+0x66f>
lea    -0x210(%rbp),%rdi
lea    0xa29(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    173c <xboardInput+0x47c>
lea    -0x210(%rbp),%rdi
add    $0x5,%rdi
call   1190 <set_opponent_name@plt>
jmp    192a <xboardInput+0x66a>
lea    -0x210(%rbp),%rdi
lea    0x9f8(%rip),%rsi
call   1100 <strcmp@plt>
cmp    $0x0,%eax
jne    175d <xboardInput+0x49d>
jmp    1925 <xboardInput+0x665>
lea    -0x210(%rbp),%rdi
lea    0x9e0(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1793 <xboardInput+0x4d3>
lea    -0x210(%rbp),%rdi
add    $0x5,%rdi
call   11d0 <set_engine_time@plt>
jmp    1920 <xboardInput+0x660>
lea    -0x210(%rbp),%rdi
lea    0x9af(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    17c9 <xboardInput+0x509>
lea    -0x210(%rbp),%rdi
add    $0x5,%rdi
call   11a0 <set_opponent_time@plt>
jmp    191b <xboardInput+0x65b>
lea    -0x210(%rbp),%rdi
lea    0x97e(%rip),%rsi
mov    $0x8,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    17ff <xboardInput+0x53f>
lea    -0x210(%rbp),%rdi
add    $0x9,%rdi
call   10c0 <engine_force_move@plt>
jmp    1916 <xboardInput+0x656>
lea    -0x210(%rbp),%rdi
lea    0x951(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1835 <xboardInput+0x575>
lea    -0x210(%rbp),%rdi
add    $0x7,%rdi
call   1040 <engine_set_result@plt>
jmp    1911 <xboardInput+0x651>
lea    -0x210(%rbp),%rdi
lea    0x922(%rip),%rsi
call   1100 <strcmp@plt>
cmp    $0x0,%eax
jne    185d <xboardInput+0x59d>
mov    $0x0,%al
call   11b0 <engine_force_mode@plt>
jmp    190c <xboardInput+0x64c>
lea    -0x210(%rbp),%rdi
lea    0x900(%rip),%rsi
call   1100 <strcmp@plt>
cmp    $0x0,%eax
jne    1885 <xboardInput+0x5c5>
mov    $0x0,%al
call   1050 <engine_go@plt>
jmp    1907 <xboardInput+0x647>
lea    -0x210(%rbp),%rdi
lea    0x8db(%rip),%rsi
call   1100 <strcmp@plt>
cmp    $0x0,%eax
jne    18ad <xboardInput+0x5ed>
mov    $0x0,%al
call   1160 <engine_undo@plt>
jmp    1902 <xboardInput+0x642>
lea    -0x210(%rbp),%rdi
lea    0x8b8(%rip),%rsi
call   1100 <strcmp@plt>
cmp    $0x0,%eax
jne    18d5 <xboardInput+0x615>
movl   $0x1,-0x4(%rbp)
jmp    196d <xboardInput+0x6ad>
lea    -0x210(%rbp),%rsi
lea    0x895(%rip),%rdi
call   1150 <log_entry@plt>
lea    -0x210(%rbp),%rsi
lea    0x896(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
jmp    1902 <xboardInput+0x642>
jmp    1907 <xboardInput+0x647>
jmp    190c <xboardInput+0x64c>
jmp    1911 <xboardInput+0x651>
jmp    1916 <xboardInput+0x656>
jmp    191b <xboardInput+0x65b>
jmp    1920 <xboardInput+0x660>
jmp    1925 <xboardInput+0x665>
jmp    192a <xboardInput+0x66a>
jmp    192f <xboardInput+0x66f>
jmp    1934 <xboardInput+0x674>
jmp    1939 <xboardInput+0x679>
jmp    193e <xboardInput+0x67e>
jmp    1943 <xboardInput+0x683>
jmp    1948 <xboardInput+0x688>
jmp    194d <xboardInput+0x68d>
jmp    1952 <xboardInput+0x692>
jmp    1957 <xboardInput+0x697>
jmp    195c <xboardInput+0x69c>
jmp    1961 <xboardInput+0x6a1>
jmp    1966 <xboardInput+0x6a6>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x250,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xboardInput>:
push   %rbp
push   %rbx
sub    $0x218,%rsp
lea    0x10(%rsp),%rbx
mov    $0x200,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   10e0 <memset@plt>
mov    0x2d04(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    $0x200,%esi
call   1100 <fgets@plt>
mov    $0x1,%ebx
test   %rax,%rax
je     16bd <xboardInput+0x3fd>
lea    0x10(%rsp),%rdi
call   1090 <strlen@plt>
cltq
cmpb   $0xa,0xf(%rsp,%rax,1)
jne    132d <xboardInput+0x6d>
add    $0xffffffffffffffff,%rax
add    %rsp,%rax
add    $0x10,%rax
nop
movb   $0x0,(%rax)
cmpb   $0xa,-0x1(%rax)
lea    -0x1(%rax),%rax
je     1320 <xboardInput+0x60>
lea    0xccc(%rip),%rdi
lea    0x10(%rsp),%rbp
mov    %rbp,%rsi
call   1150 <log_entry@plt>
lea    0xcc5(%rip),%rsi
mov    %rbp,%rdi
mov    $0x8,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     1378 <xboardInput+0xb8>
cmpl   $0x77656e,0x10(%rsp)
jne    138b <xboardInput+0xcb>
xor    %ebx,%ebx
xor    %eax,%eax
call   11e0 <engine_new_game@plt>
xor    %edi,%edi
call   10f0 <set_random_mode@plt>
jmp    16bd <xboardInput+0x3fd>
lea    0xd4b(%rip),%rdi
call   1050 <puts@plt>
xor    %ebx,%ebx
jmp    16bd <xboardInput+0x3fd>
lea    0xc84(%rip),%rsi
lea    0x10(%rsp),%rdi
mov    $0x6,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     15e9 <xboardInput+0x329>
mov    $0x646e6172,%eax
xor    0x10(%rsp),%eax
mov    $0x6d6f64,%ecx
xor    0x13(%rsp),%ecx
or     %eax,%ecx
je     1601 <xboardInput+0x341>
lea    0xc5a(%rip),%rsi
lea    0x10(%rsp),%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     161c <xboardInput+0x35c>
lea    0xc40(%rip),%rsi
lea    0x10(%rsp),%rdi
mov    $0x5,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     163e <xboardInput+0x37e>
lea    0xc28(%rip),%rsi
lea    0x10(%rsp),%rdi
mov    $0x8,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     16bb <xboardInput+0x3fb>
lea    0xc13(%rip),%rsi
lea    0x10(%rsp),%rdi
mov    $0x8,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     16bb <xboardInput+0x3fb>
mov    $0x74736f70,%eax
xor    0x10(%rsp),%eax
movzbl 0x14(%rsp),%ecx
or     %eax,%ecx
je     16c9 <xboardInput+0x409>
mov    $0x6f706f6e,%eax
xor    0x10(%rsp),%eax
mov    $0x74736f,%ecx
xor    0x13(%rsp),%ecx
or     %eax,%ecx
je     16d7 <xboardInput+0x417>
mov    $0x64726168,%eax
xor    0x10(%rsp),%eax
movzbl 0x14(%rsp),%ecx
or     %eax,%ecx
je     16e2 <xboardInput+0x422>
mov    $0x79736165,%eax
xor    0x10(%rsp),%eax
movzbl 0x14(%rsp),%ecx
or     %eax,%ecx
je     16f0 <xboardInput+0x430>
lea    0xbb3(%rip),%rsi
lea    0x10(%rsp),%rdi
mov    $0x4,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     16fb <xboardInput+0x43b>
lea    0xba2(%rip),%rsi
lea    0x10(%rsp),%rdi
mov    $0x4,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     1712 <xboardInput+0x452>
movabs $0x72657475706d6f63,%rax
74 65 72
xor    0x10(%rsp),%rax
movzbl 0x18(%rsp),%ecx
or     %rax,%rcx
je     16bb <xboardInput+0x3fb>
lea    0xb75(%rip),%rsi
lea    0x10(%rsp),%rdi
mov    $0x4,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     171e <xboardInput+0x45e>
lea    0xb5c(%rip),%rsi
lea    0x10(%rsp),%rdi
mov    $0x4,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     172c <xboardInput+0x46c>
lea    0xb43(%rip),%rsi
lea    0x10(%rsp),%rdi
mov    $0x8,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     173a <xboardInput+0x47a>
lea    0xb2e(%rip),%rsi
lea    0x10(%rsp),%rdi
mov    $0x6,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     174b <xboardInput+0x48b>
mov    $0x63726f66,%eax
xor    0x10(%rsp),%eax
movzwl 0x14(%rsp),%ecx
xor    $0x65,%ecx
or     %eax,%ecx
je     175c <xboardInput+0x49c>
mov    $0x6f67,%eax
xor    0x10(%rsp),%eax
movzbl 0x12(%rsp),%ecx
or     %ax,%cx
je     176a <xboardInput+0x4aa>
mov    $0x6f646e75,%eax
xor    0x10(%rsp),%eax
movzbl 0x14(%rsp),%ecx
or     %eax,%ecx
je     1778 <xboardInput+0x4b8>
mov    $0x74697571,%eax
xor    0x10(%rsp),%eax
movzbl 0x14(%rsp),%ecx
or     %eax,%ecx
je     16bd <xboardInput+0x3fd>
lea    0xace(%rip),%rdi
lea    0x10(%rsp),%rbp
mov    %rbp,%rsi
call   1150 <log_entry@plt>
lea    0xace(%rip),%rdi
xor    %ebx,%ebx
mov    %rbp,%rsi
jmp    1709 <xboardInput+0x449>
lea    0x17(%rsp),%rdi
call   1170 <atoi@plt>
mov    %eax,%edi
call   10c0 <set_memory_limit@plt>
xor    %ebx,%ebx
jmp    16bd <xboardInput+0x3fd>
xor    %ebx,%ebx
xor    %eax,%eax
call   1180 <get_random_mode@plt>
mov    $0x1,%edi
sub    %rax,%rdi
call   10f0 <set_random_mode@plt>
jmp    16bd <xboardInput+0x3fd>
lea    0x14(%rsp),%rdi
call   11c0 <set_ics_host@plt>
xor    %edi,%edi
cmpw   $0x2d,0x14(%rsp)
sete   %dil
call   1120 <set_ics_mode@plt>
xor    %ebx,%ebx
jmp    16bd <xboardInput+0x3fd>
lea    0x16(%rsp),%rbx
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
movl   $0x0,0x4(%rsp)
movl   $0x0,(%rsp)
mov    %rbx,%rdi
call   1170 <atoi@plt>
mov    %eax,%ebp
nopl   0x0(%rax)
cmpb   $0x20,(%rbx)
lea    0x1(%rbx),%rbx
jne    1670 <xboardInput+0x3b0>
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
mov    %rbx,%rdi
call   10a0 <parse_time@plt>
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
mov    %rax,%rdi
call   10a0 <parse_time@plt>
mov    %ebp,%edi
call   1070 <set_mps@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
call   1080 <set_base_time@plt>
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
call   1130 <set_inc_time@plt>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x218,%rsp
pop    %rbx
pop    %rbp
ret
mov    $0x1,%edi
call   1110 <set_show_thinking@plt>
xor    %ebx,%ebx
jmp    16bd <xboardInput+0x3fd>
xor    %ebx,%ebx
xor    %edi,%edi
call   1110 <set_show_thinking@plt>
jmp    16bd <xboardInput+0x3fd>
mov    $0x1,%edi
call   1140 <set_pondering@plt>
xor    %ebx,%ebx
jmp    16bd <xboardInput+0x3fd>
xor    %ebx,%ebx
xor    %edi,%edi
call   1140 <set_pondering@plt>
jmp    16bd <xboardInput+0x3fd>
lea    0x14(%rsp),%rsi
lea    0x94f(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   10b0 <printf@plt>
jmp    16bd <xboardInput+0x3fd>
lea    0x15(%rsp),%rdi
call   1190 <set_opponent_name@plt>
jmp    16bb <xboardInput+0x3fb>
lea    0x15(%rsp),%rdi
call   11d0 <set_engine_time@plt>
xor    %ebx,%ebx
jmp    16bd <xboardInput+0x3fd>
lea    0x15(%rsp),%rdi
call   11a0 <set_opponent_time@plt>
xor    %ebx,%ebx
jmp    16bd <xboardInput+0x3fd>
lea    0x19(%rsp),%rdi
call   10d0 <engine_force_move@plt>
xor    %ebx,%ebx
jmp    16bd <xboardInput+0x3fd>
lea    0x17(%rsp),%rdi
call   1040 <engine_set_result@plt>
xor    %ebx,%ebx
jmp    16bd <xboardInput+0x3fd>
xor    %ebx,%ebx
xor    %eax,%eax
call   11b0 <engine_force_mode@plt>
jmp    16bd <xboardInput+0x3fd>
xor    %ebx,%ebx
xor    %eax,%eax
call   1060 <engine_go@plt>
jmp    16bd <xboardInput+0x3fd>
xor    %ebx,%ebx
xor    %eax,%eax
call   1160 <engine_undo@plt>
jmp    16bd <xboardInput+0x3fd>

LLVM IR (-O0):
@stdin = global i32 0
@.str = [13 x i8] c"xboard_input\00"
@.str.1 = [9 x i8] c"protover\00"
@.str.2 = [217 x i8] c"feature done=0 ping=1 setboard=1 playother=1 san=0 usermove=1 time=1 sigint=0 sigterm=0 draw=1 reuse=1 analyze=0 myname=\22Patrician\22 variants=\22normal\22 colors=0 ics=1 name=1 pause=1 nps=0 debug=1 memory=1 smp=0 done=1\0A\00"
@.str.3 = [4 x i8] c"new\00"
@.str.4 = [7 x i8] c"memory\00"
@.str.5 = [7 x i8] c"random\00"
@.str.6 = [4 x i8] c"ics\00"
@.str.7 = [2 x i8] c"-\00"
@.str.8 = [6 x i8] c"level\00"
@.str.9 = [9 x i8] c"accepted\00"
@.str.10 = [9 x i8] c"rejected\00"
@.str.11 = [5 x i8] c"post\00"
@.str.12 = [7 x i8] c"nopost\00"
@.str.13 = [5 x i8] c"hard\00"
@.str.14 = [5 x i8] c"easy\00"
@.str.15 = [5 x i8] c"ping\00"
@.str.16 = [8 x i8] c"pong%s\0A\00"
@.str.17 = [5 x i8] c"name\00"
@.str.18 = [9 x i8] c"computer\00"
@.str.19 = [5 x i8] c"time\00"
@.str.20 = [5 x i8] c"otim\00"
@.str.21 = [9 x i8] c"usermove\00"
@.str.22 = [7 x i8] c"result\00"
@.str.23 = [6 x i8] c"force\00"
@.str.24 = [3 x i8] c"go\00"
@.str.25 = [5 x i8] c"undo\00"
@.str.26 = [5 x i8] c"quit\00"
@.str.27 = [20 x i8] c"xboard_unrecognised\00"
@.str.28 = [29 x i8] c"Error (unknown command): %s\0A\00"
define i32 @xboardInput() {
%1 = alloca i32
%2 = alloca [512 x i8]
%3 = alloca i64
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = bitcast [512 x i8]* %2 to i8*
store i64 0, i64* %3
%13 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%14 = load i32, i32* @stdin
%15 = call i8* @fgets(i8* %13, i32 512, i32 %14)
store i8* %15, i8** %4
%16 = load i8*, i8** %4
%17 = icmp ne i8* %16, null
br i1 %17, label %19, label %18
18: ; preds = %0
store i32 1, i32* %1
br label %247
19: ; preds = %0
%20 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%21 = call i32 @strlen(i8* %20)
%22 = sub nsw i32 %21, 1
%23 = sext i32 %22 to i64
store i64 %23, i64* %3
br label %24
24: ; preds = %30, %19
%25 = load i64, i64* %3
%26 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 %25
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 10
br i1 %29, label %30, label %34
30: ; preds = %24
%31 = load i64, i64* %3
%32 = add i64 %31, -1
store i64 %32, i64* %3
%33 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 %31
store i8 0, i8* %33
br label %24
34: ; preds = %24
%35 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%36 = call i32 @log_entry(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %35)
%37 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%38 = call i32 @strncmp(i8* %37, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 8)
%39 = icmp ne i32 %38, 0
br i1 %39, label %42, label %40
40: ; preds = %34
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([217 x i8], [217 x i8]* @.str.2, i64 0, i64 0))
br label %246
42: ; preds = %34
%43 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%44 = call i32 @strcmp(i8* %43, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%45 = icmp ne i32 %44, 0
br i1 %45, label %49, label %46
46: ; preds = %42
%47 = call i32 (...) @engine_new_game()
%48 = call i32 @set_random_mode(i64 0)
br label %245
49: ; preds = %42
%50 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%51 = call i32 @strncmp(i8* %50, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 6)
%52 = icmp ne i32 %51, 0
br i1 %52, label %59, label %53
53: ; preds = %49
%54 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%55 = getelementptr inbounds i8, i8* %54, i64 7
%56 = call i32 @atoi(i8* %55)
store i32 %56, i32* %5
%57 = load i32, i32* %5
%58 = call i32 @set_memory_limit(i32 %57)
br label %244
59: ; preds = %49
%60 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%61 = call i32 @strcmp(i8* %60, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%62 = icmp ne i32 %61, 0
br i1 %62, label %67, label %63
63: ; preds = %59
%64 = call i64 (...) @get_random_mode()
%65 = sub nsw i64 1, %64
%66 = call i32 @set_random_mode(i64 %65)
br label %243
67: ; preds = %59
%68 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%69 = call i32 @strncmp(i8* %68, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 3)
%70 = icmp ne i32 %69, 0
br i1 %70, label %82, label %71
71: ; preds = %67
%72 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%73 = getelementptr inbounds i8, i8* %72, i64 4
%74 = call i32 @set_ics_host(i8* %73)
%75 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%76 = getelementptr inbounds i8, i8* %75, i64 4
%77 = call i32 @strcmp(i8* %76, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%78 = icmp ne i32 %77, 0
%79 = xor i1 %78, true
%80 = zext i1 %79 to i32
%81 = call i32 @set_ics_mode(i32 %80)
br label %242
82: ; preds = %67
%83 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%84 = call i32 @strncmp(i8* %83, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i32 5)
%85 = icmp ne i32 %84, 0
br i1 %85, label %111, label %86
86: ; preds = %82
%87 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%88 = getelementptr inbounds i8, i8* %87, i64 6
store i8* %88, i8** %6
store i32 0, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
store i32 0, i32* %11
%89 = load i8*, i8** %6
%90 = call i32 @atoi(i8* %89)
store i32 %90, i32* %7
br label %91
91: ; preds = %97, %86
%92 = load i8*, i8** %6
%93 = getelementptr inbounds i8, i8* %92, i32 1
store i8* %93, i8** %6
%94 = load i8, i8* %92
%95 = sext i8 %94 to i32
%96 = icmp ne i32 %95, 32
br i1 %96, label %97, label %98
97: ; preds = %91
br label %91
98: ; preds = %91
%99 = load i8*, i8** %6
%100 = call i8* @parse_time(i8* %99, i32* %8, i32* %9)
store i8* %100, i8** %6
%101 = load i8*, i8** %6
%102 = call i8* @parse_time(i8* %101, i32* %10, i32* %11)
store i8* %102, i8** %6
%103 = load i32, i32* %7
%104 = call i32 @set_mps(i32 %103)
%105 = load i32, i32* %8
%106 = load i32, i32* %9
%107 = call i32 @set_base_time(i32 %105, i32 %106)
%108 = load i32, i32* %10
%109 = load i32, i32* %11
%110 = call i32 @set_inc_time(i32 %108, i32 %109)
br label %241
111: ; preds = %82
%112 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%113 = call i32 @strncmp(i8* %112, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0), i32 8)
%114 = icmp ne i32 %113, 0
br i1 %114, label %115, label %119
115: ; preds = %111
%116 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%117 = call i32 @strncmp(i8* %116, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i32 8)
%118 = icmp ne i32 %117, 0
br i1 %118, label %120, label %119
119: ; preds = %115, %111
br label %240
120: ; preds = %115
%121 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%122 = call i32 @strcmp(i8* %121, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0))
%123 = icmp ne i32 %122, 0
br i1 %123, label %126, label %124
124: ; preds = %120
%125 = call i32 @set_show_thinking(i32 1)
br label %239
126: ; preds = %120
%127 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%128 = call i32 @strcmp(i8* %127, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0))
%129 = icmp ne i32 %128, 0
br i1 %129, label %132, label %130
130: ; preds = %126
%131 = call i32 @set_show_thinking(i32 0)
br label %238
132: ; preds = %126
%133 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%134 = call i32 @strcmp(i8* %133, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0))
%135 = icmp ne i32 %134, 0
br i1 %135, label %138, label %136
136: ; preds = %132
%137 = call i32 @set_pondering(i32 1)
br label %237
138: ; preds = %132
%139 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%140 = call i32 @strcmp(i8* %139, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0))
%141 = icmp ne i32 %140, 0
br i1 %141, label %144, label %142
142: ; preds = %138
%143 = call i32 @set_pondering(i32 0)
br label %236
144: ; preds = %138
%145 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%146 = call i32 @strncmp(i8* %145, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0), i32 4)
%147 = icmp ne i32 %146, 0
br i1 %147, label %152, label %148
148: ; preds = %144
%149 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%150 = getelementptr inbounds i8, i8* %149, i64 4
%151 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.16, i64 0, i64 0), i8* %150)
br label %235
152: ; preds = %144
%153 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%154 = call i32 @strncmp(i8* %153, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.17, i64 0, i64 0), i32 4)
%155 = icmp ne i32 %154, 0
br i1 %155, label %160, label %156
156: ; preds = %152
%157 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%158 = getelementptr inbounds i8, i8* %157, i64 5
%159 = call i32 @set_opponent_name(i8* %158)
br label %234
160: ; preds = %152
%161 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%162 = call i32 @strcmp(i8* %161, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.18, i64 0, i64 0))
%163 = icmp ne i32 %162, 0
br i1 %163, label %165, label %164
164: ; preds = %160
br label %233
165: ; preds = %160
%166 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%167 = call i32 @strncmp(i8* %166, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i64 0, i64 0), i32 4)
%168 = icmp ne i32 %167, 0
br i1 %168, label %173, label %169
169: ; preds = %165
%170 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%171 = getelementptr inbounds i8, i8* %170, i64 5
%172 = call i32 @set_engine_time(i8* %171)
br label %232
173: ; preds = %165
%174 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%175 = call i32 @strncmp(i8* %174, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.20, i64 0, i64 0), i32 4)
%176 = icmp ne i32 %175, 0
br i1 %176, label %181, label %177
177: ; preds = %173
%178 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%179 = getelementptr inbounds i8, i8* %178, i64 5
%180 = call i32 @set_opponent_time(i8* %179)
br label %231
181: ; preds = %173
%182 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%183 = call i32 @strncmp(i8* %182, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.21, i64 0, i64 0), i32 8)
%184 = icmp ne i32 %183, 0
br i1 %184, label %189, label %185
185: ; preds = %181
%186 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%187 = getelementptr inbounds i8, i8* %186, i64 9
%188 = call i32 @engine_force_move(i8* %187)
br label %230
189: ; preds = %181
%190 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%191 = call i32 @strncmp(i8* %190, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.22, i64 0, i64 0), i32 6)
%192 = icmp ne i32 %191, 0
br i1 %192, label %197, label %193
193: ; preds = %189
%194 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%195 = getelementptr inbounds i8, i8* %194, i64 7
%196 = call i32 @engine_set_result(i8* %195)
br label %229
197: ; preds = %189
%198 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%199 = call i32 @strcmp(i8* %198, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.23, i64 0, i64 0))
%200 = icmp ne i32 %199, 0
br i1 %200, label %203, label %201
201: ; preds = %197
%202 = call i32 (...) @engine_force_mode()
br label %228
203: ; preds = %197
%204 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%205 = call i32 @strcmp(i8* %204, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.24, i64 0, i64 0))
%206 = icmp ne i32 %205, 0
br i1 %206, label %209, label %207
207: ; preds = %203
%208 = call i32 (...) @engine_go()
br label %227
209: ; preds = %203
%210 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%211 = call i32 @strcmp(i8* %210, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.25, i64 0, i64 0))
%212 = icmp ne i32 %211, 0
br i1 %212, label %215, label %213
213: ; preds = %209
%214 = call i32 (...) @engine_undo()
br label %226
215: ; preds = %209
%216 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%217 = call i32 @strcmp(i8* %216, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.26, i64 0, i64 0))
%218 = icmp ne i32 %217, 0
br i1 %218, label %220, label %219
219: ; preds = %215
store i32 1, i32* %1
br label %247
220: ; preds = %215
%221 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%222 = call i32 @log_entry(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.27, i64 0, i64 0), i8* %221)
%223 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%224 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.28, i64 0, i64 0), i8* %223)
br label %225
225: ; preds = %220
br label %226
226: ; preds = %225, %213
br label %227
227: ; preds = %226, %207
br label %228
228: ; preds = %227, %201
br label %229
229: ; preds = %228, %193
br label %230
230: ; preds = %229, %185
br label %231
231: ; preds = %230, %177
br label %232
232: ; preds = %231, %169
br label %233
233: ; preds = %232, %164
br label %234
234: ; preds = %233, %156
br label %235
235: ; preds = %234, %148
br label %236
236: ; preds = %235, %142
br label %237
237: ; preds = %236, %136
br label %238
238: ; preds = %237, %130
br label %239
239: ; preds = %238, %124
br label %240
240: ; preds = %239, %119
br label %241
241: ; preds = %240, %98
br label %242
242: ; preds = %241, %71
br label %243
243: ; preds = %242, %63
br label %244
244: ; preds = %243, %53
br label %245
245: ; preds = %244, %46
br label %246
246: ; preds = %245, %40
store i32 0, i32* %1
br label %247
247: ; preds = %246, %219, %18
%248 = load i32, i32* %1
ret i32 %248
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [13 x i8] c"xboard_input\00"
@.str.1 = [9 x i8] c"protover\00"
@.str.4 = [7 x i8] c"memory\00"
@.str.5 = [7 x i8] c"random\00"
@.str.6 = [4 x i8] c"ics\00"
@.str.8 = [6 x i8] c"level\00"
@.str.9 = [9 x i8] c"accepted\00"
@.str.10 = [9 x i8] c"rejected\00"
@.str.11 = [5 x i8] c"post\00"
@.str.12 = [7 x i8] c"nopost\00"
@.str.13 = [5 x i8] c"hard\00"
@.str.14 = [5 x i8] c"easy\00"
@.str.15 = [5 x i8] c"ping\00"
@.str.16 = [8 x i8] c"pong%s\0A\00"
@.str.17 = [5 x i8] c"name\00"
@.str.18 = [9 x i8] c"computer\00"
@.str.19 = [5 x i8] c"time\00"
@.str.20 = [5 x i8] c"otim\00"
@.str.21 = [9 x i8] c"usermove\00"
@.str.22 = [7 x i8] c"result\00"
@.str.23 = [6 x i8] c"force\00"
@.str.24 = [3 x i8] c"go\00"
@.str.25 = [5 x i8] c"undo\00"
@.str.26 = [5 x i8] c"quit\00"
@.str.27 = [20 x i8] c"xboard_unrecognised\00"
@.str.28 = [29 x i8] c"Error (unknown command): %s\0A\00"
@str = [216 x i8] c"feature done=0 ping=1 setboard=1 playother=1 san=0 usermove=1 time=1 sigint=0 sigterm=0 draw=1 reuse=1 analyze=0 myname=\22Patrician\22 variants=\22normal\22 colors=0 ics=1 name=1 pause=1 nps=0 debug=1 memory=1 smp=0 done=1\00"
define i32 @xboardInput() {
%1 = alloca [512 x i8]
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 0
%7 = load i32, i32* @stdin
%8 = call i8* @fgets(i8* %6, i32 512, i32 %7)
%9 = icmp eq i8* %8, null
br i1 %9, label %173, label %10
10: ; preds = %0
%11 = call i32 @strlen(i8* %6)
%12 = add nsw i32 %11, -1
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 %13
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 10
br i1 %16, label %17, label %24
17: ; preds = %10, %17
%18 = phi i8* [ %21, %17 ], [ %14, %10 ]
%19 = phi i64 [ %20, %17 ], [ %13, %10 ]
%20 = add i64 %19, -1
store i8 0, i8* %18
%21 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 %20
%22 = load i8, i8* %21
%23 = icmp eq i8 %22, 10
br i1 %23, label %17, label %24
24: ; preds = %17, %10
%25 = call i32 @log_entry(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %6)
%26 = call i32 @strncmp(i8* %6, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 8)
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %24
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([216 x i8], [216 x i8]* @str, i64 0, i64 0))
br label %173
30: ; preds = %24
%31 = bitcast [512 x i8]* %1 to i32*
%32 = load i32, i32* %31
%33 = icmp eq i32 %32, 7824750
br i1 %33, label %34, label %37
34: ; preds = %30
%35 = call i32 (...) @engine_new_game()
%36 = call i32 @set_random_mode(i64 0)
br label %173
37: ; preds = %30
%38 = call i32 @strncmp(i8* %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 6)
%39 = icmp eq i32 %38, 0
br i1 %39, label %40, label %44
40: ; preds = %37
%41 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 7
%42 = call i32 @atoi(i8* %41)
%43 = call i32 @set_memory_limit(i32 %42)
br label %173
44: ; preds = %37
%45 = call i32 @bcmp(i8* dereferenceable(7) %6, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i64 7)
%46 = icmp eq i32 %45, 0
br i1 %46, label %47, label %51
47: ; preds = %44
%48 = call i64 (...) @get_random_mode()
%49 = sub nsw i64 1, %48
%50 = call i32 @set_random_mode(i64 %49)
br label %173
51: ; preds = %44
%52 = call i32 @strncmp(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 3)
%53 = icmp eq i32 %52, 0
br i1 %53, label %54, label %62
54: ; preds = %51
%55 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 4
%56 = call i32 @set_ics_host(i8* %55)
%57 = bitcast i8* %55 to i16*
%58 = load i16, i16* %57
%59 = icmp eq i16 %58, 45
%60 = zext i1 %59 to i32
%61 = call i32 @set_ics_mode(i32 %60)
br label %173
62: ; preds = %51
%63 = call i32 @strncmp(i8* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i32 5)
%64 = icmp eq i32 %63, 0
br i1 %64, label %65, label %87
65: ; preds = %62
%66 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 6
%67 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%68 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%69 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%70 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%71 = call i32 @atoi(i8* %66)
br label %72
72: ; preds = %72, %65
%73 = phi i8* [ %66, %65 ], [ %74, %72 ]
%74 = getelementptr inbounds i8, i8* %73, i64 1
%75 = load i8, i8* %73
%76 = icmp eq i8 %75, 32
br i1 %76, label %77, label %72
77: ; preds = %72
%78 = call i8* @parse_time(i8* %74, i32* %2, i32* %3)
%79 = call i8* @parse_time(i8* %78, i32* %4, i32* %5)
%80 = call i32 @set_mps(i32 %71)
%81 = load i32, i32* %2
%82 = load i32, i32* %3
%83 = call i32 @set_base_time(i32 %81, i32 %82)
%84 = load i32, i32* %4
%85 = load i32, i32* %5
%86 = call i32 @set_inc_time(i32 %84, i32 %85)
br label %173
87: ; preds = %62
%88 = call i32 @strncmp(i8* %6, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0), i32 8)
%89 = icmp eq i32 %88, 0
br i1 %89, label %173, label %90
90: ; preds = %87
%91 = call i32 @strncmp(i8* %6, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i32 8)
%92 = icmp eq i32 %91, 0
br i1 %92, label %173, label %93
93: ; preds = %90
%94 = call i32 @bcmp(i8* dereferenceable(5) %6, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), i64 5)
%95 = icmp eq i32 %94, 0
br i1 %95, label %96, label %98
96: ; preds = %93
%97 = call i32 @set_show_thinking(i32 1)
br label %173
98: ; preds = %93
%99 = call i32 @bcmp(i8* dereferenceable(7) %6, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0), i64 7)
%100 = icmp eq i32 %99, 0
br i1 %100, label %101, label %103
101: ; preds = %98
%102 = call i32 @set_show_thinking(i32 0)
br label %173
103: ; preds = %98
%104 = call i32 @bcmp(i8* dereferenceable(5) %6, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i64 5)
%105 = icmp eq i32 %104, 0
br i1 %105, label %106, label %108
106: ; preds = %103
%107 = call i32 @set_pondering(i32 1)
br label %173
108: ; preds = %103
%109 = call i32 @bcmp(i8* dereferenceable(5) %6, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0), i64 5)
%110 = icmp eq i32 %109, 0
br i1 %110, label %111, label %113
111: ; preds = %108
%112 = call i32 @set_pondering(i32 0)
br label %173
113: ; preds = %108
%114 = call i32 @strncmp(i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0), i32 4)
%115 = icmp eq i32 %114, 0
br i1 %115, label %116, label %119
116: ; preds = %113
%117 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 4
%118 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.16, i64 0, i64 0), i8* %117)
br label %173
119: ; preds = %113
%120 = call i32 @strncmp(i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.17, i64 0, i64 0), i32 4)
%121 = icmp eq i32 %120, 0
br i1 %121, label %122, label %125
122: ; preds = %119
%123 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 5
%124 = call i32 @set_opponent_name(i8* %123)
br label %173
125: ; preds = %119
%126 = call i32 @bcmp(i8* dereferenceable(9) %6, i8* dereferenceable(9) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.18, i64 0, i64 0), i64 9)
%127 = icmp eq i32 %126, 0
br i1 %127, label %173, label %128
128: ; preds = %125
%129 = call i32 @strncmp(i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i64 0, i64 0), i32 4)
%130 = icmp eq i32 %129, 0
br i1 %130, label %131, label %134
131: ; preds = %128
%132 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 5
%133 = call i32 @set_engine_time(i8* %132)
br label %173
134: ; preds = %128
%135 = call i32 @strncmp(i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.20, i64 0, i64 0), i32 4)
%136 = icmp eq i32 %135, 0
br i1 %136, label %137, label %140
137: ; preds = %134
%138 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 5
%139 = call i32 @set_opponent_time(i8* %138)
br label %173
140: ; preds = %134
%141 = call i32 @strncmp(i8* %6, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.21, i64 0, i64 0), i32 8)
%142 = icmp eq i32 %141, 0
br i1 %142, label %143, label %146
143: ; preds = %140
%144 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 9
%145 = call i32 @engine_force_move(i8* %144)
br label %173
146: ; preds = %140
%147 = call i32 @strncmp(i8* %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.22, i64 0, i64 0), i32 6)
%148 = icmp eq i32 %147, 0
br i1 %148, label %149, label %152
149: ; preds = %146
%150 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 7
%151 = call i32 @engine_set_result(i8* %150)
br label %173
152: ; preds = %146
%153 = call i32 @bcmp(i8* dereferenceable(6) %6, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.23, i64 0, i64 0), i64 6)
%154 = icmp eq i32 %153, 0
br i1 %154, label %155, label %157
155: ; preds = %152
%156 = call i32 (...) @engine_force_mode()
br label %173
157: ; preds = %152
%158 = call i32 @bcmp(i8* dereferenceable(3) %6, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.24, i64 0, i64 0), i64 3)
%159 = icmp eq i32 %158, 0
br i1 %159, label %160, label %162
160: ; preds = %157
%161 = call i32 (...) @engine_go()
br label %173
162: ; preds = %157
%163 = call i32 @bcmp(i8* dereferenceable(5) %6, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.25, i64 0, i64 0), i64 5)
%164 = icmp eq i32 %163, 0
br i1 %164, label %165, label %167
165: ; preds = %162
%166 = call i32 (...) @engine_undo()
br label %173
167: ; preds = %162
%168 = call i32 @bcmp(i8* dereferenceable(5) %6, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.26, i64 0, i64 0), i64 5)
%169 = icmp eq i32 %168, 0
br i1 %169, label %173, label %170
170: ; preds = %167
%171 = call i32 @log_entry(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.27, i64 0, i64 0), i8* %6)
%172 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.28, i64 0, i64 0), i8* %6)
br label %173
173: ; preds = %28, %40, %54, %90, %87, %101, %111, %122, %131, %143, %155, %165, %170, %160, %149, %137, %125, %116, %106, %96, %77, %47, %34, %167, %0
%174 = phi i32 [ 1, %0 ], [ 1, %167 ], [ 0, %34 ], [ 0, %47 ], [ 0, %77 ], [ 0, %96 ], [ 0, %106 ], [ 0, %116 ], [ 0, %125 ], [ 0, %137 ], [ 0, %149 ], [ 0, %160 ], [ 0, %170 ], [ 0, %165 ], [ 0, %155 ], [ 0, %143 ], [ 0, %131 ], [ 0, %122 ], [ 0, %111 ], [ 0, %101 ], [ 0, %87 ], [ 0, %90 ], [ 0, %54 ], [ 0, %40 ], [ 0, %28 ]
ret i32 %174
}