#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);
void time_clock_from_frames(int frames, double fps, char *s) {
  int hours, mins;
  double secs;
  hours = frames / (fps * 3600);
  frames -= hours * (fps * 3600);
  mins = frames / (fps * 60);
  frames -= mins * (fps * 60);
  secs = (double)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  0xed7(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x1c(%rbp)
cvtsi2sdl -0x1c(%rbp),%xmm0
movsd  0xeba(%rip),%xmm2
mulsd  -0x10(%rbp),%xmm2
cvtsi2sdl -0x4(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x4(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xe75(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x20(%rbp)
cvtsi2sdl -0x20(%rbp),%xmm0
movsd  0xe58(%rip),%xmm2
mulsd  -0x10(%rbp),%xmm2
cvtsi2sdl -0x4(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
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    0xe13(%rip),%rsi
call   1030 <sprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<time_clock_from_frames>:
cvtsi2sd %edi,%xmm1
movsd  0xee4(%rip),%xmm2
mulsd  %xmm0,%xmm2
movapd %xmm1,%xmm3
divsd  %xmm2,%xmm3
cvttsd2si %xmm3,%edx
cvttpd2dq %xmm3,%xmm3
cvtdq2pd %xmm3,%xmm3
mulsd  %xmm2,%xmm3
subsd  %xmm3,%xmm1
cvttpd2dq %xmm1,%xmm1
mov    %rsi,%rdi
cvtdq2pd %xmm1,%xmm1
movsd  0xeb9(%rip),%xmm2
mulsd  %xmm0,%xmm2
movapd %xmm1,%xmm3
divsd  %xmm2,%xmm3
cvttsd2si %xmm3,%ecx
cvttpd2dq %xmm3,%xmm3
cvtdq2pd %xmm3,%xmm3
mulsd  %xmm2,%xmm3
subsd  %xmm3,%xmm1
cvttpd2dq %xmm1,%xmm1
cvtdq2pd %xmm1,%xmm1
divsd  %xmm0,%xmm1
lea    0xe8e(%rip),%rsi
movapd %xmm1,%xmm0
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 = sitofp i32 %16 to double
%18 = load double, double* %5
%19 = fmul double %18, 3.600000e+03
%20 = load i32, i32* %4
%21 = sitofp i32 %20 to double
%22 = fneg double %17
%23 = call double @llvm.fmuladd.f64(double %22, double %19, double %21)
%24 = fptosi double %23 to i32
store i32 %24, i32* %4
%25 = load i32, i32* %4
%26 = sitofp i32 %25 to double
%27 = load double, double* %5
%28 = fmul double %27, 6.000000e+01
%29 = fdiv double %26, %28
%30 = fptosi double %29 to i32
store i32 %30, i32* %8
%31 = load i32, i32* %8
%32 = sitofp i32 %31 to double
%33 = load double, double* %5
%34 = fmul double %33, 6.000000e+01
%35 = load i32, i32* %4
%36 = sitofp i32 %35 to double
%37 = fneg double %32
%38 = call double @llvm.fmuladd.f64(double %37, double %34, double %36)
%39 = fptosi double %38 to i32
store i32 %39, i32* %4
%40 = load i32, i32* %4
%41 = sitofp i32 %40 to double
%42 = load double, double* %5
%43 = fdiv double %41, %42
store double %43, double* %9
%44 = load i8*, i8** %6
%45 = load i32, i32* %7
%46 = load i32, i32* %8
%47 = load double, double* %9
%48 = call i32 @sprintf(i8* %44, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %45, i32 %46, double %47)
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 = sitofp i32 %7 to double
%9 = fneg double %8
%10 = tail call double @llvm.fmuladd.f64(double %9, double %5, double %4)
%11 = fptosi double %10 to i32
%12 = sitofp i32 %11 to double
%13 = fmul double %1, 6.000000e+01
%14 = fdiv double %12, %13
%15 = fptosi double %14 to i32
%16 = sitofp i32 %15 to double
%17 = fneg double %16
%18 = tail call double @llvm.fmuladd.f64(double %17, double %13, double %12)
%19 = fptosi double %18 to i32
%20 = sitofp i32 %19 to double
%21 = fdiv double %20, %1
%22 = 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 %15, double %21)
ret void
}