#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 atof(char *);
double strtod(char const *, char **);
int splitRangeChar(const char *charBS, double *low, double *high, char *retch) {
  int retvalue = 0;
  if (charBS) {
    char *endp = NULL;
    *low = strtod(charBS, &endp);
    *high = *low;
    retvalue = 1;
    if ((*endp == '-') || (*endp == '_')) {
      if (retch) {
        *retch = *endp;
      }
      *high = atof(endp + 1);
      retvalue = 2;
    }
  }
  return retvalue;
}


x86 assembly (clang, -O0):
<splitRangeChar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     11d6 <splitRangeChar+0xb6>
movq   $0x0,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1030 <strtod@plt>
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x1,-0x24(%rbp)
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
je     119e <splitRangeChar+0x7e>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5f,%eax
jne    11d1 <splitRangeChar+0xb1>
cmpq   $0x0,-0x20(%rbp)
je     11b5 <splitRangeChar+0x95>
mov    -0x30(%rbp),%rax
mov    (%rax),%cl
mov    -0x20(%rbp),%rax
mov    %cl,(%rax)
mov    -0x30(%rbp),%rdi
add    $0x1,%rdi
call   1040 <atof@plt>
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x2,-0x24(%rbp)
jmp    11d6 <splitRangeChar+0xb6>
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<splitRangeChar>:
test   %rdi,%rdi
je     118e <splitRangeChar+0x6e>
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%rbx
movq   $0x0,0x8(%rsp)
lea    0x8(%rsp),%rsi
call   1030 <strtod@plt>
movsd  %xmm0,(%rbx)
movsd  %xmm0,(%r15)
mov    0x8(%rsp),%rdi
mov    (%rdi),%cl
cmp    $0x5f,%cl
je     1169 <splitRangeChar+0x49>
mov    $0x1,%eax
cmp    $0x2d,%cl
jne    1184 <splitRangeChar+0x64>
test   %r14,%r14
je     1171 <splitRangeChar+0x51>
mov    %cl,(%r14)
add    $0x1,%rdi
call   1040 <atof@plt>
movsd  %xmm0,(%r15)
mov    $0x2,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @splitRangeChar(i8* %0, double* %1, double* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca double*
%7 = alloca double*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i8*
store i8* %0, i8** %5
store double* %1, double** %6
store double* %2, double** %7
store i8* %3, i8** %8
store i32 0, i32* %9
%11 = load i8*, i8** %5
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %42
13: ; preds = %4
store i8* null, i8** %10
%14 = load i8*, i8** %5
%15 = call double @strtod(i8* %14, i8** %10)
%16 = load double*, double** %6
store double %15, double* %16
%17 = load double*, double** %6
%18 = load double, double* %17
%19 = load double*, double** %7
store double %18, double* %19
store i32 1, i32* %9
%20 = load i8*, i8** %10
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 45
br i1 %23, label %29, label %24
24: ; preds = %13
%25 = load i8*, i8** %10
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 95
br i1 %28, label %29, label %41
29: ; preds = %24, %13
%30 = load i8*, i8** %8
%31 = icmp ne i8* %30, null
br i1 %31, label %32, label %36
32: ; preds = %29
%33 = load i8*, i8** %10
%34 = load i8, i8* %33
%35 = load i8*, i8** %8
store i8 %34, i8* %35
br label %36
36: ; preds = %32, %29
%37 = load i8*, i8** %10
%38 = getelementptr inbounds i8, i8* %37, i64 1
%39 = call double @atof(i8* %38)
%40 = load double*, double** %7
store double %39, double* %40
store i32 2, i32* %9
br label %41
41: ; preds = %36, %24
br label %42
42: ; preds = %41, %4
%43 = load i32, i32* %9
ret i32 %43
}

LLVM IR (-O2):
define i32 @splitRangeChar(i8* %0, double* nocapture writeonly %1, double* nocapture writeonly %2, i8* writeonly %3) {
%5 = alloca i8*
%6 = icmp eq i8* %0, null
br i1 %6, label %20, label %7
7: ; preds = %4
%8 = bitcast i8** %5 to i8*
store i8* null, i8** %5
%9 = call double @strtod(i8* %0, i8** %5)
store double %9, double* %1
store double %9, double* %2
%10 = load i8*, i8** %5
%11 = load i8, i8* %10
switch i8 %11, label %18 [
i8 45, label %12
i8 95, label %12
]
12: ; preds = %7, %7
%13 = icmp eq i8* %3, null
br i1 %13, label %15, label %14
14: ; preds = %12
store i8 %11, i8* %3
br label %15
15: ; preds = %14, %12
%16 = getelementptr inbounds i8, i8* %10, i64 1
%17 = tail call double @atof(i8* %16)
store double %17, double* %2
br label %18
18: ; preds = %7, %15
%19 = phi i32 [ 2, %15 ], [ 1, %7 ]
br label %20
20: ; preds = %18, %4
%21 = phi i32 [ %19, %18 ], [ 0, %4 ]
ret i32 %21
}