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

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_time_stat(u_int dl_time, u_int size) {
  u_int d, h, m, s, tmp;
  double speed;
  tmp = dl_time;
  d = tmp / (3600 * 24);
  tmp = tmp % (3600 * 24);
  h = tmp / 3600;
  tmp = tmp % 3600;
  m = tmp / 60;
  s = tmp % 60;
  printf("Download time : ");
  if (d > 0)
    printf("%u days, %u hours, %u minutes and %u seconds.\n", d, h, m, s);
  else if (h > 0)
    printf("%u hours, %u minutes and %u seconds.\n", h, m, s);
  else if (m > 0)
    printf("%u minutes and %u seconds.\n", m, s);
  else
    printf("%u seconds.\n", s);
  if (dl_time == 0) {
    printf("Download speed : infinite.\n");
    return;
  }
  speed = (double)size / (double)dl_time;
  if (speed >= 1000000000)
    printf("Download speed : %.3f giga bytes per second.\n",
           speed / 1000000000);
  else if (speed >= 1000000)
    printf("Download speed : %.3f mega bytes per second.\n", speed / 1000000);
  else if (speed >= 1000)
    printf("Download speed : %.3f kilo bytes per second.\n", speed / 1000);
  else
    printf("Download speed : %.3f bytes per second.\n", speed);
}


