#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 *);
double greg2jul(int, int, int, int, int, double);
char *julian_get_clean_hhmm(char *);
int /*<<< orphan*/ julian_get_hour_minute(int *, int *, char *);
int strlen(char *);
double julian_yyyymmdd_time_hhmm_to_julian(char *yyyymmdd, char *hhmm) {
  int year, month, day, hour, minute;
  char buffer[128];
  hhmm = julian_get_clean_hhmm(hhmm);
  if (strlen(yyyymmdd) != 8 || strlen(hhmm) != 4) {
    return 0.0;
  }
  *(buffer + 4) = '\0';
  *buffer = *yyyymmdd;
  *(buffer + 1) = *(yyyymmdd + 1);
  *(buffer + 2) = *(yyyymmdd + 2);
  *(buffer + 3) = *(yyyymmdd + 3);
  year = atoi(buffer);
  *(buffer + 2) = '\0';
  *(buffer) = *(yyyymmdd + 4);
  *(buffer + 1) = *(yyyymmdd + 5);
  month = atoi(buffer);
  *(buffer + 2) = '\0';
  *(buffer) = *(yyyymmdd + 6);
  *(buffer + 1) = *(yyyymmdd + 7);
  day = atoi(buffer);
  julian_get_hour_minute(&hour, &minute, hhmm);
  return greg2jul(month, day, year, hour, minute, 0.0);
}


x86 assembly (clang, -O0):
<julian_yyyymmdd_time_hhmm_to_julian>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%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),%rdi
call   1050 <strlen@plt>
cmp    $0x8,%eax
jne    1194 <julian_yyyymmdd_time_hhmm_to_julian+0x44>
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x4,%eax
je     11a1 <julian_yyyymmdd_time_hhmm_to_julian+0x51>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1278 <julian_yyyymmdd_time_hhmm_to_julian+0x128>
movb   $0x0,-0xac(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0xb0(%rbp)
mov    -0x10(%rbp),%rax
mov    0x1(%rax),%al
mov    %al,-0xaf(%rbp)
mov    -0x10(%rbp),%rax
mov    0x2(%rax),%al
mov    %al,-0xae(%rbp)
mov    -0x10(%rbp),%rax
mov    0x3(%rax),%al
mov    %al,-0xad(%rbp)
lea    -0xb0(%rbp),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x1c(%rbp)
movb   $0x0,-0xae(%rbp)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%al
mov    %al,-0xb0(%rbp)
mov    -0x10(%rbp),%rax
mov    0x5(%rax),%al
mov    %al,-0xaf(%rbp)
lea    -0xb0(%rbp),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x20(%rbp)
movb   $0x0,-0xae(%rbp)
mov    -0x10(%rbp),%rax
mov    0x6(%rax),%al
mov    %al,-0xb0(%rbp)
mov    -0x10(%rbp),%rax
mov    0x7(%rax),%al
mov    %al,-0xaf(%rbp)
lea    -0xb0(%rbp),%rdi
call   1070 <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   1060 <greg2jul@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<julian_yyyymmdd_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    %rbx,%rdi
call   1050 <strlen@plt>
xorps  %xmm0,%xmm0
cmp    $0x8,%eax
jne    1226 <julian_yyyymmdd_time_hhmm_to_julian+0xd6>
mov    %r14,%rdi
call   1050 <strlen@plt>
xorps  %xmm0,%xmm0
cmp    $0x4,%eax
jne    1226 <julian_yyyymmdd_time_hhmm_to_julian+0xd6>
movb   $0x0,0x14(%rsp)
mov    (%rbx),%al
mov    %al,0x10(%rsp)
mov    0x1(%rbx),%al
mov    %al,0x11(%rsp)
mov    0x2(%rbx),%al
mov    %al,0x12(%rsp)
mov    0x3(%rbx),%al
mov    %al,0x13(%rsp)
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
call   1070 <atoi@plt>
mov    %eax,%r15d
movb   $0x0,0x12(%rsp)
mov    0x4(%rbx),%al
mov    %al,0x10(%rsp)
mov    0x5(%rbx),%al
mov    %al,0x11(%rsp)
mov    %rbp,%rdi
call   1070 <atoi@plt>
mov    %eax,%r12d
mov    0x6(%rbx),%al
mov    %al,0x10(%rsp)
mov    0x7(%rbx),%al
mov    %al,0x11(%rsp)
mov    %rbp,%rdi
call   1070 <atoi@plt>
mov    %eax,%ebx
lea    0xc(%rsp),%rdi
lea    0x8(%rsp),%rsi
mov    %r14,%rdx
call   1030 <julian_get_hour_minute@plt>
mov    0xc(%rsp),%ecx
mov    0x8(%rsp),%r8d
xorps  %xmm0,%xmm0
mov    %r12d,%edi
mov    %ebx,%esi
mov    %r15d,%edx
call   1060 <greg2jul@plt>
add    $0x90,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @julian_yyyymmdd_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]
store i8* %0, i8** %4
store i8* %1, i8** %5
%12 = load i8*, i8** %5
%13 = call i8* @julian_get_clean_hhmm(i8* %12)
store i8* %13, i8** %5
%14 = load i8*, i8** %4
%15 = call i32 @strlen(i8* %14)
%16 = icmp ne i32 %15, 8
br i1 %16, label %21, label %17
17: ; preds = %2
%18 = load i8*, i8** %5
%19 = call i32 @strlen(i8* %18)
%20 = icmp ne i32 %19, 4
br i1 %20, label %21, label %22
21: ; preds = %17, %2
store double 0.000000e+00, double* %3
br label %79
22: ; preds = %17
%23 = getelementptr inbounds [128 x i8], [128 x i8]* %11, i64 0, i64 0
%24 = getelementptr inbounds i8, i8* %23, i64 4
store i8 0, i8* %24
%25 = load i8*, i8** %4
%26 = load i8, i8* %25
%27 = getelementptr inbounds [128 x i8], [128 x i8]* %11, i64 0, i64 0
store i8 %26, i8* %27
%28 = load i8*, i8** %4
%29 = getelementptr inbounds i8, i8* %28, i64 1
%30 = load i8, i8* %29
%31 = getelementptr inbounds [128 x i8], [128 x i8]* %11, i64 0, i64 0
%32 = getelementptr inbounds i8, i8* %31, i64 1
store i8 %30, i8* %32
%33 = load i8*, i8** %4
%34 = getelementptr inbounds i8, i8* %33, i64 2
%35 = load i8, i8* %34
%36 = getelementptr inbounds [128 x i8], [128 x i8]* %11, i64 0, i64 0
%37 = getelementptr inbounds i8, i8* %36, i64 2
store i8 %35, i8* %37
%38 = load i8*, i8** %4
%39 = getelementptr inbounds i8, i8* %38, i64 3
%40 = load i8, i8* %39
%41 = getelementptr inbounds [128 x i8], [128 x i8]* %11, i64 0, i64 0
%42 = getelementptr inbounds i8, i8* %41, i64 3
store i8 %40, i8* %42
%43 = getelementptr inbounds [128 x i8], [128 x i8]* %11, i64 0, i64 0
%44 = call i32 @atoi(i8* %43)
store i32 %44, i32* %6
%45 = getelementptr inbounds [128 x i8], [128 x i8]* %11, i64 0, i64 0
%46 = getelementptr inbounds i8, i8* %45, i64 2
store i8 0, i8* %46
%47 = load i8*, i8** %4
%48 = getelementptr inbounds i8, i8* %47, i64 4
%49 = load i8, i8* %48
%50 = getelementptr inbounds [128 x i8], [128 x i8]* %11, i64 0, i64 0
store i8 %49, i8* %50
%51 = load i8*, i8** %4
%52 = getelementptr inbounds i8, i8* %51, i64 5
%53 = load i8, i8* %52
%54 = getelementptr inbounds [128 x i8], [128 x i8]* %11, i64 0, i64 0
%55 = getelementptr inbounds i8, i8* %54, i64 1
store i8 %53, i8* %55
%56 = getelementptr inbounds [128 x i8], [128 x i8]* %11, i64 0, i64 0
%57 = call i32 @atoi(i8* %56)
store i32 %57, i32* %7
%58 = getelementptr inbounds [128 x i8], [128 x i8]* %11, i64 0, i64 0
%59 = getelementptr inbounds i8, i8* %58, i64 2
store i8 0, i8* %59
%60 = load i8*, i8** %4
%61 = getelementptr inbounds i8, i8* %60, i64 6
%62 = load i8, i8* %61
%63 = getelementptr inbounds [128 x i8], [128 x i8]* %11, i64 0, i64 0
store i8 %62, i8* %63
%64 = load i8*, i8** %4
%65 = getelementptr inbounds i8, i8* %64, i64 7
%66 = load i8, i8* %65
%67 = getelementptr inbounds [128 x i8], [128 x i8]* %11, i64 0, i64 0
%68 = getelementptr inbounds i8, i8* %67, i64 1
store i8 %66, i8* %68
%69 = getelementptr inbounds [128 x i8], [128 x i8]* %11, i64 0, i64 0
%70 = call i32 @atoi(i8* %69)
store i32 %70, i32* %8
%71 = load i8*, i8** %5
%72 = call i32 @julian_get_hour_minute(i32* %9, i32* %10, i8* %71)
%73 = load i32, i32* %7
%74 = load i32, i32* %8
%75 = load i32, i32* %6
%76 = load i32, i32* %9
%77 = load i32, i32* %10
%78 = call double @greg2jul(i32 %73, i32 %74, i32 %75, i32 %76, i32 %77, double 0.000000e+00)
store double %78, double* %3
br label %79
79: ; preds = %22, %21
%80 = load double, double* %3
ret double %80
}

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