; LLVM IR from FSmallenburg/EDMD :: Grow (mdgrow)

; 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.sparticle = type { double, double, double, double, double, double, double, double, double, double, [24 x ptr], i8, double, double, double, double, i8, i8, i8, i8, i32, i32, i32, ptr, i32, ptr, ptr, i32, i8 }

@thermostatinterval = external dso_local global double, align 8
@makesnapshots = external dso_local global i32, align 4
@writeinterval = external dso_local global double, align 8
@snapshotinterval = external dso_local global double, align 8
@time = external dso_local global double, align 8
@listcounter1 = external dso_local global i32, align 4
@listcounter2 = external dso_local global i32, align 4
@mergecounter = external dso_local global i32, align 4
@dvtot = external dso_local global double, align 8
@colcounter = external dso_local global i32, align 4
@particles = external dso_local global [100000 x %struct.sparticle], align 16
@xsize = external dso_local global double, align 8
@ysize = external dso_local global double, align 8
@zsize = external dso_local global double, align 8
@write.counter = external hidden global i32, align 4
@write.first = external hidden global i32, align 4
@write.lastsnapshottime = external hidden global double, align 8
@.str.29 = external hidden unnamed_addr constant [79 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [32 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1

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

; Function Attrs: nounwind uwtable
declare dso_local void @update(ptr noundef) #3

; Function Attrs: nounwind uwtable
declare dso_local ptr @createevent(double noundef, ptr noundef, ptr noundef, i32 noundef) #3

; Function Attrs: nounwind uwtable
define dso_local void @write() #3 {
  %1 = alloca i32, align 4
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca double, align 8
  %5 = alloca double, align 8
  %6 = alloca double, align 8
  %7 = alloca double, align 8
  %8 = alloca double, align 8
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  %13 = alloca double, align 8
  %14 = alloca [200 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  store double 0.000000e+00, ptr %4, align 8, !tbaa !5
  store i32 0, ptr %1, align 4, !tbaa !9
  br label %15

15:                                               ; preds = %49, %0
  %16 = load i32, ptr %1, align 4, !tbaa !9
  %17 = icmp slt i32 %16, 100000
  br i1 %17, label %18, label %52

18:                                               ; preds = %15
  %19 = load i32, ptr %1, align 4, !tbaa !9
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds %struct.sparticle, ptr @particles, i64 %20
  store ptr %21, ptr %2, align 8, !tbaa !11
  %22 = load ptr, ptr %2, align 8, !tbaa !11
  call void @update(ptr noundef %22)
  %23 = load ptr, ptr %2, align 8, !tbaa !11
  %24 = getelementptr inbounds %struct.sparticle, ptr %23, i32 0, i32 15
  %25 = load double, ptr %24, align 8, !tbaa !13
  %26 = load ptr, ptr %2, align 8, !tbaa !11
  %27 = getelementptr inbounds %struct.sparticle, ptr %26, i32 0, i32 3
  %28 = load double, ptr %27, align 8, !tbaa !15
  %29 = load ptr, ptr %2, align 8, !tbaa !11
  %30 = getelementptr inbounds %struct.sparticle, ptr %29, i32 0, i32 3
  %31 = load double, ptr %30, align 8, !tbaa !15
  %32 = load ptr, ptr %2, align 8, !tbaa !11
  %33 = getelementptr inbounds %struct.sparticle, ptr %32, i32 0, i32 4
  %34 = load double, ptr %33, align 8, !tbaa !16
  %35 = load ptr, ptr %2, align 8, !tbaa !11
  %36 = getelementptr inbounds %struct.sparticle, ptr %35, i32 0, i32 4
  %37 = load double, ptr %36, align 8, !tbaa !16
  %38 = fmul double %34, %37
  %39 = call double @llvm.fmuladd.f64(double %28, double %31, double %38)
  %40 = load ptr, ptr %2, align 8, !tbaa !11
  %41 = getelementptr inbounds %struct.sparticle, ptr %40, i32 0, i32 5
  %42 = load double, ptr %41, align 8, !tbaa !17
  %43 = load ptr, ptr %2, align 8, !tbaa !11
  %44 = getelementptr inbounds %struct.sparticle, ptr %43, i32 0, i32 5
  %45 = load double, ptr %44, align 8, !tbaa !17
  %46 = call double @llvm.fmuladd.f64(double %42, double %45, double %39)
  %47 = load double, ptr %4, align 8, !tbaa !5
  %48 = call double @llvm.fmuladd.f64(double %25, double %46, double %47)
  store double %48, ptr %4, align 8, !tbaa !5
  br label %49

49:                                               ; preds = %18
  %50 = load i32, ptr %1, align 4, !tbaa !9
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr %1, align 4, !tbaa !9
  br label %15, !llvm.loop !18

52:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  %53 = load double, ptr %4, align 8, !tbaa !5
  %54 = fmul double 5.000000e-01, %53
  %55 = fdiv double %54, 1.000000e+05
  %56 = fdiv double %55, 1.500000e+00
  store double %56, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %57 = load double, ptr @xsize, align 8, !tbaa !5
  %58 = load double, ptr @ysize, align 8, !tbaa !5
  %59 = fmul double %57, %58
  %60 = load double, ptr @zsize, align 8, !tbaa !5
  %61 = fmul double %59, %60
  store double %61, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %62 = load double, ptr %6, align 8, !tbaa !5
  %63 = fdiv double 1.000000e+05, %62
  store double %63, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %64 = load double, ptr @time, align 8, !tbaa !5
  store double %64, ptr %8, align 8, !tbaa !5
  %65 = load double, ptr %8, align 8, !tbaa !5
  %66 = fcmp olt double %65, 0.000000e+00
  br i1 %66, label %67, label %69

67:                                               ; preds = %52
  %68 = load double, ptr @time, align 8, !tbaa !5
  store double %68, ptr %8, align 8, !tbaa !5
  br label %69

69:                                               ; preds = %67, %52
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %70 = load double, ptr @dvtot, align 8, !tbaa !5
  %71 = fneg double %70
  %72 = load double, ptr %6, align 8, !tbaa !5
  %73 = fmul double 3.000000e+00, %72
  %74 = load double, ptr %8, align 8, !tbaa !5
  %75 = fmul double %73, %74
  %76 = fdiv double %71, %75
  store double %76, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %77 = load double, ptr %7, align 8, !tbaa !5
  store double %77, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %78 = load i32, ptr @colcounter, align 4, !tbaa !9
  %79 = icmp ne i32 %78, 0
  br i1 %79, label %80, label %84

80:                                               ; preds = %69
  %81 = load double, ptr %9, align 8, !tbaa !5
  %82 = load double, ptr %10, align 8, !tbaa !5
  %83 = fadd double %81, %82
  br label %85

84:                                               ; preds = %69
  br label %85

85:                                               ; preds = %84, %80
  %86 = phi double [ %83, %80 ], [ 0.000000e+00, %84 ]
  store double %86, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %87 = load i32, ptr @listcounter1, align 4, !tbaa !9
  %88 = sitofp i32 %87 to double
  %89 = load i32, ptr @mergecounter, align 4, !tbaa !9
  %90 = sitofp i32 %89 to double
  %91 = fdiv double %88, %90
  store double %91, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %92 = load i32, ptr @listcounter2, align 4, !tbaa !9
  %93 = sitofp i32 %92 to double
  %94 = load i32, ptr @mergecounter, align 4, !tbaa !9
  %95 = sitofp i32 %94 to double
  %96 = fdiv double %93, %95
  store double %96, ptr %13, align 8, !tbaa !5
  %97 = load i32, ptr @mergecounter, align 4, !tbaa !9
  %98 = icmp eq i32 %97, 0
  br i1 %98, label %99, label %100

99:                                               ; preds = %85
  store double 0.000000e+00, ptr %13, align 8, !tbaa !5
  store double 0.000000e+00, ptr %12, align 8, !tbaa !5
  br label %100

100:                                              ; preds = %99, %85
  store i32 0, ptr @mergecounter, align 4, !tbaa !9
  store i32 0, ptr @listcounter2, align 4, !tbaa !9
  store i32 0, ptr @listcounter1, align 4, !tbaa !9
  %101 = load double, ptr @time, align 8, !tbaa !5
  %102 = load i32, ptr @colcounter, align 4, !tbaa !9
  %103 = load double, ptr %11, align 8, !tbaa !5
  %104 = load double, ptr %11, align 8, !tbaa !5
  %105 = load double, ptr %7, align 8, !tbaa !5
  %106 = fdiv double %104, %105
  %107 = load double, ptr %5, align 8, !tbaa !5
  %108 = load double, ptr %12, align 8, !tbaa !5
  %109 = load double, ptr %13, align 8, !tbaa !5
  %110 = call i32 (ptr, ...) @printf(ptr noundef @.str.29, double noundef %101, i32 noundef %102, double noundef %103, double noundef %106, double noundef %107, double noundef %108, double noundef %109)
  call void @llvm.lifetime.start.p0(i64 200, ptr %14) #5
  %111 = load i32, ptr @makesnapshots, align 4, !tbaa !9
  %112 = icmp ne i32 %111, 0
  br i1 %112, label %113, label %193

113:                                              ; preds = %100
  %114 = load double, ptr @time, align 8, !tbaa !5
  %115 = load double, ptr @write.lastsnapshottime, align 8, !tbaa !5
  %116 = fsub double %114, %115
  %117 = load double, ptr @snapshotinterval, align 8, !tbaa !5
  %118 = fsub double %117, 1.000000e-03
  %119 = fcmp ogt double %116, %118
  br i1 %119, label %120, label %193

120:                                              ; preds = %113
  %121 = getelementptr inbounds [200 x i8], ptr %14, i64 0, i64 0
  %122 = load double, ptr @xsize, align 8, !tbaa !5
  %123 = load double, ptr @ysize, align 8, !tbaa !5
  %124 = fmul double %122, %123
  %125 = load double, ptr @zsize, align 8, !tbaa !5
  %126 = fmul double %124, %125
  %127 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %121, ptr noundef @.str.30, i32 noundef 100000, double noundef %126) #5
  %128 = load i32, ptr @write.first, align 4, !tbaa !9
  %129 = icmp ne i32 %128, 0
  br i1 %129, label %130, label %133

130:                                              ; preds = %120
  store i32 0, ptr @write.first, align 4, !tbaa !9
  %131 = getelementptr inbounds [200 x i8], ptr %14, i64 0, i64 0
  %132 = call noalias ptr @fopen(ptr noundef %131, ptr noundef @.str.31)
  store ptr %132, ptr %3, align 8, !tbaa !11
  br label %136

133:                                              ; preds = %120
  %134 = getelementptr inbounds [200 x i8], ptr %14, i64 0, i64 0
  %135 = call noalias ptr @fopen(ptr noundef %134, ptr noundef @.str.32)
  store ptr %135, ptr %3, align 8, !tbaa !11
  br label %136

136:                                              ; preds = %133, %130
  %137 = load ptr, ptr %3, align 8, !tbaa !11
  %138 = load double, ptr @xsize, align 8, !tbaa !5
  %139 = load double, ptr @ysize, align 8, !tbaa !5
  %140 = load double, ptr @zsize, align 8, !tbaa !5
  %141 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %137, ptr noundef @.str.33, i32 noundef 100000, double noundef %138, double noundef %139, double noundef %140) #5
  store i32 0, ptr %1, align 4, !tbaa !9
  br label %142

142:                                              ; preds = %186, %136
  %143 = load i32, ptr %1, align 4, !tbaa !9
  %144 = icmp slt i32 %143, 100000
  br i1 %144, label %145, label %189

145:                                              ; preds = %142
  %146 = load i32, ptr %1, align 4, !tbaa !9
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [100000 x %struct.sparticle], ptr @particles, i64 0, i64 %147
  store ptr %148, ptr %2, align 8, !tbaa !11
  %149 = load ptr, ptr %3, align 8, !tbaa !11
  %150 = load ptr, ptr %2, align 8, !tbaa !11
  %151 = getelementptr inbounds %struct.sparticle, ptr %150, i32 0, i32 28
  %152 = load i8, ptr %151, align 4, !tbaa !20
  %153 = zext i8 %152 to i32
  %154 = add nsw i32 97, %153
  %155 = load ptr, ptr %2, align 8, !tbaa !11
  %156 = getelementptr inbounds %struct.sparticle, ptr %155, i32 0, i32 0
  %157 = load double, ptr %156, align 8, !tbaa !21
  %158 = load double, ptr @xsize, align 8, !tbaa !5
  %159 = load ptr, ptr %2, align 8, !tbaa !11
  %160 = getelementptr inbounds %struct.sparticle, ptr %159, i32 0, i32 20
  %161 = load i32, ptr %160, align 4, !tbaa !22
  %162 = sitofp i32 %161 to double
  %163 = call double @llvm.fmuladd.f64(double %158, double %162, double %157)
  %164 = load ptr, ptr %2, align 8, !tbaa !11
  %165 = getelementptr inbounds %struct.sparticle, ptr %164, i32 0, i32 1
  %166 = load double, ptr %165, align 8, !tbaa !23
  %167 = load double, ptr @ysize, align 8, !tbaa !5
  %168 = load ptr, ptr %2, align 8, !tbaa !11
  %169 = getelementptr inbounds %struct.sparticle, ptr %168, i32 0, i32 21
  %170 = load i32, ptr %169, align 8, !tbaa !24
  %171 = sitofp i32 %170 to double
  %172 = call double @llvm.fmuladd.f64(double %167, double %171, double %166)
  %173 = load ptr, ptr %2, align 8, !tbaa !11
  %174 = getelementptr inbounds %struct.sparticle, ptr %173, i32 0, i32 2
  %175 = load double, ptr %174, align 8, !tbaa !25
  %176 = load double, ptr @zsize, align 8, !tbaa !5
  %177 = load ptr, ptr %2, align 8, !tbaa !11
  %178 = getelementptr inbounds %struct.sparticle, ptr %177, i32 0, i32 22
  %179 = load i32, ptr %178, align 4, !tbaa !26
  %180 = sitofp i32 %179 to double
  %181 = call double @llvm.fmuladd.f64(double %176, double %180, double %175)
  %182 = load ptr, ptr %2, align 8, !tbaa !11
  %183 = getelementptr inbounds %struct.sparticle, ptr %182, i32 0, i32 13
  %184 = load double, ptr %183, align 8, !tbaa !27
  %185 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %149, ptr noundef @.str.34, i32 noundef %154, double noundef %163, double noundef %172, double noundef %181, double noundef %184) #5
  br label %186

186:                                              ; preds = %145
  %187 = load i32, ptr %1, align 4, !tbaa !9
  %188 = add nsw i32 %187, 1
  store i32 %188, ptr %1, align 4, !tbaa !9
  br label %142, !llvm.loop !28

189:                                              ; preds = %142
  %190 = load ptr, ptr %3, align 8, !tbaa !11
  %191 = call i32 @fclose(ptr noundef %190)
  %192 = load double, ptr @time, align 8, !tbaa !5
  store double %192, ptr @write.lastsnapshottime, align 8, !tbaa !5
  br label %193

193:                                              ; preds = %189, %113, %100
  %194 = load double, ptr %5, align 8, !tbaa !5
  %195 = fcmp ogt double %194, 1.500000e+00
  br i1 %195, label %196, label %199

196:                                              ; preds = %193
  %197 = load double, ptr @thermostatinterval, align 8, !tbaa !5
  %198 = fmul double %197, 5.000000e-01
  store double %198, ptr @thermostatinterval, align 8, !tbaa !5
  br label %199

199:                                              ; preds = %196, %193
  %200 = load i32, ptr @write.counter, align 4, !tbaa !9
  %201 = add nsw i32 %200, 1
  store i32 %201, ptr @write.counter, align 4, !tbaa !9
  %202 = load double, ptr @time, align 8, !tbaa !5
  %203 = load double, ptr @writeinterval, align 8, !tbaa !5
  %204 = fadd double %202, %203
  %205 = call ptr @createevent(double noundef %204, ptr noundef null, ptr noundef null, i32 noundef 100)
  call void @llvm.lifetime.end.p0(i64 200, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  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 8, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #5
  ret void
}

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

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

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

declare i32 @fclose(ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 "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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!14, !6, i64 304}
!14 = !{!"sparticle", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !7, i64 80, !7, i64 272, !6, i64 280, !6, i64 288, !6, i64 296, !6, i64 304, !7, i64 312, !7, i64 313, !7, i64 314, !7, i64 315, !10, i64 316, !10, i64 320, !10, i64 324, !12, i64 328, !10, i64 336, !12, i64 344, !12, i64 352, !10, i64 360, !7, i64 364}
!15 = !{!14, !6, i64 24}
!16 = !{!14, !6, i64 32}
!17 = !{!14, !6, i64 40}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!14, !7, i64 364}
!21 = !{!14, !6, i64 0}
!22 = !{!14, !10, i64 316}
!23 = !{!14, !6, i64 8}
!24 = !{!14, !10, i64 320}
!25 = !{!14, !6, i64 16}
!26 = !{!14, !10, i64 324}
!27 = !{!14, !6, i64 288}
!28 = distinct !{!28, !19}


; 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.sparticle = type { double, double, double, double, double, double, double, double, double, double, [24 x ptr], i8, double, double, double, double, i8, i8, i8, i8, i32, i32, i32, ptr, i32, ptr, ptr, i32, i8 }

@thermostatinterval = external dso_local local_unnamed_addr global double, align 8
@makesnapshots = external dso_local local_unnamed_addr global i32, align 4
@writeinterval = external dso_local local_unnamed_addr global double, align 8
@snapshotinterval = external dso_local local_unnamed_addr global double, align 8
@time = external dso_local local_unnamed_addr global double, align 8
@listcounter1 = external dso_local local_unnamed_addr global i32, align 4
@listcounter2 = external dso_local local_unnamed_addr global i32, align 4
@mergecounter = external dso_local local_unnamed_addr global i32, align 4
@dvtot = external dso_local local_unnamed_addr global double, align 8
@colcounter = external dso_local local_unnamed_addr global i32, align 4
@particles = external dso_local global [100000 x %struct.sparticle], align 16
@xsize = external dso_local local_unnamed_addr global double, align 8
@ysize = external dso_local local_unnamed_addr global double, align 8
@zsize = external dso_local local_unnamed_addr global double, align 8
@write.counter = external hidden local_unnamed_addr global i32, align 4
@write.first = external hidden local_unnamed_addr global i32, align 4
@write.lastsnapshottime = external hidden local_unnamed_addr global double, align 8
@.str.29 = external hidden unnamed_addr constant [79 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [32 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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @write() local_unnamed_addr #3 {
  %1 = alloca [200 x i8], align 16
  br label %2

2:                                                ; preds = %0, %2
  %indvars.iv = phi i64 [ 0, %0 ], [ %indvars.iv.next, %2 ]
  %.04447 = phi double [ 0.000000e+00, %0 ], [ %15, %2 ]
  %3 = getelementptr inbounds %struct.sparticle, ptr @particles, i64 %indvars.iv
  tail call void @update(ptr noundef nonnull %3)
  %4 = getelementptr inbounds i8, ptr %3, i64 304
  %5 = load double, ptr %4, align 16, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %3, i64 24
  %7 = load double, ptr %6, align 8, !tbaa !12
  %8 = getelementptr inbounds i8, ptr %3, i64 32
  %9 = load double, ptr %8, align 16, !tbaa !13
  %10 = fmul double %9, %9
  %11 = tail call double @llvm.fmuladd.f64(double %7, double %7, double %10)
  %12 = getelementptr inbounds i8, ptr %3, i64 40
  %13 = load double, ptr %12, align 8, !tbaa !14
  %14 = tail call double @llvm.fmuladd.f64(double %13, double %13, double %11)
  %15 = tail call double @llvm.fmuladd.f64(double %5, double %14, double %.04447)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 100000
  br i1 %exitcond.not, label %16, label %2, !llvm.loop !15

16:                                               ; preds = %2
  %17 = fmul double %15, 5.000000e-01
  %18 = fdiv double %17, 1.000000e+05
  %19 = fdiv double %18, 1.500000e+00
  %20 = load double, ptr @xsize, align 8, !tbaa !17
  %21 = load double, ptr @ysize, align 8, !tbaa !17
  %22 = fmul double %20, %21
  %23 = load double, ptr @zsize, align 8, !tbaa !17
  %24 = load double, ptr @time, align 8, !tbaa !17
  %25 = load double, ptr @dvtot, align 8, !tbaa !17
  %26 = load i32, ptr @colcounter, align 4, !tbaa !18
  %.not = icmp eq i32 %26, 0
  %27 = fmul double %22, %23
  %28 = fmul double %27, 3.000000e+00
  %29 = fmul double %24, %28
  %30 = insertelement <2 x double> <double 1.000000e+05, double poison>, double %25, i64 1
  %31 = insertelement <2 x double> poison, double %27, i64 0
  %32 = insertelement <2 x double> %31, double %29, i64 1
  %33 = fdiv <2 x double> %30, %32
  %34 = extractelement <2 x double> %33, i64 0
  %shift = shufflevector <2 x double> %33, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
  %35 = fsub <2 x double> %33, %shift
  %36 = extractelement <2 x double> %35, i64 0
  %37 = select i1 %.not, double 0.000000e+00, double %36
  %38 = load i32, ptr @listcounter1, align 4, !tbaa !18
  %39 = sitofp i32 %38 to double
  %40 = load i32, ptr @mergecounter, align 4, !tbaa !18
  %41 = sitofp i32 %40 to double
  %42 = fdiv double %39, %41
  %43 = load i32, ptr @listcounter2, align 4, !tbaa !18
  %44 = sitofp i32 %43 to double
  %45 = fdiv double %44, %41
  %46 = icmp eq i32 %40, 0
  %.040 = select i1 %46, double 0.000000e+00, double %42
  %.0 = select i1 %46, double 0.000000e+00, double %45
  store i32 0, ptr @mergecounter, align 4, !tbaa !18
  store i32 0, ptr @listcounter2, align 4, !tbaa !18
  store i32 0, ptr @listcounter1, align 4, !tbaa !18
  %47 = fdiv double %37, %34
  %48 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.29, double noundef %24, i32 noundef %26, double noundef %37, double noundef %47, double noundef %19, double noundef %.040, double noundef %.0)
  call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %1) #4
  %49 = load i32, ptr @makesnapshots, align 4, !tbaa !18
  %.not45 = icmp eq i32 %49, 0
  br i1 %.not45, label %104, label %50

50:                                               ; preds = %16
  %51 = load double, ptr @time, align 8, !tbaa !17
  %52 = load double, ptr @write.lastsnapshottime, align 8, !tbaa !17
  %53 = fsub double %51, %52
  %54 = load double, ptr @snapshotinterval, align 8, !tbaa !17
  %55 = fadd double %54, -1.000000e-03
  %56 = fcmp ogt double %53, %55
  br i1 %56, label %57, label %104

57:                                               ; preds = %50
  %58 = load double, ptr @xsize, align 8, !tbaa !17
  %59 = load double, ptr @ysize, align 8, !tbaa !17
  %60 = fmul double %58, %59
  %61 = load double, ptr @zsize, align 8, !tbaa !17
  %62 = fmul double %60, %61
  %63 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) @.str.30, i32 noundef 100000, double noundef %62) #4
  %64 = load i32, ptr @write.first, align 4, !tbaa !18
  %.not46 = icmp eq i32 %64, 0
  br i1 %.not46, label %66, label %65

65:                                               ; preds = %57
  store i32 0, ptr @write.first, align 4, !tbaa !18
  br label %66

66:                                               ; preds = %57, %65
  %.str.32.sink = phi ptr [ @.str.31, %65 ], [ @.str.32, %57 ]
  %67 = call noalias ptr @fopen(ptr noundef nonnull %1, ptr noundef nonnull %.str.32.sink)
  %68 = load double, ptr @xsize, align 8, !tbaa !17
  %69 = load double, ptr @ysize, align 8, !tbaa !17
  %70 = load double, ptr @zsize, align 8, !tbaa !17
  %71 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %67, ptr noundef nonnull @.str.33, i32 noundef 100000, double noundef %68, double noundef %69, double noundef %70) #4
  br label %72

72:                                               ; preds = %66, %72
  %indvars.iv51 = phi i64 [ 0, %66 ], [ %indvars.iv.next52, %72 ]
  %73 = getelementptr inbounds [100000 x %struct.sparticle], ptr @particles, i64 0, i64 %indvars.iv51
  %74 = getelementptr inbounds i8, ptr %73, i64 364
  %75 = load i8, ptr %74, align 4, !tbaa !19
  %76 = zext i8 %75 to i32
  %77 = add nuw nsw i32 %76, 97
  %78 = load double, ptr %73, align 16, !tbaa !20
  %79 = load double, ptr @xsize, align 8, !tbaa !17
  %80 = getelementptr inbounds i8, ptr %73, i64 316
  %81 = load i32, ptr %80, align 4, !tbaa !21
  %82 = sitofp i32 %81 to double
  %83 = tail call double @llvm.fmuladd.f64(double %79, double %82, double %78)
  %84 = getelementptr inbounds i8, ptr %73, i64 8
  %85 = load double, ptr %84, align 8, !tbaa !22
  %86 = load double, ptr @ysize, align 8, !tbaa !17
  %87 = getelementptr inbounds i8, ptr %73, i64 320
  %88 = load i32, ptr %87, align 16, !tbaa !23
  %89 = sitofp i32 %88 to double
  %90 = tail call double @llvm.fmuladd.f64(double %86, double %89, double %85)
  %91 = getelementptr inbounds i8, ptr %73, i64 16
  %92 = load double, ptr %91, align 16, !tbaa !24
  %93 = load double, ptr @zsize, align 8, !tbaa !17
  %94 = getelementptr inbounds i8, ptr %73, i64 324
  %95 = load i32, ptr %94, align 4, !tbaa !25
  %96 = sitofp i32 %95 to double
  %97 = tail call double @llvm.fmuladd.f64(double %93, double %96, double %92)
  %98 = getelementptr inbounds i8, ptr %73, i64 288
  %99 = load double, ptr %98, align 16, !tbaa !26
  %100 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %67, ptr noundef nonnull @.str.34, i32 noundef %77, double noundef %83, double noundef %90, double noundef %97, double noundef %99) #4
  %indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1
  %exitcond54.not = icmp eq i64 %indvars.iv.next52, 100000
  br i1 %exitcond54.not, label %101, label %72, !llvm.loop !27

101:                                              ; preds = %72
  %102 = tail call i32 @fclose(ptr noundef %67)
  %103 = load double, ptr @time, align 8, !tbaa !17
  store double %103, ptr @write.lastsnapshottime, align 8, !tbaa !17
  br label %104

104:                                              ; preds = %101, %50, %16
  %105 = fcmp ogt double %19, 1.500000e+00
  br i1 %105, label %106, label %109

106:                                              ; preds = %104
  %107 = load double, ptr @thermostatinterval, align 8, !tbaa !17
  %108 = fmul double %107, 5.000000e-01
  store double %108, ptr @thermostatinterval, align 8, !tbaa !17
  br label %109

109:                                              ; preds = %106, %104
  %110 = load i32, ptr @write.counter, align 4, !tbaa !18
  %111 = add nsw i32 %110, 1
  store i32 %111, ptr @write.counter, align 4, !tbaa !18
  %112 = load double, ptr @time, align 8, !tbaa !17
  %113 = load double, ptr @writeinterval, align 8, !tbaa !17
  %114 = fadd double %112, %113
  %115 = tail call ptr @createevent(double noundef %114, ptr noundef null, ptr noundef null, i32 noundef 100)
  call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %1) #4
  ret void
}

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

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = { 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 304}
!6 = !{!"sparticle", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !8, i64 80, !8, i64 272, !7, i64 280, !7, i64 288, !7, i64 296, !7, i64 304, !8, i64 312, !8, i64 313, !8, i64 314, !8, i64 315, !10, i64 316, !10, i64 320, !10, i64 324, !11, i64 328, !10, i64 336, !11, i64 344, !11, i64 352, !10, i64 360, !8, i64 364}
!7 = !{!"double", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!6, !7, i64 24}
!13 = !{!6, !7, i64 32}
!14 = !{!6, !7, i64 40}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!7, !7, i64 0}
!18 = !{!10, !10, i64 0}
!19 = !{!6, !8, i64 364}
!20 = !{!6, !7, i64 0}
!21 = !{!6, !10, i64 316}
!22 = !{!6, !7, i64 8}
!23 = !{!6, !10, i64 320}
!24 = !{!6, !7, i64 16}
!25 = !{!6, !10, i64 324}
!26 = !{!6, !7, i64 288}
!27 = distinct !{!27, !16}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LoopRotatePass,LoopUnrollPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass,VectorCombinePass