; LLVM IR from NTHU-LSALAB/Gemini :: src/pod-manager.ll (Z18hook_kernel_launchidd)

; 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::queue" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<request, std::allocator<request>>::_Deque_impl" }
%"struct.std::_Deque_base<request, std::allocator<request>>::_Deque_impl" = type { %"struct.std::_Deque_base<request, std::allocator<request>>::_Deque_impl_data" }
%"struct.std::_Deque_base<request, std::allocator<request>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%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 }
%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::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, std::pair<const int, response>, std::_Select1st<std::pair<const int, response>>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, std::pair<const int, response>, std::_Select1st<std::pair<const int, response>>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"class.std::map.8" = type { %"class.std::_Rb_tree.9" }
%"class.std::_Rb_tree.9" = type { %"struct.std::_Rb_tree<int, std::pair<const int, double>, std::_Select1st<std::pair<const int, double>>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, std::pair<const int, double>, std::_Select1st<std::pair<const int, double>>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"class.std::chrono::time_point" = type { %"class.std::chrono::duration" }
%"class.std::chrono::duration" = type { i64 }
%"class.std::chrono::duration.23" = type { i64 }
%"struct.std::_Rb_tree_iterator.19" = type { ptr }
%"struct.std::pair.24" = type { i32, double }
%struct.request = type { i32, ptr }
%"struct.std::_Rb_tree_iterator.26" = type { ptr }
%struct.response = type { ptr }

@request_queue = external dso_local global %"class.std::queue", align 8
@req_queue_mutex = external dso_local global %union.pthread_mutex_t, align 8
@req_queue_cond = external dso_local global %union.pthread_cond_t, align 8
@response_map = external dso_local global %"class.std::map", align 8
@rsp_map_mutex = external dso_local global %union.pthread_mutex_t, align 8
@rsp_map_cond = external dso_local global %union.pthread_cond_t, align 8
@pod_overuse_ms = external dso_local global double, align 8
@client_burst_map = external dso_local global %"class.std::map.8", align 8
@client_stat_mutex = external dso_local global %union.pthread_mutex_t, align 8
@pod_quota = external dso_local global double, align 8
@quota_updated_tp = external dso_local global %"class.std::chrono::time_point", align 8
@quota_state = external dso_local global i32, align 4
@quota_state_mutex = external dso_local global %union.pthread_mutex_t, align 8
@quota_state_cond = external dso_local global %union.pthread_cond_t, align 8
@.str.17 = external hidden unnamed_addr constant [35 x i8], align 1

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

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

declare noundef i32 @_Z15prepare_requestPc14comm_request_tz(ptr noundef, i32 noundef, ...) #2

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

; Function Attrs: nounwind
declare i64 @_ZNSt6chrono3_V212steady_clock3nowEv() #3

; 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) #4

; Function Attrs: nounwind
declare i32 @pthread_mutex_lock(ptr noundef) #3

; Function Attrs: nounwind
declare i32 @pthread_mutex_unlock(ptr noundef) #3

declare void @_Z5DEBUGPKcz(ptr noundef, ...) #2

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_Z18hook_kernel_launchidd(i32 noundef %0, double noundef %1, double noundef %2) #5 {
  %4 = alloca i32, align 4
  %5 = alloca double, align 8
  %6 = alloca double, align 8
  %7 = alloca %"class.std::chrono::time_point", align 8
  %8 = alloca double, align 8
  %9 = alloca %"class.std::chrono::duration.23", align 8
  %10 = alloca %"class.std::chrono::duration", align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i8, align 1
  %14 = alloca i64, align 8
  %15 = alloca double, align 8
  %16 = alloca ptr, align 8
  %17 = alloca %"struct.std::_Rb_tree_iterator.19", align 8
  %18 = alloca %"struct.std::_Rb_tree_iterator.19", align 8
  %19 = alloca %"struct.std::pair.24", align 8
  %20 = alloca %struct.request, align 8
  %21 = alloca %"struct.std::_Rb_tree_iterator.26", align 8
  %22 = alloca %"struct.std::_Rb_tree_iterator.26", align 8
  %23 = alloca %"class.std::chrono::time_point", align 8
  store i32 %0, ptr %4, align 4, !tbaa !5
  store double %1, ptr %5, align 8, !tbaa !9
  store double %2, ptr %6, align 8, !tbaa !9
  br label %24

24:                                               ; preds = %33, %3
  %25 = call i32 @pthread_mutex_lock(ptr noundef @quota_state_mutex) #10
  %26 = load i32, ptr @quota_state, align 4, !tbaa !5
  %27 = icmp eq i32 %26, 0
  br i1 %27, label %28, label %30

