#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 checkFolderExists(char *);
char *createFullPath(char *, char *);
int /*<<< orphan*/ free(char *);
int strlen(char *);
int checkIdentifier(char *identifier, char *rootdir) {
  int returnCode = 200;
  if (strlen(identifier) != 10) {
    ;
    return 501;
  }
  int i = 0;
  for (i = 0; i < strlen(identifier); ++i) {
    char currentChar = identifier[i];
    if (currentChar < 48 || (currentChar > 90 && currentChar < 97) ||
        currentChar > 122) {
      return 501;
    }
  }
  char *identifierPath = createFullPath(rootdir, identifier);
  char *identifierFolderPath = createFullPath(identifierPath, "placeholder");
  if (checkFolderExists(identifierFolderPath) != 1) {
    ;
    returnCode = 501;
  }
  free(identifierPath);
  free(identifierFolderPath);
  return returnCode;
}


x86 assembly (clang, -O0):
<checkIdentifier>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0xc8,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0xa,%eax
je     1175 <checkIdentifier+0x35>
movl   $0x1f5,-0x4(%rbp)
jmp    1256 <checkIdentifier+0x116>
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x3c(%rbp),%eax
cmp    %ecx,%eax
jge    1200 <checkIdentifier+0xc0>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x21(%rbp)
movsbl -0x21(%rbp),%eax
cmp    $0x30,%eax
jl     11e1 <checkIdentifier+0xa1>
movsbl -0x21(%rbp),%eax
cmp    $0x5a,%eax
jle    11d4 <checkIdentifier+0x94>
movsbl -0x21(%rbp),%eax
cmp    $0x61,%eax
jl     11e1 <checkIdentifier+0xa1>
movsbl -0x21(%rbp),%eax
cmp    $0x7a,%eax
jle    11ed <checkIdentifier+0xad>
movl   $0x1f5,-0x4(%rbp)
jmp    1256 <checkIdentifier+0x116>
jmp    11f2 <checkIdentifier+0xb2>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1183 <checkIdentifier+0x43>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <createFullPath@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
lea    0xde4(%rip),%rsi
call   1050 <createFullPath@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
call   1060 <checkFolderExists@plt>
cmp    $0x1,%eax
je     123e <checkIdentifier+0xfe>
movl   $0x1f5,-0x1c(%rbp)
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkIdentifier>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    $0x1f5,%r15d
cmp    $0xa,%eax
jne    11f6 <checkIdentifier+0xb6>
mov    %rbx,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    11ac <checkIdentifier+0x6c>
xor    %ebp,%ebp
movabs $0x1f0000003f,%r12
jmp    1193 <checkIdentifier+0x53>
nopl   0x0(%rax)
add    $0x1,%rbp
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%rbp
jge    11ac <checkIdentifier+0x6c>
movzbl (%rbx,%rbp,1),%eax
cmp    $0x30,%al
jl     11f6 <checkIdentifier+0xb6>
add    $0xa5,%al
cmp    $0x24,%al
ja     1180 <checkIdentifier+0x40>
movzbl %al,%eax
bt     %rax,%r12
jae    1180 <checkIdentifier+0x40>
jmp    11f6 <checkIdentifier+0xb6>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <createFullPath@plt>
mov    %rax,%r14
lea    0xe3f(%rip),%rsi
mov    %rax,%rdi
call   1050 <createFullPath@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <checkFolderExists@plt>
cmp    $0x1,%eax
mov    $0xc8,%eax
mov    $0x1f5,%r15d
cmove  %eax,%r15d
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r15d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"placeholder\00"
define i32 @checkIdentifier(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8
%9 = alloca i8*
%10 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 200, i32* %6
%11 = load i8*, i8** %4
%12 = call i32 @strlen(i8* %11)
%13 = icmp ne i32 %12, 10
br i1 %13, label %14, label %15
14: ; preds = %2
store i32 501, i32* %3
br label %63
15: ; preds = %2
store i32 0, i32* %7
store i32 0, i32* %7
br label %16
16: ; preds = %44, %15
%17 = load i32, i32* %7
%18 = load i8*, i8** %4
%19 = call i32 @strlen(i8* %18)
%20 = icmp slt i32 %17, %19
br i1 %20, label %21, label %47
21: ; preds = %16
%22 = load i8*, i8** %4
%23 = load i32, i32* %7
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %22, i64 %24
%26 = load i8, i8* %25
store i8 %26, i8* %8
%27 = load i8, i8* %8
%28 = sext i8 %27 to i32
%29 = icmp slt i32 %28, 48
br i1 %29, label %42, label %30
30: ; preds = %21
%31 = load i8, i8* %8
%32 = sext i8 %31 to i32
%33 = icmp sgt i32 %32, 90
br i1 %33, label %34, label %38
34: ; preds = %30
%35 = load i8, i8* %8
%36 = sext i8 %35 to i32
%37 = icmp slt i32 %36, 97
br i1 %37, label %42, label %38
38: ; preds = %34, %30
%39 = load i8, i8* %8
%40 = sext i8 %39 to i32
%41 = icmp sgt i32 %40, 122
br i1 %41, label %42, label %43
42: ; preds = %38, %34, %21
store i32 501, i32* %3
br label %63
43: ; preds = %38
br label %44
44: ; preds = %43
%45 = load i32, i32* %7
%46 = add nsw i32 %45, 1
store i32 %46, i32* %7
br label %16
47: ; preds = %16
%48 = load i8*, i8** %5
%49 = load i8*, i8** %4
%50 = call i8* @createFullPath(i8* %48, i8* %49)
store i8* %50, i8** %9
%51 = load i8*, i8** %9
%52 = call i8* @createFullPath(i8* %51, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
store i8* %52, i8** %10
%53 = load i8*, i8** %10
%54 = call i32 @checkFolderExists(i8* %53)
%55 = icmp ne i32 %54, 1
br i1 %55, label %56, label %57
56: ; preds = %47
store i32 501, i32* %6
br label %57
57: ; preds = %56, %47
%58 = load i8*, i8** %9
%59 = call i32 @free(i8* %58)
%60 = load i8*, i8** %10
%61 = call i32 @free(i8* %60)
%62 = load i32, i32* %6
store i32 %62, i32* %3
br label %63
63: ; preds = %57, %42, %14
%64 = load i32, i32* %3
ret i32 %64
}

LLVM IR (-O2):
@.str = [12 x i8] c"placeholder\00"
define i32 @checkIdentifier(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = icmp eq i32 %3, 10
br i1 %4, label %5, label %27
5: ; preds = %2
%6 = tail call i32 @strlen(i8* %0)
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %19
8: ; preds = %5, %14
%9 = phi i64 [ %15, %14 ], [ 0, %5 ]
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = icmp slt i8 %11, 48
br i1 %12, label %27, label %13
13: ; preds = %8
switch i8 %11, label %14 [
i8 127, label %27
i8 126, label %27
i8 125, label %27
i8 124, label %27
i8 123, label %27
i8 96, label %27
i8 95, label %27
i8 94, label %27
i8 93, label %27
i8 92, label %27
i8 91, label %27
]
14: ; preds = %13
%15 = add nuw nsw i64 %9, 1
%16 = tail call i32 @strlen(i8* %0)
%17 = sext i32 %16 to i64
%18 = icmp slt i64 %15, %17
br i1 %18, label %8, label %19
19: ; preds = %14, %5
%20 = tail call i8* @createFullPath(i8* %1, i8* %0)
%21 = tail call i8* @createFullPath(i8* %20, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%22 = tail call i32 @checkFolderExists(i8* %21)
%23 = icmp eq i32 %22, 1
%24 = select i1 %23, i32 200, i32 501
%25 = tail call i32 @free(i8* %20)
%26 = tail call i32 @free(i8* %21)
br label %27
27: ; preds = %8, %13, %13, %13, %13, %13, %13, %13, %13, %13, %13, %13, %19, %2
%28 = phi i32 [ 501, %2 ], [ %24, %19 ], [ 501, %13 ], [ 501, %13 ], [ 501, %13 ], [ 501, %13 ], [ 501, %13 ], [ 501, %13 ], [ 501, %13 ], [ 501, %13 ], [ 501, %13 ], [ 501, %13 ], [ 501, %13 ], [ 501, %8 ]
ret i32 %28
}