; LLVM IR from mesbahamin/star-sim :: src (sim)

; 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.SimState = type { i32, %struct.SimBounds, %struct.SimView, ptr, [100 x %struct.Star] }
%struct.SimBounds = type { float, float, float, float }
%struct.SimView = type { float, float, float }
%struct.Star = type { float, float, float, float, float, float, i32 }
%struct.QuadTree = type { ptr }

@BRUTE_FORCE = external dso_local global 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: nounwind uwtable
declare dso_local void @sim_bounding_box_update(ptr noundef, float noundef, float noundef, float noundef, float noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @sim_update(ptr noundef %0, i32 noundef %1, i32 noundef %2) #1 {
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca float, align 4
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  %10 = alloca float, align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  store i32 %2, ptr %6, align 4, !tbaa !9
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = icmp ne ptr %20, null
  br i1 %21, label %23, label %22

22:                                               ; preds = %3
  br label %272

23:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.SimState, ptr %24, i32 0, i32 1
  %26 = getelementptr inbounds %struct.SimBounds, ptr %25, i32 0, i32 0
  %27 = load float, ptr %26, align 4, !tbaa !11
  store float %27, ptr %7, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.SimState, ptr %28, i32 0, i32 1
  %30 = getelementptr inbounds %struct.SimBounds, ptr %29, i32 0, i32 0
  %31 = load float, ptr %30, align 4, !tbaa !11
  store float %31, ptr %8, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.SimState, ptr %32, i32 0, i32 1
  %34 = getelementptr inbounds %struct.SimBounds, ptr %33, i32 0, i32 1
  %35 = load float, ptr %34, align 4, !tbaa !17
  store float %35, ptr %9, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.SimState, ptr %36, i32 0, i32 1
  %38 = getelementptr inbounds %struct.SimBounds, ptr %37, i32 0, i32 1
  %39 = load float, ptr %38, align 4, !tbaa !17
  store float %39, ptr %10, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.SimState, ptr %40, i32 0, i32 0
  %42 = load i32, ptr %41, align 8, !tbaa !18
  store i32 %42, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.SimState, ptr %43, i32 0, i32 4
  %45 = getelementptr inbounds [100 x %struct.Star], ptr %44, i64 0, i64 0
  store ptr %45, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.SimState, ptr %46, i32 0, i32 3
  %48 = load ptr, ptr %47, align 8, !tbaa !19
  store ptr %48, ptr %13, align 8, !tbaa !5
  %49 = load i8, ptr @BRUTE_FORCE, align 1, !tbaa !20, !range !22, !noundef !23
  %50 = trunc i8 %49 to i1
  br i1 %50, label %51, label %82

51:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 0, ptr %14, align 4, !tbaa !9
  br label %52

52:                                               ; preds = %78, %51
  %53 = load i32, ptr %14, align 4, !tbaa !9
  %54 = load i32, ptr %11, align 4, !tbaa !9
  %55 = icmp slt i32 %53, %54
  br i1 %55, label %57, label %56

56:                                               ; preds = %52
  store i32 2, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %81

57:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  %58 = load i32, ptr %14, align 4, !tbaa !9
  %59 = add nsw i32 %58, 1
  store i32 %59, ptr %16, align 4, !tbaa !9
  br label %60

60:                                               ; preds = %74, %57
  %61 = load i32, ptr %16, align 4, !tbaa !9
  %62 = load i32, ptr %11, align 4, !tbaa !9
  %63 = icmp slt i32 %61, %62
  br i1 %63, label %65, label %64

64:                                               ; preds = %60
  store i32 5, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  br label %77

65:                                               ; preds = %60
  %66 = load ptr, ptr %12, align 8, !tbaa !5
  %67 = load i32, ptr %14, align 4, !tbaa !9
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds %struct.Star, ptr %66, i64 %68
  %70 = load ptr, ptr %12, align 8, !tbaa !5
  %71 = load i32, ptr %16, align 4, !tbaa !9
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds %struct.Star, ptr %70, i64 %72
  call void @star_attract(ptr noundef %69, ptr noundef %73)
  br label %74

74:                                               ; preds = %65
  %75 = load i32, ptr %16, align 4, !tbaa !9
  %76 = add nsw i32 %75, 1
  store i32 %76, ptr %16, align 4, !tbaa !9
  br label %60, !llvm.loop !24

77:                                               ; preds = %64
  br label %78

78:                                               ; preds = %77
  %79 = load i32, ptr %14, align 4, !tbaa !9
  %80 = add nsw i32 %79, 1
  store i32 %80, ptr %14, align 4, !tbaa !9
  br label %52, !llvm.loop !26

81:                                               ; preds = %56
  br label %141

82:                                               ; preds = %23
  %83 = load ptr, ptr %13, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.QuadTree, ptr %83, i32 0, i32 0
  %85 = load ptr, ptr %84, align 8, !tbaa !27
  call void @quad_tree_node_free(ptr noundef %85)
  %86 = load ptr, ptr %4, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.SimState, ptr %86, i32 0, i32 1
  %88 = getelementptr inbounds %struct.SimBounds, ptr %87, i32 0, i32 0
  %89 = load float, ptr %88, align 4, !tbaa !11
  %90 = load ptr, ptr %4, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.SimState, ptr %90, i32 0, i32 1
  %92 = getelementptr inbounds %struct.SimBounds, ptr %91, i32 0, i32 1
  %93 = load float, ptr %92, align 4, !tbaa !17
  %94 = load ptr, ptr %4, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.SimState, ptr %94, i32 0, i32 1
  %96 = getelementptr inbounds %struct.SimBounds, ptr %95, i32 0, i32 2
  %97 = load float, ptr %96, align 4, !tbaa !29
  %98 = fdiv float %97, 2.000000e+00
  %99 = load ptr, ptr %4, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.SimState, ptr %99, i32 0, i32 1
  %101 = getelementptr inbounds %struct.SimBounds, ptr %100, i32 0, i32 3
  %102 = load float, ptr %101, align 4, !tbaa !30
  %103 = fdiv float %102, 2.000000e+00
  %104 = call ptr @quad_tree_node_init(float noundef %89, float noundef %93, float noundef %98, float noundef %103)
  %105 = load ptr, ptr %13, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.QuadTree, ptr %105, i32 0, i32 0
  store ptr %104, ptr %106, align 8, !tbaa !27
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %107

107:                                              ; preds = %120, %82
  %108 = load i32, ptr %17, align 4, !tbaa !9
  %109 = load i32, ptr %11, align 4, !tbaa !9
  %110 = icmp slt i32 %108, %109
  br i1 %110, label %112, label %111

111:                                              ; preds = %107
  store i32 8, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  br label %123

112:                                              ; preds = %107
  %113 = load ptr, ptr %13, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.QuadTree, ptr %113, i32 0, i32 0
  %115 = load ptr, ptr %114, align 8, !tbaa !27
  %116 = load ptr, ptr %12, align 8, !tbaa !5
  %117 = load i32, ptr %17, align 4, !tbaa !9
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds %struct.Star, ptr %116, i64 %118
  call void @quad_tree_node_insert_star(ptr noundef %115, ptr noundef %119)
  br label %120

120:                                              ; preds = %112
  %121 = load i32, ptr %17, align 4, !tbaa !9
  %122 = add nsw i32 %121, 1
  store i32 %122, ptr %17, align 4, !tbaa !9
  br label %107, !llvm.loop !31

123:                                              ; preds = %111
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  store i32 0, ptr %18, align 4, !tbaa !9
  br label %124

124:                                              ; preds = %137, %123
  %125 = load i32, ptr %18, align 4, !tbaa !9
  %126 = load i32, ptr %11, align 4, !tbaa !9
  %127 = icmp slt i32 %125, %126
  br i1 %127, label %129, label %128

128:                                              ; preds = %124
  store i32 11, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  br label %140

129:                                              ; preds = %124
  %130 = load ptr, ptr %13, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.QuadTree, ptr %130, i32 0, i32 0
  %132 = load ptr, ptr %131, align 8, !tbaa !27
  %133 = load ptr, ptr %12, align 8, !tbaa !5
  %134 = load i32, ptr %18, align 4, !tbaa !9
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds %struct.Star, ptr %133, i64 %135
  call void @quad_tree_calc_force_on_star(ptr noundef %132, ptr noundef %136)
  br label %137

137:                                              ; preds = %129
  %138 = load i32, ptr %18, align 4, !tbaa !9
  %139 = add nsw i32 %138, 1
  store i32 %139, ptr %18, align 4, !tbaa !9
  br label %124, !llvm.loop !32

140:                                              ; preds = %128
  br label %141

141:                                              ; preds = %140, %81
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #5
  store i32 0, ptr %19, align 4, !tbaa !9
  br label %142

142:                                              ; preds = %262, %141
  %143 = load i32, ptr %19, align 4, !tbaa !9
  %144 = load i32, ptr %11, align 4, !tbaa !9
  %145 = icmp slt i32 %143, %144
  br i1 %145, label %147, label %146

146:                                              ; preds = %142
  store i32 14, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  br label %265

147:                                              ; preds = %142
  %148 = load ptr, ptr %12, align 8, !tbaa !5
  %149 = load i32, ptr %19, align 4, !tbaa !9
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds %struct.Star, ptr %148, i64 %150
  %152 = getelementptr inbounds %struct.Star, ptr %151, i32 0, i32 0
  %153 = load float, ptr %152, align 4, !tbaa !33
  %154 = call float @sinf(float noundef %153) #5
  %155 = load ptr, ptr %12, align 8, !tbaa !5
  %156 = load i32, ptr %19, align 4, !tbaa !9
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds %struct.Star, ptr %155, i64 %157
  %159 = getelementptr inbounds %struct.Star, ptr %158, i32 0, i32 1
  %160 = load float, ptr %159, align 4, !tbaa !35
  %161 = load ptr, ptr %12, align 8, !tbaa !5
  %162 = load i32, ptr %19, align 4, !tbaa !9
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds %struct.Star, ptr %161, i64 %163
  %165 = getelementptr inbounds %struct.Star, ptr %164, i32 0, i32 4
  %166 = load float, ptr %165, align 4, !tbaa !36
  %167 = call float @llvm.fmuladd.f32(float %154, float %160, float %166)
  store float %167, ptr %165, align 4, !tbaa !36
  %168 = load ptr, ptr %12, align 8, !tbaa !5
  %169 = load i32, ptr %19, align 4, !tbaa !9
  %170 = sext i32 %169 to i64
  %171 = getelementptr inbounds %struct.Star, ptr %168, i64 %170
  %172 = getelementptr inbounds %struct.Star, ptr %171, i32 0, i32 0
  %173 = load float, ptr %172, align 4, !tbaa !33
  %174 = call float @cosf(float noundef %173) #5
  %175 = load ptr, ptr %12, align 8, !tbaa !5
  %176 = load i32, ptr %19, align 4, !tbaa !9
  %177 = sext i32 %176 to i64
  %178 = getelementptr inbounds %struct.Star, ptr %175, i64 %177
  %179 = getelementptr inbounds %struct.Star, ptr %178, i32 0, i32 1
  %180 = load float, ptr %179, align 4, !tbaa !35
  %181 = load ptr, ptr %12, align 8, !tbaa !5
  %182 = load i32, ptr %19, align 4, !tbaa !9
  %183 = sext i32 %182 to i64
  %184 = getelementptr inbounds %struct.Star, ptr %181, i64 %183
  %185 = getelementptr inbounds %struct.Star, ptr %184, i32 0, i32 5
  %186 = load float, ptr %185, align 4, !tbaa !37
  %187 = fneg float %174
  %188 = call float @llvm.fmuladd.f32(float %187, float %180, float %186)
  store float %188, ptr %185, align 4, !tbaa !37
  %189 = load ptr, ptr %12, align 8, !tbaa !5
  %190 = load i32, ptr %19, align 4, !tbaa !9
  %191 = sext i32 %190 to i64
  %192 = getelementptr inbounds %struct.Star, ptr %189, i64 %191
  %193 = getelementptr inbounds %struct.Star, ptr %192, i32 0, i32 1
  %194 = load float, ptr %193, align 4, !tbaa !35
  %195 = fmul float %194, 1.000000e+00
  store float %195, ptr %193, align 4, !tbaa !35
  %196 = load ptr, ptr %12, align 8, !tbaa !5
  %197 = load i32, ptr %19, align 4, !tbaa !9
  %198 = sext i32 %197 to i64
  %199 = getelementptr inbounds %struct.Star, ptr %196, i64 %198
  %200 = getelementptr inbounds %struct.Star, ptr %199, i32 0, i32 4
  %201 = load float, ptr %200, align 4, !tbaa !36
  %202 = load float, ptr %7, align 4, !tbaa !16
  %203 = fcmp ole float %201, %202
  br i1 %203, label %204, label %211

204:                                              ; preds = %147
  %205 = load ptr, ptr %12, align 8, !tbaa !5
  %206 = load i32, ptr %19, align 4, !tbaa !9
  %207 = sext i32 %206 to i64
  %208 = getelementptr inbounds %struct.Star, ptr %205, i64 %207
  %209 = getelementptr inbounds %struct.Star, ptr %208, i32 0, i32 4
  %210 = load float, ptr %209, align 4, !tbaa !36
  store float %210, ptr %7, align 4, !tbaa !16
  br label %228

211:                                              ; preds = %147
  %212 = load ptr, ptr %12, align 8, !tbaa !5
  %213 = load i32, ptr %19, align 4, !tbaa !9
  %214 = sext i32 %213 to i64
  %215 = getelementptr inbounds %struct.Star, ptr %212, i64 %214
  %216 = getelementptr inbounds %struct.Star, ptr %215, i32 0, i32 4
  %217 = load float, ptr %216, align 4, !tbaa !36
  %218 = load float, ptr %8, align 4, !tbaa !16
  %219 = fcmp oge float %217, %218
  br i1 %219, label %220, label %227

220:                                              ; preds = %211
  %221 = load ptr, ptr %12, align 8, !tbaa !5
  %222 = load i32, ptr %19, align 4, !tbaa !9
  %223 = sext i32 %222 to i64
  %224 = getelementptr inbounds %struct.Star, ptr %221, i64 %223
  %225 = getelementptr inbounds %struct.Star, ptr %224, i32 0, i32 4
  %226 = load float, ptr %225, align 4, !tbaa !36
  store float %226, ptr %8, align 4, !tbaa !16
  br label %227

227:                                              ; preds = %220, %211
  br label %228

228:                                              ; preds = %227, %204
  %229 = load ptr, ptr %12, align 8, !tbaa !5
  %230 = load i32, ptr %19, align 4, !tbaa !9
  %231 = sext i32 %230 to i64
  %232 = getelementptr inbounds %struct.Star, ptr %229, i64 %231
  %233 = getelementptr inbounds %struct.Star, ptr %232, i32 0, i32 5
  %234 = load float, ptr %233, align 4, !tbaa !37
  %235 = load float, ptr %9, align 4, !tbaa !16
  %236 = fcmp ole float %234, %235
  br i1 %236, label %237, label %244

237:                                              ; preds = %228
  %238 = load ptr, ptr %12, align 8, !tbaa !5
  %239 = load i32, ptr %19, align 4, !tbaa !9
  %240 = sext i32 %239 to i64
  %241 = getelementptr inbounds %struct.Star, ptr %238, i64 %240
  %242 = getelementptr inbounds %struct.Star, ptr %241, i32 0, i32 5
  %243 = load float, ptr %242, align 4, !tbaa !37
  store float %243, ptr %9, align 4, !tbaa !16
  br label %261

244:                                              ; preds = %228
  %245 = load ptr, ptr %12, align 8, !tbaa !5
  %246 = load i32, ptr %19, align 4, !tbaa !9
  %247 = sext i32 %246 to i64
  %248 = getelementptr inbounds %struct.Star, ptr %245, i64 %247
  %249 = getelementptr inbounds %struct.Star, ptr %248, i32 0, i32 5
  %250 = load float, ptr %249, align 4, !tbaa !37
  %251 = load float, ptr %10, align 4, !tbaa !16
  %252 = fcmp oge float %250, %251
  br i1 %252, label %253, label %260

253:                                              ; preds = %244
  %254 = load ptr, ptr %12, align 8, !tbaa !5
  %255 = load i32, ptr %19, align 4, !tbaa !9
  %256 = sext i32 %255 to i64
  %257 = getelementptr inbounds %struct.Star, ptr %254, i64 %256
  %258 = getelementptr inbounds %struct.Star, ptr %257, i32 0, i32 5
  %259 = load float, ptr %258, align 4, !tbaa !37
  store float %259, ptr %10, align 4, !tbaa !16
  br label %260

260:                                              ; preds = %253, %244
  br label %261

261:                                              ; preds = %260, %237
  br label %262

262:                                              ; preds = %261
  %263 = load i32, ptr %19, align 4, !tbaa !9
  %264 = add nsw i32 %263, 1
  store i32 %264, ptr %19, align 4, !tbaa !9
  br label %142, !llvm.loop !38

265:                                              ; preds = %146
  %266 = load ptr, ptr %4, align 8, !tbaa !5
  %267 = getelementptr inbounds %struct.SimState, ptr %266, i32 0, i32 1
  %268 = load float, ptr %7, align 4, !tbaa !16
  %269 = load float, ptr %9, align 4, !tbaa !16
  %270 = load float, ptr %8, align 4, !tbaa !16
  %271 = load float, ptr %10, align 4, !tbaa !16
  call void @sim_bounding_box_update(ptr noundef %267, float noundef %268, float noundef %269, float noundef %270, float noundef %271)
  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 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, 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
  br label %272

272:                                              ; preds = %265, %22
  ret void
}

declare void @star_attract(ptr noundef, ptr noundef) #2

declare void @quad_tree_node_free(ptr noundef) #2

declare ptr @quad_tree_node_init(float noundef, float noundef, float noundef, float noundef) #2

declare void @quad_tree_node_insert_star(ptr noundef, ptr noundef) #2

declare void @quad_tree_calc_force_on_star(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind
declare float @sinf(float noundef) #3

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

; Function Attrs: nounwind
declare float @cosf(float noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 #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 = !{!"any pointer", !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, !14, i64 4}
!12 = !{!"SimState", !10, i64 0, !13, i64 4, !15, i64 20, !6, i64 32, !7, i64 40}
!13 = !{!"SimBounds", !14, i64 0, !14, i64 4, !14, i64 8, !14, i64 12}
!14 = !{!"float", !7, i64 0}
!15 = !{!"SimView", !14, i64 0, !14, i64 4, !14, i64 8}
!16 = !{!14, !14, i64 0}
!17 = !{!12, !14, i64 8}
!18 = !{!12, !10, i64 0}
!19 = !{!12, !6, i64 32}
!20 = !{!21, !21, i64 0}
!21 = !{!"_Bool", !7, i64 0}
!22 = !{i8 0, i8 2}
!23 = !{}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = distinct !{!26, !25}
!27 = !{!28, !6, i64 0}
!28 = !{!"QuadTree", !6, i64 0}
!29 = !{!12, !14, i64 12}
!30 = !{!12, !14, i64 16}
!31 = distinct !{!31, !25}
!32 = distinct !{!32, !25}
!33 = !{!34, !14, i64 0}
!34 = !{!"Star", !14, i64 0, !14, i64 4, !14, i64 8, !14, i64 12, !14, i64 16, !14, i64 20, !10, i64 24}
!35 = !{!34, !14, i64 4}
!36 = !{!34, !14, i64 16}
!37 = !{!34, !14, i64 20}
!38 = distinct !{!38, !25}


; 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.Star = type { float, float, float, float, float, float, i32 }

@BRUTE_FORCE = external dso_local local_unnamed_addr global i8, align 1

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

; Function Attrs: nounwind uwtable
define dso_local void @sim_update(ptr noundef %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #0 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %64, label %4

4:                                                ; preds = %3
  %5 = getelementptr inbounds i8, ptr %0, i64 4
  %6 = load float, ptr %5, align 4, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %0, i64 8
  %8 = load float, ptr %7, align 4, !tbaa !14
  %9 = load i32, ptr %0, align 8, !tbaa !15
  %10 = getelementptr inbounds i8, ptr %0, i64 40
  %11 = getelementptr inbounds i8, ptr %0, i64 32
  %12 = load ptr, ptr %11, align 8, !tbaa !16
  %13 = load i8, ptr @BRUTE_FORCE, align 1, !tbaa !17, !range !19, !noundef !20
  %14 = trunc nuw i8 %13 to i1
  br i1 %14, label %.preheader, label %21

.preheader:                                       ; preds = %4
  %15 = icmp sgt i32 %9, 0
  br i1 %15, label %.lr.ph105.preheader, label %._crit_edge

.lr.ph105.preheader:                              ; preds = %.preheader
  %16 = zext nneg i32 %9 to i64
  %wide.trip.count132 = zext nneg i32 %9 to i64
  br label %.lr.ph105

.loopexit:                                        ; preds = %19, %.lr.ph105
  %indvars.iv.next123 = add nuw nsw i64 %indvars.iv122, 1
  %exitcond133.not = icmp eq i64 %indvars.iv.next130, %wide.trip.count132
  br i1 %exitcond133.not, label %.loopexit96, label %.lr.ph105, !llvm.loop !21

.lr.ph105:                                        ; preds = %.lr.ph105.preheader, %.loopexit
  %indvars.iv129 = phi i64 [ 0, %.lr.ph105.preheader ], [ %indvars.iv.next130, %.loopexit ]
  %indvars.iv122 = phi i64 [ 1, %.lr.ph105.preheader ], [ %indvars.iv.next123, %.loopexit ]
  %indvars.iv.next130 = add nuw nsw i64 %indvars.iv129, 1
  %17 = icmp ult i64 %indvars.iv.next130, %16
  br i1 %17, label %.lr.ph103, label %.loopexit

.lr.ph103:                                        ; preds = %.lr.ph105
  %18 = getelementptr inbounds %struct.Star, ptr %10, i64 %indvars.iv129
  br label %19

19:                                               ; preds = %.lr.ph103, %19
  %indvars.iv124 = phi i64 [ %indvars.iv122, %.lr.ph103 ], [ %indvars.iv.next125, %19 ]
  %20 = getelementptr inbounds %struct.Star, ptr %10, i64 %indvars.iv124
  tail call void @star_attract(ptr noundef nonnull %18, ptr noundef nonnull %20) #4
  %indvars.iv.next125 = add nuw nsw i64 %indvars.iv124, 1
  %exitcond128.not = icmp eq i64 %indvars.iv.next125, %wide.trip.count132
  br i1 %exitcond128.not, label %.loopexit, label %19, !llvm.loop !23

21:                                               ; preds = %4
  %22 = load ptr, ptr %12, align 8, !tbaa !24
  tail call void @quad_tree_node_free(ptr noundef %22) #4
  %23 = load float, ptr %5, align 4, !tbaa !5
  %24 = load float, ptr %7, align 4, !tbaa !14
  %25 = getelementptr inbounds i8, ptr %0, i64 12
  %26 = load float, ptr %25, align 4, !tbaa !26
  %27 = fmul float %26, 5.000000e-01
  %28 = getelementptr inbounds i8, ptr %0, i64 16
  %29 = load float, ptr %28, align 4, !tbaa !27
  %30 = fmul float %29, 5.000000e-01
  %31 = tail call ptr @quad_tree_node_init(float noundef %23, float noundef %24, float noundef %27, float noundef %30) #4
  store ptr %31, ptr %12, align 8, !tbaa !24
  %32 = icmp sgt i32 %9, 0
  br i1 %32, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %21
  %wide.trip.count = zext nneg i32 %9 to i64
  br label %.lr.ph

.preheader97:                                     ; preds = %.lr.ph
  br i1 %32, label %.lr.ph101.preheader, label %._crit_edge

.lr.ph101.preheader:                              ; preds = %.preheader97
  %wide.trip.count120 = zext nneg i32 %9 to i64
  br label %.lr.ph101

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %33 = load ptr, ptr %12, align 8, !tbaa !24
  %34 = getelementptr inbounds %struct.Star, ptr %10, i64 %indvars.iv
  tail call void @quad_tree_node_insert_star(ptr noundef %33, ptr noundef nonnull %34) #4
  %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 %.preheader97, label %.lr.ph, !llvm.loop !28

.lr.ph101:                                        ; preds = %.lr.ph101.preheader, %.lr.ph101
  %indvars.iv117 = phi i64 [ 0, %.lr.ph101.preheader ], [ %indvars.iv.next118, %.lr.ph101 ]
  %35 = load ptr, ptr %12, align 8, !tbaa !24
  %36 = getelementptr inbounds %struct.Star, ptr %10, i64 %indvars.iv117
  tail call void @quad_tree_calc_force_on_star(ptr noundef %35, ptr noundef nonnull %36) #4
  %indvars.iv.next118 = add nuw nsw i64 %indvars.iv117, 1
  %exitcond121.not = icmp eq i64 %indvars.iv.next118, %wide.trip.count120
  br i1 %exitcond121.not, label %.loopexit96, label %.lr.ph101, !llvm.loop !29

.loopexit96:                                      ; preds = %.lr.ph101, %.loopexit
  %37 = icmp sgt i32 %9, 0
  br i1 %37, label %.lr.ph111.preheader, label %._crit_edge

.lr.ph111.preheader:                              ; preds = %.loopexit96
  %wide.trip.count137 = zext nneg i32 %9 to i64
  br label %.lr.ph111

._crit_edge:                                      ; preds = %63, %21, %.preheader, %.preheader97, %.loopexit96
  %.087.lcssa = phi float [ %8, %.loopexit96 ], [ %8, %.preheader97 ], [ %8, %.preheader ], [ %8, %21 ], [ %.188, %63 ]
  %.085.lcssa = phi float [ %8, %.loopexit96 ], [ %8, %.preheader97 ], [ %8, %.preheader ], [ %8, %21 ], [ %.186, %63 ]
  %.083.lcssa = phi float [ %6, %.loopexit96 ], [ %6, %.preheader97 ], [ %6, %.preheader ], [ %6, %21 ], [ %.184, %63 ]
  %.082.lcssa = phi float [ %6, %.loopexit96 ], [ %6, %.preheader97 ], [ %6, %.preheader ], [ %6, %21 ], [ %.1, %63 ]
  tail call void @sim_bounding_box_update(ptr noundef nonnull %5, float noundef %.082.lcssa, float noundef %.085.lcssa, float noundef %.083.lcssa, float noundef %.087.lcssa)
  br label %64

.lr.ph111:                                        ; preds = %.lr.ph111.preheader, %63
  %indvars.iv134 = phi i64 [ 0, %.lr.ph111.preheader ], [ %indvars.iv.next135, %63 ]
  %.082109 = phi float [ %6, %.lr.ph111.preheader ], [ %.1, %63 ]
  %.083108 = phi float [ %6, %.lr.ph111.preheader ], [ %.184, %63 ]
  %.085107 = phi float [ %8, %.lr.ph111.preheader ], [ %.186, %63 ]
  %.087106 = phi float [ %8, %.lr.ph111.preheader ], [ %.188, %63 ]
  %38 = getelementptr inbounds %struct.Star, ptr %10, i64 %indvars.iv134
  %39 = load float, ptr %38, align 4, !tbaa !30
  %40 = tail call float @sinf(float noundef %39) #4
  %41 = getelementptr inbounds i8, ptr %38, i64 4
  %42 = load float, ptr %41, align 4, !tbaa !32
  %43 = getelementptr inbounds i8, ptr %38, i64 16
  %44 = load float, ptr %43, align 4, !tbaa !33
  %45 = tail call float @llvm.fmuladd.f32(float %40, float %42, float %44)
  store float %45, ptr %43, align 4, !tbaa !33
  %46 = load float, ptr %38, align 4, !tbaa !30
  %47 = tail call float @cosf(float noundef %46) #4
  %48 = load float, ptr %41, align 4, !tbaa !32
  %49 = getelementptr inbounds i8, ptr %38, i64 20
  %50 = load float, ptr %49, align 4, !tbaa !34
  %51 = fneg float %47
  %52 = tail call float @llvm.fmuladd.f32(float %51, float %48, float %50)
  store float %52, ptr %49, align 4, !tbaa !34
  %53 = load float, ptr %43, align 4, !tbaa !33
  %54 = fcmp ugt float %53, %.082109
  br i1 %54, label %55, label %58

55:                                               ; preds = %.lr.ph111
  %56 = fcmp ult float %53, %.083108
  br i1 %56, label %58, label %57

57:                                               ; preds = %55
  br label %58

58:                                               ; preds = %.lr.ph111, %55, %57
  %.184 = phi float [ %53, %57 ], [ %.083108, %55 ], [ %.083108, %.lr.ph111 ]
  %.1 = phi float [ %.082109, %57 ], [ %.082109, %55 ], [ %53, %.lr.ph111 ]
  %59 = fcmp ugt float %52, %.085107
  br i1 %59, label %60, label %63

60:                                               ; preds = %58
  %61 = fcmp ult float %52, %.087106
  br i1 %61, label %63, label %62

62:                                               ; preds = %60
  br label %63

63:                                               ; preds = %58, %62, %60
  %.188 = phi float [ %52, %62 ], [ %.087106, %60 ], [ %.087106, %58 ]
  %.186 = phi float [ %.085107, %62 ], [ %.085107, %60 ], [ %52, %58 ]
  %indvars.iv.next135 = add nuw nsw i64 %indvars.iv134, 1
  %exitcond138.not = icmp eq i64 %indvars.iv.next135, %wide.trip.count137
  br i1 %exitcond138.not, label %._crit_edge, label %.lr.ph111, !llvm.loop !35

64:                                               ; preds = %3, %._crit_edge
  ret void
}

declare void @star_attract(ptr noundef, ptr noundef) local_unnamed_addr #1

declare void @quad_tree_node_free(ptr noundef) local_unnamed_addr #1

declare ptr @quad_tree_node_init(float noundef, float noundef, float noundef, float noundef) local_unnamed_addr #1

declare void @quad_tree_node_insert_star(ptr noundef, ptr noundef) local_unnamed_addr #1

declare void @quad_tree_calc_force_on_star(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare float @sinf(float noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #3

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare float @cosf(float noundef) local_unnamed_addr #2

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !11, i64 4}
!6 = !{!"SimState", !7, i64 0, !10, i64 4, !12, i64 20, !13, i64 32, !8, i64 40}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"SimBounds", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12}
!11 = !{!"float", !8, i64 0}
!12 = !{!"SimView", !11, i64 0, !11, i64 4, !11, i64 8}
!13 = !{!"any pointer", !8, i64 0}
!14 = !{!6, !11, i64 8}
!15 = !{!6, !7, i64 0}
!16 = !{!6, !13, i64 32}
!17 = !{!18, !18, i64 0}
!18 = !{!"_Bool", !8, i64 0}
!19 = !{i8 0, i8 2}
!20 = !{}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = distinct !{!23, !22}
!24 = !{!25, !13, i64 0}
!25 = !{!"QuadTree", !13, i64 0}
!26 = !{!6, !11, i64 12}
!27 = !{!6, !11, i64 16}
!28 = distinct !{!28, !22}
!29 = distinct !{!29, !22}
!30 = !{!31, !11, i64 0}
!31 = !{!"Star", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !7, i64 24}
!32 = !{!31, !11, i64 4}
!33 = !{!31, !11, i64 16}
!34 = !{!31, !11, i64 20}
!35 = distinct !{!35, !22}


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