#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 */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ getloadavg(double *, int);
int /*<<< orphan*/ printf(char *);
int cond_idle() {
  double loadavg[3];
  if (!getloadavg(loadavg, 3)) {
    printf("Error, could not retreive system load averages.\n");
    exit(EXIT_FAILURE);
  }
  if (loadavg[1] < 0.10) {
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<cond_idle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x20(%rbp),%rdi
mov    $0x3,%esi
call   1030 <getloadavg@plt>
cmp    $0x0,%eax
jne    1169 <cond_idle+0x39>
lea    0xeb2(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e7e(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
movsd  0xe8f(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1188 <cond_idle+0x58>
movl   $0x1,-0x4(%rbp)
jmp    118f <cond_idle+0x5f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cond_idle>:
sub    $0x18,%rsp
mov    %rsp,%rdi
mov    $0x3,%esi
call   1040 <getloadavg@plt>
test   %eax,%eax
je     115d <cond_idle+0x2d>
movsd  0xeb3(%rip),%xmm0
xor    %eax,%eax
ucomisd 0x8(%rsp),%xmm0
seta   %al
add    $0x18,%rsp
ret
lea    0xea4(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e70(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [49 x i8] c"Error, could not retreive system load averages.\0A\00"
@EXIT_FAILURE = global i32 0
define i32 @cond_idle() {
%1 = alloca i32
%2 = alloca [3 x double]
%3 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 0, i64 0
%4 = call i32 @getloadavg(double* %3, i32 3)
%5 = icmp ne i32 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %0
%7 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* @EXIT_FAILURE
%9 = call i32 @exit(i32 %8)
unreachable
10: ; preds = %0
%11 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 0, i64 1
%12 = load double, double* %11
%13 = fcmp olt double %12, 1.000000e-01
br i1 %13, label %14, label %15
14: ; preds = %10
store i32 1, i32* %1
br label %16
15: ; preds = %10
store i32 0, i32* %1
br label %16
16: ; preds = %15, %14
%17 = load i32, i32* %1
ret i32 %17
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@str = [48 x i8] c"Error, could not retreive system load averages.\00"
define i32 @cond_idle() {
%1 = alloca [3 x double]
%2 = bitcast [3 x double]* %1 to i8*
%3 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 0, i64 0
%4 = call i32 @getloadavg(double* %3, i32 3)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %0
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str, i64 0, i64 0))
%8 = load i32, i32* @EXIT_FAILURE
%9 = call i32 @exit(i32 %8)
unreachable
10: ; preds = %0
%11 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 0, i64 1
%12 = load double, double* %11
%13 = fcmp olt double %12, 1.000000e-01
%14 = zext i1 %13 to i32
ret i32 %14
}