#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 /*<<< orphan*/ time_t;
struct tm {
  double tm_hour;
  double tm_min;
  double tm_sec;
};

/* Variables and functions */
struct tm *gmtime(int /*<<< orphan*/ *);
double sunmodel_get_jd(struct tm *);
int /*<<< orphan*/ sunmodel_ll_0(double, double, double *, double *);
double sunmodel_time_julian_cent(double);
void sunmodel_ll(time_t t, double *lat, double *lon) {
  struct tm *gmt;
  double jday, tl, tt;
  double slon, slat;
  gmt = gmtime(&t);
  if (gmt == NULL) {
    return;
  }
  jday = sunmodel_get_jd(gmt);
  tl = gmt->tm_hour / 24.0 + gmt->tm_min / 1440.0 + gmt->tm_sec / 86400.0;
  tt = sunmodel_time_julian_cent(jday + tl);
  sunmodel_ll_0(tt, tl * 1440.0, &slat, &slon);
  if (lat != NULL) {
    (*lat) = slat;
  }
  if (lon != NULL) {
    (*lon) = slon;
  }
}


x86 assembly (clang, -O0):
<sunmodel_ll>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x4(%rbp),%rdi
call   1050 <gmtime@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1170 <sunmodel_ll+0x30>
jmp    122c <sunmodel_ll+0xec>
mov    -0x20(%rbp),%rdi
call   1040 <sunmodel_get_jd@plt>
movsd  %xmm0,-0x28(%rbp)
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xe82(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm1
movsd  0xe5d(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  0x10(%rax),%xmm1
movsd  0xe4c(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
addsd  -0x30(%rbp),%xmm0
call   1060 <sunmodel_time_julian_cent@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  0xe16(%rip),%xmm1
mulsd  -0x30(%rbp),%xmm1
lea    -0x48(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1030 <sunmodel_ll_0@plt>
cmpq   $0x0,-0x10(%rbp)
je     1214 <sunmodel_ll+0xd4>
movsd  -0x48(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
cmpq   $0x0,-0x18(%rbp)
je     122c <sunmodel_ll+0xec>
movsd  -0x40(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sunmodel_ll>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %edi,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1050 <gmtime@plt>
test   %rax,%rax
je     11e7 <sunmodel_ll+0xa7>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <sunmodel_get_jd@plt>
movsd  0x8(%rbx),%xmm1
divsd  0xe82(%rip),%xmm1
movsd  (%rbx),%xmm2
movhpd 0x10(%rbx),%xmm2
divpd  0xe81(%rip),%xmm2
addsd  %xmm2,%xmm1
unpckhpd %xmm2,%xmm2
addsd  %xmm1,%xmm2
movapd %xmm2,0x20(%rsp)
addsd  %xmm2,%xmm0
call   1060 <sunmodel_time_julian_cent@plt>
movapd 0x20(%rsp),%xmm1
mulsd  0xe48(%rip),%xmm1
lea    0x10(%rsp),%rdi
lea    0x18(%rsp),%rsi
call   1030 <sunmodel_ll_0@plt>
test   %r15,%r15
je     11d7 <sunmodel_ll+0x97>
movsd  0x10(%rsp),%xmm0
movsd  %xmm0,(%r15)
test   %r14,%r14
je     11e7 <sunmodel_ll+0xa7>
movsd  0x18(%rsp),%xmm0
movsd  %xmm0,(%r14)
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.tm = type { double, double, double }
define void @sunmodel_ll(i32 %0, double* %1, double* %2) {
%4 = alloca i32
%5 = alloca double*
%6 = alloca double*
%7 = alloca %struct.tm*
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
store i32 %0, i32* %4
store double* %1, double** %5
store double* %2, double** %6
%13 = call %struct.tm* @gmtime(i32* %4)
store %struct.tm* %13, %struct.tm** %7
%14 = load %struct.tm*, %struct.tm** %7
%15 = icmp eq %struct.tm* %14, null
br i1 %15, label %16, label %17
16: ; preds = %3
br label %53
17: ; preds = %3
%18 = load %struct.tm*, %struct.tm** %7
%19 = call double @sunmodel_get_jd(%struct.tm* %18)
store double %19, double* %8
%20 = load %struct.tm*, %struct.tm** %7
%21 = getelementptr inbounds %struct.tm, %struct.tm* %20, i32 0, i32 0
%22 = load double, double* %21
%23 = fdiv double %22, 2.400000e+01
%24 = load %struct.tm*, %struct.tm** %7
%25 = getelementptr inbounds %struct.tm, %struct.tm* %24, i32 0, i32 1
%26 = load double, double* %25
%27 = fdiv double %26, 1.440000e+03
%28 = fadd double %23, %27
%29 = load %struct.tm*, %struct.tm** %7
%30 = getelementptr inbounds %struct.tm, %struct.tm* %29, i32 0, i32 2
%31 = load double, double* %30
%32 = fdiv double %31, 8.640000e+04
%33 = fadd double %28, %32
store double %33, double* %9
%34 = load double, double* %8
%35 = load double, double* %9
%36 = fadd double %34, %35
%37 = call double @sunmodel_time_julian_cent(double %36)
store double %37, double* %10
%38 = load double, double* %10
%39 = load double, double* %9
%40 = fmul double %39, 1.440000e+03
%41 = call i32 @sunmodel_ll_0(double %38, double %40, double* %12, double* %11)
%42 = load double*, double** %5
%43 = icmp ne double* %42, null
br i1 %43, label %44, label %47
44: ; preds = %17
%45 = load double, double* %12
%46 = load double*, double** %5
store double %45, double* %46
br label %47
47: ; preds = %44, %17
%48 = load double*, double** %6
%49 = icmp ne double* %48, null
br i1 %49, label %50, label %53
50: ; preds = %47
%51 = load double, double* %11
%52 = load double*, double** %6
store double %51, double* %52
br label %53
53: ; preds = %16, %50, %47
ret void
}

LLVM IR (-O2):
%struct.tm = type { double, double, double }
define void @sunmodel_ll(i32 %0, double* writeonly %1, double* writeonly %2) {
%4 = alloca i32
%5 = alloca double
%6 = alloca double
store i32 %0, i32* %4
%7 = bitcast double* %5 to i8*
%8 = bitcast double* %6 to i8*
%9 = call %struct.tm* @gmtime(i32* %4)
%10 = icmp eq %struct.tm* %9, null
br i1 %10, label %38, label %11
11: ; preds = %3
%12 = call double @sunmodel_get_jd(%struct.tm* %9)
%13 = getelementptr inbounds %struct.tm, %struct.tm* %9, i64 0, i32 0
%14 = load double, double* %13
%15 = getelementptr inbounds %struct.tm, %struct.tm* %9, i64 0, i32 1
%16 = load double, double* %15
%17 = fdiv double %16, 1.440000e+03
%18 = getelementptr inbounds %struct.tm, %struct.tm* %9, i64 0, i32 2
%19 = load double, double* %18
%20 = insertelement <2 x double> poison, double %14, i64 0
%21 = insertelement <2 x double> %20, double %19, i64 1
%22 = fdiv <2 x double> %21, <double 2.400000e+01, double 8.640000e+04>
%23 = extractelement <2 x double> %22, i64 0
%24 = fadd double %23, %17
%25 = extractelement <2 x double> %22, i64 1
%26 = fadd double %24, %25
%27 = fadd double %12, %26
%28 = call double @sunmodel_time_julian_cent(double %27)
%29 = fmul double %26, 1.440000e+03
%30 = call i32 @sunmodel_ll_0(double %28, double %29, double* %6, double* %5)
%31 = icmp eq double* %1, null
br i1 %31, label %34, label %32
32: ; preds = %11
%33 = load double, double* %6
store double %33, double* %1
br label %34
34: ; preds = %32, %11
%35 = icmp eq double* %2, null
br i1 %35, label %38, label %36
36: ; preds = %34
%37 = load double, double* %5
store double %37, double* %2
br label %38
38: ; preds = %34, %36, %3
ret void
}