; LLVM IR from Compaile/ctrack :: examples/complex_multithreaded_puzzle.ll (Z17complex_operationi)

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

%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.ctrack::vCTRACK_VERSION_MAJOR_CTRACK_VERSION_MINOR_CTRACK_VERSION_PATCH::EventHandler" = type <{ %"class.std::chrono::time_point", i32, i32, %"class.std::basic_string_view", %"class.std::basic_string_view", i32, i32, i32, [4 x i8] }>
%"class.std::chrono::time_point" = type { %"class.std::chrono::duration" }
%"class.std::chrono::duration" = type { i64 }
%"class.std::basic_string_view" = type { i64, ptr }
%"class.std::random_device" = type { %union.anon.22 }
%union.anon.22 = type { %"class.std::mersenne_twister_engine" }
%"class.std::mersenne_twister_engine" = type { [624 x i64], i64 }
%"class.std::uniform_int_distribution" = type { %"struct.std::uniform_int_distribution<>::param_type" }
%"struct.std::uniform_int_distribution<>::param_type" = type { i32, i32 }
%"class.std::lock_guard" = type { ptr }

@cout_mutex = external dso_local global { %union.pthread_mutex_t }, align 8
@global_counter = external dso_local global { i32 }, align 4
@.str.19 = external hidden unnamed_addr constant [91 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [18 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.25 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [12 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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: nounwind
declare i64 @_ZNSt6chrono3_V212system_clock3nowEv() #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6ctrack63vCTRACK_VERSION_MAJOR_CTRACK_VERSION_MINOR_CTRACK_VERSION_PATCH12EventHandlerC2EiPKcS3_NSt6chrono10time_pointINS4_3_V212system_clockENS4_8durationIlSt5ratioILl1ELl1000000000EEEEEE(ptr noundef nonnull align 8 dereferenceable(60), i32 noundef, ptr noundef, ptr noundef, i64) unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z14recursive_worki(i32 noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z17nested_function_ai(i32 noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z17nested_function_bi(i32 noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z17complex_operationi(i32 noundef %0) #2 personality ptr @__gxx_personality_v0 {
  %2 = alloca i32, align 4
  %3 = alloca %"class.ctrack::vCTRACK_VERSION_MAJOR_CTRACK_VERSION_MINOR_CTRACK_VERSION_PATCH::EventHandler", align 8
  %4 = alloca %"class.std::chrono::time_point", align 8
  %5 = alloca %"class.std::random_device", align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca %"class.std::mersenne_twister_engine", align 8
  %9 = alloca %"class.std::uniform_int_distribution", align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca %"class.std::lock_guard", align 8
  store i32 %0, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 64, ptr %3) #7
  %13 = call i64 @_ZNSt6chrono3_V212system_clock3nowEv() #7
  %14 = getelementptr inbounds %"class.std::chrono::time_point", ptr %4, i32 0, i32 0
  %15 = getelementptr inbounds %"class.std::chrono::duration", ptr %14, i32 0, i32 0
  store i64 %13, ptr %15, align 8
  %16 = getelementptr inbounds %"class.std::chrono::time_point", ptr %4, i32 0, i32 0
  %17 = getelementptr inbounds %"class.std::chrono::duration", ptr %16, i32 0, i32 0
  %18 = load i64, ptr %17, align 8
  call void @_ZN6ctrack63vCTRACK_VERSION_MAJOR_CTRACK_VERSION_MINOR_CTRACK_VERSION_PATCH12EventHandlerC2EiPKcS3_NSt6chrono10time_pointINS4_3_V212system_clockENS4_8durationIlSt5ratioILl1ELl1000000000EEEEEE(ptr noundef nonnull align 8 dereferenceable(60) %3, i32 noundef 45, ptr noundef @.str.19, ptr noundef @.str.24, i64 %18)
  call void @llvm.lifetime.start.p0(i64 5000, ptr %5) #7
  invoke void @_ZNSt13random_deviceC2Ev(ptr noundef nonnull align 8 dereferenceable(5000) %5)
          to label %19 unwind label %29

19:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 5000, ptr %8) #7
  %20 = invoke noundef i32 @_ZNSt13random_deviceclEv(ptr noundef nonnull align 8 dereferenceable(5000) %5)
          to label %21 unwind label %33

21:                                               ; preds = %19
  %22 = zext i32 %20 to i64
  invoke void @_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEC2Em(ptr noundef nonnull align 8 dereferenceable(5000) %8, i64 noundef %22)
          to label %23 unwind label %33

23:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  invoke void @_ZNSt24uniform_int_distributionIiEC2Eii(ptr noundef nonnull align 4 dereferenceable(8) %9, i32 noundef 1, i32 noundef 10)
          to label %24 unwind label %37

24:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %25

25:                                               ; preds = %65, %24
  %26 = load i32, ptr %10, align 4, !tbaa !5
  %27 = icmp slt i32 %26, 5
  br i1 %27, label %41, label %28

28:                                               ; preds = %25
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %68

29:                                               ; preds = %1
  %30 = landingpad { ptr, i32 }
          cleanup
  %31 = extractvalue { ptr, i32 } %30, 0
  store ptr %31, ptr %6, align 8
  %32 = extractvalue { ptr, i32 } %30, 1
  store i32 %32, ptr %7, align 4
  br label %90

33:                                               ; preds = %21, %19
  %34 = landingpad { ptr, i32 }
          cleanup
  %35 = extractvalue { ptr, i32 } %34, 0
  store ptr %35, ptr %6, align 8
  %36 = extractvalue { ptr, i32 } %34, 1
  store i32 %36, ptr %7, align 4
  br label %89

37:                                               ; preds = %23
  %38 = landingpad { ptr, i32 }
          cleanup
  %39 = extractvalue { ptr, i32 } %38, 0
  store ptr %39, ptr %6, align 8
  %40 = extractvalue { ptr, i32 } %38, 1
  store i32 %40, ptr %7, align 4
  br label %88

41:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  %42 = invoke noundef i32 @_ZNSt24uniform_int_distributionIiEclISt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEEEiRT_(ptr noundef nonnull align 4 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(5000) %8)
          to label %43 unwind label %50

43:                                               ; preds = %41
  store i32 %42, ptr %11, align 4, !tbaa !5
  %44 = load i32, ptr %11, align 4, !tbaa !5
  %45 = srem i32 %44, 2
  %46 = icmp eq i32 %45, 0
  br i1 %46, label %47, label %54

47:                                               ; preds = %43
  %48 = load i32, ptr %11, align 4, !tbaa !5
  invoke void @_Z17nested_function_ai(i32 noundef %48)
          to label %49 unwind label %50

49:                                               ; preds = %47
  br label %57

50:                                               ; preds = %60, %54, %47, %41
  %51 = landingpad { ptr, i32 }
          cleanup
  %52 = extractvalue { ptr, i32 } %51, 0
  store ptr %52, ptr %6, align 8
  %53 = extractvalue { ptr, i32 } %51, 1
  store i32 %53, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %88

54:                                               ; preds = %43
  %55 = load i32, ptr %11, align 4, !tbaa !5
  invoke void @_Z17nested_function_bi(i32 noundef %55)
          to label %56 unwind label %50

56:                                               ; preds = %54
  br label %57

57:                                               ; preds = %56, %49
  %58 = load i32, ptr %11, align 4, !tbaa !5
  %59 = icmp eq i32 %58, 7
  br i1 %59, label %60, label %63

60:                                               ; preds = %57
  %61 = invoke noundef i32 @_Z14recursive_worki(i32 noundef 20)
          to label %62 unwind label %50

62:                                               ; preds = %60
  br label %63

63:                                               ; preds = %62, %57
  %64 = call noundef i32 @_ZNSt13__atomic_baseIiE9fetch_addEiSt12memory_order(ptr noundef nonnull align 4 dereferenceable(4) @global_counter, i32 noundef 1, i32 noundef 0) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %65

65:                                               ; preds = %63
  %66 = load i32, ptr %10, align 4, !tbaa !5
  %67 = add nsw i32 %66, 1
  store i32 %67, ptr %10, align 4, !tbaa !5
  br label %25, !llvm.loop !9

68:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  invoke void @_ZNSt10lock_guardISt5mutexEC2ERS0_(ptr noundef nonnull align 8 dereferenceable(8) %12, ptr noundef nonnull align 8 dereferenceable(40) @cout_mutex)
          to label %69 unwind label %79

69:                                               ; preds = %68
  %70 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.25)
          to label %71 unwind label %83

