; 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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

; 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_qr(ptr noundef %0, i64 noundef %1, i64 noundef %2, ptr noundef %3, ptr noundef %4, i32 noundef %5) #0 {
  %7 = alloca i1, align 1
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %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
  %25 = alloca i64, align 8
  store ptr %0, ptr %8, align 8, !tbaa !5
  store i64 %1, ptr %9, align 8, !tbaa !9
  store i64 %2, ptr %10, align 8, !tbaa !9
  store ptr %3, ptr %11, align 8, !tbaa !5
  store ptr %4, ptr %12, align 8, !tbaa !5
  store i32 %5, ptr %13, align 4, !tbaa !11
  %26 = call zeroext i1 @initialize_lapack()
  br i1 %26, label %27, label %42

27:                                               ; preds = %6
  %28 = load ptr, ptr %8, align 8, !tbaa !5
  %29 = icmp ne ptr %28, null
  br i1 %29, label %30, label %42

30:                                               ; preds = %27
  %31 = load ptr, ptr %11, align 8, !tbaa !5
  %32 = icmp ne ptr %31, null
  br i1 %32, label %33, label %42

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

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

39:                                               ; preds = %36
  %40 = load i64, ptr %10, align 8, !tbaa !9
  %41 = icmp eq i64 %40, 0
  br i1 %41, label %42, label %43

42:                                               ; preds = %39, %36, %33, %30, %27, %6
  store i32 -1, ptr @lapack_state, align 8, !tbaa !13
  store i1 false, ptr %7, align 1
  br label %160

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

51:                                               ; preds = %43
  store i32 -2, ptr @lapack_state, align 8, !tbaa !13
  store i1 false, ptr %7, align 1
  store i32 1, ptr %15, align 4
  br label %159

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

68:                                               ; preds = %52
  %69 = load ptr, ptr %14, align 8, !tbaa !5
  call void @free(ptr noundef %69) #7
  store i32 -2, ptr @lapack_state, align 8, !tbaa !13
  store i1 false, ptr %7, align 1
  store i32 1, ptr %15, align 4
  br label %158

70:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #7
  store i32 -1, ptr %22, align 4, !tbaa !11
  %71 = load ptr, ptr %14, align 8, !tbaa !5
  %72 = load ptr, ptr %20, align 8, !tbaa !5
  call void @cgeqrf_(ptr noundef %16, ptr noundef %17, ptr noundef %71, ptr noundef %18, ptr noundef %72, ptr noundef %21, ptr noundef %22, ptr noundef %19)
  %73 = getelementptr inbounds %struct.ComplexFloat, ptr %21, i32 0, i32 0
  %74 = load float, ptr %73, align 4, !tbaa !16
  %75 = fptosi float %74 to i32
  store i32 %75, ptr %22, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #7
  %76 = load i32, ptr %22, align 4, !tbaa !11
  %77 = sext i32 %76 to i64
  %78 = mul i64 %77, 8
  %79 = call noalias ptr @malloc(i64 noundef %78) #8
  store ptr %79, ptr %23, align 8, !tbaa !5
  %80 = load ptr, ptr %23, align 8, !tbaa !5
  %81 = icmp ne ptr %80, null
  br i1 %81, label %85, label %82

82:                                               ; preds = %70
  %83 = load ptr, ptr %20, align 8, !tbaa !5
  call void @free(ptr noundef %83) #7
  %84 = load ptr, ptr %14, align 8, !tbaa !5
  call void @free(ptr noundef %84) #7
  store i32 -2, ptr @lapack_state, align 8, !tbaa !13
  store i1 false, ptr %7, align 1
  store i32 1, ptr %15, align 4
  br label %157

85:                                               ; preds = %70
  %86 = load ptr, ptr %14, align 8, !tbaa !5
  %87 = load ptr, ptr %20, align 8, !tbaa !5
  %88 = load ptr, ptr %23, align 8, !tbaa !5
  call void @cgeqrf_(ptr noundef %16, ptr noundef %17, ptr noundef %86, ptr noundef %18, ptr noundef %87, ptr noundef %88, ptr noundef %22, ptr noundef %19)
  %89 = load i32, ptr %19, align 4, !tbaa !11
  %90 = icmp ne i32 %89, 0
  br i1 %90, label %91, label %95

91:                                               ; preds = %85
  %92 = load ptr, ptr %23, align 8, !tbaa !5
  call void @free(ptr noundef %92) #7
  %93 = load ptr, ptr %20, align 8, !tbaa !5
  call void @free(ptr noundef %93) #7
  %94 = load ptr, ptr %14, align 8, !tbaa !5
  call void @free(ptr noundef %94) #7
  store i32 -1, ptr @lapack_state, align 8, !tbaa !13
  store i1 false, ptr %7, align 1
  store i32 1, ptr %15, align 4
  br label %157

95:                                               ; preds = %85
  %96 = load ptr, ptr %12, align 8, !tbaa !5
  %97 = load i64, ptr %9, align 8, !tbaa !9
  %98 = load i64, ptr %10, align 8, !tbaa !9
  %99 = mul i64 %97, %98
  %100 = mul i64 %99, 8
  call void @llvm.memset.p0.i64(ptr align 4 %96, i8 0, i64 %100, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #7
  store i64 0, ptr %24, align 8, !tbaa !9
  br label %101

101:                                              ; preds = %137, %95
  %102 = load i64, ptr %24, align 8, !tbaa !9
  %103 = load i64, ptr %10, align 8, !tbaa !9
  %104 = icmp ult i64 %102, %103
  br i1 %104, label %106, label %105

105:                                              ; preds = %101
  store i32 2, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #7
  br label %140

106:                                              ; preds = %101
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #7
  store i64 0, ptr %25, align 8, !tbaa !9
  br label %107

107:                                              ; preds = %133, %106
  %108 = load i64, ptr %25, align 8, !tbaa !9
  %109 = load i64, ptr %24, align 8, !tbaa !9
  %110 = icmp ule i64 %108, %109
  br i1 %110, label %111, label %115

111:                                              ; preds = %107
  %112 = load i64, ptr %25, align 8, !tbaa !9
  %113 = load i64, ptr %9, align 8, !tbaa !9
  %114 = icmp ult i64 %112, %113
  br label %115

115:                                              ; preds = %111, %107
  %116 = phi i1 [ false, %107 ], [ %114, %111 ]
  br i1 %116, label %118, label %117

117:                                              ; preds = %115
  store i32 5, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #7
  br label %136

118:                                              ; preds = %115
  %119 = load ptr, ptr %12, align 8, !tbaa !5
  %120 = load i64, ptr %24, align 8, !tbaa !9
  %121 = load i64, ptr %9, align 8, !tbaa !9
  %122 = mul i64 %120, %121
  %123 = load i64, ptr %25, align 8, !tbaa !9
  %124 = add i64 %122, %123
  %125 = getelementptr inbounds %struct.ComplexFloat, ptr %119, i64 %124
  %126 = load ptr, ptr %14, align 8, !tbaa !5
  %127 = load i64, ptr %24, align 8, !tbaa !9
  %128 = load i64, ptr %9, align 8, !tbaa !9
  %129 = mul i64 %127, %128
  %130 = load i64, ptr %25, align 8, !tbaa !9
  %131 = add i64 %129, %130
  %132 = getelementptr inbounds %struct.ComplexFloat, ptr %126, i64 %131
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %125, ptr align 4 %132, i64 8, i1 false), !tbaa.struct !19
  br label %133

133:                                              ; preds = %118
  %134 = load i64, ptr %25, align 8, !tbaa !9
  %135 = add i64 %134, 1
  store i64 %135, ptr %25, align 8, !tbaa !9
  br label %107, !llvm.loop !21

136:                                              ; preds = %117
  br label %137

137:                                              ; preds = %136
  %138 = load i64, ptr %24, align 8, !tbaa !9
  %139 = add i64 %138, 1
  store i64 %139, ptr %24, align 8, !tbaa !9
  br label %101, !llvm.loop !23

140:                                              ; preds = %105
  %141 = load ptr, ptr %11, align 8, !tbaa !5
  %142 = load ptr, ptr %14, align 8, !tbaa !5
  %143 = load i64, ptr %9, align 8, !tbaa !9
  %144 = load i64, ptr %10, align 8, !tbaa !9
  %145 = mul i64 %143, %144
  %146 = mul i64 %145, 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %141, ptr align 4 %142, i64 %146, i1 false)
  %147 = load ptr, ptr %11, align 8, !tbaa !5
  %148 = load ptr, ptr %20, align 8, !tbaa !5
  %149 = load ptr, ptr %23, align 8, !tbaa !5
  call void @cungqr_(ptr noundef %16, ptr noundef %17, ptr noundef %17, ptr noundef %147, ptr noundef %18, ptr noundef %148, ptr noundef %149, ptr noundef %22, ptr noundef %19)
  %150 = load ptr, ptr %23, align 8, !tbaa !5
  call void @free(ptr noundef %150) #7
  %151 = load ptr, ptr %20, align 8, !tbaa !5
  call void @free(ptr noundef %151) #7
  %152 = load ptr, ptr %14, align 8, !tbaa !5
  call void @free(ptr noundef %152) #7
  %153 = load i32, ptr %19, align 4, !tbaa !11
  %154 = icmp ne i32 %153, 0
  br i1 %154, label %155, label %156

155:                                              ; preds = %140
  store i32 -1, ptr @lapack_state, align 8, !tbaa !13
  store i1 false, ptr %7, align 1
  store i32 1, ptr %15, align 4
  br label %157

156:                                              ; preds = %140
  store i32 0, ptr @lapack_state, align 8, !tbaa !13
  store i1 true, ptr %7, align 1
  store i32 1, ptr %15, align 4
  br label %157

157:                                              ; preds = %156, %155, %91, %82
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #7
  br label %158

158:                                              ; preds = %157, %68
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  br label %159

159:                                              ; preds = %158, %51
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  br label %160

160:                                              ; preds = %159, %42
  %161 = load i1, ptr %7, align 1
  ret i1 %161
}

declare void @cgeqrf_(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #6

declare void @cungqr_(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #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 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!"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 = !{!17, !18, i64 0}
!17 = !{!"", !18, i64 0, !18, i64 4}
!18 = !{!"float", !7, i64 0}
!19 = !{i64 0, i64 4, !20, i64 4, i64 4, !20}
!20 = !{!18, !18, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = distinct !{!23, !22}


; 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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

; 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 zeroext i1 @lapack_qr(ptr noundef %0, i64 noundef %1, i64 noundef %2, ptr noundef %3, ptr noundef writeonly %4, i32 noundef %5) local_unnamed_addr #0 {
  %7 = alloca i32, align 4
  %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 %3, null
  %or.cond3 = and i1 %15, %or.cond
  %16 = icmp ne ptr %4, null
  %or.cond5 = and i1 %16, %or.cond3
  %or.cond5.not = xor i1 %or.cond5, true
  %17 = icmp eq i64 %1, 0
  %or.cond7 = or i1 %17, %or.cond5.not
  %18 = icmp eq i64 %2, 0
  %or.cond9 = or i1 %18, %or.cond7
  br i1 %or.cond9, label %19, label %20

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

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

24:                                               ; preds = %20
  store i32 -2, ptr @lapack_state, align 8, !tbaa !5
  br label %57

25:                                               ; preds = %20
  tail call void @convert_layout(ptr noundef nonnull %23, ptr noundef %0, i64 noundef %1, i64 noundef %2, i32 noundef %5, i32 noundef 102)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #9
  %26 = trunc i64 %1 to i32
  store i32 %26, ptr %7, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #9
  %27 = trunc i64 %2 to i32
  store i32 %27, ptr %8, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #9
  store i32 %26, ptr %9, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #9
  %28 = shl i64 %2, 3
  %29 = tail call noalias ptr @malloc(i64 noundef %28) #8
  %.not74 = icmp eq ptr %29, null
  br i1 %.not74, label %30, label %31

30:                                               ; preds = %25
  tail call void @free(ptr noundef nonnull %23) #9
  store i32 -2, ptr @lapack_state, align 8, !tbaa !5
  br label %56

31:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %12) #9
  store i32 -1, ptr %12, align 4, !tbaa !13
  call void @cgeqrf_(ptr noundef nonnull %7, ptr noundef nonnull %8, ptr noundef nonnull %23, ptr noundef nonnull %9, ptr noundef nonnull %29, ptr noundef nonnull %11, ptr noundef nonnull %12, ptr noundef nonnull %10) #9
  %32 = load float, ptr %11, align 4, !tbaa !14
  %33 = fptosi float %32 to i32
  store i32 %33, ptr %12, align 4, !tbaa !13
  %34 = sext i32 %33 to i64
  %35 = shl nsw i64 %34, 3
  %36 = call noalias ptr @malloc(i64 noundef %35) #8
  %.not75 = icmp eq ptr %36, null
  br i1 %.not75, label %37, label %38

37:                                               ; preds = %31
  call void @free(ptr noundef nonnull %29) #9
  call void @free(ptr noundef nonnull %23) #9
  br label %55

38:                                               ; preds = %31
  call void @cgeqrf_(ptr noundef nonnull %7, ptr noundef nonnull %8, ptr noundef nonnull %23, ptr noundef nonnull %9, ptr noundef nonnull %29, ptr noundef nonnull %36, ptr noundef nonnull %12, ptr noundef nonnull %10) #9
  %39 = load i32, ptr %10, align 4, !tbaa !13
  %.not76 = icmp eq i32 %39, 0
  br i1 %.not76, label %.preheader.us.preheader, label %40

40:                                               ; preds = %38
  call void @free(ptr noundef nonnull %36) #9
  call void @free(ptr noundef nonnull %29) #9
  call void @free(ptr noundef nonnull %23) #9
  br label %55

.preheader.us.preheader:                          ; preds = %38
  call void @llvm.memset.p0.i64(ptr nonnull align 4 %4, i8 0, i64 %22, i1 false)
  %41 = add i64 %1, -1
  %xtraiter = and i64 %2, 1
  %42 = icmp eq i64 %2, 1
  br i1 %42, label %._crit_edge80.unr-lcssa, label %.preheader.us.preheader.new

.preheader.us.preheader.new:                      ; preds = %.preheader.us.preheader
  %unroll_iter = and i64 %2, -2
  br label %.preheader.us

.preheader.us:                                    ; preds = %.preheader.us, %.preheader.us.preheader.new
  %.06779.us = phi i64 [ 0, %.preheader.us.preheader.new ], [ %50, %.preheader.us ]
  %niter = phi i64 [ 0, %.preheader.us.preheader.new ], [ %niter.next.1, %.preheader.us ]
  %43 = mul i64 %21, %.06779.us
  %scevgep = getelementptr i8, ptr %4, i64 %43
  %scevgep84 = getelementptr i8, ptr %23, i64 %43
  %umin = call i64 @llvm.umin.i64(i64 %.06779.us, i64 %41)
  %44 = shl i64 %umin, 3
  %45 = add i64 %44, 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %scevgep, ptr align 4 %scevgep84, i64 %45, i1 false)
  %46 = or disjoint i64 %.06779.us, 1
  %47 = mul i64 %21, %46
  %scevgep.1 = getelementptr i8, ptr %4, i64 %47
  %scevgep84.1 = getelementptr i8, ptr %23, i64 %47
  %umin.1 = call i64 @llvm.umin.i64(i64 %46, i64 %41)
  %48 = shl i64 %umin.1, 3
  %49 = add i64 %48, 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %scevgep.1, ptr align 4 %scevgep84.1, i64 %49, i1 false)
  %50 = add nuw i64 %.06779.us, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge80.unr-lcssa, label %.preheader.us, !llvm.loop !17

