; LLVM IR from tevador/RandomX :: src (randomx)

; 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.randomx_cache = type { ptr, ptr, ptr, ptr, ptr, [8 x %"class.randomx::SuperscalarProgram"], %"class.std::vector", %"class.std::__cxx11::basic_string", ptr }
%"class.randomx::SuperscalarProgram" = type { [512 x %"class.randomx::Instruction"], i32, i32, double, i32, i32, i32, i32, i32, i32, [8 x i32], [8 x i32] }
%"class.randomx::Instruction" = type { i8, i8, i8, i8, i32 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<unsigned long, std::allocator<unsigned long>>::_Vector_impl" }
%"struct.std::_Vector_base<unsigned long, std::allocator<unsigned long>>::_Vector_impl" = type { %"struct.std::_Vector_base<unsigned long, std::allocator<unsigned long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<unsigned long, std::allocator<unsigned long>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }

@_ZTISt9exception = external constant ptr

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

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

; Function Attrs: mustprogress uwtable
define dso_local ptr @randomx_alloc_cache(i32 noundef %0) #1 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  store i32 %0, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #11
  store ptr null, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #11
  %10 = load i32, ptr %3, align 4, !tbaa !5
  %11 = call noundef ptr @_ZN7randomx15selectArgonImplE13randomx_flags(i32 noundef %10)
  store ptr %11, ptr %5, align 8, !tbaa !9
  %12 = load ptr, ptr %5, align 8, !tbaa !9
  %13 = icmp eq ptr %12, null
  br i1 %13, label %14, label %16

14:                                               ; preds = %1
  %15 = load ptr, ptr %4, align 8, !tbaa !9
  store ptr %15, ptr %2, align 8
  store i32 1, ptr %6, align 4
  br label %139

16:                                               ; preds = %1
  %17 = invoke noalias noundef nonnull ptr @_Znwm(i64 noundef 33704) #12
          to label %18 unwind label %27

18:                                               ; preds = %16
  call void @llvm.memset.p0.i64(ptr align 16 %17, i8 0, i64 33704, i1 false)
  call void @_ZN13randomx_cacheC2Ev(ptr noundef nonnull align 8 dereferenceable(33704) %17) #11
  store ptr %17, ptr %4, align 8, !tbaa !9
  %19 = load ptr, ptr %5, align 8, !tbaa !9
  %20 = load ptr, ptr %4, align 8, !tbaa !9
  %21 = getelementptr inbounds %struct.randomx_cache, ptr %20, i32 0, i32 8
  store ptr %19, ptr %21, align 8, !tbaa !11
  %22 = load i32, ptr %3, align 4, !tbaa !5
  %23 = invoke noundef i32 @_Zor13randomx_flagsS_(i32 noundef 8, i32 noundef 1)
          to label %24 unwind label %27

24:                                               ; preds = %18
  %25 = invoke noundef i32 @_Zan13randomx_flagsS_(i32 noundef %22, i32 noundef %23)
          to label %26 unwind label %27

26:                                               ; preds = %24
  switch i32 %25, label %119 [
    i32 0, label %31
    i32 8, label %44
    i32 1, label %69
    i32 9, label %82
  ]

27:                                               ; preds = %96, %87, %82, %69, %58, %49, %44, %31, %24, %18, %16
  %28 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  %29 = extractvalue { ptr, i32 } %28, 0
  store ptr %29, ptr %7, align 8
  %30 = extractvalue { ptr, i32 } %28, 1
  store i32 %30, ptr %8, align 4
  br label %107

31:                                               ; preds = %26
  %32 = load ptr, ptr %4, align 8, !tbaa !9
  %33 = getelementptr inbounds %struct.randomx_cache, ptr %32, i32 0, i32 1
  store ptr @_ZN7randomx12deallocCacheINS_16AlignedAllocatorILm64EEEEEvP13randomx_cache, ptr %33, align 8, !tbaa !20
  %34 = load ptr, ptr %4, align 8, !tbaa !9
  %35 = getelementptr inbounds %struct.randomx_cache, ptr %34, i32 0, i32 2
  store ptr null, ptr %35, align 8, !tbaa !21
  %36 = load ptr, ptr %4, align 8, !tbaa !9
  %37 = getelementptr inbounds %struct.randomx_cache, ptr %36, i32 0, i32 3
  store ptr @_ZN7randomx9initCacheEP13randomx_cachePKvm, ptr %37, align 8, !tbaa !22
  %38 = load ptr, ptr %4, align 8, !tbaa !9
  %39 = getelementptr inbounds %struct.randomx_cache, ptr %38, i32 0, i32 4
  store ptr @_ZN7randomx11initDatasetEP13randomx_cachePhjj, ptr %39, align 8, !tbaa !23
  %40 = invoke noundef ptr @_ZN7randomx16AlignedAllocatorILm64EE11allocMemoryEm(i64 noundef 268435456)
          to label %41 unwind label %27

41:                                               ; preds = %31
  %42 = load ptr, ptr %4, align 8, !tbaa !9
  %43 = getelementptr inbounds %struct.randomx_cache, ptr %42, i32 0, i32 0
  store ptr %40, ptr %43, align 8, !tbaa !24
  br label %120

44:                                               ; preds = %26
  %45 = load ptr, ptr %4, align 8, !tbaa !9
  %46 = getelementptr inbounds %struct.randomx_cache, ptr %45, i32 0, i32 1
  store ptr @_ZN7randomx12deallocCacheINS_16AlignedAllocatorILm64EEEEEvP13randomx_cache, ptr %46, align 8, !tbaa !20
  %47 = invoke noalias noundef nonnull ptr @_Znwm(i64 noundef 72) #12
          to label %48 unwind label %27

48:                                               ; preds = %44
  invoke void @_ZN7randomx14JitCompilerX86C1Ev(ptr noundef nonnull align 8 dereferenceable(68) %47)
          to label %49 unwind label %65

49:                                               ; preds = %48
  %50 = load ptr, ptr %4, align 8, !tbaa !9
  %51 = getelementptr inbounds %struct.randomx_cache, ptr %50, i32 0, i32 2
  store ptr %47, ptr %51, align 8, !tbaa !21
  %52 = load ptr, ptr %4, align 8, !tbaa !9
  %53 = getelementptr inbounds %struct.randomx_cache, ptr %52, i32 0, i32 3
  store ptr @_ZN7randomx16initCacheCompileEP13randomx_cachePKvm, ptr %53, align 8, !tbaa !22
  %54 = load ptr, ptr %4, align 8, !tbaa !9
  %55 = getelementptr inbounds %struct.randomx_cache, ptr %54, i32 0, i32 2
  %56 = load ptr, ptr %55, align 8, !tbaa !21
  %57 = invoke noundef ptr @_ZN7randomx14JitCompilerX8618getDatasetInitFuncEv(ptr noundef nonnull align 8 dereferenceable(68) %56)
          to label %58 unwind label %27

58:                                               ; preds = %49
  %59 = load ptr, ptr %4, align 8, !tbaa !9
  %60 = getelementptr inbounds %struct.randomx_cache, ptr %59, i32 0, i32 4
  store ptr %57, ptr %60, align 8, !tbaa !23
  %61 = invoke noundef ptr @_ZN7randomx16AlignedAllocatorILm64EE11allocMemoryEm(i64 noundef 268435456)
          to label %62 unwind label %27

62:                                               ; preds = %58
  %63 = load ptr, ptr %4, align 8, !tbaa !9
  %64 = getelementptr inbounds %struct.randomx_cache, ptr %63, i32 0, i32 0
  store ptr %61, ptr %64, align 8, !tbaa !24
  br label %120

65:                                               ; preds = %48
  %66 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  %67 = extractvalue { ptr, i32 } %66, 0
  store ptr %67, ptr %7, align 8
  %68 = extractvalue { ptr, i32 } %66, 1
  store i32 %68, ptr %8, align 4
  call void @_ZdlPvm(ptr noundef %47, i64 noundef 72) #13
  br label %107

69:                                               ; preds = %26
  %70 = load ptr, ptr %4, align 8, !tbaa !9
  %71 = getelementptr inbounds %struct.randomx_cache, ptr %70, i32 0, i32 1
  store ptr @_ZN7randomx12deallocCacheINS_18LargePageAllocatorEEEvP13randomx_cache, ptr %71, align 8, !tbaa !20
  %72 = load ptr, ptr %4, align 8, !tbaa !9
  %73 = getelementptr inbounds %struct.randomx_cache, ptr %72, i32 0, i32 2
  store ptr null, ptr %73, align 8, !tbaa !21
  %74 = load ptr, ptr %4, align 8, !tbaa !9
  %75 = getelementptr inbounds %struct.randomx_cache, ptr %74, i32 0, i32 3
  store ptr @_ZN7randomx9initCacheEP13randomx_cachePKvm, ptr %75, align 8, !tbaa !22
  %76 = load ptr, ptr %4, align 8, !tbaa !9
  %77 = getelementptr inbounds %struct.randomx_cache, ptr %76, i32 0, i32 4
  store ptr @_ZN7randomx11initDatasetEP13randomx_cachePhjj, ptr %77, align 8, !tbaa !23
  %78 = invoke noundef ptr @_ZN7randomx18LargePageAllocator11allocMemoryEm(i64 noundef 268435456)
          to label %79 unwind label %27

79:                                               ; preds = %69
  %80 = load ptr, ptr %4, align 8, !tbaa !9
  %81 = getelementptr inbounds %struct.randomx_cache, ptr %80, i32 0, i32 0
  store ptr %78, ptr %81, align 8, !tbaa !24
  br label %120

82:                                               ; preds = %26
  %83 = load ptr, ptr %4, align 8, !tbaa !9
  %84 = getelementptr inbounds %struct.randomx_cache, ptr %83, i32 0, i32 1
  store ptr @_ZN7randomx12deallocCacheINS_18LargePageAllocatorEEEvP13randomx_cache, ptr %84, align 8, !tbaa !20
  %85 = invoke noalias noundef nonnull ptr @_Znwm(i64 noundef 72) #12
          to label %86 unwind label %27

86:                                               ; preds = %82
  invoke void @_ZN7randomx14JitCompilerX86C1Ev(ptr noundef nonnull align 8 dereferenceable(68) %85)
          to label %87 unwind label %103

87:                                               ; preds = %86
  %88 = load ptr, ptr %4, align 8, !tbaa !9
  %89 = getelementptr inbounds %struct.randomx_cache, ptr %88, i32 0, i32 2
  store ptr %85, ptr %89, align 8, !tbaa !21
  %90 = load ptr, ptr %4, align 8, !tbaa !9
  %91 = getelementptr inbounds %struct.randomx_cache, ptr %90, i32 0, i32 3
  store ptr @_ZN7randomx16initCacheCompileEP13randomx_cachePKvm, ptr %91, align 8, !tbaa !22
  %92 = load ptr, ptr %4, align 8, !tbaa !9
  %93 = getelementptr inbounds %struct.randomx_cache, ptr %92, i32 0, i32 2
  %94 = load ptr, ptr %93, align 8, !tbaa !21
  %95 = invoke noundef ptr @_ZN7randomx14JitCompilerX8618getDatasetInitFuncEv(ptr noundef nonnull align 8 dereferenceable(68) %94)
          to label %96 unwind label %27

96:                                               ; preds = %87
  %97 = load ptr, ptr %4, align 8, !tbaa !9
  %98 = getelementptr inbounds %struct.randomx_cache, ptr %97, i32 0, i32 4
  store ptr %95, ptr %98, align 8, !tbaa !23
  %99 = invoke noundef ptr @_ZN7randomx18LargePageAllocator11allocMemoryEm(i64 noundef 268435456)
          to label %100 unwind label %27

100:                                              ; preds = %96
  %101 = load ptr, ptr %4, align 8, !tbaa !9
  %102 = getelementptr inbounds %struct.randomx_cache, ptr %101, i32 0, i32 0
  store ptr %99, ptr %102, align 8, !tbaa !24
  br label %120

103:                                              ; preds = %86
  %104 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  %105 = extractvalue { ptr, i32 } %104, 0
  store ptr %105, ptr %7, align 8
  %106 = extractvalue { ptr, i32 } %104, 1
  store i32 %106, ptr %8, align 4
  call void @_ZdlPvm(ptr noundef %85, i64 noundef 72) #13
  br label %107

107:                                              ; preds = %103, %65, %27
  %108 = load i32, ptr %8, align 4
  %109 = call i32 @llvm.eh.typeid.for.p0(ptr @_ZTISt9exception) #11
  %110 = icmp eq i32 %108, %109
  br i1 %110, label %111, label %141

111:                                              ; preds = %107
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #11
  %112 = load ptr, ptr %7, align 8
  %113 = call ptr @__cxa_begin_catch(ptr %112) #11
  store ptr %113, ptr %9, align 8
  %114 = load ptr, ptr %4, align 8, !tbaa !9
  %115 = icmp ne ptr %114, null
  br i1 %115, label %116, label %125

116:                                              ; preds = %111
  %117 = load ptr, ptr %4, align 8, !tbaa !9
  invoke void @randomx_release_cache(ptr noundef %117)
          to label %118 unwind label %121

118:                                              ; preds = %116
  store ptr null, ptr %4, align 8, !tbaa !9
  br label %125

119:                                              ; preds = %26
  unreachable

120:                                              ; preds = %100, %79, %62, %41
  br label %126

121:                                              ; preds = %116
  %122 = landingpad { ptr, i32 }
          cleanup
  %123 = extractvalue { ptr, i32 } %122, 0
  store ptr %123, ptr %7, align 8
  %124 = extractvalue { ptr, i32 } %122, 1
  store i32 %124, ptr %8, align 4
  invoke void @__cxa_end_catch()
          to label %136 unwind label %147

125:                                              ; preds = %118, %111
  call void @__cxa_end_catch()
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #11
  br label %126

126:                                              ; preds = %125, %120
  %127 = load ptr, ptr %4, align 8, !tbaa !9
  %128 = icmp ne ptr %127, null
  br i1 %128, label %129, label %137

129:                                              ; preds = %126
  %130 = load ptr, ptr %4, align 8, !tbaa !9
  %131 = getelementptr inbounds %struct.randomx_cache, ptr %130, i32 0, i32 0
  %132 = load ptr, ptr %131, align 8, !tbaa !24
  %133 = icmp eq ptr %132, null
  br i1 %133, label %134, label %137

134:                                              ; preds = %129
  %135 = load ptr, ptr %4, align 8, !tbaa !9
  call void @randomx_release_cache(ptr noundef %135)
  store ptr null, ptr %4, align 8, !tbaa !9
  br label %137

136:                                              ; preds = %121
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #11
  br label %141

137:                                              ; preds = %134, %129, %126
  %138 = load ptr, ptr %4, align 8, !tbaa !9
  store ptr %138, ptr %2, align 8
  store i32 1, ptr %6, align 4
  br label %139

139:                                              ; preds = %137, %14
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #11
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #11
  %140 = load ptr, ptr %2, align 8
  ret ptr %140

141:                                              ; preds = %136, %107
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #11
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #11
  br label %142

142:                                              ; preds = %141
  %143 = load ptr, ptr %7, align 8
  %144 = load i32, ptr %8, align 4
  %145 = insertvalue { ptr, i32 } poison, ptr %143, 0
  %146 = insertvalue { ptr, i32 } %145, i32 %144, 1
  resume { ptr, i32 } %146

147:                                              ; preds = %121
  %148 = landingpad { ptr, i32 }
          catch ptr null
  %149 = extractvalue { ptr, i32 } %148, 0
  call void @__clang_call_terminate(ptr %149) #14
  unreachable
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZN7randomx15selectArgonImplE13randomx_flags(i32 noundef) #2

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #3

declare i32 @__gxx_personality_v0(...)

; 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 @_ZN13randomx_cacheC2Ev(ptr noundef nonnull align 8 dereferenceable(33704)) unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Zan13randomx_flagsS_(i32 noundef, i32 noundef) #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Zor13randomx_flagsS_(i32 noundef, i32 noundef) #5

declare void @_ZN7randomx12deallocCacheINS_16AlignedAllocatorILm64EEEEEvP13randomx_cache(ptr noundef) #6

declare void @_ZN7randomx9initCacheEP13randomx_cachePKvm(ptr noundef, ptr noundef, i64 noundef) #6

declare void @_ZN7randomx11initDatasetEP13randomx_cachePhjj(ptr noundef, ptr noundef, i32 noundef, i32 noundef) #6

declare noundef ptr @_ZN7randomx16AlignedAllocatorILm64EE11allocMemoryEm(i64 noundef) #6

declare void @_ZN7randomx14JitCompilerX86C1Ev(ptr noundef nonnull align 8 dereferenceable(68)) unnamed_addr #6

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #7

declare void @_ZN7randomx16initCacheCompileEP13randomx_cachePKvm(ptr noundef, ptr noundef, i64 noundef) #6

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

declare void @_ZN7randomx12deallocCacheINS_18LargePageAllocatorEEEvP13randomx_cache(ptr noundef) #6

declare noundef ptr @_ZN7randomx18LargePageAllocator11allocMemoryEm(i64 noundef) #6

; Function Attrs: nounwind memory(none)
declare i32 @llvm.eh.typeid.for.p0(ptr) #9

declare ptr @__cxa_begin_catch(ptr)

; Function Attrs: mustprogress uwtable
declare dso_local void @randomx_release_cache(ptr noundef) #1

declare void @__cxa_end_catch()

; Function Attrs: noinline noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) #10

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 = { 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 #3 = { nobuiltin allocsize(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 = { 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 = { "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 = { nobuiltin 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 #8 = { 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 #9 = { nounwind memory(none) }
attributes #10 = { noinline noreturn nounwind uwtable "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 #11 = { nounwind }
attributes #12 = { builtin allocsize(0) }
attributes #13 = { builtin nounwind }
attributes #14 = { 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 = !{!"_ZTS13randomx_flags", !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 = !{!12, !10, i64 33696}
!12 = !{!"_ZTS13randomx_cache", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !7, i64 40, !13, i64 33640, !17, i64 33664, !10, i64 33696}
!13 = !{!"_ZTSSt6vectorImSaImEE", !14, i64 0}
!14 = !{!"_ZTSSt12_Vector_baseImSaImEE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseImSaImEE12_Vector_implE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseImSaImEE17_Vector_impl_dataE", !10, i64 0, !10, i64 8, !10, i64 16}
!17 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !18, i64 0, !19, i64 8, !7, i64 16}
!18 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !10, i64 0}
!19 = !{!"long", !7, i64 0}
!20 = !{!12, !10, i64 8}
!21 = !{!12, !10, i64 16}
!22 = !{!12, !10, i64 24}
!23 = !{!12, !10, i64 32}
!24 = !{!12, !10, 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"

@_ZTISt9exception = external constant ptr

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @randomx_alloc_cache(i32 noundef %0) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %2 = tail call noundef ptr @_ZN7randomx15selectArgonImplE13randomx_flags(i32 noundef %0)
  %3 = icmp eq ptr %2, null
  br i1 %3, label %54, label %4

4:                                                ; preds = %1
  %5 = invoke noalias noundef nonnull dereferenceable(33704) ptr @_Znwm(i64 noundef 33704) #10
          to label %6 unwind label %11

6:                                                ; preds = %4
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(33704) %5, i8 0, i64 33704, i1 false)
  tail call void @_ZN13randomx_cacheC2Ev(ptr noundef nonnull align 8 dereferenceable(33704) %5) #11
  %7 = getelementptr inbounds i8, ptr %5, i64 33696
  store ptr %2, ptr %7, align 8, !tbaa !5
  %8 = tail call noundef i32 @_Zor13randomx_flagsS_(i32 noundef 8, i32 noundef 1)
  %9 = tail call noundef i32 @_Zan13randomx_flagsS_(i32 noundef %0, i32 noundef %8)
  %10 = getelementptr inbounds i8, ptr %5, i64 8
  switch i32 %9, label %47 [
    i32 0, label %13
    i32 8, label %16
    i32 1, label %27
    i32 9, label %30
  ]

11:                                               ; preds = %.invoke49, %.invoke, %30, %16, %4
  %.041 = phi ptr [ %5, %30 ], [ %5, %16 ], [ null, %4 ], [ %5, %.invoke ], [ %5, %.invoke49 ]
  %12 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  br label %41

13:                                               ; preds = %6
  store ptr @_ZN7randomx12deallocCacheINS_16AlignedAllocatorILm64EEEEEvP13randomx_cache, ptr %10, align 8, !tbaa !17
  %14 = getelementptr inbounds i8, ptr %5, i64 16
  store ptr null, ptr %14, align 8, !tbaa !18
  %15 = getelementptr inbounds i8, ptr %5, i64 24
  store ptr @_ZN7randomx9initCacheEP13randomx_cachePKvm, ptr %15, align 8, !tbaa !19
  br label %.invoke49

16:                                               ; preds = %6
  store ptr @_ZN7randomx12deallocCacheINS_16AlignedAllocatorILm64EEEEEvP13randomx_cache, ptr %10, align 8, !tbaa !17
  %17 = invoke noalias noundef nonnull dereferenceable(72) ptr @_Znwm(i64 noundef 72) #10
          to label %18 unwind label %11

18:                                               ; preds = %16
  invoke void @_ZN7randomx14JitCompilerX86C1Ev(ptr noundef nonnull align 8 dereferenceable(68) %17)
          to label %19 unwind label %25

19:                                               ; preds = %18
  %20 = getelementptr inbounds i8, ptr %5, i64 16
  store ptr %17, ptr %20, align 8, !tbaa !18
  %21 = getelementptr inbounds i8, ptr %5, i64 24
  store ptr @_ZN7randomx16initCacheCompileEP13randomx_cachePKvm, ptr %21, align 8, !tbaa !19
  %22 = tail call noundef ptr @_ZN7randomx14JitCompilerX8618getDatasetInitFuncEv(ptr noundef nonnull align 8 dereferenceable(68) %17)
  br label %.invoke49

.invoke49:                                        ; preds = %13, %19
  %_ZN7randomx11initDatasetEP13randomx_cachePhjj.sink = phi ptr [ @_ZN7randomx11initDatasetEP13randomx_cachePhjj, %13 ], [ %22, %19 ]
  %23 = getelementptr inbounds i8, ptr %5, i64 32
  store ptr %_ZN7randomx11initDatasetEP13randomx_cachePhjj.sink, ptr %23, align 8, !tbaa !20
  %24 = invoke noundef ptr @_ZN7randomx16AlignedAllocatorILm64EE11allocMemoryEm(i64 noundef 268435456)
          to label %51 unwind label %11

25:                                               ; preds = %18
  %26 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  tail call void @_ZdlPvm(ptr noundef nonnull %17, i64 noundef 72) #12
  br label %41

