#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 */
scalar_t__ cpufreq_cpu_exists(int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int maxcpuid = 4;
  for (int cpuid = 0; cpuid <= maxcpuid; cpuid++) {
    if (cpufreq_cpu_exists(cpuid) == 0) {
      printf("cpu %d is exists\n", cpuid);
    } else {
      printf("cpu %d is not exists\n", cpuid);
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x4,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1191 <main+0x71>
mov    -0xc(%rbp),%edi
call   1030 <cpufreq_cpu_exists@plt>
cmp    $0x0,%rax
jne    116f <main+0x4f>
mov    -0xc(%rbp),%esi
lea    0xe9b(%rip),%rdi
call   1040 <printf@plt>
jmp    117e <main+0x5e>
mov    -0xc(%rbp),%esi
lea    0xe99(%rip),%rdi
call   1040 <printf@plt>
jmp    1183 <main+0x63>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113d <main+0x1d>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %edi,%edi
call   1030 <cpufreq_cpu_exists@plt>
test   %rax,%rax
lea    0xecb(%rip),%r14
lea    0xed6(%rip),%rbx
mov    %rbx,%rdi
cmove  %r14,%rdi
xor    %esi,%esi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1030 <cpufreq_cpu_exists@plt>
test   %rax,%rax
mov    %rbx,%rdi
cmove  %r14,%rdi
mov    $0x1,%esi
call   1040 <printf@plt>
mov    $0x2,%edi
call   1030 <cpufreq_cpu_exists@plt>
test   %rax,%rax
mov    %rbx,%rdi
cmove  %r14,%rdi
mov    $0x2,%esi
call   1040 <printf@plt>
mov    $0x3,%edi
call   1030 <cpufreq_cpu_exists@plt>
test   %rax,%rax
mov    %rbx,%rdi
cmove  %r14,%rdi
mov    $0x3,%esi
call   1040 <printf@plt>
mov    $0x4,%edi
call   1030 <cpufreq_cpu_exists@plt>
test   %rax,%rax
cmove  %r14,%rbx
mov    %rbx,%rdi
mov    $0x4,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [18 x i8] c"cpu %d is exists\0A\00"
@.str.1 = [22 x i8] c"cpu %d is not exists\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 4, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %19, %0
%5 = load i32, i32* %3
%6 = load i32, i32* %2
%7 = icmp sle i32 %5, %6
br i1 %7, label %8, label %22
8: ; preds = %4
%9 = load i32, i32* %3
%10 = call i64 @cpufreq_cpu_exists(i32 %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %8
%13 = load i32, i32* %3
%14 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %13)
br label %18
15: ; preds = %8
%16 = load i32, i32* %3
%17 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %16)
br label %18
18: ; preds = %15, %12
br label %19
19: ; preds = %18
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
br label %4
22: ; preds = %4
%23 = load i32, i32* %1
ret i32 %23
}

LLVM IR (-O2):
@.str = [18 x i8] c"cpu %d is exists\0A\00"
@.str.1 = [22 x i8] c"cpu %d is not exists\0A\00"
define i32 @main() {
%1 = tail call i64 @cpufreq_cpu_exists(i32 0)
%2 = icmp eq i64 %1, 0
%3 = select i1 %2, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0)
%4 = tail call i32 @printf(i8* %3, i32 0)
%5 = tail call i64 @cpufreq_cpu_exists(i32 1)
%6 = icmp eq i64 %5, 0
%7 = select i1 %6, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0)
%8 = tail call i32 @printf(i8* %7, i32 1)
%9 = tail call i64 @cpufreq_cpu_exists(i32 2)
%10 = icmp eq i64 %9, 0
%11 = select i1 %10, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0)
%12 = tail call i32 @printf(i8* %11, i32 2)
%13 = tail call i64 @cpufreq_cpu_exists(i32 3)
%14 = icmp eq i64 %13, 0
%15 = select i1 %14, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0)
%16 = tail call i32 @printf(i8* %15, i32 3)
%17 = tail call i64 @cpufreq_cpu_exists(i32 4)
%18 = icmp eq i64 %17, 0
%19 = select i1 %18, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0)
%20 = tail call i32 @printf(i8* %19, i32 4)
ret i32 0
}