#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 */
scalar_t__ floor(int);
int /*<<< orphan*/ sprintf(char *, char *, int, int, double);
void time_clock_from_frames(int frames, double fps, char *s) {
  int hours, mins;
  double secs;
  hours = frames / (fps * 3600);
  frames -= floor(hours * 3600 * fps);
  mins = frames / (fps * 60);
  frames -= floor(mins * 60 * fps);
  secs = frames / fps;
  sprintf(s, "%02d:%02d:%06.3f", hours, mins, secs);
}


x86 assembly (clang, -O0):
<time_clock_from_frames>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xec7(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x1c(%rbp)
imul   $0xe10,-0x1c(%rbp),%eax
cvtsi2sd %eax,%xmm0
mulsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <floor@plt>
mov    %rax,%rcx
movslq -0x4(%rbp),%rax
sub    %rcx,%rax
mov    %eax,-0x4(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xe7c(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x20(%rbp)
imul   $0x3c,-0x20(%rbp),%eax
cvtsi2sd %eax,%xmm0
mulsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <floor@plt>
mov    %rax,%rcx
movslq -0x4(%rbp),%rax
sub    %rcx,%rax
mov    %eax,-0x4(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
movsd  -0x28(%rbp),%xmm0
lea    0xe34(%rip),%rsi
call   1030 <sprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<time_clock_from_frames>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
movsd  %xmm0,(%rsp)
mov    %edi,%ebx
cvtsi2sd %edi,%xmm2
movsd  0xec6(%rip),%xmm1
mulsd  %xmm0,%xmm1
divsd  %xmm1,%xmm2
cvttsd2si %xmm2,%r15d
imul   $0xe10,%r15d,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
mov    %rsi,%r14
mulsd  %xmm0,%xmm1
cvttsd2si %xmm1,%edi
call   1040 <floor@plt>
sub    %eax,%ebx
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
movsd  0xe92(%rip),%xmm1
movsd  (%rsp),%xmm2
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%ebp
imul   $0x3c,%ebp,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  %xmm2,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <floor@plt>
sub    %eax,%ebx
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
divsd  (%rsp),%xmm0
lea    0xe5d(%rip),%rsi
mov    %r14,%rdi
mov    %r15d,%edx
mov    %ebp,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <sprintf@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"%02d:%02d:%06.3f\00"
define void @time_clock_from_frames(i32 %0, double %1, i8* %2) {
%4 = alloca i32
%5 = alloca double
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca double
store i32 %0, i32* %4
store double %1, double* %5
store i8* %2, i8** %6
%10 = load i32, i32* %4
%11 = sitofp i32 %10 to double
%12 = load double, double* %5
%13 = fmul double %12, 3.600000e+03
%14 = fdiv double %11, %13
%15 = fptosi double %14 to i32
store i32 %15, i32* %7
%16 = load i32, i32* %7
%17 = mul nsw i32 %16, 3600
%18 = sitofp i32 %17 to double
%19 = load double, double* %5
%20 = fmul double %18, %19
%21 = fptosi double %20 to i32
%22 = call i64 @floor(i32 %21)
%23 = load i32, i32* %4
%24 = sext i32 %23 to i64
%25 = sub nsw i64 %24, %22
%26 = trunc i64 %25 to i32
store i32 %26, i32* %4
%27 = load i32, i32* %4
%28 = sitofp i32 %27 to double
%29 = load double, double* %5
%30 = fmul double %29, 6.000000e+01
%31 = fdiv double %28, %30
%32 = fptosi double %31 to i32
store i32 %32, i32* %8
%33 = load i32, i32* %8
%34 = mul nsw i32 %33, 60
%35 = sitofp i32 %34 to double
%36 = load double, double* %5
%37 = fmul double %35, %36
%38 = fptosi double %37 to i32
%39 = call i64 @floor(i32 %38)
%40 = load i32, i32* %4
%41 = sext i32 %40 to i64
%42 = sub nsw i64 %41, %39
%43 = trunc i64 %42 to i32
store i32 %43, i32* %4
%44 = load i32, i32* %4
%45 = sitofp i32 %44 to double
%46 = load double, double* %5
%47 = fdiv double %45, %46
store double %47, double* %9
%48 = load i8*, i8** %6
%49 = load i32, i32* %7
%50 = load i32, i32* %8
%51 = load double, double* %9
%52 = call i32 @sprintf(i8* %48, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %49, i32 %50, double %51)
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"%02d:%02d:%06.3f\00"
define void @time_clock_from_frames(i32 %0, double %1, i8* nocapture writeonly %2) {
%4 = sitofp i32 %0 to double
%5 = fmul double %1, 3.600000e+03
%6 = fdiv double %4, %5
%7 = fptosi double %6 to i32
%8 = mul nsw i32 %7, 3600
%9 = sitofp i32 %8 to double
%10 = fmul double %9, %1
%11 = fptosi double %10 to i32
%12 = tail call i64 @floor(i32 %11)
%13 = trunc i64 %12 to i32
%14 = sub i32 %0, %13
%15 = sitofp i32 %14 to double
%16 = fmul double %1, 6.000000e+01
%17 = fdiv double %15, %16
%18 = fptosi double %17 to i32
%19 = mul nsw i32 %18, 60
%20 = sitofp i32 %19 to double
%21 = fmul double %20, %1
%22 = fptosi double %21 to i32
%23 = tail call i64 @floor(i32 %22)
%24 = trunc i64 %23 to i32
%25 = sub i32 %14, %24
%26 = sitofp i32 %25 to double
%27 = fdiv double %26, %1
%28 = tail call i32 @sprintf(i8* dereferenceable(1) %2, i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %18, double %27)
ret void
}