71:                                               ; preds = %69
  %72 = load i32, ptr %2, align 4, !tbaa !5
  %73 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %70, i32 noundef %72)
          to label %74 unwind label %83

74:                                               ; preds = %71
  %75 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %73, ptr noundef @.str.26)
          to label %76 unwind label %83

76:                                               ; preds = %74
  %77 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %75, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %78 unwind label %83

78:                                               ; preds = %76
  call void @_ZNSt10lock_guardISt5mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 5000, ptr %8) #7
  call void @_ZNSt13random_deviceD2Ev(ptr noundef nonnull align 8 dereferenceable(5000) %5) #7
  call void @llvm.lifetime.end.p0(i64 5000, ptr %5) #7
  call void @_ZN6ctrack63vCTRACK_VERSION_MAJOR_CTRACK_VERSION_MINOR_CTRACK_VERSION_PATCH12EventHandlerD2Ev(ptr noundef nonnull align 8 dereferenceable(60) %3) #7
  call void @llvm.lifetime.end.p0(i64 64, ptr %3) #7
  ret void

79:                                               ; preds = %68
  %80 = landingpad { ptr, i32 }
          cleanup
  %81 = extractvalue { ptr, i32 } %80, 0
  store ptr %81, ptr %6, align 8
  %82 = extractvalue { ptr, i32 } %80, 1
  store i32 %82, ptr %7, align 4
  br label %87

83:                                               ; preds = %76, %74, %71, %69
  %84 = landingpad { ptr, i32 }
          cleanup
  %85 = extractvalue { ptr, i32 } %84, 0
  store ptr %85, ptr %6, align 8
  %86 = extractvalue { ptr, i32 } %84, 1
  store i32 %86, ptr %7, align 4
  call void @_ZNSt10lock_guardISt5mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %12) #7
  br label %87

87:                                               ; preds = %83, %79
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  br label %88

88:                                               ; preds = %87, %50, %37
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  br label %89

89:                                               ; preds = %88, %33
  call void @llvm.lifetime.end.p0(i64 5000, ptr %8) #7
  call void @_ZNSt13random_deviceD2Ev(ptr noundef nonnull align 8 dereferenceable(5000) %5) #7
  br label %90

90:                                               ; preds = %89, %29
  call void @llvm.lifetime.end.p0(i64 5000, ptr %5) #7
  call void @_ZN6ctrack63vCTRACK_VERSION_MAJOR_CTRACK_VERSION_MINOR_CTRACK_VERSION_PATCH12EventHandlerD2Ev(ptr noundef nonnull align 8 dereferenceable(60) %3) #7
  call void @llvm.lifetime.end.p0(i64 64, ptr %3) #7
  br label %91

91:                                               ; preds = %90
  %92 = load ptr, ptr %6, align 8
  %93 = load i32, ptr %7, align 4
  %94 = insertvalue { ptr, i32 } poison, ptr %92, 0
  %95 = insertvalue { ptr, i32 } %94, i32 %93, 1
  resume { ptr, i32 } %95
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEC2Em(ptr noundef nonnull align 8 dereferenceable(5000), i64 noundef) unnamed_addr #2 align 2

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #5

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #6

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #5

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

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

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

!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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.ctrack::vCTRACK_VERSION_MAJOR_CTRACK_VERSION_MINOR_CTRACK_VERSION_PATCH::EventHandler" = type <{ %"class.std::chrono::time_point", i32, i32, %"class.std::basic_string_view", %"class.std::basic_string_view", i32, i32, i32, [4 x i8] }>
%"class.std::chrono::time_point" = type { %"class.std::chrono::duration" }
%"class.std::chrono::duration" = type { i64 }
%"class.std::basic_string_view" = type { i64, ptr }
%"class.std::random_device" = type { %union.anon.22 }
%union.anon.22 = type { %"class.std::mersenne_twister_engine" }
%"class.std::mersenne_twister_engine" = type { [624 x i64], i64 }
%"class.std::uniform_int_distribution" = type { %"struct.std::uniform_int_distribution<>::param_type" }
%"struct.std::uniform_int_distribution<>::param_type" = type { i32, i32 }
%"class.std::lock_guard" = type { ptr }

