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

; 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.DynamicWallStr = type { [16 x i8], i32, i32, double, double, double, double, [4 x double] }
%struct.REMDStr = type { i32, i32, i32, [50 x i8], [50 x i8], %struct.REMDTempStr }
%struct.REMDTempStr = type { i32, double }
%struct.FileStr = type { i32, [256 x i8], ptr }
%struct.AtomStr = type { ptr, ptr }

@atomnum = external global i32, align 4
@atom = external global ptr, align 8
@connectionMap = external global ptr, align 8
@protein = external global ptr, align 8
@aminoacid = external global ptr, align 8
@celllist = external global ptr, align 8
@numofprotein = external global i32, align 4
@totalAminoAcids = external global i32, align 4
@timestep = external global double, align 8
@targetTemperature = external global double, align 8
@outputrate = external global double, align 8
@cutoffr = external global double, align 8
@Methodtype = external global [20 x i8], align 16
@wallDyn = external global %struct.DynamicWallStr, align 8
@boxDimension = external global [4 x double], align 16
@seed = external global i32, align 4
@REMDInfo = external global %struct.REMDStr, align 8
@currenttime = external global double, align 8
@HBnumformed = external global i32, align 4
@alphaHBformed = external global i32, align 4
@frame = external global i64, align 8
@collisioneventsum = external global i64, align 8
@HBeventsum = external global i64, align 8
@bondeventsum = external global i64, align 8
@HBNeighboreventsum = external global i64, align 8
@thermostateventsum = external global i64, align 8
@pbcandcrosseventsum = external global i64, align 8
@walleventsum = external global i64, align 8
@cellnum = external global [4 x i32], align 16
@cellsize = external global [4 x double], align 16

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @BackupFile(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @GenerateFile(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @SaveDAT(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %8 = load ptr, ptr %2, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.FileStr, ptr %8, i32 0, i32 2
  %10 = load ptr, ptr %9, align 8, !tbaa !9
  %11 = icmp eq ptr %10, null
  %12 = xor i1 %11, true
  %13 = xor i1 %12, true
  %14 = zext i1 %13 to i32
  %15 = sext i32 %14 to i64
  %16 = call i64 @llvm.expect.i64(i64 %15, i64 0)
  %17 = icmp ne i64 %16, 0
  br i1 %17, label %18, label %20

18:                                               ; preds = %1
  %19 = load ptr, ptr %2, align 8, !tbaa !5
  call void @BackupFile(ptr noundef %19)
  br label %20

20:                                               ; preds = %18, %1
  %21 = load ptr, ptr %2, align 8, !tbaa !5
  call void @GenerateFile(ptr noundef %21)
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  %22 = load ptr, ptr %2, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.FileStr, ptr %22, i32 0, i32 2
  %24 = load ptr, ptr %23, align 8, !tbaa !9
  store ptr %24, ptr %3, align 8, !tbaa !5
  %25 = load ptr, ptr %3, align 8, !tbaa !5
  %26 = call i64 @fwrite(ptr noundef @atomnum, i64 noundef 4, i64 noundef 1, ptr noundef %25)
  %27 = load ptr, ptr %3, align 8, !tbaa !5
  %28 = call i64 @fwrite(ptr noundef @numofprotein, i64 noundef 4, i64 noundef 1, ptr noundef %27)
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = call i64 @fwrite(ptr noundef @totalAminoAcids, i64 noundef 4, i64 noundef 1, ptr noundef %29)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store i32 0, ptr %4, align 4, !tbaa !12
  br label %31

31:                                               ; preds = %57, %20
  %32 = load i32, ptr %4, align 4, !tbaa !12
  %33 = load i32, ptr @atomnum, align 4, !tbaa !12
  %34 = icmp sle i32 %32, %33
  br i1 %34, label %36, label %35

35:                                               ; preds = %31
  store i32 2, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  br label %60

36:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 0, ptr %6, align 4, !tbaa !12
  br label %37

37:                                               ; preds = %53, %36
  %38 = load i32, ptr %6, align 4, !tbaa !12
  %39 = load i32, ptr @atomnum, align 4, !tbaa !12
  %40 = icmp sle i32 %38, %39
  br i1 %40, label %42, label %41

41:                                               ; preds = %37
  store i32 5, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %56

42:                                               ; preds = %37
  %43 = load ptr, ptr @connectionMap, align 8, !tbaa !5
  %44 = load i32, ptr %4, align 4, !tbaa !12
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds ptr, ptr %43, i64 %45
  %47 = load ptr, ptr %46, align 8, !tbaa !5
  %48 = load i32, ptr %6, align 4, !tbaa !12
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds i32, ptr %47, i64 %49
  %51 = load ptr, ptr %3, align 8, !tbaa !5
  %52 = call i64 @fwrite(ptr noundef %50, i64 noundef 4, i64 noundef 1, ptr noundef %51)
  br label %53

53:                                               ; preds = %42
  %54 = load i32, ptr %6, align 4, !tbaa !12
  %55 = add nsw i32 %54, 1
  store i32 %55, ptr %6, align 4, !tbaa !12
  br label %37, !llvm.loop !13

56:                                               ; preds = %41
  br label %57

57:                                               ; preds = %56
  %58 = load i32, ptr %4, align 4, !tbaa !12
  %59 = add nsw i32 %58, 1
  store i32 %59, ptr %4, align 4, !tbaa !12
  br label %31, !llvm.loop !15

60:                                               ; preds = %35
  %61 = load ptr, ptr %3, align 8, !tbaa !5
  %62 = call i64 @fwrite(ptr noundef @frame, i64 noundef 8, i64 noundef 1, ptr noundef %61)
  %63 = load ptr, ptr %3, align 8, !tbaa !5
  %64 = call i64 @fwrite(ptr noundef @timestep, i64 noundef 8, i64 noundef 1, ptr noundef %63)
  %65 = load ptr, ptr %3, align 8, !tbaa !5
  %66 = call i64 @fwrite(ptr noundef @currenttime, i64 noundef 8, i64 noundef 1, ptr noundef %65)
  %67 = load ptr, ptr %3, align 8, !tbaa !5
  %68 = call i64 @fwrite(ptr noundef @cutoffr, i64 noundef 8, i64 noundef 1, ptr noundef %67)
  %69 = load ptr, ptr %3, align 8, !tbaa !5
  %70 = call i64 @fwrite(ptr noundef @targetTemperature, i64 noundef 8, i64 noundef 1, ptr noundef %69)
  %71 = load ptr, ptr %3, align 8, !tbaa !5
  %72 = call i64 @fwrite(ptr noundef @outputrate, i64 noundef 8, i64 noundef 1, ptr noundef %71)
  %73 = load ptr, ptr %3, align 8, !tbaa !5
  %74 = call i64 @fwrite(ptr noundef @Methodtype, i64 noundef 1, i64 noundef 20, ptr noundef %73)
  %75 = load ptr, ptr %3, align 8, !tbaa !5
  %76 = call i64 @fwrite(ptr noundef @boxDimension, i64 noundef 8, i64 noundef 4, ptr noundef %75)
  %77 = load ptr, ptr @aminoacid, align 8, !tbaa !5
  %78 = load i32, ptr @totalAminoAcids, align 4, !tbaa !12
  %79 = add nsw i32 %78, 1
  %80 = sext i32 %79 to i64
  %81 = load ptr, ptr %3, align 8, !tbaa !5
  %82 = call i64 @fwrite(ptr noundef %77, i64 noundef 32, i64 noundef %80, ptr noundef %81)
  %83 = load ptr, ptr @protein, align 8, !tbaa !5
  %84 = load i32, ptr @numofprotein, align 4, !tbaa !12
  %85 = add nsw i32 %84, 1
  %86 = sext i32 %85 to i64
  %87 = load ptr, ptr %3, align 8, !tbaa !5
  %88 = call i64 @fwrite(ptr noundef %83, i64 noundef 24, i64 noundef %86, ptr noundef %87)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !12
  br label %89

89:                                               ; preds = %111, %60
  %90 = load i32, ptr %7, align 4, !tbaa !12
  %91 = load i32, ptr @atomnum, align 4, !tbaa !12
  %92 = icmp sle i32 %90, %91
  br i1 %92, label %94, label %93

93:                                               ; preds = %89
  store i32 8, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %114

94:                                               ; preds = %89
  %95 = load ptr, ptr @atom, align 8, !tbaa !5
  %96 = load i32, ptr %7, align 4, !tbaa !12
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds %struct.AtomStr, ptr %95, i64 %97
  %99 = getelementptr inbounds %struct.AtomStr, ptr %98, i32 0, i32 0
  %100 = load ptr, ptr %99, align 8, !tbaa !16
  %101 = load ptr, ptr %3, align 8, !tbaa !5
  %102 = call i64 @fwrite(ptr noundef %100, i64 noundef 136, i64 noundef 1, ptr noundef %101)
  %103 = load ptr, ptr @atom, align 8, !tbaa !5
  %104 = load i32, ptr %7, align 4, !tbaa !12
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds %struct.AtomStr, ptr %103, i64 %105
  %107 = getelementptr inbounds %struct.AtomStr, ptr %106, i32 0, i32 1
  %108 = load ptr, ptr %107, align 8, !tbaa !18
  %109 = load ptr, ptr %3, align 8, !tbaa !5
  %110 = call i64 @fwrite(ptr noundef %108, i64 noundef 176, i64 noundef 1, ptr noundef %109)
  br label %111

111:                                              ; preds = %94
  %112 = load i32, ptr %7, align 4, !tbaa !12
  %113 = add nsw i32 %112, 1
  store i32 %113, ptr %7, align 4, !tbaa !12
  br label %89, !llvm.loop !19

114:                                              ; preds = %93
  %115 = load ptr, ptr %3, align 8, !tbaa !5
  %116 = call i64 @fwrite(ptr noundef getelementptr inbounds (%struct.DynamicWallStr, ptr @wallDyn, i32 0, i32 1), i64 noundef 4, i64 noundef 1, ptr noundef %115)
  %117 = load ptr, ptr %3, align 8, !tbaa !5
  %118 = call i64 @fwrite(ptr noundef getelementptr inbounds (%struct.DynamicWallStr, ptr @wallDyn, i32 0, i32 2), i64 noundef 4, i64 noundef 1, ptr noundef %117)
  %119 = load ptr, ptr %3, align 8, !tbaa !5
  %120 = call i64 @fwrite(ptr noundef getelementptr inbounds (%struct.DynamicWallStr, ptr @wallDyn, i32 0, i32 6), i64 noundef 8, i64 noundef 1, ptr noundef %119)
  %121 = load ptr, ptr %3, align 8, !tbaa !5
  %122 = call i64 @fwrite(ptr noundef getelementptr inbounds (%struct.DynamicWallStr, ptr @wallDyn, i32 0, i32 7), i64 noundef 8, i64 noundef 4, ptr noundef %121)
  %123 = load ptr, ptr %3, align 8, !tbaa !5
  %124 = call i64 @fwrite(ptr noundef @collisioneventsum, i64 noundef 8, i64 noundef 1, ptr noundef %123)
  %125 = load ptr, ptr %3, align 8, !tbaa !5
  %126 = call i64 @fwrite(ptr noundef @HBeventsum, i64 noundef 8, i64 noundef 1, ptr noundef %125)
  %127 = load ptr, ptr %3, align 8, !tbaa !5
  %128 = call i64 @fwrite(ptr noundef @bondeventsum, i64 noundef 8, i64 noundef 1, ptr noundef %127)
  %129 = load ptr, ptr %3, align 8, !tbaa !5
  %130 = call i64 @fwrite(ptr noundef @HBNeighboreventsum, i64 noundef 8, i64 noundef 1, ptr noundef %129)
  %131 = load ptr, ptr %3, align 8, !tbaa !5
  %132 = call i64 @fwrite(ptr noundef @thermostateventsum, i64 noundef 8, i64 noundef 1, ptr noundef %131)
  %133 = load ptr, ptr %3, align 8, !tbaa !5
  %134 = call i64 @fwrite(ptr noundef @pbcandcrosseventsum, i64 noundef 8, i64 noundef 1, ptr noundef %133)
  %135 = load ptr, ptr %3, align 8, !tbaa !5
  %136 = call i64 @fwrite(ptr noundef @walleventsum, i64 noundef 8, i64 noundef 1, ptr noundef %135)
  %137 = load ptr, ptr %3, align 8, !tbaa !5
  %138 = call i64 @fwrite(ptr noundef @cellnum, i64 noundef 4, i64 noundef 4, ptr noundef %137)
  %139 = load ptr, ptr @celllist, align 8, !tbaa !5
  %140 = load i32, ptr @atomnum, align 4, !tbaa !12
  %141 = add nsw i32 %140, 1
  %142 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @cellnum, i64 0, i64 1), align 4, !tbaa !12
  %143 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @cellnum, i64 0, i64 2), align 8, !tbaa !12
  %144 = mul nsw i32 %142, %143
  %145 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @cellnum, i64 0, i64 3), align 4, !tbaa !12
  %146 = mul nsw i32 %144, %145
  %147 = add nsw i32 %141, %146
  %148 = sext i32 %147 to i64
  %149 = load ptr, ptr %3, align 8, !tbaa !5
  %150 = call i64 @fwrite(ptr noundef %139, i64 noundef 4, i64 noundef %148, ptr noundef %149)
  %151 = load ptr, ptr %3, align 8, !tbaa !5
  %152 = call i64 @fwrite(ptr noundef @cellsize, i64 noundef 8, i64 noundef 4, ptr noundef %151)
  %153 = load ptr, ptr %3, align 8, !tbaa !5
  %154 = call i64 @fwrite(ptr noundef @HBnumformed, i64 noundef 4, i64 noundef 1, ptr noundef %153)
  %155 = load ptr, ptr %3, align 8, !tbaa !5
  %156 = call i64 @fwrite(ptr noundef @alphaHBformed, i64 noundef 4, i64 noundef 1, ptr noundef %155)
  %157 = load ptr, ptr %3, align 8, !tbaa !5
  %158 = call i64 @fwrite(ptr noundef @seed, i64 noundef 4, i64 noundef 1, ptr noundef %157)
  %159 = load ptr, ptr %3, align 8, !tbaa !5
  %160 = call i64 @fwrite(ptr noundef @REMDInfo, i64 noundef 128, i64 noundef 1, ptr noundef %159)
  %161 = load ptr, ptr %3, align 8, !tbaa !5
  %162 = call i32 @fclose(ptr noundef %161)
  store i32 1, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  ret void
}

declare i64 @fwrite(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #2

declare i32 @fclose(ptr noundef) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare i64 @llvm.expect.i64(i64, i64) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 nosync nounwind willreturn memory(none) }
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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 264}
!10 = !{!"FileStr", !11, i64 0, !7, i64 4, !6, i64 264}
!11 = !{!"int", !7, i64 0}
!12 = !{!11, !11, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = !{!17, !6, i64 0}
!17 = !{!"AtomStr", !6, i64 0, !6, i64 8}
!18 = !{!17, !6, i64 8}
!19 = distinct !{!19, !14}


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

%struct.DynamicWallStr = type { [16 x i8], i32, i32, double, double, double, double, [4 x double] }
%struct.REMDStr = type { i32, i32, i32, [50 x i8], [50 x i8], %struct.REMDTempStr }
%struct.REMDTempStr = type { i32, double }
%struct.AtomStr = type { ptr, ptr }

@atomnum = external global i32, align 4
@atom = external local_unnamed_addr global ptr, align 8
@connectionMap = external local_unnamed_addr global ptr, align 8
@protein = external local_unnamed_addr global ptr, align 8
@aminoacid = external local_unnamed_addr global ptr, align 8
@celllist = external local_unnamed_addr global ptr, align 8
@numofprotein = external global i32, align 4
@totalAminoAcids = external global i32, align 4
@timestep = external global double, align 8
@targetTemperature = external global double, align 8
@outputrate = external global double, align 8
@cutoffr = external global double, align 8
@Methodtype = external global [20 x i8], align 16
@wallDyn = external global %struct.DynamicWallStr, align 8
@boxDimension = external global [4 x double], align 16
@seed = external global i32, align 4
@REMDInfo = external global %struct.REMDStr, align 8
@currenttime = external global double, align 8
@HBnumformed = external global i32, align 4
@alphaHBformed = external global i32, align 4
@frame = external global i64, align 8
@collisioneventsum = external global i64, align 8
@HBeventsum = external global i64, align 8
@bondeventsum = external global i64, align 8
@HBNeighboreventsum = external global i64, align 8
@thermostateventsum = external global i64, align 8
@pbcandcrosseventsum = external global i64, align 8
@walleventsum = external global i64, align 8
@cellnum = external global [4 x i32], align 16
@cellsize = external global [4 x double], align 16

; Function Attrs: nounwind uwtable
declare dso_local void @BackupFile(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @GenerateFile(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @SaveDAT(ptr noundef %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 264
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = icmp eq ptr %3, null
  br i1 %4, label %5, label %6, !prof !11

5:                                                ; preds = %1
  tail call void @BackupFile(ptr noundef nonnull %0)
  br label %6

6:                                                ; preds = %5, %1
  tail call void @GenerateFile(ptr noundef nonnull %0)
  %7 = load ptr, ptr %2, align 8, !tbaa !5
  %8 = tail call i64 @fwrite(ptr noundef nonnull @atomnum, i64 noundef 4, i64 noundef 1, ptr noundef %7)
  %9 = tail call i64 @fwrite(ptr noundef nonnull @numofprotein, i64 noundef 4, i64 noundef 1, ptr noundef %7)
  %10 = tail call i64 @fwrite(ptr noundef nonnull @totalAminoAcids, i64 noundef 4, i64 noundef 1, ptr noundef %7)
  %11 = load i32, ptr @atomnum, align 4, !tbaa !12
  %.not54 = icmp slt i32 %11, 0
  br i1 %.not54, label %._crit_edge56, label %.preheader

.preheader:                                       ; preds = %6, %._crit_edge
  %12 = phi i32 [ %32, %._crit_edge ], [ %11, %6 ]
  %indvars.iv64 = phi i64 [ %indvars.iv.next65, %._crit_edge ], [ 0, %6 ]
  %.not5152 = icmp slt i32 %12, 0
  br i1 %.not5152, label %.preheader.._crit_edge_crit_edge, label %.lr.ph

.preheader.._crit_edge_crit_edge:                 ; preds = %.preheader
  %.pre = sext i32 %12 to i64
  br label %._crit_edge

._crit_edge56:                                    ; preds = %._crit_edge, %6
  %13 = tail call i64 @fwrite(ptr noundef nonnull @frame, i64 noundef 8, i64 noundef 1, ptr noundef %7)
  %14 = tail call i64 @fwrite(ptr noundef nonnull @timestep, i64 noundef 8, i64 noundef 1, ptr noundef %7)
  %15 = tail call i64 @fwrite(ptr noundef nonnull @currenttime, i64 noundef 8, i64 noundef 1, ptr noundef %7)
  %16 = tail call i64 @fwrite(ptr noundef nonnull @cutoffr, i64 noundef 8, i64 noundef 1, ptr noundef %7)
  %17 = tail call i64 @fwrite(ptr noundef nonnull @targetTemperature, i64 noundef 8, i64 noundef 1, ptr noundef %7)
  %18 = tail call i64 @fwrite(ptr noundef nonnull @outputrate, i64 noundef 8, i64 noundef 1, ptr noundef %7)
  %19 = tail call i64 @fwrite(ptr noundef nonnull @Methodtype, i64 noundef 1, i64 noundef 20, ptr noundef %7)
  %20 = tail call i64 @fwrite(ptr noundef nonnull @boxDimension, i64 noundef 8, i64 noundef 4, ptr noundef %7)
  %21 = load ptr, ptr @aminoacid, align 8, !tbaa !13
  %22 = load i32, ptr @totalAminoAcids, align 4, !tbaa !12
  %23 = add nsw i32 %22, 1
  %24 = sext i32 %23 to i64
  %25 = tail call i64 @fwrite(ptr noundef %21, i64 noundef 32, i64 noundef %24, ptr noundef %7)
  %26 = load ptr, ptr @protein, align 8, !tbaa !13
  %27 = load i32, ptr @numofprotein, align 4, !tbaa !12
  %28 = add nsw i32 %27, 1
  %29 = sext i32 %28 to i64
  %30 = tail call i64 @fwrite(ptr noundef %26, i64 noundef 24, i64 noundef %29, ptr noundef %7)
  %31 = load i32, ptr @atomnum, align 4, !tbaa !12
  %.not5057 = icmp slt i32 %31, 0
  br i1 %.not5057, label %._crit_edge61, label %.lr.ph60

._crit_edge:                                      ; preds = %.lr.ph, %.preheader.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre, %.preheader.._crit_edge_crit_edge ], [ %39, %.lr.ph ]
  %32 = phi i32 [ %12, %.preheader.._crit_edge_crit_edge ], [ %38, %.lr.ph ]
  %indvars.iv.next65 = add nuw nsw i64 %indvars.iv64, 1
  %.not.not = icmp slt i64 %indvars.iv64, %.pre-phi
  br i1 %.not.not, label %.preheader, label %._crit_edge56, !llvm.loop !14

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.preheader ]
  %33 = load ptr, ptr @connectionMap, align 8, !tbaa !13
  %34 = getelementptr inbounds ptr, ptr %33, i64 %indvars.iv64
  %35 = load ptr, ptr %34, align 8, !tbaa !13
  %36 = getelementptr inbounds i32, ptr %35, i64 %indvars.iv
  %37 = tail call i64 @fwrite(ptr noundef %36, i64 noundef 4, i64 noundef 1, ptr noundef %7)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %38 = load i32, ptr @atomnum, align 4, !tbaa !12
  %39 = sext i32 %38 to i64
  %.not51.not = icmp slt i64 %indvars.iv, %39
  br i1 %.not51.not, label %.lr.ph, label %._crit_edge, !llvm.loop !17

._crit_edge61:                                    ; preds = %.lr.ph60, %._crit_edge56
  %40 = tail call i64 @fwrite(ptr noundef nonnull getelementptr inbounds (i8, ptr @wallDyn, i64 16), i64 noundef 4, i64 noundef 1, ptr noundef %7)
  %41 = tail call i64 @fwrite(ptr noundef nonnull getelementptr inbounds (i8, ptr @wallDyn, i64 20), i64 noundef 4, i64 noundef 1, ptr noundef %7)
  %42 = tail call i64 @fwrite(ptr noundef nonnull getelementptr inbounds (i8, ptr @wallDyn, i64 48), i64 noundef 8, i64 noundef 1, ptr noundef %7)
  %43 = tail call i64 @fwrite(ptr noundef nonnull getelementptr inbounds (i8, ptr @wallDyn, i64 56), i64 noundef 8, i64 noundef 4, ptr noundef %7)
  %44 = tail call i64 @fwrite(ptr noundef nonnull @collisioneventsum, i64 noundef 8, i64 noundef 1, ptr noundef %7)
  %45 = tail call i64 @fwrite(ptr noundef nonnull @HBeventsum, i64 noundef 8, i64 noundef 1, ptr noundef %7)
  %46 = tail call i64 @fwrite(ptr noundef nonnull @bondeventsum, i64 noundef 8, i64 noundef 1, ptr noundef %7)
  %47 = tail call i64 @fwrite(ptr noundef nonnull @HBNeighboreventsum, i64 noundef 8, i64 noundef 1, ptr noundef %7)
  %48 = tail call i64 @fwrite(ptr noundef nonnull @thermostateventsum, i64 noundef 8, i64 noundef 1, ptr noundef %7)
  %49 = tail call i64 @fwrite(ptr noundef nonnull @pbcandcrosseventsum, i64 noundef 8, i64 noundef 1, ptr noundef %7)
  %50 = tail call i64 @fwrite(ptr noundef nonnull @walleventsum, i64 noundef 8, i64 noundef 1, ptr noundef %7)
  %51 = tail call i64 @fwrite(ptr noundef nonnull @cellnum, i64 noundef 4, i64 noundef 4, ptr noundef %7)
  %52 = load ptr, ptr @celllist, align 8, !tbaa !13
  %53 = load i32, ptr @atomnum, align 4, !tbaa !12
  %54 = add nsw i32 %53, 1
  %55 = load i32, ptr getelementptr inbounds (i8, ptr @cellnum, i64 4), align 4, !tbaa !12
  %56 = load i32, ptr getelementptr inbounds (i8, ptr @cellnum, i64 8), align 8, !tbaa !12
  %57 = mul nsw i32 %56, %55
  %58 = load i32, ptr getelementptr inbounds (i8, ptr @cellnum, i64 12), align 4, !tbaa !12
  %59 = mul nsw i32 %57, %58
  %60 = add nsw i32 %54, %59
  %61 = sext i32 %60 to i64
  %62 = tail call i64 @fwrite(ptr noundef %52, i64 noundef 4, i64 noundef %61, ptr noundef %7)
  %63 = tail call i64 @fwrite(ptr noundef nonnull @cellsize, i64 noundef 8, i64 noundef 4, ptr noundef %7)
  %64 = tail call i64 @fwrite(ptr noundef nonnull @HBnumformed, i64 noundef 4, i64 noundef 1, ptr noundef %7)
  %65 = tail call i64 @fwrite(ptr noundef nonnull @alphaHBformed, i64 noundef 4, i64 noundef 1, ptr noundef %7)
  %66 = tail call i64 @fwrite(ptr noundef nonnull @seed, i64 noundef 4, i64 noundef 1, ptr noundef %7)
  %67 = tail call i64 @fwrite(ptr noundef nonnull @REMDInfo, i64 noundef 128, i64 noundef 1, ptr noundef %7)
  %68 = tail call i32 @fclose(ptr noundef %7)
  ret void

.lr.ph60:                                         ; preds = %._crit_edge56, %.lr.ph60
  %indvars.iv67 = phi i64 [ %indvars.iv.next68, %.lr.ph60 ], [ 0, %._crit_edge56 ]
  %69 = load ptr, ptr @atom, align 8, !tbaa !13
  %70 = getelementptr inbounds %struct.AtomStr, ptr %69, i64 %indvars.iv67
  %71 = load ptr, ptr %70, align 8, !tbaa !18
  %72 = tail call i64 @fwrite(ptr noundef %71, i64 noundef 136, i64 noundef 1, ptr noundef %7)
  %73 = load ptr, ptr @atom, align 8, !tbaa !13
  %74 = getelementptr inbounds %struct.AtomStr, ptr %73, i64 %indvars.iv67, i32 1
  %75 = load ptr, ptr %74, align 8, !tbaa !20
  %76 = tail call i64 @fwrite(ptr noundef %75, i64 noundef 176, i64 noundef 1, ptr noundef %7)
  %indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
  %77 = load i32, ptr @atomnum, align 4, !tbaa !12
  %78 = sext i32 %77 to i64
  %.not50.not = icmp slt i64 %indvars.iv67, %78
  br i1 %.not50.not, label %.lr.ph60, label %._crit_edge61, !llvm.loop !21
}

; Function Attrs: nofree nounwind
declare noundef i64 @fwrite(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i32 @fclose(ptr nocapture noundef) local_unnamed_addr #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 = { 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" }

!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, !10, i64 264}
!6 = !{!"FileStr", !7, i64 0, !8, i64 4, !10, i64 264}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"branch_weights", !"expected", i32 1, i32 2000}
!12 = !{!7, !7, i64 0}
!13 = !{!10, !10, i64 0}
!14 = distinct !{!14, !15, !16}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!"llvm.loop.unswitch.partial.disable"}
!17 = distinct !{!17, !15}
!18 = !{!19, !10, i64 0}
!19 = !{!"AtomStr", !10, i64 0, !10, i64 8}
!20 = !{!19, !10, i64 8}
!21 = distinct !{!21, !15}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,LowerExpectIntrinsicPass,ReassociatePass,SCCPPass,SROAPass,SimpleLoopUnswitchPass,SimplifyCFGPass,TailCallElimPass