#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*/ printf(char *, char *, long, long, long, long);
void print_time(char *label, long time) {
  const long minute = 60;
  const long hour = minute * 60;
  const long day = hour * 24;
  printf("%s: %ld days, %ld:%02ld:%02ld\n", label, time / day,
         (time % day) / hour, (time % hour) / minute, time % minute);
}


x86 assembly (clang, -O0):
<print_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x3c,-0x18(%rbp)
movq   $0xe10,-0x20(%rbp)
movq   $0x15180,-0x28(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rax
mov    $0x15180,%ecx
cqto
idiv   %rcx
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    $0x15180,%ecx
cqto
idiv   %rcx
mov    %rdx,%rax
mov    $0xe10,%ecx
cqto
idiv   %rcx
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    $0xe10,%edi
cqto
idiv   %rdi
mov    %rdx,%rax
mov    $0x3c,%edi
cqto
idiv   %rdi
mov    %rax,%r8
mov    -0x10(%rbp),%rax
mov    $0x3c,%edi
cqto
idiv   %rdi
mov    %rdx,%r9
mov    -0x30(%rbp),%rdx
lea    0xe5a(%rip),%rdi
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_time>:
mov    %rsi,%r9
mov    %rdi,%rsi
movabs $0x1845c8a0ce512957,%rcx
c8 45 18
mov    %r9,%rax
imul   %rcx
mov    %rdx,%r10
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0xd,%r10
add    %rax,%r10
imul   $0x15180,%r10,%rax
mov    %r9,%rcx
sub    %rax,%rcx
movslq %ecx,%rax
imul   $0xffffffff91a2b3c5,%rax,%rcx
shr    $0x20,%rcx
add    %ecx,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
sar    $0xb,%eax
add    %ecx,%eax
movslq %eax,%rcx
movabs $0x48d159e26af37c05,%rdx
59 d1 48
mov    %r9,%rax
imul   %rdx
mov    %rdx,%rax
shr    $0x3f,%rax
shr    $0xa,%rdx
add    %eax,%edx
imul   $0xe10,%edx,%eax
mov    %r9d,%edx
sub    %eax,%edx
movswl %dx,%eax
imul   $0xffff8889,%eax,%eax
shr    $0x10,%eax
add    %edx,%eax
movzwl %ax,%eax
movswl %ax,%edi
shr    $0xf,%eax
sar    $0x5,%edi
add    %eax,%edi
movabs $0x8888888888888889,%rdx
88 88 88
mov    %r9,%rax
imul   %rdx
movswq %di,%r8
add    %r9,%rdx
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x5,%rdx
add    %rax,%rdx
imul   $0x3c,%rdx,%rax
sub    %rax,%r9
lea    0xe28(%rip),%rdi
mov    %r10,%rdx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [31 x i8] c"%s: %ld days, %ld:%02ld:%02ld\0A\00"
define void @print_time(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
store i64 60, i64* %5
store i64 3600, i64* %6
store i64 86400, i64* %7
%8 = load i8*, i8** %3
%9 = load i64, i64* %4
%10 = sdiv i64 %9, 86400
%11 = load i64, i64* %4
%12 = srem i64 %11, 86400
%13 = sdiv i64 %12, 3600
%14 = load i64, i64* %4
%15 = srem i64 %14, 3600
%16 = sdiv i64 %15, 60
%17 = load i64, i64* %4
%18 = srem i64 %17, 60
%19 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %8, i64 %10, i64 %13, i64 %16, i64 %18)
ret void
}

LLVM IR (-O2):
@.str = [31 x i8] c"%s: %ld days, %ld:%02ld:%02ld\0A\00"
define void @print_time(i8* %0, i64 %1) {
%3 = sdiv i64 %1, 86400
%4 = srem i64 %1, 86400
%5 = trunc i64 %4 to i32
%6 = sdiv i32 %5, 3600
%7 = sext i32 %6 to i64
%8 = srem i64 %1, 3600
%9 = trunc i64 %8 to i16
%10 = sdiv i16 %9, 60
%11 = sext i16 %10 to i64
%12 = srem i64 %1, 60
%13 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %0, i64 %3, i64 %7, i64 %11, i64 %12)
ret void
}