; LLVM IR from dynexcoin/Dynex :: src/System/Event.ll (ZN6System5Event4waitEv)

; 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.System::(anonymous namespace)::EventWaiter" = type { i8, ptr, ptr, ptr }
%class.anon = type { ptr, ptr }
%"class.System::Event" = type { ptr, i8, ptr, ptr }
%"struct.System::NativeContext" = type { ptr, ptr, i8, i8, ptr, ptr, ptr, ptr, %"class.std::function", %"class.std::function" }
%"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 } }

@.str.1 = external hidden unnamed_addr constant [70 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [22 x i8], align 1
@__PRETTY_FUNCTION__._ZN6System5Event4waitEv = external hidden unnamed_addr constant [27 x i8], align 1
@_ZTIN6System20InterruptedExceptionE = external dso_local constant { ptr, ptr, ptr }, align 8
@.str.4 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [46 x i8], align 1

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6System5Event4waitEv(ptr noundef nonnull align 8 dereferenceable(32) %0) #2 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca %"struct.System::(anonymous namespace)::EventWaiter", align 8
  %4 = alloca %class.anon, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %5 = load ptr, ptr %2, align 8
  %6 = getelementptr inbounds %"class.System::Event", ptr %5, i32 0, i32 0
  %7 = load ptr, ptr %6, align 8, !tbaa !9
  %8 = icmp ne ptr %7, null
  br i1 %8, label %9, label %10

9:                                                ; preds = %1
  br label %12

10:                                               ; preds = %1
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 119, ptr noundef @__PRETTY_FUNCTION__._ZN6System5Event4waitEv) #8
  unreachable

11:                                               ; No predecessors!
  br label %12

12:                                               ; preds = %11, %9
  %13 = getelementptr inbounds %"class.System::Event", ptr %5, i32 0, i32 0
  %14 = load ptr, ptr %13, align 8, !tbaa !9
  %15 = call noundef zeroext i1 @_ZN6System10Dispatcher11interruptedEv(ptr noundef nonnull align 16 dereferenceable(440) %14)
  br i1 %15, label %16, label %18

16:                                               ; preds = %12
  %17 = call ptr @__cxa_allocate_exception(i64 8) #9
  call void @llvm.memset.p0.i64(ptr align 16 %17, i8 0, i64 8, i1 false)
  call void @_ZN6System20InterruptedExceptionC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %17) #9
  call void @__cxa_throw(ptr %17, ptr @_ZTIN6System20InterruptedExceptionE, ptr @_ZNSt9exceptionD2Ev) #10
  unreachable

18:                                               ; preds = %12
  %19 = getelementptr inbounds %"class.System::Event", ptr %5, i32 0, i32 1
  %20 = load i8, ptr %19, align 8, !tbaa !12, !range !13, !noundef !14
  %21 = trunc i8 %20 to i1
  br i1 %21, label %83, label %22

22:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 32, ptr %3) #9
  %23 = getelementptr inbounds %"struct.System::(anonymous namespace)::EventWaiter", ptr %3, i32 0, i32 0
  store i8 0, ptr %23, align 8, !tbaa !15
  %24 = getelementptr inbounds %"struct.System::(anonymous namespace)::EventWaiter", ptr %3, i32 0, i32 1
  store ptr null, ptr %24, align 8, !tbaa !17
  %25 = getelementptr inbounds %"struct.System::(anonymous namespace)::EventWaiter", ptr %3, i32 0, i32 2
  store ptr null, ptr %25, align 8, !tbaa !18
  %26 = getelementptr inbounds %"struct.System::(anonymous namespace)::EventWaiter", ptr %3, i32 0, i32 3
  %27 = getelementptr inbounds %"class.System::Event", ptr %5, i32 0, i32 0
  %28 = load ptr, ptr %27, align 8, !tbaa !9
  %29 = call noundef ptr @_ZNK6System10Dispatcher17getCurrentContextEv(ptr noundef nonnull align 16 dereferenceable(440) %28)
  store ptr %29, ptr %26, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 16, ptr %4) #9
  %30 = getelementptr inbounds %class.anon, ptr %4, i32 0, i32 0
  store ptr %3, ptr %30, align 8, !tbaa !5
  %31 = getelementptr inbounds %class.anon, ptr %4, i32 0, i32 1
  store ptr %5, ptr %31, align 8, !tbaa !20
  %32 = getelementptr inbounds %"struct.System::(anonymous namespace)::EventWaiter", ptr %3, i32 0, i32 3
  %33 = load ptr, ptr %32, align 8, !tbaa !19
  %34 = getelementptr inbounds %"struct.System::NativeContext", ptr %33, i32 0, i32 9
  %35 = call noundef nonnull align 8 dereferenceable(32) ptr @"_ZNSt8functionIFvvEEaSIZN6System5Event4waitEvE3$_0EENSt9enable_ifIXsrNS1_9_CallableIT_NS6_IXntsr7is_sameINSt9remove_cvINSt16remove_referenceIS8_E4typeEE4typeES1_EE5valueESt5decayIS8_EE4type4typeESt15__invoke_resultIRSJ_JEEEE5valueERS1_E4typeEOS8_"(ptr noundef nonnull align 8 dereferenceable(32) %34, ptr noundef nonnull align 8 dereferenceable(16) %4) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr %4) #9
  %36 = getelementptr inbounds %"class.System::Event", ptr %5, i32 0, i32 2
  %37 = load ptr, ptr %36, align 8, !tbaa !22
  %38 = icmp ne ptr %37, null
  br i1 %38, label %39, label %46

39:                                               ; preds = %22
  %40 = getelementptr inbounds %"class.System::Event", ptr %5, i32 0, i32 3
  %41 = load ptr, ptr %40, align 8, !tbaa !23
  %42 = getelementptr inbounds %"struct.System::(anonymous namespace)::EventWaiter", ptr %41, i32 0, i32 2
  store ptr %3, ptr %42, align 8, !tbaa !18
  %43 = getelementptr inbounds %"class.System::Event", ptr %5, i32 0, i32 3
  %44 = load ptr, ptr %43, align 8, !tbaa !23
  %45 = getelementptr inbounds %"struct.System::(anonymous namespace)::EventWaiter", ptr %3, i32 0, i32 1
  store ptr %44, ptr %45, align 8, !tbaa !17
  br label %48

46:                                               ; preds = %22
  %47 = getelementptr inbounds %"class.System::Event", ptr %5, i32 0, i32 2
  store ptr %3, ptr %47, align 8, !tbaa !22
  br label %48

48:                                               ; preds = %46, %39
  %49 = getelementptr inbounds %"class.System::Event", ptr %5, i32 0, i32 3
  store ptr %3, ptr %49, align 8, !tbaa !23
  %50 = getelementptr inbounds %"class.System::Event", ptr %5, i32 0, i32 0
  %51 = load ptr, ptr %50, align 8, !tbaa !9
  call void @_ZN6System10Dispatcher8dispatchEv(ptr noundef nonnull align 16 dereferenceable(440) %51)
  %52 = getelementptr inbounds %"struct.System::(anonymous namespace)::EventWaiter", ptr %3, i32 0, i32 3
  %53 = load ptr, ptr %52, align 8, !tbaa !19
  %54 = getelementptr inbounds %"class.System::Event", ptr %5, i32 0, i32 0
  %55 = load ptr, ptr %54, align 8, !tbaa !9
  %56 = call noundef ptr @_ZNK6System10Dispatcher17getCurrentContextEv(ptr noundef nonnull align 16 dereferenceable(440) %55)
  %57 = icmp eq ptr %53, %56
  br i1 %57, label %58, label %59

58:                                               ; preds = %48
  br label %61

59:                                               ; preds = %48
  call void @__assert_fail(ptr noundef @.str.4, ptr noundef @.str.1, i32 noundef 157, ptr noundef @__PRETTY_FUNCTION__._ZN6System5Event4waitEv) #8
  unreachable

60:                                               ; No predecessors!
  br label %61

61:                                               ; preds = %60, %58
  %62 = getelementptr inbounds %"struct.System::(anonymous namespace)::EventWaiter", ptr %3, i32 0, i32 3
  %63 = load ptr, ptr %62, align 8, !tbaa !19
  %64 = getelementptr inbounds %"struct.System::NativeContext", ptr %63, i32 0, i32 9
  %65 = call noundef zeroext i1 @_ZSteqIvJEEbRKSt8functionIFT_DpT0_EEDn(ptr noundef nonnull align 8 dereferenceable(32) %64, ptr null) #9
  br i1 %65, label %66, label %67

66:                                               ; preds = %61
  br label %69

67:                                               ; preds = %61
  call void @__assert_fail(ptr noundef @.str.5, ptr noundef @.str.1, i32 noundef 158, ptr noundef @__PRETTY_FUNCTION__._ZN6System5Event4waitEv) #8
  unreachable

68:                                               ; No predecessors!
  br label %69

69:                                               ; preds = %68, %66
  %70 = getelementptr inbounds %"class.System::Event", ptr %5, i32 0, i32 0
  %71 = load ptr, ptr %70, align 8, !tbaa !9
  %72 = icmp ne ptr %71, null
  br i1 %72, label %73, label %74

73:                                               ; preds = %69
  br label %76

74:                                               ; preds = %69
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 159, ptr noundef @__PRETTY_FUNCTION__._ZN6System5Event4waitEv) #8
  unreachable

75:                                               ; No predecessors!
  br label %76

76:                                               ; preds = %75, %73
  %77 = getelementptr inbounds %"struct.System::(anonymous namespace)::EventWaiter", ptr %3, i32 0, i32 0
  %78 = load i8, ptr %77, align 8, !tbaa !15, !range !13, !noundef !14
  %79 = trunc i8 %78 to i1
  br i1 %79, label %80, label %82

80:                                               ; preds = %76
  %81 = call ptr @__cxa_allocate_exception(i64 8) #9
  call void @llvm.memset.p0.i64(ptr align 16 %81, i8 0, i64 8, i1 false)
  call void @_ZN6System20InterruptedExceptionC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %81) #9
  call void @__cxa_throw(ptr %81, ptr @_ZTIN6System20InterruptedExceptionE, ptr @_ZNSt9exceptionD2Ev) #10
  unreachable

82:                                               ; preds = %76
  call void @llvm.lifetime.end.p0(i64 32, ptr %3) #9
  br label %83

83:                                               ; preds = %82, %18
  ret void
}

declare noundef zeroext i1 @_ZN6System10Dispatcher11interruptedEv(ptr noundef nonnull align 16 dereferenceable(440)) #3

declare ptr @__cxa_allocate_exception(i64)

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN6System20InterruptedExceptionC2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #5 align 2

; Function Attrs: nounwind
declare void @_ZNSt9exceptionD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #6

declare void @__cxa_throw(ptr, ptr, ptr)

declare noundef ptr @_ZNK6System10Dispatcher17getCurrentContextEv(ptr noundef nonnull align 16 dereferenceable(440)) #3

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef nonnull align 8 dereferenceable(32) ptr @"_ZNSt8functionIFvvEEaSIZN6System5Event4waitEvE3$_0EENSt9enable_ifIXsrNS1_9_CallableIT_NS6_IXntsr7is_sameINSt9remove_cvINSt16remove_referenceIS8_E4typeEE4typeES1_EE5valueESt5decayIS8_EE4type4typeESt15__invoke_resultIRSJ_JEEEE5valueERS1_E4typeEOS8_"(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(16)) #7 align 2

declare void @_ZN6System10Dispatcher8dispatchEv(ptr noundef nonnull align 16 dereferenceable(440)) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZSteqIvJEEbRKSt8functionIFT_DpT0_EEDn(ptr noundef nonnull align 8 dereferenceable(32), ptr) #5

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { "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 nounwind willreturn memory(argmem: write) }
attributes #5 = { 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 #6 = { 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 #7 = { 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 #8 = { noreturn nounwind }
attributes #9 = { nounwind }
attributes #10 = { noreturn }

!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 = !{!"_ZTSN6System5EventE", !6, i64 0, !11, i64 8, !6, i64 16, !6, i64 24}
!11 = !{!"bool", !7, i64 0}
!12 = !{!10, !11, i64 8}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!16, !11, i64 0}
!16 = !{!"_ZTSN6System12_GLOBAL__N_111EventWaiterE", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!17 = !{!16, !6, i64 8}
!18 = !{!16, !6, i64 16}
!19 = !{!16, !6, i64 24}
!20 = !{!21, !6, i64 8}
!21 = !{!"_ZTSZN6System5Event4waitEvE3$_0", !6, i64 0, !6, i64 8}
!22 = !{!10, !6, i64 16}
!23 = !{!10, !6, i64 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.System::(anonymous namespace)::EventWaiter" = type { i8, ptr, ptr, ptr }
%class.anon = type { ptr, ptr }

@.str.1 = external hidden unnamed_addr constant [70 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [22 x i8], align 1
@__PRETTY_FUNCTION__._ZN6System5Event4waitEv = external hidden unnamed_addr constant [27 x i8], align 1
@_ZTIN6System20InterruptedExceptionE = external dso_local constant { ptr, ptr, ptr }, align 8
@.str.4 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [46 x i8], align 1

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6System5Event4waitEv(ptr noundef nonnull align 8 dereferenceable(32) %0) local_unnamed_addr #2 align 2 {
  %2 = alloca %"struct.System::(anonymous namespace)::EventWaiter", align 8
  %3 = alloca %class.anon, align 8
  %4 = load ptr, ptr %0, align 8, !tbaa !5
  %.not = icmp eq ptr %4, null
  br i1 %.not, label %5, label %6

5:                                                ; preds = %1
  tail call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i32 noundef 119, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN6System5Event4waitEv) #8
  unreachable

6:                                                ; preds = %1
  %7 = tail call noundef zeroext i1 @_ZN6System10Dispatcher11interruptedEv(ptr noundef nonnull align 16 dereferenceable(440) %4)
  br i1 %7, label %8, label %10

8:                                                ; preds = %6
  %9 = tail call ptr @__cxa_allocate_exception(i64 8) #9
  store i64 0, ptr %9, align 16
  tail call void @_ZN6System20InterruptedExceptionC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %9) #9
  tail call void @__cxa_throw(ptr nonnull %9, ptr nonnull @_ZTIN6System20InterruptedExceptionE, ptr nonnull @_ZNSt9exceptionD2Ev) #10
  unreachable

10:                                               ; preds = %6
  %11 = getelementptr inbounds i8, ptr %0, i64 8
  %12 = load i8, ptr %11, align 8, !tbaa !11, !range !12, !noundef !13
  %13 = trunc nuw i8 %12 to i1
  br i1 %13, label %51, label %14

14:                                               ; preds = %10
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %2) #9
  store i8 0, ptr %2, align 8, !tbaa !14
  %15 = getelementptr inbounds i8, ptr %2, i64 8
  %16 = getelementptr inbounds i8, ptr %2, i64 24
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %15, i8 0, i64 16, i1 false)
  %17 = load ptr, ptr %0, align 8, !tbaa !5
  %18 = tail call noundef ptr @_ZNK6System10Dispatcher17getCurrentContextEv(ptr noundef nonnull align 16 dereferenceable(440) %17)
  store ptr %18, ptr %16, align 8, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #9
  store ptr %2, ptr %3, align 8, !tbaa !17
  %19 = getelementptr inbounds i8, ptr %3, i64 8
  store ptr %0, ptr %19, align 8, !tbaa !18
  %20 = getelementptr inbounds i8, ptr %18, i64 88
  %21 = call noundef nonnull align 8 dereferenceable(32) ptr @"_ZNSt8functionIFvvEEaSIZN6System5Event4waitEvE3$_0EENSt9enable_ifIXsrNS1_9_CallableIT_NS6_IXntsr7is_sameINSt9remove_cvINSt16remove_referenceIS8_E4typeEE4typeES1_EE5valueESt5decayIS8_EE4type4typeESt15__invoke_resultIRSJ_JEEEE5valueERS1_E4typeEOS8_"(ptr noundef nonnull align 8 dereferenceable(32) %20, ptr noundef nonnull align 8 dereferenceable(16) %3) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #9
  %22 = getelementptr inbounds i8, ptr %0, i64 16
  %23 = load ptr, ptr %22, align 8, !tbaa !20
  %.not1 = icmp eq ptr %23, null
  br i1 %.not1, label %28, label %24

24:                                               ; preds = %14
  %25 = getelementptr inbounds i8, ptr %0, i64 24
  %26 = load ptr, ptr %25, align 8, !tbaa !21
  %27 = getelementptr inbounds i8, ptr %26, i64 16
  store ptr %2, ptr %27, align 8, !tbaa !22
  store ptr %26, ptr %15, align 8, !tbaa !23
  br label %29

28:                                               ; preds = %14
  store ptr %2, ptr %22, align 8, !tbaa !20
  br label %29

29:                                               ; preds = %28, %24
  %30 = getelementptr inbounds i8, ptr %0, i64 24
  store ptr %2, ptr %30, align 8, !tbaa !21
  %31 = load ptr, ptr %0, align 8, !tbaa !5
  call void @_ZN6System10Dispatcher8dispatchEv(ptr noundef nonnull align 16 dereferenceable(440) %31)
  %32 = load ptr, ptr %16, align 8, !tbaa !16
  %33 = load ptr, ptr %0, align 8, !tbaa !5
  %34 = call noundef ptr @_ZNK6System10Dispatcher17getCurrentContextEv(ptr noundef nonnull align 16 dereferenceable(440) %33)
  %35 = icmp eq ptr %32, %34
  br i1 %35, label %37, label %36

36:                                               ; preds = %29
  call void @__assert_fail(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.1, i32 noundef 157, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN6System5Event4waitEv) #8
  unreachable

37:                                               ; preds = %29
  %38 = load ptr, ptr %16, align 8, !tbaa !16
  %39 = getelementptr inbounds i8, ptr %38, i64 88
  %40 = call noundef zeroext i1 @_ZSteqIvJEEbRKSt8functionIFT_DpT0_EEDn(ptr noundef nonnull align 8 dereferenceable(32) %39, ptr null) #9
  br i1 %40, label %42, label %41

41:                                               ; preds = %37
  call void @__assert_fail(ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.1, i32 noundef 158, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN6System5Event4waitEv) #8
  unreachable

42:                                               ; preds = %37
  %43 = load ptr, ptr %0, align 8, !tbaa !5
  %.not2 = icmp eq ptr %43, null
  br i1 %.not2, label %44, label %45

44:                                               ; preds = %42
  call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i32 noundef 159, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN6System5Event4waitEv) #8
  unreachable

45:                                               ; preds = %42
  %46 = load i8, ptr %2, align 8, !tbaa !14, !range !12, !noundef !13
  %47 = trunc nuw i8 %46 to i1
  br i1 %47, label %48, label %50

48:                                               ; preds = %45
  %49 = call ptr @__cxa_allocate_exception(i64 8) #9
  store i64 0, ptr %49, align 16
  call void @_ZN6System20InterruptedExceptionC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %49) #9
  call void @__cxa_throw(ptr nonnull %49, ptr nonnull @_ZTIN6System20InterruptedExceptionE, ptr nonnull @_ZNSt9exceptionD2Ev) #10
  unreachable

50:                                               ; preds = %45
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %2) #9
  br label %51

51:                                               ; preds = %50, %10
  ret void
}

declare noundef zeroext i1 @_ZN6System10Dispatcher11interruptedEv(ptr noundef nonnull align 16 dereferenceable(440)) local_unnamed_addr #3

declare ptr @__cxa_allocate_exception(i64) local_unnamed_addr

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN6System20InterruptedExceptionC2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #5 align 2

; Function Attrs: nounwind
declare void @_ZNSt9exceptionD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #6

declare void @__cxa_throw(ptr, ptr, ptr) local_unnamed_addr

declare noundef ptr @_ZNK6System10Dispatcher17getCurrentContextEv(ptr noundef nonnull align 16 dereferenceable(440)) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef nonnull align 8 dereferenceable(32) ptr @"_ZNSt8functionIFvvEEaSIZN6System5Event4waitEvE3$_0EENSt9enable_ifIXsrNS1_9_CallableIT_NS6_IXntsr7is_sameINSt9remove_cvINSt16remove_referenceIS8_E4typeEE4typeES1_EE5valueESt5decayIS8_EE4type4typeESt15__invoke_resultIRSJ_JEEEE5valueERS1_E4typeEOS8_"(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #7 align 2

declare void @_ZN6System10Dispatcher8dispatchEv(ptr noundef nonnull align 16 dereferenceable(440)) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZSteqIvJEEbRKSt8functionIFT_DpT0_EEDn(ptr noundef nonnull align 8 dereferenceable(32), ptr) local_unnamed_addr #5

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { "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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { 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 #6 = { 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 #7 = { 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 #8 = { noreturn nounwind }
attributes #9 = { nounwind }
attributes #10 = { noreturn }

!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 = !{!"_ZTSN6System5EventE", !7, i64 0, !10, i64 8, !7, i64 16, !7, i64 24}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"bool", !8, i64 0}
!11 = !{!6, !10, i64 8}
!12 = !{i8 0, i8 2}
!13 = !{}
!14 = !{!15, !10, i64 0}
!15 = !{!"_ZTSN6System12_GLOBAL__N_111EventWaiterE", !10, i64 0, !7, i64 8, !7, i64 16, !7, i64 24}
!16 = !{!15, !7, i64 24}
!17 = !{!7, !7, i64 0}
!18 = !{!19, !7, i64 8}
!19 = !{!"_ZTSZN6System5Event4waitEvE3$_0", !7, i64 0, !7, i64 8}
!20 = !{!6, !7, i64 16}
!21 = !{!6, !7, i64 24}
!22 = !{!15, !7, i64 16}
!23 = !{!15, !7, i64 8}


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