; LLVM IR from fcimeson/cbTSP :: cbLKH/SRC (PatchCycles)

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

@PatchingC = external dso_local global i32, align 4
@NonsequentialMoveType = external dso_local global i32, align 4
@RecLevel = external hidden global i32, align 4
@Patchwork = external hidden global i32, align 4
@CurrentCycle = external hidden global i32, align 4
@cycle = external dso_local global ptr, align 8
@p = external dso_local global ptr, align 8
@t = external dso_local global ptr, align 8
@Reversed = external dso_local global i16, align 2
@Dimension = external dso_local global i32, align 4
@C = external dso_local global ptr, align 8

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

19:                                               ; preds = %2
  %20 = load i64, ptr %5, align 8, !tbaa !9
  %21 = icmp sgt i64 %20, 0
  br i1 %21, label %22, label %25

22:                                               ; preds = %19
  %23 = load i32, ptr %4, align 4, !tbaa !5
  call void @MakeKOptMove(i32 noundef %23)
  %24 = load i64, ptr %5, align 8, !tbaa !9
  store i64 %24, ptr %3, align 8
  store i32 1, ptr %13, align 4
  br label %176

25:                                               ; preds = %19, %2
  %26 = load i32, ptr %11, align 4, !tbaa !5
  %27 = icmp eq i32 %26, 1
  br i1 %27, label %38, label %28

28:                                               ; preds = %25
  %29 = load i32, ptr %11, align 4, !tbaa !5
  %30 = load i32, ptr @PatchingC, align 4, !tbaa !5
  %31 = icmp sgt i32 %29, %30
  br i1 %31, label %38, label %32

32:                                               ; preds = %28
  %33 = load i32, ptr %4, align 4, !tbaa !5
  %34 = load i32, ptr %11, align 4, !tbaa !5
  %35 = add nsw i32 %33, %34
  %36 = load i32, ptr @NonsequentialMoveType, align 4, !tbaa !5
  %37 = icmp sgt i32 %35, %36
  br i1 %37, label %38, label %39

38:                                               ; preds = %32, %28, %25
  store i64 0, ptr %3, align 8
  store i32 1, ptr %13, align 4
  br label %176

39:                                               ; preds = %32
  %40 = load i32, ptr @RecLevel, align 4, !tbaa !5
  %41 = icmp eq i32 %40, 0
  br i1 %41, label %42, label %43

42:                                               ; preds = %39
  store i32 0, ptr @Patchwork, align 4, !tbaa !5
  br label %43

43:                                               ; preds = %42, %39
  %44 = load i32, ptr %11, align 4, !tbaa !5
  %45 = load i32, ptr %4, align 4, !tbaa !5
  %46 = call i32 @ShortestCycle(i32 noundef %44, i32 noundef %45)
  store i32 %46, ptr @CurrentCycle, align 4, !tbaa !5
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %47

47:                                               ; preds = %172, %43
  %48 = load i32, ptr %12, align 4, !tbaa !5
  %49 = load i32, ptr %4, align 4, !tbaa !5
  %50 = icmp slt i32 %48, %49
  br i1 %50, label %51, label %175

51:                                               ; preds = %47
  %52 = load ptr, ptr @cycle, align 8, !tbaa !11
  %53 = load ptr, ptr @p, align 8, !tbaa !11
  %54 = load i32, ptr %12, align 4, !tbaa !5
  %55 = mul nsw i32 2, %54
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds i32, ptr %53, i64 %56
  %58 = load i32, ptr %57, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds i32, ptr %52, i64 %59
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = load i32, ptr @CurrentCycle, align 4, !tbaa !5
  %63 = icmp ne i32 %61, %62
  br i1 %63, label %64, label %65

64:                                               ; preds = %51
  br label %172

65:                                               ; preds = %51
  %66 = load ptr, ptr @t, align 8, !tbaa !11
  %67 = load ptr, ptr @p, align 8, !tbaa !11
  %68 = load i32, ptr %12, align 4, !tbaa !5
  %69 = mul nsw i32 2, %68
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds i32, ptr %67, i64 %70
  %72 = load i32, ptr %71, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds ptr, ptr %66, i64 %73
  %75 = load ptr, ptr %74, align 8, !tbaa !11
  store ptr %75, ptr %8, align 8, !tbaa !11
  %76 = load ptr, ptr @t, align 8, !tbaa !11
  %77 = load ptr, ptr @p, align 8, !tbaa !11
  %78 = load i32, ptr %12, align 4, !tbaa !5
  %79 = mul nsw i32 2, %78
  %80 = add nsw i32 %79, 1
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds i32, ptr %77, i64 %81
  %83 = load i32, ptr %82, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds ptr, ptr %76, i64 %84
  %86 = load ptr, ptr %85, align 8, !tbaa !11
  store ptr %86, ptr %9, align 8, !tbaa !11
  %87 = load ptr, ptr %8, align 8, !tbaa !11
  store ptr %87, ptr %6, align 8, !tbaa !11
  br label %88

88:                                               ; preds = %169, %65
  %89 = load ptr, ptr %6, align 8, !tbaa !11
  %90 = load ptr, ptr %9, align 8, !tbaa !11
  %91 = icmp ne ptr %89, %90
  br i1 %91, label %92, label %171

92:                                               ; preds = %88
  %93 = load i16, ptr @Reversed, align 2, !tbaa !13
  %94 = sext i16 %93 to i32
  %95 = load ptr, ptr %6, align 8, !tbaa !11
  %96 = getelementptr inbounds %struct.Node, ptr %95, i32 0, i32 45
  %97 = load ptr, ptr %96, align 8, !tbaa !15
  %98 = getelementptr inbounds %struct.Segment, ptr %97, i32 0, i32 0
  %99 = load i8, ptr %98, align 8, !tbaa !18
  %100 = sext i8 %99 to i32
  %101 = icmp eq i32 %94, %100
  br i1 %101, label %102, label %106

102:                                              ; preds = %92
  %103 = load ptr, ptr %6, align 8, !tbaa !11
  %104 = getelementptr inbounds %struct.Node, ptr %103, i32 0, i32 16
  %105 = load ptr, ptr %104, align 8, !tbaa !20
  br label %110

106:                                              ; preds = %92
  %107 = load ptr, ptr %6, align 8, !tbaa !11
  %108 = getelementptr inbounds %struct.Node, ptr %107, i32 0, i32 15
  %109 = load ptr, ptr %108, align 8, !tbaa !21
  br label %110

110:                                              ; preds = %106, %102
  %111 = phi ptr [ %105, %102 ], [ %109, %106 ]
  store ptr %111, ptr %7, align 8, !tbaa !11
  %112 = load ptr, ptr %6, align 8, !tbaa !11
  %113 = getelementptr inbounds %struct.Node, ptr %112, i32 0, i32 26
  %114 = load ptr, ptr %113, align 8, !tbaa !22
  %115 = load ptr, ptr %7, align 8, !tbaa !11
  %116 = icmp eq ptr %114, %115
  br i1 %116, label %128, label %117

117:                                              ; preds = %110
  %118 = load ptr, ptr %6, align 8, !tbaa !11
  %119 = getelementptr inbounds %struct.Node, ptr %118, i32 0, i32 27
  %120 = load ptr, ptr %119, align 8, !tbaa !23
  %121 = load ptr, ptr %7, align 8, !tbaa !11
  %122 = icmp eq ptr %120, %121
  br i1 %122, label %128, label %123

123:                                              ; preds = %117
  %124 = load ptr, ptr %6, align 8, !tbaa !11
  %125 = load ptr, ptr %7, align 8, !tbaa !11
  %126 = call i32 @IsCommonEdge(ptr noundef %124, ptr noundef %125)
  %127 = icmp ne i32 %126, 0
  br i1 %127, label %128, label %129

128:                                              ; preds = %123, %117, %110
  br label %169

129:                                              ; preds = %123
  %130 = load i32, ptr @Patchwork, align 4, !tbaa !5
  %131 = add nsw i32 %130, 1
  store i32 %131, ptr @Patchwork, align 4, !tbaa !5
  %132 = load i32, ptr @Dimension, align 4, !tbaa !5
  %133 = icmp sgt i32 %131, %132
  br i1 %133, label %134, label %135

134:                                              ; preds = %129
  store i64 0, ptr %3, align 8
  store i32 1, ptr %13, align 4
  br label %176

135:                                              ; preds = %129
  %136 = load ptr, ptr %6, align 8, !tbaa !11
  %137 = load ptr, ptr @t, align 8, !tbaa !11
  %138 = load i32, ptr %4, align 4, !tbaa !5
  %139 = mul nsw i32 2, %138
  %140 = add nsw i32 %139, 1
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds ptr, ptr %137, i64 %141
  store ptr %136, ptr %142, align 8, !tbaa !11
  %143 = load ptr, ptr %7, align 8, !tbaa !11
  %144 = load ptr, ptr @t, align 8, !tbaa !11
  %145 = load i32, ptr %4, align 4, !tbaa !5
  %146 = mul nsw i32 2, %145
  %147 = add nsw i32 %146, 2
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds ptr, ptr %144, i64 %148
  store ptr %143, ptr %149, align 8, !tbaa !11
  %150 = load ptr, ptr %6, align 8, !tbaa !11
  %151 = load ptr, ptr %7, align 8, !tbaa !11
  call void @MarkDeleted(ptr noundef %150, ptr noundef %151)
  %152 = load i32, ptr %4, align 4, !tbaa !5
  %153 = load i32, ptr %11, align 4, !tbaa !5
  %154 = load i64, ptr %5, align 8, !tbaa !9
  %155 = load ptr, ptr @C, align 8, !tbaa !11
  %156 = load ptr, ptr %6, align 8, !tbaa !11
  %157 = load ptr, ptr %7, align 8, !tbaa !11
  %158 = call i32 %155(ptr noundef %156, ptr noundef %157)
  %159 = sext i32 %158 to i64
  %160 = add nsw i64 %154, %159
  %161 = call i64 @PatchCyclesRec(i32 noundef %152, i32 noundef 2, i32 noundef %153, i64 noundef %160)
  store i64 %161, ptr %10, align 8, !tbaa !9
  %162 = load ptr, ptr %6, align 8, !tbaa !11
  %163 = load ptr, ptr %7, align 8, !tbaa !11
  call void @UnmarkDeleted(ptr noundef %162, ptr noundef %163)
  %164 = load i64, ptr %10, align 8, !tbaa !9
  %165 = icmp sgt i64 %164, 0
  br i1 %165, label %166, label %168

166:                                              ; preds = %135
  %167 = load i64, ptr %10, align 8, !tbaa !9
  store i64 %167, ptr %3, align 8
  store i32 1, ptr %13, align 4
  br label %176

168:                                              ; preds = %135
  br label %169

169:                                              ; preds = %168, %128
  %170 = load ptr, ptr %7, align 8, !tbaa !11
  store ptr %170, ptr %6, align 8, !tbaa !11
  br label %88, !llvm.loop !24

171:                                              ; preds = %88
  br label %172

172:                                              ; preds = %171, %64
  %173 = load i32, ptr %12, align 4, !tbaa !5
  %174 = add nsw i32 %173, 1
  store i32 %174, ptr %12, align 4, !tbaa !5
  br label %47, !llvm.loop !26

175:                                              ; preds = %47
  store i64 0, ptr %3, align 8
  store i32 1, ptr %13, align 4
  br label %176

176:                                              ; preds = %175, %166, %134, %38, %22
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %177 = load i64, ptr %3, align 8
  ret i64 %177
}

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

declare void @FindPermutation(i32 noundef) #2

declare i32 @Cycles(i32 noundef) #2

declare void @MakeKOptMove(i32 noundef) #2

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

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

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

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

declare void @UnmarkDeleted(ptr noundef, 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"short", !7, i64 0}
!15 = !{!16, !12, i64 304}
!16 = !{!"Node", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20, !6, i64 24, !6, i64 28, !6, i64 32, !6, i64 36, !6, i64 40, !6, i64 44, !6, i64 48, !6, i64 52, !12, i64 56, !12, i64 64, !12, i64 72, !12, i64 80, !12, i64 88, !12, i64 96, !12, i64 104, !12, i64 112, !12, i64 120, !12, i64 128, !12, i64 136, !12, i64 144, !12, i64 152, !12, i64 160, !12, i64 168, !12, i64 176, !12, i64 184, !12, i64 192, !12, i64 200, !12, i64 208, !12, i64 216, !12, i64 224, !12, i64 232, !12, i64 240, !12, i64 248, !12, i64 256, !12, i64 264, !12, i64 272, !12, i64 280, !12, i64 288, !12, i64 296, !12, i64 304, !17, i64 312, !17, i64 320, !17, i64 328, !17, i64 336, !17, i64 344, !17, i64 352, !7, i64 360, !7, i64 361, !7, i64 362}
!17 = !{!"double", !7, i64 0}
!18 = !{!19, !7, i64 0}
!19 = !{!"Segment", !7, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !6, i64 40, !6, i64 44, !12, i64 48}
!20 = !{!16, !12, i64 72}
!21 = !{!16, !12, i64 64}
!22 = !{!16, !12, i64 152}
!23 = !{!16, !12, i64 160}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = distinct !{!26, !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"

@PatchingC = external dso_local local_unnamed_addr global i32, align 4
@NonsequentialMoveType = external dso_local local_unnamed_addr global i32, align 4
@RecLevel = external hidden local_unnamed_addr global i32, align 4
@Patchwork = external hidden local_unnamed_addr global i32, align 4
@CurrentCycle = external hidden local_unnamed_addr global i32, align 4
@cycle = external dso_local local_unnamed_addr global ptr, align 8
@p = external dso_local local_unnamed_addr global ptr, align 8
@t = external dso_local local_unnamed_addr global ptr, align 8
@Reversed = external dso_local local_unnamed_addr global i16, align 2
@Dimension = external dso_local local_unnamed_addr global i32, align 4
@C = external dso_local local_unnamed_addr global ptr, align 8

; Function Attrs: nounwind uwtable
define dso_local range(i64 0, -9223372036854775808) i64 @PatchCycles(i32 noundef %0, i64 noundef %1) local_unnamed_addr #0 {
  tail call void @FindPermutation(i32 noundef %0) #2
  %3 = tail call i32 @Cycles(i32 noundef %0) #2
  %4 = icmp eq i32 %3, 1
  %5 = icmp sgt i64 %1, 0
  %or.cond = and i1 %5, %4
  br i1 %or.cond, label %6, label %7

6:                                                ; preds = %2
  tail call void @MakeKOptMove(i32 noundef %0) #2
  br label %.loopexit59

7:                                                ; preds = %2
  %8 = load i32, ptr @PatchingC, align 4
  %9 = icmp sgt i32 %3, %8
  %or.cond58 = select i1 %4, i1 true, i1 %9
  br i1 %or.cond58, label %.loopexit59, label %10

10:                                               ; preds = %7
  %11 = add nsw i32 %3, %0
  %12 = load i32, ptr @NonsequentialMoveType, align 4, !tbaa !5
  %13 = icmp sgt i32 %11, %12
  br i1 %13, label %.loopexit59, label %14

14:                                               ; preds = %10
  %15 = load i32, ptr @RecLevel, align 4, !tbaa !5
  %16 = icmp eq i32 %15, 0
  br i1 %16, label %17, label %18

17:                                               ; preds = %14
  store i32 0, ptr @Patchwork, align 4, !tbaa !5
  br label %18

18:                                               ; preds = %17, %14
  %19 = tail call i32 @ShortestCycle(i32 noundef %3, i32 noundef %0)
  store i32 %19, ptr @CurrentCycle, align 4, !tbaa !5
  %20 = icmp sgt i32 %0, 0
  br i1 %20, label %.lr.ph64, label %.loopexit59

.lr.ph64:                                         ; preds = %18
  %21 = shl nuw nsw i32 %0, 1
  %22 = or disjoint i32 %21, 1
  %23 = zext nneg i32 %22 to i64
  %24 = zext nneg i32 %21 to i64
  %wide.trip.count = zext nneg i32 %0 to i64
  br label %25

25:                                               ; preds = %.lr.ph64, %.loopexit
  %indvars.iv = phi i64 [ 0, %.lr.ph64 ], [ %indvars.iv.next, %.loopexit ]
  %26 = load ptr, ptr @cycle, align 8, !tbaa !9
  %27 = load ptr, ptr @p, align 8, !tbaa !9
  %28 = shl nuw nsw i64 %indvars.iv, 1
  %29 = getelementptr inbounds i32, ptr %27, i64 %28
  %30 = load i32, ptr %29, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds i32, ptr %26, i64 %31
  %33 = load i32, ptr %32, align 4, !tbaa !5
  %34 = load i32, ptr @CurrentCycle, align 4, !tbaa !5
  %.not = icmp eq i32 %33, %34
  br i1 %.not, label %35, label %.loopexit

35:                                               ; preds = %25
  %36 = load ptr, ptr @t, align 8, !tbaa !9
  %37 = getelementptr inbounds ptr, ptr %36, i64 %31
  %38 = load ptr, ptr %37, align 8, !tbaa !9
  %39 = or disjoint i64 %28, 1
  %40 = getelementptr inbounds i32, ptr %27, i64 %39
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds ptr, ptr %36, i64 %42
  %44 = load ptr, ptr %43, align 8, !tbaa !9
  %.not5461 = icmp eq ptr %38, %44
  br i1 %.not5461, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %35, %77
  %.04862 = phi ptr [ %51, %77 ], [ %38, %35 ]
  %45 = load i16, ptr @Reversed, align 2, !tbaa !11
  %46 = getelementptr inbounds i8, ptr %.04862, i64 304
  %47 = load ptr, ptr %46, align 8, !tbaa !13
  %48 = load i8, ptr %47, align 8, !tbaa !16
  %49 = sext i8 %48 to i16
  %50 = icmp eq i16 %45, %49
  %.in.v = select i1 %50, i64 72, i64 64
  %.in = getelementptr inbounds i8, ptr %.04862, i64 %.in.v
  %51 = load ptr, ptr %.in, align 8, !tbaa !9
  %52 = getelementptr inbounds i8, ptr %.04862, i64 152
  %53 = load ptr, ptr %52, align 8, !tbaa !18
  %54 = icmp eq ptr %53, %51
  br i1 %54, label %77, label %55

55:                                               ; preds = %.lr.ph
  %56 = getelementptr inbounds i8, ptr %.04862, i64 160
  %57 = load ptr, ptr %56, align 8, !tbaa !19
  %58 = icmp eq ptr %57, %51
  br i1 %58, label %77, label %59

59:                                               ; preds = %55
  %60 = tail call i32 @IsCommonEdge(ptr noundef nonnull %.04862, ptr noundef %51) #2
  %.not55 = icmp eq i32 %60, 0
  br i1 %.not55, label %61, label %77

61:                                               ; preds = %59
  %62 = load i32, ptr @Patchwork, align 4, !tbaa !5
  %63 = add nsw i32 %62, 1
  store i32 %63, ptr @Patchwork, align 4, !tbaa !5
  %64 = load i32, ptr @Dimension, align 4, !tbaa !5
  %.not56 = icmp slt i32 %62, %64
  br i1 %.not56, label %65, label %.loopexit59

65:                                               ; preds = %61
  %66 = load ptr, ptr @t, align 8, !tbaa !9
  %67 = getelementptr inbounds ptr, ptr %66, i64 %23
  store ptr %.04862, ptr %67, align 8, !tbaa !9
  %68 = load ptr, ptr @t, align 8, !tbaa !9
  %69 = getelementptr ptr, ptr %68, i64 %24
  %70 = getelementptr i8, ptr %69, i64 16
  store ptr %51, ptr %70, align 8, !tbaa !9
  tail call void @MarkDeleted(ptr noundef nonnull %.04862, ptr noundef %51) #2
  %71 = load ptr, ptr @C, align 8, !tbaa !9
  %72 = tail call i32 %71(ptr noundef nonnull %.04862, ptr noundef %51) #2
  %73 = sext i32 %72 to i64
  %74 = add nsw i64 %73, %1
  %75 = tail call i64 @PatchCyclesRec(i32 noundef %0, i32 noundef 2, i32 noundef %3, i64 noundef %74)
  tail call void @UnmarkDeleted(ptr noundef nonnull %.04862, ptr noundef %51) #2
  %76 = icmp sgt i64 %75, 0
  br i1 %76, label %.loopexit59, label %77

77:                                               ; preds = %65, %.lr.ph, %55, %59
  %.not54 = icmp eq ptr %51, %44
  br i1 %.not54, label %.loopexit, label %.lr.ph, !llvm.loop !20

.loopexit:                                        ; preds = %77, %35, %25
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.loopexit59, label %25, !llvm.loop !22

.loopexit59:                                      ; preds = %.loopexit, %65, %61, %18, %7, %10, %6
  %.047 = phi i64 [ %1, %6 ], [ 0, %10 ], [ 0, %7 ], [ 0, %18 ], [ %75, %65 ], [ 0, %61 ], [ 0, %.loopexit ]
  ret i64 %.047
}

