#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);
int str_to_uint(char *);
void str_to_uint_test(void) {
  assert(str_to_uint("0") == 0);
  assert(str_to_uint("1") == 1);
  assert(str_to_uint("a") == -1);
  assert(str_to_uint("1a") == -1);
  assert(str_to_uint("a1") == -1);
  assert(str_to_uint("") == -1);
  assert(str_to_uint("0 ") == 0);
  assert(str_to_uint(" 0") == 0);
  assert(str_to_uint(" 0 ") == 0);
  assert(str_to_uint("   ") == -1);
  assert(str_to_uint(" 0 a") == -1);
  assert(str_to_uint("a 123 ") == -1);
  assert(str_to_uint("  123 a") == -1);
  assert(str_to_uint("	 123 a") == -1);
  assert(str_to_uint("	 123  ") == 123);
  assert(str_to_uint("	 123	") == 123);
  assert(str_to_uint("123") == 123);
  assert(str_to_uint("0x123") == -1);
}


x86 assembly (clang, -O0):
<str_to_uint_test>:
push   %rbp
mov    %rsp,%rbp
lea    0xedc(%rip),%rdi
call   1030 <str_to_uint@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xebd(%rip),%rdi
call   1030 <str_to_uint@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xeb1(%rip),%rdi
call   1030 <str_to_uint@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xe81(%rip),%rdi
call   1030 <str_to_uint@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xe68(%rip),%rdi
call   1030 <str_to_uint@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xe84(%rip),%rdi
call   1030 <str_to_uint@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xe37(%rip),%rdi
call   1030 <str_to_uint@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xe17(%rip),%rdi
call   1030 <str_to_uint@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xdfe(%rip),%rdi
call   1030 <str_to_uint@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xde6(%rip),%rdi
call   1030 <str_to_uint@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xdce(%rip),%rdi
call   1030 <str_to_uint@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xdb7(%rip),%rdi
call   1030 <str_to_uint@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xda2(%rip),%rdi
call   1030 <str_to_uint@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xd8e(%rip),%rdi
call   1030 <str_to_uint@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xd7a(%rip),%rdi
call   1030 <str_to_uint@plt>
cmp    $0x7b,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xd66(%rip),%rdi
call   1030 <str_to_uint@plt>
cmp    $0x7b,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xd53(%rip),%rdi
call   1030 <str_to_uint@plt>
cmp    $0x7b,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xd35(%rip),%rdi
call   1030 <str_to_uint@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_to_uint_test>:
push   %rax
lea    0xedf(%rip),%rdi
call   1030 <str_to_uint@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xec3(%rip),%rdi
call   1030 <str_to_uint@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xeb9(%rip),%rdi
call   1030 <str_to_uint@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xe8b(%rip),%rdi
call   1030 <str_to_uint@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xe74(%rip),%rdi
call   1030 <str_to_uint@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xe92(%rip),%rdi
call   1030 <str_to_uint@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xe47(%rip),%rdi
call   1030 <str_to_uint@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xe2a(%rip),%rdi
call   1030 <str_to_uint@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xe14(%rip),%rdi
call   1030 <str_to_uint@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xdff(%rip),%rdi
call   1030 <str_to_uint@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xde9(%rip),%rdi
call   1030 <str_to_uint@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xdd4(%rip),%rdi
call   1030 <str_to_uint@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xdc1(%rip),%rdi
call   1030 <str_to_uint@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xdaf(%rip),%rdi
call   1030 <str_to_uint@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xd9d(%rip),%rdi
call   1030 <str_to_uint@plt>
xor    %edi,%edi
cmp    $0x7b,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xd8b(%rip),%rdi
call   1030 <str_to_uint@plt>
xor    %edi,%edi
cmp    $0x7b,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xd7a(%rip),%rdi
call   1030 <str_to_uint@plt>
xor    %edi,%edi
cmp    $0x7b,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xd5e(%rip),%rdi
call   1030 <str_to_uint@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
pop    %rax
jmp    1040 <assert@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"0\00"
@.str.1 = [2 x i8] c"1\00"
@.str.2 = [2 x i8] c"a\00"
@.str.3 = [3 x i8] c"1a\00"
@.str.4 = [3 x i8] c"a1\00"
@.str.5 = [1 x i8] zeroinitializer
@.str.6 = [3 x i8] c"0 \00"
@.str.7 = [3 x i8] c" 0\00"
@.str.8 = [4 x i8] c" 0 \00"
@.str.9 = [4 x i8] c" \00"
@.str.10 = [5 x i8] c" 0 a\00"
@.str.11 = [7 x i8] c"a 123 \00"
@.str.12 = [8 x i8] c" 123 a\00"
@.str.13 = [8 x i8] c"\09 123 a\00"
@.str.14 = [8 x i8] c"\09 123 \00"
@.str.15 = [7 x i8] c"\09 123\09\00"
@.str.16 = [4 x i8] c"123\00"
@.str.17 = [6 x i8] c"0x123\00"
define void @str_to_uint_test() {
%1 = call i32 @str_to_uint(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i32 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @assert(i32 %3)
%5 = call i32 @str_to_uint(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i32 %5, 1
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = call i32 @str_to_uint(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%10 = icmp eq i32 %9, -1
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = call i32 @str_to_uint(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%14 = icmp eq i32 %13, -1
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
%17 = call i32 @str_to_uint(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%18 = icmp eq i32 %17, -1
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
%21 = call i32 @str_to_uint(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0))
%22 = icmp eq i32 %21, -1
%23 = zext i1 %22 to i32
%24 = call i32 @assert(i32 %23)
%25 = call i32 @str_to_uint(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%26 = icmp eq i32 %25, 0
%27 = zext i1 %26 to i32
%28 = call i32 @assert(i32 %27)
%29 = call i32 @str_to_uint(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%30 = icmp eq i32 %29, 0
%31 = zext i1 %30 to i32
%32 = call i32 @assert(i32 %31)
%33 = call i32 @str_to_uint(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
%34 = icmp eq i32 %33, 0
%35 = zext i1 %34 to i32
%36 = call i32 @assert(i32 %35)
%37 = call i32 @str_to_uint(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
%38 = icmp eq i32 %37, -1
%39 = zext i1 %38 to i32
%40 = call i32 @assert(i32 %39)
%41 = call i32 @str_to_uint(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
%42 = icmp eq i32 %41, -1
%43 = zext i1 %42 to i32
%44 = call i32 @assert(i32 %43)
%45 = call i32 @str_to_uint(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0))
%46 = icmp eq i32 %45, -1
%47 = zext i1 %46 to i32
%48 = call i32 @assert(i32 %47)
%49 = call i32 @str_to_uint(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0))
%50 = icmp eq i32 %49, -1
%51 = zext i1 %50 to i32
%52 = call i32 @assert(i32 %51)
%53 = call i32 @str_to_uint(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0))
%54 = icmp eq i32 %53, -1
%55 = zext i1 %54 to i32
%56 = call i32 @assert(i32 %55)
%57 = call i32 @str_to_uint(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0))
%58 = icmp eq i32 %57, 123
%59 = zext i1 %58 to i32
%60 = call i32 @assert(i32 %59)
%61 = call i32 @str_to_uint(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.15, i64 0, i64 0))
%62 = icmp eq i32 %61, 123
%63 = zext i1 %62 to i32
%64 = call i32 @assert(i32 %63)
%65 = call i32 @str_to_uint(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.16, i64 0, i64 0))
%66 = icmp eq i32 %65, 123
%67 = zext i1 %66 to i32
%68 = call i32 @assert(i32 %67)
%69 = call i32 @str_to_uint(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.17, i64 0, i64 0))
%70 = icmp eq i32 %69, -1
%71 = zext i1 %70 to i32
%72 = call i32 @assert(i32 %71)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"0\00"
@.str.1 = [2 x i8] c"1\00"
@.str.2 = [2 x i8] c"a\00"
@.str.3 = [3 x i8] c"1a\00"
@.str.4 = [3 x i8] c"a1\00"
@.str.5 = [1 x i8] zeroinitializer
@.str.6 = [3 x i8] c"0 \00"
@.str.7 = [3 x i8] c" 0\00"
@.str.8 = [4 x i8] c" 0 \00"
@.str.9 = [4 x i8] c" \00"
@.str.10 = [5 x i8] c" 0 a\00"
@.str.11 = [7 x i8] c"a 123 \00"
@.str.12 = [8 x i8] c" 123 a\00"
@.str.13 = [8 x i8] c"\09 123 a\00"
@.str.14 = [8 x i8] c"\09 123 \00"
@.str.15 = [7 x i8] c"\09 123\09\00"
@.str.16 = [4 x i8] c"123\00"
@.str.17 = [6 x i8] c"0x123\00"
define void @str_to_uint_test() {
%1 = tail call i32 @str_to_uint(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i32 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i32 @str_to_uint(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i32 %5, 1
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = tail call i32 @str_to_uint(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%10 = icmp eq i32 %9, -1
%11 = zext i1 %10 to i32
%12 = tail call i32 @assert(i32 %11)
%13 = tail call i32 @str_to_uint(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%14 = icmp eq i32 %13, -1
%15 = zext i1 %14 to i32
%16 = tail call i32 @assert(i32 %15)
%17 = tail call i32 @str_to_uint(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%18 = icmp eq i32 %17, -1
%19 = zext i1 %18 to i32
%20 = tail call i32 @assert(i32 %19)
%21 = tail call i32 @str_to_uint(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0))
%22 = icmp eq i32 %21, -1
%23 = zext i1 %22 to i32
%24 = tail call i32 @assert(i32 %23)
%25 = tail call i32 @str_to_uint(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%26 = icmp eq i32 %25, 0
%27 = zext i1 %26 to i32
%28 = tail call i32 @assert(i32 %27)
%29 = tail call i32 @str_to_uint(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%30 = icmp eq i32 %29, 0
%31 = zext i1 %30 to i32
%32 = tail call i32 @assert(i32 %31)
%33 = tail call i32 @str_to_uint(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
%34 = icmp eq i32 %33, 0
%35 = zext i1 %34 to i32
%36 = tail call i32 @assert(i32 %35)
%37 = tail call i32 @str_to_uint(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
%38 = icmp eq i32 %37, -1
%39 = zext i1 %38 to i32
%40 = tail call i32 @assert(i32 %39)
%41 = tail call i32 @str_to_uint(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
%42 = icmp eq i32 %41, -1
%43 = zext i1 %42 to i32
%44 = tail call i32 @assert(i32 %43)
%45 = tail call i32 @str_to_uint(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0))
%46 = icmp eq i32 %45, -1
%47 = zext i1 %46 to i32
%48 = tail call i32 @assert(i32 %47)
%49 = tail call i32 @str_to_uint(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0))
%50 = icmp eq i32 %49, -1
%51 = zext i1 %50 to i32
%52 = tail call i32 @assert(i32 %51)
%53 = tail call i32 @str_to_uint(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0))
%54 = icmp eq i32 %53, -1
%55 = zext i1 %54 to i32
%56 = tail call i32 @assert(i32 %55)
%57 = tail call i32 @str_to_uint(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0))
%58 = icmp eq i32 %57, 123
%59 = zext i1 %58 to i32
%60 = tail call i32 @assert(i32 %59)
%61 = tail call i32 @str_to_uint(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.15, i64 0, i64 0))
%62 = icmp eq i32 %61, 123
%63 = zext i1 %62 to i32
%64 = tail call i32 @assert(i32 %63)
%65 = tail call i32 @str_to_uint(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.16, i64 0, i64 0))
%66 = icmp eq i32 %65, 123
%67 = zext i1 %66 to i32
%68 = tail call i32 @assert(i32 %67)
%69 = tail call i32 @str_to_uint(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.17, i64 0, i64 0))
%70 = icmp eq i32 %69, -1
%71 = zext i1 %70 to i32
%72 = tail call i32 @assert(i32 %71)
ret void
}