; LLVM IR from jrouwe/JoltPhysics :: Samples/Tests/ConvexCollision (InteractivePairsTest)

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

%"class.Test::ProcessInputParams" = type { float, ptr, %struct.CameraState }
%struct.CameraState = type <{ %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Vec3", float, [12 x i8] }>
%"class.JPH::Vec3" = type { %union.anon }
%union.anon = type { <4 x float> }
%class.InteractivePairsTest = type { %class.Test, i8, float }
%class.Test = type { ptr, ptr, ptr, ptr, ptr, ptr, i8, %"class.std::unordered_map" }
%"class.std::unordered_map" = type { %"class.std::_Hashtable" }
%"class.std::_Hashtable" = type { ptr, i64, %"struct.std::__detail::_Hash_node_base", i64, %"struct.std::__detail::_Prime_rehash_policy", ptr }
%"struct.std::__detail::_Hash_node_base" = type { ptr }
%"struct.std::__detail::_Prime_rehash_policy" = type { float, i64 }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN20InteractivePairsTest12ProcessInputERKN4Test18ProcessInputParamsE(ptr noundef nonnull align 8 dereferenceable(120) %0, ptr noundef nonnull align 16 dereferenceable(80) %1) unnamed_addr #0 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %5 = load ptr, ptr %3, align 8
  %6 = load ptr, ptr %4, align 8, !tbaa !5
  %7 = getelementptr inbounds %"class.Test::ProcessInputParams", ptr %6, i32 0, i32 1
  %8 = load ptr, ptr %7, align 8, !tbaa !9
  %9 = load ptr, ptr %8, align 8, !tbaa !14
  %10 = getelementptr inbounds ptr, ptr %9, i64 5
  %11 = load ptr, ptr %10, align 8
  %12 = call noundef zeroext i1 %11(ptr noundef nonnull align 8 dereferenceable(8) %8, i32 noundef 27)
  br i1 %12, label %13, label %21

13:                                               ; preds = %2
  %14 = getelementptr inbounds %class.InteractivePairsTest, ptr %5, i32 0, i32 1
  store i8 1, ptr %14, align 8, !tbaa !16
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = getelementptr inbounds %"class.Test::ProcessInputParams", ptr %15, i32 0, i32 0
  %17 = load float, ptr %16, align 16, !tbaa !25
  %18 = getelementptr inbounds %class.InteractivePairsTest, ptr %5, i32 0, i32 2
  %19 = load float, ptr %18, align 4, !tbaa !26
  %20 = fsub float %19, %17
  store float %20, ptr %18, align 4, !tbaa !26
  br label %49

21:                                               ; preds = %2
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = getelementptr inbounds %"class.Test::ProcessInputParams", ptr %22, i32 0, i32 1
  %24 = load ptr, ptr %23, align 8, !tbaa !9
  %25 = load ptr, ptr %24, align 8, !tbaa !14
  %26 = getelementptr inbounds ptr, ptr %25, i64 5
  %27 = load ptr, ptr %26, align 8
  %28 = call noundef zeroext i1 %27(ptr noundef nonnull align 8 dereferenceable(8) %24, i32 noundef 4)
  br i1 %28, label %29, label %37

29:                                               ; preds = %21
  %30 = getelementptr inbounds %class.InteractivePairsTest, ptr %5, i32 0, i32 1
  store i8 1, ptr %30, align 8, !tbaa !16
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  %32 = getelementptr inbounds %"class.Test::ProcessInputParams", ptr %31, i32 0, i32 0
  %33 = load float, ptr %32, align 16, !tbaa !25
  %34 = getelementptr inbounds %class.InteractivePairsTest, ptr %5, i32 0, i32 2
  %35 = load float, ptr %34, align 4, !tbaa !26
  %36 = fadd float %35, %33
  store float %36, ptr %34, align 4, !tbaa !26
  br label %48

37:                                               ; preds = %21
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = getelementptr inbounds %"class.Test::ProcessInputParams", ptr %38, i32 0, i32 1
  %40 = load ptr, ptr %39, align 8, !tbaa !9
  %41 = load ptr, ptr %40, align 8, !tbaa !14
  %42 = getelementptr inbounds ptr, ptr %41, i64 5
  %43 = load ptr, ptr %42, align 8
  %44 = call noundef zeroext i1 %43(ptr noundef nonnull align 8 dereferenceable(8) %40, i32 noundef 25)
  br i1 %44, label %45, label %47

45:                                               ; preds = %37
  %46 = getelementptr inbounds %class.InteractivePairsTest, ptr %5, i32 0, i32 1
  store i8 0, ptr %46, align 8, !tbaa !16
  br label %47

47:                                               ; preds = %45, %37
  br label %48

48:                                               ; preds = %47, %29
  br label %49

49:                                               ; preds = %48, %13
  %50 = getelementptr inbounds %class.InteractivePairsTest, ptr %5, i32 0, i32 1
  %51 = load i8, ptr %50, align 8, !tbaa !16, !range !27, !noundef !28
  %52 = trunc i8 %51 to i1
  br i1 %52, label %60, label %53

53:                                               ; preds = %49
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  %55 = getelementptr inbounds %"class.Test::ProcessInputParams", ptr %54, i32 0, i32 0
  %56 = load float, ptr %55, align 16, !tbaa !25
  %57 = getelementptr inbounds %class.InteractivePairsTest, ptr %5, i32 0, i32 2
  %58 = load float, ptr %57, align 4, !tbaa !26
  %59 = fsub float %58, %56
  store float %59, ptr %57, align 4, !tbaa !26
  br label %60

60:                                               ; preds = %53, %49
  %61 = getelementptr inbounds %class.InteractivePairsTest, ptr %5, i32 0, i32 2
  %62 = load float, ptr %61, align 4, !tbaa !26
  %63 = fcmp olt float %62, -4.000000e+00
  br i1 %63, label %64, label %66

64:                                               ; preds = %60
  %65 = getelementptr inbounds %class.InteractivePairsTest, ptr %5, i32 0, i32 2
  store float 4.000000e+00, ptr %65, align 4, !tbaa !26
  br label %66

66:                                               ; preds = %64, %60
  %67 = getelementptr inbounds %class.InteractivePairsTest, ptr %5, i32 0, i32 2
  %68 = load float, ptr %67, align 4, !tbaa !26
  %69 = fcmp ogt float %68, 4.000000e+00
  br i1 %69, label %70, label %72

70:                                               ; preds = %66
  %71 = getelementptr inbounds %class.InteractivePairsTest, ptr %5, i32 0, i32 2
  store float -4.000000e+00, ptr %71, align 4, !tbaa !26
  br label %72

72:                                               ; preds = %70, %66
  ret void
}

attributes #0 = { 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" }

!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 8}
!10 = !{!"_ZTSN4Test18ProcessInputParamsE", !11, i64 0, !6, i64 8, !12, i64 16}
!11 = !{!"float", !7, i64 0}
!12 = !{!"_ZTS11CameraState", !13, i64 0, !13, i64 16, !13, i64 32, !11, i64 48}
!13 = !{!"_ZTSN3JPH4Vec3E", !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"vtable pointer", !8, i64 0}
!16 = !{!17, !19, i64 112}
!17 = !{!"_ZTS20InteractivePairsTest", !18, i64 0, !19, i64 112, !11, i64 116}
!18 = !{!"_ZTS4Test", !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !19, i64 48, !20, i64 56}
!19 = !{!"bool", !7, i64 0}
!20 = !{!"_ZTSSt13unordered_mapIN3JPH6BodyIDENSt7__cxx1112basic_stringIcSt11char_traitsIcENS0_12STLAllocatorIcEEEESt4hashIS1_ESt8equal_toIS1_ESaISt4pairIKS1_S8_EEE", !21, i64 0}
!21 = !{!"_ZTSSt10_HashtableIN3JPH6BodyIDESt4pairIKS1_NSt7__cxx1112basic_stringIcSt11char_traitsIcENS0_12STLAllocatorIcEEEEESaISB_ENSt8__detail10_Select1stESt8equal_toIS1_ESt4hashIS1_ENSD_18_Mod_range_hashingENSD_20_Default_ranged_hashENSD_20_Prime_rehash_policyENSD_17_Hashtable_traitsILb1ELb0ELb1EEEE", !6, i64 0, !22, i64 8, !23, i64 16, !22, i64 24, !24, i64 32, !6, i64 48}
!22 = !{!"long", !7, i64 0}
!23 = !{!"_ZTSNSt8__detail15_Hash_node_baseE", !6, i64 0}
!24 = !{!"_ZTSNSt8__detail20_Prime_rehash_policyE", !11, i64 0, !22, i64 8}
!25 = !{!10, !11, i64 0}
!26 = !{!17, !11, i64 116}
!27 = !{i8 0, i8 2}
!28 = !{}


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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN20InteractivePairsTest12ProcessInputERKN4Test18ProcessInputParamsE(ptr nocapture noundef nonnull align 8 dereferenceable(120) %0, ptr nocapture noundef nonnull readonly align 16 dereferenceable(80) %1) unnamed_addr #0 align 2 {
  %3 = getelementptr inbounds i8, ptr %1, i64 8
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = load ptr, ptr %4, align 8, !tbaa !13
  %6 = getelementptr inbounds i8, ptr %5, i64 40
  %7 = load ptr, ptr %6, align 8
  %8 = tail call noundef zeroext i1 %7(ptr noundef nonnull align 8 dereferenceable(8) %4, i32 noundef 27)
  br i1 %8, label %9, label %15

