; LLVM IR from yourtion/LearningMasteringAlgorithms-C :: source (mst)

; 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.Graph_ = type { i32, i32, ptr, ptr, %struct.List_ }
%struct.List_ = type { i32, ptr, ptr, ptr, ptr }
%struct.ListElmt_ = type { ptr, ptr }
%struct.AdjList_ = type { ptr, %struct.List_ }
%struct.MstVertex_ = type { ptr, double, i32, double, ptr }

; Function Attrs: nounwind uwtable
define dso_local i32 @mst(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #0 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca double, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  store ptr null, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #3
  store i32 0, ptr %16, align 4, !tbaa !9
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.Graph_, ptr %19, i32 0, i32 4
  %21 = getelementptr inbounds %struct.List_, ptr %20, i32 0, i32 3
  %22 = load ptr, ptr %21, align 8, !tbaa !11
  store ptr %22, ptr %13, align 8, !tbaa !5
  br label %23

23:                                               ; preds = %52, %4
  %24 = load ptr, ptr %13, align 8, !tbaa !5
  %25 = icmp ne ptr %24, null
  br i1 %25, label %26, label %56

26:                                               ; preds = %23
  %27 = load ptr, ptr %13, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.ListElmt_, ptr %27, i32 0, i32 0
  %29 = load ptr, ptr %28, align 8, !tbaa !14
  %30 = getelementptr inbounds %struct.AdjList_, ptr %29, i32 0, i32 0
  %31 = load ptr, ptr %30, align 8, !tbaa !16
  store ptr %31, ptr %11, align 8, !tbaa !5
  %32 = load ptr, ptr %9, align 8, !tbaa !5
  %33 = load ptr, ptr %11, align 8, !tbaa !5
  %34 = load ptr, ptr %7, align 8, !tbaa !5
  %35 = call i32 %32(ptr noundef %33, ptr noundef %34)
  %36 = icmp ne i32 %35, 0
  br i1 %36, label %37, label %44

37:                                               ; preds = %26
  %38 = load ptr, ptr %11, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.MstVertex_, ptr %38, i32 0, i32 2
  store i32 0, ptr %39, align 8, !tbaa !18
  %40 = load ptr, ptr %11, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.MstVertex_, ptr %40, i32 0, i32 3
  store double 0.000000e+00, ptr %41, align 8, !tbaa !21
  %42 = load ptr, ptr %11, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.MstVertex_, ptr %42, i32 0, i32 4
  store ptr null, ptr %43, align 8, !tbaa !22
  store i32 1, ptr %16, align 4, !tbaa !9
  br label %51

44:                                               ; preds = %26
  %45 = load ptr, ptr %11, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.MstVertex_, ptr %45, i32 0, i32 2
  store i32 0, ptr %46, align 8, !tbaa !18
  %47 = load ptr, ptr %11, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.MstVertex_, ptr %47, i32 0, i32 3
  store double 0x7FEFFFFFFFFFFFFF, ptr %48, align 8, !tbaa !21
  %49 = load ptr, ptr %11, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.MstVertex_, ptr %49, i32 0, i32 4
  store ptr null, ptr %50, align 8, !tbaa !22
  br label %51

51:                                               ; preds = %44, %37
  br label %52

52:                                               ; preds = %51
  %53 = load ptr, ptr %13, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.ListElmt_, ptr %53, i32 0, i32 1
  %55 = load ptr, ptr %54, align 8, !tbaa !23
  store ptr %55, ptr %13, align 8, !tbaa !5
  br label %23, !llvm.loop !24

56:                                               ; preds = %23
  %57 = load i32, ptr %16, align 4, !tbaa !9
  %58 = icmp ne i32 %57, 0
  br i1 %58, label %60, label %59

59:                                               ; preds = %56
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %18, align 4
  br label %211

60:                                               ; preds = %56
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %61

61:                                               ; preds = %172, %60
  %62 = load i32, ptr %17, align 4, !tbaa !9
  %63 = load ptr, ptr %6, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.Graph_, ptr %63, i32 0, i32 0
  %65 = load i32, ptr %64, align 8, !tbaa !26
  %66 = icmp slt i32 %62, %65
  br i1 %66, label %67, label %175

67:                                               ; preds = %61
  store double 0x7FEFFFFFFFFFFFFF, ptr %15, align 8, !tbaa !27
  %68 = load ptr, ptr %6, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.Graph_, ptr %68, i32 0, i32 4
  %70 = getelementptr inbounds %struct.List_, ptr %69, i32 0, i32 3
  %71 = load ptr, ptr %70, align 8, !tbaa !11
  store ptr %71, ptr %13, align 8, !tbaa !5
  br label %72

72:                                               ; preds = %99, %67
  %73 = load ptr, ptr %13, align 8, !tbaa !5
  %74 = icmp ne ptr %73, null
  br i1 %74, label %75, label %103

75:                                               ; preds = %72
  %76 = load ptr, ptr %13, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.ListElmt_, ptr %76, i32 0, i32 0
  %78 = load ptr, ptr %77, align 8, !tbaa !14
  %79 = getelementptr inbounds %struct.AdjList_, ptr %78, i32 0, i32 0
  %80 = load ptr, ptr %79, align 8, !tbaa !16
  store ptr %80, ptr %11, align 8, !tbaa !5
  %81 = load ptr, ptr %11, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.MstVertex_, ptr %81, i32 0, i32 2
  %83 = load i32, ptr %82, align 8, !tbaa !18
  %84 = icmp eq i32 %83, 0
  br i1 %84, label %85, label %98

85:                                               ; preds = %75
  %86 = load ptr, ptr %11, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.MstVertex_, ptr %86, i32 0, i32 3
  %88 = load double, ptr %87, align 8, !tbaa !21
  %89 = load double, ptr %15, align 8, !tbaa !27
  %90 = fcmp olt double %88, %89
  br i1 %90, label %91, label %98

91:                                               ; preds = %85
  %92 = load ptr, ptr %11, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.MstVertex_, ptr %92, i32 0, i32 3
  %94 = load double, ptr %93, align 8, !tbaa !21
  store double %94, ptr %15, align 8, !tbaa !27
  %95 = load ptr, ptr %13, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.ListElmt_, ptr %95, i32 0, i32 0
  %97 = load ptr, ptr %96, align 8, !tbaa !14
  store ptr %97, ptr %10, align 8, !tbaa !5
  br label %98

98:                                               ; preds = %91, %85, %75
  br label %99

99:                                               ; preds = %98
  %100 = load ptr, ptr %13, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.ListElmt_, ptr %100, i32 0, i32 1
  %102 = load ptr, ptr %101, align 8, !tbaa !23
  store ptr %102, ptr %13, align 8, !tbaa !5
  br label %72, !llvm.loop !28

103:                                              ; preds = %72
  %104 = load ptr, ptr %10, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.AdjList_, ptr %104, i32 0, i32 0
  %106 = load ptr, ptr %105, align 8, !tbaa !16
  %107 = getelementptr inbounds %struct.MstVertex_, ptr %106, i32 0, i32 2
  store i32 2, ptr %107, align 8, !tbaa !18
  %108 = load ptr, ptr %10, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.AdjList_, ptr %108, i32 0, i32 1
  %110 = getelementptr inbounds %struct.List_, ptr %109, i32 0, i32 3
  %111 = load ptr, ptr %110, align 8, !tbaa !29
  store ptr %111, ptr %14, align 8, !tbaa !5
  br label %112

112:                                              ; preds = %168, %103
  %113 = load ptr, ptr %14, align 8, !tbaa !5
  %114 = icmp ne ptr %113, null
  br i1 %114, label %115, label %172

115:                                              ; preds = %112
  %116 = load ptr, ptr %14, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.ListElmt_, ptr %116, i32 0, i32 0
  %118 = load ptr, ptr %117, align 8, !tbaa !14
  store ptr %118, ptr %12, align 8, !tbaa !5
  %119 = load ptr, ptr %6, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.Graph_, ptr %119, i32 0, i32 4
  %121 = getelementptr inbounds %struct.List_, ptr %120, i32 0, i32 3
  %122 = load ptr, ptr %121, align 8, !tbaa !11
  store ptr %122, ptr %13, align 8, !tbaa !5
  br label %123

123:                                              ; preds = %163, %115
  %124 = load ptr, ptr %13, align 8, !tbaa !5
  %125 = icmp ne ptr %124, null
  br i1 %125, label %126, label %167

126:                                              ; preds = %123
  %127 = load ptr, ptr %13, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.ListElmt_, ptr %127, i32 0, i32 0
  %129 = load ptr, ptr %128, align 8, !tbaa !14
  %130 = getelementptr inbounds %struct.AdjList_, ptr %129, i32 0, i32 0
  %131 = load ptr, ptr %130, align 8, !tbaa !16
  store ptr %131, ptr %11, align 8, !tbaa !5
  %132 = load ptr, ptr %9, align 8, !tbaa !5
  %133 = load ptr, ptr %11, align 8, !tbaa !5
  %134 = load ptr, ptr %12, align 8, !tbaa !5
  %135 = call i32 %132(ptr noundef %133, ptr noundef %134)
  %136 = icmp ne i32 %135, 0
  br i1 %136, label %137, label %162

137:                                              ; preds = %126
  %138 = load ptr, ptr %11, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.MstVertex_, ptr %138, i32 0, i32 2
  %140 = load i32, ptr %139, align 8, !tbaa !18
  %141 = icmp eq i32 %140, 0
  br i1 %141, label %142, label %161

142:                                              ; preds = %137
  %143 = load ptr, ptr %12, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.MstVertex_, ptr %143, i32 0, i32 1
  %145 = load double, ptr %144, align 8, !tbaa !30
  %146 = load ptr, ptr %11, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.MstVertex_, ptr %146, i32 0, i32 3
  %148 = load double, ptr %147, align 8, !tbaa !21
  %149 = fcmp olt double %145, %148
  br i1 %149, label %150, label %161

150:                                              ; preds = %142
  %151 = load ptr, ptr %12, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.MstVertex_, ptr %151, i32 0, i32 1
  %153 = load double, ptr %152, align 8, !tbaa !30
  %154 = load ptr, ptr %11, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.MstVertex_, ptr %154, i32 0, i32 3
  store double %153, ptr %155, align 8, !tbaa !21
  %156 = load ptr, ptr %10, align 8, !tbaa !5
  %157 = getelementptr inbounds %struct.AdjList_, ptr %156, i32 0, i32 0
  %158 = load ptr, ptr %157, align 8, !tbaa !16
  %159 = load ptr, ptr %11, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.MstVertex_, ptr %159, i32 0, i32 4
  store ptr %158, ptr %160, align 8, !tbaa !22
  br label %161

161:                                              ; preds = %150, %142, %137
  br label %167

162:                                              ; preds = %126
  br label %163

163:                                              ; preds = %162
  %164 = load ptr, ptr %13, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct.ListElmt_, ptr %164, i32 0, i32 1
  %166 = load ptr, ptr %165, align 8, !tbaa !23
  store ptr %166, ptr %13, align 8, !tbaa !5
  br label %123, !llvm.loop !31

167:                                              ; preds = %161, %123
  br label %168

168:                                              ; preds = %167
  %169 = load ptr, ptr %14, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.ListElmt_, ptr %169, i32 0, i32 1
  %171 = load ptr, ptr %170, align 8, !tbaa !23
  store ptr %171, ptr %14, align 8, !tbaa !5
  br label %112, !llvm.loop !32

172:                                              ; preds = %112
  %173 = load i32, ptr %17, align 4, !tbaa !9
  %174 = add nsw i32 %173, 1
  store i32 %174, ptr %17, align 4, !tbaa !9
  br label %61, !llvm.loop !33

175:                                              ; preds = %61
  %176 = load ptr, ptr %8, align 8, !tbaa !5
  call void @list_init(ptr noundef %176, ptr noundef null)
  %177 = load ptr, ptr %6, align 8, !tbaa !5
  %178 = getelementptr inbounds %struct.Graph_, ptr %177, i32 0, i32 4
  %179 = getelementptr inbounds %struct.List_, ptr %178, i32 0, i32 3
  %180 = load ptr, ptr %179, align 8, !tbaa !11
  store ptr %180, ptr %13, align 8, !tbaa !5
  br label %181

181:                                              ; preds = %206, %175
  %182 = load ptr, ptr %13, align 8, !tbaa !5
  %183 = icmp ne ptr %182, null
  br i1 %183, label %184, label %210

184:                                              ; preds = %181
  %185 = load ptr, ptr %13, align 8, !tbaa !5
  %186 = getelementptr inbounds %struct.ListElmt_, ptr %185, i32 0, i32 0
  %187 = load ptr, ptr %186, align 8, !tbaa !14
  %188 = getelementptr inbounds %struct.AdjList_, ptr %187, i32 0, i32 0
  %189 = load ptr, ptr %188, align 8, !tbaa !16
  store ptr %189, ptr %11, align 8, !tbaa !5
  %190 = load ptr, ptr %11, align 8, !tbaa !5
  %191 = getelementptr inbounds %struct.MstVertex_, ptr %190, i32 0, i32 2
  %192 = load i32, ptr %191, align 8, !tbaa !18
  %193 = icmp eq i32 %192, 2
  br i1 %193, label %194, label %205

194:                                              ; preds = %184
  %195 = load ptr, ptr %8, align 8, !tbaa !5
  %196 = load ptr, ptr %8, align 8, !tbaa !5
  %197 = getelementptr inbounds %struct.List_, ptr %196, i32 0, i32 4
  %198 = load ptr, ptr %197, align 8, !tbaa !34
  %199 = load ptr, ptr %11, align 8, !tbaa !5
  %200 = call i32 @list_ins_next(ptr noundef %195, ptr noundef %198, ptr noundef %199)
  %201 = icmp ne i32 %200, 0
  br i1 %201, label %202, label %204

202:                                              ; preds = %194
  %203 = load ptr, ptr %8, align 8, !tbaa !5
  call void @list_destroy(ptr noundef %203)
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %18, align 4
  br label %211

204:                                              ; preds = %194
  br label %205

205:                                              ; preds = %204, %184
  br label %206

206:                                              ; preds = %205
  %207 = load ptr, ptr %13, align 8, !tbaa !5
  %208 = getelementptr inbounds %struct.ListElmt_, ptr %207, i32 0, i32 1
  %209 = load ptr, ptr %208, align 8, !tbaa !23
  store ptr %209, ptr %13, align 8, !tbaa !5
  br label %181, !llvm.loop !35

210:                                              ; preds = %181
  store i32 0, ptr %5, align 4
  store i32 1, ptr %18, align 4
  br label %211

211:                                              ; preds = %210, %202, %59
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  %212 = load i32, ptr %5, align 4
  ret i32 %212
}

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

declare void @list_init(ptr noundef, ptr noundef) #2

declare i32 @list_ins_next(ptr noundef, ptr noundef, ptr noundef) #2

declare void @list_destroy(ptr noundef) #2

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

!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, !6, i64 48}
!12 = !{!"Graph_", !10, i64 0, !10, i64 4, !6, i64 8, !6, i64 16, !13, i64 24}
!13 = !{!"List_", !10, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!14 = !{!15, !6, i64 0}
!15 = !{!"ListElmt_", !6, i64 0, !6, i64 8}
!16 = !{!17, !6, i64 0}
!17 = !{!"AdjList_", !6, i64 0, !13, i64 8}
!18 = !{!19, !10, i64 16}
!19 = !{!"MstVertex_", !6, i64 0, !20, i64 8, !10, i64 16, !20, i64 24, !6, i64 32}
!20 = !{!"double", !7, i64 0}
!21 = !{!19, !20, i64 24}
!22 = !{!19, !6, i64 32}
!23 = !{!15, !6, i64 8}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = !{!12, !10, i64 0}
!27 = !{!20, !20, i64 0}
!28 = distinct !{!28, !25}
!29 = !{!17, !6, i64 32}
!30 = !{!19, !20, i64 8}
!31 = distinct !{!31, !25}
!32 = distinct !{!32, !25}
!33 = distinct !{!33, !25}
!34 = !{!13, !6, i64 32}
!35 = distinct !{!35, !25}


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

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @mst(ptr nocapture noundef readonly %0, ptr noundef %1, ptr noundef %2, ptr nocapture noundef readonly %3) local_unnamed_addr #0 {
  %5 = getelementptr inbounds i8, ptr %0, i64 48
  %.05977 = load ptr, ptr %5, align 8, !tbaa !5
  %.not78 = icmp eq ptr %.05977, null
  br i1 %.not78, label %.loopexit, label %.lr.ph.outer

.lr.ph.outer:                                     ; preds = %4, %.thread
  %.05980.ph = phi ptr [ %.059113, %.thread ], [ %.05977, %4 ]
  %6 = phi i1 [ false, %.thread ], [ true, %4 ]
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.outer, %12
  %.05980 = phi ptr [ %.059, %12 ], [ %.05980.ph, %.lr.ph.outer ]
  %7 = load ptr, ptr %.05980, align 8, !tbaa !9
  %8 = load ptr, ptr %7, align 8, !tbaa !11
  %9 = tail call i32 %3(ptr noundef %8, ptr noundef %1) #3
  %.not74 = icmp eq i32 %9, 0
  %10 = getelementptr inbounds i8, ptr %8, i64 16
  store i32 0, ptr %10, align 8
  %11 = getelementptr inbounds i8, ptr %8, i64 24
  br i1 %.not74, label %12, label %.thread

12:                                               ; preds = %.lr.ph
  store double 0x7FEFFFFFFFFFFFFF, ptr %11, align 8
  %13 = getelementptr inbounds i8, ptr %8, i64 32
  store ptr null, ptr %13, align 8
  %14 = getelementptr inbounds i8, ptr %.05980, i64 8
  %.059 = load ptr, ptr %14, align 8, !tbaa !5
  %.not = icmp eq ptr %.059, null
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !15

.thread:                                          ; preds = %.lr.ph
  %15 = getelementptr inbounds i8, ptr %.05980, i64 8
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %11, i8 0, i64 16, i1 false)
  %.059113 = load ptr, ptr %15, align 8, !tbaa !5
  %.not114 = icmp eq ptr %.059113, null
  br i1 %.not114, label %.preheader76, label %.lr.ph.outer, !llvm.loop !15

._crit_edge:                                      ; preds = %12
  br i1 %6, label %.loopexit, label %.preheader76

.preheader76:                                     ; preds = %.thread, %._crit_edge
  %16 = load i32, ptr %0, align 8, !tbaa !17
  %17 = icmp sgt i32 %16, 0
  br i1 %17, label %.preheader, label %._crit_edge102

.preheader:                                       ; preds = %.preheader76, %._crit_edge99
  %18 = phi i32 [ %56, %._crit_edge99 ], [ %16, %.preheader76 ]
  %.0101 = phi i32 [ %57, %._crit_edge99 ], [ 0, %.preheader76 ]
  %.062100 = phi ptr [ %.163.lcssa122, %._crit_edge99 ], [ null, %.preheader76 ]
  %.16081 = load ptr, ptr %5, align 8, !tbaa !5
  %.not7082 = icmp eq ptr %.16081, null
  br i1 %.not7082, label %._crit_edge87.thread, label %.lr.ph86

.lr.ph86:                                         ; preds = %.preheader, %29
  %.16085 = phi ptr [ %.160, %29 ], [ %.16081, %.preheader ]
  %.05684 = phi double [ %.157, %29 ], [ 0x7FEFFFFFFFFFFFFF, %.preheader ]
  %.16383 = phi ptr [ %.264, %29 ], [ %.062100, %.preheader ]
  %19 = load ptr, ptr %.16085, align 8, !tbaa !9
  %20 = load ptr, ptr %19, align 8, !tbaa !11
  %21 = getelementptr inbounds i8, ptr %20, i64 16
  %22 = load i32, ptr %21, align 8, !tbaa !19
  %23 = icmp eq i32 %22, 0
  br i1 %23, label %24, label %29

