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

; 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.Candidate = type { ptr, i32, i32 }
%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 }

@TraceLevel = external dso_local global i32, align 4
@KDTree = external hidden global ptr, align 8
@DimensionSaved = external dso_local global i32, align 4
@XMin = external hidden global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [64 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [87 x i8], align 1
@XMax = external hidden global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [64 x i8], align 1
@YMin = external hidden global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [64 x i8], align 1
@YMax = external hidden global ptr, align 8
@.str.5 = external hidden unnamed_addr constant [64 x i8], align 1
@CoordType = external dso_local global i32, align 4
@ZMin = external hidden global ptr, align 8
@.str.6 = external hidden unnamed_addr constant [64 x i8], align 1
@ZMax = external hidden global ptr, align 8
@.str.7 = external hidden unnamed_addr constant [64 x i8], align 1
@Dimension = external dso_local global i32, align 4
@Contains = external hidden global ptr, align 8
@BoxOverlaps = external hidden global ptr, align 8
@CandidateSet = external hidden global ptr, align 8
@.str.8 = external hidden unnamed_addr constant [65 x i8], align 1
@FirstNode = external dso_local global ptr, align 8
@Candidates = external hidden global i32, align 4
@D = external dso_local global ptr, align 8
@Level = external hidden global i32, align 4
@WeightType = external dso_local global i32, align 4
@.str.9 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [6 x i8], align 1
@CandidateSetSymmetric = external dso_local global i32, align 4
@.str.11 = external hidden unnamed_addr constant [45 x i8], align 1
@__PRETTY_FUNCTION__.CreateNearestNeighborCandidateSet = external hidden unnamed_addr constant [44 x i8], align 1

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

declare void @printff(ptr noundef, ...) #1

declare ptr @BuildKDTree(i32 noundef) #1

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #2

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #3

; Function Attrs: nounwind uwtable
declare hidden void @ComputeBounds(i32 noundef, i32 noundef) #4

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

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

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

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

; Function Attrs: nounwind uwtable
declare hidden void @NearestQuadrantNeighbors(ptr noundef, i32 noundef, i32 noundef) #4

declare i32 @AddCandidate(ptr noundef, ptr noundef, i32 noundef, i32 noundef) #1

; Function Attrs: nounwind
declare void @free(ptr noundef) #5

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

declare void @ResetCandidateSet() #1

declare void @AddTourCandidates() #1

declare void @SymmetrizeCandidateSet() #1

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

11:                                               ; preds = %1
  call void (ptr, ...) @printff(ptr noundef @.str.11)
  br label %12

12:                                               ; preds = %11, %1
  %13 = call ptr @BuildKDTree(i32 noundef 1)
  store ptr %13, ptr @KDTree, align 8, !tbaa !9
  %14 = load i32, ptr @DimensionSaved, align 4, !tbaa !5
  %15 = add nsw i32 1, %14
  %16 = sext i32 %15 to i64
  %17 = mul i64 %16, 8
  %18 = call noalias ptr @malloc(i64 noundef %17) #7
  store ptr %18, ptr @XMin, align 8, !tbaa !9
  %19 = icmp ne ptr %18, null
  br i1 %19, label %20, label %21

20:                                               ; preds = %12
  br label %22

21:                                               ; preds = %12
  call void @__assert_fail(ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 181, ptr noundef @__PRETTY_FUNCTION__.CreateNearestNeighborCandidateSet) #8
  unreachable

22:                                               ; preds = %20
  %23 = load i32, ptr @DimensionSaved, align 4, !tbaa !5
  %24 = add nsw i32 1, %23
  %25 = sext i32 %24 to i64
  %26 = mul i64 %25, 8
  %27 = call noalias ptr @malloc(i64 noundef %26) #7
  store ptr %27, ptr @XMax, align 8, !tbaa !9
  %28 = icmp ne ptr %27, null
  br i1 %28, label %29, label %30

29:                                               ; preds = %22
  br label %31

30:                                               ; preds = %22
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.2, i32 noundef 183, ptr noundef @__PRETTY_FUNCTION__.CreateNearestNeighborCandidateSet) #8
  unreachable

31:                                               ; preds = %29
  %32 = load i32, ptr @DimensionSaved, align 4, !tbaa !5
  %33 = add nsw i32 1, %32
  %34 = sext i32 %33 to i64
  %35 = mul i64 %34, 8
  %36 = call noalias ptr @malloc(i64 noundef %35) #7
  store ptr %36, ptr @YMin, align 8, !tbaa !9
  %37 = icmp ne ptr %36, null
  br i1 %37, label %38, label %39

38:                                               ; preds = %31
  br label %40

39:                                               ; preds = %31
  call void @__assert_fail(ptr noundef @.str.4, ptr noundef @.str.2, i32 noundef 185, ptr noundef @__PRETTY_FUNCTION__.CreateNearestNeighborCandidateSet) #8
  unreachable

40:                                               ; preds = %38
  %41 = load i32, ptr @DimensionSaved, align 4, !tbaa !5
  %42 = add nsw i32 1, %41
  %43 = sext i32 %42 to i64
  %44 = mul i64 %43, 8
  %45 = call noalias ptr @malloc(i64 noundef %44) #7
  store ptr %45, ptr @YMax, align 8, !tbaa !9
  %46 = icmp ne ptr %45, null
  br i1 %46, label %47, label %48

47:                                               ; preds = %40
  br label %49