9:                                                ; preds = %2
  %10 = getelementptr inbounds i8, ptr %0, i64 112
  store i8 1, ptr %10, align 8, !tbaa !15
  %11 = load float, ptr %1, align 16, !tbaa !24
  %12 = getelementptr inbounds i8, ptr %0, i64 116
  %13 = load float, ptr %12, align 4, !tbaa !25
  %14 = fsub float %13, %11
  store float %14, ptr %12, align 4, !tbaa !25
  br label %._crit_edge7

15:                                               ; preds = %2
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = load ptr, ptr %16, align 8, !tbaa !13
  %18 = getelementptr inbounds i8, ptr %17, i64 40
  %19 = load ptr, ptr %18, align 8
  %20 = tail call noundef zeroext i1 %19(ptr noundef nonnull align 8 dereferenceable(8) %16, i32 noundef 4)
  br i1 %20, label %21, label %27

21:                                               ; preds = %15
  %22 = getelementptr inbounds i8, ptr %0, i64 112
  store i8 1, ptr %22, align 8, !tbaa !15
  %23 = load float, ptr %1, align 16, !tbaa !24
  %24 = getelementptr inbounds i8, ptr %0, i64 116
  %25 = load float, ptr %24, align 4, !tbaa !25
  %26 = fadd float %23, %25
  store float %26, ptr %24, align 4, !tbaa !25
  br label %._crit_edge7

27:                                               ; preds = %15
  %28 = load ptr, ptr %3, align 8, !tbaa !5
  %29 = load ptr, ptr %28, align 8, !tbaa !13
  %30 = getelementptr inbounds i8, ptr %29, i64 40
  %31 = load ptr, ptr %30, align 8
  %32 = tail call noundef zeroext i1 %31(ptr noundef nonnull align 8 dereferenceable(8) %28, i32 noundef 25)
  %33 = getelementptr inbounds i8, ptr %0, i64 112
  br i1 %32, label %.thread11, label %34

.thread11:                                        ; preds = %27
  store i8 0, ptr %33, align 8, !tbaa !15
  br label %36

34:                                               ; preds = %27
  %.pre = load i8, ptr %33, align 8, !tbaa !15, !range !26
  %35 = trunc nuw i8 %.pre to i1
  br i1 %35, label %._crit_edge7, label %36

._crit_edge7:                                     ; preds = %9, %21, %34
  %.phi.trans.insert8 = getelementptr inbounds i8, ptr %0, i64 116
  %.pre9 = load float, ptr %.phi.trans.insert8, align 4, !tbaa !25
  br label %41

36:                                               ; preds = %.thread11, %34
  %37 = load float, ptr %1, align 16, !tbaa !24
  %38 = getelementptr inbounds i8, ptr %0, i64 116
  %39 = load float, ptr %38, align 4, !tbaa !25
  %40 = fsub float %39, %37
  store float %40, ptr %38, align 4, !tbaa !25
  br label %41

41:                                               ; preds = %._crit_edge7, %36
  %42 = phi float [ %.pre9, %._crit_edge7 ], [ %40, %36 ]
  %43 = getelementptr inbounds i8, ptr %0, i64 116
  %44 = fcmp olt float %42, -4.000000e+00
  br i1 %44, label %.sink.split, label %45

45:                                               ; preds = %41
  %46 = fcmp ogt float %42, 4.000000e+00
  br i1 %46, label %.sink.split, label %47

.sink.split:                                      ; preds = %45, %41
  %.sink = phi float [ 4.000000e+00, %41 ], [ -4.000000e+00, %45 ]
  store float %.sink, ptr %43, align 4, !tbaa !25
  br label %47

47:                                               ; preds = %.sink.split, %45
  ret void
}

attributes #0 = { 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" }

!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, !10, i64 8}
!6 = !{!"_ZTSN4Test18ProcessInputParamsE", !7, i64 0, !10, i64 8, !11, i64 16}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"_ZTS11CameraState", !12, i64 0, !12, i64 16, !12, i64 32, !7, i64 48}
!12 = !{!"_ZTSN3JPH4Vec3E", !8, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"vtable pointer", !9, i64 0}
!15 = !{!16, !18, i64 112}
!16 = !{!"_ZTS20InteractivePairsTest", !17, i64 0, !18, i64 112, !7, i64 116}
!17 = !{!"_ZTS4Test", !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !18, i64 48, !19, i64 56}
!18 = !{!"bool", !8, i64 0}
!19 = !{!"_ZTSSt13unordered_mapIN3JPH6BodyIDENSt7__cxx1112basic_stringIcSt11char_traitsIcENS0_12STLAllocatorIcEEEESt4hashIS1_ESt8equal_toIS1_ESaISt4pairIKS1_S8_EEE", !20, i64 0}
!20 = !{!"_ZTSSt10_HashtableIN3JPH6BodyIDESt4pairIKS1_NSt7__cxx1112basic_stringIcSt11char_traitsIcENS0_12STLAllocatorIcEEEEESaISB_ENSt8__detail10_Select1stESt8equal_toIS1_ESt4hashIS1_ENSD_18_Mod_range_hashingENSD_20_Default_ranged_hashENSD_20_Prime_rehash_policyENSD_17_Hashtable_traitsILb1ELb0ELb1EEEE", !10, i64 0, !21, i64 8, !22, i64 16, !21, i64 24, !23, i64 32, !10, i64 48}
!21 = !{!"long", !8, i64 0}
!22 = !{!"_ZTSNSt8__detail15_Hash_node_baseE", !10, i64 0}
!23 = !{!"_ZTSNSt8__detail20_Prime_rehash_policyE", !7, i64 0, !21, i64 8}
!24 = !{!6, !7, i64 0}
!25 = !{!16, !7, i64 116}
!26 = !{i8 0, i8 2}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,IPSCCPPass,InstCombinePass,JumpThreadingPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass