; LLVM IR from mtsamis/box2d-optimized :: src/dynamics/b2_contact.ll (ZN9b2Contact12CalculateTOIEv)

; 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.b2TOIInput = type <{ %struct.b2DistanceProxy, %struct.b2DistanceProxy, %struct.b2Sweep, %struct.b2Sweep, float, [4 x i8] }>
%struct.b2DistanceProxy = type { [2 x %struct.b2Vec2], ptr, i32, float }
%struct.b2Vec2 = type { float, float }
%struct.b2Sweep = type { %struct.b2Vec2, %struct.b2Vec2, %struct.b2Vec2, float, float, float }
%struct.b2TOIOutput = type { i32, float }
%class.b2Body = type { i32, i16, i32, %struct.b2Transform, %struct.b2Transform, %struct.b2Sweep, %struct.b2Vec2, float, %struct.b2Vec2, float, ptr, ptr, ptr, ptr, i32, ptr, ptr, i32, i32, float, float, float, float, float, float, float, float, %struct.b2BodyUserData }
%struct.b2Transform = type { %struct.b2Vec2, %struct.b2Rot }
%struct.b2Rot = type { float, float }
%struct.b2BodyUserData = type { i64 }

@.str.1 = external hidden unnamed_addr constant [85 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [51 x i8], align 1
@__PRETTY_FUNCTION__._ZN9b2Contact12CalculateTOIEv = external hidden unnamed_addr constant [32 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [14 x i8], align 1

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

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK9b2Fixture8IsSensorEv(ptr noundef nonnull align 8 dereferenceable(84)) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN9b2Fixture7GetBodyEv(ptr noundef nonnull align 8 dereferenceable(84)) #2 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) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN9b2Fixture8GetShapeEv(ptr noundef nonnull align 8 dereferenceable(84)) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef float @_ZN9b2Contact12CalculateTOIEv(ptr noundef nonnull align 8 dereferenceable(128) %0) #4 align 2 {
  %2 = alloca float, align 4
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i8, align 1
  %12 = alloca i8, align 1
  %13 = alloca i8, align 1
  %14 = alloca i8, align 1
  %15 = alloca i8, align 1
  %16 = alloca float, align 4
  %17 = alloca %struct.b2TOIInput, align 8
  %18 = alloca %struct.b2TOIOutput, align 4
  %19 = alloca float, align 4
  %20 = alloca float, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  %21 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #9
  %22 = call noundef ptr @_ZN9b2Contact11GetFixtureAEv(ptr noundef nonnull align 8 dereferenceable(128) %21)
  store ptr %22, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #9
  %23 = call noundef ptr @_ZN9b2Contact11GetFixtureBEv(ptr noundef nonnull align 8 dereferenceable(128) %21)
  store ptr %23, ptr %5, align 8, !tbaa !5
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = call noundef zeroext i1 @_ZNK9b2Fixture8IsSensorEv(ptr noundef nonnull align 8 dereferenceable(84) %24)
  br i1 %25, label %33, label %26

26:                                               ; preds = %1
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = call noundef zeroext i1 @_ZNK9b2Fixture8IsSensorEv(ptr noundef nonnull align 8 dereferenceable(84) %27)
  br i1 %28, label %33, label %29

29:                                               ; preds = %26
  %30 = call noundef zeroext i1 @_ZNK9b2Contact9IsEnabledEv(ptr noundef nonnull align 8 dereferenceable(128) %21)
  %31 = zext i1 %30 to i32
  %32 = icmp eq i32 %31, 0
  br i1 %32, label %33, label %34

33:                                               ; preds = %29, %26, %1
  store float 1.000000e+00, ptr %2, align 4
  store i32 1, ptr %6, align 4
  br label %190

34:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #9
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = call noundef ptr @_ZN9b2Fixture7GetBodyEv(ptr noundef nonnull align 8 dereferenceable(84) %35)
  store ptr %36, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #9
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = call noundef ptr @_ZN9b2Fixture7GetBodyEv(ptr noundef nonnull align 8 dereferenceable(84) %37)
  store ptr %38, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #9
  %39 = load ptr, ptr %7, align 8, !tbaa !5
  %40 = getelementptr inbounds %class.b2Body, ptr %39, i32 0, i32 0
  %41 = load i32, ptr %40, align 8, !tbaa !9
  store i32 %41, ptr %9, align 4, !tbaa !21
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #9
  %42 = load ptr, ptr %8, align 8, !tbaa !5
  %43 = getelementptr inbounds %class.b2Body, ptr %42, i32 0, i32 0
  %44 = load i32, ptr %43, align 8, !tbaa !9
  store i32 %44, ptr %10, align 4, !tbaa !21
  %45 = load i32, ptr %9, align 4, !tbaa !21
  %46 = icmp eq i32 %45, 2
  br i1 %46, label %50, label %47

47:                                               ; preds = %34
  %48 = load i32, ptr %10, align 4, !tbaa !21
  %49 = icmp eq i32 %48, 2
  br label %50

50:                                               ; preds = %47, %34
  %51 = phi i1 [ true, %34 ], [ %49, %47 ]
  br i1 %51, label %52, label %53

52:                                               ; preds = %50
  br label %55

53:                                               ; preds = %50
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 226, ptr noundef @__PRETTY_FUNCTION__._ZN9b2Contact12CalculateTOIEv) #10
  unreachable

54:                                               ; No predecessors!
  br label %55

55:                                               ; preds = %54, %52
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #9
  %56 = load ptr, ptr %7, align 8, !tbaa !5
  %57 = call noundef zeroext i1 @_ZNK6b2Body7IsAwakeEv(ptr noundef nonnull align 8 dereferenceable(208) %56)
  br i1 %57, label %58, label %61

58:                                               ; preds = %55
  %59 = load i32, ptr %9, align 4, !tbaa !21
  %60 = icmp ne i32 %59, 0
  br label %61

61:                                               ; preds = %58, %55
  %62 = phi i1 [ false, %55 ], [ %60, %58 ]
  %63 = zext i1 %62 to i8
  store i8 %63, ptr %11, align 1, !tbaa !22
  call void @llvm.lifetime.start.p0(i64 1, ptr %12) #9
  %64 = load ptr, ptr %8, align 8, !tbaa !5
  %65 = call noundef zeroext i1 @_ZNK6b2Body7IsAwakeEv(ptr noundef nonnull align 8 dereferenceable(208) %64)
  br i1 %65, label %66, label %69

66:                                               ; preds = %61
  %67 = load i32, ptr %10, align 4, !tbaa !21
  %68 = icmp ne i32 %67, 0
  br label %69

69:                                               ; preds = %66, %61
  %70 = phi i1 [ false, %61 ], [ %68, %66 ]
  %71 = zext i1 %70 to i8
  store i8 %71, ptr %12, align 1, !tbaa !22
  call void @llvm.lifetime.start.p0(i64 1, ptr %13) #9
  %72 = load i8, ptr %11, align 1, !tbaa !22, !range !24, !noundef !25
  %73 = trunc i8 %72 to i1
  br i1 %73, label %74, label %77

74:                                               ; preds = %69
  %75 = load i8, ptr %12, align 1, !tbaa !22, !range !24, !noundef !25
  %76 = trunc i8 %75 to i1
  br label %77

77:                                               ; preds = %74, %69
  %78 = phi i1 [ false, %69 ], [ %76, %74 ]
  %79 = zext i1 %78 to i8
  store i8 %79, ptr %13, align 1, !tbaa !22
  %80 = load i8, ptr %13, align 1, !tbaa !22, !range !24, !noundef !25
  %81 = trunc i8 %80 to i1
  %82 = zext i1 %81 to i32
  %83 = icmp eq i32 %82, 0
  br i1 %83, label %84, label %85

84:                                               ; preds = %77
  store float 1.000000e+00, ptr %2, align 4
  store i32 1, ptr %6, align 4
  br label %189

85:                                               ; preds = %77
  call void @llvm.lifetime.start.p0(i64 1, ptr %14) #9
  %86 = load ptr, ptr %7, align 8, !tbaa !5
  %87 = call noundef zeroext i1 @_ZNK6b2Body8IsBulletEv(ptr noundef nonnull align 8 dereferenceable(208) %86)
  br i1 %87, label %91, label %88

88:                                               ; preds = %85
  %89 = load i32, ptr %9, align 4, !tbaa !21
  %90 = icmp ne i32 %89, 2
  br label %91

91:                                               ; preds = %88, %85
  %92 = phi i1 [ true, %85 ], [ %90, %88 ]
  %93 = zext i1 %92 to i8
  store i8 %93, ptr %14, align 1, !tbaa !22
  call void @llvm.lifetime.start.p0(i64 1, ptr %15) #9
  %94 = load ptr, ptr %8, align 8, !tbaa !5
  %95 = call noundef zeroext i1 @_ZNK6b2Body8IsBulletEv(ptr noundef nonnull align 8 dereferenceable(208) %94)
  br i1 %95, label %99, label %96

96:                                               ; preds = %91
  %97 = load i32, ptr %10, align 4, !tbaa !21
  %98 = icmp ne i32 %97, 2
  br label %99

99:                                               ; preds = %96, %91
  %100 = phi i1 [ true, %91 ], [ %98, %96 ]
  %101 = zext i1 %100 to i8
  store i8 %101, ptr %15, align 1, !tbaa !22
  %102 = load i8, ptr %14, align 1, !tbaa !22, !range !24, !noundef !25
  %103 = trunc i8 %102 to i1
  %104 = zext i1 %103 to i32
  %105 = icmp eq i32 %104, 0
  br i1 %105, label %106, label %112

106:                                              ; preds = %99
  %107 = load i8, ptr %15, align 1, !tbaa !22, !range !24, !noundef !25
  %108 = trunc i8 %107 to i1
  %109 = zext i1 %108 to i32
  %110 = icmp eq i32 %109, 0
  br i1 %110, label %111, label %112

111:                                              ; preds = %106
  store float 1.000000e+00, ptr %2, align 4
  store i32 1, ptr %6, align 4
  br label %188

112:                                              ; preds = %106, %99
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #9
  %113 = load ptr, ptr %7, align 8, !tbaa !5
  %114 = getelementptr inbounds %class.b2Body, ptr %113, i32 0, i32 5
  %115 = getelementptr inbounds %struct.b2Sweep, ptr %114, i32 0, i32 5
  %116 = load float, ptr %115, align 4, !tbaa !26
  store float %116, ptr %16, align 4, !tbaa !27
  %117 = load ptr, ptr %7, align 8, !tbaa !5
  %118 = getelementptr inbounds %class.b2Body, ptr %117, i32 0, i32 5
  %119 = getelementptr inbounds %struct.b2Sweep, ptr %118, i32 0, i32 5
  %120 = load float, ptr %119, align 4, !tbaa !26
  %121 = load ptr, ptr %8, align 8, !tbaa !5
  %122 = getelementptr inbounds %class.b2Body, ptr %121, i32 0, i32 5
  %123 = getelementptr inbounds %struct.b2Sweep, ptr %122, i32 0, i32 5
  %124 = load float, ptr %123, align 4, !tbaa !26
  %125 = fcmp olt float %120, %124
  br i1 %125, label %126, label %134

126:                                              ; preds = %112
  %127 = load ptr, ptr %8, align 8, !tbaa !5
  %128 = getelementptr inbounds %class.b2Body, ptr %127, i32 0, i32 5
  %129 = getelementptr inbounds %struct.b2Sweep, ptr %128, i32 0, i32 5
  %130 = load float, ptr %129, align 4, !tbaa !26
  store float %130, ptr %16, align 4, !tbaa !27
  %131 = load ptr, ptr %7, align 8, !tbaa !5
  %132 = getelementptr inbounds %class.b2Body, ptr %131, i32 0, i32 5
  %133 = load float, ptr %16, align 4, !tbaa !27
  call void @_ZN7b2Sweep7AdvanceEf(ptr noundef nonnull align 4 dereferenceable(36) %132, float noundef %133)
  br label %153

134:                                              ; preds = %112
  %135 = load ptr, ptr %8, align 8, !tbaa !5
  %136 = getelementptr inbounds %class.b2Body, ptr %135, i32 0, i32 5
  %137 = getelementptr inbounds %struct.b2Sweep, ptr %136, i32 0, i32 5
  %138 = load float, ptr %137, align 4, !tbaa !26
  %139 = load ptr, ptr %7, align 8, !tbaa !5
  %140 = getelementptr inbounds %class.b2Body, ptr %139, i32 0, i32 5
  %141 = getelementptr inbounds %struct.b2Sweep, ptr %140, i32 0, i32 5
  %142 = load float, ptr %141, align 4, !tbaa !26
  %143 = fcmp olt float %138, %142
  br i1 %143, label %144, label %152

144:                                              ; preds = %134
  %145 = load ptr, ptr %7, align 8, !tbaa !5
  %146 = getelementptr inbounds %class.b2Body, ptr %145, i32 0, i32 5
  %147 = getelementptr inbounds %struct.b2Sweep, ptr %146, i32 0, i32 5
  %148 = load float, ptr %147, align 4, !tbaa !26
  store float %148, ptr %16, align 4, !tbaa !27
  %149 = load ptr, ptr %8, align 8, !tbaa !5
  %150 = getelementptr inbounds %class.b2Body, ptr %149, i32 0, i32 5
  %151 = load float, ptr %16, align 4, !tbaa !27
  call void @_ZN7b2Sweep7AdvanceEf(ptr noundef nonnull align 4 dereferenceable(36) %150, float noundef %151)
  br label %152

152:                                              ; preds = %144, %134
  br label %153

153:                                              ; preds = %152, %126
  %154 = load float, ptr %16, align 4, !tbaa !27
  %155 = fcmp olt float %154, 1.000000e+00
  br i1 %155, label %156, label %157

156:                                              ; preds = %153
  br label %159

157:                                              ; preds = %153
  call void @__assert_fail(ptr noundef @.str.4, ptr noundef @.str.1, i32 noundef 261, ptr noundef @__PRETTY_FUNCTION__._ZN9b2Contact12CalculateTOIEv) #10
  unreachable

158:                                              ; No predecessors!
  br label %159

159:                                              ; preds = %158, %156
  call void @llvm.lifetime.start.p0(i64 144, ptr %17) #9
  call void @_ZN10b2TOIInputC2Ev(ptr noundef nonnull align 8 dereferenceable(140) %17)
  %160 = getelementptr inbounds %struct.b2TOIInput, ptr %17, i32 0, i32 0
  %161 = load ptr, ptr %4, align 8, !tbaa !5
  %162 = call noundef ptr @_ZN9b2Fixture8GetShapeEv(ptr noundef nonnull align 8 dereferenceable(84) %161)
  call void @_ZN15b2DistanceProxy3SetEPK7b2Shape(ptr noundef nonnull align 8 dereferenceable(32) %160, ptr noundef %162)
  %163 = getelementptr inbounds %struct.b2TOIInput, ptr %17, i32 0, i32 1
  %164 = load ptr, ptr %5, align 8, !tbaa !5
  %165 = call noundef ptr @_ZN9b2Fixture8GetShapeEv(ptr noundef nonnull align 8 dereferenceable(84) %164)
  call void @_ZN15b2DistanceProxy3SetEPK7b2Shape(ptr noundef nonnull align 8 dereferenceable(32) %163, ptr noundef %165)
  %166 = load ptr, ptr %7, align 8, !tbaa !5
  %167 = getelementptr inbounds %class.b2Body, ptr %166, i32 0, i32 5
  %168 = getelementptr inbounds %struct.b2TOIInput, ptr %17, i32 0, i32 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %168, ptr align 4 %167, i64 36, i1 false), !tbaa.struct !28
  %169 = load ptr, ptr %8, align 8, !tbaa !5
  %170 = getelementptr inbounds %class.b2Body, ptr %169, i32 0, i32 5
  %171 = getelementptr inbounds %struct.b2TOIInput, ptr %17, i32 0, i32 3
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %171, ptr align 4 %170, i64 36, i1 false), !tbaa.struct !28
  %172 = getelementptr inbounds %struct.b2TOIInput, ptr %17, i32 0, i32 4
  store float 1.000000e+00, ptr %172, align 8, !tbaa !29
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #9
  call void @_Z14b2TimeOfImpactP11b2TOIOutputPK10b2TOIInput(ptr noundef %18, ptr noundef %17)
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #9
  %173 = getelementptr inbounds %struct.b2TOIOutput, ptr %18, i32 0, i32 1
  %174 = load float, ptr %173, align 4, !tbaa !32
  store float %174, ptr %20, align 4, !tbaa !27
  %175 = getelementptr inbounds %struct.b2TOIOutput, ptr %18, i32 0, i32 0
  %176 = load i32, ptr %175, align 4, !tbaa !35
  %177 = icmp eq i32 %176, 3
  br i1 %177, label %178, label %185

178:                                              ; preds = %159
  %179 = load float, ptr %16, align 4, !tbaa !27
  %180 = load float, ptr %16, align 4, !tbaa !27
  %181 = fsub float 1.000000e+00, %180
  %182 = load float, ptr %20, align 4, !tbaa !27
  %183 = call float @llvm.fmuladd.f32(float %181, float %182, float %179)
  %184 = call noundef float @_Z5b2MinIfET_S0_S0_(float noundef %183, float noundef 1.000000e+00)
  store float %184, ptr %19, align 4, !tbaa !27
  br label %186

185:                                              ; preds = %159
  store float 1.000000e+00, ptr %19, align 4, !tbaa !27
  br label %186

186:                                              ; preds = %185, %178
  %187 = load float, ptr %19, align 4, !tbaa !27
  store float %187, ptr %2, align 4
  store i32 1, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #9
  call void @llvm.lifetime.end.p0(i64 144, ptr %17) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #9
  br label %188

188:                                              ; preds = %186, %111
  call void @llvm.lifetime.end.p0(i64 1, ptr %15) #9
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #9
  br label %189

189:                                              ; preds = %188, %84
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #9
  call void @llvm.lifetime.end.p0(i64 1, ptr %12) #9
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #9
  br label %190

190:                                              ; preds = %189, %33
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #9
  %191 = load float, ptr %2, align 4
  ret float %191
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN9b2Contact11GetFixtureAEv(ptr noundef nonnull align 8 dereferenceable(128)) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN9b2Contact11GetFixtureBEv(ptr noundef nonnull align 8 dereferenceable(128)) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK9b2Contact9IsEnabledEv(ptr noundef nonnull align 8 dereferenceable(128)) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK6b2Body7IsAwakeEv(ptr noundef nonnull align 8 dereferenceable(208)) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK6b2Body8IsBulletEv(ptr noundef nonnull align 8 dereferenceable(208)) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN7b2Sweep7AdvanceEf(ptr noundef nonnull align 4 dereferenceable(36), float noundef) #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN10b2TOIInputC2Ev(ptr noundef nonnull align 8 dereferenceable(140)) unnamed_addr #6 align 2

declare void @_ZN15b2DistanceProxy3SetEPK7b2Shape(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) #7

declare void @_Z14b2TimeOfImpactP11b2TOIOutputPK10b2TOIInput(ptr noundef, ptr noundef) #7

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_Z5b2MinIfET_S0_S0_(float noundef, float noundef) #2

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { inlinehint mustprogress 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 nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress 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 #5 = { inlinehint mustprogress 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 #6 = { inlinehint mustprogress 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 #7 = { "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 #8 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #9 = { nounwind }
attributes #10 = { noreturn 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, !11, i64 0}
!10 = !{!"_ZTS6b2Body", !11, i64 0, !12, i64 4, !13, i64 8, !14, i64 12, !14, i64 28, !18, i64 44, !15, i64 80, !16, i64 88, !15, i64 92, !16, i64 100, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !13, i64 136, !6, i64 144, !6, i64 152, !13, i64 160, !13, i64 164, !16, i64 168, !16, i64 172, !16, i64 176, !16, i64 180, !16, i64 184, !16, i64 188, !16, i64 192, !16, i64 196, !19, i64 200}
!11 = !{!"_ZTS10b2BodyType", !7, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_ZTS11b2Transform", !15, i64 0, !17, i64 8}
!15 = !{!"_ZTS6b2Vec2", !16, i64 0, !16, i64 4}
!16 = !{!"float", !7, i64 0}
!17 = !{!"_ZTS5b2Rot", !16, i64 0, !16, i64 4}
!18 = !{!"_ZTS7b2Sweep", !15, i64 0, !15, i64 8, !15, i64 16, !16, i64 24, !16, i64 28, !16, i64 32}
!19 = !{!"_ZTS14b2BodyUserData", !20, i64 0}
!20 = !{!"long", !7, i64 0}
!21 = !{!11, !11, i64 0}
!22 = !{!23, !23, i64 0}
!23 = !{!"bool", !7, i64 0}
!24 = !{i8 0, i8 2}
!25 = !{}
!26 = !{!10, !16, i64 76}
!27 = !{!16, !16, i64 0}
!28 = !{i64 0, i64 4, !27, i64 4, i64 4, !27, i64 8, i64 4, !27, i64 12, i64 4, !27, i64 16, i64 4, !27, i64 20, i64 4, !27, i64 24, i64 4, !27, i64 28, i64 4, !27, i64 32, i64 4, !27}
!29 = !{!30, !16, i64 136}
!30 = !{!"_ZTS10b2TOIInput", !31, i64 0, !31, i64 32, !18, i64 64, !18, i64 100, !16, i64 136}
!31 = !{!"_ZTS15b2DistanceProxy", !7, i64 0, !6, i64 16, !13, i64 24, !16, i64 28}
!32 = !{!33, !16, i64 4}
!33 = !{!"_ZTS11b2TOIOutput", !34, i64 0, !16, i64 4}
!34 = !{!"_ZTSN11b2TOIOutput5StateE", !7, i64 0}
!35 = !{!33, !34, i64 0}


; 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.b2TOIInput = type <{ %struct.b2DistanceProxy, %struct.b2DistanceProxy, %struct.b2Sweep, %struct.b2Sweep, float, [4 x i8] }>
%struct.b2DistanceProxy = type { [2 x %struct.b2Vec2], ptr, i32, float }
%struct.b2Vec2 = type { float, float }
%struct.b2Sweep = type { %struct.b2Vec2, %struct.b2Vec2, %struct.b2Vec2, float, float, float }
%struct.b2TOIOutput = type { i32, float }

@.str.1 = external hidden unnamed_addr constant [85 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [51 x i8], align 1
@__PRETTY_FUNCTION__._ZN9b2Contact12CalculateTOIEv = external hidden unnamed_addr constant [32 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [14 x i8], align 1

; 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: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK9b2Fixture8IsSensorEv(ptr noundef nonnull align 8 dereferenceable(84)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN9b2Fixture7GetBodyEv(ptr noundef nonnull align 8 dereferenceable(84)) local_unnamed_addr #2 align 2

; 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) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN9b2Fixture8GetShapeEv(ptr noundef nonnull align 8 dereferenceable(84)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef float @_ZN9b2Contact12CalculateTOIEv(ptr noundef nonnull align 8 dereferenceable(128) %0) local_unnamed_addr #4 align 2 {
  %2 = alloca %struct.b2TOIInput, align 8
  %3 = alloca %struct.b2TOIOutput, align 4
  %4 = tail call noundef ptr @_ZN9b2Contact11GetFixtureAEv(ptr noundef nonnull align 8 dereferenceable(128) %0)
  %5 = tail call noundef ptr @_ZN9b2Contact11GetFixtureBEv(ptr noundef nonnull align 8 dereferenceable(128) %0)
  %6 = tail call noundef zeroext i1 @_ZNK9b2Fixture8IsSensorEv(ptr noundef nonnull align 8 dereferenceable(84) %4)
  br i1 %6, label %65, label %7

7:                                                ; preds = %1
  %8 = tail call noundef zeroext i1 @_ZNK9b2Fixture8IsSensorEv(ptr noundef nonnull align 8 dereferenceable(84) %5)
  br i1 %8, label %65, label %9

9:                                                ; preds = %7
  %10 = tail call noundef zeroext i1 @_ZNK9b2Contact9IsEnabledEv(ptr noundef nonnull align 8 dereferenceable(128) %0)
  br i1 %10, label %11, label %65

11:                                               ; preds = %9
  %12 = tail call noundef ptr @_ZN9b2Fixture7GetBodyEv(ptr noundef nonnull align 8 dereferenceable(84) %4)
  %13 = tail call noundef ptr @_ZN9b2Fixture7GetBodyEv(ptr noundef nonnull align 8 dereferenceable(84) %5)
  %14 = load i32, ptr %12, align 8, !tbaa !5
  %15 = load i32, ptr %13, align 8, !tbaa !5
  %16 = icmp eq i32 %14, 2
  %17 = icmp eq i32 %15, 2
  %18 = select i1 %16, i1 true, i1 %17
  br i1 %18, label %20, label %19

19:                                               ; preds = %11
  tail call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i32 noundef 226, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN9b2Contact12CalculateTOIEv) #9
  unreachable

20:                                               ; preds = %11
  %21 = tail call noundef zeroext i1 @_ZNK6b2Body7IsAwakeEv(ptr noundef nonnull align 8 dereferenceable(208) %12)
  %22 = icmp ne i32 %14, 0
  %23 = and i1 %22, %21
  %24 = tail call noundef zeroext i1 @_ZNK6b2Body7IsAwakeEv(ptr noundef nonnull align 8 dereferenceable(208) %13)
  %25 = icmp ne i32 %15, 0
  %26 = and i1 %23, %24
  %.not47 = select i1 %26, i1 %25, i1 false
  br i1 %.not47, label %27, label %65

27:                                               ; preds = %20
  %28 = tail call noundef zeroext i1 @_ZNK6b2Body8IsBulletEv(ptr noundef nonnull align 8 dereferenceable(208) %12)
  %29 = icmp ne i32 %14, 2
  %30 = or i1 %29, %28
  %31 = tail call noundef zeroext i1 @_ZNK6b2Body8IsBulletEv(ptr noundef nonnull align 8 dereferenceable(208) %13)
  %32 = icmp ne i32 %15, 2
  %33 = or i1 %30, %31
  %or.cond = select i1 %33, i1 true, i1 %32
  br i1 %or.cond, label %34, label %65

34:                                               ; preds = %27
  %35 = getelementptr inbounds i8, ptr %12, i64 44
  %36 = getelementptr inbounds i8, ptr %12, i64 76
  %37 = load float, ptr %36, align 4, !tbaa !20
  %38 = getelementptr inbounds i8, ptr %13, i64 44
  %39 = getelementptr inbounds i8, ptr %13, i64 76
  %40 = load float, ptr %39, align 4, !tbaa !20
  %41 = fcmp olt float %37, %40
  br i1 %41, label %42, label %43

42:                                               ; preds = %34
  tail call void @_ZN7b2Sweep7AdvanceEf(ptr noundef nonnull align 4 dereferenceable(36) %35, float noundef %40)
  br label %46

43:                                               ; preds = %34
  %44 = fcmp olt float %40, %37
  br i1 %44, label %45, label %46

45:                                               ; preds = %43
  tail call void @_ZN7b2Sweep7AdvanceEf(ptr noundef nonnull align 4 dereferenceable(36) %38, float noundef %37)
  br label %46

46:                                               ; preds = %43, %45, %42
  %.043 = phi float [ %40, %42 ], [ %37, %45 ], [ %37, %43 ]
  %47 = fcmp olt float %.043, 1.000000e+00
  br i1 %47, label %49, label %48

48:                                               ; preds = %46
  tail call void @__assert_fail(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.1, i32 noundef 261, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN9b2Contact12CalculateTOIEv) #9
  unreachable

49:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 144, ptr nonnull %2) #10
  call void @_ZN10b2TOIInputC2Ev(ptr noundef nonnull align 8 dereferenceable(140) %2)
  %50 = call noundef ptr @_ZN9b2Fixture8GetShapeEv(ptr noundef nonnull align 8 dereferenceable(84) %4)
  call void @_ZN15b2DistanceProxy3SetEPK7b2Shape(ptr noundef nonnull align 8 dereferenceable(32) %2, ptr noundef %50)
  %51 = getelementptr inbounds i8, ptr %2, i64 32
  %52 = call noundef ptr @_ZN9b2Fixture8GetShapeEv(ptr noundef nonnull align 8 dereferenceable(84) %5)
  call void @_ZN15b2DistanceProxy3SetEPK7b2Shape(ptr noundef nonnull align 8 dereferenceable(32) %51, ptr noundef %52)
  %53 = getelementptr inbounds i8, ptr %2, i64 64
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(36) %53, ptr noundef nonnull align 4 dereferenceable(36) %35, i64 36, i1 false), !tbaa.struct !21
  %54 = getelementptr inbounds i8, ptr %2, i64 100
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(36) %54, ptr noundef nonnull align 4 dereferenceable(36) %38, i64 36, i1 false), !tbaa.struct !21
  %55 = getelementptr inbounds i8, ptr %2, i64 136
  store float 1.000000e+00, ptr %55, align 8, !tbaa !23
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #10
  call void @_Z14b2TimeOfImpactP11b2TOIOutputPK10b2TOIInput(ptr noundef nonnull %3, ptr noundef nonnull %2)
  %56 = load i32, ptr %3, align 4, !tbaa !26
  %57 = icmp eq i32 %56, 3
  br i1 %57, label %58, label %64

58:                                               ; preds = %49
  %59 = getelementptr inbounds i8, ptr %3, i64 4
  %60 = load float, ptr %59, align 4, !tbaa !29
  %61 = fsub float 1.000000e+00, %.043
  %62 = call float @llvm.fmuladd.f32(float %61, float %60, float %.043)
  %63 = call noundef float @_Z5b2MinIfET_S0_S0_(float noundef %62, float noundef 1.000000e+00)
  br label %64

64:                                               ; preds = %49, %58
  %.042 = phi float [ %63, %58 ], [ 1.000000e+00, %49 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #10
  call void @llvm.lifetime.end.p0(i64 144, ptr nonnull %2) #10
  br label %65

65:                                               ; preds = %20, %27, %64, %1, %7, %9
  %.2 = phi float [ 1.000000e+00, %9 ], [ 1.000000e+00, %7 ], [ 1.000000e+00, %1 ], [ 1.000000e+00, %20 ], [ %.042, %64 ], [ 1.000000e+00, %27 ]
  ret float %.2
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN9b2Contact11GetFixtureAEv(ptr noundef nonnull align 8 dereferenceable(128)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN9b2Contact11GetFixtureBEv(ptr noundef nonnull align 8 dereferenceable(128)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK9b2Contact9IsEnabledEv(ptr noundef nonnull align 8 dereferenceable(128)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK6b2Body7IsAwakeEv(ptr noundef nonnull align 8 dereferenceable(208)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK6b2Body8IsBulletEv(ptr noundef nonnull align 8 dereferenceable(208)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN7b2Sweep7AdvanceEf(ptr noundef nonnull align 4 dereferenceable(36), float noundef) local_unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN10b2TOIInputC2Ev(ptr noundef nonnull align 8 dereferenceable(140)) unnamed_addr #6 align 2

declare void @_ZN15b2DistanceProxy3SetEPK7b2Shape(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) local_unnamed_addr #7

declare void @_Z14b2TimeOfImpactP11b2TOIOutputPK10b2TOIInput(ptr noundef, ptr noundef) local_unnamed_addr #7

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_Z5b2MinIfET_S0_S0_(float noundef, float noundef) local_unnamed_addr #2

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { inlinehint mustprogress 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress 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 #5 = { inlinehint mustprogress 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 #6 = { inlinehint mustprogress 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 #7 = { "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 #8 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #9 = { noreturn nounwind }
attributes #10 = { 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 0}
!6 = !{!"_ZTS6b2Body", !7, i64 0, !10, i64 4, !11, i64 8, !12, i64 12, !12, i64 28, !16, i64 44, !13, i64 80, !14, i64 88, !13, i64 92, !14, i64 100, !17, i64 104, !17, i64 112, !17, i64 120, !17, i64 128, !11, i64 136, !17, i64 144, !17, i64 152, !11, i64 160, !11, i64 164, !14, i64 168, !14, i64 172, !14, i64 176, !14, i64 180, !14, i64 184, !14, i64 188, !14, i64 192, !14, i64 196, !18, i64 200}
!7 = !{!"_ZTS10b2BodyType", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"short", !8, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = !{!"_ZTS11b2Transform", !13, i64 0, !15, i64 8}
!13 = !{!"_ZTS6b2Vec2", !14, i64 0, !14, i64 4}
!14 = !{!"float", !8, i64 0}
!15 = !{!"_ZTS5b2Rot", !14, i64 0, !14, i64 4}
!16 = !{!"_ZTS7b2Sweep", !13, i64 0, !13, i64 8, !13, i64 16, !14, i64 24, !14, i64 28, !14, i64 32}
!17 = !{!"any pointer", !8, i64 0}
!18 = !{!"_ZTS14b2BodyUserData", !19, i64 0}
!19 = !{!"long", !8, i64 0}
!20 = !{!6, !14, i64 76}
!21 = !{i64 0, i64 4, !22, i64 4, i64 4, !22, i64 8, i64 4, !22, i64 12, i64 4, !22, i64 16, i64 4, !22, i64 20, i64 4, !22, i64 24, i64 4, !22, i64 28, i64 4, !22, i64 32, i64 4, !22}
!22 = !{!14, !14, i64 0}
!23 = !{!24, !14, i64 136}
!24 = !{!"_ZTS10b2TOIInput", !25, i64 0, !25, i64 32, !16, i64 64, !16, i64 100, !14, i64 136}
!25 = !{!"_ZTS15b2DistanceProxy", !8, i64 0, !17, i64 16, !11, i64 24, !14, i64 28}
!26 = !{!27, !28, i64 0}
!27 = !{!"_ZTS11b2TOIOutput", !28, i64 0, !14, i64 4}
!28 = !{!"_ZTSN11b2TOIOutput5StateE", !8, i64 0}
!29 = !{!27, !14, i64 4}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass