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

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

@CandidateFiles = external dso_local global i32, align 4
@CandidateFileName = external dso_local global ptr, align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1
@ProblemType = external dso_local global i32, align 4
@DimensionSaved = external dso_local global i32, align 4
@.str.1 = external hidden unnamed_addr constant [33 x i8], align 1
@TraceLevel = external dso_local global i32, align 4
@.str.2 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [75 x i8], align 1
@__PRETTY_FUNCTION__.ReadCandidates = external hidden unnamed_addr constant [24 x i8], align 1
@NodeSet = external dso_local global ptr, align 8
@.str.6 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [72 x i8], align 1
@D = external dso_local global ptr, align 8
@.str.10 = external hidden unnamed_addr constant [6 x i8], align 1

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

16:                                               ; preds = %1
  %17 = load i32, ptr @CandidateFiles, align 4, !tbaa !5
  %18 = icmp eq i32 %17, 1
  br i1 %18, label %19, label %26

19:                                               ; preds = %16
  %20 = load ptr, ptr @CandidateFileName, align 8, !tbaa !9
  %21 = getelementptr inbounds ptr, ptr %20, i64 0
  %22 = load ptr, ptr %21, align 8, !tbaa !9
  %23 = call noalias ptr @fopen(ptr noundef %22, ptr noundef @.str)
  store ptr %23, ptr %4, align 8, !tbaa !9
  %24 = icmp ne ptr %23, null
  br i1 %24, label %26, label %25

25:                                               ; preds = %19, %1
  store i32 0, ptr %2, align 4
  store i32 1, ptr %13, align 4
  br label %208

26:                                               ; preds = %19, %16
  %27 = load i32, ptr @ProblemType, align 4, !tbaa !5
  %28 = icmp ne i32 %27, 1
  br i1 %28, label %29, label %31

29:                                               ; preds = %26
  %30 = load i32, ptr @DimensionSaved, align 4, !tbaa !5
  br label %34

31:                                               ; preds = %26
  %32 = load i32, ptr @DimensionSaved, align 4, !tbaa !5
  %33 = mul nsw i32 2, %32
  br label %34

34:                                               ; preds = %31, %29
  %35 = phi i32 [ %30, %29 ], [ %33, %31 ]
  store i32 %35, ptr %7, align 4, !tbaa !5
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %36

36:                                               ; preds = %199, %34
  %37 = load i32, ptr %9, align 4, !tbaa !5
  %38 = load i32, ptr @CandidateFiles, align 4, !tbaa !5
  %39 = icmp slt i32 %37, %38
  br i1 %39, label %40, label %202

40:                                               ; preds = %36
  %41 = load i32, ptr @CandidateFiles, align 4, !tbaa !5
  %42 = icmp sge i32 %41, 2
  br i1 %42, label %43, label %57

43:                                               ; preds = %40
  %44 = load ptr, ptr @CandidateFileName, align 8, !tbaa !9
  %45 = load i32, ptr %9, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds ptr, ptr %44, i64 %46
  %48 = load ptr, ptr %47, align 8, !tbaa !9
  %49 = call noalias ptr @fopen(ptr noundef %48, ptr noundef @.str)
  store ptr %49, ptr %4, align 8, !tbaa !9
  %50 = icmp ne ptr %49, null
  br i1 %50, label %57, label %51

51:                                               ; preds = %43
  %52 = load ptr, ptr @CandidateFileName, align 8, !tbaa !9
  %53 = load i32, ptr %9, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds ptr, ptr %52, i64 %54
  %56 = load ptr, ptr %55, align 8, !tbaa !9
  call void (ptr, ...) @eprintf(ptr noundef @.str.1, ptr noundef %56)
  br label %57

57:                                               ; preds = %51, %43, %40
  %58 = load i32, ptr @TraceLevel, align 4, !tbaa !5
  %59 = icmp sge i32 %58, 1
  br i1 %59, label %60, label %66

60:                                               ; preds = %57
  %61 = load ptr, ptr @CandidateFileName, align 8, !tbaa !9
  %62 = load i32, ptr %9, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds ptr, ptr %61, i64 %63
  %65 = load ptr, ptr %64, align 8, !tbaa !9
  call void (ptr, ...) @printff(ptr noundef @.str.2, ptr noundef %65)
  br label %66