@cout_mutex = external dso_local global { %union.pthread_mutex_t }, align 8
@global_counter = external dso_local global { i32 }, align 4
@.str.19 = external hidden unnamed_addr constant [91 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [18 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.25 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [12 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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: nounwind
declare i64 @_ZNSt6chrono3_V212system_clock3nowEv() local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6ctrack63vCTRACK_VERSION_MAJOR_CTRACK_VERSION_MINOR_CTRACK_VERSION_PATCH12EventHandlerC2EiPKcS3_NSt6chrono10time_pointINS4_3_V212system_clockENS4_8durationIlSt5ratioILl1ELl1000000000EEEEEE(ptr noundef nonnull align 8 dereferenceable(60), i32 noundef, ptr noundef, ptr noundef, i64) unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z14recursive_worki(i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z17nested_function_ai(i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z17nested_function_bi(i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z17complex_operationi(i32 noundef %0) local_unnamed_addr #2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.ctrack::vCTRACK_VERSION_MAJOR_CTRACK_VERSION_MINOR_CTRACK_VERSION_PATCH::EventHandler", align 8
  %3 = alloca %"class.std::random_device", align 8
  %4 = alloca %"class.std::mersenne_twister_engine", align 8
  %5 = alloca %"class.std::uniform_int_distribution", align 4
  %6 = alloca %"class.std::lock_guard", align 8
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %2) #7
  %7 = tail call i64 @_ZNSt6chrono3_V212system_clock3nowEv() #7
  call void @_ZN6ctrack63vCTRACK_VERSION_MAJOR_CTRACK_VERSION_MINOR_CTRACK_VERSION_PATCH12EventHandlerC2EiPKcS3_NSt6chrono10time_pointINS4_3_V212system_clockENS4_8durationIlSt5ratioILl1ELl1000000000EEEEEE(ptr noundef nonnull align 8 dereferenceable(60) %2, i32 noundef 45, ptr noundef nonnull @.str.19, ptr noundef nonnull @.str.24, i64 %7)
  call void @llvm.lifetime.start.p0(i64 5000, ptr nonnull %3) #7
  invoke void @_ZNSt13random_deviceC2Ev(ptr noundef nonnull align 8 dereferenceable(5000) %3)
          to label %8 unwind label %14

8:                                                ; preds = %1
  call void @llvm.lifetime.start.p0(i64 5000, ptr nonnull %4) #7
  %9 = invoke noundef i32 @_ZNSt13random_deviceclEv(ptr noundef nonnull align 8 dereferenceable(5000) %3)
          to label %10 unwind label %16

10:                                               ; preds = %8
  %11 = zext i32 %9 to i64
  invoke void @_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEC2Em(ptr noundef nonnull align 8 dereferenceable(5000) %4, i64 noundef %11)
          to label %12 unwind label %16

12:                                               ; preds = %10
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  invoke void @_ZNSt24uniform_int_distributionIiEC2Eii(ptr noundef nonnull align 4 dereferenceable(8) %5, i32 noundef 1, i32 noundef 10)
          to label %.preheader.preheader unwind label %18

.preheader.preheader:                             ; preds = %12
  %13 = invoke noundef i32 @_ZNSt24uniform_int_distributionIiEclISt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEEEiRT_(ptr noundef nonnull align 4 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(5000) %4)
          to label %20 unwind label %24

14:                                               ; preds = %1
  %15 = landingpad { ptr, i32 }
          cleanup
  br label %93

16:                                               ; preds = %10, %8
  %17 = landingpad { ptr, i32 }
          cleanup
  br label %92

18:                                               ; preds = %12
  %19 = landingpad { ptr, i32 }
          cleanup
  br label %91

20:                                               ; preds = %.preheader.preheader
  %21 = and i32 %13, 1
  %22 = icmp eq i32 %21, 0
  br i1 %22, label %23, label %26

23:                                               ; preds = %20
  invoke void @_Z17nested_function_ai(i32 noundef %13)
          to label %27 unwind label %24

24:                                               ; preds = %73, %70, %69, %.preheader.4, %62, %59, %58, %.preheader.3, %51, %48, %47, %.preheader.2, %40, %37, %36, %.preheader.1, %29, %26, %23, %.preheader.preheader
  %25 = landingpad { ptr, i32 }
          cleanup
  br label %91

26:                                               ; preds = %20
  invoke void @_Z17nested_function_bi(i32 noundef %13)
          to label %27 unwind label %24

27:                                               ; preds = %26, %23
  %28 = icmp eq i32 %13, 7
  br i1 %28, label %29, label %.preheader.1

29:                                               ; preds = %27
  %30 = invoke noundef i32 @_Z14recursive_worki(i32 noundef 20)
          to label %.preheader.1 unwind label %24

.preheader.1:                                     ; preds = %29, %27
  %31 = call noundef i32 @_ZNSt13__atomic_baseIiE9fetch_addEiSt12memory_order(ptr noundef nonnull align 4 dereferenceable(4) @global_counter, i32 noundef 1, i32 noundef 0) #7
  %32 = invoke noundef i32 @_ZNSt24uniform_int_distributionIiEclISt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEEEiRT_(ptr noundef nonnull align 4 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(5000) %4)
          to label %33 unwind label %24

33:                                               ; preds = %.preheader.1
  %34 = and i32 %32, 1
  %35 = icmp eq i32 %34, 0
  br i1 %35, label %37, label %36

36:                                               ; preds = %33
  invoke void @_Z17nested_function_bi(i32 noundef %32)
          to label %38 unwind label %24

37:                                               ; preds = %33
  invoke void @_Z17nested_function_ai(i32 noundef %32)
          to label %38 unwind label %24

38:                                               ; preds = %37, %36
  %39 = icmp eq i32 %32, 7
  br i1 %39, label %40, label %.preheader.2

40:                                               ; preds = %38
  %41 = invoke noundef i32 @_Z14recursive_worki(i32 noundef 20)
          to label %.preheader.2 unwind label %24

.preheader.2:                                     ; preds = %40, %38
  %42 = call noundef i32 @_ZNSt13__atomic_baseIiE9fetch_addEiSt12memory_order(ptr noundef nonnull align 4 dereferenceable(4) @global_counter, i32 noundef 1, i32 noundef 0) #7
  %43 = invoke noundef i32 @_ZNSt24uniform_int_distributionIiEclISt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEEEiRT_(ptr noundef nonnull align 4 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(5000) %4)
          to label %44 unwind label %24

44:                                               ; preds = %.preheader.2
  %45 = and i32 %43, 1
  %46 = icmp eq i32 %45, 0
  br i1 %46, label %48, label %47

47:                                               ; preds = %44
  invoke void @_Z17nested_function_bi(i32 noundef %43)
          to label %49 unwind label %24

48:                                               ; preds = %44
  invoke void @_Z17nested_function_ai(i32 noundef %43)
          to label %49 unwind label %24

49:                                               ; preds = %48, %47
  %50 = icmp eq i32 %43, 7
  br i1 %50, label %51, label %.preheader.3

51:                                               ; preds = %49
  %52 = invoke noundef i32 @_Z14recursive_worki(i32 noundef 20)
          to label %.preheader.3 unwind label %24

.preheader.3:                                     ; preds = %51, %49
  %53 = call noundef i32 @_ZNSt13__atomic_baseIiE9fetch_addEiSt12memory_order(ptr noundef nonnull align 4 dereferenceable(4) @global_counter, i32 noundef 1, i32 noundef 0) #7
  %54 = invoke noundef i32 @_ZNSt24uniform_int_distributionIiEclISt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEEEiRT_(ptr noundef nonnull align 4 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(5000) %4)
          to label %55 unwind label %24

55:                                               ; preds = %.preheader.3
  %56 = and i32 %54, 1
  %57 = icmp eq i32 %56, 0
  br i1 %57, label %59, label %58

58:                                               ; preds = %55
  invoke void @_Z17nested_function_bi(i32 noundef %54)
          to label %60 unwind label %24

59:                                               ; preds = %55
  invoke void @_Z17nested_function_ai(i32 noundef %54)
          to label %60 unwind label %24

60:                                               ; preds = %59, %58
  %61 = icmp eq i32 %54, 7
  br i1 %61, label %62, label %.preheader.4

62:                                               ; preds = %60
  %63 = invoke noundef i32 @_Z14recursive_worki(i32 noundef 20)
          to label %.preheader.4 unwind label %24

.preheader.4:                                     ; preds = %62, %60
  %64 = call noundef i32 @_ZNSt13__atomic_baseIiE9fetch_addEiSt12memory_order(ptr noundef nonnull align 4 dereferenceable(4) @global_counter, i32 noundef 1, i32 noundef 0) #7
  %65 = invoke noundef i32 @_ZNSt24uniform_int_distributionIiEclISt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEEEiRT_(ptr noundef nonnull align 4 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(5000) %4)
          to label %66 unwind label %24

66:                                               ; preds = %.preheader.4
  %67 = and i32 %65, 1
  %68 = icmp eq i32 %67, 0
  br i1 %68, label %70, label %69

69:                                               ; preds = %66
  invoke void @_Z17nested_function_bi(i32 noundef %65)
          to label %71 unwind label %24

70:                                               ; preds = %66
  invoke void @_Z17nested_function_ai(i32 noundef %65)
          to label %71 unwind label %24

71:                                               ; preds = %70, %69
  %72 = icmp eq i32 %65, 7
  br i1 %72, label %73, label %75

73:                                               ; preds = %71
  %74 = invoke noundef i32 @_Z14recursive_worki(i32 noundef 20)
          to label %75 unwind label %24

75:                                               ; preds = %73, %71
  %76 = call noundef i32 @_ZNSt13__atomic_baseIiE9fetch_addEiSt12memory_order(ptr noundef nonnull align 4 dereferenceable(4) @global_counter, i32 noundef 1, i32 noundef 0) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #7
  invoke void @_ZNSt10lock_guardISt5mutexEC2ERS0_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(40) @cout_mutex)
          to label %77 unwind label %86

77:                                               ; preds = %75
  %78 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.25)
          to label %79 unwind label %88

79:                                               ; preds = %77
  %80 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %78, i32 noundef %0)
          to label %81 unwind label %88

81:                                               ; preds = %79
  %82 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %80, ptr noundef nonnull @.str.26)
          to label %83 unwind label %88

83:                                               ; preds = %81
  %84 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %82, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %85 unwind label %88

85:                                               ; preds = %83
  call void @_ZNSt10lock_guardISt5mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 5000, ptr nonnull %4) #7
  call void @_ZNSt13random_deviceD2Ev(ptr noundef nonnull align 8 dereferenceable(5000) %3) #7
  call void @llvm.lifetime.end.p0(i64 5000, ptr nonnull %3) #7
  call void @_ZN6ctrack63vCTRACK_VERSION_MAJOR_CTRACK_VERSION_MINOR_CTRACK_VERSION_PATCH12EventHandlerD2Ev(ptr noundef nonnull align 8 dereferenceable(60) %2) #7
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %2) #7
  ret void

86:                                               ; preds = %75
  %87 = landingpad { ptr, i32 }
          cleanup
  br label %90

88:                                               ; preds = %83, %81, %79, %77
  %89 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt10lock_guardISt5mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %6) #7
  br label %90

90:                                               ; preds = %88, %86
  %.pn = phi { ptr, i32 } [ %89, %88 ], [ %87, %86 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #7
  br label %91

91:                                               ; preds = %90, %24, %18
  %.pn14 = phi { ptr, i32 } [ %25, %24 ], [ %.pn, %90 ], [ %19, %18 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  br label %92

92:                                               ; preds = %91, %16
  %.pn14.pn = phi { ptr, i32 } [ %.pn14, %91 ], [ %17, %16 ]
  call void @llvm.lifetime.end.p0(i64 5000, ptr nonnull %4) #7
  call void @_ZNSt13random_deviceD2Ev(ptr noundef nonnull align 8 dereferenceable(5000) %3) #7
  br label %93

93:                                               ; preds = %92, %14
  %.pn14.pn.pn = phi { ptr, i32 } [ %.pn14.pn, %92 ], [ %15, %14 ]
  call void @llvm.lifetime.end.p0(i64 5000, ptr nonnull %3) #7
  call void @_ZN6ctrack63vCTRACK_VERSION_MAJOR_CTRACK_VERSION_MINOR_CTRACK_VERSION_PATCH12EventHandlerD2Ev(ptr noundef nonnull align 8 dereferenceable(60) %2) #7
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %2) #7
  resume { ptr, i32 } %.pn14.pn.pn
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEC2Em(ptr noundef nonnull align 8 dereferenceable(5000), i64 noundef) unnamed_addr #2 align 2

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

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

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

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

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #6

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #5

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

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

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

!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)"}


; Effective O3 passes: GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,LoopSimplifyPass,SROAPass,SimplifyCFGPass,TailCallElimPass