#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*/ printf(char *, ...);
long strtol(char *, char **, int);
int main(int argc, char *argv[]) {
  long lval;
  char *ep, *tmp;
  char snum[] = " -2567, 45, 39";
  printf("snum = '%s'\n", snum);
  tmp = snum;
  lval = strtol(tmp, &ep, 10);
  printf("lval = %ld, tmp = '%s', ep = '%s'\n", lval, tmp, ep);
  tmp = ++ep;
  lval = strtol(tmp, &ep, 10);
  printf("lval = %ld, tmp = '%s', ep = '%s'\n", lval, tmp, ep);
  tmp = ++ep;
  lval = strtol(tmp, &ep, 10);
  printf("lval = %ld, tmp = '%s', ep = '%s'\n", lval, tmp, ep);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xec3(%rip),%rax
mov    %rax,-0x37(%rbp)
mov    0xec1(%rip),%eax
mov    %eax,-0x2f(%rbp)
mov    0xebb(%rip),%ax
mov    %ax,-0x2b(%rbp)
mov    0xeb3(%rip),%al
mov    %al,-0x29(%rbp)
lea    -0x37(%rbp),%rsi
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x37(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
lea    -0x20(%rbp),%rsi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
lea    -0x20(%rbp),%rsi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xe3b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
lea    -0x20(%rbp),%rsi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xdfb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x20,%rsp
movabs $0x3933202c353420,%rax
mov    %rax,0x17(%rsp)
movabs $0x202c373635322d20,%rax
37 2c 20
mov    %rax,0x10(%rsp)
lea    0xebd(%rip),%rdi
lea    0x10(%rsp),%r12
mov    %r12,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x8(%rsp),%r14
mov    %r12,%rdi
mov    %r14,%rsi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    0x8(%rsp),%r13
lea    0xe9a(%rip),%r15
mov    %r15,%rdi
mov    %rax,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%r13
mov    %r13,0x8(%rsp)
mov    %r13,%rdi
mov    %r14,%rsi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    0x8(%rsp),%rbx
mov    %r15,%rdi
mov    %rax,%rsi
mov    %r13,%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%rbx
mov    %rbx,0x8(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    0x8(%rsp),%rcx
mov    %r15,%rdi
mov    %rax,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.snum = [15 x i8] c" -2567, 45, 39\00"
@.str = [13 x i8] c"snum = '%s'\0A\00"
@.str.1 = [35 x i8] c"lval = %ld, tmp = '%s', ep = '%s'\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca [15 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = bitcast [15 x i8]* %9 to i8*
%11 = getelementptr inbounds [15 x i8], [15 x i8]* %9, i64 0, i64 0
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = getelementptr inbounds [15 x i8], [15 x i8]* %9, i64 0, i64 0
store i8* %13, i8** %8
%14 = load i8*, i8** %8
%15 = call i64 @strtol(i8* %14, i8** %7, i32 10)
store i64 %15, i64* %6
%16 = load i64, i64* %6
%17 = load i8*, i8** %8
%18 = load i8*, i8** %7
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i64 %16, i8* %17, i8* %18)
%20 = load i8*, i8** %7
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %7
store i8* %21, i8** %8
%22 = load i8*, i8** %8
%23 = call i64 @strtol(i8* %22, i8** %7, i32 10)
store i64 %23, i64* %6
%24 = load i64, i64* %6
%25 = load i8*, i8** %8
%26 = load i8*, i8** %7
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i64 %24, i8* %25, i8* %26)
%28 = load i8*, i8** %7
%29 = getelementptr inbounds i8, i8* %28, i32 1
store i8* %29, i8** %7
store i8* %29, i8** %8
%30 = load i8*, i8** %8
%31 = call i64 @strtol(i8* %30, i8** %7, i32 10)
store i64 %31, i64* %6
%32 = load i64, i64* %6
%33 = load i8*, i8** %8
%34 = load i8*, i8** %7
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i64 %32, i8* %33, i8* %34)
ret i32 0
}

LLVM IR (-O2):
@__const.main.snum = [15 x i8] c" -2567, 45, 39\00"
@.str = [13 x i8] c"snum = '%s'\0A\00"
@.str.1 = [35 x i8] c"lval = %ld, tmp = '%s', ep = '%s'\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i8*
%4 = alloca [15 x i8]
%5 = bitcast i8** %3 to i8*
%6 = getelementptr inbounds [15 x i8], [15 x i8]* %4, i64 0, i64 0
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = call i64 @strtol(i8* %6, i8** %3, i32 10)
%9 = load i8*, i8** %3
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i64 %8, i8* %6, i8* %9)
%11 = getelementptr inbounds i8, i8* %9, i64 1
store i8* %11, i8** %3
%12 = call i64 @strtol(i8* %11, i8** %3, i32 10)
%13 = load i8*, i8** %3
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i64 %12, i8* %11, i8* %13)
%15 = getelementptr inbounds i8, i8* %13, i64 1
store i8* %15, i8** %3
%16 = call i64 @strtol(i8* %15, i8** %3, i32 10)
%17 = load i8*, i8** %3
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i64 %16, i8* %15, i8* %17)
ret i32 0
}