x86 assembly (clang, -O0):
<print_time_stat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    $0x15180,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0x1c(%rbp),%eax
mov    $0x15180,%ecx
cltd
idiv   %ecx
mov    %edx,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x1c(%rbp),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
mov    %edx,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x1c(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,-0x18(%rbp)
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0xc(%rbp)
jle    11b0 <print_time_stat+0xa0>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1214 <print_time_stat+0x104>
cmpl   $0x0,-0x10(%rbp)
jle    11d6 <print_time_stat+0xc6>
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
lea    0xe68(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    120f <print_time_stat+0xff>
cmpl   $0x0,-0x14(%rbp)
jle    11f9 <print_time_stat+0xe9>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    120a <print_time_stat+0xfa>
mov    -0x18(%rbp),%esi
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    120f <print_time_stat+0xff>
jmp    1214 <print_time_stat+0x104>
cmpl   $0x0,-0x4(%rbp)
jne    1231 <print_time_stat+0x121>
lea    0xe33(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1312 <print_time_stat+0x202>
cvtsi2sdl -0x8(%rbp),%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xdaf(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     127f <print_time_stat+0x16f>
movsd  -0x28(%rbp),%xmm0
movsd  0xd98(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe01(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1312 <print_time_stat+0x202>
movsd  -0x28(%rbp),%xmm0
movsd  0xd7c(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     12ba <print_time_stat+0x1aa>
movsd  -0x28(%rbp),%xmm0
movsd  0xd65(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xdf4(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    130d <print_time_stat+0x1fd>
movsd  -0x28(%rbp),%xmm0
movsd  0xd49(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     12f5 <print_time_stat+0x1e5>
movsd  -0x28(%rbp),%xmm0
movsd  0xd32(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xde7(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1308 <print_time_stat+0x1f8>
movsd  -0x28(%rbp),%xmm0
lea    0xdfd(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    130d <print_time_stat+0x1fd>
jmp    1312 <print_time_stat+0x202>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_time_stat>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,0x4(%rsp)
mov    %edi,%r15d
movslq %edi,%rbx
imul   $0xffffffffc22e4507,%rbx,%rax
shr    $0x20,%rax
add    %edi,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
sar    $0x10,%eax
add    %ecx,%eax
imul   $0x15180,%eax,%eax
mov    %ebx,%r12d
sub    %eax,%r12d
movslq %r12d,%r14
imul   $0xffffffff91a2b3c5,%r14,%rbp
shr    $0x20,%rbp
add    %r12d,%ebp
mov    %ebp,%eax
shr    $0x1f,%eax
sar    $0xb,%ebp
add    %eax,%ebp
imul   $0xe10,%ebp,%eax
sub    %eax,%r14d
movswl %r14w,%eax
imul   $0xffff8889,%eax,%eax
shr    $0x10,%eax
add    %r14d,%eax
movzwl %ax,%eax
movswl %ax,%ecx
shr    $0xf,%eax
sar    $0x5,%ecx
add    %eax,%ecx
movswl %cx,%eax
mov    %eax,(%rsp)
imul   $0x3c,%ecx,%eax
mov    %r14d,%ecx
sub    %eax,%ecx
movswl %cx,%r13d
lea    0xe65(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x15180,%ebx
jl     11ea <print_time_stat+0xca>
mov    %r15d,%eax
mov    $0xc22e4507,%esi
imul   %rax,%rsi
shr    $0x30,%rsi
lea    0xe50(%rip),%rdi
mov    %ebp,%edx
mov    (%rsp),%ecx
mov    %r13d,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1231 <print_time_stat+0x111>
mov    (%rsp),%edx
cmp    $0xe10,%r12d
jl     1213 <print_time_stat+0xf3>
lea    0xe35(%rip),%rdi
mov    %ebp,%esi
mov    %r13d,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
test   %r15d,%r15d
jne    1231 <print_time_stat+0x111>
jmp    129f <print_time_stat+0x17f>
cmp    $0x3c,%r14d
jl     1289 <print_time_stat+0x169>
lea    0xe1c(%rip),%rdi
mov    %edx,%esi
mov    %r13d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
test   %r15d,%r15d
je     129f <print_time_stat+0x17f>
cvtsi2sdl 0x4(%rsp),%xmm0
cvtsi2sd %r15d,%xmm1
divsd  %xmm1,%xmm0
ucomisd 0xdb8(%rip),%xmm0
jae    1267 <print_time_stat+0x147>
ucomisd 0xdb6(%rip),%xmm0
jae    1278 <print_time_stat+0x158>
ucomisd 0xdb4(%rip),%xmm0
jae    12b9 <print_time_stat+0x199>
lea    0xe7d(%rip),%rdi
jmp    12c8 <print_time_stat+0x1a8>
divsd  0xd91(%rip),%xmm0
lea    0xde2(%rip),%rdi
jmp    12c8 <print_time_stat+0x1a8>
divsd  0xd88(%rip),%xmm0
lea    0xdff(%rip),%rdi
jmp    12c8 <print_time_stat+0x1a8>
lea    0xdbb(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r15d,%r15d
jne    1231 <print_time_stat+0x111>
lea    0xe65(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <puts@plt>
divsd  0xd4f(%rip),%xmm0
lea    0xdec(%rip),%rdi
mov    $0x1,%al
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"Download time : \00"
@.str.1 = [47 x i8] c"%u days, %u hours, %u minutes and %u seconds.\0A\00"
@.str.2 = [38 x i8] c"%u hours, %u minutes and %u seconds.\0A\00"
@.str.3 = [28 x i8] c"%u minutes and %u seconds.\0A\00"
@.str.4 = [13 x i8] c"%u seconds.\0A\00"
@.str.5 = [28 x i8] c"Download speed : infinite.\0A\00"
@.str.6 = [46 x i8] c"Download speed : %.3f giga bytes per second.\0A\00"
@.str.7 = [46 x i8] c"Download speed : %.3f mega bytes per second.\0A\00"
@.str.8 = [46 x i8] c"Download speed : %.3f kilo bytes per second.\0A\00"
@.str.9 = [41 x i8] c"Download speed : %.3f bytes per second.\0A\00"
define void @print_time_stat(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca double
store i32 %0, i32* %3
store i32 %1, i32* %4
%11 = load i32, i32* %3
store i32 %11, i32* %9
%12 = load i32, i32* %9
%13 = sdiv i32 %12, 86400
store i32 %13, i32* %5
%14 = load i32, i32* %9
%15 = srem i32 %14, 86400
store i32 %15, i32* %9
%16 = load i32, i32* %9
%17 = sdiv i32 %16, 3600
store i32 %17, i32* %6
%18 = load i32, i32* %9
%19 = srem i32 %18, 3600
store i32 %19, i32* %9
%20 = load i32, i32* %9
%21 = sdiv i32 %20, 60
store i32 %21, i32* %7
%22 = load i32, i32* %9
%23 = srem i32 %22, 60
store i32 %23, i32* %8
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%25 = load i32, i32* %5
%26 = icmp sgt i32 %25, 0
br i1 %26, label %27, label %33
27: ; preds = %2
%28 = load i32, i32* %5
%29 = load i32, i32* %6
%30 = load i32, i32* %7
%31 = load i32, i32* %8
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i32 %28, i32 %29, i32 %30, i32 %31)
br label %53
33: ; preds = %2
%34 = load i32, i32* %6
%35 = icmp sgt i32 %34, 0
br i1 %35, label %36, label %41
36: ; preds = %33
%37 = load i32, i32* %6
%38 = load i32, i32* %7
%39 = load i32, i32* %8
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i32 %37, i32 %38, i32 %39)
br label %52
41: ; preds = %33
%42 = load i32, i32* %7
%43 = icmp sgt i32 %42, 0
br i1 %43, label %44, label %48
44: ; preds = %41
%45 = load i32, i32* %7
%46 = load i32, i32* %8
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 %45, i32 %46)
br label %51
48: ; preds = %41
%49 = load i32, i32* %8
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %49)
br label %51
51: ; preds = %48, %44
br label %52
52: ; preds = %51, %36
br label %53
53: ; preds = %52, %27
%54 = load i32, i32* %3
%55 = icmp eq i32 %54, 0
br i1 %55, label %56, label %58
56: ; preds = %53
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0))
br label %89
58: ; preds = %53
%59 = load i32, i32* %4
%60 = sitofp i32 %59 to double
%61 = load i32, i32* %3
%62 = sitofp i32 %61 to double
%63 = fdiv double %60, %62
store double %63, double* %10
%64 = load double, double* %10
%65 = fcmp oge double %64, 1.000000e+09
br i1 %65, label %66, label %70
66: ; preds = %58
%67 = load double, double* %10
%68 = fdiv double %67, 1.000000e+09
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0), double %68)
br label %89
70: ; preds = %58
%71 = load double, double* %10
%72 = fcmp oge double %71, 1.000000e+06
br i1 %72, label %73, label %77
73: ; preds = %70
%74 = load double, double* %10
%75 = fdiv double %74, 1.000000e+06
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.7, i64 0, i64 0), double %75)
br label %88
77: ; preds = %70
%78 = load double, double* %10
%79 = fcmp oge double %78, 1.000000e+03
br i1 %79, label %80, label %84
80: ; preds = %77
%81 = load double, double* %10
%82 = fdiv double %81, 1.000000e+03
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.8, i64 0, i64 0), double %82)
br label %87
84: ; preds = %77
%85 = load double, double* %10
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.9, i64 0, i64 0), double %85)
br label %87
87: ; preds = %84, %80
br label %88
88: ; preds = %87, %73
br label %89
89: ; preds = %56, %88, %66
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"Download time : \00"
@.str.1 = [47 x i8] c"%u days, %u hours, %u minutes and %u seconds.\0A\00"
@.str.2 = [38 x i8] c"%u hours, %u minutes and %u seconds.\0A\00"
@.str.3 = [28 x i8] c"%u minutes and %u seconds.\0A\00"
@.str.4 = [13 x i8] c"%u seconds.\0A\00"
@.str.6 = [46 x i8] c"Download speed : %.3f giga bytes per second.\0A\00"
@.str.7 = [46 x i8] c"Download speed : %.3f mega bytes per second.\0A\00"
@.str.8 = [46 x i8] c"Download speed : %.3f kilo bytes per second.\0A\00"
@.str.9 = [41 x i8] c"Download speed : %.3f bytes per second.\0A\00"
@str = [27 x i8] c"Download speed : infinite.\00"
define void @print_time_stat(i32 %0, i32 %1) {
%3 = srem i32 %0, 86400
%4 = sdiv i32 %3, 3600
%5 = srem i32 %3, 3600
%6 = trunc i32 %5 to i16
%7 = sdiv i16 %6, 60
%8 = sext i16 %7 to i32
%9 = srem i16 %6, 60
%10 = sext i16 %9 to i32
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%12 = icmp sgt i32 %0, 86399
br i1 %12, label %13, label %16
13: ; preds = %2
%14 = udiv i32 %0, 86400
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i32 %14, i32 %4, i32 %8, i32 %10)
br label %30
16: ; preds = %2
%17 = icmp sgt i32 %3, 3599
br i1 %17, label %18, label %20
18: ; preds = %16
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i32 %4, i32 %8, i32 %10)
br label %26
20: ; preds = %16
%21 = icmp sgt i32 %5, 59
br i1 %21, label %22, label %24
22: ; preds = %20
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 %8, i32 %10)
br label %26
24: ; preds = %20
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %10)
br label %26
26: ; preds = %18, %24, %22
%27 = icmp eq i32 %0, 0
br i1 %27, label %28, label %30
28: ; preds = %26
%29 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
br label %50
30: ; preds = %13, %26
%31 = sitofp i32 %1 to double
%32 = sitofp i32 %0 to double
%33 = fdiv double %31, %32
%34 = fcmp ult double %33, 1.000000e+09
br i1 %34, label %38, label %35
35: ; preds = %30
%36 = fdiv double %33, 1.000000e+09
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0), double %36)
br label %50
38: ; preds = %30
%39 = fcmp ult double %33, 1.000000e+06
br i1 %39, label %43, label %40
40: ; preds = %38
%41 = fdiv double %33, 1.000000e+06
%42 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.7, i64 0, i64 0), double %41)
br label %50
43: ; preds = %38
%44 = fcmp ult double %33, 1.000000e+03
br i1 %44, label %48, label %45
45: ; preds = %43
%46 = fdiv double %33, 1.000000e+03
%47 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.8, i64 0, i64 0), double %46)
br label %50
48: ; preds = %43
%49 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.9, i64 0, i64 0), double %33)
br label %50
50: ; preds = %35, %45, %48, %40, %28
ret void
}