#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 *, int, int, double);
char *time_asc(double t, char *lin) {
  int h, min;
  double sec;
  h = (int)(t / 3600.);
  min = (int)((t - (double)h * 3600.) / 60.);
  sec = t - (double)h * 3600. - (double)min * 60.;
  h %= 24;
  if (sec > 59.99)
    sec = 59.99;
  sprintf(lin, "%02d:%02d:%05.2f", h, min, sec);
  return lin;
}


x86 assembly (clang, -O0):
<time_asc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xee2(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x14(%rbp)
movsd  -0x8(%rbp),%xmm1
cvtsi2sdl -0x14(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xeae(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe96(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
cvtsi2sdl -0x14(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xe6a(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
cvtsi2sdl -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xe36(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x18,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xe06(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1211 <time_asc+0x101>
movsd  0xdf4(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
movsd  -0x20(%rbp),%xmm0
lea    0xdf1(%rip),%rsi
call   1030 <sprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<time_asc>:
push   %rbx
mov    %rdi,%rbx
movsd  0xee4(%rip),%xmm1
movapd %xmm0,%xmm2
divsd  %xmm1,%xmm2
cvttsd2si %xmm2,%eax
cvttpd2dq %xmm2,%xmm2
cvtdq2pd %xmm2,%xmm2
mulsd  %xmm1,%xmm2
subsd  %xmm2,%xmm0
movsd  0xec8(%rip),%xmm1
movapd %xmm0,%xmm2
divsd  %xmm1,%xmm2
cvttsd2si %xmm2,%ecx
cvttpd2dq %xmm2,%xmm2
cvtdq2pd %xmm2,%xmm2
mulsd  %xmm1,%xmm2
subsd  %xmm2,%xmm0
movsd  0xeac(%rip),%xmm1
minsd  %xmm0,%xmm1
movslq %eax,%rdx
imul   $0x2aaaaaab,%rdx,%rax
mov    %rax,%rsi
shr    $0x3f,%rsi
shr    $0x22,%rax
add    %esi,%eax
shl    $0x3,%eax
lea    (%rax,%rax,2),%eax
sub    %eax,%edx
lea    0xe8a(%rip),%rsi
movapd %xmm1,%xmm0
call   1030 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"%02d:%02d:%05.2f\00"
define i8* @time_asc(double %0, i8* %1) {
%3 = alloca double
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
store double %0, double* %3
store i8* %1, i8** %4
%8 = load double, double* %3
%9 = fdiv double %8, 3.600000e+03
%10 = fptosi double %9 to i32
store i32 %10, i32* %5
%11 = load double, double* %3
%12 = load i32, i32* %5
%13 = sitofp i32 %12 to double
%14 = fneg double %13
%15 = call double @llvm.fmuladd.f64(double %14, double 3.600000e+03, double %11)
%16 = fdiv double %15, 6.000000e+01
%17 = fptosi double %16 to i32
store i32 %17, i32* %6
%18 = load double, double* %3
%19 = load i32, i32* %5
%20 = sitofp i32 %19 to double
%21 = fneg double %20
%22 = call double @llvm.fmuladd.f64(double %21, double 3.600000e+03, double %18)
%23 = load i32, i32* %6
%24 = sitofp i32 %23 to double
%25 = fneg double %24
%26 = call double @llvm.fmuladd.f64(double %25, double 6.000000e+01, double %22)
store double %26, double* %7
%27 = load i32, i32* %5
%28 = srem i32 %27, 24
store i32 %28, i32* %5
%29 = load double, double* %7
%30 = fcmp ogt double %29, 5.999000e+01
br i1 %30, label %31, label %32
31: ; preds = %2
store double 5.999000e+01, double* %7
br label %32
32: ; preds = %31, %2
%33 = load i8*, i8** %4
%34 = load i32, i32* %5
%35 = load i32, i32* %6
%36 = load double, double* %7
%37 = call i32 @sprintf(i8* %33, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %34, i32 %35, double %36)
%38 = load i8*, i8** %4
ret i8* %38
}

LLVM IR (-O2):
@.str = [17 x i8] c"%02d:%02d:%05.2f\00"
define i8* @time_asc(double %0, i8* returned writeonly %1) {
%3 = fdiv double %0, 3.600000e+03
%4 = fptosi double %3 to i32
%5 = sitofp i32 %4 to double
%6 = fneg double %5
%7 = tail call double @llvm.fmuladd.f64(double %6, double 3.600000e+03, double %0)
%8 = fdiv double %7, 6.000000e+01
%9 = fptosi double %8 to i32
%10 = sitofp i32 %9 to double
%11 = fneg double %10
%12 = tail call double @llvm.fmuladd.f64(double %11, double 6.000000e+01, double %7)
%13 = fcmp ogt double %12, 5.999000e+01
%14 = select i1 %13, double 5.999000e+01, double %12
%15 = srem i32 %4, 24
%16 = tail call i32 @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %15, i32 %9, double %14)
ret i8* %1
}