#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 sysfsparser_getvalue(char *, unsigned int);
char sysfsparser_path_exist(char *, unsigned int);
int get_processor_is_online(unsigned int cpu) {
  signed char path_exist = sysfsparser_path_exist("/sys/devices/system"
                                                  "/cpu"
                                                  "/cpu%u/online",
                                                  cpu);
  if (0 == path_exist)
    return -1;
  return sysfsparser_getvalue("/sys/devices/system"
                              "/cpu"
                              "/cpu%u/online",
                              cpu);
}


x86 assembly (clang, -O0):
<get_processor_is_online>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xecb(%rip),%rdi
call   1040 <sysfsparser_path_exist@plt>
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%ecx
xor    %eax,%eax
cmp    %ecx,%eax
jne    1157 <get_processor_is_online+0x37>
movl   $0xffffffff,-0x4(%rbp)
jmp    1169 <get_processor_is_online+0x49>
mov    -0x8(%rbp),%esi
lea    0xe9f(%rip),%rdi
call   1030 <sysfsparser_getvalue@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_processor_is_online>:
push   %rbx
mov    %edi,%ebx
lea    0xed6(%rip),%rdi
mov    %ebx,%esi
call   1040 <sysfsparser_path_exist@plt>
test   %al,%al
je     1144 <get_processor_is_online+0x24>
lea    0xec4(%rip),%rdi
mov    %ebx,%esi
pop    %rbx
jmp    1030 <sysfsparser_getvalue@plt>
mov    $0xffffffff,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [37 x i8] c"/sys/devices/system/cpu/cpu%u/online\00"
define i32 @get_processor_is_online(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = call signext i8 @sysfsparser_path_exist(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 %5)
store i8 %6, i8* %4
%7 = load i8, i8* %4
%8 = sext i8 %7 to i32
%9 = icmp eq i32 0, %8
br i1 %9, label %10, label %11
10: ; preds = %1
store i32 -1, i32* %2
br label %14
11: ; preds = %1
%12 = load i32, i32* %3
%13 = call i32 @sysfsparser_getvalue(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 %12)
store i32 %13, i32* %2
br label %14
14: ; preds = %11, %10
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
@.str = [37 x i8] c"/sys/devices/system/cpu/cpu%u/online\00"
define i32 @get_processor_is_online(i32 %0) {
%2 = tail call signext i8 @sysfsparser_path_exist(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = icmp eq i8 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @sysfsparser_getvalue(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ %5, %4 ], [ -1, %1 ]
ret i32 %7
}