#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 *, char *);
char *strtod(char *, char **);
int main() {
  char *endptr;
  char a[] = "12345.6789";
  char b[] = "1234.567qwer";
  char c[] = "-232.23e4";
  printf("a=%lf\n", strtod(a, NULL));
  printf("b=%lf\n", strtod(b, &endptr));
  printf("endptr=%s\n", endptr);
  printf("c=%lf\n", strtod(c, NULL));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x13(%rbp)
mov    0xece(%rip),%ax
mov    %ax,-0xb(%rbp)
mov    0xec6(%rip),%al
mov    %al,-0x9(%rbp)
mov    0xebd(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xebb(%rip),%eax
mov    %eax,-0x18(%rbp)
mov    0xeb6(%rip),%al
mov    %al,-0x14(%rbp)
mov    0xead(%rip),%rax
mov    %rax,-0x2a(%rbp)
mov    0xeaa(%rip),%ax
mov    %ax,-0x22(%rbp)
lea    -0x13(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <strtod@plt>
mov    %rax,%rsi
lea    0xe91(%rip),%rdi
call   1040 <printf@plt>
lea    -0x20(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <strtod@plt>
mov    %rax,%rsi
lea    0xe7c(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xe73(%rip),%rdi
call   1040 <printf@plt>
lea    -0x2a(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <strtod@plt>
mov    %rax,%rsi
lea    0xe62(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x38,%rsp
movabs $0x37362e3534333231,%rax
2e 36 37
mov    %rax,0x10(%rsp)
movl   $0x393837,0x17(%rsp)
movabs $0x72657771373635,%rax
mov    %rax,0x2d(%rsp)
movabs $0x3736352e34333231,%rax
35 36 37
mov    %rax,0x28(%rsp)
movabs $0x6533322e3233322d,%rax
32 33 65
mov    %rax,(%rsp)
movw   $0x34,0x8(%rsp)
lea    0x10(%rsp),%rdi
xor    %esi,%esi
call   1030 <strtod@plt>
lea    0xea1(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
lea    0x28(%rsp),%rdi
lea    0x20(%rsp),%rsi
call   1030 <strtod@plt>
lea    0xe8a(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    0x20(%rsp),%rsi
lea    0xe7d(%rip),%rdi
call   1040 <printf@plt>
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <strtod@plt>
lea    0xe72(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
ret

LLVM IR (-O0):
@__const.main.a = [11 x i8] c"12345.6789\00"
@__const.main.b = [13 x i8] c"1234.567qwer\00"
@__const.main.c = [10 x i8] c"-232.23e4\00"
@.str = [7 x i8] c"a=%lf\0A\00"
@.str.1 = [7 x i8] c"b=%lf\0A\00"
@.str.2 = [11 x i8] c"endptr=%s\0A\00"
@.str.3 = [7 x i8] c"c=%lf\0A\00"
define i32 @main() {
%1 = alloca i8*
%2 = alloca [11 x i8]
%3 = alloca [13 x i8]
%4 = alloca [10 x i8]
%5 = bitcast [11 x i8]* %2 to i8*
%6 = bitcast [13 x i8]* %3 to i8*
%7 = bitcast [10 x i8]* %4 to i8*
%8 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 0
%9 = call i8* @strtod(i8* %8, i8** null)
%10 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = getelementptr inbounds [13 x i8], [13 x i8]* %3, i64 0, i64 0
%12 = call i8* @strtod(i8* %11, i8** %1)
%13 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%14 = load i8*, i8** %1
%15 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %14)
%16 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%17 = call i8* @strtod(i8* %16, i8** null)
%18 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %17)
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [11 x i8] c"12345.6789\00"
@__const.main.b = [13 x i8] c"1234.567qwer\00"
@__const.main.c = [10 x i8] c"-232.23e4\00"
@.str = [7 x i8] c"a=%lf\0A\00"
@.str.1 = [7 x i8] c"b=%lf\0A\00"
@.str.2 = [11 x i8] c"endptr=%s\0A\00"
@.str.3 = [7 x i8] c"c=%lf\0A\00"
define i32 @main() {
%1 = alloca i8*
%2 = alloca [11 x i8]
%3 = alloca [13 x i8]
%4 = alloca [10 x i8]
%5 = bitcast i8** %1 to i8*
%6 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [13 x i8], [13 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%9 = call i8* @strtod(i8* nocapture %6, i8** null)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = call i8* @strtod(i8* %7, i8** %1)
%12 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%13 = load i8*, i8** %1
%14 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %13)
%15 = call i8* @strtod(i8* nocapture %8, i8** null)
%16 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %15)
ret i32 0
}