; LLVM IR from CLASS-SZ/class_sz :: class-sz/hyrec (history)

; 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.REC_COSMOPARAMS = type { double, double, double, double, double, double, double, double, double, double, double, double, double, double, i64, double, i16, 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 double @rec_HubbleConstant(ptr noundef, double noundef) #1

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

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

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

declare double @rec_helium_dxedt(double noundef, double noundef, double noundef, double noundef, double noundef, double noundef) #3

declare double @rec_HRecFast_dxedlna(double noundef, double noundef, double noundef, double noundef, double noundef, double noundef) #3

; Function Attrs: nounwind uwtable
define dso_local void @rec_get_xe_next2(ptr noundef %0, double noundef %1, double noundef %2, double noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6, i32 noundef %7, i32 noundef %8, ptr noundef %9, ptr noundef %10, ptr noundef %11, ptr noundef %12, ptr noundef %13, ptr noundef %14, ptr noundef %15, ptr noundef %16, ptr noundef %17) #1 {
  %19 = alloca ptr, align 8
  %20 = alloca double, align 8
  %21 = alloca double, align 8
  %22 = alloca double, align 8
  %23 = alloca ptr, align 8
  %24 = alloca ptr, align 8
  %25 = alloca ptr, align 8
  %26 = alloca i32, align 4
  %27 = alloca i32, align 4
  %28 = alloca ptr, align 8
  %29 = alloca ptr, align 8
  %30 = alloca ptr, align 8
  %31 = alloca ptr, align 8
  %32 = alloca ptr, align 8
  %33 = alloca ptr, align 8
  %34 = alloca ptr, align 8
  %35 = alloca ptr, align 8
  %36 = alloca ptr, align 8
  %37 = alloca double, align 8
  %38 = alloca double, align 8
  %39 = alloca double, align 8
  %40 = alloca double, align 8
  %41 = alloca double, align 8
  %42 = alloca double, align 8
  store ptr %0, ptr %19, align 8, !tbaa !5
  store double %1, ptr %20, align 8, !tbaa !9
  store double %2, ptr %21, align 8, !tbaa !9
  store double %3, ptr %22, align 8, !tbaa !9
  store ptr %4, ptr %23, align 8, !tbaa !5
  store ptr %5, ptr %24, align 8, !tbaa !5
  store ptr %6, ptr %25, align 8, !tbaa !5
  store i32 %7, ptr %26, align 4, !tbaa !11
  store i32 %8, ptr %27, align 4, !tbaa !11
  store ptr %9, ptr %28, align 8, !tbaa !5
  store ptr %10, ptr %29, align 8, !tbaa !5
  store ptr %11, ptr %30, align 8, !tbaa !5
  store ptr %12, ptr %31, align 8, !tbaa !5
  store ptr %13, ptr %32, align 8, !tbaa !5
  store ptr %14, ptr %33, align 8, !tbaa !5
  store ptr %15, ptr %34, align 8, !tbaa !5
  store ptr %16, ptr %35, align 8, !tbaa !5
  store ptr %17, ptr %36, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %37) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %38) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %39) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %40) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %41) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %42) #4
  %43 = load ptr, ptr %19, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.REC_COSMOPARAMS, ptr %43, i32 0, i32 0
  %45 = load double, ptr %44, align 8, !tbaa !13
  %46 = load double, ptr %20, align 8, !tbaa !9
  %47 = fadd double 1.000000e+00, %46
  store double %47, ptr %41, align 8, !tbaa !9
  %48 = fmul double %45, %47
  store double %48, ptr %39, align 8, !tbaa !9
  %49 = load ptr, ptr %19, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.REC_COSMOPARAMS, ptr %49, i32 0, i32 9
  %51 = load double, ptr %50, align 8, !tbaa !17
  %52 = load double, ptr %41, align 8, !tbaa !9
  %53 = fmul double %51, %52
  %54 = load double, ptr %41, align 8, !tbaa !9
  %55 = fmul double %53, %54
  %56 = load double, ptr %41, align 8, !tbaa !9
  %57 = fmul double %55, %56
  store double %57, ptr %40, align 8, !tbaa !9
  %58 = load ptr, ptr %19, align 8, !tbaa !5
  %59 = load double, ptr %20, align 8, !tbaa !9
  %60 = call double @rec_HubbleConstant(ptr noundef %58, double noundef %59)
  store double %60, ptr %42, align 8, !tbaa !9
  %61 = load i32, ptr %26, align 4, !tbaa !11
  %62 = icmp eq i32 %61, 1
  br i1 %62, label %63, label %79

63:                                               ; preds = %18
  %64 = load double, ptr %21, align 8, !tbaa !9
  %65 = load ptr, ptr %19, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.REC_COSMOPARAMS, ptr %65, i32 0, i32 9
  %67 = load double, ptr %66, align 8, !tbaa !17
  %68 = load ptr, ptr %19, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.REC_COSMOPARAMS, ptr %68, i32 0, i32 0
  %70 = load double, ptr %69, align 8, !tbaa !13
  %71 = load ptr, ptr %19, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.REC_COSMOPARAMS, ptr %71, i32 0, i32 10
  %73 = load double, ptr %72, align 8, !tbaa !18
  %74 = load double, ptr %42, align 8, !tbaa !9
  %75 = load double, ptr %20, align 8, !tbaa !9
  %76 = call double @rec_helium_dxedt(double noundef %64, double noundef %67, double noundef %70, double noundef %73, double noundef %74, double noundef %75)
  %77 = load double, ptr %42, align 8, !tbaa !9
  %78 = fdiv double %76, %77
  br label %92

79:                                               ; preds = %18
  %80 = load double, ptr %21, align 8, !tbaa !9
  %81 = load double, ptr %40, align 8, !tbaa !9
  %82 = fmul double %81, 0x3EB0C6F7A0B5ED8D
  %83 = load double, ptr %42, align 8, !tbaa !9
  %84 = load double, ptr %22, align 8, !tbaa !9
  %85 = fmul double %84, 0x3F16970041294F34
  %86 = load double, ptr %39, align 8, !tbaa !9
  %87 = fmul double %86, 0x3F16970041294F34
  %88 = load ptr, ptr %19, align 8, !tbaa !5
  %89 = load double, ptr %20, align 8, !tbaa !9
  %90 = call double @energy_injection_rate(ptr noundef %88, double noundef %89)
  %91 = call double @rec_HRecFast_dxedlna(double noundef %80, double noundef %82, double noundef %83, double noundef %85, double noundef %87, double noundef %90)
  br label %92

92:                                               ; preds = %79, %63
  %93 = phi double [ %78, %63 ], [ %91, %79 ]
  store double %93, ptr %37, align 8, !tbaa !9
  %94 = load double, ptr %21, align 8, !tbaa !9
  %95 = load double, ptr %22, align 8, !tbaa !9
  %96 = load double, ptr %39, align 8, !tbaa !9
  %97 = load double, ptr %42, align 8, !tbaa !9
  %98 = load ptr, ptr %19, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.REC_COSMOPARAMS, ptr %98, i32 0, i32 10
  %100 = load double, ptr %99, align 8, !tbaa !18
  %101 = load double, ptr %40, align 8, !tbaa !9
  %102 = fmul double %101, 0x3EB0C6F7A0B5ED8D
  %103 = load ptr, ptr %19, align 8, !tbaa !5
  %104 = load double, ptr %20, align 8, !tbaa !9
  %105 = call double @energy_injection_rate(ptr noundef %103, double noundef %104)
  %106 = call double @rec_dTmdlna(double noundef %94, double noundef %95, double noundef %96, double noundef %97, double noundef %100, double noundef %102, double noundef %105)
  store double %106, ptr %38, align 8, !tbaa !9
  %107 = load double, ptr %21, align 8, !tbaa !9
  %108 = load ptr, ptr %19, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.REC_COSMOPARAMS, ptr %108, i32 0, i32 13
  %110 = load double, ptr %109, align 8, !tbaa !19
  %111 = load double, ptr %37, align 8, !tbaa !9
  %112 = load ptr, ptr %35, align 8, !tbaa !5
  %113 = load double, ptr %112, align 8, !tbaa !9
  %114 = fmul double 2.500000e-01, %113
  %115 = fneg double %114
  %116 = call double @llvm.fmuladd.f64(double 1.250000e+00, double %111, double %115)
  %117 = call double @llvm.fmuladd.f64(double %110, double %116, double %107)
  %118 = load ptr, ptr %23, align 8, !tbaa !5
  store double %117, ptr %118, align 8, !tbaa !9
  %119 = load double, ptr %22, align 8, !tbaa !9
  %120 = load ptr, ptr %19, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.REC_COSMOPARAMS, ptr %120, i32 0, i32 13
  %122 = load double, ptr %121, align 8, !tbaa !19
  %123 = load double, ptr %38, align 8, !tbaa !9
  %124 = load ptr, ptr %36, align 8, !tbaa !5
  %125 = load double, ptr %124, align 8, !tbaa !9
  %126 = fmul double 2.500000e-01, %125
  %127 = fneg double %126
  %128 = call double @llvm.fmuladd.f64(double 1.250000e+00, double %123, double %127)
  %129 = call double @llvm.fmuladd.f64(double %122, double %128, double %119)
  %130 = load ptr, ptr %24, align 8, !tbaa !5
  store double %129, ptr %130, align 8, !tbaa !9
  %131 = load ptr, ptr %31, align 8, !tbaa !5
  %132 = load double, ptr %131, align 8, !tbaa !9
  %133 = load ptr, ptr %34, align 8, !tbaa !5
  store double %132, ptr %133, align 8, !tbaa !9
  %134 = load ptr, ptr %32, align 8, !tbaa !5
  %135 = load double, ptr %134, align 8, !tbaa !9
  %136 = load ptr, ptr %35, align 8, !tbaa !5
  store double %135, ptr %136, align 8, !tbaa !9
  %137 = load ptr, ptr %33, align 8, !tbaa !5
  %138 = load double, ptr %137, align 8, !tbaa !9
  %139 = load ptr, ptr %36, align 8, !tbaa !5
  store double %138, ptr %139, align 8, !tbaa !9
  %140 = load double, ptr %20, align 8, !tbaa !9
  %141 = load ptr, ptr %31, align 8, !tbaa !5
  store double %140, ptr %141, align 8, !tbaa !9
  %142 = load double, ptr %37, align 8, !tbaa !9
  %143 = load ptr, ptr %32, align 8, !tbaa !5
  store double %142, ptr %143, align 8, !tbaa !9
  %144 = load double, ptr %38, align 8, !tbaa !9
  %145 = load ptr, ptr %33, align 8, !tbaa !5
  store double %144, ptr %145, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %42) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %41) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %40) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %39) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %38) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %37) #4
  ret void
}

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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { "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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !10, i64 0}
!14 = !{!"", !10, 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, !15, i64 112, !10, i64 120, !16, i64 128, !10, i64 136, !10, i64 144, !10, i64 152, !10, i64 160, !10, i64 168, !10, i64 176, !10, i64 184}
!15 = !{!"long", !7, i64 0}
!16 = !{!"short", !7, i64 0}
!17 = !{!14, !10, i64 72}
!18 = !{!14, !10, i64 80}
!19 = !{!14, !10, i64 104}


; 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 double @rec_HubbleConstant(ptr noundef, double noundef) local_unnamed_addr #0

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

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

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

declare double @rec_helium_dxedt(double noundef, double noundef, double noundef, double noundef, double noundef, double noundef) local_unnamed_addr #2

declare double @rec_HRecFast_dxedlna(double noundef, double noundef, double noundef, double noundef, double noundef, double noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local void @rec_get_xe_next2(ptr noundef %0, double noundef %1, double noundef %2, double noundef %3, ptr nocapture noundef writeonly %4, ptr nocapture noundef writeonly %5, ptr nocapture noundef readnone %6, i32 noundef %7, i32 noundef %8, ptr nocapture noundef readnone %9, ptr nocapture noundef readnone %10, ptr nocapture noundef readnone %11, ptr nocapture noundef %12, ptr nocapture noundef %13, ptr nocapture noundef %14, ptr nocapture noundef writeonly %15, ptr nocapture noundef %16, ptr nocapture noundef %17) local_unnamed_addr #0 {
  %19 = load double, ptr %0, align 8, !tbaa !5
  %20 = fadd double %1, 1.000000e+00
  %21 = fmul double %20, %19
  %22 = getelementptr inbounds i8, ptr %0, i64 72
  %23 = load double, ptr %22, align 8, !tbaa !12
  %24 = fmul double %20, %23
  %25 = fmul double %20, %24
  %26 = fmul double %20, %25
  %27 = tail call double @rec_HubbleConstant(ptr noundef nonnull %0, double noundef %1)
  %28 = icmp eq i32 %7, 1
  br i1 %28, label %29, label %36

29:                                               ; preds = %18
  %30 = load double, ptr %22, align 8, !tbaa !12
  %31 = load double, ptr %0, align 8, !tbaa !5
  %32 = getelementptr inbounds i8, ptr %0, i64 80
  %33 = load double, ptr %32, align 8, !tbaa !13
  %34 = tail call double @rec_helium_dxedt(double noundef %2, double noundef %30, double noundef %31, double noundef %33, double noundef %27, double noundef %1) #3
  %35 = fdiv double %34, %27
  %.pre = fmul double %26, 0x3EB0C6F7A0B5ED8D
  br label %42

36:                                               ; preds = %18
  %37 = fmul double %26, 0x3EB0C6F7A0B5ED8D
  %38 = fmul double %3, 0x3F16970041294F34
  %39 = fmul double %21, 0x3F16970041294F34
  %40 = tail call double @energy_injection_rate(ptr noundef nonnull %0, double noundef %1)
  %41 = tail call double @rec_HRecFast_dxedlna(double noundef %2, double noundef %37, double noundef %27, double noundef %38, double noundef %39, double noundef %40) #3
  br label %42

42:                                               ; preds = %36, %29
  %.pre-phi = phi double [ %37, %36 ], [ %.pre, %29 ]
  %43 = phi double [ %41, %36 ], [ %35, %29 ]
  %44 = getelementptr inbounds i8, ptr %0, i64 80
  %45 = load double, ptr %44, align 8, !tbaa !13
  %46 = tail call double @energy_injection_rate(ptr noundef nonnull %0, double noundef %1)
  %47 = tail call double @rec_dTmdlna(double noundef %2, double noundef %3, double noundef %21, double noundef %27, double noundef %45, double noundef %.pre-phi, double noundef %46)
  %48 = getelementptr inbounds i8, ptr %0, i64 104
  %49 = load double, ptr %48, align 8, !tbaa !14
  %50 = load double, ptr %16, align 8, !tbaa !15
  %51 = fmul double %50, -2.500000e-01
  %52 = tail call double @llvm.fmuladd.f64(double %43, double 1.250000e+00, double %51)
  %53 = tail call double @llvm.fmuladd.f64(double %49, double %52, double %2)
  store double %53, ptr %4, align 8, !tbaa !15
  %54 = load double, ptr %48, align 8, !tbaa !14
  %55 = load double, ptr %17, align 8, !tbaa !15
  %56 = fmul double %55, -2.500000e-01
  %57 = tail call double @llvm.fmuladd.f64(double %47, double 1.250000e+00, double %56)
  %58 = tail call double @llvm.fmuladd.f64(double %54, double %57, double %3)
  store double %58, ptr %5, align 8, !tbaa !15
  %59 = load double, ptr %12, align 8, !tbaa !15
  store double %59, ptr %15, align 8, !tbaa !15
  %60 = load double, ptr %13, align 8, !tbaa !15
  store double %60, ptr %16, align 8, !tbaa !15
  %61 = load double, ptr %14, align 8, !tbaa !15
  store double %61, ptr %17, align 8, !tbaa !15
  store double %1, ptr %12, align 8, !tbaa !15
  store double %43, ptr %13, align 8, !tbaa !15
  store double %47, ptr %14, align 8, !tbaa !15
  ret void
}

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 speculatable willreturn memory(none) }
attributes #2 = { "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 }

!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 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !7, i64 80, !7, i64 88, !7, i64 96, !7, i64 104, !10, i64 112, !7, i64 120, !11, i64 128, !7, i64 136, !7, i64 144, !7, i64 152, !7, i64 160, !7, i64 168, !7, i64 176, !7, i64 184}
!7 = !{!"double", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!"short", !8, i64 0}
!12 = !{!6, !7, i64 72}
!13 = !{!6, !7, i64 80}
!14 = !{!6, !7, i64 104}
!15 = !{!7, !7, i64 0}


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