; LLVM IR from Razakhel/RaZ :: src/RaZ/Utils (TriggerSystem)

; 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.anon = type { ptr }
%"class.Raz::TriggerVolume" = type <{ %"class.Raz::Component", i8, [7 x i8], %"class.std::variant", %"class.std::function", %"class.std::function", %"class.std::function", i8, [7 x i8] }>
%"class.Raz::Component" = type { ptr }
%"class.std::variant" = type { %"struct.std::__detail::__variant::_Variant_base.base", [7 x i8] }
%"struct.std::__detail::__variant::_Variant_base.base" = type { %"struct.std::__detail::__variant::_Move_assign_base.base" }
%"struct.std::__detail::__variant::_Move_assign_base.base" = type { %"struct.std::__detail::__variant::_Copy_assign_base.base" }
%"struct.std::__detail::__variant::_Copy_assign_base.base" = type { %"struct.std::__detail::__variant::_Move_ctor_base.base" }
%"struct.std::__detail::__variant::_Move_ctor_base.base" = type { %"struct.std::__detail::__variant::_Copy_ctor_base.base" }
%"struct.std::__detail::__variant::_Copy_ctor_base.base" = type { %"struct.std::__detail::__variant::_Variant_storage.base" }
%"struct.std::__detail::__variant::_Variant_storage.base" = type { %"union.std::__detail::__variant::_Variadic_union", i8 }
%"union.std::__detail::__variant::_Variadic_union" = type { %"struct.std::__detail::__variant::_Uninitialized" }
%"struct.std::__detail::__variant::_Uninitialized" = type { %"struct.__gnu_cxx::__aligned_membuf" }
%"struct.__gnu_cxx::__aligned_membuf" = type { [32 x i8] }
%"class.std::function" = type { %"class.std::_Function_base", ptr }
%"class.std::_Function_base" = type { %"union.std::_Any_data", ptr }
%"union.std::_Any_data" = type { %"union.std::_Nocopy_types" }
%"union.std::_Nocopy_types" = type { { i64, i64 } }

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3Raz13TriggerSystem14processTriggerERNS_13TriggerVolumeERKNS_9TransformE(ptr noundef nonnull align 8 dereferenceable(160) %0, ptr noundef nonnull align 8 dereferenceable(56) %1) #1 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i8, align 1
  %6 = alloca %class.anon, align 8
  %7 = alloca i32, align 4
  %8 = 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 1, ptr %5) #3
  %9 = load ptr, ptr %3, align 8, !tbaa !5
  %10 = getelementptr inbounds %"class.Raz::TriggerVolume", ptr %9, i32 0, i32 7
  %11 = load i8, ptr %10, align 8, !tbaa !9, !range !22, !noundef !23
  %12 = trunc i8 %11 to i1
  %13 = zext i1 %12 to i8
  store i8 %13, ptr %5, align 1, !tbaa !24
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %14 = getelementptr inbounds %class.anon, ptr %6, i32 0, i32 0
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %15, ptr %14, align 8, !tbaa !5
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = getelementptr inbounds %"class.Raz::TriggerVolume", ptr %16, i32 0, i32 3
  %18 = call noundef zeroext i1 @"_ZSt5visitIZN3Raz13TriggerSystem14processTriggerERNS0_13TriggerVolumeERKNS0_9TransformEE3$_0JRSt7variantIJNS0_4AABBENS0_6SphereEEEEENSt13invoke_resultIT_JDpNSt13__conditionalIX21is_lvalue_reference_vIT0_EEE4typeIRNSt19variant_alternativeILm0ENSt16remove_referenceIDTclsr9__variantE4__asclsr3stdE7declvalISG_EEEEE4typeEE4typeEOSP_EEEE4typeEOSE_DpOSG_"(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(33) %17)
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = getelementptr inbounds %"class.Raz::TriggerVolume", ptr %19, i32 0, i32 7
  %21 = zext i1 %18 to i8
  store i8 %21, ptr %20, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %22 = load i8, ptr %5, align 1, !tbaa !24, !range !22, !noundef !23
  %23 = trunc i8 %22 to i1
  br i1 %23, label %30, label %24

24:                                               ; preds = %2
  %25 = load ptr, ptr %3, align 8, !tbaa !5
  %26 = getelementptr inbounds %"class.Raz::TriggerVolume", ptr %25, i32 0, i32 7
  %27 = load i8, ptr %26, align 8, !tbaa !9, !range !22, !noundef !23
  %28 = trunc i8 %27 to i1
  br i1 %28, label %30, label %29

29:                                               ; preds = %24
  store i32 1, ptr %7, align 4
  br label %64

30:                                               ; preds = %24, %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %31 = load i8, ptr %5, align 1, !tbaa !24, !range !22, !noundef !23
  %32 = trunc i8 %31 to i1
  br i1 %32, label %41, label %33

33:                                               ; preds = %30
  %34 = load ptr, ptr %3, align 8, !tbaa !5
  %35 = getelementptr inbounds %"class.Raz::TriggerVolume", ptr %34, i32 0, i32 7
  %36 = load i8, ptr %35, align 8, !tbaa !9, !range !22, !noundef !23
  %37 = trunc i8 %36 to i1
  br i1 %37, label %38, label %41

38:                                               ; preds = %33
  %39 = load ptr, ptr %3, align 8, !tbaa !5
  %40 = getelementptr inbounds %"class.Raz::TriggerVolume", ptr %39, i32 0, i32 4
  br label %57

41:                                               ; preds = %33, %30
  %42 = load i8, ptr %5, align 1, !tbaa !24, !range !22, !noundef !23
  %43 = trunc i8 %42 to i1
  br i1 %43, label %44, label %52

44:                                               ; preds = %41
  %45 = load ptr, ptr %3, align 8, !tbaa !5
  %46 = getelementptr inbounds %"class.Raz::TriggerVolume", ptr %45, i32 0, i32 7
  %47 = load i8, ptr %46, align 8, !tbaa !9, !range !22, !noundef !23
  %48 = trunc i8 %47 to i1
  br i1 %48, label %49, label %52

49:                                               ; preds = %44
  %50 = load ptr, ptr %3, align 8, !tbaa !5
  %51 = getelementptr inbounds %"class.Raz::TriggerVolume", ptr %50, i32 0, i32 5
  br label %55

52:                                               ; preds = %44, %41
  %53 = load ptr, ptr %3, align 8, !tbaa !5
  %54 = getelementptr inbounds %"class.Raz::TriggerVolume", ptr %53, i32 0, i32 6
  br label %55

55:                                               ; preds = %52, %49
  %56 = phi ptr [ %51, %49 ], [ %54, %52 ]
  br label %57

57:                                               ; preds = %55, %38
  %58 = phi ptr [ %40, %38 ], [ %56, %55 ]
  store ptr %58, ptr %8, align 8, !tbaa !5
  %59 = load ptr, ptr %8, align 8, !tbaa !5
  %60 = call noundef zeroext i1 @_ZNKSt8functionIFvvEEcvbEv(ptr noundef nonnull align 8 dereferenceable(32) %59) #3
  br i1 %60, label %61, label %63

61:                                               ; preds = %57
  %62 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_ZNKSt8functionIFvvEEclEv(ptr noundef nonnull align 8 dereferenceable(32) %62)
  br label %63

63:                                               ; preds = %61, %57
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  store i32 0, ptr %7, align 4
  br label %64

64:                                               ; preds = %63, %29
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #3
  %65 = load i32, ptr %7, align 4
  switch i32 %65, label %67 [
    i32 0, label %66
    i32 1, label %66
  ]

66:                                               ; preds = %64, %64
  ret void

67:                                               ; preds = %64
  unreachable
}

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

; Function Attrs: mustprogress uwtable
declare hidden noundef zeroext i1 @"_ZSt5visitIZN3Raz13TriggerSystem14processTriggerERNS0_13TriggerVolumeERKNS0_9TransformEE3$_0JRSt7variantIJNS0_4AABBENS0_6SphereEEEEENSt13invoke_resultIT_JDpNSt13__conditionalIX21is_lvalue_reference_vIT0_EEE4typeIRNSt19variant_alternativeILm0ENSt16remove_referenceIDTclsr9__variantE4__asclsr3stdE7declvalISG_EEEEE4typeEE4typeEOSP_EEEE4typeEOSE_DpOSG_"(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(33)) #1

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNKSt8functionIFvvEEclEv(ptr noundef nonnull align 8 dereferenceable(32)) #1 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 = { 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, !12, i64 152}
!10 = !{!"_ZTSN3Raz13TriggerVolumeE", !11, i64 0, !12, i64 8, !13, i64 16, !20, i64 56, !20, i64 88, !20, i64 120, !12, i64 152}
!11 = !{!"_ZTSN3Raz9ComponentE"}
!12 = !{!"bool", !7, i64 0}
!13 = !{!"_ZTSSt7variantIJN3Raz4AABBENS0_6SphereEEE", !14, i64 0}
!14 = !{!"_ZTSNSt8__detail9__variant13_Variant_baseIJN3Raz4AABBENS2_6SphereEEEE", !15, i64 0}
!15 = !{!"_ZTSNSt8__detail9__variant17_Move_assign_baseILb0EJN3Raz4AABBENS2_6SphereEEEE", !16, i64 0}
!16 = !{!"_ZTSNSt8__detail9__variant17_Copy_assign_baseILb0EJN3Raz4AABBENS2_6SphereEEEE", !17, i64 0}
!17 = !{!"_ZTSNSt8__detail9__variant15_Move_ctor_baseILb0EJN3Raz4AABBENS2_6SphereEEEE", !18, i64 0}
!18 = !{!"_ZTSNSt8__detail9__variant15_Copy_ctor_baseILb0EJN3Raz4AABBENS2_6SphereEEEE", !19, i64 0}
!19 = !{!"_ZTSNSt8__detail9__variant16_Variant_storageILb0EJN3Raz4AABBENS2_6SphereEEEE", !7, i64 0, !7, i64 32}
!20 = !{!"_ZTSSt8functionIFvvEE", !21, i64 0, !6, i64 24}
!21 = !{!"_ZTSSt14_Function_base", !7, i64 0, !6, i64 16}
!22 = !{i8 0, i8 2}
!23 = !{}
!24 = !{!12, !12, 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"

%class.anon = type { ptr }

; 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 uwtable
define dso_local void @_ZN3Raz13TriggerSystem14processTriggerERNS_13TriggerVolumeERKNS_9TransformE(ptr noundef nonnull align 8 dereferenceable(160) %0, ptr noundef nonnull align 8 dereferenceable(56) %1) local_unnamed_addr #1 align 2 {
  %3 = alloca %class.anon, align 8
  %4 = getelementptr inbounds i8, ptr %0, i64 152
  %5 = load i8, ptr %4, align 8, !tbaa !5, !range !21, !noundef !22
  %6 = trunc nuw i8 %5 to i1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #3
  store ptr %1, ptr %3, align 8, !tbaa !23
  %7 = getelementptr inbounds i8, ptr %0, i64 16
  %8 = call noundef zeroext i1 @"_ZSt5visitIZN3Raz13TriggerSystem14processTriggerERNS0_13TriggerVolumeERKNS0_9TransformEE3$_0JRSt7variantIJNS0_4AABBENS0_6SphereEEEEENSt13invoke_resultIT_JDpNSt13__conditionalIX21is_lvalue_reference_vIT0_EEE4typeIRNSt19variant_alternativeILm0ENSt16remove_referenceIDTclsr9__variantE4__asclsr3stdE7declvalISG_EEEEE4typeEE4typeEOSP_EEEE4typeEOSE_DpOSG_"(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(33) %7)
  %9 = zext i1 %8 to i8
  store i8 %9, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  br i1 %6, label %.critedge14, label %10

10:                                               ; preds = %2
  br i1 %8, label %11, label %15

.critedge14:                                      ; preds = %2
  %. = select i1 %8, i64 88, i64 120
  br label %11

11:                                               ; preds = %.critedge14, %10
  %.sink = phi i64 [ 56, %10 ], [ %., %.critedge14 ]
  %12 = getelementptr inbounds i8, ptr %0, i64 %.sink
  %13 = call noundef zeroext i1 @_ZNKSt8functionIFvvEEcvbEv(ptr noundef nonnull align 8 dereferenceable(32) %12) #3
  br i1 %13, label %14, label %15

14:                                               ; preds = %11
  call void @_ZNKSt8functionIFvvEEclEv(ptr noundef nonnull align 8 dereferenceable(32) %12)
  br label %15

15:                                               ; preds = %11, %14, %10
  ret void
}

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

; Function Attrs: mustprogress uwtable
declare hidden noundef zeroext i1 @"_ZSt5visitIZN3Raz13TriggerSystem14processTriggerERNS0_13TriggerVolumeERKNS0_9TransformEE3$_0JRSt7variantIJNS0_4AABBENS0_6SphereEEEEENSt13invoke_resultIT_JDpNSt13__conditionalIX21is_lvalue_reference_vIT0_EEE4typeIRNSt19variant_alternativeILm0ENSt16remove_referenceIDTclsr9__variantE4__asclsr3stdE7declvalISG_EEEEE4typeEE4typeEOSP_EEEE4typeEOSE_DpOSG_"(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(33)) local_unnamed_addr #1

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNKSt8functionIFvvEEclEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 = { 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, !8, i64 152}
!6 = !{!"_ZTSN3Raz13TriggerVolumeE", !7, i64 0, !8, i64 8, !11, i64 16, !18, i64 56, !18, i64 88, !18, i64 120, !8, i64 152}
!7 = !{!"_ZTSN3Raz9ComponentE"}
!8 = !{!"bool", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"_ZTSSt7variantIJN3Raz4AABBENS0_6SphereEEE", !12, i64 0}
!12 = !{!"_ZTSNSt8__detail9__variant13_Variant_baseIJN3Raz4AABBENS2_6SphereEEEE", !13, i64 0}
!13 = !{!"_ZTSNSt8__detail9__variant17_Move_assign_baseILb0EJN3Raz4AABBENS2_6SphereEEEE", !14, i64 0}
!14 = !{!"_ZTSNSt8__detail9__variant17_Copy_assign_baseILb0EJN3Raz4AABBENS2_6SphereEEEE", !15, i64 0}
!15 = !{!"_ZTSNSt8__detail9__variant15_Move_ctor_baseILb0EJN3Raz4AABBENS2_6SphereEEEE", !16, i64 0}
!16 = !{!"_ZTSNSt8__detail9__variant15_Copy_ctor_baseILb0EJN3Raz4AABBENS2_6SphereEEEE", !17, i64 0}
!17 = !{!"_ZTSNSt8__detail9__variant16_Variant_storageILb0EJN3Raz4AABBENS2_6SphereEEEE", !9, i64 0, !9, i64 32}
!18 = !{!"_ZTSSt8functionIFvvEE", !19, i64 0, !20, i64 24}
!19 = !{!"_ZTSSt14_Function_base", !9, i64 0, !20, i64 16}
!20 = !{!"any pointer", !9, i64 0}
!21 = !{i8 0, i8 2}
!22 = !{}
!23 = !{!20, !20, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,SROAPass,SimplifyCFGPass