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

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

@stderr = external global ptr, align 8
@stdout = external global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [26 x i8], align 1

declare void @_Z13PrintTestNamePKc(ptr noundef) #0

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

declare i32 @fflush(ptr noundef) #0

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN12LocalWriteEMIN7peloton5index11AtomicStackImE4NodeEEC2Em(ptr noundef nonnull align 8 dereferenceable(136), i64 noundef) unnamed_addr #4 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 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) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z10ThreadTestv() #4 personality ptr @__gxx_personality_v0 {
  %1 = alloca ptr, align 8
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  call void @_Z13PrintTestNamePKc(ptr noundef @.str.4)
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #8
  %5 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 136) #9
  invoke void @_ZN12LocalWriteEMIN7peloton5index11AtomicStackImE4NodeEEC2Em(ptr noundef nonnull align 8 dereferenceable(136) %5, i64 noundef 8)
          to label %6 unwind label %12

6:                                                ; preds = %0
  store ptr %5, ptr %1, align 8, !tbaa !5
  %7 = load ptr, ptr %1, align 8, !tbaa !5
  call void @_ZN12LocalWriteEMIN7peloton5index11AtomicStackImE4NodeEE13StartGCThreadEv(ptr noundef nonnull align 8 dereferenceable(136) %7)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #8
  store i32 0, ptr %4, align 4, !tbaa !9
  br label %8

8:                                                ; preds = %25, %6
  %9 = load i32, ptr %4, align 4, !tbaa !9
  %10 = icmp slt i32 %9, 3
  br i1 %10, label %16, label %11

11:                                               ; preds = %8
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  br label %28

12:                                               ; preds = %0
  %13 = landingpad { ptr, i32 }
          cleanup
  %14 = extractvalue { ptr, i32 } %13, 0
  store ptr %14, ptr %2, align 8
  %15 = extractvalue { ptr, i32 } %13, 1
  store i32 %15, ptr %3, align 4
  call void @_ZdlPvm(ptr noundef %5, i64 noundef 136) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #8
  br label %56

16:                                               ; preds = %8
  br label %17

17:                                               ; preds = %16
  %18 = load ptr, ptr @stderr, align 8, !tbaa !5
  %19 = load i32, ptr %4, align 4, !tbaa !9
  %20 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %18, ptr noundef @.str.5, ptr noundef @.str.4, i32 noundef %19) #8
  %21 = load ptr, ptr @stdout, align 8, !tbaa !5
  %22 = call i32 @fflush(ptr noundef %21)
  br label %23

23:                                               ; preds = %17
  br label %24

24:                                               ; preds = %23
  call void @_Z8SleepForm(i64 noundef 1000)
  br label %25

25:                                               ; preds = %24
  %26 = load i32, ptr %4, align 4, !tbaa !9
  %27 = add nsw i32 %26, 1
  store i32 %27, ptr %4, align 4, !tbaa !9
  br label %8, !llvm.loop !11

28:                                               ; preds = %11
  br label %29

29:                                               ; preds = %28
  %30 = load ptr, ptr @stderr, align 8, !tbaa !5
  %31 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %30, ptr noundef @.str.6, ptr noundef @.str.4) #8
  %32 = load ptr, ptr @stdout, align 8, !tbaa !5
  %33 = call i32 @fflush(ptr noundef %32)
  br label %34

34:                                               ; preds = %29
  br label %35

35:                                               ; preds = %34
  br label %36

36:                                               ; preds = %35
  %37 = load ptr, ptr @stderr, align 8, !tbaa !5
  %38 = load ptr, ptr %1, align 8, !tbaa !5
  %39 = call noundef i64 @_ZN12LocalWriteEMIN7peloton5index11AtomicStackImE4NodeEE22GetCurrentEpochCounterEv(ptr noundef nonnull align 8 dereferenceable(136) %38)
  %40 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %37, ptr noundef @.str.7, ptr noundef @.str.4, i64 noundef %39) #8
  %41 = load ptr, ptr @stdout, align 8, !tbaa !5
  %42 = call i32 @fflush(ptr noundef %41)
  br label %43

43:                                               ; preds = %36
  br label %44

44:                                               ; preds = %43
  %45 = load ptr, ptr %1, align 8, !tbaa !5
  %46 = icmp eq ptr %45, null
  br i1 %46, label %48, label %47

47:                                               ; preds = %44
  call void @_ZN12LocalWriteEMIN7peloton5index11AtomicStackImE4NodeEED2Ev(ptr noundef nonnull align 8 dereferenceable(136) %45) #8
  call void @_ZdlPvm(ptr noundef %45, i64 noundef 136) #10
  br label %48

48:                                               ; preds = %47, %44
  br label %49

49:                                               ; preds = %48
  %50 = load ptr, ptr @stderr, align 8, !tbaa !5
  %51 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %50, ptr noundef @.str.8, ptr noundef @.str.4) #8
  %52 = load ptr, ptr @stdout, align 8, !tbaa !5
  %53 = call i32 @fflush(ptr noundef %52)
  br label %54

54:                                               ; preds = %49
  br label %55

55:                                               ; preds = %54
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #8
  ret void

56:                                               ; preds = %12
  %57 = load ptr, ptr %2, align 8
  %58 = load i32, ptr %3, align 4
  %59 = insertvalue { ptr, i32 } poison, ptr %57, 0
  %60 = insertvalue { ptr, i32 } %59, i32 %58, 1
  resume { ptr, i32 } %60
}

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

declare void @_Z8SleepForm(i64 noundef) #0

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

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

@stderr = external local_unnamed_addr global ptr, align 8
@stdout = external local_unnamed_addr global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [26 x i8], align 1

declare void @_Z13PrintTestNamePKc(ptr noundef) local_unnamed_addr #0

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN12LocalWriteEMIN7peloton5index11AtomicStackImE4NodeEEC2Em(ptr noundef nonnull align 8 dereferenceable(136), i64 noundef) unnamed_addr #3 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 void @_ZN12LocalWriteEMIN7peloton5index11AtomicStackImE4NodeEED2Ev(ptr noundef nonnull align 8 dereferenceable(136)) unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z10ThreadTestv() local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  tail call void @_Z13PrintTestNamePKc(ptr noundef nonnull @.str.4)
  %1 = tail call noalias noundef nonnull dereferenceable(136) ptr @_Znwm(i64 noundef 136) #7
  invoke void @_ZN12LocalWriteEMIN7peloton5index11AtomicStackImE4NodeEEC2Em(ptr noundef nonnull align 8 dereferenceable(136) %1, i64 noundef 8)
          to label %2 unwind label %28

2:                                                ; preds = %0
  tail call void @_ZN12LocalWriteEMIN7peloton5index11AtomicStackImE4NodeEE13StartGCThreadEv(ptr noundef nonnull align 8 dereferenceable(136) %1)
  %3 = load ptr, ptr @stderr, align 8, !tbaa !5
  %4 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %3, ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.4, i32 noundef 0) #8
  %5 = load ptr, ptr @stdout, align 8, !tbaa !5
  %6 = tail call i32 @fflush(ptr noundef %5)
  tail call void @_Z8SleepForm(i64 noundef 1000)
  %7 = load ptr, ptr @stderr, align 8, !tbaa !5
  %8 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %7, ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.4, i32 noundef 1) #8
  %9 = load ptr, ptr @stdout, align 8, !tbaa !5
  %10 = tail call i32 @fflush(ptr noundef %9)
  tail call void @_Z8SleepForm(i64 noundef 1000)
  %11 = load ptr, ptr @stderr, align 8, !tbaa !5
  %12 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %11, ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.4, i32 noundef 2) #8
  %13 = load ptr, ptr @stdout, align 8, !tbaa !5
  %14 = tail call i32 @fflush(ptr noundef %13)
  tail call void @_Z8SleepForm(i64 noundef 1000)
  %15 = load ptr, ptr @stderr, align 8, !tbaa !5
  %16 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %15, ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.4) #8
  %17 = load ptr, ptr @stdout, align 8, !tbaa !5
  %18 = tail call i32 @fflush(ptr noundef %17)
  %19 = load ptr, ptr @stderr, align 8, !tbaa !5
  %20 = tail call noundef i64 @_ZN12LocalWriteEMIN7peloton5index11AtomicStackImE4NodeEE22GetCurrentEpochCounterEv(ptr noundef nonnull align 8 dereferenceable(136) %1)
  %21 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %19, ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.4, i64 noundef %20) #8
  %22 = load ptr, ptr @stdout, align 8, !tbaa !5
  %23 = tail call i32 @fflush(ptr noundef %22)
  tail call void @_ZN12LocalWriteEMIN7peloton5index11AtomicStackImE4NodeEED2Ev(ptr noundef nonnull align 8 dereferenceable(136) %1) #9
  tail call void @_ZdlPvm(ptr noundef nonnull %1, i64 noundef 136) #10
  %24 = load ptr, ptr @stderr, align 8, !tbaa !5
  %25 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %24, ptr noundef nonnull @.str.8, ptr noundef nonnull @.str.4) #8
  %26 = load ptr, ptr @stdout, align 8, !tbaa !5
  %27 = tail call i32 @fflush(ptr noundef %26)
  ret void

28:                                               ; preds = %0
  %29 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdlPvm(ptr noundef nonnull %1, i64 noundef 136) #10
  resume { ptr, i32 } %29
}

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

declare void @_Z8SleepForm(i64 noundef) local_unnamed_addr #0

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN12LocalWriteEMIN7peloton5index11AtomicStackImE4NodeEE22GetCurrentEpochCounterEv(ptr noundef nonnull align 8 dereferenceable(136)) local_unnamed_addr #6 align 2

attributes #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 = { 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 #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 = { 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 = { 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 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { builtin allocsize(0) }
attributes #8 = { cold nounwind }
attributes #9 = { nounwind }
attributes #10 = { 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,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,SROAPass,SimplifyCFGPass,TailCallElimPass