#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*/ get_proc_cpuinfo_data(char *, char *, int /*<<< orphan*/);
int generic_get_cpu_family() {
  char buffer[512];
  if (!get_proc_cpuinfo_data("cpu family", buffer, 0))
    return atoi(buffer);
  else if (!get_proc_cpuinfo_data("family", buffer, 0))
    return atoi(buffer);
  else
    return -1;
}


x86 assembly (clang, -O0):
<generic_get_cpu_family>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
lea    -0x210(%rbp),%rsi
lea    0xec7(%rip),%rdi
xor    %edx,%edx
call   1030 <get_proc_cpuinfo_data@plt>
cmp    $0x0,%eax
jne    115d <generic_get_cpu_family+0x3d>
lea    -0x210(%rbp),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x4(%rbp)
jmp    1196 <generic_get_cpu_family+0x76>
lea    -0x210(%rbp),%rsi
lea    0xe99(%rip),%rdi
xor    %edx,%edx
call   1030 <get_proc_cpuinfo_data@plt>
cmp    $0x0,%eax
jne    118f <generic_get_cpu_family+0x6f>
lea    -0x210(%rbp),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x4(%rbp)
jmp    1196 <generic_get_cpu_family+0x76>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generic_get_cpu_family>:
sub    $0x208,%rsp
lea    0xed2(%rip),%rdi
mov    %rsp,%rsi
xor    %edx,%edx
call   1030 <get_proc_cpuinfo_data@plt>
test   %eax,%eax
je     1160 <generic_get_cpu_family+0x40>
lea    0xec1(%rip),%rdi
mov    %rsp,%rsi
xor    %edx,%edx
call   1030 <get_proc_cpuinfo_data@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
test   %ecx,%ecx
je     1160 <generic_get_cpu_family+0x40>
add    $0x208,%rsp
ret
mov    %rsp,%rdi
call   1040 <atoi@plt>
add    $0x208,%rsp
ret

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

LLVM IR (-O2):
@.str = [11 x i8] c"cpu family\00"
@.str.1 = [7 x i8] c"family\00"
define i32 @generic_get_cpu_family() {
%1 = alloca [512 x i8]
%2 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 0
%3 = call i32 @get_proc_cpuinfo_data(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %2, i32 0)
%4 = icmp eq i32 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %0
%6 = call i32 @get_proc_cpuinfo_data(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %2, i32 0)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %5, %0
%9 = call i32 @atoi(i8* %2)
br label %10
10: ; preds = %8, %5
%11 = phi i32 [ -1, %5 ], [ %9, %8 ]
ret i32 %11
}