#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 */
struct cpufreq_available_frequencies {
  int dummy;
};

/* Variables and functions */
struct cpufreq_available_frequencies *
proc_get_available_frequencies(unsigned int);
struct cpufreq_available_frequencies *
sysfs_get_available_frequencies(unsigned int);
struct cpufreq_available_frequencies *
cpufreq_get_available_frequencies(unsigned int cpu) {
  struct cpufreq_available_frequencies *ret;
  ret = sysfs_get_available_frequencies(cpu);
  if (!ret)
    ret = proc_get_available_frequencies(cpu);
  return (ret);
}


x86 assembly (clang, -O0):
<cpufreq_get_available_frequencies>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <sysfs_get_available_frequencies@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    114e <cpufreq_get_available_frequencies+0x2e>
mov    -0x4(%rbp),%edi
call   1040 <proc_get_available_frequencies@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpufreq_get_available_frequencies>:
push   %rbx
mov    %edi,%ebx
call   1030 <sysfs_get_available_frequencies@plt>
test   %rax,%rax
je     112f <cpufreq_get_available_frequencies+0xf>
pop    %rbx
ret
mov    %ebx,%edi
pop    %rbx
jmp    1040 <proc_get_available_frequencies@plt>

LLVM IR (-O0):
%struct.cpufreq_available_frequencies = type { i32 }
define %struct.cpufreq_available_frequencies* @cpufreq_get_available_frequencies(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.cpufreq_available_frequencies*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call %struct.cpufreq_available_frequencies* @sysfs_get_available_frequencies(i32 %4)
store %struct.cpufreq_available_frequencies* %5, %struct.cpufreq_available_frequencies** %3
%6 = load %struct.cpufreq_available_frequencies*, %struct.cpufreq_available_frequencies** %3
%7 = icmp ne %struct.cpufreq_available_frequencies* %6, null
br i1 %7, label %11, label %8
8: ; preds = %1
%9 = load i32, i32* %2
%10 = call %struct.cpufreq_available_frequencies* @proc_get_available_frequencies(i32 %9)
store %struct.cpufreq_available_frequencies* %10, %struct.cpufreq_available_frequencies** %3
br label %11
11: ; preds = %8, %1
%12 = load %struct.cpufreq_available_frequencies*, %struct.cpufreq_available_frequencies** %3
ret %struct.cpufreq_available_frequencies* %12
}

LLVM IR (-O2):
%struct.cpufreq_available_frequencies = type { i32 }
define %struct.cpufreq_available_frequencies* @cpufreq_get_available_frequencies(i32 %0) {
%2 = tail call %struct.cpufreq_available_frequencies* @sysfs_get_available_frequencies(i32 %0)
%3 = icmp eq %struct.cpufreq_available_frequencies* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call %struct.cpufreq_available_frequencies* @proc_get_available_frequencies(i32 %0)
br label %6
6: ; preds = %4, %1
%7 = phi %struct.cpufreq_available_frequencies* [ %2, %1 ], [ %5, %4 ]
ret %struct.cpufreq_available_frequencies* %7
}