#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__ isalnum(char);
scalar_t__ strchr(char *, int);
char sffe_doname(char **str) {
  do {
    *str += 1;
  } while (isalnum(**str) || **str == '_');
  if (strchr("+-*/^~!@#$%&<>?\\:\"|", (int)**str)) {
    return 1;
  }
  if (**str == '(') {
    return 2;
  }
  if (**str == '.') {
    return 3;
  }
  return 1;
}


x86 assembly (clang, -O0):
<sffe_doname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%edi
call   1040 <isalnum@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x11(%rbp)
jne    116e <sffe_doname+0x4e>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x5f,%eax
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    112c <sffe_doname+0xc>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%esi
lea    0xe76(%rip),%rdi
call   1030 <strchr@plt>
cmp    $0x0,%rax
je     11a2 <sffe_doname+0x82>
movb   $0x1,-0x1(%rbp)
jmp    11de <sffe_doname+0xbe>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x28,%eax
jne    11be <sffe_doname+0x9e>
movb   $0x2,-0x1(%rbp)
jmp    11de <sffe_doname+0xbe>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
jne    11da <sffe_doname+0xba>
movb   $0x3,-0x1(%rbp)
jmp    11de <sffe_doname+0xbe>
movb   $0x1,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sffe_doname>:
push   %rbx
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%rbx),%rax
lea    0x1(%rax),%rcx
mov    %rcx,(%rbx)
movsbl 0x1(%rax),%edi
call   1040 <isalnum@plt>
test   %rax,%rax
jne    1130 <sffe_doname+0x10>
mov    (%rbx),%rax
movsbl (%rax),%esi
cmp    $0x5f,%esi
je     1130 <sffe_doname+0x10>
lea    0xea6(%rip),%rdi
call   1030 <strchr@plt>
mov    %rax,%rcx
mov    $0x1,%al
test   %rcx,%rcx
je     116b <sffe_doname+0x4b>
pop    %rbx
ret
mov    (%rbx),%rax
mov    (%rax),%al
cmp    $0x2e,%al
sete   %cl
add    %cl,%cl
or     $0x1,%cl
cmp    $0x28,%al
movzbl %cl,%ecx
mov    $0x2,%eax
cmovne %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"+-*/^~!@#$%&<>?\\:\22|\00"
define signext i8 @sffe_doname(i8** %0) {
%2 = alloca i8
%3 = alloca i8**
store i8** %0, i8*** %3
br label %4
4: ; preds = %20, %1
%5 = load i8**, i8*** %3
%6 = load i8*, i8** %5
%7 = getelementptr inbounds i8, i8* %6, i64 1
store i8* %7, i8** %5
br label %8
8: ; preds = %4
%9 = load i8**, i8*** %3
%10 = load i8*, i8** %9
%11 = load i8, i8* %10
%12 = call i64 @isalnum(i8 signext %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %20, label %14
14: ; preds = %8
%15 = load i8**, i8*** %3
%16 = load i8*, i8** %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 95
br label %20
20: ; preds = %14, %8
%21 = phi i1 [ true, %8 ], [ %19, %14 ]
br i1 %21, label %4, label %22
22: ; preds = %20
%23 = load i8**, i8*** %3
%24 = load i8*, i8** %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = call i64 @strchr(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %26)
%28 = icmp ne i64 %27, 0
br i1 %28, label %29, label %30
29: ; preds = %22
store i8 1, i8* %2
br label %45
30: ; preds = %22
%31 = load i8**, i8*** %3
%32 = load i8*, i8** %31
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 40
br i1 %35, label %36, label %37
36: ; preds = %30
store i8 2, i8* %2
br label %45
37: ; preds = %30
%38 = load i8**, i8*** %3
%39 = load i8*, i8** %38
%40 = load i8, i8* %39
%41 = sext i8 %40 to i32
%42 = icmp eq i32 %41, 46
br i1 %42, label %43, label %44
43: ; preds = %37
store i8 3, i8* %2
br label %45
44: ; preds = %37
store i8 1, i8* %2
br label %45
45: ; preds = %44, %43, %36, %29
%46 = load i8, i8* %2
ret i8 %46
}

LLVM IR (-O2):
@.str = [20 x i8] c"+-*/^~!@#$%&<>?\\:\22|\00"
define signext i8 @sffe_doname(i8** nocapture %0) {
br label %2
2: ; preds = %12, %1
%3 = load i8*, i8** %0
%4 = getelementptr inbounds i8, i8* %3, i64 1
store i8* %4, i8** %0
%5 = load i8, i8* %4
%6 = tail call i64 @isalnum(i8 signext %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i8*, i8** %0
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 95
br i1 %11, label %12, label %13
12: ; preds = %8, %2
br label %2
13: ; preds = %8
%14 = sext i8 %10 to i32
%15 = tail call i64 @strchr(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %24
17: ; preds = %13
%18 = load i8*, i8** %0
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 46
%21 = select i1 %20, i8 3, i8 1
%22 = icmp eq i8 %19, 40
%23 = select i1 %22, i8 2, i8 %21
br label %24
24: ; preds = %17, %13
%25 = phi i8 [ 1, %13 ], [ %23, %17 ]
ret i8 %25
}