; LLVM IR from kacperks/Fractal_Engine :: Engine/Thirdparty/cmake/Engine/Thirdparty/cmake/openal-soft/al (event)

; 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.al::intrusive_ptr.48" = type { ptr }
%class.anon = type { ptr }
%"class.std::lock_guard" = type { ptr }
%struct.ContextBase = type { ptr, %"struct.std::atomic", %"struct.std::atomic.0", %"struct.std::atomic.0", float, %"struct.std::atomic.2", %"struct.std::atomic.4", %"struct.std::atomic.6", %"struct.std::atomic.8", ptr, %"struct.std::atomic.10", [8 x i8], %struct.ContextParams, %"struct.std::atomic.13", %"struct.std::atomic.15", %"struct.std::atomic.17", %"class.std::thread", %"class.al::semaphore", %"class.std::unique_ptr", %"struct.std::atomic", %"class.std::vector", %"class.std::vector.21" }
%"struct.std::atomic.0" = type { %"struct.std::__atomic_base.1" }
%"struct.std::__atomic_base.1" = type { i8 }
%"struct.std::atomic.2" = type { %"struct.std::__atomic_base.3" }
%"struct.std::__atomic_base.3" = type { ptr }
%"struct.std::atomic.4" = type { %"struct.std::__atomic_base.5" }
%"struct.std::__atomic_base.5" = type { ptr }
%"struct.std::atomic.6" = type { %"struct.std::__atomic_base.7" }
%"struct.std::__atomic_base.7" = type { ptr }
%"struct.std::atomic.8" = type { %"struct.std::__atomic_base.9" }
%"struct.std::__atomic_base.9" = type { ptr }
%"struct.std::atomic.10" = type { %"struct.std::__atomic_base.11" }
%"struct.std::__atomic_base.11" = type { ptr }
%struct.ContextParams = type <{ %"struct.std::atomic.2", %"struct.std::atomic.4", %"class.alu::VectorR", %"class.alu::MatrixR", %"class.alu::VectorR", float, float, float, float, i8, i8, [14 x i8] }>
%"class.alu::MatrixR" = type { %"struct.std::array.12" }
%"struct.std::array.12" = type { [16 x float] }
%"class.alu::VectorR" = type { %"struct.std::array" }
%"struct.std::array" = type { [4 x float] }
%"struct.std::atomic.13" = type { %"struct.std::__atomic_base.14" }
%"struct.std::__atomic_base.14" = type { ptr }
%"struct.std::atomic.15" = type { %"struct.std::__atomic_base.16" }
%"struct.std::__atomic_base.16" = type { i64 }
%"struct.std::atomic.17" = type { %"struct.std::__atomic_base.18" }
%"struct.std::__atomic_base.18" = type { ptr }
%"class.std::thread" = type { %"class.std::thread::id" }
%"class.std::thread::id" = type { i64 }
%"class.al::semaphore" = type { %union.sem_t }
%union.sem_t = type { i64, [24 x i8] }
%"class.std::unique_ptr" = type { %"struct.std::__uniq_ptr_data" }
%"struct.std::__uniq_ptr_data" = type { %"class.std::__uniq_ptr_impl" }
%"class.std::__uniq_ptr_impl" = type { %"class.std::tuple" }
%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Head_base.20" }
%"struct.std::_Head_base.20" = type { ptr }
%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i32 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::unique_ptr<VoiceChange[]>, al::allocator<std::unique_ptr<VoiceChange[]>, 8>>::_Vector_impl" }
%"struct.std::_Vector_base<std::unique_ptr<VoiceChange[]>, al::allocator<std::unique_ptr<VoiceChange[]>, 8>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::unique_ptr<VoiceChange[]>, al::allocator<std::unique_ptr<VoiceChange[]>, 8>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::unique_ptr<VoiceChange[]>, al::allocator<std::unique_ptr<VoiceChange[]>, 8>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.21" = type { %"struct.std::_Vector_base.22" }
%"struct.std::_Vector_base.22" = type { %"struct.std::_Vector_base<std::unique_ptr<Voice[]>, al::allocator<std::unique_ptr<Voice[]>, 8>>::_Vector_impl" }
%"struct.std::_Vector_base<std::unique_ptr<Voice[]>, al::allocator<std::unique_ptr<Voice[]>, 8>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::unique_ptr<Voice[]>, al::allocator<std::unique_ptr<Voice[]>, 8>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::unique_ptr<Voice[]>, al::allocator<std::unique_ptr<Voice[]>, 8>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.ALCcontext = type { %"class.al::intrusive_ref", [12 x i8], %struct.ContextBase, %"class.al::intrusive_ptr", %"class.std::vector.25", %"struct.al::atomic_invflag", %"struct.std::atomic.0", %"class.std::mutex", %"struct.std::atomic.29", i8, i8, float, float, float, %"class.std::mutex", ptr, ptr, %struct.ALlistener, %"class.std::vector.32", i32, %"class.std::mutex", %"class.std::vector.36", i32, %"class.std::mutex", %"class.std::unique_ptr.40", ptr }
%"class.al::intrusive_ref" = type { %"struct.std::atomic" }
%"class.al::intrusive_ptr" = type { ptr }
%"class.std::vector.25" = type { %"struct.std::_Vector_base.26" }
%"struct.std::_Vector_base.26" = type { %"struct.std::_Vector_base<std::unique_ptr<WetBuffer>, al::allocator<std::unique_ptr<WetBuffer>, 8>>::_Vector_impl" }
%"struct.std::_Vector_base<std::unique_ptr<WetBuffer>, al::allocator<std::unique_ptr<WetBuffer>, 8>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::unique_ptr<WetBuffer>, al::allocator<std::unique_ptr<WetBuffer>, 8>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::unique_ptr<WetBuffer>, al::allocator<std::unique_ptr<WetBuffer>, 8>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.al::atomic_invflag" = type { %"struct.std::atomic_flag" }
%"struct.std::atomic_flag" = type { %"struct.std::__atomic_flag_base" }
%"struct.std::__atomic_flag_base" = type { i8 }
%"struct.std::atomic.29" = type { %"struct.std::__atomic_base.30" }
%"struct.std::__atomic_base.30" = type { i32 }
%struct.ALlistener = type <{ %"struct.std::array.31", %"struct.std::array.31", %"struct.std::array.31", %"struct.std::array.31", float, float, %"struct.al::atomic_invflag", [3 x i8] }>
%"struct.std::array.31" = type { [3 x float] }
%"class.std::vector.32" = type { %"struct.std::_Vector_base.33" }
%"struct.std::_Vector_base.33" = type { %"struct.std::_Vector_base<SourceSubList, al::allocator<SourceSubList, 8>>::_Vector_impl" }
%"struct.std::_Vector_base<SourceSubList, al::allocator<SourceSubList, 8>>::_Vector_impl" = type { %"struct.std::_Vector_base<SourceSubList, al::allocator<SourceSubList, 8>>::_Vector_impl_data" }
%"struct.std::_Vector_base<SourceSubList, al::allocator<SourceSubList, 8>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.36" = type { %"struct.std::_Vector_base.37" }
%"struct.std::_Vector_base.37" = type { %"struct.std::_Vector_base<EffectSlotSubList, al::allocator<EffectSlotSubList, 8>>::_Vector_impl" }
%"struct.std::_Vector_base<EffectSlotSubList, al::allocator<EffectSlotSubList, 8>>::_Vector_impl" = type { %"struct.std::_Vector_base<EffectSlotSubList, al::allocator<EffectSlotSubList, 8>>::_Vector_impl_data" }
%"struct.std::_Vector_base<EffectSlotSubList, al::allocator<EffectSlotSubList, 8>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::mutex" = type { %"class.std::__mutex_base" }
%"class.std::__mutex_base" = type { %union.pthread_mutex_t }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%"class.std::unique_ptr.40" = type { %"struct.std::__uniq_ptr_data.41" }
%"struct.std::__uniq_ptr_data.41" = type { %"class.std::__uniq_ptr_impl.42" }
%"class.std::__uniq_ptr_impl.42" = type { %"class.std::tuple.43" }
%"class.std::tuple.43" = type { %"struct.std::_Tuple_impl.44" }
%"struct.std::_Tuple_impl.44" = type { %"struct.std::_Head_base.47" }
%"struct.std::_Head_base.47" = type { ptr }

