#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*/ isalpha(char const);
scalar_t__ isdigit(char const);
char const *_is_command(char const *peek) {
  unsigned i;
  if (isdigit(*peek)) {
    i = 2;
    peek++;
    while (i-- > 0)
      if (!isdigit(*peek++))
        return NULL;
    return peek;
  }
  if (!isalpha(*peek++))
    return NULL;
  while (*peek) {
    if (!isalpha(*peek))
      break;
    peek++;
  }
  return peek;
}


x86 assembly (clang, -O0):
<_is_command>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     11a9 <_is_command+0x89>
movl   $0x2,-0x14(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x14(%rbp)
cmp    $0x0,%eax
jbe    119c <_is_command+0x7c>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
jne    1197 <_is_command+0x77>
movq   $0x0,-0x8(%rbp)
jmp    121b <_is_command+0xfb>
jmp    1155 <_is_command+0x35>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    121b <_is_command+0xfb>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%edi
call   1040 <isalpha@plt>
cmp    $0x0,%eax
jne    11d6 <_is_command+0xb6>
movq   $0x0,-0x8(%rbp)
jmp    121b <_is_command+0xfb>
jmp    11db <_is_command+0xbb>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1213 <_is_command+0xf3>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isalpha@plt>
cmp    $0x0,%eax
jne    1202 <_is_command+0xe2>
jmp    1213 <_is_command+0xf3>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    11db <_is_command+0xbb>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_is_command>:
push   %rbx
mov    %rdi,%rbx
movsbl (%rdi),%edi
call   1030 <isdigit@plt>
test   %rax,%rax
je     1155 <_is_command+0x35>
movsbl 0x1(%rbx),%edi
call   1030 <isdigit@plt>
test   %rax,%rax
je     118c <_is_command+0x6c>
movsbl 0x2(%rbx),%edi
call   1030 <isdigit@plt>
add    $0x3,%rbx
test   %rax,%rax
cmove  %rax,%rbx
jmp    118e <_is_command+0x6e>
movsbl (%rbx),%edi
call   1040 <isalpha@plt>
test   %eax,%eax
je     118c <_is_command+0x6c>
add    $0x1,%rbx
mov    %rbx,%rcx
nopl   0x0(%rax,%rax,1)
mov    %rcx,%rbx
movzbl (%rcx),%eax
test   %al,%al
je     118e <_is_command+0x6e>
movsbl %al,%edi
call   1040 <isalpha@plt>
lea    0x1(%rbx),%rcx
test   %eax,%eax
jne    1170 <_is_command+0x50>
jmp    118e <_is_command+0x6e>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @_is_command(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = load i8, i8* %5
%7 = call i64 @isdigit(i8 signext %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %26
9: ; preds = %1
store i32 2, i32* %4
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i32 1
store i8* %11, i8** %3
br label %12
12: ; preds = %23, %9
%13 = load i32, i32* %4
%14 = add i32 %13, -1
store i32 %14, i32* %4
%15 = icmp ugt i32 %13, 0
br i1 %15, label %16, label %24
16: ; preds = %12
%17 = load i8*, i8** %3
%18 = getelementptr inbounds i8, i8* %17, i32 1
store i8* %18, i8** %3
%19 = load i8, i8* %17
%20 = call i64 @isdigit(i8 signext %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %23, label %22
22: ; preds = %16
store i8* null, i8** %2
br label %49
23: ; preds = %16
br label %12
24: ; preds = %12
%25 = load i8*, i8** %3
store i8* %25, i8** %2
br label %49
26: ; preds = %1
%27 = load i8*, i8** %3
%28 = getelementptr inbounds i8, i8* %27, i32 1
store i8* %28, i8** %3
%29 = load i8, i8* %27
%30 = call i32 @isalpha(i8 signext %29)
%31 = icmp ne i32 %30, 0
br i1 %31, label %33, label %32
32: ; preds = %26
store i8* null, i8** %2
br label %49
33: ; preds = %26
br label %34
34: ; preds = %44, %33
%35 = load i8*, i8** %3
%36 = load i8, i8* %35
%37 = icmp ne i8 %36, 0
br i1 %37, label %38, label %47
38: ; preds = %34
%39 = load i8*, i8** %3
%40 = load i8, i8* %39
%41 = call i32 @isalpha(i8 signext %40)
%42 = icmp ne i32 %41, 0
br i1 %42, label %44, label %43
43: ; preds = %38
br label %47
44: ; preds = %38
%45 = load i8*, i8** %3
%46 = getelementptr inbounds i8, i8* %45, i32 1
store i8* %46, i8** %3
br label %34
47: ; preds = %43, %34
%48 = load i8*, i8** %3
store i8* %48, i8** %2
br label %49
49: ; preds = %47, %32, %24, %22
%50 = load i8*, i8** %2
ret i8* %50
}

LLVM IR (-O2):
define i8* @_is_command(i8* %0) {
%2 = load i8, i8* %0
%3 = tail call i64 @isdigit(i8 signext %2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %17, label %5
5: ; preds = %1
%6 = getelementptr inbounds i8, i8* %0, i64 1
%7 = load i8, i8* %6
%8 = tail call i64 @isdigit(i8 signext %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %29, label %10
10: ; preds = %5
%11 = getelementptr inbounds i8, i8* %0, i64 2
%12 = load i8, i8* %11
%13 = tail call i64 @isdigit(i8 signext %12)
%14 = icmp eq i64 %13, 0
%15 = getelementptr inbounds i8, i8* %0, i64 3
%16 = select i1 %14, i8* null, i8* %15
br label %29
17: ; preds = %1
%18 = load i8, i8* %0
%19 = tail call i32 @isalpha(i8 signext %18)
%20 = icmp eq i32 %19, 0
br i1 %20, label %29, label %21
21: ; preds = %17, %26
%22 = phi i8* [ %23, %26 ], [ %0, %17 ]
%23 = getelementptr inbounds i8, i8* %22, i64 1
%24 = load i8, i8* %23
%25 = icmp eq i8 %24, 0
br i1 %25, label %29, label %26
26: ; preds = %21
%27 = tail call i32 @isalpha(i8 signext %24)
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %21
29: ; preds = %21, %26, %10, %5, %17
%30 = phi i8* [ null, %17 ], [ null, %5 ], [ %16, %10 ], [ %23, %26 ], [ %23, %21 ]
ret i8* %30
}