#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 cos(double);
double sin(double);
double getcosincidence(double aspect, double slope, double azimuth,
                       double zenith) {
  return cos(slope) * cos(zenith) +
         sin(slope) * sin(zenith) * cos(azimuth - aspect);
}


x86 assembly (clang, -O0):
<getcosincidence>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
call   1040 <cos@plt>
movsd  -0x38(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
movaps %xmm0,%xmm3
movsd  -0x28(%rbp),%xmm0
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getcosincidence>:
sub    $0x38,%rsp
movsd  %xmm3,0x8(%rsp)
movsd  %xmm2,0x28(%rsp)
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x20(%rsp)
movaps %xmm1,%xmm0
call   1040 <cos@plt>
movsd  %xmm0,0x30(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x10(%rsp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
mulsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x28(%rsp),%xmm0
subsd  0x20(%rsp),%xmm0
call   1040 <cos@plt>
mulsd  0x8(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
mulsd  0x30(%rsp),%xmm1
addsd  %xmm1,%xmm0
add    $0x38,%rsp
ret

LLVM IR (-O0):
define double @getcosincidence(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%9 = load double, double* %6
%10 = call double @cos(double %9)
%11 = load double, double* %8
%12 = call double @cos(double %11)
%13 = load double, double* %6
%14 = call double @sin(double %13)
%15 = load double, double* %8
%16 = call double @sin(double %15)
%17 = fmul double %14, %16
%18 = load double, double* %7
%19 = load double, double* %5
%20 = fsub double %18, %19
%21 = call double @cos(double %20)
%22 = fmul double %17, %21
%23 = call double @llvm.fmuladd.f64(double %10, double %12, double %22)
ret double %23
}

LLVM IR (-O2):
define double @getcosincidence(double %0, double %1, double %2, double %3) {
%5 = tail call double @cos(double %1)
%6 = tail call double @cos(double %3)
%7 = tail call double @sin(double %1)
%8 = tail call double @sin(double %3)
%9 = fmul double %7, %8
%10 = fsub double %2, %0
%11 = tail call double @cos(double %10)
%12 = fmul double %9, %11
%13 = tail call double @llvm.fmuladd.f64(double %5, double %6, double %12)
ret double %13
}