#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 *, ...);
double strtod(char *, char **);
int main(int argc, char *argv[]) {
  double lval;
  char *ep, *tmp;
  char snum[] = " -2567.203, 45.00E-10, 39.023E9";
  printf("snum = '%s'\n", snum);
  tmp = snum;
  lval = strtod(tmp, &ep);
  printf("lval = %g, tmp = '%s', ep = '%s'\n", lval, tmp, ep);
  tmp = ++ep;
  lval = strtod(tmp, &ep);
  printf("lval = %g, tmp = '%s', ep = '%s'\n", lval, tmp, ep);
  tmp = ++ep;
  lval = strtod(tmp, &ep);
  printf("lval = %g, tmp = '%s', ep = '%s'\n", lval, tmp, ep);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xec3(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xec0(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xebd(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    -0x50(%rbp),%rsi
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x50(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <strtod@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
mov    -0x28(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    0xe8b(%rip),%rdi
mov    $0x1,%al
call   1040 <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
call   1030 <strtod@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
mov    -0x28(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    0xe4e(%rip),%rdi
mov    $0x1,%al
call   1040 <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
call   1030 <strtod@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
mov    -0x28(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    0xe11(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x30,%rsp
movaps 0xedc(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xec0(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0xed4(%rip),%rdi
lea    0x10(%rsp),%r12
mov    %r12,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%r14
mov    %r12,%rdi
mov    %r14,%rsi
call   1030 <strtod@plt>
mov    0x8(%rsp),%r13
lea    0xeb6(%rip),%r15
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x1,%r13
mov    %r13,0x8(%rsp)
mov    %r13,%rdi
mov    %r14,%rsi
call   1030 <strtod@plt>
mov    0x8(%rsp),%rbx
mov    %r15,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x1,%rbx
mov    %rbx,0x8(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strtod@plt>
mov    0x8(%rsp),%rdx
mov    %r15,%rdi
mov    %rbx,%rsi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.snum = [32 x i8] c" -2567.203, 45.00E-10, 39.023E9\00"
@.str = [13 x i8] c"snum = '%s'\0A\00"
@.str.1 = [34 x i8] c"lval = %g, tmp = '%s', ep = '%s'\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca [32 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = bitcast [32 x i8]* %9 to i8*
%11 = getelementptr inbounds [32 x i8], [32 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 [32 x i8], [32 x i8]* %9, i64 0, i64 0
store i8* %13, i8** %8
%14 = load i8*, i8** %8
%15 = call double @strtod(i8* %14, i8** %7)
store double %15, double* %6
%16 = load double, double* %6
%17 = load i8*, i8** %8
%18 = load i8*, i8** %7
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), double %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 double @strtod(i8* %22, i8** %7)
store double %23, double* %6
%24 = load double, double* %6
%25 = load i8*, i8** %8
%26 = load i8*, i8** %7
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), double %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 double @strtod(i8* %30, i8** %7)
store double %31, double* %6
%32 = load double, double* %6
%33 = load i8*, i8** %8
%34 = load i8*, i8** %7
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), double %32, i8* %33, i8* %34)
ret i32 0
}

LLVM IR (-O2):
@__const.main.snum = [32 x i8] c" -2567.203, 45.00E-10, 39.023E9\00"
@.str = [13 x i8] c"snum = '%s'\0A\00"
@.str.1 = [34 x i8] c"lval = %g, tmp = '%s', ep = '%s'\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i8*
%4 = alloca [32 x i8]
%5 = bitcast i8** %3 to i8*
%6 = getelementptr inbounds [32 x i8], [32 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 double @strtod(i8* %6, i8** %3)
%9 = load i8*, i8** %3
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), double %8, i8* %6, i8* %9)
%11 = getelementptr inbounds i8, i8* %9, i64 1
store i8* %11, i8** %3
%12 = call double @strtod(i8* %11, i8** %3)
%13 = load i8*, i8** %3
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), double %12, i8* %11, i8* %13)
%15 = getelementptr inbounds i8, i8* %13, i64 1
store i8* %15, i8** %3
%16 = call double @strtod(i8* %15, i8** %3)
%17 = load i8*, i8** %3
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), double %16, i8* %15, i8* %17)
ret i32 0
}