#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(double);
int /*<<< orphan*/ sprintf(char *, char *, int, int, int);
void conv_time(char *string, double ra) {
  int hour, min, sec;
  while (ra < 0)
    ++ra;
  while (ra > 1)
    --ra;
  ra *= 24.0;
  hour = (int)floor(ra);
  ra -= (double)hour;
  ra *= 60.0;
  min = (int)floor(ra);
  ra -= (double)min;
  sec = (int)floor(ra * 60.0);
  sprintf(string, "%02i:%02i:%02i", hour, min, sec);
  return;
}


x86 assembly (clang, -O0):
<conv_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1156 <conv_time+0x36>
movsd  0xeb9(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1131 <conv_time+0x11>
jmp    115b <conv_time+0x3b>
movsd  -0x10(%rbp),%xmm0
movsd  0xe98(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1189 <conv_time+0x69>
movsd  0xe9e(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    115b <conv_time+0x3b>
movsd  0xe7f(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <floor@plt>
mov    %eax,-0x14(%rbp)
cvtsi2sdl -0x14(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xe45(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <floor@plt>
mov    %eax,-0x18(%rbp)
cvtsi2sdl -0x18(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xe13(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
call   1040 <floor@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
lea    0xe09(%rip),%rsi
call   1030 <sprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<conv_time>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%r14
xorpd  %xmm2,%xmm2
ucomisd %xmm0,%xmm2
jbe    114a <conv_time+0x2a>
movsd  0xec2(%rip),%xmm1
xchg   %ax,%ax
addsd  %xmm1,%xmm0
ucomisd %xmm0,%xmm2
ja     1140 <conv_time+0x20>
ucomisd 0xeae(%rip),%xmm0
jbe    117a <conv_time+0x5a>
movsd  0xeac(%rip),%xmm2
movsd  0xe9c(%rip),%xmm1
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
addsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
ja     1170 <conv_time+0x50>
mulsd  0xe8e(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
call   1040 <floor@plt>
mov    %rax,%r15
xorps  %xmm1,%xmm1
cvtsi2sd %r15d,%xmm1
movsd  0x8(%rsp),%xmm0
subsd  %xmm1,%xmm0
mulsd  0xe6e(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
call   1040 <floor@plt>
mov    %rax,%rbx
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  0xe47(%rip),%xmm1
movapd %xmm1,%xmm0
call   1040 <floor@plt>
lea    0xe3f(%rip),%rsi
mov    %r14,%rdi
mov    %r15d,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <sprintf@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"%02i:%02i:%02i\00"
define void @conv_time(i8* %0, double %1) {
%3 = alloca i8*
%4 = alloca double
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %3
store double %1, double* %4
br label %8
8: ; preds = %11, %2
%9 = load double, double* %4
%10 = fcmp olt double %9, 0.000000e+00
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = load double, double* %4
%13 = fadd double %12, 1.000000e+00
store double %13, double* %4
br label %8
14: ; preds = %8
br label %15
15: ; preds = %18, %14
%16 = load double, double* %4
%17 = fcmp ogt double %16, 1.000000e+00
br i1 %17, label %18, label %21
18: ; preds = %15
%19 = load double, double* %4
%20 = fadd double %19, -1.000000e+00
store double %20, double* %4
br label %15
21: ; preds = %15
%22 = load double, double* %4
%23 = fmul double %22, 2.400000e+01
store double %23, double* %4
%24 = load double, double* %4
%25 = call i64 @floor(double %24)
%26 = trunc i64 %25 to i32
store i32 %26, i32* %5
%27 = load i32, i32* %5
%28 = sitofp i32 %27 to double
%29 = load double, double* %4
%30 = fsub double %29, %28
store double %30, double* %4
%31 = load double, double* %4
%32 = fmul double %31, 6.000000e+01
store double %32, double* %4
%33 = load double, double* %4
%34 = call i64 @floor(double %33)
%35 = trunc i64 %34 to i32
store i32 %35, i32* %6
%36 = load i32, i32* %6
%37 = sitofp i32 %36 to double
%38 = load double, double* %4
%39 = fsub double %38, %37
store double %39, double* %4
%40 = load double, double* %4
%41 = fmul double %40, 6.000000e+01
%42 = call i64 @floor(double %41)
%43 = trunc i64 %42 to i32
store i32 %43, i32* %7
%44 = load i8*, i8** %3
%45 = load i32, i32* %5
%46 = load i32, i32* %6
%47 = load i32, i32* %7
%48 = call i32 @sprintf(i8* %44, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %45, i32 %46, i32 %47)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"%02i:%02i:%02i\00"
define void @conv_time(i8* nocapture writeonly %0, double %1) {
%3 = fcmp olt double %1, 0.000000e+00
br i1 %3, label %7, label %4
4: ; preds = %7, %2
%5 = phi double [ %1, %2 ], [ %9, %7 ]
%6 = fcmp ogt double %5, 1.000000e+00
br i1 %6, label %11, label %15
7: ; preds = %2, %7
%8 = phi double [ %9, %7 ], [ %1, %2 ]
%9 = fadd double %8, 1.000000e+00
%10 = fcmp olt double %9, 0.000000e+00
br i1 %10, label %7, label %4
11: ; preds = %4, %11
%12 = phi double [ %13, %11 ], [ %5, %4 ]
%13 = fadd double %12, -1.000000e+00
%14 = fcmp ogt double %13, 1.000000e+00
br i1 %14, label %11, label %15
15: ; preds = %11, %4
%16 = phi double [ %5, %4 ], [ %13, %11 ]
%17 = fmul double %16, 2.400000e+01
%18 = tail call i64 @floor(double %17)
%19 = trunc i64 %18 to i32
%20 = sitofp i32 %19 to double
%21 = fsub double %17, %20
%22 = fmul double %21, 6.000000e+01
%23 = tail call i64 @floor(double %22)
%24 = trunc i64 %23 to i32
%25 = sitofp i32 %24 to double
%26 = fsub double %22, %25
%27 = fmul double %26, 6.000000e+01
%28 = tail call i64 @floor(double %27)
%29 = trunc i64 %28 to i32
%30 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %19, i32 %24, i32 %29)
ret void
}