; 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.CGMatrixStr = type { [5 x double], [32 x %struct.CGBeadStr] }
%struct.CGBeadStr = type { double, double, double, double }

@CGMatrix = external global %struct.CGMatrixStr, align 8
@.str.20 = external hidden unnamed_addr constant [2 x i8], align 1
@__const.PrintPotCur_Res.sur_type = external hidden unnamed_addr constant [3 x ptr], align 16
@.str.26 = external hidden unnamed_addr constant [13 x i8], align 1
@savedir = external global [1024 x i8], align 16
@.str.27 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [2 x i8], align 1

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

; Function Attrs: nounwind
declare i32 @sprintf(ptr noundef, ptr noundef, ...) #1

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

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

declare i32 @AAModel(ptr noundef) #2

declare i32 @fclose(ptr noundef) #2

; 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) #3

; Function Attrs: nounwind uwtable
declare dso_local double @FindMaxPotDis(ptr noundef byval(%struct.CGBeadStr) align 8, ptr noundef byval(%struct.CGBeadStr) align 8, double noundef) #4

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #1

; Function Attrs: nounwind uwtable
declare dso_local ptr @GetAAName(i32 noundef) #4

; Function Attrs: nounwind uwtable
declare dso_local double @CalculateSurPoten(ptr noundef byval(%struct.CGBeadStr) align 8, ptr noundef byval(%struct.CGBeadStr) align 8, double noundef) #4

; Function Attrs: nounwind uwtable
define dso_local void @PrintPotCur_Res() #4 {
  %1 = alloca ptr, align 8
  %2 = alloca [128 x i8], align 16
  %3 = alloca [3 x ptr], align 16
  %4 = alloca i32, align 4
  %5 = alloca double, align 8
  %6 = alloca double, align 8
  %7 = alloca double, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #5
  call void @llvm.lifetime.start.p0(i64 128, ptr %2) #5
  call void @llvm.lifetime.start.p0(i64 24, ptr %3) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %3, ptr align 16 @__const.PrintPotCur_Res.sur_type, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 3, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  store double 2.000000e-02, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  store double 0.000000e+00, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %11

11:                                               ; preds = %101, %0
  %12 = load i32, ptr %8, align 4, !tbaa !5
  %13 = load i32, ptr %4, align 4, !tbaa !5
  %14 = icmp slt i32 %12, %13
  br i1 %14, label %16, label %15

15:                                               ; preds = %11
  store i32 2, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %104

16:                                               ; preds = %11
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %17

17:                                               ; preds = %97, %16
  %18 = load i32, ptr %10, align 4, !tbaa !5
  %19 = icmp slt i32 %18, 32
  br i1 %19, label %21, label %20

20:                                               ; preds = %17
  store i32 5, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %100

21:                                               ; preds = %17
  %22 = load i32, ptr %10, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [32 x %struct.CGBeadStr], ptr getelementptr inbounds (%struct.CGMatrixStr, ptr @CGMatrix, i32 0, i32 1), i64 0, i64 %23
  %25 = getelementptr inbounds %struct.CGBeadStr, ptr %24, i32 0, i32 2
  %26 = load double, ptr %25, align 8, !tbaa !11
  %27 = fcmp ole double %26, 0.000000e+00
  br i1 %27, label %46, label %28

28:                                               ; preds = %21
  %29 = getelementptr inbounds [3 x ptr], ptr %3, i64 0, i64 0
  %30 = load ptr, ptr %29, align 16, !tbaa !13
  %31 = call i32 @AAModel(ptr noundef %30)
  %32 = load i32, ptr %10, align 4, !tbaa !5
  %33 = icmp eq i32 %31, %32
  br i1 %33, label %46, label %34

34:                                               ; preds = %28
  %35 = getelementptr inbounds [3 x ptr], ptr %3, i64 0, i64 1
  %36 = load ptr, ptr %35, align 8, !tbaa !13
  %37 = call i32 @AAModel(ptr noundef %36)
  %38 = load i32, ptr %10, align 4, !tbaa !5
  %39 = icmp eq i32 %37, %38
  br i1 %39, label %46, label %40

40:                                               ; preds = %34
  %41 = getelementptr inbounds [3 x ptr], ptr %3, i64 0, i64 2
  %42 = load ptr, ptr %41, align 16, !tbaa !13
  %43 = call i32 @AAModel(ptr noundef %42)
  %44 = load i32, ptr %10, align 4, !tbaa !5
  %45 = icmp eq i32 %43, %44
  br i1 %45, label %46, label %47

