#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 fscanf(int /*<<< orphan*/ *, char *, float *, float *, float *);
void get_load_average(float *load_1, float *load_5, float *load_15) {
  FILE *fff;
  int result;
  fff = fopen("/proc/loadavg", "r");
  if (fff != NULL) {
    result = fscanf(fff,
                    "%f"
                    "%f"
                    "%f",
                    load_1, load_5, load_15);
    fclose(fff);
  }
  (void)result;
}


x86 assembly (clang, -O0):
<get_load_average>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xeb5(%rip),%rdi
lea    0xebc(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     118e <get_load_average+0x5e>
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
lea    0xe93(%rip),%rsi
call   1040 <fscanf@plt>
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_load_average>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
lea    0xeb8(%rip),%rdi
lea    0xebf(%rip),%rsi
call   1050 <fopen@plt>
test   %rax,%rax
je     1187 <get_load_average+0x57>
mov    %rax,%rbx
lea    0xead(%rip),%rsi
mov    %rax,%rdi
mov    %r12,%rdx
mov    %r15,%rcx
mov    %r14,%r8
call   1040 <fscanf@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <fclose@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [14 x i8] c"/proc/loadavg\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [7 x i8] c"%f%f%f\00"
define void @get_load_average(float* %0, float* %1, float* %2) {
%4 = alloca float*
%5 = alloca float*
%6 = alloca float*
%7 = alloca i32*
%8 = alloca i32
store float* %0, float** %4
store float* %1, float** %5
store float* %2, float** %6
%9 = call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %9, i32** %7
%10 = load i32*, i32** %7
%11 = icmp ne i32* %10, null
br i1 %11, label %12, label %20
12: ; preds = %3
%13 = load i32*, i32** %7
%14 = load float*, float** %4
%15 = load float*, float** %5
%16 = load float*, float** %6
%17 = call i32 @fscanf(i32* %13, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), float* %14, float* %15, float* %16)
store i32 %17, i32* %8
%18 = load i32*, i32** %7
%19 = call i32 @fclose(i32* %18)
br label %20
20: ; preds = %12, %3
%21 = load i32, i32* %8
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"/proc/loadavg\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [7 x i8] c"%f%f%f\00"
define void @get_load_average(float* %0, float* %1, float* %2) {
%4 = tail call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%5 = icmp eq i32* %4, null
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = tail call i32 @fscanf(i32* %4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), float* %0, float* %1, float* %2)
%8 = tail call i32 @fclose(i32* %4)
br label %9
9: ; preds = %6, %3
ret void
}