#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*/ atol(char const *);
int /*<<< orphan*/ printf(char *, char const *, int /*<<< orphan*/);
int main() {
  const char *pNum[] = {"-10",   "0",    "10",    "a100", "100a",
                        "-100a", " 12f", "15.3x", NULL};
  int i = 0;
  for (i = 0; pNum[i] != NULL; i++) {
    printf("[%s] = [%ld]\n", pNum[i], atol(pNum[i]));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x50(%rbp),%rdi
lea    0x2c86(%rip),%rsi
mov    $0x48,%edx
call   1040 <memcpy@plt>
movl   $0x0,-0x54(%rbp)
movl   $0x0,-0x54(%rbp)
movslq -0x54(%rbp),%rax
cmpq   $0x0,-0x50(%rbp,%rax,8)
je     11ad <main+0x7d>
movslq -0x54(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rax
mov    %rax,-0x60(%rbp)
movslq -0x54(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rdi
call   1050 <atol@plt>
mov    -0x60(%rbp),%rsi
mov    %eax,%edx
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1162 <main+0x32>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xeef(%rip),%r14
lea    0xece(%rip),%rsi
mov    %r14,%rdi
mov    $0xfffffff6,%edx
call   1030 <printf@plt>
lea    0xec1(%rip),%rsi
mov    %r14,%rdi
xor    %edx,%edx
call   1030 <printf@plt>
lea    0xeaa(%rip),%rsi
mov    %r14,%rdi
mov    $0xa,%edx
call   1030 <printf@plt>
lea    0xe99(%rip),%rbx
mov    %rbx,%rdi
call   1040 <atol@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <printf@plt>
lea    0xe83(%rip),%rbx
mov    %rbx,%rdi
call   1040 <atol@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <printf@plt>
lea    0xe66(%rip),%rbx
mov    %rbx,%rdi
call   1040 <atol@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <printf@plt>
lea    0xe50(%rip),%rbx
mov    %rbx,%rdi
call   1040 <atol@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <printf@plt>
lea    0xe39(%rip),%rbx
mov    %rbx,%rdi
call   1040 <atol@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"-10\00"
@.str.1 = [2 x i8] c"0\00"
@.str.2 = [3 x i8] c"10\00"
@.str.3 = [5 x i8] c"a100\00"
@.str.4 = [5 x i8] c"100a\00"
@.str.5 = [6 x i8] c"-100a\00"
@.str.6 = [5 x i8] c" 12f\00"
@.str.7 = [6 x i8] c"15.3x\00"
@__const.main.pNum = [9 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i32 0, i32 0), i8* null]
@.str.8 = [14 x i8] c"[%s] = [%ld]\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [9 x i8*]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [9 x i8*]* %2 to i8*
store i32 0, i32* %3
store i32 0, i32* %3
br label %5
5: ; preds = %22, %0
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds [9 x i8*], [9 x i8*]* %2, i64 0, i64 %7
%9 = load i8*, i8** %8
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %25
11: ; preds = %5
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [9 x i8*], [9 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 [9 x i8*], [9 x i8*]* %2, i64 0, i64 %17
%19 = load i8*, i8** %18
%20 = call i32 @atol(i8* %19)
%21 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i8* %15, i32 %20)
br label %22
22: ; preds = %11
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 1
store i32 %24, i32* %3
br label %5
25: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"-10\00"
@.str.1 = [2 x i8] c"0\00"
@.str.2 = [3 x i8] c"10\00"
@.str.3 = [5 x i8] c"a100\00"
@.str.4 = [5 x i8] c"100a\00"
@.str.5 = [6 x i8] c"-100a\00"
@.str.6 = [5 x i8] c" 12f\00"
@.str.7 = [6 x i8] c"15.3x\00"
@.str.8 = [14 x i8] c"[%s] = [%ld]\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 -10)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 0)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 10)
%4 = tail call i32 @atol(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%5 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %4)
%6 = tail call i32 @atol(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%7 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 %6)
%8 = tail call i32 @atol(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%9 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %8)
%10 = tail call i32 @atol(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%11 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %10)
%12 = tail call i32 @atol(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%13 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32 %12)
ret i32 0
}