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

; 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.anon = type { [1024 x ptr], %struct.quantum_cache_t, i64, i64, i8, i32, ptr }
%struct.quantum_cache_t = type { i32, ptr, ptr, i64, %struct.quantum_protection_t }
%struct.quantum_protection_t = type { ptr, i64, float, i8 }
%struct.ComplexFloat = type { float, float }
%struct.cache_entry = type { ptr, i64, i64, i8, i8, i64, %struct.quantum_protection_t, ptr }

@cache_state = external hidden global %struct.anon, align 8
@COMPLEX_FLOAT_ZERO = external hidden constant %struct.ComplexFloat, align 4
@COMPLEX_FLOAT_ONE = external hidden constant %struct.ComplexFloat, align 4

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

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

; Function Attrs: nounwind uwtable
define dso_local ptr @qg_cache_allocate(i64 noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  store i64 %0, ptr %3, align 8, !tbaa !5
  %11 = load i8, ptr getelementptr inbounds (%struct.anon, ptr @cache_state, i32 0, i32 4), align 8, !tbaa !9, !range !17, !noundef !18
  %12 = trunc i8 %11 to i1
  br i1 %12, label %13, label %16

13:                                               ; preds = %1
  %14 = load i64, ptr %3, align 8, !tbaa !5
  %15 = icmp eq i64 %14, 0
  br i1 %15, label %16, label %17

16:                                               ; preds = %13, %1
  store ptr null, ptr %2, align 8
  br label %135

17:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #7
  store ptr null, ptr %4, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  store ptr null, ptr %5, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  store i64 0, ptr %6, align 8, !tbaa !5
  %18 = load i32, ptr getelementptr inbounds (%struct.anon, ptr @cache_state, i32 0, i32 5), align 4, !tbaa !20
  switch i32 %18, label %65 [
    i32 0, label %19
    i32 1, label %19
    i32 2, label %19
    i32 3, label %19
    i32 4, label %19
  ]

19:                                               ; preds = %17, %17, %17, %17, %17
  %20 = load i64, ptr %3, align 8, !tbaa !5
  %21 = uitofp i64 %20 to double
  %22 = call double @log2(double noundef %21) #7
  %23 = call double @llvm.ceil.f64(double %22)
  %24 = fptoui double %23 to i64
  store i64 %24, ptr %6, align 8, !tbaa !5
  %25 = load i64, ptr %6, align 8, !tbaa !5
  %26 = mul i64 8, %25
  %27 = call noalias ptr @malloc(i64 noundef %26) #8
  store ptr %27, ptr %4, align 8, !tbaa !19
  %28 = load i64, ptr %6, align 8, !tbaa !5
  %29 = mul i64 8, %28
  %30 = call noalias ptr @malloc(i64 noundef %29) #8
  store ptr %30, ptr %5, align 8, !tbaa !19
  %31 = load ptr, ptr %4, align 8, !tbaa !19
  %32 = icmp ne ptr %31, null
  br i1 %32, label %33, label %36

33:                                               ; preds = %19
  %34 = load ptr, ptr %5, align 8, !tbaa !19
  %35 = icmp ne ptr %34, null
  br i1 %35, label %39, label %36

36:                                               ; preds = %33, %19
  %37 = load ptr, ptr %4, align 8, !tbaa !19
  call void @free(ptr noundef %37) #7
  %38 = load ptr, ptr %5, align 8, !tbaa !19
  call void @free(ptr noundef %38) #7
  store ptr null, ptr %2, align 8
  store i32 1, ptr %7, align 4
  br label %134

39:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  store i64 0, ptr %8, align 8, !tbaa !5
  br label %40

40:                                               ; preds = %49, %39
  %41 = load i64, ptr %8, align 8, !tbaa !5
  %42 = load i64, ptr %6, align 8, !tbaa !5
  %43 = icmp ult i64 %41, %42
  br i1 %43, label %45, label %44

44:                                               ; preds = %40
  store i32 3, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  br label %52

45:                                               ; preds = %40
  %46 = load ptr, ptr %4, align 8, !tbaa !19
  %47 = load i64, ptr %8, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.ComplexFloat, ptr %46, i64 %47
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %48, ptr align 4 @COMPLEX_FLOAT_ZERO, i64 8, i1 false), !tbaa.struct !21
  br label %49

49:                                               ; preds = %45
  %50 = load i64, ptr %8, align 8, !tbaa !5
  %51 = add i64 %50, 1
  store i64 %51, ptr %8, align 8, !tbaa !5
  br label %40, !llvm.loop !23

52:                                               ; preds = %44
  %53 = load ptr, ptr %4, align 8, !tbaa !19
  %54 = getelementptr inbounds %struct.ComplexFloat, ptr %53, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %54, ptr align 4 @COMPLEX_FLOAT_ONE, i64 8, i1 false), !tbaa.struct !21
  %55 = load ptr, ptr getelementptr inbounds (%struct.anon, ptr @cache_state, i32 0, i32 6), align 8, !tbaa !25
  %56 = load ptr, ptr %4, align 8, !tbaa !19
  %57 = load ptr, ptr %5, align 8, !tbaa !19
  %58 = load i64, ptr %6, align 8, !tbaa !5
  %59 = call i32 @geometric_execute_hardware(ptr noundef %55, ptr noundef %56, ptr noundef %57, i64 noundef %58)
  %60 = icmp ne i32 %59, 0
  br i1 %60, label %61, label %64

61:                                               ; preds = %52
  %62 = load ptr, ptr %4, align 8, !tbaa !19
  call void @free(ptr noundef %62) #7
  %63 = load ptr, ptr %5, align 8, !tbaa !19
  call void @free(ptr noundef %63) #7
  store ptr null, ptr %2, align 8
  store i32 1, ptr %7, align 4
  br label %134

64:                                               ; preds = %52
  br label %66

65:                                               ; preds = %17
  store ptr null, ptr %2, align 8
  store i32 1, ptr %7, align 4
  br label %134

66:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %67 = call noalias ptr @malloc(i64 noundef 72) #8
  store ptr %67, ptr %9, align 8, !tbaa !19
  %68 = load ptr, ptr %9, align 8, !tbaa !19
  %69 = icmp ne ptr %68, null
  br i1 %69, label %73, label %70

70:                                               ; preds = %66
  %71 = load ptr, ptr %4, align 8, !tbaa !19
  call void @free(ptr noundef %71) #7
  %72 = load ptr, ptr %5, align 8, !tbaa !19
  call void @free(ptr noundef %72) #7
  store ptr null, ptr %2, align 8
  store i32 1, ptr %7, align 4
  br label %133

73:                                               ; preds = %66
  %74 = load ptr, ptr %4, align 8, !tbaa !19
  %75 = load ptr, ptr %9, align 8, !tbaa !19
  %76 = getelementptr inbounds %struct.cache_entry, ptr %75, i32 0, i32 0
  store ptr %74, ptr %76, align 8, !tbaa !26
  %77 = load i64, ptr %3, align 8, !tbaa !5
  %78 = load ptr, ptr %9, align 8, !tbaa !19
  %79 = getelementptr inbounds %struct.cache_entry, ptr %78, i32 0, i32 1
  store i64 %77, ptr %79, align 8, !tbaa !28
  %80 = load ptr, ptr %4, align 8, !tbaa !19
  %81 = ptrtoint ptr %80 to i64
  %82 = load ptr, ptr %9, align 8, !tbaa !19
  %83 = getelementptr inbounds %struct.cache_entry, ptr %82, i32 0, i32 2
  store i64 %81, ptr %83, align 8, !tbaa !29
  %84 = load ptr, ptr %9, align 8, !tbaa !19
  %85 = getelementptr inbounds %struct.cache_entry, ptr %84, i32 0, i32 5
  store i64 0, ptr %85, align 8, !tbaa !30
  %86 = load ptr, ptr %9, align 8, !tbaa !19
  %87 = getelementptr inbounds %struct.cache_entry, ptr %86, i32 0, i32 7
  store ptr null, ptr %87, align 8, !tbaa !31
  %88 = load i8, ptr getelementptr inbounds (%struct.quantum_protection_t, ptr getelementptr inbounds (%struct.quantum_cache_t, ptr getelementptr inbounds (%struct.anon, ptr @cache_state, i32 0, i32 1), i32 0, i32 4), i32 0, i32 3), align 4, !tbaa !32, !range !17, !noundef !18
  %89 = trunc i8 %88 to i1
  br i1 %89, label %90, label %113

90:                                               ; preds = %73
  %91 = load ptr, ptr %9, align 8, !tbaa !19
  %92 = getelementptr inbounds %struct.cache_entry, ptr %91, i32 0, i32 6
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %92, ptr align 8 getelementptr inbounds (%struct.quantum_cache_t, ptr getelementptr inbounds (%struct.anon, ptr @cache_state, i32 0, i32 1), i32 0, i32 4), i64 24, i1 false), !tbaa.struct !33
  %93 = load i64, ptr %3, align 8, !tbaa !5
  %94 = mul i64 8, %93
  %95 = call noalias ptr @malloc(i64 noundef %94) #8
  %96 = load ptr, ptr %9, align 8, !tbaa !19
  %97 = getelementptr inbounds %struct.cache_entry, ptr %96, i32 0, i32 6
  %98 = getelementptr inbounds %struct.quantum_protection_t, ptr %97, i32 0, i32 0
  store ptr %95, ptr %98, align 8, !tbaa !35
  %99 = load i64, ptr %3, align 8, !tbaa !5
  %100 = load ptr, ptr %9, align 8, !tbaa !19
  %101 = getelementptr inbounds %struct.cache_entry, ptr %100, i32 0, i32 6
  %102 = getelementptr inbounds %struct.quantum_protection_t, ptr %101, i32 0, i32 1
  store i64 %99, ptr %102, align 8, !tbaa !36
  %103 = load ptr, ptr %9, align 8, !tbaa !19
  %104 = getelementptr inbounds %struct.cache_entry, ptr %103, i32 0, i32 6
  %105 = getelementptr inbounds %struct.quantum_protection_t, ptr %104, i32 0, i32 0
  %106 = load ptr, ptr %105, align 8, !tbaa !35
  %107 = icmp ne ptr %106, null
  br i1 %107, label %112, label %108

108:                                              ; preds = %90
  %109 = load ptr, ptr %4, align 8, !tbaa !19
  call void @free(ptr noundef %109) #7
  %110 = load ptr, ptr %5, align 8, !tbaa !19
  call void @free(ptr noundef %110) #7
  %111 = load ptr, ptr %9, align 8, !tbaa !19
  call void @free(ptr noundef %111) #7
  store ptr null, ptr %2, align 8
  store i32 1, ptr %7, align 4
  br label %133

112:                                              ; preds = %90
  br label %113

113:                                              ; preds = %112, %73
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  %114 = load ptr, ptr %9, align 8, !tbaa !19
  %115 = getelementptr inbounds %struct.cache_entry, ptr %114, i32 0, i32 2
  %116 = load i64, ptr %115, align 8, !tbaa !29
  %117 = urem i64 %116, 1024
  store i64 %117, ptr %10, align 8, !tbaa !5
  %118 = load i64, ptr %10, align 8, !tbaa !5
  %119 = getelementptr inbounds [1024 x ptr], ptr @cache_state, i64 0, i64 %118
  %120 = load ptr, ptr %119, align 8, !tbaa !19
  %121 = load ptr, ptr %9, align 8, !tbaa !19
  %122 = getelementptr inbounds %struct.cache_entry, ptr %121, i32 0, i32 7
  store ptr %120, ptr %122, align 8, !tbaa !31
  %123 = load ptr, ptr %9, align 8, !tbaa !19
  %124 = load i64, ptr %10, align 8, !tbaa !5
  %125 = getelementptr inbounds [1024 x ptr], ptr @cache_state, i64 0, i64 %124
  store ptr %123, ptr %125, align 8, !tbaa !19
  %126 = load i64, ptr %3, align 8, !tbaa !5
  %127 = load i64, ptr getelementptr inbounds (%struct.anon, ptr @cache_state, i32 0, i32 3), align 8, !tbaa !37
  %128 = add i64 %127, %126
  store i64 %128, ptr getelementptr inbounds (%struct.anon, ptr @cache_state, i32 0, i32 3), align 8, !tbaa !37
  %129 = load ptr, ptr %5, align 8, !tbaa !19
  call void @free(ptr noundef %129) #7
  %130 = load ptr, ptr %9, align 8, !tbaa !19
  %131 = getelementptr inbounds %struct.cache_entry, ptr %130, i32 0, i32 0
  %132 = load ptr, ptr %131, align 8, !tbaa !26
  store ptr %132, ptr %2, align 8
  store i32 1, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  br label %133

133:                                              ; preds = %113, %108, %70
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  br label %134

134:                                              ; preds = %133, %65, %61, %36
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #7
  br label %135

135:                                              ; preds = %134, %16
  %136 = load ptr, ptr %2, align 8
  ret ptr %136
}

; Function Attrs: nounwind
declare double @log2(double noundef) #2

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

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

; Function Attrs: nounwind
declare void @free(ptr noundef) #2

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

declare i32 @geometric_execute_hardware(ptr noundef, ptr noundef, ptr noundef, i64 noundef) #6

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { "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 #7 = { nounwind }
attributes #8 = { 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !16, i64 8264}
!10 = !{!"", !7, i64 0, !11, i64 8192, !6, i64 8248, !6, i64 8256, !16, i64 8264, !12, i64 8268, !13, i64 8272}
!11 = !{!"", !12, i64 0, !13, i64 8, !13, i64 16, !6, i64 24, !14, i64 32}
!12 = !{!"int", !7, i64 0}
!13 = !{!"any pointer", !7, i64 0}
!14 = !{!"", !13, i64 0, !6, i64 8, !15, i64 16, !16, i64 20}
!15 = !{!"float", !7, i64 0}
!16 = !{!"_Bool", !7, i64 0}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = !{!13, !13, i64 0}
!20 = !{!10, !12, i64 8268}
!21 = !{i64 0, i64 4, !22, i64 4, i64 4, !22}
!22 = !{!15, !15, i64 0}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}
!25 = !{!10, !13, i64 8272}
!26 = !{!27, !13, i64 0}
!27 = !{!"cache_entry", !13, i64 0, !6, i64 8, !6, i64 16, !16, i64 24, !16, i64 25, !6, i64 32, !14, i64 40, !13, i64 64}
!28 = !{!27, !6, i64 8}
!29 = !{!27, !6, i64 16}
!30 = !{!27, !6, i64 32}
!31 = !{!27, !13, i64 64}
!32 = !{!10, !16, i64 8244}
!33 = !{i64 0, i64 8, !19, i64 8, i64 8, !5, i64 16, i64 4, !22, i64 20, i64 1, !34}
!34 = !{!16, !16, i64 0}
!35 = !{!27, !13, i64 40}
!36 = !{!27, !6, i64 48}
!37 = !{!10, !6, i64 8256}


; 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.anon = type { [1024 x ptr], %struct.quantum_cache_t, i64, i64, i8, i32, ptr }
%struct.quantum_cache_t = type { i32, ptr, ptr, i64, %struct.quantum_protection_t }
%struct.quantum_protection_t = type { ptr, i64, float, i8 }
%struct.ComplexFloat = type { float, float }

@cache_state = external hidden local_unnamed_addr global %struct.anon, align 8
@COMPLEX_FLOAT_ZERO = external hidden local_unnamed_addr constant %struct.ComplexFloat, align 4
@COMPLEX_FLOAT_ONE = external hidden local_unnamed_addr constant %struct.ComplexFloat, align 4

; Function Attrs: nounwind uwtable
define dso_local noundef ptr @qg_cache_allocate(i64 noundef %0) local_unnamed_addr #0 {
  %2 = load i8, ptr getelementptr inbounds (i8, ptr @cache_state, i64 8264), align 8, !tbaa !5, !range !16, !noundef !17
  %3 = trunc nuw i8 %2 to i1
  %4 = icmp ne i64 %0, 0
  %or.cond.not = and i1 %4, %3
  %5 = load i32, ptr getelementptr inbounds (i8, ptr @cache_state, i64 8268), align 4
  %switch = icmp ult i32 %5, 5
  %or.cond = select i1 %or.cond.not, i1 %switch, i1 false
  br i1 %or.cond, label %6, label %50

6:                                                ; preds = %1
  %7 = uitofp i64 %0 to double
  %8 = tail call double @log2(double noundef %7) #7
  %9 = tail call double @llvm.ceil.f64(double %8)
  %10 = fptoui double %9 to i64
  %11 = shl i64 %10, 3
  %12 = tail call noalias ptr @malloc(i64 noundef %11) #8
  %13 = tail call noalias ptr @malloc(i64 noundef %11) #8
  %14 = icmp ne ptr %12, null
  %15 = icmp ne ptr %13, null
  %or.cond3 = and i1 %14, %15
  br i1 %or.cond3, label %.preheader, label %20

.preheader:                                       ; preds = %6
  %.not60 = icmp eq i64 %10, 0
  br i1 %.not60, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader
  %16 = load i64, ptr @COMPLEX_FLOAT_ZERO, align 4
  %min.iters.check = icmp ult i64 %10, 4
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

scalar.ph.preheader:                              ; preds = %middle.block, %.lr.ph
  %.05059.ph = phi i64 [ 0, %.lr.ph ], [ %n.vec, %middle.block ]
  br label %scalar.ph

vector.ph:                                        ; preds = %.lr.ph
  %n.vec = and i64 %10, -4
  %broadcast.splatinsert = insertelement <2 x i64> poison, i64 %16, i64 0
  %broadcast.splat = shufflevector <2 x i64> %broadcast.splatinsert, <2 x i64> poison, <2 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %17 = getelementptr inbounds %struct.ComplexFloat, ptr %12, i64 %index
  %18 = getelementptr inbounds i8, ptr %17, i64 16
  store <2 x i64> %broadcast.splat, ptr %17, align 4
  store <2 x i64> %broadcast.splat, ptr %18, align 4
  %index.next = add nuw i64 %index, 4
  %19 = icmp eq i64 %index.next, %n.vec
  br i1 %19, label %middle.block, label %vector.body, !llvm.loop !18

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %10
  br i1 %cmp.n, label %._crit_edge, label %scalar.ph.preheader

20:                                               ; preds = %6
  tail call void @free(ptr noundef %12) #7
  tail call void @free(ptr noundef %13) #7
  br label %50

._crit_edge:                                      ; preds = %scalar.ph, %middle.block, %.preheader
  %21 = load i64, ptr @COMPLEX_FLOAT_ONE, align 4
  store i64 %21, ptr %12, align 4
  %22 = load ptr, ptr getelementptr inbounds (i8, ptr @cache_state, i64 8272), align 8, !tbaa !22
  %23 = tail call i32 @geometric_execute_hardware(ptr noundef %22, ptr noundef nonnull %12, ptr noundef nonnull %13, i64 noundef %10) #7
  %.not = icmp eq i32 %23, 0
  br i1 %.not, label %27, label %26

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %.05059 = phi i64 [ %25, %scalar.ph ], [ %.05059.ph, %scalar.ph.preheader ]
  %24 = getelementptr inbounds %struct.ComplexFloat, ptr %12, i64 %.05059
  store i64 %16, ptr %24, align 4
  %25 = add nuw i64 %.05059, 1
  %exitcond.not = icmp eq i64 %25, %10
  br i1 %exitcond.not, label %._crit_edge, label %scalar.ph, !llvm.loop !23

26:                                               ; preds = %._crit_edge
  tail call void @free(ptr noundef nonnull %12) #7
  tail call void @free(ptr noundef %13) #7
  br label %50

27:                                               ; preds = %._crit_edge
  %28 = tail call noalias dereferenceable_or_null(72) ptr @malloc(i64 noundef 72) #8
  %.not57 = icmp eq ptr %28, null
  br i1 %.not57, label %29, label %30

29:                                               ; preds = %27
  tail call void @free(ptr noundef nonnull %12) #7
  tail call void @free(ptr noundef %13) #7
  br label %50

30:                                               ; preds = %27
  store ptr %12, ptr %28, align 8, !tbaa !24
  %31 = getelementptr inbounds i8, ptr %28, i64 8
  store i64 %0, ptr %31, align 8, !tbaa !26
  %32 = ptrtoint ptr %12 to i64
  %33 = getelementptr inbounds i8, ptr %28, i64 16
  store i64 %32, ptr %33, align 8, !tbaa !27
  %34 = getelementptr inbounds i8, ptr %28, i64 32
  store i64 0, ptr %34, align 8, !tbaa !28
  %35 = getelementptr inbounds i8, ptr %28, i64 64
  store ptr null, ptr %35, align 8, !tbaa !29
  %36 = load i8, ptr getelementptr inbounds (i8, ptr @cache_state, i64 8244), align 4, !tbaa !30, !range !16, !noundef !17
  %37 = trunc nuw i8 %36 to i1
  br i1 %37, label %38, label %44

38:                                               ; preds = %30
  %39 = getelementptr inbounds i8, ptr %28, i64 40
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %39, ptr noundef nonnull align 8 dereferenceable(24) getelementptr inbounds (i8, ptr @cache_state, i64 8224), i64 24, i1 false), !tbaa.struct !31
  %40 = shl i64 %0, 3
  %41 = tail call noalias ptr @malloc(i64 noundef %40) #8
  store ptr %41, ptr %39, align 8, !tbaa !36
  %42 = getelementptr inbounds i8, ptr %28, i64 48
  store i64 %0, ptr %42, align 8, !tbaa !37
  %.not58 = icmp eq ptr %41, null
  br i1 %.not58, label %43, label %44

43:                                               ; preds = %38
  tail call void @free(ptr noundef nonnull %12) #7
  tail call void @free(ptr noundef %13) #7
  tail call void @free(ptr noundef nonnull %28) #7
  br label %50

44:                                               ; preds = %38, %30
  %45 = and i64 %32, 1023
  %46 = getelementptr inbounds [1024 x ptr], ptr @cache_state, i64 0, i64 %45
  %47 = load ptr, ptr %46, align 8, !tbaa !32
  store ptr %47, ptr %35, align 8, !tbaa !29
  store ptr %28, ptr %46, align 8, !tbaa !32
  %48 = load i64, ptr getelementptr inbounds (i8, ptr @cache_state, i64 8256), align 8, !tbaa !38
  %49 = add i64 %48, %0
  store i64 %49, ptr getelementptr inbounds (i8, ptr @cache_state, i64 8256), align 8, !tbaa !38
  tail call void @free(ptr noundef %13) #7
  br label %50

50:                                               ; preds = %20, %26, %44, %43, %29, %1
  %.2 = phi ptr [ null, %1 ], [ null, %26 ], [ null, %20 ], [ %12, %44 ], [ null, %43 ], [ null, %29 ]
  ret ptr %.2
}

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.ceil.f64(double) #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

declare i32 @geometric_execute_hardware(ptr noundef, ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #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 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = { "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 #7 = { nounwind }
attributes #8 = { 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, !15, i64 8264}
!6 = !{!"", !7, i64 0, !9, i64 8192, !12, i64 8248, !12, i64 8256, !15, i64 8264, !10, i64 8268, !11, i64 8272}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"", !10, i64 0, !11, i64 8, !11, i64 16, !12, i64 24, !13, i64 32}
!10 = !{!"int", !7, i64 0}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!"", !11, i64 0, !12, i64 8, !14, i64 16, !15, i64 20}
!14 = !{!"float", !7, i64 0}
!15 = !{!"_Bool", !7, i64 0}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = distinct !{!18, !19, !20, !21}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!"llvm.loop.isvectorized", i32 1}
!21 = !{!"llvm.loop.unroll.runtime.disable"}
!22 = !{!6, !11, i64 8272}
!23 = distinct !{!23, !19, !21, !20}
!24 = !{!25, !11, i64 0}
!25 = !{!"cache_entry", !11, i64 0, !12, i64 8, !12, i64 16, !15, i64 24, !15, i64 25, !12, i64 32, !13, i64 40, !11, i64 64}
!26 = !{!25, !12, i64 8}
!27 = !{!25, !12, i64 16}
!28 = !{!25, !12, i64 32}
!29 = !{!25, !11, i64 64}
!30 = !{!6, !15, i64 8244}
!31 = !{i64 0, i64 8, !32, i64 8, i64 8, !33, i64 16, i64 4, !34, i64 20, i64 1, !35}
!32 = !{!11, !11, i64 0}
!33 = !{!12, !12, i64 0}
!34 = !{!14, !14, i64 0}
!35 = !{!15, !15, i64 0}
!36 = !{!25, !11, i64 40}
!37 = !{!25, !12, i64 48}
!38 = !{!6, !12, i64 8256}


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