#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 fabs(double);
double sin(double);
double cosSolarZenith(double lat, double dec, double h) {
  double x, y;
  x = sin(lat) * sin(dec) + cos(lat) * cos(dec) * cos(h);
  y = 0.5 * (x + fabs(x));
  return (y);
}


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

x86 assembly (clang, -O2):
<cosSolarZenith>:
sub    $0x28,%rsp
movsd  %xmm2,0x20(%rsp)
movsd  %xmm1,(%rsp)
movsd  %xmm0,0x8(%rsp)
call   1030 <sin@plt>
movsd  %xmm0,0x18(%rsp)
movsd  (%rsp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
call   1040 <cos@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x20(%rsp),%xmm0
call   1040 <cos@plt>
mulsd  (%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
mulsd  0x18(%rsp),%xmm1
addsd  %xmm1,%xmm0
movapd 0xe62(%rip),%xmm1
andpd  %xmm0,%xmm1
addsd  %xmm1,%xmm0
mulsd  0xe62(%rip),%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @cosSolarZenith(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%9 = load double, double* %4
%10 = call double @sin(double %9)
%11 = load double, double* %5
%12 = call double @sin(double %11)
%13 = load double, double* %4
%14 = call double @cos(double %13)
%15 = load double, double* %5
%16 = call double @cos(double %15)
%17 = fmul double %14, %16
%18 = load double, double* %6
%19 = call double @cos(double %18)
%20 = fmul double %17, %19
%21 = call double @llvm.fmuladd.f64(double %10, double %12, double %20)
store double %21, double* %7
%22 = load double, double* %7
%23 = load double, double* %7
%24 = call double @llvm.fabs.f64(double %23)
%25 = fadd double %22, %24
%26 = fmul double 5.000000e-01, %25
store double %26, double* %8
%27 = load double, double* %8
ret double %27
}

LLVM IR (-O2):
define double @cosSolarZenith(double %0, double %1, double %2) {
%4 = tail call double @sin(double %0)
%5 = tail call double @sin(double %1)
%6 = tail call double @cos(double %0)
%7 = tail call double @cos(double %1)
%8 = fmul double %6, %7
%9 = tail call double @cos(double %2)
%10 = fmul double %8, %9
%11 = tail call double @llvm.fmuladd.f64(double %4, double %5, double %10)
%12 = tail call double @llvm.fabs.f64(double %11)
%13 = fadd double %11, %12
%14 = fmul double %13, 5.000000e-01
ret double %14
}