#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 atoi(char *);
int character_count(char, char *);
double greg2jul(int, int, int, int, int, double);
char *julian_get_clean_hhmm(char *);
int /*<<< orphan*/ julian_get_hour_minute(int *, int *, char *);
int /*<<< orphan*/ julian_make_y2k_year(char *);
char *piece(char *, char, char *, int);
int strlen(char *);
int /*<<< orphan*/ timlib_strcpy(char *, int /*<<< orphan*/, int);
double julian_yyyy_mm_dd_time_hhmm_to_julian(char *yyyy_mm_dd, char *hhmm) {
  int year, month, day, hour, minute;
  char buffer[128];
  char year_buffer[8];
  double current;
  hhmm = julian_get_clean_hhmm(hhmm);
  if (character_count('-', yyyy_mm_dd) != 2 || strlen(hhmm) != 4) {
    return 0.0;
  }
  piece(year_buffer, '-', yyyy_mm_dd, 0);
  if (strlen(year_buffer) == 2) {
    timlib_strcpy(year_buffer, julian_make_y2k_year(year_buffer), 8);
  }
  year = atoi(year_buffer);
  month = atoi(piece(buffer, '-', yyyy_mm_dd, 1));
  day = atoi(piece(buffer, '-', yyyy_mm_dd, 2));
  julian_get_hour_minute(&hour, &minute, hhmm);
  current = greg2jul(month, day, year, hour, minute, 0.0);
  return current;
}


x86 assembly (clang, -O0):
<julian_yyyy_mm_dd_time_hhmm_to_julian>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <julian_get_clean_hhmm@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rsi
mov    $0x2d,%edi
call   1090 <character_count@plt>
cmp    $0x2,%eax
jne    11d9 <julian_yyyy_mm_dd_time_hhmm_to_julian+0x49>
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x4,%eax
je     11e6 <julian_yyyy_mm_dd_time_hhmm_to_julian+0x56>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12d6 <julian_yyyy_mm_dd_time_hhmm_to_julian+0x146>
lea    -0xb8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x2d,%esi
xor    %ecx,%ecx
call   10b0 <piece@plt>
lea    -0xb8(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x2,%eax
jne    123f <julian_yyyy_mm_dd_time_hhmm_to_julian+0xaf>
lea    -0xb8(%rbp),%rax
mov    %rax,-0xc8(%rbp)
lea    -0xb8(%rbp),%rdi
call   1080 <julian_make_y2k_year@plt>
mov    -0xc8(%rbp),%rdi
mov    %eax,%esi
mov    $0x8,%edx
call   1060 <timlib_strcpy@plt>
lea    -0xb8(%rbp),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x1c(%rbp)
lea    -0xb0(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x2d,%esi
mov    $0x1,%ecx
call   10b0 <piece@plt>
mov    %rax,%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x20(%rbp)
lea    -0xb0(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x2d,%esi
mov    $0x2,%ecx
call   10b0 <piece@plt>
mov    %rax,%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rdx
lea    -0x28(%rbp),%rdi
lea    -0x2c(%rbp),%rsi
call   1030 <julian_get_hour_minute@plt>
mov    -0x20(%rbp),%edi
mov    -0x24(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x28(%rbp),%ecx
mov    -0x2c(%rbp),%r8d
xorps  %xmm0,%xmm0
call   1070 <greg2jul@plt>
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0xc0(%rbp),%xmm0
ff
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<julian_yyyy_mm_dd_time_hhmm_to_julian>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x90,%rsp
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1040 <julian_get_clean_hhmm@plt>
mov    %rax,%r14
mov    $0x2d,%edi
mov    %rbx,%rsi
call   1090 <character_count@plt>
xorps  %xmm0,%xmm0
cmp    $0x2,%eax
jne    1293 <julian_yyyy_mm_dd_time_hhmm_to_julian+0x103>
mov    %r14,%rdi
call   1050 <strlen@plt>
xorps  %xmm0,%xmm0
cmp    $0x4,%eax
jne    1293 <julian_yyyy_mm_dd_time_hhmm_to_julian+0x103>
lea    0x8(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x2d,%esi
mov    %rbx,%rdx
xor    %ecx,%ecx
call   10b0 <piece@plt>
mov    %rbp,%rdi
call   1050 <strlen@plt>
cmp    $0x2,%eax
jne    121a <julian_yyyy_mm_dd_time_hhmm_to_julian+0x8a>
lea    0x8(%rsp),%rbp
mov    %rbp,%rdi
call   1080 <julian_make_y2k_year@plt>
mov    %rbp,%rdi
mov    %eax,%esi
mov    $0x8,%edx
call   1060 <timlib_strcpy@plt>
lea    0x8(%rsp),%rdi
call   10a0 <atoi@plt>
mov    %eax,%r15d
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x2d,%esi
mov    %rbx,%rdx
mov    $0x1,%ecx
call   10b0 <piece@plt>
mov    %rax,%rdi
call   10a0 <atoi@plt>
mov    %eax,%r12d
mov    %rbp,%rdi
mov    $0x2d,%esi
mov    %rbx,%rdx
mov    $0x2,%ecx
call   10b0 <piece@plt>
mov    %rax,%rdi
call   10a0 <atoi@plt>
mov    %eax,%ebx
lea    0x4(%rsp),%rdi
mov    %rsp,%rsi
mov    %r14,%rdx
call   1030 <julian_get_hour_minute@plt>
mov    0x4(%rsp),%ecx
mov    (%rsp),%r8d
xorps  %xmm0,%xmm0
mov    %r12d,%edi
mov    %ebx,%esi
mov    %r15d,%edx
call   1070 <greg2jul@plt>
add    $0x90,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @julian_yyyy_mm_dd_time_hhmm_to_julian(i8* %0, i8* %1) {
%3 = alloca double
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca [128 x i8]
%12 = alloca [8 x i8]
%13 = alloca double
store i8* %0, i8** %4
store i8* %1, i8** %5
%14 = load i8*, i8** %5
%15 = call i8* @julian_get_clean_hhmm(i8* %14)
store i8* %15, i8** %5
%16 = load i8*, i8** %4
%17 = call i32 @character_count(i8 signext 45, i8* %16)
%18 = icmp ne i32 %17, 2
br i1 %18, label %23, label %19
19: ; preds = %2
%20 = load i8*, i8** %5
%21 = call i32 @strlen(i8* %20)
%22 = icmp ne i32 %21, 4
br i1 %22, label %23, label %24
23: ; preds = %19, %2
store double 0.000000e+00, double* %3
br label %56
24: ; preds = %19
%25 = getelementptr inbounds [8 x i8], [8 x i8]* %12, i64 0, i64 0
%26 = load i8*, i8** %4
%27 = call i8* @piece(i8* %25, i8 signext 45, i8* %26, i32 0)
%28 = getelementptr inbounds [8 x i8], [8 x i8]* %12, i64 0, i64 0
%29 = call i32 @strlen(i8* %28)
%30 = icmp eq i32 %29, 2
br i1 %30, label %31, label %36
31: ; preds = %24
%32 = getelementptr inbounds [8 x i8], [8 x i8]* %12, i64 0, i64 0
%33 = getelementptr inbounds [8 x i8], [8 x i8]* %12, i64 0, i64 0
%34 = call i32 @julian_make_y2k_year(i8* %33)
%35 = call i32 @timlib_strcpy(i8* %32, i32 %34, i32 8)
br label %36
36: ; preds = %31, %24
%37 = getelementptr inbounds [8 x i8], [8 x i8]* %12, i64 0, i64 0
%38 = call i32 @atoi(i8* %37)
store i32 %38, i32* %6
%39 = getelementptr inbounds [128 x i8], [128 x i8]* %11, i64 0, i64 0
%40 = load i8*, i8** %4
%41 = call i8* @piece(i8* %39, i8 signext 45, i8* %40, i32 1)
%42 = call i32 @atoi(i8* %41)
store i32 %42, i32* %7
%43 = getelementptr inbounds [128 x i8], [128 x i8]* %11, i64 0, i64 0
%44 = load i8*, i8** %4
%45 = call i8* @piece(i8* %43, i8 signext 45, i8* %44, i32 2)
%46 = call i32 @atoi(i8* %45)
store i32 %46, i32* %8
%47 = load i8*, i8** %5
%48 = call i32 @julian_get_hour_minute(i32* %9, i32* %10, i8* %47)
%49 = load i32, i32* %7
%50 = load i32, i32* %8
%51 = load i32, i32* %6
%52 = load i32, i32* %9
%53 = load i32, i32* %10
%54 = call double @greg2jul(i32 %49, i32 %50, i32 %51, i32 %52, i32 %53, double 0.000000e+00)
store double %54, double* %13
%55 = load double, double* %13
store double %55, double* %3
br label %56
56: ; preds = %36, %23
%57 = load double, double* %3
ret double %57
}

LLVM IR (-O2):
define double @julian_yyyy_mm_dd_time_hhmm_to_julian(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [128 x i8]
%6 = alloca [8 x i8]
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%10 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 0
%11 = tail call i8* @julian_get_clean_hhmm(i8* %1)
%12 = tail call i32 @character_count(i8 signext 45, i8* %0)
%13 = icmp eq i32 %12, 2
br i1 %13, label %14, label %34
14: ; preds = %2
%15 = tail call i32 @strlen(i8* %11)
%16 = icmp eq i32 %15, 4
br i1 %16, label %17, label %34
17: ; preds = %14
%18 = call i8* @piece(i8* %10, i8 signext 45, i8* %0, i32 0)
%19 = call i32 @strlen(i8* %10)
%20 = icmp eq i32 %19, 2
br i1 %20, label %21, label %24
21: ; preds = %17
%22 = call i32 @julian_make_y2k_year(i8* %10)
%23 = call i32 @timlib_strcpy(i8* %10, i32 %22, i32 8)
br label %24
24: ; preds = %21, %17
%25 = call i32 @atoi(i8* %10)
%26 = call i8* @piece(i8* %9, i8 signext 45, i8* %0, i32 1)
%27 = call i32 @atoi(i8* %26)
%28 = call i8* @piece(i8* %9, i8 signext 45, i8* %0, i32 2)
%29 = call i32 @atoi(i8* %28)
%30 = call i32 @julian_get_hour_minute(i32* %3, i32* %4, i8* %11)
%31 = load i32, i32* %3
%32 = load i32, i32* %4
%33 = call double @greg2jul(i32 %27, i32 %29, i32 %25, i32 %31, i32 %32, double 0.000000e+00)
br label %34
34: ; preds = %2, %14, %24
%35 = phi double [ %33, %24 ], [ 0.000000e+00, %14 ], [ 0.000000e+00, %2 ]
ret double %35
}