#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*/ jul2greg(double, int *, int *, int *, int *, int *,
                            double *);
int /*<<< orphan*/ sprintf(char *, char *, int, int, int);
char *strdup(char *);
char *julian_display_hhmmss(double current) {
  char buffer[128];
  int year, month, day, hour, minute;
  double seconds;
  jul2greg(current, &month, &day, &year, &hour, &minute, &seconds);
  sprintf(buffer, "%.2d:%.2d:%.2d", hour, minute, (int)seconds);
  return strdup(buffer);
}


x86 assembly (clang, -O0):
<julian_display_hhmmss>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
lea    -0x98(%rbp),%rdi
lea    -0x9c(%rbp),%rsi
lea    -0x94(%rbp),%rdx
lea    -0xa0(%rbp),%rcx
lea    -0xa4(%rbp),%r8
lea    -0xb0(%rbp),%r9
call   1030 <jul2greg@plt>
lea    -0x90(%rbp),%rdi
mov    -0xa0(%rbp),%edx
mov    -0xa4(%rbp),%ecx
cvttsd2si -0xb0(%rbp),%r8d
ff ff
lea    0xe69(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x90(%rbp),%rdi
call   1050 <strdup@plt>
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<julian_display_hhmmss>:
push   %rbx
sub    $0xa0,%rsp
lea    0x18(%rsp),%rdi
lea    0x14(%rsp),%rsi
lea    0x1c(%rsp),%rdx
lea    0x4(%rsp),%rcx
mov    %rsp,%r8
lea    0x8(%rsp),%r9
call   1030 <jul2greg@plt>
mov    0x4(%rsp),%edx
mov    (%rsp),%ecx
cvttsd2si 0x8(%rsp),%r8d
lea    0xe92(%rip),%rsi
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1050 <strdup@plt>
add    $0xa0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"%.2d:%.2d:%.2d\00"
define i8* @julian_display_hhmmss(double %0) {
%2 = alloca double
%3 = alloca [128 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca double
store double %0, double* %2
%10 = load double, double* %2
%11 = call i32 @jul2greg(double %10, i32* %5, i32* %6, i32* %4, i32* %7, i32* %8, double* %9)
%12 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%13 = load i32, i32* %7
%14 = load i32, i32* %8
%15 = load double, double* %9
%16 = fptosi double %15 to i32
%17 = call i32 @sprintf(i8* %12, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %13, i32 %14, i32 %16)
%18 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%19 = call i8* @strdup(i8* %18)
ret i8* %19
}

LLVM IR (-O2):
@.str = [15 x i8] c"%.2d:%.2d:%.2d\00"
define noalias i8* @julian_display_hhmmss(double %0) {
%2 = alloca [128 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca double
%9 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%10 = bitcast i32* %3 to i8*
%11 = bitcast i32* %4 to i8*
%12 = bitcast i32* %5 to i8*
%13 = bitcast i32* %6 to i8*
%14 = bitcast i32* %7 to i8*
%15 = bitcast double* %8 to i8*
%16 = call i32 @jul2greg(double %0, i32* %4, i32* %5, i32* %3, i32* %6, i32* %7, double* %8)
%17 = load i32, i32* %6
%18 = load i32, i32* %7
%19 = load double, double* %8
%20 = fptosi double %19 to i32
%21 = call i32 @sprintf(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %17, i32 %18, i32 %20)
%22 = call i8* @strdup(i8* %9)
ret i8* %22
}