; LLVM IR from FSmallenburg/EDMD :: Single (mdSingle)

; 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, i32, i32, ptr, ptr, i8, double, ptr, ptr, ptr, ptr, i32, 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
define dso_local void @write(ptr noundef %0) #3 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca double, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %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 i32, align 4
  %15 = alloca [200 x i8], align 16
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  store double 0.000000e+00, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 100, ptr %8, align 4, !tbaa !11
  store i32 0, ptr %3, align 4, !tbaa !11
  br label %16

16:                                               ; preds = %75, %1
  %17 = load i32, ptr %3, align 4, !tbaa !11
  %18 = load i32, ptr @N, align 4, !tbaa !11
  %19 = icmp slt i32 %17, %18
  br i1 %19, label %20, label %78

20:                                               ; preds = %16
  %21 = load ptr, ptr @particles, align 8, !tbaa !5
  %22 = load i32, ptr %3, align 4, !tbaa !11
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds %struct.sparticle, ptr %21, i64 %23
  store ptr %24, ptr %4, align 8, !tbaa !5
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.sparticle, ptr %25, i32 0, i32 13
  %27 = load double, ptr %26, align 8, !tbaa !13
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.sparticle, ptr %28, i32 0, i32 3
  %30 = load double, ptr %29, align 8, !tbaa !15
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.sparticle, ptr %31, i32 0, i32 3
  %33 = load double, ptr %32, align 8, !tbaa !15
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.sparticle, ptr %34, i32 0, i32 4
  %36 = load double, ptr %35, align 8, !tbaa !16
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.sparticle, ptr %37, i32 0, i32 4
  %39 = load double, ptr %38, align 8, !tbaa !16
  %40 = fmul double %36, %39
  %41 = call double @llvm.fmuladd.f64(double %30, double %33, double %40)
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.sparticle, ptr %42, i32 0, i32 5
  %44 = load double, ptr %43, align 8, !tbaa !17
  %45 = load ptr, ptr %4, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.sparticle, ptr %45, i32 0, i32 5
  %47 = load double, ptr %46, align 8, !tbaa !17
  %48 = call double @llvm.fmuladd.f64(double %44, double %47, double %41)
  %49 = load double, ptr %6, align 8, !tbaa !9
  %50 = call double @llvm.fmuladd.f64(double %27, double %48, double %49)
  store double %50, ptr %6, align 8, !tbaa !9
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.sparticle, ptr %51, i32 0, i32 10
  %53 = load i8, ptr %52, align 8, !tbaa !18
  %54 = zext i8 %53 to i32
  %55 = load i32, ptr %7, align 4, !tbaa !11
  %56 = icmp sgt i32 %54, %55
  br i1 %56, label %57, label %62

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

62:                                               ; preds = %57, %20
  %63 = load ptr, ptr %4, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.sparticle, ptr %63, i32 0, i32 10
  %65 = load i8, ptr %64, align 8, !tbaa !18
  %66 = zext i8 %65 to i32
  %67 = load i32, ptr %8, align 4, !tbaa !11
  %68 = icmp slt i32 %66, %67
  br i1 %68, label %69, label %74

69:                                               ; preds = %62
  %70 = load ptr, ptr %4, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.sparticle, ptr %70, i32 0, i32 10
  %72 = load i8, ptr %71, align 8, !tbaa !18
  %73 = zext i8 %72 to i32
  store i32 %73, ptr %8, align 4, !tbaa !11
  br label %74

74:                                               ; preds = %69, %62
  br label %75

75:                                               ; preds = %74
  %76 = load i32, ptr %3, align 4, !tbaa !11
  %77 = add nsw i32 %76, 1
  store i32 %77, ptr %3, align 4, !tbaa !11
  br label %16, !llvm.loop !19

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

113:                                              ; preds = %78
  store double 0.000000e+00, ptr %12, align 8, !tbaa !9
  br label %114

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

123:                                              ; preds = %114
  store double 0.000000e+00, ptr %13, align 8, !tbaa !9
  br label %124

