; LLVM IR from InsightSoftwareConsortium/ITK :: Modules/ThirdParty/VNL/src/vxl/v3p/netlib/sparse (spUtils)

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

@stdout = external global ptr, align 8
@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [66 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [122 x i8], align 1
@spcMatrixIsNotValid = external global [0 x i8], align 1
@spcErrorsMustBeCleared = external global [0 x i8], align 1
@spcMatrixMustNotBeFactored = external global [0 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @spMNA_Preorder(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  %13 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %13, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  store ptr null, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  store ptr null, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 1, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = icmp ne ptr %14, null
  br i1 %15, label %16, label %21

16:                                               ; preds = %1
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.MatrixFrame, ptr %17, i32 0, i32 17
  %19 = load i64, ptr %18, align 8, !tbaa !11
  %20 = icmp eq i64 %19, 3735928559
  br i1 %20, label %28, label %21

21:                                               ; preds = %16, %1
  %22 = load ptr, ptr @stdout, align 8, !tbaa !5
  %23 = call i32 @fflush(ptr noundef %22)
  %24 = load ptr, ptr @stderr, align 8, !tbaa !5
  %25 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %24, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 200, ptr noundef @spcMatrixIsNotValid) #5
  %26 = load ptr, ptr @stderr, align 8, !tbaa !5
  %27 = call i32 @fflush(ptr noundef %26)
  call void @abort() #6
  unreachable

28:                                               ; preds = %16
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.MatrixFrame, ptr %29, i32 0, i32 9
  %31 = load i32, ptr %30, align 4, !tbaa !16
  %32 = icmp sge i32 %31, 0
  br i1 %32, label %33, label %38

33:                                               ; preds = %28
  %34 = load ptr, ptr %3, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.MatrixFrame, ptr %34, i32 0, i32 9
  %36 = load i32, ptr %35, align 4, !tbaa !16
  %37 = icmp slt i32 %36, 2
  br i1 %37, label %45, label %38

38:                                               ; preds = %33, %28
  %39 = load ptr, ptr @stdout, align 8, !tbaa !5
  %40 = call i32 @fflush(ptr noundef %39)
  %41 = load ptr, ptr @stderr, align 8, !tbaa !5
  %42 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %41, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 201, ptr noundef @spcErrorsMustBeCleared) #5
  %43 = load ptr, ptr @stderr, align 8, !tbaa !5
  %44 = call i32 @fflush(ptr noundef %43)
  call void @abort() #6
  unreachable

45:                                               ; preds = %33
  %46 = load ptr, ptr %3, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.MatrixFrame, ptr %46, i32 0, i32 13
  %48 = load i32, ptr %47, align 8, !tbaa !17
  %49 = icmp ne i32 %48, 0
  br i1 %49, label %50, label %57

50:                                               ; preds = %45
  %51 = load ptr, ptr @stdout, align 8, !tbaa !5
  %52 = call i32 @fflush(ptr noundef %51)
  %53 = load ptr, ptr @stderr, align 8, !tbaa !5
  %54 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %53, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 202, ptr noundef @spcMatrixMustNotBeFactored) #5
  %55 = load ptr, ptr @stderr, align 8, !tbaa !5
  %56 = call i32 @fflush(ptr noundef %55)
  call void @abort() #6
  unreachable

57:                                               ; preds = %45
  %58 = load ptr, ptr %3, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.MatrixFrame, ptr %58, i32 0, i32 35
  %60 = load i32, ptr %59, align 4, !tbaa !18
  %61 = icmp ne i32 %60, 0
  br i1 %61, label %62, label %63

62:                                               ; preds = %57
  store i32 1, ptr %12, align 4
  br label %148

63:                                               ; preds = %57
  %64 = load ptr, ptr %3, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.MatrixFrame, ptr %64, i32 0, i32 39
  %66 = load i32, ptr %65, align 4, !tbaa !19
  store i32 %66, ptr %5, align 4, !tbaa !9
  %67 = load ptr, ptr %3, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.MatrixFrame, ptr %67, i32 0, i32 34
  store i32 1, ptr %68, align 8, !tbaa !20
  br label %69

69:                                               ; preds = %144, %63
  store i32 0, ptr %10, align 4, !tbaa !9
  store i32 0, ptr %11, align 4, !tbaa !9
  %70 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %70, ptr %4, align 4, !tbaa !9
  br label %71

71:                                               ; preds = %105, %69
  %72 = load i32, ptr %4, align 4, !tbaa !9
  %73 = load i32, ptr %5, align 4, !tbaa !9
  %74 = icmp sle i32 %72, %73
  br i1 %74, label %75, label %108

75:                                               ; preds = %71
  %76 = load ptr, ptr %3, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.MatrixFrame, ptr %76, i32 0, i32 5
  %78 = load ptr, ptr %77, align 8, !tbaa !21
  %79 = load i32, ptr %4, align 4, !tbaa !9
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds ptr, ptr %78, i64 %80
  %82 = load ptr, ptr %81, align 8, !tbaa !5
  %83 = icmp eq ptr %82, null
  br i1 %83, label %84, label %104

84:                                               ; preds = %75
  %85 = load ptr, ptr %3, align 8, !tbaa !5
  %86 = load i32, ptr %4, align 4, !tbaa !9
  %87 = call i32 @CountTwins(ptr noundef %85, i32 noundef %86, ptr noundef %6, ptr noundef %7)
  store i32 %87, ptr %8, align 4, !tbaa !9
  %88 = load i32, ptr %8, align 4, !tbaa !9
  %89 = icmp eq i32 %88, 1
  br i1 %89, label %90, label %94

90:                                               ; preds = %84
  %91 = load ptr, ptr %3, align 8, !tbaa !5
  %92 = load ptr, ptr %6, align 8, !tbaa !5
  %93 = load ptr, ptr %7, align 8, !tbaa !5
  call void @SwapCols(ptr noundef %91, ptr noundef %92, ptr noundef %93)
  store i32 1, ptr %10, align 4, !tbaa !9
  br label %103

94:                                               ; preds = %84
  %95 = load i32, ptr %8, align 4, !tbaa !9
  %96 = icmp sgt i32 %95, 1
  br i1 %96, label %97, label %102

97:                                               ; preds = %94
  %98 = load i32, ptr %11, align 4, !tbaa !9
  %99 = icmp ne i32 %98, 0
  br i1 %99, label %102, label %100

100:                                              ; preds = %97
  store i32 1, ptr %11, align 4, !tbaa !9
  %101 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %101, ptr %9, align 4, !tbaa !9
  br label %102

102:                                              ; preds = %100, %97, %94
  br label %103

103:                                              ; preds = %102, %90
  br label %104

104:                                              ; preds = %103, %75
  br label %105

105:                                              ; preds = %104
  %106 = load i32, ptr %4, align 4, !tbaa !9
  %107 = add nsw i32 %106, 1
  store i32 %107, ptr %4, align 4, !tbaa !9
  br label %71, !llvm.loop !22

108:                                              ; preds = %71
  %109 = load i32, ptr %11, align 4, !tbaa !9
  %110 = icmp ne i32 %109, 0
  br i1 %110, label %111, label %143

111:                                              ; preds = %108
  %112 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %112, ptr %4, align 4, !tbaa !9
  br label %113

113:                                              ; preds = %139, %111
  %114 = load i32, ptr %10, align 4, !tbaa !9
  %115 = icmp ne i32 %114, 0
  br i1 %115, label %120, label %116

116:                                              ; preds = %113
  %117 = load i32, ptr %4, align 4, !tbaa !9
  %118 = load i32, ptr %5, align 4, !tbaa !9
  %119 = icmp sle i32 %117, %118
  br label %120

120:                                              ; preds = %116, %113
  %121 = phi i1 [ false, %113 ], [ %119, %116 ]
  br i1 %121, label %122, label %142

122:                                              ; preds = %120
  %123 = load ptr, ptr %3, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.MatrixFrame, ptr %123, i32 0, i32 5
  %125 = load ptr, ptr %124, align 8, !tbaa !21
  %126 = load i32, ptr %4, align 4, !tbaa !9
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds ptr, ptr %125, i64 %127
  %129 = load ptr, ptr %128, align 8, !tbaa !5
  %130 = icmp eq ptr %129, null
  br i1 %130, label %131, label %138

