#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 */
float atof(char *);
char *strstr(char *, char *);
void getrange(char *string, float *minval, float *maxval) {
  char *str;
  str = strstr(string, "to");
  if (str) {
    *str = '\0';
    *minval = atof(string);
    *maxval = atof(str + 2);
  } else {
    *minval = 0.0;
    *maxval = atof(string);
  }
}


x86 assembly (clang, -O0):
<getrange>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec1(%rip),%rsi
call   1040 <strstr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1185 <getrange+0x65>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
call   1030 <atof@plt>
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x20(%rbp),%rdi
add    $0x2,%rdi
call   1030 <atof@plt>
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
jmp    11a1 <getrange+0x81>
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax)
mov    -0x8(%rbp),%rdi
call   1030 <atof@plt>
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getrange>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
lea    0xec8(%rip),%rsi
call   1040 <strstr@plt>
test   %rax,%rax
je     115e <getrange+0x3e>
mov    %rax,%rbx
movb   $0x0,(%rax)
mov    %r12,%rdi
call   1030 <atof@plt>
movss  %xmm0,(%r15)
add    $0x2,%rbx
mov    %rbx,%rdi
jmp    1168 <getrange+0x48>
movl   $0x0,(%r15)
mov    %r12,%rdi
call   1030 <atof@plt>
movss  %xmm0,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"to\00"
define void @getrange(i8* %0, float* %1, float* %2) {
%4 = alloca i8*
%5 = alloca float*
%6 = alloca float*
%7 = alloca i8*
store i8* %0, i8** %4
store float* %1, float** %5
store float* %2, float** %6
%8 = load i8*, i8** %4
%9 = call i8* @strstr(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i8* %9, i8** %7
%10 = load i8*, i8** %7
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %21
12: ; preds = %3
%13 = load i8*, i8** %7
store i8 0, i8* %13
%14 = load i8*, i8** %4
%15 = call float @atof(i8* %14)
%16 = load float*, float** %5
store float %15, float* %16
%17 = load i8*, i8** %7
%18 = getelementptr inbounds i8, i8* %17, i64 2
%19 = call float @atof(i8* %18)
%20 = load float*, float** %6
store float %19, float* %20
br label %26
21: ; preds = %3
%22 = load float*, float** %5
store float 0.000000e+00, float* %22
%23 = load i8*, i8** %4
%24 = call float @atof(i8* %23)
%25 = load float*, float** %6
store float %24, float* %25
br label %26
26: ; preds = %21, %12
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"to\00"
define void @getrange(i8* %0, float* nocapture writeonly %1, float* nocapture writeonly %2) {
%4 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i8* %4, null
br i1 %5, label %10, label %6
6: ; preds = %3
store i8 0, i8* %4
%7 = tail call float @atof(i8* %0)
store float %7, float* %1
%8 = getelementptr inbounds i8, i8* %4, i64 2
%9 = tail call float @atof(i8* %8)
br label %12
10: ; preds = %3
store float 0.000000e+00, float* %1
%11 = tail call float @atof(i8* %0)
br label %12
12: ; preds = %10, %6
%13 = phi float [ %11, %10 ], [ %9, %6 ]
store float %13, float* %2
ret void
}