; LLVM IR from BehaviorTree/BehaviorTree.CPP :: src/loggers/bt_file_logger_v2.ll (ZN2BT11FileLogger210writerLoopEv)

; 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.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<BT::FileLogger2::Transition, std::allocator<BT::FileLogger2::Transition>>::_Deque_impl" }
%"struct.std::_Deque_base<BT::FileLogger2::Transition, std::allocator<BT::FileLogger2::Transition>>::_Deque_impl" = type { %"struct.std::_Deque_base<BT::FileLogger2::Transition, std::allocator<BT::FileLogger2::Transition>>::_Deque_impl_data" }
%"struct.std::_Deque_base<BT::FileLogger2::Transition, std::allocator<BT::FileLogger2::Transition>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%"class.std::unique_lock" = type <{ ptr, i8, [7 x i8] }>
%"class.std::chrono::duration.37" = type { i64 }
%class.anon = type { ptr }
%"struct.BT::FileLogger2::Transition" = type { i64, i16, i8 }
%"struct.std::array.38" = type { [9 x i8] }
%"class.BT::FileLogger2" = type { %"class.BT::StatusChangeLogger", %"class.std::unique_ptr.7" }
%"class.BT::StatusChangeLogger" = type { ptr, i8, i8, %"class.std::vector", i32, %"class.std::chrono::time_point", %"class.std::mutex" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::shared_ptr<std::function<void (std::chrono::time_point<std::chrono::_V2::system_clock, std::chrono::duration<long, std::ratio<1, 1000000000>>>, const BT::TreeNode &, BT::NodeStatus, BT::NodeStatus)>>, std::allocator<std::shared_ptr<std::function<void (std::chrono::time_point<std::chrono::_V2::system_clock, std::chrono::duration<long, std::ratio<1, 1000000000>>>, const BT::TreeNode &, BT::NodeStatus, BT::NodeStatus)>>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::shared_ptr<std::function<void (std::chrono::time_point<std::chrono::_V2::system_clock, std::chrono::duration<long, std::ratio<1, 1000000000>>>, const BT::TreeNode &, BT::NodeStatus, BT::NodeStatus)>>, std::allocator<std::shared_ptr<std::function<void (std::chrono::time_point<std::chrono::_V2::system_clock, std::chrono::duration<long, std::ratio<1, 1000000000>>>, const BT::TreeNode &, BT::NodeStatus, BT::NodeStatus)>>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::shared_ptr<std::function<void (std::chrono::time_point<std::chrono::_V2::system_clock, std::chrono::duration<long, std::ratio<1, 1000000000>>>, const BT::TreeNode &, BT::NodeStatus, BT::NodeStatus)>>, std::allocator<std::shared_ptr<std::function<void (std::chrono::time_point<std::chrono::_V2::system_clock, std::chrono::duration<long, std::ratio<1, 1000000000>>>, const BT::TreeNode &, BT::NodeStatus, BT::NodeStatus)>>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::shared_ptr<std::function<void (std::chrono::time_point<std::chrono::_V2::system_clock, std::chrono::duration<long, std::ratio<1, 1000000000>>>, const BT::TreeNode &, BT::NodeStatus, BT::NodeStatus)>>, std::allocator<std::shared_ptr<std::function<void (std::chrono::time_point<std::chrono::_V2::system_clock, std::chrono::duration<long, std::ratio<1, 1000000000>>>, const BT::TreeNode &, BT::NodeStatus, BT::NodeStatus)>>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::chrono::time_point" = type { %"class.std::chrono::duration" }
%"class.std::chrono::duration" = type { i64 }
%"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.7" = type { %"struct.std::__uniq_ptr_data.8" }
%"struct.std::__uniq_ptr_data.8" = type { %"class.std::__uniq_ptr_impl.9" }
%"class.std::__uniq_ptr_impl.9" = type { %"class.std::tuple.10" }
%"class.std::tuple.10" = type { %"struct.std::_Tuple_impl.11" }
%"struct.std::_Tuple_impl.11" = type { %"struct.std::_Head_base.14" }
%"struct.std::_Head_base.14" = type { ptr }
%"struct.BT::FileLogger2::PImpl" = type <{ %"class.std::basic_ofstream", %"class.std::chrono::duration", %"class.std::deque", %"class.std::condition_variable", %"class.std::mutex", %"class.std::thread", %"struct.std::atomic", [7 x i8] }>
%"class.std::basic_ofstream" = type { %"class.std::basic_ostream.base", %"class.std::basic_filebuf", %"class.std::basic_ios" }
%"class.std::basic_ostream.base" = type { ptr }
%"class.std::basic_filebuf" = type { %"class.std::basic_streambuf", %union.pthread_mutex_t, %"class.std::__basic_file", i32, %struct.__mbstate_t, %struct.__mbstate_t, %struct.__mbstate_t, ptr, i64, i8, i8, i8, i8, ptr, ptr, i8, ptr, ptr, i64, ptr, ptr }
%"class.std::basic_streambuf" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, %"class.std::locale" }
%"class.std::locale" = type { ptr }
%"class.std::__basic_file" = type <{ ptr, i8, [7 x i8] }>
%struct.__mbstate_t = type { i32, %union.anon.25 }
%union.anon.25 = type { i32 }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::condition_variable" = type { %"class.std::__condvar" }
%"class.std::__condvar" = type { %union.pthread_cond_t }
%union.pthread_cond_t = type { %struct.__pthread_cond_s }
%struct.__pthread_cond_s = type { %union.__atomic_wide_counter, %union.__atomic_wide_counter, [2 x i32], [2 x i32], i32, i32, [2 x i32] }
%union.__atomic_wide_counter = type { i64 }
%"class.std::thread" = type { %"class.std::thread::id" }
%"class.std::thread::id" = type { i64 }
%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i8 }

; 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: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNKSt10unique_ptrIN2BT11FileLogger25PImplESt14default_deleteIS2_EEptEv(ptr noundef nonnull align 8 dereferenceable(8)) #1 align 2

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSo5writeEPKcl(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef, i64 noundef) #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN2BT11FileLogger210writerLoopEv(ptr noundef nonnull align 8 dereferenceable(104) %0) #4 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca %"class.std::deque", align 8
  %4 = alloca %"class.std::unique_lock", align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca %"class.std::chrono::duration.37", align 8
  %8 = alloca i32, align 4
  %9 = alloca %class.anon, align 8
  %10 = alloca %"struct.BT::FileLogger2::Transition", align 8
  %11 = alloca %"struct.std::array.38", align 1
  store ptr %0, ptr %2, align 8, !tbaa !5
  %12 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 80, ptr %3) #7
  call void @_ZNSt5dequeIN2BT11FileLogger210TransitionESaIS2_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(80) %3)
  br label %13

13:                                               ; preds = %72, %1
  %14 = getelementptr inbounds %"class.BT::FileLogger2", ptr %12, i32 0, i32 1
  %15 = call noundef ptr @_ZNKSt10unique_ptrIN2BT11FileLogger25PImplESt14default_deleteIS2_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %14) #7
  %16 = getelementptr inbounds %"struct.BT::FileLogger2::PImpl", ptr %15, i32 0, i32 6
  %17 = call noundef zeroext i1 @_ZNKSt6atomicIbEcvbEv(ptr noundef nonnull align 1 dereferenceable(1) %16) #7
  br i1 %17, label %18, label %77

18:                                               ; preds = %13
  call void @_ZNSt5dequeIN2BT11FileLogger210TransitionESaIS2_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(80) %3) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr %4) #7
  %19 = getelementptr inbounds %"class.BT::FileLogger2", ptr %12, i32 0, i32 1
  %20 = call noundef ptr @_ZNKSt10unique_ptrIN2BT11FileLogger25PImplESt14default_deleteIS2_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %19) #7
  %21 = getelementptr inbounds %"struct.BT::FileLogger2::PImpl", ptr %20, i32 0, i32 4
  invoke void @_ZNSt11unique_lockISt5mutexEC2ERS0_(ptr noundef nonnull align 8 dereferenceable(9) %4, ptr noundef nonnull align 8 dereferenceable(40) %21)
          to label %22 unwind label %54

22:                                               ; preds = %18
  %23 = getelementptr inbounds %"class.BT::FileLogger2", ptr %12, i32 0, i32 1
  %24 = call noundef ptr @_ZNKSt10unique_ptrIN2BT11FileLogger25PImplESt14default_deleteIS2_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %23) #7
  %25 = getelementptr inbounds %"struct.BT::FileLogger2::PImpl", ptr %24, i32 0, i32 3
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store i32 10, ptr %8, align 4, !tbaa !9
  invoke void @_ZNSt6chrono8durationIlSt5ratioILl1ELl1000EEEC2IivEERKT_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
          to label %26 unwind label %58

26:                                               ; preds = %22
  %27 = getelementptr inbounds %class.anon, ptr %9, i32 0, i32 0
  store ptr %12, ptr %27, align 8, !tbaa !11
  %28 = getelementptr inbounds %class.anon, ptr %9, i32 0, i32 0
  %29 = load ptr, ptr %28, align 8
  %30 = invoke noundef zeroext i1 @"_ZNSt18condition_variable8wait_forIlSt5ratioILl1ELl1000EEZN2BT11FileLogger210writerLoopEvE3$_0EEbRSt11unique_lockISt5mutexERKNSt6chrono8durationIT_T0_EET1_"(ptr noundef nonnull align 8 dereferenceable(48) %25, ptr noundef nonnull align 8 dereferenceable(9) %4, ptr noundef nonnull align 8 dereferenceable(8) %7, ptr %29)
          to label %31 unwind label %58

31:                                               ; preds = %26
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  %32 = getelementptr inbounds %"class.BT::FileLogger2", ptr %12, i32 0, i32 1
  %33 = call noundef ptr @_ZNKSt10unique_ptrIN2BT11FileLogger25PImplESt14default_deleteIS2_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %32) #7
  %34 = getelementptr inbounds %"struct.BT::FileLogger2::PImpl", ptr %33, i32 0, i32 2
  call void @_ZSt4swapIN2BT11FileLogger210TransitionESaIS2_EEvRSt5dequeIT_T0_ES8_(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 8 dereferenceable(80) %34) #7
  call void @_ZNSt11unique_lockISt5mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(9) %4) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %4) #7
  br label %35

35:                                               ; preds = %53, %31
  %36 = call noundef zeroext i1 @_ZNKSt5dequeIN2BT11FileLogger210TransitionESaIS2_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %3) #7
  %37 = xor i1 %36, true
  br i1 %37, label %38, label %67

38:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #7
  %39 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt5dequeIN2BT11FileLogger210TransitionESaIS2_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %3) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %10, ptr align 8 %39, i64 16, i1 false), !tbaa.struct !13
  call void @llvm.lifetime.start.p0(i64 9, ptr %11) #7
  %40 = call noundef ptr @_ZNSt5arrayIcLm9EE4dataEv(ptr noundef nonnull align 1 dereferenceable(9) %11) #8
  %41 = getelementptr inbounds %"struct.BT::FileLogger2::Transition", ptr %10, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %40, ptr align 8 %41, i64 6, i1 false)
  %42 = call noundef ptr @_ZNSt5arrayIcLm9EE4dataEv(ptr noundef nonnull align 1 dereferenceable(9) %11) #8
  %43 = getelementptr inbounds i8, ptr %42, i64 6
  %44 = getelementptr inbounds %"struct.BT::FileLogger2::Transition", ptr %10, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %43, ptr align 8 %44, i64 2, i1 false)
  %45 = call noundef ptr @_ZNSt5arrayIcLm9EE4dataEv(ptr noundef nonnull align 1 dereferenceable(9) %11) #8
  %46 = getelementptr inbounds i8, ptr %45, i64 8
  %47 = getelementptr inbounds %"struct.BT::FileLogger2::Transition", ptr %10, i32 0, i32 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %46, ptr align 2 %47, i64 1, i1 false)
  %48 = getelementptr inbounds %"class.BT::FileLogger2", ptr %12, i32 0, i32 1
  %49 = call noundef ptr @_ZNKSt10unique_ptrIN2BT11FileLogger25PImplESt14default_deleteIS2_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %48) #7
  %50 = getelementptr inbounds %"struct.BT::FileLogger2::PImpl", ptr %49, i32 0, i32 0
  %51 = call noundef ptr @_ZNSt5arrayIcLm9EE4dataEv(ptr noundef nonnull align 1 dereferenceable(9) %11) #8
  %52 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSo5writeEPKcl(ptr noundef nonnull align 8 dereferenceable(8) %50, ptr noundef %51, i64 noundef 9)
          to label %53 unwind label %63

53:                                               ; preds = %38
  call void @_ZNSt5dequeIN2BT11FileLogger210TransitionESaIS2_EE9pop_frontEv(ptr noundef nonnull align 8 dereferenceable(80) %3) #7
  call void @llvm.lifetime.end.p0(i64 9, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #7
  br label %35, !llvm.loop !19

54:                                               ; preds = %18
  %55 = landingpad { ptr, i32 }
          cleanup
  %56 = extractvalue { ptr, i32 } %55, 0
  store ptr %56, ptr %5, align 8
  %57 = extractvalue { ptr, i32 } %55, 1
  store i32 %57, ptr %6, align 4
  br label %62

58:                                               ; preds = %26, %22
  %59 = landingpad { ptr, i32 }
          cleanup
  %60 = extractvalue { ptr, i32 } %59, 0
  store ptr %60, ptr %5, align 8
  %61 = extractvalue { ptr, i32 } %59, 1
  store i32 %61, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @_ZNSt11unique_lockISt5mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(9) %4) #7
  br label %62

62:                                               ; preds = %58, %54
  call void @llvm.lifetime.end.p0(i64 16, ptr %4) #7
  br label %78

63:                                               ; preds = %38
  %64 = landingpad { ptr, i32 }
          cleanup
  %65 = extractvalue { ptr, i32 } %64, 0
  store ptr %65, ptr %5, align 8
  %66 = extractvalue { ptr, i32 } %64, 1
  store i32 %66, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 9, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #7
  br label %78

67:                                               ; preds = %35
  %68 = getelementptr inbounds %"class.BT::FileLogger2", ptr %12, i32 0, i32 1
  %69 = call noundef ptr @_ZNKSt10unique_ptrIN2BT11FileLogger25PImplESt14default_deleteIS2_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %68) #7
  %70 = getelementptr inbounds %"struct.BT::FileLogger2::PImpl", ptr %69, i32 0, i32 0
  %71 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSo5flushEv(ptr noundef nonnull align 8 dereferenceable(8) %70)
          to label %72 unwind label %73

72:                                               ; preds = %67
  br label %13, !llvm.loop !21

73:                                               ; preds = %67
  %74 = landingpad { ptr, i32 }
          cleanup
  %75 = extractvalue { ptr, i32 } %74, 0
  store ptr %75, ptr %5, align 8
  %76 = extractvalue { ptr, i32 } %74, 1
  store i32 %76, ptr %6, align 4
  br label %78

77:                                               ; preds = %13
  call void @_ZNSt5dequeIN2BT11FileLogger210TransitionESaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %3) #7
  call void @llvm.lifetime.end.p0(i64 80, ptr %3) #7
  ret void

78:                                               ; preds = %73, %63, %62
  call void @_ZNSt5dequeIN2BT11FileLogger210TransitionESaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %3) #7
  call void @llvm.lifetime.end.p0(i64 80, ptr %3) #7
  br label %79

79:                                               ; preds = %78
  %80 = load ptr, ptr %5, align 8
  %81 = load i32, ptr %6, align 4
  %82 = insertvalue { ptr, i32 } poison, ptr %80, 0
  %83 = insertvalue { ptr, i32 } %82, i32 %81, 1
  resume { ptr, i32 } %83
}

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSo5flushEv(ptr noundef nonnull align 8 dereferenceable(8)) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5dequeIN2BT11FileLogger210TransitionESaIS2_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #4 align 2

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

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

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

; Function Attrs: mustprogress uwtable
declare hidden noundef zeroext i1 @"_ZNSt18condition_variable8wait_forIlSt5ratioILl1ELl1000EEZN2BT11FileLogger210writerLoopEvE3$_0EEbRSt11unique_lockISt5mutexERKNSt6chrono8durationIT_T0_EET1_"(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(9), ptr noundef nonnull align 8 dereferenceable(8), ptr) #4 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapIN2BT11FileLogger210TransitionESaIS2_EEvRSt5dequeIT_T0_ES8_(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 8 dereferenceable(80)) #5

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

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

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

; Function Attrs: mustprogress nounwind willreturn memory(none) uwtable
declare dso_local noundef ptr @_ZNSt5arrayIcLm9EE4dataEv(ptr noundef nonnull align 1 dereferenceable(9)) #6 align 2

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

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

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #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 = { mustprogress nounwind willreturn memory(none) 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 = { nounwind willreturn memory(none) }

!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 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"_ZTSZN2BT11FileLogger210writerLoopEvE3$_0", !6, i64 0}
!13 = !{i64 0, i64 8, !14, i64 8, i64 2, !16, i64 10, i64 1, !18}
!14 = !{!15, !15, i64 0}
!15 = !{!"long", !7, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"short", !7, i64 0}
!18 = !{!7, !7, i64 0}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = distinct !{!21, !20}


; 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.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<BT::FileLogger2::Transition, std::allocator<BT::FileLogger2::Transition>>::_Deque_impl" }
%"struct.std::_Deque_base<BT::FileLogger2::Transition, std::allocator<BT::FileLogger2::Transition>>::_Deque_impl" = type { %"struct.std::_Deque_base<BT::FileLogger2::Transition, std::allocator<BT::FileLogger2::Transition>>::_Deque_impl_data" }
%"struct.std::_Deque_base<BT::FileLogger2::Transition, std::allocator<BT::FileLogger2::Transition>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%"class.std::unique_lock" = type <{ ptr, i8, [7 x i8] }>
%"class.std::chrono::duration.37" = type { i64 }
%"struct.std::array.38" = type { [9 x i8] }

; 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: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNKSt10unique_ptrIN2BT11FileLogger25PImplESt14default_deleteIS2_EEptEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1 align 2

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSo5writeEPKcl(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN2BT11FileLogger210writerLoopEv(ptr noundef nonnull align 8 dereferenceable(104) %0) local_unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.std::deque", align 8
  %3 = alloca %"class.std::unique_lock", align 8
  %4 = alloca %"class.std::chrono::duration.37", align 8
  %5 = alloca i32, align 4
  %6 = alloca %"struct.std::array.38", align 1
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %2) #6
  call void @_ZNSt5dequeIN2BT11FileLogger210TransitionESaIS2_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(80) %2)
  %7 = getelementptr inbounds i8, ptr %0, i64 96
  br label %8

8:                                                ; preds = %._crit_edge, %1
  %9 = call noundef ptr @_ZNKSt10unique_ptrIN2BT11FileLogger25PImplESt14default_deleteIS2_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #6
  %10 = getelementptr inbounds i8, ptr %9, i64 696
  %11 = call noundef zeroext i1 @_ZNKSt6atomicIbEcvbEv(ptr noundef nonnull align 1 dereferenceable(1) %10) #6
  br i1 %11, label %12, label %42

12:                                               ; preds = %8
  call void @_ZNSt5dequeIN2BT11FileLogger210TransitionESaIS2_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(80) %2) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #6
  %13 = call noundef ptr @_ZNKSt10unique_ptrIN2BT11FileLogger25PImplESt14default_deleteIS2_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #6
  %14 = getelementptr inbounds i8, ptr %13, i64 648
  invoke void @_ZNSt11unique_lockISt5mutexEC2ERS0_(ptr noundef nonnull align 8 dereferenceable(9) %3, ptr noundef nonnull align 8 dereferenceable(40) %14)
          to label %15 unwind label %31

15:                                               ; preds = %12
  %16 = call noundef ptr @_ZNKSt10unique_ptrIN2BT11FileLogger25PImplESt14default_deleteIS2_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #6
  %17 = getelementptr inbounds i8, ptr %16, i64 600
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  store i32 10, ptr %5, align 4, !tbaa !5
  call void @_ZNSt6chrono8durationIlSt5ratioILl1ELl1000EEEC2IivEERKT_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %18 = invoke noundef zeroext i1 @"_ZNSt18condition_variable8wait_forIlSt5ratioILl1ELl1000EEZN2BT11FileLogger210writerLoopEvE3$_0EEbRSt11unique_lockISt5mutexERKNSt6chrono8durationIT_T0_EET1_"(ptr noundef nonnull align 8 dereferenceable(48) %17, ptr noundef nonnull align 8 dereferenceable(9) %3, ptr noundef nonnull align 8 dereferenceable(8) %4, ptr nonnull %0)
          to label %19 unwind label %33

19:                                               ; preds = %15
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  %20 = call noundef ptr @_ZNKSt10unique_ptrIN2BT11FileLogger25PImplESt14default_deleteIS2_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #6
  %21 = getelementptr inbounds i8, ptr %20, i64 520
  call void @_ZSt4swapIN2BT11FileLogger210TransitionESaIS2_EEvRSt5dequeIT_T0_ES8_(ptr noundef nonnull align 8 dereferenceable(80) %2, ptr noundef nonnull align 8 dereferenceable(80) %21) #6
  call void @_ZNSt11unique_lockISt5mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(9) %3) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #6
  %22 = call noundef zeroext i1 @_ZNKSt5dequeIN2BT11FileLogger210TransitionESaIS2_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %2) #6
  br i1 %22, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %19, %29
  %23 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt5dequeIN2BT11FileLogger210TransitionESaIS2_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %2) #6
  %.sroa.0.0.copyload = load i64, ptr %23, align 8, !tbaa !9
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %23, i64 8
  %.sroa.5.0.copyload = load i16, ptr %.sroa.5.0..sroa_idx, align 8, !tbaa !11
  %.sroa.6.0..sroa_idx = getelementptr inbounds i8, ptr %23, i64 10
  %.sroa.6.0.copyload = load i8, ptr %.sroa.6.0..sroa_idx, align 2, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 9, ptr nonnull %6) #6
  %24 = call noundef ptr @_ZNSt5arrayIcLm9EE4dataEv(ptr noundef nonnull align 1 dereferenceable(9) %6) #7
  %.sroa.0.0.extract.trunc = trunc i64 %.sroa.0.0.copyload to i48
  store i48 %.sroa.0.0.extract.trunc, ptr %24, align 1
  %25 = getelementptr inbounds i8, ptr %24, i64 6
  store i16 %.sroa.5.0.copyload, ptr %25, align 1
  %26 = getelementptr inbounds i8, ptr %24, i64 8
  store i8 %.sroa.6.0.copyload, ptr %26, align 1
  %27 = call noundef ptr @_ZNKSt10unique_ptrIN2BT11FileLogger25PImplESt14default_deleteIS2_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #6
  %28 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSo5writeEPKcl(ptr noundef nonnull align 8 dereferenceable(8) %27, ptr noundef nonnull %24, i64 noundef 9)
          to label %29 unwind label %36

29:                                               ; preds = %.lr.ph
  call void @_ZNSt5dequeIN2BT11FileLogger210TransitionESaIS2_EE9pop_frontEv(ptr noundef nonnull align 8 dereferenceable(80) %2) #6
  call void @llvm.lifetime.end.p0(i64 9, ptr nonnull %6) #6
  %30 = call noundef zeroext i1 @_ZNKSt5dequeIN2BT11FileLogger210TransitionESaIS2_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %2) #6
  br i1 %30, label %._crit_edge, label %.lr.ph, !llvm.loop !14

31:                                               ; preds = %12
  %32 = landingpad { ptr, i32 }
          cleanup
  br label %35

33:                                               ; preds = %15
  %34 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  call void @_ZNSt11unique_lockISt5mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(9) %3) #6
  br label %35

35:                                               ; preds = %33, %31
  %.pn = phi { ptr, i32 } [ %34, %33 ], [ %32, %31 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #6
  br label %43

36:                                               ; preds = %.lr.ph
  %37 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 9, ptr nonnull %6) #6
  br label %43

._crit_edge:                                      ; preds = %29, %19
  %38 = call noundef ptr @_ZNKSt10unique_ptrIN2BT11FileLogger25PImplESt14default_deleteIS2_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #6
  %39 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSo5flushEv(ptr noundef nonnull align 8 dereferenceable(8) %38)
          to label %8 unwind label %40, !llvm.loop !16

40:                                               ; preds = %._crit_edge
  %41 = landingpad { ptr, i32 }
          cleanup
  br label %43

42:                                               ; preds = %8
  call void @_ZNSt5dequeIN2BT11FileLogger210TransitionESaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %2) #6
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %2) #6
  ret void

43:                                               ; preds = %40, %36, %35
  %.pn5 = phi { ptr, i32 } [ %37, %36 ], [ %41, %40 ], [ %.pn, %35 ]
  call void @_ZNSt5dequeIN2BT11FileLogger210TransitionESaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %2) #6
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %2) #6
  resume { ptr, i32 } %.pn5
}

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSo5flushEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5dequeIN2BT11FileLogger210TransitionESaIS2_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #3 align 2

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

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

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

; Function Attrs: mustprogress uwtable
declare hidden noundef zeroext i1 @"_ZNSt18condition_variable8wait_forIlSt5ratioILl1ELl1000EEZN2BT11FileLogger210writerLoopEvE3$_0EEbRSt11unique_lockISt5mutexERKNSt6chrono8durationIT_T0_EET1_"(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(9), ptr noundef nonnull align 8 dereferenceable(8), ptr) local_unnamed_addr #3 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapIN2BT11FileLogger210TransitionESaIS2_EEvRSt5dequeIT_T0_ES8_(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #4

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

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

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

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
declare dso_local noundef ptr @_ZNSt5arrayIcLm9EE4dataEv(ptr noundef nonnull align 1 dereferenceable(9)) local_unnamed_addr #5 align 2

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

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

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 = { 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 = { 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 = { mustprogress nofree nosync nounwind willreturn memory(none) 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 = { nounwind willreturn memory(none) }

!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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass