#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 k_exo(double);
int pow(int, int);
double k_in(double dem, double doy, double sunza) {
  double ds;
  double tsw;
  double kexo;
  ds = 1 - 0.01672 * cos(2 * 3.1415927 * (doy - 4) / 365.0);
  tsw = 0.75 + 2 * pow(10, -5) * dem;
  kexo = k_exo(doy);
  return (tsw * kexo * cos(sunza * 3.1415927 / 180.0) / (ds * ds));
}


x86 assembly (clang, -O0):
<k_in>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  0xee4(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  0xed0(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xebc(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1040 <cos@plt>
movsd  0xe9b(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe97(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    $0xa,%edi
mov    $0xfffffffb,%esi
call   1050 <pow@plt>
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  -0x8(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe57(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <k_exo@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe20(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  0xe0b(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  -0x20(%rbp),%xmm1
mulsd  -0x20(%rbp),%xmm1
divsd  %xmm1,%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<k_in>:
sub    $0x48,%rsp
movsd  %xmm2,0x28(%rsp)
movsd  %xmm1,(%rsp)
movaps %xmm0,0x10(%rsp)
movsd  0xeb4(%rip),%xmm0
addsd  %xmm1,%xmm0
mulsd  0xeb0(%rip),%xmm0
divsd  0xeb0(%rip),%xmm0
call   1040 <cos@plt>
movapd %xmm0,0x30(%rsp)
mov    $0xa,%edi
mov    $0xfffffffb,%esi
call   1050 <pow@plt>
add    %eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movapd 0x10(%rsp),%xmm1
shufpd $0x2,0xe9e(%rip),%xmm1
unpcklpd 0x30(%rsp),%xmm0
mulpd  %xmm0,%xmm1
addpd  0xe9c(%rip),%xmm1
movapd %xmm1,0x10(%rsp)
movsd  (%rsp),%xmm0
call   1030 <k_exo@plt>
movaps %xmm0,(%rsp)
movsd  0x28(%rsp),%xmm0
mulsd  0xe52(%rip),%xmm0
divsd  0xe52(%rip),%xmm0
call   1040 <cos@plt>
movapd (%rsp),%xmm1
movapd 0x10(%rsp),%xmm2
shufpd $0x2,%xmm2,%xmm1
mulpd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
unpckhpd %xmm1,%xmm1
divsd  %xmm1,%xmm0
add    $0x48,%rsp
ret

LLVM IR (-O0):
define double @k_in(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%10 = load double, double* %5
%11 = fsub double %10, 4.000000e+00
%12 = fmul double 0x401921FB5A7ED197, %11
%13 = fdiv double %12, 3.650000e+02
%14 = call double @cos(double %13)
%15 = call double @llvm.fmuladd.f64(double -1.672000e-02, double %14, double 1.000000e+00)
store double %15, double* %7
%16 = call i32 @pow(i32 10, i32 -5)
%17 = mul nsw i32 2, %16
%18 = sitofp i32 %17 to double
%19 = load double, double* %4
%20 = call double @llvm.fmuladd.f64(double %18, double %19, double 7.500000e-01)
store double %20, double* %8
%21 = load double, double* %5
%22 = call double @k_exo(double %21)
store double %22, double* %9
%23 = load double, double* %8
%24 = load double, double* %9
%25 = fmul double %23, %24
%26 = load double, double* %6
%27 = fmul double %26, 0x400921FB5A7ED197
%28 = fdiv double %27, 1.800000e+02
%29 = call double @cos(double %28)
%30 = fmul double %25, %29
%31 = load double, double* %7
%32 = load double, double* %7
%33 = fmul double %31, %32
%34 = fdiv double %30, %33
ret double %34
}

LLVM IR (-O2):
define double @k_in(double %0, double %1, double %2) {
%4 = fadd double %1, -4.000000e+00
%5 = fmul double %4, 0x401921FB5A7ED197
%6 = fdiv double %5, 3.650000e+02
%7 = tail call double @cos(double %6)
%8 = tail call i32 @pow(i32 10, i32 -5)
%9 = shl nsw i32 %8, 1
%10 = sitofp i32 %9 to double
%11 = insertelement <2 x double> poison, double %10, i64 0
%12 = insertelement <2 x double> %11, double %7, i64 1
%13 = insertelement <2 x double> <double poison, double -1.672000e-02>, double %0, i64 0
%14 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %12, <2 x double> %13, <2 x double> <double 7.500000e-01, double 1.000000e+00>)
%15 = tail call double @k_exo(double %1)
%16 = fmul double %2, 0x400921FB5A7ED197
%17 = fdiv double %16, 1.800000e+02
%18 = tail call double @cos(double %17)
%19 = insertelement <2 x double> %14, double %15, i64 0
%20 = fmul <2 x double> %19, %14
%21 = extractelement <2 x double> %20, i64 0
%22 = fmul double %18, %21
%23 = extractelement <2 x double> %20, i64 1
%24 = fdiv double %22, %23
ret double %24
}