#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 */
double date2MJD(int, int, int, int /*<<< orphan*/, int /*<<< orphan*/,
                int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ strasign(char *, char *, int, int);
int str_date2JD(char *str_JD, char *str_date) {
  double str2double(char *);
  int yr, mo, day, hr, min, doy;
  double sec = 0, MJDday, MJDyr, MJDfrac;
  char tmp[30];
  strasign(tmp, str_date, 0, 3);
  yr = (int)str2double(tmp);
  strasign(tmp, str_date, 4, 5);
  mo = (int)str2double(tmp);
  strasign(tmp, str_date, 6, 7);
  day = (int)str2double(tmp);
  strasign(tmp, str_date, 8, 9);
  hr = (int)str2double(tmp);
  strasign(tmp, str_date, 10, 11);
  min = (int)str2double(tmp);
  strasign(tmp, str_date, 12, 13);
  sec = sec + str2double(tmp);
  strasign(tmp, str_date, 14, 19);
  sec = sec + str2double(tmp) / 1000000.0;
  MJDyr = date2MJD(yr, 1, 1, 0, 0, 0);
  MJDday = date2MJD(yr, mo, day, 0, 0, 0);
  MJDfrac = (((hr * 60.) + min) * 60 + sec) / 86400;
  doy = (int)(MJDday - MJDyr + .1);
  sprintf(str_JD, "%.12f", doy + MJDfrac);
  return (1);
}


x86 assembly (clang, -O0):
<str_date2JD>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
lea    -0x70(%rbp),%rdi
mov    -0x10(%rbp),%rsi
xor    %edx,%edx
mov    $0x3,%ecx
call   1050 <strasign@plt>
lea    -0x70(%rbp),%rdi
call   1030 <str2double@plt>
cvttsd2si %xmm0,%eax
mov    %eax,-0x14(%rbp)
lea    -0x70(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x4,%edx
mov    $0x5,%ecx
call   1050 <strasign@plt>
lea    -0x70(%rbp),%rdi
call   1030 <str2double@plt>
cvttsd2si %xmm0,%eax
mov    %eax,-0x18(%rbp)
lea    -0x70(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x6,%edx
mov    $0x7,%ecx
call   1050 <strasign@plt>
lea    -0x70(%rbp),%rdi
call   1030 <str2double@plt>
cvttsd2si %xmm0,%eax
mov    %eax,-0x1c(%rbp)
lea    -0x70(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x8,%edx
mov    $0x9,%ecx
call   1050 <strasign@plt>
lea    -0x70(%rbp),%rdi
call   1030 <str2double@plt>
cvttsd2si %xmm0,%eax
mov    %eax,-0x20(%rbp)
lea    -0x70(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0xa,%edx
mov    $0xb,%ecx
call   1050 <strasign@plt>
lea    -0x70(%rbp),%rdi
call   1030 <str2double@plt>
cvttsd2si %xmm0,%eax
mov    %eax,-0x24(%rbp)
lea    -0x70(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0xc,%edx
mov    $0xd,%ecx
call   1050 <strasign@plt>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
lea    -0x70(%rbp),%rdi
call   1030 <str2double@plt>
movaps %xmm0,%xmm1
movsd  -0x80(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
lea    -0x70(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0xe,%edx
mov    $0x13,%ecx
call   1050 <strasign@plt>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
lea    -0x70(%rbp),%rdi
call   1030 <str2double@plt>
movaps %xmm0,%xmm1
movsd  -0x78(%rbp),%xmm0
movsd  0xd88(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x14(%rbp),%edi
mov    $0x1,%edx
xor    %r9d,%r9d
mov    %edx,%esi
mov    %r9d,%ecx
mov    %r9d,%r8d
call   1040 <date2MJD@plt>
movsd  %xmm0,-0x40(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
xor    %r9d,%r9d
mov    %r9d,%ecx
mov    %r9d,%r8d
call   1040 <date2MJD@plt>
movsd  %xmm0,-0x38(%rbp)
cvtsi2sdl -0x20(%rbp),%xmm0
cvtsi2sdl -0x24(%rbp),%xmm1
movsd  0xd28(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x30(%rbp),%xmm1
movsd  0xd13(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xcfb(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x38(%rbp),%xmm0
subsd  -0x40(%rbp),%xmm0
movsd  0xcd8(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
cvtsi2sdl -0x28(%rbp),%xmm0
addsd  -0x48(%rbp),%xmm0
cvttsd2si %xmm0,%edx
lea    0xcd4(%rip),%rsi
call   1060 <sprintf@plt>
mov    $0x1,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_date2JD>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %rsi,%rbp
mov    %rdi,%r14
lea    0x30(%rsp),%rbx
mov    %rbx,%rdi
xor    %edx,%edx
mov    $0x3,%ecx
call   1050 <strasign@plt>
mov    %rbx,%rdi
call   1030 <str2double@plt>
cvttsd2si %xmm0,%r15d
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    $0x4,%edx
mov    $0x5,%ecx
call   1050 <strasign@plt>
mov    %rbx,%rdi
call   1030 <str2double@plt>
cvttsd2si %xmm0,%r12d
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    $0x6,%edx
mov    $0x7,%ecx
call   1050 <strasign@plt>
mov    %rbx,%rdi
call   1030 <str2double@plt>
cvttsd2si %xmm0,%r13d
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    $0x8,%edx
mov    $0x9,%ecx
call   1050 <strasign@plt>
mov    %rbx,%rdi
call   1030 <str2double@plt>
movapd %xmm0,0x20(%rsp)
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    $0xa,%edx
mov    $0xb,%ecx
call   1050 <strasign@plt>
mov    %rbx,%rdi
call   1030 <str2double@plt>
movapd %xmm0,0x10(%rsp)
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    $0xc,%edx
mov    $0xd,%ecx
call   1050 <strasign@plt>
mov    %rbx,%rdi
call   1030 <str2double@plt>
xorpd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    $0xe,%edx
mov    $0x13,%ecx
call   1050 <strasign@plt>
mov    %rbx,%rdi
call   1030 <str2double@plt>
divsd  0xdb2(%rip),%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
mov    %r15d,%edi
mov    $0x1,%esi
mov    $0x1,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1040 <date2MJD@plt>
movsd  %xmm0,0x8(%rsp)
mov    %r15d,%edi
mov    %r12d,%esi
mov    %r13d,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1040 <date2MJD@plt>
cvttpd2dq 0x20(%rsp),%xmm1
cvtdq2pd %xmm1,%xmm1
cvttpd2dq 0x10(%rsp),%xmm2
cvtdq2pd %xmm2,%xmm2
movsd  0xd5e(%rip),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm3,%xmm1
addsd  (%rsp),%xmm1
divsd  0xd4d(%rip),%xmm1
subsd  0x8(%rsp),%xmm0
addsd  0xd47(%rip),%xmm0
cvttpd2dq %xmm0,%xmm0
cvtdq2pd %xmm0,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edx
lea    0xd38(%rip),%rsi
mov    %r14,%rdi
call   1060 <sprintf@plt>
mov    $0x1,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%.12f\00"
define i32 @str_date2JD(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca [30 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
store double 0.000000e+00, double* %11
%16 = getelementptr inbounds [30 x i8], [30 x i8]* %15, i64 0, i64 0
%17 = load i8*, i8** %4
%18 = call i32 @strasign(i8* %16, i8* %17, i32 0, i32 3)
%19 = getelementptr inbounds [30 x i8], [30 x i8]* %15, i64 0, i64 0
%20 = call double @str2double(i8* %19)
%21 = fptosi double %20 to i32
store i32 %21, i32* %5
%22 = getelementptr inbounds [30 x i8], [30 x i8]* %15, i64 0, i64 0
%23 = load i8*, i8** %4
%24 = call i32 @strasign(i8* %22, i8* %23, i32 4, i32 5)
%25 = getelementptr inbounds [30 x i8], [30 x i8]* %15, i64 0, i64 0
%26 = call double @str2double(i8* %25)
%27 = fptosi double %26 to i32
store i32 %27, i32* %6
%28 = getelementptr inbounds [30 x i8], [30 x i8]* %15, i64 0, i64 0
%29 = load i8*, i8** %4
%30 = call i32 @strasign(i8* %28, i8* %29, i32 6, i32 7)
%31 = getelementptr inbounds [30 x i8], [30 x i8]* %15, i64 0, i64 0
%32 = call double @str2double(i8* %31)
%33 = fptosi double %32 to i32
store i32 %33, i32* %7
%34 = getelementptr inbounds [30 x i8], [30 x i8]* %15, i64 0, i64 0
%35 = load i8*, i8** %4
%36 = call i32 @strasign(i8* %34, i8* %35, i32 8, i32 9)
%37 = getelementptr inbounds [30 x i8], [30 x i8]* %15, i64 0, i64 0
%38 = call double @str2double(i8* %37)
%39 = fptosi double %38 to i32
store i32 %39, i32* %8
%40 = getelementptr inbounds [30 x i8], [30 x i8]* %15, i64 0, i64 0
%41 = load i8*, i8** %4
%42 = call i32 @strasign(i8* %40, i8* %41, i32 10, i32 11)
%43 = getelementptr inbounds [30 x i8], [30 x i8]* %15, i64 0, i64 0
%44 = call double @str2double(i8* %43)
%45 = fptosi double %44 to i32
store i32 %45, i32* %9
%46 = getelementptr inbounds [30 x i8], [30 x i8]* %15, i64 0, i64 0
%47 = load i8*, i8** %4
%48 = call i32 @strasign(i8* %46, i8* %47, i32 12, i32 13)
%49 = load double, double* %11
%50 = getelementptr inbounds [30 x i8], [30 x i8]* %15, i64 0, i64 0
%51 = call double @str2double(i8* %50)
%52 = fadd double %49, %51
store double %52, double* %11
%53 = getelementptr inbounds [30 x i8], [30 x i8]* %15, i64 0, i64 0
%54 = load i8*, i8** %4
%55 = call i32 @strasign(i8* %53, i8* %54, i32 14, i32 19)
%56 = load double, double* %11
%57 = getelementptr inbounds [30 x i8], [30 x i8]* %15, i64 0, i64 0
%58 = call double @str2double(i8* %57)
%59 = fdiv double %58, 1.000000e+06
%60 = fadd double %56, %59
store double %60, double* %11
%61 = load i32, i32* %5
%62 = call double @date2MJD(i32 %61, i32 1, i32 1, i32 0, i32 0, i32 0)
store double %62, double* %13
%63 = load i32, i32* %5
%64 = load i32, i32* %6
%65 = load i32, i32* %7
%66 = call double @date2MJD(i32 %63, i32 %64, i32 %65, i32 0, i32 0, i32 0)
store double %66, double* %12
%67 = load i32, i32* %8
%68 = sitofp i32 %67 to double
%69 = load i32, i32* %9
%70 = sitofp i32 %69 to double
%71 = call double @llvm.fmuladd.f64(double %68, double 6.000000e+01, double %70)
%72 = load double, double* %11
%73 = call double @llvm.fmuladd.f64(double %71, double 6.000000e+01, double %72)
%74 = fdiv double %73, 8.640000e+04
store double %74, double* %14
%75 = load double, double* %12
%76 = load double, double* %13
%77 = fsub double %75, %76
%78 = fadd double %77, 1.000000e-01
%79 = fptosi double %78 to i32
store i32 %79, i32* %10
%80 = load i8*, i8** %3
%81 = load i32, i32* %10
%82 = sitofp i32 %81 to double
%83 = load double, double* %14
%84 = fadd double %82, %83
%85 = fptosi double %84 to i32
%86 = call i32 @sprintf(i8* %80, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %85)
ret i32 1
}

LLVM IR (-O2):
@.str = [6 x i8] c"%.12f\00"
define i32 @str_date2JD(i8* nocapture writeonly %0, i8* %1) {
%3 = alloca [30 x i8]
%4 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%5 = call i32 @strasign(i8* %4, i8* %1, i32 0, i32 3)
%6 = call double @str2double(i8* %4)
%7 = fptosi double %6 to i32
%8 = call i32 @strasign(i8* %4, i8* %1, i32 4, i32 5)
%9 = call double @str2double(i8* %4)
%10 = fptosi double %9 to i32
%11 = call i32 @strasign(i8* %4, i8* %1, i32 6, i32 7)
%12 = call double @str2double(i8* %4)
%13 = fptosi double %12 to i32
%14 = call i32 @strasign(i8* %4, i8* %1, i32 8, i32 9)
%15 = call double @str2double(i8* %4)
%16 = fptosi double %15 to i32
%17 = call i32 @strasign(i8* %4, i8* %1, i32 10, i32 11)
%18 = call double @str2double(i8* %4)
%19 = fptosi double %18 to i32
%20 = call i32 @strasign(i8* %4, i8* %1, i32 12, i32 13)
%21 = call double @str2double(i8* %4)
%22 = fadd double %21, 0.000000e+00
%23 = call i32 @strasign(i8* %4, i8* %1, i32 14, i32 19)
%24 = call double @str2double(i8* %4)
%25 = fdiv double %24, 1.000000e+06
%26 = fadd double %22, %25
%27 = call double @date2MJD(i32 %7, i32 1, i32 1, i32 0, i32 0, i32 0)
%28 = call double @date2MJD(i32 %7, i32 %10, i32 %13, i32 0, i32 0, i32 0)
%29 = sitofp i32 %16 to double
%30 = sitofp i32 %19 to double
%31 = call double @llvm.fmuladd.f64(double %29, double 6.000000e+01, double %30)
%32 = call double @llvm.fmuladd.f64(double %31, double 6.000000e+01, double %26)
%33 = fdiv double %32, 8.640000e+04
%34 = fsub double %28, %27
%35 = fadd double %34, 1.000000e-01
%36 = fptosi double %35 to i32
%37 = sitofp i32 %36 to double
%38 = fadd double %33, %37
%39 = fptosi double %38 to i32
%40 = call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %39)
ret i32 1
}