; LLVM IR from FSmallenburg/EDMD :: Cell (mdCell)

; 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.sevent = type { double, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32 }
%struct.sparticle = type { double, double, double, double, double, double, double, double, double, i8, i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, i8 }

@simtime = external dso_local global double, 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
@cx = external dso_local global i32, align 4
@cy = external dso_local global i32, align 4
@cz = external dso_local global i32, align 4
@celllist = external dso_local global [75 x [75 x [75 x ptr]]], align 16

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @findcrossing(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local void @removeevent(ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local void @cellcross(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca double, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  %6 = load ptr, ptr %2, align 8, !tbaa !5
  %7 = getelementptr inbounds %struct.sevent, ptr %6, i32 0, i32 4
  %8 = load ptr, ptr %7, align 8, !tbaa !9
  store ptr %8, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  %9 = load ptr, ptr %2, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.sevent, ptr %9, i32 0, i32 10
  %11 = load i32, ptr %10, align 8, !tbaa !13
  store i32 %11, ptr %4, align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %12 = load double, ptr @simtime, align 8, !tbaa !15
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.sparticle, ptr %13, i32 0, i32 6
  %15 = load double, ptr %14, align 8, !tbaa !16
  %16 = fsub double %12, %15
  store double %16, ptr %5, align 8, !tbaa !15
  %17 = load double, ptr %5, align 8, !tbaa !15
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.sparticle, ptr %18, i32 0, i32 3
  %20 = load double, ptr %19, align 8, !tbaa !18
  %21 = load ptr, ptr %3, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.sparticle, ptr %21, i32 0, i32 0
  %23 = load double, ptr %22, align 8, !tbaa !19
  %24 = call double @llvm.fmuladd.f64(double %17, double %20, double %23)
  store double %24, ptr %22, align 8, !tbaa !19
  %25 = load double, ptr %5, align 8, !tbaa !15
  %26 = load ptr, ptr %3, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.sparticle, ptr %26, i32 0, i32 4
  %28 = load double, ptr %27, align 8, !tbaa !20
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.sparticle, ptr %29, i32 0, i32 1
  %31 = load double, ptr %30, align 8, !tbaa !21
  %32 = call double @llvm.fmuladd.f64(double %25, double %28, double %31)
  store double %32, ptr %30, align 8, !tbaa !21
  %33 = load double, ptr %5, align 8, !tbaa !15
  %34 = load ptr, ptr %3, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.sparticle, ptr %34, i32 0, i32 5
  %36 = load double, ptr %35, align 8, !tbaa !22
  %37 = load ptr, ptr %3, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.sparticle, ptr %37, i32 0, i32 2
  %39 = load double, ptr %38, align 8, !tbaa !23
  %40 = call double @llvm.fmuladd.f64(double %33, double %36, double %39)
  store double %40, ptr %38, align 8, !tbaa !23
  %41 = load double, ptr @simtime, align 8, !tbaa !15
  %42 = load ptr, ptr %3, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.sparticle, ptr %42, i32 0, i32 6
  store double %41, ptr %43, align 8, !tbaa !16
  %44 = load ptr, ptr %3, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.sparticle, ptr %44, i32 0, i32 17
  %46 = load ptr, ptr %45, align 8, !tbaa !24
  %47 = icmp ne ptr %46, null
  br i1 %47, label %48, label %56

48:                                               ; preds = %1
  %49 = load ptr, ptr %3, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.sparticle, ptr %49, i32 0, i32 18
  %51 = load ptr, ptr %50, align 8, !tbaa !25
  %52 = load ptr, ptr %3, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.sparticle, ptr %52, i32 0, i32 17
  %54 = load ptr, ptr %53, align 8, !tbaa !24
  %55 = getelementptr inbounds %struct.sparticle, ptr %54, i32 0, i32 18
  store ptr %51, ptr %55, align 8, !tbaa !25
  br label %75

56:                                               ; preds = %1
  %57 = load ptr, ptr %3, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.sparticle, ptr %57, i32 0, i32 18
  %59 = load ptr, ptr %58, align 8, !tbaa !25
  %60 = load ptr, ptr %3, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.sparticle, ptr %60, i32 0, i32 10
  %62 = load i32, ptr %61, align 4, !tbaa !26
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [75 x [75 x [75 x ptr]]], ptr @celllist, i64 0, i64 %63
  %65 = load ptr, ptr %3, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.sparticle, ptr %65, i32 0, i32 11
  %67 = load i32, ptr %66, align 8, !tbaa !27
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [75 x [75 x ptr]], ptr %64, i64 0, i64 %68
  %70 = load ptr, ptr %3, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.sparticle, ptr %70, i32 0, i32 12
  %72 = load i32, ptr %71, align 4, !tbaa !28
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [75 x ptr], ptr %69, i64 0, i64 %73
  store ptr %59, ptr %74, align 8, !tbaa !5
  br label %75

75:                                               ; preds = %56, %48
  %76 = load ptr, ptr %3, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.sparticle, ptr %76, i32 0, i32 18
  %78 = load ptr, ptr %77, align 8, !tbaa !25
  %79 = icmp ne ptr %78, null
  br i1 %79, label %80, label %88

80:                                               ; preds = %75
  %81 = load ptr, ptr %3, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.sparticle, ptr %81, i32 0, i32 17
  %83 = load ptr, ptr %82, align 8, !tbaa !24
  %84 = load ptr, ptr %3, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.sparticle, ptr %84, i32 0, i32 18
  %86 = load ptr, ptr %85, align 8, !tbaa !25
  %87 = getelementptr inbounds %struct.sparticle, ptr %86, i32 0, i32 17
  store ptr %83, ptr %87, align 8, !tbaa !24
  br label %88

88:                                               ; preds = %80, %75
  %89 = load i32, ptr %4, align 4, !tbaa !14
  switch i32 %89, label %234 [
    i32 1, label %90
    i32 2, label %113
    i32 3, label %136
    i32 -1, label %159
    i32 -2, label %184
    i32 -3, label %209
  ]

90:                                               ; preds = %88
  %91 = load ptr, ptr %3, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.sparticle, ptr %91, i32 0, i32 10
  %93 = load i32, ptr %92, align 4, !tbaa !26
  %94 = add nsw i32 %93, 1
  store i32 %94, ptr %92, align 4, !tbaa !26
  %95 = load ptr, ptr %3, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.sparticle, ptr %95, i32 0, i32 10
  %97 = load i32, ptr %96, align 4, !tbaa !26
  %98 = load i32, ptr @cx, align 4, !tbaa !14
  %99 = icmp eq i32 %97, %98
  br i1 %99, label %100, label %112

100:                                              ; preds = %90
  %101 = load ptr, ptr %3, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.sparticle, ptr %101, i32 0, i32 10
  store i32 0, ptr %102, align 4, !tbaa !26
  %103 = load double, ptr @xsize, align 8, !tbaa !15
  %104 = load ptr, ptr %3, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.sparticle, ptr %104, i32 0, i32 0
  %106 = load double, ptr %105, align 8, !tbaa !19
  %107 = fsub double %106, %103
  store double %107, ptr %105, align 8, !tbaa !19
  %108 = load ptr, ptr %3, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.sparticle, ptr %108, i32 0, i32 13
  %110 = load i32, ptr %109, align 8, !tbaa !29
  %111 = add nsw i32 %110, 1
  store i32 %111, ptr %109, align 8, !tbaa !29
  br label %112

112:                                              ; preds = %100, %90
  br label %234

113:                                              ; preds = %88
  %114 = load ptr, ptr %3, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.sparticle, ptr %114, i32 0, i32 11
  %116 = load i32, ptr %115, align 8, !tbaa !27
  %117 = add nsw i32 %116, 1
  store i32 %117, ptr %115, align 8, !tbaa !27
  %118 = load ptr, ptr %3, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.sparticle, ptr %118, i32 0, i32 11
  %120 = load i32, ptr %119, align 8, !tbaa !27
  %121 = load i32, ptr @cy, align 4, !tbaa !14
  %122 = icmp eq i32 %120, %121
  br i1 %122, label %123, label %135

123:                                              ; preds = %113
  %124 = load ptr, ptr %3, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.sparticle, ptr %124, i32 0, i32 11
  store i32 0, ptr %125, align 8, !tbaa !27
  %126 = load double, ptr @ysize, align 8, !tbaa !15
  %127 = load ptr, ptr %3, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.sparticle, ptr %127, i32 0, i32 1
  %129 = load double, ptr %128, align 8, !tbaa !21
  %130 = fsub double %129, %126
  store double %130, ptr %128, align 8, !tbaa !21
  %131 = load ptr, ptr %3, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.sparticle, ptr %131, i32 0, i32 14
  %133 = load i32, ptr %132, align 4, !tbaa !30
  %134 = add nsw i32 %133, 1
  store i32 %134, ptr %132, align 4, !tbaa !30
  br label %135

135:                                              ; preds = %123, %113
  br label %234

136:                                              ; preds = %88
  %137 = load ptr, ptr %3, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.sparticle, ptr %137, i32 0, i32 12
  %139 = load i32, ptr %138, align 4, !tbaa !28
  %140 = add nsw i32 %139, 1
  store i32 %140, ptr %138, align 4, !tbaa !28
  %141 = load ptr, ptr %3, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.sparticle, ptr %141, i32 0, i32 12
  %143 = load i32, ptr %142, align 4, !tbaa !28
  %144 = load i32, ptr @cz, align 4, !tbaa !14
  %145 = icmp eq i32 %143, %144
  br i1 %145, label %146, label %158

146:                                              ; preds = %136
  %147 = load ptr, ptr %3, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.sparticle, ptr %147, i32 0, i32 12
  store i32 0, ptr %148, align 4, !tbaa !28
  %149 = load double, ptr @zsize, align 8, !tbaa !15
  %150 = load ptr, ptr %3, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.sparticle, ptr %150, i32 0, i32 2
  %152 = load double, ptr %151, align 8, !tbaa !23
  %153 = fsub double %152, %149
  store double %153, ptr %151, align 8, !tbaa !23
  %154 = load ptr, ptr %3, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.sparticle, ptr %154, i32 0, i32 15
  %156 = load i32, ptr %155, align 8, !tbaa !31
  %157 = add nsw i32 %156, 1
  store i32 %157, ptr %155, align 8, !tbaa !31
  br label %158

158:                                              ; preds = %146, %136
  br label %234

159:                                              ; preds = %88
  %160 = load ptr, ptr %3, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct.sparticle, ptr %160, i32 0, i32 10
  %162 = load i32, ptr %161, align 4, !tbaa !26
  %163 = icmp eq i32 %162, 0
  br i1 %163, label %164, label %178

164:                                              ; preds = %159
  %165 = load i32, ptr @cx, align 4, !tbaa !14
  %166 = sub nsw i32 %165, 1
  %167 = load ptr, ptr %3, align 8, !tbaa !5
  %168 = getelementptr inbounds %struct.sparticle, ptr %167, i32 0, i32 10
  store i32 %166, ptr %168, align 4, !tbaa !26
  %169 = load double, ptr @xsize, align 8, !tbaa !15
  %170 = load ptr, ptr %3, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct.sparticle, ptr %170, i32 0, i32 0
  %172 = load double, ptr %171, align 8, !tbaa !19
  %173 = fadd double %172, %169
  store double %173, ptr %171, align 8, !tbaa !19
  %174 = load ptr, ptr %3, align 8, !tbaa !5
  %175 = getelementptr inbounds %struct.sparticle, ptr %174, i32 0, i32 13
  %176 = load i32, ptr %175, align 8, !tbaa !29
  %177 = add nsw i32 %176, -1
  store i32 %177, ptr %175, align 8, !tbaa !29
  br label %183

178:                                              ; preds = %159
  %179 = load ptr, ptr %3, align 8, !tbaa !5
  %180 = getelementptr inbounds %struct.sparticle, ptr %179, i32 0, i32 10
  %181 = load i32, ptr %180, align 4, !tbaa !26
  %182 = add nsw i32 %181, -1
  store i32 %182, ptr %180, align 4, !tbaa !26
  br label %183

183:                                              ; preds = %178, %164
  br label %234

184:                                              ; preds = %88
  %185 = load ptr, ptr %3, align 8, !tbaa !5
  %186 = getelementptr inbounds %struct.sparticle, ptr %185, i32 0, i32 11
  %187 = load i32, ptr %186, align 8, !tbaa !27
  %188 = icmp eq i32 %187, 0
  br i1 %188, label %189, label %203

189:                                              ; preds = %184
  %190 = load i32, ptr @cy, align 4, !tbaa !14
  %191 = sub nsw i32 %190, 1
  %192 = load ptr, ptr %3, align 8, !tbaa !5
  %193 = getelementptr inbounds %struct.sparticle, ptr %192, i32 0, i32 11
  store i32 %191, ptr %193, align 8, !tbaa !27
  %194 = load double, ptr @ysize, align 8, !tbaa !15
  %195 = load ptr, ptr %3, align 8, !tbaa !5
  %196 = getelementptr inbounds %struct.sparticle, ptr %195, i32 0, i32 1
  %197 = load double, ptr %196, align 8, !tbaa !21
  %198 = fadd double %197, %194
  store double %198, ptr %196, align 8, !tbaa !21
  %199 = load ptr, ptr %3, align 8, !tbaa !5
  %200 = getelementptr inbounds %struct.sparticle, ptr %199, i32 0, i32 14
  %201 = load i32, ptr %200, align 4, !tbaa !30
  %202 = add nsw i32 %201, -1
  store i32 %202, ptr %200, align 4, !tbaa !30
  br label %208

203:                                              ; preds = %184
  %204 = load ptr, ptr %3, align 8, !tbaa !5
  %205 = getelementptr inbounds %struct.sparticle, ptr %204, i32 0, i32 11
  %206 = load i32, ptr %205, align 8, !tbaa !27
  %207 = add nsw i32 %206, -1
  store i32 %207, ptr %205, align 8, !tbaa !27
  br label %208

208:                                              ; preds = %203, %189
  br label %234

209:                                              ; preds = %88
  %210 = load ptr, ptr %3, align 8, !tbaa !5
  %211 = getelementptr inbounds %struct.sparticle, ptr %210, i32 0, i32 12
  %212 = load i32, ptr %211, align 4, !tbaa !28
  %213 = icmp eq i32 %212, 0
  br i1 %213, label %214, label %228

214:                                              ; preds = %209
  %215 = load i32, ptr @cz, align 4, !tbaa !14
  %216 = sub nsw i32 %215, 1
  %217 = load ptr, ptr %3, align 8, !tbaa !5
  %218 = getelementptr inbounds %struct.sparticle, ptr %217, i32 0, i32 12
  store i32 %216, ptr %218, align 4, !tbaa !28
  %219 = load double, ptr @zsize, align 8, !tbaa !15
  %220 = load ptr, ptr %3, align 8, !tbaa !5
  %221 = getelementptr inbounds %struct.sparticle, ptr %220, i32 0, i32 2
  %222 = load double, ptr %221, align 8, !tbaa !23
  %223 = fadd double %222, %219
  store double %223, ptr %221, align 8, !tbaa !23
  %224 = load ptr, ptr %3, align 8, !tbaa !5
  %225 = getelementptr inbounds %struct.sparticle, ptr %224, i32 0, i32 15
  %226 = load i32, ptr %225, align 8, !tbaa !31
  %227 = add nsw i32 %226, -1
  store i32 %227, ptr %225, align 8, !tbaa !31
  br label %233

228:                                              ; preds = %209
  %229 = load ptr, ptr %3, align 8, !tbaa !5
  %230 = getelementptr inbounds %struct.sparticle, ptr %229, i32 0, i32 12
  %231 = load i32, ptr %230, align 4, !tbaa !28
  %232 = add nsw i32 %231, -1
  store i32 %232, ptr %230, align 4, !tbaa !28
  br label %233

233:                                              ; preds = %228, %214
  br label %234

234:                                              ; preds = %233, %208, %183, %158, %135, %112, %88
  %235 = load ptr, ptr %3, align 8, !tbaa !5
  %236 = getelementptr inbounds %struct.sparticle, ptr %235, i32 0, i32 17
  store ptr null, ptr %236, align 8, !tbaa !24
  %237 = load ptr, ptr %3, align 8, !tbaa !5
  %238 = getelementptr inbounds %struct.sparticle, ptr %237, i32 0, i32 10
  %239 = load i32, ptr %238, align 4, !tbaa !26
  %240 = sext i32 %239 to i64
  %241 = getelementptr inbounds [75 x [75 x [75 x ptr]]], ptr @celllist, i64 0, i64 %240
  %242 = load ptr, ptr %3, align 8, !tbaa !5
  %243 = getelementptr inbounds %struct.sparticle, ptr %242, i32 0, i32 11
  %244 = load i32, ptr %243, align 8, !tbaa !27
  %245 = sext i32 %244 to i64
  %246 = getelementptr inbounds [75 x [75 x ptr]], ptr %241, i64 0, i64 %245
  %247 = load ptr, ptr %3, align 8, !tbaa !5
  %248 = getelementptr inbounds %struct.sparticle, ptr %247, i32 0, i32 12
  %249 = load i32, ptr %248, align 4, !tbaa !28
  %250 = sext i32 %249 to i64
  %251 = getelementptr inbounds [75 x ptr], ptr %246, i64 0, i64 %250
  %252 = load ptr, ptr %251, align 8, !tbaa !5
  %253 = load ptr, ptr %3, align 8, !tbaa !5
  %254 = getelementptr inbounds %struct.sparticle, ptr %253, i32 0, i32 18
  store ptr %252, ptr %254, align 8, !tbaa !25
  %255 = load ptr, ptr %3, align 8, !tbaa !5
  %256 = load ptr, ptr %3, align 8, !tbaa !5
  %257 = getelementptr inbounds %struct.sparticle, ptr %256, i32 0, i32 10
  %258 = load i32, ptr %257, align 4, !tbaa !26
  %259 = sext i32 %258 to i64
  %260 = getelementptr inbounds [75 x [75 x [75 x ptr]]], ptr @celllist, i64 0, i64 %259
  %261 = load ptr, ptr %3, align 8, !tbaa !5
  %262 = getelementptr inbounds %struct.sparticle, ptr %261, i32 0, i32 11
  %263 = load i32, ptr %262, align 8, !tbaa !27
  %264 = sext i32 %263 to i64
  %265 = getelementptr inbounds [75 x [75 x ptr]], ptr %260, i64 0, i64 %264
  %266 = load ptr, ptr %3, align 8, !tbaa !5
  %267 = getelementptr inbounds %struct.sparticle, ptr %266, i32 0, i32 12
  %268 = load i32, ptr %267, align 4, !tbaa !28
  %269 = sext i32 %268 to i64
  %270 = getelementptr inbounds [75 x ptr], ptr %265, i64 0, i64 %269
  store ptr %255, ptr %270, align 8, !tbaa !5
  %271 = load ptr, ptr %3, align 8, !tbaa !5
  %272 = getelementptr inbounds %struct.sparticle, ptr %271, i32 0, i32 18
  %273 = load ptr, ptr %272, align 8, !tbaa !25
  %274 = icmp ne ptr %273, null
  br i1 %274, label %275, label %281

275:                                              ; preds = %234
  %276 = load ptr, ptr %3, align 8, !tbaa !5
  %277 = load ptr, ptr %3, align 8, !tbaa !5
  %278 = getelementptr inbounds %struct.sparticle, ptr %277, i32 0, i32 18
  %279 = load ptr, ptr %278, align 8, !tbaa !25
  %280 = getelementptr inbounds %struct.sparticle, ptr %279, i32 0, i32 17
  store ptr %276, ptr %280, align 8, !tbaa !24
  br label %281

281:                                              ; preds = %275, %234
  %282 = load ptr, ptr %3, align 8, !tbaa !5
  %283 = getelementptr inbounds %struct.sparticle, ptr %282, i32 0, i32 10
  %284 = load i32, ptr %283, align 4, !tbaa !26
  %285 = icmp eq i32 %284, 0
  br i1 %285, label %317, label %286

286:                                              ; preds = %281
  %287 = load ptr, ptr %3, align 8, !tbaa !5
  %288 = getelementptr inbounds %struct.sparticle, ptr %287, i32 0, i32 11
  %289 = load i32, ptr %288, align 8, !tbaa !27
  %290 = icmp eq i32 %289, 0
  br i1 %290, label %317, label %291

291:                                              ; preds = %286
  %292 = load ptr, ptr %3, align 8, !tbaa !5
  %293 = getelementptr inbounds %struct.sparticle, ptr %292, i32 0, i32 12
  %294 = load i32, ptr %293, align 4, !tbaa !28
  %295 = icmp eq i32 %294, 0
  br i1 %295, label %317, label %296

296:                                              ; preds = %291
  %297 = load ptr, ptr %3, align 8, !tbaa !5
  %298 = getelementptr inbounds %struct.sparticle, ptr %297, i32 0, i32 10
  %299 = load i32, ptr %298, align 4, !tbaa !26
  %300 = load i32, ptr @cx, align 4, !tbaa !14
  %301 = sub nsw i32 %300, 1
  %302 = icmp eq i32 %299, %301
  br i1 %302, label %317, label %303

303:                                              ; preds = %296
  %304 = load ptr, ptr %3, align 8, !tbaa !5
  %305 = getelementptr inbounds %struct.sparticle, ptr %304, i32 0, i32 11
  %306 = load i32, ptr %305, align 8, !tbaa !27
  %307 = load i32, ptr @cy, align 4, !tbaa !14
  %308 = sub nsw i32 %307, 1
  %309 = icmp eq i32 %306, %308
  br i1 %309, label %317, label %310

310:                                              ; preds = %303
  %311 = load ptr, ptr %3, align 8, !tbaa !5
  %312 = getelementptr inbounds %struct.sparticle, ptr %311, i32 0, i32 12
  %313 = load i32, ptr %312, align 4, !tbaa !28
  %314 = load i32, ptr @cz, align 4, !tbaa !14
  %315 = sub nsw i32 %314, 1
  %316 = icmp eq i32 %313, %315
  br label %317

317:                                              ; preds = %310, %303, %296, %291, %286, %281
  %318 = phi i1 [ true, %303 ], [ true, %296 ], [ true, %291 ], [ true, %286 ], [ true, %281 ], [ %316, %310 ]
  %319 = zext i1 %318 to i32
  %320 = trunc i32 %319 to i8
  %321 = load ptr, ptr %3, align 8, !tbaa !5
  %322 = getelementptr inbounds %struct.sparticle, ptr %321, i32 0, i32 9
  store i8 %320, ptr %322, align 8, !tbaa !32
  %323 = load ptr, ptr %2, align 8, !tbaa !5
  call void @removeevent(ptr noundef %323)
  %324 = load ptr, ptr %3, align 8, !tbaa !5
  call void @findcrossing(ptr noundef %324)
  %325 = load ptr, ptr %3, align 8, !tbaa !5
  %326 = load i32, ptr %4, align 4, !tbaa !14
  call void @findcollisioncell(ptr noundef %325, i32 noundef %326)
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local void @findcollisioncell(ptr noundef, i32 noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { 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 #3 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 32}
!10 = !{!"sevent", !11, 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, !12, i64 80, !12, i64 84}
!11 = !{!"double", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!10, !12, i64 80}
!14 = !{!12, !12, i64 0}
!15 = !{!11, !11, i64 0}
!16 = !{!17, !11, i64 48}
!17 = !{!"sparticle", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !11, i64 56, !11, i64 64, !7, i64 72, !12, i64 76, !12, i64 80, !12, i64 84, !12, i64 88, !12, i64 92, !12, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !7, i64 128}
!18 = !{!17, !11, i64 24}
!19 = !{!17, !11, i64 0}
!20 = !{!17, !11, i64 32}
!21 = !{!17, !11, i64 8}
!22 = !{!17, !11, i64 40}
!23 = !{!17, !11, i64 16}
!24 = !{!17, !6, i64 112}
!25 = !{!17, !6, i64 120}
!26 = !{!17, !12, i64 76}
!27 = !{!17, !12, i64 80}
!28 = !{!17, !12, i64 84}
!29 = !{!17, !12, i64 88}
!30 = !{!17, !12, i64 92}
!31 = !{!17, !12, i64 96}
!32 = !{!17, !7, i64 72}


; 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"

@simtime = external dso_local local_unnamed_addr global double, 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
@cx = external dso_local local_unnamed_addr global i32, align 4
@cy = external dso_local local_unnamed_addr global i32, align 4
@cz = external dso_local local_unnamed_addr global i32, align 4
@celllist = external dso_local local_unnamed_addr global [75 x [75 x [75 x ptr]]], align 16

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @cellcross(ptr noundef %0) local_unnamed_addr #1 {
  %2 = getelementptr inbounds i8, ptr %0, i64 32
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 80
  %5 = load i32, ptr %4, align 8, !tbaa !12
  %6 = load double, ptr @simtime, align 8, !tbaa !13
  %7 = getelementptr inbounds i8, ptr %3, i64 48
  %8 = load double, ptr %7, align 8, !tbaa !14
  %9 = fsub double %6, %8
  %10 = getelementptr inbounds i8, ptr %3, i64 24
  %11 = getelementptr inbounds i8, ptr %3, i64 8
  %12 = load <2 x double>, ptr %10, align 8, !tbaa !13
  %13 = load <2 x double>, ptr %3, align 8, !tbaa !13
  %14 = insertelement <2 x double> poison, double %9, i64 0
  %15 = shufflevector <2 x double> %14, <2 x double> poison, <2 x i32> zeroinitializer
  %16 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %15, <2 x double> %12, <2 x double> %13)
  store <2 x double> %16, ptr %3, align 8, !tbaa !13
  %17 = getelementptr inbounds i8, ptr %3, i64 40
  %18 = load double, ptr %17, align 8, !tbaa !16
  %19 = getelementptr inbounds i8, ptr %3, i64 16
  %20 = load double, ptr %19, align 8, !tbaa !17
  %21 = tail call double @llvm.fmuladd.f64(double %9, double %18, double %20)
  store double %21, ptr %19, align 8, !tbaa !17
  %22 = load double, ptr @simtime, align 8, !tbaa !13
  store double %22, ptr %7, align 8, !tbaa !14
  %23 = getelementptr inbounds i8, ptr %3, i64 112
  %24 = load ptr, ptr %23, align 8, !tbaa !18
  %.not = icmp eq ptr %24, null
  %25 = getelementptr inbounds i8, ptr %3, i64 120
  %26 = load ptr, ptr %25, align 8, !tbaa !19
  br i1 %.not, label %29, label %27

27:                                               ; preds = %1
  %28 = getelementptr inbounds i8, ptr %24, i64 120
  br label %40

29:                                               ; preds = %1
  %30 = getelementptr inbounds i8, ptr %3, i64 76
  %31 = load i32, ptr %30, align 4, !tbaa !20
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds i8, ptr %3, i64 80
  %34 = load i32, ptr %33, align 8, !tbaa !21
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds i8, ptr %3, i64 84
  %37 = load i32, ptr %36, align 4, !tbaa !22
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [75 x [75 x [75 x ptr]]], ptr @celllist, i64 0, i64 %32, i64 %35, i64 %38
  br label %40

40:                                               ; preds = %29, %27
  %.sink = phi ptr [ %39, %29 ], [ %28, %27 ]
  store ptr %26, ptr %.sink, align 8, !tbaa !23
  %41 = getelementptr inbounds i8, ptr %3, i64 120
  %.not84 = icmp eq ptr %26, null
  br i1 %.not84, label %45, label %42

42:                                               ; preds = %40
  %43 = load ptr, ptr %23, align 8, !tbaa !18
  %44 = getelementptr inbounds i8, ptr %26, i64 112
  store ptr %43, ptr %44, align 8, !tbaa !18
  br label %45

45:                                               ; preds = %42, %40
  switch i32 %5, label %128 [
    i32 1, label %46
    i32 2, label %59
    i32 3, label %72
    i32 -1, label %84
    i32 -2, label %99
    i32 -3, label %114
  ]

46:                                               ; preds = %45
  %47 = getelementptr inbounds i8, ptr %3, i64 76
  %48 = load i32, ptr %47, align 4, !tbaa !20
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %47, align 4, !tbaa !20
  %50 = load i32, ptr @cx, align 4, !tbaa !24
  %51 = icmp eq i32 %49, %50
  br i1 %51, label %52, label %128

52:                                               ; preds = %46
  store i32 0, ptr %47, align 4, !tbaa !20
  %53 = load double, ptr @xsize, align 8, !tbaa !13
  %54 = extractelement <2 x double> %16, i64 0
  %55 = fsub double %54, %53
  store double %55, ptr %3, align 8, !tbaa !25
  %56 = getelementptr inbounds i8, ptr %3, i64 88
  %57 = load i32, ptr %56, align 8, !tbaa !26
  %58 = add nsw i32 %57, 1
  store i32 %58, ptr %56, align 8, !tbaa !26
  br label %128

59:                                               ; preds = %45
  %60 = getelementptr inbounds i8, ptr %3, i64 80
  %61 = load i32, ptr %60, align 8, !tbaa !21
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr %60, align 8, !tbaa !21
  %63 = load i32, ptr @cy, align 4, !tbaa !24
  %64 = icmp eq i32 %62, %63
  br i1 %64, label %65, label %128

65:                                               ; preds = %59
  store i32 0, ptr %60, align 8, !tbaa !21
  %66 = load double, ptr @ysize, align 8, !tbaa !13
  %67 = extractelement <2 x double> %16, i64 1
  %68 = fsub double %67, %66
  store double %68, ptr %11, align 8, !tbaa !27
  %69 = getelementptr inbounds i8, ptr %3, i64 92
  %70 = load i32, ptr %69, align 4, !tbaa !28
  %71 = add nsw i32 %70, 1
  store i32 %71, ptr %69, align 4, !tbaa !28
  br label %128

72:                                               ; preds = %45
  %73 = getelementptr inbounds i8, ptr %3, i64 84
  %74 = load i32, ptr %73, align 4, !tbaa !22
  %75 = add nsw i32 %74, 1
  store i32 %75, ptr %73, align 4, !tbaa !22
  %76 = load i32, ptr @cz, align 4, !tbaa !24
  %77 = icmp eq i32 %75, %76
  br i1 %77, label %78, label %128

78:                                               ; preds = %72
  store i32 0, ptr %73, align 4, !tbaa !22
  %79 = load double, ptr @zsize, align 8, !tbaa !13
  %80 = fsub double %21, %79
  store double %80, ptr %19, align 8, !tbaa !17
  %81 = getelementptr inbounds i8, ptr %3, i64 96
  %82 = load i32, ptr %81, align 8, !tbaa !29
  %83 = add nsw i32 %82, 1
  store i32 %83, ptr %81, align 8, !tbaa !29
  br label %128

84:                                               ; preds = %45
  %85 = getelementptr inbounds i8, ptr %3, i64 76
  %86 = load i32, ptr %85, align 4, !tbaa !20
  %87 = icmp eq i32 %86, 0
  br i1 %87, label %88, label %97

88:                                               ; preds = %84
  %89 = load i32, ptr @cx, align 4, !tbaa !24
  %90 = add nsw i32 %89, -1
  store i32 %90, ptr %85, align 4, !tbaa !20
  %91 = load double, ptr @xsize, align 8, !tbaa !13
  %92 = extractelement <2 x double> %16, i64 0
  %93 = fadd double %92, %91
  store double %93, ptr %3, align 8, !tbaa !25
  %94 = getelementptr inbounds i8, ptr %3, i64 88
  %95 = load i32, ptr %94, align 8, !tbaa !26
  %96 = add nsw i32 %95, -1
  store i32 %96, ptr %94, align 8, !tbaa !26
  br label %128

97:                                               ; preds = %84
  %98 = add nsw i32 %86, -1
  store i32 %98, ptr %85, align 4, !tbaa !20
  br label %128

99:                                               ; preds = %45
  %100 = getelementptr inbounds i8, ptr %3, i64 80
  %101 = load i32, ptr %100, align 8, !tbaa !21
  %102 = icmp eq i32 %101, 0
  br i1 %102, label %103, label %112

103:                                              ; preds = %99
  %104 = load i32, ptr @cy, align 4, !tbaa !24
  %105 = add nsw i32 %104, -1
  store i32 %105, ptr %100, align 8, !tbaa !21
  %106 = load double, ptr @ysize, align 8, !tbaa !13
  %107 = extractelement <2 x double> %16, i64 1
  %108 = fadd double %107, %106
  store double %108, ptr %11, align 8, !tbaa !27
  %109 = getelementptr inbounds i8, ptr %3, i64 92
  %110 = load i32, ptr %109, align 4, !tbaa !28
  %111 = add nsw i32 %110, -1
  store i32 %111, ptr %109, align 4, !tbaa !28
  br label %128

112:                                              ; preds = %99
  %113 = add nsw i32 %101, -1
  store i32 %113, ptr %100, align 8, !tbaa !21
  br label %128

114:                                              ; preds = %45
  %115 = getelementptr inbounds i8, ptr %3, i64 84
  %116 = load i32, ptr %115, align 4, !tbaa !22
  %117 = icmp eq i32 %116, 0
  br i1 %117, label %118, label %126

118:                                              ; preds = %114
  %119 = load i32, ptr @cz, align 4, !tbaa !24
  %120 = add nsw i32 %119, -1
  store i32 %120, ptr %115, align 4, !tbaa !22
  %121 = load double, ptr @zsize, align 8, !tbaa !13
  %122 = fadd double %21, %121
  store double %122, ptr %19, align 8, !tbaa !17
  %123 = getelementptr inbounds i8, ptr %3, i64 96
  %124 = load i32, ptr %123, align 8, !tbaa !29
  %125 = add nsw i32 %124, -1
  store i32 %125, ptr %123, align 8, !tbaa !29
  br label %128

126:                                              ; preds = %114
  %127 = add nsw i32 %116, -1
  store i32 %127, ptr %115, align 4, !tbaa !22
  br label %128

128:                                              ; preds = %118, %126, %103, %112, %88, %97, %72, %78, %59, %65, %46, %52, %45
  store ptr null, ptr %23, align 8, !tbaa !18
  %129 = getelementptr inbounds i8, ptr %3, i64 76
  %130 = load i32, ptr %129, align 4, !tbaa !20
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds i8, ptr %3, i64 80
  %133 = load i32, ptr %132, align 8, !tbaa !21
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds i8, ptr %3, i64 84
  %136 = load i32, ptr %135, align 4, !tbaa !22
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [75 x [75 x [75 x ptr]]], ptr @celllist, i64 0, i64 %131, i64 %134, i64 %137
  %139 = load ptr, ptr %138, align 8, !tbaa !23
  store ptr %139, ptr %41, align 8, !tbaa !19
  store ptr %3, ptr %138, align 8, !tbaa !23
  %140 = load ptr, ptr %41, align 8, !tbaa !19
  %.not85 = icmp eq ptr %140, null
  br i1 %.not85, label %143, label %141

141:                                              ; preds = %128
  %142 = getelementptr inbounds i8, ptr %140, i64 112
  store ptr %3, ptr %142, align 8, !tbaa !18
  br label %143

143:                                              ; preds = %141, %128
  %144 = icmp eq i32 %130, 0
  %145 = icmp eq i32 %133, 0
  %or.cond = or i1 %144, %145
  %146 = icmp eq i32 %136, 0
  %or.cond86 = or i1 %or.cond, %146
  br i1 %or.cond86, label %160, label %147

147:                                              ; preds = %143
  %148 = load i32, ptr @cx, align 4, !tbaa !24
  %149 = add nsw i32 %148, -1
  %150 = icmp eq i32 %130, %149
  br i1 %150, label %160, label %151

151:                                              ; preds = %147
  %152 = load i32, ptr @cy, align 4, !tbaa !24
  %153 = add nsw i32 %152, -1
  %154 = icmp eq i32 %133, %153
  br i1 %154, label %160, label %155

155:                                              ; preds = %151
  %156 = load i32, ptr @cz, align 4, !tbaa !24
  %157 = add nsw i32 %156, -1
  %158 = icmp eq i32 %136, %157
  %159 = zext i1 %158 to i8
  br label %160

160:                                              ; preds = %155, %151, %147, %143
  %161 = phi i8 [ 1, %151 ], [ 1, %147 ], [ 1, %143 ], [ %159, %155 ]
  %162 = getelementptr inbounds i8, ptr %3, i64 72
  store i8 %161, ptr %162, align 8, !tbaa !30
  tail call void @removeevent(ptr noundef nonnull %0)
  tail call void @findcrossing(ptr noundef nonnull %3)
  tail call void @findcollisioncell(ptr noundef nonnull %3, i32 noundef %5)
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local void @findcollisioncell(ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !10, i64 32}
!6 = !{!"sevent", !7, 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, !10, i64 72, !11, i64 80, !11, i64 84}
!7 = !{!"double", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = !{!6, !11, i64 80}
!13 = !{!7, !7, i64 0}
!14 = !{!15, !7, i64 48}
!15 = !{!"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, !8, i64 72, !11, i64 76, !11, i64 80, !11, i64 84, !11, i64 88, !11, i64 92, !11, i64 96, !10, i64 104, !10, i64 112, !10, i64 120, !8, i64 128}
!16 = !{!15, !7, i64 40}
!17 = !{!15, !7, i64 16}
!18 = !{!15, !10, i64 112}
!19 = !{!15, !10, i64 120}
!20 = !{!15, !11, i64 76}
!21 = !{!15, !11, i64 80}
!22 = !{!15, !11, i64 84}
!23 = !{!10, !10, i64 0}
!24 = !{!11, !11, i64 0}
!25 = !{!15, !7, i64 0}
!26 = !{!15, !11, i64 88}
!27 = !{!15, !7, i64 8}
!28 = !{!15, !11, i64 92}
!29 = !{!15, !11, i64 96}
!30 = !{!15, !8, i64 72}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass