#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 */
double fmod(double, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, double, ...);
int /*<<< orphan*/ stdout;
void secstoHuman(double sec, int precision) {
  double s, m, h, d, y;
  double min, hour, day, year;
  m = h = d = y = 0;
  min = hour = day = year = 0;
  s = fmod(sec, 60);
  if (sec >= 60) {
    m = (sec - s) / 60;
    if (m >= 60) {
      min = m;
      m = fmod(min, 60);
      h = (min - m) / 60;
      if (h >= 24) {
        hour = h;
        h = fmod(hour, 24);
        d = (hour - h) / 24;
        if (d >= 365) {
          day = d;
          d = fmod(day, 365);
          y = (day - d) / 365;
        }
      }
    }
  }
  if (y > 0)
    fprintf(stdout, "%.0lf years ", y);
  if (d > 0)
    fprintf(stdout, "%.0lf days ", d);
  fprintf(stdout, "%02.0lf:%02.0lf:", h, m);
  if (precision == 1)
    fprintf(stdout, "%02lf", s);
  else
    fprintf(stdout, "%02.0lf", s);
}


x86 assembly (clang, -O0):
<secstoHuman>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    $0x3c,%edi
call   1030 <fmod@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xe6f(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     12b5 <secstoHuman+0x195>
movsd  -0x8(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  0xe53(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xe3d(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     12b0 <secstoHuman+0x190>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
mov    $0x3c,%edi
call   1030 <fmod@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x40(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  0xe03(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xdf5(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     12ab <secstoHuman+0x18b>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
mov    $0x18,%edi
call   1030 <fmod@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x48(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
movsd  0xdbb(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  0xdad(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     12a6 <secstoHuman+0x186>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
mov    $0x16d,%edi
call   1030 <fmod@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x50(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
movsd  0xd73(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    12ab <secstoHuman+0x18b>
jmp    12b0 <secstoHuman+0x190>
jmp    12b5 <secstoHuman+0x195>
movsd  -0x38(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    12e3 <secstoHuman+0x1c3>
mov    0x2d12(%rip),%rax
mov    (%rax),%edi
movsd  -0x38(%rbp),%xmm0
lea    0xd3c(%rip),%rsi
mov    $0x1,%al
call   1040 <fprintf@plt>
movsd  -0x30(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1311 <secstoHuman+0x1f1>
mov    0x2ce4(%rip),%rax
mov    (%rax),%edi
movsd  -0x30(%rbp),%xmm0
lea    0xd1b(%rip),%rsi
mov    $0x1,%al
call   1040 <fprintf@plt>
mov    0x2cc8(%rip),%rax
mov    (%rax),%edi
movsd  -0x28(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
lea    0xd06(%rip),%rsi
mov    $0x2,%al
call   1040 <fprintf@plt>
cmpl   $0x1,-0xc(%rbp)
jne    135d <secstoHuman+0x23d>
mov    0x2c9d(%rip),%rax
mov    (%rax),%edi
movsd  -0x18(%rbp),%xmm0
lea    0xcf1(%rip),%rsi
mov    $0x1,%al
call   1040 <fprintf@plt>
jmp    1379 <secstoHuman+0x259>
mov    0x2c7c(%rip),%rax
mov    (%rax),%edi
movsd  -0x18(%rbp),%xmm0
lea    0xcd6(%rip),%rsi
mov    $0x1,%al
call   1040 <fprintf@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<secstoHuman>:
push   %rbp
push   %rbx
sub    $0x28,%rsp
mov    %edi,%ebp
movsd  %xmm0,0x8(%rsp)
mov    $0x3c,%edi
call   1030 <fmod@plt>
movsd  0x8(%rsp),%xmm1
xorpd  %xmm2,%xmm2
ucomisd 0xeb6(%rip),%xmm1
movsd  %xmm0,0x20(%rsp)
jae    115b <secstoHuman+0x3b>
xorpd  %xmm1,%xmm1
jmp    1281 <secstoHuman+0x161>
subsd  %xmm0,%xmm1
movsd  0xe99(%rip),%xmm0
divsd  %xmm0,%xmm1
ucomisd %xmm0,%xmm1
jb     1281 <secstoHuman+0x161>
movapd %xmm1,%xmm0
mov    $0x3c,%edi
movsd  %xmm1,0x8(%rsp)
call   1030 <fmod@plt>
movsd  0x8(%rsp),%xmm2
movapd %xmm0,%xmm1
subsd  %xmm0,%xmm2
divsd  0xe61(%rip),%xmm2
ucomisd 0xe61(%rip),%xmm2
jb     1281 <secstoHuman+0x161>
movsd  %xmm1,0x18(%rsp)
movapd %xmm2,%xmm0
mov    $0x18,%edi
movsd  %xmm2,0x8(%rsp)
call   1030 <fmod@plt>
movsd  0x8(%rsp),%xmm3
subsd  %xmm0,%xmm3
divsd  0xe2f(%rip),%xmm3
ucomisd 0xe2f(%rip),%xmm3
movsd  %xmm0,0x10(%rsp)
jae    11ef <secstoHuman+0xcf>
movapd %xmm0,%xmm2
jmp    1250 <secstoHuman+0x130>
movapd %xmm3,%xmm0
mov    $0x16d,%edi
movsd  %xmm3,0x8(%rsp)
call   1030 <fmod@plt>
movsd  0x8(%rsp),%xmm1
movapd %xmm0,%xmm3
subsd  %xmm0,%xmm1
divsd  0xdf7(%rip),%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jbe    124a <secstoHuman+0x12a>
mov    0x2db6(%rip),%rax
mov    (%rax),%edi
lea    0xde5(%rip),%rsi
movapd %xmm1,%xmm0
mov    $0x1,%al
movsd  %xmm3,0x8(%rsp)
call   1040 <fprintf@plt>
movsd  0x8(%rsp),%xmm3
movsd  0x10(%rsp),%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm3
jbe    127b <secstoHuman+0x15b>
mov    0x2d7f(%rip),%rax
mov    (%rax),%edi
lea    0xdbb(%rip),%rsi
movapd %xmm3,%xmm0
mov    $0x1,%al
call   1040 <fprintf@plt>
movsd  0x10(%rsp),%xmm2
movsd  0x18(%rsp),%xmm1
mov    0x2d58(%rip),%rbx
mov    (%rbx),%edi
lea    0xda0(%rip),%rsi
movapd %xmm2,%xmm0
mov    $0x2,%al
call   1040 <fprintf@plt>
cmp    $0x1,%ebp
mov    (%rbx),%edi
lea    0xd9a(%rip),%rax
lea    0xd99(%rip),%rsi
cmove  %rax,%rsi
movsd  0x20(%rsp),%xmm0
mov    $0x1,%al
add    $0x28,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <fprintf@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [13 x i8] c"%.0lf years \00"
@.str.1 = [12 x i8] c"%.0lf days \00"
@.str.2 = [17 x i8] c"%02.0lf:%02.0lf:\00"
@.str.3 = [6 x i8] c"%02lf\00"
@.str.4 = [8 x i8] c"%02.0lf\00"
define void @secstoHuman(double %0, i32 %1) {
%3 = alloca double
%4 = alloca i32
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
store double %0, double* %3
store i32 %1, i32* %4
store double 0.000000e+00, double* %9
store double 0.000000e+00, double* %8
store double 0.000000e+00, double* %7
store double 0.000000e+00, double* %6
store double 0.000000e+00, double* %13
store double 0.000000e+00, double* %12
store double 0.000000e+00, double* %11
store double 0.000000e+00, double* %10
%14 = load double, double* %3
%15 = call double @fmod(double %14, i32 60)
store double %15, double* %5
%16 = load double, double* %3
%17 = fcmp oge double %16, 6.000000e+01
br i1 %17, label %18, label %56
18: ; preds = %2
%19 = load double, double* %3
%20 = load double, double* %5
%21 = fsub double %19, %20
%22 = fdiv double %21, 6.000000e+01
store double %22, double* %6
%23 = load double, double* %6
%24 = fcmp oge double %23, 6.000000e+01
br i1 %24, label %25, label %55
25: ; preds = %18
%26 = load double, double* %6
store double %26, double* %10
%27 = load double, double* %10
%28 = call double @fmod(double %27, i32 60)
store double %28, double* %6
%29 = load double, double* %10
%30 = load double, double* %6
%31 = fsub double %29, %30
%32 = fdiv double %31, 6.000000e+01
store double %32, double* %7
%33 = load double, double* %7
%34 = fcmp oge double %33, 2.400000e+01
br i1 %34, label %35, label %54
35: ; preds = %25
%36 = load double, double* %7
store double %36, double* %11
%37 = load double, double* %11
%38 = call double @fmod(double %37, i32 24)
store double %38, double* %7
%39 = load double, double* %11
%40 = load double, double* %7
%41 = fsub double %39, %40
%42 = fdiv double %41, 2.400000e+01
store double %42, double* %8
%43 = load double, double* %8
%44 = fcmp oge double %43, 3.650000e+02
br i1 %44, label %45, label %53
45: ; preds = %35
%46 = load double, double* %8
store double %46, double* %12
%47 = load double, double* %12
%48 = call double @fmod(double %47, i32 365)
store double %48, double* %8
%49 = load double, double* %12
%50 = load double, double* %8
%51 = fsub double %49, %50
%52 = fdiv double %51, 3.650000e+02
store double %52, double* %9
br label %53
53: ; preds = %45, %35
br label %54
54: ; preds = %53, %25
br label %55
55: ; preds = %54, %18
br label %56
56: ; preds = %55, %2
%57 = load double, double* %9
%58 = fcmp ogt double %57, 0.000000e+00
br i1 %58, label %59, label %63
59: ; preds = %56
%60 = load i32, i32* @stdout
%61 = load double, double* %9
%62 = call i32 (i32, i8*, double, ...) @fprintf(i32 %60, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), double %61)
br label %63
63: ; preds = %59, %56
%64 = load double, double* %8
%65 = fcmp ogt double %64, 0.000000e+00
br i1 %65, label %66, label %70
66: ; preds = %63
%67 = load i32, i32* @stdout
%68 = load double, double* %8
%69 = call i32 (i32, i8*, double, ...) @fprintf(i32 %67, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), double %68)
br label %70
70: ; preds = %66, %63
%71 = load i32, i32* @stdout
%72 = load double, double* %7
%73 = load double, double* %6
%74 = call i32 (i32, i8*, double, ...) @fprintf(i32 %71, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), double %72, double %73)
%75 = load i32, i32* %4
%76 = icmp eq i32 %75, 1
br i1 %76, label %77, label %81
77: ; preds = %70
%78 = load i32, i32* @stdout
%79 = load double, double* %5
%80 = call i32 (i32, i8*, double, ...) @fprintf(i32 %78, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), double %79)
br label %85
81: ; preds = %70
%82 = load i32, i32* @stdout
%83 = load double, double* %5
%84 = call i32 (i32, i8*, double, ...) @fprintf(i32 %82, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), double %83)
br label %85
85: ; preds = %81, %77
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [13 x i8] c"%.0lf years \00"
@.str.1 = [12 x i8] c"%.0lf days \00"
@.str.2 = [17 x i8] c"%02.0lf:%02.0lf:\00"
@.str.3 = [6 x i8] c"%02lf\00"
@.str.4 = [8 x i8] c"%02.0lf\00"
define void @secstoHuman(double %0, i32 %1) {
%3 = tail call double @fmod(double %0, i32 60)
%4 = fcmp ult double %0, 6.000000e+01
br i1 %4, label %33, label %5
5: ; preds = %2
%6 = fsub double %0, %3
%7 = fdiv double %6, 6.000000e+01
%8 = fcmp ult double %7, 6.000000e+01
br i1 %8, label %33, label %9
9: ; preds = %5
%10 = tail call double @fmod(double %7, i32 60)
%11 = fsub double %7, %10
%12 = fdiv double %11, 6.000000e+01
%13 = fcmp ult double %12, 2.400000e+01
br i1 %13, label %33, label %14
14: ; preds = %9
%15 = tail call double @fmod(double %12, i32 24)
%16 = fsub double %12, %15
%17 = fdiv double %16, 2.400000e+01
%18 = fcmp ult double %17, 3.650000e+02
br i1 %18, label %27, label %19
19: ; preds = %14
%20 = tail call double @fmod(double %17, i32 365)
%21 = fsub double %17, %20
%22 = fdiv double %21, 3.650000e+02
%23 = fcmp ogt double %22, 0.000000e+00
br i1 %23, label %24, label %27
24: ; preds = %19
%25 = load i32, i32* @stdout
%26 = tail call i32 (i32, i8*, double, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), double %22)
br label %27
27: ; preds = %14, %24, %19
%28 = phi double [ %20, %24 ], [ %20, %19 ], [ %17, %14 ]
%29 = fcmp ogt double %28, 0.000000e+00
br i1 %29, label %30, label %33
30: ; preds = %27
%31 = load i32, i32* @stdout
%32 = tail call i32 (i32, i8*, double, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), double %28)
br label %33
33: ; preds = %9, %5, %2, %30, %27
%34 = phi double [ %15, %30 ], [ %15, %27 ], [ %12, %9 ], [ 0.000000e+00, %5 ], [ 0.000000e+00, %2 ]
%35 = phi double [ %10, %30 ], [ %10, %27 ], [ %10, %9 ], [ %7, %5 ], [ 0.000000e+00, %2 ]
%36 = load i32, i32* @stdout
%37 = tail call i32 (i32, i8*, double, ...) @fprintf(i32 %36, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), double %34, double %35)
%38 = icmp eq i32 %1, 1
%39 = load i32, i32* @stdout
%40 = select i1 %38, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0)
%41 = tail call i32 (i32, i8*, double, ...) @fprintf(i32 %39, i8* %40, double %3)
ret void
}