; LLVM IR from facebook/redex :: libredex/RedexContext.ll (ZN12RedexContext23ConcurrentStringStorage11get_contextEv)

; 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.RedexContext::ConcurrentStringStorage::Context" = type { ptr, i64, ptr }
%"class.std::lock_guard" = type { ptr }
%"struct.RedexContext::ConcurrentStringStorage" = type { i64, i64, i64, %"struct.std::atomic.1", %"struct.std::atomic.1", %"struct.std::atomic.1", %"struct.std::atomic.1", %"struct.std::array.28", %"class.std::mutex", %"class.std::vector" }
%"struct.std::atomic.1" = type { %"struct.std::__atomic_base.2" }
%"struct.std::__atomic_base.2" = type { i64 }
%"struct.std::array.28" = type { [11 x %"struct.RedexContext::ConcurrentStringStorage::Slot"] }
%"struct.RedexContext::ConcurrentStringStorage::Slot" = type { %"struct.std::atomic.29", [56 x i8] }
%"struct.std::atomic.29" = type { %"struct.std::__atomic_base.30" }
%"struct.std::__atomic_base.30" = type { 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::unique_ptr<RedexContext::ConcurrentStringStorage::Container>, std::allocator<std::unique_ptr<RedexContext::ConcurrentStringStorage::Container>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::unique_ptr<RedexContext::ConcurrentStringStorage::Container>, std::allocator<std::unique_ptr<RedexContext::ConcurrentStringStorage::Container>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::unique_ptr<RedexContext::ConcurrentStringStorage::Container>, std::allocator<std::unique_ptr<RedexContext::ConcurrentStringStorage::Container>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::unique_ptr<RedexContext::ConcurrentStringStorage::Container>, std::allocator<std::unique_ptr<RedexContext::ConcurrentStringStorage::Container>>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@_ZZN12RedexContext23ConcurrentStringStorage11get_contextEvE10next_index = external hidden global { i64 }, align 8
@_ZZN12RedexContext23ConcurrentStringStorage11get_contextEvE12index_plus_1 = external hidden thread_local global i64, align 8

; 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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN12RedexContext23ConcurrentStringStorage11get_contextEv(ptr dead_on_unwind noalias writable sret(%"struct.RedexContext::ConcurrentStringStorage::Context") align 8 %0, ptr noundef nonnull align 8 dereferenceable(824) %1) #3 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca %"class.std::lock_guard", align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  store ptr %0, ptr %3, align 8
  store ptr %1, ptr %4, align 8, !tbaa !5
  %11 = load ptr, ptr %4, align 8
  %12 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_ZZN12RedexContext23ConcurrentStringStorage11get_contextEvE12index_plus_1)
  %13 = load i64, ptr %12, align 8, !tbaa !9
  %14 = icmp eq i64 %13, 0
  br i1 %14, label %15, label %20

15:                                               ; preds = %2
  %16 = call noundef i64 @_ZNSt13__atomic_baseImEppEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZZN12RedexContext23ConcurrentStringStorage11get_contextEvE10next_index, i32 noundef 0) #7
  %17 = urem i64 %16, 11
  %18 = add i64 %17, 1
  %19 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_ZZN12RedexContext23ConcurrentStringStorage11get_contextEvE12index_plus_1)
  store i64 %18, ptr %19, align 8, !tbaa !9
  br label %20

20:                                               ; preds = %15, %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  %21 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_ZZN12RedexContext23ConcurrentStringStorage11get_contextEvE12index_plus_1)
  %22 = load i64, ptr %21, align 8, !tbaa !9
  %23 = sub i64 %22, 1
  store i64 %23, ptr %5, align 8, !tbaa !9
  br label %24

24:                                               ; preds = %96, %20
  br label %25

25:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  %26 = getelementptr inbounds %"struct.RedexContext::ConcurrentStringStorage", ptr %11, i32 0, i32 7
  %27 = load i64, ptr %5, align 8, !tbaa !9
  %28 = call noundef nonnull align 8 dereferenceable(64) ptr @_ZNSt5arrayIN12RedexContext23ConcurrentStringStorage4SlotELm11EEixEm(ptr noundef nonnull align 8 dereferenceable(704) %26, i64 noundef %27) #7
  %29 = getelementptr inbounds %"struct.RedexContext::ConcurrentStringStorage::Slot", ptr %28, i32 0, i32 0
  %30 = call noundef ptr @_ZNSt6atomicIPN12RedexContext23ConcurrentStringStorage9ContainerEE8exchangeES3_St12memory_order(ptr noundef nonnull align 8 dereferenceable(8) %29, ptr noundef null, i32 noundef 5) #7
  store ptr %30, ptr %6, align 8, !tbaa !5
  %31 = load ptr, ptr %6, align 8, !tbaa !5
  %32 = icmp ne ptr %31, null
  br i1 %32, label %33, label %39

33:                                               ; preds = %25
  call void @_ZSt19atomic_thread_fenceSt12memory_order(i32 noundef 2) #7
  %34 = getelementptr inbounds %"struct.RedexContext::ConcurrentStringStorage::Context", ptr %0, i32 0, i32 0
  store ptr %11, ptr %34, align 8, !tbaa !11
  %35 = getelementptr inbounds %"struct.RedexContext::ConcurrentStringStorage::Context", ptr %0, i32 0, i32 1
  %36 = load i64, ptr %5, align 8, !tbaa !9
  store i64 %36, ptr %35, align 8, !tbaa !13
  %37 = getelementptr inbounds %"struct.RedexContext::ConcurrentStringStorage::Context", ptr %0, i32 0, i32 2
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %38, ptr %37, align 8, !tbaa !14
  store i32 1, ptr %7, align 4
  br label %94

39:                                               ; preds = %25
  %40 = getelementptr inbounds %"struct.RedexContext::ConcurrentStringStorage", ptr %11, i32 0, i32 5
  %41 = call noundef i64 @_ZNSt13__atomic_baseImEppEi(ptr noundef nonnull align 8 dereferenceable(8) %40, i32 noundef 0) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  %42 = getelementptr inbounds %"struct.RedexContext::ConcurrentStringStorage", ptr %11, i32 0, i32 8
  call void @_ZNSt10lock_guardISt5mutexEC2ERS0_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(40) %42)
  %43 = getelementptr inbounds %"struct.RedexContext::ConcurrentStringStorage", ptr %11, i32 0, i32 9
  %44 = call noundef zeroext i1 @_ZNKSt6vectorISt10unique_ptrIN12RedexContext23ConcurrentStringStorage9ContainerESt14default_deleteIS3_EESaIS6_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %43) #7
  br i1 %44, label %55, label %45

45:                                               ; preds = %39
  %46 = getelementptr inbounds %"struct.RedexContext::ConcurrentStringStorage", ptr %11, i32 0, i32 9
  %47 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorISt10unique_ptrIN12RedexContext23ConcurrentStringStorage9ContainerESt14default_deleteIS3_EESaIS6_EE4backEv(ptr noundef nonnull align 8 dereferenceable(24) %46) #7
  %48 = call noundef ptr @_ZNSt10unique_ptrIN12RedexContext23ConcurrentStringStorage9ContainerESt14default_deleteIS2_EE7releaseEv(ptr noundef nonnull align 8 dereferenceable(8) %47) #7
  store ptr %48, ptr %6, align 8, !tbaa !5
  %49 = getelementptr inbounds %"struct.RedexContext::ConcurrentStringStorage", ptr %11, i32 0, i32 9
  call void @_ZNSt6vectorISt10unique_ptrIN12RedexContext23ConcurrentStringStorage9ContainerESt14default_deleteIS3_EESaIS6_EE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24) %49) #7
  %50 = getelementptr inbounds %"struct.RedexContext::ConcurrentStringStorage::Context", ptr %0, i32 0, i32 0
  store ptr %11, ptr %50, align 8, !tbaa !11
  %51 = getelementptr inbounds %"struct.RedexContext::ConcurrentStringStorage::Context", ptr %0, i32 0, i32 1
  %52 = load i64, ptr %5, align 8, !tbaa !9
  store i64 %52, ptr %51, align 8, !tbaa !13
  %53 = getelementptr inbounds %"struct.RedexContext::ConcurrentStringStorage::Context", ptr %0, i32 0, i32 2
  %54 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %54, ptr %53, align 8, !tbaa !14
  store i32 1, ptr %7, align 4
  br label %93

55:                                               ; preds = %39
  %56 = getelementptr inbounds %"struct.RedexContext::ConcurrentStringStorage", ptr %11, i32 0, i32 3
  %57 = call noundef i64 @_ZNSt13__atomic_baseImE9fetch_addEmSt12memory_order(ptr noundef nonnull align 8 dereferenceable(8) %56, i64 noundef 1, i32 noundef 5) #7
  %58 = getelementptr inbounds %"struct.RedexContext::ConcurrentStringStorage", ptr %11, i32 0, i32 2
  %59 = load i64, ptr %58, align 8, !tbaa !15
  %60 = icmp ult i64 %57, %59
  br i1 %60, label %61, label %81

61:                                               ; preds = %55
  %62 = getelementptr inbounds %"struct.RedexContext::ConcurrentStringStorage", ptr %11, i32 0, i32 5
  %63 = call noundef i64 @_ZNSt13__atomic_baseImEmmEi(ptr noundef nonnull align 8 dereferenceable(8) %62, i32 noundef 0) #7
  %64 = getelementptr inbounds %"struct.RedexContext::ConcurrentStringStorage::Context", ptr %0, i32 0, i32 0
  store ptr %11, ptr %64, align 8, !tbaa !11
  %65 = getelementptr inbounds %"struct.RedexContext::ConcurrentStringStorage::Context", ptr %0, i32 0, i32 1
  %66 = load i64, ptr %5, align 8, !tbaa !9
  store i64 %66, ptr %65, align 8, !tbaa !13
  %67 = getelementptr inbounds %"struct.RedexContext::ConcurrentStringStorage::Context", ptr %0, i32 0, i32 2
  %68 = invoke noalias noundef nonnull ptr @_Znwm(i64 noundef 16) #8
          to label %69 unwind label %73

69:                                               ; preds = %61
  %70 = getelementptr inbounds %"struct.RedexContext::ConcurrentStringStorage", ptr %11, i32 0, i32 0
  %71 = load i64, ptr %70, align 8, !tbaa !26
  invoke void @_ZN12RedexContext23ConcurrentStringStorage9ContainerC2Em(ptr noundef nonnull align 8 dereferenceable(16) %68, i64 noundef %71)
          to label %72 unwind label %77

72:                                               ; preds = %69
  store ptr %68, ptr %67, align 8, !tbaa !14
  store i32 1, ptr %7, align 4
  br label %93

73:                                               ; preds = %61
  %74 = landingpad { ptr, i32 }
          cleanup
  %75 = extractvalue { ptr, i32 } %74, 0
  store ptr %75, ptr %9, align 8
  %76 = extractvalue { ptr, i32 } %74, 1
  store i32 %76, ptr %10, align 4
  br label %97

77:                                               ; preds = %69
  %78 = landingpad { ptr, i32 }
          cleanup
  %79 = extractvalue { ptr, i32 } %78, 0
  store ptr %79, ptr %9, align 8
  %80 = extractvalue { ptr, i32 } %78, 1
  store i32 %80, ptr %10, align 4
  call void @_ZdlPvm(ptr noundef %68, i64 noundef 16) #9
  br label %97

81:                                               ; preds = %55
  %82 = getelementptr inbounds %"struct.RedexContext::ConcurrentStringStorage", ptr %11, i32 0, i32 3
  %83 = call noundef i64 @_ZNSt13__atomic_baseImE9fetch_subEmSt12memory_order(ptr noundef nonnull align 8 dereferenceable(8) %82, i64 noundef 1, i32 noundef 5) #7
  %84 = getelementptr inbounds %"struct.RedexContext::ConcurrentStringStorage", ptr %11, i32 0, i32 4
  %85 = call noundef i64 @_ZNSt13__atomic_baseImEppEi(ptr noundef nonnull align 8 dereferenceable(8) %84, i32 noundef 0) #7
  %86 = call noundef i64 @_ZNSt13__atomic_baseImEppEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZZN12RedexContext23ConcurrentStringStorage11get_contextEvE10next_index, i32 noundef 0) #7
  %87 = urem i64 %86, 11
  %88 = add i64 %87, 1
  %89 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_ZZN12RedexContext23ConcurrentStringStorage11get_contextEvE12index_plus_1)
  store i64 %88, ptr %89, align 8, !tbaa !9
  %90 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_ZZN12RedexContext23ConcurrentStringStorage11get_contextEvE12index_plus_1)
  %91 = load i64, ptr %90, align 8, !tbaa !9
  %92 = sub i64 %91, 1
  store i64 %92, ptr %5, align 8, !tbaa !9
  store i32 0, ptr %7, align 4
  br label %93

93:                                               ; preds = %81, %72, %45
  call void @_ZNSt10lock_guardISt5mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  br label %94

94:                                               ; preds = %93, %33
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  %95 = load i32, ptr %7, align 4
  switch i32 %95, label %98 [
    i32 0, label %96
  ]

96:                                               ; preds = %94
  br label %24, !llvm.loop !27

97:                                               ; preds = %77, %73
  call void @_ZNSt10lock_guardISt5mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  br label %99

98:                                               ; preds = %94
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  ret void

99:                                               ; preds = %97
  %100 = load ptr, ptr %9, align 8
  %101 = load i32, ptr %10, align 4
  %102 = insertvalue { ptr, i32 } poison, ptr %100, 0
  %103 = insertvalue { ptr, i32 } %102, i32 %101, 1
  resume { ptr, i32 } %103
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNSt13__atomic_baseImEppEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(64) ptr @_ZNSt5arrayIN12RedexContext23ConcurrentStringStorage4SlotELm11EEixEm(ptr noundef nonnull align 8 dereferenceable(704), i64 noundef) #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNSt6atomicIPN12RedexContext23ConcurrentStringStorage9ContainerEE8exchangeES3_St12memory_order(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef, i32 noundef) #5 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local void @_ZSt19atomic_thread_fenceSt12memory_order(i32 noundef) #6

; 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 #3 align 2

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

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

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

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

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNSt13__atomic_baseImE9fetch_addEmSt12memory_order(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef, i32 noundef) #6 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNSt13__atomic_baseImEmmEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN12RedexContext23ConcurrentStringStorage9ContainerC2Em(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef) unnamed_addr #5 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNSt13__atomic_baseImE9fetch_subEmSt12memory_order(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef, i32 noundef) #6 align 2

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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 = { 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 #7 = { nounwind }
attributes #8 = { builtin allocsize(0) }
attributes #9 = { builtin nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"_ZTSN12RedexContext23ConcurrentStringStorage7ContextE", !6, i64 0, !10, i64 8, !6, i64 16}
!13 = !{!12, !10, i64 8}
!14 = !{!12, !6, i64 16}
!15 = !{!16, !10, i64 16}
!16 = !{!"_ZTSN12RedexContext23ConcurrentStringStorageE", !10, i64 0, !10, i64 8, !10, i64 16, !17, i64 24, !17, i64 32, !17, i64 40, !17, i64 48, !19, i64 56, !20, i64 760, !22, i64 800}
!17 = !{!"_ZTSSt6atomicImE", !18, i64 0}
!18 = !{!"_ZTSSt13__atomic_baseImE", !10, i64 0}
!19 = !{!"_ZTSSt5arrayIN12RedexContext23ConcurrentStringStorage4SlotELm11EE", !7, i64 0}
!20 = !{!"_ZTSSt5mutex", !21, i64 0}
!21 = !{!"_ZTSSt12__mutex_base", !7, i64 0}
!22 = !{!"_ZTSSt6vectorISt10unique_ptrIN12RedexContext23ConcurrentStringStorage9ContainerESt14default_deleteIS3_EESaIS6_EE", !23, i64 0}
!23 = !{!"_ZTSSt12_Vector_baseISt10unique_ptrIN12RedexContext23ConcurrentStringStorage9ContainerESt14default_deleteIS3_EESaIS6_EE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseISt10unique_ptrIN12RedexContext23ConcurrentStringStorage9ContainerESt14default_deleteIS3_EESaIS6_EE12_Vector_implE", !25, i64 0}
!25 = !{!"_ZTSNSt12_Vector_baseISt10unique_ptrIN12RedexContext23ConcurrentStringStorage9ContainerESt14default_deleteIS3_EESaIS6_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!26 = !{!16, !10, i64 0}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}


; 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.RedexContext::ConcurrentStringStorage::Context" = type { ptr, i64, ptr }
%"class.std::lock_guard" = type { ptr }

@_ZZN12RedexContext23ConcurrentStringStorage11get_contextEvE10next_index = external hidden global { i64 }, align 8
@_ZZN12RedexContext23ConcurrentStringStorage11get_contextEvE12index_plus_1 = external hidden thread_local local_unnamed_addr global i64, align 8

; 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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN12RedexContext23ConcurrentStringStorage11get_contextEv(ptr dead_on_unwind noalias nocapture writable writeonly sret(%"struct.RedexContext::ConcurrentStringStorage::Context") align 8 %0, ptr noundef nonnull align 8 dereferenceable(824) %1) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.std::lock_guard", align 8
  %4 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_ZZN12RedexContext23ConcurrentStringStorage11get_contextEvE12index_plus_1)
  %5 = load i64, ptr %4, align 8, !tbaa !5
  %6 = icmp eq i64 %5, 0
  br i1 %6, label %7, label %11

7:                                                ; preds = %2
  %8 = tail call noundef i64 @_ZNSt13__atomic_baseImEppEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZZN12RedexContext23ConcurrentStringStorage11get_contextEvE10next_index, i32 noundef 0) #6
  %9 = urem i64 %8, 11
  %10 = add nuw nsw i64 %9, 1
  store i64 %10, ptr %4, align 8, !tbaa !5
  br label %11

11:                                               ; preds = %7, %2
  %12 = phi i64 [ %10, %7 ], [ %5, %2 ]
  %13 = add i64 %12, -1
  %14 = getelementptr inbounds i8, ptr %1, i64 56
  %15 = tail call noundef nonnull align 8 dereferenceable(64) ptr @_ZNSt5arrayIN12RedexContext23ConcurrentStringStorage4SlotELm11EEixEm(ptr noundef nonnull align 8 dereferenceable(704) %14, i64 noundef %13) #6
  %16 = tail call noundef ptr @_ZNSt6atomicIPN12RedexContext23ConcurrentStringStorage9ContainerEE8exchangeES3_St12memory_order(ptr noundef nonnull align 8 dereferenceable(8) %15, ptr noundef null, i32 noundef 5) #6
  %.not28 = icmp eq ptr %16, null
  br i1 %.not28, label %.lr.ph, label %.thread

.lr.ph:                                           ; preds = %11
  %17 = getelementptr inbounds i8, ptr %1, i64 40
  %18 = getelementptr inbounds i8, ptr %1, i64 760
  %19 = getelementptr inbounds i8, ptr %1, i64 800
  %20 = getelementptr inbounds i8, ptr %1, i64 24
  %21 = getelementptr inbounds i8, ptr %1, i64 16
  %22 = getelementptr inbounds i8, ptr %1, i64 32
  br label %25

.thread:                                          ; preds = %46, %11
  %.0.lcssa = phi i64 [ %13, %11 ], [ %50, %46 ]
  %.lcssa = phi ptr [ %16, %11 ], [ %53, %46 ]
  call void @_ZSt19atomic_thread_fenceSt12memory_order(i32 noundef 2) #6
  store ptr %1, ptr %0, align 8, !tbaa !9
  %23 = getelementptr inbounds i8, ptr %0, i64 8
  store i64 %.0.lcssa, ptr %23, align 8, !tbaa !12
  %24 = getelementptr inbounds i8, ptr %0, i64 16
  store ptr %.lcssa, ptr %24, align 8, !tbaa !13
  br label %54

25:                                               ; preds = %.lr.ph, %46
  %.029 = phi i64 [ %13, %.lr.ph ], [ %50, %46 ]
  %26 = call noundef i64 @_ZNSt13__atomic_baseImEppEi(ptr noundef nonnull align 8 dereferenceable(8) %17, i32 noundef 0) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  call void @_ZNSt10lock_guardISt5mutexEC2ERS0_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(40) %18)
  %27 = call noundef zeroext i1 @_ZNKSt6vectorISt10unique_ptrIN12RedexContext23ConcurrentStringStorage9ContainerESt14default_deleteIS3_EESaIS6_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %19) #6
  br i1 %27, label %33, label %28

28:                                               ; preds = %25
  %29 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorISt10unique_ptrIN12RedexContext23ConcurrentStringStorage9ContainerESt14default_deleteIS3_EESaIS6_EE4backEv(ptr noundef nonnull align 8 dereferenceable(24) %19) #6
  %30 = call noundef ptr @_ZNSt10unique_ptrIN12RedexContext23ConcurrentStringStorage9ContainerESt14default_deleteIS2_EE7releaseEv(ptr noundef nonnull align 8 dereferenceable(8) %29) #6
  call void @_ZNSt6vectorISt10unique_ptrIN12RedexContext23ConcurrentStringStorage9ContainerESt14default_deleteIS3_EESaIS6_EE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24) %19) #6
  store ptr %1, ptr %0, align 8, !tbaa !9
  %31 = getelementptr inbounds i8, ptr %0, i64 8
  store i64 %.029, ptr %31, align 8, !tbaa !12
  %32 = getelementptr inbounds i8, ptr %0, i64 16
  store ptr %30, ptr %32, align 8, !tbaa !13
  br label %.thread16

33:                                               ; preds = %25
  %34 = call noundef i64 @_ZNSt13__atomic_baseImE9fetch_addEmSt12memory_order(ptr noundef nonnull align 8 dereferenceable(8) %20, i64 noundef 1, i32 noundef 5) #6
  %35 = load i64, ptr %21, align 8, !tbaa !14
  %36 = icmp ult i64 %34, %35
  br i1 %36, label %37, label %46

37:                                               ; preds = %33
  %38 = call noundef i64 @_ZNSt13__atomic_baseImEmmEi(ptr noundef nonnull align 8 dereferenceable(8) %17, i32 noundef 0) #6
  store ptr %1, ptr %0, align 8, !tbaa !9
  %39 = getelementptr inbounds i8, ptr %0, i64 8
  store i64 %.029, ptr %39, align 8, !tbaa !12
  %40 = invoke noalias noundef nonnull dereferenceable(16) ptr @_Znwm(i64 noundef 16) #7
          to label %41 unwind label %44

41:                                               ; preds = %37
  %42 = getelementptr inbounds i8, ptr %0, i64 16
  %43 = load i64, ptr %1, align 8, !tbaa !25
  call void @_ZN12RedexContext23ConcurrentStringStorage9ContainerC2Em(ptr noundef nonnull align 8 dereferenceable(16) %40, i64 noundef %43)
  store ptr %40, ptr %42, align 8, !tbaa !13
  br label %.thread16

44:                                               ; preds = %37
  %45 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt10lock_guardISt5mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  resume { ptr, i32 } %45

.thread16:                                        ; preds = %41, %28
  call void @_ZNSt10lock_guardISt5mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  br label %54

46:                                               ; preds = %33
  %47 = call noundef i64 @_ZNSt13__atomic_baseImE9fetch_subEmSt12memory_order(ptr noundef nonnull align 8 dereferenceable(8) %20, i64 noundef 1, i32 noundef 5) #6
  %48 = call noundef i64 @_ZNSt13__atomic_baseImEppEi(ptr noundef nonnull align 8 dereferenceable(8) %22, i32 noundef 0) #6
  %49 = call noundef i64 @_ZNSt13__atomic_baseImEppEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZZN12RedexContext23ConcurrentStringStorage11get_contextEvE10next_index, i32 noundef 0) #6
  %50 = urem i64 %49, 11
  %51 = add nuw nsw i64 %50, 1
  store i64 %51, ptr %4, align 8, !tbaa !5
  call void @_ZNSt10lock_guardISt5mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  %52 = call noundef nonnull align 8 dereferenceable(64) ptr @_ZNSt5arrayIN12RedexContext23ConcurrentStringStorage4SlotELm11EEixEm(ptr noundef nonnull align 8 dereferenceable(704) %14, i64 noundef %50) #6
  %53 = call noundef ptr @_ZNSt6atomicIPN12RedexContext23ConcurrentStringStorage9ContainerEE8exchangeES3_St12memory_order(ptr noundef nonnull align 8 dereferenceable(8) %52, ptr noundef null, i32 noundef 5) #6
  %.not = icmp eq ptr %53, null
  br i1 %.not, label %25, label %.thread, !llvm.loop !26

54:                                               ; preds = %.thread16, %.thread
  ret void
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #3

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(64) ptr @_ZNSt5arrayIN12RedexContext23ConcurrentStringStorage4SlotELm11EEixEm(ptr noundef nonnull align 8 dereferenceable(704), i64 noundef) local_unnamed_addr #4 align 2

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

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local void @_ZSt19atomic_thread_fenceSt12memory_order(i32 noundef) local_unnamed_addr #5

; 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 #2 align 2

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorISt10unique_ptrIN12RedexContext23ConcurrentStringStorage9ContainerESt14default_deleteIS3_EESaIS6_EE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #4 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNSt13__atomic_baseImE9fetch_addEmSt12memory_order(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef, i32 noundef) local_unnamed_addr #5 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN12RedexContext23ConcurrentStringStorage9ContainerC2Em(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef) unnamed_addr #4 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNSt13__atomic_baseImE9fetch_subEmSt12memory_order(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef, i32 noundef) local_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 #4 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { 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 = { 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 #6 = { nounwind }
attributes #7 = { builtin allocsize(0) }

!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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"_ZTSN12RedexContext23ConcurrentStringStorage7ContextE", !11, i64 0, !6, i64 8, !11, i64 16}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!10, !6, i64 8}
!13 = !{!10, !11, i64 16}
!14 = !{!15, !6, i64 16}
!15 = !{!"_ZTSN12RedexContext23ConcurrentStringStorageE", !6, i64 0, !6, i64 8, !6, i64 16, !16, i64 24, !16, i64 32, !16, i64 40, !16, i64 48, !18, i64 56, !19, i64 760, !21, i64 800}
!16 = !{!"_ZTSSt6atomicImE", !17, i64 0}
!17 = !{!"_ZTSSt13__atomic_baseImE", !6, i64 0}
!18 = !{!"_ZTSSt5arrayIN12RedexContext23ConcurrentStringStorage4SlotELm11EE", !7, i64 0}
!19 = !{!"_ZTSSt5mutex", !20, i64 0}
!20 = !{!"_ZTSSt12__mutex_base", !7, i64 0}
!21 = !{!"_ZTSSt6vectorISt10unique_ptrIN12RedexContext23ConcurrentStringStorage9ContainerESt14default_deleteIS3_EESaIS6_EE", !22, i64 0}
!22 = !{!"_ZTSSt12_Vector_baseISt10unique_ptrIN12RedexContext23ConcurrentStringStorage9ContainerESt14default_deleteIS3_EESaIS6_EE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseISt10unique_ptrIN12RedexContext23ConcurrentStringStorage9ContainerESt14default_deleteIS3_EESaIS6_EE12_Vector_implE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseISt10unique_ptrIN12RedexContext23ConcurrentStringStorage9ContainerESt14default_deleteIS3_EESaIS6_EE17_Vector_impl_dataE", !11, i64 0, !11, i64 8, !11, i64 16}
!25 = !{!15, !6, i64 0}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass