#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 */
typedef int /*<<< orphan*/ off_t;

/* Variables and functions */
int /*<<< orphan*/ strtoll(char const *, char **, int /*<<< orphan*/);
int parse_intrange(const char *s, off_t *a, off_t *b) {
  char *p;
  *a = strtoll(s, &p, 0);
  if (!p || !*p) {
    *b = *a;
    return 1;
  }
  if (*p != '-')
    return 0;
  p++;
  *b = strtoll(p, &p, 0);
  return 1;
}


x86 assembly (clang, -O0):
<parse_intrange>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x28(%rbp),%rsi
xor    %edx,%edx
call   1030 <strtoll@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
cmpq   $0x0,-0x28(%rbp)
je     1153 <parse_intrange+0x43>
mov    -0x28(%rbp),%rax
cmpb   $0x0,(%rax)
jne    116b <parse_intrange+0x5b>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    11b1 <parse_intrange+0xa1>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
je     1187 <parse_intrange+0x77>
movl   $0x0,-0x4(%rbp)
jmp    11b1 <parse_intrange+0xa1>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
lea    -0x28(%rbp),%rsi
xor    %edx,%edx
call   1030 <strtoll@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_intrange>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
lea    0x8(%rsp),%rsi
xor    %ebp,%ebp
xor    %edx,%edx
call   1030 <strtoll@plt>
mov    %eax,(%rbx)
mov    0x8(%rsp),%rdi
test   %rdi,%rdi
je     1158 <parse_intrange+0x48>
mov    (%rdi),%cl
test   %cl,%cl
je     1158 <parse_intrange+0x48>
cmp    $0x2d,%cl
jne    1160 <parse_intrange+0x50>
add    $0x1,%rdi
mov    %rdi,0x8(%rsp)
lea    0x8(%rsp),%rsi
xor    %edx,%edx
call   1030 <strtoll@plt>
mov    %eax,(%r14)
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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