#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*/ str_lower(char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ trim_extra_spaces(char *);
int check_for_learn_command(char *str) {
  char usrqry[10000];
  strcpy(usrqry, str);
  str_lower(usrqry);
  trim_extra_spaces(usrqry);
  if (usrqry[0] == '{' && usrqry[1] == 'l' && usrqry[2] == 'e' &&
      usrqry[3] == 'a' && usrqry[4] == 'r' && usrqry[5] == 'n' &&
      usrqry[6] == '}') {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<check_for_learn_command>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2720,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x2720(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x2720(%rbp),%rdi
call   1040 <str_lower@plt>
lea    -0x2720(%rbp),%rdi
call   1050 <trim_extra_spaces@plt>
movsbl -0x2720(%rbp),%eax
cmp    $0x7b,%eax
jne    11e3 <check_for_learn_command+0xb3>
movsbl -0x271f(%rbp),%eax
cmp    $0x6c,%eax
jne    11e3 <check_for_learn_command+0xb3>
movsbl -0x271e(%rbp),%eax
cmp    $0x65,%eax
jne    11e3 <check_for_learn_command+0xb3>
movsbl -0x271d(%rbp),%eax
cmp    $0x61,%eax
jne    11e3 <check_for_learn_command+0xb3>
movsbl -0x271c(%rbp),%eax
cmp    $0x72,%eax
jne    11e3 <check_for_learn_command+0xb3>
movsbl -0x271b(%rbp),%eax
cmp    $0x6e,%eax
jne    11e3 <check_for_learn_command+0xb3>
movsbl -0x271a(%rbp),%eax
cmp    $0x7d,%eax
jne    11e3 <check_for_learn_command+0xb3>
movl   $0x1,-0x4(%rbp)
jmp    11ea <check_for_learn_command+0xba>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x2720,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_for_learn_command>:
push   %rbx
sub    $0x2710,%rsp
mov    %rdi,%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1040 <str_lower@plt>
mov    %rbx,%rdi
call   1050 <trim_extra_spaces@plt>
movdqa (%rsp),%xmm0
movd   %xmm0,%eax
cmp    $0x61656c7b,%eax
sete   %al
cmpb   $0x72,0x4(%rsp)
sete   %cl
cmpb   $0x6e,0x5(%rsp)
sete   %dl
and    %cl,%dl
cmpb   $0x7d,0x6(%rsp)
sete   %cl
and    %dl,%cl
and    %al,%cl
movzbl %cl,%eax
add    $0x2710,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @check_for_learn_command(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [10000 x i8]
store i8* %0, i8** %3
%5 = getelementptr inbounds [10000 x i8], [10000 x i8]* %4, i64 0, i64 0
%6 = load i8*, i8** %3
%7 = call i32 @strcpy(i8* %5, i8* %6)
%8 = getelementptr inbounds [10000 x i8], [10000 x i8]* %4, i64 0, i64 0
%9 = call i32 @str_lower(i8* %8)
%10 = getelementptr inbounds [10000 x i8], [10000 x i8]* %4, i64 0, i64 0
%11 = call i32 @trim_extra_spaces(i8* %10)
%12 = getelementptr inbounds [10000 x i8], [10000 x i8]* %4, i64 0, i64 0
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 123
br i1 %15, label %16, label %47
16: ; preds = %1
%17 = getelementptr inbounds [10000 x i8], [10000 x i8]* %4, i64 0, i64 1
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 108
br i1 %20, label %21, label %47
21: ; preds = %16
%22 = getelementptr inbounds [10000 x i8], [10000 x i8]* %4, i64 0, i64 2
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 101
br i1 %25, label %26, label %47
26: ; preds = %21
%27 = getelementptr inbounds [10000 x i8], [10000 x i8]* %4, i64 0, i64 3
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 97
br i1 %30, label %31, label %47
31: ; preds = %26
%32 = getelementptr inbounds [10000 x i8], [10000 x i8]* %4, i64 0, i64 4
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 114
br i1 %35, label %36, label %47
36: ; preds = %31
%37 = getelementptr inbounds [10000 x i8], [10000 x i8]* %4, i64 0, i64 5
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = icmp eq i32 %39, 110
br i1 %40, label %41, label %47
41: ; preds = %36
%42 = getelementptr inbounds [10000 x i8], [10000 x i8]* %4, i64 0, i64 6
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = icmp eq i32 %44, 125
br i1 %45, label %46, label %47
46: ; preds = %41
store i32 1, i32* %2
br label %48
47: ; preds = %41, %36, %31, %26, %21, %16, %1
store i32 0, i32* %2
br label %48
48: ; preds = %47, %46
%49 = load i32, i32* %2
ret i32 %49
}

LLVM IR (-O2):
define i32 @check_for_learn_command(i8* %0) {
%2 = alloca [10000 x i8]
%3 = getelementptr inbounds [10000 x i8], [10000 x i8]* %2, i64 0, i64 0
%4 = call i32 @strcpy(i8* %3, i8* %0)
%5 = call i32 @str_lower(i8* %3)
%6 = call i32 @trim_extra_spaces(i8* %3)
%7 = bitcast [10000 x i8]* %2 to <4 x i8>*
%8 = load <4 x i8>, <4 x i8>* %7
%9 = freeze <4 x i8> %8
%10 = bitcast <4 x i8> %9 to i32
%11 = icmp eq i32 %10, 1634036859
%12 = getelementptr inbounds [10000 x i8], [10000 x i8]* %2, i64 0, i64 4
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 114
%15 = select i1 %11, i1 %14, i1 false
%16 = getelementptr inbounds [10000 x i8], [10000 x i8]* %2, i64 0, i64 5
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 110
%19 = select i1 %15, i1 %18, i1 false
%20 = getelementptr inbounds [10000 x i8], [10000 x i8]* %2, i64 0, i64 6
%21 = load i8, i8* %20
%22 = icmp eq i8 %21, 125
%23 = select i1 %19, i1 %22, i1 false
%24 = zext i1 %23 to i32
ret i32 %24
}