24:                                               ; preds = %.lr.ph86
  %25 = getelementptr inbounds i8, ptr %20, i64 24
  %26 = load double, ptr %25, align 8, !tbaa !22
  %27 = fcmp olt double %26, %.05684
  br i1 %27, label %28, label %29

28:                                               ; preds = %24
  br label %29

29:                                               ; preds = %.lr.ph86, %24, %28
  %.264 = phi ptr [ %19, %28 ], [ %.16383, %24 ], [ %.16383, %.lr.ph86 ]
  %.157 = phi double [ %26, %28 ], [ %.05684, %24 ], [ %.05684, %.lr.ph86 ]
  %30 = getelementptr inbounds i8, ptr %.16085, i64 8
  %.160 = load ptr, ptr %30, align 8, !tbaa !5
  %.not70 = icmp eq ptr %.160, null
  br i1 %.not70, label %._crit_edge87, label %.lr.ph86, !llvm.loop !23

._crit_edge87:                                    ; preds = %29
  %31 = load ptr, ptr %.264, align 8, !tbaa !11
  %32 = getelementptr inbounds i8, ptr %31, i64 16
  store i32 2, ptr %32, align 8, !tbaa !19
  %33 = getelementptr inbounds i8, ptr %.264, i64 32
  %.05894 = load ptr, ptr %33, align 8, !tbaa !5
  %.not7195 = icmp eq ptr %.05894, null
  %brmerge = or i1 %.not7195, %.not7082
  br i1 %brmerge, label %._crit_edge99, label %.lr.ph98.split

._crit_edge87.thread:                             ; preds = %.preheader
  %34 = load ptr, ptr %.062100, align 8, !tbaa !11
  %35 = getelementptr inbounds i8, ptr %34, i64 16
  store i32 2, ptr %35, align 8, !tbaa !19
  br label %._crit_edge99

.lr.ph98.split:                                   ; preds = %._crit_edge87, %.loopexit75
  %.05896 = phi ptr [ %.058, %.loopexit75 ], [ %.05894, %._crit_edge87 ]
  %36 = load ptr, ptr %.05896, align 8, !tbaa !9
  %.289 = load ptr, ptr %5, align 8, !tbaa !5
  %.not7290 = icmp eq ptr %.289, null
  br i1 %.not7290, label %.loopexit75, label %.lr.ph93

37:                                               ; preds = %.lr.ph93
  %38 = getelementptr inbounds i8, ptr %.291, i64 8
  %.2 = load ptr, ptr %38, align 8, !tbaa !5
  %.not72 = icmp eq ptr %.2, null
  br i1 %.not72, label %.loopexit75, label %.lr.ph93, !llvm.loop !24

.lr.ph93:                                         ; preds = %.lr.ph98.split, %37
  %.291 = phi ptr [ %.2, %37 ], [ %.289, %.lr.ph98.split ]
  %39 = load ptr, ptr %.291, align 8, !tbaa !9
  %40 = load ptr, ptr %39, align 8, !tbaa !11
  %41 = tail call i32 %3(ptr noundef %40, ptr noundef %36) #3
  %.not73 = icmp eq i32 %41, 0
  br i1 %.not73, label %37, label %42

42:                                               ; preds = %.lr.ph93
  %43 = getelementptr inbounds i8, ptr %40, i64 16
  %44 = load i32, ptr %43, align 8, !tbaa !19
  %45 = icmp eq i32 %44, 0
  br i1 %45, label %46, label %.loopexit75

46:                                               ; preds = %42
  %47 = getelementptr inbounds i8, ptr %36, i64 8
  %48 = load double, ptr %47, align 8, !tbaa !25
  %49 = getelementptr inbounds i8, ptr %40, i64 24
  %50 = load double, ptr %49, align 8, !tbaa !22
  %51 = fcmp olt double %48, %50
  br i1 %51, label %52, label %.loopexit75

52:                                               ; preds = %46
  store double %48, ptr %49, align 8, !tbaa !22
  %53 = load ptr, ptr %.264, align 8, !tbaa !11
  %54 = getelementptr inbounds i8, ptr %40, i64 32
  store ptr %53, ptr %54, align 8, !tbaa !26
  br label %.loopexit75

.loopexit75:                                      ; preds = %37, %.lr.ph98.split, %52, %46, %42
  %55 = getelementptr inbounds i8, ptr %.05896, i64 8
  %.058 = load ptr, ptr %55, align 8, !tbaa !5
  %.not71 = icmp eq ptr %.058, null
  br i1 %.not71, label %._crit_edge99.loopexit108, label %.lr.ph98.split, !llvm.loop !27

._crit_edge99.loopexit108:                        ; preds = %.loopexit75
  %.pre = load i32, ptr %0, align 8, !tbaa !17
  br label %._crit_edge99

._crit_edge99:                                    ; preds = %._crit_edge87, %._crit_edge87.thread, %._crit_edge99.loopexit108
  %.163.lcssa122 = phi ptr [ %.264, %._crit_edge99.loopexit108 ], [ %.264, %._crit_edge87 ], [ %.062100, %._crit_edge87.thread ]
  %56 = phi i32 [ %.pre, %._crit_edge99.loopexit108 ], [ %18, %._crit_edge87 ], [ %18, %._crit_edge87.thread ]
  %57 = add nuw nsw i32 %.0101, 1
  %58 = icmp slt i32 %57, %56
  br i1 %58, label %.preheader, label %._crit_edge102, !llvm.loop !29

._crit_edge102:                                   ; preds = %._crit_edge99, %.preheader76
  tail call void @list_init(ptr noundef %2, ptr noundef null) #3
  %.3103 = load ptr, ptr %5, align 8, !tbaa !5
  %.not68104 = icmp eq ptr %.3103, null
  br i1 %.not68104, label %.loopexit, label %.lr.ph107

.lr.ph107:                                        ; preds = %._crit_edge102
  %59 = getelementptr inbounds i8, ptr %2, i64 32
  br label %60

60:                                               ; preds = %.lr.ph107, %70
  %.3105 = phi ptr [ %.3103, %.lr.ph107 ], [ %.3, %70 ]
  %61 = load ptr, ptr %.3105, align 8, !tbaa !9
  %62 = load ptr, ptr %61, align 8, !tbaa !11
  %63 = getelementptr inbounds i8, ptr %62, i64 16
  %64 = load i32, ptr %63, align 8, !tbaa !19
  %65 = icmp eq i32 %64, 2
  br i1 %65, label %66, label %70

66:                                               ; preds = %60
  %67 = load ptr, ptr %59, align 8, !tbaa !30
  %68 = tail call i32 @list_ins_next(ptr noundef %2, ptr noundef %67, ptr noundef nonnull %62) #3
  %.not69 = icmp eq i32 %68, 0
  br i1 %.not69, label %70, label %69

69:                                               ; preds = %66
  tail call void @list_destroy(ptr noundef nonnull %2) #3
  br label %.loopexit

70:                                               ; preds = %60, %66
  %71 = getelementptr inbounds i8, ptr %.3105, i64 8
  %.3 = load ptr, ptr %71, align 8, !tbaa !5
  %.not68 = icmp eq ptr %.3, null
  br i1 %.not68, label %.loopexit, label %60, !llvm.loop !31

.loopexit:                                        ; preds = %70, %4, %._crit_edge102, %._crit_edge, %69
  %.061 = phi i32 [ -1, %69 ], [ -1, %._crit_edge ], [ 0, %._crit_edge102 ], [ -1, %4 ], [ 0, %70 ]
  ret i32 %.061
}

declare void @list_init(ptr noundef, ptr noundef) local_unnamed_addr #1

declare i32 @list_ins_next(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare void @list_destroy(ptr noundef) local_unnamed_addr #1

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

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { 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, !6, i64 0}
!10 = !{!"ListElmt_", !6, i64 0, !6, i64 8}
!11 = !{!12, !6, i64 0}
!12 = !{!"AdjList_", !6, i64 0, !13, i64 8}
!13 = !{!"List_", !14, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!14 = !{!"int", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!18, !14, i64 0}
!18 = !{!"Graph_", !14, i64 0, !14, i64 4, !6, i64 8, !6, i64 16, !13, i64 24}
!19 = !{!20, !14, i64 16}
!20 = !{!"MstVertex_", !6, i64 0, !21, i64 8, !14, i64 16, !21, i64 24, !6, i64 32}
!21 = !{!"double", !7, i64 0}
!22 = !{!20, !21, i64 24}
!23 = distinct !{!23, !16}
!24 = distinct !{!24, !16}
!25 = !{!20, !21, i64 8}
!26 = !{!20, !6, i64 32}
!27 = distinct !{!27, !16, !28}
!28 = !{!"llvm.loop.unswitch.partial.disable"}
!29 = distinct !{!29, !16}
!30 = !{!13, !6, i64 32}
!31 = distinct !{!31, !16}


; Effective O3 passes: ADCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,MemCpyOptPass,MergedLoadStoreMotionPass,PostOrderFunctionAttrsPass,SROAPass,SimpleLoopUnswitchPass,SimplifyCFGPass,TailCallElimPass