#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 DBL_EPSILON;
double M_PI;
double acos(double);
double asin(double);
double cos(double);
double fabs(double);
double sin(double);
scalar_t__ sunmodel_atmo_refraction_correction(double);
void sunmodel_ae_0(double slat, double slon, double lat, double lon,
                   double *azm, double *elv, char use_arc) {
  double azimuth;
  double omega, csz, elevation, az_denom;
  double sinlat, coslat, sinslat, cosslat;
  omega = lon - slon;
  sinlat = sin(lat);
  coslat = cos(lat);
  sinslat = sin(slat);
  cosslat = cos(slat);
  csz = sinlat * sinslat + coslat * cosslat * cos(omega);
  if (csz > 1.0) {
    csz = 1.0;
  } else {
    if (csz < -1.0) {
      csz = -1.0;
    }
  }
  elevation = asin(csz);
  az_denom = coslat * cos(elevation);
  if (fabs(az_denom) > DBL_EPSILON) {
    azimuth = (sinlat * csz - sinslat) / az_denom;
    if (fabs(azimuth) > 1.0) {
      if (azimuth < 0.0) {
        azimuth = -1.0;
      } else {
        azimuth = 1.0;
      }
    }
    azimuth = M_PI - acos(azimuth);
    if (omega > 0.0) {
      azimuth = -azimuth;
    }
  } else {
    if (lat > 0.0) {
      azimuth = M_PI;
    } else {
      azimuth = 0.0;
    }
  }
  if (azimuth < 0.0) {
    azimuth += 2.0 * M_PI;
  }
  if (use_arc == 1 || use_arc == 'y') {
    elevation += sunmodel_atmo_refraction_correction(elevation);
  }
  if (azm != NULL) {
    (*azm) = azimuth;
  }
  if (elv != NULL) {
    (*elv) = elevation;
  }
}


x86 assembly (clang, -O0):
<sunmodel_ae_0>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %dl,%al
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
mov    %rdi,-0x28(%rbp)
mov    %rsi,-0x30(%rbp)
mov    %al,-0x31(%rbp)
movsd  -0x20(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1050 <sin@plt>
movsd  %xmm0,-0x68(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1070 <cos@plt>
movsd  %xmm0,-0x70(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1050 <sin@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1070 <cos@plt>
movsd  %xmm0,-0x80(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x70(%rbp),%xmm0
mulsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
call   1070 <cos@plt>
movsd  -0x98(%rbp),%xmm1
ff
movsd  -0x90(%rbp),%xmm2
ff
movaps %xmm0,%xmm3
movsd  -0x88(%rbp),%xmm0
ff
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  0xdca(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1252 <sunmodel_ae_0+0x102>
movsd  0xdb8(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    1277 <sunmodel_ae_0+0x127>
movsd  0xdae(%rip),%xmm0
ucomisd -0x50(%rbp),%xmm0
jbe    1272 <sunmodel_ae_0+0x122>
movsd  0xd9b(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    1277 <sunmodel_ae_0+0x127>
movsd  -0x50(%rbp),%xmm0
call   1060 <asin@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x58(%rbp),%xmm0
call   1070 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0xa0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
movaps 0xd53(%rip),%xmm1
pand   %xmm1,%xmm0
mov    0x2d18(%rip),%rax
ucomisd (%rax),%xmm0
jbe    13c7 <sunmodel_ae_0+0x277>
movsd  -0x68(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x78(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
divsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
movaps 0xcfa(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xcde(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    135e <sunmodel_ae_0+0x20e>
xorps  %xmm0,%xmm0
ucomisd -0x40(%rbp),%xmm0
jbe    134c <sunmodel_ae_0+0x1fc>
movsd  0xcc6(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    1359 <sunmodel_ae_0+0x209>
movsd  0xcac(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    135e <sunmodel_ae_0+0x20e>
mov    0x2c83(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x40(%rbp),%xmm0
call   1030 <acos@plt>
movaps %xmm0,%xmm1
movsd  -0xa8(%rbp),%xmm0
ff
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x48(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    13c2 <sunmodel_ae_0+0x272>
movsd  -0x40(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    13fb <sunmodel_ae_0+0x2ab>
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    13ee <sunmodel_ae_0+0x29e>
mov    0x2c08(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    13f6 <sunmodel_ae_0+0x2a6>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    13fb <sunmodel_ae_0+0x2ab>
xorps  %xmm0,%xmm0
ucomisd -0x40(%rbp),%xmm0
jbe    1426 <sunmodel_ae_0+0x2d6>
mov    0x2bd8(%rip),%rax
movsd  (%rax),%xmm0
movsd  -0x40(%rbp),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsbl -0x31(%rbp),%eax
cmp    $0x1,%eax
je     1440 <sunmodel_ae_0+0x2f0>
movsbl -0x31(%rbp),%eax
cmp    $0x79,%eax
jne    1459 <sunmodel_ae_0+0x309>
movsd  -0x58(%rbp),%xmm0
call   1040 <sunmodel_atmo_refraction_correction@plt>
cvtsi2sd %rax,%xmm0
addsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1471 <sunmodel_ae_0+0x321>
movsd  -0x40(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
cmpq   $0x0,-0x30(%rbp)
je     1489 <sunmodel_ae_0+0x339>
movsd  -0x58(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sunmodel_ae_0>:
push   %rbp
push   %r14
push   %rbx
sub    $0x60,%rsp
mov    %edx,%ebp
mov    %rsi,%r14
mov    %rdi,%rbx
movsd  %xmm2,0x28(%rsp)
movsd  %xmm0,0x8(%rsp)
subsd  %xmm1,%xmm3
movsd  %xmm3,0x30(%rsp)
movapd %xmm2,%xmm0
call   1050 <sin@plt>
movapd %xmm0,0x50(%rsp)
movsd  0x28(%rsp),%xmm0
call   1070 <cos@plt>
movaps %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1050 <sin@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0x8(%rsp),%xmm0
call   1070 <cos@plt>
mulsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x30(%rsp),%xmm0
call   1070 <cos@plt>
mulsd  0x8(%rsp),%xmm0
movapd 0x50(%rsp),%xmm1
mulsd  0x20(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  0xe1a(%rip),%xmm0
ucomisd %xmm0,%xmm1
ja     1202 <sunmodel_ae_0+0xb2>
movsd  0xe14(%rip),%xmm2
ucomisd %xmm1,%xmm2
movapd %xmm1,%xmm0
jbe    1202 <sunmodel_ae_0+0xb2>
movapd %xmm2,%xmm0
movsd  %xmm0,0x48(%rsp)
call   1060 <asin@plt>
movsd  %xmm0,0x8(%rsp)
call   1070 <cos@plt>
movapd 0x10(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movapd 0xdf6(%rip),%xmm0
andpd  %xmm1,%xmm0
mov    0x2dab(%rip),%rax
ucomisd (%rax),%xmm0
jbe    12cd <sunmodel_ae_0+0x17d>
movapd 0x50(%rsp),%xmm3
mulsd  0x48(%rsp),%xmm3
subsd  0x20(%rsp),%xmm3
divsd  %xmm1,%xmm3
xorpd  %xmm0,%xmm0
xor    %eax,%eax
ucomisd %xmm3,%xmm0
seta   %al
movapd 0xdb6(%rip),%xmm1
andpd  %xmm3,%xmm1
lea    0xdbb(%rip),%rcx
movsd  (%rcx,%rax,8),%xmm2
movsd  0xd7e(%rip),%xmm0
cmpltsd %xmm1,%xmm0
andpd  %xmm0,%xmm2
andnpd %xmm3,%xmm0
orpd   %xmm2,%xmm0
mov    0x2d4e(%rip),%rax
movsd  (%rax),%xmm1
movapd %xmm1,0x10(%rsp)
call   1030 <acos@plt>
movapd 0x10(%rsp),%xmm2
subsd  %xmm0,%xmm2
movsd  0x30(%rsp),%xmm0
ucomisd 0xd4f(%rip),%xmm0
jbe    12e8 <sunmodel_ae_0+0x198>
xorpd  0xd75(%rip),%xmm2
jmp    12e8 <sunmodel_ae_0+0x198>
xorpd  %xmm2,%xmm2
movsd  0x28(%rsp),%xmm0
ucomisd %xmm2,%xmm0
jbe    12e8 <sunmodel_ae_0+0x198>
mov    0x2d04(%rip),%rax
movsd  (%rax),%xmm2
mov    0x2cf9(%rip),%rax
movsd  (%rax),%xmm3
cmp    $0x79,%bpl
je     12ff <sunmodel_ae_0+0x1af>
cmp    $0x1,%bpl
jne    133a <sunmodel_ae_0+0x1ea>
movsd  0x8(%rsp),%xmm0
movapd %xmm2,0x10(%rsp)
movapd %xmm3,0x30(%rsp)
call   1040 <sunmodel_atmo_refraction_correction@plt>
movapd 0x30(%rsp),%xmm3
movapd 0x10(%rsp),%xmm2
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  0x8(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
test   %rbx,%rbx
je     1364 <sunmodel_ae_0+0x214>
addsd  %xmm3,%xmm3
xorpd  %xmm0,%xmm0
addsd  %xmm2,%xmm3
movapd %xmm2,%xmm1
cmpltsd %xmm0,%xmm1
andpd  %xmm1,%xmm3
andnpd %xmm2,%xmm1
orpd   %xmm3,%xmm1
movsd  %xmm1,(%rbx)
test   %r14,%r14
je     1374 <sunmodel_ae_0+0x224>
movsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%r14)
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@DBL_EPSILON = global double 0.000000e+00
@M_PI = global double 0.000000e+00
define void @sunmodel_ae_0(double %0, double %1, double %2, double %3, double* %4, double* %5, i8 signext %6) {
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double*
%13 = alloca double*
%14 = alloca i8
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca double
store double %0, double* %8
store double %1, double* %9
store double %2, double* %10
store double %3, double* %11
store double* %4, double** %12
store double* %5, double** %13
store i8 %6, i8* %14
%24 = load double, double* %11
%25 = load double, double* %9
%26 = fsub double %24, %25
store double %26, double* %16
%27 = load double, double* %10
%28 = call double @sin(double %27)
store double %28, double* %20
%29 = load double, double* %10
%30 = call double @cos(double %29)
store double %30, double* %21
%31 = load double, double* %8
%32 = call double @sin(double %31)
store double %32, double* %22
%33 = load double, double* %8
%34 = call double @cos(double %33)
store double %34, double* %23
%35 = load double, double* %20
%36 = load double, double* %22
%37 = load double, double* %21
%38 = load double, double* %23
%39 = fmul double %37, %38
%40 = load double, double* %16
%41 = call double @cos(double %40)
%42 = fmul double %39, %41
%43 = call double @llvm.fmuladd.f64(double %35, double %36, double %42)
store double %43, double* %17
%44 = load double, double* %17
%45 = fcmp ogt double %44, 1.000000e+00
br i1 %45, label %46, label %47
46: ; preds = %7
store double 1.000000e+00, double* %17
br label %52
47: ; preds = %7
%48 = load double, double* %17
%49 = fcmp olt double %48, -1.000000e+00
br i1 %49, label %50, label %51
50: ; preds = %47
store double -1.000000e+00, double* %17
br label %51
51: ; preds = %50, %47
br label %52
52: ; preds = %51, %46
%53 = load double, double* %17
%54 = call double @asin(double %53)
store double %54, double* %18
%55 = load double, double* %21
%56 = load double, double* %18
%57 = call double @cos(double %56)
%58 = fmul double %55, %57
store double %58, double* %19
%59 = load double, double* %19
%60 = call double @llvm.fabs.f64(double %59)
%61 = load double, double* @DBL_EPSILON
%62 = fcmp ogt double %60, %61
br i1 %62, label %63, label %91
63: ; preds = %52
%64 = load double, double* %20
%65 = load double, double* %17
%66 = load double, double* %22
%67 = fneg double %66
%68 = call double @llvm.fmuladd.f64(double %64, double %65, double %67)
%69 = load double, double* %19
%70 = fdiv double %68, %69
store double %70, double* %15
%71 = load double, double* %15
%72 = call double @llvm.fabs.f64(double %71)
%73 = fcmp ogt double %72, 1.000000e+00
br i1 %73, label %74, label %80
74: ; preds = %63
%75 = load double, double* %15
%76 = fcmp olt double %75, 0.000000e+00
br i1 %76, label %77, label %78
77: ; preds = %74
store double -1.000000e+00, double* %15
br label %79
78: ; preds = %74
store double 1.000000e+00, double* %15
br label %79
79: ; preds = %78, %77
br label %80
80: ; preds = %79, %63
%81 = load double, double* @M_PI
%82 = load double, double* %15
%83 = call double @acos(double %82)
%84 = fsub double %81, %83
store double %84, double* %15
%85 = load double, double* %16
%86 = fcmp ogt double %85, 0.000000e+00
br i1 %86, label %87, label %90
87: ; preds = %80
%88 = load double, double* %15
%89 = fneg double %88
store double %89, double* %15
br label %90
90: ; preds = %87, %80
br label %98
91: ; preds = %52
%92 = load double, double* %10
%93 = fcmp ogt double %92, 0.000000e+00
br i1 %93, label %94, label %96
94: ; preds = %91
%95 = load double, double* @M_PI
store double %95, double* %15
br label %97
96: ; preds = %91
store double 0.000000e+00, double* %15
br label %97
97: ; preds = %96, %94
br label %98
98: ; preds = %97, %90
%99 = load double, double* %15
%100 = fcmp olt double %99, 0.000000e+00
br i1 %100, label %101, label %105
101: ; preds = %98
%102 = load double, double* @M_PI
%103 = load double, double* %15
%104 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %102, double %103)
store double %104, double* %15
br label %105
105: ; preds = %101, %98
%106 = load i8, i8* %14
%107 = sext i8 %106 to i32
%108 = icmp eq i32 %107, 1
br i1 %108, label %113, label %109
109: ; preds = %105
%110 = load i8, i8* %14
%111 = sext i8 %110 to i32
%112 = icmp eq i32 %111, 121
br i1 %112, label %113, label %119
113: ; preds = %109, %105
%114 = load double, double* %18
%115 = call i64 @sunmodel_atmo_refraction_correction(double %114)
%116 = sitofp i64 %115 to double
%117 = load double, double* %18
%118 = fadd double %117, %116
store double %118, double* %18
br label %119
119: ; preds = %113, %109
%120 = load double*, double** %12
%121 = icmp ne double* %120, null
br i1 %121, label %122, label %125
122: ; preds = %119
%123 = load double, double* %15
%124 = load double*, double** %12
store double %123, double* %124
br label %125
125: ; preds = %122, %119
%126 = load double*, double** %13
%127 = icmp ne double* %126, null
br i1 %127, label %128, label %131
128: ; preds = %125
%129 = load double, double* %18
%130 = load double*, double** %13
store double %129, double* %130
br label %131
131: ; preds = %128, %125
ret void
}

LLVM IR (-O2):
@DBL_EPSILON = global double 0.000000e+00
@M_PI = global double 0.000000e+00
define void @sunmodel_ae_0(double %0, double %1, double %2, double %3, double* writeonly %4, double* writeonly %5, i8 signext %6) {
%8 = fsub double %3, %1
%9 = tail call double @sin(double %2)
%10 = tail call double @cos(double %2)
%11 = tail call double @sin(double %0)
%12 = tail call double @cos(double %0)
%13 = fmul double %10, %12
%14 = tail call double @cos(double %8)
%15 = fmul double %13, %14
%16 = tail call double @llvm.fmuladd.f64(double %9, double %11, double %15)
%17 = fcmp ogt double %16, 1.000000e+00
br i1 %17, label %21, label %18
18: ; preds = %7
%19 = fcmp olt double %16, -1.000000e+00
br i1 %19, label %20, label %21
20: ; preds = %18
br label %21
21: ; preds = %7, %18, %20
%22 = phi double [ -1.000000e+00, %20 ], [ %16, %18 ], [ 1.000000e+00, %7 ]
%23 = tail call double @asin(double %22)
%24 = tail call double @cos(double %23)
%25 = fmul double %10, %24
%26 = tail call double @llvm.fabs.f64(double %25)
%27 = load double, double* @DBL_EPSILON
%28 = fcmp ogt double %26, %27
br i1 %28, label %29, label %44
29: ; preds = %21
%30 = fneg double %11
%31 = tail call double @llvm.fmuladd.f64(double %9, double %22, double %30)
%32 = fdiv double %31, %25
%33 = tail call double @llvm.fabs.f64(double %32)
%34 = fcmp ogt double %33, 1.000000e+00
%35 = fcmp olt double %32, 0.000000e+00
%36 = select i1 %35, double -1.000000e+00, double 1.000000e+00
%37 = select i1 %34, double %36, double %32
%38 = load double, double* @M_PI
%39 = tail call double @acos(double %37)
%40 = fsub double %38, %39
%41 = fcmp ogt double %8, 0.000000e+00
br i1 %41, label %42, label %48
42: ; preds = %29
%43 = fneg double %40
br label %48
44: ; preds = %21
%45 = fcmp ogt double %2, 0.000000e+00
br i1 %45, label %46, label %48
46: ; preds = %44
%47 = load double, double* @M_PI
br label %48
48: ; preds = %44, %46, %29, %42
%49 = phi double [ %43, %42 ], [ %40, %29 ], [ %47, %46 ], [ 0.000000e+00, %44 ]
%50 = fcmp olt double %49, 0.000000e+00
%51 = load double, double* @M_PI
%52 = tail call double @llvm.fmuladd.f64(double %51, double 2.000000e+00, double %49)
%53 = select i1 %50, double %52, double %49
switch i8 %6, label %58 [
i8 121, label %54
i8 1, label %54
]
54: ; preds = %48, %48
%55 = tail call i64 @sunmodel_atmo_refraction_correction(double %23)
%56 = sitofp i64 %55 to double
%57 = fadd double %23, %56
br label %58
58: ; preds = %48, %54
%59 = phi double [ %57, %54 ], [ %23, %48 ]
%60 = icmp eq double* %4, null
br i1 %60, label %62, label %61
61: ; preds = %58
store double %53, double* %4
br label %62
62: ; preds = %61, %58
%63 = icmp eq double* %5, null
br i1 %63, label %65, label %64
64: ; preds = %62
store double %59, double* %5
br label %65
65: ; preds = %64, %62
ret void
}