#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 cos(double);
double k_exo(double);
int pow(int, int);
double sin(double);
int tan(double);
double k_in24(double latitude, double doy, double dem) {
  double tsw, ws, cosun, latrad, deltarad, ds;
  double Kexo;
  tsw = 0.75 + 2 * pow(10, -5) * dem;
  Kexo = k_exo(doy);
  ds = 1.0 + 0.01672 * sin(2 * 3.1415927 * (doy - 93.5) / 365.0);
  latrad = latitude * 3.1415927 / 180.0;
  deltarad = (0.4093 * sin((2 * 3.1415927 * doy / 365) - 1.39));
  ws = (acos(-tan(latrad) * tan(deltarad)));
  cosun = sin(deltarad) * sin(latrad) + cos(deltarad) * cos(latrad) * sin(ws);
  return (ws * cosun * Kexo * tsw) / (3.1415927 * ds * ds);
}


x86 assembly (clang, -O0):
<k_in24>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
mov    $0xa,%edi
mov    $0xfffffffb,%esi
call   1080 <pow@plt>
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  -0x18(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xea7(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <k_exo@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  0xe7a(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  0xe4e(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe3a(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1050 <sin@plt>
movsd  0xe41(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe3d(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xdf4(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  0xe0f(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xdf6(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  0xde1(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xdcd(%rip),%xmm1
subsd  %xmm1,%xmm0
call   1050 <sin@plt>
movaps %xmm0,%xmm1
movsd  0xdb1(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1060 <tan@plt>
mov    %eax,%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    %eax,-0x74(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1060 <tan@plt>
mov    -0x74(%rbp),%edi
imul   %eax,%edi
call   1040 <acos@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1050 <sin@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1050 <sin@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1070 <cos@plt>
movsd  %xmm0,-0x70(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1070 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1050 <sin@plt>
movsd  -0x68(%rbp),%xmm1
movsd  -0x60(%rbp),%xmm2
movaps %xmm0,%xmm3
movsd  -0x58(%rbp),%xmm0
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
mulsd  -0x50(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  0xce2(%rip),%xmm1
mulsd  -0x48(%rbp),%xmm1
mulsd  -0x48(%rbp),%xmm1
divsd  %xmm1,%xmm0
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<k_in24>:
push   %rbx
sub    $0x50,%rsp
movaps %xmm2,0x20(%rsp)
movsd  %xmm1,(%rsp)
movsd  %xmm0,0x8(%rsp)
mov    $0xa,%edi
mov    $0xfffffffb,%esi
call   1080 <pow@plt>
add    %eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movapd %xmm0,0x10(%rsp)
movsd  (%rsp),%xmm0
call   1030 <k_exo@plt>
movaps %xmm0,0x40(%rsp)
movsd  0xe56(%rip),%xmm0
addsd  (%rsp),%xmm0
mulsd  0xe51(%rip),%xmm0
divsd  0xe51(%rip),%xmm0
call   1050 <sin@plt>
movapd 0x20(%rsp),%xmm1
shufpd $0x2,0xe6d(%rip),%xmm1
movapd 0x10(%rsp),%xmm2
unpcklpd %xmm0,%xmm2
mulpd  %xmm2,%xmm1
addpd  0xe67(%rip),%xmm1
movapd %xmm1,0x20(%rsp)
movsd  0x8(%rsp),%xmm0
mulsd  0xe1b(%rip),%xmm0
divsd  0xe1b(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
mulsd  0xdf0(%rip),%xmm0
divsd  0xdf0(%rip),%xmm0
addsd  0xe00(%rip),%xmm0
call   1050 <sin@plt>
mulsd  0xdfb(%rip),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
call   1060 <tan@plt>
mov    %eax,%ebx
movsd  (%rsp),%xmm0
call   1060 <tan@plt>
imul   %eax,%ebx
neg    %ebx
mov    %ebx,%edi
call   1040 <acos@plt>
movsd  %xmm0,0x10(%rsp)
movsd  (%rsp),%xmm0
call   1050 <sin@plt>
movsd  %xmm0,0x38(%rsp)
movsd  0x8(%rsp),%xmm0
call   1050 <sin@plt>
movsd  %xmm0,0x30(%rsp)
movsd  (%rsp),%xmm0
call   1070 <cos@plt>
movsd  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
call   1070 <cos@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   1050 <sin@plt>
mulsd  0x8(%rsp),%xmm0
movsd  0x30(%rsp),%xmm1
mulsd  0x38(%rsp),%xmm1
addsd  %xmm1,%xmm0
mulsd  0x10(%rsp),%xmm0
movapd 0x40(%rsp),%xmm1
movapd 0x20(%rsp),%xmm2
shufpd $0x2,%xmm2,%xmm1
shufpd $0x2,0xd76(%rip),%xmm0
mulpd  %xmm1,%xmm0
mulpd  %xmm2,%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
divsd  %xmm1,%xmm0
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @k_in24(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%14 = call i32 @pow(i32 10, i32 -5)
%15 = mul nsw i32 2, %14
%16 = sitofp i32 %15 to double
%17 = load double, double* %6
%18 = call double @llvm.fmuladd.f64(double %16, double %17, double 7.500000e-01)
store double %18, double* %7
%19 = load double, double* %5
%20 = call double @k_exo(double %19)
store double %20, double* %13
%21 = load double, double* %5
%22 = fsub double %21, 9.350000e+01
%23 = fmul double 0x401921FB5A7ED197, %22
%24 = fdiv double %23, 3.650000e+02
%25 = call double @sin(double %24)
%26 = call double @llvm.fmuladd.f64(double 1.672000e-02, double %25, double 1.000000e+00)
store double %26, double* %12
%27 = load double, double* %4
%28 = fmul double %27, 0x400921FB5A7ED197
%29 = fdiv double %28, 1.800000e+02
store double %29, double* %10
%30 = load double, double* %5
%31 = fmul double 0x401921FB5A7ED197, %30
%32 = fdiv double %31, 3.650000e+02
%33 = fsub double %32, 1.390000e+00
%34 = call double @sin(double %33)
%35 = fmul double 4.093000e-01, %34
store double %35, double* %11
%36 = load double, double* %10
%37 = call i32 @tan(double %36)
%38 = sub nsw i32 0, %37
%39 = load double, double* %11
%40 = call i32 @tan(double %39)
%41 = mul nsw i32 %38, %40
%42 = call double @acos(i32 %41)
store double %42, double* %8
%43 = load double, double* %11
%44 = call double @sin(double %43)
%45 = load double, double* %10
%46 = call double @sin(double %45)
%47 = load double, double* %11
%48 = call double @cos(double %47)
%49 = load double, double* %10
%50 = call double @cos(double %49)
%51 = fmul double %48, %50
%52 = load double, double* %8
%53 = call double @sin(double %52)
%54 = fmul double %51, %53
%55 = call double @llvm.fmuladd.f64(double %44, double %46, double %54)
store double %55, double* %9
%56 = load double, double* %8
%57 = load double, double* %9
%58 = fmul double %56, %57
%59 = load double, double* %13
%60 = fmul double %58, %59
%61 = load double, double* %7
%62 = fmul double %60, %61
%63 = load double, double* %12
%64 = fmul double 0x400921FB5A7ED197, %63
%65 = load double, double* %12
%66 = fmul double %64, %65
%67 = fdiv double %62, %66
ret double %67
}

LLVM IR (-O2):
define double @k_in24(double %0, double %1, double %2) {
%4 = tail call i32 @pow(i32 10, i32 -5)
%5 = shl nsw i32 %4, 1
%6 = sitofp i32 %5 to double
%7 = tail call double @k_exo(double %1)
%8 = fadd double %1, -9.350000e+01
%9 = fmul double %8, 0x401921FB5A7ED197
%10 = fdiv double %9, 3.650000e+02
%11 = tail call double @sin(double %10)
%12 = insertelement <2 x double> poison, double %6, i64 0
%13 = insertelement <2 x double> %12, double %11, i64 1
%14 = insertelement <2 x double> <double poison, double 1.672000e-02>, double %2, i64 0
%15 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %13, <2 x double> %14, <2 x double> <double 7.500000e-01, double 1.000000e+00>)
%16 = fmul double %0, 0x400921FB5A7ED197
%17 = fdiv double %16, 1.800000e+02
%18 = fmul double %1, 0x401921FB5A7ED197
%19 = fdiv double %18, 3.650000e+02
%20 = fadd double %19, -1.390000e+00
%21 = tail call double @sin(double %20)
%22 = fmul double %21, 4.093000e-01
%23 = tail call i32 @tan(double %17)
%24 = tail call i32 @tan(double %22)
%25 = mul i32 %23, %24
%26 = sub i32 0, %25
%27 = tail call double @acos(i32 %26)
%28 = tail call double @sin(double %22)
%29 = tail call double @sin(double %17)
%30 = tail call double @cos(double %22)
%31 = tail call double @cos(double %17)
%32 = fmul double %30, %31
%33 = tail call double @sin(double %27)
%34 = fmul double %32, %33
%35 = tail call double @llvm.fmuladd.f64(double %28, double %29, double %34)
%36 = fmul double %27, %35
%37 = insertelement <2 x double> %15, double %7, i64 0
%38 = insertelement <2 x double> <double poison, double 0x400921FB5A7ED197>, double %36, i64 0
%39 = fmul <2 x double> %37, %38
%40 = fmul <2 x double> %15, %39
%41 = extractelement <2 x double> %40, i64 0
%42 = extractelement <2 x double> %40, i64 1
%43 = fdiv double %41, %42
ret double %43
}