#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 */
char *strchr(char *, char);
char *strpbrk(char *, char *);
long strtol(char *, char **, int);
int /*<<< orphan*/ valid_int(long);
void get_number_prev(int *number, int *start, int *end, char *line) {
  char *endptr;
  char *num = strpbrk(line, "0123456789");
  long int check = strtol(num, &endptr, 10);
  if (!valid_int(check))
    *number = -1;
  else {
    *number = (int)check;
    num = strchr(num, ' ');
    num = strpbrk(num, "0123456789");
    check = strtol(num, &endptr, 10);
    if (!valid_int(check))
      *start = -1;
    else {
      *start = (int)check;
      num = strchr(num, ' ');
      num = strpbrk(num, "0123456789");
      check = strtol(num, &endptr, 10);
      if (!valid_int(check))
        *end = -1;
      else
        *end = (int)check;
    }
  }
}


x86 assembly (clang, -O0):
<get_number_prev>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xe9d(%rip),%rsi
call   1050 <strpbrk@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
lea    -0x28(%rbp),%rsi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
call   1060 <valid_int@plt>
cmp    $0x0,%eax
jne    11a3 <get_number_prev+0x63>
mov    -0x8(%rbp),%rax
movl   $0xffffffff,(%rax)
jmp    128b <get_number_prev+0x14b>
mov    -0x38(%rbp),%rax
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x30(%rbp),%rdi
mov    $0x20,%esi
call   1030 <strchr@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
lea    0xe34(%rip),%rsi
call   1050 <strpbrk@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
lea    -0x28(%rbp),%rsi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
call   1060 <valid_int@plt>
cmp    $0x0,%eax
jne    120c <get_number_prev+0xcc>
mov    -0x10(%rbp),%rax
movl   $0xffffffff,(%rax)
jmp    1286 <get_number_prev+0x146>
mov    -0x38(%rbp),%rax
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x30(%rbp),%rdi
mov    $0x20,%esi
call   1030 <strchr@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
lea    0xdcb(%rip),%rsi
call   1050 <strpbrk@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
lea    -0x28(%rbp),%rsi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
call   1060 <valid_int@plt>
cmp    $0x0,%eax
jne    1275 <get_number_prev+0x135>
mov    -0x18(%rbp),%rax
movl   $0xffffffff,(%rax)
jmp    1281 <get_number_prev+0x141>
mov    -0x38(%rbp),%rax
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    1286 <get_number_prev+0x146>
jmp    128b <get_number_prev+0x14b>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_number_prev>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
lea    0xea3(%rip),%rsi
mov    %rcx,%rdi
call   1050 <strpbrk@plt>
mov    %rax,%r13
lea    0x8(%rsp),%rsi
mov    %rax,%rdi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <valid_int@plt>
test   %eax,%eax
je     1216 <get_number_prev+0xd6>
mov    %ebx,(%r12)
mov    %r13,%rdi
mov    $0x20,%esi
call   1030 <strchr@plt>
lea    0xe5b(%rip),%rsi
mov    %rax,%rdi
call   1050 <strpbrk@plt>
mov    %rax,%r12
lea    0x8(%rsp),%rsi
mov    %rax,%rdi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <valid_int@plt>
test   %eax,%eax
je     1220 <get_number_prev+0xe0>
mov    %ebx,(%r15)
mov    %r12,%rdi
mov    $0x20,%esi
call   1030 <strchr@plt>
lea    0xe18(%rip),%rsi
mov    %rax,%rdi
call   1050 <strpbrk@plt>
lea    0x8(%rsp),%rsi
mov    %rax,%rdi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <valid_int@plt>
test   %eax,%eax
je     1229 <get_number_prev+0xe9>
mov    %ebx,(%r14)
jmp    1230 <get_number_prev+0xf0>
movl   $0xffffffff,(%r12)
ff
jmp    1230 <get_number_prev+0xf0>
movl   $0xffffffff,(%r15)
jmp    1230 <get_number_prev+0xf0>
movl   $0xffffffff,(%r14)
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [11 x i8] c"0123456789\00"
define void @get_number_prev(i32* %0, i32* %1, i32* %2, i8* %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i64
store i32* %0, i32** %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i8* %3, i8** %8
%12 = load i8*, i8** %8
%13 = call i8* @strpbrk(i8* %12, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
store i8* %13, i8** %10
%14 = load i8*, i8** %10
%15 = call i64 @strtol(i8* %14, i8** %9, i32 10)
store i64 %15, i64* %11
%16 = load i64, i64* %11
%17 = call i32 @valid_int(i64 %16)
%18 = icmp ne i32 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %4
%20 = load i32*, i32** %5
store i32 -1, i32* %20
br label %57
21: ; preds = %4
%22 = load i64, i64* %11
%23 = trunc i64 %22 to i32
%24 = load i32*, i32** %5
store i32 %23, i32* %24
%25 = load i8*, i8** %10
%26 = call i8* @strchr(i8* %25, i8 signext 32)
store i8* %26, i8** %10
%27 = load i8*, i8** %10
%28 = call i8* @strpbrk(i8* %27, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
store i8* %28, i8** %10
%29 = load i8*, i8** %10
%30 = call i64 @strtol(i8* %29, i8** %9, i32 10)
store i64 %30, i64* %11
%31 = load i64, i64* %11
%32 = call i32 @valid_int(i64 %31)
%33 = icmp ne i32 %32, 0
br i1 %33, label %36, label %34
34: ; preds = %21
%35 = load i32*, i32** %6
store i32 -1, i32* %35
br label %56
36: ; preds = %21
%37 = load i64, i64* %11
%38 = trunc i64 %37 to i32
%39 = load i32*, i32** %6
store i32 %38, i32* %39
%40 = load i8*, i8** %10
%41 = call i8* @strchr(i8* %40, i8 signext 32)
store i8* %41, i8** %10
%42 = load i8*, i8** %10
%43 = call i8* @strpbrk(i8* %42, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
store i8* %43, i8** %10
%44 = load i8*, i8** %10
%45 = call i64 @strtol(i8* %44, i8** %9, i32 10)
store i64 %45, i64* %11
%46 = load i64, i64* %11
%47 = call i32 @valid_int(i64 %46)
%48 = icmp ne i32 %47, 0
br i1 %48, label %51, label %49
49: ; preds = %36
%50 = load i32*, i32** %7
store i32 -1, i32* %50
br label %55
51: ; preds = %36
%52 = load i64, i64* %11
%53 = trunc i64 %52 to i32
%54 = load i32*, i32** %7
store i32 %53, i32* %54
br label %55
55: ; preds = %51, %49
br label %56
56: ; preds = %55, %34
br label %57
57: ; preds = %56, %19
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"0123456789\00"
define void @get_number_prev(i32* nocapture writeonly %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2, i8* %3) {
%5 = alloca i8*
%6 = bitcast i8** %5 to i8*
%7 = tail call i8* @strpbrk(i8* %3, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%8 = call i64 @strtol(i8* %7, i8** %5, i32 10)
%9 = tail call i32 @valid_int(i64 %8)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %4
store i32 -1, i32* %0
br label %30
12: ; preds = %4
%13 = trunc i64 %8 to i32
store i32 %13, i32* %0
%14 = tail call i8* @strchr(i8* dereferenceable(1) %7, i8 signext 32)
%15 = tail call i8* @strpbrk(i8* %14, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%16 = call i64 @strtol(i8* %15, i8** %5, i32 10)
%17 = tail call i32 @valid_int(i64 %16)
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %12
store i32 -1, i32* %1
br label %30
20: ; preds = %12
%21 = trunc i64 %16 to i32
store i32 %21, i32* %1
%22 = tail call i8* @strchr(i8* dereferenceable(1) %15, i8 signext 32)
%23 = tail call i8* @strpbrk(i8* %22, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%24 = call i64 @strtol(i8* %23, i8** %5, i32 10)
%25 = tail call i32 @valid_int(i64 %24)
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %20
store i32 -1, i32* %2
br label %30
28: ; preds = %20
%29 = trunc i64 %24 to i32
store i32 %29, i32* %2
br label %30
30: ; preds = %19, %28, %27, %11
ret void
}