; LLVM IR from alexzheng42/sDMD :: src (CG)

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

@datadir = external global [1024 x i8], align 16
@.str.7 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [31 x i8], align 1
@potentialPairCG = external global [33 x [33 x %struct.ConstraintStr]], align 16
@.str.35 = external hidden unnamed_addr constant [65 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [9 x i8], align 1

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

; 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 i32 @sprintf(ptr noundef, ptr noundef, ...) #2

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

declare i32 @printf(ptr noundef, ...) #3

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #4

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

declare ptr @fgets(ptr noundef, i32 noundef, ptr noundef) #3

; Function Attrs: nounwind
declare i32 @__isoc99_sscanf(ptr noundef, ptr noundef, ...) #2

declare i32 @AAModel(ptr noundef) #3

declare i32 @fclose(ptr noundef) #3

; Function Attrs: nounwind uwtable
define dso_local void @ReadCGPotTable() #5 {
  %1 = alloca [2 x i32], align 4
  %2 = alloca [2 x [10 x i8]], align 16
  %3 = alloca [1024 x i8], align 16
  %4 = alloca [2 x double], align 16
  %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 ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #8
  call void @llvm.memset.p0.i64(ptr align 4 %1, i8 0, i64 8, i1 false)
  call void @llvm.lifetime.start.p0(i64 20, ptr %2) #8
  call void @llvm.lifetime.start.p0(i64 1024, ptr %3) #8
  call void @llvm.lifetime.start.p0(i64 16, ptr %4) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #8
  store ptr null, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #8
  %11 = getelementptr inbounds [1024 x i8], ptr %3, i64 0, i64 0
  %12 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %11, ptr noundef @.str.19, ptr noundef @datadir) #8
  %13 = getelementptr inbounds [1024 x i8], ptr %3, i64 0, i64 0
  %14 = call noalias ptr @fopen(ptr noundef %13, ptr noundef @.str.7)
  store ptr %14, ptr %6, align 8, !tbaa !5
  %15 = load ptr, ptr %6, align 8, !tbaa !5
  %16 = icmp eq ptr %15, null
  br i1 %16, label %17, label %20

17:                                               ; preds = %0
  %18 = call i32 (ptr, ...) @printf(ptr noundef @.str.35, ptr noundef @datadir)
  %19 = call i32 (ptr, ...) @printf(ptr noundef @.str.9)
  call void @exit(i32 noundef 1) #9
  unreachable

20:                                               ; preds = %0
  br label %21

21:                                               ; preds = %141, %31, %20
  %22 = getelementptr inbounds [1024 x i8], ptr %3, i64 0, i64 0
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  %24 = call ptr @fgets(ptr noundef %22, i32 noundef 1024, ptr noundef %23)
  %25 = icmp ne ptr %24, null
  br i1 %25, label %26, label %168

26:                                               ; preds = %21
  %27 = getelementptr inbounds [1024 x i8], ptr %3, i64 0, i64 0
  %28 = load i8, ptr %27, align 16, !tbaa !9
  %29 = sext i8 %28 to i32
  %30 = icmp eq i32 %29, 35
  br i1 %30, label %31, label %32

31:                                               ; preds = %26
  br label %21, !llvm.loop !10

32:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  store i32 0, ptr %8, align 4, !tbaa !12
  %33 = getelementptr inbounds [1024 x i8], ptr %3, i64 0, i64 0
  %34 = getelementptr inbounds [2 x [10 x i8]], ptr %2, i64 0, i64 0
  %35 = getelementptr inbounds [10 x i8], ptr %34, i64 0, i64 0
  %36 = getelementptr inbounds [2 x [10 x i8]], ptr %2, i64 0, i64 1
  %37 = getelementptr inbounds [10 x i8], ptr %36, i64 0, i64 0
  %38 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef %33, ptr noundef @.str.36, ptr noundef %35, ptr noundef %37, ptr noundef %7) #8
  %39 = load i32, ptr %7, align 4, !tbaa !12
  %40 = load i32, ptr %8, align 4, !tbaa !12
  %41 = add nsw i32 %40, %39
  store i32 %41, ptr %8, align 4, !tbaa !12
  %42 = getelementptr inbounds [2 x [10 x i8]], ptr %2, i64 0, i64 0
  %43 = getelementptr inbounds [10 x i8], ptr %42, i64 0, i64 0
  %44 = call i32 @AAModel(ptr noundef %43)
  %45 = getelementptr inbounds [2 x i32], ptr %1, i64 0, i64 0
  store i32 %44, ptr %45, align 4, !tbaa !12
  %46 = getelementptr inbounds [2 x [10 x i8]], ptr %2, i64 0, i64 1
  %47 = getelementptr inbounds [10 x i8], ptr %46, i64 0, i64 0
  %48 = call i32 @AAModel(ptr noundef %47)
  %49 = getelementptr inbounds [2 x i32], ptr %1, i64 0, i64 1
  store i32 %48, ptr %49, align 4, !tbaa !12
  %50 = getelementptr inbounds [1024 x i8], ptr %3, i64 0, i64 0
  %51 = load i32, ptr %8, align 4, !tbaa !12
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds i8, ptr %50, i64 %52
  %54 = getelementptr inbounds [2 x i32], ptr %1, i64 0, i64 0
  %55 = load i32, ptr %54, align 4, !tbaa !12
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [33 x [33 x %struct.ConstraintStr]], ptr @potentialPairCG, i64 0, i64 %56
  %58 = getelementptr inbounds [2 x i32], ptr %1, i64 0, i64 1
  %59 = load i32, ptr %58, align 4, !tbaa !12
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [33 x %struct.ConstraintStr], ptr %57, i64 0, i64 %60
  %62 = getelementptr inbounds %struct.ConstraintStr, ptr %61, i32 0, i32 1
  %63 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef %53, ptr noundef @.str.37, ptr noundef %62, ptr noundef %7) #8
  %64 = load i32, ptr %7, align 4, !tbaa !12
  %65 = load i32, ptr %8, align 4, !tbaa !12
  %66 = add nsw i32 %65, %64
  store i32 %66, ptr %8, align 4, !tbaa !12
  %67 = getelementptr inbounds [2 x i32], ptr %1, i64 0, i64 0
  %68 = load i32, ptr %67, align 4, !tbaa !12
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [33 x [33 x %struct.ConstraintStr]], ptr @potentialPairCG, i64 0, i64 %69
  %71 = getelementptr inbounds [2 x i32], ptr %1, i64 0, i64 1
  %72 = load i32, ptr %71, align 4, !tbaa !12
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [33 x %struct.ConstraintStr], ptr %70, i64 0, i64 %73
  %75 = getelementptr inbounds %struct.ConstraintStr, ptr %74, i32 0, i32 1
  %76 = load double, ptr %75, align 8, !tbaa !14
  %77 = getelementptr inbounds [2 x i32], ptr %1, i64 0, i64 0
  %78 = load i32, ptr %77, align 4, !tbaa !12
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [33 x [33 x %struct.ConstraintStr]], ptr @potentialPairCG, i64 0, i64 %79
  %81 = getelementptr inbounds [2 x i32], ptr %1, i64 0, i64 1
  %82 = load i32, ptr %81, align 4, !tbaa !12
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [33 x %struct.ConstraintStr], ptr %80, i64 0, i64 %83
  %85 = getelementptr inbounds %struct.ConstraintStr, ptr %84, i32 0, i32 1
  %86 = load double, ptr %85, align 8, !tbaa !14
  %87 = fmul double %86, %76
  store double %87, ptr %85, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  store i32 1, ptr %9, align 4, !tbaa !12
  br label %88

88:                                               ; preds = %140, %32
  %89 = getelementptr inbounds [1024 x i8], ptr %3, i64 0, i64 0
  %90 = load i32, ptr %8, align 4, !tbaa !12
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds i8, ptr %89, i64 %91
  %93 = getelementptr inbounds [2 x double], ptr %4, i64 0, i64 0
  %94 = getelementptr inbounds [2 x double], ptr %4, i64 0, i64 1
  %95 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef %92, ptr noundef @.str.38, ptr noundef %93, ptr noundef %94, ptr noundef %7) #8
  %96 = icmp ne i32 %95, -1
  br i1 %96, label %97, label %141

97:                                               ; preds = %88
  %98 = load i32, ptr %7, align 4, !tbaa !12
  %99 = load i32, ptr %8, align 4, !tbaa !12
  %100 = add nsw i32 %99, %98
  store i32 %100, ptr %8, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #8
  %101 = call noalias ptr @calloc(i64 noundef 1, i64 noundef 32) #10
  store ptr %101, ptr %10, align 8, !tbaa !5
  %102 = getelementptr inbounds [2 x double], ptr %4, i64 0, i64 0
  %103 = load double, ptr %102, align 16, !tbaa !17
  %104 = load ptr, ptr %10, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.StepPotenStr, ptr %104, i32 0, i32 0
  store double %103, ptr %105, align 8, !tbaa !18
  %106 = load ptr, ptr %10, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.StepPotenStr, ptr %106, i32 0, i32 0
  %108 = load double, ptr %107, align 8, !tbaa !18
  %109 = load ptr, ptr %10, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.StepPotenStr, ptr %109, i32 0, i32 0
  %111 = load double, ptr %110, align 8, !tbaa !18
  %112 = fmul double %111, %108
  store double %112, ptr %110, align 8, !tbaa !18
  %113 = getelementptr inbounds [2 x double], ptr %4, i64 0, i64 1
  %114 = load double, ptr %113, align 8, !tbaa !17
  %115 = load ptr, ptr %10, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.StepPotenStr, ptr %115, i32 0, i32 1
  store double %114, ptr %116, align 8, !tbaa !20
  %117 = load i32, ptr %9, align 4, !tbaa !12
  %118 = icmp eq i32 %117, 1
  br i1 %118, label %119, label %133

119:                                              ; preds = %97
  %120 = load ptr, ptr %10, align 8, !tbaa !5
  %121 = getelementptr inbounds [2 x i32], ptr %1, i64 0, i64 0
  %122 = load i32, ptr %121, align 4, !tbaa !12
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [33 x [33 x %struct.ConstraintStr]], ptr @potentialPairCG, i64 0, i64 %123
  %125 = getelementptr inbounds [2 x i32], ptr %1, i64 0, i64 1
  %126 = load i32, ptr %125, align 4, !tbaa !12
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [33 x %struct.ConstraintStr], ptr %124, i64 0, i64 %127
  %129 = getelementptr inbounds %struct.ConstraintStr, ptr %128, i32 0, i32 2
  store ptr %120, ptr %129, align 8, !tbaa !21
  %130 = load ptr, ptr %10, align 8, !tbaa !5
  store ptr %130, ptr %5, align 8, !tbaa !5
  %131 = load i32, ptr %9, align 4, !tbaa !12
  %132 = add nsw i32 %131, 1
  store i32 %132, ptr %9, align 4, !tbaa !12
  br label %140

133:                                              ; preds = %97
  %134 = load ptr, ptr %10, align 8, !tbaa !5
  %135 = load ptr, ptr %5, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.StepPotenStr, ptr %135, i32 0, i32 3
  store ptr %134, ptr %136, align 8, !tbaa !22
  %137 = load ptr, ptr %5, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.StepPotenStr, ptr %137, i32 0, i32 3
  %139 = load ptr, ptr %138, align 8, !tbaa !22
  store ptr %139, ptr %5, align 8, !tbaa !5
  br label %140

140:                                              ; preds = %133, %119
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  br label %88, !llvm.loop !23

