#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 /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ free(char *);
int getdelim(char **, size_t *, int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ main();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ system(char *);
int cpuinfofunc(int argc, char **argv) {
  char z;
  FILE *cpuinfo = fopen("/proc/cpuinfo", "rb");
  char *arg22 = 0;
  size_t size = 0;
  while (getdelim(&arg22, &size, 0, cpuinfo) != -1) {
    puts(arg22);
  }
  free(arg22);
  fclose(cpuinfo);
  printf("\nDo you want to clear the screen and return to menu? [Y/N]");
  scanf(" %c", &z);
  switch (z) {
  case 'Y':
    system("clear");
    main();
    break;
  case 'y':
    system("clear");
    main();
    break;
  case 'N':
    break;
  case 'n':
    break;
  }
}


x86 assembly (clang, -O0):
<cpuinfofunc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe5a(%rip),%rdi
lea    0xe61(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
mov    -0x20(%rbp),%rcx
lea    -0x28(%rbp),%rdi
lea    -0x30(%rbp),%rsi
xor    %edx,%edx
call   10b0 <getdelim@plt>
cmp    $0xffffffff,%eax
je     11f0 <cpuinfofunc+0x60>
mov    -0x28(%rbp),%rdi
call   1040 <puts@plt>
jmp    11c6 <cpuinfofunc+0x36>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
lea    0xe08(%rip),%rdi
call   1070 <printf@plt>
lea    0xe37(%rip),%rdi
lea    -0x11(%rbp),%rsi
call   1090 <scanf@plt>
movsbl -0x11(%rbp),%eax
mov    %eax,-0x34(%rbp)
sub    $0x4e,%eax
je     1296 <cpuinfofunc+0x106>
jmp    1233 <cpuinfofunc+0xa3>
mov    -0x34(%rbp),%eax
sub    $0x59,%eax
je     1266 <cpuinfofunc+0xd6>
jmp    1244 <cpuinfofunc+0xb4>
mov    -0x34(%rbp),%eax
sub    $0x6e,%eax
je     129b <cpuinfofunc+0x10b>
jmp    1255 <cpuinfofunc+0xc5>
mov    -0x34(%rbp),%eax
sub    $0x79,%eax
je     127e <cpuinfofunc+0xee>
jmp    12a0 <cpuinfofunc+0x110>
lea    0xde3(%rip),%rdi
call   1060 <system@plt>
mov    $0x0,%al
call   1080 <main@plt>
jmp    12a0 <cpuinfofunc+0x110>
lea    0xdcb(%rip),%rdi
call   1060 <system@plt>
mov    $0x0,%al
call   1080 <main@plt>
jmp    12a0 <cpuinfofunc+0x110>
jmp    12a0 <cpuinfofunc+0x110>
jmp    12a0 <cpuinfofunc+0x110>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpuinfofunc>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
lea    0xe60(%rip),%rdi
lea    0xe67(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,%rbx
movq   $0x0,0x10(%rsp)
movq   $0x0,0x18(%rsp)
lea    0x10(%rsp),%rdi
lea    0x18(%rsp),%rsi
xor    %edx,%edx
mov    %rax,%rcx
call   10b0 <getdelim@plt>
cmp    $0xffffffff,%eax
je     120f <cpuinfofunc+0x7f>
lea    0x10(%rsp),%r14
lea    0x18(%rsp),%r15
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x10(%rsp),%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %edx,%edx
mov    %rbx,%rcx
call   10b0 <getdelim@plt>
cmp    $0xffffffff,%eax
jne    11f0 <cpuinfofunc+0x60>
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
lea    0xde9(%rip),%rdi
call   1070 <printf@plt>
lea    0xe18(%rip),%rdi
lea    0xf(%rsp),%rsi
call   1090 <scanf@plt>
movsbl 0xf(%rsp),%eax
or     $0x20,%eax
cmp    $0x79,%eax
jne    125e <cpuinfofunc+0xce>
lea    0xdfe(%rip),%rdi
call   1060 <system@plt>
xor    %eax,%eax
call   1080 <main@plt>
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [14 x i8] c"/proc/cpuinfo\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [59 x i8] c"\0ADo you want to clear the screen and return to menu? [Y/N]\00"
@.str.3 = [4 x i8] c" %c\00"
@.str.4 = [6 x i8] c"clear\00"
define i32 @cpuinfofunc(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i64
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %10, i32** %7
store i8* null, i8** %8
store i64 0, i64* %9
br label %11
11: ; preds = %15, %2
%12 = load i32*, i32** %7
%13 = call i32 @getdelim(i8** %8, i64* %9, i32 0, i32* %12)
%14 = icmp ne i32 %13, -1
br i1 %14, label %15, label %18
15: ; preds = %11
%16 = load i8*, i8** %8
%17 = call i32 @puts(i8* %16)
br label %11
18: ; preds = %11
%19 = load i8*, i8** %8
%20 = call i32 @free(i8* %19)
%21 = load i32*, i32** %7
%22 = call i32 @fclose(i32* %21)
%23 = call i32 @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.2, i64 0, i64 0))
%24 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %6)
%25 = load i8, i8* %6
%26 = sext i8 %25 to i32
switch i32 %26, label %35 [
i32 89, label %27
i32 121, label %30
i32 78, label %33
i32 110, label %34
]
27: ; preds = %18
%28 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%29 = call i32 (...) @main()
br label %35
30: ; preds = %18
%31 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%32 = call i32 (...) @main()
br label %35
33: ; preds = %18
br label %35
34: ; preds = %18
br label %35
35: ; preds = %18, %34, %33, %30, %27
%36 = load i32, i32* %3
ret i32 %36
}

LLVM IR (-O2):
@.str = [14 x i8] c"/proc/cpuinfo\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [59 x i8] c"\0ADo you want to clear the screen and return to menu? [Y/N]\00"
@.str.3 = [4 x i8] c" %c\00"
@.str.4 = [6 x i8] c"clear\00"
define i32 @cpuinfofunc(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i8
%4 = alloca i8*
%5 = alloca i64
%6 = tail call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%7 = bitcast i8** %4 to i8*
store i8* null, i8** %4
%8 = bitcast i64* %5 to i8*
store i64 0, i64* %5
%9 = call i32 @getdelim(i8** %4, i64* %5, i32 0, i32* %6)
%10 = icmp eq i32 %9, -1
br i1 %10, label %16, label %11
11: ; preds = %2, %11
%12 = load i8*, i8** %4
%13 = call i32 @puts(i8* dereferenceable(1) %12)
%14 = call i32 @getdelim(i8** %4, i64* %5, i32 0, i32* %6)
%15 = icmp eq i32 %14, -1
br i1 %15, label %16, label %11
16: ; preds = %11, %2
%17 = load i8*, i8** %4
%18 = call i32 @free(i8* %17)
%19 = call i32 @fclose(i32* %6)
%20 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str.2, i64 0, i64 0))
%21 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %3)
%22 = load i8, i8* %3
%23 = sext i8 %22 to i32
switch i32 %23, label %27 [
i32 89, label %24
i32 121, label %24
]
24: ; preds = %16, %16
%25 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%26 = call i32 (...) @main()
br label %27
27: ; preds = %24, %16
ret i32 undef
}