#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 CountUTF8String(char *);
int /*<<< orphan*/ free(char *);
scalar_t__ isalnum(int);
scalar_t__ isdigit(char);
char *malloc(int);
int /*<<< orphan*/ printFooter();
int /*<<< orphan*/ printMenuHeader(char *);
int /*<<< orphan*/ printMenuItem(char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ sprintf(char *, char *, ...);
int isValidKnotenName(char *Name) {
  char *buffer = malloc(sizeof(char) * 1000);
  if (isdigit(Name[0])) {
    puts(" ");
    sprintf(buffer,
            "  Fehler , Der Ausfahrts Name muss mit einem Buchstaben beginnen");
    printMenuHeader(buffer);
    free(buffer);
    return 1;
  }
  for (int i = 0; i < CountUTF8String(Name); i++) {
    if (isalnum((int)Name[i]) == 0 && Name[i] != '_' && Name[i] != '.') {
      sprintf(
          buffer,
          "  Fehler , Der Ausfahrts Name enthält '%c' , ein Verbotenes Zeichen",
          Name[i]);
      printMenuHeader(buffer);
      printMenuItem("Erlaubte zeichen [A-Z] [a-z] [0-9] '_' '.' ");
      printFooter();
      free(buffer);
      return 1;
    }
  }
  free(buffer);
  return 0;
}


x86 assembly (clang, -O0):
<isValidKnotenName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    $0x3e8,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isdigit@plt>
cmp    $0x0,%rax
je     120c <isValidKnotenName+0x6c>
lea    0xed9(%rip),%rdi
call   1050 <puts@plt>
mov    -0x18(%rbp),%rdi
lea    0xe19(%rip),%rsi
mov    $0x0,%al
call   10c0 <sprintf@plt>
mov    -0x18(%rbp),%rdi
call   10b0 <printMenuHeader@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
movl   $0x1,-0x4(%rbp)
jmp    12e6 <isValidKnotenName+0x146>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1090 <CountUTF8String@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
cmp    %ecx,%eax
jge    12d6 <isValidKnotenName+0x136>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1080 <isalnum@plt>
cmp    $0x0,%rax
jne    12c3 <isValidKnotenName+0x123>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x5f,%eax
je     12c3 <isValidKnotenName+0x123>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2e,%eax
je     12c3 <isValidKnotenName+0x123>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%edx
lea    0xdb6(%rip),%rsi
mov    $0x0,%al
call   10c0 <sprintf@plt>
mov    -0x18(%rbp),%rdi
call   10b0 <printMenuHeader@plt>
lea    0xde4(%rip),%rdi
call   1060 <printMenuItem@plt>
mov    $0x0,%al
call   1070 <printFooter@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
movl   $0x1,-0x4(%rbp)
jmp    12e6 <isValidKnotenName+0x146>
jmp    12c8 <isValidKnotenName+0x128>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1213 <isValidKnotenName+0x73>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isValidKnotenName>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
mov    $0x3e8,%edi
call   10a0 <malloc@plt>
mov    %rax,%r14
movsbl (%r15),%edi
call   1040 <isdigit@plt>
test   %rax,%rax
je     1215 <isValidKnotenName+0x75>
lea    0xee6(%rip),%rdi
call   1050 <puts@plt>
movups 0xe2a(%rip),%xmm0
movups %xmm0,(%r14)
movups 0xe2f(%rip),%xmm0
movups %xmm0,0x10(%r14)
movups 0xe33(%rip),%xmm0
movups %xmm0,0x20(%r14)
movups 0xe37(%rip),%xmm0
movups %xmm0,0x30(%r14)
movb   $0x0,0x40(%r14)
mov    %r14,%rdi
call   10b0 <printMenuHeader@plt>
mov    $0x1,%ebx
jmp    1296 <isValidKnotenName+0xf6>
mov    %r15,%rdi
call   1090 <CountUTF8String@plt>
test   %eax,%eax
jle    1294 <isValidKnotenName+0xf4>
xor    %ebx,%ebx
jmp    1243 <isValidKnotenName+0xa3>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%rbx
mov    %r15,%rdi
call   1090 <CountUTF8String@plt>
cltq
cmp    %rax,%rbx
jge    1294 <isValidKnotenName+0xf4>
movsbl (%r15,%rbx,1),%edi
call   1080 <isalnum@plt>
test   %rax,%rax
jne    1230 <isValidKnotenName+0x90>
movsbl (%r15,%rbx,1),%edx
cmp    $0x2e,%edx
je     1230 <isValidKnotenName+0x90>
cmp    $0x5f,%dl
je     1230 <isValidKnotenName+0x90>
lea    0xdd9(%rip),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   10c0 <sprintf@plt>
mov    %r14,%rdi
call   10b0 <printMenuHeader@plt>
lea    0xe05(%rip),%rdi
call   1060 <printMenuItem@plt>
xor    %eax,%eax
call   1070 <printFooter@plt>
mov    $0x1,%ebx
jmp    1296 <isValidKnotenName+0xf6>
xor    %ebx,%ebx
mov    %r14,%rdi
call   1030 <free@plt>
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
@.str.1 = [65 x i8] c" Fehler , Der Ausfahrts Name muss mit einem Buchstaben beginnen\00"
@.str.2 = [69 x i8] c" Fehler , Der Ausfahrts Name enth\C3\A4lt '%c' , ein Verbotenes Zeichen\00"
@.str.3 = [44 x i8] c"Erlaubte zeichen [A-Z] [a-z] [0-9] '_' '.' \00"
define i32 @isValidKnotenName(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
%6 = call i8* @malloc(i32 1000)
store i8* %6, i8** %4
%7 = load i8*, i8** %3
%8 = getelementptr inbounds i8, i8* %7, i64 0
%9 = load i8, i8* %8
%10 = call i64 @isdigit(i8 signext %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %20
12: ; preds = %1
%13 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%14 = load i8*, i8** %4
%15 = call i32 (i8*, i8*, ...) @sprintf(i8* %14, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0))
%16 = load i8*, i8** %4
%17 = call i32 @printMenuHeader(i8* %16)
%18 = load i8*, i8** %4
%19 = call i32 @free(i8* %18)
store i32 1, i32* %2
br label %73
20: ; preds = %1
store i32 0, i32* %5
br label %21
21: ; preds = %67, %20
%22 = load i32, i32* %5
%23 = load i8*, i8** %3
%24 = call i32 @CountUTF8String(i8* %23)
%25 = icmp slt i32 %22, %24
br i1 %25, label %26, label %70
26: ; preds = %21
%27 = load i8*, i8** %3
%28 = load i32, i32* %5
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8, i8* %27, i64 %29
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = call i64 @isalnum(i32 %32)
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %66
35: ; preds = %26
%36 = load i8*, i8** %3
%37 = load i32, i32* %5
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8, i8* %36, i64 %38
%40 = load i8, i8* %39
%41 = sext i8 %40 to i32
%42 = icmp ne i32 %41, 95
br i1 %42, label %43, label %66
43: ; preds = %35
%44 = load i8*, i8** %3
%45 = load i32, i32* %5
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8, i8* %44, i64 %46
%48 = load i8, i8* %47
%49 = sext i8 %48 to i32
%50 = icmp ne i32 %49, 46
br i1 %50, label %51, label %66
51: ; preds = %43
%52 = load i8*, i8** %4
%53 = load i8*, i8** %3
%54 = load i32, i32* %5
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds i8, i8* %53, i64 %55
%57 = load i8, i8* %56
%58 = sext i8 %57 to i32
%59 = call i32 (i8*, i8*, ...) @sprintf(i8* %52, i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.2, i64 0, i64 0), i32 %58)
%60 = load i8*, i8** %4
%61 = call i32 @printMenuHeader(i8* %60)
%62 = call i32 @printMenuItem(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0))
%63 = call i32 (...) @printFooter()
%64 = load i8*, i8** %4
%65 = call i32 @free(i8* %64)
store i32 1, i32* %2
br label %73
66: ; preds = %43, %35, %26
br label %67
67: ; preds = %66
%68 = load i32, i32* %5
%69 = add nsw i32 %68, 1
store i32 %69, i32* %5
br label %21
70: ; preds = %21
%71 = load i8*, i8** %4
%72 = call i32 @free(i8* %71)
store i32 0, i32* %2
br label %73
73: ; preds = %70, %51, %12
%74 = load i32, i32* %2
ret i32 %74
}

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
@.str.1 = [65 x i8] c" Fehler , Der Ausfahrts Name muss mit einem Buchstaben beginnen\00"
@.str.2 = [69 x i8] c" Fehler , Der Ausfahrts Name enth\C3\A4lt '%c' , ein Verbotenes Zeichen\00"
@.str.3 = [44 x i8] c"Erlaubte zeichen [A-Z] [a-z] [0-9] '_' '.' \00"
define i32 @isValidKnotenName(i8* %0) {
%2 = tail call dereferenceable_or_null(1000) i8* @malloc(i32 1000)
%3 = load i8, i8* %0
%4 = tail call i64 @isdigit(i8 signext %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = tail call i32 @CountUTF8String(i8* %0)
%8 = icmp sgt i32 %7, 0
br i1 %8, label %12, label %32
9: ; preds = %1
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(65) %2, i8* align 1 dereferenceable(65) getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0), i64 65, i1 false)
%11 = tail call i32 @printMenuHeader(i8* %2)
br label %32
12: ; preds = %6, %27
%13 = phi i64 [ %28, %27 ], [ 0, %6 ]
%14 = getelementptr inbounds i8, i8* %0, i64 %13
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = tail call i64 @isalnum(i32 %16)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %27
19: ; preds = %12
%20 = load i8, i8* %14
switch i8 %20, label %21 [
i8 95, label %27
i8 46, label %27
]
21: ; preds = %19
%22 = sext i8 %20 to i32
%23 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %2, i8* dereferenceable(1) getelementptr inbounds ([69 x i8], [69 x i8]* @.str.2, i64 0, i64 0), i32 %22)
%24 = tail call i32 @printMenuHeader(i8* %2)
%25 = tail call i32 @printMenuItem(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0))
%26 = tail call i32 (...) @printFooter()
br label %32
27: ; preds = %19, %19, %12
%28 = add nuw nsw i64 %13, 1
%29 = tail call i32 @CountUTF8String(i8* %0)
%30 = sext i32 %29 to i64
%31 = icmp slt i64 %28, %30
br i1 %31, label %12, label %32
32: ; preds = %27, %6, %21, %9
%33 = phi i32 [ 1, %9 ], [ 1, %21 ], [ 0, %6 ], [ 0, %27 ]
%34 = tail call i32 @free(i8* %2)
ret i32 %33
}