28:                                               ; preds = %24
  %29 = call i32 @pthread_mutex_unlock(ptr noundef @quota_state_mutex) #10
  br label %34

30:                                               ; preds = %24
  call void (ptr, ...) @_Z5DEBUGPKcz(ptr noundef @.str.17)
  %31 = call i32 @pthread_cond_wait(ptr noundef @quota_state_cond, ptr noundef @quota_state_mutex)
  %32 = call i32 @pthread_mutex_unlock(ptr noundef @quota_state_mutex) #10
  br label %33

33:                                               ; preds = %30
  br label %24, !llvm.loop !11

34:                                               ; preds = %28
  %35 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) @pod_overuse_ms)
  %36 = load double, ptr %35, align 8, !tbaa !9
  store double %36, ptr @pod_overuse_ms, align 8, !tbaa !9
  %37 = call i32 @pthread_mutex_lock(ptr noundef @client_stat_mutex) #10
  %38 = load double, ptr %6, align 8, !tbaa !9
  %39 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIidSt4lessIiESaISt4pairIKidEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @client_burst_map, ptr noundef nonnull align 4 dereferenceable(4) %4)
  store double %38, ptr %39, align 8, !tbaa !9
  %40 = call i32 @pthread_mutex_unlock(ptr noundef @client_stat_mutex) #10
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #10
  %41 = call i64 @_ZNSt6chrono3_V212steady_clock3nowEv() #10
  %42 = getelementptr inbounds %"class.std::chrono::time_point", ptr %7, i32 0, i32 0
  %43 = getelementptr inbounds %"class.std::chrono::duration", ptr %42, i32 0, i32 0
  store i64 %41, ptr %43, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #10
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #10
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #10
  %44 = call i64 @_ZNSt6chronomiINS_3_V212steady_clockENS_8durationIlSt5ratioILl1ELl1000000000EEEES6_EENSt11common_typeIJT0_T1_EE4typeERKNS_10time_pointIT_S8_EERKNSC_ISD_S9_EE(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) @quota_updated_tp)
  %45 = getelementptr inbounds %"class.std::chrono::duration", ptr %10, i32 0, i32 0
  store i64 %44, ptr %45, align 8
  %46 = call i64 @_ZNSt6chrono13duration_castINS_8durationIlSt5ratioILl1ELl1000000EEEElS2_ILl1ELl1000000000EEEENSt9enable_ifIXsr13__is_durationIT_EE5valueES7_E4typeERKNS1_IT0_T1_EE(ptr noundef nonnull align 8 dereferenceable(8) %10)
  %47 = getelementptr inbounds %"class.std::chrono::duration.23", ptr %9, i32 0, i32 0
  store i64 %46, ptr %47, align 8
  %48 = call noundef i64 @_ZNKSt6chrono8durationIlSt5ratioILl1ELl1000000EEE5countEv(ptr noundef nonnull align 8 dereferenceable(8) %9)
  %49 = sitofp i64 %48 to double
  %50 = fdiv double %49, 1.000000e+03
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #10
  store double %50, ptr %8, align 8, !tbaa !9
  %51 = load double, ptr %8, align 8, !tbaa !9
  %52 = load double, ptr %6, align 8, !tbaa !9
  %53 = fadd double %51, %52
  %54 = load double, ptr @pod_quota, align 8, !tbaa !9
  %55 = fcmp ogt double %53, %54
  br i1 %55, label %56, label %123

56:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #10
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #10
  call void @llvm.lifetime.start.p0(i64 1, ptr %13) #10
  store i8 0, ptr %13, align 1, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #10
  store i64 0, ptr %14, align 8, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #10
  store double 0.000000e+00, ptr %15, align 8, !tbaa !9
  %57 = call i32 @pthread_mutex_lock(ptr noundef @quota_state_mutex) #10
  store i32 1, ptr @quota_state, align 4, !tbaa !5
  %58 = call i32 @pthread_mutex_unlock(ptr noundef @quota_state_mutex) #10
  %59 = call i32 @pthread_mutex_lock(ptr noundef @client_stat_mutex) #10
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #10
  store ptr @client_burst_map, ptr %16, align 8, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #10
  %60 = call ptr @_ZNSt3mapIidSt4lessIiESaISt4pairIKidEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @client_burst_map) #10
  %61 = getelementptr inbounds %"struct.std::_Rb_tree_iterator.19", ptr %17, i32 0, i32 0
  store ptr %60, ptr %61, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #10
  %62 = call ptr @_ZNSt3mapIidSt4lessIiESaISt4pairIKidEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @client_burst_map) #10
  %63 = getelementptr inbounds %"struct.std::_Rb_tree_iterator.19", ptr %18, i32 0, i32 0
  store ptr %62, ptr %63, align 8
  br label %64

