#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 */
struct tm {
  int /*<<< orphan*/ tm_sec;
  int /*<<< orphan*/ tm_min;
  int /*<<< orphan*/ tm_hour;
  int /*<<< orphan*/ tm_mday;
  int /*<<< orphan*/ tm_mon;
  int /*<<< orphan*/ tm_year;
};

/* Variables and functions */
double DOY(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
double Fraction_of_Day(int /*<<< orphan*/, int /*<<< orphan*/,
                       int /*<<< orphan*/);
double Julian_Date_of_Year(int /*<<< orphan*/);
double Julian_Date(struct tm *cdate) {
  double julian_date;
  julian_date = Julian_Date_of_Year(cdate->tm_year) +
                DOY(cdate->tm_year, cdate->tm_mon, cdate->tm_mday) +
                Fraction_of_Day(cdate->tm_hour, cdate->tm_min, cdate->tm_sec);
  return (julian_date);
}


x86 assembly (clang, -O0):
<Julian_Date>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x14(%rax),%edi
call   1030 <Julian_Date_of_Year@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    0x14(%rax),%edi
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%esi
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%edx
call   1040 <DOY@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%edi
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%esi
mov    -0x8(%rbp),%rax
mov    (%rax),%edx
call   1050 <Fraction_of_Day@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Julian_Date>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
mov    0x14(%rdi),%edi
call   1030 <Julian_Date_of_Year@plt>
movsd  %xmm0,0x8(%rsp)
mov    0x14(%rbx),%edi
mov    0xc(%rbx),%edx
mov    0x10(%rbx),%esi
call   1040 <DOY@plt>
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    0x8(%rbx),%edi
mov    (%rbx),%edx
mov    0x4(%rbx),%esi
call   1050 <Fraction_of_Day@plt>
addsd  0x8(%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
define double @Julian_Date(%struct.tm* %0) {
%2 = alloca %struct.tm*
%3 = alloca double
store %struct.tm* %0, %struct.tm** %2
%4 = load %struct.tm*, %struct.tm** %2
%5 = getelementptr inbounds %struct.tm, %struct.tm* %4, i32 0, i32 5
%6 = load i32, i32* %5
%7 = call double @Julian_Date_of_Year(i32 %6)
%8 = load %struct.tm*, %struct.tm** %2
%9 = getelementptr inbounds %struct.tm, %struct.tm* %8, i32 0, i32 5
%10 = load i32, i32* %9
%11 = load %struct.tm*, %struct.tm** %2
%12 = getelementptr inbounds %struct.tm, %struct.tm* %11, i32 0, i32 4
%13 = load i32, i32* %12
%14 = load %struct.tm*, %struct.tm** %2
%15 = getelementptr inbounds %struct.tm, %struct.tm* %14, i32 0, i32 3
%16 = load i32, i32* %15
%17 = call double @DOY(i32 %10, i32 %13, i32 %16)
%18 = fadd double %7, %17
%19 = load %struct.tm*, %struct.tm** %2
%20 = getelementptr inbounds %struct.tm, %struct.tm* %19, i32 0, i32 2
%21 = load i32, i32* %20
%22 = load %struct.tm*, %struct.tm** %2
%23 = getelementptr inbounds %struct.tm, %struct.tm* %22, i32 0, i32 1
%24 = load i32, i32* %23
%25 = load %struct.tm*, %struct.tm** %2
%26 = getelementptr inbounds %struct.tm, %struct.tm* %25, i32 0, i32 0
%27 = load i32, i32* %26
%28 = call double @Fraction_of_Day(i32 %21, i32 %24, i32 %27)
%29 = fadd double %18, %28
store double %29, double* %3
%30 = load double, double* %3
ret double %30
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
define double @Julian_Date(%struct.tm* nocapture %0) {
%2 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 5
%3 = load i32, i32* %2
%4 = tail call double @Julian_Date_of_Year(i32 %3)
%5 = load i32, i32* %2
%6 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 4
%7 = load i32, i32* %6
%8 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 3
%9 = load i32, i32* %8
%10 = tail call double @DOY(i32 %5, i32 %7, i32 %9)
%11 = fadd double %4, %10
%12 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 2
%13 = load i32, i32* %12
%14 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 1
%15 = load i32, i32* %14
%16 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 0
%17 = load i32, i32* %16
%18 = tail call double @Fraction_of_Day(i32 %13, i32 %15, i32 %17)
%19 = fadd double %11, %18
ret double %19
}