#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*/ free(char *);
char *player_line_query(int /*<<< orphan*/ *);
size_t strlen(char *);
int /*<<< orphan*/ *strstr(char *, char const *);
char tolower(char);
bool player_query(const char *accept) {
  char *answer;
  size_t answer_length;
  size_t character;
  answer = player_line_query(NULL);
  if (answer == NULL) {
    return false;
  }
  answer_length = strlen(answer);
  for (character = 0; character < answer_length; character++) {
    answer[character] = tolower(answer[character]);
  }
  if (strstr(answer, accept) != NULL) {
    return true;
  } else {
    return false;
  }
  free(answer);
}


x86 assembly (clang, -O0):
<player_query>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <player_line_query@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1170 <player_query+0x30>
movl   $0x0,-0x4(%rbp)
jmp    11ec <player_query+0xac>
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    11c2 <player_query+0x82>
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <tolower@plt>
mov    %al,%dl
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1185 <player_query+0x45>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <strstr@plt>
cmp    $0x0,%rax
je     11e5 <player_query+0xa5>
movl   $0x1,-0x4(%rbp)
jmp    11ec <player_query+0xac>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<player_query>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %r15d,%r15d
xor    %edi,%edi
call   1050 <player_line_query@plt>
test   %rax,%rax
je     119c <player_query+0x5c>
mov    %rax,%r12
mov    %rax,%rdi
call   1030 <strlen@plt>
test   %rax,%rax
je     1187 <player_query+0x47>
mov    %rax,%r15
xor    %ebx,%ebx
nop
movsbl (%r12,%rbx,1),%edi
call   1040 <tolower@plt>
mov    %al,(%r12,%rbx,1)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1170 <player_query+0x30>
mov    %r12,%rdi
mov    %r14,%rsi
call   1060 <strstr@plt>
xor    %r15d,%r15d
test   %rax,%rax
setne  %r15b
mov    %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @player_query(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
store i8* %0, i8** %3
%7 = call i8* @player_line_query(i32* null)
store i8* %7, i8** %4
%8 = load i8*, i8** %4
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %11
10: ; preds = %1
store i32 0, i32* %2
br label %37
11: ; preds = %1
%12 = load i8*, i8** %4
%13 = call i64 @strlen(i8* %12)
store i64 %13, i64* %5
store i64 0, i64* %6
br label %14
14: ; preds = %27, %11
%15 = load i64, i64* %6
%16 = load i64, i64* %5
%17 = icmp ult i64 %15, %16
br i1 %17, label %18, label %30
18: ; preds = %14
%19 = load i8*, i8** %4
%20 = load i64, i64* %6
%21 = getelementptr inbounds i8, i8* %19, i64 %20
%22 = load i8, i8* %21
%23 = call signext i8 @tolower(i8 signext %22)
%24 = load i8*, i8** %4
%25 = load i64, i64* %6
%26 = getelementptr inbounds i8, i8* %24, i64 %25
store i8 %23, i8* %26
br label %27
27: ; preds = %18
%28 = load i64, i64* %6
%29 = add i64 %28, 1
store i64 %29, i64* %6
br label %14
30: ; preds = %14
%31 = load i8*, i8** %4
%32 = load i8*, i8** %3
%33 = call i32* @strstr(i8* %31, i8* %32)
%34 = icmp ne i32* %33, null
br i1 %34, label %35, label %36
35: ; preds = %30
store i32 1, i32* %2
br label %37
36: ; preds = %30
store i32 0, i32* %2
br label %37
37: ; preds = %36, %35, %10
%38 = load i32, i32* %2
ret i32 %38
}

LLVM IR (-O2):
define i32 @player_query(i8* nocapture %0) {
%2 = tail call i8* @player_line_query(i32* null)
%3 = icmp eq i8* %2, null
br i1 %3, label %18, label %4
4: ; preds = %1
%5 = tail call i64 @strlen(i8* %2)
%6 = icmp eq i64 %5, 0
br i1 %6, label %14, label %7
7: ; preds = %4, %7
%8 = phi i64 [ %12, %7 ], [ 0, %4 ]
%9 = getelementptr inbounds i8, i8* %2, i64 %8
%10 = load i8, i8* %9
%11 = tail call signext i8 @tolower(i8 signext %10)
store i8 %11, i8* %9
%12 = add nuw i64 %8, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %14, label %7
14: ; preds = %7, %4
%15 = tail call i32* @strstr(i8* %2, i8* dereferenceable(1) %0)
%16 = icmp ne i32* %15, null
%17 = zext i1 %16 to i32
br label %18
18: ; preds = %14, %1
%19 = phi i32 [ 0, %1 ], [ %17, %14 ]
ret i32 %19
}