#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 time_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int pr_idle(time_t idle) {
  if (idle >= 36 * 3600) {
    int days = idle / 86400;
    (void)printf(" %dday%s ", days, days > 1 ? "s" : " ");
    if (days >= 100)
      return (2);
    if (days >= 10)
      return (1);
  } else if (idle >= 3600)
    (void)printf(" %2d:%02d ", (int)(idle / 3600), (int)((idle % 3600) / 60));
  else if (idle / 60 == 0)
    (void)printf("     - ");
  else
    (void)printf("    %2d ", (int)(idle / 60));
  return (0);
}


x86 assembly (clang, -O0):
<pr_idle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x1fa40,-0x8(%rbp)
jl     1190 <pr_idle+0x80>
mov    -0x8(%rbp),%eax
mov    $0x15180,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
mov    -0xc(%rbp),%ecx
lea    0xeda(%rip),%rdx
lea    0xec0(%rip),%rax
cmp    $0x1,%ecx
cmovg  %rax,%rdx
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x64,-0xc(%rbp)
jl     1175 <pr_idle+0x65>
movl   $0x2,-0x4(%rbp)
jmp    1227 <pr_idle+0x117>
cmpl   $0xa,-0xc(%rbp)
jl     118b <pr_idle+0x7b>
movl   $0x1,-0x4(%rbp)
jmp    1227 <pr_idle+0x117>
jmp    1220 <pr_idle+0x110>
cmpl   $0xe10,-0x8(%rbp)
jl     11d4 <pr_idle+0xc4>
mov    -0x8(%rbp),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
mov    -0x8(%rbp),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
lea    0xe44(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    121b <pr_idle+0x10b>
mov    -0x8(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
cmp    $0x0,%eax
jne    11fb <pr_idle+0xeb>
lea    0xe28(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1216 <pr_idle+0x106>
mov    -0x8(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    0xe10(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    121b <pr_idle+0x10b>
jmp    1220 <pr_idle+0x110>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pr_idle>:
push   %rbx
mov    %edi,%ebx
cmp    $0x1fa40,%edi
jl     1168 <pr_idle+0x58>
mov    %ebx,%eax
mov    $0xc22e4507,%esi
imul   %rax,%rsi
shr    $0x30,%rsi
cmp    $0x2a300,%ebx
lea    0xed3(%rip),%rax
lea    0xedf(%rip),%rdx
cmovae %rax,%rdx
lea    0xeb7(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
cmp    $0x83d600,%ebx
mov    $0x1,%eax
sbb    $0xffffffff,%eax
cmp    $0xd2f00,%ebx
jb     11e0 <pr_idle+0xd0>
pop    %rbx
ret
cmp    $0xe10,%ebx
jl     11a0 <pr_idle+0x90>
mov    %ebx,%eax
mov    $0x91a2b3c5,%esi
imul   %rax,%rsi
shr    $0x2b,%rsi
imul   $0xe10,%esi,%eax
sub    %eax,%ebx
imul   $0x8889,%ebx,%edx
shr    $0x15,%edx
lea    0xe75(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11e0 <pr_idle+0xd0>
lea    0x3b(%rbx),%eax
cmp    $0x76,%eax
ja     11b8 <pr_idle+0xa8>
lea    0xe68(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11e0 <pr_idle+0xd0>
movslq %ebx,%rax
imul   $0xffffffff88888889,%rax,%rsi
shr    $0x20,%rsi
add    %ebx,%esi
mov    %esi,%eax
shr    $0x1f,%eax
sar    $0x5,%esi
add    %eax,%esi
lea    0xe46(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [10 x i8] c" %dday%s \00"
@.str.1 = [2 x i8] c"s\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [11 x i8] c" %2d:%02d \00"
@.str.4 = [8 x i8] c" - \00"
@.str.5 = [9 x i8] c" %2d \00"
define i32 @pr_idle(i32 %0) {
%2 = icmp sgt i32 %0, 129599
br i1 %2, label %3, label %11
3: ; preds = %1
%4 = udiv i32 %0, 86400
%5 = icmp ugt i32 %0, 172799
%6 = select i1 %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %4, i8* %6)
%8 = icmp ugt i32 %0, 8639999
%9 = icmp ult i32 %0, 864000
%10 = select i1 %8, i32 2, i32 1
br i1 %9, label %28, label %29
11: ; preds = %1
%12 = icmp sgt i32 %0, 3599
br i1 %12, label %13, label %20
13: ; preds = %11
%14 = udiv i32 %0, 3600
%15 = urem i32 %0, 3600
%16 = trunc i32 %15 to i16
%17 = udiv i16 %16, 60
%18 = zext i16 %17 to i32
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %14, i32 %18)
br label %28
20: ; preds = %11
%21 = add nsw i32 %0, 59
%22 = icmp ult i32 %21, 119
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
br label %28
25: ; preds = %20
%26 = sdiv i32 %0, 60
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32 %26)
br label %28
28: ; preds = %3, %13, %25, %23
br label %29
29: ; preds = %3, %28
%30 = phi i32 [ %10, %3 ], [ 0, %28 ]
ret i32 %30
}