#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(int);
double pow(double, int);
double k_exo(double doy) {
  double Kexo, kexo_mean, r_prime_es, phi, dr;
  r_prime_es = 1.495978706916 * pow(10, 11);
  phi = 3.9 * pow(10, 26);
  kexo_mean = phi / (4 * 3.1415927 * pow(r_prime_es, 2));
  dr = 1 + 0.033 * cos(2 * 3.1415927 * doy / 365);
  Kexo = kexo_mean * (pow(r_prime_es, 2)) / (pow(dr * r_prime_es, 2));
  return Kexo;
}


x86 assembly (clang, -O0):
<k_exo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xefb(%rip),%xmm0
mov    $0xb,%edi
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  0xeee(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xed5(%rip),%xmm0
mov    $0x1a,%edi
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  0xeb8(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
movaps %xmm0,%xmm2
movsd  -0x48(%rbp),%xmm0
movsd  0xe7e(%rip),%xmm1
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe61(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  0xe4c(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <cos@plt>
movsd  0xe27(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe23(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<k_exo>:
sub    $0x18,%rsp
movsd  %xmm0,0x8(%rsp)
movsd  0xece(%rip),%xmm0
mov    $0xb,%edi
call   1040 <pow@plt>
mulsd  0xec4(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0xeae(%rip),%xmm0
mov    $0x1a,%edi
call   1040 <pow@plt>
mulsd  0xeac(%rip),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x10(%rsp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mulsd  0xe97(%rip),%xmm0
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movsd  0x8(%rsp),%xmm0
mulsd  0xe83(%rip),%xmm0
divsd  0xe83(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <cos@plt>
mulsd  0xe7a(%rip),%xmm0
addsd  0xe7a(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
mulsd  0x10(%rsp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @k_exo(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %2
%8 = call double @pow(double 1.000000e+01, i32 11)
%9 = fmul double 0x3FF7EF875E5B7726, %8
store double %9, double* %5
%10 = call double @pow(double 1.000000e+01, i32 26)
%11 = fmul double 3.900000e+00, %10
store double %11, double* %6
%12 = load double, double* %6
%13 = load double, double* %5
%14 = call double @pow(double %13, i32 2)
%15 = fmul double 0x402921FB5A7ED197, %14
%16 = fdiv double %12, %15
store double %16, double* %4
%17 = load double, double* %2
%18 = fmul double 0x401921FB5A7ED197, %17
%19 = fdiv double %18, 3.650000e+02
%20 = fptosi double %19 to i32
%21 = call double @cos(i32 %20)
%22 = call double @llvm.fmuladd.f64(double 3.300000e-02, double %21, double 1.000000e+00)
store double %22, double* %7
%23 = load double, double* %4
%24 = load double, double* %5
%25 = call double @pow(double %24, i32 2)
%26 = fmul double %23, %25
%27 = load double, double* %7
%28 = load double, double* %5
%29 = fmul double %27, %28
%30 = call double @pow(double %29, i32 2)
%31 = fdiv double %26, %30
store double %31, double* %3
%32 = load double, double* %3
ret double %32
}

LLVM IR (-O2):
define double @k_exo(double %0) {
%2 = tail call double @pow(double 1.000000e+01, i32 11)
%3 = fmul double %2, 0x3FF7EF875E5B7726
%4 = tail call double @pow(double 1.000000e+01, i32 26)
%5 = fmul double %4, 3.900000e+00
%6 = tail call double @pow(double %3, i32 2)
%7 = fmul double %6, 0x402921FB5A7ED197
%8 = fdiv double %5, %7
%9 = fmul double %0, 0x401921FB5A7ED197
%10 = fdiv double %9, 3.650000e+02
%11 = fptosi double %10 to i32
%12 = tail call double @cos(i32 %11)
%13 = tail call double @llvm.fmuladd.f64(double %12, double 3.300000e-02, double 1.000000e+00)
%14 = tail call double @pow(double %3, i32 2)
%15 = fmul double %8, %14
%16 = fmul double %3, %13
%17 = tail call double @pow(double %16, i32 2)
%18 = fdiv double %15, %17
ret double %18
}