#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 floor(double);
int sscanf(char *, char *, ...);
char *strchr(char *, char);
int /*<<< orphan*/ strcpy(char *, char const *);
char *wcsutil_dot_to_locale(char const *, char *);
int wcsutil_str2double2(const char *buf, double *value) {
  char *cptr, ctmp[72], *dptr, *eptr, ltmp[72];
  int exp = 0;
  value[0] = 0.0;
  value[1] = 0.0;
  if (sscanf(wcsutil_dot_to_locale(buf, ltmp), "%lf", value) < 1) {
    return 1;
  }
  value[0] = floor(value[0]);
  strcpy(ctmp, buf);
  dptr = strchr(ctmp, '.');
  if ((eptr = strchr(ctmp, 'E')) == NULL) {
    if ((eptr = strchr(ctmp, 'D')) == NULL) {
      if ((eptr = strchr(ctmp, 'e')) == NULL) {
        eptr = strchr(ctmp, 'd');
      }
    }
  }
  if (eptr) {
    if (sscanf(eptr + 1, "%d", &exp) < 1) {
      return 1;
    }
    if (!dptr) {
      dptr = eptr;
      eptr++;
    }
    if (dptr + exp <= ctmp) {
      return sscanf(wcsutil_dot_to_locale(buf, ctmp), "%lf", value + 1) < 1;
    } else if (eptr <= dptr + exp + 1) {
      return 0;
    }
  }
  if (dptr) {
    cptr = ctmp;
    while (cptr <= dptr + exp) {
      if ('0' < *cptr && *cptr <= '9')
        *cptr = '0';
      cptr++;
    }
    if (sscanf(wcsutil_dot_to_locale(ctmp, ltmp), "%lf", value + 1) < 1) {
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<wcsutil_str2double2>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0xd4(%rbp)
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rdi
lea    -0xd0(%rbp),%rsi
call   1060 <wcsutil_dot_to_locale@plt>
mov    %rax,%rdi
mov    -0x18(%rbp),%rdx
lea    0xe5e(%rip),%rsi
mov    $0x0,%al
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jge    11be <wcsutil_str2double2+0x6e>
movl   $0x1,-0x4(%rbp)
jmp    13fb <wcsutil_str2double2+0x2ab>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
call   1070 <floor@plt>
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
lea    -0x70(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x70(%rbp),%rdi
mov    $0x2e,%esi
call   1040 <strchr@plt>
mov    %rax,-0x78(%rbp)
lea    -0x70(%rbp),%rdi
mov    $0x45,%esi
call   1040 <strchr@plt>
mov    %rax,-0x80(%rbp)
cmp    $0x0,%rax
jne    1262 <wcsutil_str2double2+0x112>
lea    -0x70(%rbp),%rdi
mov    $0x44,%esi
call   1040 <strchr@plt>
mov    %rax,-0x80(%rbp)
cmp    $0x0,%rax
jne    125d <wcsutil_str2double2+0x10d>
lea    -0x70(%rbp),%rdi
mov    $0x65,%esi
call   1040 <strchr@plt>
mov    %rax,-0x80(%rbp)
cmp    $0x0,%rax
jne    1258 <wcsutil_str2double2+0x108>
lea    -0x70(%rbp),%rdi
mov    $0x64,%esi
call   1040 <strchr@plt>
mov    %rax,-0x80(%rbp)
jmp    125d <wcsutil_str2double2+0x10d>
jmp    1262 <wcsutil_str2double2+0x112>
cmpq   $0x0,-0x80(%rbp)
je     1347 <wcsutil_str2double2+0x1f7>
mov    -0x80(%rbp),%rdi
add    $0x1,%rdi
lea    0xd88(%rip),%rsi
lea    -0xd4(%rbp),%rdx
mov    $0x0,%al
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jge    129f <wcsutil_str2double2+0x14f>
movl   $0x1,-0x4(%rbp)
jmp    13fb <wcsutil_str2double2+0x2ab>
cmpq   $0x0,-0x78(%rbp)
jne    12be <wcsutil_str2double2+0x16e>
mov    -0x80(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x80(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x80(%rbp)
mov    -0x78(%rbp),%rax
movslq -0xd4(%rbp),%rcx
add    %rcx,%rax
lea    -0x70(%rbp),%rcx
cmp    %rcx,%rax
ja     1312 <wcsutil_str2double2+0x1c2>
mov    -0x10(%rbp),%rdi
lea    -0x70(%rbp),%rsi
call   1060 <wcsutil_dot_to_locale@plt>
mov    %rax,%rdi
mov    -0x18(%rbp),%rdx
add    $0x8,%rdx
lea    0xd08(%rip),%rsi
mov    $0x0,%al
call   1050 <sscanf@plt>
cmp    $0x1,%eax
setl   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    13fb <wcsutil_str2double2+0x2ab>
mov    -0x80(%rbp),%rax
mov    -0x78(%rbp),%rcx
movslq -0xd4(%rbp),%rdx
add    %rdx,%rcx
add    $0x1,%rcx
cmp    %rcx,%rax
ja     133d <wcsutil_str2double2+0x1ed>
movl   $0x0,-0x4(%rbp)
jmp    13fb <wcsutil_str2double2+0x2ab>
jmp    1342 <wcsutil_str2double2+0x1f2>
jmp    1347 <wcsutil_str2double2+0x1f7>
cmpq   $0x0,-0x78(%rbp)
je     13f4 <wcsutil_str2double2+0x2a4>
lea    -0x70(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x78(%rbp),%rcx
movslq -0xd4(%rbp),%rdx
add    %rdx,%rcx
cmp    %rcx,%rax
ja     13b1 <wcsutil_str2double2+0x261>
mov    -0x20(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x30,%eax
cmp    %ecx,%eax
jge    13a0 <wcsutil_str2double2+0x250>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x39,%eax
jg     13a0 <wcsutil_str2double2+0x250>
mov    -0x20(%rbp),%rax
movb   $0x30,(%rax)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    135a <wcsutil_str2double2+0x20a>
lea    -0x70(%rbp),%rdi
lea    -0xd0(%rbp),%rsi
call   1060 <wcsutil_dot_to_locale@plt>
mov    %rax,%rdi
mov    -0x18(%rbp),%rdx
add    $0x8,%rdx
lea    0xc2d(%rip),%rsi
mov    $0x0,%al
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jge    13ef <wcsutil_str2double2+0x29f>
movl   $0x1,-0x4(%rbp)
jmp    13fb <wcsutil_str2double2+0x2ab>
jmp    13f4 <wcsutil_str2double2+0x2a4>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wcsutil_str2double2>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa8,%rsp
mov    %rsi,%rbx
mov    %rdi,%r15
movl   $0x0,0x4(%rsp)
pxor   %xmm0,%xmm0
movdqu %xmm0,(%rsi)
lea    0x60(%rsp),%rsi
call   1060 <wcsutil_dot_to_locale@plt>
lea    0xe98(%rip),%rsi
mov    %rax,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <sscanf@plt>
mov    $0x1,%r13d
test   %eax,%eax
jle    1511 <wcsutil_str2double2+0x3c1>
lea    0x8(%rbx),%r14
movq   (%rbx),%xmm0
call   1070 <floor@plt>
movq   %xmm0,(%rbx)
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    $0x2e,%esi
call   1040 <strchr@plt>
mov    %rax,%r12
mov    %rbx,%rdi
mov    $0x45,%esi
call   1040 <strchr@plt>
mov    %rax,%rbp
test   %rax,%rax
mov    %r14,0x8(%rsp)
jne    1237 <wcsutil_str2double2+0xe7>
lea    0x10(%rsp),%rdi
mov    $0x44,%esi
call   1040 <strchr@plt>
mov    %rax,%rbp
test   %rax,%rax
jne    1237 <wcsutil_str2double2+0xe7>
lea    0x10(%rsp),%rdi
mov    $0x65,%esi
call   1040 <strchr@plt>
mov    %rax,%rbp
test   %rax,%rax
jne    1237 <wcsutil_str2double2+0xe7>
lea    0x10(%rsp),%rdi
mov    $0x64,%esi
call   1040 <strchr@plt>
mov    %rax,%rbp
test   %rax,%rax
je     1549 <wcsutil_str2double2+0x3f9>
lea    0x1(%rbp),%r14
lea    0xde2(%rip),%rsi
lea    0x4(%rsp),%rdx
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <sscanf@plt>
test   %eax,%eax
jle    1511 <wcsutil_str2double2+0x3c1>
test   %r12,%r12
mov    %r12,%rcx
cmove  %rbp,%rcx
movslq 0x4(%rsp),%rax
lea    (%rcx,%rax,1),%rdx
cmp    %rbx,%rdx
jbe    14ae <wcsutil_str2double2+0x35e>
test   %r12,%r12
cmove  %r14,%rbp
add    $0x1,%rdx
xor    %r13d,%r13d
cmp    %rdx,%rbp
jbe    1511 <wcsutil_str2double2+0x3c1>
movslq %eax,%rdx
lea    (%rcx,%rdx,1),%rax
cmp    %rax,%rbx
mov    0x8(%rsp),%rbp
ja     14e1 <wcsutil_str2double2+0x391>
add    %rcx,%rdx
add    $0x1,%rdx
lea    0x11(%rsp),%rcx
cmp    %rcx,%rdx
cmova  %rdx,%rcx
sub    %rbx,%rcx
cmp    $0x10,%rcx
jb     1539 <wcsutil_str2double2+0x3e9>
mov    %rcx,%rdx
and    $0xfffffffffffffff0,%rdx
lea    (%rsp,%rdx,1),%rbx
add    $0x10,%rbx
xor    %esi,%esi
movdqa 0xd26(%rip),%xmm0
movdqa 0xd2e(%rip),%xmm1
pcmpeqd %xmm2,%xmm2
jmp    12fd <wcsutil_str2double2+0x1ad>
nopl   0x0(%rax,%rax,1)
add    $0x10,%rsi
cmp    %rsi,%rdx
je     14dc <wcsutil_str2double2+0x38c>
movq   0x10(%rsp,%rsi,1),%xmm3
paddb  %xmm0,%xmm3
movdqa %xmm3,%xmm4
pmaxub %xmm1,%xmm4
pcmpeqb %xmm3,%xmm4
movd   %xmm4,%edi
not    %dil
test   $0x1,%dil
je     1325 <wcsutil_str2double2+0x1d5>
movb   $0x30,0x10(%rsp,%rsi,1)
movdqa %xmm4,%xmm3
pxor   %xmm2,%xmm3
movdqa %xmm3,%xmm5
pslld  $0x8,%xmm5
movd   %xmm5,%edi
shr    $0x10,%edi
test   $0x1,%dil
je     1348 <wcsutil_str2double2+0x1f8>
movb   $0x30,0x11(%rsp,%rsi,1)
pshuflw $0x55,%xmm4,%xmm5
pxor   %xmm2,%xmm5
pextrw $0x2,%xmm5,%edi
test   $0x1,%dil
je     1361 <wcsutil_str2double2+0x211>
movb   $0x30,0x12(%rsp,%rsi,1)
movdqa %xmm3,%xmm5
psllq  $0x18,%xmm5
pextrw $0x3,%xmm5,%edi
test   $0x1,%dil
je     137a <wcsutil_str2double2+0x22a>
movb   $0x30,0x13(%rsp,%rsi,1)
pshufd $0x55,%xmm4,%xmm4
pxor   %xmm2,%xmm4
pextrw $0x4,%xmm4,%edi
test   $0x1,%dil
je     1393 <wcsutil_str2double2+0x243>
movb   $0x30,0x14(%rsp,%rsi,1)
movdqa %xmm3,%xmm4
pslldq $0x5,%xmm4
pextrw $0x5,%xmm4,%edi
test   $0x1,%dil
je     13ac <wcsutil_str2double2+0x25c>
movb   $0x30,0x15(%rsp,%rsi,1)
pextrw $0x3,%xmm3,%edi
test   $0x1,%dil
je     13bc <wcsutil_str2double2+0x26c>
movb   $0x30,0x16(%rsp,%rsi,1)
pslldq $0x7,%xmm3
pextrw $0x7,%xmm3,%edi
test   $0x1,%dil
je     13d1 <wcsutil_str2double2+0x281>
movb   $0x30,0x17(%rsp,%rsi,1)
movq   0x18(%rsp,%rsi,1),%xmm3
paddb  %xmm0,%xmm3
movdqa %xmm3,%xmm4
pmaxub %xmm1,%xmm4
pcmpeqb %xmm3,%xmm4
movd   %xmm4,%edi
not    %dil
test   $0x1,%dil
je     13f9 <wcsutil_str2double2+0x2a9>
movb   $0x30,0x18(%rsp,%rsi,1)
movdqa %xmm4,%xmm3
pxor   %xmm2,%xmm3
movdqa %xmm3,%xmm5
pslld  $0x8,%xmm5
movd   %xmm5,%edi
shr    $0x10,%edi
test   $0x1,%dil
je     141c <wcsutil_str2double2+0x2cc>
movb   $0x30,0x19(%rsp,%rsi,1)
pshuflw $0x55,%xmm4,%xmm5
pxor   %xmm2,%xmm5
pextrw $0x2,%xmm5,%edi
test   $0x1,%dil
je     1435 <wcsutil_str2double2+0x2e5>
movb   $0x30,0x1a(%rsp,%rsi,1)
movdqa %xmm3,%xmm5
psllq  $0x18,%xmm5
pextrw $0x3,%xmm5,%edi
test   $0x1,%dil
je     144e <wcsutil_str2double2+0x2fe>
movb   $0x30,0x1b(%rsp,%rsi,1)
pshufd $0x55,%xmm4,%xmm4
pxor   %xmm2,%xmm4
pextrw $0x4,%xmm4,%edi
test   $0x1,%dil
je     1467 <wcsutil_str2double2+0x317>
movb   $0x30,0x1c(%rsp,%rsi,1)
movdqa %xmm3,%xmm4
pslldq $0x5,%xmm4
pextrw $0x5,%xmm4,%edi
test   $0x1,%dil
je     1480 <wcsutil_str2double2+0x330>
movb   $0x30,0x1d(%rsp,%rsi,1)
pextrw $0x3,%xmm3,%edi
test   $0x1,%dil
je     1490 <wcsutil_str2double2+0x340>
movb   $0x30,0x1e(%rsp,%rsi,1)
pslldq $0x7,%xmm3
pextrw $0x7,%xmm3,%edi
test   $0x1,%dil
je     12f0 <wcsutil_str2double2+0x1a0>
movb   $0x30,0x1f(%rsp,%rsi,1)
jmp    12f0 <wcsutil_str2double2+0x1a0>
lea    0x10(%rsp),%rsi
mov    %r15,%rdi
call   1060 <wcsutil_dot_to_locale@plt>
lea    0xb5e(%rip),%rsi
mov    %rax,%rdi
mov    0x8(%rsp),%rdx
xor    %eax,%eax
call   1050 <sscanf@plt>
xor    %r13d,%r13d
test   %eax,%eax
setle  %r13b
jmp    1511 <wcsutil_str2double2+0x3c1>
cmp    %rdx,%rcx
jne    1539 <wcsutil_str2double2+0x3e9>
lea    0x10(%rsp),%rdi
lea    0x60(%rsp),%rsi
call   1060 <wcsutil_dot_to_locale@plt>
lea    0xb29(%rip),%rsi
mov    %rax,%rdi
mov    %rbp,%rdx
xor    %eax,%eax
call   1050 <sscanf@plt>
mov    $0x1,%r13d
test   %eax,%eax
jle    1511 <wcsutil_str2double2+0x3c1>
xor    %r13d,%r13d
mov    %r13d,%eax
add    $0xa8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    %rax,%rbx
ja     14e1 <wcsutil_str2double2+0x391>
movzbl (%rbx),%ecx
add    $0xcf,%cl
cmp    $0x8,%cl
ja     1530 <wcsutil_str2double2+0x3e0>
movb   $0x30,(%rbx)
jmp    1530 <wcsutil_str2double2+0x3e0>
test   %r12,%r12
je     150e <wcsutil_str2double2+0x3be>
xor    %eax,%eax
mov    %r12,%rcx
jmp    128c <wcsutil_str2double2+0x13c>

LLVM IR (-O0):
@.str = [4 x i8] c"%lf\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @wcsutil_str2double2(i8* %0, double* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca double*
%6 = alloca i8*
%7 = alloca [72 x i8]
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca [72 x i8]
%11 = alloca i32
store i8* %0, i8** %4
store double* %1, double** %5
store i32 0, i32* %11
%12 = load double*, double** %5
%13 = getelementptr inbounds double, double* %12, i64 0
store double 0.000000e+00, double* %13
%14 = load double*, double** %5
%15 = getelementptr inbounds double, double* %14, i64 1
store double 0.000000e+00, double* %15
%16 = load i8*, i8** %4
%17 = getelementptr inbounds [72 x i8], [72 x i8]* %10, i64 0, i64 0
%18 = call i8* @wcsutil_dot_to_locale(i8* %16, i8* %17)
%19 = load double*, double** %5
%20 = call i32 (i8*, i8*, ...) @sscanf(i8* %18, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %19)
%21 = icmp slt i32 %20, 1
br i1 %21, label %22, label %23
22: ; preds = %2
store i32 1, i32* %3
br label %132
23: ; preds = %2
%24 = load double*, double** %5
%25 = getelementptr inbounds double, double* %24, i64 0
%26 = load double, double* %25
%27 = call double @llvm.floor.f64(double %26)
%28 = load double*, double** %5
%29 = getelementptr inbounds double, double* %28, i64 0
store double %27, double* %29
%30 = getelementptr inbounds [72 x i8], [72 x i8]* %7, i64 0, i64 0
%31 = load i8*, i8** %4
%32 = call i32 @strcpy(i8* %30, i8* %31)
%33 = getelementptr inbounds [72 x i8], [72 x i8]* %7, i64 0, i64 0
%34 = call i8* @strchr(i8* %33, i8 signext 46)
store i8* %34, i8** %8
%35 = getelementptr inbounds [72 x i8], [72 x i8]* %7, i64 0, i64 0
%36 = call i8* @strchr(i8* %35, i8 signext 69)
store i8* %36, i8** %9
%37 = icmp eq i8* %36, null
br i1 %37, label %38, label %51
38: ; preds = %23
%39 = getelementptr inbounds [72 x i8], [72 x i8]* %7, i64 0, i64 0
%40 = call i8* @strchr(i8* %39, i8 signext 68)
store i8* %40, i8** %9
%41 = icmp eq i8* %40, null
br i1 %41, label %42, label %50
42: ; preds = %38
%43 = getelementptr inbounds [72 x i8], [72 x i8]* %7, i64 0, i64 0
%44 = call i8* @strchr(i8* %43, i8 signext 101)
store i8* %44, i8** %9
%45 = icmp eq i8* %44, null
br i1 %45, label %46, label %49
46: ; preds = %42
%47 = getelementptr inbounds [72 x i8], [72 x i8]* %7, i64 0, i64 0
%48 = call i8* @strchr(i8* %47, i8 signext 100)
store i8* %48, i8** %9
br label %49
49: ; preds = %46, %42
br label %50
50: ; preds = %49, %38
br label %51
51: ; preds = %50, %23
%52 = load i8*, i8** %9
%53 = icmp ne i8* %52, null
br i1 %53, label %54, label %94
54: ; preds = %51
%55 = load i8*, i8** %9
%56 = getelementptr inbounds i8, i8* %55, i64 1
%57 = call i32 (i8*, i8*, ...) @sscanf(i8* %56, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %11)
%58 = icmp slt i32 %57, 1
br i1 %58, label %59, label %60
59: ; preds = %54
store i32 1, i32* %3
br label %132
60: ; preds = %54
%61 = load i8*, i8** %8
%62 = icmp ne i8* %61, null
br i1 %62, label %67, label %63
63: ; preds = %60
%64 = load i8*, i8** %9
store i8* %64, i8** %8
%65 = load i8*, i8** %9
%66 = getelementptr inbounds i8, i8* %65, i32 1
store i8* %66, i8** %9
br label %67
67: ; preds = %63, %60
%68 = load i8*, i8** %8
%69 = load i32, i32* %11
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds i8, i8* %68, i64 %70
%72 = getelementptr inbounds [72 x i8], [72 x i8]* %7, i64 0, i64 0
%73 = icmp ule i8* %71, %72
br i1 %73, label %74, label %83
74: ; preds = %67
%75 = load i8*, i8** %4
%76 = getelementptr inbounds [72 x i8], [72 x i8]* %7, i64 0, i64 0
%77 = call i8* @wcsutil_dot_to_locale(i8* %75, i8* %76)
%78 = load double*, double** %5
%79 = getelementptr inbounds double, double* %78, i64 1
%80 = call i32 (i8*, i8*, ...) @sscanf(i8* %77, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %79)
%81 = icmp slt i32 %80, 1
%82 = zext i1 %81 to i32
store i32 %82, i32* %3
br label %132
83: ; preds = %67
%84 = load i8*, i8** %9
%85 = load i8*, i8** %8
%86 = load i32, i32* %11
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds i8, i8* %85, i64 %87
%89 = getelementptr inbounds i8, i8* %88, i64 1
%90 = icmp ule i8* %84, %89
br i1 %90, label %91, label %92
91: ; preds = %83
store i32 0, i32* %3
br label %132
92: ; preds = %83
br label %93
93: ; preds = %92
br label %94
94: ; preds = %93, %51
%95 = load i8*, i8** %8
%96 = icmp ne i8* %95, null
br i1 %96, label %97, label %131
97: ; preds = %94
%98 = getelementptr inbounds [72 x i8], [72 x i8]* %7, i64 0, i64 0
store i8* %98, i8** %6
br label %99
99: ; preds = %118, %97
%100 = load i8*, i8** %6
%101 = load i8*, i8** %8
%102 = load i32, i32* %11
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds i8, i8* %101, i64 %103
%105 = icmp ule i8* %100, %104
br i1 %105, label %106, label %121
106: ; preds = %99
%107 = load i8*, i8** %6
%108 = load i8, i8* %107
%109 = sext i8 %108 to i32
%110 = icmp slt i32 48, %109
br i1 %110, label %111, label %118
111: ; preds = %106
%112 = load i8*, i8** %6
%113 = load i8, i8* %112
%114 = sext i8 %113 to i32
%115 = icmp sle i32 %114, 57
br i1 %115, label %116, label %118
116: ; preds = %111
%117 = load i8*, i8** %6
store i8 48, i8* %117
br label %118
118: ; preds = %116, %111, %106
%119 = load i8*, i8** %6
%120 = getelementptr inbounds i8, i8* %119, i32 1
store i8* %120, i8** %6
br label %99
121: ; preds = %99
%122 = getelementptr inbounds [72 x i8], [72 x i8]* %7, i64 0, i64 0
%123 = getelementptr inbounds [72 x i8], [72 x i8]* %10, i64 0, i64 0
%124 = call i8* @wcsutil_dot_to_locale(i8* %122, i8* %123)
%125 = load double*, double** %5
%126 = getelementptr inbounds double, double* %125, i64 1
%127 = call i32 (i8*, i8*, ...) @sscanf(i8* %124, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %126)
%128 = icmp slt i32 %127, 1
br i1 %128, label %129, label %130
129: ; preds = %121
store i32 1, i32* %3
br label %132
130: ; preds = %121
br label %131
131: ; preds = %130, %94
store i32 0, i32* %3
br label %132
132: ; preds = %131, %129, %91, %74, %59, %22
%133 = load i32, i32* %3
ret i32 %133
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lf\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @wcsutil_str2double2(i8* %0, double* %1) {
%3 = alloca [72 x i8]
%4 = ptrtoint [72 x i8]* %3 to i64
%5 = alloca [72 x i8]
%6 = alloca i32
%7 = getelementptr inbounds [72 x i8], [72 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [72 x i8], [72 x i8]* %5, i64 0, i64 0
%9 = bitcast i32* %6 to i8*
store i32 0, i32* %6
%10 = getelementptr inbounds double, double* %1, i64 1
%11 = bitcast double* %1 to i8*
%12 = call i8* @wcsutil_dot_to_locale(i8* %0, i8* %8)
%13 = call i32 (i8*, i8*, ...) @sscanf(i8* %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %1)
%14 = icmp slt i32 %13, 1
br i1 %14, label %181, label %15
15: ; preds = %2
%16 = load double, double* %1
%17 = call double @llvm.floor.f64(double %16)
store double %17, double* %1
%18 = call i32 @strcpy(i8* %7, i8* %0)
%19 = call i8* @strchr(i8* %7, i8 signext 46)
%20 = call i8* @strchr(i8* %7, i8 signext 69)
%21 = icmp eq i8* %20, null
br i1 %21, label %22, label %31
22: ; preds = %15
%23 = call i8* @strchr(i8* %7, i8 signext 68)
%24 = icmp eq i8* %23, null
br i1 %24, label %25, label %31
25: ; preds = %22
%26 = call i8* @strchr(i8* %7, i8 signext 101)
%27 = icmp eq i8* %26, null
br i1 %27, label %28, label %31
28: ; preds = %25
%29 = call i8* @strchr(i8* %7, i8 signext 100)
%30 = icmp eq i8* %29, null
br i1 %30, label %52, label %31
31: ; preds = %15, %22, %25, %28
%32 = phi i8* [ %29, %28 ], [ %20, %15 ], [ %23, %22 ], [ %26, %25 ]
%33 = getelementptr inbounds i8, i8* %32, i64 1
%34 = call i32 (i8*, i8*, ...) @sscanf(i8* %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%35 = icmp slt i32 %34, 1
br i1 %35, label %181, label %36
36: ; preds = %31
%37 = icmp eq i8* %19, null
%38 = select i1 %37, i8* %32, i8* %19
%39 = load i32, i32* %6
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i8, i8* %38, i64 %40
%42 = icmp ugt i8* %41, %7
br i1 %42, label %48, label %43
43: ; preds = %36
%44 = call i8* @wcsutil_dot_to_locale(i8* %0, i8* %7)
%45 = call i32 (i8*, i8*, ...) @sscanf(i8* %44, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %10)
%46 = icmp slt i32 %45, 1
%47 = zext i1 %46 to i32
br label %181
48: ; preds = %36
%49 = select i1 %37, i8* %33, i8* %32
%50 = getelementptr inbounds i8, i8* %41, i64 1
%51 = icmp ugt i8* %49, %50
br i1 %51, label %54, label %181
52: ; preds = %28
%53 = icmp eq i8* %19, null
br i1 %53, label %180, label %54
54: ; preds = %48, %52
%55 = phi i8* [ %19, %52 ], [ %38, %48 ]
%56 = phi i32 [ 0, %52 ], [ %39, %48 ]
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds i8, i8* %55, i64 %57
%59 = icmp ugt i8* %7, %58
br i1 %59, label %176, label %60
60: ; preds = %54
%61 = ptrtoint i8* %55 to i64
%62 = add i64 %61, %57
%63 = add i64 %62, 1
%64 = or i64 %4, 1
%65 = call i64 @llvm.umax.i64(i64 %63, i64 %64)
%66 = sub i64 %65, %4
%67 = icmp ult i64 %66, 16
br i1 %67, label %165, label %68
68: ; preds = %60
%69 = and i64 %66, -16
%70 = getelementptr [72 x i8], [72 x i8]* %3, i64 0, i64 %69
br label %71
71: ; preds = %160, %68
%72 = phi i64 [ 0, %68 ], [ %161, %160 ]
%73 = getelementptr [72 x i8], [72 x i8]* %3, i64 0, i64 %72
%74 = bitcast i8* %73 to <8 x i8>*
%75 = load <8 x i8>, <8 x i8>* %74
%76 = getelementptr i8, i8* %73, i64 8
%77 = bitcast i8* %76 to <8 x i8>*
%78 = load <8 x i8>, <8 x i8>* %77
%79 = add <8 x i8> %75, <i8 -49, i8 -49, i8 -49, i8 -49, i8 -49, i8 -49, i8 -49, i8 -49>
%80 = add <8 x i8> %78, <i8 -49, i8 -49, i8 -49, i8 -49, i8 -49, i8 -49, i8 -49, i8 -49>
%81 = icmp ult <8 x i8> %79, <i8 9, i8 9, i8 9, i8 9, i8 9, i8 9, i8 9, i8 9>
%82 = icmp ult <8 x i8> %80, <i8 9, i8 9, i8 9, i8 9, i8 9, i8 9, i8 9, i8 9>
%83 = extractelement <8 x i1> %81, i64 0
br i1 %83, label %84, label %85
84: ; preds = %71
store i8 48, i8* %73
br label %85
85: ; preds = %84, %71
%86 = extractelement <8 x i1> %81, i64 1
br i1 %86, label %87, label %90
87: ; preds = %85
%88 = or i64 %72, 1
%89 = getelementptr [72 x i8], [72 x i8]* %3, i64 0, i64 %88
store i8 48, i8* %89
br label %90
90: ; preds = %87, %85
%91 = extractelement <8 x i1> %81, i64 2
br i1 %91, label %92, label %95
92: ; preds = %90
%93 = or i64 %72, 2
%94 = getelementptr [72 x i8], [72 x i8]* %3, i64 0, i64 %93
store i8 48, i8* %94
br label %95
95: ; preds = %92, %90
%96 = extractelement <8 x i1> %81, i64 3
br i1 %96, label %97, label %100
97: ; preds = %95
%98 = or i64 %72, 3
%99 = getelementptr [72 x i8], [72 x i8]* %3, i64 0, i64 %98
store i8 48, i8* %99
br label %100
100: ; preds = %97, %95
%101 = extractelement <8 x i1> %81, i64 4
br i1 %101, label %102, label %105
102: ; preds = %100
%103 = or i64 %72, 4
%104 = getelementptr [72 x i8], [72 x i8]* %3, i64 0, i64 %103
store i8 48, i8* %104
br label %105
105: ; preds = %102, %100
%106 = extractelement <8 x i1> %81, i64 5
br i1 %106, label %107, label %110
107: ; preds = %105
%108 = or i64 %72, 5
%109 = getelementptr [72 x i8], [72 x i8]* %3, i64 0, i64 %108
store i8 48, i8* %109
br label %110
110: ; preds = %107, %105
%111 = extractelement <8 x i1> %81, i64 6
br i1 %111, label %112, label %115
112: ; preds = %110
%113 = or i64 %72, 6
%114 = getelementptr [72 x i8], [72 x i8]* %3, i64 0, i64 %113
store i8 48, i8* %114
br label %115
115: ; preds = %112, %110
%116 = extractelement <8 x i1> %81, i64 7
br i1 %116, label %117, label %120
117: ; preds = %115
%118 = or i64 %72, 7
%119 = getelementptr [72 x i8], [72 x i8]* %3, i64 0, i64 %118
store i8 48, i8* %119
br label %120
120: ; preds = %117, %115
%121 = extractelement <8 x i1> %82, i64 0
br i1 %121, label %122, label %125
122: ; preds = %120
%123 = or i64 %72, 8
%124 = getelementptr [72 x i8], [72 x i8]* %3, i64 0, i64 %123
store i8 48, i8* %124
br label %125
125: ; preds = %122, %120
%126 = extractelement <8 x i1> %82, i64 1
br i1 %126, label %127, label %130
127: ; preds = %125
%128 = or i64 %72, 9
%129 = getelementptr [72 x i8], [72 x i8]* %3, i64 0, i64 %128
store i8 48, i8* %129
br label %130
130: ; preds = %127, %125
%131 = extractelement <8 x i1> %82, i64 2
br i1 %131, label %132, label %135
132: ; preds = %130
%133 = or i64 %72, 10
%134 = getelementptr [72 x i8], [72 x i8]* %3, i64 0, i64 %133
store i8 48, i8* %134
br label %135
135: ; preds = %132, %130
%136 = extractelement <8 x i1> %82, i64 3
br i1 %136, label %137, label %140
137: ; preds = %135
%138 = or i64 %72, 11
%139 = getelementptr [72 x i8], [72 x i8]* %3, i64 0, i64 %138
store i8 48, i8* %139
br label %140
140: ; preds = %137, %135
%141 = extractelement <8 x i1> %82, i64 4
br i1 %141, label %142, label %145
142: ; preds = %140
%143 = or i64 %72, 12
%144 = getelementptr [72 x i8], [72 x i8]* %3, i64 0, i64 %143
store i8 48, i8* %144
br label %145
145: ; preds = %142, %140
%146 = extractelement <8 x i1> %82, i64 5
br i1 %146, label %147, label %150
147: ; preds = %145
%148 = or i64 %72, 13
%149 = getelementptr [72 x i8], [72 x i8]* %3, i64 0, i64 %148
store i8 48, i8* %149
br label %150
150: ; preds = %147, %145
%151 = extractelement <8 x i1> %82, i64 6
br i1 %151, label %152, label %155
152: ; preds = %150
%153 = or i64 %72, 14
%154 = getelementptr [72 x i8], [72 x i8]* %3, i64 0, i64 %153
store i8 48, i8* %154
br label %155
155: ; preds = %152, %150
%156 = extractelement <8 x i1> %82, i64 7
br i1 %156, label %157, label %160
157: ; preds = %155
%158 = or i64 %72, 15
%159 = getelementptr [72 x i8], [72 x i8]* %3, i64 0, i64 %158
store i8 48, i8* %159
br label %160
160: ; preds = %157, %155
%161 = add nuw i64 %72, 16
%162 = icmp eq i64 %161, %69
br i1 %162, label %163, label %71
163: ; preds = %160
%164 = icmp eq i64 %66, %69
br i1 %164, label %176, label %165
165: ; preds = %60, %163
%166 = phi i8* [ %7, %60 ], [ %70, %163 ]
br label %167
167: ; preds = %165, %173
%168 = phi i8* [ %174, %173 ], [ %166, %165 ]
%169 = load i8, i8* %168
%170 = add i8 %169, -49
%171 = icmp ult i8 %170, 9
br i1 %171, label %172, label %173
172: ; preds = %167
store i8 48, i8* %168
br label %173
173: ; preds = %172, %167
%174 = getelementptr inbounds i8, i8* %168, i64 1
%175 = icmp ugt i8* %174, %58
br i1 %175, label %176, label %167
176: ; preds = %173, %163, %54
%177 = call i8* @wcsutil_dot_to_locale(i8* %7, i8* %8)
%178 = call i32 (i8*, i8*, ...) @sscanf(i8* %177, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %10)
%179 = icmp slt i32 %178, 1
br i1 %179, label %181, label %180
180: ; preds = %176, %52
br label %181
181: ; preds = %176, %48, %31, %2, %180, %43
%182 = phi i32 [ %47, %43 ], [ 0, %180 ], [ 1, %2 ], [ 1, %31 ], [ 0, %48 ], [ 1, %176 ]
ret i32 %182
}