; LLVM IR from ESPboy-edu/ESPboy_tinyphysicsengine :: programs (hello)

; 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.TPE_Vec3 = type { i32, i32, i32 }
%struct.TPE_World = type { ptr, i16, ptr, ptr }
%struct.TPE_Body = type { ptr, i8, ptr, i8, i16, i16, i16, i8, i8 }
%struct.TPE_Joint = type { %struct.TPE_Vec3, [3 x i16], i8 }
%struct.TPE_Connection = type { i8, i8, i16 }

@_TPE_collisionCallback = external dso_local global ptr, align 8
@_TPE_body1Index = external dso_local global i16, align 2
@_TPE_body2Index = external dso_local global i16, align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #0

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @TPE_vec3Len(i64, i32) #2

; Function Attrs: nounwind uwtable
define dso_local void @TPE_worldStep(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca i16, align 2
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca %struct.TPE_Vec3, align 4
  %9 = alloca i16, align 2
  %10 = alloca i8, align 1
  %11 = alloca ptr, align 8
  %12 = alloca %struct.TPE_Vec3, align 4
  %13 = alloca %struct.TPE_Vec3, align 4
  %14 = alloca i8, align 1
  %15 = alloca i8, align 1
  %16 = alloca %struct.TPE_Vec3, align 4
  %17 = alloca { i64, i32 }, align 4
  %18 = alloca { i64, i32 }, align 4
  %19 = alloca { i64, i32 }, align 8
  %20 = alloca { i64, i32 }, align 4
  %21 = alloca i32, align 4
  %22 = alloca i16, align 2
  %23 = alloca %struct.TPE_Vec3, align 4
  %24 = alloca { i64, i32 }, align 4
  %25 = alloca { i64, i32 }, align 4
  %26 = alloca { i64, i32 }, align 8
  %27 = alloca i32, align 4
  %28 = alloca { i64, i32 }, align 4
  %29 = alloca i8, align 1
  %30 = alloca i8, align 1
  %31 = alloca i16, align 2
  %32 = alloca %struct.TPE_Vec3, align 4
  %33 = alloca %struct.TPE_Vec3, align 8
  %34 = alloca { i64, i32 }, align 4
  %35 = alloca { i64, i32 }, align 4
  %36 = alloca { i64, i32 }, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %37 = load ptr, ptr %2, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.TPE_World, ptr %37, i32 0, i32 3
  %39 = load ptr, ptr %38, align 8, !tbaa !9
  store ptr %39, ptr @_TPE_collisionCallback, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 2, ptr %3) #4
  store i16 0, ptr %3, align 2, !tbaa !12
  br label %40

40:                                               ; preds = %575, %1
  %41 = load i16, ptr %3, align 2, !tbaa !12
  %42 = zext i16 %41 to i32
  %43 = load ptr, ptr %2, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.TPE_World, ptr %43, i32 0, i32 1
  %45 = load i16, ptr %44, align 8, !tbaa !13
  %46 = zext i16 %45 to i32
  %47 = icmp slt i32 %42, %46
  br i1 %47, label %49, label %48

48:                                               ; preds = %40
  store i32 2, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 2, ptr %3) #4
  br label %578

49:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %50 = load ptr, ptr %2, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.TPE_World, ptr %50, i32 0, i32 0
  %52 = load ptr, ptr %51, align 8, !tbaa !14
  %53 = load i16, ptr %3, align 2, !tbaa !12
  %54 = zext i16 %53 to i32
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds %struct.TPE_Body, ptr %52, i64 %55
  store ptr %56, ptr %5, align 8, !tbaa !5
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.TPE_Body, ptr %57, i32 0, i32 7
  %59 = load i8, ptr %58, align 8, !tbaa !15
  %60 = zext i8 %59 to i32
  %61 = and i32 %60, 5
  %62 = icmp ne i32 %61, 0
  br i1 %62, label %63, label %64

63:                                               ; preds = %49
  store i32 4, ptr %4, align 4
  br label %572

64:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.TPE_Body, ptr %65, i32 0, i32 0
  %67 = load ptr, ptr %66, align 8, !tbaa !17
  store ptr %67, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 12, ptr %8) #4
  %68 = load ptr, ptr %5, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.TPE_Body, ptr %68, i32 0, i32 0
  %70 = load ptr, ptr %69, align 8, !tbaa !17
  %71 = getelementptr inbounds %struct.TPE_Joint, ptr %70, i64 0
  %72 = getelementptr inbounds %struct.TPE_Joint, ptr %71, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %8, ptr align 4 %72, i64 12, i1 false), !tbaa.struct !18
  call void @llvm.lifetime.start.p0(i64 2, ptr %9) #4
  store i16 0, ptr %9, align 2, !tbaa !12
  br label %73

73:                                               ; preds = %147, %64
  %74 = load i16, ptr %9, align 2, !tbaa !12
  %75 = zext i16 %74 to i32
  %76 = load ptr, ptr %5, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.TPE_Body, ptr %76, i32 0, i32 1
  %78 = load i8, ptr %77, align 8, !tbaa !21
  %79 = zext i8 %78 to i32
  %80 = icmp slt i32 %75, %79
  br i1 %80, label %82, label %81

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

82:                                               ; preds = %73
  %83 = load ptr, ptr %5, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.TPE_Body, ptr %83, i32 0, i32 7
  %85 = load i8, ptr %84, align 8, !tbaa !15
  %86 = zext i8 %85 to i32
  %87 = and i32 %86, 2
  %88 = icmp ne i32 %87, 0
  br i1 %88, label %89, label %114

89:                                               ; preds = %82
  call void @llvm.lifetime.start.p0(i64 1, ptr %10) #4
  store i8 0, ptr %10, align 1, !tbaa !22
  br label %90

90:                                               ; preds = %110, %89
  %91 = load i8, ptr %10, align 1, !tbaa !22
  %92 = zext i8 %91 to i32
  %93 = icmp slt i32 %92, 3
  br i1 %93, label %95, label %94

94:                                               ; preds = %90
  store i32 8, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #4
  br label %113

95:                                               ; preds = %90
  %96 = load ptr, ptr %5, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.TPE_Body, ptr %96, i32 0, i32 0
  %98 = load ptr, ptr %97, align 8, !tbaa !17
  %99 = getelementptr inbounds %struct.TPE_Joint, ptr %98, i64 0
  %100 = getelementptr inbounds %struct.TPE_Joint, ptr %99, i32 0, i32 1
  %101 = load i8, ptr %10, align 1, !tbaa !22
  %102 = zext i8 %101 to i64
  %103 = getelementptr inbounds [3 x i16], ptr %100, i64 0, i64 %102
  %104 = load i16, ptr %103, align 2, !tbaa !12
  %105 = load ptr, ptr %6, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.TPE_Joint, ptr %105, i32 0, i32 1
  %107 = load i8, ptr %10, align 1, !tbaa !22
  %108 = zext i8 %107 to i64
  %109 = getelementptr inbounds [3 x i16], ptr %106, i64 0, i64 %108
  store i16 %104, ptr %109, align 2, !tbaa !12
  br label %110

110:                                              ; preds = %95
  %111 = load i8, ptr %10, align 1, !tbaa !22
  %112 = add i8 %111, 1
  store i8 %112, ptr %10, align 1, !tbaa !22
  br label %90, !llvm.loop !23

113:                                              ; preds = %94
  br label %114

114:                                              ; preds = %113, %82
  %115 = load ptr, ptr %6, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.TPE_Joint, ptr %115, i32 0, i32 1
  %117 = getelementptr inbounds [3 x i16], ptr %116, i64 0, i64 0
  %118 = load i16, ptr %117, align 4, !tbaa !12
  %119 = sext i16 %118 to i32
  %120 = load ptr, ptr %6, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.TPE_Joint, ptr %120, i32 0, i32 0
  %122 = getelementptr inbounds %struct.TPE_Vec3, ptr %121, i32 0, i32 0
  %123 = load i32, ptr %122, align 4, !tbaa !25
  %124 = add nsw i32 %123, %119
  store i32 %124, ptr %122, align 4, !tbaa !25
  %125 = load ptr, ptr %6, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.TPE_Joint, ptr %125, i32 0, i32 1
  %127 = getelementptr inbounds [3 x i16], ptr %126, i64 0, i64 1
  %128 = load i16, ptr %127, align 2, !tbaa !12
  %129 = sext i16 %128 to i32
  %130 = load ptr, ptr %6, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.TPE_Joint, ptr %130, i32 0, i32 0
  %132 = getelementptr inbounds %struct.TPE_Vec3, ptr %131, i32 0, i32 1
  %133 = load i32, ptr %132, align 4, !tbaa !28
  %134 = add nsw i32 %133, %129
  store i32 %134, ptr %132, align 4, !tbaa !28
  %135 = load ptr, ptr %6, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.TPE_Joint, ptr %135, i32 0, i32 1
  %137 = getelementptr inbounds [3 x i16], ptr %136, i64 0, i64 2
  %138 = load i16, ptr %137, align 4, !tbaa !12
  %139 = sext i16 %138 to i32
  %140 = load ptr, ptr %6, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.TPE_Joint, ptr %140, i32 0, i32 0
  %142 = getelementptr inbounds %struct.TPE_Vec3, ptr %141, i32 0, i32 2
  %143 = load i32, ptr %142, align 4, !tbaa !29
  %144 = add nsw i32 %143, %139
  store i32 %144, ptr %142, align 4, !tbaa !29
  %145 = load ptr, ptr %6, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct.TPE_Joint, ptr %145, i32 1
  store ptr %146, ptr %6, align 8, !tbaa !5
  br label %147

