#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 *, ...);
void print_time(double diff) {
  if (diff > 0) {
    printf("Time taken:");
    if (diff > 60) {
      if (diff > 3600) {
        if (diff > 86400) {
          printf(" %0.0lf Day", diff / 86400);
          if (diff / 86400 > 1)
            printf("s");
          diff = diff - (86400 * ((int)diff / 86400));
        }
        printf(" %0.0lf Hour", diff / 3600);
        if (diff / 3600 > 1)
          printf("s");
        diff = diff - (3600 * ((int)diff / 3600));
      }
      printf(" %0.0lf Minute", diff / 60);
      if (diff / 60 > 1)
        printf("s");
      diff = diff - (60 * ((int)diff / 60));
    }
    printf(" %0.0lf second", diff);
    if (diff > 1)
      printf("s");
    printf("\n\n");
  }
}


x86 assembly (clang, -O0):
<print_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1324 <print_time+0x214>
lea    0xeea(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x8(%rbp),%xmm0
movsd  0xeb6(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    12de <print_time+0x1ce>
movsd  -0x8(%rbp),%xmm0
movsd  0xea7(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    126c <print_time+0x15c>
movsd  -0x8(%rbp),%xmm0
movsd  0xe98(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11f7 <print_time+0xe7>
movsd  -0x8(%rbp),%xmm0
movsd  0xe81(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe92(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x8(%rbp),%xmm0
movsd  0xe62(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe5e(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11d2 <print_time+0xc2>
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x8(%rbp),%xmm0
cvttsd2si -0x8(%rbp),%eax
mov    $0x15180,%ecx
cltd
idiv   %ecx
imul   $0x15180,%eax,%eax
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xe04(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe2b(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x8(%rbp),%xmm0
movsd  0xde5(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xde9(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1247 <print_time+0x137>
lea    0xdf8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x8(%rbp),%xmm0
cvttsd2si -0x8(%rbp),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
imul   $0xe10,%eax,%eax
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xd87(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xdc3(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x8(%rbp),%xmm0
movsd  0xd68(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xd74(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    12bc <print_time+0x1ac>
lea    0xd83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x8(%rbp),%xmm0
cvttsd2si -0x8(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
imul   $0x3c,%eax,%eax
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
lea    0xd6c(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x8(%rbp),%xmm0
movsd  0xd1a(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1316 <print_time+0x206>
lea    0xd29(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd48(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_time>:
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    130f <print_time+0x1df>
sub    $0x18,%rsp
lea    0xed7(%rip),%rdi
xor    %eax,%eax
movsd  %xmm0,0x8(%rsp)
call   1050 <printf@plt>
movsd  0x8(%rsp),%xmm0
ucomisd 0xe9c(%rip),%xmm0
jbe    12d1 <print_time+0x1a1>
ucomisd 0xe96(%rip),%xmm0
jbe    1260 <print_time+0x130>
ucomisd 0xe90(%rip),%xmm0
jbe    11ec <print_time+0xbc>
divsd  0xe86(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
lea    0xe95(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x10(%rsp),%xmm0
ucomisd 0xe6c(%rip),%xmm0
jbe    11b8 <print_time+0x88>
mov    $0x73,%edi
call   1030 <putchar@plt>
movsd  0x8(%rsp),%xmm0
cvttsd2si %xmm0,%eax
cltq
imul   $0xffffffffc22e4507,%rax,%rcx
shr    $0x20,%rcx
add    %ecx,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
sar    $0x10,%eax
add    %ecx,%eax
imul   $0x15180,%eax,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
divsd  0xe0e(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
lea    0xe31(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x10(%rsp),%xmm0
ucomisd 0xdfc(%rip),%xmm0
jbe    1228 <print_time+0xf8>
mov    $0x73,%edi
call   1030 <putchar@plt>
movsd  0x8(%rsp),%xmm1
cvttsd2si %xmm1,%eax
cltq
imul   $0xffffffff91a2b3c5,%rax,%rcx
shr    $0x20,%rcx
add    %ecx,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
sar    $0xb,%eax
add    %ecx,%eax
imul   $0xe10,%eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
divsd  0xd92(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
lea    0xdca(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x10(%rsp),%xmm0
ucomisd 0xd88(%rip),%xmm0
jbe    129c <print_time+0x16c>
mov    $0x73,%edi
call   1030 <putchar@plt>
movsd  0x8(%rsp),%xmm1
cvttsd2si %xmm1,%eax
cltq
imul   $0xffffffff88888889,%rax,%rcx
shr    $0x20,%rcx
add    %ecx,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
sar    $0x5,%eax
add    %ecx,%eax
imul   $0x3c,%eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
lea    0xd76(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x8(%rsp),%xmm0
ucomisd 0xd25(%rip),%xmm0
jbe    12ff <print_time+0x1cf>
mov    $0x73,%edi
call   1030 <putchar@plt>
lea    0xd5d(%rip),%rdi
add    $0x18,%rsp
jmp    1040 <puts@plt>
ret

LLVM IR (-O0):
@.str = [12 x i8] c"Time taken:\00"
@.str.1 = [12 x i8] c" %0.0lf Day\00"
@.str.2 = [2 x i8] c"s\00"
@.str.3 = [13 x i8] c" %0.0lf Hour\00"
@.str.4 = [15 x i8] c" %0.0lf Minute\00"
@.str.5 = [15 x i8] c" %0.0lf second\00"
@.str.6 = [3 x i8] c"\0A\0A\00"
define void @print_time(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp ogt double %3, 0.000000e+00
br i1 %4, label %5, label %75
5: ; preds = %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%7 = load double, double* %2
%8 = fcmp ogt double %7, 6.000000e+01
br i1 %8, label %9, label %66
9: ; preds = %5
%10 = load double, double* %2
%11 = fcmp ogt double %10, 3.600000e+03
br i1 %11, label %12, label %49
12: ; preds = %9
%13 = load double, double* %2
%14 = fcmp ogt double %13, 8.640000e+04
br i1 %14, label %15, label %32
15: ; preds = %12
%16 = load double, double* %2
%17 = fdiv double %16, 8.640000e+04
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), double %17)
%19 = load double, double* %2
%20 = fdiv double %19, 8.640000e+04
%21 = fcmp ogt double %20, 1.000000e+00
br i1 %21, label %22, label %24
22: ; preds = %15
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %24
24: ; preds = %22, %15
%25 = load double, double* %2
%26 = load double, double* %2
%27 = fptosi double %26 to i32
%28 = sdiv i32 %27, 86400
%29 = mul nsw i32 86400, %28
%30 = sitofp i32 %29 to double
%31 = fsub double %25, %30
store double %31, double* %2
br label %32
32: ; preds = %24, %12
%33 = load double, double* %2
%34 = fdiv double %33, 3.600000e+03
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), double %34)
%36 = load double, double* %2
%37 = fdiv double %36, 3.600000e+03
%38 = fcmp ogt double %37, 1.000000e+00
br i1 %38, label %39, label %41
39: ; preds = %32
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %41
41: ; preds = %39, %32
%42 = load double, double* %2
%43 = load double, double* %2
%44 = fptosi double %43 to i32
%45 = sdiv i32 %44, 3600
%46 = mul nsw i32 3600, %45
%47 = sitofp i32 %46 to double
%48 = fsub double %42, %47
store double %48, double* %2
br label %49
49: ; preds = %41, %9
%50 = load double, double* %2
%51 = fdiv double %50, 6.000000e+01
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), double %51)
%53 = load double, double* %2
%54 = fdiv double %53, 6.000000e+01
%55 = fcmp ogt double %54, 1.000000e+00
br i1 %55, label %56, label %58
56: ; preds = %49
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %58
58: ; preds = %56, %49
%59 = load double, double* %2
%60 = load double, double* %2
%61 = fptosi double %60 to i32
%62 = sdiv i32 %61, 60
%63 = mul nsw i32 60, %62
%64 = sitofp i32 %63 to double
%65 = fsub double %59, %64
store double %65, double* %2
br label %66
66: ; preds = %58, %5
%67 = load double, double* %2
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), double %67)
%69 = load double, double* %2
%70 = fcmp ogt double %69, 1.000000e+00
br i1 %70, label %71, label %73
71: ; preds = %66
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %73
73: ; preds = %71, %66
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %75
75: ; preds = %73, %1
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"Time taken:\00"
@.str.1 = [12 x i8] c" %0.0lf Day\00"
@.str.3 = [13 x i8] c" %0.0lf Hour\00"
@.str.4 = [15 x i8] c" %0.0lf Minute\00"
@.str.5 = [15 x i8] c" %0.0lf second\00"
@str = [2 x i8] c"\0A\00"
define void @print_time(double %0) {
%2 = fcmp ogt double %0, 0.000000e+00
br i1 %2, label %3, label %56
3: ; preds = %1
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%5 = fcmp ogt double %0, 6.000000e+01
br i1 %5, label %6, label %48
6: ; preds = %3
%7 = fcmp ogt double %0, 3.600000e+03
br i1 %7, label %8, label %35
8: ; preds = %6
%9 = fcmp ogt double %0, 8.640000e+04
br i1 %9, label %10, label %22
10: ; preds = %8
%11 = fdiv double %0, 8.640000e+04
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), double %11)
%13 = fcmp ogt double %11, 1.000000e+00
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = tail call i32 @putchar(i32 115)
br label %16
16: ; preds = %14, %10
%17 = fptosi double %0 to i32
%18 = srem i32 %17, 86400
%19 = sub i32 %17, %18
%20 = sitofp i32 %19 to double
%21 = fsub double %0, %20
br label %22
22: ; preds = %16, %8
%23 = phi double [ %21, %16 ], [ %0, %8 ]
%24 = fdiv double %23, 3.600000e+03
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), double %24)
%26 = fcmp ogt double %24, 1.000000e+00
br i1 %26, label %27, label %29
27: ; preds = %22
%28 = tail call i32 @putchar(i32 115)
br label %29
29: ; preds = %27, %22
%30 = fptosi double %23 to i32
%31 = srem i32 %30, 3600
%32 = sub i32 %30, %31
%33 = sitofp i32 %32 to double
%34 = fsub double %23, %33
br label %35
35: ; preds = %29, %6
%36 = phi double [ %34, %29 ], [ %0, %6 ]
%37 = fdiv double %36, 6.000000e+01
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), double %37)
%39 = fcmp ogt double %37, 1.000000e+00
br i1 %39, label %40, label %42
40: ; preds = %35
%41 = tail call i32 @putchar(i32 115)
br label %42
42: ; preds = %40, %35
%43 = fptosi double %36 to i32
%44 = srem i32 %43, 60
%45 = sub i32 %43, %44
%46 = sitofp i32 %45 to double
%47 = fsub double %36, %46
br label %48
48: ; preds = %42, %3
%49 = phi double [ %47, %42 ], [ %0, %3 ]
%50 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), double %49)
%51 = fcmp ogt double %49, 1.000000e+00
br i1 %51, label %52, label %54
52: ; preds = %48
%53 = tail call i32 @putchar(i32 115)
br label %54
54: ; preds = %52, %48
%55 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
br label %56
56: ; preds = %54, %1
ret void
}