#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 */
struct sysinfo {
  long const uptime;
  double const totalram;
  double const freeram;
  double const procs;
};

/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, double const, ...);
int /*<<< orphan*/ sysinfo(struct sysinfo *);
int /*<<< orphan*/ system(char *);
int information(void) {
  const long minute = 60;
  const long hour = minute * 60;
  const long day = hour * 24;
  const double megabyte = 1024 * 1024;
  struct sysinfo si;
  sysinfo(&si);
  printf("System uptime : %ld days, %ld:%02ld:%02ld\n", si.uptime / day,
         (si.uptime % day) / hour, (si.uptime % hour) / minute,
         si.uptime % minute);
  printf("Total RAM   : %5.1f MB\n", si.totalram / megabyte);
  printf("Free RAM   : %5.1f MB\n", si.freeram / megabyte);
  printf("Number of running processes : %d\n", si.procs);
  system("echo \"The computer has $(cat /proc/cpuinfo | grep CPU | wc -l) "
         "core(s).\"");
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<information>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movq   $0x3c,-0x8(%rbp)
movq   $0xe10,-0x10(%rbp)
movq   $0x15180,-0x18(%rbp)
movsd  0xea8(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
lea    -0x40(%rbp),%rdi
call   1050 <sysinfo@plt>
mov    -0x40(%rbp),%rax
mov    $0x15180,%ecx
cqto
idiv   %rcx
cvtsi2sd %rax,%xmm0
mov    -0x40(%rbp),%rax
mov    $0x15180,%ecx
cqto
idiv   %rcx
mov    %rdx,%rax
mov    $0xe10,%ecx
cqto
idiv   %rcx
mov    %rax,%rsi
mov    -0x40(%rbp),%rax
mov    $0xe10,%ecx
cqto
idiv   %rcx
mov    %rdx,%rax
mov    $0x3c,%ecx
cqto
idiv   %rcx
mov    %rax,-0x48(%rbp)
mov    -0x40(%rbp),%rax
mov    $0x3c,%ecx
cqto
idiv   %rcx
mov    %rdx,%rcx
mov    -0x48(%rbp),%rdx
lea    0xe36(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  -0x38(%rbp),%xmm0
movsd  0xe1a(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe42(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  -0x30(%rbp),%xmm0
movsd  0xdfb(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe3b(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  -0x28(%rbp),%xmm0
lea    0xe3f(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe53(%rip),%rdi
call   1030 <system@plt>
mov    0x2da3(%rip),%rax
mov    (%rax),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<information>:
sub    $0x28,%rsp
lea    0x8(%rsp),%rdi
call   1050 <sysinfo@plt>
mov    0x8(%rsp),%rcx
movabs $0x1845c8a0ce512957,%rdx
c8 45 18
mov    %rcx,%rax
imul   %rdx
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0xd,%rdx
add    %rax,%rdx
cvtsi2sd %rdx,%xmm0
imul   $0x15180,%rdx,%rax
mov    %rcx,%rdx
sub    %rax,%rdx
movslq %edx,%rax
imul   $0xffffffff91a2b3c5,%rax,%rdx
shr    $0x20,%rdx
add    %edx,%eax
mov    %eax,%edx
shr    $0x1f,%edx
sar    $0xb,%eax
add    %edx,%eax
movslq %eax,%rsi
movabs $0x48d159e26af37c05,%rdx
59 d1 48
mov    %rcx,%rax
imul   %rdx
mov    %rdx,%rax
shr    $0x3f,%rax
shr    $0xa,%rdx
add    %eax,%edx
imul   $0xe10,%edx,%eax
mov    %ecx,%edx
sub    %eax,%edx
movswl %dx,%eax
imul   $0xffff8889,%eax,%eax
shr    $0x10,%eax
add    %edx,%eax
movzwl %ax,%eax
movswl %ax,%edx
shr    $0xf,%eax
sar    $0x5,%edx
add    %eax,%edx
movswq %dx,%r8
movabs $0x8888888888888889,%rdx
88 88 88
mov    %rcx,%rax
imul   %rdx
add    %rcx,%rdx
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x5,%rdx
add    %rax,%rdx
imul   $0x3c,%rdx,%rax
sub    %rax,%rcx
lea    0xe02(%rip),%rdi
mov    %r8,%rdx
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x10(%rsp),%xmm0
mulsd  0xde2(%rip),%xmm0
lea    0xe0e(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0xdcc(%rip),%xmm0
mulsd  0x18(%rsp),%xmm0
lea    0xe0a(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x20(%rsp),%xmm0
lea    0xe0d(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe21(%rip),%rdi
call   1030 <system@plt>
mov    0x2d71(%rip),%rax
mov    (%rax),%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
%struct.sysinfo = type { i64, double, double, double }
@.str = [43 x i8] c"System uptime : %ld days, %ld:%02ld:%02ld\0A\00"
@.str.1 = [24 x i8] c"Total RAM : %5.1f MB\0A\00"
@.str.2 = [23 x i8] c"Free RAM : %5.1f MB\0A\00"
@.str.3 = [34 x i8] c"Number of running processes : %d\0A\00"
@.str.4 = [73 x i8] c"echo \22The computer has $(cat /proc/cpuinfo | grep CPU | wc -l) core(s).\22\00"
@EXIT_SUCCESS = global i32 0
define i32 @information() {
%1 = alloca i64
%2 = alloca i64
%3 = alloca i64
%4 = alloca double
%5 = alloca %struct.sysinfo
store i64 60, i64* %1
store i64 3600, i64* %2
store i64 86400, i64* %3
store double 0x4130000000000000, double* %4
%6 = call i32 @sysinfo(%struct.sysinfo* %5)
%7 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %5, i32 0, i32 0
%8 = load i64, i64* %7
%9 = sdiv i64 %8, 86400
%10 = sitofp i64 %9 to double
%11 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %5, i32 0, i32 0
%12 = load i64, i64* %11
%13 = srem i64 %12, 86400
%14 = sdiv i64 %13, 3600
%15 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %5, i32 0, i32 0
%16 = load i64, i64* %15
%17 = srem i64 %16, 3600
%18 = sdiv i64 %17, 60
%19 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %5, i32 0, i32 0
%20 = load i64, i64* %19
%21 = srem i64 %20, 60
%22 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), double %10, i64 %14, i64 %18, i64 %21)
%23 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %5, i32 0, i32 1
%24 = load double, double* %23
%25 = fdiv double %24, 0x4130000000000000
%26 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), double %25)
%27 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %5, i32 0, i32 2
%28 = load double, double* %27
%29 = fdiv double %28, 0x4130000000000000
%30 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), double %29)
%31 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %5, i32 0, i32 3
%32 = load double, double* %31
%33 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), double %32)
%34 = call i32 @system(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.4, i64 0, i64 0))
%35 = load i32, i32* @EXIT_SUCCESS
ret i32 %35
}

LLVM IR (-O2):
%struct.sysinfo = type { i64, double, double, double }
@.str = [43 x i8] c"System uptime : %ld days, %ld:%02ld:%02ld\0A\00"
@.str.1 = [24 x i8] c"Total RAM : %5.1f MB\0A\00"
@.str.2 = [23 x i8] c"Free RAM : %5.1f MB\0A\00"
@.str.3 = [34 x i8] c"Number of running processes : %d\0A\00"
@.str.4 = [73 x i8] c"echo \22The computer has $(cat /proc/cpuinfo | grep CPU | wc -l) core(s).\22\00"
@EXIT_SUCCESS = global i32 0
define i32 @information() {
%1 = alloca %struct.sysinfo
%2 = bitcast %struct.sysinfo* %1 to i8*
%3 = call i32 @sysinfo(%struct.sysinfo* %1)
%4 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %1, i64 0, i32 0
%5 = load i64, i64* %4
%6 = sdiv i64 %5, 86400
%7 = sitofp i64 %6 to double
%8 = srem i64 %5, 86400
%9 = trunc i64 %8 to i32
%10 = sdiv i32 %9, 3600
%11 = sext i32 %10 to i64
%12 = srem i64 %5, 3600
%13 = trunc i64 %12 to i16
%14 = sdiv i16 %13, 60
%15 = sext i16 %14 to i64
%16 = srem i64 %5, 60
%17 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), double %7, i64 %11, i64 %15, i64 %16)
%18 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %1, i64 0, i32 1
%19 = load double, double* %18
%20 = fmul double %19, 0x3EB0000000000000
%21 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), double %20)
%22 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %1, i64 0, i32 2
%23 = load double, double* %22
%24 = fmul double %23, 0x3EB0000000000000
%25 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), double %24)
%26 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %1, i64 0, i32 3
%27 = load double, double* %26
%28 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), double %27)
%29 = call i32 @system(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.4, i64 0, i64 0))
%30 = load i32, i32* @EXIT_SUCCESS
ret i32 %30
}