64:                                               ; preds = %72, %56
  %65 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKidEES5_(ptr noundef nonnull align 8 dereferenceable(8) %17, ptr noundef nonnull align 8 dereferenceable(8) %18) #10
  br i1 %65, label %67, label %66

66:                                               ; preds = %64
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #10
  br label %74

67:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 16, ptr %19) #10
  %68 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKidEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %17) #10
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %19, ptr align 8 %68, i64 16, i1 false)
  %69 = getelementptr inbounds %"struct.std::pair.24", ptr %19, i32 0, i32 1
  %70 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %69, ptr noundef nonnull align 8 dereferenceable(8) %15)
  %71 = load double, ptr %70, align 8, !tbaa !9
  store double %71, ptr %15, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 16, ptr %19) #10
  br label %72

72:                                               ; preds = %67
  %73 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKidEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %17) #10
  br label %64

74:                                               ; preds = %66
  %75 = call i32 @pthread_mutex_unlock(ptr noundef @client_stat_mutex) #10
  %76 = call i32 @pthread_mutex_lock(ptr noundef @req_queue_mutex) #10
  %77 = call noalias noundef nonnull ptr @_Znam(i64 noundef 80) #11
  store ptr %77, ptr %11, align 8, !tbaa !17
  %78 = load ptr, ptr %11, align 8, !tbaa !17
  call void @llvm.memset.p0.i64(ptr align 1 %78, i8 0, i64 80, i1 false)
  %79 = load ptr, ptr %11, align 8, !tbaa !17
  %80 = load double, ptr @pod_overuse_ms, align 8, !tbaa !9
  %81 = load double, ptr %15, align 8, !tbaa !9
  %82 = call noundef i32 (ptr, i32, ...) @_Z15prepare_requestPc14comm_request_tz(ptr noundef %79, i32 noundef 0, double noundef %80, double noundef %81)
  store i32 %82, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %20) #10
  %83 = getelementptr inbounds %struct.request, ptr %20, i32 0, i32 0
  %84 = load i32, ptr %12, align 4, !tbaa !5
  store i32 %84, ptr %83, align 8, !tbaa !19
  %85 = getelementptr inbounds %struct.request, ptr %20, i32 0, i32 1
  %86 = load ptr, ptr %11, align 8, !tbaa !17
  store ptr %86, ptr %85, align 8, !tbaa !21
  call void @_ZNSt5queueI7requestSt5dequeIS0_SaIS0_EEE4pushEOS0_(ptr noundef nonnull align 8 dereferenceable(80) @request_queue, ptr noundef nonnull align 8 dereferenceable(16) %20)
  call void @llvm.lifetime.end.p0(i64 16, ptr %20) #10
  %87 = call i32 @pthread_cond_signal(ptr noundef @req_queue_cond) #10
  %88 = call i32 @pthread_mutex_unlock(ptr noundef @req_queue_mutex) #10
  br label %89

89:                                               ; preds = %116, %74
  %90 = load i8, ptr %13, align 1, !tbaa !13, !range !22, !noundef !23
  %91 = trunc i8 %90 to i1
  %92 = xor i1 %91, true
  br i1 %92, label %93, label %118

93:                                               ; preds = %89
  %94 = call i32 @pthread_mutex_lock(ptr noundef @rsp_map_mutex) #10
  %95 = call i32 @pthread_cond_wait(ptr noundef @rsp_map_cond, ptr noundef @rsp_map_mutex)
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #10
  %96 = call ptr @_ZNSt3mapIi8responseSt4lessIiESaISt4pairIKiS0_EEE4findERS4_(ptr noundef nonnull align 8 dereferenceable(48) @response_map, ptr noundef nonnull align 4 dereferenceable(4) %12)
  %97 = getelementptr inbounds %"struct.std::_Rb_tree_iterator.26", ptr %21, i32 0, i32 0
  store ptr %96, ptr %97, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #10
  %98 = call ptr @_ZNSt3mapIi8responseSt4lessIiESaISt4pairIKiS0_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @response_map) #10
  %99 = getelementptr inbounds %"struct.std::_Rb_tree_iterator.26", ptr %22, i32 0, i32 0
  store ptr %98, ptr %99, align 8
  %100 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKi8responseEES6_(ptr noundef nonnull align 8 dereferenceable(8) %21, ptr noundef nonnull align 8 dereferenceable(8) %22) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #10
  br i1 %100, label %101, label %116

101:                                              ; preds = %93
  store i8 1, ptr %13, align 1, !tbaa !13
  %102 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIi8responseSt4lessIiESaISt4pairIKiS0_EEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) @response_map, ptr noundef nonnull align 4 dereferenceable(4) %12)
  %103 = getelementptr inbounds %struct.response, ptr %102, i32 0, i32 0
  %104 = load ptr, ptr %103, align 8, !tbaa !24
  %105 = call noundef double @_Z12get_msg_dataIdET_PcRm(ptr noundef %104, ptr noundef nonnull align 8 dereferenceable(8) %14)
  store double %105, ptr @pod_quota, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #10
  %106 = call i64 @_ZNSt6chrono3_V212steady_clock3nowEv() #10
  %107 = getelementptr inbounds %"class.std::chrono::time_point", ptr %23, i32 0, i32 0
  %108 = getelementptr inbounds %"class.std::chrono::duration", ptr %107, i32 0, i32 0
  store i64 %106, ptr %108, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 @quota_updated_tp, ptr align 8 %23, i64 8, i1 false), !tbaa.struct !26
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #10
  store double 0.000000e+00, ptr %8, align 8, !tbaa !9
  store double 0.000000e+00, ptr @pod_overuse_ms, align 8, !tbaa !9
  %109 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIi8responseSt4lessIiESaISt4pairIKiS0_EEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) @response_map, ptr noundef nonnull align 4 dereferenceable(4) %12)
  %110 = getelementptr inbounds %struct.response, ptr %109, i32 0, i32 0
  %111 = load ptr, ptr %110, align 8, !tbaa !24
  %112 = icmp eq ptr %111, null
  br i1 %112, label %114, label %113

113:                                              ; preds = %101
  call void @_ZdlPvm(ptr noundef %111, i64 noundef 8) #12
  br label %114

114:                                              ; preds = %113, %101
  %115 = call noundef i64 @_ZNSt3mapIi8responseSt4lessIiESaISt4pairIKiS0_EEE5eraseERS4_(ptr noundef nonnull align 8 dereferenceable(48) @response_map, ptr noundef nonnull align 4 dereferenceable(4) %12)
  br label %116

116:                                              ; preds = %114, %93
  %117 = call i32 @pthread_mutex_unlock(ptr noundef @rsp_map_mutex) #10
  br label %89, !llvm.loop !27

118:                                              ; preds = %89
  %119 = load ptr, ptr %11, align 8, !tbaa !17
  %120 = icmp eq ptr %119, null
  br i1 %120, label %122, label %121

121:                                              ; preds = %118
  call void @_ZdaPv(ptr noundef %119) #12
  br label %122

122:                                              ; preds = %121, %118
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #10
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #10
  br label %123

123:                                              ; preds = %122, %34
  %124 = call i32 @pthread_mutex_lock(ptr noundef @quota_state_mutex) #10
  store i32 0, ptr @quota_state, align 4, !tbaa !5
  %125 = call i32 @pthread_cond_broadcast(ptr noundef @quota_state_cond) #10
  %126 = call i32 @pthread_mutex_unlock(ptr noundef @quota_state_mutex) #10
  %127 = load double, ptr @pod_quota, align 8, !tbaa !9
  %128 = load double, ptr %8, align 8, !tbaa !9
  %129 = fsub double %127, %128
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #10
  ret double %129
}

declare i32 @pthread_cond_wait(ptr noundef, ptr noundef) #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #6

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIidSt4lessIiESaISt4pairIKidEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZNSt6chrono13duration_castINS_8durationIlSt5ratioILl1ELl1000000EEEElS2_ILl1ELl1000000000EEEENSt9enable_ifIXsr13__is_durationIT_EE5valueES7_E4typeERKNS1_IT0_T1_EE(ptr noundef nonnull align 8 dereferenceable(8)) #5

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKidEES5_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #7

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5queueI7requestSt5dequeIS0_SaIS0_EEE4pushEOS0_(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 8 dereferenceable(16)) #5 align 2

; Function Attrs: nounwind
declare i32 @pthread_cond_signal(ptr noundef) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKi8responseEES6_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #7

; Function Attrs: mustprogress uwtable
declare dso_local ptr @_ZNSt3mapIi8responseSt4lessIiESaISt4pairIKiS0_EEE4findERS4_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) #5 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_Z12get_msg_dataIdET_PcRm(ptr noundef, ptr noundef nonnull align 8 dereferenceable(8)) #7

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIi8responseSt4lessIiESaISt4pairIKiS0_EEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) #5 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNSt3mapIi8responseSt4lessIiESaISt4pairIKiS0_EEE5eraseERS4_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) #5 align 2

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) #9

; Function Attrs: nounwind
declare i32 @pthread_cond_broadcast(ptr noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { 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 #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 #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 = { 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 #9 = { 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 #10 = { nounwind }
attributes #11 = { builtin allocsize(0) }
attributes #12 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"long", !7, i64 0}
!17 = !{!18, !18, i64 0}
!18 = !{!"any pointer", !7, i64 0}
!19 = !{!20, !6, i64 0}
!20 = !{!"_ZTS7request", !6, i64 0, !18, i64 8}
!21 = !{!20, !18, i64 8}
!22 = !{i8 0, i8 2}
!23 = !{}
!24 = !{!25, !18, i64 0}
!25 = !{!"_ZTS8response", !18, i64 0}
!26 = !{i64 0, i64 8, !15}
!27 = distinct !{!27, !12}


; 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::queue" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<request, std::allocator<request>>::_Deque_impl" }
%"struct.std::_Deque_base<request, std::allocator<request>>::_Deque_impl" = type { %"struct.std::_Deque_base<request, std::allocator<request>>::_Deque_impl_data" }
%"struct.std::_Deque_base<request, std::allocator<request>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%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 }
%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::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, std::pair<const int, response>, std::_Select1st<std::pair<const int, response>>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, std::pair<const int, response>, std::_Select1st<std::pair<const int, response>>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"class.std::map.8" = type { %"class.std::_Rb_tree.9" }
%"class.std::_Rb_tree.9" = type { %"struct.std::_Rb_tree<int, std::pair<const int, double>, std::_Select1st<std::pair<const int, double>>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, std::pair<const int, double>, std::_Select1st<std::pair<const int, double>>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"class.std::chrono::time_point" = type { %"class.std::chrono::duration" }
%"class.std::chrono::duration" = type { i64 }
%"class.std::chrono::duration.23" = type { i64 }
%"struct.std::_Rb_tree_iterator.19" = type { ptr }
%"struct.std::pair.24" = type { i32, double }
%struct.request = type { i32, ptr }
%"struct.std::_Rb_tree_iterator.26" = type { ptr }

@request_queue = external dso_local global %"class.std::queue", align 8
@req_queue_mutex = external dso_local global %union.pthread_mutex_t, align 8
@req_queue_cond = external dso_local global %union.pthread_cond_t, align 8
@response_map = external dso_local global %"class.std::map", align 8
@rsp_map_mutex = external dso_local global %union.pthread_mutex_t, align 8
@rsp_map_cond = external dso_local global %union.pthread_cond_t, align 8
@pod_overuse_ms = external dso_local global double, align 8
@client_burst_map = external dso_local global %"class.std::map.8", align 8
@client_stat_mutex = external dso_local global %union.pthread_mutex_t, align 8
@pod_quota = external dso_local local_unnamed_addr global double, align 8
@quota_updated_tp = external dso_local global %"class.std::chrono::time_point", align 8
@quota_state = external dso_local local_unnamed_addr global i32, align 4
@quota_state_mutex = external dso_local global %union.pthread_mutex_t, align 8
@quota_state_cond = external dso_local global %union.pthread_cond_t, align 8
@.str.17 = external hidden unnamed_addr constant [35 x i8], align 1

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

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

declare noundef i32 @_Z15prepare_requestPc14comm_request_tz(ptr noundef, i32 noundef, ...) local_unnamed_addr #2

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

; Function Attrs: nounwind
declare i64 @_ZNSt6chrono3_V212steady_clock3nowEv() local_unnamed_addr #3

; Function Attrs: mustprogress 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) #4

; Function Attrs: nounwind
declare i32 @pthread_mutex_lock(ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind
declare i32 @pthread_mutex_unlock(ptr noundef) local_unnamed_addr #3

declare void @_Z5DEBUGPKcz(ptr noundef, ...) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_Z18hook_kernel_launchidd(i32 noundef %0, double noundef %1, double noundef %2) local_unnamed_addr #5 {
  %4 = alloca i32, align 4
  %5 = alloca double, align 8
  %6 = alloca %"class.std::chrono::time_point", align 8
  %7 = alloca %"class.std::chrono::duration.23", align 8
  %8 = alloca %"class.std::chrono::duration", align 8
  %9 = alloca i32, align 4
  %10 = alloca i64, align 8
  %11 = alloca double, align 8
  %12 = alloca %"struct.std::_Rb_tree_iterator.19", align 8
  %13 = alloca %"struct.std::_Rb_tree_iterator.19", align 8
  %14 = alloca %"struct.std::pair.24", align 8
  %15 = alloca %struct.request, align 8
  %16 = alloca %"struct.std::_Rb_tree_iterator.26", align 8
  %17 = alloca %"struct.std::_Rb_tree_iterator.26", align 8
  store i32 %0, ptr %4, align 4, !tbaa !5
  store double %1, ptr %5, align 8, !tbaa !9
  %18 = tail call i32 @pthread_mutex_lock(ptr noundef nonnull @quota_state_mutex) #10
  %19 = load i32, ptr @quota_state, align 4, !tbaa !5
  %20 = icmp eq i32 %19, 0
  br i1 %20, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %3
  %21 = tail call i32 @pthread_mutex_unlock(ptr noundef nonnull @quota_state_mutex) #10
  %22 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) @pod_overuse_ms)
  %23 = load double, ptr %22, align 8, !tbaa !9
  store double %23, ptr @pod_overuse_ms, align 8, !tbaa !9
  %24 = call i32 @pthread_mutex_lock(ptr noundef nonnull @client_stat_mutex) #10
  %25 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIidSt4lessIiESaISt4pairIKidEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @client_burst_map, ptr noundef nonnull align 4 dereferenceable(4) %4)
  store double %2, ptr %25, align 8, !tbaa !9
  %26 = call i32 @pthread_mutex_unlock(ptr noundef nonnull @client_stat_mutex) #10
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #10
  %27 = call i64 @_ZNSt6chrono3_V212steady_clock3nowEv() #10
  store i64 %27, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #10
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #10
  %28 = call i64 @_ZNSt6chronomiINS_3_V212steady_clockENS_8durationIlSt5ratioILl1ELl1000000000EEEES6_EENSt11common_typeIJT0_T1_EE4typeERKNS_10time_pointIT_S8_EERKNSC_ISD_S9_EE(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) @quota_updated_tp)
  store i64 %28, ptr %8, align 8
  %29 = call i64 @_ZNSt6chrono13duration_castINS_8durationIlSt5ratioILl1ELl1000000EEEElS2_ILl1ELl1000000000EEEENSt9enable_ifIXsr13__is_durationIT_EE5valueES7_E4typeERKNS1_IT0_T1_EE(ptr noundef nonnull align 8 dereferenceable(8) %8)
  store i64 %29, ptr %7, align 8
  %30 = call noundef i64 @_ZNKSt6chrono8durationIlSt5ratioILl1ELl1000000EEE5countEv(ptr noundef nonnull align 8 dereferenceable(8) %7)
  %31 = sitofp i64 %30 to double
  %32 = fdiv double %31, 1.000000e+03
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #10
  %33 = fadd double %32, %2
  %34 = load double, ptr @pod_quota, align 8, !tbaa !9
  %35 = fcmp ogt double %33, %34
  br i1 %35, label %41, label %86

.lr.ph:                                           ; preds = %3, %.lr.ph
  tail call void (ptr, ...) @_Z5DEBUGPKcz(ptr noundef nonnull @.str.17)
  %36 = tail call i32 @pthread_cond_wait(ptr noundef nonnull @quota_state_cond, ptr noundef nonnull @quota_state_mutex)
  %37 = tail call i32 @pthread_mutex_unlock(ptr noundef nonnull @quota_state_mutex) #10
  %38 = tail call i32 @pthread_mutex_lock(ptr noundef nonnull @quota_state_mutex) #10
  %39 = load i32, ptr @quota_state, align 4, !tbaa !5
  %40 = icmp eq i32 %39, 0
  br i1 %40, label %._crit_edge, label %.lr.ph, !llvm.loop !11

41:                                               ; preds = %._crit_edge
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #10
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #10
  store i64 0, ptr %10, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #10
  store double 0.000000e+00, ptr %11, align 8, !tbaa !9
  %42 = call i32 @pthread_mutex_lock(ptr noundef nonnull @quota_state_mutex) #10
  store i32 1, ptr @quota_state, align 4, !tbaa !5
  %43 = call i32 @pthread_mutex_unlock(ptr noundef nonnull @quota_state_mutex) #10
  %44 = call i32 @pthread_mutex_lock(ptr noundef nonnull @client_stat_mutex) #10
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #10
  %45 = call ptr @_ZNSt3mapIidSt4lessIiESaISt4pairIKidEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @client_burst_map) #10
  store ptr %45, ptr %12, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %13) #10
  %46 = call ptr @_ZNSt3mapIidSt4lessIiESaISt4pairIKidEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @client_burst_map) #10
  store ptr %46, ptr %13, align 8
  %47 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKidEES5_(ptr noundef nonnull align 8 dereferenceable(8) %12, ptr noundef nonnull align 8 dereferenceable(8) %13) #10
  br i1 %47, label %.lr.ph12, label %._crit_edge13

.lr.ph12:                                         ; preds = %41
  %48 = getelementptr inbounds i8, ptr %14, i64 8
  br label %63

._crit_edge13:                                    ; preds = %63, %41
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #10
  %49 = call i32 @pthread_mutex_unlock(ptr noundef nonnull @client_stat_mutex) #10
  %50 = call i32 @pthread_mutex_lock(ptr noundef nonnull @req_queue_mutex) #10
  %51 = call noalias noundef nonnull dereferenceable(80) ptr @_Znam(i64 noundef 80) #11
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(80) %51, i8 0, i64 80, i1 false)
  %52 = load double, ptr @pod_overuse_ms, align 8, !tbaa !9
  %53 = load double, ptr %11, align 8, !tbaa !9
  %54 = call noundef i32 (ptr, i32, ...) @_Z15prepare_requestPc14comm_request_tz(ptr noundef nonnull %51, i32 noundef 0, double noundef %52, double noundef %53)
  store i32 %54, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %15) #10
  store i32 %54, ptr %15, align 8, !tbaa !15
  %55 = getelementptr inbounds i8, ptr %15, i64 8
  store ptr %51, ptr %55, align 8, !tbaa !18
  call void @_ZNSt5queueI7requestSt5dequeIS0_SaIS0_EEE4pushEOS0_(ptr noundef nonnull align 8 dereferenceable(80) @request_queue, ptr noundef nonnull align 8 dereferenceable(16) %15)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %15) #10
  %56 = call i32 @pthread_cond_signal(ptr noundef nonnull @req_queue_cond) #10
  %57 = call i32 @pthread_mutex_unlock(ptr noundef nonnull @req_queue_mutex) #10
  %58 = call i32 @pthread_mutex_lock(ptr noundef nonnull @rsp_map_mutex) #10
  %59 = call i32 @pthread_cond_wait(ptr noundef nonnull @rsp_map_cond, ptr noundef nonnull @rsp_map_mutex)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %16) #10
  %60 = call ptr @_ZNSt3mapIi8responseSt4lessIiESaISt4pairIKiS0_EEE4findERS4_(ptr noundef nonnull align 8 dereferenceable(48) @response_map, ptr noundef nonnull align 4 dereferenceable(4) %9)
  store ptr %60, ptr %16, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %17) #10
  %61 = call ptr @_ZNSt3mapIi8responseSt4lessIiESaISt4pairIKiS0_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @response_map) #10
  store ptr %61, ptr %17, align 8
  %62 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKi8responseEES6_(ptr noundef nonnull align 8 dereferenceable(8) %16, ptr noundef nonnull align 8 dereferenceable(8) %17) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %17) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %16) #10
  br i1 %62, label %.loopexit, label %._crit_edge13.peel.newph

63:                                               ; preds = %.lr.ph12, %63
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %14) #10
  %64 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKidEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %12) #10
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %14, ptr noundef nonnull align 8 dereferenceable(16) %64, i64 16, i1 false)
  %65 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %48, ptr noundef nonnull align 8 dereferenceable(8) %11)
  %66 = load double, ptr %65, align 8, !tbaa !9
  store double %66, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %14) #10
  %67 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKidEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %12) #10
  %68 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKidEES5_(ptr noundef nonnull align 8 dereferenceable(8) %12, ptr noundef nonnull align 8 dereferenceable(8) %13) #10
  br i1 %68, label %63, label %._crit_edge13

._crit_edge13.peel.newph:                         ; preds = %._crit_edge13, %._crit_edge13.peel.newph
  %69 = call i32 @pthread_mutex_unlock(ptr noundef nonnull @rsp_map_mutex) #10
  %70 = call i32 @pthread_mutex_lock(ptr noundef nonnull @rsp_map_mutex) #10
  %71 = call i32 @pthread_cond_wait(ptr noundef nonnull @rsp_map_cond, ptr noundef nonnull @rsp_map_mutex)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %16) #10
  %72 = call ptr @_ZNSt3mapIi8responseSt4lessIiESaISt4pairIKiS0_EEE4findERS4_(ptr noundef nonnull align 8 dereferenceable(48) @response_map, ptr noundef nonnull align 4 dereferenceable(4) %9)
  store ptr %72, ptr %16, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %17) #10
  %73 = call ptr @_ZNSt3mapIi8responseSt4lessIiESaISt4pairIKiS0_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @response_map) #10
  store ptr %73, ptr %17, align 8
  %74 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKi8responseEES6_(ptr noundef nonnull align 8 dereferenceable(8) %16, ptr noundef nonnull align 8 dereferenceable(8) %17) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %17) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %16) #10
  br i1 %74, label %.loopexit, label %._crit_edge13.peel.newph, !llvm.loop !19

.loopexit:                                        ; preds = %._crit_edge13.peel.newph, %._crit_edge13
  %75 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIi8responseSt4lessIiESaISt4pairIKiS0_EEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) @response_map, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %76 = load ptr, ptr %75, align 8, !tbaa !21
  %77 = call noundef double @_Z12get_msg_dataIdET_PcRm(ptr noundef %76, ptr noundef nonnull align 8 dereferenceable(8) %10)
  store double %77, ptr @pod_quota, align 8, !tbaa !9
  %78 = call i64 @_ZNSt6chrono3_V212steady_clock3nowEv() #10
  store i64 %78, ptr @quota_updated_tp, align 8, !tbaa !13
  store double 0.000000e+00, ptr @pod_overuse_ms, align 8, !tbaa !9
  %79 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIi8responseSt4lessIiESaISt4pairIKiS0_EEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) @response_map, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %80 = load ptr, ptr %79, align 8, !tbaa !21
  %81 = icmp eq ptr %80, null
  br i1 %81, label %83, label %82

82:                                               ; preds = %.loopexit
  call void @_ZdlPvm(ptr noundef nonnull %80, i64 noundef 8) #12
  br label %83

83:                                               ; preds = %.loopexit, %82
  %84 = call noundef i64 @_ZNSt3mapIi8responseSt4lessIiESaISt4pairIKiS0_EEE5eraseERS4_(ptr noundef nonnull align 8 dereferenceable(48) @response_map, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %85 = call i32 @pthread_mutex_unlock(ptr noundef nonnull @rsp_map_mutex) #10
  call void @_ZdaPv(ptr noundef nonnull %51) #12
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #10
  br label %86

86:                                               ; preds = %83, %._crit_edge
  %.2 = phi double [ 0.000000e+00, %83 ], [ %32, %._crit_edge ]
  %87 = call i32 @pthread_mutex_lock(ptr noundef nonnull @quota_state_mutex) #10
  store i32 0, ptr @quota_state, align 4, !tbaa !5
  %88 = call i32 @pthread_cond_broadcast(ptr noundef nonnull @quota_state_cond) #10
  %89 = call i32 @pthread_mutex_unlock(ptr noundef nonnull @quota_state_mutex) #10
  %90 = load double, ptr @pod_quota, align 8, !tbaa !9
  %91 = fsub double %90, %.2
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #10
  ret double %91
}

declare i32 @pthread_cond_wait(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #6

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIidSt4lessIiESaISt4pairIKidEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZNSt6chrono13duration_castINS_8durationIlSt5ratioILl1ELl1000000EEEElS2_ILl1ELl1000000000EEEENSt9enable_ifIXsr13__is_durationIT_EE5valueES7_E4typeERKNS1_IT0_T1_EE(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #5

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZNSt6chronomiINS_3_V212steady_clockENS_8durationIlSt5ratioILl1ELl1000000000EEEES6_EENSt11common_typeIJT0_T1_EE4typeERKNS_10time_pointIT_S8_EERKNSC_ISD_S9_EE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #5

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKidEES5_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #7

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5queueI7requestSt5dequeIS0_SaIS0_EEE4pushEOS0_(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #5 align 2

; Function Attrs: nounwind
declare i32 @pthread_cond_signal(ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKi8responseEES6_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #7

; Function Attrs: mustprogress uwtable
declare dso_local ptr @_ZNSt3mapIi8responseSt4lessIiESaISt4pairIKiS0_EEE4findERS4_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #5 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_Z12get_msg_dataIdET_PcRm(ptr noundef, ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #7

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIi8responseSt4lessIiESaISt4pairIKiS0_EEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #5 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNSt3mapIi8responseSt4lessIiESaISt4pairIKiS0_EEE5eraseERS4_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #5 align 2

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) local_unnamed_addr #9

; Function Attrs: nounwind
declare i32 @pthread_cond_broadcast(ptr noundef) local_unnamed_addr #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { 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 #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 #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 = { 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 #9 = { 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 #10 = { nounwind }
attributes #11 = { builtin allocsize(0) }
attributes #12 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!16, !6, i64 0}
!16 = !{!"_ZTS7request", !6, i64 0, !17, i64 8}
!17 = !{!"any pointer", !7, i64 0}
!18 = !{!16, !17, i64 8}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.peeled.count", i32 1}
!21 = !{!22, !17, i64 0}
!22 = !{!"_ZTS8response", !17, i64 0}


; Effective O3 passes: ADCEPass,AggressiveInstCombinePass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass