; LLVM IR from tsotchke/quantum_geometric_tensor :: src/quantum_geometric/core (quantum_geometric_tensor)

; 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.ComplexFloat = type { float, float }
%struct.quantum_geometric_tensor_t = type { i32, ptr, i64, ptr, ptr, i8, i8, i8, i32, i64, i64 }

@.str = external hidden unnamed_addr constant [36 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [28 x i8], align 1

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

24:                                               ; preds = %4
  %25 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  store i32 -1, ptr %5, align 4
  br label %141

26:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  %27 = load ptr, ptr %8, align 8, !tbaa !5
  %28 = load i64, ptr %9, align 8, !tbaa !11
  %29 = call i32 @validate_dimensions(ptr noundef %27, i64 noundef %28)
  store i32 %29, ptr %10, align 4, !tbaa !9
  %30 = load i32, ptr %10, align 4, !tbaa !9
  %31 = icmp ne i32 %30, 0
  br i1 %31, label %32, label %36

32:                                               ; preds = %26
  %33 = load i32, ptr %10, align 4, !tbaa !9
  %34 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %33)
  %35 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %35, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %140

36:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  store i64 1, ptr %12, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  store i64 0, ptr %13, align 8, !tbaa !11
  br label %37

37:                                               ; preds = %49, %36
  %38 = load i64, ptr %13, align 8, !tbaa !11
  %39 = load i64, ptr %9, align 8, !tbaa !11
  %40 = icmp ult i64 %38, %39
  br i1 %40, label %42, label %41

41:                                               ; preds = %37
  store i32 2, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  br label %52

42:                                               ; preds = %37
  %43 = load ptr, ptr %8, align 8, !tbaa !5
  %44 = load i64, ptr %13, align 8, !tbaa !11
  %45 = getelementptr inbounds i64, ptr %43, i64 %44
  %46 = load i64, ptr %45, align 8, !tbaa !11
  %47 = load i64, ptr %12, align 8, !tbaa !11
  %48 = mul i64 %47, %46
  store i64 %48, ptr %12, align 8, !tbaa !11
  br label %49

49:                                               ; preds = %42
  %50 = load i64, ptr %13, align 8, !tbaa !11
  %51 = add i64 %50, 1
  store i64 %51, ptr %13, align 8, !tbaa !11
  br label %37, !llvm.loop !13

52:                                               ; preds = %41
  %53 = load i64, ptr %12, align 8, !tbaa !11
  %54 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i64 noundef %53)
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %55 = load i64, ptr %12, align 8, !tbaa !11
  %56 = add i64 %55, 7
  %57 = and i64 %56, -8
  store i64 %57, ptr %14, align 8, !tbaa !11
  %58 = load i64, ptr %14, align 8, !tbaa !11
  %59 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i64 noundef %58)
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  %60 = call noalias align 64 ptr @aligned_alloc(i64 noundef 64, i64 noundef 64) #8
  store ptr %60, ptr %15, align 8, !tbaa !5
  %61 = load ptr, ptr %15, align 8, !tbaa !5
  %62 = icmp ne ptr %61, null
  br i1 %62, label %65, label %63

63:                                               ; preds = %52
  %64 = call i32 (ptr, ...) @printf(ptr noundef @.str.5)
  store i32 -2, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %139

65:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  %66 = load i64, ptr %9, align 8, !tbaa !11
  %67 = mul i64 %66, 8
  %68 = call noalias ptr @malloc(i64 noundef %67) #9
  store ptr %68, ptr %16, align 8, !tbaa !5
  %69 = load ptr, ptr %16, align 8, !tbaa !5
  %70 = icmp ne ptr %69, null
  br i1 %70, label %74, label %71

71:                                               ; preds = %65
  %72 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  %73 = load ptr, ptr %15, align 8, !tbaa !5
  call void @free(ptr noundef %73) #7
  store i32 -2, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %138

74:                                               ; preds = %65
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #7
  %75 = load i64, ptr %14, align 8, !tbaa !11
  %76 = mul i64 %75, 8
  %77 = call noalias align 64 ptr @aligned_alloc(i64 noundef 64, i64 noundef %76) #8
  store ptr %77, ptr %17, align 8, !tbaa !5
  %78 = load ptr, ptr %17, align 8, !tbaa !5
  %79 = icmp ne ptr %78, null
  br i1 %79, label %84, label %80

80:                                               ; preds = %74
  %81 = call i32 (ptr, ...) @printf(ptr noundef @.str.7)
  %82 = load ptr, ptr %16, align 8, !tbaa !5
  call void @free(ptr noundef %82) #7
  %83 = load ptr, ptr %15, align 8, !tbaa !5
  call void @free(ptr noundef %83) #7
  store i32 -2, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %137

84:                                               ; preds = %74
  %85 = call i32 (ptr, ...) @printf(ptr noundef @.str.8)
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  store i64 0, ptr %18, align 8, !tbaa !11
  br label %86

86:                                               ; preds = %100, %84
  %87 = load i64, ptr %18, align 8, !tbaa !11
  %88 = load i64, ptr %14, align 8, !tbaa !11
  %89 = icmp ult i64 %87, %88
  br i1 %89, label %91, label %90

90:                                               ; preds = %86
  store i32 5, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  br label %103

91:                                               ; preds = %86
  %92 = load ptr, ptr %17, align 8, !tbaa !5
  %93 = load i64, ptr %18, align 8, !tbaa !11
  %94 = getelementptr inbounds %struct.ComplexFloat, ptr %92, i64 %93
  %95 = getelementptr inbounds %struct.ComplexFloat, ptr %94, i32 0, i32 0
  store float 0.000000e+00, ptr %95, align 4, !tbaa !15
  %96 = load ptr, ptr %17, align 8, !tbaa !5
  %97 = load i64, ptr %18, align 8, !tbaa !11
  %98 = getelementptr inbounds %struct.ComplexFloat, ptr %96, i64 %97
  %99 = getelementptr inbounds %struct.ComplexFloat, ptr %98, i32 0, i32 1
  store float 0.000000e+00, ptr %99, align 4, !tbaa !18
  br label %100

100:                                              ; preds = %91
  %101 = load i64, ptr %18, align 8, !tbaa !11
  %102 = add i64 %101, 1
  store i64 %102, ptr %18, align 8, !tbaa !11
  br label %86, !llvm.loop !19

103:                                              ; preds = %90
  %104 = call i32 (ptr, ...) @printf(ptr noundef @.str.9)
  %105 = load ptr, ptr %16, align 8, !tbaa !5
  %106 = load ptr, ptr %8, align 8, !tbaa !5
  %107 = load i64, ptr %9, align 8, !tbaa !11
  %108 = mul i64 %107, 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %105, ptr align 8 %106, i64 %108, i1 false)
  %109 = call i32 (ptr, ...) @printf(ptr noundef @.str.10)
  %110 = load ptr, ptr %16, align 8, !tbaa !5
  %111 = load ptr, ptr %15, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.quantum_geometric_tensor_t, ptr %111, i32 0, i32 1
  store ptr %110, ptr %112, align 8, !tbaa !20
  %113 = load ptr, ptr %17, align 8, !tbaa !5
  %114 = load ptr, ptr %15, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.quantum_geometric_tensor_t, ptr %114, i32 0, i32 3
  store ptr %113, ptr %115, align 8, !tbaa !23
  %116 = load i64, ptr %9, align 8, !tbaa !11
  %117 = load ptr, ptr %15, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.quantum_geometric_tensor_t, ptr %117, i32 0, i32 2
  store i64 %116, ptr %118, align 8, !tbaa !24
  %119 = load i64, ptr %12, align 8, !tbaa !11
  %120 = load ptr, ptr %15, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.quantum_geometric_tensor_t, ptr %120, i32 0, i32 9
  store i64 %119, ptr %121, align 8, !tbaa !25
  %122 = load i64, ptr %14, align 8, !tbaa !11
  %123 = load ptr, ptr %15, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.quantum_geometric_tensor_t, ptr %123, i32 0, i32 10
  store i64 %122, ptr %124, align 8, !tbaa !26
  %125 = call i32 (ptr, ...) @printf(ptr noundef @.str.11)
  %126 = load ptr, ptr %15, align 8, !tbaa !5
  %127 = load i32, ptr %7, align 4, !tbaa !9
  call void @initialize_tensor_properties(ptr noundef %126, i32 noundef %127)
  %128 = load ptr, ptr %15, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.quantum_geometric_tensor_t, ptr %128, i32 0, i32 7
  %130 = load i8, ptr %129, align 2, !tbaa !27, !range !28, !noundef !29
  %131 = trunc i8 %130 to i1
  %132 = zext i1 %131 to i32
  %133 = call i32 (ptr, ...) @printf(ptr noundef @.str.12, i32 noundef %132)
  %134 = load ptr, ptr %15, align 8, !tbaa !5
  %135 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %134, ptr %135, align 8, !tbaa !5
  %136 = call i32 (ptr, ...) @printf(ptr noundef @.str.13)
  store i32 0, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %137

137:                                              ; preds = %103, %80
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  br label %138

138:                                              ; preds = %137, %71
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  br label %139

139:                                              ; preds = %138, %63
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  br label %140

140:                                              ; preds = %139, %32
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %141

141:                                              ; preds = %140, %24
  %142 = load i32, ptr %5, align 4
  ret i32 %142
}

declare i32 @printf(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: nounwind uwtable
declare hidden i32 @validate_dimensions(ptr noundef, i64 noundef) #0

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

; Function Attrs: nounwind allocsize(1)
declare noalias ptr @aligned_alloc(i64 noundef, i64 noundef) #3

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #4

; Function Attrs: nounwind
declare void @free(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

; Function Attrs: nounwind uwtable
declare hidden void @initialize_tensor_properties(ptr noundef, i32 noundef) #0

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 = { "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 allocsize(1) "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 allocsize(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 #5 = { 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 #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nounwind }
attributes #8 = { nounwind allocsize(1) }
attributes #9 = { nounwind allocsize(0) }

!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, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !17, i64 0}
!16 = !{!"", !17, i64 0, !17, i64 4}
!17 = !{!"float", !7, i64 0}
!18 = !{!16, !17, i64 4}
!19 = distinct !{!19, !14}
!20 = !{!21, !6, i64 8}
!21 = !{!"quantum_geometric_tensor_t", !10, i64 0, !6, i64 8, !12, i64 16, !6, i64 24, !6, i64 32, !22, i64 40, !22, i64 41, !22, i64 42, !10, i64 44, !12, i64 48, !12, i64 56}
!22 = !{!"_Bool", !7, i64 0}
!23 = !{!21, !6, i64 24}
!24 = !{!21, !12, i64 16}
!25 = !{!21, !12, i64 48}
!26 = !{!21, !12, i64 56}
!27 = !{!21, !22, i64 42}
!28 = !{i8 0, i8 2}
!29 = !{}


; 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 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [28 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @geometric_tensor_create(ptr noundef writeonly %0, i32 noundef %1, ptr noundef %2, i64 noundef %3) local_unnamed_addr #0 {
  %5 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1, i64 noundef %3)
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %6, label %8

6:                                                ; preds = %4
  %7 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  br label %83

8:                                                ; preds = %4
  %9 = tail call i32 @validate_dimensions(ptr noundef %2, i64 noundef %3)
  %.not60 = icmp eq i32 %9, 0
  br i1 %.not60, label %.preheader, label %11

.preheader:                                       ; preds = %8
  %.not70 = icmp eq i64 %3, 0
  br i1 %.not70, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.preheader
  %xtraiter = and i64 %3, 7
  %10 = icmp ult i64 %3, 8
  br i1 %10, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.preheader.new

.lr.ph.preheader.new:                             ; preds = %.lr.ph.preheader
  %unroll_iter = and i64 %3, -8
  br label %.lr.ph

11:                                               ; preds = %8
  %12 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %9)
  br label %83

._crit_edge.loopexit.unr-lcssa:                   ; preds = %.lr.ph, %.lr.ph.preheader
  %.lcssa.ph = phi i64 [ poison, %.lr.ph.preheader ], [ %52, %.lr.ph ]
  %.05165.unr = phi i64 [ 1, %.lr.ph.preheader ], [ %52, %.lr.ph ]
  %.05264.unr = phi i64 [ 0, %.lr.ph.preheader ], [ %53, %.lr.ph ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %.lr.ph.epil
  %.05165.epil = phi i64 [ %15, %.lr.ph.epil ], [ %.05165.unr, %._crit_edge.loopexit.unr-lcssa ]
  %.05264.epil = phi i64 [ %16, %.lr.ph.epil ], [ %.05264.unr, %._crit_edge.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph.epil ], [ 0, %._crit_edge.loopexit.unr-lcssa ]
  %13 = getelementptr inbounds i64, ptr %2, i64 %.05264.epil
  %14 = load i64, ptr %13, align 8, !tbaa !5
  %15 = mul i64 %14, %.05165.epil
  %16 = add nuw i64 %.05264.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge, label %.lr.ph.epil, !llvm.loop !9

._crit_edge:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %.lr.ph.epil, %.preheader
  %.051.lcssa = phi i64 [ 1, %.preheader ], [ %.lcssa.ph, %._crit_edge.loopexit.unr-lcssa ], [ %15, %.lr.ph.epil ]
  %17 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %.051.lcssa)
  %18 = add i64 %.051.lcssa, 7
  %19 = and i64 %18, -8
  %20 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i64 noundef %19)
  %21 = tail call noalias align 64 dereferenceable_or_null(64) ptr @aligned_alloc(i64 noundef 64, i64 noundef 64) #7
  %.not61 = icmp eq ptr %21, null
  br i1 %.not61, label %54, label %56

.lr.ph:                                           ; preds = %.lr.ph, %.lr.ph.preheader.new
  %.05165 = phi i64 [ 1, %.lr.ph.preheader.new ], [ %52, %.lr.ph ]
  %.05264 = phi i64 [ 0, %.lr.ph.preheader.new ], [ %53, %.lr.ph ]
  %niter = phi i64 [ 0, %.lr.ph.preheader.new ], [ %niter.next.7, %.lr.ph ]
  %22 = getelementptr inbounds i64, ptr %2, i64 %.05264
  %23 = load i64, ptr %22, align 8, !tbaa !5
  %24 = mul i64 %23, %.05165
  %25 = or disjoint i64 %.05264, 1
  %26 = getelementptr inbounds i64, ptr %2, i64 %25
  %27 = load i64, ptr %26, align 8, !tbaa !5
  %28 = mul i64 %27, %24
  %29 = or disjoint i64 %.05264, 2
  %30 = getelementptr inbounds i64, ptr %2, i64 %29
  %31 = load i64, ptr %30, align 8, !tbaa !5
  %32 = mul i64 %31, %28
  %33 = or disjoint i64 %.05264, 3
  %34 = getelementptr inbounds i64, ptr %2, i64 %33
  %35 = load i64, ptr %34, align 8, !tbaa !5
  %36 = mul i64 %35, %32
  %37 = or disjoint i64 %.05264, 4
  %38 = getelementptr inbounds i64, ptr %2, i64 %37
  %39 = load i64, ptr %38, align 8, !tbaa !5
  %40 = mul i64 %39, %36
  %41 = or disjoint i64 %.05264, 5
  %42 = getelementptr inbounds i64, ptr %2, i64 %41
  %43 = load i64, ptr %42, align 8, !tbaa !5
  %44 = mul i64 %43, %40
  %45 = or disjoint i64 %.05264, 6
  %46 = getelementptr inbounds i64, ptr %2, i64 %45
  %47 = load i64, ptr %46, align 8, !tbaa !5
  %48 = mul i64 %47, %44
  %49 = or disjoint i64 %.05264, 7
  %50 = getelementptr inbounds i64, ptr %2, i64 %49
  %51 = load i64, ptr %50, align 8, !tbaa !5
  %52 = mul i64 %51, %48
  %53 = add nuw i64 %.05264, 8
  %niter.next.7 = add i64 %niter, 8
  %niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
  br i1 %niter.ncmp.7, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph, !llvm.loop !11

54:                                               ; preds = %._crit_edge
  %55 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5)
  br label %83

56:                                               ; preds = %._crit_edge
  %57 = shl i64 %3, 3
  %58 = tail call noalias ptr @malloc(i64 noundef %57) #8
  %.not62 = icmp eq ptr %58, null
  br i1 %.not62, label %59, label %61

59:                                               ; preds = %56
  %60 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6)
  tail call void @free(ptr noundef nonnull %21) #9
  br label %83

61:                                               ; preds = %56
  %62 = shl i64 %19, 3
  %63 = tail call noalias align 64 ptr @aligned_alloc(i64 noundef 64, i64 noundef %62) #7
  %.not63 = icmp eq ptr %63, null
  br i1 %.not63, label %64, label %66

64:                                               ; preds = %61
  %65 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7)
  tail call void @free(ptr noundef nonnull %58) #9
  tail call void @free(ptr noundef nonnull %21) #9
  br label %83

66:                                               ; preds = %61
  %67 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8)
  %.not71 = icmp eq i64 %19, 0
  br i1 %.not71, label %._crit_edge69, label %.lr.ph68.preheader

.lr.ph68.preheader:                               ; preds = %66
  %68 = shl i64 %18, 3
  %69 = and i64 %68, -64
  tail call void @llvm.memset.p0.i64(ptr nonnull align 64 %63, i8 0, i64 %69, i1 false), !tbaa !13
  br label %._crit_edge69

._crit_edge69:                                    ; preds = %.lr.ph68.preheader, %66
  %70 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9)
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 8 %58, ptr align 8 %2, i64 %57, i1 false)
  %71 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10)
  %72 = getelementptr inbounds i8, ptr %21, i64 8
  store ptr %58, ptr %72, align 8, !tbaa !15
  %73 = getelementptr inbounds i8, ptr %21, i64 24
  store ptr %63, ptr %73, align 8, !tbaa !20
  %74 = getelementptr inbounds i8, ptr %21, i64 16
  store i64 %3, ptr %74, align 16, !tbaa !21
  %75 = getelementptr inbounds i8, ptr %21, i64 48
  store i64 %.051.lcssa, ptr %75, align 16, !tbaa !22
  %76 = getelementptr inbounds i8, ptr %21, i64 56
  store i64 %19, ptr %76, align 8, !tbaa !23
  %77 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11)
  tail call void @initialize_tensor_properties(ptr noundef nonnull %21, i32 noundef %1)
  %78 = getelementptr inbounds i8, ptr %21, i64 42
  %79 = load i8, ptr %78, align 2, !tbaa !24, !range !25, !noundef !26
  %80 = zext nneg i8 %79 to i32
  %81 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.12, i32 noundef %80)
  store ptr %21, ptr %0, align 8, !tbaa !27
  %82 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.13)
  br label %83

83:                                               ; preds = %11, %59, %._crit_edge69, %64, %54, %6
  %.4 = phi i32 [ -1, %6 ], [ %9, %11 ], [ -2, %54 ], [ -2, %59 ], [ 0, %._crit_edge69 ], [ -2, %64 ]
  ret i32 %.4
}

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden i32 @validate_dimensions(ptr noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized,aligned") allocsize(1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @aligned_alloc(i64 allocalign noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4

; 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) #5

; Function Attrs: nounwind uwtable
declare hidden void @initialize_tensor_properties(ptr noundef, i32 noundef) local_unnamed_addr #0

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

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 = { nofree 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 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized,aligned") allocsize(1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { nounwind allocsize(1) }
attributes #8 = { nounwind allocsize(0) }
attributes #9 = { 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.unroll.disable"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"float", !7, i64 0}
!15 = !{!16, !18, i64 8}
!16 = !{!"quantum_geometric_tensor_t", !17, i64 0, !18, i64 8, !6, i64 16, !18, i64 24, !18, i64 32, !19, i64 40, !19, i64 41, !19, i64 42, !17, i64 44, !6, i64 48, !6, i64 56}
!17 = !{!"int", !7, i64 0}
!18 = !{!"any pointer", !7, i64 0}
!19 = !{!"_Bool", !7, i64 0}
!20 = !{!16, !18, i64 24}
!21 = !{!16, !6, i64 16}
!22 = !{!16, !6, i64 48}
!23 = !{!16, !6, i64 56}
!24 = !{!16, !19, i64 42}
!25 = !{i8 0, i8 2}
!26 = !{}
!27 = !{!18, !18, i64 0}


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