; 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"

@PE_TERMS = external dso_local constant [63 x [4 x double]], align 16

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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #2

; Function Attrs: nounwind
declare double @cos(double noundef) #3

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

; Function Attrs: nounwind uwtable
define dso_local void @nutation_longitude_and_obliquity(double noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #0 {
  %5 = alloca double, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  store double %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !9
  store ptr %3, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  store double 0.000000e+00, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  store double 0.000000e+00, ptr %12, align 8, !tbaa !5
  store i32 0, ptr %9, align 4, !tbaa !11
  br label %13

13:                                               ; preds = %53, %4
  %14 = load i32, ptr %9, align 4, !tbaa !11
  %15 = icmp slt i32 %14, 63
  br i1 %15, label %16, label %56

16:                                               ; preds = %13
  %17 = load i32, ptr %9, align 4, !tbaa !11
  %18 = load ptr, ptr %6, align 8, !tbaa !9
  %19 = call double @xy_term_summation(i32 noundef %17, ptr noundef %18)
  %20 = call double @deg2rad(double noundef %19)
  store double %20, ptr %10, align 8, !tbaa !5
  %21 = load i32, ptr %9, align 4, !tbaa !11
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [63 x [4 x double]], ptr @PE_TERMS, i64 0, i64 %22
  %24 = getelementptr inbounds [4 x double], ptr %23, i64 0, i64 0
  %25 = load double, ptr %24, align 16, !tbaa !5
  %26 = load double, ptr %5, align 8, !tbaa !5
  %27 = load i32, ptr %9, align 4, !tbaa !11
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [63 x [4 x double]], ptr @PE_TERMS, i64 0, i64 %28
  %30 = getelementptr inbounds [4 x double], ptr %29, i64 0, i64 1
  %31 = load double, ptr %30, align 8, !tbaa !5
  %32 = call double @llvm.fmuladd.f64(double %26, double %31, double %25)
  %33 = load double, ptr %10, align 8, !tbaa !5
  %34 = call double @sin(double noundef %33) #4
  %35 = load double, ptr %11, align 8, !tbaa !5
  %36 = call double @llvm.fmuladd.f64(double %32, double %34, double %35)
  store double %36, ptr %11, align 8, !tbaa !5
  %37 = load i32, ptr %9, align 4, !tbaa !11
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [63 x [4 x double]], ptr @PE_TERMS, i64 0, i64 %38
  %40 = getelementptr inbounds [4 x double], ptr %39, i64 0, i64 2
  %41 = load double, ptr %40, align 16, !tbaa !5
  %42 = load double, ptr %5, align 8, !tbaa !5
  %43 = load i32, ptr %9, align 4, !tbaa !11
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [63 x [4 x double]], ptr @PE_TERMS, i64 0, i64 %44
  %46 = getelementptr inbounds [4 x double], ptr %45, i64 0, i64 3
  %47 = load double, ptr %46, align 8, !tbaa !5
  %48 = call double @llvm.fmuladd.f64(double %42, double %47, double %41)
  %49 = load double, ptr %10, align 8, !tbaa !5
  %50 = call double @cos(double noundef %49) #4
  %51 = load double, ptr %12, align 8, !tbaa !5
  %52 = call double @llvm.fmuladd.f64(double %48, double %50, double %51)
  store double %52, ptr %12, align 8, !tbaa !5
  br label %53

53:                                               ; preds = %16
  %54 = load i32, ptr %9, align 4, !tbaa !11
  %55 = add nsw i32 %54, 1
  store i32 %55, ptr %9, align 4, !tbaa !11
  br label %13, !llvm.loop !13

56:                                               ; preds = %13
  %57 = load double, ptr %11, align 8, !tbaa !5
  %58 = fdiv double %57, 3.600000e+07
  %59 = load ptr, ptr %7, align 8, !tbaa !9
  store double %58, ptr %59, align 8, !tbaa !5
  %60 = load double, ptr %12, align 8, !tbaa !5
  %61 = fdiv double %60, 3.600000e+07
  %62 = load ptr, ptr %8, align 8, !tbaa !9
  store double %61, ptr %62, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  ret void
}

; Function Attrs: nounwind
declare double @sin(double noundef) #3

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" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { nounwind "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 #4 = { 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


; 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"

@PE_TERMS = external dso_local local_unnamed_addr constant [63 x [4 x double]], align 16

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @cos(double noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local void @nutation_longitude_and_obliquity(double noundef %0, ptr noundef %1, ptr nocapture noundef writeonly %2, ptr nocapture noundef writeonly %3) local_unnamed_addr #0 {
  %5 = insertelement <2 x double> poison, double %0, i64 0
  %6 = shufflevector <2 x double> %5, <2 x double> poison, <2 x i32> zeroinitializer
  br label %7

7:                                                ; preds = %4, %7
  %indvars.iv = phi i64 [ 0, %4 ], [ %indvars.iv.next, %7 ]
  %8 = phi <2 x double> [ zeroinitializer, %4 ], [ %29, %7 ]
  %9 = trunc nuw nsw i64 %indvars.iv to i32
  %10 = tail call double @xy_term_summation(i32 noundef %9, ptr noundef %1)
  %11 = tail call double @deg2rad(double noundef %10)
  %12 = getelementptr inbounds [63 x [4 x double]], ptr @PE_TERMS, i64 0, i64 %indvars.iv
  %13 = load double, ptr %12, align 16, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %12, i64 8
  %15 = load double, ptr %14, align 8, !tbaa !5
  %16 = tail call double @sin(double noundef %11) #3
  %17 = getelementptr inbounds i8, ptr %12, i64 16
  %18 = load double, ptr %17, align 16, !tbaa !5
  %19 = getelementptr inbounds i8, ptr %12, i64 24
  %20 = load double, ptr %19, align 8, !tbaa !5
  %21 = insertelement <2 x double> poison, double %20, i64 0
  %22 = insertelement <2 x double> %21, double %15, i64 1
  %23 = insertelement <2 x double> poison, double %18, i64 0
  %24 = insertelement <2 x double> %23, double %13, i64 1
  %25 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %6, <2 x double> %22, <2 x double> %24)
  %26 = tail call double @cos(double noundef %11) #3
  %27 = insertelement <2 x double> poison, double %26, i64 0
  %28 = insertelement <2 x double> %27, double %16, i64 1
  %29 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %25, <2 x double> %28, <2 x double> %8)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 63
  br i1 %exitcond.not, label %30, label %7, !llvm.loop !9

30:                                               ; preds = %7
  %31 = extractelement <2 x double> %29, i64 1
  %32 = fdiv double %31, 3.600000e+07
  store double %32, ptr %2, align 8, !tbaa !5
  %33 = extractelement <2 x double> %29, i64 0
  %34 = fdiv double %33, 3.600000e+07
  store double %34, ptr %3, align 8, !tbaa !5
  ret void
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sin(double noundef) local_unnamed_addr #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #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" }
attributes #1 = { mustprogress nofree nounwind willreturn memory(write) "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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalDCEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LoopRotatePass,LoopUnrollPass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass