#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*/ test_string_strtoul(char *, int, int);
int /*<<< orphan*/ test_value_strtoul(unsigned long);
void test_strtoul(void) {
  int base, i;
  unsigned long value, valuenext;
  value = 0;
  for (i = 0; i < 0x10000; i++) {
    test_value_strtoul(value);
    test_value_strtoul(-value);
    value++;
  }
  value = 0;
  value = ((~value) << 1) >> 1;
  for (i = 0; i < 0x10000; i++) {
    test_value_strtoul(value);
    test_value_strtoul(-value);
    value++;
  }
  for (base = 2; base <= 36; base++) {
    value = 1;
    while (1) {
      for (i = -36; i <= 36; i++) {
        test_value_strtoul(value + i);
        test_value_strtoul(-value + i);
      }
      valuenext = value * base;
      if (valuenext <= value)
        break;
      value = valuenext;
    }
  }
  test_string_strtoul("10", 10, 0);
  test_string_strtoul("010", 010, 0);
  test_string_strtoul("010", 010, 8);
  test_string_strtoul("0x10", 0x10, 0);
  test_string_strtoul("0X10", 0X10, 0);
  test_string_strtoul("0x10", 0x10, 16);
  test_string_strtoul("0X10", 0X10, 16);
  test_string_strtoul("10", 10, 10);
  test_string_strtoul("010", 10, 10);
  test_string_strtoul("0010", 10, 10);
  test_string_strtoul(" 10", 10, 10);
  test_string_strtoul(" 010", 10, 10);
  test_string_strtoul(" 0010", 10, 10);
  test_string_strtoul("\t10", 10, 10);
  test_string_strtoul("\t010", 10, 10);
  test_string_strtoul("\t0010", 10, 10);
  test_string_strtoul(" \t10", 10, 10);
  test_string_strtoul(" \t010", 10, 10);
  test_string_strtoul(" \t0010", 10, 10);
  test_string_strtoul("+10", 10, 10);
  test_string_strtoul("+010", 10, 10);
  test_string_strtoul("+0010", 10, 10);
  test_string_strtoul(" +10", 10, 10);
  test_string_strtoul(" +010", 10, 10);
  test_string_strtoul(" +0010", 10, 10);
  test_string_strtoul("\t+10", 10, 10);
  test_string_strtoul("\t+010", 10, 10);
  test_string_strtoul("\t+0010", 10, 10);
  test_string_strtoul(" \t+10", 10, 10);
  test_string_strtoul(" \t+010", 10, 10);
  test_string_strtoul(" \t+0010", 10, 10);
}


x86 assembly (clang, -O0):
<test_strtoul>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movq   $0x0,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x10000,-0x8(%rbp)
jge    1174 <test_strtoul+0x54>
mov    -0x10(%rbp),%rdi
call   1040 <test_value_strtoul@plt>
xor    %eax,%eax
mov    %eax,%edi
sub    -0x10(%rbp),%rdi
call   1040 <test_value_strtoul@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1137 <test_strtoul+0x17>
movq   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%rax
xor    $0xffffffffffffffff,%rax
shl    $0x1,%rax
shr    $0x1,%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x10000,-0x8(%rbp)
jge    11d4 <test_strtoul+0xb4>
mov    -0x10(%rbp),%rdi
call   1040 <test_value_strtoul@plt>
xor    %eax,%eax
mov    %eax,%edi
sub    -0x10(%rbp),%rdi
call   1040 <test_value_strtoul@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1197 <test_strtoul+0x77>
movl   $0x2,-0x4(%rbp)
cmpl   $0x24,-0x4(%rbp)
jg     1273 <test_strtoul+0x153>
movq   $0x1,-0x10(%rbp)
movl   $0xffffffdc,-0x8(%rbp)
cmpl   $0x24,-0x8(%rbp)
jg     1230 <test_strtoul+0x110>
mov    -0x10(%rbp),%rdi
movslq -0x8(%rbp),%rax
add    %rax,%rdi
call   1040 <test_value_strtoul@plt>
xor    %eax,%eax
mov    %eax,%edi
sub    -0x10(%rbp),%rdi
movslq -0x8(%rbp),%rax
add    %rax,%rdi
call   1040 <test_value_strtoul@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11f4 <test_strtoul+0xd4>
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
imul   %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
ja     1253 <test_strtoul+0x133>
jmp    1260 <test_strtoul+0x140>
mov    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    11ed <test_strtoul+0xcd>
jmp    1265 <test_strtoul+0x145>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    11db <test_strtoul+0xbb>
lea    0xda1(%rip),%rdi
mov    $0xa,%esi
xor    %edx,%edx
call   1030 <test_string_strtoul@plt>
lea    0xd93(%rip),%rdi
mov    $0x8,%esi
xor    %edx,%edx
call   1030 <test_string_strtoul@plt>
lea    0xd80(%rip),%rdi
mov    $0x8,%edx
mov    %edx,%esi
call   1030 <test_string_strtoul@plt>
lea    0xd4d(%rip),%rdi
mov    $0x10,%esi
xor    %edx,%edx
call   1030 <test_string_strtoul@plt>
lea    0xd3f(%rip),%rdi
mov    $0x10,%esi
xor    %edx,%edx
call   1030 <test_string_strtoul@plt>
lea    0xd27(%rip),%rdi
mov    $0x10,%edx
mov    %edx,%esi
call   1030 <test_string_strtoul@plt>
lea    0xd19(%rip),%rdi
mov    $0x10,%edx
mov    %edx,%esi
call   1030 <test_string_strtoul@plt>
lea    0xd1c(%rip),%rdi
mov    $0xa,%edx
mov    %edx,%esi
call   1030 <test_string_strtoul@plt>
lea    0xd0e(%rip),%rdi
mov    $0xa,%edx
mov    %edx,%esi
call   1030 <test_string_strtoul@plt>
lea    0xd01(%rip),%rdi
mov    $0xa,%edx
mov    %edx,%esi
call   1030 <test_string_strtoul@plt>
lea    0xcd2(%rip),%rdi
mov    $0xa,%edx
mov    %edx,%esi
call   1030 <test_string_strtoul@plt>
lea    0xcc3(%rip),%rdi
mov    $0xa,%edx
mov    %edx,%esi
call   1030 <test_string_strtoul@plt>
lea    0xcb5(%rip),%rdi
mov    $0xa,%edx
mov    %edx,%esi
call   1030 <test_string_strtoul@plt>
lea    0xca9(%rip),%rdi
mov    $0xa,%edx
mov    %edx,%esi
call   1030 <test_string_strtoul@plt>
lea    0xc9b(%rip),%rdi
mov    $0xa,%edx
mov    %edx,%esi
call   1030 <test_string_strtoul@plt>
lea    0xc8e(%rip),%rdi
mov    $0xa,%edx
mov    %edx,%esi
call   1030 <test_string_strtoul@plt>
lea    0xc6f(%rip),%rdi
mov    $0xa,%edx
mov    %edx,%esi
call   1030 <test_string_strtoul@plt>
lea    0xc61(%rip),%rdi
mov    $0xa,%edx
mov    %edx,%esi
call   1030 <test_string_strtoul@plt>
lea    0xc54(%rip),%rdi
mov    $0xa,%edx
mov    %edx,%esi
call   1030 <test_string_strtoul@plt>
lea    0xc5c(%rip),%rdi
mov    $0xa,%edx
mov    %edx,%esi
call   1030 <test_string_strtoul@plt>
lea    0xc4f(%rip),%rdi
mov    $0xa,%edx
mov    %edx,%esi
call   1030 <test_string_strtoul@plt>
lea    0xc43(%rip),%rdi
mov    $0xa,%edx
mov    %edx,%esi
call   1030 <test_string_strtoul@plt>
lea    0xc0f(%rip),%rdi
mov    $0xa,%edx
mov    %edx,%esi
call   1030 <test_string_strtoul@plt>
lea    0xc01(%rip),%rdi
mov    $0xa,%edx
mov    %edx,%esi
call   1030 <test_string_strtoul@plt>
lea    0xbf4(%rip),%rdi
mov    $0xa,%edx
mov    %edx,%esi
call   1030 <test_string_strtoul@plt>
lea    0xbe9(%rip),%rdi
mov    $0xa,%edx
mov    %edx,%esi
call   1030 <test_string_strtoul@plt>
lea    0xbdc(%rip),%rdi
mov    $0xa,%edx
mov    %edx,%esi
call   1030 <test_string_strtoul@plt>
lea    0xbd0(%rip),%rdi
mov    $0xa,%edx
mov    %edx,%esi
call   1030 <test_string_strtoul@plt>
lea    0xbaf(%rip),%rdi
mov    $0xa,%edx
mov    %edx,%esi
call   1030 <test_string_strtoul@plt>
lea    0xba2(%rip),%rdi
mov    $0xa,%edx
mov    %edx,%esi
call   1030 <test_string_strtoul@plt>
lea    0xb96(%rip),%rdi
mov    $0xa,%edx
mov    %edx,%esi
call   1030 <test_string_strtoul@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_strtoul>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
xor    %r14d,%r14d
xor    %ebx,%ebx
nopl   (%rax)
mov    %rbx,%rdi
call   1040 <test_value_strtoul@plt>
mov    %r14,%rdi
call   1040 <test_value_strtoul@plt>
add    $0x1,%rbx
add    $0xffffffffffffffff,%r14
cmp    $0x10000,%rbx
jne    1130 <test_strtoul+0x10>
movabs $0x7fffffffffffffff,%r14
ff ff 7f
xor    %ebx,%ebx
mov    %r14,%r15
mov    %r15,%rdi
call   1040 <test_value_strtoul@plt>
lea    (%r14,%rbx,1),%rdi
add    $0x2,%rdi
call   1040 <test_value_strtoul@plt>
add    $0x1,%r15
add    $0xffffffffffffffff,%rbx
cmp    $0xffffffffffff0000,%rbx
jne    1160 <test_strtoul+0x40>
mov    $0x2,%r14d
nopl   0x0(%rax)
mov    $0x1,%r15d
cs nopw 0x0(%rax,%rax,1)
mov    %r15,%r12
neg    %r12
mov    $0xffffffffffffffdc,%rbx
nopl   (%rax)
lea    (%r15,%rbx,1),%rdi
call   1040 <test_value_strtoul@plt>
lea    (%r12,%rbx,1),%rdi
call   1040 <test_value_strtoul@plt>
add    $0x1,%rbx
cmp    $0x25,%rbx
jne    11b0 <test_strtoul+0x90>
mov    %r15,%rax
imul   %r14,%rax
cmp    %r15,%rax
mov    %rax,%r15
ja     11a0 <test_strtoul+0x80>
add    $0x1,%r14
cmp    $0x25,%r14
jne    1190 <test_strtoul+0x70>
lea    0xe2f(%rip),%r14
mov    %r14,%rdi
mov    $0xa,%esi
xor    %edx,%edx
call   1030 <test_string_strtoul@plt>
lea    0xe1e(%rip),%r15
mov    %r15,%rdi
mov    $0x8,%esi
xor    %edx,%edx
call   1030 <test_string_strtoul@plt>
mov    %r15,%rdi
mov    $0x8,%esi
mov    $0x8,%edx
call   1030 <test_string_strtoul@plt>
lea    0xdd6(%rip),%r12
mov    %r12,%rdi
mov    $0x10,%esi
xor    %edx,%edx
call   1030 <test_string_strtoul@plt>
lea    0xdc5(%rip),%rbx
mov    %rbx,%rdi
mov    $0x10,%esi
xor    %edx,%edx
call   1030 <test_string_strtoul@plt>
mov    %r12,%rdi
mov    $0x10,%esi
mov    $0x10,%edx
call   1030 <test_string_strtoul@plt>
mov    %rbx,%rdi
mov    $0x10,%esi
mov    $0x10,%edx
call   1030 <test_string_strtoul@plt>
mov    %r14,%rdi
mov    $0xa,%esi
mov    $0xa,%edx
call   1030 <test_string_strtoul@plt>
mov    %r15,%rdi
mov    $0xa,%esi
mov    $0xa,%edx
call   1030 <test_string_strtoul@plt>
lea    0xd88(%rip),%rdi
mov    $0xa,%esi
mov    $0xa,%edx
call   1030 <test_string_strtoul@plt>
lea    0xd56(%rip),%rdi
mov    $0xa,%esi
mov    $0xa,%edx
call   1030 <test_string_strtoul@plt>
lea    0xd44(%rip),%rdi
mov    $0xa,%esi
mov    $0xa,%edx
call   1030 <test_string_strtoul@plt>
lea    0xd33(%rip),%rdi
mov    $0xa,%esi
mov    $0xa,%edx
call   1030 <test_string_strtoul@plt>
lea    0xd24(%rip),%rdi
mov    $0xa,%esi
mov    $0xa,%edx
call   1030 <test_string_strtoul@plt>
lea    0xd13(%rip),%rdi
mov    $0xa,%esi
mov    $0xa,%edx
call   1030 <test_string_strtoul@plt>
lea    0xd03(%rip),%rdi
mov    $0xa,%esi
mov    $0xa,%edx
call   1030 <test_string_strtoul@plt>
lea    0xce1(%rip),%rdi
mov    $0xa,%esi
mov    $0xa,%edx
call   1030 <test_string_strtoul@plt>
lea    0xcd0(%rip),%rdi
mov    $0xa,%esi
mov    $0xa,%edx
call   1030 <test_string_strtoul@plt>
lea    0xcc0(%rip),%rdi
mov    $0xa,%esi
mov    $0xa,%edx
call   1030 <test_string_strtoul@plt>
lea    0xcc5(%rip),%rdi
mov    $0xa,%esi
mov    $0xa,%edx
call   1030 <test_string_strtoul@plt>
lea    0xcb5(%rip),%rdi
mov    $0xa,%esi
mov    $0xa,%edx
call   1030 <test_string_strtoul@plt>
lea    0xca6(%rip),%rdi
mov    $0xa,%esi
mov    $0xa,%edx
call   1030 <test_string_strtoul@plt>
lea    0xc6f(%rip),%rdi
mov    $0xa,%esi
mov    $0xa,%edx
call   1030 <test_string_strtoul@plt>
lea    0xc5e(%rip),%rdi
mov    $0xa,%esi
mov    $0xa,%edx
call   1030 <test_string_strtoul@plt>
lea    0xc4e(%rip),%rdi
mov    $0xa,%esi
mov    $0xa,%edx
call   1030 <test_string_strtoul@plt>
lea    0xc40(%rip),%rdi
mov    $0xa,%esi
mov    $0xa,%edx
call   1030 <test_string_strtoul@plt>
lea    0xc30(%rip),%rdi
mov    $0xa,%esi
mov    $0xa,%edx
call   1030 <test_string_strtoul@plt>
lea    0xc21(%rip),%rdi
mov    $0xa,%esi
mov    $0xa,%edx
call   1030 <test_string_strtoul@plt>
lea    0xbfd(%rip),%rdi
mov    $0xa,%esi
mov    $0xa,%edx
call   1030 <test_string_strtoul@plt>
lea    0xbed(%rip),%rdi
mov    $0xa,%esi
mov    $0xa,%edx
call   1030 <test_string_strtoul@plt>
lea    0xbde(%rip),%rdi
mov    $0xa,%esi
mov    $0xa,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <test_string_strtoul@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"10\00"
@.str.1 = [4 x i8] c"010\00"
@.str.2 = [5 x i8] c"0x10\00"
@.str.3 = [5 x i8] c"0X10\00"
@.str.4 = [5 x i8] c"0010\00"
@.str.5 = [4 x i8] c" 10\00"
@.str.6 = [5 x i8] c" 010\00"
@.str.7 = [6 x i8] c" 0010\00"
@.str.8 = [4 x i8] c"\0910\00"
@.str.9 = [5 x i8] c"\09010\00"
@.str.10 = [6 x i8] c"\090010\00"
@.str.11 = [5 x i8] c" \0910\00"
@.str.12 = [6 x i8] c" \09010\00"
@.str.13 = [7 x i8] c" \090010\00"
@.str.14 = [4 x i8] c"+10\00"
@.str.15 = [5 x i8] c"+010\00"
@.str.16 = [6 x i8] c"+0010\00"
@.str.17 = [5 x i8] c" +10\00"
@.str.18 = [6 x i8] c" +010\00"
@.str.19 = [7 x i8] c" +0010\00"
@.str.20 = [5 x i8] c"\09+10\00"
@.str.21 = [6 x i8] c"\09+010\00"
@.str.22 = [7 x i8] c"\09+0010\00"
@.str.23 = [6 x i8] c" \09+10\00"
@.str.24 = [7 x i8] c" \09+010\00"
@.str.25 = [8 x i8] c" \09+0010\00"
define void @test_strtoul() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i64
%4 = alloca i64
store i64 0, i64* %3
store i32 0, i32* %2
br label %5
5: ; preds = %16, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 65536
br i1 %7, label %8, label %19
8: ; preds = %5
%9 = load i64, i64* %3
%10 = call i32 @test_value_strtoul(i64 %9)
%11 = load i64, i64* %3
%12 = sub i64 0, %11
%13 = call i32 @test_value_strtoul(i64 %12)
%14 = load i64, i64* %3
%15 = add i64 %14, 1
store i64 %15, i64* %3
br label %16
16: ; preds = %8
%17 = load i32, i32* %2
%18 = add nsw i32 %17, 1
store i32 %18, i32* %2
br label %5
19: ; preds = %5
store i64 0, i64* %3
%20 = load i64, i64* %3
%21 = xor i64 %20, -1
%22 = shl i64 %21, 1
%23 = lshr i64 %22, 1
store i64 %23, i64* %3
store i32 0, i32* %2
br label %24
24: ; preds = %35, %19
%25 = load i32, i32* %2
%26 = icmp slt i32 %25, 65536
br i1 %26, label %27, label %38
27: ; preds = %24
%28 = load i64, i64* %3
%29 = call i32 @test_value_strtoul(i64 %28)
%30 = load i64, i64* %3
%31 = sub i64 0, %30
%32 = call i32 @test_value_strtoul(i64 %31)
%33 = load i64, i64* %3
%34 = add i64 %33, 1
store i64 %34, i64* %3
br label %35
35: ; preds = %27
%36 = load i32, i32* %2
%37 = add nsw i32 %36, 1
store i32 %37, i32* %2
br label %24
38: ; preds = %24
store i32 2, i32* %1
br label %39
39: ; preds = %74, %38
%40 = load i32, i32* %1
%41 = icmp sle i32 %40, 36
br i1 %41, label %42, label %77
42: ; preds = %39
store i64 1, i64* %3
br label %43
43: ; preds = %42, %71
store i32 -36, i32* %2
br label %44
44: ; preds = %59, %43
%45 = load i32, i32* %2
%46 = icmp sle i32 %45, 36
br i1 %46, label %47, label %62
47: ; preds = %44
%48 = load i64, i64* %3
%49 = load i32, i32* %2
%50 = sext i32 %49 to i64
%51 = add i64 %48, %50
%52 = call i32 @test_value_strtoul(i64 %51)
%53 = load i64, i64* %3
%54 = sub i64 0, %53
%55 = load i32, i32* %2
%56 = sext i32 %55 to i64
%57 = add i64 %54, %56
%58 = call i32 @test_value_strtoul(i64 %57)
br label %59
59: ; preds = %47
%60 = load i32, i32* %2
%61 = add nsw i32 %60, 1
store i32 %61, i32* %2
br label %44
62: ; preds = %44
%63 = load i64, i64* %3
%64 = load i32, i32* %1
%65 = sext i32 %64 to i64
%66 = mul i64 %63, %65
store i64 %66, i64* %4
%67 = load i64, i64* %4
%68 = load i64, i64* %3
%69 = icmp ule i64 %67, %68
br i1 %69, label %70, label %71
70: ; preds = %62
br label %73
71: ; preds = %62
%72 = load i64, i64* %4
store i64 %72, i64* %3
br label %43
73: ; preds = %70
br label %74
74: ; preds = %73
%75 = load i32, i32* %1
%76 = add nsw i32 %75, 1
store i32 %76, i32* %1
br label %39
77: ; preds = %39
%78 = call i32 @test_string_strtoul(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 10, i32 0)
%79 = call i32 @test_string_strtoul(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 8, i32 0)
%80 = call i32 @test_string_strtoul(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 8, i32 8)
%81 = call i32 @test_string_strtoul(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 16, i32 0)
%82 = call i32 @test_string_strtoul(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 16, i32 0)
%83 = call i32 @test_string_strtoul(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 16, i32 16)
%84 = call i32 @test_string_strtoul(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 16, i32 16)
%85 = call i32 @test_string_strtoul(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 10, i32 10)
%86 = call i32 @test_string_strtoul(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 10, i32 10)
%87 = call i32 @test_string_strtoul(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 10, i32 10)
%88 = call i32 @test_string_strtoul(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 10, i32 10)
%89 = call i32 @test_string_strtoul(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 10, i32 10)
%90 = call i32 @test_string_strtoul(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32 10, i32 10)
%91 = call i32 @test_string_strtoul(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 10, i32 10)
%92 = call i32 @test_string_strtoul(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i32 10, i32 10)
%93 = call i32 @test_string_strtoul(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i32 10, i32 10)
%94 = call i32 @test_string_strtoul(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), i32 10, i32 10)
%95 = call i32 @test_string_strtoul(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0), i32 10, i32 10)
%96 = call i32 @test_string_strtoul(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.13, i64 0, i64 0), i32 10, i32 10)
%97 = call i32 @test_string_strtoul(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i64 0, i64 0), i32 10, i32 10)
%98 = call i32 @test_string_strtoul(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0), i32 10, i32 10)
%99 = call i32 @test_string_strtoul(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.16, i64 0, i64 0), i32 10, i32 10)
%100 = call i32 @test_string_strtoul(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.17, i64 0, i64 0), i32 10, i32 10)
%101 = call i32 @test_string_strtoul(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.18, i64 0, i64 0), i32 10, i32 10)
%102 = call i32 @test_string_strtoul(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.19, i64 0, i64 0), i32 10, i32 10)
%103 = call i32 @test_string_strtoul(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.20, i64 0, i64 0), i32 10, i32 10)
%104 = call i32 @test_string_strtoul(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.21, i64 0, i64 0), i32 10, i32 10)
%105 = call i32 @test_string_strtoul(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.22, i64 0, i64 0), i32 10, i32 10)
%106 = call i32 @test_string_strtoul(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.23, i64 0, i64 0), i32 10, i32 10)
%107 = call i32 @test_string_strtoul(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.24, i64 0, i64 0), i32 10, i32 10)
%108 = call i32 @test_string_strtoul(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.25, i64 0, i64 0), i32 10, i32 10)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"10\00"
@.str.1 = [4 x i8] c"010\00"
@.str.2 = [5 x i8] c"0x10\00"
@.str.3 = [5 x i8] c"0X10\00"
@.str.4 = [5 x i8] c"0010\00"
@.str.5 = [4 x i8] c" 10\00"
@.str.6 = [5 x i8] c" 010\00"
@.str.7 = [6 x i8] c" 0010\00"
@.str.8 = [4 x i8] c"\0910\00"
@.str.9 = [5 x i8] c"\09010\00"
@.str.10 = [6 x i8] c"\090010\00"
@.str.11 = [5 x i8] c" \0910\00"
@.str.12 = [6 x i8] c" \09010\00"
@.str.13 = [7 x i8] c" \090010\00"
@.str.14 = [4 x i8] c"+10\00"
@.str.15 = [5 x i8] c"+010\00"
@.str.16 = [6 x i8] c"+0010\00"
@.str.17 = [5 x i8] c" +10\00"
@.str.18 = [6 x i8] c" +010\00"
@.str.19 = [7 x i8] c" +0010\00"
@.str.20 = [5 x i8] c"\09+10\00"
@.str.21 = [6 x i8] c"\09+010\00"
@.str.22 = [7 x i8] c"\09+0010\00"
@.str.23 = [6 x i8] c" \09+10\00"
@.str.24 = [7 x i8] c" \09+010\00"
@.str.25 = [8 x i8] c" \09+0010\00"
define void @test_strtoul() {
br label %1
1: ; preds = %0, %1
%2 = phi i64 [ 0, %0 ], [ %6, %1 ]
%3 = tail call i32 @test_value_strtoul(i64 %2)
%4 = sub nsw i64 0, %2
%5 = tail call i32 @test_value_strtoul(i64 %4)
%6 = add nuw nsw i64 %2, 1
%7 = icmp eq i64 %6, 65536
br i1 %7, label %8, label %1
8: ; preds = %1, %8
%9 = phi i64 [ %13, %8 ], [ 9223372036854775807, %1 ]
%10 = tail call i32 @test_value_strtoul(i64 %9)
%11 = sub i64 0, %9
%12 = tail call i32 @test_value_strtoul(i64 %11)
%13 = add nuw i64 %9, 1
%14 = icmp eq i64 %13, -9223372036854710273
br i1 %14, label %15, label %8
15: ; preds = %8, %30
%16 = phi i64 [ %31, %30 ], [ 2, %8 ]
br label %17
17: ; preds = %15, %27
%18 = phi i64 [ %28, %27 ], [ 1, %15 ]
br label %19
19: ; preds = %17, %19
%20 = phi i64 [ -36, %17 ], [ %25, %19 ]
%21 = add i64 %18, %20
%22 = tail call i32 @test_value_strtoul(i64 %21)
%23 = sub i64 %20, %18
%24 = tail call i32 @test_value_strtoul(i64 %23)
%25 = add nsw i64 %20, 1
%26 = icmp eq i64 %25, 37
br i1 %26, label %27, label %19
27: ; preds = %19
%28 = mul i64 %18, %16
%29 = icmp ugt i64 %28, %18
br i1 %29, label %17, label %30
30: ; preds = %27
%31 = add nuw nsw i64 %16, 1
%32 = icmp eq i64 %31, 37
br i1 %32, label %33, label %15
33: ; preds = %30
%34 = tail call i32 @test_string_strtoul(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 10, i32 0)
%35 = tail call i32 @test_string_strtoul(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 8, i32 0)
%36 = tail call i32 @test_string_strtoul(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 8, i32 8)
%37 = tail call i32 @test_string_strtoul(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 16, i32 0)
%38 = tail call i32 @test_string_strtoul(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 16, i32 0)
%39 = tail call i32 @test_string_strtoul(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 16, i32 16)
%40 = tail call i32 @test_string_strtoul(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 16, i32 16)
%41 = tail call i32 @test_string_strtoul(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 10, i32 10)
%42 = tail call i32 @test_string_strtoul(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 10, i32 10)
%43 = tail call i32 @test_string_strtoul(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 10, i32 10)
%44 = tail call i32 @test_string_strtoul(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 10, i32 10)
%45 = tail call i32 @test_string_strtoul(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 10, i32 10)
%46 = tail call i32 @test_string_strtoul(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32 10, i32 10)
%47 = tail call i32 @test_string_strtoul(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 10, i32 10)
%48 = tail call i32 @test_string_strtoul(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i32 10, i32 10)
%49 = tail call i32 @test_string_strtoul(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i32 10, i32 10)
%50 = tail call i32 @test_string_strtoul(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), i32 10, i32 10)
%51 = tail call i32 @test_string_strtoul(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0), i32 10, i32 10)
%52 = tail call i32 @test_string_strtoul(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.13, i64 0, i64 0), i32 10, i32 10)
%53 = tail call i32 @test_string_strtoul(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i64 0, i64 0), i32 10, i32 10)
%54 = tail call i32 @test_string_strtoul(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0), i32 10, i32 10)
%55 = tail call i32 @test_string_strtoul(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.16, i64 0, i64 0), i32 10, i32 10)
%56 = tail call i32 @test_string_strtoul(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.17, i64 0, i64 0), i32 10, i32 10)
%57 = tail call i32 @test_string_strtoul(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.18, i64 0, i64 0), i32 10, i32 10)
%58 = tail call i32 @test_string_strtoul(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.19, i64 0, i64 0), i32 10, i32 10)
%59 = tail call i32 @test_string_strtoul(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.20, i64 0, i64 0), i32 10, i32 10)
%60 = tail call i32 @test_string_strtoul(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.21, i64 0, i64 0), i32 10, i32 10)
%61 = tail call i32 @test_string_strtoul(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.22, i64 0, i64 0), i32 10, i32 10)
%62 = tail call i32 @test_string_strtoul(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.23, i64 0, i64 0), i32 10, i32 10)
%63 = tail call i32 @test_string_strtoul(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.24, i64 0, i64 0), i32 10, i32 10)
%64 = tail call i32 @test_string_strtoul(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.25, i64 0, i64 0), i32 10, i32 10)
ret void
}