._crit_edge80.unr-lcssa:                          ; preds = %.preheader.us, %.preheader.us.preheader
  %.06779.us.unr = phi i64 [ 0, %.preheader.us.preheader ], [ %50, %.preheader.us ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge80, label %.preheader.us.epil

.preheader.us.epil:                               ; preds = %._crit_edge80.unr-lcssa
  %51 = mul i64 %21, %.06779.us.unr
  %scevgep.epil = getelementptr i8, ptr %4, i64 %51
  %scevgep84.epil = getelementptr i8, ptr %23, i64 %51
  %umin.epil = call i64 @llvm.umin.i64(i64 %.06779.us.unr, i64 %41)
  %52 = shl i64 %umin.epil, 3
  %53 = add i64 %52, 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %scevgep.epil, ptr align 4 %scevgep84.epil, i64 %53, i1 false)
  br label %._crit_edge80

._crit_edge80:                                    ; preds = %._crit_edge80.unr-lcssa, %.preheader.us.epil
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %3, ptr nonnull align 4 %23, i64 %22, i1 false)
  call void @cungqr_(ptr noundef nonnull %7, ptr noundef nonnull %8, ptr noundef nonnull %8, ptr noundef %3, ptr noundef nonnull %9, ptr noundef nonnull %29, ptr noundef nonnull %36, ptr noundef nonnull %12, ptr noundef nonnull %10) #9
  call void @free(ptr noundef %36) #9
  call void @free(ptr noundef %29) #9
  call void @free(ptr noundef %23) #9
  %54 = load i32, ptr %10, align 4, !tbaa !13
  %.not77 = icmp eq i32 %54, 0
  %not..not77 = xor i1 %.not77, true
  %. = sext i1 %not..not77 to i32
  br label %55

55:                                               ; preds = %._crit_edge80, %40, %37
  %.sink = phi i32 [ -1, %40 ], [ -2, %37 ], [ %., %._crit_edge80 ]
  %.068 = phi i1 [ false, %40 ], [ false, %37 ], [ %.not77, %._crit_edge80 ]
  store i32 %.sink, ptr @lapack_state, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #9
  br label %56

56:                                               ; preds = %55, %30
  %.1 = phi i1 [ %.068, %55 ], [ false, %30 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #9
  br label %57

57:                                               ; preds = %24, %56, %19
  %.3 = phi i1 [ false, %19 ], [ %.1, %56 ], [ false, %24 ]
  ret i1 %.3
}

declare void @cgeqrf_(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #6

declare void @cungqr_(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #6

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umin.i64(i64, i64) #7

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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !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 = !{!7, !7, i64 0}
!14 = !{!15, !16, i64 0}
!15 = !{!"", !16, i64 0, !16, i64 4}
!16 = !{!"float", !8, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}


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