#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 */
scalar_t__ isalpha(char const);
scalar_t__ isdigit(char const);
char const *_is_shortname(char const *peek) {
  if (!(isdigit(*peek) || isalpha(*peek)))
    return NULL;
  peek++;
  while (isalpha(*peek) || isdigit(*peek) || *peek == '-')
    peek++;
  while (isalpha(*peek) || isdigit(*peek))
    peek++;
  return peek;
}


x86 assembly (clang, -O0):
<_is_shortname>:
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
jne    1165 <_is_shortname+0x45>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isalpha@plt>
cmp    $0x0,%rax
jne    1165 <_is_shortname+0x45>
movq   $0x0,-0x8(%rbp)
jmp    1240 <_is_shortname+0x120>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isalpha@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x11(%rbp)
jne    11bd <_is_shortname+0x9d>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x11(%rbp)
jne    11bd <_is_shortname+0x9d>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    11cd <_is_shortname+0xad>
jmp    11de <_is_shortname+0xbe>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1171 <_is_shortname+0x51>
jmp    11e3 <_is_shortname+0xc3>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isalpha@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x12(%rbp)
jne    1217 <_is_shortname+0xf7>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
test   $0x1,%al
jne    1227 <_is_shortname+0x107>
jmp    1238 <_is_shortname+0x118>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    11e3 <_is_shortname+0xc3>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_is_shortname>:
push   %rbx
mov    %rdi,%rbx
movsbl (%rdi),%edi
call   1030 <isdigit@plt>
test   %rax,%rax
jne    1140 <_is_shortname+0x20>
movsbl (%rbx),%edi
call   1040 <isalpha@plt>
test   %rax,%rax
je     1197 <_is_shortname+0x77>
xchg   %ax,%ax
add    $0x1,%rbx
movsbl (%rbx),%edi
call   1040 <isalpha@plt>
test   %rax,%rax
jne    1140 <_is_shortname+0x20>
movsbl (%rbx),%edi
call   1030 <isdigit@plt>
test   %rax,%rax
jne    1140 <_is_shortname+0x20>
movzbl (%rbx),%eax
cmp    $0x2d,%al
je     1140 <_is_shortname+0x20>
jmp    1178 <_is_shortname+0x58>
nopw   0x0(%rax,%rax,1)
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
movsbl %al,%edi
call   1040 <isalpha@plt>
test   %rax,%rax
jne    1170 <_is_shortname+0x50>
movsbl (%rbx),%edi
call   1030 <isdigit@plt>
test   %rax,%rax
jne    1170 <_is_shortname+0x50>
mov    %rbx,%rax
pop    %rbx
ret
xor    %ebx,%ebx
jmp    1192 <_is_shortname+0x72>

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

LLVM IR (-O2):
define i8* @_is_shortname(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 %5, label %9
5: ; preds = %1
%6 = load i8, i8* %0
%7 = tail call i64 @isalpha(i8 signext %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %36, label %9
9: ; preds = %5, %1
br label %10
10: ; preds = %16, %9
%11 = phi i8* [ %0, %9 ], [ %12, %16 ]
%12 = getelementptr inbounds i8, i8* %11, i64 1
%13 = load i8, i8* %12
%14 = tail call i64 @isalpha(i8 signext %13)
%15 = icmp eq i64 %14, 0
br i1 %15, label %17, label %16
16: ; preds = %10, %17, %21
br label %10
17: ; preds = %10
%18 = load i8, i8* %12
%19 = tail call i64 @isdigit(i8 signext %18)
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %16
21: ; preds = %17
%22 = load i8, i8* %12
%23 = icmp eq i8 %22, 45
br i1 %23, label %16, label %24
24: ; preds = %21, %33
%25 = phi i8 [ %35, %33 ], [ %22, %21 ]
%26 = phi i8* [ %34, %33 ], [ %12, %21 ]
%27 = tail call i64 @isalpha(i8 signext %25)
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %33
29: ; preds = %24
%30 = load i8, i8* %26
%31 = tail call i64 @isdigit(i8 signext %30)
%32 = icmp eq i64 %31, 0
br i1 %32, label %36, label %33
33: ; preds = %24, %29
%34 = getelementptr inbounds i8, i8* %26, i64 1
%35 = load i8, i8* %34
br label %24
36: ; preds = %29, %5
%37 = phi i8* [ null, %5 ], [ %26, %29 ]
ret i8* %37
}