#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 */
typedef int /*<<< orphan*/ test_values;

/* Variables and functions */
int /*<<< orphan*/ check_error();
int /*<<< orphan*/ printf(char *, ...);
int strtol(char *, char **, int);
int /*<<< orphan*/ strtoll(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ strtoul(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ strtoull(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int main() {
  char *test_values[] = {
      "-9223372036854775809",
      "-9223372036854775808",
      "-9223372036854775807",
      "-2147483649",
      "-2147483648",
      "-2147483647",
      "-5",
      "-1",
      "0",
      "1",
      "5",
      "2147483646",
      "2147483647",
      "2147483648",
      "4294967294",
      "4294967295",
      "4294967296",
      "18446744073709551614",
      "18446744073709551615",
      "18446744073709551616",
  };
  for (int i = 0; i < sizeof(test_values) / sizeof(test_values[0]); i++) {
    printf("strtol(\"%s\") = %ld\n", test_values[i],
           strtol(test_values[i], 0, 0));
    check_error();
    printf("strtoll(\"%s\") = %lld\n", test_values[i],
           strtoll(test_values[i], 0, 0));
    check_error();
    printf("strtoul(\"%s\") = %lu\n", test_values[i],
           strtoul(test_values[i], 0, 0));
    check_error();
    printf("strtoull(\"%s\") = %llu\n", test_values[i],
           strtoull(test_values[i], 0, 0));
    check_error();
    printf("\n");
  }
  printf("strtol(\"0x12\", 0, 0) = %ld\n", strtol("0x12", 0, 0));
  printf("strtol(\"0x12\", 0, 10) = %ld\n", strtol("0x12", 0, 10));
  printf("strtol(\"012\", 0, 0) = %ld\n", strtol("012", 0, 0));
  printf("strtol(\"012\", 0, 10) = %ld\n", strtol("012", 0, 10));
  printf("strtol(\"0y12\", 0, 0) = %ld\n", strtol("0y12", 0, 0));
  printf("strtol(\"hello\", 0, 30) = %ld\n", strtol("hello", 0, 30));
  printf("strtol(\"hello\", 0, 10) = %ld\n", strtol("hello", 0, 10));
  printf("strtol(\"not-a-number\") = %ld\n", strtol("not-a-number", 0, 0));
  char str[] = "  0x12end";
  char *endptr;
  printf("strtol(\"  0x12end\") = %ld\n", strtol(str, &endptr, 0));
  printf("endptr - str = %d\n", endptr - str);
  check_error();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xb0(%rbp),%rdi
lea    0x2bf0(%rip),%rsi
mov    $0xa0,%edx
call   1070 <memcpy@plt>
movl   $0x0,-0xb4(%rbp)
movslq -0xb4(%rbp),%rax
cmp    $0x14,%rax
jae    1309 <main+0x199>
movslq -0xb4(%rbp),%rax
mov    -0xb0(%rbp,%rax,8),%rax
ff
mov    %rax,-0xe8(%rbp)
movslq -0xb4(%rbp),%rax
mov    -0xb0(%rbp,%rax,8),%rdi
ff
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1060 <strtol@plt>
mov    -0xe8(%rbp),%rsi
mov    %eax,%edx
lea    0xee1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1080 <check_error@plt>
movslq -0xb4(%rbp),%rax
mov    -0xb0(%rbp,%rax,8),%rax
ff
mov    %rax,-0xe0(%rbp)
movslq -0xb4(%rbp),%rax
mov    -0xb0(%rbp,%rax,8),%rdi
ff
xor    %edx,%edx
mov    %edx,%esi
call   1050 <strtoll@plt>
mov    -0xe0(%rbp),%rsi
mov    %eax,%edx
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1080 <check_error@plt>
movslq -0xb4(%rbp),%rax
mov    -0xb0(%rbp,%rax,8),%rax
ff
mov    %rax,-0xd8(%rbp)
movslq -0xb4(%rbp),%rax
mov    -0xb0(%rbp,%rax,8),%rdi
ff
xor    %edx,%edx
mov    %edx,%esi
call   1090 <strtoul@plt>
mov    -0xd8(%rbp),%rsi
mov    %eax,%edx
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1080 <check_error@plt>
movslq -0xb4(%rbp),%rax
mov    -0xb0(%rbp,%rax,8),%rax
ff
mov    %rax,-0xd0(%rbp)
movslq -0xb4(%rbp),%rax
mov    -0xb0(%rbp,%rax,8),%rdi
ff
xor    %edx,%edx
mov    %edx,%esi
call   1040 <strtoull@plt>
mov    -0xd0(%rbp),%rsi
mov    %eax,%edx
lea    0xe3c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1080 <check_error@plt>
lea    0xf7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    11a4 <main+0x34>
lea    0xe38(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1060 <strtol@plt>
mov    %eax,%esi
lea    0xe08(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe16(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1060 <strtol@plt>
mov    %eax,%esi
lea    0xe04(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe2e(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1060 <strtol@plt>
mov    %eax,%esi
lea    0xdff(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe0c(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1060 <strtol@plt>
mov    %eax,%esi
lea    0xdf9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe23(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1060 <strtol@plt>
mov    %eax,%esi
lea    0xdf3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe24(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x1e,%edx
call   1060 <strtol@plt>
mov    %eax,%esi
lea    0xdef(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdff(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1060 <strtol@plt>
mov    %eax,%esi
lea    0xdee(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe1c(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1060 <strtol@plt>
mov    %eax,%esi
lea    0xdea(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0xe07(%rip),%rax
mov    %rax,-0xbe(%rbp)
mov    0xe01(%rip),%ax
mov    %ax,-0xb6(%rbp)
lea    -0xbe(%rbp),%rdi
lea    -0xc8(%rbp),%rsi
xor    %edx,%edx
call   1060 <strtol@plt>
mov    %eax,%esi
lea    0xdde(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc8(%rbp),%rsi
lea    -0xbe(%rbp),%rax
sub    %rax,%rsi
lea    0xdda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1080 <check_error@plt>
xor    %eax,%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xf51(%rip),%r14
lea    0xf5e(%rip),%r15
lea    0xf6d(%rip),%r12
lea    0xf7b(%rip),%r13
xor    %ebp,%ebp
nopl   0x0(%rax)
lea    0x2bd9(%rip),%rax
mov    0x0(%rbp,%rax,1),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1070 <strtol@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1080 <check_error@plt>
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <strtoll@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1080 <check_error@plt>
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1090 <strtoul@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1080 <check_error@plt>
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1050 <strtoull@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1080 <check_error@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x8,%rbp
cmp    $0xa0,%rbp
jne    11a0 <main+0x30>
lea    0xed6(%rip),%rdi
mov    $0x12,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xedf(%rip),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1070 <strtol@plt>
lea    0xed1(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xede(%rip),%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xee6(%rip),%rdi
mov    $0xc,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf0b(%rip),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1070 <strtol@plt>
lea    0xedf(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xef0(%rip),%rdi
mov    $0xd82e02,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xefb(%rip),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1070 <strtol@plt>
lea    0xeee(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf1a(%rip),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1070 <strtol@plt>
lea    0xeec(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movabs $0x6e65323178302020,%rax
32 65 6e
mov    %rax,(%rsp)
movw   $0x64,0x8(%rsp)
mov    %rsp,%rbx
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
xor    %edx,%edx
call   1070 <strtol@plt>
lea    0xeea(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%rsi
sub    %rbx,%rsi
lea    0xeed(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1080 <check_error@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [21 x i8] c"-9223372036854775809\00"
@.str.1 = [21 x i8] c"-9223372036854775808\00"
@.str.2 = [21 x i8] c"-9223372036854775807\00"
@.str.3 = [12 x i8] c"-2147483649\00"
@.str.4 = [12 x i8] c"-2147483648\00"
@.str.5 = [12 x i8] c"-2147483647\00"
@.str.6 = [3 x i8] c"-5\00"
@.str.7 = [3 x i8] c"-1\00"
@.str.8 = [2 x i8] c"0\00"
@.str.9 = [2 x i8] c"1\00"
@.str.10 = [2 x i8] c"5\00"
@.str.11 = [11 x i8] c"2147483646\00"
@.str.12 = [11 x i8] c"2147483647\00"
@.str.13 = [11 x i8] c"2147483648\00"
@.str.14 = [11 x i8] c"4294967294\00"
@.str.15 = [11 x i8] c"4294967295\00"
@.str.16 = [11 x i8] c"4294967296\00"
@.str.17 = [21 x i8] c"18446744073709551614\00"
@.str.18 = [21 x i8] c"18446744073709551615\00"
@.str.19 = [21 x i8] c"18446744073709551616\00"
@__const.main.test_values = [20 x i8*] [i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.17, i32 0, i32 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.18, i32 0, i32 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.19, i32 0, i32 0)]
@.str.20 = [20 x i8] c"strtol(\22%s\22) = %ld\0A\00"
@.str.21 = [22 x i8] c"strtoll(\22%s\22) = %lld\0A\00"
@.str.22 = [21 x i8] c"strtoul(\22%s\22) = %lu\0A\00"
@.str.23 = [23 x i8] c"strtoull(\22%s\22) = %llu\0A\00"
@.str.24 = [2 x i8] c"\0A\00"
@.str.25 = [28 x i8] c"strtol(\220x12\22, 0, 0) = %ld\0A\00"
@.str.26 = [5 x i8] c"0x12\00"
@.str.27 = [29 x i8] c"strtol(\220x12\22, 0, 10) = %ld\0A\00"
@.str.28 = [27 x i8] c"strtol(\22012\22, 0, 0) = %ld\0A\00"
@.str.29 = [4 x i8] c"012\00"
@.str.30 = [28 x i8] c"strtol(\22012\22, 0, 10) = %ld\0A\00"
@.str.31 = [28 x i8] c"strtol(\220y12\22, 0, 0) = %ld\0A\00"
@.str.32 = [5 x i8] c"0y12\00"
@.str.33 = [30 x i8] c"strtol(\22hello\22, 0, 30) = %ld\0A\00"
@.str.34 = [6 x i8] c"hello\00"
@.str.35 = [30 x i8] c"strtol(\22hello\22, 0, 10) = %ld\0A\00"
@.str.36 = [30 x i8] c"strtol(\22not-a-number\22) = %ld\0A\00"
@.str.37 = [13 x i8] c"not-a-number\00"
@__const.main.str = [10 x i8] c" 0x12end\00"
@.str.38 = [27 x i8] c"strtol(\22 0x12end\22) = %ld\0A\00"
@.str.39 = [19 x i8] c"endptr - str = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x i8*]
%3 = alloca i32
%4 = alloca [10 x i8]
%5 = alloca i8*
store i32 0, i32* %1
%6 = bitcast [20 x i8*]* %2 to i8*
store i32 0, i32* %3
br label %7
7: ; preds = %57, %0
%8 = load i32, i32* %3
%9 = sext i32 %8 to i64
%10 = icmp ult i64 %9, 20
br i1 %10, label %11, label %60
11: ; preds = %7
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [20 x i8*], [20 x i8*]* %2, i64 0, i64 %13
%15 = load i8*, i8** %14
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [20 x i8*], [20 x i8*]* %2, i64 0, i64 %17
%19 = load i8*, i8** %18
%20 = call i32 @strtol(i8* %19, i8** null, i32 0)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.20, i64 0, i64 0), i8* %15, i32 %20)
%22 = call i32 (...) @check_error()
%23 = load i32, i32* %3
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [20 x i8*], [20 x i8*]* %2, i64 0, i64 %24
%26 = load i8*, i8** %25
%27 = load i32, i32* %3
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [20 x i8*], [20 x i8*]* %2, i64 0, i64 %28
%30 = load i8*, i8** %29
%31 = call i32 @strtoll(i8* %30, i32 0, i32 0)
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.21, i64 0, i64 0), i8* %26, i32 %31)
%33 = call i32 (...) @check_error()
%34 = load i32, i32* %3
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [20 x i8*], [20 x i8*]* %2, i64 0, i64 %35
%37 = load i8*, i8** %36
%38 = load i32, i32* %3
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [20 x i8*], [20 x i8*]* %2, i64 0, i64 %39
%41 = load i8*, i8** %40
%42 = call i32 @strtoul(i8* %41, i32 0, i32 0)
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.22, i64 0, i64 0), i8* %37, i32 %42)
%44 = call i32 (...) @check_error()
%45 = load i32, i32* %3
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [20 x i8*], [20 x i8*]* %2, i64 0, i64 %46
%48 = load i8*, i8** %47
%49 = load i32, i32* %3
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [20 x i8*], [20 x i8*]* %2, i64 0, i64 %50
%52 = load i8*, i8** %51
%53 = call i32 @strtoull(i8* %52, i32 0, i32 0)
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.23, i64 0, i64 0), i8* %48, i32 %53)
%55 = call i32 (...) @check_error()
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.24, i64 0, i64 0))
br label %57
57: ; preds = %11
%58 = load i32, i32* %3
%59 = add nsw i32 %58, 1
store i32 %59, i32* %3
br label %7
60: ; preds = %7
%61 = call i32 @strtol(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.26, i64 0, i64 0), i8** null, i32 0)
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.25, i64 0, i64 0), i32 %61)
%63 = call i32 @strtol(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.26, i64 0, i64 0), i8** null, i32 10)
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.27, i64 0, i64 0), i32 %63)
%65 = call i32 @strtol(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.29, i64 0, i64 0), i8** null, i32 0)
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.28, i64 0, i64 0), i32 %65)
%67 = call i32 @strtol(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.29, i64 0, i64 0), i8** null, i32 10)
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.30, i64 0, i64 0), i32 %67)
%69 = call i32 @strtol(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.32, i64 0, i64 0), i8** null, i32 0)
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.31, i64 0, i64 0), i32 %69)
%71 = call i32 @strtol(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.34, i64 0, i64 0), i8** null, i32 30)
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.33, i64 0, i64 0), i32 %71)
%73 = call i32 @strtol(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.34, i64 0, i64 0), i8** null, i32 10)
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.35, i64 0, i64 0), i32 %73)
%75 = call i32 @strtol(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.37, i64 0, i64 0), i8** null, i32 0)
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.36, i64 0, i64 0), i32 %75)
%77 = bitcast [10 x i8]* %4 to i8*
%78 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%79 = call i32 @strtol(i8* %78, i8** %5, i32 0)
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.38, i64 0, i64 0), i32 %79)
%81 = load i8*, i8** %5
%82 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%83 = ptrtoint i8* %81 to i64
%84 = ptrtoint i8* %82 to i64
%85 = sub i64 %83, %84
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.39, i64 0, i64 0), i64 %85)
%87 = call i32 (...) @check_error()
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"-9223372036854775809\00"
@.str.1 = [21 x i8] c"-9223372036854775808\00"
@.str.2 = [21 x i8] c"-9223372036854775807\00"
@.str.3 = [12 x i8] c"-2147483649\00"
@.str.4 = [12 x i8] c"-2147483648\00"
@.str.5 = [12 x i8] c"-2147483647\00"
@.str.6 = [3 x i8] c"-5\00"
@.str.7 = [3 x i8] c"-1\00"
@.str.8 = [2 x i8] c"0\00"
@.str.9 = [2 x i8] c"1\00"
@.str.10 = [2 x i8] c"5\00"
@.str.11 = [11 x i8] c"2147483646\00"
@.str.12 = [11 x i8] c"2147483647\00"
@.str.13 = [11 x i8] c"2147483648\00"
@.str.14 = [11 x i8] c"4294967294\00"
@.str.15 = [11 x i8] c"4294967295\00"
@.str.16 = [11 x i8] c"4294967296\00"
@.str.17 = [21 x i8] c"18446744073709551614\00"
@.str.18 = [21 x i8] c"18446744073709551615\00"
@.str.19 = [21 x i8] c"18446744073709551616\00"
@__const.main.test_values = [20 x i8*] [i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.17, i32 0, i32 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.18, i32 0, i32 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.19, i32 0, i32 0)]
@.str.20 = [20 x i8] c"strtol(\22%s\22) = %ld\0A\00"
@.str.21 = [22 x i8] c"strtoll(\22%s\22) = %lld\0A\00"
@.str.22 = [21 x i8] c"strtoul(\22%s\22) = %lu\0A\00"
@.str.23 = [23 x i8] c"strtoull(\22%s\22) = %llu\0A\00"
@.str.25 = [28 x i8] c"strtol(\220x12\22, 0, 0) = %ld\0A\00"
@.str.26 = [5 x i8] c"0x12\00"
@.str.27 = [29 x i8] c"strtol(\220x12\22, 0, 10) = %ld\0A\00"
@.str.28 = [27 x i8] c"strtol(\22012\22, 0, 0) = %ld\0A\00"
@.str.30 = [28 x i8] c"strtol(\22012\22, 0, 10) = %ld\0A\00"
@.str.31 = [28 x i8] c"strtol(\220y12\22, 0, 0) = %ld\0A\00"
@.str.32 = [5 x i8] c"0y12\00"
@.str.33 = [30 x i8] c"strtol(\22hello\22, 0, 30) = %ld\0A\00"
@.str.34 = [6 x i8] c"hello\00"
@.str.35 = [30 x i8] c"strtol(\22hello\22, 0, 10) = %ld\0A\00"
@.str.36 = [30 x i8] c"strtol(\22not-a-number\22) = %ld\0A\00"
@.str.37 = [13 x i8] c"not-a-number\00"
@__const.main.str = [10 x i8] c" 0x12end\00"
@.str.38 = [27 x i8] c"strtol(\22 0x12end\22) = %ld\0A\00"
@.str.39 = [19 x i8] c"endptr - str = %d\0A\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = alloca i8*
br label %26
3: ; preds = %26
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.25, i64 0, i64 0), i32 18)
%5 = tail call i32 @strtol(i8* nocapture getelementptr inbounds ([5 x i8], [5 x i8]* @.str.26, i64 0, i64 0), i8** null, i32 10)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.27, i64 0, i64 0), i32 %5)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.28, i64 0, i64 0), i32 10)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.30, i64 0, i64 0), i32 12)
%9 = tail call i32 @strtol(i8* nocapture getelementptr inbounds ([5 x i8], [5 x i8]* @.str.32, i64 0, i64 0), i8** null, i32 0)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.31, i64 0, i64 0), i32 %9)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.33, i64 0, i64 0), i32 14167554)
%12 = tail call i32 @strtol(i8* nocapture getelementptr inbounds ([6 x i8], [6 x i8]* @.str.34, i64 0, i64 0), i8** null, i32 10)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.35, i64 0, i64 0), i32 %12)
%14 = tail call i32 @strtol(i8* nocapture getelementptr inbounds ([13 x i8], [13 x i8]* @.str.37, i64 0, i64 0), i8** null, i32 0)
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.36, i64 0, i64 0), i32 %14)
%16 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%17 = bitcast i8** %2 to i8*
%18 = call i32 @strtol(i8* %16, i8** %2, i32 0)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.38, i64 0, i64 0), i32 %18)
%20 = load i8*, i8** %2
%21 = ptrtoint i8* %20 to i64
%22 = ptrtoint [10 x i8]* %1 to i64
%23 = sub i64 %21, %22
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.39, i64 0, i64 0), i64 %23)
%25 = call i32 (...) @check_error()
ret i32 0
26: ; preds = %0, %26
%27 = phi i64 [ 0, %0 ], [ %43, %26 ]
%28 = getelementptr inbounds [20 x i8*], [20 x i8*]* @__const.main.test_values, i64 0, i64 %27
%29 = load i8*, i8** %28
%30 = tail call i32 @strtol(i8* nocapture %29, i8** null, i32 0)
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.20, i64 0, i64 0), i8* %29, i32 %30)
%32 = tail call i32 (...) @check_error()
%33 = tail call i32 @strtoll(i8* %29, i32 0, i32 0)
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.21, i64 0, i64 0), i8* %29, i32 %33)
%35 = tail call i32 (...) @check_error()
%36 = tail call i32 @strtoul(i8* %29, i32 0, i32 0)
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.22, i64 0, i64 0), i8* %29, i32 %36)
%38 = tail call i32 (...) @check_error()
%39 = tail call i32 @strtoull(i8* %29, i32 0, i32 0)
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.23, i64 0, i64 0), i8* %29, i32 %39)
%41 = tail call i32 (...) @check_error()
%42 = tail call i32 @putchar(i32 10)
%43 = add nuw nsw i64 %27, 1
%44 = icmp eq i64 %43, 20
br i1 %44, label %3, label %26
}