141:                                              ; preds = %88
  %142 = getelementptr inbounds [2 x i32], ptr %1, i64 0, i64 0
  %143 = load i32, ptr %142, align 4, !tbaa !12
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds [33 x [33 x %struct.ConstraintStr]], ptr @potentialPairCG, i64 0, i64 %144
  %146 = getelementptr inbounds [2 x i32], ptr %1, i64 0, i64 1
  %147 = load i32, ptr %146, align 4, !tbaa !12
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [33 x %struct.ConstraintStr], ptr %145, i64 0, i64 %148
  %150 = getelementptr inbounds %struct.ConstraintStr, ptr %149, i32 0, i32 2
  %151 = load ptr, ptr %150, align 8, !tbaa !21
  call void @CalAccumulatedPoten(ptr noundef %151)
  %152 = getelementptr inbounds [2 x i32], ptr %1, i64 0, i64 1
  %153 = load i32, ptr %152, align 4, !tbaa !12
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds [33 x [33 x %struct.ConstraintStr]], ptr @potentialPairCG, i64 0, i64 %154
  %156 = getelementptr inbounds [2 x i32], ptr %1, i64 0, i64 0
  %157 = load i32, ptr %156, align 4, !tbaa !12
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds [33 x %struct.ConstraintStr], ptr %155, i64 0, i64 %158
  %160 = getelementptr inbounds [2 x i32], ptr %1, i64 0, i64 0
  %161 = load i32, ptr %160, align 4, !tbaa !12
  %162 = sext i32 %161 to i64
  %163 = getelementptr inbounds [33 x [33 x %struct.ConstraintStr]], ptr @potentialPairCG, i64 0, i64 %162
  %164 = getelementptr inbounds [2 x i32], ptr %1, i64 0, i64 1
  %165 = load i32, ptr %164, align 4, !tbaa !12
  %166 = sext i32 %165 to i64
  %167 = getelementptr inbounds [33 x %struct.ConstraintStr], ptr %163, i64 0, i64 %166
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %159, ptr align 8 %167, i64 40, i1 false), !tbaa.struct !24
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #8
  br label %21, !llvm.loop !10

168:                                              ; preds = %21
  %169 = load ptr, ptr %6, align 8, !tbaa !5
  %170 = call i32 @fclose(ptr noundef %169)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %4) #8
  call void @llvm.lifetime.end.p0(i64 1024, ptr %3) #8
  call void @llvm.lifetime.end.p0(i64 20, ptr %2) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #8
  ret void
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #7

declare void @CalAccumulatedPoten(ptr noundef) #3

attributes #0 = { 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 #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 = { 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 = { 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 #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #8 = { nounwind }
attributes #9 = { noreturn nounwind }
attributes #10 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !16, i64 8}
!15 = !{!"ConstraintStr", !13, i64 0, !16, i64 8, !6, i64 16, !16, i64 24, !6, i64 32}
!16 = !{!"double", !7, i64 0}
!17 = !{!16, !16, i64 0}
!18 = !{!19, !16, i64 0}
!19 = !{!"StepPotenStr", !16, i64 0, !16, i64 8, !16, i64 16, !6, i64 24}
!20 = !{!19, !16, i64 8}
!21 = !{!15, !6, i64 16}
!22 = !{!19, !6, i64 24}
!23 = distinct !{!23, !11}
!24 = !{i64 0, i64 4, !12, i64 8, i64 8, !17, i64 16, i64 8, !5, i64 24, i64 8, !17, i64 32, i64 8, !5}


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

@datadir = external global [1024 x i8], align 16
@.str.7 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [31 x i8], align 1
@potentialPairCG = external global [33 x [33 x %struct.ConstraintStr]], align 16
@.str.35 = external hidden unnamed_addr constant [65 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [9 x i8], align 1

; 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 #0

; 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 noundef i32 @sprintf(ptr noalias nocapture noundef writeonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #2

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

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #3

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

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

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_sscanf(ptr nocapture noundef readonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #2

declare i32 @AAModel(ptr noundef) local_unnamed_addr #4

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

; Function Attrs: nounwind uwtable
define dso_local void @ReadCGPotTable() local_unnamed_addr #5 {
  %1 = alloca [2 x [10 x i8]], align 16
  %2 = alloca [1024 x i8], align 16
  %3 = alloca [2 x double], align 16
  %4 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %2) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #7
  %5 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %2, ptr noundef nonnull dereferenceable(1) @.str.19, ptr noundef nonnull @datadir) #7
  %6 = call noalias ptr @fopen(ptr noundef nonnull %2, ptr noundef nonnull @.str.7)
  %7 = icmp eq ptr %6, null
  br i1 %7, label %10, label %.preheader

.preheader:                                       ; preds = %0
  %8 = getelementptr inbounds i8, ptr %1, i64 10
  %9 = getelementptr inbounds i8, ptr %3, i64 8
  br label %.outer

10:                                               ; preds = %0
  %11 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.35, ptr noundef nonnull @datadir)
  %12 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9)
  tail call void @exit(i32 noundef 1) #8
  unreachable

.outer:                                           ; preds = %.outer.backedge, %.preheader
  %13 = call ptr @fgets(ptr noundef nonnull %2, i32 noundef 1024, ptr noundef nonnull %6)
  %.not = icmp eq ptr %13, null
  br i1 %.not, label %62, label %14

14:                                               ; preds = %.outer
  %15 = load i8, ptr %2, align 16, !tbaa !5
  %16 = icmp eq i8 %15, 35
  br i1 %16, label %.outer.backedge, label %17

.outer.backedge:                                  ; preds = %14, %._crit_edge
  br label %.outer, !llvm.loop !8

17:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  %18 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %2, ptr noundef nonnull @.str.36, ptr noundef nonnull %1, ptr noundef nonnull %8, ptr noundef nonnull %4) #7
  %19 = load i32, ptr %4, align 4, !tbaa !10
  %20 = call i32 @AAModel(ptr noundef nonnull %1) #7
  %21 = call i32 @AAModel(ptr noundef nonnull %8) #7
  %22 = sext i32 %19 to i64
  %23 = getelementptr inbounds i8, ptr %2, i64 %22
  %24 = sext i32 %20 to i64
  %25 = sext i32 %21 to i64
  %26 = getelementptr inbounds [33 x [33 x %struct.ConstraintStr]], ptr @potentialPairCG, i64 0, i64 %24, i64 %25
  %27 = getelementptr inbounds i8, ptr %26, i64 8
  %28 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %23, ptr noundef nonnull @.str.37, ptr noundef nonnull %27, ptr noundef nonnull %4) #7
  %29 = load i32, ptr %4, align 4, !tbaa !10
  %30 = add nsw i32 %29, %19
  %31 = load double, ptr %27, align 8, !tbaa !12
  %32 = fmul double %31, %31
  store double %32, ptr %27, align 8, !tbaa !12
  %33 = sext i32 %30 to i64
  %34 = getelementptr inbounds i8, ptr %2, i64 %33
  %35 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %34, ptr noundef nonnull @.str.38, ptr noundef nonnull %3, ptr noundef nonnull %9, ptr noundef nonnull %4) #7
  %.not3940 = icmp eq i32 %35, -1
  br i1 %.not3940, label %._crit_edge, label %36

36:                                               ; preds = %17
  %37 = load i32, ptr %4, align 4, !tbaa !10
  %38 = add nsw i32 %37, %30
  %39 = call noalias dereferenceable_or_null(32) ptr @calloc(i64 noundef 1, i64 noundef 32) #9
  %40 = load double, ptr %3, align 16, !tbaa !16
  %41 = fmul double %40, %40
  store double %41, ptr %39, align 8, !tbaa !17
  %42 = load double, ptr %9, align 8, !tbaa !16
  %43 = getelementptr inbounds i8, ptr %39, i64 8
  store double %42, ptr %43, align 8, !tbaa !19
  %44 = getelementptr inbounds i8, ptr %26, i64 16
  store ptr %39, ptr %44, align 8, !tbaa !20
  %45 = sext i32 %38 to i64
  %46 = getelementptr inbounds i8, ptr %2, i64 %45
  %47 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %46, ptr noundef nonnull @.str.38, ptr noundef nonnull %3, ptr noundef nonnull %9, ptr noundef nonnull %4) #7
  %.not39.peel = icmp eq i32 %47, -1
  br i1 %.not39.peel, label %._crit_edge, label %.peel.next

.peel.next:                                       ; preds = %36, %.peel.next
  %.03642 = phi i32 [ %49, %.peel.next ], [ %38, %36 ]
  %.13841 = phi ptr [ %50, %.peel.next ], [ %39, %36 ]
  %48 = load i32, ptr %4, align 4, !tbaa !10
  %49 = add nsw i32 %48, %.03642
  %50 = call noalias dereferenceable_or_null(32) ptr @calloc(i64 noundef 1, i64 noundef 32) #9
  %51 = load double, ptr %3, align 16, !tbaa !16
  %52 = fmul double %51, %51
  store double %52, ptr %50, align 8, !tbaa !17
  %53 = load double, ptr %9, align 8, !tbaa !16
  %54 = getelementptr inbounds i8, ptr %50, i64 8
  store double %53, ptr %54, align 8, !tbaa !19
  %55 = getelementptr inbounds i8, ptr %.13841, i64 24
  store ptr %50, ptr %55, align 8, !tbaa !21
  %56 = sext i32 %49 to i64
  %57 = getelementptr inbounds i8, ptr %2, i64 %56
  %58 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %57, ptr noundef nonnull @.str.38, ptr noundef nonnull %3, ptr noundef nonnull %9, ptr noundef nonnull %4) #7
  %.not39 = icmp eq i32 %58, -1
  br i1 %.not39, label %._crit_edge, label %.peel.next, !llvm.loop !22

._crit_edge:                                      ; preds = %.peel.next, %36, %17
  %59 = getelementptr inbounds i8, ptr %26, i64 16
  %60 = load ptr, ptr %59, align 8, !tbaa !20
  call void @CalAccumulatedPoten(ptr noundef %60) #7
  %61 = getelementptr inbounds [33 x [33 x %struct.ConstraintStr]], ptr @potentialPairCG, i64 0, i64 %25, i64 %24
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(40) %61, ptr noundef nonnull align 8 dereferenceable(40) %26, i64 40, i1 false), !tbaa.struct !24
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  br label %.outer.backedge

62:                                               ; preds = %.outer
  %63 = call i32 @fclose(ptr noundef nonnull %6)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %1) #7
  ret void
}

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6

declare void @CalAccumulatedPoten(ptr noundef) local_unnamed_addr #4

attributes #0 = { 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 #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 = { 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 = { "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 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 #6 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nounwind }
attributes #8 = { noreturn nounwind }
attributes #9 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !6, i64 0}
!12 = !{!13, !14, i64 8}
!13 = !{!"ConstraintStr", !11, i64 0, !14, i64 8, !15, i64 16, !14, i64 24, !15, i64 32}
!14 = !{!"double", !6, i64 0}
!15 = !{!"any pointer", !6, i64 0}
!16 = !{!14, !14, i64 0}
!17 = !{!18, !14, i64 0}
!18 = !{!"StepPotenStr", !14, i64 0, !14, i64 8, !14, i64 16, !15, i64 24}
!19 = !{!18, !14, i64 8}
!20 = !{!13, !15, i64 16}
!21 = !{!18, !15, i64 24}
!22 = distinct !{!22, !9, !23}
!23 = !{!"llvm.loop.peeled.count", i32 1}
!24 = !{i64 0, i64 4, !10, i64 8, i64 8, !16, i64 16, i64 8, !25, i64 24, i64 8, !16, i64 32, i64 8, !25}
!25 = !{!15, !15, i64 0}


; Effective O3 passes: BDCEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LICMPass,LoopFullUnrollPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass