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

; 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: nounwind uwtable
declare dso_local { i64, i32 } @TPE_vec3(i32 noundef, i32 noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @TPE_sqrt(i32 noundef) #1

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

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

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

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

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

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @TPE_vec3Dot(i64, i32, i64, i32) #1

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

; Function Attrs: nounwind uwtable
define dso_local { i64, i32 } @TPE_castBodyRay(i64 %0, i32 %1, i64 %2, i32 %3, i16 noundef signext %4, ptr noundef %5, ptr noundef %6, ptr noundef %7) #1 {
  %9 = alloca %struct.TPE_Vec3, align 4
  %10 = alloca %struct.TPE_Vec3, align 4
  %11 = alloca { i64, i32 }, align 4
  %12 = alloca %struct.TPE_Vec3, align 4
  %13 = alloca { i64, i32 }, align 4
  %14 = alloca i16, align 2
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca { i64, i32 }, align 8
  %19 = alloca i32, align 4
  %20 = alloca i16, align 2
  %21 = alloca i32, align 4
  %22 = alloca %struct.TPE_Vec3, align 4
  %23 = alloca %struct.TPE_Vec3, align 4
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  %26 = alloca %struct.TPE_Vec3, align 4
  %27 = alloca { i64, i32 }, align 4
  %28 = alloca { i64, i32 }, align 4
  %29 = alloca { i64, i32 }, align 8
  %30 = alloca %struct.TPE_Vec3, align 4
  %31 = alloca { i64, i32 }, align 4
  %32 = alloca { i64, i32 }, align 4
  %33 = alloca { i64, i32 }, align 8
  %34 = alloca { i64, i32 }, align 4
  %35 = alloca { i64, i32 }, align 4
  %36 = alloca { i64, i32 }, align 4
  %37 = alloca { i64, i32 }, align 4
  %38 = alloca ptr, align 8
  %39 = alloca i16, align 2
  %40 = alloca %struct.TPE_Vec3, align 4
  %41 = alloca { i64, i32 }, align 4
  %42 = alloca { i64, i32 }, align 4
  %43 = alloca { i64, i32 }, align 8
  %44 = alloca %struct.TPE_Vec3, align 4
  %45 = alloca { i64, i32 }, align 4
  %46 = alloca { i64, i32 }, align 4
  %47 = alloca { i64, i32 }, align 8
  %48 = alloca { i64, i32 }, align 4
  %49 = alloca { i64, i32 }, align 4
  %50 = alloca { i64, i32 }, align 4
  %51 = alloca { i64, i32 }, align 4
  %52 = alloca i32, align 4
  %53 = alloca %struct.TPE_Vec3, align 4
  %54 = alloca { i64, i32 }, align 4
  %55 = alloca { i64, i32 }, align 8
  %56 = alloca %struct.TPE_Vec3, align 4
  %57 = alloca { i64, i32 }, align 4
  %58 = alloca { i64, i32 }, align 4
  %59 = alloca { i64, i32 }, align 8
  %60 = alloca %struct.TPE_Vec3, align 4
  %61 = alloca { i64, i32 }, align 4
  %62 = alloca { i64, i32 }, align 4
  %63 = alloca { i64, i32 }, align 8
  %64 = alloca %struct.TPE_Vec3, align 4
  %65 = alloca { i64, i32 }, align 4
  %66 = alloca { i64, i32 }, align 4
  %67 = alloca { i64, i32 }, align 8
  %68 = alloca { i64, i32 }, align 4
  %69 = alloca { i64, i32 }, align 4
  %70 = alloca i32, align 4
  %71 = alloca { i64, i32 }, align 4
  %72 = alloca { i64, i32 }, align 4
  %73 = alloca { i64, i32 }, align 8
  %74 = getelementptr inbounds { i64, i32 }, ptr %11, i32 0, i32 0
  store i64 %0, ptr %74, align 4
  %75 = getelementptr inbounds { i64, i32 }, ptr %11, i32 0, i32 1
  store i32 %1, ptr %75, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %10, ptr align 4 %11, i64 12, i1 false)
  %76 = getelementptr inbounds { i64, i32 }, ptr %13, i32 0, i32 0
  store i64 %2, ptr %76, align 4
  %77 = getelementptr inbounds { i64, i32 }, ptr %13, i32 0, i32 1
  store i32 %3, ptr %77, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %12, ptr align 4 %13, i64 12, i1 false)
  store i16 %4, ptr %14, align 2, !tbaa !5
  store ptr %5, ptr %15, align 8, !tbaa !9
  store ptr %6, ptr %16, align 8, !tbaa !9
  store ptr %7, ptr %17, align 8, !tbaa !9
  %78 = call { i64, i32 } @TPE_vec3(i32 noundef 2147483647, i32 noundef 2147483647, i32 noundef 2147483647)
  store { i64, i32 } %78, ptr %18, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %9, ptr align 8 %18, i64 12, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #4
  store i32 2147483647, ptr %19, align 4, !tbaa !11
  %79 = load ptr, ptr %16, align 8, !tbaa !9
  %80 = icmp ne ptr %79, null
  br i1 %80, label %81, label %83

81:                                               ; preds = %8
  %82 = load ptr, ptr %16, align 8, !tbaa !9
  store i16 -1, ptr %82, align 2, !tbaa !5
  br label %83

83:                                               ; preds = %81, %8
  %84 = load ptr, ptr %17, align 8, !tbaa !9
  %85 = icmp ne ptr %84, null
  br i1 %85, label %86, label %88

86:                                               ; preds = %83
  %87 = load ptr, ptr %17, align 8, !tbaa !9
  store i16 -1, ptr %87, align 2, !tbaa !5
  br label %88

88:                                               ; preds = %86, %83
  call void @TPE_vec3Normalize(ptr noundef %12)
  call void @llvm.lifetime.start.p0(i64 2, ptr %20) #4
  store i16 0, ptr %20, align 2, !tbaa !5
  br label %89

89:                                               ; preds = %311, %88
  %90 = load i16, ptr %20, align 2, !tbaa !5
  %91 = zext i16 %90 to i32
  %92 = load ptr, ptr %15, align 8, !tbaa !9
  %93 = getelementptr inbounds %struct.TPE_World, ptr %92, i32 0, i32 1
  %94 = load i16, ptr %93, align 8, !tbaa !13
  %95 = zext i16 %94 to i32
  %96 = icmp slt i32 %91, %95
  br i1 %96, label %98, label %97

97:                                               ; preds = %89
  store i32 2, ptr %21, align 4
  call void @llvm.lifetime.end.p0(i64 2, ptr %20) #4
  br label %314

98:                                               ; preds = %89
  call void @llvm.lifetime.start.p0(i64 12, ptr %22) #4
  call void @llvm.lifetime.start.p0(i64 12, ptr %23) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #4
  %99 = load ptr, ptr %15, align 8, !tbaa !9
  %100 = getelementptr inbounds %struct.TPE_World, ptr %99, i32 0, i32 0
  %101 = load ptr, ptr %100, align 8, !tbaa !15
  %102 = load i16, ptr %20, align 2, !tbaa !5
  %103 = zext i16 %102 to i64
  %104 = getelementptr inbounds %struct.TPE_Body, ptr %101, i64 %103
  call void @TPE_bodyGetFastBSphere(ptr noundef %104, ptr noundef %22, ptr noundef %24)
  call void @llvm.lifetime.start.p0(i64 12, ptr %26) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %27, ptr align 4 %22, i64 12, i1 false)
  %105 = getelementptr inbounds { i64, i32 }, ptr %27, i32 0, i32 0
  %106 = load i64, ptr %105, align 4
  %107 = getelementptr inbounds { i64, i32 }, ptr %27, i32 0, i32 1
  %108 = load i32, ptr %107, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %28, ptr align 4 %10, i64 12, i1 false)
  %109 = getelementptr inbounds { i64, i32 }, ptr %28, i32 0, i32 0
  %110 = load i64, ptr %109, align 4
  %111 = getelementptr inbounds { i64, i32 }, ptr %28, i32 0, i32 1
  %112 = load i32, ptr %111, align 4
  %113 = call { i64, i32 } @TPE_vec3Minus(i64 %106, i32 %108, i64 %110, i32 %112)
  store { i64, i32 } %113, ptr %29, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %26, ptr align 8 %29, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %22, ptr align 4 %26, i64 12, i1 false), !tbaa.struct !16
  call void @llvm.lifetime.end.p0(i64 12, ptr %26) #4
  call void @llvm.lifetime.start.p0(i64 12, ptr %30) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %31, ptr align 4 %22, i64 12, i1 false)
  %114 = getelementptr inbounds { i64, i32 }, ptr %31, i32 0, i32 0
  %115 = load i64, ptr %114, align 4
  %116 = getelementptr inbounds { i64, i32 }, ptr %31, i32 0, i32 1
  %117 = load i32, ptr %116, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %32, ptr align 4 %12, i64 12, i1 false)
  %118 = getelementptr inbounds { i64, i32 }, ptr %32, i32 0, i32 0
  %119 = load i64, ptr %118, align 4
  %120 = getelementptr inbounds { i64, i32 }, ptr %32, i32 0, i32 1
  %121 = load i32, ptr %120, align 4
  %122 = call { i64, i32 } @TPE_vec3ProjectNormalized(i64 %115, i32 %117, i64 %119, i32 %121)
  store { i64, i32 } %122, ptr %33, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %30, ptr align 8 %33, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %23, ptr align 4 %30, i64 12, i1 false), !tbaa.struct !16
  call void @llvm.lifetime.end.p0(i64 12, ptr %30) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %34, ptr align 4 %23, i64 12, i1 false)
  %123 = getelementptr inbounds { i64, i32 }, ptr %34, i32 0, i32 0
  %124 = load i64, ptr %123, align 4
  %125 = getelementptr inbounds { i64, i32 }, ptr %34, i32 0, i32 1
  %126 = load i32, ptr %125, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %35, ptr align 4 %12, i64 12, i1 false)
  %127 = getelementptr inbounds { i64, i32 }, ptr %35, i32 0, i32 0
  %128 = load i64, ptr %127, align 4
  %129 = getelementptr inbounds { i64, i32 }, ptr %35, i32 0, i32 1
  %130 = load i32, ptr %129, align 4
  %131 = call i32 @TPE_vec3Dot(i64 %124, i32 %126, i64 %128, i32 %130)
  %132 = icmp sge i32 %131, 0
  br i1 %132, label %133, label %310

133:                                              ; preds = %98
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %36, ptr align 4 %23, i64 12, i1 false)
  %134 = getelementptr inbounds { i64, i32 }, ptr %36, i32 0, i32 0
  %135 = load i64, ptr %134, align 4
  %136 = getelementptr inbounds { i64, i32 }, ptr %36, i32 0, i32 1
  %137 = load i32, ptr %136, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %37, ptr align 4 %22, i64 12, i1 false)
  %138 = getelementptr inbounds { i64, i32 }, ptr %37, i32 0, i32 0
  %139 = load i64, ptr %138, align 4
  %140 = getelementptr inbounds { i64, i32 }, ptr %37, i32 0, i32 1
  %141 = load i32, ptr %140, align 4
  %142 = call i32 @TPE_dist(i64 %135, i32 %137, i64 %139, i32 %141)
  store i32 %142, ptr %25, align 4, !tbaa !11
  %143 = load i32, ptr %25, align 4, !tbaa !11
  %144 = load i32, ptr %24, align 4, !tbaa !11
  %145 = icmp sle i32 %143, %144
  br i1 %145, label %146, label %309

146:                                              ; preds = %133
  call void @llvm.lifetime.start.p0(i64 8, ptr %38) #4
  %147 = load ptr, ptr %15, align 8, !tbaa !9
  %148 = getelementptr inbounds %struct.TPE_World, ptr %147, i32 0, i32 0
  %149 = load ptr, ptr %148, align 8, !tbaa !15
  %150 = load i16, ptr %20, align 2, !tbaa !5
  %151 = zext i16 %150 to i64
  %152 = getelementptr inbounds %struct.TPE_Body, ptr %149, i64 %151
  %153 = getelementptr inbounds %struct.TPE_Body, ptr %152, i32 0, i32 0
  %154 = load ptr, ptr %153, align 8, !tbaa !17
  store ptr %154, ptr %38, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 2, ptr %39) #4
  store i16 0, ptr %39, align 2, !tbaa !5
  br label %155

155:                                              ; preds = %305, %146
  %156 = load i16, ptr %39, align 2, !tbaa !5
  %157 = zext i16 %156 to i32
  %158 = load ptr, ptr %15, align 8, !tbaa !9
  %159 = getelementptr inbounds %struct.TPE_World, ptr %158, i32 0, i32 0
  %160 = load ptr, ptr %159, align 8, !tbaa !15
  %161 = load i16, ptr %20, align 2, !tbaa !5
  %162 = zext i16 %161 to i64
  %163 = getelementptr inbounds %struct.TPE_Body, ptr %160, i64 %162
  %164 = getelementptr inbounds %struct.TPE_Body, ptr %163, i32 0, i32 1
  %165 = load i8, ptr %164, align 8, !tbaa !19
  %166 = zext i8 %165 to i32
  %167 = icmp slt i32 %157, %166
  br i1 %167, label %169, label %168

168:                                              ; preds = %155
  store i32 5, ptr %21, align 4
  call void @llvm.lifetime.end.p0(i64 2, ptr %39) #4
  br label %308

169:                                              ; preds = %155
  %170 = load ptr, ptr %38, align 8, !tbaa !9
  %171 = getelementptr inbounds %struct.TPE_Joint, ptr %170, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %22, ptr align 4 %171, i64 12, i1 false), !tbaa.struct !16
  call void @llvm.lifetime.start.p0(i64 12, ptr %40) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %41, ptr align 4 %22, i64 12, i1 false)
  %172 = getelementptr inbounds { i64, i32 }, ptr %41, i32 0, i32 0
  %173 = load i64, ptr %172, align 4
  %174 = getelementptr inbounds { i64, i32 }, ptr %41, i32 0, i32 1
  %175 = load i32, ptr %174, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %42, ptr align 4 %10, i64 12, i1 false)
  %176 = getelementptr inbounds { i64, i32 }, ptr %42, i32 0, i32 0
  %177 = load i64, ptr %176, align 4
  %178 = getelementptr inbounds { i64, i32 }, ptr %42, i32 0, i32 1
  %179 = load i32, ptr %178, align 4
  %180 = call { i64, i32 } @TPE_vec3Minus(i64 %173, i32 %175, i64 %177, i32 %179)
  store { i64, i32 } %180, ptr %43, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %40, ptr align 8 %43, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %22, ptr align 4 %40, i64 12, i1 false), !tbaa.struct !16
  call void @llvm.lifetime.end.p0(i64 12, ptr %40) #4
  call void @llvm.lifetime.start.p0(i64 12, ptr %44) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %45, ptr align 4 %22, i64 12, i1 false)
  %181 = getelementptr inbounds { i64, i32 }, ptr %45, i32 0, i32 0
  %182 = load i64, ptr %181, align 4
  %183 = getelementptr inbounds { i64, i32 }, ptr %45, i32 0, i32 1
  %184 = load i32, ptr %183, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %46, ptr align 4 %12, i64 12, i1 false)
  %185 = getelementptr inbounds { i64, i32 }, ptr %46, i32 0, i32 0
  %186 = load i64, ptr %185, align 4
  %187 = getelementptr inbounds { i64, i32 }, ptr %46, i32 0, i32 1
  %188 = load i32, ptr %187, align 4
  %189 = call { i64, i32 } @TPE_vec3ProjectNormalized(i64 %182, i32 %184, i64 %186, i32 %188)
  store { i64, i32 } %189, ptr %47, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %44, ptr align 8 %47, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %23, ptr align 4 %44, i64 12, i1 false), !tbaa.struct !16
  call void @llvm.lifetime.end.p0(i64 12, ptr %44) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %48, ptr align 4 %23, i64 12, i1 false)
  %190 = getelementptr inbounds { i64, i32 }, ptr %48, i32 0, i32 0
  %191 = load i64, ptr %190, align 4
  %192 = getelementptr inbounds { i64, i32 }, ptr %48, i32 0, i32 1
  %193 = load i32, ptr %192, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %49, ptr align 4 %12, i64 12, i1 false)
  %194 = getelementptr inbounds { i64, i32 }, ptr %49, i32 0, i32 0
  %195 = load i64, ptr %194, align 4
  %196 = getelementptr inbounds { i64, i32 }, ptr %49, i32 0, i32 1
  %197 = load i32, ptr %196, align 4
  %198 = call i32 @TPE_vec3Dot(i64 %191, i32 %193, i64 %195, i32 %197)
  %199 = icmp sge i32 %198, 0
  br i1 %199, label %200, label %302

200:                                              ; preds = %169
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %50, ptr align 4 %23, i64 12, i1 false)
  %201 = getelementptr inbounds { i64, i32 }, ptr %50, i32 0, i32 0
  %202 = load i64, ptr %201, align 4
  %203 = getelementptr inbounds { i64, i32 }, ptr %50, i32 0, i32 1
  %204 = load i32, ptr %203, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %51, ptr align 4 %22, i64 12, i1 false)
  %205 = getelementptr inbounds { i64, i32 }, ptr %51, i32 0, i32 0
  %206 = load i64, ptr %205, align 4
  %207 = getelementptr inbounds { i64, i32 }, ptr %51, i32 0, i32 1
  %208 = load i32, ptr %207, align 4
  %209 = call i32 @TPE_dist(i64 %202, i32 %204, i64 %206, i32 %208)
  store i32 %209, ptr %25, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %52) #4
  %210 = load ptr, ptr %38, align 8, !tbaa !9
  %211 = getelementptr inbounds %struct.TPE_Joint, ptr %210, i32 0, i32 2
  %212 = load i8, ptr %211, align 2, !tbaa !20
  %213 = zext i8 %212 to i32
  %214 = mul nsw i32 %213, 32
  store i32 %214, ptr %52, align 4, !tbaa !11
  %215 = load i32, ptr %25, align 4, !tbaa !11
  %216 = load i32, ptr %52, align 4, !tbaa !11
  %217 = icmp sle i32 %215, %216
  br i1 %217, label %218, label %301

218:                                              ; preds = %200
  %219 = load ptr, ptr %16, align 8, !tbaa !9
  %220 = icmp ne ptr %219, null
  br i1 %220, label %221, label %224

221:                                              ; preds = %218
  %222 = load i16, ptr %20, align 2, !tbaa !5
  %223 = load ptr, ptr %16, align 8, !tbaa !9
  store i16 %222, ptr %223, align 2, !tbaa !5
  br label %224

224:                                              ; preds = %221, %218
  %225 = load ptr, ptr %17, align 8, !tbaa !9
  %226 = icmp ne ptr %225, null
  br i1 %226, label %227, label %230

227:                                              ; preds = %224
  %228 = load i16, ptr %39, align 2, !tbaa !5
  %229 = load ptr, ptr %17, align 8, !tbaa !9
  store i16 %228, ptr %229, align 2, !tbaa !5
  br label %230

230:                                              ; preds = %227, %224
  call void @llvm.lifetime.start.p0(i64 12, ptr %53) #4
  %231 = load i32, ptr %52, align 4, !tbaa !11
  %232 = load i32, ptr %52, align 4, !tbaa !11
  %233 = mul nsw i32 %231, %232
  %234 = load i32, ptr %25, align 4, !tbaa !11
  %235 = load i32, ptr %25, align 4, !tbaa !11
  %236 = mul nsw i32 %234, %235
  %237 = sub nsw i32 %233, %236
  %238 = call i32 @TPE_sqrt(i32 noundef %237)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %54, ptr align 4 %12, i64 12, i1 false)
  %239 = getelementptr inbounds { i64, i32 }, ptr %54, i32 0, i32 0
  %240 = load i64, ptr %239, align 4
  %241 = getelementptr inbounds { i64, i32 }, ptr %54, i32 0, i32 1
  %242 = load i32, ptr %241, align 4
  %243 = call { i64, i32 } @TPE_vec3Times(i64 %240, i32 %242, i32 noundef %238)
  store { i64, i32 } %243, ptr %55, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %53, ptr align 8 %55, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %22, ptr align 4 %53, i64 12, i1 false), !tbaa.struct !16
  call void @llvm.lifetime.end.p0(i64 12, ptr %53) #4
  call void @llvm.lifetime.start.p0(i64 12, ptr %56) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %57, ptr align 4 %23, i64 12, i1 false)
  %244 = getelementptr inbounds { i64, i32 }, ptr %57, i32 0, i32 0
  %245 = load i64, ptr %244, align 4
  %246 = getelementptr inbounds { i64, i32 }, ptr %57, i32 0, i32 1
  %247 = load i32, ptr %246, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %58, ptr align 4 %10, i64 12, i1 false)
  %248 = getelementptr inbounds { i64, i32 }, ptr %58, i32 0, i32 0
  %249 = load i64, ptr %248, align 4
  %250 = getelementptr inbounds { i64, i32 }, ptr %58, i32 0, i32 1
  %251 = load i32, ptr %250, align 4
  %252 = call { i64, i32 } @TPE_vec3Plus(i64 %245, i32 %247, i64 %249, i32 %251)
  store { i64, i32 } %252, ptr %59, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %56, ptr align 8 %59, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %23, ptr align 4 %56, i64 12, i1 false), !tbaa.struct !16
  call void @llvm.lifetime.end.p0(i64 12, ptr %56) #4
  call void @llvm.lifetime.start.p0(i64 12, ptr %60) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %61, ptr align 4 %23, i64 12, i1 false)
  %253 = getelementptr inbounds { i64, i32 }, ptr %61, i32 0, i32 0
  %254 = load i64, ptr %253, align 4
  %255 = getelementptr inbounds { i64, i32 }, ptr %61, i32 0, i32 1
  %256 = load i32, ptr %255, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %62, ptr align 4 %22, i64 12, i1 false)
  %257 = getelementptr inbounds { i64, i32 }, ptr %62, i32 0, i32 0
  %258 = load i64, ptr %257, align 4
  %259 = getelementptr inbounds { i64, i32 }, ptr %62, i32 0, i32 1
  %260 = load i32, ptr %259, align 4
  %261 = call { i64, i32 } @TPE_vec3Plus(i64 %254, i32 %256, i64 %258, i32 %260)
  store { i64, i32 } %261, ptr %63, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %60, ptr align 8 %63, i64 12, i1 false)
  call void @llvm.lifetime.start.p0(i64 12, ptr %64) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %65, ptr align 4 %23, i64 12, i1 false)
  %262 = getelementptr inbounds { i64, i32 }, ptr %65, i32 0, i32 0
  %263 = load i64, ptr %262, align 4
  %264 = getelementptr inbounds { i64, i32 }, ptr %65, i32 0, i32 1
  %265 = load i32, ptr %264, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %66, ptr align 4 %22, i64 12, i1 false)
  %266 = getelementptr inbounds { i64, i32 }, ptr %66, i32 0, i32 0
  %267 = load i64, ptr %266, align 4
  %268 = getelementptr inbounds { i64, i32 }, ptr %66, i32 0, i32 1
  %269 = load i32, ptr %268, align 4
  %270 = call { i64, i32 } @TPE_vec3Minus(i64 %263, i32 %265, i64 %267, i32 %269)
  store { i64, i32 } %270, ptr %67, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %64, ptr align 8 %67, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %68, ptr align 4 %10, i64 12, i1 false)
  %271 = getelementptr inbounds { i64, i32 }, ptr %68, i32 0, i32 0
  %272 = load i64, ptr %271, align 4
  %273 = getelementptr inbounds { i64, i32 }, ptr %68, i32 0, i32 1
  %274 = load i32, ptr %273, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %69, ptr align 4 %60, i64 12, i1 false)
  %275 = getelementptr inbounds { i64, i32 }, ptr %69, i32 0, i32 0
  %276 = load i64, ptr %275, align 4
  %277 = getelementptr inbounds { i64, i32 }, ptr %69, i32 0, i32 1
  %278 = load i32, ptr %277, align 4
  %279 = call i32 @TPE_dist(i64 %272, i32 %274, i64 %276, i32 %278)
  store i32 %279, ptr %25, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %70) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %71, ptr align 4 %10, i64 12, i1 false)
  %280 = getelementptr inbounds { i64, i32 }, ptr %71, i32 0, i32 0
  %281 = load i64, ptr %280, align 4
  %282 = getelementptr inbounds { i64, i32 }, ptr %71, i32 0, i32 1
  %283 = load i32, ptr %282, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %72, ptr align 4 %64, i64 12, i1 false)
  %284 = getelementptr inbounds { i64, i32 }, ptr %72, i32 0, i32 0
  %285 = load i64, ptr %284, align 4
  %286 = getelementptr inbounds { i64, i32 }, ptr %72, i32 0, i32 1
  %287 = load i32, ptr %286, align 4
  %288 = call i32 @TPE_dist(i64 %281, i32 %283, i64 %285, i32 %287)
  store i32 %288, ptr %70, align 4, !tbaa !11
  %289 = load i32, ptr %70, align 4, !tbaa !11
  %290 = load i32, ptr %25, align 4, !tbaa !11
  %291 = icmp slt i32 %289, %290
  br i1 %291, label %292, label %294

292:                                              ; preds = %230
  %293 = load i32, ptr %70, align 4, !tbaa !11
  store i32 %293, ptr %25, align 4, !tbaa !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %60, ptr align 4 %64, i64 12, i1 false), !tbaa.struct !16
  br label %294

294:                                              ; preds = %292, %230
  %295 = load i32, ptr %25, align 4, !tbaa !11
  %296 = load i32, ptr %19, align 4, !tbaa !11
  %297 = icmp slt i32 %295, %296
  br i1 %297, label %298, label %300

298:                                              ; preds = %294
  %299 = load i32, ptr %25, align 4, !tbaa !11
  store i32 %299, ptr %19, align 4, !tbaa !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %9, ptr align 4 %60, i64 12, i1 false), !tbaa.struct !16
  br label %300

300:                                              ; preds = %298, %294
  call void @llvm.lifetime.end.p0(i64 4, ptr %70) #4
  call void @llvm.lifetime.end.p0(i64 12, ptr %64) #4
  call void @llvm.lifetime.end.p0(i64 12, ptr %60) #4
  br label %301

301:                                              ; preds = %300, %200
  call void @llvm.lifetime.end.p0(i64 4, ptr %52) #4
  br label %302

302:                                              ; preds = %301, %169
  %303 = load ptr, ptr %38, align 8, !tbaa !9
  %304 = getelementptr inbounds %struct.TPE_Joint, ptr %303, i32 1
  store ptr %304, ptr %38, align 8, !tbaa !9
  br label %305

305:                                              ; preds = %302
  %306 = load i16, ptr %39, align 2, !tbaa !5
  %307 = add i16 %306, 1
  store i16 %307, ptr %39, align 2, !tbaa !5
  br label %155, !llvm.loop !23

308:                                              ; preds = %168
  call void @llvm.lifetime.end.p0(i64 8, ptr %38) #4
  br label %309

309:                                              ; preds = %308, %133
  br label %310

310:                                              ; preds = %309, %98
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #4
  call void @llvm.lifetime.end.p0(i64 12, ptr %23) #4
  call void @llvm.lifetime.end.p0(i64 12, ptr %22) #4
  br label %311

311:                                              ; preds = %310
  %312 = load i16, ptr %20, align 2, !tbaa !5
  %313 = add i16 %312, 1
  store i16 %313, ptr %20, align 2, !tbaa !5
  br label %89, !llvm.loop !25

314:                                              ; preds = %97
  store i32 1, ptr %21, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %73, ptr align 4 %9, i64 12, i1 false)
  %315 = load { i64, i32 }, ptr %73, align 8
  ret { i64, i32 } %315
}

attributes #0 = { nocallback nofree 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"short", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !6, i64 8}
!14 = !{!"", !10, i64 0, !6, i64 8, !10, i64 16, !10, i64 24}
!15 = !{!14, !10, i64 0}
!16 = !{i64 0, i64 4, !11, i64 4, i64 4, !11, i64 8, i64 4, !11}
!17 = !{!18, !10, i64 0}
!18 = !{!"", !10, i64 0, !7, i64 8, !10, i64 16, !7, i64 24, !6, i64 26, !6, i64 28, !6, i64 30, !7, i64 32, !7, i64 33}
!19 = !{!18, !7, i64 8}
!20 = !{!21, !7, i64 18}
!21 = !{!"", !22, i64 0, !7, i64 12, !7, i64 18}
!22 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}
!25 = distinct !{!25, !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 }

; Function Attrs: mustprogress 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: nounwind uwtable
declare dso_local { i64, i32 } @TPE_vec3(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

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

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @TPE_dist(i64, i32, i64, i32) local_unnamed_addr #3

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

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

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local { i64, i32 } @TPE_castBodyRay(i64 %0, i32 %1, i64 %2, i32 %3, i16 noundef signext %4, ptr nocapture noundef readonly %5, ptr noundef writeonly %6, ptr noundef writeonly %7) local_unnamed_addr #1 {
  %9 = alloca %struct.TPE_Vec3, align 8
  %10 = alloca %struct.TPE_Vec3, align 8
  %11 = alloca i32, align 4
  store i64 %2, ptr %9, align 8
  %.sroa.2151.0..sroa_idx = getelementptr inbounds i8, ptr %9, i64 8
  store i32 %3, ptr %.sroa.2151.0..sroa_idx, align 8
  %12 = tail call { i64, i32 } @TPE_vec3(i32 noundef 2147483647, i32 noundef 2147483647, i32 noundef 2147483647)
  %.fca.0.extract134 = extractvalue { i64, i32 } %12, 0
  %.fca.1.extract135 = extractvalue { i64, i32 } %12, 1
  %.not = icmp eq ptr %6, null
  br i1 %.not, label %14, label %13

13:                                               ; preds = %8
  store i16 -1, ptr %6, align 2, !tbaa !5
  br label %14

14:                                               ; preds = %13, %8
  %.not177 = icmp eq ptr %7, null
  br i1 %.not177, label %16, label %15

15:                                               ; preds = %14
  store i16 -1, ptr %7, align 2, !tbaa !5
  br label %16

16:                                               ; preds = %15, %14
  call void @TPE_vec3Normalize(ptr noundef nonnull %9)
  %17 = getelementptr inbounds i8, ptr %5, i64 8
  %18 = load i16, ptr %17, align 8, !tbaa !9
  %.not194 = icmp eq i16 %18, 0
  br i1 %.not194, label %._crit_edge, label %.lr.ph191

.lr.ph191:                                        ; preds = %16
  %.sroa.2104.0..sroa_idx = getelementptr inbounds i8, ptr %10, i64 8
  br label %19

._crit_edge:                                      ; preds = %.loopexit, %16
  %.sroa.0164.0.lcssa = phi i64 [ %.fca.0.extract134, %16 ], [ %.sroa.0164.5, %.loopexit ]
  %.sroa.3.0.lcssa = phi i32 [ %.fca.1.extract135, %16 ], [ %.sroa.3.5, %.loopexit ]
  %.fca.0.insert = insertvalue { i64, i32 } poison, i64 %.sroa.0164.0.lcssa, 0
  %.fca.1.insert = insertvalue { i64, i32 } %.fca.0.insert, i32 %.sroa.3.0.lcssa, 1
  ret { i64, i32 } %.fca.1.insert

19:                                               ; preds = %.lr.ph191, %.loopexit
  %indvars.iv = phi i64 [ 0, %.lr.ph191 ], [ %indvars.iv.next, %.loopexit ]
  %.sroa.3.0190 = phi i32 [ %.fca.1.extract135, %.lr.ph191 ], [ %.sroa.3.5, %.loopexit ]
  %.sroa.0164.0189 = phi i64 [ %.fca.0.extract134, %.lr.ph191 ], [ %.sroa.0164.5, %.loopexit ]
  %.0188 = phi i32 [ 2147483647, %.lr.ph191 ], [ %.5, %.loopexit ]
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %10) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %11) #5
  %20 = load ptr, ptr %5, align 8, !tbaa !12
  %21 = getelementptr inbounds %struct.TPE_Body, ptr %20, i64 %indvars.iv
  call void @TPE_bodyGetFastBSphere(ptr noundef %21, ptr noundef nonnull %10, ptr noundef nonnull %11)
  %.sroa.0103.0.copyload = load i64, ptr %10, align 8
  %.sroa.2104.0.copyload = load i32, ptr %.sroa.2104.0..sroa_idx, align 8
  %22 = call { i64, i32 } @TPE_vec3Minus(i64 %.sroa.0103.0.copyload, i32 %.sroa.2104.0.copyload, i64 %0, i32 %1)
  %.fca.0.extract97 = extractvalue { i64, i32 } %22, 0
  %.fca.1.extract98 = extractvalue { i64, i32 } %22, 1
  store i64 %.fca.0.extract97, ptr %10, align 8
  store i32 %.fca.1.extract98, ptr %.sroa.2104.0..sroa_idx, align 8, !tbaa !13
  %.sroa.091.0.copyload = load i64, ptr %9, align 8
  %.sroa.292.0.copyload = load i32, ptr %.sroa.2151.0..sroa_idx, align 8
  %23 = call { i64, i32 } @TPE_vec3ProjectNormalized(i64 %.fca.0.extract97, i32 %.fca.1.extract98, i64 %.sroa.091.0.copyload, i32 %.sroa.292.0.copyload)
  %.fca.0.extract87 = extractvalue { i64, i32 } %23, 0
  %.fca.1.extract88 = extractvalue { i64, i32 } %23, 1
  %.sroa.083.0.copyload = load i64, ptr %9, align 8
  %.sroa.284.0.copyload = load i32, ptr %.sroa.2151.0..sroa_idx, align 8
  %24 = call i32 @TPE_vec3Dot(i64 %.fca.0.extract87, i32 %.fca.1.extract88, i64 %.sroa.083.0.copyload, i32 %.sroa.284.0.copyload)
  %25 = icmp sgt i32 %24, -1
  br i1 %25, label %26, label %.loopexit

26:                                               ; preds = %19
  %.sroa.079.0.copyload = load i64, ptr %10, align 8
  %.sroa.280.0.copyload = load i32, ptr %.sroa.2104.0..sroa_idx, align 8
  %27 = call i32 @TPE_dist(i64 %.fca.0.extract87, i32 %.fca.1.extract88, i64 %.sroa.079.0.copyload, i32 %.sroa.280.0.copyload)
  %28 = load i32, ptr %11, align 4, !tbaa !13
  %.not178 = icmp sgt i32 %27, %28
  br i1 %.not178, label %.loopexit, label %29

29:                                               ; preds = %26
  %30 = load ptr, ptr %5, align 8, !tbaa !12
  %31 = getelementptr inbounds %struct.TPE_Body, ptr %30, i64 %indvars.iv, i32 1
  %32 = load i8, ptr %31, align 8, !tbaa !15
  %.not195 = icmp eq i8 %32, 0
  br i1 %.not195, label %.loopexit, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %29
  %33 = getelementptr inbounds %struct.TPE_Body, ptr %30, i64 %indvars.iv
  %34 = load ptr, ptr %33, align 8, !tbaa !17
  %35 = trunc nuw i64 %indvars.iv to i16
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %61
  %.sroa.3.1184 = phi i32 [ %.sroa.3.4, %61 ], [ %.sroa.3.0190, %.lr.ph.preheader ]
  %.sroa.0164.1183 = phi i64 [ %.sroa.0164.4, %61 ], [ %.sroa.0164.0189, %.lr.ph.preheader ]
  %.1182 = phi i32 [ %.4, %61 ], [ %.0188, %.lr.ph.preheader ]
  %.0167181 = phi ptr [ %62, %61 ], [ %34, %.lr.ph.preheader ]
  %.0168180 = phi i16 [ %63, %61 ], [ 0, %.lr.ph.preheader ]
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(12) %10, ptr noundef nonnull align 4 dereferenceable(12) %.0167181, i64 12, i1 false), !tbaa.struct !18
  %.sroa.070.0.copyload = load i64, ptr %10, align 8
  %.sroa.271.0.copyload = load i32, ptr %.sroa.2104.0..sroa_idx, align 8
  %36 = call { i64, i32 } @TPE_vec3Minus(i64 %.sroa.070.0.copyload, i32 %.sroa.271.0.copyload, i64 %0, i32 %1)
  %.fca.0.extract64 = extractvalue { i64, i32 } %36, 0
  %.fca.1.extract65 = extractvalue { i64, i32 } %36, 1
  store i64 %.fca.0.extract64, ptr %10, align 8
  store i32 %.fca.1.extract65, ptr %.sroa.2104.0..sroa_idx, align 8, !tbaa !13
  %.sroa.058.0.copyload = load i64, ptr %9, align 8
  %.sroa.259.0.copyload = load i32, ptr %.sroa.2151.0..sroa_idx, align 8
  %37 = call { i64, i32 } @TPE_vec3ProjectNormalized(i64 %.fca.0.extract64, i32 %.fca.1.extract65, i64 %.sroa.058.0.copyload, i32 %.sroa.259.0.copyload)
  %.fca.0.extract54 = extractvalue { i64, i32 } %37, 0
  %.fca.1.extract55 = extractvalue { i64, i32 } %37, 1
  %.sroa.050.0.copyload = load i64, ptr %9, align 8
  %.sroa.251.0.copyload = load i32, ptr %.sroa.2151.0..sroa_idx, align 8
  %38 = call i32 @TPE_vec3Dot(i64 %.fca.0.extract54, i32 %.fca.1.extract55, i64 %.sroa.050.0.copyload, i32 %.sroa.251.0.copyload)
  %39 = icmp sgt i32 %38, -1
  br i1 %39, label %40, label %61

40:                                               ; preds = %.lr.ph
  %.sroa.046.0.copyload = load i64, ptr %10, align 8
  %.sroa.247.0.copyload = load i32, ptr %.sroa.2104.0..sroa_idx, align 8
  %41 = call i32 @TPE_dist(i64 %.fca.0.extract54, i32 %.fca.1.extract55, i64 %.sroa.046.0.copyload, i32 %.sroa.247.0.copyload)
  %42 = getelementptr inbounds i8, ptr %.0167181, i64 18
  %43 = load i8, ptr %42, align 2, !tbaa !19
  %44 = zext i8 %43 to i32
  %45 = shl nuw nsw i32 %44, 5
  %.not179 = icmp sgt i32 %41, %45
  br i1 %.not179, label %61, label %46

46:                                               ; preds = %40
  br i1 %.not, label %48, label %47

47:                                               ; preds = %46
  store i16 %35, ptr %6, align 2, !tbaa !5
  br label %48

48:                                               ; preds = %47, %46
  br i1 %.not177, label %50, label %49

49:                                               ; preds = %48
  store i16 %.0168180, ptr %7, align 2, !tbaa !5
  br label %50

50:                                               ; preds = %49, %48
  %add = add nsw i32 %45, %41
  %sub = sub nsw i32 %45, %41
  %51 = mul nsw i32 %add, %sub
  %52 = call i32 @TPE_sqrt(i32 noundef %51)
  %.sroa.039.0.copyload = load i64, ptr %9, align 8
  %.sroa.240.0.copyload = load i32, ptr %.sroa.2151.0..sroa_idx, align 8
  %53 = call { i64, i32 } @TPE_vec3Times(i64 %.sroa.039.0.copyload, i32 %.sroa.240.0.copyload, i32 noundef %52)
  %.fca.0.extract35 = extractvalue { i64, i32 } %53, 0
  %.fca.1.extract36 = extractvalue { i64, i32 } %53, 1
  store i64 %.fca.0.extract35, ptr %10, align 8
  store i32 %.fca.1.extract36, ptr %.sroa.2104.0..sroa_idx, align 8, !tbaa !13
  %54 = call { i64, i32 } @TPE_vec3Plus(i64 %.fca.0.extract54, i32 %.fca.1.extract55, i64 %0, i32 %1)
  %.fca.0.extract26 = extractvalue { i64, i32 } %54, 0
  %.fca.1.extract27 = extractvalue { i64, i32 } %54, 1
  %.sroa.021.0.copyload = load i64, ptr %10, align 8
  %.sroa.222.0.copyload = load i32, ptr %.sroa.2104.0..sroa_idx, align 8
  %55 = call { i64, i32 } @TPE_vec3Plus(i64 %.fca.0.extract26, i32 %.fca.1.extract27, i64 %.sroa.021.0.copyload, i32 %.sroa.222.0.copyload)
  %.fca.0.extract17 = extractvalue { i64, i32 } %55, 0
  %.fca.1.extract18 = extractvalue { i64, i32 } %55, 1
  %.sroa.012.0.copyload = load i64, ptr %10, align 8
  %.sroa.213.0.copyload = load i32, ptr %.sroa.2104.0..sroa_idx, align 8
  %56 = call { i64, i32 } @TPE_vec3Minus(i64 %.fca.0.extract26, i32 %.fca.1.extract27, i64 %.sroa.012.0.copyload, i32 %.sroa.213.0.copyload)
  %.fca.0.extract = extractvalue { i64, i32 } %56, 0
  %.fca.1.extract = extractvalue { i64, i32 } %56, 1
  %57 = call i32 @TPE_dist(i64 %0, i32 %1, i64 %.fca.0.extract17, i32 %.fca.1.extract18)
  %58 = call i32 @TPE_dist(i64 %0, i32 %1, i64 %.fca.0.extract, i32 %.fca.1.extract)
  %59 = icmp slt i32 %58, %57
  %.sroa.025.0 = select i1 %59, i64 %.fca.0.extract, i64 %.fca.0.extract17
  %.sroa.6.0 = select i1 %59, i32 %.fca.1.extract, i32 %.fca.1.extract18
  %.0166 = call i32 @llvm.smin.i32(i32 %58, i32 %57)
  %60 = icmp slt i32 %.0166, %.1182
  %.2 = call i32 @llvm.smin.i32(i32 %.0166, i32 %.1182)
  %.sroa.0164.2 = select i1 %60, i64 %.sroa.025.0, i64 %.sroa.0164.1183
  %.sroa.3.2 = select i1 %60, i32 %.sroa.6.0, i32 %.sroa.3.1184
  br label %61

61:                                               ; preds = %40, %50, %.lr.ph
  %.4 = phi i32 [ %.1182, %.lr.ph ], [ %.2, %50 ], [ %.1182, %40 ]
  %.sroa.0164.4 = phi i64 [ %.sroa.0164.1183, %.lr.ph ], [ %.sroa.0164.2, %50 ], [ %.sroa.0164.1183, %40 ]
  %.sroa.3.4 = phi i32 [ %.sroa.3.1184, %.lr.ph ], [ %.sroa.3.2, %50 ], [ %.sroa.3.1184, %40 ]
  %62 = getelementptr inbounds i8, ptr %.0167181, i64 20
  %63 = add nuw nsw i16 %.0168180, 1
  %64 = load ptr, ptr %5, align 8, !tbaa !12
  %65 = getelementptr inbounds %struct.TPE_Body, ptr %64, i64 %indvars.iv, i32 1
  %66 = load i8, ptr %65, align 8, !tbaa !15
  %67 = zext i8 %66 to i16
  %68 = icmp ult i16 %63, %67
  br i1 %68, label %.lr.ph, label %.loopexit, !llvm.loop !22

.loopexit:                                        ; preds = %61, %29, %26, %19
  %.5 = phi i32 [ %.0188, %26 ], [ %.0188, %19 ], [ %.0188, %29 ], [ %.4, %61 ]
  %.sroa.0164.5 = phi i64 [ %.sroa.0164.0189, %26 ], [ %.sroa.0164.0189, %19 ], [ %.sroa.0164.0189, %29 ], [ %.sroa.0164.4, %61 ]
  %.sroa.3.5 = phi i32 [ %.sroa.3.0190, %26 ], [ %.sroa.3.0190, %19 ], [ %.sroa.3.0190, %29 ], [ %.sroa.3.4, %61 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %10) #5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %69 = load i16, ptr %17, align 8, !tbaa !9
  %70 = zext i16 %69 to i64
  %71 = icmp ult i64 %indvars.iv.next, %70
  br i1 %71, label %19, label %._crit_edge, !llvm.loop !24
}

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

attributes #0 = { mustprogress nocallback nofree 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = !{!"short", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 8}
!10 = !{!"", !11, i64 0, !6, i64 8, !11, i64 16, !11, i64 24}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!10, !11, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!16, !7, i64 8}
!16 = !{!"", !11, i64 0, !7, i64 8, !11, i64 16, !7, i64 24, !6, i64 26, !6, i64 28, !6, i64 30, !7, i64 32, !7, i64 33}
!17 = !{!16, !11, i64 0}
!18 = !{i64 0, i64 4, !13, i64 4, i64 4, !13, i64 8, i64 4, !13}
!19 = !{!20, !7, i64 18}
!20 = !{!"", !21, i64 0, !7, i64 12, !7, i64 18}
!21 = !{!"", !14, i64 0, !14, i64 4, !14, i64 8}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = distinct !{!24, !23}


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