147:                                              ; preds = %114
  %148 = load i16, ptr %9, align 2, !tbaa !12
  %149 = add i16 %148, 1
  store i16 %149, ptr %9, align 2, !tbaa !12
  br label %73, !llvm.loop !30

150:                                              ; preds = %81
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %151 = load ptr, ptr %5, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.TPE_Body, ptr %151, i32 0, i32 2
  %153 = load ptr, ptr %152, align 8, !tbaa !31
  store ptr %153, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 12, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 12, ptr %13) #4
  %154 = load ptr, ptr %5, align 8, !tbaa !5
  call void @TPE_bodyGetAABB(ptr noundef %154, ptr noundef %12, ptr noundef %13)
  %155 = load i16, ptr %3, align 2, !tbaa !12
  store i16 %155, ptr @_TPE_body1Index, align 2, !tbaa !12
  %156 = load i16, ptr @_TPE_body1Index, align 2, !tbaa !12
  store i16 %156, ptr @_TPE_body2Index, align 2, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 1, ptr %14) #4
  %157 = load ptr, ptr %5, align 8, !tbaa !5
  %158 = load ptr, ptr %2, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct.TPE_World, ptr %158, i32 0, i32 2
  %160 = load ptr, ptr %159, align 8, !tbaa !32
  %161 = call zeroext i8 @TPE_bodyEnvironmentResolveCollision(ptr noundef %157, ptr noundef %160)
  store i8 %161, ptr %14, align 1, !tbaa !22
  %162 = load ptr, ptr %5, align 8, !tbaa !5
  %163 = getelementptr inbounds %struct.TPE_Body, ptr %162, i32 0, i32 7
  %164 = load i8, ptr %163, align 8, !tbaa !15
  %165 = zext i8 %164 to i32
  %166 = and i32 %165, 2
  %167 = icmp ne i32 %166, 0
  br i1 %167, label %168, label %221

168:                                              ; preds = %150
  call void @llvm.lifetime.start.p0(i64 1, ptr %15) #4
  store i8 0, ptr %15, align 1, !tbaa !22
  br label %169

169:                                              ; preds = %184, %168
  %170 = load i8, ptr %15, align 1, !tbaa !22
  %171 = zext i8 %170 to i32
  %172 = icmp slt i32 %171, 8
  br i1 %172, label %174, label %173

173:                                              ; preds = %169
  store i32 11, ptr %4, align 4
  br label %187

174:                                              ; preds = %169
  %175 = load i8, ptr %14, align 1, !tbaa !22
  %176 = icmp ne i8 %175, 0
  br i1 %176, label %178, label %177

177:                                              ; preds = %174
  store i32 11, ptr %4, align 4
  br label %187

178:                                              ; preds = %174
  %179 = load ptr, ptr %5, align 8, !tbaa !5
  %180 = load ptr, ptr %2, align 8, !tbaa !5
  %181 = getelementptr inbounds %struct.TPE_World, ptr %180, i32 0, i32 2
  %182 = load ptr, ptr %181, align 8, !tbaa !32
  %183 = call zeroext i8 @TPE_bodyEnvironmentResolveCollision(ptr noundef %179, ptr noundef %182)
  store i8 %183, ptr %14, align 1, !tbaa !22
  br label %184

184:                                              ; preds = %178
  %185 = load i8, ptr %15, align 1, !tbaa !22
  %186 = add i8 %185, 1
  store i8 %186, ptr %15, align 1, !tbaa !22
  br label %169, !llvm.loop !33

187:                                              ; preds = %177, %173
  call void @llvm.lifetime.end.p0(i64 1, ptr %15) #4
  br label %188

188:                                              ; preds = %187
  %189 = load i8, ptr %14, align 1, !tbaa !22
  %190 = zext i8 %189 to i32
  %191 = icmp ne i32 %190, 0
  br i1 %191, label %192, label %220

192:                                              ; preds = %188
  %193 = load ptr, ptr %5, align 8, !tbaa !5
  %194 = load ptr, ptr %2, align 8, !tbaa !5
  %195 = getelementptr inbounds %struct.TPE_World, ptr %194, i32 0, i32 2
  %196 = load ptr, ptr %195, align 8, !tbaa !32
  %197 = call zeroext i8 @TPE_bodyEnvironmentCollide(ptr noundef %193, ptr noundef %196)
  %198 = zext i8 %197 to i32
  %199 = icmp ne i32 %198, 0
  br i1 %199, label %200, label %220

200:                                              ; preds = %192
  %201 = load ptr, ptr %5, align 8, !tbaa !5
  %202 = load ptr, ptr %5, align 8, !tbaa !5
  %203 = getelementptr inbounds %struct.TPE_Body, ptr %202, i32 0, i32 0
  %204 = load ptr, ptr %203, align 8, !tbaa !17
  %205 = getelementptr inbounds %struct.TPE_Joint, ptr %204, i64 0
  %206 = getelementptr inbounds %struct.TPE_Joint, ptr %205, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %17, ptr align 4 %8, i64 12, i1 false)
  %207 = getelementptr inbounds { i64, i32 }, ptr %17, i32 0, i32 0
  %208 = load i64, ptr %207, align 4
  %209 = getelementptr inbounds { i64, i32 }, ptr %17, i32 0, i32 1
  %210 = load i32, ptr %209, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %18, ptr align 4 %206, i64 12, i1 false)
  %211 = getelementptr inbounds { i64, i32 }, ptr %18, i32 0, i32 0
  %212 = load i64, ptr %211, align 4
  %213 = getelementptr inbounds { i64, i32 }, ptr %18, i32 0, i32 1
  %214 = load i32, ptr %213, align 4
  %215 = call { i64, i32 } @TPE_vec3Minus(i64 %208, i32 %210, i64 %212, i32 %214)
  store { i64, i32 } %215, ptr %19, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %16, ptr align 8 %19, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %20, ptr align 4 %16, i64 12, i1 false)
  %216 = getelementptr inbounds { i64, i32 }, ptr %20, i32 0, i32 0
  %217 = load i64, ptr %216, align 4
  %218 = getelementptr inbounds { i64, i32 }, ptr %20, i32 0, i32 1
  %219 = load i32, ptr %218, align 4
  call void @TPE_bodyMoveBy(ptr noundef %201, i64 %217, i32 %219)
  br label %220

220:                                              ; preds = %200, %192, %188
  br label %445

221:                                              ; preds = %150
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #4
  store i32 0, ptr %21, align 4, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 2, ptr %22) #4
  store i16 0, ptr %22, align 2, !tbaa !12
  br label %222

222:                                              ; preds = %383, %221
  %223 = load i16, ptr %22, align 2, !tbaa !12
  %224 = zext i16 %223 to i32
  %225 = load ptr, ptr %5, align 8, !tbaa !5
  %226 = getelementptr inbounds %struct.TPE_Body, ptr %225, i32 0, i32 3
  %227 = load i8, ptr %226, align 8, !tbaa !34
  %228 = zext i8 %227 to i32
  %229 = icmp slt i32 %224, %228
  br i1 %229, label %231, label %230

230:                                              ; preds = %222
  store i32 14, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 2, ptr %22) #4
  br label %386

231:                                              ; preds = %222
  %232 = load ptr, ptr %5, align 8, !tbaa !5
  %233 = getelementptr inbounds %struct.TPE_Body, ptr %232, i32 0, i32 0
  %234 = load ptr, ptr %233, align 8, !tbaa !17
  %235 = load ptr, ptr %11, align 8, !tbaa !5
  %236 = getelementptr inbounds %struct.TPE_Connection, ptr %235, i32 0, i32 0
  %237 = load i8, ptr %236, align 2, !tbaa !35
  %238 = zext i8 %237 to i64
  %239 = getelementptr inbounds %struct.TPE_Joint, ptr %234, i64 %238
  store ptr %239, ptr %6, align 8, !tbaa !5
  %240 = load ptr, ptr %5, align 8, !tbaa !5
  %241 = getelementptr inbounds %struct.TPE_Body, ptr %240, i32 0, i32 0
  %242 = load ptr, ptr %241, align 8, !tbaa !17
  %243 = load ptr, ptr %11, align 8, !tbaa !5
  %244 = getelementptr inbounds %struct.TPE_Connection, ptr %243, i32 0, i32 1
  %245 = load i8, ptr %244, align 1, !tbaa !37
  %246 = zext i8 %245 to i64
  %247 = getelementptr inbounds %struct.TPE_Joint, ptr %242, i64 %246
  store ptr %247, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 12, ptr %23) #4
  %248 = load ptr, ptr %7, align 8, !tbaa !5
  %249 = getelementptr inbounds %struct.TPE_Joint, ptr %248, i32 0, i32 0
  %250 = load ptr, ptr %6, align 8, !tbaa !5
  %251 = getelementptr inbounds %struct.TPE_Joint, ptr %250, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %24, ptr align 4 %249, i64 12, i1 false)
  %252 = getelementptr inbounds { i64, i32 }, ptr %24, i32 0, i32 0
  %253 = load i64, ptr %252, align 4
  %254 = getelementptr inbounds { i64, i32 }, ptr %24, i32 0, i32 1
  %255 = load i32, ptr %254, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %25, ptr align 4 %251, i64 12, i1 false)
  %256 = getelementptr inbounds { i64, i32 }, ptr %25, i32 0, i32 0
  %257 = load i64, ptr %256, align 4
  %258 = getelementptr inbounds { i64, i32 }, ptr %25, i32 0, i32 1
  %259 = load i32, ptr %258, align 4
  %260 = call { i64, i32 } @TPE_vec3Minus(i64 %253, i32 %255, i64 %257, i32 %259)
  store { i64, i32 } %260, ptr %26, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %23, ptr align 8 %26, i64 12, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %28, ptr align 4 %23, i64 12, i1 false)
  %261 = getelementptr inbounds { i64, i32 }, ptr %28, i32 0, i32 0
  %262 = load i64, ptr %261, align 4
  %263 = getelementptr inbounds { i64, i32 }, ptr %28, i32 0, i32 1
  %264 = load i32, ptr %263, align 4
  %265 = call i32 @TPE_vec3Len(i64 %262, i32 %264)
  %266 = load ptr, ptr %11, align 8, !tbaa !5
  %267 = getelementptr inbounds %struct.TPE_Connection, ptr %266, i32 0, i32 2
  %268 = load i16, ptr %267, align 2, !tbaa !38
  %269 = zext i16 %268 to i32
  %270 = call i32 @TPE_connectionTension(i32 noundef %265, i32 noundef %269)
  store i32 %270, ptr %27, align 4, !tbaa !19
  %271 = load i32, ptr %27, align 4, !tbaa !19
  %272 = icmp sgt i32 %271, 0
  br i1 %272, label %273, label %275

273:                                              ; preds = %231
  %274 = load i32, ptr %27, align 4, !tbaa !19
  br label %278

275:                                              ; preds = %231
  %276 = load i32, ptr %27, align 4, !tbaa !19
  %277 = sub nsw i32 0, %276
  br label %278

278:                                              ; preds = %275, %273
  %279 = phi i32 [ %274, %273 ], [ %277, %275 ]
  %280 = load i32, ptr %21, align 4, !tbaa !19
  %281 = add nsw i32 %280, %279
  store i32 %281, ptr %21, align 4, !tbaa !19
  %282 = load i32, ptr %27, align 4, !tbaa !19
  %283 = icmp sgt i32 %282, 5
  br i1 %283, label %287, label %284

284:                                              ; preds = %278
  %285 = load i32, ptr %27, align 4, !tbaa !19
  %286 = icmp slt i32 %285, -5
  br i1 %286, label %287, label %380

287:                                              ; preds = %284, %278
  call void @TPE_vec3Normalize(ptr noundef %23)
  %288 = load i32, ptr %27, align 4, !tbaa !19
  %289 = icmp sgt i32 %288, 15
  br i1 %289, label %293, label %290

290:                                              ; preds = %287
  %291 = load i32, ptr %27, align 4, !tbaa !19
  %292 = icmp slt i32 %291, -15
  br i1 %292, label %293, label %303

293:                                              ; preds = %290, %287
  %294 = getelementptr inbounds %struct.TPE_Vec3, ptr %23, i32 0, i32 0
  %295 = load i32, ptr %294, align 4, !tbaa !39
  %296 = mul nsw i32 %295, 2
  store i32 %296, ptr %294, align 4, !tbaa !39
  %297 = getelementptr inbounds %struct.TPE_Vec3, ptr %23, i32 0, i32 1
  %298 = load i32, ptr %297, align 4, !tbaa !40
  %299 = mul nsw i32 %298, 2
  store i32 %299, ptr %297, align 4, !tbaa !40
  %300 = getelementptr inbounds %struct.TPE_Vec3, ptr %23, i32 0, i32 2
  %301 = load i32, ptr %300, align 4, !tbaa !41
  %302 = mul nsw i32 %301, 2
  store i32 %302, ptr %300, align 4, !tbaa !41
  br label %303

303:                                              ; preds = %293, %290
  %304 = getelementptr inbounds %struct.TPE_Vec3, ptr %23, i32 0, i32 0
  %305 = load i32, ptr %304, align 4, !tbaa !39
  %306 = sdiv i32 %305, 32
  store i32 %306, ptr %304, align 4, !tbaa !39
  %307 = getelementptr inbounds %struct.TPE_Vec3, ptr %23, i32 0, i32 1
  %308 = load i32, ptr %307, align 4, !tbaa !40
  %309 = sdiv i32 %308, 32
  store i32 %309, ptr %307, align 4, !tbaa !40
  %310 = getelementptr inbounds %struct.TPE_Vec3, ptr %23, i32 0, i32 2
  %311 = load i32, ptr %310, align 4, !tbaa !41
  %312 = sdiv i32 %311, 32
  store i32 %312, ptr %310, align 4, !tbaa !41
  %313 = load i32, ptr %27, align 4, !tbaa !19
  %314 = icmp slt i32 %313, 0
  br i1 %314, label %315, label %325

315:                                              ; preds = %303
  %316 = getelementptr inbounds %struct.TPE_Vec3, ptr %23, i32 0, i32 0
  %317 = load i32, ptr %316, align 4, !tbaa !39
  %318 = mul nsw i32 %317, -1
  store i32 %318, ptr %316, align 4, !tbaa !39
  %319 = getelementptr inbounds %struct.TPE_Vec3, ptr %23, i32 0, i32 1
  %320 = load i32, ptr %319, align 4, !tbaa !40
  %321 = mul nsw i32 %320, -1
  store i32 %321, ptr %319, align 4, !tbaa !40
  %322 = getelementptr inbounds %struct.TPE_Vec3, ptr %23, i32 0, i32 2
  %323 = load i32, ptr %322, align 4, !tbaa !41
  %324 = mul nsw i32 %323, -1
  store i32 %324, ptr %322, align 4, !tbaa !41
  br label %325

325:                                              ; preds = %315, %303
  %326 = getelementptr inbounds %struct.TPE_Vec3, ptr %23, i32 0, i32 0
  %327 = load i32, ptr %326, align 4, !tbaa !39
  %328 = load ptr, ptr %6, align 8, !tbaa !5
  %329 = getelementptr inbounds %struct.TPE_Joint, ptr %328, i32 0, i32 1
  %330 = getelementptr inbounds [3 x i16], ptr %329, i64 0, i64 0
  %331 = load i16, ptr %330, align 4, !tbaa !12
  %332 = sext i16 %331 to i32
  %333 = add nsw i32 %332, %327
  %334 = trunc i32 %333 to i16
  store i16 %334, ptr %330, align 4, !tbaa !12
  %335 = getelementptr inbounds %struct.TPE_Vec3, ptr %23, i32 0, i32 1
  %336 = load i32, ptr %335, align 4, !tbaa !40
  %337 = load ptr, ptr %6, align 8, !tbaa !5
  %338 = getelementptr inbounds %struct.TPE_Joint, ptr %337, i32 0, i32 1
  %339 = getelementptr inbounds [3 x i16], ptr %338, i64 0, i64 1
  %340 = load i16, ptr %339, align 2, !tbaa !12
  %341 = sext i16 %340 to i32
  %342 = add nsw i32 %341, %336
  %343 = trunc i32 %342 to i16
  store i16 %343, ptr %339, align 2, !tbaa !12
  %344 = getelementptr inbounds %struct.TPE_Vec3, ptr %23, i32 0, i32 2
  %345 = load i32, ptr %344, align 4, !tbaa !41
  %346 = load ptr, ptr %6, align 8, !tbaa !5
  %347 = getelementptr inbounds %struct.TPE_Joint, ptr %346, i32 0, i32 1
  %348 = getelementptr inbounds [3 x i16], ptr %347, i64 0, i64 2
  %349 = load i16, ptr %348, align 4, !tbaa !12
  %350 = sext i16 %349 to i32
  %351 = add nsw i32 %350, %345
  %352 = trunc i32 %351 to i16
  store i16 %352, ptr %348, align 4, !tbaa !12
  %353 = getelementptr inbounds %struct.TPE_Vec3, ptr %23, i32 0, i32 0
  %354 = load i32, ptr %353, align 4, !tbaa !39
  %355 = load ptr, ptr %7, align 8, !tbaa !5
  %356 = getelementptr inbounds %struct.TPE_Joint, ptr %355, i32 0, i32 1
  %357 = getelementptr inbounds [3 x i16], ptr %356, i64 0, i64 0
  %358 = load i16, ptr %357, align 4, !tbaa !12
  %359 = sext i16 %358 to i32
  %360 = sub nsw i32 %359, %354
  %361 = trunc i32 %360 to i16
  store i16 %361, ptr %357, align 4, !tbaa !12
  %362 = getelementptr inbounds %struct.TPE_Vec3, ptr %23, i32 0, i32 1
  %363 = load i32, ptr %362, align 4, !tbaa !40
  %364 = load ptr, ptr %7, align 8, !tbaa !5
  %365 = getelementptr inbounds %struct.TPE_Joint, ptr %364, i32 0, i32 1
  %366 = getelementptr inbounds [3 x i16], ptr %365, i64 0, i64 1
  %367 = load i16, ptr %366, align 2, !tbaa !12
  %368 = sext i16 %367 to i32
  %369 = sub nsw i32 %368, %363
  %370 = trunc i32 %369 to i16
  store i16 %370, ptr %366, align 2, !tbaa !12
  %371 = getelementptr inbounds %struct.TPE_Vec3, ptr %23, i32 0, i32 2
  %372 = load i32, ptr %371, align 4, !tbaa !41
  %373 = load ptr, ptr %7, align 8, !tbaa !5
  %374 = getelementptr inbounds %struct.TPE_Joint, ptr %373, i32 0, i32 1
  %375 = getelementptr inbounds [3 x i16], ptr %374, i64 0, i64 2
  %376 = load i16, ptr %375, align 4, !tbaa !12
  %377 = sext i16 %376 to i32
  %378 = sub nsw i32 %377, %372
  %379 = trunc i32 %378 to i16
  store i16 %379, ptr %375, align 4, !tbaa !12
  br label %380

380:                                              ; preds = %325, %284
  %381 = load ptr, ptr %11, align 8, !tbaa !5
  %382 = getelementptr inbounds %struct.TPE_Connection, ptr %381, i32 1
  store ptr %382, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #4
  call void @llvm.lifetime.end.p0(i64 12, ptr %23) #4
  br label %383

383:                                              ; preds = %380
  %384 = load i16, ptr %22, align 2, !tbaa !12
  %385 = add i16 %384, 1
  store i16 %385, ptr %22, align 2, !tbaa !12
  br label %222, !llvm.loop !42

386:                                              ; preds = %230
  %387 = load ptr, ptr %5, align 8, !tbaa !5
  %388 = getelementptr inbounds %struct.TPE_Body, ptr %387, i32 0, i32 3
  %389 = load i8, ptr %388, align 8, !tbaa !34
  %390 = zext i8 %389 to i32
  %391 = icmp sgt i32 %390, 0
  br i1 %391, label %392, label %444

392:                                              ; preds = %386
  call void @llvm.lifetime.start.p0(i64 1, ptr %29) #4
  %393 = load ptr, ptr %5, align 8, !tbaa !5
  %394 = getelementptr inbounds %struct.TPE_Body, ptr %393, i32 0, i32 7
  %395 = load i8, ptr %394, align 8, !tbaa !15
  %396 = zext i8 %395 to i32
  %397 = and i32 %396, 8
  %398 = icmp ne i32 %397, 0
  %399 = xor i1 %398, true
  %400 = zext i1 %399 to i32
  %401 = trunc i32 %400 to i8
  store i8 %401, ptr %29, align 1, !tbaa !22
  %402 = load i8, ptr %29, align 1, !tbaa !22
  %403 = icmp ne i8 %402, 0
  br i1 %403, label %404, label %433

404:                                              ; preds = %392
  %405 = load ptr, ptr %5, align 8, !tbaa !5
  %406 = load ptr, ptr %2, align 8, !tbaa !5
  %407 = getelementptr inbounds %struct.TPE_World, ptr %406, i32 0, i32 2
  %408 = load ptr, ptr %407, align 8, !tbaa !32
  call void @TPE_bodyReshape(ptr noundef %405, ptr noundef %408)
  %409 = load ptr, ptr %5, align 8, !tbaa !5
  %410 = getelementptr inbounds %struct.TPE_Body, ptr %409, i32 0, i32 3
  %411 = load i8, ptr %410, align 8, !tbaa !34
  %412 = zext i8 %411 to i32
  %413 = load i32, ptr %21, align 4, !tbaa !19
  %414 = sdiv i32 %413, %412
  store i32 %414, ptr %21, align 4, !tbaa !19
  %415 = load i32, ptr %21, align 4, !tbaa !19
  %416 = icmp sgt i32 %415, 20
  br i1 %416, label %417, label %432

417:                                              ; preds = %404
  call void @llvm.lifetime.start.p0(i64 1, ptr %30) #4
  store i8 0, ptr %30, align 1, !tbaa !22
  br label %418

418:                                              ; preds = %428, %417
  %419 = load i8, ptr %30, align 1, !tbaa !22
  %420 = zext i8 %419 to i32
  %421 = icmp slt i32 %420, 3
  br i1 %421, label %423, label %422

422:                                              ; preds = %418
  store i32 17, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %30) #4
  br label %431

423:                                              ; preds = %418
  %424 = load ptr, ptr %5, align 8, !tbaa !5
  %425 = load ptr, ptr %2, align 8, !tbaa !5
  %426 = getelementptr inbounds %struct.TPE_World, ptr %425, i32 0, i32 2
  %427 = load ptr, ptr %426, align 8, !tbaa !32
  call void @TPE_bodyReshape(ptr noundef %424, ptr noundef %427)
  br label %428

428:                                              ; preds = %423
  %429 = load i8, ptr %30, align 1, !tbaa !22
  %430 = add i8 %429, 1
  store i8 %430, ptr %30, align 1, !tbaa !22
  br label %418, !llvm.loop !43

431:                                              ; preds = %422
  br label %432

432:                                              ; preds = %431, %404
  br label %433

433:                                              ; preds = %432, %392
  %434 = load ptr, ptr %5, align 8, !tbaa !5
  %435 = getelementptr inbounds %struct.TPE_Body, ptr %434, i32 0, i32 7
  %436 = load i8, ptr %435, align 8, !tbaa !15
  %437 = zext i8 %436 to i32
  %438 = and i32 %437, 16
  %439 = icmp ne i32 %438, 0
  br i1 %439, label %443, label %440

440:                                              ; preds = %433
  %441 = load ptr, ptr %5, align 8, !tbaa !5
  %442 = load i8, ptr %29, align 1, !tbaa !22
  call void @TPE_bodyCancelOutVelocities(ptr noundef %441, i8 noundef zeroext %442)
  br label %443

443:                                              ; preds = %440, %433
  call void @llvm.lifetime.end.p0(i64 1, ptr %29) #4
  br label %444

444:                                              ; preds = %443, %386
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #4
  br label %445

445:                                              ; preds = %444, %220
  call void @llvm.lifetime.start.p0(i64 2, ptr %31) #4
  store i16 0, ptr %31, align 2, !tbaa !12
  br label %446

446:                                              ; preds = %531, %445
  %447 = load i16, ptr %31, align 2, !tbaa !12
  %448 = zext i16 %447 to i32
  %449 = load ptr, ptr %2, align 8, !tbaa !5
  %450 = getelementptr inbounds %struct.TPE_World, ptr %449, i32 0, i32 1
  %451 = load i16, ptr %450, align 8, !tbaa !13
  %452 = zext i16 %451 to i32
  %453 = icmp slt i32 %448, %452
  br i1 %453, label %455, label %454

454:                                              ; preds = %446
  store i32 20, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 2, ptr %31) #4
  br label %534

455:                                              ; preds = %446
  %456 = load i16, ptr %31, align 2, !tbaa !12
  %457 = zext i16 %456 to i32
  %458 = load i16, ptr %3, align 2, !tbaa !12
  %459 = zext i16 %458 to i32
  %460 = icmp sgt i32 %457, %459
  br i1 %460, label %473, label %461

461:                                              ; preds = %455
  %462 = load ptr, ptr %2, align 8, !tbaa !5
  %463 = getelementptr inbounds %struct.TPE_World, ptr %462, i32 0, i32 0
  %464 = load ptr, ptr %463, align 8, !tbaa !14
  %465 = load i16, ptr %31, align 2, !tbaa !12
  %466 = zext i16 %465 to i64
  %467 = getelementptr inbounds %struct.TPE_Body, ptr %464, i64 %466
  %468 = getelementptr inbounds %struct.TPE_Body, ptr %467, i32 0, i32 7
  %469 = load i8, ptr %468, align 8, !tbaa !15
  %470 = zext i8 %469 to i32
  %471 = and i32 %470, 1
  %472 = icmp ne i32 %471, 0
  br i1 %472, label %473, label %530

473:                                              ; preds = %461, %455
  call void @llvm.lifetime.start.p0(i64 12, ptr %32) #4
  call void @llvm.lifetime.start.p0(i64 12, ptr %33) #4
  %474 = load ptr, ptr %2, align 8, !tbaa !5
  %475 = getelementptr inbounds %struct.TPE_World, ptr %474, i32 0, i32 0
  %476 = load ptr, ptr %475, align 8, !tbaa !14
  %477 = load i16, ptr %31, align 2, !tbaa !12
  %478 = zext i16 %477 to i64
  %479 = getelementptr inbounds %struct.TPE_Body, ptr %476, i64 %478
  call void @TPE_bodyGetAABB(ptr noundef %479, ptr noundef %32, ptr noundef %33)
  %480 = load i16, ptr %31, align 2, !tbaa !12
  store i16 %480, ptr @_TPE_body2Index, align 2, !tbaa !12
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %34, ptr align 4 %12, i64 12, i1 false)
  %481 = getelementptr inbounds { i64, i32 }, ptr %34, i32 0, i32 0
  %482 = load i64, ptr %481, align 4
  %483 = getelementptr inbounds { i64, i32 }, ptr %34, i32 0, i32 1
  %484 = load i32, ptr %483, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %35, ptr align 4 %13, i64 12, i1 false)
  %485 = getelementptr inbounds { i64, i32 }, ptr %35, i32 0, i32 0
  %486 = load i64, ptr %485, align 4
  %487 = getelementptr inbounds { i64, i32 }, ptr %35, i32 0, i32 1
  %488 = load i32, ptr %487, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %36, ptr align 4 %32, i64 12, i1 false)
  %489 = getelementptr inbounds { i64, i32 }, ptr %36, i32 0, i32 0
  %490 = load i64, ptr %489, align 4
  %491 = getelementptr inbounds { i64, i32 }, ptr %36, i32 0, i32 1
  %492 = load i32, ptr %491, align 4
  %493 = call zeroext i8 @TPE_checkOverlapAABB(i64 %482, i32 %484, i64 %486, i32 %488, i64 %490, i32 %492, ptr noundef byval(%struct.TPE_Vec3) align 8 %33)
  %494 = zext i8 %493 to i32
  %495 = icmp ne i32 %494, 0
  br i1 %495, label %496, label %529

496:                                              ; preds = %473
  %497 = load ptr, ptr %5, align 8, !tbaa !5
  %498 = load ptr, ptr %2, align 8, !tbaa !5
  %499 = getelementptr inbounds %struct.TPE_World, ptr %498, i32 0, i32 0
  %500 = load ptr, ptr %499, align 8, !tbaa !14
  %501 = load i16, ptr %31, align 2, !tbaa !12
  %502 = zext i16 %501 to i32
  %503 = sext i32 %502 to i64
  %504 = getelementptr inbounds %struct.TPE_Body, ptr %500, i64 %503
  %505 = load ptr, ptr %2, align 8, !tbaa !5
  %506 = getelementptr inbounds %struct.TPE_World, ptr %505, i32 0, i32 2
  %507 = load ptr, ptr %506, align 8, !tbaa !32
  %508 = call zeroext i8 @TPE_bodiesResolveCollision(ptr noundef %497, ptr noundef %504, ptr noundef %507)
  %509 = zext i8 %508 to i32
  %510 = icmp ne i32 %509, 0
  br i1 %510, label %511, label %529

511:                                              ; preds = %496
  %512 = load ptr, ptr %5, align 8, !tbaa !5
  call void @TPE_bodyActivate(ptr noundef %512)
  %513 = load ptr, ptr %5, align 8, !tbaa !5
  %514 = getelementptr inbounds %struct.TPE_Body, ptr %513, i32 0, i32 8
  store i8 116, ptr %514, align 1, !tbaa !44
  %515 = load ptr, ptr %2, align 8, !tbaa !5
  %516 = getelementptr inbounds %struct.TPE_World, ptr %515, i32 0, i32 0
  %517 = load ptr, ptr %516, align 8, !tbaa !14
  %518 = load i16, ptr %31, align 2, !tbaa !12
  %519 = zext i16 %518 to i32
  %520 = sext i32 %519 to i64
  %521 = getelementptr inbounds %struct.TPE_Body, ptr %517, i64 %520
  call void @TPE_bodyActivate(ptr noundef %521)
  %522 = load ptr, ptr %2, align 8, !tbaa !5
  %523 = getelementptr inbounds %struct.TPE_World, ptr %522, i32 0, i32 0
  %524 = load ptr, ptr %523, align 8, !tbaa !14
  %525 = load i16, ptr %31, align 2, !tbaa !12
  %526 = zext i16 %525 to i64
  %527 = getelementptr inbounds %struct.TPE_Body, ptr %524, i64 %526
  %528 = getelementptr inbounds %struct.TPE_Body, ptr %527, i32 0, i32 8
  store i8 116, ptr %528, align 1, !tbaa !44
  br label %529

529:                                              ; preds = %511, %496, %473
  call void @llvm.lifetime.end.p0(i64 12, ptr %33) #4
  call void @llvm.lifetime.end.p0(i64 12, ptr %32) #4
  br label %530

530:                                              ; preds = %529, %461
  br label %531

531:                                              ; preds = %530
  %532 = load i16, ptr %31, align 2, !tbaa !12
  %533 = add i16 %532, 1
  store i16 %533, ptr %31, align 2, !tbaa !12
  br label %446, !llvm.loop !45

534:                                              ; preds = %454
  %535 = load ptr, ptr %5, align 8, !tbaa !5
  %536 = getelementptr inbounds %struct.TPE_Body, ptr %535, i32 0, i32 7
  %537 = load i8, ptr %536, align 8, !tbaa !15
  %538 = zext i8 %537 to i32
  %539 = and i32 %538, 32
  %540 = icmp ne i32 %539, 0
  br i1 %540, label %571, label %541

541:                                              ; preds = %534
  %542 = load ptr, ptr %5, align 8, !tbaa !5
  %543 = getelementptr inbounds %struct.TPE_Body, ptr %542, i32 0, i32 8
  %544 = load i8, ptr %543, align 1, !tbaa !44
  %545 = zext i8 %544 to i32
  %546 = icmp sge i32 %545, 128
  br i1 %546, label %547, label %557

547:                                              ; preds = %541
  %548 = load ptr, ptr %5, align 8, !tbaa !5
  call void @TPE_bodyStop(ptr noundef %548)
  %549 = load ptr, ptr %5, align 8, !tbaa !5
  %550 = getelementptr inbounds %struct.TPE_Body, ptr %549, i32 0, i32 8
  store i8 0, ptr %550, align 1, !tbaa !44
  %551 = load ptr, ptr %5, align 8, !tbaa !5
  %552 = getelementptr inbounds %struct.TPE_Body, ptr %551, i32 0, i32 7
  %553 = load i8, ptr %552, align 8, !tbaa !15
  %554 = zext i8 %553 to i32
  %555 = or i32 %554, 1
  %556 = trunc i32 %555 to i8
  store i8 %556, ptr %552, align 8, !tbaa !15
  br label %570

557:                                              ; preds = %541
  %558 = load ptr, ptr %5, align 8, !tbaa !5
  %559 = call i32 @TPE_bodyGetAverageSpeed(ptr noundef %558)
  %560 = icmp sle i32 %559, 30
  br i1 %560, label %561, label %566

561:                                              ; preds = %557
  %562 = load ptr, ptr %5, align 8, !tbaa !5
  %563 = getelementptr inbounds %struct.TPE_Body, ptr %562, i32 0, i32 8
  %564 = load i8, ptr %563, align 1, !tbaa !44
  %565 = add i8 %564, 1
  store i8 %565, ptr %563, align 1, !tbaa !44
  br label %569

566:                                              ; preds = %557
  %567 = load ptr, ptr %5, align 8, !tbaa !5
  %568 = getelementptr inbounds %struct.TPE_Body, ptr %567, i32 0, i32 8
  store i8 0, ptr %568, align 1, !tbaa !44
  br label %569

569:                                              ; preds = %566, %561
  br label %570

570:                                              ; preds = %569, %547
  br label %571

571:                                              ; preds = %570, %534
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 12, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 12, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 12, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  store i32 0, ptr %4, align 4
  br label %572

572:                                              ; preds = %571, %63
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  %573 = load i32, ptr %4, align 4
  switch i32 %573, label %579 [
    i32 0, label %574
    i32 4, label %575
  ]

574:                                              ; preds = %572
  br label %575

575:                                              ; preds = %574, %572
  %576 = load i16, ptr %3, align 2, !tbaa !12
  %577 = add i16 %576, 1
  store i16 %577, ptr %3, align 2, !tbaa !12
  br label %40, !llvm.loop !46

578:                                              ; preds = %48
  ret void

579:                                              ; preds = %572
  unreachable
}

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

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @TPE_bodyEnvironmentResolveCollision(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @TPE_bodyEnvironmentCollide(ptr noundef, ptr noundef) #2

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

; Function Attrs: nounwind uwtable
declare dso_local { i64, i32 } @TPE_vec3Minus(i64, i32, i64, i32) #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @TPE_connectionTension(i32 noundef, i32 noundef) #3

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @TPE_bodyCancelOutVelocities(ptr noundef, i8 noundef zeroext) #2

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @TPE_checkOverlapAABB(i64, i32, i64, i32, i64, i32, ptr noundef byval(%struct.TPE_Vec3) align 8) #2

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @TPE_bodiesResolveCollision(ptr noundef, ptr noundef, ptr noundef) #2

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

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

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

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

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

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


; 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.TPE_Vec3 = type { i32, i32, i32 }
%struct.TPE_Body = type { ptr, i8, ptr, i8, i16, i16, i16, i8, i8 }
%struct.TPE_Joint = type { %struct.TPE_Vec3, [3 x i16], i8 }

@_TPE_collisionCallback = external dso_local local_unnamed_addr global ptr, align 8
@_TPE_body1Index = external dso_local local_unnamed_addr global i16, align 2
@_TPE_body2Index = external dso_local local_unnamed_addr global i16, align 2

; 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: nounwind uwtable
declare dso_local i32 @TPE_vec3Len(i64, i32) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @TPE_worldStep(ptr nocapture noundef readonly %0) local_unnamed_addr #1 {
  %2 = alloca %struct.TPE_Vec3, align 8
  %3 = alloca %struct.TPE_Vec3, align 8
  %4 = alloca %struct.TPE_Vec3, align 8
  %5 = alloca %struct.TPE_Vec3, align 8
  %6 = alloca %struct.TPE_Vec3, align 8
  %7 = getelementptr inbounds i8, ptr %0, i64 24
  %8 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %8, ptr @_TPE_collisionCallback, align 8, !tbaa !11
  %9 = getelementptr inbounds i8, ptr %0, i64 8
  %10 = load i16, ptr %9, align 8, !tbaa !12
  %.not192 = icmp eq i16 %10, 0
  br i1 %.not192, label %._crit_edge191, label %.lr.ph190

.lr.ph190:                                        ; preds = %1
  %11 = getelementptr inbounds i8, ptr %0, i64 16
  %.sroa.231.0..sroa_idx = getelementptr inbounds i8, ptr %4, i64 8
  %12 = getelementptr inbounds i8, ptr %4, i64 4
  %.sroa.27.0..sroa_idx = getelementptr inbounds i8, ptr %2, i64 8
  %.sroa.25.0..sroa_idx = getelementptr inbounds i8, ptr %3, i64 8
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %5, i64 8
  br label %13

._crit_edge191:                                   ; preds = %206, %1
  ret void

13:                                               ; preds = %.lr.ph190, %206
  %14 = phi i16 [ %10, %.lr.ph190 ], [ %207, %206 ]
  %indvars.iv203 = phi i64 [ 0, %.lr.ph190 ], [ %indvars.iv.next204, %206 ]
  %15 = load ptr, ptr %0, align 8, !tbaa !13
  %16 = getelementptr inbounds %struct.TPE_Body, ptr %15, i64 %indvars.iv203
  %17 = getelementptr inbounds i8, ptr %16, i64 32
  %18 = load i8, ptr %17, align 8, !tbaa !14
  %19 = and i8 %18, 5
  %.not = icmp eq i8 %19, 0
  br i1 %.not, label %20, label %206

20:                                               ; preds = %13
  %21 = load ptr, ptr %16, align 8, !tbaa !16
  %.sroa.066.0.copyload = load i64, ptr %21, align 4
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %21, i64 8
  %.sroa.4.0.copyload = load i32, ptr %.sroa.4.0..sroa_idx, align 4, !tbaa !17
  %22 = getelementptr inbounds i8, ptr %16, i64 8
  %23 = load i8, ptr %22, align 8, !tbaa !19
  %24 = zext i8 %23 to i16
  %.not193 = icmp eq i8 %23, 0
  br i1 %.not193, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %20
  %25 = and i8 %18, 2
  %.not163 = icmp eq i8 %25, 0
  %26 = getelementptr i8, ptr %21, i64 12
  %27 = getelementptr i8, ptr %21, i64 14
  %28 = getelementptr i8, ptr %21, i64 16
  br label %38

._crit_edge:                                      ; preds = %.loopexit, %20
  %29 = getelementptr inbounds i8, ptr %16, i64 16
  %30 = load ptr, ptr %29, align 8, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %2) #4
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %3) #4
  call void @TPE_bodyGetAABB(ptr noundef nonnull %16, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %31 = trunc nuw i64 %indvars.iv203 to i16
  store i16 %31, ptr @_TPE_body1Index, align 2, !tbaa !21
  store i16 %31, ptr @_TPE_body2Index, align 2, !tbaa !21
  %32 = load ptr, ptr %11, align 8, !tbaa !22
  %33 = call zeroext i8 @TPE_bodyEnvironmentResolveCollision(ptr noundef nonnull %16, ptr noundef %32)
  %34 = load i8, ptr %17, align 8, !tbaa !14
  %35 = and i8 %34, 2
  %.not151 = icmp eq i8 %35, 0
  br i1 %.not151, label %.preheader166, label %.preheader167.preheader

.preheader167.preheader:                          ; preds = %._crit_edge
  %cond = icmp eq i8 %33, 0
  br i1 %cond, label %.loopexit168, label %.preheader167.1

.preheader166:                                    ; preds = %._crit_edge
  %36 = getelementptr inbounds i8, ptr %16, i64 24
  %37 = load i8, ptr %36, align 8, !tbaa !23
  %.not194 = icmp eq i8 %37, 0
  br i1 %.not194, label %.loopexit168, label %.lr.ph179

38:                                               ; preds = %.lr.ph, %.loopexit
  %.0138173 = phi ptr [ %21, %.lr.ph ], [ %56, %.loopexit ]
  %.0139172 = phi i16 [ 0, %.lr.ph ], [ %57, %.loopexit ]
  %.phi.trans.insert = getelementptr inbounds i8, ptr %.0138173, i64 12
  br i1 %.not163, label %..loopexit_crit_edge, label %.preheader

..loopexit_crit_edge:                             ; preds = %38
  %39 = load <2 x i16>, ptr %.phi.trans.insert, align 4, !tbaa !21
  %.phi.trans.insert208 = getelementptr inbounds i8, ptr %.0138173, i64 16
  %.pre209 = load i16, ptr %.phi.trans.insert208, align 4, !tbaa !21
  br label %.loopexit

.preheader:                                       ; preds = %38
  %40 = load i16, ptr %26, align 2, !tbaa !21
  store i16 %40, ptr %.phi.trans.insert, align 2, !tbaa !21
  %41 = load i16, ptr %27, align 2, !tbaa !21
  %42 = getelementptr inbounds i8, ptr %.0138173, i64 14
  store i16 %41, ptr %42, align 2, !tbaa !21
  %43 = load i16, ptr %28, align 2, !tbaa !21
  %44 = getelementptr inbounds i8, ptr %.0138173, i64 16
  store i16 %43, ptr %44, align 2, !tbaa !21
  %45 = insertelement <2 x i16> poison, i16 %40, i64 0
  %46 = insertelement <2 x i16> %45, i16 %41, i64 1
  br label %.loopexit

.loopexit:                                        ; preds = %..loopexit_crit_edge, %.preheader
  %47 = phi i16 [ %.pre209, %..loopexit_crit_edge ], [ %43, %.preheader ]
  %48 = phi <2 x i16> [ %39, %..loopexit_crit_edge ], [ %46, %.preheader ]
  %49 = sext <2 x i16> %48 to <2 x i32>
  %50 = load <2 x i32>, ptr %.0138173, align 4, !tbaa !17
  %51 = add nsw <2 x i32> %50, %49
  store <2 x i32> %51, ptr %.0138173, align 4, !tbaa !17
  %52 = sext i16 %47 to i32
  %53 = getelementptr inbounds i8, ptr %.0138173, i64 8
  %54 = load i32, ptr %53, align 4, !tbaa !24
  %55 = add nsw i32 %54, %52
  store i32 %55, ptr %53, align 4, !tbaa !24
  %56 = getelementptr inbounds i8, ptr %.0138173, i64 20
  %57 = add nuw nsw i16 %.0139172, 1
  %exitcond.not = icmp eq i16 %57, %24
  br i1 %exitcond.not, label %._crit_edge, label %38, !llvm.loop !27

.preheader167.1:                                  ; preds = %.preheader167.preheader
  %58 = load ptr, ptr %11, align 8, !tbaa !22
  %59 = call zeroext i8 @TPE_bodyEnvironmentResolveCollision(ptr noundef nonnull %16, ptr noundef %58)
  %cond.1 = icmp eq i8 %59, 0
  br i1 %cond.1, label %.loopexit168, label %.preheader167.2

.preheader167.2:                                  ; preds = %.preheader167.1
  %60 = load ptr, ptr %11, align 8, !tbaa !22
  %61 = call zeroext i8 @TPE_bodyEnvironmentResolveCollision(ptr noundef nonnull %16, ptr noundef %60)
  %cond.2 = icmp eq i8 %61, 0
  br i1 %cond.2, label %.loopexit168, label %.preheader167.3

.preheader167.3:                                  ; preds = %.preheader167.2
  %62 = load ptr, ptr %11, align 8, !tbaa !22
  %63 = call zeroext i8 @TPE_bodyEnvironmentResolveCollision(ptr noundef nonnull %16, ptr noundef %62)
  %cond.3 = icmp eq i8 %63, 0
  br i1 %cond.3, label %.loopexit168, label %.preheader167.4

.preheader167.4:                                  ; preds = %.preheader167.3
  %64 = load ptr, ptr %11, align 8, !tbaa !22
  %65 = call zeroext i8 @TPE_bodyEnvironmentResolveCollision(ptr noundef nonnull %16, ptr noundef %64)
  %cond.4 = icmp eq i8 %65, 0
  br i1 %cond.4, label %.loopexit168, label %.preheader167.5

.preheader167.5:                                  ; preds = %.preheader167.4
  %66 = load ptr, ptr %11, align 8, !tbaa !22
  %67 = call zeroext i8 @TPE_bodyEnvironmentResolveCollision(ptr noundef nonnull %16, ptr noundef %66)
  %cond.5 = icmp eq i8 %67, 0
  br i1 %cond.5, label %.loopexit168, label %.preheader167.6

.preheader167.6:                                  ; preds = %.preheader167.5
  %68 = load ptr, ptr %11, align 8, !tbaa !22
  %69 = call zeroext i8 @TPE_bodyEnvironmentResolveCollision(ptr noundef nonnull %16, ptr noundef %68)
  %cond.6 = icmp eq i8 %69, 0
  br i1 %cond.6, label %.loopexit168, label %.preheader167.7

.preheader167.7:                                  ; preds = %.preheader167.6
  %70 = load ptr, ptr %11, align 8, !tbaa !22
  %71 = call zeroext i8 @TPE_bodyEnvironmentResolveCollision(ptr noundef nonnull %16, ptr noundef %70)
  %cond.7 = icmp eq i8 %71, 0
  br i1 %cond.7, label %.loopexit168, label %72

72:                                               ; preds = %.preheader167.7
  %73 = load ptr, ptr %11, align 8, !tbaa !22
  %74 = call zeroext i8 @TPE_bodyEnvironmentResolveCollision(ptr noundef nonnull %16, ptr noundef %73)
  %.not157 = icmp eq i8 %74, 0
  br i1 %.not157, label %.loopexit168, label %75

75:                                               ; preds = %72
  %76 = load ptr, ptr %11, align 8, !tbaa !22
  %77 = call zeroext i8 @TPE_bodyEnvironmentCollide(ptr noundef nonnull %16, ptr noundef %76)
  %.not158 = icmp eq i8 %77, 0
  br i1 %.not158, label %.loopexit168, label %78

78:                                               ; preds = %75
  %79 = load ptr, ptr %16, align 8, !tbaa !16
  %.sroa.047.0.copyload = load i64, ptr %79, align 4
  %.sroa.248.0..sroa_idx = getelementptr inbounds i8, ptr %79, i64 8
  %.sroa.248.0.copyload = load i32, ptr %.sroa.248.0..sroa_idx, align 4
  %80 = call { i64, i32 } @TPE_vec3Minus(i64 %.sroa.066.0.copyload, i32 %.sroa.4.0.copyload, i64 %.sroa.047.0.copyload, i32 %.sroa.248.0.copyload)
  %.fca.0.extract43 = extractvalue { i64, i32 } %80, 0
  %.fca.1.extract44 = extractvalue { i64, i32 } %80, 1
  call void @TPE_bodyMoveBy(ptr noundef nonnull %16, i64 %.fca.0.extract43, i32 %.fca.1.extract44)
  br label %.loopexit168

._crit_edge180:                                   ; preds = %139
  %.not152 = icmp eq i8 %142, 0
  br i1 %.not152, label %.loopexit168, label %145

.lr.ph179:                                        ; preds = %.preheader166, %139
  %.0141178 = phi ptr [ %140, %139 ], [ %30, %.preheader166 ]
  %.0146177 = phi i32 [ %96, %139 ], [ 0, %.preheader166 ]
  %.0147176 = phi i16 [ %141, %139 ], [ 0, %.preheader166 ]
  %81 = load ptr, ptr %16, align 8, !tbaa !16
  %82 = load i8, ptr %.0141178, align 2, !tbaa !29
  %83 = zext i8 %82 to i64
  %84 = getelementptr inbounds %struct.TPE_Joint, ptr %81, i64 %83
  %85 = getelementptr inbounds i8, ptr %.0141178, i64 1
  %86 = load i8, ptr %85, align 1, !tbaa !31
  %87 = zext i8 %86 to i64
  %88 = getelementptr inbounds %struct.TPE_Joint, ptr %81, i64 %87
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %4) #4
  %.sroa.034.0.copyload = load i64, ptr %88, align 4
  %.sroa.235.0..sroa_idx = getelementptr inbounds i8, ptr %88, i64 8
  %.sroa.235.0.copyload = load i32, ptr %.sroa.235.0..sroa_idx, align 4
  %.sroa.032.0.copyload = load i64, ptr %84, align 4
  %.sroa.233.0..sroa_idx = getelementptr inbounds i8, ptr %84, i64 8
  %.sroa.233.0.copyload = load i32, ptr %.sroa.233.0..sroa_idx, align 4
  %89 = call { i64, i32 } @TPE_vec3Minus(i64 %.sroa.034.0.copyload, i32 %.sroa.235.0.copyload, i64 %.sroa.032.0.copyload, i32 %.sroa.233.0.copyload)
  %.fca.0.extract = extractvalue { i64, i32 } %89, 0
  %.fca.1.extract = extractvalue { i64, i32 } %89, 1
  store i64 %.fca.0.extract, ptr %4, align 8
  store i32 %.fca.1.extract, ptr %.sroa.231.0..sroa_idx, align 8
  %90 = call i32 @TPE_vec3Len(i64 %.fca.0.extract, i32 %.fca.1.extract)
  %91 = getelementptr inbounds i8, ptr %.0141178, i64 2
  %92 = load i16, ptr %91, align 2, !tbaa !32
  %93 = zext i16 %92 to i32
  %94 = call i32 @TPE_connectionTension(i32 noundef %90, i32 noundef %93)
  %95 = call i32 @llvm.abs.i32(i32 %94, i1 true)
  %96 = add nuw nsw i32 %95, %.0146177
  %97 = add i32 %94, -6
  %or.cond = icmp ult i32 %97, -11
  br i1 %or.cond, label %98, label %139

98:                                               ; preds = %.lr.ph179
  call void @TPE_vec3Normalize(ptr noundef nonnull %4)
  %99 = add i32 %94, -16
  %or.cond3 = icmp ult i32 %99, -31
  %.pre210 = load i32, ptr %4, align 8, !tbaa !33
  %.pre211 = load i32, ptr %12, align 4, !tbaa !34
  %.pre212 = load i32, ptr %.sroa.231.0..sroa_idx, align 8, !tbaa !35
  %100 = zext i1 %or.cond3 to i32
  %101 = shl nsw i32 %.pre212, %100
  %102 = zext i1 %or.cond3 to i32
  %103 = shl nsw i32 %.pre211, %102
  %104 = zext i1 %or.cond3 to i32
  %105 = shl nsw i32 %.pre210, %104
  %106 = sdiv i32 %105, 32
  %107 = sdiv i32 %103, 32
  %108 = sdiv i32 %101, 32
  %109 = icmp slt i32 %94, 0
  br i1 %109, label %110, label %114

110:                                              ; preds = %98
  %111 = sub nsw i32 0, %106
  store i32 %111, ptr %4, align 8, !tbaa !33
  %112 = sub nsw i32 0, %107
  store i32 %112, ptr %12, align 4, !tbaa !34
  %113 = sub nsw i32 0, %108
  store i32 %113, ptr %.sroa.231.0..sroa_idx, align 8, !tbaa !35
  br label %114

114:                                              ; preds = %110, %98
  %115 = phi i32 [ %113, %110 ], [ %108, %98 ]
  %116 = phi i32 [ %112, %110 ], [ %107, %98 ]
  %117 = phi i32 [ %111, %110 ], [ %106, %98 ]
  %118 = getelementptr inbounds i8, ptr %84, i64 12
  %119 = load i16, ptr %118, align 4, !tbaa !21
  %120 = trunc i32 %117 to i16
  %121 = add i16 %119, %120
  store i16 %121, ptr %118, align 4, !tbaa !21
  %122 = getelementptr inbounds i8, ptr %84, i64 14
  %123 = load i16, ptr %122, align 2, !tbaa !21
  %124 = trunc i32 %116 to i16
  %125 = add i16 %123, %124
  store i16 %125, ptr %122, align 2, !tbaa !21
  %126 = getelementptr inbounds i8, ptr %84, i64 16
  %127 = load i16, ptr %126, align 4, !tbaa !21
  %128 = trunc i32 %115 to i16
  %129 = add i16 %127, %128
  store i16 %129, ptr %126, align 4, !tbaa !21
  %130 = getelementptr inbounds i8, ptr %88, i64 12
  %131 = load i16, ptr %130, align 4, !tbaa !21
  %132 = sub i16 %131, %120
  store i16 %132, ptr %130, align 4, !tbaa !21
  %133 = getelementptr inbounds i8, ptr %88, i64 14
  %134 = load i16, ptr %133, align 2, !tbaa !21
  %135 = sub i16 %134, %124
  store i16 %135, ptr %133, align 2, !tbaa !21
  %136 = getelementptr inbounds i8, ptr %88, i64 16
  %137 = load i16, ptr %136, align 4, !tbaa !21
  %138 = sub i16 %137, %128
  store i16 %138, ptr %136, align 4, !tbaa !21
  br label %139

139:                                              ; preds = %.lr.ph179, %114
  %140 = getelementptr inbounds i8, ptr %.0141178, i64 4
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %4) #4
  %141 = add nuw nsw i16 %.0147176, 1
  %142 = load i8, ptr %36, align 8, !tbaa !23
  %143 = zext i8 %142 to i16
  %144 = icmp ult i16 %141, %143
  br i1 %144, label %.lr.ph179, label %._crit_edge180, !llvm.loop !36

145:                                              ; preds = %._crit_edge180
  %146 = load i8, ptr %17, align 8, !tbaa !14
  %147 = lshr i8 %146, 3
  %.lobit = and i8 %147, 1
  %148 = xor i8 %.lobit, 1
  %.not154.not = icmp eq i8 %.lobit, 0
  br i1 %.not154.not, label %149, label %.loopexit165

149:                                              ; preds = %145
  %150 = load ptr, ptr %11, align 8, !tbaa !22
  call void @TPE_bodyReshape(ptr noundef nonnull %16, ptr noundef %150)
  %151 = load i8, ptr %36, align 8, !tbaa !23
  %152 = zext i8 %151 to i32
  %153 = udiv i32 %96, %152
  %154 = icmp ugt i32 %153, 20
  br i1 %154, label %.preheader164.preheader, label %.loopexit165

.preheader164.preheader:                          ; preds = %149
  %155 = load ptr, ptr %11, align 8, !tbaa !22
  call void @TPE_bodyReshape(ptr noundef nonnull %16, ptr noundef %155)
  %156 = load ptr, ptr %11, align 8, !tbaa !22
  call void @TPE_bodyReshape(ptr noundef nonnull %16, ptr noundef %156)
  %157 = load ptr, ptr %11, align 8, !tbaa !22
  call void @TPE_bodyReshape(ptr noundef nonnull %16, ptr noundef %157)
  br label %.loopexit165

.loopexit165:                                     ; preds = %.preheader164.preheader, %149, %145
  %158 = load i8, ptr %17, align 8, !tbaa !14
  %159 = and i8 %158, 16
  %.not155 = icmp eq i8 %159, 0
  br i1 %.not155, label %160, label %.loopexit168

160:                                              ; preds = %.loopexit165
  call void @TPE_bodyCancelOutVelocities(ptr noundef nonnull %16, i8 noundef zeroext %148)
  br label %.loopexit168

.loopexit168:                                     ; preds = %.preheader166, %.preheader167.preheader, %.preheader167.1, %.preheader167.2, %.preheader167.3, %.preheader167.4, %.preheader167.5, %.preheader167.6, %.preheader167.7, %._crit_edge180, %160, %.loopexit165, %72, %75, %78
  %161 = load i16, ptr %9, align 8, !tbaa !12
  %.not195 = icmp eq i16 %161, 0
  br i1 %.not195, label %._crit_edge186, label %.lr.ph185

.lr.ph185:                                        ; preds = %.loopexit168
  %162 = getelementptr inbounds i8, ptr %16, i64 33
  br label %165

._crit_edge186:                                   ; preds = %187, %.loopexit168
  %163 = load i8, ptr %17, align 8, !tbaa !14
  %164 = and i8 %163, 32
  %.not159 = icmp eq i8 %164, 0
  br i1 %.not159, label %191, label %205

165:                                              ; preds = %.lr.ph185, %187
  %166 = phi i16 [ %161, %.lr.ph185 ], [ %188, %187 ]
  %indvars.iv = phi i64 [ 0, %.lr.ph185 ], [ %indvars.iv.next, %187 ]
  %167 = icmp ugt i64 %indvars.iv, %indvars.iv203
  %.pre213 = load ptr, ptr %0, align 8, !tbaa !13
  br i1 %167, label %172, label %168

168:                                              ; preds = %165
  %169 = getelementptr inbounds %struct.TPE_Body, ptr %.pre213, i64 %indvars.iv, i32 7
  %170 = load i8, ptr %169, align 8, !tbaa !14
  %171 = and i8 %170, 1
  %.not160 = icmp eq i8 %171, 0
  br i1 %.not160, label %187, label %172

172:                                              ; preds = %168, %165
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %5) #4
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %6) #4
  %173 = getelementptr inbounds %struct.TPE_Body, ptr %.pre213, i64 %indvars.iv
  call void @TPE_bodyGetAABB(ptr noundef %173, ptr noundef nonnull %5, ptr noundef nonnull %6)
  %174 = trunc nuw i64 %indvars.iv to i16
  store i16 %174, ptr @_TPE_body2Index, align 2, !tbaa !21
  %.sroa.06.0.copyload = load i64, ptr %2, align 8
  %.sroa.27.0.copyload = load i32, ptr %.sroa.27.0..sroa_idx, align 8
  %.sroa.04.0.copyload = load i64, ptr %3, align 8
  %.sroa.25.0.copyload = load i32, ptr %.sroa.25.0..sroa_idx, align 8
  %.sroa.0.0.copyload = load i64, ptr %5, align 8
  %.sroa.2.0.copyload = load i32, ptr %.sroa.2.0..sroa_idx, align 8
  %175 = call zeroext i8 @TPE_checkOverlapAABB(i64 %.sroa.06.0.copyload, i32 %.sroa.27.0.copyload, i64 %.sroa.04.0.copyload, i32 %.sroa.25.0.copyload, i64 %.sroa.0.0.copyload, i32 %.sroa.2.0.copyload, ptr noundef nonnull byval(%struct.TPE_Vec3) align 8 %6)
  %.not161 = icmp eq i8 %175, 0
  br i1 %.not161, label %186, label %176

176:                                              ; preds = %172
  %177 = load ptr, ptr %0, align 8, !tbaa !13
  %178 = getelementptr inbounds %struct.TPE_Body, ptr %177, i64 %indvars.iv
  %179 = load ptr, ptr %11, align 8, !tbaa !22
  %180 = call zeroext i8 @TPE_bodiesResolveCollision(ptr noundef nonnull %16, ptr noundef %178, ptr noundef %179)
  %.not162 = icmp eq i8 %180, 0
  br i1 %.not162, label %186, label %181

181:                                              ; preds = %176
  call void @TPE_bodyActivate(ptr noundef nonnull %16)
  store i8 116, ptr %162, align 1, !tbaa !37
  %182 = load ptr, ptr %0, align 8, !tbaa !13
  %183 = getelementptr inbounds %struct.TPE_Body, ptr %182, i64 %indvars.iv
  call void @TPE_bodyActivate(ptr noundef %183)
  %184 = load ptr, ptr %0, align 8, !tbaa !13
  %185 = getelementptr inbounds %struct.TPE_Body, ptr %184, i64 %indvars.iv, i32 8
  store i8 116, ptr %185, align 1, !tbaa !37
  br label %186

186:                                              ; preds = %181, %176, %172
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %5) #4
  %.pre214 = load i16, ptr %9, align 8, !tbaa !12
  br label %187

187:                                              ; preds = %168, %186
  %188 = phi i16 [ %166, %168 ], [ %.pre214, %186 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %189 = zext i16 %188 to i64
  %190 = icmp ult i64 %indvars.iv.next, %189
  br i1 %190, label %165, label %._crit_edge186, !llvm.loop !38

191:                                              ; preds = %._crit_edge186
  %192 = getelementptr inbounds i8, ptr %16, i64 33
  %193 = load i8, ptr %192, align 1, !tbaa !37
  %194 = icmp slt i8 %193, 0
  br i1 %194, label %195, label %198

195:                                              ; preds = %191
  call void @TPE_bodyStop(ptr noundef nonnull %16)
  store i8 0, ptr %192, align 1, !tbaa !37
  %196 = load i8, ptr %17, align 8, !tbaa !14
  %197 = or i8 %196, 1
  store i8 %197, ptr %17, align 8, !tbaa !14
  br label %205

198:                                              ; preds = %191
  %199 = call i32 @TPE_bodyGetAverageSpeed(ptr noundef nonnull %16)
  %200 = icmp slt i32 %199, 31
  br i1 %200, label %201, label %204

201:                                              ; preds = %198
  %202 = load i8, ptr %192, align 1, !tbaa !37
  %203 = add i8 %202, 1
  store i8 %203, ptr %192, align 1, !tbaa !37
  br label %205

204:                                              ; preds = %198
  store i8 0, ptr %192, align 1, !tbaa !37
  br label %205

205:                                              ; preds = %195, %204, %201, %._crit_edge186
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %2) #4
  %.pre215 = load i16, ptr %9, align 8, !tbaa !12
  br label %206

206:                                              ; preds = %13, %205
  %207 = phi i16 [ %14, %13 ], [ %.pre215, %205 ]
  %indvars.iv.next204 = add nuw nsw i64 %indvars.iv203, 1
  %208 = zext i16 %207 to i64
  %209 = icmp ult i64 %indvars.iv.next204, %208
  br i1 %209, label %13, label %._crit_edge191, !llvm.loop !39
}

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

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @TPE_bodyEnvironmentResolveCollision(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @TPE_bodyEnvironmentCollide(ptr noundef, ptr noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
declare dso_local { i64, i32 } @TPE_vec3Minus(i64, i32, i64, i32) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @TPE_connectionTension(i32 noundef, i32 noundef) local_unnamed_addr #2

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @TPE_bodyCancelOutVelocities(ptr noundef, i8 noundef zeroext) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @TPE_checkOverlapAABB(i64, i32, i64, i32, i64, i32, ptr noundef byval(%struct.TPE_Vec3) align 8) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @TPE_bodiesResolveCollision(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #3

attributes #0 = { mustprogress 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 = { inlinehint 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 = { 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, !7, i64 24}
!6 = !{!"", !7, i64 0, !10, i64 8, !7, i64 16, !7, i64 24}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"short", !8, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!6, !10, i64 8}
!13 = !{!6, !7, i64 0}
!14 = !{!15, !8, i64 32}
!15 = !{!"", !7, i64 0, !8, i64 8, !7, i64 16, !8, i64 24, !10, i64 26, !10, i64 28, !10, i64 30, !8, i64 32, !8, i64 33}
!16 = !{!15, !7, i64 0}
!17 = !{!18, !18, i64 0}
!18 = !{!"int", !8, i64 0}
!19 = !{!15, !8, i64 8}
!20 = !{!15, !7, i64 16}
!21 = !{!10, !10, i64 0}
!22 = !{!6, !7, i64 16}
!23 = !{!15, !8, i64 24}
!24 = !{!25, !18, i64 8}
!25 = !{!"", !26, i64 0, !8, i64 12, !8, i64 18}
!26 = !{!"", !18, i64 0, !18, i64 4, !18, i64 8}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}
!29 = !{!30, !8, i64 0}
!30 = !{!"", !8, i64 0, !8, i64 1, !10, i64 2}
!31 = !{!30, !8, i64 1}
!32 = !{!30, !10, i64 2}
!33 = !{!26, !18, i64 0}
!34 = !{!26, !18, i64 4}
!35 = !{!26, !18, i64 8}
!36 = distinct !{!36, !28}
!37 = !{!15, !8, i64 33}
!38 = distinct !{!38, !28}
!39 = distinct !{!39, !28}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass