#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*/ keyValues;
typedef int /*<<< orphan*/ buffer;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
scalar_t__ strncmp(char *, char *, size_t const);
const char *GetCPUVersion() {
  struct {
    const char *key;
    char value[1024];
  } keyValues[] = {{"model name", ""}, {"Processor", ""}, {"Hardware", ""}};
  static char name[1024];
  FILE *cpuinfo = fopen("/proc/cpuinfo", "r");
  if (cpuinfo != NULL) {
    char buffer[1024];
    while (fgets(buffer, sizeof(buffer), cpuinfo)) {
      for (int i = 0; i < (int)(sizeof(keyValues) / sizeof(keyValues[0]));
           i++) {
        const size_t length = strlen(keyValues[i].key);
        if (strncmp(buffer, keyValues[i].key, length) == 0) {
          char *pretty_name = buffer + length;
          while (pretty_name[0] == ' ' || pretty_name[0] == '\t' ||
                 pretty_name[0] == ':' || pretty_name[0] == '\'' ||
                 pretty_name[0] == '\"') {
            pretty_name++;
          }
          int last = strlen(pretty_name) - 1;
          while (last >= 0 &&
                 (pretty_name[last] == '\n' || pretty_name[last] == '\'' ||
                  pretty_name[last] == '\"')) {
            pretty_name[last--] = '\0';
          }
          strcpy(keyValues[i].value, pretty_name);
          break;
        }
      }
    }
    fclose(cpuinfo);
    sprintf(name, "%s%s%s", keyValues[2].value,
            (keyValues[2].value[0] != '\0') ? " - " : "",
            (keyValues[0].value[0] != '\0') ? keyValues[0].value
                                            : keyValues[1].value);
    return name;
  }
  return "unknown";
}


x86 assembly (clang, -O0):
<GetCPUVersion>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1070,%rsp
lea    -0xc20(%rbp),%rdi
xor    %esi,%esi
mov    $0xc18,%edx
call   1070 <memset@plt>
lea    0xe5b(%rip),%rax
mov    %rax,-0xc20(%rbp)
lea    0xe58(%rip),%rax
mov    %rax,-0x818(%rbp)
lea    0xe54(%rip),%rax
mov    %rax,-0x410(%rbp)
lea    0xe4f(%rip),%rdi
lea    0xe3d(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0xc28(%rbp)
cmpq   $0x0,-0xc28(%rbp)
je     152a <GetCPUVersion+0x3aa>
jmp    11f5 <GetCPUVersion+0x75>
lea    -0x1030(%rbp),%rdi
mov    -0xc28(%rbp),%rdx
mov    $0x400,%esi
call   1080 <fgets@plt>
cmp    $0x0,%rax
je     146c <GetCPUVersion+0x2ec>
movl   $0x0,-0x1034(%rbp)
cmpl   $0x3,-0x1034(%rbp)
jge    1467 <GetCPUVersion+0x2e7>
movslq -0x1034(%rbp),%rcx
lea    -0xc20(%rbp),%rax
imul   $0x408,%rcx,%rcx
add    %rcx,%rax
mov    (%rax),%rdi
call   1060 <strlen@plt>
cltq
mov    %rax,-0x1040(%rbp)
lea    -0x1030(%rbp),%rdi
movslq -0x1034(%rbp),%rcx
lea    -0xc20(%rbp),%rax
imul   $0x408,%rcx,%rcx
add    %rcx,%rax
mov    (%rax),%rsi
mov    -0x1040(%rbp),%rdx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    144e <GetCPUVersion+0x2ce>
lea    -0x1030(%rbp),%rax
add    -0x1040(%rbp),%rax
mov    %rax,-0x1048(%rbp)
mov    -0x1048(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x104d(%rbp)
je     1326 <GetCPUVersion+0x1a6>
mov    -0x1048(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x9,%ecx
mov    %al,-0x104d(%rbp)
je     1326 <GetCPUVersion+0x1a6>
mov    -0x1048(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x3a,%ecx
mov    %al,-0x104d(%rbp)
je     1326 <GetCPUVersion+0x1a6>
mov    -0x1048(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x27,%ecx
mov    %al,-0x104d(%rbp)
je     1326 <GetCPUVersion+0x1a6>
mov    -0x1048(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
sete   %al
mov    %al,-0x104d(%rbp)
mov    -0x104d(%rbp),%al
test   $0x1,%al
jne    1339 <GetCPUVersion+0x1b9>
jmp    1350 <GetCPUVersion+0x1d0>
mov    -0x1048(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x1048(%rbp)
jmp    12a4 <GetCPUVersion+0x124>
mov    -0x1048(%rbp),%rdi
call   1060 <strlen@plt>
sub    $0x1,%eax
mov    %eax,-0x104c(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x104c(%rbp)
mov    %al,-0x104e(%rbp)
jl     13ea <GetCPUVersion+0x26a>
mov    -0x1048(%rbp),%rax
movslq -0x104c(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
mov    $0x1,%al
cmp    $0xa,%ecx
mov    %al,-0x104f(%rbp)
je     13de <GetCPUVersion+0x25e>
mov    -0x1048(%rbp),%rax
movslq -0x104c(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
mov    $0x1,%al
cmp    $0x27,%ecx
mov    %al,-0x104f(%rbp)
je     13de <GetCPUVersion+0x25e>
mov    -0x1048(%rbp),%rax
movslq -0x104c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x22,%eax
sete   %al
mov    %al,-0x104f(%rbp)
mov    -0x104f(%rbp),%al
mov    %al,-0x104e(%rbp)
mov    -0x104e(%rbp),%al
test   $0x1,%al
jne    13fd <GetCPUVersion+0x27d>
jmp    1421 <GetCPUVersion+0x2a1>
mov    -0x1048(%rbp),%rax
mov    -0x104c(%rbp),%ecx
mov    %ecx,%edx
add    $0xffffffff,%edx
mov    %edx,-0x104c(%rbp)
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    1365 <GetCPUVersion+0x1e5>
movslq -0x1034(%rbp),%rax
lea    -0xc20(%rbp),%rdi
imul   $0x408,%rax,%rax
add    %rax,%rdi
add    $0x8,%rdi
mov    -0x1048(%rbp),%rsi
call   1040 <strcpy@plt>
jmp    1467 <GetCPUVersion+0x2e7>
jmp    1453 <GetCPUVersion+0x2d3>
mov    -0x1034(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1034(%rbp)
jmp    1221 <GetCPUVersion+0xa1>
jmp    11f5 <GetCPUVersion+0x75>
mov    -0xc28(%rbp),%rdi
call   1050 <fclose@plt>
lea    -0xc20(%rbp),%rax
add    $0x810,%rax
add    $0x8,%rax
mov    %rax,-0x1060(%rbp)
movsbl -0x408(%rbp),%edx
lea    0xb98(%rip),%rax
lea    0xb8e(%rip),%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
mov    %rax,-0x1058(%rbp)
movsbl -0xc18(%rbp),%eax
cmp    $0x0,%eax
je     14da <GetCPUVersion+0x35a>
lea    -0xc20(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x1068(%rbp)
jmp    14f2 <GetCPUVersion+0x372>
lea    -0xc20(%rbp),%rax
add    $0x408,%rax
add    $0x8,%rax
mov    %rax,-0x1068(%rbp)
mov    -0x1058(%rbp),%rcx
mov    -0x1060(%rbp),%rdx
mov    -0x1068(%rbp),%r8
lea    0x2b62(%rip),%rdi
lea    0xb17(%rip),%rsi
call   10a0 <sprintf@plt>
lea    0x2b4f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1535 <GetCPUVersion+0x3b5>
lea    0xb06(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1070,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetCPUVersion>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1028,%rsp
mov    %rsp,%rdi
mov    $0xc18,%edx
xor    %esi,%esi
call   1070 <memset@plt>
lea    0xe59(%rip),%rbx
mov    %rbx,(%rsp)
lea    0xe59(%rip),%rax
mov    %rax,0x408(%rsp)
lea    0xe54(%rip),%rax
mov    %rax,0x810(%rsp)
lea    0xe4e(%rip),%rdi
lea    0xe3c(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
je     13c4 <GetCPUVersion+0x244>
mov    %rax,%r14
lea    0xc20(%rsp),%rdi
mov    $0x400,%esi
mov    %rax,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     136c <GetCPUVersion+0x1ec>
lea    0xc20(%rsp),%r15
movabs $0x8400000400,%r12
movabs $0x400008500000200,%r13
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1060 <strlen@plt>
movslq %eax,%rbx
mov    (%rsp),%rsi
mov    %r15,%rdi
mov    %rbx,%rdx
call   1030 <strncmp@plt>
test   %rax,%rax
je     12b0 <GetCPUVersion+0x130>
mov    0x408(%rsp),%rdi
call   1060 <strlen@plt>
movslq %eax,%rbx
mov    0x408(%rsp),%rsi
mov    %r15,%rdi
mov    %rbx,%rdx
call   1030 <strncmp@plt>
test   %rax,%rax
je     12c0 <GetCPUVersion+0x140>
mov    0x810(%rsp),%rdi
call   1060 <strlen@plt>
movslq %eax,%rbx
mov    0x810(%rsp),%rsi
mov    %r15,%rdi
mov    %rbx,%rdx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    134e <GetCPUVersion+0x1ce>
mov    $0x2,%ebp
jmp    12c5 <GetCPUVersion+0x145>
nopw   0x0(%rax,%rax,1)
xor    %ebp,%ebp
jmp    12c5 <GetCPUVersion+0x145>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x1,%ebp
add    %rsp,%rbx
add    $0xc20,%rbx
nop
movzbl (%rbx),%eax
cmp    $0x3a,%rax
ja     12f0 <GetCPUVersion+0x170>
bt     %rax,%r13
jae    12f0 <GetCPUVersion+0x170>
add    $0x1,%rbx
jmp    12d0 <GetCPUVersion+0x150>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
call   1060 <strlen@plt>
test   %eax,%eax
jle    1333 <GetCPUVersion+0x1b3>
mov    %eax,%ecx
add    $0xffffffff,%eax
add    $0x1,%rcx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %eax,%eax
movzbl (%rbx,%rax,1),%edx
cmp    $0x27,%rdx
ja     1333 <GetCPUVersion+0x1b3>
bt     %rdx,%r12
jae    1333 <GetCPUVersion+0x1b3>
movb   $0x0,(%rbx,%rax,1)
add    $0xffffffff,%eax
add    $0xffffffffffffffff,%rcx
cmp    $0x1,%rcx
ja     1310 <GetCPUVersion+0x190>
mov    %rbp,%rax
shl    $0xa,%rax
lea    (%rax,%rbp,8),%rax
lea    (%rsp,%rax,1),%rdi
add    $0x8,%rdi
mov    %rbx,%rsi
call   1040 <strcpy@plt>
mov    %r15,%rdi
mov    $0x400,%esi
mov    %r14,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     136c <GetCPUVersion+0x1ec>
mov    (%rsp),%rbx
jmp    1230 <GetCPUVersion+0xb0>
mov    %r14,%rdi
call   1050 <fclose@plt>
lea    0x818(%rsp),%rdx
cmpb   $0x0,0x818(%rsp)
lea    0xcab(%rip),%rax
lea    0xca1(%rip),%rcx
cmove  %rax,%rcx
cmpb   $0x0,0x8(%rsp)
lea    0x8(%rsp),%rax
lea    0x410(%rsp),%r8
cmovne %rax,%r8
lea    0x2cbd(%rip),%rbx
lea    0xc72(%rip),%rsi
mov    %rbx,%rdi
call   10a0 <sprintf@plt>
jmp    13cb <GetCPUVersion+0x24b>
lea    0xc6c(%rip),%rbx
mov    %rbx,%rax
add    $0x1028,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.anon = type { i8*, [1024 x i8] }
@.str = [11 x i8] c"model name\00"
@.str.1 = [10 x i8] c"Processor\00"
@.str.2 = [9 x i8] c"Hardware\00"
@GetCPUVersion.name = internal global [1024 x i8] zeroinitializer
@.str.3 = [14 x i8] c"/proc/cpuinfo\00"
@.str.4 = [2 x i8] c"r\00"
@.str.5 = [7 x i8] c"%s%s%s\00"
@.str.6 = [4 x i8] c" - \00"
@.str.7 = [1 x i8] zeroinitializer
@.str.8 = [8 x i8] c"unknown\00"
define i8* @GetCPUVersion() {
%1 = alloca i8*
%2 = alloca [3 x %struct.anon]
%3 = alloca i32*
%4 = alloca [1024 x i8]
%5 = alloca i32
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i32
%9 = bitcast [3 x %struct.anon]* %2 to i8*
%10 = bitcast i8* %9 to [3 x %struct.anon]*
%11 = getelementptr inbounds [3 x %struct.anon], [3 x %struct.anon]* %10, i32 0, i32 0
%12 = getelementptr inbounds %struct.anon, %struct.anon* %11, i32 0, i32 0
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i32 0, i32 0), i8** %12
%13 = getelementptr inbounds [3 x %struct.anon], [3 x %struct.anon]* %10, i32 0, i32 1
%14 = getelementptr inbounds %struct.anon, %struct.anon* %13, i32 0, i32 0
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i32 0, i32 0), i8** %14
%15 = getelementptr inbounds [3 x %struct.anon], [3 x %struct.anon]* %10, i32 0, i32 2
%16 = getelementptr inbounds %struct.anon, %struct.anon* %15, i32 0, i32 0
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i32 0, i32 0), i8** %16
%17 = call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %17, i32** %3
%18 = load i32*, i32** %3
%19 = icmp ne i32* %18, null
br i1 %19, label %20, label %171
20: ; preds = %0
br label %21
21: ; preds = %139, %20
%22 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%23 = load i32*, i32** %3
%24 = call i64 @fgets(i8* %22, i32 1024, i32* %23)
%25 = icmp ne i64 %24, 0
br i1 %25, label %26, label %140
26: ; preds = %21
store i32 0, i32* %5
br label %27
27: ; preds = %136, %26
%28 = load i32, i32* %5
%29 = icmp slt i32 %28, 3
br i1 %29, label %30, label %139
30: ; preds = %27
%31 = load i32, i32* %5
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [3 x %struct.anon], [3 x %struct.anon]* %2, i64 0, i64 %32
%34 = getelementptr inbounds %struct.anon, %struct.anon* %33, i32 0, i32 0
%35 = load i8*, i8** %34
%36 = call i32 @strlen(i8* %35)
%37 = sext i32 %36 to i64
store i64 %37, i64* %6
%38 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%39 = load i32, i32* %5
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [3 x %struct.anon], [3 x %struct.anon]* %2, i64 0, i64 %40
%42 = getelementptr inbounds %struct.anon, %struct.anon* %41, i32 0, i32 0
%43 = load i8*, i8** %42
%44 = load i64, i64* %6
%45 = call i64 @strncmp(i8* %38, i8* %43, i64 %44)
%46 = icmp eq i64 %45, 0
br i1 %46, label %47, label %135
47: ; preds = %30
%48 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%49 = load i64, i64* %6
%50 = getelementptr inbounds i8, i8* %48, i64 %49
store i8* %50, i8** %7
br label %51
51: ; preds = %83, %47
%52 = load i8*, i8** %7
%53 = getelementptr inbounds i8, i8* %52, i64 0
%54 = load i8, i8* %53
%55 = sext i8 %54 to i32
%56 = icmp eq i32 %55, 32
br i1 %56, label %81, label %57
57: ; preds = %51
%58 = load i8*, i8** %7
%59 = getelementptr inbounds i8, i8* %58, i64 0
%60 = load i8, i8* %59
%61 = sext i8 %60 to i32
%62 = icmp eq i32 %61, 9
br i1 %62, label %81, label %63
63: ; preds = %57
%64 = load i8*, i8** %7
%65 = getelementptr inbounds i8, i8* %64, i64 0
%66 = load i8, i8* %65
%67 = sext i8 %66 to i32
%68 = icmp eq i32 %67, 58
br i1 %68, label %81, label %69
69: ; preds = %63
%70 = load i8*, i8** %7
%71 = getelementptr inbounds i8, i8* %70, i64 0
%72 = load i8, i8* %71
%73 = sext i8 %72 to i32
%74 = icmp eq i32 %73, 39
br i1 %74, label %81, label %75
75: ; preds = %69
%76 = load i8*, i8** %7
%77 = getelementptr inbounds i8, i8* %76, i64 0
%78 = load i8, i8* %77
%79 = sext i8 %78 to i32
%80 = icmp eq i32 %79, 34
br label %81
81: ; preds = %75, %69, %63, %57, %51
%82 = phi i1 [ true, %69 ], [ true, %63 ], [ true, %57 ], [ true, %51 ], [ %80, %75 ]
br i1 %82, label %83, label %86
83: ; preds = %81
%84 = load i8*, i8** %7
%85 = getelementptr inbounds i8, i8* %84, i32 1
store i8* %85, i8** %7
br label %51
86: ; preds = %81
%87 = load i8*, i8** %7
%88 = call i32 @strlen(i8* %87)
%89 = sub nsw i32 %88, 1
store i32 %89, i32* %8
br label %90
90: ; preds = %121, %86
%91 = load i32, i32* %8
%92 = icmp sge i32 %91, 0
br i1 %92, label %93, label %119
93: ; preds = %90
%94 = load i8*, i8** %7
%95 = load i32, i32* %8
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds i8, i8* %94, i64 %96
%98 = load i8, i8* %97
%99 = sext i8 %98 to i32
%100 = icmp eq i32 %99, 10
br i1 %100, label %117, label %101
101: ; preds = %93
%102 = load i8*, i8** %7
%103 = load i32, i32* %8
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds i8, i8* %102, i64 %104
%106 = load i8, i8* %105
%107 = sext i8 %106 to i32
%108 = icmp eq i32 %107, 39
br i1 %108, label %117, label %109
109: ; preds = %101
%110 = load i8*, i8** %7
%111 = load i32, i32* %8
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds i8, i8* %110, i64 %112
%114 = load i8, i8* %113
%115 = sext i8 %114 to i32
%116 = icmp eq i32 %115, 34
br label %117
117: ; preds = %109, %101, %93
%118 = phi i1 [ true, %101 ], [ true, %93 ], [ %116, %109 ]
br label %119
119: ; preds = %117, %90
%120 = phi i1 [ false, %90 ], [ %118, %117 ]
br i1 %120, label %121, label %127
121: ; preds = %119
%122 = load i8*, i8** %7
%123 = load i32, i32* %8
%124 = add nsw i32 %123, -1
store i32 %124, i32* %8
%125 = sext i32 %123 to i64
%126 = getelementptr inbounds i8, i8* %122, i64 %125
store i8 0, i8* %126
br label %90
127: ; preds = %119
%128 = load i32, i32* %5
%129 = sext i32 %128 to i64
%130 = getelementptr inbounds [3 x %struct.anon], [3 x %struct.anon]* %2, i64 0, i64 %129
%131 = getelementptr inbounds %struct.anon, %struct.anon* %130, i32 0, i32 1
%132 = getelementptr inbounds [1024 x i8], [1024 x i8]* %131, i64 0, i64 0
%133 = load i8*, i8** %7
%134 = call i32 @strcpy(i8* %132, i8* %133)
br label %139
135: ; preds = %30
br label %136
136: ; preds = %135
%137 = load i32, i32* %5
%138 = add nsw i32 %137, 1
store i32 %138, i32* %5
br label %27
139: ; preds = %127, %27
br label %21
140: ; preds = %21
%141 = load i32*, i32** %3
%142 = call i32 @fclose(i32* %141)
%143 = getelementptr inbounds [3 x %struct.anon], [3 x %struct.anon]* %2, i64 0, i64 2
%144 = getelementptr inbounds %struct.anon, %struct.anon* %143, i32 0, i32 1
%145 = getelementptr inbounds [1024 x i8], [1024 x i8]* %144, i64 0, i64 0
%146 = getelementptr inbounds [3 x %struct.anon], [3 x %struct.anon]* %2, i64 0, i64 2
%147 = getelementptr inbounds %struct.anon, %struct.anon* %146, i32 0, i32 1
%148 = getelementptr inbounds [1024 x i8], [1024 x i8]* %147, i64 0, i64 0
%149 = load i8, i8* %148
%150 = sext i8 %149 to i32
%151 = icmp ne i32 %150, 0
%152 = zext i1 %151 to i64
%153 = select i1 %151, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.7, i64 0, i64 0)
%154 = getelementptr inbounds [3 x %struct.anon], [3 x %struct.anon]* %2, i64 0, i64 0
%155 = getelementptr inbounds %struct.anon, %struct.anon* %154, i32 0, i32 1
%156 = getelementptr inbounds [1024 x i8], [1024 x i8]* %155, i64 0, i64 0
%157 = load i8, i8* %156
%158 = sext i8 %157 to i32
%159 = icmp ne i32 %158, 0
br i1 %159, label %160, label %164
160: ; preds = %140
%161 = getelementptr inbounds [3 x %struct.anon], [3 x %struct.anon]* %2, i64 0, i64 0
%162 = getelementptr inbounds %struct.anon, %struct.anon* %161, i32 0, i32 1
%163 = getelementptr inbounds [1024 x i8], [1024 x i8]* %162, i64 0, i64 0
br label %168
164: ; preds = %140
%165 = getelementptr inbounds [3 x %struct.anon], [3 x %struct.anon]* %2, i64 0, i64 1
%166 = getelementptr inbounds %struct.anon, %struct.anon* %165, i32 0, i32 1
%167 = getelementptr inbounds [1024 x i8], [1024 x i8]* %166, i64 0, i64 0
br label %168
168: ; preds = %164, %160
%169 = phi i8* [ %163, %160 ], [ %167, %164 ]
%170 = call i32 @sprintf(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @GetCPUVersion.name, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* %145, i8* %153, i8* %169)
store i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @GetCPUVersion.name, i64 0, i64 0), i8** %1
br label %172
171: ; preds = %0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i8** %1
br label %172
172: ; preds = %171, %168
%173 = load i8*, i8** %1
ret i8* %173
}

LLVM IR (-O2):
%struct.anon = type { i8*, [1024 x i8] }
@.str = [11 x i8] c"model name\00"
@.str.1 = [10 x i8] c"Processor\00"
@.str.2 = [9 x i8] c"Hardware\00"
@GetCPUVersion.name = internal global [1024 x i8] zeroinitializer
@.str.3 = [14 x i8] c"/proc/cpuinfo\00"
@.str.4 = [2 x i8] c"r\00"
@.str.5 = [7 x i8] c"%s%s%s\00"
@.str.6 = [4 x i8] c" - \00"
@.str.7 = [1 x i8] zeroinitializer
@.str.8 = [8 x i8] c"unknown\00"
define i8* @GetCPUVersion() {
%1 = alloca [3 x %struct.anon]
%2 = alloca [1024 x i8]
%3 = bitcast [3 x %struct.anon]* %1 to i8*
%4 = getelementptr inbounds [3 x %struct.anon], [3 x %struct.anon]* %1, i64 0, i64 0, i32 0
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8** %4
%5 = getelementptr inbounds [3 x %struct.anon], [3 x %struct.anon]* %1, i64 0, i64 1, i32 0
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8** %5
%6 = getelementptr inbounds [3 x %struct.anon], [3 x %struct.anon]* %1, i64 0, i64 2, i32 0
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8** %6
%7 = tail call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%8 = icmp eq i32* %7, null
br i1 %8, label %76, label %9
9: ; preds = %0
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%11 = call i64 @fgets(i8* %10, i32 1024, i32* %7)
%12 = icmp eq i64 %11, 0
br i1 %12, label %64, label %13
13: ; preds = %9, %62
%14 = phi i8* [ %63, %62 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), %9 ]
%15 = call i32 @strlen(i8* %14)
%16 = sext i32 %15 to i64
%17 = load i8*, i8** %4
%18 = call i64 @strncmp(i8* %10, i8* %17, i64 %16)
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %45
20: ; preds = %52, %45, %13
%21 = phi i64 [ 0, %13 ], [ 1, %45 ], [ 2, %52 ]
%22 = phi i64 [ %16, %13 ], [ %48, %45 ], [ %55, %52 ]
%23 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %22
br label %24
24: ; preds = %27, %20
%25 = phi i8* [ %23, %20 ], [ %28, %27 ]
%26 = load i8, i8* %25
switch i8 %26, label %29 [
i8 32, label %27
i8 9, label %27
i8 58, label %27
i8 39, label %27
i8 34, label %27
]
27: ; preds = %24, %24, %24, %24, %24
%28 = getelementptr inbounds i8, i8* %25, i64 1
br label %24
29: ; preds = %24
%30 = call i32 @strlen(i8* %25)
%31 = icmp sgt i32 %30, 0
br i1 %31, label %32, label %42
32: ; preds = %29
%33 = zext i32 %30 to i64
br label %34
34: ; preds = %32, %40
%35 = phi i64 [ %33, %32 ], [ %36, %40 ]
%36 = add nsw i64 %35, -1
%37 = and i64 %36, 4294967295
%38 = getelementptr inbounds i8, i8* %25, i64 %37
%39 = load i8, i8* %38
switch i8 %39, label %42 [
i8 10, label %40
i8 39, label %40
i8 34, label %40
]
40: ; preds = %34, %34, %34
store i8 0, i8* %38
%41 = icmp ugt i64 %35, 1
br i1 %41, label %34, label %42
42: ; preds = %40, %34, %29
%43 = getelementptr inbounds [3 x %struct.anon], [3 x %struct.anon]* %1, i64 0, i64 %21, i32 1, i64 0
%44 = call i32 @strcpy(i8* %43, i8* %25)
br label %59
45: ; preds = %13
%46 = load i8*, i8** %5
%47 = call i32 @strlen(i8* %46)
%48 = sext i32 %47 to i64
%49 = load i8*, i8** %5
%50 = call i64 @strncmp(i8* %10, i8* %49, i64 %48)
%51 = icmp eq i64 %50, 0
br i1 %51, label %20, label %52
52: ; preds = %45
%53 = load i8*, i8** %6
%54 = call i32 @strlen(i8* %53)
%55 = sext i32 %54 to i64
%56 = load i8*, i8** %6
%57 = call i64 @strncmp(i8* %10, i8* %56, i64 %55)
%58 = icmp eq i64 %57, 0
br i1 %58, label %20, label %59
59: ; preds = %52, %42
%60 = call i64 @fgets(i8* %10, i32 1024, i32* %7)
%61 = icmp eq i64 %60, 0
br i1 %61, label %64, label %62
62: ; preds = %59
%63 = load i8*, i8** %4
br label %13
64: ; preds = %59, %9
%65 = call i32 @fclose(i32* %7)
%66 = getelementptr inbounds [3 x %struct.anon], [3 x %struct.anon]* %1, i64 0, i64 2, i32 1, i64 0
%67 = load i8, i8* %66
%68 = icmp eq i8 %67, 0
%69 = select i1 %68, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0)
%70 = getelementptr inbounds [3 x %struct.anon], [3 x %struct.anon]* %1, i64 0, i64 0, i32 1, i64 0
%71 = load i8, i8* %70
%72 = icmp eq i8 %71, 0
%73 = getelementptr inbounds [3 x %struct.anon], [3 x %struct.anon]* %1, i64 0, i64 1, i32 1, i64 0
%74 = select i1 %72, i8* %73, i8* %70
%75 = call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([1024 x i8], [1024 x i8]* @GetCPUVersion.name, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* %66, i8* %69, i8* %74)
br label %76
76: ; preds = %0, %64
%77 = phi i8* [ getelementptr inbounds ([1024 x i8], [1024 x i8]* @GetCPUVersion.name, i64 0, i64 0), %64 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), %0 ]
ret i8* %77
}