#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 */
double CPLNan();
int /*<<< orphan*/ _GTIFFree(char *);
int /*<<< orphan*/ _ReplacePointByLocalePoint(char *, char);
int errno;
char *gtCPLStrdup(char const *);
scalar_t__ strcasecmp(char const *, char *);
double strtod(char *, char **);
double _StrtodDelim(const char *nptr, char **endptr, char point) {
  if ((strcasecmp(nptr, "nan") == 0) || (strcasecmp(nptr, "1.#QNAN") == 0) ||
      (strcasecmp(nptr, "-1.#QNAN") == 0) || (strcasecmp(nptr, "-1.#IND") == 0))
    return CPLNan();
  char *pszNumber = gtCPLStrdup(nptr);
  double dfValue;
  int nError;
  _ReplacePointByLocalePoint(pszNumber, point);
  dfValue = strtod(pszNumber, endptr);
  nError = errno;
  if (endptr)
    *endptr = (char *)nptr + (*endptr - pszNumber);
  {
    if (pszNumber != 0)
      _GTIFFree(pszNumber);
  };
  errno = nError;
  return dfValue;
}


x86 assembly (clang, -O0):
<_StrtodDelim>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %dl,%al
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %al,-0x19(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe80(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     11dd <_StrtodDelim+0x7d>
mov    -0x10(%rbp),%rdi
lea    0xe6b(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     11dd <_StrtodDelim+0x7d>
mov    -0x10(%rbp),%rdi
lea    0xe50(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     11dd <_StrtodDelim+0x7d>
mov    -0x10(%rbp),%rdi
lea    0xe3f(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    11ee <_StrtodDelim+0x8e>
mov    $0x0,%al
call   1060 <CPLNan@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    1277 <_StrtodDelim+0x117>
mov    -0x10(%rbp),%rdi
call   1050 <gtCPLStrdup@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
movsbl -0x19(%rbp),%esi
call   1070 <_ReplacePointByLocalePoint@plt>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strtod@plt>
movsd  %xmm0,-0x30(%rbp)
mov    0x2dbf(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     124d <_StrtodDelim+0xed>
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    -0x28(%rbp),%rdx
sub    %rdx,%rax
add    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
cmpq   $0x0,-0x28(%rbp)
je     1261 <_StrtodDelim+0x101>
mov    -0x28(%rbp),%rdi
call   1080 <_GTIFFree@plt>
mov    -0x34(%rbp),%ecx
mov    0x2d75(%rip),%rax
mov    %ecx,(%rax)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_StrtodDelim>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xe8a(%rip),%rsi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1226 <_StrtodDelim+0xc6>
lea    0xe7a(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1226 <_StrtodDelim+0xc6>
lea    0xe61(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1226 <_StrtodDelim+0xc6>
lea    0xe56(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1226 <_StrtodDelim+0xc6>
mov    %rbx,%rdi
call   1050 <gtCPLStrdup@plt>
mov    %rax,%r15
movsbl %bpl,%esi
mov    %rax,%rdi
call   1070 <_ReplacePointByLocalePoint@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <strtod@plt>
mov    0x2df3(%rip),%rbp
test   %r14,%r14
je     11fe <_StrtodDelim+0x9e>
mov    (%r14),%rax
sub    %r15,%rax
add    %rax,%rbx
mov    %rbx,(%r14)
mov    0x0(%rbp),%ebx
test   %r15,%r15
je     1218 <_StrtodDelim+0xb8>
mov    %r15,%rdi
movsd  %xmm0,(%rsp)
call   1080 <_GTIFFree@plt>
movsd  (%rsp),%xmm0
mov    %ebx,0x0(%rbp)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <CPLNan@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"nan\00"
@.str.1 = [8 x i8] c"1.#QNAN\00"
@.str.2 = [9 x i8] c"-1.#QNAN\00"
@.str.3 = [8 x i8] c"-1.#IND\00"
@errno = global i32 0
define double @_StrtodDelim(i8* %0, i8** %1, i8 signext %2) {
%4 = alloca double
%5 = alloca i8*
%6 = alloca i8**
%7 = alloca i8
%8 = alloca i8*
%9 = alloca double
%10 = alloca i32
store i8* %0, i8** %5
store i8** %1, i8*** %6
store i8 %2, i8* %7
%11 = load i8*, i8** %5
%12 = call i64 @strcasecmp(i8* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %26, label %14
14: ; preds = %3
%15 = load i8*, i8** %5
%16 = call i64 @strcasecmp(i8* %15, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %26, label %18
18: ; preds = %14
%19 = load i8*, i8** %5
%20 = call i64 @strcasecmp(i8* %19, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %26, label %22
22: ; preds = %18
%23 = load i8*, i8** %5
%24 = call i64 @strcasecmp(i8* %23, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %22, %18, %14, %3
%27 = call double (...) @CPLNan()
store double %27, double* %4
br label %59
28: ; preds = %22
%29 = load i8*, i8** %5
%30 = call i8* @gtCPLStrdup(i8* %29)
store i8* %30, i8** %8
%31 = load i8*, i8** %8
%32 = load i8, i8* %7
%33 = call i32 @_ReplacePointByLocalePoint(i8* %31, i8 signext %32)
%34 = load i8*, i8** %8
%35 = load i8**, i8*** %6
%36 = call double @strtod(i8* %34, i8** %35)
store double %36, double* %9
%37 = load i32, i32* @errno
store i32 %37, i32* %10
%38 = load i8**, i8*** %6
%39 = icmp ne i8** %38, null
br i1 %39, label %40, label %50
40: ; preds = %28
%41 = load i8*, i8** %5
%42 = load i8**, i8*** %6
%43 = load i8*, i8** %42
%44 = load i8*, i8** %8
%45 = ptrtoint i8* %43 to i64
%46 = ptrtoint i8* %44 to i64
%47 = sub i64 %45, %46
%48 = getelementptr inbounds i8, i8* %41, i64 %47
%49 = load i8**, i8*** %6
store i8* %48, i8** %49
br label %50
50: ; preds = %40, %28
%51 = load i8*, i8** %8
%52 = icmp ne i8* %51, null
br i1 %52, label %53, label %56
53: ; preds = %50
%54 = load i8*, i8** %8
%55 = call i32 @_GTIFFree(i8* %54)
br label %56
56: ; preds = %53, %50
%57 = load i32, i32* %10
store i32 %57, i32* @errno
%58 = load double, double* %9
store double %58, double* %4
br label %59
59: ; preds = %56, %26
%60 = load double, double* %4
ret double %60
}

LLVM IR (-O2):
@.str = [4 x i8] c"nan\00"
@.str.1 = [8 x i8] c"1.#QNAN\00"
@.str.2 = [9 x i8] c"-1.#QNAN\00"
@.str.3 = [8 x i8] c"-1.#IND\00"
@errno = global i32 0
define double @_StrtodDelim(i8* %0, i8** %1, i8 signext %2) {
%4 = tail call i64 @strcasecmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
br i1 %5, label %15, label %6
6: ; preds = %3
%7 = tail call i64 @strcasecmp(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %15, label %9
9: ; preds = %6
%10 = tail call i64 @strcasecmp(i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %9
%13 = tail call i64 @strcasecmp(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %12, %9, %6, %3
%16 = tail call double (...) @CPLNan()
br label %34
17: ; preds = %12
%18 = tail call i8* @gtCPLStrdup(i8* %0)
%19 = tail call i32 @_ReplacePointByLocalePoint(i8* %18, i8 signext %2)
%20 = tail call double @strtod(i8* %18, i8** %1)
%21 = load i32, i32* @errno
%22 = icmp eq i8** %1, null
br i1 %22, label %29, label %23
23: ; preds = %17
%24 = load i8*, i8** %1
%25 = ptrtoint i8* %24 to i64
%26 = ptrtoint i8* %18 to i64
%27 = sub i64 %25, %26
%28 = getelementptr inbounds i8, i8* %0, i64 %27
store i8* %28, i8** %1
br label %29
29: ; preds = %23, %17
%30 = icmp eq i8* %18, null
br i1 %30, label %33, label %31
31: ; preds = %29
%32 = tail call i32 @_GTIFFree(i8* %18)
br label %33
33: ; preds = %31, %29
store i32 %21, i32* @errno
br label %34
34: ; preds = %33, %15
%35 = phi double [ %16, %15 ], [ %20, %33 ]
ret double %35
}