27:                                               ; preds = %6
  store ptr @_ZN7randomx12deallocCacheINS_18LargePageAllocatorEEEvP13randomx_cache, ptr %10, align 8, !tbaa !17
  %28 = getelementptr inbounds i8, ptr %5, i64 16
  store ptr null, ptr %28, align 8, !tbaa !18
  %29 = getelementptr inbounds i8, ptr %5, i64 24
  store ptr @_ZN7randomx9initCacheEP13randomx_cachePKvm, ptr %29, align 8, !tbaa !19
  br label %.invoke

30:                                               ; preds = %6
  store ptr @_ZN7randomx12deallocCacheINS_18LargePageAllocatorEEEvP13randomx_cache, ptr %10, align 8, !tbaa !17
  %31 = invoke noalias noundef nonnull dereferenceable(72) ptr @_Znwm(i64 noundef 72) #10
          to label %32 unwind label %11

32:                                               ; preds = %30
  invoke void @_ZN7randomx14JitCompilerX86C1Ev(ptr noundef nonnull align 8 dereferenceable(68) %31)
          to label %33 unwind label %39

33:                                               ; preds = %32
  %34 = getelementptr inbounds i8, ptr %5, i64 16
  store ptr %31, ptr %34, align 8, !tbaa !18
  %35 = getelementptr inbounds i8, ptr %5, i64 24
  store ptr @_ZN7randomx16initCacheCompileEP13randomx_cachePKvm, ptr %35, align 8, !tbaa !19
  %36 = tail call noundef ptr @_ZN7randomx14JitCompilerX8618getDatasetInitFuncEv(ptr noundef nonnull align 8 dereferenceable(68) %31)
  br label %.invoke

.invoke:                                          ; preds = %27, %33
  %_ZN7randomx11initDatasetEP13randomx_cachePhjj.sink51 = phi ptr [ @_ZN7randomx11initDatasetEP13randomx_cachePhjj, %27 ], [ %36, %33 ]
  %37 = getelementptr inbounds i8, ptr %5, i64 32
  store ptr %_ZN7randomx11initDatasetEP13randomx_cachePhjj.sink51, ptr %37, align 8, !tbaa !20
  %38 = invoke noundef ptr @_ZN7randomx18LargePageAllocator11allocMemoryEm(i64 noundef 268435456)
          to label %51 unwind label %11

39:                                               ; preds = %32
  %40 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  tail call void @_ZdlPvm(ptr noundef nonnull %31, i64 noundef 72) #12
  br label %41

41:                                               ; preds = %39, %25, %11
  %.142 = phi ptr [ %.041, %11 ], [ %5, %39 ], [ %5, %25 ]
  %.pn = phi { ptr, i32 } [ %12, %11 ], [ %40, %39 ], [ %26, %25 ]
  %.038 = extractvalue { ptr, i32 } %.pn, 1
  %42 = tail call i32 @llvm.eh.typeid.for.p0(ptr nonnull @_ZTISt9exception) #11
  %43 = icmp eq i32 %.038, %42
  br i1 %43, label %44, label %55

44:                                               ; preds = %41
  %.039 = extractvalue { ptr, i32 } %.pn, 0
  %45 = tail call ptr @__cxa_begin_catch(ptr %.039) #11
  %.not = icmp eq ptr %.142, null
  br i1 %.not, label %50, label %46

46:                                               ; preds = %44
  invoke void @randomx_release_cache(ptr noundef nonnull %.142)
          to label %50 unwind label %48

47:                                               ; preds = %6
  unreachable

48:                                               ; preds = %46
  %49 = landingpad { ptr, i32 }
          cleanup
  invoke void @__cxa_end_catch()
          to label %55 unwind label %56

50:                                               ; preds = %44, %46
  tail call void @__cxa_end_catch()
  br label %54

51:                                               ; preds = %.invoke49, %.invoke
  %.sink = phi ptr [ %38, %.invoke ], [ %24, %.invoke49 ]
  store ptr %.sink, ptr %5, align 8, !tbaa !21
  %52 = icmp eq ptr %.sink, null
  br i1 %52, label %53, label %54

53:                                               ; preds = %51
  tail call void @randomx_release_cache(ptr noundef nonnull %5)
  br label %54

54:                                               ; preds = %50, %51, %53, %1
  %.0 = phi ptr [ null, %1 ], [ null, %53 ], [ %5, %51 ], [ null, %50 ]
  ret ptr %.0

55:                                               ; preds = %48, %41
  %.merged = phi { ptr, i32 } [ %.pn, %41 ], [ %49, %48 ]
  resume { ptr, i32 } %.merged

56:                                               ; preds = %48
  %57 = landingpad { ptr, i32 }
          catch ptr null
  %58 = extractvalue { ptr, i32 } %57, 0
  tail call void @__clang_call_terminate(ptr %58) #13
  unreachable
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZN7randomx15selectArgonImplE13randomx_flags(i32 noundef) local_unnamed_addr #1

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #2

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Zan13randomx_flagsS_(i32 noundef, i32 noundef) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Zor13randomx_flagsS_(i32 noundef, i32 noundef) local_unnamed_addr #4

declare void @_ZN7randomx12deallocCacheINS_16AlignedAllocatorILm64EEEEEvP13randomx_cache(ptr noundef) #5

declare void @_ZN7randomx9initCacheEP13randomx_cachePKvm(ptr noundef, ptr noundef, i64 noundef) #5

declare void @_ZN7randomx11initDatasetEP13randomx_cachePhjj(ptr noundef, ptr noundef, i32 noundef, i32 noundef) #5

declare noundef ptr @_ZN7randomx16AlignedAllocatorILm64EE11allocMemoryEm(i64 noundef) local_unnamed_addr #5

declare void @_ZN7randomx14JitCompilerX86C1Ev(ptr noundef nonnull align 8 dereferenceable(68)) unnamed_addr #5

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #6

declare void @_ZN7randomx16initCacheCompileEP13randomx_cachePKvm(ptr noundef, ptr noundef, i64 noundef) #5

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

declare void @_ZN7randomx12deallocCacheINS_18LargePageAllocatorEEEvP13randomx_cache(ptr noundef) #5

declare noundef ptr @_ZN7randomx18LargePageAllocator11allocMemoryEm(i64 noundef) local_unnamed_addr #5

; Function Attrs: nofree nosync nounwind memory(none)
declare i32 @llvm.eh.typeid.for.p0(ptr) #8

declare ptr @__cxa_begin_catch(ptr) local_unnamed_addr

; Function Attrs: mustprogress uwtable
declare dso_local void @randomx_release_cache(ptr noundef) local_unnamed_addr #0

declare void @__cxa_end_catch() local_unnamed_addr

; Function Attrs: noinline noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) local_unnamed_addr #9

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" }
attributes #1 = { 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 #2 = { nobuiltin allocsize(0) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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 #5 = { "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 = { nobuiltin 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 = { nofree nosync nounwind memory(none) }
attributes #9 = { noinline noreturn nounwind uwtable "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 #10 = { builtin allocsize(0) }
attributes #11 = { nounwind }
attributes #12 = { builtin nounwind }
attributes #13 = { 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, !7, i64 33696}
!6 = !{!"_ZTS13randomx_cache", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !8, i64 40, !10, i64 33640, !14, i64 33664, !7, i64 33696}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSSt6vectorImSaImEE", !11, i64 0}
!11 = !{!"_ZTSSt12_Vector_baseImSaImEE", !12, i64 0}
!12 = !{!"_ZTSNSt12_Vector_baseImSaImEE12_Vector_implE", !13, i64 0}
!13 = !{!"_ZTSNSt12_Vector_baseImSaImEE17_Vector_impl_dataE", !7, i64 0, !7, i64 8, !7, i64 16}
!14 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !15, i64 0, !16, i64 8, !8, i64 16}
!15 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !7, i64 0}
!16 = !{!"long", !8, i64 0}
!17 = !{!6, !7, i64 8}
!18 = !{!6, !7, i64 16}
!19 = !{!6, !7, i64 24}
!20 = !{!6, !7, i64 32}
!21 = !{!6, !7, i64 0}


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