; LLVM IR from sfu-dis/mosaicdb :: benchmarks/egen (MEETradingFloor)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"struct.TPCE::TTradeRequest" = type { double, i64, i32, i32, [16 x i8], [4 x i8] }
%"class.TPCE::CMEETradingFloor" = type { ptr, ptr, ptr, ptr, ptr, %"class.TPCE::CTimerWheel", %"class.TPCE::CRandom", double }
%"class.TPCE::CTimerWheel" = type <{ %"class.TPCE::CDateTime", %"class.TPCE::CWheelTime", %"class.TPCE::CWheelTime", %"class.TPCE::CWheelTime", %"struct.TPCE::TWheelConfig", [5000 x %"class.std::__cxx11::list"], i32, [4 x i8] }>
%"class.TPCE::CDateTime" = type { i32, i32, ptr }
%"class.TPCE::CWheelTime" = type { ptr, i32, i32 }
%"struct.TPCE::TWheelConfig" = type { i32, i32 }
%"class.std::__cxx11::list" = type { %"class.std::__cxx11::_List_base" }
%"class.std::__cxx11::_List_base" = type { %"struct.std::__cxx11::_List_base<TPCE::CTimerWheelTimer<TPCE::TTradeRequest, TPCE::CMEETradingFloor> *, std::allocator<TPCE::CTimerWheelTimer<TPCE::TTradeRequest, TPCE::CMEETradingFloor> *>>::_List_impl" }
%"struct.std::__cxx11::_List_base<TPCE::CTimerWheelTimer<TPCE::TTradeRequest, TPCE::CMEETradingFloor> *, std::allocator<TPCE::CTimerWheelTimer<TPCE::TTradeRequest, TPCE::CMEETradingFloor> *>>::_List_impl" = type { %"struct.std::__detail::_List_node_header" }
%"struct.std::__detail::_List_node_header" = type { %"struct.std::__detail::_List_node_base", i64 }
%"struct.std::__detail::_List_node_base" = type { ptr, ptr }
%"class.TPCE::CRandom" = type { i64 }

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN4TPCE16CMEETradingFloor18SubmitTradeRequestEPNS_13TTradeRequestE(ptr noundef nonnull align 8 dereferenceable(120136) %0, ptr noundef %1) #0 align 2 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca { i64, i64 }, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %8 = load ptr, ptr %4, align 8
  %9 = load ptr, ptr %5, align 8, !tbaa !5
  %10 = getelementptr inbounds %"struct.TPCE::TTradeRequest", ptr %9, i32 0, i32 3
  %11 = load i32, ptr %10, align 4, !tbaa !9
  switch i32 %11, label %32 [
    i32 0, label %12
    i32 1, label %26
  ]

12:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %13 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 48) #7
  store ptr %13, ptr %6, align 8, !tbaa !5
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  %15 = load ptr, ptr %6, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %15, ptr align 8 %14, i64 48, i1 false), !tbaa.struct !15
  %16 = getelementptr inbounds %"class.TPCE::CMEETradingFloor", ptr %8, i32 0, i32 5
  %17 = getelementptr inbounds %"class.TPCE::CMEETradingFloor", ptr %8, i32 0, i32 7
  %18 = load double, ptr %17, align 8, !tbaa !21
  %19 = call noundef double @_ZN4TPCE16CMEETradingFloor18GenProcessingDelayEd(ptr noundef nonnull align 8 dereferenceable(120136) %8, double noundef %18)
  %20 = load ptr, ptr %6, align 8, !tbaa !5
  store { i64, i64 } { i64 ptrtoint (ptr @_ZN4TPCE16CMEETradingFloor15SendTradeResultEPNS_13TTradeRequestE to i64), i64 0 }, ptr %7, align 8, !tbaa !20
  %21 = getelementptr inbounds { i64, i64 }, ptr %7, i32 0, i32 0
  %22 = load i64, ptr %21, align 8
  %23 = getelementptr inbounds { i64, i64 }, ptr %7, i32 0, i32 1
  %24 = load i64, ptr %23, align 8
  %25 = call noundef i32 @_ZN4TPCE11CTimerWheelINS_13TTradeRequestENS_16CMEETradingFloorELi5ELi1EE10StartTimerEdPS2_MS2_FvPS1_ES5_(ptr noundef nonnull align 8 dereferenceable(120076) %16, double noundef %19, ptr noundef %8, i64 %22, i64 %24, ptr noundef %20)
  store i32 %25, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  br label %35

26:                                               ; preds = %2
  %27 = getelementptr inbounds %"class.TPCE::CMEETradingFloor", ptr %8, i32 0, i32 2
  %28 = load ptr, ptr %27, align 8, !tbaa !28
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZN4TPCE14CMEETickerTape14PostLimitOrderEPNS_13TTradeRequestE(ptr noundef nonnull align 8 dereferenceable(22504) %28, ptr noundef %29)
  %30 = getelementptr inbounds %"class.TPCE::CMEETradingFloor", ptr %8, i32 0, i32 5
  %31 = call noundef i32 @_ZN4TPCE11CTimerWheelINS_13TTradeRequestENS_16CMEETradingFloorELi5ELi1EE20ProcessExpiredTimersEv(ptr noundef nonnull align 8 dereferenceable(120076) %30)
  store i32 %31, ptr %3, align 4
  br label %35

32:                                               ; preds = %2
  %33 = getelementptr inbounds %"class.TPCE::CMEETradingFloor", ptr %8, i32 0, i32 5
  %34 = call noundef i32 @_ZN4TPCE11CTimerWheelINS_13TTradeRequestENS_16CMEETradingFloorELi5ELi1EE20ProcessExpiredTimersEv(ptr noundef nonnull align 8 dereferenceable(120076) %33)
  store i32 %34, ptr %3, align 4
  br label %35

35:                                               ; preds = %32, %26, %12
  %36 = load i32, ptr %3, align 4
  ret i32 %36
}

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

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(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
declare dso_local noundef i32 @_ZN4TPCE11CTimerWheelINS_13TTradeRequestENS_16CMEETradingFloorELi5ELi1EE10StartTimerEdPS2_MS2_FvPS1_ES5_(ptr noundef nonnull align 8 dereferenceable(120076), double noundef, ptr noundef, i64, i64, ptr noundef) #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef double @_ZN4TPCE16CMEETradingFloor18GenProcessingDelayEd(ptr noundef nonnull align 8 dereferenceable(120136), double noundef) #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4TPCE16CMEETradingFloor15SendTradeResultEPNS_13TTradeRequestE(ptr noundef nonnull align 8 dereferenceable(120136), ptr noundef) #0 align 2

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

declare void @_ZN4TPCE14CMEETickerTape14PostLimitOrderEPNS_13TTradeRequestE(ptr noundef nonnull align 8 dereferenceable(22504), ptr noundef) #5

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN4TPCE11CTimerWheelINS_13TTradeRequestENS_16CMEETradingFloorELi5ELi1EE20ProcessExpiredTimersEv(ptr noundef nonnull align 8 dereferenceable(120076)) #0 align 2

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nobuiltin allocsize(0) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }
attributes #7 = { builtin allocsize(0) }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !14, i64 20}
!10 = !{!"_ZTSN4TPCE13TTradeRequestE", !11, i64 0, !12, i64 8, !13, i64 16, !14, i64 20, !7, i64 24, !7, i64 40}
!11 = !{!"double", !7, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_ZTSN4TPCE22eMEETradeRequestActionE", !7, i64 0}
!15 = !{i64 0, i64 8, !16, i64 8, i64 8, !17, i64 16, i64 4, !18, i64 20, i64 4, !19, i64 24, i64 16, !20, i64 40, i64 4, !20}
!16 = !{!11, !11, i64 0}
!17 = !{!12, !12, i64 0}
!18 = !{!13, !13, i64 0}
!19 = !{!14, !14, i64 0}
!20 = !{!7, !7, i64 0}
!21 = !{!22, !11, i64 120128}
!22 = !{!"_ZTSN4TPCE16CMEETradingFloorE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !23, i64 40, !27, i64 120120, !11, i64 120128}
!23 = !{!"_ZTSN4TPCE11CTimerWheelINS_13TTradeRequestENS_16CMEETradingFloorELi5ELi1EEE", !24, i64 0, !25, i64 16, !25, i64 32, !25, i64 48, !26, i64 64, !7, i64 72, !13, i64 120072}
!24 = !{!"_ZTSN4TPCE9CDateTimeE", !13, i64 0, !13, i64 4, !6, i64 8}
!25 = !{!"_ZTSN4TPCE10CWheelTimeE", !6, i64 0, !13, i64 8, !13, i64 12}
!26 = !{!"_ZTSN4TPCE12TWheelConfigE", !13, i64 0, !13, i64 4}
!27 = !{!"_ZTSN4TPCE7CRandomE", !12, i64 0}
!28 = !{!22, !6, i64 16}


; 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"

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN4TPCE16CMEETradingFloor18SubmitTradeRequestEPNS_13TTradeRequestE(ptr noundef nonnull align 8 dereferenceable(120136) %0, ptr noundef %1) local_unnamed_addr #0 align 2 {
  %3 = getelementptr inbounds i8, ptr %1, i64 20
  %4 = load i32, ptr %3, align 4, !tbaa !5
  switch i32 %4, label %17 [
    i32 0, label %5
    i32 1, label %12
  ]

5:                                                ; preds = %2
  %6 = tail call noalias noundef nonnull dereferenceable(48) ptr @_Znwm(i64 noundef 48) #5
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(48) %6, ptr noundef nonnull align 8 dereferenceable(48) %1, i64 48, i1 false), !tbaa.struct !13
  %7 = getelementptr inbounds i8, ptr %0, i64 40
  %8 = getelementptr inbounds i8, ptr %0, i64 120128
  %9 = load double, ptr %8, align 8, !tbaa !19
  %10 = tail call noundef double @_ZN4TPCE16CMEETradingFloor18GenProcessingDelayEd(ptr noundef nonnull align 8 dereferenceable(120136) %0, double noundef %9)
  %11 = tail call noundef i32 @_ZN4TPCE11CTimerWheelINS_13TTradeRequestENS_16CMEETradingFloorELi5ELi1EE10StartTimerEdPS2_MS2_FvPS1_ES5_(ptr noundef nonnull align 8 dereferenceable(120076) %7, double noundef %10, ptr noundef nonnull %0, i64 ptrtoint (ptr @_ZN4TPCE16CMEETradingFloor15SendTradeResultEPNS_13TTradeRequestE to i64), i64 0, ptr noundef nonnull %6)
  br label %20

12:                                               ; preds = %2
  %13 = getelementptr inbounds i8, ptr %0, i64 16
  %14 = load ptr, ptr %13, align 8, !tbaa !27
  tail call void @_ZN4TPCE14CMEETickerTape14PostLimitOrderEPNS_13TTradeRequestE(ptr noundef nonnull align 8 dereferenceable(22504) %14, ptr noundef nonnull %1)
  %15 = getelementptr inbounds i8, ptr %0, i64 40
  %16 = tail call noundef i32 @_ZN4TPCE11CTimerWheelINS_13TTradeRequestENS_16CMEETradingFloorELi5ELi1EE20ProcessExpiredTimersEv(ptr noundef nonnull align 8 dereferenceable(120076) %15)
  br label %20

17:                                               ; preds = %2
  %18 = getelementptr inbounds i8, ptr %0, i64 40
  %19 = tail call noundef i32 @_ZN4TPCE11CTimerWheelINS_13TTradeRequestENS_16CMEETradingFloorELi5ELi1EE20ProcessExpiredTimersEv(ptr noundef nonnull align 8 dereferenceable(120076) %18)
  br label %20

20:                                               ; preds = %17, %12, %5
  %.0 = phi i32 [ %19, %17 ], [ %16, %12 ], [ %11, %5 ]
  ret i32 %.0
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN4TPCE11CTimerWheelINS_13TTradeRequestENS_16CMEETradingFloorELi5ELi1EE10StartTimerEdPS2_MS2_FvPS1_ES5_(ptr noundef nonnull align 8 dereferenceable(120076), double noundef, ptr noundef, i64, i64, ptr noundef) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef double @_ZN4TPCE16CMEETradingFloor18GenProcessingDelayEd(ptr noundef nonnull align 8 dereferenceable(120136), double noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4TPCE16CMEETradingFloor15SendTradeResultEPNS_13TTradeRequestE(ptr noundef nonnull align 8 dereferenceable(120136), ptr noundef) #0 align 2

declare void @_ZN4TPCE14CMEETickerTape14PostLimitOrderEPNS_13TTradeRequestE(ptr noundef nonnull align 8 dereferenceable(22504), ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN4TPCE11CTimerWheelINS_13TTradeRequestENS_16CMEETradingFloorELi5ELi1EE20ProcessExpiredTimersEv(ptr noundef nonnull align 8 dereferenceable(120076)) local_unnamed_addr #0 align 2

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nobuiltin allocsize(0) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { "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 = { builtin allocsize(0) }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !12, i64 20}
!6 = !{!"_ZTSN4TPCE13TTradeRequestE", !7, i64 0, !10, i64 8, !11, i64 16, !12, i64 20, !8, i64 24, !8, i64 40}
!7 = !{!"double", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"long long", !8, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = !{!"_ZTSN4TPCE22eMEETradeRequestActionE", !8, i64 0}
!13 = !{i64 0, i64 8, !14, i64 8, i64 8, !15, i64 16, i64 4, !16, i64 20, i64 4, !17, i64 24, i64 16, !18, i64 40, i64 4, !18}
!14 = !{!7, !7, i64 0}
!15 = !{!10, !10, i64 0}
!16 = !{!11, !11, i64 0}
!17 = !{!12, !12, i64 0}
!18 = !{!8, !8, i64 0}
!19 = !{!20, !7, i64 120128}
!20 = !{!"_ZTSN4TPCE16CMEETradingFloorE", !21, i64 0, !21, i64 8, !21, i64 16, !21, i64 24, !21, i64 32, !22, i64 40, !26, i64 120120, !7, i64 120128}
!21 = !{!"any pointer", !8, i64 0}
!22 = !{!"_ZTSN4TPCE11CTimerWheelINS_13TTradeRequestENS_16CMEETradingFloorELi5ELi1EEE", !23, i64 0, !24, i64 16, !24, i64 32, !24, i64 48, !25, i64 64, !8, i64 72, !11, i64 120072}
!23 = !{!"_ZTSN4TPCE9CDateTimeE", !11, i64 0, !11, i64 4, !21, i64 8}
!24 = !{!"_ZTSN4TPCE10CWheelTimeE", !21, i64 0, !11, i64 8, !11, i64 12}
!25 = !{!"_ZTSN4TPCE12TWheelConfigE", !11, i64 0, !11, i64 4}
!26 = !{!"_ZTSN4TPCE7CRandomE", !10, i64 0}
!27 = !{!20, !21, i64 16}


; Effective O3 passes: CorrelatedValuePropagationPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,TailCallElimPass