#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void check_assignment(char *s) {
  if (*s == '/') {
    fprintf(stderr, "turnin: The assignment cannot be an absolute path.\n"
                    "        Please ask for help.\n");
    exit(1);
  }
  for (; *s; s++) {
    if (!((*s == ' ') || (*s == '_') || (*s == '-') || (*s == '/') ||
          ((*s >= '0') && (*s <= '9')) || ((*s >= 'a') && (*s <= 'z')) ||
          ((*s >= 'A') && (*s <= 'Z')))) {
      fprintf(stderr, "turnin: An assignment can include only ascii characters "
                      "in [a-zA-Z0-9 /_-]\n");
      exit(1);
    }
  }
}


x86 assembly (clang, -O0):
<check_assignment>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    115b <check_assignment+0x3b>
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
lea    0xeb4(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
jmp    1160 <check_assignment+0x40>
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1242 <check_assignment+0x122>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
je     122c <check_assignment+0x10c>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5f,%eax
je     122c <check_assignment+0x10c>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
je     122c <check_assignment+0x10c>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
je     122c <check_assignment+0x10c>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jl     11cd <check_assignment+0xad>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x39,%eax
jle    122c <check_assignment+0x10c>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x61,%eax
jl     11ed <check_assignment+0xcd>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7a,%eax
jle    122c <check_assignment+0x10c>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x41,%eax
jl     120d <check_assignment+0xed>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5a,%eax
jle    122c <check_assignment+0x10c>
mov    0x2dcc(%rip),%rax
mov    (%rax),%edi
lea    0xe34(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
jmp    1231 <check_assignment+0x111>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1160 <check_assignment+0x40>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_assignment>:
push   %rax
mov    (%rdi),%al
cmp    $0x2f,%al
je     1193 <check_assignment+0x73>
add    $0x1,%rdi
movabs $0x800000000000a001,%rcx
jmp    1147 <check_assignment+0x27>
nopw   0x0(%rax,%rax,1)
movzbl (%rdi),%eax
add    $0x1,%rdi
lea    -0x20(%rax),%edx
cmp    $0x3f,%dl
ja     1158 <check_assignment+0x38>
movzbl %dl,%edx
bt     %rdx,%rcx
jb     1140 <check_assignment+0x20>
test   %al,%al
je     1191 <check_assignment+0x71>
lea    -0x30(%rax),%edx
cmp    $0xa,%dl
jb     1140 <check_assignment+0x20>
lea    -0x61(%rax),%edx
cmp    $0x1a,%dl
jb     1140 <check_assignment+0x20>
add    $0xbf,%al
cmp    $0x1a,%al
jb     1140 <check_assignment+0x20>
mov    0x2e67(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
pop    %rax
ret
mov    0x2e46(%rip),%rax
mov    (%rax),%edi
lea    0xe5d(%rip),%rsi
jmp    1182 <check_assignment+0x62>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [81 x i8] c"turnin: The assignment cannot be an absolute path.\0A Please ask for help.\0A\00"
@.str.1 = [76 x i8] c"turnin: An assignment can include only ascii characters in [a-zA-Z0-9 /_-]\0A\00"
define void @check_assignment(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp eq i32 %5, 47
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i32, i32* @stderr
%9 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @exit(i32 1)
unreachable
11: ; preds = %1
br label %12
12: ; preds = %71, %11
%13 = load i8*, i8** %2
%14 = load i8, i8* %13
%15 = icmp ne i8 %14, 0
br i1 %15, label %16, label %74
16: ; preds = %12
%17 = load i8*, i8** %2
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 32
br i1 %20, label %70, label %21
21: ; preds = %16
%22 = load i8*, i8** %2
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 95
br i1 %25, label %70, label %26
26: ; preds = %21
%27 = load i8*, i8** %2
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 45
br i1 %30, label %70, label %31
31: ; preds = %26
%32 = load i8*, i8** %2
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 47
br i1 %35, label %70, label %36
36: ; preds = %31
%37 = load i8*, i8** %2
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = icmp sge i32 %39, 48
br i1 %40, label %41, label %46
41: ; preds = %36
%42 = load i8*, i8** %2
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = icmp sle i32 %44, 57
br i1 %45, label %70, label %46
46: ; preds = %41, %36
%47 = load i8*, i8** %2
%48 = load i8, i8* %47
%49 = sext i8 %48 to i32
%50 = icmp sge i32 %49, 97
br i1 %50, label %51, label %56
51: ; preds = %46
%52 = load i8*, i8** %2
%53 = load i8, i8* %52
%54 = sext i8 %53 to i32
%55 = icmp sle i32 %54, 122
br i1 %55, label %70, label %56
56: ; preds = %51, %46
%57 = load i8*, i8** %2
%58 = load i8, i8* %57
%59 = sext i8 %58 to i32
%60 = icmp sge i32 %59, 65
br i1 %60, label %61, label %66
61: ; preds = %56
%62 = load i8*, i8** %2
%63 = load i8, i8* %62
%64 = sext i8 %63 to i32
%65 = icmp sle i32 %64, 90
br i1 %65, label %70, label %66
66: ; preds = %61, %56
%67 = load i32, i32* @stderr
%68 = call i32 @fprintf(i32 %67, i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.1, i64 0, i64 0))
%69 = call i32 @exit(i32 1)
unreachable
70: ; preds = %61, %51, %41, %31, %26, %21, %16
br label %71
71: ; preds = %70
%72 = load i8*, i8** %2
%73 = getelementptr inbounds i8, i8* %72, i32 1
store i8* %73, i8** %2
br label %12
74: ; preds = %12
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [81 x i8] c"turnin: The assignment cannot be an absolute path.\0A Please ask for help.\0A\00"
@.str.1 = [76 x i8] c"turnin: An assignment can include only ascii characters in [a-zA-Z0-9 /_-]\0A\00"
define void @check_assignment(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 47
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %1, %24
%9 = phi i8 [ %26, %24 ], [ %2, %1 ]
%10 = phi i8* [ %25, %24 ], [ %0, %1 ]
switch i8 %9, label %11 [
i8 0, label %27
i8 32, label %24
i8 95, label %24
i8 45, label %24
i8 47, label %24
]
11: ; preds = %8
%12 = add i8 %9, -48
%13 = icmp ult i8 %12, 10
%14 = add i8 %9, -97
%15 = icmp ult i8 %14, 26
%16 = or i1 %13, %15
%17 = add i8 %9, -65
%18 = icmp ult i8 %17, 26
%19 = select i1 %16, i1 true, i1 %18
br i1 %19, label %24, label %20
20: ; preds = %11
%21 = load i32, i32* @stderr
%22 = tail call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.1, i64 0, i64 0))
%23 = tail call i32 @exit(i32 1)
unreachable
24: ; preds = %11, %8, %8, %8, %8
%25 = getelementptr inbounds i8, i8* %10, i64 1
%26 = load i8, i8* %25
br label %8
27: ; preds = %8
ret void
}