; LLVM IR from wangziqi2013/EpochManager :: test/local_em_test.ll (Z11FactoryTestv)

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

@.str = external hidden unnamed_addr constant [12 x i8], align 1
@stderr = external global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [34 x i8], align 1
@stdout = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [31 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z11FactoryTestv() #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca ptr, align 8
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  call void @_Z13PrintTestNamePKc(ptr noundef @.str)
  br label %4

4:                                                ; preds = %0
  %5 = load ptr, ptr @stderr, align 8, !tbaa !5
  %6 = call noundef i32 @_Z20GetOptimalCoreNumberv()
  %7 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %5, ptr noundef @.str.1, ptr noundef @.str, i32 noundef %6) #7
  %8 = load ptr, ptr @stdout, align 8, !tbaa !5
  %9 = call i32 @fflush(ptr noundef %8)
  br label %10

10:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #7
  %11 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 136) #8
  invoke void @_ZN12LocalWriteEMIN7peloton5index11AtomicStackImE4NodeEEC2Em(ptr noundef nonnull align 8 dereferenceable(136) %11, i64 noundef 8)
          to label %12 unwind label %35

12:                                               ; preds = %10
  store ptr %11, ptr %1, align 8, !tbaa !5
  br label %13

13:                                               ; preds = %12
  %14 = load ptr, ptr @stderr, align 8, !tbaa !5
  %15 = load ptr, ptr %1, align 8, !tbaa !5
  %16 = call noundef zeroext i1 @_ZN12LocalWriteEMIN7peloton5index11AtomicStackImE4NodeEE9HasExitedEv(ptr noundef nonnull align 8 dereferenceable(136) %15)
  %17 = zext i1 %16 to i32
  %18 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %14, ptr noundef @.str.2, ptr noundef @.str, i32 noundef %17) #7
  %19 = load ptr, ptr @stdout, align 8, !tbaa !5
  %20 = call i32 @fflush(ptr noundef %19)
  br label %21

21:                                               ; preds = %13
  br label %22

22:                                               ; preds = %21
  br label %23

23:                                               ; preds = %22
  %24 = load ptr, ptr @stderr, align 8, !tbaa !5
  %25 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %24, ptr noundef @.str.3, ptr noundef @.str, i64 noundef 64) #7
  %26 = load ptr, ptr @stdout, align 8, !tbaa !5
  %27 = call i32 @fflush(ptr noundef %26)
  br label %28

28:                                               ; preds = %23
  br label %29

29:                                               ; preds = %28
  %30 = load ptr, ptr %1, align 8, !tbaa !5
  call void @_ZN12LocalWriteEMIN7peloton5index11AtomicStackImE4NodeEE10SignalExitEv(ptr noundef nonnull align 8 dereferenceable(136) %30)
  %31 = load ptr, ptr %1, align 8, !tbaa !5
  %32 = icmp eq ptr %31, null
  br i1 %32, label %34, label %33

33:                                               ; preds = %29
  call void @_ZN12LocalWriteEMIN7peloton5index11AtomicStackImE4NodeEED2Ev(ptr noundef nonnull align 8 dereferenceable(136) %31) #7
  call void @_ZdlPvm(ptr noundef %31, i64 noundef 136) #9
  br label %34

34:                                               ; preds = %33, %29
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #7
  ret void

35:                                               ; preds = %10
  %36 = landingpad { ptr, i32 }
          cleanup
  %37 = extractvalue { ptr, i32 } %36, 0
  store ptr %37, ptr %2, align 8
  %38 = extractvalue { ptr, i32 } %36, 1
  store i32 %38, ptr %3, align 4
  call void @_ZdlPvm(ptr noundef %11, i64 noundef 136) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #7
  br label %39

39:                                               ; preds = %35
  %40 = load ptr, ptr %2, align 8
  %41 = load i32, ptr %3, align 4
  %42 = insertvalue { ptr, i32 } poison, ptr %40, 0
  %43 = insertvalue { ptr, i32 } %42, i32 %41, 1
  resume { ptr, i32 } %43
}

declare void @_Z13PrintTestNamePKc(ptr noundef) #1

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #2

declare noundef i32 @_Z20GetOptimalCoreNumberv() #1

declare i32 @fflush(ptr noundef) #1

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

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

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN12LocalWriteEMIN7peloton5index11AtomicStackImE4NodeEE9HasExitedEv(ptr noundef nonnull align 8 dereferenceable(136)) #6 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN12LocalWriteEMIN7peloton5index11AtomicStackImE4NodeEE10SignalExitEv(ptr noundef nonnull align 8 dereferenceable(136)) #6 align 2

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

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


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

@.str = external hidden unnamed_addr constant [12 x i8], align 1
@stderr = external local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [34 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [31 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z11FactoryTestv() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  tail call void @_Z13PrintTestNamePKc(ptr noundef nonnull @.str)
  %1 = load ptr, ptr @stderr, align 8, !tbaa !5
  %2 = tail call noundef i32 @_Z20GetOptimalCoreNumberv()
  %3 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %1, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str, i32 noundef %2) #6
  %4 = load ptr, ptr @stdout, align 8, !tbaa !5
  %5 = tail call i32 @fflush(ptr noundef %4)
  %6 = tail call noalias noundef nonnull dereferenceable(136) ptr @_Znwm(i64 noundef 136) #7
  invoke void @_ZN12LocalWriteEMIN7peloton5index11AtomicStackImE4NodeEEC2Em(ptr noundef nonnull align 8 dereferenceable(136) %6, i64 noundef 8)
          to label %7 unwind label %18

7:                                                ; preds = %0
  %8 = load ptr, ptr @stderr, align 8, !tbaa !5
  %9 = tail call noundef zeroext i1 @_ZN12LocalWriteEMIN7peloton5index11AtomicStackImE4NodeEE9HasExitedEv(ptr noundef nonnull align 8 dereferenceable(136) %6)
  %10 = zext i1 %9 to i32
  %11 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %8, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str, i32 noundef %10) #6
  %12 = load ptr, ptr @stdout, align 8, !tbaa !5
  %13 = tail call i32 @fflush(ptr noundef %12)
  %14 = load ptr, ptr @stderr, align 8, !tbaa !5
  %15 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %14, ptr noundef nonnull @.str.3, ptr noundef nonnull @.str, i64 noundef 64) #6
  %16 = load ptr, ptr @stdout, align 8, !tbaa !5
  %17 = tail call i32 @fflush(ptr noundef %16)
  tail call void @_ZN12LocalWriteEMIN7peloton5index11AtomicStackImE4NodeEE10SignalExitEv(ptr noundef nonnull align 8 dereferenceable(136) %6)
  tail call void @_ZN12LocalWriteEMIN7peloton5index11AtomicStackImE4NodeEED2Ev(ptr noundef nonnull align 8 dereferenceable(136) %6) #8
  tail call void @_ZdlPvm(ptr noundef nonnull %6, i64 noundef 136) #9
  ret void

18:                                               ; preds = %0
  %19 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdlPvm(ptr noundef nonnull %6, i64 noundef 136) #9
  resume { ptr, i32 } %19
}

declare void @_Z13PrintTestNamePKc(ptr noundef) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #2

declare noundef i32 @_Z20GetOptimalCoreNumberv() local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i32 @fflush(ptr nocapture noundef) local_unnamed_addr #2

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

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN12LocalWriteEMIN7peloton5index11AtomicStackImE4NodeEE9HasExitedEv(ptr noundef nonnull align 8 dereferenceable(136)) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN12LocalWriteEMIN7peloton5index11AtomicStackImE4NodeEE10SignalExitEv(ptr noundef nonnull align 8 dereferenceable(136)) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN12LocalWriteEMIN7peloton5index11AtomicStackImE4NodeEED2Ev(ptr noundef nonnull align 8 dereferenceable(136)) unnamed_addr #5 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 = { "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 = { nofree 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 = { 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 #4 = { nobuiltin nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { cold nounwind }
attributes #7 = { builtin allocsize(0) }
attributes #8 = { nounwind }
attributes #9 = { builtin nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


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