46:                                               ; preds = %40, %34, %28, %21
  br label %97

47:                                               ; preds = %40
  %48 = getelementptr inbounds [128 x i8], ptr %2, i64 0, i64 0
  %49 = load i32, ptr %8, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [3 x ptr], ptr %3, i64 0, i64 %50
  %52 = load ptr, ptr %51, align 8, !tbaa !13
  %53 = load i32, ptr %10, align 4, !tbaa !5
  %54 = call ptr @GetAAName(i32 noundef %53)
  %55 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %48, ptr noundef @.str.26, ptr noundef @savedir, ptr noundef %52, ptr noundef %54) #5
  %56 = getelementptr inbounds [128 x i8], ptr %2, i64 0, i64 0
  %57 = call noalias ptr @fopen(ptr noundef %56, ptr noundef @.str.20)
  store ptr %57, ptr %1, align 8, !tbaa !13
  %58 = load i32, ptr %8, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [3 x ptr], ptr %3, i64 0, i64 %59
  %61 = load ptr, ptr %60, align 8, !tbaa !13
  %62 = call i32 @AAModel(ptr noundef %61)
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [32 x %struct.CGBeadStr], ptr getelementptr inbounds (%struct.CGMatrixStr, ptr @CGMatrix, i32 0, i32 1), i64 0, i64 %63
  %65 = load i32, ptr %10, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [32 x %struct.CGBeadStr], ptr getelementptr inbounds (%struct.CGMatrixStr, ptr @CGMatrix, i32 0, i32 1), i64 0, i64 %66
  %68 = call double @FindMaxPotDis(ptr noundef byval(%struct.CGBeadStr) align 8 %64, ptr noundef byval(%struct.CGBeadStr) align 8 %67, double noundef 6.000000e-01)
  store double %68, ptr %5, align 8, !tbaa !9
  br label %69

69:                                               ; preds = %72, %47
  %70 = load double, ptr %5, align 8, !tbaa !9
  %71 = fcmp olt double %70, 1.000000e+01
  br i1 %71, label %72, label %92

72:                                               ; preds = %69
  %73 = load i32, ptr %8, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [3 x ptr], ptr %3, i64 0, i64 %74
  %76 = load ptr, ptr %75, align 8, !tbaa !13
  %77 = call i32 @AAModel(ptr noundef %76)
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [32 x %struct.CGBeadStr], ptr getelementptr inbounds (%struct.CGMatrixStr, ptr @CGMatrix, i32 0, i32 1), i64 0, i64 %78
  %80 = load i32, ptr %10, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [32 x %struct.CGBeadStr], ptr getelementptr inbounds (%struct.CGMatrixStr, ptr @CGMatrix, i32 0, i32 1), i64 0, i64 %81
  %83 = load double, ptr %5, align 8, !tbaa !9
  %84 = call double @CalculateSurPoten(ptr noundef byval(%struct.CGBeadStr) align 8 %79, ptr noundef byval(%struct.CGBeadStr) align 8 %82, double noundef %83)
  store double %84, ptr %7, align 8, !tbaa !9
  %85 = load ptr, ptr %1, align 8, !tbaa !13
  %86 = load double, ptr %5, align 8, !tbaa !9
  %87 = load double, ptr %7, align 8, !tbaa !9
  %88 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %85, ptr noundef @.str.27, double noundef %86, double noundef %87) #5
  %89 = load double, ptr %6, align 8, !tbaa !9
  %90 = load double, ptr %5, align 8, !tbaa !9
  %91 = fadd double %90, %89
  store double %91, ptr %5, align 8, !tbaa !9
  br label %69, !llvm.loop !15

92:                                               ; preds = %69
  %93 = load ptr, ptr %1, align 8, !tbaa !13
  %94 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %93, ptr noundef @.str.28) #5
  %95 = load ptr, ptr %1, align 8, !tbaa !13
  %96 = call i32 @fclose(ptr noundef %95)
  br label %97

97:                                               ; preds = %92, %46
  %98 = load i32, ptr %10, align 4, !tbaa !5
  %99 = add nsw i32 %98, 1
  store i32 %99, ptr %10, align 4, !tbaa !5
  br label %17, !llvm.loop !17

100:                                              ; preds = %20
  br label %101

101:                                              ; preds = %100
  %102 = load i32, ptr %8, align 4, !tbaa !5
  %103 = add nsw i32 %102, 1
  store i32 %103, ptr %8, align 4, !tbaa !5
  br label %11, !llvm.loop !18

104:                                              ; preds = %15
  store i32 1, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, 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 4, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 128, ptr %2) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #5
  ret void
}

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

!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 = !{!"double", !7, i64 0}
!11 = !{!12, !10, i64 16}
!12 = !{!"CGBeadStr", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24}
!13 = !{!14, !14, i64 0}
!14 = !{!"any pointer", !7, i64 0}
!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.CGMatrixStr = type { [5 x double], [32 x %struct.CGBeadStr] }
%struct.CGBeadStr = type { double, double, double, double }

@CGMatrix = external global %struct.CGMatrixStr, align 8
@.str.20 = external hidden unnamed_addr constant [2 x i8], align 1
@__const.PrintPotCur_Res.sur_type = external hidden unnamed_addr constant [3 x ptr], align 16
@.str.26 = external hidden unnamed_addr constant [13 x i8], align 1
@savedir = external global [1024 x i8], align 16
@.str.27 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [2 x i8], align 1

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

; Function Attrs: nofree nounwind
declare noundef i32 @sprintf(ptr noalias nocapture noundef writeonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #1

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

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

declare i32 @AAModel(ptr noundef) local_unnamed_addr #2

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

; Function Attrs: nounwind uwtable
declare dso_local double @FindMaxPotDis(ptr noundef byval(%struct.CGBeadStr) align 8, ptr noundef byval(%struct.CGBeadStr) align 8, double noundef) local_unnamed_addr #3

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

; Function Attrs: nounwind uwtable
declare dso_local ptr @GetAAName(i32 noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare dso_local double @CalculateSurPoten(ptr noundef byval(%struct.CGBeadStr) align 8, ptr noundef byval(%struct.CGBeadStr) align 8, double noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local void @PrintPotCur_Res() local_unnamed_addr #3 {
.preheader:
  %0 = alloca [128 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %0) #4
  %1 = load ptr, ptr @__const.PrintPotCur_Res.sur_type, align 16
  %2 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.PrintPotCur_Res.sur_type, i64 8), align 8
  %3 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.PrintPotCur_Res.sur_type, i64 16), align 16
  br label %77

.preheader.1:                                     ; preds = %113, %39
  %indvars.iv.1 = phi i64 [ %indvars.iv.next.1, %39 ], [ 0, %113 ]
  %4 = getelementptr inbounds [32 x %struct.CGBeadStr], ptr getelementptr inbounds (i8, ptr @CGMatrix, i64 40), i64 0, i64 %indvars.iv.1
  %5 = getelementptr inbounds i8, ptr %4, i64 16
  %6 = load double, ptr %5, align 8, !tbaa !5
  %7 = fcmp ugt double %6, 0.000000e+00
  br i1 %7, label %8, label %39

8:                                                ; preds = %.preheader.1
  %9 = tail call i32 @AAModel(ptr noundef %1) #4
  %10 = zext i32 %9 to i64
  %11 = icmp eq i64 %indvars.iv.1, %10
  br i1 %11, label %39, label %12

12:                                               ; preds = %8
  %13 = tail call i32 @AAModel(ptr noundef %2) #4
  %14 = zext i32 %13 to i64
  %15 = icmp eq i64 %indvars.iv.1, %14
  br i1 %15, label %39, label %16

16:                                               ; preds = %12
  %17 = tail call i32 @AAModel(ptr noundef %3) #4
  %18 = zext i32 %17 to i64
  %19 = icmp eq i64 %indvars.iv.1, %18
  br i1 %19, label %39, label %20

20:                                               ; preds = %16
  %21 = trunc nuw nsw i64 %indvars.iv.1 to i32
  %22 = tail call ptr @GetAAName(i32 noundef %21)
  %23 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) @.str.26, ptr noundef nonnull @savedir, ptr noundef %2, ptr noundef %22) #4
  %24 = call noalias ptr @fopen(ptr noundef nonnull %0, ptr noundef nonnull @.str.20)
  %25 = tail call i32 @AAModel(ptr noundef %2) #4
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [32 x %struct.CGBeadStr], ptr getelementptr inbounds (i8, ptr @CGMatrix, i64 40), i64 0, i64 %26
  %28 = tail call double @FindMaxPotDis(ptr noundef nonnull byval(%struct.CGBeadStr) align 8 %27, ptr noundef nonnull byval(%struct.CGBeadStr) align 8 %4, double noundef 6.000000e-01)
  %29 = fcmp olt double %28, 1.000000e+01
  br i1 %29, label %.lr.ph.1, label %._crit_edge.1

.lr.ph.1:                                         ; preds = %20, %.lr.ph.1
  %.02425.1 = phi double [ %35, %.lr.ph.1 ], [ %28, %20 ]
  %30 = tail call i32 @AAModel(ptr noundef %2) #4
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [32 x %struct.CGBeadStr], ptr getelementptr inbounds (i8, ptr @CGMatrix, i64 40), i64 0, i64 %31
  %33 = tail call double @CalculateSurPoten(ptr noundef nonnull byval(%struct.CGBeadStr) align 8 %32, ptr noundef nonnull byval(%struct.CGBeadStr) align 8 %4, double noundef %.02425.1)
  %34 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %24, ptr noundef nonnull @.str.27, double noundef %.02425.1, double noundef %33) #4
  %35 = fadd double %.02425.1, 2.000000e-02
  %36 = fcmp olt double %35, 1.000000e+01
  br i1 %36, label %.lr.ph.1, label %._crit_edge.1, !llvm.loop !10

._crit_edge.1:                                    ; preds = %.lr.ph.1, %20
  %37 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %24, ptr noundef nonnull @.str.28) #4
  %38 = tail call i32 @fclose(ptr noundef %24)
  br label %39

39:                                               ; preds = %._crit_edge.1, %16, %12, %8, %.preheader.1
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv.1, 1
  %exitcond.1.not = icmp eq i64 %indvars.iv.next.1, 32
  br i1 %exitcond.1.not, label %.preheader.2, label %.preheader.1, !llvm.loop !12

.preheader.2:                                     ; preds = %39, %75
  %indvars.iv.2 = phi i64 [ %indvars.iv.next.2, %75 ], [ 0, %39 ]
  %40 = getelementptr inbounds [32 x %struct.CGBeadStr], ptr getelementptr inbounds (i8, ptr @CGMatrix, i64 40), i64 0, i64 %indvars.iv.2
  %41 = getelementptr inbounds i8, ptr %40, i64 16
  %42 = load double, ptr %41, align 8, !tbaa !5
  %43 = fcmp ugt double %42, 0.000000e+00
  br i1 %43, label %44, label %75

44:                                               ; preds = %.preheader.2
  %45 = tail call i32 @AAModel(ptr noundef %1) #4
  %46 = zext i32 %45 to i64
  %47 = icmp eq i64 %indvars.iv.2, %46
  br i1 %47, label %75, label %48

48:                                               ; preds = %44
  %49 = tail call i32 @AAModel(ptr noundef %2) #4
  %50 = zext i32 %49 to i64
  %51 = icmp eq i64 %indvars.iv.2, %50
  br i1 %51, label %75, label %52

52:                                               ; preds = %48
  %53 = tail call i32 @AAModel(ptr noundef %3) #4
  %54 = zext i32 %53 to i64
  %55 = icmp eq i64 %indvars.iv.2, %54
  br i1 %55, label %75, label %56

56:                                               ; preds = %52
  %57 = trunc nuw nsw i64 %indvars.iv.2 to i32
  %58 = tail call ptr @GetAAName(i32 noundef %57)
  %59 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) @.str.26, ptr noundef nonnull @savedir, ptr noundef %3, ptr noundef %58) #4
  %60 = call noalias ptr @fopen(ptr noundef nonnull %0, ptr noundef nonnull @.str.20)
  %61 = tail call i32 @AAModel(ptr noundef %3) #4
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [32 x %struct.CGBeadStr], ptr getelementptr inbounds (i8, ptr @CGMatrix, i64 40), i64 0, i64 %62
  %64 = tail call double @FindMaxPotDis(ptr noundef nonnull byval(%struct.CGBeadStr) align 8 %63, ptr noundef nonnull byval(%struct.CGBeadStr) align 8 %40, double noundef 6.000000e-01)
  %65 = fcmp olt double %64, 1.000000e+01
  br i1 %65, label %.lr.ph.2, label %._crit_edge.2

.lr.ph.2:                                         ; preds = %56, %.lr.ph.2
  %.02425.2 = phi double [ %71, %.lr.ph.2 ], [ %64, %56 ]
  %66 = tail call i32 @AAModel(ptr noundef %3) #4
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [32 x %struct.CGBeadStr], ptr getelementptr inbounds (i8, ptr @CGMatrix, i64 40), i64 0, i64 %67
  %69 = tail call double @CalculateSurPoten(ptr noundef nonnull byval(%struct.CGBeadStr) align 8 %68, ptr noundef nonnull byval(%struct.CGBeadStr) align 8 %40, double noundef %.02425.2)
  %70 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %60, ptr noundef nonnull @.str.27, double noundef %.02425.2, double noundef %69) #4
  %71 = fadd double %.02425.2, 2.000000e-02
  %72 = fcmp olt double %71, 1.000000e+01
  br i1 %72, label %.lr.ph.2, label %._crit_edge.2, !llvm.loop !10

