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

@l_subcount = external dso_local constant [6 x i32], align 16
@L_TERMS = external dso_local constant <{ [64 x [3 x double]], <{ [34 x [3 x double]], [30 x [3 x double]] }>, <{ [20 x [3 x double]], [44 x [3 x double]] }>, <{ [3 x double], [3 x double], [3 x double], [3 x double], [3 x double], [3 x double], [3 x double], [57 x [3 x double]] }>, <{ [3 x double], [3 x double], [3 x double], [61 x [3 x double]] }>, <{ [3 x double], [63 x [3 x double]] }> }>, align 16

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

; Function Attrs: nounwind uwtable
declare dso_local double @limit_degrees(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: nounwind uwtable
declare dso_local double @earth_periodic_term_summation(ptr noundef, i32 noundef, double noundef) #0

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

; Function Attrs: nounwind uwtable
define dso_local double @earth_heliocentric_longitude(double noundef %0) #0 {
  %2 = alloca double, align 8
  %3 = alloca [6 x double], align 16
  %4 = alloca i32, align 4
  store double %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 48, ptr %3) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #2
  store i32 0, ptr %4, align 4, !tbaa !9
  br label %5

5:                                                ; preds = %22, %1
  %6 = load i32, ptr %4, align 4, !tbaa !9
  %7 = icmp slt i32 %6, 6
  br i1 %7, label %8, label %25

8:                                                ; preds = %5
  %9 = load i32, ptr %4, align 4, !tbaa !9
  %10 = sext i32 %9 to i64
  %11 = getelementptr inbounds [6 x [64 x [3 x double]]], ptr @L_TERMS, i64 0, i64 %10
  %12 = getelementptr inbounds [64 x [3 x double]], ptr %11, i64 0, i64 0
  %13 = load i32, ptr %4, align 4, !tbaa !9
  %14 = sext i32 %13 to i64
  %15 = getelementptr inbounds [6 x i32], ptr @l_subcount, i64 0, i64 %14
  %16 = load i32, ptr %15, align 4, !tbaa !9
  %17 = load double, ptr %2, align 8, !tbaa !5
  %18 = call double @earth_periodic_term_summation(ptr noundef %12, i32 noundef %16, double noundef %17)
  %19 = load i32, ptr %4, align 4, !tbaa !9
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [6 x double], ptr %3, i64 0, i64 %20
  store double %18, ptr %21, align 8, !tbaa !5
  br label %22

22:                                               ; preds = %8
  %23 = load i32, ptr %4, align 4, !tbaa !9
  %24 = add nsw i32 %23, 1
  store i32 %24, ptr %4, align 4, !tbaa !9
  br label %5, !llvm.loop !11

25:                                               ; preds = %5
  %26 = getelementptr inbounds [6 x double], ptr %3, i64 0, i64 0
  %27 = load double, ptr %2, align 8, !tbaa !5
  %28 = call double @earth_values(ptr noundef %26, i32 noundef 6, double noundef %27)
  %29 = call double @rad2deg(double noundef %28)
  %30 = call double @limit_degrees(double noundef %29)
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #2
  call void @llvm.lifetime.end.p0(i64 48, ptr %3) #2
  ret double %30
}

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 = { 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 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"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"

@l_subcount = external dso_local local_unnamed_addr constant [6 x i32], align 16
@L_TERMS = external dso_local constant <{ [64 x [3 x double]], <{ [34 x [3 x double]], [30 x [3 x double]] }>, <{ [20 x [3 x double]], [44 x [3 x double]] }>, <{ [3 x double], [3 x double], [3 x double], [3 x double], [3 x double], [3 x double], [3 x double], [57 x [3 x double]] }>, <{ [3 x double], [3 x double], [3 x double], [61 x [3 x double]] }>, <{ [3 x double], [63 x [3 x double]] }> }>, align 16

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

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local double @earth_heliocentric_longitude(double noundef %0) local_unnamed_addr #0 {
  %2 = alloca [6 x double], align 16
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %2) #2
  %3 = load i32, ptr @l_subcount, align 16, !tbaa !5
  %4 = tail call double @earth_periodic_term_summation(ptr noundef nonnull @L_TERMS, i32 noundef %3, double noundef %0)
  store double %4, ptr %2, align 16, !tbaa !9
  %5 = load i32, ptr getelementptr inbounds (i8, ptr @l_subcount, i64 4), align 4, !tbaa !5
  %6 = tail call double @earth_periodic_term_summation(ptr noundef nonnull getelementptr inbounds (i8, ptr @L_TERMS, i64 1536), i32 noundef %5, double noundef %0)
  %7 = getelementptr inbounds i8, ptr %2, i64 8
  store double %6, ptr %7, align 8, !tbaa !9
  %8 = load i32, ptr getelementptr inbounds (i8, ptr @l_subcount, i64 8), align 8, !tbaa !5
  %9 = tail call double @earth_periodic_term_summation(ptr noundef nonnull getelementptr inbounds (i8, ptr @L_TERMS, i64 3072), i32 noundef %8, double noundef %0)
  %10 = getelementptr inbounds i8, ptr %2, i64 16
  store double %9, ptr %10, align 16, !tbaa !9
  %11 = load i32, ptr getelementptr inbounds (i8, ptr @l_subcount, i64 12), align 4, !tbaa !5
  %12 = tail call double @earth_periodic_term_summation(ptr noundef nonnull getelementptr inbounds (i8, ptr @L_TERMS, i64 4608), i32 noundef %11, double noundef %0)
  %13 = getelementptr inbounds i8, ptr %2, i64 24
  store double %12, ptr %13, align 8, !tbaa !9
  %14 = load i32, ptr getelementptr inbounds (i8, ptr @l_subcount, i64 16), align 16, !tbaa !5
  %15 = tail call double @earth_periodic_term_summation(ptr noundef nonnull getelementptr inbounds (i8, ptr @L_TERMS, i64 6144), i32 noundef %14, double noundef %0)
  %16 = getelementptr inbounds i8, ptr %2, i64 32
  store double %15, ptr %16, align 16, !tbaa !9
  %17 = load i32, ptr getelementptr inbounds (i8, ptr @l_subcount, i64 20), align 4, !tbaa !5
  %18 = tail call double @earth_periodic_term_summation(ptr noundef nonnull getelementptr inbounds (i8, ptr @L_TERMS, i64 7680), i32 noundef %17, double noundef %0)
  %19 = getelementptr inbounds i8, ptr %2, i64 40
  store double %18, ptr %19, align 8, !tbaa !9
  %20 = call double @earth_values(ptr noundef nonnull %2, i32 noundef 6, double noundef %0)
  %21 = call double @rad2deg(double noundef %20)
  %22 = call double @limit_degrees(double noundef %21)
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %2) #2
  ret double %22
}

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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,SROAPass,SimplifyCFGPass,TailCallElimPass