; LLVM IR from qc-tum/chemtensor :: src/tensor (su2_tree)

; 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.su2_tree_node = type { i32, [2 x ptr] }

@.str.1 = external hidden unnamed_addr constant [73 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [48 x i8], align 1
@__PRETTY_FUNCTION__.su2_tree_eval_clebsch_gordan = external hidden unnamed_addr constant [123 x i8], align 1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #0

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @ct_malloc(i64 noundef) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @ct_free(ptr noundef) #1

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @su2_tree_node_is_leaf(ptr noundef) #1

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

; Function Attrs: nounwind uwtable
define dso_local double @su2_tree_eval_clebsch_gordan(ptr noundef %0, ptr noalias noundef %1, ptr noalias noundef %2, i32 noundef %3) #3 {
  %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 i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca double, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca double, align 8
  %19 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store i32 %3, ptr %9, align 4, !tbaa !9
  %20 = load i32, ptr %9, align 4, !tbaa !9
  %21 = icmp sle i32 0, %20
  br i1 %21, label %22, label %34

22:                                               ; preds = %4
  %23 = load i32, ptr %9, align 4, !tbaa !9
  %24 = load ptr, ptr %7, align 8, !tbaa !5
  %25 = load ptr, ptr %6, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.su2_tree_node, ptr %25, i32 0, i32 0
  %27 = load i32, ptr %26, align 8, !tbaa !11
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds i32, ptr %24, i64 %28
  %30 = load i32, ptr %29, align 4, !tbaa !9
  %31 = add nsw i32 %30, 1
  %32 = icmp slt i32 %23, %31
  br i1 %32, label %33, label %34

33:                                               ; preds = %22
  br label %35

34:                                               ; preds = %22, %4
  call void @__assert_fail(ptr noundef @.str.9, ptr noundef @.str.1, i32 noundef 410, ptr noundef @__PRETTY_FUNCTION__.su2_tree_eval_clebsch_gordan) #6
  unreachable

35:                                               ; preds = %33
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  %37 = call zeroext i1 @su2_tree_node_is_leaf(ptr noundef %36)
  br i1 %37, label %38, label %51

38:                                               ; preds = %35
  %39 = load ptr, ptr %8, align 8, !tbaa !5
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.su2_tree_node, ptr %40, i32 0, i32 0
  %42 = load i32, ptr %41, align 8, !tbaa !11
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds i32, ptr %39, i64 %43
  %45 = load i32, ptr %44, align 4, !tbaa !9
  %46 = load i32, ptr %9, align 4, !tbaa !9
  %47 = icmp eq i32 %45, %46
  %48 = zext i1 %47 to i64
  %49 = select i1 %47, i32 1, i32 0
  %50 = sitofp i32 %49 to double
  store double %50, ptr %5, align 8
  br label %167

51:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  %52 = load ptr, ptr %7, align 8, !tbaa !5
  %53 = load ptr, ptr %6, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.su2_tree_node, ptr %53, i32 0, i32 1
  %55 = getelementptr inbounds [2 x ptr], ptr %54, i64 0, i64 0
  %56 = load ptr, ptr %55, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.su2_tree_node, ptr %56, i32 0, i32 0
  %58 = load i32, ptr %57, align 8, !tbaa !11
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds i32, ptr %52, i64 %59
  %61 = load i32, ptr %60, align 4, !tbaa !9
  store i32 %61, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  %62 = load ptr, ptr %7, align 8, !tbaa !5
  %63 = load ptr, ptr %6, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.su2_tree_node, ptr %63, i32 0, i32 1
  %65 = getelementptr inbounds [2 x ptr], ptr %64, i64 0, i64 1
  %66 = load ptr, ptr %65, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.su2_tree_node, ptr %66, i32 0, i32 0
  %68 = load i32, ptr %67, align 8, !tbaa !11
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds i32, ptr %62, i64 %69
  %71 = load i32, ptr %70, align 4, !tbaa !9
  store i32 %71, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  %72 = load ptr, ptr %7, align 8, !tbaa !5
  %73 = load ptr, ptr %6, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.su2_tree_node, ptr %73, i32 0, i32 0
  %75 = load i32, ptr %74, align 8, !tbaa !11
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds i32, ptr %72, i64 %76
  %78 = load i32, ptr %77, align 4, !tbaa !9
  store i32 %78, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %79 = load i32, ptr %11, align 4, !tbaa !9
  %80 = add nsw i32 %79, 1
  %81 = sext i32 %80 to i64
  %82 = mul i64 %81, 8
  %83 = call ptr @ct_malloc(i64 noundef %82)
  store ptr %83, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  store i32 0, ptr %14, align 4, !tbaa !9
  br label %84

84:                                               ; preds = %102, %51
  %85 = load i32, ptr %14, align 4, !tbaa !9
  %86 = load i32, ptr %11, align 4, !tbaa !9
  %87 = icmp sle i32 %85, %86
  br i1 %87, label %89, label %88

88:                                               ; preds = %84
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %105

89:                                               ; preds = %84
  %90 = load ptr, ptr %6, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.su2_tree_node, ptr %90, i32 0, i32 1
  %92 = getelementptr inbounds [2 x ptr], ptr %91, i64 0, i64 1
  %93 = load ptr, ptr %92, align 8, !tbaa !5
  %94 = load ptr, ptr %7, align 8, !tbaa !5
  %95 = load ptr, ptr %8, align 8, !tbaa !5
  %96 = load i32, ptr %14, align 4, !tbaa !9
  %97 = call double @su2_tree_eval_clebsch_gordan(ptr noundef %93, ptr noundef %94, ptr noundef %95, i32 noundef %96)
  %98 = load ptr, ptr %13, align 8, !tbaa !5
  %99 = load i32, ptr %14, align 4, !tbaa !9
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds double, ptr %98, i64 %100
  store double %97, ptr %101, align 8, !tbaa !13
  br label %102

102:                                              ; preds = %89
  %103 = load i32, ptr %14, align 4, !tbaa !9
  %104 = add nsw i32 %103, 1
  store i32 %104, ptr %14, align 4, !tbaa !9
  br label %84, !llvm.loop !15

105:                                              ; preds = %88
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  store double 0.000000e+00, ptr %15, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  store i32 0, ptr %16, align 4, !tbaa !9
  br label %106

106:                                              ; preds = %161, %105
  %107 = load i32, ptr %16, align 4, !tbaa !9
  %108 = load i32, ptr %10, align 4, !tbaa !9
  %109 = icmp sle i32 %107, %108
  br i1 %109, label %111, label %110

110:                                              ; preds = %106
  store i32 5, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  br label %164

111:                                              ; preds = %106
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  %112 = load ptr, ptr %6, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.su2_tree_node, ptr %112, i32 0, i32 1
  %114 = getelementptr inbounds [2 x ptr], ptr %113, i64 0, i64 0
  %115 = load ptr, ptr %114, align 8, !tbaa !5
  %116 = load ptr, ptr %7, align 8, !tbaa !5
  %117 = load ptr, ptr %8, align 8, !tbaa !5
  %118 = load i32, ptr %16, align 4, !tbaa !9
  %119 = call double @su2_tree_eval_clebsch_gordan(ptr noundef %115, ptr noundef %116, ptr noundef %117, i32 noundef %118)
  store double %119, ptr %18, align 8, !tbaa !13
  %120 = load double, ptr %18, align 8, !tbaa !13
  %121 = fcmp oeq double %120, 0.000000e+00
  br i1 %121, label %122, label %123

122:                                              ; preds = %111
  store i32 7, ptr %17, align 4
  br label %158

123:                                              ; preds = %111
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #7
  store i32 0, ptr %19, align 4, !tbaa !9
  br label %124

124:                                              ; preds = %154, %123
  %125 = load i32, ptr %19, align 4, !tbaa !9
  %126 = load i32, ptr %11, align 4, !tbaa !9
  %127 = icmp sle i32 %125, %126
  br i1 %127, label %129, label %128

128:                                              ; preds = %124
  store i32 8, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  br label %157

129:                                              ; preds = %124
  %130 = load ptr, ptr %13, align 8, !tbaa !5
  %131 = load i32, ptr %19, align 4, !tbaa !9
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds double, ptr %130, i64 %132
  %134 = load double, ptr %133, align 8, !tbaa !13
  %135 = fcmp oeq double %134, 0.000000e+00
  br i1 %135, label %136, label %137

136:                                              ; preds = %129
  br label %154

137:                                              ; preds = %129
  %138 = load double, ptr %18, align 8, !tbaa !13
  %139 = load ptr, ptr %13, align 8, !tbaa !5
  %140 = load i32, ptr %19, align 4, !tbaa !9
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds double, ptr %139, i64 %141
  %143 = load double, ptr %142, align 8, !tbaa !13
  %144 = fmul double %138, %143
  %145 = load i32, ptr %10, align 4, !tbaa !9
  %146 = load i32, ptr %11, align 4, !tbaa !9
  %147 = load i32, ptr %12, align 4, !tbaa !9
  %148 = load i32, ptr %16, align 4, !tbaa !9
  %149 = load i32, ptr %19, align 4, !tbaa !9
  %150 = load i32, ptr %9, align 4, !tbaa !9
  %151 = call double @clebsch_gordan(i32 noundef %145, i32 noundef %146, i32 noundef %147, i32 noundef %148, i32 noundef %149, i32 noundef %150)
  %152 = load double, ptr %15, align 8, !tbaa !13
  %153 = call double @llvm.fmuladd.f64(double %144, double %151, double %152)
  store double %153, ptr %15, align 8, !tbaa !13
  br label %154

154:                                              ; preds = %137, %136
  %155 = load i32, ptr %19, align 4, !tbaa !9
  %156 = add nsw i32 %155, 1
  store i32 %156, ptr %19, align 4, !tbaa !9
  br label %124, !llvm.loop !17

157:                                              ; preds = %128
  store i32 0, ptr %17, align 4
  br label %158

158:                                              ; preds = %157, %122
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  %159 = load i32, ptr %17, align 4
  switch i32 %159, label %169 [
    i32 0, label %160
    i32 7, label %161
  ]

160:                                              ; preds = %158
  br label %161

161:                                              ; preds = %160, %158
  %162 = load i32, ptr %16, align 4, !tbaa !9
  %163 = add nsw i32 %162, 1
  store i32 %163, ptr %16, align 4, !tbaa !9
  br label %106, !llvm.loop !18

164:                                              ; preds = %110
  %165 = load ptr, ptr %13, align 8, !tbaa !5
  call void @ct_free(ptr noundef %165)
  %166 = load double, ptr %15, align 8, !tbaa !13
  store double %166, ptr %5, align 8
  store i32 1, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %167

167:                                              ; preds = %164, %38
  %168 = load double, ptr %5, align 8
  ret double %168

169:                                              ; preds = %158
  unreachable
}

declare double @clebsch_gordan(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #4

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

attributes #0 = { noreturn 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 #1 = { inlinehint 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 willreturn memory(argmem: readwrite) }
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 = { "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 #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { noreturn nounwind }
attributes #7 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"su2_tree_node", !10, i64 0, !7, i64 8}
!13 = !{!14, !14, i64 0}
!14 = !{!"double", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !16}


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

@.str.1 = external hidden unnamed_addr constant [73 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [48 x i8], align 1
@__PRETTY_FUNCTION__.su2_tree_eval_clebsch_gordan = external hidden unnamed_addr constant [123 x i8], align 1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @ct_malloc(i64 noundef) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @ct_free(ptr noundef) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @su2_tree_node_is_leaf(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local double @su2_tree_eval_clebsch_gordan(ptr noundef %0, ptr noalias noundef %1, ptr noalias noundef %2, i32 noundef %3) local_unnamed_addr #2 {
  %5 = icmp sgt i32 %3, -1
  br i1 %5, label %6, label %11

6:                                                ; preds = %4
  %7 = load i32, ptr %0, align 8, !tbaa !5
  %8 = sext i32 %7 to i64
  %9 = getelementptr inbounds i32, ptr %1, i64 %8
  %10 = load i32, ptr %9, align 4, !tbaa !10
  %.not = icmp slt i32 %10, %3
  br i1 %.not, label %11, label %12

11:                                               ; preds = %6, %4
  tail call void @__assert_fail(ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.1, i32 noundef 410, ptr noundef nonnull @__PRETTY_FUNCTION__.su2_tree_eval_clebsch_gordan) #5
  unreachable

12:                                               ; preds = %6
  %13 = tail call zeroext i1 @su2_tree_node_is_leaf(ptr noundef nonnull %0)
  br i1 %13, label %14, label %21

14:                                               ; preds = %12
  %15 = load i32, ptr %0, align 8, !tbaa !5
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds i32, ptr %2, i64 %16
  %18 = load i32, ptr %17, align 4, !tbaa !10
  %19 = icmp eq i32 %18, %3
  %20 = uitofp i1 %19 to double
  br label %62

21:                                               ; preds = %12
  %22 = getelementptr inbounds i8, ptr %0, i64 8
  %23 = load ptr, ptr %22, align 8, !tbaa !11
  %24 = load i32, ptr %23, align 8, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds i32, ptr %1, i64 %25
  %27 = load i32, ptr %26, align 4, !tbaa !10
  %28 = getelementptr inbounds i8, ptr %0, i64 16
  %29 = load ptr, ptr %28, align 8, !tbaa !11
  %30 = load i32, ptr %29, align 8, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds i32, ptr %1, i64 %31
  %33 = load i32, ptr %32, align 4, !tbaa !10
  %.fr = freeze i32 %33
  %34 = load i32, ptr %0, align 8, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds i32, ptr %1, i64 %35
  %37 = load i32, ptr %36, align 4, !tbaa !10
  %38 = add i32 %.fr, 1
  %39 = sext i32 %38 to i64
  %40 = shl nsw i64 %39, 3
  %41 = tail call ptr @ct_malloc(i64 noundef %40)
  %.not5862 = icmp slt i32 %.fr, 0
  br i1 %.not5862, label %.preheader61.thread, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %21
  %wide.trip.count = zext i32 %38 to i64
  br label %.lr.ph

.preheader61:                                     ; preds = %.lr.ph
  %.not5968 = icmp slt i32 %27, 0
  br i1 %.not5968, label %._crit_edge, label %.lr.ph71

.preheader61.thread:                              ; preds = %21
  %.not596882 = icmp slt i32 %27, 0
  br i1 %.not596882, label %._crit_edge, label %.lr.ph71.split.us.preheader

.lr.ph71:                                         ; preds = %.preheader61
  br i1 %.not5862, label %.lr.ph71.split.us.preheader, label %.lr.ph71.split.preheader

.lr.ph71.split.us.preheader:                      ; preds = %.preheader61.thread, %.lr.ph71
  br label %.lr.ph71.split.us

.lr.ph71.split.preheader:                         ; preds = %.lr.ph71
  %wide.trip.count78 = zext i32 %38 to i64
  br label %.lr.ph71.split

.lr.ph71.split.us:                                ; preds = %.lr.ph71.split.us.preheader, %.lr.ph71.split.us
  %.05070.us = phi i32 [ %44, %.lr.ph71.split.us ], [ 0, %.lr.ph71.split.us.preheader ]
  %42 = load ptr, ptr %22, align 8, !tbaa !11
  %43 = tail call double @su2_tree_eval_clebsch_gordan(ptr noundef %42, ptr noundef %1, ptr noundef %2, i32 noundef %.05070.us)
  %44 = add nuw i32 %.05070.us, 1
  %exitcond81.not = icmp eq i32 %.05070.us, %27
  br i1 %exitcond81.not, label %._crit_edge, label %.lr.ph71.split.us, !llvm.loop !13

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %45 = load ptr, ptr %28, align 8, !tbaa !11
  %46 = trunc nuw nsw i64 %indvars.iv to i32
  %47 = tail call double @su2_tree_eval_clebsch_gordan(ptr noundef %45, ptr noundef %1, ptr noundef %2, i32 noundef %46)
  %48 = getelementptr inbounds double, ptr %41, i64 %indvars.iv
  store double %47, ptr %48, align 8, !tbaa !15
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.preheader61, label %.lr.ph, !llvm.loop !17

._crit_edge:                                      ; preds = %..loopexit_crit_edge, %.lr.ph71.split.us, %.preheader61.thread, %.preheader61
  %.051.lcssa = phi double [ 0.000000e+00, %.preheader61 ], [ 0.000000e+00, %.preheader61.thread ], [ 0.000000e+00, %.lr.ph71.split.us ], [ %.3, %..loopexit_crit_edge ]
  tail call void @ct_free(ptr noundef %41)
  br label %62

.lr.ph71.split:                                   ; preds = %.lr.ph71.split.preheader, %..loopexit_crit_edge
  %.05070 = phi i32 [ %61, %..loopexit_crit_edge ], [ 0, %.lr.ph71.split.preheader ]
  %.05169 = phi double [ %.3, %..loopexit_crit_edge ], [ 0.000000e+00, %.lr.ph71.split.preheader ]
  %49 = load ptr, ptr %22, align 8, !tbaa !11
  %50 = tail call double @su2_tree_eval_clebsch_gordan(ptr noundef %49, ptr noundef %1, ptr noundef %2, i32 noundef %.05070)
  %51 = fcmp oeq double %50, 0.000000e+00
  br i1 %51, label %..loopexit_crit_edge, label %.preheader

.preheader:                                       ; preds = %.lr.ph71.split, %60
  %indvars.iv75 = phi i64 [ %indvars.iv.next76, %60 ], [ 0, %.lr.ph71.split ]
  %.165 = phi double [ %.2, %60 ], [ %.05169, %.lr.ph71.split ]
  %52 = getelementptr inbounds double, ptr %41, i64 %indvars.iv75
  %53 = load double, ptr %52, align 8, !tbaa !15
  %54 = fcmp oeq double %53, 0.000000e+00
  br i1 %54, label %60, label %55

55:                                               ; preds = %.preheader
  %56 = fmul double %50, %53
  %57 = trunc nuw nsw i64 %indvars.iv75 to i32
  %58 = tail call double @clebsch_gordan(i32 noundef %27, i32 noundef %.fr, i32 noundef %37, i32 noundef %.05070, i32 noundef %57, i32 noundef %3) #6
  %59 = tail call double @llvm.fmuladd.f64(double %56, double %58, double %.165)
  br label %60

60:                                               ; preds = %.preheader, %55
  %.2 = phi double [ %.165, %.preheader ], [ %59, %55 ]
  %indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
  %exitcond79.not = icmp eq i64 %indvars.iv.next76, %wide.trip.count78
  br i1 %exitcond79.not, label %..loopexit_crit_edge, label %.preheader, !llvm.loop !18

..loopexit_crit_edge:                             ; preds = %60, %.lr.ph71.split
  %.3 = phi double [ %.05169, %.lr.ph71.split ], [ %.2, %60 ]
  %61 = add nuw i32 %.05070, 1
  %exitcond80.not = icmp eq i32 %.05070, %27
  br i1 %exitcond80.not, label %._crit_edge, label %.lr.ph71.split, !llvm.loop !13

62:                                               ; preds = %._crit_edge, %14
  %.049 = phi double [ %20, %14 ], [ %.051.lcssa, %._crit_edge ]
  ret double %.049
}

declare double @clebsch_gordan(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #3

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

attributes #0 = { noreturn 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 #1 = { inlinehint 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 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 = { "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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { noreturn nounwind }
attributes #6 = { 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 = !{!"su2_tree_node", !7, i64 0, !8, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!7, !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !8, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !16, i64 0}
!16 = !{!"double", !8, i64 0}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass