; LLVM IR from venumb/ZSPACE :: cpp/depends/spa (spa)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.spa_data = type { i32, i32, i32, i32, i32, double, double, double, double, double, double, double, double, double, double, double, double, i32, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double }

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @validate_inputs(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local double @julian_day(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, double noundef, double noundef, double noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local double @observer_hour_angle(double noundef, double noundef, double noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local double @sun_equatorial_horizontal_parallax(double noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @right_ascension_parallax_and_topocentric_dec(double noundef, double noundef, double noundef, double noundef, double noundef, ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local double @topocentric_right_ascension(double noundef, double noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local double @topocentric_local_hour_angle(double noundef, double noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local double @topocentric_elevation_angle(double noundef, double noundef, double noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local double @atmospheric_refraction_correction(double noundef, double noundef, double noundef, double noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local double @topocentric_elevation_angle_corrected(double noundef, double noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local double @topocentric_zenith_angle(double noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local double @topocentric_azimuth_angle_astro(double noundef, double noundef, double noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local double @topocentric_azimuth_angle(double noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local double @surface_incidence_angle(double noundef, double noundef, double noundef, double noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @calculate_geocentric_sun_right_ascension_and_declination(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @calculate_eot_and_sun_rise_transit_set(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @spa_calculate(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #2
  %4 = load ptr, ptr %2, align 8, !tbaa !5
  %5 = call i32 @validate_inputs(ptr noundef %4)
  store i32 %5, ptr %3, align 4, !tbaa !9
  %6 = load i32, ptr %3, align 4, !tbaa !9
  %7 = icmp eq i32 %6, 0
  br i1 %7, label %8, label %190

8:                                                ; preds = %1
  %9 = load ptr, ptr %2, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.spa_data, ptr %9, i32 0, i32 0
  %11 = load i32, ptr %10, align 8, !tbaa !11
  %12 = load ptr, ptr %2, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.spa_data, ptr %12, i32 0, i32 1
  %14 = load i32, ptr %13, align 4, !tbaa !14
  %15 = load ptr, ptr %2, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.spa_data, ptr %15, i32 0, i32 2
  %17 = load i32, ptr %16, align 8, !tbaa !15
  %18 = load ptr, ptr %2, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.spa_data, ptr %18, i32 0, i32 3
  %20 = load i32, ptr %19, align 4, !tbaa !16
  %21 = load ptr, ptr %2, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.spa_data, ptr %21, i32 0, i32 4
  %23 = load i32, ptr %22, align 8, !tbaa !17
  %24 = load ptr, ptr %2, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.spa_data, ptr %24, i32 0, i32 5
  %26 = load double, ptr %25, align 8, !tbaa !18
  %27 = load ptr, ptr %2, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.spa_data, ptr %27, i32 0, i32 6
  %29 = load double, ptr %28, align 8, !tbaa !19
  %30 = load ptr, ptr %2, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.spa_data, ptr %30, i32 0, i32 8
  %32 = load double, ptr %31, align 8, !tbaa !20
  %33 = call double @julian_day(i32 noundef %11, i32 noundef %14, i32 noundef %17, i32 noundef %20, i32 noundef %23, double noundef %26, double noundef %29, double noundef %32)
  %34 = load ptr, ptr %2, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.spa_data, ptr %34, i32 0, i32 18
  store double %33, ptr %35, align 8, !tbaa !21
  %36 = load ptr, ptr %2, align 8, !tbaa !5
  call void @calculate_geocentric_sun_right_ascension_and_declination(ptr noundef %36)
  %37 = load ptr, ptr %2, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.spa_data, ptr %37, i32 0, i32 40
  %39 = load double, ptr %38, align 8, !tbaa !22
  %40 = load ptr, ptr %2, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.spa_data, ptr %40, i32 0, i32 9
  %42 = load double, ptr %41, align 8, !tbaa !23
  %43 = load ptr, ptr %2, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.spa_data, ptr %43, i32 0, i32 41
  %45 = load double, ptr %44, align 8, !tbaa !24
  %46 = call double @observer_hour_angle(double noundef %39, double noundef %42, double noundef %45)
  %47 = load ptr, ptr %2, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.spa_data, ptr %47, i32 0, i32 43
  store double %46, ptr %48, align 8, !tbaa !25
  %49 = load ptr, ptr %2, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.spa_data, ptr %49, i32 0, i32 25
  %51 = load double, ptr %50, align 8, !tbaa !26
  %52 = call double @sun_equatorial_horizontal_parallax(double noundef %51)
  %53 = load ptr, ptr %2, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.spa_data, ptr %53, i32 0, i32 44
  store double %52, ptr %54, align 8, !tbaa !27
  %55 = load ptr, ptr %2, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.spa_data, ptr %55, i32 0, i32 10
  %57 = load double, ptr %56, align 8, !tbaa !28
  %58 = load ptr, ptr %2, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.spa_data, ptr %58, i32 0, i32 11
  %60 = load double, ptr %59, align 8, !tbaa !29
  %61 = load ptr, ptr %2, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.spa_data, ptr %61, i32 0, i32 44
  %63 = load double, ptr %62, align 8, !tbaa !27
  %64 = load ptr, ptr %2, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.spa_data, ptr %64, i32 0, i32 43
  %66 = load double, ptr %65, align 8, !tbaa !25
  %67 = load ptr, ptr %2, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.spa_data, ptr %67, i32 0, i32 42
  %69 = load double, ptr %68, align 8, !tbaa !30
  %70 = load ptr, ptr %2, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.spa_data, ptr %70, i32 0, i32 45
  %72 = load ptr, ptr %2, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.spa_data, ptr %72, i32 0, i32 46
  call void @right_ascension_parallax_and_topocentric_dec(double noundef %57, double noundef %60, double noundef %63, double noundef %66, double noundef %69, ptr noundef %71, ptr noundef %73)
  %74 = load ptr, ptr %2, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.spa_data, ptr %74, i32 0, i32 41
  %76 = load double, ptr %75, align 8, !tbaa !24
  %77 = load ptr, ptr %2, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.spa_data, ptr %77, i32 0, i32 45
  %79 = load double, ptr %78, align 8, !tbaa !31
  %80 = call double @topocentric_right_ascension(double noundef %76, double noundef %79)
  %81 = load ptr, ptr %2, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.spa_data, ptr %81, i32 0, i32 47
  store double %80, ptr %82, align 8, !tbaa !32
  %83 = load ptr, ptr %2, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.spa_data, ptr %83, i32 0, i32 43
  %85 = load double, ptr %84, align 8, !tbaa !25
  %86 = load ptr, ptr %2, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.spa_data, ptr %86, i32 0, i32 45
  %88 = load double, ptr %87, align 8, !tbaa !31
  %89 = call double @topocentric_local_hour_angle(double noundef %85, double noundef %88)
  %90 = load ptr, ptr %2, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.spa_data, ptr %90, i32 0, i32 48
  store double %89, ptr %91, align 8, !tbaa !33
  %92 = load ptr, ptr %2, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.spa_data, ptr %92, i32 0, i32 10
  %94 = load double, ptr %93, align 8, !tbaa !28
  %95 = load ptr, ptr %2, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.spa_data, ptr %95, i32 0, i32 46
  %97 = load double, ptr %96, align 8, !tbaa !34
  %98 = load ptr, ptr %2, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.spa_data, ptr %98, i32 0, i32 48
  %100 = load double, ptr %99, align 8, !tbaa !33
  %101 = call double @topocentric_elevation_angle(double noundef %94, double noundef %97, double noundef %100)
  %102 = load ptr, ptr %2, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.spa_data, ptr %102, i32 0, i32 49
  store double %101, ptr %103, align 8, !tbaa !35
  %104 = load ptr, ptr %2, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.spa_data, ptr %104, i32 0, i32 12
  %106 = load double, ptr %105, align 8, !tbaa !36
  %107 = load ptr, ptr %2, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.spa_data, ptr %107, i32 0, i32 13
  %109 = load double, ptr %108, align 8, !tbaa !37
  %110 = load ptr, ptr %2, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.spa_data, ptr %110, i32 0, i32 16
  %112 = load double, ptr %111, align 8, !tbaa !38
  %113 = load ptr, ptr %2, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.spa_data, ptr %113, i32 0, i32 49
  %115 = load double, ptr %114, align 8, !tbaa !35
  %116 = call double @atmospheric_refraction_correction(double noundef %106, double noundef %109, double noundef %112, double noundef %115)
  %117 = load ptr, ptr %2, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.spa_data, ptr %117, i32 0, i32 50
  store double %116, ptr %118, align 8, !tbaa !39
  %119 = load ptr, ptr %2, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.spa_data, ptr %119, i32 0, i32 49
  %121 = load double, ptr %120, align 8, !tbaa !35
  %122 = load ptr, ptr %2, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.spa_data, ptr %122, i32 0, i32 50
  %124 = load double, ptr %123, align 8, !tbaa !39
  %125 = call double @topocentric_elevation_angle_corrected(double noundef %121, double noundef %124)
  %126 = load ptr, ptr %2, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.spa_data, ptr %126, i32 0, i32 51
  store double %125, ptr %127, align 8, !tbaa !40
  %128 = load ptr, ptr %2, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.spa_data, ptr %128, i32 0, i32 51
  %130 = load double, ptr %129, align 8, !tbaa !40
  %131 = call double @topocentric_zenith_angle(double noundef %130)
  %132 = load ptr, ptr %2, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.spa_data, ptr %132, i32 0, i32 56
  store double %131, ptr %133, align 8, !tbaa !41
  %134 = load ptr, ptr %2, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.spa_data, ptr %134, i32 0, i32 48
  %136 = load double, ptr %135, align 8, !tbaa !33
  %137 = load ptr, ptr %2, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.spa_data, ptr %137, i32 0, i32 10
  %139 = load double, ptr %138, align 8, !tbaa !28
  %140 = load ptr, ptr %2, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.spa_data, ptr %140, i32 0, i32 46
  %142 = load double, ptr %141, align 8, !tbaa !34
  %143 = call double @topocentric_azimuth_angle_astro(double noundef %136, double noundef %139, double noundef %142)
  %144 = load ptr, ptr %2, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.spa_data, ptr %144, i32 0, i32 57
  store double %143, ptr %145, align 8, !tbaa !42
  %146 = load ptr, ptr %2, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.spa_data, ptr %146, i32 0, i32 57
  %148 = load double, ptr %147, align 8, !tbaa !42
  %149 = call double @topocentric_azimuth_angle(double noundef %148)
  %150 = load ptr, ptr %2, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.spa_data, ptr %150, i32 0, i32 58
  store double %149, ptr %151, align 8, !tbaa !43
  %152 = load ptr, ptr %2, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.spa_data, ptr %152, i32 0, i32 17
  %154 = load i32, ptr %153, align 8, !tbaa !44
  %155 = icmp eq i32 %154, 1
  br i1 %155, label %161, label %156

156:                                              ; preds = %8
  %157 = load ptr, ptr %2, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.spa_data, ptr %157, i32 0, i32 17
  %159 = load i32, ptr %158, align 8, !tbaa !44
  %160 = icmp eq i32 %159, 3
  br i1 %160, label %161, label %177

161:                                              ; preds = %156, %8
  %162 = load ptr, ptr %2, align 8, !tbaa !5
  %163 = getelementptr inbounds %struct.spa_data, ptr %162, i32 0, i32 56
  %164 = load double, ptr %163, align 8, !tbaa !41
  %165 = load ptr, ptr %2, align 8, !tbaa !5
  %166 = getelementptr inbounds %struct.spa_data, ptr %165, i32 0, i32 57
  %167 = load double, ptr %166, align 8, !tbaa !42
  %168 = load ptr, ptr %2, align 8, !tbaa !5
  %169 = getelementptr inbounds %struct.spa_data, ptr %168, i32 0, i32 15
  %170 = load double, ptr %169, align 8, !tbaa !45
  %171 = load ptr, ptr %2, align 8, !tbaa !5
  %172 = getelementptr inbounds %struct.spa_data, ptr %171, i32 0, i32 14
  %173 = load double, ptr %172, align 8, !tbaa !46
  %174 = call double @surface_incidence_angle(double noundef %164, double noundef %167, double noundef %170, double noundef %173)
  %175 = load ptr, ptr %2, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct.spa_data, ptr %175, i32 0, i32 59
  store double %174, ptr %176, align 8, !tbaa !47
  br label %177

177:                                              ; preds = %161, %156
  %178 = load ptr, ptr %2, align 8, !tbaa !5
  %179 = getelementptr inbounds %struct.spa_data, ptr %178, i32 0, i32 17
  %180 = load i32, ptr %179, align 8, !tbaa !44
  %181 = icmp eq i32 %180, 2
  br i1 %181, label %187, label %182

182:                                              ; preds = %177
  %183 = load ptr, ptr %2, align 8, !tbaa !5
  %184 = getelementptr inbounds %struct.spa_data, ptr %183, i32 0, i32 17
  %185 = load i32, ptr %184, align 8, !tbaa !44
  %186 = icmp eq i32 %185, 3
  br i1 %186, label %187, label %189

187:                                              ; preds = %182, %177
  %188 = load ptr, ptr %2, align 8, !tbaa !5
  call void @calculate_eot_and_sun_rise_transit_set(ptr noundef %188)
  br label %189

189:                                              ; preds = %187, %182
  br label %190

190:                                              ; preds = %189, %1
  %191 = load i32, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #2
  ret i32 %191
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !13, i64 24, !13, i64 32, !13, i64 40, !13, i64 48, !13, i64 56, !13, i64 64, !13, i64 72, !13, i64 80, !13, i64 88, !13, i64 96, !13, i64 104, !13, i64 112, !10, i64 120, !13, i64 128, !13, i64 136, !13, i64 144, !13, i64 152, !13, i64 160, !13, i64 168, !13, i64 176, !13, i64 184, !13, i64 192, !13, i64 200, !13, i64 208, !13, i64 216, !13, i64 224, !13, i64 232, !13, i64 240, !13, i64 248, !13, i64 256, !13, i64 264, !13, i64 272, !13, i64 280, !13, i64 288, !13, i64 296, !13, i64 304, !13, i64 312, !13, i64 320, !13, i64 328, !13, i64 336, !13, i64 344, !13, i64 352, !13, i64 360, !13, i64 368, !13, i64 376, !13, i64 384, !13, i64 392, !13, i64 400, !13, i64 408, !13, i64 416, !13, i64 424, !13, i64 432, !13, i64 440, !13, i64 448, !13, i64 456, !13, i64 464, !13, i64 472, !13, i64 480}
!13 = !{!"double", !7, i64 0}
!14 = !{!12, !10, i64 4}
!15 = !{!12, !10, i64 8}
!16 = !{!12, !10, i64 12}
!17 = !{!12, !10, i64 16}
!18 = !{!12, !13, i64 24}
!19 = !{!12, !13, i64 32}
!20 = !{!12, !13, i64 48}
!21 = !{!12, !13, i64 128}
!22 = !{!12, !13, i64 304}
!23 = !{!12, !13, i64 56}
!24 = !{!12, !13, i64 312}
!25 = !{!12, !13, i64 328}
!26 = !{!12, !13, i64 184}
!27 = !{!12, !13, i64 336}
!28 = !{!12, !13, i64 64}
!29 = !{!12, !13, i64 72}
!30 = !{!12, !13, i64 320}
!31 = !{!12, !13, i64 344}
!32 = !{!12, !13, i64 360}
!33 = !{!12, !13, i64 368}
!34 = !{!12, !13, i64 352}
!35 = !{!12, !13, i64 376}
!36 = !{!12, !13, i64 80}
!37 = !{!12, !13, i64 88}
!38 = !{!12, !13, i64 112}
!39 = !{!12, !13, i64 384}
!40 = !{!12, !13, i64 392}
!41 = !{!12, !13, i64 432}
!42 = !{!12, !13, i64 440}
!43 = !{!12, !13, i64 448}
!44 = !{!12, !10, i64 120}
!45 = !{!12, !13, i64 104}
!46 = !{!12, !13, i64 96}
!47 = !{!12, !13, i64 456}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

; Function Attrs: nounwind uwtable
declare dso_local i32 @validate_inputs(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local double @julian_day(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, double noundef, double noundef, double noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local double @observer_hour_angle(double noundef, double noundef, double noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local double @sun_equatorial_horizontal_parallax(double noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @right_ascension_parallax_and_topocentric_dec(double noundef, double noundef, double noundef, double noundef, double noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local double @topocentric_right_ascension(double noundef, double noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local double @topocentric_local_hour_angle(double noundef, double noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local double @topocentric_elevation_angle(double noundef, double noundef, double noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local double @atmospheric_refraction_correction(double noundef, double noundef, double noundef, double noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local double @topocentric_elevation_angle_corrected(double noundef, double noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local double @topocentric_zenith_angle(double noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local double @topocentric_azimuth_angle_astro(double noundef, double noundef, double noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local double @topocentric_azimuth_angle(double noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local double @surface_incidence_angle(double noundef, double noundef, double noundef, double noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @calculate_geocentric_sun_right_ascension_and_declination(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @calculate_eot_and_sun_rise_transit_set(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local i32 @spa_calculate(ptr noundef %0) local_unnamed_addr #0 {
  %2 = tail call i32 @validate_inputs(ptr noundef %0)
  %3 = icmp eq i32 %2, 0
  br i1 %3, label %4, label %90

4:                                                ; preds = %1
  %5 = load i32, ptr %0, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 4
  %7 = load i32, ptr %6, align 4, !tbaa !11
  %8 = getelementptr inbounds i8, ptr %0, i64 8
  %9 = load i32, ptr %8, align 8, !tbaa !12
  %10 = getelementptr inbounds i8, ptr %0, i64 12
  %11 = load i32, ptr %10, align 4, !tbaa !13
  %12 = getelementptr inbounds i8, ptr %0, i64 16
  %13 = load i32, ptr %12, align 8, !tbaa !14
  %14 = getelementptr inbounds i8, ptr %0, i64 24
  %15 = load double, ptr %14, align 8, !tbaa !15
  %16 = getelementptr inbounds i8, ptr %0, i64 32
  %17 = load double, ptr %16, align 8, !tbaa !16
  %18 = getelementptr inbounds i8, ptr %0, i64 48
  %19 = load double, ptr %18, align 8, !tbaa !17
  %20 = tail call double @julian_day(i32 noundef %5, i32 noundef %7, i32 noundef %9, i32 noundef %11, i32 noundef %13, double noundef %15, double noundef %17, double noundef %19)
  %21 = getelementptr inbounds i8, ptr %0, i64 128
  store double %20, ptr %21, align 8, !tbaa !18
  tail call void @calculate_geocentric_sun_right_ascension_and_declination(ptr noundef nonnull %0)
  %22 = getelementptr inbounds i8, ptr %0, i64 304
  %23 = load double, ptr %22, align 8, !tbaa !19
  %24 = getelementptr inbounds i8, ptr %0, i64 56
  %25 = load double, ptr %24, align 8, !tbaa !20
  %26 = getelementptr inbounds i8, ptr %0, i64 312
  %27 = load double, ptr %26, align 8, !tbaa !21
  %28 = tail call double @observer_hour_angle(double noundef %23, double noundef %25, double noundef %27)
  %29 = getelementptr inbounds i8, ptr %0, i64 328
  store double %28, ptr %29, align 8, !tbaa !22
  %30 = getelementptr inbounds i8, ptr %0, i64 184
  %31 = load double, ptr %30, align 8, !tbaa !23
  %32 = tail call double @sun_equatorial_horizontal_parallax(double noundef %31)
  %33 = getelementptr inbounds i8, ptr %0, i64 336
  store double %32, ptr %33, align 8, !tbaa !24
  %34 = getelementptr inbounds i8, ptr %0, i64 64
  %35 = load double, ptr %34, align 8, !tbaa !25
  %36 = getelementptr inbounds i8, ptr %0, i64 72
  %37 = load double, ptr %36, align 8, !tbaa !26
  %38 = load double, ptr %29, align 8, !tbaa !22
  %39 = getelementptr inbounds i8, ptr %0, i64 320
  %40 = load double, ptr %39, align 8, !tbaa !27
  %41 = getelementptr inbounds i8, ptr %0, i64 344
  %42 = getelementptr inbounds i8, ptr %0, i64 352
  tail call void @right_ascension_parallax_and_topocentric_dec(double noundef %35, double noundef %37, double noundef %32, double noundef %38, double noundef %40, ptr noundef nonnull %41, ptr noundef nonnull %42)
  %43 = load double, ptr %26, align 8, !tbaa !21
  %44 = load double, ptr %41, align 8, !tbaa !28
  %45 = tail call double @topocentric_right_ascension(double noundef %43, double noundef %44)
  %46 = getelementptr inbounds i8, ptr %0, i64 360
  store double %45, ptr %46, align 8, !tbaa !29
  %47 = load double, ptr %29, align 8, !tbaa !22
  %48 = load double, ptr %41, align 8, !tbaa !28
  %49 = tail call double @topocentric_local_hour_angle(double noundef %47, double noundef %48)
  %50 = getelementptr inbounds i8, ptr %0, i64 368
  store double %49, ptr %50, align 8, !tbaa !30
  %51 = load double, ptr %34, align 8, !tbaa !25
  %52 = load double, ptr %42, align 8, !tbaa !31
  %53 = tail call double @topocentric_elevation_angle(double noundef %51, double noundef %52, double noundef %49)
  %54 = getelementptr inbounds i8, ptr %0, i64 376
  store double %53, ptr %54, align 8, !tbaa !32
  %55 = getelementptr inbounds i8, ptr %0, i64 80
  %56 = load double, ptr %55, align 8, !tbaa !33
  %57 = getelementptr inbounds i8, ptr %0, i64 88
  %58 = load double, ptr %57, align 8, !tbaa !34
  %59 = getelementptr inbounds i8, ptr %0, i64 112
  %60 = load double, ptr %59, align 8, !tbaa !35
  %61 = tail call double @atmospheric_refraction_correction(double noundef %56, double noundef %58, double noundef %60, double noundef %53)
  %62 = getelementptr inbounds i8, ptr %0, i64 384
  store double %61, ptr %62, align 8, !tbaa !36
  %63 = load double, ptr %54, align 8, !tbaa !32
  %64 = tail call double @topocentric_elevation_angle_corrected(double noundef %63, double noundef %61)
  %65 = getelementptr inbounds i8, ptr %0, i64 392
  store double %64, ptr %65, align 8, !tbaa !37
  %66 = tail call double @topocentric_zenith_angle(double noundef %64)
  %67 = getelementptr inbounds i8, ptr %0, i64 432
  store double %66, ptr %67, align 8, !tbaa !38
  %68 = load double, ptr %50, align 8, !tbaa !30
  %69 = load double, ptr %34, align 8, !tbaa !25
  %70 = load double, ptr %42, align 8, !tbaa !31
  %71 = tail call double @topocentric_azimuth_angle_astro(double noundef %68, double noundef %69, double noundef %70)
  %72 = getelementptr inbounds i8, ptr %0, i64 440
  store double %71, ptr %72, align 8, !tbaa !39
  %73 = tail call double @topocentric_azimuth_angle(double noundef %71)
  %74 = getelementptr inbounds i8, ptr %0, i64 448
  store double %73, ptr %74, align 8, !tbaa !40
  %75 = getelementptr inbounds i8, ptr %0, i64 120
  %76 = load i32, ptr %75, align 8, !tbaa !41
  switch i32 %76, label %86 [
    i32 1, label %77
    i32 3, label %77
  ]

77:                                               ; preds = %4, %4
  %78 = load double, ptr %67, align 8, !tbaa !38
  %79 = load double, ptr %72, align 8, !tbaa !39
  %80 = getelementptr inbounds i8, ptr %0, i64 104
  %81 = load double, ptr %80, align 8, !tbaa !42
  %82 = getelementptr inbounds i8, ptr %0, i64 96
  %83 = load double, ptr %82, align 8, !tbaa !43
  %84 = tail call double @surface_incidence_angle(double noundef %78, double noundef %79, double noundef %81, double noundef %83)
  %85 = getelementptr inbounds i8, ptr %0, i64 456
  store double %84, ptr %85, align 8, !tbaa !44
  %.pre = load i32, ptr %75, align 8, !tbaa !41
  br label %86

86:                                               ; preds = %4, %77
  %87 = phi i32 [ %76, %4 ], [ %.pre, %77 ]
  %88 = and i32 %87, -2
  %switch = icmp eq i32 %88, 2
  br i1 %switch, label %89, label %90

89:                                               ; preds = %86
  tail call void @calculate_eot_and_sun_rise_transit_set(ptr noundef nonnull %0)
  br label %90

90:                                               ; preds = %86, %89, %1
  ret i32 %2
}

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !7, i64 120, !10, i64 128, !10, i64 136, !10, i64 144, !10, i64 152, !10, i64 160, !10, i64 168, !10, i64 176, !10, i64 184, !10, i64 192, !10, i64 200, !10, i64 208, !10, i64 216, !10, i64 224, !10, i64 232, !10, i64 240, !10, i64 248, !10, i64 256, !10, i64 264, !10, i64 272, !10, i64 280, !10, i64 288, !10, i64 296, !10, i64 304, !10, i64 312, !10, i64 320, !10, i64 328, !10, i64 336, !10, i64 344, !10, i64 352, !10, i64 360, !10, i64 368, !10, i64 376, !10, i64 384, !10, i64 392, !10, i64 400, !10, i64 408, !10, i64 416, !10, i64 424, !10, i64 432, !10, i64 440, !10, i64 448, !10, i64 456, !10, i64 464, !10, i64 472, !10, i64 480}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"double", !8, i64 0}
!11 = !{!6, !7, i64 4}
!12 = !{!6, !7, i64 8}
!13 = !{!6, !7, i64 12}
!14 = !{!6, !7, i64 16}
!15 = !{!6, !10, i64 24}
!16 = !{!6, !10, i64 32}
!17 = !{!6, !10, i64 48}
!18 = !{!6, !10, i64 128}
!19 = !{!6, !10, i64 304}
!20 = !{!6, !10, i64 56}
!21 = !{!6, !10, i64 312}
!22 = !{!6, !10, i64 328}
!23 = !{!6, !10, i64 184}
!24 = !{!6, !10, i64 336}
!25 = !{!6, !10, i64 64}
!26 = !{!6, !10, i64 72}
!27 = !{!6, !10, i64 320}
!28 = !{!6, !10, i64 344}
!29 = !{!6, !10, i64 360}
!30 = !{!6, !10, i64 368}
!31 = !{!6, !10, i64 352}
!32 = !{!6, !10, i64 376}
!33 = !{!6, !10, i64 80}
!34 = !{!6, !10, i64 88}
!35 = !{!6, !10, i64 112}
!36 = !{!6, !10, i64 384}
!37 = !{!6, !10, i64 392}
!38 = !{!6, !10, i64 432}
!39 = !{!6, !10, i64 440}
!40 = !{!6, !10, i64 448}
!41 = !{!6, !7, i64 120}
!42 = !{!6, !10, i64 104}
!43 = !{!6, !10, i64 96}
!44 = !{!6, !10, i64 456}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass