; 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
declare double @pow(double noundef, double noundef) #1

; Function Attrs: nounwind
declare double @exp(double noundef) #1

; Function Attrs: nounwind
declare double @sqrt(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
define dso_local double @energy_injection_rate(ptr noundef %0, double noundef %1) #3 {
  %3 = alloca double, align 8
  %4 = alloca ptr, align 8
  %5 = alloca double, align 8
  %6 = alloca double, align 8
  %7 = alloca double, align 8
  %8 = alloca double, align 8
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  %12 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store double %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 8, 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
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.REC_COSMOPARAMS, ptr %13, i32 0, i32 15
  %15 = load double, ptr %14, align 8, !tbaa !11
  %16 = fcmp ogt double %15, 0.000000e+00
  br i1 %16, label %17, label %109

17:                                               ; preds = %2
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.REC_COSMOPARAMS, ptr %18, i32 0, i32 16
  %20 = load i16, ptr %19, align 8, !tbaa !15
  %21 = sext i16 %20 to i32
  %22 = icmp eq i32 %21, 0
  br i1 %22, label %23, label %103

23:                                               ; preds = %17
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.REC_COSMOPARAMS, ptr %24, i32 0, i32 9
  %26 = load double, ptr %25, align 8, !tbaa !16
  %27 = fmul double 0x3BD78B939EA8C8BF, %26
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.REC_COSMOPARAMS, ptr %28, i32 0, i32 2
  %30 = load double, ptr %29, align 8, !tbaa !17
  %31 = call double @sqrt(double noundef %30) #4
  %32 = fmul double 0x3C4DE412E12433CA, %31
  %33 = fdiv double %27, %32
  store double %33, ptr %10, align 8, !tbaa !9
  store double 1.000000e+00, ptr %7, align 8, !tbaa !9
  %34 = load double, ptr %5, align 8, !tbaa !9
  store double %34, ptr %6, align 8, !tbaa !9
  %35 = load double, ptr %10, align 8, !tbaa !9
  %36 = load double, ptr %5, align 8, !tbaa !9
  %37 = fadd double 1.000000e+00, %36
  %38 = call double @pow(double noundef %37, double noundef 8.000000e+00) #4
  %39 = fmul double %35, %38
  %40 = load double, ptr %6, align 8, !tbaa !9
  %41 = fadd double 1.000000e+00, %40
  %42 = call double @pow(double noundef %41, double noundef 7.500000e+00) #4
  %43 = fdiv double %39, %42
  %44 = load double, ptr %10, align 8, !tbaa !9
  %45 = fmul double 0x3FE5555555555555, %44
  %46 = load double, ptr %5, align 8, !tbaa !9
  %47 = fadd double 1.000000e+00, %46
  %48 = call double @pow(double noundef %47, double noundef 1.500000e+00) #4
  %49 = load double, ptr %6, align 8, !tbaa !9
  %50 = fadd double 1.000000e+00, %49
  %51 = call double @pow(double noundef %50, double noundef 1.500000e+00) #4
  %52 = fsub double %48, %51
  %53 = fmul double %45, %52
  %54 = call double @exp(double noundef %53) #4
  %55 = fmul double %43, %54
  %56 = load ptr, ptr %4, align 8, !tbaa !5
  %57 = load double, ptr %6, align 8, !tbaa !9
  %58 = call double @onthespot_injection_rate(ptr noundef %56, double noundef %57)
  %59 = fmul double %55, %58
  store double %59, ptr %9, align 8, !tbaa !9
  %60 = load double, ptr %7, align 8, !tbaa !9
  %61 = fmul double 5.000000e-01, %60
  %62 = load double, ptr %9, align 8, !tbaa !9
  %63 = fmul double %61, %62
  store double %63, ptr %11, align 8, !tbaa !9
  br label %64

64:                                               ; preds = %97, %23
  %65 = load double, ptr %7, align 8, !tbaa !9
  %66 = load double, ptr %6, align 8, !tbaa !9
  %67 = fadd double %66, %65
  store double %67, ptr %6, align 8, !tbaa !9
  %68 = load double, ptr %10, align 8, !tbaa !9
  %69 = load double, ptr %5, align 8, !tbaa !9
  %70 = fadd double 1.000000e+00, %69
  %71 = call double @pow(double noundef %70, double noundef 8.000000e+00) #4
  %72 = fmul double %68, %71
  %73 = load double, ptr %6, align 8, !tbaa !9
  %74 = fadd double 1.000000e+00, %73
  %75 = call double @pow(double noundef %74, double noundef 7.500000e+00) #4
  %76 = fdiv double %72, %75
  %77 = load double, ptr %10, align 8, !tbaa !9
  %78 = fmul double 0x3FE5555555555555, %77
  %79 = load double, ptr %5, align 8, !tbaa !9
  %80 = fadd double 1.000000e+00, %79
  %81 = call double @pow(double noundef %80, double noundef 1.500000e+00) #4
  %82 = load double, ptr %6, align 8, !tbaa !9
  %83 = fadd double 1.000000e+00, %82
  %84 = call double @pow(double noundef %83, double noundef 1.500000e+00) #4
  %85 = fsub double %81, %84
  %86 = fmul double %78, %85
  %87 = call double @exp(double noundef %86) #4
  %88 = fmul double %76, %87
  %89 = load ptr, ptr %4, align 8, !tbaa !5
  %90 = load double, ptr %6, align 8, !tbaa !9
  %91 = call double @onthespot_injection_rate(ptr noundef %89, double noundef %90)
  %92 = fmul double %88, %91
  store double %92, ptr %8, align 8, !tbaa !9
  %93 = load double, ptr %7, align 8, !tbaa !9
  %94 = load double, ptr %8, align 8, !tbaa !9
  %95 = load double, ptr %11, align 8, !tbaa !9
  %96 = call double @llvm.fmuladd.f64(double %93, double %94, double %95)
  store double %96, ptr %11, align 8, !tbaa !9
  br label %97

97:                                               ; preds = %64
  %98 = load double, ptr %8, align 8, !tbaa !9
  %99 = load double, ptr %9, align 8, !tbaa !9
  %100 = fdiv double %98, %99
  %101 = fcmp ogt double %100, 2.000000e-02
  br i1 %101, label %64, label %102, !llvm.loop !18

102:                                              ; preds = %97
  br label %107

103:                                              ; preds = %17
  %104 = load ptr, ptr %4, align 8, !tbaa !5
  %105 = load double, ptr %5, align 8, !tbaa !9
  %106 = call double @onthespot_injection_rate(ptr noundef %104, double noundef %105)
  store double %106, ptr %11, align 8, !tbaa !9
  br label %107

107:                                              ; preds = %103, %102
  %108 = load double, ptr %11, align 8, !tbaa !9
  store double %108, ptr %3, align 8
  store i32 1, ptr %12, align 4
  br label %110

109:                                              ; preds = %2
  store double 0.000000e+00, ptr %3, align 8
  store i32 1, ptr %12, align 4
  br label %110

110:                                              ; preds = %109, %107
  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 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  %111 = load double, ptr %3, align 8
  ret double %111
}

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { 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 #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, !10, i64 120}
!12 = !{!"", !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, !13, i64 112, !10, i64 120, !14, i64 128, !10, i64 136, !10, i64 144, !10, i64 152, !10, i64 160, !10, i64 168, !10, i64 176, !10, i64 184}
!13 = !{!"long", !7, i64 0}
!14 = !{!"short", !7, i64 0}
!15 = !{!12, !14, i64 128}
!16 = !{!12, !10, i64 72}
!17 = !{!12, !10, i64 16}
!18 = distinct !{!18, !19}
!19 = !{!"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"

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @pow(double noundef, double noundef) local_unnamed_addr #0

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

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

; Function Attrs: nounwind uwtable
define dso_local double @energy_injection_rate(ptr noundef %0, double noundef %1) local_unnamed_addr #1 {
  %3 = getelementptr inbounds i8, ptr %0, i64 120
  %4 = load double, ptr %3, align 8, !tbaa !5
  %5 = fcmp ogt double %4, 0.000000e+00
  br i1 %5, label %6, label %.loopexit

6:                                                ; preds = %2
  %7 = getelementptr inbounds i8, ptr %0, i64 128
  %8 = load i16, ptr %7, align 8, !tbaa !12
  %9 = icmp eq i16 %8, 0
  br i1 %9, label %10, label %52

10:                                               ; preds = %6
  %11 = getelementptr inbounds i8, ptr %0, i64 72
  %12 = load double, ptr %11, align 8, !tbaa !13
  %13 = fmul double %12, 0x3BD78B939EA8C8BF
  %14 = getelementptr inbounds i8, ptr %0, i64 16
  %15 = load double, ptr %14, align 8, !tbaa !14
  %16 = tail call double @sqrt(double noundef %15) #2
  %17 = fmul double %16, 0x3C4DE412E12433CA
  %18 = fdiv double %13, %17
  %19 = fadd double %1, 1.000000e+00
  %20 = tail call double @pow(double noundef %19, double noundef 8.000000e+00) #2
  %21 = fmul double %20, %18
  %22 = tail call double @pow(double noundef %19, double noundef 7.500000e+00) #2
  %23 = fdiv double %21, %22
  %24 = fmul double %18, 0x3FE5555555555555
  %25 = tail call double @pow(double noundef %19, double noundef 1.500000e+00) #2
  %26 = tail call double @pow(double noundef %19, double noundef 1.500000e+00) #2
  %27 = fsub double %25, %26
  %28 = fmul double %24, %27
  %29 = tail call double @exp(double noundef %28) #2
  %30 = fmul double %23, %29
  %31 = tail call double @onthespot_injection_rate(ptr noundef nonnull %0, double noundef %1)
  %32 = fmul double %30, %31
  %33 = fmul double %32, 5.000000e-01
  br label %34

34:                                               ; preds = %34, %10
  %.035 = phi double [ %1, %10 ], [ %35, %34 ]
  %.0 = phi double [ %33, %10 ], [ %49, %34 ]
  %35 = fadd double %.035, 1.000000e+00
  %36 = tail call double @pow(double noundef %19, double noundef 8.000000e+00) #2
  %37 = fmul double %18, %36
  %38 = fadd double %35, 1.000000e+00
  %39 = tail call double @pow(double noundef %38, double noundef 7.500000e+00) #2
  %40 = fdiv double %37, %39
  %41 = tail call double @pow(double noundef %19, double noundef 1.500000e+00) #2
  %42 = tail call double @pow(double noundef %38, double noundef 1.500000e+00) #2
  %43 = fsub double %41, %42
  %44 = fmul double %24, %43
  %45 = tail call double @exp(double noundef %44) #2
  %46 = fmul double %40, %45
  %47 = tail call double @onthespot_injection_rate(ptr noundef %0, double noundef %35)
  %48 = fmul double %46, %47
  %49 = fadd double %.0, %48
  %50 = fdiv double %48, %32
  %51 = fcmp ogt double %50, 2.000000e-02
  br i1 %51, label %34, label %.loopexit, !llvm.loop !15

52:                                               ; preds = %6
  %53 = tail call double @onthespot_injection_rate(ptr noundef nonnull %0, double noundef %1)
  br label %.loopexit

.loopexit:                                        ; preds = %34, %2, %52
  %.034 = phi double [ %53, %52 ], [ 0.000000e+00, %2 ], [ %49, %34 ]
  ret double %.034
}

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

attributes #0 = { 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 #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, !7, i64 120}
!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, !11, i64 128}
!13 = !{!6, !7, i64 72}
!14 = !{!6, !7, i64 16}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass