; LLVM IR from ashishzero/karma :: src/broad_phase.ll (Z22hgrid_add_body_to_gridP5HGridP10Rigid_Body)

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

%union.Vec2 = type { %struct.anon.1 }
%struct.anon.1 = type { float, float }
%struct.Mm_Rect = type { %union.Vec2, %union.Vec2 }
%struct.HGrid = type { ptr, i32, float, i32 }
%struct.Grid = type { %union.Vec2, float, i32, ptr }
%struct.Rigid_Body = type { i16, i16, float, float, float, float, %union.Vec2, %union.Vec2, %struct.Transform, i32, ptr, %struct.Mm_Rect, %struct.Entity_Id, ptr, i32, i32 }
%struct.Transform = type { %union.Vec2, %union.Mat2 }
%union.Mat2 = type { [2 x %union.Vec2] }
%struct.Entity_Id = type { i64 }

; 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: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z16hgrid_fully_fits4Vec2f7Mm_Rect(<2 x float>, float noundef, <2 x float>, <2 x float>) #1

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z22hgrid_add_body_to_gridP5HGridP10Rigid_Body(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i8, align 1
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca %union.Vec2, align 4
  %14 = alloca %struct.Mm_Rect, align 4
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.HGrid, ptr %17, i32 0, i32 0
  %19 = load ptr, ptr %18, align 8, !tbaa !9
  store ptr %19, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.HGrid, ptr %20, i32 0, i32 1
  %22 = load i32, ptr %21, align 8, !tbaa !13
  store i32 %22, ptr %6, align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #3
  store i8 1, ptr %7, align 1, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  store i32 0, ptr %8, align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  store i32 0, ptr %9, align 4, !tbaa !14
  br label %23

23:                                               ; preds = %77, %2
  %24 = load i32, ptr %8, align 4, !tbaa !14
  %25 = mul i32 %24, 4
  %26 = add i32 %25, 1
  %27 = load i32, ptr %6, align 4, !tbaa !14
  %28 = icmp ult i32 %26, %27
  br i1 %28, label %29, label %32

29:                                               ; preds = %23
  %30 = load i8, ptr %7, align 1, !tbaa !15, !range !17, !noundef !18
  %31 = trunc i8 %30 to i1
  br label %32

32:                                               ; preds = %29, %23
  %33 = phi i1 [ false, %23 ], [ %31, %29 ]
  br i1 %33, label %34, label %78

34:                                               ; preds = %32
  store i8 0, ptr %7, align 1, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  store i32 1, ptr %10, align 4, !tbaa !14
  br label %35

35:                                               ; preds = %73, %34
  %36 = load i32, ptr %10, align 4, !tbaa !14
  %37 = icmp sle i32 %36, 4
  br i1 %37, label %39, label %38

38:                                               ; preds = %35
  store i32 4, ptr %11, align 4
  br label %76

39:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = load i32, ptr %8, align 4, !tbaa !14
  %42 = mul i32 4, %41
  %43 = zext i32 %42 to i64
  %44 = getelementptr inbounds %struct.Grid, ptr %40, i64 %43
  %45 = load i32, ptr %10, align 4, !tbaa !14
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds %struct.Grid, ptr %44, i64 %46
  store ptr %47, ptr %12, align 8, !tbaa !5
  %48 = load ptr, ptr %12, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.Grid, ptr %48, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %13, ptr align 8 %49, i64 8, i1 false), !tbaa.struct !19
  %50 = load ptr, ptr %12, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.Grid, ptr %50, i32 0, i32 1
  %52 = load float, ptr %51, align 8, !tbaa !21
  %53 = load ptr, ptr %4, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.Rigid_Body, ptr %53, i32 0, i32 11
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %14, ptr align 8 %54, i64 16, i1 false), !tbaa.struct !23
  %55 = getelementptr inbounds %union.Vec2, ptr %13, i32 0, i32 0
  %56 = load <2 x float>, ptr %55, align 4
  %57 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %14, i32 0, i32 0
  %58 = load <2 x float>, ptr %57, align 4
  %59 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %14, i32 0, i32 1
  %60 = load <2 x float>, ptr %59, align 4
  %61 = call noundef zeroext i1 @_Z16hgrid_fully_fits4Vec2f7Mm_Rect(<2 x float> %56, float noundef %52, <2 x float> %58, <2 x float> %60)
  br i1 %61, label %62, label %69

62:                                               ; preds = %39
  store i8 1, ptr %7, align 1, !tbaa !15
  %63 = load i32, ptr %8, align 4, !tbaa !14
  %64 = mul i32 4, %63
  %65 = load i32, ptr %10, align 4, !tbaa !14
  %66 = add i32 %64, %65
  store i32 %66, ptr %8, align 4, !tbaa !14
  %67 = load i32, ptr %9, align 4, !tbaa !14
  %68 = add i32 %67, 1
  store i32 %68, ptr %9, align 4, !tbaa !14
  store i32 4, ptr %11, align 4
  br label %70

69:                                               ; preds = %39
  store i32 0, ptr %11, align 4
  br label %70

70:                                               ; preds = %69, %62
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  %71 = load i32, ptr %11, align 4
  switch i32 %71, label %76 [
    i32 0, label %72
  ]

72:                                               ; preds = %70
  br label %73

73:                                               ; preds = %72
  %74 = load i32, ptr %10, align 4, !tbaa !14
  %75 = add nsw i32 %74, 1
  store i32 %75, ptr %10, align 4, !tbaa !14
  br label %35, !llvm.loop !24

76:                                               ; preds = %70, %38
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  br label %77

77:                                               ; preds = %76
  br label %23, !llvm.loop !26

78:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  %79 = load ptr, ptr %5, align 8, !tbaa !5
  %80 = load i32, ptr %8, align 4, !tbaa !14
  %81 = zext i32 %80 to i64
  %82 = getelementptr inbounds %struct.Grid, ptr %79, i64 %81
  store ptr %82, ptr %16, align 8, !tbaa !5
  %83 = load ptr, ptr %16, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.Grid, ptr %83, i32 0, i32 3
  %85 = load ptr, ptr %84, align 8, !tbaa !27
  store ptr %85, ptr %15, align 8, !tbaa !5
  %86 = load ptr, ptr %15, align 8, !tbaa !5
  %87 = icmp eq ptr %86, null
  br i1 %87, label %88, label %105

88:                                               ; preds = %78
  %89 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %89, ptr %15, align 8, !tbaa !5
  %90 = load ptr, ptr %16, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.Grid, ptr %90, i32 0, i32 2
  %92 = load i32, ptr %91, align 4, !tbaa !28
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %91, align 4, !tbaa !28
  %94 = load ptr, ptr %4, align 8, !tbaa !5
  %95 = load ptr, ptr %16, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.Grid, ptr %95, i32 0, i32 3
  store ptr %94, ptr %96, align 8, !tbaa !27
  %97 = load i32, ptr %8, align 4, !tbaa !14
  %98 = load ptr, ptr %4, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.Rigid_Body, ptr %98, i32 0, i32 14
  store i32 %97, ptr %99, align 8, !tbaa !29
  %100 = load ptr, ptr %4, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.Rigid_Body, ptr %100, i32 0, i32 13
  store ptr null, ptr %101, align 8, !tbaa !37
  %102 = load i32, ptr %9, align 4, !tbaa !14
  %103 = load ptr, ptr %4, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.Rigid_Body, ptr %103, i32 0, i32 15
  store i32 %102, ptr %104, align 4, !tbaa !38
  br label %131

105:                                              ; preds = %78
  br label %106

106:                                              ; preds = %111, %105
  %107 = load ptr, ptr %15, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.Rigid_Body, ptr %107, i32 0, i32 13
  %109 = load ptr, ptr %108, align 8, !tbaa !37
  %110 = icmp ne ptr %109, null
  br i1 %110, label %111, label %115

111:                                              ; preds = %106
  %112 = load ptr, ptr %15, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.Rigid_Body, ptr %112, i32 0, i32 13
  %114 = load ptr, ptr %113, align 8, !tbaa !37
  store ptr %114, ptr %15, align 8, !tbaa !5
  br label %106, !llvm.loop !39

115:                                              ; preds = %106
  %116 = load ptr, ptr %4, align 8, !tbaa !5
  %117 = load ptr, ptr %15, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.Rigid_Body, ptr %117, i32 0, i32 13
  store ptr %116, ptr %118, align 8, !tbaa !37
  %119 = load ptr, ptr %16, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.Grid, ptr %119, i32 0, i32 2
  %121 = load i32, ptr %120, align 4, !tbaa !28
  %122 = add nsw i32 %121, 1
  store i32 %122, ptr %120, align 4, !tbaa !28
  %123 = load i32, ptr %8, align 4, !tbaa !14
  %124 = load ptr, ptr %4, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.Rigid_Body, ptr %124, i32 0, i32 14
  store i32 %123, ptr %125, align 8, !tbaa !29
  %126 = load ptr, ptr %4, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.Rigid_Body, ptr %126, i32 0, i32 13
  store ptr null, ptr %127, align 8, !tbaa !37
  %128 = load i32, ptr %9, align 4, !tbaa !14
  %129 = load ptr, ptr %4, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.Rigid_Body, ptr %129, i32 0, i32 15
  store i32 %128, ptr %130, align 4, !tbaa !38
  br label %131

131:                                              ; preds = %115, %88
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  ret void
}

; 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

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="64" "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 = { 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++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"_ZTS5HGrid", !6, i64 0, !11, i64 8, !12, i64 12, !11, i64 16}
!11 = !{!"int", !7, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!10, !11, i64 8}
!14 = !{!11, !11, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"bool", !7, i64 0}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = !{i64 0, i64 8, !20}
!20 = !{!7, !7, i64 0}
!21 = !{!22, !12, i64 8}
!22 = !{!"_ZTS4Grid", !7, i64 0, !12, i64 8, !11, i64 12, !6, i64 16}
!23 = !{i64 0, i64 8, !20, i64 8, i64 8, !20}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = distinct !{!26, !25}
!27 = !{!22, !6, i64 16}
!28 = !{!22, !11, i64 12}
!29 = !{!30, !11, i64 104}
!30 = !{!"_ZTS10Rigid_Body", !31, i64 0, !32, i64 2, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !7, i64 20, !7, i64 28, !33, i64 36, !11, i64 60, !6, i64 64, !34, i64 72, !35, i64 88, !6, i64 96, !11, i64 104, !11, i64 108}
!31 = !{!"_ZTS15Rigid_Body_Type", !7, i64 0}
!32 = !{!"short", !7, i64 0}
!33 = !{!"_ZTS9Transform", !7, i64 0, !7, i64 8}
!34 = !{!"_ZTS7Mm_Rect", !7, i64 0, !7, i64 8}
!35 = !{!"_ZTS9Entity_Id", !36, i64 0}
!36 = !{!"long", !7, i64 0}
!37 = !{!30, !6, i64 96}
!38 = !{!30, !11, i64 108}
!39 = distinct !{!39, !25}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.Grid = type { %union.Vec2, float, i32, ptr }
%union.Vec2 = type { %struct.anon.1 }
%struct.anon.1 = type { float, float }

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z16hgrid_fully_fits4Vec2f7Mm_Rect(<2 x float>, float noundef, <2 x float>, <2 x float>) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z22hgrid_add_body_to_gridP5HGridP10Rigid_Body(ptr nocapture noundef readonly %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = load ptr, ptr %0, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 8
  %5 = load i32, ptr %4, align 8, !tbaa !12
  %6 = icmp ugt i32 %5, 1
  br i1 %6, label %.preheader53.lr.ph, label %._crit_edge

.preheader53.lr.ph:                               ; preds = %2
  %7 = getelementptr inbounds i8, ptr %1, i64 72
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %1, i64 80
  br label %.preheader53

.preheader53:                                     ; preds = %.preheader53.lr.ph, %.split.loop.exit
  %.04162 = phi i32 [ 0, %.preheader53.lr.ph ], [ %30, %.split.loop.exit ]
  %.04561 = phi i32 [ 0, %.preheader53.lr.ph ], [ %31, %.split.loop.exit ]
  %8 = shl i32 %.04162, 2
  %9 = zext i32 %8 to i64
  %10 = getelementptr inbounds %struct.Grid, ptr %3, i64 %9
  %11 = getelementptr inbounds i8, ptr %10, i64 24
  %.sroa.08.0.copyload = load <2 x float>, ptr %11, align 8, !tbaa !13
  %12 = getelementptr inbounds i8, ptr %10, i64 32
  %13 = load float, ptr %12, align 8, !tbaa !14
  %.sroa.0.0.copyload = load <2 x float>, ptr %7, align 8, !tbaa !13
  %.sroa.2.0.copyload = load <2 x float>, ptr %.sroa.2.0..sroa_idx, align 8, !tbaa !13
  %14 = tail call noundef zeroext i1 @_Z16hgrid_fully_fits4Vec2f7Mm_Rect(<2 x float> %.sroa.08.0.copyload, float noundef %13, <2 x float> %.sroa.0.0.copyload, <2 x float> %.sroa.2.0.copyload)
  br i1 %14, label %.split.loop.exit, label %15

15:                                               ; preds = %.preheader53
  %16 = getelementptr inbounds i8, ptr %10, i64 48
  %.sroa.08.0.copyload.1 = load <2 x float>, ptr %16, align 8, !tbaa !13
  %17 = getelementptr inbounds i8, ptr %10, i64 56
  %18 = load float, ptr %17, align 8, !tbaa !14
  %.sroa.0.0.copyload.1 = load <2 x float>, ptr %7, align 8, !tbaa !13
  %.sroa.2.0.copyload.1 = load <2 x float>, ptr %.sroa.2.0..sroa_idx, align 8, !tbaa !13
  %19 = tail call noundef zeroext i1 @_Z16hgrid_fully_fits4Vec2f7Mm_Rect(<2 x float> %.sroa.08.0.copyload.1, float noundef %18, <2 x float> %.sroa.0.0.copyload.1, <2 x float> %.sroa.2.0.copyload.1)
  br i1 %19, label %.split.loop.exit, label %20

20:                                               ; preds = %15
  %21 = getelementptr inbounds i8, ptr %10, i64 72
  %.sroa.08.0.copyload.2 = load <2 x float>, ptr %21, align 8, !tbaa !13
  %22 = getelementptr inbounds i8, ptr %10, i64 80
  %23 = load float, ptr %22, align 8, !tbaa !14
  %.sroa.0.0.copyload.2 = load <2 x float>, ptr %7, align 8, !tbaa !13
  %.sroa.2.0.copyload.2 = load <2 x float>, ptr %.sroa.2.0..sroa_idx, align 8, !tbaa !13
  %24 = tail call noundef zeroext i1 @_Z16hgrid_fully_fits4Vec2f7Mm_Rect(<2 x float> %.sroa.08.0.copyload.2, float noundef %23, <2 x float> %.sroa.0.0.copyload.2, <2 x float> %.sroa.2.0.copyload.2)
  br i1 %24, label %.split.loop.exit, label %25

25:                                               ; preds = %20
  %26 = getelementptr inbounds i8, ptr %10, i64 96
  %.sroa.08.0.copyload.3 = load <2 x float>, ptr %26, align 8, !tbaa !13
  %27 = getelementptr inbounds i8, ptr %10, i64 104
  %28 = load float, ptr %27, align 8, !tbaa !14
  %.sroa.0.0.copyload.3 = load <2 x float>, ptr %7, align 8, !tbaa !13
  %.sroa.2.0.copyload.3 = load <2 x float>, ptr %.sroa.2.0..sroa_idx, align 8, !tbaa !13
  %29 = tail call noundef zeroext i1 @_Z16hgrid_fully_fits4Vec2f7Mm_Rect(<2 x float> %.sroa.08.0.copyload.3, float noundef %28, <2 x float> %.sroa.0.0.copyload.3, <2 x float> %.sroa.2.0.copyload.3)
  br i1 %29, label %.split.loop.exit, label %._crit_edge

.split.loop.exit:                                 ; preds = %.preheader53, %15, %20, %25
  %.04960.lcssa.wide = phi i32 [ 1, %.preheader53 ], [ 2, %15 ], [ 3, %20 ], [ 4, %25 ]
  %30 = add i32 %.04960.lcssa.wide, %8
  %31 = add i32 %.04561, 1
  %.pre = shl i32 %30, 2
  %32 = or disjoint i32 %.pre, 1
  %33 = icmp ult i32 %32, %5
  br i1 %33, label %.preheader53, label %._crit_edge, !llvm.loop !16

._crit_edge:                                      ; preds = %25, %.split.loop.exit, %2
  %.045.lcssa = phi i32 [ 0, %2 ], [ %.04561, %25 ], [ %31, %.split.loop.exit ]
  %.041.lcssa = phi i32 [ 0, %2 ], [ %.04162, %25 ], [ %30, %.split.loop.exit ]
  %34 = zext i32 %.041.lcssa to i64
  %35 = getelementptr inbounds %struct.Grid, ptr %3, i64 %34
  %36 = getelementptr inbounds i8, ptr %35, i64 16
  %37 = load ptr, ptr %36, align 8, !tbaa !18
  %38 = icmp eq ptr %37, null
  br i1 %38, label %39, label %.preheader

39:                                               ; preds = %._crit_edge
  %40 = getelementptr inbounds i8, ptr %35, i64 12
  %41 = load i32, ptr %40, align 4, !tbaa !19
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %40, align 4, !tbaa !19
  store ptr %1, ptr %36, align 8, !tbaa !18
  br label %50

.preheader:                                       ; preds = %._crit_edge, %.preheader
  %.040 = phi ptr [ %44, %.preheader ], [ %37, %._crit_edge ]
  %43 = getelementptr inbounds i8, ptr %.040, i64 96
  %44 = load ptr, ptr %43, align 8, !tbaa !20
  %.not = icmp eq ptr %44, null
  br i1 %.not, label %45, label %.preheader, !llvm.loop !28

45:                                               ; preds = %.preheader
  %46 = getelementptr inbounds i8, ptr %.040, i64 96
  store ptr %1, ptr %46, align 8, !tbaa !20
  %47 = getelementptr inbounds i8, ptr %35, i64 12
  %48 = load i32, ptr %47, align 4, !tbaa !19
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %47, align 4, !tbaa !19
  br label %50

50:                                               ; preds = %45, %39
  %51 = getelementptr inbounds i8, ptr %1, i64 104
  store i32 %.041.lcssa, ptr %51, align 8, !tbaa !29
  %52 = getelementptr inbounds i8, ptr %1, i64 96
  store ptr null, ptr %52, align 8, !tbaa !20
  %53 = getelementptr inbounds i8, ptr %1, i64 108
  store i32 %.045.lcssa, ptr %53, align 4, !tbaa !30
  ret void
}

attributes #0 = { mustprogress nounwind uwtable "min-legal-vector-width"="64" "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" }

!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 0}
!6 = !{!"_ZTS5HGrid", !7, i64 0, !10, i64 8, !11, i64 12, !10, i64 16}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"float", !8, i64 0}
!12 = !{!6, !10, i64 8}
!13 = !{!8, !8, i64 0}
!14 = !{!15, !11, i64 8}
!15 = !{!"_ZTS4Grid", !8, i64 0, !11, i64 8, !10, i64 12, !7, i64 16}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!15, !7, i64 16}
!19 = !{!15, !10, i64 12}
!20 = !{!21, !7, i64 96}
!21 = !{!"_ZTS10Rigid_Body", !22, i64 0, !23, i64 2, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !8, i64 20, !8, i64 28, !24, i64 36, !10, i64 60, !7, i64 64, !25, i64 72, !26, i64 88, !7, i64 96, !10, i64 104, !10, i64 108}
!22 = !{!"_ZTS15Rigid_Body_Type", !8, i64 0}
!23 = !{!"short", !8, i64 0}
!24 = !{!"_ZTS9Transform", !8, i64 0, !8, i64 8}
!25 = !{!"_ZTS7Mm_Rect", !8, i64 0, !8, i64 8}
!26 = !{!"_ZTS9Entity_Id", !27, i64 0}
!27 = !{!"long", !8, i64 0}
!28 = distinct !{!28, !17}
!29 = !{!21, !10, i64 104}
!30 = !{!21, !10, i64 108}


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