#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 getloadavg(double *, int);
int /*<<< orphan*/ printf(char *, int, double);
int main() {
  double la[3];
  int i, rv;
  rv = getloadavg(la, 3);
  for (i = 0; i < rv; i++) {
    printf("%d\tn\t%f\n", i == 0 ? 1 : i == 1 ? 5 : 15, la[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x3,%esi
call   1030 <getloadavg@plt>
mov    %eax,-0x28(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    11a7 <main+0x87>
cmpl   $0x0,-0x24(%rbp)
jne    116a <main+0x4a>
mov    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1180 <main+0x60>
mov    -0x24(%rbp),%edx
mov    $0xf,%eax
mov    $0x5,%ecx
cmp    $0x1,%edx
cmove  %ecx,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%esi
movslq -0x24(%rbp),%rax
movsd  -0x20(%rbp,%rax,8),%xmm0
lea    0xe6c(%rip),%rdi
call   1040 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1147 <main+0x27>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x20,%rsp
mov    %rsp,%rdi
mov    $0x3,%esi
call   1030 <getloadavg@plt>
test   %eax,%eax
jle    1189 <main+0x69>
mov    %eax,%r15d
xor    %ebx,%ebx
mov    $0x5,%r12d
mov    $0x1,%ebp
lea    0xeac(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmp    $0x1,%rbx
mov    $0xf,%esi
cmove  %r12d,%esi
test   %rbx,%rbx
cmove  %ebp,%esi
movsd  (%rsp,%rbx,8),%xmm0
mov    %r14,%rdi
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1160 <main+0x40>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%d\09n\09%f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x double]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 0, i64 0
%6 = call i32 @getloadavg(double* %5, i32 3)
store i32 %6, i32* %4
store i32 0, i32* %3
br label %7
7: ; preds = %27, %0
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %30
11: ; preds = %7
%12 = load i32, i32* %3
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %11
br label %20
15: ; preds = %11
%16 = load i32, i32* %3
%17 = icmp eq i32 %16, 1
%18 = zext i1 %17 to i64
%19 = select i1 %17, i32 5, i32 15
br label %20
20: ; preds = %15, %14
%21 = phi i32 [ 1, %14 ], [ %19, %15 ]
%22 = load i32, i32* %3
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 0, i64 %23
%25 = load double, double* %24
%26 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %21, double %25)
br label %27
27: ; preds = %20
%28 = load i32, i32* %3
%29 = add nsw i32 %28, 1
store i32 %29, i32* %3
br label %7
30: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"%d\09n\09%f\0A\00"
define i32 @main() {
%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 sgt i32 %4, 0
br i1 %5, label %6, label %19
6: ; preds = %0
%7 = zext i32 %4 to i64
br label %8
8: ; preds = %6, %8
%9 = phi i64 [ 0, %6 ], [ %17, %8 ]
%10 = icmp eq i64 %9, 0
%11 = icmp eq i64 %9, 1
%12 = select i1 %11, i32 5, i32 15
%13 = select i1 %10, i32 1, i32 %12
%14 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 0, i64 %9
%15 = load double, double* %14
%16 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %13, double %15)
%17 = add nuw nsw i64 %9, 1
%18 = icmp eq i64 %17, %7
br i1 %18, label %19, label %8
19: ; preds = %8, %0
ret i32 0
}