#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 *);
int /*<<< orphan*/ *strstr(char *, char *);
char *strtok(char *, char *);
int check_and_return_processor(char *strinfo) {
  char *t1;
  if (strstr(strinfo, "processor") != NULL) {
    strtok(strinfo, ":");
    t1 = strtok(NULL, " ");
    return (atoi(t1));
  } else {
    return (-1);
  }
}


x86 assembly (clang, -O0):
<check_and_return_processor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeb9(%rip),%rsi
call   1050 <strstr@plt>
cmp    $0x0,%rax
je     118b <check_and_return_processor+0x5b>
mov    -0x10(%rbp),%rdi
lea    0xea9(%rip),%rsi
call   1030 <strtok@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xe9b(%rip),%rsi
call   1030 <strtok@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x4(%rbp)
jmp    1192 <check_and_return_processor+0x62>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_and_return_processor>:
push   %rbx
mov    %rdi,%rbx
lea    0xec5(%rip),%rsi
call   1050 <strstr@plt>
test   %rax,%rax
je     116b <check_and_return_processor+0x3b>
lea    0xebe(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strtok@plt>
lea    0xeb1(%rip),%rsi
xor    %edi,%edi
call   1030 <strtok@plt>
mov    %rax,%rdi
pop    %rbx
jmp    1040 <atoi@plt>
mov    $0xffffffff,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"processor\00"
@.str.1 = [2 x i8] c":\00"
@.str.2 = [2 x i8] c" \00"
define i32 @check_and_return_processor(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32* @strstr(i8* %5, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%7 = icmp ne i32* %6, null
br i1 %7, label %8, label %14
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = call i8* @strtok(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%11 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i8* %11, i8** %4
%12 = load i8*, i8** %4
%13 = call i32 @atoi(i8* %12)
store i32 %13, i32* %2
br label %15
14: ; preds = %1
store i32 -1, i32* %2
br label %15
15: ; preds = %14, %8
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
@.str = [10 x i8] c"processor\00"
@.str.1 = [2 x i8] c":\00"
@.str.2 = [2 x i8] c" \00"
define i32 @check_and_return_processor(i8* %0) {
%2 = tail call i32* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i8* @strtok(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32 @atoi(i8* %6)
br label %8
8: ; preds = %1, %4
%9 = phi i32 [ %7, %4 ], [ -1, %1 ]
ret i32 %9
}