#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 */
typedef int int64_t;

/* Variables and functions */
int /*<<< orphan*/ adjust_seconds(int *, int *);
double julday_sub(int julday1, int secofday1, int julday2, int secofday2,
                  int *days, int *secs) {
  int64_t sec_of_day;
  int64_t seconds;
  *days = julday2 - julday1;
  *secs = secofday2 - secofday1;
  sec_of_day = *secs;
  adjust_seconds(days, &sec_of_day);
  *secs = (int)sec_of_day;
  seconds = *days * 86400 + sec_of_day;
  return (double)seconds;
}


x86 assembly (clang, -O0):
<julday_sub>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
mov    -0xc(%rbp),%ecx
sub    -0x4(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%ecx
sub    -0x8(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x24(%rbp),%rsi
call   1030 <adjust_seconds@plt>
mov    -0x24(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
imul   $0x15180,(%rax),%eax
add    -0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
cvtsi2sdl -0x28(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<julday_sub>:
push   %r14
push   %rbx
push   %rax
mov    %r9,%r14
mov    %r8,%rbx
sub    %edi,%edx
mov    %edx,(%r8)
sub    %esi,%ecx
mov    %ecx,(%r9)
mov    %ecx,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    %r8,%rdi
call   1030 <adjust_seconds@plt>
mov    0x4(%rsp),%eax
mov    %eax,(%r14)
imul   $0x15180,(%rbx),%ecx
add    %eax,%ecx
cvtsi2sd %ecx,%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define double @julday_sub(i32 %0, i32 %1, i32 %2, i32 %3, i32* %4, i32* %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32*
%12 = alloca i32*
%13 = alloca i32
%14 = alloca i32
store i32 %0, i32* %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32* %4, i32** %11
store i32* %5, i32** %12
%15 = load i32, i32* %9
%16 = load i32, i32* %7
%17 = sub nsw i32 %15, %16
%18 = load i32*, i32** %11
store i32 %17, i32* %18
%19 = load i32, i32* %10
%20 = load i32, i32* %8
%21 = sub nsw i32 %19, %20
%22 = load i32*, i32** %12
store i32 %21, i32* %22
%23 = load i32*, i32** %12
%24 = load i32, i32* %23
store i32 %24, i32* %13
%25 = load i32*, i32** %11
%26 = call i32 @adjust_seconds(i32* %25, i32* %13)
%27 = load i32, i32* %13
%28 = load i32*, i32** %12
store i32 %27, i32* %28
%29 = load i32*, i32** %11
%30 = load i32, i32* %29
%31 = mul nsw i32 %30, 86400
%32 = load i32, i32* %13
%33 = add nsw i32 %31, %32
store i32 %33, i32* %14
%34 = load i32, i32* %14
%35 = sitofp i32 %34 to double
ret double %35
}

LLVM IR (-O2):
define double @julday_sub(i32 %0, i32 %1, i32 %2, i32 %3, i32* %4, i32* nocapture writeonly %5) {
%7 = alloca i32
%8 = bitcast i32* %7 to i8*
%9 = sub nsw i32 %2, %0
store i32 %9, i32* %4
%10 = sub nsw i32 %3, %1
store i32 %10, i32* %5
store i32 %10, i32* %7
%11 = call i32 @adjust_seconds(i32* %4, i32* %7)
%12 = load i32, i32* %7
store i32 %12, i32* %5
%13 = load i32, i32* %4
%14 = mul nsw i32 %13, 86400
%15 = add nsw i32 %14, %12
%16 = sitofp i32 %15 to double
ret double %16
}