; LLVM IR from FSmallenburg/EDMD :: Multi (mdMulti)

; 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, [24 x ptr], i8, double, double, double, i8, i32, i32, i32, i32, ptr, ptr, ptr, i8 }

@makesnapshots = external dso_local global i32, align 4
@writeinterval = external dso_local global double, align 8
@snapshotinterval = external dso_local global double, align 8
@N = external dso_local global i32, align 4
@simtime = 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 ptr, align 8
@xsize = external dso_local global double, align 8
@ysize = external dso_local global double, align 8
@zsize = external dso_local global double, align 8
@.str.28 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [32 x i8], align 1
@write.counter = external hidden global i32, align 4
@write.first = external hidden global i32, align 4
@write.lastsnapshottime = external hidden global double, align 8
@write.dvtotlast = external hidden global double, align 8
@write.timelast = external hidden global double, align 8
@.str.31 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [9 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

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

declare i32 @fclose(ptr noundef) #2

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

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

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

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

; 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 i32, align 4
  %6 = alloca i32, align 4
  %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 i32, align 4
  %13 = 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
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 0, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 100, ptr %6, align 4, !tbaa !9
  store i32 0, ptr %1, align 4, !tbaa !9
  br label %14

14:                                               ; preds = %73, %0
  %15 = load i32, ptr %1, align 4, !tbaa !9
  %16 = load i32, ptr @N, align 4, !tbaa !9
  %17 = icmp slt i32 %15, %16
  br i1 %17, label %18, label %76

18:                                               ; preds = %14
  %19 = load ptr, ptr @particles, align 8, !tbaa !11
  %20 = load i32, ptr %1, align 4, !tbaa !9
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds %struct.sparticle, ptr %19, i64 %21
  store ptr %22, ptr %2, align 8, !tbaa !11
  %23 = load ptr, ptr %2, align 8, !tbaa !11
  %24 = getelementptr inbounds %struct.sparticle, ptr %23, i32 0, i32 13
  %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
  %49 = load ptr, ptr %2, align 8, !tbaa !11
  %50 = getelementptr inbounds %struct.sparticle, ptr %49, i32 0, i32 10
  %51 = load i8, ptr %50, align 8, !tbaa !18
  %52 = zext i8 %51 to i32
  %53 = load i32, ptr %5, align 4, !tbaa !9
  %54 = icmp sgt i32 %52, %53
  br i1 %54, label %55, label %60

55:                                               ; preds = %18
  %56 = load ptr, ptr %2, align 8, !tbaa !11
  %57 = getelementptr inbounds %struct.sparticle, ptr %56, i32 0, i32 10
  %58 = load i8, ptr %57, align 8, !tbaa !18
  %59 = zext i8 %58 to i32
  store i32 %59, ptr %5, align 4, !tbaa !9
  br label %60

60:                                               ; preds = %55, %18
  %61 = load ptr, ptr %2, align 8, !tbaa !11
  %62 = getelementptr inbounds %struct.sparticle, ptr %61, i32 0, i32 10
  %63 = load i8, ptr %62, align 8, !tbaa !18
  %64 = zext i8 %63 to i32
  %65 = load i32, ptr %6, align 4, !tbaa !9
  %66 = icmp slt i32 %64, %65
  br i1 %66, label %67, label %72

67:                                               ; preds = %60
  %68 = load ptr, ptr %2, align 8, !tbaa !11
  %69 = getelementptr inbounds %struct.sparticle, ptr %68, i32 0, i32 10
  %70 = load i8, ptr %69, align 8, !tbaa !18
  %71 = zext i8 %70 to i32
  store i32 %71, ptr %6, align 4, !tbaa !9
  br label %72

72:                                               ; preds = %67, %60
  br label %73

73:                                               ; preds = %72
  %74 = load i32, ptr %1, align 4, !tbaa !9
  %75 = add nsw i32 %74, 1
  store i32 %75, ptr %1, align 4, !tbaa !9
  br label %14, !llvm.loop !19

76:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %77 = load double, ptr %4, align 8, !tbaa !5
  %78 = fmul double 5.000000e-01, %77
  %79 = load i32, ptr @N, align 4, !tbaa !9
  %80 = sitofp i32 %79 to float
  %81 = fpext float %80 to double
  %82 = fdiv double %78, %81
  %83 = fdiv double %82, 1.500000e+00
  store double %83, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %84 = load double, ptr @xsize, align 8, !tbaa !5
  %85 = load double, ptr @ysize, align 8, !tbaa !5
  %86 = fmul double %84, %85
  %87 = load double, ptr @zsize, align 8, !tbaa !5
  %88 = fmul double %86, %87
  store double %88, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %89 = load i32, ptr @N, align 4, !tbaa !9
  %90 = sitofp i32 %89 to double
  %91 = load double, ptr %8, align 8, !tbaa !5
  %92 = fdiv double %90, %91
  store double %92, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %93 = load double, ptr @dvtot, align 8, !tbaa !5
  %94 = load double, ptr @write.dvtotlast, align 8, !tbaa !5
  %95 = fsub double %93, %94
  %96 = fneg double %95
  %97 = load double, ptr %8, align 8, !tbaa !5
  %98 = fmul double 3.000000e+00, %97
  %99 = load double, ptr @simtime, align 8, !tbaa !5
  %100 = load double, ptr @write.timelast, align 8, !tbaa !5
  %101 = fsub double %99, %100
  %102 = fmul double %98, %101
  %103 = fdiv double %96, %102
  store double %103, ptr %10, align 8, !tbaa !5
  %104 = load double, ptr %9, align 8, !tbaa !5
  %105 = load double, ptr %10, align 8, !tbaa !5
  %106 = fadd double %105, %104
  store double %106, ptr %10, align 8, !tbaa !5
  %107 = load double, ptr @dvtot, align 8, !tbaa !5
  store double %107, ptr @write.dvtotlast, align 8, !tbaa !5
  %108 = load double, ptr @simtime, align 8, !tbaa !5
  store double %108, ptr @write.timelast, align 8, !tbaa !5
  %109 = load i32, ptr @colcounter, align 4, !tbaa !9
  %110 = icmp eq i32 %109, 0
  br i1 %110, label %111, label %112

111:                                              ; preds = %76
  store double 0.000000e+00, ptr %10, align 8, !tbaa !5
  br label %112

112:                                              ; preds = %111, %76
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %113 = load i32, ptr @listcounter1, align 4, !tbaa !9
  %114 = sitofp i32 %113 to double
  %115 = load i32, ptr @mergecounter, align 4, !tbaa !9
  %116 = sitofp i32 %115 to double
  %117 = fdiv double %114, %116
  store double %117, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %118 = load i32, ptr @listcounter2, align 4, !tbaa !9
  store i32 %118, ptr %12, align 4, !tbaa !9
  %119 = load i32, ptr @mergecounter, align 4, !tbaa !9
  %120 = icmp eq i32 %119, 0
  br i1 %120, label %121, label %122

121:                                              ; preds = %112
  store double 0.000000e+00, ptr %11, align 8, !tbaa !5
  br label %122

122:                                              ; preds = %121, %112
  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
  %123 = load double, ptr @simtime, align 8, !tbaa !5
  %124 = load i32, ptr @colcounter, align 4, !tbaa !9
  %125 = load double, ptr %10, align 8, !tbaa !5
  %126 = load double, ptr %7, align 8, !tbaa !5
  %127 = load double, ptr %11, align 8, !tbaa !5
  %128 = load i32, ptr %12, align 4, !tbaa !9
  %129 = load i32, ptr %6, align 4, !tbaa !9
  %130 = load i32, ptr %5, align 4, !tbaa !9
  %131 = call i32 (ptr, ...) @printf(ptr noundef @.str.31, double noundef %123, i32 noundef %124, double noundef %125, double noundef %126, double noundef %127, i32 noundef %128, i32 noundef %129, i32 noundef %130)
  call void @llvm.lifetime.start.p0(i64 200, ptr %13) #5
  %132 = load i32, ptr @makesnapshots, align 4, !tbaa !9
  %133 = icmp ne i32 %132, 0
  br i1 %133, label %134, label %219

134:                                              ; preds = %122
  %135 = load double, ptr @simtime, align 8, !tbaa !5
  %136 = load double, ptr @write.lastsnapshottime, align 8, !tbaa !5
  %137 = fsub double %135, %136
  %138 = load double, ptr @snapshotinterval, align 8, !tbaa !5
  %139 = fsub double %138, 1.000000e-03
  %140 = fcmp ogt double %137, %139
  br i1 %140, label %141, label %219

141:                                              ; preds = %134
  %142 = getelementptr inbounds [200 x i8], ptr %13, i64 0, i64 0
  %143 = load i32, ptr @N, align 4, !tbaa !9
  %144 = load double, ptr @xsize, align 8, !tbaa !5
  %145 = load double, ptr @ysize, align 8, !tbaa !5
  %146 = fmul double %144, %145
  %147 = load double, ptr @zsize, align 8, !tbaa !5
  %148 = fmul double %146, %147
  %149 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %142, ptr noundef @.str.32, i32 noundef %143, double noundef %148) #5
  %150 = load i32, ptr @write.first, align 4, !tbaa !9
  %151 = icmp ne i32 %150, 0
  br i1 %151, label %152, label %155

152:                                              ; preds = %141
  store i32 0, ptr @write.first, align 4, !tbaa !9
  %153 = getelementptr inbounds [200 x i8], ptr %13, i64 0, i64 0
  %154 = call noalias ptr @fopen(ptr noundef %153, ptr noundef @.str.28)
  store ptr %154, ptr %3, align 8, !tbaa !11
  br label %158

155:                                              ; preds = %141
  %156 = getelementptr inbounds [200 x i8], ptr %13, i64 0, i64 0
  %157 = call noalias ptr @fopen(ptr noundef %156, ptr noundef @.str.33)
  store ptr %157, ptr %3, align 8, !tbaa !11
  br label %158

158:                                              ; preds = %155, %152
  %159 = load ptr, ptr %3, align 8, !tbaa !11
  %160 = load i32, ptr @N, align 4, !tbaa !9
  %161 = load double, ptr @xsize, align 8, !tbaa !5
  %162 = load double, ptr @ysize, align 8, !tbaa !5
  %163 = load double, ptr @zsize, align 8, !tbaa !5
  %164 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %159, ptr noundef @.str.29, i32 noundef %160, double noundef %161, double noundef %162, double noundef %163) #5
  store i32 0, ptr %1, align 4, !tbaa !9
  br label %165

165:                                              ; preds = %212, %158
  %166 = load i32, ptr %1, align 4, !tbaa !9
  %167 = load i32, ptr @N, align 4, !tbaa !9
  %168 = icmp slt i32 %166, %167
  br i1 %168, label %169, label %215

169:                                              ; preds = %165
  %170 = load ptr, ptr @particles, align 8, !tbaa !11
  %171 = load i32, ptr %1, align 4, !tbaa !9
  %172 = sext i32 %171 to i64
  %173 = getelementptr inbounds %struct.sparticle, ptr %170, i64 %172
  store ptr %173, ptr %2, align 8, !tbaa !11
  %174 = load ptr, ptr %2, align 8, !tbaa !11
  call void @update(ptr noundef %174)
  %175 = load ptr, ptr %3, align 8, !tbaa !11
  %176 = load ptr, ptr %2, align 8, !tbaa !11
  %177 = getelementptr inbounds %struct.sparticle, ptr %176, i32 0, i32 22
  %178 = load i8, ptr %177, align 8, !tbaa !21
  %179 = zext i8 %178 to i32
  %180 = add nsw i32 97, %179
  %181 = load ptr, ptr %2, align 8, !tbaa !11
  %182 = getelementptr inbounds %struct.sparticle, ptr %181, i32 0, i32 0
  %183 = load double, ptr %182, align 8, !tbaa !22
  %184 = load double, ptr @xsize, align 8, !tbaa !5
  %185 = load ptr, ptr %2, align 8, !tbaa !11
  %186 = getelementptr inbounds %struct.sparticle, ptr %185, i32 0, i32 16
  %187 = load i32, ptr %186, align 8, !tbaa !23
  %188 = sitofp i32 %187 to double
  %189 = call double @llvm.fmuladd.f64(double %184, double %188, double %183)
  %190 = load ptr, ptr %2, align 8, !tbaa !11
  %191 = getelementptr inbounds %struct.sparticle, ptr %190, i32 0, i32 1
  %192 = load double, ptr %191, align 8, !tbaa !24
  %193 = load double, ptr @ysize, align 8, !tbaa !5
  %194 = load ptr, ptr %2, align 8, !tbaa !11
  %195 = getelementptr inbounds %struct.sparticle, ptr %194, i32 0, i32 17
  %196 = load i32, ptr %195, align 4, !tbaa !25
  %197 = sitofp i32 %196 to double
  %198 = call double @llvm.fmuladd.f64(double %193, double %197, double %192)
  %199 = load ptr, ptr %2, align 8, !tbaa !11
  %200 = getelementptr inbounds %struct.sparticle, ptr %199, i32 0, i32 2
  %201 = load double, ptr %200, align 8, !tbaa !26
  %202 = load double, ptr @zsize, align 8, !tbaa !5
  %203 = load ptr, ptr %2, align 8, !tbaa !11
  %204 = getelementptr inbounds %struct.sparticle, ptr %203, i32 0, i32 18
  %205 = load i32, ptr %204, align 8, !tbaa !27
  %206 = sitofp i32 %205 to double
  %207 = call double @llvm.fmuladd.f64(double %202, double %206, double %201)
  %208 = load ptr, ptr %2, align 8, !tbaa !11
  %209 = getelementptr inbounds %struct.sparticle, ptr %208, i32 0, i32 12
  %210 = load double, ptr %209, align 8, !tbaa !28
  %211 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %175, ptr noundef @.str.30, i32 noundef %180, double noundef %189, double noundef %198, double noundef %207, double noundef %210) #5
  br label %212

212:                                              ; preds = %169
  %213 = load i32, ptr %1, align 4, !tbaa !9
  %214 = add nsw i32 %213, 1
  store i32 %214, ptr %1, align 4, !tbaa !9
  br label %165, !llvm.loop !29

215:                                              ; preds = %165
  %216 = load ptr, ptr %3, align 8, !tbaa !11
  %217 = call i32 @fclose(ptr noundef %216)
  %218 = load double, ptr @simtime, align 8, !tbaa !5
  store double %218, ptr @write.lastsnapshottime, align 8, !tbaa !5
  br label %219

219:                                              ; preds = %215, %134, %122
  %220 = getelementptr inbounds [200 x i8], ptr %13, i64 0, i64 0
  %221 = load i32, ptr @N, align 4, !tbaa !9
  %222 = load double, ptr @xsize, align 8, !tbaa !5
  %223 = load double, ptr @ysize, align 8, !tbaa !5
  %224 = fmul double %222, %223
  %225 = load double, ptr @zsize, align 8, !tbaa !5
  %226 = fmul double %224, %225
  %227 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %220, ptr noundef @.str.34, i32 noundef %221, double noundef %226) #5
  %228 = load i32, ptr @write.counter, align 4, !tbaa !9
  %229 = icmp eq i32 %228, 0
  br i1 %229, label %230, label %233

230:                                              ; preds = %219
  %231 = getelementptr inbounds [200 x i8], ptr %13, i64 0, i64 0
  %232 = call noalias ptr @fopen(ptr noundef %231, ptr noundef @.str.28)
  store ptr %232, ptr %3, align 8, !tbaa !11
  br label %236

233:                                              ; preds = %219
  %234 = getelementptr inbounds [200 x i8], ptr %13, i64 0, i64 0
  %235 = call noalias ptr @fopen(ptr noundef %234, ptr noundef @.str.33)
  store ptr %235, ptr %3, align 8, !tbaa !11
  br label %236

236:                                              ; preds = %233, %230
  %237 = load ptr, ptr %3, align 8, !tbaa !11
  %238 = load double, ptr @simtime, align 8, !tbaa !5
  %239 = load double, ptr %10, align 8, !tbaa !5
  %240 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %237, ptr noundef @.str.35, double noundef %238, double noundef %239) #5
  %241 = load ptr, ptr %3, align 8, !tbaa !11
  %242 = call i32 @fclose(ptr noundef %241)
  %243 = load i32, ptr @write.counter, align 4, !tbaa !9
  %244 = add nsw i32 %243, 1
  store i32 %244, ptr @write.counter, align 4, !tbaa !9
  %245 = load double, ptr @simtime, align 8, !tbaa !5
  %246 = load double, ptr @writeinterval, align 8, !tbaa !5
  %247 = fadd double %245, %246
  call void @createevent(double noundef %247, ptr noundef null, ptr noundef null, i32 noundef 100)
  call void @llvm.lifetime.end.p0(i64 200, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, 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 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, 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
}

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 288}
!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, !7, i64 72, !7, i64 264, !6, i64 272, !6, i64 280, !6, i64 288, !7, i64 296, !10, i64 300, !10, i64 304, !10, i64 308, !10, i64 312, !12, i64 320, !12, i64 328, !12, i64 336, !7, i64 344}
!15 = !{!14, !6, i64 24}
!16 = !{!14, !6, i64 32}
!17 = !{!14, !6, i64 40}
!18 = !{!14, !7, i64 264}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{!14, !7, i64 344}
!22 = !{!14, !6, i64 0}
!23 = !{!14, !10, i64 304}
!24 = !{!14, !6, i64 8}
!25 = !{!14, !10, i64 308}
!26 = !{!14, !6, i64 16}
!27 = !{!14, !10, i64 312}
!28 = !{!14, !6, i64 280}
!29 = distinct !{!29, !20}


; 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, [24 x ptr], i8, double, double, double, i8, i32, i32, i32, i32, ptr, ptr, ptr, i8 }

@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
@N = external dso_local local_unnamed_addr global i32, align 4
@simtime = 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 local_unnamed_addr global ptr, align 8
@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
@.str.28 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [32 x i8], align 1
@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
@write.dvtotlast = external hidden local_unnamed_addr global double, align 8
@write.timelast = external hidden local_unnamed_addr global double, align 8
@.str.31 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [9 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: 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 @fclose(ptr nocapture noundef) 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 void @createevent(double noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #3

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

; Function Attrs: nounwind uwtable
define dso_local void @write() local_unnamed_addr #3 {
  %1 = alloca [200 x i8], align 16
  %2 = load i32, ptr @N, align 4, !tbaa !5
  %3 = icmp sgt i32 %2, 0
  br i1 %3, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %0
  %4 = load ptr, ptr @particles, align 8, !tbaa !9
  %wide.trip.count = zext nneg i32 %2 to i64
  br label %5

5:                                                ; preds = %.lr.ph, %5
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %5 ]
  %.04960 = phi double [ 0.000000e+00, %.lr.ph ], [ %18, %5 ]
  %.05059 = phi i32 [ 100, %.lr.ph ], [ %.151, %5 ]
  %.05258 = phi i32 [ 0, %.lr.ph ], [ %spec.select, %5 ]
  %6 = getelementptr inbounds %struct.sparticle, ptr %4, i64 %indvars.iv
  %7 = getelementptr inbounds i8, ptr %6, i64 288
  %8 = load double, ptr %7, align 8, !tbaa !11
  %9 = getelementptr inbounds i8, ptr %6, i64 24
  %10 = load double, ptr %9, align 8, !tbaa !14
  %11 = getelementptr inbounds i8, ptr %6, i64 32
  %12 = load double, ptr %11, align 8, !tbaa !15
  %13 = fmul double %12, %12
  %14 = tail call double @llvm.fmuladd.f64(double %10, double %10, double %13)
  %15 = getelementptr inbounds i8, ptr %6, i64 40
  %16 = load double, ptr %15, align 8, !tbaa !16
  %17 = tail call double @llvm.fmuladd.f64(double %16, double %16, double %14)
  %18 = tail call double @llvm.fmuladd.f64(double %8, double %17, double %.04960)
  %19 = getelementptr inbounds i8, ptr %6, i64 264
  %20 = load i8, ptr %19, align 8, !tbaa !17
  %21 = zext i8 %20 to i32
  %spec.select = tail call i32 @llvm.smax.i32(i32 %.05258, i32 %21)
  %.151 = tail call i32 @llvm.smin.i32(i32 %.05059, i32 %21)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge.loopexit, label %5, !llvm.loop !18

._crit_edge.loopexit:                             ; preds = %5
  %22 = fmul double %18, 5.000000e-01
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %0
  %.052.lcssa = phi i32 [ 0, %0 ], [ %spec.select, %._crit_edge.loopexit ]
  %.050.lcssa = phi i32 [ 100, %0 ], [ %.151, %._crit_edge.loopexit ]
  %.049.lcssa = phi double [ 0.000000e+00, %0 ], [ %22, %._crit_edge.loopexit ]
  %23 = sitofp i32 %2 to float
  %24 = fpext float %23 to double
  %25 = fdiv double %.049.lcssa, %24
  %26 = fdiv double %25, 1.500000e+00
  %27 = load double, ptr @xsize, align 8, !tbaa !20
  %28 = load double, ptr @ysize, align 8, !tbaa !20
  %29 = fmul double %27, %28
  %30 = load double, ptr @zsize, align 8, !tbaa !20
  %31 = sitofp i32 %2 to double
  %32 = load double, ptr @dvtot, align 8, !tbaa !20
  %33 = load double, ptr @write.dvtotlast, align 8, !tbaa !20
  %34 = fsub double %32, %33
  %35 = load double, ptr @simtime, align 8, !tbaa !20
  %36 = load double, ptr @write.timelast, align 8, !tbaa !20
  %37 = fsub double %35, %36
  %38 = fmul double %29, %30
  %39 = fmul double %38, 3.000000e+00
  %40 = fmul double %39, %37
  %41 = insertelement <2 x double> poison, double %31, i64 0
  %42 = insertelement <2 x double> %41, double %34, i64 1
  %43 = insertelement <2 x double> poison, double %38, i64 0
  %44 = insertelement <2 x double> %43, double %40, i64 1
  %45 = fdiv <2 x double> %42, %44
  %shift = shufflevector <2 x double> %45, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
  %46 = fsub <2 x double> %45, %shift
  %47 = extractelement <2 x double> %46, i64 0
  store double %32, ptr @write.dvtotlast, align 8, !tbaa !20
  store double %35, ptr @write.timelast, align 8, !tbaa !20
  %48 = load i32, ptr @colcounter, align 4, !tbaa !5
  %49 = icmp eq i32 %48, 0
  %.046 = select i1 %49, double 0.000000e+00, double %47
  %50 = load i32, ptr @listcounter1, align 4, !tbaa !5
  %51 = sitofp i32 %50 to double
  %52 = load i32, ptr @mergecounter, align 4, !tbaa !5
  %53 = sitofp i32 %52 to double
  %54 = fdiv double %51, %53
  %55 = load i32, ptr @listcounter2, align 4, !tbaa !5
  %56 = icmp eq i32 %52, 0
  %.045 = select i1 %56, double 0.000000e+00, double %54
  store i32 0, ptr @mergecounter, align 4, !tbaa !5
  store i32 0, ptr @listcounter2, align 4, !tbaa !5
  store i32 0, ptr @listcounter1, align 4, !tbaa !5
  %57 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.31, double noundef %35, i32 noundef %48, double noundef %.046, double noundef %26, double noundef %.045, i32 noundef %55, i32 noundef %.050.lcssa, i32 noundef %.052.lcssa)
  call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %1) #5
  %58 = load i32, ptr @makesnapshots, align 4, !tbaa !5
  %.not = icmp eq i32 %58, 0
  br i1 %.not, label %119, label %59

59:                                               ; preds = %._crit_edge
  %60 = load double, ptr @simtime, align 8, !tbaa !20
  %61 = load double, ptr @write.lastsnapshottime, align 8, !tbaa !20
  %62 = fsub double %60, %61
  %63 = load double, ptr @snapshotinterval, align 8, !tbaa !20
  %64 = fadd double %63, -1.000000e-03
  %65 = fcmp ogt double %62, %64
  br i1 %65, label %66, label %119

66:                                               ; preds = %59
  %67 = load i32, ptr @N, align 4, !tbaa !5
  %68 = load double, ptr @xsize, align 8, !tbaa !20
  %69 = load double, ptr @ysize, align 8, !tbaa !20
  %70 = fmul double %68, %69
  %71 = load double, ptr @zsize, align 8, !tbaa !20
  %72 = fmul double %70, %71
  %73 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) @.str.32, i32 noundef %67, double noundef %72) #5
  %74 = load i32, ptr @write.first, align 4, !tbaa !5
  %.not57 = icmp eq i32 %74, 0
  br i1 %.not57, label %76, label %75

75:                                               ; preds = %66
  store i32 0, ptr @write.first, align 4, !tbaa !5
  br label %76

76:                                               ; preds = %66, %75
  %.str.33.sink = phi ptr [ @.str.28, %75 ], [ @.str.33, %66 ]
  %77 = call noalias ptr @fopen(ptr noundef nonnull %1, ptr noundef nonnull %.str.33.sink)
  %78 = load i32, ptr @N, align 4, !tbaa !5
  %79 = load double, ptr @xsize, align 8, !tbaa !20
  %80 = load double, ptr @ysize, align 8, !tbaa !20
  %81 = load double, ptr @zsize, align 8, !tbaa !20
  %82 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %77, ptr noundef nonnull @.str.29, i32 noundef %78, double noundef %79, double noundef %80, double noundef %81) #5
  %83 = load i32, ptr @N, align 4, !tbaa !5
  %84 = icmp sgt i32 %83, 0
  br i1 %84, label %.lr.ph67, label %._crit_edge68

.lr.ph67:                                         ; preds = %76, %.lr.ph67
  %indvars.iv70 = phi i64 [ %indvars.iv.next71, %.lr.ph67 ], [ 0, %76 ]
  %85 = load ptr, ptr @particles, align 8, !tbaa !9
  %86 = getelementptr inbounds %struct.sparticle, ptr %85, i64 %indvars.iv70
  tail call void @update(ptr noundef %86)
  %87 = getelementptr inbounds i8, ptr %86, i64 344
  %88 = load i8, ptr %87, align 8, !tbaa !21
  %89 = zext i8 %88 to i32
  %90 = add nuw nsw i32 %89, 97
  %91 = load double, ptr %86, align 8, !tbaa !22
  %92 = load double, ptr @xsize, align 8, !tbaa !20
  %93 = getelementptr inbounds i8, ptr %86, i64 304
  %94 = load i32, ptr %93, align 8, !tbaa !23
  %95 = sitofp i32 %94 to double
  %96 = tail call double @llvm.fmuladd.f64(double %92, double %95, double %91)
  %97 = getelementptr inbounds i8, ptr %86, i64 8
  %98 = load double, ptr %97, align 8, !tbaa !24
  %99 = load double, ptr @ysize, align 8, !tbaa !20
  %100 = getelementptr inbounds i8, ptr %86, i64 308
  %101 = load i32, ptr %100, align 4, !tbaa !25
  %102 = sitofp i32 %101 to double
  %103 = tail call double @llvm.fmuladd.f64(double %99, double %102, double %98)
  %104 = getelementptr inbounds i8, ptr %86, i64 16
  %105 = load double, ptr %104, align 8, !tbaa !26
  %106 = load double, ptr @zsize, align 8, !tbaa !20
  %107 = getelementptr inbounds i8, ptr %86, i64 312
  %108 = load i32, ptr %107, align 8, !tbaa !27
  %109 = sitofp i32 %108 to double
  %110 = tail call double @llvm.fmuladd.f64(double %106, double %109, double %105)
  %111 = getelementptr inbounds i8, ptr %86, i64 280
  %112 = load double, ptr %111, align 8, !tbaa !28
  %113 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %77, ptr noundef nonnull @.str.30, i32 noundef %90, double noundef %96, double noundef %103, double noundef %110, double noundef %112) #5
  %indvars.iv.next71 = add nuw nsw i64 %indvars.iv70, 1
  %114 = load i32, ptr @N, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = icmp slt i64 %indvars.iv.next71, %115
  br i1 %116, label %.lr.ph67, label %._crit_edge68, !llvm.loop !29

._crit_edge68:                                    ; preds = %.lr.ph67, %76
  %117 = tail call i32 @fclose(ptr noundef %77)
  %118 = load double, ptr @simtime, align 8, !tbaa !20
  store double %118, ptr @write.lastsnapshottime, align 8, !tbaa !20
  br label %119

119:                                              ; preds = %._crit_edge68, %59, %._crit_edge
  %120 = load i32, ptr @N, align 4, !tbaa !5
  %121 = load double, ptr @xsize, align 8, !tbaa !20
  %122 = load double, ptr @ysize, align 8, !tbaa !20
  %123 = fmul double %121, %122
  %124 = load double, ptr @zsize, align 8, !tbaa !20
  %125 = fmul double %123, %124
  %126 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) @.str.34, i32 noundef %120, double noundef %125) #5
  %127 = load i32, ptr @write.counter, align 4, !tbaa !5
  %128 = icmp eq i32 %127, 0
  %.str.28..str.33 = select i1 %128, ptr @.str.28, ptr @.str.33
  %129 = call noalias ptr @fopen(ptr noundef nonnull %1, ptr noundef nonnull %.str.28..str.33)
  %130 = load double, ptr @simtime, align 8, !tbaa !20
  %131 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %129, ptr noundef nonnull @.str.35, double noundef %130, double noundef %.046) #5
  %132 = tail call i32 @fclose(ptr noundef %129)
  %133 = load i32, ptr @write.counter, align 4, !tbaa !5
  %134 = add nsw i32 %133, 1
  store i32 %134, ptr @write.counter, align 4, !tbaa !5
  %135 = load double, ptr @simtime, align 8, !tbaa !20
  %136 = load double, ptr @writeinterval, align 8, !tbaa !20
  %137 = fadd double %135, %136
  tail call void @createevent(double noundef %137, ptr noundef null, ptr noundef null, i32 noundef 100)
  call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %1) #5
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4

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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !13, i64 288}
!12 = !{!"sparticle", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24, !13, i64 32, !13, i64 40, !13, i64 48, !13, i64 56, !13, i64 64, !7, i64 72, !7, i64 264, !13, i64 272, !13, i64 280, !13, i64 288, !7, i64 296, !6, i64 300, !6, i64 304, !6, i64 308, !6, i64 312, !10, i64 320, !10, i64 328, !10, i64 336, !7, i64 344}
!13 = !{!"double", !7, i64 0}
!14 = !{!12, !13, i64 24}
!15 = !{!12, !13, i64 32}
!16 = !{!12, !13, i64 40}
!17 = !{!12, !7, i64 264}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!13, !13, i64 0}
!21 = !{!12, !7, i64 344}
!22 = !{!12, !13, i64 0}
!23 = !{!12, !6, i64 304}
!24 = !{!12, !13, i64 8}
!25 = !{!12, !6, i64 308}
!26 = !{!12, !13, i64 16}
!27 = !{!12, !6, i64 312}
!28 = !{!12, !13, i64 280}
!29 = distinct !{!29, !19}


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