#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 /*<<< orphan*/ sprintf(char *, char *, unsigned int);
void decode_time(char *buf, unsigned t) {
  if (t > 86400 * 2) {
    sprintf(buf, "%d days", t / 86400);
    return;
  }
  if (t > 3600 * 2) {
    sprintf(buf, "%d hours", t / 3600);
    return;
  }
  if (t > 60 * 2) {
    sprintf(buf, "%d minutes", t / 60);
    return;
  }
  sprintf(buf, "%d seconds", t);
}


x86 assembly (clang, -O0):
<decode_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x2a300,-0xc(%rbp)
jbe    114f <decode_time+0x3f>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%eax
mov    $0x15180,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,%edx
lea    0xebb(%rip),%rsi
call   1030 <sprintf@plt>
jmp    11bf <decode_time+0xaf>
cmpl   $0x1c20,-0xc(%rbp)
jbe    117f <decode_time+0x6f>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%eax
mov    $0xe10,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,%edx
lea    0xe93(%rip),%rsi
call   1030 <sprintf@plt>
jmp    11bf <decode_time+0xaf>
cmpl   $0x78,-0xc(%rbp)
jbe    11ac <decode_time+0x9c>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%eax
mov    $0x3c,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,%edx
lea    0xe6f(%rip),%rsi
call   1030 <sprintf@plt>
jmp    11bf <decode_time+0xaf>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xe62(%rip),%rsi
call   1030 <sprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_time>:
mov    %esi,%edx
cmp    $0x2a301,%esi
jb     1135 <decode_time+0x25>
mov    %edx,%eax
mov    $0xc22e4507,%edx
imul   %rax,%rdx
shr    $0x30,%rdx
lea    0xed0(%rip),%rsi
jmp    1030 <sprintf@plt>
cmp    $0x1c21,%edx
jb     1158 <decode_time+0x48>
mov    %edx,%eax
mov    $0x91a2b3c5,%edx
imul   %rax,%rdx
shr    $0x2b,%rdx
lea    0xeb5(%rip),%rsi
jmp    1030 <sprintf@plt>
cmp    $0x79,%edx
jb     1175 <decode_time+0x65>
movzwl %dx,%eax
imul   $0x8889,%eax,%edx
shr    $0x15,%edx
lea    0xea1(%rip),%rsi
jmp    1030 <sprintf@plt>
lea    0xea0(%rip),%rsi
jmp    1030 <sprintf@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"%d days\00"
@.str.1 = [9 x i8] c"%d hours\00"
@.str.2 = [11 x i8] c"%d minutes\00"
@.str.3 = [11 x i8] c"%d seconds\00"
define void @decode_time(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp ugt i32 %5, 172800
br i1 %6, label %7, label %12
7: ; preds = %2
%8 = load i8*, i8** %3
%9 = load i32, i32* %4
%10 = udiv i32 %9, 86400
%11 = call i32 @sprintf(i8* %8, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %10)
br label %32
12: ; preds = %2
%13 = load i32, i32* %4
%14 = icmp ugt i32 %13, 7200
br i1 %14, label %15, label %20
15: ; preds = %12
%16 = load i8*, i8** %3
%17 = load i32, i32* %4
%18 = udiv i32 %17, 3600
%19 = call i32 @sprintf(i8* %16, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %18)
br label %32
20: ; preds = %12
%21 = load i32, i32* %4
%22 = icmp ugt i32 %21, 120
br i1 %22, label %23, label %28
23: ; preds = %20
%24 = load i8*, i8** %3
%25 = load i32, i32* %4
%26 = udiv i32 %25, 60
%27 = call i32 @sprintf(i8* %24, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %26)
br label %32
28: ; preds = %20
%29 = load i8*, i8** %3
%30 = load i32, i32* %4
%31 = call i32 @sprintf(i8* %29, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %30)
br label %32
32: ; preds = %28, %23, %15, %7
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"%d days\00"
@.str.1 = [9 x i8] c"%d hours\00"
@.str.2 = [11 x i8] c"%d minutes\00"
@.str.3 = [11 x i8] c"%d seconds\00"
define void @decode_time(i8* nocapture writeonly %0, i32 %1) {
%3 = icmp ugt i32 %1, 172800
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = udiv i32 %1, 86400
%6 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %5)
br label %21
7: ; preds = %2
%8 = icmp ugt i32 %1, 7200
br i1 %8, label %9, label %12
9: ; preds = %7
%10 = udiv i32 %1, 3600
%11 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %10)
br label %21
12: ; preds = %7
%13 = icmp ugt i32 %1, 120
br i1 %13, label %14, label %19
14: ; preds = %12
%15 = trunc i32 %1 to i16
%16 = udiv i16 %15, 60
%17 = zext i16 %16 to i32
%18 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %17)
br label %21
19: ; preds = %12
%20 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %1)
br label %21
21: ; preds = %19, %14, %9, %4
ret void
}