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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @tsp(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 double, align 8
  %15 = alloca double, align 8
  %16 = alloca double, align 8
  %17 = alloca double, align 8
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = 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) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  store ptr null, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  store double 0.000000e+00, ptr %16, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  store double 0.000000e+00, ptr %17, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #4
  %21 = load ptr, ptr %8, align 8, !tbaa !5
  call void @list_init(ptr noundef %21, ptr noundef null)
  store i32 0, ptr %18, align 4, !tbaa !11
  %22 = load ptr, ptr %6, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.List_, ptr %22, i32 0, i32 3
  %24 = load ptr, ptr %23, align 8, !tbaa !13
  store ptr %24, ptr %13, align 8, !tbaa !5
  br label %25

25:                                               ; preds = %61, %4
  %26 = load ptr, ptr %13, align 8, !tbaa !5
  %27 = icmp ne ptr %26, null
  br i1 %27, label %28, label %65

28:                                               ; preds = %25
  %29 = load ptr, ptr %13, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.ListElmt_, ptr %29, i32 0, i32 0
  %31 = load ptr, ptr %30, align 8, !tbaa !15
  store ptr %31, ptr %10, align 8, !tbaa !5
  %32 = load ptr, ptr %9, align 8, !tbaa !5
  %33 = load ptr, ptr %10, 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 %57

37:                                               ; preds = %28
  %38 = load ptr, ptr %8, align 8, !tbaa !5
  %39 = load ptr, ptr %8, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.List_, ptr %39, i32 0, i32 4
  %41 = load ptr, ptr %40, align 8, !tbaa !17
  %42 = load ptr, ptr %10, align 8, !tbaa !5
  %43 = call i32 @list_ins_next(ptr noundef %38, ptr noundef %41, ptr noundef %42)
  %44 = icmp ne i32 %43, 0
  br i1 %44, label %45, label %47

45:                                               ; preds = %37
  %46 = load ptr, ptr %8, align 8, !tbaa !5
  call void @list_destroy(ptr noundef %46)
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %20, align 4
  br label %152

47:                                               ; preds = %37
  %48 = load ptr, ptr %10, align 8, !tbaa !5
  store ptr %48, ptr %11, align 8, !tbaa !5
  %49 = load ptr, ptr %10, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.TspVertex_, ptr %49, i32 0, i32 1
  %51 = load double, ptr %50, align 8, !tbaa !18
  store double %51, ptr %16, align 8, !tbaa !9
  %52 = load ptr, ptr %10, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.TspVertex_, ptr %52, i32 0, i32 2
  %54 = load double, ptr %53, align 8, !tbaa !20
  store double %54, ptr %17, align 8, !tbaa !9
  %55 = load ptr, ptr %10, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.TspVertex_, ptr %55, i32 0, i32 3
  store i32 2, ptr %56, align 8, !tbaa !21
  store i32 1, ptr %18, align 4, !tbaa !11
  br label %60

57:                                               ; preds = %28
  %58 = load ptr, ptr %10, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.TspVertex_, ptr %58, i32 0, i32 3
  store i32 0, ptr %59, align 8, !tbaa !21
  br label %60

60:                                               ; preds = %57, %47
  br label %61

61:                                               ; preds = %60
  %62 = load ptr, ptr %13, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.ListElmt_, ptr %62, i32 0, i32 1
  %64 = load ptr, ptr %63, align 8, !tbaa !22
  store ptr %64, ptr %13, align 8, !tbaa !5
  br label %25, !llvm.loop !23

65:                                               ; preds = %25
  %66 = load i32, ptr %18, align 4, !tbaa !11
  %67 = icmp ne i32 %66, 0
  br i1 %67, label %70, label %68

68:                                               ; preds = %65
  %69 = load ptr, ptr %8, align 8, !tbaa !5
  call void @list_destroy(ptr noundef %69)
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %20, align 4
  br label %152

70:                                               ; preds = %65
  store i32 0, ptr %19, align 4, !tbaa !11
  br label %71

71:                                               ; preds = %138, %70
  %72 = load i32, ptr %19, align 4, !tbaa !11
  %73 = load ptr, ptr %6, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.List_, ptr %73, i32 0, i32 0
  %75 = load i32, ptr %74, align 8, !tbaa !25
  %76 = sub nsw i32 %75, 1
  %77 = icmp slt i32 %72, %76
  br i1 %77, label %78, label %141

78:                                               ; preds = %71
  store double 0x7FEFFFFFFFFFFFFF, ptr %14, align 8, !tbaa !9
  %79 = load ptr, ptr %6, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.List_, ptr %79, i32 0, i32 3
  %81 = load ptr, ptr %80, align 8, !tbaa !13
  store ptr %81, ptr %13, align 8, !tbaa !5
  br label %82

82:                                               ; preds = %116, %78
  %83 = load ptr, ptr %13, align 8, !tbaa !5
  %84 = icmp ne ptr %83, null
  br i1 %84, label %85, label %120

85:                                               ; preds = %82
  %86 = load ptr, ptr %13, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.ListElmt_, ptr %86, i32 0, i32 0
  %88 = load ptr, ptr %87, align 8, !tbaa !15
  store ptr %88, ptr %10, align 8, !tbaa !5
  %89 = load ptr, ptr %10, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.TspVertex_, ptr %89, i32 0, i32 3
  %91 = load i32, ptr %90, align 8, !tbaa !21
  %92 = icmp eq i32 %91, 0
  br i1 %92, label %93, label %115

93:                                               ; preds = %85
  %94 = load ptr, ptr %10, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.TspVertex_, ptr %94, i32 0, i32 1
  %96 = load double, ptr %95, align 8, !tbaa !18
  %97 = load double, ptr %16, align 8, !tbaa !9
  %98 = fsub double %96, %97
  %99 = call double @pow(double noundef %98, double noundef 2.000000e+00) #4
  %100 = load ptr, ptr %10, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.TspVertex_, ptr %100, i32 0, i32 2
  %102 = load double, ptr %101, align 8, !tbaa !20
  %103 = load double, ptr %17, align 8, !tbaa !9
  %104 = fsub double %102, %103
  %105 = call double @pow(double noundef %104, double noundef 2.000000e+00) #4
  %106 = fadd double %99, %105
  %107 = call double @sqrt(double noundef %106) #4
  store double %107, ptr %15, align 8, !tbaa !9
  %108 = load double, ptr %15, align 8, !tbaa !9
  %109 = load double, ptr %14, align 8, !tbaa !9
  %110 = fcmp olt double %108, %109
  br i1 %110, label %111, label %114

111:                                              ; preds = %93
  %112 = load double, ptr %15, align 8, !tbaa !9
  store double %112, ptr %14, align 8, !tbaa !9
  %113 = load ptr, ptr %10, align 8, !tbaa !5
  store ptr %113, ptr %12, align 8, !tbaa !5
  br label %114

114:                                              ; preds = %111, %93
  br label %115

115:                                              ; preds = %114, %85
  br label %116

116:                                              ; preds = %115
  %117 = load ptr, ptr %13, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.ListElmt_, ptr %117, i32 0, i32 1
  %119 = load ptr, ptr %118, align 8, !tbaa !22
  store ptr %119, ptr %13, align 8, !tbaa !5
  br label %82, !llvm.loop !26

120:                                              ; preds = %82
  %121 = load ptr, ptr %12, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.TspVertex_, ptr %121, i32 0, i32 1
  %123 = load double, ptr %122, align 8, !tbaa !18
  store double %123, ptr %16, align 8, !tbaa !9
  %124 = load ptr, ptr %12, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.TspVertex_, ptr %124, i32 0, i32 2
  %126 = load double, ptr %125, align 8, !tbaa !20
  store double %126, ptr %17, align 8, !tbaa !9
  %127 = load ptr, ptr %12, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.TspVertex_, ptr %127, i32 0, i32 3
  store i32 2, ptr %128, align 8, !tbaa !21
  %129 = load ptr, ptr %8, align 8, !tbaa !5
  %130 = load ptr, ptr %8, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.List_, ptr %130, i32 0, i32 4
  %132 = load ptr, ptr %131, align 8, !tbaa !17
  %133 = load ptr, ptr %12, align 8, !tbaa !5
  %134 = call i32 @list_ins_next(ptr noundef %129, ptr noundef %132, ptr noundef %133)
  %135 = icmp ne i32 %134, 0
  br i1 %135, label %136, label %138

