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

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

@Heap = external dso_local global ptr, align 8
@BestTour = external dso_local global ptr, align 8
@BetterTour = external dso_local global ptr, align 8
@HTable = external dso_local global ptr, align 8
@Rand = external dso_local global ptr, align 8
@CacheSig = external dso_local global ptr, align 8
@CacheVal = external dso_local global ptr, align 8
@T = external dso_local global ptr, align 8
@G = external dso_local global ptr, align 8
@t = external dso_local global ptr, align 8
@p = external dso_local global ptr, align 8
@q = external dso_local global ptr, align 8
@SwapStack = external dso_local global ptr, align 8
@tSaved = external dso_local global ptr, align 8
@Dimension = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [54 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [79 x i8], align 1
@__PRETTY_FUNCTION__.AllocateStructures = external hidden unnamed_addr constant [26 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [56 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [49 x i8], align 1
@Seed = external dso_local global i32, align 4
@.str.4 = external hidden unnamed_addr constant [63 x i8], align 1
@WeightType = external dso_local global i32, align 4
@.str.5 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [42 x i8], align 1
@CacheMask = external dso_local global i32, align 4
@MoveType = external dso_local global i32, align 4
@SubsequentMoveType = external dso_local global i32, align 4
@.str.7 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [56 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [40 x i8], align 1
@incl = external dso_local global ptr, align 8
@.str.13 = external hidden unnamed_addr constant [43 x i8], align 1
@cycle = external dso_local global ptr, align 8
@.str.14 = external hidden unnamed_addr constant [44 x i8], align 1
@MaxSwaps = external dso_local global i32, align 4
@.str.15 = external hidden unnamed_addr constant [75 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @AllocateStructures() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  %3 = load ptr, ptr @Heap, align 8, !tbaa !5
  call void @free(ptr noundef %3) #7
  store ptr null, ptr @Heap, align 8, !tbaa !5
  %4 = load ptr, ptr @BestTour, align 8, !tbaa !5
  call void @free(ptr noundef %4) #7
  store ptr null, ptr @BestTour, align 8, !tbaa !5
  %5 = load ptr, ptr @BetterTour, align 8, !tbaa !5
  call void @free(ptr noundef %5) #7
  store ptr null, ptr @BetterTour, align 8, !tbaa !5
  %6 = load ptr, ptr @HTable, align 8, !tbaa !5
  call void @free(ptr noundef %6) #7
  store ptr null, ptr @HTable, align 8, !tbaa !5
  %7 = load ptr, ptr @Rand, align 8, !tbaa !5
  call void @free(ptr noundef %7) #7
  store ptr null, ptr @Rand, align 8, !tbaa !5
  %8 = load ptr, ptr @CacheSig, align 8, !tbaa !5
  call void @free(ptr noundef %8) #7
  store ptr null, ptr @CacheSig, align 8, !tbaa !5
  %9 = load ptr, ptr @CacheVal, align 8, !tbaa !5
  call void @free(ptr noundef %9) #7
  store ptr null, ptr @CacheVal, align 8, !tbaa !5
  %10 = load ptr, ptr @T, align 8, !tbaa !5
  call void @free(ptr noundef %10) #7
  store ptr null, ptr @T, align 8, !tbaa !5
  %11 = load ptr, ptr @G, align 8, !tbaa !5
  call void @free(ptr noundef %11) #7
  store ptr null, ptr @G, align 8, !tbaa !5
  %12 = load ptr, ptr @t, align 8, !tbaa !5
  call void @free(ptr noundef %12) #7
  store ptr null, ptr @t, align 8, !tbaa !5
  %13 = load ptr, ptr @p, align 8, !tbaa !5
  call void @free(ptr noundef %13) #7
  store ptr null, ptr @p, align 8, !tbaa !5
  %14 = load ptr, ptr @q, align 8, !tbaa !5
  call void @free(ptr noundef %14) #7
  store ptr null, ptr @q, align 8, !tbaa !5
  %15 = load ptr, ptr @SwapStack, align 8, !tbaa !5
  call void @free(ptr noundef %15) #7
  store ptr null, ptr @SwapStack, align 8, !tbaa !5
  %16 = load ptr, ptr @tSaved, align 8, !tbaa !5
  call void @free(ptr noundef %16) #7
  store ptr null, ptr @tSaved, align 8, !tbaa !5
  %17 = load i32, ptr @Dimension, align 4, !tbaa !9
  call void @MakeHeap(i32 noundef %17)
  %18 = load i32, ptr @Dimension, align 4, !tbaa !9
  %19 = add nsw i32 1, %18
  %20 = sext i32 %19 to i64
  %21 = call noalias ptr @calloc(i64 noundef %20, i64 noundef 4) #8
  store ptr %21, ptr @BestTour, align 8, !tbaa !5
  %22 = icmp ne ptr %21, null
  br i1 %22, label %23, label %24

23:                                               ; preds = %0
  br label %25

24:                                               ; preds = %0
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 33, ptr noundef @__PRETTY_FUNCTION__.AllocateStructures) #9
  unreachable

25:                                               ; preds = %23
  %26 = load i32, ptr @Dimension, align 4, !tbaa !9
  %27 = add nsw i32 1, %26
  %28 = sext i32 %27 to i64
  %29 = call noalias ptr @calloc(i64 noundef %28, i64 noundef 4) #8
  store ptr %29, ptr @BetterTour, align 8, !tbaa !5
  %30 = icmp ne ptr %29, null
  br i1 %30, label %31, label %32

31:                                               ; preds = %25
  br label %33

32:                                               ; preds = %25
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 34, ptr noundef @__PRETTY_FUNCTION__.AllocateStructures) #9
  unreachable

33:                                               ; preds = %31
  %34 = call noalias ptr @malloc(i64 noundef 1048344) #10
  store ptr %34, ptr @HTable, align 8, !tbaa !5
  %35 = icmp ne ptr %34, null
  br i1 %35, label %36, label %37

36:                                               ; preds = %33
  br label %38

37:                                               ; preds = %33
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 35, ptr noundef @__PRETTY_FUNCTION__.AllocateStructures) #9
  unreachable

38:                                               ; preds = %36
  %39 = load ptr, ptr @HTable, align 8, !tbaa !5
  call void @HashInitialize(ptr noundef %39)
  %40 = load i32, ptr @Seed, align 4, !tbaa !9
  call void @SRandom(i32 noundef %40)
  %41 = load i32, ptr @Dimension, align 4, !tbaa !9
  %42 = add nsw i32 %41, 1
  %43 = sext i32 %42 to i64
  %44 = mul i64 %43, 4
  %45 = call noalias ptr @malloc(i64 noundef %44) #10
  store ptr %45, ptr @Rand, align 8, !tbaa !5
  %46 = icmp ne ptr %45, null
  br i1 %46, label %47, label %48

47:                                               ; preds = %38
  br label %49

48:                                               ; preds = %38
  call void @__assert_fail(ptr noundef @.str.4, ptr noundef @.str.1, i32 noundef 39, ptr noundef @__PRETTY_FUNCTION__.AllocateStructures) #9
  unreachable

49:                                               ; preds = %47
  store i32 1, ptr %1, align 4, !tbaa !9
  br label %50

50:                                               ; preds = %60, %49
  %51 = load i32, ptr %1, align 4, !tbaa !9
  %52 = load i32, ptr @Dimension, align 4, !tbaa !9
  %53 = icmp sle i32 %51, %52
  br i1 %53, label %54, label %63

54:                                               ; preds = %50
  %55 = call i32 @Random()
  %56 = load ptr, ptr @Rand, align 8, !tbaa !5
  %57 = load i32, ptr %1, align 4, !tbaa !9
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds i32, ptr %56, i64 %58
  store i32 %55, ptr %59, align 4, !tbaa !9
  br label %60

60:                                               ; preds = %54
  %61 = load i32, ptr %1, align 4, !tbaa !9
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr %1, align 4, !tbaa !9
  br label %50, !llvm.loop !11

63:                                               ; preds = %50
  %64 = load i32, ptr @Seed, align 4, !tbaa !9
  call void @SRandom(i32 noundef %64)
  %65 = load i32, ptr @WeightType, align 4, !tbaa !9
  %66 = icmp ne i32 %65, 0
  br i1 %66, label %67, label %97

67:                                               ; preds = %63
  store i32 0, ptr %1, align 4, !tbaa !9
  br label %68

68:                                               ; preds = %75, %67
  %69 = load i32, ptr %1, align 4, !tbaa !9
  %70 = shl i32 1, %69
  %71 = load i32, ptr @Dimension, align 4, !tbaa !9
  %72 = shl i32 %71, 1
  %73 = icmp slt i32 %70, %72
  br i1 %73, label %74, label %78

74:                                               ; preds = %68
  br label %75

75:                                               ; preds = %74
  %76 = load i32, ptr %1, align 4, !tbaa !9
  %77 = add nsw i32 %76, 1
  store i32 %77, ptr %1, align 4, !tbaa !9
  br label %68, !llvm.loop !13

78:                                               ; preds = %68
  %79 = load i32, ptr %1, align 4, !tbaa !9
  %80 = shl i32 1, %79
  store i32 %80, ptr %1, align 4, !tbaa !9
  %81 = load i32, ptr %1, align 4, !tbaa !9
  %82 = sext i32 %81 to i64
  %83 = call noalias ptr @calloc(i64 noundef %82, i64 noundef 4) #8
  store ptr %83, ptr @CacheSig, align 8, !tbaa !5
  %84 = icmp ne ptr %83, null
  br i1 %84, label %85, label %86

85:                                               ; preds = %78
  br label %87

86:                                               ; preds = %78
  call void @__assert_fail(ptr noundef @.str.5, ptr noundef @.str.1, i32 noundef 46, ptr noundef @__PRETTY_FUNCTION__.AllocateStructures) #9
  unreachable

87:                                               ; preds = %85
  %88 = load i32, ptr %1, align 4, !tbaa !9
  %89 = sext i32 %88 to i64
  %90 = call noalias ptr @calloc(i64 noundef %89, i64 noundef 4) #8
  store ptr %90, ptr @CacheVal, align 8, !tbaa !5
  %91 = icmp ne ptr %90, null
  br i1 %91, label %92, label %93

92:                                               ; preds = %87
  br label %94

93:                                               ; preds = %87
  call void @__assert_fail(ptr noundef @.str.6, ptr noundef @.str.1, i32 noundef 47, ptr noundef @__PRETTY_FUNCTION__.AllocateStructures) #9
  unreachable

94:                                               ; preds = %92
  %95 = load i32, ptr %1, align 4, !tbaa !9
  %96 = sub nsw i32 %95, 1
  store i32 %96, ptr @CacheMask, align 4, !tbaa !9
  br label %97

97:                                               ; preds = %94, %63
  call void @AllocateSegments()
  %98 = load i32, ptr @MoveType, align 4, !tbaa !9
  store i32 %98, ptr %2, align 4, !tbaa !9
  %99 = load i32, ptr @SubsequentMoveType, align 4, !tbaa !9
  %100 = load i32, ptr %2, align 4, !tbaa !9
  %101 = icmp sgt i32 %99, %100
  br i1 %101, label %102, label %104

102:                                              ; preds = %97
  %103 = load i32, ptr @SubsequentMoveType, align 4, !tbaa !9
  store i32 %103, ptr %2, align 4, !tbaa !9
  br label %104

104:                                              ; preds = %102, %97
  %105 = load i32, ptr %2, align 4, !tbaa !9
  %106 = mul nsw i32 2, %105
  %107 = add nsw i32 1, %106
  %108 = sext i32 %107 to i64
  %109 = mul i64 %108, 8
  %110 = call noalias ptr @malloc(i64 noundef %109) #10
  store ptr %110, ptr @T, align 8, !tbaa !5
  %111 = icmp ne ptr %110, null
  br i1 %111, label %112, label %113

112:                                              ; preds = %104
  br label %114

113:                                              ; preds = %104
  call void @__assert_fail(ptr noundef @.str.7, ptr noundef @.str.1, i32 noundef 54, ptr noundef @__PRETTY_FUNCTION__.AllocateStructures) #9
  unreachable

114:                                              ; preds = %112
  %115 = load i32, ptr %2, align 4, !tbaa !9
  %116 = mul nsw i32 2, %115
  %117 = sext i32 %116 to i64
  %118 = mul i64 %117, 8
  %119 = call noalias ptr @malloc(i64 noundef %118) #10
  store ptr %119, ptr @G, align 8, !tbaa !5
  %120 = icmp ne ptr %119, null
  br i1 %120, label %121, label %122

121:                                              ; preds = %114
  br label %123

122:                                              ; preds = %114
  call void @__assert_fail(ptr noundef @.str.8, ptr noundef @.str.1, i32 noundef 55, ptr noundef @__PRETTY_FUNCTION__.AllocateStructures) #9
  unreachable

123:                                              ; preds = %121
  %124 = load i32, ptr %2, align 4, !tbaa !9
  %125 = mul nsw i32 6, %124
  %126 = sext i32 %125 to i64
  %127 = mul i64 %126, 8
  %128 = call noalias ptr @malloc(i64 noundef %127) #10
  store ptr %128, ptr @t, align 8, !tbaa !5
  %129 = icmp ne ptr %128, null
  br i1 %129, label %130, label %131

130:                                              ; preds = %123
  br label %132

131:                                              ; preds = %123
  call void @__assert_fail(ptr noundef @.str.9, ptr noundef @.str.1, i32 noundef 56, ptr noundef @__PRETTY_FUNCTION__.AllocateStructures) #9
  unreachable

132:                                              ; preds = %130
  %133 = load i32, ptr %2, align 4, !tbaa !9
  %134 = mul nsw i32 2, %133
  %135 = add nsw i32 1, %134
  %136 = sext i32 %135 to i64
  %137 = mul i64 %136, 8
  %138 = call noalias ptr @malloc(i64 noundef %137) #10
  store ptr %138, ptr @tSaved, align 8, !tbaa !5
  %139 = icmp ne ptr %138, null
  br i1 %139, label %140, label %141

140:                                              ; preds = %132
  br label %142

141:                                              ; preds = %132
  call void @__assert_fail(ptr noundef @.str.10, ptr noundef @.str.1, i32 noundef 57, ptr noundef @__PRETTY_FUNCTION__.AllocateStructures) #9
  unreachable

142:                                              ; preds = %140
  %143 = load i32, ptr %2, align 4, !tbaa !9
  %144 = mul nsw i32 6, %143
  %145 = sext i32 %144 to i64
  %146 = mul i64 %145, 4
  %147 = call noalias ptr @malloc(i64 noundef %146) #10
  store ptr %147, ptr @p, align 8, !tbaa !5
  %148 = icmp ne ptr %147, null
  br i1 %148, label %149, label %150

149:                                              ; preds = %142
  br label %151

150:                                              ; preds = %142
  call void @__assert_fail(ptr noundef @.str.11, ptr noundef @.str.1, i32 noundef 58, ptr noundef @__PRETTY_FUNCTION__.AllocateStructures) #9
  unreachable

151:                                              ; preds = %149
  %152 = load i32, ptr %2, align 4, !tbaa !9
  %153 = mul nsw i32 6, %152
  %154 = sext i32 %153 to i64
  %155 = mul i64 %154, 4
  %156 = call noalias ptr @malloc(i64 noundef %155) #10
  store ptr %156, ptr @q, align 8, !tbaa !5
  %157 = icmp ne ptr %156, null
  br i1 %157, label %158, label %159

158:                                              ; preds = %151
  br label %160

159:                                              ; preds = %151
  call void @__assert_fail(ptr noundef @.str.12, ptr noundef @.str.1, i32 noundef 59, ptr noundef @__PRETTY_FUNCTION__.AllocateStructures) #9
  unreachable

160:                                              ; preds = %158
  %161 = load i32, ptr %2, align 4, !tbaa !9
  %162 = mul nsw i32 6, %161
  %163 = sext i32 %162 to i64
  %164 = mul i64 %163, 4
  %165 = call noalias ptr @malloc(i64 noundef %164) #10
  store ptr %165, ptr @incl, align 8, !tbaa !5
  %166 = icmp ne ptr %165, null
  br i1 %166, label %167, label %168

167:                                              ; preds = %160
  br label %169

168:                                              ; preds = %160
  call void @__assert_fail(ptr noundef @.str.13, ptr noundef @.str.1, i32 noundef 60, ptr noundef @__PRETTY_FUNCTION__.AllocateStructures) #9
  unreachable

169:                                              ; preds = %167
  %170 = load i32, ptr %2, align 4, !tbaa !9
  %171 = mul nsw i32 6, %170
  %172 = sext i32 %171 to i64
  %173 = mul i64 %172, 4
  %174 = call noalias ptr @malloc(i64 noundef %173) #10
  store ptr %174, ptr @cycle, align 8, !tbaa !5
  %175 = icmp ne ptr %174, null
  br i1 %175, label %176, label %177

176:                                              ; preds = %169
  br label %178

177:                                              ; preds = %169
  call void @__assert_fail(ptr noundef @.str.14, ptr noundef @.str.1, i32 noundef 61, ptr noundef @__PRETTY_FUNCTION__.AllocateStructures) #9
  unreachable

178:                                              ; preds = %176
  %179 = load i32, ptr @MaxSwaps, align 4, !tbaa !9
  %180 = load i32, ptr %2, align 4, !tbaa !9
  %181 = mul nsw i32 6, %180
  %182 = add nsw i32 %179, %181
  %183 = sext i32 %182 to i64
  %184 = mul i64 %183, 32
  %185 = call noalias ptr @malloc(i64 noundef %184) #10
  store ptr %185, ptr @SwapStack, align 8, !tbaa !5
  %186 = icmp ne ptr %185, null
  br i1 %186, label %187, label %188

187:                                              ; preds = %178
  br label %189

188:                                              ; preds = %178
  call void @__assert_fail(ptr noundef @.str.15, ptr noundef @.str.1, i32 noundef 63, ptr noundef @__PRETTY_FUNCTION__.AllocateStructures) #9
  unreachable

189:                                              ; preds = %187
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #7
  ret void
}

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

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

declare void @MakeHeap(i32 noundef) #3

; Function Attrs: nounwind allocsize(0,1)
declare noalias ptr @calloc(i64 noundef, i64 noundef) #4

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

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

declare void @HashInitialize(ptr noundef) #3

declare void @SRandom(i32 noundef) #3

declare i32 @Random() #3

; Function Attrs: nounwind uwtable
declare dso_local void @AllocateSegments() #0

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

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = { "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 allocsize(0,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 #5 = { 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 #6 = { 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 #7 = { nounwind }
attributes #8 = { nounwind allocsize(0,1) }
attributes #9 = { noreturn nounwind }
attributes #10 = { nounwind allocsize(0) }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}


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

@Heap = external dso_local local_unnamed_addr global ptr, align 8
@BestTour = external dso_local local_unnamed_addr global ptr, align 8
@BetterTour = external dso_local local_unnamed_addr global ptr, align 8
@HTable = external dso_local local_unnamed_addr global ptr, align 8
@Rand = external dso_local local_unnamed_addr global ptr, align 8
@CacheSig = external dso_local local_unnamed_addr global ptr, align 8
@CacheVal = external dso_local local_unnamed_addr global ptr, align 8
@T = external dso_local local_unnamed_addr global ptr, align 8
@G = external dso_local local_unnamed_addr global ptr, align 8
@t = external dso_local local_unnamed_addr global ptr, align 8
@p = external dso_local local_unnamed_addr global ptr, align 8
@q = external dso_local local_unnamed_addr global ptr, align 8
@SwapStack = external dso_local local_unnamed_addr global ptr, align 8
@tSaved = external dso_local local_unnamed_addr global ptr, align 8
@Dimension = external dso_local local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [54 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [79 x i8], align 1
@__PRETTY_FUNCTION__.AllocateStructures = external hidden unnamed_addr constant [26 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [56 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [49 x i8], align 1
@Seed = external dso_local local_unnamed_addr global i32, align 4
@.str.4 = external hidden unnamed_addr constant [63 x i8], align 1
@WeightType = external dso_local local_unnamed_addr global i32, align 4
@.str.5 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [42 x i8], align 1
@CacheMask = external dso_local local_unnamed_addr global i32, align 4
@MoveType = external dso_local local_unnamed_addr global i32, align 4
@SubsequentMoveType = external dso_local local_unnamed_addr global i32, align 4
@.str.7 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [56 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [40 x i8], align 1
@incl = external dso_local local_unnamed_addr global ptr, align 8
@.str.13 = external hidden unnamed_addr constant [43 x i8], align 1
@cycle = external dso_local local_unnamed_addr global ptr, align 8
@.str.14 = external hidden unnamed_addr constant [44 x i8], align 1
@MaxSwaps = external dso_local local_unnamed_addr global i32, align 4
@.str.15 = external hidden unnamed_addr constant [75 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @AllocateStructures() local_unnamed_addr #0 {
  %1 = load ptr, ptr @Heap, align 8, !tbaa !5
  tail call void @free(ptr noundef %1) #7
  store ptr null, ptr @Heap, align 8, !tbaa !5
  %2 = load ptr, ptr @BestTour, align 8, !tbaa !5
  tail call void @free(ptr noundef %2) #7
  store ptr null, ptr @BestTour, align 8, !tbaa !5
  %3 = load ptr, ptr @BetterTour, align 8, !tbaa !5
  tail call void @free(ptr noundef %3) #7
  store ptr null, ptr @BetterTour, align 8, !tbaa !5
  %4 = load ptr, ptr @HTable, align 8, !tbaa !5
  tail call void @free(ptr noundef %4) #7
  store ptr null, ptr @HTable, align 8, !tbaa !5
  %5 = load ptr, ptr @Rand, align 8, !tbaa !5
  tail call void @free(ptr noundef %5) #7
  store ptr null, ptr @Rand, align 8, !tbaa !5
  %6 = load ptr, ptr @CacheSig, align 8, !tbaa !5
  tail call void @free(ptr noundef %6) #7
  store ptr null, ptr @CacheSig, align 8, !tbaa !5
  %7 = load ptr, ptr @CacheVal, align 8, !tbaa !5
  tail call void @free(ptr noundef %7) #7
  store ptr null, ptr @CacheVal, align 8, !tbaa !5
  %8 = load ptr, ptr @T, align 8, !tbaa !5
  tail call void @free(ptr noundef %8) #7
  store ptr null, ptr @T, align 8, !tbaa !5
  %9 = load ptr, ptr @G, align 8, !tbaa !5
  tail call void @free(ptr noundef %9) #7
  store ptr null, ptr @G, align 8, !tbaa !5
  %10 = load ptr, ptr @t, align 8, !tbaa !5
  tail call void @free(ptr noundef %10) #7
  store ptr null, ptr @t, align 8, !tbaa !5
  %11 = load ptr, ptr @p, align 8, !tbaa !5
  tail call void @free(ptr noundef %11) #7
  store ptr null, ptr @p, align 8, !tbaa !5
  %12 = load ptr, ptr @q, align 8, !tbaa !5
  tail call void @free(ptr noundef %12) #7
  store ptr null, ptr @q, align 8, !tbaa !5
  %13 = load ptr, ptr @SwapStack, align 8, !tbaa !5
  tail call void @free(ptr noundef %13) #7
  store ptr null, ptr @SwapStack, align 8, !tbaa !5
  %14 = load ptr, ptr @tSaved, align 8, !tbaa !5
  tail call void @free(ptr noundef %14) #7
  store ptr null, ptr @tSaved, align 8, !tbaa !5
  %15 = load i32, ptr @Dimension, align 4, !tbaa !9
  tail call void @MakeHeap(i32 noundef %15) #7
  %16 = load i32, ptr @Dimension, align 4, !tbaa !9
  %17 = add nsw i32 %16, 1
  %18 = sext i32 %17 to i64
  %19 = tail call noalias ptr @calloc(i64 noundef %18, i64 noundef 4) #8
  store ptr %19, ptr @BestTour, align 8, !tbaa !5
  %.not = icmp eq ptr %19, null
  br i1 %.not, label %20, label %21

20:                                               ; preds = %0
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 33, ptr noundef nonnull @__PRETTY_FUNCTION__.AllocateStructures) #9
  unreachable

21:                                               ; preds = %0
  %22 = tail call noalias ptr @calloc(i64 noundef %18, i64 noundef 4) #8
  store ptr %22, ptr @BetterTour, align 8, !tbaa !5
  %.not24 = icmp eq ptr %22, null
  br i1 %.not24, label %23, label %24

23:                                               ; preds = %21
  tail call void @__assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 34, ptr noundef nonnull @__PRETTY_FUNCTION__.AllocateStructures) #9
  unreachable

24:                                               ; preds = %21
  %25 = tail call noalias dereferenceable_or_null(1048344) ptr @malloc(i64 noundef 1048344) #10
  store ptr %25, ptr @HTable, align 8, !tbaa !5
  %.not25 = icmp eq ptr %25, null
  br i1 %.not25, label %26, label %27

26:                                               ; preds = %24
  tail call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i32 noundef 35, ptr noundef nonnull @__PRETTY_FUNCTION__.AllocateStructures) #9
  unreachable

27:                                               ; preds = %24
  tail call void @HashInitialize(ptr noundef nonnull %25) #7
  %28 = load i32, ptr @Seed, align 4, !tbaa !9
  tail call void @SRandom(i32 noundef %28) #7
  %29 = load i32, ptr @Dimension, align 4, !tbaa !9
  %30 = add nsw i32 %29, 1
  %31 = sext i32 %30 to i64
  %32 = shl nsw i64 %31, 2
  %33 = tail call noalias ptr @malloc(i64 noundef %32) #10
  store ptr %33, ptr @Rand, align 8, !tbaa !5
  %.not26 = icmp eq ptr %33, null
  br i1 %.not26, label %34, label %.preheader40

.preheader40:                                     ; preds = %27
  %.not2741 = icmp slt i32 %29, 1
  br i1 %.not2741, label %._crit_edge, label %.lr.ph

34:                                               ; preds = %27
  tail call void @__assert_fail(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.1, i32 noundef 39, ptr noundef nonnull @__PRETTY_FUNCTION__.AllocateStructures) #9
  unreachable

.lr.ph:                                           ; preds = %.preheader40, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %.preheader40 ]
  %35 = tail call i32 @Random() #7
  %36 = load ptr, ptr @Rand, align 8, !tbaa !5
  %37 = getelementptr inbounds i32, ptr %36, i64 %indvars.iv
  store i32 %35, ptr %37, align 4, !tbaa !9
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %38 = load i32, ptr @Dimension, align 4, !tbaa !9
  %39 = sext i32 %38 to i64
  %.not27.not = icmp slt i64 %indvars.iv, %39
  br i1 %.not27.not, label %.lr.ph, label %._crit_edge, !llvm.loop !11

._crit_edge:                                      ; preds = %.lr.ph, %.preheader40
  %40 = load i32, ptr @Seed, align 4, !tbaa !9
  tail call void @SRandom(i32 noundef %40) #7
  %41 = load i32, ptr @WeightType, align 4, !tbaa !9
  %.not28 = icmp eq i32 %41, 0
  br i1 %.not28, label %57, label %.preheader

.preheader:                                       ; preds = %._crit_edge
  %42 = load i32, ptr @Dimension, align 4, !tbaa !9
  %43 = shl i32 %42, 1
  br label %44

44:                                               ; preds = %44, %.preheader
  %.1 = phi i32 [ %47, %44 ], [ 0, %.preheader ]
  %45 = shl nuw i32 1, %.1
  %46 = icmp slt i32 %45, %43
  %47 = add nuw nsw i32 %.1, 1
  br i1 %46, label %44, label %48, !llvm.loop !13

48:                                               ; preds = %44
  %49 = sext i32 %45 to i64
  %50 = tail call noalias ptr @calloc(i64 noundef %49, i64 noundef 4) #8
  store ptr %50, ptr @CacheSig, align 8, !tbaa !5
  %.not29 = icmp eq ptr %50, null
  br i1 %.not29, label %51, label %52

51:                                               ; preds = %48
  tail call void @__assert_fail(ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.1, i32 noundef 46, ptr noundef nonnull @__PRETTY_FUNCTION__.AllocateStructures) #9
  unreachable

52:                                               ; preds = %48
  %53 = tail call noalias ptr @calloc(i64 noundef %49, i64 noundef 4) #8
  store ptr %53, ptr @CacheVal, align 8, !tbaa !5
  %.not30 = icmp eq ptr %53, null
  br i1 %.not30, label %54, label %55

54:                                               ; preds = %52
  tail call void @__assert_fail(ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.1, i32 noundef 47, ptr noundef nonnull @__PRETTY_FUNCTION__.AllocateStructures) #9
  unreachable

55:                                               ; preds = %52
  %56 = add nsw i32 %45, -1
  store i32 %56, ptr @CacheMask, align 4, !tbaa !9
  br label %57

57:                                               ; preds = %55, %._crit_edge
  tail call void @AllocateSegments()
  %58 = load i32, ptr @MoveType, align 4, !tbaa !9
  %59 = load i32, ptr @SubsequentMoveType, align 4, !tbaa !9
  %spec.select = tail call i32 @llvm.smax.i32(i32 %59, i32 %58)
  %60 = shl nsw i32 %spec.select, 1
  %61 = or disjoint i32 %60, 1
  %62 = sext i32 %61 to i64
  %63 = shl nsw i64 %62, 3
  %64 = tail call noalias ptr @malloc(i64 noundef %63) #10
  store ptr %64, ptr @T, align 8, !tbaa !5
  %.not31 = icmp eq ptr %64, null
  br i1 %.not31, label %65, label %66

65:                                               ; preds = %57
  tail call void @__assert_fail(ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.1, i32 noundef 54, ptr noundef nonnull @__PRETTY_FUNCTION__.AllocateStructures) #9
  unreachable

66:                                               ; preds = %57
  %67 = sext i32 %60 to i64
  %68 = shl nsw i64 %67, 3
  %69 = tail call noalias ptr @malloc(i64 noundef %68) #10
  store ptr %69, ptr @G, align 8, !tbaa !5
  %.not32 = icmp eq ptr %69, null
  br i1 %.not32, label %70, label %71

70:                                               ; preds = %66
  tail call void @__assert_fail(ptr noundef nonnull @.str.8, ptr noundef nonnull @.str.1, i32 noundef 55, ptr noundef nonnull @__PRETTY_FUNCTION__.AllocateStructures) #9
  unreachable

71:                                               ; preds = %66
  %72 = mul nsw i32 %spec.select, 6
  %73 = sext i32 %72 to i64
  %74 = shl nsw i64 %73, 3
  %75 = tail call noalias ptr @malloc(i64 noundef %74) #10
  store ptr %75, ptr @t, align 8, !tbaa !5
  %.not33 = icmp eq ptr %75, null
  br i1 %.not33, label %76, label %77

76:                                               ; preds = %71
  tail call void @__assert_fail(ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.1, i32 noundef 56, ptr noundef nonnull @__PRETTY_FUNCTION__.AllocateStructures) #9
  unreachable

77:                                               ; preds = %71
  %78 = tail call noalias ptr @malloc(i64 noundef %63) #10
  store ptr %78, ptr @tSaved, align 8, !tbaa !5
  %.not34 = icmp eq ptr %78, null
  br i1 %.not34, label %79, label %80

79:                                               ; preds = %77
  tail call void @__assert_fail(ptr noundef nonnull @.str.10, ptr noundef nonnull @.str.1, i32 noundef 57, ptr noundef nonnull @__PRETTY_FUNCTION__.AllocateStructures) #9
  unreachable

80:                                               ; preds = %77
  %81 = shl nsw i64 %73, 2
  %82 = tail call noalias ptr @malloc(i64 noundef %81) #10
  store ptr %82, ptr @p, align 8, !tbaa !5
  %.not35 = icmp eq ptr %82, null
  br i1 %.not35, label %83, label %84

83:                                               ; preds = %80
  tail call void @__assert_fail(ptr noundef nonnull @.str.11, ptr noundef nonnull @.str.1, i32 noundef 58, ptr noundef nonnull @__PRETTY_FUNCTION__.AllocateStructures) #9
  unreachable

84:                                               ; preds = %80
  %85 = tail call noalias ptr @malloc(i64 noundef %81) #10
  store ptr %85, ptr @q, align 8, !tbaa !5
  %.not36 = icmp eq ptr %85, null
  br i1 %.not36, label %86, label %87

86:                                               ; preds = %84
  tail call void @__assert_fail(ptr noundef nonnull @.str.12, ptr noundef nonnull @.str.1, i32 noundef 59, ptr noundef nonnull @__PRETTY_FUNCTION__.AllocateStructures) #9
  unreachable

87:                                               ; preds = %84
  %88 = tail call noalias ptr @malloc(i64 noundef %81) #10
  store ptr %88, ptr @incl, align 8, !tbaa !5
  %.not37 = icmp eq ptr %88, null
  br i1 %.not37, label %89, label %90

89:                                               ; preds = %87
  tail call void @__assert_fail(ptr noundef nonnull @.str.13, ptr noundef nonnull @.str.1, i32 noundef 60, ptr noundef nonnull @__PRETTY_FUNCTION__.AllocateStructures) #9
  unreachable

90:                                               ; preds = %87
  %91 = tail call noalias ptr @malloc(i64 noundef %81) #10
  store ptr %91, ptr @cycle, align 8, !tbaa !5
  %.not38 = icmp eq ptr %91, null
  br i1 %.not38, label %92, label %93

92:                                               ; preds = %90
  tail call void @__assert_fail(ptr noundef nonnull @.str.14, ptr noundef nonnull @.str.1, i32 noundef 61, ptr noundef nonnull @__PRETTY_FUNCTION__.AllocateStructures) #9
  unreachable

93:                                               ; preds = %90
  %94 = load i32, ptr @MaxSwaps, align 4, !tbaa !9
  %95 = add nsw i32 %94, %72
  %96 = sext i32 %95 to i64
  %97 = shl nsw i64 %96, 5
  %98 = tail call noalias ptr @malloc(i64 noundef %97) #10
  store ptr %98, ptr @SwapStack, align 8, !tbaa !5
  %.not39 = icmp eq ptr %98, null
  br i1 %.not39, label %99, label %100

99:                                               ; preds = %93
  tail call void @__assert_fail(ptr noundef nonnull @.str.15, ptr noundef nonnull @.str.1, i32 noundef 63, ptr noundef nonnull @__PRETTY_FUNCTION__.AllocateStructures) #9
  unreachable

100:                                              ; preds = %93
  ret void
}

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

declare void @MakeHeap(i32 noundef) local_unnamed_addr #2

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

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

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

declare void @HashInitialize(ptr noundef) local_unnamed_addr #2

declare void @SRandom(i32 noundef) local_unnamed_addr #2

declare i32 @Random() local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local void @AllocateSegments() local_unnamed_addr #0

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #6

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress 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 #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 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) 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 #4 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
attributes #8 = { nounwind allocsize(0,1) }
attributes #9 = { noreturn nounwind }
attributes #10 = { nounwind allocsize(0) }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}


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