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


x86 assembly (clang, -O0):
<splitRange>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     11bb <splitRange+0x9b>
movq   $0x0,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x28(%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,-0x1c(%rbp)
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
je     119a <splitRange+0x7a>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5f,%eax
jne    11b6 <splitRange+0x96>
mov    -0x28(%rbp),%rdi
add    $0x1,%rdi
call   1040 <atof@plt>
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x2,-0x1c(%rbp)
jmp    11bb <splitRange+0x9b>
mov    -0x1c(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<splitRange>:
test   %rdi,%rdi
je     1178 <splitRange+0x58>
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
movq   $0x0,(%rsp)
mov    %rsp,%rsi
call   1030 <strtod@plt>
movsd  %xmm0,(%rbx)
movsd  %xmm0,(%r14)
mov    (%rsp),%rdi
mov    (%rdi),%cl
cmp    $0x5f,%cl
je     115d <splitRange+0x3d>
mov    $0x1,%eax
cmp    $0x2d,%cl
jne    1170 <splitRange+0x50>
add    $0x1,%rdi
call   1040 <atof@plt>
movsd  %xmm0,(%r14)
mov    $0x2,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
xor    %eax,%eax
ret

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

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