#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 *show_time(int samplerate, int samples) {
  static char time_buff[15];
  int hours, minutes;
  double seconds;
  seconds = (double)samples / samplerate;
  minutes = (int)seconds / 60;
  seconds -= minutes * 60;
  hours = minutes / 60;
  minutes -= hours * 60;
  sprintf(time_buff, "%02d:%02d:%06.3f", hours, minutes, seconds);
  return time_buff;
}


x86 assembly (clang, -O0):
<show_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
cvttsd2si -0x18(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
imul   $0x3c,-0x10(%rbp),%eax
cvtsi2sd %eax,%xmm1
movsd  -0x18(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
imul   $0x3c,-0xc(%rbp),%ecx
mov    -0x10(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
movsd  -0x18(%rbp),%xmm0
lea    0x2ea6(%rip),%rdi
lea    0xe76(%rip),%rsi
call   1030 <sprintf@plt>
lea    0x2e93(%rip),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_time>:
push   %rbx
cvtsi2sd %esi,%xmm0
cvtsi2sd %edi,%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
movslq %eax,%rcx
imul   $0xffffffff88888889,%rcx,%rax
shr    $0x20,%rax
add    %ecx,%eax
mov    %eax,%edx
shr    $0x1f,%edx
sar    $0x5,%eax
add    %edx,%eax
imul   $0x3c,%eax,%edx
xorps  %xmm1,%xmm1
cvtsi2sd %edx,%xmm1
subsd  %xmm1,%xmm0
imul   $0xffffffff91a2b3c5,%rcx,%rdx
shr    $0x20,%rdx
add    %ecx,%edx
mov    %edx,%ecx
shr    $0x1f,%ecx
sar    $0xb,%edx
add    %ecx,%edx
imul   $0xffffffc4,%edx,%ecx
add    %eax,%ecx
lea    0x2ebd(%rip),%rbx
lea    0xe8d(%rip),%rsi
mov    %rbx,%rdi
call   1030 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@show_time.time_buff = internal global [15 x i8] zeroinitializer
@.str = [17 x i8] c"%02d:%02d:%06.3f\00"
define i8* @show_time(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
store i32 %0, i32* %3
store i32 %1, i32* %4
%8 = load i32, i32* %4
%9 = sitofp i32 %8 to double
%10 = load i32, i32* %3
%11 = sitofp i32 %10 to double
%12 = fdiv double %9, %11
store double %12, double* %7
%13 = load double, double* %7
%14 = fptosi double %13 to i32
%15 = sdiv i32 %14, 60
store i32 %15, i32* %6
%16 = load i32, i32* %6
%17 = mul nsw i32 %16, 60
%18 = sitofp i32 %17 to double
%19 = load double, double* %7
%20 = fsub double %19, %18
store double %20, double* %7
%21 = load i32, i32* %6
%22 = sdiv i32 %21, 60
store i32 %22, i32* %5
%23 = load i32, i32* %5
%24 = mul nsw i32 %23, 60
%25 = load i32, i32* %6
%26 = sub nsw i32 %25, %24
store i32 %26, i32* %6
%27 = load i32, i32* %5
%28 = load i32, i32* %6
%29 = load double, double* %7
%30 = call i32 @sprintf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @show_time.time_buff, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %27, i32 %28, double %29)
ret i8* getelementptr inbounds ([15 x i8], [15 x i8]* @show_time.time_buff, i64 0, i64 0)
}

LLVM IR (-O2):
@show_time.time_buff = internal global [15 x i8] zeroinitializer
@.str = [17 x i8] c"%02d:%02d:%06.3f\00"
define i8* @show_time(i32 %0, i32 %1) {
%3 = sitofp i32 %1 to double
%4 = sitofp i32 %0 to double
%5 = fdiv double %3, %4
%6 = fptosi double %5 to i32
%7 = sdiv i32 %6, 60
%8 = mul nsw i32 %7, 60
%9 = sitofp i32 %8 to double
%10 = fsub double %5, %9
%11 = sdiv i32 %6, 3600
%12 = mul nsw i32 %11, -60
%13 = add nsw i32 %12, %7
%14 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @show_time.time_buff, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %13, double %10)
ret i8* getelementptr inbounds ([15 x i8], [15 x i8]* @show_time.time_buff, i64 0, i64 0)
}