#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*/ assert(char const *);
scalar_t__ gms_strncasecmp(char const *, char *, int);
int strcspn(char const *, char *);
int strlen(char *);
int strspn(char const *, char *);
int gms_command_undo_special(const char *string) {
  int posn, end;
  assert(string);
  posn = strspn(string, "\t ");
  end = posn + strcspn(string + posn, "\t ");
  if (end - posn == strlen("undo") &&
      gms_strncasecmp(string + posn, "undo", end - posn) == 0) {
    posn = end + strspn(string + end, "\t ");
    if (string[posn] == '\0')
      return (!0);
  }
  return 0;
}


x86 assembly (clang, -O0):
<gms_command_undo_special>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <assert@plt>
mov    -0x10(%rbp),%rdi
lea    0xe90(%rip),%rsi
call   1050 <strspn@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rax
add    %rax,%rdi
lea    0xe70(%rip),%rsi
call   1060 <strcspn@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
sub    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
lea    0xe54(%rip),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
cmp    %ecx,%eax
jne    1235 <gms_command_undo_special+0xe5>
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rax
add    %rax,%rdi
mov    -0x18(%rbp),%edx
sub    -0x14(%rbp),%edx
lea    0xe2a(%rip),%rsi
call   1030 <gms_strncasecmp@plt>
cmp    $0x0,%rax
jne    1235 <gms_command_undo_special+0xe5>
mov    -0x18(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
movslq -0x18(%rbp),%rax
add    %rax,%rdi
lea    0xe00(%rip),%rsi
call   1050 <strspn@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
jne    1230 <gms_command_undo_special+0xe0>
movl   $0x1,-0x4(%rbp)
jmp    123c <gms_command_undo_special+0xec>
jmp    1235 <gms_command_undo_special+0xe5>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gms_command_undo_special>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r15
call   1070 <assert@plt>
lea    0xe9a(%rip),%rbp
mov    %r15,%rdi
mov    %rbp,%rsi
call   1050 <strspn@plt>
mov    %eax,%r14d
movslq %eax,%rbx
add    %r15,%rbx
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1060 <strcspn@plt>
mov    %eax,%ebp
lea    0xe75(%rip),%rdi
call   1040 <strlen@plt>
cmp    %eax,%ebp
jne    11cf <gms_command_undo_special+0x7f>
lea    0xe65(%rip),%rsi
mov    %rbx,%rdi
mov    %ebp,%edx
call   1030 <gms_strncasecmp@plt>
test   %rax,%rax
jne    11cf <gms_command_undo_special+0x7f>
add    %r14d,%ebp
movslq %ebp,%rbx
lea    (%r15,%rbx,1),%rdi
lea    0xe42(%rip),%rsi
call   1050 <strspn@plt>
add    %eax,%ebx
movslq %ebx,%rax
cmpb   $0x0,(%r15,%rax,1)
je     11dc <gms_command_undo_special+0x8c>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%eax
jmp    11d1 <gms_command_undo_special+0x81>

LLVM IR (-O0):
@.str = [3 x i8] c"\09 \00"
@.str.1 = [5 x i8] c"undo\00"
define i32 @gms_command_undo_special(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @assert(i8* %6)
%8 = load i8*, i8** %3
%9 = call i32 @strspn(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 %9, i32* %4
%10 = load i32, i32* %4
%11 = load i8*, i8** %3
%12 = load i32, i32* %4
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %11, i64 %13
%15 = call i32 @strcspn(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%16 = add nsw i32 %10, %15
store i32 %16, i32* %5
%17 = load i32, i32* %5
%18 = load i32, i32* %4
%19 = sub nsw i32 %17, %18
%20 = call i32 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%21 = icmp eq i32 %19, %20
br i1 %21, label %22, label %49
22: ; preds = %1
%23 = load i8*, i8** %3
%24 = load i32, i32* %4
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %23, i64 %25
%27 = load i32, i32* %5
%28 = load i32, i32* %4
%29 = sub nsw i32 %27, %28
%30 = call i64 @gms_strncasecmp(i8* %26, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %29)
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %49
32: ; preds = %22
%33 = load i32, i32* %5
%34 = load i8*, i8** %3
%35 = load i32, i32* %5
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8, i8* %34, i64 %36
%38 = call i32 @strspn(i8* %37, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%39 = add nsw i32 %33, %38
store i32 %39, i32* %4
%40 = load i8*, i8** %3
%41 = load i32, i32* %4
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8, i8* %40, i64 %42
%44 = load i8, i8* %43
%45 = sext i8 %44 to i32
%46 = icmp eq i32 %45, 0
br i1 %46, label %47, label %48
47: ; preds = %32
store i32 1, i32* %2
br label %50
48: ; preds = %32
br label %49
49: ; preds = %48, %22, %1
store i32 0, i32* %2
br label %50
50: ; preds = %49, %47
%51 = load i32, i32* %2
ret i32 %51
}

LLVM IR (-O2):
@.str = [3 x i8] c"\09 \00"
@.str.1 = [5 x i8] c"undo\00"
define i32 @gms_command_undo_special(i8* %0) {
%2 = tail call i32 @assert(i8* %0)
%3 = tail call i32 @strspn(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = tail call i32 @strcspn(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%7 = add nsw i32 %6, %3
%8 = tail call i32 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i32 %6, %8
br i1 %9, label %10, label %22
10: ; preds = %1
%11 = tail call i64 @gms_strncasecmp(i8* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %22
13: ; preds = %10
%14 = sext i32 %7 to i64
%15 = getelementptr inbounds i8, i8* %0, i64 %14
%16 = tail call i32 @strspn(i8* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%17 = add nsw i32 %16, %7
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %0, i64 %18
%20 = load i8, i8* %19
%21 = icmp eq i8 %20, 0
br i1 %21, label %23, label %22
22: ; preds = %13, %10, %1
br label %23
23: ; preds = %13, %22
%24 = phi i32 [ 0, %22 ], [ 1, %13 ]
ret i32 %24
}