#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 acos(int);
double atan22(int, double);
int cos(double);
int sin(double);
void illumination(double day, double lra, double ldec, double dr, double sra,
                  double sdec, double *pabl, double *ill) {
  double x, y, phi, i;
  y = cos(sdec) * sin(sra - lra);
  x = sin(sdec) * cos(ldec) - cos(sdec) * sin(ldec) * cos(sra - lra);
  *pabl = atan22(y, x);
  phi = acos(sin(sdec) * sin(ldec) + cos(sdec) * cos(ldec) * cos(sra - lra));
  i = atan22(sin(phi), (dr - cos(phi)));
  *ill = 0.5 * (1 + cos(i));
}


x86 assembly (clang, -O0):
<illumination>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  %xmm5,-0x30(%rbp)
mov    %rdi,-0x38(%rbp)
mov    %rsi,-0x40(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1050 <cos@plt>
mov    %eax,-0x94(%rbp)
movsd  -0x28(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
call   1040 <sin@plt>
mov    %eax,%ecx
mov    -0x94(%rbp),%eax
imul   %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1040 <sin@plt>
mov    %eax,-0x90(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1050 <cos@plt>
mov    %eax,%ecx
mov    -0x90(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x84(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1050 <cos@plt>
mov    %eax,-0x8c(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1040 <sin@plt>
mov    %eax,%ecx
mov    -0x8c(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x88(%rbp)
movsd  -0x28(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
call   1050 <cos@plt>
mov    -0x88(%rbp),%ecx
mov    %eax,%edx
mov    -0x84(%rbp),%eax
imul   %edx,%ecx
sub    %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x48(%rbp)
cvttsd2si -0x50(%rbp),%edi
movsd  -0x48(%rbp),%xmm0
call   1060 <atan22@plt>
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x30(%rbp),%xmm0
call   1040 <sin@plt>
mov    %eax,-0x80(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1040 <sin@plt>
mov    %eax,%ecx
mov    -0x80(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x78(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1050 <cos@plt>
mov    %eax,-0x7c(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1050 <cos@plt>
mov    %eax,%ecx
mov    -0x7c(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x74(%rbp)
movsd  -0x28(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
call   1050 <cos@plt>
mov    -0x78(%rbp),%edi
mov    %eax,%ecx
mov    -0x74(%rbp),%eax
imul   %ecx,%eax
add    %eax,%edi
call   1030 <acos@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
call   1040 <sin@plt>
mov    %eax,-0x64(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x58(%rbp),%xmm0
call   1050 <cos@plt>
movsd  -0x70(%rbp),%xmm0
mov    -0x64(%rbp),%edi
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
call   1060 <atan22@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
call   1050 <cos@plt>
add    $0x1,%eax
cvtsi2sd %eax,%xmm1
movsd  0xd06(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<illumination>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
movaps %xmm5,%xmm0
movsd  %xmm5,0x8(%rsp)
movsd  %xmm4,0x10(%rsp)
movsd  %xmm3,0x20(%rsp)
movsd  %xmm2,(%rsp)
movsd  %xmm1,0x18(%rsp)
call   1050 <cos@plt>
mov    %eax,%r12d
movsd  0x10(%rsp),%xmm0
subsd  0x18(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
call   1040 <sin@plt>
imul   %eax,%r12d
movsd  0x8(%rsp),%xmm0
call   1040 <sin@plt>
mov    %eax,%ebx
movsd  (%rsp),%xmm0
call   1050 <cos@plt>
mov    %eax,%ebp
imul   %ebx,%ebp
movsd  0x8(%rsp),%xmm0
call   1050 <cos@plt>
mov    %eax,%r13d
movsd  (%rsp),%xmm0
call   1040 <sin@plt>
mov    %eax,%ebx
imul   %r13d,%ebx
movsd  0x10(%rsp),%xmm0
call   1050 <cos@plt>
imul   %ebx,%eax
sub    %eax,%ebp
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
mov    %r12d,%edi
call   1060 <atan22@plt>
movsd  %xmm0,(%r15)
movsd  0x8(%rsp),%xmm0
call   1040 <sin@plt>
mov    %eax,%ebx
movsd  (%rsp),%xmm0
call   1040 <sin@plt>
imul   %eax,%ebx
movsd  0x8(%rsp),%xmm0
call   1050 <cos@plt>
mov    %eax,%ebp
movsd  (%rsp),%xmm0
call   1050 <cos@plt>
imul   %eax,%ebp
movsd  0x10(%rsp),%xmm0
call   1050 <cos@plt>
imul   %eax,%ebp
add    %ebx,%ebp
mov    %ebp,%edi
call   1030 <acos@plt>
movsd  %xmm0,(%rsp)
call   1040 <sin@plt>
mov    %eax,%ebx
movsd  (%rsp),%xmm0
call   1050 <cos@plt>
cvtsi2sd %eax,%xmm1
movsd  0x20(%rsp),%xmm0
subsd  %xmm1,%xmm0
mov    %ebx,%edi
call   1060 <atan22@plt>
call   1050 <cos@plt>
add    $0x1,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xd7e(%rip),%xmm0
movsd  %xmm0,(%r14)
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @illumination(double %0, double %1, double %2, double %3, double %4, double %5, double* %6, double* %7) {
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double*
%16 = alloca double*
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
store double %0, double* %9
store double %1, double* %10
store double %2, double* %11
store double %3, double* %12
store double %4, double* %13
store double %5, double* %14
store double* %6, double** %15
store double* %7, double** %16
%21 = load double, double* %14
%22 = call i32 @cos(double %21)
%23 = load double, double* %13
%24 = load double, double* %10
%25 = fsub double %23, %24
%26 = call i32 @sin(double %25)
%27 = mul nsw i32 %22, %26
%28 = sitofp i32 %27 to double
store double %28, double* %18
%29 = load double, double* %14
%30 = call i32 @sin(double %29)
%31 = load double, double* %11
%32 = call i32 @cos(double %31)
%33 = mul nsw i32 %30, %32
%34 = load double, double* %14
%35 = call i32 @cos(double %34)
%36 = load double, double* %11
%37 = call i32 @sin(double %36)
%38 = mul nsw i32 %35, %37
%39 = load double, double* %13
%40 = load double, double* %10
%41 = fsub double %39, %40
%42 = call i32 @cos(double %41)
%43 = mul nsw i32 %38, %42
%44 = sub nsw i32 %33, %43
%45 = sitofp i32 %44 to double
store double %45, double* %17
%46 = load double, double* %18
%47 = fptosi double %46 to i32
%48 = load double, double* %17
%49 = call double @atan22(i32 %47, double %48)
%50 = load double*, double** %15
store double %49, double* %50
%51 = load double, double* %14
%52 = call i32 @sin(double %51)
%53 = load double, double* %11
%54 = call i32 @sin(double %53)
%55 = mul nsw i32 %52, %54
%56 = load double, double* %14
%57 = call i32 @cos(double %56)
%58 = load double, double* %11
%59 = call i32 @cos(double %58)
%60 = mul nsw i32 %57, %59
%61 = load double, double* %13
%62 = load double, double* %10
%63 = fsub double %61, %62
%64 = call i32 @cos(double %63)
%65 = mul nsw i32 %60, %64
%66 = add nsw i32 %55, %65
%67 = call double @acos(i32 %66)
store double %67, double* %19
%68 = load double, double* %19
%69 = call i32 @sin(double %68)
%70 = load double, double* %12
%71 = load double, double* %19
%72 = call i32 @cos(double %71)
%73 = sitofp i32 %72 to double
%74 = fsub double %70, %73
%75 = call double @atan22(i32 %69, double %74)
store double %75, double* %20
%76 = load double, double* %20
%77 = call i32 @cos(double %76)
%78 = add nsw i32 1, %77
%79 = sitofp i32 %78 to double
%80 = fmul double 5.000000e-01, %79
%81 = load double*, double** %16
store double %80, double* %81
ret void
}

LLVM IR (-O2):
define void @illumination(double %0, double %1, double %2, double %3, double %4, double %5, double* nocapture writeonly %6, double* nocapture writeonly %7) {
%9 = tail call i32 @cos(double %5)
%10 = fsub double %4, %1
%11 = tail call i32 @sin(double %10)
%12 = mul nsw i32 %11, %9
%13 = tail call i32 @sin(double %5)
%14 = tail call i32 @cos(double %2)
%15 = mul nsw i32 %14, %13
%16 = tail call i32 @cos(double %5)
%17 = tail call i32 @sin(double %2)
%18 = mul nsw i32 %17, %16
%19 = tail call i32 @cos(double %10)
%20 = mul nsw i32 %18, %19
%21 = sub nsw i32 %15, %20
%22 = sitofp i32 %21 to double
%23 = tail call double @atan22(i32 %12, double %22)
store double %23, double* %6
%24 = tail call i32 @sin(double %5)
%25 = tail call i32 @sin(double %2)
%26 = mul nsw i32 %25, %24
%27 = tail call i32 @cos(double %5)
%28 = tail call i32 @cos(double %2)
%29 = mul nsw i32 %28, %27
%30 = tail call i32 @cos(double %10)
%31 = mul nsw i32 %29, %30
%32 = add nsw i32 %31, %26
%33 = tail call double @acos(i32 %32)
%34 = tail call i32 @sin(double %33)
%35 = tail call i32 @cos(double %33)
%36 = sitofp i32 %35 to double
%37 = fsub double %3, %36
%38 = tail call double @atan22(i32 %34, double %37)
%39 = tail call i32 @cos(double %38)
%40 = add nsw i32 %39, 1
%41 = sitofp i32 %40 to double
%42 = fmul double %41, 5.000000e-01
store double %42, double* %7
ret void
}