#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*/ snprintf(char *, int, char *, char *, char *, char *,
                            double);
int /*<<< orphan*/ strncpy(char *, char *, int);
char *get_load() {
  static double loadavg[3] = {0};
  static char ret[50] = {0};
  if ((getloadavg(loadavg, 3)) == -1) {
    strncpy(ret, "err", 14);
    return ret;
  }
  snprintf(ret, 50, "%s %s\ue608%s %1.2f", "", "%{F#808080}", "%{F#FFFFFF}",
           loadavg[0]);
  return ret;
}


x86 assembly (clang, -O0):
<get_load>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0x2f11(%rip),%rdi
mov    $0x3,%esi
call   1040 <getloadavg@plt>
cmp    $0xffffffff,%eax
jne    117a <get_load+0x4a>
lea    0x2f17(%rip),%rdi
lea    0xea0(%rip),%rsi
mov    $0xe,%edx
call   1030 <strncpy@plt>
lea    0x2eff(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11ba <get_load+0x8a>
movsd  0x2ece(%rip),%xmm0
lea    0x2ee7(%rip),%rdi
mov    $0x32,%esi
lea    0xe6f(%rip),%rdx
lea    0xe79(%rip),%rcx
lea    0xe76(%rip),%r8
lea    0xe7b(%rip),%r9
call   1050 <snprintf@plt>
lea    0x2eba(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_load>:
push   %rax
lea    0x2f18(%rip),%rdi
mov    $0x3,%esi
call   1040 <getloadavg@plt>
cmp    $0xffffffff,%eax
je     117e <get_load+0x4e>
movsd  0x2f01(%rip),%xmm0
lea    0x2f1a(%rip),%rdi
lea    0xea7(%rip),%rdx
lea    0xeb1(%rip),%rcx
lea    0xeae(%rip),%r8
lea    0xeb3(%rip),%r9
mov    $0x32,%esi
call   1050 <snprintf@plt>
jmp    1196 <get_load+0x66>
lea    0x2eeb(%rip),%rdi
lea    0xe74(%rip),%rsi
mov    $0xe,%edx
call   1030 <strncpy@plt>
lea    0x2ed3(%rip),%rax
pop    %rcx
ret

LLVM IR (-O0):
@get_load.loadavg = internal global [3 x double] zeroinitializer
@get_load.ret = internal global [50 x i8] zeroinitializer
@.str = [4 x i8] c"err\00"
@.str.1 = [17 x i8] c"%s %s\EE\98\88%s %1.2f\00"
@.str.2 = [4 x i8] c"\EE\82\B3\00"
@.str.3 = [12 x i8] c"%{F}\00"
@.str.4 = [12 x i8] c"%{F#FFFFFF}\00"
define i8* @get_load() {
%1 = alloca i8*
%2 = call i32 @getloadavg(double* getelementptr inbounds ([3 x double], [3 x double]* @get_load.loadavg, i64 0, i64 0), i32 3)
%3 = icmp eq i32 %2, -1
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 @strncpy(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @get_load.ret, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 14)
store i8* getelementptr inbounds ([50 x i8], [50 x i8]* @get_load.ret, i64 0, i64 0), i8** %1
br label %9
6: ; preds = %0
%7 = load double, double* getelementptr inbounds ([3 x double], [3 x double]* @get_load.loadavg, i64 0, i64 0)
%8 = call i32 @snprintf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @get_load.ret, i64 0, i64 0), i32 50, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), double %7)
store i8* getelementptr inbounds ([50 x i8], [50 x i8]* @get_load.ret, i64 0, i64 0), i8** %1
br label %9
9: ; preds = %6, %4
%10 = load i8*, i8** %1
ret i8* %10
}

LLVM IR (-O2):
@get_load.loadavg = internal global [3 x double] zeroinitializer
@get_load.ret = internal global [50 x i8] zeroinitializer
@.str = [4 x i8] c"err\00"
@.str.1 = [17 x i8] c"%s %s\EE\98\88%s %1.2f\00"
@.str.2 = [4 x i8] c"\EE\82\B3\00"
@.str.3 = [12 x i8] c"%{F}\00"
@.str.4 = [12 x i8] c"%{F#FFFFFF}\00"
define i8* @get_load() {
%1 = tail call i32 @getloadavg(double* getelementptr inbounds ([3 x double], [3 x double]* @get_load.loadavg, i64 0, i64 0), i32 3)
%2 = icmp eq i32 %1, -1
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @strncpy(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @get_load.ret, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 14)
br label %8
5: ; preds = %0
%6 = load double, double* getelementptr inbounds ([3 x double], [3 x double]* @get_load.loadavg, i64 0, i64 0)
%7 = tail call i32 @snprintf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @get_load.ret, i64 0, i64 0), i32 50, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), double %6)
br label %8
8: ; preds = %5, %3
ret i8* getelementptr inbounds ([50 x i8], [50 x i8]* @get_load.ret, i64 0, i64 0)
}