._crit_edge.2:                                    ; preds = %.lr.ph.2, %56
  %73 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %60, ptr noundef nonnull @.str.28) #4
  %74 = tail call i32 @fclose(ptr noundef %60)
  br label %75

75:                                               ; preds = %._crit_edge.2, %52, %48, %44, %.preheader.2
  %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv.2, 1
  %exitcond.2.not = icmp eq i64 %indvars.iv.next.2, 32
  br i1 %exitcond.2.not, label %76, label %.preheader.2, !llvm.loop !12

76:                                               ; preds = %75
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %0) #4
  ret void

77:                                               ; preds = %.preheader, %113
  %indvars.iv = phi i64 [ 0, %.preheader ], [ %indvars.iv.next, %113 ]
  %78 = getelementptr inbounds [32 x %struct.CGBeadStr], ptr getelementptr inbounds (i8, ptr @CGMatrix, i64 40), i64 0, i64 %indvars.iv
  %79 = getelementptr inbounds i8, ptr %78, i64 16
  %80 = load double, ptr %79, align 8, !tbaa !5
  %81 = fcmp ugt double %80, 0.000000e+00
  br i1 %81, label %82, label %113

82:                                               ; preds = %77
  %83 = tail call i32 @AAModel(ptr noundef %1) #4
  %84 = zext i32 %83 to i64
  %85 = icmp eq i64 %indvars.iv, %84
  br i1 %85, label %113, label %86

86:                                               ; preds = %82
  %87 = tail call i32 @AAModel(ptr noundef %2) #4
  %88 = zext i32 %87 to i64
  %89 = icmp eq i64 %indvars.iv, %88
  br i1 %89, label %113, label %90

90:                                               ; preds = %86
  %91 = tail call i32 @AAModel(ptr noundef %3) #4
  %92 = zext i32 %91 to i64
  %93 = icmp eq i64 %indvars.iv, %92
  br i1 %93, label %113, label %94

94:                                               ; preds = %90
  %95 = trunc nuw nsw i64 %indvars.iv to i32
  %96 = tail call ptr @GetAAName(i32 noundef %95)
  %97 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) @.str.26, ptr noundef nonnull @savedir, ptr noundef %1, ptr noundef %96) #4
  %98 = call noalias ptr @fopen(ptr noundef nonnull %0, ptr noundef nonnull @.str.20)
  %99 = tail call i32 @AAModel(ptr noundef %1) #4
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [32 x %struct.CGBeadStr], ptr getelementptr inbounds (i8, ptr @CGMatrix, i64 40), i64 0, i64 %100
  %102 = tail call double @FindMaxPotDis(ptr noundef nonnull byval(%struct.CGBeadStr) align 8 %101, ptr noundef nonnull byval(%struct.CGBeadStr) align 8 %78, double noundef 6.000000e-01)
  %103 = fcmp olt double %102, 1.000000e+01
  br i1 %103, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %94, %.lr.ph
  %.02425 = phi double [ %109, %.lr.ph ], [ %102, %94 ]
  %104 = tail call i32 @AAModel(ptr noundef %1) #4
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [32 x %struct.CGBeadStr], ptr getelementptr inbounds (i8, ptr @CGMatrix, i64 40), i64 0, i64 %105
  %107 = tail call double @CalculateSurPoten(ptr noundef nonnull byval(%struct.CGBeadStr) align 8 %106, ptr noundef nonnull byval(%struct.CGBeadStr) align 8 %78, double noundef %.02425)
  %108 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %98, ptr noundef nonnull @.str.27, double noundef %.02425, double noundef %107) #4
  %109 = fadd double %.02425, 2.000000e-02
  %110 = fcmp olt double %109, 1.000000e+01
  br i1 %110, label %.lr.ph, label %._crit_edge, !llvm.loop !10

._crit_edge:                                      ; preds = %.lr.ph, %94
  %111 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %98, ptr noundef nonnull @.str.28) #4
  %112 = tail call i32 @fclose(ptr noundef %98)
  br label %113

113:                                              ; preds = %77, %82, %86, %90, %._crit_edge
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 32
  br i1 %exitcond.not, label %.preheader.1, label %77, !llvm.loop !12
}

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

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

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


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