; 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.queue = type { ptr, ptr }
%struct.linked_list = type { ptr, ptr, i64 }
%struct.su2_tree_node = type { i32, [2 x ptr] }
%struct.charge_sectors = type { ptr, i64, i32 }
%struct.linked_list_node = type { ptr, ptr, ptr }

@.str.1 = external hidden unnamed_addr constant [73 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [13 x i8], align 1
@__PRETTY_FUNCTION__.su2_tree_enumerate_charge_sectors = external hidden unnamed_addr constant [142 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [18 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
declare dso_local i32 @su2_tree_num_nodes(ptr noundef) #3

; Function Attrs: nounwind uwtable
define dso_local void @su2_tree_enumerate_charge_sectors(ptr noundef %0, i32 noundef %1, ptr noundef %2, ptr noundef %3) #3 {
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca %struct.queue, align 8
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca %struct.linked_list, align 8
  %17 = alloca i64, align 8
  %18 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = icmp ne ptr %19, null
  br i1 %20, label %21, label %22

21:                                               ; preds = %4
  br label %23

22:                                               ; preds = %4
  call void @__assert_fail(ptr noundef @.str.10, ptr noundef @.str.1, i32 noundef 546, ptr noundef @__PRETTY_FUNCTION__.su2_tree_enumerate_charge_sectors) #7
  unreachable

23:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = call i32 @su2_tree_num_nodes(ptr noundef %24)
  store i32 %25, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #8
  %26 = load i32, ptr %9, align 4, !tbaa !9
  %27 = sext i32 %26 to i64
  %28 = mul i64 %27, 8
  %29 = call ptr @ct_malloc(i64 noundef %28)
  store ptr %29, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #8
  call void @llvm.memset.p0.i64(ptr align 8 %11, i8 0, i64 16, i1 false)
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  call void @enqueue(ptr noundef %11, ptr noundef %30)
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  store i32 0, ptr %12, align 4, !tbaa !9
  br label %31

31:                                               ; preds = %54, %23
  %32 = call zeroext i1 @queue_is_empty(ptr noundef %11)
  %33 = xor i1 %32, true
  br i1 %33, label %34, label %55

34:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #8
  %35 = call ptr @dequeue(ptr noundef %11)
  store ptr %35, ptr %13, align 8, !tbaa !5
  %36 = load ptr, ptr %13, align 8, !tbaa !5
  %37 = load ptr, ptr %10, align 8, !tbaa !5
  %38 = load i32, ptr %12, align 4, !tbaa !9
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds ptr, ptr %37, i64 %39
  store ptr %36, ptr %40, align 8, !tbaa !5
  %41 = load i32, ptr %12, align 4, !tbaa !9
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %12, align 4, !tbaa !9
  %43 = load ptr, ptr %13, align 8, !tbaa !5
  %44 = call zeroext i1 @su2_tree_node_is_leaf(ptr noundef %43)
  br i1 %44, label %54, label %45

45:                                               ; preds = %34
  %46 = load ptr, ptr %13, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.su2_tree_node, ptr %46, i32 0, i32 1
  %48 = getelementptr inbounds [2 x ptr], ptr %47, i64 0, i64 0
  %49 = load ptr, ptr %48, align 8, !tbaa !5
  call void @enqueue(ptr noundef %11, ptr noundef %49)
  %50 = load ptr, ptr %13, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.su2_tree_node, ptr %50, i32 0, i32 1
  %52 = getelementptr inbounds [2 x ptr], ptr %51, i64 0, i64 1
  %53 = load ptr, ptr %52, align 8, !tbaa !5
  call void @enqueue(ptr noundef %11, ptr noundef %53)
  br label %54

54:                                               ; preds = %45, %34
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  br label %31, !llvm.loop !11

55:                                               ; preds = %31
  %56 = load i32, ptr %12, align 4, !tbaa !9
  %57 = load i32, ptr %9, align 4, !tbaa !9
  %58 = icmp eq i32 %56, %57
  br i1 %58, label %59, label %60

59:                                               ; preds = %55
  br label %61

60:                                               ; preds = %55
  call void @__assert_fail(ptr noundef @.str.11, ptr noundef @.str.1, i32 noundef 568, ptr noundef @__PRETTY_FUNCTION__.su2_tree_enumerate_charge_sectors) #7
  unreachable

61:                                               ; preds = %59
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #8
  %62 = load i32, ptr %6, align 4, !tbaa !9
  %63 = sext i32 %62 to i64
  %64 = call ptr @ct_calloc(i64 noundef %63, i64 noundef 4)
  store ptr %64, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #8
  %65 = load i32, ptr %9, align 4, !tbaa !9
  %66 = sub nsw i32 %65, 1
  store i32 %66, ptr %15, align 4, !tbaa !9
  br label %67

67:                                               ; preds = %79, %61
  %68 = load i32, ptr %15, align 4, !tbaa !9
  %69 = icmp sge i32 %68, 0
  br i1 %69, label %71, label %70

70:                                               ; preds = %67
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  br label %82

71:                                               ; preds = %67
  %72 = load ptr, ptr %10, align 8, !tbaa !5
  %73 = load i32, ptr %15, align 4, !tbaa !9
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds ptr, ptr %72, i64 %74
  %76 = load ptr, ptr %75, align 8, !tbaa !5
  %77 = load ptr, ptr %7, align 8, !tbaa !5
  %78 = load ptr, ptr %14, align 8, !tbaa !5
  call void @su2_tree_node_reset_quantum_number(ptr noundef %76, ptr noundef %77, ptr noundef %78)
  br label %79

79:                                               ; preds = %71
  %80 = load i32, ptr %15, align 4, !tbaa !9
  %81 = add nsw i32 %80, -1
  store i32 %81, ptr %15, align 4, !tbaa !9
  br label %67, !llvm.loop !13

82:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 24, ptr %16) #8
  call void @llvm.memset.p0.i64(ptr align 8 %16, i8 0, i64 24, i1 false)
  br label %83

83:                                               ; preds = %89, %82
  %84 = load ptr, ptr %14, align 8, !tbaa !5
  %85 = load i32, ptr %6, align 4, !tbaa !9
  %86 = sext i32 %85 to i64
  %87 = mul i64 %86, 4
  %88 = call ptr @allocate_copy(ptr noundef %84, i64 noundef %87)
  call void @linked_list_append(ptr noundef %16, ptr noundef %88)
  br label %89

89:                                               ; preds = %83
  %90 = load ptr, ptr %10, align 8, !tbaa !5
  %91 = load i32, ptr %9, align 4, !tbaa !9
  %92 = load ptr, ptr %7, align 8, !tbaa !5
  %93 = load ptr, ptr %14, align 8, !tbaa !5
  %94 = call zeroext i1 @su2_tree_next_charge_sector(ptr noundef %90, i32 noundef %91, ptr noundef %92, ptr noundef %93)
  br i1 %94, label %83, label %95, !llvm.loop !14

95:                                               ; preds = %89
  %96 = getelementptr inbounds %struct.linked_list, ptr %16, i32 0, i32 2
  %97 = load i64, ptr %96, align 8, !tbaa !15
  %98 = load i32, ptr %6, align 4, !tbaa !9
  %99 = load ptr, ptr %8, align 8, !tbaa !5
  call void @allocate_charge_sectors(i64 noundef %97, i32 noundef %98, ptr noundef %99)
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #8
  store i64 0, ptr %17, align 8, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #8
  %100 = getelementptr inbounds %struct.linked_list, ptr %16, i32 0, i32 0
  %101 = load ptr, ptr %100, align 8, !tbaa !19
  store ptr %101, ptr %18, align 8, !tbaa !5
  br label %102

102:                                              ; preds = %105, %95
  %103 = load ptr, ptr %18, align 8, !tbaa !5
  %104 = icmp ne ptr %103, null
  br i1 %104, label %105, label %125

105:                                              ; preds = %102
  %106 = load ptr, ptr %8, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.charge_sectors, ptr %106, i32 0, i32 0
  %108 = load ptr, ptr %107, align 8, !tbaa !20
  %109 = load i64, ptr %17, align 8, !tbaa !18
  %110 = load i32, ptr %6, align 4, !tbaa !9
  %111 = sext i32 %110 to i64
  %112 = mul nsw i64 %109, %111
  %113 = getelementptr inbounds i32, ptr %108, i64 %112
  %114 = load ptr, ptr %18, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.linked_list_node, ptr %114, i32 0, i32 0
  %116 = load ptr, ptr %115, align 8, !tbaa !22
  %117 = load i32, ptr %6, align 4, !tbaa !9
  %118 = sext i32 %117 to i64
  %119 = mul i64 %118, 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %113, ptr align 1 %116, i64 %119, i1 false)
  %120 = load ptr, ptr %18, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.linked_list_node, ptr %120, i32 0, i32 2
  %122 = load ptr, ptr %121, align 8, !tbaa !24
  store ptr %122, ptr %18, align 8, !tbaa !5
  %123 = load i64, ptr %17, align 8, !tbaa !18
  %124 = add nsw i64 %123, 1
  store i64 %124, ptr %17, align 8, !tbaa !18
  br label %102, !llvm.loop !25

125:                                              ; preds = %102
  %126 = load i64, ptr %17, align 8, !tbaa !18
  %127 = getelementptr inbounds %struct.linked_list, ptr %16, i32 0, i32 2
  %128 = load i64, ptr %127, align 8, !tbaa !15
  %129 = icmp eq i64 %126, %128
  br i1 %129, label %130, label %131

130:                                              ; preds = %125
  br label %132

131:                                              ; preds = %125
  call void @__assert_fail(ptr noundef @.str.12, ptr noundef @.str.1, i32 noundef 595, ptr noundef @__PRETTY_FUNCTION__.su2_tree_enumerate_charge_sectors) #7
  unreachable

132:                                              ; preds = %130
  call void @delete_linked_list(ptr noundef %16, ptr noundef @ct_free)
  %133 = load ptr, ptr %14, align 8, !tbaa !5
  call void @ct_free(ptr noundef %133)
  %134 = load ptr, ptr %10, align 8, !tbaa !5
  call void @ct_free(ptr noundef %134)
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  ret void
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

declare void @enqueue(ptr noundef, ptr noundef) #5

declare zeroext i1 @queue_is_empty(ptr noundef) #5

declare ptr @dequeue(ptr noundef) #5

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

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

declare void @linked_list_append(ptr noundef, ptr noundef) #5

; Function Attrs: nounwind uwtable
declare hidden ptr @allocate_copy(ptr noundef, i64 noundef) #3

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @su2_tree_next_charge_sector(ptr noundef, i32 noundef, ptr noundef, ptr noalias noundef) #3

declare void @allocate_charge_sectors(i64 noundef, i32 noundef, ptr noundef) #5

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6

declare void @delete_linked_list(ptr noundef, ptr noundef) #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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { "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 #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { noreturn nounwind }
attributes #8 = { 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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = !{!16, !17, i64 16}
!16 = !{!"linked_list", !6, i64 0, !6, i64 8, !17, i64 16}
!17 = !{!"long", !7, i64 0}
!18 = !{!17, !17, i64 0}
!19 = !{!16, !6, i64 0}
!20 = !{!21, !6, i64 0}
!21 = !{!"charge_sectors", !6, i64 0, !17, i64 8, !10, i64 16}
!22 = !{!23, !6, i64 0}
!23 = !{!"linked_list_node", !6, i64 0, !6, i64 8, !6, i64 16}
!24 = !{!23, !6, i64 16}
!25 = distinct !{!25, !12}


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

%struct.queue = type { ptr, ptr }
%struct.linked_list = type { ptr, ptr, i64 }

@.str.1 = external hidden unnamed_addr constant [73 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [13 x i8], align 1
@__PRETTY_FUNCTION__.su2_tree_enumerate_charge_sectors = external hidden unnamed_addr constant [142 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [18 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) #1

; Function Attrs: mustprogress 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) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @su2_tree_num_nodes(ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local void @su2_tree_enumerate_charge_sectors(ptr noundef %0, i32 noundef %1, ptr noundef %2, ptr noundef %3) local_unnamed_addr #3 {
  %5 = alloca %struct.queue, align 8
  %6 = alloca %struct.linked_list, align 8
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %7, label %8

7:                                                ; preds = %4
  tail call void @__assert_fail(ptr noundef nonnull @.str.10, ptr noundef nonnull @.str.1, i32 noundef 546, ptr noundef nonnull @__PRETTY_FUNCTION__.su2_tree_enumerate_charge_sectors) #7
  unreachable

8:                                                ; preds = %4
  %9 = tail call i32 @su2_tree_num_nodes(ptr noundef nonnull %0)
  %10 = sext i32 %9 to i64
  %11 = shl nsw i64 %10, 3
  %12 = tail call ptr @ct_malloc(i64 noundef %11)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %5, i8 0, i64 16, i1 false)
  call void @enqueue(ptr noundef nonnull %5, ptr noundef nonnull %0) #8
  %13 = call zeroext i1 @queue_is_empty(ptr noundef nonnull %5) #8
  br i1 %13, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %8, %22
  %indvars.iv = phi i64 [ %indvars.iv.next, %22 ], [ 0, %8 ]
  %14 = call ptr @dequeue(ptr noundef nonnull %5) #8
  %15 = getelementptr inbounds ptr, ptr %12, i64 %indvars.iv
  store ptr %14, ptr %15, align 8, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %16 = call zeroext i1 @su2_tree_node_is_leaf(ptr noundef %14)
  br i1 %16, label %22, label %17

17:                                               ; preds = %.lr.ph
  %18 = getelementptr inbounds i8, ptr %14, i64 8
  %19 = load ptr, ptr %18, align 8, !tbaa !5
  call void @enqueue(ptr noundef nonnull %5, ptr noundef %19) #8
  %20 = getelementptr inbounds i8, ptr %14, i64 16
  %21 = load ptr, ptr %20, align 8, !tbaa !5
  call void @enqueue(ptr noundef nonnull %5, ptr noundef %21) #8
  br label %22

22:                                               ; preds = %17, %.lr.ph
  %23 = call zeroext i1 @queue_is_empty(ptr noundef nonnull %5) #8
  br i1 %23, label %._crit_edge.loopexit, label %.lr.ph, !llvm.loop !9

._crit_edge.loopexit:                             ; preds = %22
  %24 = trunc nuw i64 %indvars.iv.next to i32
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %8
  %.041.lcssa = phi i32 [ 0, %8 ], [ %24, %._crit_edge.loopexit ]
  %25 = icmp eq i32 %.041.lcssa, %9
  br i1 %25, label %27, label %26

26:                                               ; preds = %._crit_edge
  call void @__assert_fail(ptr noundef nonnull @.str.11, ptr noundef nonnull @.str.1, i32 noundef 568, ptr noundef nonnull @__PRETTY_FUNCTION__.su2_tree_enumerate_charge_sectors) #7
  unreachable

27:                                               ; preds = %._crit_edge
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #8
  %28 = sext i32 %1 to i64
  %29 = call ptr @ct_calloc(i64 noundef %28, i64 noundef 4)
  %30 = icmp sgt i32 %9, 0
  br i1 %30, label %.lr.ph48.preheader, label %._crit_edge49

.lr.ph48.preheader:                               ; preds = %27
  %31 = zext nneg i32 %9 to i64
  br label %.lr.ph48

._crit_edge49:                                    ; preds = %.lr.ph48, %27
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %6, i8 0, i64 24, i1 false)
  %32 = shl nsw i64 %28, 2
  br label %36

.lr.ph48:                                         ; preds = %.lr.ph48.preheader, %.lr.ph48
  %indvars.iv60 = phi i64 [ %31, %.lr.ph48.preheader ], [ %indvars.iv.next61, %.lr.ph48 ]
  %indvars.iv.next61 = add nsw i64 %indvars.iv60, -1
  %33 = getelementptr inbounds ptr, ptr %12, i64 %indvars.iv.next61
  %34 = load ptr, ptr %33, align 8, !tbaa !5
  call void @su2_tree_node_reset_quantum_number(ptr noundef %34, ptr noundef %2, ptr noundef %29)
  %35 = icmp ugt i64 %indvars.iv60, 1
  br i1 %35, label %.lr.ph48, label %._crit_edge49, !llvm.loop !11

36:                                               ; preds = %36, %._crit_edge49
  %37 = call ptr @allocate_copy(ptr noundef %29, i64 noundef %32)
  call void @linked_list_append(ptr noundef nonnull %6, ptr noundef %37) #8
  %38 = call zeroext i1 @su2_tree_next_charge_sector(ptr noundef %12, i32 noundef %9, ptr noundef %2, ptr noundef %29)
  br i1 %38, label %36, label %39, !llvm.loop !12

39:                                               ; preds = %36
  %40 = getelementptr inbounds i8, ptr %6, i64 16
  %41 = load i64, ptr %40, align 8, !tbaa !13
  call void @allocate_charge_sectors(i64 noundef %41, i32 noundef %1, ptr noundef %3) #8
  %.050 = load ptr, ptr %6, align 8, !tbaa !5
  %.not4451 = icmp eq ptr %.050, null
  br i1 %.not4451, label %._crit_edge56, label %.lr.ph55

.lr.ph55:                                         ; preds = %39, %.lr.ph55
  %.053 = phi ptr [ %.0, %.lr.ph55 ], [ %.050, %39 ]
  %.03952 = phi i64 [ %47, %.lr.ph55 ], [ 0, %39 ]
  %42 = load ptr, ptr %3, align 8, !tbaa !16
  %43 = mul nsw i64 %.03952, %28
  %44 = getelementptr inbounds i32, ptr %42, i64 %43
  %45 = load ptr, ptr %.053, align 8, !tbaa !19
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %44, ptr align 1 %45, i64 %32, i1 false)
  %46 = getelementptr inbounds i8, ptr %.053, i64 16
  %47 = add nuw nsw i64 %.03952, 1
  %.0 = load ptr, ptr %46, align 8, !tbaa !5
  %.not44 = icmp eq ptr %.0, null
  br i1 %.not44, label %._crit_edge56, label %.lr.ph55, !llvm.loop !21

._crit_edge56:                                    ; preds = %.lr.ph55, %39
  %.039.lcssa = phi i64 [ 0, %39 ], [ %47, %.lr.ph55 ]
  %48 = load i64, ptr %40, align 8, !tbaa !13
  %49 = icmp eq i64 %.039.lcssa, %48
  br i1 %49, label %51, label %50

50:                                               ; preds = %._crit_edge56
  call void @__assert_fail(ptr noundef nonnull @.str.12, ptr noundef nonnull @.str.1, i32 noundef 595, ptr noundef nonnull @__PRETTY_FUNCTION__.su2_tree_enumerate_charge_sectors) #7
  unreachable

51:                                               ; preds = %._crit_edge56
  call void @delete_linked_list(ptr noundef nonnull %6, ptr noundef nonnull @ct_free) #8
  call void @ct_free(ptr noundef %29)
  call void @ct_free(ptr noundef %12)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #8
  ret void
}

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

declare void @enqueue(ptr noundef, ptr noundef) local_unnamed_addr #5

declare zeroext i1 @queue_is_empty(ptr noundef) local_unnamed_addr #5

declare ptr @dequeue(ptr noundef) local_unnamed_addr #5

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

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

declare void @linked_list_append(ptr noundef, ptr noundef) local_unnamed_addr #5

; Function Attrs: nounwind uwtable
declare hidden ptr @allocate_copy(ptr noundef, i64 noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @su2_tree_next_charge_sector(ptr noundef, i32 noundef, ptr noundef, ptr noalias noundef) local_unnamed_addr #3

declare void @allocate_charge_sectors(i64 noundef, i32 noundef, ptr noundef) local_unnamed_addr #5

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6

declare void @delete_linked_list(ptr noundef, ptr noundef) local_unnamed_addr #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 = { mustprogress 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { "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 #6 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { noreturn nounwind }
attributes #8 = { 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = !{!14, !15, i64 16}
!14 = !{!"linked_list", !6, i64 0, !6, i64 8, !15, i64 16}
!15 = !{!"long", !7, i64 0}
!16 = !{!17, !6, i64 0}
!17 = !{!"charge_sectors", !6, i64 0, !15, i64 8, !18, i64 16}
!18 = !{!"int", !7, i64 0}
!19 = !{!20, !6, i64 0}
!20 = !{!"linked_list_node", !6, i64 0, !6, i64 8, !6, i64 16}
!21 = distinct !{!21, !10}


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