#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 */
double atof(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int system(char *);
double cpufreq_info() {
  char tmp_str[30];
  tmp_str[0] = '\0';
  if (system("								"
             "	awk 'BEGIN{						"
             "								"
             "exit_value=1;						"
             "				}				"
             "								"
             "		{						"
             "								"
             "	if ($0 ~ /^cpu[[:blank:]]+MHz[[:blank:]]+:/) {		"
             "		print $0;					"
             "							"
             "exit_value=0;						"
             "				}				"
             "								"
             "	}							"
             "							END{	"
             "								"
             "					exit (exit_value);	"
             "								}' "
             "/proc/cpuinfo >/tmp/cpufreq.txt; 				") !=
      -1) {
    FILE *tmp_file;
    tmp_file = fopen("/tmp/cpufreq.txt", "r");
    if (fgets(tmp_str, 30, tmp_file) == NULL) {
      tmp_str[0] = '\0';
    }
    fclose(tmp_file);
  }
  return atof(tmp_str);
}


x86 assembly (clang, -O0):
<cpufreq_info>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movb   $0x0,-0x20(%rbp)
lea    0xe9d(%rip),%rdi
call   1050 <system@plt>
cmp    $0xffffffff,%eax
je     11b1 <cpufreq_info+0x61>
lea    0xfb1(%rip),%rdi
lea    0xfbb(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x28(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    $0x1e,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
jne    11a8 <cpufreq_info+0x58>
movb   $0x0,-0x20(%rbp)
mov    -0x28(%rbp),%rdi
call   1040 <fclose@plt>
lea    -0x20(%rbp),%rdi
call   1030 <atof@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpufreq_info>:
push   %rbx
sub    $0x20,%rsp
movb   $0x0,(%rsp)
lea    0xea0(%rip),%rdi
call   1050 <system@plt>
cmp    $0xffffffff,%eax
je     11a1 <cpufreq_info+0x51>
lea    0xfb8(%rip),%rdi
lea    0xfc2(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rbx
mov    %rsp,%rdi
mov    $0x1e,%esi
mov    %rax,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
jne    1199 <cpufreq_info+0x49>
movb   $0x0,(%rsp)
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    %rsp,%rdi
call   1030 <atof@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [297 x i8] c"\09\09\09\09\09\09\09\09\09awk 'BEGIN{\09\09\09\09\09\09\09\09\09\09\09\09\09\09exit_value=1;\09\09\09\09\09\09\09\09\09\09}\09\09\09\09\09\09\09\09\09\09\09\09\09\09{\09\09\09\09\09\09\09\09\09\09\09\09\09\09\09if ($0 ~ /^cpu[[:blank:]]+MHz[[:blank:]]+:/) {\09\09\09\09print $0;\09\09\09\09\09\09\09\09\09\09\09\09exit_value=0;\09\09\09\09\09\09\09\09\09\09}\09\09\09\09\09\09\09\09\09\09\09\09\09}\09\09\09\09\09\09\09\09\09\09\09\09\09\09END{\09\09\09\09\09\09\09\09\09\09\09\09\09\09exit (exit_value);\09\09\09\09\09\09\09\09\09}' /proc/cpuinfo >/tmp/cpufreq.txt; \09\09\09\09\00"
@.str.1 = [17 x i8] c"/tmp/cpufreq.txt\00"
@.str.2 = [2 x i8] c"r\00"
define double @cpufreq_info() {
%1 = alloca [30 x i8]
%2 = alloca i32*
%3 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
store i8 0, i8* %3
%4 = call i32 @system(i8* getelementptr inbounds ([297 x i8], [297 x i8]* @.str, i64 0, i64 0))
%5 = icmp ne i32 %4, -1
br i1 %5, label %6, label %17
6: ; preds = %0
%7 = call i32* @fopen(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %7, i32** %2
%8 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
%9 = load i32*, i32** %2
%10 = call i32* @fgets(i8* %8, i32 30, i32* %9)
%11 = icmp eq i32* %10, null
br i1 %11, label %12, label %14
12: ; preds = %6
%13 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
store i8 0, i8* %13
br label %14
14: ; preds = %12, %6
%15 = load i32*, i32** %2
%16 = call i32 @fclose(i32* %15)
br label %17
17: ; preds = %14, %0
%18 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
%19 = call double @atof(i8* %18)
ret double %19
}

LLVM IR (-O2):
@.str = [297 x i8] c"\09\09\09\09\09\09\09\09\09awk 'BEGIN{\09\09\09\09\09\09\09\09\09\09\09\09\09\09exit_value=1;\09\09\09\09\09\09\09\09\09\09}\09\09\09\09\09\09\09\09\09\09\09\09\09\09{\09\09\09\09\09\09\09\09\09\09\09\09\09\09\09if ($0 ~ /^cpu[[:blank:]]+MHz[[:blank:]]+:/) {\09\09\09\09print $0;\09\09\09\09\09\09\09\09\09\09\09\09exit_value=0;\09\09\09\09\09\09\09\09\09\09}\09\09\09\09\09\09\09\09\09\09\09\09\09}\09\09\09\09\09\09\09\09\09\09\09\09\09\09END{\09\09\09\09\09\09\09\09\09\09\09\09\09\09exit (exit_value);\09\09\09\09\09\09\09\09\09}' /proc/cpuinfo >/tmp/cpufreq.txt; \09\09\09\09\00"
@.str.1 = [17 x i8] c"/tmp/cpufreq.txt\00"
@.str.2 = [2 x i8] c"r\00"
define double @cpufreq_info() {
%1 = alloca [30 x i8]
%2 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
store i8 0, i8* %2
%3 = tail call i32 @system(i8* getelementptr inbounds ([297 x i8], [297 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32 %3, -1
br i1 %4, label %12, label %5
5: ; preds = %0
%6 = tail call i32* @fopen(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32* @fgets(i8* %2, i32 30, i32* %6)
%8 = icmp eq i32* %7, null
br i1 %8, label %9, label %10
9: ; preds = %5
store i8 0, i8* %2
br label %10
10: ; preds = %9, %5
%11 = call i32 @fclose(i32* %6)
br label %12
12: ; preds = %10, %0
%13 = call double @atof(i8* %2)
ret double %13
}