#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 uptime;
};

/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sysinfo(struct sysinfo *);
int main() {
  struct sysinfo si;
  long uptime;
  int days, hours, minutes;
  sysinfo(&si);
  uptime = si.uptime;
  days = uptime / (24 * (60 * 60));
  uptime %= (24 * (60 * 60));
  hours = uptime / (60 * 60);
  uptime %= (60 * 60);
  minutes = uptime / 60;
  printf("uptime: ");
  if (days > 0)
    printf("%d day%s, ", days, days == 1 ? "" : "s");
  if (hours > 0)
    printf("%d hour%s, ", hours, hours == 1 ? "" : "s");
  printf("%d minute%s\n", minutes, minutes == 1 ? "" : "s");
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x10(%rbp),%rdi
call   1040 <sysinfo@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    $0x15180,%ecx
cqto
idiv   %rcx
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    $0x15180,%ecx
cqto
idiv   %rcx
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    $0xe10,%ecx
cqto
idiv   %rcx
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    $0xe10,%ecx
cqto
idiv   %rcx
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    $0x3c,%ecx
cqto
idiv   %rcx
mov    %eax,-0x24(%rbp)
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x1c(%rbp)
jle    11d8 <main+0xb8>
mov    -0x1c(%rbp),%esi
mov    -0x1c(%rbp),%ecx
lea    0xe58(%rip),%rdx
lea    0xe6b(%rip),%rax
cmp    $0x1,%ecx
cmove  %rax,%rdx
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x20(%rbp)
jle    120b <main+0xeb>
mov    -0x20(%rbp),%esi
mov    -0x20(%rbp),%ecx
lea    0xe25(%rip),%rdx
lea    0xe38(%rip),%rax
cmp    $0x1,%ecx
cmove  %rax,%rdx
lea    0xe12(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%esi
mov    -0x24(%rbp),%ecx
lea    0xdfc(%rip),%rdx
lea    0xe0f(%rip),%rax
cmp    $0x1,%ecx
cmove  %rax,%rdx
lea    0xdf5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2da5(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsp,%rdi
call   1040 <sysinfo@plt>
mov    (%rsp),%r14
movabs $0x1845c8a0ce512957,%rcx
c8 45 18
mov    %r14,%rax
imul   %rcx
mov    %rdx,%r15
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0xd,%r15
add    %rax,%r15
imul   $0x15180,%r15,%rax
sub    %rax,%r14
movslq %r14d,%r12
imul   $0xffffffff91a2b3c5,%r12,%rbx
shr    $0x20,%rbx
add    %r14d,%ebx
mov    %ebx,%eax
shr    $0x1f,%eax
sar    $0xb,%ebx
add    %eax,%ebx
imul   $0xe10,%ebx,%eax
sub    %eax,%r12d
lea    0xe76(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
test   %r15d,%r15d
jle    11bd <main+0x9d>
cmp    $0x1,%r15d
lea    0xe8d(%rip),%rax
lea    0xe6c(%rip),%rdx
cmove  %rax,%rdx
lea    0xe56(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmp    $0xe10,%r14d
jl     11f6 <main+0xd6>
add    $0xfffff1f0,%r14d
cmp    $0xe10,%r14d
lea    0xe53(%rip),%rax
lea    0xe32(%rip),%rdx
cmovb  %rax,%rdx
lea    0xe29(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
movswl %r12w,%eax
imul   $0xffff8889,%eax,%eax
shr    $0x10,%eax
add    %r12d,%eax
movzwl %ax,%eax
movswl %ax,%ecx
shr    $0xf,%eax
sar    $0x5,%ecx
add    %eax,%ecx
movswl %cx,%esi
lea    -0x3c(%r12),%eax
cmp    $0x3c,%ax
lea    0xe07(%rip),%rax
lea    0xde6(%rip),%rdx
cmovb  %rax,%rdx
lea    0xde9(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2d99(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.sysinfo = type { i64 }
@.str = [9 x i8] c"uptime: \00"
@.str.1 = [11 x i8] c"%d day%s, \00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [2 x i8] c"s\00"
@.str.4 = [12 x i8] c"%d hour%s, \00"
@.str.5 = [13 x i8] c"%d minute%s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.sysinfo
%3 = alloca i64
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 @sysinfo(%struct.sysinfo* %2)
%8 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %2, i32 0, i32 0
%9 = load i64, i64* %8
store i64 %9, i64* %3
%10 = load i64, i64* %3
%11 = sdiv i64 %10, 86400
%12 = trunc i64 %11 to i32
store i32 %12, i32* %4
%13 = load i64, i64* %3
%14 = srem i64 %13, 86400
store i64 %14, i64* %3
%15 = load i64, i64* %3
%16 = sdiv i64 %15, 3600
%17 = trunc i64 %16 to i32
store i32 %17, i32* %5
%18 = load i64, i64* %3
%19 = srem i64 %18, 3600
store i64 %19, i64* %3
%20 = load i64, i64* %3
%21 = sdiv i64 %20, 60
%22 = trunc i64 %21 to i32
store i32 %22, i32* %6
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%24 = load i32, i32* %4
%25 = icmp sgt i32 %24, 0
br i1 %25, label %26, label %33
26: ; preds = %0
%27 = load i32, i32* %4
%28 = load i32, i32* %4
%29 = icmp eq i32 %28, 1
%30 = zext i1 %29 to i64
%31 = select i1 %29, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0)
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %27, i8* %31)
br label %33
33: ; preds = %26, %0
%34 = load i32, i32* %5
%35 = icmp sgt i32 %34, 0
br i1 %35, label %36, label %43
36: ; preds = %33
%37 = load i32, i32* %5
%38 = load i32, i32* %5
%39 = icmp eq i32 %38, 1
%40 = zext i1 %39 to i64
%41 = select i1 %39, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0)
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %37, i8* %41)
br label %43
43: ; preds = %36, %33
%44 = load i32, i32* %6
%45 = load i32, i32* %6
%46 = icmp eq i32 %45, 1
%47 = zext i1 %46 to i64
%48 = select i1 %46, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0)
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i32 %44, i8* %48)
%50 = load i32, i32* @EXIT_SUCCESS
ret i32 %50
}

LLVM IR (-O2):
%struct.sysinfo = type { i64 }
@.str = [9 x i8] c"uptime: \00"
@.str.1 = [11 x i8] c"%d day%s, \00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [2 x i8] c"s\00"
@.str.4 = [12 x i8] c"%d hour%s, \00"
@.str.5 = [13 x i8] c"%d minute%s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%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 = trunc i64 %6 to i32
%8 = srem i64 %5, 86400
%9 = trunc i64 %8 to i32
%10 = sdiv i32 %9, 3600
%11 = srem i32 %9, 3600
%12 = trunc i32 %11 to i16
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%14 = icmp sgt i32 %7, 0
br i1 %14, label %15, label %19
15: ; preds = %0
%16 = icmp eq i32 %7, 1
%17 = select i1 %16, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %7, i8* %17)
br label %19
19: ; preds = %15, %0
%20 = icmp sgt i32 %9, 3599
br i1 %20, label %21, label %26
21: ; preds = %19
%22 = add nsw i32 %9, -3600
%23 = icmp ult i32 %22, 3600
%24 = select i1 %23, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0)
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %10, i8* %24)
br label %26
26: ; preds = %21, %19
%27 = sdiv i16 %12, 60
%28 = sext i16 %27 to i32
%29 = add nsw i16 %12, -60
%30 = icmp ult i16 %29, 60
%31 = select i1 %30, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0)
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i32 %28, i8* %31)
%33 = load i32, i32* @EXIT_SUCCESS
ret i32 %33
}