131:                                              ; preds = %122
  %132 = load ptr, ptr %3, align 8, !tbaa !5
  %133 = load i32, ptr %4, align 4, !tbaa !9
  %134 = call i32 @CountTwins(ptr noundef %132, i32 noundef %133, ptr noundef %6, ptr noundef %7)
  %135 = load ptr, ptr %3, align 8, !tbaa !5
  %136 = load ptr, ptr %6, align 8, !tbaa !5
  %137 = load ptr, ptr %7, align 8, !tbaa !5
  call void @SwapCols(ptr noundef %135, ptr noundef %136, ptr noundef %137)
  store i32 1, ptr %10, align 4, !tbaa !9
  br label %138

138:                                              ; preds = %131, %122
  br label %139

139:                                              ; preds = %138
  %140 = load i32, ptr %4, align 4, !tbaa !9
  %141 = add nsw i32 %140, 1
  store i32 %141, ptr %4, align 4, !tbaa !9
  br label %113, !llvm.loop !24

142:                                              ; preds = %120
  br label %143

143:                                              ; preds = %142, %108
  br label %144

144:                                              ; preds = %143
  %145 = load i32, ptr %11, align 4, !tbaa !9
  %146 = icmp ne i32 %145, 0
  br i1 %146, label %69, label %147, !llvm.loop !25

147:                                              ; preds = %144
  store i32 1, ptr %12, align 4
  br label %148

148:                                              ; preds = %147, %62
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  ret void
}

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

declare i32 @fflush(ptr noundef) #2

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #3

; Function Attrs: noreturn nounwind
declare void @abort() #4

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

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

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

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 = { "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 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
attributes #6 = { noreturn nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !14, i64 104}
!12 = !{!"MatrixFrame", !13, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !6, i64 24, !6, i64 32, !6, i64 40, !10, i64 48, !10, i64 52, !10, i64 56, !6, i64 64, !6, i64 72, !10, i64 80, !10, i64 84, !6, i64 88, !6, i64 96, !14, i64 104, !6, i64 112, !10, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !10, i64 168, !10, i64 172, !10, i64 176, !10, i64 180, !10, i64 184, !10, i64 188, !7, i64 192, !10, i64 196, !13, i64 200, !10, i64 208, !10, i64 212, !10, i64 216, !10, i64 220, !10, i64 224, !10, i64 228, !15, i64 232, !6, i64 272, !10, i64 280, !6, i64 288, !10, i64 296, !6, i64 304, !10, i64 312, !6, i64 320, !6, i64 328}
!13 = !{!"double", !7, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!"MatrixElement", !13, i64 0, !10, i64 8, !10, i64 12, !6, i64 16, !6, i64 24, !6, i64 32}
!16 = !{!12, !10, i64 52}
!17 = !{!12, !10, i64 80}
!18 = !{!12, !10, i64 212}
!19 = !{!12, !10, i64 228}
!20 = !{!12, !10, i64 208}
!21 = !{!12, !6, i64 24}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = distinct !{!24, !23}
!25 = distinct !{!25, !23}


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

@stdout = external local_unnamed_addr global ptr, align 8
@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [66 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [122 x i8], align 1
@spcMatrixIsNotValid = external global [0 x i8], align 1
@spcErrorsMustBeCleared = external global [0 x i8], align 1
@spcMatrixMustNotBeFactored = external global [0 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @spMNA_Preorder(ptr noundef %0) local_unnamed_addr #0 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #4
  store ptr null, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #4
  store ptr null, ptr %3, align 8, !tbaa !5
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %8, label %4

4:                                                ; preds = %1
  %5 = getelementptr inbounds i8, ptr %0, i64 104
  %6 = load i64, ptr %5, align 8, !tbaa !9
  %7 = icmp eq i64 %6, 3735928559
  br i1 %7, label %15, label %8

8:                                                ; preds = %4, %1
  %9 = load ptr, ptr @stdout, align 8, !tbaa !5
  %10 = tail call i32 @fflush(ptr noundef %9)
  %11 = load ptr, ptr @stderr, align 8, !tbaa !5
  %12 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %11, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 200, ptr noundef nonnull @spcMatrixIsNotValid) #5
  %13 = load ptr, ptr @stderr, align 8, !tbaa !5
  %14 = tail call i32 @fflush(ptr noundef %13)
  tail call void @abort() #6
  unreachable

15:                                               ; preds = %4
  %16 = getelementptr inbounds i8, ptr %0, i64 52
  %17 = load i32, ptr %16, align 4, !tbaa !15
  %or.cond50 = icmp ult i32 %17, 2
  br i1 %or.cond50, label %25, label %18

18:                                               ; preds = %15
  %19 = load ptr, ptr @stdout, align 8, !tbaa !5
  %20 = tail call i32 @fflush(ptr noundef %19)
  %21 = load ptr, ptr @stderr, align 8, !tbaa !5
  %22 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %21, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 201, ptr noundef nonnull @spcErrorsMustBeCleared) #5
  %23 = load ptr, ptr @stderr, align 8, !tbaa !5
  %24 = tail call i32 @fflush(ptr noundef %23)
  tail call void @abort() #6
  unreachable

25:                                               ; preds = %15
  %26 = getelementptr inbounds i8, ptr %0, i64 80
  %27 = load i32, ptr %26, align 8, !tbaa !16
  %.not45 = icmp eq i32 %27, 0
  br i1 %.not45, label %35, label %28

28:                                               ; preds = %25
  %29 = load ptr, ptr @stdout, align 8, !tbaa !5
  %30 = tail call i32 @fflush(ptr noundef %29)
  %31 = load ptr, ptr @stderr, align 8, !tbaa !5
  %32 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %31, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 202, ptr noundef nonnull @spcMatrixMustNotBeFactored) #5
  %33 = load ptr, ptr @stderr, align 8, !tbaa !5
  %34 = tail call i32 @fflush(ptr noundef %33)
  tail call void @abort() #6
  unreachable

35:                                               ; preds = %25
  %36 = getelementptr inbounds i8, ptr %0, i64 212
  %37 = load i32, ptr %36, align 4, !tbaa !17
  %.not46 = icmp eq i32 %37, 0
  br i1 %.not46, label %38, label %.critedge

38:                                               ; preds = %35
  %39 = getelementptr inbounds i8, ptr %0, i64 228
  %40 = load i32, ptr %39, align 4, !tbaa !18
  %41 = getelementptr inbounds i8, ptr %0, i64 208
  store i32 1, ptr %41, align 8, !tbaa !19
  %42 = getelementptr inbounds i8, ptr %0, i64 24
  %43 = add i32 %40, 1
  %44 = sext i32 %40 to i64
  %.not475274 = icmp slt i32 %40, 1
  br i1 %.not475274, label %.critedge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %38, %._crit_edge62
  %.03675 = phi i32 [ %.238, %._crit_edge62 ], [ 1, %38 ]
  %45 = sext i32 %.03675 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %60
  %indvars.iv = phi i64 [ %45, %.lr.ph.preheader ], [ %indvars.iv.next, %60 ]
  %.056 = phi i32 [ 0, %.lr.ph.preheader ], [ %.1, %60 ]
  %.03455 = phi i32 [ 0, %.lr.ph.preheader ], [ %.135, %60 ]
  %.13754 = phi i32 [ %.03675, %.lr.ph.preheader ], [ %.238, %60 ]
  %46 = load ptr, ptr %42, align 8, !tbaa !20
  %47 = getelementptr inbounds ptr, ptr %46, i64 %indvars.iv
  %48 = load ptr, ptr %47, align 8, !tbaa !5
  %49 = icmp eq ptr %48, null
  br i1 %49, label %50, label %60

50:                                               ; preds = %.lr.ph
  %51 = trunc nsw i64 %indvars.iv to i32
  %52 = call i32 @CountTwins(ptr noundef nonnull %0, i32 noundef %51, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %53 = icmp eq i32 %52, 1
  br i1 %53, label %54, label %57

54:                                               ; preds = %50
  %55 = load ptr, ptr %2, align 8, !tbaa !5
  %56 = load ptr, ptr %3, align 8, !tbaa !5
  call void @SwapCols(ptr noundef nonnull %0, ptr noundef %55, ptr noundef %56)
  br label %60

57:                                               ; preds = %50
  %58 = icmp slt i32 %52, 2
  %59 = icmp ne i32 %.056, 0
  %or.cond = select i1 %58, i1 true, i1 %59
  %spec.select = select i1 %or.cond, i32 %.13754, i32 %51
  %spec.select51 = select i1 %or.cond, i32 %.056, i32 1
  br label %60

60:                                               ; preds = %57, %.lr.ph, %54
  %.238 = phi i32 [ %.13754, %54 ], [ %.13754, %.lr.ph ], [ %spec.select, %57 ]
  %.135 = phi i32 [ 1, %54 ], [ %.03455, %.lr.ph ], [ %.03455, %57 ]
  %.1 = phi i32 [ %.056, %54 ], [ %.056, %.lr.ph ], [ %spec.select51, %57 ]
  %indvars.iv.next = add nsw i64 %indvars.iv, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next to i32
  %exitcond.not = icmp eq i32 %43, %lftr.wideiv
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !21

._crit_edge:                                      ; preds = %60
  %.not48 = icmp eq i32 %.1, 0
  br i1 %.not48, label %.critedge, label %.preheader

.preheader:                                       ; preds = %._crit_edge
  %.not4959 = icmp eq i32 %.135, 0
  %61 = icmp sle i32 %.238, %40
  %62 = select i1 %.not4959, i1 %61, i1 false
  br i1 %62, label %.lr.ph61.preheader, label %._crit_edge62

.lr.ph61.preheader:                               ; preds = %.preheader
  %63 = sext i32 %.238 to i64
  %64 = load ptr, ptr %42, align 8, !tbaa !20
  br label %.lr.ph61

.lr.ph61:                                         ; preds = %.lr.ph61.preheader, %72
  %indvars.iv64 = phi i64 [ %63, %.lr.ph61.preheader ], [ %indvars.iv.next65, %72 ]
  %65 = getelementptr inbounds ptr, ptr %64, i64 %indvars.iv64
  %66 = load ptr, ptr %65, align 8, !tbaa !5
  %67 = icmp ne ptr %66, null
  br i1 %67, label %72, label %.thread

.thread:                                          ; preds = %.lr.ph61
  %68 = trunc nsw i64 %indvars.iv64 to i32
  %69 = call i32 @CountTwins(ptr noundef nonnull %0, i32 noundef %68, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %70 = load ptr, ptr %2, align 8, !tbaa !5
  %71 = load ptr, ptr %3, align 8, !tbaa !5
  call void @SwapCols(ptr noundef nonnull %0, ptr noundef %70, ptr noundef %71)
  br label %._crit_edge62

72:                                               ; preds = %.lr.ph61
  %indvars.iv.next65 = add nsw i64 %indvars.iv64, 1
  %73 = icmp slt i64 %indvars.iv64, %44
  %74 = and i1 %67, %73
  br i1 %74, label %.lr.ph61, label %._crit_edge62, !llvm.loop !23

._crit_edge62:                                    ; preds = %72, %.thread, %.preheader
  %.not4752 = icmp sgt i32 %.238, %40
  br i1 %.not4752, label %.critedge, label %.lr.ph.preheader

.critedge:                                        ; preds = %._crit_edge, %._crit_edge62, %38, %35
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #4
  ret void
}

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

; Function Attrs: nofree nounwind
declare noundef i32 @fflush(ptr nocapture noundef) local_unnamed_addr #2

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

; Function Attrs: noreturn nounwind
declare void @abort() local_unnamed_addr #3

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

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

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

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 = { 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 #3 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { cold nounwind }
attributes #6 = { noreturn nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !13, i64 104}
!10 = !{!"MatrixFrame", !11, i64 0, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !6, i64 24, !6, i64 32, !6, i64 40, !12, i64 48, !12, i64 52, !12, i64 56, !6, i64 64, !6, i64 72, !12, i64 80, !12, i64 84, !6, i64 88, !6, i64 96, !13, i64 104, !6, i64 112, !12, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !12, i64 168, !12, i64 172, !12, i64 176, !12, i64 180, !12, i64 184, !12, i64 188, !7, i64 192, !12, i64 196, !11, i64 200, !12, i64 208, !12, i64 212, !12, i64 216, !12, i64 220, !12, i64 224, !12, i64 228, !14, i64 232, !6, i64 272, !12, i64 280, !6, i64 288, !12, i64 296, !6, i64 304, !12, i64 312, !6, i64 320, !6, i64 328}
!11 = !{!"double", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!"MatrixElement", !11, i64 0, !12, i64 8, !12, i64 12, !6, i64 16, !6, i64 24, !6, i64 32}
!15 = !{!10, !12, i64 52}
!16 = !{!10, !12, i64 80}
!17 = !{!10, !12, i64 212}
!18 = !{!10, !12, i64 228}
!19 = !{!10, !12, i64 208}
!20 = !{!10, !6, i64 24}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = distinct !{!23, !22}


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