; LLVM IR from mitdbg/deneva :: system/work_queue.ll (ZN10QWorkQueue7dequeueEm)

; 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.mem_alloc = type { i8 }
%class.Stats = type { ptr, ptr, i64, i64, i64, i64 }
%class.QWorkQueue = type { ptr, ptr, ptr, ptr, i64, ptr, i64 }
%class.Stats_thd = type { [64 x i8], ptr, ptr, double, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, double, i64, double, i64, double, i64, i64, double, double, double, double, double, double, double, double, i64, double, double, double, double, double, double, double, double, i64, i64, double, i64, double, i64, double, double, double, i64, i64, i64, double, double, double, double, double, double, double, double, double, i64, ptr, ptr, double, i64, i64, double, double, double, i64, i64, i64, i64, i64, i64, i64, double, double, double, i64, i64, i64, i64, i64, i64, i64, i64, i64, double, double, double, double, double, i64, i64, double, double, i64, i64, i64, double, double, i64, i64, double, double, double, double, i64, i64, double, double, double, i64, i64, double, double, double, double, double, i64, double, double, double, double, double, double, double, double, i64, i64, i64, double, i64, double, double, i64, i64, i64, i64, i64, double, i64, i64, double, i64, double, double, i64, i64, i64, i64, i64, double, double, double, %class.StatsArr, %class.StatsArr, %class.StatsArr, %class.StatsArr, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, ptr, [64 x i8] }
%class.StatsArr = type { ptr, i64, i64, i32, %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 }
%struct.work_queue_entry = type { ptr, i64, i64, i32, i64 }
%class.Message = type { ptr, i32, i64, i64, i64, i64, i64, i64, double, double, double, double, double, double, double }

@g_node_cnt = external global i32, align 4
@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [69 x i8], align 1
@mem_allocator = external global %class.mem_alloc, align 1
@g_node_id = external global i32, align 4
@simulation = external global ptr, align 8
@stats = external global %class.Stats, align 8
@g_client_node_cnt = external global i32, align 4
@g_repl_cnt = external global i32, align 4
@.str.4 = external hidden unnamed_addr constant [22 x i8], align 1
@__PRETTY_FUNCTION__._ZN10QWorkQueue7dequeueEm = external hidden unnamed_addr constant [39 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 nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

declare noundef i64 @_Z13get_sys_clockv() #1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #2

declare noundef zeroext i1 @_ZN10SimManager14is_warmup_doneEv(ptr noundef nonnull align 8 dereferenceable(96)) #1

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN5boost8lockfree5queueIP16work_queue_entryJEE3popERS3_(ptr noundef nonnull align 8 dereferenceable(136), ptr noundef nonnull align 8 dereferenceable(8)) #3 align 2

declare void @_ZN9mem_alloc4freeEPvm(ptr noundef nonnull align 1 dereferenceable(1), ptr noundef, i64 noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN10QWorkQueue7dequeueEm(ptr noundef nonnull align 8 dereferenceable(56) %0, i64 noundef %1) #3 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca i8, align 1
  %10 = alloca i64, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i64 %1, ptr %4, align 8, !tbaa !9
  %11 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %12 = call noundef i64 @_Z13get_sys_clockv()
  store i64 %12, ptr %5, align 8, !tbaa !9
  %13 = load i32, ptr @g_node_id, align 4, !tbaa !11
  %14 = load i32, ptr @g_node_cnt, align 4, !tbaa !11
  %15 = icmp ult i32 %13, %14
  br i1 %15, label %34, label %16

16:                                               ; preds = %2
  %17 = load i32, ptr @g_node_id, align 4, !tbaa !11
  %18 = load i32, ptr @g_node_cnt, align 4, !tbaa !11
  %19 = load i32, ptr @g_client_node_cnt, align 4, !tbaa !11
  %20 = add i32 %18, %19
  %21 = icmp uge i32 %17, %20
  br i1 %21, label %22, label %32

22:                                               ; preds = %16
  %23 = load i32, ptr @g_node_id, align 4, !tbaa !11
  %24 = load i32, ptr @g_node_cnt, align 4, !tbaa !11
  %25 = load i32, ptr @g_client_node_cnt, align 4, !tbaa !11
  %26 = add i32 %24, %25
  %27 = load i32, ptr @g_repl_cnt, align 4, !tbaa !11
  %28 = load i32, ptr @g_node_cnt, align 4, !tbaa !11
  %29 = mul i32 %27, %28
  %30 = add i32 %26, %29
  %31 = icmp ult i32 %23, %30
  br label %32

32:                                               ; preds = %22, %16
  %33 = phi i1 [ false, %16 ], [ %31, %22 ]
  br label %34

34:                                               ; preds = %32, %2
  %35 = phi i1 [ true, %2 ], [ %33, %32 ]
  br i1 %35, label %36, label %37

36:                                               ; preds = %34
  br label %39

37:                                               ; preds = %34
  call void @__assert_fail(ptr noundef @.str.4, ptr noundef @.str.1, i32 noundef 184, ptr noundef @__PRETTY_FUNCTION__._ZN10QWorkQueue7dequeueEm) #5
  unreachable

38:                                               ; No predecessors!
  br label %39

39:                                               ; preds = %38, %36
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  store ptr null, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  store ptr null, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %40 = call noundef i64 @_Z13get_sys_clockv()
  store i64 %40, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #4
  %41 = getelementptr inbounds %class.QWorkQueue, ptr %11, i32 0, i32 0
  %42 = load ptr, ptr %41, align 8, !tbaa !13
  %43 = call noundef zeroext i1 @_ZN5boost8lockfree5queueIP16work_queue_entryJEE3popERS3_(ptr noundef nonnull align 8 dereferenceable(136) %42, ptr noundef nonnull align 8 dereferenceable(8) %7)
  %44 = zext i1 %43 to i8
  store i8 %44, ptr %9, align 1, !tbaa !15
  %45 = load i8, ptr %9, align 1, !tbaa !15, !range !17, !noundef !18
  %46 = trunc i8 %45 to i1
  br i1 %46, label %52, label %47

47:                                               ; preds = %39
  %48 = getelementptr inbounds %class.QWorkQueue, ptr %11, i32 0, i32 1
  %49 = load ptr, ptr %48, align 8, !tbaa !19
  %50 = call noundef zeroext i1 @_ZN5boost8lockfree5queueIP16work_queue_entryJEE3popERS3_(ptr noundef nonnull align 8 dereferenceable(136) %49, ptr noundef nonnull align 8 dereferenceable(8) %7)
  %51 = zext i1 %50 to i8
  store i8 %51, ptr %9, align 1, !tbaa !15
  br label %52

52:                                               ; preds = %47, %39
  %53 = load ptr, ptr @simulation, align 8, !tbaa !5
  %54 = call noundef zeroext i1 @_ZN10SimManager14is_warmup_doneEv(ptr noundef nonnull align 8 dereferenceable(96) %53)
  br i1 %54, label %55, label %69

55:                                               ; preds = %52
  %56 = call noundef i64 @_Z13get_sys_clockv()
  %57 = load i64, ptr %8, align 8, !tbaa !9
  %58 = sub i64 %56, %57
  %59 = uitofp i64 %58 to double
  %60 = load ptr, ptr @stats, align 8, !tbaa !20
  %61 = load i64, ptr %4, align 8, !tbaa !9
  %62 = getelementptr inbounds ptr, ptr %60, i64 %61
  %63 = load ptr, ptr %62, align 8, !tbaa !5
  %64 = getelementptr inbounds %class.Stats_thd, ptr %63, i32 0, i32 197
  %65 = load ptr, ptr %64, align 8, !tbaa !22
  %66 = getelementptr inbounds double, ptr %65, i64 14
  %67 = load double, ptr %66, align 8, !tbaa !27
  %68 = fadd double %67, %59
  store double %68, ptr %66, align 8, !tbaa !27
  br label %69

69:                                               ; preds = %55, %52
  %70 = load i8, ptr %9, align 1, !tbaa !15, !range !17, !noundef !18
  %71 = trunc i8 %70 to i1
  br i1 %71, label %72, label %185

72:                                               ; preds = %69
  %73 = load ptr, ptr %7, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.work_queue_entry, ptr %73, i32 0, i32 0
  %75 = load ptr, ptr %74, align 8, !tbaa !28
  store ptr %75, ptr %6, align 8, !tbaa !5
  %76 = load ptr, ptr %6, align 8, !tbaa !5
  %77 = icmp ne ptr %76, null
  br i1 %77, label %78, label %79

78:                                               ; preds = %72
  br label %81

79:                                               ; preds = %72
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 206, ptr noundef @__PRETTY_FUNCTION__._ZN10QWorkQueue7dequeueEm) #5
  unreachable

80:                                               ; No predecessors!
  br label %81

81:                                               ; preds = %80, %78
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %82 = call noundef i64 @_Z13get_sys_clockv()
  %83 = load ptr, ptr %7, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.work_queue_entry, ptr %83, i32 0, i32 4
  %85 = load i64, ptr %84, align 8, !tbaa !31
  %86 = sub i64 %82, %85
  store i64 %86, ptr %10, align 8, !tbaa !9
  %87 = load ptr, ptr @simulation, align 8, !tbaa !5
  %88 = call noundef zeroext i1 @_ZN10SimManager14is_warmup_doneEv(ptr noundef nonnull align 8 dereferenceable(96) %87)
  br i1 %88, label %89, label %99

89:                                               ; preds = %81
  %90 = load i64, ptr %10, align 8, !tbaa !9
  %91 = uitofp i64 %90 to double
  %92 = load ptr, ptr @stats, align 8, !tbaa !20
  %93 = load i64, ptr %4, align 8, !tbaa !9
  %94 = getelementptr inbounds ptr, ptr %92, i64 %93
  %95 = load ptr, ptr %94, align 8, !tbaa !5
  %96 = getelementptr inbounds %class.Stats_thd, ptr %95, i32 0, i32 39
  %97 = load double, ptr %96, align 8, !tbaa !32
  %98 = fadd double %97, %91
  store double %98, ptr %96, align 8, !tbaa !32
  br label %99

99:                                               ; preds = %89, %81
  %100 = load ptr, ptr @simulation, align 8, !tbaa !5
  %101 = call noundef zeroext i1 @_ZN10SimManager14is_warmup_doneEv(ptr noundef nonnull align 8 dereferenceable(96) %100)
  br i1 %101, label %102, label %110

102:                                              ; preds = %99
  %103 = load ptr, ptr @stats, align 8, !tbaa !20
  %104 = load i64, ptr %4, align 8, !tbaa !9
  %105 = getelementptr inbounds ptr, ptr %103, i64 %104
  %106 = load ptr, ptr %105, align 8, !tbaa !5
  %107 = getelementptr inbounds %class.Stats_thd, ptr %106, i32 0, i32 40
  %108 = load i64, ptr %107, align 8, !tbaa !33
  %109 = add i64 %108, 1
  store i64 %109, ptr %107, align 8, !tbaa !33
  br label %110

110:                                              ; preds = %102, %99
  %111 = load ptr, ptr %6, align 8, !tbaa !5
  %112 = getelementptr inbounds %class.Message, ptr %111, i32 0, i32 1
  %113 = load i32, ptr %112, align 8, !tbaa !34
  %114 = icmp eq i32 %113, 3
  br i1 %114, label %115, label %140

115:                                              ; preds = %110
  %116 = load ptr, ptr @simulation, align 8, !tbaa !5
  %117 = call noundef zeroext i1 @_ZN10SimManager14is_warmup_doneEv(ptr noundef nonnull align 8 dereferenceable(96) %116)
  br i1 %117, label %118, label %128

118:                                              ; preds = %115
  %119 = load i64, ptr %10, align 8, !tbaa !9
  %120 = uitofp i64 %119 to double
  %121 = load ptr, ptr @stats, align 8, !tbaa !20
  %122 = load i64, ptr %4, align 8, !tbaa !9
  %123 = getelementptr inbounds ptr, ptr %121, i64 %122
  %124 = load ptr, ptr %123, align 8, !tbaa !5
  %125 = getelementptr inbounds %class.Stats_thd, ptr %124, i32 0, i32 44
  %126 = load double, ptr %125, align 8, !tbaa !36
  %127 = fadd double %126, %120
  store double %127, ptr %125, align 8, !tbaa !36
  br label %128

128:                                              ; preds = %118, %115
  %129 = load ptr, ptr @simulation, align 8, !tbaa !5
  %130 = call noundef zeroext i1 @_ZN10SimManager14is_warmup_doneEv(ptr noundef nonnull align 8 dereferenceable(96) %129)
  br i1 %130, label %131, label %139

131:                                              ; preds = %128
  %132 = load ptr, ptr @stats, align 8, !tbaa !20
  %133 = load i64, ptr %4, align 8, !tbaa !9
  %134 = getelementptr inbounds ptr, ptr %132, i64 %133
  %135 = load ptr, ptr %134, align 8, !tbaa !5
  %136 = getelementptr inbounds %class.Stats_thd, ptr %135, i32 0, i32 43
  %137 = load i64, ptr %136, align 8, !tbaa !37
  %138 = add i64 %137, 1
  store i64 %138, ptr %136, align 8, !tbaa !37
  br label %139

139:                                              ; preds = %131, %128
  br label %165

140:                                              ; preds = %110
  %141 = load ptr, ptr @simulation, align 8, !tbaa !5
  %142 = call noundef zeroext i1 @_ZN10SimManager14is_warmup_doneEv(ptr noundef nonnull align 8 dereferenceable(96) %141)
  br i1 %142, label %143, label %153

143:                                              ; preds = %140
  %144 = load i64, ptr %10, align 8, !tbaa !9
  %145 = uitofp i64 %144 to double
  %146 = load ptr, ptr @stats, align 8, !tbaa !20
  %147 = load i64, ptr %4, align 8, !tbaa !9
  %148 = getelementptr inbounds ptr, ptr %146, i64 %147
  %149 = load ptr, ptr %148, align 8, !tbaa !5
  %150 = getelementptr inbounds %class.Stats_thd, ptr %149, i32 0, i32 46
  %151 = load double, ptr %150, align 8, !tbaa !38
  %152 = fadd double %151, %145
  store double %152, ptr %150, align 8, !tbaa !38
  br label %153

153:                                              ; preds = %143, %140
  %154 = load ptr, ptr @simulation, align 8, !tbaa !5
  %155 = call noundef zeroext i1 @_ZN10SimManager14is_warmup_doneEv(ptr noundef nonnull align 8 dereferenceable(96) %154)
  br i1 %155, label %156, label %164

156:                                              ; preds = %153
  %157 = load ptr, ptr @stats, align 8, !tbaa !20
  %158 = load i64, ptr %4, align 8, !tbaa !9
  %159 = getelementptr inbounds ptr, ptr %157, i64 %158
  %160 = load ptr, ptr %159, align 8, !tbaa !5
  %161 = getelementptr inbounds %class.Stats_thd, ptr %160, i32 0, i32 45
  %162 = load i64, ptr %161, align 8, !tbaa !39
  %163 = add i64 %162, 1
  store i64 %163, ptr %161, align 8, !tbaa !39
  br label %164

164:                                              ; preds = %156, %153
  br label %165

165:                                              ; preds = %164, %139
  %166 = load i64, ptr %10, align 8, !tbaa !9
  %167 = load ptr, ptr %6, align 8, !tbaa !5
  %168 = getelementptr inbounds %class.Message, ptr %167, i32 0, i32 5
  store i64 %166, ptr %168, align 8, !tbaa !40
  %169 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_ZN9mem_alloc4freeEPvm(ptr noundef nonnull align 1 dereferenceable(1) @mem_allocator, ptr noundef %169, i64 noundef 40)
  %170 = load ptr, ptr @simulation, align 8, !tbaa !5
  %171 = call noundef zeroext i1 @_ZN10SimManager14is_warmup_doneEv(ptr noundef nonnull align 8 dereferenceable(96) %170)
  br i1 %171, label %172, label %184

172:                                              ; preds = %165
  %173 = call noundef i64 @_Z13get_sys_clockv()
  %174 = load i64, ptr %5, align 8, !tbaa !9
  %175 = sub i64 %173, %174
  %176 = uitofp i64 %175 to double
  %177 = load ptr, ptr @stats, align 8, !tbaa !20
  %178 = load i64, ptr %4, align 8, !tbaa !9
  %179 = getelementptr inbounds ptr, ptr %177, i64 %178
  %180 = load ptr, ptr %179, align 8, !tbaa !5
  %181 = getelementptr inbounds %class.Stats_thd, ptr %180, i32 0, i32 48
  %182 = load double, ptr %181, align 8, !tbaa !41
  %183 = fadd double %182, %176
  store double %183, ptr %181, align 8, !tbaa !41
  br label %184

184:                                              ; preds = %172, %165
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  br label %185

185:                                              ; preds = %184, %69
  %186 = load ptr, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  ret ptr %186
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { nounwind }
attributes #5 = { noreturn nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !6, i64 0}
!14 = !{!"_ZTS10QWorkQueue", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !10, i64 32, !6, i64 40, !10, i64 48}
!15 = !{!16, !16, i64 0}
!16 = !{!"bool", !7, i64 0}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = !{!14, !6, i64 8}
!20 = !{!21, !6, i64 0}
!21 = !{!"_ZTS5Stats", !6, i64 0, !6, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40}
!22 = !{!23, !6, i64 1888}
!23 = !{!"_ZTS9Stats_thd", !7, i64 0, !6, i64 64, !6, i64 72, !24, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !10, i64 120, !10, i64 128, !10, i64 136, !10, i64 144, !10, i64 152, !10, i64 160, !10, i64 168, !10, i64 176, !24, i64 184, !10, i64 192, !24, i64 200, !10, i64 208, !24, i64 216, !10, i64 224, !10, i64 232, !24, i64 240, !24, i64 248, !24, i64 256, !24, i64 264, !24, i64 272, !24, i64 280, !24, i64 288, !24, i64 296, !10, i64 304, !24, i64 312, !24, i64 320, !24, i64 328, !24, i64 336, !24, i64 344, !24, i64 352, !24, i64 360, !24, i64 368, !10, i64 376, !10, i64 384, !24, i64 392, !10, i64 400, !24, i64 408, !10, i64 416, !24, i64 424, !24, i64 432, !24, i64 440, !10, i64 448, !10, i64 456, !10, i64 464, !24, i64 472, !24, i64 480, !24, i64 488, !24, i64 496, !24, i64 504, !24, i64 512, !24, i64 520, !24, i64 528, !24, i64 536, !10, i64 544, !6, i64 552, !6, i64 560, !24, i64 568, !10, i64 576, !10, i64 584, !24, i64 592, !24, i64 600, !24, i64 608, !10, i64 616, !10, i64 624, !10, i64 632, !10, i64 640, !10, i64 648, !10, i64 656, !10, i64 664, !24, i64 672, !24, i64 680, !24, i64 688, !10, i64 696, !10, i64 704, !10, i64 712, !10, i64 720, !10, i64 728, !10, i64 736, !10, i64 744, !10, i64 752, !10, i64 760, !24, i64 768, !24, i64 776, !24, i64 784, !24, i64 792, !24, i64 800, !10, i64 808, !10, i64 816, !24, i64 824, !24, i64 832, !10, i64 840, !10, i64 848, !10, i64 856, !24, i64 864, !24, i64 872, !10, i64 880, !10, i64 888, !24, i64 896, !24, i64 904, !24, i64 912, !24, i64 920, !10, i64 928, !10, i64 936, !24, i64 944, !24, i64 952, !24, i64 960, !10, i64 968, !10, i64 976, !24, i64 984, !24, i64 992, !24, i64 1000, !24, i64 1008, !24, i64 1016, !10, i64 1024, !24, i64 1032, !24, i64 1040, !24, i64 1048, !24, i64 1056, !24, i64 1064, !24, i64 1072, !24, i64 1080, !24, i64 1088, !10, i64 1096, !10, i64 1104, !10, i64 1112, !24, i64 1120, !10, i64 1128, !24, i64 1136, !24, i64 1144, !10, i64 1152, !10, i64 1160, !10, i64 1168, !10, i64 1176, !10, i64 1184, !24, i64 1192, !10, i64 1200, !10, i64 1208, !24, i64 1216, !10, i64 1224, !24, i64 1232, !24, i64 1240, !10, i64 1248, !10, i64 1256, !10, i64 1264, !10, i64 1272, !10, i64 1280, !24, i64 1288, !24, i64 1296, !24, i64 1304, !25, i64 1312, !25, i64 1384, !25, i64 1456, !25, i64 1528, !24, i64 1600, !24, i64 1608, !24, i64 1616, !24, i64 1624, !24, i64 1632, !24, i64 1640, !24, i64 1648, !24, i64 1656, !24, i64 1664, !24, i64 1672, !24, i64 1680, !24, i64 1688, !24, i64 1696, !24, i64 1704, !24, i64 1712, !24, i64 1720, !24, i64 1728, !24, i64 1736, !24, i64 1744, !24, i64 1752, !24, i64 1760, !24, i64 1768, !24, i64 1776, !24, i64 1784, !24, i64 1792, !24, i64 1800, !24, i64 1808, !24, i64 1816, !24, i64 1824, !24, i64 1832, !24, i64 1840, !24, i64 1848, !24, i64 1856, !24, i64 1864, !24, i64 1872, !24, i64 1880, !6, i64 1888, !7, i64 1896}
!24 = !{!"double", !7, i64 0}
!25 = !{!"_ZTS8StatsArr", !6, i64 0, !10, i64 8, !10, i64 16, !26, i64 24, !7, i64 32}
!26 = !{!"_ZTS12StatsArrType", !7, i64 0}
!27 = !{!24, !24, i64 0}
!28 = !{!29, !6, i64 0}
!29 = !{!"_ZTS16work_queue_entry", !6, i64 0, !10, i64 8, !10, i64 16, !30, i64 24, !10, i64 32}
!30 = !{!"_ZTS10RemReqType", !7, i64 0}
!31 = !{!29, !10, i64 32}
!32 = !{!23, !24, i64 368}
!33 = !{!23, !10, i64 376}
!34 = !{!35, !30, i64 8}
!35 = !{!"_ZTS7Message", !30, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !24, i64 64, !24, i64 72, !24, i64 80, !24, i64 88, !24, i64 96, !24, i64 104, !24, i64 112}
!36 = !{!23, !24, i64 408}
!37 = !{!23, !10, i64 400}
!38 = !{!23, !24, i64 424}
!39 = !{!23, !10, i64 416}
!40 = !{!35, !10, i64 40}
!41 = !{!23, !24, i64 440}


; 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.mem_alloc = type { i8 }
%class.Stats = type { ptr, ptr, i64, i64, i64, i64 }

@g_node_cnt = external local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [69 x i8], align 1
@mem_allocator = external global %class.mem_alloc, align 1
@g_node_id = external local_unnamed_addr global i32, align 4
@simulation = external local_unnamed_addr global ptr, align 8
@stats = external local_unnamed_addr global %class.Stats, align 8
@g_client_node_cnt = external local_unnamed_addr global i32, align 4
@g_repl_cnt = external local_unnamed_addr global i32, align 4
@.str.4 = external hidden unnamed_addr constant [22 x i8], align 1
@__PRETTY_FUNCTION__._ZN10QWorkQueue7dequeueEm = external hidden unnamed_addr constant [39 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 nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

declare noundef i64 @_Z13get_sys_clockv() local_unnamed_addr #1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

declare noundef zeroext i1 @_ZN10SimManager14is_warmup_doneEv(ptr noundef nonnull align 8 dereferenceable(96)) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN5boost8lockfree5queueIP16work_queue_entryJEE3popERS3_(ptr noundef nonnull align 8 dereferenceable(136), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3 align 2

declare void @_ZN9mem_alloc4freeEPvm(ptr noundef nonnull align 1 dereferenceable(1), ptr noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN10QWorkQueue7dequeueEm(ptr nocapture noundef nonnull readonly align 8 dereferenceable(56) %0, i64 noundef %1) local_unnamed_addr #3 align 2 {
  %3 = alloca ptr, align 8
  %4 = tail call noundef i64 @_Z13get_sys_clockv()
  %5 = load i32, ptr @g_node_id, align 4, !tbaa !5
  %6 = load i32, ptr @g_node_cnt, align 4, !tbaa !5
  %7 = icmp ult i32 %5, %6
  br i1 %7, label %.critedge, label %8

8:                                                ; preds = %2
  %9 = load i32, ptr @g_client_node_cnt, align 4, !tbaa !5
  %10 = add i32 %9, %6
  %.not = icmp ult i32 %5, %10
  br i1 %.not, label %.critedge2, label %11

11:                                               ; preds = %8
  %12 = load i32, ptr @g_repl_cnt, align 4, !tbaa !5
  %13 = mul i32 %12, %6
  %14 = add i32 %13, %10
  %15 = icmp ult i32 %5, %14
  br i1 %15, label %.critedge, label %.critedge2

.critedge2:                                       ; preds = %8, %11
  tail call void @__assert_fail(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.1, i32 noundef 184, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN10QWorkQueue7dequeueEm) #4
  unreachable

.critedge:                                        ; preds = %2, %11
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  store ptr null, ptr %3, align 8, !tbaa !9
  %16 = tail call noundef i64 @_Z13get_sys_clockv()
  %17 = load ptr, ptr %0, align 8, !tbaa !11
  %18 = call noundef zeroext i1 @_ZN5boost8lockfree5queueIP16work_queue_entryJEE3popERS3_(ptr noundef nonnull align 8 dereferenceable(136) %17, ptr noundef nonnull align 8 dereferenceable(8) %3)
  br i1 %18, label %23, label %19

19:                                               ; preds = %.critedge
  %20 = getelementptr inbounds i8, ptr %0, i64 8
  %21 = load ptr, ptr %20, align 8, !tbaa !14
  %22 = call noundef zeroext i1 @_ZN5boost8lockfree5queueIP16work_queue_entryJEE3popERS3_(ptr noundef nonnull align 8 dereferenceable(136) %21, ptr noundef nonnull align 8 dereferenceable(8) %3)
  br label %23

23:                                               ; preds = %19, %.critedge
  %.022.in = phi i1 [ true, %.critedge ], [ %22, %19 ]
  %24 = load ptr, ptr @simulation, align 8, !tbaa !9
  %25 = call noundef zeroext i1 @_ZN10SimManager14is_warmup_doneEv(ptr noundef nonnull align 8 dereferenceable(96) %24)
  br i1 %25, label %26, label %38

26:                                               ; preds = %23
  %27 = call noundef i64 @_Z13get_sys_clockv()
  %28 = sub i64 %27, %16
  %29 = uitofp i64 %28 to double
  %30 = load ptr, ptr @stats, align 8, !tbaa !15
  %31 = getelementptr inbounds ptr, ptr %30, i64 %1
  %32 = load ptr, ptr %31, align 8, !tbaa !9
  %33 = getelementptr inbounds i8, ptr %32, i64 1888
  %34 = load ptr, ptr %33, align 8, !tbaa !17
  %35 = getelementptr inbounds i8, ptr %34, i64 112
  %36 = load double, ptr %35, align 8, !tbaa !22
  %37 = fadd double %36, %29
  store double %37, ptr %35, align 8, !tbaa !22
  br label %38

38:                                               ; preds = %26, %23
  br i1 %.022.in, label %39, label %120

39:                                               ; preds = %38
  %40 = load ptr, ptr %3, align 8, !tbaa !9
  %41 = load ptr, ptr %40, align 8, !tbaa !23
  %.not27 = icmp eq ptr %41, null
  br i1 %.not27, label %42, label %43

42:                                               ; preds = %39
  call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 206, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN10QWorkQueue7dequeueEm) #4
  unreachable

43:                                               ; preds = %39
  %44 = call noundef i64 @_Z13get_sys_clockv()
  %45 = load ptr, ptr %3, align 8, !tbaa !9
  %46 = getelementptr inbounds i8, ptr %45, i64 32
  %47 = load i64, ptr %46, align 8, !tbaa !26
  %48 = sub i64 %44, %47
  %49 = load ptr, ptr @simulation, align 8, !tbaa !9
  %50 = call noundef zeroext i1 @_ZN10SimManager14is_warmup_doneEv(ptr noundef nonnull align 8 dereferenceable(96) %49)
  br i1 %50, label %51, label %59

51:                                               ; preds = %43
  %52 = uitofp i64 %48 to double
  %53 = load ptr, ptr @stats, align 8, !tbaa !15
  %54 = getelementptr inbounds ptr, ptr %53, i64 %1
  %55 = load ptr, ptr %54, align 8, !tbaa !9
  %56 = getelementptr inbounds i8, ptr %55, i64 368
  %57 = load double, ptr %56, align 8, !tbaa !27
  %58 = fadd double %57, %52
  store double %58, ptr %56, align 8, !tbaa !27
  br label %59

59:                                               ; preds = %51, %43
  %60 = load ptr, ptr @simulation, align 8, !tbaa !9
  %61 = call noundef zeroext i1 @_ZN10SimManager14is_warmup_doneEv(ptr noundef nonnull align 8 dereferenceable(96) %60)
  br i1 %61, label %62, label %69

62:                                               ; preds = %59
  %63 = load ptr, ptr @stats, align 8, !tbaa !15
  %64 = getelementptr inbounds ptr, ptr %63, i64 %1
  %65 = load ptr, ptr %64, align 8, !tbaa !9
  %66 = getelementptr inbounds i8, ptr %65, i64 376
  %67 = load i64, ptr %66, align 8, !tbaa !28
  %68 = add i64 %67, 1
  store i64 %68, ptr %66, align 8, !tbaa !28
  br label %69

69:                                               ; preds = %62, %59
  %70 = getelementptr inbounds i8, ptr %41, i64 8
  %71 = load i32, ptr %70, align 8, !tbaa !29
  %72 = icmp eq i32 %71, 3
  %73 = load ptr, ptr @simulation, align 8, !tbaa !9
  %74 = call noundef zeroext i1 @_ZN10SimManager14is_warmup_doneEv(ptr noundef nonnull align 8 dereferenceable(96) %73)
  br i1 %72, label %75, label %87

75:                                               ; preds = %69
  br i1 %74, label %76, label %84

76:                                               ; preds = %75
  %77 = uitofp i64 %48 to double
  %78 = load ptr, ptr @stats, align 8, !tbaa !15
  %79 = getelementptr inbounds ptr, ptr %78, i64 %1
  %80 = load ptr, ptr %79, align 8, !tbaa !9
  %81 = getelementptr inbounds i8, ptr %80, i64 408
  %82 = load double, ptr %81, align 8, !tbaa !31
  %83 = fadd double %82, %77
  store double %83, ptr %81, align 8, !tbaa !31
  br label %84

84:                                               ; preds = %76, %75
  %85 = load ptr, ptr @simulation, align 8, !tbaa !9
  %86 = call noundef zeroext i1 @_ZN10SimManager14is_warmup_doneEv(ptr noundef nonnull align 8 dereferenceable(96) %85)
  br i1 %86, label %.sink.split, label %105

87:                                               ; preds = %69
  br i1 %74, label %88, label %96

88:                                               ; preds = %87
  %89 = uitofp i64 %48 to double
  %90 = load ptr, ptr @stats, align 8, !tbaa !15
  %91 = getelementptr inbounds ptr, ptr %90, i64 %1
  %92 = load ptr, ptr %91, align 8, !tbaa !9
  %93 = getelementptr inbounds i8, ptr %92, i64 424
  %94 = load double, ptr %93, align 8, !tbaa !32
  %95 = fadd double %94, %89
  store double %95, ptr %93, align 8, !tbaa !32
  br label %96

96:                                               ; preds = %88, %87
  %97 = load ptr, ptr @simulation, align 8, !tbaa !9
  %98 = call noundef zeroext i1 @_ZN10SimManager14is_warmup_doneEv(ptr noundef nonnull align 8 dereferenceable(96) %97)
  br i1 %98, label %.sink.split, label %105

.sink.split:                                      ; preds = %96, %84
  %.sink31 = phi i64 [ 400, %84 ], [ 416, %96 ]
  %99 = load ptr, ptr @stats, align 8, !tbaa !15
  %100 = getelementptr inbounds ptr, ptr %99, i64 %1
  %101 = load ptr, ptr %100, align 8, !tbaa !9
  %102 = getelementptr inbounds i8, ptr %101, i64 %.sink31
  %103 = load i64, ptr %102, align 8, !tbaa !33
  %104 = add i64 %103, 1
  store i64 %104, ptr %102, align 8, !tbaa !33
  br label %105

105:                                              ; preds = %.sink.split, %96, %84
  %106 = getelementptr inbounds i8, ptr %41, i64 40
  store i64 %48, ptr %106, align 8, !tbaa !34
  %107 = load ptr, ptr %3, align 8, !tbaa !9
  call void @_ZN9mem_alloc4freeEPvm(ptr noundef nonnull align 1 dereferenceable(1) @mem_allocator, ptr noundef %107, i64 noundef 40)
  %108 = load ptr, ptr @simulation, align 8, !tbaa !9
  %109 = call noundef zeroext i1 @_ZN10SimManager14is_warmup_doneEv(ptr noundef nonnull align 8 dereferenceable(96) %108)
  br i1 %109, label %110, label %120

110:                                              ; preds = %105
  %111 = call noundef i64 @_Z13get_sys_clockv()
  %112 = sub i64 %111, %4
  %113 = uitofp i64 %112 to double
  %114 = load ptr, ptr @stats, align 8, !tbaa !15
  %115 = getelementptr inbounds ptr, ptr %114, i64 %1
  %116 = load ptr, ptr %115, align 8, !tbaa !9
  %117 = getelementptr inbounds i8, ptr %116, i64 440
  %118 = load double, ptr %117, align 8, !tbaa !35
  %119 = fadd double %118, %113
  store double %119, ptr %117, align 8, !tbaa !35
  br label %120

120:                                              ; preds = %105, %110, %38
  %.0 = phi ptr [ null, %38 ], [ %41, %110 ], [ %41, %105 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  ret ptr %.0
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { noreturn nounwind }
attributes #5 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"_ZTS10QWorkQueue", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !13, i64 32, !10, i64 40, !13, i64 48}
!13 = !{!"long", !7, i64 0}
!14 = !{!12, !10, i64 8}
!15 = !{!16, !10, i64 0}
!16 = !{!"_ZTS5Stats", !10, i64 0, !10, i64 8, !13, i64 16, !13, i64 24, !13, i64 32, !13, i64 40}
!17 = !{!18, !10, i64 1888}
!18 = !{!"_ZTS9Stats_thd", !7, i64 0, !10, i64 64, !10, i64 72, !19, i64 80, !13, i64 88, !13, i64 96, !13, i64 104, !13, i64 112, !13, i64 120, !13, i64 128, !13, i64 136, !13, i64 144, !13, i64 152, !13, i64 160, !13, i64 168, !13, i64 176, !19, i64 184, !13, i64 192, !19, i64 200, !13, i64 208, !19, i64 216, !13, i64 224, !13, i64 232, !19, i64 240, !19, i64 248, !19, i64 256, !19, i64 264, !19, i64 272, !19, i64 280, !19, i64 288, !19, i64 296, !13, i64 304, !19, i64 312, !19, i64 320, !19, i64 328, !19, i64 336, !19, i64 344, !19, i64 352, !19, i64 360, !19, i64 368, !13, i64 376, !13, i64 384, !19, i64 392, !13, i64 400, !19, i64 408, !13, i64 416, !19, i64 424, !19, i64 432, !19, i64 440, !13, i64 448, !13, i64 456, !13, i64 464, !19, i64 472, !19, i64 480, !19, i64 488, !19, i64 496, !19, i64 504, !19, i64 512, !19, i64 520, !19, i64 528, !19, i64 536, !13, i64 544, !10, i64 552, !10, i64 560, !19, i64 568, !13, i64 576, !13, i64 584, !19, i64 592, !19, i64 600, !19, i64 608, !13, i64 616, !13, i64 624, !13, i64 632, !13, i64 640, !13, i64 648, !13, i64 656, !13, i64 664, !19, i64 672, !19, i64 680, !19, i64 688, !13, i64 696, !13, i64 704, !13, i64 712, !13, i64 720, !13, i64 728, !13, i64 736, !13, i64 744, !13, i64 752, !13, i64 760, !19, i64 768, !19, i64 776, !19, i64 784, !19, i64 792, !19, i64 800, !13, i64 808, !13, i64 816, !19, i64 824, !19, i64 832, !13, i64 840, !13, i64 848, !13, i64 856, !19, i64 864, !19, i64 872, !13, i64 880, !13, i64 888, !19, i64 896, !19, i64 904, !19, i64 912, !19, i64 920, !13, i64 928, !13, i64 936, !19, i64 944, !19, i64 952, !19, i64 960, !13, i64 968, !13, i64 976, !19, i64 984, !19, i64 992, !19, i64 1000, !19, i64 1008, !19, i64 1016, !13, i64 1024, !19, i64 1032, !19, i64 1040, !19, i64 1048, !19, i64 1056, !19, i64 1064, !19, i64 1072, !19, i64 1080, !19, i64 1088, !13, i64 1096, !13, i64 1104, !13, i64 1112, !19, i64 1120, !13, i64 1128, !19, i64 1136, !19, i64 1144, !13, i64 1152, !13, i64 1160, !13, i64 1168, !13, i64 1176, !13, i64 1184, !19, i64 1192, !13, i64 1200, !13, i64 1208, !19, i64 1216, !13, i64 1224, !19, i64 1232, !19, i64 1240, !13, i64 1248, !13, i64 1256, !13, i64 1264, !13, i64 1272, !13, i64 1280, !19, i64 1288, !19, i64 1296, !19, i64 1304, !20, i64 1312, !20, i64 1384, !20, i64 1456, !20, i64 1528, !19, i64 1600, !19, i64 1608, !19, i64 1616, !19, i64 1624, !19, i64 1632, !19, i64 1640, !19, i64 1648, !19, i64 1656, !19, i64 1664, !19, i64 1672, !19, i64 1680, !19, i64 1688, !19, i64 1696, !19, i64 1704, !19, i64 1712, !19, i64 1720, !19, i64 1728, !19, i64 1736, !19, i64 1744, !19, i64 1752, !19, i64 1760, !19, i64 1768, !19, i64 1776, !19, i64 1784, !19, i64 1792, !19, i64 1800, !19, i64 1808, !19, i64 1816, !19, i64 1824, !19, i64 1832, !19, i64 1840, !19, i64 1848, !19, i64 1856, !19, i64 1864, !19, i64 1872, !19, i64 1880, !10, i64 1888, !7, i64 1896}
!19 = !{!"double", !7, i64 0}
!20 = !{!"_ZTS8StatsArr", !10, i64 0, !13, i64 8, !13, i64 16, !21, i64 24, !7, i64 32}
!21 = !{!"_ZTS12StatsArrType", !7, i64 0}
!22 = !{!19, !19, i64 0}
!23 = !{!24, !10, i64 0}
!24 = !{!"_ZTS16work_queue_entry", !10, i64 0, !13, i64 8, !13, i64 16, !25, i64 24, !13, i64 32}
!25 = !{!"_ZTS10RemReqType", !7, i64 0}
!26 = !{!24, !13, i64 32}
!27 = !{!18, !19, i64 368}
!28 = !{!18, !13, i64 376}
!29 = !{!30, !25, i64 8}
!30 = !{!"_ZTS7Message", !25, i64 8, !13, i64 16, !13, i64 24, !13, i64 32, !13, i64 40, !13, i64 48, !13, i64 56, !19, i64 64, !19, i64 72, !19, i64 80, !19, i64 88, !19, i64 96, !19, i64 104, !19, i64 112}
!31 = !{!18, !19, i64 408}
!32 = !{!18, !19, i64 424}
!33 = !{!13, !13, i64 0}
!34 = !{!30, !13, i64 40}
!35 = !{!18, !19, i64 440}


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