66:                                               ; preds = %60, %57
  %67 = load ptr, ptr %4, align 8, !tbaa !9
  %68 = call i32 @fscanint(ptr noundef %67, ptr noundef %8)
  %69 = load i32, ptr %8, align 4, !tbaa !5
  %70 = load i32, ptr %7, align 4, !tbaa !5
  %71 = icmp ne i32 %69, %70
  br i1 %71, label %72, label %78

72:                                               ; preds = %66
  %73 = load ptr, ptr @CandidateFileName, align 8, !tbaa !9
  %74 = load i32, ptr %9, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds ptr, ptr %73, i64 %75
  %77 = load ptr, ptr %76, align 8, !tbaa !9
  call void (ptr, ...) @eprintf(ptr noundef @.str.3, ptr noundef %77)
  br label %78

78:                                               ; preds = %72, %66
  br label %79

79:                                               ; preds = %191, %78
  %80 = load ptr, ptr %4, align 8, !tbaa !9
  %81 = call i32 @fscanint(ptr noundef %80, ptr noundef %10)
  %82 = icmp eq i32 %81, 1
  br i1 %82, label %83, label %86

83:                                               ; preds = %79
  %84 = load i32, ptr %10, align 4, !tbaa !5
  %85 = icmp ne i32 %84, -1
  br label %86

86:                                               ; preds = %83, %79
  %87 = phi i1 [ false, %79 ], [ %85, %83 ]
  br i1 %87, label %88, label %192

88:                                               ; preds = %86
  %89 = load i32, ptr %10, align 4, !tbaa !5
  %90 = icmp sge i32 %89, 1
  br i1 %90, label %91, label %96

91:                                               ; preds = %88
  %92 = load i32, ptr %10, align 4, !tbaa !5
  %93 = load i32, ptr %7, align 4, !tbaa !5
  %94 = icmp sle i32 %92, %93
  br i1 %94, label %95, label %96

95:                                               ; preds = %91
  br label %97

96:                                               ; preds = %91, %88
  call void @__assert_fail(ptr noundef @.str.4, ptr noundef @.str.5, i32 noundef 47, ptr noundef @__PRETTY_FUNCTION__.ReadCandidates) #6
  unreachable

97:                                               ; preds = %95
  %98 = load ptr, ptr @NodeSet, align 8, !tbaa !9
  %99 = load i32, ptr %10, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds %struct.Node, ptr %98, i64 %100
  store ptr %101, ptr %5, align 8, !tbaa !9
  %102 = load ptr, ptr %4, align 8, !tbaa !9
  %103 = call i32 @fscanint(ptr noundef %102, ptr noundef %10)
  %104 = load i32, ptr %10, align 4, !tbaa !5
  %105 = icmp sge i32 %104, 0
  br i1 %105, label %106, label %111

106:                                              ; preds = %97
  %107 = load i32, ptr %10, align 4, !tbaa !5
  %108 = load i32, ptr %7, align 4, !tbaa !5
  %109 = icmp sle i32 %107, %108
  br i1 %109, label %110, label %111

110:                                              ; preds = %106
  br label %112

111:                                              ; preds = %106, %97
  call void @__assert_fail(ptr noundef @.str.6, ptr noundef @.str.5, i32 noundef 50, ptr noundef @__PRETTY_FUNCTION__.ReadCandidates) #6
  unreachable

112:                                              ; preds = %110
  %113 = load i32, ptr %10, align 4, !tbaa !5
  %114 = icmp sgt i32 %113, 0
  br i1 %114, label %115, label %122

115:                                              ; preds = %112
  %116 = load ptr, ptr @NodeSet, align 8, !tbaa !9
  %117 = load i32, ptr %10, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds %struct.Node, ptr %116, i64 %118
  %120 = load ptr, ptr %5, align 8, !tbaa !9
  %121 = getelementptr inbounds %struct.Node, ptr %120, i32 0, i32 21
  store ptr %119, ptr %121, align 8, !tbaa !11
  br label %122

122:                                              ; preds = %115, %112
  %123 = load ptr, ptr %5, align 8, !tbaa !9
  %124 = load ptr, ptr %5, align 8, !tbaa !9
  %125 = getelementptr inbounds %struct.Node, ptr %124, i32 0, i32 21
  %126 = load ptr, ptr %125, align 8, !tbaa !11
  %127 = icmp ne ptr %123, %126
  br i1 %127, label %128, label %129

128:                                              ; preds = %122
  br label %130

129:                                              ; preds = %122
  call void @__assert_fail(ptr noundef @.str.7, ptr noundef @.str.5, i32 noundef 53, ptr noundef @__PRETTY_FUNCTION__.ReadCandidates) #6
  unreachable

130:                                              ; preds = %128
  %131 = load ptr, ptr %4, align 8, !tbaa !9
  %132 = call i32 @fscanint(ptr noundef %131, ptr noundef %12)
  %133 = load i32, ptr %12, align 4, !tbaa !5
  %134 = icmp sge i32 %133, 0
  br i1 %134, label %135, label %140

135:                                              ; preds = %130
  %136 = load i32, ptr %12, align 4, !tbaa !5
  %137 = load i32, ptr %7, align 4, !tbaa !5
  %138 = icmp slt i32 %136, %137
  br i1 %138, label %139, label %140

139:                                              ; preds = %135
  br label %141

140:                                              ; preds = %135, %130
  call void @__assert_fail(ptr noundef @.str.8, ptr noundef @.str.5, i32 noundef 55, ptr noundef @__PRETTY_FUNCTION__.ReadCandidates) #6
  unreachable

141:                                              ; preds = %139
  %142 = load ptr, ptr %5, align 8, !tbaa !9
  %143 = getelementptr inbounds %struct.Node, ptr %142, i32 0, i32 43
  %144 = load ptr, ptr %143, align 8, !tbaa !14
  %145 = icmp ne ptr %144, null
  br i1 %145, label %157, label %146

146:                                              ; preds = %141
  %147 = load i32, ptr %12, align 4, !tbaa !5
  %148 = add nsw i32 %147, 1
  %149 = sext i32 %148 to i64
  %150 = call noalias ptr @calloc(i64 noundef %149, i64 noundef 16) #7
  %151 = load ptr, ptr %5, align 8, !tbaa !9
  %152 = getelementptr inbounds %struct.Node, ptr %151, i32 0, i32 43
  store ptr %150, ptr %152, align 8, !tbaa !14
  %153 = icmp ne ptr %150, null
  br i1 %153, label %154, label %155

154:                                              ; preds = %146
  br label %156

155:                                              ; preds = %146
  call void @__assert_fail(ptr noundef @.str.9, ptr noundef @.str.5, i32 noundef 58, ptr noundef @__PRETTY_FUNCTION__.ReadCandidates) #6
  unreachable

156:                                              ; preds = %154
  br label %157

157:                                              ; preds = %156, %141
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %158

158:                                              ; preds = %188, %157
  %159 = load i32, ptr %8, align 4, !tbaa !5
  %160 = load i32, ptr %12, align 4, !tbaa !5
  %161 = icmp slt i32 %159, %160
  br i1 %161, label %162, label %191

162:                                              ; preds = %158
  %163 = load ptr, ptr %4, align 8, !tbaa !9
  %164 = call i32 @fscanint(ptr noundef %163, ptr noundef %10)
  %165 = load i32, ptr %10, align 4, !tbaa !5
  %166 = icmp sge i32 %165, 1
  br i1 %166, label %167, label %172

167:                                              ; preds = %162
  %168 = load i32, ptr %10, align 4, !tbaa !5
  %169 = load i32, ptr %7, align 4, !tbaa !5
  %170 = icmp sle i32 %168, %169
  br i1 %170, label %171, label %172

171:                                              ; preds = %167
  br label %173

172:                                              ; preds = %167, %162
  call void @__assert_fail(ptr noundef @.str.4, ptr noundef @.str.5, i32 noundef 61, ptr noundef @__PRETTY_FUNCTION__.ReadCandidates) #6
  unreachable

173:                                              ; preds = %171
  %174 = load ptr, ptr @NodeSet, align 8, !tbaa !9
  %175 = load i32, ptr %10, align 4, !tbaa !5
  %176 = sext i32 %175 to i64
  %177 = getelementptr inbounds %struct.Node, ptr %174, i64 %176
  store ptr %177, ptr %6, align 8, !tbaa !9
  %178 = load ptr, ptr %4, align 8, !tbaa !9
  %179 = call i32 @fscanint(ptr noundef %178, ptr noundef %11)
  %180 = load ptr, ptr %5, align 8, !tbaa !9
  %181 = load ptr, ptr %6, align 8, !tbaa !9
  %182 = load ptr, ptr @D, align 8, !tbaa !9
  %183 = load ptr, ptr %5, align 8, !tbaa !9
  %184 = load ptr, ptr %6, align 8, !tbaa !9
  %185 = call i32 %182(ptr noundef %183, ptr noundef %184)
  %186 = load i32, ptr %11, align 4, !tbaa !5
  %187 = call i32 @AddCandidate(ptr noundef %180, ptr noundef %181, i32 noundef %185, i32 noundef %186)
  br label %188

188:                                              ; preds = %173
  %189 = load i32, ptr %8, align 4, !tbaa !5
  %190 = add nsw i32 %189, 1
  store i32 %190, ptr %8, align 4, !tbaa !5
  br label %158, !llvm.loop !15

191:                                              ; preds = %158
  br label %79, !llvm.loop !17

192:                                              ; preds = %86
  %193 = load ptr, ptr %4, align 8, !tbaa !9
  %194 = call i32 @fclose(ptr noundef %193)
  %195 = load i32, ptr @TraceLevel, align 4, !tbaa !5
  %196 = icmp sge i32 %195, 1
  br i1 %196, label %197, label %198

197:                                              ; preds = %192
  call void (ptr, ...) @printff(ptr noundef @.str.10)
  br label %198

198:                                              ; preds = %197, %192
  br label %199

199:                                              ; preds = %198
  %200 = load i32, ptr %9, align 4, !tbaa !5
  %201 = add nsw i32 %200, 1
  store i32 %201, ptr %9, align 4, !tbaa !5
  br label %36, !llvm.loop !18

202:                                              ; preds = %36
  call void @ResetCandidateSet()
  %203 = load i32, ptr %3, align 4, !tbaa !5
  %204 = icmp sgt i32 %203, 0
  br i1 %204, label %205, label %207

205:                                              ; preds = %202
  %206 = load i32, ptr %3, align 4, !tbaa !5
  call void @TrimCandidateSet(i32 noundef %206)
  br label %207

207:                                              ; preds = %205, %202
  store i32 1, ptr %2, align 4
  store i32 1, ptr %13, align 4
  br label %208

208:                                              ; preds = %207, %25
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  %209 = load i32, ptr %2, align 4
  ret i32 %209
}

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

declare noalias ptr @fopen(ptr noundef, ptr noundef) #2

declare void @eprintf(ptr noundef, ...) #2

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

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

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

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

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

declare i32 @fclose(ptr noundef) #2

declare void @ResetCandidateSet() #2

declare void @TrimCandidateSet(i32 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 = { 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 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 = { nounwind }
attributes #6 = { noreturn nounwind }
attributes #7 = { nounwind allocsize(0,1) }

!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 112}
!12 = !{!"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, !13, i64 312, !13, i64 320, !13, i64 328, !13, i64 336, !13, i64 344, !13, i64 352, !7, i64 360, !7, i64 361, !7, i64 362}
!13 = !{!"double", !7, i64 0}
!14 = !{!12, !10, i64 288}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !16}


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

@CandidateFiles = external dso_local local_unnamed_addr global i32, align 4
@CandidateFileName = external dso_local local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1
@ProblemType = external dso_local local_unnamed_addr global i32, align 4
@DimensionSaved = external dso_local local_unnamed_addr global i32, align 4
@.str.1 = external hidden unnamed_addr constant [33 x i8], align 1
@TraceLevel = external dso_local local_unnamed_addr global i32, align 4
@.str.2 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [75 x i8], align 1
@__PRETTY_FUNCTION__.ReadCandidates = external hidden unnamed_addr constant [24 x i8], align 1
@NodeSet = external dso_local local_unnamed_addr global ptr, align 8
@.str.6 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [72 x i8], align 1
@D = external dso_local local_unnamed_addr global ptr, align 8
@.str.10 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @ReadCandidates(i32 noundef %0) local_unnamed_addr #0 {
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  %6 = load i32, ptr @CandidateFiles, align 4, !tbaa !5
  switch i32 %6, label %11 [
    i32 0, label %116
    i32 1, label %7
  ]

7:                                                ; preds = %1
  %8 = load ptr, ptr @CandidateFileName, align 8, !tbaa !9
  %9 = load ptr, ptr %8, align 8, !tbaa !9
  %10 = tail call noalias ptr @fopen(ptr noundef %9, ptr noundef nonnull @.str)
  %.not = icmp eq ptr %10, null
  br i1 %.not, label %116, label %._crit_edge63

._crit_edge63:                                    ; preds = %7
  %.pre = load i32, ptr @CandidateFiles, align 4, !tbaa !5
  br label %11

11:                                               ; preds = %._crit_edge63, %1
  %12 = phi i32 [ %.pre, %._crit_edge63 ], [ %6, %1 ]
  %.030 = phi ptr [ %10, %._crit_edge63 ], [ null, %1 ]
  %13 = load i32, ptr @ProblemType, align 4, !tbaa !5
  %.not43 = icmp eq i32 %13, 1
  %14 = load i32, ptr @DimensionSaved, align 4
  %15 = zext i1 %.not43 to i32
  %16 = shl nsw i32 %14, %15
  %17 = icmp sgt i32 %12, 0
  br i1 %17, label %.lr.ph60, label %._crit_edge61

.lr.ph60:                                         ; preds = %11, %110
  %indvars.iv = phi i64 [ %indvars.iv.next, %110 ], [ 0, %11 ]
  %18 = phi i32 [ %111, %110 ], [ %12, %11 ]
  %.157 = phi ptr [ %.2, %110 ], [ %.030, %11 ]
  %19 = icmp sgt i32 %18, 1
  br i1 %19, label %20, label %29

20:                                               ; preds = %.lr.ph60
  %21 = load ptr, ptr @CandidateFileName, align 8, !tbaa !9
  %22 = getelementptr inbounds ptr, ptr %21, i64 %indvars.iv
  %23 = load ptr, ptr %22, align 8, !tbaa !9
  %24 = call noalias ptr @fopen(ptr noundef %23, ptr noundef nonnull @.str)
  %.not44 = icmp eq ptr %24, null
  br i1 %.not44, label %25, label %29

25:                                               ; preds = %20
  %26 = load ptr, ptr @CandidateFileName, align 8, !tbaa !9
  %27 = getelementptr inbounds ptr, ptr %26, i64 %indvars.iv
  %28 = load ptr, ptr %27, align 8, !tbaa !9
  call void (ptr, ...) @eprintf(ptr noundef nonnull @.str.1, ptr noundef %28) #6
  br label %29

29:                                               ; preds = %25, %20, %.lr.ph60
  %.2 = phi ptr [ %24, %20 ], [ null, %25 ], [ %.157, %.lr.ph60 ]
  %30 = load i32, ptr @TraceLevel, align 4, !tbaa !5
  %31 = icmp sgt i32 %30, 0
  br i1 %31, label %32, label %36

32:                                               ; preds = %29
  %33 = load ptr, ptr @CandidateFileName, align 8, !tbaa !9
  %34 = getelementptr inbounds ptr, ptr %33, i64 %indvars.iv
  %35 = load ptr, ptr %34, align 8, !tbaa !9
  call void (ptr, ...) @printff(ptr noundef nonnull @.str.2, ptr noundef %35) #6
  br label %36

36:                                               ; preds = %32, %29
  %37 = call i32 @fscanint(ptr noundef %.2, ptr noundef nonnull %2) #6
  %38 = load i32, ptr %2, align 4, !tbaa !5
  %.not45 = icmp eq i32 %38, %16
  br i1 %.not45, label %43, label %39

39:                                               ; preds = %36
  %40 = load ptr, ptr @CandidateFileName, align 8, !tbaa !9
  %41 = getelementptr inbounds ptr, ptr %40, i64 %indvars.iv
  %42 = load ptr, ptr %41, align 8, !tbaa !9
  call void (ptr, ...) @eprintf(ptr noundef nonnull @.str.3, ptr noundef %42) #6
  br label %43

43:                                               ; preds = %39, %36
  %44 = call i32 @fscanint(ptr noundef %.2, ptr noundef nonnull %3) #6
  %45 = icmp eq i32 %44, 1
  %46 = load i32, ptr %3, align 4
  %47 = icmp ne i32 %46, -1
  %48 = select i1 %45, i1 %47, i1 false
  br i1 %48, label %.lr.ph56, label %._crit_edge

.loopexit:                                        ; preds = %93, %88
  %49 = call i32 @fscanint(ptr noundef %.2, ptr noundef nonnull %3) #6
  %50 = icmp eq i32 %49, 1
  %51 = load i32, ptr %3, align 4
  %52 = icmp ne i32 %51, -1
  %53 = select i1 %50, i1 %52, i1 false
  br i1 %53, label %.lr.ph56, label %._crit_edge, !llvm.loop !11

.lr.ph56:                                         ; preds = %43, %.loopexit
  %54 = phi i32 [ %51, %.loopexit ], [ %46, %43 ]
  %55 = icmp slt i32 %54, 1
  %.not46 = icmp sgt i32 %54, %16
  %or.cond = select i1 %55, i1 true, i1 %.not46
  br i1 %or.cond, label %56, label %57

56:                                               ; preds = %.lr.ph56
  call void @__assert_fail(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.5, i32 noundef 47, ptr noundef nonnull @__PRETTY_FUNCTION__.ReadCandidates) #7
  unreachable

57:                                               ; preds = %.lr.ph56
  %58 = load ptr, ptr @NodeSet, align 8, !tbaa !9
  %59 = zext nneg i32 %54 to i64
  %60 = getelementptr inbounds %struct.Node, ptr %58, i64 %59
  %61 = call i32 @fscanint(ptr noundef %.2, ptr noundef nonnull %3) #6
  %62 = load i32, ptr %3, align 4, !tbaa !5
  %63 = icmp slt i32 %62, 0
  %.not47 = icmp sgt i32 %62, %16
  %or.cond53 = select i1 %63, i1 true, i1 %.not47
  br i1 %or.cond53, label %64, label %65

64:                                               ; preds = %57
  call void @__assert_fail(ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.5, i32 noundef 50, ptr noundef nonnull @__PRETTY_FUNCTION__.ReadCandidates) #7
  unreachable

65:                                               ; preds = %57
  %.not48 = icmp eq i32 %62, 0
  br i1 %.not48, label %._crit_edge64, label %66

._crit_edge64:                                    ; preds = %65
  %.phi.trans.insert = getelementptr inbounds i8, ptr %60, i64 112
  %.pre65 = load ptr, ptr %.phi.trans.insert, align 8, !tbaa !13
  br label %71

66:                                               ; preds = %65
  %67 = load ptr, ptr @NodeSet, align 8, !tbaa !9
  %68 = zext nneg i32 %62 to i64
  %69 = getelementptr inbounds %struct.Node, ptr %67, i64 %68
  %70 = getelementptr inbounds i8, ptr %60, i64 112
  store ptr %69, ptr %70, align 8, !tbaa !13
  br label %71

71:                                               ; preds = %._crit_edge64, %66
  %72 = phi ptr [ %.pre65, %._crit_edge64 ], [ %69, %66 ]
  %.not49 = icmp eq ptr %60, %72
  br i1 %.not49, label %73, label %74

73:                                               ; preds = %71
  call void @__assert_fail(ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.5, i32 noundef 53, ptr noundef nonnull @__PRETTY_FUNCTION__.ReadCandidates) #7
  unreachable

74:                                               ; preds = %71
  %75 = call i32 @fscanint(ptr noundef %.2, ptr noundef nonnull %5) #6
  %76 = load i32, ptr %5, align 4, !tbaa !5
  %77 = icmp sgt i32 %76, -1
  %78 = icmp slt i32 %76, %16
  %or.cond54 = select i1 %77, i1 %78, i1 false
  br i1 %or.cond54, label %80, label %79

79:                                               ; preds = %74
  call void @__assert_fail(ptr noundef nonnull @.str.8, ptr noundef nonnull @.str.5, i32 noundef 55, ptr noundef nonnull @__PRETTY_FUNCTION__.ReadCandidates) #7
  unreachable

80:                                               ; preds = %74
  %81 = getelementptr inbounds i8, ptr %60, i64 288
  %82 = load ptr, ptr %81, align 8, !tbaa !16
  %.not50 = icmp eq ptr %82, null
  br i1 %.not50, label %83, label %88

83:                                               ; preds = %80
  %84 = add nuw nsw i32 %76, 1
  %85 = zext nneg i32 %84 to i64
  %86 = call noalias ptr @calloc(i64 noundef %85, i64 noundef 16) #8
  store ptr %86, ptr %81, align 8, !tbaa !16
  %.not51 = icmp eq ptr %86, null
  br i1 %.not51, label %87, label %88

87:                                               ; preds = %83
  call void @__assert_fail(ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.5, i32 noundef 58, ptr noundef nonnull @__PRETTY_FUNCTION__.ReadCandidates) #7
  unreachable

88:                                               ; preds = %83, %80
  store i32 0, ptr %2, align 4, !tbaa !5
  %.not66 = icmp eq i32 %76, 0
  br i1 %.not66, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %88, %93
  %89 = call i32 @fscanint(ptr noundef %.2, ptr noundef nonnull %3) #6
  %90 = load i32, ptr %3, align 4, !tbaa !5
  %91 = icmp slt i32 %90, 1
  %.not52 = icmp sgt i32 %90, %16
  %or.cond55 = select i1 %91, i1 true, i1 %.not52
  br i1 %or.cond55, label %92, label %93

92:                                               ; preds = %.lr.ph
  call void @__assert_fail(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.5, i32 noundef 61, ptr noundef nonnull @__PRETTY_FUNCTION__.ReadCandidates) #7
  unreachable

93:                                               ; preds = %.lr.ph
  %94 = load ptr, ptr @NodeSet, align 8, !tbaa !9
  %95 = zext nneg i32 %90 to i64
  %96 = getelementptr inbounds %struct.Node, ptr %94, i64 %95
  %97 = call i32 @fscanint(ptr noundef %.2, ptr noundef nonnull %4) #6
  %98 = load ptr, ptr @D, align 8, !tbaa !9
  %99 = call i32 %98(ptr noundef nonnull %60, ptr noundef nonnull %96) #6
  %100 = load i32, ptr %4, align 4, !tbaa !5
  %101 = call i32 @AddCandidate(ptr noundef nonnull %60, ptr noundef nonnull %96, i32 noundef %99, i32 noundef %100) #6
  %102 = load i32, ptr %2, align 4, !tbaa !5
  %103 = add nsw i32 %102, 1
  store i32 %103, ptr %2, align 4, !tbaa !5
  %104 = load i32, ptr %5, align 4, !tbaa !5
  %105 = icmp slt i32 %103, %104
  br i1 %105, label %.lr.ph, label %.loopexit, !llvm.loop !17

._crit_edge:                                      ; preds = %.loopexit, %43
  %106 = call i32 @fclose(ptr noundef %.2)
  %107 = load i32, ptr @TraceLevel, align 4, !tbaa !5
  %108 = icmp sgt i32 %107, 0
  br i1 %108, label %109, label %110

109:                                              ; preds = %._crit_edge
  call void (ptr, ...) @printff(ptr noundef nonnull @.str.10) #6
  br label %110

110:                                              ; preds = %._crit_edge, %109
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %111 = load i32, ptr @CandidateFiles, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = icmp slt i64 %indvars.iv.next, %112
  br i1 %113, label %.lr.ph60, label %._crit_edge61, !llvm.loop !18

._crit_edge61:                                    ; preds = %110, %11
  call void @ResetCandidateSet() #6
  %114 = icmp sgt i32 %0, 0
  br i1 %114, label %115, label %116

115:                                              ; preds = %._crit_edge61
  call void @TrimCandidateSet(i32 noundef %0) #6
  br label %116

116:                                              ; preds = %._crit_edge61, %115, %7, %1
  %.029 = phi i32 [ %6, %1 ], [ 0, %7 ], [ 1, %115 ], [ 1, %._crit_edge61 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  ret i32 %.029
}

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

; Function Attrs: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #2

declare void @eprintf(ptr noundef, ...) local_unnamed_addr #3

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

declare i32 @fscanint(ptr noundef, ptr 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,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #5

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

; Function Attrs: nofree nounwind
declare noundef i32 @fclose(ptr nocapture noundef) local_unnamed_addr #2

declare void @ResetCandidateSet() local_unnamed_addr #3

declare void @TrimCandidateSet(i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree 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 = { 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,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 #6 = { nounwind }
attributes #7 = { noreturn nounwind }
attributes #8 = { nounwind allocsize(0,1) }

!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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !10, i64 112}
!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 = !{!14, !10, i64 288}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}


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