#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*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
void analyzeRunId(char id[128]) {
  int i = 0;
  while (id[i] != '\0') {
    if (i >= 128) {
      printf("Error: run id after \"-n\" is too long, it has %d characters "
             "please use a shorter one\n",
             i);
      assert(0);
    }
    if (id[i] == '/') {
      printf("Error character %c not allowed in run ID\n", id[i]);
      assert(0);
    }
    i++;
  }
  if (i == 0) {
    printf("Error: please provide a string for the run id after \"-n\" \n");
    assert(0);
  }
}


x86 assembly (clang, -O0):
<analyzeRunId>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     11b1 <analyzeRunId+0x91>
cmpl   $0x80,-0xc(%rbp)
jl     116d <analyzeRunId+0x4d>
mov    -0xc(%rbp),%esi
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2f,%eax
jne    11a3 <analyzeRunId+0x83>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xec0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <assert@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1133 <analyzeRunId+0x13>
cmpl   $0x0,-0xc(%rbp)
jne    11d0 <analyzeRunId+0xb0>
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <assert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<analyzeRunId>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    (%rdi),%bpl
test   %bpl,%bpl
je     11b9 <analyzeRunId+0x89>
mov    %rdi,%r12
lea    0xeb6(%rip),%r14
lea    0xf04(%rip),%r15
xor    %ebx,%ebx
mov    %ebp,%eax
jmp    116e <analyzeRunId+0x3e>
nopw   0x0(%rax,%rax,1)
movzbl 0x1(%r12,%rbx,1),%eax
add    $0x1,%rbx
test   %al,%al
je     11ab <analyzeRunId+0x7b>
cmp    $0x80,%rbx
jb     118f <analyzeRunId+0x5f>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %edi,%edi
call   1050 <assert@plt>
movzbl (%r12,%rbx,1),%eax
cmp    $0x2f,%al
jne    1160 <analyzeRunId+0x30>
mov    %r15,%rdi
mov    $0x2f,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %edi,%edi
call   1050 <assert@plt>
jmp    1160 <analyzeRunId+0x30>
test   %bpl,%bpl
je     11b9 <analyzeRunId+0x89>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xebf(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <assert@plt>

LLVM IR (-O0):
@.str = [85 x i8] c"Error: run id after \22-n\22 is too long, it has %d characters please use a shorter one\0A\00"
@.str.1 = [42 x i8] c"Error character %c not allowed in run ID\0A\00"
@.str.2 = [59 x i8] c"Error: please provide a string for the run id after \22-n\22 \0A\00"
define void @analyzeRunId(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %36, %1
%5 = load i8*, i8** %2
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %5, i64 %7
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %39
12: ; preds = %4
%13 = load i32, i32* %3
%14 = icmp sge i32 %13, 128
br i1 %14, label %15, label %19
15: ; preds = %12
%16 = load i32, i32* %3
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([85 x i8], [85 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = call i32 @assert(i32 0)
br label %19
19: ; preds = %15, %12
%20 = load i8*, i8** %2
%21 = load i32, i32* %3
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %20, i64 %22
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 47
br i1 %26, label %27, label %36
27: ; preds = %19
%28 = load i8*, i8** %2
%29 = load i32, i32* %3
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %28, i64 %30
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i32 %33)
%35 = call i32 @assert(i32 0)
br label %36
36: ; preds = %27, %19
%37 = load i32, i32* %3
%38 = add nsw i32 %37, 1
store i32 %38, i32* %3
br label %4
39: ; preds = %4
%40 = load i32, i32* %3
%41 = icmp eq i32 %40, 0
br i1 %41, label %42, label %45
42: ; preds = %39
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.2, i64 0, i64 0))
%44 = call i32 @assert(i32 0)
br label %45
45: ; preds = %42, %39
ret void
}

LLVM IR (-O2):
@.str = [85 x i8] c"Error: run id after \22-n\22 is too long, it has %d characters please use a shorter one\0A\00"
@.str.1 = [42 x i8] c"Error character %c not allowed in run ID\0A\00"
@str = [58 x i8] c"Error: please provide a string for the run id after \22-n\22 \00"
define void @analyzeRunId(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %26, label %4
4: ; preds = %1, %20
%5 = phi i64 [ %21, %20 ], [ 0, %1 ]
%6 = phi i8 [ %23, %20 ], [ %2, %1 ]
%7 = phi i8* [ %22, %20 ], [ %0, %1 ]
%8 = icmp ugt i64 %5, 127
br i1 %8, label %9, label %14
9: ; preds = %4
%10 = trunc i64 %5 to i32
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([85 x i8], [85 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = tail call i32 @assert(i32 0)
%13 = load i8, i8* %7
br label %14
14: ; preds = %9, %4
%15 = phi i8 [ %13, %9 ], [ %6, %4 ]
%16 = icmp eq i8 %15, 47
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i32 47)
%19 = tail call i32 @assert(i32 0)
br label %20
20: ; preds = %17, %14
%21 = add nuw i64 %5, 1
%22 = getelementptr inbounds i8, i8* %0, i64 %21
%23 = load i8, i8* %22
%24 = icmp eq i8 %23, 0
br i1 %24, label %25, label %4
25: ; preds = %20
br i1 %3, label %26, label %29
26: ; preds = %1, %25
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @str, i64 0, i64 0))
%28 = tail call i32 @assert(i32 0)
br label %29
29: ; preds = %26, %25
ret void
}