; LLVM IR from USDA-ARS-ACSL/MAIZSIM :: Crop source/solar.ll (ZN6CSolar12SetSolarNoonEv)

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

%class.CSolar = type <{ i32, [4 x i8], 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, double, double, double, double, double, double, i8, i8, [6 x i8] }>

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_Z8DegToRadd(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: mustprogress uwtable
define dso_local void @_ZN6CSolar12SetSolarNoonEv(ptr noundef nonnull align 8 dereferenceable(418) %0) #2 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca double, align 8
  %4 = alloca double, align 8
  %5 = alloca double, align 8
  %6 = alloca double, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %7 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  store double 1.500000e+01, ptr %3, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %8 = getelementptr inbounds %class.CSolar, ptr %7, i32 0, i32 4
  %9 = load double, ptr %8, align 8, !tbaa !11
  %10 = fsub double 7.500000e+01, %9
  %11 = fmul double %10, 1.000000e+00
  %12 = fdiv double %11, 1.500000e+01
  store double %12, ptr %4, align 8, !tbaa !9
  %13 = getelementptr inbounds %class.CSolar, ptr %7, i32 0, i32 4
  %14 = load double, ptr %13, align 8, !tbaa !11
  %15 = call noundef double @_ZSt4fmodIdiEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(double noundef %14, i32 noundef 15)
  store double %15, ptr %4, align 8, !tbaa !9
  %16 = load double, ptr %4, align 8, !tbaa !9
  %17 = fmul double %16, -1.000000e+00
  %18 = fmul double %17, 1.000000e+00
  %19 = fdiv double %18, 1.500000e+01
  store double %19, ptr %4, align 8, !tbaa !9
  %20 = getelementptr inbounds %class.CSolar, ptr %7, i32 0, i32 0
  %21 = load i32, ptr %20, align 8, !tbaa !15
  %22 = sitofp i32 %21 to double
  %23 = call double @llvm.fmuladd.f64(double 9.856000e-01, double %22, double 2.795750e+02)
  %24 = call noundef double @_Z8DegToRadd(double noundef %23)
  store double %24, ptr %6, align 8, !tbaa !9
  %25 = load double, ptr %6, align 8, !tbaa !9
  %26 = call double @sin(double noundef %25) #5
  %27 = load double, ptr %6, align 8, !tbaa !9
  %28 = fmul double 2.000000e+00, %27
  %29 = call double @sin(double noundef %28) #5
  %30 = fmul double 5.962000e+02, %29
  %31 = call double @llvm.fmuladd.f64(double -1.047000e+02, double %26, double %30)
  %32 = load double, ptr %6, align 8, !tbaa !9
  %33 = fmul double 3.000000e+00, %32
  %34 = call double @sin(double noundef %33) #5
  %35 = call double @llvm.fmuladd.f64(double 4.300000e+00, double %34, double %31)
  %36 = load double, ptr %6, align 8, !tbaa !9
  %37 = fmul double 4.000000e+00, %36
  %38 = call double @sin(double noundef %37) #5
  %39 = call double @llvm.fmuladd.f64(double -1.270000e+01, double %38, double %35)
  %40 = load double, ptr %6, align 8, !tbaa !9
  %41 = call double @cos(double noundef %40) #5
  %42 = call double @llvm.fmuladd.f64(double -4.293000e+02, double %41, double %39)
  %43 = load double, ptr %6, align 8, !tbaa !9
  %44 = fmul double 2.000000e+00, %43
  %45 = call double @cos(double noundef %44) #5
  %46 = call double @llvm.fmuladd.f64(double -2.000000e+00, double %45, double %42)
  %47 = load double, ptr %6, align 8, !tbaa !9
  %48 = fmul double 3.000000e+00, %47
  %49 = call double @cos(double noundef %48) #5
  %50 = call double @llvm.fmuladd.f64(double 1.930000e+01, double %49, double %46)
  %51 = fdiv double %50, 3.600000e+03
  store double %51, ptr %5, align 8, !tbaa !9
  %52 = load double, ptr %4, align 8, !tbaa !9
  %53 = fsub double 1.200000e+01, %52
  %54 = load double, ptr %5, align 8, !tbaa !9
  %55 = fsub double %53, %54
  %56 = getelementptr inbounds %class.CSolar, ptr %7, i32 0, i32 9
  store double %55, ptr %56, align 8, !tbaa !16
  %57 = getelementptr inbounds %class.CSolar, ptr %7, i32 0, i32 9
  %58 = load double, ptr %57, align 8, !tbaa !16
  %59 = getelementptr inbounds %class.CSolar, ptr %7, i32 0, i32 14
  %60 = load double, ptr %59, align 8, !tbaa !17
  %61 = fsub double %58, %60
  %62 = getelementptr inbounds %class.CSolar, ptr %7, i32 0, i32 12
  store double %61, ptr %62, align 8, !tbaa !18
  %63 = getelementptr inbounds %class.CSolar, ptr %7, i32 0, i32 9
  %64 = load double, ptr %63, align 8, !tbaa !16
  %65 = getelementptr inbounds %class.CSolar, ptr %7, i32 0, i32 14
  %66 = load double, ptr %65, align 8, !tbaa !17
  %67 = fadd double %64, %66
  %68 = getelementptr inbounds %class.CSolar, ptr %7, i32 0, i32 13
  store double %67, ptr %68, align 8, !tbaa !19
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  ret void
}

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZSt4fmodIdiEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(double noundef, i32 noundef) #0

attributes #0 = { inlinehint mustprogress 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 = { mustprogress 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 #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!12, !10, i64 24}
!12 = !{!"_ZTS6CSolar", !13, i64 0, !10, i64 8, !10, 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, !10, 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, !14, i64 416, !14, i64 417}
!13 = !{!"int", !7, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{!12, !13, i64 0}
!16 = !{!12, !10, i64 64}
!17 = !{!12, !10, i64 104}
!18 = !{!12, !10, i64 88}
!19 = !{!12, !10, i64 96}


; 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_Z8DegToRadd(double noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN6CSolar12SetSolarNoonEv(ptr nocapture noundef nonnull align 8 dereferenceable(418) %0) local_unnamed_addr #1 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 24
  %3 = load double, ptr %2, align 8, !tbaa !5
  %4 = tail call noundef double @_ZSt4fmodIdiEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(double noundef %3, i32 noundef 15)
  %5 = fdiv double %4, 1.500000e+01
  %6 = load i32, ptr %0, align 8, !tbaa !12
  %7 = sitofp i32 %6 to double
  %8 = tail call double @llvm.fmuladd.f64(double %7, double 9.856000e-01, double 2.795750e+02)
  %9 = tail call noundef double @_Z8DegToRadd(double noundef %8)
  %10 = tail call double @sin(double noundef %9) #4
  %11 = fmul double %9, 2.000000e+00
  %12 = tail call double @sin(double noundef %11) #4
  %13 = fmul double %12, 5.962000e+02
  %14 = tail call double @llvm.fmuladd.f64(double %10, double -1.047000e+02, double %13)
  %15 = fmul double %9, 3.000000e+00
  %16 = tail call double @sin(double noundef %15) #4
  %17 = tail call double @llvm.fmuladd.f64(double %16, double 4.300000e+00, double %14)
  %18 = fmul double %9, 4.000000e+00
  %19 = tail call double @sin(double noundef %18) #4
  %20 = tail call double @llvm.fmuladd.f64(double %19, double -1.270000e+01, double %17)
  %21 = tail call double @cos(double noundef %9) #4
  %22 = tail call double @llvm.fmuladd.f64(double %21, double -4.293000e+02, double %20)
  %23 = tail call double @cos(double noundef %11) #4
  %24 = tail call double @llvm.fmuladd.f64(double %23, double -2.000000e+00, double %22)
  %25 = tail call double @cos(double noundef %15) #4
  %26 = tail call double @llvm.fmuladd.f64(double %25, double 1.930000e+01, double %24)
  %27 = fdiv double %26, 3.600000e+03
  %28 = fadd double %5, 1.200000e+01
  %29 = fsub double %28, %27
  %30 = getelementptr inbounds i8, ptr %0, i64 64
  store double %29, ptr %30, align 8, !tbaa !13
  %31 = getelementptr inbounds i8, ptr %0, i64 104
  %32 = load double, ptr %31, align 8, !tbaa !14
  %33 = fsub double %29, %32
  %34 = getelementptr inbounds i8, ptr %0, i64 88
  store double %33, ptr %34, align 8, !tbaa !15
  %35 = fadd double %32, %29
  %36 = getelementptr inbounds i8, ptr %0, i64 96
  store double %35, ptr %36, align 8, !tbaa !16
  ret void
}

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

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

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

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

attributes #0 = { inlinehint mustprogress 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 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 = { 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 #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !10, i64 24}
!6 = !{!"_ZTS6CSolar", !7, i64 0, !10, i64 8, !10, 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, !10, 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, !11, i64 416, !11, i64 417}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"double", !8, i64 0}
!11 = !{!"bool", !8, i64 0}
!12 = !{!6, !7, i64 0}
!13 = !{!6, !10, i64 64}
!14 = !{!6, !10, i64 104}
!15 = !{!6, !10, i64 88}
!16 = !{!6, !10, i64 96}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,TailCallElimPass