#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*/ exit(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int read(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ stdout;
scalar_t__ strcmp(char *, char *);
int guess(char *seed) {
  char buf[20];
  int i;
  for (i = 0; i < 20 - 1; i++) {
    if (read(0, buf + i, 1) != 1)
      exit(1);
    if (buf[i] == 'n' || buf[i] == 's' || buf[i] == '$' || buf[i] == 'S')
      break;
  }
  buf[i] = 0;
  if (strcmp(buf, seed) == 0)
    return 1;
  printf(buf);
  printf("\n");
  fflush(stdout);
  return 0;
}


x86 assembly (clang, -O0):
<guess>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x13,-0x34(%rbp)
jge    11f7 <guess+0xa7>
lea    -0x30(%rbp),%rsi
movslq -0x34(%rbp),%rax
add    %rax,%rsi
xor    %edi,%edi
mov    $0x1,%edx
call   1040 <read@plt>
cmp    $0x1,%eax
je     1197 <guess+0x47>
mov    $0x1,%edi
call   1070 <exit@plt>
movslq -0x34(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
cmp    $0x6e,%eax
je     11df <guess+0x8f>
movslq -0x34(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
cmp    $0x73,%eax
je     11df <guess+0x8f>
movslq -0x34(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
cmp    $0x24,%eax
je     11df <guess+0x8f>
movslq -0x34(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
cmp    $0x53,%eax
jne    11e4 <guess+0x94>
jmp    11f7 <guess+0xa7>
jmp    11e9 <guess+0x99>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1163 <guess+0x13>
movslq -0x34(%rbp),%rax
movb   $0x0,-0x30(%rbp,%rax,1)
lea    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1223 <guess+0xd3>
movl   $0x1,-0x4(%rbp)
jmp    124d <guess+0xfd>
lea    -0x30(%rbp),%rdi
call   1030 <printf@plt>
lea    0xdcd(%rip),%rdi
call   1030 <printf@plt>
mov    0x2da1(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<guess>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%r14
xor    %r15d,%r15d
movabs $0x108000001,%r12
nopl   0x0(%rax,%rax,1)
lea    (%rsp,%r15,1),%rbx
xor    %edi,%edi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1050 <read@plt>
cmp    $0x1,%eax
jne    120c <guess+0xac>
movzbl (%rbx),%eax
lea    -0x53(%rax),%ecx
cmp    $0x20,%cl
ja     11ac <guess+0x4c>
movzbl %cl,%ecx
bt     %rcx,%r12
jb     11c0 <guess+0x60>
cmp    $0x24,%al
je     11c0 <guess+0x60>
add    $0x1,%r15
cmp    $0x13,%r15
jne    1180 <guess+0x20>
mov    $0x13,%r15d
mov    %r15d,%eax
movb   $0x0,(%rsp,%rax,1)
mov    %rsp,%rdi
mov    %r14,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     11fb <guess+0x9b>
mov    %rsp,%rdi
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x2df0(%rip),%rax
mov    (%rax),%edi
call   1070 <fflush@plt>
xor    %eax,%eax
jmp    1200 <guess+0xa0>
mov    $0x1,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@stdout = global i32 0
define i32 @guess(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [20 x i8]
%5 = alloca i32
store i8* %0, i8** %3
store i32 0, i32* %5
br label %6
6: ; preds = %48, %1
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 19
br i1 %8, label %9, label %51
9: ; preds = %6
%10 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%11 = load i32, i32* %5
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %10, i64 %12
%14 = call i32 @read(i32 0, i8* %13, i32 1)
%15 = icmp ne i32 %14, 1
br i1 %15, label %16, label %18
16: ; preds = %9
%17 = call i32 @exit(i32 1)
unreachable
18: ; preds = %9
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 %20
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 110
br i1 %24, label %46, label %25
25: ; preds = %18
%26 = load i32, i32* %5
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 %27
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 115
br i1 %31, label %46, label %32
32: ; preds = %25
%33 = load i32, i32* %5
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 %34
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = icmp eq i32 %37, 36
br i1 %38, label %46, label %39
39: ; preds = %32
%40 = load i32, i32* %5
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 %41
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = icmp eq i32 %44, 83
br i1 %45, label %46, label %47
46: ; preds = %39, %32, %25, %18
br label %51
47: ; preds = %39
br label %48
48: ; preds = %47
%49 = load i32, i32* %5
%50 = add nsw i32 %49, 1
store i32 %50, i32* %5
br label %6
51: ; preds = %46, %6
%52 = load i32, i32* %5
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 %53
store i8 0, i8* %54
%55 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%56 = load i8*, i8** %3
%57 = call i64 @strcmp(i8* %55, i8* %56)
%58 = icmp eq i64 %57, 0
br i1 %58, label %59, label %60
59: ; preds = %51
store i32 1, i32* %2
br label %66
60: ; preds = %51
%61 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%62 = call i32 @printf(i8* %61)
%63 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%64 = load i32, i32* @stdout
%65 = call i32 @fflush(i32 %64)
store i32 0, i32* %2
br label %66
66: ; preds = %60, %59
%67 = load i32, i32* %2
ret i32 %67
}

LLVM IR (-O2):
@stdout = global i32 0
define i32 @guess(i8* %0) {
%2 = alloca [20 x i8]
%3 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
br label %4
4: ; preds = %1, %13
%5 = phi i64 [ 0, %1 ], [ %14, %13 ]
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %5
%7 = call i32 @read(i32 0, i8* %6, i32 1)
%8 = icmp eq i32 %7, 1
br i1 %8, label %11, label %9
9: ; preds = %4
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %4
%12 = load i8, i8* %6
switch i8 %12, label %13 [
i8 110, label %16
i8 115, label %16
i8 36, label %16
i8 83, label %16
]
13: ; preds = %11
%14 = add nuw nsw i64 %5, 1
%15 = icmp eq i64 %14, 19
br i1 %15, label %16, label %4
16: ; preds = %11, %11, %11, %11, %13
%17 = phi i64 [ %5, %11 ], [ %5, %11 ], [ %5, %11 ], [ %5, %11 ], [ 19, %13 ]
%18 = and i64 %17, 4294967295
%19 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %18
store i8 0, i8* %19
%20 = call i64 @strcmp(i8* %3, i8* %0)
%21 = icmp eq i64 %20, 0
br i1 %21, label %27, label %22
22: ; preds = %16
%23 = call i32 @printf(i8* %3)
%24 = call i32 @putchar(i32 10)
%25 = load i32, i32* @stdout
%26 = call i32 @fflush(i32 %25)
br label %27
27: ; preds = %16, %22
%28 = phi i32 [ 0, %22 ], [ 1, %16 ]
ret i32 %28
}