136:                                              ; preds = %120
  %137 = load ptr, ptr %8, align 8, !tbaa !5
  call void @list_destroy(ptr noundef %137)
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %20, align 4
  br label %152

138:                                              ; preds = %120
  %139 = load i32, ptr %19, align 4, !tbaa !11
  %140 = add nsw i32 %139, 1
  store i32 %140, ptr %19, align 4, !tbaa !11
  br label %71, !llvm.loop !27

141:                                              ; preds = %71
  %142 = load ptr, ptr %8, align 8, !tbaa !5
  %143 = load ptr, ptr %8, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.List_, ptr %143, i32 0, i32 4
  %145 = load ptr, ptr %144, align 8, !tbaa !17
  %146 = load ptr, ptr %11, align 8, !tbaa !5
  %147 = call i32 @list_ins_next(ptr noundef %142, ptr noundef %145, ptr noundef %146)
  %148 = icmp ne i32 %147, 0
  br i1 %148, label %149, label %151

149:                                              ; preds = %141
  %150 = load ptr, ptr %8, align 8, !tbaa !5
  call void @list_destroy(ptr noundef %150)
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %20, align 4
  br label %152

151:                                              ; preds = %141
  store i32 0, ptr %5, align 4
  store i32 1, ptr %20, align 4
  br label %152

152:                                              ; preds = %151, %149, %136, %68, %45
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  %153 = load i32, ptr %5, align 4
  ret i32 %153
}

; 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: nounwind
declare double @sqrt(double noundef) #3

; Function Attrs: nounwind
declare double @pow(double noundef, double noundef) #3

; 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 = { 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 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !6, i64 24}
!14 = !{!"List_", !12, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!15 = !{!16, !6, i64 0}
!16 = !{!"ListElmt_", !6, i64 0, !6, i64 8}
!17 = !{!14, !6, i64 32}
!18 = !{!19, !10, i64 8}
!19 = !{!"TspVertex_", !6, i64 0, !10, i64 8, !10, i64 16, !12, i64 24}
!20 = !{!19, !10, i64 16}
!21 = !{!19, !12, i64 24}
!22 = !{!16, !6, i64 8}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}
!25 = !{!14, !12, i64 0}
!26 = distinct !{!26, !24}
!27 = distinct !{!27, !24}


; 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 @tsp(ptr nocapture noundef readonly %0, ptr noundef %1, ptr noundef %2, ptr nocapture noundef readonly %3) local_unnamed_addr #0 {
  tail call void @list_init(ptr noundef %2, ptr noundef null) #3
  %5 = getelementptr inbounds i8, ptr %0, i64 24
  %.05575 = load ptr, ptr %5, align 8, !tbaa !5
  %.not76 = icmp eq ptr %.05575, null
  br i1 %.not76, label %._crit_edge.thread, label %.lr.ph

.lr.ph:                                           ; preds = %4
  %6 = getelementptr inbounds i8, ptr %2, i64 32
  br label %.outer

.outer:                                           ; preds = %.thread, %.lr.ph
  %.05581.ph = phi ptr [ %.055106, %.thread ], [ %.05575, %.lr.ph ]
  %7 = phi i1 [ false, %.thread ], [ true, %.lr.ph ]
  %.06077.ph = phi ptr [ %10, %.thread ], [ undef, %.lr.ph ]
  %8 = phi <2 x double> [ %20, %.thread ], [ zeroinitializer, %.lr.ph ]
  br label %9

9:                                                ; preds = %.outer, %16
  %.05581 = phi ptr [ %.055, %16 ], [ %.05581.ph, %.outer ]
  %10 = load ptr, ptr %.05581, align 8, !tbaa !9
  %11 = tail call i32 %3(ptr noundef %10, ptr noundef %1) #3
  %.not68 = icmp eq i32 %11, 0
  br i1 %.not68, label %16, label %12

12:                                               ; preds = %9
  %13 = load ptr, ptr %6, align 8, !tbaa !11
  %14 = tail call i32 @list_ins_next(ptr noundef %2, ptr noundef %13, ptr noundef %10) #3
  %.not69 = icmp eq i32 %14, 0
  br i1 %.not69, label %.thread, label %15

15:                                               ; preds = %12
  tail call void @list_destroy(ptr noundef nonnull %2) #3
  br label %58

16:                                               ; preds = %9
  %17 = getelementptr inbounds i8, ptr %10, i64 24
  store i32 0, ptr %17, align 8, !tbaa !14
  %18 = getelementptr inbounds i8, ptr %.05581, i64 8
  %.055 = load ptr, ptr %18, align 8, !tbaa !5
  %.not = icmp eq ptr %.055, null
  br i1 %.not, label %._crit_edge, label %9, !llvm.loop !17

.thread:                                          ; preds = %12
  %19 = getelementptr inbounds i8, ptr %10, i64 8
  %20 = load <2 x double>, ptr %19, align 8, !tbaa !19
  %21 = getelementptr inbounds i8, ptr %10, i64 24
  store i32 2, ptr %21, align 8, !tbaa !14
  %22 = getelementptr inbounds i8, ptr %.05581, i64 8
  %.055106 = load ptr, ptr %22, align 8, !tbaa !5
  %.not107 = icmp eq ptr %.055106, null
  br i1 %.not107, label %.preheader70, label %.outer, !llvm.loop !17

._crit_edge:                                      ; preds = %16
  br i1 %7, label %._crit_edge.thread, label %.preheader70

.preheader70:                                     ; preds = %.thread, %._crit_edge
  %.161108119 = phi ptr [ %.06077.ph, %._crit_edge ], [ %10, %.thread ]
  %23 = phi <2 x double> [ %8, %._crit_edge ], [ %20, %.thread ]
  %24 = load i32, ptr %0, align 8, !tbaa !20
  %25 = icmp sgt i32 %24, 1
  br i1 %25, label %.preheader.lr.ph, label %._crit_edge97

.preheader.lr.ph:                                 ; preds = %.preheader70
  %26 = getelementptr inbounds i8, ptr %2, i64 32
  br label %.preheader

._crit_edge.thread:                               ; preds = %4, %._crit_edge
  tail call void @list_destroy(ptr noundef %2) #3
  br label %58

27:                                               ; preds = %._crit_edge91
  %28 = add nuw nsw i32 %.096, 1
  %29 = load i32, ptr %0, align 8, !tbaa !20
  %30 = add nsw i32 %29, -1
  %31 = icmp slt i32 %28, %30
  br i1 %31, label %.preheader, label %._crit_edge97, !llvm.loop !21

.preheader:                                       ; preds = %.preheader.lr.ph, %27
  %.096 = phi i32 [ 0, %.preheader.lr.ph ], [ %28, %27 ]
  %.05793 = phi ptr [ null, %.preheader.lr.ph ], [ %.158.lcssa, %27 ]
  %32 = phi <2 x double> [ %23, %.preheader.lr.ph ], [ %49, %27 ]
  %.15685 = load ptr, ptr %5, align 8, !tbaa !5
  %.not6586 = icmp eq ptr %.15685, null
  br i1 %.not6586, label %._crit_edge91, label %.lr.ph90

.lr.ph90:                                         ; preds = %.preheader, %46
  %.15689 = phi ptr [ %.156, %46 ], [ %.15685, %.preheader ]
  %.05388 = phi double [ %.154, %46 ], [ 0x7FEFFFFFFFFFFFFF, %.preheader ]
  %.15887 = phi ptr [ %.259, %46 ], [ %.05793, %.preheader ]
  %33 = load ptr, ptr %.15689, align 8, !tbaa !9
  %34 = getelementptr inbounds i8, ptr %33, i64 24
  %35 = load i32, ptr %34, align 8, !tbaa !14
  %36 = icmp eq i32 %35, 0
  br i1 %36, label %37, label %46

37:                                               ; preds = %.lr.ph90
  %38 = getelementptr inbounds i8, ptr %33, i64 8
  %39 = load <2 x double>, ptr %38, align 8, !tbaa !19
  %40 = fsub <2 x double> %39, %32
  %41 = fmul <2 x double> %40, %40
  %shift = shufflevector <2 x double> %41, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
  %42 = fadd <2 x double> %41, %shift
  %43 = extractelement <2 x double> %42, i64 0
  %sqrt = tail call double @llvm.sqrt.f64(double %43)
  %44 = fcmp olt double %sqrt, %.05388
  br i1 %44, label %45, label %46

45:                                               ; preds = %37
  br label %46

46:                                               ; preds = %.lr.ph90, %45, %37
  %.259 = phi ptr [ %33, %45 ], [ %.15887, %37 ], [ %.15887, %.lr.ph90 ]
  %.154 = phi double [ %sqrt, %45 ], [ %.05388, %37 ], [ %.05388, %.lr.ph90 ]
  %47 = getelementptr inbounds i8, ptr %.15689, i64 8
  %.156 = load ptr, ptr %47, align 8, !tbaa !5
  %.not65 = icmp eq ptr %.156, null
  br i1 %.not65, label %._crit_edge91, label %.lr.ph90, !llvm.loop !22

._crit_edge91:                                    ; preds = %46, %.preheader
  %.158.lcssa = phi ptr [ %.05793, %.preheader ], [ %.259, %46 ]
  %48 = getelementptr inbounds i8, ptr %.158.lcssa, i64 8
  %49 = load <2 x double>, ptr %48, align 8, !tbaa !19
  %50 = getelementptr inbounds i8, ptr %.158.lcssa, i64 24
  store i32 2, ptr %50, align 8, !tbaa !14
  %51 = load ptr, ptr %26, align 8, !tbaa !11
  %52 = tail call i32 @list_ins_next(ptr noundef %2, ptr noundef %51, ptr noundef %.158.lcssa) #3
  %.not66 = icmp eq i32 %52, 0
  br i1 %.not66, label %27, label %53

53:                                               ; preds = %._crit_edge91
  tail call void @list_destroy(ptr noundef nonnull %2) #3
  br label %58

._crit_edge97:                                    ; preds = %27, %.preheader70
  %54 = getelementptr inbounds i8, ptr %2, i64 32
  %55 = load ptr, ptr %54, align 8, !tbaa !11
  %56 = tail call i32 @list_ins_next(ptr noundef %2, ptr noundef %55, ptr noundef %.161108119) #3
  %.not64 = icmp eq i32 %56, 0
  br i1 %.not64, label %58, label %57

57:                                               ; preds = %._crit_edge97
  tail call void @list_destroy(ptr noundef nonnull %2) #3
  br label %58

58:                                               ; preds = %._crit_edge97, %57, %53, %._crit_edge.thread, %15
  %.052 = phi i32 [ -1, %15 ], [ -1, %53 ], [ -1, %57 ], [ -1, %._crit_edge.thread ], [ 0, %._crit_edge97 ]
  ret i32 %.052
}

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 nosync nounwind speculatable willreturn memory(none)
declare double @llvm.sqrt.f64(double) #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 nosync nounwind speculatable willreturn memory(none) }
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 32}
!12 = !{!"List_", !13, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !13, i64 24}
!15 = !{!"TspVertex_", !6, i64 0, !16, i64 8, !16, i64 16, !13, i64 24}
!16 = !{!"double", !7, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!16, !16, i64 0}
!20 = !{!12, !13, i64 0}
!21 = distinct !{!21, !18}
!22 = distinct !{!22, !18}


; Effective O3 passes: AggressiveInstCombinePass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass,VectorCombinePass