48:                                               ; preds = %40
  call void @__assert_fail(ptr noundef @.str.5, ptr noundef @.str.2, i32 noundef 187, ptr noundef @__PRETTY_FUNCTION__.CreateNearestNeighborCandidateSet) #8
  unreachable

49:                                               ; preds = %47
  %50 = load i32, ptr @CoordType, align 4, !tbaa !5
  %51 = icmp eq i32 %50, 1
  br i1 %51, label %52, label %71

52:                                               ; preds = %49
  %53 = load i32, ptr @DimensionSaved, align 4, !tbaa !5
  %54 = add nsw i32 1, %53
  %55 = sext i32 %54 to i64
  %56 = mul i64 %55, 8
  %57 = call noalias ptr @malloc(i64 noundef %56) #7
  store ptr %57, ptr @ZMin, align 8, !tbaa !9
  %58 = icmp ne ptr %57, null
  br i1 %58, label %59, label %60

59:                                               ; preds = %52
  br label %61

60:                                               ; preds = %52
  call void @__assert_fail(ptr noundef @.str.6, ptr noundef @.str.2, i32 noundef 190, ptr noundef @__PRETTY_FUNCTION__.CreateNearestNeighborCandidateSet) #8
  unreachable

61:                                               ; preds = %59
  %62 = load i32, ptr @DimensionSaved, align 4, !tbaa !5
  %63 = add nsw i32 1, %62
  %64 = sext i32 %63 to i64
  %65 = mul i64 %64, 8
  %66 = call noalias ptr @malloc(i64 noundef %65) #7
  store ptr %66, ptr @ZMax, align 8, !tbaa !9
  %67 = icmp ne ptr %66, null
  br i1 %67, label %68, label %69

68:                                               ; preds = %61
  br label %70

69:                                               ; preds = %61
  call void @__assert_fail(ptr noundef @.str.7, ptr noundef @.str.2, i32 noundef 192, ptr noundef @__PRETTY_FUNCTION__.CreateNearestNeighborCandidateSet) #8
  unreachable

70:                                               ; preds = %68
  br label %71

71:                                               ; preds = %70, %49
  %72 = load i32, ptr @Dimension, align 4, !tbaa !5
  %73 = sub nsw i32 %72, 1
  call void @ComputeBounds(i32 noundef 0, i32 noundef %73)
  %74 = load i32, ptr @CoordType, align 4, !tbaa !5
  %75 = icmp eq i32 %74, 1
  %76 = zext i1 %75 to i64
  %77 = select i1 %75, ptr @Contains3D, ptr @Contains2D
  store ptr %77, ptr @Contains, align 8, !tbaa !9
  %78 = load i32, ptr @CoordType, align 4, !tbaa !5
  %79 = icmp eq i32 %78, 1
  %80 = zext i1 %79 to i64
  %81 = select i1 %79, ptr @BoxOverlaps3D, ptr @BoxOverlaps2D
  store ptr %81, ptr @BoxOverlaps, align 8, !tbaa !9
  %82 = load i32, ptr %2, align 4, !tbaa !5
  %83 = add nsw i32 %82, 1
  %84 = sext i32 %83 to i64
  %85 = mul i64 %84, 16
  %86 = call noalias ptr @malloc(i64 noundef %85) #7
  store ptr %86, ptr @CandidateSet, align 8, !tbaa !9
  %87 = icmp ne ptr %86, null
  br i1 %87, label %88, label %89

88:                                               ; preds = %71
  br label %90

89:                                               ; preds = %71
  call void @__assert_fail(ptr noundef @.str.8, ptr noundef @.str.2, i32 noundef 199, ptr noundef @__PRETTY_FUNCTION__.CreateNearestNeighborCandidateSet) #8
  unreachable

90:                                               ; preds = %88
  %91 = load ptr, ptr @FirstNode, align 8, !tbaa !9
  store ptr %91, ptr %3, align 8, !tbaa !9
  br label %92

92:                                               ; preds = %117, %90
  %93 = load ptr, ptr %3, align 8, !tbaa !9
  %94 = load i32, ptr %2, align 4, !tbaa !5
  call void @NearestQuadrantNeighbors(ptr noundef %93, i32 noundef 0, i32 noundef %94)
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %95

95:                                               ; preds = %113, %92
  %96 = load i32, ptr %5, align 4, !tbaa !5
  %97 = load i32, ptr @Candidates, align 4, !tbaa !5
  %98 = icmp slt i32 %96, %97
  br i1 %98, label %99, label %116

99:                                               ; preds = %95
  %100 = load ptr, ptr @CandidateSet, align 8, !tbaa !9
  %101 = load i32, ptr %5, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds %struct.Candidate, ptr %100, i64 %102
  %104 = getelementptr inbounds %struct.Candidate, ptr %103, i32 0, i32 0
  %105 = load ptr, ptr %104, align 8, !tbaa !11
  store ptr %105, ptr %4, align 8, !tbaa !9
  %106 = load ptr, ptr %3, align 8, !tbaa !9
  %107 = load ptr, ptr %4, align 8, !tbaa !9
  %108 = load ptr, ptr @D, align 8, !tbaa !9
  %109 = load ptr, ptr %3, align 8, !tbaa !9
  %110 = load ptr, ptr %4, align 8, !tbaa !9
  %111 = call i32 %108(ptr noundef %109, ptr noundef %110)
  %112 = call i32 @AddCandidate(ptr noundef %106, ptr noundef %107, i32 noundef %111, i32 noundef 1)
  br label %113

113:                                              ; preds = %99
  %114 = load i32, ptr %5, align 4, !tbaa !5
  %115 = add nsw i32 %114, 1
  store i32 %115, ptr %5, align 4, !tbaa !5
  br label %95, !llvm.loop !13

116:                                              ; preds = %95
  br label %117

117:                                              ; preds = %116
  %118 = load ptr, ptr %3, align 8, !tbaa !9
  %119 = getelementptr inbounds %struct.Node, ptr %118, i32 0, i32 16
  %120 = load ptr, ptr %119, align 8, !tbaa !15
  store ptr %120, ptr %3, align 8, !tbaa !9
  %121 = load ptr, ptr @FirstNode, align 8, !tbaa !9
  %122 = icmp ne ptr %120, %121
  br i1 %122, label %92, label %123, !llvm.loop !18

123:                                              ; preds = %117
  %124 = load ptr, ptr @CandidateSet, align 8, !tbaa !9
  call void @free(ptr noundef %124) #6
  %125 = load ptr, ptr @KDTree, align 8, !tbaa !9
  call void @free(ptr noundef %125) #6
  %126 = load ptr, ptr @XMin, align 8, !tbaa !9
  call void @free(ptr noundef %126) #6
  %127 = load ptr, ptr @XMax, align 8, !tbaa !9
  call void @free(ptr noundef %127) #6
  %128 = load ptr, ptr @YMin, align 8, !tbaa !9
  call void @free(ptr noundef %128) #6
  %129 = load ptr, ptr @YMax, align 8, !tbaa !9
  call void @free(ptr noundef %129) #6
  %130 = load i32, ptr @CoordType, align 4, !tbaa !5
  %131 = icmp eq i32 %130, 1
  br i1 %131, label %132, label %135

132:                                              ; preds = %123
  %133 = load ptr, ptr @ZMin, align 8, !tbaa !9
  call void @free(ptr noundef %133) #6
  %134 = load ptr, ptr @ZMax, align 8, !tbaa !9
  call void @free(ptr noundef %134) #6
  br label %135

135:                                              ; preds = %132, %123
  %136 = load i32, ptr @Level, align 4, !tbaa !5
  %137 = icmp eq i32 %136, 0
  br i1 %137, label %138, label %255

138:                                              ; preds = %135
  %139 = load i32, ptr @WeightType, align 4, !tbaa !5
  %140 = icmp eq i32 %139, 10
  br i1 %140, label %144, label %141

141:                                              ; preds = %138
  %142 = load i32, ptr @WeightType, align 4, !tbaa !5
  %143 = icmp eq i32 %142, 12
  br i1 %143, label %144, label %255

144:                                              ; preds = %141, %138
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %145 = load i32, ptr @DimensionSaved, align 4, !tbaa !5
  %146 = add nsw i32 1, %145
  %147 = sext i32 %146 to i64
  %148 = mul i64 %147, 8
  %149 = call noalias ptr @malloc(i64 noundef %148) #7
  store ptr %149, ptr %6, align 8, !tbaa !9
  %150 = icmp ne ptr %149, null
  br i1 %150, label %151, label %152

151:                                              ; preds = %144
  br label %153

152:                                              ; preds = %144
  call void @__assert_fail(ptr noundef @.str.9, ptr noundef @.str.2, i32 noundef 224, ptr noundef @__PRETTY_FUNCTION__.CreateNearestNeighborCandidateSet) #8
  unreachable

153:                                              ; preds = %151
  %154 = load i32, ptr @TraceLevel, align 4, !tbaa !5
  %155 = icmp sge i32 %154, 2
  br i1 %155, label %156, label %157

156:                                              ; preds = %153
  call void (ptr, ...) @printff(ptr noundef @.str.10)
  br label %157

157:                                              ; preds = %156, %153
  %158 = load ptr, ptr @FirstNode, align 8, !tbaa !9
  store ptr %158, ptr %3, align 8, !tbaa !9
  br label %159

159:                                              ; preds = %187, %157
  %160 = load ptr, ptr %3, align 8, !tbaa !9
  %161 = getelementptr inbounds %struct.Node, ptr %160, i32 0, i32 43
  %162 = load ptr, ptr %161, align 8, !tbaa !19
  %163 = load ptr, ptr %6, align 8, !tbaa !9
  %164 = load ptr, ptr %3, align 8, !tbaa !9
  %165 = getelementptr inbounds %struct.Node, ptr %164, i32 0, i32 0
  %166 = load i32, ptr %165, align 8, !tbaa !20
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds ptr, ptr %163, i64 %167
  store ptr %162, ptr %168, align 8, !tbaa !9
  %169 = load ptr, ptr %3, align 8, !tbaa !9
  %170 = getelementptr inbounds %struct.Node, ptr %169, i32 0, i32 43
  store ptr null, ptr %170, align 8, !tbaa !19
  %171 = load ptr, ptr %3, align 8, !tbaa !9
  %172 = getelementptr inbounds %struct.Node, ptr %171, i32 0, i32 47
  %173 = load double, ptr %172, align 8, !tbaa !21
  %174 = load ptr, ptr %3, align 8, !tbaa !9
  %175 = getelementptr inbounds %struct.Node, ptr %174, i32 0, i32 50
  store double %173, ptr %175, align 8, !tbaa !22
  %176 = load ptr, ptr %3, align 8, !tbaa !9
  %177 = getelementptr inbounds %struct.Node, ptr %176, i32 0, i32 47
  %178 = load double, ptr %177, align 8, !tbaa !21
  %179 = fcmp ogt double %178, 0.000000e+00
  %180 = zext i1 %179 to i64
  %181 = select i1 %179, i32 -180, i32 180
  %182 = sitofp i32 %181 to double
  %183 = load ptr, ptr %3, align 8, !tbaa !9
  %184 = getelementptr inbounds %struct.Node, ptr %183, i32 0, i32 47
  %185 = load double, ptr %184, align 8, !tbaa !21
  %186 = fadd double %185, %182
  store double %186, ptr %184, align 8, !tbaa !21
  br label %187

187:                                              ; preds = %159
  %188 = load ptr, ptr %3, align 8, !tbaa !9
  %189 = getelementptr inbounds %struct.Node, ptr %188, i32 0, i32 16
  %190 = load ptr, ptr %189, align 8, !tbaa !15
  store ptr %190, ptr %3, align 8, !tbaa !9
  %191 = load ptr, ptr @FirstNode, align 8, !tbaa !9
  %192 = icmp ne ptr %190, %191
  br i1 %192, label %159, label %193, !llvm.loop !23

193:                                              ; preds = %187
  %194 = load i32, ptr @Level, align 4, !tbaa !5
  %195 = add nsw i32 %194, 1
  store i32 %195, ptr @Level, align 4, !tbaa !5
  %196 = load i32, ptr %2, align 4, !tbaa !5
  call void @CreateNearestNeighborCandidateSet(i32 noundef %196)
  %197 = load i32, ptr @Level, align 4, !tbaa !5
  %198 = add nsw i32 %197, -1
  store i32 %198, ptr @Level, align 4, !tbaa !5
  %199 = load ptr, ptr @FirstNode, align 8, !tbaa !9
  store ptr %199, ptr %3, align 8, !tbaa !9
  br label %200

200:                                              ; preds = %206, %193
  %201 = load ptr, ptr %3, align 8, !tbaa !9
  %202 = getelementptr inbounds %struct.Node, ptr %201, i32 0, i32 50
  %203 = load double, ptr %202, align 8, !tbaa !22
  %204 = load ptr, ptr %3, align 8, !tbaa !9
  %205 = getelementptr inbounds %struct.Node, ptr %204, i32 0, i32 47
  store double %203, ptr %205, align 8, !tbaa !21
  br label %206

206:                                              ; preds = %200
  %207 = load ptr, ptr %3, align 8, !tbaa !9
  %208 = getelementptr inbounds %struct.Node, ptr %207, i32 0, i32 16
  %209 = load ptr, ptr %208, align 8, !tbaa !15
  store ptr %209, ptr %3, align 8, !tbaa !9
  %210 = load ptr, ptr @FirstNode, align 8, !tbaa !9
  %211 = icmp ne ptr %209, %210
  br i1 %211, label %200, label %212, !llvm.loop !24

212:                                              ; preds = %206
  br label %213

213:                                              ; preds = %247, %212
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %214 = load ptr, ptr %3, align 8, !tbaa !9
  %215 = getelementptr inbounds %struct.Node, ptr %214, i32 0, i32 43
  %216 = load ptr, ptr %215, align 8, !tbaa !19
  store ptr %216, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %217 = load ptr, ptr %6, align 8, !tbaa !9
  %218 = load ptr, ptr %3, align 8, !tbaa !9
  %219 = getelementptr inbounds %struct.Node, ptr %218, i32 0, i32 0
  %220 = load i32, ptr %219, align 8, !tbaa !20
  %221 = sext i32 %220 to i64
  %222 = getelementptr inbounds ptr, ptr %217, i64 %221
  %223 = load ptr, ptr %222, align 8, !tbaa !9
  %224 = load ptr, ptr %3, align 8, !tbaa !9
  %225 = getelementptr inbounds %struct.Node, ptr %224, i32 0, i32 43
  store ptr %223, ptr %225, align 8, !tbaa !19
  %226 = load ptr, ptr %7, align 8, !tbaa !9
  store ptr %226, ptr %8, align 8, !tbaa !9
  br label %227

227:                                              ; preds = %242, %213
  %228 = load ptr, ptr %8, align 8, !tbaa !9
  %229 = getelementptr inbounds %struct.Candidate, ptr %228, i32 0, i32 0
  %230 = load ptr, ptr %229, align 8, !tbaa !11
  store ptr %230, ptr %4, align 8, !tbaa !9
  %231 = icmp ne ptr %230, null
  br i1 %231, label %232, label %245

232:                                              ; preds = %227
  %233 = load ptr, ptr %3, align 8, !tbaa !9
  %234 = load ptr, ptr %4, align 8, !tbaa !9
  %235 = load ptr, ptr %8, align 8, !tbaa !9
  %236 = getelementptr inbounds %struct.Candidate, ptr %235, i32 0, i32 1
  %237 = load i32, ptr %236, align 8, !tbaa !25
  %238 = load ptr, ptr %8, align 8, !tbaa !9
  %239 = getelementptr inbounds %struct.Candidate, ptr %238, i32 0, i32 2
  %240 = load i32, ptr %239, align 4, !tbaa !26
  %241 = call i32 @AddCandidate(ptr noundef %233, ptr noundef %234, i32 noundef %237, i32 noundef %240)
  br label %242

242:                                              ; preds = %232
  %243 = load ptr, ptr %8, align 8, !tbaa !9
  %244 = getelementptr inbounds %struct.Candidate, ptr %243, i32 1
  store ptr %244, ptr %8, align 8, !tbaa !9
  br label %227, !llvm.loop !27

245:                                              ; preds = %227
  %246 = load ptr, ptr %7, align 8, !tbaa !9
  call void @free(ptr noundef %246) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  br label %247

247:                                              ; preds = %245
  %248 = load ptr, ptr %3, align 8, !tbaa !9
  %249 = getelementptr inbounds %struct.Node, ptr %248, i32 0, i32 16
  %250 = load ptr, ptr %249, align 8, !tbaa !15
  store ptr %250, ptr %3, align 8, !tbaa !9
  %251 = load ptr, ptr @FirstNode, align 8, !tbaa !9
  %252 = icmp ne ptr %250, %251
  br i1 %252, label %213, label %253, !llvm.loop !28

253:                                              ; preds = %247
  %254 = load ptr, ptr %6, align 8, !tbaa !9
  call void @free(ptr noundef %254) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  br label %255

255:                                              ; preds = %253, %141, %135
  %256 = load i32, ptr @Level, align 4, !tbaa !5
  %257 = icmp eq i32 %256, 0
  br i1 %257, label %258, label %267

258:                                              ; preds = %255
  call void @ResetCandidateSet()
  call void @AddTourCandidates()
  %259 = load i32, ptr @CandidateSetSymmetric, align 4, !tbaa !5
  %260 = icmp ne i32 %259, 0
  br i1 %260, label %261, label %262

261:                                              ; preds = %258
  call void @SymmetrizeCandidateSet()
  br label %262

262:                                              ; preds = %261, %258
  %263 = load i32, ptr @TraceLevel, align 4, !tbaa !5
  %264 = icmp sge i32 %263, 2
  br i1 %264, label %265, label %266

265:                                              ; preds = %262
  call void (ptr, ...) @printff(ptr noundef @.str.10)
  br label %266

266:                                              ; preds = %265, %262
  br label %267

267:                                              ; preds = %266, %255
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 allocsize(0) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 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 #5 = { 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 #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }
attributes #8 = { 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 = !{!"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, !10, i64 0}
!12 = !{!"Candidate", !10, i64 0, !6, i64 8, !6, i64 12}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !10, i64 72}
!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, !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, !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 = distinct !{!18, !14}
!19 = !{!16, !10, i64 288}
!20 = !{!16, !6, i64 0}
!21 = !{!16, !17, i64 320}
!22 = !{!16, !17, i64 344}
!23 = distinct !{!23, !14}
!24 = distinct !{!24, !14}
!25 = !{!12, !6, i64 8}
!26 = !{!12, !6, i64 12}
!27 = distinct !{!27, !14}
!28 = distinct !{!28, !14}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.Candidate = type { ptr, i32, i32 }

@TraceLevel = external dso_local local_unnamed_addr global i32, align 4
@KDTree = external hidden local_unnamed_addr global ptr, align 8
@DimensionSaved = external dso_local local_unnamed_addr global i32, align 4
@XMin = external hidden local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [64 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [87 x i8], align 1
@XMax = external hidden local_unnamed_addr global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [64 x i8], align 1
@YMin = external hidden local_unnamed_addr global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [64 x i8], align 1
@YMax = external hidden local_unnamed_addr global ptr, align 8
@.str.5 = external hidden unnamed_addr constant [64 x i8], align 1
@CoordType = external dso_local local_unnamed_addr global i32, align 4
@ZMin = external hidden local_unnamed_addr global ptr, align 8
@.str.6 = external hidden unnamed_addr constant [64 x i8], align 1
@ZMax = external hidden local_unnamed_addr global ptr, align 8
@.str.7 = external hidden unnamed_addr constant [64 x i8], align 1
@Dimension = external dso_local local_unnamed_addr global i32, align 4
@Contains = external hidden local_unnamed_addr global ptr, align 8
@BoxOverlaps = external hidden local_unnamed_addr global ptr, align 8
@CandidateSet = external hidden local_unnamed_addr global ptr, align 8
@.str.8 = external hidden unnamed_addr constant [65 x i8], align 1
@FirstNode = external dso_local local_unnamed_addr global ptr, align 8
@Candidates = external hidden local_unnamed_addr global i32, align 4
@D = external dso_local local_unnamed_addr global ptr, align 8
@Level = external hidden local_unnamed_addr global i32, align 4
@WeightType = external dso_local local_unnamed_addr global i32, align 4
@.str.9 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [6 x i8], align 1
@CandidateSetSymmetric = external dso_local local_unnamed_addr global i32, align 4
@.str.11 = external hidden unnamed_addr constant [45 x i8], align 1
@__PRETTY_FUNCTION__.CreateNearestNeighborCandidateSet = external hidden unnamed_addr constant [44 x i8], align 1

declare void @printff(ptr noundef, ...) local_unnamed_addr #0

declare ptr @BuildKDTree(i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden void @ComputeBounds(i32 noundef, i32 noundef) local_unnamed_addr #3

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

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

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

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

; Function Attrs: nounwind uwtable
declare hidden void @NearestQuadrantNeighbors(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #3

declare i32 @AddCandidate(ptr noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4

declare void @ResetCandidateSet() local_unnamed_addr #0

declare void @AddTourCandidates() local_unnamed_addr #0

declare void @SymmetrizeCandidateSet() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @CreateNearestNeighborCandidateSet(i32 noundef %0) local_unnamed_addr #3 {
  %2 = load i32, ptr @TraceLevel, align 4, !tbaa !5
  %3 = icmp sgt i32 %2, 1
  br i1 %3, label %4, label %5

4:                                                ; preds = %1
  tail call void (ptr, ...) @printff(ptr noundef nonnull @.str.11) #5
  br label %5

5:                                                ; preds = %4, %1
  %6 = tail call ptr @BuildKDTree(i32 noundef 1) #5
  store ptr %6, ptr @KDTree, align 8, !tbaa !9
  %7 = load i32, ptr @DimensionSaved, align 4, !tbaa !5
  %8 = add nsw i32 %7, 1
  %9 = sext i32 %8 to i64
  %10 = shl nsw i64 %9, 3
  %11 = tail call noalias ptr @malloc(i64 noundef %10) #6
  store ptr %11, ptr @XMin, align 8, !tbaa !9
  %.not = icmp eq ptr %11, null
  br i1 %.not, label %12, label %13

12:                                               ; preds = %5
  tail call void @__assert_fail(ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef 181, ptr noundef nonnull @__PRETTY_FUNCTION__.CreateNearestNeighborCandidateSet) #7
  unreachable

13:                                               ; preds = %5
  %14 = tail call noalias ptr @malloc(i64 noundef %10) #6
  store ptr %14, ptr @XMax, align 8, !tbaa !9
  %.not45 = icmp eq ptr %14, null
  br i1 %.not45, label %15, label %16

15:                                               ; preds = %13
  tail call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.2, i32 noundef 183, ptr noundef nonnull @__PRETTY_FUNCTION__.CreateNearestNeighborCandidateSet) #7
  unreachable

16:                                               ; preds = %13
  %17 = tail call noalias ptr @malloc(i64 noundef %10) #6
  store ptr %17, ptr @YMin, align 8, !tbaa !9
  %.not46 = icmp eq ptr %17, null
  br i1 %.not46, label %18, label %19

18:                                               ; preds = %16
  tail call void @__assert_fail(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.2, i32 noundef 185, ptr noundef nonnull @__PRETTY_FUNCTION__.CreateNearestNeighborCandidateSet) #7
  unreachable

19:                                               ; preds = %16
  %20 = tail call noalias ptr @malloc(i64 noundef %10) #6
  store ptr %20, ptr @YMax, align 8, !tbaa !9
  %.not47 = icmp eq ptr %20, null
  br i1 %.not47, label %21, label %22

21:                                               ; preds = %19
  tail call void @__assert_fail(ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.2, i32 noundef 187, ptr noundef nonnull @__PRETTY_FUNCTION__.CreateNearestNeighborCandidateSet) #7
  unreachable

22:                                               ; preds = %19
  %23 = load i32, ptr @CoordType, align 4, !tbaa !5
  %24 = icmp eq i32 %23, 1
  br i1 %24, label %25, label %31

25:                                               ; preds = %22
  %26 = tail call noalias ptr @malloc(i64 noundef %10) #6
  store ptr %26, ptr @ZMin, align 8, !tbaa !9
  %.not48 = icmp eq ptr %26, null
  br i1 %.not48, label %27, label %28

27:                                               ; preds = %25
  tail call void @__assert_fail(ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.2, i32 noundef 190, ptr noundef nonnull @__PRETTY_FUNCTION__.CreateNearestNeighborCandidateSet) #7
  unreachable

28:                                               ; preds = %25
  %29 = tail call noalias ptr @malloc(i64 noundef %10) #6
  store ptr %29, ptr @ZMax, align 8, !tbaa !9
  %.not49 = icmp eq ptr %29, null
  br i1 %.not49, label %30, label %31

30:                                               ; preds = %28
  tail call void @__assert_fail(ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.2, i32 noundef 192, ptr noundef nonnull @__PRETTY_FUNCTION__.CreateNearestNeighborCandidateSet) #7
  unreachable

31:                                               ; preds = %28, %22
  %32 = load i32, ptr @Dimension, align 4, !tbaa !5
  %33 = add nsw i32 %32, -1
  tail call void @ComputeBounds(i32 noundef 0, i32 noundef %33)
  %34 = load i32, ptr @CoordType, align 4, !tbaa !5
  %35 = icmp eq i32 %34, 1
  %36 = select i1 %35, ptr @Contains3D, ptr @Contains2D
  store ptr %36, ptr @Contains, align 8, !tbaa !9
  %37 = select i1 %35, ptr @BoxOverlaps3D, ptr @BoxOverlaps2D
  store ptr %37, ptr @BoxOverlaps, align 8, !tbaa !9
  %38 = add nsw i32 %0, 1
  %39 = sext i32 %38 to i64
  %40 = shl nsw i64 %39, 4
  %41 = tail call noalias ptr @malloc(i64 noundef %40) #6
  store ptr %41, ptr @CandidateSet, align 8, !tbaa !9
  %.not50 = icmp eq ptr %41, null
  br i1 %.not50, label %42, label %43

42:                                               ; preds = %31
  tail call void @__assert_fail(ptr noundef nonnull @.str.8, ptr noundef nonnull @.str.2, i32 noundef 199, ptr noundef nonnull @__PRETTY_FUNCTION__.CreateNearestNeighborCandidateSet) #7
  unreachable

43:                                               ; preds = %31
  %44 = load ptr, ptr @FirstNode, align 8, !tbaa !9
  br label %45

45:                                               ; preds = %._crit_edge, %43
  %.038 = phi ptr [ %44, %43 ], [ %58, %._crit_edge ]
  tail call void @NearestQuadrantNeighbors(ptr noundef %.038, i32 noundef 0, i32 noundef %0)
  %46 = load i32, ptr @Candidates, align 4, !tbaa !5
  %47 = icmp sgt i32 %46, 0
  br i1 %47, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %45, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %45 ]
  %48 = load ptr, ptr @CandidateSet, align 8, !tbaa !9
  %49 = getelementptr inbounds %struct.Candidate, ptr %48, i64 %indvars.iv
  %50 = load ptr, ptr %49, align 8, !tbaa !11
  %51 = load ptr, ptr @D, align 8, !tbaa !9
  %52 = tail call i32 %51(ptr noundef %.038, ptr noundef %50) #5
  %53 = tail call i32 @AddCandidate(ptr noundef %.038, ptr noundef %50, i32 noundef %52, i32 noundef 1) #5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %54 = load i32, ptr @Candidates, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = icmp slt i64 %indvars.iv.next, %55
  br i1 %56, label %.lr.ph, label %._crit_edge, !llvm.loop !13

._crit_edge:                                      ; preds = %.lr.ph, %45
  %57 = getelementptr inbounds i8, ptr %.038, i64 72
  %58 = load ptr, ptr %57, align 8, !tbaa !15
  %59 = load ptr, ptr @FirstNode, align 8, !tbaa !9
  %.not51 = icmp eq ptr %58, %59
  br i1 %.not51, label %60, label %45, !llvm.loop !18

60:                                               ; preds = %._crit_edge
  %61 = load ptr, ptr @CandidateSet, align 8, !tbaa !9
  tail call void @free(ptr noundef %61) #5
  %62 = load ptr, ptr @KDTree, align 8, !tbaa !9
  tail call void @free(ptr noundef %62) #5
  %63 = load ptr, ptr @XMin, align 8, !tbaa !9
  tail call void @free(ptr noundef %63) #5
  %64 = load ptr, ptr @XMax, align 8, !tbaa !9
  tail call void @free(ptr noundef %64) #5
  %65 = load ptr, ptr @YMin, align 8, !tbaa !9
  tail call void @free(ptr noundef %65) #5
  %66 = load ptr, ptr @YMax, align 8, !tbaa !9
  tail call void @free(ptr noundef %66) #5
  %67 = load i32, ptr @CoordType, align 4, !tbaa !5
  %68 = icmp eq i32 %67, 1
  br i1 %68, label %69, label %72

69:                                               ; preds = %60
  %70 = load ptr, ptr @ZMin, align 8, !tbaa !9
  tail call void @free(ptr noundef %70) #5
  %71 = load ptr, ptr @ZMax, align 8, !tbaa !9
  tail call void @free(ptr noundef %71) #5
  br label %72

72:                                               ; preds = %69, %60
  %73 = load i32, ptr @Level, align 4, !tbaa !5
  %74 = icmp eq i32 %73, 0
  br i1 %74, label %75, label %.thread58

75:                                               ; preds = %72
  %76 = load i32, ptr @WeightType, align 4
  switch i32 %76, label %.thread [
    i32 12, label %77
    i32 10, label %77
  ]

77:                                               ; preds = %75, %75
  %78 = load i32, ptr @DimensionSaved, align 4, !tbaa !5
  %79 = add nsw i32 %78, 1
  %80 = sext i32 %79 to i64
  %81 = shl nsw i64 %80, 3
  %82 = tail call noalias ptr @malloc(i64 noundef %81) #6
  %.not52 = icmp eq ptr %82, null
  br i1 %.not52, label %83, label %84

83:                                               ; preds = %77
  tail call void @__assert_fail(ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.2, i32 noundef 224, ptr noundef nonnull @__PRETTY_FUNCTION__.CreateNearestNeighborCandidateSet) #7
  unreachable

84:                                               ; preds = %77
  %85 = load i32, ptr @TraceLevel, align 4, !tbaa !5
  %86 = icmp sgt i32 %85, 1
  br i1 %86, label %87, label %88

87:                                               ; preds = %84
  tail call void (ptr, ...) @printff(ptr noundef nonnull @.str.10) #5
  br label %88

88:                                               ; preds = %87, %84
  %89 = load ptr, ptr @FirstNode, align 8, !tbaa !9
  br label %90

90:                                               ; preds = %90, %88
  %.1 = phi ptr [ %89, %88 ], [ %103, %90 ]
  %91 = getelementptr inbounds i8, ptr %.1, i64 288
  %92 = load ptr, ptr %91, align 8, !tbaa !19
  %93 = load i32, ptr %.1, align 8, !tbaa !20
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds ptr, ptr %82, i64 %94
  store ptr %92, ptr %95, align 8, !tbaa !9
  store ptr null, ptr %91, align 8, !tbaa !19
  %96 = getelementptr inbounds i8, ptr %.1, i64 320
  %97 = load double, ptr %96, align 8, !tbaa !21
  %98 = getelementptr inbounds i8, ptr %.1, i64 344
  store double %97, ptr %98, align 8, !tbaa !22
  %99 = fcmp ogt double %97, 0.000000e+00
  %100 = select i1 %99, double -1.800000e+02, double 1.800000e+02
  %101 = fadd double %97, %100
  store double %101, ptr %96, align 8, !tbaa !21
  %102 = getelementptr inbounds i8, ptr %.1, i64 72
  %103 = load ptr, ptr %102, align 8, !tbaa !15
  %.not53 = icmp eq ptr %103, %89
  br i1 %.not53, label %104, label %90, !llvm.loop !23

104:                                              ; preds = %90
  %105 = load i32, ptr @Level, align 4, !tbaa !5
  %106 = add nsw i32 %105, 1
  store i32 %106, ptr @Level, align 4, !tbaa !5
  tail call void @CreateNearestNeighborCandidateSet(i32 noundef %0)
  %107 = load i32, ptr @Level, align 4, !tbaa !5
  %108 = add nsw i32 %107, -1
  store i32 %108, ptr @Level, align 4, !tbaa !5
  %109 = load ptr, ptr @FirstNode, align 8, !tbaa !9
  br label %110

110:                                              ; preds = %110, %104
  %.2 = phi ptr [ %109, %104 ], [ %115, %110 ]
  %111 = getelementptr inbounds i8, ptr %.2, i64 344
  %112 = load double, ptr %111, align 8, !tbaa !22
  %113 = getelementptr inbounds i8, ptr %.2, i64 320
  store double %112, ptr %113, align 8, !tbaa !21
  %114 = getelementptr inbounds i8, ptr %.2, i64 72
  %115 = load ptr, ptr %114, align 8, !tbaa !15
  %.not54 = icmp eq ptr %115, %109
  br i1 %.not54, label %.preheader, label %110, !llvm.loop !24

.preheader:                                       ; preds = %110, %._crit_edge64
  %.3 = phi ptr [ %132, %._crit_edge64 ], [ %115, %110 ]
  %116 = getelementptr inbounds i8, ptr %.3, i64 288
  %117 = load ptr, ptr %116, align 8, !tbaa !19
  %118 = load i32, ptr %.3, align 8, !tbaa !20
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds ptr, ptr %82, i64 %119
  %121 = load ptr, ptr %120, align 8, !tbaa !9
  store ptr %121, ptr %116, align 8, !tbaa !19
  %122 = load ptr, ptr %117, align 8, !tbaa !11
  %.not5560 = icmp eq ptr %122, null
  br i1 %.not5560, label %._crit_edge64, label %.lr.ph63

.lr.ph63:                                         ; preds = %.preheader, %.lr.ph63
  %123 = phi ptr [ %130, %.lr.ph63 ], [ %122, %.preheader ]
  %.061 = phi ptr [ %129, %.lr.ph63 ], [ %117, %.preheader ]
  %124 = getelementptr inbounds i8, ptr %.061, i64 8
  %125 = load i32, ptr %124, align 8, !tbaa !25
  %126 = getelementptr inbounds i8, ptr %.061, i64 12
  %127 = load i32, ptr %126, align 4, !tbaa !26
  %128 = tail call i32 @AddCandidate(ptr noundef nonnull %.3, ptr noundef nonnull %123, i32 noundef %125, i32 noundef %127) #5
  %129 = getelementptr inbounds i8, ptr %.061, i64 16
  %130 = load ptr, ptr %129, align 8, !tbaa !11
  %.not55 = icmp eq ptr %130, null
  br i1 %.not55, label %._crit_edge64, label %.lr.ph63, !llvm.loop !27

._crit_edge64:                                    ; preds = %.lr.ph63, %.preheader
  tail call void @free(ptr noundef %117) #5
  %131 = getelementptr inbounds i8, ptr %.3, i64 72
  %132 = load ptr, ptr %131, align 8, !tbaa !15
  %133 = load ptr, ptr @FirstNode, align 8, !tbaa !9
  %.not56 = icmp eq ptr %132, %133
  br i1 %.not56, label %134, label %.preheader, !llvm.loop !28

134:                                              ; preds = %._crit_edge64
  tail call void @free(ptr noundef %82) #5
  %.pr = load i32, ptr @Level, align 4, !tbaa !5
  %135 = icmp eq i32 %.pr, 0
  br i1 %135, label %.thread, label %.thread58

.thread:                                          ; preds = %75, %134
  tail call void @ResetCandidateSet() #5
  tail call void @AddTourCandidates() #5
  %136 = load i32, ptr @CandidateSetSymmetric, align 4, !tbaa !5
  %.not57 = icmp eq i32 %136, 0
  br i1 %.not57, label %138, label %137

137:                                              ; preds = %.thread
  tail call void @SymmetrizeCandidateSet() #5
  br label %138

138:                                              ; preds = %137, %.thread
  %139 = load i32, ptr @TraceLevel, align 4, !tbaa !5
  %140 = icmp sgt i32 %139, 1
  br i1 %140, label %141, label %.thread58

141:                                              ; preds = %138
  tail call void (ptr, ...) @printff(ptr noundef nonnull @.str.10) #5
  br label %.thread58

.thread58:                                        ; preds = %72, %138, %141, %134
  ret void
}

attributes #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 nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 #3 = { 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 #4 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
attributes #6 = { nounwind allocsize(0) }
attributes #7 = { 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 = !{!"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, !10, i64 0}
!12 = !{!"Candidate", !10, i64 0, !6, i64 8, !6, i64 12}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !10, i64 72}
!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, !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, !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 = distinct !{!18, !14}
!19 = !{!16, !10, i64 288}
!20 = !{!16, !6, i64 0}
!21 = !{!16, !17, i64 320}
!22 = !{!16, !17, i64 344}
!23 = distinct !{!23, !14}
!24 = distinct !{!24, !14}
!25 = !{!12, !6, i64 8}
!26 = !{!12, !6, i64 12}
!27 = distinct !{!27, !14}
!28 = distinct !{!28, !14}


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