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


x86 assembly (clang, -O0):
<julian_to_hhmm>:
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
lea    0xe72(%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_to_hhmm>:
push   %rbx
sub    $0xa0,%rsp
lea    0x10(%rsp),%rdi
lea    0xc(%rsp),%rsi
lea    0x14(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0x4(%rsp),%r8
lea    0x18(%rsp),%r9
call   1030 <jul2greg@plt>
mov    0x8(%rsp),%edx
mov    0x4(%rsp),%ecx
lea    0xe96(%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 = [9 x i8] c"%.2d%.2d\00"
define i8* @julian_to_hhmm(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 = call i32 @sprintf(i8* %12, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %13, i32 %14)
%16 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%17 = call i8* @strdup(i8* %16)
ret i8* %17
}

LLVM IR (-O2):
@.str = [9 x i8] c"%.2d%.2d\00"
define noalias i8* @julian_to_hhmm(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 = call i32 @sprintf(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %17, i32 %18)
%20 = call i8* @strdup(i8* %9)
ret i8* %20
}