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

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

@lapack_state = external hidden global %struct.anon, align 8

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @initialize_lapack() #0

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

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @lapack_eigendecomposition(ptr noundef %0, i64 noundef %1, ptr noundef %2, ptr noundef %3, i32 noundef %4) #0 {
  %6 = alloca i1, align 1
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i8, align 1
  %15 = alloca i8, align 1
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca %struct.ComplexFloat, align 4
  %22 = alloca i32, align 4
  %23 = alloca ptr, align 8
  %24 = alloca i64, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i64 %1, ptr %8, align 8, !tbaa !9
  store ptr %2, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !5
  store i32 %4, ptr %11, align 4, !tbaa !11
  %25 = call zeroext i1 @initialize_lapack()
  br i1 %25, label %26, label %38

26:                                               ; preds = %5
  %27 = load ptr, ptr %7, align 8, !tbaa !5
  %28 = icmp ne ptr %27, null
  br i1 %28, label %29, label %38

29:                                               ; preds = %26
  %30 = load ptr, ptr %9, align 8, !tbaa !5
  %31 = icmp ne ptr %30, null
  br i1 %31, label %32, label %38

32:                                               ; preds = %29
  %33 = load ptr, ptr %10, align 8, !tbaa !5
  %34 = icmp ne ptr %33, null
  br i1 %34, label %35, label %38

35:                                               ; preds = %32
  %36 = load i64, ptr %8, align 8, !tbaa !9
  %37 = icmp eq i64 %36, 0
  br i1 %37, label %38, label %39

38:                                               ; preds = %35, %32, %29, %26, %5
  store i32 -1, ptr @lapack_state, align 8, !tbaa !13
  store i1 false, ptr %6, align 1
  br label %143

39:                                               ; preds = %35
  %40 = load ptr, ptr %7, align 8, !tbaa !5
  %41 = load i64, ptr %8, align 8, !tbaa !9
  %42 = call zeroext i1 @is_hermitian(ptr noundef %40, i64 noundef %41)
  br i1 %42, label %44, label %43

43:                                               ; preds = %39
  store i32 -1, ptr @lapack_state, align 8, !tbaa !13
  store i1 false, ptr %6, align 1
  br label %143

44:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %45 = load i64, ptr %8, align 8, !tbaa !9
  %46 = load i64, ptr %8, align 8, !tbaa !9
  %47 = mul i64 %45, %46
  %48 = mul i64 %47, 8
  %49 = call noalias ptr @malloc(i64 noundef %48) #7
  store ptr %49, ptr %12, align 8, !tbaa !5
  %50 = load ptr, ptr %12, align 8, !tbaa !5
  %51 = icmp ne ptr %50, null
  br i1 %51, label %53, label %52

52:                                               ; preds = %44
  store i32 -2, ptr @lapack_state, align 8, !tbaa !13
  store i1 false, ptr %6, align 1
  store i32 1, ptr %13, align 4
  br label %142

53:                                               ; preds = %44
  %54 = load ptr, ptr %12, align 8, !tbaa !5
  %55 = load ptr, ptr %7, align 8, !tbaa !5
  %56 = load i64, ptr %8, align 8, !tbaa !9
  %57 = load i64, ptr %8, align 8, !tbaa !9
  %58 = load i32, ptr %11, align 4, !tbaa !11
  call void @convert_layout(ptr noundef %54, ptr noundef %55, i64 noundef %56, i64 noundef %57, i32 noundef %58, i32 noundef 102)
  call void @llvm.lifetime.start.p0(i64 1, ptr %14) #6
  store i8 86, ptr %14, align 1, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 1, ptr %15) #6
  store i8 85, ptr %15, align 1, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  %59 = load i64, ptr %8, align 8, !tbaa !9
  %60 = trunc i64 %59 to i32
  store i32 %60, ptr %16, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  %61 = load i32, ptr %16, align 4, !tbaa !11
  store i32 %61, ptr %17, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #6
  %62 = load i64, ptr %8, align 8, !tbaa !9
  %63 = mul i64 %62, 4
  %64 = call noalias ptr @malloc(i64 noundef %63) #7
  store ptr %64, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #6
  %65 = load i64, ptr %8, align 8, !tbaa !9
  %66 = mul i64 3, %65
  %67 = mul i64 %66, 4
  %68 = call noalias ptr @malloc(i64 noundef %67) #7
  store ptr %68, ptr %20, align 8, !tbaa !5
  %69 = load ptr, ptr %19, align 8, !tbaa !5
  %70 = icmp ne ptr %69, null
  br i1 %70, label %71, label %74

71:                                               ; preds = %53
  %72 = load ptr, ptr %20, align 8, !tbaa !5
  %73 = icmp ne ptr %72, null
  br i1 %73, label %78, label %74

74:                                               ; preds = %71, %53
  %75 = load ptr, ptr %19, align 8, !tbaa !5
  call void @free(ptr noundef %75) #6
  %76 = load ptr, ptr %20, align 8, !tbaa !5
  call void @free(ptr noundef %76) #6
  %77 = load ptr, ptr %12, align 8, !tbaa !5
  call void @free(ptr noundef %77) #6
  store i32 -2, ptr @lapack_state, align 8, !tbaa !13
  store i1 false, ptr %6, align 1
  store i32 1, ptr %13, align 4
  br label %141

78:                                               ; preds = %71
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #6
  store i32 -1, ptr %22, align 4, !tbaa !11
  %79 = load ptr, ptr %12, align 8, !tbaa !5
  %80 = load ptr, ptr %19, align 8, !tbaa !5
  %81 = load ptr, ptr %20, align 8, !tbaa !5
  call void @cheev_(ptr noundef %14, ptr noundef %15, ptr noundef %16, ptr noundef %79, ptr noundef %17, ptr noundef %80, ptr noundef %21, ptr noundef %22, ptr noundef %81, ptr noundef %18)
  %82 = getelementptr inbounds %struct.ComplexFloat, ptr %21, i32 0, i32 0
  %83 = load float, ptr %82, align 4, !tbaa !17
  %84 = fptosi float %83 to i32
  store i32 %84, ptr %22, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #6
  %85 = load i32, ptr %22, align 4, !tbaa !11
  %86 = sext i32 %85 to i64
  %87 = mul i64 %86, 8
  %88 = call noalias ptr @malloc(i64 noundef %87) #7
  store ptr %88, ptr %23, align 8, !tbaa !5
  %89 = load ptr, ptr %23, align 8, !tbaa !5
  %90 = icmp ne ptr %89, null
  br i1 %90, label %95, label %91

91:                                               ; preds = %78
  %92 = load ptr, ptr %19, align 8, !tbaa !5
  call void @free(ptr noundef %92) #6
  %93 = load ptr, ptr %20, align 8, !tbaa !5
  call void @free(ptr noundef %93) #6
  %94 = load ptr, ptr %12, align 8, !tbaa !5
  call void @free(ptr noundef %94) #6
  store i32 -2, ptr @lapack_state, align 8, !tbaa !13
  store i1 false, ptr %6, align 1
  store i32 1, ptr %13, align 4
  br label %140

95:                                               ; preds = %78
  %96 = load ptr, ptr %12, align 8, !tbaa !5
  %97 = load ptr, ptr %19, align 8, !tbaa !5
  %98 = load ptr, ptr %23, align 8, !tbaa !5
  %99 = load ptr, ptr %20, align 8, !tbaa !5
  call void @cheev_(ptr noundef %14, ptr noundef %15, ptr noundef %16, ptr noundef %96, ptr noundef %17, ptr noundef %97, ptr noundef %98, ptr noundef %22, ptr noundef %99, ptr noundef %18)
  %100 = load ptr, ptr %9, align 8, !tbaa !5
  %101 = load ptr, ptr %12, align 8, !tbaa !5
  %102 = load i64, ptr %8, align 8, !tbaa !9
  %103 = load i64, ptr %8, align 8, !tbaa !9
  %104 = mul i64 %102, %103
  %105 = mul i64 %104, 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %100, ptr align 4 %101, i64 %105, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #6
  store i64 0, ptr %24, align 8, !tbaa !9
  br label %106

106:                                              ; preds = %124, %95
  %107 = load i64, ptr %24, align 8, !tbaa !9
  %108 = load i64, ptr %8, align 8, !tbaa !9
  %109 = icmp ult i64 %107, %108
  br i1 %109, label %111, label %110

110:                                              ; preds = %106
  store i32 2, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #6
  br label %127

111:                                              ; preds = %106
  %112 = load ptr, ptr %19, align 8, !tbaa !5
  %113 = load i64, ptr %24, align 8, !tbaa !9
  %114 = getelementptr inbounds float, ptr %112, i64 %113
  %115 = load float, ptr %114, align 4, !tbaa !20
  %116 = load ptr, ptr %10, align 8, !tbaa !5
  %117 = load i64, ptr %24, align 8, !tbaa !9
  %118 = getelementptr inbounds %struct.ComplexFloat, ptr %116, i64 %117
  %119 = getelementptr inbounds %struct.ComplexFloat, ptr %118, i32 0, i32 0
  store float %115, ptr %119, align 4, !tbaa !17
  %120 = load ptr, ptr %10, align 8, !tbaa !5
  %121 = load i64, ptr %24, align 8, !tbaa !9
  %122 = getelementptr inbounds %struct.ComplexFloat, ptr %120, i64 %121
  %123 = getelementptr inbounds %struct.ComplexFloat, ptr %122, i32 0, i32 1
  store float 0.000000e+00, ptr %123, align 4, !tbaa !21
  br label %124

124:                                              ; preds = %111
  %125 = load i64, ptr %24, align 8, !tbaa !9
  %126 = add i64 %125, 1
  store i64 %126, ptr %24, align 8, !tbaa !9
  br label %106, !llvm.loop !22

127:                                              ; preds = %110
  %128 = load ptr, ptr %23, align 8, !tbaa !5
  call void @free(ptr noundef %128) #6
  %129 = load ptr, ptr %20, align 8, !tbaa !5
  call void @free(ptr noundef %129) #6
  %130 = load ptr, ptr %19, align 8, !tbaa !5
  call void @free(ptr noundef %130) #6
  %131 = load ptr, ptr %12, align 8, !tbaa !5
  call void @free(ptr noundef %131) #6
  %132 = load i32, ptr %18, align 4, !tbaa !11
  %133 = icmp ne i32 %132, 0
  br i1 %133, label %134, label %139

134:                                              ; preds = %127
  %135 = load i32, ptr %18, align 4, !tbaa !11
  %136 = icmp sgt i32 %135, 0
  %137 = zext i1 %136 to i64
  %138 = select i1 %136, i32 -4, i32 -1
  store i32 %138, ptr @lapack_state, align 8, !tbaa !13
  store i1 false, ptr %6, align 1
  store i32 1, ptr %13, align 4
  br label %140

139:                                              ; preds = %127
  store i32 0, ptr @lapack_state, align 8, !tbaa !13
  store i1 true, ptr %6, align 1
  store i32 1, ptr %13, align 4
  br label %140

140:                                              ; preds = %139, %134, %91
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  br label %141

141:                                              ; preds = %140, %74
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #6
  br label %142

142:                                              ; preds = %141, %52
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  br label %143

143:                                              ; preds = %142, %43, %38
  %144 = load i1, ptr %6, align 1
  ret i1 %144
}

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @is_hermitian(ptr noundef, i64 noundef) #0

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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { nounwind }
attributes #7 = { 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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !12, i64 0}
!14 = !{!"", !12, i64 0, !15, i64 4, !10, i64 8, !6, i64 16}
!15 = !{!"_Bool", !7, i64 0}
!16 = !{!7, !7, i64 0}
!17 = !{!18, !19, i64 0}
!18 = !{!"", !19, i64 0, !19, i64 4}
!19 = !{!"float", !7, i64 0}
!20 = !{!19, !19, i64 0}
!21 = !{!18, !19, i64 4}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.anon = type { i32, i8, i64, ptr }
%struct.ComplexFloat = type { float, float }

@lapack_state = external hidden local_unnamed_addr global %struct.anon, align 8

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @initialize_lapack() local_unnamed_addr #0

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

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local noundef zeroext i1 @lapack_eigendecomposition(ptr noundef %0, i64 noundef %1, ptr noundef writeonly %2, ptr noundef writeonly %3, i32 noundef %4) local_unnamed_addr #0 {
  %6 = alloca i8, align 1
  %7 = alloca i8, align 1
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca %struct.ComplexFloat, align 4
  %12 = alloca i32, align 4
  %13 = tail call zeroext i1 @initialize_lapack()
  %14 = icmp ne ptr %0, null
  %or.cond = and i1 %14, %13
  %15 = icmp ne ptr %2, null
  %or.cond3 = and i1 %15, %or.cond
  %16 = icmp ne ptr %3, null
  %or.cond5 = and i1 %16, %or.cond3
  %17 = icmp ne i64 %1, 0
  %or.cond7.not = and i1 %17, %or.cond5
  br i1 %or.cond7.not, label %19, label %18

18:                                               ; preds = %5
  store i32 -1, ptr @lapack_state, align 8, !tbaa !5
  br label %61

19:                                               ; preds = %5
  %20 = tail call zeroext i1 @is_hermitian(ptr noundef nonnull %0, i64 noundef %1)
  br i1 %20, label %22, label %21

21:                                               ; preds = %19
  store i32 -1, ptr @lapack_state, align 8, !tbaa !5
  br label %61

22:                                               ; preds = %19
  %23 = shl i64 %1, 3
  %24 = mul i64 %23, %1
  %25 = tail call noalias ptr @malloc(i64 noundef %24) #6
  %.not = icmp eq ptr %25, null
  br i1 %.not, label %26, label %27

26:                                               ; preds = %22
  store i32 -2, ptr @lapack_state, align 8, !tbaa !5
  br label %61

27:                                               ; preds = %22
  tail call void @convert_layout(ptr noundef nonnull %25, ptr noundef nonnull %0, i64 noundef %1, i64 noundef %1, i32 noundef %4, i32 noundef 102)
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %6) #7
  store i8 86, ptr %6, align 1, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %7) #7
  store i8 85, ptr %7, align 1, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #7
  %28 = trunc i64 %1 to i32
  store i32 %28, ptr %8, align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #7
  store i32 %28, ptr %9, align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #7
  %29 = shl i64 %1, 2
  %30 = tail call noalias ptr @malloc(i64 noundef %29) #6
  %31 = mul i64 %1, 12
  %32 = tail call noalias ptr @malloc(i64 noundef %31) #6
  %33 = icmp ne ptr %30, null
  %34 = icmp ne ptr %32, null
  %or.cond9 = and i1 %33, %34
  br i1 %or.cond9, label %36, label %35

35:                                               ; preds = %27
  tail call void @free(ptr noundef %30) #7
  tail call void @free(ptr noundef %32) #7
  tail call void @free(ptr noundef nonnull %25) #7
  store i32 -2, ptr @lapack_state, align 8, !tbaa !5
  br label %60

36:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %12) #7
  store i32 -1, ptr %12, align 4, !tbaa !14
  call void @cheev_(ptr noundef nonnull %6, ptr noundef nonnull %7, ptr noundef nonnull %8, ptr noundef nonnull %25, ptr noundef nonnull %9, ptr noundef nonnull %30, ptr noundef nonnull %11, ptr noundef nonnull %12, ptr noundef nonnull %32, ptr noundef nonnull %10) #7
  %37 = load float, ptr %11, align 4, !tbaa !15
  %38 = fptosi float %37 to i32
  store i32 %38, ptr %12, align 4, !tbaa !14
  %39 = sext i32 %38 to i64
  %40 = shl nsw i64 %39, 3
  %41 = call noalias ptr @malloc(i64 noundef %40) #6
  %.not66 = icmp eq ptr %41, null
  br i1 %.not66, label %42, label %43

42:                                               ; preds = %36
  call void @free(ptr noundef nonnull %30) #7
  call void @free(ptr noundef nonnull %32) #7
  call void @free(ptr noundef nonnull %25) #7
  br label %59

43:                                               ; preds = %36
  call void @cheev_(ptr noundef nonnull %6, ptr noundef nonnull %7, ptr noundef nonnull %8, ptr noundef nonnull %25, ptr noundef nonnull %9, ptr noundef nonnull %30, ptr noundef nonnull %41, ptr noundef nonnull %12, ptr noundef nonnull %32, ptr noundef nonnull %10) #7
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 4 %2, ptr nonnull align 4 %25, i64 %24, i1 false)
  %min.iters.check = icmp ult i64 %1, 4
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

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

vector.ph:                                        ; preds = %43
  %n.vec = and i64 %1, -4
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %44 = or disjoint i64 %index, 2
  %45 = getelementptr inbounds float, ptr %30, i64 %index
  %46 = getelementptr inbounds i8, ptr %45, i64 8
  %wide.load = load <2 x float>, ptr %45, align 4, !tbaa !18
  %wide.load69 = load <2 x float>, ptr %46, align 4, !tbaa !18
  %47 = getelementptr inbounds %struct.ComplexFloat, ptr %3, i64 %index
  %48 = getelementptr inbounds %struct.ComplexFloat, ptr %3, i64 %44
  %interleaved.vec = shufflevector <2 x float> %wide.load, <2 x float> zeroinitializer, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
  store <4 x float> %interleaved.vec, ptr %47, align 4, !tbaa !18
  %interleaved.vec70 = shufflevector <2 x float> %wide.load69, <2 x float> zeroinitializer, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
  store <4 x float> %interleaved.vec70, ptr %48, align 4, !tbaa !18
  %index.next = add nuw i64 %index, 4
  %49 = icmp eq i64 %index.next, %n.vec
  br i1 %49, label %middle.block, label %vector.body, !llvm.loop !19

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

.loopexit:                                        ; preds = %scalar.ph, %middle.block
  call void @free(ptr noundef %41) #7
  call void @free(ptr noundef %32) #7
  call void @free(ptr noundef nonnull %30) #7
  call void @free(ptr noundef %25) #7
  %50 = load i32, ptr %10, align 4, !tbaa !14
  %.not67 = icmp eq i32 %50, 0
  br i1 %.not67, label %59, label %56

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %.068 = phi i64 [ %55, %scalar.ph ], [ %.068.ph, %scalar.ph.preheader ]
  %51 = getelementptr inbounds float, ptr %30, i64 %.068
  %52 = load float, ptr %51, align 4, !tbaa !18
  %53 = getelementptr inbounds %struct.ComplexFloat, ptr %3, i64 %.068
  store float %52, ptr %53, align 4, !tbaa !15
  %54 = getelementptr inbounds i8, ptr %53, i64 4
  store float 0.000000e+00, ptr %54, align 4, !tbaa !23
  %55 = add nuw i64 %.068, 1
  %exitcond.not = icmp eq i64 %55, %1
  br i1 %exitcond.not, label %.loopexit, label %scalar.ph, !llvm.loop !24

56:                                               ; preds = %.loopexit
  %57 = icmp sgt i32 %50, 0
  %58 = select i1 %57, i32 -4, i32 -1
  br label %59

59:                                               ; preds = %.loopexit, %56, %42
  %.sink = phi i32 [ %58, %56 ], [ -2, %42 ], [ 0, %.loopexit ]
  %.059 = phi i1 [ false, %56 ], [ false, %42 ], [ true, %.loopexit ]
  store i32 %.sink, ptr @lapack_state, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #7
  br label %60

60:                                               ; preds = %59, %35
  %.1 = phi i1 [ %.059, %59 ], [ false, %35 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #7
  br label %61

61:                                               ; preds = %26, %60, %21, %18
  %.3 = phi i1 [ false, %18 ], [ false, %21 ], [ %.1, %60 ], [ false, %26 ]
  ret i1 %.3
}

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @is_hermitian(ptr noundef, i64 noundef) local_unnamed_addr #0

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

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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { nounwind allocsize(0) }
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, !7, i64 0}
!6 = !{!"", !7, i64 0, !10, i64 4, !11, i64 8, !12, i64 16}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"_Bool", !8, i64 0}
!11 = !{!"long", !8, i64 0}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!8, !8, i64 0}
!14 = !{!7, !7, i64 0}
!15 = !{!16, !17, i64 0}
!16 = !{!"", !17, i64 0, !17, i64 4}
!17 = !{!"float", !8, i64 0}
!18 = !{!17, !17, i64 0}
!19 = distinct !{!19, !20, !21, !22}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{!"llvm.loop.isvectorized", i32 1}
!22 = !{!"llvm.loop.unroll.runtime.disable"}
!23 = !{!16, !17, i64 4}
!24 = distinct !{!24, !20, !22, !21}


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