#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*/ time_t;
struct utmp {
  scalar_t__ ut_type;
  int /*<<< orphan*/ ut_user;
};
struct tm {
  double tm_hour;
  double tm_min;
  double tm_sec;
};

/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
scalar_t__ USER_PROCESS;
int /*<<< orphan*/ endutent();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
struct utmp *getutent();
int /*<<< orphan*/ loadavg(double *, double *, double *);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ setutent();
int sprintf(char *, char *, double, ...);
int /*<<< orphan*/ strcat(char *, char *);
scalar_t__ strlen(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int /*<<< orphan*/ uptime(double *, double *);
int main(int argc, char *argv[]) {
  time_t real_time;
  struct tm *tmp;
  char out_buf[128];
  int pos = 0, updays = 0, uphours = 0, upminutes = 0, num_users = 0;
  double uptime_secs, idle_secs, av1, av5, av15;
  struct utmp *utmpp;
  time(&real_time);
  tmp = localtime(&real_time);
  pos = sprintf(out_buf, " %02d:%02d:%02d ", tmp->tm_hour, tmp->tm_min,
                tmp->tm_sec);
  strcat(out_buf, "up ");
  pos += 3;
  uptime(&uptime_secs, &idle_secs);
  updays = (int)uptime_secs / (60 * 60 * 24);
  if (updays) {
    pos +=
        sprintf(out_buf + pos, "%d day%s, ", updays, (updays != 1) ? "s" : "");
  }
  upminutes = (int)uptime_secs / 60;
  uphours = (int)upminutes / 60;
  uphours = (int)uphours % 24;
  upminutes = upminutes % 60;
  if (uphours) {
    pos += sprintf(out_buf + pos, "%2d:%2d, ", uphours, upminutes);
  } else {
    pos += sprintf(out_buf + pos, "%d min, ", upminutes);
  }
  setutent();
  while ((utmpp = getutent()) != NULL) {
    if ((utmpp->ut_type == USER_PROCESS) && strlen(utmpp->ut_user)) {
      num_users++;
    }
  }
  endutent();
  pos += sprintf(out_buf + pos, "%2d user%s,  ", num_users,
                 (num_users != 1) ? "s" : "");
  loadavg(&av1, &av5, &av15);
  sprintf(out_buf + pos, "load average: %0.2f, %0.2f, %0.2f", av1, av5, av15);
  printf("%s\n", out_buf);
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0xa4(%rbp)
movl   $0x0,-0xa8(%rbp)
movl   $0x0,-0xac(%rbp)
movl   $0x0,-0xb0(%rbp)
movl   $0x0,-0xb4(%rbp)
lea    -0x14(%rbp),%rdi
call   1090 <time@plt>
lea    -0x14(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x20(%rbp)
lea    -0xa0(%rbp),%rdi
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x20(%rbp),%rax
movsd  0x10(%rax),%xmm2
lea    0xdb7(%rip),%rsi
mov    $0x3,%al
call   10d0 <sprintf@plt>
mov    %eax,-0xa4(%rbp)
lea    -0xa0(%rbp),%rdi
lea    0xdad(%rip),%rsi
call   10c0 <strcat@plt>
mov    -0xa4(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0xa4(%rbp)
lea    -0xc0(%rbp),%rdi
lea    -0xc8(%rbp),%rsi
call   1080 <uptime@plt>
cvttsd2si -0xc0(%rbp),%eax
ff
mov    $0x15180,%ecx
cltd
idiv   %ecx
mov    %eax,-0xa8(%rbp)
cmpl   $0x0,-0xa8(%rbp)
je     12fc <main+0x13c>
lea    -0xa0(%rbp),%rdi
movslq -0xa4(%rbp),%rax
add    %rax,%rdi
cvtsi2sdl -0xa8(%rbp),%xmm0
ff
mov    -0xa8(%rbp),%ecx
lea    0xd94(%rip),%rdx
lea    0xd45(%rip),%rax
cmp    $0x1,%ecx
cmovne %rax,%rdx
lea    0xd2c(%rip),%rsi
mov    $0x1,%al
call   10d0 <sprintf@plt>
add    -0xa4(%rbp),%eax
mov    %eax,-0xa4(%rbp)
cvttsd2si -0xc0(%rbp),%eax
ff
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,-0xb0(%rbp)
mov    -0xb0(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,-0xac(%rbp)
mov    -0xac(%rbp),%eax
mov    $0x18,%ecx
cltd
idiv   %ecx
mov    %edx,-0xac(%rbp)
mov    -0xb0(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,-0xb0(%rbp)
cmpl   $0x0,-0xac(%rbp)
je     1399 <main+0x1d9>
lea    -0xa0(%rbp),%rdi
movslq -0xa4(%rbp),%rax
add    %rax,%rdi
cvtsi2sdl -0xac(%rbp),%xmm0
ff
mov    -0xb0(%rbp),%edx
lea    0xca1(%rip),%rsi
mov    $0x1,%al
call   10d0 <sprintf@plt>
add    -0xa4(%rbp),%eax
mov    %eax,-0xa4(%rbp)
jmp    13cc <main+0x20c>
lea    -0xa0(%rbp),%rdi
movslq -0xa4(%rbp),%rax
add    %rax,%rdi
cvtsi2sdl -0xb0(%rbp),%xmm0
ff
lea    0xc73(%rip),%rsi
mov    $0x1,%al
call   10d0 <sprintf@plt>
add    -0xa4(%rbp),%eax
mov    %eax,-0xa4(%rbp)
mov    $0x0,%al
call   10b0 <setutent@plt>
mov    $0x0,%al
call   10a0 <getutent@plt>
mov    %rax,-0xe8(%rbp)
cmp    $0x0,%rax
je     1432 <main+0x272>
mov    -0xe8(%rbp),%rax
mov    (%rax),%rax
mov    0x2bec(%rip),%rcx
cmp    (%rcx),%rax
jne    142d <main+0x26d>
mov    -0xe8(%rbp),%rax
mov    0x8(%rax),%edi
call   1050 <strlen@plt>
cmp    $0x0,%rax
je     142d <main+0x26d>
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    13d3 <main+0x213>
mov    $0x0,%al
call   1070 <endutent@plt>
lea    -0xa0(%rbp),%rdi
movslq -0xa4(%rbp),%rax
add    %rax,%rdi
cvtsi2sdl -0xb4(%rbp),%xmm0
ff
mov    -0xb4(%rbp),%ecx
lea    0xc09(%rip),%rdx
lea    0xbba(%rip),%rax
cmp    $0x1,%ecx
cmovne %rax,%rdx
lea    0xbc1(%rip),%rsi
mov    $0x1,%al
call   10d0 <sprintf@plt>
add    -0xa4(%rbp),%eax
mov    %eax,-0xa4(%rbp)
lea    -0xd0(%rbp),%rdi
lea    -0xd8(%rbp),%rsi
lea    -0xe0(%rbp),%rdx
call   1040 <loadavg@plt>
lea    -0xa0(%rbp),%rdi
movslq -0xa4(%rbp),%rax
add    %rax,%rdi
movsd  -0xd0(%rbp),%xmm0
ff
movsd  -0xd8(%rbp),%xmm1
ff
movsd  -0xe0(%rbp),%xmm2
ff
lea    0xb72(%rip),%rsi
mov    $0x3,%al
call   10d0 <sprintf@plt>
lea    -0xa0(%rbp),%rsi
lea    0xb7f(%rip),%rdi
call   1060 <printf@plt>
mov    0x2ae6(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0xb0,%rsp
lea    0x24(%rsp),%rbx
mov    %rbx,%rdi
call   1090 <time@plt>
mov    %rbx,%rdi
call   1030 <localtime@plt>
movsd  (%rax),%xmm0
movsd  0x8(%rax),%xmm1
movsd  0x10(%rax),%xmm2
lea    0xe0b(%rip),%rsi
lea    0x30(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x3,%al
call   10d0 <sprintf@plt>
mov    %eax,%ebx
lea    0xe04(%rip),%rsi
mov    %rbp,%rdi
call   10c0 <strcat@plt>
add    $0x3,%ebx
mov    %rsp,%rdi
lea    0x28(%rsp),%rsi
call   1080 <uptime@plt>
cvttsd2si (%rsp),%eax
lea    0x1517f(%rax),%ecx
cmp    $0x2a2ff,%ecx
jb     1295 <main+0xd5>
movslq %eax,%rcx
imul   $0xffffffffc22e4507,%rcx,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x10,%ecx
add    %edx,%ecx
movslq %ebx,%rbx
lea    (%rsp,%rbx,1),%rdi
add    $0x30,%rdi
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
add    $0xfffeae80,%eax
cmp    $0x15180,%eax
lea    0xdf3(%rip),%rax
lea    0xda4(%rip),%rdx
cmovb  %rax,%rdx
lea    0xd8e(%rip),%rsi
mov    $0x1,%al
call   10d0 <sprintf@plt>
add    %eax,%ebx
cvttsd2si (%rsp),%eax
movslq %eax,%rcx
imul   $0xffffffff88888889,%rcx,%rax
shr    $0x20,%rax
add    %ecx,%eax
mov    %eax,%edx
shr    $0x1f,%edx
sar    $0x5,%eax
add    %edx,%eax
imul   $0xffffffff91a2b3c5,%rcx,%rdx
shr    $0x20,%rdx
add    %ecx,%edx
mov    %edx,%ecx
shr    $0x1f,%ecx
sar    $0xb,%edx
add    %ecx,%edx
movslq %edx,%rcx
imul   $0x2aaaaaab,%rcx,%rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
shr    $0x22,%rdx
add    %esi,%edx
shl    $0x3,%edx
lea    (%rdx,%rdx,2),%esi
movslq %eax,%rdx
imul   $0xffffffff88888889,%rdx,%rax
shr    $0x20,%rax
add    %edx,%eax
mov    %eax,%edi
shr    $0x1f,%edi
sar    $0x5,%eax
add    %edi,%eax
imul   $0x3c,%eax,%eax
sub    %eax,%edx
movslq %ebx,%rax
lea    (%rsp,%rax,1),%rdi
add    $0x30,%rdi
sub    %esi,%ecx
jne    1328 <main+0x168>
xorps  %xmm0,%xmm0
cvtsi2sd %edx,%xmm0
lea    0xd0d(%rip),%rsi
mov    $0x1,%al
call   10d0 <sprintf@plt>
jmp    133d <main+0x17d>
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
lea    0xcec(%rip),%rsi
mov    $0x1,%al
call   10d0 <sprintf@plt>
mov    %eax,%r14d
add    %ebx,%r14d
xor    %ebx,%ebx
xor    %eax,%eax
call   10b0 <setutent@plt>
xor    %eax,%eax
call   10a0 <getutent@plt>
test   %rax,%rax
jne    13f8 <main+0x238>
xor    %eax,%eax
call   1070 <endutent@plt>
movslq %r14d,%rbp
lea    (%rsp,%rbp,1),%rdi
add    $0x30,%rdi
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
cmp    $0x1,%ebx
lea    0xce9(%rip),%rax
lea    0xc9a(%rip),%rdx
cmove  %rax,%rdx
lea    0xca4(%rip),%rsi
mov    $0x1,%al
call   10d0 <sprintf@plt>
add    %eax,%ebp
lea    0x18(%rsp),%rdi
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1040 <loadavg@plt>
movslq %ebp,%rax
lea    (%rsp,%rax,1),%rdi
add    $0x30,%rdi
movsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
movsd  0x8(%rsp),%xmm2
lea    0xc71(%rip),%rsi
mov    $0x3,%al
call   10d0 <sprintf@plt>
lea    0xc85(%rip),%rdi
lea    0x30(%rsp),%rsi
call   1060 <printf@plt>
mov    0x2be7(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
mov    0x2be9(%rip),%rbp
xor    %ebx,%ebx
jmp    1420 <main+0x260>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   10a0 <getutent@plt>
test   %rax,%rax
je     135c <main+0x19c>
mov    (%rax),%rcx
cmp    0x0(%rbp),%rcx
jne    1410 <main+0x250>
mov    0x8(%rax),%edi
call   1050 <strlen@plt>
cmp    $0x1,%rax
sbb    $0xffffffff,%ebx
jmp    1410 <main+0x250>

LLVM IR (-O0):
%struct.tm = type { double, double, double }
%struct.utmp = type { i64, i32 }
@.str = [17 x i8] c" %02d:%02d:%02d \00"
@.str.1 = [4 x i8] c"up \00"
@.str.2 = [11 x i8] c"%d day%s, \00"
@.str.3 = [2 x i8] c"s\00"
@.str.4 = [1 x i8] zeroinitializer
@.str.5 = [10 x i8] c"%2d:%2d, \00"
@.str.6 = [9 x i8] c"%d min, \00"
@USER_PROCESS = global i64 0
@.str.7 = [14 x i8] c"%2d user%s, \00"
@.str.8 = [34 x i8] c"load average: %0.2f, %0.2f, %0.2f\00"
@.str.9 = [4 x i8] c"%s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca %struct.tm*
%8 = alloca [128 x i8]
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca %struct.utmp*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %9
store i32 0, i32* %10
store i32 0, i32* %11
store i32 0, i32* %12
store i32 0, i32* %13
%20 = call i32 @time(i32* %6)
%21 = call %struct.tm* @localtime(i32* %6)
store %struct.tm* %21, %struct.tm** %7
%22 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%23 = load %struct.tm*, %struct.tm** %7
%24 = getelementptr inbounds %struct.tm, %struct.tm* %23, i32 0, i32 0
%25 = load double, double* %24
%26 = load %struct.tm*, %struct.tm** %7
%27 = getelementptr inbounds %struct.tm, %struct.tm* %26, i32 0, i32 1
%28 = load double, double* %27
%29 = load %struct.tm*, %struct.tm** %7
%30 = getelementptr inbounds %struct.tm, %struct.tm* %29, i32 0, i32 2
%31 = load double, double* %30
%32 = call i32 (i8*, i8*, double, ...) @sprintf(i8* %22, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), double %25, double %28, double %31)
store i32 %32, i32* %9
%33 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%34 = call i32 @strcat(i8* %33, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%35 = load i32, i32* %9
%36 = add nsw i32 %35, 3
store i32 %36, i32* %9
%37 = call i32 @uptime(double* %14, double* %15)
%38 = load double, double* %14
%39 = fptosi double %38 to i32
%40 = sdiv i32 %39, 86400
store i32 %40, i32* %10
%41 = load i32, i32* %10
%42 = icmp ne i32 %41, 0
br i1 %42, label %43, label %57
43: ; preds = %2
%44 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%45 = load i32, i32* %9
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8, i8* %44, i64 %46
%48 = load i32, i32* %10
%49 = sitofp i32 %48 to double
%50 = load i32, i32* %10
%51 = icmp ne i32 %50, 1
%52 = zext i1 %51 to i64
%53 = select i1 %51, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0)
%54 = call i32 (i8*, i8*, double, ...) @sprintf(i8* %47, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), double %49, i8* %53)
%55 = load i32, i32* %9
%56 = add nsw i32 %55, %54
store i32 %56, i32* %9
br label %57
57: ; preds = %43, %2
%58 = load double, double* %14
%59 = fptosi double %58 to i32
%60 = sdiv i32 %59, 60
store i32 %60, i32* %12
%61 = load i32, i32* %12
%62 = sdiv i32 %61, 60
store i32 %62, i32* %11
%63 = load i32, i32* %11
%64 = srem i32 %63, 24
store i32 %64, i32* %11
%65 = load i32, i32* %12
%66 = srem i32 %65, 60
store i32 %66, i32* %12
%67 = load i32, i32* %11
%68 = icmp ne i32 %67, 0
br i1 %68, label %69, label %80
69: ; preds = %57
%70 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%71 = load i32, i32* %9
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds i8, i8* %70, i64 %72
%74 = load i32, i32* %11
%75 = sitofp i32 %74 to double
%76 = load i32, i32* %12
%77 = call i32 (i8*, i8*, double, ...) @sprintf(i8* %73, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), double %75, i32 %76)
%78 = load i32, i32* %9
%79 = add nsw i32 %78, %77
store i32 %79, i32* %9
br label %90
80: ; preds = %57
%81 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%82 = load i32, i32* %9
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds i8, i8* %81, i64 %83
%85 = load i32, i32* %12
%86 = sitofp i32 %85 to double
%87 = call i32 (i8*, i8*, double, ...) @sprintf(i8* %84, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), double %86)
%88 = load i32, i32* %9
%89 = add nsw i32 %88, %87
store i32 %89, i32* %9
br label %90
90: ; preds = %80, %69
%91 = call i32 (...) @setutent()
br label %92
92: ; preds = %110, %90
%93 = call %struct.utmp* (...) @getutent()
store %struct.utmp* %93, %struct.utmp** %19
%94 = icmp ne %struct.utmp* %93, null
br i1 %94, label %95, label %111
95: ; preds = %92
%96 = load %struct.utmp*, %struct.utmp** %19
%97 = getelementptr inbounds %struct.utmp, %struct.utmp* %96, i32 0, i32 0
%98 = load i64, i64* %97
%99 = load i64, i64* @USER_PROCESS
%100 = icmp eq i64 %98, %99
br i1 %100, label %101, label %110
101: ; preds = %95
%102 = load %struct.utmp*, %struct.utmp** %19
%103 = getelementptr inbounds %struct.utmp, %struct.utmp* %102, i32 0, i32 1
%104 = load i32, i32* %103
%105 = call i64 @strlen(i32 %104)
%106 = icmp ne i64 %105, 0
br i1 %106, label %107, label %110
107: ; preds = %101
%108 = load i32, i32* %13
%109 = add nsw i32 %108, 1
store i32 %109, i32* %13
br label %110
110: ; preds = %107, %101, %95
br label %92
111: ; preds = %92
%112 = call i32 (...) @endutent()
%113 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%114 = load i32, i32* %9
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds i8, i8* %113, i64 %115
%117 = load i32, i32* %13
%118 = sitofp i32 %117 to double
%119 = load i32, i32* %13
%120 = icmp ne i32 %119, 1
%121 = zext i1 %120 to i64
%122 = select i1 %120, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0)
%123 = call i32 (i8*, i8*, double, ...) @sprintf(i8* %116, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), double %118, i8* %122)
%124 = load i32, i32* %9
%125 = add nsw i32 %124, %123
store i32 %125, i32* %9
%126 = call i32 @loadavg(double* %16, double* %17, double* %18)
%127 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%128 = load i32, i32* %9
%129 = sext i32 %128 to i64
%130 = getelementptr inbounds i8, i8* %127, i64 %129
%131 = load double, double* %16
%132 = load double, double* %17
%133 = load double, double* %18
%134 = call i32 (i8*, i8*, double, ...) @sprintf(i8* %130, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.8, i64 0, i64 0), double %131, double %132, double %133)
%135 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%136 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* %135)
%137 = load i32, i32* @EXIT_SUCCESS
%138 = call i32 @exit(i32 %137)
unreachable
}

LLVM IR (-O2):
%struct.tm = type { double, double, double }
%struct.utmp = type { i64, i32 }
@.str = [17 x i8] c" %02d:%02d:%02d \00"
@.str.1 = [4 x i8] c"up \00"
@.str.2 = [11 x i8] c"%d day%s, \00"
@.str.3 = [2 x i8] c"s\00"
@.str.4 = [1 x i8] zeroinitializer
@.str.5 = [10 x i8] c"%2d:%2d, \00"
@.str.6 = [9 x i8] c"%d min, \00"
@USER_PROCESS = global i64 0
@.str.7 = [14 x i8] c"%2d user%s, \00"
@.str.8 = [34 x i8] c"load average: %0.2f, %0.2f, %0.2f\00"
@.str.9 = [4 x i8] c"%s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca [128 x i8]
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = bitcast i32* %3 to i8*
%11 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%12 = bitcast double* %5 to i8*
%13 = bitcast double* %6 to i8*
%14 = bitcast double* %7 to i8*
%15 = bitcast double* %8 to i8*
%16 = bitcast double* %9 to i8*
%17 = call i32 @time(i32* %3)
%18 = call %struct.tm* @localtime(i32* %3)
%19 = getelementptr inbounds %struct.tm, %struct.tm* %18, i64 0, i32 0
%20 = load double, double* %19
%21 = getelementptr inbounds %struct.tm, %struct.tm* %18, i64 0, i32 1
%22 = load double, double* %21
%23 = getelementptr inbounds %struct.tm, %struct.tm* %18, i64 0, i32 2
%24 = load double, double* %23
%25 = call i32 (i8*, i8*, double, ...) @sprintf(i8* %11, i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), double %20, double %22, double %24)
%26 = call i32 @strcat(i8* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%27 = add nsw i32 %25, 3
%28 = call i32 @uptime(double* %5, double* %6)
%29 = load double, double* %5
%30 = fptosi double %29 to i32
%31 = add i32 %30, 86399
%32 = icmp ult i32 %31, 172799
br i1 %32, label %45, label %33
33: ; preds = %2
%34 = sdiv i32 %30, 86400
%35 = sext i32 %27 to i64
%36 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 %35
%37 = sitofp i32 %34 to double
%38 = add i32 %30, -86400
%39 = icmp ult i32 %38, 86400
%40 = select i1 %39, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0)
%41 = call i32 (i8*, i8*, double, ...) @sprintf(i8* %36, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), double %37, i8* %40)
%42 = add nsw i32 %41, %27
%43 = load double, double* %5
%44 = fptosi double %43 to i32
br label %45
45: ; preds = %33, %2
%46 = phi i32 [ %44, %33 ], [ %30, %2 ]
%47 = phi i32 [ %42, %33 ], [ %27, %2 ]
%48 = sdiv i32 %46, 60
%49 = sdiv i32 %46, 3600
%50 = srem i32 %49, 24
%51 = srem i32 %48, 60
%52 = icmp eq i32 %50, 0
%53 = sext i32 %47 to i64
%54 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 %53
br i1 %52, label %58, label %55
55: ; preds = %45
%56 = sitofp i32 %50 to double
%57 = call i32 (i8*, i8*, double, ...) @sprintf(i8* %54, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), double %56, i32 %51)
br label %61
58: ; preds = %45
%59 = sitofp i32 %51 to double
%60 = call i32 (i8*, i8*, double, ...) @sprintf(i8* %54, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), double %59)
br label %61
61: ; preds = %58, %55
%62 = phi i32 [ %57, %55 ], [ %60, %58 ]
%63 = add nsw i32 %62, %47
%64 = call i32 (...) @setutent()
%65 = call %struct.utmp* (...) @getutent()
%66 = icmp eq %struct.utmp* %65, null
br i1 %66, label %85, label %67
67: ; preds = %61, %81
%68 = phi %struct.utmp* [ %83, %81 ], [ %65, %61 ]
%69 = phi i32 [ %82, %81 ], [ 0, %61 ]
%70 = getelementptr inbounds %struct.utmp, %struct.utmp* %68, i64 0, i32 0
%71 = load i64, i64* %70
%72 = load i64, i64* @USER_PROCESS
%73 = icmp eq i64 %71, %72
br i1 %73, label %74, label %81
74: ; preds = %67
%75 = getelementptr inbounds %struct.utmp, %struct.utmp* %68, i64 0, i32 1
%76 = load i32, i32* %75
%77 = call i64 @strlen(i32 %76)
%78 = icmp ne i64 %77, 0
%79 = zext i1 %78 to i32
%80 = add nsw i32 %69, %79
br label %81
81: ; preds = %74, %67
%82 = phi i32 [ %69, %67 ], [ %80, %74 ]
%83 = call %struct.utmp* (...) @getutent()
%84 = icmp eq %struct.utmp* %83, null
br i1 %84, label %85, label %67
85: ; preds = %81, %61
%86 = phi i32 [ 0, %61 ], [ %82, %81 ]
%87 = call i32 (...) @endutent()
%88 = sext i32 %63 to i64
%89 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 %88
%90 = sitofp i32 %86 to double
%91 = icmp eq i32 %86, 1
%92 = select i1 %91, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0)
%93 = call i32 (i8*, i8*, double, ...) @sprintf(i8* %89, i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), double %90, i8* %92)
%94 = add nsw i32 %93, %63
%95 = call i32 @loadavg(double* %7, double* %8, double* %9)
%96 = sext i32 %94 to i64
%97 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 %96
%98 = load double, double* %7
%99 = load double, double* %8
%100 = load double, double* %9
%101 = call i32 (i8*, i8*, double, ...) @sprintf(i8* %97, i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.8, i64 0, i64 0), double %98, double %99, double %100)
%102 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* %11)
%103 = load i32, i32* @EXIT_SUCCESS
%104 = call i32 @exit(i32 %103)
unreachable
}