declare void @FindPermutation(i32 noundef) local_unnamed_addr #1

declare i32 @Cycles(i32 noundef) local_unnamed_addr #1

declare void @MakeKOptMove(i32 noundef) local_unnamed_addr #1

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

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

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

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

declare void @UnmarkDeleted(ptr noundef, ptr noundef) local_unnamed_addr #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 = { "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 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = !{!14, !10, i64 304}
!14 = !{!"Node", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20, !6, i64 24, !6, i64 28, !6, i64 32, !6, i64 36, !6, i64 40, !6, i64 44, !6, i64 48, !6, i64 52, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !10, i64 120, !10, i64 128, !10, i64 136, !10, i64 144, !10, i64 152, !10, i64 160, !10, i64 168, !10, i64 176, !10, i64 184, !10, i64 192, !10, i64 200, !10, i64 208, !10, i64 216, !10, i64 224, !10, i64 232, !10, i64 240, !10, i64 248, !10, i64 256, !10, i64 264, !10, i64 272, !10, i64 280, !10, i64 288, !10, i64 296, !10, i64 304, !15, i64 312, !15, i64 320, !15, i64 328, !15, i64 336, !15, i64 344, !15, i64 352, !7, i64 360, !7, i64 361, !7, i64 362}
!15 = !{!"double", !7, i64 0}
!16 = !{!17, !7, i64 0}
!17 = !{!"Segment", !7, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !6, i64 40, !6, i64 44, !10, i64 48}
!18 = !{!14, !10, i64 152}
!19 = !{!14, !10, i64 160}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = distinct !{!22, !21}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass