#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*/ free(char *);
char *iStrDupUntilNoCase(char **, char);
int sscanf(char const *, char *, double *);
int iupStrToDoubleDouble(const char *str, double *f1, double *f2, char sep) {
  if (!str)
    return 0;
  if (((*str >= 'A' && *str <= 'Z') ? (*str - 'A') + 'a' : *str) == sep) {
    str++;
    if (sscanf(str, "%lf", f2) != 1)
      return 0;
    return 1;
  } else {
    char *p_str = iStrDupUntilNoCase((char **)&str, sep);
    if (!p_str) {
      if (sscanf(str, "%lf", f1) != 1)
        return 0;
      return 1;
    } else if (*str == 0) {
      int ret = sscanf(p_str, "%lf", f1);
      free(p_str);
      if (ret != 1)
        return 0;
      return 1;
    } else {
      int ret = 0;
      if (sscanf(p_str, "%lf", f1) == 1)
        ret++;
      if (sscanf(str, "%lf", f2) == 1)
        ret++;
      free(p_str);
      return ret;
    }
  }
}


x86 assembly (clang, -O0):
<iupStrToDoubleDouble>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %cl,%al
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %al,-0x21(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1160 <iupStrToDoubleDouble+0x30>
movl   $0x0,-0x4(%rbp)
jmp    12f4 <iupStrToDoubleDouble+0x1c4>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x41,%eax
jl     1195 <iupStrToDoubleDouble+0x65>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5a,%eax
jg     1195 <iupStrToDoubleDouble+0x65>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
sub    $0x41,%eax
add    $0x61,%eax
mov    %eax,-0x3c(%rbp)
jmp    119f <iupStrToDoubleDouble+0x6f>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
movsbl -0x21(%rbp),%ecx
cmp    %ecx,%eax
jne    11ef <iupStrToDoubleDouble+0xbf>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xe37(%rip),%rsi
call   1050 <sscanf@plt>
cmp    $0x1,%eax
je     11e3 <iupStrToDoubleDouble+0xb3>
movl   $0x0,-0x4(%rbp)
jmp    12f4 <iupStrToDoubleDouble+0x1c4>
movl   $0x1,-0x4(%rbp)
jmp    12f4 <iupStrToDoubleDouble+0x1c4>
lea    -0x10(%rbp),%rdi
movsbl -0x21(%rbp),%esi
call   1040 <iStrDupUntilNoCase@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1240 <iupStrToDoubleDouble+0x110>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xde6(%rip),%rsi
call   1050 <sscanf@plt>
cmp    $0x1,%eax
je     1234 <iupStrToDoubleDouble+0x104>
movl   $0x0,-0x4(%rbp)
jmp    12f4 <iupStrToDoubleDouble+0x1c4>
movl   $0x1,-0x4(%rbp)
jmp    12f4 <iupStrToDoubleDouble+0x1c4>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1292 <iupStrToDoubleDouble+0x162>
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xda1(%rip),%rsi
call   1050 <sscanf@plt>
mov    %eax,-0x34(%rbp)
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
cmpl   $0x1,-0x34(%rbp)
je     1286 <iupStrToDoubleDouble+0x156>
movl   $0x0,-0x4(%rbp)
jmp    12f4 <iupStrToDoubleDouble+0x1c4>
movl   $0x1,-0x4(%rbp)
jmp    12f4 <iupStrToDoubleDouble+0x1c4>
movl   $0x0,-0x38(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xd58(%rip),%rsi
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    12bf <iupStrToDoubleDouble+0x18f>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xd32(%rip),%rsi
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    12e5 <iupStrToDoubleDouble+0x1b5>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iupStrToDoubleDouble>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,(%rsp)
test   %rdi,%rdi
je     1174 <iupStrToDoubleDouble+0x44>
mov    %rdx,%r14
mov    %rsi,%rbx
movsbl (%rdi),%eax
lea    -0x41(%rax),%edx
lea    0x20(%rax),%ebp
cmp    $0x1a,%dl
cmovae %eax,%ebp
movsbl %cl,%esi
cmp    %esi,%ebp
jne    1178 <iupStrToDoubleDouble+0x48>
add    $0x1,%rdi
mov    %rdi,(%rsp)
lea    0xe91(%rip),%rsi
mov    %r14,%rdx
jmp    11e3 <iupStrToDoubleDouble+0xb3>
xor    %ebx,%ebx
jmp    11f0 <iupStrToDoubleDouble+0xc0>
mov    %rsp,%rdi
call   1040 <iStrDupUntilNoCase@plt>
mov    (%rsp),%rdi
test   %rax,%rax
je     11d9 <iupStrToDoubleDouble+0xa9>
mov    %rax,%r15
mov    (%rdi),%r12b
lea    0xe6a(%rip),%rsi
mov    %rax,%rdi
mov    %rbx,%rdx
call   1050 <sscanf@plt>
mov    %eax,%r13d
test   %r12b,%r12b
je     1201 <iupStrToDoubleDouble+0xd1>
xor    %ebp,%ebp
cmp    $0x1,%r13d
sete   %bpl
mov    (%rsp),%rdi
lea    0xe42(%rip),%rsi
mov    %r14,%rdx
call   1050 <sscanf@plt>
lea    0x1(%rbp),%ebx
cmp    $0x1,%eax
cmovne %ebp,%ebx
mov    %r15,%rdi
call   1030 <free@plt>
jmp    11f0 <iupStrToDoubleDouble+0xc0>
lea    0xe20(%rip),%rsi
mov    %rbx,%rdx
call   1050 <sscanf@plt>
xor    %ebx,%ebx
cmp    $0x1,%eax
sete   %bl
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r15,%rdi
call   1030 <free@plt>
xor    %ebx,%ebx
cmp    $0x1,%r13d
jmp    11ed <iupStrToDoubleDouble+0xbd>

LLVM IR (-O0):
@.str = [4 x i8] c"%lf\00"
define i32 @iupStrToDoubleDouble(i8* %0, double* %1, double* %2, i8 signext %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca double*
%8 = alloca double*
%9 = alloca i8
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
store i8* %0, i8** %6
store double* %1, double** %7
store double* %2, double** %8
store i8 %3, i8* %9
%13 = load i8*, i8** %6
%14 = icmp ne i8* %13, null
br i1 %14, label %16, label %15
15: ; preds = %4
store i32 0, i32* %5
br label %97
16: ; preds = %4
%17 = load i8*, i8** %6
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp sge i32 %19, 65
br i1 %20, label %21, label %32
21: ; preds = %16
%22 = load i8*, i8** %6
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp sle i32 %24, 90
br i1 %25, label %26, label %32
26: ; preds = %21
%27 = load i8*, i8** %6
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = sub nsw i32 %29, 65
%31 = add nsw i32 %30, 97
br label %36
32: ; preds = %21, %16
%33 = load i8*, i8** %6
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
br label %36
36: ; preds = %32, %26
%37 = phi i32 [ %31, %26 ], [ %35, %32 ]
%38 = load i8, i8* %9
%39 = sext i8 %38 to i32
%40 = icmp eq i32 %37, %39
br i1 %40, label %41, label %50
41: ; preds = %36
%42 = load i8*, i8** %6
%43 = getelementptr inbounds i8, i8* %42, i32 1
store i8* %43, i8** %6
%44 = load i8*, i8** %6
%45 = load double*, double** %8
%46 = call i32 @sscanf(i8* %44, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %45)
%47 = icmp ne i32 %46, 1
br i1 %47, label %48, label %49
48: ; preds = %41
store i32 0, i32* %5
br label %97
49: ; preds = %41
store i32 1, i32* %5
br label %97
50: ; preds = %36
%51 = load i8, i8* %9
%52 = call i8* @iStrDupUntilNoCase(i8** %6, i8 signext %51)
store i8* %52, i8** %10
%53 = load i8*, i8** %10
%54 = icmp ne i8* %53, null
br i1 %54, label %62, label %55
55: ; preds = %50
%56 = load i8*, i8** %6
%57 = load double*, double** %7
%58 = call i32 @sscanf(i8* %56, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %57)
%59 = icmp ne i32 %58, 1
br i1 %59, label %60, label %61
60: ; preds = %55
store i32 0, i32* %5
br label %97
61: ; preds = %55
store i32 1, i32* %5
br label %97
62: ; preds = %50
%63 = load i8*, i8** %6
%64 = load i8, i8* %63
%65 = sext i8 %64 to i32
%66 = icmp eq i32 %65, 0
br i1 %66, label %67, label %77
67: ; preds = %62
%68 = load i8*, i8** %10
%69 = load double*, double** %7
%70 = call i32 @sscanf(i8* %68, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %69)
store i32 %70, i32* %11
%71 = load i8*, i8** %10
%72 = call i32 @free(i8* %71)
%73 = load i32, i32* %11
%74 = icmp ne i32 %73, 1
br i1 %74, label %75, label %76
75: ; preds = %67
store i32 0, i32* %5
br label %97
76: ; preds = %67
store i32 1, i32* %5
br label %97
77: ; preds = %62
store i32 0, i32* %12
%78 = load i8*, i8** %10
%79 = load double*, double** %7
%80 = call i32 @sscanf(i8* %78, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %79)
%81 = icmp eq i32 %80, 1
br i1 %81, label %82, label %85
82: ; preds = %77
%83 = load i32, i32* %12
%84 = add nsw i32 %83, 1
store i32 %84, i32* %12
br label %85
85: ; preds = %82, %77
%86 = load i8*, i8** %6
%87 = load double*, double** %8
%88 = call i32 @sscanf(i8* %86, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %87)
%89 = icmp eq i32 %88, 1
br i1 %89, label %90, label %93
90: ; preds = %85
%91 = load i32, i32* %12
%92 = add nsw i32 %91, 1
store i32 %92, i32* %12
br label %93
93: ; preds = %90, %85
%94 = load i8*, i8** %10
%95 = call i32 @free(i8* %94)
%96 = load i32, i32* %12
store i32 %96, i32* %5
br label %97
97: ; preds = %93, %76, %75, %61, %60, %49, %48, %15
%98 = load i32, i32* %5
ret i32 %98
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lf\00"
define i32 @iupStrToDoubleDouble(i8* %0, double* %1, double* %2, i8 signext %3) {
%5 = alloca i8*
store i8* %0, i8** %5
%6 = icmp eq i8* %0, null
br i1 %6, label %46, label %7
7: ; preds = %4
%8 = load i8, i8* %0
%9 = sext i8 %8 to i32
%10 = add i8 %8, -65
%11 = icmp ult i8 %10, 26
%12 = add nsw i32 %9, 32
%13 = select i1 %11, i32 %12, i32 %9
%14 = sext i8 %3 to i32
%15 = icmp eq i32 %13, %14
br i1 %15, label %16, label %21
16: ; preds = %7
%17 = getelementptr inbounds i8, i8* %0, i64 1
store i8* %17, i8** %5
%18 = tail call i32 @sscanf(i8* %17, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %2)
%19 = icmp eq i32 %18, 1
%20 = zext i1 %19 to i32
br label %46
21: ; preds = %7
%22 = call i8* @iStrDupUntilNoCase(i8** %5, i8 signext %3)
%23 = icmp eq i8* %22, null
%24 = load i8*, i8** %5
br i1 %23, label %25, label %29
25: ; preds = %21
%26 = call i32 @sscanf(i8* %24, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %1)
%27 = icmp eq i32 %26, 1
%28 = zext i1 %27 to i32
br label %46
29: ; preds = %21
%30 = load i8, i8* %24
%31 = icmp eq i8 %30, 0
%32 = call i32 @sscanf(i8* %22, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %1)
br i1 %31, label %33, label %37
33: ; preds = %29
%34 = call i32 @free(i8* %22)
%35 = icmp eq i32 %32, 1
%36 = zext i1 %35 to i32
br label %46
37: ; preds = %29
%38 = icmp eq i32 %32, 1
%39 = zext i1 %38 to i32
%40 = load i8*, i8** %5
%41 = call i32 @sscanf(i8* %40, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %2)
%42 = icmp eq i32 %41, 1
%43 = select i1 %38, i32 2, i32 1
%44 = select i1 %42, i32 %43, i32 %39
%45 = call i32 @free(i8* %22)
br label %46
46: ; preds = %33, %37, %25, %16, %4
%47 = phi i32 [ 0, %4 ], [ %20, %16 ], [ %36, %33 ], [ %44, %37 ], [ %28, %25 ]
ret i32 %47
}