#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*/ FILE;

/* Variables and functions */
int BUFSIZ;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
char *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sscanf(char *, char *, ...);
scalar_t__ strncmp(char *, char *, int);
int detect_cpu(void) {
  FILE *fff;
  int family, model = -1;
  char buffer[BUFSIZ], *result;
  char vendor[BUFSIZ];
  int is_core2 = -1;
  fff = fopen("/proc/cpuinfo", "r");
  if (fff == NULL)
    return -1;
  while (1) {
    result = fgets(buffer, BUFSIZ, fff);
    if (result == NULL)
      break;
    if (!strncmp(result, "vendor_id", 8)) {
      sscanf(result, "%*s%*s%s", vendor);
      if (strncmp(vendor, "GenuineIntel", 12)) {
        printf("%s not an Intel chip\n", vendor);
        return -1;
      }
    }
    if (!strncmp(result, "cpu family", 10)) {
      sscanf(result, "%*s%*s%*s%d", &family);
      if (family != 6) {
        printf("Wrong CPU family %d\n", family);
        return -1;
      }
    }
    if (!strncmp(result, "model", 5)) {
      sscanf(result, "%*s%*s%d", &model);
    }
  }
  fclose(fff);
  switch (model) {
  case 26:
  case 30:
  case 31:
    printf("Found Nehalem CPU\n");
    is_core2 = 0;
    break;
  case 46:
    printf("Found Nehalem-EX CPU\n");
    is_core2 = 0;
    break;
  case 37:
  case 44:
    printf("Found Westmere CPU\n");
    is_core2 = 0;
    break;
  case 47:
    printf("Found Westmere-EX CPU\n");
    is_core2 = 0;
    break;
  case 42:
    printf("Found Sandybridge CPU\n");
    is_core2 = 0;
    break;
  case 45:
    printf("Found Sandybridge-EP CPU\n");
    is_core2 = 0;
    break;
  case 58:
    printf("Found Ivybridge CPU\n");
    is_core2 = 0;
    break;
  case 62:
    printf("Found Ivybridge-EP CPU\n");
    is_core2 = 0;
    break;
  case 60:
  case 69:
  case 70:
    printf("Found Haswell CPU\n");
    is_core2 = 0;
    break;
  case 63:
    printf("Found Haswell-EP CPU\n");
    is_core2 = 0;
    break;
  case 61:
  case 71:
    printf("Found Broadwell CPU\n");
    is_core2 = 0;
    break;
  case 86:
  case 79:
    printf("Found Broadwell-DE/EP CPU\n");
    is_core2 = 0;
    break;
  case 78:
  case 94:
    printf("Found Skylake CPU\n");
    is_core2 = 0;
    break;
  case 85:
    printf("Found Skylake / Cascadelake Server CPU\n");
    is_core2 = 0;
    break;
  case 142:
  case 158:
    printf("Found Kabylake CPU\n");
    is_core2 = 0;
    break;
  case 15:
  case 22:
  case 23:
  case 29:
    printf("Found Core2 CPU\n");
    is_core2 = 1;
    break;
    break;
  default:
    printf("Unsupported model %d\n", model);
    is_core2 = -1;
    break;
  }
  return is_core2;
}


x86 assembly (clang, -O0):
<detect_cpu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0xffffffff,-0x18(%rbp)
mov    0x2e6a(%rip),%rax
mov    (%rax),%ecx
mov    %rsp,%rdx
mov    %rdx,-0x20(%rbp)
mov    %rcx,%rsi
add    $0xf,%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rdx
sub    %rsi,%rdx
mov    %rdx,-0x50(%rbp)
mov    %rdx,%rsp
mov    %rcx,-0x28(%rbp)
mov    (%rax),%eax
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x48(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x38(%rbp)
movl   $0xffffffff,-0x3c(%rbp)
lea    0x1079(%rip),%rdi
lea    0x1080(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11f5 <detect_cpu+0x95>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x40(%rbp)
jmp    1542 <detect_cpu+0x3e2>
jmp    11fa <detect_cpu+0x9a>
jmp    11ff <detect_cpu+0x9f>
mov    -0x50(%rbp),%rdi
mov    0x2dd6(%rip),%rax
mov    (%rax),%esi
mov    -0x10(%rbp),%rdx
call   1060 <fgets@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1229 <detect_cpu+0xc9>
jmp    1349 <detect_cpu+0x1e9>
mov    -0x30(%rbp),%rdi
lea    0x101c(%rip),%rsi
mov    $0x8,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    12a7 <detect_cpu+0x147>
mov    -0x48(%rbp),%rdx
mov    -0x30(%rbp),%rdi
lea    0x1003(%rip),%rsi
mov    $0x0,%al
call   1070 <sscanf@plt>
mov    -0x48(%rbp),%rdi
lea    0xffa(%rip),%rsi
mov    $0xc,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     12a2 <detect_cpu+0x142>
mov    -0x48(%rbp),%rsi
lea    0xfe8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x40(%rbp)
jmp    1542 <detect_cpu+0x3e2>
jmp    12a7 <detect_cpu+0x147>
mov    -0x30(%rbp),%rdi
lea    0xfd4(%rip),%rsi
mov    $0xa,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    130f <detect_cpu+0x1af>
mov    -0x30(%rbp),%rdi
lea    0xfc0(%rip),%rsi
lea    -0x14(%rbp),%rdx
mov    $0x0,%al
call   1070 <sscanf@plt>
cmpl   $0x6,-0x14(%rbp)
je     130a <detect_cpu+0x1aa>
mov    -0x14(%rbp),%esi
lea    0xfad(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x40(%rbp)
jmp    1542 <detect_cpu+0x3e2>
jmp    130f <detect_cpu+0x1af>
mov    -0x30(%rbp),%rdi
lea    0xf98(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1344 <detect_cpu+0x1e4>
mov    -0x30(%rbp),%rdi
lea    0xf5b(%rip),%rsi
lea    -0x18(%rbp),%rdx
mov    $0x0,%al
call   1070 <sscanf@plt>
jmp    11fa <detect_cpu+0x9a>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x18(%rbp),%eax
add    $0xfffffff1,%eax
mov    %eax,%ecx
mov    %rcx,-0x58(%rbp)
sub    $0x8f,%eax
ja     151d <detect_cpu+0x3bd>
mov    -0x58(%rbp),%rax
lea    0xc8c(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf34(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x3c(%rbp)
jmp    1535 <detect_cpu+0x3d5>
lea    0xf2d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x3c(%rbp)
jmp    1535 <detect_cpu+0x3d5>
lea    0xf29(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x3c(%rbp)
jmp    1535 <detect_cpu+0x3d5>
lea    0xf23(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x3c(%rbp)
jmp    1535 <detect_cpu+0x3d5>
lea    0xf20(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x3c(%rbp)
jmp    1535 <detect_cpu+0x3d5>
lea    0xf1d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x3c(%rbp)
jmp    1535 <detect_cpu+0x3d5>
lea    0xf1d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x3c(%rbp)
jmp    1535 <detect_cpu+0x3d5>
lea    0xf18(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x3c(%rbp)
jmp    1535 <detect_cpu+0x3d5>
lea    0xf16(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x3c(%rbp)
jmp    1535 <detect_cpu+0x3d5>
lea    0xf0f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x3c(%rbp)
jmp    1535 <detect_cpu+0x3d5>
lea    0xf0b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x3c(%rbp)
jmp    1535 <detect_cpu+0x3d5>
lea    0xf06(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x3c(%rbp)
jmp    1535 <detect_cpu+0x3d5>
lea    0xf07(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x3c(%rbp)
jmp    1535 <detect_cpu+0x3d5>
lea    0xf00(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x3c(%rbp)
jmp    1535 <detect_cpu+0x3d5>
lea    0xf0e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x3c(%rbp)
jmp    1535 <detect_cpu+0x3d5>
lea    0xf08(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x3c(%rbp)
jmp    1535 <detect_cpu+0x3d5>
mov    -0x18(%rbp),%esi
lea    0xefc(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x40(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<detect_cpu>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsp,%r14
movl   $0xffffffff,-0x34(%rbp)
mov    0x2e4e(%rip),%r13
mov    0x0(%r13),%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    0x0(%r13),%eax
mov    %rsp,%r15
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r15
mov    %r15,%rsp
lea    0x107d(%rip),%rdi
lea    0x1084(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%r12
mov    $0xffffffff,%eax
test   %r12,%r12
je     13f1 <detect_cpu+0x281>
mov    %r14,-0x30(%rbp)
mov    0x0(%r13),%esi
mov    %rbx,%rdi
mov    %r12,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
je     12e7 <detect_cpu+0x177>
mov    %rax,%r13
lea    0x10ac(%rip),%r14
jmp    1230 <detect_cpu+0xc0>
nopl   0x0(%rax,%rax,1)
mov    0x2dc9(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
mov    %r12,%rdx
call   1070 <fgets@plt>
mov    %rax,%r13
test   %rax,%rax
je     12e7 <detect_cpu+0x177>
mov    %r13,%rdi
lea    0x1016(%rip),%rsi
mov    $0x8,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    127a <detect_cpu+0x10a>
mov    %r13,%rdi
lea    0x1007(%rip),%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1080 <sscanf@plt>
mov    %r15,%rdi
lea    0xffc(%rip),%rsi
mov    $0xc,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    1326 <detect_cpu+0x1b6>
mov    %r13,%rdi
lea    0x1002(%rip),%rsi
mov    $0xa,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    12b4 <detect_cpu+0x144>
mov    %r13,%rdi
lea    0xff4(%rip),%rsi
lea    -0x38(%rbp),%rdx
xor    %eax,%eax
call   1080 <sscanf@plt>
mov    -0x38(%rbp),%esi
cmp    $0x6,%esi
jne    1339 <detect_cpu+0x1c9>
mov    %r13,%rdi
mov    %r14,%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    1210 <detect_cpu+0xa0>
mov    %r13,%rdi
lea    0xfbd(%rip),%rsi
lea    -0x34(%rbp),%rdx
xor    %eax,%eax
call   1080 <sscanf@plt>
jmp    1210 <detect_cpu+0xa0>
mov    %r12,%rdi
call   1050 <fclose@plt>
mov    -0x34(%rbp),%esi
lea    -0xf(%rsi),%eax
cmp    $0x8f,%eax
ja     1397 <detect_cpu+0x227>
lea    0xcf9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xfb7(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%eax
jmp    13ed <detect_cpu+0x27d>
lea    0xf43(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    1347 <detect_cpu+0x1d7>
lea    0xf5d(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    -0x30(%rbp),%r14
mov    $0xffffffff,%eax
jmp    13f1 <detect_cpu+0x281>
lea    0x10bb(%rip),%rdi
jmp    13e6 <detect_cpu+0x276>
lea    0x1005(%rip),%rdi
jmp    13e6 <detect_cpu+0x276>
lea    0x107e(%rip),%rdi
jmp    13e6 <detect_cpu+0x276>
lea    0xfca(%rip),%rdi
jmp    13e6 <detect_cpu+0x276>
lea    0xf95(%rip),%rdi
jmp    13e6 <detect_cpu+0x276>
lea    0xf9e(%rip),%rdi
jmp    13e6 <detect_cpu+0x276>
lea    0xf49(%rip),%rdi
jmp    13e6 <detect_cpu+0x276>
lea    0xf1a(%rip),%rdi
jmp    1340 <detect_cpu+0x1d0>
lea    0x101c(%rip),%rdi
jmp    13e6 <detect_cpu+0x276>
lea    0xffa(%rip),%rdi
jmp    13e6 <detect_cpu+0x276>
lea    0x1049(%rip),%rdi
jmp    13e6 <detect_cpu+0x276>
lea    0x1017(%rip),%rdi
jmp    13e6 <detect_cpu+0x276>
lea    0xfcb(%rip),%rdi
jmp    13e6 <detect_cpu+0x276>
lea    0xfab(%rip),%rdi
jmp    13e6 <detect_cpu+0x276>
lea    0xf7b(%rip),%rdi
jmp    13e6 <detect_cpu+0x276>
lea    0xf0b(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
mov    -0x30(%rbp),%r14
mov    %r14,%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@BUFSIZ = global i32 0
@.str = [14 x i8] c"/proc/cpuinfo\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [10 x i8] c"vendor_id\00"
@.str.3 = [9 x i8] c"%*s%*s%s\00"
@.str.4 = [13 x i8] c"GenuineIntel\00"
@.str.5 = [22 x i8] c"%s not an Intel chip\0A\00"
@.str.6 = [11 x i8] c"cpu family\00"
@.str.7 = [12 x i8] c"%*s%*s%*s%d\00"
@.str.8 = [21 x i8] c"Wrong CPU family %d\0A\00"
@.str.9 = [6 x i8] c"model\00"
@.str.10 = [9 x i8] c"%*s%*s%d\00"
@.str.11 = [19 x i8] c"Found Nehalem CPU\0A\00"
@.str.12 = [22 x i8] c"Found Nehalem-EX CPU\0A\00"
@.str.13 = [20 x i8] c"Found Westmere CPU\0A\00"
@.str.14 = [23 x i8] c"Found Westmere-EX CPU\0A\00"
@.str.15 = [23 x i8] c"Found Sandybridge CPU\0A\00"
@.str.16 = [26 x i8] c"Found Sandybridge-EP CPU\0A\00"
@.str.17 = [21 x i8] c"Found Ivybridge CPU\0A\00"
@.str.18 = [24 x i8] c"Found Ivybridge-EP CPU\0A\00"
@.str.19 = [19 x i8] c"Found Haswell CPU\0A\00"
@.str.20 = [22 x i8] c"Found Haswell-EP CPU\0A\00"
@.str.21 = [21 x i8] c"Found Broadwell CPU\0A\00"
@.str.22 = [27 x i8] c"Found Broadwell-DE/EP CPU\0A\00"
@.str.23 = [19 x i8] c"Found Skylake CPU\0A\00"
@.str.24 = [40 x i8] c"Found Skylake / Cascadelake Server CPU\0A\00"
@.str.25 = [20 x i8] c"Found Kabylake CPU\0A\00"
@.str.26 = [17 x i8] c"Found Core2 CPU\0A\00"
@.str.27 = [22 x i8] c"Unsupported model %d\0A\00"
define i32 @detect_cpu() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i32
%10 = alloca i32
store i32 -1, i32* %4
%11 = load i32, i32* @BUFSIZ
%12 = zext i32 %11 to i64
%13 = call i8* @llvm.stacksave()
store i8* %13, i8** %5
%14 = alloca i8, i64 %12
store i64 %12, i64* %6
%15 = load i32, i32* @BUFSIZ
%16 = zext i32 %15 to i64
%17 = alloca i8, i64 %16
store i64 %16, i64* %8
store i32 -1, i32* %9
%18 = call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %18, i32** %2
%19 = load i32*, i32** %2
%20 = icmp eq i32* %19, null
br i1 %20, label %21, label %22
21: ; preds = %0
store i32 -1, i32* %1
store i32 1, i32* %10
br label %105
22: ; preds = %0
br label %23
23: ; preds = %63, %22
br label %24
24: ; preds = %23
%25 = load i32, i32* @BUFSIZ
%26 = load i32*, i32** %2
%27 = call i8* @fgets(i8* %14, i32 %25, i32* %26)
store i8* %27, i8** %7
%28 = load i8*, i8** %7
%29 = icmp eq i8* %28, null
br i1 %29, label %30, label %31
30: ; preds = %24
br label %64
31: ; preds = %24
%32 = load i8*, i8** %7
%33 = call i64 @strncmp(i8* %32, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 8)
%34 = icmp ne i64 %33, 0
br i1 %34, label %43, label %35
35: ; preds = %31
%36 = load i8*, i8** %7
%37 = call i32 (i8*, i8*, ...) @sscanf(i8* %36, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* %17)
%38 = call i64 @strncmp(i8* %17, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 12)
%39 = icmp ne i64 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %35
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i8* %17)
store i32 -1, i32* %1
store i32 1, i32* %10
br label %105
42: ; preds = %35
br label %43
43: ; preds = %42, %31
%44 = load i8*, i8** %7
%45 = call i64 @strncmp(i8* %44, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i32 10)
%46 = icmp ne i64 %45, 0
br i1 %46, label %56, label %47
47: ; preds = %43
%48 = load i8*, i8** %7
%49 = call i32 (i8*, i8*, ...) @sscanf(i8* %48, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i32* %3)
%50 = load i32, i32* %3
%51 = icmp ne i32 %50, 6
br i1 %51, label %52, label %55
52: ; preds = %47
%53 = load i32, i32* %3
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0), i32 %53)
store i32 -1, i32* %1
store i32 1, i32* %10
br label %105
55: ; preds = %47
br label %56
56: ; preds = %55, %43
%57 = load i8*, i8** %7
%58 = call i64 @strncmp(i8* %57, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i32 5)
%59 = icmp ne i64 %58, 0
br i1 %59, label %63, label %60
60: ; preds = %56
%61 = load i8*, i8** %7
%62 = call i32 (i8*, i8*, ...) @sscanf(i8* %61, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i32* %4)
br label %63
63: ; preds = %60, %56
br label %23
64: ; preds = %30
%65 = load i32*, i32** %2
%66 = call i32 @fclose(i32* %65)
%67 = load i32, i32* %4
switch i32 %67, label %100 [
i32 26, label %68
i32 30, label %68
i32 31, label %68
i32 46, label %70
i32 37, label %72
i32 44, label %72
i32 47, label %74
i32 42, label %76
i32 45, label %78
i32 58, label %80
i32 62, label %82
i32 60, label %84
i32 69, label %84
i32 70, label %84
i32 63, label %86
i32 61, label %88
i32 71, label %88
i32 86, label %90
i32 79, label %90
i32 78, label %92
i32 94, label %92
i32 85, label %94
i32 142, label %96
i32 158, label %96
i32 15, label %98
i32 22, label %98
i32 23, label %98
i32 29, label %98
]
68: ; preds = %64, %64, %64
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.11, i64 0, i64 0))
store i32 0, i32* %9
br label %103
70: ; preds = %64
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.12, i64 0, i64 0))
store i32 0, i32* %9
br label %103
72: ; preds = %64, %64
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.13, i64 0, i64 0))
store i32 0, i32* %9
br label %103
74: ; preds = %64
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.14, i64 0, i64 0))
store i32 0, i32* %9
br label %103
76: ; preds = %64
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.15, i64 0, i64 0))
store i32 0, i32* %9
br label %103
78: ; preds = %64
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.16, i64 0, i64 0))
store i32 0, i32* %9
br label %103
80: ; preds = %64
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.17, i64 0, i64 0))
store i32 0, i32* %9
br label %103
82: ; preds = %64
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.18, i64 0, i64 0))
store i32 0, i32* %9
br label %103
84: ; preds = %64, %64, %64
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.19, i64 0, i64 0))
store i32 0, i32* %9
br label %103
86: ; preds = %64
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.20, i64 0, i64 0))
store i32 0, i32* %9
br label %103
88: ; preds = %64, %64
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.21, i64 0, i64 0))
store i32 0, i32* %9
br label %103
90: ; preds = %64, %64
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.22, i64 0, i64 0))
store i32 0, i32* %9
br label %103
92: ; preds = %64, %64
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.23, i64 0, i64 0))
store i32 0, i32* %9
br label %103
94: ; preds = %64
%95 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.24, i64 0, i64 0))
store i32 0, i32* %9
br label %103
96: ; preds = %64, %64
%97 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.25, i64 0, i64 0))
store i32 0, i32* %9
br label %103
98: ; preds = %64, %64, %64, %64
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.26, i64 0, i64 0))
store i32 1, i32* %9
br label %103
100: ; preds = %64
%101 = load i32, i32* %4
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.27, i64 0, i64 0), i32 %101)
store i32 -1, i32* %9
br label %103
103: ; preds = %100, %98, %96, %94, %92, %90, %88, %86, %84, %82, %80, %78, %76, %74, %72, %70, %68
%104 = load i32, i32* %9
store i32 %104, i32* %1
store i32 1, i32* %10
br label %105
105: ; preds = %103, %52, %40, %21
%106 = load i8*, i8** %5
%107 = load i32, i32* %1
ret i32 %107
}

LLVM IR (-O2):
@BUFSIZ = global i32 0
@.str = [14 x i8] c"/proc/cpuinfo\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [10 x i8] c"vendor_id\00"
@.str.3 = [9 x i8] c"%*s%*s%s\00"
@.str.4 = [13 x i8] c"GenuineIntel\00"
@.str.5 = [22 x i8] c"%s not an Intel chip\0A\00"
@.str.6 = [11 x i8] c"cpu family\00"
@.str.7 = [12 x i8] c"%*s%*s%*s%d\00"
@.str.8 = [21 x i8] c"Wrong CPU family %d\0A\00"
@.str.9 = [6 x i8] c"model\00"
@.str.10 = [9 x i8] c"%*s%*s%d\00"
@.str.27 = [22 x i8] c"Unsupported model %d\0A\00"
@str = [16 x i8] c"Found Core2 CPU\00"
@str.28 = [19 x i8] c"Found Kabylake CPU\00"
@str.29 = [39 x i8] c"Found Skylake / Cascadelake Server CPU\00"
@str.30 = [18 x i8] c"Found Skylake CPU\00"
@str.31 = [26 x i8] c"Found Broadwell-DE/EP CPU\00"
@str.32 = [20 x i8] c"Found Broadwell CPU\00"
@str.33 = [21 x i8] c"Found Haswell-EP CPU\00"
@str.34 = [18 x i8] c"Found Haswell CPU\00"
@str.35 = [23 x i8] c"Found Ivybridge-EP CPU\00"
@str.36 = [20 x i8] c"Found Ivybridge CPU\00"
@str.37 = [25 x i8] c"Found Sandybridge-EP CPU\00"
@str.38 = [22 x i8] c"Found Sandybridge CPU\00"
@str.39 = [22 x i8] c"Found Westmere-EX CPU\00"
@str.40 = [19 x i8] c"Found Westmere CPU\00"
@str.41 = [21 x i8] c"Found Nehalem-EX CPU\00"
@str.42 = [18 x i8] c"Found Nehalem CPU\00"
define i32 @detect_cpu() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
store i32 -1, i32* %2
%5 = load i32, i32* @BUFSIZ
%6 = zext i32 %5 to i64
%7 = tail call i8* @llvm.stacksave()
%8 = alloca i8, i64 %6
%9 = load i32, i32* @BUFSIZ
%10 = zext i32 %9 to i64
%11 = alloca i8, i64 %10
%12 = tail call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i32* %12, null
br i1 %13, label %83, label %14
14: ; preds = %0
%15 = load i32, i32* @BUFSIZ
%16 = call i8* @fgets(i8* %8, i32 %15, i32* %12)
%17 = icmp eq i8* %16, null
br i1 %17, label %46, label %18
18: ; preds = %14, %42
%19 = phi i8* [ %44, %42 ], [ %16, %14 ]
%20 = call i64 @strncmp(i8* %19, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 8)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %28
22: ; preds = %18
%23 = call i32 (i8*, i8*, ...) @sscanf(i8* %19, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* %11)
%24 = call i64 @strncmp(i8* %11, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 12)
%25 = icmp eq i64 %24, 0
br i1 %25, label %28, label %26
26: ; preds = %22
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i8* %11)
br label %83
28: ; preds = %22, %18
%29 = call i64 @strncmp(i8* %19, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i32 10)
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %37
31: ; preds = %28
%32 = call i32 (i8*, i8*, ...) @sscanf(i8* %19, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i32* %1)
%33 = load i32, i32* %1
%34 = icmp eq i32 %33, 6
br i1 %34, label %37, label %35
35: ; preds = %31
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0), i32 %33)
br label %83
37: ; preds = %31, %28
%38 = call i64 @strncmp(i8* %19, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i32 5)
%39 = icmp eq i64 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %37
%41 = call i32 (i8*, i8*, ...) @sscanf(i8* %19, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i32* %2)
br label %42
42: ; preds = %40, %37
%43 = load i32, i32* @BUFSIZ
%44 = call i8* @fgets(i8* %8, i32 %43, i32* %12)
%45 = icmp eq i8* %44, null
br i1 %45, label %46, label %18
46: ; preds = %42, %14
%47 = call i32 @fclose(i32* %12)
%48 = load i32, i32* %2
switch i32 %48, label %81 [
i32 26, label %49
i32 30, label %49
i32 31, label %49
i32 46, label %51
i32 37, label %53
i32 44, label %53
i32 47, label %55
i32 42, label %57
i32 45, label %59
i32 58, label %61
i32 62, label %63
i32 60, label %65
i32 69, label %65
i32 70, label %65
i32 63, label %67
i32 61, label %69
i32 71, label %69
i32 86, label %71
i32 79, label %71
i32 78, label %73
i32 94, label %73
i32 85, label %75
i32 142, label %77
i32 158, label %77
i32 15, label %79
i32 22, label %79
i32 23, label %79
i32 29, label %79
]
49: ; preds = %46, %46, %46
%50 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.42, i64 0, i64 0))
br label %83
51: ; preds = %46
%52 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.41, i64 0, i64 0))
br label %83
53: ; preds = %46, %46
%54 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.40, i64 0, i64 0))
br label %83
55: ; preds = %46
%56 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.39, i64 0, i64 0))
br label %83
57: ; preds = %46
%58 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.38, i64 0, i64 0))
br label %83
59: ; preds = %46
%60 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.37, i64 0, i64 0))
br label %83
61: ; preds = %46
%62 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.36, i64 0, i64 0))
br label %83
63: ; preds = %46
%64 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.35, i64 0, i64 0))
br label %83
65: ; preds = %46, %46, %46
%66 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.34, i64 0, i64 0))
br label %83
67: ; preds = %46
%68 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.33, i64 0, i64 0))
br label %83
69: ; preds = %46, %46
%70 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.32, i64 0, i64 0))
br label %83
71: ; preds = %46, %46
%72 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.31, i64 0, i64 0))
br label %83
73: ; preds = %46, %46
%74 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.30, i64 0, i64 0))
br label %83
75: ; preds = %46
%76 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.29, i64 0, i64 0))
br label %83
77: ; preds = %46, %46
%78 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.28, i64 0, i64 0))
br label %83
79: ; preds = %46, %46, %46, %46
%80 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
br label %83
81: ; preds = %46
%82 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.27, i64 0, i64 0), i32 %48)
br label %83
83: ; preds = %49, %51, %53, %55, %57, %59, %61, %63, %65, %67, %69, %71, %73, %75, %77, %79, %81, %0, %35, %26
%84 = phi i32 [ -1, %35 ], [ -1, %26 ], [ -1, %0 ], [ -1, %81 ], [ 1, %79 ], [ 0, %77 ], [ 0, %75 ], [ 0, %73 ], [ 0, %71 ], [ 0, %69 ], [ 0, %67 ], [ 0, %65 ], [ 0, %63 ], [ 0, %61 ], [ 0, %59 ], [ 0, %57 ], [ 0, %55 ], [ 0, %53 ], [ 0, %51 ], [ 0, %49 ]
ret i32 %84
}