124:                                              ; preds = %123, %114
  store i32 0, ptr @mergecounter, align 4, !tbaa !11
  store i32 0, ptr @listcounter2, align 4, !tbaa !11
  store i32 0, ptr @listcounter1, align 4, !tbaa !11
  %125 = load double, ptr @simtime, align 8, !tbaa !9
  %126 = load i32, ptr @colcounter, align 4, !tbaa !11
  %127 = load double, ptr %12, align 8, !tbaa !9
  %128 = load double, ptr %9, align 8, !tbaa !9
  %129 = load double, ptr %13, align 8, !tbaa !9
  %130 = load i32, ptr %14, align 4, !tbaa !11
  %131 = load i32, ptr %8, align 4, !tbaa !11
  %132 = load i32, ptr %7, align 4, !tbaa !11
  %133 = call i32 (ptr, ...) @printf(ptr noundef @.str.31, double noundef %125, i32 noundef %126, double noundef %127, double noundef %128, double noundef %129, i32 noundef %130, i32 noundef %131, i32 noundef %132)
  call void @llvm.lifetime.start.p0(i64 200, ptr %15) #5
  %134 = load i32, ptr @makesnapshots, align 4, !tbaa !11
  %135 = icmp ne i32 %134, 0
  br i1 %135, label %136, label %221

136:                                              ; preds = %124
  %137 = load double, ptr @simtime, align 8, !tbaa !9
  %138 = load double, ptr @write.lastsnapshottime, align 8, !tbaa !9
  %139 = fsub double %137, %138
  %140 = load double, ptr @snapshotinterval, align 8, !tbaa !9
  %141 = fsub double %140, 1.000000e-03
  %142 = fcmp ogt double %139, %141
  br i1 %142, label %143, label %221

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

154:                                              ; preds = %143
  store i32 0, ptr @write.first, align 4, !tbaa !11
  %155 = getelementptr inbounds [200 x i8], ptr %15, i64 0, i64 0
  %156 = call noalias ptr @fopen(ptr noundef %155, ptr noundef @.str.28)
  store ptr %156, ptr %5, align 8, !tbaa !5
  br label %160

157:                                              ; preds = %143
  %158 = getelementptr inbounds [200 x i8], ptr %15, i64 0, i64 0
  %159 = call noalias ptr @fopen(ptr noundef %158, ptr noundef @.str.33)
  store ptr %159, ptr %5, align 8, !tbaa !5
  br label %160

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

167:                                              ; preds = %214, %160
  %168 = load i32, ptr %3, align 4, !tbaa !11
  %169 = load i32, ptr @N, align 4, !tbaa !11
  %170 = icmp slt i32 %168, %169
  br i1 %170, label %171, label %217

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

214:                                              ; preds = %171
  %215 = load i32, ptr %3, align 4, !tbaa !11
  %216 = add nsw i32 %215, 1
  store i32 %216, ptr %3, align 4, !tbaa !11
  br label %167, !llvm.loop !29

217:                                              ; preds = %167
  %218 = load ptr, ptr %5, align 8, !tbaa !5
  %219 = call i32 @fclose(ptr noundef %218)
  %220 = load double, ptr @simtime, align 8, !tbaa !9
  store double %220, ptr @write.lastsnapshottime, align 8, !tbaa !9
  br label %221

221:                                              ; preds = %217, %136, %124
  %222 = getelementptr inbounds [200 x i8], ptr %15, i64 0, i64 0
  %223 = load i32, ptr @N, align 4, !tbaa !11
  %224 = load double, ptr @xsize, align 8, !tbaa !9
  %225 = load double, ptr @ysize, align 8, !tbaa !9
  %226 = fmul double %224, %225
  %227 = load double, ptr @zsize, align 8, !tbaa !9
  %228 = fmul double %226, %227
  %229 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %222, ptr noundef @.str.34, i32 noundef %223, double noundef %228) #5
  %230 = load i32, ptr @write.counter, align 4, !tbaa !11
  %231 = icmp eq i32 %230, 0
  br i1 %231, label %232, label %235

232:                                              ; preds = %221
  %233 = getelementptr inbounds [200 x i8], ptr %15, i64 0, i64 0
  %234 = call noalias ptr @fopen(ptr noundef %233, ptr noundef @.str.28)
  store ptr %234, ptr %5, align 8, !tbaa !5
  br label %238

235:                                              ; preds = %221
  %236 = getelementptr inbounds [200 x i8], ptr %15, i64 0, i64 0
  %237 = call noalias ptr @fopen(ptr noundef %236, ptr noundef @.str.33)
  store ptr %237, ptr %5, align 8, !tbaa !5
  br label %238

238:                                              ; preds = %235, %232
  %239 = load ptr, ptr %5, align 8, !tbaa !5
  %240 = load double, ptr @simtime, align 8, !tbaa !9
  %241 = load double, ptr %12, align 8, !tbaa !9
  %242 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %239, ptr noundef @.str.35, double noundef %240, double noundef %241) #5
  %243 = load ptr, ptr %5, align 8, !tbaa !5
  %244 = call i32 @fclose(ptr noundef %243)
  %245 = load i32, ptr @write.counter, align 4, !tbaa !11
  %246 = add nsw i32 %245, 1
  store i32 %246, ptr @write.counter, align 4, !tbaa !11
  %247 = load double, ptr @simtime, align 8, !tbaa !9
  %248 = load double, ptr @writeinterval, align 8, !tbaa !9
  %249 = fadd double %247, %248
  %250 = load ptr, ptr %2, align 8, !tbaa !5
  %251 = getelementptr inbounds %struct.sparticle, ptr %250, i32 0, i32 24
  store double %249, ptr %251, align 8, !tbaa !30
  %252 = load ptr, ptr %2, align 8, !tbaa !5
  call void @addevent(ptr noundef %252)
  call void @llvm.lifetime.end.p0(i64 200, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, 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 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, 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 4, ptr %3) #5
  ret void
}

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

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

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

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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !10, i64 288}
!14 = !{!"sparticle", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !7, i64 72, !7, i64 264, !10, i64 272, !10, i64 280, !10, i64 288, !7, i64 296, !12, i64 300, !12, i64 304, !12, i64 308, !12, i64 312, !12, i64 316, !12, i64 320, !6, i64 328, !6, i64 336, !7, i64 344, !10, i64 352, !6, i64 360, !6, i64 368, !6, i64 376, !6, i64 384, !12, i64 392, !7, i64 396}
!15 = !{!14, !10, i64 24}
!16 = !{!14, !10, i64 32}
!17 = !{!14, !10, i64 40}
!18 = !{!14, !7, i64 264}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{!14, !7, i64 344}
!22 = !{!14, !10, i64 0}
!23 = !{!14, !12, i64 304}
!24 = !{!14, !10, i64 8}
!25 = !{!14, !12, i64 308}
!26 = !{!14, !10, i64 16}
!27 = !{!14, !12, i64 312}
!28 = !{!14, !10, i64 280}
!29 = distinct !{!29, !20}
!30 = !{!14, !10, i64 352}


; 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, i32, i32, ptr, ptr, i8, double, ptr, ptr, ptr, ptr, i32, 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
define dso_local void @write(ptr noundef %0) local_unnamed_addr #3 {
  %2 = alloca [200 x i8], align 16
  %3 = load i32, ptr @N, align 4, !tbaa !5
  %4 = icmp sgt i32 %3, 0
  br i1 %4, label %.lr.ph, label %._crit_edge

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

6:                                                ; preds = %.lr.ph, %6
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %6 ]
  %.05162 = phi double [ 0.000000e+00, %.lr.ph ], [ %19, %6 ]
  %.05261 = phi i32 [ 100, %.lr.ph ], [ %.153, %6 ]
  %.05460 = phi i32 [ 0, %.lr.ph ], [ %spec.select, %6 ]
  %7 = getelementptr inbounds %struct.sparticle, ptr %5, i64 %indvars.iv
  %8 = getelementptr inbounds i8, ptr %7, i64 288
  %9 = load double, ptr %8, align 8, !tbaa !11
  %10 = getelementptr inbounds i8, ptr %7, i64 24
  %11 = load double, ptr %10, align 8, !tbaa !14
  %12 = getelementptr inbounds i8, ptr %7, i64 32
  %13 = load double, ptr %12, align 8, !tbaa !15
  %14 = fmul double %13, %13
  %15 = tail call double @llvm.fmuladd.f64(double %11, double %11, double %14)
  %16 = getelementptr inbounds i8, ptr %7, i64 40
  %17 = load double, ptr %16, align 8, !tbaa !16
  %18 = tail call double @llvm.fmuladd.f64(double %17, double %17, double %15)
  %19 = tail call double @llvm.fmuladd.f64(double %9, double %18, double %.05162)
  %20 = getelementptr inbounds i8, ptr %7, i64 264
  %21 = load i8, ptr %20, align 8, !tbaa !17
  %22 = zext i8 %21 to i32
  %spec.select = tail call i32 @llvm.smax.i32(i32 %.05460, i32 %22)
  %.153 = tail call i32 @llvm.smin.i32(i32 %.05261, i32 %22)
  %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 %6, !llvm.loop !18

._crit_edge.loopexit:                             ; preds = %6
  %23 = fmul double %19, 5.000000e-01
  br label %._crit_edge

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

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

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

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

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

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @addevent(ptr 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: 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, !6, i64 316, !6, i64 320, !10, i64 328, !10, i64 336, !7, i64 344, !13, i64 352, !10, i64 360, !10, i64 368, !10, i64 376, !10, i64 384, !6, i64 392, !7, i64 396}
!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}
!30 = !{!12, !13, i64 352}


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