#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 atoi(char *);
char *strchr(char *, char);
void parserange(char *s, int *min, int *max) {
  char *p = strchr(s, '-');
  if (p == NULL)
    *min = *max = atoi(s);
  else {
    *min = atoi(s);
    *max = atoi(p + 1);
  }
}


x86 assembly (clang, -O0):
<parserange>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2d,%esi
call   1030 <strchr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    116d <parserange+0x4d>
mov    -0x8(%rbp),%rdi
call   1040 <atoi@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
jmp    1193 <parserange+0x73>
mov    -0x8(%rbp),%rdi
call   1040 <atoi@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%rdi
add    $0x1,%rdi
call   1040 <atoi@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parserange>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
mov    $0x2d,%esi
call   1030 <strchr@plt>
mov    %rax,%rbx
mov    %r12,%rdi
call   1040 <atoi@plt>
test   %rbx,%rbx
je     115f <parserange+0x3f>
mov    %eax,(%r15)
add    $0x1,%rbx
mov    %rbx,%rdi
call   1040 <atoi@plt>
mov    %eax,(%r14)
jmp    1165 <parserange+0x45>
mov    %eax,(%r14)
mov    %eax,(%r15)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @parserange(i8* %0, i32* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i8*
store i8* %0, i8** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%8 = load i8*, i8** %4
%9 = call i8* @strchr(i8* %8, i8 signext 45)
store i8* %9, i8** %7
%10 = load i8*, i8** %7
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %17
12: ; preds = %3
%13 = load i8*, i8** %4
%14 = call i32 @atoi(i8* %13)
%15 = load i32*, i32** %6
store i32 %14, i32* %15
%16 = load i32*, i32** %5
store i32 %14, i32* %16
br label %25
17: ; preds = %3
%18 = load i8*, i8** %4
%19 = call i32 @atoi(i8* %18)
%20 = load i32*, i32** %5
store i32 %19, i32* %20
%21 = load i8*, i8** %7
%22 = getelementptr inbounds i8, i8* %21, i64 1
%23 = call i32 @atoi(i8* %22)
%24 = load i32*, i32** %6
store i32 %23, i32* %24
br label %25
25: ; preds = %17, %12
ret void
}

LLVM IR (-O2):
define void @parserange(i8* %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2) {
%4 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 45)
%5 = icmp eq i8* %4, null
%6 = tail call i32 @atoi(i8* %0)
br i1 %5, label %7, label %8
7: ; preds = %3
store i32 %6, i32* %2
store i32 %6, i32* %1
br label %11
8: ; preds = %3
store i32 %6, i32* %1
%9 = getelementptr inbounds i8, i8* %4, i64 1
%10 = tail call i32 @atoi(i8* %9)
store i32 %10, i32* %2
br label %11
11: ; preds = %8, %7
ret void
}