@.str.2 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [26 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

declare i32 @__gxx_personality_v0(...)

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

declare ptr @__cxa_begin_catch(ptr)

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z18alEventControlSOFTiPKic(i32 noundef %0, ptr noundef %1, i8 noundef signext %2) #1 personality ptr @__gxx_personality_v0 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i8, align 1
  %7 = alloca %"class.al::intrusive_ptr.48", align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca %class.anon, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca %"class.std::lock_guard", align 8
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  store i8 %2, ptr %6, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  invoke void @_Z13GetContextRefv(ptr dead_on_unwind writable sret(%"class.al::intrusive_ptr.48") align 8 %7)
          to label %18 unwind label %24

18:                                               ; preds = %3
  %19 = call noundef zeroext i1 @_ZNK2al13intrusive_ptrI10ALCcontextEcvbEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #7
  %20 = xor i1 %19, true
  %21 = invoke noundef zeroext i1 @_Z8unlikelyb(i1 noundef zeroext %20)
          to label %22 unwind label %28

22:                                               ; preds = %18
  br i1 %21, label %23, label %32

23:                                               ; preds = %22
  store i32 1, ptr %10, align 4
  br label %126

24:                                               ; preds = %3
  %25 = landingpad { ptr, i32 }
          catch ptr null
  %26 = extractvalue { ptr, i32 } %25, 0
  store ptr %26, ptr %8, align 8
  %27 = extractvalue { ptr, i32 } %25, 1
  store i32 %27, ptr %9, align 4
  br label %131

28:                                               ; preds = %47, %35, %18
  %29 = landingpad { ptr, i32 }
          catch ptr null
  %30 = extractvalue { ptr, i32 } %29, 0
  store ptr %30, ptr %8, align 8
  %31 = extractvalue { ptr, i32 } %29, 1
  store i32 %31, ptr %9, align 4
  br label %130

32:                                               ; preds = %22
  %33 = load i32, ptr %4, align 4, !tbaa !5
  %34 = icmp slt i32 %33, 0
  br i1 %34, label %35, label %39

35:                                               ; preds = %32
  %36 = call noundef ptr @_ZNK2al13intrusive_ptrI10ALCcontextEptEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #7
  %37 = load i32, ptr %4, align 4, !tbaa !5
  invoke void (ptr, i32, ptr, ...) @_ZN10ALCcontext8setErrorEiPKcz(ptr noundef nonnull align 16 dereferenceable(752) %36, i32 noundef 40963, ptr noundef @.str.2, i32 noundef %37)
          to label %38 unwind label %28

38:                                               ; preds = %35
  br label %39

39:                                               ; preds = %38, %32
  %40 = load i32, ptr %4, align 4, !tbaa !5
  %41 = icmp sle i32 %40, 0
  br i1 %41, label %42, label %43

42:                                               ; preds = %39
  store i32 1, ptr %10, align 4
  br label %126

43:                                               ; preds = %39
  %44 = load ptr, ptr %5, align 8, !tbaa !9
  %45 = icmp ne ptr %44, null
  br i1 %45, label %52, label %46

46:                                               ; preds = %43
  br label %47

47:                                               ; preds = %46
  %48 = call noundef ptr @_ZNK2al13intrusive_ptrI10ALCcontextEptEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #7
  invoke void (ptr, i32, ptr, ...) @_ZN10ALCcontext8setErrorEiPKcz(ptr noundef nonnull align 16 dereferenceable(752) %48, i32 noundef 40963, ptr noundef @.str.3)
          to label %49 unwind label %28

49:                                               ; preds = %47
  store i32 1, ptr %10, align 4
  br label %126

50:                                               ; No predecessors!
  br label %51

51:                                               ; preds = %50
  br label %52

52:                                               ; preds = %51, %43
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  store i32 0, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  %53 = load ptr, ptr %5, align 8, !tbaa !9
  %54 = load i32, ptr %4, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds i32, ptr %53, i64 %55
  store ptr %56, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %57 = load ptr, ptr %5, align 8, !tbaa !9
  %58 = load ptr, ptr %12, align 8, !tbaa !9
  %59 = getelementptr inbounds %class.anon, ptr %14, i32 0, i32 0
  store ptr %11, ptr %59, align 8, !tbaa !9
  %60 = getelementptr inbounds %class.anon, ptr %14, i32 0, i32 0
  %61 = load ptr, ptr %60, align 8
  %62 = invoke noundef ptr @"_ZSt11find_if_notIPKiZ18alEventControlSOFTiS1_cE3$_0ET_S3_S3_T0_"(ptr noundef %57, ptr noundef %58, ptr %61)
          to label %63 unwind label %73

63:                                               ; preds = %52
  store ptr %62, ptr %13, align 8, !tbaa !9
  %64 = load ptr, ptr %13, align 8, !tbaa !9
  %65 = load ptr, ptr %12, align 8, !tbaa !9
  %66 = icmp ne ptr %64, %65
  br i1 %66, label %67, label %79

67:                                               ; preds = %63
  br label %68

68:                                               ; preds = %67
  %69 = call noundef ptr @_ZNK2al13intrusive_ptrI10ALCcontextEptEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #7
  %70 = load ptr, ptr %13, align 8, !tbaa !9
  %71 = load i32, ptr %70, align 4, !tbaa !5
  invoke void (ptr, i32, ptr, ...) @_ZN10ALCcontext8setErrorEiPKcz(ptr noundef nonnull align 16 dereferenceable(752) %69, i32 noundef 40962, ptr noundef @.str.4, i32 noundef %71)
          to label %72 unwind label %73

72:                                               ; preds = %68
  store i32 1, ptr %10, align 4
  br label %125

73:                                               ; preds = %68, %52
  %74 = landingpad { ptr, i32 }
          catch ptr null
  %75 = extractvalue { ptr, i32 } %74, 0
  store ptr %75, ptr %8, align 8
  %76 = extractvalue { ptr, i32 } %74, 1
  store i32 %76, ptr %9, align 4
  br label %129

77:                                               ; No predecessors!
  br label %78

78:                                               ; preds = %77
  br label %79

79:                                               ; preds = %78, %63
  %80 = load i8, ptr %6, align 1, !tbaa !11
  %81 = icmp ne i8 %80, 0
  br i1 %81, label %82, label %99

82:                                               ; preds = %79
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  %83 = call noundef ptr @_ZNK2al13intrusive_ptrI10ALCcontextEptEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #7
  %84 = getelementptr inbounds i8, ptr %83, i64 16
  %85 = getelementptr inbounds %struct.ContextBase, ptr %84, i32 0, i32 19
  %86 = call noundef i32 @_ZNKSt13__atomic_baseIjE4loadESt12memory_order(ptr noundef nonnull align 4 dereferenceable(4) %85, i32 noundef 0) #7
  store i32 %86, ptr %15, align 4, !tbaa !5
  br label %87

87:                                               ; preds = %97, %82
  %88 = call noundef ptr @_ZNK2al13intrusive_ptrI10ALCcontextEptEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #7
  %89 = getelementptr inbounds i8, ptr %88, i64 16
  %90 = getelementptr inbounds %struct.ContextBase, ptr %89, i32 0, i32 19
  %91 = load i32, ptr %15, align 4, !tbaa !5
  %92 = load i32, ptr %11, align 4, !tbaa !5
  %93 = or i32 %91, %92
  %94 = call noundef zeroext i1 @_ZNSt13__atomic_baseIjE21compare_exchange_weakERjjSt12memory_orderS2_(ptr noundef nonnull align 4 dereferenceable(4) %90, ptr noundef nonnull align 4 dereferenceable(4) %15, i32 noundef %93, i32 noundef 4, i32 noundef 2) #7
  %95 = zext i1 %94 to i32
  %96 = icmp eq i32 %95, 0
  br i1 %96, label %97, label %98

97:                                               ; preds = %87
  br label %87, !llvm.loop !12

98:                                               ; preds = %87
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  br label %124

99:                                               ; preds = %79
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  %100 = call noundef ptr @_ZNK2al13intrusive_ptrI10ALCcontextEptEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #7
  %101 = getelementptr inbounds i8, ptr %100, i64 16
  %102 = getelementptr inbounds %struct.ContextBase, ptr %101, i32 0, i32 19
  %103 = call noundef i32 @_ZNKSt13__atomic_baseIjE4loadESt12memory_order(ptr noundef nonnull align 4 dereferenceable(4) %102, i32 noundef 0) #7
  store i32 %103, ptr %16, align 4, !tbaa !5
  br label %104

104:                                              ; preds = %115, %99
  %105 = call noundef ptr @_ZNK2al13intrusive_ptrI10ALCcontextEptEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #7
  %106 = getelementptr inbounds i8, ptr %105, i64 16
  %107 = getelementptr inbounds %struct.ContextBase, ptr %106, i32 0, i32 19
  %108 = load i32, ptr %16, align 4, !tbaa !5
  %109 = load i32, ptr %11, align 4, !tbaa !5
  %110 = xor i32 %109, -1
  %111 = and i32 %108, %110
  %112 = call noundef zeroext i1 @_ZNSt13__atomic_baseIjE21compare_exchange_weakERjjSt12memory_orderS2_(ptr noundef nonnull align 4 dereferenceable(4) %107, ptr noundef nonnull align 4 dereferenceable(4) %16, i32 noundef %111, i32 noundef 4, i32 noundef 2) #7
  %113 = zext i1 %112 to i32
  %114 = icmp eq i32 %113, 0
  br i1 %114, label %115, label %116

115:                                              ; preds = %104
  br label %104, !llvm.loop !14

116:                                              ; preds = %104
  %117 = call noundef ptr @_ZNK2al13intrusive_ptrI10ALCcontextEptEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #7
  %118 = getelementptr inbounds %struct.ALCcontext, ptr %117, i32 0, i32 14
  invoke void @_ZNSt10lock_guardISt5mutexEC2ERS0_(ptr noundef nonnull align 8 dereferenceable(8) %17, ptr noundef nonnull align 8 dereferenceable(40) %118)
          to label %119 unwind label %120

119:                                              ; preds = %116
  call void @_ZNSt10lock_guardISt5mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %17) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  br label %124

120:                                              ; preds = %116
  %121 = landingpad { ptr, i32 }
          catch ptr null
  %122 = extractvalue { ptr, i32 } %121, 0
  store ptr %122, ptr %8, align 8
  %123 = extractvalue { ptr, i32 } %121, 1
  store i32 %123, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  br label %129

124:                                              ; preds = %119, %98
  store i32 0, ptr %10, align 4
  br label %125

125:                                              ; preds = %124, %72
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %126

126:                                              ; preds = %125, %49, %42, %23
  call void @_ZN2al13intrusive_ptrI10ALCcontextED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  %127 = load i32, ptr %10, align 4
  switch i32 %127, label %136 [
    i32 0, label %128
    i32 1, label %135
  ]

128:                                              ; preds = %126
  br label %135

129:                                              ; preds = %120, %73
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %130

130:                                              ; preds = %129, %28
  call void @_ZN2al13intrusive_ptrI10ALCcontextED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %7) #7
  br label %131

131:                                              ; preds = %130, %24
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  br label %132

132:                                              ; preds = %131
  %133 = load ptr, ptr %8, align 8
  %134 = call ptr @__cxa_begin_catch(ptr %133) #7
  call void @_ZSt9terminatev() #8
  unreachable

135:                                              ; preds = %128, %126
  ret void

136:                                              ; preds = %126
  unreachable
}

declare void @_Z13GetContextRefv(ptr dead_on_unwind writable sret(%"class.al::intrusive_ptr.48") align 8) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z8unlikelyb(i1 noundef zeroext) #1

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

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

declare void @_ZN10ALCcontext8setErrorEiPKcz(ptr noundef nonnull align 16 dereferenceable(752), i32 noundef, ptr noundef, ...) #2

; Function Attrs: inlinehint mustprogress uwtable
declare hidden noundef ptr @"_ZSt11find_if_notIPKiZ18alEventControlSOFTiS1_cE3$_0ET_S3_S3_T0_"(ptr noundef, ptr noundef, ptr) #3

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNKSt13__atomic_baseIjE4loadESt12memory_order(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef) #4 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNSt13__atomic_baseIjE21compare_exchange_weakERjjSt12memory_orderS2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), i32 noundef, i32 noundef, i32 noundef) #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt10lock_guardISt5mutexEC2ERS0_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #5 align 2

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

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

; Function Attrs: noreturn nounwind
declare void @_ZSt9terminatev() #6

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { "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 = { 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 #4 = { alwaysinline 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 #5 = { 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 #6 = { 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 #7 = { nounwind }
attributes #8 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}


; 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.al::intrusive_ptr.48" = type { ptr }
%"class.std::lock_guard" = type { ptr }

@.str.2 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [26 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

declare i32 @__gxx_personality_v0(...)

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

declare ptr @__cxa_begin_catch(ptr) local_unnamed_addr

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z18alEventControlSOFTiPKic(i32 noundef %0, ptr noundef %1, i8 noundef signext %2) local_unnamed_addr #1 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"class.al::intrusive_ptr.48", align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca %"class.std::lock_guard", align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  invoke void @_Z13GetContextRefv(ptr dead_on_unwind nonnull writable sret(%"class.al::intrusive_ptr.48") align 8 %4)
          to label %9 unwind label %13

9:                                                ; preds = %3
  %10 = call noundef zeroext i1 @_ZNK2al13intrusive_ptrI10ALCcontextEcvbEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #7
  %11 = xor i1 %10, true
  %12 = call noundef zeroext i1 @_Z8unlikelyb(i1 noundef zeroext %11)
  br i1 %12, label %.thread, label %17

13:                                               ; preds = %3
  %14 = landingpad { ptr, i32 }
          catch ptr null
  br label %70

15:                                               ; preds = %24, %19
  %16 = landingpad { ptr, i32 }
          catch ptr null
  br label %69

17:                                               ; preds = %9
  %18 = icmp slt i32 %0, 0
  br i1 %18, label %19, label %21

19:                                               ; preds = %17
  %20 = call noundef ptr @_ZNK2al13intrusive_ptrI10ALCcontextEptEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #7
  invoke void (ptr, i32, ptr, ...) @_ZN10ALCcontext8setErrorEiPKcz(ptr noundef nonnull align 16 dereferenceable(752) %20, i32 noundef 40963, ptr noundef nonnull @.str.2, i32 noundef %0)
          to label %.thread unwind label %15

21:                                               ; preds = %17
  %22 = icmp eq i32 %0, 0
  br i1 %22, label %.thread, label %23

23:                                               ; preds = %21
  %.not = icmp eq ptr %1, null
  br i1 %.not, label %24, label %26

24:                                               ; preds = %23
  %25 = call noundef ptr @_ZNK2al13intrusive_ptrI10ALCcontextEptEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #7
  invoke void (ptr, i32, ptr, ...) @_ZN10ALCcontext8setErrorEiPKcz(ptr noundef nonnull align 16 dereferenceable(752) %25, i32 noundef 40963, ptr noundef nonnull @.str.3)
          to label %.thread unwind label %15

26:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #7
  store i32 0, ptr %5, align 4, !tbaa !5
  %27 = zext nneg i32 %0 to i64
  %28 = getelementptr inbounds i32, ptr %1, i64 %27
  %29 = invoke noundef ptr @"_ZSt11find_if_notIPKiZ18alEventControlSOFTiS1_cE3$_0ET_S3_S3_T0_"(ptr noundef nonnull %1, ptr noundef nonnull %28, ptr nonnull %5)
          to label %30 unwind label %34

30:                                               ; preds = %26
  %.not16 = icmp eq ptr %29, %28
  br i1 %.not16, label %36, label %31

31:                                               ; preds = %30
  %32 = call noundef ptr @_ZNK2al13intrusive_ptrI10ALCcontextEptEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #7
  %33 = load i32, ptr %29, align 4, !tbaa !5
  invoke void (ptr, i32, ptr, ...) @_ZN10ALCcontext8setErrorEiPKcz(ptr noundef nonnull align 16 dereferenceable(752) %32, i32 noundef 40962, ptr noundef nonnull @.str.4, i32 noundef %33)
          to label %67 unwind label %34

34:                                               ; preds = %31, %26
  %35 = landingpad { ptr, i32 }
          catch ptr null
  br label %68

36:                                               ; preds = %30
  %.not17 = icmp eq i8 %2, 0
  br i1 %.not17, label %49, label %37

37:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #7
  %38 = call noundef ptr @_ZNK2al13intrusive_ptrI10ALCcontextEptEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #7
  %39 = getelementptr inbounds i8, ptr %38, i64 312
  %40 = call noundef i32 @_ZNKSt13__atomic_baseIjE4loadESt12memory_order(ptr noundef nonnull align 4 dereferenceable(4) %39, i32 noundef 0) #7
  store i32 %40, ptr %6, align 4, !tbaa !5
  br label %41

41:                                               ; preds = %41, %37
  %42 = call noundef ptr @_ZNK2al13intrusive_ptrI10ALCcontextEptEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #7
  %43 = getelementptr inbounds i8, ptr %42, i64 312
  %44 = load i32, ptr %6, align 4, !tbaa !5
  %45 = load i32, ptr %5, align 4, !tbaa !5
  %46 = or i32 %45, %44
  %47 = call noundef zeroext i1 @_ZNSt13__atomic_baseIjE21compare_exchange_weakERjjSt12memory_orderS2_(ptr noundef nonnull align 4 dereferenceable(4) %43, ptr noundef nonnull align 4 dereferenceable(4) %6, i32 noundef %46, i32 noundef 4, i32 noundef 2) #7
  br i1 %47, label %48, label %41, !llvm.loop !9

48:                                               ; preds = %41
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #7
  br label %67

49:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #7
  %50 = call noundef ptr @_ZNK2al13intrusive_ptrI10ALCcontextEptEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #7
  %51 = getelementptr inbounds i8, ptr %50, i64 312
  %52 = call noundef i32 @_ZNKSt13__atomic_baseIjE4loadESt12memory_order(ptr noundef nonnull align 4 dereferenceable(4) %51, i32 noundef 0) #7
  store i32 %52, ptr %7, align 4, !tbaa !5
  br label %53

53:                                               ; preds = %53, %49
  %54 = call noundef ptr @_ZNK2al13intrusive_ptrI10ALCcontextEptEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #7
  %55 = getelementptr inbounds i8, ptr %54, i64 312
  %56 = load i32, ptr %7, align 4, !tbaa !5
  %57 = load i32, ptr %5, align 4, !tbaa !5
  %58 = xor i32 %57, -1
  %59 = and i32 %56, %58
  %60 = call noundef zeroext i1 @_ZNSt13__atomic_baseIjE21compare_exchange_weakERjjSt12memory_orderS2_(ptr noundef nonnull align 4 dereferenceable(4) %55, ptr noundef nonnull align 4 dereferenceable(4) %7, i32 noundef %59, i32 noundef 4, i32 noundef 2) #7
  br i1 %60, label %61, label %53, !llvm.loop !11

61:                                               ; preds = %53
  %62 = call noundef ptr @_ZNK2al13intrusive_ptrI10ALCcontextEptEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #7
  %63 = getelementptr inbounds i8, ptr %62, i64 472
  invoke void @_ZNSt10lock_guardISt5mutexEC2ERS0_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(40) %63)
          to label %64 unwind label %65

64:                                               ; preds = %61
  call void @_ZNSt10lock_guardISt5mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #7
  br label %67

65:                                               ; preds = %61
  %66 = landingpad { ptr, i32 }
          catch ptr null
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #7
  br label %68

67:                                               ; preds = %48, %64, %31
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #7
  br label %.thread

.thread:                                          ; preds = %19, %24, %21, %9, %67
  call void @_ZN2al13intrusive_ptrI10ALCcontextED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  ret void

68:                                               ; preds = %65, %34
  %.pn = phi { ptr, i32 } [ %35, %34 ], [ %66, %65 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #7
  br label %69

69:                                               ; preds = %68, %15
  %.pn.pn = phi { ptr, i32 } [ %.pn, %68 ], [ %16, %15 ]
  call void @_ZN2al13intrusive_ptrI10ALCcontextED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #7
  br label %70

70:                                               ; preds = %69, %13
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %69 ], [ %14, %13 ]
  %.2 = extractvalue { ptr, i32 } %.pn.pn.pn, 0
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  %71 = call ptr @__cxa_begin_catch(ptr %.2) #7
  call void @_ZSt9terminatev() #8
  unreachable
}

declare void @_Z13GetContextRefv(ptr dead_on_unwind writable sret(%"class.al::intrusive_ptr.48") align 8) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z8unlikelyb(i1 noundef zeroext) local_unnamed_addr #1

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

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

declare void @_ZN10ALCcontext8setErrorEiPKcz(ptr noundef nonnull align 16 dereferenceable(752), i32 noundef, ptr noundef, ...) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress uwtable
declare hidden noundef ptr @"_ZSt11find_if_notIPKiZ18alEventControlSOFTiS1_cE3$_0ET_S3_S3_T0_"(ptr noundef, ptr noundef, ptr) local_unnamed_addr #3

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNKSt13__atomic_baseIjE4loadESt12memory_order(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef) local_unnamed_addr #4 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNSt13__atomic_baseIjE21compare_exchange_weakERjjSt12memory_orderS2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt10lock_guardISt5mutexEC2ERS0_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #5 align 2

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

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

; Function Attrs: noreturn nounwind
declare void @_ZSt9terminatev() local_unnamed_addr #6

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { "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 = { 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 #4 = { alwaysinline 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 #5 = { 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 #6 = { 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 #7 = { nounwind }
attributes #8 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}


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